diff --git a/.fern/metadata.json b/.fern/metadata.json new file mode 100644 index 00000000..8e4096f6 --- /dev/null +++ b/.fern/metadata.json @@ -0,0 +1,16 @@ +{ + "cliVersion": "5.90.1", + "generatorName": "fernapi/fern-java-sdk", + "generatorVersion": "4.9.1", + "generatorConfig": { + "package-prefix": "com.whop.api", + "group": "com.whop.api", + "artifact": "whop-java" + }, + "originGitCommit": "a26a97d2d8ee29f78819a299712fb3b4086d634e", + "originGitCommitIsDirty": false, + "invokedBy": "ci", + "requestedVersion": "1.0.11", + "ciProvider": "unknown", + "sdkVersion": "1.0.11" +} \ No newline at end of file diff --git a/.fernignore b/.fernignore new file mode 100644 index 00000000..084a8ebb --- /dev/null +++ b/.fernignore @@ -0,0 +1 @@ +# Specify files that shouldn't be modified by Fern diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..190eed59 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: ci + +on: [push] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + compile: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up Java + id: setup-jre + uses: actions/setup-java@v1 + with: + java-version: "11" + architecture: x64 + + - name: Compile + run: ./gradlew compileJava + + test: + needs: [ compile ] + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up Java + id: setup-jre + uses: actions/setup-java@v1 + with: + java-version: "11" + architecture: x64 + + - name: Test + run: ./gradlew test diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..d4199abc --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +*.class +.project +.gradle +? +.classpath +.checkstyle +.settings +.node +build + +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ +out/ + +# Eclipse/IntelliJ APT +generated_src/ +generated_testSrc/ +generated/ + +bin +build \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..24cf9fa0 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,114 @@ +# Contributing + +Thanks for your interest in contributing to this SDK! This document provides guidelines for contributing to the project. + +## Getting Started + +### Prerequisites + +- Java 11+ +- Gradle + +### Installation + +Install the project dependencies: + +```bash +./gradlew build +``` + +### Building + +Build the project: + +```bash +./gradlew build +``` + +### Testing + +Run the test suite: + +```bash +./gradlew test +``` + +### Formatting + +Check and fix code style: + +```bash +./gradlew spotlessApply +``` + +## About Generated Code + +**Important**: Most files in this SDK are automatically generated by [Fern](https://buildwithfern.com) from the API definition. Direct modifications to generated files will be overwritten the next time the SDK is generated. + +### Generated Files + +The following directories contain generated code: +- `src/` - API client classes and types +- Most Java files in the project + +### How to Customize + +If you need to customize the SDK, you have two options: + +#### Option 1: Use `.fernignore` + +For custom code that should persist across SDK regenerations: + +1. Create a `.fernignore` file in the project root +2. Add file patterns for files you want to preserve (similar to `.gitignore` syntax) +3. Add your custom code to those files + +Files listed in `.fernignore` will not be overwritten when the SDK is regenerated. + +For more information, see the [Fern documentation on custom code](https://buildwithfern.com/learn/sdks/overview/custom-code). + +#### Option 2: Contribute to the Generator + +If you want to change how code is generated for all users of this SDK: + +1. The Java SDK generator lives in the [Fern repository](https://github.com/fern-api/fern) +2. Generator code is located at `generators/java-v2/` +3. Follow the [Fern contributing guidelines](https://github.com/fern-api/fern/blob/main/CONTRIBUTING.md) +4. Submit a pull request with your changes to the generator + +This approach is best for: +- Bug fixes in generated code +- New features that would benefit all users +- Improvements to code generation patterns + +## Making Changes + +### Workflow + +1. Create a new branch for your changes +2. Make your modifications +3. Run tests to ensure nothing breaks: `./gradlew test` +4. Run formatting: `./gradlew spotlessApply` +5. Build the project: `./gradlew build` +6. Commit your changes with a clear commit message +7. Push your branch and create a pull request + +### Commit Messages + +Write clear, descriptive commit messages that explain what changed and why. + +### Code Style + +This project uses automated code formatting. Run `./gradlew spotlessApply` before committing to ensure your code meets the project's style guidelines. + +## Questions or Issues? + +If you have questions or run into issues: + +1. Check the [Fern documentation](https://buildwithfern.com) +2. Search existing [GitHub issues](https://github.com/fern-api/fern/issues) +3. Open a new issue if your question hasn't been addressed + +## License + +By contributing to this project, you agree that your contributions will be licensed under the same license as the project. diff --git a/README.md b/README.md index 38d40b6c..ec958128 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,215 @@ -# whopsdk-java -The official Whop API SDK for Java, generated by Fern from sdks/fern in whopio/whop-monorepo. +# Whop Java Library + +[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fwhopio%2Fwhopsdk-java) + +The Whop Java library provides convenient access to the Whop APIs from Java. + +## Table of Contents + +- [Reference](#reference) +- [Usage](#usage) +- [Environments](#environments) +- [Base Url](#base-url) +- [Exception Handling](#exception-handling) +- [Advanced](#advanced) + - [Custom Client](#custom-client) + - [Retries](#retries) + - [Timeouts](#timeouts) + - [Custom Headers](#custom-headers) + - [Access Raw Response Data](#access-raw-response-data) +- [Contributing](#contributing) + +## Reference + +A full reference for this library is available [here](https://github.com/whopio/whopsdk-java/blob/HEAD/./reference.md). + +## Usage + +Instantiate and use the client with the following: + +```java +package com.example.usage; + +import com.whop.api.WhopApiClient; +import com.whop.api.resources.accesstokens.requests.CreateAccessTokensRequest; + +public class Example { + public static void main(String[] args) { + WhopApiClient client = WhopApiClient + .builder() + .token("") + .build(); + + client.accessTokens().create( + CreateAccessTokensRequest + .builder() + .build() + ); + } +} +``` + +## Environments + +This SDK allows you to configure different environments for API requests. + +```java +import com.whop.api.WhopApiClient; +import com.whop.api.core.Environment; + +WhopApiClient client = WhopApiClient + .builder() + .environment(Environment.Default) + .build(); +``` + +## Base Url + +You can set a custom base URL when constructing the client. + +```java +import com.whop.api.WhopApiClient; + +WhopApiClient client = WhopApiClient + .builder() + .url("https://example.com") + .build(); +``` + +## Exception Handling + +When the API returns a non-success status code (4xx or 5xx response), an API exception will be thrown. + +```java +import com.whop.api.core.WhopApiApiException; + +try{ + client.accessTokens().create(...); +} catch (WhopApiApiException e){ + // Do something with the API exception... +} +``` + +## Advanced + +### Custom Client + +This SDK is built to work with any instance of `OkHttpClient`. By default, if no client is provided, the SDK will construct one. +However, you can pass your own client like so: + +```java +import com.whop.api.WhopApiClient; +import okhttp3.OkHttpClient; + +OkHttpClient customClient = ...; + +WhopApiClient client = WhopApiClient + .builder() + .httpClient(customClient) + .build(); +``` + +### Retries + +The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long +as the request is deemed retryable and the number of retry attempts has not grown larger than the configured +retry limit (default: 2). Before defaulting to exponential backoff, the SDK will first attempt to respect +the `Retry-After` header (as either in seconds or as an HTTP date), and then the `X-RateLimit-Reset` header +(as a Unix timestamp in epoch seconds); failing both of those, it will fall back to exponential backoff. + +Which status codes are retried depends on the `retry-status-codes` generator configuration: + +**`legacy`** (current default): retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) + +Use the `maxRetries` client option to configure this behavior. + +```java +import com.whop.api.WhopApiClient; + +WhopApiClient client = WhopApiClient + .builder() + .maxRetries(1) + .build(); +``` + +### Timeouts + +The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level. +```java +import com.whop.api.WhopApiClient; +import com.whop.api.core.RequestOptions; + +// Client level +WhopApiClient client = WhopApiClient + .builder() + .timeout(60) + .build(); + +// Request level +client.accessTokens().create( + ..., + RequestOptions + .builder() + .timeout(60) + .build() +); +``` + +### Custom Headers + +The SDK allows you to add custom headers to requests. You can configure headers at the client level or at the request level. + +```java +import com.whop.api.WhopApiClient; +import com.whop.api.core.RequestOptions; + +// Client level +WhopApiClient client = WhopApiClient + .builder() + .addHeader("X-Custom-Header", "custom-value") + .addHeader("X-Request-Id", "abc-123") + .build(); +; + +// Request level +client.accessTokens().create( + ..., + RequestOptions + .builder() + .addHeader("X-Request-Header", "request-value") + .build() +); +``` + +### Access Raw Response Data + +The SDK provides access to raw response data, including headers, through the `withRawResponse()` method. +The `withRawResponse()` method returns a raw client that wraps all responses with `body()` and `headers()` methods. +(A normal client's `response` is identical to a raw client's `response.body()`.) + +```java +WhopApiHttpResponse response = client.accessTokens().withRawResponse().create(...); + +System.out.println(response.body()); +System.out.println(response.headers().get("X-My-Header")); +``` + +## Contributing + +While we value open-source contributions to this SDK, this library is generated programmatically. +Additions made directly to this library would have to be moved over to our generation code, +otherwise they would be overwritten upon the next generated release. Feel free to open a PR as +a proof of concept, but know that we will not be able to merge it as-is. We suggest opening +an issue first to discuss with us! + +On the other hand, contributions to the README are always very welcome! diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..ec80204f --- /dev/null +++ b/build.gradle @@ -0,0 +1,52 @@ +plugins { + id 'java-library' + id 'maven-publish' + id 'com.diffplug.spotless' version '6.11.0' +} + +repositories { + mavenCentral() + maven { + url 'https://s01.oss.sonatype.org/content/repositories/releases/' + } +} + +dependencies { + api 'com.squareup.okhttp3:okhttp:5.2.1' + api 'com.fasterxml.jackson.core:jackson-databind:2.18.6' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.6' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.6' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2' +} + + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +tasks.withType(Javadoc) { + failOnError false + options.addStringOption('Xdoclint:none', '-quiet') +} + +spotless { + java { + palantirJavaFormat() + } +} + + +java { + withSourcesJar() + withJavadocJar() +} + + +test { + useJUnitPlatform() + testLogging { + showStandardStreams = true + } +} + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..1b33c55b Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..d4081da4 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 00000000..23d15a93 --- /dev/null +++ b/gradlew @@ -0,0 +1,251 @@ +#!/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. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# 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/HEAD/platforms/jvm/plugins-application/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 + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# 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="\\\"\\\"" + + +# 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 + if ! command -v java >/dev/null 2>&1 + then + 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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + 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 + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# 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/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..5eed7ee8 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,94 @@ +@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 +@rem SPDX-License-Identifier: Apache-2.0 +@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=. +@rem This is normally unused +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="-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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH= + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/reference.md b/reference.md new file mode 100644 index 00000000..ba3eb38c --- /dev/null +++ b/reference.md @@ -0,0 +1,36659 @@ +# Reference +## AccessTokens +
client.accessTokens.create(request) -> AccessToken +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accessTokens().create( + CreateAccessTokensRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyId:** `Optional` — The unique identifier of the company to generate the token for, starting with 'biz_'. The API key must have permission to access this company. + +
+
+ +
+
+ +**expiresAt:** `Optional` — The expiration timestamp for the access token. Defaults to 1 hour from now, with a maximum of 3 hours. + +
+
+ +
+
+ +**scopedActions:** `Optional>` — An array of permission scopes to grant to the access token. If empty or omitted, all permissions from the authenticating credential are inherited. Must be a subset of the credential's permissions. + +
+
+ +
+
+ +**userId:** `Optional` — The unique identifier of the user to generate the token for, starting with 'user_'. The API key must have permission to access this user. + +
+
+
+
+ + +
+
+
+ +## AccountLinks +
client.accountLinks.create(request) -> AccountLink +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Generate a URL that directs a sub-merchant to their account portal, such as the hosted payouts dashboard or the KYC onboarding flow. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accountLinks().create( + CreateAccountLinksRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .refreshUrl("refresh_url") + .returnUrl("return_url") + .useCase(AccountLinkUseCases.ACCOUNT_ONBOARDING) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to generate the link for, starting with 'biz_'. Must be a sub-merchant of the API key's company. + +
+
+ +
+
+ +**refreshUrl:** `String` — The URL to redirect the user to if the session expires and needs to be re-authenticated, such as 'https://example.com/refresh'. + +
+
+ +
+
+ +**returnUrl:** `String` — The URL to redirect the user to when they want to return to your site, such as 'https://example.com/return'. + +
+
+ +
+
+ +**useCase:** `AccountLinkUseCases` — The purpose of the account link, such as hosted payouts portal or hosted KYC onboarding. + +
+
+
+
+ + +
+
+
+ +## Accounts +
client.accounts.list() -> SyncPagingIterable&lt;Account&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass `parent_account_id` to return only that parent account's connected accounts. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().list( + ListAccountsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**first:** `Optional` — The number of accounts to return (default 10, max 50). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns accounts after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of accounts to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns accounts before this position. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort accounts by. `volume` requires `stats:read` on the parent account. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+ +
+
+ +**status:** `Optional` — Return only accounts with this status: `active` (includes accounts that have not entered payments review) or `suspended`. + +
+
+ +
+
+ +**query:** `Optional` — Free-text filter on account title or ID. `%` and `_` match literally. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Return only accounts created after this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Return only accounts created before this ISO 8601 timestamp. + +
+
+ +
+
+ +**volumeMin:** `Optional` — Return only accounts whose lifetime USD volume is at least this value. Requires `stats:read` on the parent account. + +
+
+ +
+
+ +**volumeMax:** `Optional` — Return only accounts whose lifetime USD volume is at most this value. Requires `stats:read` on the parent account. + +
+
+ +
+
+ +**parentAccountId:** `Optional` — For platforms: the parent account ID whose direct connected accounts to return. Requires `payout:account:read` on the parent account. + +
+
+
+
+ + +
+
+
+ +
client.accounts.create(request) -> Account +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (`tax_remitted_by`, `tax_type`, `product_tax_code_id`, `business_address`, `tax_identifiers`) are configured with Update Account, not at creation. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().create( + CreateAccountsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**affiliateCode:** `Optional` — The username, if any, of the partner who referred this account + +
+
+ +
+
+ +**country:** `Optional` — The ISO 3166-1 alpha-2 country code where the account's business is located (e.g. `US`). Defaults to the parent account's country for connected accounts. + +
+
+ +
+
+ +**email:** `Optional` — The email address of the account owner. Required for Account API key requests. + +
+
+ +
+
+ +**metadata:** `Optional>` — Arbitrary key/value metadata to store on the account. + +
+
+ +
+
+ +**title:** `Optional` — The display name of the account. Defaults to `metadata.external_id` or the owner's email when omitted. + +
+
+
+
+ + +
+
+
+ +
client.accounts.me() -> Account +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the account associated with the current Account API key. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().me(); +``` +
+
+
+
+ + +
+
+
+ +
client.accounts.retrieve(id) -> Account +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id `me` retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().retrieve( + "id", + RetrieveAccountsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Account ID, prefixed `biz_`, its public route, or `me` for the account associated with the current API key. + +
+
+
+
+ + +
+
+
+ +
client.accounts.update(id, request) -> Account +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id `me` — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its `biz_` id. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().update( + "id", + UpdateAccountsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Account ID, prefixed `biz_`. + +
+
+ +
+
+ +**affiliateApplicationRequired:** `Optional` — Whether prospective affiliates must submit an application before promoting this account. + +
+
+ +
+
+ +**affiliateInstructions:** `Optional` — Guidelines shown to affiliates promoting this account. + +
+
+ +
+
+ +**bannerImage:** `Optional` — Account banner image, used as the cover photo when creating a Whop-managed Facebook page. Image files up to 10 MB, except `image/gif`. Pass a JSON object containing an `id` from [Create File](/api-reference/files/create-file). + +
+
+ +
+
+ +**businessAddress:** `Optional` — Account business address used to calculate tax. A complete address in a supported country is required when `tax_remitted_by` is `self`. + +
+
+ +
+
+ +**businessName:** `Optional` — The legal business name used with the account's tax address. + +
+
+ +
+
+ +**businessType:** `Optional` — High-level business category for the account. See the [business types and industries glossary](/api-reference/beta/accounts/account#business-types-and-industries-glossary) for valid values. + +
+
+ +
+
+ +**collectVatId:** `Optional` — Whether checkout shows a VAT/tax ID field for buyers to optionally enter. Does not require a VAT ID to purchase. + +
+
+ +
+
+ +**country:** `Optional` — Country where the account is located. + +
+
+ +
+
+ +**description:** `Optional` — Account promotional description. When creating a Whop-managed Facebook page, it is truncated to 155 characters and used as the About text. + +
+
+ +
+
+ +**featuredAffiliateProductId:** `Optional` — The ID of the product to feature for affiliates. Pass `null` to clear. + +
+
+ +
+
+ +**homePreferences:** `Optional>` — Public account home page preferences. + +
+
+ +
+
+ +**industryGroup:** `Optional` — Account industry group. See the [business types and industries glossary](/api-reference/beta/accounts/account#business-types-and-industries-glossary) for valid values. + +
+
+ +
+
+ +**industryType:** `Optional` — Specific industry vertical for the account. See the [business types and industries glossary](/api-reference/beta/accounts/account#business-types-and-industries-glossary) for valid values. + +
+
+ +
+
+ +**invoicePrefix:** `Optional` — Prefix used for account invoices. + +
+
+ +
+
+ +**logo:** `Optional` — Account logo, used as the profile picture when creating a Whop-managed Facebook page. Image files up to 5 MB. Pass a JSON object containing an `id` from [Create File](/api-reference/files/create-file). + +
+
+ +
+
+ +**metadata:** `Optional>` — Arbitrary key/value metadata to store on the account. + +
+
+ +
+
+ +**onboardingType:** `Optional` — The type of onboarding the account has completed. + +
+
+ +
+
+ +**opengraphImage:** `Optional` — Open Graph preview media used when the account is shared. Image and video files up to 5 MB. Pass a JSON object containing an `id` from [Create File](/api-reference/files/create-file). + +
+
+ +
+
+ +**opengraphImageVariant:** `Optional` — The account Open Graph image variant. + +
+
+ +
+
+ +**otherBusinessDescription:** `Optional` — The description of the business type when business_type is other. + +
+
+ +
+
+ +**otherIndustryDescription:** `Optional` — The description of the industry type when industry_type is other. + +
+
+ +
+
+ +**productTaxCodeId:** `Optional` — ID of the tax classification code applied by default to the account's products. See the available [product categories](https://docs.numeral.com/essentials/product-categories). + +
+
+ +
+
+ +**require2Fa:** `Optional` — Whether the account requires authorized users to have two-factor authentication enabled. + +
+
+ +
+
+ +**route:** `Optional` — The unique URL slug for the account. + +
+
+ +
+
+ +**sendCustomerEmails:** `Optional` — Whether Whop sends transactional emails to customers on behalf of this account. + +
+
+ +
+
+ +**showJoinedWhops:** `Optional` — Whether the account appears in joined whops on other accounts. + +
+
+ +
+
+ +**showReviewsDtc:** `Optional` — Whether reviews are displayed on direct-to-consumer product pages. + +
+
+ +
+
+ +**showUserDirectory:** `Optional` — Whether the account shows users in the user directory. + +
+
+ +
+
+ +**socialLinks:** `Optional>>` — The full list of social links to display for the account. + +
+
+ +
+
+ +**storePageConfig:** `Optional` — Account store page display configuration. + +
+
+ +
+
+ +**targetAudience:** `Optional` — The target audience for this account. + +
+
+ +
+
+ +**taxCollectionEnabledStates:** `Optional>` — US state codes (50 states plus `DC`) where the account collects tax. Replaces the full set on update. Only settable when `tax_remitted_by` is `self`. + +
+
+ +
+
+ +**taxIdentifiers:** `Optional>` — Account tax/VAT registrations to add or update. When `tax_remitted_by` is `self`, tax is calculated and collected only in the countries where the account holds a registration. + +
+
+ +
+
+ +**taxRemittedBy:** `Optional` — Determines whether Whop or the account calculates and remits tax. The account must provide a supported-country business address when it self-remits. + +
+
+ +
+
+ +**taxType:** `Optional` — Determines whether tax is included in the listed price or added at checkout. + +
+
+ +
+
+ +**threeDsLevel:** `Optional` — Account-level 3D Secure behavior. Set `mandate_challenge` to require cardholder verification on supported card payments, or `null` to use the standard checkout flow. + +
+
+ +
+
+ +**title:** `Optional` — The display name of the account. + +
+
+ +
+
+ +**useLogoAsOpengraphImageFallback:** `Optional` — Whether the account uses its logo as the fallback Open Graph image. + +
+
+
+
+ + +
+
+
+ +
client.accounts.formCompany(id, request) -> FormCompanyAccountsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Starts an LLC or C-Corp formation for a business account. Defaults to an LLC; set `entity_type` to `c_corp` to form a C-Corp, which additionally requires `share_structure` and officer `roles` on every founder. On submission, the application is validated and the response returns a hosted checkout URL. Once paid, the filing is submitted. Track progress through the account's [`company_formation`](/api-reference/beta/accounts/retrieve-account) field on Retrieve Account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().formCompany( + "id", + FormCompanyAccountsRequest + .builder() + .businessName("Shine Time Auto Detailing") + .businessType("brick_and_mortar") + .formationState(FormCompanyAccountsRequestFormationState.TX) + .industryGroup("automotive") + .industryType("car_wash") + .founders( + Arrays.asList( + FormCompanyAccountsRequestFoundersItem + .builder() + .address( + FormCompanyAccountsRequestFoundersItemAddress + .builder() + .city("Austin") + .country("US") + .line1("907 Ridgemont Dr") + .postalCode("78704") + .state("TX") + .line2("Apt 4") + .build() + ) + .email("marcus@shinetime.example") + .firstName("Marcus") + .isPrimary(true) + .lastName("Webb") + .phone("+15125550142") + .dateOfBirth("1988-03-14") + .ownershipPercentage(100.0) + .roles( + Optional.of( + Arrays.asList(FormCompanyAccountsRequestFoundersItemRolesItem.PRESIDENT) + ) + ) + .ssn("123-45-6789") + .build() + ) + ) + .businessAddress( + FormCompanyAccountsRequestBusinessAddress + .builder() + .city("Austin") + .country("US") + .line1("4180 Burnet Rd") + .postalCode("78756") + .state("TX") + .line2("Suite 2") + .build() + ) + .businessPhone("+15125550142") + .businessWebsite("https://shinetime.example") + .entitySuffix(FormCompanyAccountsRequestEntitySuffix.LLC) + .entityType(FormCompanyAccountsRequestEntityType.LLC) + .expediteEin(true) + .shareStructure( + FormCompanyAccountsRequestShareStructure + .builder() + .numberOfShares(123) + .value(123.0) + .build() + ) + .useRegisteredAgent(true) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Account ID, prefixed `biz_`. + +
+
+ +
+
+ +**businessAddress:** `Optional` — Company mailing address. Required unless `use_registered_agent` is `true`. + +
+
+ +
+
+ +**businessName:** `String` — Legal name for the new company. + +
+
+ +
+
+ +**businessPhone:** `Optional` — Business phone number in E.164 format, for example `+12125550100`. Required unless `use_registered_agent` is `true`. + +
+
+ +
+
+ +**businessType:** `String` — High-level business category, from the Whop business taxonomy. Valid values are listed on [business types and industries glossary](/api-reference/beta/accounts/account#business-types-and-industries-glossary). + +
+
+ +
+
+ +**businessWebsite:** `Optional` — Company website URL. + +
+
+ +
+
+ +**entitySuffix:** `Optional` — Legal entity ending appended to `business_name`. LLC formations accept `LLC`, `L.L.C`, `L.L.C.` or `Limited Liability Company` and default to `LLC`; C-Corp formations accept `Inc`, `Inc.`, `Incorporated`, `Corp.`, `Corporation`, `C Corp`, `C Corporation`, `CCorp` or `Company` and default to `Inc.`. Unrecognized values fall back to the default for the entity type. + +
+
+ +
+
+ +**entityType:** `Optional` — Legal entity type to form. Defaults to `llc`. + +
+
+ +
+
+ +**expediteEin:** `Optional` — Request expedited EIN processing for an additional fee. Available only when no founder supplies an SSN. + +
+
+ +
+
+ +**formationState:** `FormCompanyAccountsRequestFormationState` — Two-letter code of the US state (or `DC`) to form the company in. + +
+
+ +
+
+ +**founders:** `List` — The company's founders. Exactly one must be marked `is_primary` — the responsible party for the filing. + +
+
+ +
+
+ +**industryGroup:** `String` — Industry group, from the Whop business taxonomy. Valid values are listed on [business types and industries glossary](/api-reference/beta/accounts/account#business-types-and-industries-glossary). + +
+
+ +
+
+ +**industryType:** `String` — Specific industry vertical, from the Whop business taxonomy. Valid values are listed on [business types and industries glossary](/api-reference/beta/accounts/account#business-types-and-industries-glossary). + +
+
+ +
+
+ +**shareStructure:** `Optional` — Authorized share structure. Required when `entity_type` is `c_corp`; ignored for LLCs. + +
+
+ +
+
+ +**useRegisteredAgent:** `Optional` — Use the registered agent's address as the company address instead of `business_address`. + +
+
+
+
+ + +
+
+
+ +
client.accounts.transferOwnership(id, request) -> TransferOwnershipAccountsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Transfers ownership of the account to another user, identified by user ID or email address. If the recipient already holds the owner role, ownership moves immediately; otherwise they get an invite and ownership moves when they accept. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().transferOwnership( + "id", + TransferOwnershipAccountsRequest + .builder() + .identifier("marcus@shinetime.example") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Account ID, prefixed `biz_`. + +
+
+ +
+
+ +**asPartner:** `Optional` — If true, the current owner is credited as the account's Whop partner, earning partner commission on its sales. Requires the current owner to already be an enrolled Whop partner. Skipped if the account already has an active partner. + +
+
+ +
+
+ +**identifier:** `String` — The user to transfer ownership to: a user ID (`user_*`) or an email address. An email address with no Whop account yet is sent an invite to create one. + +
+
+
+
+ + +
+
+
+ +## Ad Campaigns +
client.adCampaigns.list() -> SyncPagingIterable&lt;AdCampaign&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the ad campaigns for an account, with stats over the requested window. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adCampaigns().list( + ListAdCampaignsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The account the campaigns belong to. Defaults to the account-scoped key's own account. + +
+
+ +
+
+ +**status:** `Optional` — Only return campaigns with this status. + +
+
+ +
+
+ +**query:** `Optional` — Filter campaigns by a title or ID substring. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort by. Defaults to created_at. Stat columns (spend, impressions, …) rank over the stats_from/stats_to window across the whole list, not just the current page. results, cost_per_result and return_on_ad_spend rank by the same Whop pixel-attributed values the response reports. + +
+
+ +
+
+ +**direction:** `Optional` — The sort direction. Defaults to desc. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return campaigns created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return campaigns created after this timestamp. + +
+
+ +
+
+ +**statsFrom:** `Optional` — Start of the stats window. Defaults to all-time. + +
+
+ +
+
+ +**statsTo:** `Optional` — End of the stats window. Defaults to now. + +
+
+ +
+
+ +**timeZone:** `Optional` — IANA timezone (e.g. America/New_York) the stats window is interpreted in. Bare stats_from/stats_to dates resolve to day boundaries on this clock. Defaults to UTC. + +
+
+ +
+
+ +**attributionModel:** `Optional` — Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise. + +
+
+ +
+
+ +**first:** `Optional` — The number of campaigns to return. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to fetch the page after (from page_info.end_cursor). + +
+
+ +
+
+ +**last:** `Optional` — The number of campaigns to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to fetch the page before (from page_info.start_cursor). + +
+
+
+
+ + +
+
+
+ +
client.adCampaigns.create(request) -> AdCampaign +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates an ad campaign for an account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adCampaigns().create( + CreateAdCampaignsRequest + .builder() + .objective(CreateAdCampaignsRequestObjective.AWARENESS) + .platform(CreateAdCampaignsRequestPlatform.META) + .title("Now hiring mobile detailers — Austin") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The account to create the campaign under. Defaults to the account-scoped key's own account. + +
+
+ +
+
+ +**bidType:** `Optional` — How delivery bids in the ad auction: `minimum_cost` gets the most results for the budget, `average_target` holds an average cost per result, `maximum_target` never bids above a cap. Only for campaigns that own the budget. + +
+
+ +
+
+ +**budgetAmount:** `Optional` — The campaign's budget, in the ad account's currency. Required when budget_optimization is `ad_campaign`; omit when each ad group sets its own budget. + +
+
+ +
+
+ +**budgetOptimization:** `Optional` — Which level owns the budget: the whole campaign (`ad_campaign`) or each ad group individually (`ad_group`). Defaults to `ad_group`. + +
+
+ +
+
+ +**budgetType:** `Optional` — Whether the budget is spent per day (`daily`) or over the campaign's full run (`lifetime`). Defaults to `daily`. + +
+
+ +
+
+ +**desiredCostPerResult:** `Optional` — Cost per result to aim for (`average_target`) or never exceed (`maximum_target`). Only for campaigns that own the budget. + +
+
+ +
+
+ +**endsAt:** `Optional` — When the campaign stops delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget. + +
+
+ +
+
+ +**objective:** `CreateAdCampaignsRequestObjective` — The goal the campaign optimizes toward. + +
+
+ +
+
+ +**platform:** `CreateAdCampaignsRequestPlatform` — The ad network the campaign runs on. + +
+
+ +
+
+ +**specialAdCategories:** `Optional>` — Regulated categories the campaign falls under. Ads in these categories are subject to extra targeting restrictions. + +
+
+ +
+
+ +**startsAt:** `Optional` — When the campaign starts delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget. + +
+
+ +
+
+ +**title:** `String` — The title of the campaign. + +
+
+
+
+ + +
+
+
+ +
client.adCampaigns.retrieve(id) -> AdCampaign +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a single ad campaign with stats over the requested window. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adCampaigns().retrieve( + "id", + RetrieveAdCampaignsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad campaign ID. + +
+
+ +
+
+ +**statsFrom:** `Optional` — Start of the stats window. + +
+
+ +
+
+ +**statsTo:** `Optional` — End of the stats window. + +
+
+ +
+
+ +**timeZone:** `Optional` — IANA timezone the stats window is interpreted in. Defaults to UTC. + +
+
+ +
+
+ +**attributionModel:** `Optional` — Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise. + +
+
+
+
+ + +
+
+
+ +
client.adCampaigns.delete(id) -> DeleteAdCampaignsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adCampaigns().delete( + "id", + DeleteAdCampaignsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad campaign ID. + +
+
+
+
+ + +
+
+
+ +
client.adCampaigns.update(id, request) -> AdCampaign +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adCampaigns().update( + "id", + UpdateAdCampaignsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad campaign ID. + +
+
+ +
+
+ +**bidType:** `Optional` — How delivery bids in the ad auction: `minimum_cost` gets the most results for the budget, `average_target` holds an average cost per result, `maximum_target` never bids above a cap. Switching to `minimum_cost` clears the cap amounts stored on the campaign's ad groups. Only for campaigns that own the budget. + +
+
+ +
+
+ +**budgetAmount:** `Optional` — The campaign budget, in the account's currency. Interpreted as daily or lifetime per the campaign's existing budget type. + +
+
+ +
+
+ +**budgetOptimization:** `Optional` — Which level owns the budget: the whole campaign (`ad_campaign`) or each ad group individually (`ad_group`). Only changeable before the campaign is live on the ad network; switching to `ad_campaign` requires budget_amount in the same request, and switching to `ad_group` clears the campaign budget. + +
+
+ +
+
+ +**endsAt:** `Optional` — When the campaign stops delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget. + +
+
+ +
+
+ +**specialAdCategories:** `Optional>` — Regulated categories the campaign falls under. Editable on any campaign, draft or launched; pass an empty array to clear. + +
+
+ +
+
+ +**startsAt:** `Optional` — When the campaign starts delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget. + +
+
+ +
+
+ +**status:** `Optional` — Set to active to launch a draft campaign (moderates and pushes it live). Live-campaign pause and resume use the pause and unpause actions. + +
+
+ +
+
+ +**title:** `Optional` — The name of the campaign. + +
+
+
+
+ + +
+
+
+ +
client.adCampaigns.duplicate(id, request) -> DuplicateAdCampaignsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates copies of the campaign in `duplicating` status and returns them; each copy transitions to `draft` once duplication completes. Poll each returned campaign until it leaves `duplicating` — a copy that could not be completed is deleted and returns 404. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adCampaigns().duplicate( + "id", + DuplicateAdCampaignsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad campaign ID. + +
+
+ +
+
+ +**count:** `Optional` — Number of copies to create (1-10). Defaults to 1. + +
+
+ +
+
+ +**preserveEngagement:** `Optional` — Whether the copied ads keep the original posts' engagement (likes, comments, shares). Defaults to false. + +
+
+
+
+ + +
+
+
+ +
client.adCampaigns.pause(id) -> AdCampaign +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Pauses an active ad campaign. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adCampaigns().pause( + "id", + PauseAdCampaignsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad campaign ID. + +
+
+
+
+ + +
+
+
+ +
client.adCampaigns.retryPayment(id) -> AdCampaign +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retries billing for an ad campaign whose payment previously failed. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adCampaigns().retryPayment( + "id", + RetryPaymentAdCampaignsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad campaign ID. + +
+
+
+
+ + +
+
+
+ +
client.adCampaigns.unpause(id) -> AdCampaign +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Resumes a paused ad campaign. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adCampaigns().unpause( + "id", + UnpauseAdCampaignsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad campaign ID. + +
+
+
+
+ + +
+
+
+ +## Ad Groups +
client.adGroups.list() -> SyncPagingIterable&lt;AdGroup&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists ad groups for the account, newest first. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adGroups().list( + ListAdGroupsRequest + .builder() + .adCampaignIds( + Arrays.asList("adcamp_xxxxxxxxxxxxxx") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Account whose ad groups to list. Defaults to the authenticated account. + +
+
+ +
+
+ +**adCampaignId:** `Optional` — Filter to ad groups in this campaign. + +
+
+ +
+
+ +**adCampaignIds:** `Optional` — Filter to ad groups in these campaigns (max 100). Repeat the parameter for each id (ad_campaign_ids=a&ad_campaign_ids=b). + +
+
+ +
+
+ +**status:** `Optional` — Filter to ad groups with this status. + +
+
+ +
+
+ +**query:** `Optional` — Filter ad groups by a title or ID substring. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort by. Defaults to created_at. Stat columns (spend, impressions, …) rank over the stats_from/stats_to window across the whole list, not just the current page. results, cost_per_result and return_on_ad_spend rank by the same Whop pixel-attributed values the response reports. + +
+
+ +
+
+ +**direction:** `Optional` — The sort direction. Defaults to desc. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return ad groups created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return ad groups created after this timestamp. + +
+
+ +
+
+ +**statsFrom:** `Optional` — Start of the stats window. Defaults to all-time. + +
+
+ +
+
+ +**statsTo:** `Optional` — End of the stats window. Defaults to now. + +
+
+ +
+
+ +**timeZone:** `Optional` — IANA timezone (e.g. America/New_York) the stats window is interpreted in. Bare stats_from/stats_to dates resolve to day boundaries on this clock. Defaults to UTC. + +
+
+ +
+
+ +**attributionModel:** `Optional` — Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise. + +
+
+ +
+
+ +**first:** `Optional` — The number of ad groups to return. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to fetch the page after (from page_info.end_cursor). + +
+
+ +
+
+ +**last:** `Optional` — The number of ad groups to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to fetch the page before (from page_info.start_cursor). + +
+
+
+
+ + +
+
+
+ +
client.adGroups.create(request) -> AdGroup +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates an ad group (ad set) in a campaign. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adGroups().create( + CreateAdGroupsRequest + .builder() + .adCampaignId("adcamp_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**adCampaignId:** `String` — The ad campaign to create the ad group in, prefixed `adcamp_`. + +
+
+ +
+
+ +**audiences:** `Optional` — Saved audiences to deliver to or exclude. Can't be combined with demographics.automatic. + +
+
+ +
+
+ +**bidType:** `Optional` — How delivery bids are set in the ad auction. Target-based strategies use `desired_cost_per_result`. + +
+
+ +
+
+ +**budgetAmount:** `Optional` — This ad group's budget, in the ad account's currency. Omit when the budget is set on the campaign instead. + +
+
+ +
+
+ +**budgetType:** `Optional` — Whether budget_amount is spent per day (`daily`) or over the ad group's full run (`lifetime`). + +
+
+ +
+
+ +**conversionEvent:** `Optional` + +
+
+ +
+
+ +**conversionLocation:** `Optional` — Where the outcome being optimized for occurs, such as a website visit, social-profile visit, messaging conversation, ad interaction, or lead-form submission. The lead form itself is set on the ad. + +
+
+ +
+
+ +**demographics:** `Optional` — Age, gender, and automatic-audience targeting. + +
+
+ +
+
+ +**desiredCostPerResult:** `Optional` — Cost per result to aim for (`average_target`) or never exceed (`maximum_target`). + +
+
+ +
+
+ +**detailedTargeting:** `Optional` — Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. Entries across interests, behaviors, and demographics are OR'd together (anyone matching any entry is reached), matching Ads Manager's detailed-targeting box. At most 100 entries per section. Can't be combined with demographics.automatic, and unavailable to campaigns with special_ad_categories. Send the complete intended state — a section you omit is cleared. + +
+
+ +
+
+ +**devices:** `Optional` — Device platforms and operating systems to target. + +
+
+ +
+
+ +**dynamicCreative:** `Optional` — Let the ad platform automatically mix and match this ad group's creatives and copy to find the best-performing combinations. Set at creation; can't be changed afterward. + +
+
+ +
+
+ +**endsAt:** `Optional` — When the ad group stops delivering, as an ISO 8601 timestamp. Omit to run until paused. + +
+
+ +
+
+ +**frequencyCap:** `Optional` — Cap on how often one person sees ads from this ad group. Only available on campaigns with the `awareness` objective. + +
+
+ +
+
+ +**languages:** `Optional>` — Languages to target, as ISO 639 codes such as `en` or `es`. Empty or omitted targets all languages. + +
+
+ +
+
+ +**messageApps:** `Optional>` — Apps the conversation opens in. Required when setting `conversion_location` to `messaging`, and rejected unless the ad group's conversion location is `messaging`. + +
+
+ +
+
+ +**minimumDailySpend:** `Optional` — Minimum the ad group tries to spend each day. + +
+
+ +
+
+ +**optimizationGoal:** `Optional` — The result the ad group's delivery is optimized to get the most of. + +
+
+ +
+
+ +**placements:** `Optional` + +`automatic` to let the ad platform choose placements, or the list of platforms and positions to target. Omit a platform's positions to target all of them. + +Valid positions per platform: + +- `facebook`: `feed`, `right_hand_column`, `marketplace`, `search`, `profile_feed`, `notification`, `story`, `instream_video`, `facebook_reels`, `facebook_reels_overlay`, `biz_disco_feed` +- `instagram`: `stream`, `story`, `explore`, `explore_home`, `reels`, `profile_feed`, `profile_reels`, `ig_search` +- `messenger`: `story` +- `audience_network`: `classic`, `rewarded_video` +- `threads`: `threads_stream` +- `whatsapp`: `status` + +
+
+ +
+
+ +**regions:** `Optional` — Locations to target and exclude. + +
+
+ +
+
+ +**startsAt:** `Optional` — When the ad group starts delivering, as an ISO 8601 timestamp. Omit to start as soon as it's active. + +
+
+ +
+
+ +**status:** `Optional` — Initial status (default: `active`). + +
+
+ +
+
+ +**title:** `Optional` — The display name of the ad group. + +
+
+
+
+ + +
+
+
+ +
client.adGroups.estimateReach(request) -> ReachEstimate +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Estimates how many people a draft targeting spec can reach, before an ad group is created. The body takes the same targeting fields as creating an ad group — `regions`, `demographics`, `detailed_targeting`, `audiences`, `languages`, and `devices` — and nothing is persisted. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adGroups().estimateReach( + EstimateReachAdGroupsRequest + .builder() + .platform(EstimateReachAdGroupsRequestPlatform.META) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Account to estimate on behalf of. Defaults to the authenticated account. + +
+
+ +
+
+ +**audiences:** `Optional` — Saved audiences to deliver to or exclude. Can't be combined with demographics.automatic. + +
+
+ +
+
+ +**demographics:** `Optional` — Age, gender, and automatic-audience targeting. + +
+
+ +
+
+ +**detailedTargeting:** `Optional` — Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. At most 100 entries per section. + +
+
+ +
+
+ +**devices:** `Optional` — Device platforms and operating systems to target. + +
+
+ +
+
+ +**languages:** `Optional>` — Languages to target, as ISO 639 codes such as `en` or `es`. Empty or omitted targets all languages. + +
+
+ +
+
+ +**platform:** `EstimateReachAdGroupsRequestPlatform` — The ad network the estimate runs on. + +
+
+ +
+
+ +**regions:** `Optional` — Locations to target and exclude. + +
+
+
+
+ + +
+
+
+ +
client.adGroups.searchTargetingOptions() -> SearchTargetingOptionsAdGroupsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Searches the ad platform's targeting taxonomy for options to target an ad group with. Each result comes back in the exact shape the ad-group body accepts for its `type`, so it can be used in `detailed_targeting`, `regions`, or `languages` as-is. A blank `query` browses the small fixed lists (behaviors, browse demographic categories, languages); interests, work employers, job titles, schools, majors, and locations need a search term. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adGroups().searchTargetingOptions( + SearchTargetingOptionsAdGroupsRequest + .builder() + .platform(SearchTargetingOptionsAdGroupsRequestPlatform.META) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Account to search on behalf of. Defaults to the authenticated account. + +
+
+ +
+
+ +**platform:** `SearchTargetingOptionsAdGroupsRequestPlatform` — The ad network whose targeting taxonomy to search. + +
+
+ +
+
+ +**query:** `Optional` — The search term. Blank browses the fixed lists; interests, work employers, job titles, schools, majors, and locations return nothing without one. + +
+
+ +
+
+ +**types:** `Optional` — Kinds of targeting options to search. Defaults to all of them. + +
+
+ +
+
+ +**locationTypes:** `Optional` — Narrow location results to these kinds of places. Only applies when `types` includes `locations`. + +
+
+ +
+
+ +**country:** `Optional` — Narrow location results to one country, as an ISO 3166-1 code such as `US`. Only applies when `types` includes `locations`. + +
+
+ +
+
+ +**limit:** `Optional` — Maximum number of results per requested type. + +
+
+
+
+ + +
+
+
+ +
client.adGroups.retrieve(id) -> AdGroup +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a single ad group. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adGroups().retrieve( + "id", + RetrieveAdGroupsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad group ID. + +
+
+ +
+
+ +**statsFrom:** `Optional` — Start of the stats window. + +
+
+ +
+
+ +**statsTo:** `Optional` — End of the stats window. + +
+
+ +
+
+ +**timeZone:** `Optional` — IANA timezone the stats window is interpreted in. Defaults to UTC. + +
+
+ +
+
+ +**attributionModel:** `Optional` — Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise. + +
+
+
+
+ + +
+
+
+ +
client.adGroups.delete(id) -> DeleteAdGroupsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes an ad group. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adGroups().delete( + "id", + DeleteAdGroupsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad group ID. + +
+
+
+
+ + +
+
+
+ +
client.adGroups.update(id, request) -> AdGroup +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an ad group's editable fields. Only the keys you send are changed. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adGroups().update( + "id", + UpdateAdGroupsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad group ID. + +
+
+ +
+
+ +**audiences:** `Optional` — Saved audiences to deliver to or exclude. Can't be combined with demographics.automatic. + +
+
+ +
+
+ +**bidType:** `Optional` — How delivery bids are set in the ad auction. Target-based strategies use `desired_cost_per_result`. + +
+
+ +
+
+ +**budgetAmount:** `Optional` — This ad group's budget, in the ad account's currency. Omit when the budget is set on the campaign instead. + +
+
+ +
+
+ +**budgetType:** `Optional` — Whether budget_amount is spent per day (`daily`) or over the ad group's full run (`lifetime`). + +
+
+ +
+
+ +**conversionEvent:** `Optional` + +
+
+ +
+
+ +**conversionLocation:** `Optional` — Where the outcome being optimized for occurs, such as a website visit, social-profile visit, messaging conversation, ad interaction, or lead-form submission. The lead form itself is set on the ad. + +
+
+ +
+
+ +**demographics:** `Optional` — Age, gender, and automatic-audience targeting. + +
+
+ +
+
+ +**desiredCostPerResult:** `Optional` — Cost per result to aim for (`average_target`) or never exceed (`maximum_target`). + +
+
+ +
+
+ +**detailedTargeting:** `Optional` — Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. Entries across interests, behaviors, and demographics are OR'd together (anyone matching any entry is reached), matching Ads Manager's detailed-targeting box. At most 100 entries per section. Can't be combined with demographics.automatic, and unavailable to campaigns with special_ad_categories. Send the complete intended state — a section you omit is cleared. + +
+
+ +
+
+ +**devices:** `Optional` — Device platforms and operating systems to target. + +
+
+ +
+
+ +**endsAt:** `Optional` — When the ad group stops delivering, as an ISO 8601 timestamp. Omit to run until paused. + +
+
+ +
+
+ +**frequencyCap:** `Optional` — Cap on how often one person sees ads from this ad group. Only available on campaigns with the `awareness` objective. + +
+
+ +
+
+ +**languages:** `Optional>` — Languages to target, as ISO 639 codes such as `en` or `es`. Empty or omitted targets all languages. + +
+
+ +
+
+ +**messageApps:** `Optional>` — Apps the conversation opens in. Required when setting `conversion_location` to `messaging`, and rejected unless the ad group's conversion location is `messaging`. + +
+
+ +
+
+ +**minimumDailySpend:** `Optional` — Minimum the ad group tries to spend each day. + +
+
+ +
+
+ +**optimizationGoal:** `Optional` — The result the ad group's delivery is optimized to get the most of. + +
+
+ +
+
+ +**placements:** `Optional` + +`automatic` to let the ad platform choose placements, or the list of platforms and positions to target. Omit a platform's positions to target all of them. + +Valid positions per platform: + +- `facebook`: `feed`, `right_hand_column`, `marketplace`, `search`, `profile_feed`, `notification`, `story`, `instream_video`, `facebook_reels`, `facebook_reels_overlay`, `biz_disco_feed` +- `instagram`: `stream`, `story`, `explore`, `explore_home`, `reels`, `profile_feed`, `profile_reels`, `ig_search` +- `messenger`: `story` +- `audience_network`: `classic`, `rewarded_video` +- `threads`: `threads_stream` +- `whatsapp`: `status` + +
+
+ +
+
+ +**regions:** `Optional` — Locations to target and exclude. + +
+
+ +
+
+ +**startsAt:** `Optional` — When the ad group starts delivering, as an ISO 8601 timestamp. Omit to start as soon as it's active. + +
+
+ +
+
+ +**status:** `Optional` — Initial status (default: `active`). + +
+
+ +
+
+ +**title:** `Optional` — The display name of the ad group. + +
+
+
+
+ + +
+
+
+ +
client.adGroups.duplicate(id, request) -> DuplicateAdGroupsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates copies of the ad group in `duplicating` status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves `duplicating` — a copy that could not be completed is deleted and returns 404. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adGroups().duplicate( + "id", + DuplicateAdGroupsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad group ID. + +
+
+ +
+
+ +**count:** `Optional` — Number of copies to create (1-10). Defaults to 1. + +
+
+ +
+
+ +**preserveEngagement:** `Optional` — Whether the copied ads keep the original posts' engagement (likes, comments, shares). Defaults to false. + +
+
+ +
+
+ +**targetAdCampaignId:** `Optional` — Campaign to duplicate into. Defaults to the ad group's own campaign. + +
+
+
+
+ + +
+
+
+ +
client.adGroups.pause(id) -> AdGroup +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Pauses delivery of an ad group. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adGroups().pause( + "id", + PauseAdGroupsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad group ID. + +
+
+
+
+ + +
+
+
+ +
client.adGroups.unpause(id) -> AdGroup +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Resumes delivery of a paused ad group. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adGroups().unpause( + "id", + UnpauseAdGroupsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad group ID. + +
+
+
+
+ + +
+
+
+ +## AdReports +
client.adReports.retrieve() -> AdReport +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Performance report for a company, ad campaigns, ad groups, or ads. Always returns aggregate `summary` totals summed across the scope. Set `granularity` to additionally get a time series, or set `breakdown` (`campaign`/`ad_group`/`ad`) to additionally get per-entity rows inside the requested scope. Exactly one of `companyId`, `adCampaignIds`, `adGroupIds`, or `adIds` must be provided. + +Required permissions: + - `ad_campaign:stats:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adReports().retrieve( + RetrieveAdReportsRequest + .builder() + .from(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .to(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .companyId("biz_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**adCampaignIds:** `Optional` — Scope the report to these ad campaigns (max 100); stats are summed across them. Mutually exclusive with `companyId`, `adGroupIds`, and `adIds`. + +
+
+ +
+
+ +**adGroupIds:** `Optional` — Scope the report to these ad groups (max 100); stats are summed across them. Mutually exclusive with `companyId`, `adCampaignIds`, and `adIds`. + +
+
+ +
+
+ +**adIds:** `Optional` — Scope the report to these ads (max 100); stats are summed across them. Mutually exclusive with `companyId`, `adCampaignIds`, and `adGroupIds`. + +
+
+ +
+
+ +**breakdown:** `Optional` + +
+
+ +
+
+ +**companyId:** `Optional` — The unique identifier of a company. Mutually exclusive with `adCampaignIds`, `adGroupIds`, and `adIds`. Use with `breakdown` to fan out across every campaign, ad group, or ad in the company without paging. + +
+
+ +
+
+ +**currency:** `Optional` — ISO 4217 currency code to report `spend` in. Defaults to the company's ads reporting currency. + +
+
+ +
+
+ +**from:** `OffsetDateTime` — Inclusive start of the reporting window. + +
+
+ +
+
+ +**granularity:** `Optional` + +
+
+ +
+
+ +**to:** `OffsetDateTime` — Inclusive end of the reporting window. + +
+
+
+
+ + +
+
+
+ +## Ads +
client.ads.list() -> SyncPagingIterable&lt;Ad&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the ads for an account, with stats over the requested window. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.ads().list( + ListAdsRequest + .builder() + .adCampaignIds( + Arrays.asList("adcamp_xxxxxxxxxxxxxx") + ) + .adGroupIds( + Arrays.asList("adgrp_xxxxxxxxxxxxxx") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The account the ads belong to. Defaults to the account-scoped key's own account. + +
+
+ +
+
+ +**adCampaignId:** `Optional` — Only return ads in this ad campaign. + +
+
+ +
+
+ +**adCampaignIds:** `Optional` — Only return ads in these ad campaigns (max 100). Repeat the parameter for each id (ad_campaign_ids=a&ad_campaign_ids=b). + +
+
+ +
+
+ +**adGroupId:** `Optional` — Only return ads in this ad group. + +
+
+ +
+
+ +**adGroupIds:** `Optional` — Only return ads in these ad groups (max 100). Repeat the parameter for each id (ad_group_ids=a&ad_group_ids=b). + +
+
+ +
+
+ +**status:** `Optional` — Only return ads with this status. + +
+
+ +
+
+ +**query:** `Optional` — Filter ads by a title or ID substring. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort by. Defaults to created_at. Stat columns (spend, impressions, …) rank over the stats_from/stats_to window across the whole list, not just the current page. results, cost_per_result and return_on_ad_spend rank by the same Whop pixel-attributed values the response reports. + +
+
+ +
+
+ +**direction:** `Optional` — The sort direction. Defaults to desc. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return ads created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return ads created after this timestamp. + +
+
+ +
+
+ +**statsFrom:** `Optional` — Start of the stats window. Defaults to all-time. + +
+
+ +
+
+ +**statsTo:** `Optional` — End of the stats window. Defaults to now. + +
+
+ +
+
+ +**timeZone:** `Optional` — IANA timezone (e.g. America/New_York) the stats window is interpreted in. Bare stats_from/stats_to dates resolve to day boundaries on this clock. Defaults to UTC. + +
+
+ +
+
+ +**attributionModel:** `Optional` — Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise. + +
+
+ +
+
+ +**first:** `Optional` — The number of ads to return. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to fetch the page after (from page_info.end_cursor). + +
+
+ +
+
+ +**last:** `Optional` — The number of ads to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to fetch the page before (from page_info.start_cursor). + +
+
+
+
+ + +
+
+
+ +
client.ads.create(request) -> Ad +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates an ad in an ad group. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.ads().create( + CreateAdsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**adGroup:** `Optional>` — An inline ad group to create (same shape as POST /ad_groups, including ad_campaign_id). Creates the ad group and the ad together. Provide this OR ad_group_id. + +
+
+ +
+
+ +**adGroupId:** `Optional` — The existing ad group to create the ad in. Provide this OR ad_group, not both. + +
+
+ +
+
+ +**callToAction:** `Optional` — The call-to-action button shown on the ad. + +
+
+ +
+
+ +**creatives:** `Optional>` — The ad's creative assets. Each entry is an uploaded file id with an optional format; omit format for the original asset. Two or more entries with no format become a carousel (2-10 attachments), in order, sharing the ad's copy. + +
+
+ +
+
+ +**descriptions:** `Optional>` — The description variants shown on the ad. + +
+
+ +
+
+ +**headlines:** `Optional>` — The headline variants shown on the ad. + +
+
+ +
+
+ +**leadForm:** `Optional` — Instant lead form for the ad. Only allowed when the ad group's conversion_location is an instant-form destination (instant_forms, instant_forms_and_messenger, website_and_instant_forms). Mutually exclusive with lead_form_id. + +
+
+ +
+
+ +**leadFormId:** `Optional` — Use an existing instant form instead of creating one — the form's platform ID, from a form already on the ad's Facebook page. Only allowed when the ad group's conversion_location is an instant-form destination. Mutually exclusive with lead_form. + +
+
+ +
+
+ +**messagingConfig:** `Optional` — Click-to-message welcome copy: the greeting (message) and the ice-breaker prompt (keyword). + +
+
+ +
+
+ +**multiAdvertiserAds:** `Optional` — Whether the ad can appear alongside other advertisers' ads in the same unit. Defaults to true. + +
+
+ +
+
+ +**postId:** `Optional` — Promote an existing post instead of uploading creatives — a Facebook post or Instagram media id. Mutually exclusive with creatives. Pair with post_source. + +
+
+ +
+
+ +**postSource:** `Optional` — Identifies the network that owns `post_id`. The source is inferred from the ID shape when omitted. + +
+
+ +
+
+ +**primaryTexts:** `Optional>` — The primary text variants shown in the ad body. + +
+
+ +
+
+ +**socialAccounts:** `Optional>` — The social accounts the ad runs under — a connected Facebook page and, optionally, an Instagram profile. + +
+
+ +
+
+ +**title:** `Optional` — The display name of the ad. + +
+
+ +
+
+ +**url:** `Optional` — The URL the ad links to. Query parameters are merged into url_parameters, so the stored URL is always bare. + +
+
+ +
+
+ +**urlParameters:** `Optional>` — Query parameters to append to the destination URL, keyed by parameter name. Merged with any query string on `url`. Whop adds its own click-attribution parameters; those are reserved and rejected if you set them (utm_meta_ad_id, utm_meta_adset_id, utm_meta_campaign_id, utm_source, utm_placement, utm_medium, utm_content, utm_adset, utm_whop, wacid, wasid, waid, tw_source, tw_adid). + +
+
+
+
+ + +
+
+
+ +
client.ads.retrieve(id) -> Ad +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a single ad with stats over the requested window. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.ads().retrieve( + "id", + RetrieveAdsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad ID. + +
+
+ +
+
+ +**statsFrom:** `Optional` — Start of the stats window. + +
+
+ +
+
+ +**statsTo:** `Optional` — End of the stats window. + +
+
+ +
+
+ +**timeZone:** `Optional` — IANA timezone the stats window is interpreted in. Defaults to UTC. + +
+
+ +
+
+ +**attributionModel:** `Optional` — Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise. + +
+
+
+
+ + +
+
+
+ +
client.ads.delete(id) -> DeleteAdsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes an ad. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.ads().delete( + "id", + DeleteAdsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad ID. + +
+
+
+
+ + +
+
+
+ +
client.ads.update(id, request) -> Ad +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an ad's editable fields. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.ads().update( + "id", + UpdateAdsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad ID. + +
+
+ +
+
+ +**callToAction:** `Optional` — The call-to-action button shown on the ad. + +
+
+ +
+
+ +**creatives:** `Optional>` — The ad's creative assets. Each entry is an uploaded file id with an optional format; omit format for the original asset. Replaces a live ad's creative on the platform. Two or more entries with no format replace it with a carousel (2-10 attachments), in order, sharing the ad's copy. + +
+
+ +
+
+ +**descriptions:** `Optional>` — The description variants shown on the ad. + +
+
+ +
+
+ +**headlines:** `Optional>` — The headline variants shown on the ad. + +
+
+ +
+
+ +**leadForm:** `Optional` — Instant lead form for the ad. Only allowed when the ad group's conversion_location is an instant-form destination (instant_forms, instant_forms_and_messenger, website_and_instant_forms). Mutually exclusive with lead_form_id. + +
+
+ +
+
+ +**leadFormId:** `Optional` — Use an existing instant form instead of creating one — the form's platform ID, from a form already on the ad's Facebook page. Only allowed when the ad group's conversion_location is an instant-form destination. Mutually exclusive with lead_form. Replaces a stored lead_form. + +
+
+ +
+
+ +**messagingConfig:** `Optional` — Click-to-message welcome copy: the greeting (message) and the ice-breaker prompt (keyword). + +
+
+ +
+
+ +**multiAdvertiserAds:** `Optional` — Whether the ad can appear alongside other advertisers' ads in the same unit. Defaults to true. + +
+
+ +
+
+ +**postId:** `Optional` — Promote an existing post instead of uploading creatives — a Facebook post or Instagram media id. Mutually exclusive with creatives. Pair with post_source. + +
+
+ +
+
+ +**postSource:** `Optional` — Identifies the network that owns `post_id`. The source is inferred from the ID shape when omitted. + +
+
+ +
+
+ +**primaryTexts:** `Optional>` — The primary text variants shown in the ad body. + +
+
+ +
+
+ +**socialAccounts:** `Optional>` — The social accounts the ad runs under — a connected Facebook page and, optionally, an Instagram profile. + +
+
+ +
+
+ +**title:** `Optional` — The display name of the ad. + +
+
+ +
+
+ +**url:** `Optional` — The URL the ad links to. Query parameters are merged into url_parameters, so the stored URL is always bare. + +
+
+ +
+
+ +**urlParameters:** `Optional>` — Query parameters to append to the destination URL, keyed by parameter name. Merged with any query string on `url`. Whop adds its own click-attribution parameters; those are reserved and rejected if you set them (utm_meta_ad_id, utm_meta_adset_id, utm_meta_campaign_id, utm_source, utm_placement, utm_medium, utm_content, utm_adset, utm_whop, wacid, wasid, waid, tw_source, tw_adid). + +
+
+
+
+ + +
+
+
+ +
client.ads.duplicate(id, request) -> DuplicateAdsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.ads().duplicate( + "id", + DuplicateAdsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad ID. + +
+
+ +
+
+ +**count:** `Optional` — Number of copies to create (1-10). Defaults to 1. + +
+
+ +
+
+ +**preserveEngagement:** `Optional` — Whether the copies keep the original post's engagement (likes, comments, shares). Defaults to false. + +
+
+ +
+
+ +**targetAdGroupId:** `Optional` — Ad group to duplicate into. Defaults to the ad's own ad group. + +
+
+
+
+ + +
+
+
+ +
client.ads.pause(id) -> Ad +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Pauses an active ad. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.ads().pause( + "id", + PauseAdsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad ID. + +
+
+
+
+ + +
+
+
+ +
client.ads.unpause(id) -> Ad +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Resumes a paused ad. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.ads().unpause( + "id", + UnpauseAdsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ad ID. + +
+
+
+
+ + +
+
+
+ +## Affiliates +
client.affiliates.list() -> SyncPagingIterable&lt;AffiliateListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of affiliates for the actor in context, with optional filtering by status, search, and sorting. + +Required permissions: + - `affiliate:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.affiliates().list( + ListAffiliatesRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .first(42) + .last(42) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to list affiliates for. + +
+
+ +
+
+ +**direction:** `Optional` + +
+
+ +
+
+ +**order:** `Optional` + +
+
+ +
+
+ +**query:** `Optional` — Search affiliates by username. + +
+
+ +
+
+ +**status:** `Optional` + +
+
+
+
+ + +
+
+
+ +
client.affiliates.create(request) -> Affiliate +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates or finds an affiliate for a company and user. + +Required permissions: + - `affiliate:create` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.affiliates().create( + CreateAffiliatesRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .userIdentifier("user_identifier") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyId:** `String` — The ID of the company to create the affiliate for. + +
+
+ +
+
+ +**userIdentifier:** `String` — The user identifier (username, email, user ID, or Discord ID). + +
+
+
+
+ + +
+
+
+ +
client.affiliates.retrieve(id) -> Affiliate +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing affiliate. + +Required permissions: + - `affiliate:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.affiliates().retrieve( + "aff_xxxxxxxxxxxxxx", + RetrieveAffiliatesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the affiliate. + +
+
+
+
+ + +
+
+
+ +
client.affiliates.archive(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Archives an existing Affiliate + +Required permissions: + - `affiliate:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.affiliates().archive( + "aff_xxxxxxxxxxxxxx", + ArchiveAffiliatesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The internal ID of the affiliate to archive. + +
+
+
+
+ + +
+
+
+ +
client.affiliates.unarchive(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Unarchives an existing Affiliate + +Required permissions: + - `affiliate:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.affiliates().unarchive( + "aff_xxxxxxxxxxxxxx", + UnarchiveAffiliatesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The internal ID of the affiliate to archive. + +
+
+
+
+ + +
+
+
+ +## AiChats +
client.aiChats.list() -> SyncPagingIterable&lt;AiChatListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of AI chat threads for the current authenticated user. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.aiChats().list( + ListAiChatsRequest + .builder() + .first(42) + .last(42) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**onlyActiveCrons:** `Optional` — When true, returns only chats with an active cron schedule + +
+
+
+
+ + +
+
+
+ +
client.aiChats.create(request) -> AiChat +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new AI chat thread and send the first message to the AI agent. + +Required permissions: + - `ai_chat:create` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.aiChats().create( + CreateAiChatsRequest + .builder() + .messageText("message_text") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**currentCompanyId:** `Optional` — The unique identifier of the company to set as context for the AI chat (e.g., "biz_XXXXX"). + +
+
+ +
+
+ +**messageAttachments:** `Optional>` — A list of previously uploaded file attachments to include with the first message. + +
+
+ +
+
+ +**messageSource:** `Optional` — The source of the message. + +
+
+ +
+
+ +**messageText:** `String` — The text content of the first message to send to the AI agent. + +
+
+ +
+
+ +**suggestionType:** `Optional` — The type of suggestion prompt that was clicked, when message_source is 'suggestion'. + +
+
+ +
+
+ +**title:** `Optional` — An optional display title for the AI chat thread (e.g., "Help with billing"). + +
+
+
+
+ + +
+
+
+ +
client.aiChats.retrieve(id) -> AiChat +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing AI chat. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.aiChats().retrieve( + "aich_xxxxxxxxxxxxx", + RetrieveAiChatsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the AI chat to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.aiChats.delete(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete an AI chat thread so it no longer appears in the user's chat list. + +Required permissions: + - `ai_chat:delete` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.aiChats().delete( + "aich_xxxxxxxxxxxxx", + DeleteAiChatsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the AI chat to delete (e.g., "ai_chat_XXXXX"). + +
+
+
+
+ + +
+
+
+ +
client.aiChats.update(id, request) -> AiChat +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update an AI chat's title, notification preferences, or associated company context. + +Required permissions: + - `ai_chat:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.aiChats().update( + "aich_xxxxxxxxxxxxx", + UpdateAiChatsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the AI chat to update (e.g., "ai_chat_XXXXX"). + +
+
+ +
+
+ +**currentCompanyId:** `Optional` — The unique identifier of the company to set as context for the AI chat (e.g., "biz_XXXXX"). + +
+
+ +
+
+ +**notificationPreference:** `Optional` — The notification preference for the AI chat. + +
+
+ +
+
+ +**title:** `Optional` — The new display title for the AI chat thread (e.g., "Help with billing"). + +
+
+
+
+ + +
+
+
+ +## API Keys +
client.apiKeys.list() -> SyncPagingIterable&lt;ApiKey&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the API keys of an account or app, newest first. Responses never include the full secret — only its obfuscated form. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apiKeys().list( + ListApiKeysRequest + .builder() + .resourceId("resource_id") + .resourceType(ListApiKeysRequestResourceType.ACCOUNT) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**resourceId:** `String` — The account (`biz_`) or app (`app_`) tag to list API keys for. + +
+
+ +
+
+ +**resourceType:** `ListApiKeysRequestResourceType` — The type of resource that owns the API keys. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return API keys created before this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return API keys created after this ISO 8601 timestamp. + +
+
+ +
+
+ +**first:** `Optional` — The number of API keys to return (default 20, max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns API keys after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of API keys to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns API keys before this position. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort API keys by. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+
+
+ + +
+
+
+ +
client.apiKeys.create(request) -> ApiKey +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates an API key for an account or app. The response is the only place the full `secret_key` is returned — store it immediately. Requires a user session; API keys cannot manage API keys. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apiKeys().create( + CreateApiKeysRequest + .builder() + .name("Shine Time Booking (production)") + .permissions( + CreateApiKeysRequestPermissions + .builder() + .build() + ) + .resourceId("biz_xxxxxxxxxxxxxx") + .resourceType(CreateApiKeysRequestResourceType.ACCOUNT) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**apiVersionDate:** `Optional` — Dated API version used when requests authenticated with this key omit the `Api-Version-Date` header. New keys default to the latest version. + +
+
+ +
+
+ +**expiresAt:** `Optional` — When the API key should stop working, as an ISO 8601 timestamp. Omit (or pass `null` on update) for a key that never expires. + +
+
+ +
+
+ +**ipAllowlist:** `Optional>` — IPv4/IPv6 CIDR ranges allowed to use this key, for example `["203.0.113.0/24"]`. Empty or `null` allows any IP. + +
+
+ +
+
+ +**name:** `String` — A human-readable name for the API key, such as 'Production API Key'. + +
+
+ +
+
+ +**permissions:** `CreateApiKeysRequestPermissions` — The permissions policy for the API key: explicit permission statements, or a system role to inherit from. Statements without a `resources` array default to the owning account (Account API keys) or every key-addressable resource (App API keys). + +
+
+ +
+
+ +**resourceId:** `String` — The account (`biz_`) or app (`app_`) tag to create the API key for. + +
+
+ +
+
+ +**resourceType:** `CreateApiKeysRequestResourceType` — The type of resource that will own this API key. + +
+
+
+
+ + +
+
+
+ +
client.apiKeys.listPermissions() -> ListPermissionsApiKeysResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the catalog of permission actions that can be granted to users, apps, and API keys — the source for the dashboard's permission pickers. Small and returned in full on one page. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apiKeys().listPermissions(); +``` +
+
+
+
+ + +
+
+
+ +
client.apiKeys.retrieve(id) -> ApiKey +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apiKeys().retrieve( + "id", + RetrieveApiKeysRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — API key ID, prefixed `apik_`. + +
+
+
+
+ + +
+
+
+ +
client.apiKeys.delete(id) -> DeleteApiKeysResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apiKeys().delete( + "id", + DeleteApiKeysRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — API key ID, prefixed `apik_`. + +
+
+
+
+ + +
+
+
+ +
client.apiKeys.update(id, request) -> ApiKey +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apiKeys().update( + "id", + UpdateApiKeysRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — API key ID, prefixed `apik_`. + +
+
+ +
+
+ +**apiVersionDate:** `Optional` — Dated API version used when requests authenticated with this key omit the `Api-Version-Date` header. New keys default to the latest version. + +
+
+ +
+
+ +**expiresAt:** `Optional` — When the API key should stop working, as an ISO 8601 timestamp. Omit (or pass `null` on update) for a key that never expires. + +
+
+ +
+
+ +**ipAllowlist:** `Optional>` — IPv4/IPv6 CIDR ranges allowed to use this key, for example `["203.0.113.0/24"]`. Empty or `null` allows any IP. + +
+
+ +
+
+ +**name:** `Optional` — A new human-readable name for the API key. + +
+
+ +
+
+ +**permissions:** `Optional` — The permissions policy for the API key: explicit permission statements, or a system role to inherit from. Statements without a `resources` array default to the owning account (Account API keys) or every key-addressable resource (App API keys). + +
+
+
+
+ + +
+
+
+ +
client.apiKeys.rotate(id) -> ApiKey +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new `secret_key` is returned. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apiKeys().rotate( + "id", + RotateApiKeysRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — API key ID, prefixed `apik_`. + +
+
+
+
+ + +
+
+
+ +## App Builds +
client.appBuilds.list() -> SyncPagingIterable&lt;AppBuild&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of build artifacts for an app, newest first, with optional platform, status, and creation-date filters. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.appBuilds().list( + ListAppBuildsRequest + .builder() + .appId("app_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**appId:** `String` — The app to list builds for, prefixed `app_`. + +
+
+ +
+
+ +**platform:** `Optional` — Filter builds by target platform. + +
+
+ +
+
+ +**status:** `Optional` — Filter builds by review status. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return builds created before this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return builds created after this ISO 8601 timestamp. + +
+
+ +
+
+ +**first:** `Optional` — The number of builds to return (default 20, max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns builds after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of builds to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns builds before this position. + +
+
+
+
+ + +
+
+
+ +
client.appBuilds.create(request) -> AppBuild +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Uploads a new build artifact for an app. Upload the file first (POST /files or a direct upload), then reference it here; iOS and Android take a .zip bundle, web takes a JavaScript file or a .zip archive of the hosted site. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.appBuilds().create( + CreateAppBuildsRequest + .builder() + .attachment( + CreateAppBuildsRequestAttachment + .builder() + .build() + ) + .checksum("xxxxxxxxxxxxxxx") + .platform(CreateAppBuildsRequestPlatform.IOS) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**aiPromptId:** `Optional` — The AI prompt that generated this build, if applicable. + +
+
+ +
+
+ +**appId:** `Optional` — The app to create the build for, prefixed `app_`. Defaults to the app behind the presented credential. + +
+
+ +
+
+ +**attachment:** `CreateAppBuildsRequestAttachment` — The uploaded build file: `{ id }` for an existing file or `{ direct_upload_id }` for a completed direct upload. + +
+
+ +
+
+ +**checksum:** `String` — A client-generated checksum of the build file, used to verify file integrity when unpacked. + +
+
+ +
+
+ +**platform:** `CreateAppBuildsRequestPlatform` — The target platform for the build. + +
+
+ +
+
+ +**sourceAttachment:** `Optional` — An optional compressed archive (.zip or .gz) of the source code that produced this build, stored alongside the build so it can be downloaded later. Referenced like `attachment`, and must be a different file. + +
+
+ +
+
+ +**supportedAppViewTypes:** `Optional>` — The view types this build supports. Only list the ones its code implements. + +
+
+
+
+ + +
+
+
+ +
client.appBuilds.retrieve(id) -> AppBuild +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing app build. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.appBuilds().retrieve( + "id", + RetrieveAppBuildsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — App build ID, prefixed `abld_`. + +
+
+
+
+ + +
+
+
+ +
client.appBuilds.promote(id) -> AppBuild +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.appBuilds().promote( + "id", + PromoteAppBuildsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — App build ID, prefixed `abld_`. + +
+
+
+
+ + +
+
+
+ +## Apps +
client.apps.list() -> SyncPagingIterable&lt;AppListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists apps on the Whop platform: the app store's live apps, or — with `account_id` and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: `verified_apps_only=true`, and `app_type=website` with no `account_id`, which returns every live deployed website that Whop has not verified — verified templates are the curated `verified_apps_only=true` list instead. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apps().list( + ListAppsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Only return apps created by this account (`biz_` tag). With developer access to the account this includes its unlisted and hidden apps. + +
+
+ +
+
+ +**appType:** `Optional` — Filter apps by the type of end-user they are built for. Apps of type `website` are left out unless you ask for them by name. + +
+
+ +
+
+ +**viewType:** `Optional` — Only return apps supporting this view type, such as `dashboard` or `hub`. + +
+
+ +
+
+ +**verifiedAppsOnly:** `Optional` — Whether to only return apps verified by Whop. Verified website templates — websites with a published web build — are included, even though websites are otherwise left out of app lists. + +
+
+ +
+
+ +**query:** `Optional` — A search string matched against app names. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort apps by. Defaults to discoverable_at, showing the most recently published apps first. `template_usage` ranks Whop-verified apps first, then apps with a banner image, then by how many apps were created from each app as a template. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+ +
+
+ +**first:** `Optional` — The number of apps to return (default 20, max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns apps after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of apps to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns apps before this position. + +
+
+
+
+ + +
+
+
+ +
client.apps.create(request) -> App +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Registers a new app on the Whop developer platform. Apps provide custom experiences that can be added to products. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apps().create( + CreateAppsRequest + .builder() + .name("Shine Time Booking") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The account to create the app for (`biz_` tag). Defaults to the account behind the presented credential. + +
+
+ +
+
+ +**appType:** `Optional` — The type of app to create. Defaults to `b2c_app`. + +
+
+ +
+
+ +**baseUrl:** `Optional` — The base production URL where the app is hosted, such as `https://myapp.example.com`. + +
+
+ +
+
+ +**icon:** `Optional` — The icon image for the app in PNG, JPEG, or GIF format, referencing an uploaded file: `{ id }` for an existing attachment or `{ direct_upload_id }` for a new direct upload. + +
+
+ +
+
+ +**name:** `String` — The display name for the app, shown to users on the app store and product pages. + +
+
+ +
+
+ +**redirectUris:** `Optional>` — The whitelisted OAuth callback URLs that users are redirected to after authorizing the app. + +
+
+ +
+
+ +**route:** `Optional` — The subdomain route where the app's hosted web builds are served, such as `myapp` for myapp.whop.app. + +
+
+
+
+ + +
+
+
+ +
client.apps.updatePermissionsApp(appId, request) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates the permission requirements for an app + +Required permissions: + - `developer:update_app_authorization` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apps().updatePermissionsApp( + "app_id", + UpdatePermissionsAppRequest + .builder() + .requestedPermissions( + Arrays.asList( + UpdatePermissionsAppRequestRequestedPermissionsItem + .builder() + .action("action") + .isRequired(true) + .justification("justification") + .build() + ) + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**appId:** `String` — The ID of the app the permission requirements are being updated for + +
+
+ +
+
+ +**requestedPermissions:** `List` — The permissions that the app will request off of users when a user installs the app. + +
+
+
+
+ + +
+
+
+ +
client.apps.retrieve(id) -> App +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render `null` unless the caller has the corresponding developer permission on the owning account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apps().retrieve( + "id", + RetrieveAppsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — App ID (prefixed `app_`), the app's claimed route, or its proxy domain id. + +
+
+
+
+ + +
+
+
+ +
client.apps.delete(id) -> DeleteAppsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apps().delete( + "id", + DeleteAppsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — App ID (prefixed `app_`), the app's claimed route, or its proxy domain id. + +
+
+
+
+ + +
+
+
+ +
client.apps.update(id, request) -> App +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apps().update( + "id", + UpdateAppsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — App ID (prefixed `app_`), the app's claimed route, or its proxy domain id. + +
+
+ +
+
+ +**appStoreDescription:** `Optional` — The detailed description shown on the app store's in-depth app view page. + +
+
+ +
+
+ +**appType:** `Optional` — The type of end-user the app is built for. Cannot be changed on an app whose type is already `website`. + +
+
+ +
+
+ +**baseUrl:** `Optional` — The base production URL where the app is hosted. Set to `null` to take the app proxy offline. + +
+
+ +
+
+ +**dashboardPath:** `Optional` — The URL path for the account dashboard view. + +
+
+ +
+
+ +**description:** `Optional` — A short description of the app shown in listings and search results. + +
+
+ +
+
+ +**discoverPath:** `Optional` — The URL path for the discover view. + +
+
+ +
+
+ +**experiencePath:** `Optional` — The URL path for the member-facing hub view, such as `/experiences/[experienceId]`. + +
+
+ +
+
+ +**icon:** `Optional` — The icon image for the app in PNG, JPEG, or GIF format, referencing an uploaded file: `{ id }` for an existing attachment or `{ direct_upload_id }` for a new direct upload. + +
+
+ +
+
+ +**name:** `Optional` — The display name for the app, shown to users on the app store and product pages. + +
+
+ +
+
+ +**oauthClientType:** `Optional` — How the app authenticates at the OAuth token endpoint. + +
+
+ +
+
+ +**openapiPath:** `Optional` — The URL path to the app's OpenAPI spec file (requires the ai_chat capability). + +
+
+ +
+
+ +**productionAndroidBuildId:** `Optional` — The app build (`abld_` tag) to serve as the Android production build, or `null` to unassign it. Same rules as `production_web_build_id`. + +
+
+ +
+
+ +**productionIosBuildId:** `Optional` — The app build (`abld_` tag) to serve as the iOS production build, or `null` to unassign it. Same rules as `production_web_build_id`. + +
+
+ +
+
+ +**productionWebBuildId:** `Optional` — The app build (`abld_` tag) to serve as the web production build, or `null` to unassign it. The build must belong to this app, target web, and be in the draft or approved status; a draft build is queued for approval and takes over once approved. Requires the `developer:manage_builds` scope. + +
+
+ +
+
+ +**redirectUris:** `Optional>` — The whitelisted OAuth callback URLs users are redirected to after authorizing the app. + +
+
+ +
+
+ +**requiredScopes:** `Optional>` — The OAuth scopes the app requests from users when they install it. + +
+
+ +
+
+ +**route:** `Optional` — The subdomain route where the app's hosted web builds are served. + +
+
+ +
+
+ +**secrets:** `Optional>` — Secrets to add or overwrite on the app, as an object of string values. Keys not included are left untouched; pass null or an empty string as the value to delete a secret. Encrypted at rest and injected into the app's hosted server runtime. + +
+
+ +
+
+ +**skillsPath:** `Optional` — The URL path to the app's skills directory (requires the ai_chat capability). + +
+
+ +
+
+ +**status:** `Optional` — Controls whether the app is published on Whop discovery or accessible only through its direct link. Publishing requires a name, icon, and description. + +
+
+
+
+ + +
+
+
+ +
client.apps.deploy(id, request) -> AppDeployment +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's `deployment` field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apps().deploy( + "id", + DeployAppsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The app to deploy, prefixed `app_`. + +
+
+ +
+
+ +**draft:** `Optional` — Upload the build without making it live. Defaults to `false`, which deploys and promotes in one step. + +
+
+
+
+ + +
+
+
+ +
client.apps.logs(id) -> SyncPagingIterable&lt;LogsAppsResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apps().logs( + "id", + LogsAppsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the app, which will look like app_*************. + +
+
+ +
+
+ +**appBuildId:** `Optional` — Only return logs from this build. + +
+
+ +
+
+ +**level:** `Optional` — Only return console lines of this level. + +
+
+ +
+
+ +**query:** `Optional` — Only return logs whose message contains this text (case-insensitive). + +
+
+ +
+
+ +**createdAfter:** `Optional` — Start of the time window as an ISO 8601 timestamp. Defaults to 7 days before created_before. + +
+
+ +
+
+ +**createdBefore:** `Optional` — End of the time window as an ISO 8601 timestamp. Defaults to now. + +
+
+ +
+
+ +**first:** `Optional` — The number of log lines to return (max 500). + +
+
+ +
+
+ +**after:** `Optional` — A cursor for fetching logs after a previous page. + +
+
+ +
+
+ +**before:** `Optional` — A cursor for fetching logs before a later page. + +
+
+
+
+ + +
+
+
+ +
client.apps.updatePermissions(id, request) -> App +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Replaces the set of permissions the app requests from users when they install it. Requires a user session: the `developer:update_app_authorization` scope cannot be delegated to API keys. Sensitive permissions require step-up verification. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.apps().updatePermissions( + "id", + UpdatePermissionsAppsRequest + .builder() + .requestedPermissions( + Arrays.asList( + UpdatePermissionsAppsRequestRequestedPermissionsItem + .builder() + .action("company:basic:read") + .isRequired(true) + .justification("Reads basic account info to render the dashboard home.") + .build() + ) + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — App ID, prefixed `app_`. + +
+
+ +
+
+ +**requestedPermissions:** `List` — The full set of permissions the app requests on install; permissions not listed are removed. + +
+
+
+
+ + +
+
+
+ +## Audiences +
client.audiences.list() -> SyncPagingIterable&lt;Audience&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists uploaded customer-list audiences for an account. Pass `audience_id` to return a specific audience. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.audiences().list( + ListAudiencesRequest + .builder() + .accountId("account_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — Account ID, prefixed `biz_`. + +
+
+ +
+
+ +**audienceId:** `Optional` — Audience ID, prefixed `adaud_`, used to filter the response to one audience. + +
+
+ +
+
+ +**audienceType:** `Optional` — Filter by audience type: `custom` (uploaded lists) or `lookalike`. + +
+
+ +
+
+ +**sourceType:** `Optional` — Filter by member source: `csv_upload` (uploaded lists) or `people_filter` (automatic audiences built from saved People filters). + +
+
+ +
+
+ +**first:** `Optional` — Number of audiences to return. Defaults to 20; maximum 100. + +
+
+ +
+
+ +**after:** `Optional` — Cursor for the next page of audiences. + +
+
+
+
+ + +
+
+
+ +
client.audiences.create(request) -> CreateAudiencesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates an audience. Default (`audience_type` omitted or `custom`): creates one audience from an uploaded customer identity CSV file (`name`, `column_mapping`, and `file_id` required) and starts processing it; responds with the audience object. With `filters`: creates an audience from saved People filters (`name` required) — membership is built from the account's People data, and `auto_refresh` decides whether it keeps tracking the filters or keeps whoever matched at creation. With `audience_type: lookalike`: creates a ladder of Meta lookalike audiences from an existing ready custom audience (`source_audience_id`, `count`, and `percentage` required) — `count` equal similarity bands slicing the top `percentage`% (3 audiences at 6% = 0–2%, 2–4%, 4–6%), each returned as its own audience in a `{ data: [...] }` envelope. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.audiences().create( + CreateAudiencesRequest + .builder() + .accountId("biz_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — Account ID, prefixed `biz_`. + +
+
+ +
+
+ +**audienceType:** `Optional` — What to create. Defaults to `custom` (CSV upload). + +
+
+ +
+
+ +**autoRefresh:** `Optional` — Filter audiences only, and set only at creation. `true` (the default) rebuilds membership from the filters twice a day. `false` keeps whoever matched at creation and never rebuilds. + +
+
+ +
+
+ +**columnMapping:** `Optional` — Custom audiences only. Maps supported identity fields to CSV column headers. Map at least one of `email` or `phone`. + +
+
+ +
+
+ +**count:** `Optional` — Lookalikes only. Number of lookalike audiences to create (1–6). + +
+
+ +
+
+ +**fileId:** `Optional` — Custom audiences only. The uploaded customer CSV — a file id (`file_...`) returned by `POST /files`. + +
+
+ +
+
+ +**filters:** `Optional>` — Filter audiences only. The People filters that define membership, keyed exactly as `GET /people` accepts them — for example `{"os": "iOS", "country": "US"}`. Date filters must be rolling windows — `first_seen_within_days` or `last_seen_within_days` — so the audience re-anchors on every refresh; fixed dates such as `first_seen_after` are rejected. Source values are canonical source paths (`whop:::`, `ext::...`, `referrer:`, `direct`), exact or with a trailing `:*` wildcard. + +
+
+ +
+
+ +**name:** `Optional` — Audience display name. Required for custom audiences; lookalike names are generated from the source audience. + +
+
+ +
+
+ +**percentage:** `Optional` — Lookalikes only. Total similarity reach as a whole percent (1–20), sliced evenly across `count` — must be divisible by `count`. + +
+
+ +
+
+ +**sourceAudienceId:** `Optional` — Lookalikes only. The ready custom audience (`adaud_`) to build from; it needs at least 100 matched people. + +
+
+
+
+ + +
+
+
+ +
client.audiences.delete(id) -> DeleteAudiencesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes an audience so it is no longer available for targeting. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.audiences().delete( + "id", + DeleteAudiencesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Audience ID, prefixed `adaud_`. + +
+
+
+
+ + +
+
+
+ +
client.audiences.update(id, request) -> Audience +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Renames an audience. For an audience built from People filters that keeps itself up to date, pass `filters` to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.audiences().update( + "id", + UpdateAudiencesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Audience ID, prefixed `adaud_`. + +
+
+ +
+
+ +**filters:** `Optional>` — Replaces the People filters that define membership. The whole definition is replaced rather than merged, so send every filter you want to keep — a filter you leave out stops applying. Keys and values are the ones `GET /people` accepts, such as an `os` of `iOS` or a `country` of `US`, and at least one filter is required. Date filters must be rolling windows — `first_seen_within_days` or `last_seen_within_days` — so the audience re-anchors every time it rebuilds; fixed dates such as `first_seen_after` are rejected, as is `audience_id`. An array value holds at most 500 items, and each value at most 10 KB. Only an audience with a `source_type` of `people_filter` and `auto_refresh` of `true` accepts filters: an uploaded list has no filters to replace, and with auto refresh off the audience keeps the people it matched when it was built, so create a new audience instead. + +
+
+ +
+
+ +**name:** `Optional` — New audience display name. A blank value is ignored rather than clearing the name. + +
+
+
+
+ + +
+
+
+ +
client.audiences.addPeople(id, request) -> Audience +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Adds users from a new CSV file to an existing uploaded custom audience. The file uses the audience's saved column mapping, processing happens in the background, and existing audience members remain unchanged. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.audiences().addPeople( + "id", + AddPeopleAudiencesRequest + .builder() + .fileId("file_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Audience ID, prefixed `adaud_`. + +
+
+ +
+
+ +**fileId:** `String` — The new customer CSV — a file id (`file_...`) returned by `POST /files`. Its headers must match the audience's saved column mapping. + +
+
+
+
+ + +
+
+
+ +## AuthorizedUsers +
client.authorizedUsers.list() -> SyncPagingIterable&lt;AuthorizedUserListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + +Required permissions: + - `company:authorized_user:read` + - `member:email:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.authorizedUsers().list( + ListAuthorizedUsersRequest + .builder() + .first(42) + .last(42) + .companyId("biz_xxxxxxxxxxxxxx") + .userId("user_xxxxxxxxxxxxx") + .createdBefore(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .createdAfter(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `Optional` — The unique identifier of the company to list authorized users for. + +
+
+ +
+
+ +**userId:** `Optional` — Filter results to a specific user to check if they are an authorized team member. + +
+
+ +
+
+ +**role:** `Optional` + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return authorized users created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return authorized users created after this timestamp. + +
+
+
+
+ + +
+
+
+ +
client.authorizedUsers.create(request) -> AuthorizedUser +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add a new authorized user to a company. + +Required permissions: + - `authorized_user:create` + - `member:email:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.authorizedUsers().create( + CreateAuthorizedUsersRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .role(GrantableAuthorizedUserRoles.OWNER) + .userId("user_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyId:** `String` — The ID of the company to add the authorized user to. + +
+
+ +
+
+ +**elevation:** `Optional` — Re-authentication proof required to perform this sensitive action. + +
+
+ +
+
+ +**role:** `GrantableAuthorizedUserRoles` — The role to assign to the authorized user within the company. Supported roles: 'moderator', 'sales_manager'. + +
+
+ +
+
+ +**sendEmails:** `Optional` — Whether to send notification emails to the user on creation. + +
+
+ +
+
+ +**userId:** `String` — The ID of the user to add as an authorized user. + +
+
+
+
+ + +
+
+
+ +
client.authorizedUsers.retrieve(id) -> AuthorizedUser +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing authorized user. + +Required permissions: + - `company:authorized_user:read` + - `member:email:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.authorizedUsers().retrieve( + "ausr_xxxxxxxxxxxxx", + RetrieveAuthorizedUsersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the authorized user to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.authorizedUsers.delete(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Remove an authorized user from a company. + +Required permissions: + - `authorized_user:delete` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.authorizedUsers().delete( + "ausr_xxxxxxxxxxxxx", + DeleteAuthorizedUsersRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the authorized user or user to remove. + +
+
+ +
+
+ +**companyId:** `Optional` — The ID of the company the authorized user belongs to. Optional if the authorized user ID is provided. + +
+
+
+
+ + +
+
+
+ +## Bounties +
client.bounties.list() -> SyncPagingIterable&lt;BountyListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.bounties().list( + ListBountiesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Scope the list to this account (`biz_` tag). Requires read access to the account; account API keys may pass their own account or a connected account. + +
+
+ +
+
+ +**userId:** `Optional` — List the bounties this user participated in (`user_` tag). Must be the authenticated user. + +
+
+ +
+
+ +**status:** `Optional` — Filter by lifecycle state. + +
+
+ +
+
+ +**businessGoalType:** `Optional` — Filter by the poster's declared goal. Bounties created before the goal taxonomy carry no goal and never match this filter. + +
+
+ +
+
+ +**country:** `Optional` — Only bounties workable from this country, as an ISO 3166-1 alpha-2 code. Bounties with no country targeting are workable worldwide and always match. + +
+
+ +
+
+ +**experienceId:** `Optional` — Only bounties posted to this forum experience, prefixed `exp_`. An unknown experience, or one outside the caller's scope, matches nothing. + +
+
+ +
+
+ +**query:** `Optional` — Substring match on the bounty title or ID. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only bounties created after this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only bounties created before this ISO 8601 timestamp. + +
+
+ +
+
+ +**order:** `Optional` — Sort field. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+ +
+
+ +**first:** `Optional` — Number of bounties to return from the start of the window. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to paginate forwards from. + +
+
+ +
+
+ +**last:** `Optional` — Number of bounties to return from the end of the window. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to paginate backwards from. + +
+
+
+
+ + +
+
+
+ +
client.bounties.create(request) -> Bounty +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a bounty and escrows its reward pool. Publishes immediately, or as a scheduled draft when you set `publish_at`. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.bounties().create( + CreateBountiesRequest + .builder() + .description("Record one continuous pass of a full interior detail, dash to trunk, on a customer vehicle.") + .grossRewardAmount(40.0) + .title("Record interior detailing passes") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**acceptedSubmissionsLimit:** `Optional` — Number of submissions that can be accepted (winner slots). Defaults to 1. The escrowed total is `gross_reward_amount` times this limit and must be at least $5. + +
+
+ +
+
+ +**acceptedSubmissionsPerUserLimit:** `Optional` — How many winner slots one worker can win. Defaults to `1`. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed `accepted_submissions_limit`. + +
+
+ +
+
+ +**accountId:** `Optional` — Account whose balance funds the bounty pool (`biz_` tag). Defaults to the caller's personal balance. Requires permission to move the account's funds. + +
+
+ +
+
+ +**allowedCountryCodes:** `Optional>` — Countries whose residents can work the bounty, as ISO 3166 alpha-2 codes. Empty means worldwide. + +
+
+ +
+
+ +**businessGoalType:** `Optional` — What the poster wants the work to achieve, declared once here. + +
+
+ +
+
+ +**captureSpec:** `Optional` — Per-bounty overrides of the served capture contract. Only accepted when `business_goal_type` is `data_capture`; omitted fields keep the platform defaults, and the resulting contract is echoed back as `capture_spec` on the bounty. + +
+
+ +
+
+ +**description:** `String` — Full task instructions shown to workers. + +
+
+ +
+
+ +**experienceId:** `Optional` — Experience to host the bounty in (`exp_` tag). Any visibility — public for an open bounty, private for an invited one. Required unless account_id is set, in which case the bounty anchors in that account's public forum. + +
+
+ +
+
+ +**frequency:** `Optional` — How often the schedule creates a new bounty. Each occurrence is a separate bounty. Defaults to `once`; only applies with `publish_at`. + +
+
+ +
+
+ +**grossRewardAmount:** `Double` — Gross bounty-pool amount (USD) escrowed per accepted submission, in whole dollars. Platform fees and affiliate shares are paid from this amount. + +
+
+ +
+
+ +**publishAt:** `Optional` — ISO 8601 time to publish the bounty. When set, the bounty is created as a hidden draft and funded + published at this time instead of immediately. + +
+
+ +
+
+ +**publishAtTimezone:** `Optional` — IANA timezone for recurring occurrences. Required when publish_at is set. + +
+
+ +
+
+ +**title:** `String` — Short name of the task shown to workers. + +
+
+
+
+ + +
+
+
+ +
client.bounties.retrieve(id) -> Bounty +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return `404`. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.bounties().retrieve( + "id", + RetrieveBountiesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Bounty ID (`bnty_` tag). + +
+
+
+
+ + +
+
+
+ +
client.bounties.update(id, request) -> Bounty +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.bounties().update( + "id", + UpdateBountiesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Bounty ID (`bnty_` tag). + +
+
+ +
+
+ +**acceptedSubmissionsLimit:** `Optional` — Scheduled drafts only. Number of submissions that can be accepted (winner slots). + +
+
+ +
+
+ +**acceptedSubmissionsPerUserLimit:** `Optional` — How many winner slots one worker can win. Defaults to `1`. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed `accepted_submissions_limit`. Editable while the bounty is still open with nothing under review. + +
+
+ +
+
+ +**allowedCountryCodes:** `Optional>` — Replace the countries whose residents can work the bounty, as ISO 3166 alpha-2 codes. Empty means worldwide. + +
+
+ +
+
+ +**businessGoalType:** `Optional` — What the poster wants the work to achieve, declared once here. + +
+
+ +
+
+ +**description:** `Optional` — New full task instructions. + +
+
+ +
+
+ +**frequency:** `Optional` — Scheduled drafts only. How often the schedule creates a new bounty. + +
+
+ +
+
+ +**grossRewardAmount:** `Optional` — Scheduled drafts only. Gross bounty-pool amount (USD) escrowed per accepted submission. The escrowed total (this times accepted_submissions_limit) must stay at least $5. + +
+
+ +
+
+ +**publishAt:** `Optional` — Scheduled drafts only. New ISO 8601 time to publish the draft. Must be in the future. + +
+
+ +
+
+ +**publishAtTimezone:** `Optional` — Scheduled drafts only. IANA timezone for recurring occurrences. + +
+
+ +
+
+ +**title:** `Optional` — New short name of the task. + +
+
+
+
+ + +
+
+
+ +
client.bounties.cancel(id) -> Bounty +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns `400`. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.bounties().cancel( + "id", + CancelBountiesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Bounty ID (`bnty_` tag). + +
+
+
+
+ + +
+
+
+ +## Bounty Submissions +
client.bountySubmissions.list() -> SyncPagingIterable&lt;BountySubmission&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.bountySubmissions().list( + ListBountySubmissionsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Scope the list to submissions on this account's bounties (`biz_` tag). Requires read access to the account. + +
+
+ +
+
+ +**bountyId:** `Optional` — Only submissions on this bounty (`bnty_` tag). + +
+
+ +
+
+ +**status:** `Optional` — Filter by lifecycle state. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only submissions created after this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only submissions created before this ISO 8601 timestamp. + +
+
+ +
+
+ +**order:** `Optional` — Sort field. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+ +
+
+ +**first:** `Optional` — Number of submissions to return from the start of the window. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to paginate forwards from. + +
+
+ +
+
+ +**last:** `Optional` — Number of submissions to return from the end of the window. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to paginate backwards from. + +
+
+
+
+ + +
+
+
+ +
client.bountySubmissions.create(request) -> BountySubmission +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a submission on a workforce bounty. Include a `deliverable` payload — any combination of links and uploaded files, with at least one of the two — and the submission goes straight to review; create is the only step. For `data_capture` bounties, omit the deliverable: this starts a claimed attempt whose proof accumulates server-side, and the separate submit endpoint sends it to review once complete. Requires a user credential — account API keys cannot author submissions. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.bountySubmissions().create( + CreateBountySubmissionsRequest + .builder() + .bountyId("bnty_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**affiliateCode:** `Optional` — Affiliate code crediting the referrer, when the worker arrived through one. + +
+
+ +
+
+ +**bountyId:** `String` — The bounty to submit to (`bnty_` tag). + +
+
+ +
+
+ +**deliverable:** `Optional` — The submitted work. Combine `urls`, `file_ids`, and `caption` freely; at least one link or file is required. + +
+
+ +
+
+ +**metadata:** `Optional` — Optional capture metadata describing where and how the footage was recorded. Persisted on the submission. On a `data_capture` bounty every field except `fov` is required whenever metadata is provided. + +
+
+
+
+ + +
+
+
+ +
client.bountySubmissions.retrieve(id) -> BountySubmission +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes `account_id`, the same way the list does. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.bountySubmissions().retrieve( + "id", + RetrieveBountySubmissionsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The bounty submission to act on (`btys_` tag). + +
+
+ +
+
+ +**accountId:** `Optional` — Read the submission as this account (`biz_` tag), scoping the lookup to its bounties rather than the caller's own work. Requires read access to the account. Without it the lookup covers only what the credential owns — the submissions the caller authored plus those on bounties they posted. + +
+
+
+
+ + +
+
+
+ +
client.bountySubmissions.delete(id) -> DeleteBountySubmissionsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.bountySubmissions().delete( + "id", + DeleteBountySubmissionsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The bounty submission to act on (`btys_` tag). + +
+
+
+
+ + +
+
+
+ +
client.bountySubmissions.submit(id, request) -> BountySubmission +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional `deliverable` — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.bountySubmissions().submit( + "id", + SubmitBountySubmissionsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The claimed attempt to submit for review (`btys_` tag). + +
+
+ +
+
+ +**deliverable:** `Optional` — Work to attach to the submission. Combine `urls`, `file_ids`, and `caption` freely; all are optional. + +
+
+
+
+ + +
+
+
+ +## CardTransactions +
client.cardTransactions.list() -> SyncPagingIterable&lt;CardTransaction&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass `transaction_ids` to fetch specific transactions instead of paging for them. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.cardTransactions().list( + ListCardTransactionsRequest + .builder() + .transactionIds( + Arrays.asList("citx_xxxxxxxxxxxxxx") + ) + .cardId( + Arrays.asList("icrd_xxxxxxxxxxxxxx") + ) + .cardholderId( + Arrays.asList("user_xxxxxxxxxxxxxx") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The account whose card transactions to list, prefixed `biz_`. Defaults to the credential's account. + +
+
+ +
+
+ +**transactionIds:** `Optional` — Return only these card transactions, each prefixed `citx_`. Repeat the parameter, or pass one comma-separated value. + +
+
+ +
+
+ +**cardId:** `Optional` — Return only transactions charged to these cards, each prefixed `icrd_`. + +
+
+ +
+
+ +**cardholderId:** `Optional` — Return only transactions on cards assigned to these users, each prefixed `user_`. + +
+
+ +
+
+ +**status:** `Optional` — Return only transactions with this status. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Return only transactions authorized at or after this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Return only transactions authorized at or before this ISO 8601 timestamp. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort by. Defaults to `created_at`. + +
+
+ +
+
+ +**direction:** `Optional` — The sort direction. Defaults to `desc`. + +
+
+ +
+
+ +**first:** `Optional` — The number of card transactions to return. + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns card transactions after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of card transactions to return, counting back from the end. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns card transactions before this position. + +
+
+
+
+ + +
+
+
+ +
client.cardTransactions.retrieve(id) -> CardTransaction +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Fetches a single card transaction by its `citx_` identifier. The owner defaults to the account the credential belongs to. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.cardTransactions().retrieve( + "id", + RetrieveCardTransactionsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The card transaction ID, prefixed `citx_`. + +
+
+ +
+
+ +**accountId:** `Optional` — The account that owns the transaction, prefixed `biz_`. Defaults to the credential's account. + +
+
+
+
+ + +
+
+
+ +## Cards +
client.cards.list() -> ListCardsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.cards().list( + ListCardsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The owning account ID (a biz_ identifier). Provide this or user_id. + +
+
+ +
+
+ +**userId:** `Optional` — The owning user ID (a user_ identifier). Provide this or account_id. + +
+
+
+
+ + +
+
+
+ +
client.cards.create(request) -> CreateCardsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Issue a virtual card, or apply for card issuing. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.cards().create( + CreateCardsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The owning account ID (a biz_ identifier). Provide this or user_id. + +
+
+ +
+
+ +**assignedUserId:** `Optional` — The account member (a user_ identifier) to assign the card to. Required for business card issuing accounts. + +
+
+ +
+
+ +**name:** `Optional` — A display name for the card. + +
+
+ +
+
+ +**spendLimit:** `Optional` — Spending limit amount, in dollars. + +
+
+ +
+
+ +**spendLimitFrequency:** `Optional` — The window the spend limit applies to. + +
+
+ +
+
+ +**transactionLimit:** `Optional` — Per-transaction limit amount, in dollars. + +
+
+ +
+
+ +**userId:** `Optional` — The owning user ID (a user_ identifier). Provide this or account_id. + +
+
+
+
+ + +
+
+
+ +
client.cards.retrieve(id) -> RetrieveCardsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a single card. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.cards().retrieve( + "id", + RetrieveCardsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Card ID to retrieve, prefixed `icrd_`. + +
+
+ +
+
+ +**accountId:** `Optional` — The owning account ID (a biz_ identifier). Provide this or user_id. + +
+
+ +
+
+ +**userId:** `Optional` — The owning user ID (a user_ identifier). Provide this or account_id. + +
+
+
+
+ + +
+
+
+ +
client.cards.update(id, request) -> UpdateCardsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both `payout:account:update` and `company:balance:read`; a card's assigned holder may update their own card's pin and frozen state with any user token. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.cards().update( + "id", + UpdateCardsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Card ID to retrieve, prefixed `icrd_`. + +
+
+ +
+
+ +**accountId:** `Optional` — The owning account ID (a biz_ identifier). Provide this or user_id. + +
+
+ +
+
+ +**billing:** `Optional` — New billing address. Requires line1, city, region, postal_code, and country_code. On an invited card, passing billing alone (as the invited user) completes onboarding and starts card provisioning. + +
+
+ +
+
+ +**canceled:** `Optional` — Pass `true` to permanently cancel the card. A canceled card cannot be uncanceled. Cannot be combined with other fields. + +
+
+ +
+
+ +**frozen:** `Optional` — Pass `true` to freeze the card, `false` to unfreeze it. The assigned cardholder may freeze their own card without the payout:account:update scope. + +
+
+ +
+
+ +**name:** `Optional` — A display name for the card. + +
+
+ +
+
+ +**pin:** `Optional` — New 4-digit PIN. Can only be set on a card assigned to the acting user, who may set it without the payout:account:update scope. + +
+
+ +
+
+ +**removeLimit:** `Optional` — Pass `true` to remove the spending limit (make the card unlimited). + +
+
+ +
+
+ +**spendLimit:** `Optional` — Spending limit amount, in dollars. + +
+
+ +
+
+ +**spendLimitFrequency:** `Optional` — The window the spend limit applies to. + +
+
+ +
+
+ +**transactionLimit:** `Optional` — Per-transaction limit amount, in dollars. + +
+
+ +
+
+ +**userId:** `Optional` — The owning user ID (a user_ identifier). Provide this or account_id. + +
+
+
+
+ + +
+
+
+ +## ChatChannels +
client.chatChannels.list() -> SyncPagingIterable&lt;ChatChannelListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of chat channels within a specific company, with optional filtering by product. + +Required permissions: + - `chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.chatChannels().list( + ListChatChannelsRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .first(42) + .last(42) + .productId("prod_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to list chat channels for. + +
+
+ +
+
+ +**productId:** `Optional` — The unique identifier of a product to filter by. When set, only chat channels connected to this product are returned. + +
+
+
+
+ + +
+
+
+ +
client.chatChannels.retrieve(id) -> ChatChannel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing chat channel. + +Required permissions: + - `chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.chatChannels().retrieve( + "id", + RetrieveChatChannelsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the chat channel or experience to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.chatChannels.update(id, request) -> ChatChannel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + +Required permissions: + - `chat:moderate` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.chatChannels().update( + "id", + UpdateChatChannelsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the chat channel to update. Accepts either an experience ID (e.g. 'exp_xxxxx') or a chat channel ID. + +
+
+ +
+
+ +**banMedia:** `Optional` — Whether media uploads such as images and videos are banned in this chat channel. + +
+
+ +
+
+ +**banUrls:** `Optional` — Whether URLs and links are banned from being posted in this chat channel. + +
+
+ +
+
+ +**bannedWords:** `Optional>` — A list of words that are automatically blocked from messages in this chat channel. For example, ['spam', 'scam']. + +
+
+ +
+
+ +**userPostsCooldownSeconds:** `Optional` — The minimum number of seconds a user must wait between sending messages in this chat channel. + +
+
+ +
+
+ +**whoCanPost:** `Optional` — Controls which roles are allowed to send messages in this chat channel. + +
+
+ +
+
+ +**whoCanReact:** `Optional` — Controls which roles are allowed to add reactions to messages in this chat channel. + +
+
+
+
+ + +
+
+
+ +## Checkout Configurations +
client.checkoutConfigurations.list() -> SyncPagingIterable&lt;ListCheckoutConfigurationsResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists checkout configurations for an account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.checkoutConfigurations().list( + ListCheckoutConfigurationsRequest + .builder() + .accountId("account_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — Account ID, prefixed `biz_`. + +
+
+ +
+
+ +**planId:** `Optional` — Only return checkout configurations for this plan ID, prefixed `plan_`. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return checkout configurations created before this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return checkout configurations created after this ISO 8601 timestamp. + +
+
+ +
+
+ +**order:** `Optional` — Field used to sort checkout configurations. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. Defaults to `desc`. + +
+
+ +
+
+ +**first:** `Optional` — Number of checkout configurations to return. + +
+
+ +
+
+ +**after:** `Optional` — Cursor for the next page of results. + +
+
+
+
+ + +
+
+
+ +
client.checkoutConfigurations.create(request) -> CreateCheckoutConfigurationsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a reusable checkout configuration for an existing or inline plan. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.checkoutConfigurations().create( + CreateCheckoutConfigurationsRequest + .builder() + .accountId("biz_xxxxxxxxxxxxxx") + .planId("plan_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Account ID, prefixed `biz_`. + +
+
+ +
+
+ +**affiliateCode:** `Optional` — Affiliate code to apply to the checkout. + +
+
+ +
+
+ +**currency:** `Optional` — Currency used for setup-mode payment method availability. + +
+
+ +
+
+ +**metadata:** `Optional>` — Custom key-value metadata copied to payments and memberships. + +
+
+ +
+
+ +**mode:** `Optional` — Controls whether checkout charges the buyer immediately or saves payment details for later. Defaults to `payment`. + +
+
+ +
+
+ +**paymentMethodConfiguration:** `Optional` — Payment method overrides for this checkout. `null` uses the plan or platform defaults. + +
+
+ +
+
+ +**plan:** `Optional` — Plan attributes used to create or find a plan for this checkout configuration. Mutually exclusive with `plan_id`. + +
+
+ +
+
+ +**planId:** `Optional` — Existing plan ID, prefixed `plan_`. Mutually exclusive with `plan`. + +
+
+ +
+
+ +**redirectUrl:** `Optional` — URL customers are sent to after checkout. + +
+
+ +
+
+ +**threeDsLevel:** `Optional` — 3D Secure behavior for this checkout. + +
+
+
+
+ + +
+
+
+ +
client.checkoutConfigurations.retrieve(id) -> RetrieveCheckoutConfigurationsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.checkoutConfigurations().retrieve( + "id", + RetrieveCheckoutConfigurationsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the checkout configuration. + +
+
+
+
+ + +
+
+
+ +
client.checkoutConfigurations.delete(id) -> DeleteCheckoutConfigurationsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a checkout configuration so its checkout URL can no longer be used. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.checkoutConfigurations().delete( + "id", + DeleteCheckoutConfigurationsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the checkout configuration. + +
+
+
+
+ + +
+
+
+ +## Companies +
client.companies.list() -> SyncPagingIterable&lt;CompanyListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + +Required permissions: + - `company:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.companies().list( + ListCompaniesRequest + .builder() + .first(42) + .last(42) + .createdBefore(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .createdAfter(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**parentCompanyId:** `Optional` — The unique identifier of the parent platform company. When provided, lists connected accounts under that platform. Omit to list the current user's own companies. + +
+
+ +
+
+ +**direction:** `Optional` + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return companies created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return companies created after this timestamp. + +
+
+
+
+ + +
+
+
+ +
client.companies.create(request) -> Company +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new company. Pass parent_company_id to create a connected account under a platform, or omit it to create a company for the current user. + +Required permissions: + - `company:create` + - `company:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.companies().create( + CreateCompaniesRequest + .builder() + .title("title") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**country:** `Optional` — The country the company is located in. Defaults to the parent company's country for connected accounts, or the owner's IP-derived country. + +
+
+ +
+
+ +**description:** `Optional` — A promotional pitch displayed to potential customers on the company's store page. + +
+
+ +
+
+ +**email:** `Optional` — The email address of the user who will own the connected account. Required when parent_company_id is provided. + +
+
+ +
+
+ +**logo:** `Optional` — The company's logo image. Accepts PNG, JPEG, or GIF format. + +
+
+ +
+
+ +**metadata:** `Optional>` — A key-value JSON object of custom metadata to store on the company. + +
+
+ +
+
+ +**parentCompanyId:** `Optional` — The unique identifier of the parent platform company. When provided, creates a connected account under that platform. Omit to create a company for the current user. + +
+
+ +
+
+ +**sendCustomerEmails:** `Optional` — Whether Whop sends transactional emails to customers on behalf of this company. Only applies when creating a connected account. + +
+
+ +
+
+ +**title:** `String` — The display name of the company shown to customers. + +
+
+
+
+ + +
+
+
+ +
client.companies.retrieve(id) -> Company +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing company. + +Required permissions: + - `company:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.companies().retrieve( + "biz_xxxxxxxxxxxxxx", + RetrieveCompaniesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier or route slug of the company. + +
+
+
+
+ + +
+
+
+ +
client.companies.update(id, request) -> Company +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a company's title, description, logo, and other settings. + +Required permissions: + - `company:update` + - `company:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.companies().update( + "biz_xxxxxxxxxxxxxx", + UpdateCompaniesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the company to update. + +
+
+ +
+
+ +**affiliateApplicationRequired:** `Optional` — Whether prospective affiliates must submit an application before they can promote this company. + +
+
+ +
+
+ +**affiliateInstructions:** `Optional` — Guidelines and instructions shown to affiliates explaining how to promote this company's products. + +
+
+ +
+
+ +**bannerImage:** `Optional` — The company's banner image. Accepts PNG or JPEG format. + +
+
+ +
+
+ +**description:** `Optional` — A promotional pitch displayed to potential customers on the company's store page. + +
+
+ +
+
+ +**featuredAffiliateProductId:** `Optional` — The ID of the product to feature on this company's affiliate page. Pass null to clear. + +
+
+ +
+
+ +**logo:** `Optional` — The company's logo image. Accepts PNG, JPEG, or GIF format. + +
+
+ +
+
+ +**route:** `Optional` — The unique URL slug for the company's store page. Must be lowercase and can include hyphens (e.g., 'my-company'). If not provided, the route will remain unchanged. + +
+
+ +
+
+ +**sendCustomerEmails:** `Optional` — Whether Whop sends transactional emails (receipts, renewals, cancelations) to customers on behalf of this company. + +
+
+ +
+
+ +**socialLinks:** `Optional>` — The social media links to display on the company's store page. Pass the full list of desired social links — any existing links not included will be removed. + +
+
+ +
+
+ +**targetAudience:** `Optional` — The target audience for this company (e.g., 'beginner day traders aged 18-25 looking to learn options'). + +
+
+ +
+
+ +**title:** `Optional` — The display name of the company shown to customers. + +
+
+
+
+ + +
+
+
+ +
client.companies.createApiKey(parentCompanyId, request) -> CreateApiKeyCompaniesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create an API key for a connected account (child company) owned by a parent company. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.companies().createApiKey( + "parent_company_id", + CreateApiKeyCompaniesRequest + .builder() + .childCompanyId("child_company_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**parentCompanyId:** `String` — The unique identifier of the parent platform company (e.g. 'biz_xxx'). + +
+
+ +
+
+ +**childCompanyId:** `String` — The unique identifier of the connected account to create the API key for (e.g. 'biz_xxx'). + +
+
+ +
+
+ +**name:** `Optional` — A human-readable name for the API key, such as 'Production API Key'. + +
+
+ +
+
+ +**permissions:** `Optional>` — Granular permission statements defining which actions this API key can perform. Either permissions or role must be provided. + +
+
+ +
+
+ +**role:** `Optional` — A system role to inherit permissions from (e.g. owner, admin, moderator). Either role or permissions must be provided. + +
+
+
+
+ + +
+
+
+ +## CompanyTokenTransactions +
client.companyTokenTransactions.list() -> SyncPagingIterable&lt;CompanyTokenTransactionListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of token transactions for a user or company, depending on the authenticated actor, with optional filtering by user and transaction type. + +Required permissions: + - `company_token_transaction:read` + - `member:basic:read` + - `company:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.companyTokenTransactions().list( + ListCompanyTokenTransactionsRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .first(42) + .last(42) + .userId("user_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to list token transactions for. + +
+
+ +
+
+ +**userId:** `Optional` — Filter transactions to only those involving this specific user. + +
+
+ +
+
+ +**transactionType:** `Optional` + +
+
+
+
+ + +
+
+
+ +
client.companyTokenTransactions.create(request) -> CompanyTokenTransaction +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a token transaction to add, subtract, or transfer tokens for a member within a company. + +Required permissions: + - `company_token_transaction:create` + - `member:basic:read` + - `company:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.companyTokenTransactions().create( + CreateCompanyTokenTransactionsRequest.transfer( + CreateCompanyTokenTransactionsRequestTransfer + .builder() + .amount(6.9) + .companyId("biz_xxxxxxxxxxxxxx") + .destinationUserId("destination_user_id") + .userId("user_xxxxxxxxxxxxx") + .build() + ) +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `CreateCompanyTokenTransactionsRequest` — Parameters for CreateCompanyTokenTransaction + +
+
+
+
+ + +
+
+
+ +
client.companyTokenTransactions.retrieve(id) -> CompanyTokenTransaction +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing company token transaction. + +Required permissions: + - `company_token_transaction:read` + - `member:basic:read` + - `company:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.companyTokenTransactions().retrieve( + "id", + RetrieveCompanyTokenTransactionsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the token transaction to retrieve. + +
+
+
+
+ + +
+
+
+ +## CourseChapters +
client.courseChapters.list() -> SyncPagingIterable&lt;CourseChapterListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of chapters within a course, ordered by position. + +Required permissions: + - `courses:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseChapters().list( + ListCourseChaptersRequest + .builder() + .courseId("cors_xxxxxxxxxxxxx") + .first(42) + .last(42) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**courseId:** `String` — The unique identifier of the course to list chapters for. + +
+
+
+
+ + +
+
+
+ +
client.courseChapters.create(request) -> CourseChapter +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new chapter within a course to organize lessons into sections. + +Required permissions: + - `courses:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseChapters().create( + CreateCourseChaptersRequest + .builder() + .courseId("cors_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**courseId:** `String` — The unique identifier of the course to create the chapter in (e.g., "course_XXXXX"). + +
+
+ +
+
+ +**title:** `Optional` — The display title of the chapter (e.g., "Module 1: Introduction"). + +
+
+
+
+ + +
+
+
+ +
client.courseChapters.retrieve(id) -> CourseChapter +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing course chapter. + +Required permissions: + - `courses:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseChapters().retrieve( + "chap_xxxxxxxxxxxxx", + RetrieveCourseChaptersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the chapter to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.courseChapters.delete(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Permanently delete a chapter and all of its lessons from a course. + +Required permissions: + - `courses:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseChapters().delete( + "chap_xxxxxxxxxxxxx", + DeleteCourseChaptersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the chapter to delete (e.g., "chap_XXXXX"). + +
+
+
+
+ + +
+
+
+ +
client.courseChapters.update(id, request) -> CourseChapter +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a chapter's title within a course. + +Required permissions: + - `courses:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseChapters().update( + "chap_xxxxxxxxxxxxx", + UpdateCourseChaptersRequest + .builder() + .title("title") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the chapter to update (e.g., "chap_XXXXX"). + +
+
+ +
+
+ +**title:** `String` — The new display title of the chapter (e.g., "Module 1: Introduction"). + +
+
+
+
+ + +
+
+
+ +## CourseLessonInteractions +
client.courseLessonInteractions.list() -> SyncPagingIterable&lt;CourseLessonInteractionListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + +Required permissions: + - `courses:read` + - `course_analytics:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseLessonInteractions().list( + ListCourseLessonInteractionsRequest + .builder() + .first(42) + .last(42) + .userId("user_xxxxxxxxxxxxx") + .lessonId("lesn_xxxxxxxxxxxxx") + .courseId("cors_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**userId:** `Optional` — The unique identifier of the user to filter lesson interactions for. + +
+
+ +
+
+ +**lessonId:** `Optional` — The unique identifier of the lesson to filter interactions for. + +
+
+ +
+
+ +**courseId:** `Optional` — The unique identifier of the course to filter interactions for. + +
+
+ +
+
+ +**completed:** `Optional` — Whether to filter for completed or in-progress lesson interactions. + +
+
+
+
+ + +
+
+
+ +
client.courseLessonInteractions.retrieve(id) -> CourseLessonInteraction +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing course lesson interaction. + +Required permissions: + - `courses:read` + - `course_analytics:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseLessonInteractions().retrieve( + "crsli_xxxxxxxxxxxx", + RetrieveCourseLessonInteractionsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the lesson interaction to retrieve. + +
+
+
+
+ + +
+
+
+ +## CourseLessons +
client.courseLessons.list() -> SyncPagingIterable&lt;CourseLessonListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of lessons within a course or chapter, ordered by position. + +Required permissions: + - `courses:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseLessons().list( + ListCourseLessonsRequest + .builder() + .first(42) + .last(42) + .courseId("cors_xxxxxxxxxxxxx") + .chapterId("chap_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**courseId:** `Optional` — The unique identifier of the course to return all lessons across all chapters. + +
+
+ +
+
+ +**chapterId:** `Optional` — The unique identifier of a chapter to return only its lessons. + +
+
+
+
+ + +
+
+
+ +
client.courseLessons.create(request) -> CourseLesson +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new lesson within a course chapter. Lessons can contain video, text, or assessment content. + +Required permissions: + - `courses:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseLessons().create( + CreateCourseLessonsRequest + .builder() + .chapterId("chap_xxxxxxxxxxxxx") + .lessonType(LessonTypes.TEXT) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**chapterId:** `String` — The unique identifier of the chapter to create the lesson in (e.g., "chap_XXXXX"). + +
+
+ +
+
+ +**content:** `Optional` — The Markdown content body of the lesson. + +
+
+ +
+
+ +**daysFromCourseStartUntilUnlock:** `Optional` — The number of days after a student starts the course before this lesson becomes accessible. + +
+
+ +
+
+ +**embedId:** `Optional` — The external video identifier for embedded content (e.g., a YouTube video ID or Loom share ID). + +
+
+ +
+
+ +**embedType:** `Optional` — The type of video embed for this lesson, such as YouTube or Loom. + +
+
+ +
+
+ +**lessonType:** `LessonTypes` — The content type of the lesson, such as video, text, quiz, or knowledge check. + +
+
+ +
+
+ +**thumbnail:** `Optional` — The thumbnail image for the lesson in PNG, JPEG, or GIF format. + +
+
+ +
+
+ +**title:** `Optional` — The display title of the lesson (e.g., "Getting Started with APIs"). + +
+
+
+
+ + +
+
+
+ +
client.courseLessons.retrieve(id) -> CourseLesson +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing course lesson. + +Required permissions: + - `courses:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseLessons().retrieve( + "lesn_xxxxxxxxxxxxx", + RetrieveCourseLessonsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the lesson to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.courseLessons.delete(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Permanently delete a lesson and remove it from its chapter. + +Required permissions: + - `courses:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseLessons().delete( + "lesn_xxxxxxxxxxxxx", + DeleteCourseLessonsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the lesson to delete (e.g., "les_XXXXX"). + +
+
+
+
+ + +
+
+
+ +
client.courseLessons.update(id, request) -> CourseLesson +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a lesson's content, type, visibility, assessment questions, or media attachments. + +Required permissions: + - `courses:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseLessons().update( + "lesn_xxxxxxxxxxxxx", + UpdateCourseLessonsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the lesson to update (e.g., "les_XXXXX"). + +
+
+ +
+
+ +**assessmentCompletionRequirement:** `Optional` — The passing criteria for quiz or knowledge check lessons, such as minimum grade or correct answers. + +
+
+ +
+
+ +**assessmentQuestions:** `Optional>` — The full list of assessment questions for quiz or knowledge check lessons. Replaces all existing questions. + +
+
+ +
+
+ +**attachments:** `Optional>` — File attachments for the lesson such as PDFs or documents. Replaces all existing attachments. + +
+
+ +
+
+ +**content:** `Optional` — The Markdown content body of the lesson. + +
+
+ +
+
+ +**daysFromCourseStartUntilUnlock:** `Optional` — The number of days after a student starts the course before this lesson becomes accessible. + +
+
+ +
+
+ +**embedId:** `Optional` — The external video identifier for embedded content (e.g., a YouTube video ID or Loom share ID). + +
+
+ +
+
+ +**embedType:** `Optional` — The type of video embed for this lesson, such as YouTube or Loom. + +
+
+ +
+
+ +**lessonType:** `Optional` — The content type of the lesson, such as video, text, quiz, or knowledge check. + +
+
+ +
+
+ +**mainPdf:** `Optional` — The primary PDF document attached to this lesson for student reference. + +
+
+ +
+
+ +**maxAttempts:** `Optional` — The maximum number of attempts a student is allowed for assessment lessons. + +
+
+ +
+
+ +**muxAssetId:** `Optional` — The identifier of a Mux video asset to attach to this lesson (e.g., "mux_XXXXX"). + +
+
+ +
+
+ +**thumbnail:** `Optional` — The thumbnail image for the lesson in PNG, JPEG, or GIF format. + +
+
+ +
+
+ +**title:** `Optional` — The display title of the lesson (e.g., "Getting Started with APIs"). + +
+
+ +
+
+ +**visibility:** `Optional` — Controls whether this lesson is visible to students or hidden as a draft. + +
+
+
+
+ + +
+
+
+ +
client.courseLessons.markAsCompleted(lessonId) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Mark a lesson as completed for the current user after they finish the content. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseLessons().markAsCompleted( + "lesson_id", + MarkAsCompletedCourseLessonsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**lessonId:** `String` — The unique identifier of the lesson to mark as completed (e.g., "les_XXXXX"). + +
+
+
+
+ + +
+
+
+ +
client.courseLessons.start(lessonId) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Record that the current user has started viewing a lesson, creating progress tracking records. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseLessons().start( + "lesson_id", + StartCourseLessonsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**lessonId:** `String` — The unique identifier of the lesson the user is starting (e.g., "les_XXXXX"). + +
+
+
+
+ + +
+
+
+ +
client.courseLessons.submitAssessment(lessonId, request) -> SubmitAssessmentCourseLessonsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Submit answers for a quiz or knowledge check lesson and receive a graded result. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseLessons().submitAssessment( + "lesson_id", + SubmitAssessmentCourseLessonsRequest + .builder() + .answers( + Arrays.asList( + SubmitAssessmentCourseLessonsRequestAnswersItem + .builder() + .questionId("question_id") + .build() + ) + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**lessonId:** `String` — The unique identifier of the quiz or knowledge check lesson to submit answers for (e.g., "les_XXXXX"). + +
+
+ +
+
+ +**answers:** `List` — The list of answers to submit for each assessment question. + +
+
+
+
+ + +
+
+
+ +## CourseStudents +
client.courseStudents.list() -> SyncPagingIterable&lt;CourseStudentListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of students enrolled in a course, with optional name filtering. + +Required permissions: + - `courses:read` + - `course_analytics:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseStudents().list( + ListCourseStudentsRequest + .builder() + .courseId("cors_xxxxxxxxxxxxx") + .first(42) + .last(42) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**courseId:** `String` — The unique identifier of the course to list enrolled students for. + +
+
+ +
+
+ +**keyword:** `Optional` — A search term to filter students by name or username. + +
+
+
+
+ + +
+
+
+ +
client.courseStudents.retrieve(id) -> CourseStudent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing course student. + +Required permissions: + - `courses:read` + - `course_analytics:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courseStudents().retrieve( + "id", + RetrieveCourseStudentsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the course student record to retrieve. + +
+
+
+
+ + +
+
+
+ +## Courses +
client.courses.list() -> SyncPagingIterable&lt;CourseListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of courses, filtered by either an experience or a company. + +Required permissions: + - `courses:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courses().list( + ListCoursesRequest + .builder() + .first(42) + .last(42) + .experienceId("exp_xxxxxxxxxxxxxx") + .companyId("biz_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**experienceId:** `Optional` — The unique identifier of the experience to list courses for. + +
+
+ +
+
+ +**companyId:** `Optional` — The unique identifier of the company to list courses for. + +
+
+
+
+ + +
+
+
+ +
client.courses.create(request) -> Course +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new course within an experience, with optional chapters, lessons, and a certificate. + +Required permissions: + - `courses:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courses().create( + CreateCoursesRequest + .builder() + .experienceId("exp_xxxxxxxxxxxxxx") + .title("title") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**certificateAfterCompletionEnabled:** `Optional` — Whether the course awards students a PDF certificate after completing all lessons. + +
+
+ +
+
+ +**experienceId:** `String` — The unique identifier of the experience to create the course in (e.g., "exp_XXXXX"). + +
+
+ +
+
+ +**order:** `Optional` — The decimal order position of the course within its experience. Use fractional values (e.g., "1.5") to place between existing courses. + +
+
+ +
+
+ +**requireCompletingLessonsInOrder:** `Optional` — Whether students must complete each lesson sequentially before advancing to the next one. + +
+
+ +
+
+ +**tagline:** `Optional` — A short tagline displayed beneath the course title (e.g., "Master the fundamentals of design"). + +
+
+ +
+
+ +**thumbnail:** `Optional` — The thumbnail image for the course in PNG, JPEG, or GIF format. + +
+
+ +
+
+ +**title:** `String` — The display title of the course (e.g., "Introduction to Web Development"). + +
+
+ +
+
+ +**visibility:** `Optional` — Controls whether this course is visible to students or hidden as a draft. + +
+
+
+
+ + +
+
+
+ +
client.courses.retrieve(id) -> Course +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing course. + +Required permissions: + - `courses:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courses().retrieve( + "cors_xxxxxxxxxxxxx", + RetrieveCoursesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the course to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.courses.delete(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Permanently delete a course and all of its chapters, lessons, and student progress. + +Required permissions: + - `courses:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courses().delete( + "cors_xxxxxxxxxxxxx", + DeleteCoursesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the course to delete (e.g., "course_XXXXX"). + +
+
+
+
+ + +
+
+
+ +
client.courses.update(id, request) -> Course +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a course's title, description, visibility, thumbnail, or chapter ordering. + +Required permissions: + - `courses:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.courses().update( + "cors_xxxxxxxxxxxxx", + UpdateCoursesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the course to update (e.g., "course_XXXXX"). + +
+
+ +
+
+ +**certificateAfterCompletionEnabled:** `Optional` — Whether the course awards students a PDF certificate after completing all lessons. + +
+
+ +
+
+ +**chapters:** `Optional>` — A list of chapters with nested lessons to reorder or rename in bulk. + +
+
+ +
+
+ +**description:** `Optional` — A short description of the course displayed to students on the course page. + +
+
+ +
+
+ +**language:** `Optional` — The primary language spoken in the video content of the course. + +
+
+ +
+
+ +**order:** `Optional` — The decimal order position of the course within its experience. Use fractional values (e.g., "1.5") to place between existing courses. + +
+
+ +
+
+ +**requireCompletingLessonsInOrder:** `Optional` — Whether students must complete each lesson sequentially before advancing to the next one. + +
+
+ +
+
+ +**tagline:** `Optional` — A short tagline displayed beneath the course title (e.g., "Master the fundamentals of design"). + +
+
+ +
+
+ +**thumbnail:** `Optional` — The thumbnail image for the course in PNG, JPEG, or GIF format. + +
+
+ +
+
+ +**title:** `Optional` — The display title of the course (e.g., "Introduction to Web Development"). + +
+
+ +
+
+ +**visibility:** `Optional` — Controls whether this course is visible to students or hidden as a draft. + +
+
+
+
+ + +
+
+
+ +## Deposits +
client.deposits.create(request) -> CreateDepositsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve the deposit methods for an account, including crypto and bank transfer. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.deposits().create( + CreateDepositsRequest + .builder() + .destination( + CreateDepositsRequestDestination.of("destination") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**amount:** `Optional` — Amount to prefill on hosted deposit page. + +
+
+ +
+
+ +**destination:** `CreateDepositsRequestDestination` — Destination account ID or wallet address. Object form is supported for compatibility. Any business resolves by its account ID without authentication; a user account resolves only for that same authenticated user. + +
+
+ +
+
+ +**metadata:** `Optional>` — Metadata to include with the deposit response. + +
+
+ +
+
+ +**network:** `Optional` — Destination network override. Defaults to the destination wallet's own network. + +
+
+
+
+ + +
+
+
+ +## Dispute alerts +
client.disputeAlerts.list() -> SyncPagingIterable&lt;DisputeAlert&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the dispute alerts and early fraud warnings across the accounts you can read. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.disputeAlerts().list( + ListDisputeAlertsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Only alerts on this account's payments (`biz_` tag). Omit it to cover every account you can read. + +
+
+ +
+
+ +**paymentId:** `Optional` — Only alerts on this payment (`pay_` tag). A payment can carry several. + +
+
+ +
+
+ +**type:** `Optional` — Only alerts of this kind. `early_fraud_warning` for issuer fraud reports, `dispute_alert` for pre-dispute notices, `rapid_dispute_resolution` for Visa RDR cases the network already closed. + +
+
+ +
+
+ +**first:** `Optional` — The number of alerts to return (default 20, max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns alerts after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of alerts to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns alerts before this position. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort alerts by. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only alerts Whop received before this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only alerts Whop received after this ISO 8601 timestamp. + +
+
+
+
+ + +
+
+
+ +
client.disputeAlerts.retrieve(id) -> DisputeAlert +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a single dispute alert or early fraud warning by ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.disputeAlerts().retrieve( + "id", + RetrieveDisputeAlertsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The dispute alert ID, prefixed `dspa_`. + +
+
+
+
+ + +
+
+
+ +## Disputes +
client.disputes.list() -> SyncPagingIterable&lt;Dispute&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the disputes across the accounts you can read. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.disputes().list( + ListDisputesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Only disputes filed against this account (`biz_` tag). Omit it to cover every account you can read. + +
+
+ +
+
+ +**first:** `Optional` — The number of disputes to return (default 20, max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns disputes after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of disputes to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns disputes before this position. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort disputes by. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+ +
+
+ +**status:** `Optional` — Only disputes in these statuses. Repeat the parameter to pass several — one paginated list covers all of them. Covers both chargebacks and inquiries at each stage. A `needs_response` dispute whose evidence deadline has passed reports and filters as `under_review` instead. + +
+
+ +
+
+ +**currency:** `Optional` — Only disputes in this three-letter ISO currency. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only disputes opened before this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only disputes opened after this ISO 8601 timestamp. + +
+
+
+
+ + +
+
+
+ +
client.disputes.summary() -> SummaryDisputesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.disputes().summary( + SummaryDisputesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**groups:** `Optional` — Which breakdowns to return, keyed by these names under `groups`. Repeat the parameter to ask for several; omit it for all of them. + +
+
+ +
+
+ +**accountId:** `Optional` — Only disputes filed against this account (`biz_` tag). Omit it to cover every account you can read. + +
+
+ +
+
+ +**status:** `Optional` — Only disputes in these statuses. Repeat the parameter to pass several. A `needs_response` dispute whose evidence deadline has passed reports and filters as `under_review` instead. + +
+
+ +
+
+ +**currency:** `Optional` — Only disputes in this three-letter ISO currency. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only disputes opened before this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only disputes opened after this ISO 8601 timestamp. + +
+
+
+
+ + +
+
+
+ +
client.disputes.retrieve(id) -> Dispute +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a single dispute. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.disputes().retrieve( + "id", + RetrieveDisputesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The dispute ID (`dspt_` tag). + +
+
+
+
+ + +
+
+
+ +
client.disputes.update(id, request) -> Dispute +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Edits a dispute's evidence, while it is still editable. Sending it is a separate call. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.disputes().update( + "id", + UpdateDisputesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The dispute ID (`dspt_` tag). + +
+
+ +
+
+ +**evidence:** `Optional` — The evidence packet to send to the processor. Only the fields you provide are changed. + +
+
+
+
+ + +
+
+
+ +
client.disputes.submit(id) -> Dispute +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.disputes().submit( + "id", + SubmitDisputesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The dispute ID (`dspt_` tag). + +
+
+
+
+ + +
+
+
+ +
client.disputes.submitEvidenceDispute(id) -> Dispute +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + +Required permissions: + - `payment:dispute` + - `plan:basic:read` + - `access_pass:basic:read` + - `company:basic:read` + - `payment:basic:read` + - `member:email:read` + - `member:basic:read` + - `member:phone:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.disputes().submitEvidenceDispute( + "dspt_xxxxxxxxxxxxx", + SubmitEvidenceDisputeRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the dispute to submit to the payment processor for review. + +
+
+
+
+ + +
+
+
+ +
client.disputes.updateEvidenceDispute(id, request) -> Dispute +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a dispute with evidence data to attempt to win the dispute. + +Required permissions: + - `payment:dispute` + - `plan:basic:read` + - `access_pass:basic:read` + - `company:basic:read` + - `payment:basic:read` + - `member:email:read` + - `member:basic:read` + - `member:phone:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.disputes().updateEvidenceDispute( + "dspt_xxxxxxxxxxxxx", + UpdateEvidenceDisputeRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the dispute to update. + +
+
+ +
+
+ +**accessActivityLog:** `Optional` — An IP access activity log showing the customer used the service. + +
+
+ +
+
+ +**billingAddress:** `Optional` — The billing address associated with the customer's payment method. + +
+
+ +
+
+ +**cancellationPolicyAttachment:** `Optional` — A file upload containing the company's cancellation policy document. + +
+
+ +
+
+ +**cancellationPolicyDisclosure:** `Optional` — The company's cancellation policy text to submit as evidence. + +
+
+ +
+
+ +**customerCommunicationAttachment:** `Optional` — A file upload containing evidence of customer communication. Must be a JPEG, PNG, GIF, or PDF. + +
+
+ +
+
+ +**customerEmailAddress:** `Optional` — The email address of the customer associated with the disputed payment. + +
+
+ +
+
+ +**customerName:** `Optional` — The full name of the customer associated with the disputed payment. + +
+
+ +
+
+ +**notes:** `Optional` — Additional notes or context to submit as part of the dispute evidence. + +
+
+ +
+
+ +**productDescription:** `Optional` — A description of the product or service that was provided to the customer. + +
+
+ +
+
+ +**refundPolicyAttachment:** `Optional` — A file upload containing the company's refund policy document. + +
+
+ +
+
+ +**refundPolicyDisclosure:** `Optional` — The company's refund policy text to submit as evidence. + +
+
+ +
+
+ +**refundRefusalExplanation:** `Optional` — An explanation of why the refund request was refused. + +
+
+ +
+
+ +**serviceDate:** `Optional` — The date when the product or service was delivered to the customer. + +
+
+ +
+
+ +**uncategorizedAttachment:** `Optional` — A file upload for evidence that does not fit into the other categories. + +
+
+
+
+ + +
+
+
+ +
client.disputes.uploadEvidence(id, request) -> Dispute +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Replaces the full set of uploaded evidence documents on a dispute, beyond the four fixed evidence slots. Send the files as multipart file parts to upload and attach in one call, or reference files already stored by `id`/`direct_upload_id`. Send every document the packet should carry — up to 10, 10MB each and 25MB in total; an empty list removes them all. Accepted content types: application/pdf, application/json, image/jpeg, image/png, image/webp — any other type is rejected. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.disputes().uploadEvidence( + "id", + UploadEvidenceDisputesRequest + .builder() + .documents( + Arrays.asList( + UploadEvidenceDisputesRequestDocumentsItem + .builder() + .documentType(UploadEvidenceDisputesRequestDocumentsItemDocumentType.RETURN_POLICY) + .build() + ) + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The dispute ID (`dspt_` tag). + +
+
+ +
+
+ +**documents:** `List` — The full set of evidence documents the dispute should carry. Replaces all previously uploaded documents. + +
+
+
+
+ + +
+
+
+ +## DmChannels +
client.dmChannels.list() -> SyncPagingIterable&lt;DmChannelListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + +Required permissions: + - `dms:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.dmChannels().list( + ListDmChannelsRequest + .builder() + .first(42) + .last(42) + .companyId("biz_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `Optional` — The unique identifier of a company to filter DM channels by. Only returns channels scoped to this company. + +
+
+
+
+ + +
+
+
+ +
client.dmChannels.create(request) -> DmChannel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new DM channel between two or more users, optionally scoped to a specific company. Returns the existing channel if one already exists. + +Required permissions: + - `dms:channel:manage` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.dmChannels().create( + CreateDmChannelsRequest + .builder() + .withUserIds( + Arrays.asList("with_user_ids") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyId:** `Optional` — The unique identifier of the company to scope this DM channel to. When set, the channel is visible only within that company context. + +
+
+ +
+
+ +**customName:** `Optional` — A custom display name for the DM channel. For example, 'Project Discussion'. + +
+
+ +
+
+ +**notificationsEnabled:** `Optional` — Whether Whop app notifications are enabled for this direct message channel. Webhooks still fire. + +
+
+ +
+
+ +**withUserIds:** `List` — The list of user identifiers to include in the DM channel. Each entry can be an email, username, or user ID (e.g. 'user_xxxxx'). + +
+
+
+
+ + +
+
+
+ +
client.dmChannels.retrieve(id) -> DmChannel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing DM channel. + +Required permissions (one of): + - `dms:read` + - `support_chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.dmChannels().retrieve( + "id", + RetrieveDmChannelsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the DM channel to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.dmChannels.delete(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + +Required permissions (one of): + - `dms:channel:manage` + - `support_chat:create` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.dmChannels().delete( + "id", + DeleteDmChannelsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the DM channel to delete. + +
+
+
+
+ + +
+
+
+ +
client.dmChannels.update(id, request) -> DmChannel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + +Required permissions (one of): + - `dms:channel:manage` + - `support_chat:create` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.dmChannels().update( + "id", + UpdateDmChannelsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the DM channel to update. + +
+
+ +
+
+ +**customName:** `Optional` — A new custom display name for the DM channel. For example, 'Project Discussion'. + +
+
+
+
+ + +
+
+
+ +## DmMembers +
client.dmMembers.list() -> SyncPagingIterable&lt;DmMemberListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of members in a specific DM channel, sorted by the date they were added. + +Required permissions (one of): + - `dms:read` + - `support_chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.dmMembers().list( + ListDmMembersRequest + .builder() + .channelId("channel_id") + .first(42) + .last(42) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**channelId:** `String` — The unique identifier of the DM channel to list members for. + +
+
+
+
+ + +
+
+
+ +
client.dmMembers.create(request) -> DmMember +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add a new user to an existing DM channel. Only an admin of the channel can add members. + +Required permissions (one of): + - `dms:message:manage` + - `support_chat:message:create` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.dmMembers().create( + CreateDmMembersRequest + .builder() + .channelId("channel_id") + .userId("user_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**channelId:** `String` — The unique identifier of the DM channel to add the new member to. + +
+
+ +
+
+ +**userId:** `String` — The unique identifier of the user to add to the DM channel. For example, 'user_xxxxx'. + +
+
+
+
+ + +
+
+
+ +
client.dmMembers.retrieve(id) -> DmMember +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing DM member. + +Required permissions (one of): + - `dms:read` + - `support_chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.dmMembers().retrieve( + "id", + RetrieveDmMembersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the DM channel member to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.dmMembers.delete(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + +Required permissions (one of): + - `dms:read` + - `support_chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.dmMembers().delete( + "id", + DeleteDmMembersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the DM channel member to remove. + +
+
+
+
+ + +
+
+
+ +
client.dmMembers.update(id, request) -> DmMember +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a DM channel member's settings, such as their notification preferences or membership status. + +Required permissions (one of): + - `dms:read` + - `support_chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.dmMembers().update( + "id", + UpdateDmMembersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the DM channel member to update. + +
+
+ +
+
+ +**notificationPreference:** `Optional` — The notification setting for this member, controlling how they receive alerts for new messages in this channel. + +
+
+ +
+
+ +**status:** `Optional` — The membership status for this member in the DM channel. + +
+
+
+
+ + +
+
+
+ +## Entries +
client.entries.list() -> SyncPagingIterable&lt;EntryListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of waitlist entries for a company, with optional filtering by product, plan, status, and creation date. + +Required permissions: + - `plan:waitlist:read` + - `member:email:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.entries().list( + ListEntriesRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .first(42) + .last(42) + .createdBefore(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .createdAfter(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to list waitlist entries for. + +
+
+ +
+
+ +**direction:** `Optional` + +
+
+ +
+
+ +**order:** `Optional` + +
+
+ +
+
+ +**productIds:** `Optional` — Filter entries to only those for specific products. + +
+
+ +
+
+ +**planIds:** `Optional` — Filter entries to only those for specific plans. + +
+
+ +
+
+ +**statuses:** `Optional` — Filter entries by their current status. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return entries created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return entries created after this timestamp. + +
+
+
+
+ + +
+
+
+ +
client.entries.retrieve(id) -> Entry +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing waitlist entry. + +Required permissions: + - `plan:waitlist:read` + - `member:email:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.entries().retrieve( + "entry_xxxxxxxxxxxx", + RetrieveEntriesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the waitlist entry to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.entries.approve(id) -> ApproveEntriesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + +Required permissions: + - `plan:waitlist:manage` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.entries().approve( + "entry_xxxxxxxxxxxx", + ApproveEntriesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the waitlist entry to approve. + +
+
+
+
+ + +
+
+
+ +
client.entries.deny(id) -> Entry +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deny a pending waitlist entry, preventing the user from gaining access to the plan. + +Required permissions: + - `plan:waitlist:manage` + - `plan:basic:read` + - `member:email:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.entries().deny( + "entry_xxxxxxxxxxxx", + DenyEntriesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the waitlist entry to deny. + +
+
+
+
+ + +
+
+
+ +## Events +
client.events.list() -> SyncPagingIterable&lt;ListEventsResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.events().list( + ListEventsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**identifier:** `Optional` — Any hard identifier of the person: a person ID (prsn_*), user ID, email, phone number, or a tracking cookie value (wuid, anonymous ID, fbp/fbc/ttp/ga). Omit to list recent events for the account. + +
+
+ +
+
+ +**accountId:** `Optional` — Account ID, prefixed `biz_`. Optional for account API keys; required for credentials that can access multiple accounts. + +
+
+ +
+
+ +**from:** `Optional` — Start of the time range as an ISO 8601 timestamp. Required when identifier is omitted. + +
+
+ +
+
+ +**to:** `Optional` — End of the time range as an ISO 8601 timestamp. Required when identifier is omitted; otherwise defaults to now. + +
+
+ +
+
+ +**first:** `Optional` — The number of events to return. + +
+
+ +
+
+ +**after:** `Optional` — A cursor for fetching events after a previous page. + +
+
+ +
+
+ +**before:** `Optional` — A cursor for fetching events before a later page. + +
+
+ +
+
+ +**direction:** `Optional` — The order events are returned in by time. Defaults to desc (most recent first); asc reads a journey forwards from where it starts. after and before always page forwards and backwards through that order. + +
+
+ +
+
+ +**event:** `Optional` — Full event names to filter by, comma-separated (payment.completed, pixel.lead, pixel.page, pixel.custom:) — the same vocabulary the events / people metrics use. + +
+
+ +
+
+ +**source:** `Optional` — Canonical source path, exact or with a trailing :* prefix (whop::*, ext:meta:*, referrer:, direct). Restricts the list to conversion targets attributed to that source — the debuggability twin of a metric cell's source parameter. + +
+
+ +
+
+ +**attributionModel:** `Optional` — Attribution model for the source filter (defaults to last_touch). + +
+
+ +
+
+ +**country:** `Optional` — Country codes to filter by, comma-separated. + +
+
+ +
+
+ +**city:** `Optional` — Cities to filter by, comma-separated. + +
+
+ +
+
+ +**device:** `Optional` — Device families to filter by, comma-separated (e.g. iPhone, Mac). + +
+
+ +
+
+ +**browser:** `Optional` — Browser families to filter by, comma-separated (e.g. Chrome, Mobile Safari). + +
+
+ +
+
+ +**os:** `Optional` — Operating system families to filter by, comma-separated (e.g. iOS, Windows). + +
+
+ +
+
+ +**utmSource:** `Optional` — utm_source values to filter by, comma-separated. + +
+
+ +
+
+ +**hostname:** `Optional` — Page hostnames to filter by, comma-separated. + +
+
+ +
+
+ +**page:** `Optional` — Page paths to filter by, comma-separated. + +
+
+
+
+ + +
+
+
+ +
client.events.create(request) -> CreateEventsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Tracks a conversion or engagement event for an account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.events().create( + CreateEventsRequest + .builder() + .accountId("biz_xxxxxxxxxxxxxx") + .eventName("coating_deposit_paid") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — The account to associate with this event. + +
+
+ +
+
+ +**actionSource:** `Optional` — Where the event originated. + +
+
+ +
+
+ +**context:** `Optional` — Tracking and attribution context. + +
+
+ +
+
+ +**currency:** `Optional` — ISO 4217 currency code. + +
+
+ +
+
+ +**customName:** `Optional` — Custom event name when event_name is 'custom'. Maximum 35 chars for this value. + +
+
+ +
+
+ +**duration:** `Optional` — For 'leave' events: milliseconds the visitor spent on the page. + +
+
+ +
+
+ +**eventId:** `Optional` — Client-provided identifier for deduplication. Generated if omitted. + +
+
+ +
+
+ +**eventName:** `String` + +The type of event. + +Use a standard event (lead, submit_application, contact, complete_registration, schedule, view_content, add_to_cart) or pass your own name directly for a custom event. + +
+
+ +
+
+ +**eventTime:** `Optional` — When the event occurred. Defaults to now. + +
+
+ +
+
+ +**planId:** `Optional` — The plan associated with the event. + +
+
+ +
+
+ +**productId:** `Optional` — The product associated with the event. + +
+
+ +
+
+ +**referrerUrl:** `Optional` — The referring URL. + +
+
+ +
+
+ +**resumed:** `Optional` — For 'page' events: true when the page was restored from the back/forward cache. + +
+
+ +
+
+ +**source:** `Optional` — For 'identify' events: where the identity was captured (url, form, manual, iframe). + +
+
+ +
+
+ +**title:** `Optional` — For 'page' events: the document title. + +
+
+ +
+
+ +**url:** `Optional` — The URL where the event occurred. + +
+
+ +
+
+ +**user:** `Optional` — User identity and profile data. + +
+
+ +
+
+ +**value:** `Optional` — Monetary value associated with the event. + +
+
+
+
+ + +
+
+
+ +
client.events.pulse() -> SyncPagingIterable&lt;PulseEventsResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a `type`, the underlying event name, a USD amount, a coarse location under `user`, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.events().pulse( + PulseEventsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**event:** `Optional` — Filter to one or more types, comma separated — for example `purchase,card_spend`. These are the item's `type`, not its `event_name`: several types share the `ledger_line.created` event name. Omit for every type in the feed. Values outside the feed's own set are rejected. + +
+
+ +
+
+ +**first:** `Optional` — The number of events to return. + +
+
+ +
+
+ +**after:** `Optional` — A cursor for fetching events after a previous page. + +
+
+ +
+
+ +**before:** `Optional` — A cursor for fetching events before a later page. + +
+
+
+
+ + +
+
+
+ +
client.events.validatePixel(request) -> PixelValidation +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a `url`. Pass a `url` and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. `installed` is only true when the pixel was actually seen — in the account's events or in the page. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.events().validatePixel( + ValidatePixelEventsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Account to check. Defaults to the authenticated account. + +
+
+ +
+
+ +**url:** `Optional` — A page to read for the pixel, e.g. an ad destination. Omit it to check the account from its events alone. + +
+
+
+
+ + +
+
+
+ +## Experiences +
client.experiences.list() -> SyncPagingIterable&lt;ExperienceListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of experiences belonging to a company, with optional filtering by product and app. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experiences().list( + ListExperiencesRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .first(42) + .last(42) + .productId("prod_xxxxxxxxxxxxx") + .appId("app_xxxxxxxxxxxxxx") + .createdBefore(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .createdAfter(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to list experiences for. + +
+
+ +
+
+ +**productId:** `Optional` — Filter to only experiences attached to this product identifier. + +
+
+ +
+
+ +**appId:** `Optional` — Filter to only experiences powered by this app identifier. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return experiences created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return experiences created after this timestamp. + +
+
+
+
+ + +
+
+
+ +
client.experiences.create(request) -> Experience +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Required permissions: + - `experience:create` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experiences().create( + CreateExperiencesRequest + .builder() + .appId("app_xxxxxxxxxxxxxx") + .companyId("biz_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**appId:** `String` — The unique identifier of the app that powers this experience. + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to create this experience for. + +
+
+ +
+
+ +**isPublic:** `Optional` — Whether the experience is publicly accessible without a membership. + +
+
+ +
+
+ +**logo:** `Optional` — A logo image displayed alongside the experience name. + +
+
+ +
+
+ +**name:** `Optional` — The display name of the experience. Defaults to the app's name if not provided. + +
+
+ +
+
+ +**notificationsEnabled:** `Optional` — Whether Whop app notifications are enabled for this experience. Webhooks still fire. + +
+
+ +
+
+ +**sectionId:** `Optional` — The unique identifier of the section to place the experience in. + +
+
+
+
+ + +
+
+
+ +
client.experiences.retrieve(id) -> Experience +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing experience. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experiences().retrieve( + "exp_xxxxxxxxxxxxxx", + RetrieveExperiencesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the experience. + +
+
+
+
+ + +
+
+
+ +
client.experiences.delete(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Required permissions: + - `experience:delete` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experiences().delete( + "exp_xxxxxxxxxxxxxx", + DeleteExperiencesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the experience to delete. + +
+
+
+
+ + +
+
+
+ +
client.experiences.update(id, request) -> Experience +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Required permissions: + - `experience:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experiences().update( + "exp_xxxxxxxxxxxxxx", + UpdateExperiencesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the experience to update. + +
+
+ +
+
+ +**accessLevel:** `Optional` — The access level of the experience. + +
+
+ +
+
+ +**isPublic:** `Optional` — Whether the experience is publicly accessible without a membership. + +
+
+ +
+
+ +**logo:** `Optional` — A logo image displayed alongside the experience name. + +
+
+ +
+
+ +**name:** `Optional` — The display name of the experience. + +
+
+ +
+
+ +**notificationsEnabled:** `Optional` — Whether Whop app notifications are enabled for this experience. Webhooks still fire. + +
+
+ +
+
+ +**order:** `Optional` — The position of the experience within its section for display ordering. + +
+
+ +
+
+ +**sectionId:** `Optional` — The unique identifier of the section to move the experience into. + +
+
+
+
+ + +
+
+
+ +
client.experiences.attach(id, request) -> Experience +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Attach an experience to a product, making it accessible to the product's customers. + +Required permissions: + - `experience:attach` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experiences().attach( + "exp_xxxxxxxxxxxxxx", + AttachExperiencesRequest + .builder() + .productId("prod_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the experience to attach. + +
+
+ +
+
+ +**productId:** `String` — The unique identifier of the product to attach the experience to. + +
+
+
+
+ + +
+
+
+ +
client.experiences.detach(id, request) -> Experience +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Detach an experience from a product, removing customer access to it through that product. + +Required permissions: + - `experience:detach` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experiences().detach( + "exp_xxxxxxxxxxxxxx", + DetachExperiencesRequest + .builder() + .productId("prod_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the experience to detach. + +
+
+ +
+
+ +**productId:** `String` — The unique identifier of the product to detach the experience from. + +
+
+
+
+ + +
+
+
+ +
client.experiences.duplicate(id, request) -> Experience +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. +If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. +No content, e.g. posts, messages, lessons from within the original experience will be copied. + + +Required permissions: + - `experience:create` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.experiences().duplicate( + "exp_xxxxxxxxxxxxxx", + DuplicateExperiencesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the experience to duplicate. + +
+
+ +
+
+ +**name:** `Optional` — The display name for the duplicated experience. Defaults to the original experience's name. + +
+
+
+
+ + +
+
+
+ +## Exports +
client.exports.list() -> ListExportsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.exports().list( + ListExportsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The account to list exports for, prefixed `biz_`. Defaults to the credential's account. + +
+
+ +
+
+ +**resource:** `Optional` — Only return exports of this resource. + +
+
+ +
+
+ +**status:** `Optional` — Only return exports in this status. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return exports created at or after this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return exports created at or before this ISO 8601 timestamp. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort by. + +
+
+ +
+
+ +**direction:** `Optional` — The sort direction. + +
+
+
+
+ + +
+
+
+ +
client.exports.create(request) -> Export +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Starts an asynchronous CSV export of a resource for an account. Returns the export in `pending`; poll `GET /exports/{id}` until `download_url` is set. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.exports().create( + CreateExportsRequest + .builder() + .resource(CreateExportsRequestResource.AD_CAMPAIGNS) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The account to export from, prefixed `biz_`. Defaults to the credential's account. + +
+
+ +
+
+ +**columns:** `Optional>` — Column keys to include. Empty means all columns for the resource. + +
+
+ +
+
+ +**filters:** `Optional>` — Resource-specific filters. For native REST resources (`payouts`, `transfers`, `memberships`) these are the resource's own list query params; for dashboard tables they mirror the dashboard table filters. + +
+
+ +
+
+ +**resource:** `CreateExportsRequestResource` — The resource to export, e.g. `payouts`, `receipts`, or `members`. + +
+
+ +
+
+ +**timezone:** `Optional` — IANA timezone for date columns, e.g. `America/New_York`. Defaults to `UTC`. + +
+
+
+
+ + +
+
+
+ +
client.exports.retrieve(id) -> Export +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Fetches an export's status and, once complete, its download link. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.exports().retrieve( + "id", + RetrieveExportsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The export ID, prefixed `exprt_`. + +
+
+
+
+ + +
+
+
+ +## FeeMarkups +
client.feeMarkups.list() -> SyncPagingIterable&lt;FeeMarkupListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of fee markups configured for a company. If the company is a platform account, returns the platform default markups. + +Required permissions: + - `company:update_child_fees` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.feeMarkups().list( + ListFeeMarkupsRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .first(42) + .last(42) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to list fee markups for. Pass a platform account identifier to retrieve platform default markups. + +
+
+
+
+ + +
+
+
+ +
client.feeMarkups.create(request) -> FeeMarkup +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create or update a fee markup for a company. If a markup for the specified fee type already exists, it will be updated with the new values. + +Required permissions: + - `company:update_child_fees` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.feeMarkups().create( + CreateFeeMarkupsRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .feeType(FeeMarkupTypes.CRYPTO_WITHDRAWAL_MARKUP) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to create or update the fee markup for. + +
+
+ +
+
+ +**feeType:** `FeeMarkupTypes` — The type of fee this markup applies to, such as processing or platform fees. + +
+
+ +
+
+ +**fixedFeeUsd:** `Optional` — The fixed fee amount in USD to charge per transaction. Must be between 0 and 50. + +
+
+ +
+
+ +**metadata:** `Optional>` — Custom key-value metadata to attach to this fee markup. + +
+
+ +
+
+ +**notes:** `Optional` — Internal notes about this fee markup for record-keeping purposes. + +
+
+ +
+
+ +**percentageFee:** `Optional` — The percentage fee to charge per transaction. Must be between 0 and 25. + +
+
+
+
+ + +
+
+
+ +
client.feeMarkups.delete(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + +Required permissions: + - `company:update_child_fees` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.feeMarkups().delete( + "id", + DeleteFeeMarkupsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the fee markup to delete. + +
+
+
+
+ + +
+
+
+ +## Files +
client.files.create(request) -> CreateFilesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new file record and receive a presigned URL for uploading content to S3. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.files().create( + CreateFilesRequest + .builder() + .filename("filename") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**filename:** `String` — The name of the file including its extension (e.g., "photo.png" or "document.pdf"). + +
+
+ +
+
+ +**visibility:** `Optional` — Controls whether the file is publicly accessible via CDN or requires authentication. Defaults to private. + +
+
+
+
+ + +
+
+
+ +
client.files.retrieve(id) -> File +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing file. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.files().retrieve( + "file_xxxxxxxxxxxxx", + RetrieveFilesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the file to retrieve. + +
+
+
+
+ + +
+
+
+ +## FinancialActivity +
client.financialActivity.list() -> ListFinancialActivityResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns an account's or user's activity feed: every movement of money in or out. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.financialActivity().list( + ListFinancialActivityRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The owning account ID (a biz_ identifier). Provide this or user_id. + +
+
+ +
+
+ +**userId:** `Optional` — The owning user ID (a user_ identifier). Provide this or account_id. + +
+
+ +
+
+ +**includeOwnedAccounts:** `Optional` — When true, aggregates the authenticated user's personal ledger with the businesses they own (owner role with balance read) into one feed. Requires user_id to be the authenticated user; cannot be combined with account_id or the settlement-date filters. Each returned row includes the owning `account`. + +
+
+ +
+
+ +**includeResource:** `Optional` — Whether to include the `resource` field in the response or not. Consider passing `false` if you need a fast response without as many rich details. + +
+
+ +
+
+ +**lineTypes:** `Optional` — Optional ledger line categories to include. Some categories (for example `onchain_deposit`, which covers inbound crypto deposits such as MoonPay onramps) are only returned when explicitly requested here. + +
+
+ +
+
+ +**currency:** `Optional` — Optional currency code filter, for example `usd`. + +
+
+ +
+
+ +**postedAfter:** `Optional` — Only include rows posted after this ISO 8601 timestamp. + +
+
+ +
+
+ +**postedBefore:** `Optional` — Only include rows posted before this ISO 8601 timestamp. + +
+
+ +
+
+ +**availableAfter:** `Optional` — Only include rows whose funds became withdrawable on or after this `YYYY-MM-DD` settlement date (UTC), distinct from posted_at. Requires currency. + +
+
+ +
+
+ +**availableBefore:** `Optional` — Only include rows whose funds became withdrawable on or before this `YYYY-MM-DD` settlement date (UTC). Set equal to available_after for a single day. Requires currency. + +
+
+ +
+
+ +**limit:** `Optional` — Maximum number of rows to return. + +
+
+ +
+
+ +**cursor:** `Optional` — Cursor returned by the previous page. + +
+
+
+
+ + +
+
+
+ +## Ledgers +
client.ledgers.getFinancialReport() -> GetFinancialReportResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a financial report — balance activity, income statement, or balance summary — for an account over a date range. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.ledgers().getFinancialReport( + GetFinancialReportRequest + .builder() + .accountId("account_id") + .reportType(GetFinancialReportRequestReportType.BALANCE_SUMMARY) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — The owning account ID (a biz_ identifier), or `global` for a platform-wide report across all ledger accounts (requires internal admin access). + +
+
+ +
+
+ +**reportType:** `GetFinancialReportRequestReportType` — The type of financial report to generate. + +
+
+ +
+
+ +**currency:** `Optional` — Filter rows to this currency, for example `usd`. Defaults to `usd` unless `in_currency` is provided. + +
+
+ +
+
+ +**inCurrency:** `Optional` — Aggregate all activity into this display currency via FX conversion. + +
+
+ +
+
+ +**fromDate:** `Optional` — Start of the report window as an ISO 8601 timestamp (UTC). Required for platform-wide (global) reports. + +
+
+ +
+
+ +**toDate:** `Optional` — End of the report window as an ISO 8601 timestamp (UTC). Required for platform-wide (global) reports. + +
+
+ +
+
+ +**groupBy:** `Optional` — Grouping granularity for report rows. + +
+
+ +
+
+ +**timezone:** `Optional` — IANA timezone (for example `America/New_York`) used to bucket report periods and to interpret calendar-day boundaries for balance snapshots. Defaults to UTC. from_date/to_date remain exact instants regardless of this setting. + +
+
+ +
+
+ +**cumulative:** `Optional` — Platform-wide (global) reports only: when true, return cumulative balances as of to_date (all history, no lower bound) instead of activity within the period. + +
+
+ +
+
+ +**scopeAccountId:** `Optional` — Platform-wide (global) reports only: narrow the report to ledger lines on the ledger account owned by this account ID (a biz_ identifier). Ignored unless account_id is `global`. + +
+
+
+
+ + +
+
+
+ +## ForumPosts +
client.forumPosts.list() -> SyncPagingIterable&lt;ForumPostListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of forum posts within a specific experience, with optional filtering by parent post or pinned status. + +Required permissions: + - `forum:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.forumPosts().list( + ListForumPostsRequest + .builder() + .experienceId("exp_xxxxxxxxxxxxxx") + .first(42) + .last(42) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**experienceId:** `String` — The unique identifier of the experience to list forum posts for. + +
+
+ +
+
+ +**includeBountyAnchors:** `Optional` — Whether to include top-level bounty discussion anchors as rich forum items. + +
+
+ +
+
+ +**parentId:** `Optional` — The unique identifier of a parent post to list comments for. When set, returns replies to that post. + +
+
+ +
+
+ +**pinned:** `Optional` — Whether to filter for only pinned posts. Set to true to return only pinned posts. + +
+
+
+
+ + +
+
+
+ +
client.forumPosts.create(request) -> ForumPost +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new forum post or comment within an experience. Supports text content, attachments, polls, paywalling, and pinning. Pass experience_id 'public' with a company_id to post to a company's public forum. + +Required permissions: + - `forum:post:create` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.forumPosts().create( + CreateForumPostsRequest + .builder() + .experienceId("exp_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**attachments:** `Optional>` — A list of file attachments to include with the post, such as images or videos. + +
+
+ +
+
+ +**companyId:** `Optional` — The unique identifier of the company whose public forum to post in. Required when experience_id is 'public'. For example, 'biz_xxxxx'. + +
+
+ +
+
+ +**content:** `Optional` — The main body of the post in Markdown format. For example, 'Check out this **update**'. Hidden if the post is paywalled and the viewer has not purchased access. + +
+
+ +
+
+ +**experienceId:** `String` — The unique identifier of the experience to create this post in. For example, 'exp_xxxxx'. Pass 'public' along with company_id to automatically use the company's public forum. + +
+
+ +
+
+ +**isMention:** `Optional` — Whether to send this post as a mention notification to all users in the experience who have mentions enabled. + +
+
+ +
+
+ +**parentId:** `Optional` — The unique identifier of the parent post to comment on. Omit this field to create a top-level post. + +
+
+ +
+
+ +**paywallAmount:** `Optional` — The price to unlock this post in the specified paywall currency. For example, 5.00 for $5.00. When set, users must purchase access to view the post content. + +
+
+ +
+
+ +**paywallCurrency:** `Optional` — The currency for the paywall price on this post. When set along with paywall_amount, users must purchase access to view the post content. + +
+
+ +
+
+ +**pinned:** `Optional` — Whether this post should be pinned to the top of the forum. + +
+
+ +
+
+ +**poll:** `Optional` — A poll to attach to this post, allowing members to vote on options. + +
+
+ +
+
+ +**richContent:** `Optional` — The rich content of the post in Tiptap JSON format. When provided, takes priority over the markdown content field for rendering. + +
+
+ +
+
+ +**title:** `Optional` — The title of the post, displayed prominently at the top. Required for paywalled posts as it remains visible to non-purchasers. + +
+
+ +
+
+ +**visibility:** `Optional` — Controls who can see this forum post, such as members only or public. + +
+
+
+
+ + +
+
+
+ +
client.forumPosts.retrieve(id) -> ForumPost +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing forum post. + +Required permissions: + - `forum:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.forumPosts().retrieve( + "id", + RetrieveForumPostsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the forum post to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.forumPosts.update(id, request) -> ForumPost +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.forumPosts().update( + "id", + UpdateForumPostsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the forum post to update. + +
+
+ +
+
+ +**attachments:** `Optional>` — A replacement list of file attachments for this post, such as images or videos. + +
+
+ +
+
+ +**content:** `Optional` — The updated body of the post in Markdown format. For example, 'Check out this **update**'. Hidden if the post is paywalled and the viewer has not purchased access. + +
+
+ +
+
+ +**isPinned:** `Optional` — Whether this post should be pinned to the top of the forum. Only top-level posts can be pinned, not comments. + +
+
+ +
+
+ +**title:** `Optional` — The updated title of the post, displayed prominently at the top. Required for paywalled posts as it remains visible to non-purchasers. + +
+
+ +
+
+ +**visibility:** `Optional` — Controls who can see this forum post, such as members only or public. + +
+
+
+
+ + +
+
+
+ +## Forums +
client.forums.list() -> SyncPagingIterable&lt;ForumListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of forums within a specific company, with optional filtering by product. + +Required permissions: + - `forum:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.forums().list( + ListForumsRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .first(42) + .last(42) + .productId("prod_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to list forums for. + +
+
+ +
+
+ +**productId:** `Optional` — The unique identifier of a product to filter by. When set, only forums connected to this product are returned. + +
+
+
+
+ + +
+
+
+ +
client.forums.retrieve(id) -> Forum +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing forum. + +Required permissions: + - `forum:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.forums().retrieve( + "id", + RetrieveForumsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the forum or experience to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.forums.update(id, request) -> Forum +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + +Required permissions: + - `forum:moderate` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.forums().update( + "id", + UpdateForumsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the forum to update. Accepts either an experience ID (e.g. 'exp_xxxxx') or a forum ID. + +
+
+ +
+
+ +**bannedWords:** `Optional>` — A list of words that are automatically blocked from posts in this forum. For example, ['spam', 'scam']. + +
+
+ +
+
+ +**bannerImage:** `Optional` — The banner image displayed at the top of the forum page. Pass null to remove the existing banner. + +
+
+ +
+
+ +**emailNotificationPreference:** `Optional` — Controls how email notifications are sent to members when new posts are created in this forum. + +
+
+ +
+
+ +**whoCanComment:** `Optional` — Controls which roles are allowed to comment on posts in this forum. + +
+
+ +
+
+ +**whoCanPost:** `Optional` — Controls which roles are allowed to create new posts in this forum. + +
+
+
+
+ + +
+
+
+ +## IdentityProfiles +
client.identityProfiles.listIdentityProfile() -> SyncPagingIterable&lt;IdentityProfileListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + +Required permissions: + - `identity:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.identityProfiles().listIdentityProfile( + ListIdentityProfileRequest + .builder() + .first(42) + .last(42) + .companyId("biz_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `Optional` — The unique identifier of the company to filter to. When omitted, returns IPs across all ledgers the actor can read. + +
+
+ +
+
+ +**profileType:** `Optional` + +
+
+ +
+
+ +**status:** `Optional` + +
+
+
+
+ + +
+
+
+ +
client.identityProfiles.retrieveIdentityProfile(id) -> IdentityProfile +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing identity profile. + +Required permissions: + - `identity:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.identityProfiles().retrieveIdentityProfile( + "idpf_xxxxxxxxxxxxx", + RetrieveIdentityProfileRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the identity profile (idpf_xxx). + +
+
+
+
+ + +
+
+
+ +
client.identityProfiles.unlinkIdentityProfile(id) -> IdentityProfile +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Unlinks an IdentityProfile from a LedgerAccount (flips the matching link to is_current=false). +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.identityProfiles().unlinkIdentityProfile( + "idpf_xxxxxxxxxxxxx", + UnlinkIdentityProfileRequest + .builder() + .ledgerAccountId("ldgr_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the IdentityProfile to unlink. + +
+
+ +
+
+ +**ledgerAccountId:** `String` — The ID of the LedgerAccount to unlink the identity profile from. + +
+
+
+
+ + +
+
+
+ +
client.identityProfiles.listVerificationsIdentityProfile(id) -> SyncPagingIterable&lt;ListVerificationsIdentityProfileResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of verifications attached to an identity profile, ordered by most recent first. + +Required permissions: + - `identity:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.identityProfiles().listVerificationsIdentityProfile( + "idpf_xxxxxxxxxxxxx", + ListVerificationsIdentityProfileRequest + .builder() + .first(42) + .last(42) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the identity profile (idpf_xxx). + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+
+
+ + +
+
+
+ +## Invoices +
client.invoices.list() -> SyncPagingIterable&lt;InvoiceListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + +Required permissions: + - `invoice:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.invoices().list( + ListInvoicesRequest + .builder() + .first(42) + .last(42) + .companyId("biz_xxxxxxxxxxxxxx") + .createdBefore(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .createdAfter(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `Optional` — The unique identifier of the company to list invoices for. + +
+
+ +
+
+ +**direction:** `Optional` + +
+
+ +
+
+ +**productIds:** `Optional` — Filter invoices to only those associated with these specific product identifiers. + +
+
+ +
+
+ +**collectionMethods:** `Optional` — Filter invoices by their collection method. + +
+
+ +
+
+ +**statuses:** `Optional` — Filter invoices by their current status. + +
+
+ +
+
+ +**order:** `Optional` + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return invoices created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return invoices created after this timestamp. + +
+
+
+
+ + +
+
+
+ +
client.invoices.create(request) -> Invoice +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create an invoice for a customer. The invoice can be charged automatically using a stored payment method, or sent to the customer for manual payment. + +Required permissions: + - `invoice:create` + - `member:email:read` + - `member:basic:read` + - `payment:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.invoices().create( + CreateInvoicesRequest.of( + CreateInvoicesRequestProduct + .builder() + .collectionMethod(InvoiceCollectionMethods.SEND_INVOICE) + .companyId("biz_xxxxxxxxxxxxxx") + .plan( + CreateInvoicesRequestProductPlan + .builder() + .build() + ) + .product( + CreateInvoicesRequestProductProduct + .builder() + .title("title") + .build() + ) + .build() + ) +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `CreateInvoicesRequest` — Parameters for CreateInvoice + +
+
+
+
+ + +
+
+
+ +
client.invoices.retrieve(id) -> Invoice +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing invoice. + +Required permissions: + - `invoice:basic:read` + - `member:email:read` + - `member:basic:read` + - `payment:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.invoices().retrieve( + "inv_xxxxxxxxxxxxxx", + RetrieveInvoicesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the invoice, or a secure token. + +
+
+
+
+ + +
+
+
+ +
client.invoices.delete(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a draft invoice. + +Required permissions: + - `invoice:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.invoices().delete( + "inv_xxxxxxxxxxxxxx", + DeleteInvoicesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the draft invoice to delete. + +
+
+
+
+ + +
+
+
+ +
client.invoices.update(id, request) -> Invoice +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a draft invoice's details. + +Required permissions: + - `invoice:update` + - `member:email:read` + - `member:basic:read` + - `payment:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.invoices().update( + "inv_xxxxxxxxxxxxxx", + UpdateInvoicesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the invoice to update. + +
+
+ +
+
+ +**automaticallyFinalizesAt:** `Optional` — The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email at the specified time. + +
+
+ +
+
+ +**billingAddress:** `Optional` — Inline billing address to create or update a mailing address for this invoice. + +
+
+ +
+
+ +**chargeBuyerFee:** `Optional` — Whether to charge the customer a buyer fee on this invoice. + +
+
+ +
+
+ +**collectionMethod:** `Optional` — How the invoice should be collected. + +
+
+ +
+
+ +**customerName:** `Optional` — The name of the customer. + +
+
+ +
+
+ +**dueDate:** `Optional` — The date by which the invoice must be paid. + +
+
+ +
+
+ +**emailAddress:** `Optional` — The email address of the customer. + +
+
+ +
+
+ +**lineItems:** `Optional>` — Line items that break down the invoice total. + +
+
+ +
+
+ +**mailingAddressId:** `Optional` — The unique identifier of an existing mailing address to attach. + +
+
+ +
+
+ +**memberId:** `Optional` — The unique identifier of a member to assign as the customer. + +
+
+ +
+
+ +**paymentMethodId:** `Optional` — The unique identifier of the payment method to charge. + +
+
+ +
+
+ +**plan:** `Optional` — Updated plan attributes. + +
+
+ +
+
+ +**productId:** `Optional` — The unique identifier of an existing product to attach to this invoice. Only allowed while the invoice is still a draft. + +
+
+ +
+
+ +**subscriptionBillingAnchorAt:** `Optional` — The date that defines when the subscription billing cycle should start. + +
+
+
+
+ + +
+
+
+ +
client.invoices.markPaid(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Mark an open invoice as paid when payment was collected outside of Whop. + +Required permissions: + - `invoice:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.invoices().markPaid( + "inv_xxxxxxxxxxxxxx", + MarkPaidInvoicesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the invoice to mark as paid. + +
+
+
+
+ + +
+
+
+ +
client.invoices.markUncollectible(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Mark an open invoice as uncollectible when payment is not expected. + +Required permissions: + - `invoice:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.invoices().markUncollectible( + "inv_xxxxxxxxxxxxxx", + MarkUncollectibleInvoicesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the invoice to mark as uncollectible. + +
+
+
+
+ + +
+
+
+ +
client.invoices.resend(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Resend the notification email for an existing invoice to the customer. + +Required permissions: + - `invoice:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.invoices().resend( + "inv_xxxxxxxxxxxxxx", + ResendInvoicesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the invoice to resend. + +
+
+
+
+ + +
+
+
+ +
client.invoices.void_(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + +Required permissions: + - `invoice:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.invoices().void_( + "inv_xxxxxxxxxxxxxx", + VoidInvoicesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the invoice to void. + +
+
+
+
+ + +
+
+
+ +## Leads +
client.leads.list() -> SyncPagingIterable&lt;LeadListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of leads for a company, with optional filtering by product and creation date. + +Required permissions: + - `lead:basic:read` + - `member:email:read` + - `access_pass:basic:read` + - `member:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.leads().list( + ListLeadsRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .first(42) + .last(42) + .createdAfter(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .createdBefore(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to list leads for. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return leads created after this timestamp. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return leads created before this timestamp. + +
+
+ +
+
+ +**productIds:** `Optional` — Filter leads to only those associated with these specific product identifiers. + +
+
+
+
+ + +
+
+
+ +
client.leads.create(request) -> Lead +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Record a new lead for a company, capturing a potential customer's interest in a specific product. + +Required permissions: + - `lead:manage` + - `member:email:read` + - `access_pass:basic:read` + - `member:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.leads().create( + CreateLeadsRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to create the lead for, starting with 'biz_'. + +
+
+ +
+
+ +**metadata:** `Optional>` — A JSON object of custom metadata to attach to the lead for tracking purposes. + +
+
+ +
+
+ +**productId:** `Optional` — The unique identifier of the product the lead is interested in, starting with 'prod_'. + +
+
+ +
+
+ +**referrer:** `Optional` — The referral URL that brought the lead to the company, such as 'https://example.com/landing'. + +
+
+ +
+
+ +**userId:** `Optional` — The unique identifier of the user to record as the lead. If authenticated as a user, that user is used automatically. + +
+
+
+
+ + +
+
+
+ +
client.leads.retrieve(id) -> Lead +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing lead. + +Required permissions: + - `lead:basic:read` + - `member:email:read` + - `access_pass:basic:read` + - `member:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.leads().retrieve( + "lead_xxxxxxxxxxxxx", + RetrieveLeadsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the lead to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.leads.update(id, request) -> Lead +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update the metadata or referrer information on an existing lead record. + +Required permissions: + - `lead:manage` + - `member:email:read` + - `access_pass:basic:read` + - `member:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.leads().update( + "lead_xxxxxxxxxxxxx", + UpdateLeadsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the lead to update, starting with 'lead_'. + +
+
+ +
+
+ +**metadata:** `Optional>` — A JSON object of custom metadata to set on the lead, replacing any existing metadata. + +
+
+ +
+
+ +**referrer:** `Optional` — The updated referral URL for the lead, such as 'https://example.com/landing'. + +
+
+
+
+ + +
+
+
+ +## LedgerAccounts +
client.ledgerAccounts.retrieve(id) -> LedgerAccount +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing ledger account. + +Required permissions: + - `company:balance:read` + - `payout:account:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.ledgerAccounts().retrieve( + "ldgr_xxxxxxxxxxxxx", + RetrieveLedgerAccountsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The identifier to look up the ledger account. Accepts a user ID ('user_xxx'), company ID ('biz_xxx'), or ledger account ID ('ldgr_xxx'). + +
+
+
+
+ + +
+
+
+ +## Media +
client.media.generate(request) -> MediaAsset +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Starts an AI media generation job billed from the account's balance. Generation is asynchronous — poll `GET /media/{id}` until the asset is `ready`, then use `file.id` anywhere attachments are accepted. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.media().generate( + GenerateMediaRequest + .builder() + .prompt("A 9:16 product showcase of a cordless power scrubber") + .type(GenerateMediaRequestType.VIDEO) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Account ID, prefixed `biz_`. Defaults to the account the API key belongs to. + +
+
+ +
+
+ +**durationSeconds:** `Optional` — Video length in seconds. Video only; defaults to 5. + +
+
+ +
+
+ +**prompt:** `String` — What to generate. Up to 2,000 characters. + +
+
+ +
+
+ +**referenceMedia:** `Optional>` — Optional reference image file IDs (`file_` prefixed), up to 4. For video, a single reference seeds the opening frame; multiple references guide subject and style instead. + +
+
+ +
+
+ +**resolution:** `Optional` — Video resolution. Video only; defaults to `1080p`. `1080p` is not supported by Seedance 2.0 Fast or Mini; `4k` is only supported by Seedance 2.0. + +
+
+ +
+
+ +**type:** `GenerateMediaRequestType` — The kind of media to generate. + +
+
+
+
+ + +
+
+
+ +
client.media.retrieve(id) -> MediaAsset +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a media asset by ID. Poll this while the asset is `processing`. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.media().retrieve( + "id", + RetrieveMediaRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Media asset ID, prefixed `media_`. + +
+
+
+
+ + +
+
+
+ +## Members +
client.members.list() -> SyncPagingIterable&lt;Member&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.members().list( + ListMembersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The account to list members for (`biz_` tag). Defaults to the account the credential acts as. + +
+
+ +
+
+ +**accessLevel:** `Optional` — Filter by what the member can reach on the account. + +
+
+ +
+
+ +**status:** `Optional` — Filter by whether the member is still part of the account. + +
+
+ +
+
+ +**query:** `Optional` — Search members by name or username. An exact email address also matches when the credential holds the member:email:read scope. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only members who joined after this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only members who joined before this ISO 8601 timestamp. + +
+
+ +
+
+ +**order:** `Optional` — Sort field. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+ +
+
+ +**first:** `Optional` — Number of members to return from the start of the window. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to paginate forwards from. + +
+
+ +
+
+ +**last:** `Optional` — Number of members to return from the end of the window. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to paginate backwards from. + +
+
+
+
+ + +
+
+
+ +
client.members.retrieve(id) -> Member +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a member by ID. Accessible to the account and to the member's own user. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.members().retrieve( + "id", + RetrieveMembersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Member ID (`mber_` tag). + +
+
+
+
+ + +
+
+
+ +## Memberships +
client.memberships.list() -> SyncPagingIterable&lt;Membership&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. `account_id` and `user_id` only narrow that list — values outside the caller's reach return fewer results, not an error. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.memberships().list( + ListMembershipsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Narrow to one account (`biz_` tag). With read access to the account this lists all of its memberships; without, only the caller's own memberships in it. + +
+
+ +
+
+ +**userId:** `Optional` — Narrow to one user's memberships (`user_` tag, or `me` for the caller). A user outside the caller's visible set returns an empty list. + +
+
+ +
+
+ +**status:** `Optional` — Filter by billing state. `canceling` matches active memberships set to cancel at period end; `paused` matches memberships with payment collection paused. + +
+
+ +
+
+ +**productId:** `Optional` — Filter to memberships of this product (`prod_` tag). Repeat as product_ids[] for several. + +
+
+ +
+
+ +**planId:** `Optional` — Filter to memberships of this plan (`plan_` tag). Repeat as plan_ids[] for several. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only memberships created after this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only memberships created before this ISO 8601 timestamp. + +
+
+ +
+
+ +**order:** `Optional` — Sort field. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+ +
+
+ +**first:** `Optional` — Number of memberships to return from the start of the window. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to paginate forwards from. + +
+
+ +
+
+ +**last:** `Optional` — Number of memberships to return from the end of the window. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to paginate backwards from. + +
+
+
+
+ + +
+
+
+ +
client.memberships.invite(request) -> InviteMembershipsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Sends an email inviting one recipient to join the account through a free plan. Identify the recipient by exactly one of `user_id` or `email`. The invitation is bound to that recipient; after signing in, accepting it immediately grants the membership without checkout. This Experimental endpoint is available only to accounts enabled for membership invitations. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.memberships().invite( + InviteMembershipsRequestBody.of( + InviteMembershipsRequestBodyUserId + .builder() + .planId("plan_xxxxxxxxxxxxxx") + .userId("user_xxxxxxxxxxxxxx") + .build() + ) +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `InviteMembershipsRequestBody` + +
+
+
+
+ + +
+
+
+ +
client.memberships.retrieve(id) -> Membership +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.memberships().retrieve( + "id", + RetrieveMembershipsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Membership ID (`mem_` tag), or a software license key. + +
+
+
+
+ + +
+
+
+ +
client.memberships.update(id, request) -> Membership +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a membership: merge metadata key-value pairs, or toggle `cancel_at_period_end` — `true` schedules the cancellation for the end of the current billing period, `false` reverses a pending one. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.memberships().update( + "id", + UpdateMembershipsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Membership ID (`mem_` tag), or a software license key. + +
+
+ +
+
+ +**cancelAtPeriodEnd:** `Optional` — `true` cancels at the end of the current billing period (the customer keeps access until then); `false` reverses a pending cancellation. + +
+
+ +
+
+ +**metadata:** `Optional>` — Key-value pairs to merge into the membership's metadata. Pass an empty object to clear it. + +
+
+
+
+ + +
+
+
+ +
client.memberships.addFreeDaysMembership(id, request) -> Membership +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add free days to extend a membership's current billing period, expiration date, or Stripe trial. + +Required permissions: + - `member:manage` + - `member:email:read` + - `member:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.memberships().addFreeDaysMembership( + "mem_xxxxxxxxxxxxxx", + AddFreeDaysMembershipRequest + .builder() + .freeDays(42) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the membership. + +
+
+ +
+
+ +**freeDays:** `Integer` — The number of free days to add (1-1095). Extends the billing period, expiration date, or Stripe trial depending on plan type. + +
+
+
+
+ + +
+
+
+ +
client.memberships.cancel(id, request) -> Membership +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Cancels a membership. Pass `cancel_at_period_end: true` to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass `false`) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (`splitit`, `sezzle`) or non-trial split-pay memberships. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.memberships().cancel( + "id", + CancelMembershipsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Membership ID (`mem_` tag). + +
+
+ +
+
+ +**cancelAtPeriodEnd:** `Optional` — `true` stops auto-renewal and keeps access until the current billing period ends. Omit or `false` revokes access immediately. + +
+
+ +
+
+ +**reason:** `Optional` — Free-form note recording why the membership was canceled. + +
+
+
+
+ + +
+
+
+ +
client.memberships.extend(id, request) -> Membership +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Adds free days to a membership, extending its current billing period, expiration date, or trial depending on the plan type. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.memberships().extend( + "id", + ExtendMembershipsRequest + .builder() + .days(7) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Membership ID (`mem_` tag). + +
+
+ +
+
+ +**days:** `Integer` — Number of free days to add (1-1095). + +
+
+
+
+ + +
+
+
+ +
client.memberships.pause(id, request) -> Membership +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.memberships().pause( + "id", + PauseMembershipsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Membership ID (`mem_` tag). + +
+
+ +
+
+ +**until:** `Optional` — ISO 8601 time to automatically resume payment collection. Must be in the future; only supported for memberships billed by Whop. + +
+
+
+
+ + +
+
+
+ +
client.memberships.resume(id) -> Membership +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.memberships().resume( + "id", + ResumeMembershipsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Membership ID (`mem_` tag). + +
+
+
+
+ + +
+
+
+ +
client.memberships.resyncAccessMembership(id) -> Membership +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + +Required permissions: + - `membership:resync_access` + - `member:email:read` + - `member:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.memberships().resyncAccessMembership( + "mem_xxxxxxxxxxxxxx", + ResyncAccessMembershipRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the membership to resync access for. + +
+
+
+
+ + +
+
+
+ +
client.memberships.transfer(id) -> TransferMembershipsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with `membership:transfer` when the product allows transfers and the membership is `trialing`, `active`, or `completed`. An account credential with `membership:update` bypasses both restrictions. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.memberships().transfer( + "id", + TransferMembershipsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Membership ID (`mem_` tag). + +
+
+
+
+ + +
+
+
+ +
client.memberships.uncancelMembership(id) -> Membership +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + +Required permissions: + - `member:manage` + - `member:email:read` + - `member:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.memberships().uncancelMembership( + "mem_xxxxxxxxxxxxxx", + UncancelMembershipRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the membership to uncancel. + +
+
+
+
+ + +
+
+
+ +## Messages +
client.messages.list() -> SyncPagingIterable&lt;MessageListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of messages within a specific experience chat, DM, or group chat channel, sorted by creation time. + +Required permissions (one of): + - `chat:read` + - `dms:read` + - `support_chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.messages().list( + ListMessagesRequest + .builder() + .channelId("channel_id") + .first(42) + .last(42) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**channelId:** `String` — The unique identifier of the channel or experience to list messages for. + +
+
+ +
+
+ +**direction:** `Optional` + +
+
+
+
+ + +
+
+
+ +
client.messages.create(request) -> Message +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Send a new message in an experience chat, DM, or group chat channel. Supports text content, attachments, polls, and replies. + +Required permissions (one of): + - `chat:message:create` + - `dms:message:manage` + - `livestream:chat:write` + - `support_chat:message:create` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.messages().create( + CreateMessagesRequest + .builder() + .channelId("channel_id") + .content("content") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**attachments:** `Optional>` — A list of file attachments to include with the message, such as images or videos. + +
+
+ +
+
+ +**autoDetectLinks:** `Optional` — Automatically detect URLs in the message and generate link previews. + +
+
+ +
+
+ +**channelId:** `String` — The unique identifier of the channel or experience to send the message in. For example, 'exp_xxxxx' or 'feed_xxxxx'. + +
+
+ +
+
+ +**content:** `String` — The body of the message in Markdown format. For example, 'Hello **world**'. + +
+
+ +
+
+ +**poll:** `Optional` — A poll to attach to this message, allowing recipients to vote on options. + +
+
+ +
+
+ +**replyingToMessageId:** `Optional` — The unique identifier of the message this is replying to, creating a threaded reply. + +
+
+
+
+ + +
+
+
+ +
client.messages.retrieve(id) -> Message +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing message. + +Required permissions (one of): + - `chat:read` + - `dms:read` + - `livestream:chat:read` + - `support_chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.messages().retrieve( + "id", + RetrieveMessagesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the message to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.messages.delete(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + +Required permissions (one of): + - `chat:message:create` and `chat:read` + - `dms:message:manage` and `dms:read` + - `livestream:chat:write` and `livestream:chat:read` + - `support_chat:message:create` and `support_chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.messages().delete( + "id", + DeleteMessagesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the message to delete. + +
+
+
+
+ + +
+
+
+ +
client.messages.update(id, request) -> Message +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + +Required permissions (one of): + - `chat:message:create` + - `dms:message:manage` + - `livestream:chat:write` + - `support_chat:message:create` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.messages().update( + "id", + UpdateMessagesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the message to update. + +
+
+ +
+
+ +**attachments:** `Optional>` — A replacement list of file attachments for this message, such as images or videos. + +
+
+ +
+
+ +**content:** `Optional` — The updated body of the message in Markdown format. For example, 'Hello **world**'. + +
+
+ +
+
+ +**isPinned:** `Optional` — Whether this message should be pinned to the top of the channel. + +
+
+
+
+ + +
+
+
+ +## Notifications +
client.notifications.list() -> SyncPagingIterable&lt;Notification&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.notifications().list( + ListNotificationsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**unread:** `Optional` — Only return notifications created since the user last viewed their source. + +
+
+ +
+
+ +**experienceId:** `Optional` — Only return notifications from this experience (`exp_` tag). + +
+
+ +
+
+ +**accountId:** `Optional` — Only return team notifications for this account (`biz_` tag). + +
+
+ +
+
+ +**mentions:** `Optional` — Only return notifications that mention the user directly. + +
+
+ +
+
+ +**first:** `Optional` — The number of notifications to return (default 20, max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor (a notification `id` from a previous page); returns notifications older than it. + +
+
+
+
+ + +
+
+
+ +
client.notifications.create(request) -> CreateNotificationsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Queues a notification to every user of an experience or to an account's team, processed asynchronously. Every send is attributed to an app: use an app API key, or a credential acting on behalf of an app. Narrow the audience with `user_ids` to send a mention. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.notifications().create( + CreateNotificationsRequest + .builder() + .content("Drop off at 4180 Burnet Rd. Plan on two days for the full coating.") + .title("Your ceramic coating is booked") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Account whose team members receive the notification (`biz_` tag). Exactly one of `experience_id` or `account_id` is required. + +
+
+ +
+
+ +**content:** `String` — Main body text of the notification. + +
+
+ +
+
+ +**experienceId:** `Optional` — Experience whose users receive the notification (`exp_` tag). Exactly one of `experience_id` or `account_id` is required. + +
+
+ +
+
+ +**iconUserId:** `Optional` — User whose profile picture is used as the notification icon. Defaults to the experience or account avatar. + +
+
+ +
+
+ +**restPath:** `Optional` — Path segment appended to the generated deep link that opens your app, for example `/settings/billing`. + +
+
+ +
+
+ +**subtitle:** `Optional` — Optional secondary line displayed below the title. + +
+
+ +
+
+ +**title:** `String` — Headline text of the notification. + +
+
+ +
+
+ +**userIds:** `Optional>` — Optional `user_` tags narrowing the audience. When provided, only these users are notified (as a mention), provided they are in the targeted experience or account. + +
+
+
+
+ + +
+
+
+ +
client.notifications.badges() -> BadgesNotificationsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.notifications().badges( + BadgesNotificationsRequest + .builder() + .experienceIds( + Arrays.asList("exp_xxxxxxxxxxxxxx") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**experienceIds:** `Optional` — Only return badges for these experiences (`exp_` tags). + +
+
+ +
+
+ +**lastFetchedAt:** `Optional` — The client's last fetched-at ISO 8601 timestamp, used to partially refresh badges after a websocket message. + +
+
+
+
+ + +
+
+
+ +
client.notifications.markRead(request) -> MarkReadNotificationsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Marks the authenticated user's notifications as read: one experience's (`experience_id`) or everything (`all: true`) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.notifications().markRead( + MarkReadNotificationsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**all:** `Optional` — Pass `true` to mark every notification read. Exactly one of `experience_id` or `all` is required. + +
+
+ +
+
+ +**experienceId:** `Optional` — Experience to mark read (`exp_` tag). Exactly one of `experience_id` or `all` is required. + +
+
+
+
+ + +
+
+
+ +
client.notifications.retrieve(id) -> Notification +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a single notification by id — either an `id` returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.notifications().retrieve( + "id", + RetrieveNotificationsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — A notification `id` from List Notifications, or the id delivered with a push/websocket event. + +
+
+
+
+ + +
+
+
+ +## Partners +
client.partners.create() -> CreatePartnersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Enrolls the calling user in the Whop partner program, making their partner businesses eligible for earnings. Idempotent — enrolling again keeps the original enrollment time. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.partners().create(); +``` +
+
+
+
+ + +
+
+
+ +
client.partners.leaderboard() -> LeaderboardPartnersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.partners().leaderboard( + LeaderboardPartnersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**period:** `Optional` — Time window for the rankings. `day`, `month`, and `year` count earnings since the start of the current calendar day, month, or year; `last_30_days` counts earnings over the trailing 30 days; `all_time` ranks lifetime earnings. + +
+
+
+
+ + +
+
+
+ +
client.partners.referredUsers() -> SyncPagingIterable&lt;ReferredUsersPartnersResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.partners().referredUsers( + ReferredUsersPartnersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**hasBusinesses:** `Optional` — When true, only referred users who brought at least one business onto Whop. + +
+
+ +
+
+ +**hasEarningBusinesses:** `Optional` — When true, only referred users with at least one business that has generated earnings. + +
+
+ +
+
+ +**first:** `Optional` — Number of referred users to return from the start of the window. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to fetch the page after (from page_info.end_cursor). + +
+
+ +
+
+ +**last:** `Optional` — Number of referred users to return from the end of the window. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to fetch the page before (from page_info.start_cursor). + +
+
+
+
+ + +
+
+
+ +## Payment Method Domains +
client.paymentMethodDomains.list() -> SyncPagingIterable&lt;PaymentMethodDomain&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists payment method domains. Without `account_id`, returns the caller's own domains and those of every connected account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.paymentMethodDomains().list( + ListPaymentMethodDomainsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Only domains registered for this account (`biz_` tag). Defaults to the caller's account plus its connected accounts. + +
+
+ +
+
+ +**hostname:** `Optional` — Only the domain with this exact hostname. + +
+
+ +
+
+ +**status:** `Optional` — Only domains with this verification status. + +
+
+ +
+
+ +**provider:** `Optional` — Only domains registered with this wallet provider. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only domains created before this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only domains created after this ISO 8601 timestamp. + +
+
+ +
+
+ +**order:** `Optional` — Sort field. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+ +
+
+ +**first:** `Optional` — Number of domains to return from the start of the window. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to paginate forwards from. + +
+
+ +
+
+ +**last:** `Optional` — Number of domains to return from the end of the window. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to paginate backwards from. + +
+
+
+
+ + +
+
+
+ +
client.paymentMethodDomains.create(request) -> PaymentMethodDomain +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Registers a hostname with the wallet provider and attempts verification inline. Returns `verified` when the provider fetched the domain-association file (for Apple Pay, `/.well-known/apple-developer-merchantid-domain-association`), or `pending` when it could not — host the file, then retry with the verify endpoint. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.paymentMethodDomains().create( + CreatePaymentMethodDomainsRequest + .builder() + .hostname("pending.shinetime.example") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Account to register the domain for (`biz_` tag). Defaults to the caller's account. + +
+
+ +
+
+ +**hostname:** `String` — Hostname to register (e.g. `checkout.shinetime.example`). + +
+
+
+
+ + +
+
+
+ +
client.paymentMethodDomains.retrieve(id) -> PaymentMethodDomain +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a payment method domain to check its verification status. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.paymentMethodDomains().retrieve( + "id", + RetrievePaymentMethodDomainsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the payment method domain, prefixed `pmd_`. + +
+
+
+
+ + +
+
+
+ +
client.paymentMethodDomains.delete(id) -> DeletePaymentMethodDomainsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Unregisters a payment method domain so its wallet payment methods stop rendering there. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.paymentMethodDomains().delete( + "id", + DeletePaymentMethodDomainsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the payment method domain, prefixed `pmd_`. + +
+
+
+
+ + +
+
+
+ +
client.paymentMethodDomains.verify(id) -> PaymentMethodDomain +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a `bad_request` explaining what to fix; verifying an already `verified` domain is a no-op. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.paymentMethodDomains().verify( + "id", + VerifyPaymentMethodDomainsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the payment method domain, prefixed `pmd_`. + +
+
+
+
+ + +
+
+
+ +## PaymentMethods +
client.paymentMethods.list() -> SyncPagingIterable&lt;PaymentMethodListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + +Required permissions: + - `member:payment_methods:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.paymentMethods().list( + ListPaymentMethodsRequest + .builder() + .first(42) + .last(42) + .memberId("mber_xxxxxxxxxxxxx") + .companyId("biz_xxxxxxxxxxxxxx") + .createdBefore(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .createdAfter(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**memberId:** `Optional` — The unique identifier of the member to list payment methods for. Omit this and company_id to list your own saved payment methods. + +
+
+ +
+
+ +**companyId:** `Optional` — The unique identifier of the company. Provide either this or member_id, not both. Omit both to address your own saved payment methods. + +
+
+ +
+
+ +**direction:** `Optional` + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return payment methods created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return payment methods created after this timestamp. + +
+
+ +
+
+ +**futureUsage:** `Optional` + +
+
+ +
+
+ +**paymentMethodTypes:** `Optional` — Only return payment methods of these types. Pass the eligible `type` values from the payment method types catalogue so the list holds nothing the purchase cannot take. An empty list returns no payment methods. + +
+
+ +
+
+ +**cardBrands:** `Optional` — Only return cards on these networks, such as the networks the seller accepts. Payment methods that are not cards are unaffected. + +
+
+ +
+
+ +**cardFundingTypes:** `Optional` — Only return cards funded this way. A card whose funding could not be determined is excluded, and payment methods that are not cards are unaffected. + +
+
+ +
+
+ +**hasPayerDocument:** `Optional` — Filter cards by whether they carry the payer identity document their payment provider requires. Payment methods that are not cards are unaffected. + +
+
+ +
+
+ +**expired:** `Optional` — Filter by expiry. Only a card can expire, so `false` keeps every payment method that is not past its expiration month and `true` returns expired cards alone. + +
+
+ +
+
+ +**broken:** `Optional` — Filter by whether the stored credential has permanently stopped charging, such as a vault entry its provider closed. + +
+
+
+
+ + +
+
+
+ +
client.paymentMethods.retrieve(id) -> PaymentMethod +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + +Required permissions: + - `member:payment_methods:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.paymentMethods().retrieve( + "payt_xxxxxxxxxxxxx", + RetrievePaymentMethodsRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .memberId("mber_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the payment method. + +
+
+ +
+
+ +**companyId:** `Optional` — The unique identifier of the company. Provide either this or member_id, not both. Omit both to address your own saved payment methods. + +
+
+ +
+
+ +**memberId:** `Optional` — The unique identifier of the member. Provide either this or company_id, not both. Omit both to address your own saved payment methods. + +
+
+
+
+ + +
+
+
+ +
client.paymentMethods.deletePaymentMethod(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + +Required permissions: + - `member:payment_methods:manage` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.paymentMethods().deletePaymentMethod( + "payt_xxxxxxxxxxxxx", + DeletePaymentMethodRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .memberId("mber_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the payment method to delete. + +
+
+ +
+
+ +**companyId:** `Optional` — The unique identifier of the company. Provide either this or member_id, not both. Omit both to address your own saved payment methods. + +
+
+ +
+
+ +**memberId:** `Optional` — The unique identifier of the member. Provide either this or company_id, not both. Omit both to address your own saved payment methods. + +
+
+
+
+ + +
+
+
+ +## Payments +
client.payments.list() -> SyncPagingIterable&lt;PaymentListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + +Required permissions: + - `payment:basic:read` + - `plan:basic:read` + - `access_pass:basic:read` + - `member:email:read` + - `member:basic:read` + - `member:phone:read` + - `promo_code:basic:read` + - `shipment:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payments().list( + ListPaymentsRequest + .builder() + .first(42) + .last(42) + .companyId("biz_xxxxxxxxxxxxxx") + .createdBefore(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .createdAfter(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .updatedBefore(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .updatedAfter(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `Optional` — The unique identifier of the company to list payments for. + +
+
+ +
+
+ +**direction:** `Optional` + +
+
+ +
+
+ +**order:** `Optional` + +
+
+ +
+
+ +**productIds:** `Optional` — Filter payments to only those associated with these specific product identifiers. + +
+
+ +
+
+ +**billingReasons:** `Optional` — Filter payments by their billing reason. + +
+
+ +
+
+ +**currencies:** `Optional` — Filter payments by their currency code. + +
+
+ +
+
+ +**planIds:** `Optional` — Filter payments to only those associated with these specific plan identifiers. + +
+
+ +
+
+ +**statuses:** `Optional` — Filter payments by their current status. + +
+
+ +
+
+ +**substatuses:** `Optional` — Filter payments by their current substatus for more granular filtering. + +
+
+ +
+
+ +**includeFree:** `Optional` — Whether to include payments with a zero amount. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return payments created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return payments created after this timestamp. + +
+
+ +
+
+ +**updatedBefore:** `Optional` — Only return payments last updated before this timestamp. + +
+
+ +
+
+ +**updatedAfter:** `Optional` — Only return payments last updated after this timestamp. + +
+
+ +
+
+ +**query:** `Optional` — Search payments by user ID, membership ID, user email, name, or username. Email filtering requires the member:email:read permission. + +
+
+ +
+
+ +**checkoutConfigurationIds:** `Optional` — Only return payments from these checkout configurations. + +
+
+
+
+ + +
+
+
+ +
client.payments.create(request) -> CreatePaymentsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Charge an existing member off-session using one of their stored payment methods. You can provide an existing plan, or create a new one in-line. This endpoint will respond with a payment object immediately, but the payment is processed asynchronously in the background. Use webhooks to be notified when the payment succeeds or fails. + +Required permissions: + - `payment:charge` + - `plan:create` + - `access_pass:create` + - `access_pass:update` + - `plan:basic:read` + - `access_pass:basic:read` + - `member:email:read` + - `member:basic:read` + - `member:phone:read` + - `promo_code:basic:read` + - `shipment:basic:read` + - `payment:dispute:read` + - `payment:resolution_center_case:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payments().create( + CreatePaymentsRequest.of( + CreatePaymentsRequestZero + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .confirmationToken("confirmation_token") + .plan( + CreatePaymentsRequestZeroPlan + .builder() + .currency(Currencies.USD) + .build() + ) + .build() + ) +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `CreatePaymentsRequest` — Parameters for CreatePayment + +
+
+
+
+ + +
+
+
+ +
client.payments.retrieve(id) -> RetrievePaymentsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing payment. + +Required permissions: + - `payment:basic:read` + - `plan:basic:read` + - `access_pass:basic:read` + - `member:email:read` + - `member:basic:read` + - `member:phone:read` + - `promo_code:basic:read` + - `shipment:basic:read` + - `payment:dispute:read` + - `payment:resolution_center_case:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payments().retrieve( + "pay_xxxxxxxxxxxxxx", + RetrievePaymentsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the payment. + +
+
+
+
+ + +
+
+
+ +
client.payments.listFees(id) -> SyncPagingIterable&lt;ListFeesPaymentsResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the list of fees associated with a specific payment, including platform fees and processing fees. + +Required permissions: + - `payment:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payments().listFees( + "pay_xxxxxxxxxxxxxx", + ListFeesPaymentsRequest + .builder() + .first(42) + .last(42) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the payment to list fees for. + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+
+
+ + +
+
+
+ +
client.payments.refund(id, request) -> Payment +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + +Required permissions: + - `payment:manage` + - `plan:basic:read` + - `access_pass:basic:read` + - `member:email:read` + - `member:basic:read` + - `member:phone:read` + - `promo_code:basic:read` + - `shipment:basic:read` + - `payment:dispute:read` + - `payment:resolution_center_case:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payments().refund( + "pay_xxxxxxxxxxxxxx", + RefundPaymentsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the payment to refund. + +
+
+ +
+
+ +**partialAmount:** `Optional` — The amount to refund. For multi-currency payments, this is in the charge currency (what the buyer paid). For single-currency, this is in the payment currency. If omitted, the full payment amount is refunded. + +
+
+
+
+ + +
+
+
+ +
client.payments.retry(id) -> Payment +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + +Required permissions: + - `payment:manage` + - `plan:basic:read` + - `access_pass:basic:read` + - `member:email:read` + - `member:basic:read` + - `member:phone:read` + - `promo_code:basic:read` + - `shipment:basic:read` + - `payment:dispute:read` + - `payment:resolution_center_case:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payments().retry( + "pay_xxxxxxxxxxxxxx", + RetryPaymentsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the payment to retry. + +
+
+
+
+ + +
+
+
+ +
client.payments.void_(id) -> Payment +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + +Required permissions: + - `payment:manage` + - `plan:basic:read` + - `access_pass:basic:read` + - `member:email:read` + - `member:basic:read` + - `member:phone:read` + - `promo_code:basic:read` + - `shipment:basic:read` + - `payment:dispute:read` + - `payment:resolution_center_case:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payments().void_( + "pay_xxxxxxxxxxxxxx", + VoidPaymentsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the payment to void. + +
+
+
+
+ + +
+
+
+ +
client.payments.updateReturnUrl(paymentId, request) -> PaymentStatus +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the payment's own `client_secret`, so the surface that knows the final destination can set it. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payments().updateReturnUrl( + "payment_id", + UpdateReturnUrlPaymentsRequest + .builder() + .returnUrl("https://shinetime.example/checkout/thanks") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**paymentId:** `String` — The unique identifier of the payment. + +
+
+ +
+
+ +**returnUrl:** `String` — Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. + +
+
+
+
+ + +
+
+
+ +
client.payments.retrieveStatus(paymentId) -> PaymentStatus +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own `client_secret`, so the surface collecting the payment can poll it directly. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payments().retrieveStatus( + "payment_id", + RetrieveStatusPaymentsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**paymentId:** `String` — The unique identifier of the payment. + +
+
+
+
+ + +
+
+
+ +## PayoutAccounts +
client.payoutAccounts.retrieve(id) -> PayoutAccount +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing payout account. + +Required permissions: + - `payout:account:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payoutAccounts().retrieve( + "poact_xxxxxxxxxxxx", + RetrievePayoutAccountsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the payout account to retrieve. + +
+
+
+
+ + +
+
+
+ +## PayoutMethods +
client.payoutMethods.listPayoutMethod() -> SyncPagingIterable&lt;PayoutMethodListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of active payout methods configured for a company, ordered by most recently created. + +Required permissions: + - `payout:destination:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payoutMethods().listPayoutMethod( + ListPayoutMethodRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .first(42) + .last(42) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to list payout methods for. + +
+
+
+
+ + +
+
+
+ +
client.payoutMethods.retrievePayoutMethod(id) -> PayoutMethod +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing payout method. + +Required permissions: + - `payout:destination:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payoutMethods().retrievePayoutMethod( + "potk_xxxxxxxxxxxxx", + RetrievePayoutMethodRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the payout method to retrieve. + +
+
+
+
+ + +
+
+
+ +## Payouts +
client.payouts.list() -> SyncPagingIterable&lt;ListPayoutsResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists an account's or user's payouts, newest first. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payouts().list( + ListPayoutsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The owning account ID (a biz_ identifier). Provide this or user_id. + +
+
+ +
+
+ +**userId:** `Optional` — The owning user ID (a user_ identifier). Provide this or account_id. + +
+
+ +
+
+ +**currency:** `Optional` — Optional currency code filter, for example `usd`. + +
+
+ +
+
+ +**status:** `Optional` — Filter to payouts whose `status` reads this word, matching exactly what this version displays — `reversed` finds settled payouts the bank later returned. Requires Api-Version-Date 2026-08-21 or later. + +
+
+ +
+
+ +**source:** `Optional` — Filter by how the payout was created. Payouts created before source tracking or through internal tooling carry no source and never match. + +
+
+ +
+
+ +**payoutMethodId:** `Optional` — Filter to payouts sent to one saved payout method (a pytk_ identifier). An unknown id matches nothing. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only payouts created before this ISO 8601 time (exclusive). + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only payouts created at or after this ISO 8601 time (inclusive). + +
+
+ +
+
+ +**first:** `Optional` — Number of payouts to return from the start of the window. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to fetch the page after (from page_info.end_cursor). + +
+
+ +
+
+ +**last:** `Optional` — Number of payouts to return from the end of the window. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to fetch the page before (from page_info.start_cursor). + +
+
+
+
+ + +
+
+
+ +
client.payouts.create(request) -> CreatePayoutsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Sends money from an account or user balance to a saved payout method for that owner. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payouts().create( + CreatePayoutsRequestBody.of(new + HashMap() {{put("key", "value"); + }}) +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `CreatePayoutsRequestBody` + +
+
+
+
+ + +
+
+
+ +
client.payouts.retrieve(id) -> RetrievePayoutsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Fetches one payout by its `wdrl_` ID, or by the `cofr_` conversion request ID a stablecoin payout carries as `payout_request_id` — both ids answer with the same payout object. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payouts().retrieve( + "id", + RetrievePayoutsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Payout ID, prefixed `wdrl_` for a payout returned by `GET /payouts` or `cofr_` for the payout request returned by `POST /payouts`. + +
+
+ +
+
+ +**accountId:** `Optional` — Owning account ID, prefixed `biz_`. Provide exactly one of `account_id` or `user_id`. + +
+
+ +
+
+ +**userId:** `Optional` — Owning user ID, prefixed `user_`. Provide exactly one of `account_id` or `user_id`. + +
+
+
+
+ + +
+
+
+ +## People +
client.people.list() -> SyncPagingIterable&lt;ListPeopleResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.people().list( + ListPeopleRequest + .builder() + .source( + Arrays.asList("direct") + ) + .eventName( + Arrays.asList("payment.completed") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Account ID, prefixed `biz_`. Optional for account API keys; required for credentials that can access multiple accounts. + +
+
+ +
+
+ +**query:** `Optional` — Search people by name, email, phone, or whop user ID (case-insensitive substring match). + +
+
+ +
+
+ +**source:** `Optional` — Only include people acquired from any of these sources — canonical paths (whop:::, ext::..., referrer:, direct, other), exact or with a trailing :* prefix. The same vocabulary the events / people metrics use. + +
+
+ +
+
+ +**attributionModel:** `Optional` — Attribution model the source filter matches against (defaults to last_touch). + +
+
+ +
+
+ +**eventName:** `Optional` — Only include people who fired any of these events, e.g. payment.completed or page.checkout.view. + +
+
+ +
+
+ +**customEvent:** `Optional` — Only include people who fired this custom pixel event. + +
+
+ +
+
+ +**eventFrom:** `Optional` — With event_to plus an event or source filter, switches to exact-population mode: person ids are resolved and paginated on the events side within this window (the same query the people metric counts), then hydrated per page. + +
+
+ +
+
+ +**eventTo:** `Optional` — The inclusive end of the event window for exact-population mode. + +
+
+ +
+
+ +**audienceId:** `Optional` — Only include people in this audience. An audience that keeps itself up to date resolves to the People filters that define it, so this always reflects who matches now; uploaded lists and point-in-time snapshots match their recorded members. + +
+
+ +
+
+ +**userId:** `Optional` — Only include the person linked to this whop user ID. + +
+
+ +
+
+ +**email:** `Optional` — Only include the person linked to this email address. + +
+
+ +
+
+ +**phone:** `Optional` — Only include the person linked to this phone number. + +
+
+ +
+
+ +**country:** `Optional` — Only include people whose most recent visit came from this ISO 3166-1 alpha-2 country code. + +
+
+ +
+
+ +**hasPurchased:** `Optional` — true for customers only, false for people who have never purchased. + +
+
+ +
+
+ +**contactable:** `Optional` — true for people who have an email address or phone number — the ones an ad platform can match. + +
+
+ +
+
+ +**firstSeenWithinDays:** `Optional` — Only include people first seen within this many days, as a rolling window. + +
+
+ +
+
+ +**lastSeenWithinDays:** `Optional` — Only include people last seen within this many days, as a rolling window. + +
+
+ +
+
+ +**firstSeenAfter:** `Optional` — Only include people first seen at or after this ISO 8601 timestamp. + +
+
+ +
+
+ +**firstSeenBefore:** `Optional` — Only include people first seen before this ISO 8601 timestamp. + +
+
+ +
+
+ +**lastSeenAfter:** `Optional` — Only include people last seen at or after this ISO 8601 timestamp. + +
+
+ +
+
+ +**lastSeenBefore:** `Optional` — Only include people last seen before this ISO 8601 timestamp. + +
+
+ +
+
+ +**first:** `Optional` — The number of people to return (default 100, max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor for fetching people after a previous page. + +
+
+ +
+
+ +**before:** `Optional` — A cursor for fetching people before a later page. + +
+
+ +
+
+ +**order:** `Optional` — Column to sort by. Defaults to last_seen_at. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. Defaults to desc. + +
+
+
+
+ + +
+
+
+ +
client.people.retrieve(id) -> RetrievePeopleResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves one person for an account. The identifier can be a person ID (prefixed `prsn_`), a user ID (prefixed `user_`), an email address, or a phone number — merged people resolve to the surviving profile. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.people().retrieve( + "id", + RetrievePeopleRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The person ID, user ID, email address, or phone number to look up. + +
+
+ +
+
+ +**accountId:** `Optional` — Account ID, prefixed `biz_`. Optional for account API keys; required for credentials that can access multiple accounts. + +
+
+
+
+ + +
+
+
+ +## Permissions +
client.permissions.list() -> ListPermissionsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists permission actions and whether the calling credential is granted each one for a resource. Answers for whichever identity authenticated the request — a user session, an OAuth token, or an account or app API key — so it never describes who else can reach the resource. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.permissions().list( + ListPermissionsRequest + .builder() + .resourceId("resource_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**resourceId:** `String` — Tag of the resource to check against: an account (`biz_`), product (`prod_`), experience (`exp_`), or app (`app_`). A resource the credential cannot see is reported as granted nothing rather than as an error. + +
+
+ +
+
+ +**actions:** `Optional` — Comma-separated permission actions to check, for example `stats:read,payment:basic:read`. Every action is returned when omitted. + +
+
+
+
+ + +
+
+
+ +## Plans +
client.plans.list() -> SyncPagingIterable&lt;PlanListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of plans belonging to an account, with optional filtering by visibility, type, release method, and product. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.plans().list( + ListPlansRequest + .builder() + .accountId("account_id") + .releaseMethods( + Arrays.asList("buy_now") + ) + .visibilities( + Arrays.asList("visible") + ) + .planTypes( + Arrays.asList("renewal") + ) + .productIds( + Arrays.asList("prod_xxxxxxxxxxxxxx") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — The unique identifier of the account to list plans for. + +
+
+ +
+
+ +**direction:** `Optional` — The sort direction for results. Defaults to descending. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort results by. Defaults to created_at. + +
+
+ +
+
+ +**releaseMethods:** `Optional` — Filter to only plans matching these release methods. + +
+
+ +
+
+ +**visibilities:** `Optional` — Filter to only plans matching these visibility states. + +
+
+ +
+
+ +**planTypes:** `Optional` — Filter to only plans matching these billing types. + +
+
+ +
+
+ +**productIds:** `Optional` — Filter to only plans belonging to these product identifiers. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return plans created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return plans created after this timestamp. + +
+
+ +
+
+ +**first:** `Optional` — The number of plans to return (default and max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns plans after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of plans to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns plans before this position. + +
+
+
+
+ + +
+
+
+ +
client.plans.create(request) -> Plan +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.plans().create( + CreatePlansRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The unique identifier of the account to create this plan for. Defaults to the caller's account. + +
+
+ +
+
+ +**adaptivePricingEnabled:** `Optional` — Whether this plan accepts local currency payments via adaptive pricing. + +
+
+ +
+
+ +**billingPeriod:** `Optional` — Recurring billing interval in days, such as 30 for monthly or 365 for annual. + +
+
+ +
+
+ +**checkoutStyling:** `Optional>` — Checkout styling overrides for this plan. + +
+
+ +
+
+ +**currency:** `Optional` — The three-letter ISO currency code for the plan's pricing. Defaults to USD. + +
+
+ +
+
+ +**customFields:** `Optional>` — An array of custom field definitions to collect from customers at checkout. Omitting this field clears existing custom fields. + +
+
+ +
+
+ +**description:** `Optional` — A text description of the plan displayed to customers on the product page. + +
+
+ +
+
+ +**expirationDays:** `Optional` — Access duration in days before the membership expires. + +
+
+ +
+
+ +**image:** `Optional` — An image displayed on the product page to represent this plan. + +
+
+ +
+
+ +**initialPrice:** `Optional` — Initial amount charged in the plan's currency, e.g. 10.43 for $10.43. + +
+
+ +
+
+ +**internalNotes:** `Optional` — Private notes visible only to the account owner. Not shown to customers. + +
+
+ +
+
+ +**metadata:** `Optional>` — Custom key-value pairs to store on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys `custom_cta` (a checkout call-to-action button label — one of the product custom CTA values, e.g. `subscribe`, `get_offer`) and `custom_cta_url` (a URL the button links to; web or `tel:`) override the product's call to action for this plan and are validated on save. + +
+
+ +
+
+ +**overrideTaxType:** `Optional` — Override the default tax classification for this specific plan. + +
+
+ +
+
+ +**paymentMethodConfiguration:** `Optional` — Explicit payment method configuration for the plan. When not provided, the account's defaults apply. + +
+
+ +
+
+ +**planType:** `Optional` — Plan billing type, such as `one_time` or `renewal`. + +
+
+ +
+
+ +**productId:** `Optional` — The unique identifier of the product to attach this plan to. + +
+
+ +
+
+ +**releaseMethod:** `Optional` — Sales method for this plan. + +
+
+ +
+
+ +**renewalPrice:** `Optional` — The amount charged each billing period for recurring plans, in the plan's currency. + +
+
+ +
+
+ +**splitPayRequiredPayments:** `Optional` — Installment payments required before the subscription pauses. + +
+
+ +
+
+ +**stock:** `Optional` — The maximum number of units available for purchase. Ignored when unlimited_stock is true. + +
+
+ +
+
+ +**threeDsLevel:** `Optional` — 3D Secure behavior for this plan. Send `null` to inherit the account default. + +
+
+ +
+
+ +**title:** `Optional` — The display name of the plan shown to customers on the product page. + +
+
+ +
+
+ +**trialPeriodDays:** `Optional` — Free trial duration before the first recurring charge. + +
+
+ +
+
+ +**unlimitedStock:** `Optional` — Whether the plan has unlimited stock. When true, the stock field is ignored. + +
+
+ +
+
+ +**visibility:** `Optional` — Whether the plan is visible to customers or hidden from public view. + +
+
+
+
+ + +
+
+
+ +
client.plans.retrieve(id) -> Plan +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing plan. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.plans().retrieve( + "id", + RetrievePlansRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Plan ID, prefixed `plan_`. + +
+
+
+
+ + +
+
+
+ +
client.plans.delete(id) -> DeletePlansResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Permanently delete a plan from a product. Existing memberships on this plan will not be affected. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.plans().delete( + "id", + DeletePlansRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Plan ID, prefixed `plan_`. + +
+
+
+
+ + +
+
+
+ +
client.plans.update(id, request) -> Plan +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a plan's pricing, billing interval, visibility, stock, and other settings. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.plans().update( + "id", + UpdatePlansRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Plan ID, prefixed `plan_`. + +
+
+ +
+
+ +**adaptivePricingEnabled:** `Optional` — Whether this plan accepts local currency payments via adaptive pricing. + +
+
+ +
+
+ +**billingPeriod:** `Optional` — Recurring billing interval in days, such as 30 for monthly or 365 for annual. + +
+
+ +
+
+ +**cancelDiscountIntervals:** `Optional` — How many renewals the retention discount applies to. Required when `offer_cancel_discount` is true. + +
+
+ +
+
+ +**cancelDiscountPercentage:** `Optional` — Percentage taken off each discounted renewal. Required when `offer_cancel_discount` is true. + +
+
+ +
+
+ +**checkoutStyling:** `Optional>` — Checkout styling overrides for this plan. + +
+
+ +
+
+ +**currency:** `Optional` — The three-letter ISO currency code for the plan's pricing. Defaults to USD. + +
+
+ +
+
+ +**customFields:** `Optional>` — An array of custom field definitions to collect from customers at checkout. Omitting this field clears existing custom fields. + +
+
+ +
+
+ +**description:** `Optional` — A text description of the plan displayed to customers on the product page. + +
+
+ +
+
+ +**expirationDays:** `Optional` — Access duration in days before the membership expires. + +
+
+ +
+
+ +**image:** `Optional` — An image displayed on the product page to represent this plan. + +
+
+ +
+
+ +**initialPrice:** `Optional` — Initial amount charged in the plan's currency, e.g. 10.43 for $10.43. + +
+
+ +
+
+ +**internalNotes:** `Optional` — Private notes visible only to the account owner. Not shown to customers. + +
+
+ +
+
+ +**metadata:** `Optional>` — Custom key-value pairs to store on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys `custom_cta` (a checkout call-to-action button label — one of the product custom CTA values, e.g. `subscribe`, `get_offer`) and `custom_cta_url` (a URL the button links to; web or `tel:`) override the product's call to action for this plan and are validated on save. + +
+
+ +
+
+ +**offerCancelDiscount:** `Optional` — Whether to offer a retention discount when a customer attempts to cancel. + +
+
+ +
+
+ +**overrideTaxType:** `Optional` — Override the default tax classification for this specific plan. + +
+
+ +
+
+ +**paymentMethodConfiguration:** `Optional` — Explicit payment method configuration for the plan. When not provided, the account's defaults apply. + +
+
+ +
+
+ +**releaseMethod:** `Optional` — Sales method for this plan. + +
+
+ +
+
+ +**renewalPrice:** `Optional` — The amount charged each billing period for recurring plans, in the plan's currency. + +
+
+ +
+
+ +**stock:** `Optional` — The maximum number of units available for purchase. Ignored when unlimited_stock is true. + +
+
+ +
+
+ +**strikeThroughInitialPrice:** `Optional` — A comparison price displayed with a strikethrough for the initial price. + +
+
+ +
+
+ +**strikeThroughRenewalPrice:** `Optional` — A comparison price displayed with a strikethrough for the renewal price. + +
+
+ +
+
+ +**threeDsLevel:** `Optional` — 3D Secure behavior for this plan. Send `null` to inherit the account default. + +
+
+ +
+
+ +**title:** `Optional` — The display name of the plan shown to customers on the product page. + +
+
+ +
+
+ +**trialPeriodDays:** `Optional` — Free trial duration before the first recurring charge. + +
+
+ +
+
+ +**unlimitedStock:** `Optional` — Whether the plan has unlimited stock. When true, the stock field is ignored. + +
+
+ +
+
+ +**visibility:** `Optional` — Whether the plan is visible to customers or hidden from public view. + +
+
+
+
+ + +
+
+
+ +
client.plans.calculateTax(id, request) -> CalculateTaxPlansResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Previews tax for a plan before checkout, based on the buyer's location. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.plans().calculateTax( + "id", + CalculateTaxPlansRequest + .builder() + .address( + CalculateTaxPlansRequestAddress + .builder() + .country("DE") + .postalCode("10115") + .build() + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Plan ID, prefixed `plan_`. + +
+
+ +
+
+ +**address:** `Optional` — Buyer billing address used for tax calculation. Provide either `address.country` or `ip_address`; include state and postal code when available for more accurate results. + +
+
+ +
+
+ +**ipAddress:** `Optional` — Buyer IP address used to infer location when no billing address is provided. + +
+
+ +
+
+ +**taxIds:** `Optional>` — Optional buyer tax ID for B2B exemptions. At most one entry is supported. + +
+
+
+
+ + +
+
+
+ +## Products +
client.products.list() -> SyncPagingIterable&lt;ProductListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of products belonging to an account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.products().list( + ListProductsRequest + .builder() + .accountId("account_id") + .visibilities( + Arrays.asList("visible") + ) + .accessPassTypes( + Arrays.asList("regular") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — The unique identifier of the account to list products for. + +
+
+ +
+
+ +**visibilities:** `Optional` — Filter to only products matching these visibility states. + +
+
+ +
+
+ +**accessPassTypes:** `Optional` — Filter to only products matching these types. + +
+
+ +
+
+ +**labels:** `Optional` — Filter to only products carrying all of these labels. Labels are matched lowercased. + +
+
+ +
+
+ +**direction:** `Optional` — The sort direction for results. Defaults to descending. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort results by. Defaults to created_at. + +
+
+ +
+
+ +**first:** `Optional` — The number of products to return (default and max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns products after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of products to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns products before this position. + +
+
+
+
+ + +
+
+
+ +
client.products.create(request) -> Product +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new product for an account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.products().create( + CreateProductsRequest + .builder() + .title("Interior Deep Clean") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The unique identifier of the account to create this product for. + +
+
+ +
+
+ +**collectShippingAddress:** `Optional` — Whether to collect a shipping address at checkout. + +
+
+ +
+
+ +**customCta:** `Optional` — The call-to-action button label. + +
+
+ +
+
+ +**customCtaUrl:** `Optional` — A URL the call-to-action button links to. + +
+
+ +
+
+ +**customStatementDescriptor:** `Optional` — Custom bank statement descriptor. Must start with WHOP*. + +
+
+ +
+
+ +**description:** `Optional` — A written description displayed on the product page. + +
+
+ +
+
+ +**globalAffiliatePercentage:** `Optional` — The commission rate affiliates earn. + +
+
+ +
+
+ +**globalAffiliateStatus:** `Optional` — The enrollment status in the global affiliate program. + +
+
+ +
+
+ +**headline:** `Optional` — A short marketing headline for the product page. + +
+
+ +
+
+ +**labels:** `Optional>` — Labels used to group products into collections. Stored lowercased and de-duplicated. Maximum 20 labels, 50 characters each. + +
+
+ +
+
+ +**memberAffiliatePercentage:** `Optional` — The commission rate members earn. + +
+
+ +
+
+ +**memberAffiliateStatus:** `Optional` — The enrollment status in the member affiliate program. + +
+
+ +
+
+ +**metadata:** `Optional>` — Custom key-value pairs to store on the product. + +
+
+ +
+
+ +**productTaxCodeId:** `Optional` — The unique identifier of the tax classification code. See the available [product categories](https://docs.numeral.com/essentials/product-categories). + +
+
+ +
+
+ +**redirectPurchaseUrl:** `Optional` — A URL to redirect the customer to after purchase. + +
+
+ +
+
+ +**route:** `Optional` — The URL slug for the product's public link. + +
+
+ +
+
+ +**sendWelcomeMessage:** `Optional` — Whether to send an automated welcome message via support chat when a user joins this product. Defaults to true. + +
+
+ +
+
+ +**title:** `String` — The display name of the product. Maximum 80 characters. + +
+
+ +
+
+ +**visibility:** `Optional` — Whether the product is visible to customers. + +
+
+
+
+ + +
+
+
+ +
client.products.retrieve(id) -> Product +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing product. This endpoint is publicly accessible. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.products().retrieve( + "id", + RetrieveProductsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the product. + +
+
+
+
+ + +
+
+
+ +
client.products.delete(id) -> DeleteProductsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.products().delete( + "id", + DeleteProductsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the product. + +
+
+
+
+ + +
+
+
+ +
client.products.update(id, request) -> Product +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an existing product. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.products().update( + "id", + UpdateProductsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the product. + +
+
+ +
+
+ +**bannerImage:** `Optional` — A wide image for the product, shown on the product page and on listing cards. Pass `{ id }` for an existing attachment or `{ direct_upload_id }` for a completed direct upload; `null` removes it. + +
+
+ +
+
+ +**description:** `Optional` — A written description displayed on the product page. + +
+
+ +
+
+ +**headline:** `Optional` — A short marketing headline for the product page. + +
+
+ +
+
+ +**labels:** `Optional>` — Labels used to group products into collections. Replaces the existing labels. Send an empty array to clear them. + +
+
+ +
+
+ +**metadata:** `Optional>` — Custom key-value pairs to store on the product. + +
+
+ +
+
+ +**productTaxCodeId:** `Optional` — The unique identifier of the tax classification code. See the available [product categories](https://docs.numeral.com/essentials/product-categories). + +
+
+ +
+
+ +**sendWelcomeMessage:** `Optional` — Whether to send an automated welcome message via support chat when a user joins this product. + +
+
+ +
+
+ +**title:** `Optional` — The display name of the product. + +
+
+ +
+
+ +**visibility:** `Optional` — Whether the product is visible to customers. + +
+
+
+
+ + +
+
+
+ +
client.products.publish(id) -> Product +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Submits a product to the whop.com marketplace for review. The product moves to `pending_review`; a Whop reviewer approves it before it goes live. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.products().publish( + "id", + PublishProductsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the product, prefixed `prod_`. + +
+
+
+
+ + +
+
+
+ +
client.products.unpublish(id) -> Product +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Removes a product from the whop.com marketplace. The product moves to `not_available`. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.products().unpublish( + "id", + UnpublishProductsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the product, prefixed `prod_`. + +
+
+
+
+ + +
+
+
+ +## Promo Codes +
client.promoCodes.list() -> SyncPagingIterable&lt;PromoCodeListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists promo codes for an account with cursor pagination, filters, and sorting. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.promoCodes().list( + ListPromoCodesRequest + .builder() + .accountId("account_id") + .productIds( + Arrays.asList("prod_xxxxxxxxxxxxxx") + ) + .planIds( + Arrays.asList("plan_xxxxxxxxxxxxxx") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — Account whose promo codes are listed (`biz_` tag). + +
+
+ +
+
+ +**status:** `Optional` — Promo-code status. `expired` groups inactive and archived codes. + +
+
+ +
+
+ +**productIds:** `Optional` — Only promo codes scoped to these product IDs. + +
+
+ +
+
+ +**planIds:** `Optional` — Only promo codes scoped to these plan IDs. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only promo codes created before this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only promo codes created after this ISO 8601 timestamp. + +
+
+ +
+
+ +**order:** `Optional` — Sort field. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+ +
+
+ +**first:** `Optional` — Number of promo codes to return from the start of the window. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to paginate forwards from. + +
+
+ +
+
+ +**last:** `Optional` — Number of promo codes to return from the end of the window. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to paginate backwards from. + +
+
+
+
+ + +
+
+
+ +
client.promoCodes.create(request) -> PromoCode +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a promo code for an account. First-party sessions may attach an affiliate. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.promoCodes().create( + CreatePromoCodesRequest + .builder() + .accountId("biz_xxxxxxxxxxxxxx") + .amountOff(25.0) + .baseCurrency(CreatePromoCodesRequestBaseCurrency.USD) + .code("AFFILIATE25") + .newUsersOnly(true) + .promoDurationMonths(3) + .promoType(CreatePromoCodesRequestPromoType.PERCENTAGE) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` + +
+
+ +
+
+ +**amountOff:** `Double` + +
+
+ +
+
+ +**baseCurrency:** `CreatePromoCodesRequestBaseCurrency` + +
+
+ +
+
+ +**churnedUsersOnly:** `Optional` + +
+
+ +
+
+ +**code:** `String` + +
+
+ +
+
+ +**existingMembershipsOnly:** `Optional` + +
+
+ +
+
+ +**expiresAt:** `Optional` + +
+
+ +
+
+ +**newUsersOnly:** `Boolean` + +
+
+ +
+
+ +**onePerCustomer:** `Optional` + +
+
+ +
+
+ +**planIds:** `Optional>` + +
+
+ +
+
+ +**productId:** `Optional` + +
+
+ +
+
+ +**promoDurationMonths:** `Integer` + +
+
+ +
+
+ +**promoType:** `CreatePromoCodesRequestPromoType` + +
+
+ +
+
+ +**stock:** `Optional` + +
+
+ +
+
+ +**unlimitedStock:** `Optional` + +
+
+
+
+ + +
+
+
+ +
client.promoCodes.retrieve(id) -> PromoCode +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a promo code by ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.promoCodes().retrieve( + "id", + RetrievePromoCodesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Promo code ID (`promo_` tag). + +
+
+
+
+ + +
+
+
+ +
client.promoCodes.delete(id) -> DeletePromoCodesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Archives a promo code so it cannot be used in future checkouts. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.promoCodes().delete( + "id", + DeletePromoCodesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Promo code ID (`promo_` tag). + +
+
+
+
+ + +
+
+
+ +
client.promoCodes.activate(id) -> PromoCode +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Turns an inactive promo code back on so it can be redeemed at checkout. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.promoCodes().activate( + "id", + ActivatePromoCodesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Promo code ID (`promo_` tag). + +
+
+
+
+ + +
+
+
+ +
client.promoCodes.deactivate(id) -> PromoCode +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Turns off an active promo code so it can no longer be redeemed at checkout. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.promoCodes().deactivate( + "id", + DeactivatePromoCodesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Promo code ID (`promo_` tag). + +
+
+
+
+ + +
+
+
+ +## Reactions +
client.reactions.list() -> SyncPagingIterable&lt;ReactionListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of emoji reactions on a specific message or forum post, sorted by most recent. + +Required permissions (one of): + - `chat:read` + - `dms:read` + - `forum:read` + - `livestream:chat:read` + - `support_chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.reactions().list( + ListReactionsRequest + .builder() + .resourceId("resource_id") + .first(42) + .last(42) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**resourceId:** `String` — The unique identifier of the message or forum post to list reactions for. + +
+
+
+
+ + +
+
+
+ +
client.reactions.create(request) -> Reaction +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add an emoji reaction or poll vote to a message or forum post. In forums, the reaction is always a like. + +Required permissions (one of): + - `chat:read` + - `dms:read` + - `forum:read` + - `livestream:chat:read` + - `support_chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.reactions().create( + CreateReactionsRequest + .builder() + .resourceId("resource_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**emoji:** `Optional` — The emoji to react with, in shortcode or unicode format. For example, ':heart:' or a unicode emoji. Ignored in forums where reactions are always likes. + +
+
+ +
+
+ +**pollOptionId:** `Optional` — The unique identifier of a poll option to vote for. Only valid when the target message or post contains a poll. + +
+
+ +
+
+ +**resourceId:** `String` — The unique identifier of the message or forum post to react to. + +
+
+
+
+ + +
+
+
+ +
client.reactions.retrieve(id) -> Reaction +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing reaction. + +Required permissions (one of): + - `chat:read` + - `dms:read` + - `forum:read` + - `livestream:chat:read` + - `support_chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.reactions().retrieve( + "reac_xxxxxxxxxxxxxxxxxxxxxx", + RetrieveReactionsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the reaction to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.reactions.delete(id) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + +Required permissions (one of): + - `chat:read` + - `dms:read` + - `forum:read` + - `livestream:chat:read` + - `support_chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.reactions().delete( + "reac_xxxxxxxxxxxxxxxxxxxxxx", + DeleteReactionsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the reaction to remove, or the identifier of the message or forum post to remove a reaction from. When passing a message or post ID, you must also provide the emoji argument. + +
+
+ +
+
+ +**emoji:** `Optional` — The emoji to remove, in shortcode or unicode format. For example, ':heart:' or a unicode emoji. Required when the id refers to a message or post instead of a reaction. + +
+
+
+
+ + +
+
+
+ +## Recommended Actions +
client.recommendedActions.list() -> ListRecommendedActionsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.recommendedActions().list( + ListRecommendedActionsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Account ID, prefixed `biz_`. Defaults to the API key's own account. + +
+
+
+
+ + +
+
+
+ +
client.recommendedActions.retrieve(id) -> AccountRecommendedActionChain +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.recommendedActions().retrieve( + "id", + RetrieveRecommendedActionsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Chain ID from the list endpoint, e.g. `rac_seed_start_selling_9f2c1a7b04`. + +
+
+ +
+
+ +**accountId:** `Optional` — Account ID, prefixed `biz_`. Defaults to the API key's own account. + +
+
+
+
+ + +
+
+
+ +
client.recommendedActions.run(id) -> RunRecommendedActionsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the `recommended_action_chain.executed` analytics event. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.recommendedActions().run( + "id", + RunRecommendedActionsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Chain ID from the list endpoint, e.g. `rac_seed_start_selling_9f2c1a7b04`. + +
+
+ +
+
+ +**accountId:** `Optional` — Account ID, prefixed `biz_`. Defaults to the API key's own account. + +
+
+
+
+ + +
+
+
+ +
client.recommendedActions.listExecutions(id) -> ListExecutionsRecommendedActionsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.recommendedActions().listExecutions( + "id", + ListExecutionsRecommendedActionsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Chain ID from the list endpoint. + +
+
+ +
+
+ +**accountId:** `Optional` — Account ID, prefixed `biz_`. Defaults to the API key's own account. + +
+
+
+
+ + +
+
+
+ +## Refunds +
client.refunds.list() -> SyncPagingIterable&lt;RefundListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + +Required permissions: + - `payment:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.refunds().list( + ListRefundsRequest + .builder() + .first(42) + .last(42) + .paymentId("pay_xxxxxxxxxxxxxx") + .companyId("biz_xxxxxxxxxxxxxx") + .userId("user_xxxxxxxxxxxxx") + .createdBefore(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .createdAfter(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**paymentId:** `Optional` — Filter refunds to only those associated with this specific payment. + +
+
+ +
+
+ +**companyId:** `Optional` — Filter refunds to only those belonging to this company. + +
+
+ +
+
+ +**userId:** `Optional` — Filter refunds to only those associated with this specific user. + +
+
+ +
+
+ +**direction:** `Optional` + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return refunds created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return refunds created after this timestamp. + +
+
+
+
+ + +
+
+
+ +
client.refunds.retrieve(id) -> Refund +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing refund. + +Required permissions: + - `payment:basic:read` + - `plan:basic:read` + - `access_pass:basic:read` + - `member:email:read` + - `member:basic:read` + - `member:phone:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.refunds().retrieve( + "rf_xxxxxxxxxxxxxxx", + RetrieveRefundsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the refund. + +
+
+
+
+ + +
+
+
+ +## Resolution Center Cases +
client.resolutionCenterCases.list() -> SyncPagingIterable&lt;ResolutionCenterCase&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists resolution center cases. Without `account_id` you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.resolutionCenterCases().list( + ListResolutionCenterCasesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Only cases filed against this account (`biz_` tag). With read access to the account this lists its whole queue; without, only the cases you opened against it. + +
+
+ +
+
+ +**userId:** `Optional` — Only cases opened by this customer — a `user_` tag, or `me` for the calling user. It narrows what you can already read, so `me` lists the cases you opened without the ones on accounts you are a team member of. + +
+
+ +
+
+ +**first:** `Optional` — The number of cases to return (default 20, max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns cases after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of cases to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns cases before this position. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort cases by. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+ +
+
+ +**status:** `Optional` — Only cases in these statuses. Repeat the parameter to pass several — one paginated list covers all of them. + +
+
+ +
+
+ +**reason:** `Optional` — Only cases opened for these reasons. Repeat the parameter to pass several. + +
+
+ +
+
+ +**outcome:** `Optional` — Only closed cases that ended these ways. Repeat the parameter to pass several. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only cases created before this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only cases created after this ISO 8601 timestamp. + +
+
+
+
+ + +
+
+
+ +
client.resolutionCenterCases.create(request) -> ResolutionCenterCase +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Opens a case, as the customer, against one of your own payments. Provide the payment (`receipt_id`), the `reason`, and a `message`. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.resolutionCenterCases().create( + CreateResolutionCenterCasesRequest + .builder() + .message("The mobile detailer never showed up for the Ceramic Coating appointment.") + .reason(CreateResolutionCenterCasesRequestReason.FRAUDULENT) + .receiptId("pay_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**attachments:** `Optional>` + +
+
+ +
+
+ +**message:** `String` — The customer's explanation. + +
+
+ +
+
+ +**reason:** `CreateResolutionCenterCasesRequestReason` — What went wrong. Uses the same vocabulary as `/disputes`. + +
+
+ +
+
+ +**receiptId:** `String` — The payment to open the case against (`pay_` tag). + +
+
+
+
+ + +
+
+
+ +
client.resolutionCenterCases.summary() -> SummaryResolutionCenterCasesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Aggregates the same cases `GET /resolution_center_cases` lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.resolutionCenterCases().summary( + SummaryResolutionCenterCasesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**groups:** `Optional` — Which breakdowns to return, keyed by these names under `groups`. Repeat the parameter to ask for several; omit it for all of them. + +
+
+ +
+
+ +**accountId:** `Optional` — The account to summarize cases for (`biz_` tag). + +
+
+ +
+
+ +**userId:** `Optional` — Only cases opened by this customer — a `user_` tag, or `me` for the calling user. + +
+
+ +
+
+ +**status:** `Optional` — Only cases in these statuses. + +
+
+ +
+
+ +**reason:** `Optional` — Only cases opened for these reasons. + +
+
+ +
+
+ +**outcome:** `Optional` — Only closed cases that ended these ways. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only count cases created before this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only count cases created after this ISO 8601 timestamp. + +
+
+
+
+ + +
+
+
+ +
client.resolutionCenterCases.retrieve(id) -> ResolutionCenterCase +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a single resolution center case with its full event timeline. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.resolutionCenterCases().retrieve( + "id", + RetrieveResolutionCenterCasesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The resolution center case ID (`reso_` tag). + +
+
+
+
+ + +
+
+
+ +
client.resolutionCenterCases.accept(id, request) -> ResolutionCenterCase +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.resolutionCenterCases().accept( + "id", + AcceptResolutionCenterCasesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The resolution center case ID (`reso_` tag). + +
+
+ +
+
+ +**attachments:** `Optional>` — Up to 3 evidence files, by existing file `id` or `direct_upload_id`. + +
+
+ +
+
+ +**message:** `Optional` — An optional note to the customer, recorded on the case timeline. + +
+
+ +
+
+ +**terminateMembership:** `Optional` — Whether to also terminate the customer's membership. + +
+
+
+
+ + +
+
+
+ +
client.resolutionCenterCases.appeal(id, request) -> ResolutionCenterCase +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Appeals a decision, as the customer, on a case that closed in the merchant's favor. Escalates the case to Whop for platform review. A case can be appealed once. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.resolutionCenterCases().appeal( + "id", + AppealResolutionCenterCasesRequest + .builder() + .message("The coating is already flaking on the hood two weeks later.") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The resolution center case ID (`reso_` tag). + +
+
+ +
+
+ +**attachments:** `Optional>` — Up to 3 evidence files, by existing file `id` or `direct_upload_id`. + +
+
+ +
+
+ +**message:** `String` — Why you are appealing the decision. + +
+
+
+
+ + +
+
+
+ +
client.resolutionCenterCases.deny(id, request) -> ResolutionCenterCase +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Denies the case, as the merchant: rejects the claim and closes the case with no refund. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.resolutionCenterCases().deny( + "id", + DenyResolutionCenterCasesRequest + .builder() + .message("The ceramic coating was applied and the vehicle was collected on 2026-01-05.") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The resolution center case ID (`reso_` tag). + +
+
+ +
+
+ +**attachments:** `Optional>` — Up to 3 evidence files, by existing file `id` or `direct_upload_id`. + +
+
+ +
+
+ +**message:** `String` — Why the claim is being denied. Shown to the customer. + +
+
+
+
+ + +
+
+
+ +
client.resolutionCenterCases.events(id) -> SyncPagingIterable&lt;ResolutionEvent&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.resolutionCenterCases().events( + "id", + EventsResolutionCenterCasesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The resolution center case ID (`reso_` tag). + +
+
+ +
+
+ +**first:** `Optional` — The number of events to return (default 20, max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns events after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of events to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns events before this position. + +
+
+
+
+ + +
+
+
+ +
client.resolutionCenterCases.reply(id, request) -> ResolutionCenterCase +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Replies to an open request for information on the case. As the merchant this answers Whop's request (valid while the case awaits your information); as the customer it provides the information requested from you. The actor is resolved from the credential. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.resolutionCenterCases().reply( + "id", + ReplyResolutionCenterCasesRequest + .builder() + .message("Here are the before and after photos from the Burnet Rd bay.") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The resolution center case ID (`reso_` tag). + +
+
+ +
+
+ +**attachments:** `Optional>` — Up to 3 evidence files, by existing file `id` or `direct_upload_id`. + +
+
+ +
+
+ +**message:** `String` — The reply to add to the case. + +
+
+
+
+ + +
+
+
+ +
client.resolutionCenterCases.requestInfo(id, request) -> ResolutionCenterCase +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.resolutionCenterCases().requestInfo( + "id", + RequestInfoResolutionCenterCasesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The resolution center case ID (`reso_` tag). + +
+
+ +
+
+ +**attachments:** `Optional>` — Up to 3 evidence files, by existing file `id` or `direct_upload_id`. + +
+
+ +
+
+ +**message:** `Optional` — What you need from the customer. + +
+
+
+
+ + +
+
+
+ +
client.resolutionCenterCases.withdraw(id) -> ResolutionCenterCase +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.resolutionCenterCases().withdraw( + "id", + WithdrawResolutionCenterCasesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The resolution center case ID (`reso_` tag). + +
+
+
+
+ + +
+
+
+ +## Reviews +
client.reviews.list() -> SyncPagingIterable&lt;ReviewListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of customer reviews for a specific product, with optional filtering by star rating and creation date. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.reviews().list( + ListReviewsRequest + .builder() + .productId("prod_xxxxxxxxxxxxx") + .first(42) + .last(42) + .minStars(42) + .maxStars(42) + .createdBefore(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .createdAfter(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**productId:** `String` — The unique identifier of the product to list reviews for. + +
+
+ +
+
+ +**minStars:** `Optional` — The minimum star rating to include in results, from 1 to 5 inclusive. + +
+
+ +
+
+ +**maxStars:** `Optional` — The maximum star rating to include in results, from 1 to 5 inclusive. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return reviews created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return reviews created after this timestamp. + +
+
+
+
+ + +
+
+
+ +
client.reviews.retrieve(id) -> Review +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing review. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.reviews().retrieve( + "rev_xxxxxxxxxxxxxx", + RetrieveReviewsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the review to retrieve. + +
+
+
+
+ + +
+
+
+ +## Setup Intents +
client.setupIntents.list() -> SyncPagingIterable&lt;SetupIntentListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of setup intents for a company, with optional filtering by creation date. A setup intent securely collects and stores a member's payment method for future use without charging them immediately. + +Required permissions: + - `payment:setup_intent:read` + - `member:basic:read` + - `member:email:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.setupIntents().list( + ListSetupIntentsRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .first(42) + .last(42) + .createdBefore(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .createdAfter(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to list setup intents for. + +
+
+ +
+
+ +**direction:** `Optional` + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return setup intents created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return setup intents created after this timestamp. + +
+
+
+
+ + +
+
+
+ +
client.setupIntents.create(request) -> CreateSetupIntentsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Save a buyer's payment method for later without charging it. Provide a confirmation token for a method the buyer just supplied, or an existing payment method to re-verify. The buyer may still have a step to complete — 3D Secure, a hosted enrollment, linking a bank account — so poll the setup intent's status endpoint for what to do next. + +Required permissions: + - `payment:charge` + - `member:basic:read` + - `member:email:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.setupIntents().create( + CreateSetupIntentsRequest.of( + CreateSetupIntentsRequestConfirmationToken + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .confirmationToken("ctok_xxxxxxxxxxxxxx") + .build() + ) +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `CreateSetupIntentsRequest` — Parameters for CreateSetupIntent + +
+
+
+
+ + +
+
+
+ +
client.setupIntents.retrieve(id) -> SetupIntent +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing setup intent. + +Required permissions: + - `payment:setup_intent:read` + - `member:basic:read` + - `member:email:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.setupIntents().retrieve( + "sint_xxxxxxxxxxxxx", + RetrieveSetupIntentsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the setup intent. + +
+
+
+
+ + +
+
+
+ +
client.setupIntents.updateReturnUrl(setupIntentId, request) -> SetupStatus +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the setup's own `client_secret`, so the surface that knows the final destination can set it. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.setupIntents().updateReturnUrl( + "setup_intent_id", + UpdateReturnUrlSetupIntentsRequest + .builder() + .returnUrl("https://shinetime.example/checkout/thanks") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**setupIntentId:** `String` — The unique identifier of the setup intent. + +
+
+ +
+
+ +**returnUrl:** `String` — Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. + +
+
+
+
+ + +
+
+
+ +
client.setupIntents.retrieveStatus(setupIntentId) -> SetupStatus +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own `client_secret`, so the surface collecting the payment method can poll it directly. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.setupIntents().retrieveStatus( + "setup_intent_id", + RetrieveStatusSetupIntentsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**setupIntentId:** `String` — The unique identifier of the setup intent. + +
+
+
+
+ + +
+
+
+ +## Shipments +
client.shipments.list() -> SyncPagingIterable&lt;Shipment&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of shipments for an account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.shipments().list( + ListShipmentsRequest + .builder() + .paymentId( + Arrays.asList("pay_xxxxxxxxxxxxxx") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The account to list shipments for. Defaults to the acting account. + +
+
+ +
+
+ +**status:** `Optional` — Filter to shipments with this delivery status. + +
+
+ +
+
+ +**paymentId:** `Optional` — Only shipments fulfilling these payments, each prefixed `pay_`. Repeat the parameter to pass several, up to 100 per request — one paginated list covers all of them. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Return shipments created before this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Return shipments created after this ISO 8601 timestamp. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort by. + +
+
+ +
+
+ +**direction:** `Optional` — The sort direction. + +
+
+ +
+
+ +**first:** `Optional` — The number of shipments to return. + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns shipments after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of shipments to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns shipments before this position. + +
+
+
+
+ + +
+
+
+ +
client.shipments.create(request) -> Shipment +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Attaches a carrier tracking number to a payment and begins tracking it. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.shipments().create( + CreateShipmentsRequest + .builder() + .paymentId("pay_xxxxxxxxxxxxxx") + .trackingNumber("1Z999AA10123456784") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The unique identifier of the account, prefixed `biz_`. + +
+
+ +
+
+ +**paymentId:** `String` — The payment to attach the shipment to, prefixed `pay_`. + +
+
+ +
+
+ +**trackingNumber:** `String` — The carrier-assigned tracking number. + +
+
+
+
+ + +
+
+
+ +
client.shipments.retrieve(id) -> Shipment +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a shipment by its id, or by the payment id it fulfills. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.shipments().retrieve( + "id", + RetrieveShipmentsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The shipment id (`ship_`), or the payment id (`pay_`) it fulfills. + +
+
+
+
+ + +
+
+
+ +
client.shipments.update(id, request) -> Shipment +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a shipment's tracking number and re-tracks it with the carrier. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.shipments().update( + "id", + UpdateShipmentsRequest + .builder() + .trackingNumber("9400111899223456789012") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The shipment id (`ship_`), or the payment id (`pay_`) it fulfills. + +
+
+ +
+
+ +**trackingNumber:** `String` — The new carrier-assigned tracking number. + +
+
+
+
+ + +
+
+
+ +## Social Accounts +
client.socialAccounts.list() -> SyncPagingIterable&lt;SocialAccount&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the social accounts linked to an account or user. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.socialAccounts().list( + ListSocialAccountsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The Account that the social accounts are connected to. Provide either this or user_id. + +
+
+ +
+
+ +**userId:** `Optional` — The User that the social accounts are connected to. Provide either this or account_id. + +
+
+ +
+
+ +**platform:** `Optional` — Only return social accounts for the platform that is specified. + +
+
+ +
+
+ +**verified:** `Optional` — Only return social accounts that are verified on the platform. + +
+
+ +
+
+ +**scopes:** `Optional` — Only return social accounts that have these scopes. + +
+
+ +
+
+ +**first:** `Optional` — The number of social accounts to return. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to fetch the page after (from page_info.end_cursor). + +
+
+ +
+
+ +**last:** `Optional` — The number of social accounts to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to fetch the page before (from page_info.start_cursor). + +
+
+ +
+
+ +**order:** `Optional` — The field to sort social accounts by. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+
+
+ + +
+
+
+ +
client.socialAccounts.create(request) -> SocialAccount +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates or returns a Whop-managed Facebook page for an account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.socialAccounts().create( + CreateSocialAccountsRequest + .builder() + .platform(CreateSocialAccountsRequestPlatform.FACEBOOK) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The Account (biz_ identifier) to create the social account for. An account-scoped API key may omit this to default to its own account. Account API keys cannot update their own account's branding through Update Account; use a user-authenticated path. + +
+
+ +
+
+ +**platform:** `CreateSocialAccountsRequestPlatform` — The platform to create the social account on. `facebook` requires the account's `banner_image`, `logo`, and `description`; configure them with [Update Account](/api-reference/beta/accounts/update-account). + +
+
+
+
+ + +
+
+
+ +
client.socialAccounts.connect(request) -> ConnectSocialAccountsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Starts an OAuth connection flow and returns an authorize_url where the user can connect a social account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.socialAccounts().connect( + ConnectSocialAccountsRequest + .builder() + .platform(ConnectSocialAccountsRequestPlatform.META_BUSINESS) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The Account (biz_ identifier) to connect the social account for. An account-scoped API key may omit this to default to its own account. + +
+
+ +
+
+ +**platform:** `ConnectSocialAccountsRequestPlatform` — The platform to connect the social account on. Supported options are `meta_business` and `tiktok`. + +
+
+ +
+
+ +**redirectUrl:** `Optional` — The Whop URL to redirect the user to after they finish connecting. + +
+
+ +
+
+ +**scopes:** `Optional>` — Capabilities to grant for the connected social account. Use `advertise` when connecting a Meta Business or TikTok account for ads. + +
+
+
+
+ + +
+
+
+ +
client.socialAccounts.delete(id) -> DeleteSocialAccountsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Disconnects a social account from an account or user without deleting the underlying platform account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.socialAccounts().delete( + "id", + DeleteSocialAccountsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The ID of the social account to disconnect. + +
+
+ +
+
+ +**accountId:** `Optional` — The Account that the social account is connected to. Provide either this or user_id. + +
+
+ +
+
+ +**userId:** `Optional` — The User that the social account is connected to. Provide either this or account_id. + +
+
+
+
+ + +
+
+
+ +
client.socialAccounts.leadForms(id) -> LeadFormsSocialAccountsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the active lead (instant) forms that already exist on a connected Facebook page, so an ad can reuse one as its `lead_gen_form_id` instead of authoring a new form. Every active form comes back in a single response — the list is not paginated. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.socialAccounts().leadForms( + "id", + LeadFormsSocialAccountsRequest + .builder() + .accountId("account_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The social account (a sacc_ identifier) whose lead forms to list. + +
+
+ +
+
+ +**accountId:** `String` — The Account (a biz_ identifier) the social account is connected to. + +
+
+
+
+ + +
+
+
+ +
client.socialAccounts.posts(id) -> SyncPagingIterable&lt;SocialAccountPost&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the existing posts of a connected Facebook page, Instagram account, or TikTok account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.socialAccounts().posts( + "id", + PostsSocialAccountsRequest + .builder() + .accountId("account_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The social account (a sacc_ identifier) whose posts to list. + +
+
+ +
+
+ +**accountId:** `String` — The Account (a biz_ identifier) the social account is connected to. + +
+
+ +
+
+ +**postId:** `Optional` — Return only the single post with this platform id, instead of the full list. + +
+
+ +
+
+ +**first:** `Optional` — The number of posts to return. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to fetch the page after (from page_info.end_cursor). + +
+
+
+
+ + +
+
+
+ +## Stats +
client.stats.list() -> ListStatsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists every metric you can query, with its unit and the properties you can filter or break it down by. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.stats().list(); +``` +
+
+
+
+ + +
+
+
+ +
client.stats.describeStats() -> DescribeStatsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + +Required permissions: + - `stats:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.stats().describeStats( + DescribeStatsRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .userId("user_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**resource:** `Optional` — Resource path using : as separator (e.g., 'receipts', 'payments:membership', 'receipts:gross_revenue'). + +
+
+ +
+
+ +**companyId:** `Optional` — Scope query to a specific company. + +
+
+ +
+
+ +**userId:** `Optional` — Scope query to a specific user. + +
+
+
+
+ + +
+
+
+ +
client.stats.metricStats() -> MetricStatsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Query an aggregated metric. Returns data grouped by period with optional breakdowns. + +Required permissions: + - `stats:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.stats().metricStats( + MetricStatsRequest + .builder() + .resource("resource") + .from(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .to(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .companyId("biz_xxxxxxxxxxxxxx") + .userId("user_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**resource:** `String` — Metric resource using : as separator (e.g., 'receipts:gross_revenue', 'members:new_users'). + +
+
+ +
+
+ +**granularity:** `Optional` — Time granularity (daily, weekly, monthly). + +
+
+ +
+
+ +**breakdowns:** `Optional` — Columns to break down the metric by. + +
+
+ +
+
+ +**filters:** `Optional>` — Key-value pairs to filter the data. + +
+
+ +
+
+ +**timeZone:** `Optional` — IANA timezone for period bucketing (e.g. 'America/New_York'). Defaults to UTC. Only applies to ClickHouse metrics. + +
+
+ +
+
+ +**from:** `Optional` — Start of time range (unix timestamp). + +
+
+ +
+
+ +**to:** `Optional` — End of time range (unix timestamp). + +
+
+ +
+
+ +**companyId:** `Optional` — Scope query to a specific company. + +
+
+ +
+
+ +**userId:** `Optional` — Scope query to a specific user. + +
+
+
+
+ + +
+
+
+ +
client.stats.rawStats() -> RawStatsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Query raw data from a resource. Returns paginated rows with all columns. + +Required permissions: + - `stats:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.stats().rawStats( + RawStatsRequest + .builder() + .resource("resource") + .from(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .to(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .limit(42) + .companyId("biz_xxxxxxxxxxxxxx") + .userId("user_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**resource:** `String` — Resource path using : as separator (e.g., 'members', 'payments:membership'). + +
+
+ +
+
+ +**from:** `Optional` — Start of time range (unix timestamp). + +
+
+ +
+
+ +**to:** `Optional` — End of time range (unix timestamp). + +
+
+ +
+
+ +**limit:** `Optional` — Number of records to return (max 10000). + +
+
+ +
+
+ +**cursor:** `Optional` — Pagination cursor for next page. + +
+
+ +
+
+ +**sort:** `Optional` — Column to sort by. + +
+
+ +
+
+ +**sortDirection:** `Optional` + +
+
+ +
+
+ +**companyId:** `Optional` — Scope query to a specific company. + +
+
+ +
+
+ +**userId:** `Optional` — Scope query to a specific user. + +
+
+
+
+ + +
+
+
+ +
client.stats.retrieve(metric) -> RetrieveStatsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a metric as a time series of points for an account or user over a time range. The `market_prices` metric is public and requires no authentication. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.stats().retrieve( + "metric", + RetrieveStatsRequest + .builder() + .from("from") + .to("to") + .adCampaignIds( + Arrays.asList("adcamp_xxxxxxxxxxxxxx") + ) + .adGroupIds( + Arrays.asList("adgrp_xxxxxxxxxxxxxx") + ) + .adIds( + Arrays.asList("ad_xxxxxxxxxxxxxx") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**metric:** `String` — The metric to retrieve, for example net_revenue. Use GET /stats to see every metric key. The metric sets the unit and the properties you can filter or break down by. + +
+
+ +
+
+ +**accountId:** `Optional` — The account this query concerns, for example biz_AbC123. + +
+
+ +
+
+ +**userId:** `Optional` — The user this query concerns, for example user_AbC123. Available on metrics that support user subjects, such as account_balance. + +
+
+ +
+
+ +**from:** `String` — Start of the range — a date (YYYY-MM-DD), expanded to the start of that day, or an ISO 8601 timestamp (for example 2026-07-16T16:37:00Z), used exactly. + +
+
+ +
+
+ +**to:** `String` — End of the range — a date (YYYY-MM-DD), expanded to the end of that day, or an ISO 8601 timestamp (for example 2026-07-17T16:37:00Z), used exactly. + +
+
+ +
+
+ +**interval:** `Optional` — How wide each point is. Defaults to day. Snapshot metrics are day-only. + +
+
+ +
+
+ +**breakdownBy:** `Optional` — Split the metric out by one of its properties — each point gets a breakdown array. For example breakdown_by=currency returns an entry for usd, an entry for eur, and so on. + +
+
+ +
+
+ +**convertTo:** `Optional` — Display currency for money metrics — every amount is converted into this ISO currency using the exchange rate on each period's date. Defaults to usd. For the ads metrics (ad_spend, ad_delivery), pass the account's ads reporting currency to match the ad entity endpoints. On transaction metrics, it is ignored when you filter or break down by currency (those report the original transaction currency, unconverted). + +
+
+ +
+
+ +**currency:** `Optional` — Select the source currency or asset on metrics that list currency. For transaction metrics, for example currency=eur, values are reported without conversion. For market_prices, use btc or xaut and convert_to=usd. Pair with breakdown_by=currency to split a metric by currency. + +
+
+ +
+
+ +**timeZone:** `Optional` — IANA time zone to bucket the series in, for example America/New_York. Defaults to UTC. Not accepted by snapshot metrics, which are UTC only. + +
+
+ +
+
+ +**paymentMethod:** `Optional` — Filter to a single payment method, for example card or crypto. Available on metrics that list payment_method. + +
+
+ +
+
+ +**cardNetwork:** `Optional` — Filter to a single card brand, for example visa. A refinement of payment_method=card. Available on metrics that list card_network. + +
+
+ +
+
+ +**disputeReason:** `Optional` — Filter disputes to a normalized reason, for example product_not_received. Pair with breakdown_by=dispute_reason to split dispute counts by reason. + +
+
+ +
+
+ +**source:** `Optional` — Filter to a single GMV source, for example payments — or, on the traffic metrics, a visit source (whop_ads, direct, or a utm_source value). Pair with breakdown_by=source to split by source. Available on metrics that list source. + +
+
+ +
+
+ +**hostname:** `Optional` — Filter traffic metrics to one website hostname, for example shop.example.com. Pair with breakdown_by=hostname to split by website. + +
+
+ +
+
+ +**page:** `Optional` — Filter traffic metrics to one page — a hostname plus normalized path, for example shop.example.com/pricing. Pair with breakdown_by=page to split by page. + +
+
+ +
+
+ +**deviceType:** `Optional` — Filter traffic metrics to one device type: desktop, mobile, tablet, or unknown. Pair with breakdown_by=device_type to split by device. + +
+
+ +
+
+ +**countryCode:** `Optional` — Filter traffic metrics to one visitor country (uppercase ISO 3166-1 alpha-2, for example US). Pair with breakdown_by=country_code to split by country. + +
+
+ +
+
+ +**eventName:** `Optional` — Filter the events metric to one tracked event name, for example pixel.page or pixel.custom. Pair with breakdown_by=event_name to split by event. + +
+
+ +
+
+ +**eventType:** `Optional` — Filter the events metric to a canonical group of events: page_view (pixel page views plus whop.com store views), checkout_start (hosted and embedded checkout views), or other. Pair with breakdown_by=event_type to split by group. + +
+
+ +
+
+ +**customName:** `Optional` — Filter the events metric to one merchant-defined custom event name. Only valid alongside event_name=pixel.custom. Pair with breakdown_by=custom_name to split custom events by name. + +
+
+ +
+
+ +**segment:** `Optional` — Filter to a single wallet-balance segment, for example available. Pair with breakdown_by=segment to split the balance. Available on metrics that list segment. + +
+
+ +
+
+ +**category:** `Optional` — Filter to a single balance-activity category, for example payments. Pair with breakdown_by=category to split the activity. Available on metrics that list category. + +
+
+ +
+
+ +**merchant:** `Optional` — Filter to a single cashback merchant bucket, for example whop-ads. Pair with breakdown_by=merchant to split cashback by merchant. Available on metrics that list merchant. + +
+
+ +
+
+ +**feeType:** `Optional` — Filter to a single fee type. Pair with breakdown_by=fee_type to split fees by type. Available on metrics that list fee_type. + +
+
+ +
+
+ +**product:** `Optional` — Filter to a single product (access pass id), for example prod_AbC123. Pair with breakdown_by=product. Available on metrics that list product. + +
+
+ +
+
+ +**status:** `Optional` — Filter to a single membership status. Pair with breakdown_by=status. Available on metrics that list status. + +
+
+ +
+
+ +**accessLevel:** `Optional` — Filter to a single access level. Pair with breakdown_by=access_level. Available on metrics that list access_level. + +
+
+ +
+
+ +**mostRecentAction:** `Optional` — Filter to a single most-recent member action. Pair with breakdown_by=most_recent_action. Available on metrics that list most_recent_action. + +
+
+ +
+
+ +**referredUserId:** `Optional` — Filter a referral metric to the businesses attributed to one person you referred, for example user_AbC123. Available on metrics that list referred_user_id. + +
+
+ +
+
+ +**adCampaignIds:** `Optional` — Ad campaign ids (adcamp_...) to scope the report to; stats are summed across them. Available on metrics that list ad_campaign_ids. + +
+
+ +
+
+ +**adGroupIds:** `Optional` — Ad group ids (adgrp_...) to scope the report to; stats are summed across them. Available on metrics that list ad_group_ids. + +
+
+ +
+
+ +**adIds:** `Optional` — Ad ids (ad_...) to scope the report to; stats are summed across them. Available on metrics that list ad_ids. + +
+
+ +
+
+ +**snapshotWindow:** `Optional` — Window used by a snapshot metric. Ordinary snapshots accept 30d as their trailing activity window. Cohorted dispute metrics accept 7d or 28d as the sales-transaction pool; their attribution window is fixed in the metric name. Each metric lists its accepted values in the catalog. + +
+
+ +
+
+ +**event:** `Optional` — Filter the events metric to one or more full event names, for example payment.completed or pixel.lead. Comma-separate several to break the metric down by each event. Available on metrics that list event. + +
+
+
+
+ + +
+
+
+ +## SupportChannels +
client.supportChannels.list() -> SyncPagingIterable&lt;SupportChannelListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + +Required permissions: + - `support_chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.supportChannels().list( + ListSupportChannelsRequest + .builder() + .first(42) + .last(42) + .companyId("biz_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `Optional` — The unique identifier of the company to list support channels for. Includes channels of child companies. When omitted, returns support channels across all companies the user has access to. + +
+
+ +
+
+ +**view:** `Optional` + +
+
+ +
+
+ +**open:** `Optional` — Whether to filter by open or resolved support channels. Set to true to only return channels awaiting a response, or false for resolved channels. + +
+
+ +
+
+ +**direction:** `Optional` + +
+
+ +
+
+ +**order:** `Optional` + +
+
+
+
+ + +
+
+
+ +
client.supportChannels.create(request) -> SupportChannel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Open a new support channel between a company team member and a customer. Returns the existing channel if one already exists for that user. + +Required permissions: + - `support_chat:create` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.supportChannels().create( + CreateSupportChannelsRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .userId("user_xxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to create the support channel in. + +
+
+ +
+
+ +**customName:** `Optional` — Optional custom display name for the support channel. + +
+
+ +
+
+ +**notificationsEnabled:** `Optional` — Whether Whop app notifications are enabled for this support channel. Webhooks still fire. + +
+
+ +
+
+ +**userId:** `String` — The user ID (e.g. 'user_xxxxx') or username of the customer to open a support channel for. + +
+
+
+
+ + +
+
+
+ +
client.supportChannels.retrieve(id) -> SupportChannel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing support channel. + +Required permissions: + - `support_chat:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.supportChannels().retrieve( + "id", + RetrieveSupportChannelsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the support channel to retrieve. + +
+
+
+
+ + +
+
+
+ +## Swaps +
client.swaps.list() -> ListSwapsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve the account's completed or pending swaps — currently just the latest one. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.swaps().list( + ListSwapsRequest + .builder() + .accountId("account_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — Business or user account ID (biz_* / user_*). + +
+
+
+
+ + +
+
+
+ +
client.swaps.create(request) -> CreateSwapsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Swaps one token for another from the account's wallet, or converts between fiat currencies in the account's ledger at the mid-market rate. Crypto swaps finish in the background — check the swap for its status. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.swaps().create( + CreateSwapsRequest + .builder() + .accountId("biz_xxxxxxxxxxxxxx") + .fromToken("usd") + .toToken("cad") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — Business or user account ID (biz_* / user_*). + +
+
+ +
+
+ +**amount:** `Optional` — Source token amount. Required for crypto swaps. For fiat pairs: the amount of from_token to convert at the mid-market rate; omit (along with to_amount) to repay the full negative to_token balance instead. + +
+
+ +
+
+ +**fromChain:** `Optional` — Source chain name or chain ID. Defaults to the source token's chain when omitted. + +
+
+ +
+
+ +**fromToken:** `String` — Source token contract address or ticker symbol, such as "USDT". + +
+
+ +
+
+ +**slippageBps:** `Optional` — Maximum slippage tolerance in basis points. + +
+
+ +
+
+ +**toAmount:** `Optional` — Fiat pairs only: sizes a partial repayment of the negative to_token balance, denominated in to_token. Must not exceed the debt. Mutually exclusive with amount. + +
+
+ +
+
+ +**toChain:** `Optional` — Destination chain name or chain ID. Defaults to the destination token's chain when omitted. + +
+
+ +
+
+ +**toToken:** `String` — Destination token contract address or ticker symbol, such as "XAUT". + +
+
+
+
+ + +
+
+
+ +
client.swaps.createQuote(request) -> CreateQuoteSwapsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Previews the price of a swap. Fiat pairs quote the in-ledger mid-market conversion — the same rate creating the swap fills at. No funds move and nothing is saved. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.swaps().createQuote( + CreateQuoteSwapsRequest + .builder() + .amount("100") + .fromToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") + .toToken("0x1b64b9025eebb9a6239575df9ea4b9ac46d4d193") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**amount:** `String` — Source token amount. + +
+
+ +
+
+ +**fromAddress:** `Optional` — Source wallet address used for the quote. + +
+
+ +
+
+ +**fromChain:** `Optional` — Source chain name or chain ID. Defaults to the source token's chain when omitted. + +
+
+ +
+
+ +**fromToken:** `String` — Source token contract address or ticker symbol, such as "USDT". + +
+
+ +
+
+ +**metadata:** `Optional>` — Metadata to include with the quote response. + +
+
+ +
+
+ +**slippageBps:** `Optional` — Maximum slippage tolerance in basis points. + +
+
+ +
+
+ +**toAddress:** `Optional` — Destination wallet address used for the quote. + +
+
+ +
+
+ +**toChain:** `Optional` — Destination chain name or chain ID. Defaults to the destination token's chain when omitted. + +
+
+ +
+
+ +**toToken:** `String` — Destination token contract address or ticker symbol, such as "XAUT". + +
+
+
+
+ + +
+
+
+ +
client.swaps.retrieve(id) -> RetrieveSwapsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a single swap and its status. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.swaps().retrieve( + "id", + RetrieveSwapsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Swap ID returned from POST /swaps. + +
+
+
+
+ + +
+
+
+ +## Team Members +
client.teamMembers.list() -> SyncPagingIterable&lt;TeamMember&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists an account's team members, including pending invites (`status: "pending"`, `ausri_` ids; `user` is `null` for invites sent to an email with no Whop account yet). For accepted members, `email` requires the `company:authorized_user:email:read` scope and is `null` otherwise. Listing `role=workforce` is also allowed with the `bounty:create` scope. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.teamMembers().list( + ListTeamMembersRequest + .builder() + .accountId("account_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — Account ID, prefixed `biz_`. + +
+
+ +
+
+ +**status:** `Optional` — Only return members with this status: `joined` (accepted members) or `pending` (pending invites). Both are returned by default. + +
+
+ +
+
+ +**userId:** `Optional` — Only return the membership for this user ID, prefixed `user_`. + +
+
+ +
+
+ +**role:** `Optional` — Only return members with this role. `custom` matches members on a dashboard-managed custom role. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return members added before this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return members added after this ISO 8601 timestamp. + +
+
+ +
+
+ +**order:** `Optional` — Field used to sort members. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. Defaults to `desc`. + +
+
+ +
+
+ +**first:** `Optional` — Number of members to return. Defaults to 20; maximum 100. + +
+
+ +
+
+ +**after:** `Optional` — Cursor for the next page of members. + +
+
+ +
+
+ +**last:** `Optional` — Number of members to return from the end of the window. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to paginate backwards from. + +
+
+
+
+ + +
+
+
+ +
client.teamMembers.create(request) -> TeamMember +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Adds a member to an account's team with a system role. Identify them by exactly one of `user_id` or `email`. If the person has not yet accepted — or the email does not belong to a Whop account yet — an invitation is sent instead and the response is `202` with `{ "object": "team_member_invite", "invitation_sent": true }`. If they already have a pending invite, the request fails with a `400`. Custom roles cannot be granted via the API. Granting the `workforce` role is also allowed with the `bounty:create` scope. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.teamMembers().create( + CreateTeamMembersRequest + .builder() + .accountId("biz_xxxxxxxxxxxxxx") + .role(CreateTeamMembersRequestRole.OWNER) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — Account ID, prefixed `biz_`. + +
+
+ +
+
+ +**email:** `Optional` — Email address to invite. Mutually exclusive with `user_id`. If the email already belongs to a Whop account it is treated the same as passing that account's `user_id`; otherwise a pending invite is created for the email. + +
+
+ +
+
+ +**role:** `CreateTeamMembersRequestRole` — The system role to grant. + +
+
+ +
+
+ +**userId:** `Optional` — The user to add to the team, prefixed `user_`. Mutually exclusive with `email`. + +
+
+
+
+ + +
+
+
+ +
client.teamMembers.retrieve(id) -> TeamMember +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a team member by ID. `email` requires the `company:authorized_user:email:read` scope and is `null` otherwise. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.teamMembers().retrieve( + "id", + RetrieveTeamMembersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Team member ID — `ausr_` for accepted members, `ausri_` for pending invites. + +
+
+
+
+ + +
+
+
+ +
client.teamMembers.delete(id) -> DeleteTeamMembersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Removes a team member from the account, or revokes a pending invite when given an `ausri_` ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the `workforce` role is also allowed with the `bounty:create` scope. The account owner cannot be removed. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.teamMembers().delete( + "id", + DeleteTeamMembersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Team member ID — `ausr_` for accepted members, `ausri_` for pending invites. + +
+
+
+
+ + +
+
+
+ +
client.teamMembers.update(id, request) -> TeamMember +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Changes a team member's system role. Requires a user session — account API keys cannot change member roles. The account owner's role cannot be changed, and you cannot change your own role. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.teamMembers().update( + "id", + UpdateTeamMembersRequest + .builder() + .role(UpdateTeamMembersRequestRole.OWNER) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Team member ID — `ausr_` for accepted members, `ausri_` for pending invites. + +
+
+ +
+
+ +**role:** `UpdateTeamMembersRequestRole` — The system role to grant. + +
+
+
+
+ + +
+
+
+ +## Topups +
client.topups.create(request) -> Topup +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add funds to a company's platform balance by charging a stored payment method. Top-ups have no fees or taxes and do not count as revenue. + +Required permissions: + - `payment:charge` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.topups().create( + CreateTopupsRequest + .builder() + .amount(6.9) + .companyId("biz_xxxxxxxxxxxxxx") + .currency(Currencies.USD) + .paymentMethodId("pmt_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**amount:** `Double` — The amount to add to the balance in the specified currency. For example, 50.00 for $50.00 USD. + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to add funds to, starting with 'biz_'. + +
+
+ +
+
+ +**currency:** `Currencies` — The currency for the top-up amount, such as 'usd'. + +
+
+ +
+
+ +**paymentMethodId:** `String` — The unique identifier of the stored payment method to charge for the top-up. + +
+
+
+
+ + +
+
+
+ +## Transfers +
client.transfers.list() -> SyncPagingIterable&lt;ListTransfersResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists an account's transfers. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.transfers().list( + ListTransfersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**originId:** `Optional` — Filter to transfers sent from this account. Provide this or destination_id. + +
+
+ +
+
+ +**destinationId:** `Optional` — Filter to transfers received by this account. Provide this or origin_id. + +
+
+ +
+
+ +**order:** `Optional` — Sort column. Defaults to created_at. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. Defaults to desc. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only transfers created strictly before this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only transfers created strictly after this ISO 8601 timestamp. + +
+
+ +
+
+ +**first:** `Optional` — Number of transfers to return from the start of the window. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to fetch the page after (from page_info.end_cursor). + +
+
+ +
+
+ +**last:** `Optional` — Number of transfers to return from the end of the window. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to fetch the page before (from page_info.start_cursor). + +
+
+
+
+ + +
+
+
+ +
client.transfers.create(request) -> CreateTransfersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Moves money between accounts, or into a claim link anyone with the URL can redeem. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.transfers().create( + CreateTransfersRequest + .builder() + .amount(25.0) + .originId("biz_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**amount:** `Double` — The amount to move, in the transfer currency. For example 25.00. + +
+
+ +
+
+ +**currency:** `Optional` — Currency, such as `usd`. Required for ledger transfers. + +
+
+ +
+
+ +**destinationId:** `Optional` — The recipient. Required for ledger and wallet_send (a user_/biz_/ldgr_ ID, or — for sends — an email). Omit for claim_link. + +
+
+ +
+
+ +**expiresAt:** `Optional` — claim_link only. Link expiry as an ISO 8601 timestamp. Defaults to 24 hours from creation. + +
+
+ +
+
+ +**idempotenceKey:** `Optional` — Ledger transfers and wallet sends. A unique key that makes retries safe. Retrying with the same key returns the original transfer, or attaches to the original wallet send, instead of moving money twice. + +
+
+ +
+
+ +**metadata:** `Optional>` — Ledger transfers only. Custom key-value pairs attached to the transfer. Max 50 keys, 100 chars per key, 500 chars per string value. + +
+
+ +
+
+ +**notes:** `Optional` — Ledger transfers only. A short note describing the transfer. + +
+
+ +
+
+ +**originId:** `String` — The account sending the funds. A user ID (user_xxx), account ID (biz_xxx), or ledger account ID (ldgr_xxx). + +
+
+ +
+
+ +**redeemableCount:** `Optional` — claim_link only. How many different users can claim the link. Defaults to 1. + +
+
+ +
+
+ +**type:** `Optional` — The kind of money movement, which decides what comes back. Defaults to ledger. `ledger` moves credit between two Whop balances and returns a `transfer`; `wallet_send` sends USDT from the origin account's Ethereum wallet and returns a `send`; `claim_link` funds a shareable link anyone with the URL can redeem and returns a `claim_link`. A `ledger` transfer from a stablecoin-rails account settles on-chain when covered, and still returns a `transfer`. + +
+
+
+
+ + +
+
+
+ +
client.transfers.listRecipients() -> SyncPagingIterable&lt;ListRecipientsTransfersResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the people and accounts you can send money to. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.transfers().listRecipients( + ListRecipientsTransfersRequest + .builder() + .originId("origin_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**originId:** `String` — The account sending the money: a company account ID (`biz_`), or a user ID (`user_`) for that user's own personal balance. + +
+
+ +
+
+ +**query:** `Optional` — Search anyone on Whop by name or username, plus your own accounts by name or ID. Omit it to get the team around the balance, the people you follow, and your own accounts. The list is the same whether the balance belongs to a company or to you. Searching from a `biz_` origin additionally requires the member:basic:read scope. A credential scoped to a single company is the exception to the search itself: it only ever sees that company's own people. Complete email addresses return no matches. + +
+
+ +
+
+ +**first:** `Optional` — Number of recipients per page. Search queries preserve the dashboard's 20-result maximum. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to fetch the page after (from page_info.end_cursor). + +
+
+
+
+ + +
+
+
+ +
client.transfers.retrieve(id) -> RetrieveTransfersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a single transfer. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.transfers().retrieve( + "id", + RetrieveTransfersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The transfer ID. + +
+
+
+
+ + +
+
+
+ +## Users +
client.users.list() -> SyncPagingIterable&lt;User&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().list( + ListUsersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**query:** `Optional` — A search term to filter users by name or username. + +
+
+ +
+
+ +**first:** `Optional` — The number of users to return (max 50). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns users after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of users to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns users before this position. + +
+
+
+
+ + +
+
+
+ +
client.users.me() -> User +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the authenticated user — the self view of the user object. Same shape as `GET /users/{id}`, with the self-only fields populated: `email` (email-read scope), `staff` (Whop staff only, staff-read scope), `balance` and `earnings_usd` (balance-read scope), the opt-in `balance_history`, and every linked social account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().me( + MeUsersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — When set, returns your account-specific profile overrides for this account. + +
+
+ +
+
+ +**includeBalanceHistory:** `Optional` — Also compute your balance history (opt-in; runs a heavier query). Ignored for callers without balance-read scope. + +
+
+ +
+
+ +**from:** `Optional` — Balance-history window start, ISO 8601 date or datetime. Defaults to 30 days ago. Only used with `include_balance_history`. + +
+
+ +
+
+ +**to:** `Optional` — Balance-history window end, ISO 8601 date or datetime. Defaults to now. Only used with `include_balance_history`. + +
+
+ +
+
+ +**interval:** `Optional` — Balance-history point granularity. Defaults to `day`. Only used with `include_balance_history`. + +
+
+ +
+
+ +**timeZone:** `Optional` — IANA time zone the balance-history points are bucketed in. Defaults to `UTC`. Only used with `include_balance_history`. + +
+
+
+
+ + +
+
+
+ +
client.users.updateMe(request) -> User +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().updateMe( + UpdateMeUsersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — When set, updates the authenticated user's profile override for this account instead of their global profile. + +
+
+ +
+
+ +**banner:** `Optional` + +
+
+ +
+
+ +**bio:** `Optional` + +
+
+ +
+
+ +**name:** `Optional` + +
+
+ +
+
+ +**profilePicture:** `Optional` + +
+
+ +
+
+ +**username:** `Optional` + +
+
+
+
+ + +
+
+
+ +
client.users.retrieve(id) -> User +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a user by `user_` tag or username, or the authenticated user with the reserved id `me`. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is `me`: `email` (email-read scope), `staff` (Whop staff only, staff-read scope), `balance` and `earnings_usd` (balance-read scope), and the opt-in `balance_history`. They are always `null` when addressing a user by tag or username. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().retrieve( + "id", + RetrieveUsersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — User ID (prefixed `user_`), username, or `me` for the authenticated user. + +
+
+ +
+
+ +**accountId:** `Optional` — When set, returns the user's account-specific profile overrides for this account. + +
+
+ +
+
+ +**includeBalanceHistory:** `Optional` — Also compute your balance history (opt-in; runs a heavier query). Only applies when the id is `me`; ignored for callers without balance-read scope. + +
+
+ +
+
+ +**from:** `Optional` — Balance-history window start, ISO 8601 date or datetime. Defaults to 30 days ago. Only used with `include_balance_history`. + +
+
+ +
+
+ +**to:** `Optional` — Balance-history window end, ISO 8601 date or datetime. Defaults to now. Only used with `include_balance_history`. + +
+
+ +
+
+ +**interval:** `Optional` — Balance-history point granularity. Defaults to `day`. Only used with `include_balance_history`. + +
+
+ +
+
+ +**timeZone:** `Optional` — IANA time zone the balance-history points are bucketed in. Defaults to `UTC`. Only used with `include_balance_history`. + +
+
+
+
+ + +
+
+
+ +
client.users.update(id, request) -> User +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a user, addressed by `user_` tag, username, or the reserved id `me` for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().update( + "id", + UpdateUsersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — User ID (prefixed `user_`), username, or `me` for the authenticated user. + +
+
+ +
+
+ +**accountId:** `Optional` — The account whose profile override to update. Required for API key callers. + +
+
+ +
+
+ +**banner:** `Optional` + +
+
+ +
+
+ +**bio:** `Optional` + +
+
+ +
+
+ +**name:** `Optional` + +
+
+ +
+
+ +**profilePicture:** `Optional` + +
+
+ +
+
+ +**username:** `Optional` + +
+
+
+
+ + +
+
+
+ +
client.users.checkAccess(id, resourceId) -> CheckAccessUsersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Checks whether a user has access to an account, product, or experience the caller can reach. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().checkAccess( + "id", + "resource_id", + CheckAccessUsersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The user_ tag or username to check access for. + +
+
+ +
+
+ +**resourceId:** `String` — An account (biz_), product (prod_), or experience (exp_) ID. + +
+
+
+
+ + +
+
+
+ +
client.users.recommendActions(id) -> RecommendActionsUsersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their `account_id`/`account_name`; personal actions leave those `null`. Self-only: `id` must be `me` or the authenticated user's own tag/username. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().recommendActions( + "id", + RecommendActionsUsersRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — `me`, or the authenticated user's own `user_` tag or username. + +
+
+
+
+ + +
+
+
+ +## Verifications +
client.verifications.list() -> ListVerificationsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns verifications for an account, including their status and any required actions. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.verifications().list( + ListVerificationsRequest + .builder() + .accountId("account_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — Account or user ID whose verifications you want to list. Use a `biz_` account ID, or the caller's `user_` ID for personal verifications. + +
+
+ +
+
+ +**order:** `Optional` — Field used to sort returned verifications. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction for returned verifications. + +
+
+
+
+ + +
+
+
+ +
client.verifications.create(request) -> CreateVerificationsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Starts a hosted verification session for an account or user, or returns the active session when one already exists. Any fields you include in the request body are used to prefill the session. Send `documents` (with `document_type`) to instead verify the person from identity documents included in this request — no hosted session involved. Send `share_token` to reuse a verification another Sumsub account has already completed for this person, instead of verifying them again. If the account already has an `approved` verification the request is rejected; unlink it first to start a new one. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.verifications().create( + CreateVerificationsRequest + .builder() + .accountId("account_id") + .body( + CreateVerificationsRequestBody.individual( + CreateVerificationsRequestBodyIndividual + .builder() + .build() + ) + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — Account or user ID whose identity you want to verify. Use a `biz_` account ID for account verifications, or the caller's `user_` ID for personal verification. + +
+
+ +
+
+ +**request:** `CreateVerificationsRequestBody` + +
+
+
+
+ + +
+
+
+ +
client.verifications.retrieve(id) -> RetrieveVerificationsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns verifications for an account, including their status and any required actions. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.verifications().retrieve( + "id", + RetrieveVerificationsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Verification profile ID, prefixed `idpf_`. + +
+
+
+
+ + +
+
+
+ +
client.verifications.update(id, request) -> UpdateVerificationsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates editable profile details or submits answers for items returned in `requested_information`. Once a verification is `approved` its profile details are locked and can no longer be edited. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.verifications().update( + "id", + UpdateVerificationsRequest + .builder() + .body( + UpdateVerificationsRequestBody.of( + UpdateVerificationsRequestBodyPersonalAddress + .builder() + .build() + ) + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Verification profile ID, prefixed `idpf_`. + +
+
+ +
+
+ +**request:** `UpdateVerificationsRequestBody` + +
+
+
+
+ + +
+
+
+ +## Webhooks +
client.webhooks.list() -> SyncPagingIterable&lt;WebhookListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of webhook endpoints configured for an account, ordered by most recently created. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.webhooks().list( + ListWebhooksRequest + .builder() + .accountId("account_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — The unique identifier of the account to list webhooks for. + +
+
+ +
+
+ +**appId:** `Optional` — Only return webhooks attached to this app. Omit to list the account's own webhooks. + +
+
+ +
+
+ +**includeAppWebhooks:** `Optional` — Also return webhooks attached to the account's apps, not just the account's own. Cannot be combined with `app_id`. + +
+
+ +
+
+ +**hasFailures:** `Optional` — Only return webhooks whose endpoint is currently failing — every delivery since the current failure streak began has been rejected. Clears as soon as a delivery succeeds. + +
+
+ +
+
+ +**first:** `Optional` — The number of webhooks to return (default 20, max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns webhooks after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of webhooks to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns webhooks before this position. + +
+
+
+
+ + +
+
+
+ +
client.webhooks.create(request) -> Webhook +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a webhook endpoint that receives event notifications via HTTP POST. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.webhooks().create( + CreateWebhooksRequest + .builder() + .url("https://example.com/hooks") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**apiVersionDate:** `Optional` — The dated API version (Api-Version-Date) to pin this webhook's payloads to. Omit to leave the webhook unpinned, tracking the current payload shape. + +
+
+ +
+
+ +**childResourceEvents:** `Optional` — Whether to send events for child resources. For example, if the webhook is created for an account, enabling this sends events only from its connected accounts. + +
+
+ +
+
+ +**enabled:** `Optional` — Whether or not the webhook is enabled. Defaults to `true`. + +
+
+ +
+
+ +**events:** `Optional>` — The events to send the webhook for, in dot form (for example `payment.succeeded`). + +
+
+ +
+
+ +**resourceId:** `Optional` — The account or app to create the webhook for. Defaults to the current account. + +
+
+ +
+
+ +**url:** `String` — The URL to send the webhook to. + +
+
+
+
+ + +
+
+
+ +
client.webhooks.retrieve(id) -> Webhook +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing webhook. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.webhooks().retrieve( + "id", + RetrieveWebhooksRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Webhook ID, prefixed `hook_`. + +
+
+
+
+ + +
+
+
+ +
client.webhooks.delete(id) -> DeleteWebhooksResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Permanently deletes a webhook endpoint. Returns `true` on success, matching the legacy proxy response. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.webhooks().delete( + "id", + DeleteWebhooksRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Webhook ID, prefixed `hook_`. + +
+
+
+
+ + +
+
+
+ +
client.webhooks.update(id, request) -> Webhook +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.webhooks().update( + "id", + UpdateWebhooksRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Webhook ID, prefixed `hook_`. + +
+
+ +
+
+ +**apiVersionDate:** `Optional` — The dated API version (Api-Version-Date) to pin this webhook's payloads to. Only valid for `v1` webhooks. Omit to leave the current pin unchanged, or pass `null` to unpin and track the current payload shape. + +
+
+ +
+
+ +**childResourceEvents:** `Optional` — Whether or not to send events for child resources. + +
+
+ +
+
+ +**enabled:** `Optional` — Whether or not the webhook is enabled. + +
+
+ +
+
+ +**events:** `Optional>` — The events to send the webhook for, in dot form (for example `payment.succeeded`). + +
+
+ +
+
+ +**url:** `Optional` — The URL to send the webhook to. + +
+
+
+
+ + +
+
+
+ +
client.webhooks.listDeliveries(id) -> SyncPagingIterable&lt;WebhookDelivery&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.webhooks().listDeliveries( + "id", + ListDeliveriesWebhooksRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Webhook ID, prefixed `hook_`. + +
+
+ +
+
+ +**first:** `Optional` — The number of deliveries to return (default 50, max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns deliveries after this position. + +
+
+
+
+ + +
+
+
+ +
client.webhooks.replayDelivery(id, deliveryId, request) -> ReplayDeliveryWebhooksResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original `webhook-id`, so consumers that deduplicate on it can drop events they already processed. Pass `regenerate_id` to re-send under a freshly generated `webhook-id` instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.webhooks().replayDelivery( + "id", + "delivery_id", + ReplayDeliveryWebhooksRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Webhook ID, prefixed `hook_`. + +
+
+ +
+
+ +**deliveryId:** `String` — Delivery ID, prefixed `whdel_`, from the List Deliveries endpoint. + +
+
+ +
+
+ +**regenerateId:** `Optional` — Re-send the delivery under a freshly generated `webhook-id` (in both the envelope and the signed headers) instead of the original one. Defaults to false. Use this when your endpoint deduplicates on `webhook-id` and you want it to process the replay as a new message. + +
+
+
+
+ + +
+
+
+ +
client.webhooks.replay(id, request) -> ReplayWebhooksResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Re-sends the webhook's past deliveries within a time window, optionally limited to specific events or to messages whose most recent delivery attempt failed. Fire and forget: nothing about the replay is stored, and each re-send appears as a new entry in the webhook's delivery log. Each matching message is re-sent once, by default with its original `webhook-id`, so consumers that deduplicate are unaffected; pass `regenerate_ids` to re-send under freshly generated ids instead. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.webhooks().replay( + "id", + ReplayWebhooksRequest + .builder() + .sentAfter("2026-01-01T12:00:00.000Z") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Webhook ID, prefixed `hook_`. + +
+
+ +
+
+ +**events:** `Optional>` — Only replay these event types, in dot form (for example `payment.succeeded`). Omit to include every event. + +
+
+ +
+
+ +**failedOnly:** `Optional` — Only replay messages whose most recent delivery attempt in the window failed. Defaults to false. Best-effort: a message whose attempts span processing batches can still be re-sent — replays keep the original `webhook-id` by default, so consumers that deduplicate are unaffected. + +
+
+ +
+
+ +**regenerateIds:** `Optional` — Re-send each replayed message under a freshly generated `webhook-id` (in both the envelope and the signed headers) instead of its original one. Defaults to false. Use this when your endpoint deduplicates on `webhook-id` and you want it to process the replays as new messages. + +
+
+ +
+
+ +**sentAfter:** `String` — Start of the delivery window to replay, as an ISO 8601 timestamp. Clamped to the 30-day delivery retention. + +
+
+ +
+
+ +**sentBefore:** `Optional` — End of the delivery window to replay, as an ISO 8601 timestamp. Defaults to now. + +
+
+
+
+ + +
+
+
+ +
client.webhooks.test(id, request) -> TestWebhooksResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Sends a sample payload for the given event to the webhook's URL and returns the delivery result. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.webhooks().test( + "id", + TestWebhooksRequest + .builder() + .event("payment.succeeded") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Webhook ID, prefixed `hook_`. + +
+
+ +
+
+ +**event:** `String` — The event to test the webhook for, in dot form (for example `payment.succeeded`). + +
+
+
+
+ + +
+
+
+ +
client.webhooks.deliveriesWebhook(webhookId) -> SyncPagingIterable&lt;DeliveriesWebhookResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + +Required permissions: + - `developer:manage_webhook` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.webhooks().deliveriesWebhook( + "webhook_id", + DeliveriesWebhookRequest + .builder() + .first(42) + .last(42) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**webhookId:** `String` — The unique identifier of the webhook to list deliveries for. + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+
+
+ + +
+
+
+ +## Withdrawals +
client.withdrawals.list() -> SyncPagingIterable&lt;WithdrawalListItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of withdrawals for a company, with optional sorting and date filtering. + +Required permissions: + - `payout:withdrawal:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.withdrawals().list( + ListWithdrawalsRequest + .builder() + .companyId("biz_xxxxxxxxxxxxxx") + .first(42) + .last(42) + .createdBefore(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .createdAfter(OffsetDateTime.parse("2023-12-01T05:00:00Z")) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**companyId:** `String` — The unique identifier of the company to list withdrawals for. + +
+
+ +
+
+ +**direction:** `Optional` + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return withdrawals created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return withdrawals created after this timestamp. + +
+
+
+
+ + +
+
+
+ +
client.withdrawals.create(request) -> Withdrawal +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a withdrawal request for a ledger account + +Required permissions: + - `payout:withdraw_funds` + - `payout:destination:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.withdrawals().create( + CreateWithdrawalsRequest + .builder() + .amount(6.9) + .companyId("biz_xxxxxxxxxxxxxx") + .currency(Currencies.USD) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**acknowledgeBankWarning:** `Optional` — Set to true to continue when the bank could not confirm the account holder's name, or false to be refused in that case so the creator can fix the account or link their bank first. Omitting the argument skips the warning gate — a client that cannot show the warning keeps its pre-gate behavior. + +
+
+ +
+
+ +**amount:** `Double` — The amount to withdraw in the specified currency + +
+
+ +
+
+ +**companyId:** `String` — The ID of the company to withdraw from. + +
+
+ +
+
+ +**currency:** `Currencies` — The currency that is being withdrawn. + +
+
+ +
+
+ +**idempotencyKey:** `Optional` — A client-generated key that makes retries safe. Retrying with the same key returns the original withdrawal instead of creating a second one. + +
+
+ +
+
+ +**payoutMethodId:** `Optional` — The ID of the payout method to use for the withdrawal. + +
+
+ +
+
+ +**platformCoversFees:** `Optional` — Whether the platform covers the payout fees. + +
+
+ +
+
+ +**speed:** `Optional` — The processing speed for the withdrawal. Either standard or instant. + +
+
+ +
+
+ +**statementDescriptor:** `Optional` — Custom statement descriptor for the withdrawal. Must be between 5 and 22 characters and contain only alphanumeric characters. + +
+
+
+
+ + +
+
+
+ +
client.withdrawals.retrieve(id) -> Withdrawal +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of an existing withdrawal. + +Required permissions: + - `payout:withdrawal:read` + - `payout:destination:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.withdrawals().retrieve( + "wdrl_xxxxxxxxxxxxx", + RetrieveWithdrawalsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the withdrawal to retrieve. + +
+
+
+
+ + +
+
+
+ +
client.withdrawals.generatePdf(id) -> GeneratePdfWithdrawalsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Generates a withdrawal PDF invoice and returns a temporary download URL. + +Required permissions: + - `payout:withdrawal:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.withdrawals().generatePdf( + "wdrl_xxxxxxxxxxxxx", + GeneratePdfWithdrawalsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The unique identifier of the withdrawal to generate a PDF for. + +
+
+
+
+ + +
+
+
+ +## Accounts Preferences +
client.accounts.preferences.retrieve(accountId) -> RetrievePreferencesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the account's preferences: a singleton settings document keyed by preference name. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().preferences().retrieve( + "account_id", + RetrievePreferencesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — Account ID, prefixed `biz_`. + +
+
+
+
+ + +
+
+
+ +
client.accounts.preferences.update(accountId, request) -> UpdatePreferencesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. `ads_triple_whale_integration` takes the Data-In API key to connect with, or `null` to disconnect. `ads_payment_methods` always requires a `primary` entry. `backup` is optional and any pairing is allowed — two cards, `card`+`platform_balance`, or a single method — so a card-only advertiser can fund ads without a platform balance. The `primary` and `backup` must be different sources. A `platform_balance` entry may omit `id` to use the account's default Whop balance. Configuring a `card` requires a user token; account API keys can set up platform-balance billing only. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().preferences().update( + "account_id", + UpdatePreferencesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — Account ID, prefixed `biz_`. + +
+
+ +
+
+ +**adsPaymentMethods:** `Optional` — How the account pays for Whop Ads spend. `primary` is charged first; `backup` covers the charge when the primary fails. + +
+
+ +
+
+ +**adsReportingCurrency:** `Optional` — Lowercase ISO currency code, such as `usd` or `eur`, used to display ad spend and stats. Defaults to `usd`. + +
+
+ +
+
+ +**adsSchedulingTimezone:** `Optional` — IANA timezone (e.g. `America/New_York`) used to interpret campaign start/end times and to bucket reports. Cannot be cleared once set — pass a new value to change it. + +
+
+ +
+
+ +**adsTripleWhaleIntegration:** `Optional` — Connects or disconnects the Triple Whale integration. Requires a connected Shopify store, since Triple Whale keys spend records by Shopify shop. + +
+
+ +
+
+ +**cardsAutoTopUp:** `Optional` — Whether incoming funds are automatically moved to the account's cards balance. Requires a cards balance on the account. + +
+
+ +
+
+ +**disputeFighterEnabled:** `Optional` — Whether Whop assembles and files the evidence response when this account's payments are disputed. Off by default; enabling it also opts the account into the success fee charged only on disputes it wins. + +
+
+
+
+ + +
+
+
+ +## Accounts Reserves +
client.accounts.reserves.list(accountId) -> ListReservesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().reserves().list( + "account_id", + ListReservesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `String` — Account ID, prefixed `biz_`. + +
+
+
+
+ + +
+
+
+ +## Affiliates Overrides +
client.affiliates.overrides.list(id) -> SyncPagingIterable&lt;ListOverridesResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of overrides for an affiliate. + +Required permissions: + - `affiliate:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.affiliates().overrides().list( + "aff_xxxxxxxxxxxxxx", + ListOverridesRequest + .builder() + .first(42) + .last(42) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The affiliate ID. + +
+
+ +
+
+ +**after:** `Optional` — Returns the elements in the list that come after the specified cursor. + +
+
+ +
+
+ +**before:** `Optional` — Returns the elements in the list that come before the specified cursor. + +
+
+ +
+
+ +**first:** `Optional` — Returns the first _n_ elements from the list. + +
+
+ +
+
+ +**last:** `Optional` — Returns the last _n_ elements from the list. + +
+
+ +
+
+ +**overrideType:** `Optional` + +
+
+
+
+ + +
+
+
+ +
client.affiliates.overrides.create(id, request) -> CreateOverridesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a commission override for an affiliate. + +Required permissions: + - `affiliate:create` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.affiliates().overrides().create( + "aff_xxxxxxxxxxxxxx", + CreateOverridesRequest + .builder() + .body( + CreateOverridesRequestBody.standard( + CreateOverridesRequestBodyStandard + .builder() + .commissionValue(6.9) + .id("id") + .planId("plan_xxxxxxxxxxxxx") + .build() + ) + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The affiliate ID. + +
+
+ +
+
+ +**request:** `CreateOverridesRequestBody` — Parameters for CreateAffiliateOverride + +
+
+
+
+ + +
+
+
+ +
client.affiliates.overrides.retrieve(id, overrideId) -> RetrieveOverridesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the details of a specific affiliate override. + +Required permissions: + - `affiliate:basic:read` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.affiliates().overrides().retrieve( + "aff_xxxxxxxxxxxxxx", + "override_id", + RetrieveOverridesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The affiliate ID. + +
+
+ +
+
+ +**overrideId:** `String` — The override ID. + +
+
+
+
+ + +
+
+
+ +
client.affiliates.overrides.delete(id, overrideId) -> Boolean +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes an affiliate override. + +Required permissions: + - `affiliate:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.affiliates().overrides().delete( + "aff_xxxxxxxxxxxxxx", + "override_id", + DeleteOverridesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The affiliate ID. + +
+
+ +
+
+ +**overrideId:** `String` — The override ID. + +
+
+
+
+ + +
+
+
+ +
client.affiliates.overrides.update(id, overrideId, request) -> UpdateOverridesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an existing affiliate override. + +Required permissions: + - `affiliate:update` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.affiliates().overrides().update( + "aff_xxxxxxxxxxxxxx", + "override_id", + UpdateOverridesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The affiliate ID. + +
+
+ +
+
+ +**overrideId:** `String` — The override ID. + +
+
+ +
+
+ +**appliesToPayments:** `Optional` — Whether commission applies to first payment or all payments (standard only). + +
+
+ +
+
+ +**commissionType:** `Optional` — The commission type (percentage or flat_fee). + +
+
+ +
+
+ +**commissionValue:** `Optional` — The commission value (percentage 1-100 or flat fee in dollars). + +
+
+ +
+
+ +**revenueBasis:** `Optional` — The revenue calculation basis (rev-share only). + +
+
+
+
+ + +
+
+
+ +## Bounties Submissions +
client.bounties.submissions.list(bountyId) -> SyncPagingIterable&lt;PublicBountySubmission&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns `404`. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.bounties().submissions().list( + "bounty_id", + ListSubmissionsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**bountyId:** `String` — The bounty whose public submissions to list (`bnty_` tag). + +
+
+ +
+
+ +**status:** `Optional` — Filter by lifecycle state. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only submissions created after this ISO 8601 timestamp. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only submissions created before this ISO 8601 timestamp. + +
+
+ +
+
+ +**order:** `Optional` — Sort field. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+ +
+
+ +**first:** `Optional` — Number of submissions to return from the start of the window. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to paginate forwards from. + +
+
+ +
+
+ +**last:** `Optional` — Number of submissions to return from the end of the window. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to paginate backwards from. + +
+
+
+
+ + +
+
+
+ +
client.bounties.submissions.retrieve(bountyId, id) -> PublicBountySubmission +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return `404`. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.bounties().submissions().retrieve( + "bounty_id", + "id", + RetrieveSubmissionsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**bountyId:** `String` — The bounty the submission belongs to (`bnty_` tag). + +
+
+ +
+
+ +**id:** `String` — The submission to retrieve (`btys_` tag). + +
+
+
+
+ + +
+
+
+ +## Members Logs +
client.members.logs.list(id) -> SyncPagingIterable&lt;ListLogsResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists activity for a member and all of their non-drafted memberships, most recent first. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.members().logs().list( + "id", + ListLogsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Member ID (`mber_` tag). + +
+
+ +
+
+ +**first:** `Optional` — Number of log entries to return from the start of the window. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to paginate forwards from. + +
+
+ +
+
+ +**last:** `Optional` — Number of log entries to return from the end of the window. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to paginate backwards from. + +
+
+
+
+ + +
+
+
+ +## Notifications Topics +
client.notifications.topics.list() -> SyncPagingIterable&lt;NotificationTopic&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.notifications().topics().list( + ListTopicsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**topicType:** `Optional` — Only return topics of this scope: `user` (member notifications) or `account_team` (team notifications). + +
+
+ +
+
+ +**first:** `Optional` — The number of topics to return (default 20, max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns topics after this position. + +
+
+
+
+ + +
+
+
+ +## Partners Businesses +
client.partners.businesses.list() -> SyncPagingIterable&lt;ListBusinessesResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the businesses the authenticated user referred onto Whop, most recent first. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.partners().businesses().list( + ListBusinessesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**status:** `Optional` — Filter by referral status. + +
+
+ +
+
+ +**hasEarnings:** `Optional` — When true, only businesses with pending or completed earnings paid to the caller. + +
+
+ +
+
+ +**first:** `Optional` — Number of partner businesses to return from the start of the window. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to fetch the page after (from page_info.end_cursor). + +
+
+ +
+
+ +**last:** `Optional` — Number of partner businesses to return from the end of the window. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to fetch the page before (from page_info.start_cursor). + +
+
+ +
+
+ +**order:** `Optional` — The field to sort partner businesses by. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return partner businesses created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return partner businesses created after this timestamp. + +
+
+ +
+
+ +**referredUserId:** `Optional` — Filter to referrals attributed to this user. For first-tier referrals, this is the referred account owner; for second-tier referrals, this is the partner you recruited. + +
+
+ +
+
+ +**referredUsername:** `Optional` — Filter by the referred user's exact username. Ignored when `referred_user_id` is present. + +
+
+ +
+
+ +**tier:** `Optional` — Filter to only first-tier referrals or only second-tier referrals. + +
+
+
+
+ + +
+
+
+ +
client.partners.businesses.retrieve(id) -> RetrieveBusinessesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a single referred business and its referral terms. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.partners().businesses().retrieve( + "id", + RetrieveBusinessesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The partner business ID (a coma_ identifier). + +
+
+
+
+ + +
+
+
+ +## Partners Businesses Earnings +
client.partners.businesses.earnings.list(id) -> SyncPagingIterable&lt;ListEarningsResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the earnings Whop pays out for one referred business's activity, most recent first. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.partners().businesses().earnings().list( + "id", + ListEarningsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — The partner business ID (a coma_ identifier). + +
+
+ +
+
+ +**status:** `Optional` — Filter by earning status. + +
+
+ +
+
+ +**incomeSource:** `Optional` — Filter to earnings from these income sources. Repeat the parameter for each one (income_source=sales&income_source=ad_spend). + +
+
+ +
+
+ +**first:** `Optional` + +
+
+ +
+
+ +**after:** `Optional` + +
+
+ +
+
+ +**last:** `Optional` + +
+
+ +
+
+ +**before:** `Optional` + +
+
+ +
+
+ +**order:** `Optional` — The field to sort earnings by. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+ +
+
+ +**createdBefore:** `Optional` — Only return earnings created before this timestamp. + +
+
+ +
+
+ +**createdAfter:** `Optional` — Only return earnings created after this timestamp. + +
+
+
+
+ + +
+
+
+ +## Payouts Methods +
client.payouts.methods.list() -> SyncPagingIterable&lt;ListMethodsResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payouts().methods().list( + ListMethodsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The owning account ID (a biz_ identifier). Provide this or user_id. + +
+
+ +
+
+ +**userId:** `Optional` — The owning user ID (a user_ identifier). Provide this or account_id. + +
+
+ +
+
+ +**status:** `Optional` — Optional status filter. `created` means saved but unused, `active` means a payout through it succeeded, `broken` means the last payout failed and the method needs fixing. + +
+
+ +
+
+ +**amount:** `Optional` — Optional withdrawal amount in whole currency units, for example `250.00`. When provided, each method includes a quote with the estimated fee, amount received, and delivery date for that amount. + +
+
+ +
+
+ +**currency:** `Optional` — Currency code of the amount, for example `usd`. Only meaningful with amount or include_limits. + +
+
+ +
+
+ +**includeLimits:** `Optional` — When true, the response also carries limits — the live per-speed payout caps the account's payout requests are validated against, in the requested currency. Requires the payout:withdrawal:read scope. + +
+
+ +
+
+ +**first:** `Optional` — Number of payout methods to return from the start of the window. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to fetch the page after (from page_info.end_cursor). + +
+
+ +
+
+ +**last:** `Optional` — Number of payout methods to return from the end of the window. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to fetch the page before (from page_info.start_cursor). + +
+
+
+
+ + +
+
+
+ +
client.payouts.methods.create(request) -> CreateMethodsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Saves a new place an account or user can withdraw to. Sensitive details are vaulted in transit and never stored raw. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payouts().methods().create( + CreateMethodsRequest + .builder() + .supportedPayoutMethodId("podst_xxxxxxxxxxxxxx") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The account to add the payout method for, prefixed `biz_`. Provide this or `user_id`. + +
+
+ +
+
+ +**destinationCurrency:** `Optional` — Currency the supported payout method delivers payouts in. + +
+
+ +
+
+ +**fields:** `Optional>` — The supported payout method's required field values, keyed by field id — list them with `GET /payouts/supported_methods?supported_payout_method_id=...`. Field ids are stable `fld_` identifiers you may hardcode; they never change for a given field. A Basis Theory token id may be passed in place of a raw value. For a U.S. bank routing-number field, a raw nine-digit value must also pass the ABA checksum. A validation failure returns the method's full required_fields schema alongside the error. Required whenever the account details are supplied directly. + +
+
+ +
+
+ +**isDefault:** `Optional` — Whether to make this the account's default payout method. + +
+
+ +
+
+ +**nickname:** `Optional` — A label for the payout method, unique per destination. + +
+
+ +
+
+ +**supportedPayoutMethodId:** `String` — The supported payout method to save (a podst_ identifier from a previous listing). + +
+
+ +
+
+ +**userId:** `Optional` — The user to add the payout method for, prefixed `user_`. Provide this or `account_id`. + +
+
+
+
+ + +
+
+
+ +
client.payouts.methods.delete(id) -> DeleteMethodsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a saved payout method so it can no longer receive payouts. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payouts().methods().delete( + "id", + DeleteMethodsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Payout method ID, prefixed `potk_`. + +
+
+
+
+ + +
+
+
+ +
client.payouts.methods.update(id, request) -> UpdateMethodsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Changes the label used to identify a saved payout method. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payouts().methods().update( + "id", + UpdateMethodsRequest + .builder() + .nickname("Primary checking") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Payout method ID, prefixed `potk_`. + +
+
+ +
+
+ +**nickname:** `String` — New label for the payout method, with at least one non-whitespace character and a maximum of 100 characters. + +
+
+
+
+ + +
+
+
+ +## Payouts SupportedMethods +
client.payouts.supportedMethods.list() -> SyncPagingIterable&lt;ListSupportedMethodsResponseDataItem&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the payout methods an account or user is eligible to add. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.payouts().supportedMethods().list( + ListSupportedMethodsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — The owning account ID (a biz_ identifier). Provide this or user_id. + +
+
+ +
+
+ +**userId:** `Optional` — The owning user ID (a user_ identifier). Provide this or account_id. + +
+
+ +
+
+ +**country:** `Optional` — ISO 3166-1 alpha-2 country code for the bank account or wallet, such as `US`. Defaults to the country of supported_payout_method_id when one is given, otherwise the payout account's country. + +
+
+ +
+
+ +**amount:** `Optional` — Optional withdrawal amount in whole currency units, for example `250.00`. When provided, each destination includes per-currency fee and delivery quotes. + +
+
+ +
+
+ +**currency:** `Optional` — Currency code of the amount, for example `usd`. Only meaningful with amount. + +
+
+ +
+
+ +**supportedPayoutMethodId:** `Optional` — Narrows the list to one supported payout method (a podst_ identifier) and includes the required_fields needed to save it as a payout method. + +
+
+ +
+
+ +**destinationCurrency:** `Optional` — Currency the supported payout method would deliver payouts in. Only meaningful with supported_payout_method_id; required fields vary by destination currency. + +
+
+ +
+
+ +**first:** `Optional` — Number of supported payout methods to return from the start of the window. + +
+
+ +
+
+ +**after:** `Optional` — Cursor to fetch the page after (from page_info.end_cursor). + +
+
+ +
+
+ +**last:** `Optional` — Number of supported payout methods to return from the end of the window. + +
+
+ +
+
+ +**before:** `Optional` — Cursor to fetch the page before (from page_info.start_cursor). + +
+
+
+
+ + +
+
+
+ +## Users OauthGrants +
client.users.oauthGrants.list() -> SyncPagingIterable&lt;OauthGrant&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().oauthGrants().list( + ListOauthGrantsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**appId:** `Optional` — Only return grants for this app, prefixed `app_`. An app the user has never authorized returns an empty list. + +
+
+ +
+
+ +**first:** `Optional` — The number of grants to return (default 20, max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns grants after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of grants to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns grants before this position. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort grants by. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+
+
+ + +
+
+
+ +
client.users.oauthGrants.create(request) -> OauthGrant +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Completes the OAuth authorization step for the authenticated user: records their consent for the scopes an app asked for and mints the authorization code to hand back to it. Returns the grant, plus a `redirect_url` carrying that code — the one and only time it is returned. Exchange the code at `POST /oauth/token` with the verifier for `code_challenge`. Requires a user session, because consent has to come from the account holder: an API key or an OAuth token is refused, so an app can never authorize itself. Send an `Idempotency-Key` to make a retry safe — a replay returns the original `redirect_url` and its code rather than issuing a second one. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().oauthGrants().create( + CreateOauthGrantsRequest + .builder() + .clientId("app_xxxxxxxxxxxxxx") + .codeChallenge("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") + .codeChallengeMethod(CreateOauthGrantsRequestCodeChallengeMethod.S256) + .redirectUri("https://Booking.Shinetime.example:8443/oauth/Callback/") + .requestedScopes( + Arrays.asList("profile") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountId:** `Optional` — Authorize the app for one of the user's accounts rather than for the user alone, prefixed `biz_`. The user must have access to it. + +
+
+ +
+
+ +**clientId:** `String` — The app being authorized, prefixed `app_`. + +
+
+ +
+
+ +**codeChallenge:** `String` — The PKCE code challenge: the base64url-encoded SHA-256 of your code verifier, without padding. + +
+
+ +
+
+ +**codeChallengeMethod:** `CreateOauthGrantsRequestCodeChallengeMethod` — How `code_challenge` was derived. Only `S256` is accepted. + +
+
+ +
+
+ +**consentShown:** `Optional` — Whether the consent UI listed these scopes for the user. Sending `false` succeeds only when the user has already granted every scope requested. + +
+
+ +
+
+ +**nonce:** `Optional` — OIDC nonce, echoed into the resulting ID token. Required when `requested_scopes` includes `openid`. + +
+
+ +
+
+ +**redirectUri:** `String` — Where to send the user once they have consented. Must match one of the app's registered redirect URIs exactly — it is compared as a string, not normalized. + +
+
+ +
+
+ +**requestedScopes:** `List` — The permissions the app is asking for, for example `member:basic:read`. `GET /api_keys/permissions` names and describes each one. Granting adds to whatever the user already granted this app rather than replacing it. + +
+
+ +
+
+ +**responseType:** `Optional` — The OAuth response type. Only `code` is accepted; defaults to `code`. + +
+
+ +
+
+ +**state:** `Optional` — Opaque value appended to `redirect_url` unchanged, for the client to correlate the response with its request. + +
+
+
+
+ + +
+
+
+ +## Users Passkeys +
client.users.passkeys.list() -> SyncPagingIterable&lt;Passkey&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().passkeys().list( + ListPasskeysRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**first:** `Optional` — The number of passkeys to return (default 20, max 100). + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns passkeys after this position. + +
+
+ +
+
+ +**last:** `Optional` — The number of passkeys to return from the end of the range. + +
+
+ +
+
+ +**before:** `Optional` — A cursor; returns passkeys before this position. + +
+
+ +
+
+ +**order:** `Optional` — The field to sort passkeys by. + +
+
+ +
+
+ +**direction:** `Optional` — Sort direction. + +
+
+
+
+ + +
+
+
+ +
client.users.passkeys.create(request) -> Passkey +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Registers a passkey for the authenticated user from the attestation a browser produced for a `registration` challenge. Mint that challenge first with `POST /users/me/passkeys/challenge`; it is single-use and expires 5 minutes after it is issued. Requires a user session. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().passkeys().create( + CreatePasskeysRequest + .builder() + .attestationObject("YXR0ZXN0YXRpb24") + .clientDataJson("Y2xpZW50LWRhdGE") + .credentialId("bmV3LWNyZWRlbnRpYWw") + .nickname("Work laptop") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**attestationObject:** `String` — The `attestationObject` from the WebAuthn attestation response, base64url-encoded. + +
+
+ +
+
+ +**clientDataJson:** `String` — The `clientDataJSON` from the WebAuthn attestation response, base64url-encoded. + +
+
+ +
+
+ +**credentialId:** `String` — The WebAuthn credential ID the authenticator returned, base64url-encoded. + +
+
+ +
+
+ +**nickname:** `String` — A name for this passkey, usually the device it lives on. 255 characters or fewer. + +
+
+
+
+ + +
+
+
+ +
client.users.passkeys.challenge(request) -> ChallengePasskeysResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Mints the challenge a browser needs to run a WebAuthn ceremony against the authenticated user's own passkeys. A `registration` challenge enrolls a new passkey; a `deletion` challenge is bound to the one passkey named by `passkey_id` and proves the user still holds it. Challenges are single-use and expire 5 minutes after they are issued, so send a fresh `Idempotency-Key` per ceremony — a replayed key returns the original challenge, which may already have expired. Requires a user session. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().passkeys().challenge( + ChallengePasskeysRequest + .builder() + .challengeType(ChallengePasskeysRequestChallengeType.REGISTRATION) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**challengeType:** `ChallengePasskeysRequestChallengeType` — The ceremony this challenge is for. + +
+
+ +
+
+ +**passkeyId:** `Optional` — The passkey the ceremony targets, prefixed `wcred_`. Required when `challenge_type` is `deletion`, ignored otherwise. + +
+
+
+
+ + +
+
+
+ +
client.users.passkeys.delete(id, request) -> DeletePasskeysResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes one of the authenticated user's own passkeys. The request body carries a WebAuthn assertion from the passkey being deleted, so possession of the credential is proven before it is removed: mint a `deletion` challenge for it first, run the ceremony with that passkey, and send the result here. Deleting the user's last passkey is allowed — their other step-up factors remain. Requires a user session. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().passkeys().delete( + "id", + DeletePasskeysRequest + .builder() + .authenticatorData("YXV0aGVudGljYXRvci1kYXRh") + .clientDataJson("Y2xpZW50LWRhdGE") + .signature("c2lnbmF0dXJl") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `String` — Passkey ID, prefixed `wcred_`. + +
+
+ +
+
+ +**authenticatorData:** `String` — The `authenticatorData` from the WebAuthn assertion, base64url-encoded. + +
+
+ +
+
+ +**clientDataJson:** `String` — The `clientDataJSON` from the WebAuthn assertion, base64url-encoded. + +
+
+ +
+
+ +**signature:** `String` — The `signature` from the WebAuthn assertion, base64url-encoded. + +
+
+
+
+ + +
+
+
+ +## Users Preferences +
client.users.preferences.retrieve() -> UserPreferences +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the authenticated user's settings document. Addressed only as `me` — the document always belongs to the session user. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().preferences().retrieve(); +``` +
+
+
+
+ + +
+
+
+ +
client.users.preferences.update(request) -> UserPreferences +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().preferences().update( + UpdatePreferencesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**bountyWorkerOnboardingDismissed:** `Optional` — Whether the user has dismissed the first-time bounty worker onboarding. Set to `false` to show it again. + +
+
+ +
+
+ +**investigationEnabled:** `Optional` — Whether investigation mode is enabled for the user. Only meaningful for staff users with investigation access. + +
+
+ +
+
+ +**termsAccepted:** `Optional` — Records the user's acceptance of Whop's terms and policies. Only `true` is accepted — the server stamps `terms_accepted_at` and acceptance cannot be withdrawn here. + +
+
+
+
+ + +
+
+
+ +## Users Preferences Notifications +
client.users.preferences.notifications.set(request) -> SetNotificationsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Sets the authenticated user's notification preferences. Each preference is addressed by `scope`, not by id, so a scope read back from either list endpoint can be sent straight here. + +A scope naming an experience with no topic sets that experience's level, and accepts all three levels. Any other scope sets a topic override, which is binary — `all` or `nothing` — and requires a `channel`. + +`level: null` clears the preference. Preferences are stored as overrides, so clearing one means the scope inherits its default again rather than being switched off. + +The batch is applied in one transaction: if any entry is rejected, none are written. Experience levels are applied before topic overrides, because setting a level replaces every topic preference for that experience — so an override sent alongside a level wins. The response reports what each scope now resolves to, in the order the entries were sent. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().preferences().notifications().set( + SetNotificationsRequest + .builder() + .preferences( + Arrays.asList( + SetNotificationsRequestPreferencesItem + .builder() + .level( + Nullable.ofNull() + ) + .scope( + SetNotificationsRequestPreferencesItemScope + .builder() + .build() + ) + .build() + ) + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**preferences:** `List` — The preferences to set, at most 100 per request. + +
+
+
+
+ + +
+
+
+ +## Users Preferences Notifications Experiences +
client.users.preferences.notifications.experiences.list() -> SyncPagingIterable&lt;ExperienceNotificationPreference&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is `all`. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().preferences().notifications().experiences().list( + ListExperiencesRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**first:** `Optional` — The number of preferences to return. + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns preferences after this position. + +
+
+
+
+ + +
+
+
+ +## Users Preferences Notifications Topics +
client.users.preferences.notifications.topics.list() -> SyncPagingIterable&lt;UserNotificationPreference&gt; +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by `GET /users/me/preferences/notifications/experiences`. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.users().preferences().notifications().topics().list( + ListTopicsRequest + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**channel:** `Optional` — Only return preferences for this delivery channel (or not narrowed to a channel). + +
+
+ +
+
+ +**accountId:** `Optional` — Only return preferences scoped to this account's member notifications (`biz_` tag). + +
+
+ +
+
+ +**teamAccountId:** `Optional` — Only return preferences scoped to this account's team notifications (`biz_` tag). + +
+
+ +
+
+ +**experienceId:** `Optional` — Only return preferences scoped to this experience (`exp_` tag). + +
+
+ +
+
+ +**topicId:** `Optional` — Only return preferences scoped to this notification topic (`topic_` tag). + +
+
+ +
+
+ +**first:** `Optional` — The number of preferences to return. + +
+
+ +
+
+ +**after:** `Optional` — A cursor; returns preferences after this position. + +
+
+
+
+ + +
+
+
+ diff --git a/sample-app/build.gradle b/sample-app/build.gradle new file mode 100644 index 00000000..4ee8f227 --- /dev/null +++ b/sample-app/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java-library' +} + +repositories { + mavenCentral() + maven { + url 'https://s01.oss.sonatype.org/content/repositories/releases/' + } +} + +dependencies { + implementation rootProject +} + + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + diff --git a/sample-app/src/main/java/sample/App.java b/sample-app/src/main/java/sample/App.java new file mode 100644 index 00000000..06f652ed --- /dev/null +++ b/sample-app/src/main/java/sample/App.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +package sample; + +import java.lang.String; + +public final class App { + public static void main(String[] args) { + // import com.whop.api.AsyncWhopApiClient + } +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..aed36fec --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include 'sample-app' \ No newline at end of file diff --git a/src/main/java/com/whop/api/AsyncWhopApiClient.java b/src/main/java/com/whop/api/AsyncWhopApiClient.java new file mode 100644 index 00000000..67b012c0 --- /dev/null +++ b/src/main/java/com/whop/api/AsyncWhopApiClient.java @@ -0,0 +1,671 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.resources.accesstokens.AsyncAccessTokensClient; +import com.whop.api.resources.accountlinks.AsyncAccountLinksClient; +import com.whop.api.resources.accounts.AsyncAccountsClient; +import com.whop.api.resources.adcampaigns.AsyncAdCampaignsClient; +import com.whop.api.resources.adgroups.AsyncAdGroupsClient; +import com.whop.api.resources.adreports.AsyncAdReportsClient; +import com.whop.api.resources.ads.AsyncAdsClient; +import com.whop.api.resources.affiliates.AsyncAffiliatesClient; +import com.whop.api.resources.aichats.AsyncAiChatsClient; +import com.whop.api.resources.apikeys.AsyncApiKeysClient; +import com.whop.api.resources.appbuilds.AsyncAppBuildsClient; +import com.whop.api.resources.apps.AsyncAppsClient; +import com.whop.api.resources.audiences.AsyncAudiencesClient; +import com.whop.api.resources.authorizedusers.AsyncAuthorizedUsersClient; +import com.whop.api.resources.bounties.AsyncBountiesClient; +import com.whop.api.resources.bountysubmissions.AsyncBountySubmissionsClient; +import com.whop.api.resources.cards.AsyncCardsClient; +import com.whop.api.resources.cardtransactions.AsyncCardTransactionsClient; +import com.whop.api.resources.chatchannels.AsyncChatChannelsClient; +import com.whop.api.resources.checkoutconfigurations.AsyncCheckoutConfigurationsClient; +import com.whop.api.resources.companies.AsyncCompaniesClient; +import com.whop.api.resources.companytokentransactions.AsyncCompanyTokenTransactionsClient; +import com.whop.api.resources.coursechapters.AsyncCourseChaptersClient; +import com.whop.api.resources.courselessoninteractions.AsyncCourseLessonInteractionsClient; +import com.whop.api.resources.courselessons.AsyncCourseLessonsClient; +import com.whop.api.resources.courses.AsyncCoursesClient; +import com.whop.api.resources.coursestudents.AsyncCourseStudentsClient; +import com.whop.api.resources.deposits.AsyncDepositsClient; +import com.whop.api.resources.disputealerts.AsyncDisputeAlertsClient; +import com.whop.api.resources.disputes.AsyncDisputesClient; +import com.whop.api.resources.dmchannels.AsyncDmChannelsClient; +import com.whop.api.resources.dmmembers.AsyncDmMembersClient; +import com.whop.api.resources.entries.AsyncEntriesClient; +import com.whop.api.resources.events.AsyncEventsClient; +import com.whop.api.resources.experiences.AsyncExperiencesClient; +import com.whop.api.resources.exports.AsyncExportsClient; +import com.whop.api.resources.feemarkups.AsyncFeeMarkupsClient; +import com.whop.api.resources.files.AsyncFilesClient; +import com.whop.api.resources.financialactivity.AsyncFinancialActivityClient; +import com.whop.api.resources.forumposts.AsyncForumPostsClient; +import com.whop.api.resources.forums.AsyncForumsClient; +import com.whop.api.resources.identityprofiles.AsyncIdentityProfilesClient; +import com.whop.api.resources.invoices.AsyncInvoicesClient; +import com.whop.api.resources.leads.AsyncLeadsClient; +import com.whop.api.resources.ledgeraccounts.AsyncLedgerAccountsClient; +import com.whop.api.resources.ledgers.AsyncLedgersClient; +import com.whop.api.resources.media.AsyncMediaClient; +import com.whop.api.resources.members.AsyncMembersClient; +import com.whop.api.resources.memberships.AsyncMembershipsClient; +import com.whop.api.resources.messages.AsyncMessagesClient; +import com.whop.api.resources.notifications.AsyncNotificationsClient; +import com.whop.api.resources.partners.AsyncPartnersClient; +import com.whop.api.resources.paymentmethoddomains.AsyncPaymentMethodDomainsClient; +import com.whop.api.resources.paymentmethods.AsyncPaymentMethodsClient; +import com.whop.api.resources.payments.AsyncPaymentsClient; +import com.whop.api.resources.payoutaccounts.AsyncPayoutAccountsClient; +import com.whop.api.resources.payoutmethods.AsyncPayoutMethodsClient; +import com.whop.api.resources.payouts.AsyncPayoutsClient; +import com.whop.api.resources.people.AsyncPeopleClient; +import com.whop.api.resources.permissions.AsyncPermissionsClient; +import com.whop.api.resources.plans.AsyncPlansClient; +import com.whop.api.resources.products.AsyncProductsClient; +import com.whop.api.resources.promocodes.AsyncPromoCodesClient; +import com.whop.api.resources.reactions.AsyncReactionsClient; +import com.whop.api.resources.recommendedactions.AsyncRecommendedActionsClient; +import com.whop.api.resources.refunds.AsyncRefundsClient; +import com.whop.api.resources.resolutioncentercases.AsyncResolutionCenterCasesClient; +import com.whop.api.resources.reviews.AsyncReviewsClient; +import com.whop.api.resources.setupintents.AsyncSetupIntentsClient; +import com.whop.api.resources.shipments.AsyncShipmentsClient; +import com.whop.api.resources.socialaccounts.AsyncSocialAccountsClient; +import com.whop.api.resources.stats.AsyncStatsClient; +import com.whop.api.resources.supportchannels.AsyncSupportChannelsClient; +import com.whop.api.resources.swaps.AsyncSwapsClient; +import com.whop.api.resources.teammembers.AsyncTeamMembersClient; +import com.whop.api.resources.topups.AsyncTopupsClient; +import com.whop.api.resources.transfers.AsyncTransfersClient; +import com.whop.api.resources.users.AsyncUsersClient; +import com.whop.api.resources.verifications.AsyncVerificationsClient; +import com.whop.api.resources.webhooks.AsyncWebhooksClient; +import com.whop.api.resources.withdrawals.AsyncWithdrawalsClient; +import java.util.function.Supplier; + +public class AsyncWhopApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier accessTokensClient; + + protected final Supplier accountLinksClient; + + protected final Supplier accountsClient; + + protected final Supplier adCampaignsClient; + + protected final Supplier adGroupsClient; + + protected final Supplier adReportsClient; + + protected final Supplier adsClient; + + protected final Supplier affiliatesClient; + + protected final Supplier aiChatsClient; + + protected final Supplier apiKeysClient; + + protected final Supplier appBuildsClient; + + protected final Supplier appsClient; + + protected final Supplier audiencesClient; + + protected final Supplier authorizedUsersClient; + + protected final Supplier bountiesClient; + + protected final Supplier bountySubmissionsClient; + + protected final Supplier cardTransactionsClient; + + protected final Supplier cardsClient; + + protected final Supplier chatChannelsClient; + + protected final Supplier checkoutConfigurationsClient; + + protected final Supplier companiesClient; + + protected final Supplier companyTokenTransactionsClient; + + protected final Supplier courseChaptersClient; + + protected final Supplier courseLessonInteractionsClient; + + protected final Supplier courseLessonsClient; + + protected final Supplier courseStudentsClient; + + protected final Supplier coursesClient; + + protected final Supplier depositsClient; + + protected final Supplier disputeAlertsClient; + + protected final Supplier disputesClient; + + protected final Supplier dmChannelsClient; + + protected final Supplier dmMembersClient; + + protected final Supplier entriesClient; + + protected final Supplier eventsClient; + + protected final Supplier experiencesClient; + + protected final Supplier exportsClient; + + protected final Supplier feeMarkupsClient; + + protected final Supplier filesClient; + + protected final Supplier financialActivityClient; + + protected final Supplier ledgersClient; + + protected final Supplier forumPostsClient; + + protected final Supplier forumsClient; + + protected final Supplier identityProfilesClient; + + protected final Supplier invoicesClient; + + protected final Supplier leadsClient; + + protected final Supplier ledgerAccountsClient; + + protected final Supplier mediaClient; + + protected final Supplier membersClient; + + protected final Supplier membershipsClient; + + protected final Supplier messagesClient; + + protected final Supplier notificationsClient; + + protected final Supplier partnersClient; + + protected final Supplier paymentMethodDomainsClient; + + protected final Supplier paymentMethodsClient; + + protected final Supplier paymentsClient; + + protected final Supplier payoutAccountsClient; + + protected final Supplier payoutMethodsClient; + + protected final Supplier payoutsClient; + + protected final Supplier peopleClient; + + protected final Supplier permissionsClient; + + protected final Supplier plansClient; + + protected final Supplier productsClient; + + protected final Supplier promoCodesClient; + + protected final Supplier reactionsClient; + + protected final Supplier recommendedActionsClient; + + protected final Supplier refundsClient; + + protected final Supplier resolutionCenterCasesClient; + + protected final Supplier reviewsClient; + + protected final Supplier setupIntentsClient; + + protected final Supplier shipmentsClient; + + protected final Supplier socialAccountsClient; + + protected final Supplier statsClient; + + protected final Supplier supportChannelsClient; + + protected final Supplier swapsClient; + + protected final Supplier teamMembersClient; + + protected final Supplier topupsClient; + + protected final Supplier transfersClient; + + protected final Supplier usersClient; + + protected final Supplier verificationsClient; + + protected final Supplier webhooksClient; + + protected final Supplier withdrawalsClient; + + public AsyncWhopApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.accessTokensClient = Suppliers.memoize(() -> new AsyncAccessTokensClient(clientOptions)); + this.accountLinksClient = Suppliers.memoize(() -> new AsyncAccountLinksClient(clientOptions)); + this.accountsClient = Suppliers.memoize(() -> new AsyncAccountsClient(clientOptions)); + this.adCampaignsClient = Suppliers.memoize(() -> new AsyncAdCampaignsClient(clientOptions)); + this.adGroupsClient = Suppliers.memoize(() -> new AsyncAdGroupsClient(clientOptions)); + this.adReportsClient = Suppliers.memoize(() -> new AsyncAdReportsClient(clientOptions)); + this.adsClient = Suppliers.memoize(() -> new AsyncAdsClient(clientOptions)); + this.affiliatesClient = Suppliers.memoize(() -> new AsyncAffiliatesClient(clientOptions)); + this.aiChatsClient = Suppliers.memoize(() -> new AsyncAiChatsClient(clientOptions)); + this.apiKeysClient = Suppliers.memoize(() -> new AsyncApiKeysClient(clientOptions)); + this.appBuildsClient = Suppliers.memoize(() -> new AsyncAppBuildsClient(clientOptions)); + this.appsClient = Suppliers.memoize(() -> new AsyncAppsClient(clientOptions)); + this.audiencesClient = Suppliers.memoize(() -> new AsyncAudiencesClient(clientOptions)); + this.authorizedUsersClient = Suppliers.memoize(() -> new AsyncAuthorizedUsersClient(clientOptions)); + this.bountiesClient = Suppliers.memoize(() -> new AsyncBountiesClient(clientOptions)); + this.bountySubmissionsClient = Suppliers.memoize(() -> new AsyncBountySubmissionsClient(clientOptions)); + this.cardTransactionsClient = Suppliers.memoize(() -> new AsyncCardTransactionsClient(clientOptions)); + this.cardsClient = Suppliers.memoize(() -> new AsyncCardsClient(clientOptions)); + this.chatChannelsClient = Suppliers.memoize(() -> new AsyncChatChannelsClient(clientOptions)); + this.checkoutConfigurationsClient = + Suppliers.memoize(() -> new AsyncCheckoutConfigurationsClient(clientOptions)); + this.companiesClient = Suppliers.memoize(() -> new AsyncCompaniesClient(clientOptions)); + this.companyTokenTransactionsClient = + Suppliers.memoize(() -> new AsyncCompanyTokenTransactionsClient(clientOptions)); + this.courseChaptersClient = Suppliers.memoize(() -> new AsyncCourseChaptersClient(clientOptions)); + this.courseLessonInteractionsClient = + Suppliers.memoize(() -> new AsyncCourseLessonInteractionsClient(clientOptions)); + this.courseLessonsClient = Suppliers.memoize(() -> new AsyncCourseLessonsClient(clientOptions)); + this.courseStudentsClient = Suppliers.memoize(() -> new AsyncCourseStudentsClient(clientOptions)); + this.coursesClient = Suppliers.memoize(() -> new AsyncCoursesClient(clientOptions)); + this.depositsClient = Suppliers.memoize(() -> new AsyncDepositsClient(clientOptions)); + this.disputeAlertsClient = Suppliers.memoize(() -> new AsyncDisputeAlertsClient(clientOptions)); + this.disputesClient = Suppliers.memoize(() -> new AsyncDisputesClient(clientOptions)); + this.dmChannelsClient = Suppliers.memoize(() -> new AsyncDmChannelsClient(clientOptions)); + this.dmMembersClient = Suppliers.memoize(() -> new AsyncDmMembersClient(clientOptions)); + this.entriesClient = Suppliers.memoize(() -> new AsyncEntriesClient(clientOptions)); + this.eventsClient = Suppliers.memoize(() -> new AsyncEventsClient(clientOptions)); + this.experiencesClient = Suppliers.memoize(() -> new AsyncExperiencesClient(clientOptions)); + this.exportsClient = Suppliers.memoize(() -> new AsyncExportsClient(clientOptions)); + this.feeMarkupsClient = Suppliers.memoize(() -> new AsyncFeeMarkupsClient(clientOptions)); + this.filesClient = Suppliers.memoize(() -> new AsyncFilesClient(clientOptions)); + this.financialActivityClient = Suppliers.memoize(() -> new AsyncFinancialActivityClient(clientOptions)); + this.ledgersClient = Suppliers.memoize(() -> new AsyncLedgersClient(clientOptions)); + this.forumPostsClient = Suppliers.memoize(() -> new AsyncForumPostsClient(clientOptions)); + this.forumsClient = Suppliers.memoize(() -> new AsyncForumsClient(clientOptions)); + this.identityProfilesClient = Suppliers.memoize(() -> new AsyncIdentityProfilesClient(clientOptions)); + this.invoicesClient = Suppliers.memoize(() -> new AsyncInvoicesClient(clientOptions)); + this.leadsClient = Suppliers.memoize(() -> new AsyncLeadsClient(clientOptions)); + this.ledgerAccountsClient = Suppliers.memoize(() -> new AsyncLedgerAccountsClient(clientOptions)); + this.mediaClient = Suppliers.memoize(() -> new AsyncMediaClient(clientOptions)); + this.membersClient = Suppliers.memoize(() -> new AsyncMembersClient(clientOptions)); + this.membershipsClient = Suppliers.memoize(() -> new AsyncMembershipsClient(clientOptions)); + this.messagesClient = Suppliers.memoize(() -> new AsyncMessagesClient(clientOptions)); + this.notificationsClient = Suppliers.memoize(() -> new AsyncNotificationsClient(clientOptions)); + this.partnersClient = Suppliers.memoize(() -> new AsyncPartnersClient(clientOptions)); + this.paymentMethodDomainsClient = Suppliers.memoize(() -> new AsyncPaymentMethodDomainsClient(clientOptions)); + this.paymentMethodsClient = Suppliers.memoize(() -> new AsyncPaymentMethodsClient(clientOptions)); + this.paymentsClient = Suppliers.memoize(() -> new AsyncPaymentsClient(clientOptions)); + this.payoutAccountsClient = Suppliers.memoize(() -> new AsyncPayoutAccountsClient(clientOptions)); + this.payoutMethodsClient = Suppliers.memoize(() -> new AsyncPayoutMethodsClient(clientOptions)); + this.payoutsClient = Suppliers.memoize(() -> new AsyncPayoutsClient(clientOptions)); + this.peopleClient = Suppliers.memoize(() -> new AsyncPeopleClient(clientOptions)); + this.permissionsClient = Suppliers.memoize(() -> new AsyncPermissionsClient(clientOptions)); + this.plansClient = Suppliers.memoize(() -> new AsyncPlansClient(clientOptions)); + this.productsClient = Suppliers.memoize(() -> new AsyncProductsClient(clientOptions)); + this.promoCodesClient = Suppliers.memoize(() -> new AsyncPromoCodesClient(clientOptions)); + this.reactionsClient = Suppliers.memoize(() -> new AsyncReactionsClient(clientOptions)); + this.recommendedActionsClient = Suppliers.memoize(() -> new AsyncRecommendedActionsClient(clientOptions)); + this.refundsClient = Suppliers.memoize(() -> new AsyncRefundsClient(clientOptions)); + this.resolutionCenterCasesClient = Suppliers.memoize(() -> new AsyncResolutionCenterCasesClient(clientOptions)); + this.reviewsClient = Suppliers.memoize(() -> new AsyncReviewsClient(clientOptions)); + this.setupIntentsClient = Suppliers.memoize(() -> new AsyncSetupIntentsClient(clientOptions)); + this.shipmentsClient = Suppliers.memoize(() -> new AsyncShipmentsClient(clientOptions)); + this.socialAccountsClient = Suppliers.memoize(() -> new AsyncSocialAccountsClient(clientOptions)); + this.statsClient = Suppliers.memoize(() -> new AsyncStatsClient(clientOptions)); + this.supportChannelsClient = Suppliers.memoize(() -> new AsyncSupportChannelsClient(clientOptions)); + this.swapsClient = Suppliers.memoize(() -> new AsyncSwapsClient(clientOptions)); + this.teamMembersClient = Suppliers.memoize(() -> new AsyncTeamMembersClient(clientOptions)); + this.topupsClient = Suppliers.memoize(() -> new AsyncTopupsClient(clientOptions)); + this.transfersClient = Suppliers.memoize(() -> new AsyncTransfersClient(clientOptions)); + this.usersClient = Suppliers.memoize(() -> new AsyncUsersClient(clientOptions)); + this.verificationsClient = Suppliers.memoize(() -> new AsyncVerificationsClient(clientOptions)); + this.webhooksClient = Suppliers.memoize(() -> new AsyncWebhooksClient(clientOptions)); + this.withdrawalsClient = Suppliers.memoize(() -> new AsyncWithdrawalsClient(clientOptions)); + } + + public AsyncAccessTokensClient accessTokens() { + return this.accessTokensClient.get(); + } + + public AsyncAccountLinksClient accountLinks() { + return this.accountLinksClient.get(); + } + + public AsyncAccountsClient accounts() { + return this.accountsClient.get(); + } + + public AsyncAdCampaignsClient adCampaigns() { + return this.adCampaignsClient.get(); + } + + public AsyncAdGroupsClient adGroups() { + return this.adGroupsClient.get(); + } + + public AsyncAdReportsClient adReports() { + return this.adReportsClient.get(); + } + + public AsyncAdsClient ads() { + return this.adsClient.get(); + } + + public AsyncAffiliatesClient affiliates() { + return this.affiliatesClient.get(); + } + + public AsyncAiChatsClient aiChats() { + return this.aiChatsClient.get(); + } + + public AsyncApiKeysClient apiKeys() { + return this.apiKeysClient.get(); + } + + public AsyncAppBuildsClient appBuilds() { + return this.appBuildsClient.get(); + } + + public AsyncAppsClient apps() { + return this.appsClient.get(); + } + + public AsyncAudiencesClient audiences() { + return this.audiencesClient.get(); + } + + public AsyncAuthorizedUsersClient authorizedUsers() { + return this.authorizedUsersClient.get(); + } + + public AsyncBountiesClient bounties() { + return this.bountiesClient.get(); + } + + public AsyncBountySubmissionsClient bountySubmissions() { + return this.bountySubmissionsClient.get(); + } + + public AsyncCardTransactionsClient cardTransactions() { + return this.cardTransactionsClient.get(); + } + + public AsyncCardsClient cards() { + return this.cardsClient.get(); + } + + public AsyncChatChannelsClient chatChannels() { + return this.chatChannelsClient.get(); + } + + public AsyncCheckoutConfigurationsClient checkoutConfigurations() { + return this.checkoutConfigurationsClient.get(); + } + + public AsyncCompaniesClient companies() { + return this.companiesClient.get(); + } + + public AsyncCompanyTokenTransactionsClient companyTokenTransactions() { + return this.companyTokenTransactionsClient.get(); + } + + public AsyncCourseChaptersClient courseChapters() { + return this.courseChaptersClient.get(); + } + + public AsyncCourseLessonInteractionsClient courseLessonInteractions() { + return this.courseLessonInteractionsClient.get(); + } + + public AsyncCourseLessonsClient courseLessons() { + return this.courseLessonsClient.get(); + } + + public AsyncCourseStudentsClient courseStudents() { + return this.courseStudentsClient.get(); + } + + public AsyncCoursesClient courses() { + return this.coursesClient.get(); + } + + public AsyncDepositsClient deposits() { + return this.depositsClient.get(); + } + + public AsyncDisputeAlertsClient disputeAlerts() { + return this.disputeAlertsClient.get(); + } + + public AsyncDisputesClient disputes() { + return this.disputesClient.get(); + } + + public AsyncDmChannelsClient dmChannels() { + return this.dmChannelsClient.get(); + } + + public AsyncDmMembersClient dmMembers() { + return this.dmMembersClient.get(); + } + + public AsyncEntriesClient entries() { + return this.entriesClient.get(); + } + + public AsyncEventsClient events() { + return this.eventsClient.get(); + } + + public AsyncExperiencesClient experiences() { + return this.experiencesClient.get(); + } + + public AsyncExportsClient exports() { + return this.exportsClient.get(); + } + + public AsyncFeeMarkupsClient feeMarkups() { + return this.feeMarkupsClient.get(); + } + + public AsyncFilesClient files() { + return this.filesClient.get(); + } + + public AsyncFinancialActivityClient financialActivity() { + return this.financialActivityClient.get(); + } + + public AsyncLedgersClient ledgers() { + return this.ledgersClient.get(); + } + + public AsyncForumPostsClient forumPosts() { + return this.forumPostsClient.get(); + } + + public AsyncForumsClient forums() { + return this.forumsClient.get(); + } + + public AsyncIdentityProfilesClient identityProfiles() { + return this.identityProfilesClient.get(); + } + + public AsyncInvoicesClient invoices() { + return this.invoicesClient.get(); + } + + public AsyncLeadsClient leads() { + return this.leadsClient.get(); + } + + public AsyncLedgerAccountsClient ledgerAccounts() { + return this.ledgerAccountsClient.get(); + } + + public AsyncMediaClient media() { + return this.mediaClient.get(); + } + + public AsyncMembersClient members() { + return this.membersClient.get(); + } + + public AsyncMembershipsClient memberships() { + return this.membershipsClient.get(); + } + + public AsyncMessagesClient messages() { + return this.messagesClient.get(); + } + + public AsyncNotificationsClient notifications() { + return this.notificationsClient.get(); + } + + public AsyncPartnersClient partners() { + return this.partnersClient.get(); + } + + public AsyncPaymentMethodDomainsClient paymentMethodDomains() { + return this.paymentMethodDomainsClient.get(); + } + + public AsyncPaymentMethodsClient paymentMethods() { + return this.paymentMethodsClient.get(); + } + + public AsyncPaymentsClient payments() { + return this.paymentsClient.get(); + } + + public AsyncPayoutAccountsClient payoutAccounts() { + return this.payoutAccountsClient.get(); + } + + public AsyncPayoutMethodsClient payoutMethods() { + return this.payoutMethodsClient.get(); + } + + public AsyncPayoutsClient payouts() { + return this.payoutsClient.get(); + } + + public AsyncPeopleClient people() { + return this.peopleClient.get(); + } + + public AsyncPermissionsClient permissions() { + return this.permissionsClient.get(); + } + + public AsyncPlansClient plans() { + return this.plansClient.get(); + } + + public AsyncProductsClient products() { + return this.productsClient.get(); + } + + public AsyncPromoCodesClient promoCodes() { + return this.promoCodesClient.get(); + } + + public AsyncReactionsClient reactions() { + return this.reactionsClient.get(); + } + + public AsyncRecommendedActionsClient recommendedActions() { + return this.recommendedActionsClient.get(); + } + + public AsyncRefundsClient refunds() { + return this.refundsClient.get(); + } + + public AsyncResolutionCenterCasesClient resolutionCenterCases() { + return this.resolutionCenterCasesClient.get(); + } + + public AsyncReviewsClient reviews() { + return this.reviewsClient.get(); + } + + public AsyncSetupIntentsClient setupIntents() { + return this.setupIntentsClient.get(); + } + + public AsyncShipmentsClient shipments() { + return this.shipmentsClient.get(); + } + + public AsyncSocialAccountsClient socialAccounts() { + return this.socialAccountsClient.get(); + } + + public AsyncStatsClient stats() { + return this.statsClient.get(); + } + + public AsyncSupportChannelsClient supportChannels() { + return this.supportChannelsClient.get(); + } + + public AsyncSwapsClient swaps() { + return this.swapsClient.get(); + } + + public AsyncTeamMembersClient teamMembers() { + return this.teamMembersClient.get(); + } + + public AsyncTopupsClient topups() { + return this.topupsClient.get(); + } + + public AsyncTransfersClient transfers() { + return this.transfersClient.get(); + } + + public AsyncUsersClient users() { + return this.usersClient.get(); + } + + public AsyncVerificationsClient verifications() { + return this.verificationsClient.get(); + } + + public AsyncWebhooksClient webhooks() { + return this.webhooksClient.get(); + } + + public AsyncWithdrawalsClient withdrawals() { + return this.withdrawalsClient.get(); + } + + public static AsyncWhopApiClientBuilder builder() { + return new AsyncWhopApiClientBuilder(); + } +} diff --git a/src/main/java/com/whop/api/AsyncWhopApiClientBuilder.java b/src/main/java/com/whop/api/AsyncWhopApiClientBuilder.java new file mode 100644 index 00000000..0fcaf921 --- /dev/null +++ b/src/main/java/com/whop/api/AsyncWhopApiClientBuilder.java @@ -0,0 +1,271 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.Environment; +import com.whop.api.core.LogConfig; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import okhttp3.OkHttpClient; + +public class AsyncWhopApiClientBuilder { + private Optional timeout = Optional.empty(); + + private Optional maxRetries = Optional.empty(); + + private final Map customHeaders = new HashMap<>(); + + private String token = null; + + private String apiVersionDate = null; + + private String idempotencyKey = null; + + private Environment environment = Environment.DEFAULT; + + private OkHttpClient httpClient; + + private Optional logging = Optional.empty(); + + /** + * Sets token + */ + public AsyncWhopApiClientBuilder token(String token) { + this.token = token; + return this; + } + + /** + * Sets apiVersionDate + */ + public AsyncWhopApiClientBuilder apiVersionDate(String apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + * Sets idempotencyKey + */ + public AsyncWhopApiClientBuilder idempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + return this; + } + + public AsyncWhopApiClientBuilder environment(Environment environment) { + this.environment = environment; + return this; + } + + public AsyncWhopApiClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public AsyncWhopApiClientBuilder timeout(int timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public AsyncWhopApiClientBuilder maxRetries(int maxRetries) { + this.maxRetries = Optional.of(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public AsyncWhopApiClientBuilder httpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /** + * Configure logging for the SDK. Silent by default — no log output unless explicitly configured. + */ + public AsyncWhopApiClientBuilder logging(LogConfig logging) { + this.logging = Optional.of(logging); + return this; + } + + /** + * Add a custom header to be sent with all requests. + * For headers that need to be computed dynamically or conditionally, use the setAdditional() method override instead. + * + * @param name The header name + * @param value The header value + * @return This builder for method chaining + */ + public AsyncWhopApiClientBuilder addHeader(String name, String value) { + this.customHeaders.put(name, value); + return this; + } + + protected ClientOptions buildClientOptions() { + ClientOptions.Builder builder = ClientOptions.builder(); + setEnvironment(builder); + setAuthentication(builder); + setCustomHeaders(builder); + setHttpClient(builder); + setTimeouts(builder); + setRetries(builder); + setLogging(builder); + for (Map.Entry header : this.customHeaders.entrySet()) { + builder.addHeader(header.getKey(), header.getValue()); + } + setAdditional(builder); + return builder.build(); + } + + /** + * Sets the environment configuration for the client. + * Override this method to modify URLs or add environment-specific logic. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setEnvironment(ClientOptions.Builder builder) { + builder.environment(this.environment); + } + + /** + * Override this method to customize authentication. + * This method is called during client options construction to set up authentication headers. + * + * @param builder The ClientOptions.Builder to configure + * + * Example: + *
{@code
+     * @Override
+     * protected void setAuthentication(ClientOptions.Builder builder) {
+     *     super.setAuthentication(builder); // Keep existing auth
+     *     builder.addHeader("X-API-Key", this.apiKey);
+     * }
+     * }
+ */ + protected void setAuthentication(ClientOptions.Builder builder) { + if (this.token != null) { + builder.addHeader("Authorization", "Bearer " + this.token); + } + } + + /** + * Override this method to add or modify custom headers. + * This method is called during client options construction to set up custom headers defined in the API. + * + * @param builder The ClientOptions.Builder to configure + * + * Example: + *
{@code
+     * @Override
+     * protected void setCustomHeaders(ClientOptions.Builder builder) {
+     *     super.setCustomHeaders(builder); // Keep existing headers
+     *     builder.addHeader("X-Trace-ID", generateTraceId());
+     * }
+     * }
+ */ + protected void setCustomHeaders(ClientOptions.Builder builder) { + if (this.apiVersionDate != null) { + builder.addHeader("Api-Version-Date", this.apiVersionDate); + } + if (this.idempotencyKey != null) { + builder.addHeader("Idempotency-Key", this.idempotencyKey); + } + } + + /** + * Sets the request timeout configuration. + * Override this method to customize timeout behavior. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setTimeouts(ClientOptions.Builder builder) { + if (this.timeout.isPresent()) { + builder.timeout(this.timeout.get()); + } + } + + /** + * Sets the retry configuration for failed requests. + * Override this method to implement custom retry strategies. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setRetries(ClientOptions.Builder builder) { + if (this.maxRetries.isPresent()) { + builder.maxRetries(this.maxRetries.get()); + } + } + + /** + * Sets the OkHttp client configuration. + * Override this method to customize HTTP client behavior (interceptors, connection pools, etc). + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setHttpClient(ClientOptions.Builder builder) { + if (this.httpClient != null) { + builder.httpClient(this.httpClient); + } + } + + /** + * Sets the logging configuration for the SDK. + * Override this method to customize logging behavior. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setLogging(ClientOptions.Builder builder) { + if (this.logging.isPresent()) { + builder.logging(this.logging.get()); + } + } + + /** + * Override this method to add any additional configuration to the client. + * This method is called at the end of the configuration chain, allowing you to add + * custom headers, modify settings, or perform any other client customization. + * + * @param builder The ClientOptions.Builder to configure + * + * Example: + *
{@code
+     * @Override
+     * protected void setAdditional(ClientOptions.Builder builder) {
+     *     builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
+     *     builder.addHeader("X-Client-Version", "1.0.0");
+     * }
+     * }
+ */ + protected void setAdditional(ClientOptions.Builder builder) {} + + /** + * Override this method to add custom validation logic before the client is built. + * This method is called at the beginning of the build() method to ensure the configuration is valid. + * Throw an exception to prevent client creation if validation fails. + * + * Example: + *
{@code
+     * @Override
+     * protected void validateConfiguration() {
+     *     super.validateConfiguration(); // Run parent validations
+     *     if (tenantId == null || tenantId.isEmpty()) {
+     *         throw new IllegalStateException("tenantId is required");
+     *     }
+     * }
+     * }
+ */ + protected void validateConfiguration() {} + + public AsyncWhopApiClient build() { + validateConfiguration(); + return new AsyncWhopApiClient(buildClientOptions()); + } +} diff --git a/src/main/java/com/whop/api/WhopApiClient.java b/src/main/java/com/whop/api/WhopApiClient.java new file mode 100644 index 00000000..0fc02eea --- /dev/null +++ b/src/main/java/com/whop/api/WhopApiClient.java @@ -0,0 +1,670 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.resources.accesstokens.AccessTokensClient; +import com.whop.api.resources.accountlinks.AccountLinksClient; +import com.whop.api.resources.accounts.AccountsClient; +import com.whop.api.resources.adcampaigns.AdCampaignsClient; +import com.whop.api.resources.adgroups.AdGroupsClient; +import com.whop.api.resources.adreports.AdReportsClient; +import com.whop.api.resources.ads.AdsClient; +import com.whop.api.resources.affiliates.AffiliatesClient; +import com.whop.api.resources.aichats.AiChatsClient; +import com.whop.api.resources.apikeys.ApiKeysClient; +import com.whop.api.resources.appbuilds.AppBuildsClient; +import com.whop.api.resources.apps.AppsClient; +import com.whop.api.resources.audiences.AudiencesClient; +import com.whop.api.resources.authorizedusers.AuthorizedUsersClient; +import com.whop.api.resources.bounties.BountiesClient; +import com.whop.api.resources.bountysubmissions.BountySubmissionsClient; +import com.whop.api.resources.cards.CardsClient; +import com.whop.api.resources.cardtransactions.CardTransactionsClient; +import com.whop.api.resources.chatchannels.ChatChannelsClient; +import com.whop.api.resources.checkoutconfigurations.CheckoutConfigurationsClient; +import com.whop.api.resources.companies.CompaniesClient; +import com.whop.api.resources.companytokentransactions.CompanyTokenTransactionsClient; +import com.whop.api.resources.coursechapters.CourseChaptersClient; +import com.whop.api.resources.courselessoninteractions.CourseLessonInteractionsClient; +import com.whop.api.resources.courselessons.CourseLessonsClient; +import com.whop.api.resources.courses.CoursesClient; +import com.whop.api.resources.coursestudents.CourseStudentsClient; +import com.whop.api.resources.deposits.DepositsClient; +import com.whop.api.resources.disputealerts.DisputeAlertsClient; +import com.whop.api.resources.disputes.DisputesClient; +import com.whop.api.resources.dmchannels.DmChannelsClient; +import com.whop.api.resources.dmmembers.DmMembersClient; +import com.whop.api.resources.entries.EntriesClient; +import com.whop.api.resources.events.EventsClient; +import com.whop.api.resources.experiences.ExperiencesClient; +import com.whop.api.resources.exports.ExportsClient; +import com.whop.api.resources.feemarkups.FeeMarkupsClient; +import com.whop.api.resources.files.FilesClient; +import com.whop.api.resources.financialactivity.FinancialActivityClient; +import com.whop.api.resources.forumposts.ForumPostsClient; +import com.whop.api.resources.forums.ForumsClient; +import com.whop.api.resources.identityprofiles.IdentityProfilesClient; +import com.whop.api.resources.invoices.InvoicesClient; +import com.whop.api.resources.leads.LeadsClient; +import com.whop.api.resources.ledgeraccounts.LedgerAccountsClient; +import com.whop.api.resources.ledgers.LedgersClient; +import com.whop.api.resources.media.MediaClient; +import com.whop.api.resources.members.MembersClient; +import com.whop.api.resources.memberships.MembershipsClient; +import com.whop.api.resources.messages.MessagesClient; +import com.whop.api.resources.notifications.NotificationsClient; +import com.whop.api.resources.partners.PartnersClient; +import com.whop.api.resources.paymentmethoddomains.PaymentMethodDomainsClient; +import com.whop.api.resources.paymentmethods.PaymentMethodsClient; +import com.whop.api.resources.payments.PaymentsClient; +import com.whop.api.resources.payoutaccounts.PayoutAccountsClient; +import com.whop.api.resources.payoutmethods.PayoutMethodsClient; +import com.whop.api.resources.payouts.PayoutsClient; +import com.whop.api.resources.people.PeopleClient; +import com.whop.api.resources.permissions.PermissionsClient; +import com.whop.api.resources.plans.PlansClient; +import com.whop.api.resources.products.ProductsClient; +import com.whop.api.resources.promocodes.PromoCodesClient; +import com.whop.api.resources.reactions.ReactionsClient; +import com.whop.api.resources.recommendedactions.RecommendedActionsClient; +import com.whop.api.resources.refunds.RefundsClient; +import com.whop.api.resources.resolutioncentercases.ResolutionCenterCasesClient; +import com.whop.api.resources.reviews.ReviewsClient; +import com.whop.api.resources.setupintents.SetupIntentsClient; +import com.whop.api.resources.shipments.ShipmentsClient; +import com.whop.api.resources.socialaccounts.SocialAccountsClient; +import com.whop.api.resources.stats.StatsClient; +import com.whop.api.resources.supportchannels.SupportChannelsClient; +import com.whop.api.resources.swaps.SwapsClient; +import com.whop.api.resources.teammembers.TeamMembersClient; +import com.whop.api.resources.topups.TopupsClient; +import com.whop.api.resources.transfers.TransfersClient; +import com.whop.api.resources.users.UsersClient; +import com.whop.api.resources.verifications.VerificationsClient; +import com.whop.api.resources.webhooks.WebhooksClient; +import com.whop.api.resources.withdrawals.WithdrawalsClient; +import java.util.function.Supplier; + +public class WhopApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier accessTokensClient; + + protected final Supplier accountLinksClient; + + protected final Supplier accountsClient; + + protected final Supplier adCampaignsClient; + + protected final Supplier adGroupsClient; + + protected final Supplier adReportsClient; + + protected final Supplier adsClient; + + protected final Supplier affiliatesClient; + + protected final Supplier aiChatsClient; + + protected final Supplier apiKeysClient; + + protected final Supplier appBuildsClient; + + protected final Supplier appsClient; + + protected final Supplier audiencesClient; + + protected final Supplier authorizedUsersClient; + + protected final Supplier bountiesClient; + + protected final Supplier bountySubmissionsClient; + + protected final Supplier cardTransactionsClient; + + protected final Supplier cardsClient; + + protected final Supplier chatChannelsClient; + + protected final Supplier checkoutConfigurationsClient; + + protected final Supplier companiesClient; + + protected final Supplier companyTokenTransactionsClient; + + protected final Supplier courseChaptersClient; + + protected final Supplier courseLessonInteractionsClient; + + protected final Supplier courseLessonsClient; + + protected final Supplier courseStudentsClient; + + protected final Supplier coursesClient; + + protected final Supplier depositsClient; + + protected final Supplier disputeAlertsClient; + + protected final Supplier disputesClient; + + protected final Supplier dmChannelsClient; + + protected final Supplier dmMembersClient; + + protected final Supplier entriesClient; + + protected final Supplier eventsClient; + + protected final Supplier experiencesClient; + + protected final Supplier exportsClient; + + protected final Supplier feeMarkupsClient; + + protected final Supplier filesClient; + + protected final Supplier financialActivityClient; + + protected final Supplier ledgersClient; + + protected final Supplier forumPostsClient; + + protected final Supplier forumsClient; + + protected final Supplier identityProfilesClient; + + protected final Supplier invoicesClient; + + protected final Supplier leadsClient; + + protected final Supplier ledgerAccountsClient; + + protected final Supplier mediaClient; + + protected final Supplier membersClient; + + protected final Supplier membershipsClient; + + protected final Supplier messagesClient; + + protected final Supplier notificationsClient; + + protected final Supplier partnersClient; + + protected final Supplier paymentMethodDomainsClient; + + protected final Supplier paymentMethodsClient; + + protected final Supplier paymentsClient; + + protected final Supplier payoutAccountsClient; + + protected final Supplier payoutMethodsClient; + + protected final Supplier payoutsClient; + + protected final Supplier peopleClient; + + protected final Supplier permissionsClient; + + protected final Supplier plansClient; + + protected final Supplier productsClient; + + protected final Supplier promoCodesClient; + + protected final Supplier reactionsClient; + + protected final Supplier recommendedActionsClient; + + protected final Supplier refundsClient; + + protected final Supplier resolutionCenterCasesClient; + + protected final Supplier reviewsClient; + + protected final Supplier setupIntentsClient; + + protected final Supplier shipmentsClient; + + protected final Supplier socialAccountsClient; + + protected final Supplier statsClient; + + protected final Supplier supportChannelsClient; + + protected final Supplier swapsClient; + + protected final Supplier teamMembersClient; + + protected final Supplier topupsClient; + + protected final Supplier transfersClient; + + protected final Supplier usersClient; + + protected final Supplier verificationsClient; + + protected final Supplier webhooksClient; + + protected final Supplier withdrawalsClient; + + public WhopApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.accessTokensClient = Suppliers.memoize(() -> new AccessTokensClient(clientOptions)); + this.accountLinksClient = Suppliers.memoize(() -> new AccountLinksClient(clientOptions)); + this.accountsClient = Suppliers.memoize(() -> new AccountsClient(clientOptions)); + this.adCampaignsClient = Suppliers.memoize(() -> new AdCampaignsClient(clientOptions)); + this.adGroupsClient = Suppliers.memoize(() -> new AdGroupsClient(clientOptions)); + this.adReportsClient = Suppliers.memoize(() -> new AdReportsClient(clientOptions)); + this.adsClient = Suppliers.memoize(() -> new AdsClient(clientOptions)); + this.affiliatesClient = Suppliers.memoize(() -> new AffiliatesClient(clientOptions)); + this.aiChatsClient = Suppliers.memoize(() -> new AiChatsClient(clientOptions)); + this.apiKeysClient = Suppliers.memoize(() -> new ApiKeysClient(clientOptions)); + this.appBuildsClient = Suppliers.memoize(() -> new AppBuildsClient(clientOptions)); + this.appsClient = Suppliers.memoize(() -> new AppsClient(clientOptions)); + this.audiencesClient = Suppliers.memoize(() -> new AudiencesClient(clientOptions)); + this.authorizedUsersClient = Suppliers.memoize(() -> new AuthorizedUsersClient(clientOptions)); + this.bountiesClient = Suppliers.memoize(() -> new BountiesClient(clientOptions)); + this.bountySubmissionsClient = Suppliers.memoize(() -> new BountySubmissionsClient(clientOptions)); + this.cardTransactionsClient = Suppliers.memoize(() -> new CardTransactionsClient(clientOptions)); + this.cardsClient = Suppliers.memoize(() -> new CardsClient(clientOptions)); + this.chatChannelsClient = Suppliers.memoize(() -> new ChatChannelsClient(clientOptions)); + this.checkoutConfigurationsClient = Suppliers.memoize(() -> new CheckoutConfigurationsClient(clientOptions)); + this.companiesClient = Suppliers.memoize(() -> new CompaniesClient(clientOptions)); + this.companyTokenTransactionsClient = + Suppliers.memoize(() -> new CompanyTokenTransactionsClient(clientOptions)); + this.courseChaptersClient = Suppliers.memoize(() -> new CourseChaptersClient(clientOptions)); + this.courseLessonInteractionsClient = + Suppliers.memoize(() -> new CourseLessonInteractionsClient(clientOptions)); + this.courseLessonsClient = Suppliers.memoize(() -> new CourseLessonsClient(clientOptions)); + this.courseStudentsClient = Suppliers.memoize(() -> new CourseStudentsClient(clientOptions)); + this.coursesClient = Suppliers.memoize(() -> new CoursesClient(clientOptions)); + this.depositsClient = Suppliers.memoize(() -> new DepositsClient(clientOptions)); + this.disputeAlertsClient = Suppliers.memoize(() -> new DisputeAlertsClient(clientOptions)); + this.disputesClient = Suppliers.memoize(() -> new DisputesClient(clientOptions)); + this.dmChannelsClient = Suppliers.memoize(() -> new DmChannelsClient(clientOptions)); + this.dmMembersClient = Suppliers.memoize(() -> new DmMembersClient(clientOptions)); + this.entriesClient = Suppliers.memoize(() -> new EntriesClient(clientOptions)); + this.eventsClient = Suppliers.memoize(() -> new EventsClient(clientOptions)); + this.experiencesClient = Suppliers.memoize(() -> new ExperiencesClient(clientOptions)); + this.exportsClient = Suppliers.memoize(() -> new ExportsClient(clientOptions)); + this.feeMarkupsClient = Suppliers.memoize(() -> new FeeMarkupsClient(clientOptions)); + this.filesClient = Suppliers.memoize(() -> new FilesClient(clientOptions)); + this.financialActivityClient = Suppliers.memoize(() -> new FinancialActivityClient(clientOptions)); + this.ledgersClient = Suppliers.memoize(() -> new LedgersClient(clientOptions)); + this.forumPostsClient = Suppliers.memoize(() -> new ForumPostsClient(clientOptions)); + this.forumsClient = Suppliers.memoize(() -> new ForumsClient(clientOptions)); + this.identityProfilesClient = Suppliers.memoize(() -> new IdentityProfilesClient(clientOptions)); + this.invoicesClient = Suppliers.memoize(() -> new InvoicesClient(clientOptions)); + this.leadsClient = Suppliers.memoize(() -> new LeadsClient(clientOptions)); + this.ledgerAccountsClient = Suppliers.memoize(() -> new LedgerAccountsClient(clientOptions)); + this.mediaClient = Suppliers.memoize(() -> new MediaClient(clientOptions)); + this.membersClient = Suppliers.memoize(() -> new MembersClient(clientOptions)); + this.membershipsClient = Suppliers.memoize(() -> new MembershipsClient(clientOptions)); + this.messagesClient = Suppliers.memoize(() -> new MessagesClient(clientOptions)); + this.notificationsClient = Suppliers.memoize(() -> new NotificationsClient(clientOptions)); + this.partnersClient = Suppliers.memoize(() -> new PartnersClient(clientOptions)); + this.paymentMethodDomainsClient = Suppliers.memoize(() -> new PaymentMethodDomainsClient(clientOptions)); + this.paymentMethodsClient = Suppliers.memoize(() -> new PaymentMethodsClient(clientOptions)); + this.paymentsClient = Suppliers.memoize(() -> new PaymentsClient(clientOptions)); + this.payoutAccountsClient = Suppliers.memoize(() -> new PayoutAccountsClient(clientOptions)); + this.payoutMethodsClient = Suppliers.memoize(() -> new PayoutMethodsClient(clientOptions)); + this.payoutsClient = Suppliers.memoize(() -> new PayoutsClient(clientOptions)); + this.peopleClient = Suppliers.memoize(() -> new PeopleClient(clientOptions)); + this.permissionsClient = Suppliers.memoize(() -> new PermissionsClient(clientOptions)); + this.plansClient = Suppliers.memoize(() -> new PlansClient(clientOptions)); + this.productsClient = Suppliers.memoize(() -> new ProductsClient(clientOptions)); + this.promoCodesClient = Suppliers.memoize(() -> new PromoCodesClient(clientOptions)); + this.reactionsClient = Suppliers.memoize(() -> new ReactionsClient(clientOptions)); + this.recommendedActionsClient = Suppliers.memoize(() -> new RecommendedActionsClient(clientOptions)); + this.refundsClient = Suppliers.memoize(() -> new RefundsClient(clientOptions)); + this.resolutionCenterCasesClient = Suppliers.memoize(() -> new ResolutionCenterCasesClient(clientOptions)); + this.reviewsClient = Suppliers.memoize(() -> new ReviewsClient(clientOptions)); + this.setupIntentsClient = Suppliers.memoize(() -> new SetupIntentsClient(clientOptions)); + this.shipmentsClient = Suppliers.memoize(() -> new ShipmentsClient(clientOptions)); + this.socialAccountsClient = Suppliers.memoize(() -> new SocialAccountsClient(clientOptions)); + this.statsClient = Suppliers.memoize(() -> new StatsClient(clientOptions)); + this.supportChannelsClient = Suppliers.memoize(() -> new SupportChannelsClient(clientOptions)); + this.swapsClient = Suppliers.memoize(() -> new SwapsClient(clientOptions)); + this.teamMembersClient = Suppliers.memoize(() -> new TeamMembersClient(clientOptions)); + this.topupsClient = Suppliers.memoize(() -> new TopupsClient(clientOptions)); + this.transfersClient = Suppliers.memoize(() -> new TransfersClient(clientOptions)); + this.usersClient = Suppliers.memoize(() -> new UsersClient(clientOptions)); + this.verificationsClient = Suppliers.memoize(() -> new VerificationsClient(clientOptions)); + this.webhooksClient = Suppliers.memoize(() -> new WebhooksClient(clientOptions)); + this.withdrawalsClient = Suppliers.memoize(() -> new WithdrawalsClient(clientOptions)); + } + + public AccessTokensClient accessTokens() { + return this.accessTokensClient.get(); + } + + public AccountLinksClient accountLinks() { + return this.accountLinksClient.get(); + } + + public AccountsClient accounts() { + return this.accountsClient.get(); + } + + public AdCampaignsClient adCampaigns() { + return this.adCampaignsClient.get(); + } + + public AdGroupsClient adGroups() { + return this.adGroupsClient.get(); + } + + public AdReportsClient adReports() { + return this.adReportsClient.get(); + } + + public AdsClient ads() { + return this.adsClient.get(); + } + + public AffiliatesClient affiliates() { + return this.affiliatesClient.get(); + } + + public AiChatsClient aiChats() { + return this.aiChatsClient.get(); + } + + public ApiKeysClient apiKeys() { + return this.apiKeysClient.get(); + } + + public AppBuildsClient appBuilds() { + return this.appBuildsClient.get(); + } + + public AppsClient apps() { + return this.appsClient.get(); + } + + public AudiencesClient audiences() { + return this.audiencesClient.get(); + } + + public AuthorizedUsersClient authorizedUsers() { + return this.authorizedUsersClient.get(); + } + + public BountiesClient bounties() { + return this.bountiesClient.get(); + } + + public BountySubmissionsClient bountySubmissions() { + return this.bountySubmissionsClient.get(); + } + + public CardTransactionsClient cardTransactions() { + return this.cardTransactionsClient.get(); + } + + public CardsClient cards() { + return this.cardsClient.get(); + } + + public ChatChannelsClient chatChannels() { + return this.chatChannelsClient.get(); + } + + public CheckoutConfigurationsClient checkoutConfigurations() { + return this.checkoutConfigurationsClient.get(); + } + + public CompaniesClient companies() { + return this.companiesClient.get(); + } + + public CompanyTokenTransactionsClient companyTokenTransactions() { + return this.companyTokenTransactionsClient.get(); + } + + public CourseChaptersClient courseChapters() { + return this.courseChaptersClient.get(); + } + + public CourseLessonInteractionsClient courseLessonInteractions() { + return this.courseLessonInteractionsClient.get(); + } + + public CourseLessonsClient courseLessons() { + return this.courseLessonsClient.get(); + } + + public CourseStudentsClient courseStudents() { + return this.courseStudentsClient.get(); + } + + public CoursesClient courses() { + return this.coursesClient.get(); + } + + public DepositsClient deposits() { + return this.depositsClient.get(); + } + + public DisputeAlertsClient disputeAlerts() { + return this.disputeAlertsClient.get(); + } + + public DisputesClient disputes() { + return this.disputesClient.get(); + } + + public DmChannelsClient dmChannels() { + return this.dmChannelsClient.get(); + } + + public DmMembersClient dmMembers() { + return this.dmMembersClient.get(); + } + + public EntriesClient entries() { + return this.entriesClient.get(); + } + + public EventsClient events() { + return this.eventsClient.get(); + } + + public ExperiencesClient experiences() { + return this.experiencesClient.get(); + } + + public ExportsClient exports() { + return this.exportsClient.get(); + } + + public FeeMarkupsClient feeMarkups() { + return this.feeMarkupsClient.get(); + } + + public FilesClient files() { + return this.filesClient.get(); + } + + public FinancialActivityClient financialActivity() { + return this.financialActivityClient.get(); + } + + public LedgersClient ledgers() { + return this.ledgersClient.get(); + } + + public ForumPostsClient forumPosts() { + return this.forumPostsClient.get(); + } + + public ForumsClient forums() { + return this.forumsClient.get(); + } + + public IdentityProfilesClient identityProfiles() { + return this.identityProfilesClient.get(); + } + + public InvoicesClient invoices() { + return this.invoicesClient.get(); + } + + public LeadsClient leads() { + return this.leadsClient.get(); + } + + public LedgerAccountsClient ledgerAccounts() { + return this.ledgerAccountsClient.get(); + } + + public MediaClient media() { + return this.mediaClient.get(); + } + + public MembersClient members() { + return this.membersClient.get(); + } + + public MembershipsClient memberships() { + return this.membershipsClient.get(); + } + + public MessagesClient messages() { + return this.messagesClient.get(); + } + + public NotificationsClient notifications() { + return this.notificationsClient.get(); + } + + public PartnersClient partners() { + return this.partnersClient.get(); + } + + public PaymentMethodDomainsClient paymentMethodDomains() { + return this.paymentMethodDomainsClient.get(); + } + + public PaymentMethodsClient paymentMethods() { + return this.paymentMethodsClient.get(); + } + + public PaymentsClient payments() { + return this.paymentsClient.get(); + } + + public PayoutAccountsClient payoutAccounts() { + return this.payoutAccountsClient.get(); + } + + public PayoutMethodsClient payoutMethods() { + return this.payoutMethodsClient.get(); + } + + public PayoutsClient payouts() { + return this.payoutsClient.get(); + } + + public PeopleClient people() { + return this.peopleClient.get(); + } + + public PermissionsClient permissions() { + return this.permissionsClient.get(); + } + + public PlansClient plans() { + return this.plansClient.get(); + } + + public ProductsClient products() { + return this.productsClient.get(); + } + + public PromoCodesClient promoCodes() { + return this.promoCodesClient.get(); + } + + public ReactionsClient reactions() { + return this.reactionsClient.get(); + } + + public RecommendedActionsClient recommendedActions() { + return this.recommendedActionsClient.get(); + } + + public RefundsClient refunds() { + return this.refundsClient.get(); + } + + public ResolutionCenterCasesClient resolutionCenterCases() { + return this.resolutionCenterCasesClient.get(); + } + + public ReviewsClient reviews() { + return this.reviewsClient.get(); + } + + public SetupIntentsClient setupIntents() { + return this.setupIntentsClient.get(); + } + + public ShipmentsClient shipments() { + return this.shipmentsClient.get(); + } + + public SocialAccountsClient socialAccounts() { + return this.socialAccountsClient.get(); + } + + public StatsClient stats() { + return this.statsClient.get(); + } + + public SupportChannelsClient supportChannels() { + return this.supportChannelsClient.get(); + } + + public SwapsClient swaps() { + return this.swapsClient.get(); + } + + public TeamMembersClient teamMembers() { + return this.teamMembersClient.get(); + } + + public TopupsClient topups() { + return this.topupsClient.get(); + } + + public TransfersClient transfers() { + return this.transfersClient.get(); + } + + public UsersClient users() { + return this.usersClient.get(); + } + + public VerificationsClient verifications() { + return this.verificationsClient.get(); + } + + public WebhooksClient webhooks() { + return this.webhooksClient.get(); + } + + public WithdrawalsClient withdrawals() { + return this.withdrawalsClient.get(); + } + + public static WhopApiClientBuilder builder() { + return new WhopApiClientBuilder(); + } +} diff --git a/src/main/java/com/whop/api/WhopApiClientBuilder.java b/src/main/java/com/whop/api/WhopApiClientBuilder.java new file mode 100644 index 00000000..4638c7b3 --- /dev/null +++ b/src/main/java/com/whop/api/WhopApiClientBuilder.java @@ -0,0 +1,271 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.Environment; +import com.whop.api.core.LogConfig; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import okhttp3.OkHttpClient; + +public class WhopApiClientBuilder { + private Optional timeout = Optional.empty(); + + private Optional maxRetries = Optional.empty(); + + private final Map customHeaders = new HashMap<>(); + + private String token = null; + + private String apiVersionDate = null; + + private String idempotencyKey = null; + + private Environment environment = Environment.DEFAULT; + + private OkHttpClient httpClient; + + private Optional logging = Optional.empty(); + + /** + * Sets token + */ + public WhopApiClientBuilder token(String token) { + this.token = token; + return this; + } + + /** + * Sets apiVersionDate + */ + public WhopApiClientBuilder apiVersionDate(String apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + * Sets idempotencyKey + */ + public WhopApiClientBuilder idempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + return this; + } + + public WhopApiClientBuilder environment(Environment environment) { + this.environment = environment; + return this; + } + + public WhopApiClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public WhopApiClientBuilder timeout(int timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public WhopApiClientBuilder maxRetries(int maxRetries) { + this.maxRetries = Optional.of(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public WhopApiClientBuilder httpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /** + * Configure logging for the SDK. Silent by default — no log output unless explicitly configured. + */ + public WhopApiClientBuilder logging(LogConfig logging) { + this.logging = Optional.of(logging); + return this; + } + + /** + * Add a custom header to be sent with all requests. + * For headers that need to be computed dynamically or conditionally, use the setAdditional() method override instead. + * + * @param name The header name + * @param value The header value + * @return This builder for method chaining + */ + public WhopApiClientBuilder addHeader(String name, String value) { + this.customHeaders.put(name, value); + return this; + } + + protected ClientOptions buildClientOptions() { + ClientOptions.Builder builder = ClientOptions.builder(); + setEnvironment(builder); + setAuthentication(builder); + setCustomHeaders(builder); + setHttpClient(builder); + setTimeouts(builder); + setRetries(builder); + setLogging(builder); + for (Map.Entry header : this.customHeaders.entrySet()) { + builder.addHeader(header.getKey(), header.getValue()); + } + setAdditional(builder); + return builder.build(); + } + + /** + * Sets the environment configuration for the client. + * Override this method to modify URLs or add environment-specific logic. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setEnvironment(ClientOptions.Builder builder) { + builder.environment(this.environment); + } + + /** + * Override this method to customize authentication. + * This method is called during client options construction to set up authentication headers. + * + * @param builder The ClientOptions.Builder to configure + * + * Example: + *
{@code
+     * @Override
+     * protected void setAuthentication(ClientOptions.Builder builder) {
+     *     super.setAuthentication(builder); // Keep existing auth
+     *     builder.addHeader("X-API-Key", this.apiKey);
+     * }
+     * }
+ */ + protected void setAuthentication(ClientOptions.Builder builder) { + if (this.token != null) { + builder.addHeader("Authorization", "Bearer " + this.token); + } + } + + /** + * Override this method to add or modify custom headers. + * This method is called during client options construction to set up custom headers defined in the API. + * + * @param builder The ClientOptions.Builder to configure + * + * Example: + *
{@code
+     * @Override
+     * protected void setCustomHeaders(ClientOptions.Builder builder) {
+     *     super.setCustomHeaders(builder); // Keep existing headers
+     *     builder.addHeader("X-Trace-ID", generateTraceId());
+     * }
+     * }
+ */ + protected void setCustomHeaders(ClientOptions.Builder builder) { + if (this.apiVersionDate != null) { + builder.addHeader("Api-Version-Date", this.apiVersionDate); + } + if (this.idempotencyKey != null) { + builder.addHeader("Idempotency-Key", this.idempotencyKey); + } + } + + /** + * Sets the request timeout configuration. + * Override this method to customize timeout behavior. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setTimeouts(ClientOptions.Builder builder) { + if (this.timeout.isPresent()) { + builder.timeout(this.timeout.get()); + } + } + + /** + * Sets the retry configuration for failed requests. + * Override this method to implement custom retry strategies. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setRetries(ClientOptions.Builder builder) { + if (this.maxRetries.isPresent()) { + builder.maxRetries(this.maxRetries.get()); + } + } + + /** + * Sets the OkHttp client configuration. + * Override this method to customize HTTP client behavior (interceptors, connection pools, etc). + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setHttpClient(ClientOptions.Builder builder) { + if (this.httpClient != null) { + builder.httpClient(this.httpClient); + } + } + + /** + * Sets the logging configuration for the SDK. + * Override this method to customize logging behavior. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setLogging(ClientOptions.Builder builder) { + if (this.logging.isPresent()) { + builder.logging(this.logging.get()); + } + } + + /** + * Override this method to add any additional configuration to the client. + * This method is called at the end of the configuration chain, allowing you to add + * custom headers, modify settings, or perform any other client customization. + * + * @param builder The ClientOptions.Builder to configure + * + * Example: + *
{@code
+     * @Override
+     * protected void setAdditional(ClientOptions.Builder builder) {
+     *     builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
+     *     builder.addHeader("X-Client-Version", "1.0.0");
+     * }
+     * }
+ */ + protected void setAdditional(ClientOptions.Builder builder) {} + + /** + * Override this method to add custom validation logic before the client is built. + * This method is called at the beginning of the build() method to ensure the configuration is valid. + * Throw an exception to prevent client creation if validation fails. + * + * Example: + *
{@code
+     * @Override
+     * protected void validateConfiguration() {
+     *     super.validateConfiguration(); // Run parent validations
+     *     if (tenantId == null || tenantId.isEmpty()) {
+     *         throw new IllegalStateException("tenantId is required");
+     *     }
+     * }
+     * }
+ */ + protected void validateConfiguration() {} + + public WhopApiClient build() { + validateConfiguration(); + return new WhopApiClient(buildClientOptions()); + } +} diff --git a/src/main/java/com/whop/api/core/ClientOptions.java b/src/main/java/com/whop/api/core/ClientOptions.java new file mode 100644 index 00000000..a5105edf --- /dev/null +++ b/src/main/java/com/whop/api/core/ClientOptions.java @@ -0,0 +1,221 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +import okhttp3.OkHttpClient; + +public final class ClientOptions { + private final Environment environment; + + private final Map headers; + + private final Map> headerSuppliers; + + private final OkHttpClient httpClient; + + private final int timeout; + + private final int maxRetries; + + private final Optional logging; + + private ClientOptions( + Environment environment, + Map headers, + Map> headerSuppliers, + OkHttpClient httpClient, + int timeout, + int maxRetries, + Optional logging) { + this.environment = environment; + this.headers = new HashMap<>(); + this.headers.putAll(headers); + this.headers.putAll(new HashMap() { + { + put("X-Fern-Language", "JAVA"); + put("X-Fern-SDK-Name", "com.whop.fern:api-sdk"); + put("X-Fern-SDK-Version", "1.0.11"); + } + }); + this.headerSuppliers = headerSuppliers; + this.httpClient = httpClient; + this.timeout = timeout; + this.maxRetries = maxRetries; + this.logging = logging; + } + + public Environment environment() { + return this.environment; + } + + public Map headers(RequestOptions requestOptions) { + Map values = new HashMap<>(this.headers); + headerSuppliers.forEach((key, supplier) -> { + values.put(key, supplier.get()); + }); + if (requestOptions != null) { + values.putAll(requestOptions.getHeaders()); + } + return values; + } + + public int timeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.timeout; + } + return requestOptions.getTimeout().orElse(this.timeout); + } + + public OkHttpClient httpClient() { + return this.httpClient; + } + + public OkHttpClient httpClientWithTimeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.httpClient; + } + return this.httpClient + .newBuilder() + .callTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit()) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .build(); + } + + public int maxRetries() { + return this.maxRetries; + } + + public Optional logging() { + return this.logging; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Environment environment; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + private int maxRetries = 2; + + private Optional timeout = Optional.empty(); + + private OkHttpClient httpClient = null; + + private Optional logging = Optional.empty(); + + public Builder environment(Environment environment) { + this.environment = environment; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(int timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(Optional timeout) { + this.timeout = timeout; + return this; + } + + /** + * Override the maximum number of retries. Defaults to 2 retries. + */ + public Builder maxRetries(int maxRetries) { + this.maxRetries = maxRetries; + return this; + } + + public Builder httpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /** + * Configure logging for the SDK. Silent by default — no log output unless explicitly configured. + */ + public Builder logging(LogConfig logging) { + this.logging = Optional.of(logging); + return this; + } + + public ClientOptions build() { + OkHttpClient.Builder httpClientBuilder = + this.httpClient != null ? this.httpClient.newBuilder() : new OkHttpClient.Builder(); + + if (this.httpClient != null) { + timeout.ifPresent(timeout -> httpClientBuilder + .callTimeout(timeout, TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS)); + } else { + httpClientBuilder + .callTimeout(this.timeout.orElse(60), TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .addInterceptor(new RetryInterceptor(this.maxRetries)); + } + + Logger logger = Logger.from(this.logging); + httpClientBuilder.addInterceptor(new LoggingInterceptor(logger)); + + this.httpClient = httpClientBuilder.build(); + this.timeout = Optional.of(httpClient.callTimeoutMillis() / 1000); + + return new ClientOptions( + environment, + headers, + headerSuppliers, + httpClient, + this.timeout.get(), + this.maxRetries, + this.logging); + } + + /** + * Create a new Builder initialized with values from an existing ClientOptions + */ + public static Builder from(ClientOptions clientOptions) { + Builder builder = new Builder(); + builder.environment = clientOptions.environment(); + builder.timeout = Optional.of(clientOptions.timeout(null)); + builder.httpClient = clientOptions.httpClient(); + builder.headers.putAll(clientOptions.headers); + builder.headerSuppliers.putAll(clientOptions.headerSuppliers); + builder.maxRetries = clientOptions.maxRetries(); + builder.logging = clientOptions.logging(); + return builder; + } + } +} diff --git a/src/main/java/com/whop/api/core/ConsoleLogger.java b/src/main/java/com/whop/api/core/ConsoleLogger.java new file mode 100644 index 00000000..8667c369 --- /dev/null +++ b/src/main/java/com/whop/api/core/ConsoleLogger.java @@ -0,0 +1,51 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.util.logging.Level; + +/** + * Default logger implementation that writes to the console using {@link java.util.logging.Logger}. + * + *

Uses the "fern" logger name with a simple format of "LEVEL - message". + */ +public final class ConsoleLogger implements ILogger { + + private static final java.util.logging.Logger logger = java.util.logging.Logger.getLogger("fern"); + + static { + if (logger.getHandlers().length == 0) { + java.util.logging.ConsoleHandler handler = new java.util.logging.ConsoleHandler(); + handler.setFormatter(new java.util.logging.SimpleFormatter() { + @Override + public String format(java.util.logging.LogRecord record) { + return record.getLevel() + " - " + record.getMessage() + System.lineSeparator(); + } + }); + logger.addHandler(handler); + logger.setUseParentHandlers(false); + logger.setLevel(Level.ALL); + } + } + + @Override + public void debug(String message) { + logger.log(Level.FINE, message); + } + + @Override + public void info(String message) { + logger.log(Level.INFO, message); + } + + @Override + public void warn(String message) { + logger.log(Level.WARNING, message); + } + + @Override + public void error(String message) { + logger.log(Level.SEVERE, message); + } +} diff --git a/src/main/java/com/whop/api/core/DateTimeDeserializer.java b/src/main/java/com/whop/api/core/DateTimeDeserializer.java new file mode 100644 index 00000000..aa0c7a9c --- /dev/null +++ b/src/main/java/com/whop/api/core/DateTimeDeserializer.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.module.SimpleModule; +import java.io.IOException; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalQueries; + +/** + * Custom deserializer that handles converting ISO8601 dates into {@link OffsetDateTime} objects. + */ +class DateTimeDeserializer extends JsonDeserializer { + private static final SimpleModule MODULE; + + static { + MODULE = new SimpleModule().addDeserializer(OffsetDateTime.class, new DateTimeDeserializer()); + } + + /** + * Gets a module wrapping this deserializer as an adapter for the Jackson ObjectMapper. + * + * @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper. + */ + public static SimpleModule getModule() { + return MODULE; + } + + @Override + public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException { + JsonToken token = parser.currentToken(); + if (token == JsonToken.VALUE_NUMBER_INT) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC); + } else { + TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest( + parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from); + + if (temporal.query(TemporalQueries.offset()) == null) { + return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC); + } else { + return OffsetDateTime.from(temporal); + } + } + } +} diff --git a/src/main/java/com/whop/api/core/DoubleSerializer.java b/src/main/java/com/whop/api/core/DoubleSerializer.java new file mode 100644 index 00000000..de70726a --- /dev/null +++ b/src/main/java/com/whop/api/core/DoubleSerializer.java @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.module.SimpleModule; +import java.io.IOException; + +/** + * Custom serializer that writes integer-valued doubles without a decimal point. + * For example, {@code 24000.0} is serialized as {@code 24000} instead of {@code 24000.0}. + * Non-integer values like {@code 3.14} are serialized normally. + */ +class DoubleSerializer extends JsonSerializer { + private static final SimpleModule MODULE; + + static { + MODULE = new SimpleModule() + .addSerializer(Double.class, new DoubleSerializer()) + .addSerializer(double.class, new DoubleSerializer()); + } + + /** + * Gets a module wrapping this serializer as an adapter for the Jackson ObjectMapper. + * + * @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper. + */ + public static SimpleModule getModule() { + return MODULE; + } + + @Override + public void serialize(Double value, JsonGenerator gen, SerializerProvider serializers) throws IOException { + if (value != null && value == Math.floor(value) && !Double.isInfinite(value) && !Double.isNaN(value)) { + gen.writeNumber(value.longValue()); + } else { + gen.writeNumber(value); + } + } +} diff --git a/src/main/java/com/whop/api/core/Environment.java b/src/main/java/com/whop/api/core/Environment.java new file mode 100644 index 00000000..2504b1c0 --- /dev/null +++ b/src/main/java/com/whop/api/core/Environment.java @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +public final class Environment { + public static final Environment DEFAULT = new Environment("https://api.whop.com/api/v1"); + + private final String url; + + private Environment(String url) { + this.url = url; + } + + public String getUrl() { + return this.url; + } + + public static Environment custom(String url) { + return new Environment(url); + } +} diff --git a/src/main/java/com/whop/api/core/FileStream.java b/src/main/java/com/whop/api/core/FileStream.java new file mode 100644 index 00000000..e447075b --- /dev/null +++ b/src/main/java/com/whop/api/core/FileStream.java @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import org.jetbrains.annotations.Nullable; + +/** + * Represents a file stream with associated metadata for file uploads. + */ +public class FileStream { + private final InputStream inputStream; + private final String fileName; + private final MediaType contentType; + + /** + * Constructs a FileStream with the given input stream and optional metadata. + * + * @param inputStream The input stream of the file content. Must not be null. + * @param fileName The name of the file, or null if unknown. + * @param contentType The MIME type of the file content, or null if unknown. + * @throws NullPointerException if inputStream is null + */ + public FileStream(InputStream inputStream, @Nullable String fileName, @Nullable MediaType contentType) { + this.inputStream = Objects.requireNonNull(inputStream, "Input stream cannot be null"); + this.fileName = fileName; + this.contentType = contentType; + } + + public FileStream(InputStream inputStream) { + this(inputStream, null, null); + } + + public InputStream getInputStream() { + return inputStream; + } + + @Nullable + public String getFileName() { + return fileName; + } + + @Nullable + public MediaType getContentType() { + return contentType; + } + + /** + * Creates a RequestBody suitable for use with OkHttp client. + * + * @return A RequestBody instance representing this file stream. + */ + public RequestBody toRequestBody() { + return new InputStreamRequestBody(contentType, inputStream); + } +} diff --git a/src/main/java/com/whop/api/core/ILogger.java b/src/main/java/com/whop/api/core/ILogger.java new file mode 100644 index 00000000..a360de54 --- /dev/null +++ b/src/main/java/com/whop/api/core/ILogger.java @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +/** + * Interface for custom logger implementations. + * + *

Implement this interface to provide a custom logging backend for the SDK. + * The SDK will call the appropriate method based on the log level. + * + *

Example: + *

{@code
+ * public class MyCustomLogger implements ILogger {
+ *     public void debug(String message) {
+ *         System.out.println("[DBG] " + message);
+ *     }
+ *     public void info(String message) {
+ *         System.out.println("[INF] " + message);
+ *     }
+ *     public void warn(String message) {
+ *         System.out.println("[WRN] " + message);
+ *     }
+ *     public void error(String message) {
+ *         System.out.println("[ERR] " + message);
+ *     }
+ * }
+ * }
+ */ +public interface ILogger { + void debug(String message); + + void info(String message); + + void warn(String message); + + void error(String message); +} diff --git a/src/main/java/com/whop/api/core/InputStreamRequestBody.java b/src/main/java/com/whop/api/core/InputStreamRequestBody.java new file mode 100644 index 00000000..d69de28f --- /dev/null +++ b/src/main/java/com/whop/api/core/InputStreamRequestBody.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import okio.BufferedSink; +import okio.Okio; +import okio.Source; +import org.jetbrains.annotations.Nullable; + +/** + * A custom implementation of OkHttp's RequestBody that wraps an InputStream. + * This class allows streaming of data from an InputStream directly to an HTTP request body, + * which is useful for file uploads or sending large amounts of data without loading it all into memory. + */ +public class InputStreamRequestBody extends RequestBody { + private final InputStream inputStream; + private final MediaType contentType; + + /** + * Constructs an InputStreamRequestBody with the specified content type and input stream. + * + * @param contentType the MediaType of the content, or null if not known + * @param inputStream the InputStream containing the data to be sent + * @throws NullPointerException if inputStream is null + */ + public InputStreamRequestBody(@Nullable MediaType contentType, InputStream inputStream) { + this.contentType = contentType; + this.inputStream = Objects.requireNonNull(inputStream, "inputStream == null"); + } + + /** + * Returns the content type of this request body. + * + * @return the MediaType of the content, or null if not specified + */ + @Nullable + @Override + public MediaType contentType() { + return contentType; + } + + /** + * Returns the content length of this request body, if known. + * This method attempts to determine the length using the InputStream's available() method, + * which may not always accurately reflect the total length of the stream. + * + * @return the content length, or -1 if the length is unknown + * @throws IOException if an I/O error occurs + */ + @Override + public long contentLength() throws IOException { + return inputStream.available() == 0 ? -1 : inputStream.available(); + } + + /** + * Writes the content of the InputStream to the given BufferedSink. + * This method is responsible for transferring the data from the InputStream to the network request. + * + * @param sink the BufferedSink to write the content to + * @throws IOException if an I/O error occurs during writing + */ + @Override + public void writeTo(BufferedSink sink) throws IOException { + try (Source source = Okio.source(inputStream)) { + sink.writeAll(source); + } + } +} diff --git a/src/main/java/com/whop/api/core/LogConfig.java b/src/main/java/com/whop/api/core/LogConfig.java new file mode 100644 index 00000000..7c8d4d0c --- /dev/null +++ b/src/main/java/com/whop/api/core/LogConfig.java @@ -0,0 +1,98 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +/** + * Configuration for SDK logging. + * + *

Use the builder to configure logging behavior: + *

{@code
+ * LogConfig config = LogConfig.builder()
+ *     .level(LogLevel.DEBUG)
+ *     .silent(false)
+ *     .build();
+ * }
+ * + *

Or with a custom logger: + *

{@code
+ * LogConfig config = LogConfig.builder()
+ *     .level(LogLevel.DEBUG)
+ *     .logger(new MyCustomLogger())
+ *     .silent(false)
+ *     .build();
+ * }
+ * + *

Defaults: + *

    + *
  • {@code level} — {@link LogLevel#INFO}
  • + *
  • {@code logger} — {@link ConsoleLogger} (writes to stderr via java.util.logging)
  • + *
  • {@code silent} — {@code true} (no output unless explicitly enabled)
  • + *
+ */ +public final class LogConfig { + + private final LogLevel level; + private final ILogger logger; + private final boolean silent; + + private LogConfig(LogLevel level, ILogger logger, boolean silent) { + this.level = level; + this.logger = logger; + this.silent = silent; + } + + public LogLevel level() { + return level; + } + + public ILogger logger() { + return logger; + } + + public boolean silent() { + return silent; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private LogLevel level = LogLevel.INFO; + private ILogger logger = new ConsoleLogger(); + private boolean silent = true; + + private Builder() {} + + /** + * Set the minimum log level. Only messages at this level or above will be logged. + * Defaults to {@link LogLevel#INFO}. + */ + public Builder level(LogLevel level) { + this.level = level; + return this; + } + + /** + * Set a custom logger implementation. Defaults to {@link ConsoleLogger}. + */ + public Builder logger(ILogger logger) { + this.logger = logger; + return this; + } + + /** + * Set whether logging is silent (disabled). Defaults to {@code true}. + * Set to {@code false} to enable log output. + */ + public Builder silent(boolean silent) { + this.silent = silent; + return this; + } + + public LogConfig build() { + return new LogConfig(level, logger, silent); + } + } +} diff --git a/src/main/java/com/whop/api/core/LogLevel.java b/src/main/java/com/whop/api/core/LogLevel.java new file mode 100644 index 00000000..6b9de74c --- /dev/null +++ b/src/main/java/com/whop/api/core/LogLevel.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +/** + * Log levels for SDK logging configuration. + * Silent by default — no log output unless explicitly configured. + */ +public enum LogLevel { + DEBUG(1), + INFO(2), + WARN(3), + ERROR(4); + + private final int value; + + LogLevel(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + /** + * Parse a log level from a string (case-insensitive). + * + * @param level the level string (debug, info, warn, error) + * @return the corresponding LogLevel + * @throws IllegalArgumentException if the string does not match any level + */ + public static LogLevel fromString(String level) { + return LogLevel.valueOf(level.toUpperCase()); + } +} diff --git a/src/main/java/com/whop/api/core/Logger.java b/src/main/java/com/whop/api/core/Logger.java new file mode 100644 index 00000000..544211e6 --- /dev/null +++ b/src/main/java/com/whop/api/core/Logger.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +/** + * SDK logger that filters messages based on level and silent mode. + * + *

Silent by default — no log output unless explicitly configured. + * Create via {@link LogConfig} or directly: + *

{@code
+ * Logger logger = new Logger(LogLevel.DEBUG, new ConsoleLogger(), false);
+ * logger.debug("request sent");
+ * }
+ */ +public final class Logger { + + private static final Logger DEFAULT = new Logger(LogLevel.INFO, new ConsoleLogger(), true); + + private final LogLevel level; + private final ILogger logger; + private final boolean silent; + + public Logger(LogLevel level, ILogger logger, boolean silent) { + this.level = level; + this.logger = logger; + this.silent = silent; + } + + /** + * Returns a default silent logger (no output). + */ + public static Logger getDefault() { + return DEFAULT; + } + + /** + * Creates a Logger from a {@link LogConfig}. If config is {@code null}, returns the default silent logger. + */ + public static Logger from(LogConfig config) { + if (config == null) { + return DEFAULT; + } + return new Logger(config.level(), config.logger(), config.silent()); + } + + /** + * Creates a Logger from an {@code Optional}. If empty, returns the default silent logger. + */ + public static Logger from(java.util.Optional config) { + return config.map(Logger::from).orElse(DEFAULT); + } + + private boolean shouldLog(LogLevel messageLevel) { + return !silent && level.getValue() <= messageLevel.getValue(); + } + + public boolean isDebug() { + return shouldLog(LogLevel.DEBUG); + } + + public boolean isInfo() { + return shouldLog(LogLevel.INFO); + } + + public boolean isWarn() { + return shouldLog(LogLevel.WARN); + } + + public boolean isError() { + return shouldLog(LogLevel.ERROR); + } + + public void debug(String message) { + if (isDebug()) { + logger.debug(message); + } + } + + public void info(String message) { + if (isInfo()) { + logger.info(message); + } + } + + public void warn(String message) { + if (isWarn()) { + logger.warn(message); + } + } + + public void error(String message) { + if (isError()) { + logger.error(message); + } + } +} diff --git a/src/main/java/com/whop/api/core/LoggingInterceptor.java b/src/main/java/com/whop/api/core/LoggingInterceptor.java new file mode 100644 index 00000000..d318a026 --- /dev/null +++ b/src/main/java/com/whop/api/core/LoggingInterceptor.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; +import okhttp3.Interceptor; +import okhttp3.Request; +import okhttp3.Response; + +/** + * OkHttp interceptor that logs HTTP requests and responses. + * + *

Logs request method, URL, and headers (with sensitive values redacted) at debug level. + * Logs response status at debug level, and 4xx/5xx responses at error level. + * Does nothing if the logger is silent. + */ +public final class LoggingInterceptor implements Interceptor { + + private static final Set SENSITIVE_HEADERS = new HashSet<>(Arrays.asList( + "authorization", + "www-authenticate", + "x-api-key", + "api-key", + "apikey", + "x-api-token", + "x-auth-token", + "auth-token", + "proxy-authenticate", + "proxy-authorization", + "cookie", + "set-cookie", + "x-csrf-token", + "x-xsrf-token", + "x-session-token", + "x-access-token")); + + private final Logger logger; + + public LoggingInterceptor(Logger logger) { + this.logger = logger; + } + + @Override + public Response intercept(Chain chain) throws IOException { + Request request = chain.request(); + + if (logger.isDebug()) { + StringBuilder sb = new StringBuilder(); + sb.append("HTTP Request: ").append(request.method()).append(" ").append(request.url()); + sb.append(" headers={"); + boolean first = true; + for (String name : request.headers().names()) { + if (!first) { + sb.append(", "); + } + sb.append(name).append("="); + if (SENSITIVE_HEADERS.contains(name.toLowerCase())) { + sb.append("[REDACTED]"); + } else { + sb.append(request.header(name)); + } + first = false; + } + sb.append("}"); + sb.append(" has_body=").append(request.body() != null); + logger.debug(sb.toString()); + } + + Response response = chain.proceed(request); + + if (logger.isDebug()) { + StringBuilder sb = new StringBuilder(); + sb.append("HTTP Response: status=").append(response.code()); + sb.append(" url=").append(response.request().url()); + sb.append(" headers={"); + boolean first = true; + for (String name : response.headers().names()) { + if (!first) { + sb.append(", "); + } + sb.append(name).append("="); + if (SENSITIVE_HEADERS.contains(name.toLowerCase())) { + sb.append("[REDACTED]"); + } else { + sb.append(response.header(name)); + } + first = false; + } + sb.append("}"); + logger.debug(sb.toString()); + } + + if (response.code() >= 400 && logger.isError()) { + logger.error("HTTP Error: status=" + response.code() + " url=" + + response.request().url()); + } + + return response; + } +} diff --git a/src/main/java/com/whop/api/core/MediaTypes.java b/src/main/java/com/whop/api/core/MediaTypes.java new file mode 100644 index 00000000..efc7ee06 --- /dev/null +++ b/src/main/java/com/whop/api/core/MediaTypes.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import okhttp3.MediaType; + +public final class MediaTypes { + + public static final MediaType APPLICATION_JSON = MediaType.parse("application/json"); + + private MediaTypes() {} +} diff --git a/src/main/java/com/whop/api/core/Nullable.java b/src/main/java/com/whop/api/core/Nullable.java new file mode 100644 index 00000000..2d971dba --- /dev/null +++ b/src/main/java/com/whop/api/core/Nullable.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.util.Optional; +import java.util.function.Function; + +public final class Nullable { + + private final Either, Null> value; + + private Nullable() { + this.value = Either.left(Optional.empty()); + } + + private Nullable(T value) { + if (value == null) { + this.value = Either.right(Null.INSTANCE); + } else { + this.value = Either.left(Optional.of(value)); + } + } + + public static Nullable ofNull() { + return new Nullable<>(null); + } + + public static Nullable of(T value) { + return new Nullable<>(value); + } + + public static Nullable empty() { + return new Nullable<>(); + } + + public static Nullable ofOptional(Optional value) { + if (value.isPresent()) { + return of(value.get()); + } else { + return empty(); + } + } + + public boolean isNull() { + return this.value.isRight(); + } + + public boolean isEmpty() { + return this.value.isLeft() && !this.value.getLeft().isPresent(); + } + + public T get() { + if (this.isNull()) { + return null; + } + + return this.value.getLeft().get(); + } + + public Nullable map(Function mapper) { + if (this.isNull()) { + return Nullable.ofNull(); + } + + return Nullable.ofOptional(this.value.getLeft().map(mapper)); + } + + @Override + public boolean equals(Object other) { + if (!(other instanceof Nullable)) { + return false; + } + + if (((Nullable) other).isNull() && this.isNull()) { + return true; + } + + return this.value.getLeft().equals(((Nullable) other).value.getLeft()); + } + + private static final class Either { + private L left = null; + private R right = null; + + private Either(L left, R right) { + if (left != null && right != null) { + throw new IllegalArgumentException("Left and right argument cannot both be non-null."); + } + + if (left == null && right == null) { + throw new IllegalArgumentException("Left and right argument cannot both be null."); + } + + if (left != null) { + this.left = left; + } + + if (right != null) { + this.right = right; + } + } + + public static Either left(L left) { + return new Either<>(left, null); + } + + public static Either right(R right) { + return new Either<>(null, right); + } + + public boolean isLeft() { + return this.left != null; + } + + public boolean isRight() { + return this.right != null; + } + + public L getLeft() { + if (!this.isLeft()) { + throw new IllegalArgumentException("Cannot get left from right Either."); + } + return this.left; + } + + public R getRight() { + if (!this.isRight()) { + throw new IllegalArgumentException("Cannot get right from left Either."); + } + return this.right; + } + } + + private static final class Null { + private static final Null INSTANCE = new Null(); + + private Null() {} + } +} diff --git a/src/main/java/com/whop/api/core/NullableNonemptyFilter.java b/src/main/java/com/whop/api/core/NullableNonemptyFilter.java new file mode 100644 index 00000000..070e4b13 --- /dev/null +++ b/src/main/java/com/whop/api/core/NullableNonemptyFilter.java @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.util.Optional; + +public final class NullableNonemptyFilter { + @Override + public boolean equals(Object o) { + boolean isOptionalEmpty = isOptionalEmpty(o); + + return isOptionalEmpty; + } + + private boolean isOptionalEmpty(Object o) { + if (o instanceof Optional) { + return !((Optional) o).isPresent(); + } + return false; + } +} diff --git a/src/main/java/com/whop/api/core/ObjectMappers.java b/src/main/java/com/whop/api/core/ObjectMappers.java new file mode 100644 index 00000000..4d377d54 --- /dev/null +++ b/src/main/java/com/whop/api/core/ObjectMappers.java @@ -0,0 +1,46 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.io.IOException; + +public final class ObjectMappers { + public static final ObjectMapper JSON_MAPPER = JsonMapper.builder() + .addModule(new Jdk8Module()) + .addModule(new JavaTimeModule()) + .addModule(DateTimeDeserializer.getModule()) + .addModule(DoubleSerializer.getModule()) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .build(); + + private ObjectMappers() {} + + public static String stringify(Object o) { + try { + return JSON_MAPPER + .setSerializationInclusion(JsonInclude.Include.ALWAYS) + .writerWithDefaultPrettyPrinter() + .writeValueAsString(o); + } catch (IOException e) { + return o.getClass().getName() + "@" + Integer.toHexString(o.hashCode()); + } + } + + public static Object parseErrorBody(String responseBodyString) { + try { + return JSON_MAPPER.readValue(responseBodyString, Object.class); + } catch (JsonProcessingException ignored) { + return responseBodyString; + } + } +} diff --git a/src/main/java/com/whop/api/core/QueryStringMapper.java b/src/main/java/com/whop/api/core/QueryStringMapper.java new file mode 100644 index 00000000..1c1a4527 --- /dev/null +++ b/src/main/java/com/whop/api/core/QueryStringMapper.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import okhttp3.HttpUrl; +import okhttp3.MultipartBody; + +public class QueryStringMapper { + + private static final ObjectMapper MAPPER = ObjectMappers.JSON_MAPPER; + + public static void addQueryParameter(HttpUrl.Builder httpUrl, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + httpUrl.addQueryParameter(key, valueNode.textValue()); + } else { + httpUrl.addQueryParameter(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().textValue()); + } else { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().toString()); + } + } + } + + public static void addFormDataPart( + MultipartBody.Builder multipartBody, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + multipartBody.addFormDataPart(key, valueNode.textValue()); + } else { + multipartBody.addFormDataPart(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().textValue()); + } else { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().toString()); + } + } + } + + public static List> flattenObject(ObjectNode object, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator> fields = object.fields(); + while (fields.hasNext()) { + Map.Entry field = fields.next(); + + String key = "[" + field.getKey() + "]"; + + if (field.getValue().isObject()) { + List> flatField = + flattenObject((ObjectNode) field.getValue(), arraysAsRepeats); + addAll(flat, flatField, key); + } else if (field.getValue().isArray()) { + List> flatField = + flattenArray((ArrayNode) field.getValue(), key, arraysAsRepeats); + addAll(flat, flatField, ""); + } else { + flat.add(new AbstractMap.SimpleEntry<>(key, field.getValue())); + } + } + + return flat; + } + + private static List> flattenArray( + ArrayNode array, String key, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator elements = array.elements(); + + int index = 0; + while (elements.hasNext()) { + JsonNode element = elements.next(); + + String indexKey = key + "[" + index + "]"; + + if (arraysAsRepeats) { + indexKey = key; + } + + if (element.isObject()) { + List> flatField = flattenObject((ObjectNode) element, arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else if (element.isArray()) { + List> flatField = flattenArray((ArrayNode) element, "", arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else { + flat.add(new AbstractMap.SimpleEntry<>(indexKey, element)); + } + + index++; + } + + return flat; + } + + private static void addAll( + List> target, List> source, String prefix) { + for (Map.Entry entry : source) { + Map.Entry entryToAdd = + new AbstractMap.SimpleEntry<>(prefix + entry.getKey(), entry.getValue()); + target.add(entryToAdd); + } + } +} diff --git a/src/main/java/com/whop/api/core/RequestOptions.java b/src/main/java/com/whop/api/core/RequestOptions.java new file mode 100644 index 00000000..acc9c43a --- /dev/null +++ b/src/main/java/com/whop/api/core/RequestOptions.java @@ -0,0 +1,168 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; + +public final class RequestOptions { + private final String token; + + private final String apiVersionDate; + + private final String idempotencyKey; + + private final Optional timeout; + + private final TimeUnit timeoutTimeUnit; + + private final Map headers; + + private final Map> headerSuppliers; + + private final Map queryParameters; + + private final Map> queryParameterSuppliers; + + private RequestOptions( + String token, + String apiVersionDate, + String idempotencyKey, + Optional timeout, + TimeUnit timeoutTimeUnit, + Map headers, + Map> headerSuppliers, + Map queryParameters, + Map> queryParameterSuppliers) { + this.token = token; + this.apiVersionDate = apiVersionDate; + this.idempotencyKey = idempotencyKey; + this.timeout = timeout; + this.timeoutTimeUnit = timeoutTimeUnit; + this.headers = headers; + this.headerSuppliers = headerSuppliers; + this.queryParameters = queryParameters; + this.queryParameterSuppliers = queryParameterSuppliers; + } + + public Optional getTimeout() { + return timeout; + } + + public TimeUnit getTimeoutTimeUnit() { + return timeoutTimeUnit; + } + + public Map getHeaders() { + Map headers = new HashMap<>(); + if (this.token != null) { + headers.put("Authorization", "Bearer " + this.token); + } + if (this.apiVersionDate != null) { + headers.put("Api-Version-Date", this.apiVersionDate); + } + if (this.idempotencyKey != null) { + headers.put("Idempotency-Key", this.idempotencyKey); + } + headers.putAll(this.headers); + this.headerSuppliers.forEach((key, supplier) -> { + headers.put(key, supplier.get()); + }); + return headers; + } + + public Map getQueryParameters() { + Map queryParameters = new HashMap<>(this.queryParameters); + this.queryParameterSuppliers.forEach((key, supplier) -> { + queryParameters.put(key, supplier.get()); + }); + return queryParameters; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String token = null; + + private String apiVersionDate = null; + + private String idempotencyKey = null; + + private Optional timeout = Optional.empty(); + + private TimeUnit timeoutTimeUnit = TimeUnit.SECONDS; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + private final Map queryParameters = new HashMap<>(); + + private final Map> queryParameterSuppliers = new HashMap<>(); + + public Builder token(String token) { + this.token = token; + return this; + } + + public Builder apiVersionDate(String apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + public Builder idempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + return this; + } + + public Builder timeout(Integer timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + public Builder timeout(Integer timeout, TimeUnit timeoutTimeUnit) { + this.timeout = Optional.of(timeout); + this.timeoutTimeUnit = timeoutTimeUnit; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + public Builder addQueryParameter(String key, String value) { + this.queryParameters.put(key, value); + return this; + } + + public Builder addQueryParameter(String key, Supplier value) { + this.queryParameterSuppliers.put(key, value); + return this; + } + + public RequestOptions build() { + return new RequestOptions( + token, + apiVersionDate, + idempotencyKey, + timeout, + timeoutTimeUnit, + headers, + headerSuppliers, + queryParameters, + queryParameterSuppliers); + } + } +} diff --git a/src/main/java/com/whop/api/core/ResponseBodyInputStream.java b/src/main/java/com/whop/api/core/ResponseBodyInputStream.java new file mode 100644 index 00000000..1fbb0b6d --- /dev/null +++ b/src/main/java/com/whop/api/core/ResponseBodyInputStream.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.io.FilterInputStream; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom InputStream that wraps the InputStream from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the stream is closed. + * + * This class extends FilterInputStream and takes an OkHttp Response object as a parameter. + * It retrieves the InputStream from the Response and overrides the close method to close + * both the InputStream and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyInputStream extends FilterInputStream { + private final Response response; + + /** + * Constructs a ResponseBodyInputStream that wraps the InputStream from the given OkHttp + * Response object. + * + * @param response the OkHttp Response object from which the InputStream is retrieved + * @throws IOException if an I/O error occurs while retrieving the InputStream + */ + public ResponseBodyInputStream(Response response) throws IOException { + super(response.body().byteStream()); + this.response = response; + } + + /** + * Closes the InputStream and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the stream is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the stream is closed + } +} diff --git a/src/main/java/com/whop/api/core/ResponseBodyReader.java b/src/main/java/com/whop/api/core/ResponseBodyReader.java new file mode 100644 index 00000000..8ff6fb50 --- /dev/null +++ b/src/main/java/com/whop/api/core/ResponseBodyReader.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.io.FilterReader; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom Reader that wraps the Reader from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the reader is closed. + * + * This class extends FilterReader and takes an OkHttp Response object as a parameter. + * It retrieves the Reader from the Response and overrides the close method to close + * both the Reader and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyReader extends FilterReader { + private final Response response; + + /** + * Constructs a ResponseBodyReader that wraps the Reader from the given OkHttp Response object. + * + * @param response the OkHttp Response object from which the Reader is retrieved + * @throws IOException if an I/O error occurs while retrieving the Reader + */ + public ResponseBodyReader(Response response) throws IOException { + super(response.body().charStream()); + this.response = response; + } + + /** + * Closes the Reader and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the reader is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the reader is closed + } +} diff --git a/src/main/java/com/whop/api/core/RetryInterceptor.java b/src/main/java/com/whop/api/core/RetryInterceptor.java new file mode 100644 index 00000000..06d05ae8 --- /dev/null +++ b/src/main/java/com/whop/api/core/RetryInterceptor.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.io.IOException; +import java.time.Duration; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; +import java.util.Optional; +import java.util.Random; +import okhttp3.Interceptor; +import okhttp3.Response; + +public class RetryInterceptor implements Interceptor { + + private static final Duration INITIAL_RETRY_DELAY = Duration.ofMillis(1000); + private static final Duration MAX_RETRY_DELAY = Duration.ofMillis(60000); + private static final double JITTER_FACTOR = 0.2; + + private final int maxRetries; + private final Random random = new Random(); + + public RetryInterceptor(int maxRetries) { + this.maxRetries = maxRetries; + } + + @Override + public Response intercept(Chain chain) throws IOException { + Response response = chain.proceed(chain.request()); + + if (shouldRetry(response.code())) { + return retryChain(response, chain); + } + + return response; + } + + private Response retryChain(Response response, Chain chain) throws IOException { + ExponentialBackoff backoff = new ExponentialBackoff(this.maxRetries); + Optional nextBackoff = backoff.nextBackoff(response); + while (nextBackoff.isPresent()) { + try { + Thread.sleep(nextBackoff.get().toMillis()); + } catch (InterruptedException e) { + throw new IOException("Interrupted while trying request", e); + } + response.close(); + response = chain.proceed(chain.request()); + if (shouldRetry(response.code())) { + nextBackoff = backoff.nextBackoff(response); + } else { + return response; + } + } + + return response; + } + + /** + * Calculates the retry delay from response headers, with fallback to exponential backoff. + * Priority: Retry-After > X-RateLimit-Reset > Exponential Backoff + */ + private Duration getRetryDelayFromHeaders(Response response, int retryAttempt) { + // Check for Retry-After header first (RFC 7231), with no jitter + String retryAfter = response.header("Retry-After"); + if (retryAfter != null) { + // Parse as number of seconds... + Optional secondsDelay = tryParseLong(retryAfter) + .map(seconds -> seconds * 1000) + .filter(delayMs -> delayMs > 0) + .map(delayMs -> Math.min(delayMs, MAX_RETRY_DELAY.toMillis())) + .map(Duration::ofMillis); + if (secondsDelay.isPresent()) { + return secondsDelay.get(); + } + + // ...or as an HTTP date; both are valid + Optional dateDelay = tryParseHttpDate(retryAfter) + .map(resetTime -> resetTime.toInstant().toEpochMilli() - System.currentTimeMillis()) + .filter(delayMs -> delayMs > 0) + .map(delayMs -> Math.min(delayMs, MAX_RETRY_DELAY.toMillis())) + .map(Duration::ofMillis); + if (dateDelay.isPresent()) { + return dateDelay.get(); + } + } + + // Then check for industry-standard X-RateLimit-Reset header, with positive jitter + String rateLimitReset = response.header("X-RateLimit-Reset"); + if (rateLimitReset != null) { + // Assume Unix timestamp in epoch seconds + Optional rateLimitDelay = tryParseLong(rateLimitReset) + .map(resetTimeSeconds -> (resetTimeSeconds * 1000) - System.currentTimeMillis()) + .filter(delayMs -> delayMs > 0) + .map(delayMs -> Math.min(delayMs, MAX_RETRY_DELAY.toMillis())) + .map(this::addPositiveJitter) + .map(Duration::ofMillis); + if (rateLimitDelay.isPresent()) { + return rateLimitDelay.get(); + } + } + + // Fall back to exponential backoff, with symmetric jitter + long baseDelay = INITIAL_RETRY_DELAY.toMillis() * (1L << retryAttempt); // 2^retryAttempt + long cappedDelay = Math.min(baseDelay, MAX_RETRY_DELAY.toMillis()); + return Duration.ofMillis(addSymmetricJitter(cappedDelay)); + } + + /** + * Attempts to parse a string as a long, returning empty Optional on failure. + */ + private Optional tryParseLong(String value) { + if (value == null) { + return Optional.empty(); + } + try { + return Optional.of(Long.parseLong(value)); + } catch (NumberFormatException e) { + return Optional.empty(); + } + } + + /** + * Attempts to parse a string as an HTTP date (RFC 1123), returning empty Optional on failure. + */ + private Optional tryParseHttpDate(String value) { + if (value == null) { + return Optional.empty(); + } + try { + return Optional.of(ZonedDateTime.parse(value, DateTimeFormatter.RFC_1123_DATE_TIME)); + } catch (DateTimeParseException e) { + return Optional.empty(); + } + } + + /** + * Adds positive jitter (100-120% of original value) to prevent thundering herd. + * Used for X-RateLimit-Reset header delays. + */ + private long addPositiveJitter(long delayMs) { + double jitterMultiplier = 1.0 + (random.nextDouble() * JITTER_FACTOR); + return (long) (delayMs * jitterMultiplier); + } + + /** + * Adds symmetric jitter (90-110% of original value) to prevent thundering herd. + * Used for exponential backoff delays. + */ + private long addSymmetricJitter(long delayMs) { + double jitterMultiplier = 1.0 + ((random.nextDouble() - 0.5) * JITTER_FACTOR); + return (long) (delayMs * jitterMultiplier); + } + + private static boolean shouldRetry(int statusCode) { + return statusCode == 408 || statusCode == 429 || statusCode >= 500; + } + + private final class ExponentialBackoff { + + private final int maxNumRetries; + + private int retryNumber = 0; + + ExponentialBackoff(int maxNumRetries) { + this.maxNumRetries = maxNumRetries; + } + + public Optional nextBackoff(Response response) { + if (retryNumber >= maxNumRetries) { + return Optional.empty(); + } + + Duration delay = getRetryDelayFromHeaders(response, retryNumber); + retryNumber += 1; + return Optional.of(delay); + } + } +} diff --git a/src/main/java/com/whop/api/core/Rfc2822DateTimeDeserializer.java b/src/main/java/com/whop/api/core/Rfc2822DateTimeDeserializer.java new file mode 100644 index 00000000..225937be --- /dev/null +++ b/src/main/java/com/whop/api/core/Rfc2822DateTimeDeserializer.java @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Custom deserializer that handles converting RFC 2822 (RFC 1123) dates into {@link OffsetDateTime} objects. + * This is used for fields with format "date-time-rfc-2822", such as Twilio's dateCreated, dateSent, dateUpdated. + */ +public class Rfc2822DateTimeDeserializer extends JsonDeserializer { + + @Override + public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException { + String raw = parser.getValueAsString(); + return ZonedDateTime.parse(raw, DateTimeFormatter.RFC_1123_DATE_TIME).toOffsetDateTime(); + } +} diff --git a/src/main/java/com/whop/api/core/SseEvent.java b/src/main/java/com/whop/api/core/SseEvent.java new file mode 100644 index 00000000..59bb65a6 --- /dev/null +++ b/src/main/java/com/whop/api/core/SseEvent.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; +import java.util.Optional; + +/** + * Represents a Server-Sent Event with all standard fields. + * Used for event-level discrimination where the discriminator is at the SSE envelope level. + * + * @param The type of the data field + */ +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonIgnoreProperties(ignoreUnknown = true) +public final class SseEvent { + private final String event; + private final T data; + private final String id; + private final Long retry; + + private SseEvent(String event, T data, String id, Long retry) { + this.event = event; + this.data = data; + this.id = id; + this.retry = retry; + } + + @JsonProperty("event") + public Optional getEvent() { + return Optional.ofNullable(event); + } + + @JsonProperty("data") + public T getData() { + return data; + } + + @JsonProperty("id") + public Optional getId() { + return Optional.ofNullable(id); + } + + @JsonProperty("retry") + public Optional getRetry() { + return Optional.ofNullable(retry); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SseEvent sseEvent = (SseEvent) o; + return Objects.equals(event, sseEvent.event) + && Objects.equals(data, sseEvent.data) + && Objects.equals(id, sseEvent.id) + && Objects.equals(retry, sseEvent.retry); + } + + @Override + public int hashCode() { + return Objects.hash(event, data, id, retry); + } + + @Override + public String toString() { + return "SseEvent{" + "event='" + + event + '\'' + ", data=" + + data + ", id='" + + id + '\'' + ", retry=" + + retry + '}'; + } + + public static Builder builder() { + return new Builder<>(); + } + + public static final class Builder { + private String event; + private T data; + private String id; + private Long retry; + + private Builder() {} + + public Builder event(String event) { + this.event = event; + return this; + } + + public Builder data(T data) { + this.data = data; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder retry(Long retry) { + this.retry = retry; + return this; + } + + public SseEvent build() { + return new SseEvent<>(event, data, id, retry); + } + } +} diff --git a/src/main/java/com/whop/api/core/SseEventParser.java b/src/main/java/com/whop/api/core/SseEventParser.java new file mode 100644 index 00000000..f18426e7 --- /dev/null +++ b/src/main/java/com/whop/api/core/SseEventParser.java @@ -0,0 +1,228 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.core.type.TypeReference; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Optional; +import java.util.Set; + +/** + * Utility class for parsing Server-Sent Events with support for discriminated unions. + *

+ * Handles two discrimination patterns: + *

    + *
  1. Data-level discrimination: The discriminator (e.g., 'type') is inside the JSON data payload. + * Jackson's polymorphic deserialization handles this automatically.
  2. + *
  3. Event-level discrimination: The discriminator (e.g., 'event') is at the SSE envelope level. + * This requires constructing the full SSE envelope for Jackson to process.
  4. + *
+ */ +public final class SseEventParser { + + private static final Set SSE_ENVELOPE_FIELDS = new HashSet<>(Arrays.asList("event", "data", "id", "retry")); + + private SseEventParser() { + // Utility class + } + + /** + * Parse an SSE event using event-level discrimination. + *

+ * Constructs the full SSE envelope object with event, data, id, and retry fields, + * then deserializes it to the target union type. + * + * @param eventType The SSE event type (from event: field) + * @param data The SSE data content (from data: field) + * @param id The SSE event ID (from id: field), may be null + * @param retry The SSE retry value (from retry: field), may be null + * @param unionClass The target union class + * @param discriminatorProperty The property name used for discrimination (e.g., "event") + * @param The target type + * @return The deserialized object + */ + public static T parseEventLevelUnion( + String eventType, String data, String id, Long retry, Class unionClass, String discriminatorProperty) { + try { + // Determine if data should be parsed as JSON based on the variant's expected type + Object parsedData = parseDataForVariant(eventType, data, unionClass, discriminatorProperty); + + // Construct the SSE envelope object + Map envelope = new HashMap<>(); + envelope.put(discriminatorProperty, eventType); + envelope.put("data", parsedData); + if (id != null) { + envelope.put("id", id); + } + if (retry != null) { + envelope.put("retry", retry); + } + + // Serialize to JSON and deserialize to target type + String envelopeJson = ObjectMappers.JSON_MAPPER.writeValueAsString(envelope); + return ObjectMappers.JSON_MAPPER.readValue(envelopeJson, unionClass); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SSE event with event-level discrimination", e); + } + } + + /** + * Parse an SSE event using data-level discrimination. + *

+ * Simply parses the data field as JSON and deserializes it to the target type. + * Jackson's polymorphic deserialization handles the discrimination automatically. + * + * @param data The SSE data content (from data: field) + * @param valueType The target type + * @param The target type + * @return The deserialized object + */ + public static T parseDataLevelUnion(String data, Class valueType) { + try { + return ObjectMappers.JSON_MAPPER.readValue(data, valueType); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SSE data with data-level discrimination", e); + } + } + + /** + * Determines if the given discriminator property indicates event-level discrimination. + * Event-level discrimination occurs when the discriminator is an SSE envelope field. + * + * @param discriminatorProperty The discriminator property name + * @return true if event-level discrimination, false otherwise + */ + public static boolean isEventLevelDiscrimination(String discriminatorProperty) { + return SSE_ENVELOPE_FIELDS.contains(discriminatorProperty); + } + + /** + * Attempts to find the discriminator property from the union class's Jackson annotations. + * + * @param unionClass The union class to inspect + * @return The discriminator property name, or empty if not found + */ + public static Optional findDiscriminatorProperty(Class unionClass) { + try { + // Look for JsonTypeInfo on the class itself + JsonTypeInfo typeInfo = unionClass.getAnnotation(JsonTypeInfo.class); + if (typeInfo != null && !typeInfo.property().isEmpty()) { + return Optional.of(typeInfo.property()); + } + + // Look for inner Value interface with JsonTypeInfo + for (Class innerClass : unionClass.getDeclaredClasses()) { + typeInfo = innerClass.getAnnotation(JsonTypeInfo.class); + if (typeInfo != null && !typeInfo.property().isEmpty()) { + return Optional.of(typeInfo.property()); + } + } + } catch (Exception e) { + // Ignore reflection errors + } + return Optional.empty(); + } + + /** + * Parse the data field based on what the matching variant expects. + * If the variant expects a String for its data field, returns the raw string. + * Otherwise, parses the data as JSON. + */ + private static Object parseDataForVariant( + String eventType, String data, Class unionClass, String discriminatorProperty) { + if (data == null || data.isEmpty()) { + return data; + } + + try { + // Try to find the variant class that matches this event type + Class variantClass = findVariantClass(unionClass, eventType, discriminatorProperty); + if (variantClass != null) { + // Check if the variant expects a String for the data field + Field dataField = findField(variantClass, "data"); + if (dataField != null && String.class.equals(dataField.getType())) { + // Variant expects String - return raw data + return data; + } + } + + // Try to parse as JSON + return ObjectMappers.JSON_MAPPER.readValue(data, new TypeReference>() {}); + } catch (Exception e) { + // If JSON parsing fails, return as string + return data; + } + } + + /** + * Find the variant class that matches the given discriminator value. + */ + private static Class findVariantClass( + Class unionClass, String discriminatorValue, String discriminatorProperty) { + try { + // Look for JsonSubTypes annotation + JsonSubTypes subTypes = findJsonSubTypes(unionClass); + if (subTypes == null) { + return null; + } + + for (JsonSubTypes.Type subType : subTypes.value()) { + JsonTypeName typeName = subType.value().getAnnotation(JsonTypeName.class); + if (typeName != null && typeName.value().equals(discriminatorValue)) { + return subType.value(); + } + // Also check the name attribute of @JsonSubTypes.Type + if (subType.name().equals(discriminatorValue)) { + return subType.value(); + } + } + } catch (Exception e) { + // Ignore reflection errors + } + return null; + } + + /** + * Find JsonSubTypes annotation on the class or its inner classes. + */ + private static JsonSubTypes findJsonSubTypes(Class unionClass) { + // Check the class itself + JsonSubTypes subTypes = unionClass.getAnnotation(JsonSubTypes.class); + if (subTypes != null) { + return subTypes; + } + + // Check inner classes (for Fern-style unions with inner Value interface) + for (Class innerClass : unionClass.getDeclaredClasses()) { + subTypes = innerClass.getAnnotation(JsonSubTypes.class); + if (subTypes != null) { + return subTypes; + } + } + return null; + } + + /** + * Find a field by name in a class, including private fields. + */ + private static Field findField(Class clazz, String fieldName) { + try { + return clazz.getDeclaredField(fieldName); + } catch (NoSuchFieldException e) { + // Check superclass + Class superClass = clazz.getSuperclass(); + if (superClass != null && superClass != Object.class) { + return findField(superClass, fieldName); + } + return null; + } + } +} diff --git a/src/main/java/com/whop/api/core/Stream.java b/src/main/java/com/whop/api/core/Stream.java new file mode 100644 index 00000000..02e88680 --- /dev/null +++ b/src/main/java/com/whop/api/core/Stream.java @@ -0,0 +1,513 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.io.Closeable; +import java.io.IOException; +import java.io.Reader; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.Scanner; + +/** + * The {@code Stream} class implements {@link Iterable} to provide a simple mechanism for reading and parsing + * objects of a given type from data streamed via a {@link Reader} using a specified delimiter. + *

+ * {@code Stream} assumes that data is being pushed to the provided {@link Reader} asynchronously and utilizes a + * {@code Scanner} to block during iteration if the next object is not available. + * Iterable stream for parsing JSON and Server-Sent Events (SSE) data. + * Supports both newline-delimited JSON and SSE with optional stream termination. + * + * @param The type of objects in the stream. + */ +public final class Stream implements Iterable, Closeable { + + private static final String NEWLINE = "\n"; + private static final String DATA_PREFIX = "data:"; + + public enum StreamType { + JSON, + SSE, + SSE_EVENT_DISCRIMINATED + } + + private final Class valueType; + private final Scanner scanner; + private final StreamType streamType; + private final String messageTerminator; + private final String streamTerminator; + private final Reader sseReader; + private final String discriminatorProperty; + private boolean isClosed = false; + + /** + * Constructs a new {@code Stream} with the specified value type, reader, and delimiter. + * + * @param valueType The class of the objects in the stream. + * @param reader The reader that provides the streamed data. + * @param delimiter The delimiter used to separate elements in the stream. + */ + public Stream(Class valueType, Reader reader, String delimiter) { + this.valueType = valueType; + this.scanner = new Scanner(reader).useDelimiter(delimiter); + this.streamType = StreamType.JSON; + this.messageTerminator = delimiter; + this.streamTerminator = null; + this.sseReader = null; + this.discriminatorProperty = null; + } + + private Stream(Class valueType, StreamType type, Reader reader, String terminator) { + this(valueType, type, reader, terminator, null); + } + + private Stream( + Class valueType, StreamType type, Reader reader, String terminator, String discriminatorProperty) { + this.valueType = valueType; + this.streamType = type; + this.discriminatorProperty = discriminatorProperty; + if (type == StreamType.JSON) { + this.scanner = new Scanner(reader).useDelimiter(terminator); + this.messageTerminator = terminator; + this.streamTerminator = null; + this.sseReader = null; + } else { + this.scanner = null; + this.messageTerminator = NEWLINE; + this.streamTerminator = terminator; + this.sseReader = reader; + } + } + + public static Stream fromJson(Class valueType, Reader reader, String delimiter) { + return new Stream<>(valueType, reader, delimiter); + } + + public static Stream fromJson(Class valueType, Reader reader) { + return new Stream<>(valueType, reader, NEWLINE); + } + + public static Stream fromSse(Class valueType, Reader sseReader) { + return new Stream<>(valueType, StreamType.SSE, sseReader, null); + } + + public static Stream fromSse(Class valueType, Reader sseReader, String streamTerminator) { + return new Stream<>(valueType, StreamType.SSE, sseReader, streamTerminator); + } + + /** + * Creates a stream from SSE data with event-level discrimination support. + * Use this when the SSE payload is a discriminated union where the discriminator + * is an SSE envelope field (e.g., 'event'). + * + * @param valueType The class of the objects in the stream. + * @param sseReader The reader that provides the SSE data. + * @param discriminatorProperty The property name used for discrimination (e.g., "event"). + * @param The type of objects in the stream. + * @return A new Stream instance configured for SSE with event-level discrimination. + */ + public static Stream fromSseWithEventDiscrimination( + Class valueType, Reader sseReader, String discriminatorProperty) { + return new Stream<>(valueType, StreamType.SSE_EVENT_DISCRIMINATED, sseReader, null, discriminatorProperty); + } + + /** + * Creates a stream from SSE data with event-level discrimination support and a stream terminator. + * + * @param valueType The class of the objects in the stream. + * @param sseReader The reader that provides the SSE data. + * @param discriminatorProperty The property name used for discrimination (e.g., "event"). + * @param streamTerminator The terminator string that signals end of stream (e.g., "[DONE]"). + * @param The type of objects in the stream. + * @return A new Stream instance configured for SSE with event-level discrimination. + */ + public static Stream fromSseWithEventDiscrimination( + Class valueType, Reader sseReader, String discriminatorProperty, String streamTerminator) { + return new Stream<>( + valueType, StreamType.SSE_EVENT_DISCRIMINATED, sseReader, streamTerminator, discriminatorProperty); + } + + @Override + public void close() throws IOException { + if (!isClosed) { + isClosed = true; + if (scanner != null) { + scanner.close(); + } + if (sseReader != null) { + sseReader.close(); + } + } + } + + private boolean isStreamClosed() { + return isClosed; + } + + /** + * Returns an iterator over the elements in this stream that blocks during iteration when the next object is + * not yet available. + * + * @return An iterator that can be used to traverse the elements in the stream. + */ + @Override + public Iterator iterator() { + switch (streamType) { + case SSE: + return new SSEIterator(); + case SSE_EVENT_DISCRIMINATED: + return new SSEEventDiscriminatedIterator(); + case JSON: + default: + return new JsonIterator(); + } + } + + private final class JsonIterator implements Iterator { + + /** + * Returns {@code true} if there are more elements in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return {@code true} if there are more elements, {@code false} otherwise. + */ + @Override + public boolean hasNext() { + if (isStreamClosed()) { + return false; + } + return scanner.hasNext(); + } + + /** + * Returns the next element in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return The next element in the stream. + * @throws NoSuchElementException If there are no more elements in the stream. + */ + @Override + public T next() { + if (isStreamClosed()) { + throw new NoSuchElementException("Stream is closed"); + } + + if (!scanner.hasNext()) { + throw new NoSuchElementException(); + } else { + try { + T parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(scanner.next().trim(), valueType); + return parsedResponse; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + } + + private final class SSEIterator implements Iterator { + private Scanner sseScanner; + private T nextItem; + private boolean hasNextItem = false; + private boolean endOfStream = false; + private StringBuilder eventDataBuffer = new StringBuilder(); + private String currentEventType = null; + + private SSEIterator() { + if (sseReader != null && !isStreamClosed()) { + this.sseScanner = new Scanner(sseReader); + } else { + this.endOfStream = true; + } + } + + @Override + public boolean hasNext() { + if (isStreamClosed() || endOfStream) { + return false; + } + + if (hasNextItem) { + return true; + } + + return readNextMessage(); + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException("No more elements in stream"); + } + + T result = nextItem; + nextItem = null; + hasNextItem = false; + return result; + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + private boolean readNextMessage() { + if (sseScanner == null || isStreamClosed()) { + endOfStream = true; + return false; + } + + try { + while (sseScanner.hasNextLine()) { + String line = sseScanner.nextLine(); + + if (line.trim().isEmpty()) { + if (eventDataBuffer.length() > 0) { + try { + nextItem = ObjectMappers.JSON_MAPPER.readValue(eventDataBuffer.toString(), valueType); + hasNextItem = true; + eventDataBuffer.setLength(0); + currentEventType = null; + return true; + } catch (Exception parseEx) { + System.err.println("Failed to parse SSE event: " + parseEx.getMessage()); + eventDataBuffer.setLength(0); + currentEventType = null; + continue; + } + } + continue; + } + + if (line.startsWith(DATA_PREFIX)) { + String dataContent = line.substring(DATA_PREFIX.length()); + if (dataContent.startsWith(" ")) { + dataContent = dataContent.substring(1); + } + + if (eventDataBuffer.length() == 0 + && streamTerminator != null + && dataContent.trim().equals(streamTerminator)) { + endOfStream = true; + return false; + } + + if (eventDataBuffer.length() > 0) { + eventDataBuffer.append('\n'); + } + eventDataBuffer.append(dataContent); + } else if (line.startsWith("event:")) { + String eventValue = line.length() > 6 ? line.substring(6) : ""; + if (eventValue.startsWith(" ")) { + eventValue = eventValue.substring(1); + } + currentEventType = eventValue; + } else if (line.startsWith("id:")) { + // Event ID field (ignored) + } else if (line.startsWith("retry:")) { + // Retry field (ignored) + } else if (line.startsWith(":")) { + // Comment line (ignored) + } + } + + if (eventDataBuffer.length() > 0) { + try { + nextItem = ObjectMappers.JSON_MAPPER.readValue(eventDataBuffer.toString(), valueType); + hasNextItem = true; + eventDataBuffer.setLength(0); + currentEventType = null; + return true; + } catch (Exception parseEx) { + System.err.println("Failed to parse final SSE event: " + parseEx.getMessage()); + eventDataBuffer.setLength(0); + currentEventType = null; + } + } + + endOfStream = true; + return false; + + } catch (Exception e) { + System.err.println("Failed to parse SSE stream: " + e.getMessage()); + endOfStream = true; + return false; + } + } + } + + /** + * Iterator for SSE streams with event-level discrimination. + * Uses SseEventParser to construct the full SSE envelope for Jackson deserialization. + */ + private final class SSEEventDiscriminatedIterator implements Iterator { + private Scanner sseScanner; + private T nextItem; + private boolean hasNextItem = false; + private boolean endOfStream = false; + private StringBuilder eventDataBuffer = new StringBuilder(); + private String currentEventType = null; + private String currentEventId = null; + private Long currentRetry = null; + + private SSEEventDiscriminatedIterator() { + if (sseReader != null && !isStreamClosed()) { + this.sseScanner = new Scanner(sseReader); + } else { + this.endOfStream = true; + } + } + + @Override + public boolean hasNext() { + if (isStreamClosed() || endOfStream) { + return false; + } + + if (hasNextItem) { + return true; + } + + return readNextMessage(); + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException("No more elements in stream"); + } + + T result = nextItem; + nextItem = null; + hasNextItem = false; + return result; + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + private boolean readNextMessage() { + if (sseScanner == null || isStreamClosed()) { + endOfStream = true; + return false; + } + + try { + while (sseScanner.hasNextLine()) { + String line = sseScanner.nextLine(); + + if (line.trim().isEmpty()) { + if (eventDataBuffer.length() > 0 || currentEventType != null) { + try { + // Use SseEventParser for event-level discrimination + nextItem = SseEventParser.parseEventLevelUnion( + currentEventType, + eventDataBuffer.toString(), + currentEventId, + currentRetry, + valueType, + discriminatorProperty); + hasNextItem = true; + resetEventState(); + return true; + } catch (Exception parseEx) { + System.err.println("Failed to parse SSE event: " + parseEx.getMessage()); + resetEventState(); + continue; + } + } + continue; + } + + if (line.startsWith(DATA_PREFIX)) { + String dataContent = line.substring(DATA_PREFIX.length()); + if (dataContent.startsWith(" ")) { + dataContent = dataContent.substring(1); + } + + if (eventDataBuffer.length() == 0 + && streamTerminator != null + && dataContent.trim().equals(streamTerminator)) { + endOfStream = true; + return false; + } + + if (eventDataBuffer.length() > 0) { + eventDataBuffer.append('\n'); + } + eventDataBuffer.append(dataContent); + } else if (line.startsWith("event:")) { + String eventValue = line.length() > 6 ? line.substring(6) : ""; + if (eventValue.startsWith(" ")) { + eventValue = eventValue.substring(1); + } + currentEventType = eventValue; + } else if (line.startsWith("id:")) { + String idValue = line.length() > 3 ? line.substring(3) : ""; + if (idValue.startsWith(" ")) { + idValue = idValue.substring(1); + } + currentEventId = idValue; + } else if (line.startsWith("retry:")) { + String retryValue = line.length() > 6 ? line.substring(6) : ""; + if (retryValue.startsWith(" ")) { + retryValue = retryValue.substring(1); + } + try { + currentRetry = Long.parseLong(retryValue.trim()); + } catch (NumberFormatException e) { + // Ignore invalid retry values + } + } else if (line.startsWith(":")) { + // Comment line (ignored) + } + } + + // Handle any remaining buffered data at end of stream + if (eventDataBuffer.length() > 0 || currentEventType != null) { + try { + nextItem = SseEventParser.parseEventLevelUnion( + currentEventType, + eventDataBuffer.toString(), + currentEventId, + currentRetry, + valueType, + discriminatorProperty); + hasNextItem = true; + resetEventState(); + return true; + } catch (Exception parseEx) { + System.err.println("Failed to parse final SSE event: " + parseEx.getMessage()); + resetEventState(); + } + } + + endOfStream = true; + return false; + + } catch (Exception e) { + System.err.println("Failed to parse SSE stream: " + e.getMessage()); + endOfStream = true; + return false; + } + } + + private void resetEventState() { + eventDataBuffer.setLength(0); + currentEventType = null; + currentEventId = null; + currentRetry = null; + } + } +} diff --git a/src/main/java/com/whop/api/core/Suppliers.java b/src/main/java/com/whop/api/core/Suppliers.java new file mode 100644 index 00000000..402ff351 --- /dev/null +++ b/src/main/java/com/whop/api/core/Suppliers.java @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +public final class Suppliers { + private Suppliers() {} + + public static Supplier memoize(Supplier delegate) { + AtomicReference value = new AtomicReference<>(); + return () -> { + T val = value.get(); + if (val == null) { + val = value.updateAndGet(cur -> cur == null ? Objects.requireNonNull(delegate.get()) : cur); + } + return val; + }; + } +} diff --git a/src/main/java/com/whop/api/core/WhopApiApiException.java b/src/main/java/com/whop/api/core/WhopApiApiException.java new file mode 100644 index 00000000..70482519 --- /dev/null +++ b/src/main/java/com/whop/api/core/WhopApiApiException.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.Response; + +/** + * This exception type will be thrown for any non-2XX API responses. + */ +public class WhopApiApiException extends WhopApiException { + /** + * The error code of the response that triggered the exception. + */ + private final int statusCode; + + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + private final Map> headers; + + public WhopApiApiException(String message, int statusCode, Object body) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + } + + public WhopApiApiException(String message, int statusCode, Object body, Response rawResponse) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + this.headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + } + + /** + * @return the statusCode + */ + public int statusCode() { + return this.statusCode; + } + + /** + * @return the body + */ + public Object body() { + return this.body; + } + + /** + * @return the headers + */ + public Map> headers() { + return this.headers; + } + + @Override + public String toString() { + return "WhopApiApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + + ObjectMappers.stringify(body) + "}"; + } +} diff --git a/src/main/java/com/whop/api/core/WhopApiException.java b/src/main/java/com/whop/api/core/WhopApiException.java new file mode 100644 index 00000000..8aee7f3b --- /dev/null +++ b/src/main/java/com/whop/api/core/WhopApiException.java @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +/** + * This class serves as the base exception for all errors in the SDK. + */ +public class WhopApiException extends RuntimeException { + public WhopApiException(String message) { + super(message); + } + + public WhopApiException(String message, Exception e) { + super(message, e); + } +} diff --git a/src/main/java/com/whop/api/core/WhopApiHttpResponse.java b/src/main/java/com/whop/api/core/WhopApiHttpResponse.java new file mode 100644 index 00000000..781727d9 --- /dev/null +++ b/src/main/java/com/whop/api/core/WhopApiHttpResponse.java @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.Response; + +public final class WhopApiHttpResponse { + + private final T body; + + private final Map> headers; + + public WhopApiHttpResponse(T body, Response rawResponse) { + this.body = body; + + Map> headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + this.headers = headers; + } + + public T body() { + return this.body; + } + + public Map> headers() { + return headers; + } +} diff --git a/src/main/java/com/whop/api/core/pagination/BasePage.java b/src/main/java/com/whop/api/core/pagination/BasePage.java new file mode 100644 index 00000000..018435bd --- /dev/null +++ b/src/main/java/com/whop/api/core/pagination/BasePage.java @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core.pagination; + +import java.util.List; +import java.util.Optional; + +public abstract class BasePage { + private final boolean hasNext; + private final List items; + private final Object response; + + public BasePage(boolean hasNext, List items, Object response) { + this.hasNext = hasNext; + this.items = items; + this.response = response; + } + + public boolean hasNext() { + return !items.isEmpty() && hasNext; + } + + public List getItems() { + return items; + } + + /** + * Returns the full response object for accessing pagination metadata like cursor tokens. + * + * @return Optional containing the response, or empty if unavailable + */ + public Optional getResponse() { + @SuppressWarnings("unchecked") + R typedResponse = (R) response; + return Optional.ofNullable(typedResponse); + } +} diff --git a/src/main/java/com/whop/api/core/pagination/SyncPage.java b/src/main/java/com/whop/api/core/pagination/SyncPage.java new file mode 100644 index 00000000..5a6b386b --- /dev/null +++ b/src/main/java/com/whop/api/core/pagination/SyncPage.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core.pagination; + +import java.util.List; +import java.util.NoSuchElementException; +import java.util.function.Supplier; + +public class SyncPage extends BasePage { + protected final Supplier> nextSupplier; + + public SyncPage(boolean hasNext, List items, Object response, Supplier> nextSupplier) { + super(hasNext, items, response); + this.nextSupplier = nextSupplier; + } + + public SyncPage nextPage() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + return nextSupplier.get(); + } +} diff --git a/src/main/java/com/whop/api/core/pagination/SyncPagingIterable.java b/src/main/java/com/whop/api/core/pagination/SyncPagingIterable.java new file mode 100644 index 00000000..9b8feede --- /dev/null +++ b/src/main/java/com/whop/api/core/pagination/SyncPagingIterable.java @@ -0,0 +1,63 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core.pagination; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Optional; +import java.util.function.Supplier; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +public class SyncPagingIterable extends SyncPage implements Iterable { + + public SyncPagingIterable( + boolean hasNext, List items, Object response, Supplier> getNext) { + super(hasNext, items, response, getNext); + } + + public SyncPagingIterable( + boolean hasNext, Optional> items, Object response, Supplier> getNext) { + super(hasNext, items.orElse(new ArrayList<>()), response, getNext); + } + + public Stream streamItems() { + return StreamSupport.stream(this.spliterator(), false); + } + + @Override + public Iterator iterator() { + return new Iterator() { + private Iterator itemsIterator = getItems().iterator(); + private SyncPage currentPage = SyncPagingIterable.this; + + @Override + public boolean hasNext() { + if (itemsIterator.hasNext()) { + return true; + } + if (currentPage.hasNext()) { + advancePage(); + return itemsIterator.hasNext(); + } + return false; + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + return itemsIterator.next(); + } + + private void advancePage() { + currentPage = currentPage.nextPage(); + itemsIterator = currentPage.getItems().iterator(); + } + }; + } +} diff --git a/src/main/java/com/whop/api/errors/BadRequestError.java b/src/main/java/com/whop/api/errors/BadRequestError.java new file mode 100644 index 00000000..8cc64cc7 --- /dev/null +++ b/src/main/java/com/whop/api/errors/BadRequestError.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.errors; + +import com.whop.api.core.WhopApiApiException; +import okhttp3.Response; + +public final class BadRequestError extends WhopApiApiException { + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + public BadRequestError(Object body) { + super("BadRequestError", 400, body); + this.body = body; + } + + public BadRequestError(Object body, Response rawResponse) { + super("BadRequestError", 400, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public Object body() { + return this.body; + } +} diff --git a/src/main/java/com/whop/api/errors/ConflictError.java b/src/main/java/com/whop/api/errors/ConflictError.java new file mode 100644 index 00000000..58179570 --- /dev/null +++ b/src/main/java/com/whop/api/errors/ConflictError.java @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.errors; + +import com.whop.api.core.WhopApiApiException; +import com.whop.api.types.V1ErrorResponse; +import okhttp3.Response; + +public final class ConflictError extends WhopApiApiException { + /** + * The body of the response that triggered the exception. + */ + private final V1ErrorResponse body; + + public ConflictError(V1ErrorResponse body) { + super("ConflictError", 409, body); + this.body = body; + } + + public ConflictError(V1ErrorResponse body, Response rawResponse) { + super("ConflictError", 409, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public V1ErrorResponse body() { + return this.body; + } +} diff --git a/src/main/java/com/whop/api/errors/ForbiddenError.java b/src/main/java/com/whop/api/errors/ForbiddenError.java new file mode 100644 index 00000000..eaa11b70 --- /dev/null +++ b/src/main/java/com/whop/api/errors/ForbiddenError.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.errors; + +import com.whop.api.core.WhopApiApiException; +import okhttp3.Response; + +public final class ForbiddenError extends WhopApiApiException { + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + public ForbiddenError(Object body) { + super("ForbiddenError", 403, body); + this.body = body; + } + + public ForbiddenError(Object body, Response rawResponse) { + super("ForbiddenError", 403, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public Object body() { + return this.body; + } +} diff --git a/src/main/java/com/whop/api/errors/InternalServerError.java b/src/main/java/com/whop/api/errors/InternalServerError.java new file mode 100644 index 00000000..d1aa3d3d --- /dev/null +++ b/src/main/java/com/whop/api/errors/InternalServerError.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.errors; + +import com.whop.api.core.WhopApiApiException; +import okhttp3.Response; + +public final class InternalServerError extends WhopApiApiException { + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + public InternalServerError(Object body) { + super("InternalServerError", 500, body); + this.body = body; + } + + public InternalServerError(Object body, Response rawResponse) { + super("InternalServerError", 500, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public Object body() { + return this.body; + } +} diff --git a/src/main/java/com/whop/api/errors/NotFoundError.java b/src/main/java/com/whop/api/errors/NotFoundError.java new file mode 100644 index 00000000..625224a3 --- /dev/null +++ b/src/main/java/com/whop/api/errors/NotFoundError.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.errors; + +import com.whop.api.core.WhopApiApiException; +import okhttp3.Response; + +public final class NotFoundError extends WhopApiApiException { + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + public NotFoundError(Object body) { + super("NotFoundError", 404, body); + this.body = body; + } + + public NotFoundError(Object body, Response rawResponse) { + super("NotFoundError", 404, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public Object body() { + return this.body; + } +} diff --git a/src/main/java/com/whop/api/errors/PaymentRequiredError.java b/src/main/java/com/whop/api/errors/PaymentRequiredError.java new file mode 100644 index 00000000..9c865766 --- /dev/null +++ b/src/main/java/com/whop/api/errors/PaymentRequiredError.java @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.errors; + +import com.whop.api.core.WhopApiApiException; +import com.whop.api.types.PaymentRequiredErrorBody; +import okhttp3.Response; + +public final class PaymentRequiredError extends WhopApiApiException { + /** + * The body of the response that triggered the exception. + */ + private final PaymentRequiredErrorBody body; + + public PaymentRequiredError(PaymentRequiredErrorBody body) { + super("PaymentRequiredError", 402, body); + this.body = body; + } + + public PaymentRequiredError(PaymentRequiredErrorBody body, Response rawResponse) { + super("PaymentRequiredError", 402, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public PaymentRequiredErrorBody body() { + return this.body; + } +} diff --git a/src/main/java/com/whop/api/errors/ServiceUnavailableError.java b/src/main/java/com/whop/api/errors/ServiceUnavailableError.java new file mode 100644 index 00000000..554d0b83 --- /dev/null +++ b/src/main/java/com/whop/api/errors/ServiceUnavailableError.java @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.errors; + +import com.whop.api.core.WhopApiApiException; +import com.whop.api.types.V1ErrorResponse; +import okhttp3.Response; + +public final class ServiceUnavailableError extends WhopApiApiException { + /** + * The body of the response that triggered the exception. + */ + private final V1ErrorResponse body; + + public ServiceUnavailableError(V1ErrorResponse body) { + super("ServiceUnavailableError", 503, body); + this.body = body; + } + + public ServiceUnavailableError(V1ErrorResponse body, Response rawResponse) { + super("ServiceUnavailableError", 503, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public V1ErrorResponse body() { + return this.body; + } +} diff --git a/src/main/java/com/whop/api/errors/TooManyRequestsError.java b/src/main/java/com/whop/api/errors/TooManyRequestsError.java new file mode 100644 index 00000000..12b37547 --- /dev/null +++ b/src/main/java/com/whop/api/errors/TooManyRequestsError.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.errors; + +import com.whop.api.core.WhopApiApiException; +import okhttp3.Response; + +public final class TooManyRequestsError extends WhopApiApiException { + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + public TooManyRequestsError(Object body) { + super("TooManyRequestsError", 429, body); + this.body = body; + } + + public TooManyRequestsError(Object body, Response rawResponse) { + super("TooManyRequestsError", 429, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public Object body() { + return this.body; + } +} diff --git a/src/main/java/com/whop/api/errors/UnauthorizedError.java b/src/main/java/com/whop/api/errors/UnauthorizedError.java new file mode 100644 index 00000000..5b297c11 --- /dev/null +++ b/src/main/java/com/whop/api/errors/UnauthorizedError.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.errors; + +import com.whop.api.core.WhopApiApiException; +import okhttp3.Response; + +public final class UnauthorizedError extends WhopApiApiException { + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + public UnauthorizedError(Object body) { + super("UnauthorizedError", 401, body); + this.body = body; + } + + public UnauthorizedError(Object body, Response rawResponse) { + super("UnauthorizedError", 401, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public Object body() { + return this.body; + } +} diff --git a/src/main/java/com/whop/api/errors/UnprocessableEntityError.java b/src/main/java/com/whop/api/errors/UnprocessableEntityError.java new file mode 100644 index 00000000..0452f85b --- /dev/null +++ b/src/main/java/com/whop/api/errors/UnprocessableEntityError.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.errors; + +import com.whop.api.core.WhopApiApiException; +import okhttp3.Response; + +public final class UnprocessableEntityError extends WhopApiApiException { + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + public UnprocessableEntityError(Object body) { + super("UnprocessableEntityError", 422, body); + this.body = body; + } + + public UnprocessableEntityError(Object body, Response rawResponse) { + super("UnprocessableEntityError", 422, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public Object body() { + return this.body; + } +} diff --git a/src/main/java/com/whop/api/resources/accesstokens/AccessTokensClient.java b/src/main/java/com/whop/api/resources/accesstokens/AccessTokensClient.java new file mode 100644 index 00000000..c1a3a32c --- /dev/null +++ b/src/main/java/com/whop/api/resources/accesstokens/AccessTokensClient.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accesstokens; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.accesstokens.requests.CreateAccessTokensRequest; +import com.whop.api.types.AccessToken; + +public class AccessTokensClient { + protected final ClientOptions clientOptions; + + private final RawAccessTokensClient rawClient; + + public AccessTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAccessTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAccessTokensClient withRawResponse() { + return this.rawClient; + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public AccessToken create() { + return this.rawClient.create().body(); + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public AccessToken create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).body(); + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public AccessToken create(CreateAccessTokensRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public AccessToken create(CreateAccessTokensRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/accesstokens/AsyncAccessTokensClient.java b/src/main/java/com/whop/api/resources/accesstokens/AsyncAccessTokensClient.java new file mode 100644 index 00000000..207e257f --- /dev/null +++ b/src/main/java/com/whop/api/resources/accesstokens/AsyncAccessTokensClient.java @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accesstokens; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.accesstokens.requests.CreateAccessTokensRequest; +import com.whop.api.types.AccessToken; +import java.util.concurrent.CompletableFuture; + +public class AsyncAccessTokensClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAccessTokensClient rawClient; + + public AsyncAccessTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAccessTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAccessTokensClient withRawResponse() { + return this.rawClient; + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public CompletableFuture create() { + return this.rawClient.create().thenApply(response -> response.body()); + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public CompletableFuture create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).thenApply(response -> response.body()); + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public CompletableFuture create(CreateAccessTokensRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public CompletableFuture create(CreateAccessTokensRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/accesstokens/AsyncRawAccessTokensClient.java b/src/main/java/com/whop/api/resources/accesstokens/AsyncRawAccessTokensClient.java new file mode 100644 index 00000000..4806511a --- /dev/null +++ b/src/main/java/com/whop/api/resources/accesstokens/AsyncRawAccessTokensClient.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accesstokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.accesstokens.requests.CreateAccessTokensRequest; +import com.whop.api.types.AccessToken; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAccessTokensClient { + protected final ClientOptions clientOptions; + + public AsyncRawAccessTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public CompletableFuture> create() { + return create(CreateAccessTokensRequest.builder().build()); + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public CompletableFuture> create(RequestOptions requestOptions) { + return create(CreateAccessTokensRequest.builder().build(), requestOptions); + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public CompletableFuture> create(CreateAccessTokensRequest request) { + return create(request, null); + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public CompletableFuture> create( + CreateAccessTokensRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("access_tokens"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AccessToken.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/accesstokens/RawAccessTokensClient.java b/src/main/java/com/whop/api/resources/accesstokens/RawAccessTokensClient.java new file mode 100644 index 00000000..0cbdbcc9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accesstokens/RawAccessTokensClient.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accesstokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.accesstokens.requests.CreateAccessTokensRequest; +import com.whop.api.types.AccessToken; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAccessTokensClient { + protected final ClientOptions clientOptions; + + public RawAccessTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public WhopApiHttpResponse create() { + return create(CreateAccessTokensRequest.builder().build()); + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public WhopApiHttpResponse create(RequestOptions requestOptions) { + return create(CreateAccessTokensRequest.builder().build(), requestOptions); + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public WhopApiHttpResponse create(CreateAccessTokensRequest request) { + return create(request, null); + } + + /** + * Create a short-lived access token for authenticating API requests. When using API key authentication, provide company_id or user_id. When using OAuth, the user is derived from the token. Use this token with Whop's web and mobile embedded components. + */ + public WhopApiHttpResponse create(CreateAccessTokensRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("access_tokens"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AccessToken.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/accesstokens/requests/CreateAccessTokensRequest.java b/src/main/java/com/whop/api/resources/accesstokens/requests/CreateAccessTokensRequest.java new file mode 100644 index 00000000..23dce2ba --- /dev/null +++ b/src/main/java/com/whop/api/resources/accesstokens/requests/CreateAccessTokensRequest.java @@ -0,0 +1,288 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accesstokens.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAccessTokensRequest.Builder.class) +public final class CreateAccessTokensRequest { + private final Optional companyId; + + private final Optional expiresAt; + + private final Optional> scopedActions; + + private final Optional userId; + + private final Map additionalProperties; + + private CreateAccessTokensRequest( + Optional companyId, + Optional expiresAt, + Optional> scopedActions, + Optional userId, + Map additionalProperties) { + this.companyId = companyId; + this.expiresAt = expiresAt; + this.scopedActions = scopedActions; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the company to generate the token for, starting with 'biz_'. The API key must have permission to access this company. + */ + @JsonIgnore + public Optional getCompanyId() { + if (companyId == null) { + return Optional.empty(); + } + return companyId; + } + + /** + * @return The expiration timestamp for the access token. Defaults to 1 hour from now, with a maximum of 3 hours. + */ + @JsonIgnore + public Optional getExpiresAt() { + if (expiresAt == null) { + return Optional.empty(); + } + return expiresAt; + } + + /** + * @return An array of permission scopes to grant to the access token. If empty or omitted, all permissions from the authenticating credential are inherited. Must be a subset of the credential's permissions. + */ + @JsonIgnore + public Optional> getScopedActions() { + if (scopedActions == null) { + return Optional.empty(); + } + return scopedActions; + } + + /** + * @return The unique identifier of the user to generate the token for, starting with 'user_'. The API key must have permission to access this user. + */ + @JsonIgnore + public Optional getUserId() { + if (userId == null) { + return Optional.empty(); + } + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company_id") + private Optional _getCompanyId() { + return companyId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expires_at") + private Optional _getExpiresAt() { + return expiresAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("scoped_actions") + private Optional> _getScopedActions() { + return scopedActions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_id") + private Optional _getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAccessTokensRequest && equalTo((CreateAccessTokensRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAccessTokensRequest other) { + return companyId.equals(other.companyId) + && expiresAt.equals(other.expiresAt) + && scopedActions.equals(other.scopedActions) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.expiresAt, this.scopedActions, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional companyId = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + private Optional> scopedActions = Optional.empty(); + + private Optional userId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAccessTokensRequest other) { + companyId(other.getCompanyId()); + expiresAt(other.getExpiresAt()); + scopedActions(other.getScopedActions()); + userId(other.getUserId()); + return this; + } + + /** + *

The unique identifier of the company to generate the token for, starting with 'biz_'. The API key must have permission to access this company.

+ */ + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + public Builder companyId(Nullable companyId) { + if (companyId.isNull()) { + this.companyId = null; + } else if (companyId.isEmpty()) { + this.companyId = Optional.empty(); + } else { + this.companyId = Optional.of(companyId.get()); + } + return this; + } + + /** + *

The expiration timestamp for the access token. Defaults to 1 hour from now, with a maximum of 3 hours.

+ */ + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public Builder expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + public Builder expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + public Builder expiresAt(Nullable expiresAt) { + if (expiresAt.isNull()) { + this.expiresAt = null; + } else if (expiresAt.isEmpty()) { + this.expiresAt = Optional.empty(); + } else { + this.expiresAt = Optional.of(expiresAt.get()); + } + return this; + } + + /** + *

An array of permission scopes to grant to the access token. If empty or omitted, all permissions from the authenticating credential are inherited. Must be a subset of the credential's permissions.

+ */ + @JsonSetter(value = "scoped_actions", nulls = Nulls.SKIP) + public Builder scopedActions(Optional> scopedActions) { + this.scopedActions = scopedActions; + return this; + } + + public Builder scopedActions(List scopedActions) { + this.scopedActions = Optional.ofNullable(scopedActions); + return this; + } + + public Builder scopedActions(Nullable> scopedActions) { + if (scopedActions.isNull()) { + this.scopedActions = null; + } else if (scopedActions.isEmpty()) { + this.scopedActions = Optional.empty(); + } else { + this.scopedActions = Optional.of(scopedActions.get()); + } + return this; + } + + /** + *

The unique identifier of the user to generate the token for, starting with 'user_'. The API key must have permission to access this user.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + public Builder userId(Nullable userId) { + if (userId.isNull()) { + this.userId = null; + } else if (userId.isEmpty()) { + this.userId = Optional.empty(); + } else { + this.userId = Optional.of(userId.get()); + } + return this; + } + + public CreateAccessTokensRequest build() { + return new CreateAccessTokensRequest(companyId, expiresAt, scopedActions, userId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accountlinks/AccountLinksClient.java b/src/main/java/com/whop/api/resources/accountlinks/AccountLinksClient.java new file mode 100644 index 00000000..adc181f4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accountlinks/AccountLinksClient.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accountlinks; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.accountlinks.requests.CreateAccountLinksRequest; +import com.whop.api.types.AccountLink; + +public class AccountLinksClient { + protected final ClientOptions clientOptions; + + private final RawAccountLinksClient rawClient; + + public AccountLinksClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAccountLinksClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAccountLinksClient withRawResponse() { + return this.rawClient; + } + + /** + * Generate a URL that directs a sub-merchant to their account portal, such as the hosted payouts dashboard or the KYC onboarding flow. + */ + public AccountLink create(CreateAccountLinksRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Generate a URL that directs a sub-merchant to their account portal, such as the hosted payouts dashboard or the KYC onboarding flow. + */ + public AccountLink create(CreateAccountLinksRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/accountlinks/AsyncAccountLinksClient.java b/src/main/java/com/whop/api/resources/accountlinks/AsyncAccountLinksClient.java new file mode 100644 index 00000000..0532979e --- /dev/null +++ b/src/main/java/com/whop/api/resources/accountlinks/AsyncAccountLinksClient.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accountlinks; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.accountlinks.requests.CreateAccountLinksRequest; +import com.whop.api.types.AccountLink; +import java.util.concurrent.CompletableFuture; + +public class AsyncAccountLinksClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAccountLinksClient rawClient; + + public AsyncAccountLinksClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAccountLinksClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAccountLinksClient withRawResponse() { + return this.rawClient; + } + + /** + * Generate a URL that directs a sub-merchant to their account portal, such as the hosted payouts dashboard or the KYC onboarding flow. + */ + public CompletableFuture create(CreateAccountLinksRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Generate a URL that directs a sub-merchant to their account portal, such as the hosted payouts dashboard or the KYC onboarding flow. + */ + public CompletableFuture create(CreateAccountLinksRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/accountlinks/AsyncRawAccountLinksClient.java b/src/main/java/com/whop/api/resources/accountlinks/AsyncRawAccountLinksClient.java new file mode 100644 index 00000000..6e1b86e4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accountlinks/AsyncRawAccountLinksClient.java @@ -0,0 +1,149 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accountlinks; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.accountlinks.requests.CreateAccountLinksRequest; +import com.whop.api.types.AccountLink; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAccountLinksClient { + protected final ClientOptions clientOptions; + + public AsyncRawAccountLinksClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Generate a URL that directs a sub-merchant to their account portal, such as the hosted payouts dashboard or the KYC onboarding flow. + */ + public CompletableFuture> create(CreateAccountLinksRequest request) { + return create(request, null); + } + + /** + * Generate a URL that directs a sub-merchant to their account portal, such as the hosted payouts dashboard or the KYC onboarding flow. + */ + public CompletableFuture> create( + CreateAccountLinksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("account_links"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AccountLink.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/accountlinks/RawAccountLinksClient.java b/src/main/java/com/whop/api/resources/accountlinks/RawAccountLinksClient.java new file mode 100644 index 00000000..dd7f524a --- /dev/null +++ b/src/main/java/com/whop/api/resources/accountlinks/RawAccountLinksClient.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accountlinks; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.accountlinks.requests.CreateAccountLinksRequest; +import com.whop.api.types.AccountLink; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAccountLinksClient { + protected final ClientOptions clientOptions; + + public RawAccountLinksClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Generate a URL that directs a sub-merchant to their account portal, such as the hosted payouts dashboard or the KYC onboarding flow. + */ + public WhopApiHttpResponse create(CreateAccountLinksRequest request) { + return create(request, null); + } + + /** + * Generate a URL that directs a sub-merchant to their account portal, such as the hosted payouts dashboard or the KYC onboarding flow. + */ + public WhopApiHttpResponse create(CreateAccountLinksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("account_links"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AccountLink.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/accountlinks/requests/CreateAccountLinksRequest.java b/src/main/java/com/whop/api/resources/accountlinks/requests/CreateAccountLinksRequest.java new file mode 100644 index 00000000..b20c428d --- /dev/null +++ b/src/main/java/com/whop/api/resources/accountlinks/requests/CreateAccountLinksRequest.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accountlinks.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AccountLinkUseCases; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAccountLinksRequest.Builder.class) +public final class CreateAccountLinksRequest { + private final String companyId; + + private final String refreshUrl; + + private final String returnUrl; + + private final AccountLinkUseCases useCase; + + private final Map additionalProperties; + + private CreateAccountLinksRequest( + String companyId, + String refreshUrl, + String returnUrl, + AccountLinkUseCases useCase, + Map additionalProperties) { + this.companyId = companyId; + this.refreshUrl = refreshUrl; + this.returnUrl = returnUrl; + this.useCase = useCase; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the company to generate the link for, starting with 'biz_'. Must be a sub-merchant of the API key's company. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return The URL to redirect the user to if the session expires and needs to be re-authenticated, such as 'https://example.com/refresh'. + */ + @JsonProperty("refresh_url") + public String getRefreshUrl() { + return refreshUrl; + } + + /** + * @return The URL to redirect the user to when they want to return to your site, such as 'https://example.com/return'. + */ + @JsonProperty("return_url") + public String getReturnUrl() { + return returnUrl; + } + + /** + * @return The purpose of the account link, such as hosted payouts portal or hosted KYC onboarding. + */ + @JsonProperty("use_case") + public AccountLinkUseCases getUseCase() { + return useCase; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAccountLinksRequest && equalTo((CreateAccountLinksRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAccountLinksRequest other) { + return companyId.equals(other.companyId) + && refreshUrl.equals(other.refreshUrl) + && returnUrl.equals(other.returnUrl) + && useCase.equals(other.useCase); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.refreshUrl, this.returnUrl, this.useCase); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to generate the link for, starting with 'biz_'. Must be a sub-merchant of the API key's company.

+ */ + RefreshUrlStage companyId(@NotNull String companyId); + + Builder from(CreateAccountLinksRequest other); + } + + public interface RefreshUrlStage { + /** + *

The URL to redirect the user to if the session expires and needs to be re-authenticated, such as 'https://example.com/refresh'.

+ */ + ReturnUrlStage refreshUrl(@NotNull String refreshUrl); + } + + public interface ReturnUrlStage { + /** + *

The URL to redirect the user to when they want to return to your site, such as 'https://example.com/return'.

+ */ + UseCaseStage returnUrl(@NotNull String returnUrl); + } + + public interface UseCaseStage { + /** + *

The purpose of the account link, such as hosted payouts portal or hosted KYC onboarding.

+ */ + _FinalStage useCase(@NotNull AccountLinkUseCases useCase); + } + + public interface _FinalStage { + CreateAccountLinksRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CompanyIdStage, RefreshUrlStage, ReturnUrlStage, UseCaseStage, _FinalStage { + private String companyId; + + private String refreshUrl; + + private String returnUrl; + + private AccountLinkUseCases useCase; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAccountLinksRequest other) { + companyId(other.getCompanyId()); + refreshUrl(other.getRefreshUrl()); + returnUrl(other.getReturnUrl()); + useCase(other.getUseCase()); + return this; + } + + /** + *

The unique identifier of the company to generate the link for, starting with 'biz_'. Must be a sub-merchant of the API key's company.

+ *

The unique identifier of the company to generate the link for, starting with 'biz_'. Must be a sub-merchant of the API key's company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public RefreshUrlStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The URL to redirect the user to if the session expires and needs to be re-authenticated, such as 'https://example.com/refresh'.

+ *

The URL to redirect the user to if the session expires and needs to be re-authenticated, such as 'https://example.com/refresh'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("refresh_url") + public ReturnUrlStage refreshUrl(@NotNull String refreshUrl) { + this.refreshUrl = Objects.requireNonNull(refreshUrl, "refreshUrl must not be null"); + return this; + } + + /** + *

The URL to redirect the user to when they want to return to your site, such as 'https://example.com/return'.

+ *

The URL to redirect the user to when they want to return to your site, such as 'https://example.com/return'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("return_url") + public UseCaseStage returnUrl(@NotNull String returnUrl) { + this.returnUrl = Objects.requireNonNull(returnUrl, "returnUrl must not be null"); + return this; + } + + /** + *

The purpose of the account link, such as hosted payouts portal or hosted KYC onboarding.

+ *

The purpose of the account link, such as hosted payouts portal or hosted KYC onboarding.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("use_case") + public _FinalStage useCase(@NotNull AccountLinkUseCases useCase) { + this.useCase = Objects.requireNonNull(useCase, "useCase must not be null"); + return this; + } + + @java.lang.Override + public CreateAccountLinksRequest build() { + return new CreateAccountLinksRequest(companyId, refreshUrl, returnUrl, useCase, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/AccountsClient.java b/src/main/java/com/whop/api/resources/accounts/AccountsClient.java new file mode 100644 index 00000000..9d45d56d --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/AccountsClient.java @@ -0,0 +1,209 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.accounts.preferences.PreferencesClient; +import com.whop.api.resources.accounts.requests.CreateAccountsRequest; +import com.whop.api.resources.accounts.requests.FormCompanyAccountsRequest; +import com.whop.api.resources.accounts.requests.ListAccountsRequest; +import com.whop.api.resources.accounts.requests.RetrieveAccountsRequest; +import com.whop.api.resources.accounts.requests.TransferOwnershipAccountsRequest; +import com.whop.api.resources.accounts.requests.UpdateAccountsRequest; +import com.whop.api.resources.accounts.reserves.ReservesClient; +import com.whop.api.resources.accounts.types.FormCompanyAccountsResponse; +import com.whop.api.resources.accounts.types.TransferOwnershipAccountsResponse; +import com.whop.api.types.Account; +import java.util.function.Supplier; + +public class AccountsClient { + protected final ClientOptions clientOptions; + + private final RawAccountsClient rawClient; + + protected final Supplier preferencesClient; + + protected final Supplier reservesClient; + + public AccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAccountsClient(clientOptions); + this.preferencesClient = Suppliers.memoize(() -> new PreferencesClient(clientOptions)); + this.reservesClient = Suppliers.memoize(() -> new ReservesClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAccountsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public SyncPagingIterable list(ListAccountsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public SyncPagingIterable list(ListAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public Account create() { + return this.rawClient.create().body(); + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public Account create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).body(); + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public Account create(CreateAccountsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public Account create(CreateAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the account associated with the current Account API key. + */ + public Account me() { + return this.rawClient.me().body(); + } + + /** + * Retrieves the account associated with the current Account API key. + */ + public Account me(RequestOptions requestOptions) { + return this.rawClient.me(requestOptions).body(); + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public Account retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public Account retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public Account retrieve(String id, RetrieveAccountsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public Account retrieve(String id, RetrieveAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public Account update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public Account update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public Account update(String id, UpdateAccountsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public Account update(String id, UpdateAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Starts an LLC or C-Corp formation for a business account. Defaults to an LLC; set entity_type to c_corp to form a C-Corp, which additionally requires share_structure and officer roles on every founder. On submission, the application is validated and the response returns a hosted checkout URL. Once paid, the filing is submitted. Track progress through the account's company_formation field on Retrieve Account. + */ + public FormCompanyAccountsResponse formCompany(String id, FormCompanyAccountsRequest request) { + return this.rawClient.formCompany(id, request).body(); + } + + /** + * Starts an LLC or C-Corp formation for a business account. Defaults to an LLC; set entity_type to c_corp to form a C-Corp, which additionally requires share_structure and officer roles on every founder. On submission, the application is validated and the response returns a hosted checkout URL. Once paid, the filing is submitted. Track progress through the account's company_formation field on Retrieve Account. + */ + public FormCompanyAccountsResponse formCompany( + String id, FormCompanyAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.formCompany(id, request, requestOptions).body(); + } + + /** + * Transfers ownership of the account to another user, identified by user ID or email address. If the recipient already holds the owner role, ownership moves immediately; otherwise they get an invite and ownership moves when they accept. + */ + public TransferOwnershipAccountsResponse transferOwnership(String id, TransferOwnershipAccountsRequest request) { + return this.rawClient.transferOwnership(id, request).body(); + } + + /** + * Transfers ownership of the account to another user, identified by user ID or email address. If the recipient already holds the owner role, ownership moves immediately; otherwise they get an invite and ownership moves when they accept. + */ + public TransferOwnershipAccountsResponse transferOwnership( + String id, TransferOwnershipAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.transferOwnership(id, request, requestOptions).body(); + } + + public PreferencesClient preferences() { + return this.preferencesClient.get(); + } + + public ReservesClient reserves() { + return this.reservesClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/AsyncAccountsClient.java b/src/main/java/com/whop/api/resources/accounts/AsyncAccountsClient.java new file mode 100644 index 00000000..166c4943 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/AsyncAccountsClient.java @@ -0,0 +1,213 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.accounts.preferences.AsyncPreferencesClient; +import com.whop.api.resources.accounts.requests.CreateAccountsRequest; +import com.whop.api.resources.accounts.requests.FormCompanyAccountsRequest; +import com.whop.api.resources.accounts.requests.ListAccountsRequest; +import com.whop.api.resources.accounts.requests.RetrieveAccountsRequest; +import com.whop.api.resources.accounts.requests.TransferOwnershipAccountsRequest; +import com.whop.api.resources.accounts.requests.UpdateAccountsRequest; +import com.whop.api.resources.accounts.reserves.AsyncReservesClient; +import com.whop.api.resources.accounts.types.FormCompanyAccountsResponse; +import com.whop.api.resources.accounts.types.TransferOwnershipAccountsResponse; +import com.whop.api.types.Account; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class AsyncAccountsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAccountsClient rawClient; + + protected final Supplier preferencesClient; + + protected final Supplier reservesClient; + + public AsyncAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAccountsClient(clientOptions); + this.preferencesClient = Suppliers.memoize(() -> new AsyncPreferencesClient(clientOptions)); + this.reservesClient = Suppliers.memoize(() -> new AsyncReservesClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAccountsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public CompletableFuture> list(ListAccountsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public CompletableFuture> list( + ListAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public CompletableFuture create() { + return this.rawClient.create().thenApply(response -> response.body()); + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public CompletableFuture create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public CompletableFuture create(CreateAccountsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public CompletableFuture create(CreateAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the account associated with the current Account API key. + */ + public CompletableFuture me() { + return this.rawClient.me().thenApply(response -> response.body()); + } + + /** + * Retrieves the account associated with the current Account API key. + */ + public CompletableFuture me(RequestOptions requestOptions) { + return this.rawClient.me(requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public CompletableFuture retrieve(String id, RetrieveAccountsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public CompletableFuture retrieve( + String id, RetrieveAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public CompletableFuture update(String id, UpdateAccountsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public CompletableFuture update(String id, UpdateAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Starts an LLC or C-Corp formation for a business account. Defaults to an LLC; set entity_type to c_corp to form a C-Corp, which additionally requires share_structure and officer roles on every founder. On submission, the application is validated and the response returns a hosted checkout URL. Once paid, the filing is submitted. Track progress through the account's company_formation field on Retrieve Account. + */ + public CompletableFuture formCompany(String id, FormCompanyAccountsRequest request) { + return this.rawClient.formCompany(id, request).thenApply(response -> response.body()); + } + + /** + * Starts an LLC or C-Corp formation for a business account. Defaults to an LLC; set entity_type to c_corp to form a C-Corp, which additionally requires share_structure and officer roles on every founder. On submission, the application is validated and the response returns a hosted checkout URL. Once paid, the filing is submitted. Track progress through the account's company_formation field on Retrieve Account. + */ + public CompletableFuture formCompany( + String id, FormCompanyAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.formCompany(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Transfers ownership of the account to another user, identified by user ID or email address. If the recipient already holds the owner role, ownership moves immediately; otherwise they get an invite and ownership moves when they accept. + */ + public CompletableFuture transferOwnership( + String id, TransferOwnershipAccountsRequest request) { + return this.rawClient.transferOwnership(id, request).thenApply(response -> response.body()); + } + + /** + * Transfers ownership of the account to another user, identified by user ID or email address. If the recipient already holds the owner role, ownership moves immediately; otherwise they get an invite and ownership moves when they accept. + */ + public CompletableFuture transferOwnership( + String id, TransferOwnershipAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.transferOwnership(id, request, requestOptions).thenApply(response -> response.body()); + } + + public AsyncPreferencesClient preferences() { + return this.preferencesClient.get(); + } + + public AsyncReservesClient reserves() { + return this.reservesClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/AsyncRawAccountsClient.java b/src/main/java/com/whop/api/resources/accounts/AsyncRawAccountsClient.java new file mode 100644 index 00000000..e2b00128 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/AsyncRawAccountsClient.java @@ -0,0 +1,786 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.accounts.requests.CreateAccountsRequest; +import com.whop.api.resources.accounts.requests.FormCompanyAccountsRequest; +import com.whop.api.resources.accounts.requests.ListAccountsRequest; +import com.whop.api.resources.accounts.requests.RetrieveAccountsRequest; +import com.whop.api.resources.accounts.requests.TransferOwnershipAccountsRequest; +import com.whop.api.resources.accounts.requests.UpdateAccountsRequest; +import com.whop.api.resources.accounts.types.FormCompanyAccountsResponse; +import com.whop.api.resources.accounts.types.ListAccountsResponse; +import com.whop.api.resources.accounts.types.TransferOwnershipAccountsResponse; +import com.whop.api.types.Account; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAccountsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public CompletableFuture>> list() { + return list(ListAccountsRequest.builder().build()); + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(ListAccountsRequest.builder().build(), requestOptions); + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public CompletableFuture>> list(ListAccountsRequest request) { + return list(request, null); + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public CompletableFuture>> list( + ListAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts"); + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getVolumeMin().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "volume_min", request.getVolumeMin().get(), false); + } + if (request.getVolumeMax().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "volume_max", request.getVolumeMax().get(), false); + } + if (request.getParentAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "parent_account_id", request.getParentAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAccountsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAccountsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListAccountsRequest nextRequest = ListAccountsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable(startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public CompletableFuture> create() { + return create(CreateAccountsRequest.builder().build()); + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public CompletableFuture> create(RequestOptions requestOptions) { + return create(CreateAccountsRequest.builder().build(), requestOptions); + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public CompletableFuture> create(CreateAccountsRequest request) { + return create(request, null); + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public CompletableFuture> create( + CreateAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Account.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the account associated with the current Account API key. + */ + public CompletableFuture> me() { + return me(null); + } + + /** + * Retrieves the account associated with the current Account API key. + */ + public CompletableFuture> me(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts/me"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Account.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveAccountsRequest.builder().build()); + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAccountsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public CompletableFuture> retrieve(String id, RetrieveAccountsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public CompletableFuture> retrieve( + String id, RetrieveAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Account.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateAccountsRequest.builder().build()); + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateAccountsRequest.builder().build(), requestOptions); + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public CompletableFuture> update(String id, UpdateAccountsRequest request) { + return update(id, request, null); + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public CompletableFuture> update( + String id, UpdateAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Account.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Starts an LLC or C-Corp formation for a business account. Defaults to an LLC; set entity_type to c_corp to form a C-Corp, which additionally requires share_structure and officer roles on every founder. On submission, the application is validated and the response returns a hosted checkout URL. Once paid, the filing is submitted. Track progress through the account's company_formation field on Retrieve Account. + */ + public CompletableFuture> formCompany( + String id, FormCompanyAccountsRequest request) { + return formCompany(id, request, null); + } + + /** + * Starts an LLC or C-Corp formation for a business account. Defaults to an LLC; set entity_type to c_corp to form a C-Corp, which additionally requires share_structure and officer roles on every founder. On submission, the application is validated and the response returns a hosted checkout URL. Once paid, the filing is submitted. Track progress through the account's company_formation field on Retrieve Account. + */ + public CompletableFuture> formCompany( + String id, FormCompanyAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts") + .addPathSegment(id) + .addPathSegments("form_company"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, FormCompanyAccountsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Transfers ownership of the account to another user, identified by user ID or email address. If the recipient already holds the owner role, ownership moves immediately; otherwise they get an invite and ownership moves when they accept. + */ + public CompletableFuture> transferOwnership( + String id, TransferOwnershipAccountsRequest request) { + return transferOwnership(id, request, null); + } + + /** + * Transfers ownership of the account to another user, identified by user ID or email address. If the recipient already holds the owner role, ownership moves immediately; otherwise they get an invite and ownership moves when they accept. + */ + public CompletableFuture> transferOwnership( + String id, TransferOwnershipAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts") + .addPathSegment(id) + .addPathSegments("transfer_ownership"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, TransferOwnershipAccountsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/RawAccountsClient.java b/src/main/java/com/whop/api/resources/accounts/RawAccountsClient.java new file mode 100644 index 00000000..15309301 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/RawAccountsClient.java @@ -0,0 +1,637 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.accounts.requests.CreateAccountsRequest; +import com.whop.api.resources.accounts.requests.FormCompanyAccountsRequest; +import com.whop.api.resources.accounts.requests.ListAccountsRequest; +import com.whop.api.resources.accounts.requests.RetrieveAccountsRequest; +import com.whop.api.resources.accounts.requests.TransferOwnershipAccountsRequest; +import com.whop.api.resources.accounts.requests.UpdateAccountsRequest; +import com.whop.api.resources.accounts.types.FormCompanyAccountsResponse; +import com.whop.api.resources.accounts.types.ListAccountsResponse; +import com.whop.api.resources.accounts.types.TransferOwnershipAccountsResponse; +import com.whop.api.types.Account; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAccountsClient { + protected final ClientOptions clientOptions; + + public RawAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public WhopApiHttpResponse> list() { + return list(ListAccountsRequest.builder().build()); + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListAccountsRequest.builder().build(), requestOptions); + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public WhopApiHttpResponse> list(ListAccountsRequest request) { + return list(request, null); + } + + /** + * Lists accounts visible to the credential. User tokens return the user's business accounts; Account API keys return the requesting account and its connected accounts. Pass parent_account_id to return only that parent account's connected accounts. + */ + public WhopApiHttpResponse> list( + ListAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts"); + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getVolumeMin().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "volume_min", request.getVolumeMin().get(), false); + } + if (request.getVolumeMax().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "volume_max", request.getVolumeMax().get(), false); + } + if (request.getParentAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "parent_account_id", request.getParentAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAccountsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAccountsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListAccountsRequest nextRequest = ListAccountsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public WhopApiHttpResponse create() { + return create(CreateAccountsRequest.builder().build()); + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public WhopApiHttpResponse create(RequestOptions requestOptions) { + return create(CreateAccountsRequest.builder().build(), requestOptions); + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public WhopApiHttpResponse create(CreateAccountsRequest request) { + return create(request, null); + } + + /** + * Creates an account. User tokens create business accounts; Account API keys create connected accounts. Tax fields (tax_remitted_by, tax_type, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation. + */ + public WhopApiHttpResponse create(CreateAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Account.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the account associated with the current Account API key. + */ + public WhopApiHttpResponse me() { + return me(null); + } + + /** + * Retrieves the account associated with the current Account API key. + */ + public WhopApiHttpResponse me(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts/me"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Account.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveAccountsRequest.builder().build()); + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAccountsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveAccountsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single account by ID or public route when it is visible to the credential, including its crypto wallet. The reserved id me retrieves the account associated with the current Account API key; user tokens have no single account, so they must address one by ID or route. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Account.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateAccountsRequest.builder().build()); + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateAccountsRequest.builder().build(), requestOptions); + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public WhopApiHttpResponse update(String id, UpdateAccountsRequest request) { + return update(id, request, null); + } + + /** + * Updates an account. User tokens can update business accounts; Account API keys can update connected accounts. The reserved id me — accepted on Retrieve Account — resolves to the requesting account, which an Account API key cannot edit, so updates must name the connected account by its biz_ id. + */ + public WhopApiHttpResponse update( + String id, UpdateAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Account.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Starts an LLC or C-Corp formation for a business account. Defaults to an LLC; set entity_type to c_corp to form a C-Corp, which additionally requires share_structure and officer roles on every founder. On submission, the application is validated and the response returns a hosted checkout URL. Once paid, the filing is submitted. Track progress through the account's company_formation field on Retrieve Account. + */ + public WhopApiHttpResponse formCompany(String id, FormCompanyAccountsRequest request) { + return formCompany(id, request, null); + } + + /** + * Starts an LLC or C-Corp formation for a business account. Defaults to an LLC; set entity_type to c_corp to form a C-Corp, which additionally requires share_structure and officer roles on every founder. On submission, the application is validated and the response returns a hosted checkout URL. Once paid, the filing is submitted. Track progress through the account's company_formation field on Retrieve Account. + */ + public WhopApiHttpResponse formCompany( + String id, FormCompanyAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts") + .addPathSegment(id) + .addPathSegments("form_company"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, FormCompanyAccountsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Transfers ownership of the account to another user, identified by user ID or email address. If the recipient already holds the owner role, ownership moves immediately; otherwise they get an invite and ownership moves when they accept. + */ + public WhopApiHttpResponse transferOwnership( + String id, TransferOwnershipAccountsRequest request) { + return transferOwnership(id, request, null); + } + + /** + * Transfers ownership of the account to another user, identified by user ID or email address. If the recipient already holds the owner role, ownership moves immediately; otherwise they get an invite and ownership moves when they accept. + */ + public WhopApiHttpResponse transferOwnership( + String id, TransferOwnershipAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts") + .addPathSegment(id) + .addPathSegments("transfer_ownership"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, TransferOwnershipAccountsResponse.class), + response); + } + try { + switch (response.code()) { + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/AsyncPreferencesClient.java b/src/main/java/com/whop/api/resources/accounts/preferences/AsyncPreferencesClient.java new file mode 100644 index 00000000..ae442c75 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/AsyncPreferencesClient.java @@ -0,0 +1,89 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.accounts.preferences.requests.RetrievePreferencesRequest; +import com.whop.api.resources.accounts.preferences.requests.UpdatePreferencesRequest; +import com.whop.api.resources.accounts.preferences.types.RetrievePreferencesResponse; +import com.whop.api.resources.accounts.preferences.types.UpdatePreferencesResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncPreferencesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPreferencesClient rawClient; + + public AsyncPreferencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPreferencesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPreferencesClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public CompletableFuture retrieve(String accountId) { + return this.rawClient.retrieve(accountId).thenApply(response -> response.body()); + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public CompletableFuture retrieve(String accountId, RequestOptions requestOptions) { + return this.rawClient.retrieve(accountId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public CompletableFuture retrieve( + String accountId, RetrievePreferencesRequest request) { + return this.rawClient.retrieve(accountId, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public CompletableFuture retrieve( + String accountId, RetrievePreferencesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(accountId, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public CompletableFuture update(String accountId) { + return this.rawClient.update(accountId).thenApply(response -> response.body()); + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public CompletableFuture update(String accountId, RequestOptions requestOptions) { + return this.rawClient.update(accountId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public CompletableFuture update(String accountId, UpdatePreferencesRequest request) { + return this.rawClient.update(accountId, request).thenApply(response -> response.body()); + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public CompletableFuture update( + String accountId, UpdatePreferencesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(accountId, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/AsyncRawPreferencesClient.java b/src/main/java/com/whop/api/resources/accounts/preferences/AsyncRawPreferencesClient.java new file mode 100644 index 00000000..660981a8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/AsyncRawPreferencesClient.java @@ -0,0 +1,247 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.accounts.preferences.requests.RetrievePreferencesRequest; +import com.whop.api.resources.accounts.preferences.requests.UpdatePreferencesRequest; +import com.whop.api.resources.accounts.preferences.types.RetrievePreferencesResponse; +import com.whop.api.resources.accounts.preferences.types.UpdatePreferencesResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPreferencesClient { + protected final ClientOptions clientOptions; + + public AsyncRawPreferencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public CompletableFuture> retrieve(String accountId) { + return retrieve(accountId, RetrievePreferencesRequest.builder().build()); + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public CompletableFuture> retrieve( + String accountId, RequestOptions requestOptions) { + return retrieve(accountId, RetrievePreferencesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public CompletableFuture> retrieve( + String accountId, RetrievePreferencesRequest request) { + return retrieve(accountId, request, null); + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public CompletableFuture> retrieve( + String accountId, RetrievePreferencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts") + .addPathSegment(accountId) + .addPathSegments("preferences"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, RetrievePreferencesResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public CompletableFuture> update(String accountId) { + return update(accountId, UpdatePreferencesRequest.builder().build()); + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public CompletableFuture> update( + String accountId, RequestOptions requestOptions) { + return update(accountId, UpdatePreferencesRequest.builder().build(), requestOptions); + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public CompletableFuture> update( + String accountId, UpdatePreferencesRequest request) { + return update(accountId, request, null); + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public CompletableFuture> update( + String accountId, UpdatePreferencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts") + .addPathSegment(accountId) + .addPathSegments("preferences"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpdatePreferencesResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/PreferencesClient.java b/src/main/java/com/whop/api/resources/accounts/preferences/PreferencesClient.java new file mode 100644 index 00000000..8fb32b16 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/PreferencesClient.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.accounts.preferences.requests.RetrievePreferencesRequest; +import com.whop.api.resources.accounts.preferences.requests.UpdatePreferencesRequest; +import com.whop.api.resources.accounts.preferences.types.RetrievePreferencesResponse; +import com.whop.api.resources.accounts.preferences.types.UpdatePreferencesResponse; + +public class PreferencesClient { + protected final ClientOptions clientOptions; + + private final RawPreferencesClient rawClient; + + public PreferencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPreferencesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPreferencesClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public RetrievePreferencesResponse retrieve(String accountId) { + return this.rawClient.retrieve(accountId).body(); + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public RetrievePreferencesResponse retrieve(String accountId, RequestOptions requestOptions) { + return this.rawClient.retrieve(accountId, requestOptions).body(); + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public RetrievePreferencesResponse retrieve(String accountId, RetrievePreferencesRequest request) { + return this.rawClient.retrieve(accountId, request).body(); + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public RetrievePreferencesResponse retrieve( + String accountId, RetrievePreferencesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(accountId, request, requestOptions).body(); + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public UpdatePreferencesResponse update(String accountId) { + return this.rawClient.update(accountId).body(); + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public UpdatePreferencesResponse update(String accountId, RequestOptions requestOptions) { + return this.rawClient.update(accountId, requestOptions).body(); + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public UpdatePreferencesResponse update(String accountId, UpdatePreferencesRequest request) { + return this.rawClient.update(accountId, request).body(); + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public UpdatePreferencesResponse update( + String accountId, UpdatePreferencesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(accountId, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/RawPreferencesClient.java b/src/main/java/com/whop/api/resources/accounts/preferences/RawPreferencesClient.java new file mode 100644 index 00000000..0b886b44 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/RawPreferencesClient.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.accounts.preferences.requests.RetrievePreferencesRequest; +import com.whop.api.resources.accounts.preferences.requests.UpdatePreferencesRequest; +import com.whop.api.resources.accounts.preferences.types.RetrievePreferencesResponse; +import com.whop.api.resources.accounts.preferences.types.UpdatePreferencesResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPreferencesClient { + protected final ClientOptions clientOptions; + + public RawPreferencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public WhopApiHttpResponse retrieve(String accountId) { + return retrieve(accountId, RetrievePreferencesRequest.builder().build()); + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public WhopApiHttpResponse retrieve(String accountId, RequestOptions requestOptions) { + return retrieve(accountId, RetrievePreferencesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public WhopApiHttpResponse retrieve( + String accountId, RetrievePreferencesRequest request) { + return retrieve(accountId, request, null); + } + + /** + * Retrieves the account's preferences: a singleton settings document keyed by preference name. + */ + public WhopApiHttpResponse retrieve( + String accountId, RetrievePreferencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts") + .addPathSegment(accountId) + .addPathSegments("preferences"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrievePreferencesResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public WhopApiHttpResponse update(String accountId) { + return update(accountId, UpdatePreferencesRequest.builder().build()); + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public WhopApiHttpResponse update(String accountId, RequestOptions requestOptions) { + return update(accountId, UpdatePreferencesRequest.builder().build(), requestOptions); + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public WhopApiHttpResponse update(String accountId, UpdatePreferencesRequest request) { + return update(accountId, request, null); + } + + /** + * Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_triple_whale_integration takes the Data-In API key to connect with, or null to disconnect. ads_payment_methods always requires a primary entry. backup is optional and any pairing is allowed — two cards, card+platform_balance, or a single method — so a card-only advertiser can fund ads without a platform balance. The primary and backup must be different sources. A platform_balance entry may omit id to use the account's default Whop balance. Configuring a card requires a user token; account API keys can set up platform-balance billing only. + */ + public WhopApiHttpResponse update( + String accountId, UpdatePreferencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts") + .addPathSegment(accountId) + .addPathSegments("preferences"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdatePreferencesResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/requests/RetrievePreferencesRequest.java b/src/main/java/com/whop/api/resources/accounts/preferences/requests/RetrievePreferencesRequest.java new file mode 100644 index 00000000..6cb2403a --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/requests/RetrievePreferencesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePreferencesRequest.Builder.class) +public final class RetrievePreferencesRequest { + private final Map additionalProperties; + + private RetrievePreferencesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePreferencesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePreferencesRequest other) { + return this; + } + + public RetrievePreferencesRequest build() { + return new RetrievePreferencesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/requests/UpdatePreferencesRequest.java b/src/main/java/com/whop/api/resources/accounts/preferences/requests/UpdatePreferencesRequest.java new file mode 100644 index 00000000..538d8fa0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/requests/UpdatePreferencesRequest.java @@ -0,0 +1,281 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.accounts.preferences.types.UpdatePreferencesRequestAdsPaymentMethods; +import com.whop.api.resources.accounts.preferences.types.UpdatePreferencesRequestAdsTripleWhaleIntegration; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePreferencesRequest.Builder.class) +public final class UpdatePreferencesRequest { + private final Optional adsPaymentMethods; + + private final Optional adsReportingCurrency; + + private final Optional adsSchedulingTimezone; + + private final Optional adsTripleWhaleIntegration; + + private final Optional cardsAutoTopUp; + + private final Optional disputeFighterEnabled; + + private final Map additionalProperties; + + private UpdatePreferencesRequest( + Optional adsPaymentMethods, + Optional adsReportingCurrency, + Optional adsSchedulingTimezone, + Optional adsTripleWhaleIntegration, + Optional cardsAutoTopUp, + Optional disputeFighterEnabled, + Map additionalProperties) { + this.adsPaymentMethods = adsPaymentMethods; + this.adsReportingCurrency = adsReportingCurrency; + this.adsSchedulingTimezone = adsSchedulingTimezone; + this.adsTripleWhaleIntegration = adsTripleWhaleIntegration; + this.cardsAutoTopUp = cardsAutoTopUp; + this.disputeFighterEnabled = disputeFighterEnabled; + this.additionalProperties = additionalProperties; + } + + /** + * @return How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when the primary fails. + */ + @JsonProperty("ads_payment_methods") + public Optional getAdsPaymentMethods() { + return adsPaymentMethods; + } + + /** + * @return Lowercase ISO currency code, such as usd or eur, used to display ad spend and stats. Defaults to usd. + */ + @JsonProperty("ads_reporting_currency") + public Optional getAdsReportingCurrency() { + return adsReportingCurrency; + } + + /** + * @return IANA timezone (e.g. America/New_York) used to interpret campaign start/end times and to bucket reports. Cannot be cleared once set — pass a new value to change it. + */ + @JsonProperty("ads_scheduling_timezone") + public Optional getAdsSchedulingTimezone() { + return adsSchedulingTimezone; + } + + /** + * @return Connects or disconnects the Triple Whale integration. Requires a connected Shopify store, since Triple Whale keys spend records by Shopify shop. + */ + @JsonProperty("ads_triple_whale_integration") + public Optional getAdsTripleWhaleIntegration() { + return adsTripleWhaleIntegration; + } + + /** + * @return Whether incoming funds are automatically moved to the account's cards balance. Requires a cards balance on the account. + */ + @JsonProperty("cards_auto_top_up") + public Optional getCardsAutoTopUp() { + return cardsAutoTopUp; + } + + /** + * @return Whether Whop assembles and files the evidence response when this account's payments are disputed. Off by default; enabling it also opts the account into the success fee charged only on disputes it wins. + */ + @JsonProperty("dispute_fighter_enabled") + public Optional getDisputeFighterEnabled() { + return disputeFighterEnabled; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePreferencesRequest && equalTo((UpdatePreferencesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePreferencesRequest other) { + return adsPaymentMethods.equals(other.adsPaymentMethods) + && adsReportingCurrency.equals(other.adsReportingCurrency) + && adsSchedulingTimezone.equals(other.adsSchedulingTimezone) + && adsTripleWhaleIntegration.equals(other.adsTripleWhaleIntegration) + && cardsAutoTopUp.equals(other.cardsAutoTopUp) + && disputeFighterEnabled.equals(other.disputeFighterEnabled); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adsPaymentMethods, + this.adsReportingCurrency, + this.adsSchedulingTimezone, + this.adsTripleWhaleIntegration, + this.cardsAutoTopUp, + this.disputeFighterEnabled); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional adsPaymentMethods = Optional.empty(); + + private Optional adsReportingCurrency = Optional.empty(); + + private Optional adsSchedulingTimezone = Optional.empty(); + + private Optional adsTripleWhaleIntegration = + Optional.empty(); + + private Optional cardsAutoTopUp = Optional.empty(); + + private Optional disputeFighterEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdatePreferencesRequest other) { + adsPaymentMethods(other.getAdsPaymentMethods()); + adsReportingCurrency(other.getAdsReportingCurrency()); + adsSchedulingTimezone(other.getAdsSchedulingTimezone()); + adsTripleWhaleIntegration(other.getAdsTripleWhaleIntegration()); + cardsAutoTopUp(other.getCardsAutoTopUp()); + disputeFighterEnabled(other.getDisputeFighterEnabled()); + return this; + } + + /** + *

How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when the primary fails.

+ */ + @JsonSetter(value = "ads_payment_methods", nulls = Nulls.SKIP) + public Builder adsPaymentMethods(Optional adsPaymentMethods) { + this.adsPaymentMethods = adsPaymentMethods; + return this; + } + + public Builder adsPaymentMethods(UpdatePreferencesRequestAdsPaymentMethods adsPaymentMethods) { + this.adsPaymentMethods = Optional.ofNullable(adsPaymentMethods); + return this; + } + + /** + *

Lowercase ISO currency code, such as usd or eur, used to display ad spend and stats. Defaults to usd.

+ */ + @JsonSetter(value = "ads_reporting_currency", nulls = Nulls.SKIP) + public Builder adsReportingCurrency(Optional adsReportingCurrency) { + this.adsReportingCurrency = adsReportingCurrency; + return this; + } + + public Builder adsReportingCurrency(String adsReportingCurrency) { + this.adsReportingCurrency = Optional.ofNullable(adsReportingCurrency); + return this; + } + + /** + *

IANA timezone (e.g. America/New_York) used to interpret campaign start/end times and to bucket reports. Cannot be cleared once set — pass a new value to change it.

+ */ + @JsonSetter(value = "ads_scheduling_timezone", nulls = Nulls.SKIP) + public Builder adsSchedulingTimezone(Optional adsSchedulingTimezone) { + this.adsSchedulingTimezone = adsSchedulingTimezone; + return this; + } + + public Builder adsSchedulingTimezone(String adsSchedulingTimezone) { + this.adsSchedulingTimezone = Optional.ofNullable(adsSchedulingTimezone); + return this; + } + + /** + *

Connects or disconnects the Triple Whale integration. Requires a connected Shopify store, since Triple Whale keys spend records by Shopify shop.

+ */ + @JsonSetter(value = "ads_triple_whale_integration", nulls = Nulls.SKIP) + public Builder adsTripleWhaleIntegration( + Optional adsTripleWhaleIntegration) { + this.adsTripleWhaleIntegration = adsTripleWhaleIntegration; + return this; + } + + public Builder adsTripleWhaleIntegration( + UpdatePreferencesRequestAdsTripleWhaleIntegration adsTripleWhaleIntegration) { + this.adsTripleWhaleIntegration = Optional.ofNullable(adsTripleWhaleIntegration); + return this; + } + + /** + *

Whether incoming funds are automatically moved to the account's cards balance. Requires a cards balance on the account.

+ */ + @JsonSetter(value = "cards_auto_top_up", nulls = Nulls.SKIP) + public Builder cardsAutoTopUp(Optional cardsAutoTopUp) { + this.cardsAutoTopUp = cardsAutoTopUp; + return this; + } + + public Builder cardsAutoTopUp(Boolean cardsAutoTopUp) { + this.cardsAutoTopUp = Optional.ofNullable(cardsAutoTopUp); + return this; + } + + /** + *

Whether Whop assembles and files the evidence response when this account's payments are disputed. Off by default; enabling it also opts the account into the success fee charged only on disputes it wins.

+ */ + @JsonSetter(value = "dispute_fighter_enabled", nulls = Nulls.SKIP) + public Builder disputeFighterEnabled(Optional disputeFighterEnabled) { + this.disputeFighterEnabled = disputeFighterEnabled; + return this; + } + + public Builder disputeFighterEnabled(Boolean disputeFighterEnabled) { + this.disputeFighterEnabled = Optional.ofNullable(disputeFighterEnabled); + return this; + } + + public UpdatePreferencesRequest build() { + return new UpdatePreferencesRequest( + adsPaymentMethods, + adsReportingCurrency, + adsSchedulingTimezone, + adsTripleWhaleIntegration, + cardsAutoTopUp, + disputeFighterEnabled, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponse.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponse.java new file mode 100644 index 00000000..e3e8a11d --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponse.java @@ -0,0 +1,408 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePreferencesResponse.Builder.class) +public final class RetrievePreferencesResponse { + private final RetrievePreferencesResponseAdsAgreement adsAgreement; + + private final Optional adsPaymentMethods; + + private final String adsReportingCurrency; + + private final String adsSchedulingTimezone; + + private final RetrievePreferencesResponseAdsTripleWhaleIntegration adsTripleWhaleIntegration; + + private final boolean cardsAutoTopUp; + + private final boolean disputeFighterEnabled; + + private final Map additionalProperties; + + private RetrievePreferencesResponse( + RetrievePreferencesResponseAdsAgreement adsAgreement, + Optional adsPaymentMethods, + String adsReportingCurrency, + String adsSchedulingTimezone, + RetrievePreferencesResponseAdsTripleWhaleIntegration adsTripleWhaleIntegration, + boolean cardsAutoTopUp, + boolean disputeFighterEnabled, + Map additionalProperties) { + this.adsAgreement = adsAgreement; + this.adsPaymentMethods = adsPaymentMethods; + this.adsReportingCurrency = adsReportingCurrency; + this.adsSchedulingTimezone = adsSchedulingTimezone; + this.adsTripleWhaleIntegration = adsTripleWhaleIntegration; + this.cardsAutoTopUp = cardsAutoTopUp; + this.disputeFighterEnabled = disputeFighterEnabled; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account's Whop Ads services and payment authorization agreement. While pending_signature, campaign launch is blocked; sign by answering requested_information via PATCH /verifications/{id}. + */ + @JsonProperty("ads_agreement") + public RetrievePreferencesResponseAdsAgreement getAdsAgreement() { + return adsAgreement; + } + + /** + * @return How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when the primary fails. null until ads billing has been configured. + */ + @JsonIgnore + public Optional getAdsPaymentMethods() { + if (adsPaymentMethods == null) { + return Optional.empty(); + } + return adsPaymentMethods; + } + + /** + * @return Lowercase ISO currency code, such as usd or eur, used to display ad spend and stats. Defaults to usd. + */ + @JsonProperty("ads_reporting_currency") + public String getAdsReportingCurrency() { + return adsReportingCurrency; + } + + /** + * @return IANA timezone (e.g. America/New_York) used to interpret campaign start/end times and to bucket reports. Defaults to America/New_York until explicitly overridden. + */ + @JsonProperty("ads_scheduling_timezone") + public String getAdsSchedulingTimezone() { + return adsSchedulingTimezone; + } + + /** + * @return The account's Triple Whale integration, which pushes Whop ad spend to Triple Whale's Data-In API so it reports as a whop channel. + */ + @JsonProperty("ads_triple_whale_integration") + public RetrievePreferencesResponseAdsTripleWhaleIntegration getAdsTripleWhaleIntegration() { + return adsTripleWhaleIntegration; + } + + /** + * @return Whether incoming funds are automatically moved to the account's cards balance. false when the account has no cards balance. + */ + @JsonProperty("cards_auto_top_up") + public boolean getCardsAutoTopUp() { + return cardsAutoTopUp; + } + + /** + * @return Whether Whop assembles and files the evidence response when this account's payments are disputed. Off by default; enabling it also opts the account into the success fee charged only on disputes it wins. + */ + @JsonProperty("dispute_fighter_enabled") + public boolean getDisputeFighterEnabled() { + return disputeFighterEnabled; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ads_payment_methods") + private Optional _getAdsPaymentMethods() { + return adsPaymentMethods; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePreferencesResponse && equalTo((RetrievePreferencesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePreferencesResponse other) { + return adsAgreement.equals(other.adsAgreement) + && adsPaymentMethods.equals(other.adsPaymentMethods) + && adsReportingCurrency.equals(other.adsReportingCurrency) + && adsSchedulingTimezone.equals(other.adsSchedulingTimezone) + && adsTripleWhaleIntegration.equals(other.adsTripleWhaleIntegration) + && cardsAutoTopUp == other.cardsAutoTopUp + && disputeFighterEnabled == other.disputeFighterEnabled; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adsAgreement, + this.adsPaymentMethods, + this.adsReportingCurrency, + this.adsSchedulingTimezone, + this.adsTripleWhaleIntegration, + this.cardsAutoTopUp, + this.disputeFighterEnabled); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdsAgreementStage builder() { + return new Builder(); + } + + public interface AdsAgreementStage { + /** + *

The account's Whop Ads services and payment authorization agreement. While pending_signature, campaign launch is blocked; sign by answering requested_information via PATCH /verifications/{id}.

+ */ + AdsReportingCurrencyStage adsAgreement(@NotNull RetrievePreferencesResponseAdsAgreement adsAgreement); + + Builder from(RetrievePreferencesResponse other); + } + + public interface AdsReportingCurrencyStage { + /** + *

Lowercase ISO currency code, such as usd or eur, used to display ad spend and stats. Defaults to usd.

+ */ + AdsSchedulingTimezoneStage adsReportingCurrency(@NotNull String adsReportingCurrency); + } + + public interface AdsSchedulingTimezoneStage { + /** + *

IANA timezone (e.g. America/New_York) used to interpret campaign start/end times and to bucket reports. Defaults to America/New_York until explicitly overridden.

+ */ + AdsTripleWhaleIntegrationStage adsSchedulingTimezone(@NotNull String adsSchedulingTimezone); + } + + public interface AdsTripleWhaleIntegrationStage { + /** + *

The account's Triple Whale integration, which pushes Whop ad spend to Triple Whale's Data-In API so it reports as a whop channel.

+ */ + CardsAutoTopUpStage adsTripleWhaleIntegration( + @NotNull RetrievePreferencesResponseAdsTripleWhaleIntegration adsTripleWhaleIntegration); + } + + public interface CardsAutoTopUpStage { + /** + *

Whether incoming funds are automatically moved to the account's cards balance. false when the account has no cards balance.

+ */ + DisputeFighterEnabledStage cardsAutoTopUp(boolean cardsAutoTopUp); + } + + public interface DisputeFighterEnabledStage { + /** + *

Whether Whop assembles and files the evidence response when this account's payments are disputed. Off by default; enabling it also opts the account into the success fee charged only on disputes it wins.

+ */ + _FinalStage disputeFighterEnabled(boolean disputeFighterEnabled); + } + + public interface _FinalStage { + RetrievePreferencesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when the primary fails. null until ads billing has been configured.

+ */ + _FinalStage adsPaymentMethods(Optional adsPaymentMethods); + + _FinalStage adsPaymentMethods(RetrievePreferencesResponseAdsPaymentMethods adsPaymentMethods); + + _FinalStage adsPaymentMethods(Nullable adsPaymentMethods); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AdsAgreementStage, + AdsReportingCurrencyStage, + AdsSchedulingTimezoneStage, + AdsTripleWhaleIntegrationStage, + CardsAutoTopUpStage, + DisputeFighterEnabledStage, + _FinalStage { + private RetrievePreferencesResponseAdsAgreement adsAgreement; + + private String adsReportingCurrency; + + private String adsSchedulingTimezone; + + private RetrievePreferencesResponseAdsTripleWhaleIntegration adsTripleWhaleIntegration; + + private boolean cardsAutoTopUp; + + private boolean disputeFighterEnabled; + + private Optional adsPaymentMethods = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePreferencesResponse other) { + adsAgreement(other.getAdsAgreement()); + adsPaymentMethods(other.getAdsPaymentMethods()); + adsReportingCurrency(other.getAdsReportingCurrency()); + adsSchedulingTimezone(other.getAdsSchedulingTimezone()); + adsTripleWhaleIntegration(other.getAdsTripleWhaleIntegration()); + cardsAutoTopUp(other.getCardsAutoTopUp()); + disputeFighterEnabled(other.getDisputeFighterEnabled()); + return this; + } + + /** + *

The account's Whop Ads services and payment authorization agreement. While pending_signature, campaign launch is blocked; sign by answering requested_information via PATCH /verifications/{id}.

+ *

The account's Whop Ads services and payment authorization agreement. While pending_signature, campaign launch is blocked; sign by answering requested_information via PATCH /verifications/{id}.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ads_agreement") + public AdsReportingCurrencyStage adsAgreement(@NotNull RetrievePreferencesResponseAdsAgreement adsAgreement) { + this.adsAgreement = Objects.requireNonNull(adsAgreement, "adsAgreement must not be null"); + return this; + } + + /** + *

Lowercase ISO currency code, such as usd or eur, used to display ad spend and stats. Defaults to usd.

+ *

Lowercase ISO currency code, such as usd or eur, used to display ad spend and stats. Defaults to usd.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ads_reporting_currency") + public AdsSchedulingTimezoneStage adsReportingCurrency(@NotNull String adsReportingCurrency) { + this.adsReportingCurrency = + Objects.requireNonNull(adsReportingCurrency, "adsReportingCurrency must not be null"); + return this; + } + + /** + *

IANA timezone (e.g. America/New_York) used to interpret campaign start/end times and to bucket reports. Defaults to America/New_York until explicitly overridden.

+ *

IANA timezone (e.g. America/New_York) used to interpret campaign start/end times and to bucket reports. Defaults to America/New_York until explicitly overridden.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ads_scheduling_timezone") + public AdsTripleWhaleIntegrationStage adsSchedulingTimezone(@NotNull String adsSchedulingTimezone) { + this.adsSchedulingTimezone = + Objects.requireNonNull(adsSchedulingTimezone, "adsSchedulingTimezone must not be null"); + return this; + } + + /** + *

The account's Triple Whale integration, which pushes Whop ad spend to Triple Whale's Data-In API so it reports as a whop channel.

+ *

The account's Triple Whale integration, which pushes Whop ad spend to Triple Whale's Data-In API so it reports as a whop channel.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ads_triple_whale_integration") + public CardsAutoTopUpStage adsTripleWhaleIntegration( + @NotNull RetrievePreferencesResponseAdsTripleWhaleIntegration adsTripleWhaleIntegration) { + this.adsTripleWhaleIntegration = + Objects.requireNonNull(adsTripleWhaleIntegration, "adsTripleWhaleIntegration must not be null"); + return this; + } + + /** + *

Whether incoming funds are automatically moved to the account's cards balance. false when the account has no cards balance.

+ *

Whether incoming funds are automatically moved to the account's cards balance. false when the account has no cards balance.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cards_auto_top_up") + public DisputeFighterEnabledStage cardsAutoTopUp(boolean cardsAutoTopUp) { + this.cardsAutoTopUp = cardsAutoTopUp; + return this; + } + + /** + *

Whether Whop assembles and files the evidence response when this account's payments are disputed. Off by default; enabling it also opts the account into the success fee charged only on disputes it wins.

+ *

Whether Whop assembles and files the evidence response when this account's payments are disputed. Off by default; enabling it also opts the account into the success fee charged only on disputes it wins.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dispute_fighter_enabled") + public _FinalStage disputeFighterEnabled(boolean disputeFighterEnabled) { + this.disputeFighterEnabled = disputeFighterEnabled; + return this; + } + + /** + *

How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when the primary fails. null until ads billing has been configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adsPaymentMethods(Nullable adsPaymentMethods) { + if (adsPaymentMethods.isNull()) { + this.adsPaymentMethods = null; + } else if (adsPaymentMethods.isEmpty()) { + this.adsPaymentMethods = Optional.empty(); + } else { + this.adsPaymentMethods = Optional.of(adsPaymentMethods.get()); + } + return this; + } + + /** + *

How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when the primary fails. null until ads billing has been configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adsPaymentMethods(RetrievePreferencesResponseAdsPaymentMethods adsPaymentMethods) { + this.adsPaymentMethods = Optional.ofNullable(adsPaymentMethods); + return this; + } + + /** + *

How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when the primary fails. null until ads billing has been configured.

+ */ + @java.lang.Override + @JsonSetter(value = "ads_payment_methods", nulls = Nulls.SKIP) + public _FinalStage adsPaymentMethods(Optional adsPaymentMethods) { + this.adsPaymentMethods = adsPaymentMethods; + return this; + } + + @java.lang.Override + public RetrievePreferencesResponse build() { + return new RetrievePreferencesResponse( + adsAgreement, + adsPaymentMethods, + adsReportingCurrency, + adsSchedulingTimezone, + adsTripleWhaleIntegration, + cardsAutoTopUp, + disputeFighterEnabled, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsAgreement.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsAgreement.java new file mode 100644 index 00000000..d4da3732 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsAgreement.java @@ -0,0 +1,348 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePreferencesResponseAdsAgreement.Builder.class) +public final class RetrievePreferencesResponseAdsAgreement { + private final Optional acceptedAt; + + private final Optional agreementVersion; + + private final Optional printedName; + + private final RetrievePreferencesResponseAdsAgreementStatus status; + + private final Map additionalProperties; + + private RetrievePreferencesResponseAdsAgreement( + Optional acceptedAt, + Optional agreementVersion, + Optional printedName, + RetrievePreferencesResponseAdsAgreementStatus status, + Map additionalProperties) { + this.acceptedAt = acceptedAt; + this.agreementVersion = agreementVersion; + this.printedName = printedName; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the agreement was signed, as an ISO 8601 timestamp. null until signed. + */ + @JsonIgnore + public Optional getAcceptedAt() { + if (acceptedAt == null) { + return Optional.empty(); + } + return acceptedAt; + } + + /** + * @return The agreement version signed or awaiting signature, as an ISO date. null when no signature is required. + */ + @JsonIgnore + public Optional getAgreementVersion() { + if (agreementVersion == null) { + return Optional.empty(); + } + return agreementVersion; + } + + /** + * @return The signer's printed full name. null until signed. + */ + @JsonIgnore + public Optional getPrintedName() { + if (printedName == null) { + return Optional.empty(); + } + return printedName; + } + + /** + * @return Where the account's ads services agreement stands. + */ + @JsonProperty("status") + public RetrievePreferencesResponseAdsAgreementStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("accepted_at") + private Optional _getAcceptedAt() { + return acceptedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("agreement_version") + private Optional _getAgreementVersion() { + return agreementVersion; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("printed_name") + private Optional _getPrintedName() { + return printedName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePreferencesResponseAdsAgreement + && equalTo((RetrievePreferencesResponseAdsAgreement) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePreferencesResponseAdsAgreement other) { + return acceptedAt.equals(other.acceptedAt) + && agreementVersion.equals(other.agreementVersion) + && printedName.equals(other.printedName) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.acceptedAt, this.agreementVersion, this.printedName, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StatusStage builder() { + return new Builder(); + } + + public interface StatusStage { + /** + *

Where the account's ads services agreement stands.

+ */ + _FinalStage status(@NotNull RetrievePreferencesResponseAdsAgreementStatus status); + + Builder from(RetrievePreferencesResponseAdsAgreement other); + } + + public interface _FinalStage { + RetrievePreferencesResponseAdsAgreement build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When the agreement was signed, as an ISO 8601 timestamp. null until signed.

+ */ + _FinalStage acceptedAt(Optional acceptedAt); + + _FinalStage acceptedAt(String acceptedAt); + + _FinalStage acceptedAt(Nullable acceptedAt); + + /** + *

The agreement version signed or awaiting signature, as an ISO date. null when no signature is required.

+ */ + _FinalStage agreementVersion(Optional agreementVersion); + + _FinalStage agreementVersion(String agreementVersion); + + _FinalStage agreementVersion(Nullable agreementVersion); + + /** + *

The signer's printed full name. null until signed.

+ */ + _FinalStage printedName(Optional printedName); + + _FinalStage printedName(String printedName); + + _FinalStage printedName(Nullable printedName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StatusStage, _FinalStage { + private RetrievePreferencesResponseAdsAgreementStatus status; + + private Optional printedName = Optional.empty(); + + private Optional agreementVersion = Optional.empty(); + + private Optional acceptedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePreferencesResponseAdsAgreement other) { + acceptedAt(other.getAcceptedAt()); + agreementVersion(other.getAgreementVersion()); + printedName(other.getPrintedName()); + status(other.getStatus()); + return this; + } + + /** + *

Where the account's ads services agreement stands.

+ *

Where the account's ads services agreement stands.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull RetrievePreferencesResponseAdsAgreementStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The signer's printed full name. null until signed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage printedName(Nullable printedName) { + if (printedName.isNull()) { + this.printedName = null; + } else if (printedName.isEmpty()) { + this.printedName = Optional.empty(); + } else { + this.printedName = Optional.of(printedName.get()); + } + return this; + } + + /** + *

The signer's printed full name. null until signed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage printedName(String printedName) { + this.printedName = Optional.ofNullable(printedName); + return this; + } + + /** + *

The signer's printed full name. null until signed.

+ */ + @java.lang.Override + @JsonSetter(value = "printed_name", nulls = Nulls.SKIP) + public _FinalStage printedName(Optional printedName) { + this.printedName = printedName; + return this; + } + + /** + *

The agreement version signed or awaiting signature, as an ISO date. null when no signature is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage agreementVersion(Nullable agreementVersion) { + if (agreementVersion.isNull()) { + this.agreementVersion = null; + } else if (agreementVersion.isEmpty()) { + this.agreementVersion = Optional.empty(); + } else { + this.agreementVersion = Optional.of(agreementVersion.get()); + } + return this; + } + + /** + *

The agreement version signed or awaiting signature, as an ISO date. null when no signature is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage agreementVersion(String agreementVersion) { + this.agreementVersion = Optional.ofNullable(agreementVersion); + return this; + } + + /** + *

The agreement version signed or awaiting signature, as an ISO date. null when no signature is required.

+ */ + @java.lang.Override + @JsonSetter(value = "agreement_version", nulls = Nulls.SKIP) + public _FinalStage agreementVersion(Optional agreementVersion) { + this.agreementVersion = agreementVersion; + return this; + } + + /** + *

When the agreement was signed, as an ISO 8601 timestamp. null until signed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage acceptedAt(Nullable acceptedAt) { + if (acceptedAt.isNull()) { + this.acceptedAt = null; + } else if (acceptedAt.isEmpty()) { + this.acceptedAt = Optional.empty(); + } else { + this.acceptedAt = Optional.of(acceptedAt.get()); + } + return this; + } + + /** + *

When the agreement was signed, as an ISO 8601 timestamp. null until signed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage acceptedAt(String acceptedAt) { + this.acceptedAt = Optional.ofNullable(acceptedAt); + return this; + } + + /** + *

When the agreement was signed, as an ISO 8601 timestamp. null until signed.

+ */ + @java.lang.Override + @JsonSetter(value = "accepted_at", nulls = Nulls.SKIP) + public _FinalStage acceptedAt(Optional acceptedAt) { + this.acceptedAt = acceptedAt; + return this; + } + + @java.lang.Override + public RetrievePreferencesResponseAdsAgreement build() { + return new RetrievePreferencesResponseAdsAgreement( + acceptedAt, agreementVersion, printedName, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsAgreementStatus.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsAgreementStatus.java new file mode 100644 index 00000000..f37a0fb3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsAgreementStatus.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrievePreferencesResponseAdsAgreementStatus { + public static final RetrievePreferencesResponseAdsAgreementStatus NOT_REQUIRED = + new RetrievePreferencesResponseAdsAgreementStatus(Value.NOT_REQUIRED, "not_required"); + + public static final RetrievePreferencesResponseAdsAgreementStatus SIGNED = + new RetrievePreferencesResponseAdsAgreementStatus(Value.SIGNED, "signed"); + + public static final RetrievePreferencesResponseAdsAgreementStatus PENDING_SIGNATURE = + new RetrievePreferencesResponseAdsAgreementStatus(Value.PENDING_SIGNATURE, "pending_signature"); + + private final Value value; + + private final String string; + + RetrievePreferencesResponseAdsAgreementStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrievePreferencesResponseAdsAgreementStatus + && this.string.equals(((RetrievePreferencesResponseAdsAgreementStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NOT_REQUIRED: + return visitor.visitNotRequired(); + case SIGNED: + return visitor.visitSigned(); + case PENDING_SIGNATURE: + return visitor.visitPendingSignature(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrievePreferencesResponseAdsAgreementStatus valueOf(String value) { + switch (value) { + case "not_required": + return NOT_REQUIRED; + case "signed": + return SIGNED; + case "pending_signature": + return PENDING_SIGNATURE; + default: + return new RetrievePreferencesResponseAdsAgreementStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + NOT_REQUIRED, + + PENDING_SIGNATURE, + + SIGNED, + + UNKNOWN + } + + public interface Visitor { + T visitNotRequired(); + + T visitPendingSignature(); + + T visitSigned(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsPaymentMethods.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsPaymentMethods.java new file mode 100644 index 00000000..4837e844 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsPaymentMethods.java @@ -0,0 +1,174 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePreferencesResponseAdsPaymentMethods.Builder.class) +public final class RetrievePreferencesResponseAdsPaymentMethods { + private final Optional backup; + + private final Optional primary; + + private final Map additionalProperties; + + private RetrievePreferencesResponseAdsPaymentMethods( + Optional backup, + Optional primary, + Map additionalProperties) { + this.backup = backup; + this.primary = primary; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getBackup() { + if (backup == null) { + return Optional.empty(); + } + return backup; + } + + @JsonIgnore + public Optional getPrimary() { + if (primary == null) { + return Optional.empty(); + } + return primary; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("backup") + private Optional _getBackup() { + return backup; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("primary") + private Optional _getPrimary() { + return primary; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePreferencesResponseAdsPaymentMethods + && equalTo((RetrievePreferencesResponseAdsPaymentMethods) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePreferencesResponseAdsPaymentMethods other) { + return backup.equals(other.backup) && primary.equals(other.primary); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.backup, this.primary); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional backup = Optional.empty(); + + private Optional primary = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePreferencesResponseAdsPaymentMethods other) { + backup(other.getBackup()); + primary(other.getPrimary()); + return this; + } + + @JsonSetter(value = "backup", nulls = Nulls.SKIP) + public Builder backup(Optional backup) { + this.backup = backup; + return this; + } + + public Builder backup(RetrievePreferencesResponseAdsPaymentMethodsBackup backup) { + this.backup = Optional.ofNullable(backup); + return this; + } + + public Builder backup(Nullable backup) { + if (backup.isNull()) { + this.backup = null; + } else if (backup.isEmpty()) { + this.backup = Optional.empty(); + } else { + this.backup = Optional.of(backup.get()); + } + return this; + } + + @JsonSetter(value = "primary", nulls = Nulls.SKIP) + public Builder primary(Optional primary) { + this.primary = primary; + return this; + } + + public Builder primary(RetrievePreferencesResponseAdsPaymentMethodsPrimary primary) { + this.primary = Optional.ofNullable(primary); + return this; + } + + public Builder primary(Nullable primary) { + if (primary.isNull()) { + this.primary = null; + } else if (primary.isEmpty()) { + this.primary = Optional.empty(); + } else { + this.primary = Optional.of(primary.get()); + } + return this; + } + + public RetrievePreferencesResponseAdsPaymentMethods build() { + return new RetrievePreferencesResponseAdsPaymentMethods(backup, primary, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsPaymentMethodsBackup.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsPaymentMethodsBackup.java new file mode 100644 index 00000000..28ddd965 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsPaymentMethodsBackup.java @@ -0,0 +1,594 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePreferencesResponseAdsPaymentMethodsBackup.Builder.class) +public final class RetrievePreferencesResponseAdsPaymentMethodsBackup { + private final Optional cardBrand; + + private final Optional expMonth; + + private final Optional expYear; + + private final Optional iconUrl; + + private final String id; + + private final Optional last4; + + private final Optional title; + + private final RetrievePreferencesResponseAdsPaymentMethodsBackupType type; + + private final Map additionalProperties; + + private RetrievePreferencesResponseAdsPaymentMethodsBackup( + Optional cardBrand, + Optional expMonth, + Optional expYear, + Optional iconUrl, + String id, + Optional last4, + Optional title, + RetrievePreferencesResponseAdsPaymentMethodsBackupType type, + Map additionalProperties) { + this.cardBrand = cardBrand; + this.expMonth = expMonth; + this.expYear = expYear; + this.iconUrl = iconUrl; + this.id = id; + this.last4 = last4; + this.title = title; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Card brand, present for card entries. + */ + @JsonIgnore + public Optional getCardBrand() { + if (cardBrand == null) { + return Optional.empty(); + } + return cardBrand; + } + + /** + * @return Expiration month, present for card entries. + */ + @JsonIgnore + public Optional getExpMonth() { + if (expMonth == null) { + return Optional.empty(); + } + return expMonth; + } + + /** + * @return Expiration year, present for card entries. + */ + @JsonIgnore + public Optional getExpYear() { + if (expYear == null) { + return Optional.empty(); + } + return expYear; + } + + /** + * @return Balance owner icon URL, present for platform_balance entries. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Last four digits, present for card entries. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + /** + * @return Balance name, present for account platform_balance entries (null for a personal balance). + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The funding source kind: a Whop balance or a saved card. + */ + @JsonProperty("type") + public RetrievePreferencesResponseAdsPaymentMethodsBackupType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_brand") + private Optional _getCardBrand() { + return cardBrand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_month") + private Optional _getExpMonth() { + return expMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_year") + private Optional _getExpYear() { + return expYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePreferencesResponseAdsPaymentMethodsBackup + && equalTo((RetrievePreferencesResponseAdsPaymentMethodsBackup) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePreferencesResponseAdsPaymentMethodsBackup other) { + return cardBrand.equals(other.cardBrand) + && expMonth.equals(other.expMonth) + && expYear.equals(other.expYear) + && iconUrl.equals(other.iconUrl) + && id.equals(other.id) + && last4.equals(other.last4) + && title.equals(other.title) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.cardBrand, this.expMonth, this.expYear, this.iconUrl, this.id, this.last4, this.title, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card.

+ */ + TypeStage id(@NotNull String id); + + Builder from(RetrievePreferencesResponseAdsPaymentMethodsBackup other); + } + + public interface TypeStage { + /** + *

The funding source kind: a Whop balance or a saved card.

+ */ + _FinalStage type(@NotNull RetrievePreferencesResponseAdsPaymentMethodsBackupType type); + } + + public interface _FinalStage { + RetrievePreferencesResponseAdsPaymentMethodsBackup build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Card brand, present for card entries.

+ */ + _FinalStage cardBrand(Optional cardBrand); + + _FinalStage cardBrand(String cardBrand); + + _FinalStage cardBrand(Nullable cardBrand); + + /** + *

Expiration month, present for card entries.

+ */ + _FinalStage expMonth(Optional expMonth); + + _FinalStage expMonth(Integer expMonth); + + _FinalStage expMonth(Nullable expMonth); + + /** + *

Expiration year, present for card entries.

+ */ + _FinalStage expYear(Optional expYear); + + _FinalStage expYear(Integer expYear); + + _FinalStage expYear(Nullable expYear); + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Last four digits, present for card entries.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TypeStage, _FinalStage { + private String id; + + private RetrievePreferencesResponseAdsPaymentMethodsBackupType type; + + private Optional title = Optional.empty(); + + private Optional last4 = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + private Optional expYear = Optional.empty(); + + private Optional expMonth = Optional.empty(); + + private Optional cardBrand = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePreferencesResponseAdsPaymentMethodsBackup other) { + cardBrand(other.getCardBrand()); + expMonth(other.getExpMonth()); + expYear(other.getExpYear()); + iconUrl(other.getIconUrl()); + id(other.getId()); + last4(other.getLast4()); + title(other.getTitle()); + type(other.getType()); + return this; + } + + /** + *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card.

+ *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The funding source kind: a Whop balance or a saved card.

+ *

The funding source kind: a Whop balance or a saved card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull RetrievePreferencesResponseAdsPaymentMethodsBackupType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Last four digits, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

Last four digits, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

Last four digits, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + /** + *

Expiration year, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expYear(Nullable expYear) { + if (expYear.isNull()) { + this.expYear = null; + } else if (expYear.isEmpty()) { + this.expYear = Optional.empty(); + } else { + this.expYear = Optional.of(expYear.get()); + } + return this; + } + + /** + *

Expiration year, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expYear(Integer expYear) { + this.expYear = Optional.ofNullable(expYear); + return this; + } + + /** + *

Expiration year, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "exp_year", nulls = Nulls.SKIP) + public _FinalStage expYear(Optional expYear) { + this.expYear = expYear; + return this; + } + + /** + *

Expiration month, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expMonth(Nullable expMonth) { + if (expMonth.isNull()) { + this.expMonth = null; + } else if (expMonth.isEmpty()) { + this.expMonth = Optional.empty(); + } else { + this.expMonth = Optional.of(expMonth.get()); + } + return this; + } + + /** + *

Expiration month, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expMonth(Integer expMonth) { + this.expMonth = Optional.ofNullable(expMonth); + return this; + } + + /** + *

Expiration month, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "exp_month", nulls = Nulls.SKIP) + public _FinalStage expMonth(Optional expMonth) { + this.expMonth = expMonth; + return this; + } + + /** + *

Card brand, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(Nullable cardBrand) { + if (cardBrand.isNull()) { + this.cardBrand = null; + } else if (cardBrand.isEmpty()) { + this.cardBrand = Optional.empty(); + } else { + this.cardBrand = Optional.of(cardBrand.get()); + } + return this; + } + + /** + *

Card brand, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(String cardBrand) { + this.cardBrand = Optional.ofNullable(cardBrand); + return this; + } + + /** + *

Card brand, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "card_brand", nulls = Nulls.SKIP) + public _FinalStage cardBrand(Optional cardBrand) { + this.cardBrand = cardBrand; + return this; + } + + @java.lang.Override + public RetrievePreferencesResponseAdsPaymentMethodsBackup build() { + return new RetrievePreferencesResponseAdsPaymentMethodsBackup( + cardBrand, expMonth, expYear, iconUrl, id, last4, title, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsPaymentMethodsBackupType.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsPaymentMethodsBackupType.java new file mode 100644 index 00000000..c704c4ea --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsPaymentMethodsBackupType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrievePreferencesResponseAdsPaymentMethodsBackupType { + public static final RetrievePreferencesResponseAdsPaymentMethodsBackupType CARD = + new RetrievePreferencesResponseAdsPaymentMethodsBackupType(Value.CARD, "card"); + + public static final RetrievePreferencesResponseAdsPaymentMethodsBackupType PLATFORM_BALANCE = + new RetrievePreferencesResponseAdsPaymentMethodsBackupType(Value.PLATFORM_BALANCE, "platform_balance"); + + private final Value value; + + private final String string; + + RetrievePreferencesResponseAdsPaymentMethodsBackupType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrievePreferencesResponseAdsPaymentMethodsBackupType + && this.string.equals(((RetrievePreferencesResponseAdsPaymentMethodsBackupType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD: + return visitor.visitCard(); + case PLATFORM_BALANCE: + return visitor.visitPlatformBalance(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrievePreferencesResponseAdsPaymentMethodsBackupType valueOf(String value) { + switch (value) { + case "card": + return CARD; + case "platform_balance": + return PLATFORM_BALANCE; + default: + return new RetrievePreferencesResponseAdsPaymentMethodsBackupType(Value.UNKNOWN, value); + } + } + + public enum Value { + PLATFORM_BALANCE, + + CARD, + + UNKNOWN + } + + public interface Visitor { + T visitPlatformBalance(); + + T visitCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsPaymentMethodsPrimary.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsPaymentMethodsPrimary.java new file mode 100644 index 00000000..0259e502 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsPaymentMethodsPrimary.java @@ -0,0 +1,594 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePreferencesResponseAdsPaymentMethodsPrimary.Builder.class) +public final class RetrievePreferencesResponseAdsPaymentMethodsPrimary { + private final Optional cardBrand; + + private final Optional expMonth; + + private final Optional expYear; + + private final Optional iconUrl; + + private final String id; + + private final Optional last4; + + private final Optional title; + + private final RetrievePreferencesResponseAdsPaymentMethodsPrimaryType type; + + private final Map additionalProperties; + + private RetrievePreferencesResponseAdsPaymentMethodsPrimary( + Optional cardBrand, + Optional expMonth, + Optional expYear, + Optional iconUrl, + String id, + Optional last4, + Optional title, + RetrievePreferencesResponseAdsPaymentMethodsPrimaryType type, + Map additionalProperties) { + this.cardBrand = cardBrand; + this.expMonth = expMonth; + this.expYear = expYear; + this.iconUrl = iconUrl; + this.id = id; + this.last4 = last4; + this.title = title; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Card brand, present for card entries. + */ + @JsonIgnore + public Optional getCardBrand() { + if (cardBrand == null) { + return Optional.empty(); + } + return cardBrand; + } + + /** + * @return Expiration month, present for card entries. + */ + @JsonIgnore + public Optional getExpMonth() { + if (expMonth == null) { + return Optional.empty(); + } + return expMonth; + } + + /** + * @return Expiration year, present for card entries. + */ + @JsonIgnore + public Optional getExpYear() { + if (expYear == null) { + return Optional.empty(); + } + return expYear; + } + + /** + * @return Balance owner icon URL, present for platform_balance entries. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Last four digits, present for card entries. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + /** + * @return Balance name, present for account platform_balance entries (null for a personal balance). + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The funding source kind: a Whop balance or a saved card. + */ + @JsonProperty("type") + public RetrievePreferencesResponseAdsPaymentMethodsPrimaryType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_brand") + private Optional _getCardBrand() { + return cardBrand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_month") + private Optional _getExpMonth() { + return expMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_year") + private Optional _getExpYear() { + return expYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePreferencesResponseAdsPaymentMethodsPrimary + && equalTo((RetrievePreferencesResponseAdsPaymentMethodsPrimary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePreferencesResponseAdsPaymentMethodsPrimary other) { + return cardBrand.equals(other.cardBrand) + && expMonth.equals(other.expMonth) + && expYear.equals(other.expYear) + && iconUrl.equals(other.iconUrl) + && id.equals(other.id) + && last4.equals(other.last4) + && title.equals(other.title) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.cardBrand, this.expMonth, this.expYear, this.iconUrl, this.id, this.last4, this.title, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card.

+ */ + TypeStage id(@NotNull String id); + + Builder from(RetrievePreferencesResponseAdsPaymentMethodsPrimary other); + } + + public interface TypeStage { + /** + *

The funding source kind: a Whop balance or a saved card.

+ */ + _FinalStage type(@NotNull RetrievePreferencesResponseAdsPaymentMethodsPrimaryType type); + } + + public interface _FinalStage { + RetrievePreferencesResponseAdsPaymentMethodsPrimary build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Card brand, present for card entries.

+ */ + _FinalStage cardBrand(Optional cardBrand); + + _FinalStage cardBrand(String cardBrand); + + _FinalStage cardBrand(Nullable cardBrand); + + /** + *

Expiration month, present for card entries.

+ */ + _FinalStage expMonth(Optional expMonth); + + _FinalStage expMonth(Integer expMonth); + + _FinalStage expMonth(Nullable expMonth); + + /** + *

Expiration year, present for card entries.

+ */ + _FinalStage expYear(Optional expYear); + + _FinalStage expYear(Integer expYear); + + _FinalStage expYear(Nullable expYear); + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Last four digits, present for card entries.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TypeStage, _FinalStage { + private String id; + + private RetrievePreferencesResponseAdsPaymentMethodsPrimaryType type; + + private Optional title = Optional.empty(); + + private Optional last4 = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + private Optional expYear = Optional.empty(); + + private Optional expMonth = Optional.empty(); + + private Optional cardBrand = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePreferencesResponseAdsPaymentMethodsPrimary other) { + cardBrand(other.getCardBrand()); + expMonth(other.getExpMonth()); + expYear(other.getExpYear()); + iconUrl(other.getIconUrl()); + id(other.getId()); + last4(other.getLast4()); + title(other.getTitle()); + type(other.getType()); + return this; + } + + /** + *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card.

+ *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The funding source kind: a Whop balance or a saved card.

+ *

The funding source kind: a Whop balance or a saved card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull RetrievePreferencesResponseAdsPaymentMethodsPrimaryType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Last four digits, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

Last four digits, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

Last four digits, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + /** + *

Expiration year, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expYear(Nullable expYear) { + if (expYear.isNull()) { + this.expYear = null; + } else if (expYear.isEmpty()) { + this.expYear = Optional.empty(); + } else { + this.expYear = Optional.of(expYear.get()); + } + return this; + } + + /** + *

Expiration year, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expYear(Integer expYear) { + this.expYear = Optional.ofNullable(expYear); + return this; + } + + /** + *

Expiration year, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "exp_year", nulls = Nulls.SKIP) + public _FinalStage expYear(Optional expYear) { + this.expYear = expYear; + return this; + } + + /** + *

Expiration month, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expMonth(Nullable expMonth) { + if (expMonth.isNull()) { + this.expMonth = null; + } else if (expMonth.isEmpty()) { + this.expMonth = Optional.empty(); + } else { + this.expMonth = Optional.of(expMonth.get()); + } + return this; + } + + /** + *

Expiration month, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expMonth(Integer expMonth) { + this.expMonth = Optional.ofNullable(expMonth); + return this; + } + + /** + *

Expiration month, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "exp_month", nulls = Nulls.SKIP) + public _FinalStage expMonth(Optional expMonth) { + this.expMonth = expMonth; + return this; + } + + /** + *

Card brand, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(Nullable cardBrand) { + if (cardBrand.isNull()) { + this.cardBrand = null; + } else if (cardBrand.isEmpty()) { + this.cardBrand = Optional.empty(); + } else { + this.cardBrand = Optional.of(cardBrand.get()); + } + return this; + } + + /** + *

Card brand, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(String cardBrand) { + this.cardBrand = Optional.ofNullable(cardBrand); + return this; + } + + /** + *

Card brand, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "card_brand", nulls = Nulls.SKIP) + public _FinalStage cardBrand(Optional cardBrand) { + this.cardBrand = cardBrand; + return this; + } + + @java.lang.Override + public RetrievePreferencesResponseAdsPaymentMethodsPrimary build() { + return new RetrievePreferencesResponseAdsPaymentMethodsPrimary( + cardBrand, expMonth, expYear, iconUrl, id, last4, title, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsPaymentMethodsPrimaryType.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsPaymentMethodsPrimaryType.java new file mode 100644 index 00000000..39ce8c35 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsPaymentMethodsPrimaryType.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrievePreferencesResponseAdsPaymentMethodsPrimaryType { + public static final RetrievePreferencesResponseAdsPaymentMethodsPrimaryType CARD = + new RetrievePreferencesResponseAdsPaymentMethodsPrimaryType(Value.CARD, "card"); + + public static final RetrievePreferencesResponseAdsPaymentMethodsPrimaryType PLATFORM_BALANCE = + new RetrievePreferencesResponseAdsPaymentMethodsPrimaryType(Value.PLATFORM_BALANCE, "platform_balance"); + + private final Value value; + + private final String string; + + RetrievePreferencesResponseAdsPaymentMethodsPrimaryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrievePreferencesResponseAdsPaymentMethodsPrimaryType + && this.string.equals( + ((RetrievePreferencesResponseAdsPaymentMethodsPrimaryType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD: + return visitor.visitCard(); + case PLATFORM_BALANCE: + return visitor.visitPlatformBalance(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrievePreferencesResponseAdsPaymentMethodsPrimaryType valueOf(String value) { + switch (value) { + case "card": + return CARD; + case "platform_balance": + return PLATFORM_BALANCE; + default: + return new RetrievePreferencesResponseAdsPaymentMethodsPrimaryType(Value.UNKNOWN, value); + } + } + + public enum Value { + PLATFORM_BALANCE, + + CARD, + + UNKNOWN + } + + public interface Visitor { + T visitPlatformBalance(); + + T visitCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsTripleWhaleIntegration.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsTripleWhaleIntegration.java new file mode 100644 index 00000000..7b44a164 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsTripleWhaleIntegration.java @@ -0,0 +1,278 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePreferencesResponseAdsTripleWhaleIntegration.Builder.class) +public final class RetrievePreferencesResponseAdsTripleWhaleIntegration { + private final Optional maskedApiKey; + + private final Optional shopDomain; + + private final RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus status; + + private final Map additionalProperties; + + private RetrievePreferencesResponseAdsTripleWhaleIntegration( + Optional maskedApiKey, + Optional shopDomain, + RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus status, + Map additionalProperties) { + this.maskedApiKey = maskedApiKey; + this.shopDomain = shopDomain; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The leading characters of the stored Data-In API key, followed by asterisks. The full key is never returned. null when no key is stored. + */ + @JsonIgnore + public Optional getMaskedApiKey() { + if (maskedApiKey == null) { + return Optional.empty(); + } + return maskedApiKey; + } + + /** + * @return The connected Shopify store domain spend is reported for, such as acme.myshopify.com. null when no store is connected. + */ + @JsonIgnore + public Optional getShopDomain() { + if (shopDomain == null) { + return Optional.empty(); + } + return shopDomain; + } + + /** + * @return Where the integration stands. requires_shopify_store means no Shopify store is connected — Triple Whale keys records by Shopify shop, so no spend is reported until one is. + */ + @JsonProperty("status") + public RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("masked_api_key") + private Optional _getMaskedApiKey() { + return maskedApiKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("shop_domain") + private Optional _getShopDomain() { + return shopDomain; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePreferencesResponseAdsTripleWhaleIntegration + && equalTo((RetrievePreferencesResponseAdsTripleWhaleIntegration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePreferencesResponseAdsTripleWhaleIntegration other) { + return maskedApiKey.equals(other.maskedApiKey) + && shopDomain.equals(other.shopDomain) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.maskedApiKey, this.shopDomain, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StatusStage builder() { + return new Builder(); + } + + public interface StatusStage { + /** + *

Where the integration stands. requires_shopify_store means no Shopify store is connected — Triple Whale keys records by Shopify shop, so no spend is reported until one is.

+ */ + _FinalStage status(@NotNull RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus status); + + Builder from(RetrievePreferencesResponseAdsTripleWhaleIntegration other); + } + + public interface _FinalStage { + RetrievePreferencesResponseAdsTripleWhaleIntegration build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The leading characters of the stored Data-In API key, followed by asterisks. The full key is never returned. null when no key is stored.

+ */ + _FinalStage maskedApiKey(Optional maskedApiKey); + + _FinalStage maskedApiKey(String maskedApiKey); + + _FinalStage maskedApiKey(Nullable maskedApiKey); + + /** + *

The connected Shopify store domain spend is reported for, such as acme.myshopify.com. null when no store is connected.

+ */ + _FinalStage shopDomain(Optional shopDomain); + + _FinalStage shopDomain(String shopDomain); + + _FinalStage shopDomain(Nullable shopDomain); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StatusStage, _FinalStage { + private RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus status; + + private Optional shopDomain = Optional.empty(); + + private Optional maskedApiKey = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePreferencesResponseAdsTripleWhaleIntegration other) { + maskedApiKey(other.getMaskedApiKey()); + shopDomain(other.getShopDomain()); + status(other.getStatus()); + return this; + } + + /** + *

Where the integration stands. requires_shopify_store means no Shopify store is connected — Triple Whale keys records by Shopify shop, so no spend is reported until one is.

+ *

Where the integration stands. requires_shopify_store means no Shopify store is connected — Triple Whale keys records by Shopify shop, so no spend is reported until one is.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The connected Shopify store domain spend is reported for, such as acme.myshopify.com. null when no store is connected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shopDomain(Nullable shopDomain) { + if (shopDomain.isNull()) { + this.shopDomain = null; + } else if (shopDomain.isEmpty()) { + this.shopDomain = Optional.empty(); + } else { + this.shopDomain = Optional.of(shopDomain.get()); + } + return this; + } + + /** + *

The connected Shopify store domain spend is reported for, such as acme.myshopify.com. null when no store is connected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shopDomain(String shopDomain) { + this.shopDomain = Optional.ofNullable(shopDomain); + return this; + } + + /** + *

The connected Shopify store domain spend is reported for, such as acme.myshopify.com. null when no store is connected.

+ */ + @java.lang.Override + @JsonSetter(value = "shop_domain", nulls = Nulls.SKIP) + public _FinalStage shopDomain(Optional shopDomain) { + this.shopDomain = shopDomain; + return this; + } + + /** + *

The leading characters of the stored Data-In API key, followed by asterisks. The full key is never returned. null when no key is stored.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maskedApiKey(Nullable maskedApiKey) { + if (maskedApiKey.isNull()) { + this.maskedApiKey = null; + } else if (maskedApiKey.isEmpty()) { + this.maskedApiKey = Optional.empty(); + } else { + this.maskedApiKey = Optional.of(maskedApiKey.get()); + } + return this; + } + + /** + *

The leading characters of the stored Data-In API key, followed by asterisks. The full key is never returned. null when no key is stored.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maskedApiKey(String maskedApiKey) { + this.maskedApiKey = Optional.ofNullable(maskedApiKey); + return this; + } + + /** + *

The leading characters of the stored Data-In API key, followed by asterisks. The full key is never returned. null when no key is stored.

+ */ + @java.lang.Override + @JsonSetter(value = "masked_api_key", nulls = Nulls.SKIP) + public _FinalStage maskedApiKey(Optional maskedApiKey) { + this.maskedApiKey = maskedApiKey; + return this; + } + + @java.lang.Override + public RetrievePreferencesResponseAdsTripleWhaleIntegration build() { + return new RetrievePreferencesResponseAdsTripleWhaleIntegration( + maskedApiKey, shopDomain, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus.java new file mode 100644 index 00000000..93ecbdc6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus.java @@ -0,0 +1,99 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus { + public static final RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus REQUIRES_SHOPIFY_STORE = + new RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus( + Value.REQUIRES_SHOPIFY_STORE, "requires_shopify_store"); + + public static final RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus CONNECTED = + new RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus(Value.CONNECTED, "connected"); + + public static final RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus NOT_CONNECTED = + new RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus(Value.NOT_CONNECTED, "not_connected"); + + private final Value value; + + private final String string; + + RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus + && this.string.equals( + ((RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REQUIRES_SHOPIFY_STORE: + return visitor.visitRequiresShopifyStore(); + case CONNECTED: + return visitor.visitConnected(); + case NOT_CONNECTED: + return visitor.visitNotConnected(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus valueOf(String value) { + switch (value) { + case "requires_shopify_store": + return REQUIRES_SHOPIFY_STORE; + case "connected": + return CONNECTED; + case "not_connected": + return NOT_CONNECTED; + default: + return new RetrievePreferencesResponseAdsTripleWhaleIntegrationStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + CONNECTED, + + NOT_CONNECTED, + + REQUIRES_SHOPIFY_STORE, + + UNKNOWN + } + + public interface Visitor { + T visitConnected(); + + T visitNotConnected(); + + T visitRequiresShopifyStore(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsPaymentMethods.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsPaymentMethods.java new file mode 100644 index 00000000..9f0ba514 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsPaymentMethods.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePreferencesRequestAdsPaymentMethods.Builder.class) +public final class UpdatePreferencesRequestAdsPaymentMethods { + private final Optional backup; + + private final UpdatePreferencesRequestAdsPaymentMethodsPrimary primary; + + private final Map additionalProperties; + + private UpdatePreferencesRequestAdsPaymentMethods( + Optional backup, + UpdatePreferencesRequestAdsPaymentMethodsPrimary primary, + Map additionalProperties) { + this.backup = backup; + this.primary = primary; + this.additionalProperties = additionalProperties; + } + + /** + * @return Optional second method charged if the primary fails. Any pairing is allowed (two cards, card+balance, balance+card); omit it to run on a single method. Must differ from the primary. + */ + @JsonProperty("backup") + public Optional getBackup() { + return backup; + } + + @JsonProperty("primary") + public UpdatePreferencesRequestAdsPaymentMethodsPrimary getPrimary() { + return primary; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePreferencesRequestAdsPaymentMethods + && equalTo((UpdatePreferencesRequestAdsPaymentMethods) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePreferencesRequestAdsPaymentMethods other) { + return backup.equals(other.backup) && primary.equals(other.primary); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.backup, this.primary); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PrimaryStage builder() { + return new Builder(); + } + + public interface PrimaryStage { + _FinalStage primary(@NotNull UpdatePreferencesRequestAdsPaymentMethodsPrimary primary); + + Builder from(UpdatePreferencesRequestAdsPaymentMethods other); + } + + public interface _FinalStage { + UpdatePreferencesRequestAdsPaymentMethods build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Optional second method charged if the primary fails. Any pairing is allowed (two cards, card+balance, balance+card); omit it to run on a single method. Must differ from the primary.

+ */ + _FinalStage backup(Optional backup); + + _FinalStage backup(UpdatePreferencesRequestAdsPaymentMethodsBackup backup); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PrimaryStage, _FinalStage { + private UpdatePreferencesRequestAdsPaymentMethodsPrimary primary; + + private Optional backup = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdatePreferencesRequestAdsPaymentMethods other) { + backup(other.getBackup()); + primary(other.getPrimary()); + return this; + } + + @java.lang.Override + @JsonSetter("primary") + public _FinalStage primary(@NotNull UpdatePreferencesRequestAdsPaymentMethodsPrimary primary) { + this.primary = Objects.requireNonNull(primary, "primary must not be null"); + return this; + } + + /** + *

Optional second method charged if the primary fails. Any pairing is allowed (two cards, card+balance, balance+card); omit it to run on a single method. Must differ from the primary.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage backup(UpdatePreferencesRequestAdsPaymentMethodsBackup backup) { + this.backup = Optional.ofNullable(backup); + return this; + } + + /** + *

Optional second method charged if the primary fails. Any pairing is allowed (two cards, card+balance, balance+card); omit it to run on a single method. Must differ from the primary.

+ */ + @java.lang.Override + @JsonSetter(value = "backup", nulls = Nulls.SKIP) + public _FinalStage backup(Optional backup) { + this.backup = backup; + return this; + } + + @java.lang.Override + public UpdatePreferencesRequestAdsPaymentMethods build() { + return new UpdatePreferencesRequestAdsPaymentMethods(backup, primary, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsPaymentMethodsBackup.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsPaymentMethodsBackup.java new file mode 100644 index 00000000..4a654d6a --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsPaymentMethodsBackup.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePreferencesRequestAdsPaymentMethodsBackup.Builder.class) +public final class UpdatePreferencesRequestAdsPaymentMethodsBackup { + private final Optional id; + + private final UpdatePreferencesRequestAdsPaymentMethodsBackupType type; + + private final Map additionalProperties; + + private UpdatePreferencesRequestAdsPaymentMethodsBackup( + Optional id, + UpdatePreferencesRequestAdsPaymentMethodsBackupType type, + Map additionalProperties) { + this.id = id; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card. Optional for platform_balance — defaults to the account's default Whop balance. Required for card. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The funding source kind. + */ + @JsonProperty("type") + public UpdatePreferencesRequestAdsPaymentMethodsBackupType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePreferencesRequestAdsPaymentMethodsBackup + && equalTo((UpdatePreferencesRequestAdsPaymentMethodsBackup) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePreferencesRequestAdsPaymentMethodsBackup other) { + return id.equals(other.id) && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + /** + *

The funding source kind.

+ */ + _FinalStage type(@NotNull UpdatePreferencesRequestAdsPaymentMethodsBackupType type); + + Builder from(UpdatePreferencesRequestAdsPaymentMethodsBackup other); + } + + public interface _FinalStage { + UpdatePreferencesRequestAdsPaymentMethodsBackup build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card. Optional for platform_balance — defaults to the account's default Whop balance. Required for card.

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private UpdatePreferencesRequestAdsPaymentMethodsBackupType type; + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdatePreferencesRequestAdsPaymentMethodsBackup other) { + id(other.getId()); + type(other.getType()); + return this; + } + + /** + *

The funding source kind.

+ *

The funding source kind.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull UpdatePreferencesRequestAdsPaymentMethodsBackupType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card. Optional for platform_balance — defaults to the account's default Whop balance. Required for card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card. Optional for platform_balance — defaults to the account's default Whop balance. Required for card.

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public UpdatePreferencesRequestAdsPaymentMethodsBackup build() { + return new UpdatePreferencesRequestAdsPaymentMethodsBackup(id, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsPaymentMethodsBackupType.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsPaymentMethodsBackupType.java new file mode 100644 index 00000000..91e96987 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsPaymentMethodsBackupType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdatePreferencesRequestAdsPaymentMethodsBackupType { + public static final UpdatePreferencesRequestAdsPaymentMethodsBackupType CARD = + new UpdatePreferencesRequestAdsPaymentMethodsBackupType(Value.CARD, "card"); + + public static final UpdatePreferencesRequestAdsPaymentMethodsBackupType PLATFORM_BALANCE = + new UpdatePreferencesRequestAdsPaymentMethodsBackupType(Value.PLATFORM_BALANCE, "platform_balance"); + + private final Value value; + + private final String string; + + UpdatePreferencesRequestAdsPaymentMethodsBackupType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdatePreferencesRequestAdsPaymentMethodsBackupType + && this.string.equals(((UpdatePreferencesRequestAdsPaymentMethodsBackupType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD: + return visitor.visitCard(); + case PLATFORM_BALANCE: + return visitor.visitPlatformBalance(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdatePreferencesRequestAdsPaymentMethodsBackupType valueOf(String value) { + switch (value) { + case "card": + return CARD; + case "platform_balance": + return PLATFORM_BALANCE; + default: + return new UpdatePreferencesRequestAdsPaymentMethodsBackupType(Value.UNKNOWN, value); + } + } + + public enum Value { + PLATFORM_BALANCE, + + CARD, + + UNKNOWN + } + + public interface Visitor { + T visitPlatformBalance(); + + T visitCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsPaymentMethodsPrimary.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsPaymentMethodsPrimary.java new file mode 100644 index 00000000..58b04682 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsPaymentMethodsPrimary.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePreferencesRequestAdsPaymentMethodsPrimary.Builder.class) +public final class UpdatePreferencesRequestAdsPaymentMethodsPrimary { + private final Optional id; + + private final UpdatePreferencesRequestAdsPaymentMethodsPrimaryType type; + + private final Map additionalProperties; + + private UpdatePreferencesRequestAdsPaymentMethodsPrimary( + Optional id, + UpdatePreferencesRequestAdsPaymentMethodsPrimaryType type, + Map additionalProperties) { + this.id = id; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card. Optional for platform_balance — defaults to the account's default Whop balance. Required for card. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The funding source kind. + */ + @JsonProperty("type") + public UpdatePreferencesRequestAdsPaymentMethodsPrimaryType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePreferencesRequestAdsPaymentMethodsPrimary + && equalTo((UpdatePreferencesRequestAdsPaymentMethodsPrimary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePreferencesRequestAdsPaymentMethodsPrimary other) { + return id.equals(other.id) && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + /** + *

The funding source kind.

+ */ + _FinalStage type(@NotNull UpdatePreferencesRequestAdsPaymentMethodsPrimaryType type); + + Builder from(UpdatePreferencesRequestAdsPaymentMethodsPrimary other); + } + + public interface _FinalStage { + UpdatePreferencesRequestAdsPaymentMethodsPrimary build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card. Optional for platform_balance — defaults to the account's default Whop balance. Required for card.

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private UpdatePreferencesRequestAdsPaymentMethodsPrimaryType type; + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdatePreferencesRequestAdsPaymentMethodsPrimary other) { + id(other.getId()); + type(other.getType()); + return this; + } + + /** + *

The funding source kind.

+ *

The funding source kind.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull UpdatePreferencesRequestAdsPaymentMethodsPrimaryType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card. Optional for platform_balance — defaults to the account's default Whop balance. Required for card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card. Optional for platform_balance — defaults to the account's default Whop balance. Required for card.

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public UpdatePreferencesRequestAdsPaymentMethodsPrimary build() { + return new UpdatePreferencesRequestAdsPaymentMethodsPrimary(id, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsPaymentMethodsPrimaryType.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsPaymentMethodsPrimaryType.java new file mode 100644 index 00000000..36f6b751 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsPaymentMethodsPrimaryType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdatePreferencesRequestAdsPaymentMethodsPrimaryType { + public static final UpdatePreferencesRequestAdsPaymentMethodsPrimaryType CARD = + new UpdatePreferencesRequestAdsPaymentMethodsPrimaryType(Value.CARD, "card"); + + public static final UpdatePreferencesRequestAdsPaymentMethodsPrimaryType PLATFORM_BALANCE = + new UpdatePreferencesRequestAdsPaymentMethodsPrimaryType(Value.PLATFORM_BALANCE, "platform_balance"); + + private final Value value; + + private final String string; + + UpdatePreferencesRequestAdsPaymentMethodsPrimaryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdatePreferencesRequestAdsPaymentMethodsPrimaryType + && this.string.equals(((UpdatePreferencesRequestAdsPaymentMethodsPrimaryType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD: + return visitor.visitCard(); + case PLATFORM_BALANCE: + return visitor.visitPlatformBalance(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdatePreferencesRequestAdsPaymentMethodsPrimaryType valueOf(String value) { + switch (value) { + case "card": + return CARD; + case "platform_balance": + return PLATFORM_BALANCE; + default: + return new UpdatePreferencesRequestAdsPaymentMethodsPrimaryType(Value.UNKNOWN, value); + } + } + + public enum Value { + PLATFORM_BALANCE, + + CARD, + + UNKNOWN + } + + public interface Visitor { + T visitPlatformBalance(); + + T visitCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsTripleWhaleIntegration.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsTripleWhaleIntegration.java new file mode 100644 index 00000000..e8b86a22 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesRequestAdsTripleWhaleIntegration.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePreferencesRequestAdsTripleWhaleIntegration.Builder.class) +public final class UpdatePreferencesRequestAdsTripleWhaleIntegration { + private final Optional apiKey; + + private final Map additionalProperties; + + private UpdatePreferencesRequestAdsTripleWhaleIntegration( + Optional apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + /** + * @return A Triple Whale Data-In API key with the Data-In Write: Ads scope, validated against Triple Whale before it is stored. Pass null to disconnect. Connecting for the first time backfills the account's existing ad spend. + */ + @JsonIgnore + public Optional getApiKey() { + if (apiKey == null) { + return Optional.empty(); + } + return apiKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_key") + private Optional _getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePreferencesRequestAdsTripleWhaleIntegration + && equalTo((UpdatePreferencesRequestAdsTripleWhaleIntegration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePreferencesRequestAdsTripleWhaleIntegration other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional apiKey = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdatePreferencesRequestAdsTripleWhaleIntegration other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

A Triple Whale Data-In API key with the Data-In Write: Ads scope, validated against Triple Whale before it is stored. Pass null to disconnect. Connecting for the first time backfills the account's existing ad spend.

+ */ + @JsonSetter(value = "api_key", nulls = Nulls.SKIP) + public Builder apiKey(Optional apiKey) { + this.apiKey = apiKey; + return this; + } + + public Builder apiKey(String apiKey) { + this.apiKey = Optional.ofNullable(apiKey); + return this; + } + + public Builder apiKey(Nullable apiKey) { + if (apiKey.isNull()) { + this.apiKey = null; + } else if (apiKey.isEmpty()) { + this.apiKey = Optional.empty(); + } else { + this.apiKey = Optional.of(apiKey.get()); + } + return this; + } + + public UpdatePreferencesRequestAdsTripleWhaleIntegration build() { + return new UpdatePreferencesRequestAdsTripleWhaleIntegration(apiKey, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponse.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponse.java new file mode 100644 index 00000000..cf51c67c --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponse.java @@ -0,0 +1,408 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePreferencesResponse.Builder.class) +public final class UpdatePreferencesResponse { + private final UpdatePreferencesResponseAdsAgreement adsAgreement; + + private final Optional adsPaymentMethods; + + private final String adsReportingCurrency; + + private final String adsSchedulingTimezone; + + private final UpdatePreferencesResponseAdsTripleWhaleIntegration adsTripleWhaleIntegration; + + private final boolean cardsAutoTopUp; + + private final boolean disputeFighterEnabled; + + private final Map additionalProperties; + + private UpdatePreferencesResponse( + UpdatePreferencesResponseAdsAgreement adsAgreement, + Optional adsPaymentMethods, + String adsReportingCurrency, + String adsSchedulingTimezone, + UpdatePreferencesResponseAdsTripleWhaleIntegration adsTripleWhaleIntegration, + boolean cardsAutoTopUp, + boolean disputeFighterEnabled, + Map additionalProperties) { + this.adsAgreement = adsAgreement; + this.adsPaymentMethods = adsPaymentMethods; + this.adsReportingCurrency = adsReportingCurrency; + this.adsSchedulingTimezone = adsSchedulingTimezone; + this.adsTripleWhaleIntegration = adsTripleWhaleIntegration; + this.cardsAutoTopUp = cardsAutoTopUp; + this.disputeFighterEnabled = disputeFighterEnabled; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account's Whop Ads services and payment authorization agreement. While pending_signature, campaign launch is blocked; sign by answering requested_information via PATCH /verifications/{id}. + */ + @JsonProperty("ads_agreement") + public UpdatePreferencesResponseAdsAgreement getAdsAgreement() { + return adsAgreement; + } + + /** + * @return How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when the primary fails. null until ads billing has been configured. + */ + @JsonIgnore + public Optional getAdsPaymentMethods() { + if (adsPaymentMethods == null) { + return Optional.empty(); + } + return adsPaymentMethods; + } + + /** + * @return Lowercase ISO currency code, such as usd or eur, used to display ad spend and stats. Defaults to usd. + */ + @JsonProperty("ads_reporting_currency") + public String getAdsReportingCurrency() { + return adsReportingCurrency; + } + + /** + * @return IANA timezone (e.g. America/New_York) used to interpret campaign start/end times and to bucket reports. Defaults to America/New_York until explicitly overridden. + */ + @JsonProperty("ads_scheduling_timezone") + public String getAdsSchedulingTimezone() { + return adsSchedulingTimezone; + } + + /** + * @return The account's Triple Whale integration, which pushes Whop ad spend to Triple Whale's Data-In API so it reports as a whop channel. + */ + @JsonProperty("ads_triple_whale_integration") + public UpdatePreferencesResponseAdsTripleWhaleIntegration getAdsTripleWhaleIntegration() { + return adsTripleWhaleIntegration; + } + + /** + * @return Whether incoming funds are automatically moved to the account's cards balance. false when the account has no cards balance. + */ + @JsonProperty("cards_auto_top_up") + public boolean getCardsAutoTopUp() { + return cardsAutoTopUp; + } + + /** + * @return Whether Whop assembles and files the evidence response when this account's payments are disputed. Off by default; enabling it also opts the account into the success fee charged only on disputes it wins. + */ + @JsonProperty("dispute_fighter_enabled") + public boolean getDisputeFighterEnabled() { + return disputeFighterEnabled; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ads_payment_methods") + private Optional _getAdsPaymentMethods() { + return adsPaymentMethods; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePreferencesResponse && equalTo((UpdatePreferencesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePreferencesResponse other) { + return adsAgreement.equals(other.adsAgreement) + && adsPaymentMethods.equals(other.adsPaymentMethods) + && adsReportingCurrency.equals(other.adsReportingCurrency) + && adsSchedulingTimezone.equals(other.adsSchedulingTimezone) + && adsTripleWhaleIntegration.equals(other.adsTripleWhaleIntegration) + && cardsAutoTopUp == other.cardsAutoTopUp + && disputeFighterEnabled == other.disputeFighterEnabled; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adsAgreement, + this.adsPaymentMethods, + this.adsReportingCurrency, + this.adsSchedulingTimezone, + this.adsTripleWhaleIntegration, + this.cardsAutoTopUp, + this.disputeFighterEnabled); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdsAgreementStage builder() { + return new Builder(); + } + + public interface AdsAgreementStage { + /** + *

The account's Whop Ads services and payment authorization agreement. While pending_signature, campaign launch is blocked; sign by answering requested_information via PATCH /verifications/{id}.

+ */ + AdsReportingCurrencyStage adsAgreement(@NotNull UpdatePreferencesResponseAdsAgreement adsAgreement); + + Builder from(UpdatePreferencesResponse other); + } + + public interface AdsReportingCurrencyStage { + /** + *

Lowercase ISO currency code, such as usd or eur, used to display ad spend and stats. Defaults to usd.

+ */ + AdsSchedulingTimezoneStage adsReportingCurrency(@NotNull String adsReportingCurrency); + } + + public interface AdsSchedulingTimezoneStage { + /** + *

IANA timezone (e.g. America/New_York) used to interpret campaign start/end times and to bucket reports. Defaults to America/New_York until explicitly overridden.

+ */ + AdsTripleWhaleIntegrationStage adsSchedulingTimezone(@NotNull String adsSchedulingTimezone); + } + + public interface AdsTripleWhaleIntegrationStage { + /** + *

The account's Triple Whale integration, which pushes Whop ad spend to Triple Whale's Data-In API so it reports as a whop channel.

+ */ + CardsAutoTopUpStage adsTripleWhaleIntegration( + @NotNull UpdatePreferencesResponseAdsTripleWhaleIntegration adsTripleWhaleIntegration); + } + + public interface CardsAutoTopUpStage { + /** + *

Whether incoming funds are automatically moved to the account's cards balance. false when the account has no cards balance.

+ */ + DisputeFighterEnabledStage cardsAutoTopUp(boolean cardsAutoTopUp); + } + + public interface DisputeFighterEnabledStage { + /** + *

Whether Whop assembles and files the evidence response when this account's payments are disputed. Off by default; enabling it also opts the account into the success fee charged only on disputes it wins.

+ */ + _FinalStage disputeFighterEnabled(boolean disputeFighterEnabled); + } + + public interface _FinalStage { + UpdatePreferencesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when the primary fails. null until ads billing has been configured.

+ */ + _FinalStage adsPaymentMethods(Optional adsPaymentMethods); + + _FinalStage adsPaymentMethods(UpdatePreferencesResponseAdsPaymentMethods adsPaymentMethods); + + _FinalStage adsPaymentMethods(Nullable adsPaymentMethods); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AdsAgreementStage, + AdsReportingCurrencyStage, + AdsSchedulingTimezoneStage, + AdsTripleWhaleIntegrationStage, + CardsAutoTopUpStage, + DisputeFighterEnabledStage, + _FinalStage { + private UpdatePreferencesResponseAdsAgreement adsAgreement; + + private String adsReportingCurrency; + + private String adsSchedulingTimezone; + + private UpdatePreferencesResponseAdsTripleWhaleIntegration adsTripleWhaleIntegration; + + private boolean cardsAutoTopUp; + + private boolean disputeFighterEnabled; + + private Optional adsPaymentMethods = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdatePreferencesResponse other) { + adsAgreement(other.getAdsAgreement()); + adsPaymentMethods(other.getAdsPaymentMethods()); + adsReportingCurrency(other.getAdsReportingCurrency()); + adsSchedulingTimezone(other.getAdsSchedulingTimezone()); + adsTripleWhaleIntegration(other.getAdsTripleWhaleIntegration()); + cardsAutoTopUp(other.getCardsAutoTopUp()); + disputeFighterEnabled(other.getDisputeFighterEnabled()); + return this; + } + + /** + *

The account's Whop Ads services and payment authorization agreement. While pending_signature, campaign launch is blocked; sign by answering requested_information via PATCH /verifications/{id}.

+ *

The account's Whop Ads services and payment authorization agreement. While pending_signature, campaign launch is blocked; sign by answering requested_information via PATCH /verifications/{id}.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ads_agreement") + public AdsReportingCurrencyStage adsAgreement(@NotNull UpdatePreferencesResponseAdsAgreement adsAgreement) { + this.adsAgreement = Objects.requireNonNull(adsAgreement, "adsAgreement must not be null"); + return this; + } + + /** + *

Lowercase ISO currency code, such as usd or eur, used to display ad spend and stats. Defaults to usd.

+ *

Lowercase ISO currency code, such as usd or eur, used to display ad spend and stats. Defaults to usd.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ads_reporting_currency") + public AdsSchedulingTimezoneStage adsReportingCurrency(@NotNull String adsReportingCurrency) { + this.adsReportingCurrency = + Objects.requireNonNull(adsReportingCurrency, "adsReportingCurrency must not be null"); + return this; + } + + /** + *

IANA timezone (e.g. America/New_York) used to interpret campaign start/end times and to bucket reports. Defaults to America/New_York until explicitly overridden.

+ *

IANA timezone (e.g. America/New_York) used to interpret campaign start/end times and to bucket reports. Defaults to America/New_York until explicitly overridden.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ads_scheduling_timezone") + public AdsTripleWhaleIntegrationStage adsSchedulingTimezone(@NotNull String adsSchedulingTimezone) { + this.adsSchedulingTimezone = + Objects.requireNonNull(adsSchedulingTimezone, "adsSchedulingTimezone must not be null"); + return this; + } + + /** + *

The account's Triple Whale integration, which pushes Whop ad spend to Triple Whale's Data-In API so it reports as a whop channel.

+ *

The account's Triple Whale integration, which pushes Whop ad spend to Triple Whale's Data-In API so it reports as a whop channel.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ads_triple_whale_integration") + public CardsAutoTopUpStage adsTripleWhaleIntegration( + @NotNull UpdatePreferencesResponseAdsTripleWhaleIntegration adsTripleWhaleIntegration) { + this.adsTripleWhaleIntegration = + Objects.requireNonNull(adsTripleWhaleIntegration, "adsTripleWhaleIntegration must not be null"); + return this; + } + + /** + *

Whether incoming funds are automatically moved to the account's cards balance. false when the account has no cards balance.

+ *

Whether incoming funds are automatically moved to the account's cards balance. false when the account has no cards balance.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cards_auto_top_up") + public DisputeFighterEnabledStage cardsAutoTopUp(boolean cardsAutoTopUp) { + this.cardsAutoTopUp = cardsAutoTopUp; + return this; + } + + /** + *

Whether Whop assembles and files the evidence response when this account's payments are disputed. Off by default; enabling it also opts the account into the success fee charged only on disputes it wins.

+ *

Whether Whop assembles and files the evidence response when this account's payments are disputed. Off by default; enabling it also opts the account into the success fee charged only on disputes it wins.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dispute_fighter_enabled") + public _FinalStage disputeFighterEnabled(boolean disputeFighterEnabled) { + this.disputeFighterEnabled = disputeFighterEnabled; + return this; + } + + /** + *

How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when the primary fails. null until ads billing has been configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adsPaymentMethods(Nullable adsPaymentMethods) { + if (adsPaymentMethods.isNull()) { + this.adsPaymentMethods = null; + } else if (adsPaymentMethods.isEmpty()) { + this.adsPaymentMethods = Optional.empty(); + } else { + this.adsPaymentMethods = Optional.of(adsPaymentMethods.get()); + } + return this; + } + + /** + *

How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when the primary fails. null until ads billing has been configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adsPaymentMethods(UpdatePreferencesResponseAdsPaymentMethods adsPaymentMethods) { + this.adsPaymentMethods = Optional.ofNullable(adsPaymentMethods); + return this; + } + + /** + *

How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when the primary fails. null until ads billing has been configured.

+ */ + @java.lang.Override + @JsonSetter(value = "ads_payment_methods", nulls = Nulls.SKIP) + public _FinalStage adsPaymentMethods(Optional adsPaymentMethods) { + this.adsPaymentMethods = adsPaymentMethods; + return this; + } + + @java.lang.Override + public UpdatePreferencesResponse build() { + return new UpdatePreferencesResponse( + adsAgreement, + adsPaymentMethods, + adsReportingCurrency, + adsSchedulingTimezone, + adsTripleWhaleIntegration, + cardsAutoTopUp, + disputeFighterEnabled, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsAgreement.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsAgreement.java new file mode 100644 index 00000000..5596c391 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsAgreement.java @@ -0,0 +1,348 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePreferencesResponseAdsAgreement.Builder.class) +public final class UpdatePreferencesResponseAdsAgreement { + private final Optional acceptedAt; + + private final Optional agreementVersion; + + private final Optional printedName; + + private final UpdatePreferencesResponseAdsAgreementStatus status; + + private final Map additionalProperties; + + private UpdatePreferencesResponseAdsAgreement( + Optional acceptedAt, + Optional agreementVersion, + Optional printedName, + UpdatePreferencesResponseAdsAgreementStatus status, + Map additionalProperties) { + this.acceptedAt = acceptedAt; + this.agreementVersion = agreementVersion; + this.printedName = printedName; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the agreement was signed, as an ISO 8601 timestamp. null until signed. + */ + @JsonIgnore + public Optional getAcceptedAt() { + if (acceptedAt == null) { + return Optional.empty(); + } + return acceptedAt; + } + + /** + * @return The agreement version signed or awaiting signature, as an ISO date. null when no signature is required. + */ + @JsonIgnore + public Optional getAgreementVersion() { + if (agreementVersion == null) { + return Optional.empty(); + } + return agreementVersion; + } + + /** + * @return The signer's printed full name. null until signed. + */ + @JsonIgnore + public Optional getPrintedName() { + if (printedName == null) { + return Optional.empty(); + } + return printedName; + } + + /** + * @return Where the account's ads services agreement stands. + */ + @JsonProperty("status") + public UpdatePreferencesResponseAdsAgreementStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("accepted_at") + private Optional _getAcceptedAt() { + return acceptedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("agreement_version") + private Optional _getAgreementVersion() { + return agreementVersion; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("printed_name") + private Optional _getPrintedName() { + return printedName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePreferencesResponseAdsAgreement + && equalTo((UpdatePreferencesResponseAdsAgreement) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePreferencesResponseAdsAgreement other) { + return acceptedAt.equals(other.acceptedAt) + && agreementVersion.equals(other.agreementVersion) + && printedName.equals(other.printedName) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.acceptedAt, this.agreementVersion, this.printedName, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StatusStage builder() { + return new Builder(); + } + + public interface StatusStage { + /** + *

Where the account's ads services agreement stands.

+ */ + _FinalStage status(@NotNull UpdatePreferencesResponseAdsAgreementStatus status); + + Builder from(UpdatePreferencesResponseAdsAgreement other); + } + + public interface _FinalStage { + UpdatePreferencesResponseAdsAgreement build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When the agreement was signed, as an ISO 8601 timestamp. null until signed.

+ */ + _FinalStage acceptedAt(Optional acceptedAt); + + _FinalStage acceptedAt(String acceptedAt); + + _FinalStage acceptedAt(Nullable acceptedAt); + + /** + *

The agreement version signed or awaiting signature, as an ISO date. null when no signature is required.

+ */ + _FinalStage agreementVersion(Optional agreementVersion); + + _FinalStage agreementVersion(String agreementVersion); + + _FinalStage agreementVersion(Nullable agreementVersion); + + /** + *

The signer's printed full name. null until signed.

+ */ + _FinalStage printedName(Optional printedName); + + _FinalStage printedName(String printedName); + + _FinalStage printedName(Nullable printedName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StatusStage, _FinalStage { + private UpdatePreferencesResponseAdsAgreementStatus status; + + private Optional printedName = Optional.empty(); + + private Optional agreementVersion = Optional.empty(); + + private Optional acceptedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdatePreferencesResponseAdsAgreement other) { + acceptedAt(other.getAcceptedAt()); + agreementVersion(other.getAgreementVersion()); + printedName(other.getPrintedName()); + status(other.getStatus()); + return this; + } + + /** + *

Where the account's ads services agreement stands.

+ *

Where the account's ads services agreement stands.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull UpdatePreferencesResponseAdsAgreementStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The signer's printed full name. null until signed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage printedName(Nullable printedName) { + if (printedName.isNull()) { + this.printedName = null; + } else if (printedName.isEmpty()) { + this.printedName = Optional.empty(); + } else { + this.printedName = Optional.of(printedName.get()); + } + return this; + } + + /** + *

The signer's printed full name. null until signed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage printedName(String printedName) { + this.printedName = Optional.ofNullable(printedName); + return this; + } + + /** + *

The signer's printed full name. null until signed.

+ */ + @java.lang.Override + @JsonSetter(value = "printed_name", nulls = Nulls.SKIP) + public _FinalStage printedName(Optional printedName) { + this.printedName = printedName; + return this; + } + + /** + *

The agreement version signed or awaiting signature, as an ISO date. null when no signature is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage agreementVersion(Nullable agreementVersion) { + if (agreementVersion.isNull()) { + this.agreementVersion = null; + } else if (agreementVersion.isEmpty()) { + this.agreementVersion = Optional.empty(); + } else { + this.agreementVersion = Optional.of(agreementVersion.get()); + } + return this; + } + + /** + *

The agreement version signed or awaiting signature, as an ISO date. null when no signature is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage agreementVersion(String agreementVersion) { + this.agreementVersion = Optional.ofNullable(agreementVersion); + return this; + } + + /** + *

The agreement version signed or awaiting signature, as an ISO date. null when no signature is required.

+ */ + @java.lang.Override + @JsonSetter(value = "agreement_version", nulls = Nulls.SKIP) + public _FinalStage agreementVersion(Optional agreementVersion) { + this.agreementVersion = agreementVersion; + return this; + } + + /** + *

When the agreement was signed, as an ISO 8601 timestamp. null until signed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage acceptedAt(Nullable acceptedAt) { + if (acceptedAt.isNull()) { + this.acceptedAt = null; + } else if (acceptedAt.isEmpty()) { + this.acceptedAt = Optional.empty(); + } else { + this.acceptedAt = Optional.of(acceptedAt.get()); + } + return this; + } + + /** + *

When the agreement was signed, as an ISO 8601 timestamp. null until signed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage acceptedAt(String acceptedAt) { + this.acceptedAt = Optional.ofNullable(acceptedAt); + return this; + } + + /** + *

When the agreement was signed, as an ISO 8601 timestamp. null until signed.

+ */ + @java.lang.Override + @JsonSetter(value = "accepted_at", nulls = Nulls.SKIP) + public _FinalStage acceptedAt(Optional acceptedAt) { + this.acceptedAt = acceptedAt; + return this; + } + + @java.lang.Override + public UpdatePreferencesResponseAdsAgreement build() { + return new UpdatePreferencesResponseAdsAgreement( + acceptedAt, agreementVersion, printedName, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsAgreementStatus.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsAgreementStatus.java new file mode 100644 index 00000000..b21fd400 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsAgreementStatus.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdatePreferencesResponseAdsAgreementStatus { + public static final UpdatePreferencesResponseAdsAgreementStatus NOT_REQUIRED = + new UpdatePreferencesResponseAdsAgreementStatus(Value.NOT_REQUIRED, "not_required"); + + public static final UpdatePreferencesResponseAdsAgreementStatus SIGNED = + new UpdatePreferencesResponseAdsAgreementStatus(Value.SIGNED, "signed"); + + public static final UpdatePreferencesResponseAdsAgreementStatus PENDING_SIGNATURE = + new UpdatePreferencesResponseAdsAgreementStatus(Value.PENDING_SIGNATURE, "pending_signature"); + + private final Value value; + + private final String string; + + UpdatePreferencesResponseAdsAgreementStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdatePreferencesResponseAdsAgreementStatus + && this.string.equals(((UpdatePreferencesResponseAdsAgreementStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NOT_REQUIRED: + return visitor.visitNotRequired(); + case SIGNED: + return visitor.visitSigned(); + case PENDING_SIGNATURE: + return visitor.visitPendingSignature(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdatePreferencesResponseAdsAgreementStatus valueOf(String value) { + switch (value) { + case "not_required": + return NOT_REQUIRED; + case "signed": + return SIGNED; + case "pending_signature": + return PENDING_SIGNATURE; + default: + return new UpdatePreferencesResponseAdsAgreementStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + NOT_REQUIRED, + + PENDING_SIGNATURE, + + SIGNED, + + UNKNOWN + } + + public interface Visitor { + T visitNotRequired(); + + T visitPendingSignature(); + + T visitSigned(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsPaymentMethods.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsPaymentMethods.java new file mode 100644 index 00000000..bfb279df --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsPaymentMethods.java @@ -0,0 +1,174 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePreferencesResponseAdsPaymentMethods.Builder.class) +public final class UpdatePreferencesResponseAdsPaymentMethods { + private final Optional backup; + + private final Optional primary; + + private final Map additionalProperties; + + private UpdatePreferencesResponseAdsPaymentMethods( + Optional backup, + Optional primary, + Map additionalProperties) { + this.backup = backup; + this.primary = primary; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getBackup() { + if (backup == null) { + return Optional.empty(); + } + return backup; + } + + @JsonIgnore + public Optional getPrimary() { + if (primary == null) { + return Optional.empty(); + } + return primary; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("backup") + private Optional _getBackup() { + return backup; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("primary") + private Optional _getPrimary() { + return primary; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePreferencesResponseAdsPaymentMethods + && equalTo((UpdatePreferencesResponseAdsPaymentMethods) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePreferencesResponseAdsPaymentMethods other) { + return backup.equals(other.backup) && primary.equals(other.primary); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.backup, this.primary); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional backup = Optional.empty(); + + private Optional primary = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdatePreferencesResponseAdsPaymentMethods other) { + backup(other.getBackup()); + primary(other.getPrimary()); + return this; + } + + @JsonSetter(value = "backup", nulls = Nulls.SKIP) + public Builder backup(Optional backup) { + this.backup = backup; + return this; + } + + public Builder backup(UpdatePreferencesResponseAdsPaymentMethodsBackup backup) { + this.backup = Optional.ofNullable(backup); + return this; + } + + public Builder backup(Nullable backup) { + if (backup.isNull()) { + this.backup = null; + } else if (backup.isEmpty()) { + this.backup = Optional.empty(); + } else { + this.backup = Optional.of(backup.get()); + } + return this; + } + + @JsonSetter(value = "primary", nulls = Nulls.SKIP) + public Builder primary(Optional primary) { + this.primary = primary; + return this; + } + + public Builder primary(UpdatePreferencesResponseAdsPaymentMethodsPrimary primary) { + this.primary = Optional.ofNullable(primary); + return this; + } + + public Builder primary(Nullable primary) { + if (primary.isNull()) { + this.primary = null; + } else if (primary.isEmpty()) { + this.primary = Optional.empty(); + } else { + this.primary = Optional.of(primary.get()); + } + return this; + } + + public UpdatePreferencesResponseAdsPaymentMethods build() { + return new UpdatePreferencesResponseAdsPaymentMethods(backup, primary, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsPaymentMethodsBackup.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsPaymentMethodsBackup.java new file mode 100644 index 00000000..07b83912 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsPaymentMethodsBackup.java @@ -0,0 +1,594 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePreferencesResponseAdsPaymentMethodsBackup.Builder.class) +public final class UpdatePreferencesResponseAdsPaymentMethodsBackup { + private final Optional cardBrand; + + private final Optional expMonth; + + private final Optional expYear; + + private final Optional iconUrl; + + private final String id; + + private final Optional last4; + + private final Optional title; + + private final UpdatePreferencesResponseAdsPaymentMethodsBackupType type; + + private final Map additionalProperties; + + private UpdatePreferencesResponseAdsPaymentMethodsBackup( + Optional cardBrand, + Optional expMonth, + Optional expYear, + Optional iconUrl, + String id, + Optional last4, + Optional title, + UpdatePreferencesResponseAdsPaymentMethodsBackupType type, + Map additionalProperties) { + this.cardBrand = cardBrand; + this.expMonth = expMonth; + this.expYear = expYear; + this.iconUrl = iconUrl; + this.id = id; + this.last4 = last4; + this.title = title; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Card brand, present for card entries. + */ + @JsonIgnore + public Optional getCardBrand() { + if (cardBrand == null) { + return Optional.empty(); + } + return cardBrand; + } + + /** + * @return Expiration month, present for card entries. + */ + @JsonIgnore + public Optional getExpMonth() { + if (expMonth == null) { + return Optional.empty(); + } + return expMonth; + } + + /** + * @return Expiration year, present for card entries. + */ + @JsonIgnore + public Optional getExpYear() { + if (expYear == null) { + return Optional.empty(); + } + return expYear; + } + + /** + * @return Balance owner icon URL, present for platform_balance entries. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Last four digits, present for card entries. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + /** + * @return Balance name, present for account platform_balance entries (null for a personal balance). + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The funding source kind: a Whop balance or a saved card. + */ + @JsonProperty("type") + public UpdatePreferencesResponseAdsPaymentMethodsBackupType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_brand") + private Optional _getCardBrand() { + return cardBrand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_month") + private Optional _getExpMonth() { + return expMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_year") + private Optional _getExpYear() { + return expYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePreferencesResponseAdsPaymentMethodsBackup + && equalTo((UpdatePreferencesResponseAdsPaymentMethodsBackup) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePreferencesResponseAdsPaymentMethodsBackup other) { + return cardBrand.equals(other.cardBrand) + && expMonth.equals(other.expMonth) + && expYear.equals(other.expYear) + && iconUrl.equals(other.iconUrl) + && id.equals(other.id) + && last4.equals(other.last4) + && title.equals(other.title) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.cardBrand, this.expMonth, this.expYear, this.iconUrl, this.id, this.last4, this.title, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card.

+ */ + TypeStage id(@NotNull String id); + + Builder from(UpdatePreferencesResponseAdsPaymentMethodsBackup other); + } + + public interface TypeStage { + /** + *

The funding source kind: a Whop balance or a saved card.

+ */ + _FinalStage type(@NotNull UpdatePreferencesResponseAdsPaymentMethodsBackupType type); + } + + public interface _FinalStage { + UpdatePreferencesResponseAdsPaymentMethodsBackup build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Card brand, present for card entries.

+ */ + _FinalStage cardBrand(Optional cardBrand); + + _FinalStage cardBrand(String cardBrand); + + _FinalStage cardBrand(Nullable cardBrand); + + /** + *

Expiration month, present for card entries.

+ */ + _FinalStage expMonth(Optional expMonth); + + _FinalStage expMonth(Integer expMonth); + + _FinalStage expMonth(Nullable expMonth); + + /** + *

Expiration year, present for card entries.

+ */ + _FinalStage expYear(Optional expYear); + + _FinalStage expYear(Integer expYear); + + _FinalStage expYear(Nullable expYear); + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Last four digits, present for card entries.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TypeStage, _FinalStage { + private String id; + + private UpdatePreferencesResponseAdsPaymentMethodsBackupType type; + + private Optional title = Optional.empty(); + + private Optional last4 = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + private Optional expYear = Optional.empty(); + + private Optional expMonth = Optional.empty(); + + private Optional cardBrand = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdatePreferencesResponseAdsPaymentMethodsBackup other) { + cardBrand(other.getCardBrand()); + expMonth(other.getExpMonth()); + expYear(other.getExpYear()); + iconUrl(other.getIconUrl()); + id(other.getId()); + last4(other.getLast4()); + title(other.getTitle()); + type(other.getType()); + return this; + } + + /** + *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card.

+ *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The funding source kind: a Whop balance or a saved card.

+ *

The funding source kind: a Whop balance or a saved card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull UpdatePreferencesResponseAdsPaymentMethodsBackupType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Last four digits, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

Last four digits, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

Last four digits, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + /** + *

Expiration year, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expYear(Nullable expYear) { + if (expYear.isNull()) { + this.expYear = null; + } else if (expYear.isEmpty()) { + this.expYear = Optional.empty(); + } else { + this.expYear = Optional.of(expYear.get()); + } + return this; + } + + /** + *

Expiration year, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expYear(Integer expYear) { + this.expYear = Optional.ofNullable(expYear); + return this; + } + + /** + *

Expiration year, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "exp_year", nulls = Nulls.SKIP) + public _FinalStage expYear(Optional expYear) { + this.expYear = expYear; + return this; + } + + /** + *

Expiration month, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expMonth(Nullable expMonth) { + if (expMonth.isNull()) { + this.expMonth = null; + } else if (expMonth.isEmpty()) { + this.expMonth = Optional.empty(); + } else { + this.expMonth = Optional.of(expMonth.get()); + } + return this; + } + + /** + *

Expiration month, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expMonth(Integer expMonth) { + this.expMonth = Optional.ofNullable(expMonth); + return this; + } + + /** + *

Expiration month, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "exp_month", nulls = Nulls.SKIP) + public _FinalStage expMonth(Optional expMonth) { + this.expMonth = expMonth; + return this; + } + + /** + *

Card brand, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(Nullable cardBrand) { + if (cardBrand.isNull()) { + this.cardBrand = null; + } else if (cardBrand.isEmpty()) { + this.cardBrand = Optional.empty(); + } else { + this.cardBrand = Optional.of(cardBrand.get()); + } + return this; + } + + /** + *

Card brand, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(String cardBrand) { + this.cardBrand = Optional.ofNullable(cardBrand); + return this; + } + + /** + *

Card brand, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "card_brand", nulls = Nulls.SKIP) + public _FinalStage cardBrand(Optional cardBrand) { + this.cardBrand = cardBrand; + return this; + } + + @java.lang.Override + public UpdatePreferencesResponseAdsPaymentMethodsBackup build() { + return new UpdatePreferencesResponseAdsPaymentMethodsBackup( + cardBrand, expMonth, expYear, iconUrl, id, last4, title, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsPaymentMethodsBackupType.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsPaymentMethodsBackupType.java new file mode 100644 index 00000000..bc459242 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsPaymentMethodsBackupType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdatePreferencesResponseAdsPaymentMethodsBackupType { + public static final UpdatePreferencesResponseAdsPaymentMethodsBackupType CARD = + new UpdatePreferencesResponseAdsPaymentMethodsBackupType(Value.CARD, "card"); + + public static final UpdatePreferencesResponseAdsPaymentMethodsBackupType PLATFORM_BALANCE = + new UpdatePreferencesResponseAdsPaymentMethodsBackupType(Value.PLATFORM_BALANCE, "platform_balance"); + + private final Value value; + + private final String string; + + UpdatePreferencesResponseAdsPaymentMethodsBackupType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdatePreferencesResponseAdsPaymentMethodsBackupType + && this.string.equals(((UpdatePreferencesResponseAdsPaymentMethodsBackupType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD: + return visitor.visitCard(); + case PLATFORM_BALANCE: + return visitor.visitPlatformBalance(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdatePreferencesResponseAdsPaymentMethodsBackupType valueOf(String value) { + switch (value) { + case "card": + return CARD; + case "platform_balance": + return PLATFORM_BALANCE; + default: + return new UpdatePreferencesResponseAdsPaymentMethodsBackupType(Value.UNKNOWN, value); + } + } + + public enum Value { + PLATFORM_BALANCE, + + CARD, + + UNKNOWN + } + + public interface Visitor { + T visitPlatformBalance(); + + T visitCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsPaymentMethodsPrimary.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsPaymentMethodsPrimary.java new file mode 100644 index 00000000..771d903b --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsPaymentMethodsPrimary.java @@ -0,0 +1,594 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePreferencesResponseAdsPaymentMethodsPrimary.Builder.class) +public final class UpdatePreferencesResponseAdsPaymentMethodsPrimary { + private final Optional cardBrand; + + private final Optional expMonth; + + private final Optional expYear; + + private final Optional iconUrl; + + private final String id; + + private final Optional last4; + + private final Optional title; + + private final UpdatePreferencesResponseAdsPaymentMethodsPrimaryType type; + + private final Map additionalProperties; + + private UpdatePreferencesResponseAdsPaymentMethodsPrimary( + Optional cardBrand, + Optional expMonth, + Optional expYear, + Optional iconUrl, + String id, + Optional last4, + Optional title, + UpdatePreferencesResponseAdsPaymentMethodsPrimaryType type, + Map additionalProperties) { + this.cardBrand = cardBrand; + this.expMonth = expMonth; + this.expYear = expYear; + this.iconUrl = iconUrl; + this.id = id; + this.last4 = last4; + this.title = title; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Card brand, present for card entries. + */ + @JsonIgnore + public Optional getCardBrand() { + if (cardBrand == null) { + return Optional.empty(); + } + return cardBrand; + } + + /** + * @return Expiration month, present for card entries. + */ + @JsonIgnore + public Optional getExpMonth() { + if (expMonth == null) { + return Optional.empty(); + } + return expMonth; + } + + /** + * @return Expiration year, present for card entries. + */ + @JsonIgnore + public Optional getExpYear() { + if (expYear == null) { + return Optional.empty(); + } + return expYear; + } + + /** + * @return Balance owner icon URL, present for platform_balance entries. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Last four digits, present for card entries. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + /** + * @return Balance name, present for account platform_balance entries (null for a personal balance). + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The funding source kind: a Whop balance or a saved card. + */ + @JsonProperty("type") + public UpdatePreferencesResponseAdsPaymentMethodsPrimaryType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_brand") + private Optional _getCardBrand() { + return cardBrand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_month") + private Optional _getExpMonth() { + return expMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_year") + private Optional _getExpYear() { + return expYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePreferencesResponseAdsPaymentMethodsPrimary + && equalTo((UpdatePreferencesResponseAdsPaymentMethodsPrimary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePreferencesResponseAdsPaymentMethodsPrimary other) { + return cardBrand.equals(other.cardBrand) + && expMonth.equals(other.expMonth) + && expYear.equals(other.expYear) + && iconUrl.equals(other.iconUrl) + && id.equals(other.id) + && last4.equals(other.last4) + && title.equals(other.title) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.cardBrand, this.expMonth, this.expYear, this.iconUrl, this.id, this.last4, this.title, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card.

+ */ + TypeStage id(@NotNull String id); + + Builder from(UpdatePreferencesResponseAdsPaymentMethodsPrimary other); + } + + public interface TypeStage { + /** + *

The funding source kind: a Whop balance or a saved card.

+ */ + _FinalStage type(@NotNull UpdatePreferencesResponseAdsPaymentMethodsPrimaryType type); + } + + public interface _FinalStage { + UpdatePreferencesResponseAdsPaymentMethodsPrimary build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Card brand, present for card entries.

+ */ + _FinalStage cardBrand(Optional cardBrand); + + _FinalStage cardBrand(String cardBrand); + + _FinalStage cardBrand(Nullable cardBrand); + + /** + *

Expiration month, present for card entries.

+ */ + _FinalStage expMonth(Optional expMonth); + + _FinalStage expMonth(Integer expMonth); + + _FinalStage expMonth(Nullable expMonth); + + /** + *

Expiration year, present for card entries.

+ */ + _FinalStage expYear(Optional expYear); + + _FinalStage expYear(Integer expYear); + + _FinalStage expYear(Nullable expYear); + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Last four digits, present for card entries.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TypeStage, _FinalStage { + private String id; + + private UpdatePreferencesResponseAdsPaymentMethodsPrimaryType type; + + private Optional title = Optional.empty(); + + private Optional last4 = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + private Optional expYear = Optional.empty(); + + private Optional expMonth = Optional.empty(); + + private Optional cardBrand = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdatePreferencesResponseAdsPaymentMethodsPrimary other) { + cardBrand(other.getCardBrand()); + expMonth(other.getExpMonth()); + expYear(other.getExpYear()); + iconUrl(other.getIconUrl()); + id(other.getId()); + last4(other.getLast4()); + title(other.getTitle()); + type(other.getType()); + return this; + } + + /** + *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card.

+ *

The funding source ID: a Whop balance (ldgr_) for platform_balance, or a payment method (payt_) for card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The funding source kind: a Whop balance or a saved card.

+ *

The funding source kind: a Whop balance or a saved card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull UpdatePreferencesResponseAdsPaymentMethodsPrimaryType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Balance name, present for account platform_balance entries (null for a personal balance).

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Last four digits, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

Last four digits, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

Last four digits, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Balance owner icon URL, present for platform_balance entries.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + /** + *

Expiration year, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expYear(Nullable expYear) { + if (expYear.isNull()) { + this.expYear = null; + } else if (expYear.isEmpty()) { + this.expYear = Optional.empty(); + } else { + this.expYear = Optional.of(expYear.get()); + } + return this; + } + + /** + *

Expiration year, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expYear(Integer expYear) { + this.expYear = Optional.ofNullable(expYear); + return this; + } + + /** + *

Expiration year, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "exp_year", nulls = Nulls.SKIP) + public _FinalStage expYear(Optional expYear) { + this.expYear = expYear; + return this; + } + + /** + *

Expiration month, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expMonth(Nullable expMonth) { + if (expMonth.isNull()) { + this.expMonth = null; + } else if (expMonth.isEmpty()) { + this.expMonth = Optional.empty(); + } else { + this.expMonth = Optional.of(expMonth.get()); + } + return this; + } + + /** + *

Expiration month, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expMonth(Integer expMonth) { + this.expMonth = Optional.ofNullable(expMonth); + return this; + } + + /** + *

Expiration month, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "exp_month", nulls = Nulls.SKIP) + public _FinalStage expMonth(Optional expMonth) { + this.expMonth = expMonth; + return this; + } + + /** + *

Card brand, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(Nullable cardBrand) { + if (cardBrand.isNull()) { + this.cardBrand = null; + } else if (cardBrand.isEmpty()) { + this.cardBrand = Optional.empty(); + } else { + this.cardBrand = Optional.of(cardBrand.get()); + } + return this; + } + + /** + *

Card brand, present for card entries.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(String cardBrand) { + this.cardBrand = Optional.ofNullable(cardBrand); + return this; + } + + /** + *

Card brand, present for card entries.

+ */ + @java.lang.Override + @JsonSetter(value = "card_brand", nulls = Nulls.SKIP) + public _FinalStage cardBrand(Optional cardBrand) { + this.cardBrand = cardBrand; + return this; + } + + @java.lang.Override + public UpdatePreferencesResponseAdsPaymentMethodsPrimary build() { + return new UpdatePreferencesResponseAdsPaymentMethodsPrimary( + cardBrand, expMonth, expYear, iconUrl, id, last4, title, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsPaymentMethodsPrimaryType.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsPaymentMethodsPrimaryType.java new file mode 100644 index 00000000..93a85220 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsPaymentMethodsPrimaryType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdatePreferencesResponseAdsPaymentMethodsPrimaryType { + public static final UpdatePreferencesResponseAdsPaymentMethodsPrimaryType CARD = + new UpdatePreferencesResponseAdsPaymentMethodsPrimaryType(Value.CARD, "card"); + + public static final UpdatePreferencesResponseAdsPaymentMethodsPrimaryType PLATFORM_BALANCE = + new UpdatePreferencesResponseAdsPaymentMethodsPrimaryType(Value.PLATFORM_BALANCE, "platform_balance"); + + private final Value value; + + private final String string; + + UpdatePreferencesResponseAdsPaymentMethodsPrimaryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdatePreferencesResponseAdsPaymentMethodsPrimaryType + && this.string.equals(((UpdatePreferencesResponseAdsPaymentMethodsPrimaryType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD: + return visitor.visitCard(); + case PLATFORM_BALANCE: + return visitor.visitPlatformBalance(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdatePreferencesResponseAdsPaymentMethodsPrimaryType valueOf(String value) { + switch (value) { + case "card": + return CARD; + case "platform_balance": + return PLATFORM_BALANCE; + default: + return new UpdatePreferencesResponseAdsPaymentMethodsPrimaryType(Value.UNKNOWN, value); + } + } + + public enum Value { + PLATFORM_BALANCE, + + CARD, + + UNKNOWN + } + + public interface Visitor { + T visitPlatformBalance(); + + T visitCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsTripleWhaleIntegration.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsTripleWhaleIntegration.java new file mode 100644 index 00000000..20c38d9a --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsTripleWhaleIntegration.java @@ -0,0 +1,278 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePreferencesResponseAdsTripleWhaleIntegration.Builder.class) +public final class UpdatePreferencesResponseAdsTripleWhaleIntegration { + private final Optional maskedApiKey; + + private final Optional shopDomain; + + private final UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus status; + + private final Map additionalProperties; + + private UpdatePreferencesResponseAdsTripleWhaleIntegration( + Optional maskedApiKey, + Optional shopDomain, + UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus status, + Map additionalProperties) { + this.maskedApiKey = maskedApiKey; + this.shopDomain = shopDomain; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The leading characters of the stored Data-In API key, followed by asterisks. The full key is never returned. null when no key is stored. + */ + @JsonIgnore + public Optional getMaskedApiKey() { + if (maskedApiKey == null) { + return Optional.empty(); + } + return maskedApiKey; + } + + /** + * @return The connected Shopify store domain spend is reported for, such as acme.myshopify.com. null when no store is connected. + */ + @JsonIgnore + public Optional getShopDomain() { + if (shopDomain == null) { + return Optional.empty(); + } + return shopDomain; + } + + /** + * @return Where the integration stands. requires_shopify_store means no Shopify store is connected — Triple Whale keys records by Shopify shop, so no spend is reported until one is. + */ + @JsonProperty("status") + public UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("masked_api_key") + private Optional _getMaskedApiKey() { + return maskedApiKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("shop_domain") + private Optional _getShopDomain() { + return shopDomain; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePreferencesResponseAdsTripleWhaleIntegration + && equalTo((UpdatePreferencesResponseAdsTripleWhaleIntegration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePreferencesResponseAdsTripleWhaleIntegration other) { + return maskedApiKey.equals(other.maskedApiKey) + && shopDomain.equals(other.shopDomain) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.maskedApiKey, this.shopDomain, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StatusStage builder() { + return new Builder(); + } + + public interface StatusStage { + /** + *

Where the integration stands. requires_shopify_store means no Shopify store is connected — Triple Whale keys records by Shopify shop, so no spend is reported until one is.

+ */ + _FinalStage status(@NotNull UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus status); + + Builder from(UpdatePreferencesResponseAdsTripleWhaleIntegration other); + } + + public interface _FinalStage { + UpdatePreferencesResponseAdsTripleWhaleIntegration build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The leading characters of the stored Data-In API key, followed by asterisks. The full key is never returned. null when no key is stored.

+ */ + _FinalStage maskedApiKey(Optional maskedApiKey); + + _FinalStage maskedApiKey(String maskedApiKey); + + _FinalStage maskedApiKey(Nullable maskedApiKey); + + /** + *

The connected Shopify store domain spend is reported for, such as acme.myshopify.com. null when no store is connected.

+ */ + _FinalStage shopDomain(Optional shopDomain); + + _FinalStage shopDomain(String shopDomain); + + _FinalStage shopDomain(Nullable shopDomain); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StatusStage, _FinalStage { + private UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus status; + + private Optional shopDomain = Optional.empty(); + + private Optional maskedApiKey = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdatePreferencesResponseAdsTripleWhaleIntegration other) { + maskedApiKey(other.getMaskedApiKey()); + shopDomain(other.getShopDomain()); + status(other.getStatus()); + return this; + } + + /** + *

Where the integration stands. requires_shopify_store means no Shopify store is connected — Triple Whale keys records by Shopify shop, so no spend is reported until one is.

+ *

Where the integration stands. requires_shopify_store means no Shopify store is connected — Triple Whale keys records by Shopify shop, so no spend is reported until one is.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The connected Shopify store domain spend is reported for, such as acme.myshopify.com. null when no store is connected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shopDomain(Nullable shopDomain) { + if (shopDomain.isNull()) { + this.shopDomain = null; + } else if (shopDomain.isEmpty()) { + this.shopDomain = Optional.empty(); + } else { + this.shopDomain = Optional.of(shopDomain.get()); + } + return this; + } + + /** + *

The connected Shopify store domain spend is reported for, such as acme.myshopify.com. null when no store is connected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shopDomain(String shopDomain) { + this.shopDomain = Optional.ofNullable(shopDomain); + return this; + } + + /** + *

The connected Shopify store domain spend is reported for, such as acme.myshopify.com. null when no store is connected.

+ */ + @java.lang.Override + @JsonSetter(value = "shop_domain", nulls = Nulls.SKIP) + public _FinalStage shopDomain(Optional shopDomain) { + this.shopDomain = shopDomain; + return this; + } + + /** + *

The leading characters of the stored Data-In API key, followed by asterisks. The full key is never returned. null when no key is stored.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maskedApiKey(Nullable maskedApiKey) { + if (maskedApiKey.isNull()) { + this.maskedApiKey = null; + } else if (maskedApiKey.isEmpty()) { + this.maskedApiKey = Optional.empty(); + } else { + this.maskedApiKey = Optional.of(maskedApiKey.get()); + } + return this; + } + + /** + *

The leading characters of the stored Data-In API key, followed by asterisks. The full key is never returned. null when no key is stored.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maskedApiKey(String maskedApiKey) { + this.maskedApiKey = Optional.ofNullable(maskedApiKey); + return this; + } + + /** + *

The leading characters of the stored Data-In API key, followed by asterisks. The full key is never returned. null when no key is stored.

+ */ + @java.lang.Override + @JsonSetter(value = "masked_api_key", nulls = Nulls.SKIP) + public _FinalStage maskedApiKey(Optional maskedApiKey) { + this.maskedApiKey = maskedApiKey; + return this; + } + + @java.lang.Override + public UpdatePreferencesResponseAdsTripleWhaleIntegration build() { + return new UpdatePreferencesResponseAdsTripleWhaleIntegration( + maskedApiKey, shopDomain, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus.java b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus.java new file mode 100644 index 00000000..b6835f35 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/preferences/types/UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus.java @@ -0,0 +1,99 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.preferences.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus { + public static final UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus REQUIRES_SHOPIFY_STORE = + new UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus( + Value.REQUIRES_SHOPIFY_STORE, "requires_shopify_store"); + + public static final UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus CONNECTED = + new UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus(Value.CONNECTED, "connected"); + + public static final UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus NOT_CONNECTED = + new UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus(Value.NOT_CONNECTED, "not_connected"); + + private final Value value; + + private final String string; + + UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus + && this.string.equals( + ((UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REQUIRES_SHOPIFY_STORE: + return visitor.visitRequiresShopifyStore(); + case CONNECTED: + return visitor.visitConnected(); + case NOT_CONNECTED: + return visitor.visitNotConnected(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus valueOf(String value) { + switch (value) { + case "requires_shopify_store": + return REQUIRES_SHOPIFY_STORE; + case "connected": + return CONNECTED; + case "not_connected": + return NOT_CONNECTED; + default: + return new UpdatePreferencesResponseAdsTripleWhaleIntegrationStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + CONNECTED, + + NOT_CONNECTED, + + REQUIRES_SHOPIFY_STORE, + + UNKNOWN + } + + public interface Visitor { + T visitConnected(); + + T visitNotConnected(); + + T visitRequiresShopifyStore(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/requests/CreateAccountsRequest.java b/src/main/java/com/whop/api/resources/accounts/requests/CreateAccountsRequest.java new file mode 100644 index 00000000..8c393c49 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/requests/CreateAccountsRequest.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAccountsRequest.Builder.class) +public final class CreateAccountsRequest { + private final Optional affiliateCode; + + private final Optional country; + + private final Optional email; + + private final Optional> metadata; + + private final Optional title; + + private final Map additionalProperties; + + private CreateAccountsRequest( + Optional affiliateCode, + Optional country, + Optional email, + Optional> metadata, + Optional title, + Map additionalProperties) { + this.affiliateCode = affiliateCode; + this.country = country; + this.email = email; + this.metadata = metadata; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The username, if any, of the partner who referred this account + */ + @JsonIgnore + public Optional getAffiliateCode() { + if (affiliateCode == null) { + return Optional.empty(); + } + return affiliateCode; + } + + /** + * @return The ISO 3166-1 alpha-2 country code where the account's business is located (e.g. US). Defaults to the parent account's country for connected accounts. + */ + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + /** + * @return The email address of the account owner. Required for Account API key requests. + */ + @JsonProperty("email") + public Optional getEmail() { + return email; + } + + /** + * @return Arbitrary key/value metadata to store on the account. + */ + @JsonProperty("metadata") + public Optional> getMetadata() { + return metadata; + } + + /** + * @return The display name of the account. Defaults to metadata.external_id or the owner's email when omitted. + */ + @JsonProperty("title") + public Optional getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("affiliate_code") + private Optional _getAffiliateCode() { + return affiliateCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAccountsRequest && equalTo((CreateAccountsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAccountsRequest other) { + return affiliateCode.equals(other.affiliateCode) + && country.equals(other.country) + && email.equals(other.email) + && metadata.equals(other.metadata) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.affiliateCode, this.country, this.email, this.metadata, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional affiliateCode = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAccountsRequest other) { + affiliateCode(other.getAffiliateCode()); + country(other.getCountry()); + email(other.getEmail()); + metadata(other.getMetadata()); + title(other.getTitle()); + return this; + } + + /** + *

The username, if any, of the partner who referred this account

+ */ + @JsonSetter(value = "affiliate_code", nulls = Nulls.SKIP) + public Builder affiliateCode(Optional affiliateCode) { + this.affiliateCode = affiliateCode; + return this; + } + + public Builder affiliateCode(String affiliateCode) { + this.affiliateCode = Optional.ofNullable(affiliateCode); + return this; + } + + public Builder affiliateCode(Nullable affiliateCode) { + if (affiliateCode.isNull()) { + this.affiliateCode = null; + } else if (affiliateCode.isEmpty()) { + this.affiliateCode = Optional.empty(); + } else { + this.affiliateCode = Optional.of(affiliateCode.get()); + } + return this; + } + + /** + *

The ISO 3166-1 alpha-2 country code where the account's business is located (e.g. US). Defaults to the parent account's country for connected accounts.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

The email address of the account owner. Required for Account API key requests.

+ */ + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

Arbitrary key/value metadata to store on the account.

+ */ + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

The display name of the account. Defaults to metadata.external_id or the owner's email when omitted.

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public CreateAccountsRequest build() { + return new CreateAccountsRequest(affiliateCode, country, email, metadata, title, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/requests/FormCompanyAccountsRequest.java b/src/main/java/com/whop/api/resources/accounts/requests/FormCompanyAccountsRequest.java new file mode 100644 index 00000000..e0a76dc7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/requests/FormCompanyAccountsRequest.java @@ -0,0 +1,720 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.accounts.types.FormCompanyAccountsRequestBusinessAddress; +import com.whop.api.resources.accounts.types.FormCompanyAccountsRequestEntitySuffix; +import com.whop.api.resources.accounts.types.FormCompanyAccountsRequestEntityType; +import com.whop.api.resources.accounts.types.FormCompanyAccountsRequestFormationState; +import com.whop.api.resources.accounts.types.FormCompanyAccountsRequestFoundersItem; +import com.whop.api.resources.accounts.types.FormCompanyAccountsRequestShareStructure; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FormCompanyAccountsRequest.Builder.class) +public final class FormCompanyAccountsRequest { + private final Optional businessAddress; + + private final String businessName; + + private final Optional businessPhone; + + private final String businessType; + + private final Optional businessWebsite; + + private final Optional entitySuffix; + + private final Optional entityType; + + private final Optional expediteEin; + + private final FormCompanyAccountsRequestFormationState formationState; + + private final List founders; + + private final String industryGroup; + + private final String industryType; + + private final Optional shareStructure; + + private final Optional useRegisteredAgent; + + private final Map additionalProperties; + + private FormCompanyAccountsRequest( + Optional businessAddress, + String businessName, + Optional businessPhone, + String businessType, + Optional businessWebsite, + Optional entitySuffix, + Optional entityType, + Optional expediteEin, + FormCompanyAccountsRequestFormationState formationState, + List founders, + String industryGroup, + String industryType, + Optional shareStructure, + Optional useRegisteredAgent, + Map additionalProperties) { + this.businessAddress = businessAddress; + this.businessName = businessName; + this.businessPhone = businessPhone; + this.businessType = businessType; + this.businessWebsite = businessWebsite; + this.entitySuffix = entitySuffix; + this.entityType = entityType; + this.expediteEin = expediteEin; + this.formationState = formationState; + this.founders = founders; + this.industryGroup = industryGroup; + this.industryType = industryType; + this.shareStructure = shareStructure; + this.useRegisteredAgent = useRegisteredAgent; + this.additionalProperties = additionalProperties; + } + + /** + * @return Company mailing address. Required unless use_registered_agent is true. + */ + @JsonProperty("business_address") + public Optional getBusinessAddress() { + return businessAddress; + } + + /** + * @return Legal name for the new company. + */ + @JsonProperty("business_name") + public String getBusinessName() { + return businessName; + } + + /** + * @return Business phone number in E.164 format, for example +12125550100. Required unless use_registered_agent is true. + */ + @JsonProperty("business_phone") + public Optional getBusinessPhone() { + return businessPhone; + } + + /** + * @return High-level business category, from the Whop business taxonomy. Valid values are listed on business types and industries glossary. + */ + @JsonProperty("business_type") + public String getBusinessType() { + return businessType; + } + + /** + * @return Company website URL. + */ + @JsonProperty("business_website") + public Optional getBusinessWebsite() { + return businessWebsite; + } + + /** + * @return Legal entity ending appended to business_name. LLC formations accept LLC, L.L.C, L.L.C. or Limited Liability Company and default to LLC; C-Corp formations accept Inc, Inc., Incorporated, Corp., Corporation, C Corp, C Corporation, CCorp or Company and default to Inc.. Unrecognized values fall back to the default for the entity type. + */ + @JsonProperty("entity_suffix") + public Optional getEntitySuffix() { + return entitySuffix; + } + + /** + * @return Legal entity type to form. Defaults to llc. + */ + @JsonProperty("entity_type") + public Optional getEntityType() { + return entityType; + } + + /** + * @return Request expedited EIN processing for an additional fee. Available only when no founder supplies an SSN. + */ + @JsonProperty("expedite_ein") + public Optional getExpediteEin() { + return expediteEin; + } + + /** + * @return Two-letter code of the US state (or DC) to form the company in. + */ + @JsonProperty("formation_state") + public FormCompanyAccountsRequestFormationState getFormationState() { + return formationState; + } + + /** + * @return The company's founders. Exactly one must be marked is_primary — the responsible party for the filing. + */ + @JsonProperty("founders") + public List getFounders() { + return founders; + } + + /** + * @return Industry group, from the Whop business taxonomy. Valid values are listed on business types and industries glossary. + */ + @JsonProperty("industry_group") + public String getIndustryGroup() { + return industryGroup; + } + + /** + * @return Specific industry vertical, from the Whop business taxonomy. Valid values are listed on business types and industries glossary. + */ + @JsonProperty("industry_type") + public String getIndustryType() { + return industryType; + } + + /** + * @return Authorized share structure. Required when entity_type is c_corp; ignored for LLCs. + */ + @JsonProperty("share_structure") + public Optional getShareStructure() { + return shareStructure; + } + + /** + * @return Use the registered agent's address as the company address instead of business_address. + */ + @JsonProperty("use_registered_agent") + public Optional getUseRegisteredAgent() { + return useRegisteredAgent; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FormCompanyAccountsRequest && equalTo((FormCompanyAccountsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FormCompanyAccountsRequest other) { + return businessAddress.equals(other.businessAddress) + && businessName.equals(other.businessName) + && businessPhone.equals(other.businessPhone) + && businessType.equals(other.businessType) + && businessWebsite.equals(other.businessWebsite) + && entitySuffix.equals(other.entitySuffix) + && entityType.equals(other.entityType) + && expediteEin.equals(other.expediteEin) + && formationState.equals(other.formationState) + && founders.equals(other.founders) + && industryGroup.equals(other.industryGroup) + && industryType.equals(other.industryType) + && shareStructure.equals(other.shareStructure) + && useRegisteredAgent.equals(other.useRegisteredAgent); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.businessAddress, + this.businessName, + this.businessPhone, + this.businessType, + this.businessWebsite, + this.entitySuffix, + this.entityType, + this.expediteEin, + this.formationState, + this.founders, + this.industryGroup, + this.industryType, + this.shareStructure, + this.useRegisteredAgent); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BusinessNameStage builder() { + return new Builder(); + } + + public interface BusinessNameStage { + /** + *

Legal name for the new company.

+ */ + BusinessTypeStage businessName(@NotNull String businessName); + + Builder from(FormCompanyAccountsRequest other); + } + + public interface BusinessTypeStage { + /** + *

High-level business category, from the Whop business taxonomy. Valid values are listed on business types and industries glossary.

+ */ + FormationStateStage businessType(@NotNull String businessType); + } + + public interface FormationStateStage { + /** + *

Two-letter code of the US state (or DC) to form the company in.

+ */ + IndustryGroupStage formationState(@NotNull FormCompanyAccountsRequestFormationState formationState); + } + + public interface IndustryGroupStage { + /** + *

Industry group, from the Whop business taxonomy. Valid values are listed on business types and industries glossary.

+ */ + IndustryTypeStage industryGroup(@NotNull String industryGroup); + } + + public interface IndustryTypeStage { + /** + *

Specific industry vertical, from the Whop business taxonomy. Valid values are listed on business types and industries glossary.

+ */ + _FinalStage industryType(@NotNull String industryType); + } + + public interface _FinalStage { + FormCompanyAccountsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Company mailing address. Required unless use_registered_agent is true.

+ */ + _FinalStage businessAddress(Optional businessAddress); + + _FinalStage businessAddress(FormCompanyAccountsRequestBusinessAddress businessAddress); + + /** + *

Business phone number in E.164 format, for example +12125550100. Required unless use_registered_agent is true.

+ */ + _FinalStage businessPhone(Optional businessPhone); + + _FinalStage businessPhone(String businessPhone); + + /** + *

Company website URL.

+ */ + _FinalStage businessWebsite(Optional businessWebsite); + + _FinalStage businessWebsite(String businessWebsite); + + /** + *

Legal entity ending appended to business_name. LLC formations accept LLC, L.L.C, L.L.C. or Limited Liability Company and default to LLC; C-Corp formations accept Inc, Inc., Incorporated, Corp., Corporation, C Corp, C Corporation, CCorp or Company and default to Inc.. Unrecognized values fall back to the default for the entity type.

+ */ + _FinalStage entitySuffix(Optional entitySuffix); + + _FinalStage entitySuffix(FormCompanyAccountsRequestEntitySuffix entitySuffix); + + /** + *

Legal entity type to form. Defaults to llc.

+ */ + _FinalStage entityType(Optional entityType); + + _FinalStage entityType(FormCompanyAccountsRequestEntityType entityType); + + /** + *

Request expedited EIN processing for an additional fee. Available only when no founder supplies an SSN.

+ */ + _FinalStage expediteEin(Optional expediteEin); + + _FinalStage expediteEin(Boolean expediteEin); + + /** + *

The company's founders. Exactly one must be marked is_primary — the responsible party for the filing.

+ */ + _FinalStage founders(List founders); + + _FinalStage addFounders(FormCompanyAccountsRequestFoundersItem founders); + + _FinalStage addAllFounders(List founders); + + /** + *

Authorized share structure. Required when entity_type is c_corp; ignored for LLCs.

+ */ + _FinalStage shareStructure(Optional shareStructure); + + _FinalStage shareStructure(FormCompanyAccountsRequestShareStructure shareStructure); + + /** + *

Use the registered agent's address as the company address instead of business_address.

+ */ + _FinalStage useRegisteredAgent(Optional useRegisteredAgent); + + _FinalStage useRegisteredAgent(Boolean useRegisteredAgent); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BusinessNameStage, + BusinessTypeStage, + FormationStateStage, + IndustryGroupStage, + IndustryTypeStage, + _FinalStage { + private String businessName; + + private String businessType; + + private FormCompanyAccountsRequestFormationState formationState; + + private String industryGroup; + + private String industryType; + + private Optional useRegisteredAgent = Optional.empty(); + + private Optional shareStructure = Optional.empty(); + + private List founders = new ArrayList<>(); + + private Optional expediteEin = Optional.empty(); + + private Optional entityType = Optional.empty(); + + private Optional entitySuffix = Optional.empty(); + + private Optional businessWebsite = Optional.empty(); + + private Optional businessPhone = Optional.empty(); + + private Optional businessAddress = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FormCompanyAccountsRequest other) { + businessAddress(other.getBusinessAddress()); + businessName(other.getBusinessName()); + businessPhone(other.getBusinessPhone()); + businessType(other.getBusinessType()); + businessWebsite(other.getBusinessWebsite()); + entitySuffix(other.getEntitySuffix()); + entityType(other.getEntityType()); + expediteEin(other.getExpediteEin()); + formationState(other.getFormationState()); + founders(other.getFounders()); + industryGroup(other.getIndustryGroup()); + industryType(other.getIndustryType()); + shareStructure(other.getShareStructure()); + useRegisteredAgent(other.getUseRegisteredAgent()); + return this; + } + + /** + *

Legal name for the new company.

+ *

Legal name for the new company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("business_name") + public BusinessTypeStage businessName(@NotNull String businessName) { + this.businessName = Objects.requireNonNull(businessName, "businessName must not be null"); + return this; + } + + /** + *

High-level business category, from the Whop business taxonomy. Valid values are listed on business types and industries glossary.

+ *

High-level business category, from the Whop business taxonomy. Valid values are listed on business types and industries glossary.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("business_type") + public FormationStateStage businessType(@NotNull String businessType) { + this.businessType = Objects.requireNonNull(businessType, "businessType must not be null"); + return this; + } + + /** + *

Two-letter code of the US state (or DC) to form the company in.

+ *

Two-letter code of the US state (or DC) to form the company in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("formation_state") + public IndustryGroupStage formationState(@NotNull FormCompanyAccountsRequestFormationState formationState) { + this.formationState = Objects.requireNonNull(formationState, "formationState must not be null"); + return this; + } + + /** + *

Industry group, from the Whop business taxonomy. Valid values are listed on business types and industries glossary.

+ *

Industry group, from the Whop business taxonomy. Valid values are listed on business types and industries glossary.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("industry_group") + public IndustryTypeStage industryGroup(@NotNull String industryGroup) { + this.industryGroup = Objects.requireNonNull(industryGroup, "industryGroup must not be null"); + return this; + } + + /** + *

Specific industry vertical, from the Whop business taxonomy. Valid values are listed on business types and industries glossary.

+ *

Specific industry vertical, from the Whop business taxonomy. Valid values are listed on business types and industries glossary.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("industry_type") + public _FinalStage industryType(@NotNull String industryType) { + this.industryType = Objects.requireNonNull(industryType, "industryType must not be null"); + return this; + } + + /** + *

Use the registered agent's address as the company address instead of business_address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage useRegisteredAgent(Boolean useRegisteredAgent) { + this.useRegisteredAgent = Optional.ofNullable(useRegisteredAgent); + return this; + } + + /** + *

Use the registered agent's address as the company address instead of business_address.

+ */ + @java.lang.Override + @JsonSetter(value = "use_registered_agent", nulls = Nulls.SKIP) + public _FinalStage useRegisteredAgent(Optional useRegisteredAgent) { + this.useRegisteredAgent = useRegisteredAgent; + return this; + } + + /** + *

Authorized share structure. Required when entity_type is c_corp; ignored for LLCs.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shareStructure(FormCompanyAccountsRequestShareStructure shareStructure) { + this.shareStructure = Optional.ofNullable(shareStructure); + return this; + } + + /** + *

Authorized share structure. Required when entity_type is c_corp; ignored for LLCs.

+ */ + @java.lang.Override + @JsonSetter(value = "share_structure", nulls = Nulls.SKIP) + public _FinalStage shareStructure(Optional shareStructure) { + this.shareStructure = shareStructure; + return this; + } + + /** + *

The company's founders. Exactly one must be marked is_primary — the responsible party for the filing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllFounders(List founders) { + if (founders != null) { + this.founders.addAll(founders); + } + return this; + } + + /** + *

The company's founders. Exactly one must be marked is_primary — the responsible party for the filing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addFounders(FormCompanyAccountsRequestFoundersItem founders) { + this.founders.add(founders); + return this; + } + + /** + *

The company's founders. Exactly one must be marked is_primary — the responsible party for the filing.

+ */ + @java.lang.Override + @JsonSetter(value = "founders", nulls = Nulls.SKIP) + public _FinalStage founders(List founders) { + this.founders.clear(); + if (founders != null) { + this.founders.addAll(founders); + } + return this; + } + + /** + *

Request expedited EIN processing for an additional fee. Available only when no founder supplies an SSN.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expediteEin(Boolean expediteEin) { + this.expediteEin = Optional.ofNullable(expediteEin); + return this; + } + + /** + *

Request expedited EIN processing for an additional fee. Available only when no founder supplies an SSN.

+ */ + @java.lang.Override + @JsonSetter(value = "expedite_ein", nulls = Nulls.SKIP) + public _FinalStage expediteEin(Optional expediteEin) { + this.expediteEin = expediteEin; + return this; + } + + /** + *

Legal entity type to form. Defaults to llc.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage entityType(FormCompanyAccountsRequestEntityType entityType) { + this.entityType = Optional.ofNullable(entityType); + return this; + } + + /** + *

Legal entity type to form. Defaults to llc.

+ */ + @java.lang.Override + @JsonSetter(value = "entity_type", nulls = Nulls.SKIP) + public _FinalStage entityType(Optional entityType) { + this.entityType = entityType; + return this; + } + + /** + *

Legal entity ending appended to business_name. LLC formations accept LLC, L.L.C, L.L.C. or Limited Liability Company and default to LLC; C-Corp formations accept Inc, Inc., Incorporated, Corp., Corporation, C Corp, C Corporation, CCorp or Company and default to Inc.. Unrecognized values fall back to the default for the entity type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage entitySuffix(FormCompanyAccountsRequestEntitySuffix entitySuffix) { + this.entitySuffix = Optional.ofNullable(entitySuffix); + return this; + } + + /** + *

Legal entity ending appended to business_name. LLC formations accept LLC, L.L.C, L.L.C. or Limited Liability Company and default to LLC; C-Corp formations accept Inc, Inc., Incorporated, Corp., Corporation, C Corp, C Corporation, CCorp or Company and default to Inc.. Unrecognized values fall back to the default for the entity type.

+ */ + @java.lang.Override + @JsonSetter(value = "entity_suffix", nulls = Nulls.SKIP) + public _FinalStage entitySuffix(Optional entitySuffix) { + this.entitySuffix = entitySuffix; + return this; + } + + /** + *

Company website URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessWebsite(String businessWebsite) { + this.businessWebsite = Optional.ofNullable(businessWebsite); + return this; + } + + /** + *

Company website URL.

+ */ + @java.lang.Override + @JsonSetter(value = "business_website", nulls = Nulls.SKIP) + public _FinalStage businessWebsite(Optional businessWebsite) { + this.businessWebsite = businessWebsite; + return this; + } + + /** + *

Business phone number in E.164 format, for example +12125550100. Required unless use_registered_agent is true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessPhone(String businessPhone) { + this.businessPhone = Optional.ofNullable(businessPhone); + return this; + } + + /** + *

Business phone number in E.164 format, for example +12125550100. Required unless use_registered_agent is true.

+ */ + @java.lang.Override + @JsonSetter(value = "business_phone", nulls = Nulls.SKIP) + public _FinalStage businessPhone(Optional businessPhone) { + this.businessPhone = businessPhone; + return this; + } + + /** + *

Company mailing address. Required unless use_registered_agent is true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessAddress(FormCompanyAccountsRequestBusinessAddress businessAddress) { + this.businessAddress = Optional.ofNullable(businessAddress); + return this; + } + + /** + *

Company mailing address. Required unless use_registered_agent is true.

+ */ + @java.lang.Override + @JsonSetter(value = "business_address", nulls = Nulls.SKIP) + public _FinalStage businessAddress(Optional businessAddress) { + this.businessAddress = businessAddress; + return this; + } + + @java.lang.Override + public FormCompanyAccountsRequest build() { + return new FormCompanyAccountsRequest( + businessAddress, + businessName, + businessPhone, + businessType, + businessWebsite, + entitySuffix, + entityType, + expediteEin, + formationState, + founders, + industryGroup, + industryType, + shareStructure, + useRegisteredAgent, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/requests/ListAccountsRequest.java b/src/main/java/com/whop/api/resources/accounts/requests/ListAccountsRequest.java new file mode 100644 index 00000000..445430c6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/requests/ListAccountsRequest.java @@ -0,0 +1,504 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.accounts.types.ListAccountsRequestDirection; +import com.whop.api.resources.accounts.types.ListAccountsRequestOrder; +import com.whop.api.resources.accounts.types.ListAccountsRequestStatus; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAccountsRequest.Builder.class) +public final class ListAccountsRequest { + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Optional order; + + private final Optional direction; + + private final Optional status; + + private final Optional query; + + private final Optional createdAfter; + + private final Optional createdBefore; + + private final Optional volumeMin; + + private final Optional volumeMax; + + private final Optional parentAccountId; + + private final Map additionalProperties; + + private ListAccountsRequest( + Optional first, + Optional after, + Optional last, + Optional before, + Optional order, + Optional direction, + Optional status, + Optional query, + Optional createdAfter, + Optional createdBefore, + Optional volumeMin, + Optional volumeMax, + Optional parentAccountId, + Map additionalProperties) { + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.order = order; + this.direction = direction; + this.status = status; + this.query = query; + this.createdAfter = createdAfter; + this.createdBefore = createdBefore; + this.volumeMin = volumeMin; + this.volumeMax = volumeMax; + this.parentAccountId = parentAccountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The number of accounts to return (default 10, max 50). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns accounts after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of accounts to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns accounts before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The field to sort accounts by. volume requires stats:read on the parent account. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Return only accounts with this status: active (includes accounts that have not entered payments review) or suspended. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Free-text filter on account title or ID. % and _ match literally. + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + /** + * @return Return only accounts created after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Return only accounts created before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Return only accounts whose lifetime USD volume is at least this value. Requires stats:read on the parent account. + */ + @JsonProperty("volume_min") + public Optional getVolumeMin() { + return volumeMin; + } + + /** + * @return Return only accounts whose lifetime USD volume is at most this value. Requires stats:read on the parent account. + */ + @JsonProperty("volume_max") + public Optional getVolumeMax() { + return volumeMax; + } + + /** + * @return For platforms: the parent account ID whose direct connected accounts to return. Requires payout:account:read on the parent account. + */ + @JsonProperty("parent_account_id") + public Optional getParentAccountId() { + return parentAccountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAccountsRequest && equalTo((ListAccountsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAccountsRequest other) { + return first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before) + && order.equals(other.order) + && direction.equals(other.direction) + && status.equals(other.status) + && query.equals(other.query) + && createdAfter.equals(other.createdAfter) + && createdBefore.equals(other.createdBefore) + && volumeMin.equals(other.volumeMin) + && volumeMax.equals(other.volumeMax) + && parentAccountId.equals(other.parentAccountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.first, + this.after, + this.last, + this.before, + this.order, + this.direction, + this.status, + this.query, + this.createdAfter, + this.createdBefore, + this.volumeMin, + this.volumeMax, + this.parentAccountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional query = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional volumeMin = Optional.empty(); + + private Optional volumeMax = Optional.empty(); + + private Optional parentAccountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListAccountsRequest other) { + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + order(other.getOrder()); + direction(other.getDirection()); + status(other.getStatus()); + query(other.getQuery()); + createdAfter(other.getCreatedAfter()); + createdBefore(other.getCreatedBefore()); + volumeMin(other.getVolumeMin()); + volumeMax(other.getVolumeMax()); + parentAccountId(other.getParentAccountId()); + return this; + } + + /** + *

The number of accounts to return (default 10, max 50).

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor; returns accounts after this position.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The number of accounts to return from the end of the range.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

A cursor; returns accounts before this position.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The field to sort accounts by. volume requires stats:read on the parent account.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListAccountsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListAccountsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Return only accounts with this status: active (includes accounts that have not entered payments review) or suspended.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListAccountsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Free-text filter on account title or ID. % and _ match literally.

+ */ + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public Builder query(Optional query) { + this.query = query; + return this; + } + + public Builder query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + /** + *

Return only accounts created after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Return only accounts created before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Return only accounts whose lifetime USD volume is at least this value. Requires stats:read on the parent account.

+ */ + @JsonSetter(value = "volume_min", nulls = Nulls.SKIP) + public Builder volumeMin(Optional volumeMin) { + this.volumeMin = volumeMin; + return this; + } + + public Builder volumeMin(Double volumeMin) { + this.volumeMin = Optional.ofNullable(volumeMin); + return this; + } + + /** + *

Return only accounts whose lifetime USD volume is at most this value. Requires stats:read on the parent account.

+ */ + @JsonSetter(value = "volume_max", nulls = Nulls.SKIP) + public Builder volumeMax(Optional volumeMax) { + this.volumeMax = volumeMax; + return this; + } + + public Builder volumeMax(Double volumeMax) { + this.volumeMax = Optional.ofNullable(volumeMax); + return this; + } + + /** + *

For platforms: the parent account ID whose direct connected accounts to return. Requires payout:account:read on the parent account.

+ */ + @JsonSetter(value = "parent_account_id", nulls = Nulls.SKIP) + public Builder parentAccountId(Optional parentAccountId) { + this.parentAccountId = parentAccountId; + return this; + } + + public Builder parentAccountId(String parentAccountId) { + this.parentAccountId = Optional.ofNullable(parentAccountId); + return this; + } + + public ListAccountsRequest build() { + return new ListAccountsRequest( + first, + after, + last, + before, + order, + direction, + status, + query, + createdAfter, + createdBefore, + volumeMin, + volumeMax, + parentAccountId, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/requests/RetrieveAccountsRequest.java b/src/main/java/com/whop/api/resources/accounts/requests/RetrieveAccountsRequest.java new file mode 100644 index 00000000..36169377 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/requests/RetrieveAccountsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveAccountsRequest.Builder.class) +public final class RetrieveAccountsRequest { + private final Map additionalProperties; + + private RetrieveAccountsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveAccountsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveAccountsRequest other) { + return this; + } + + public RetrieveAccountsRequest build() { + return new RetrieveAccountsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/requests/TransferOwnershipAccountsRequest.java b/src/main/java/com/whop/api/resources/accounts/requests/TransferOwnershipAccountsRequest.java new file mode 100644 index 00000000..92194c22 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/requests/TransferOwnershipAccountsRequest.java @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TransferOwnershipAccountsRequest.Builder.class) +public final class TransferOwnershipAccountsRequest { + private final Optional asPartner; + + private final String identifier; + + private final Map additionalProperties; + + private TransferOwnershipAccountsRequest( + Optional asPartner, String identifier, Map additionalProperties) { + this.asPartner = asPartner; + this.identifier = identifier; + this.additionalProperties = additionalProperties; + } + + /** + * @return If true, the current owner is credited as the account's Whop partner, earning partner commission on its sales. Requires the current owner to already be an enrolled Whop partner. Skipped if the account already has an active partner. + */ + @JsonProperty("as_partner") + public Optional getAsPartner() { + return asPartner; + } + + /** + * @return The user to transfer ownership to: a user ID (user_*) or an email address. An email address with no Whop account yet is sent an invite to create one. + */ + @JsonProperty("identifier") + public String getIdentifier() { + return identifier; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferOwnershipAccountsRequest && equalTo((TransferOwnershipAccountsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TransferOwnershipAccountsRequest other) { + return asPartner.equals(other.asPartner) && identifier.equals(other.identifier); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asPartner, this.identifier); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdentifierStage builder() { + return new Builder(); + } + + public interface IdentifierStage { + /** + *

The user to transfer ownership to: a user ID (user_*) or an email address. An email address with no Whop account yet is sent an invite to create one.

+ */ + _FinalStage identifier(@NotNull String identifier); + + Builder from(TransferOwnershipAccountsRequest other); + } + + public interface _FinalStage { + TransferOwnershipAccountsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

If true, the current owner is credited as the account's Whop partner, earning partner commission on its sales. Requires the current owner to already be an enrolled Whop partner. Skipped if the account already has an active partner.

+ */ + _FinalStage asPartner(Optional asPartner); + + _FinalStage asPartner(Boolean asPartner); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdentifierStage, _FinalStage { + private String identifier; + + private Optional asPartner = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TransferOwnershipAccountsRequest other) { + asPartner(other.getAsPartner()); + identifier(other.getIdentifier()); + return this; + } + + /** + *

The user to transfer ownership to: a user ID (user_*) or an email address. An email address with no Whop account yet is sent an invite to create one.

+ *

The user to transfer ownership to: a user ID (user_*) or an email address. An email address with no Whop account yet is sent an invite to create one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("identifier") + public _FinalStage identifier(@NotNull String identifier) { + this.identifier = Objects.requireNonNull(identifier, "identifier must not be null"); + return this; + } + + /** + *

If true, the current owner is credited as the account's Whop partner, earning partner commission on its sales. Requires the current owner to already be an enrolled Whop partner. Skipped if the account already has an active partner.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage asPartner(Boolean asPartner) { + this.asPartner = Optional.ofNullable(asPartner); + return this; + } + + /** + *

If true, the current owner is credited as the account's Whop partner, earning partner commission on its sales. Requires the current owner to already be an enrolled Whop partner. Skipped if the account already has an active partner.

+ */ + @java.lang.Override + @JsonSetter(value = "as_partner", nulls = Nulls.SKIP) + public _FinalStage asPartner(Optional asPartner) { + this.asPartner = asPartner; + return this; + } + + @java.lang.Override + public TransferOwnershipAccountsRequest build() { + return new TransferOwnershipAccountsRequest(asPartner, identifier, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/requests/UpdateAccountsRequest.java b/src/main/java/com/whop/api/resources/accounts/requests/UpdateAccountsRequest.java new file mode 100644 index 00000000..bb90bdf6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/requests/UpdateAccountsRequest.java @@ -0,0 +1,1764 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.accounts.types.UpdateAccountsRequestBannerImage; +import com.whop.api.resources.accounts.types.UpdateAccountsRequestBusinessAddress; +import com.whop.api.resources.accounts.types.UpdateAccountsRequestBusinessType; +import com.whop.api.resources.accounts.types.UpdateAccountsRequestHomePreferencesItem; +import com.whop.api.resources.accounts.types.UpdateAccountsRequestIndustryGroup; +import com.whop.api.resources.accounts.types.UpdateAccountsRequestLogo; +import com.whop.api.resources.accounts.types.UpdateAccountsRequestOnboardingType; +import com.whop.api.resources.accounts.types.UpdateAccountsRequestOpengraphImage; +import com.whop.api.resources.accounts.types.UpdateAccountsRequestOpengraphImageVariant; +import com.whop.api.resources.accounts.types.UpdateAccountsRequestStorePageConfig; +import com.whop.api.resources.accounts.types.UpdateAccountsRequestTaxCollectionEnabledStatesItem; +import com.whop.api.resources.accounts.types.UpdateAccountsRequestTaxIdentifiersItem; +import com.whop.api.resources.accounts.types.UpdateAccountsRequestTaxRemittedBy; +import com.whop.api.resources.accounts.types.UpdateAccountsRequestTaxType; +import com.whop.api.resources.accounts.types.UpdateAccountsRequestThreeDsLevel; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAccountsRequest.Builder.class) +public final class UpdateAccountsRequest { + private final Optional affiliateApplicationRequired; + + private final Optional affiliateInstructions; + + private final Optional bannerImage; + + private final Optional businessAddress; + + private final Optional businessName; + + private final Optional businessType; + + private final Optional collectVatId; + + private final Optional country; + + private final Optional description; + + private final Optional featuredAffiliateProductId; + + private final Optional> homePreferences; + + private final Optional industryGroup; + + private final Optional industryType; + + private final Optional invoicePrefix; + + private final Optional logo; + + private final Optional> metadata; + + private final Optional onboardingType; + + private final Optional opengraphImage; + + private final Optional opengraphImageVariant; + + private final Optional otherBusinessDescription; + + private final Optional otherIndustryDescription; + + private final Optional productTaxCodeId; + + private final Optional require2Fa; + + private final Optional route; + + private final Optional sendCustomerEmails; + + private final Optional showJoinedWhops; + + private final Optional showReviewsDtc; + + private final Optional showUserDirectory; + + private final Optional>> socialLinks; + + private final Optional storePageConfig; + + private final Optional targetAudience; + + private final Optional> taxCollectionEnabledStates; + + private final Optional> taxIdentifiers; + + private final Optional taxRemittedBy; + + private final Optional taxType; + + private final Optional threeDsLevel; + + private final Optional title; + + private final Optional useLogoAsOpengraphImageFallback; + + private final Map additionalProperties; + + private UpdateAccountsRequest( + Optional affiliateApplicationRequired, + Optional affiliateInstructions, + Optional bannerImage, + Optional businessAddress, + Optional businessName, + Optional businessType, + Optional collectVatId, + Optional country, + Optional description, + Optional featuredAffiliateProductId, + Optional> homePreferences, + Optional industryGroup, + Optional industryType, + Optional invoicePrefix, + Optional logo, + Optional> metadata, + Optional onboardingType, + Optional opengraphImage, + Optional opengraphImageVariant, + Optional otherBusinessDescription, + Optional otherIndustryDescription, + Optional productTaxCodeId, + Optional require2Fa, + Optional route, + Optional sendCustomerEmails, + Optional showJoinedWhops, + Optional showReviewsDtc, + Optional showUserDirectory, + Optional>> socialLinks, + Optional storePageConfig, + Optional targetAudience, + Optional> taxCollectionEnabledStates, + Optional> taxIdentifiers, + Optional taxRemittedBy, + Optional taxType, + Optional threeDsLevel, + Optional title, + Optional useLogoAsOpengraphImageFallback, + Map additionalProperties) { + this.affiliateApplicationRequired = affiliateApplicationRequired; + this.affiliateInstructions = affiliateInstructions; + this.bannerImage = bannerImage; + this.businessAddress = businessAddress; + this.businessName = businessName; + this.businessType = businessType; + this.collectVatId = collectVatId; + this.country = country; + this.description = description; + this.featuredAffiliateProductId = featuredAffiliateProductId; + this.homePreferences = homePreferences; + this.industryGroup = industryGroup; + this.industryType = industryType; + this.invoicePrefix = invoicePrefix; + this.logo = logo; + this.metadata = metadata; + this.onboardingType = onboardingType; + this.opengraphImage = opengraphImage; + this.opengraphImageVariant = opengraphImageVariant; + this.otherBusinessDescription = otherBusinessDescription; + this.otherIndustryDescription = otherIndustryDescription; + this.productTaxCodeId = productTaxCodeId; + this.require2Fa = require2Fa; + this.route = route; + this.sendCustomerEmails = sendCustomerEmails; + this.showJoinedWhops = showJoinedWhops; + this.showReviewsDtc = showReviewsDtc; + this.showUserDirectory = showUserDirectory; + this.socialLinks = socialLinks; + this.storePageConfig = storePageConfig; + this.targetAudience = targetAudience; + this.taxCollectionEnabledStates = taxCollectionEnabledStates; + this.taxIdentifiers = taxIdentifiers; + this.taxRemittedBy = taxRemittedBy; + this.taxType = taxType; + this.threeDsLevel = threeDsLevel; + this.title = title; + this.useLogoAsOpengraphImageFallback = useLogoAsOpengraphImageFallback; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether prospective affiliates must submit an application before promoting this account. + */ + @JsonProperty("affiliate_application_required") + public Optional getAffiliateApplicationRequired() { + return affiliateApplicationRequired; + } + + /** + * @return Guidelines shown to affiliates promoting this account. + */ + @JsonIgnore + public Optional getAffiliateInstructions() { + if (affiliateInstructions == null) { + return Optional.empty(); + } + return affiliateInstructions; + } + + /** + * @return Account banner image, used as the cover photo when creating a Whop-managed Facebook page. Image files up to 10 MB, except image/gif. Pass a JSON object containing an id from Create File. + */ + @JsonIgnore + public Optional getBannerImage() { + if (bannerImage == null) { + return Optional.empty(); + } + return bannerImage; + } + + /** + * @return Account business address used to calculate tax. A complete address in a supported country is required when tax_remitted_by is self. + */ + @JsonProperty("business_address") + public Optional getBusinessAddress() { + return businessAddress; + } + + /** + * @return The legal business name used with the account's tax address. + */ + @JsonIgnore + public Optional getBusinessName() { + if (businessName == null) { + return Optional.empty(); + } + return businessName; + } + + /** + * @return High-level business category for the account. See the business types and industries glossary for valid values. + */ + @JsonIgnore + public Optional getBusinessType() { + if (businessType == null) { + return Optional.empty(); + } + return businessType; + } + + /** + * @return Whether checkout shows a VAT/tax ID field for buyers to optionally enter. Does not require a VAT ID to purchase. + */ + @JsonProperty("collect_vat_id") + public Optional getCollectVatId() { + return collectVatId; + } + + /** + * @return Country where the account is located. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return Account promotional description. When creating a Whop-managed Facebook page, it is truncated to 155 characters and used as the About text. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The ID of the product to feature for affiliates. Pass null to clear. + */ + @JsonIgnore + public Optional getFeaturedAffiliateProductId() { + if (featuredAffiliateProductId == null) { + return Optional.empty(); + } + return featuredAffiliateProductId; + } + + /** + * @return Public account home page preferences. + */ + @JsonProperty("home_preferences") + public Optional> getHomePreferences() { + return homePreferences; + } + + /** + * @return Account industry group. See the business types and industries glossary for valid values. + */ + @JsonIgnore + public Optional getIndustryGroup() { + if (industryGroup == null) { + return Optional.empty(); + } + return industryGroup; + } + + /** + * @return Specific industry vertical for the account. See the business types and industries glossary for valid values. + */ + @JsonIgnore + public Optional getIndustryType() { + if (industryType == null) { + return Optional.empty(); + } + return industryType; + } + + /** + * @return Prefix used for account invoices. + */ + @JsonIgnore + public Optional getInvoicePrefix() { + if (invoicePrefix == null) { + return Optional.empty(); + } + return invoicePrefix; + } + + /** + * @return Account logo, used as the profile picture when creating a Whop-managed Facebook page. Image files up to 5 MB. Pass a JSON object containing an id from Create File. + */ + @JsonIgnore + public Optional getLogo() { + if (logo == null) { + return Optional.empty(); + } + return logo; + } + + /** + * @return Arbitrary key/value metadata to store on the account. + */ + @JsonProperty("metadata") + public Optional> getMetadata() { + return metadata; + } + + /** + * @return The type of onboarding the account has completed. + */ + @JsonIgnore + public Optional getOnboardingType() { + if (onboardingType == null) { + return Optional.empty(); + } + return onboardingType; + } + + /** + * @return Open Graph preview media used when the account is shared. Image and video files up to 5 MB. Pass a JSON object containing an id from Create File. + */ + @JsonIgnore + public Optional getOpengraphImage() { + if (opengraphImage == null) { + return Optional.empty(); + } + return opengraphImage; + } + + /** + * @return The account Open Graph image variant. + */ + @JsonIgnore + public Optional getOpengraphImageVariant() { + if (opengraphImageVariant == null) { + return Optional.empty(); + } + return opengraphImageVariant; + } + + /** + * @return The description of the business type when business_type is other. + */ + @JsonIgnore + public Optional getOtherBusinessDescription() { + if (otherBusinessDescription == null) { + return Optional.empty(); + } + return otherBusinessDescription; + } + + /** + * @return The description of the industry type when industry_type is other. + */ + @JsonIgnore + public Optional getOtherIndustryDescription() { + if (otherIndustryDescription == null) { + return Optional.empty(); + } + return otherIndustryDescription; + } + + /** + * @return ID of the tax classification code applied by default to the account's products. See the available product categories. + */ + @JsonIgnore + public Optional getProductTaxCodeId() { + if (productTaxCodeId == null) { + return Optional.empty(); + } + return productTaxCodeId; + } + + /** + * @return Whether the account requires authorized users to have two-factor authentication enabled. + */ + @JsonProperty("require_2fa") + public Optional getRequire2Fa() { + return require2Fa; + } + + /** + * @return The unique URL slug for the account. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Whether Whop sends transactional emails to customers on behalf of this account. + */ + @JsonProperty("send_customer_emails") + public Optional getSendCustomerEmails() { + return sendCustomerEmails; + } + + /** + * @return Whether the account appears in joined whops on other accounts. + */ + @JsonProperty("show_joined_whops") + public Optional getShowJoinedWhops() { + return showJoinedWhops; + } + + /** + * @return Whether reviews are displayed on direct-to-consumer product pages. + */ + @JsonProperty("show_reviews_dtc") + public Optional getShowReviewsDtc() { + return showReviewsDtc; + } + + /** + * @return Whether the account shows users in the user directory. + */ + @JsonProperty("show_user_directory") + public Optional getShowUserDirectory() { + return showUserDirectory; + } + + /** + * @return The full list of social links to display for the account. + */ + @JsonProperty("social_links") + public Optional>> getSocialLinks() { + return socialLinks; + } + + /** + * @return Account store page display configuration. + */ + @JsonIgnore + public Optional getStorePageConfig() { + if (storePageConfig == null) { + return Optional.empty(); + } + return storePageConfig; + } + + /** + * @return The target audience for this account. + */ + @JsonIgnore + public Optional getTargetAudience() { + if (targetAudience == null) { + return Optional.empty(); + } + return targetAudience; + } + + /** + * @return US state codes (50 states plus DC) where the account collects tax. Replaces the full set on update. Only settable when tax_remitted_by is self. + */ + @JsonProperty("tax_collection_enabled_states") + public Optional> getTaxCollectionEnabledStates() { + return taxCollectionEnabledStates; + } + + /** + * @return Account tax/VAT registrations to add or update. When tax_remitted_by is self, tax is calculated and collected only in the countries where the account holds a registration. + */ + @JsonProperty("tax_identifiers") + public Optional> getTaxIdentifiers() { + return taxIdentifiers; + } + + /** + * @return Determines whether Whop or the account calculates and remits tax. The account must provide a supported-country business address when it self-remits. + */ + @JsonProperty("tax_remitted_by") + public Optional getTaxRemittedBy() { + return taxRemittedBy; + } + + /** + * @return Determines whether tax is included in the listed price or added at checkout. + */ + @JsonProperty("tax_type") + public Optional getTaxType() { + return taxType; + } + + /** + * @return Account-level 3D Secure behavior. Set mandate_challenge to require cardholder verification on supported card payments, or null to use the standard checkout flow. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return The display name of the account. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return Whether the account uses its logo as the fallback Open Graph image. + */ + @JsonProperty("use_logo_as_opengraph_image_fallback") + public Optional getUseLogoAsOpengraphImageFallback() { + return useLogoAsOpengraphImageFallback; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("affiliate_instructions") + private Optional _getAffiliateInstructions() { + return affiliateInstructions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("banner_image") + private Optional _getBannerImage() { + return bannerImage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_name") + private Optional _getBusinessName() { + return businessName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_type") + private Optional _getBusinessType() { + return businessType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("featured_affiliate_product_id") + private Optional _getFeaturedAffiliateProductId() { + return featuredAffiliateProductId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("industry_group") + private Optional _getIndustryGroup() { + return industryGroup; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("industry_type") + private Optional _getIndustryType() { + return industryType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("invoice_prefix") + private Optional _getInvoicePrefix() { + return invoicePrefix; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo") + private Optional _getLogo() { + return logo; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("onboarding_type") + private Optional _getOnboardingType() { + return onboardingType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("opengraph_image") + private Optional _getOpengraphImage() { + return opengraphImage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("opengraph_image_variant") + private Optional _getOpengraphImageVariant() { + return opengraphImageVariant; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("other_business_description") + private Optional _getOtherBusinessDescription() { + return otherBusinessDescription; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("other_industry_description") + private Optional _getOtherIndustryDescription() { + return otherIndustryDescription; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_tax_code_id") + private Optional _getProductTaxCodeId() { + return productTaxCodeId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("store_page_config") + private Optional _getStorePageConfig() { + return storePageConfig; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("target_audience") + private Optional _getTargetAudience() { + return targetAudience; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAccountsRequest && equalTo((UpdateAccountsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAccountsRequest other) { + return affiliateApplicationRequired.equals(other.affiliateApplicationRequired) + && affiliateInstructions.equals(other.affiliateInstructions) + && bannerImage.equals(other.bannerImage) + && businessAddress.equals(other.businessAddress) + && businessName.equals(other.businessName) + && businessType.equals(other.businessType) + && collectVatId.equals(other.collectVatId) + && country.equals(other.country) + && description.equals(other.description) + && featuredAffiliateProductId.equals(other.featuredAffiliateProductId) + && homePreferences.equals(other.homePreferences) + && industryGroup.equals(other.industryGroup) + && industryType.equals(other.industryType) + && invoicePrefix.equals(other.invoicePrefix) + && logo.equals(other.logo) + && metadata.equals(other.metadata) + && onboardingType.equals(other.onboardingType) + && opengraphImage.equals(other.opengraphImage) + && opengraphImageVariant.equals(other.opengraphImageVariant) + && otherBusinessDescription.equals(other.otherBusinessDescription) + && otherIndustryDescription.equals(other.otherIndustryDescription) + && productTaxCodeId.equals(other.productTaxCodeId) + && require2Fa.equals(other.require2Fa) + && route.equals(other.route) + && sendCustomerEmails.equals(other.sendCustomerEmails) + && showJoinedWhops.equals(other.showJoinedWhops) + && showReviewsDtc.equals(other.showReviewsDtc) + && showUserDirectory.equals(other.showUserDirectory) + && socialLinks.equals(other.socialLinks) + && storePageConfig.equals(other.storePageConfig) + && targetAudience.equals(other.targetAudience) + && taxCollectionEnabledStates.equals(other.taxCollectionEnabledStates) + && taxIdentifiers.equals(other.taxIdentifiers) + && taxRemittedBy.equals(other.taxRemittedBy) + && taxType.equals(other.taxType) + && threeDsLevel.equals(other.threeDsLevel) + && title.equals(other.title) + && useLogoAsOpengraphImageFallback.equals(other.useLogoAsOpengraphImageFallback); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.affiliateApplicationRequired, + this.affiliateInstructions, + this.bannerImage, + this.businessAddress, + this.businessName, + this.businessType, + this.collectVatId, + this.country, + this.description, + this.featuredAffiliateProductId, + this.homePreferences, + this.industryGroup, + this.industryType, + this.invoicePrefix, + this.logo, + this.metadata, + this.onboardingType, + this.opengraphImage, + this.opengraphImageVariant, + this.otherBusinessDescription, + this.otherIndustryDescription, + this.productTaxCodeId, + this.require2Fa, + this.route, + this.sendCustomerEmails, + this.showJoinedWhops, + this.showReviewsDtc, + this.showUserDirectory, + this.socialLinks, + this.storePageConfig, + this.targetAudience, + this.taxCollectionEnabledStates, + this.taxIdentifiers, + this.taxRemittedBy, + this.taxType, + this.threeDsLevel, + this.title, + this.useLogoAsOpengraphImageFallback); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional affiliateApplicationRequired = Optional.empty(); + + private Optional affiliateInstructions = Optional.empty(); + + private Optional bannerImage = Optional.empty(); + + private Optional businessAddress = Optional.empty(); + + private Optional businessName = Optional.empty(); + + private Optional businessType = Optional.empty(); + + private Optional collectVatId = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional featuredAffiliateProductId = Optional.empty(); + + private Optional> homePreferences = Optional.empty(); + + private Optional industryGroup = Optional.empty(); + + private Optional industryType = Optional.empty(); + + private Optional invoicePrefix = Optional.empty(); + + private Optional logo = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional onboardingType = Optional.empty(); + + private Optional opengraphImage = Optional.empty(); + + private Optional opengraphImageVariant = Optional.empty(); + + private Optional otherBusinessDescription = Optional.empty(); + + private Optional otherIndustryDescription = Optional.empty(); + + private Optional productTaxCodeId = Optional.empty(); + + private Optional require2Fa = Optional.empty(); + + private Optional route = Optional.empty(); + + private Optional sendCustomerEmails = Optional.empty(); + + private Optional showJoinedWhops = Optional.empty(); + + private Optional showReviewsDtc = Optional.empty(); + + private Optional showUserDirectory = Optional.empty(); + + private Optional>> socialLinks = Optional.empty(); + + private Optional storePageConfig = Optional.empty(); + + private Optional targetAudience = Optional.empty(); + + private Optional> taxCollectionEnabledStates = + Optional.empty(); + + private Optional> taxIdentifiers = Optional.empty(); + + private Optional taxRemittedBy = Optional.empty(); + + private Optional taxType = Optional.empty(); + + private Optional threeDsLevel = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional useLogoAsOpengraphImageFallback = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAccountsRequest other) { + affiliateApplicationRequired(other.getAffiliateApplicationRequired()); + affiliateInstructions(other.getAffiliateInstructions()); + bannerImage(other.getBannerImage()); + businessAddress(other.getBusinessAddress()); + businessName(other.getBusinessName()); + businessType(other.getBusinessType()); + collectVatId(other.getCollectVatId()); + country(other.getCountry()); + description(other.getDescription()); + featuredAffiliateProductId(other.getFeaturedAffiliateProductId()); + homePreferences(other.getHomePreferences()); + industryGroup(other.getIndustryGroup()); + industryType(other.getIndustryType()); + invoicePrefix(other.getInvoicePrefix()); + logo(other.getLogo()); + metadata(other.getMetadata()); + onboardingType(other.getOnboardingType()); + opengraphImage(other.getOpengraphImage()); + opengraphImageVariant(other.getOpengraphImageVariant()); + otherBusinessDescription(other.getOtherBusinessDescription()); + otherIndustryDescription(other.getOtherIndustryDescription()); + productTaxCodeId(other.getProductTaxCodeId()); + require2Fa(other.getRequire2Fa()); + route(other.getRoute()); + sendCustomerEmails(other.getSendCustomerEmails()); + showJoinedWhops(other.getShowJoinedWhops()); + showReviewsDtc(other.getShowReviewsDtc()); + showUserDirectory(other.getShowUserDirectory()); + socialLinks(other.getSocialLinks()); + storePageConfig(other.getStorePageConfig()); + targetAudience(other.getTargetAudience()); + taxCollectionEnabledStates(other.getTaxCollectionEnabledStates()); + taxIdentifiers(other.getTaxIdentifiers()); + taxRemittedBy(other.getTaxRemittedBy()); + taxType(other.getTaxType()); + threeDsLevel(other.getThreeDsLevel()); + title(other.getTitle()); + useLogoAsOpengraphImageFallback(other.getUseLogoAsOpengraphImageFallback()); + return this; + } + + /** + *

Whether prospective affiliates must submit an application before promoting this account.

+ */ + @JsonSetter(value = "affiliate_application_required", nulls = Nulls.SKIP) + public Builder affiliateApplicationRequired(Optional affiliateApplicationRequired) { + this.affiliateApplicationRequired = affiliateApplicationRequired; + return this; + } + + public Builder affiliateApplicationRequired(Boolean affiliateApplicationRequired) { + this.affiliateApplicationRequired = Optional.ofNullable(affiliateApplicationRequired); + return this; + } + + /** + *

Guidelines shown to affiliates promoting this account.

+ */ + @JsonSetter(value = "affiliate_instructions", nulls = Nulls.SKIP) + public Builder affiliateInstructions(Optional affiliateInstructions) { + this.affiliateInstructions = affiliateInstructions; + return this; + } + + public Builder affiliateInstructions(String affiliateInstructions) { + this.affiliateInstructions = Optional.ofNullable(affiliateInstructions); + return this; + } + + public Builder affiliateInstructions(Nullable affiliateInstructions) { + if (affiliateInstructions.isNull()) { + this.affiliateInstructions = null; + } else if (affiliateInstructions.isEmpty()) { + this.affiliateInstructions = Optional.empty(); + } else { + this.affiliateInstructions = Optional.of(affiliateInstructions.get()); + } + return this; + } + + /** + *

Account banner image, used as the cover photo when creating a Whop-managed Facebook page. Image files up to 10 MB, except image/gif. Pass a JSON object containing an id from Create File.

+ */ + @JsonSetter(value = "banner_image", nulls = Nulls.SKIP) + public Builder bannerImage(Optional bannerImage) { + this.bannerImage = bannerImage; + return this; + } + + public Builder bannerImage(UpdateAccountsRequestBannerImage bannerImage) { + this.bannerImage = Optional.ofNullable(bannerImage); + return this; + } + + public Builder bannerImage(Nullable bannerImage) { + if (bannerImage.isNull()) { + this.bannerImage = null; + } else if (bannerImage.isEmpty()) { + this.bannerImage = Optional.empty(); + } else { + this.bannerImage = Optional.of(bannerImage.get()); + } + return this; + } + + /** + *

Account business address used to calculate tax. A complete address in a supported country is required when tax_remitted_by is self.

+ */ + @JsonSetter(value = "business_address", nulls = Nulls.SKIP) + public Builder businessAddress(Optional businessAddress) { + this.businessAddress = businessAddress; + return this; + } + + public Builder businessAddress(UpdateAccountsRequestBusinessAddress businessAddress) { + this.businessAddress = Optional.ofNullable(businessAddress); + return this; + } + + /** + *

The legal business name used with the account's tax address.

+ */ + @JsonSetter(value = "business_name", nulls = Nulls.SKIP) + public Builder businessName(Optional businessName) { + this.businessName = businessName; + return this; + } + + public Builder businessName(String businessName) { + this.businessName = Optional.ofNullable(businessName); + return this; + } + + public Builder businessName(Nullable businessName) { + if (businessName.isNull()) { + this.businessName = null; + } else if (businessName.isEmpty()) { + this.businessName = Optional.empty(); + } else { + this.businessName = Optional.of(businessName.get()); + } + return this; + } + + /** + *

High-level business category for the account. See the business types and industries glossary for valid values.

+ */ + @JsonSetter(value = "business_type", nulls = Nulls.SKIP) + public Builder businessType(Optional businessType) { + this.businessType = businessType; + return this; + } + + public Builder businessType(UpdateAccountsRequestBusinessType businessType) { + this.businessType = Optional.ofNullable(businessType); + return this; + } + + public Builder businessType(Nullable businessType) { + if (businessType.isNull()) { + this.businessType = null; + } else if (businessType.isEmpty()) { + this.businessType = Optional.empty(); + } else { + this.businessType = Optional.of(businessType.get()); + } + return this; + } + + /** + *

Whether checkout shows a VAT/tax ID field for buyers to optionally enter. Does not require a VAT ID to purchase.

+ */ + @JsonSetter(value = "collect_vat_id", nulls = Nulls.SKIP) + public Builder collectVatId(Optional collectVatId) { + this.collectVatId = collectVatId; + return this; + } + + public Builder collectVatId(Boolean collectVatId) { + this.collectVatId = Optional.ofNullable(collectVatId); + return this; + } + + /** + *

Country where the account is located.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

Account promotional description. When creating a Whop-managed Facebook page, it is truncated to 155 characters and used as the About text.

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public Builder description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

The ID of the product to feature for affiliates. Pass null to clear.

+ */ + @JsonSetter(value = "featured_affiliate_product_id", nulls = Nulls.SKIP) + public Builder featuredAffiliateProductId(Optional featuredAffiliateProductId) { + this.featuredAffiliateProductId = featuredAffiliateProductId; + return this; + } + + public Builder featuredAffiliateProductId(String featuredAffiliateProductId) { + this.featuredAffiliateProductId = Optional.ofNullable(featuredAffiliateProductId); + return this; + } + + public Builder featuredAffiliateProductId(Nullable featuredAffiliateProductId) { + if (featuredAffiliateProductId.isNull()) { + this.featuredAffiliateProductId = null; + } else if (featuredAffiliateProductId.isEmpty()) { + this.featuredAffiliateProductId = Optional.empty(); + } else { + this.featuredAffiliateProductId = Optional.of(featuredAffiliateProductId.get()); + } + return this; + } + + /** + *

Public account home page preferences.

+ */ + @JsonSetter(value = "home_preferences", nulls = Nulls.SKIP) + public Builder homePreferences(Optional> homePreferences) { + this.homePreferences = homePreferences; + return this; + } + + public Builder homePreferences(List homePreferences) { + this.homePreferences = Optional.ofNullable(homePreferences); + return this; + } + + /** + *

Account industry group. See the business types and industries glossary for valid values.

+ */ + @JsonSetter(value = "industry_group", nulls = Nulls.SKIP) + public Builder industryGroup(Optional industryGroup) { + this.industryGroup = industryGroup; + return this; + } + + public Builder industryGroup(UpdateAccountsRequestIndustryGroup industryGroup) { + this.industryGroup = Optional.ofNullable(industryGroup); + return this; + } + + public Builder industryGroup(Nullable industryGroup) { + if (industryGroup.isNull()) { + this.industryGroup = null; + } else if (industryGroup.isEmpty()) { + this.industryGroup = Optional.empty(); + } else { + this.industryGroup = Optional.of(industryGroup.get()); + } + return this; + } + + /** + *

Specific industry vertical for the account. See the business types and industries glossary for valid values.

+ */ + @JsonSetter(value = "industry_type", nulls = Nulls.SKIP) + public Builder industryType(Optional industryType) { + this.industryType = industryType; + return this; + } + + public Builder industryType(String industryType) { + this.industryType = Optional.ofNullable(industryType); + return this; + } + + public Builder industryType(Nullable industryType) { + if (industryType.isNull()) { + this.industryType = null; + } else if (industryType.isEmpty()) { + this.industryType = Optional.empty(); + } else { + this.industryType = Optional.of(industryType.get()); + } + return this; + } + + /** + *

Prefix used for account invoices.

+ */ + @JsonSetter(value = "invoice_prefix", nulls = Nulls.SKIP) + public Builder invoicePrefix(Optional invoicePrefix) { + this.invoicePrefix = invoicePrefix; + return this; + } + + public Builder invoicePrefix(String invoicePrefix) { + this.invoicePrefix = Optional.ofNullable(invoicePrefix); + return this; + } + + public Builder invoicePrefix(Nullable invoicePrefix) { + if (invoicePrefix.isNull()) { + this.invoicePrefix = null; + } else if (invoicePrefix.isEmpty()) { + this.invoicePrefix = Optional.empty(); + } else { + this.invoicePrefix = Optional.of(invoicePrefix.get()); + } + return this; + } + + /** + *

Account logo, used as the profile picture when creating a Whop-managed Facebook page. Image files up to 5 MB. Pass a JSON object containing an id from Create File.

+ */ + @JsonSetter(value = "logo", nulls = Nulls.SKIP) + public Builder logo(Optional logo) { + this.logo = logo; + return this; + } + + public Builder logo(UpdateAccountsRequestLogo logo) { + this.logo = Optional.ofNullable(logo); + return this; + } + + public Builder logo(Nullable logo) { + if (logo.isNull()) { + this.logo = null; + } else if (logo.isEmpty()) { + this.logo = Optional.empty(); + } else { + this.logo = Optional.of(logo.get()); + } + return this; + } + + /** + *

Arbitrary key/value metadata to store on the account.

+ */ + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

The type of onboarding the account has completed.

+ */ + @JsonSetter(value = "onboarding_type", nulls = Nulls.SKIP) + public Builder onboardingType(Optional onboardingType) { + this.onboardingType = onboardingType; + return this; + } + + public Builder onboardingType(UpdateAccountsRequestOnboardingType onboardingType) { + this.onboardingType = Optional.ofNullable(onboardingType); + return this; + } + + public Builder onboardingType(Nullable onboardingType) { + if (onboardingType.isNull()) { + this.onboardingType = null; + } else if (onboardingType.isEmpty()) { + this.onboardingType = Optional.empty(); + } else { + this.onboardingType = Optional.of(onboardingType.get()); + } + return this; + } + + /** + *

Open Graph preview media used when the account is shared. Image and video files up to 5 MB. Pass a JSON object containing an id from Create File.

+ */ + @JsonSetter(value = "opengraph_image", nulls = Nulls.SKIP) + public Builder opengraphImage(Optional opengraphImage) { + this.opengraphImage = opengraphImage; + return this; + } + + public Builder opengraphImage(UpdateAccountsRequestOpengraphImage opengraphImage) { + this.opengraphImage = Optional.ofNullable(opengraphImage); + return this; + } + + public Builder opengraphImage(Nullable opengraphImage) { + if (opengraphImage.isNull()) { + this.opengraphImage = null; + } else if (opengraphImage.isEmpty()) { + this.opengraphImage = Optional.empty(); + } else { + this.opengraphImage = Optional.of(opengraphImage.get()); + } + return this; + } + + /** + *

The account Open Graph image variant.

+ */ + @JsonSetter(value = "opengraph_image_variant", nulls = Nulls.SKIP) + public Builder opengraphImageVariant( + Optional opengraphImageVariant) { + this.opengraphImageVariant = opengraphImageVariant; + return this; + } + + public Builder opengraphImageVariant(UpdateAccountsRequestOpengraphImageVariant opengraphImageVariant) { + this.opengraphImageVariant = Optional.ofNullable(opengraphImageVariant); + return this; + } + + public Builder opengraphImageVariant( + Nullable opengraphImageVariant) { + if (opengraphImageVariant.isNull()) { + this.opengraphImageVariant = null; + } else if (opengraphImageVariant.isEmpty()) { + this.opengraphImageVariant = Optional.empty(); + } else { + this.opengraphImageVariant = Optional.of(opengraphImageVariant.get()); + } + return this; + } + + /** + *

The description of the business type when business_type is other.

+ */ + @JsonSetter(value = "other_business_description", nulls = Nulls.SKIP) + public Builder otherBusinessDescription(Optional otherBusinessDescription) { + this.otherBusinessDescription = otherBusinessDescription; + return this; + } + + public Builder otherBusinessDescription(String otherBusinessDescription) { + this.otherBusinessDescription = Optional.ofNullable(otherBusinessDescription); + return this; + } + + public Builder otherBusinessDescription(Nullable otherBusinessDescription) { + if (otherBusinessDescription.isNull()) { + this.otherBusinessDescription = null; + } else if (otherBusinessDescription.isEmpty()) { + this.otherBusinessDescription = Optional.empty(); + } else { + this.otherBusinessDescription = Optional.of(otherBusinessDescription.get()); + } + return this; + } + + /** + *

The description of the industry type when industry_type is other.

+ */ + @JsonSetter(value = "other_industry_description", nulls = Nulls.SKIP) + public Builder otherIndustryDescription(Optional otherIndustryDescription) { + this.otherIndustryDescription = otherIndustryDescription; + return this; + } + + public Builder otherIndustryDescription(String otherIndustryDescription) { + this.otherIndustryDescription = Optional.ofNullable(otherIndustryDescription); + return this; + } + + public Builder otherIndustryDescription(Nullable otherIndustryDescription) { + if (otherIndustryDescription.isNull()) { + this.otherIndustryDescription = null; + } else if (otherIndustryDescription.isEmpty()) { + this.otherIndustryDescription = Optional.empty(); + } else { + this.otherIndustryDescription = Optional.of(otherIndustryDescription.get()); + } + return this; + } + + /** + *

ID of the tax classification code applied by default to the account's products. See the available product categories.

+ */ + @JsonSetter(value = "product_tax_code_id", nulls = Nulls.SKIP) + public Builder productTaxCodeId(Optional productTaxCodeId) { + this.productTaxCodeId = productTaxCodeId; + return this; + } + + public Builder productTaxCodeId(String productTaxCodeId) { + this.productTaxCodeId = Optional.ofNullable(productTaxCodeId); + return this; + } + + public Builder productTaxCodeId(Nullable productTaxCodeId) { + if (productTaxCodeId.isNull()) { + this.productTaxCodeId = null; + } else if (productTaxCodeId.isEmpty()) { + this.productTaxCodeId = Optional.empty(); + } else { + this.productTaxCodeId = Optional.of(productTaxCodeId.get()); + } + return this; + } + + /** + *

Whether the account requires authorized users to have two-factor authentication enabled.

+ */ + @JsonSetter(value = "require_2fa", nulls = Nulls.SKIP) + public Builder require2Fa(Optional require2Fa) { + this.require2Fa = require2Fa; + return this; + } + + public Builder require2Fa(Boolean require2Fa) { + this.require2Fa = Optional.ofNullable(require2Fa); + return this; + } + + /** + *

The unique URL slug for the account.

+ */ + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public Builder route(Optional route) { + this.route = route; + return this; + } + + public Builder route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + public Builder route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Whether Whop sends transactional emails to customers on behalf of this account.

+ */ + @JsonSetter(value = "send_customer_emails", nulls = Nulls.SKIP) + public Builder sendCustomerEmails(Optional sendCustomerEmails) { + this.sendCustomerEmails = sendCustomerEmails; + return this; + } + + public Builder sendCustomerEmails(Boolean sendCustomerEmails) { + this.sendCustomerEmails = Optional.ofNullable(sendCustomerEmails); + return this; + } + + /** + *

Whether the account appears in joined whops on other accounts.

+ */ + @JsonSetter(value = "show_joined_whops", nulls = Nulls.SKIP) + public Builder showJoinedWhops(Optional showJoinedWhops) { + this.showJoinedWhops = showJoinedWhops; + return this; + } + + public Builder showJoinedWhops(Boolean showJoinedWhops) { + this.showJoinedWhops = Optional.ofNullable(showJoinedWhops); + return this; + } + + /** + *

Whether reviews are displayed on direct-to-consumer product pages.

+ */ + @JsonSetter(value = "show_reviews_dtc", nulls = Nulls.SKIP) + public Builder showReviewsDtc(Optional showReviewsDtc) { + this.showReviewsDtc = showReviewsDtc; + return this; + } + + public Builder showReviewsDtc(Boolean showReviewsDtc) { + this.showReviewsDtc = Optional.ofNullable(showReviewsDtc); + return this; + } + + /** + *

Whether the account shows users in the user directory.

+ */ + @JsonSetter(value = "show_user_directory", nulls = Nulls.SKIP) + public Builder showUserDirectory(Optional showUserDirectory) { + this.showUserDirectory = showUserDirectory; + return this; + } + + public Builder showUserDirectory(Boolean showUserDirectory) { + this.showUserDirectory = Optional.ofNullable(showUserDirectory); + return this; + } + + /** + *

The full list of social links to display for the account.

+ */ + @JsonSetter(value = "social_links", nulls = Nulls.SKIP) + public Builder socialLinks(Optional>> socialLinks) { + this.socialLinks = socialLinks; + return this; + } + + public Builder socialLinks(List> socialLinks) { + this.socialLinks = Optional.ofNullable(socialLinks); + return this; + } + + /** + *

Account store page display configuration.

+ */ + @JsonSetter(value = "store_page_config", nulls = Nulls.SKIP) + public Builder storePageConfig(Optional storePageConfig) { + this.storePageConfig = storePageConfig; + return this; + } + + public Builder storePageConfig(UpdateAccountsRequestStorePageConfig storePageConfig) { + this.storePageConfig = Optional.ofNullable(storePageConfig); + return this; + } + + public Builder storePageConfig(Nullable storePageConfig) { + if (storePageConfig.isNull()) { + this.storePageConfig = null; + } else if (storePageConfig.isEmpty()) { + this.storePageConfig = Optional.empty(); + } else { + this.storePageConfig = Optional.of(storePageConfig.get()); + } + return this; + } + + /** + *

The target audience for this account.

+ */ + @JsonSetter(value = "target_audience", nulls = Nulls.SKIP) + public Builder targetAudience(Optional targetAudience) { + this.targetAudience = targetAudience; + return this; + } + + public Builder targetAudience(String targetAudience) { + this.targetAudience = Optional.ofNullable(targetAudience); + return this; + } + + public Builder targetAudience(Nullable targetAudience) { + if (targetAudience.isNull()) { + this.targetAudience = null; + } else if (targetAudience.isEmpty()) { + this.targetAudience = Optional.empty(); + } else { + this.targetAudience = Optional.of(targetAudience.get()); + } + return this; + } + + /** + *

US state codes (50 states plus DC) where the account collects tax. Replaces the full set on update. Only settable when tax_remitted_by is self.

+ */ + @JsonSetter(value = "tax_collection_enabled_states", nulls = Nulls.SKIP) + public Builder taxCollectionEnabledStates( + Optional> taxCollectionEnabledStates) { + this.taxCollectionEnabledStates = taxCollectionEnabledStates; + return this; + } + + public Builder taxCollectionEnabledStates( + List taxCollectionEnabledStates) { + this.taxCollectionEnabledStates = Optional.ofNullable(taxCollectionEnabledStates); + return this; + } + + /** + *

Account tax/VAT registrations to add or update. When tax_remitted_by is self, tax is calculated and collected only in the countries where the account holds a registration.

+ */ + @JsonSetter(value = "tax_identifiers", nulls = Nulls.SKIP) + public Builder taxIdentifiers(Optional> taxIdentifiers) { + this.taxIdentifiers = taxIdentifiers; + return this; + } + + public Builder taxIdentifiers(List taxIdentifiers) { + this.taxIdentifiers = Optional.ofNullable(taxIdentifiers); + return this; + } + + /** + *

Determines whether Whop or the account calculates and remits tax. The account must provide a supported-country business address when it self-remits.

+ */ + @JsonSetter(value = "tax_remitted_by", nulls = Nulls.SKIP) + public Builder taxRemittedBy(Optional taxRemittedBy) { + this.taxRemittedBy = taxRemittedBy; + return this; + } + + public Builder taxRemittedBy(UpdateAccountsRequestTaxRemittedBy taxRemittedBy) { + this.taxRemittedBy = Optional.ofNullable(taxRemittedBy); + return this; + } + + /** + *

Determines whether tax is included in the listed price or added at checkout.

+ */ + @JsonSetter(value = "tax_type", nulls = Nulls.SKIP) + public Builder taxType(Optional taxType) { + this.taxType = taxType; + return this; + } + + public Builder taxType(UpdateAccountsRequestTaxType taxType) { + this.taxType = Optional.ofNullable(taxType); + return this; + } + + /** + *

Account-level 3D Secure behavior. Set mandate_challenge to require cardholder verification on supported card payments, or null to use the standard checkout flow.

+ */ + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public Builder threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + public Builder threeDsLevel(UpdateAccountsRequestThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + public Builder threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

The display name of the account.

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Whether the account uses its logo as the fallback Open Graph image.

+ */ + @JsonSetter(value = "use_logo_as_opengraph_image_fallback", nulls = Nulls.SKIP) + public Builder useLogoAsOpengraphImageFallback(Optional useLogoAsOpengraphImageFallback) { + this.useLogoAsOpengraphImageFallback = useLogoAsOpengraphImageFallback; + return this; + } + + public Builder useLogoAsOpengraphImageFallback(Boolean useLogoAsOpengraphImageFallback) { + this.useLogoAsOpengraphImageFallback = Optional.ofNullable(useLogoAsOpengraphImageFallback); + return this; + } + + public UpdateAccountsRequest build() { + return new UpdateAccountsRequest( + affiliateApplicationRequired, + affiliateInstructions, + bannerImage, + businessAddress, + businessName, + businessType, + collectVatId, + country, + description, + featuredAffiliateProductId, + homePreferences, + industryGroup, + industryType, + invoicePrefix, + logo, + metadata, + onboardingType, + opengraphImage, + opengraphImageVariant, + otherBusinessDescription, + otherIndustryDescription, + productTaxCodeId, + require2Fa, + route, + sendCustomerEmails, + showJoinedWhops, + showReviewsDtc, + showUserDirectory, + socialLinks, + storePageConfig, + targetAudience, + taxCollectionEnabledStates, + taxIdentifiers, + taxRemittedBy, + taxType, + threeDsLevel, + title, + useLogoAsOpengraphImageFallback, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/reserves/AsyncRawReservesClient.java b/src/main/java/com/whop/api/resources/accounts/reserves/AsyncRawReservesClient.java new file mode 100644 index 00000000..349a2655 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/reserves/AsyncRawReservesClient.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.reserves; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.ServiceUnavailableError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.accounts.reserves.requests.ListReservesRequest; +import com.whop.api.resources.accounts.reserves.types.ListReservesResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawReservesClient { + protected final ClientOptions clientOptions; + + public AsyncRawReservesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public CompletableFuture> list(String accountId) { + return list(accountId, ListReservesRequest.builder().build()); + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public CompletableFuture> list( + String accountId, RequestOptions requestOptions) { + return list(accountId, ListReservesRequest.builder().build(), requestOptions); + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public CompletableFuture> list( + String accountId, ListReservesRequest request) { + return list(accountId, request, null); + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public CompletableFuture> list( + String accountId, ListReservesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts") + .addPathSegment(accountId) + .addPathSegments("reserves"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListReservesResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 503: + future.completeExceptionally(new ServiceUnavailableError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/reserves/AsyncReservesClient.java b/src/main/java/com/whop/api/resources/accounts/reserves/AsyncReservesClient.java new file mode 100644 index 00000000..0ff2ba0a --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/reserves/AsyncReservesClient.java @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.reserves; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.accounts.reserves.requests.ListReservesRequest; +import com.whop.api.resources.accounts.reserves.types.ListReservesResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncReservesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawReservesClient rawClient; + + public AsyncReservesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawReservesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawReservesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public CompletableFuture list(String accountId) { + return this.rawClient.list(accountId).thenApply(response -> response.body()); + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public CompletableFuture list(String accountId, RequestOptions requestOptions) { + return this.rawClient.list(accountId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public CompletableFuture list(String accountId, ListReservesRequest request) { + return this.rawClient.list(accountId, request).thenApply(response -> response.body()); + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public CompletableFuture list( + String accountId, ListReservesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(accountId, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/reserves/RawReservesClient.java b/src/main/java/com/whop/api/resources/accounts/reserves/RawReservesClient.java new file mode 100644 index 00000000..7b0cbb36 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/reserves/RawReservesClient.java @@ -0,0 +1,110 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.reserves; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.ServiceUnavailableError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.accounts.reserves.requests.ListReservesRequest; +import com.whop.api.resources.accounts.reserves.types.ListReservesResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawReservesClient { + protected final ClientOptions clientOptions; + + public RawReservesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public WhopApiHttpResponse list(String accountId) { + return list(accountId, ListReservesRequest.builder().build()); + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public WhopApiHttpResponse list(String accountId, RequestOptions requestOptions) { + return list(accountId, ListReservesRequest.builder().build(), requestOptions); + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public WhopApiHttpResponse list(String accountId, ListReservesRequest request) { + return list(accountId, request, null); + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public WhopApiHttpResponse list( + String accountId, ListReservesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("accounts") + .addPathSegment(accountId) + .addPathSegments("reserves"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListReservesResponse.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 503: + throw new ServiceUnavailableError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/reserves/ReservesClient.java b/src/main/java/com/whop/api/resources/accounts/reserves/ReservesClient.java new file mode 100644 index 00000000..413c9c54 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/reserves/ReservesClient.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.reserves; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.accounts.reserves.requests.ListReservesRequest; +import com.whop.api.resources.accounts.reserves.types.ListReservesResponse; + +public class ReservesClient { + protected final ClientOptions clientOptions; + + private final RawReservesClient rawClient; + + public ReservesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawReservesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawReservesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public ListReservesResponse list(String accountId) { + return this.rawClient.list(accountId).body(); + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public ListReservesResponse list(String accountId, RequestOptions requestOptions) { + return this.rawClient.list(accountId, requestOptions).body(); + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public ListReservesResponse list(String accountId, ListReservesRequest request) { + return this.rawClient.list(accountId, request).body(); + } + + /** + * Lists what the account's held balance is made of, one entry per currency: the total held, why each part is held, and the days it unlocks. + */ + public ListReservesResponse list(String accountId, ListReservesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(accountId, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/reserves/requests/ListReservesRequest.java b/src/main/java/com/whop/api/resources/accounts/reserves/requests/ListReservesRequest.java new file mode 100644 index 00000000..3d95b475 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/reserves/requests/ListReservesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.reserves.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListReservesRequest.Builder.class) +public final class ListReservesRequest { + private final Map additionalProperties; + + private ListReservesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListReservesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListReservesRequest other) { + return this; + } + + public ListReservesRequest build() { + return new ListReservesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/reserves/types/ListReservesResponse.java b/src/main/java/com/whop/api/resources/accounts/reserves/types/ListReservesResponse.java new file mode 100644 index 00000000..723e45b1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/reserves/types/ListReservesResponse.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.reserves.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AccountReserve; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListReservesResponse.Builder.class) +public final class ListReservesResponse { + private final List data; + + private final Map additionalProperties; + + private ListReservesResponse(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListReservesResponse && equalTo((ListReservesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListReservesResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListReservesResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(AccountReserve data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public ListReservesResponse build() { + return new ListReservesResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestBusinessAddress.java b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestBusinessAddress.java new file mode 100644 index 00000000..c9e0d77a --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestBusinessAddress.java @@ -0,0 +1,308 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FormCompanyAccountsRequestBusinessAddress.Builder.class) +public final class FormCompanyAccountsRequestBusinessAddress { + private final String city; + + private final String country; + + private final String line1; + + private final Optional line2; + + private final String postalCode; + + private final String state; + + private final Map additionalProperties; + + private FormCompanyAccountsRequestBusinessAddress( + String city, + String country, + String line1, + Optional line2, + String postalCode, + String state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("city") + public String getCity() { + return city; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US. + */ + @JsonProperty("country") + public String getCountry() { + return country; + } + + /** + * @return First line of the street address. + */ + @JsonProperty("line1") + public String getLine1() { + return line1; + } + + /** + * @return Second line of the street address. + */ + @JsonProperty("line2") + public Optional getLine2() { + return line2; + } + + /** + * @return Postal or ZIP code. + */ + @JsonProperty("postal_code") + public String getPostalCode() { + return postalCode; + } + + /** + * @return State or region code, for example CA. + */ + @JsonProperty("state") + public String getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FormCompanyAccountsRequestBusinessAddress + && equalTo((FormCompanyAccountsRequestBusinessAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FormCompanyAccountsRequestBusinessAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CityStage builder() { + return new Builder(); + } + + public interface CityStage { + CountryStage city(@NotNull String city); + + Builder from(FormCompanyAccountsRequestBusinessAddress other); + } + + public interface CountryStage { + /** + *

Two-letter ISO 3166-1 country code, for example US.

+ */ + Line1Stage country(@NotNull String country); + } + + public interface Line1Stage { + /** + *

First line of the street address.

+ */ + PostalCodeStage line1(@NotNull String line1); + } + + public interface PostalCodeStage { + /** + *

Postal or ZIP code.

+ */ + StateStage postalCode(@NotNull String postalCode); + } + + public interface StateStage { + /** + *

State or region code, for example CA.

+ */ + _FinalStage state(@NotNull String state); + } + + public interface _FinalStage { + FormCompanyAccountsRequestBusinessAddress build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Second line of the street address.

+ */ + _FinalStage line2(Optional line2); + + _FinalStage line2(String line2); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CityStage, CountryStage, Line1Stage, PostalCodeStage, StateStage, _FinalStage { + private String city; + + private String country; + + private String line1; + + private String postalCode; + + private String state; + + private Optional line2 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FormCompanyAccountsRequestBusinessAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + @java.lang.Override + @JsonSetter("city") + public CountryStage city(@NotNull String city) { + this.city = Objects.requireNonNull(city, "city must not be null"); + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US.

+ *

Two-letter ISO 3166-1 country code, for example US.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("country") + public Line1Stage country(@NotNull String country) { + this.country = Objects.requireNonNull(country, "country must not be null"); + return this; + } + + /** + *

First line of the street address.

+ *

First line of the street address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("line1") + public PostalCodeStage line1(@NotNull String line1) { + this.line1 = Objects.requireNonNull(line1, "line1 must not be null"); + return this; + } + + /** + *

Postal or ZIP code.

+ *

Postal or ZIP code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("postal_code") + public StateStage postalCode(@NotNull String postalCode) { + this.postalCode = Objects.requireNonNull(postalCode, "postalCode must not be null"); + return this; + } + + /** + *

State or region code, for example CA.

+ *

State or region code, for example CA.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("state") + public _FinalStage state(@NotNull String state) { + this.state = Objects.requireNonNull(state, "state must not be null"); + return this; + } + + /** + *

Second line of the street address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + /** + *

Second line of the street address.

+ */ + @java.lang.Override + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public _FinalStage line2(Optional line2) { + this.line2 = line2; + return this; + } + + @java.lang.Override + public FormCompanyAccountsRequestBusinessAddress build() { + return new FormCompanyAccountsRequestBusinessAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestEntitySuffix.java b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestEntitySuffix.java new file mode 100644 index 00000000..df4de245 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestEntitySuffix.java @@ -0,0 +1,207 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class FormCompanyAccountsRequestEntitySuffix { + public static final FormCompanyAccountsRequestEntitySuffix CORPORATION = + new FormCompanyAccountsRequestEntitySuffix(Value.CORPORATION, "Corporation"); + + public static final FormCompanyAccountsRequestEntitySuffix INC_TRAILING_PERIOD = + new FormCompanyAccountsRequestEntitySuffix(Value.INC_TRAILING_PERIOD, "Inc."); + + public static final FormCompanyAccountsRequestEntitySuffix INC = + new FormCompanyAccountsRequestEntitySuffix(Value.INC, "Inc"); + + public static final FormCompanyAccountsRequestEntitySuffix C_CORP_ONE_WORD = + new FormCompanyAccountsRequestEntitySuffix(Value.C_CORP_ONE_WORD, "CCorp"); + + public static final FormCompanyAccountsRequestEntitySuffix INCORPORATED = + new FormCompanyAccountsRequestEntitySuffix(Value.INCORPORATED, "Incorporated"); + + public static final FormCompanyAccountsRequestEntitySuffix CORP = + new FormCompanyAccountsRequestEntitySuffix(Value.CORP, "Corp."); + + public static final FormCompanyAccountsRequestEntitySuffix COMPANY = + new FormCompanyAccountsRequestEntitySuffix(Value.COMPANY, "Company"); + + public static final FormCompanyAccountsRequestEntitySuffix LLC_DOTTED = + new FormCompanyAccountsRequestEntitySuffix(Value.LLC_DOTTED, "L.L.C"); + + public static final FormCompanyAccountsRequestEntitySuffix C_CORP = + new FormCompanyAccountsRequestEntitySuffix(Value.C_CORP, "C Corp"); + + public static final FormCompanyAccountsRequestEntitySuffix C_CORPORATION = + new FormCompanyAccountsRequestEntitySuffix(Value.C_CORPORATION, "C Corporation"); + + public static final FormCompanyAccountsRequestEntitySuffix LLC = + new FormCompanyAccountsRequestEntitySuffix(Value.LLC, "LLC"); + + public static final FormCompanyAccountsRequestEntitySuffix LIMITED_LIABILITY_COMPANY = + new FormCompanyAccountsRequestEntitySuffix(Value.LIMITED_LIABILITY_COMPANY, "Limited Liability Company"); + + public static final FormCompanyAccountsRequestEntitySuffix LLC_DOTTED_TRAILING_PERIOD = + new FormCompanyAccountsRequestEntitySuffix(Value.LLC_DOTTED_TRAILING_PERIOD, "L.L.C."); + + private final Value value; + + private final String string; + + FormCompanyAccountsRequestEntitySuffix(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof FormCompanyAccountsRequestEntitySuffix + && this.string.equals(((FormCompanyAccountsRequestEntitySuffix) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CORPORATION: + return visitor.visitCorporation(); + case INC_TRAILING_PERIOD: + return visitor.visitIncTrailingPeriod(); + case INC: + return visitor.visitInc(); + case C_CORP_ONE_WORD: + return visitor.visitCCorpOneWord(); + case INCORPORATED: + return visitor.visitIncorporated(); + case CORP: + return visitor.visitCorp(); + case COMPANY: + return visitor.visitCompany(); + case LLC_DOTTED: + return visitor.visitLlcDotted(); + case C_CORP: + return visitor.visitCCorp(); + case C_CORPORATION: + return visitor.visitCCorporation(); + case LLC: + return visitor.visitLlc(); + case LIMITED_LIABILITY_COMPANY: + return visitor.visitLimitedLiabilityCompany(); + case LLC_DOTTED_TRAILING_PERIOD: + return visitor.visitLlcDottedTrailingPeriod(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static FormCompanyAccountsRequestEntitySuffix valueOf(String value) { + switch (value) { + case "Corporation": + return CORPORATION; + case "Inc.": + return INC_TRAILING_PERIOD; + case "Inc": + return INC; + case "CCorp": + return C_CORP_ONE_WORD; + case "Incorporated": + return INCORPORATED; + case "Corp.": + return CORP; + case "Company": + return COMPANY; + case "L.L.C": + return LLC_DOTTED; + case "C Corp": + return C_CORP; + case "C Corporation": + return C_CORPORATION; + case "LLC": + return LLC; + case "Limited Liability Company": + return LIMITED_LIABILITY_COMPANY; + case "L.L.C.": + return LLC_DOTTED_TRAILING_PERIOD; + default: + return new FormCompanyAccountsRequestEntitySuffix(Value.UNKNOWN, value); + } + } + + public enum Value { + LLC, + + LLC_DOTTED, + + LLC_DOTTED_TRAILING_PERIOD, + + LIMITED_LIABILITY_COMPANY, + + INC, + + INC_TRAILING_PERIOD, + + INCORPORATED, + + CORP, + + CORPORATION, + + C_CORP, + + C_CORPORATION, + + C_CORP_ONE_WORD, + + COMPANY, + + UNKNOWN + } + + public interface Visitor { + T visitLlc(); + + T visitLlcDotted(); + + T visitLlcDottedTrailingPeriod(); + + T visitLimitedLiabilityCompany(); + + T visitInc(); + + T visitIncTrailingPeriod(); + + T visitIncorporated(); + + T visitCorp(); + + T visitCorporation(); + + T visitCCorp(); + + T visitCCorporation(); + + T visitCCorpOneWord(); + + T visitCompany(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestEntityType.java b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestEntityType.java new file mode 100644 index 00000000..7c00659f --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestEntityType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class FormCompanyAccountsRequestEntityType { + public static final FormCompanyAccountsRequestEntityType LLC = + new FormCompanyAccountsRequestEntityType(Value.LLC, "llc"); + + public static final FormCompanyAccountsRequestEntityType C_CORP = + new FormCompanyAccountsRequestEntityType(Value.C_CORP, "c_corp"); + + private final Value value; + + private final String string; + + FormCompanyAccountsRequestEntityType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof FormCompanyAccountsRequestEntityType + && this.string.equals(((FormCompanyAccountsRequestEntityType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LLC: + return visitor.visitLlc(); + case C_CORP: + return visitor.visitCCorp(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static FormCompanyAccountsRequestEntityType valueOf(String value) { + switch (value) { + case "llc": + return LLC; + case "c_corp": + return C_CORP; + default: + return new FormCompanyAccountsRequestEntityType(Value.UNKNOWN, value); + } + } + + public enum Value { + LLC, + + C_CORP, + + UNKNOWN + } + + public interface Visitor { + T visitLlc(); + + T visitCCorp(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestFormationState.java b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestFormationState.java new file mode 100644 index 00000000..5cfdcdfb --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestFormationState.java @@ -0,0 +1,625 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class FormCompanyAccountsRequestFormationState { + public static final FormCompanyAccountsRequestFormationState NM = + new FormCompanyAccountsRequestFormationState(Value.NM, "NM"); + + public static final FormCompanyAccountsRequestFormationState WA = + new FormCompanyAccountsRequestFormationState(Value.WA, "WA"); + + public static final FormCompanyAccountsRequestFormationState MA = + new FormCompanyAccountsRequestFormationState(Value.MA, "MA"); + + public static final FormCompanyAccountsRequestFormationState UT = + new FormCompanyAccountsRequestFormationState(Value.UT, "UT"); + + public static final FormCompanyAccountsRequestFormationState KS = + new FormCompanyAccountsRequestFormationState(Value.KS, "KS"); + + public static final FormCompanyAccountsRequestFormationState CA = + new FormCompanyAccountsRequestFormationState(Value.CA, "CA"); + + public static final FormCompanyAccountsRequestFormationState AR = + new FormCompanyAccountsRequestFormationState(Value.AR, "AR"); + + public static final FormCompanyAccountsRequestFormationState MD = + new FormCompanyAccountsRequestFormationState(Value.MD, "MD"); + + public static final FormCompanyAccountsRequestFormationState ME = + new FormCompanyAccountsRequestFormationState(Value.ME, "ME"); + + public static final FormCompanyAccountsRequestFormationState PA = + new FormCompanyAccountsRequestFormationState(Value.PA, "PA"); + + public static final FormCompanyAccountsRequestFormationState NV = + new FormCompanyAccountsRequestFormationState(Value.NV, "NV"); + + public static final FormCompanyAccountsRequestFormationState TN = + new FormCompanyAccountsRequestFormationState(Value.TN, "TN"); + + public static final FormCompanyAccountsRequestFormationState KY = + new FormCompanyAccountsRequestFormationState(Value.KY, "KY"); + + public static final FormCompanyAccountsRequestFormationState WI = + new FormCompanyAccountsRequestFormationState(Value.WI, "WI"); + + public static final FormCompanyAccountsRequestFormationState MI = + new FormCompanyAccountsRequestFormationState(Value.MI, "MI"); + + public static final FormCompanyAccountsRequestFormationState SC = + new FormCompanyAccountsRequestFormationState(Value.SC, "SC"); + + public static final FormCompanyAccountsRequestFormationState IA = + new FormCompanyAccountsRequestFormationState(Value.IA, "IA"); + + public static final FormCompanyAccountsRequestFormationState NC = + new FormCompanyAccountsRequestFormationState(Value.NC, "NC"); + + public static final FormCompanyAccountsRequestFormationState NE = + new FormCompanyAccountsRequestFormationState(Value.NE, "NE"); + + public static final FormCompanyAccountsRequestFormationState DC = + new FormCompanyAccountsRequestFormationState(Value.DC, "DC"); + + public static final FormCompanyAccountsRequestFormationState OR = + new FormCompanyAccountsRequestFormationState(Value.OR, "OR"); + + public static final FormCompanyAccountsRequestFormationState MO = + new FormCompanyAccountsRequestFormationState(Value.MO, "MO"); + + public static final FormCompanyAccountsRequestFormationState DE = + new FormCompanyAccountsRequestFormationState(Value.DE, "DE"); + + public static final FormCompanyAccountsRequestFormationState CO = + new FormCompanyAccountsRequestFormationState(Value.CO, "CO"); + + public static final FormCompanyAccountsRequestFormationState AL = + new FormCompanyAccountsRequestFormationState(Value.AL, "AL"); + + public static final FormCompanyAccountsRequestFormationState FL = + new FormCompanyAccountsRequestFormationState(Value.FL, "FL"); + + public static final FormCompanyAccountsRequestFormationState MS = + new FormCompanyAccountsRequestFormationState(Value.MS, "MS"); + + public static final FormCompanyAccountsRequestFormationState TX = + new FormCompanyAccountsRequestFormationState(Value.TX, "TX"); + + public static final FormCompanyAccountsRequestFormationState CT = + new FormCompanyAccountsRequestFormationState(Value.CT, "CT"); + + public static final FormCompanyAccountsRequestFormationState IL = + new FormCompanyAccountsRequestFormationState(Value.IL, "IL"); + + public static final FormCompanyAccountsRequestFormationState IN = + new FormCompanyAccountsRequestFormationState(Value.IN, "IN"); + + public static final FormCompanyAccountsRequestFormationState WY = + new FormCompanyAccountsRequestFormationState(Value.WY, "WY"); + + public static final FormCompanyAccountsRequestFormationState OH = + new FormCompanyAccountsRequestFormationState(Value.OH, "OH"); + + public static final FormCompanyAccountsRequestFormationState OK = + new FormCompanyAccountsRequestFormationState(Value.OK, "OK"); + + public static final FormCompanyAccountsRequestFormationState RI = + new FormCompanyAccountsRequestFormationState(Value.RI, "RI"); + + public static final FormCompanyAccountsRequestFormationState HI = + new FormCompanyAccountsRequestFormationState(Value.HI, "HI"); + + public static final FormCompanyAccountsRequestFormationState VT = + new FormCompanyAccountsRequestFormationState(Value.VT, "VT"); + + public static final FormCompanyAccountsRequestFormationState AZ = + new FormCompanyAccountsRequestFormationState(Value.AZ, "AZ"); + + public static final FormCompanyAccountsRequestFormationState SD = + new FormCompanyAccountsRequestFormationState(Value.SD, "SD"); + + public static final FormCompanyAccountsRequestFormationState NY = + new FormCompanyAccountsRequestFormationState(Value.NY, "NY"); + + public static final FormCompanyAccountsRequestFormationState ID = + new FormCompanyAccountsRequestFormationState(Value.ID, "ID"); + + public static final FormCompanyAccountsRequestFormationState MN = + new FormCompanyAccountsRequestFormationState(Value.MN, "MN"); + + public static final FormCompanyAccountsRequestFormationState ND = + new FormCompanyAccountsRequestFormationState(Value.ND, "ND"); + + public static final FormCompanyAccountsRequestFormationState VA = + new FormCompanyAccountsRequestFormationState(Value.VA, "VA"); + + public static final FormCompanyAccountsRequestFormationState GA = + new FormCompanyAccountsRequestFormationState(Value.GA, "GA"); + + public static final FormCompanyAccountsRequestFormationState LA = + new FormCompanyAccountsRequestFormationState(Value.LA, "LA"); + + public static final FormCompanyAccountsRequestFormationState NH = + new FormCompanyAccountsRequestFormationState(Value.NH, "NH"); + + public static final FormCompanyAccountsRequestFormationState AK = + new FormCompanyAccountsRequestFormationState(Value.AK, "AK"); + + public static final FormCompanyAccountsRequestFormationState NJ = + new FormCompanyAccountsRequestFormationState(Value.NJ, "NJ"); + + public static final FormCompanyAccountsRequestFormationState WV = + new FormCompanyAccountsRequestFormationState(Value.WV, "WV"); + + public static final FormCompanyAccountsRequestFormationState MT = + new FormCompanyAccountsRequestFormationState(Value.MT, "MT"); + + private final Value value; + + private final String string; + + FormCompanyAccountsRequestFormationState(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof FormCompanyAccountsRequestFormationState + && this.string.equals(((FormCompanyAccountsRequestFormationState) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NM: + return visitor.visitNm(); + case WA: + return visitor.visitWa(); + case MA: + return visitor.visitMa(); + case UT: + return visitor.visitUt(); + case KS: + return visitor.visitKs(); + case CA: + return visitor.visitCa(); + case AR: + return visitor.visitAr(); + case MD: + return visitor.visitMd(); + case ME: + return visitor.visitMe(); + case PA: + return visitor.visitPa(); + case NV: + return visitor.visitNv(); + case TN: + return visitor.visitTn(); + case KY: + return visitor.visitKy(); + case WI: + return visitor.visitWi(); + case MI: + return visitor.visitMi(); + case SC: + return visitor.visitSc(); + case IA: + return visitor.visitIa(); + case NC: + return visitor.visitNc(); + case NE: + return visitor.visitNe(); + case DC: + return visitor.visitDc(); + case OR: + return visitor.visitOr(); + case MO: + return visitor.visitMo(); + case DE: + return visitor.visitDe(); + case CO: + return visitor.visitCo(); + case AL: + return visitor.visitAl(); + case FL: + return visitor.visitFl(); + case MS: + return visitor.visitMs(); + case TX: + return visitor.visitTx(); + case CT: + return visitor.visitCt(); + case IL: + return visitor.visitIl(); + case IN: + return visitor.visitIn(); + case WY: + return visitor.visitWy(); + case OH: + return visitor.visitOh(); + case OK: + return visitor.visitOk(); + case RI: + return visitor.visitRi(); + case HI: + return visitor.visitHi(); + case VT: + return visitor.visitVt(); + case AZ: + return visitor.visitAz(); + case SD: + return visitor.visitSd(); + case NY: + return visitor.visitNy(); + case ID: + return visitor.visitId(); + case MN: + return visitor.visitMn(); + case ND: + return visitor.visitNd(); + case VA: + return visitor.visitVa(); + case GA: + return visitor.visitGa(); + case LA: + return visitor.visitLa(); + case NH: + return visitor.visitNh(); + case AK: + return visitor.visitAk(); + case NJ: + return visitor.visitNj(); + case WV: + return visitor.visitWv(); + case MT: + return visitor.visitMt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static FormCompanyAccountsRequestFormationState valueOf(String value) { + switch (value) { + case "NM": + return NM; + case "WA": + return WA; + case "MA": + return MA; + case "UT": + return UT; + case "KS": + return KS; + case "CA": + return CA; + case "AR": + return AR; + case "MD": + return MD; + case "ME": + return ME; + case "PA": + return PA; + case "NV": + return NV; + case "TN": + return TN; + case "KY": + return KY; + case "WI": + return WI; + case "MI": + return MI; + case "SC": + return SC; + case "IA": + return IA; + case "NC": + return NC; + case "NE": + return NE; + case "DC": + return DC; + case "OR": + return OR; + case "MO": + return MO; + case "DE": + return DE; + case "CO": + return CO; + case "AL": + return AL; + case "FL": + return FL; + case "MS": + return MS; + case "TX": + return TX; + case "CT": + return CT; + case "IL": + return IL; + case "IN": + return IN; + case "WY": + return WY; + case "OH": + return OH; + case "OK": + return OK; + case "RI": + return RI; + case "HI": + return HI; + case "VT": + return VT; + case "AZ": + return AZ; + case "SD": + return SD; + case "NY": + return NY; + case "ID": + return ID; + case "MN": + return MN; + case "ND": + return ND; + case "VA": + return VA; + case "GA": + return GA; + case "LA": + return LA; + case "NH": + return NH; + case "AK": + return AK; + case "NJ": + return NJ; + case "WV": + return WV; + case "MT": + return MT; + default: + return new FormCompanyAccountsRequestFormationState(Value.UNKNOWN, value); + } + } + + public enum Value { + AL, + + AK, + + AZ, + + AR, + + CA, + + CO, + + CT, + + DE, + + DC, + + FL, + + GA, + + HI, + + ID, + + IL, + + IN, + + IA, + + KS, + + KY, + + LA, + + ME, + + MD, + + MA, + + MI, + + MN, + + MS, + + MO, + + MT, + + NE, + + NV, + + NH, + + NJ, + + NM, + + NY, + + NC, + + ND, + + OH, + + OK, + + OR, + + PA, + + RI, + + SC, + + SD, + + TN, + + TX, + + UT, + + VT, + + VA, + + WA, + + WV, + + WI, + + WY, + + UNKNOWN + } + + public interface Visitor { + T visitAl(); + + T visitAk(); + + T visitAz(); + + T visitAr(); + + T visitCa(); + + T visitCo(); + + T visitCt(); + + T visitDe(); + + T visitDc(); + + T visitFl(); + + T visitGa(); + + T visitHi(); + + T visitId(); + + T visitIl(); + + T visitIn(); + + T visitIa(); + + T visitKs(); + + T visitKy(); + + T visitLa(); + + T visitMe(); + + T visitMd(); + + T visitMa(); + + T visitMi(); + + T visitMn(); + + T visitMs(); + + T visitMo(); + + T visitMt(); + + T visitNe(); + + T visitNv(); + + T visitNh(); + + T visitNj(); + + T visitNm(); + + T visitNy(); + + T visitNc(); + + T visitNd(); + + T visitOh(); + + T visitOk(); + + T visitOr(); + + T visitPa(); + + T visitRi(); + + T visitSc(); + + T visitSd(); + + T visitTn(); + + T visitTx(); + + T visitUt(); + + T visitVt(); + + T visitVa(); + + T visitWa(); + + T visitWv(); + + T visitWi(); + + T visitWy(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestFoundersItem.java b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestFoundersItem.java new file mode 100644 index 00000000..c0d85903 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestFoundersItem.java @@ -0,0 +1,477 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FormCompanyAccountsRequestFoundersItem.Builder.class) +public final class FormCompanyAccountsRequestFoundersItem { + private final FormCompanyAccountsRequestFoundersItemAddress address; + + private final Optional dateOfBirth; + + private final String email; + + private final String firstName; + + private final boolean isPrimary; + + private final String lastName; + + private final Optional ownershipPercentage; + + private final String phone; + + private final Optional> roles; + + private final Optional ssn; + + private final Map additionalProperties; + + private FormCompanyAccountsRequestFoundersItem( + FormCompanyAccountsRequestFoundersItemAddress address, + Optional dateOfBirth, + String email, + String firstName, + boolean isPrimary, + String lastName, + Optional ownershipPercentage, + String phone, + Optional> roles, + Optional ssn, + Map additionalProperties) { + this.address = address; + this.dateOfBirth = dateOfBirth; + this.email = email; + this.firstName = firstName; + this.isPrimary = isPrimary; + this.lastName = lastName; + this.ownershipPercentage = ownershipPercentage; + this.phone = phone; + this.roles = roles; + this.ssn = ssn; + this.additionalProperties = additionalProperties; + } + + /** + * @return Founder's personal address. + */ + @JsonProperty("address") + public FormCompanyAccountsRequestFoundersItemAddress getAddress() { + return address; + } + + /** + * @return Formatted as YYYY-MM-DD. + */ + @JsonProperty("date_of_birth") + public Optional getDateOfBirth() { + return dateOfBirth; + } + + @JsonProperty("email") + public String getEmail() { + return email; + } + + @JsonProperty("first_name") + public String getFirstName() { + return firstName; + } + + /** + * @return Marks the responsible party for the filing. Exactly one founder must be primary. + */ + @JsonProperty("is_primary") + public boolean getIsPrimary() { + return isPrimary; + } + + @JsonProperty("last_name") + public String getLastName() { + return lastName; + } + + /** + * @return The founder's ownership share: greater than 0, at most 100. Shares across founders must total 100. Required when entity_type is llc; ignored for C-Corps. + */ + @JsonProperty("ownership_percentage") + public Optional getOwnershipPercentage() { + return ownershipPercentage; + } + + /** + * @return Phone number in E.164 format, for example +12125550100. + */ + @JsonProperty("phone") + public String getPhone() { + return phone; + } + + /** + * @return Officer roles held by the member — one member can hold several. Required (at least one role) for every member when entity_type is c_corp; ignored for LLCs. Across all members every role must be covered; president, secretary and treasurer may each be held by only one member, while director may repeat. + */ + @JsonProperty("roles") + public Optional> getRoles() { + return roles; + } + + /** + * @return The founder's US Social Security Number. Leave empty if the founder is not a US resident. Non-US founders can request expedited EIN processing via the expedite_ein option. + */ + @JsonProperty("ssn") + public Optional getSsn() { + return ssn; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FormCompanyAccountsRequestFoundersItem + && equalTo((FormCompanyAccountsRequestFoundersItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FormCompanyAccountsRequestFoundersItem other) { + return address.equals(other.address) + && dateOfBirth.equals(other.dateOfBirth) + && email.equals(other.email) + && firstName.equals(other.firstName) + && isPrimary == other.isPrimary + && lastName.equals(other.lastName) + && ownershipPercentage.equals(other.ownershipPercentage) + && phone.equals(other.phone) + && roles.equals(other.roles) + && ssn.equals(other.ssn); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.address, + this.dateOfBirth, + this.email, + this.firstName, + this.isPrimary, + this.lastName, + this.ownershipPercentage, + this.phone, + this.roles, + this.ssn); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AddressStage builder() { + return new Builder(); + } + + public interface AddressStage { + /** + *

Founder's personal address.

+ */ + EmailStage address(@NotNull FormCompanyAccountsRequestFoundersItemAddress address); + + Builder from(FormCompanyAccountsRequestFoundersItem other); + } + + public interface EmailStage { + FirstNameStage email(@NotNull String email); + } + + public interface FirstNameStage { + IsPrimaryStage firstName(@NotNull String firstName); + } + + public interface IsPrimaryStage { + /** + *

Marks the responsible party for the filing. Exactly one founder must be primary.

+ */ + LastNameStage isPrimary(boolean isPrimary); + } + + public interface LastNameStage { + PhoneStage lastName(@NotNull String lastName); + } + + public interface PhoneStage { + /** + *

Phone number in E.164 format, for example +12125550100.

+ */ + _FinalStage phone(@NotNull String phone); + } + + public interface _FinalStage { + FormCompanyAccountsRequestFoundersItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Formatted as YYYY-MM-DD.

+ */ + _FinalStage dateOfBirth(Optional dateOfBirth); + + _FinalStage dateOfBirth(String dateOfBirth); + + /** + *

The founder's ownership share: greater than 0, at most 100. Shares across founders must total 100. Required when entity_type is llc; ignored for C-Corps.

+ */ + _FinalStage ownershipPercentage(Optional ownershipPercentage); + + _FinalStage ownershipPercentage(Double ownershipPercentage); + + /** + *

Officer roles held by the member — one member can hold several. Required (at least one role) for every member when entity_type is c_corp; ignored for LLCs. Across all members every role must be covered; president, secretary and treasurer may each be held by only one member, while director may repeat.

+ */ + _FinalStage roles(Optional> roles); + + _FinalStage roles(List roles); + + /** + *

The founder's US Social Security Number. Leave empty if the founder is not a US resident. Non-US founders can request expedited EIN processing via the expedite_ein option.

+ */ + _FinalStage ssn(Optional ssn); + + _FinalStage ssn(String ssn); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AddressStage, + EmailStage, + FirstNameStage, + IsPrimaryStage, + LastNameStage, + PhoneStage, + _FinalStage { + private FormCompanyAccountsRequestFoundersItemAddress address; + + private String email; + + private String firstName; + + private boolean isPrimary; + + private String lastName; + + private String phone; + + private Optional ssn = Optional.empty(); + + private Optional> roles = Optional.empty(); + + private Optional ownershipPercentage = Optional.empty(); + + private Optional dateOfBirth = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FormCompanyAccountsRequestFoundersItem other) { + address(other.getAddress()); + dateOfBirth(other.getDateOfBirth()); + email(other.getEmail()); + firstName(other.getFirstName()); + isPrimary(other.getIsPrimary()); + lastName(other.getLastName()); + ownershipPercentage(other.getOwnershipPercentage()); + phone(other.getPhone()); + roles(other.getRoles()); + ssn(other.getSsn()); + return this; + } + + /** + *

Founder's personal address.

+ *

Founder's personal address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("address") + public EmailStage address(@NotNull FormCompanyAccountsRequestFoundersItemAddress address) { + this.address = Objects.requireNonNull(address, "address must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("email") + public FirstNameStage email(@NotNull String email) { + this.email = Objects.requireNonNull(email, "email must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("first_name") + public IsPrimaryStage firstName(@NotNull String firstName) { + this.firstName = Objects.requireNonNull(firstName, "firstName must not be null"); + return this; + } + + /** + *

Marks the responsible party for the filing. Exactly one founder must be primary.

+ *

Marks the responsible party for the filing. Exactly one founder must be primary.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_primary") + public LastNameStage isPrimary(boolean isPrimary) { + this.isPrimary = isPrimary; + return this; + } + + @java.lang.Override + @JsonSetter("last_name") + public PhoneStage lastName(@NotNull String lastName) { + this.lastName = Objects.requireNonNull(lastName, "lastName must not be null"); + return this; + } + + /** + *

Phone number in E.164 format, for example +12125550100.

+ *

Phone number in E.164 format, for example +12125550100.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("phone") + public _FinalStage phone(@NotNull String phone) { + this.phone = Objects.requireNonNull(phone, "phone must not be null"); + return this; + } + + /** + *

The founder's US Social Security Number. Leave empty if the founder is not a US resident. Non-US founders can request expedited EIN processing via the expedite_ein option.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage ssn(String ssn) { + this.ssn = Optional.ofNullable(ssn); + return this; + } + + /** + *

The founder's US Social Security Number. Leave empty if the founder is not a US resident. Non-US founders can request expedited EIN processing via the expedite_ein option.

+ */ + @java.lang.Override + @JsonSetter(value = "ssn", nulls = Nulls.SKIP) + public _FinalStage ssn(Optional ssn) { + this.ssn = ssn; + return this; + } + + /** + *

Officer roles held by the member — one member can hold several. Required (at least one role) for every member when entity_type is c_corp; ignored for LLCs. Across all members every role must be covered; president, secretary and treasurer may each be held by only one member, while director may repeat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage roles(List roles) { + this.roles = Optional.ofNullable(roles); + return this; + } + + /** + *

Officer roles held by the member — one member can hold several. Required (at least one role) for every member when entity_type is c_corp; ignored for LLCs. Across all members every role must be covered; president, secretary and treasurer may each be held by only one member, while director may repeat.

+ */ + @java.lang.Override + @JsonSetter(value = "roles", nulls = Nulls.SKIP) + public _FinalStage roles(Optional> roles) { + this.roles = roles; + return this; + } + + /** + *

The founder's ownership share: greater than 0, at most 100. Shares across founders must total 100. Required when entity_type is llc; ignored for C-Corps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage ownershipPercentage(Double ownershipPercentage) { + this.ownershipPercentage = Optional.ofNullable(ownershipPercentage); + return this; + } + + /** + *

The founder's ownership share: greater than 0, at most 100. Shares across founders must total 100. Required when entity_type is llc; ignored for C-Corps.

+ */ + @java.lang.Override + @JsonSetter(value = "ownership_percentage", nulls = Nulls.SKIP) + public _FinalStage ownershipPercentage(Optional ownershipPercentage) { + this.ownershipPercentage = ownershipPercentage; + return this; + } + + /** + *

Formatted as YYYY-MM-DD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dateOfBirth(String dateOfBirth) { + this.dateOfBirth = Optional.ofNullable(dateOfBirth); + return this; + } + + /** + *

Formatted as YYYY-MM-DD.

+ */ + @java.lang.Override + @JsonSetter(value = "date_of_birth", nulls = Nulls.SKIP) + public _FinalStage dateOfBirth(Optional dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + @java.lang.Override + public FormCompanyAccountsRequestFoundersItem build() { + return new FormCompanyAccountsRequestFoundersItem( + address, + dateOfBirth, + email, + firstName, + isPrimary, + lastName, + ownershipPercentage, + phone, + roles, + ssn, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestFoundersItemAddress.java b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestFoundersItemAddress.java new file mode 100644 index 00000000..803b6008 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestFoundersItemAddress.java @@ -0,0 +1,308 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FormCompanyAccountsRequestFoundersItemAddress.Builder.class) +public final class FormCompanyAccountsRequestFoundersItemAddress { + private final String city; + + private final String country; + + private final String line1; + + private final Optional line2; + + private final String postalCode; + + private final String state; + + private final Map additionalProperties; + + private FormCompanyAccountsRequestFoundersItemAddress( + String city, + String country, + String line1, + Optional line2, + String postalCode, + String state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("city") + public String getCity() { + return city; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US. + */ + @JsonProperty("country") + public String getCountry() { + return country; + } + + /** + * @return First line of the street address. + */ + @JsonProperty("line1") + public String getLine1() { + return line1; + } + + /** + * @return Second line of the street address. + */ + @JsonProperty("line2") + public Optional getLine2() { + return line2; + } + + /** + * @return Postal or ZIP code. + */ + @JsonProperty("postal_code") + public String getPostalCode() { + return postalCode; + } + + /** + * @return State or region code, for example CA. + */ + @JsonProperty("state") + public String getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FormCompanyAccountsRequestFoundersItemAddress + && equalTo((FormCompanyAccountsRequestFoundersItemAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FormCompanyAccountsRequestFoundersItemAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CityStage builder() { + return new Builder(); + } + + public interface CityStage { + CountryStage city(@NotNull String city); + + Builder from(FormCompanyAccountsRequestFoundersItemAddress other); + } + + public interface CountryStage { + /** + *

Two-letter ISO 3166-1 country code, for example US.

+ */ + Line1Stage country(@NotNull String country); + } + + public interface Line1Stage { + /** + *

First line of the street address.

+ */ + PostalCodeStage line1(@NotNull String line1); + } + + public interface PostalCodeStage { + /** + *

Postal or ZIP code.

+ */ + StateStage postalCode(@NotNull String postalCode); + } + + public interface StateStage { + /** + *

State or region code, for example CA.

+ */ + _FinalStage state(@NotNull String state); + } + + public interface _FinalStage { + FormCompanyAccountsRequestFoundersItemAddress build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Second line of the street address.

+ */ + _FinalStage line2(Optional line2); + + _FinalStage line2(String line2); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CityStage, CountryStage, Line1Stage, PostalCodeStage, StateStage, _FinalStage { + private String city; + + private String country; + + private String line1; + + private String postalCode; + + private String state; + + private Optional line2 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FormCompanyAccountsRequestFoundersItemAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + @java.lang.Override + @JsonSetter("city") + public CountryStage city(@NotNull String city) { + this.city = Objects.requireNonNull(city, "city must not be null"); + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US.

+ *

Two-letter ISO 3166-1 country code, for example US.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("country") + public Line1Stage country(@NotNull String country) { + this.country = Objects.requireNonNull(country, "country must not be null"); + return this; + } + + /** + *

First line of the street address.

+ *

First line of the street address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("line1") + public PostalCodeStage line1(@NotNull String line1) { + this.line1 = Objects.requireNonNull(line1, "line1 must not be null"); + return this; + } + + /** + *

Postal or ZIP code.

+ *

Postal or ZIP code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("postal_code") + public StateStage postalCode(@NotNull String postalCode) { + this.postalCode = Objects.requireNonNull(postalCode, "postalCode must not be null"); + return this; + } + + /** + *

State or region code, for example CA.

+ *

State or region code, for example CA.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("state") + public _FinalStage state(@NotNull String state) { + this.state = Objects.requireNonNull(state, "state must not be null"); + return this; + } + + /** + *

Second line of the street address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + /** + *

Second line of the street address.

+ */ + @java.lang.Override + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public _FinalStage line2(Optional line2) { + this.line2 = line2; + return this; + } + + @java.lang.Override + public FormCompanyAccountsRequestFoundersItemAddress build() { + return new FormCompanyAccountsRequestFoundersItemAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestFoundersItemRolesItem.java b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestFoundersItemRolesItem.java new file mode 100644 index 00000000..bf25a13c --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestFoundersItemRolesItem.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class FormCompanyAccountsRequestFoundersItemRolesItem { + public static final FormCompanyAccountsRequestFoundersItemRolesItem SECRETARY = + new FormCompanyAccountsRequestFoundersItemRolesItem(Value.SECRETARY, "secretary"); + + public static final FormCompanyAccountsRequestFoundersItemRolesItem PRESIDENT = + new FormCompanyAccountsRequestFoundersItemRolesItem(Value.PRESIDENT, "president"); + + public static final FormCompanyAccountsRequestFoundersItemRolesItem TREASURER = + new FormCompanyAccountsRequestFoundersItemRolesItem(Value.TREASURER, "treasurer"); + + public static final FormCompanyAccountsRequestFoundersItemRolesItem DIRECTOR = + new FormCompanyAccountsRequestFoundersItemRolesItem(Value.DIRECTOR, "director"); + + private final Value value; + + private final String string; + + FormCompanyAccountsRequestFoundersItemRolesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof FormCompanyAccountsRequestFoundersItemRolesItem + && this.string.equals(((FormCompanyAccountsRequestFoundersItemRolesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SECRETARY: + return visitor.visitSecretary(); + case PRESIDENT: + return visitor.visitPresident(); + case TREASURER: + return visitor.visitTreasurer(); + case DIRECTOR: + return visitor.visitDirector(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static FormCompanyAccountsRequestFoundersItemRolesItem valueOf(String value) { + switch (value) { + case "secretary": + return SECRETARY; + case "president": + return PRESIDENT; + case "treasurer": + return TREASURER; + case "director": + return DIRECTOR; + default: + return new FormCompanyAccountsRequestFoundersItemRolesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + PRESIDENT, + + SECRETARY, + + TREASURER, + + DIRECTOR, + + UNKNOWN + } + + public interface Visitor { + T visitPresident(); + + T visitSecretary(); + + T visitTreasurer(); + + T visitDirector(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestShareStructure.java b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestShareStructure.java new file mode 100644 index 00000000..949de12e --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsRequestShareStructure.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FormCompanyAccountsRequestShareStructure.Builder.class) +public final class FormCompanyAccountsRequestShareStructure { + private final int numberOfShares; + + private final double value; + + private final Map additionalProperties; + + private FormCompanyAccountsRequestShareStructure( + int numberOfShares, double value, Map additionalProperties) { + this.numberOfShares = numberOfShares; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return Number of shares the company authorizes. Must be greater than 0. + */ + @JsonProperty("number_of_shares") + public int getNumberOfShares() { + return numberOfShares; + } + + /** + * @return Par value per share, in USD. Must be greater than 0; fractional values like 0.01 are allowed. + */ + @JsonProperty("value") + public double getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FormCompanyAccountsRequestShareStructure + && equalTo((FormCompanyAccountsRequestShareStructure) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FormCompanyAccountsRequestShareStructure other) { + return numberOfShares == other.numberOfShares && value == other.value; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.numberOfShares, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NumberOfSharesStage builder() { + return new Builder(); + } + + public interface NumberOfSharesStage { + /** + *

Number of shares the company authorizes. Must be greater than 0.

+ */ + ValueStage numberOfShares(int numberOfShares); + + Builder from(FormCompanyAccountsRequestShareStructure other); + } + + public interface ValueStage { + /** + *

Par value per share, in USD. Must be greater than 0; fractional values like 0.01 are allowed.

+ */ + _FinalStage value(double value); + } + + public interface _FinalStage { + FormCompanyAccountsRequestShareStructure build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NumberOfSharesStage, ValueStage, _FinalStage { + private int numberOfShares; + + private double value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FormCompanyAccountsRequestShareStructure other) { + numberOfShares(other.getNumberOfShares()); + value(other.getValue()); + return this; + } + + /** + *

Number of shares the company authorizes. Must be greater than 0.

+ *

Number of shares the company authorizes. Must be greater than 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("number_of_shares") + public ValueStage numberOfShares(int numberOfShares) { + this.numberOfShares = numberOfShares; + return this; + } + + /** + *

Par value per share, in USD. Must be greater than 0; fractional values like 0.01 are allowed.

+ *

Par value per share, in USD. Must be greater than 0; fractional values like 0.01 are allowed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(double value) { + this.value = value; + return this; + } + + @java.lang.Override + public FormCompanyAccountsRequestShareStructure build() { + return new FormCompanyAccountsRequestShareStructure(numberOfShares, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsResponse.java b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsResponse.java new file mode 100644 index 00000000..a824b851 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/FormCompanyAccountsResponse.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FormCompanyAccountsResponse.Builder.class) +public final class FormCompanyAccountsResponse { + private final String checkoutSessionId; + + private final String checkoutUrl; + + private final String currency; + + private final int total; + + private final Map additionalProperties; + + private FormCompanyAccountsResponse( + String checkoutSessionId, + String checkoutUrl, + String currency, + int total, + Map additionalProperties) { + this.checkoutSessionId = checkoutSessionId; + this.checkoutUrl = checkoutUrl; + this.currency = currency; + this.total = total; + this.additionalProperties = additionalProperties; + } + + /** + * @return Checkout session ID, prefixed ch_. + */ + @JsonProperty("checkout_session_id") + public String getCheckoutSessionId() { + return checkoutSessionId; + } + + /** + * @return Hosted checkout URL. Send the buyer here to pay for the formation; the filing is submitted once payment completes. + */ + @JsonProperty("checkout_url") + public String getCheckoutUrl() { + return checkoutUrl; + } + + /** + * @return Always usd. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Total due at checkout in USD cents. + */ + @JsonProperty("total") + public int getTotal() { + return total; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FormCompanyAccountsResponse && equalTo((FormCompanyAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FormCompanyAccountsResponse other) { + return checkoutSessionId.equals(other.checkoutSessionId) + && checkoutUrl.equals(other.checkoutUrl) + && currency.equals(other.currency) + && total == other.total; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.checkoutSessionId, this.checkoutUrl, this.currency, this.total); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CheckoutSessionIdStage builder() { + return new Builder(); + } + + public interface CheckoutSessionIdStage { + /** + *

Checkout session ID, prefixed ch_.

+ */ + CheckoutUrlStage checkoutSessionId(@NotNull String checkoutSessionId); + + Builder from(FormCompanyAccountsResponse other); + } + + public interface CheckoutUrlStage { + /** + *

Hosted checkout URL. Send the buyer here to pay for the formation; the filing is submitted once payment completes.

+ */ + CurrencyStage checkoutUrl(@NotNull String checkoutUrl); + } + + public interface CurrencyStage { + /** + *

Always usd.

+ */ + TotalStage currency(@NotNull String currency); + } + + public interface TotalStage { + /** + *

Total due at checkout in USD cents.

+ */ + _FinalStage total(int total); + } + + public interface _FinalStage { + FormCompanyAccountsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CheckoutSessionIdStage, CheckoutUrlStage, CurrencyStage, TotalStage, _FinalStage { + private String checkoutSessionId; + + private String checkoutUrl; + + private String currency; + + private int total; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FormCompanyAccountsResponse other) { + checkoutSessionId(other.getCheckoutSessionId()); + checkoutUrl(other.getCheckoutUrl()); + currency(other.getCurrency()); + total(other.getTotal()); + return this; + } + + /** + *

Checkout session ID, prefixed ch_.

+ *

Checkout session ID, prefixed ch_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("checkout_session_id") + public CheckoutUrlStage checkoutSessionId(@NotNull String checkoutSessionId) { + this.checkoutSessionId = Objects.requireNonNull(checkoutSessionId, "checkoutSessionId must not be null"); + return this; + } + + /** + *

Hosted checkout URL. Send the buyer here to pay for the formation; the filing is submitted once payment completes.

+ *

Hosted checkout URL. Send the buyer here to pay for the formation; the filing is submitted once payment completes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("checkout_url") + public CurrencyStage checkoutUrl(@NotNull String checkoutUrl) { + this.checkoutUrl = Objects.requireNonNull(checkoutUrl, "checkoutUrl must not be null"); + return this; + } + + /** + *

Always usd.

+ *

Always usd.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public TotalStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Total due at checkout in USD cents.

+ *

Total due at checkout in USD cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total") + public _FinalStage total(int total) { + this.total = total; + return this; + } + + @java.lang.Override + public FormCompanyAccountsResponse build() { + return new FormCompanyAccountsResponse( + checkoutSessionId, checkoutUrl, currency, total, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/ListAccountsRequestDirection.java b/src/main/java/com/whop/api/resources/accounts/types/ListAccountsRequestDirection.java new file mode 100644 index 00000000..19327ea3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/ListAccountsRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAccountsRequestDirection { + public static final ListAccountsRequestDirection ASC = new ListAccountsRequestDirection(Value.ASC, "asc"); + + public static final ListAccountsRequestDirection DESC = new ListAccountsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListAccountsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAccountsRequestDirection + && this.string.equals(((ListAccountsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAccountsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListAccountsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/ListAccountsRequestOrder.java b/src/main/java/com/whop/api/resources/accounts/types/ListAccountsRequestOrder.java new file mode 100644 index 00000000..a283ee1c --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/ListAccountsRequestOrder.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAccountsRequestOrder { + public static final ListAccountsRequestOrder CREATED_AT = + new ListAccountsRequestOrder(Value.CREATED_AT, "created_at"); + + public static final ListAccountsRequestOrder VOLUME = new ListAccountsRequestOrder(Value.VOLUME, "volume"); + + private final Value value; + + private final String string; + + ListAccountsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAccountsRequestOrder + && this.string.equals(((ListAccountsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case VOLUME: + return visitor.visitVolume(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAccountsRequestOrder valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + case "volume": + return VOLUME; + default: + return new ListAccountsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + VOLUME, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitVolume(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/ListAccountsRequestStatus.java b/src/main/java/com/whop/api/resources/accounts/types/ListAccountsRequestStatus.java new file mode 100644 index 00000000..261edc6b --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/ListAccountsRequestStatus.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAccountsRequestStatus { + public static final ListAccountsRequestStatus SUSPENDED = + new ListAccountsRequestStatus(Value.SUSPENDED, "suspended"); + + public static final ListAccountsRequestStatus ACTIVE = new ListAccountsRequestStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + ListAccountsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAccountsRequestStatus + && this.string.equals(((ListAccountsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SUSPENDED: + return visitor.visitSuspended(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAccountsRequestStatus valueOf(String value) { + switch (value) { + case "suspended": + return SUSPENDED; + case "active": + return ACTIVE; + default: + return new ListAccountsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + SUSPENDED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitSuspended(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/ListAccountsResponse.java b/src/main/java/com/whop/api/resources/accounts/types/ListAccountsResponse.java new file mode 100644 index 00000000..6e2c29df --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/ListAccountsResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Account; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAccountsResponse.Builder.class) +public final class ListAccountsResponse { + private final List data; + + private final ListAccountsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListAccountsResponse( + List data, ListAccountsResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListAccountsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAccountsResponse && equalTo((ListAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAccountsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListAccountsResponsePageInfo pageInfo); + + Builder from(ListAccountsResponse other); + } + + public interface _FinalStage { + ListAccountsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(Account data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListAccountsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAccountsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListAccountsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(Account data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListAccountsResponse build() { + return new ListAccountsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/ListAccountsResponsePageInfo.java b/src/main/java/com/whop/api/resources/accounts/types/ListAccountsResponsePageInfo.java new file mode 100644 index 00000000..0dad5686 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/ListAccountsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAccountsResponsePageInfo.Builder.class) +public final class ListAccountsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListAccountsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAccountsResponsePageInfo && equalTo((ListAccountsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAccountsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListAccountsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListAccountsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAccountsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListAccountsResponsePageInfo build() { + return new ListAccountsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/PostAccountUpdatedPayload.java b/src/main/java/com/whop/api/resources/accounts/types/PostAccountUpdatedPayload.java new file mode 100644 index 00000000..9ed475f6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/PostAccountUpdatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Account; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostAccountUpdatedPayload.Builder.class) +public final class PostAccountUpdatedPayload { + private final Optional accountId; + + private final PostAccountUpdatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Account data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostAccountUpdatedPayloadType type; + + private final Map additionalProperties; + + private PostAccountUpdatedPayload( + Optional accountId, + PostAccountUpdatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Account data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostAccountUpdatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostAccountUpdatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Account getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostAccountUpdatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostAccountUpdatedPayload && equalTo((PostAccountUpdatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostAccountUpdatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostAccountUpdatedPayloadApiVersion apiVersion); + + Builder from(PostAccountUpdatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Account data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostAccountUpdatedPayloadType type); + } + + public interface _FinalStage { + PostAccountUpdatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostAccountUpdatedPayloadApiVersion apiVersion; + + private Account data; + + private String id; + + private OffsetDateTime timestamp; + + private PostAccountUpdatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostAccountUpdatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostAccountUpdatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Account data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostAccountUpdatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostAccountUpdatedPayload build() { + return new PostAccountUpdatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/PostAccountUpdatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/accounts/types/PostAccountUpdatedPayloadApiVersion.java new file mode 100644 index 00000000..60afb431 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/PostAccountUpdatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostAccountUpdatedPayloadApiVersion { + public static final PostAccountUpdatedPayloadApiVersion V1 = + new PostAccountUpdatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostAccountUpdatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostAccountUpdatedPayloadApiVersion + && this.string.equals(((PostAccountUpdatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostAccountUpdatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostAccountUpdatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/PostAccountUpdatedPayloadType.java b/src/main/java/com/whop/api/resources/accounts/types/PostAccountUpdatedPayloadType.java new file mode 100644 index 00000000..1545d1cf --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/PostAccountUpdatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostAccountUpdatedPayloadType { + public static final PostAccountUpdatedPayloadType ACCOUNT_UPDATED = + new PostAccountUpdatedPayloadType(Value.ACCOUNT_UPDATED, "account.updated"); + + private final Value value; + + private final String string; + + PostAccountUpdatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostAccountUpdatedPayloadType + && this.string.equals(((PostAccountUpdatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ACCOUNT_UPDATED: + return visitor.visitAccountUpdated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostAccountUpdatedPayloadType valueOf(String value) { + switch (value) { + case "account.updated": + return ACCOUNT_UPDATED; + default: + return new PostAccountUpdatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT_UPDATED, + + UNKNOWN + } + + public interface Visitor { + T visitAccountUpdated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/TransferOwnershipAccountsResponse.java b/src/main/java/com/whop/api/resources/accounts/types/TransferOwnershipAccountsResponse.java new file mode 100644 index 00000000..535713fe --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/TransferOwnershipAccountsResponse.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TransferOwnershipAccountsResponse.Builder.class) +public final class TransferOwnershipAccountsResponse { + private final boolean success; + + private final Map additionalProperties; + + private TransferOwnershipAccountsResponse(boolean success, Map additionalProperties) { + this.success = success; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("success") + public boolean getSuccess() { + return success; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferOwnershipAccountsResponse && equalTo((TransferOwnershipAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TransferOwnershipAccountsResponse other) { + return success == other.success; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.success); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SuccessStage builder() { + return new Builder(); + } + + public interface SuccessStage { + _FinalStage success(boolean success); + + Builder from(TransferOwnershipAccountsResponse other); + } + + public interface _FinalStage { + TransferOwnershipAccountsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SuccessStage, _FinalStage { + private boolean success; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TransferOwnershipAccountsResponse other) { + success(other.getSuccess()); + return this; + } + + @java.lang.Override + @JsonSetter("success") + public _FinalStage success(boolean success) { + this.success = success; + return this; + } + + @java.lang.Override + public TransferOwnershipAccountsResponse build() { + return new TransferOwnershipAccountsResponse(success, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestBannerImage.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestBannerImage.java new file mode 100644 index 00000000..e7a74f1e --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestBannerImage.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAccountsRequestBannerImage.Builder.class) +public final class UpdateAccountsRequestBannerImage { + private final Optional id; + + private final Map additionalProperties; + + private UpdateAccountsRequestBannerImage(Optional id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of a file from Create File, prefixed file_. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAccountsRequestBannerImage && equalTo((UpdateAccountsRequestBannerImage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAccountsRequestBannerImage other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAccountsRequestBannerImage other) { + id(other.getId()); + return this; + } + + /** + *

ID of a file from Create File, prefixed file_.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdateAccountsRequestBannerImage build() { + return new UpdateAccountsRequestBannerImage(id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestBusinessAddress.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestBusinessAddress.java new file mode 100644 index 00000000..ba332229 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestBusinessAddress.java @@ -0,0 +1,348 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAccountsRequestBusinessAddress.Builder.class) +public final class UpdateAccountsRequestBusinessAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private UpdateAccountsRequestBusinessAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return City name. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + /** + * @return First line of the street address. + */ + @JsonProperty("line1") + public Optional getLine1() { + return line1; + } + + /** + * @return Second line of the street address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Postal or ZIP code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return State, province, or region code, for example CA. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAccountsRequestBusinessAddress + && equalTo((UpdateAccountsRequestBusinessAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAccountsRequestBusinessAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAccountsRequestBusinessAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

City name.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

First line of the street address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + /** + *

Second line of the street address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Postal or ZIP code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

State, province, or region code, for example CA.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public UpdateAccountsRequestBusinessAddress build() { + return new UpdateAccountsRequestBusinessAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestBusinessType.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestBusinessType.java new file mode 100644 index 00000000..a36a15db --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestBusinessType.java @@ -0,0 +1,284 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAccountsRequestBusinessType { + public static final UpdateAccountsRequestBusinessType SERVICES = + new UpdateAccountsRequestBusinessType(Value.SERVICES, "services"); + + public static final UpdateAccountsRequestBusinessType TELEHEALTH = + new UpdateAccountsRequestBusinessType(Value.TELEHEALTH, "telehealth"); + + public static final UpdateAccountsRequestBusinessType COMMUNITY = + new UpdateAccountsRequestBusinessType(Value.COMMUNITY, "community"); + + public static final UpdateAccountsRequestBusinessType BRICK_AND_MORTAR = + new UpdateAccountsRequestBusinessType(Value.BRICK_AND_MORTAR, "brick_and_mortar"); + + public static final UpdateAccountsRequestBusinessType EDUCATION_PROGRAM = + new UpdateAccountsRequestBusinessType(Value.EDUCATION_PROGRAM, "education_program"); + + public static final UpdateAccountsRequestBusinessType PAID_GROUP = + new UpdateAccountsRequestBusinessType(Value.PAID_GROUP, "paid_group"); + + public static final UpdateAccountsRequestBusinessType PHYSICAL_PRODUCT = + new UpdateAccountsRequestBusinessType(Value.PHYSICAL_PRODUCT, "physical_product"); + + public static final UpdateAccountsRequestBusinessType COACHING = + new UpdateAccountsRequestBusinessType(Value.COACHING, "coaching"); + + public static final UpdateAccountsRequestBusinessType SOFTWARE = + new UpdateAccountsRequestBusinessType(Value.SOFTWARE, "software"); + + public static final UpdateAccountsRequestBusinessType GIG_ECONOMY = + new UpdateAccountsRequestBusinessType(Value.GIG_ECONOMY, "gig_economy"); + + public static final UpdateAccountsRequestBusinessType SAAS = + new UpdateAccountsRequestBusinessType(Value.SAAS, "saas"); + + public static final UpdateAccountsRequestBusinessType COACHING_AND_COURSES = + new UpdateAccountsRequestBusinessType(Value.COACHING_AND_COURSES, "coaching_and_courses"); + + public static final UpdateAccountsRequestBusinessType OTHER = + new UpdateAccountsRequestBusinessType(Value.OTHER, "other"); + + public static final UpdateAccountsRequestBusinessType NEWSLETTER = + new UpdateAccountsRequestBusinessType(Value.NEWSLETTER, "newsletter"); + + public static final UpdateAccountsRequestBusinessType AGENCY = + new UpdateAccountsRequestBusinessType(Value.AGENCY, "agency"); + + public static final UpdateAccountsRequestBusinessType MARKETPLACE = + new UpdateAccountsRequestBusinessType(Value.MARKETPLACE, "marketplace"); + + public static final UpdateAccountsRequestBusinessType PHYSICAL_PRODUCTS = + new UpdateAccountsRequestBusinessType(Value.PHYSICAL_PRODUCTS, "physical_products"); + + public static final UpdateAccountsRequestBusinessType EVENTS = + new UpdateAccountsRequestBusinessType(Value.EVENTS, "events"); + + public static final UpdateAccountsRequestBusinessType CLASS_ACTION_SETTLEMENT = + new UpdateAccountsRequestBusinessType(Value.CLASS_ACTION_SETTLEMENT, "class_action_settlement"); + + public static final UpdateAccountsRequestBusinessType COURSE = + new UpdateAccountsRequestBusinessType(Value.COURSE, "course"); + + private final Value value; + + private final String string; + + UpdateAccountsRequestBusinessType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAccountsRequestBusinessType + && this.string.equals(((UpdateAccountsRequestBusinessType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SERVICES: + return visitor.visitServices(); + case TELEHEALTH: + return visitor.visitTelehealth(); + case COMMUNITY: + return visitor.visitCommunity(); + case BRICK_AND_MORTAR: + return visitor.visitBrickAndMortar(); + case EDUCATION_PROGRAM: + return visitor.visitEducationProgram(); + case PAID_GROUP: + return visitor.visitPaidGroup(); + case PHYSICAL_PRODUCT: + return visitor.visitPhysicalProduct(); + case COACHING: + return visitor.visitCoaching(); + case SOFTWARE: + return visitor.visitSoftware(); + case GIG_ECONOMY: + return visitor.visitGigEconomy(); + case SAAS: + return visitor.visitSaas(); + case COACHING_AND_COURSES: + return visitor.visitCoachingAndCourses(); + case OTHER: + return visitor.visitOther(); + case NEWSLETTER: + return visitor.visitNewsletter(); + case AGENCY: + return visitor.visitAgency(); + case MARKETPLACE: + return visitor.visitMarketplace(); + case PHYSICAL_PRODUCTS: + return visitor.visitPhysicalProducts(); + case EVENTS: + return visitor.visitEvents(); + case CLASS_ACTION_SETTLEMENT: + return visitor.visitClassActionSettlement(); + case COURSE: + return visitor.visitCourse(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAccountsRequestBusinessType valueOf(String value) { + switch (value) { + case "services": + return SERVICES; + case "telehealth": + return TELEHEALTH; + case "community": + return COMMUNITY; + case "brick_and_mortar": + return BRICK_AND_MORTAR; + case "education_program": + return EDUCATION_PROGRAM; + case "paid_group": + return PAID_GROUP; + case "physical_product": + return PHYSICAL_PRODUCT; + case "coaching": + return COACHING; + case "software": + return SOFTWARE; + case "gig_economy": + return GIG_ECONOMY; + case "saas": + return SAAS; + case "coaching_and_courses": + return COACHING_AND_COURSES; + case "other": + return OTHER; + case "newsletter": + return NEWSLETTER; + case "agency": + return AGENCY; + case "marketplace": + return MARKETPLACE; + case "physical_products": + return PHYSICAL_PRODUCTS; + case "events": + return EVENTS; + case "class_action_settlement": + return CLASS_ACTION_SETTLEMENT; + case "course": + return COURSE; + default: + return new UpdateAccountsRequestBusinessType(Value.UNKNOWN, value); + } + } + + public enum Value { + EDUCATION_PROGRAM, + + COACHING, + + SOFTWARE, + + PAID_GROUP, + + NEWSLETTER, + + AGENCY, + + PHYSICAL_PRODUCTS, + + BRICK_AND_MORTAR, + + EVENTS, + + COACHING_AND_COURSES, + + OTHER, + + SERVICES, + + GIG_ECONOMY, + + MARKETPLACE, + + TELEHEALTH, + + CLASS_ACTION_SETTLEMENT, + + PHYSICAL_PRODUCT, + + SAAS, + + COURSE, + + COMMUNITY, + + UNKNOWN + } + + public interface Visitor { + T visitEducationProgram(); + + T visitCoaching(); + + T visitSoftware(); + + T visitPaidGroup(); + + T visitNewsletter(); + + T visitAgency(); + + T visitPhysicalProducts(); + + T visitBrickAndMortar(); + + T visitEvents(); + + T visitCoachingAndCourses(); + + T visitOther(); + + T visitServices(); + + T visitGigEconomy(); + + T visitMarketplace(); + + T visitTelehealth(); + + T visitClassActionSettlement(); + + T visitPhysicalProduct(); + + T visitSaas(); + + T visitCourse(); + + T visitCommunity(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestHomePreferencesItem.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestHomePreferencesItem.java new file mode 100644 index 00000000..6414532e --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestHomePreferencesItem.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAccountsRequestHomePreferencesItem { + public static final UpdateAccountsRequestHomePreferencesItem HIDE_MEMBER_COUNT = + new UpdateAccountsRequestHomePreferencesItem(Value.HIDE_MEMBER_COUNT, "hide_member_count"); + + public static final UpdateAccountsRequestHomePreferencesItem HIDE_MEMBERS_CARD = + new UpdateAccountsRequestHomePreferencesItem(Value.HIDE_MEMBERS_CARD, "hide_members_card"); + + private final Value value; + + private final String string; + + UpdateAccountsRequestHomePreferencesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAccountsRequestHomePreferencesItem + && this.string.equals(((UpdateAccountsRequestHomePreferencesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HIDE_MEMBER_COUNT: + return visitor.visitHideMemberCount(); + case HIDE_MEMBERS_CARD: + return visitor.visitHideMembersCard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAccountsRequestHomePreferencesItem valueOf(String value) { + switch (value) { + case "hide_member_count": + return HIDE_MEMBER_COUNT; + case "hide_members_card": + return HIDE_MEMBERS_CARD; + default: + return new UpdateAccountsRequestHomePreferencesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + HIDE_MEMBER_COUNT, + + HIDE_MEMBERS_CARD, + + UNKNOWN + } + + public interface Visitor { + T visitHideMemberCount(); + + T visitHideMembersCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestIndustryGroup.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestIndustryGroup.java new file mode 100644 index 00000000..6e36815f --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestIndustryGroup.java @@ -0,0 +1,1625 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAccountsRequestIndustryGroup { + public static final UpdateAccountsRequestIndustryGroup DERMATOLOGY_AND_SKIN = + new UpdateAccountsRequestIndustryGroup(Value.DERMATOLOGY_AND_SKIN, "dermatology_and_skin"); + + public static final UpdateAccountsRequestIndustryGroup MARKETING_AND_ADVERTISING = + new UpdateAccountsRequestIndustryGroup(Value.MARKETING_AND_ADVERTISING, "marketing_and_advertising"); + + public static final UpdateAccountsRequestIndustryGroup RESTAURANTS = + new UpdateAccountsRequestIndustryGroup(Value.RESTAURANTS, "restaurants"); + + public static final UpdateAccountsRequestIndustryGroup CREATIVE_AND_CONTENT_GROUPS = + new UpdateAccountsRequestIndustryGroup(Value.CREATIVE_AND_CONTENT_GROUPS, "creative_and_content_groups"); + + public static final UpdateAccountsRequestIndustryGroup HOME_AND_TRADE_STOREFRONTS = + new UpdateAccountsRequestIndustryGroup(Value.HOME_AND_TRADE_STOREFRONTS, "home_and_trade_storefronts"); + + public static final UpdateAccountsRequestIndustryGroup HOME_AND_LIVING = + new UpdateAccountsRequestIndustryGroup(Value.HOME_AND_LIVING, "home_and_living"); + + public static final UpdateAccountsRequestIndustryGroup RELIGION_AND_FAITH = + new UpdateAccountsRequestIndustryGroup(Value.RELIGION_AND_FAITH, "religion_and_faith"); + + public static final UpdateAccountsRequestIndustryGroup REAL_ESTATE_SOFTWARE = + new UpdateAccountsRequestIndustryGroup(Value.REAL_ESTATE_SOFTWARE, "real_estate_software"); + + public static final UpdateAccountsRequestIndustryGroup SUPPLEMENTS_AND_NUTRITION = + new UpdateAccountsRequestIndustryGroup(Value.SUPPLEMENTS_AND_NUTRITION, "supplements_and_nutrition"); + + public static final UpdateAccountsRequestIndustryGroup VIDEO_GAMES_AND_ESPORTS = + new UpdateAccountsRequestIndustryGroup(Value.VIDEO_GAMES_AND_ESPORTS, "video_games_and_esports"); + + public static final UpdateAccountsRequestIndustryGroup PERSONAL_DEVELOPMENT = + new UpdateAccountsRequestIndustryGroup(Value.PERSONAL_DEVELOPMENT, "personal_development"); + + public static final UpdateAccountsRequestIndustryGroup HEALTHCARE = + new UpdateAccountsRequestIndustryGroup(Value.HEALTHCARE, "healthcare"); + + public static final UpdateAccountsRequestIndustryGroup TRADING_AND_FINANCE_SOFTWARE = + new UpdateAccountsRequestIndustryGroup(Value.TRADING_AND_FINANCE_SOFTWARE, "trading_and_finance_software"); + + public static final UpdateAccountsRequestIndustryGroup SOCIAL_AND_NETWORKING_EVENTS = + new UpdateAccountsRequestIndustryGroup(Value.SOCIAL_AND_NETWORKING_EVENTS, "social_and_networking_events"); + + public static final UpdateAccountsRequestIndustryGroup DENTAL_AND_VISION = + new UpdateAccountsRequestIndustryGroup(Value.DENTAL_AND_VISION, "dental_and_vision"); + + public static final UpdateAccountsRequestIndustryGroup CREATIVE_GIGS = + new UpdateAccountsRequestIndustryGroup(Value.CREATIVE_GIGS, "creative_gigs"); + + public static final UpdateAccountsRequestIndustryGroup GAMING_GROUPS = + new UpdateAccountsRequestIndustryGroup(Value.GAMING_GROUPS, "gaming_groups"); + + public static final UpdateAccountsRequestIndustryGroup SLEEP_AND_CHRONIC_CONDITIONS = + new UpdateAccountsRequestIndustryGroup(Value.SLEEP_AND_CHRONIC_CONDITIONS, "sleep_and_chronic_conditions"); + + public static final UpdateAccountsRequestIndustryGroup PERSONAL_SERVICES = + new UpdateAccountsRequestIndustryGroup(Value.PERSONAL_SERVICES, "personal_services"); + + public static final UpdateAccountsRequestIndustryGroup SERVICE_MARKETPLACES = + new UpdateAccountsRequestIndustryGroup(Value.SERVICE_MARKETPLACES, "service_marketplaces"); + + public static final UpdateAccountsRequestIndustryGroup ARTS_AND_CRAFTS = + new UpdateAccountsRequestIndustryGroup(Value.ARTS_AND_CRAFTS, "arts_and_crafts"); + + public static final UpdateAccountsRequestIndustryGroup CAFES_AND_QUICK_SERVICE = + new UpdateAccountsRequestIndustryGroup(Value.CAFES_AND_QUICK_SERVICE, "cafes_and_quick_service"); + + public static final UpdateAccountsRequestIndustryGroup GOVERNMENT_AND_PUBLIC = + new UpdateAccountsRequestIndustryGroup(Value.GOVERNMENT_AND_PUBLIC, "government_and_public"); + + public static final UpdateAccountsRequestIndustryGroup OUTDOOR_AND_SPORTS = + new UpdateAccountsRequestIndustryGroup(Value.OUTDOOR_AND_SPORTS, "outdoor_and_sports"); + + public static final UpdateAccountsRequestIndustryGroup SPORTS_BETTING_GROUPS = + new UpdateAccountsRequestIndustryGroup(Value.SPORTS_BETTING_GROUPS, "sports_betting_groups"); + + public static final UpdateAccountsRequestIndustryGroup LIFESTYLE_AND_PERSONAL_GROWTH = + new UpdateAccountsRequestIndustryGroup( + Value.LIFESTYLE_AND_PERSONAL_GROWTH, "lifestyle_and_personal_growth"); + + public static final UpdateAccountsRequestIndustryGroup HOME_AND_TRADE_SERVICES = + new UpdateAccountsRequestIndustryGroup(Value.HOME_AND_TRADE_SERVICES, "home_and_trade_services"); + + public static final UpdateAccountsRequestIndustryGroup SPIRITUALITY_AND_PERSONAL_GROWTH = + new UpdateAccountsRequestIndustryGroup( + Value.SPIRITUALITY_AND_PERSONAL_GROWTH, "spirituality_and_personal_growth"); + + public static final UpdateAccountsRequestIndustryGroup E_COMMERCE_SOFTWARE = + new UpdateAccountsRequestIndustryGroup(Value.E_COMMERCE_SOFTWARE, "e_commerce_software"); + + public static final UpdateAccountsRequestIndustryGroup HOSPITALITY_AND_LODGING = + new UpdateAccountsRequestIndustryGroup(Value.HOSPITALITY_AND_LODGING, "hospitality_and_lodging"); + + public static final UpdateAccountsRequestIndustryGroup PERFORMANCE_AND_SHOW_EVENTS = + new UpdateAccountsRequestIndustryGroup(Value.PERFORMANCE_AND_SHOW_EVENTS, "performance_and_show_events"); + + public static final UpdateAccountsRequestIndustryGroup CUSTOMER_SUPPORT_AGENCIES = + new UpdateAccountsRequestIndustryGroup(Value.CUSTOMER_SUPPORT_AGENCIES, "customer_support_agencies"); + + public static final UpdateAccountsRequestIndustryGroup FUNERAL_AND_DEATH_CARE = + new UpdateAccountsRequestIndustryGroup(Value.FUNERAL_AND_DEATH_CARE, "funeral_and_death_care"); + + public static final UpdateAccountsRequestIndustryGroup SUSTAINABILITY_AND_ECO_PRODUCTS = + new UpdateAccountsRequestIndustryGroup( + Value.SUSTAINABILITY_AND_ECO_PRODUCTS, "sustainability_and_eco_products"); + + public static final UpdateAccountsRequestIndustryGroup MARKETING_AGENCIES = + new UpdateAccountsRequestIndustryGroup(Value.MARKETING_AGENCIES, "marketing_agencies"); + + public static final UpdateAccountsRequestIndustryGroup LIFESTYLE_AND_WELLNESS_EVENTS = + new UpdateAccountsRequestIndustryGroup( + Value.LIFESTYLE_AND_WELLNESS_EVENTS, "lifestyle_and_wellness_events"); + + public static final UpdateAccountsRequestIndustryGroup SPECIALIZED_GIGS = + new UpdateAccountsRequestIndustryGroup(Value.SPECIALIZED_GIGS, "specialized_gigs"); + + public static final UpdateAccountsRequestIndustryGroup SECURITY_AND_PRIVACY_SOFTWARE = + new UpdateAccountsRequestIndustryGroup( + Value.SECURITY_AND_PRIVACY_SOFTWARE, "security_and_privacy_software"); + + public static final UpdateAccountsRequestIndustryGroup GENETIC_AND_SPECIALIZED = + new UpdateAccountsRequestIndustryGroup(Value.GENETIC_AND_SPECIALIZED, "genetic_and_specialized"); + + public static final UpdateAccountsRequestIndustryGroup PRIMARY_AND_GENERAL_CARE = + new UpdateAccountsRequestIndustryGroup(Value.PRIMARY_AND_GENERAL_CARE, "primary_and_general_care"); + + public static final UpdateAccountsRequestIndustryGroup FAMILY_AND_COMMUNITY_EVENTS = + new UpdateAccountsRequestIndustryGroup(Value.FAMILY_AND_COMMUNITY_EVENTS, "family_and_community_events"); + + public static final UpdateAccountsRequestIndustryGroup TECH_AND_AI = + new UpdateAccountsRequestIndustryGroup(Value.TECH_AND_AI, "tech_and_ai"); + + public static final UpdateAccountsRequestIndustryGroup SPORTS_BETTING_AND_GAMBLING = + new UpdateAccountsRequestIndustryGroup(Value.SPORTS_BETTING_AND_GAMBLING, "sports_betting_and_gambling"); + + public static final UpdateAccountsRequestIndustryGroup BARS_AND_BREWERIES = + new UpdateAccountsRequestIndustryGroup(Value.BARS_AND_BREWERIES, "bars_and_breweries"); + + public static final UpdateAccountsRequestIndustryGroup DIGITAL_GOODS_AND_ACCOUNTS = + new UpdateAccountsRequestIndustryGroup(Value.DIGITAL_GOODS_AND_ACCOUNTS, "digital_goods_and_accounts"); + + public static final UpdateAccountsRequestIndustryGroup ENTERTAINMENT_AND_LEISURE = + new UpdateAccountsRequestIndustryGroup(Value.ENTERTAINMENT_AND_LEISURE, "entertainment_and_leisure"); + + public static final UpdateAccountsRequestIndustryGroup HEALTHCARE_AND_WELLNESS_SOFTWARE = + new UpdateAccountsRequestIndustryGroup( + Value.HEALTHCARE_AND_WELLNESS_SOFTWARE, "healthcare_and_wellness_software"); + + public static final UpdateAccountsRequestIndustryGroup EDUCATION_AND_CHILDCARE = + new UpdateAccountsRequestIndustryGroup(Value.EDUCATION_AND_CHILDCARE, "education_and_childcare"); + + public static final UpdateAccountsRequestIndustryGroup LEGAL_AND_COMPLIANCE = + new UpdateAccountsRequestIndustryGroup(Value.LEGAL_AND_COMPLIANCE, "legal_and_compliance"); + + public static final UpdateAccountsRequestIndustryGroup COMMUNICATION_AND_MESSAGING_SOFTWARE = + new UpdateAccountsRequestIndustryGroup( + Value.COMMUNICATION_AND_MESSAGING_SOFTWARE, "communication_and_messaging_software"); + + public static final UpdateAccountsRequestIndustryGroup SPORTS_AND_FITNESS_EVENTS = + new UpdateAccountsRequestIndustryGroup(Value.SPORTS_AND_FITNESS_EVENTS, "sports_and_fitness_events"); + + public static final UpdateAccountsRequestIndustryGroup PET_SERVICES = + new UpdateAccountsRequestIndustryGroup(Value.PET_SERVICES, "pet_services"); + + public static final UpdateAccountsRequestIndustryGroup DESIGN_AND_CREATIVE_AGENCIES = + new UpdateAccountsRequestIndustryGroup(Value.DESIGN_AND_CREATIVE_AGENCIES, "design_and_creative_agencies"); + + public static final UpdateAccountsRequestIndustryGroup VETERINARY = + new UpdateAccountsRequestIndustryGroup(Value.VETERINARY, "veterinary"); + + public static final UpdateAccountsRequestIndustryGroup AUTOMOTIVE = + new UpdateAccountsRequestIndustryGroup(Value.AUTOMOTIVE, "automotive"); + + public static final UpdateAccountsRequestIndustryGroup HEALTH_AND_WELLNESS = + new UpdateAccountsRequestIndustryGroup(Value.HEALTH_AND_WELLNESS, "health_and_wellness"); + + public static final UpdateAccountsRequestIndustryGroup LIFESTYLE_AND_PERSONAL_GROWTH_GROUPS = + new UpdateAccountsRequestIndustryGroup( + Value.LIFESTYLE_AND_PERSONAL_GROWTH_GROUPS, "lifestyle_and_personal_growth_groups"); + + public static final UpdateAccountsRequestIndustryGroup SPIRITUALITY_AND_MINDFULNESS = + new UpdateAccountsRequestIndustryGroup(Value.SPIRITUALITY_AND_MINDFULNESS, "spirituality_and_mindfulness"); + + public static final UpdateAccountsRequestIndustryGroup CONTENT_AND_CLIPPING_AGENCIES = + new UpdateAccountsRequestIndustryGroup( + Value.CONTENT_AND_CLIPPING_AGENCIES, "content_and_clipping_agencies"); + + public static final UpdateAccountsRequestIndustryGroup BABY_AND_KIDS = + new UpdateAccountsRequestIndustryGroup(Value.BABY_AND_KIDS, "baby_and_kids"); + + public static final UpdateAccountsRequestIndustryGroup DIGITAL_AND_EDUCATION_MARKETPLACES = + new UpdateAccountsRequestIndustryGroup( + Value.DIGITAL_AND_EDUCATION_MARKETPLACES, "digital_and_education_marketplaces"); + + public static final UpdateAccountsRequestIndustryGroup TASK_AND_ERRANDS = + new UpdateAccountsRequestIndustryGroup(Value.TASK_AND_ERRANDS, "task_and_errands"); + + public static final UpdateAccountsRequestIndustryGroup FOOD_AND_BEVERAGES = + new UpdateAccountsRequestIndustryGroup(Value.FOOD_AND_BEVERAGES, "food_and_beverages"); + + public static final UpdateAccountsRequestIndustryGroup FITNESS_EQUIPMENT_AND_GEAR = + new UpdateAccountsRequestIndustryGroup(Value.FITNESS_EQUIPMENT_AND_GEAR, "fitness_equipment_and_gear"); + + public static final UpdateAccountsRequestIndustryGroup DATING_AND_RELATIONSHIPS = + new UpdateAccountsRequestIndustryGroup(Value.DATING_AND_RELATIONSHIPS, "dating_and_relationships"); + + public static final UpdateAccountsRequestIndustryGroup HOBBY_AND_INTEREST_GROUPS = + new UpdateAccountsRequestIndustryGroup(Value.HOBBY_AND_INTEREST_GROUPS, "hobby_and_interest_groups"); + + public static final UpdateAccountsRequestIndustryGroup REHABILITATION_AND_THERAPY = + new UpdateAccountsRequestIndustryGroup(Value.REHABILITATION_AND_THERAPY, "rehabilitation_and_therapy"); + + public static final UpdateAccountsRequestIndustryGroup LOGISTICS_AND_TRANSPORTATION_SERVICES = + new UpdateAccountsRequestIndustryGroup( + Value.LOGISTICS_AND_TRANSPORTATION_SERVICES, "logistics_and_transportation_services"); + + public static final UpdateAccountsRequestIndustryGroup RETAIL = + new UpdateAccountsRequestIndustryGroup(Value.RETAIL, "retail"); + + public static final UpdateAccountsRequestIndustryGroup BUSINESS_AND_MONEY_GROUPS = + new UpdateAccountsRequestIndustryGroup(Value.BUSINESS_AND_MONEY_GROUPS, "business_and_money_groups"); + + public static final UpdateAccountsRequestIndustryGroup CLOTHING_AND_APPAREL = + new UpdateAccountsRequestIndustryGroup(Value.CLOTHING_AND_APPAREL, "clothing_and_apparel"); + + public static final UpdateAccountsRequestIndustryGroup CREATIVE_AND_EDUCATION = + new UpdateAccountsRequestIndustryGroup(Value.CREATIVE_AND_EDUCATION, "creative_and_education"); + + public static final UpdateAccountsRequestIndustryGroup NEWS_AND_POLITICS = + new UpdateAccountsRequestIndustryGroup(Value.NEWS_AND_POLITICS, "news_and_politics"); + + public static final UpdateAccountsRequestIndustryGroup BEAUTY_AND_PERSONAL_CARE = + new UpdateAccountsRequestIndustryGroup(Value.BEAUTY_AND_PERSONAL_CARE, "beauty_and_personal_care"); + + public static final UpdateAccountsRequestIndustryGroup DELIVERY_AND_LOGISTICS = + new UpdateAccountsRequestIndustryGroup(Value.DELIVERY_AND_LOGISTICS, "delivery_and_logistics"); + + public static final UpdateAccountsRequestIndustryGroup HEALTH_AND_WELLNESS_SERVICES = + new UpdateAccountsRequestIndustryGroup(Value.HEALTH_AND_WELLNESS_SERVICES, "health_and_wellness_services"); + + public static final UpdateAccountsRequestIndustryGroup HOBBIES_AND_LIFESTYLE = + new UpdateAccountsRequestIndustryGroup(Value.HOBBIES_AND_LIFESTYLE, "hobbies_and_lifestyle"); + + public static final UpdateAccountsRequestIndustryGroup PRODUCT_MARKETPLACES = + new UpdateAccountsRequestIndustryGroup(Value.PRODUCT_MARKETPLACES, "product_marketplaces"); + + public static final UpdateAccountsRequestIndustryGroup PETS_AND_ANIMALS = + new UpdateAccountsRequestIndustryGroup(Value.PETS_AND_ANIMALS, "pets_and_animals"); + + public static final UpdateAccountsRequestIndustryGroup PROFESSIONAL_SERVICES_STOREFRONT = + new UpdateAccountsRequestIndustryGroup( + Value.PROFESSIONAL_SERVICES_STOREFRONT, "professional_services_storefront"); + + public static final UpdateAccountsRequestIndustryGroup CREATIVE_AND_CONTENT_CREATION = + new UpdateAccountsRequestIndustryGroup( + Value.CREATIVE_AND_CONTENT_CREATION, "creative_and_content_creation"); + + public static final UpdateAccountsRequestIndustryGroup SOCIAL_ENTERTAINMENT_EVENTS = + new UpdateAccountsRequestIndustryGroup(Value.SOCIAL_ENTERTAINMENT_EVENTS, "social_entertainment_events"); + + public static final UpdateAccountsRequestIndustryGroup CREATIVE_SERVICES = + new UpdateAccountsRequestIndustryGroup(Value.CREATIVE_SERVICES, "creative_services"); + + public static final UpdateAccountsRequestIndustryGroup REAL_ESTATE = + new UpdateAccountsRequestIndustryGroup(Value.REAL_ESTATE, "real_estate"); + + public static final UpdateAccountsRequestIndustryGroup FITNESS_AND_RECREATION = + new UpdateAccountsRequestIndustryGroup(Value.FITNESS_AND_RECREATION, "fitness_and_recreation"); + + public static final UpdateAccountsRequestIndustryGroup FOOD_AND_HOSPITALITY_MARKETPLACES = + new UpdateAccountsRequestIndustryGroup( + Value.FOOD_AND_HOSPITALITY_MARKETPLACES, "food_and_hospitality_marketplaces"); + + public static final UpdateAccountsRequestIndustryGroup RENTAL_MARKETPLACES = + new UpdateAccountsRequestIndustryGroup(Value.RENTAL_MARKETPLACES, "rental_marketplaces"); + + public static final UpdateAccountsRequestIndustryGroup SPECIALTY_MEDICAL_CARE = + new UpdateAccountsRequestIndustryGroup(Value.SPECIALTY_MEDICAL_CARE, "specialty_medical_care"); + + public static final UpdateAccountsRequestIndustryGroup FINANCE_AND_INVESTING = + new UpdateAccountsRequestIndustryGroup(Value.FINANCE_AND_INVESTING, "finance_and_investing"); + + public static final UpdateAccountsRequestIndustryGroup AGRICULTURE_AND_FARMING = + new UpdateAccountsRequestIndustryGroup(Value.AGRICULTURE_AND_FARMING, "agriculture_and_farming"); + + public static final UpdateAccountsRequestIndustryGroup ACADEMIC_AND_TEST_PREP = + new UpdateAccountsRequestIndustryGroup(Value.ACADEMIC_AND_TEST_PREP, "academic_and_test_prep"); + + public static final UpdateAccountsRequestIndustryGroup OFFICE_AND_BUSINESS_SUPPLIES = + new UpdateAccountsRequestIndustryGroup(Value.OFFICE_AND_BUSINESS_SUPPLIES, "office_and_business_supplies"); + + public static final UpdateAccountsRequestIndustryGroup B2B_AND_PROFESSIONAL_MARKETPLACES = + new UpdateAccountsRequestIndustryGroup( + Value.B2B_AND_PROFESSIONAL_MARKETPLACES, "b2b_and_professional_marketplaces"); + + public static final UpdateAccountsRequestIndustryGroup WELLNESS_AND_ALTERNATIVE = + new UpdateAccountsRequestIndustryGroup(Value.WELLNESS_AND_ALTERNATIVE, "wellness_and_alternative"); + + public static final UpdateAccountsRequestIndustryGroup TRADING_AND_INVESTING_GROUPS = + new UpdateAccountsRequestIndustryGroup(Value.TRADING_AND_INVESTING_GROUPS, "trading_and_investing_groups"); + + public static final UpdateAccountsRequestIndustryGroup GAMING_AND_ENTERTAINMENT_SOFTWARE = + new UpdateAccountsRequestIndustryGroup( + Value.GAMING_AND_ENTERTAINMENT_SOFTWARE, "gaming_and_entertainment_software"); + + public static final UpdateAccountsRequestIndustryGroup MEDIA_AND_PUBLISHING_COMPANIES = + new UpdateAccountsRequestIndustryGroup( + Value.MEDIA_AND_PUBLISHING_COMPANIES, "media_and_publishing_companies"); + + public static final UpdateAccountsRequestIndustryGroup TRADING_AND_INVESTING = + new UpdateAccountsRequestIndustryGroup(Value.TRADING_AND_INVESTING, "trading_and_investing"); + + public static final UpdateAccountsRequestIndustryGroup BEAUTY_AND_WELLNESS = + new UpdateAccountsRequestIndustryGroup(Value.BEAUTY_AND_WELLNESS, "beauty_and_wellness"); + + public static final UpdateAccountsRequestIndustryGroup BUSINESS_AND_ENTREPRENEURSHIP = + new UpdateAccountsRequestIndustryGroup( + Value.BUSINESS_AND_ENTREPRENEURSHIP, "business_and_entrepreneurship"); + + public static final UpdateAccountsRequestIndustryGroup RECRUITING_AND_STAFFING = + new UpdateAccountsRequestIndustryGroup(Value.RECRUITING_AND_STAFFING, "recruiting_and_staffing"); + + public static final UpdateAccountsRequestIndustryGroup AI_AND_AUTOMATION_AGENCIES = + new UpdateAccountsRequestIndustryGroup(Value.AI_AND_AUTOMATION_AGENCIES, "ai_and_automation_agencies"); + + public static final UpdateAccountsRequestIndustryGroup PRODUCTIVITY_AND_BUSINESS_OPS = + new UpdateAccountsRequestIndustryGroup( + Value.PRODUCTIVITY_AND_BUSINESS_OPS, "productivity_and_business_ops"); + + public static final UpdateAccountsRequestIndustryGroup AI_AND_AUTOMATION_SOFTWARE = + new UpdateAccountsRequestIndustryGroup(Value.AI_AND_AUTOMATION_SOFTWARE, "ai_and_automation_software"); + + public static final UpdateAccountsRequestIndustryGroup LIFESTYLE_AND_CULTURE = + new UpdateAccountsRequestIndustryGroup(Value.LIFESTYLE_AND_CULTURE, "lifestyle_and_culture"); + + public static final UpdateAccountsRequestIndustryGroup CHARITY_AND_CAUSE_EVENTS = + new UpdateAccountsRequestIndustryGroup(Value.CHARITY_AND_CAUSE_EVENTS, "charity_and_cause_events"); + + public static final UpdateAccountsRequestIndustryGroup SECURITY_AND_INVESTIGATIONS = + new UpdateAccountsRequestIndustryGroup(Value.SECURITY_AND_INVESTIGATIONS, "security_and_investigations"); + + public static final UpdateAccountsRequestIndustryGroup MUSIC_AND_PERFORMING_ARTS = + new UpdateAccountsRequestIndustryGroup(Value.MUSIC_AND_PERFORMING_ARTS, "music_and_performing_arts"); + + public static final UpdateAccountsRequestIndustryGroup PROFESSIONAL_SERVICES = + new UpdateAccountsRequestIndustryGroup(Value.PROFESSIONAL_SERVICES, "professional_services"); + + public static final UpdateAccountsRequestIndustryGroup SALES_AGENCIES = + new UpdateAccountsRequestIndustryGroup(Value.SALES_AGENCIES, "sales_agencies"); + + public static final UpdateAccountsRequestIndustryGroup SALES_AND_REVENUE = + new UpdateAccountsRequestIndustryGroup(Value.SALES_AND_REVENUE, "sales_and_revenue"); + + public static final UpdateAccountsRequestIndustryGroup CONFERENCE_AND_EXPO_EVENTS = + new UpdateAccountsRequestIndustryGroup(Value.CONFERENCE_AND_EXPO_EVENTS, "conference_and_expo_events"); + + public static final UpdateAccountsRequestIndustryGroup ELECTRONICS_AND_GADGETS = + new UpdateAccountsRequestIndustryGroup(Value.ELECTRONICS_AND_GADGETS, "electronics_and_gadgets"); + + public static final UpdateAccountsRequestIndustryGroup EDUCATIONAL_TRAINING_EVENTS = + new UpdateAccountsRequestIndustryGroup(Value.EDUCATIONAL_TRAINING_EVENTS, "educational_training_events"); + + public static final UpdateAccountsRequestIndustryGroup PUBLISHING_AND_INFO_PRODUCTS = + new UpdateAccountsRequestIndustryGroup(Value.PUBLISHING_AND_INFO_PRODUCTS, "publishing_and_info_products"); + + public static final UpdateAccountsRequestIndustryGroup FITNESS_AND_ATHLETICS = + new UpdateAccountsRequestIndustryGroup(Value.FITNESS_AND_ATHLETICS, "fitness_and_athletics"); + + public static final UpdateAccountsRequestIndustryGroup DEVELOPMENT_AGENCIES = + new UpdateAccountsRequestIndustryGroup(Value.DEVELOPMENT_AGENCIES, "development_agencies"); + + public static final UpdateAccountsRequestIndustryGroup MISCELLANEOUS = + new UpdateAccountsRequestIndustryGroup(Value.MISCELLANEOUS, "miscellaneous"); + + public static final UpdateAccountsRequestIndustryGroup MENTAL_HEALTH_AND_BEHAVIORAL = + new UpdateAccountsRequestIndustryGroup(Value.MENTAL_HEALTH_AND_BEHAVIORAL, "mental_health_and_behavioral"); + + public static final UpdateAccountsRequestIndustryGroup TECH_AND_DEVELOPMENT = + new UpdateAccountsRequestIndustryGroup(Value.TECH_AND_DEVELOPMENT, "tech_and_development"); + + public static final UpdateAccountsRequestIndustryGroup DEVELOPER_AND_TECHNICAL_TOOLS = + new UpdateAccountsRequestIndustryGroup( + Value.DEVELOPER_AND_TECHNICAL_TOOLS, "developer_and_technical_tools"); + + public static final UpdateAccountsRequestIndustryGroup LANGUAGE_AND_COMMUNICATION = + new UpdateAccountsRequestIndustryGroup(Value.LANGUAGE_AND_COMMUNICATION, "language_and_communication"); + + public static final UpdateAccountsRequestIndustryGroup HOME_SERVICES_GIGS = + new UpdateAccountsRequestIndustryGroup(Value.HOME_SERVICES_GIGS, "home_services_gigs"); + + public static final UpdateAccountsRequestIndustryGroup CAREER_AND_PROFESSIONAL = + new UpdateAccountsRequestIndustryGroup(Value.CAREER_AND_PROFESSIONAL, "career_and_professional"); + + public static final UpdateAccountsRequestIndustryGroup COMMUNITY_AND_EDUCATION_SOFTWARE = + new UpdateAccountsRequestIndustryGroup( + Value.COMMUNITY_AND_EDUCATION_SOFTWARE, "community_and_education_software"); + + public static final UpdateAccountsRequestIndustryGroup ACCESSORIES = + new UpdateAccountsRequestIndustryGroup(Value.ACCESSORIES, "accessories"); + + public static final UpdateAccountsRequestIndustryGroup NONPROFIT_AND_CHARITY = + new UpdateAccountsRequestIndustryGroup(Value.NONPROFIT_AND_CHARITY, "nonprofit_and_charity"); + + public static final UpdateAccountsRequestIndustryGroup INDUSTRY_SPECIFIC_SOFTWARE = + new UpdateAccountsRequestIndustryGroup(Value.INDUSTRY_SPECIFIC_SOFTWARE, "industry_specific_software"); + + public static final UpdateAccountsRequestIndustryGroup CONSULTING = + new UpdateAccountsRequestIndustryGroup(Value.CONSULTING, "consulting"); + + public static final UpdateAccountsRequestIndustryGroup PERSONAL_FINANCE = + new UpdateAccountsRequestIndustryGroup(Value.PERSONAL_FINANCE, "personal_finance"); + + public static final UpdateAccountsRequestIndustryGroup HOME_IMPROVEMENT_AND_TOOLS = + new UpdateAccountsRequestIndustryGroup(Value.HOME_IMPROVEMENT_AND_TOOLS, "home_improvement_and_tools"); + + public static final UpdateAccountsRequestIndustryGroup FITNESS_AND_HEALTH_GROUPS = + new UpdateAccountsRequestIndustryGroup(Value.FITNESS_AND_HEALTH_GROUPS, "fitness_and_health_groups"); + + public static final UpdateAccountsRequestIndustryGroup INDUSTRIAL_AND_MANUFACTURING = + new UpdateAccountsRequestIndustryGroup(Value.INDUSTRIAL_AND_MANUFACTURING, "industrial_and_manufacturing"); + + public static final UpdateAccountsRequestIndustryGroup WEIGHT_AND_METABOLIC_HEALTH = + new UpdateAccountsRequestIndustryGroup(Value.WEIGHT_AND_METABOLIC_HEALTH, "weight_and_metabolic_health"); + + public static final UpdateAccountsRequestIndustryGroup MARKETING_AND_SALES_SOFTWARE = + new UpdateAccountsRequestIndustryGroup(Value.MARKETING_AND_SALES_SOFTWARE, "marketing_and_sales_software"); + + public static final UpdateAccountsRequestIndustryGroup TRANSPORTATION = + new UpdateAccountsRequestIndustryGroup(Value.TRANSPORTATION, "transportation"); + + public static final UpdateAccountsRequestIndustryGroup WOMENS_AND_MENS_HEALTH = + new UpdateAccountsRequestIndustryGroup(Value.WOMENS_AND_MENS_HEALTH, "womens_and_mens_health"); + + public static final UpdateAccountsRequestIndustryGroup CLASS_ACTION_SETTLEMENT = + new UpdateAccountsRequestIndustryGroup(Value.CLASS_ACTION_SETTLEMENT, "class_action_settlement"); + + public static final UpdateAccountsRequestIndustryGroup PROFESSIONAL_GIGS = + new UpdateAccountsRequestIndustryGroup(Value.PROFESSIONAL_GIGS, "professional_gigs"); + + public static final UpdateAccountsRequestIndustryGroup TECH_AND_DEV_GROUPS = + new UpdateAccountsRequestIndustryGroup(Value.TECH_AND_DEV_GROUPS, "tech_and_dev_groups"); + + private final Value value; + + private final String string; + + UpdateAccountsRequestIndustryGroup(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAccountsRequestIndustryGroup + && this.string.equals(((UpdateAccountsRequestIndustryGroup) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DERMATOLOGY_AND_SKIN: + return visitor.visitDermatologyAndSkin(); + case MARKETING_AND_ADVERTISING: + return visitor.visitMarketingAndAdvertising(); + case RESTAURANTS: + return visitor.visitRestaurants(); + case CREATIVE_AND_CONTENT_GROUPS: + return visitor.visitCreativeAndContentGroups(); + case HOME_AND_TRADE_STOREFRONTS: + return visitor.visitHomeAndTradeStorefronts(); + case HOME_AND_LIVING: + return visitor.visitHomeAndLiving(); + case RELIGION_AND_FAITH: + return visitor.visitReligionAndFaith(); + case REAL_ESTATE_SOFTWARE: + return visitor.visitRealEstateSoftware(); + case SUPPLEMENTS_AND_NUTRITION: + return visitor.visitSupplementsAndNutrition(); + case VIDEO_GAMES_AND_ESPORTS: + return visitor.visitVideoGamesAndEsports(); + case PERSONAL_DEVELOPMENT: + return visitor.visitPersonalDevelopment(); + case HEALTHCARE: + return visitor.visitHealthcare(); + case TRADING_AND_FINANCE_SOFTWARE: + return visitor.visitTradingAndFinanceSoftware(); + case SOCIAL_AND_NETWORKING_EVENTS: + return visitor.visitSocialAndNetworkingEvents(); + case DENTAL_AND_VISION: + return visitor.visitDentalAndVision(); + case CREATIVE_GIGS: + return visitor.visitCreativeGigs(); + case GAMING_GROUPS: + return visitor.visitGamingGroups(); + case SLEEP_AND_CHRONIC_CONDITIONS: + return visitor.visitSleepAndChronicConditions(); + case PERSONAL_SERVICES: + return visitor.visitPersonalServices(); + case SERVICE_MARKETPLACES: + return visitor.visitServiceMarketplaces(); + case ARTS_AND_CRAFTS: + return visitor.visitArtsAndCrafts(); + case CAFES_AND_QUICK_SERVICE: + return visitor.visitCafesAndQuickService(); + case GOVERNMENT_AND_PUBLIC: + return visitor.visitGovernmentAndPublic(); + case OUTDOOR_AND_SPORTS: + return visitor.visitOutdoorAndSports(); + case SPORTS_BETTING_GROUPS: + return visitor.visitSportsBettingGroups(); + case LIFESTYLE_AND_PERSONAL_GROWTH: + return visitor.visitLifestyleAndPersonalGrowth(); + case HOME_AND_TRADE_SERVICES: + return visitor.visitHomeAndTradeServices(); + case SPIRITUALITY_AND_PERSONAL_GROWTH: + return visitor.visitSpiritualityAndPersonalGrowth(); + case E_COMMERCE_SOFTWARE: + return visitor.visitECommerceSoftware(); + case HOSPITALITY_AND_LODGING: + return visitor.visitHospitalityAndLodging(); + case PERFORMANCE_AND_SHOW_EVENTS: + return visitor.visitPerformanceAndShowEvents(); + case CUSTOMER_SUPPORT_AGENCIES: + return visitor.visitCustomerSupportAgencies(); + case FUNERAL_AND_DEATH_CARE: + return visitor.visitFuneralAndDeathCare(); + case SUSTAINABILITY_AND_ECO_PRODUCTS: + return visitor.visitSustainabilityAndEcoProducts(); + case MARKETING_AGENCIES: + return visitor.visitMarketingAgencies(); + case LIFESTYLE_AND_WELLNESS_EVENTS: + return visitor.visitLifestyleAndWellnessEvents(); + case SPECIALIZED_GIGS: + return visitor.visitSpecializedGigs(); + case SECURITY_AND_PRIVACY_SOFTWARE: + return visitor.visitSecurityAndPrivacySoftware(); + case GENETIC_AND_SPECIALIZED: + return visitor.visitGeneticAndSpecialized(); + case PRIMARY_AND_GENERAL_CARE: + return visitor.visitPrimaryAndGeneralCare(); + case FAMILY_AND_COMMUNITY_EVENTS: + return visitor.visitFamilyAndCommunityEvents(); + case TECH_AND_AI: + return visitor.visitTechAndAi(); + case SPORTS_BETTING_AND_GAMBLING: + return visitor.visitSportsBettingAndGambling(); + case BARS_AND_BREWERIES: + return visitor.visitBarsAndBreweries(); + case DIGITAL_GOODS_AND_ACCOUNTS: + return visitor.visitDigitalGoodsAndAccounts(); + case ENTERTAINMENT_AND_LEISURE: + return visitor.visitEntertainmentAndLeisure(); + case HEALTHCARE_AND_WELLNESS_SOFTWARE: + return visitor.visitHealthcareAndWellnessSoftware(); + case EDUCATION_AND_CHILDCARE: + return visitor.visitEducationAndChildcare(); + case LEGAL_AND_COMPLIANCE: + return visitor.visitLegalAndCompliance(); + case COMMUNICATION_AND_MESSAGING_SOFTWARE: + return visitor.visitCommunicationAndMessagingSoftware(); + case SPORTS_AND_FITNESS_EVENTS: + return visitor.visitSportsAndFitnessEvents(); + case PET_SERVICES: + return visitor.visitPetServices(); + case DESIGN_AND_CREATIVE_AGENCIES: + return visitor.visitDesignAndCreativeAgencies(); + case VETERINARY: + return visitor.visitVeterinary(); + case AUTOMOTIVE: + return visitor.visitAutomotive(); + case HEALTH_AND_WELLNESS: + return visitor.visitHealthAndWellness(); + case LIFESTYLE_AND_PERSONAL_GROWTH_GROUPS: + return visitor.visitLifestyleAndPersonalGrowthGroups(); + case SPIRITUALITY_AND_MINDFULNESS: + return visitor.visitSpiritualityAndMindfulness(); + case CONTENT_AND_CLIPPING_AGENCIES: + return visitor.visitContentAndClippingAgencies(); + case BABY_AND_KIDS: + return visitor.visitBabyAndKids(); + case DIGITAL_AND_EDUCATION_MARKETPLACES: + return visitor.visitDigitalAndEducationMarketplaces(); + case TASK_AND_ERRANDS: + return visitor.visitTaskAndErrands(); + case FOOD_AND_BEVERAGES: + return visitor.visitFoodAndBeverages(); + case FITNESS_EQUIPMENT_AND_GEAR: + return visitor.visitFitnessEquipmentAndGear(); + case DATING_AND_RELATIONSHIPS: + return visitor.visitDatingAndRelationships(); + case HOBBY_AND_INTEREST_GROUPS: + return visitor.visitHobbyAndInterestGroups(); + case REHABILITATION_AND_THERAPY: + return visitor.visitRehabilitationAndTherapy(); + case LOGISTICS_AND_TRANSPORTATION_SERVICES: + return visitor.visitLogisticsAndTransportationServices(); + case RETAIL: + return visitor.visitRetail(); + case BUSINESS_AND_MONEY_GROUPS: + return visitor.visitBusinessAndMoneyGroups(); + case CLOTHING_AND_APPAREL: + return visitor.visitClothingAndApparel(); + case CREATIVE_AND_EDUCATION: + return visitor.visitCreativeAndEducation(); + case NEWS_AND_POLITICS: + return visitor.visitNewsAndPolitics(); + case BEAUTY_AND_PERSONAL_CARE: + return visitor.visitBeautyAndPersonalCare(); + case DELIVERY_AND_LOGISTICS: + return visitor.visitDeliveryAndLogistics(); + case HEALTH_AND_WELLNESS_SERVICES: + return visitor.visitHealthAndWellnessServices(); + case HOBBIES_AND_LIFESTYLE: + return visitor.visitHobbiesAndLifestyle(); + case PRODUCT_MARKETPLACES: + return visitor.visitProductMarketplaces(); + case PETS_AND_ANIMALS: + return visitor.visitPetsAndAnimals(); + case PROFESSIONAL_SERVICES_STOREFRONT: + return visitor.visitProfessionalServicesStorefront(); + case CREATIVE_AND_CONTENT_CREATION: + return visitor.visitCreativeAndContentCreation(); + case SOCIAL_ENTERTAINMENT_EVENTS: + return visitor.visitSocialEntertainmentEvents(); + case CREATIVE_SERVICES: + return visitor.visitCreativeServices(); + case REAL_ESTATE: + return visitor.visitRealEstate(); + case FITNESS_AND_RECREATION: + return visitor.visitFitnessAndRecreation(); + case FOOD_AND_HOSPITALITY_MARKETPLACES: + return visitor.visitFoodAndHospitalityMarketplaces(); + case RENTAL_MARKETPLACES: + return visitor.visitRentalMarketplaces(); + case SPECIALTY_MEDICAL_CARE: + return visitor.visitSpecialtyMedicalCare(); + case FINANCE_AND_INVESTING: + return visitor.visitFinanceAndInvesting(); + case AGRICULTURE_AND_FARMING: + return visitor.visitAgricultureAndFarming(); + case ACADEMIC_AND_TEST_PREP: + return visitor.visitAcademicAndTestPrep(); + case OFFICE_AND_BUSINESS_SUPPLIES: + return visitor.visitOfficeAndBusinessSupplies(); + case B2B_AND_PROFESSIONAL_MARKETPLACES: + return visitor.visitB2BAndProfessionalMarketplaces(); + case WELLNESS_AND_ALTERNATIVE: + return visitor.visitWellnessAndAlternative(); + case TRADING_AND_INVESTING_GROUPS: + return visitor.visitTradingAndInvestingGroups(); + case GAMING_AND_ENTERTAINMENT_SOFTWARE: + return visitor.visitGamingAndEntertainmentSoftware(); + case MEDIA_AND_PUBLISHING_COMPANIES: + return visitor.visitMediaAndPublishingCompanies(); + case TRADING_AND_INVESTING: + return visitor.visitTradingAndInvesting(); + case BEAUTY_AND_WELLNESS: + return visitor.visitBeautyAndWellness(); + case BUSINESS_AND_ENTREPRENEURSHIP: + return visitor.visitBusinessAndEntrepreneurship(); + case RECRUITING_AND_STAFFING: + return visitor.visitRecruitingAndStaffing(); + case AI_AND_AUTOMATION_AGENCIES: + return visitor.visitAiAndAutomationAgencies(); + case PRODUCTIVITY_AND_BUSINESS_OPS: + return visitor.visitProductivityAndBusinessOps(); + case AI_AND_AUTOMATION_SOFTWARE: + return visitor.visitAiAndAutomationSoftware(); + case LIFESTYLE_AND_CULTURE: + return visitor.visitLifestyleAndCulture(); + case CHARITY_AND_CAUSE_EVENTS: + return visitor.visitCharityAndCauseEvents(); + case SECURITY_AND_INVESTIGATIONS: + return visitor.visitSecurityAndInvestigations(); + case MUSIC_AND_PERFORMING_ARTS: + return visitor.visitMusicAndPerformingArts(); + case PROFESSIONAL_SERVICES: + return visitor.visitProfessionalServices(); + case SALES_AGENCIES: + return visitor.visitSalesAgencies(); + case SALES_AND_REVENUE: + return visitor.visitSalesAndRevenue(); + case CONFERENCE_AND_EXPO_EVENTS: + return visitor.visitConferenceAndExpoEvents(); + case ELECTRONICS_AND_GADGETS: + return visitor.visitElectronicsAndGadgets(); + case EDUCATIONAL_TRAINING_EVENTS: + return visitor.visitEducationalTrainingEvents(); + case PUBLISHING_AND_INFO_PRODUCTS: + return visitor.visitPublishingAndInfoProducts(); + case FITNESS_AND_ATHLETICS: + return visitor.visitFitnessAndAthletics(); + case DEVELOPMENT_AGENCIES: + return visitor.visitDevelopmentAgencies(); + case MISCELLANEOUS: + return visitor.visitMiscellaneous(); + case MENTAL_HEALTH_AND_BEHAVIORAL: + return visitor.visitMentalHealthAndBehavioral(); + case TECH_AND_DEVELOPMENT: + return visitor.visitTechAndDevelopment(); + case DEVELOPER_AND_TECHNICAL_TOOLS: + return visitor.visitDeveloperAndTechnicalTools(); + case LANGUAGE_AND_COMMUNICATION: + return visitor.visitLanguageAndCommunication(); + case HOME_SERVICES_GIGS: + return visitor.visitHomeServicesGigs(); + case CAREER_AND_PROFESSIONAL: + return visitor.visitCareerAndProfessional(); + case COMMUNITY_AND_EDUCATION_SOFTWARE: + return visitor.visitCommunityAndEducationSoftware(); + case ACCESSORIES: + return visitor.visitAccessories(); + case NONPROFIT_AND_CHARITY: + return visitor.visitNonprofitAndCharity(); + case INDUSTRY_SPECIFIC_SOFTWARE: + return visitor.visitIndustrySpecificSoftware(); + case CONSULTING: + return visitor.visitConsulting(); + case PERSONAL_FINANCE: + return visitor.visitPersonalFinance(); + case HOME_IMPROVEMENT_AND_TOOLS: + return visitor.visitHomeImprovementAndTools(); + case FITNESS_AND_HEALTH_GROUPS: + return visitor.visitFitnessAndHealthGroups(); + case INDUSTRIAL_AND_MANUFACTURING: + return visitor.visitIndustrialAndManufacturing(); + case WEIGHT_AND_METABOLIC_HEALTH: + return visitor.visitWeightAndMetabolicHealth(); + case MARKETING_AND_SALES_SOFTWARE: + return visitor.visitMarketingAndSalesSoftware(); + case TRANSPORTATION: + return visitor.visitTransportation(); + case WOMENS_AND_MENS_HEALTH: + return visitor.visitWomensAndMensHealth(); + case CLASS_ACTION_SETTLEMENT: + return visitor.visitClassActionSettlement(); + case PROFESSIONAL_GIGS: + return visitor.visitProfessionalGigs(); + case TECH_AND_DEV_GROUPS: + return visitor.visitTechAndDevGroups(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAccountsRequestIndustryGroup valueOf(String value) { + switch (value) { + case "dermatology_and_skin": + return DERMATOLOGY_AND_SKIN; + case "marketing_and_advertising": + return MARKETING_AND_ADVERTISING; + case "restaurants": + return RESTAURANTS; + case "creative_and_content_groups": + return CREATIVE_AND_CONTENT_GROUPS; + case "home_and_trade_storefronts": + return HOME_AND_TRADE_STOREFRONTS; + case "home_and_living": + return HOME_AND_LIVING; + case "religion_and_faith": + return RELIGION_AND_FAITH; + case "real_estate_software": + return REAL_ESTATE_SOFTWARE; + case "supplements_and_nutrition": + return SUPPLEMENTS_AND_NUTRITION; + case "video_games_and_esports": + return VIDEO_GAMES_AND_ESPORTS; + case "personal_development": + return PERSONAL_DEVELOPMENT; + case "healthcare": + return HEALTHCARE; + case "trading_and_finance_software": + return TRADING_AND_FINANCE_SOFTWARE; + case "social_and_networking_events": + return SOCIAL_AND_NETWORKING_EVENTS; + case "dental_and_vision": + return DENTAL_AND_VISION; + case "creative_gigs": + return CREATIVE_GIGS; + case "gaming_groups": + return GAMING_GROUPS; + case "sleep_and_chronic_conditions": + return SLEEP_AND_CHRONIC_CONDITIONS; + case "personal_services": + return PERSONAL_SERVICES; + case "service_marketplaces": + return SERVICE_MARKETPLACES; + case "arts_and_crafts": + return ARTS_AND_CRAFTS; + case "cafes_and_quick_service": + return CAFES_AND_QUICK_SERVICE; + case "government_and_public": + return GOVERNMENT_AND_PUBLIC; + case "outdoor_and_sports": + return OUTDOOR_AND_SPORTS; + case "sports_betting_groups": + return SPORTS_BETTING_GROUPS; + case "lifestyle_and_personal_growth": + return LIFESTYLE_AND_PERSONAL_GROWTH; + case "home_and_trade_services": + return HOME_AND_TRADE_SERVICES; + case "spirituality_and_personal_growth": + return SPIRITUALITY_AND_PERSONAL_GROWTH; + case "e_commerce_software": + return E_COMMERCE_SOFTWARE; + case "hospitality_and_lodging": + return HOSPITALITY_AND_LODGING; + case "performance_and_show_events": + return PERFORMANCE_AND_SHOW_EVENTS; + case "customer_support_agencies": + return CUSTOMER_SUPPORT_AGENCIES; + case "funeral_and_death_care": + return FUNERAL_AND_DEATH_CARE; + case "sustainability_and_eco_products": + return SUSTAINABILITY_AND_ECO_PRODUCTS; + case "marketing_agencies": + return MARKETING_AGENCIES; + case "lifestyle_and_wellness_events": + return LIFESTYLE_AND_WELLNESS_EVENTS; + case "specialized_gigs": + return SPECIALIZED_GIGS; + case "security_and_privacy_software": + return SECURITY_AND_PRIVACY_SOFTWARE; + case "genetic_and_specialized": + return GENETIC_AND_SPECIALIZED; + case "primary_and_general_care": + return PRIMARY_AND_GENERAL_CARE; + case "family_and_community_events": + return FAMILY_AND_COMMUNITY_EVENTS; + case "tech_and_ai": + return TECH_AND_AI; + case "sports_betting_and_gambling": + return SPORTS_BETTING_AND_GAMBLING; + case "bars_and_breweries": + return BARS_AND_BREWERIES; + case "digital_goods_and_accounts": + return DIGITAL_GOODS_AND_ACCOUNTS; + case "entertainment_and_leisure": + return ENTERTAINMENT_AND_LEISURE; + case "healthcare_and_wellness_software": + return HEALTHCARE_AND_WELLNESS_SOFTWARE; + case "education_and_childcare": + return EDUCATION_AND_CHILDCARE; + case "legal_and_compliance": + return LEGAL_AND_COMPLIANCE; + case "communication_and_messaging_software": + return COMMUNICATION_AND_MESSAGING_SOFTWARE; + case "sports_and_fitness_events": + return SPORTS_AND_FITNESS_EVENTS; + case "pet_services": + return PET_SERVICES; + case "design_and_creative_agencies": + return DESIGN_AND_CREATIVE_AGENCIES; + case "veterinary": + return VETERINARY; + case "automotive": + return AUTOMOTIVE; + case "health_and_wellness": + return HEALTH_AND_WELLNESS; + case "lifestyle_and_personal_growth_groups": + return LIFESTYLE_AND_PERSONAL_GROWTH_GROUPS; + case "spirituality_and_mindfulness": + return SPIRITUALITY_AND_MINDFULNESS; + case "content_and_clipping_agencies": + return CONTENT_AND_CLIPPING_AGENCIES; + case "baby_and_kids": + return BABY_AND_KIDS; + case "digital_and_education_marketplaces": + return DIGITAL_AND_EDUCATION_MARKETPLACES; + case "task_and_errands": + return TASK_AND_ERRANDS; + case "food_and_beverages": + return FOOD_AND_BEVERAGES; + case "fitness_equipment_and_gear": + return FITNESS_EQUIPMENT_AND_GEAR; + case "dating_and_relationships": + return DATING_AND_RELATIONSHIPS; + case "hobby_and_interest_groups": + return HOBBY_AND_INTEREST_GROUPS; + case "rehabilitation_and_therapy": + return REHABILITATION_AND_THERAPY; + case "logistics_and_transportation_services": + return LOGISTICS_AND_TRANSPORTATION_SERVICES; + case "retail": + return RETAIL; + case "business_and_money_groups": + return BUSINESS_AND_MONEY_GROUPS; + case "clothing_and_apparel": + return CLOTHING_AND_APPAREL; + case "creative_and_education": + return CREATIVE_AND_EDUCATION; + case "news_and_politics": + return NEWS_AND_POLITICS; + case "beauty_and_personal_care": + return BEAUTY_AND_PERSONAL_CARE; + case "delivery_and_logistics": + return DELIVERY_AND_LOGISTICS; + case "health_and_wellness_services": + return HEALTH_AND_WELLNESS_SERVICES; + case "hobbies_and_lifestyle": + return HOBBIES_AND_LIFESTYLE; + case "product_marketplaces": + return PRODUCT_MARKETPLACES; + case "pets_and_animals": + return PETS_AND_ANIMALS; + case "professional_services_storefront": + return PROFESSIONAL_SERVICES_STOREFRONT; + case "creative_and_content_creation": + return CREATIVE_AND_CONTENT_CREATION; + case "social_entertainment_events": + return SOCIAL_ENTERTAINMENT_EVENTS; + case "creative_services": + return CREATIVE_SERVICES; + case "real_estate": + return REAL_ESTATE; + case "fitness_and_recreation": + return FITNESS_AND_RECREATION; + case "food_and_hospitality_marketplaces": + return FOOD_AND_HOSPITALITY_MARKETPLACES; + case "rental_marketplaces": + return RENTAL_MARKETPLACES; + case "specialty_medical_care": + return SPECIALTY_MEDICAL_CARE; + case "finance_and_investing": + return FINANCE_AND_INVESTING; + case "agriculture_and_farming": + return AGRICULTURE_AND_FARMING; + case "academic_and_test_prep": + return ACADEMIC_AND_TEST_PREP; + case "office_and_business_supplies": + return OFFICE_AND_BUSINESS_SUPPLIES; + case "b2b_and_professional_marketplaces": + return B2B_AND_PROFESSIONAL_MARKETPLACES; + case "wellness_and_alternative": + return WELLNESS_AND_ALTERNATIVE; + case "trading_and_investing_groups": + return TRADING_AND_INVESTING_GROUPS; + case "gaming_and_entertainment_software": + return GAMING_AND_ENTERTAINMENT_SOFTWARE; + case "media_and_publishing_companies": + return MEDIA_AND_PUBLISHING_COMPANIES; + case "trading_and_investing": + return TRADING_AND_INVESTING; + case "beauty_and_wellness": + return BEAUTY_AND_WELLNESS; + case "business_and_entrepreneurship": + return BUSINESS_AND_ENTREPRENEURSHIP; + case "recruiting_and_staffing": + return RECRUITING_AND_STAFFING; + case "ai_and_automation_agencies": + return AI_AND_AUTOMATION_AGENCIES; + case "productivity_and_business_ops": + return PRODUCTIVITY_AND_BUSINESS_OPS; + case "ai_and_automation_software": + return AI_AND_AUTOMATION_SOFTWARE; + case "lifestyle_and_culture": + return LIFESTYLE_AND_CULTURE; + case "charity_and_cause_events": + return CHARITY_AND_CAUSE_EVENTS; + case "security_and_investigations": + return SECURITY_AND_INVESTIGATIONS; + case "music_and_performing_arts": + return MUSIC_AND_PERFORMING_ARTS; + case "professional_services": + return PROFESSIONAL_SERVICES; + case "sales_agencies": + return SALES_AGENCIES; + case "sales_and_revenue": + return SALES_AND_REVENUE; + case "conference_and_expo_events": + return CONFERENCE_AND_EXPO_EVENTS; + case "electronics_and_gadgets": + return ELECTRONICS_AND_GADGETS; + case "educational_training_events": + return EDUCATIONAL_TRAINING_EVENTS; + case "publishing_and_info_products": + return PUBLISHING_AND_INFO_PRODUCTS; + case "fitness_and_athletics": + return FITNESS_AND_ATHLETICS; + case "development_agencies": + return DEVELOPMENT_AGENCIES; + case "miscellaneous": + return MISCELLANEOUS; + case "mental_health_and_behavioral": + return MENTAL_HEALTH_AND_BEHAVIORAL; + case "tech_and_development": + return TECH_AND_DEVELOPMENT; + case "developer_and_technical_tools": + return DEVELOPER_AND_TECHNICAL_TOOLS; + case "language_and_communication": + return LANGUAGE_AND_COMMUNICATION; + case "home_services_gigs": + return HOME_SERVICES_GIGS; + case "career_and_professional": + return CAREER_AND_PROFESSIONAL; + case "community_and_education_software": + return COMMUNITY_AND_EDUCATION_SOFTWARE; + case "accessories": + return ACCESSORIES; + case "nonprofit_and_charity": + return NONPROFIT_AND_CHARITY; + case "industry_specific_software": + return INDUSTRY_SPECIFIC_SOFTWARE; + case "consulting": + return CONSULTING; + case "personal_finance": + return PERSONAL_FINANCE; + case "home_improvement_and_tools": + return HOME_IMPROVEMENT_AND_TOOLS; + case "fitness_and_health_groups": + return FITNESS_AND_HEALTH_GROUPS; + case "industrial_and_manufacturing": + return INDUSTRIAL_AND_MANUFACTURING; + case "weight_and_metabolic_health": + return WEIGHT_AND_METABOLIC_HEALTH; + case "marketing_and_sales_software": + return MARKETING_AND_SALES_SOFTWARE; + case "transportation": + return TRANSPORTATION; + case "womens_and_mens_health": + return WOMENS_AND_MENS_HEALTH; + case "class_action_settlement": + return CLASS_ACTION_SETTLEMENT; + case "professional_gigs": + return PROFESSIONAL_GIGS; + case "tech_and_dev_groups": + return TECH_AND_DEV_GROUPS; + default: + return new UpdateAccountsRequestIndustryGroup(Value.UNKNOWN, value); + } + } + + public enum Value { + ACADEMIC_AND_TEST_PREP, + + ACCESSORIES, + + AGRICULTURE_AND_FARMING, + + AI_AND_AUTOMATION_AGENCIES, + + AI_AND_AUTOMATION_SOFTWARE, + + ARTS_AND_CRAFTS, + + AUTOMOTIVE, + + B2B_AND_PROFESSIONAL_MARKETPLACES, + + BABY_AND_KIDS, + + BARS_AND_BREWERIES, + + BEAUTY_AND_PERSONAL_CARE, + + BEAUTY_AND_WELLNESS, + + BUSINESS_AND_ENTREPRENEURSHIP, + + BUSINESS_AND_MONEY_GROUPS, + + CAFES_AND_QUICK_SERVICE, + + CAREER_AND_PROFESSIONAL, + + CHARITY_AND_CAUSE_EVENTS, + + CLASS_ACTION_SETTLEMENT, + + CLOTHING_AND_APPAREL, + + COMMUNICATION_AND_MESSAGING_SOFTWARE, + + COMMUNITY_AND_EDUCATION_SOFTWARE, + + CONFERENCE_AND_EXPO_EVENTS, + + CONSULTING, + + CONTENT_AND_CLIPPING_AGENCIES, + + CREATIVE_AND_CONTENT_CREATION, + + CREATIVE_AND_CONTENT_GROUPS, + + CREATIVE_AND_EDUCATION, + + CREATIVE_GIGS, + + CREATIVE_SERVICES, + + CUSTOMER_SUPPORT_AGENCIES, + + DATING_AND_RELATIONSHIPS, + + DELIVERY_AND_LOGISTICS, + + DENTAL_AND_VISION, + + DERMATOLOGY_AND_SKIN, + + DESIGN_AND_CREATIVE_AGENCIES, + + DEVELOPER_AND_TECHNICAL_TOOLS, + + DEVELOPMENT_AGENCIES, + + DIGITAL_AND_EDUCATION_MARKETPLACES, + + DIGITAL_GOODS_AND_ACCOUNTS, + + E_COMMERCE_SOFTWARE, + + EDUCATION_AND_CHILDCARE, + + EDUCATIONAL_TRAINING_EVENTS, + + ELECTRONICS_AND_GADGETS, + + ENTERTAINMENT_AND_LEISURE, + + FAMILY_AND_COMMUNITY_EVENTS, + + FINANCE_AND_INVESTING, + + FITNESS_AND_ATHLETICS, + + FITNESS_AND_HEALTH_GROUPS, + + FITNESS_AND_RECREATION, + + FITNESS_EQUIPMENT_AND_GEAR, + + FOOD_AND_BEVERAGES, + + FOOD_AND_HOSPITALITY_MARKETPLACES, + + FUNERAL_AND_DEATH_CARE, + + GAMING_AND_ENTERTAINMENT_SOFTWARE, + + GAMING_GROUPS, + + GENETIC_AND_SPECIALIZED, + + GOVERNMENT_AND_PUBLIC, + + HEALTH_AND_WELLNESS, + + HEALTH_AND_WELLNESS_SERVICES, + + HEALTHCARE, + + HEALTHCARE_AND_WELLNESS_SOFTWARE, + + HOBBIES_AND_LIFESTYLE, + + HOBBY_AND_INTEREST_GROUPS, + + HOME_AND_LIVING, + + HOME_AND_TRADE_SERVICES, + + HOME_AND_TRADE_STOREFRONTS, + + HOME_IMPROVEMENT_AND_TOOLS, + + HOME_SERVICES_GIGS, + + HOSPITALITY_AND_LODGING, + + INDUSTRIAL_AND_MANUFACTURING, + + INDUSTRY_SPECIFIC_SOFTWARE, + + LANGUAGE_AND_COMMUNICATION, + + LEGAL_AND_COMPLIANCE, + + LIFESTYLE_AND_CULTURE, + + LIFESTYLE_AND_PERSONAL_GROWTH, + + LIFESTYLE_AND_PERSONAL_GROWTH_GROUPS, + + LIFESTYLE_AND_WELLNESS_EVENTS, + + LOGISTICS_AND_TRANSPORTATION_SERVICES, + + MARKETING_AGENCIES, + + MARKETING_AND_ADVERTISING, + + MARKETING_AND_SALES_SOFTWARE, + + MEDIA_AND_PUBLISHING_COMPANIES, + + MENTAL_HEALTH_AND_BEHAVIORAL, + + MISCELLANEOUS, + + MUSIC_AND_PERFORMING_ARTS, + + NEWS_AND_POLITICS, + + NONPROFIT_AND_CHARITY, + + OFFICE_AND_BUSINESS_SUPPLIES, + + OUTDOOR_AND_SPORTS, + + PERFORMANCE_AND_SHOW_EVENTS, + + PERSONAL_DEVELOPMENT, + + PERSONAL_FINANCE, + + PERSONAL_SERVICES, + + PET_SERVICES, + + PETS_AND_ANIMALS, + + PRIMARY_AND_GENERAL_CARE, + + PRODUCT_MARKETPLACES, + + PRODUCTIVITY_AND_BUSINESS_OPS, + + PROFESSIONAL_GIGS, + + PROFESSIONAL_SERVICES, + + PROFESSIONAL_SERVICES_STOREFRONT, + + PUBLISHING_AND_INFO_PRODUCTS, + + REAL_ESTATE, + + REAL_ESTATE_SOFTWARE, + + RECRUITING_AND_STAFFING, + + REHABILITATION_AND_THERAPY, + + RELIGION_AND_FAITH, + + RENTAL_MARKETPLACES, + + RESTAURANTS, + + RETAIL, + + SALES_AGENCIES, + + SALES_AND_REVENUE, + + SECURITY_AND_INVESTIGATIONS, + + SECURITY_AND_PRIVACY_SOFTWARE, + + SERVICE_MARKETPLACES, + + SLEEP_AND_CHRONIC_CONDITIONS, + + SOCIAL_AND_NETWORKING_EVENTS, + + SOCIAL_ENTERTAINMENT_EVENTS, + + SPECIALIZED_GIGS, + + SPECIALTY_MEDICAL_CARE, + + SPIRITUALITY_AND_MINDFULNESS, + + SPIRITUALITY_AND_PERSONAL_GROWTH, + + SPORTS_AND_FITNESS_EVENTS, + + SPORTS_BETTING_AND_GAMBLING, + + SPORTS_BETTING_GROUPS, + + SUPPLEMENTS_AND_NUTRITION, + + SUSTAINABILITY_AND_ECO_PRODUCTS, + + TASK_AND_ERRANDS, + + TECH_AND_AI, + + TECH_AND_DEV_GROUPS, + + TECH_AND_DEVELOPMENT, + + TRADING_AND_FINANCE_SOFTWARE, + + TRADING_AND_INVESTING, + + TRADING_AND_INVESTING_GROUPS, + + TRANSPORTATION, + + VETERINARY, + + VIDEO_GAMES_AND_ESPORTS, + + WEIGHT_AND_METABOLIC_HEALTH, + + WELLNESS_AND_ALTERNATIVE, + + WOMENS_AND_MENS_HEALTH, + + UNKNOWN + } + + public interface Visitor { + T visitAcademicAndTestPrep(); + + T visitAccessories(); + + T visitAgricultureAndFarming(); + + T visitAiAndAutomationAgencies(); + + T visitAiAndAutomationSoftware(); + + T visitArtsAndCrafts(); + + T visitAutomotive(); + + T visitB2BAndProfessionalMarketplaces(); + + T visitBabyAndKids(); + + T visitBarsAndBreweries(); + + T visitBeautyAndPersonalCare(); + + T visitBeautyAndWellness(); + + T visitBusinessAndEntrepreneurship(); + + T visitBusinessAndMoneyGroups(); + + T visitCafesAndQuickService(); + + T visitCareerAndProfessional(); + + T visitCharityAndCauseEvents(); + + T visitClassActionSettlement(); + + T visitClothingAndApparel(); + + T visitCommunicationAndMessagingSoftware(); + + T visitCommunityAndEducationSoftware(); + + T visitConferenceAndExpoEvents(); + + T visitConsulting(); + + T visitContentAndClippingAgencies(); + + T visitCreativeAndContentCreation(); + + T visitCreativeAndContentGroups(); + + T visitCreativeAndEducation(); + + T visitCreativeGigs(); + + T visitCreativeServices(); + + T visitCustomerSupportAgencies(); + + T visitDatingAndRelationships(); + + T visitDeliveryAndLogistics(); + + T visitDentalAndVision(); + + T visitDermatologyAndSkin(); + + T visitDesignAndCreativeAgencies(); + + T visitDeveloperAndTechnicalTools(); + + T visitDevelopmentAgencies(); + + T visitDigitalAndEducationMarketplaces(); + + T visitDigitalGoodsAndAccounts(); + + T visitECommerceSoftware(); + + T visitEducationAndChildcare(); + + T visitEducationalTrainingEvents(); + + T visitElectronicsAndGadgets(); + + T visitEntertainmentAndLeisure(); + + T visitFamilyAndCommunityEvents(); + + T visitFinanceAndInvesting(); + + T visitFitnessAndAthletics(); + + T visitFitnessAndHealthGroups(); + + T visitFitnessAndRecreation(); + + T visitFitnessEquipmentAndGear(); + + T visitFoodAndBeverages(); + + T visitFoodAndHospitalityMarketplaces(); + + T visitFuneralAndDeathCare(); + + T visitGamingAndEntertainmentSoftware(); + + T visitGamingGroups(); + + T visitGeneticAndSpecialized(); + + T visitGovernmentAndPublic(); + + T visitHealthAndWellness(); + + T visitHealthAndWellnessServices(); + + T visitHealthcare(); + + T visitHealthcareAndWellnessSoftware(); + + T visitHobbiesAndLifestyle(); + + T visitHobbyAndInterestGroups(); + + T visitHomeAndLiving(); + + T visitHomeAndTradeServices(); + + T visitHomeAndTradeStorefronts(); + + T visitHomeImprovementAndTools(); + + T visitHomeServicesGigs(); + + T visitHospitalityAndLodging(); + + T visitIndustrialAndManufacturing(); + + T visitIndustrySpecificSoftware(); + + T visitLanguageAndCommunication(); + + T visitLegalAndCompliance(); + + T visitLifestyleAndCulture(); + + T visitLifestyleAndPersonalGrowth(); + + T visitLifestyleAndPersonalGrowthGroups(); + + T visitLifestyleAndWellnessEvents(); + + T visitLogisticsAndTransportationServices(); + + T visitMarketingAgencies(); + + T visitMarketingAndAdvertising(); + + T visitMarketingAndSalesSoftware(); + + T visitMediaAndPublishingCompanies(); + + T visitMentalHealthAndBehavioral(); + + T visitMiscellaneous(); + + T visitMusicAndPerformingArts(); + + T visitNewsAndPolitics(); + + T visitNonprofitAndCharity(); + + T visitOfficeAndBusinessSupplies(); + + T visitOutdoorAndSports(); + + T visitPerformanceAndShowEvents(); + + T visitPersonalDevelopment(); + + T visitPersonalFinance(); + + T visitPersonalServices(); + + T visitPetServices(); + + T visitPetsAndAnimals(); + + T visitPrimaryAndGeneralCare(); + + T visitProductMarketplaces(); + + T visitProductivityAndBusinessOps(); + + T visitProfessionalGigs(); + + T visitProfessionalServices(); + + T visitProfessionalServicesStorefront(); + + T visitPublishingAndInfoProducts(); + + T visitRealEstate(); + + T visitRealEstateSoftware(); + + T visitRecruitingAndStaffing(); + + T visitRehabilitationAndTherapy(); + + T visitReligionAndFaith(); + + T visitRentalMarketplaces(); + + T visitRestaurants(); + + T visitRetail(); + + T visitSalesAgencies(); + + T visitSalesAndRevenue(); + + T visitSecurityAndInvestigations(); + + T visitSecurityAndPrivacySoftware(); + + T visitServiceMarketplaces(); + + T visitSleepAndChronicConditions(); + + T visitSocialAndNetworkingEvents(); + + T visitSocialEntertainmentEvents(); + + T visitSpecializedGigs(); + + T visitSpecialtyMedicalCare(); + + T visitSpiritualityAndMindfulness(); + + T visitSpiritualityAndPersonalGrowth(); + + T visitSportsAndFitnessEvents(); + + T visitSportsBettingAndGambling(); + + T visitSportsBettingGroups(); + + T visitSupplementsAndNutrition(); + + T visitSustainabilityAndEcoProducts(); + + T visitTaskAndErrands(); + + T visitTechAndAi(); + + T visitTechAndDevGroups(); + + T visitTechAndDevelopment(); + + T visitTradingAndFinanceSoftware(); + + T visitTradingAndInvesting(); + + T visitTradingAndInvestingGroups(); + + T visitTransportation(); + + T visitVeterinary(); + + T visitVideoGamesAndEsports(); + + T visitWeightAndMetabolicHealth(); + + T visitWellnessAndAlternative(); + + T visitWomensAndMensHealth(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestLogo.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestLogo.java new file mode 100644 index 00000000..b70254a7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestLogo.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAccountsRequestLogo.Builder.class) +public final class UpdateAccountsRequestLogo { + private final Optional id; + + private final Map additionalProperties; + + private UpdateAccountsRequestLogo(Optional id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of a file from Create File, prefixed file_. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAccountsRequestLogo && equalTo((UpdateAccountsRequestLogo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAccountsRequestLogo other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAccountsRequestLogo other) { + id(other.getId()); + return this; + } + + /** + *

ID of a file from Create File, prefixed file_.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdateAccountsRequestLogo build() { + return new UpdateAccountsRequestLogo(id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestOnboardingType.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestOnboardingType.java new file mode 100644 index 00000000..8eb39076 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestOnboardingType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAccountsRequestOnboardingType { + public static final UpdateAccountsRequestOnboardingType SELLER = + new UpdateAccountsRequestOnboardingType(Value.SELLER, "seller"); + + public static final UpdateAccountsRequestOnboardingType PLATFORM = + new UpdateAccountsRequestOnboardingType(Value.PLATFORM, "platform"); + + private final Value value; + + private final String string; + + UpdateAccountsRequestOnboardingType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAccountsRequestOnboardingType + && this.string.equals(((UpdateAccountsRequestOnboardingType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELLER: + return visitor.visitSeller(); + case PLATFORM: + return visitor.visitPlatform(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAccountsRequestOnboardingType valueOf(String value) { + switch (value) { + case "seller": + return SELLER; + case "platform": + return PLATFORM; + default: + return new UpdateAccountsRequestOnboardingType(Value.UNKNOWN, value); + } + } + + public enum Value { + PLATFORM, + + SELLER, + + UNKNOWN + } + + public interface Visitor { + T visitPlatform(); + + T visitSeller(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestOpengraphImage.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestOpengraphImage.java new file mode 100644 index 00000000..22994a89 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestOpengraphImage.java @@ -0,0 +1,112 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAccountsRequestOpengraphImage.Builder.class) +public final class UpdateAccountsRequestOpengraphImage { + private final Optional id; + + private final Map additionalProperties; + + private UpdateAccountsRequestOpengraphImage(Optional id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of a file from Create File, prefixed file_. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAccountsRequestOpengraphImage + && equalTo((UpdateAccountsRequestOpengraphImage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAccountsRequestOpengraphImage other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAccountsRequestOpengraphImage other) { + id(other.getId()); + return this; + } + + /** + *

ID of a file from Create File, prefixed file_.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdateAccountsRequestOpengraphImage build() { + return new UpdateAccountsRequestOpengraphImage(id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestOpengraphImageVariant.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestOpengraphImageVariant.java new file mode 100644 index 00000000..d6b7951d --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestOpengraphImageVariant.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAccountsRequestOpengraphImageVariant { + public static final UpdateAccountsRequestOpengraphImageVariant BLACK = + new UpdateAccountsRequestOpengraphImageVariant(Value.BLACK, "black"); + + public static final UpdateAccountsRequestOpengraphImageVariant WHITE = + new UpdateAccountsRequestOpengraphImageVariant(Value.WHITE, "white"); + + public static final UpdateAccountsRequestOpengraphImageVariant ORANGE = + new UpdateAccountsRequestOpengraphImageVariant(Value.ORANGE, "orange"); + + private final Value value; + + private final String string; + + UpdateAccountsRequestOpengraphImageVariant(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAccountsRequestOpengraphImageVariant + && this.string.equals(((UpdateAccountsRequestOpengraphImageVariant) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case BLACK: + return visitor.visitBlack(); + case WHITE: + return visitor.visitWhite(); + case ORANGE: + return visitor.visitOrange(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAccountsRequestOpengraphImageVariant valueOf(String value) { + switch (value) { + case "black": + return BLACK; + case "white": + return WHITE; + case "orange": + return ORANGE; + default: + return new UpdateAccountsRequestOpengraphImageVariant(Value.UNKNOWN, value); + } + } + + public enum Value { + WHITE, + + BLACK, + + ORANGE, + + UNKNOWN + } + + public interface Visitor { + T visitWhite(); + + T visitBlack(); + + T visitOrange(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestStorePageConfig.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestStorePageConfig.java new file mode 100644 index 00000000..1ff4a7a2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestStorePageConfig.java @@ -0,0 +1,268 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAccountsRequestStorePageConfig.Builder.class) +public final class UpdateAccountsRequestStorePageConfig { + private final Optional accentColor; + + private final Optional layout; + + private final Optional profileVariant; + + private final Optional whopAffiliateLink; + + private final Map additionalProperties; + + private UpdateAccountsRequestStorePageConfig( + Optional accentColor, + Optional layout, + Optional profileVariant, + Optional whopAffiliateLink, + Map additionalProperties) { + this.accentColor = accentColor; + this.layout = layout; + this.profileVariant = profileVariant; + this.whopAffiliateLink = whopAffiliateLink; + this.additionalProperties = additionalProperties; + } + + /** + * @return Accent color used on the account store page. + */ + @JsonIgnore + public Optional getAccentColor() { + if (accentColor == null) { + return Optional.empty(); + } + return accentColor; + } + + /** + * @return Layout used on the account store page. + */ + @JsonIgnore + public Optional getLayout() { + if (layout == null) { + return Optional.empty(); + } + return layout; + } + + /** + * @return Profile presentation used on the account store page. + */ + @JsonIgnore + public Optional getProfileVariant() { + if (profileVariant == null) { + return Optional.empty(); + } + return profileVariant; + } + + /** + * @return Whether the account store page shows a Whop affiliate link. + */ + @JsonProperty("whop_affiliate_link") + public Optional getWhopAffiliateLink() { + return whopAffiliateLink; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("accent_color") + private Optional _getAccentColor() { + return accentColor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("layout") + private Optional _getLayout() { + return layout; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("profile_variant") + private Optional _getProfileVariant() { + return profileVariant; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAccountsRequestStorePageConfig + && equalTo((UpdateAccountsRequestStorePageConfig) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAccountsRequestStorePageConfig other) { + return accentColor.equals(other.accentColor) + && layout.equals(other.layout) + && profileVariant.equals(other.profileVariant) + && whopAffiliateLink.equals(other.whopAffiliateLink); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accentColor, this.layout, this.profileVariant, this.whopAffiliateLink); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accentColor = Optional.empty(); + + private Optional layout = Optional.empty(); + + private Optional profileVariant = Optional.empty(); + + private Optional whopAffiliateLink = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAccountsRequestStorePageConfig other) { + accentColor(other.getAccentColor()); + layout(other.getLayout()); + profileVariant(other.getProfileVariant()); + whopAffiliateLink(other.getWhopAffiliateLink()); + return this; + } + + /** + *

Accent color used on the account store page.

+ */ + @JsonSetter(value = "accent_color", nulls = Nulls.SKIP) + public Builder accentColor(Optional accentColor) { + this.accentColor = accentColor; + return this; + } + + public Builder accentColor(UpdateAccountsRequestStorePageConfigAccentColor accentColor) { + this.accentColor = Optional.ofNullable(accentColor); + return this; + } + + public Builder accentColor(Nullable accentColor) { + if (accentColor.isNull()) { + this.accentColor = null; + } else if (accentColor.isEmpty()) { + this.accentColor = Optional.empty(); + } else { + this.accentColor = Optional.of(accentColor.get()); + } + return this; + } + + /** + *

Layout used on the account store page.

+ */ + @JsonSetter(value = "layout", nulls = Nulls.SKIP) + public Builder layout(Optional layout) { + this.layout = layout; + return this; + } + + public Builder layout(UpdateAccountsRequestStorePageConfigLayout layout) { + this.layout = Optional.ofNullable(layout); + return this; + } + + public Builder layout(Nullable layout) { + if (layout.isNull()) { + this.layout = null; + } else if (layout.isEmpty()) { + this.layout = Optional.empty(); + } else { + this.layout = Optional.of(layout.get()); + } + return this; + } + + /** + *

Profile presentation used on the account store page.

+ */ + @JsonSetter(value = "profile_variant", nulls = Nulls.SKIP) + public Builder profileVariant(Optional profileVariant) { + this.profileVariant = profileVariant; + return this; + } + + public Builder profileVariant(UpdateAccountsRequestStorePageConfigProfileVariant profileVariant) { + this.profileVariant = Optional.ofNullable(profileVariant); + return this; + } + + public Builder profileVariant(Nullable profileVariant) { + if (profileVariant.isNull()) { + this.profileVariant = null; + } else if (profileVariant.isEmpty()) { + this.profileVariant = Optional.empty(); + } else { + this.profileVariant = Optional.of(profileVariant.get()); + } + return this; + } + + /** + *

Whether the account store page shows a Whop affiliate link.

+ */ + @JsonSetter(value = "whop_affiliate_link", nulls = Nulls.SKIP) + public Builder whopAffiliateLink(Optional whopAffiliateLink) { + this.whopAffiliateLink = whopAffiliateLink; + return this; + } + + public Builder whopAffiliateLink(Boolean whopAffiliateLink) { + this.whopAffiliateLink = Optional.ofNullable(whopAffiliateLink); + return this; + } + + public UpdateAccountsRequestStorePageConfig build() { + return new UpdateAccountsRequestStorePageConfig( + accentColor, layout, profileVariant, whopAffiliateLink, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestStorePageConfigAccentColor.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestStorePageConfigAccentColor.java new file mode 100644 index 00000000..49a1ccf1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestStorePageConfigAccentColor.java @@ -0,0 +1,372 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAccountsRequestStorePageConfigAccentColor { + public static final UpdateAccountsRequestStorePageConfigAccentColor PLUM = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.PLUM, "plum"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor BRONZE = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.BRONZE, "bronze"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor GOLD = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.GOLD, "gold"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor YELLOW = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.YELLOW, "yellow"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor IRIS = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.IRIS, "iris"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor JADE = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.JADE, "jade"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor MINT = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.MINT, "mint"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor LIME = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.LIME, "lime"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor SKY = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.SKY, "sky"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor GRAY = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.GRAY, "gray"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor MAGENTA = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.MAGENTA, "magenta"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor CYAN = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.CYAN, "cyan"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor BROWN = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.BROWN, "brown"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor BLUE = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.BLUE, "blue"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor VIOLET = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.VIOLET, "violet"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor GRASS = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.GRASS, "grass"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor GREEN = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.GREEN, "green"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor PINK = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.PINK, "pink"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor ORANGE = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.ORANGE, "orange"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor TEAL = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.TEAL, "teal"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor CRIMSON = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.CRIMSON, "crimson"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor INDIGO = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.INDIGO, "indigo"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor RUBY = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.RUBY, "ruby"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor RED = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.RED, "red"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor AMBER = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.AMBER, "amber"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor PURPLE = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.PURPLE, "purple"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor LEMON = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.LEMON, "lemon"); + + public static final UpdateAccountsRequestStorePageConfigAccentColor TOMATO = + new UpdateAccountsRequestStorePageConfigAccentColor(Value.TOMATO, "tomato"); + + private final Value value; + + private final String string; + + UpdateAccountsRequestStorePageConfigAccentColor(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAccountsRequestStorePageConfigAccentColor + && this.string.equals(((UpdateAccountsRequestStorePageConfigAccentColor) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PLUM: + return visitor.visitPlum(); + case BRONZE: + return visitor.visitBronze(); + case GOLD: + return visitor.visitGold(); + case YELLOW: + return visitor.visitYellow(); + case IRIS: + return visitor.visitIris(); + case JADE: + return visitor.visitJade(); + case MINT: + return visitor.visitMint(); + case LIME: + return visitor.visitLime(); + case SKY: + return visitor.visitSky(); + case GRAY: + return visitor.visitGray(); + case MAGENTA: + return visitor.visitMagenta(); + case CYAN: + return visitor.visitCyan(); + case BROWN: + return visitor.visitBrown(); + case BLUE: + return visitor.visitBlue(); + case VIOLET: + return visitor.visitViolet(); + case GRASS: + return visitor.visitGrass(); + case GREEN: + return visitor.visitGreen(); + case PINK: + return visitor.visitPink(); + case ORANGE: + return visitor.visitOrange(); + case TEAL: + return visitor.visitTeal(); + case CRIMSON: + return visitor.visitCrimson(); + case INDIGO: + return visitor.visitIndigo(); + case RUBY: + return visitor.visitRuby(); + case RED: + return visitor.visitRed(); + case AMBER: + return visitor.visitAmber(); + case PURPLE: + return visitor.visitPurple(); + case LEMON: + return visitor.visitLemon(); + case TOMATO: + return visitor.visitTomato(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAccountsRequestStorePageConfigAccentColor valueOf(String value) { + switch (value) { + case "plum": + return PLUM; + case "bronze": + return BRONZE; + case "gold": + return GOLD; + case "yellow": + return YELLOW; + case "iris": + return IRIS; + case "jade": + return JADE; + case "mint": + return MINT; + case "lime": + return LIME; + case "sky": + return SKY; + case "gray": + return GRAY; + case "magenta": + return MAGENTA; + case "cyan": + return CYAN; + case "brown": + return BROWN; + case "blue": + return BLUE; + case "violet": + return VIOLET; + case "grass": + return GRASS; + case "green": + return GREEN; + case "pink": + return PINK; + case "orange": + return ORANGE; + case "teal": + return TEAL; + case "crimson": + return CRIMSON; + case "indigo": + return INDIGO; + case "ruby": + return RUBY; + case "red": + return RED; + case "amber": + return AMBER; + case "purple": + return PURPLE; + case "lemon": + return LEMON; + case "tomato": + return TOMATO; + default: + return new UpdateAccountsRequestStorePageConfigAccentColor(Value.UNKNOWN, value); + } + } + + public enum Value { + RUBY, + + TOMATO, + + RED, + + CRIMSON, + + PINK, + + PLUM, + + PURPLE, + + VIOLET, + + IRIS, + + CYAN, + + TEAL, + + JADE, + + GREEN, + + GRASS, + + BROWN, + + BLUE, + + ORANGE, + + INDIGO, + + SKY, + + MINT, + + YELLOW, + + AMBER, + + LIME, + + LEMON, + + MAGENTA, + + GOLD, + + BRONZE, + + GRAY, + + UNKNOWN + } + + public interface Visitor { + T visitRuby(); + + T visitTomato(); + + T visitRed(); + + T visitCrimson(); + + T visitPink(); + + T visitPlum(); + + T visitPurple(); + + T visitViolet(); + + T visitIris(); + + T visitCyan(); + + T visitTeal(); + + T visitJade(); + + T visitGreen(); + + T visitGrass(); + + T visitBrown(); + + T visitBlue(); + + T visitOrange(); + + T visitIndigo(); + + T visitSky(); + + T visitMint(); + + T visitYellow(); + + T visitAmber(); + + T visitLime(); + + T visitLemon(); + + T visitMagenta(); + + T visitGold(); + + T visitBronze(); + + T visitGray(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestStorePageConfigLayout.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestStorePageConfigLayout.java new file mode 100644 index 00000000..d979e3f7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestStorePageConfigLayout.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAccountsRequestStorePageConfigLayout { + public static final UpdateAccountsRequestStorePageConfigLayout FEATURED = + new UpdateAccountsRequestStorePageConfigLayout(Value.FEATURED, "featured"); + + public static final UpdateAccountsRequestStorePageConfigLayout COMPACT = + new UpdateAccountsRequestStorePageConfigLayout(Value.COMPACT, "compact"); + + private final Value value; + + private final String string; + + UpdateAccountsRequestStorePageConfigLayout(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAccountsRequestStorePageConfigLayout + && this.string.equals(((UpdateAccountsRequestStorePageConfigLayout) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FEATURED: + return visitor.visitFeatured(); + case COMPACT: + return visitor.visitCompact(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAccountsRequestStorePageConfigLayout valueOf(String value) { + switch (value) { + case "featured": + return FEATURED; + case "compact": + return COMPACT; + default: + return new UpdateAccountsRequestStorePageConfigLayout(Value.UNKNOWN, value); + } + } + + public enum Value { + FEATURED, + + COMPACT, + + UNKNOWN + } + + public interface Visitor { + T visitFeatured(); + + T visitCompact(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestStorePageConfigProfileVariant.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestStorePageConfigProfileVariant.java new file mode 100644 index 00000000..85edede3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestStorePageConfigProfileVariant.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAccountsRequestStorePageConfigProfileVariant { + public static final UpdateAccountsRequestStorePageConfigProfileVariant PERSONAL = + new UpdateAccountsRequestStorePageConfigProfileVariant(Value.PERSONAL, "personal"); + + public static final UpdateAccountsRequestStorePageConfigProfileVariant BUSINESS = + new UpdateAccountsRequestStorePageConfigProfileVariant(Value.BUSINESS, "business"); + + private final Value value; + + private final String string; + + UpdateAccountsRequestStorePageConfigProfileVariant(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAccountsRequestStorePageConfigProfileVariant + && this.string.equals(((UpdateAccountsRequestStorePageConfigProfileVariant) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PERSONAL: + return visitor.visitPersonal(); + case BUSINESS: + return visitor.visitBusiness(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAccountsRequestStorePageConfigProfileVariant valueOf(String value) { + switch (value) { + case "personal": + return PERSONAL; + case "business": + return BUSINESS; + default: + return new UpdateAccountsRequestStorePageConfigProfileVariant(Value.UNKNOWN, value); + } + } + + public enum Value { + PERSONAL, + + BUSINESS, + + UNKNOWN + } + + public interface Visitor { + T visitPersonal(); + + T visitBusiness(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestTaxCollectionEnabledStatesItem.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestTaxCollectionEnabledStatesItem.java new file mode 100644 index 00000000..9436bcc0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestTaxCollectionEnabledStatesItem.java @@ -0,0 +1,625 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAccountsRequestTaxCollectionEnabledStatesItem { + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem NM = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.NM, "NM"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem WA = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.WA, "WA"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem MA = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.MA, "MA"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem UT = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.UT, "UT"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem KS = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.KS, "KS"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem CA = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.CA, "CA"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem AR = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.AR, "AR"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem MD = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.MD, "MD"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem ME = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.ME, "ME"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem PA = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.PA, "PA"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem NV = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.NV, "NV"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem TN = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.TN, "TN"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem KY = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.KY, "KY"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem WI = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.WI, "WI"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem MI = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.MI, "MI"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem SC = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.SC, "SC"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem IA = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.IA, "IA"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem NC = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.NC, "NC"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem NE = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.NE, "NE"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem DC = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.DC, "DC"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem OR = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.OR, "OR"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem MO = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.MO, "MO"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem DE = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.DE, "DE"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem CO = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.CO, "CO"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem AL = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.AL, "AL"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem FL = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.FL, "FL"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem MS = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.MS, "MS"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem TX = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.TX, "TX"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem CT = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.CT, "CT"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem IL = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.IL, "IL"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem IN = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.IN, "IN"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem WY = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.WY, "WY"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem OH = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.OH, "OH"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem OK = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.OK, "OK"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem RI = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.RI, "RI"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem HI = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.HI, "HI"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem VT = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.VT, "VT"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem AZ = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.AZ, "AZ"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem SD = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.SD, "SD"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem NY = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.NY, "NY"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem ID = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.ID, "ID"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem MN = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.MN, "MN"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem ND = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.ND, "ND"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem VA = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.VA, "VA"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem GA = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.GA, "GA"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem LA = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.LA, "LA"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem NH = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.NH, "NH"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem AK = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.AK, "AK"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem NJ = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.NJ, "NJ"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem WV = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.WV, "WV"); + + public static final UpdateAccountsRequestTaxCollectionEnabledStatesItem MT = + new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.MT, "MT"); + + private final Value value; + + private final String string; + + UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAccountsRequestTaxCollectionEnabledStatesItem + && this.string.equals(((UpdateAccountsRequestTaxCollectionEnabledStatesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NM: + return visitor.visitNm(); + case WA: + return visitor.visitWa(); + case MA: + return visitor.visitMa(); + case UT: + return visitor.visitUt(); + case KS: + return visitor.visitKs(); + case CA: + return visitor.visitCa(); + case AR: + return visitor.visitAr(); + case MD: + return visitor.visitMd(); + case ME: + return visitor.visitMe(); + case PA: + return visitor.visitPa(); + case NV: + return visitor.visitNv(); + case TN: + return visitor.visitTn(); + case KY: + return visitor.visitKy(); + case WI: + return visitor.visitWi(); + case MI: + return visitor.visitMi(); + case SC: + return visitor.visitSc(); + case IA: + return visitor.visitIa(); + case NC: + return visitor.visitNc(); + case NE: + return visitor.visitNe(); + case DC: + return visitor.visitDc(); + case OR: + return visitor.visitOr(); + case MO: + return visitor.visitMo(); + case DE: + return visitor.visitDe(); + case CO: + return visitor.visitCo(); + case AL: + return visitor.visitAl(); + case FL: + return visitor.visitFl(); + case MS: + return visitor.visitMs(); + case TX: + return visitor.visitTx(); + case CT: + return visitor.visitCt(); + case IL: + return visitor.visitIl(); + case IN: + return visitor.visitIn(); + case WY: + return visitor.visitWy(); + case OH: + return visitor.visitOh(); + case OK: + return visitor.visitOk(); + case RI: + return visitor.visitRi(); + case HI: + return visitor.visitHi(); + case VT: + return visitor.visitVt(); + case AZ: + return visitor.visitAz(); + case SD: + return visitor.visitSd(); + case NY: + return visitor.visitNy(); + case ID: + return visitor.visitId(); + case MN: + return visitor.visitMn(); + case ND: + return visitor.visitNd(); + case VA: + return visitor.visitVa(); + case GA: + return visitor.visitGa(); + case LA: + return visitor.visitLa(); + case NH: + return visitor.visitNh(); + case AK: + return visitor.visitAk(); + case NJ: + return visitor.visitNj(); + case WV: + return visitor.visitWv(); + case MT: + return visitor.visitMt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAccountsRequestTaxCollectionEnabledStatesItem valueOf(String value) { + switch (value) { + case "NM": + return NM; + case "WA": + return WA; + case "MA": + return MA; + case "UT": + return UT; + case "KS": + return KS; + case "CA": + return CA; + case "AR": + return AR; + case "MD": + return MD; + case "ME": + return ME; + case "PA": + return PA; + case "NV": + return NV; + case "TN": + return TN; + case "KY": + return KY; + case "WI": + return WI; + case "MI": + return MI; + case "SC": + return SC; + case "IA": + return IA; + case "NC": + return NC; + case "NE": + return NE; + case "DC": + return DC; + case "OR": + return OR; + case "MO": + return MO; + case "DE": + return DE; + case "CO": + return CO; + case "AL": + return AL; + case "FL": + return FL; + case "MS": + return MS; + case "TX": + return TX; + case "CT": + return CT; + case "IL": + return IL; + case "IN": + return IN; + case "WY": + return WY; + case "OH": + return OH; + case "OK": + return OK; + case "RI": + return RI; + case "HI": + return HI; + case "VT": + return VT; + case "AZ": + return AZ; + case "SD": + return SD; + case "NY": + return NY; + case "ID": + return ID; + case "MN": + return MN; + case "ND": + return ND; + case "VA": + return VA; + case "GA": + return GA; + case "LA": + return LA; + case "NH": + return NH; + case "AK": + return AK; + case "NJ": + return NJ; + case "WV": + return WV; + case "MT": + return MT; + default: + return new UpdateAccountsRequestTaxCollectionEnabledStatesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + AL, + + AK, + + AZ, + + AR, + + CA, + + CO, + + CT, + + DE, + + DC, + + FL, + + GA, + + HI, + + ID, + + IL, + + IN, + + IA, + + KS, + + KY, + + LA, + + ME, + + MD, + + MA, + + MI, + + MN, + + MS, + + MO, + + MT, + + NE, + + NV, + + NH, + + NJ, + + NM, + + NY, + + NC, + + ND, + + OH, + + OK, + + OR, + + PA, + + RI, + + SC, + + SD, + + TN, + + TX, + + UT, + + VT, + + VA, + + WA, + + WV, + + WI, + + WY, + + UNKNOWN + } + + public interface Visitor { + T visitAl(); + + T visitAk(); + + T visitAz(); + + T visitAr(); + + T visitCa(); + + T visitCo(); + + T visitCt(); + + T visitDe(); + + T visitDc(); + + T visitFl(); + + T visitGa(); + + T visitHi(); + + T visitId(); + + T visitIl(); + + T visitIn(); + + T visitIa(); + + T visitKs(); + + T visitKy(); + + T visitLa(); + + T visitMe(); + + T visitMd(); + + T visitMa(); + + T visitMi(); + + T visitMn(); + + T visitMs(); + + T visitMo(); + + T visitMt(); + + T visitNe(); + + T visitNv(); + + T visitNh(); + + T visitNj(); + + T visitNm(); + + T visitNy(); + + T visitNc(); + + T visitNd(); + + T visitOh(); + + T visitOk(); + + T visitOr(); + + T visitPa(); + + T visitRi(); + + T visitSc(); + + T visitSd(); + + T visitTn(); + + T visitTx(); + + T visitUt(); + + T visitVt(); + + T visitVa(); + + T visitWa(); + + T visitWv(); + + T visitWi(); + + T visitWy(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestTaxIdentifiersItem.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestTaxIdentifiersItem.java new file mode 100644 index 00000000..f9bd8d51 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestTaxIdentifiersItem.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAccountsRequestTaxIdentifiersItem.Builder.class) +public final class UpdateAccountsRequestTaxIdentifiersItem { + private final UpdateAccountsRequestTaxIdentifiersItemTaxIdType taxIdType; + + private final String taxIdValue; + + private final Map additionalProperties; + + private UpdateAccountsRequestTaxIdentifiersItem( + UpdateAccountsRequestTaxIdentifiersItemTaxIdType taxIdType, + String taxIdValue, + Map additionalProperties) { + this.taxIdType = taxIdType; + this.taxIdValue = taxIdValue; + this.additionalProperties = additionalProperties; + } + + /** + * @return Tax ID type, for example eu_vat, gb_vat, or us_ein. + */ + @JsonProperty("tax_id_type") + public UpdateAccountsRequestTaxIdentifiersItemTaxIdType getTaxIdType() { + return taxIdType; + } + + /** + * @return Tax ID value, for example DE123456789. + */ + @JsonProperty("tax_id_value") + public String getTaxIdValue() { + return taxIdValue; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAccountsRequestTaxIdentifiersItem + && equalTo((UpdateAccountsRequestTaxIdentifiersItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAccountsRequestTaxIdentifiersItem other) { + return taxIdType.equals(other.taxIdType) && taxIdValue.equals(other.taxIdValue); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.taxIdType, this.taxIdValue); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TaxIdTypeStage builder() { + return new Builder(); + } + + public interface TaxIdTypeStage { + /** + *

Tax ID type, for example eu_vat, gb_vat, or us_ein.

+ */ + TaxIdValueStage taxIdType(@NotNull UpdateAccountsRequestTaxIdentifiersItemTaxIdType taxIdType); + + Builder from(UpdateAccountsRequestTaxIdentifiersItem other); + } + + public interface TaxIdValueStage { + /** + *

Tax ID value, for example DE123456789.

+ */ + _FinalStage taxIdValue(@NotNull String taxIdValue); + } + + public interface _FinalStage { + UpdateAccountsRequestTaxIdentifiersItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TaxIdTypeStage, TaxIdValueStage, _FinalStage { + private UpdateAccountsRequestTaxIdentifiersItemTaxIdType taxIdType; + + private String taxIdValue; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateAccountsRequestTaxIdentifiersItem other) { + taxIdType(other.getTaxIdType()); + taxIdValue(other.getTaxIdValue()); + return this; + } + + /** + *

Tax ID type, for example eu_vat, gb_vat, or us_ein.

+ *

Tax ID type, for example eu_vat, gb_vat, or us_ein.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tax_id_type") + public TaxIdValueStage taxIdType(@NotNull UpdateAccountsRequestTaxIdentifiersItemTaxIdType taxIdType) { + this.taxIdType = Objects.requireNonNull(taxIdType, "taxIdType must not be null"); + return this; + } + + /** + *

Tax ID value, for example DE123456789.

+ *

Tax ID value, for example DE123456789.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tax_id_value") + public _FinalStage taxIdValue(@NotNull String taxIdValue) { + this.taxIdValue = Objects.requireNonNull(taxIdValue, "taxIdValue must not be null"); + return this; + } + + @java.lang.Override + public UpdateAccountsRequestTaxIdentifiersItem build() { + return new UpdateAccountsRequestTaxIdentifiersItem(taxIdType, taxIdValue, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestTaxIdentifiersItemTaxIdType.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestTaxIdentifiersItemTaxIdType.java new file mode 100644 index 00000000..4db80543 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestTaxIdentifiersItemTaxIdType.java @@ -0,0 +1,1285 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAccountsRequestTaxIdentifiersItemTaxIdType { + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType TW_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.TW_VAT, "tw_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType VE_RIF = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.VE_RIF, "ve_rif"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType KR_BRN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.KR_BRN, "kr_brn"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType SN_NINEA = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.SN_NINEA, "sn_ninea"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType AU_ABN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.AU_ABN, "au_abn"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType MY_SST = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.MY_SST, "my_sst"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType EU_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.EU_VAT, "eu_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType IN_GST = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.IN_GST, "in_gst"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType CA_QST = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.CA_QST, "ca_qst"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType MA_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.MA_VAT, "ma_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType MK_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.MK_VAT, "mk_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType UA_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.UA_VAT, "ua_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType CN_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.CN_TIN, "cn_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType MX_RFC = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.MX_RFC, "mx_rfc"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType BY_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.BY_TIN, "by_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType CA_PST_BC = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.CA_PST_BC, "ca_pst_bc"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType ID_NPWP = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.ID_NPWP, "id_npwp"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType PH_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.PH_TIN, "ph_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType AE_TRN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.AE_TRN, "ae_trn"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType EC_RUC = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.EC_RUC, "ec_ruc"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType DE_STN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.DE_STN, "de_stn"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType US_EIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.US_EIN, "us_ein"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType CM_NIU = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.CM_NIU, "cm_niu"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType ET_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.ET_TIN, "et_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType IS_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.IS_VAT, "is_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType MY_FRP = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.MY_FRP, "my_frp"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType SG_UEN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.SG_UEN, "sg_uen"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType HU_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.HU_TIN, "hu_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType CO_NIT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.CO_NIT, "co_nit"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType JP_CN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.JP_CN, "jp_cn"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType MY_ITN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.MY_ITN, "my_itn"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType RU_KPP = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.RU_KPP, "ru_kpp"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType KE_PIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.KE_PIN, "ke_pin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType AR_CUIT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.AR_CUIT, "ar_cuit"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType PE_RUC = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.PE_RUC, "pe_ruc"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType CA_PST_MB = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.CA_PST_MB, "ca_pst_mb"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType AM_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.AM_TIN, "am_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType DO_RCN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.DO_RCN, "do_rcn"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType BB_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.BB_TIN, "bb_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType JP_TRN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.JP_TRN, "jp_trn"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType HK_BR = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.HK_BR, "hk_br"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType UZ_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.UZ_TIN, "uz_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType ME_PIB = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.ME_PIB, "me_pib"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType BS_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.BS_TIN, "bs_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType GN_NIF = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.GN_NIF, "gn_nif"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType KH_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.KH_TIN, "kh_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType CD_NIF = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.CD_NIF, "cd_nif"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType NZ_GST = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.NZ_GST, "nz_gst"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType TH_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.TH_VAT, "th_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType JP_RN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.JP_RN, "jp_rn"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType RU_INN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.RU_INN, "ru_inn"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType SG_GST = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.SG_GST, "sg_gst"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType NO_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.NO_VAT, "no_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType BA_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.BA_TIN, "ba_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType KZ_BIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.KZ_BIN, "kz_bin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType AL_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.AL_TIN, "al_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType EG_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.EG_TIN, "eg_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType NP_PAN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.NP_PAN, "np_pan"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType CH_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.CH_VAT, "ch_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType NO_VOEC = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.NO_VOEC, "no_voec"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType UZ_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.UZ_VAT, "uz_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType SR_FIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.SR_FIN, "sr_fin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType BG_UIC = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.BG_UIC, "bg_uic"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType AU_ARN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.AU_ARN, "au_arn"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType BR_CNPJ = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.BR_CNPJ, "br_cnpj"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType UG_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.UG_TIN, "ug_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType CA_PST_SK = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.CA_PST_SK, "ca_pst_sk"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType OM_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.OM_VAT, "om_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType BR_CPF = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.BR_CPF, "br_cpf"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType MR_NIF = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.MR_NIF, "mr_nif"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType TR_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.TR_TIN, "tr_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType BJ_IFU = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.BJ_IFU, "bj_ifu"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType ZW_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.ZW_TIN, "zw_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType LI_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.LI_VAT, "li_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType ZM_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.ZM_TIN, "zm_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType SI_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.SI_TIN, "si_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType CV_NIF = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.CV_NIF, "cv_nif"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType LI_UID = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.LI_UID, "li_uid"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType RS_PIB = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.RS_PIB, "rs_pib"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType IL_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.IL_VAT, "il_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType TZ_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.TZ_VAT, "tz_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType BH_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.BH_VAT, "bh_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType HR_OIB = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.HR_OIB, "hr_oib"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType NG_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.NG_TIN, "ng_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType ZA_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.ZA_VAT, "za_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType AO_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.AO_TIN, "ao_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType MD_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.MD_VAT, "md_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType UY_RUC = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.UY_RUC, "uy_ruc"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType AD_NRT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.AD_NRT, "ad_nrt"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType BF_IFU = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.BF_IFU, "bf_ifu"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType VN_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.VN_TIN, "vn_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType CL_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.CL_TIN, "cl_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType LA_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.LA_TIN, "la_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType KG_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.KG_TIN, "kg_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType CA_BN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.CA_BN, "ca_bn"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType SA_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.SA_VAT, "sa_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType EU_OSS_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.EU_OSS_VAT, "eu_oss_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType BD_BIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.BD_BIN, "bd_bin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType SV_NIT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.SV_NIT, "sv_nit"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType BO_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.BO_TIN, "bo_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType GE_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.GE_VAT, "ge_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType AZ_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.AZ_TIN, "az_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType CH_UID = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.CH_UID, "ch_uid"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType RO_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.RO_TIN, "ro_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType TJ_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.TJ_TIN, "tj_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType AW_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.AW_TIN, "aw_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType CR_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.CR_TIN, "cr_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType GB_VAT = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.GB_VAT, "gb_vat"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType ES_CIF = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.ES_CIF, "es_cif"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType GH_TIN = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.GH_TIN, "gh_tin"); + + public static final UpdateAccountsRequestTaxIdentifiersItemTaxIdType CA_GST_HST = + new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.CA_GST_HST, "ca_gst_hst"); + + private final Value value; + + private final String string; + + UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAccountsRequestTaxIdentifiersItemTaxIdType + && this.string.equals(((UpdateAccountsRequestTaxIdentifiersItemTaxIdType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TW_VAT: + return visitor.visitTwVat(); + case VE_RIF: + return visitor.visitVeRif(); + case KR_BRN: + return visitor.visitKrBrn(); + case SN_NINEA: + return visitor.visitSnNinea(); + case AU_ABN: + return visitor.visitAuAbn(); + case MY_SST: + return visitor.visitMySst(); + case EU_VAT: + return visitor.visitEuVat(); + case IN_GST: + return visitor.visitInGst(); + case CA_QST: + return visitor.visitCaQst(); + case MA_VAT: + return visitor.visitMaVat(); + case MK_VAT: + return visitor.visitMkVat(); + case UA_VAT: + return visitor.visitUaVat(); + case CN_TIN: + return visitor.visitCnTin(); + case MX_RFC: + return visitor.visitMxRfc(); + case BY_TIN: + return visitor.visitByTin(); + case CA_PST_BC: + return visitor.visitCaPstBc(); + case ID_NPWP: + return visitor.visitIdNpwp(); + case PH_TIN: + return visitor.visitPhTin(); + case AE_TRN: + return visitor.visitAeTrn(); + case EC_RUC: + return visitor.visitEcRuc(); + case DE_STN: + return visitor.visitDeStn(); + case US_EIN: + return visitor.visitUsEin(); + case CM_NIU: + return visitor.visitCmNiu(); + case ET_TIN: + return visitor.visitEtTin(); + case IS_VAT: + return visitor.visitIsVat(); + case MY_FRP: + return visitor.visitMyFrp(); + case SG_UEN: + return visitor.visitSgUen(); + case HU_TIN: + return visitor.visitHuTin(); + case CO_NIT: + return visitor.visitCoNit(); + case JP_CN: + return visitor.visitJpCn(); + case MY_ITN: + return visitor.visitMyItn(); + case RU_KPP: + return visitor.visitRuKpp(); + case KE_PIN: + return visitor.visitKePin(); + case AR_CUIT: + return visitor.visitArCuit(); + case PE_RUC: + return visitor.visitPeRuc(); + case CA_PST_MB: + return visitor.visitCaPstMb(); + case AM_TIN: + return visitor.visitAmTin(); + case DO_RCN: + return visitor.visitDoRcn(); + case BB_TIN: + return visitor.visitBbTin(); + case JP_TRN: + return visitor.visitJpTrn(); + case HK_BR: + return visitor.visitHkBr(); + case UZ_TIN: + return visitor.visitUzTin(); + case ME_PIB: + return visitor.visitMePib(); + case BS_TIN: + return visitor.visitBsTin(); + case GN_NIF: + return visitor.visitGnNif(); + case KH_TIN: + return visitor.visitKhTin(); + case CD_NIF: + return visitor.visitCdNif(); + case NZ_GST: + return visitor.visitNzGst(); + case TH_VAT: + return visitor.visitThVat(); + case JP_RN: + return visitor.visitJpRn(); + case RU_INN: + return visitor.visitRuInn(); + case SG_GST: + return visitor.visitSgGst(); + case NO_VAT: + return visitor.visitNoVat(); + case BA_TIN: + return visitor.visitBaTin(); + case KZ_BIN: + return visitor.visitKzBin(); + case AL_TIN: + return visitor.visitAlTin(); + case EG_TIN: + return visitor.visitEgTin(); + case NP_PAN: + return visitor.visitNpPan(); + case CH_VAT: + return visitor.visitChVat(); + case NO_VOEC: + return visitor.visitNoVoec(); + case UZ_VAT: + return visitor.visitUzVat(); + case SR_FIN: + return visitor.visitSrFin(); + case BG_UIC: + return visitor.visitBgUic(); + case AU_ARN: + return visitor.visitAuArn(); + case BR_CNPJ: + return visitor.visitBrCnpj(); + case UG_TIN: + return visitor.visitUgTin(); + case CA_PST_SK: + return visitor.visitCaPstSk(); + case OM_VAT: + return visitor.visitOmVat(); + case BR_CPF: + return visitor.visitBrCpf(); + case MR_NIF: + return visitor.visitMrNif(); + case TR_TIN: + return visitor.visitTrTin(); + case BJ_IFU: + return visitor.visitBjIfu(); + case ZW_TIN: + return visitor.visitZwTin(); + case LI_VAT: + return visitor.visitLiVat(); + case ZM_TIN: + return visitor.visitZmTin(); + case SI_TIN: + return visitor.visitSiTin(); + case CV_NIF: + return visitor.visitCvNif(); + case LI_UID: + return visitor.visitLiUid(); + case RS_PIB: + return visitor.visitRsPib(); + case IL_VAT: + return visitor.visitIlVat(); + case TZ_VAT: + return visitor.visitTzVat(); + case BH_VAT: + return visitor.visitBhVat(); + case HR_OIB: + return visitor.visitHrOib(); + case NG_TIN: + return visitor.visitNgTin(); + case ZA_VAT: + return visitor.visitZaVat(); + case AO_TIN: + return visitor.visitAoTin(); + case MD_VAT: + return visitor.visitMdVat(); + case UY_RUC: + return visitor.visitUyRuc(); + case AD_NRT: + return visitor.visitAdNrt(); + case BF_IFU: + return visitor.visitBfIfu(); + case VN_TIN: + return visitor.visitVnTin(); + case CL_TIN: + return visitor.visitClTin(); + case LA_TIN: + return visitor.visitLaTin(); + case KG_TIN: + return visitor.visitKgTin(); + case CA_BN: + return visitor.visitCaBn(); + case SA_VAT: + return visitor.visitSaVat(); + case EU_OSS_VAT: + return visitor.visitEuOssVat(); + case BD_BIN: + return visitor.visitBdBin(); + case SV_NIT: + return visitor.visitSvNit(); + case BO_TIN: + return visitor.visitBoTin(); + case GE_VAT: + return visitor.visitGeVat(); + case AZ_TIN: + return visitor.visitAzTin(); + case CH_UID: + return visitor.visitChUid(); + case RO_TIN: + return visitor.visitRoTin(); + case TJ_TIN: + return visitor.visitTjTin(); + case AW_TIN: + return visitor.visitAwTin(); + case CR_TIN: + return visitor.visitCrTin(); + case GB_VAT: + return visitor.visitGbVat(); + case ES_CIF: + return visitor.visitEsCif(); + case GH_TIN: + return visitor.visitGhTin(); + case CA_GST_HST: + return visitor.visitCaGstHst(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAccountsRequestTaxIdentifiersItemTaxIdType valueOf(String value) { + switch (value) { + case "tw_vat": + return TW_VAT; + case "ve_rif": + return VE_RIF; + case "kr_brn": + return KR_BRN; + case "sn_ninea": + return SN_NINEA; + case "au_abn": + return AU_ABN; + case "my_sst": + return MY_SST; + case "eu_vat": + return EU_VAT; + case "in_gst": + return IN_GST; + case "ca_qst": + return CA_QST; + case "ma_vat": + return MA_VAT; + case "mk_vat": + return MK_VAT; + case "ua_vat": + return UA_VAT; + case "cn_tin": + return CN_TIN; + case "mx_rfc": + return MX_RFC; + case "by_tin": + return BY_TIN; + case "ca_pst_bc": + return CA_PST_BC; + case "id_npwp": + return ID_NPWP; + case "ph_tin": + return PH_TIN; + case "ae_trn": + return AE_TRN; + case "ec_ruc": + return EC_RUC; + case "de_stn": + return DE_STN; + case "us_ein": + return US_EIN; + case "cm_niu": + return CM_NIU; + case "et_tin": + return ET_TIN; + case "is_vat": + return IS_VAT; + case "my_frp": + return MY_FRP; + case "sg_uen": + return SG_UEN; + case "hu_tin": + return HU_TIN; + case "co_nit": + return CO_NIT; + case "jp_cn": + return JP_CN; + case "my_itn": + return MY_ITN; + case "ru_kpp": + return RU_KPP; + case "ke_pin": + return KE_PIN; + case "ar_cuit": + return AR_CUIT; + case "pe_ruc": + return PE_RUC; + case "ca_pst_mb": + return CA_PST_MB; + case "am_tin": + return AM_TIN; + case "do_rcn": + return DO_RCN; + case "bb_tin": + return BB_TIN; + case "jp_trn": + return JP_TRN; + case "hk_br": + return HK_BR; + case "uz_tin": + return UZ_TIN; + case "me_pib": + return ME_PIB; + case "bs_tin": + return BS_TIN; + case "gn_nif": + return GN_NIF; + case "kh_tin": + return KH_TIN; + case "cd_nif": + return CD_NIF; + case "nz_gst": + return NZ_GST; + case "th_vat": + return TH_VAT; + case "jp_rn": + return JP_RN; + case "ru_inn": + return RU_INN; + case "sg_gst": + return SG_GST; + case "no_vat": + return NO_VAT; + case "ba_tin": + return BA_TIN; + case "kz_bin": + return KZ_BIN; + case "al_tin": + return AL_TIN; + case "eg_tin": + return EG_TIN; + case "np_pan": + return NP_PAN; + case "ch_vat": + return CH_VAT; + case "no_voec": + return NO_VOEC; + case "uz_vat": + return UZ_VAT; + case "sr_fin": + return SR_FIN; + case "bg_uic": + return BG_UIC; + case "au_arn": + return AU_ARN; + case "br_cnpj": + return BR_CNPJ; + case "ug_tin": + return UG_TIN; + case "ca_pst_sk": + return CA_PST_SK; + case "om_vat": + return OM_VAT; + case "br_cpf": + return BR_CPF; + case "mr_nif": + return MR_NIF; + case "tr_tin": + return TR_TIN; + case "bj_ifu": + return BJ_IFU; + case "zw_tin": + return ZW_TIN; + case "li_vat": + return LI_VAT; + case "zm_tin": + return ZM_TIN; + case "si_tin": + return SI_TIN; + case "cv_nif": + return CV_NIF; + case "li_uid": + return LI_UID; + case "rs_pib": + return RS_PIB; + case "il_vat": + return IL_VAT; + case "tz_vat": + return TZ_VAT; + case "bh_vat": + return BH_VAT; + case "hr_oib": + return HR_OIB; + case "ng_tin": + return NG_TIN; + case "za_vat": + return ZA_VAT; + case "ao_tin": + return AO_TIN; + case "md_vat": + return MD_VAT; + case "uy_ruc": + return UY_RUC; + case "ad_nrt": + return AD_NRT; + case "bf_ifu": + return BF_IFU; + case "vn_tin": + return VN_TIN; + case "cl_tin": + return CL_TIN; + case "la_tin": + return LA_TIN; + case "kg_tin": + return KG_TIN; + case "ca_bn": + return CA_BN; + case "sa_vat": + return SA_VAT; + case "eu_oss_vat": + return EU_OSS_VAT; + case "bd_bin": + return BD_BIN; + case "sv_nit": + return SV_NIT; + case "bo_tin": + return BO_TIN; + case "ge_vat": + return GE_VAT; + case "az_tin": + return AZ_TIN; + case "ch_uid": + return CH_UID; + case "ro_tin": + return RO_TIN; + case "tj_tin": + return TJ_TIN; + case "aw_tin": + return AW_TIN; + case "cr_tin": + return CR_TIN; + case "gb_vat": + return GB_VAT; + case "es_cif": + return ES_CIF; + case "gh_tin": + return GH_TIN; + case "ca_gst_hst": + return CA_GST_HST; + default: + return new UpdateAccountsRequestTaxIdentifiersItemTaxIdType(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_NRT, + + AO_TIN, + + AR_CUIT, + + AL_TIN, + + AM_TIN, + + AW_TIN, + + AU_ABN, + + AU_ARN, + + EU_VAT, + + AZ_TIN, + + BS_TIN, + + BH_VAT, + + BD_BIN, + + BB_TIN, + + BY_TIN, + + BJ_IFU, + + BO_TIN, + + BA_TIN, + + BR_CNPJ, + + BR_CPF, + + BG_UIC, + + BF_IFU, + + KH_TIN, + + CM_NIU, + + CA_BN, + + CA_GST_HST, + + CA_PST_BC, + + CA_PST_MB, + + CA_PST_SK, + + CA_QST, + + CV_NIF, + + CL_TIN, + + CN_TIN, + + CO_NIT, + + CD_NIF, + + CR_TIN, + + HR_OIB, + + DO_RCN, + + EC_RUC, + + EG_TIN, + + SV_NIT, + + ET_TIN, + + EU_OSS_VAT, + + GE_VAT, + + GH_TIN, + + DE_STN, + + GB_VAT, + + GN_NIF, + + HK_BR, + + HU_TIN, + + IS_VAT, + + IN_GST, + + ID_NPWP, + + IL_VAT, + + JP_CN, + + JP_RN, + + JP_TRN, + + KZ_BIN, + + KE_PIN, + + KG_TIN, + + LA_TIN, + + LI_UID, + + LI_VAT, + + MY_FRP, + + MY_ITN, + + MY_SST, + + MR_NIF, + + MX_RFC, + + MD_VAT, + + ME_PIB, + + MA_VAT, + + NP_PAN, + + NZ_GST, + + NG_TIN, + + MK_VAT, + + NO_VAT, + + NO_VOEC, + + OM_VAT, + + PE_RUC, + + PH_TIN, + + RO_TIN, + + RU_INN, + + RU_KPP, + + SA_VAT, + + SN_NINEA, + + RS_PIB, + + SG_GST, + + SG_UEN, + + SI_TIN, + + ZA_VAT, + + KR_BRN, + + ES_CIF, + + CH_UID, + + CH_VAT, + + TW_VAT, + + TJ_TIN, + + TZ_VAT, + + TH_VAT, + + TR_TIN, + + UG_TIN, + + UA_VAT, + + AE_TRN, + + US_EIN, + + UY_RUC, + + UZ_TIN, + + UZ_VAT, + + VE_RIF, + + VN_TIN, + + ZM_TIN, + + ZW_TIN, + + SR_FIN, + + UNKNOWN + } + + public interface Visitor { + T visitAdNrt(); + + T visitAoTin(); + + T visitArCuit(); + + T visitAlTin(); + + T visitAmTin(); + + T visitAwTin(); + + T visitAuAbn(); + + T visitAuArn(); + + T visitEuVat(); + + T visitAzTin(); + + T visitBsTin(); + + T visitBhVat(); + + T visitBdBin(); + + T visitBbTin(); + + T visitByTin(); + + T visitBjIfu(); + + T visitBoTin(); + + T visitBaTin(); + + T visitBrCnpj(); + + T visitBrCpf(); + + T visitBgUic(); + + T visitBfIfu(); + + T visitKhTin(); + + T visitCmNiu(); + + T visitCaBn(); + + T visitCaGstHst(); + + T visitCaPstBc(); + + T visitCaPstMb(); + + T visitCaPstSk(); + + T visitCaQst(); + + T visitCvNif(); + + T visitClTin(); + + T visitCnTin(); + + T visitCoNit(); + + T visitCdNif(); + + T visitCrTin(); + + T visitHrOib(); + + T visitDoRcn(); + + T visitEcRuc(); + + T visitEgTin(); + + T visitSvNit(); + + T visitEtTin(); + + T visitEuOssVat(); + + T visitGeVat(); + + T visitGhTin(); + + T visitDeStn(); + + T visitGbVat(); + + T visitGnNif(); + + T visitHkBr(); + + T visitHuTin(); + + T visitIsVat(); + + T visitInGst(); + + T visitIdNpwp(); + + T visitIlVat(); + + T visitJpCn(); + + T visitJpRn(); + + T visitJpTrn(); + + T visitKzBin(); + + T visitKePin(); + + T visitKgTin(); + + T visitLaTin(); + + T visitLiUid(); + + T visitLiVat(); + + T visitMyFrp(); + + T visitMyItn(); + + T visitMySst(); + + T visitMrNif(); + + T visitMxRfc(); + + T visitMdVat(); + + T visitMePib(); + + T visitMaVat(); + + T visitNpPan(); + + T visitNzGst(); + + T visitNgTin(); + + T visitMkVat(); + + T visitNoVat(); + + T visitNoVoec(); + + T visitOmVat(); + + T visitPeRuc(); + + T visitPhTin(); + + T visitRoTin(); + + T visitRuInn(); + + T visitRuKpp(); + + T visitSaVat(); + + T visitSnNinea(); + + T visitRsPib(); + + T visitSgGst(); + + T visitSgUen(); + + T visitSiTin(); + + T visitZaVat(); + + T visitKrBrn(); + + T visitEsCif(); + + T visitChUid(); + + T visitChVat(); + + T visitTwVat(); + + T visitTjTin(); + + T visitTzVat(); + + T visitThVat(); + + T visitTrTin(); + + T visitUgTin(); + + T visitUaVat(); + + T visitAeTrn(); + + T visitUsEin(); + + T visitUyRuc(); + + T visitUzTin(); + + T visitUzVat(); + + T visitVeRif(); + + T visitVnTin(); + + T visitZmTin(); + + T visitZwTin(); + + T visitSrFin(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestTaxRemittedBy.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestTaxRemittedBy.java new file mode 100644 index 00000000..54c52e0e --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestTaxRemittedBy.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAccountsRequestTaxRemittedBy { + public static final UpdateAccountsRequestTaxRemittedBy SELF = + new UpdateAccountsRequestTaxRemittedBy(Value.SELF, "self"); + + public static final UpdateAccountsRequestTaxRemittedBy WHOP = + new UpdateAccountsRequestTaxRemittedBy(Value.WHOP, "whop"); + + public static final UpdateAccountsRequestTaxRemittedBy NONE = + new UpdateAccountsRequestTaxRemittedBy(Value.NONE, "none"); + + private final Value value; + + private final String string; + + UpdateAccountsRequestTaxRemittedBy(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAccountsRequestTaxRemittedBy + && this.string.equals(((UpdateAccountsRequestTaxRemittedBy) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF: + return visitor.visitSelf(); + case WHOP: + return visitor.visitWhop(); + case NONE: + return visitor.visitNone(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAccountsRequestTaxRemittedBy valueOf(String value) { + switch (value) { + case "self": + return SELF; + case "whop": + return WHOP; + case "none": + return NONE; + default: + return new UpdateAccountsRequestTaxRemittedBy(Value.UNKNOWN, value); + } + } + + public enum Value { + WHOP, + + SELF, + + NONE, + + UNKNOWN + } + + public interface Visitor { + T visitWhop(); + + T visitSelf(); + + T visitNone(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestTaxType.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestTaxType.java new file mode 100644 index 00000000..e6d4c5bf --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestTaxType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAccountsRequestTaxType { + public static final UpdateAccountsRequestTaxType EXCLUSIVE = + new UpdateAccountsRequestTaxType(Value.EXCLUSIVE, "exclusive"); + + public static final UpdateAccountsRequestTaxType INCLUSIVE = + new UpdateAccountsRequestTaxType(Value.INCLUSIVE, "inclusive"); + + private final Value value; + + private final String string; + + UpdateAccountsRequestTaxType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAccountsRequestTaxType + && this.string.equals(((UpdateAccountsRequestTaxType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EXCLUSIVE: + return visitor.visitExclusive(); + case INCLUSIVE: + return visitor.visitInclusive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAccountsRequestTaxType valueOf(String value) { + switch (value) { + case "exclusive": + return EXCLUSIVE; + case "inclusive": + return INCLUSIVE; + default: + return new UpdateAccountsRequestTaxType(Value.UNKNOWN, value); + } + } + + public enum Value { + INCLUSIVE, + + EXCLUSIVE, + + UNKNOWN + } + + public interface Visitor { + T visitInclusive(); + + T visitExclusive(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestThreeDsLevel.java b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestThreeDsLevel.java new file mode 100644 index 00000000..5ee1b6b5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/accounts/types/UpdateAccountsRequestThreeDsLevel.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAccountsRequestThreeDsLevel { + public static final UpdateAccountsRequestThreeDsLevel MANDATE_CHALLENGE = + new UpdateAccountsRequestThreeDsLevel(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + private final Value value; + + private final String string; + + UpdateAccountsRequestThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAccountsRequestThreeDsLevel + && this.string.equals(((UpdateAccountsRequestThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAccountsRequestThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + default: + return new UpdateAccountsRequestThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/AdCampaignsClient.java b/src/main/java/com/whop/api/resources/adcampaigns/AdCampaignsClient.java new file mode 100644 index 00000000..8e3894ff --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/AdCampaignsClient.java @@ -0,0 +1,278 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.adcampaigns.requests.CreateAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.DeleteAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.DuplicateAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.ListAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.PauseAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.RetrieveAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.RetryPaymentAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.UnpauseAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.UpdateAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.types.DeleteAdCampaignsResponse; +import com.whop.api.resources.adcampaigns.types.DuplicateAdCampaignsResponse; +import com.whop.api.types.AdCampaign; + +public class AdCampaignsClient { + protected final ClientOptions clientOptions; + + private final RawAdCampaignsClient rawClient; + + public AdCampaignsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAdCampaignsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAdCampaignsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public SyncPagingIterable list(ListAdCampaignsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public SyncPagingIterable list(ListAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Creates an ad campaign for an account. + */ + public AdCampaign create(CreateAdCampaignsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Creates an ad campaign for an account. + */ + public AdCampaign create(CreateAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public AdCampaign retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public AdCampaign retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public AdCampaign retrieve(String id, RetrieveAdCampaignsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public AdCampaign retrieve(String id, RetrieveAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public DeleteAdCampaignsResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public DeleteAdCampaignsResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public DeleteAdCampaignsResponse delete(String id, DeleteAdCampaignsRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public DeleteAdCampaignsResponse delete( + String id, DeleteAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public AdCampaign update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public AdCampaign update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public AdCampaign update(String id, UpdateAdCampaignsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public AdCampaign update(String id, UpdateAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public DuplicateAdCampaignsResponse duplicate(String id) { + return this.rawClient.duplicate(id).body(); + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public DuplicateAdCampaignsResponse duplicate(String id, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, requestOptions).body(); + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public DuplicateAdCampaignsResponse duplicate(String id, DuplicateAdCampaignsRequest request) { + return this.rawClient.duplicate(id, request).body(); + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public DuplicateAdCampaignsResponse duplicate( + String id, DuplicateAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, request, requestOptions).body(); + } + + /** + * Pauses an active ad campaign. + */ + public AdCampaign pause(String id) { + return this.rawClient.pause(id).body(); + } + + /** + * Pauses an active ad campaign. + */ + public AdCampaign pause(String id, RequestOptions requestOptions) { + return this.rawClient.pause(id, requestOptions).body(); + } + + /** + * Pauses an active ad campaign. + */ + public AdCampaign pause(String id, PauseAdCampaignsRequest request) { + return this.rawClient.pause(id, request).body(); + } + + /** + * Pauses an active ad campaign. + */ + public AdCampaign pause(String id, PauseAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.pause(id, request, requestOptions).body(); + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public AdCampaign retryPayment(String id) { + return this.rawClient.retryPayment(id).body(); + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public AdCampaign retryPayment(String id, RequestOptions requestOptions) { + return this.rawClient.retryPayment(id, requestOptions).body(); + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public AdCampaign retryPayment(String id, RetryPaymentAdCampaignsRequest request) { + return this.rawClient.retryPayment(id, request).body(); + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public AdCampaign retryPayment(String id, RetryPaymentAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.retryPayment(id, request, requestOptions).body(); + } + + /** + * Resumes a paused ad campaign. + */ + public AdCampaign unpause(String id) { + return this.rawClient.unpause(id).body(); + } + + /** + * Resumes a paused ad campaign. + */ + public AdCampaign unpause(String id, RequestOptions requestOptions) { + return this.rawClient.unpause(id, requestOptions).body(); + } + + /** + * Resumes a paused ad campaign. + */ + public AdCampaign unpause(String id, UnpauseAdCampaignsRequest request) { + return this.rawClient.unpause(id, request).body(); + } + + /** + * Resumes a paused ad campaign. + */ + public AdCampaign unpause(String id, UnpauseAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.unpause(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/AsyncAdCampaignsClient.java b/src/main/java/com/whop/api/resources/adcampaigns/AsyncAdCampaignsClient.java new file mode 100644 index 00000000..dbf2daa1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/AsyncAdCampaignsClient.java @@ -0,0 +1,285 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.adcampaigns.requests.CreateAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.DeleteAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.DuplicateAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.ListAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.PauseAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.RetrieveAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.RetryPaymentAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.UnpauseAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.UpdateAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.types.DeleteAdCampaignsResponse; +import com.whop.api.resources.adcampaigns.types.DuplicateAdCampaignsResponse; +import com.whop.api.types.AdCampaign; +import java.util.concurrent.CompletableFuture; + +public class AsyncAdCampaignsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAdCampaignsClient rawClient; + + public AsyncAdCampaignsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAdCampaignsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAdCampaignsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public CompletableFuture> list(ListAdCampaignsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public CompletableFuture> list( + ListAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates an ad campaign for an account. + */ + public CompletableFuture create(CreateAdCampaignsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Creates an ad campaign for an account. + */ + public CompletableFuture create(CreateAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public CompletableFuture retrieve(String id, RetrieveAdCampaignsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public CompletableFuture retrieve( + String id, RetrieveAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public CompletableFuture delete(String id, DeleteAdCampaignsRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public CompletableFuture delete( + String id, DeleteAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public CompletableFuture update(String id, UpdateAdCampaignsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public CompletableFuture update( + String id, UpdateAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture duplicate(String id) { + return this.rawClient.duplicate(id).thenApply(response -> response.body()); + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture duplicate(String id, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture duplicate(String id, DuplicateAdCampaignsRequest request) { + return this.rawClient.duplicate(id, request).thenApply(response -> response.body()); + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture duplicate( + String id, DuplicateAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Pauses an active ad campaign. + */ + public CompletableFuture pause(String id) { + return this.rawClient.pause(id).thenApply(response -> response.body()); + } + + /** + * Pauses an active ad campaign. + */ + public CompletableFuture pause(String id, RequestOptions requestOptions) { + return this.rawClient.pause(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Pauses an active ad campaign. + */ + public CompletableFuture pause(String id, PauseAdCampaignsRequest request) { + return this.rawClient.pause(id, request).thenApply(response -> response.body()); + } + + /** + * Pauses an active ad campaign. + */ + public CompletableFuture pause( + String id, PauseAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.pause(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public CompletableFuture retryPayment(String id) { + return this.rawClient.retryPayment(id).thenApply(response -> response.body()); + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public CompletableFuture retryPayment(String id, RequestOptions requestOptions) { + return this.rawClient.retryPayment(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public CompletableFuture retryPayment(String id, RetryPaymentAdCampaignsRequest request) { + return this.rawClient.retryPayment(id, request).thenApply(response -> response.body()); + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public CompletableFuture retryPayment( + String id, RetryPaymentAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.retryPayment(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Resumes a paused ad campaign. + */ + public CompletableFuture unpause(String id) { + return this.rawClient.unpause(id).thenApply(response -> response.body()); + } + + /** + * Resumes a paused ad campaign. + */ + public CompletableFuture unpause(String id, RequestOptions requestOptions) { + return this.rawClient.unpause(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Resumes a paused ad campaign. + */ + public CompletableFuture unpause(String id, UnpauseAdCampaignsRequest request) { + return this.rawClient.unpause(id, request).thenApply(response -> response.body()); + } + + /** + * Resumes a paused ad campaign. + */ + public CompletableFuture unpause( + String id, UnpauseAdCampaignsRequest request, RequestOptions requestOptions) { + return this.rawClient.unpause(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/AsyncRawAdCampaignsClient.java b/src/main/java/com/whop/api/resources/adcampaigns/AsyncRawAdCampaignsClient.java new file mode 100644 index 00000000..b2a185a4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/AsyncRawAdCampaignsClient.java @@ -0,0 +1,936 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.adcampaigns.requests.CreateAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.DeleteAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.DuplicateAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.ListAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.PauseAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.RetrieveAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.RetryPaymentAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.UnpauseAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.UpdateAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.types.DeleteAdCampaignsResponse; +import com.whop.api.resources.adcampaigns.types.DuplicateAdCampaignsResponse; +import com.whop.api.resources.adcampaigns.types.ListAdCampaignsResponse; +import com.whop.api.types.AdCampaign; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAdCampaignsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAdCampaignsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public CompletableFuture>> list() { + return list(ListAdCampaignsRequest.builder().build()); + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(ListAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public CompletableFuture>> list(ListAdCampaignsRequest request) { + return list(request, null); + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public CompletableFuture>> list( + ListAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getStatsFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_from", request.getStatsFrom().get(), false); + } + if (request.getStatsTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_to", request.getStatsTo().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAdCampaignsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAdCampaignsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListAdCampaignsRequest nextRequest = ListAdCampaignsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates an ad campaign for an account. + */ + public CompletableFuture> create(CreateAdCampaignsRequest request) { + return create(request, null); + } + + /** + * Creates an ad campaign for an account. + */ + public CompletableFuture> create( + CreateAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdCampaign.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveAdCampaignsRequest.builder().build()); + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public CompletableFuture> retrieve(String id, RetrieveAdCampaignsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public CompletableFuture> retrieve( + String id, RetrieveAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns") + .addPathSegment(id); + if (request.getStatsFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_from", request.getStatsFrom().get(), false); + } + if (request.getStatsTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_to", request.getStatsTo().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdCampaign.class), response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteAdCampaignsRequest.builder().build()); + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public CompletableFuture> delete( + String id, RequestOptions requestOptions) { + return delete(id, DeleteAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public CompletableFuture> delete( + String id, DeleteAdCampaignsRequest request) { + return delete(id, request, null); + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public CompletableFuture> delete( + String id, DeleteAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DeleteAdCampaignsResponse.class), + response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateAdCampaignsRequest.builder().build()); + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public CompletableFuture> update(String id, UpdateAdCampaignsRequest request) { + return update(id, request, null); + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public CompletableFuture> update( + String id, UpdateAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdCampaign.class), response)); + return; + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture> duplicate(String id) { + return duplicate(id, DuplicateAdCampaignsRequest.builder().build()); + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture> duplicate( + String id, RequestOptions requestOptions) { + return duplicate(id, DuplicateAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture> duplicate( + String id, DuplicateAdCampaignsRequest request) { + return duplicate(id, request, null); + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture> duplicate( + String id, DuplicateAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns") + .addPathSegment(id) + .addPathSegments("duplicate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DuplicateAdCampaignsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Pauses an active ad campaign. + */ + public CompletableFuture> pause(String id) { + return pause(id, PauseAdCampaignsRequest.builder().build()); + } + + /** + * Pauses an active ad campaign. + */ + public CompletableFuture> pause(String id, RequestOptions requestOptions) { + return pause(id, PauseAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Pauses an active ad campaign. + */ + public CompletableFuture> pause(String id, PauseAdCampaignsRequest request) { + return pause(id, request, null); + } + + /** + * Pauses an active ad campaign. + */ + public CompletableFuture> pause( + String id, PauseAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns") + .addPathSegment(id) + .addPathSegments("pause"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdCampaign.class), response)); + return; + } + try { + if (response.code() == 409) { + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public CompletableFuture> retryPayment(String id) { + return retryPayment(id, RetryPaymentAdCampaignsRequest.builder().build()); + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public CompletableFuture> retryPayment(String id, RequestOptions requestOptions) { + return retryPayment(id, RetryPaymentAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public CompletableFuture> retryPayment( + String id, RetryPaymentAdCampaignsRequest request) { + return retryPayment(id, request, null); + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public CompletableFuture> retryPayment( + String id, RetryPaymentAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns") + .addPathSegment(id) + .addPathSegments("retry_payment"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdCampaign.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Resumes a paused ad campaign. + */ + public CompletableFuture> unpause(String id) { + return unpause(id, UnpauseAdCampaignsRequest.builder().build()); + } + + /** + * Resumes a paused ad campaign. + */ + public CompletableFuture> unpause(String id, RequestOptions requestOptions) { + return unpause(id, UnpauseAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Resumes a paused ad campaign. + */ + public CompletableFuture> unpause(String id, UnpauseAdCampaignsRequest request) { + return unpause(id, request, null); + } + + /** + * Resumes a paused ad campaign. + */ + public CompletableFuture> unpause( + String id, UnpauseAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns") + .addPathSegment(id) + .addPathSegments("unpause"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdCampaign.class), response)); + return; + } + try { + if (response.code() == 409) { + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/RawAdCampaignsClient.java b/src/main/java/com/whop/api/resources/adcampaigns/RawAdCampaignsClient.java new file mode 100644 index 00000000..b48105ca --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/RawAdCampaignsClient.java @@ -0,0 +1,777 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.adcampaigns.requests.CreateAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.DeleteAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.DuplicateAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.ListAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.PauseAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.RetrieveAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.RetryPaymentAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.UnpauseAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.requests.UpdateAdCampaignsRequest; +import com.whop.api.resources.adcampaigns.types.DeleteAdCampaignsResponse; +import com.whop.api.resources.adcampaigns.types.DuplicateAdCampaignsResponse; +import com.whop.api.resources.adcampaigns.types.ListAdCampaignsResponse; +import com.whop.api.types.AdCampaign; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAdCampaignsClient { + protected final ClientOptions clientOptions; + + public RawAdCampaignsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public WhopApiHttpResponse> list() { + return list(ListAdCampaignsRequest.builder().build()); + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public WhopApiHttpResponse> list(ListAdCampaignsRequest request) { + return list(request, null); + } + + /** + * Lists the ad campaigns for an account, with stats over the requested window. + */ + public WhopApiHttpResponse> list( + ListAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getStatsFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_from", request.getStatsFrom().get(), false); + } + if (request.getStatsTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_to", request.getStatsTo().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAdCampaignsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAdCampaignsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListAdCampaignsRequest nextRequest = ListAdCampaignsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates an ad campaign for an account. + */ + public WhopApiHttpResponse create(CreateAdCampaignsRequest request) { + return create(request, null); + } + + /** + * Creates an ad campaign for an account. + */ + public WhopApiHttpResponse create(CreateAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdCampaign.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveAdCampaignsRequest.builder().build()); + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveAdCampaignsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single ad campaign with stats over the requested window. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns") + .addPathSegment(id); + if (request.getStatsFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_from", request.getStatsFrom().get(), false); + } + if (request.getStatsTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_to", request.getStatsTo().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdCampaign.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteAdCampaignsRequest.builder().build()); + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public WhopApiHttpResponse delete(String id, DeleteAdCampaignsRequest request) { + return delete(id, request, null); + } + + /** + * Deletes an ad campaign and archives it on the ad platform (cascades to ad groups and ads). + */ + public WhopApiHttpResponse delete( + String id, DeleteAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteAdCampaignsResponse.class), + response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateAdCampaignsRequest.builder().build()); + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public WhopApiHttpResponse update(String id, UpdateAdCampaignsRequest request) { + return update(id, request, null); + } + + /** + * Updates an ad campaign's editable fields (title, budget, schedule, bid strategy, special ad categories, and, before launch, budget optimization), and launches a draft campaign by setting status to active. Objective, budget type and desired cost per result are fixed at creation and cannot be changed. + */ + public WhopApiHttpResponse update( + String id, UpdateAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdCampaign.class), response); + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public WhopApiHttpResponse duplicate(String id) { + return duplicate(id, DuplicateAdCampaignsRequest.builder().build()); + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public WhopApiHttpResponse duplicate(String id, RequestOptions requestOptions) { + return duplicate(id, DuplicateAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public WhopApiHttpResponse duplicate(String id, DuplicateAdCampaignsRequest request) { + return duplicate(id, request, null); + } + + /** + * Creates copies of the campaign in duplicating status and returns them; each copy transitions to draft once duplication completes. Poll each returned campaign until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public WhopApiHttpResponse duplicate( + String id, DuplicateAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns") + .addPathSegment(id) + .addPathSegments("duplicate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DuplicateAdCampaignsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Pauses an active ad campaign. + */ + public WhopApiHttpResponse pause(String id) { + return pause(id, PauseAdCampaignsRequest.builder().build()); + } + + /** + * Pauses an active ad campaign. + */ + public WhopApiHttpResponse pause(String id, RequestOptions requestOptions) { + return pause(id, PauseAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Pauses an active ad campaign. + */ + public WhopApiHttpResponse pause(String id, PauseAdCampaignsRequest request) { + return pause(id, request, null); + } + + /** + * Pauses an active ad campaign. + */ + public WhopApiHttpResponse pause( + String id, PauseAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns") + .addPathSegment(id) + .addPathSegments("pause"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdCampaign.class), response); + } + try { + if (response.code() == 409) { + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public WhopApiHttpResponse retryPayment(String id) { + return retryPayment(id, RetryPaymentAdCampaignsRequest.builder().build()); + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public WhopApiHttpResponse retryPayment(String id, RequestOptions requestOptions) { + return retryPayment(id, RetryPaymentAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public WhopApiHttpResponse retryPayment(String id, RetryPaymentAdCampaignsRequest request) { + return retryPayment(id, request, null); + } + + /** + * Retries billing for an ad campaign whose payment previously failed. + */ + public WhopApiHttpResponse retryPayment( + String id, RetryPaymentAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns") + .addPathSegment(id) + .addPathSegments("retry_payment"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdCampaign.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Resumes a paused ad campaign. + */ + public WhopApiHttpResponse unpause(String id) { + return unpause(id, UnpauseAdCampaignsRequest.builder().build()); + } + + /** + * Resumes a paused ad campaign. + */ + public WhopApiHttpResponse unpause(String id, RequestOptions requestOptions) { + return unpause(id, UnpauseAdCampaignsRequest.builder().build(), requestOptions); + } + + /** + * Resumes a paused ad campaign. + */ + public WhopApiHttpResponse unpause(String id, UnpauseAdCampaignsRequest request) { + return unpause(id, request, null); + } + + /** + * Resumes a paused ad campaign. + */ + public WhopApiHttpResponse unpause( + String id, UnpauseAdCampaignsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_campaigns") + .addPathSegment(id) + .addPathSegments("unpause"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdCampaign.class), response); + } + try { + if (response.code() == 409) { + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/requests/CreateAdCampaignsRequest.java b/src/main/java/com/whop/api/resources/adcampaigns/requests/CreateAdCampaignsRequest.java new file mode 100644 index 00000000..ff28fdc4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/requests/CreateAdCampaignsRequest.java @@ -0,0 +1,625 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.adcampaigns.types.CreateAdCampaignsRequestBidType; +import com.whop.api.resources.adcampaigns.types.CreateAdCampaignsRequestBudgetOptimization; +import com.whop.api.resources.adcampaigns.types.CreateAdCampaignsRequestBudgetType; +import com.whop.api.resources.adcampaigns.types.CreateAdCampaignsRequestObjective; +import com.whop.api.resources.adcampaigns.types.CreateAdCampaignsRequestPlatform; +import com.whop.api.resources.adcampaigns.types.CreateAdCampaignsRequestSpecialAdCategoriesItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdCampaignsRequest.Builder.class) +public final class CreateAdCampaignsRequest { + private final Optional accountId; + + private final Optional bidType; + + private final Optional budgetAmount; + + private final Optional budgetOptimization; + + private final Optional budgetType; + + private final Optional desiredCostPerResult; + + private final Optional endsAt; + + private final CreateAdCampaignsRequestObjective objective; + + private final CreateAdCampaignsRequestPlatform platform; + + private final Optional> specialAdCategories; + + private final Optional startsAt; + + private final String title; + + private final Map additionalProperties; + + private CreateAdCampaignsRequest( + Optional accountId, + Optional bidType, + Optional budgetAmount, + Optional budgetOptimization, + Optional budgetType, + Optional desiredCostPerResult, + Optional endsAt, + CreateAdCampaignsRequestObjective objective, + CreateAdCampaignsRequestPlatform platform, + Optional> specialAdCategories, + Optional startsAt, + String title, + Map additionalProperties) { + this.accountId = accountId; + this.bidType = bidType; + this.budgetAmount = budgetAmount; + this.budgetOptimization = budgetOptimization; + this.budgetType = budgetType; + this.desiredCostPerResult = desiredCostPerResult; + this.endsAt = endsAt; + this.objective = objective; + this.platform = platform; + this.specialAdCategories = specialAdCategories; + this.startsAt = startsAt; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account to create the campaign under. Defaults to the account-scoped key's own account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return How delivery bids in the ad auction: minimum_cost gets the most results for the budget, average_target holds an average cost per result, maximum_target never bids above a cap. Only for campaigns that own the budget. + */ + @JsonProperty("bid_type") + public Optional getBidType() { + return bidType; + } + + /** + * @return The campaign's budget, in the ad account's currency. Required when budget_optimization is ad_campaign; omit when each ad group sets its own budget. + */ + @JsonProperty("budget_amount") + public Optional getBudgetAmount() { + return budgetAmount; + } + + /** + * @return Which level owns the budget: the whole campaign (ad_campaign) or each ad group individually (ad_group). Defaults to ad_group. + */ + @JsonProperty("budget_optimization") + public Optional getBudgetOptimization() { + return budgetOptimization; + } + + /** + * @return Whether the budget is spent per day (daily) or over the campaign's full run (lifetime). Defaults to daily. + */ + @JsonProperty("budget_type") + public Optional getBudgetType() { + return budgetType; + } + + /** + * @return Cost per result to aim for (average_target) or never exceed (maximum_target). Only for campaigns that own the budget. + */ + @JsonProperty("desired_cost_per_result") + public Optional getDesiredCostPerResult() { + return desiredCostPerResult; + } + + /** + * @return When the campaign stops delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget. + */ + @JsonProperty("ends_at") + public Optional getEndsAt() { + return endsAt; + } + + /** + * @return The goal the campaign optimizes toward. + */ + @JsonProperty("objective") + public CreateAdCampaignsRequestObjective getObjective() { + return objective; + } + + /** + * @return The ad network the campaign runs on. + */ + @JsonProperty("platform") + public CreateAdCampaignsRequestPlatform getPlatform() { + return platform; + } + + /** + * @return Regulated categories the campaign falls under. Ads in these categories are subject to extra targeting restrictions. + */ + @JsonProperty("special_ad_categories") + public Optional> getSpecialAdCategories() { + return specialAdCategories; + } + + /** + * @return When the campaign starts delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget. + */ + @JsonProperty("starts_at") + public Optional getStartsAt() { + return startsAt; + } + + /** + * @return The title of the campaign. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdCampaignsRequest && equalTo((CreateAdCampaignsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdCampaignsRequest other) { + return accountId.equals(other.accountId) + && bidType.equals(other.bidType) + && budgetAmount.equals(other.budgetAmount) + && budgetOptimization.equals(other.budgetOptimization) + && budgetType.equals(other.budgetType) + && desiredCostPerResult.equals(other.desiredCostPerResult) + && endsAt.equals(other.endsAt) + && objective.equals(other.objective) + && platform.equals(other.platform) + && specialAdCategories.equals(other.specialAdCategories) + && startsAt.equals(other.startsAt) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.bidType, + this.budgetAmount, + this.budgetOptimization, + this.budgetType, + this.desiredCostPerResult, + this.endsAt, + this.objective, + this.platform, + this.specialAdCategories, + this.startsAt, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ObjectiveStage builder() { + return new Builder(); + } + + public interface ObjectiveStage { + /** + *

The goal the campaign optimizes toward.

+ */ + PlatformStage objective(@NotNull CreateAdCampaignsRequestObjective objective); + + Builder from(CreateAdCampaignsRequest other); + } + + public interface PlatformStage { + /** + *

The ad network the campaign runs on.

+ */ + TitleStage platform(@NotNull CreateAdCampaignsRequestPlatform platform); + } + + public interface TitleStage { + /** + *

The title of the campaign.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + CreateAdCampaignsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account to create the campaign under. Defaults to the account-scoped key's own account.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + /** + *

How delivery bids in the ad auction: minimum_cost gets the most results for the budget, average_target holds an average cost per result, maximum_target never bids above a cap. Only for campaigns that own the budget.

+ */ + _FinalStage bidType(Optional bidType); + + _FinalStage bidType(CreateAdCampaignsRequestBidType bidType); + + /** + *

The campaign's budget, in the ad account's currency. Required when budget_optimization is ad_campaign; omit when each ad group sets its own budget.

+ */ + _FinalStage budgetAmount(Optional budgetAmount); + + _FinalStage budgetAmount(Double budgetAmount); + + /** + *

Which level owns the budget: the whole campaign (ad_campaign) or each ad group individually (ad_group). Defaults to ad_group.

+ */ + _FinalStage budgetOptimization(Optional budgetOptimization); + + _FinalStage budgetOptimization(CreateAdCampaignsRequestBudgetOptimization budgetOptimization); + + /** + *

Whether the budget is spent per day (daily) or over the campaign's full run (lifetime). Defaults to daily.

+ */ + _FinalStage budgetType(Optional budgetType); + + _FinalStage budgetType(CreateAdCampaignsRequestBudgetType budgetType); + + /** + *

Cost per result to aim for (average_target) or never exceed (maximum_target). Only for campaigns that own the budget.

+ */ + _FinalStage desiredCostPerResult(Optional desiredCostPerResult); + + _FinalStage desiredCostPerResult(Double desiredCostPerResult); + + /** + *

When the campaign stops delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget.

+ */ + _FinalStage endsAt(Optional endsAt); + + _FinalStage endsAt(String endsAt); + + /** + *

Regulated categories the campaign falls under. Ads in these categories are subject to extra targeting restrictions.

+ */ + _FinalStage specialAdCategories( + Optional> specialAdCategories); + + _FinalStage specialAdCategories(List specialAdCategories); + + /** + *

When the campaign starts delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget.

+ */ + _FinalStage startsAt(Optional startsAt); + + _FinalStage startsAt(String startsAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ObjectiveStage, PlatformStage, TitleStage, _FinalStage { + private CreateAdCampaignsRequestObjective objective; + + private CreateAdCampaignsRequestPlatform platform; + + private String title; + + private Optional startsAt = Optional.empty(); + + private Optional> specialAdCategories = Optional.empty(); + + private Optional endsAt = Optional.empty(); + + private Optional desiredCostPerResult = Optional.empty(); + + private Optional budgetType = Optional.empty(); + + private Optional budgetOptimization = Optional.empty(); + + private Optional budgetAmount = Optional.empty(); + + private Optional bidType = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAdCampaignsRequest other) { + accountId(other.getAccountId()); + bidType(other.getBidType()); + budgetAmount(other.getBudgetAmount()); + budgetOptimization(other.getBudgetOptimization()); + budgetType(other.getBudgetType()); + desiredCostPerResult(other.getDesiredCostPerResult()); + endsAt(other.getEndsAt()); + objective(other.getObjective()); + platform(other.getPlatform()); + specialAdCategories(other.getSpecialAdCategories()); + startsAt(other.getStartsAt()); + title(other.getTitle()); + return this; + } + + /** + *

The goal the campaign optimizes toward.

+ *

The goal the campaign optimizes toward.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("objective") + public PlatformStage objective(@NotNull CreateAdCampaignsRequestObjective objective) { + this.objective = Objects.requireNonNull(objective, "objective must not be null"); + return this; + } + + /** + *

The ad network the campaign runs on.

+ *

The ad network the campaign runs on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public TitleStage platform(@NotNull CreateAdCampaignsRequestPlatform platform) { + this.platform = Objects.requireNonNull(platform, "platform must not be null"); + return this; + } + + /** + *

The title of the campaign.

+ *

The title of the campaign.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

When the campaign starts delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startsAt(String startsAt) { + this.startsAt = Optional.ofNullable(startsAt); + return this; + } + + /** + *

When the campaign starts delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget.

+ */ + @java.lang.Override + @JsonSetter(value = "starts_at", nulls = Nulls.SKIP) + public _FinalStage startsAt(Optional startsAt) { + this.startsAt = startsAt; + return this; + } + + /** + *

Regulated categories the campaign falls under. Ads in these categories are subject to extra targeting restrictions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage specialAdCategories( + List specialAdCategories) { + this.specialAdCategories = Optional.ofNullable(specialAdCategories); + return this; + } + + /** + *

Regulated categories the campaign falls under. Ads in these categories are subject to extra targeting restrictions.

+ */ + @java.lang.Override + @JsonSetter(value = "special_ad_categories", nulls = Nulls.SKIP) + public _FinalStage specialAdCategories( + Optional> specialAdCategories) { + this.specialAdCategories = specialAdCategories; + return this; + } + + /** + *

When the campaign stops delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endsAt(String endsAt) { + this.endsAt = Optional.ofNullable(endsAt); + return this; + } + + /** + *

When the campaign stops delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget.

+ */ + @java.lang.Override + @JsonSetter(value = "ends_at", nulls = Nulls.SKIP) + public _FinalStage endsAt(Optional endsAt) { + this.endsAt = endsAt; + return this; + } + + /** + *

Cost per result to aim for (average_target) or never exceed (maximum_target). Only for campaigns that own the budget.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage desiredCostPerResult(Double desiredCostPerResult) { + this.desiredCostPerResult = Optional.ofNullable(desiredCostPerResult); + return this; + } + + /** + *

Cost per result to aim for (average_target) or never exceed (maximum_target). Only for campaigns that own the budget.

+ */ + @java.lang.Override + @JsonSetter(value = "desired_cost_per_result", nulls = Nulls.SKIP) + public _FinalStage desiredCostPerResult(Optional desiredCostPerResult) { + this.desiredCostPerResult = desiredCostPerResult; + return this; + } + + /** + *

Whether the budget is spent per day (daily) or over the campaign's full run (lifetime). Defaults to daily.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage budgetType(CreateAdCampaignsRequestBudgetType budgetType) { + this.budgetType = Optional.ofNullable(budgetType); + return this; + } + + /** + *

Whether the budget is spent per day (daily) or over the campaign's full run (lifetime). Defaults to daily.

+ */ + @java.lang.Override + @JsonSetter(value = "budget_type", nulls = Nulls.SKIP) + public _FinalStage budgetType(Optional budgetType) { + this.budgetType = budgetType; + return this; + } + + /** + *

Which level owns the budget: the whole campaign (ad_campaign) or each ad group individually (ad_group). Defaults to ad_group.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage budgetOptimization(CreateAdCampaignsRequestBudgetOptimization budgetOptimization) { + this.budgetOptimization = Optional.ofNullable(budgetOptimization); + return this; + } + + /** + *

Which level owns the budget: the whole campaign (ad_campaign) or each ad group individually (ad_group). Defaults to ad_group.

+ */ + @java.lang.Override + @JsonSetter(value = "budget_optimization", nulls = Nulls.SKIP) + public _FinalStage budgetOptimization(Optional budgetOptimization) { + this.budgetOptimization = budgetOptimization; + return this; + } + + /** + *

The campaign's budget, in the ad account's currency. Required when budget_optimization is ad_campaign; omit when each ad group sets its own budget.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage budgetAmount(Double budgetAmount) { + this.budgetAmount = Optional.ofNullable(budgetAmount); + return this; + } + + /** + *

The campaign's budget, in the ad account's currency. Required when budget_optimization is ad_campaign; omit when each ad group sets its own budget.

+ */ + @java.lang.Override + @JsonSetter(value = "budget_amount", nulls = Nulls.SKIP) + public _FinalStage budgetAmount(Optional budgetAmount) { + this.budgetAmount = budgetAmount; + return this; + } + + /** + *

How delivery bids in the ad auction: minimum_cost gets the most results for the budget, average_target holds an average cost per result, maximum_target never bids above a cap. Only for campaigns that own the budget.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bidType(CreateAdCampaignsRequestBidType bidType) { + this.bidType = Optional.ofNullable(bidType); + return this; + } + + /** + *

How delivery bids in the ad auction: minimum_cost gets the most results for the budget, average_target holds an average cost per result, maximum_target never bids above a cap. Only for campaigns that own the budget.

+ */ + @java.lang.Override + @JsonSetter(value = "bid_type", nulls = Nulls.SKIP) + public _FinalStage bidType(Optional bidType) { + this.bidType = bidType; + return this; + } + + /** + *

The account to create the campaign under. Defaults to the account-scoped key's own account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account to create the campaign under. Defaults to the account-scoped key's own account.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public CreateAdCampaignsRequest build() { + return new CreateAdCampaignsRequest( + accountId, + bidType, + budgetAmount, + budgetOptimization, + budgetType, + desiredCostPerResult, + endsAt, + objective, + platform, + specialAdCategories, + startsAt, + title, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/requests/DeleteAdCampaignsRequest.java b/src/main/java/com/whop/api/resources/adcampaigns/requests/DeleteAdCampaignsRequest.java new file mode 100644 index 00000000..f052a100 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/requests/DeleteAdCampaignsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteAdCampaignsRequest.Builder.class) +public final class DeleteAdCampaignsRequest { + private final Map additionalProperties; + + private DeleteAdCampaignsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteAdCampaignsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteAdCampaignsRequest other) { + return this; + } + + public DeleteAdCampaignsRequest build() { + return new DeleteAdCampaignsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/requests/DuplicateAdCampaignsRequest.java b/src/main/java/com/whop/api/resources/adcampaigns/requests/DuplicateAdCampaignsRequest.java new file mode 100644 index 00000000..cd050145 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/requests/DuplicateAdCampaignsRequest.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DuplicateAdCampaignsRequest.Builder.class) +public final class DuplicateAdCampaignsRequest { + private final Optional count; + + private final Optional preserveEngagement; + + private final Map additionalProperties; + + private DuplicateAdCampaignsRequest( + Optional count, Optional preserveEngagement, Map additionalProperties) { + this.count = count; + this.preserveEngagement = preserveEngagement; + this.additionalProperties = additionalProperties; + } + + /** + * @return Number of copies to create (1-10). Defaults to 1. + */ + @JsonProperty("count") + public Optional getCount() { + return count; + } + + /** + * @return Whether the copied ads keep the original posts' engagement (likes, comments, shares). Defaults to false. + */ + @JsonProperty("preserve_engagement") + public Optional getPreserveEngagement() { + return preserveEngagement; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DuplicateAdCampaignsRequest && equalTo((DuplicateAdCampaignsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DuplicateAdCampaignsRequest other) { + return count.equals(other.count) && preserveEngagement.equals(other.preserveEngagement); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.count, this.preserveEngagement); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional count = Optional.empty(); + + private Optional preserveEngagement = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DuplicateAdCampaignsRequest other) { + count(other.getCount()); + preserveEngagement(other.getPreserveEngagement()); + return this; + } + + /** + *

Number of copies to create (1-10). Defaults to 1.

+ */ + @JsonSetter(value = "count", nulls = Nulls.SKIP) + public Builder count(Optional count) { + this.count = count; + return this; + } + + public Builder count(Integer count) { + this.count = Optional.ofNullable(count); + return this; + } + + /** + *

Whether the copied ads keep the original posts' engagement (likes, comments, shares). Defaults to false.

+ */ + @JsonSetter(value = "preserve_engagement", nulls = Nulls.SKIP) + public Builder preserveEngagement(Optional preserveEngagement) { + this.preserveEngagement = preserveEngagement; + return this; + } + + public Builder preserveEngagement(Boolean preserveEngagement) { + this.preserveEngagement = Optional.ofNullable(preserveEngagement); + return this; + } + + public DuplicateAdCampaignsRequest build() { + return new DuplicateAdCampaignsRequest(count, preserveEngagement, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/requests/ListAdCampaignsRequest.java b/src/main/java/com/whop/api/resources/adcampaigns/requests/ListAdCampaignsRequest.java new file mode 100644 index 00000000..5fb2653a --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/requests/ListAdCampaignsRequest.java @@ -0,0 +1,568 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.adcampaigns.types.ListAdCampaignsRequestAttributionModel; +import com.whop.api.resources.adcampaigns.types.ListAdCampaignsRequestDirection; +import com.whop.api.resources.adcampaigns.types.ListAdCampaignsRequestOrder; +import com.whop.api.resources.adcampaigns.types.ListAdCampaignsRequestStatus; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAdCampaignsRequest.Builder.class) +public final class ListAdCampaignsRequest { + private final Optional accountId; + + private final Optional status; + + private final Optional query; + + private final Optional order; + + private final Optional direction; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional statsFrom; + + private final Optional statsTo; + + private final Optional timeZone; + + private final Optional attributionModel; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListAdCampaignsRequest( + Optional accountId, + Optional status, + Optional query, + Optional order, + Optional direction, + Optional createdBefore, + Optional createdAfter, + Optional statsFrom, + Optional statsTo, + Optional timeZone, + Optional attributionModel, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.accountId = accountId; + this.status = status; + this.query = query; + this.order = order; + this.direction = direction; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.statsFrom = statsFrom; + this.statsTo = statsTo; + this.timeZone = timeZone; + this.attributionModel = attributionModel; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account the campaigns belong to. Defaults to the account-scoped key's own account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Only return campaigns with this status. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Filter campaigns by a title or ID substring. + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + /** + * @return The field to sort by. Defaults to created_at. Stat columns (spend, impressions, …) rank over the stats_from/stats_to window across the whole list, not just the current page. results, cost_per_result and return_on_ad_spend rank by the same Whop pixel-attributed values the response reports. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return The sort direction. Defaults to desc. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Only return campaigns created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return campaigns created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Start of the stats window. Defaults to all-time. + */ + @JsonProperty("stats_from") + public Optional getStatsFrom() { + return statsFrom; + } + + /** + * @return End of the stats window. Defaults to now. + */ + @JsonProperty("stats_to") + public Optional getStatsTo() { + return statsTo; + } + + /** + * @return IANA timezone (e.g. America/New_York) the stats window is interpreted in. Bare stats_from/stats_to dates resolve to day boundaries on this clock. Defaults to UTC. + */ + @JsonProperty("time_zone") + public Optional getTimeZone() { + return timeZone; + } + + /** + * @return Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise. + */ + @JsonProperty("attribution_model") + public Optional getAttributionModel() { + return attributionModel; + } + + /** + * @return The number of campaigns to return. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to fetch the page after (from page_info.end_cursor). + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of campaigns to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to fetch the page before (from page_info.start_cursor). + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAdCampaignsRequest && equalTo((ListAdCampaignsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAdCampaignsRequest other) { + return accountId.equals(other.accountId) + && status.equals(other.status) + && query.equals(other.query) + && order.equals(other.order) + && direction.equals(other.direction) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && statsFrom.equals(other.statsFrom) + && statsTo.equals(other.statsTo) + && timeZone.equals(other.timeZone) + && attributionModel.equals(other.attributionModel) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.status, + this.query, + this.order, + this.direction, + this.createdBefore, + this.createdAfter, + this.statsFrom, + this.statsTo, + this.timeZone, + this.attributionModel, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional query = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional statsFrom = Optional.empty(); + + private Optional statsTo = Optional.empty(); + + private Optional timeZone = Optional.empty(); + + private Optional attributionModel = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListAdCampaignsRequest other) { + accountId(other.getAccountId()); + status(other.getStatus()); + query(other.getQuery()); + order(other.getOrder()); + direction(other.getDirection()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + statsFrom(other.getStatsFrom()); + statsTo(other.getStatsTo()); + timeZone(other.getTimeZone()); + attributionModel(other.getAttributionModel()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

The account the campaigns belong to. Defaults to the account-scoped key's own account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Only return campaigns with this status.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListAdCampaignsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Filter campaigns by a title or ID substring.

+ */ + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public Builder query(Optional query) { + this.query = query; + return this; + } + + public Builder query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + /** + *

The field to sort by. Defaults to created_at. Stat columns (spend, impressions, …) rank over the stats_from/stats_to window across the whole list, not just the current page. results, cost_per_result and return_on_ad_spend rank by the same Whop pixel-attributed values the response reports.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListAdCampaignsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The sort direction. Defaults to desc.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListAdCampaignsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Only return campaigns created before this timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return campaigns created after this timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Start of the stats window. Defaults to all-time.

+ */ + @JsonSetter(value = "stats_from", nulls = Nulls.SKIP) + public Builder statsFrom(Optional statsFrom) { + this.statsFrom = statsFrom; + return this; + } + + public Builder statsFrom(String statsFrom) { + this.statsFrom = Optional.ofNullable(statsFrom); + return this; + } + + /** + *

End of the stats window. Defaults to now.

+ */ + @JsonSetter(value = "stats_to", nulls = Nulls.SKIP) + public Builder statsTo(Optional statsTo) { + this.statsTo = statsTo; + return this; + } + + public Builder statsTo(String statsTo) { + this.statsTo = Optional.ofNullable(statsTo); + return this; + } + + /** + *

IANA timezone (e.g. America/New_York) the stats window is interpreted in. Bare stats_from/stats_to dates resolve to day boundaries on this clock. Defaults to UTC.

+ */ + @JsonSetter(value = "time_zone", nulls = Nulls.SKIP) + public Builder timeZone(Optional timeZone) { + this.timeZone = timeZone; + return this; + } + + public Builder timeZone(String timeZone) { + this.timeZone = Optional.ofNullable(timeZone); + return this; + } + + /** + *

Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise.

+ */ + @JsonSetter(value = "attribution_model", nulls = Nulls.SKIP) + public Builder attributionModel(Optional attributionModel) { + this.attributionModel = attributionModel; + return this; + } + + public Builder attributionModel(ListAdCampaignsRequestAttributionModel attributionModel) { + this.attributionModel = Optional.ofNullable(attributionModel); + return this; + } + + /** + *

The number of campaigns to return.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The number of campaigns to return from the end of the range.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to fetch the page before (from page_info.start_cursor).

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListAdCampaignsRequest build() { + return new ListAdCampaignsRequest( + accountId, + status, + query, + order, + direction, + createdBefore, + createdAfter, + statsFrom, + statsTo, + timeZone, + attributionModel, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/requests/PauseAdCampaignsRequest.java b/src/main/java/com/whop/api/resources/adcampaigns/requests/PauseAdCampaignsRequest.java new file mode 100644 index 00000000..66e0c443 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/requests/PauseAdCampaignsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PauseAdCampaignsRequest.Builder.class) +public final class PauseAdCampaignsRequest { + private final Map additionalProperties; + + private PauseAdCampaignsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PauseAdCampaignsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PauseAdCampaignsRequest other) { + return this; + } + + public PauseAdCampaignsRequest build() { + return new PauseAdCampaignsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/requests/RetrieveAdCampaignsRequest.java b/src/main/java/com/whop/api/resources/adcampaigns/requests/RetrieveAdCampaignsRequest.java new file mode 100644 index 00000000..51bf26e6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/requests/RetrieveAdCampaignsRequest.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.adcampaigns.types.RetrieveAdCampaignsRequestAttributionModel; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveAdCampaignsRequest.Builder.class) +public final class RetrieveAdCampaignsRequest { + private final Optional statsFrom; + + private final Optional statsTo; + + private final Optional timeZone; + + private final Optional attributionModel; + + private final Map additionalProperties; + + private RetrieveAdCampaignsRequest( + Optional statsFrom, + Optional statsTo, + Optional timeZone, + Optional attributionModel, + Map additionalProperties) { + this.statsFrom = statsFrom; + this.statsTo = statsTo; + this.timeZone = timeZone; + this.attributionModel = attributionModel; + this.additionalProperties = additionalProperties; + } + + /** + * @return Start of the stats window. + */ + @JsonProperty("stats_from") + public Optional getStatsFrom() { + return statsFrom; + } + + /** + * @return End of the stats window. + */ + @JsonProperty("stats_to") + public Optional getStatsTo() { + return statsTo; + } + + /** + * @return IANA timezone the stats window is interpreted in. Defaults to UTC. + */ + @JsonProperty("time_zone") + public Optional getTimeZone() { + return timeZone; + } + + /** + * @return Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise. + */ + @JsonProperty("attribution_model") + public Optional getAttributionModel() { + return attributionModel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveAdCampaignsRequest && equalTo((RetrieveAdCampaignsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveAdCampaignsRequest other) { + return statsFrom.equals(other.statsFrom) + && statsTo.equals(other.statsTo) + && timeZone.equals(other.timeZone) + && attributionModel.equals(other.attributionModel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.statsFrom, this.statsTo, this.timeZone, this.attributionModel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional statsFrom = Optional.empty(); + + private Optional statsTo = Optional.empty(); + + private Optional timeZone = Optional.empty(); + + private Optional attributionModel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveAdCampaignsRequest other) { + statsFrom(other.getStatsFrom()); + statsTo(other.getStatsTo()); + timeZone(other.getTimeZone()); + attributionModel(other.getAttributionModel()); + return this; + } + + /** + *

Start of the stats window.

+ */ + @JsonSetter(value = "stats_from", nulls = Nulls.SKIP) + public Builder statsFrom(Optional statsFrom) { + this.statsFrom = statsFrom; + return this; + } + + public Builder statsFrom(String statsFrom) { + this.statsFrom = Optional.ofNullable(statsFrom); + return this; + } + + /** + *

End of the stats window.

+ */ + @JsonSetter(value = "stats_to", nulls = Nulls.SKIP) + public Builder statsTo(Optional statsTo) { + this.statsTo = statsTo; + return this; + } + + public Builder statsTo(String statsTo) { + this.statsTo = Optional.ofNullable(statsTo); + return this; + } + + /** + *

IANA timezone the stats window is interpreted in. Defaults to UTC.

+ */ + @JsonSetter(value = "time_zone", nulls = Nulls.SKIP) + public Builder timeZone(Optional timeZone) { + this.timeZone = timeZone; + return this; + } + + public Builder timeZone(String timeZone) { + this.timeZone = Optional.ofNullable(timeZone); + return this; + } + + /** + *

Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise.

+ */ + @JsonSetter(value = "attribution_model", nulls = Nulls.SKIP) + public Builder attributionModel(Optional attributionModel) { + this.attributionModel = attributionModel; + return this; + } + + public Builder attributionModel(RetrieveAdCampaignsRequestAttributionModel attributionModel) { + this.attributionModel = Optional.ofNullable(attributionModel); + return this; + } + + public RetrieveAdCampaignsRequest build() { + return new RetrieveAdCampaignsRequest(statsFrom, statsTo, timeZone, attributionModel, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/requests/RetryPaymentAdCampaignsRequest.java b/src/main/java/com/whop/api/resources/adcampaigns/requests/RetryPaymentAdCampaignsRequest.java new file mode 100644 index 00000000..9eb466d0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/requests/RetryPaymentAdCampaignsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetryPaymentAdCampaignsRequest.Builder.class) +public final class RetryPaymentAdCampaignsRequest { + private final Map additionalProperties; + + private RetryPaymentAdCampaignsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetryPaymentAdCampaignsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetryPaymentAdCampaignsRequest other) { + return this; + } + + public RetryPaymentAdCampaignsRequest build() { + return new RetryPaymentAdCampaignsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/requests/UnpauseAdCampaignsRequest.java b/src/main/java/com/whop/api/resources/adcampaigns/requests/UnpauseAdCampaignsRequest.java new file mode 100644 index 00000000..0e5593b3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/requests/UnpauseAdCampaignsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UnpauseAdCampaignsRequest.Builder.class) +public final class UnpauseAdCampaignsRequest { + private final Map additionalProperties; + + private UnpauseAdCampaignsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UnpauseAdCampaignsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UnpauseAdCampaignsRequest other) { + return this; + } + + public UnpauseAdCampaignsRequest build() { + return new UnpauseAdCampaignsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/requests/UpdateAdCampaignsRequest.java b/src/main/java/com/whop/api/resources/adcampaigns/requests/UpdateAdCampaignsRequest.java new file mode 100644 index 00000000..eb0902c8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/requests/UpdateAdCampaignsRequest.java @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.adcampaigns.types.UpdateAdCampaignsRequestBidType; +import com.whop.api.resources.adcampaigns.types.UpdateAdCampaignsRequestBudgetOptimization; +import com.whop.api.resources.adcampaigns.types.UpdateAdCampaignsRequestSpecialAdCategoriesItem; +import com.whop.api.resources.adcampaigns.types.UpdateAdCampaignsRequestStatus; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdCampaignsRequest.Builder.class) +public final class UpdateAdCampaignsRequest { + private final Optional bidType; + + private final Optional budgetAmount; + + private final Optional budgetOptimization; + + private final Optional endsAt; + + private final Optional> specialAdCategories; + + private final Optional startsAt; + + private final Optional status; + + private final Optional title; + + private final Map additionalProperties; + + private UpdateAdCampaignsRequest( + Optional bidType, + Optional budgetAmount, + Optional budgetOptimization, + Optional endsAt, + Optional> specialAdCategories, + Optional startsAt, + Optional status, + Optional title, + Map additionalProperties) { + this.bidType = bidType; + this.budgetAmount = budgetAmount; + this.budgetOptimization = budgetOptimization; + this.endsAt = endsAt; + this.specialAdCategories = specialAdCategories; + this.startsAt = startsAt; + this.status = status; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return How delivery bids in the ad auction: minimum_cost gets the most results for the budget, average_target holds an average cost per result, maximum_target never bids above a cap. Switching to minimum_cost clears the cap amounts stored on the campaign's ad groups. Only for campaigns that own the budget. + */ + @JsonProperty("bid_type") + public Optional getBidType() { + return bidType; + } + + /** + * @return The campaign budget, in the account's currency. Interpreted as daily or lifetime per the campaign's existing budget type. + */ + @JsonProperty("budget_amount") + public Optional getBudgetAmount() { + return budgetAmount; + } + + /** + * @return Which level owns the budget: the whole campaign (ad_campaign) or each ad group individually (ad_group). Only changeable before the campaign is live on the ad network; switching to ad_campaign requires budget_amount in the same request, and switching to ad_group clears the campaign budget. + */ + @JsonProperty("budget_optimization") + public Optional getBudgetOptimization() { + return budgetOptimization; + } + + /** + * @return When the campaign stops delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget. + */ + @JsonProperty("ends_at") + public Optional getEndsAt() { + return endsAt; + } + + /** + * @return Regulated categories the campaign falls under. Editable on any campaign, draft or launched; pass an empty array to clear. + */ + @JsonProperty("special_ad_categories") + public Optional> getSpecialAdCategories() { + return specialAdCategories; + } + + /** + * @return When the campaign starts delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget. + */ + @JsonProperty("starts_at") + public Optional getStartsAt() { + return startsAt; + } + + /** + * @return Set to active to launch a draft campaign (moderates and pushes it live). Live-campaign pause and resume use the pause and unpause actions. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return The name of the campaign. + */ + @JsonProperty("title") + public Optional getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdCampaignsRequest && equalTo((UpdateAdCampaignsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdCampaignsRequest other) { + return bidType.equals(other.bidType) + && budgetAmount.equals(other.budgetAmount) + && budgetOptimization.equals(other.budgetOptimization) + && endsAt.equals(other.endsAt) + && specialAdCategories.equals(other.specialAdCategories) + && startsAt.equals(other.startsAt) + && status.equals(other.status) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bidType, + this.budgetAmount, + this.budgetOptimization, + this.endsAt, + this.specialAdCategories, + this.startsAt, + this.status, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional bidType = Optional.empty(); + + private Optional budgetAmount = Optional.empty(); + + private Optional budgetOptimization = Optional.empty(); + + private Optional endsAt = Optional.empty(); + + private Optional> specialAdCategories = Optional.empty(); + + private Optional startsAt = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdCampaignsRequest other) { + bidType(other.getBidType()); + budgetAmount(other.getBudgetAmount()); + budgetOptimization(other.getBudgetOptimization()); + endsAt(other.getEndsAt()); + specialAdCategories(other.getSpecialAdCategories()); + startsAt(other.getStartsAt()); + status(other.getStatus()); + title(other.getTitle()); + return this; + } + + /** + *

How delivery bids in the ad auction: minimum_cost gets the most results for the budget, average_target holds an average cost per result, maximum_target never bids above a cap. Switching to minimum_cost clears the cap amounts stored on the campaign's ad groups. Only for campaigns that own the budget.

+ */ + @JsonSetter(value = "bid_type", nulls = Nulls.SKIP) + public Builder bidType(Optional bidType) { + this.bidType = bidType; + return this; + } + + public Builder bidType(UpdateAdCampaignsRequestBidType bidType) { + this.bidType = Optional.ofNullable(bidType); + return this; + } + + /** + *

The campaign budget, in the account's currency. Interpreted as daily or lifetime per the campaign's existing budget type.

+ */ + @JsonSetter(value = "budget_amount", nulls = Nulls.SKIP) + public Builder budgetAmount(Optional budgetAmount) { + this.budgetAmount = budgetAmount; + return this; + } + + public Builder budgetAmount(Double budgetAmount) { + this.budgetAmount = Optional.ofNullable(budgetAmount); + return this; + } + + /** + *

Which level owns the budget: the whole campaign (ad_campaign) or each ad group individually (ad_group). Only changeable before the campaign is live on the ad network; switching to ad_campaign requires budget_amount in the same request, and switching to ad_group clears the campaign budget.

+ */ + @JsonSetter(value = "budget_optimization", nulls = Nulls.SKIP) + public Builder budgetOptimization(Optional budgetOptimization) { + this.budgetOptimization = budgetOptimization; + return this; + } + + public Builder budgetOptimization(UpdateAdCampaignsRequestBudgetOptimization budgetOptimization) { + this.budgetOptimization = Optional.ofNullable(budgetOptimization); + return this; + } + + /** + *

When the campaign stops delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget.

+ */ + @JsonSetter(value = "ends_at", nulls = Nulls.SKIP) + public Builder endsAt(Optional endsAt) { + this.endsAt = endsAt; + return this; + } + + public Builder endsAt(String endsAt) { + this.endsAt = Optional.ofNullable(endsAt); + return this; + } + + /** + *

Regulated categories the campaign falls under. Editable on any campaign, draft or launched; pass an empty array to clear.

+ */ + @JsonSetter(value = "special_ad_categories", nulls = Nulls.SKIP) + public Builder specialAdCategories( + Optional> specialAdCategories) { + this.specialAdCategories = specialAdCategories; + return this; + } + + public Builder specialAdCategories(List specialAdCategories) { + this.specialAdCategories = Optional.ofNullable(specialAdCategories); + return this; + } + + /** + *

When the campaign starts delivering, as an ISO 8601 timestamp. Only for campaigns that own the budget.

+ */ + @JsonSetter(value = "starts_at", nulls = Nulls.SKIP) + public Builder startsAt(Optional startsAt) { + this.startsAt = startsAt; + return this; + } + + public Builder startsAt(String startsAt) { + this.startsAt = Optional.ofNullable(startsAt); + return this; + } + + /** + *

Set to active to launch a draft campaign (moderates and pushes it live). Live-campaign pause and resume use the pause and unpause actions.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(UpdateAdCampaignsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The name of the campaign.

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public UpdateAdCampaignsRequest build() { + return new UpdateAdCampaignsRequest( + bidType, + budgetAmount, + budgetOptimization, + endsAt, + specialAdCategories, + startsAt, + status, + title, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestBidType.java b/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestBidType.java new file mode 100644 index 00000000..d406497f --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestBidType.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdCampaignsRequestBidType { + public static final CreateAdCampaignsRequestBidType AVERAGE_TARGET = + new CreateAdCampaignsRequestBidType(Value.AVERAGE_TARGET, "average_target"); + + public static final CreateAdCampaignsRequestBidType MAXIMUM_TARGET = + new CreateAdCampaignsRequestBidType(Value.MAXIMUM_TARGET, "maximum_target"); + + public static final CreateAdCampaignsRequestBidType MINIMUM_COST = + new CreateAdCampaignsRequestBidType(Value.MINIMUM_COST, "minimum_cost"); + + private final Value value; + + private final String string; + + CreateAdCampaignsRequestBidType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdCampaignsRequestBidType + && this.string.equals(((CreateAdCampaignsRequestBidType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AVERAGE_TARGET: + return visitor.visitAverageTarget(); + case MAXIMUM_TARGET: + return visitor.visitMaximumTarget(); + case MINIMUM_COST: + return visitor.visitMinimumCost(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdCampaignsRequestBidType valueOf(String value) { + switch (value) { + case "average_target": + return AVERAGE_TARGET; + case "maximum_target": + return MAXIMUM_TARGET; + case "minimum_cost": + return MINIMUM_COST; + default: + return new CreateAdCampaignsRequestBidType(Value.UNKNOWN, value); + } + } + + public enum Value { + MINIMUM_COST, + + AVERAGE_TARGET, + + MAXIMUM_TARGET, + + UNKNOWN + } + + public interface Visitor { + T visitMinimumCost(); + + T visitAverageTarget(); + + T visitMaximumTarget(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestBudgetOptimization.java b/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestBudgetOptimization.java new file mode 100644 index 00000000..9e07e144 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestBudgetOptimization.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdCampaignsRequestBudgetOptimization { + public static final CreateAdCampaignsRequestBudgetOptimization AD_GROUP = + new CreateAdCampaignsRequestBudgetOptimization(Value.AD_GROUP, "ad_group"); + + public static final CreateAdCampaignsRequestBudgetOptimization AD_CAMPAIGN = + new CreateAdCampaignsRequestBudgetOptimization(Value.AD_CAMPAIGN, "ad_campaign"); + + private final Value value; + + private final String string; + + CreateAdCampaignsRequestBudgetOptimization(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdCampaignsRequestBudgetOptimization + && this.string.equals(((CreateAdCampaignsRequestBudgetOptimization) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AD_GROUP: + return visitor.visitAdGroup(); + case AD_CAMPAIGN: + return visitor.visitAdCampaign(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdCampaignsRequestBudgetOptimization valueOf(String value) { + switch (value) { + case "ad_group": + return AD_GROUP; + case "ad_campaign": + return AD_CAMPAIGN; + default: + return new CreateAdCampaignsRequestBudgetOptimization(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_CAMPAIGN, + + AD_GROUP, + + UNKNOWN + } + + public interface Visitor { + T visitAdCampaign(); + + T visitAdGroup(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestBudgetType.java b/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestBudgetType.java new file mode 100644 index 00000000..cd87ea20 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestBudgetType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdCampaignsRequestBudgetType { + public static final CreateAdCampaignsRequestBudgetType DAILY = + new CreateAdCampaignsRequestBudgetType(Value.DAILY, "daily"); + + public static final CreateAdCampaignsRequestBudgetType LIFETIME = + new CreateAdCampaignsRequestBudgetType(Value.LIFETIME, "lifetime"); + + private final Value value; + + private final String string; + + CreateAdCampaignsRequestBudgetType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdCampaignsRequestBudgetType + && this.string.equals(((CreateAdCampaignsRequestBudgetType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DAILY: + return visitor.visitDaily(); + case LIFETIME: + return visitor.visitLifetime(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdCampaignsRequestBudgetType valueOf(String value) { + switch (value) { + case "daily": + return DAILY; + case "lifetime": + return LIFETIME; + default: + return new CreateAdCampaignsRequestBudgetType(Value.UNKNOWN, value); + } + } + + public enum Value { + DAILY, + + LIFETIME, + + UNKNOWN + } + + public interface Visitor { + T visitDaily(); + + T visitLifetime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestObjective.java b/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestObjective.java new file mode 100644 index 00000000..5210fd82 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestObjective.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdCampaignsRequestObjective { + public static final CreateAdCampaignsRequestObjective LEADS = + new CreateAdCampaignsRequestObjective(Value.LEADS, "leads"); + + public static final CreateAdCampaignsRequestObjective SALES = + new CreateAdCampaignsRequestObjective(Value.SALES, "sales"); + + public static final CreateAdCampaignsRequestObjective AWARENESS = + new CreateAdCampaignsRequestObjective(Value.AWARENESS, "awareness"); + + public static final CreateAdCampaignsRequestObjective TRAFFIC = + new CreateAdCampaignsRequestObjective(Value.TRAFFIC, "traffic"); + + public static final CreateAdCampaignsRequestObjective ENGAGEMENT = + new CreateAdCampaignsRequestObjective(Value.ENGAGEMENT, "engagement"); + + private final Value value; + + private final String string; + + CreateAdCampaignsRequestObjective(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdCampaignsRequestObjective + && this.string.equals(((CreateAdCampaignsRequestObjective) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LEADS: + return visitor.visitLeads(); + case SALES: + return visitor.visitSales(); + case AWARENESS: + return visitor.visitAwareness(); + case TRAFFIC: + return visitor.visitTraffic(); + case ENGAGEMENT: + return visitor.visitEngagement(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdCampaignsRequestObjective valueOf(String value) { + switch (value) { + case "leads": + return LEADS; + case "sales": + return SALES; + case "awareness": + return AWARENESS; + case "traffic": + return TRAFFIC; + case "engagement": + return ENGAGEMENT; + default: + return new CreateAdCampaignsRequestObjective(Value.UNKNOWN, value); + } + } + + public enum Value { + AWARENESS, + + TRAFFIC, + + ENGAGEMENT, + + LEADS, + + SALES, + + UNKNOWN + } + + public interface Visitor { + T visitAwareness(); + + T visitTraffic(); + + T visitEngagement(); + + T visitLeads(); + + T visitSales(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestPlatform.java b/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestPlatform.java new file mode 100644 index 00000000..18420740 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestPlatform.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdCampaignsRequestPlatform { + public static final CreateAdCampaignsRequestPlatform META = + new CreateAdCampaignsRequestPlatform(Value.META, "meta"); + + private final Value value; + + private final String string; + + CreateAdCampaignsRequestPlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdCampaignsRequestPlatform + && this.string.equals(((CreateAdCampaignsRequestPlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case META: + return visitor.visitMeta(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdCampaignsRequestPlatform valueOf(String value) { + switch (value) { + case "meta": + return META; + default: + return new CreateAdCampaignsRequestPlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + META, + + UNKNOWN + } + + public interface Visitor { + T visitMeta(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestSpecialAdCategoriesItem.java b/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestSpecialAdCategoriesItem.java new file mode 100644 index 00000000..4fb1c1f9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/CreateAdCampaignsRequestSpecialAdCategoriesItem.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdCampaignsRequestSpecialAdCategoriesItem { + public static final CreateAdCampaignsRequestSpecialAdCategoriesItem EMPLOYMENT = + new CreateAdCampaignsRequestSpecialAdCategoriesItem(Value.EMPLOYMENT, "employment"); + + public static final CreateAdCampaignsRequestSpecialAdCategoriesItem HOUSING = + new CreateAdCampaignsRequestSpecialAdCategoriesItem(Value.HOUSING, "housing"); + + public static final CreateAdCampaignsRequestSpecialAdCategoriesItem POLITICS = + new CreateAdCampaignsRequestSpecialAdCategoriesItem(Value.POLITICS, "politics"); + + public static final CreateAdCampaignsRequestSpecialAdCategoriesItem FINANCIAL_PRODUCTS = + new CreateAdCampaignsRequestSpecialAdCategoriesItem(Value.FINANCIAL_PRODUCTS, "financial_products"); + + private final Value value; + + private final String string; + + CreateAdCampaignsRequestSpecialAdCategoriesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdCampaignsRequestSpecialAdCategoriesItem + && this.string.equals(((CreateAdCampaignsRequestSpecialAdCategoriesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EMPLOYMENT: + return visitor.visitEmployment(); + case HOUSING: + return visitor.visitHousing(); + case POLITICS: + return visitor.visitPolitics(); + case FINANCIAL_PRODUCTS: + return visitor.visitFinancialProducts(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdCampaignsRequestSpecialAdCategoriesItem valueOf(String value) { + switch (value) { + case "employment": + return EMPLOYMENT; + case "housing": + return HOUSING; + case "politics": + return POLITICS; + case "financial_products": + return FINANCIAL_PRODUCTS; + default: + return new CreateAdCampaignsRequestSpecialAdCategoriesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + HOUSING, + + EMPLOYMENT, + + FINANCIAL_PRODUCTS, + + POLITICS, + + UNKNOWN + } + + public interface Visitor { + T visitHousing(); + + T visitEmployment(); + + T visitFinancialProducts(); + + T visitPolitics(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/DeleteAdCampaignsResponse.java b/src/main/java/com/whop/api/resources/adcampaigns/types/DeleteAdCampaignsResponse.java new file mode 100644 index 00000000..81e65e32 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/DeleteAdCampaignsResponse.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteAdCampaignsResponse.Builder.class) +public final class DeleteAdCampaignsResponse { + private final boolean deleted; + + private final String id; + + private final Map additionalProperties; + + private DeleteAdCampaignsResponse(boolean deleted, String id, Map additionalProperties) { + this.deleted = deleted; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Always true. + */ + @JsonProperty("deleted") + public boolean getDeleted() { + return deleted; + } + + /** + * @return ID of the deleted ad campaign. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteAdCampaignsResponse && equalTo((DeleteAdCampaignsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteAdCampaignsResponse other) { + return deleted == other.deleted && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deleted, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeletedStage builder() { + return new Builder(); + } + + public interface DeletedStage { + /** + *

Always true.

+ */ + IdStage deleted(boolean deleted); + + Builder from(DeleteAdCampaignsResponse other); + } + + public interface IdStage { + /** + *

ID of the deleted ad campaign.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DeleteAdCampaignsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeletedStage, IdStage, _FinalStage { + private boolean deleted; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeleteAdCampaignsResponse other) { + deleted(other.getDeleted()); + id(other.getId()); + return this; + } + + /** + *

Always true.

+ *

Always true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("deleted") + public IdStage deleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + *

ID of the deleted ad campaign.

+ *

ID of the deleted ad campaign.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DeleteAdCampaignsResponse build() { + return new DeleteAdCampaignsResponse(deleted, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/DuplicateAdCampaignsResponse.java b/src/main/java/com/whop/api/resources/adcampaigns/types/DuplicateAdCampaignsResponse.java new file mode 100644 index 00000000..73947827 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/DuplicateAdCampaignsResponse.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AdCampaign; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DuplicateAdCampaignsResponse.Builder.class) +public final class DuplicateAdCampaignsResponse { + private final List data; + + private final Map additionalProperties; + + private DuplicateAdCampaignsResponse(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DuplicateAdCampaignsResponse && equalTo((DuplicateAdCampaignsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DuplicateAdCampaignsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DuplicateAdCampaignsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(AdCampaign data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public DuplicateAdCampaignsResponse build() { + return new DuplicateAdCampaignsResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsRequestAttributionModel.java b/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsRequestAttributionModel.java new file mode 100644 index 00000000..8cd65996 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsRequestAttributionModel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAdCampaignsRequestAttributionModel { + public static final ListAdCampaignsRequestAttributionModel FIRST_TOUCH = + new ListAdCampaignsRequestAttributionModel(Value.FIRST_TOUCH, "first_touch"); + + public static final ListAdCampaignsRequestAttributionModel LAST_TOUCH = + new ListAdCampaignsRequestAttributionModel(Value.LAST_TOUCH, "last_touch"); + + private final Value value; + + private final String string; + + ListAdCampaignsRequestAttributionModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAdCampaignsRequestAttributionModel + && this.string.equals(((ListAdCampaignsRequestAttributionModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FIRST_TOUCH: + return visitor.visitFirstTouch(); + case LAST_TOUCH: + return visitor.visitLastTouch(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAdCampaignsRequestAttributionModel valueOf(String value) { + switch (value) { + case "first_touch": + return FIRST_TOUCH; + case "last_touch": + return LAST_TOUCH; + default: + return new ListAdCampaignsRequestAttributionModel(Value.UNKNOWN, value); + } + } + + public enum Value { + LAST_TOUCH, + + FIRST_TOUCH, + + UNKNOWN + } + + public interface Visitor { + T visitLastTouch(); + + T visitFirstTouch(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsRequestDirection.java b/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsRequestDirection.java new file mode 100644 index 00000000..647b8726 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAdCampaignsRequestDirection { + public static final ListAdCampaignsRequestDirection ASC = new ListAdCampaignsRequestDirection(Value.ASC, "asc"); + + public static final ListAdCampaignsRequestDirection DESC = new ListAdCampaignsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListAdCampaignsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAdCampaignsRequestDirection + && this.string.equals(((ListAdCampaignsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAdCampaignsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListAdCampaignsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsRequestOrder.java b/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsRequestOrder.java new file mode 100644 index 00000000..58fdf12a --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsRequestOrder.java @@ -0,0 +1,214 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAdCampaignsRequestOrder { + public static final ListAdCampaignsRequestOrder SPEND = new ListAdCampaignsRequestOrder(Value.SPEND, "spend"); + + public static final ListAdCampaignsRequestOrder COST_PER_RESULT = + new ListAdCampaignsRequestOrder(Value.COST_PER_RESULT, "cost_per_result"); + + public static final ListAdCampaignsRequestOrder COST_PER_CLICK = + new ListAdCampaignsRequestOrder(Value.COST_PER_CLICK, "cost_per_click"); + + public static final ListAdCampaignsRequestOrder FREQUENCY = + new ListAdCampaignsRequestOrder(Value.FREQUENCY, "frequency"); + + public static final ListAdCampaignsRequestOrder RESULTS = new ListAdCampaignsRequestOrder(Value.RESULTS, "results"); + + public static final ListAdCampaignsRequestOrder UNIQUE_CLICKS = + new ListAdCampaignsRequestOrder(Value.UNIQUE_CLICKS, "unique_clicks"); + + public static final ListAdCampaignsRequestOrder CLICK_THROUGH_RATE = + new ListAdCampaignsRequestOrder(Value.CLICK_THROUGH_RATE, "click_through_rate"); + + public static final ListAdCampaignsRequestOrder REACH = new ListAdCampaignsRequestOrder(Value.REACH, "reach"); + + public static final ListAdCampaignsRequestOrder UPDATED_AT = + new ListAdCampaignsRequestOrder(Value.UPDATED_AT, "updated_at"); + + public static final ListAdCampaignsRequestOrder COST_PER_MILLE = + new ListAdCampaignsRequestOrder(Value.COST_PER_MILLE, "cost_per_mille"); + + public static final ListAdCampaignsRequestOrder CREATED_AT = + new ListAdCampaignsRequestOrder(Value.CREATED_AT, "created_at"); + + public static final ListAdCampaignsRequestOrder CLICKS = new ListAdCampaignsRequestOrder(Value.CLICKS, "clicks"); + + public static final ListAdCampaignsRequestOrder IMPRESSIONS = + new ListAdCampaignsRequestOrder(Value.IMPRESSIONS, "impressions"); + + public static final ListAdCampaignsRequestOrder RETURN_ON_AD_SPEND = + new ListAdCampaignsRequestOrder(Value.RETURN_ON_AD_SPEND, "return_on_ad_spend"); + + private final Value value; + + private final String string; + + ListAdCampaignsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAdCampaignsRequestOrder + && this.string.equals(((ListAdCampaignsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SPEND: + return visitor.visitSpend(); + case COST_PER_RESULT: + return visitor.visitCostPerResult(); + case COST_PER_CLICK: + return visitor.visitCostPerClick(); + case FREQUENCY: + return visitor.visitFrequency(); + case RESULTS: + return visitor.visitResults(); + case UNIQUE_CLICKS: + return visitor.visitUniqueClicks(); + case CLICK_THROUGH_RATE: + return visitor.visitClickThroughRate(); + case REACH: + return visitor.visitReach(); + case UPDATED_AT: + return visitor.visitUpdatedAt(); + case COST_PER_MILLE: + return visitor.visitCostPerMille(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case CLICKS: + return visitor.visitClicks(); + case IMPRESSIONS: + return visitor.visitImpressions(); + case RETURN_ON_AD_SPEND: + return visitor.visitReturnOnAdSpend(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAdCampaignsRequestOrder valueOf(String value) { + switch (value) { + case "spend": + return SPEND; + case "cost_per_result": + return COST_PER_RESULT; + case "cost_per_click": + return COST_PER_CLICK; + case "frequency": + return FREQUENCY; + case "results": + return RESULTS; + case "unique_clicks": + return UNIQUE_CLICKS; + case "click_through_rate": + return CLICK_THROUGH_RATE; + case "reach": + return REACH; + case "updated_at": + return UPDATED_AT; + case "cost_per_mille": + return COST_PER_MILLE; + case "created_at": + return CREATED_AT; + case "clicks": + return CLICKS; + case "impressions": + return IMPRESSIONS; + case "return_on_ad_spend": + return RETURN_ON_AD_SPEND; + default: + return new ListAdCampaignsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UPDATED_AT, + + SPEND, + + IMPRESSIONS, + + REACH, + + CLICKS, + + UNIQUE_CLICKS, + + FREQUENCY, + + CLICK_THROUGH_RATE, + + RESULTS, + + COST_PER_MILLE, + + COST_PER_CLICK, + + COST_PER_RESULT, + + RETURN_ON_AD_SPEND, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUpdatedAt(); + + T visitSpend(); + + T visitImpressions(); + + T visitReach(); + + T visitClicks(); + + T visitUniqueClicks(); + + T visitFrequency(); + + T visitClickThroughRate(); + + T visitResults(); + + T visitCostPerMille(); + + T visitCostPerClick(); + + T visitCostPerResult(); + + T visitReturnOnAdSpend(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsRequestStatus.java b/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsRequestStatus.java new file mode 100644 index 00000000..2aaa4973 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsRequestStatus.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAdCampaignsRequestStatus { + public static final ListAdCampaignsRequestStatus PAUSED = new ListAdCampaignsRequestStatus(Value.PAUSED, "paused"); + + public static final ListAdCampaignsRequestStatus PAYMENT_FAILED = + new ListAdCampaignsRequestStatus(Value.PAYMENT_FAILED, "payment_failed"); + + public static final ListAdCampaignsRequestStatus DRAFT = new ListAdCampaignsRequestStatus(Value.DRAFT, "draft"); + + public static final ListAdCampaignsRequestStatus ACTIVE = new ListAdCampaignsRequestStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + ListAdCampaignsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAdCampaignsRequestStatus + && this.string.equals(((ListAdCampaignsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAUSED: + return visitor.visitPaused(); + case PAYMENT_FAILED: + return visitor.visitPaymentFailed(); + case DRAFT: + return visitor.visitDraft(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAdCampaignsRequestStatus valueOf(String value) { + switch (value) { + case "paused": + return PAUSED; + case "payment_failed": + return PAYMENT_FAILED; + case "draft": + return DRAFT; + case "active": + return ACTIVE; + default: + return new ListAdCampaignsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + DRAFT, + + ACTIVE, + + PAUSED, + + PAYMENT_FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitDraft(); + + T visitActive(); + + T visitPaused(); + + T visitPaymentFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsResponse.java b/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsResponse.java new file mode 100644 index 00000000..0bbc4c47 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AdCampaign; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAdCampaignsResponse.Builder.class) +public final class ListAdCampaignsResponse { + private final List data; + + private final ListAdCampaignsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListAdCampaignsResponse( + List data, ListAdCampaignsResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListAdCampaignsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAdCampaignsResponse && equalTo((ListAdCampaignsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAdCampaignsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListAdCampaignsResponsePageInfo pageInfo); + + Builder from(ListAdCampaignsResponse other); + } + + public interface _FinalStage { + ListAdCampaignsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(AdCampaign data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListAdCampaignsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAdCampaignsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListAdCampaignsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(AdCampaign data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListAdCampaignsResponse build() { + return new ListAdCampaignsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsResponsePageInfo.java b/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsResponsePageInfo.java new file mode 100644 index 00000000..d30a66df --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/ListAdCampaignsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAdCampaignsResponsePageInfo.Builder.class) +public final class ListAdCampaignsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListAdCampaignsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAdCampaignsResponsePageInfo && equalTo((ListAdCampaignsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAdCampaignsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListAdCampaignsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListAdCampaignsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAdCampaignsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListAdCampaignsResponsePageInfo build() { + return new ListAdCampaignsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/PostAdCampaignPaymentFailedPayload.java b/src/main/java/com/whop/api/resources/adcampaigns/types/PostAdCampaignPaymentFailedPayload.java new file mode 100644 index 00000000..c9c25fb4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/PostAdCampaignPaymentFailedPayload.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AdCampaign; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostAdCampaignPaymentFailedPayload.Builder.class) +public final class PostAdCampaignPaymentFailedPayload { + private final Optional accountId; + + private final PostAdCampaignPaymentFailedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final AdCampaign data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostAdCampaignPaymentFailedPayloadType type; + + private final Map additionalProperties; + + private PostAdCampaignPaymentFailedPayload( + Optional accountId, + PostAdCampaignPaymentFailedPayloadApiVersion apiVersion, + Optional apiVersionDate, + AdCampaign data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostAdCampaignPaymentFailedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostAdCampaignPaymentFailedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public AdCampaign getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostAdCampaignPaymentFailedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostAdCampaignPaymentFailedPayload + && equalTo((PostAdCampaignPaymentFailedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostAdCampaignPaymentFailedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostAdCampaignPaymentFailedPayloadApiVersion apiVersion); + + Builder from(PostAdCampaignPaymentFailedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull AdCampaign data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostAdCampaignPaymentFailedPayloadType type); + } + + public interface _FinalStage { + PostAdCampaignPaymentFailedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostAdCampaignPaymentFailedPayloadApiVersion apiVersion; + + private AdCampaign data; + + private String id; + + private OffsetDateTime timestamp; + + private PostAdCampaignPaymentFailedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostAdCampaignPaymentFailedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostAdCampaignPaymentFailedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull AdCampaign data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostAdCampaignPaymentFailedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostAdCampaignPaymentFailedPayload build() { + return new PostAdCampaignPaymentFailedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/PostAdCampaignPaymentFailedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/adcampaigns/types/PostAdCampaignPaymentFailedPayloadApiVersion.java new file mode 100644 index 00000000..7bbcd11b --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/PostAdCampaignPaymentFailedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostAdCampaignPaymentFailedPayloadApiVersion { + public static final PostAdCampaignPaymentFailedPayloadApiVersion V1 = + new PostAdCampaignPaymentFailedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostAdCampaignPaymentFailedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostAdCampaignPaymentFailedPayloadApiVersion + && this.string.equals(((PostAdCampaignPaymentFailedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostAdCampaignPaymentFailedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostAdCampaignPaymentFailedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/PostAdCampaignPaymentFailedPayloadType.java b/src/main/java/com/whop/api/resources/adcampaigns/types/PostAdCampaignPaymentFailedPayloadType.java new file mode 100644 index 00000000..cda49014 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/PostAdCampaignPaymentFailedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostAdCampaignPaymentFailedPayloadType { + public static final PostAdCampaignPaymentFailedPayloadType AD_CAMPAIGN_PAYMENT_FAILED = + new PostAdCampaignPaymentFailedPayloadType(Value.AD_CAMPAIGN_PAYMENT_FAILED, "ad_campaign.payment_failed"); + + private final Value value; + + private final String string; + + PostAdCampaignPaymentFailedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostAdCampaignPaymentFailedPayloadType + && this.string.equals(((PostAdCampaignPaymentFailedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AD_CAMPAIGN_PAYMENT_FAILED: + return visitor.visitAdCampaignPaymentFailed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostAdCampaignPaymentFailedPayloadType valueOf(String value) { + switch (value) { + case "ad_campaign.payment_failed": + return AD_CAMPAIGN_PAYMENT_FAILED; + default: + return new PostAdCampaignPaymentFailedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_CAMPAIGN_PAYMENT_FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitAdCampaignPaymentFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/RetrieveAdCampaignsRequestAttributionModel.java b/src/main/java/com/whop/api/resources/adcampaigns/types/RetrieveAdCampaignsRequestAttributionModel.java new file mode 100644 index 00000000..d1170627 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/RetrieveAdCampaignsRequestAttributionModel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveAdCampaignsRequestAttributionModel { + public static final RetrieveAdCampaignsRequestAttributionModel FIRST_TOUCH = + new RetrieveAdCampaignsRequestAttributionModel(Value.FIRST_TOUCH, "first_touch"); + + public static final RetrieveAdCampaignsRequestAttributionModel LAST_TOUCH = + new RetrieveAdCampaignsRequestAttributionModel(Value.LAST_TOUCH, "last_touch"); + + private final Value value; + + private final String string; + + RetrieveAdCampaignsRequestAttributionModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveAdCampaignsRequestAttributionModel + && this.string.equals(((RetrieveAdCampaignsRequestAttributionModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FIRST_TOUCH: + return visitor.visitFirstTouch(); + case LAST_TOUCH: + return visitor.visitLastTouch(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveAdCampaignsRequestAttributionModel valueOf(String value) { + switch (value) { + case "first_touch": + return FIRST_TOUCH; + case "last_touch": + return LAST_TOUCH; + default: + return new RetrieveAdCampaignsRequestAttributionModel(Value.UNKNOWN, value); + } + } + + public enum Value { + LAST_TOUCH, + + FIRST_TOUCH, + + UNKNOWN + } + + public interface Visitor { + T visitLastTouch(); + + T visitFirstTouch(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/UpdateAdCampaignsRequestBidType.java b/src/main/java/com/whop/api/resources/adcampaigns/types/UpdateAdCampaignsRequestBidType.java new file mode 100644 index 00000000..c0713918 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/UpdateAdCampaignsRequestBidType.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdCampaignsRequestBidType { + public static final UpdateAdCampaignsRequestBidType AVERAGE_TARGET = + new UpdateAdCampaignsRequestBidType(Value.AVERAGE_TARGET, "average_target"); + + public static final UpdateAdCampaignsRequestBidType MAXIMUM_TARGET = + new UpdateAdCampaignsRequestBidType(Value.MAXIMUM_TARGET, "maximum_target"); + + public static final UpdateAdCampaignsRequestBidType MINIMUM_COST = + new UpdateAdCampaignsRequestBidType(Value.MINIMUM_COST, "minimum_cost"); + + private final Value value; + + private final String string; + + UpdateAdCampaignsRequestBidType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdCampaignsRequestBidType + && this.string.equals(((UpdateAdCampaignsRequestBidType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AVERAGE_TARGET: + return visitor.visitAverageTarget(); + case MAXIMUM_TARGET: + return visitor.visitMaximumTarget(); + case MINIMUM_COST: + return visitor.visitMinimumCost(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdCampaignsRequestBidType valueOf(String value) { + switch (value) { + case "average_target": + return AVERAGE_TARGET; + case "maximum_target": + return MAXIMUM_TARGET; + case "minimum_cost": + return MINIMUM_COST; + default: + return new UpdateAdCampaignsRequestBidType(Value.UNKNOWN, value); + } + } + + public enum Value { + MINIMUM_COST, + + AVERAGE_TARGET, + + MAXIMUM_TARGET, + + UNKNOWN + } + + public interface Visitor { + T visitMinimumCost(); + + T visitAverageTarget(); + + T visitMaximumTarget(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/UpdateAdCampaignsRequestBudgetOptimization.java b/src/main/java/com/whop/api/resources/adcampaigns/types/UpdateAdCampaignsRequestBudgetOptimization.java new file mode 100644 index 00000000..df6621a8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/UpdateAdCampaignsRequestBudgetOptimization.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdCampaignsRequestBudgetOptimization { + public static final UpdateAdCampaignsRequestBudgetOptimization AD_GROUP = + new UpdateAdCampaignsRequestBudgetOptimization(Value.AD_GROUP, "ad_group"); + + public static final UpdateAdCampaignsRequestBudgetOptimization AD_CAMPAIGN = + new UpdateAdCampaignsRequestBudgetOptimization(Value.AD_CAMPAIGN, "ad_campaign"); + + private final Value value; + + private final String string; + + UpdateAdCampaignsRequestBudgetOptimization(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdCampaignsRequestBudgetOptimization + && this.string.equals(((UpdateAdCampaignsRequestBudgetOptimization) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AD_GROUP: + return visitor.visitAdGroup(); + case AD_CAMPAIGN: + return visitor.visitAdCampaign(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdCampaignsRequestBudgetOptimization valueOf(String value) { + switch (value) { + case "ad_group": + return AD_GROUP; + case "ad_campaign": + return AD_CAMPAIGN; + default: + return new UpdateAdCampaignsRequestBudgetOptimization(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_CAMPAIGN, + + AD_GROUP, + + UNKNOWN + } + + public interface Visitor { + T visitAdCampaign(); + + T visitAdGroup(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/UpdateAdCampaignsRequestSpecialAdCategoriesItem.java b/src/main/java/com/whop/api/resources/adcampaigns/types/UpdateAdCampaignsRequestSpecialAdCategoriesItem.java new file mode 100644 index 00000000..ff5514b1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/UpdateAdCampaignsRequestSpecialAdCategoriesItem.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdCampaignsRequestSpecialAdCategoriesItem { + public static final UpdateAdCampaignsRequestSpecialAdCategoriesItem EMPLOYMENT = + new UpdateAdCampaignsRequestSpecialAdCategoriesItem(Value.EMPLOYMENT, "employment"); + + public static final UpdateAdCampaignsRequestSpecialAdCategoriesItem HOUSING = + new UpdateAdCampaignsRequestSpecialAdCategoriesItem(Value.HOUSING, "housing"); + + public static final UpdateAdCampaignsRequestSpecialAdCategoriesItem POLITICS = + new UpdateAdCampaignsRequestSpecialAdCategoriesItem(Value.POLITICS, "politics"); + + public static final UpdateAdCampaignsRequestSpecialAdCategoriesItem FINANCIAL_PRODUCTS = + new UpdateAdCampaignsRequestSpecialAdCategoriesItem(Value.FINANCIAL_PRODUCTS, "financial_products"); + + private final Value value; + + private final String string; + + UpdateAdCampaignsRequestSpecialAdCategoriesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdCampaignsRequestSpecialAdCategoriesItem + && this.string.equals(((UpdateAdCampaignsRequestSpecialAdCategoriesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EMPLOYMENT: + return visitor.visitEmployment(); + case HOUSING: + return visitor.visitHousing(); + case POLITICS: + return visitor.visitPolitics(); + case FINANCIAL_PRODUCTS: + return visitor.visitFinancialProducts(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdCampaignsRequestSpecialAdCategoriesItem valueOf(String value) { + switch (value) { + case "employment": + return EMPLOYMENT; + case "housing": + return HOUSING; + case "politics": + return POLITICS; + case "financial_products": + return FINANCIAL_PRODUCTS; + default: + return new UpdateAdCampaignsRequestSpecialAdCategoriesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + HOUSING, + + EMPLOYMENT, + + FINANCIAL_PRODUCTS, + + POLITICS, + + UNKNOWN + } + + public interface Visitor { + T visitHousing(); + + T visitEmployment(); + + T visitFinancialProducts(); + + T visitPolitics(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adcampaigns/types/UpdateAdCampaignsRequestStatus.java b/src/main/java/com/whop/api/resources/adcampaigns/types/UpdateAdCampaignsRequestStatus.java new file mode 100644 index 00000000..ce6757ee --- /dev/null +++ b/src/main/java/com/whop/api/resources/adcampaigns/types/UpdateAdCampaignsRequestStatus.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adcampaigns.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdCampaignsRequestStatus { + public static final UpdateAdCampaignsRequestStatus ACTIVE = + new UpdateAdCampaignsRequestStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + UpdateAdCampaignsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdCampaignsRequestStatus + && this.string.equals(((UpdateAdCampaignsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdCampaignsRequestStatus valueOf(String value) { + switch (value) { + case "active": + return ACTIVE; + default: + return new UpdateAdCampaignsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/AdGroupsClient.java b/src/main/java/com/whop/api/resources/adgroups/AdGroupsClient.java new file mode 100644 index 00000000..27f1f787 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/AdGroupsClient.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.adgroups.requests.CreateAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.DeleteAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.DuplicateAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.EstimateReachAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.ListAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.PauseAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.RetrieveAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.SearchTargetingOptionsAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.UnpauseAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.UpdateAdGroupsRequest; +import com.whop.api.resources.adgroups.types.DeleteAdGroupsResponse; +import com.whop.api.resources.adgroups.types.DuplicateAdGroupsResponse; +import com.whop.api.resources.adgroups.types.SearchTargetingOptionsAdGroupsResponse; +import com.whop.api.types.AdGroup; +import com.whop.api.types.ReachEstimate; + +public class AdGroupsClient { + protected final ClientOptions clientOptions; + + private final RawAdGroupsClient rawClient; + + public AdGroupsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAdGroupsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAdGroupsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists ad groups for the account, newest first. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists ad groups for the account, newest first. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists ad groups for the account, newest first. + */ + public SyncPagingIterable list(ListAdGroupsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists ad groups for the account, newest first. + */ + public SyncPagingIterable list(ListAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Creates an ad group (ad set) in a campaign. + */ + public AdGroup create(CreateAdGroupsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Creates an ad group (ad set) in a campaign. + */ + public AdGroup create(CreateAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Estimates how many people a draft targeting spec can reach, before an ad group is created. The body takes the same targeting fields as creating an ad group — regions, demographics, detailed_targeting, audiences, languages, and devices — and nothing is persisted. + */ + public ReachEstimate estimateReach(EstimateReachAdGroupsRequest request) { + return this.rawClient.estimateReach(request).body(); + } + + /** + * Estimates how many people a draft targeting spec can reach, before an ad group is created. The body takes the same targeting fields as creating an ad group — regions, demographics, detailed_targeting, audiences, languages, and devices — and nothing is persisted. + */ + public ReachEstimate estimateReach(EstimateReachAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.estimateReach(request, requestOptions).body(); + } + + /** + * Searches the ad platform's targeting taxonomy for options to target an ad group with. Each result comes back in the exact shape the ad-group body accepts for its type, so it can be used in detailed_targeting, regions, or languages as-is. A blank query browses the small fixed lists (behaviors, browse demographic categories, languages); interests, work employers, job titles, schools, majors, and locations need a search term. + */ + public SearchTargetingOptionsAdGroupsResponse searchTargetingOptions( + SearchTargetingOptionsAdGroupsRequest request) { + return this.rawClient.searchTargetingOptions(request).body(); + } + + /** + * Searches the ad platform's targeting taxonomy for options to target an ad group with. Each result comes back in the exact shape the ad-group body accepts for its type, so it can be used in detailed_targeting, regions, or languages as-is. A blank query browses the small fixed lists (behaviors, browse demographic categories, languages); interests, work employers, job titles, schools, majors, and locations need a search term. + */ + public SearchTargetingOptionsAdGroupsResponse searchTargetingOptions( + SearchTargetingOptionsAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.searchTargetingOptions(request, requestOptions).body(); + } + + /** + * Retrieves a single ad group. + */ + public AdGroup retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a single ad group. + */ + public AdGroup retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a single ad group. + */ + public AdGroup retrieve(String id, RetrieveAdGroupsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a single ad group. + */ + public AdGroup retrieve(String id, RetrieveAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Deletes an ad group. + */ + public DeleteAdGroupsResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Deletes an ad group. + */ + public DeleteAdGroupsResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Deletes an ad group. + */ + public DeleteAdGroupsResponse delete(String id, DeleteAdGroupsRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Deletes an ad group. + */ + public DeleteAdGroupsResponse delete(String id, DeleteAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public AdGroup update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public AdGroup update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public AdGroup update(String id, UpdateAdGroupsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public AdGroup update(String id, UpdateAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public DuplicateAdGroupsResponse duplicate(String id) { + return this.rawClient.duplicate(id).body(); + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public DuplicateAdGroupsResponse duplicate(String id, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, requestOptions).body(); + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public DuplicateAdGroupsResponse duplicate(String id, DuplicateAdGroupsRequest request) { + return this.rawClient.duplicate(id, request).body(); + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public DuplicateAdGroupsResponse duplicate( + String id, DuplicateAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, request, requestOptions).body(); + } + + /** + * Pauses delivery of an ad group. + */ + public AdGroup pause(String id) { + return this.rawClient.pause(id).body(); + } + + /** + * Pauses delivery of an ad group. + */ + public AdGroup pause(String id, RequestOptions requestOptions) { + return this.rawClient.pause(id, requestOptions).body(); + } + + /** + * Pauses delivery of an ad group. + */ + public AdGroup pause(String id, PauseAdGroupsRequest request) { + return this.rawClient.pause(id, request).body(); + } + + /** + * Pauses delivery of an ad group. + */ + public AdGroup pause(String id, PauseAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.pause(id, request, requestOptions).body(); + } + + /** + * Resumes delivery of a paused ad group. + */ + public AdGroup unpause(String id) { + return this.rawClient.unpause(id).body(); + } + + /** + * Resumes delivery of a paused ad group. + */ + public AdGroup unpause(String id, RequestOptions requestOptions) { + return this.rawClient.unpause(id, requestOptions).body(); + } + + /** + * Resumes delivery of a paused ad group. + */ + public AdGroup unpause(String id, UnpauseAdGroupsRequest request) { + return this.rawClient.unpause(id, request).body(); + } + + /** + * Resumes delivery of a paused ad group. + */ + public AdGroup unpause(String id, UnpauseAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.unpause(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/AsyncAdGroupsClient.java b/src/main/java/com/whop/api/resources/adgroups/AsyncAdGroupsClient.java new file mode 100644 index 00000000..5fe19eb1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/AsyncAdGroupsClient.java @@ -0,0 +1,288 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.adgroups.requests.CreateAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.DeleteAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.DuplicateAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.EstimateReachAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.ListAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.PauseAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.RetrieveAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.SearchTargetingOptionsAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.UnpauseAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.UpdateAdGroupsRequest; +import com.whop.api.resources.adgroups.types.DeleteAdGroupsResponse; +import com.whop.api.resources.adgroups.types.DuplicateAdGroupsResponse; +import com.whop.api.resources.adgroups.types.SearchTargetingOptionsAdGroupsResponse; +import com.whop.api.types.AdGroup; +import com.whop.api.types.ReachEstimate; +import java.util.concurrent.CompletableFuture; + +public class AsyncAdGroupsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAdGroupsClient rawClient; + + public AsyncAdGroupsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAdGroupsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAdGroupsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists ad groups for the account, newest first. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists ad groups for the account, newest first. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists ad groups for the account, newest first. + */ + public CompletableFuture> list(ListAdGroupsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists ad groups for the account, newest first. + */ + public CompletableFuture> list( + ListAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates an ad group (ad set) in a campaign. + */ + public CompletableFuture create(CreateAdGroupsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Creates an ad group (ad set) in a campaign. + */ + public CompletableFuture create(CreateAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Estimates how many people a draft targeting spec can reach, before an ad group is created. The body takes the same targeting fields as creating an ad group — regions, demographics, detailed_targeting, audiences, languages, and devices — and nothing is persisted. + */ + public CompletableFuture estimateReach(EstimateReachAdGroupsRequest request) { + return this.rawClient.estimateReach(request).thenApply(response -> response.body()); + } + + /** + * Estimates how many people a draft targeting spec can reach, before an ad group is created. The body takes the same targeting fields as creating an ad group — regions, demographics, detailed_targeting, audiences, languages, and devices — and nothing is persisted. + */ + public CompletableFuture estimateReach( + EstimateReachAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.estimateReach(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Searches the ad platform's targeting taxonomy for options to target an ad group with. Each result comes back in the exact shape the ad-group body accepts for its type, so it can be used in detailed_targeting, regions, or languages as-is. A blank query browses the small fixed lists (behaviors, browse demographic categories, languages); interests, work employers, job titles, schools, majors, and locations need a search term. + */ + public CompletableFuture searchTargetingOptions( + SearchTargetingOptionsAdGroupsRequest request) { + return this.rawClient.searchTargetingOptions(request).thenApply(response -> response.body()); + } + + /** + * Searches the ad platform's targeting taxonomy for options to target an ad group with. Each result comes back in the exact shape the ad-group body accepts for its type, so it can be used in detailed_targeting, regions, or languages as-is. A blank query browses the small fixed lists (behaviors, browse demographic categories, languages); interests, work employers, job titles, schools, majors, and locations need a search term. + */ + public CompletableFuture searchTargetingOptions( + SearchTargetingOptionsAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.searchTargetingOptions(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single ad group. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a single ad group. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single ad group. + */ + public CompletableFuture retrieve(String id, RetrieveAdGroupsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a single ad group. + */ + public CompletableFuture retrieve( + String id, RetrieveAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes an ad group. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Deletes an ad group. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes an ad group. + */ + public CompletableFuture delete(String id, DeleteAdGroupsRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Deletes an ad group. + */ + public CompletableFuture delete( + String id, DeleteAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public CompletableFuture update(String id, UpdateAdGroupsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public CompletableFuture update(String id, UpdateAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture duplicate(String id) { + return this.rawClient.duplicate(id).thenApply(response -> response.body()); + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture duplicate(String id, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture duplicate(String id, DuplicateAdGroupsRequest request) { + return this.rawClient.duplicate(id, request).thenApply(response -> response.body()); + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture duplicate( + String id, DuplicateAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Pauses delivery of an ad group. + */ + public CompletableFuture pause(String id) { + return this.rawClient.pause(id).thenApply(response -> response.body()); + } + + /** + * Pauses delivery of an ad group. + */ + public CompletableFuture pause(String id, RequestOptions requestOptions) { + return this.rawClient.pause(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Pauses delivery of an ad group. + */ + public CompletableFuture pause(String id, PauseAdGroupsRequest request) { + return this.rawClient.pause(id, request).thenApply(response -> response.body()); + } + + /** + * Pauses delivery of an ad group. + */ + public CompletableFuture pause(String id, PauseAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.pause(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Resumes delivery of a paused ad group. + */ + public CompletableFuture unpause(String id) { + return this.rawClient.unpause(id).thenApply(response -> response.body()); + } + + /** + * Resumes delivery of a paused ad group. + */ + public CompletableFuture unpause(String id, RequestOptions requestOptions) { + return this.rawClient.unpause(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Resumes delivery of a paused ad group. + */ + public CompletableFuture unpause(String id, UnpauseAdGroupsRequest request) { + return this.rawClient.unpause(id, request).thenApply(response -> response.body()); + } + + /** + * Resumes delivery of a paused ad group. + */ + public CompletableFuture unpause( + String id, UnpauseAdGroupsRequest request, RequestOptions requestOptions) { + return this.rawClient.unpause(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/AsyncRawAdGroupsClient.java b/src/main/java/com/whop/api/resources/adgroups/AsyncRawAdGroupsClient.java new file mode 100644 index 00000000..a42e9f24 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/AsyncRawAdGroupsClient.java @@ -0,0 +1,1040 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.adgroups.requests.CreateAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.DeleteAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.DuplicateAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.EstimateReachAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.ListAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.PauseAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.RetrieveAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.SearchTargetingOptionsAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.UnpauseAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.UpdateAdGroupsRequest; +import com.whop.api.resources.adgroups.types.DeleteAdGroupsResponse; +import com.whop.api.resources.adgroups.types.DuplicateAdGroupsResponse; +import com.whop.api.resources.adgroups.types.ListAdGroupsResponse; +import com.whop.api.resources.adgroups.types.SearchTargetingOptionsAdGroupsResponse; +import com.whop.api.types.AdGroup; +import com.whop.api.types.ReachEstimate; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAdGroupsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAdGroupsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists ad groups for the account, newest first. + */ + public CompletableFuture>> list() { + return list(ListAdGroupsRequest.builder().build()); + } + + /** + * Lists ad groups for the account, newest first. + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(ListAdGroupsRequest.builder().build(), requestOptions); + } + + /** + * Lists ad groups for the account, newest first. + */ + public CompletableFuture>> list(ListAdGroupsRequest request) { + return list(request, null); + } + + /** + * Lists ad groups for the account, newest first. + */ + public CompletableFuture>> list( + ListAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getAdCampaignId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_campaign_id", request.getAdCampaignId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getStatsFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_from", request.getStatsFrom().get(), false); + } + if (request.getStatsTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_to", request.getStatsTo().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getAdCampaignIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_campaign_ids", request.getAdCampaignIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAdGroupsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAdGroupsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListAdGroupsRequest nextRequest = ListAdGroupsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable(startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates an ad group (ad set) in a campaign. + */ + public CompletableFuture> create(CreateAdGroupsRequest request) { + return create(request, null); + } + + /** + * Creates an ad group (ad set) in a campaign. + */ + public CompletableFuture> create( + CreateAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdGroup.class), response)); + return; + } + try { + switch (response.code()) { + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Estimates how many people a draft targeting spec can reach, before an ad group is created. The body takes the same targeting fields as creating an ad group — regions, demographics, detailed_targeting, audiences, languages, and devices — and nothing is persisted. + */ + public CompletableFuture> estimateReach(EstimateReachAdGroupsRequest request) { + return estimateReach(request, null); + } + + /** + * Estimates how many people a draft targeting spec can reach, before an ad group is created. The body takes the same targeting fields as creating an ad group — regions, demographics, detailed_targeting, audiences, languages, and devices — and nothing is persisted. + */ + public CompletableFuture> estimateReach( + EstimateReachAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups/estimate_reach"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReachEstimate.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Searches the ad platform's targeting taxonomy for options to target an ad group with. Each result comes back in the exact shape the ad-group body accepts for its type, so it can be used in detailed_targeting, regions, or languages as-is. A blank query browses the small fixed lists (behaviors, browse demographic categories, languages); interests, work employers, job titles, schools, majors, and locations need a search term. + */ + public CompletableFuture> searchTargetingOptions( + SearchTargetingOptionsAdGroupsRequest request) { + return searchTargetingOptions(request, null); + } + + /** + * Searches the ad platform's targeting taxonomy for options to target an ad group with. Each result comes back in the exact shape the ad-group body accepts for its type, so it can be used in detailed_targeting, regions, or languages as-is. A blank query browses the small fixed lists (behaviors, browse demographic categories, languages); interests, work employers, job titles, schools, majors, and locations need a search term. + */ + public CompletableFuture> searchTargetingOptions( + SearchTargetingOptionsAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups/targeting_options"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "platform", request.getPlatform(), false); + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getCountry().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "country", request.getCountry().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "types", request.getTypes().get(), true); + } + if (request.getLocationTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "location_types", request.getLocationTypes().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, SearchTargetingOptionsAdGroupsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a single ad group. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveAdGroupsRequest.builder().build()); + } + + /** + * Retrieves a single ad group. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAdGroupsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single ad group. + */ + public CompletableFuture> retrieve(String id, RetrieveAdGroupsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single ad group. + */ + public CompletableFuture> retrieve( + String id, RetrieveAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups") + .addPathSegment(id); + if (request.getStatsFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_from", request.getStatsFrom().get(), false); + } + if (request.getStatsTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_to", request.getStatsTo().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdGroup.class), response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes an ad group. + */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteAdGroupsRequest.builder().build()); + } + + /** + * Deletes an ad group. + */ + public CompletableFuture> delete( + String id, RequestOptions requestOptions) { + return delete(id, DeleteAdGroupsRequest.builder().build(), requestOptions); + } + + /** + * Deletes an ad group. + */ + public CompletableFuture> delete( + String id, DeleteAdGroupsRequest request) { + return delete(id, request, null); + } + + /** + * Deletes an ad group. + */ + public CompletableFuture> delete( + String id, DeleteAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteAdGroupsResponse.class), + response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateAdGroupsRequest.builder().build()); + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateAdGroupsRequest.builder().build(), requestOptions); + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public CompletableFuture> update(String id, UpdateAdGroupsRequest request) { + return update(id, request, null); + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public CompletableFuture> update( + String id, UpdateAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdGroup.class), response)); + return; + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture> duplicate(String id) { + return duplicate(id, DuplicateAdGroupsRequest.builder().build()); + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture> duplicate( + String id, RequestOptions requestOptions) { + return duplicate(id, DuplicateAdGroupsRequest.builder().build(), requestOptions); + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture> duplicate( + String id, DuplicateAdGroupsRequest request) { + return duplicate(id, request, null); + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public CompletableFuture> duplicate( + String id, DuplicateAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups") + .addPathSegment(id) + .addPathSegments("duplicate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DuplicateAdGroupsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Pauses delivery of an ad group. + */ + public CompletableFuture> pause(String id) { + return pause(id, PauseAdGroupsRequest.builder().build()); + } + + /** + * Pauses delivery of an ad group. + */ + public CompletableFuture> pause(String id, RequestOptions requestOptions) { + return pause(id, PauseAdGroupsRequest.builder().build(), requestOptions); + } + + /** + * Pauses delivery of an ad group. + */ + public CompletableFuture> pause(String id, PauseAdGroupsRequest request) { + return pause(id, request, null); + } + + /** + * Pauses delivery of an ad group. + */ + public CompletableFuture> pause( + String id, PauseAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups") + .addPathSegment(id) + .addPathSegments("pause"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdGroup.class), response)); + return; + } + try { + if (response.code() == 409) { + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Resumes delivery of a paused ad group. + */ + public CompletableFuture> unpause(String id) { + return unpause(id, UnpauseAdGroupsRequest.builder().build()); + } + + /** + * Resumes delivery of a paused ad group. + */ + public CompletableFuture> unpause(String id, RequestOptions requestOptions) { + return unpause(id, UnpauseAdGroupsRequest.builder().build(), requestOptions); + } + + /** + * Resumes delivery of a paused ad group. + */ + public CompletableFuture> unpause(String id, UnpauseAdGroupsRequest request) { + return unpause(id, request, null); + } + + /** + * Resumes delivery of a paused ad group. + */ + public CompletableFuture> unpause( + String id, UnpauseAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups") + .addPathSegment(id) + .addPathSegments("unpause"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdGroup.class), response)); + return; + } + try { + if (response.code() == 409) { + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/RawAdGroupsClient.java b/src/main/java/com/whop/api/resources/adgroups/RawAdGroupsClient.java new file mode 100644 index 00000000..1e6ead3f --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/RawAdGroupsClient.java @@ -0,0 +1,862 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.adgroups.requests.CreateAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.DeleteAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.DuplicateAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.EstimateReachAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.ListAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.PauseAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.RetrieveAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.SearchTargetingOptionsAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.UnpauseAdGroupsRequest; +import com.whop.api.resources.adgroups.requests.UpdateAdGroupsRequest; +import com.whop.api.resources.adgroups.types.DeleteAdGroupsResponse; +import com.whop.api.resources.adgroups.types.DuplicateAdGroupsResponse; +import com.whop.api.resources.adgroups.types.ListAdGroupsResponse; +import com.whop.api.resources.adgroups.types.SearchTargetingOptionsAdGroupsResponse; +import com.whop.api.types.AdGroup; +import com.whop.api.types.ReachEstimate; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAdGroupsClient { + protected final ClientOptions clientOptions; + + public RawAdGroupsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists ad groups for the account, newest first. + */ + public WhopApiHttpResponse> list() { + return list(ListAdGroupsRequest.builder().build()); + } + + /** + * Lists ad groups for the account, newest first. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListAdGroupsRequest.builder().build(), requestOptions); + } + + /** + * Lists ad groups for the account, newest first. + */ + public WhopApiHttpResponse> list(ListAdGroupsRequest request) { + return list(request, null); + } + + /** + * Lists ad groups for the account, newest first. + */ + public WhopApiHttpResponse> list( + ListAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getAdCampaignId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_campaign_id", request.getAdCampaignId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getStatsFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_from", request.getStatsFrom().get(), false); + } + if (request.getStatsTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_to", request.getStatsTo().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getAdCampaignIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_campaign_ids", request.getAdCampaignIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAdGroupsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAdGroupsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListAdGroupsRequest nextRequest = ListAdGroupsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates an ad group (ad set) in a campaign. + */ + public WhopApiHttpResponse create(CreateAdGroupsRequest request) { + return create(request, null); + } + + /** + * Creates an ad group (ad set) in a campaign. + */ + public WhopApiHttpResponse create(CreateAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdGroup.class), response); + } + try { + switch (response.code()) { + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Estimates how many people a draft targeting spec can reach, before an ad group is created. The body takes the same targeting fields as creating an ad group — regions, demographics, detailed_targeting, audiences, languages, and devices — and nothing is persisted. + */ + public WhopApiHttpResponse estimateReach(EstimateReachAdGroupsRequest request) { + return estimateReach(request, null); + } + + /** + * Estimates how many people a draft targeting spec can reach, before an ad group is created. The body takes the same targeting fields as creating an ad group — regions, demographics, detailed_targeting, audiences, languages, and devices — and nothing is persisted. + */ + public WhopApiHttpResponse estimateReach( + EstimateReachAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups/estimate_reach"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReachEstimate.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Searches the ad platform's targeting taxonomy for options to target an ad group with. Each result comes back in the exact shape the ad-group body accepts for its type, so it can be used in detailed_targeting, regions, or languages as-is. A blank query browses the small fixed lists (behaviors, browse demographic categories, languages); interests, work employers, job titles, schools, majors, and locations need a search term. + */ + public WhopApiHttpResponse searchTargetingOptions( + SearchTargetingOptionsAdGroupsRequest request) { + return searchTargetingOptions(request, null); + } + + /** + * Searches the ad platform's targeting taxonomy for options to target an ad group with. Each result comes back in the exact shape the ad-group body accepts for its type, so it can be used in detailed_targeting, regions, or languages as-is. A blank query browses the small fixed lists (behaviors, browse demographic categories, languages); interests, work employers, job titles, schools, majors, and locations need a search term. + */ + public WhopApiHttpResponse searchTargetingOptions( + SearchTargetingOptionsAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups/targeting_options"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "platform", request.getPlatform(), false); + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getCountry().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "country", request.getCountry().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "types", request.getTypes().get(), true); + } + if (request.getLocationTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "location_types", request.getLocationTypes().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, SearchTargetingOptionsAdGroupsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a single ad group. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveAdGroupsRequest.builder().build()); + } + + /** + * Retrieves a single ad group. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAdGroupsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single ad group. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveAdGroupsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single ad group. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups") + .addPathSegment(id); + if (request.getStatsFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_from", request.getStatsFrom().get(), false); + } + if (request.getStatsTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_to", request.getStatsTo().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdGroup.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Deletes an ad group. + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteAdGroupsRequest.builder().build()); + } + + /** + * Deletes an ad group. + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteAdGroupsRequest.builder().build(), requestOptions); + } + + /** + * Deletes an ad group. + */ + public WhopApiHttpResponse delete(String id, DeleteAdGroupsRequest request) { + return delete(id, request, null); + } + + /** + * Deletes an ad group. + */ + public WhopApiHttpResponse delete( + String id, DeleteAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteAdGroupsResponse.class), + response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateAdGroupsRequest.builder().build()); + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateAdGroupsRequest.builder().build(), requestOptions); + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public WhopApiHttpResponse update(String id, UpdateAdGroupsRequest request) { + return update(id, request, null); + } + + /** + * Updates an ad group's editable fields. Only the keys you send are changed. + */ + public WhopApiHttpResponse update( + String id, UpdateAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdGroup.class), response); + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public WhopApiHttpResponse duplicate(String id) { + return duplicate(id, DuplicateAdGroupsRequest.builder().build()); + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public WhopApiHttpResponse duplicate(String id, RequestOptions requestOptions) { + return duplicate(id, DuplicateAdGroupsRequest.builder().build(), requestOptions); + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public WhopApiHttpResponse duplicate(String id, DuplicateAdGroupsRequest request) { + return duplicate(id, request, null); + } + + /** + * Creates copies of the ad group in duplicating status and returns them — into its own campaign, or into target_ad_campaign_id (which must belong to the same account and be compatible with the ad group's targeting and goals); each copy transitions to its final status (matching the source's active/paused state) once duplication completes. Poll each returned ad group until it leaves duplicating — a copy that could not be completed is deleted and returns 404. + */ + public WhopApiHttpResponse duplicate( + String id, DuplicateAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups") + .addPathSegment(id) + .addPathSegments("duplicate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DuplicateAdGroupsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Pauses delivery of an ad group. + */ + public WhopApiHttpResponse pause(String id) { + return pause(id, PauseAdGroupsRequest.builder().build()); + } + + /** + * Pauses delivery of an ad group. + */ + public WhopApiHttpResponse pause(String id, RequestOptions requestOptions) { + return pause(id, PauseAdGroupsRequest.builder().build(), requestOptions); + } + + /** + * Pauses delivery of an ad group. + */ + public WhopApiHttpResponse pause(String id, PauseAdGroupsRequest request) { + return pause(id, request, null); + } + + /** + * Pauses delivery of an ad group. + */ + public WhopApiHttpResponse pause(String id, PauseAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups") + .addPathSegment(id) + .addPathSegments("pause"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdGroup.class), response); + } + try { + if (response.code() == 409) { + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Resumes delivery of a paused ad group. + */ + public WhopApiHttpResponse unpause(String id) { + return unpause(id, UnpauseAdGroupsRequest.builder().build()); + } + + /** + * Resumes delivery of a paused ad group. + */ + public WhopApiHttpResponse unpause(String id, RequestOptions requestOptions) { + return unpause(id, UnpauseAdGroupsRequest.builder().build(), requestOptions); + } + + /** + * Resumes delivery of a paused ad group. + */ + public WhopApiHttpResponse unpause(String id, UnpauseAdGroupsRequest request) { + return unpause(id, request, null); + } + + /** + * Resumes delivery of a paused ad group. + */ + public WhopApiHttpResponse unpause( + String id, UnpauseAdGroupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_groups") + .addPathSegment(id) + .addPathSegments("unpause"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdGroup.class), response); + } + try { + if (response.code() == 409) { + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/requests/CreateAdGroupsRequest.java b/src/main/java/com/whop/api/resources/adgroups/requests/CreateAdGroupsRequest.java new file mode 100644 index 00000000..6bf2fdc5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/requests/CreateAdGroupsRequest.java @@ -0,0 +1,1190 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.adgroups.types.CreateAdGroupsRequestBidType; +import com.whop.api.resources.adgroups.types.CreateAdGroupsRequestBudgetType; +import com.whop.api.resources.adgroups.types.CreateAdGroupsRequestConversionLocation; +import com.whop.api.resources.adgroups.types.CreateAdGroupsRequestFrequencyCap; +import com.whop.api.resources.adgroups.types.CreateAdGroupsRequestMessageAppsItem; +import com.whop.api.resources.adgroups.types.CreateAdGroupsRequestOptimizationGoal; +import com.whop.api.resources.adgroups.types.CreateAdGroupsRequestPlacements; +import com.whop.api.resources.adgroups.types.CreateAdGroupsRequestStatus; +import com.whop.api.types.AdGroupAudiencesBody; +import com.whop.api.types.AdGroupDemographicsBody; +import com.whop.api.types.AdGroupDetailedTargetingBody; +import com.whop.api.types.AdGroupDevicesBody; +import com.whop.api.types.AdGroupRegionsBody; +import com.whop.api.types.ConversionEvent; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdGroupsRequest.Builder.class) +public final class CreateAdGroupsRequest { + private final String adCampaignId; + + private final Optional audiences; + + private final Optional bidType; + + private final Optional budgetAmount; + + private final Optional budgetType; + + private final Optional conversionEvent; + + private final Optional conversionLocation; + + private final Optional demographics; + + private final Optional desiredCostPerResult; + + private final Optional detailedTargeting; + + private final Optional devices; + + private final Optional dynamicCreative; + + private final Optional endsAt; + + private final Optional frequencyCap; + + private final Optional> languages; + + private final Optional> messageApps; + + private final Optional minimumDailySpend; + + private final Optional optimizationGoal; + + private final Optional placements; + + private final Optional regions; + + private final Optional startsAt; + + private final Optional status; + + private final Optional title; + + private final Map additionalProperties; + + private CreateAdGroupsRequest( + String adCampaignId, + Optional audiences, + Optional bidType, + Optional budgetAmount, + Optional budgetType, + Optional conversionEvent, + Optional conversionLocation, + Optional demographics, + Optional desiredCostPerResult, + Optional detailedTargeting, + Optional devices, + Optional dynamicCreative, + Optional endsAt, + Optional frequencyCap, + Optional> languages, + Optional> messageApps, + Optional minimumDailySpend, + Optional optimizationGoal, + Optional placements, + Optional regions, + Optional startsAt, + Optional status, + Optional title, + Map additionalProperties) { + this.adCampaignId = adCampaignId; + this.audiences = audiences; + this.bidType = bidType; + this.budgetAmount = budgetAmount; + this.budgetType = budgetType; + this.conversionEvent = conversionEvent; + this.conversionLocation = conversionLocation; + this.demographics = demographics; + this.desiredCostPerResult = desiredCostPerResult; + this.detailedTargeting = detailedTargeting; + this.devices = devices; + this.dynamicCreative = dynamicCreative; + this.endsAt = endsAt; + this.frequencyCap = frequencyCap; + this.languages = languages; + this.messageApps = messageApps; + this.minimumDailySpend = minimumDailySpend; + this.optimizationGoal = optimizationGoal; + this.placements = placements; + this.regions = regions; + this.startsAt = startsAt; + this.status = status; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ad campaign to create the ad group in, prefixed adcamp_. + */ + @JsonProperty("ad_campaign_id") + public String getAdCampaignId() { + return adCampaignId; + } + + /** + * @return Saved audiences to deliver to or exclude. Can't be combined with demographics.automatic. + */ + @JsonProperty("audiences") + public Optional getAudiences() { + return audiences; + } + + /** + * @return How delivery bids are set in the ad auction. Target-based strategies use desired_cost_per_result. + */ + @JsonProperty("bid_type") + public Optional getBidType() { + return bidType; + } + + /** + * @return This ad group's budget, in the ad account's currency. Omit when the budget is set on the campaign instead. + */ + @JsonProperty("budget_amount") + public Optional getBudgetAmount() { + return budgetAmount; + } + + /** + * @return Whether budget_amount is spent per day (daily) or over the ad group's full run (lifetime). + */ + @JsonProperty("budget_type") + public Optional getBudgetType() { + return budgetType; + } + + @JsonIgnore + public Optional getConversionEvent() { + if (conversionEvent == null) { + return Optional.empty(); + } + return conversionEvent; + } + + /** + * @return Where the outcome being optimized for occurs, such as a website visit, social-profile visit, messaging conversation, ad interaction, or lead-form submission. The lead form itself is set on the ad. + */ + @JsonProperty("conversion_location") + public Optional getConversionLocation() { + return conversionLocation; + } + + /** + * @return Age, gender, and automatic-audience targeting. + */ + @JsonProperty("demographics") + public Optional getDemographics() { + return demographics; + } + + /** + * @return Cost per result to aim for (average_target) or never exceed (maximum_target). + */ + @JsonProperty("desired_cost_per_result") + public Optional getDesiredCostPerResult() { + return desiredCostPerResult; + } + + /** + * @return Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. Entries across interests, behaviors, and demographics are OR'd together (anyone matching any entry is reached), matching Ads Manager's detailed-targeting box. At most 100 entries per section. Can't be combined with demographics.automatic, and unavailable to campaigns with special_ad_categories. Send the complete intended state — a section you omit is cleared. + */ + @JsonProperty("detailed_targeting") + public Optional getDetailedTargeting() { + return detailedTargeting; + } + + /** + * @return Device platforms and operating systems to target. + */ + @JsonProperty("devices") + public Optional getDevices() { + return devices; + } + + /** + * @return Let the ad platform automatically mix and match this ad group's creatives and copy to find the best-performing combinations. Set at creation; can't be changed afterward. + */ + @JsonProperty("dynamic_creative") + public Optional getDynamicCreative() { + return dynamicCreative; + } + + /** + * @return When the ad group stops delivering, as an ISO 8601 timestamp. Omit to run until paused. + */ + @JsonProperty("ends_at") + public Optional getEndsAt() { + return endsAt; + } + + /** + * @return Cap on how often one person sees ads from this ad group. Only available on campaigns with the awareness objective. + */ + @JsonProperty("frequency_cap") + public Optional getFrequencyCap() { + return frequencyCap; + } + + /** + * @return Languages to target, as ISO 639 codes such as en or es. Empty or omitted targets all languages. + */ + @JsonProperty("languages") + public Optional> getLanguages() { + return languages; + } + + /** + * @return Apps the conversation opens in. Required when setting conversion_location to messaging, and rejected unless the ad group's conversion location is messaging. + */ + @JsonProperty("message_apps") + public Optional> getMessageApps() { + return messageApps; + } + + /** + * @return Minimum the ad group tries to spend each day. + */ + @JsonProperty("minimum_daily_spend") + public Optional getMinimumDailySpend() { + return minimumDailySpend; + } + + /** + * @return The result the ad group's delivery is optimized to get the most of. + */ + @JsonProperty("optimization_goal") + public Optional getOptimizationGoal() { + return optimizationGoal; + } + + /** + * @return automatic to let the ad platform choose placements, or the list of platforms and positions to target. Omit a platform's positions to target all of them. + *

Valid positions per platform:

+ *
    + *
  • facebook: feed, right_hand_column, marketplace, search, profile_feed, notification, story, instream_video, facebook_reels, facebook_reels_overlay, biz_disco_feed
  • + *
  • instagram: stream, story, explore, explore_home, reels, profile_feed, profile_reels, ig_search
  • + *
  • messenger: story
  • + *
  • audience_network: classic, rewarded_video
  • + *
  • threads: threads_stream
  • + *
  • whatsapp: status
  • + *
+ */ + @JsonProperty("placements") + public Optional getPlacements() { + return placements; + } + + /** + * @return Locations to target and exclude. + */ + @JsonProperty("regions") + public Optional getRegions() { + return regions; + } + + /** + * @return When the ad group starts delivering, as an ISO 8601 timestamp. Omit to start as soon as it's active. + */ + @JsonProperty("starts_at") + public Optional getStartsAt() { + return startsAt; + } + + /** + * @return Initial status (default: active). + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return The display name of the ad group. + */ + @JsonProperty("title") + public Optional getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("conversion_event") + private Optional _getConversionEvent() { + return conversionEvent; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdGroupsRequest && equalTo((CreateAdGroupsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdGroupsRequest other) { + return adCampaignId.equals(other.adCampaignId) + && audiences.equals(other.audiences) + && bidType.equals(other.bidType) + && budgetAmount.equals(other.budgetAmount) + && budgetType.equals(other.budgetType) + && conversionEvent.equals(other.conversionEvent) + && conversionLocation.equals(other.conversionLocation) + && demographics.equals(other.demographics) + && desiredCostPerResult.equals(other.desiredCostPerResult) + && detailedTargeting.equals(other.detailedTargeting) + && devices.equals(other.devices) + && dynamicCreative.equals(other.dynamicCreative) + && endsAt.equals(other.endsAt) + && frequencyCap.equals(other.frequencyCap) + && languages.equals(other.languages) + && messageApps.equals(other.messageApps) + && minimumDailySpend.equals(other.minimumDailySpend) + && optimizationGoal.equals(other.optimizationGoal) + && placements.equals(other.placements) + && regions.equals(other.regions) + && startsAt.equals(other.startsAt) + && status.equals(other.status) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adCampaignId, + this.audiences, + this.bidType, + this.budgetAmount, + this.budgetType, + this.conversionEvent, + this.conversionLocation, + this.demographics, + this.desiredCostPerResult, + this.detailedTargeting, + this.devices, + this.dynamicCreative, + this.endsAt, + this.frequencyCap, + this.languages, + this.messageApps, + this.minimumDailySpend, + this.optimizationGoal, + this.placements, + this.regions, + this.startsAt, + this.status, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdCampaignIdStage builder() { + return new Builder(); + } + + public interface AdCampaignIdStage { + /** + *

The ad campaign to create the ad group in, prefixed adcamp_.

+ */ + _FinalStage adCampaignId(@NotNull String adCampaignId); + + Builder from(CreateAdGroupsRequest other); + } + + public interface _FinalStage { + CreateAdGroupsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Saved audiences to deliver to or exclude. Can't be combined with demographics.automatic.

+ */ + _FinalStage audiences(Optional audiences); + + _FinalStage audiences(AdGroupAudiencesBody audiences); + + /** + *

How delivery bids are set in the ad auction. Target-based strategies use desired_cost_per_result.

+ */ + _FinalStage bidType(Optional bidType); + + _FinalStage bidType(CreateAdGroupsRequestBidType bidType); + + /** + *

This ad group's budget, in the ad account's currency. Omit when the budget is set on the campaign instead.

+ */ + _FinalStage budgetAmount(Optional budgetAmount); + + _FinalStage budgetAmount(Double budgetAmount); + + /** + *

Whether budget_amount is spent per day (daily) or over the ad group's full run (lifetime).

+ */ + _FinalStage budgetType(Optional budgetType); + + _FinalStage budgetType(CreateAdGroupsRequestBudgetType budgetType); + + _FinalStage conversionEvent(Optional conversionEvent); + + _FinalStage conversionEvent(ConversionEvent conversionEvent); + + _FinalStage conversionEvent(Nullable conversionEvent); + + /** + *

Where the outcome being optimized for occurs, such as a website visit, social-profile visit, messaging conversation, ad interaction, or lead-form submission. The lead form itself is set on the ad.

+ */ + _FinalStage conversionLocation(Optional conversionLocation); + + _FinalStage conversionLocation(CreateAdGroupsRequestConversionLocation conversionLocation); + + /** + *

Age, gender, and automatic-audience targeting.

+ */ + _FinalStage demographics(Optional demographics); + + _FinalStage demographics(AdGroupDemographicsBody demographics); + + /** + *

Cost per result to aim for (average_target) or never exceed (maximum_target).

+ */ + _FinalStage desiredCostPerResult(Optional desiredCostPerResult); + + _FinalStage desiredCostPerResult(Double desiredCostPerResult); + + /** + *

Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. Entries across interests, behaviors, and demographics are OR'd together (anyone matching any entry is reached), matching Ads Manager's detailed-targeting box. At most 100 entries per section. Can't be combined with demographics.automatic, and unavailable to campaigns with special_ad_categories. Send the complete intended state — a section you omit is cleared.

+ */ + _FinalStage detailedTargeting(Optional detailedTargeting); + + _FinalStage detailedTargeting(AdGroupDetailedTargetingBody detailedTargeting); + + /** + *

Device platforms and operating systems to target.

+ */ + _FinalStage devices(Optional devices); + + _FinalStage devices(AdGroupDevicesBody devices); + + /** + *

Let the ad platform automatically mix and match this ad group's creatives and copy to find the best-performing combinations. Set at creation; can't be changed afterward.

+ */ + _FinalStage dynamicCreative(Optional dynamicCreative); + + _FinalStage dynamicCreative(Boolean dynamicCreative); + + /** + *

When the ad group stops delivering, as an ISO 8601 timestamp. Omit to run until paused.

+ */ + _FinalStage endsAt(Optional endsAt); + + _FinalStage endsAt(String endsAt); + + /** + *

Cap on how often one person sees ads from this ad group. Only available on campaigns with the awareness objective.

+ */ + _FinalStage frequencyCap(Optional frequencyCap); + + _FinalStage frequencyCap(CreateAdGroupsRequestFrequencyCap frequencyCap); + + /** + *

Languages to target, as ISO 639 codes such as en or es. Empty or omitted targets all languages.

+ */ + _FinalStage languages(Optional> languages); + + _FinalStage languages(List languages); + + /** + *

Apps the conversation opens in. Required when setting conversion_location to messaging, and rejected unless the ad group's conversion location is messaging.

+ */ + _FinalStage messageApps(Optional> messageApps); + + _FinalStage messageApps(List messageApps); + + /** + *

Minimum the ad group tries to spend each day.

+ */ + _FinalStage minimumDailySpend(Optional minimumDailySpend); + + _FinalStage minimumDailySpend(Double minimumDailySpend); + + /** + *

The result the ad group's delivery is optimized to get the most of.

+ */ + _FinalStage optimizationGoal(Optional optimizationGoal); + + _FinalStage optimizationGoal(CreateAdGroupsRequestOptimizationGoal optimizationGoal); + + /** + *

automatic to let the ad platform choose placements, or the list of platforms and positions to target. Omit a platform's positions to target all of them.

+ *

Valid positions per platform:

+ *
    + *
  • facebook: feed, right_hand_column, marketplace, search, profile_feed, notification, story, instream_video, facebook_reels, facebook_reels_overlay, biz_disco_feed
  • + *
  • instagram: stream, story, explore, explore_home, reels, profile_feed, profile_reels, ig_search
  • + *
  • messenger: story
  • + *
  • audience_network: classic, rewarded_video
  • + *
  • threads: threads_stream
  • + *
  • whatsapp: status
  • + *
+ */ + _FinalStage placements(Optional placements); + + _FinalStage placements(CreateAdGroupsRequestPlacements placements); + + /** + *

Locations to target and exclude.

+ */ + _FinalStage regions(Optional regions); + + _FinalStage regions(AdGroupRegionsBody regions); + + /** + *

When the ad group starts delivering, as an ISO 8601 timestamp. Omit to start as soon as it's active.

+ */ + _FinalStage startsAt(Optional startsAt); + + _FinalStage startsAt(String startsAt); + + /** + *

Initial status (default: active).

+ */ + _FinalStage status(Optional status); + + _FinalStage status(CreateAdGroupsRequestStatus status); + + /** + *

The display name of the ad group.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AdCampaignIdStage, _FinalStage { + private String adCampaignId; + + private Optional title = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional startsAt = Optional.empty(); + + private Optional regions = Optional.empty(); + + private Optional placements = Optional.empty(); + + private Optional optimizationGoal = Optional.empty(); + + private Optional minimumDailySpend = Optional.empty(); + + private Optional> messageApps = Optional.empty(); + + private Optional> languages = Optional.empty(); + + private Optional frequencyCap = Optional.empty(); + + private Optional endsAt = Optional.empty(); + + private Optional dynamicCreative = Optional.empty(); + + private Optional devices = Optional.empty(); + + private Optional detailedTargeting = Optional.empty(); + + private Optional desiredCostPerResult = Optional.empty(); + + private Optional demographics = Optional.empty(); + + private Optional conversionLocation = Optional.empty(); + + private Optional conversionEvent = Optional.empty(); + + private Optional budgetType = Optional.empty(); + + private Optional budgetAmount = Optional.empty(); + + private Optional bidType = Optional.empty(); + + private Optional audiences = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAdGroupsRequest other) { + adCampaignId(other.getAdCampaignId()); + audiences(other.getAudiences()); + bidType(other.getBidType()); + budgetAmount(other.getBudgetAmount()); + budgetType(other.getBudgetType()); + conversionEvent(other.getConversionEvent()); + conversionLocation(other.getConversionLocation()); + demographics(other.getDemographics()); + desiredCostPerResult(other.getDesiredCostPerResult()); + detailedTargeting(other.getDetailedTargeting()); + devices(other.getDevices()); + dynamicCreative(other.getDynamicCreative()); + endsAt(other.getEndsAt()); + frequencyCap(other.getFrequencyCap()); + languages(other.getLanguages()); + messageApps(other.getMessageApps()); + minimumDailySpend(other.getMinimumDailySpend()); + optimizationGoal(other.getOptimizationGoal()); + placements(other.getPlacements()); + regions(other.getRegions()); + startsAt(other.getStartsAt()); + status(other.getStatus()); + title(other.getTitle()); + return this; + } + + /** + *

The ad campaign to create the ad group in, prefixed adcamp_.

+ *

The ad campaign to create the ad group in, prefixed adcamp_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ad_campaign_id") + public _FinalStage adCampaignId(@NotNull String adCampaignId) { + this.adCampaignId = Objects.requireNonNull(adCampaignId, "adCampaignId must not be null"); + return this; + } + + /** + *

The display name of the ad group.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The display name of the ad group.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Initial status (default: active).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(CreateAdGroupsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Initial status (default: active).

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

When the ad group starts delivering, as an ISO 8601 timestamp. Omit to start as soon as it's active.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startsAt(String startsAt) { + this.startsAt = Optional.ofNullable(startsAt); + return this; + } + + /** + *

When the ad group starts delivering, as an ISO 8601 timestamp. Omit to start as soon as it's active.

+ */ + @java.lang.Override + @JsonSetter(value = "starts_at", nulls = Nulls.SKIP) + public _FinalStage startsAt(Optional startsAt) { + this.startsAt = startsAt; + return this; + } + + /** + *

Locations to target and exclude.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage regions(AdGroupRegionsBody regions) { + this.regions = Optional.ofNullable(regions); + return this; + } + + /** + *

Locations to target and exclude.

+ */ + @java.lang.Override + @JsonSetter(value = "regions", nulls = Nulls.SKIP) + public _FinalStage regions(Optional regions) { + this.regions = regions; + return this; + } + + /** + *

automatic to let the ad platform choose placements, or the list of platforms and positions to target. Omit a platform's positions to target all of them.

+ *

Valid positions per platform:

+ *
    + *
  • facebook: feed, right_hand_column, marketplace, search, profile_feed, notification, story, instream_video, facebook_reels, facebook_reels_overlay, biz_disco_feed
  • + *
  • instagram: stream, story, explore, explore_home, reels, profile_feed, profile_reels, ig_search
  • + *
  • messenger: story
  • + *
  • audience_network: classic, rewarded_video
  • + *
  • threads: threads_stream
  • + *
  • whatsapp: status
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage placements(CreateAdGroupsRequestPlacements placements) { + this.placements = Optional.ofNullable(placements); + return this; + } + + /** + *

automatic to let the ad platform choose placements, or the list of platforms and positions to target. Omit a platform's positions to target all of them.

+ *

Valid positions per platform:

+ *
    + *
  • facebook: feed, right_hand_column, marketplace, search, profile_feed, notification, story, instream_video, facebook_reels, facebook_reels_overlay, biz_disco_feed
  • + *
  • instagram: stream, story, explore, explore_home, reels, profile_feed, profile_reels, ig_search
  • + *
  • messenger: story
  • + *
  • audience_network: classic, rewarded_video
  • + *
  • threads: threads_stream
  • + *
  • whatsapp: status
  • + *
+ */ + @java.lang.Override + @JsonSetter(value = "placements", nulls = Nulls.SKIP) + public _FinalStage placements(Optional placements) { + this.placements = placements; + return this; + } + + /** + *

The result the ad group's delivery is optimized to get the most of.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optimizationGoal(CreateAdGroupsRequestOptimizationGoal optimizationGoal) { + this.optimizationGoal = Optional.ofNullable(optimizationGoal); + return this; + } + + /** + *

The result the ad group's delivery is optimized to get the most of.

+ */ + @java.lang.Override + @JsonSetter(value = "optimization_goal", nulls = Nulls.SKIP) + public _FinalStage optimizationGoal(Optional optimizationGoal) { + this.optimizationGoal = optimizationGoal; + return this; + } + + /** + *

Minimum the ad group tries to spend each day.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage minimumDailySpend(Double minimumDailySpend) { + this.minimumDailySpend = Optional.ofNullable(minimumDailySpend); + return this; + } + + /** + *

Minimum the ad group tries to spend each day.

+ */ + @java.lang.Override + @JsonSetter(value = "minimum_daily_spend", nulls = Nulls.SKIP) + public _FinalStage minimumDailySpend(Optional minimumDailySpend) { + this.minimumDailySpend = minimumDailySpend; + return this; + } + + /** + *

Apps the conversation opens in. Required when setting conversion_location to messaging, and rejected unless the ad group's conversion location is messaging.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messageApps(List messageApps) { + this.messageApps = Optional.ofNullable(messageApps); + return this; + } + + /** + *

Apps the conversation opens in. Required when setting conversion_location to messaging, and rejected unless the ad group's conversion location is messaging.

+ */ + @java.lang.Override + @JsonSetter(value = "message_apps", nulls = Nulls.SKIP) + public _FinalStage messageApps(Optional> messageApps) { + this.messageApps = messageApps; + return this; + } + + /** + *

Languages to target, as ISO 639 codes such as en or es. Empty or omitted targets all languages.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage languages(List languages) { + this.languages = Optional.ofNullable(languages); + return this; + } + + /** + *

Languages to target, as ISO 639 codes such as en or es. Empty or omitted targets all languages.

+ */ + @java.lang.Override + @JsonSetter(value = "languages", nulls = Nulls.SKIP) + public _FinalStage languages(Optional> languages) { + this.languages = languages; + return this; + } + + /** + *

Cap on how often one person sees ads from this ad group. Only available on campaigns with the awareness objective.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frequencyCap(CreateAdGroupsRequestFrequencyCap frequencyCap) { + this.frequencyCap = Optional.ofNullable(frequencyCap); + return this; + } + + /** + *

Cap on how often one person sees ads from this ad group. Only available on campaigns with the awareness objective.

+ */ + @java.lang.Override + @JsonSetter(value = "frequency_cap", nulls = Nulls.SKIP) + public _FinalStage frequencyCap(Optional frequencyCap) { + this.frequencyCap = frequencyCap; + return this; + } + + /** + *

When the ad group stops delivering, as an ISO 8601 timestamp. Omit to run until paused.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endsAt(String endsAt) { + this.endsAt = Optional.ofNullable(endsAt); + return this; + } + + /** + *

When the ad group stops delivering, as an ISO 8601 timestamp. Omit to run until paused.

+ */ + @java.lang.Override + @JsonSetter(value = "ends_at", nulls = Nulls.SKIP) + public _FinalStage endsAt(Optional endsAt) { + this.endsAt = endsAt; + return this; + } + + /** + *

Let the ad platform automatically mix and match this ad group's creatives and copy to find the best-performing combinations. Set at creation; can't be changed afterward.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dynamicCreative(Boolean dynamicCreative) { + this.dynamicCreative = Optional.ofNullable(dynamicCreative); + return this; + } + + /** + *

Let the ad platform automatically mix and match this ad group's creatives and copy to find the best-performing combinations. Set at creation; can't be changed afterward.

+ */ + @java.lang.Override + @JsonSetter(value = "dynamic_creative", nulls = Nulls.SKIP) + public _FinalStage dynamicCreative(Optional dynamicCreative) { + this.dynamicCreative = dynamicCreative; + return this; + } + + /** + *

Device platforms and operating systems to target.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage devices(AdGroupDevicesBody devices) { + this.devices = Optional.ofNullable(devices); + return this; + } + + /** + *

Device platforms and operating systems to target.

+ */ + @java.lang.Override + @JsonSetter(value = "devices", nulls = Nulls.SKIP) + public _FinalStage devices(Optional devices) { + this.devices = devices; + return this; + } + + /** + *

Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. Entries across interests, behaviors, and demographics are OR'd together (anyone matching any entry is reached), matching Ads Manager's detailed-targeting box. At most 100 entries per section. Can't be combined with demographics.automatic, and unavailable to campaigns with special_ad_categories. Send the complete intended state — a section you omit is cleared.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage detailedTargeting(AdGroupDetailedTargetingBody detailedTargeting) { + this.detailedTargeting = Optional.ofNullable(detailedTargeting); + return this; + } + + /** + *

Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. Entries across interests, behaviors, and demographics are OR'd together (anyone matching any entry is reached), matching Ads Manager's detailed-targeting box. At most 100 entries per section. Can't be combined with demographics.automatic, and unavailable to campaigns with special_ad_categories. Send the complete intended state — a section you omit is cleared.

+ */ + @java.lang.Override + @JsonSetter(value = "detailed_targeting", nulls = Nulls.SKIP) + public _FinalStage detailedTargeting(Optional detailedTargeting) { + this.detailedTargeting = detailedTargeting; + return this; + } + + /** + *

Cost per result to aim for (average_target) or never exceed (maximum_target).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage desiredCostPerResult(Double desiredCostPerResult) { + this.desiredCostPerResult = Optional.ofNullable(desiredCostPerResult); + return this; + } + + /** + *

Cost per result to aim for (average_target) or never exceed (maximum_target).

+ */ + @java.lang.Override + @JsonSetter(value = "desired_cost_per_result", nulls = Nulls.SKIP) + public _FinalStage desiredCostPerResult(Optional desiredCostPerResult) { + this.desiredCostPerResult = desiredCostPerResult; + return this; + } + + /** + *

Age, gender, and automatic-audience targeting.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage demographics(AdGroupDemographicsBody demographics) { + this.demographics = Optional.ofNullable(demographics); + return this; + } + + /** + *

Age, gender, and automatic-audience targeting.

+ */ + @java.lang.Override + @JsonSetter(value = "demographics", nulls = Nulls.SKIP) + public _FinalStage demographics(Optional demographics) { + this.demographics = demographics; + return this; + } + + /** + *

Where the outcome being optimized for occurs, such as a website visit, social-profile visit, messaging conversation, ad interaction, or lead-form submission. The lead form itself is set on the ad.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage conversionLocation(CreateAdGroupsRequestConversionLocation conversionLocation) { + this.conversionLocation = Optional.ofNullable(conversionLocation); + return this; + } + + /** + *

Where the outcome being optimized for occurs, such as a website visit, social-profile visit, messaging conversation, ad interaction, or lead-form submission. The lead form itself is set on the ad.

+ */ + @java.lang.Override + @JsonSetter(value = "conversion_location", nulls = Nulls.SKIP) + public _FinalStage conversionLocation(Optional conversionLocation) { + this.conversionLocation = conversionLocation; + return this; + } + + @java.lang.Override + public _FinalStage conversionEvent(Nullable conversionEvent) { + if (conversionEvent.isNull()) { + this.conversionEvent = null; + } else if (conversionEvent.isEmpty()) { + this.conversionEvent = Optional.empty(); + } else { + this.conversionEvent = Optional.of(conversionEvent.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage conversionEvent(ConversionEvent conversionEvent) { + this.conversionEvent = Optional.ofNullable(conversionEvent); + return this; + } + + @java.lang.Override + @JsonSetter(value = "conversion_event", nulls = Nulls.SKIP) + public _FinalStage conversionEvent(Optional conversionEvent) { + this.conversionEvent = conversionEvent; + return this; + } + + /** + *

Whether budget_amount is spent per day (daily) or over the ad group's full run (lifetime).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage budgetType(CreateAdGroupsRequestBudgetType budgetType) { + this.budgetType = Optional.ofNullable(budgetType); + return this; + } + + /** + *

Whether budget_amount is spent per day (daily) or over the ad group's full run (lifetime).

+ */ + @java.lang.Override + @JsonSetter(value = "budget_type", nulls = Nulls.SKIP) + public _FinalStage budgetType(Optional budgetType) { + this.budgetType = budgetType; + return this; + } + + /** + *

This ad group's budget, in the ad account's currency. Omit when the budget is set on the campaign instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage budgetAmount(Double budgetAmount) { + this.budgetAmount = Optional.ofNullable(budgetAmount); + return this; + } + + /** + *

This ad group's budget, in the ad account's currency. Omit when the budget is set on the campaign instead.

+ */ + @java.lang.Override + @JsonSetter(value = "budget_amount", nulls = Nulls.SKIP) + public _FinalStage budgetAmount(Optional budgetAmount) { + this.budgetAmount = budgetAmount; + return this; + } + + /** + *

How delivery bids are set in the ad auction. Target-based strategies use desired_cost_per_result.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bidType(CreateAdGroupsRequestBidType bidType) { + this.bidType = Optional.ofNullable(bidType); + return this; + } + + /** + *

How delivery bids are set in the ad auction. Target-based strategies use desired_cost_per_result.

+ */ + @java.lang.Override + @JsonSetter(value = "bid_type", nulls = Nulls.SKIP) + public _FinalStage bidType(Optional bidType) { + this.bidType = bidType; + return this; + } + + /** + *

Saved audiences to deliver to or exclude. Can't be combined with demographics.automatic.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage audiences(AdGroupAudiencesBody audiences) { + this.audiences = Optional.ofNullable(audiences); + return this; + } + + /** + *

Saved audiences to deliver to or exclude. Can't be combined with demographics.automatic.

+ */ + @java.lang.Override + @JsonSetter(value = "audiences", nulls = Nulls.SKIP) + public _FinalStage audiences(Optional audiences) { + this.audiences = audiences; + return this; + } + + @java.lang.Override + public CreateAdGroupsRequest build() { + return new CreateAdGroupsRequest( + adCampaignId, + audiences, + bidType, + budgetAmount, + budgetType, + conversionEvent, + conversionLocation, + demographics, + desiredCostPerResult, + detailedTargeting, + devices, + dynamicCreative, + endsAt, + frequencyCap, + languages, + messageApps, + minimumDailySpend, + optimizationGoal, + placements, + regions, + startsAt, + status, + title, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/requests/DeleteAdGroupsRequest.java b/src/main/java/com/whop/api/resources/adgroups/requests/DeleteAdGroupsRequest.java new file mode 100644 index 00000000..a0c271e8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/requests/DeleteAdGroupsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteAdGroupsRequest.Builder.class) +public final class DeleteAdGroupsRequest { + private final Map additionalProperties; + + private DeleteAdGroupsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteAdGroupsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteAdGroupsRequest other) { + return this; + } + + public DeleteAdGroupsRequest build() { + return new DeleteAdGroupsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/requests/DuplicateAdGroupsRequest.java b/src/main/java/com/whop/api/resources/adgroups/requests/DuplicateAdGroupsRequest.java new file mode 100644 index 00000000..bbb0dc2d --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/requests/DuplicateAdGroupsRequest.java @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DuplicateAdGroupsRequest.Builder.class) +public final class DuplicateAdGroupsRequest { + private final Optional count; + + private final Optional preserveEngagement; + + private final Optional targetAdCampaignId; + + private final Map additionalProperties; + + private DuplicateAdGroupsRequest( + Optional count, + Optional preserveEngagement, + Optional targetAdCampaignId, + Map additionalProperties) { + this.count = count; + this.preserveEngagement = preserveEngagement; + this.targetAdCampaignId = targetAdCampaignId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Number of copies to create (1-10). Defaults to 1. + */ + @JsonProperty("count") + public Optional getCount() { + return count; + } + + /** + * @return Whether the copied ads keep the original posts' engagement (likes, comments, shares). Defaults to false. + */ + @JsonProperty("preserve_engagement") + public Optional getPreserveEngagement() { + return preserveEngagement; + } + + /** + * @return Campaign to duplicate into. Defaults to the ad group's own campaign. + */ + @JsonProperty("target_ad_campaign_id") + public Optional getTargetAdCampaignId() { + return targetAdCampaignId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DuplicateAdGroupsRequest && equalTo((DuplicateAdGroupsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DuplicateAdGroupsRequest other) { + return count.equals(other.count) + && preserveEngagement.equals(other.preserveEngagement) + && targetAdCampaignId.equals(other.targetAdCampaignId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.count, this.preserveEngagement, this.targetAdCampaignId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional count = Optional.empty(); + + private Optional preserveEngagement = Optional.empty(); + + private Optional targetAdCampaignId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DuplicateAdGroupsRequest other) { + count(other.getCount()); + preserveEngagement(other.getPreserveEngagement()); + targetAdCampaignId(other.getTargetAdCampaignId()); + return this; + } + + /** + *

Number of copies to create (1-10). Defaults to 1.

+ */ + @JsonSetter(value = "count", nulls = Nulls.SKIP) + public Builder count(Optional count) { + this.count = count; + return this; + } + + public Builder count(Integer count) { + this.count = Optional.ofNullable(count); + return this; + } + + /** + *

Whether the copied ads keep the original posts' engagement (likes, comments, shares). Defaults to false.

+ */ + @JsonSetter(value = "preserve_engagement", nulls = Nulls.SKIP) + public Builder preserveEngagement(Optional preserveEngagement) { + this.preserveEngagement = preserveEngagement; + return this; + } + + public Builder preserveEngagement(Boolean preserveEngagement) { + this.preserveEngagement = Optional.ofNullable(preserveEngagement); + return this; + } + + /** + *

Campaign to duplicate into. Defaults to the ad group's own campaign.

+ */ + @JsonSetter(value = "target_ad_campaign_id", nulls = Nulls.SKIP) + public Builder targetAdCampaignId(Optional targetAdCampaignId) { + this.targetAdCampaignId = targetAdCampaignId; + return this; + } + + public Builder targetAdCampaignId(String targetAdCampaignId) { + this.targetAdCampaignId = Optional.ofNullable(targetAdCampaignId); + return this; + } + + public DuplicateAdGroupsRequest build() { + return new DuplicateAdGroupsRequest(count, preserveEngagement, targetAdCampaignId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/requests/EstimateReachAdGroupsRequest.java b/src/main/java/com/whop/api/resources/adgroups/requests/EstimateReachAdGroupsRequest.java new file mode 100644 index 00000000..1923a680 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/requests/EstimateReachAdGroupsRequest.java @@ -0,0 +1,458 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.adgroups.types.EstimateReachAdGroupsRequestPlatform; +import com.whop.api.types.AdGroupAudiencesBody; +import com.whop.api.types.AdGroupDemographicsBody; +import com.whop.api.types.AdGroupDetailedTargetingBody; +import com.whop.api.types.AdGroupDevicesBody; +import com.whop.api.types.AdGroupRegionsBody; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EstimateReachAdGroupsRequest.Builder.class) +public final class EstimateReachAdGroupsRequest { + private final Optional accountId; + + private final Optional audiences; + + private final Optional demographics; + + private final Optional detailedTargeting; + + private final Optional devices; + + private final Optional> languages; + + private final EstimateReachAdGroupsRequestPlatform platform; + + private final Optional regions; + + private final Map additionalProperties; + + private EstimateReachAdGroupsRequest( + Optional accountId, + Optional audiences, + Optional demographics, + Optional detailedTargeting, + Optional devices, + Optional> languages, + EstimateReachAdGroupsRequestPlatform platform, + Optional regions, + Map additionalProperties) { + this.accountId = accountId; + this.audiences = audiences; + this.demographics = demographics; + this.detailedTargeting = detailedTargeting; + this.devices = devices; + this.languages = languages; + this.platform = platform; + this.regions = regions; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account to estimate on behalf of. Defaults to the authenticated account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Saved audiences to deliver to or exclude. Can't be combined with demographics.automatic. + */ + @JsonProperty("audiences") + public Optional getAudiences() { + return audiences; + } + + /** + * @return Age, gender, and automatic-audience targeting. + */ + @JsonProperty("demographics") + public Optional getDemographics() { + return demographics; + } + + /** + * @return Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. At most 100 entries per section. + */ + @JsonProperty("detailed_targeting") + public Optional getDetailedTargeting() { + return detailedTargeting; + } + + /** + * @return Device platforms and operating systems to target. + */ + @JsonProperty("devices") + public Optional getDevices() { + return devices; + } + + /** + * @return Languages to target, as ISO 639 codes such as en or es. Empty or omitted targets all languages. + */ + @JsonProperty("languages") + public Optional> getLanguages() { + return languages; + } + + /** + * @return The ad network the estimate runs on. + */ + @JsonProperty("platform") + public EstimateReachAdGroupsRequestPlatform getPlatform() { + return platform; + } + + /** + * @return Locations to target and exclude. + */ + @JsonProperty("regions") + public Optional getRegions() { + return regions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EstimateReachAdGroupsRequest && equalTo((EstimateReachAdGroupsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EstimateReachAdGroupsRequest other) { + return accountId.equals(other.accountId) + && audiences.equals(other.audiences) + && demographics.equals(other.demographics) + && detailedTargeting.equals(other.detailedTargeting) + && devices.equals(other.devices) + && languages.equals(other.languages) + && platform.equals(other.platform) + && regions.equals(other.regions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.audiences, + this.demographics, + this.detailedTargeting, + this.devices, + this.languages, + this.platform, + this.regions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlatformStage builder() { + return new Builder(); + } + + public interface PlatformStage { + /** + *

The ad network the estimate runs on.

+ */ + _FinalStage platform(@NotNull EstimateReachAdGroupsRequestPlatform platform); + + Builder from(EstimateReachAdGroupsRequest other); + } + + public interface _FinalStage { + EstimateReachAdGroupsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account to estimate on behalf of. Defaults to the authenticated account.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + /** + *

Saved audiences to deliver to or exclude. Can't be combined with demographics.automatic.

+ */ + _FinalStage audiences(Optional audiences); + + _FinalStage audiences(AdGroupAudiencesBody audiences); + + /** + *

Age, gender, and automatic-audience targeting.

+ */ + _FinalStage demographics(Optional demographics); + + _FinalStage demographics(AdGroupDemographicsBody demographics); + + /** + *

Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. At most 100 entries per section.

+ */ + _FinalStage detailedTargeting(Optional detailedTargeting); + + _FinalStage detailedTargeting(AdGroupDetailedTargetingBody detailedTargeting); + + /** + *

Device platforms and operating systems to target.

+ */ + _FinalStage devices(Optional devices); + + _FinalStage devices(AdGroupDevicesBody devices); + + /** + *

Languages to target, as ISO 639 codes such as en or es. Empty or omitted targets all languages.

+ */ + _FinalStage languages(Optional> languages); + + _FinalStage languages(List languages); + + /** + *

Locations to target and exclude.

+ */ + _FinalStage regions(Optional regions); + + _FinalStage regions(AdGroupRegionsBody regions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlatformStage, _FinalStage { + private EstimateReachAdGroupsRequestPlatform platform; + + private Optional regions = Optional.empty(); + + private Optional> languages = Optional.empty(); + + private Optional devices = Optional.empty(); + + private Optional detailedTargeting = Optional.empty(); + + private Optional demographics = Optional.empty(); + + private Optional audiences = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EstimateReachAdGroupsRequest other) { + accountId(other.getAccountId()); + audiences(other.getAudiences()); + demographics(other.getDemographics()); + detailedTargeting(other.getDetailedTargeting()); + devices(other.getDevices()); + languages(other.getLanguages()); + platform(other.getPlatform()); + regions(other.getRegions()); + return this; + } + + /** + *

The ad network the estimate runs on.

+ *

The ad network the estimate runs on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public _FinalStage platform(@NotNull EstimateReachAdGroupsRequestPlatform platform) { + this.platform = Objects.requireNonNull(platform, "platform must not be null"); + return this; + } + + /** + *

Locations to target and exclude.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage regions(AdGroupRegionsBody regions) { + this.regions = Optional.ofNullable(regions); + return this; + } + + /** + *

Locations to target and exclude.

+ */ + @java.lang.Override + @JsonSetter(value = "regions", nulls = Nulls.SKIP) + public _FinalStage regions(Optional regions) { + this.regions = regions; + return this; + } + + /** + *

Languages to target, as ISO 639 codes such as en or es. Empty or omitted targets all languages.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage languages(List languages) { + this.languages = Optional.ofNullable(languages); + return this; + } + + /** + *

Languages to target, as ISO 639 codes such as en or es. Empty or omitted targets all languages.

+ */ + @java.lang.Override + @JsonSetter(value = "languages", nulls = Nulls.SKIP) + public _FinalStage languages(Optional> languages) { + this.languages = languages; + return this; + } + + /** + *

Device platforms and operating systems to target.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage devices(AdGroupDevicesBody devices) { + this.devices = Optional.ofNullable(devices); + return this; + } + + /** + *

Device platforms and operating systems to target.

+ */ + @java.lang.Override + @JsonSetter(value = "devices", nulls = Nulls.SKIP) + public _FinalStage devices(Optional devices) { + this.devices = devices; + return this; + } + + /** + *

Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. At most 100 entries per section.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage detailedTargeting(AdGroupDetailedTargetingBody detailedTargeting) { + this.detailedTargeting = Optional.ofNullable(detailedTargeting); + return this; + } + + /** + *

Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. At most 100 entries per section.

+ */ + @java.lang.Override + @JsonSetter(value = "detailed_targeting", nulls = Nulls.SKIP) + public _FinalStage detailedTargeting(Optional detailedTargeting) { + this.detailedTargeting = detailedTargeting; + return this; + } + + /** + *

Age, gender, and automatic-audience targeting.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage demographics(AdGroupDemographicsBody demographics) { + this.demographics = Optional.ofNullable(demographics); + return this; + } + + /** + *

Age, gender, and automatic-audience targeting.

+ */ + @java.lang.Override + @JsonSetter(value = "demographics", nulls = Nulls.SKIP) + public _FinalStage demographics(Optional demographics) { + this.demographics = demographics; + return this; + } + + /** + *

Saved audiences to deliver to or exclude. Can't be combined with demographics.automatic.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage audiences(AdGroupAudiencesBody audiences) { + this.audiences = Optional.ofNullable(audiences); + return this; + } + + /** + *

Saved audiences to deliver to or exclude. Can't be combined with demographics.automatic.

+ */ + @java.lang.Override + @JsonSetter(value = "audiences", nulls = Nulls.SKIP) + public _FinalStage audiences(Optional audiences) { + this.audiences = audiences; + return this; + } + + /** + *

Account to estimate on behalf of. Defaults to the authenticated account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Account to estimate on behalf of. Defaults to the authenticated account.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public EstimateReachAdGroupsRequest build() { + return new EstimateReachAdGroupsRequest( + accountId, + audiences, + demographics, + detailedTargeting, + devices, + languages, + platform, + regions, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/requests/ListAdGroupsRequest.java b/src/main/java/com/whop/api/resources/adgroups/requests/ListAdGroupsRequest.java new file mode 100644 index 00000000..1a5c4c83 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/requests/ListAdGroupsRequest.java @@ -0,0 +1,639 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.adgroups.types.ListAdGroupsRequestAttributionModel; +import com.whop.api.resources.adgroups.types.ListAdGroupsRequestDirection; +import com.whop.api.resources.adgroups.types.ListAdGroupsRequestOrder; +import com.whop.api.resources.adgroups.types.ListAdGroupsRequestStatus; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAdGroupsRequest.Builder.class) +public final class ListAdGroupsRequest { + private final Optional> adCampaignIds; + + private final Optional accountId; + + private final Optional adCampaignId; + + private final Optional status; + + private final Optional query; + + private final Optional order; + + private final Optional direction; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional statsFrom; + + private final Optional statsTo; + + private final Optional timeZone; + + private final Optional attributionModel; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListAdGroupsRequest( + Optional> adCampaignIds, + Optional accountId, + Optional adCampaignId, + Optional status, + Optional query, + Optional order, + Optional direction, + Optional createdBefore, + Optional createdAfter, + Optional statsFrom, + Optional statsTo, + Optional timeZone, + Optional attributionModel, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.adCampaignIds = adCampaignIds; + this.accountId = accountId; + this.adCampaignId = adCampaignId; + this.status = status; + this.query = query; + this.order = order; + this.direction = direction; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.statsFrom = statsFrom; + this.statsTo = statsTo; + this.timeZone = timeZone; + this.attributionModel = attributionModel; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Filter to ad groups in these campaigns (max 100). Repeat the parameter for each id (ad_campaign_ids=a&ad_campaign_ids=b). + */ + @JsonProperty("ad_campaign_ids") + public Optional> getAdCampaignIds() { + return adCampaignIds; + } + + /** + * @return Account whose ad groups to list. Defaults to the authenticated account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Filter to ad groups in this campaign. + */ + @JsonProperty("ad_campaign_id") + public Optional getAdCampaignId() { + return adCampaignId; + } + + /** + * @return Filter to ad groups with this status. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Filter ad groups by a title or ID substring. + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + /** + * @return The field to sort by. Defaults to created_at. Stat columns (spend, impressions, …) rank over the stats_from/stats_to window across the whole list, not just the current page. results, cost_per_result and return_on_ad_spend rank by the same Whop pixel-attributed values the response reports. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return The sort direction. Defaults to desc. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Only return ad groups created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return ad groups created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Start of the stats window. Defaults to all-time. + */ + @JsonProperty("stats_from") + public Optional getStatsFrom() { + return statsFrom; + } + + /** + * @return End of the stats window. Defaults to now. + */ + @JsonProperty("stats_to") + public Optional getStatsTo() { + return statsTo; + } + + /** + * @return IANA timezone (e.g. America/New_York) the stats window is interpreted in. Bare stats_from/stats_to dates resolve to day boundaries on this clock. Defaults to UTC. + */ + @JsonProperty("time_zone") + public Optional getTimeZone() { + return timeZone; + } + + /** + * @return Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise. + */ + @JsonProperty("attribution_model") + public Optional getAttributionModel() { + return attributionModel; + } + + /** + * @return The number of ad groups to return. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to fetch the page after (from page_info.end_cursor). + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of ad groups to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to fetch the page before (from page_info.start_cursor). + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAdGroupsRequest && equalTo((ListAdGroupsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAdGroupsRequest other) { + return adCampaignIds.equals(other.adCampaignIds) + && accountId.equals(other.accountId) + && adCampaignId.equals(other.adCampaignId) + && status.equals(other.status) + && query.equals(other.query) + && order.equals(other.order) + && direction.equals(other.direction) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && statsFrom.equals(other.statsFrom) + && statsTo.equals(other.statsTo) + && timeZone.equals(other.timeZone) + && attributionModel.equals(other.attributionModel) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adCampaignIds, + this.accountId, + this.adCampaignId, + this.status, + this.query, + this.order, + this.direction, + this.createdBefore, + this.createdAfter, + this.statsFrom, + this.statsTo, + this.timeZone, + this.attributionModel, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> adCampaignIds = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional adCampaignId = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional query = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional statsFrom = Optional.empty(); + + private Optional statsTo = Optional.empty(); + + private Optional timeZone = Optional.empty(); + + private Optional attributionModel = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListAdGroupsRequest other) { + adCampaignIds(other.getAdCampaignIds()); + accountId(other.getAccountId()); + adCampaignId(other.getAdCampaignId()); + status(other.getStatus()); + query(other.getQuery()); + order(other.getOrder()); + direction(other.getDirection()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + statsFrom(other.getStatsFrom()); + statsTo(other.getStatsTo()); + timeZone(other.getTimeZone()); + attributionModel(other.getAttributionModel()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

Filter to ad groups in these campaigns (max 100). Repeat the parameter for each id (ad_campaign_ids=a&ad_campaign_ids=b).

+ */ + @JsonSetter(value = "ad_campaign_ids", nulls = Nulls.SKIP) + public Builder adCampaignIds(Optional> adCampaignIds) { + this.adCampaignIds = adCampaignIds; + return this; + } + + public Builder adCampaignIds(List adCampaignIds) { + this.adCampaignIds = Optional.ofNullable(adCampaignIds); + return this; + } + + public Builder adCampaignIds(String adCampaignIds) { + this.adCampaignIds = Optional.of(Collections.singletonList(adCampaignIds)); + return this; + } + + /** + *

Account whose ad groups to list. Defaults to the authenticated account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Filter to ad groups in this campaign.

+ */ + @JsonSetter(value = "ad_campaign_id", nulls = Nulls.SKIP) + public Builder adCampaignId(Optional adCampaignId) { + this.adCampaignId = adCampaignId; + return this; + } + + public Builder adCampaignId(String adCampaignId) { + this.adCampaignId = Optional.ofNullable(adCampaignId); + return this; + } + + /** + *

Filter to ad groups with this status.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListAdGroupsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Filter ad groups by a title or ID substring.

+ */ + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public Builder query(Optional query) { + this.query = query; + return this; + } + + public Builder query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + /** + *

The field to sort by. Defaults to created_at. Stat columns (spend, impressions, …) rank over the stats_from/stats_to window across the whole list, not just the current page. results, cost_per_result and return_on_ad_spend rank by the same Whop pixel-attributed values the response reports.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListAdGroupsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The sort direction. Defaults to desc.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListAdGroupsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Only return ad groups created before this timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return ad groups created after this timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Start of the stats window. Defaults to all-time.

+ */ + @JsonSetter(value = "stats_from", nulls = Nulls.SKIP) + public Builder statsFrom(Optional statsFrom) { + this.statsFrom = statsFrom; + return this; + } + + public Builder statsFrom(String statsFrom) { + this.statsFrom = Optional.ofNullable(statsFrom); + return this; + } + + /** + *

End of the stats window. Defaults to now.

+ */ + @JsonSetter(value = "stats_to", nulls = Nulls.SKIP) + public Builder statsTo(Optional statsTo) { + this.statsTo = statsTo; + return this; + } + + public Builder statsTo(String statsTo) { + this.statsTo = Optional.ofNullable(statsTo); + return this; + } + + /** + *

IANA timezone (e.g. America/New_York) the stats window is interpreted in. Bare stats_from/stats_to dates resolve to day boundaries on this clock. Defaults to UTC.

+ */ + @JsonSetter(value = "time_zone", nulls = Nulls.SKIP) + public Builder timeZone(Optional timeZone) { + this.timeZone = timeZone; + return this; + } + + public Builder timeZone(String timeZone) { + this.timeZone = Optional.ofNullable(timeZone); + return this; + } + + /** + *

Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise.

+ */ + @JsonSetter(value = "attribution_model", nulls = Nulls.SKIP) + public Builder attributionModel(Optional attributionModel) { + this.attributionModel = attributionModel; + return this; + } + + public Builder attributionModel(ListAdGroupsRequestAttributionModel attributionModel) { + this.attributionModel = Optional.ofNullable(attributionModel); + return this; + } + + /** + *

The number of ad groups to return.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The number of ad groups to return from the end of the range.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to fetch the page before (from page_info.start_cursor).

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListAdGroupsRequest build() { + return new ListAdGroupsRequest( + adCampaignIds, + accountId, + adCampaignId, + status, + query, + order, + direction, + createdBefore, + createdAfter, + statsFrom, + statsTo, + timeZone, + attributionModel, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/requests/PauseAdGroupsRequest.java b/src/main/java/com/whop/api/resources/adgroups/requests/PauseAdGroupsRequest.java new file mode 100644 index 00000000..308a1579 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/requests/PauseAdGroupsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PauseAdGroupsRequest.Builder.class) +public final class PauseAdGroupsRequest { + private final Map additionalProperties; + + private PauseAdGroupsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PauseAdGroupsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PauseAdGroupsRequest other) { + return this; + } + + public PauseAdGroupsRequest build() { + return new PauseAdGroupsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/requests/RetrieveAdGroupsRequest.java b/src/main/java/com/whop/api/resources/adgroups/requests/RetrieveAdGroupsRequest.java new file mode 100644 index 00000000..e4cfc61c --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/requests/RetrieveAdGroupsRequest.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.adgroups.types.RetrieveAdGroupsRequestAttributionModel; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveAdGroupsRequest.Builder.class) +public final class RetrieveAdGroupsRequest { + private final Optional statsFrom; + + private final Optional statsTo; + + private final Optional timeZone; + + private final Optional attributionModel; + + private final Map additionalProperties; + + private RetrieveAdGroupsRequest( + Optional statsFrom, + Optional statsTo, + Optional timeZone, + Optional attributionModel, + Map additionalProperties) { + this.statsFrom = statsFrom; + this.statsTo = statsTo; + this.timeZone = timeZone; + this.attributionModel = attributionModel; + this.additionalProperties = additionalProperties; + } + + /** + * @return Start of the stats window. + */ + @JsonProperty("stats_from") + public Optional getStatsFrom() { + return statsFrom; + } + + /** + * @return End of the stats window. + */ + @JsonProperty("stats_to") + public Optional getStatsTo() { + return statsTo; + } + + /** + * @return IANA timezone the stats window is interpreted in. Defaults to UTC. + */ + @JsonProperty("time_zone") + public Optional getTimeZone() { + return timeZone; + } + + /** + * @return Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise. + */ + @JsonProperty("attribution_model") + public Optional getAttributionModel() { + return attributionModel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveAdGroupsRequest && equalTo((RetrieveAdGroupsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveAdGroupsRequest other) { + return statsFrom.equals(other.statsFrom) + && statsTo.equals(other.statsTo) + && timeZone.equals(other.timeZone) + && attributionModel.equals(other.attributionModel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.statsFrom, this.statsTo, this.timeZone, this.attributionModel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional statsFrom = Optional.empty(); + + private Optional statsTo = Optional.empty(); + + private Optional timeZone = Optional.empty(); + + private Optional attributionModel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveAdGroupsRequest other) { + statsFrom(other.getStatsFrom()); + statsTo(other.getStatsTo()); + timeZone(other.getTimeZone()); + attributionModel(other.getAttributionModel()); + return this; + } + + /** + *

Start of the stats window.

+ */ + @JsonSetter(value = "stats_from", nulls = Nulls.SKIP) + public Builder statsFrom(Optional statsFrom) { + this.statsFrom = statsFrom; + return this; + } + + public Builder statsFrom(String statsFrom) { + this.statsFrom = Optional.ofNullable(statsFrom); + return this; + } + + /** + *

End of the stats window.

+ */ + @JsonSetter(value = "stats_to", nulls = Nulls.SKIP) + public Builder statsTo(Optional statsTo) { + this.statsTo = statsTo; + return this; + } + + public Builder statsTo(String statsTo) { + this.statsTo = Optional.ofNullable(statsTo); + return this; + } + + /** + *

IANA timezone the stats window is interpreted in. Defaults to UTC.

+ */ + @JsonSetter(value = "time_zone", nulls = Nulls.SKIP) + public Builder timeZone(Optional timeZone) { + this.timeZone = timeZone; + return this; + } + + public Builder timeZone(String timeZone) { + this.timeZone = Optional.ofNullable(timeZone); + return this; + } + + /** + *

Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise.

+ */ + @JsonSetter(value = "attribution_model", nulls = Nulls.SKIP) + public Builder attributionModel(Optional attributionModel) { + this.attributionModel = attributionModel; + return this; + } + + public Builder attributionModel(RetrieveAdGroupsRequestAttributionModel attributionModel) { + this.attributionModel = Optional.ofNullable(attributionModel); + return this; + } + + public RetrieveAdGroupsRequest build() { + return new RetrieveAdGroupsRequest(statsFrom, statsTo, timeZone, attributionModel, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/requests/SearchTargetingOptionsAdGroupsRequest.java b/src/main/java/com/whop/api/resources/adgroups/requests/SearchTargetingOptionsAdGroupsRequest.java new file mode 100644 index 00000000..bec8b077 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/requests/SearchTargetingOptionsAdGroupsRequest.java @@ -0,0 +1,416 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.adgroups.types.SearchTargetingOptionsAdGroupsRequestLocationTypesItem; +import com.whop.api.resources.adgroups.types.SearchTargetingOptionsAdGroupsRequestPlatform; +import com.whop.api.resources.adgroups.types.SearchTargetingOptionsAdGroupsRequestTypesItem; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SearchTargetingOptionsAdGroupsRequest.Builder.class) +public final class SearchTargetingOptionsAdGroupsRequest { + private final Optional> types; + + private final Optional> locationTypes; + + private final Optional accountId; + + private final SearchTargetingOptionsAdGroupsRequestPlatform platform; + + private final Optional query; + + private final Optional country; + + private final Optional limit; + + private final Map additionalProperties; + + private SearchTargetingOptionsAdGroupsRequest( + Optional> types, + Optional> locationTypes, + Optional accountId, + SearchTargetingOptionsAdGroupsRequestPlatform platform, + Optional query, + Optional country, + Optional limit, + Map additionalProperties) { + this.types = types; + this.locationTypes = locationTypes; + this.accountId = accountId; + this.platform = platform; + this.query = query; + this.country = country; + this.limit = limit; + this.additionalProperties = additionalProperties; + } + + /** + * @return Kinds of targeting options to search. Defaults to all of them. + */ + @JsonProperty("types") + public Optional> getTypes() { + return types; + } + + /** + * @return Narrow location results to these kinds of places. Only applies when types includes locations. + */ + @JsonProperty("location_types") + public Optional> getLocationTypes() { + return locationTypes; + } + + /** + * @return Account to search on behalf of. Defaults to the authenticated account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The ad network whose targeting taxonomy to search. + */ + @JsonProperty("platform") + public SearchTargetingOptionsAdGroupsRequestPlatform getPlatform() { + return platform; + } + + /** + * @return The search term. Blank browses the fixed lists; interests, work employers, job titles, schools, majors, and locations return nothing without one. + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + /** + * @return Narrow location results to one country, as an ISO 3166-1 code such as US. Only applies when types includes locations. + */ + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + /** + * @return Maximum number of results per requested type. + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SearchTargetingOptionsAdGroupsRequest + && equalTo((SearchTargetingOptionsAdGroupsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SearchTargetingOptionsAdGroupsRequest other) { + return types.equals(other.types) + && locationTypes.equals(other.locationTypes) + && accountId.equals(other.accountId) + && platform.equals(other.platform) + && query.equals(other.query) + && country.equals(other.country) + && limit.equals(other.limit); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.types, this.locationTypes, this.accountId, this.platform, this.query, this.country, this.limit); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlatformStage builder() { + return new Builder(); + } + + public interface PlatformStage { + /** + *

The ad network whose targeting taxonomy to search.

+ */ + _FinalStage platform(@NotNull SearchTargetingOptionsAdGroupsRequestPlatform platform); + + Builder from(SearchTargetingOptionsAdGroupsRequest other); + } + + public interface _FinalStage { + SearchTargetingOptionsAdGroupsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Kinds of targeting options to search. Defaults to all of them.

+ */ + _FinalStage types(Optional> types); + + _FinalStage types(List types); + + _FinalStage types(SearchTargetingOptionsAdGroupsRequestTypesItem types); + + /** + *

Narrow location results to these kinds of places. Only applies when types includes locations.

+ */ + _FinalStage locationTypes(Optional> locationTypes); + + _FinalStage locationTypes(List locationTypes); + + _FinalStage locationTypes(SearchTargetingOptionsAdGroupsRequestLocationTypesItem locationTypes); + + /** + *

Account to search on behalf of. Defaults to the authenticated account.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + /** + *

The search term. Blank browses the fixed lists; interests, work employers, job titles, schools, majors, and locations return nothing without one.

+ */ + _FinalStage query(Optional query); + + _FinalStage query(String query); + + /** + *

Narrow location results to one country, as an ISO 3166-1 code such as US. Only applies when types includes locations.

+ */ + _FinalStage country(Optional country); + + _FinalStage country(String country); + + /** + *

Maximum number of results per requested type.

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Integer limit); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlatformStage, _FinalStage { + private SearchTargetingOptionsAdGroupsRequestPlatform platform; + + private Optional limit = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional query = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional> locationTypes = Optional.empty(); + + private Optional> types = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SearchTargetingOptionsAdGroupsRequest other) { + types(other.getTypes()); + locationTypes(other.getLocationTypes()); + accountId(other.getAccountId()); + platform(other.getPlatform()); + query(other.getQuery()); + country(other.getCountry()); + limit(other.getLimit()); + return this; + } + + /** + *

The ad network whose targeting taxonomy to search.

+ *

The ad network whose targeting taxonomy to search.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public _FinalStage platform(@NotNull SearchTargetingOptionsAdGroupsRequestPlatform platform) { + this.platform = Objects.requireNonNull(platform, "platform must not be null"); + return this; + } + + /** + *

Maximum number of results per requested type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

Maximum number of results per requested type.

+ */ + @java.lang.Override + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public _FinalStage limit(Optional limit) { + this.limit = limit; + return this; + } + + /** + *

Narrow location results to one country, as an ISO 3166-1 code such as US. Only applies when types includes locations.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

Narrow location results to one country, as an ISO 3166-1 code such as US. Only applies when types includes locations.

+ */ + @java.lang.Override + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public _FinalStage country(Optional country) { + this.country = country; + return this; + } + + /** + *

The search term. Blank browses the fixed lists; interests, work employers, job titles, schools, majors, and locations return nothing without one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + /** + *

The search term. Blank browses the fixed lists; interests, work employers, job titles, schools, majors, and locations return nothing without one.

+ */ + @java.lang.Override + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public _FinalStage query(Optional query) { + this.query = query; + return this; + } + + /** + *

Account to search on behalf of. Defaults to the authenticated account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Account to search on behalf of. Defaults to the authenticated account.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public _FinalStage locationTypes(SearchTargetingOptionsAdGroupsRequestLocationTypesItem locationTypes) { + this.locationTypes = Optional.of(Collections.singletonList(locationTypes)); + return this; + } + + /** + *

Narrow location results to these kinds of places. Only applies when types includes locations.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage locationTypes(List locationTypes) { + this.locationTypes = Optional.ofNullable(locationTypes); + return this; + } + + /** + *

Narrow location results to these kinds of places. Only applies when types includes locations.

+ */ + @java.lang.Override + @JsonSetter(value = "location_types", nulls = Nulls.SKIP) + public _FinalStage locationTypes( + Optional> locationTypes) { + this.locationTypes = locationTypes; + return this; + } + + @java.lang.Override + public _FinalStage types(SearchTargetingOptionsAdGroupsRequestTypesItem types) { + this.types = Optional.of(Collections.singletonList(types)); + return this; + } + + /** + *

Kinds of targeting options to search. Defaults to all of them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage types(List types) { + this.types = Optional.ofNullable(types); + return this; + } + + /** + *

Kinds of targeting options to search. Defaults to all of them.

+ */ + @java.lang.Override + @JsonSetter(value = "types", nulls = Nulls.SKIP) + public _FinalStage types(Optional> types) { + this.types = types; + return this; + } + + @java.lang.Override + public SearchTargetingOptionsAdGroupsRequest build() { + return new SearchTargetingOptionsAdGroupsRequest( + types, locationTypes, accountId, platform, query, country, limit, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/requests/UnpauseAdGroupsRequest.java b/src/main/java/com/whop/api/resources/adgroups/requests/UnpauseAdGroupsRequest.java new file mode 100644 index 00000000..17d55c14 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/requests/UnpauseAdGroupsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UnpauseAdGroupsRequest.Builder.class) +public final class UnpauseAdGroupsRequest { + private final Map additionalProperties; + + private UnpauseAdGroupsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UnpauseAdGroupsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UnpauseAdGroupsRequest other) { + return this; + } + + public UnpauseAdGroupsRequest build() { + return new UnpauseAdGroupsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/requests/UpdateAdGroupsRequest.java b/src/main/java/com/whop/api/resources/adgroups/requests/UpdateAdGroupsRequest.java new file mode 100644 index 00000000..6f0a0dcd --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/requests/UpdateAdGroupsRequest.java @@ -0,0 +1,806 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.adgroups.types.UpdateAdGroupsRequestBidType; +import com.whop.api.resources.adgroups.types.UpdateAdGroupsRequestBudgetType; +import com.whop.api.resources.adgroups.types.UpdateAdGroupsRequestConversionLocation; +import com.whop.api.resources.adgroups.types.UpdateAdGroupsRequestFrequencyCap; +import com.whop.api.resources.adgroups.types.UpdateAdGroupsRequestMessageAppsItem; +import com.whop.api.resources.adgroups.types.UpdateAdGroupsRequestOptimizationGoal; +import com.whop.api.resources.adgroups.types.UpdateAdGroupsRequestPlacements; +import com.whop.api.resources.adgroups.types.UpdateAdGroupsRequestStatus; +import com.whop.api.types.AdGroupAudiencesBody; +import com.whop.api.types.AdGroupDemographicsBody; +import com.whop.api.types.AdGroupDetailedTargetingBody; +import com.whop.api.types.AdGroupDevicesBody; +import com.whop.api.types.AdGroupRegionsBody; +import com.whop.api.types.ConversionEvent; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdGroupsRequest.Builder.class) +public final class UpdateAdGroupsRequest { + private final Optional audiences; + + private final Optional bidType; + + private final Optional budgetAmount; + + private final Optional budgetType; + + private final Optional conversionEvent; + + private final Optional conversionLocation; + + private final Optional demographics; + + private final Optional desiredCostPerResult; + + private final Optional detailedTargeting; + + private final Optional devices; + + private final Optional endsAt; + + private final Optional frequencyCap; + + private final Optional> languages; + + private final Optional> messageApps; + + private final Optional minimumDailySpend; + + private final Optional optimizationGoal; + + private final Optional placements; + + private final Optional regions; + + private final Optional startsAt; + + private final Optional status; + + private final Optional title; + + private final Map additionalProperties; + + private UpdateAdGroupsRequest( + Optional audiences, + Optional bidType, + Optional budgetAmount, + Optional budgetType, + Optional conversionEvent, + Optional conversionLocation, + Optional demographics, + Optional desiredCostPerResult, + Optional detailedTargeting, + Optional devices, + Optional endsAt, + Optional frequencyCap, + Optional> languages, + Optional> messageApps, + Optional minimumDailySpend, + Optional optimizationGoal, + Optional placements, + Optional regions, + Optional startsAt, + Optional status, + Optional title, + Map additionalProperties) { + this.audiences = audiences; + this.bidType = bidType; + this.budgetAmount = budgetAmount; + this.budgetType = budgetType; + this.conversionEvent = conversionEvent; + this.conversionLocation = conversionLocation; + this.demographics = demographics; + this.desiredCostPerResult = desiredCostPerResult; + this.detailedTargeting = detailedTargeting; + this.devices = devices; + this.endsAt = endsAt; + this.frequencyCap = frequencyCap; + this.languages = languages; + this.messageApps = messageApps; + this.minimumDailySpend = minimumDailySpend; + this.optimizationGoal = optimizationGoal; + this.placements = placements; + this.regions = regions; + this.startsAt = startsAt; + this.status = status; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Saved audiences to deliver to or exclude. Can't be combined with demographics.automatic. + */ + @JsonProperty("audiences") + public Optional getAudiences() { + return audiences; + } + + /** + * @return How delivery bids are set in the ad auction. Target-based strategies use desired_cost_per_result. + */ + @JsonProperty("bid_type") + public Optional getBidType() { + return bidType; + } + + /** + * @return This ad group's budget, in the ad account's currency. Omit when the budget is set on the campaign instead. + */ + @JsonProperty("budget_amount") + public Optional getBudgetAmount() { + return budgetAmount; + } + + /** + * @return Whether budget_amount is spent per day (daily) or over the ad group's full run (lifetime). + */ + @JsonProperty("budget_type") + public Optional getBudgetType() { + return budgetType; + } + + @JsonIgnore + public Optional getConversionEvent() { + if (conversionEvent == null) { + return Optional.empty(); + } + return conversionEvent; + } + + /** + * @return Where the outcome being optimized for occurs, such as a website visit, social-profile visit, messaging conversation, ad interaction, or lead-form submission. The lead form itself is set on the ad. + */ + @JsonProperty("conversion_location") + public Optional getConversionLocation() { + return conversionLocation; + } + + /** + * @return Age, gender, and automatic-audience targeting. + */ + @JsonProperty("demographics") + public Optional getDemographics() { + return demographics; + } + + /** + * @return Cost per result to aim for (average_target) or never exceed (maximum_target). + */ + @JsonProperty("desired_cost_per_result") + public Optional getDesiredCostPerResult() { + return desiredCostPerResult; + } + + /** + * @return Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. Entries across interests, behaviors, and demographics are OR'd together (anyone matching any entry is reached), matching Ads Manager's detailed-targeting box. At most 100 entries per section. Can't be combined with demographics.automatic, and unavailable to campaigns with special_ad_categories. Send the complete intended state — a section you omit is cleared. + */ + @JsonProperty("detailed_targeting") + public Optional getDetailedTargeting() { + return detailedTargeting; + } + + /** + * @return Device platforms and operating systems to target. + */ + @JsonProperty("devices") + public Optional getDevices() { + return devices; + } + + /** + * @return When the ad group stops delivering, as an ISO 8601 timestamp. Omit to run until paused. + */ + @JsonProperty("ends_at") + public Optional getEndsAt() { + return endsAt; + } + + /** + * @return Cap on how often one person sees ads from this ad group. Only available on campaigns with the awareness objective. + */ + @JsonProperty("frequency_cap") + public Optional getFrequencyCap() { + return frequencyCap; + } + + /** + * @return Languages to target, as ISO 639 codes such as en or es. Empty or omitted targets all languages. + */ + @JsonProperty("languages") + public Optional> getLanguages() { + return languages; + } + + /** + * @return Apps the conversation opens in. Required when setting conversion_location to messaging, and rejected unless the ad group's conversion location is messaging. + */ + @JsonProperty("message_apps") + public Optional> getMessageApps() { + return messageApps; + } + + /** + * @return Minimum the ad group tries to spend each day. + */ + @JsonProperty("minimum_daily_spend") + public Optional getMinimumDailySpend() { + return minimumDailySpend; + } + + /** + * @return The result the ad group's delivery is optimized to get the most of. + */ + @JsonProperty("optimization_goal") + public Optional getOptimizationGoal() { + return optimizationGoal; + } + + /** + * @return automatic to let the ad platform choose placements, or the list of platforms and positions to target. Omit a platform's positions to target all of them. + *

Valid positions per platform:

+ *
    + *
  • facebook: feed, right_hand_column, marketplace, search, profile_feed, notification, story, instream_video, facebook_reels, facebook_reels_overlay, biz_disco_feed
  • + *
  • instagram: stream, story, explore, explore_home, reels, profile_feed, profile_reels, ig_search
  • + *
  • messenger: story
  • + *
  • audience_network: classic, rewarded_video
  • + *
  • threads: threads_stream
  • + *
  • whatsapp: status
  • + *
+ */ + @JsonProperty("placements") + public Optional getPlacements() { + return placements; + } + + /** + * @return Locations to target and exclude. + */ + @JsonProperty("regions") + public Optional getRegions() { + return regions; + } + + /** + * @return When the ad group starts delivering, as an ISO 8601 timestamp. Omit to start as soon as it's active. + */ + @JsonProperty("starts_at") + public Optional getStartsAt() { + return startsAt; + } + + /** + * @return Initial status (default: active). + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return The display name of the ad group. + */ + @JsonProperty("title") + public Optional getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("conversion_event") + private Optional _getConversionEvent() { + return conversionEvent; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdGroupsRequest && equalTo((UpdateAdGroupsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdGroupsRequest other) { + return audiences.equals(other.audiences) + && bidType.equals(other.bidType) + && budgetAmount.equals(other.budgetAmount) + && budgetType.equals(other.budgetType) + && conversionEvent.equals(other.conversionEvent) + && conversionLocation.equals(other.conversionLocation) + && demographics.equals(other.demographics) + && desiredCostPerResult.equals(other.desiredCostPerResult) + && detailedTargeting.equals(other.detailedTargeting) + && devices.equals(other.devices) + && endsAt.equals(other.endsAt) + && frequencyCap.equals(other.frequencyCap) + && languages.equals(other.languages) + && messageApps.equals(other.messageApps) + && minimumDailySpend.equals(other.minimumDailySpend) + && optimizationGoal.equals(other.optimizationGoal) + && placements.equals(other.placements) + && regions.equals(other.regions) + && startsAt.equals(other.startsAt) + && status.equals(other.status) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.audiences, + this.bidType, + this.budgetAmount, + this.budgetType, + this.conversionEvent, + this.conversionLocation, + this.demographics, + this.desiredCostPerResult, + this.detailedTargeting, + this.devices, + this.endsAt, + this.frequencyCap, + this.languages, + this.messageApps, + this.minimumDailySpend, + this.optimizationGoal, + this.placements, + this.regions, + this.startsAt, + this.status, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional audiences = Optional.empty(); + + private Optional bidType = Optional.empty(); + + private Optional budgetAmount = Optional.empty(); + + private Optional budgetType = Optional.empty(); + + private Optional conversionEvent = Optional.empty(); + + private Optional conversionLocation = Optional.empty(); + + private Optional demographics = Optional.empty(); + + private Optional desiredCostPerResult = Optional.empty(); + + private Optional detailedTargeting = Optional.empty(); + + private Optional devices = Optional.empty(); + + private Optional endsAt = Optional.empty(); + + private Optional frequencyCap = Optional.empty(); + + private Optional> languages = Optional.empty(); + + private Optional> messageApps = Optional.empty(); + + private Optional minimumDailySpend = Optional.empty(); + + private Optional optimizationGoal = Optional.empty(); + + private Optional placements = Optional.empty(); + + private Optional regions = Optional.empty(); + + private Optional startsAt = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdGroupsRequest other) { + audiences(other.getAudiences()); + bidType(other.getBidType()); + budgetAmount(other.getBudgetAmount()); + budgetType(other.getBudgetType()); + conversionEvent(other.getConversionEvent()); + conversionLocation(other.getConversionLocation()); + demographics(other.getDemographics()); + desiredCostPerResult(other.getDesiredCostPerResult()); + detailedTargeting(other.getDetailedTargeting()); + devices(other.getDevices()); + endsAt(other.getEndsAt()); + frequencyCap(other.getFrequencyCap()); + languages(other.getLanguages()); + messageApps(other.getMessageApps()); + minimumDailySpend(other.getMinimumDailySpend()); + optimizationGoal(other.getOptimizationGoal()); + placements(other.getPlacements()); + regions(other.getRegions()); + startsAt(other.getStartsAt()); + status(other.getStatus()); + title(other.getTitle()); + return this; + } + + /** + *

Saved audiences to deliver to or exclude. Can't be combined with demographics.automatic.

+ */ + @JsonSetter(value = "audiences", nulls = Nulls.SKIP) + public Builder audiences(Optional audiences) { + this.audiences = audiences; + return this; + } + + public Builder audiences(AdGroupAudiencesBody audiences) { + this.audiences = Optional.ofNullable(audiences); + return this; + } + + /** + *

How delivery bids are set in the ad auction. Target-based strategies use desired_cost_per_result.

+ */ + @JsonSetter(value = "bid_type", nulls = Nulls.SKIP) + public Builder bidType(Optional bidType) { + this.bidType = bidType; + return this; + } + + public Builder bidType(UpdateAdGroupsRequestBidType bidType) { + this.bidType = Optional.ofNullable(bidType); + return this; + } + + /** + *

This ad group's budget, in the ad account's currency. Omit when the budget is set on the campaign instead.

+ */ + @JsonSetter(value = "budget_amount", nulls = Nulls.SKIP) + public Builder budgetAmount(Optional budgetAmount) { + this.budgetAmount = budgetAmount; + return this; + } + + public Builder budgetAmount(Double budgetAmount) { + this.budgetAmount = Optional.ofNullable(budgetAmount); + return this; + } + + /** + *

Whether budget_amount is spent per day (daily) or over the ad group's full run (lifetime).

+ */ + @JsonSetter(value = "budget_type", nulls = Nulls.SKIP) + public Builder budgetType(Optional budgetType) { + this.budgetType = budgetType; + return this; + } + + public Builder budgetType(UpdateAdGroupsRequestBudgetType budgetType) { + this.budgetType = Optional.ofNullable(budgetType); + return this; + } + + @JsonSetter(value = "conversion_event", nulls = Nulls.SKIP) + public Builder conversionEvent(Optional conversionEvent) { + this.conversionEvent = conversionEvent; + return this; + } + + public Builder conversionEvent(ConversionEvent conversionEvent) { + this.conversionEvent = Optional.ofNullable(conversionEvent); + return this; + } + + public Builder conversionEvent(Nullable conversionEvent) { + if (conversionEvent.isNull()) { + this.conversionEvent = null; + } else if (conversionEvent.isEmpty()) { + this.conversionEvent = Optional.empty(); + } else { + this.conversionEvent = Optional.of(conversionEvent.get()); + } + return this; + } + + /** + *

Where the outcome being optimized for occurs, such as a website visit, social-profile visit, messaging conversation, ad interaction, or lead-form submission. The lead form itself is set on the ad.

+ */ + @JsonSetter(value = "conversion_location", nulls = Nulls.SKIP) + public Builder conversionLocation(Optional conversionLocation) { + this.conversionLocation = conversionLocation; + return this; + } + + public Builder conversionLocation(UpdateAdGroupsRequestConversionLocation conversionLocation) { + this.conversionLocation = Optional.ofNullable(conversionLocation); + return this; + } + + /** + *

Age, gender, and automatic-audience targeting.

+ */ + @JsonSetter(value = "demographics", nulls = Nulls.SKIP) + public Builder demographics(Optional demographics) { + this.demographics = demographics; + return this; + } + + public Builder demographics(AdGroupDemographicsBody demographics) { + this.demographics = Optional.ofNullable(demographics); + return this; + } + + /** + *

Cost per result to aim for (average_target) or never exceed (maximum_target).

+ */ + @JsonSetter(value = "desired_cost_per_result", nulls = Nulls.SKIP) + public Builder desiredCostPerResult(Optional desiredCostPerResult) { + this.desiredCostPerResult = desiredCostPerResult; + return this; + } + + public Builder desiredCostPerResult(Double desiredCostPerResult) { + this.desiredCostPerResult = Optional.ofNullable(desiredCostPerResult); + return this; + } + + /** + *

Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. Entries across interests, behaviors, and demographics are OR'd together (anyone matching any entry is reached), matching Ads Manager's detailed-targeting box. At most 100 entries per section. Can't be combined with demographics.automatic, and unavailable to campaigns with special_ad_categories. Send the complete intended state — a section you omit is cleared.

+ */ + @JsonSetter(value = "detailed_targeting", nulls = Nulls.SKIP) + public Builder detailedTargeting(Optional detailedTargeting) { + this.detailedTargeting = detailedTargeting; + return this; + } + + public Builder detailedTargeting(AdGroupDetailedTargetingBody detailedTargeting) { + this.detailedTargeting = Optional.ofNullable(detailedTargeting); + return this; + } + + /** + *

Device platforms and operating systems to target.

+ */ + @JsonSetter(value = "devices", nulls = Nulls.SKIP) + public Builder devices(Optional devices) { + this.devices = devices; + return this; + } + + public Builder devices(AdGroupDevicesBody devices) { + this.devices = Optional.ofNullable(devices); + return this; + } + + /** + *

When the ad group stops delivering, as an ISO 8601 timestamp. Omit to run until paused.

+ */ + @JsonSetter(value = "ends_at", nulls = Nulls.SKIP) + public Builder endsAt(Optional endsAt) { + this.endsAt = endsAt; + return this; + } + + public Builder endsAt(String endsAt) { + this.endsAt = Optional.ofNullable(endsAt); + return this; + } + + /** + *

Cap on how often one person sees ads from this ad group. Only available on campaigns with the awareness objective.

+ */ + @JsonSetter(value = "frequency_cap", nulls = Nulls.SKIP) + public Builder frequencyCap(Optional frequencyCap) { + this.frequencyCap = frequencyCap; + return this; + } + + public Builder frequencyCap(UpdateAdGroupsRequestFrequencyCap frequencyCap) { + this.frequencyCap = Optional.ofNullable(frequencyCap); + return this; + } + + /** + *

Languages to target, as ISO 639 codes such as en or es. Empty or omitted targets all languages.

+ */ + @JsonSetter(value = "languages", nulls = Nulls.SKIP) + public Builder languages(Optional> languages) { + this.languages = languages; + return this; + } + + public Builder languages(List languages) { + this.languages = Optional.ofNullable(languages); + return this; + } + + /** + *

Apps the conversation opens in. Required when setting conversion_location to messaging, and rejected unless the ad group's conversion location is messaging.

+ */ + @JsonSetter(value = "message_apps", nulls = Nulls.SKIP) + public Builder messageApps(Optional> messageApps) { + this.messageApps = messageApps; + return this; + } + + public Builder messageApps(List messageApps) { + this.messageApps = Optional.ofNullable(messageApps); + return this; + } + + /** + *

Minimum the ad group tries to spend each day.

+ */ + @JsonSetter(value = "minimum_daily_spend", nulls = Nulls.SKIP) + public Builder minimumDailySpend(Optional minimumDailySpend) { + this.minimumDailySpend = minimumDailySpend; + return this; + } + + public Builder minimumDailySpend(Double minimumDailySpend) { + this.minimumDailySpend = Optional.ofNullable(minimumDailySpend); + return this; + } + + /** + *

The result the ad group's delivery is optimized to get the most of.

+ */ + @JsonSetter(value = "optimization_goal", nulls = Nulls.SKIP) + public Builder optimizationGoal(Optional optimizationGoal) { + this.optimizationGoal = optimizationGoal; + return this; + } + + public Builder optimizationGoal(UpdateAdGroupsRequestOptimizationGoal optimizationGoal) { + this.optimizationGoal = Optional.ofNullable(optimizationGoal); + return this; + } + + /** + *

automatic to let the ad platform choose placements, or the list of platforms and positions to target. Omit a platform's positions to target all of them.

+ *

Valid positions per platform:

+ *
    + *
  • facebook: feed, right_hand_column, marketplace, search, profile_feed, notification, story, instream_video, facebook_reels, facebook_reels_overlay, biz_disco_feed
  • + *
  • instagram: stream, story, explore, explore_home, reels, profile_feed, profile_reels, ig_search
  • + *
  • messenger: story
  • + *
  • audience_network: classic, rewarded_video
  • + *
  • threads: threads_stream
  • + *
  • whatsapp: status
  • + *
+ */ + @JsonSetter(value = "placements", nulls = Nulls.SKIP) + public Builder placements(Optional placements) { + this.placements = placements; + return this; + } + + public Builder placements(UpdateAdGroupsRequestPlacements placements) { + this.placements = Optional.ofNullable(placements); + return this; + } + + /** + *

Locations to target and exclude.

+ */ + @JsonSetter(value = "regions", nulls = Nulls.SKIP) + public Builder regions(Optional regions) { + this.regions = regions; + return this; + } + + public Builder regions(AdGroupRegionsBody regions) { + this.regions = Optional.ofNullable(regions); + return this; + } + + /** + *

When the ad group starts delivering, as an ISO 8601 timestamp. Omit to start as soon as it's active.

+ */ + @JsonSetter(value = "starts_at", nulls = Nulls.SKIP) + public Builder startsAt(Optional startsAt) { + this.startsAt = startsAt; + return this; + } + + public Builder startsAt(String startsAt) { + this.startsAt = Optional.ofNullable(startsAt); + return this; + } + + /** + *

Initial status (default: active).

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(UpdateAdGroupsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The display name of the ad group.

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public UpdateAdGroupsRequest build() { + return new UpdateAdGroupsRequest( + audiences, + bidType, + budgetAmount, + budgetType, + conversionEvent, + conversionLocation, + demographics, + desiredCostPerResult, + detailedTargeting, + devices, + endsAt, + frequencyCap, + languages, + messageApps, + minimumDailySpend, + optimizationGoal, + placements, + regions, + startsAt, + status, + title, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestBidType.java b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestBidType.java new file mode 100644 index 00000000..528b7806 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestBidType.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdGroupsRequestBidType { + public static final CreateAdGroupsRequestBidType AVERAGE_TARGET = + new CreateAdGroupsRequestBidType(Value.AVERAGE_TARGET, "average_target"); + + public static final CreateAdGroupsRequestBidType MAXIMUM_TARGET = + new CreateAdGroupsRequestBidType(Value.MAXIMUM_TARGET, "maximum_target"); + + public static final CreateAdGroupsRequestBidType MINIMUM_COST = + new CreateAdGroupsRequestBidType(Value.MINIMUM_COST, "minimum_cost"); + + private final Value value; + + private final String string; + + CreateAdGroupsRequestBidType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdGroupsRequestBidType + && this.string.equals(((CreateAdGroupsRequestBidType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AVERAGE_TARGET: + return visitor.visitAverageTarget(); + case MAXIMUM_TARGET: + return visitor.visitMaximumTarget(); + case MINIMUM_COST: + return visitor.visitMinimumCost(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdGroupsRequestBidType valueOf(String value) { + switch (value) { + case "average_target": + return AVERAGE_TARGET; + case "maximum_target": + return MAXIMUM_TARGET; + case "minimum_cost": + return MINIMUM_COST; + default: + return new CreateAdGroupsRequestBidType(Value.UNKNOWN, value); + } + } + + public enum Value { + MINIMUM_COST, + + AVERAGE_TARGET, + + MAXIMUM_TARGET, + + UNKNOWN + } + + public interface Visitor { + T visitMinimumCost(); + + T visitAverageTarget(); + + T visitMaximumTarget(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestBudgetType.java b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestBudgetType.java new file mode 100644 index 00000000..735276c9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestBudgetType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdGroupsRequestBudgetType { + public static final CreateAdGroupsRequestBudgetType DAILY = + new CreateAdGroupsRequestBudgetType(Value.DAILY, "daily"); + + public static final CreateAdGroupsRequestBudgetType LIFETIME = + new CreateAdGroupsRequestBudgetType(Value.LIFETIME, "lifetime"); + + private final Value value; + + private final String string; + + CreateAdGroupsRequestBudgetType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdGroupsRequestBudgetType + && this.string.equals(((CreateAdGroupsRequestBudgetType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DAILY: + return visitor.visitDaily(); + case LIFETIME: + return visitor.visitLifetime(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdGroupsRequestBudgetType valueOf(String value) { + switch (value) { + case "daily": + return DAILY; + case "lifetime": + return LIFETIME; + default: + return new CreateAdGroupsRequestBudgetType(Value.UNKNOWN, value); + } + } + + public enum Value { + DAILY, + + LIFETIME, + + UNKNOWN + } + + public interface Visitor { + T visitDaily(); + + T visitLifetime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestConversionLocation.java b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestConversionLocation.java new file mode 100644 index 00000000..bd1a4e07 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestConversionLocation.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdGroupsRequestConversionLocation { + public static final CreateAdGroupsRequestConversionLocation WEBSITE = + new CreateAdGroupsRequestConversionLocation(Value.WEBSITE, "website"); + + public static final CreateAdGroupsRequestConversionLocation MESSAGING = + new CreateAdGroupsRequestConversionLocation(Value.MESSAGING, "messaging"); + + public static final CreateAdGroupsRequestConversionLocation INSTANT_FORMS_AND_MESSENGER = + new CreateAdGroupsRequestConversionLocation( + Value.INSTANT_FORMS_AND_MESSENGER, "instant_forms_and_messenger"); + + public static final CreateAdGroupsRequestConversionLocation WEBSITE_AND_INSTANT_FORMS = + new CreateAdGroupsRequestConversionLocation(Value.WEBSITE_AND_INSTANT_FORMS, "website_and_instant_forms"); + + public static final CreateAdGroupsRequestConversionLocation PROFILE = + new CreateAdGroupsRequestConversionLocation(Value.PROFILE, "profile"); + + public static final CreateAdGroupsRequestConversionLocation INSTANT_FORMS = + new CreateAdGroupsRequestConversionLocation(Value.INSTANT_FORMS, "instant_forms"); + + public static final CreateAdGroupsRequestConversionLocation INSTAGRAM_AND_FACEBOOK = + new CreateAdGroupsRequestConversionLocation(Value.INSTAGRAM_AND_FACEBOOK, "instagram_and_facebook"); + + public static final CreateAdGroupsRequestConversionLocation ON_AD = + new CreateAdGroupsRequestConversionLocation(Value.ON_AD, "on_ad"); + + public static final CreateAdGroupsRequestConversionLocation INSTAGRAM_PROFILE = + new CreateAdGroupsRequestConversionLocation(Value.INSTAGRAM_PROFILE, "instagram_profile"); + + private final Value value; + + private final String string; + + CreateAdGroupsRequestConversionLocation(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdGroupsRequestConversionLocation + && this.string.equals(((CreateAdGroupsRequestConversionLocation) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WEBSITE: + return visitor.visitWebsite(); + case MESSAGING: + return visitor.visitMessaging(); + case INSTANT_FORMS_AND_MESSENGER: + return visitor.visitInstantFormsAndMessenger(); + case WEBSITE_AND_INSTANT_FORMS: + return visitor.visitWebsiteAndInstantForms(); + case PROFILE: + return visitor.visitProfile(); + case INSTANT_FORMS: + return visitor.visitInstantForms(); + case INSTAGRAM_AND_FACEBOOK: + return visitor.visitInstagramAndFacebook(); + case ON_AD: + return visitor.visitOnAd(); + case INSTAGRAM_PROFILE: + return visitor.visitInstagramProfile(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdGroupsRequestConversionLocation valueOf(String value) { + switch (value) { + case "website": + return WEBSITE; + case "messaging": + return MESSAGING; + case "instant_forms_and_messenger": + return INSTANT_FORMS_AND_MESSENGER; + case "website_and_instant_forms": + return WEBSITE_AND_INSTANT_FORMS; + case "profile": + return PROFILE; + case "instant_forms": + return INSTANT_FORMS; + case "instagram_and_facebook": + return INSTAGRAM_AND_FACEBOOK; + case "on_ad": + return ON_AD; + case "instagram_profile": + return INSTAGRAM_PROFILE; + default: + return new CreateAdGroupsRequestConversionLocation(Value.UNKNOWN, value); + } + } + + public enum Value { + WEBSITE, + + PROFILE, + + INSTAGRAM_AND_FACEBOOK, + + INSTAGRAM_PROFILE, + + MESSAGING, + + ON_AD, + + INSTANT_FORMS, + + INSTANT_FORMS_AND_MESSENGER, + + WEBSITE_AND_INSTANT_FORMS, + + UNKNOWN + } + + public interface Visitor { + T visitWebsite(); + + T visitProfile(); + + T visitInstagramAndFacebook(); + + T visitInstagramProfile(); + + T visitMessaging(); + + T visitOnAd(); + + T visitInstantForms(); + + T visitInstantFormsAndMessenger(); + + T visitWebsiteAndInstantForms(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestFrequencyCap.java b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestFrequencyCap.java new file mode 100644 index 00000000..d81fece7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestFrequencyCap.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdGroupsRequestFrequencyCap.Builder.class) +public final class CreateAdGroupsRequestFrequencyCap { + private final Optional maximumImpressions; + + private final Optional perDays; + + private final Map additionalProperties; + + private CreateAdGroupsRequestFrequencyCap( + Optional maximumImpressions, Optional perDays, Map additionalProperties) { + this.maximumImpressions = maximumImpressions; + this.perDays = perDays; + this.additionalProperties = additionalProperties; + } + + /** + * @return Most times one person can be shown ads from this ad group within the window. + */ + @JsonProperty("maximum_impressions") + public Optional getMaximumImpressions() { + return maximumImpressions; + } + + /** + * @return Length of the rolling window, in days. + */ + @JsonProperty("per_days") + public Optional getPerDays() { + return perDays; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdGroupsRequestFrequencyCap && equalTo((CreateAdGroupsRequestFrequencyCap) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdGroupsRequestFrequencyCap other) { + return maximumImpressions.equals(other.maximumImpressions) && perDays.equals(other.perDays); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.maximumImpressions, this.perDays); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional maximumImpressions = Optional.empty(); + + private Optional perDays = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAdGroupsRequestFrequencyCap other) { + maximumImpressions(other.getMaximumImpressions()); + perDays(other.getPerDays()); + return this; + } + + /** + *

Most times one person can be shown ads from this ad group within the window.

+ */ + @JsonSetter(value = "maximum_impressions", nulls = Nulls.SKIP) + public Builder maximumImpressions(Optional maximumImpressions) { + this.maximumImpressions = maximumImpressions; + return this; + } + + public Builder maximumImpressions(Integer maximumImpressions) { + this.maximumImpressions = Optional.ofNullable(maximumImpressions); + return this; + } + + /** + *

Length of the rolling window, in days.

+ */ + @JsonSetter(value = "per_days", nulls = Nulls.SKIP) + public Builder perDays(Optional perDays) { + this.perDays = perDays; + return this; + } + + public Builder perDays(Integer perDays) { + this.perDays = Optional.ofNullable(perDays); + return this; + } + + public CreateAdGroupsRequestFrequencyCap build() { + return new CreateAdGroupsRequestFrequencyCap(maximumImpressions, perDays, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestMessageAppsItem.java b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestMessageAppsItem.java new file mode 100644 index 00000000..5844f747 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestMessageAppsItem.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdGroupsRequestMessageAppsItem { + public static final CreateAdGroupsRequestMessageAppsItem INSTAGRAM = + new CreateAdGroupsRequestMessageAppsItem(Value.INSTAGRAM, "instagram"); + + public static final CreateAdGroupsRequestMessageAppsItem WHATSAPP = + new CreateAdGroupsRequestMessageAppsItem(Value.WHATSAPP, "whatsapp"); + + public static final CreateAdGroupsRequestMessageAppsItem MESSENGER = + new CreateAdGroupsRequestMessageAppsItem(Value.MESSENGER, "messenger"); + + private final Value value; + + private final String string; + + CreateAdGroupsRequestMessageAppsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdGroupsRequestMessageAppsItem + && this.string.equals(((CreateAdGroupsRequestMessageAppsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTAGRAM: + return visitor.visitInstagram(); + case WHATSAPP: + return visitor.visitWhatsapp(); + case MESSENGER: + return visitor.visitMessenger(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdGroupsRequestMessageAppsItem valueOf(String value) { + switch (value) { + case "instagram": + return INSTAGRAM; + case "whatsapp": + return WHATSAPP; + case "messenger": + return MESSENGER; + default: + return new CreateAdGroupsRequestMessageAppsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + MESSENGER, + + INSTAGRAM, + + WHATSAPP, + + UNKNOWN + } + + public interface Visitor { + T visitMessenger(); + + T visitInstagram(); + + T visitWhatsapp(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestOptimizationGoal.java b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestOptimizationGoal.java new file mode 100644 index 00000000..6f539505 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestOptimizationGoal.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdGroupsRequestOptimizationGoal { + public static final CreateAdGroupsRequestOptimizationGoal AD_RECALL_LIFT = + new CreateAdGroupsRequestOptimizationGoal(Value.AD_RECALL_LIFT, "ad_recall_lift"); + + public static final CreateAdGroupsRequestOptimizationGoal PAGE_LIKES = + new CreateAdGroupsRequestOptimizationGoal(Value.PAGE_LIKES, "page_likes"); + + public static final CreateAdGroupsRequestOptimizationGoal CONVERSIONS = + new CreateAdGroupsRequestOptimizationGoal(Value.CONVERSIONS, "conversions"); + + public static final CreateAdGroupsRequestOptimizationGoal LINK_CLICKS = + new CreateAdGroupsRequestOptimizationGoal(Value.LINK_CLICKS, "link_clicks"); + + public static final CreateAdGroupsRequestOptimizationGoal TWO_SECOND_VIEWS = + new CreateAdGroupsRequestOptimizationGoal(Value.TWO_SECOND_VIEWS, "two_second_views"); + + public static final CreateAdGroupsRequestOptimizationGoal EVENT_RESPONSES = + new CreateAdGroupsRequestOptimizationGoal(Value.EVENT_RESPONSES, "event_responses"); + + public static final CreateAdGroupsRequestOptimizationGoal SOCIAL_PROFILE = + new CreateAdGroupsRequestOptimizationGoal(Value.SOCIAL_PROFILE, "social_profile"); + + public static final CreateAdGroupsRequestOptimizationGoal VIDEO_VIEWS = + new CreateAdGroupsRequestOptimizationGoal(Value.VIDEO_VIEWS, "video_views"); + + public static final CreateAdGroupsRequestOptimizationGoal VALUE = + new CreateAdGroupsRequestOptimizationGoal(Value.VALUE, "value"); + + public static final CreateAdGroupsRequestOptimizationGoal REACH = + new CreateAdGroupsRequestOptimizationGoal(Value.REACH, "reach"); + + public static final CreateAdGroupsRequestOptimizationGoal LANDING_PAGE_VIEWS = + new CreateAdGroupsRequestOptimizationGoal(Value.LANDING_PAGE_VIEWS, "landing_page_views"); + + public static final CreateAdGroupsRequestOptimizationGoal PROFILE_AND_PAGE_ENGAGEMENT = + new CreateAdGroupsRequestOptimizationGoal(Value.PROFILE_AND_PAGE_ENGAGEMENT, "profile_and_page_engagement"); + + public static final CreateAdGroupsRequestOptimizationGoal CONVERSATIONS = + new CreateAdGroupsRequestOptimizationGoal(Value.CONVERSATIONS, "conversations"); + + public static final CreateAdGroupsRequestOptimizationGoal REMINDERS_SET = + new CreateAdGroupsRequestOptimizationGoal(Value.REMINDERS_SET, "reminders_set"); + + public static final CreateAdGroupsRequestOptimizationGoal ENGAGEMENT = + new CreateAdGroupsRequestOptimizationGoal(Value.ENGAGEMENT, "engagement"); + + public static final CreateAdGroupsRequestOptimizationGoal LEAD_GENERATION = + new CreateAdGroupsRequestOptimizationGoal(Value.LEAD_GENERATION, "lead_generation"); + + public static final CreateAdGroupsRequestOptimizationGoal QUALITY_LEAD = + new CreateAdGroupsRequestOptimizationGoal(Value.QUALITY_LEAD, "quality_lead"); + + public static final CreateAdGroupsRequestOptimizationGoal IMPRESSIONS = + new CreateAdGroupsRequestOptimizationGoal(Value.IMPRESSIONS, "impressions"); + + private final Value value; + + private final String string; + + CreateAdGroupsRequestOptimizationGoal(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdGroupsRequestOptimizationGoal + && this.string.equals(((CreateAdGroupsRequestOptimizationGoal) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AD_RECALL_LIFT: + return visitor.visitAdRecallLift(); + case PAGE_LIKES: + return visitor.visitPageLikes(); + case CONVERSIONS: + return visitor.visitConversions(); + case LINK_CLICKS: + return visitor.visitLinkClicks(); + case TWO_SECOND_VIEWS: + return visitor.visitTwoSecondViews(); + case EVENT_RESPONSES: + return visitor.visitEventResponses(); + case SOCIAL_PROFILE: + return visitor.visitSocialProfile(); + case VIDEO_VIEWS: + return visitor.visitVideoViews(); + case VALUE: + return visitor.visitValue(); + case REACH: + return visitor.visitReach(); + case LANDING_PAGE_VIEWS: + return visitor.visitLandingPageViews(); + case PROFILE_AND_PAGE_ENGAGEMENT: + return visitor.visitProfileAndPageEngagement(); + case CONVERSATIONS: + return visitor.visitConversations(); + case REMINDERS_SET: + return visitor.visitRemindersSet(); + case ENGAGEMENT: + return visitor.visitEngagement(); + case LEAD_GENERATION: + return visitor.visitLeadGeneration(); + case QUALITY_LEAD: + return visitor.visitQualityLead(); + case IMPRESSIONS: + return visitor.visitImpressions(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdGroupsRequestOptimizationGoal valueOf(String value) { + switch (value) { + case "ad_recall_lift": + return AD_RECALL_LIFT; + case "page_likes": + return PAGE_LIKES; + case "conversions": + return CONVERSIONS; + case "link_clicks": + return LINK_CLICKS; + case "two_second_views": + return TWO_SECOND_VIEWS; + case "event_responses": + return EVENT_RESPONSES; + case "social_profile": + return SOCIAL_PROFILE; + case "video_views": + return VIDEO_VIEWS; + case "value": + return VALUE; + case "reach": + return REACH; + case "landing_page_views": + return LANDING_PAGE_VIEWS; + case "profile_and_page_engagement": + return PROFILE_AND_PAGE_ENGAGEMENT; + case "conversations": + return CONVERSATIONS; + case "reminders_set": + return REMINDERS_SET; + case "engagement": + return ENGAGEMENT; + case "lead_generation": + return LEAD_GENERATION; + case "quality_lead": + return QUALITY_LEAD; + case "impressions": + return IMPRESSIONS; + default: + return new CreateAdGroupsRequestOptimizationGoal(Value.UNKNOWN, value); + } + } + + public enum Value { + CONVERSIONS, + + LINK_CLICKS, + + LANDING_PAGE_VIEWS, + + REACH, + + IMPRESSIONS, + + ENGAGEMENT, + + CONVERSATIONS, + + VIDEO_VIEWS, + + TWO_SECOND_VIEWS, + + PAGE_LIKES, + + SOCIAL_PROFILE, + + AD_RECALL_LIFT, + + EVENT_RESPONSES, + + REMINDERS_SET, + + LEAD_GENERATION, + + QUALITY_LEAD, + + VALUE, + + PROFILE_AND_PAGE_ENGAGEMENT, + + UNKNOWN + } + + public interface Visitor { + T visitConversions(); + + T visitLinkClicks(); + + T visitLandingPageViews(); + + T visitReach(); + + T visitImpressions(); + + T visitEngagement(); + + T visitConversations(); + + T visitVideoViews(); + + T visitTwoSecondViews(); + + T visitPageLikes(); + + T visitSocialProfile(); + + T visitAdRecallLift(); + + T visitEventResponses(); + + T visitRemindersSet(); + + T visitLeadGeneration(); + + T visitQualityLead(); + + T visitValue(); + + T visitProfileAndPageEngagement(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestPlacements.java b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestPlacements.java new file mode 100644 index 00000000..8e6d292e --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestPlacements.java @@ -0,0 +1,99 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.List; +import java.util.Objects; + +@JsonDeserialize(using = CreateAdGroupsRequestPlacements.Deserializer.class) +public final class CreateAdGroupsRequestPlacements { + private final Object value; + + private final int type; + + private CreateAdGroupsRequestPlacements(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((CreateAdGroupsRequestPlacementsZero) this.value); + } else if (this.type == 1) { + return visitor.visit((List) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdGroupsRequestPlacements && equalTo((CreateAdGroupsRequestPlacements) other); + } + + private boolean equalTo(CreateAdGroupsRequestPlacements other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static CreateAdGroupsRequestPlacements of(CreateAdGroupsRequestPlacementsZero value) { + return new CreateAdGroupsRequestPlacements(value, 0); + } + + public static CreateAdGroupsRequestPlacements of(List value) { + return new CreateAdGroupsRequestPlacements(value, 1); + } + + public interface Visitor { + T visit(CreateAdGroupsRequestPlacementsZero value); + + T visit(List value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(CreateAdGroupsRequestPlacements.class); + } + + @java.lang.Override + public CreateAdGroupsRequestPlacements deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, CreateAdGroupsRequestPlacementsZero.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, new TypeReference>() {})); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestPlacementsOneItem.java b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestPlacementsOneItem.java new file mode 100644 index 00000000..c89ce418 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestPlacementsOneItem.java @@ -0,0 +1,177 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdGroupsRequestPlacementsOneItem.Builder.class) +public final class CreateAdGroupsRequestPlacementsOneItem { + private final CreateAdGroupsRequestPlacementsOneItemPlatform platform; + + private final Optional> positions; + + private final Map additionalProperties; + + private CreateAdGroupsRequestPlacementsOneItem( + CreateAdGroupsRequestPlacementsOneItemPlatform platform, + Optional> positions, + Map additionalProperties) { + this.platform = platform; + this.positions = positions; + this.additionalProperties = additionalProperties; + } + + /** + * @return Platform the ads run on. + */ + @JsonProperty("platform") + public CreateAdGroupsRequestPlacementsOneItemPlatform getPlatform() { + return platform; + } + + /** + * @return Positions to target within the platform, such as feed or story. Omit to target all of the platform's positions. + */ + @JsonProperty("positions") + public Optional> getPositions() { + return positions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdGroupsRequestPlacementsOneItem + && equalTo((CreateAdGroupsRequestPlacementsOneItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdGroupsRequestPlacementsOneItem other) { + return platform.equals(other.platform) && positions.equals(other.positions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.platform, this.positions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlatformStage builder() { + return new Builder(); + } + + public interface PlatformStage { + /** + *

Platform the ads run on.

+ */ + _FinalStage platform(@NotNull CreateAdGroupsRequestPlacementsOneItemPlatform platform); + + Builder from(CreateAdGroupsRequestPlacementsOneItem other); + } + + public interface _FinalStage { + CreateAdGroupsRequestPlacementsOneItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Positions to target within the platform, such as feed or story. Omit to target all of the platform's positions.

+ */ + _FinalStage positions(Optional> positions); + + _FinalStage positions(List positions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlatformStage, _FinalStage { + private CreateAdGroupsRequestPlacementsOneItemPlatform platform; + + private Optional> positions = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAdGroupsRequestPlacementsOneItem other) { + platform(other.getPlatform()); + positions(other.getPositions()); + return this; + } + + /** + *

Platform the ads run on.

+ *

Platform the ads run on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public _FinalStage platform(@NotNull CreateAdGroupsRequestPlacementsOneItemPlatform platform) { + this.platform = Objects.requireNonNull(platform, "platform must not be null"); + return this; + } + + /** + *

Positions to target within the platform, such as feed or story. Omit to target all of the platform's positions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage positions(List positions) { + this.positions = Optional.ofNullable(positions); + return this; + } + + /** + *

Positions to target within the platform, such as feed or story. Omit to target all of the platform's positions.

+ */ + @java.lang.Override + @JsonSetter(value = "positions", nulls = Nulls.SKIP) + public _FinalStage positions(Optional> positions) { + this.positions = positions; + return this; + } + + @java.lang.Override + public CreateAdGroupsRequestPlacementsOneItem build() { + return new CreateAdGroupsRequestPlacementsOneItem(platform, positions, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestPlacementsOneItemPlatform.java b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestPlacementsOneItemPlatform.java new file mode 100644 index 00000000..7b8db35a --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestPlacementsOneItemPlatform.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdGroupsRequestPlacementsOneItemPlatform { + public static final CreateAdGroupsRequestPlacementsOneItemPlatform INSTAGRAM = + new CreateAdGroupsRequestPlacementsOneItemPlatform(Value.INSTAGRAM, "instagram"); + + public static final CreateAdGroupsRequestPlacementsOneItemPlatform FACEBOOK = + new CreateAdGroupsRequestPlacementsOneItemPlatform(Value.FACEBOOK, "facebook"); + + public static final CreateAdGroupsRequestPlacementsOneItemPlatform THREADS = + new CreateAdGroupsRequestPlacementsOneItemPlatform(Value.THREADS, "threads"); + + public static final CreateAdGroupsRequestPlacementsOneItemPlatform WHATSAPP = + new CreateAdGroupsRequestPlacementsOneItemPlatform(Value.WHATSAPP, "whatsapp"); + + public static final CreateAdGroupsRequestPlacementsOneItemPlatform MESSENGER = + new CreateAdGroupsRequestPlacementsOneItemPlatform(Value.MESSENGER, "messenger"); + + public static final CreateAdGroupsRequestPlacementsOneItemPlatform AUDIENCE_NETWORK = + new CreateAdGroupsRequestPlacementsOneItemPlatform(Value.AUDIENCE_NETWORK, "audience_network"); + + private final Value value; + + private final String string; + + CreateAdGroupsRequestPlacementsOneItemPlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdGroupsRequestPlacementsOneItemPlatform + && this.string.equals(((CreateAdGroupsRequestPlacementsOneItemPlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTAGRAM: + return visitor.visitInstagram(); + case FACEBOOK: + return visitor.visitFacebook(); + case THREADS: + return visitor.visitThreads(); + case WHATSAPP: + return visitor.visitWhatsapp(); + case MESSENGER: + return visitor.visitMessenger(); + case AUDIENCE_NETWORK: + return visitor.visitAudienceNetwork(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdGroupsRequestPlacementsOneItemPlatform valueOf(String value) { + switch (value) { + case "instagram": + return INSTAGRAM; + case "facebook": + return FACEBOOK; + case "threads": + return THREADS; + case "whatsapp": + return WHATSAPP; + case "messenger": + return MESSENGER; + case "audience_network": + return AUDIENCE_NETWORK; + default: + return new CreateAdGroupsRequestPlacementsOneItemPlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + FACEBOOK, + + INSTAGRAM, + + MESSENGER, + + AUDIENCE_NETWORK, + + THREADS, + + WHATSAPP, + + UNKNOWN + } + + public interface Visitor { + T visitFacebook(); + + T visitInstagram(); + + T visitMessenger(); + + T visitAudienceNetwork(); + + T visitThreads(); + + T visitWhatsapp(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestPlacementsZero.java b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestPlacementsZero.java new file mode 100644 index 00000000..8c7cd6f3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestPlacementsZero.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdGroupsRequestPlacementsZero { + public static final CreateAdGroupsRequestPlacementsZero AUTOMATIC = + new CreateAdGroupsRequestPlacementsZero(Value.AUTOMATIC, "automatic"); + + private final Value value; + + private final String string; + + CreateAdGroupsRequestPlacementsZero(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdGroupsRequestPlacementsZero + && this.string.equals(((CreateAdGroupsRequestPlacementsZero) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AUTOMATIC: + return visitor.visitAutomatic(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdGroupsRequestPlacementsZero valueOf(String value) { + switch (value) { + case "automatic": + return AUTOMATIC; + default: + return new CreateAdGroupsRequestPlacementsZero(Value.UNKNOWN, value); + } + } + + public enum Value { + AUTOMATIC, + + UNKNOWN + } + + public interface Visitor { + T visitAutomatic(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestStatus.java b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestStatus.java new file mode 100644 index 00000000..bad15ad1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/CreateAdGroupsRequestStatus.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdGroupsRequestStatus { + public static final CreateAdGroupsRequestStatus PAUSED = new CreateAdGroupsRequestStatus(Value.PAUSED, "paused"); + + public static final CreateAdGroupsRequestStatus ACTIVE = new CreateAdGroupsRequestStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + CreateAdGroupsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdGroupsRequestStatus + && this.string.equals(((CreateAdGroupsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAUSED: + return visitor.visitPaused(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdGroupsRequestStatus valueOf(String value) { + switch (value) { + case "paused": + return PAUSED; + case "active": + return ACTIVE; + default: + return new CreateAdGroupsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + PAUSED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitPaused(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/DeleteAdGroupsResponse.java b/src/main/java/com/whop/api/resources/adgroups/types/DeleteAdGroupsResponse.java new file mode 100644 index 00000000..ae411aa0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/DeleteAdGroupsResponse.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteAdGroupsResponse.Builder.class) +public final class DeleteAdGroupsResponse { + private final boolean deleted; + + private final String id; + + private final Map additionalProperties; + + private DeleteAdGroupsResponse(boolean deleted, String id, Map additionalProperties) { + this.deleted = deleted; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Always true. + */ + @JsonProperty("deleted") + public boolean getDeleted() { + return deleted; + } + + /** + * @return ID of the deleted ad group. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteAdGroupsResponse && equalTo((DeleteAdGroupsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteAdGroupsResponse other) { + return deleted == other.deleted && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deleted, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeletedStage builder() { + return new Builder(); + } + + public interface DeletedStage { + /** + *

Always true.

+ */ + IdStage deleted(boolean deleted); + + Builder from(DeleteAdGroupsResponse other); + } + + public interface IdStage { + /** + *

ID of the deleted ad group.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DeleteAdGroupsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeletedStage, IdStage, _FinalStage { + private boolean deleted; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeleteAdGroupsResponse other) { + deleted(other.getDeleted()); + id(other.getId()); + return this; + } + + /** + *

Always true.

+ *

Always true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("deleted") + public IdStage deleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + *

ID of the deleted ad group.

+ *

ID of the deleted ad group.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DeleteAdGroupsResponse build() { + return new DeleteAdGroupsResponse(deleted, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/DuplicateAdGroupsResponse.java b/src/main/java/com/whop/api/resources/adgroups/types/DuplicateAdGroupsResponse.java new file mode 100644 index 00000000..2af28c7d --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/DuplicateAdGroupsResponse.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AdGroup; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DuplicateAdGroupsResponse.Builder.class) +public final class DuplicateAdGroupsResponse { + private final List data; + + private final Map additionalProperties; + + private DuplicateAdGroupsResponse(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DuplicateAdGroupsResponse && equalTo((DuplicateAdGroupsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DuplicateAdGroupsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DuplicateAdGroupsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(AdGroup data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public DuplicateAdGroupsResponse build() { + return new DuplicateAdGroupsResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/EstimateReachAdGroupsRequestPlatform.java b/src/main/java/com/whop/api/resources/adgroups/types/EstimateReachAdGroupsRequestPlatform.java new file mode 100644 index 00000000..6db00b07 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/EstimateReachAdGroupsRequestPlatform.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class EstimateReachAdGroupsRequestPlatform { + public static final EstimateReachAdGroupsRequestPlatform META = + new EstimateReachAdGroupsRequestPlatform(Value.META, "meta"); + + private final Value value; + + private final String string; + + EstimateReachAdGroupsRequestPlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof EstimateReachAdGroupsRequestPlatform + && this.string.equals(((EstimateReachAdGroupsRequestPlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case META: + return visitor.visitMeta(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static EstimateReachAdGroupsRequestPlatform valueOf(String value) { + switch (value) { + case "meta": + return META; + default: + return new EstimateReachAdGroupsRequestPlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + META, + + UNKNOWN + } + + public interface Visitor { + T visitMeta(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsRequestAttributionModel.java b/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsRequestAttributionModel.java new file mode 100644 index 00000000..98afc69c --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsRequestAttributionModel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAdGroupsRequestAttributionModel { + public static final ListAdGroupsRequestAttributionModel FIRST_TOUCH = + new ListAdGroupsRequestAttributionModel(Value.FIRST_TOUCH, "first_touch"); + + public static final ListAdGroupsRequestAttributionModel LAST_TOUCH = + new ListAdGroupsRequestAttributionModel(Value.LAST_TOUCH, "last_touch"); + + private final Value value; + + private final String string; + + ListAdGroupsRequestAttributionModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAdGroupsRequestAttributionModel + && this.string.equals(((ListAdGroupsRequestAttributionModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FIRST_TOUCH: + return visitor.visitFirstTouch(); + case LAST_TOUCH: + return visitor.visitLastTouch(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAdGroupsRequestAttributionModel valueOf(String value) { + switch (value) { + case "first_touch": + return FIRST_TOUCH; + case "last_touch": + return LAST_TOUCH; + default: + return new ListAdGroupsRequestAttributionModel(Value.UNKNOWN, value); + } + } + + public enum Value { + LAST_TOUCH, + + FIRST_TOUCH, + + UNKNOWN + } + + public interface Visitor { + T visitLastTouch(); + + T visitFirstTouch(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsRequestDirection.java b/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsRequestDirection.java new file mode 100644 index 00000000..3318bc4d --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAdGroupsRequestDirection { + public static final ListAdGroupsRequestDirection ASC = new ListAdGroupsRequestDirection(Value.ASC, "asc"); + + public static final ListAdGroupsRequestDirection DESC = new ListAdGroupsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListAdGroupsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAdGroupsRequestDirection + && this.string.equals(((ListAdGroupsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAdGroupsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListAdGroupsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsRequestOrder.java b/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsRequestOrder.java new file mode 100644 index 00000000..2827e427 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsRequestOrder.java @@ -0,0 +1,213 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAdGroupsRequestOrder { + public static final ListAdGroupsRequestOrder SPEND = new ListAdGroupsRequestOrder(Value.SPEND, "spend"); + + public static final ListAdGroupsRequestOrder COST_PER_RESULT = + new ListAdGroupsRequestOrder(Value.COST_PER_RESULT, "cost_per_result"); + + public static final ListAdGroupsRequestOrder COST_PER_CLICK = + new ListAdGroupsRequestOrder(Value.COST_PER_CLICK, "cost_per_click"); + + public static final ListAdGroupsRequestOrder FREQUENCY = new ListAdGroupsRequestOrder(Value.FREQUENCY, "frequency"); + + public static final ListAdGroupsRequestOrder RESULTS = new ListAdGroupsRequestOrder(Value.RESULTS, "results"); + + public static final ListAdGroupsRequestOrder UNIQUE_CLICKS = + new ListAdGroupsRequestOrder(Value.UNIQUE_CLICKS, "unique_clicks"); + + public static final ListAdGroupsRequestOrder CLICK_THROUGH_RATE = + new ListAdGroupsRequestOrder(Value.CLICK_THROUGH_RATE, "click_through_rate"); + + public static final ListAdGroupsRequestOrder REACH = new ListAdGroupsRequestOrder(Value.REACH, "reach"); + + public static final ListAdGroupsRequestOrder UPDATED_AT = + new ListAdGroupsRequestOrder(Value.UPDATED_AT, "updated_at"); + + public static final ListAdGroupsRequestOrder COST_PER_MILLE = + new ListAdGroupsRequestOrder(Value.COST_PER_MILLE, "cost_per_mille"); + + public static final ListAdGroupsRequestOrder CREATED_AT = + new ListAdGroupsRequestOrder(Value.CREATED_AT, "created_at"); + + public static final ListAdGroupsRequestOrder CLICKS = new ListAdGroupsRequestOrder(Value.CLICKS, "clicks"); + + public static final ListAdGroupsRequestOrder IMPRESSIONS = + new ListAdGroupsRequestOrder(Value.IMPRESSIONS, "impressions"); + + public static final ListAdGroupsRequestOrder RETURN_ON_AD_SPEND = + new ListAdGroupsRequestOrder(Value.RETURN_ON_AD_SPEND, "return_on_ad_spend"); + + private final Value value; + + private final String string; + + ListAdGroupsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAdGroupsRequestOrder + && this.string.equals(((ListAdGroupsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SPEND: + return visitor.visitSpend(); + case COST_PER_RESULT: + return visitor.visitCostPerResult(); + case COST_PER_CLICK: + return visitor.visitCostPerClick(); + case FREQUENCY: + return visitor.visitFrequency(); + case RESULTS: + return visitor.visitResults(); + case UNIQUE_CLICKS: + return visitor.visitUniqueClicks(); + case CLICK_THROUGH_RATE: + return visitor.visitClickThroughRate(); + case REACH: + return visitor.visitReach(); + case UPDATED_AT: + return visitor.visitUpdatedAt(); + case COST_PER_MILLE: + return visitor.visitCostPerMille(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case CLICKS: + return visitor.visitClicks(); + case IMPRESSIONS: + return visitor.visitImpressions(); + case RETURN_ON_AD_SPEND: + return visitor.visitReturnOnAdSpend(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAdGroupsRequestOrder valueOf(String value) { + switch (value) { + case "spend": + return SPEND; + case "cost_per_result": + return COST_PER_RESULT; + case "cost_per_click": + return COST_PER_CLICK; + case "frequency": + return FREQUENCY; + case "results": + return RESULTS; + case "unique_clicks": + return UNIQUE_CLICKS; + case "click_through_rate": + return CLICK_THROUGH_RATE; + case "reach": + return REACH; + case "updated_at": + return UPDATED_AT; + case "cost_per_mille": + return COST_PER_MILLE; + case "created_at": + return CREATED_AT; + case "clicks": + return CLICKS; + case "impressions": + return IMPRESSIONS; + case "return_on_ad_spend": + return RETURN_ON_AD_SPEND; + default: + return new ListAdGroupsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UPDATED_AT, + + SPEND, + + IMPRESSIONS, + + REACH, + + CLICKS, + + UNIQUE_CLICKS, + + FREQUENCY, + + CLICK_THROUGH_RATE, + + RESULTS, + + COST_PER_MILLE, + + COST_PER_CLICK, + + COST_PER_RESULT, + + RETURN_ON_AD_SPEND, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUpdatedAt(); + + T visitSpend(); + + T visitImpressions(); + + T visitReach(); + + T visitClicks(); + + T visitUniqueClicks(); + + T visitFrequency(); + + T visitClickThroughRate(); + + T visitResults(); + + T visitCostPerMille(); + + T visitCostPerClick(); + + T visitCostPerResult(); + + T visitReturnOnAdSpend(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsRequestStatus.java b/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsRequestStatus.java new file mode 100644 index 00000000..3c4de122 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsRequestStatus.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAdGroupsRequestStatus { + public static final ListAdGroupsRequestStatus DUPLICATING = + new ListAdGroupsRequestStatus(Value.DUPLICATING, "duplicating"); + + public static final ListAdGroupsRequestStatus PAUSED = new ListAdGroupsRequestStatus(Value.PAUSED, "paused"); + + public static final ListAdGroupsRequestStatus REJECTED = new ListAdGroupsRequestStatus(Value.REJECTED, "rejected"); + + public static final ListAdGroupsRequestStatus ACTIVE = new ListAdGroupsRequestStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + ListAdGroupsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAdGroupsRequestStatus + && this.string.equals(((ListAdGroupsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DUPLICATING: + return visitor.visitDuplicating(); + case PAUSED: + return visitor.visitPaused(); + case REJECTED: + return visitor.visitRejected(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAdGroupsRequestStatus valueOf(String value) { + switch (value) { + case "duplicating": + return DUPLICATING; + case "paused": + return PAUSED; + case "rejected": + return REJECTED; + case "active": + return ACTIVE; + default: + return new ListAdGroupsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + PAUSED, + + REJECTED, + + DUPLICATING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitPaused(); + + T visitRejected(); + + T visitDuplicating(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsResponse.java b/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsResponse.java new file mode 100644 index 00000000..951a16f5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AdGroup; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAdGroupsResponse.Builder.class) +public final class ListAdGroupsResponse { + private final List data; + + private final ListAdGroupsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListAdGroupsResponse( + List data, ListAdGroupsResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListAdGroupsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAdGroupsResponse && equalTo((ListAdGroupsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAdGroupsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListAdGroupsResponsePageInfo pageInfo); + + Builder from(ListAdGroupsResponse other); + } + + public interface _FinalStage { + ListAdGroupsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(AdGroup data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListAdGroupsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAdGroupsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListAdGroupsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(AdGroup data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListAdGroupsResponse build() { + return new ListAdGroupsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsResponsePageInfo.java b/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsResponsePageInfo.java new file mode 100644 index 00000000..fb453c8d --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/ListAdGroupsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAdGroupsResponsePageInfo.Builder.class) +public final class ListAdGroupsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListAdGroupsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAdGroupsResponsePageInfo && equalTo((ListAdGroupsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAdGroupsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListAdGroupsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListAdGroupsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAdGroupsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListAdGroupsResponsePageInfo build() { + return new ListAdGroupsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/RetrieveAdGroupsRequestAttributionModel.java b/src/main/java/com/whop/api/resources/adgroups/types/RetrieveAdGroupsRequestAttributionModel.java new file mode 100644 index 00000000..4c43a185 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/RetrieveAdGroupsRequestAttributionModel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveAdGroupsRequestAttributionModel { + public static final RetrieveAdGroupsRequestAttributionModel FIRST_TOUCH = + new RetrieveAdGroupsRequestAttributionModel(Value.FIRST_TOUCH, "first_touch"); + + public static final RetrieveAdGroupsRequestAttributionModel LAST_TOUCH = + new RetrieveAdGroupsRequestAttributionModel(Value.LAST_TOUCH, "last_touch"); + + private final Value value; + + private final String string; + + RetrieveAdGroupsRequestAttributionModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveAdGroupsRequestAttributionModel + && this.string.equals(((RetrieveAdGroupsRequestAttributionModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FIRST_TOUCH: + return visitor.visitFirstTouch(); + case LAST_TOUCH: + return visitor.visitLastTouch(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveAdGroupsRequestAttributionModel valueOf(String value) { + switch (value) { + case "first_touch": + return FIRST_TOUCH; + case "last_touch": + return LAST_TOUCH; + default: + return new RetrieveAdGroupsRequestAttributionModel(Value.UNKNOWN, value); + } + } + + public enum Value { + LAST_TOUCH, + + FIRST_TOUCH, + + UNKNOWN + } + + public interface Visitor { + T visitLastTouch(); + + T visitFirstTouch(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/SearchTargetingOptionsAdGroupsRequestLocationTypesItem.java b/src/main/java/com/whop/api/resources/adgroups/types/SearchTargetingOptionsAdGroupsRequestLocationTypesItem.java new file mode 100644 index 00000000..76b89950 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/SearchTargetingOptionsAdGroupsRequestLocationTypesItem.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SearchTargetingOptionsAdGroupsRequestLocationTypesItem { + public static final SearchTargetingOptionsAdGroupsRequestLocationTypesItem SUBCITY = + new SearchTargetingOptionsAdGroupsRequestLocationTypesItem(Value.SUBCITY, "subcity"); + + public static final SearchTargetingOptionsAdGroupsRequestLocationTypesItem COUNTRY = + new SearchTargetingOptionsAdGroupsRequestLocationTypesItem(Value.COUNTRY, "country"); + + public static final SearchTargetingOptionsAdGroupsRequestLocationTypesItem MEDIUM_GEO_AREA = + new SearchTargetingOptionsAdGroupsRequestLocationTypesItem(Value.MEDIUM_GEO_AREA, "medium_geo_area"); + + public static final SearchTargetingOptionsAdGroupsRequestLocationTypesItem CITY = + new SearchTargetingOptionsAdGroupsRequestLocationTypesItem(Value.CITY, "city"); + + public static final SearchTargetingOptionsAdGroupsRequestLocationTypesItem ZIP = + new SearchTargetingOptionsAdGroupsRequestLocationTypesItem(Value.ZIP, "zip"); + + public static final SearchTargetingOptionsAdGroupsRequestLocationTypesItem REGION = + new SearchTargetingOptionsAdGroupsRequestLocationTypesItem(Value.REGION, "region"); + + public static final SearchTargetingOptionsAdGroupsRequestLocationTypesItem NEIGHBORHOOD = + new SearchTargetingOptionsAdGroupsRequestLocationTypesItem(Value.NEIGHBORHOOD, "neighborhood"); + + private final Value value; + + private final String string; + + SearchTargetingOptionsAdGroupsRequestLocationTypesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SearchTargetingOptionsAdGroupsRequestLocationTypesItem + && this.string.equals(((SearchTargetingOptionsAdGroupsRequestLocationTypesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SUBCITY: + return visitor.visitSubcity(); + case COUNTRY: + return visitor.visitCountry(); + case MEDIUM_GEO_AREA: + return visitor.visitMediumGeoArea(); + case CITY: + return visitor.visitCity(); + case ZIP: + return visitor.visitZip(); + case REGION: + return visitor.visitRegion(); + case NEIGHBORHOOD: + return visitor.visitNeighborhood(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SearchTargetingOptionsAdGroupsRequestLocationTypesItem valueOf(String value) { + switch (value) { + case "subcity": + return SUBCITY; + case "country": + return COUNTRY; + case "medium_geo_area": + return MEDIUM_GEO_AREA; + case "city": + return CITY; + case "zip": + return ZIP; + case "region": + return REGION; + case "neighborhood": + return NEIGHBORHOOD; + default: + return new SearchTargetingOptionsAdGroupsRequestLocationTypesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + COUNTRY, + + REGION, + + CITY, + + ZIP, + + NEIGHBORHOOD, + + SUBCITY, + + MEDIUM_GEO_AREA, + + UNKNOWN + } + + public interface Visitor { + T visitCountry(); + + T visitRegion(); + + T visitCity(); + + T visitZip(); + + T visitNeighborhood(); + + T visitSubcity(); + + T visitMediumGeoArea(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/SearchTargetingOptionsAdGroupsRequestPlatform.java b/src/main/java/com/whop/api/resources/adgroups/types/SearchTargetingOptionsAdGroupsRequestPlatform.java new file mode 100644 index 00000000..5e1e45f5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/SearchTargetingOptionsAdGroupsRequestPlatform.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SearchTargetingOptionsAdGroupsRequestPlatform { + public static final SearchTargetingOptionsAdGroupsRequestPlatform META = + new SearchTargetingOptionsAdGroupsRequestPlatform(Value.META, "meta"); + + private final Value value; + + private final String string; + + SearchTargetingOptionsAdGroupsRequestPlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SearchTargetingOptionsAdGroupsRequestPlatform + && this.string.equals(((SearchTargetingOptionsAdGroupsRequestPlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case META: + return visitor.visitMeta(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SearchTargetingOptionsAdGroupsRequestPlatform valueOf(String value) { + switch (value) { + case "meta": + return META; + default: + return new SearchTargetingOptionsAdGroupsRequestPlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + META, + + UNKNOWN + } + + public interface Visitor { + T visitMeta(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/SearchTargetingOptionsAdGroupsRequestTypesItem.java b/src/main/java/com/whop/api/resources/adgroups/types/SearchTargetingOptionsAdGroupsRequestTypesItem.java new file mode 100644 index 00000000..82f99dca --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/SearchTargetingOptionsAdGroupsRequestTypesItem.java @@ -0,0 +1,196 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SearchTargetingOptionsAdGroupsRequestTypesItem { + public static final SearchTargetingOptionsAdGroupsRequestTypesItem WORK_POSITIONS = + new SearchTargetingOptionsAdGroupsRequestTypesItem(Value.WORK_POSITIONS, "work_positions"); + + public static final SearchTargetingOptionsAdGroupsRequestTypesItem BEHAVIORS = + new SearchTargetingOptionsAdGroupsRequestTypesItem(Value.BEHAVIORS, "behaviors"); + + public static final SearchTargetingOptionsAdGroupsRequestTypesItem INTERESTS = + new SearchTargetingOptionsAdGroupsRequestTypesItem(Value.INTERESTS, "interests"); + + public static final SearchTargetingOptionsAdGroupsRequestTypesItem FAMILY_STATUSES = + new SearchTargetingOptionsAdGroupsRequestTypesItem(Value.FAMILY_STATUSES, "family_statuses"); + + public static final SearchTargetingOptionsAdGroupsRequestTypesItem INDUSTRIES = + new SearchTargetingOptionsAdGroupsRequestTypesItem(Value.INDUSTRIES, "industries"); + + public static final SearchTargetingOptionsAdGroupsRequestTypesItem EDUCATION_MAJORS = + new SearchTargetingOptionsAdGroupsRequestTypesItem(Value.EDUCATION_MAJORS, "education_majors"); + + public static final SearchTargetingOptionsAdGroupsRequestTypesItem INCOME = + new SearchTargetingOptionsAdGroupsRequestTypesItem(Value.INCOME, "income"); + + public static final SearchTargetingOptionsAdGroupsRequestTypesItem LANGUAGES = + new SearchTargetingOptionsAdGroupsRequestTypesItem(Value.LANGUAGES, "languages"); + + public static final SearchTargetingOptionsAdGroupsRequestTypesItem LIFE_EVENTS = + new SearchTargetingOptionsAdGroupsRequestTypesItem(Value.LIFE_EVENTS, "life_events"); + + public static final SearchTargetingOptionsAdGroupsRequestTypesItem LOCATIONS = + new SearchTargetingOptionsAdGroupsRequestTypesItem(Value.LOCATIONS, "locations"); + + public static final SearchTargetingOptionsAdGroupsRequestTypesItem EDUCATION_SCHOOLS = + new SearchTargetingOptionsAdGroupsRequestTypesItem(Value.EDUCATION_SCHOOLS, "education_schools"); + + public static final SearchTargetingOptionsAdGroupsRequestTypesItem WORK_EMPLOYERS = + new SearchTargetingOptionsAdGroupsRequestTypesItem(Value.WORK_EMPLOYERS, "work_employers"); + + private final Value value; + + private final String string; + + SearchTargetingOptionsAdGroupsRequestTypesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SearchTargetingOptionsAdGroupsRequestTypesItem + && this.string.equals(((SearchTargetingOptionsAdGroupsRequestTypesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WORK_POSITIONS: + return visitor.visitWorkPositions(); + case BEHAVIORS: + return visitor.visitBehaviors(); + case INTERESTS: + return visitor.visitInterests(); + case FAMILY_STATUSES: + return visitor.visitFamilyStatuses(); + case INDUSTRIES: + return visitor.visitIndustries(); + case EDUCATION_MAJORS: + return visitor.visitEducationMajors(); + case INCOME: + return visitor.visitIncome(); + case LANGUAGES: + return visitor.visitLanguages(); + case LIFE_EVENTS: + return visitor.visitLifeEvents(); + case LOCATIONS: + return visitor.visitLocations(); + case EDUCATION_SCHOOLS: + return visitor.visitEducationSchools(); + case WORK_EMPLOYERS: + return visitor.visitWorkEmployers(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SearchTargetingOptionsAdGroupsRequestTypesItem valueOf(String value) { + switch (value) { + case "work_positions": + return WORK_POSITIONS; + case "behaviors": + return BEHAVIORS; + case "interests": + return INTERESTS; + case "family_statuses": + return FAMILY_STATUSES; + case "industries": + return INDUSTRIES; + case "education_majors": + return EDUCATION_MAJORS; + case "income": + return INCOME; + case "languages": + return LANGUAGES; + case "life_events": + return LIFE_EVENTS; + case "locations": + return LOCATIONS; + case "education_schools": + return EDUCATION_SCHOOLS; + case "work_employers": + return WORK_EMPLOYERS; + default: + return new SearchTargetingOptionsAdGroupsRequestTypesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + INTERESTS, + + BEHAVIORS, + + LIFE_EVENTS, + + INDUSTRIES, + + INCOME, + + FAMILY_STATUSES, + + WORK_EMPLOYERS, + + WORK_POSITIONS, + + EDUCATION_SCHOOLS, + + EDUCATION_MAJORS, + + LANGUAGES, + + LOCATIONS, + + UNKNOWN + } + + public interface Visitor { + T visitInterests(); + + T visitBehaviors(); + + T visitLifeEvents(); + + T visitIndustries(); + + T visitIncome(); + + T visitFamilyStatuses(); + + T visitWorkEmployers(); + + T visitWorkPositions(); + + T visitEducationSchools(); + + T visitEducationMajors(); + + T visitLanguages(); + + T visitLocations(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/SearchTargetingOptionsAdGroupsResponse.java b/src/main/java/com/whop/api/resources/adgroups/types/SearchTargetingOptionsAdGroupsResponse.java new file mode 100644 index 00000000..4be69220 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/SearchTargetingOptionsAdGroupsResponse.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.TargetingOption; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SearchTargetingOptionsAdGroupsResponse.Builder.class) +public final class SearchTargetingOptionsAdGroupsResponse { + private final List data; + + private final Map additionalProperties; + + private SearchTargetingOptionsAdGroupsResponse( + List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SearchTargetingOptionsAdGroupsResponse + && equalTo((SearchTargetingOptionsAdGroupsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SearchTargetingOptionsAdGroupsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SearchTargetingOptionsAdGroupsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(TargetingOption data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public SearchTargetingOptionsAdGroupsResponse build() { + return new SearchTargetingOptionsAdGroupsResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestBidType.java b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestBidType.java new file mode 100644 index 00000000..e3a4eac7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestBidType.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdGroupsRequestBidType { + public static final UpdateAdGroupsRequestBidType AVERAGE_TARGET = + new UpdateAdGroupsRequestBidType(Value.AVERAGE_TARGET, "average_target"); + + public static final UpdateAdGroupsRequestBidType MAXIMUM_TARGET = + new UpdateAdGroupsRequestBidType(Value.MAXIMUM_TARGET, "maximum_target"); + + public static final UpdateAdGroupsRequestBidType MINIMUM_COST = + new UpdateAdGroupsRequestBidType(Value.MINIMUM_COST, "minimum_cost"); + + private final Value value; + + private final String string; + + UpdateAdGroupsRequestBidType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdGroupsRequestBidType + && this.string.equals(((UpdateAdGroupsRequestBidType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AVERAGE_TARGET: + return visitor.visitAverageTarget(); + case MAXIMUM_TARGET: + return visitor.visitMaximumTarget(); + case MINIMUM_COST: + return visitor.visitMinimumCost(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdGroupsRequestBidType valueOf(String value) { + switch (value) { + case "average_target": + return AVERAGE_TARGET; + case "maximum_target": + return MAXIMUM_TARGET; + case "minimum_cost": + return MINIMUM_COST; + default: + return new UpdateAdGroupsRequestBidType(Value.UNKNOWN, value); + } + } + + public enum Value { + MINIMUM_COST, + + AVERAGE_TARGET, + + MAXIMUM_TARGET, + + UNKNOWN + } + + public interface Visitor { + T visitMinimumCost(); + + T visitAverageTarget(); + + T visitMaximumTarget(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestBudgetType.java b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestBudgetType.java new file mode 100644 index 00000000..7859cf3b --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestBudgetType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdGroupsRequestBudgetType { + public static final UpdateAdGroupsRequestBudgetType DAILY = + new UpdateAdGroupsRequestBudgetType(Value.DAILY, "daily"); + + public static final UpdateAdGroupsRequestBudgetType LIFETIME = + new UpdateAdGroupsRequestBudgetType(Value.LIFETIME, "lifetime"); + + private final Value value; + + private final String string; + + UpdateAdGroupsRequestBudgetType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdGroupsRequestBudgetType + && this.string.equals(((UpdateAdGroupsRequestBudgetType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DAILY: + return visitor.visitDaily(); + case LIFETIME: + return visitor.visitLifetime(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdGroupsRequestBudgetType valueOf(String value) { + switch (value) { + case "daily": + return DAILY; + case "lifetime": + return LIFETIME; + default: + return new UpdateAdGroupsRequestBudgetType(Value.UNKNOWN, value); + } + } + + public enum Value { + DAILY, + + LIFETIME, + + UNKNOWN + } + + public interface Visitor { + T visitDaily(); + + T visitLifetime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestConversionLocation.java b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestConversionLocation.java new file mode 100644 index 00000000..7f38a40b --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestConversionLocation.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdGroupsRequestConversionLocation { + public static final UpdateAdGroupsRequestConversionLocation WEBSITE = + new UpdateAdGroupsRequestConversionLocation(Value.WEBSITE, "website"); + + public static final UpdateAdGroupsRequestConversionLocation MESSAGING = + new UpdateAdGroupsRequestConversionLocation(Value.MESSAGING, "messaging"); + + public static final UpdateAdGroupsRequestConversionLocation INSTANT_FORMS_AND_MESSENGER = + new UpdateAdGroupsRequestConversionLocation( + Value.INSTANT_FORMS_AND_MESSENGER, "instant_forms_and_messenger"); + + public static final UpdateAdGroupsRequestConversionLocation WEBSITE_AND_INSTANT_FORMS = + new UpdateAdGroupsRequestConversionLocation(Value.WEBSITE_AND_INSTANT_FORMS, "website_and_instant_forms"); + + public static final UpdateAdGroupsRequestConversionLocation PROFILE = + new UpdateAdGroupsRequestConversionLocation(Value.PROFILE, "profile"); + + public static final UpdateAdGroupsRequestConversionLocation INSTANT_FORMS = + new UpdateAdGroupsRequestConversionLocation(Value.INSTANT_FORMS, "instant_forms"); + + public static final UpdateAdGroupsRequestConversionLocation INSTAGRAM_AND_FACEBOOK = + new UpdateAdGroupsRequestConversionLocation(Value.INSTAGRAM_AND_FACEBOOK, "instagram_and_facebook"); + + public static final UpdateAdGroupsRequestConversionLocation ON_AD = + new UpdateAdGroupsRequestConversionLocation(Value.ON_AD, "on_ad"); + + public static final UpdateAdGroupsRequestConversionLocation INSTAGRAM_PROFILE = + new UpdateAdGroupsRequestConversionLocation(Value.INSTAGRAM_PROFILE, "instagram_profile"); + + private final Value value; + + private final String string; + + UpdateAdGroupsRequestConversionLocation(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdGroupsRequestConversionLocation + && this.string.equals(((UpdateAdGroupsRequestConversionLocation) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WEBSITE: + return visitor.visitWebsite(); + case MESSAGING: + return visitor.visitMessaging(); + case INSTANT_FORMS_AND_MESSENGER: + return visitor.visitInstantFormsAndMessenger(); + case WEBSITE_AND_INSTANT_FORMS: + return visitor.visitWebsiteAndInstantForms(); + case PROFILE: + return visitor.visitProfile(); + case INSTANT_FORMS: + return visitor.visitInstantForms(); + case INSTAGRAM_AND_FACEBOOK: + return visitor.visitInstagramAndFacebook(); + case ON_AD: + return visitor.visitOnAd(); + case INSTAGRAM_PROFILE: + return visitor.visitInstagramProfile(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdGroupsRequestConversionLocation valueOf(String value) { + switch (value) { + case "website": + return WEBSITE; + case "messaging": + return MESSAGING; + case "instant_forms_and_messenger": + return INSTANT_FORMS_AND_MESSENGER; + case "website_and_instant_forms": + return WEBSITE_AND_INSTANT_FORMS; + case "profile": + return PROFILE; + case "instant_forms": + return INSTANT_FORMS; + case "instagram_and_facebook": + return INSTAGRAM_AND_FACEBOOK; + case "on_ad": + return ON_AD; + case "instagram_profile": + return INSTAGRAM_PROFILE; + default: + return new UpdateAdGroupsRequestConversionLocation(Value.UNKNOWN, value); + } + } + + public enum Value { + WEBSITE, + + PROFILE, + + INSTAGRAM_AND_FACEBOOK, + + INSTAGRAM_PROFILE, + + MESSAGING, + + ON_AD, + + INSTANT_FORMS, + + INSTANT_FORMS_AND_MESSENGER, + + WEBSITE_AND_INSTANT_FORMS, + + UNKNOWN + } + + public interface Visitor { + T visitWebsite(); + + T visitProfile(); + + T visitInstagramAndFacebook(); + + T visitInstagramProfile(); + + T visitMessaging(); + + T visitOnAd(); + + T visitInstantForms(); + + T visitInstantFormsAndMessenger(); + + T visitWebsiteAndInstantForms(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestFrequencyCap.java b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestFrequencyCap.java new file mode 100644 index 00000000..ec125b2e --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestFrequencyCap.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdGroupsRequestFrequencyCap.Builder.class) +public final class UpdateAdGroupsRequestFrequencyCap { + private final Optional maximumImpressions; + + private final Optional perDays; + + private final Map additionalProperties; + + private UpdateAdGroupsRequestFrequencyCap( + Optional maximumImpressions, Optional perDays, Map additionalProperties) { + this.maximumImpressions = maximumImpressions; + this.perDays = perDays; + this.additionalProperties = additionalProperties; + } + + /** + * @return Most times one person can be shown ads from this ad group within the window. + */ + @JsonProperty("maximum_impressions") + public Optional getMaximumImpressions() { + return maximumImpressions; + } + + /** + * @return Length of the rolling window, in days. + */ + @JsonProperty("per_days") + public Optional getPerDays() { + return perDays; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdGroupsRequestFrequencyCap && equalTo((UpdateAdGroupsRequestFrequencyCap) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdGroupsRequestFrequencyCap other) { + return maximumImpressions.equals(other.maximumImpressions) && perDays.equals(other.perDays); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.maximumImpressions, this.perDays); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional maximumImpressions = Optional.empty(); + + private Optional perDays = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdGroupsRequestFrequencyCap other) { + maximumImpressions(other.getMaximumImpressions()); + perDays(other.getPerDays()); + return this; + } + + /** + *

Most times one person can be shown ads from this ad group within the window.

+ */ + @JsonSetter(value = "maximum_impressions", nulls = Nulls.SKIP) + public Builder maximumImpressions(Optional maximumImpressions) { + this.maximumImpressions = maximumImpressions; + return this; + } + + public Builder maximumImpressions(Integer maximumImpressions) { + this.maximumImpressions = Optional.ofNullable(maximumImpressions); + return this; + } + + /** + *

Length of the rolling window, in days.

+ */ + @JsonSetter(value = "per_days", nulls = Nulls.SKIP) + public Builder perDays(Optional perDays) { + this.perDays = perDays; + return this; + } + + public Builder perDays(Integer perDays) { + this.perDays = Optional.ofNullable(perDays); + return this; + } + + public UpdateAdGroupsRequestFrequencyCap build() { + return new UpdateAdGroupsRequestFrequencyCap(maximumImpressions, perDays, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestMessageAppsItem.java b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestMessageAppsItem.java new file mode 100644 index 00000000..5d8c3765 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestMessageAppsItem.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdGroupsRequestMessageAppsItem { + public static final UpdateAdGroupsRequestMessageAppsItem INSTAGRAM = + new UpdateAdGroupsRequestMessageAppsItem(Value.INSTAGRAM, "instagram"); + + public static final UpdateAdGroupsRequestMessageAppsItem WHATSAPP = + new UpdateAdGroupsRequestMessageAppsItem(Value.WHATSAPP, "whatsapp"); + + public static final UpdateAdGroupsRequestMessageAppsItem MESSENGER = + new UpdateAdGroupsRequestMessageAppsItem(Value.MESSENGER, "messenger"); + + private final Value value; + + private final String string; + + UpdateAdGroupsRequestMessageAppsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdGroupsRequestMessageAppsItem + && this.string.equals(((UpdateAdGroupsRequestMessageAppsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTAGRAM: + return visitor.visitInstagram(); + case WHATSAPP: + return visitor.visitWhatsapp(); + case MESSENGER: + return visitor.visitMessenger(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdGroupsRequestMessageAppsItem valueOf(String value) { + switch (value) { + case "instagram": + return INSTAGRAM; + case "whatsapp": + return WHATSAPP; + case "messenger": + return MESSENGER; + default: + return new UpdateAdGroupsRequestMessageAppsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + MESSENGER, + + INSTAGRAM, + + WHATSAPP, + + UNKNOWN + } + + public interface Visitor { + T visitMessenger(); + + T visitInstagram(); + + T visitWhatsapp(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestOptimizationGoal.java b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestOptimizationGoal.java new file mode 100644 index 00000000..e4b377d4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestOptimizationGoal.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdGroupsRequestOptimizationGoal { + public static final UpdateAdGroupsRequestOptimizationGoal AD_RECALL_LIFT = + new UpdateAdGroupsRequestOptimizationGoal(Value.AD_RECALL_LIFT, "ad_recall_lift"); + + public static final UpdateAdGroupsRequestOptimizationGoal PAGE_LIKES = + new UpdateAdGroupsRequestOptimizationGoal(Value.PAGE_LIKES, "page_likes"); + + public static final UpdateAdGroupsRequestOptimizationGoal CONVERSIONS = + new UpdateAdGroupsRequestOptimizationGoal(Value.CONVERSIONS, "conversions"); + + public static final UpdateAdGroupsRequestOptimizationGoal LINK_CLICKS = + new UpdateAdGroupsRequestOptimizationGoal(Value.LINK_CLICKS, "link_clicks"); + + public static final UpdateAdGroupsRequestOptimizationGoal TWO_SECOND_VIEWS = + new UpdateAdGroupsRequestOptimizationGoal(Value.TWO_SECOND_VIEWS, "two_second_views"); + + public static final UpdateAdGroupsRequestOptimizationGoal EVENT_RESPONSES = + new UpdateAdGroupsRequestOptimizationGoal(Value.EVENT_RESPONSES, "event_responses"); + + public static final UpdateAdGroupsRequestOptimizationGoal SOCIAL_PROFILE = + new UpdateAdGroupsRequestOptimizationGoal(Value.SOCIAL_PROFILE, "social_profile"); + + public static final UpdateAdGroupsRequestOptimizationGoal VIDEO_VIEWS = + new UpdateAdGroupsRequestOptimizationGoal(Value.VIDEO_VIEWS, "video_views"); + + public static final UpdateAdGroupsRequestOptimizationGoal VALUE = + new UpdateAdGroupsRequestOptimizationGoal(Value.VALUE, "value"); + + public static final UpdateAdGroupsRequestOptimizationGoal REACH = + new UpdateAdGroupsRequestOptimizationGoal(Value.REACH, "reach"); + + public static final UpdateAdGroupsRequestOptimizationGoal LANDING_PAGE_VIEWS = + new UpdateAdGroupsRequestOptimizationGoal(Value.LANDING_PAGE_VIEWS, "landing_page_views"); + + public static final UpdateAdGroupsRequestOptimizationGoal PROFILE_AND_PAGE_ENGAGEMENT = + new UpdateAdGroupsRequestOptimizationGoal(Value.PROFILE_AND_PAGE_ENGAGEMENT, "profile_and_page_engagement"); + + public static final UpdateAdGroupsRequestOptimizationGoal CONVERSATIONS = + new UpdateAdGroupsRequestOptimizationGoal(Value.CONVERSATIONS, "conversations"); + + public static final UpdateAdGroupsRequestOptimizationGoal REMINDERS_SET = + new UpdateAdGroupsRequestOptimizationGoal(Value.REMINDERS_SET, "reminders_set"); + + public static final UpdateAdGroupsRequestOptimizationGoal ENGAGEMENT = + new UpdateAdGroupsRequestOptimizationGoal(Value.ENGAGEMENT, "engagement"); + + public static final UpdateAdGroupsRequestOptimizationGoal LEAD_GENERATION = + new UpdateAdGroupsRequestOptimizationGoal(Value.LEAD_GENERATION, "lead_generation"); + + public static final UpdateAdGroupsRequestOptimizationGoal QUALITY_LEAD = + new UpdateAdGroupsRequestOptimizationGoal(Value.QUALITY_LEAD, "quality_lead"); + + public static final UpdateAdGroupsRequestOptimizationGoal IMPRESSIONS = + new UpdateAdGroupsRequestOptimizationGoal(Value.IMPRESSIONS, "impressions"); + + private final Value value; + + private final String string; + + UpdateAdGroupsRequestOptimizationGoal(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdGroupsRequestOptimizationGoal + && this.string.equals(((UpdateAdGroupsRequestOptimizationGoal) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AD_RECALL_LIFT: + return visitor.visitAdRecallLift(); + case PAGE_LIKES: + return visitor.visitPageLikes(); + case CONVERSIONS: + return visitor.visitConversions(); + case LINK_CLICKS: + return visitor.visitLinkClicks(); + case TWO_SECOND_VIEWS: + return visitor.visitTwoSecondViews(); + case EVENT_RESPONSES: + return visitor.visitEventResponses(); + case SOCIAL_PROFILE: + return visitor.visitSocialProfile(); + case VIDEO_VIEWS: + return visitor.visitVideoViews(); + case VALUE: + return visitor.visitValue(); + case REACH: + return visitor.visitReach(); + case LANDING_PAGE_VIEWS: + return visitor.visitLandingPageViews(); + case PROFILE_AND_PAGE_ENGAGEMENT: + return visitor.visitProfileAndPageEngagement(); + case CONVERSATIONS: + return visitor.visitConversations(); + case REMINDERS_SET: + return visitor.visitRemindersSet(); + case ENGAGEMENT: + return visitor.visitEngagement(); + case LEAD_GENERATION: + return visitor.visitLeadGeneration(); + case QUALITY_LEAD: + return visitor.visitQualityLead(); + case IMPRESSIONS: + return visitor.visitImpressions(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdGroupsRequestOptimizationGoal valueOf(String value) { + switch (value) { + case "ad_recall_lift": + return AD_RECALL_LIFT; + case "page_likes": + return PAGE_LIKES; + case "conversions": + return CONVERSIONS; + case "link_clicks": + return LINK_CLICKS; + case "two_second_views": + return TWO_SECOND_VIEWS; + case "event_responses": + return EVENT_RESPONSES; + case "social_profile": + return SOCIAL_PROFILE; + case "video_views": + return VIDEO_VIEWS; + case "value": + return VALUE; + case "reach": + return REACH; + case "landing_page_views": + return LANDING_PAGE_VIEWS; + case "profile_and_page_engagement": + return PROFILE_AND_PAGE_ENGAGEMENT; + case "conversations": + return CONVERSATIONS; + case "reminders_set": + return REMINDERS_SET; + case "engagement": + return ENGAGEMENT; + case "lead_generation": + return LEAD_GENERATION; + case "quality_lead": + return QUALITY_LEAD; + case "impressions": + return IMPRESSIONS; + default: + return new UpdateAdGroupsRequestOptimizationGoal(Value.UNKNOWN, value); + } + } + + public enum Value { + CONVERSIONS, + + LINK_CLICKS, + + LANDING_PAGE_VIEWS, + + REACH, + + IMPRESSIONS, + + ENGAGEMENT, + + CONVERSATIONS, + + VIDEO_VIEWS, + + TWO_SECOND_VIEWS, + + PAGE_LIKES, + + SOCIAL_PROFILE, + + AD_RECALL_LIFT, + + EVENT_RESPONSES, + + REMINDERS_SET, + + LEAD_GENERATION, + + QUALITY_LEAD, + + VALUE, + + PROFILE_AND_PAGE_ENGAGEMENT, + + UNKNOWN + } + + public interface Visitor { + T visitConversions(); + + T visitLinkClicks(); + + T visitLandingPageViews(); + + T visitReach(); + + T visitImpressions(); + + T visitEngagement(); + + T visitConversations(); + + T visitVideoViews(); + + T visitTwoSecondViews(); + + T visitPageLikes(); + + T visitSocialProfile(); + + T visitAdRecallLift(); + + T visitEventResponses(); + + T visitRemindersSet(); + + T visitLeadGeneration(); + + T visitQualityLead(); + + T visitValue(); + + T visitProfileAndPageEngagement(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestPlacements.java b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestPlacements.java new file mode 100644 index 00000000..d648e2c4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestPlacements.java @@ -0,0 +1,99 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.List; +import java.util.Objects; + +@JsonDeserialize(using = UpdateAdGroupsRequestPlacements.Deserializer.class) +public final class UpdateAdGroupsRequestPlacements { + private final Object value; + + private final int type; + + private UpdateAdGroupsRequestPlacements(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((UpdateAdGroupsRequestPlacementsZero) this.value); + } else if (this.type == 1) { + return visitor.visit((List) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdGroupsRequestPlacements && equalTo((UpdateAdGroupsRequestPlacements) other); + } + + private boolean equalTo(UpdateAdGroupsRequestPlacements other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static UpdateAdGroupsRequestPlacements of(UpdateAdGroupsRequestPlacementsZero value) { + return new UpdateAdGroupsRequestPlacements(value, 0); + } + + public static UpdateAdGroupsRequestPlacements of(List value) { + return new UpdateAdGroupsRequestPlacements(value, 1); + } + + public interface Visitor { + T visit(UpdateAdGroupsRequestPlacementsZero value); + + T visit(List value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(UpdateAdGroupsRequestPlacements.class); + } + + @java.lang.Override + public UpdateAdGroupsRequestPlacements deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, UpdateAdGroupsRequestPlacementsZero.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, new TypeReference>() {})); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestPlacementsOneItem.java b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestPlacementsOneItem.java new file mode 100644 index 00000000..574c4eb8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestPlacementsOneItem.java @@ -0,0 +1,177 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdGroupsRequestPlacementsOneItem.Builder.class) +public final class UpdateAdGroupsRequestPlacementsOneItem { + private final UpdateAdGroupsRequestPlacementsOneItemPlatform platform; + + private final Optional> positions; + + private final Map additionalProperties; + + private UpdateAdGroupsRequestPlacementsOneItem( + UpdateAdGroupsRequestPlacementsOneItemPlatform platform, + Optional> positions, + Map additionalProperties) { + this.platform = platform; + this.positions = positions; + this.additionalProperties = additionalProperties; + } + + /** + * @return Platform the ads run on. + */ + @JsonProperty("platform") + public UpdateAdGroupsRequestPlacementsOneItemPlatform getPlatform() { + return platform; + } + + /** + * @return Positions to target within the platform, such as feed or story. Omit to target all of the platform's positions. + */ + @JsonProperty("positions") + public Optional> getPositions() { + return positions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdGroupsRequestPlacementsOneItem + && equalTo((UpdateAdGroupsRequestPlacementsOneItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdGroupsRequestPlacementsOneItem other) { + return platform.equals(other.platform) && positions.equals(other.positions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.platform, this.positions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlatformStage builder() { + return new Builder(); + } + + public interface PlatformStage { + /** + *

Platform the ads run on.

+ */ + _FinalStage platform(@NotNull UpdateAdGroupsRequestPlacementsOneItemPlatform platform); + + Builder from(UpdateAdGroupsRequestPlacementsOneItem other); + } + + public interface _FinalStage { + UpdateAdGroupsRequestPlacementsOneItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Positions to target within the platform, such as feed or story. Omit to target all of the platform's positions.

+ */ + _FinalStage positions(Optional> positions); + + _FinalStage positions(List positions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlatformStage, _FinalStage { + private UpdateAdGroupsRequestPlacementsOneItemPlatform platform; + + private Optional> positions = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateAdGroupsRequestPlacementsOneItem other) { + platform(other.getPlatform()); + positions(other.getPositions()); + return this; + } + + /** + *

Platform the ads run on.

+ *

Platform the ads run on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public _FinalStage platform(@NotNull UpdateAdGroupsRequestPlacementsOneItemPlatform platform) { + this.platform = Objects.requireNonNull(platform, "platform must not be null"); + return this; + } + + /** + *

Positions to target within the platform, such as feed or story. Omit to target all of the platform's positions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage positions(List positions) { + this.positions = Optional.ofNullable(positions); + return this; + } + + /** + *

Positions to target within the platform, such as feed or story. Omit to target all of the platform's positions.

+ */ + @java.lang.Override + @JsonSetter(value = "positions", nulls = Nulls.SKIP) + public _FinalStage positions(Optional> positions) { + this.positions = positions; + return this; + } + + @java.lang.Override + public UpdateAdGroupsRequestPlacementsOneItem build() { + return new UpdateAdGroupsRequestPlacementsOneItem(platform, positions, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestPlacementsOneItemPlatform.java b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestPlacementsOneItemPlatform.java new file mode 100644 index 00000000..4a9ef1b4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestPlacementsOneItemPlatform.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdGroupsRequestPlacementsOneItemPlatform { + public static final UpdateAdGroupsRequestPlacementsOneItemPlatform INSTAGRAM = + new UpdateAdGroupsRequestPlacementsOneItemPlatform(Value.INSTAGRAM, "instagram"); + + public static final UpdateAdGroupsRequestPlacementsOneItemPlatform FACEBOOK = + new UpdateAdGroupsRequestPlacementsOneItemPlatform(Value.FACEBOOK, "facebook"); + + public static final UpdateAdGroupsRequestPlacementsOneItemPlatform THREADS = + new UpdateAdGroupsRequestPlacementsOneItemPlatform(Value.THREADS, "threads"); + + public static final UpdateAdGroupsRequestPlacementsOneItemPlatform WHATSAPP = + new UpdateAdGroupsRequestPlacementsOneItemPlatform(Value.WHATSAPP, "whatsapp"); + + public static final UpdateAdGroupsRequestPlacementsOneItemPlatform MESSENGER = + new UpdateAdGroupsRequestPlacementsOneItemPlatform(Value.MESSENGER, "messenger"); + + public static final UpdateAdGroupsRequestPlacementsOneItemPlatform AUDIENCE_NETWORK = + new UpdateAdGroupsRequestPlacementsOneItemPlatform(Value.AUDIENCE_NETWORK, "audience_network"); + + private final Value value; + + private final String string; + + UpdateAdGroupsRequestPlacementsOneItemPlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdGroupsRequestPlacementsOneItemPlatform + && this.string.equals(((UpdateAdGroupsRequestPlacementsOneItemPlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTAGRAM: + return visitor.visitInstagram(); + case FACEBOOK: + return visitor.visitFacebook(); + case THREADS: + return visitor.visitThreads(); + case WHATSAPP: + return visitor.visitWhatsapp(); + case MESSENGER: + return visitor.visitMessenger(); + case AUDIENCE_NETWORK: + return visitor.visitAudienceNetwork(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdGroupsRequestPlacementsOneItemPlatform valueOf(String value) { + switch (value) { + case "instagram": + return INSTAGRAM; + case "facebook": + return FACEBOOK; + case "threads": + return THREADS; + case "whatsapp": + return WHATSAPP; + case "messenger": + return MESSENGER; + case "audience_network": + return AUDIENCE_NETWORK; + default: + return new UpdateAdGroupsRequestPlacementsOneItemPlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + FACEBOOK, + + INSTAGRAM, + + MESSENGER, + + AUDIENCE_NETWORK, + + THREADS, + + WHATSAPP, + + UNKNOWN + } + + public interface Visitor { + T visitFacebook(); + + T visitInstagram(); + + T visitMessenger(); + + T visitAudienceNetwork(); + + T visitThreads(); + + T visitWhatsapp(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestPlacementsZero.java b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestPlacementsZero.java new file mode 100644 index 00000000..765d2de8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestPlacementsZero.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdGroupsRequestPlacementsZero { + public static final UpdateAdGroupsRequestPlacementsZero AUTOMATIC = + new UpdateAdGroupsRequestPlacementsZero(Value.AUTOMATIC, "automatic"); + + private final Value value; + + private final String string; + + UpdateAdGroupsRequestPlacementsZero(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdGroupsRequestPlacementsZero + && this.string.equals(((UpdateAdGroupsRequestPlacementsZero) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AUTOMATIC: + return visitor.visitAutomatic(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdGroupsRequestPlacementsZero valueOf(String value) { + switch (value) { + case "automatic": + return AUTOMATIC; + default: + return new UpdateAdGroupsRequestPlacementsZero(Value.UNKNOWN, value); + } + } + + public enum Value { + AUTOMATIC, + + UNKNOWN + } + + public interface Visitor { + T visitAutomatic(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestStatus.java b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestStatus.java new file mode 100644 index 00000000..6e554def --- /dev/null +++ b/src/main/java/com/whop/api/resources/adgroups/types/UpdateAdGroupsRequestStatus.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adgroups.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdGroupsRequestStatus { + public static final UpdateAdGroupsRequestStatus PAUSED = new UpdateAdGroupsRequestStatus(Value.PAUSED, "paused"); + + public static final UpdateAdGroupsRequestStatus ACTIVE = new UpdateAdGroupsRequestStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + UpdateAdGroupsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdGroupsRequestStatus + && this.string.equals(((UpdateAdGroupsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAUSED: + return visitor.visitPaused(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdGroupsRequestStatus valueOf(String value) { + switch (value) { + case "paused": + return PAUSED; + case "active": + return ACTIVE; + default: + return new UpdateAdGroupsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + PAUSED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitPaused(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/adreports/AdReportsClient.java b/src/main/java/com/whop/api/resources/adreports/AdReportsClient.java new file mode 100644 index 00000000..658745df --- /dev/null +++ b/src/main/java/com/whop/api/resources/adreports/AdReportsClient.java @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adreports; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.adreports.requests.RetrieveAdReportsRequest; +import com.whop.api.types.AdReport; + +public class AdReportsClient { + protected final ClientOptions clientOptions; + + private final RawAdReportsClient rawClient; + + public AdReportsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAdReportsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAdReportsClient withRawResponse() { + return this.rawClient; + } + + /** + * Performance report for a company, ad campaigns, ad groups, or ads. Always returns aggregate summary totals summed across the scope. Set granularity to additionally get a time series, or set breakdown (campaign/ad_group/ad) to additionally get per-entity rows inside the requested scope. Exactly one of companyId, adCampaignIds, adGroupIds, or adIds must be provided. + *

Required permissions:

+ *
    + *
  • ad_campaign:stats:read
  • + *
+ */ + public AdReport retrieve(RetrieveAdReportsRequest request) { + return this.rawClient.retrieve(request).body(); + } + + /** + * Performance report for a company, ad campaigns, ad groups, or ads. Always returns aggregate summary totals summed across the scope. Set granularity to additionally get a time series, or set breakdown (campaign/ad_group/ad) to additionally get per-entity rows inside the requested scope. Exactly one of companyId, adCampaignIds, adGroupIds, or adIds must be provided. + *

Required permissions:

+ *
    + *
  • ad_campaign:stats:read
  • + *
+ */ + public AdReport retrieve(RetrieveAdReportsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/adreports/AsyncAdReportsClient.java b/src/main/java/com/whop/api/resources/adreports/AsyncAdReportsClient.java new file mode 100644 index 00000000..3a865967 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adreports/AsyncAdReportsClient.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adreports; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.adreports.requests.RetrieveAdReportsRequest; +import com.whop.api.types.AdReport; +import java.util.concurrent.CompletableFuture; + +public class AsyncAdReportsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAdReportsClient rawClient; + + public AsyncAdReportsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAdReportsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAdReportsClient withRawResponse() { + return this.rawClient; + } + + /** + * Performance report for a company, ad campaigns, ad groups, or ads. Always returns aggregate summary totals summed across the scope. Set granularity to additionally get a time series, or set breakdown (campaign/ad_group/ad) to additionally get per-entity rows inside the requested scope. Exactly one of companyId, adCampaignIds, adGroupIds, or adIds must be provided. + *

Required permissions:

+ *
    + *
  • ad_campaign:stats:read
  • + *
+ */ + public CompletableFuture retrieve(RetrieveAdReportsRequest request) { + return this.rawClient.retrieve(request).thenApply(response -> response.body()); + } + + /** + * Performance report for a company, ad campaigns, ad groups, or ads. Always returns aggregate summary totals summed across the scope. Set granularity to additionally get a time series, or set breakdown (campaign/ad_group/ad) to additionally get per-entity rows inside the requested scope. Exactly one of companyId, adCampaignIds, adGroupIds, or adIds must be provided. + *

Required permissions:

+ *
    + *
  • ad_campaign:stats:read
  • + *
+ */ + public CompletableFuture retrieve(RetrieveAdReportsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/adreports/AsyncRawAdReportsClient.java b/src/main/java/com/whop/api/resources/adreports/AsyncRawAdReportsClient.java new file mode 100644 index 00000000..3a8eecc8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adreports/AsyncRawAdReportsClient.java @@ -0,0 +1,178 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adreports; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.adreports.requests.RetrieveAdReportsRequest; +import com.whop.api.types.AdReport; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAdReportsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAdReportsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Performance report for a company, ad campaigns, ad groups, or ads. Always returns aggregate summary totals summed across the scope. Set granularity to additionally get a time series, or set breakdown (campaign/ad_group/ad) to additionally get per-entity rows inside the requested scope. Exactly one of companyId, adCampaignIds, adGroupIds, or adIds must be provided. + *

Required permissions:

+ *
    + *
  • ad_campaign:stats:read
  • + *
+ */ + public CompletableFuture> retrieve(RetrieveAdReportsRequest request) { + return retrieve(request, null); + } + + /** + * Performance report for a company, ad campaigns, ad groups, or ads. Always returns aggregate summary totals summed across the scope. Set granularity to additionally get a time series, or set breakdown (campaign/ad_group/ad) to additionally get per-entity rows inside the requested scope. Exactly one of companyId, adCampaignIds, adGroupIds, or adIds must be provided. + *

Required permissions:

+ *
    + *
  • ad_campaign:stats:read
  • + *
+ */ + public CompletableFuture> retrieve( + RetrieveAdReportsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_reports"); + if (request.getBreakdown().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "breakdown", request.getBreakdown().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "from", request.getFrom(), false); + if (request.getGranularity().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "granularity", request.getGranularity().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "to", request.getTo(), false); + if (request.getAdCampaignIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_campaign_ids", request.getAdCampaignIds().get(), true); + } + if (request.getAdGroupIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_group_ids", request.getAdGroupIds().get(), true); + } + if (request.getAdIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_ids", request.getAdIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdReport.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/adreports/RawAdReportsClient.java b/src/main/java/com/whop/api/resources/adreports/RawAdReportsClient.java new file mode 100644 index 00000000..b99f77f8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adreports/RawAdReportsClient.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adreports; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.adreports.requests.RetrieveAdReportsRequest; +import com.whop.api.types.AdReport; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAdReportsClient { + protected final ClientOptions clientOptions; + + public RawAdReportsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Performance report for a company, ad campaigns, ad groups, or ads. Always returns aggregate summary totals summed across the scope. Set granularity to additionally get a time series, or set breakdown (campaign/ad_group/ad) to additionally get per-entity rows inside the requested scope. Exactly one of companyId, adCampaignIds, adGroupIds, or adIds must be provided. + *

Required permissions:

+ *
    + *
  • ad_campaign:stats:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(RetrieveAdReportsRequest request) { + return retrieve(request, null); + } + + /** + * Performance report for a company, ad campaigns, ad groups, or ads. Always returns aggregate summary totals summed across the scope. Set granularity to additionally get a time series, or set breakdown (campaign/ad_group/ad) to additionally get per-entity rows inside the requested scope. Exactly one of companyId, adCampaignIds, adGroupIds, or adIds must be provided. + *

Required permissions:

+ *
    + *
  • ad_campaign:stats:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(RetrieveAdReportsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ad_reports"); + if (request.getBreakdown().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "breakdown", request.getBreakdown().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "from", request.getFrom(), false); + if (request.getGranularity().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "granularity", request.getGranularity().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "to", request.getTo(), false); + if (request.getAdCampaignIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_campaign_ids", request.getAdCampaignIds().get(), true); + } + if (request.getAdGroupIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_group_ids", request.getAdGroupIds().get(), true); + } + if (request.getAdIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_ids", request.getAdIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdReport.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/adreports/requests/RetrieveAdReportsRequest.java b/src/main/java/com/whop/api/resources/adreports/requests/RetrieveAdReportsRequest.java new file mode 100644 index 00000000..2e61e555 --- /dev/null +++ b/src/main/java/com/whop/api/resources/adreports/requests/RetrieveAdReportsRequest.java @@ -0,0 +1,491 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.adreports.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AdReportBreakdownLevels; +import com.whop.api.types.Granularities; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveAdReportsRequest.Builder.class) +public final class RetrieveAdReportsRequest { + private final Optional> adCampaignIds; + + private final Optional> adGroupIds; + + private final Optional> adIds; + + private final Optional breakdown; + + private final Optional companyId; + + private final Optional currency; + + private final OffsetDateTime from; + + private final Optional granularity; + + private final OffsetDateTime to; + + private final Map additionalProperties; + + private RetrieveAdReportsRequest( + Optional> adCampaignIds, + Optional> adGroupIds, + Optional> adIds, + Optional breakdown, + Optional companyId, + Optional currency, + OffsetDateTime from, + Optional granularity, + OffsetDateTime to, + Map additionalProperties) { + this.adCampaignIds = adCampaignIds; + this.adGroupIds = adGroupIds; + this.adIds = adIds; + this.breakdown = breakdown; + this.companyId = companyId; + this.currency = currency; + this.from = from; + this.granularity = granularity; + this.to = to; + this.additionalProperties = additionalProperties; + } + + /** + * @return Scope the report to these ad campaigns (max 100); stats are summed across them. Mutually exclusive with companyId, adGroupIds, and adIds. + */ + @JsonProperty("ad_campaign_ids") + public Optional> getAdCampaignIds() { + return adCampaignIds; + } + + /** + * @return Scope the report to these ad groups (max 100); stats are summed across them. Mutually exclusive with companyId, adCampaignIds, and adIds. + */ + @JsonProperty("ad_group_ids") + public Optional> getAdGroupIds() { + return adGroupIds; + } + + /** + * @return Scope the report to these ads (max 100); stats are summed across them. Mutually exclusive with companyId, adCampaignIds, and adGroupIds. + */ + @JsonProperty("ad_ids") + public Optional> getAdIds() { + return adIds; + } + + @JsonProperty("breakdown") + public Optional getBreakdown() { + return breakdown; + } + + /** + * @return The unique identifier of a company. Mutually exclusive with adCampaignIds, adGroupIds, and adIds. Use with breakdown to fan out across every campaign, ad group, or ad in the company without paging. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + /** + * @return ISO 4217 currency code to report spend in. Defaults to the company's ads reporting currency. + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + /** + * @return Inclusive start of the reporting window. + */ + @JsonProperty("from") + public OffsetDateTime getFrom() { + return from; + } + + @JsonProperty("granularity") + public Optional getGranularity() { + return granularity; + } + + /** + * @return Inclusive end of the reporting window. + */ + @JsonProperty("to") + public OffsetDateTime getTo() { + return to; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveAdReportsRequest && equalTo((RetrieveAdReportsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveAdReportsRequest other) { + return adCampaignIds.equals(other.adCampaignIds) + && adGroupIds.equals(other.adGroupIds) + && adIds.equals(other.adIds) + && breakdown.equals(other.breakdown) + && companyId.equals(other.companyId) + && currency.equals(other.currency) + && from.equals(other.from) + && granularity.equals(other.granularity) + && to.equals(other.to); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adCampaignIds, + this.adGroupIds, + this.adIds, + this.breakdown, + this.companyId, + this.currency, + this.from, + this.granularity, + this.to); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FromStage builder() { + return new Builder(); + } + + public interface FromStage { + /** + *

Inclusive start of the reporting window.

+ */ + ToStage from(@NotNull OffsetDateTime from); + + Builder from(RetrieveAdReportsRequest other); + } + + public interface ToStage { + /** + *

Inclusive end of the reporting window.

+ */ + _FinalStage to(@NotNull OffsetDateTime to); + } + + public interface _FinalStage { + RetrieveAdReportsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Scope the report to these ad campaigns (max 100); stats are summed across them. Mutually exclusive with companyId, adGroupIds, and adIds.

+ */ + _FinalStage adCampaignIds(Optional> adCampaignIds); + + _FinalStage adCampaignIds(List adCampaignIds); + + _FinalStage adCampaignIds(String adCampaignIds); + + /** + *

Scope the report to these ad groups (max 100); stats are summed across them. Mutually exclusive with companyId, adCampaignIds, and adIds.

+ */ + _FinalStage adGroupIds(Optional> adGroupIds); + + _FinalStage adGroupIds(List adGroupIds); + + _FinalStage adGroupIds(String adGroupIds); + + /** + *

Scope the report to these ads (max 100); stats are summed across them. Mutually exclusive with companyId, adCampaignIds, and adGroupIds.

+ */ + _FinalStage adIds(Optional> adIds); + + _FinalStage adIds(List adIds); + + _FinalStage adIds(String adIds); + + _FinalStage breakdown(Optional breakdown); + + _FinalStage breakdown(AdReportBreakdownLevels breakdown); + + /** + *

The unique identifier of a company. Mutually exclusive with adCampaignIds, adGroupIds, and adIds. Use with breakdown to fan out across every campaign, ad group, or ad in the company without paging.

+ */ + _FinalStage companyId(Optional companyId); + + _FinalStage companyId(String companyId); + + /** + *

ISO 4217 currency code to report spend in. Defaults to the company's ads reporting currency.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + _FinalStage granularity(Optional granularity); + + _FinalStage granularity(Granularities granularity); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FromStage, ToStage, _FinalStage { + private OffsetDateTime from; + + private OffsetDateTime to; + + private Optional granularity = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional companyId = Optional.empty(); + + private Optional breakdown = Optional.empty(); + + private Optional> adIds = Optional.empty(); + + private Optional> adGroupIds = Optional.empty(); + + private Optional> adCampaignIds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveAdReportsRequest other) { + adCampaignIds(other.getAdCampaignIds()); + adGroupIds(other.getAdGroupIds()); + adIds(other.getAdIds()); + breakdown(other.getBreakdown()); + companyId(other.getCompanyId()); + currency(other.getCurrency()); + from(other.getFrom()); + granularity(other.getGranularity()); + to(other.getTo()); + return this; + } + + /** + *

Inclusive start of the reporting window.

+ *

Inclusive start of the reporting window.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("from") + public ToStage from(@NotNull OffsetDateTime from) { + this.from = Objects.requireNonNull(from, "from must not be null"); + return this; + } + + /** + *

Inclusive end of the reporting window.

+ *

Inclusive end of the reporting window.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("to") + public _FinalStage to(@NotNull OffsetDateTime to) { + this.to = Objects.requireNonNull(to, "to must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage granularity(Granularities granularity) { + this.granularity = Optional.ofNullable(granularity); + return this; + } + + @java.lang.Override + @JsonSetter(value = "granularity", nulls = Nulls.SKIP) + public _FinalStage granularity(Optional granularity) { + this.granularity = granularity; + return this; + } + + /** + *

ISO 4217 currency code to report spend in. Defaults to the company's ads reporting currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

ISO 4217 currency code to report spend in. Defaults to the company's ads reporting currency.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + /** + *

The unique identifier of a company. Mutually exclusive with adCampaignIds, adGroupIds, and adIds. Use with breakdown to fan out across every campaign, ad group, or ad in the company without paging.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + /** + *

The unique identifier of a company. Mutually exclusive with adCampaignIds, adGroupIds, and adIds. Use with breakdown to fan out across every campaign, ad group, or ad in the company without paging.

+ */ + @java.lang.Override + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public _FinalStage companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + @java.lang.Override + public _FinalStage breakdown(AdReportBreakdownLevels breakdown) { + this.breakdown = Optional.ofNullable(breakdown); + return this; + } + + @java.lang.Override + @JsonSetter(value = "breakdown", nulls = Nulls.SKIP) + public _FinalStage breakdown(Optional breakdown) { + this.breakdown = breakdown; + return this; + } + + @java.lang.Override + public _FinalStage adIds(String adIds) { + this.adIds = Optional.of(Collections.singletonList(adIds)); + return this; + } + + /** + *

Scope the report to these ads (max 100); stats are summed across them. Mutually exclusive with companyId, adCampaignIds, and adGroupIds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adIds(List adIds) { + this.adIds = Optional.ofNullable(adIds); + return this; + } + + /** + *

Scope the report to these ads (max 100); stats are summed across them. Mutually exclusive with companyId, adCampaignIds, and adGroupIds.

+ */ + @java.lang.Override + @JsonSetter(value = "ad_ids", nulls = Nulls.SKIP) + public _FinalStage adIds(Optional> adIds) { + this.adIds = adIds; + return this; + } + + @java.lang.Override + public _FinalStage adGroupIds(String adGroupIds) { + this.adGroupIds = Optional.of(Collections.singletonList(adGroupIds)); + return this; + } + + /** + *

Scope the report to these ad groups (max 100); stats are summed across them. Mutually exclusive with companyId, adCampaignIds, and adIds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adGroupIds(List adGroupIds) { + this.adGroupIds = Optional.ofNullable(adGroupIds); + return this; + } + + /** + *

Scope the report to these ad groups (max 100); stats are summed across them. Mutually exclusive with companyId, adCampaignIds, and adIds.

+ */ + @java.lang.Override + @JsonSetter(value = "ad_group_ids", nulls = Nulls.SKIP) + public _FinalStage adGroupIds(Optional> adGroupIds) { + this.adGroupIds = adGroupIds; + return this; + } + + @java.lang.Override + public _FinalStage adCampaignIds(String adCampaignIds) { + this.adCampaignIds = Optional.of(Collections.singletonList(adCampaignIds)); + return this; + } + + /** + *

Scope the report to these ad campaigns (max 100); stats are summed across them. Mutually exclusive with companyId, adGroupIds, and adIds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adCampaignIds(List adCampaignIds) { + this.adCampaignIds = Optional.ofNullable(adCampaignIds); + return this; + } + + /** + *

Scope the report to these ad campaigns (max 100); stats are summed across them. Mutually exclusive with companyId, adGroupIds, and adIds.

+ */ + @java.lang.Override + @JsonSetter(value = "ad_campaign_ids", nulls = Nulls.SKIP) + public _FinalStage adCampaignIds(Optional> adCampaignIds) { + this.adCampaignIds = adCampaignIds; + return this; + } + + @java.lang.Override + public RetrieveAdReportsRequest build() { + return new RetrieveAdReportsRequest( + adCampaignIds, + adGroupIds, + adIds, + breakdown, + companyId, + currency, + from, + granularity, + to, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/AdsClient.java b/src/main/java/com/whop/api/resources/ads/AdsClient.java new file mode 100644 index 00000000..6b378905 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/AdsClient.java @@ -0,0 +1,261 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.ads.requests.CreateAdsRequest; +import com.whop.api.resources.ads.requests.DeleteAdsRequest; +import com.whop.api.resources.ads.requests.DuplicateAdsRequest; +import com.whop.api.resources.ads.requests.ListAdsRequest; +import com.whop.api.resources.ads.requests.PauseAdsRequest; +import com.whop.api.resources.ads.requests.RetrieveAdsRequest; +import com.whop.api.resources.ads.requests.UnpauseAdsRequest; +import com.whop.api.resources.ads.requests.UpdateAdsRequest; +import com.whop.api.resources.ads.types.DeleteAdsResponse; +import com.whop.api.resources.ads.types.DuplicateAdsResponse; +import com.whop.api.types.Ad; + +public class AdsClient { + protected final ClientOptions clientOptions; + + private final RawAdsClient rawClient; + + public AdsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAdsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAdsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public SyncPagingIterable list(ListAdsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public SyncPagingIterable list(ListAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Creates an ad in an ad group. + */ + public Ad create() { + return this.rawClient.create().body(); + } + + /** + * Creates an ad in an ad group. + */ + public Ad create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).body(); + } + + /** + * Creates an ad in an ad group. + */ + public Ad create(CreateAdsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Creates an ad in an ad group. + */ + public Ad create(CreateAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public Ad retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public Ad retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public Ad retrieve(String id, RetrieveAdsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public Ad retrieve(String id, RetrieveAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Deletes an ad. + */ + public DeleteAdsResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Deletes an ad. + */ + public DeleteAdsResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Deletes an ad. + */ + public DeleteAdsResponse delete(String id, DeleteAdsRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Deletes an ad. + */ + public DeleteAdsResponse delete(String id, DeleteAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Updates an ad's editable fields. + */ + public Ad update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Updates an ad's editable fields. + */ + public Ad update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Updates an ad's editable fields. + */ + public Ad update(String id, UpdateAdsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Updates an ad's editable fields. + */ + public Ad update(String id, UpdateAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public DuplicateAdsResponse duplicate(String id) { + return this.rawClient.duplicate(id).body(); + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public DuplicateAdsResponse duplicate(String id, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, requestOptions).body(); + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public DuplicateAdsResponse duplicate(String id, DuplicateAdsRequest request) { + return this.rawClient.duplicate(id, request).body(); + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public DuplicateAdsResponse duplicate(String id, DuplicateAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, request, requestOptions).body(); + } + + /** + * Pauses an active ad. + */ + public Ad pause(String id) { + return this.rawClient.pause(id).body(); + } + + /** + * Pauses an active ad. + */ + public Ad pause(String id, RequestOptions requestOptions) { + return this.rawClient.pause(id, requestOptions).body(); + } + + /** + * Pauses an active ad. + */ + public Ad pause(String id, PauseAdsRequest request) { + return this.rawClient.pause(id, request).body(); + } + + /** + * Pauses an active ad. + */ + public Ad pause(String id, PauseAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.pause(id, request, requestOptions).body(); + } + + /** + * Resumes a paused ad. + */ + public Ad unpause(String id) { + return this.rawClient.unpause(id).body(); + } + + /** + * Resumes a paused ad. + */ + public Ad unpause(String id, RequestOptions requestOptions) { + return this.rawClient.unpause(id, requestOptions).body(); + } + + /** + * Resumes a paused ad. + */ + public Ad unpause(String id, UnpauseAdsRequest request) { + return this.rawClient.unpause(id, request).body(); + } + + /** + * Resumes a paused ad. + */ + public Ad unpause(String id, UnpauseAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.unpause(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/AsyncAdsClient.java b/src/main/java/com/whop/api/resources/ads/AsyncAdsClient.java new file mode 100644 index 00000000..12a9746f --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/AsyncAdsClient.java @@ -0,0 +1,264 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.ads.requests.CreateAdsRequest; +import com.whop.api.resources.ads.requests.DeleteAdsRequest; +import com.whop.api.resources.ads.requests.DuplicateAdsRequest; +import com.whop.api.resources.ads.requests.ListAdsRequest; +import com.whop.api.resources.ads.requests.PauseAdsRequest; +import com.whop.api.resources.ads.requests.RetrieveAdsRequest; +import com.whop.api.resources.ads.requests.UnpauseAdsRequest; +import com.whop.api.resources.ads.requests.UpdateAdsRequest; +import com.whop.api.resources.ads.types.DeleteAdsResponse; +import com.whop.api.resources.ads.types.DuplicateAdsResponse; +import com.whop.api.types.Ad; +import java.util.concurrent.CompletableFuture; + +public class AsyncAdsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAdsClient rawClient; + + public AsyncAdsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAdsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAdsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public CompletableFuture> list(ListAdsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public CompletableFuture> list(ListAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates an ad in an ad group. + */ + public CompletableFuture create() { + return this.rawClient.create().thenApply(response -> response.body()); + } + + /** + * Creates an ad in an ad group. + */ + public CompletableFuture create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates an ad in an ad group. + */ + public CompletableFuture create(CreateAdsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Creates an ad in an ad group. + */ + public CompletableFuture create(CreateAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public CompletableFuture retrieve(String id, RetrieveAdsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public CompletableFuture retrieve(String id, RetrieveAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes an ad. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Deletes an ad. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes an ad. + */ + public CompletableFuture delete(String id, DeleteAdsRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Deletes an ad. + */ + public CompletableFuture delete( + String id, DeleteAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates an ad's editable fields. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Updates an ad's editable fields. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates an ad's editable fields. + */ + public CompletableFuture update(String id, UpdateAdsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Updates an ad's editable fields. + */ + public CompletableFuture update(String id, UpdateAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public CompletableFuture duplicate(String id) { + return this.rawClient.duplicate(id).thenApply(response -> response.body()); + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public CompletableFuture duplicate(String id, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public CompletableFuture duplicate(String id, DuplicateAdsRequest request) { + return this.rawClient.duplicate(id, request).thenApply(response -> response.body()); + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public CompletableFuture duplicate( + String id, DuplicateAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Pauses an active ad. + */ + public CompletableFuture pause(String id) { + return this.rawClient.pause(id).thenApply(response -> response.body()); + } + + /** + * Pauses an active ad. + */ + public CompletableFuture pause(String id, RequestOptions requestOptions) { + return this.rawClient.pause(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Pauses an active ad. + */ + public CompletableFuture pause(String id, PauseAdsRequest request) { + return this.rawClient.pause(id, request).thenApply(response -> response.body()); + } + + /** + * Pauses an active ad. + */ + public CompletableFuture pause(String id, PauseAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.pause(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Resumes a paused ad. + */ + public CompletableFuture unpause(String id) { + return this.rawClient.unpause(id).thenApply(response -> response.body()); + } + + /** + * Resumes a paused ad. + */ + public CompletableFuture unpause(String id, RequestOptions requestOptions) { + return this.rawClient.unpause(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Resumes a paused ad. + */ + public CompletableFuture unpause(String id, UnpauseAdsRequest request) { + return this.rawClient.unpause(id, request).thenApply(response -> response.body()); + } + + /** + * Resumes a paused ad. + */ + public CompletableFuture unpause(String id, UnpauseAdsRequest request, RequestOptions requestOptions) { + return this.rawClient.unpause(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/AsyncRawAdsClient.java b/src/main/java/com/whop/api/resources/ads/AsyncRawAdsClient.java new file mode 100644 index 00000000..d11985b1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/AsyncRawAdsClient.java @@ -0,0 +1,873 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.ads.requests.CreateAdsRequest; +import com.whop.api.resources.ads.requests.DeleteAdsRequest; +import com.whop.api.resources.ads.requests.DuplicateAdsRequest; +import com.whop.api.resources.ads.requests.ListAdsRequest; +import com.whop.api.resources.ads.requests.PauseAdsRequest; +import com.whop.api.resources.ads.requests.RetrieveAdsRequest; +import com.whop.api.resources.ads.requests.UnpauseAdsRequest; +import com.whop.api.resources.ads.requests.UpdateAdsRequest; +import com.whop.api.resources.ads.types.DeleteAdsResponse; +import com.whop.api.resources.ads.types.DuplicateAdsResponse; +import com.whop.api.resources.ads.types.ListAdsResponse; +import com.whop.api.types.Ad; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAdsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAdsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public CompletableFuture>> list() { + return list(ListAdsRequest.builder().build()); + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(ListAdsRequest.builder().build(), requestOptions); + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public CompletableFuture>> list(ListAdsRequest request) { + return list(request, null); + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public CompletableFuture>> list( + ListAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getAdCampaignId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_campaign_id", request.getAdCampaignId().get(), false); + } + if (request.getAdGroupId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_group_id", request.getAdGroupId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getStatsFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_from", request.getStatsFrom().get(), false); + } + if (request.getStatsTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_to", request.getStatsTo().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getAdCampaignIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_campaign_ids", request.getAdCampaignIds().get(), true); + } + if (request.getAdGroupIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_group_ids", request.getAdGroupIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAdsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAdsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListAdsRequest nextRequest = ListAdsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable(startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates an ad in an ad group. + */ + public CompletableFuture> create() { + return create(CreateAdsRequest.builder().build()); + } + + /** + * Creates an ad in an ad group. + */ + public CompletableFuture> create(RequestOptions requestOptions) { + return create(CreateAdsRequest.builder().build(), requestOptions); + } + + /** + * Creates an ad in an ad group. + */ + public CompletableFuture> create(CreateAdsRequest request) { + return create(request, null); + } + + /** + * Creates an ad in an ad group. + */ + public CompletableFuture> create(CreateAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Ad.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveAdsRequest.builder().build()); + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAdsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public CompletableFuture> retrieve(String id, RetrieveAdsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public CompletableFuture> retrieve( + String id, RetrieveAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads") + .addPathSegment(id); + if (request.getStatsFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_from", request.getStatsFrom().get(), false); + } + if (request.getStatsTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_to", request.getStatsTo().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Ad.class), response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes an ad. + */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteAdsRequest.builder().build()); + } + + /** + * Deletes an ad. + */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteAdsRequest.builder().build(), requestOptions); + } + + /** + * Deletes an ad. + */ + public CompletableFuture> delete(String id, DeleteAdsRequest request) { + return delete(id, request, null); + } + + /** + * Deletes an ad. + */ + public CompletableFuture> delete( + String id, DeleteAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteAdsResponse.class), + response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates an ad's editable fields. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateAdsRequest.builder().build()); + } + + /** + * Updates an ad's editable fields. + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateAdsRequest.builder().build(), requestOptions); + } + + /** + * Updates an ad's editable fields. + */ + public CompletableFuture> update(String id, UpdateAdsRequest request) { + return update(id, request, null); + } + + /** + * Updates an ad's editable fields. + */ + public CompletableFuture> update( + String id, UpdateAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Ad.class), response)); + return; + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public CompletableFuture> duplicate(String id) { + return duplicate(id, DuplicateAdsRequest.builder().build()); + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public CompletableFuture> duplicate( + String id, RequestOptions requestOptions) { + return duplicate(id, DuplicateAdsRequest.builder().build(), requestOptions); + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public CompletableFuture> duplicate( + String id, DuplicateAdsRequest request) { + return duplicate(id, request, null); + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public CompletableFuture> duplicate( + String id, DuplicateAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads") + .addPathSegment(id) + .addPathSegments("duplicate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DuplicateAdsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Pauses an active ad. + */ + public CompletableFuture> pause(String id) { + return pause(id, PauseAdsRequest.builder().build()); + } + + /** + * Pauses an active ad. + */ + public CompletableFuture> pause(String id, RequestOptions requestOptions) { + return pause(id, PauseAdsRequest.builder().build(), requestOptions); + } + + /** + * Pauses an active ad. + */ + public CompletableFuture> pause(String id, PauseAdsRequest request) { + return pause(id, request, null); + } + + /** + * Pauses an active ad. + */ + public CompletableFuture> pause( + String id, PauseAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads") + .addPathSegment(id) + .addPathSegments("pause"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Ad.class), response)); + return; + } + try { + if (response.code() == 409) { + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Resumes a paused ad. + */ + public CompletableFuture> unpause(String id) { + return unpause(id, UnpauseAdsRequest.builder().build()); + } + + /** + * Resumes a paused ad. + */ + public CompletableFuture> unpause(String id, RequestOptions requestOptions) { + return unpause(id, UnpauseAdsRequest.builder().build(), requestOptions); + } + + /** + * Resumes a paused ad. + */ + public CompletableFuture> unpause(String id, UnpauseAdsRequest request) { + return unpause(id, request, null); + } + + /** + * Resumes a paused ad. + */ + public CompletableFuture> unpause( + String id, UnpauseAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads") + .addPathSegment(id) + .addPathSegments("unpause"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Ad.class), response)); + return; + } + try { + if (response.code() == 409) { + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/ads/RawAdsClient.java b/src/main/java/com/whop/api/resources/ads/RawAdsClient.java new file mode 100644 index 00000000..6614412e --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/RawAdsClient.java @@ -0,0 +1,728 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.ads.requests.CreateAdsRequest; +import com.whop.api.resources.ads.requests.DeleteAdsRequest; +import com.whop.api.resources.ads.requests.DuplicateAdsRequest; +import com.whop.api.resources.ads.requests.ListAdsRequest; +import com.whop.api.resources.ads.requests.PauseAdsRequest; +import com.whop.api.resources.ads.requests.RetrieveAdsRequest; +import com.whop.api.resources.ads.requests.UnpauseAdsRequest; +import com.whop.api.resources.ads.requests.UpdateAdsRequest; +import com.whop.api.resources.ads.types.DeleteAdsResponse; +import com.whop.api.resources.ads.types.DuplicateAdsResponse; +import com.whop.api.resources.ads.types.ListAdsResponse; +import com.whop.api.types.Ad; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAdsClient { + protected final ClientOptions clientOptions; + + public RawAdsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public WhopApiHttpResponse> list() { + return list(ListAdsRequest.builder().build()); + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListAdsRequest.builder().build(), requestOptions); + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public WhopApiHttpResponse> list(ListAdsRequest request) { + return list(request, null); + } + + /** + * Lists the ads for an account, with stats over the requested window. + */ + public WhopApiHttpResponse> list(ListAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getAdCampaignId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_campaign_id", request.getAdCampaignId().get(), false); + } + if (request.getAdGroupId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_group_id", request.getAdGroupId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getStatsFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_from", request.getStatsFrom().get(), false); + } + if (request.getStatsTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_to", request.getStatsTo().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getAdCampaignIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_campaign_ids", request.getAdCampaignIds().get(), true); + } + if (request.getAdGroupIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_group_ids", request.getAdGroupIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAdsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAdsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListAdsRequest nextRequest = ListAdsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates an ad in an ad group. + */ + public WhopApiHttpResponse create() { + return create(CreateAdsRequest.builder().build()); + } + + /** + * Creates an ad in an ad group. + */ + public WhopApiHttpResponse create(RequestOptions requestOptions) { + return create(CreateAdsRequest.builder().build(), requestOptions); + } + + /** + * Creates an ad in an ad group. + */ + public WhopApiHttpResponse create(CreateAdsRequest request) { + return create(request, null); + } + + /** + * Creates an ad in an ad group. + */ + public WhopApiHttpResponse create(CreateAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Ad.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveAdsRequest.builder().build()); + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAdsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveAdsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single ad with stats over the requested window. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads") + .addPathSegment(id); + if (request.getStatsFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_from", request.getStatsFrom().get(), false); + } + if (request.getStatsTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "stats_to", request.getStatsTo().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Ad.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Deletes an ad. + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteAdsRequest.builder().build()); + } + + /** + * Deletes an ad. + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteAdsRequest.builder().build(), requestOptions); + } + + /** + * Deletes an ad. + */ + public WhopApiHttpResponse delete(String id, DeleteAdsRequest request) { + return delete(id, request, null); + } + + /** + * Deletes an ad. + */ + public WhopApiHttpResponse delete( + String id, DeleteAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteAdsResponse.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates an ad's editable fields. + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateAdsRequest.builder().build()); + } + + /** + * Updates an ad's editable fields. + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateAdsRequest.builder().build(), requestOptions); + } + + /** + * Updates an ad's editable fields. + */ + public WhopApiHttpResponse update(String id, UpdateAdsRequest request) { + return update(id, request, null); + } + + /** + * Updates an ad's editable fields. + */ + public WhopApiHttpResponse update(String id, UpdateAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Ad.class), response); + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public WhopApiHttpResponse duplicate(String id) { + return duplicate(id, DuplicateAdsRequest.builder().build()); + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public WhopApiHttpResponse duplicate(String id, RequestOptions requestOptions) { + return duplicate(id, DuplicateAdsRequest.builder().build(), requestOptions); + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public WhopApiHttpResponse duplicate(String id, DuplicateAdsRequest request) { + return duplicate(id, request, null); + } + + /** + * Copies the ad into its own ad group, or into target_ad_group_id (which must belong to the same account and be compatible with the ad). Copies keep the source ad's active/paused state. + */ + public WhopApiHttpResponse duplicate( + String id, DuplicateAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads") + .addPathSegment(id) + .addPathSegments("duplicate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DuplicateAdsResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Pauses an active ad. + */ + public WhopApiHttpResponse pause(String id) { + return pause(id, PauseAdsRequest.builder().build()); + } + + /** + * Pauses an active ad. + */ + public WhopApiHttpResponse pause(String id, RequestOptions requestOptions) { + return pause(id, PauseAdsRequest.builder().build(), requestOptions); + } + + /** + * Pauses an active ad. + */ + public WhopApiHttpResponse pause(String id, PauseAdsRequest request) { + return pause(id, request, null); + } + + /** + * Pauses an active ad. + */ + public WhopApiHttpResponse pause(String id, PauseAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads") + .addPathSegment(id) + .addPathSegments("pause"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Ad.class), response); + } + try { + if (response.code() == 409) { + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Resumes a paused ad. + */ + public WhopApiHttpResponse unpause(String id) { + return unpause(id, UnpauseAdsRequest.builder().build()); + } + + /** + * Resumes a paused ad. + */ + public WhopApiHttpResponse unpause(String id, RequestOptions requestOptions) { + return unpause(id, UnpauseAdsRequest.builder().build(), requestOptions); + } + + /** + * Resumes a paused ad. + */ + public WhopApiHttpResponse unpause(String id, UnpauseAdsRequest request) { + return unpause(id, request, null); + } + + /** + * Resumes a paused ad. + */ + public WhopApiHttpResponse unpause(String id, UnpauseAdsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ads") + .addPathSegment(id) + .addPathSegments("unpause"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Ad.class), response); + } + try { + if (response.code() == 409) { + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/requests/CreateAdsRequest.java b/src/main/java/com/whop/api/resources/ads/requests/CreateAdsRequest.java new file mode 100644 index 00000000..ca0fd315 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/requests/CreateAdsRequest.java @@ -0,0 +1,635 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.ads.types.CreateAdsRequestCallToAction; +import com.whop.api.resources.ads.types.CreateAdsRequestCreativesItem; +import com.whop.api.resources.ads.types.CreateAdsRequestLeadForm; +import com.whop.api.resources.ads.types.CreateAdsRequestMessagingConfig; +import com.whop.api.resources.ads.types.CreateAdsRequestPostSource; +import com.whop.api.resources.ads.types.CreateAdsRequestSocialAccountsItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdsRequest.Builder.class) +public final class CreateAdsRequest { + private final Optional> adGroup; + + private final Optional adGroupId; + + private final Optional callToAction; + + private final Optional> creatives; + + private final Optional> descriptions; + + private final Optional> headlines; + + private final Optional leadForm; + + private final Optional leadFormId; + + private final Optional messagingConfig; + + private final Optional multiAdvertiserAds; + + private final Optional postId; + + private final Optional postSource; + + private final Optional> primaryTexts; + + private final Optional> socialAccounts; + + private final Optional title; + + private final Optional url; + + private final Optional> urlParameters; + + private final Map additionalProperties; + + private CreateAdsRequest( + Optional> adGroup, + Optional adGroupId, + Optional callToAction, + Optional> creatives, + Optional> descriptions, + Optional> headlines, + Optional leadForm, + Optional leadFormId, + Optional messagingConfig, + Optional multiAdvertiserAds, + Optional postId, + Optional postSource, + Optional> primaryTexts, + Optional> socialAccounts, + Optional title, + Optional url, + Optional> urlParameters, + Map additionalProperties) { + this.adGroup = adGroup; + this.adGroupId = adGroupId; + this.callToAction = callToAction; + this.creatives = creatives; + this.descriptions = descriptions; + this.headlines = headlines; + this.leadForm = leadForm; + this.leadFormId = leadFormId; + this.messagingConfig = messagingConfig; + this.multiAdvertiserAds = multiAdvertiserAds; + this.postId = postId; + this.postSource = postSource; + this.primaryTexts = primaryTexts; + this.socialAccounts = socialAccounts; + this.title = title; + this.url = url; + this.urlParameters = urlParameters; + this.additionalProperties = additionalProperties; + } + + /** + * @return An inline ad group to create (same shape as POST /ad_groups, including ad_campaign_id). Creates the ad group and the ad together. Provide this OR ad_group_id. + */ + @JsonProperty("ad_group") + public Optional> getAdGroup() { + return adGroup; + } + + /** + * @return The existing ad group to create the ad in. Provide this OR ad_group, not both. + */ + @JsonProperty("ad_group_id") + public Optional getAdGroupId() { + return adGroupId; + } + + /** + * @return The call-to-action button shown on the ad. + */ + @JsonProperty("call_to_action") + public Optional getCallToAction() { + return callToAction; + } + + /** + * @return The ad's creative assets. Each entry is an uploaded file id with an optional format; omit format for the original asset. Two or more entries with no format become a carousel (2-10 attachments), in order, sharing the ad's copy. + */ + @JsonProperty("creatives") + public Optional> getCreatives() { + return creatives; + } + + /** + * @return The description variants shown on the ad. + */ + @JsonProperty("descriptions") + public Optional> getDescriptions() { + return descriptions; + } + + /** + * @return The headline variants shown on the ad. + */ + @JsonProperty("headlines") + public Optional> getHeadlines() { + return headlines; + } + + /** + * @return Instant lead form for the ad. Only allowed when the ad group's conversion_location is an instant-form destination (instant_forms, instant_forms_and_messenger, website_and_instant_forms). Mutually exclusive with lead_form_id. + */ + @JsonProperty("lead_form") + public Optional getLeadForm() { + return leadForm; + } + + /** + * @return Use an existing instant form instead of creating one — the form's platform ID, from a form already on the ad's Facebook page. Only allowed when the ad group's conversion_location is an instant-form destination. Mutually exclusive with lead_form. + */ + @JsonProperty("lead_form_id") + public Optional getLeadFormId() { + return leadFormId; + } + + /** + * @return Click-to-message welcome copy: the greeting (message) and the ice-breaker prompt (keyword). + */ + @JsonProperty("messaging_config") + public Optional getMessagingConfig() { + return messagingConfig; + } + + /** + * @return Whether the ad can appear alongside other advertisers' ads in the same unit. Defaults to true. + */ + @JsonProperty("multi_advertiser_ads") + public Optional getMultiAdvertiserAds() { + return multiAdvertiserAds; + } + + /** + * @return Promote an existing post instead of uploading creatives — a Facebook post or Instagram media id. Mutually exclusive with creatives. Pair with post_source. + */ + @JsonProperty("post_id") + public Optional getPostId() { + return postId; + } + + /** + * @return Identifies the network that owns post_id. The source is inferred from the ID shape when omitted. + */ + @JsonProperty("post_source") + public Optional getPostSource() { + return postSource; + } + + /** + * @return The primary text variants shown in the ad body. + */ + @JsonProperty("primary_texts") + public Optional> getPrimaryTexts() { + return primaryTexts; + } + + /** + * @return The social accounts the ad runs under — a connected Facebook page and, optionally, an Instagram profile. + */ + @JsonProperty("social_accounts") + public Optional> getSocialAccounts() { + return socialAccounts; + } + + /** + * @return The display name of the ad. + */ + @JsonProperty("title") + public Optional getTitle() { + return title; + } + + /** + * @return The URL the ad links to. Query parameters are merged into url_parameters, so the stored URL is always bare. + */ + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + /** + * @return Query parameters to append to the destination URL, keyed by parameter name. Merged with any query string on url. Whop adds its own click-attribution parameters; those are reserved and rejected if you set them (utm_meta_ad_id, utm_meta_adset_id, utm_meta_campaign_id, utm_source, utm_placement, utm_medium, utm_content, utm_adset, utm_whop, wacid, wasid, waid, tw_source, tw_adid). + */ + @JsonProperty("url_parameters") + public Optional> getUrlParameters() { + return urlParameters; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdsRequest && equalTo((CreateAdsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdsRequest other) { + return adGroup.equals(other.adGroup) + && adGroupId.equals(other.adGroupId) + && callToAction.equals(other.callToAction) + && creatives.equals(other.creatives) + && descriptions.equals(other.descriptions) + && headlines.equals(other.headlines) + && leadForm.equals(other.leadForm) + && leadFormId.equals(other.leadFormId) + && messagingConfig.equals(other.messagingConfig) + && multiAdvertiserAds.equals(other.multiAdvertiserAds) + && postId.equals(other.postId) + && postSource.equals(other.postSource) + && primaryTexts.equals(other.primaryTexts) + && socialAccounts.equals(other.socialAccounts) + && title.equals(other.title) + && url.equals(other.url) + && urlParameters.equals(other.urlParameters); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adGroup, + this.adGroupId, + this.callToAction, + this.creatives, + this.descriptions, + this.headlines, + this.leadForm, + this.leadFormId, + this.messagingConfig, + this.multiAdvertiserAds, + this.postId, + this.postSource, + this.primaryTexts, + this.socialAccounts, + this.title, + this.url, + this.urlParameters); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> adGroup = Optional.empty(); + + private Optional adGroupId = Optional.empty(); + + private Optional callToAction = Optional.empty(); + + private Optional> creatives = Optional.empty(); + + private Optional> descriptions = Optional.empty(); + + private Optional> headlines = Optional.empty(); + + private Optional leadForm = Optional.empty(); + + private Optional leadFormId = Optional.empty(); + + private Optional messagingConfig = Optional.empty(); + + private Optional multiAdvertiserAds = Optional.empty(); + + private Optional postId = Optional.empty(); + + private Optional postSource = Optional.empty(); + + private Optional> primaryTexts = Optional.empty(); + + private Optional> socialAccounts = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional url = Optional.empty(); + + private Optional> urlParameters = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAdsRequest other) { + adGroup(other.getAdGroup()); + adGroupId(other.getAdGroupId()); + callToAction(other.getCallToAction()); + creatives(other.getCreatives()); + descriptions(other.getDescriptions()); + headlines(other.getHeadlines()); + leadForm(other.getLeadForm()); + leadFormId(other.getLeadFormId()); + messagingConfig(other.getMessagingConfig()); + multiAdvertiserAds(other.getMultiAdvertiserAds()); + postId(other.getPostId()); + postSource(other.getPostSource()); + primaryTexts(other.getPrimaryTexts()); + socialAccounts(other.getSocialAccounts()); + title(other.getTitle()); + url(other.getUrl()); + urlParameters(other.getUrlParameters()); + return this; + } + + /** + *

An inline ad group to create (same shape as POST /ad_groups, including ad_campaign_id). Creates the ad group and the ad together. Provide this OR ad_group_id.

+ */ + @JsonSetter(value = "ad_group", nulls = Nulls.SKIP) + public Builder adGroup(Optional> adGroup) { + this.adGroup = adGroup; + return this; + } + + public Builder adGroup(Map adGroup) { + this.adGroup = Optional.ofNullable(adGroup); + return this; + } + + /** + *

The existing ad group to create the ad in. Provide this OR ad_group, not both.

+ */ + @JsonSetter(value = "ad_group_id", nulls = Nulls.SKIP) + public Builder adGroupId(Optional adGroupId) { + this.adGroupId = adGroupId; + return this; + } + + public Builder adGroupId(String adGroupId) { + this.adGroupId = Optional.ofNullable(adGroupId); + return this; + } + + /** + *

The call-to-action button shown on the ad.

+ */ + @JsonSetter(value = "call_to_action", nulls = Nulls.SKIP) + public Builder callToAction(Optional callToAction) { + this.callToAction = callToAction; + return this; + } + + public Builder callToAction(CreateAdsRequestCallToAction callToAction) { + this.callToAction = Optional.ofNullable(callToAction); + return this; + } + + /** + *

The ad's creative assets. Each entry is an uploaded file id with an optional format; omit format for the original asset. Two or more entries with no format become a carousel (2-10 attachments), in order, sharing the ad's copy.

+ */ + @JsonSetter(value = "creatives", nulls = Nulls.SKIP) + public Builder creatives(Optional> creatives) { + this.creatives = creatives; + return this; + } + + public Builder creatives(List creatives) { + this.creatives = Optional.ofNullable(creatives); + return this; + } + + /** + *

The description variants shown on the ad.

+ */ + @JsonSetter(value = "descriptions", nulls = Nulls.SKIP) + public Builder descriptions(Optional> descriptions) { + this.descriptions = descriptions; + return this; + } + + public Builder descriptions(List descriptions) { + this.descriptions = Optional.ofNullable(descriptions); + return this; + } + + /** + *

The headline variants shown on the ad.

+ */ + @JsonSetter(value = "headlines", nulls = Nulls.SKIP) + public Builder headlines(Optional> headlines) { + this.headlines = headlines; + return this; + } + + public Builder headlines(List headlines) { + this.headlines = Optional.ofNullable(headlines); + return this; + } + + /** + *

Instant lead form for the ad. Only allowed when the ad group's conversion_location is an instant-form destination (instant_forms, instant_forms_and_messenger, website_and_instant_forms). Mutually exclusive with lead_form_id.

+ */ + @JsonSetter(value = "lead_form", nulls = Nulls.SKIP) + public Builder leadForm(Optional leadForm) { + this.leadForm = leadForm; + return this; + } + + public Builder leadForm(CreateAdsRequestLeadForm leadForm) { + this.leadForm = Optional.ofNullable(leadForm); + return this; + } + + /** + *

Use an existing instant form instead of creating one — the form's platform ID, from a form already on the ad's Facebook page. Only allowed when the ad group's conversion_location is an instant-form destination. Mutually exclusive with lead_form.

+ */ + @JsonSetter(value = "lead_form_id", nulls = Nulls.SKIP) + public Builder leadFormId(Optional leadFormId) { + this.leadFormId = leadFormId; + return this; + } + + public Builder leadFormId(String leadFormId) { + this.leadFormId = Optional.ofNullable(leadFormId); + return this; + } + + /** + *

Click-to-message welcome copy: the greeting (message) and the ice-breaker prompt (keyword).

+ */ + @JsonSetter(value = "messaging_config", nulls = Nulls.SKIP) + public Builder messagingConfig(Optional messagingConfig) { + this.messagingConfig = messagingConfig; + return this; + } + + public Builder messagingConfig(CreateAdsRequestMessagingConfig messagingConfig) { + this.messagingConfig = Optional.ofNullable(messagingConfig); + return this; + } + + /** + *

Whether the ad can appear alongside other advertisers' ads in the same unit. Defaults to true.

+ */ + @JsonSetter(value = "multi_advertiser_ads", nulls = Nulls.SKIP) + public Builder multiAdvertiserAds(Optional multiAdvertiserAds) { + this.multiAdvertiserAds = multiAdvertiserAds; + return this; + } + + public Builder multiAdvertiserAds(Boolean multiAdvertiserAds) { + this.multiAdvertiserAds = Optional.ofNullable(multiAdvertiserAds); + return this; + } + + /** + *

Promote an existing post instead of uploading creatives — a Facebook post or Instagram media id. Mutually exclusive with creatives. Pair with post_source.

+ */ + @JsonSetter(value = "post_id", nulls = Nulls.SKIP) + public Builder postId(Optional postId) { + this.postId = postId; + return this; + } + + public Builder postId(String postId) { + this.postId = Optional.ofNullable(postId); + return this; + } + + /** + *

Identifies the network that owns post_id. The source is inferred from the ID shape when omitted.

+ */ + @JsonSetter(value = "post_source", nulls = Nulls.SKIP) + public Builder postSource(Optional postSource) { + this.postSource = postSource; + return this; + } + + public Builder postSource(CreateAdsRequestPostSource postSource) { + this.postSource = Optional.ofNullable(postSource); + return this; + } + + /** + *

The primary text variants shown in the ad body.

+ */ + @JsonSetter(value = "primary_texts", nulls = Nulls.SKIP) + public Builder primaryTexts(Optional> primaryTexts) { + this.primaryTexts = primaryTexts; + return this; + } + + public Builder primaryTexts(List primaryTexts) { + this.primaryTexts = Optional.ofNullable(primaryTexts); + return this; + } + + /** + *

The social accounts the ad runs under — a connected Facebook page and, optionally, an Instagram profile.

+ */ + @JsonSetter(value = "social_accounts", nulls = Nulls.SKIP) + public Builder socialAccounts(Optional> socialAccounts) { + this.socialAccounts = socialAccounts; + return this; + } + + public Builder socialAccounts(List socialAccounts) { + this.socialAccounts = Optional.ofNullable(socialAccounts); + return this; + } + + /** + *

The display name of the ad.

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The URL the ad links to. Query parameters are merged into url_parameters, so the stored URL is always bare.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

Query parameters to append to the destination URL, keyed by parameter name. Merged with any query string on url. Whop adds its own click-attribution parameters; those are reserved and rejected if you set them (utm_meta_ad_id, utm_meta_adset_id, utm_meta_campaign_id, utm_source, utm_placement, utm_medium, utm_content, utm_adset, utm_whop, wacid, wasid, waid, tw_source, tw_adid).

+ */ + @JsonSetter(value = "url_parameters", nulls = Nulls.SKIP) + public Builder urlParameters(Optional> urlParameters) { + this.urlParameters = urlParameters; + return this; + } + + public Builder urlParameters(Map urlParameters) { + this.urlParameters = Optional.ofNullable(urlParameters); + return this; + } + + public CreateAdsRequest build() { + return new CreateAdsRequest( + adGroup, + adGroupId, + callToAction, + creatives, + descriptions, + headlines, + leadForm, + leadFormId, + messagingConfig, + multiAdvertiserAds, + postId, + postSource, + primaryTexts, + socialAccounts, + title, + url, + urlParameters, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/requests/DeleteAdsRequest.java b/src/main/java/com/whop/api/resources/ads/requests/DeleteAdsRequest.java new file mode 100644 index 00000000..e47dada2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/requests/DeleteAdsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteAdsRequest.Builder.class) +public final class DeleteAdsRequest { + private final Map additionalProperties; + + private DeleteAdsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteAdsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteAdsRequest other) { + return this; + } + + public DeleteAdsRequest build() { + return new DeleteAdsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/requests/DuplicateAdsRequest.java b/src/main/java/com/whop/api/resources/ads/requests/DuplicateAdsRequest.java new file mode 100644 index 00000000..6e427e21 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/requests/DuplicateAdsRequest.java @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DuplicateAdsRequest.Builder.class) +public final class DuplicateAdsRequest { + private final Optional count; + + private final Optional preserveEngagement; + + private final Optional targetAdGroupId; + + private final Map additionalProperties; + + private DuplicateAdsRequest( + Optional count, + Optional preserveEngagement, + Optional targetAdGroupId, + Map additionalProperties) { + this.count = count; + this.preserveEngagement = preserveEngagement; + this.targetAdGroupId = targetAdGroupId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Number of copies to create (1-10). Defaults to 1. + */ + @JsonProperty("count") + public Optional getCount() { + return count; + } + + /** + * @return Whether the copies keep the original post's engagement (likes, comments, shares). Defaults to false. + */ + @JsonProperty("preserve_engagement") + public Optional getPreserveEngagement() { + return preserveEngagement; + } + + /** + * @return Ad group to duplicate into. Defaults to the ad's own ad group. + */ + @JsonProperty("target_ad_group_id") + public Optional getTargetAdGroupId() { + return targetAdGroupId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DuplicateAdsRequest && equalTo((DuplicateAdsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DuplicateAdsRequest other) { + return count.equals(other.count) + && preserveEngagement.equals(other.preserveEngagement) + && targetAdGroupId.equals(other.targetAdGroupId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.count, this.preserveEngagement, this.targetAdGroupId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional count = Optional.empty(); + + private Optional preserveEngagement = Optional.empty(); + + private Optional targetAdGroupId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DuplicateAdsRequest other) { + count(other.getCount()); + preserveEngagement(other.getPreserveEngagement()); + targetAdGroupId(other.getTargetAdGroupId()); + return this; + } + + /** + *

Number of copies to create (1-10). Defaults to 1.

+ */ + @JsonSetter(value = "count", nulls = Nulls.SKIP) + public Builder count(Optional count) { + this.count = count; + return this; + } + + public Builder count(Integer count) { + this.count = Optional.ofNullable(count); + return this; + } + + /** + *

Whether the copies keep the original post's engagement (likes, comments, shares). Defaults to false.

+ */ + @JsonSetter(value = "preserve_engagement", nulls = Nulls.SKIP) + public Builder preserveEngagement(Optional preserveEngagement) { + this.preserveEngagement = preserveEngagement; + return this; + } + + public Builder preserveEngagement(Boolean preserveEngagement) { + this.preserveEngagement = Optional.ofNullable(preserveEngagement); + return this; + } + + /** + *

Ad group to duplicate into. Defaults to the ad's own ad group.

+ */ + @JsonSetter(value = "target_ad_group_id", nulls = Nulls.SKIP) + public Builder targetAdGroupId(Optional targetAdGroupId) { + this.targetAdGroupId = targetAdGroupId; + return this; + } + + public Builder targetAdGroupId(String targetAdGroupId) { + this.targetAdGroupId = Optional.ofNullable(targetAdGroupId); + return this; + } + + public DuplicateAdsRequest build() { + return new DuplicateAdsRequest(count, preserveEngagement, targetAdGroupId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/requests/ListAdsRequest.java b/src/main/java/com/whop/api/resources/ads/requests/ListAdsRequest.java new file mode 100644 index 00000000..a4a44336 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/requests/ListAdsRequest.java @@ -0,0 +1,708 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.ads.types.ListAdsRequestAttributionModel; +import com.whop.api.resources.ads.types.ListAdsRequestDirection; +import com.whop.api.resources.ads.types.ListAdsRequestOrder; +import com.whop.api.resources.ads.types.ListAdsRequestStatus; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAdsRequest.Builder.class) +public final class ListAdsRequest { + private final Optional> adCampaignIds; + + private final Optional> adGroupIds; + + private final Optional accountId; + + private final Optional adCampaignId; + + private final Optional adGroupId; + + private final Optional status; + + private final Optional query; + + private final Optional order; + + private final Optional direction; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional statsFrom; + + private final Optional statsTo; + + private final Optional timeZone; + + private final Optional attributionModel; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListAdsRequest( + Optional> adCampaignIds, + Optional> adGroupIds, + Optional accountId, + Optional adCampaignId, + Optional adGroupId, + Optional status, + Optional query, + Optional order, + Optional direction, + Optional createdBefore, + Optional createdAfter, + Optional statsFrom, + Optional statsTo, + Optional timeZone, + Optional attributionModel, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.adCampaignIds = adCampaignIds; + this.adGroupIds = adGroupIds; + this.accountId = accountId; + this.adCampaignId = adCampaignId; + this.adGroupId = adGroupId; + this.status = status; + this.query = query; + this.order = order; + this.direction = direction; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.statsFrom = statsFrom; + this.statsTo = statsTo; + this.timeZone = timeZone; + this.attributionModel = attributionModel; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only return ads in these ad campaigns (max 100). Repeat the parameter for each id (ad_campaign_ids=a&ad_campaign_ids=b). + */ + @JsonProperty("ad_campaign_ids") + public Optional> getAdCampaignIds() { + return adCampaignIds; + } + + /** + * @return Only return ads in these ad groups (max 100). Repeat the parameter for each id (ad_group_ids=a&ad_group_ids=b). + */ + @JsonProperty("ad_group_ids") + public Optional> getAdGroupIds() { + return adGroupIds; + } + + /** + * @return The account the ads belong to. Defaults to the account-scoped key's own account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Only return ads in this ad campaign. + */ + @JsonProperty("ad_campaign_id") + public Optional getAdCampaignId() { + return adCampaignId; + } + + /** + * @return Only return ads in this ad group. + */ + @JsonProperty("ad_group_id") + public Optional getAdGroupId() { + return adGroupId; + } + + /** + * @return Only return ads with this status. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Filter ads by a title or ID substring. + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + /** + * @return The field to sort by. Defaults to created_at. Stat columns (spend, impressions, …) rank over the stats_from/stats_to window across the whole list, not just the current page. results, cost_per_result and return_on_ad_spend rank by the same Whop pixel-attributed values the response reports. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return The sort direction. Defaults to desc. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Only return ads created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return ads created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Start of the stats window. Defaults to all-time. + */ + @JsonProperty("stats_from") + public Optional getStatsFrom() { + return statsFrom; + } + + /** + * @return End of the stats window. Defaults to now. + */ + @JsonProperty("stats_to") + public Optional getStatsTo() { + return statsTo; + } + + /** + * @return IANA timezone (e.g. America/New_York) the stats window is interpreted in. Bare stats_from/stats_to dates resolve to day boundaries on this clock. Defaults to UTC. + */ + @JsonProperty("time_zone") + public Optional getTimeZone() { + return timeZone; + } + + /** + * @return Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise. + */ + @JsonProperty("attribution_model") + public Optional getAttributionModel() { + return attributionModel; + } + + /** + * @return The number of ads to return. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to fetch the page after (from page_info.end_cursor). + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of ads to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to fetch the page before (from page_info.start_cursor). + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAdsRequest && equalTo((ListAdsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAdsRequest other) { + return adCampaignIds.equals(other.adCampaignIds) + && adGroupIds.equals(other.adGroupIds) + && accountId.equals(other.accountId) + && adCampaignId.equals(other.adCampaignId) + && adGroupId.equals(other.adGroupId) + && status.equals(other.status) + && query.equals(other.query) + && order.equals(other.order) + && direction.equals(other.direction) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && statsFrom.equals(other.statsFrom) + && statsTo.equals(other.statsTo) + && timeZone.equals(other.timeZone) + && attributionModel.equals(other.attributionModel) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adCampaignIds, + this.adGroupIds, + this.accountId, + this.adCampaignId, + this.adGroupId, + this.status, + this.query, + this.order, + this.direction, + this.createdBefore, + this.createdAfter, + this.statsFrom, + this.statsTo, + this.timeZone, + this.attributionModel, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> adCampaignIds = Optional.empty(); + + private Optional> adGroupIds = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional adCampaignId = Optional.empty(); + + private Optional adGroupId = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional query = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional statsFrom = Optional.empty(); + + private Optional statsTo = Optional.empty(); + + private Optional timeZone = Optional.empty(); + + private Optional attributionModel = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListAdsRequest other) { + adCampaignIds(other.getAdCampaignIds()); + adGroupIds(other.getAdGroupIds()); + accountId(other.getAccountId()); + adCampaignId(other.getAdCampaignId()); + adGroupId(other.getAdGroupId()); + status(other.getStatus()); + query(other.getQuery()); + order(other.getOrder()); + direction(other.getDirection()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + statsFrom(other.getStatsFrom()); + statsTo(other.getStatsTo()); + timeZone(other.getTimeZone()); + attributionModel(other.getAttributionModel()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

Only return ads in these ad campaigns (max 100). Repeat the parameter for each id (ad_campaign_ids=a&ad_campaign_ids=b).

+ */ + @JsonSetter(value = "ad_campaign_ids", nulls = Nulls.SKIP) + public Builder adCampaignIds(Optional> adCampaignIds) { + this.adCampaignIds = adCampaignIds; + return this; + } + + public Builder adCampaignIds(List adCampaignIds) { + this.adCampaignIds = Optional.ofNullable(adCampaignIds); + return this; + } + + public Builder adCampaignIds(String adCampaignIds) { + this.adCampaignIds = Optional.of(Collections.singletonList(adCampaignIds)); + return this; + } + + /** + *

Only return ads in these ad groups (max 100). Repeat the parameter for each id (ad_group_ids=a&ad_group_ids=b).

+ */ + @JsonSetter(value = "ad_group_ids", nulls = Nulls.SKIP) + public Builder adGroupIds(Optional> adGroupIds) { + this.adGroupIds = adGroupIds; + return this; + } + + public Builder adGroupIds(List adGroupIds) { + this.adGroupIds = Optional.ofNullable(adGroupIds); + return this; + } + + public Builder adGroupIds(String adGroupIds) { + this.adGroupIds = Optional.of(Collections.singletonList(adGroupIds)); + return this; + } + + /** + *

The account the ads belong to. Defaults to the account-scoped key's own account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Only return ads in this ad campaign.

+ */ + @JsonSetter(value = "ad_campaign_id", nulls = Nulls.SKIP) + public Builder adCampaignId(Optional adCampaignId) { + this.adCampaignId = adCampaignId; + return this; + } + + public Builder adCampaignId(String adCampaignId) { + this.adCampaignId = Optional.ofNullable(adCampaignId); + return this; + } + + /** + *

Only return ads in this ad group.

+ */ + @JsonSetter(value = "ad_group_id", nulls = Nulls.SKIP) + public Builder adGroupId(Optional adGroupId) { + this.adGroupId = adGroupId; + return this; + } + + public Builder adGroupId(String adGroupId) { + this.adGroupId = Optional.ofNullable(adGroupId); + return this; + } + + /** + *

Only return ads with this status.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListAdsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Filter ads by a title or ID substring.

+ */ + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public Builder query(Optional query) { + this.query = query; + return this; + } + + public Builder query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + /** + *

The field to sort by. Defaults to created_at. Stat columns (spend, impressions, …) rank over the stats_from/stats_to window across the whole list, not just the current page. results, cost_per_result and return_on_ad_spend rank by the same Whop pixel-attributed values the response reports.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListAdsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The sort direction. Defaults to desc.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListAdsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Only return ads created before this timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return ads created after this timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Start of the stats window. Defaults to all-time.

+ */ + @JsonSetter(value = "stats_from", nulls = Nulls.SKIP) + public Builder statsFrom(Optional statsFrom) { + this.statsFrom = statsFrom; + return this; + } + + public Builder statsFrom(String statsFrom) { + this.statsFrom = Optional.ofNullable(statsFrom); + return this; + } + + /** + *

End of the stats window. Defaults to now.

+ */ + @JsonSetter(value = "stats_to", nulls = Nulls.SKIP) + public Builder statsTo(Optional statsTo) { + this.statsTo = statsTo; + return this; + } + + public Builder statsTo(String statsTo) { + this.statsTo = Optional.ofNullable(statsTo); + return this; + } + + /** + *

IANA timezone (e.g. America/New_York) the stats window is interpreted in. Bare stats_from/stats_to dates resolve to day boundaries on this clock. Defaults to UTC.

+ */ + @JsonSetter(value = "time_zone", nulls = Nulls.SKIP) + public Builder timeZone(Optional timeZone) { + this.timeZone = timeZone; + return this; + } + + public Builder timeZone(String timeZone) { + this.timeZone = Optional.ofNullable(timeZone); + return this; + } + + /** + *

Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise.

+ */ + @JsonSetter(value = "attribution_model", nulls = Nulls.SKIP) + public Builder attributionModel(Optional attributionModel) { + this.attributionModel = attributionModel; + return this; + } + + public Builder attributionModel(ListAdsRequestAttributionModel attributionModel) { + this.attributionModel = Optional.ofNullable(attributionModel); + return this; + } + + /** + *

The number of ads to return.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The number of ads to return from the end of the range.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to fetch the page before (from page_info.start_cursor).

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListAdsRequest build() { + return new ListAdsRequest( + adCampaignIds, + adGroupIds, + accountId, + adCampaignId, + adGroupId, + status, + query, + order, + direction, + createdBefore, + createdAfter, + statsFrom, + statsTo, + timeZone, + attributionModel, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/requests/PauseAdsRequest.java b/src/main/java/com/whop/api/resources/ads/requests/PauseAdsRequest.java new file mode 100644 index 00000000..fc9b688f --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/requests/PauseAdsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PauseAdsRequest.Builder.class) +public final class PauseAdsRequest { + private final Map additionalProperties; + + private PauseAdsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PauseAdsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PauseAdsRequest other) { + return this; + } + + public PauseAdsRequest build() { + return new PauseAdsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/requests/RetrieveAdsRequest.java b/src/main/java/com/whop/api/resources/ads/requests/RetrieveAdsRequest.java new file mode 100644 index 00000000..5ea158bd --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/requests/RetrieveAdsRequest.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.ads.types.RetrieveAdsRequestAttributionModel; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveAdsRequest.Builder.class) +public final class RetrieveAdsRequest { + private final Optional statsFrom; + + private final Optional statsTo; + + private final Optional timeZone; + + private final Optional attributionModel; + + private final Map additionalProperties; + + private RetrieveAdsRequest( + Optional statsFrom, + Optional statsTo, + Optional timeZone, + Optional attributionModel, + Map additionalProperties) { + this.statsFrom = statsFrom; + this.statsTo = statsTo; + this.timeZone = timeZone; + this.attributionModel = attributionModel; + this.additionalProperties = additionalProperties; + } + + /** + * @return Start of the stats window. + */ + @JsonProperty("stats_from") + public Optional getStatsFrom() { + return statsFrom; + } + + /** + * @return End of the stats window. + */ + @JsonProperty("stats_to") + public Optional getStatsTo() { + return statsTo; + } + + /** + * @return IANA timezone the stats window is interpreted in. Defaults to UTC. + */ + @JsonProperty("time_zone") + public Optional getTimeZone() { + return timeZone; + } + + /** + * @return Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise. + */ + @JsonProperty("attribution_model") + public Optional getAttributionModel() { + return attributionModel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveAdsRequest && equalTo((RetrieveAdsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveAdsRequest other) { + return statsFrom.equals(other.statsFrom) + && statsTo.equals(other.statsTo) + && timeZone.equals(other.timeZone) + && attributionModel.equals(other.attributionModel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.statsFrom, this.statsTo, this.timeZone, this.attributionModel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional statsFrom = Optional.empty(); + + private Optional statsTo = Optional.empty(); + + private Optional timeZone = Optional.empty(); + + private Optional attributionModel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveAdsRequest other) { + statsFrom(other.getStatsFrom()); + statsTo(other.getStatsTo()); + timeZone(other.getTimeZone()); + attributionModel(other.getAttributionModel()); + return this; + } + + /** + *

Start of the stats window.

+ */ + @JsonSetter(value = "stats_from", nulls = Nulls.SKIP) + public Builder statsFrom(Optional statsFrom) { + this.statsFrom = statsFrom; + return this; + } + + public Builder statsFrom(String statsFrom) { + this.statsFrom = Optional.ofNullable(statsFrom); + return this; + } + + /** + *

End of the stats window.

+ */ + @JsonSetter(value = "stats_to", nulls = Nulls.SKIP) + public Builder statsTo(Optional statsTo) { + this.statsTo = statsTo; + return this; + } + + public Builder statsTo(String statsTo) { + this.statsTo = Optional.ofNullable(statsTo); + return this; + } + + /** + *

IANA timezone the stats window is interpreted in. Defaults to UTC.

+ */ + @JsonSetter(value = "time_zone", nulls = Nulls.SKIP) + public Builder timeZone(Optional timeZone) { + this.timeZone = timeZone; + return this; + } + + public Builder timeZone(String timeZone) { + this.timeZone = Optional.ofNullable(timeZone); + return this; + } + + /** + *

Attribution model the conversion stats count under (defaults to last_touch). Under both models a journey with any whop ad touch attributes to whop; the model picks which whop touch credits the entity and which non-whop source wins otherwise.

+ */ + @JsonSetter(value = "attribution_model", nulls = Nulls.SKIP) + public Builder attributionModel(Optional attributionModel) { + this.attributionModel = attributionModel; + return this; + } + + public Builder attributionModel(RetrieveAdsRequestAttributionModel attributionModel) { + this.attributionModel = Optional.ofNullable(attributionModel); + return this; + } + + public RetrieveAdsRequest build() { + return new RetrieveAdsRequest(statsFrom, statsTo, timeZone, attributionModel, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/requests/UnpauseAdsRequest.java b/src/main/java/com/whop/api/resources/ads/requests/UnpauseAdsRequest.java new file mode 100644 index 00000000..2372d3b9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/requests/UnpauseAdsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UnpauseAdsRequest.Builder.class) +public final class UnpauseAdsRequest { + private final Map additionalProperties; + + private UnpauseAdsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UnpauseAdsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UnpauseAdsRequest other) { + return this; + } + + public UnpauseAdsRequest build() { + return new UnpauseAdsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/requests/UpdateAdsRequest.java b/src/main/java/com/whop/api/resources/ads/requests/UpdateAdsRequest.java new file mode 100644 index 00000000..4f0f8aa3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/requests/UpdateAdsRequest.java @@ -0,0 +1,571 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.ads.types.UpdateAdsRequestCallToAction; +import com.whop.api.resources.ads.types.UpdateAdsRequestCreativesItem; +import com.whop.api.resources.ads.types.UpdateAdsRequestLeadForm; +import com.whop.api.resources.ads.types.UpdateAdsRequestMessagingConfig; +import com.whop.api.resources.ads.types.UpdateAdsRequestPostSource; +import com.whop.api.resources.ads.types.UpdateAdsRequestSocialAccountsItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdsRequest.Builder.class) +public final class UpdateAdsRequest { + private final Optional callToAction; + + private final Optional> creatives; + + private final Optional> descriptions; + + private final Optional> headlines; + + private final Optional leadForm; + + private final Optional leadFormId; + + private final Optional messagingConfig; + + private final Optional multiAdvertiserAds; + + private final Optional postId; + + private final Optional postSource; + + private final Optional> primaryTexts; + + private final Optional> socialAccounts; + + private final Optional title; + + private final Optional url; + + private final Optional> urlParameters; + + private final Map additionalProperties; + + private UpdateAdsRequest( + Optional callToAction, + Optional> creatives, + Optional> descriptions, + Optional> headlines, + Optional leadForm, + Optional leadFormId, + Optional messagingConfig, + Optional multiAdvertiserAds, + Optional postId, + Optional postSource, + Optional> primaryTexts, + Optional> socialAccounts, + Optional title, + Optional url, + Optional> urlParameters, + Map additionalProperties) { + this.callToAction = callToAction; + this.creatives = creatives; + this.descriptions = descriptions; + this.headlines = headlines; + this.leadForm = leadForm; + this.leadFormId = leadFormId; + this.messagingConfig = messagingConfig; + this.multiAdvertiserAds = multiAdvertiserAds; + this.postId = postId; + this.postSource = postSource; + this.primaryTexts = primaryTexts; + this.socialAccounts = socialAccounts; + this.title = title; + this.url = url; + this.urlParameters = urlParameters; + this.additionalProperties = additionalProperties; + } + + /** + * @return The call-to-action button shown on the ad. + */ + @JsonProperty("call_to_action") + public Optional getCallToAction() { + return callToAction; + } + + /** + * @return The ad's creative assets. Each entry is an uploaded file id with an optional format; omit format for the original asset. Replaces a live ad's creative on the platform. Two or more entries with no format replace it with a carousel (2-10 attachments), in order, sharing the ad's copy. + */ + @JsonProperty("creatives") + public Optional> getCreatives() { + return creatives; + } + + /** + * @return The description variants shown on the ad. + */ + @JsonProperty("descriptions") + public Optional> getDescriptions() { + return descriptions; + } + + /** + * @return The headline variants shown on the ad. + */ + @JsonProperty("headlines") + public Optional> getHeadlines() { + return headlines; + } + + /** + * @return Instant lead form for the ad. Only allowed when the ad group's conversion_location is an instant-form destination (instant_forms, instant_forms_and_messenger, website_and_instant_forms). Mutually exclusive with lead_form_id. + */ + @JsonProperty("lead_form") + public Optional getLeadForm() { + return leadForm; + } + + /** + * @return Use an existing instant form instead of creating one — the form's platform ID, from a form already on the ad's Facebook page. Only allowed when the ad group's conversion_location is an instant-form destination. Mutually exclusive with lead_form. Replaces a stored lead_form. + */ + @JsonProperty("lead_form_id") + public Optional getLeadFormId() { + return leadFormId; + } + + /** + * @return Click-to-message welcome copy: the greeting (message) and the ice-breaker prompt (keyword). + */ + @JsonProperty("messaging_config") + public Optional getMessagingConfig() { + return messagingConfig; + } + + /** + * @return Whether the ad can appear alongside other advertisers' ads in the same unit. Defaults to true. + */ + @JsonProperty("multi_advertiser_ads") + public Optional getMultiAdvertiserAds() { + return multiAdvertiserAds; + } + + /** + * @return Promote an existing post instead of uploading creatives — a Facebook post or Instagram media id. Mutually exclusive with creatives. Pair with post_source. + */ + @JsonProperty("post_id") + public Optional getPostId() { + return postId; + } + + /** + * @return Identifies the network that owns post_id. The source is inferred from the ID shape when omitted. + */ + @JsonProperty("post_source") + public Optional getPostSource() { + return postSource; + } + + /** + * @return The primary text variants shown in the ad body. + */ + @JsonProperty("primary_texts") + public Optional> getPrimaryTexts() { + return primaryTexts; + } + + /** + * @return The social accounts the ad runs under — a connected Facebook page and, optionally, an Instagram profile. + */ + @JsonProperty("social_accounts") + public Optional> getSocialAccounts() { + return socialAccounts; + } + + /** + * @return The display name of the ad. + */ + @JsonProperty("title") + public Optional getTitle() { + return title; + } + + /** + * @return The URL the ad links to. Query parameters are merged into url_parameters, so the stored URL is always bare. + */ + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + /** + * @return Query parameters to append to the destination URL, keyed by parameter name. Merged with any query string on url. Whop adds its own click-attribution parameters; those are reserved and rejected if you set them (utm_meta_ad_id, utm_meta_adset_id, utm_meta_campaign_id, utm_source, utm_placement, utm_medium, utm_content, utm_adset, utm_whop, wacid, wasid, waid, tw_source, tw_adid). + */ + @JsonProperty("url_parameters") + public Optional> getUrlParameters() { + return urlParameters; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdsRequest && equalTo((UpdateAdsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdsRequest other) { + return callToAction.equals(other.callToAction) + && creatives.equals(other.creatives) + && descriptions.equals(other.descriptions) + && headlines.equals(other.headlines) + && leadForm.equals(other.leadForm) + && leadFormId.equals(other.leadFormId) + && messagingConfig.equals(other.messagingConfig) + && multiAdvertiserAds.equals(other.multiAdvertiserAds) + && postId.equals(other.postId) + && postSource.equals(other.postSource) + && primaryTexts.equals(other.primaryTexts) + && socialAccounts.equals(other.socialAccounts) + && title.equals(other.title) + && url.equals(other.url) + && urlParameters.equals(other.urlParameters); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.callToAction, + this.creatives, + this.descriptions, + this.headlines, + this.leadForm, + this.leadFormId, + this.messagingConfig, + this.multiAdvertiserAds, + this.postId, + this.postSource, + this.primaryTexts, + this.socialAccounts, + this.title, + this.url, + this.urlParameters); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional callToAction = Optional.empty(); + + private Optional> creatives = Optional.empty(); + + private Optional> descriptions = Optional.empty(); + + private Optional> headlines = Optional.empty(); + + private Optional leadForm = Optional.empty(); + + private Optional leadFormId = Optional.empty(); + + private Optional messagingConfig = Optional.empty(); + + private Optional multiAdvertiserAds = Optional.empty(); + + private Optional postId = Optional.empty(); + + private Optional postSource = Optional.empty(); + + private Optional> primaryTexts = Optional.empty(); + + private Optional> socialAccounts = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional url = Optional.empty(); + + private Optional> urlParameters = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdsRequest other) { + callToAction(other.getCallToAction()); + creatives(other.getCreatives()); + descriptions(other.getDescriptions()); + headlines(other.getHeadlines()); + leadForm(other.getLeadForm()); + leadFormId(other.getLeadFormId()); + messagingConfig(other.getMessagingConfig()); + multiAdvertiserAds(other.getMultiAdvertiserAds()); + postId(other.getPostId()); + postSource(other.getPostSource()); + primaryTexts(other.getPrimaryTexts()); + socialAccounts(other.getSocialAccounts()); + title(other.getTitle()); + url(other.getUrl()); + urlParameters(other.getUrlParameters()); + return this; + } + + /** + *

The call-to-action button shown on the ad.

+ */ + @JsonSetter(value = "call_to_action", nulls = Nulls.SKIP) + public Builder callToAction(Optional callToAction) { + this.callToAction = callToAction; + return this; + } + + public Builder callToAction(UpdateAdsRequestCallToAction callToAction) { + this.callToAction = Optional.ofNullable(callToAction); + return this; + } + + /** + *

The ad's creative assets. Each entry is an uploaded file id with an optional format; omit format for the original asset. Replaces a live ad's creative on the platform. Two or more entries with no format replace it with a carousel (2-10 attachments), in order, sharing the ad's copy.

+ */ + @JsonSetter(value = "creatives", nulls = Nulls.SKIP) + public Builder creatives(Optional> creatives) { + this.creatives = creatives; + return this; + } + + public Builder creatives(List creatives) { + this.creatives = Optional.ofNullable(creatives); + return this; + } + + /** + *

The description variants shown on the ad.

+ */ + @JsonSetter(value = "descriptions", nulls = Nulls.SKIP) + public Builder descriptions(Optional> descriptions) { + this.descriptions = descriptions; + return this; + } + + public Builder descriptions(List descriptions) { + this.descriptions = Optional.ofNullable(descriptions); + return this; + } + + /** + *

The headline variants shown on the ad.

+ */ + @JsonSetter(value = "headlines", nulls = Nulls.SKIP) + public Builder headlines(Optional> headlines) { + this.headlines = headlines; + return this; + } + + public Builder headlines(List headlines) { + this.headlines = Optional.ofNullable(headlines); + return this; + } + + /** + *

Instant lead form for the ad. Only allowed when the ad group's conversion_location is an instant-form destination (instant_forms, instant_forms_and_messenger, website_and_instant_forms). Mutually exclusive with lead_form_id.

+ */ + @JsonSetter(value = "lead_form", nulls = Nulls.SKIP) + public Builder leadForm(Optional leadForm) { + this.leadForm = leadForm; + return this; + } + + public Builder leadForm(UpdateAdsRequestLeadForm leadForm) { + this.leadForm = Optional.ofNullable(leadForm); + return this; + } + + /** + *

Use an existing instant form instead of creating one — the form's platform ID, from a form already on the ad's Facebook page. Only allowed when the ad group's conversion_location is an instant-form destination. Mutually exclusive with lead_form. Replaces a stored lead_form.

+ */ + @JsonSetter(value = "lead_form_id", nulls = Nulls.SKIP) + public Builder leadFormId(Optional leadFormId) { + this.leadFormId = leadFormId; + return this; + } + + public Builder leadFormId(String leadFormId) { + this.leadFormId = Optional.ofNullable(leadFormId); + return this; + } + + /** + *

Click-to-message welcome copy: the greeting (message) and the ice-breaker prompt (keyword).

+ */ + @JsonSetter(value = "messaging_config", nulls = Nulls.SKIP) + public Builder messagingConfig(Optional messagingConfig) { + this.messagingConfig = messagingConfig; + return this; + } + + public Builder messagingConfig(UpdateAdsRequestMessagingConfig messagingConfig) { + this.messagingConfig = Optional.ofNullable(messagingConfig); + return this; + } + + /** + *

Whether the ad can appear alongside other advertisers' ads in the same unit. Defaults to true.

+ */ + @JsonSetter(value = "multi_advertiser_ads", nulls = Nulls.SKIP) + public Builder multiAdvertiserAds(Optional multiAdvertiserAds) { + this.multiAdvertiserAds = multiAdvertiserAds; + return this; + } + + public Builder multiAdvertiserAds(Boolean multiAdvertiserAds) { + this.multiAdvertiserAds = Optional.ofNullable(multiAdvertiserAds); + return this; + } + + /** + *

Promote an existing post instead of uploading creatives — a Facebook post or Instagram media id. Mutually exclusive with creatives. Pair with post_source.

+ */ + @JsonSetter(value = "post_id", nulls = Nulls.SKIP) + public Builder postId(Optional postId) { + this.postId = postId; + return this; + } + + public Builder postId(String postId) { + this.postId = Optional.ofNullable(postId); + return this; + } + + /** + *

Identifies the network that owns post_id. The source is inferred from the ID shape when omitted.

+ */ + @JsonSetter(value = "post_source", nulls = Nulls.SKIP) + public Builder postSource(Optional postSource) { + this.postSource = postSource; + return this; + } + + public Builder postSource(UpdateAdsRequestPostSource postSource) { + this.postSource = Optional.ofNullable(postSource); + return this; + } + + /** + *

The primary text variants shown in the ad body.

+ */ + @JsonSetter(value = "primary_texts", nulls = Nulls.SKIP) + public Builder primaryTexts(Optional> primaryTexts) { + this.primaryTexts = primaryTexts; + return this; + } + + public Builder primaryTexts(List primaryTexts) { + this.primaryTexts = Optional.ofNullable(primaryTexts); + return this; + } + + /** + *

The social accounts the ad runs under — a connected Facebook page and, optionally, an Instagram profile.

+ */ + @JsonSetter(value = "social_accounts", nulls = Nulls.SKIP) + public Builder socialAccounts(Optional> socialAccounts) { + this.socialAccounts = socialAccounts; + return this; + } + + public Builder socialAccounts(List socialAccounts) { + this.socialAccounts = Optional.ofNullable(socialAccounts); + return this; + } + + /** + *

The display name of the ad.

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The URL the ad links to. Query parameters are merged into url_parameters, so the stored URL is always bare.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

Query parameters to append to the destination URL, keyed by parameter name. Merged with any query string on url. Whop adds its own click-attribution parameters; those are reserved and rejected if you set them (utm_meta_ad_id, utm_meta_adset_id, utm_meta_campaign_id, utm_source, utm_placement, utm_medium, utm_content, utm_adset, utm_whop, wacid, wasid, waid, tw_source, tw_adid).

+ */ + @JsonSetter(value = "url_parameters", nulls = Nulls.SKIP) + public Builder urlParameters(Optional> urlParameters) { + this.urlParameters = urlParameters; + return this; + } + + public Builder urlParameters(Map urlParameters) { + this.urlParameters = Optional.ofNullable(urlParameters); + return this; + } + + public UpdateAdsRequest build() { + return new UpdateAdsRequest( + callToAction, + creatives, + descriptions, + headlines, + leadForm, + leadFormId, + messagingConfig, + multiAdvertiserAds, + postId, + postSource, + primaryTexts, + socialAccounts, + title, + url, + urlParameters, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestCallToAction.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestCallToAction.java new file mode 100644 index 00000000..2fd8e259 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestCallToAction.java @@ -0,0 +1,306 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdsRequestCallToAction { + public static final CreateAdsRequestCallToAction BOOK_NOW = + new CreateAdsRequestCallToAction(Value.BOOK_NOW, "book_now"); + + public static final CreateAdsRequestCallToAction REQUEST_TIME = + new CreateAdsRequestCallToAction(Value.REQUEST_TIME, "request_time"); + + public static final CreateAdsRequestCallToAction SIGN_UP = + new CreateAdsRequestCallToAction(Value.SIGN_UP, "sign_up"); + + public static final CreateAdsRequestCallToAction NO_BUTTON = + new CreateAdsRequestCallToAction(Value.NO_BUTTON, "no_button"); + + public static final CreateAdsRequestCallToAction GET_OFFER = + new CreateAdsRequestCallToAction(Value.GET_OFFER, "get_offer"); + + public static final CreateAdsRequestCallToAction OPEN_LINK = + new CreateAdsRequestCallToAction(Value.OPEN_LINK, "open_link"); + + public static final CreateAdsRequestCallToAction SHOP_NOW = + new CreateAdsRequestCallToAction(Value.SHOP_NOW, "shop_now"); + + public static final CreateAdsRequestCallToAction GET_DIRECTIONS = + new CreateAdsRequestCallToAction(Value.GET_DIRECTIONS, "get_directions"); + + public static final CreateAdsRequestCallToAction LISTEN_NOW = + new CreateAdsRequestCallToAction(Value.LISTEN_NOW, "listen_now"); + + public static final CreateAdsRequestCallToAction MESSAGE_PAGE = + new CreateAdsRequestCallToAction(Value.MESSAGE_PAGE, "message_page"); + + public static final CreateAdsRequestCallToAction SEE_DETAILS = + new CreateAdsRequestCallToAction(Value.SEE_DETAILS, "see_details"); + + public static final CreateAdsRequestCallToAction CALL_NOW = + new CreateAdsRequestCallToAction(Value.CALL_NOW, "call_now"); + + public static final CreateAdsRequestCallToAction GET_QUOTE = + new CreateAdsRequestCallToAction(Value.GET_QUOTE, "get_quote"); + + public static final CreateAdsRequestCallToAction ORDER_NOW = + new CreateAdsRequestCallToAction(Value.ORDER_NOW, "order_now"); + + public static final CreateAdsRequestCallToAction SEE_MENU = + new CreateAdsRequestCallToAction(Value.SEE_MENU, "see_menu"); + + public static final CreateAdsRequestCallToAction SUBSCRIBE = + new CreateAdsRequestCallToAction(Value.SUBSCRIBE, "subscribe"); + + public static final CreateAdsRequestCallToAction APPLY_NOW = + new CreateAdsRequestCallToAction(Value.APPLY_NOW, "apply_now"); + + public static final CreateAdsRequestCallToAction LEARN_MORE = + new CreateAdsRequestCallToAction(Value.LEARN_MORE, "learn_more"); + + public static final CreateAdsRequestCallToAction DOWNLOAD = + new CreateAdsRequestCallToAction(Value.DOWNLOAD, "download"); + + public static final CreateAdsRequestCallToAction SEND_UPDATES = + new CreateAdsRequestCallToAction(Value.SEND_UPDATES, "send_updates"); + + public static final CreateAdsRequestCallToAction CONTACT_US = + new CreateAdsRequestCallToAction(Value.CONTACT_US, "contact_us"); + + public static final CreateAdsRequestCallToAction WATCH_MORE = + new CreateAdsRequestCallToAction(Value.WATCH_MORE, "watch_more"); + + private final Value value; + + private final String string; + + CreateAdsRequestCallToAction(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdsRequestCallToAction + && this.string.equals(((CreateAdsRequestCallToAction) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case BOOK_NOW: + return visitor.visitBookNow(); + case REQUEST_TIME: + return visitor.visitRequestTime(); + case SIGN_UP: + return visitor.visitSignUp(); + case NO_BUTTON: + return visitor.visitNoButton(); + case GET_OFFER: + return visitor.visitGetOffer(); + case OPEN_LINK: + return visitor.visitOpenLink(); + case SHOP_NOW: + return visitor.visitShopNow(); + case GET_DIRECTIONS: + return visitor.visitGetDirections(); + case LISTEN_NOW: + return visitor.visitListenNow(); + case MESSAGE_PAGE: + return visitor.visitMessagePage(); + case SEE_DETAILS: + return visitor.visitSeeDetails(); + case CALL_NOW: + return visitor.visitCallNow(); + case GET_QUOTE: + return visitor.visitGetQuote(); + case ORDER_NOW: + return visitor.visitOrderNow(); + case SEE_MENU: + return visitor.visitSeeMenu(); + case SUBSCRIBE: + return visitor.visitSubscribe(); + case APPLY_NOW: + return visitor.visitApplyNow(); + case LEARN_MORE: + return visitor.visitLearnMore(); + case DOWNLOAD: + return visitor.visitDownload(); + case SEND_UPDATES: + return visitor.visitSendUpdates(); + case CONTACT_US: + return visitor.visitContactUs(); + case WATCH_MORE: + return visitor.visitWatchMore(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdsRequestCallToAction valueOf(String value) { + switch (value) { + case "book_now": + return BOOK_NOW; + case "request_time": + return REQUEST_TIME; + case "sign_up": + return SIGN_UP; + case "no_button": + return NO_BUTTON; + case "get_offer": + return GET_OFFER; + case "open_link": + return OPEN_LINK; + case "shop_now": + return SHOP_NOW; + case "get_directions": + return GET_DIRECTIONS; + case "listen_now": + return LISTEN_NOW; + case "message_page": + return MESSAGE_PAGE; + case "see_details": + return SEE_DETAILS; + case "call_now": + return CALL_NOW; + case "get_quote": + return GET_QUOTE; + case "order_now": + return ORDER_NOW; + case "see_menu": + return SEE_MENU; + case "subscribe": + return SUBSCRIBE; + case "apply_now": + return APPLY_NOW; + case "learn_more": + return LEARN_MORE; + case "download": + return DOWNLOAD; + case "send_updates": + return SEND_UPDATES; + case "contact_us": + return CONTACT_US; + case "watch_more": + return WATCH_MORE; + default: + return new CreateAdsRequestCallToAction(Value.UNKNOWN, value); + } + } + + public enum Value { + APPLY_NOW, + + BOOK_NOW, + + CALL_NOW, + + CONTACT_US, + + DOWNLOAD, + + GET_DIRECTIONS, + + GET_OFFER, + + GET_QUOTE, + + LEARN_MORE, + + LISTEN_NOW, + + MESSAGE_PAGE, + + NO_BUTTON, + + OPEN_LINK, + + ORDER_NOW, + + REQUEST_TIME, + + SEE_DETAILS, + + SEE_MENU, + + SEND_UPDATES, + + SHOP_NOW, + + SIGN_UP, + + SUBSCRIBE, + + WATCH_MORE, + + UNKNOWN + } + + public interface Visitor { + T visitApplyNow(); + + T visitBookNow(); + + T visitCallNow(); + + T visitContactUs(); + + T visitDownload(); + + T visitGetDirections(); + + T visitGetOffer(); + + T visitGetQuote(); + + T visitLearnMore(); + + T visitListenNow(); + + T visitMessagePage(); + + T visitNoButton(); + + T visitOpenLink(); + + T visitOrderNow(); + + T visitRequestTime(); + + T visitSeeDetails(); + + T visitSeeMenu(); + + T visitSendUpdates(); + + T visitShopNow(); + + T visitSignUp(); + + T visitSubscribe(); + + T visitWatchMore(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestCreativesItem.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestCreativesItem.java new file mode 100644 index 00000000..40456e72 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestCreativesItem.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdsRequestCreativesItem.Builder.class) +public final class CreateAdsRequestCreativesItem { + private final Optional crop; + + private final Optional format; + + private final Optional id; + + private final Map additionalProperties; + + private CreateAdsRequestCreativesItem( + Optional crop, + Optional format, + Optional id, + Map additionalProperties) { + this.crop = crop; + this.format = format; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The saved crop window for this creative, in source image pixels. Omit it for the original asset or for a format that has not been cropped. + */ + @JsonProperty("crop") + public Optional getCrop() { + return crop; + } + + @JsonProperty("format") + public Optional getFormat() { + return format; + } + + /** + * @return Uploaded file ID, prefixed file_. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdsRequestCreativesItem && equalTo((CreateAdsRequestCreativesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdsRequestCreativesItem other) { + return crop.equals(other.crop) && format.equals(other.format) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.crop, this.format, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional crop = Optional.empty(); + + private Optional format = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAdsRequestCreativesItem other) { + crop(other.getCrop()); + format(other.getFormat()); + id(other.getId()); + return this; + } + + /** + *

The saved crop window for this creative, in source image pixels. Omit it for the original asset or for a format that has not been cropped.

+ */ + @JsonSetter(value = "crop", nulls = Nulls.SKIP) + public Builder crop(Optional crop) { + this.crop = crop; + return this; + } + + public Builder crop(CreateAdsRequestCreativesItemCrop crop) { + this.crop = Optional.ofNullable(crop); + return this; + } + + @JsonSetter(value = "format", nulls = Nulls.SKIP) + public Builder format(Optional format) { + this.format = format; + return this; + } + + public Builder format(CreateAdsRequestCreativesItemFormat format) { + this.format = Optional.ofNullable(format); + return this; + } + + /** + *

Uploaded file ID, prefixed file_.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public CreateAdsRequestCreativesItem build() { + return new CreateAdsRequestCreativesItem(crop, format, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestCreativesItemCrop.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestCreativesItemCrop.java new file mode 100644 index 00000000..6b086c48 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestCreativesItemCrop.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdsRequestCreativesItemCrop.Builder.class) +public final class CreateAdsRequestCreativesItemCrop { + private final Optional height; + + private final Optional width; + + private final Optional x; + + private final Optional y; + + private final Map additionalProperties; + + private CreateAdsRequestCreativesItemCrop( + Optional height, + Optional width, + Optional x, + Optional y, + Map additionalProperties) { + this.height = height; + this.width = width; + this.x = x; + this.y = y; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("height") + public Optional getHeight() { + return height; + } + + @JsonProperty("width") + public Optional getWidth() { + return width; + } + + @JsonProperty("x") + public Optional getX() { + return x; + } + + @JsonProperty("y") + public Optional getY() { + return y; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdsRequestCreativesItemCrop && equalTo((CreateAdsRequestCreativesItemCrop) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdsRequestCreativesItemCrop other) { + return height.equals(other.height) && width.equals(other.width) && x.equals(other.x) && y.equals(other.y); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.height, this.width, this.x, this.y); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional height = Optional.empty(); + + private Optional width = Optional.empty(); + + private Optional x = Optional.empty(); + + private Optional y = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAdsRequestCreativesItemCrop other) { + height(other.getHeight()); + width(other.getWidth()); + x(other.getX()); + y(other.getY()); + return this; + } + + @JsonSetter(value = "height", nulls = Nulls.SKIP) + public Builder height(Optional height) { + this.height = height; + return this; + } + + public Builder height(Double height) { + this.height = Optional.ofNullable(height); + return this; + } + + @JsonSetter(value = "width", nulls = Nulls.SKIP) + public Builder width(Optional width) { + this.width = width; + return this; + } + + public Builder width(Double width) { + this.width = Optional.ofNullable(width); + return this; + } + + @JsonSetter(value = "x", nulls = Nulls.SKIP) + public Builder x(Optional x) { + this.x = x; + return this; + } + + public Builder x(Double x) { + this.x = Optional.ofNullable(x); + return this; + } + + @JsonSetter(value = "y", nulls = Nulls.SKIP) + public Builder y(Optional y) { + this.y = y; + return this; + } + + public Builder y(Double y) { + this.y = Optional.ofNullable(y); + return this; + } + + public CreateAdsRequestCreativesItemCrop build() { + return new CreateAdsRequestCreativesItemCrop(height, width, x, y, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestCreativesItemFormat.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestCreativesItemFormat.java new file mode 100644 index 00000000..d19191ec --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestCreativesItemFormat.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdsRequestCreativesItemFormat { + public static final CreateAdsRequestCreativesItemFormat SQUARE = + new CreateAdsRequestCreativesItemFormat(Value.SQUARE, "square"); + + public static final CreateAdsRequestCreativesItemFormat VERTICAL = + new CreateAdsRequestCreativesItemFormat(Value.VERTICAL, "vertical"); + + public static final CreateAdsRequestCreativesItemFormat HORIZONTAL = + new CreateAdsRequestCreativesItemFormat(Value.HORIZONTAL, "horizontal"); + + private final Value value; + + private final String string; + + CreateAdsRequestCreativesItemFormat(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdsRequestCreativesItemFormat + && this.string.equals(((CreateAdsRequestCreativesItemFormat) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SQUARE: + return visitor.visitSquare(); + case VERTICAL: + return visitor.visitVertical(); + case HORIZONTAL: + return visitor.visitHorizontal(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdsRequestCreativesItemFormat valueOf(String value) { + switch (value) { + case "square": + return SQUARE; + case "vertical": + return VERTICAL; + case "horizontal": + return HORIZONTAL; + default: + return new CreateAdsRequestCreativesItemFormat(Value.UNKNOWN, value); + } + } + + public enum Value { + SQUARE, + + VERTICAL, + + HORIZONTAL, + + UNKNOWN + } + + public interface Visitor { + T visitSquare(); + + T visitVertical(); + + T visitHorizontal(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadForm.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadForm.java new file mode 100644 index 00000000..b7d39bc3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadForm.java @@ -0,0 +1,341 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdsRequestLeadForm.Builder.class) +public final class CreateAdsRequestLeadForm { + private final Optional completion; + + private final Optional disclaimer; + + private final Optional formType; + + private final Optional intro; + + private final Optional name; + + private final Optional phoneVerification; + + private final Optional privacyPolicy; + + private final Optional> questions; + + private final Map additionalProperties; + + private CreateAdsRequestLeadForm( + Optional completion, + Optional disclaimer, + Optional formType, + Optional intro, + Optional name, + Optional phoneVerification, + Optional privacyPolicy, + Optional> questions, + Map additionalProperties) { + this.completion = completion; + this.disclaimer = disclaimer; + this.formType = formType; + this.intro = intro; + this.name = name; + this.phoneVerification = phoneVerification; + this.privacyPolicy = privacyPolicy; + this.questions = questions; + this.additionalProperties = additionalProperties; + } + + /** + * @return Optional completion screen shown after submission; url sets the follow-up website button. + */ + @JsonProperty("completion") + public Optional getCompletion() { + return completion; + } + + /** + * @return Optional custom consent disclaimer with checkboxes. + */ + @JsonProperty("disclaimer") + public Optional getDisclaimer() { + return disclaimer; + } + + /** + * @return more_volume (default) is quickest to submit; higher_intent adds a confirmation step. + */ + @JsonProperty("form_type") + public Optional getFormType() { + return formType; + } + + /** + * @return Optional intro screen shown before the questions. + */ + @JsonProperty("intro") + public Optional getIntro() { + return intro; + } + + /** + * @return Internal name for the form. Auto-generated if omitted. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Require SMS verification of the phone number (higher_intent forms). + */ + @JsonProperty("phone_verification") + public Optional getPhoneVerification() { + return phoneVerification; + } + + /** + * @return Your privacy policy. url is required by the ad platform. + */ + @JsonProperty("privacy_policy") + public Optional getPrivacyPolicy() { + return privacyPolicy; + } + + /** + * @return The questions on the form. Standard prefill types need only a type; a custom question needs a label and a format (plus options for multiple_choice). Options carry an optional key and answer-routing logic. + */ + @JsonProperty("questions") + public Optional> getQuestions() { + return questions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdsRequestLeadForm && equalTo((CreateAdsRequestLeadForm) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdsRequestLeadForm other) { + return completion.equals(other.completion) + && disclaimer.equals(other.disclaimer) + && formType.equals(other.formType) + && intro.equals(other.intro) + && name.equals(other.name) + && phoneVerification.equals(other.phoneVerification) + && privacyPolicy.equals(other.privacyPolicy) + && questions.equals(other.questions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.completion, + this.disclaimer, + this.formType, + this.intro, + this.name, + this.phoneVerification, + this.privacyPolicy, + this.questions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional completion = Optional.empty(); + + private Optional disclaimer = Optional.empty(); + + private Optional formType = Optional.empty(); + + private Optional intro = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional phoneVerification = Optional.empty(); + + private Optional privacyPolicy = Optional.empty(); + + private Optional> questions = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAdsRequestLeadForm other) { + completion(other.getCompletion()); + disclaimer(other.getDisclaimer()); + formType(other.getFormType()); + intro(other.getIntro()); + name(other.getName()); + phoneVerification(other.getPhoneVerification()); + privacyPolicy(other.getPrivacyPolicy()); + questions(other.getQuestions()); + return this; + } + + /** + *

Optional completion screen shown after submission; url sets the follow-up website button.

+ */ + @JsonSetter(value = "completion", nulls = Nulls.SKIP) + public Builder completion(Optional completion) { + this.completion = completion; + return this; + } + + public Builder completion(CreateAdsRequestLeadFormCompletion completion) { + this.completion = Optional.ofNullable(completion); + return this; + } + + /** + *

Optional custom consent disclaimer with checkboxes.

+ */ + @JsonSetter(value = "disclaimer", nulls = Nulls.SKIP) + public Builder disclaimer(Optional disclaimer) { + this.disclaimer = disclaimer; + return this; + } + + public Builder disclaimer(CreateAdsRequestLeadFormDisclaimer disclaimer) { + this.disclaimer = Optional.ofNullable(disclaimer); + return this; + } + + /** + *

more_volume (default) is quickest to submit; higher_intent adds a confirmation step.

+ */ + @JsonSetter(value = "form_type", nulls = Nulls.SKIP) + public Builder formType(Optional formType) { + this.formType = formType; + return this; + } + + public Builder formType(CreateAdsRequestLeadFormFormType formType) { + this.formType = Optional.ofNullable(formType); + return this; + } + + /** + *

Optional intro screen shown before the questions.

+ */ + @JsonSetter(value = "intro", nulls = Nulls.SKIP) + public Builder intro(Optional intro) { + this.intro = intro; + return this; + } + + public Builder intro(CreateAdsRequestLeadFormIntro intro) { + this.intro = Optional.ofNullable(intro); + return this; + } + + /** + *

Internal name for the form. Auto-generated if omitted.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Require SMS verification of the phone number (higher_intent forms).

+ */ + @JsonSetter(value = "phone_verification", nulls = Nulls.SKIP) + public Builder phoneVerification(Optional phoneVerification) { + this.phoneVerification = phoneVerification; + return this; + } + + public Builder phoneVerification(Boolean phoneVerification) { + this.phoneVerification = Optional.ofNullable(phoneVerification); + return this; + } + + /** + *

Your privacy policy. url is required by the ad platform.

+ */ + @JsonSetter(value = "privacy_policy", nulls = Nulls.SKIP) + public Builder privacyPolicy(Optional privacyPolicy) { + this.privacyPolicy = privacyPolicy; + return this; + } + + public Builder privacyPolicy(CreateAdsRequestLeadFormPrivacyPolicy privacyPolicy) { + this.privacyPolicy = Optional.ofNullable(privacyPolicy); + return this; + } + + /** + *

The questions on the form. Standard prefill types need only a type; a custom question needs a label and a format (plus options for multiple_choice). Options carry an optional key and answer-routing logic.

+ */ + @JsonSetter(value = "questions", nulls = Nulls.SKIP) + public Builder questions(Optional> questions) { + this.questions = questions; + return this; + } + + public Builder questions(List questions) { + this.questions = Optional.ofNullable(questions); + return this; + } + + public CreateAdsRequestLeadForm build() { + return new CreateAdsRequestLeadForm( + completion, + disclaimer, + formType, + intro, + name, + phoneVerification, + privacyPolicy, + questions, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormCompletion.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormCompletion.java new file mode 100644 index 00000000..71893c52 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormCompletion.java @@ -0,0 +1,180 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdsRequestLeadFormCompletion.Builder.class) +public final class CreateAdsRequestLeadFormCompletion { + private final Optional buttonText; + + private final Optional description; + + private final Optional headline; + + private final Optional url; + + private final Map additionalProperties; + + private CreateAdsRequestLeadFormCompletion( + Optional buttonText, + Optional description, + Optional headline, + Optional url, + Map additionalProperties) { + this.buttonText = buttonText; + this.description = description; + this.headline = headline; + this.url = url; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("button_text") + public Optional getButtonText() { + return buttonText; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("headline") + public Optional getHeadline() { + return headline; + } + + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdsRequestLeadFormCompletion + && equalTo((CreateAdsRequestLeadFormCompletion) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdsRequestLeadFormCompletion other) { + return buttonText.equals(other.buttonText) + && description.equals(other.description) + && headline.equals(other.headline) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.buttonText, this.description, this.headline, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional buttonText = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional headline = Optional.empty(); + + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAdsRequestLeadFormCompletion other) { + buttonText(other.getButtonText()); + description(other.getDescription()); + headline(other.getHeadline()); + url(other.getUrl()); + return this; + } + + @JsonSetter(value = "button_text", nulls = Nulls.SKIP) + public Builder buttonText(Optional buttonText) { + this.buttonText = buttonText; + return this; + } + + public Builder buttonText(String buttonText) { + this.buttonText = Optional.ofNullable(buttonText); + return this; + } + + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @JsonSetter(value = "headline", nulls = Nulls.SKIP) + public Builder headline(Optional headline) { + this.headline = headline; + return this; + } + + public Builder headline(String headline) { + this.headline = Optional.ofNullable(headline); + return this; + } + + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public CreateAdsRequestLeadFormCompletion build() { + return new CreateAdsRequestLeadFormCompletion(buttonText, description, headline, url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormDisclaimer.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormDisclaimer.java new file mode 100644 index 00000000..73cdda55 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormDisclaimer.java @@ -0,0 +1,155 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdsRequestLeadFormDisclaimer.Builder.class) +public final class CreateAdsRequestLeadFormDisclaimer { + private final Optional body; + + private final Optional> checkboxes; + + private final Optional title; + + private final Map additionalProperties; + + private CreateAdsRequestLeadFormDisclaimer( + Optional body, + Optional> checkboxes, + Optional title, + Map additionalProperties) { + this.body = body; + this.checkboxes = checkboxes; + this.title = title; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("body") + public Optional getBody() { + return body; + } + + @JsonProperty("checkboxes") + public Optional> getCheckboxes() { + return checkboxes; + } + + @JsonProperty("title") + public Optional getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdsRequestLeadFormDisclaimer + && equalTo((CreateAdsRequestLeadFormDisclaimer) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdsRequestLeadFormDisclaimer other) { + return body.equals(other.body) && checkboxes.equals(other.checkboxes) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.body, this.checkboxes, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional body = Optional.empty(); + + private Optional> checkboxes = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAdsRequestLeadFormDisclaimer other) { + body(other.getBody()); + checkboxes(other.getCheckboxes()); + title(other.getTitle()); + return this; + } + + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public Builder body(Optional body) { + this.body = body; + return this; + } + + public Builder body(String body) { + this.body = Optional.ofNullable(body); + return this; + } + + @JsonSetter(value = "checkboxes", nulls = Nulls.SKIP) + public Builder checkboxes(Optional> checkboxes) { + this.checkboxes = checkboxes; + return this; + } + + public Builder checkboxes(List checkboxes) { + this.checkboxes = Optional.ofNullable(checkboxes); + return this; + } + + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public CreateAdsRequestLeadFormDisclaimer build() { + return new CreateAdsRequestLeadFormDisclaimer(body, checkboxes, title, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormDisclaimerCheckboxesItem.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormDisclaimerCheckboxesItem.java new file mode 100644 index 00000000..30a01392 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormDisclaimerCheckboxesItem.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdsRequestLeadFormDisclaimerCheckboxesItem.Builder.class) +public final class CreateAdsRequestLeadFormDisclaimerCheckboxesItem { + private final Optional checkedByDefault; + + private final Optional key; + + private final Optional required; + + private final Optional text; + + private final Map additionalProperties; + + private CreateAdsRequestLeadFormDisclaimerCheckboxesItem( + Optional checkedByDefault, + Optional key, + Optional required, + Optional text, + Map additionalProperties) { + this.checkedByDefault = checkedByDefault; + this.key = key; + this.required = required; + this.text = text; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("checked_by_default") + public Optional getCheckedByDefault() { + return checkedByDefault; + } + + @JsonProperty("key") + public Optional getKey() { + return key; + } + + @JsonProperty("required") + public Optional getRequired() { + return required; + } + + @JsonProperty("text") + public Optional getText() { + return text; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdsRequestLeadFormDisclaimerCheckboxesItem + && equalTo((CreateAdsRequestLeadFormDisclaimerCheckboxesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdsRequestLeadFormDisclaimerCheckboxesItem other) { + return checkedByDefault.equals(other.checkedByDefault) + && key.equals(other.key) + && required.equals(other.required) + && text.equals(other.text); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.checkedByDefault, this.key, this.required, this.text); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional checkedByDefault = Optional.empty(); + + private Optional key = Optional.empty(); + + private Optional required = Optional.empty(); + + private Optional text = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAdsRequestLeadFormDisclaimerCheckboxesItem other) { + checkedByDefault(other.getCheckedByDefault()); + key(other.getKey()); + required(other.getRequired()); + text(other.getText()); + return this; + } + + @JsonSetter(value = "checked_by_default", nulls = Nulls.SKIP) + public Builder checkedByDefault(Optional checkedByDefault) { + this.checkedByDefault = checkedByDefault; + return this; + } + + public Builder checkedByDefault(Boolean checkedByDefault) { + this.checkedByDefault = Optional.ofNullable(checkedByDefault); + return this; + } + + @JsonSetter(value = "key", nulls = Nulls.SKIP) + public Builder key(Optional key) { + this.key = key; + return this; + } + + public Builder key(String key) { + this.key = Optional.ofNullable(key); + return this; + } + + @JsonSetter(value = "required", nulls = Nulls.SKIP) + public Builder required(Optional required) { + this.required = required; + return this; + } + + public Builder required(Boolean required) { + this.required = Optional.ofNullable(required); + return this; + } + + @JsonSetter(value = "text", nulls = Nulls.SKIP) + public Builder text(Optional text) { + this.text = text; + return this; + } + + public Builder text(String text) { + this.text = Optional.ofNullable(text); + return this; + } + + public CreateAdsRequestLeadFormDisclaimerCheckboxesItem build() { + return new CreateAdsRequestLeadFormDisclaimerCheckboxesItem( + checkedByDefault, key, required, text, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormFormType.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormFormType.java new file mode 100644 index 00000000..98b0515d --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormFormType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdsRequestLeadFormFormType { + public static final CreateAdsRequestLeadFormFormType HIGHER_INTENT = + new CreateAdsRequestLeadFormFormType(Value.HIGHER_INTENT, "higher_intent"); + + public static final CreateAdsRequestLeadFormFormType MORE_VOLUME = + new CreateAdsRequestLeadFormFormType(Value.MORE_VOLUME, "more_volume"); + + private final Value value; + + private final String string; + + CreateAdsRequestLeadFormFormType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdsRequestLeadFormFormType + && this.string.equals(((CreateAdsRequestLeadFormFormType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HIGHER_INTENT: + return visitor.visitHigherIntent(); + case MORE_VOLUME: + return visitor.visitMoreVolume(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdsRequestLeadFormFormType valueOf(String value) { + switch (value) { + case "higher_intent": + return HIGHER_INTENT; + case "more_volume": + return MORE_VOLUME; + default: + return new CreateAdsRequestLeadFormFormType(Value.UNKNOWN, value); + } + } + + public enum Value { + MORE_VOLUME, + + HIGHER_INTENT, + + UNKNOWN + } + + public interface Visitor { + T visitMoreVolume(); + + T visitHigherIntent(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormIntro.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormIntro.java new file mode 100644 index 00000000..2be9d334 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormIntro.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdsRequestLeadFormIntro.Builder.class) +public final class CreateAdsRequestLeadFormIntro { + private final Optional description; + + private final Optional headline; + + private final Map additionalProperties; + + private CreateAdsRequestLeadFormIntro( + Optional description, Optional headline, Map additionalProperties) { + this.description = description; + this.headline = headline; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("headline") + public Optional getHeadline() { + return headline; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdsRequestLeadFormIntro && equalTo((CreateAdsRequestLeadFormIntro) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdsRequestLeadFormIntro other) { + return description.equals(other.description) && headline.equals(other.headline); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.description, this.headline); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional description = Optional.empty(); + + private Optional headline = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAdsRequestLeadFormIntro other) { + description(other.getDescription()); + headline(other.getHeadline()); + return this; + } + + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @JsonSetter(value = "headline", nulls = Nulls.SKIP) + public Builder headline(Optional headline) { + this.headline = headline; + return this; + } + + public Builder headline(String headline) { + this.headline = Optional.ofNullable(headline); + return this; + } + + public CreateAdsRequestLeadFormIntro build() { + return new CreateAdsRequestLeadFormIntro(description, headline, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormPrivacyPolicy.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormPrivacyPolicy.java new file mode 100644 index 00000000..1980e3c8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormPrivacyPolicy.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdsRequestLeadFormPrivacyPolicy.Builder.class) +public final class CreateAdsRequestLeadFormPrivacyPolicy { + private final Optional linkText; + + private final Optional url; + + private final Map additionalProperties; + + private CreateAdsRequestLeadFormPrivacyPolicy( + Optional linkText, Optional url, Map additionalProperties) { + this.linkText = linkText; + this.url = url; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("link_text") + public Optional getLinkText() { + return linkText; + } + + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdsRequestLeadFormPrivacyPolicy + && equalTo((CreateAdsRequestLeadFormPrivacyPolicy) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdsRequestLeadFormPrivacyPolicy other) { + return linkText.equals(other.linkText) && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.linkText, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional linkText = Optional.empty(); + + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAdsRequestLeadFormPrivacyPolicy other) { + linkText(other.getLinkText()); + url(other.getUrl()); + return this; + } + + @JsonSetter(value = "link_text", nulls = Nulls.SKIP) + public Builder linkText(Optional linkText) { + this.linkText = linkText; + return this; + } + + public Builder linkText(String linkText) { + this.linkText = Optional.ofNullable(linkText); + return this; + } + + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public CreateAdsRequestLeadFormPrivacyPolicy build() { + return new CreateAdsRequestLeadFormPrivacyPolicy(linkText, url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItem.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItem.java new file mode 100644 index 00000000..60a75d7a --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItem.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdsRequestLeadFormQuestionsItem.Builder.class) +public final class CreateAdsRequestLeadFormQuestionsItem { + private final Optional format; + + private final Optional label; + + private final Optional> options; + + private final Optional type; + + private final Map additionalProperties; + + private CreateAdsRequestLeadFormQuestionsItem( + Optional format, + Optional label, + Optional> options, + Optional type, + Map additionalProperties) { + this.format = format; + this.label = label; + this.options = options; + this.type = type; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("format") + public Optional getFormat() { + return format; + } + + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdsRequestLeadFormQuestionsItem + && equalTo((CreateAdsRequestLeadFormQuestionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdsRequestLeadFormQuestionsItem other) { + return format.equals(other.format) + && label.equals(other.label) + && options.equals(other.options) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.format, this.label, this.options, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional format = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional> options = Optional.empty(); + + private Optional type = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAdsRequestLeadFormQuestionsItem other) { + format(other.getFormat()); + label(other.getLabel()); + options(other.getOptions()); + type(other.getType()); + return this; + } + + @JsonSetter(value = "format", nulls = Nulls.SKIP) + public Builder format(Optional format) { + this.format = format; + return this; + } + + public Builder format(CreateAdsRequestLeadFormQuestionsItemFormat format) { + this.format = Optional.ofNullable(format); + return this; + } + + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public Builder options(Optional> options) { + this.options = options; + return this; + } + + public Builder options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(CreateAdsRequestLeadFormQuestionsItemType type) { + this.type = Optional.ofNullable(type); + return this; + } + + public CreateAdsRequestLeadFormQuestionsItem build() { + return new CreateAdsRequestLeadFormQuestionsItem(format, label, options, type, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItemFormat.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItemFormat.java new file mode 100644 index 00000000..4f4b2bda --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItemFormat.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdsRequestLeadFormQuestionsItemFormat { + public static final CreateAdsRequestLeadFormQuestionsItemFormat APPOINTMENT = + new CreateAdsRequestLeadFormQuestionsItemFormat(Value.APPOINTMENT, "appointment"); + + public static final CreateAdsRequestLeadFormQuestionsItemFormat SHORT_ANSWER = + new CreateAdsRequestLeadFormQuestionsItemFormat(Value.SHORT_ANSWER, "short_answer"); + + public static final CreateAdsRequestLeadFormQuestionsItemFormat MULTIPLE_CHOICE = + new CreateAdsRequestLeadFormQuestionsItemFormat(Value.MULTIPLE_CHOICE, "multiple_choice"); + + private final Value value; + + private final String string; + + CreateAdsRequestLeadFormQuestionsItemFormat(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdsRequestLeadFormQuestionsItemFormat + && this.string.equals(((CreateAdsRequestLeadFormQuestionsItemFormat) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPOINTMENT: + return visitor.visitAppointment(); + case SHORT_ANSWER: + return visitor.visitShortAnswer(); + case MULTIPLE_CHOICE: + return visitor.visitMultipleChoice(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdsRequestLeadFormQuestionsItemFormat valueOf(String value) { + switch (value) { + case "appointment": + return APPOINTMENT; + case "short_answer": + return SHORT_ANSWER; + case "multiple_choice": + return MULTIPLE_CHOICE; + default: + return new CreateAdsRequestLeadFormQuestionsItemFormat(Value.UNKNOWN, value); + } + } + + public enum Value { + SHORT_ANSWER, + + MULTIPLE_CHOICE, + + APPOINTMENT, + + UNKNOWN + } + + public interface Visitor { + T visitShortAnswer(); + + T visitMultipleChoice(); + + T visitAppointment(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItemOptionsItem.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItemOptionsItem.java new file mode 100644 index 00000000..a60f7411 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItemOptionsItem.java @@ -0,0 +1,154 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdsRequestLeadFormQuestionsItemOptionsItem.Builder.class) +public final class CreateAdsRequestLeadFormQuestionsItemOptionsItem { + private final Optional key; + + private final Optional logic; + + private final Optional value; + + private final Map additionalProperties; + + private CreateAdsRequestLeadFormQuestionsItemOptionsItem( + Optional key, + Optional logic, + Optional value, + Map additionalProperties) { + this.key = key; + this.logic = logic; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("key") + public Optional getKey() { + return key; + } + + @JsonProperty("logic") + public Optional getLogic() { + return logic; + } + + @JsonProperty("value") + public Optional getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdsRequestLeadFormQuestionsItemOptionsItem + && equalTo((CreateAdsRequestLeadFormQuestionsItemOptionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdsRequestLeadFormQuestionsItemOptionsItem other) { + return key.equals(other.key) && logic.equals(other.logic) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.key, this.logic, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional key = Optional.empty(); + + private Optional logic = Optional.empty(); + + private Optional value = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAdsRequestLeadFormQuestionsItemOptionsItem other) { + key(other.getKey()); + logic(other.getLogic()); + value(other.getValue()); + return this; + } + + @JsonSetter(value = "key", nulls = Nulls.SKIP) + public Builder key(Optional key) { + this.key = key; + return this; + } + + public Builder key(String key) { + this.key = Optional.ofNullable(key); + return this; + } + + @JsonSetter(value = "logic", nulls = Nulls.SKIP) + public Builder logic(Optional logic) { + this.logic = logic; + return this; + } + + public Builder logic(CreateAdsRequestLeadFormQuestionsItemOptionsItemLogic logic) { + this.logic = Optional.ofNullable(logic); + return this; + } + + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public Builder value(Optional value) { + this.value = value; + return this; + } + + public Builder value(String value) { + this.value = Optional.ofNullable(value); + return this; + } + + public CreateAdsRequestLeadFormQuestionsItemOptionsItem build() { + return new CreateAdsRequestLeadFormQuestionsItemOptionsItem(key, logic, value, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItemOptionsItemLogic.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItemOptionsItemLogic.java new file mode 100644 index 00000000..09f1cf8a --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItemOptionsItemLogic.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdsRequestLeadFormQuestionsItemOptionsItemLogic.Builder.class) +public final class CreateAdsRequestLeadFormQuestionsItemOptionsItemLogic { + private final Optional action; + + private final Optional targetEndPageIndex; + + private final Optional targetQuestionIndex; + + private final Map additionalProperties; + + private CreateAdsRequestLeadFormQuestionsItemOptionsItemLogic( + Optional action, + Optional targetEndPageIndex, + Optional targetQuestionIndex, + Map additionalProperties) { + this.action = action; + this.targetEndPageIndex = targetEndPageIndex; + this.targetQuestionIndex = targetQuestionIndex; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("action") + public Optional getAction() { + return action; + } + + @JsonProperty("target_end_page_index") + public Optional getTargetEndPageIndex() { + return targetEndPageIndex; + } + + @JsonProperty("target_question_index") + public Optional getTargetQuestionIndex() { + return targetQuestionIndex; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdsRequestLeadFormQuestionsItemOptionsItemLogic + && equalTo((CreateAdsRequestLeadFormQuestionsItemOptionsItemLogic) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdsRequestLeadFormQuestionsItemOptionsItemLogic other) { + return action.equals(other.action) + && targetEndPageIndex.equals(other.targetEndPageIndex) + && targetQuestionIndex.equals(other.targetQuestionIndex); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.action, this.targetEndPageIndex, this.targetQuestionIndex); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional action = Optional.empty(); + + private Optional targetEndPageIndex = Optional.empty(); + + private Optional targetQuestionIndex = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAdsRequestLeadFormQuestionsItemOptionsItemLogic other) { + action(other.getAction()); + targetEndPageIndex(other.getTargetEndPageIndex()); + targetQuestionIndex(other.getTargetQuestionIndex()); + return this; + } + + @JsonSetter(value = "action", nulls = Nulls.SKIP) + public Builder action(Optional action) { + this.action = action; + return this; + } + + public Builder action(CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction action) { + this.action = Optional.ofNullable(action); + return this; + } + + @JsonSetter(value = "target_end_page_index", nulls = Nulls.SKIP) + public Builder targetEndPageIndex(Optional targetEndPageIndex) { + this.targetEndPageIndex = targetEndPageIndex; + return this; + } + + public Builder targetEndPageIndex(Integer targetEndPageIndex) { + this.targetEndPageIndex = Optional.ofNullable(targetEndPageIndex); + return this; + } + + @JsonSetter(value = "target_question_index", nulls = Nulls.SKIP) + public Builder targetQuestionIndex(Optional targetQuestionIndex) { + this.targetQuestionIndex = targetQuestionIndex; + return this; + } + + public Builder targetQuestionIndex(Integer targetQuestionIndex) { + this.targetQuestionIndex = Optional.ofNullable(targetQuestionIndex); + return this; + } + + public CreateAdsRequestLeadFormQuestionsItemOptionsItemLogic build() { + return new CreateAdsRequestLeadFormQuestionsItemOptionsItemLogic( + action, targetEndPageIndex, targetQuestionIndex, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction.java new file mode 100644 index 00000000..8f52911b --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction.java @@ -0,0 +1,98 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction { + public static final CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction GO_TO_QUESTION = + new CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction(Value.GO_TO_QUESTION, "go_to_question"); + + public static final CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction CLOSE_FORM = + new CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction(Value.CLOSE_FORM, "close_form"); + + public static final CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction SUBMIT_FORM = + new CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction(Value.SUBMIT_FORM, "submit_form"); + + private final Value value; + + private final String string; + + CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction + && this.string.equals( + ((CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case GO_TO_QUESTION: + return visitor.visitGoToQuestion(); + case CLOSE_FORM: + return visitor.visitCloseForm(); + case SUBMIT_FORM: + return visitor.visitSubmitForm(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction valueOf(String value) { + switch (value) { + case "go_to_question": + return GO_TO_QUESTION; + case "close_form": + return CLOSE_FORM; + case "submit_form": + return SUBMIT_FORM; + default: + return new CreateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction(Value.UNKNOWN, value); + } + } + + public enum Value { + GO_TO_QUESTION, + + SUBMIT_FORM, + + CLOSE_FORM, + + UNKNOWN + } + + public interface Visitor { + T visitGoToQuestion(); + + T visitSubmitForm(); + + T visitCloseForm(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItemType.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItemType.java new file mode 100644 index 00000000..24a1e9a2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestLeadFormQuestionsItemType.java @@ -0,0 +1,295 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdsRequestLeadFormQuestionsItemType { + public static final CreateAdsRequestLeadFormQuestionsItemType GENDER = + new CreateAdsRequestLeadFormQuestionsItemType(Value.GENDER, "gender"); + + public static final CreateAdsRequestLeadFormQuestionsItemType STREET_ADDRESS = + new CreateAdsRequestLeadFormQuestionsItemType(Value.STREET_ADDRESS, "street_address"); + + public static final CreateAdsRequestLeadFormQuestionsItemType LAST_NAME = + new CreateAdsRequestLeadFormQuestionsItemType(Value.LAST_NAME, "last_name"); + + public static final CreateAdsRequestLeadFormQuestionsItemType COUNTRY = + new CreateAdsRequestLeadFormQuestionsItemType(Value.COUNTRY, "country"); + + public static final CreateAdsRequestLeadFormQuestionsItemType WORK_PHONE_NUMBER = + new CreateAdsRequestLeadFormQuestionsItemType(Value.WORK_PHONE_NUMBER, "work_phone_number"); + + public static final CreateAdsRequestLeadFormQuestionsItemType PHONE = + new CreateAdsRequestLeadFormQuestionsItemType(Value.PHONE, "phone"); + + public static final CreateAdsRequestLeadFormQuestionsItemType MILITARY_STATUS = + new CreateAdsRequestLeadFormQuestionsItemType(Value.MILITARY_STATUS, "military_status"); + + public static final CreateAdsRequestLeadFormQuestionsItemType ZIP = + new CreateAdsRequestLeadFormQuestionsItemType(Value.ZIP, "zip"); + + public static final CreateAdsRequestLeadFormQuestionsItemType DOB = + new CreateAdsRequestLeadFormQuestionsItemType(Value.DOB, "dob"); + + public static final CreateAdsRequestLeadFormQuestionsItemType DATE_TIME = + new CreateAdsRequestLeadFormQuestionsItemType(Value.DATE_TIME, "date_time"); + + public static final CreateAdsRequestLeadFormQuestionsItemType FULL_NAME = + new CreateAdsRequestLeadFormQuestionsItemType(Value.FULL_NAME, "full_name"); + + public static final CreateAdsRequestLeadFormQuestionsItemType FIRST_NAME = + new CreateAdsRequestLeadFormQuestionsItemType(Value.FIRST_NAME, "first_name"); + + public static final CreateAdsRequestLeadFormQuestionsItemType COMPANY_NAME = + new CreateAdsRequestLeadFormQuestionsItemType(Value.COMPANY_NAME, "company_name"); + + public static final CreateAdsRequestLeadFormQuestionsItemType EMAIL = + new CreateAdsRequestLeadFormQuestionsItemType(Value.EMAIL, "email"); + + public static final CreateAdsRequestLeadFormQuestionsItemType WORK_EMAIL = + new CreateAdsRequestLeadFormQuestionsItemType(Value.WORK_EMAIL, "work_email"); + + public static final CreateAdsRequestLeadFormQuestionsItemType MARITAL_STATUS = + new CreateAdsRequestLeadFormQuestionsItemType(Value.MARITAL_STATUS, "marital_status"); + + public static final CreateAdsRequestLeadFormQuestionsItemType CITY = + new CreateAdsRequestLeadFormQuestionsItemType(Value.CITY, "city"); + + public static final CreateAdsRequestLeadFormQuestionsItemType RELATIONSHIP_STATUS = + new CreateAdsRequestLeadFormQuestionsItemType(Value.RELATIONSHIP_STATUS, "relationship_status"); + + public static final CreateAdsRequestLeadFormQuestionsItemType CUSTOM = + new CreateAdsRequestLeadFormQuestionsItemType(Value.CUSTOM, "custom"); + + public static final CreateAdsRequestLeadFormQuestionsItemType JOB_TITLE = + new CreateAdsRequestLeadFormQuestionsItemType(Value.JOB_TITLE, "job_title"); + + public static final CreateAdsRequestLeadFormQuestionsItemType STATE = + new CreateAdsRequestLeadFormQuestionsItemType(Value.STATE, "state"); + + private final Value value; + + private final String string; + + CreateAdsRequestLeadFormQuestionsItemType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdsRequestLeadFormQuestionsItemType + && this.string.equals(((CreateAdsRequestLeadFormQuestionsItemType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case GENDER: + return visitor.visitGender(); + case STREET_ADDRESS: + return visitor.visitStreetAddress(); + case LAST_NAME: + return visitor.visitLastName(); + case COUNTRY: + return visitor.visitCountry(); + case WORK_PHONE_NUMBER: + return visitor.visitWorkPhoneNumber(); + case PHONE: + return visitor.visitPhone(); + case MILITARY_STATUS: + return visitor.visitMilitaryStatus(); + case ZIP: + return visitor.visitZip(); + case DOB: + return visitor.visitDob(); + case DATE_TIME: + return visitor.visitDateTime(); + case FULL_NAME: + return visitor.visitFullName(); + case FIRST_NAME: + return visitor.visitFirstName(); + case COMPANY_NAME: + return visitor.visitCompanyName(); + case EMAIL: + return visitor.visitEmail(); + case WORK_EMAIL: + return visitor.visitWorkEmail(); + case MARITAL_STATUS: + return visitor.visitMaritalStatus(); + case CITY: + return visitor.visitCity(); + case RELATIONSHIP_STATUS: + return visitor.visitRelationshipStatus(); + case CUSTOM: + return visitor.visitCustom(); + case JOB_TITLE: + return visitor.visitJobTitle(); + case STATE: + return visitor.visitState(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdsRequestLeadFormQuestionsItemType valueOf(String value) { + switch (value) { + case "gender": + return GENDER; + case "street_address": + return STREET_ADDRESS; + case "last_name": + return LAST_NAME; + case "country": + return COUNTRY; + case "work_phone_number": + return WORK_PHONE_NUMBER; + case "phone": + return PHONE; + case "military_status": + return MILITARY_STATUS; + case "zip": + return ZIP; + case "dob": + return DOB; + case "date_time": + return DATE_TIME; + case "full_name": + return FULL_NAME; + case "first_name": + return FIRST_NAME; + case "company_name": + return COMPANY_NAME; + case "email": + return EMAIL; + case "work_email": + return WORK_EMAIL; + case "marital_status": + return MARITAL_STATUS; + case "city": + return CITY; + case "relationship_status": + return RELATIONSHIP_STATUS; + case "custom": + return CUSTOM; + case "job_title": + return JOB_TITLE; + case "state": + return STATE; + default: + return new CreateAdsRequestLeadFormQuestionsItemType(Value.UNKNOWN, value); + } + } + + public enum Value { + EMAIL, + + PHONE, + + FULL_NAME, + + FIRST_NAME, + + LAST_NAME, + + CITY, + + STATE, + + ZIP, + + COUNTRY, + + STREET_ADDRESS, + + JOB_TITLE, + + COMPANY_NAME, + + WORK_EMAIL, + + WORK_PHONE_NUMBER, + + DOB, + + GENDER, + + MARITAL_STATUS, + + RELATIONSHIP_STATUS, + + MILITARY_STATUS, + + DATE_TIME, + + CUSTOM, + + UNKNOWN + } + + public interface Visitor { + T visitEmail(); + + T visitPhone(); + + T visitFullName(); + + T visitFirstName(); + + T visitLastName(); + + T visitCity(); + + T visitState(); + + T visitZip(); + + T visitCountry(); + + T visitStreetAddress(); + + T visitJobTitle(); + + T visitCompanyName(); + + T visitWorkEmail(); + + T visitWorkPhoneNumber(); + + T visitDob(); + + T visitGender(); + + T visitMaritalStatus(); + + T visitRelationshipStatus(); + + T visitMilitaryStatus(); + + T visitDateTime(); + + T visitCustom(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestMessagingConfig.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestMessagingConfig.java new file mode 100644 index 00000000..587cf0f4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestMessagingConfig.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdsRequestMessagingConfig.Builder.class) +public final class CreateAdsRequestMessagingConfig { + private final Optional keyword; + + private final Optional message; + + private final Map additionalProperties; + + private CreateAdsRequestMessagingConfig( + Optional keyword, Optional message, Map additionalProperties) { + this.keyword = keyword; + this.message = message; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("keyword") + public Optional getKeyword() { + return keyword; + } + + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdsRequestMessagingConfig && equalTo((CreateAdsRequestMessagingConfig) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdsRequestMessagingConfig other) { + return keyword.equals(other.keyword) && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.keyword, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional keyword = Optional.empty(); + + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAdsRequestMessagingConfig other) { + keyword(other.getKeyword()); + message(other.getMessage()); + return this; + } + + @JsonSetter(value = "keyword", nulls = Nulls.SKIP) + public Builder keyword(Optional keyword) { + this.keyword = keyword; + return this; + } + + public Builder keyword(String keyword) { + this.keyword = Optional.ofNullable(keyword); + return this; + } + + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public CreateAdsRequestMessagingConfig build() { + return new CreateAdsRequestMessagingConfig(keyword, message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestPostSource.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestPostSource.java new file mode 100644 index 00000000..aa0f4ffb --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestPostSource.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAdsRequestPostSource { + public static final CreateAdsRequestPostSource INSTAGRAM = + new CreateAdsRequestPostSource(Value.INSTAGRAM, "instagram"); + + public static final CreateAdsRequestPostSource FACEBOOK = + new CreateAdsRequestPostSource(Value.FACEBOOK, "facebook"); + + private final Value value; + + private final String string; + + CreateAdsRequestPostSource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAdsRequestPostSource + && this.string.equals(((CreateAdsRequestPostSource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTAGRAM: + return visitor.visitInstagram(); + case FACEBOOK: + return visitor.visitFacebook(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAdsRequestPostSource valueOf(String value) { + switch (value) { + case "instagram": + return INSTAGRAM; + case "facebook": + return FACEBOOK; + default: + return new CreateAdsRequestPostSource(Value.UNKNOWN, value); + } + } + + public enum Value { + FACEBOOK, + + INSTAGRAM, + + UNKNOWN + } + + public interface Visitor { + T visitFacebook(); + + T visitInstagram(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestSocialAccountsItem.java b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestSocialAccountsItem.java new file mode 100644 index 00000000..fc8caf40 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/CreateAdsRequestSocialAccountsItem.java @@ -0,0 +1,112 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAdsRequestSocialAccountsItem.Builder.class) +public final class CreateAdsRequestSocialAccountsItem { + private final Optional id; + + private final Map additionalProperties; + + private CreateAdsRequestSocialAccountsItem(Optional id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Social account ID, prefixed sacc_. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAdsRequestSocialAccountsItem + && equalTo((CreateAdsRequestSocialAccountsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAdsRequestSocialAccountsItem other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAdsRequestSocialAccountsItem other) { + id(other.getId()); + return this; + } + + /** + *

Social account ID, prefixed sacc_.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public CreateAdsRequestSocialAccountsItem build() { + return new CreateAdsRequestSocialAccountsItem(id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/DeleteAdsResponse.java b/src/main/java/com/whop/api/resources/ads/types/DeleteAdsResponse.java new file mode 100644 index 00000000..5d742c88 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/DeleteAdsResponse.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteAdsResponse.Builder.class) +public final class DeleteAdsResponse { + private final boolean deleted; + + private final String id; + + private final Map additionalProperties; + + private DeleteAdsResponse(boolean deleted, String id, Map additionalProperties) { + this.deleted = deleted; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Always true. + */ + @JsonProperty("deleted") + public boolean getDeleted() { + return deleted; + } + + /** + * @return ID of the deleted ad. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteAdsResponse && equalTo((DeleteAdsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteAdsResponse other) { + return deleted == other.deleted && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deleted, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeletedStage builder() { + return new Builder(); + } + + public interface DeletedStage { + /** + *

Always true.

+ */ + IdStage deleted(boolean deleted); + + Builder from(DeleteAdsResponse other); + } + + public interface IdStage { + /** + *

ID of the deleted ad.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DeleteAdsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeletedStage, IdStage, _FinalStage { + private boolean deleted; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeleteAdsResponse other) { + deleted(other.getDeleted()); + id(other.getId()); + return this; + } + + /** + *

Always true.

+ *

Always true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("deleted") + public IdStage deleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + *

ID of the deleted ad.

+ *

ID of the deleted ad.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DeleteAdsResponse build() { + return new DeleteAdsResponse(deleted, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/DuplicateAdsResponse.java b/src/main/java/com/whop/api/resources/ads/types/DuplicateAdsResponse.java new file mode 100644 index 00000000..727f01e8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/DuplicateAdsResponse.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Ad; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DuplicateAdsResponse.Builder.class) +public final class DuplicateAdsResponse { + private final List data; + + private final Map additionalProperties; + + private DuplicateAdsResponse(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DuplicateAdsResponse && equalTo((DuplicateAdsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DuplicateAdsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DuplicateAdsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(Ad data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public DuplicateAdsResponse build() { + return new DuplicateAdsResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/ListAdsRequestAttributionModel.java b/src/main/java/com/whop/api/resources/ads/types/ListAdsRequestAttributionModel.java new file mode 100644 index 00000000..337a36a0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/ListAdsRequestAttributionModel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAdsRequestAttributionModel { + public static final ListAdsRequestAttributionModel FIRST_TOUCH = + new ListAdsRequestAttributionModel(Value.FIRST_TOUCH, "first_touch"); + + public static final ListAdsRequestAttributionModel LAST_TOUCH = + new ListAdsRequestAttributionModel(Value.LAST_TOUCH, "last_touch"); + + private final Value value; + + private final String string; + + ListAdsRequestAttributionModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAdsRequestAttributionModel + && this.string.equals(((ListAdsRequestAttributionModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FIRST_TOUCH: + return visitor.visitFirstTouch(); + case LAST_TOUCH: + return visitor.visitLastTouch(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAdsRequestAttributionModel valueOf(String value) { + switch (value) { + case "first_touch": + return FIRST_TOUCH; + case "last_touch": + return LAST_TOUCH; + default: + return new ListAdsRequestAttributionModel(Value.UNKNOWN, value); + } + } + + public enum Value { + LAST_TOUCH, + + FIRST_TOUCH, + + UNKNOWN + } + + public interface Visitor { + T visitLastTouch(); + + T visitFirstTouch(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/ListAdsRequestDirection.java b/src/main/java/com/whop/api/resources/ads/types/ListAdsRequestDirection.java new file mode 100644 index 00000000..b58d3a0f --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/ListAdsRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAdsRequestDirection { + public static final ListAdsRequestDirection ASC = new ListAdsRequestDirection(Value.ASC, "asc"); + + public static final ListAdsRequestDirection DESC = new ListAdsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListAdsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAdsRequestDirection + && this.string.equals(((ListAdsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAdsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListAdsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/ListAdsRequestOrder.java b/src/main/java/com/whop/api/resources/ads/types/ListAdsRequestOrder.java new file mode 100644 index 00000000..8c536c07 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/ListAdsRequestOrder.java @@ -0,0 +1,209 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAdsRequestOrder { + public static final ListAdsRequestOrder SPEND = new ListAdsRequestOrder(Value.SPEND, "spend"); + + public static final ListAdsRequestOrder COST_PER_RESULT = + new ListAdsRequestOrder(Value.COST_PER_RESULT, "cost_per_result"); + + public static final ListAdsRequestOrder COST_PER_CLICK = + new ListAdsRequestOrder(Value.COST_PER_CLICK, "cost_per_click"); + + public static final ListAdsRequestOrder FREQUENCY = new ListAdsRequestOrder(Value.FREQUENCY, "frequency"); + + public static final ListAdsRequestOrder RESULTS = new ListAdsRequestOrder(Value.RESULTS, "results"); + + public static final ListAdsRequestOrder UNIQUE_CLICKS = + new ListAdsRequestOrder(Value.UNIQUE_CLICKS, "unique_clicks"); + + public static final ListAdsRequestOrder CLICK_THROUGH_RATE = + new ListAdsRequestOrder(Value.CLICK_THROUGH_RATE, "click_through_rate"); + + public static final ListAdsRequestOrder REACH = new ListAdsRequestOrder(Value.REACH, "reach"); + + public static final ListAdsRequestOrder UPDATED_AT = new ListAdsRequestOrder(Value.UPDATED_AT, "updated_at"); + + public static final ListAdsRequestOrder COST_PER_MILLE = + new ListAdsRequestOrder(Value.COST_PER_MILLE, "cost_per_mille"); + + public static final ListAdsRequestOrder CREATED_AT = new ListAdsRequestOrder(Value.CREATED_AT, "created_at"); + + public static final ListAdsRequestOrder CLICKS = new ListAdsRequestOrder(Value.CLICKS, "clicks"); + + public static final ListAdsRequestOrder IMPRESSIONS = new ListAdsRequestOrder(Value.IMPRESSIONS, "impressions"); + + public static final ListAdsRequestOrder RETURN_ON_AD_SPEND = + new ListAdsRequestOrder(Value.RETURN_ON_AD_SPEND, "return_on_ad_spend"); + + private final Value value; + + private final String string; + + ListAdsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAdsRequestOrder && this.string.equals(((ListAdsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SPEND: + return visitor.visitSpend(); + case COST_PER_RESULT: + return visitor.visitCostPerResult(); + case COST_PER_CLICK: + return visitor.visitCostPerClick(); + case FREQUENCY: + return visitor.visitFrequency(); + case RESULTS: + return visitor.visitResults(); + case UNIQUE_CLICKS: + return visitor.visitUniqueClicks(); + case CLICK_THROUGH_RATE: + return visitor.visitClickThroughRate(); + case REACH: + return visitor.visitReach(); + case UPDATED_AT: + return visitor.visitUpdatedAt(); + case COST_PER_MILLE: + return visitor.visitCostPerMille(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case CLICKS: + return visitor.visitClicks(); + case IMPRESSIONS: + return visitor.visitImpressions(); + case RETURN_ON_AD_SPEND: + return visitor.visitReturnOnAdSpend(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAdsRequestOrder valueOf(String value) { + switch (value) { + case "spend": + return SPEND; + case "cost_per_result": + return COST_PER_RESULT; + case "cost_per_click": + return COST_PER_CLICK; + case "frequency": + return FREQUENCY; + case "results": + return RESULTS; + case "unique_clicks": + return UNIQUE_CLICKS; + case "click_through_rate": + return CLICK_THROUGH_RATE; + case "reach": + return REACH; + case "updated_at": + return UPDATED_AT; + case "cost_per_mille": + return COST_PER_MILLE; + case "created_at": + return CREATED_AT; + case "clicks": + return CLICKS; + case "impressions": + return IMPRESSIONS; + case "return_on_ad_spend": + return RETURN_ON_AD_SPEND; + default: + return new ListAdsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UPDATED_AT, + + SPEND, + + IMPRESSIONS, + + REACH, + + CLICKS, + + UNIQUE_CLICKS, + + FREQUENCY, + + CLICK_THROUGH_RATE, + + RESULTS, + + COST_PER_MILLE, + + COST_PER_CLICK, + + COST_PER_RESULT, + + RETURN_ON_AD_SPEND, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUpdatedAt(); + + T visitSpend(); + + T visitImpressions(); + + T visitReach(); + + T visitClicks(); + + T visitUniqueClicks(); + + T visitFrequency(); + + T visitClickThroughRate(); + + T visitResults(); + + T visitCostPerMille(); + + T visitCostPerClick(); + + T visitCostPerResult(); + + T visitReturnOnAdSpend(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/ListAdsRequestStatus.java b/src/main/java/com/whop/api/resources/ads/types/ListAdsRequestStatus.java new file mode 100644 index 00000000..7f4a6a97 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/ListAdsRequestStatus.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAdsRequestStatus { + public static final ListAdsRequestStatus PAUSED = new ListAdsRequestStatus(Value.PAUSED, "paused"); + + public static final ListAdsRequestStatus REJECTED = new ListAdsRequestStatus(Value.REJECTED, "rejected"); + + public static final ListAdsRequestStatus IN_REVIEW = new ListAdsRequestStatus(Value.IN_REVIEW, "in_review"); + + public static final ListAdsRequestStatus ACTIVE = new ListAdsRequestStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + ListAdsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAdsRequestStatus && this.string.equals(((ListAdsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAUSED: + return visitor.visitPaused(); + case REJECTED: + return visitor.visitRejected(); + case IN_REVIEW: + return visitor.visitInReview(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAdsRequestStatus valueOf(String value) { + switch (value) { + case "paused": + return PAUSED; + case "rejected": + return REJECTED; + case "in_review": + return IN_REVIEW; + case "active": + return ACTIVE; + default: + return new ListAdsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + PAUSED, + + IN_REVIEW, + + REJECTED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitPaused(); + + T visitInReview(); + + T visitRejected(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/ListAdsResponse.java b/src/main/java/com/whop/api/resources/ads/types/ListAdsResponse.java new file mode 100644 index 00000000..5167bc27 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/ListAdsResponse.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Ad; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAdsResponse.Builder.class) +public final class ListAdsResponse { + private final List data; + + private final ListAdsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListAdsResponse(List data, ListAdsResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListAdsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAdsResponse && equalTo((ListAdsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAdsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListAdsResponsePageInfo pageInfo); + + Builder from(ListAdsResponse other); + } + + public interface _FinalStage { + ListAdsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(Ad data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListAdsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAdsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListAdsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(Ad data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListAdsResponse build() { + return new ListAdsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/ListAdsResponsePageInfo.java b/src/main/java/com/whop/api/resources/ads/types/ListAdsResponsePageInfo.java new file mode 100644 index 00000000..d70392f1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/ListAdsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAdsResponsePageInfo.Builder.class) +public final class ListAdsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListAdsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAdsResponsePageInfo && equalTo((ListAdsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAdsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListAdsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListAdsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAdsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListAdsResponsePageInfo build() { + return new ListAdsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/RetrieveAdsRequestAttributionModel.java b/src/main/java/com/whop/api/resources/ads/types/RetrieveAdsRequestAttributionModel.java new file mode 100644 index 00000000..537fdfa2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/RetrieveAdsRequestAttributionModel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveAdsRequestAttributionModel { + public static final RetrieveAdsRequestAttributionModel FIRST_TOUCH = + new RetrieveAdsRequestAttributionModel(Value.FIRST_TOUCH, "first_touch"); + + public static final RetrieveAdsRequestAttributionModel LAST_TOUCH = + new RetrieveAdsRequestAttributionModel(Value.LAST_TOUCH, "last_touch"); + + private final Value value; + + private final String string; + + RetrieveAdsRequestAttributionModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveAdsRequestAttributionModel + && this.string.equals(((RetrieveAdsRequestAttributionModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FIRST_TOUCH: + return visitor.visitFirstTouch(); + case LAST_TOUCH: + return visitor.visitLastTouch(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveAdsRequestAttributionModel valueOf(String value) { + switch (value) { + case "first_touch": + return FIRST_TOUCH; + case "last_touch": + return LAST_TOUCH; + default: + return new RetrieveAdsRequestAttributionModel(Value.UNKNOWN, value); + } + } + + public enum Value { + LAST_TOUCH, + + FIRST_TOUCH, + + UNKNOWN + } + + public interface Visitor { + T visitLastTouch(); + + T visitFirstTouch(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestCallToAction.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestCallToAction.java new file mode 100644 index 00000000..5ee7acbd --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestCallToAction.java @@ -0,0 +1,306 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdsRequestCallToAction { + public static final UpdateAdsRequestCallToAction BOOK_NOW = + new UpdateAdsRequestCallToAction(Value.BOOK_NOW, "book_now"); + + public static final UpdateAdsRequestCallToAction REQUEST_TIME = + new UpdateAdsRequestCallToAction(Value.REQUEST_TIME, "request_time"); + + public static final UpdateAdsRequestCallToAction SIGN_UP = + new UpdateAdsRequestCallToAction(Value.SIGN_UP, "sign_up"); + + public static final UpdateAdsRequestCallToAction NO_BUTTON = + new UpdateAdsRequestCallToAction(Value.NO_BUTTON, "no_button"); + + public static final UpdateAdsRequestCallToAction GET_OFFER = + new UpdateAdsRequestCallToAction(Value.GET_OFFER, "get_offer"); + + public static final UpdateAdsRequestCallToAction OPEN_LINK = + new UpdateAdsRequestCallToAction(Value.OPEN_LINK, "open_link"); + + public static final UpdateAdsRequestCallToAction SHOP_NOW = + new UpdateAdsRequestCallToAction(Value.SHOP_NOW, "shop_now"); + + public static final UpdateAdsRequestCallToAction GET_DIRECTIONS = + new UpdateAdsRequestCallToAction(Value.GET_DIRECTIONS, "get_directions"); + + public static final UpdateAdsRequestCallToAction LISTEN_NOW = + new UpdateAdsRequestCallToAction(Value.LISTEN_NOW, "listen_now"); + + public static final UpdateAdsRequestCallToAction MESSAGE_PAGE = + new UpdateAdsRequestCallToAction(Value.MESSAGE_PAGE, "message_page"); + + public static final UpdateAdsRequestCallToAction SEE_DETAILS = + new UpdateAdsRequestCallToAction(Value.SEE_DETAILS, "see_details"); + + public static final UpdateAdsRequestCallToAction CALL_NOW = + new UpdateAdsRequestCallToAction(Value.CALL_NOW, "call_now"); + + public static final UpdateAdsRequestCallToAction GET_QUOTE = + new UpdateAdsRequestCallToAction(Value.GET_QUOTE, "get_quote"); + + public static final UpdateAdsRequestCallToAction ORDER_NOW = + new UpdateAdsRequestCallToAction(Value.ORDER_NOW, "order_now"); + + public static final UpdateAdsRequestCallToAction SEE_MENU = + new UpdateAdsRequestCallToAction(Value.SEE_MENU, "see_menu"); + + public static final UpdateAdsRequestCallToAction SUBSCRIBE = + new UpdateAdsRequestCallToAction(Value.SUBSCRIBE, "subscribe"); + + public static final UpdateAdsRequestCallToAction APPLY_NOW = + new UpdateAdsRequestCallToAction(Value.APPLY_NOW, "apply_now"); + + public static final UpdateAdsRequestCallToAction LEARN_MORE = + new UpdateAdsRequestCallToAction(Value.LEARN_MORE, "learn_more"); + + public static final UpdateAdsRequestCallToAction DOWNLOAD = + new UpdateAdsRequestCallToAction(Value.DOWNLOAD, "download"); + + public static final UpdateAdsRequestCallToAction SEND_UPDATES = + new UpdateAdsRequestCallToAction(Value.SEND_UPDATES, "send_updates"); + + public static final UpdateAdsRequestCallToAction CONTACT_US = + new UpdateAdsRequestCallToAction(Value.CONTACT_US, "contact_us"); + + public static final UpdateAdsRequestCallToAction WATCH_MORE = + new UpdateAdsRequestCallToAction(Value.WATCH_MORE, "watch_more"); + + private final Value value; + + private final String string; + + UpdateAdsRequestCallToAction(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdsRequestCallToAction + && this.string.equals(((UpdateAdsRequestCallToAction) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case BOOK_NOW: + return visitor.visitBookNow(); + case REQUEST_TIME: + return visitor.visitRequestTime(); + case SIGN_UP: + return visitor.visitSignUp(); + case NO_BUTTON: + return visitor.visitNoButton(); + case GET_OFFER: + return visitor.visitGetOffer(); + case OPEN_LINK: + return visitor.visitOpenLink(); + case SHOP_NOW: + return visitor.visitShopNow(); + case GET_DIRECTIONS: + return visitor.visitGetDirections(); + case LISTEN_NOW: + return visitor.visitListenNow(); + case MESSAGE_PAGE: + return visitor.visitMessagePage(); + case SEE_DETAILS: + return visitor.visitSeeDetails(); + case CALL_NOW: + return visitor.visitCallNow(); + case GET_QUOTE: + return visitor.visitGetQuote(); + case ORDER_NOW: + return visitor.visitOrderNow(); + case SEE_MENU: + return visitor.visitSeeMenu(); + case SUBSCRIBE: + return visitor.visitSubscribe(); + case APPLY_NOW: + return visitor.visitApplyNow(); + case LEARN_MORE: + return visitor.visitLearnMore(); + case DOWNLOAD: + return visitor.visitDownload(); + case SEND_UPDATES: + return visitor.visitSendUpdates(); + case CONTACT_US: + return visitor.visitContactUs(); + case WATCH_MORE: + return visitor.visitWatchMore(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdsRequestCallToAction valueOf(String value) { + switch (value) { + case "book_now": + return BOOK_NOW; + case "request_time": + return REQUEST_TIME; + case "sign_up": + return SIGN_UP; + case "no_button": + return NO_BUTTON; + case "get_offer": + return GET_OFFER; + case "open_link": + return OPEN_LINK; + case "shop_now": + return SHOP_NOW; + case "get_directions": + return GET_DIRECTIONS; + case "listen_now": + return LISTEN_NOW; + case "message_page": + return MESSAGE_PAGE; + case "see_details": + return SEE_DETAILS; + case "call_now": + return CALL_NOW; + case "get_quote": + return GET_QUOTE; + case "order_now": + return ORDER_NOW; + case "see_menu": + return SEE_MENU; + case "subscribe": + return SUBSCRIBE; + case "apply_now": + return APPLY_NOW; + case "learn_more": + return LEARN_MORE; + case "download": + return DOWNLOAD; + case "send_updates": + return SEND_UPDATES; + case "contact_us": + return CONTACT_US; + case "watch_more": + return WATCH_MORE; + default: + return new UpdateAdsRequestCallToAction(Value.UNKNOWN, value); + } + } + + public enum Value { + APPLY_NOW, + + BOOK_NOW, + + CALL_NOW, + + CONTACT_US, + + DOWNLOAD, + + GET_DIRECTIONS, + + GET_OFFER, + + GET_QUOTE, + + LEARN_MORE, + + LISTEN_NOW, + + MESSAGE_PAGE, + + NO_BUTTON, + + OPEN_LINK, + + ORDER_NOW, + + REQUEST_TIME, + + SEE_DETAILS, + + SEE_MENU, + + SEND_UPDATES, + + SHOP_NOW, + + SIGN_UP, + + SUBSCRIBE, + + WATCH_MORE, + + UNKNOWN + } + + public interface Visitor { + T visitApplyNow(); + + T visitBookNow(); + + T visitCallNow(); + + T visitContactUs(); + + T visitDownload(); + + T visitGetDirections(); + + T visitGetOffer(); + + T visitGetQuote(); + + T visitLearnMore(); + + T visitListenNow(); + + T visitMessagePage(); + + T visitNoButton(); + + T visitOpenLink(); + + T visitOrderNow(); + + T visitRequestTime(); + + T visitSeeDetails(); + + T visitSeeMenu(); + + T visitSendUpdates(); + + T visitShopNow(); + + T visitSignUp(); + + T visitSubscribe(); + + T visitWatchMore(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestCreativesItem.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestCreativesItem.java new file mode 100644 index 00000000..c6dd2bb1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestCreativesItem.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdsRequestCreativesItem.Builder.class) +public final class UpdateAdsRequestCreativesItem { + private final Optional crop; + + private final Optional format; + + private final Optional id; + + private final Map additionalProperties; + + private UpdateAdsRequestCreativesItem( + Optional crop, + Optional format, + Optional id, + Map additionalProperties) { + this.crop = crop; + this.format = format; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The saved crop window for this creative, in source image pixels. Omit it for the original asset or for a format that has not been cropped. + */ + @JsonProperty("crop") + public Optional getCrop() { + return crop; + } + + @JsonProperty("format") + public Optional getFormat() { + return format; + } + + /** + * @return Uploaded file ID, prefixed file_. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdsRequestCreativesItem && equalTo((UpdateAdsRequestCreativesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdsRequestCreativesItem other) { + return crop.equals(other.crop) && format.equals(other.format) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.crop, this.format, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional crop = Optional.empty(); + + private Optional format = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdsRequestCreativesItem other) { + crop(other.getCrop()); + format(other.getFormat()); + id(other.getId()); + return this; + } + + /** + *

The saved crop window for this creative, in source image pixels. Omit it for the original asset or for a format that has not been cropped.

+ */ + @JsonSetter(value = "crop", nulls = Nulls.SKIP) + public Builder crop(Optional crop) { + this.crop = crop; + return this; + } + + public Builder crop(UpdateAdsRequestCreativesItemCrop crop) { + this.crop = Optional.ofNullable(crop); + return this; + } + + @JsonSetter(value = "format", nulls = Nulls.SKIP) + public Builder format(Optional format) { + this.format = format; + return this; + } + + public Builder format(UpdateAdsRequestCreativesItemFormat format) { + this.format = Optional.ofNullable(format); + return this; + } + + /** + *

Uploaded file ID, prefixed file_.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdateAdsRequestCreativesItem build() { + return new UpdateAdsRequestCreativesItem(crop, format, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestCreativesItemCrop.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestCreativesItemCrop.java new file mode 100644 index 00000000..8119c712 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestCreativesItemCrop.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdsRequestCreativesItemCrop.Builder.class) +public final class UpdateAdsRequestCreativesItemCrop { + private final Optional height; + + private final Optional width; + + private final Optional x; + + private final Optional y; + + private final Map additionalProperties; + + private UpdateAdsRequestCreativesItemCrop( + Optional height, + Optional width, + Optional x, + Optional y, + Map additionalProperties) { + this.height = height; + this.width = width; + this.x = x; + this.y = y; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("height") + public Optional getHeight() { + return height; + } + + @JsonProperty("width") + public Optional getWidth() { + return width; + } + + @JsonProperty("x") + public Optional getX() { + return x; + } + + @JsonProperty("y") + public Optional getY() { + return y; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdsRequestCreativesItemCrop && equalTo((UpdateAdsRequestCreativesItemCrop) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdsRequestCreativesItemCrop other) { + return height.equals(other.height) && width.equals(other.width) && x.equals(other.x) && y.equals(other.y); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.height, this.width, this.x, this.y); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional height = Optional.empty(); + + private Optional width = Optional.empty(); + + private Optional x = Optional.empty(); + + private Optional y = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdsRequestCreativesItemCrop other) { + height(other.getHeight()); + width(other.getWidth()); + x(other.getX()); + y(other.getY()); + return this; + } + + @JsonSetter(value = "height", nulls = Nulls.SKIP) + public Builder height(Optional height) { + this.height = height; + return this; + } + + public Builder height(Double height) { + this.height = Optional.ofNullable(height); + return this; + } + + @JsonSetter(value = "width", nulls = Nulls.SKIP) + public Builder width(Optional width) { + this.width = width; + return this; + } + + public Builder width(Double width) { + this.width = Optional.ofNullable(width); + return this; + } + + @JsonSetter(value = "x", nulls = Nulls.SKIP) + public Builder x(Optional x) { + this.x = x; + return this; + } + + public Builder x(Double x) { + this.x = Optional.ofNullable(x); + return this; + } + + @JsonSetter(value = "y", nulls = Nulls.SKIP) + public Builder y(Optional y) { + this.y = y; + return this; + } + + public Builder y(Double y) { + this.y = Optional.ofNullable(y); + return this; + } + + public UpdateAdsRequestCreativesItemCrop build() { + return new UpdateAdsRequestCreativesItemCrop(height, width, x, y, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestCreativesItemFormat.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestCreativesItemFormat.java new file mode 100644 index 00000000..96aae33a --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestCreativesItemFormat.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdsRequestCreativesItemFormat { + public static final UpdateAdsRequestCreativesItemFormat SQUARE = + new UpdateAdsRequestCreativesItemFormat(Value.SQUARE, "square"); + + public static final UpdateAdsRequestCreativesItemFormat VERTICAL = + new UpdateAdsRequestCreativesItemFormat(Value.VERTICAL, "vertical"); + + public static final UpdateAdsRequestCreativesItemFormat HORIZONTAL = + new UpdateAdsRequestCreativesItemFormat(Value.HORIZONTAL, "horizontal"); + + private final Value value; + + private final String string; + + UpdateAdsRequestCreativesItemFormat(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdsRequestCreativesItemFormat + && this.string.equals(((UpdateAdsRequestCreativesItemFormat) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SQUARE: + return visitor.visitSquare(); + case VERTICAL: + return visitor.visitVertical(); + case HORIZONTAL: + return visitor.visitHorizontal(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdsRequestCreativesItemFormat valueOf(String value) { + switch (value) { + case "square": + return SQUARE; + case "vertical": + return VERTICAL; + case "horizontal": + return HORIZONTAL; + default: + return new UpdateAdsRequestCreativesItemFormat(Value.UNKNOWN, value); + } + } + + public enum Value { + SQUARE, + + VERTICAL, + + HORIZONTAL, + + UNKNOWN + } + + public interface Visitor { + T visitSquare(); + + T visitVertical(); + + T visitHorizontal(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadForm.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadForm.java new file mode 100644 index 00000000..81e14c27 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadForm.java @@ -0,0 +1,341 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdsRequestLeadForm.Builder.class) +public final class UpdateAdsRequestLeadForm { + private final Optional completion; + + private final Optional disclaimer; + + private final Optional formType; + + private final Optional intro; + + private final Optional name; + + private final Optional phoneVerification; + + private final Optional privacyPolicy; + + private final Optional> questions; + + private final Map additionalProperties; + + private UpdateAdsRequestLeadForm( + Optional completion, + Optional disclaimer, + Optional formType, + Optional intro, + Optional name, + Optional phoneVerification, + Optional privacyPolicy, + Optional> questions, + Map additionalProperties) { + this.completion = completion; + this.disclaimer = disclaimer; + this.formType = formType; + this.intro = intro; + this.name = name; + this.phoneVerification = phoneVerification; + this.privacyPolicy = privacyPolicy; + this.questions = questions; + this.additionalProperties = additionalProperties; + } + + /** + * @return Optional completion screen shown after submission; url sets the follow-up website button. + */ + @JsonProperty("completion") + public Optional getCompletion() { + return completion; + } + + /** + * @return Optional custom consent disclaimer with checkboxes. + */ + @JsonProperty("disclaimer") + public Optional getDisclaimer() { + return disclaimer; + } + + /** + * @return more_volume (default) is quickest to submit; higher_intent adds a confirmation step. + */ + @JsonProperty("form_type") + public Optional getFormType() { + return formType; + } + + /** + * @return Optional intro screen shown before the questions. + */ + @JsonProperty("intro") + public Optional getIntro() { + return intro; + } + + /** + * @return Internal name for the form. Auto-generated if omitted. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Require SMS verification of the phone number (higher_intent forms). + */ + @JsonProperty("phone_verification") + public Optional getPhoneVerification() { + return phoneVerification; + } + + /** + * @return Your privacy policy. url is required by the ad platform. + */ + @JsonProperty("privacy_policy") + public Optional getPrivacyPolicy() { + return privacyPolicy; + } + + /** + * @return The questions on the form. Standard prefill types need only a type; a custom question needs a label and a format (plus options for multiple_choice). Options carry an optional key and answer-routing logic. + */ + @JsonProperty("questions") + public Optional> getQuestions() { + return questions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdsRequestLeadForm && equalTo((UpdateAdsRequestLeadForm) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdsRequestLeadForm other) { + return completion.equals(other.completion) + && disclaimer.equals(other.disclaimer) + && formType.equals(other.formType) + && intro.equals(other.intro) + && name.equals(other.name) + && phoneVerification.equals(other.phoneVerification) + && privacyPolicy.equals(other.privacyPolicy) + && questions.equals(other.questions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.completion, + this.disclaimer, + this.formType, + this.intro, + this.name, + this.phoneVerification, + this.privacyPolicy, + this.questions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional completion = Optional.empty(); + + private Optional disclaimer = Optional.empty(); + + private Optional formType = Optional.empty(); + + private Optional intro = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional phoneVerification = Optional.empty(); + + private Optional privacyPolicy = Optional.empty(); + + private Optional> questions = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdsRequestLeadForm other) { + completion(other.getCompletion()); + disclaimer(other.getDisclaimer()); + formType(other.getFormType()); + intro(other.getIntro()); + name(other.getName()); + phoneVerification(other.getPhoneVerification()); + privacyPolicy(other.getPrivacyPolicy()); + questions(other.getQuestions()); + return this; + } + + /** + *

Optional completion screen shown after submission; url sets the follow-up website button.

+ */ + @JsonSetter(value = "completion", nulls = Nulls.SKIP) + public Builder completion(Optional completion) { + this.completion = completion; + return this; + } + + public Builder completion(UpdateAdsRequestLeadFormCompletion completion) { + this.completion = Optional.ofNullable(completion); + return this; + } + + /** + *

Optional custom consent disclaimer with checkboxes.

+ */ + @JsonSetter(value = "disclaimer", nulls = Nulls.SKIP) + public Builder disclaimer(Optional disclaimer) { + this.disclaimer = disclaimer; + return this; + } + + public Builder disclaimer(UpdateAdsRequestLeadFormDisclaimer disclaimer) { + this.disclaimer = Optional.ofNullable(disclaimer); + return this; + } + + /** + *

more_volume (default) is quickest to submit; higher_intent adds a confirmation step.

+ */ + @JsonSetter(value = "form_type", nulls = Nulls.SKIP) + public Builder formType(Optional formType) { + this.formType = formType; + return this; + } + + public Builder formType(UpdateAdsRequestLeadFormFormType formType) { + this.formType = Optional.ofNullable(formType); + return this; + } + + /** + *

Optional intro screen shown before the questions.

+ */ + @JsonSetter(value = "intro", nulls = Nulls.SKIP) + public Builder intro(Optional intro) { + this.intro = intro; + return this; + } + + public Builder intro(UpdateAdsRequestLeadFormIntro intro) { + this.intro = Optional.ofNullable(intro); + return this; + } + + /** + *

Internal name for the form. Auto-generated if omitted.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Require SMS verification of the phone number (higher_intent forms).

+ */ + @JsonSetter(value = "phone_verification", nulls = Nulls.SKIP) + public Builder phoneVerification(Optional phoneVerification) { + this.phoneVerification = phoneVerification; + return this; + } + + public Builder phoneVerification(Boolean phoneVerification) { + this.phoneVerification = Optional.ofNullable(phoneVerification); + return this; + } + + /** + *

Your privacy policy. url is required by the ad platform.

+ */ + @JsonSetter(value = "privacy_policy", nulls = Nulls.SKIP) + public Builder privacyPolicy(Optional privacyPolicy) { + this.privacyPolicy = privacyPolicy; + return this; + } + + public Builder privacyPolicy(UpdateAdsRequestLeadFormPrivacyPolicy privacyPolicy) { + this.privacyPolicy = Optional.ofNullable(privacyPolicy); + return this; + } + + /** + *

The questions on the form. Standard prefill types need only a type; a custom question needs a label and a format (plus options for multiple_choice). Options carry an optional key and answer-routing logic.

+ */ + @JsonSetter(value = "questions", nulls = Nulls.SKIP) + public Builder questions(Optional> questions) { + this.questions = questions; + return this; + } + + public Builder questions(List questions) { + this.questions = Optional.ofNullable(questions); + return this; + } + + public UpdateAdsRequestLeadForm build() { + return new UpdateAdsRequestLeadForm( + completion, + disclaimer, + formType, + intro, + name, + phoneVerification, + privacyPolicy, + questions, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormCompletion.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormCompletion.java new file mode 100644 index 00000000..cfbcb0a0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormCompletion.java @@ -0,0 +1,180 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdsRequestLeadFormCompletion.Builder.class) +public final class UpdateAdsRequestLeadFormCompletion { + private final Optional buttonText; + + private final Optional description; + + private final Optional headline; + + private final Optional url; + + private final Map additionalProperties; + + private UpdateAdsRequestLeadFormCompletion( + Optional buttonText, + Optional description, + Optional headline, + Optional url, + Map additionalProperties) { + this.buttonText = buttonText; + this.description = description; + this.headline = headline; + this.url = url; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("button_text") + public Optional getButtonText() { + return buttonText; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("headline") + public Optional getHeadline() { + return headline; + } + + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdsRequestLeadFormCompletion + && equalTo((UpdateAdsRequestLeadFormCompletion) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdsRequestLeadFormCompletion other) { + return buttonText.equals(other.buttonText) + && description.equals(other.description) + && headline.equals(other.headline) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.buttonText, this.description, this.headline, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional buttonText = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional headline = Optional.empty(); + + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdsRequestLeadFormCompletion other) { + buttonText(other.getButtonText()); + description(other.getDescription()); + headline(other.getHeadline()); + url(other.getUrl()); + return this; + } + + @JsonSetter(value = "button_text", nulls = Nulls.SKIP) + public Builder buttonText(Optional buttonText) { + this.buttonText = buttonText; + return this; + } + + public Builder buttonText(String buttonText) { + this.buttonText = Optional.ofNullable(buttonText); + return this; + } + + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @JsonSetter(value = "headline", nulls = Nulls.SKIP) + public Builder headline(Optional headline) { + this.headline = headline; + return this; + } + + public Builder headline(String headline) { + this.headline = Optional.ofNullable(headline); + return this; + } + + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public UpdateAdsRequestLeadFormCompletion build() { + return new UpdateAdsRequestLeadFormCompletion(buttonText, description, headline, url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormDisclaimer.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormDisclaimer.java new file mode 100644 index 00000000..4c1e29c9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormDisclaimer.java @@ -0,0 +1,155 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdsRequestLeadFormDisclaimer.Builder.class) +public final class UpdateAdsRequestLeadFormDisclaimer { + private final Optional body; + + private final Optional> checkboxes; + + private final Optional title; + + private final Map additionalProperties; + + private UpdateAdsRequestLeadFormDisclaimer( + Optional body, + Optional> checkboxes, + Optional title, + Map additionalProperties) { + this.body = body; + this.checkboxes = checkboxes; + this.title = title; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("body") + public Optional getBody() { + return body; + } + + @JsonProperty("checkboxes") + public Optional> getCheckboxes() { + return checkboxes; + } + + @JsonProperty("title") + public Optional getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdsRequestLeadFormDisclaimer + && equalTo((UpdateAdsRequestLeadFormDisclaimer) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdsRequestLeadFormDisclaimer other) { + return body.equals(other.body) && checkboxes.equals(other.checkboxes) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.body, this.checkboxes, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional body = Optional.empty(); + + private Optional> checkboxes = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdsRequestLeadFormDisclaimer other) { + body(other.getBody()); + checkboxes(other.getCheckboxes()); + title(other.getTitle()); + return this; + } + + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public Builder body(Optional body) { + this.body = body; + return this; + } + + public Builder body(String body) { + this.body = Optional.ofNullable(body); + return this; + } + + @JsonSetter(value = "checkboxes", nulls = Nulls.SKIP) + public Builder checkboxes(Optional> checkboxes) { + this.checkboxes = checkboxes; + return this; + } + + public Builder checkboxes(List checkboxes) { + this.checkboxes = Optional.ofNullable(checkboxes); + return this; + } + + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public UpdateAdsRequestLeadFormDisclaimer build() { + return new UpdateAdsRequestLeadFormDisclaimer(body, checkboxes, title, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormDisclaimerCheckboxesItem.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormDisclaimerCheckboxesItem.java new file mode 100644 index 00000000..d0f19286 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormDisclaimerCheckboxesItem.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdsRequestLeadFormDisclaimerCheckboxesItem.Builder.class) +public final class UpdateAdsRequestLeadFormDisclaimerCheckboxesItem { + private final Optional checkedByDefault; + + private final Optional key; + + private final Optional required; + + private final Optional text; + + private final Map additionalProperties; + + private UpdateAdsRequestLeadFormDisclaimerCheckboxesItem( + Optional checkedByDefault, + Optional key, + Optional required, + Optional text, + Map additionalProperties) { + this.checkedByDefault = checkedByDefault; + this.key = key; + this.required = required; + this.text = text; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("checked_by_default") + public Optional getCheckedByDefault() { + return checkedByDefault; + } + + @JsonProperty("key") + public Optional getKey() { + return key; + } + + @JsonProperty("required") + public Optional getRequired() { + return required; + } + + @JsonProperty("text") + public Optional getText() { + return text; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdsRequestLeadFormDisclaimerCheckboxesItem + && equalTo((UpdateAdsRequestLeadFormDisclaimerCheckboxesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdsRequestLeadFormDisclaimerCheckboxesItem other) { + return checkedByDefault.equals(other.checkedByDefault) + && key.equals(other.key) + && required.equals(other.required) + && text.equals(other.text); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.checkedByDefault, this.key, this.required, this.text); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional checkedByDefault = Optional.empty(); + + private Optional key = Optional.empty(); + + private Optional required = Optional.empty(); + + private Optional text = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdsRequestLeadFormDisclaimerCheckboxesItem other) { + checkedByDefault(other.getCheckedByDefault()); + key(other.getKey()); + required(other.getRequired()); + text(other.getText()); + return this; + } + + @JsonSetter(value = "checked_by_default", nulls = Nulls.SKIP) + public Builder checkedByDefault(Optional checkedByDefault) { + this.checkedByDefault = checkedByDefault; + return this; + } + + public Builder checkedByDefault(Boolean checkedByDefault) { + this.checkedByDefault = Optional.ofNullable(checkedByDefault); + return this; + } + + @JsonSetter(value = "key", nulls = Nulls.SKIP) + public Builder key(Optional key) { + this.key = key; + return this; + } + + public Builder key(String key) { + this.key = Optional.ofNullable(key); + return this; + } + + @JsonSetter(value = "required", nulls = Nulls.SKIP) + public Builder required(Optional required) { + this.required = required; + return this; + } + + public Builder required(Boolean required) { + this.required = Optional.ofNullable(required); + return this; + } + + @JsonSetter(value = "text", nulls = Nulls.SKIP) + public Builder text(Optional text) { + this.text = text; + return this; + } + + public Builder text(String text) { + this.text = Optional.ofNullable(text); + return this; + } + + public UpdateAdsRequestLeadFormDisclaimerCheckboxesItem build() { + return new UpdateAdsRequestLeadFormDisclaimerCheckboxesItem( + checkedByDefault, key, required, text, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormFormType.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormFormType.java new file mode 100644 index 00000000..ded8432b --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormFormType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdsRequestLeadFormFormType { + public static final UpdateAdsRequestLeadFormFormType HIGHER_INTENT = + new UpdateAdsRequestLeadFormFormType(Value.HIGHER_INTENT, "higher_intent"); + + public static final UpdateAdsRequestLeadFormFormType MORE_VOLUME = + new UpdateAdsRequestLeadFormFormType(Value.MORE_VOLUME, "more_volume"); + + private final Value value; + + private final String string; + + UpdateAdsRequestLeadFormFormType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdsRequestLeadFormFormType + && this.string.equals(((UpdateAdsRequestLeadFormFormType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HIGHER_INTENT: + return visitor.visitHigherIntent(); + case MORE_VOLUME: + return visitor.visitMoreVolume(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdsRequestLeadFormFormType valueOf(String value) { + switch (value) { + case "higher_intent": + return HIGHER_INTENT; + case "more_volume": + return MORE_VOLUME; + default: + return new UpdateAdsRequestLeadFormFormType(Value.UNKNOWN, value); + } + } + + public enum Value { + MORE_VOLUME, + + HIGHER_INTENT, + + UNKNOWN + } + + public interface Visitor { + T visitMoreVolume(); + + T visitHigherIntent(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormIntro.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormIntro.java new file mode 100644 index 00000000..9e57e100 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormIntro.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdsRequestLeadFormIntro.Builder.class) +public final class UpdateAdsRequestLeadFormIntro { + private final Optional description; + + private final Optional headline; + + private final Map additionalProperties; + + private UpdateAdsRequestLeadFormIntro( + Optional description, Optional headline, Map additionalProperties) { + this.description = description; + this.headline = headline; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("headline") + public Optional getHeadline() { + return headline; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdsRequestLeadFormIntro && equalTo((UpdateAdsRequestLeadFormIntro) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdsRequestLeadFormIntro other) { + return description.equals(other.description) && headline.equals(other.headline); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.description, this.headline); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional description = Optional.empty(); + + private Optional headline = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdsRequestLeadFormIntro other) { + description(other.getDescription()); + headline(other.getHeadline()); + return this; + } + + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @JsonSetter(value = "headline", nulls = Nulls.SKIP) + public Builder headline(Optional headline) { + this.headline = headline; + return this; + } + + public Builder headline(String headline) { + this.headline = Optional.ofNullable(headline); + return this; + } + + public UpdateAdsRequestLeadFormIntro build() { + return new UpdateAdsRequestLeadFormIntro(description, headline, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormPrivacyPolicy.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormPrivacyPolicy.java new file mode 100644 index 00000000..2841ba65 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormPrivacyPolicy.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdsRequestLeadFormPrivacyPolicy.Builder.class) +public final class UpdateAdsRequestLeadFormPrivacyPolicy { + private final Optional linkText; + + private final Optional url; + + private final Map additionalProperties; + + private UpdateAdsRequestLeadFormPrivacyPolicy( + Optional linkText, Optional url, Map additionalProperties) { + this.linkText = linkText; + this.url = url; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("link_text") + public Optional getLinkText() { + return linkText; + } + + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdsRequestLeadFormPrivacyPolicy + && equalTo((UpdateAdsRequestLeadFormPrivacyPolicy) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdsRequestLeadFormPrivacyPolicy other) { + return linkText.equals(other.linkText) && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.linkText, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional linkText = Optional.empty(); + + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdsRequestLeadFormPrivacyPolicy other) { + linkText(other.getLinkText()); + url(other.getUrl()); + return this; + } + + @JsonSetter(value = "link_text", nulls = Nulls.SKIP) + public Builder linkText(Optional linkText) { + this.linkText = linkText; + return this; + } + + public Builder linkText(String linkText) { + this.linkText = Optional.ofNullable(linkText); + return this; + } + + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public UpdateAdsRequestLeadFormPrivacyPolicy build() { + return new UpdateAdsRequestLeadFormPrivacyPolicy(linkText, url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItem.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItem.java new file mode 100644 index 00000000..4654162b --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItem.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdsRequestLeadFormQuestionsItem.Builder.class) +public final class UpdateAdsRequestLeadFormQuestionsItem { + private final Optional format; + + private final Optional label; + + private final Optional> options; + + private final Optional type; + + private final Map additionalProperties; + + private UpdateAdsRequestLeadFormQuestionsItem( + Optional format, + Optional label, + Optional> options, + Optional type, + Map additionalProperties) { + this.format = format; + this.label = label; + this.options = options; + this.type = type; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("format") + public Optional getFormat() { + return format; + } + + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdsRequestLeadFormQuestionsItem + && equalTo((UpdateAdsRequestLeadFormQuestionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdsRequestLeadFormQuestionsItem other) { + return format.equals(other.format) + && label.equals(other.label) + && options.equals(other.options) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.format, this.label, this.options, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional format = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional> options = Optional.empty(); + + private Optional type = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdsRequestLeadFormQuestionsItem other) { + format(other.getFormat()); + label(other.getLabel()); + options(other.getOptions()); + type(other.getType()); + return this; + } + + @JsonSetter(value = "format", nulls = Nulls.SKIP) + public Builder format(Optional format) { + this.format = format; + return this; + } + + public Builder format(UpdateAdsRequestLeadFormQuestionsItemFormat format) { + this.format = Optional.ofNullable(format); + return this; + } + + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public Builder options(Optional> options) { + this.options = options; + return this; + } + + public Builder options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(UpdateAdsRequestLeadFormQuestionsItemType type) { + this.type = Optional.ofNullable(type); + return this; + } + + public UpdateAdsRequestLeadFormQuestionsItem build() { + return new UpdateAdsRequestLeadFormQuestionsItem(format, label, options, type, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItemFormat.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItemFormat.java new file mode 100644 index 00000000..3f9612eb --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItemFormat.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdsRequestLeadFormQuestionsItemFormat { + public static final UpdateAdsRequestLeadFormQuestionsItemFormat APPOINTMENT = + new UpdateAdsRequestLeadFormQuestionsItemFormat(Value.APPOINTMENT, "appointment"); + + public static final UpdateAdsRequestLeadFormQuestionsItemFormat SHORT_ANSWER = + new UpdateAdsRequestLeadFormQuestionsItemFormat(Value.SHORT_ANSWER, "short_answer"); + + public static final UpdateAdsRequestLeadFormQuestionsItemFormat MULTIPLE_CHOICE = + new UpdateAdsRequestLeadFormQuestionsItemFormat(Value.MULTIPLE_CHOICE, "multiple_choice"); + + private final Value value; + + private final String string; + + UpdateAdsRequestLeadFormQuestionsItemFormat(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdsRequestLeadFormQuestionsItemFormat + && this.string.equals(((UpdateAdsRequestLeadFormQuestionsItemFormat) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPOINTMENT: + return visitor.visitAppointment(); + case SHORT_ANSWER: + return visitor.visitShortAnswer(); + case MULTIPLE_CHOICE: + return visitor.visitMultipleChoice(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdsRequestLeadFormQuestionsItemFormat valueOf(String value) { + switch (value) { + case "appointment": + return APPOINTMENT; + case "short_answer": + return SHORT_ANSWER; + case "multiple_choice": + return MULTIPLE_CHOICE; + default: + return new UpdateAdsRequestLeadFormQuestionsItemFormat(Value.UNKNOWN, value); + } + } + + public enum Value { + SHORT_ANSWER, + + MULTIPLE_CHOICE, + + APPOINTMENT, + + UNKNOWN + } + + public interface Visitor { + T visitShortAnswer(); + + T visitMultipleChoice(); + + T visitAppointment(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItemOptionsItem.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItemOptionsItem.java new file mode 100644 index 00000000..b8966563 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItemOptionsItem.java @@ -0,0 +1,154 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdsRequestLeadFormQuestionsItemOptionsItem.Builder.class) +public final class UpdateAdsRequestLeadFormQuestionsItemOptionsItem { + private final Optional key; + + private final Optional logic; + + private final Optional value; + + private final Map additionalProperties; + + private UpdateAdsRequestLeadFormQuestionsItemOptionsItem( + Optional key, + Optional logic, + Optional value, + Map additionalProperties) { + this.key = key; + this.logic = logic; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("key") + public Optional getKey() { + return key; + } + + @JsonProperty("logic") + public Optional getLogic() { + return logic; + } + + @JsonProperty("value") + public Optional getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdsRequestLeadFormQuestionsItemOptionsItem + && equalTo((UpdateAdsRequestLeadFormQuestionsItemOptionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdsRequestLeadFormQuestionsItemOptionsItem other) { + return key.equals(other.key) && logic.equals(other.logic) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.key, this.logic, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional key = Optional.empty(); + + private Optional logic = Optional.empty(); + + private Optional value = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdsRequestLeadFormQuestionsItemOptionsItem other) { + key(other.getKey()); + logic(other.getLogic()); + value(other.getValue()); + return this; + } + + @JsonSetter(value = "key", nulls = Nulls.SKIP) + public Builder key(Optional key) { + this.key = key; + return this; + } + + public Builder key(String key) { + this.key = Optional.ofNullable(key); + return this; + } + + @JsonSetter(value = "logic", nulls = Nulls.SKIP) + public Builder logic(Optional logic) { + this.logic = logic; + return this; + } + + public Builder logic(UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogic logic) { + this.logic = Optional.ofNullable(logic); + return this; + } + + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public Builder value(Optional value) { + this.value = value; + return this; + } + + public Builder value(String value) { + this.value = Optional.ofNullable(value); + return this; + } + + public UpdateAdsRequestLeadFormQuestionsItemOptionsItem build() { + return new UpdateAdsRequestLeadFormQuestionsItemOptionsItem(key, logic, value, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogic.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogic.java new file mode 100644 index 00000000..4c1b73ee --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogic.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogic.Builder.class) +public final class UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogic { + private final Optional action; + + private final Optional targetEndPageIndex; + + private final Optional targetQuestionIndex; + + private final Map additionalProperties; + + private UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogic( + Optional action, + Optional targetEndPageIndex, + Optional targetQuestionIndex, + Map additionalProperties) { + this.action = action; + this.targetEndPageIndex = targetEndPageIndex; + this.targetQuestionIndex = targetQuestionIndex; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("action") + public Optional getAction() { + return action; + } + + @JsonProperty("target_end_page_index") + public Optional getTargetEndPageIndex() { + return targetEndPageIndex; + } + + @JsonProperty("target_question_index") + public Optional getTargetQuestionIndex() { + return targetQuestionIndex; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogic + && equalTo((UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogic) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogic other) { + return action.equals(other.action) + && targetEndPageIndex.equals(other.targetEndPageIndex) + && targetQuestionIndex.equals(other.targetQuestionIndex); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.action, this.targetEndPageIndex, this.targetQuestionIndex); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional action = Optional.empty(); + + private Optional targetEndPageIndex = Optional.empty(); + + private Optional targetQuestionIndex = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogic other) { + action(other.getAction()); + targetEndPageIndex(other.getTargetEndPageIndex()); + targetQuestionIndex(other.getTargetQuestionIndex()); + return this; + } + + @JsonSetter(value = "action", nulls = Nulls.SKIP) + public Builder action(Optional action) { + this.action = action; + return this; + } + + public Builder action(UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction action) { + this.action = Optional.ofNullable(action); + return this; + } + + @JsonSetter(value = "target_end_page_index", nulls = Nulls.SKIP) + public Builder targetEndPageIndex(Optional targetEndPageIndex) { + this.targetEndPageIndex = targetEndPageIndex; + return this; + } + + public Builder targetEndPageIndex(Integer targetEndPageIndex) { + this.targetEndPageIndex = Optional.ofNullable(targetEndPageIndex); + return this; + } + + @JsonSetter(value = "target_question_index", nulls = Nulls.SKIP) + public Builder targetQuestionIndex(Optional targetQuestionIndex) { + this.targetQuestionIndex = targetQuestionIndex; + return this; + } + + public Builder targetQuestionIndex(Integer targetQuestionIndex) { + this.targetQuestionIndex = Optional.ofNullable(targetQuestionIndex); + return this; + } + + public UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogic build() { + return new UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogic( + action, targetEndPageIndex, targetQuestionIndex, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction.java new file mode 100644 index 00000000..4f2285ce --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction.java @@ -0,0 +1,98 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction { + public static final UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction GO_TO_QUESTION = + new UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction(Value.GO_TO_QUESTION, "go_to_question"); + + public static final UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction CLOSE_FORM = + new UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction(Value.CLOSE_FORM, "close_form"); + + public static final UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction SUBMIT_FORM = + new UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction(Value.SUBMIT_FORM, "submit_form"); + + private final Value value; + + private final String string; + + UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction + && this.string.equals( + ((UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case GO_TO_QUESTION: + return visitor.visitGoToQuestion(); + case CLOSE_FORM: + return visitor.visitCloseForm(); + case SUBMIT_FORM: + return visitor.visitSubmitForm(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction valueOf(String value) { + switch (value) { + case "go_to_question": + return GO_TO_QUESTION; + case "close_form": + return CLOSE_FORM; + case "submit_form": + return SUBMIT_FORM; + default: + return new UpdateAdsRequestLeadFormQuestionsItemOptionsItemLogicAction(Value.UNKNOWN, value); + } + } + + public enum Value { + GO_TO_QUESTION, + + SUBMIT_FORM, + + CLOSE_FORM, + + UNKNOWN + } + + public interface Visitor { + T visitGoToQuestion(); + + T visitSubmitForm(); + + T visitCloseForm(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItemType.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItemType.java new file mode 100644 index 00000000..8fed4a56 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestLeadFormQuestionsItemType.java @@ -0,0 +1,295 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdsRequestLeadFormQuestionsItemType { + public static final UpdateAdsRequestLeadFormQuestionsItemType GENDER = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.GENDER, "gender"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType STREET_ADDRESS = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.STREET_ADDRESS, "street_address"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType LAST_NAME = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.LAST_NAME, "last_name"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType COUNTRY = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.COUNTRY, "country"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType WORK_PHONE_NUMBER = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.WORK_PHONE_NUMBER, "work_phone_number"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType PHONE = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.PHONE, "phone"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType MILITARY_STATUS = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.MILITARY_STATUS, "military_status"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType ZIP = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.ZIP, "zip"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType DOB = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.DOB, "dob"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType DATE_TIME = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.DATE_TIME, "date_time"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType FULL_NAME = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.FULL_NAME, "full_name"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType FIRST_NAME = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.FIRST_NAME, "first_name"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType COMPANY_NAME = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.COMPANY_NAME, "company_name"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType EMAIL = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.EMAIL, "email"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType WORK_EMAIL = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.WORK_EMAIL, "work_email"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType MARITAL_STATUS = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.MARITAL_STATUS, "marital_status"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType CITY = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.CITY, "city"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType RELATIONSHIP_STATUS = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.RELATIONSHIP_STATUS, "relationship_status"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType CUSTOM = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.CUSTOM, "custom"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType JOB_TITLE = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.JOB_TITLE, "job_title"); + + public static final UpdateAdsRequestLeadFormQuestionsItemType STATE = + new UpdateAdsRequestLeadFormQuestionsItemType(Value.STATE, "state"); + + private final Value value; + + private final String string; + + UpdateAdsRequestLeadFormQuestionsItemType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdsRequestLeadFormQuestionsItemType + && this.string.equals(((UpdateAdsRequestLeadFormQuestionsItemType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case GENDER: + return visitor.visitGender(); + case STREET_ADDRESS: + return visitor.visitStreetAddress(); + case LAST_NAME: + return visitor.visitLastName(); + case COUNTRY: + return visitor.visitCountry(); + case WORK_PHONE_NUMBER: + return visitor.visitWorkPhoneNumber(); + case PHONE: + return visitor.visitPhone(); + case MILITARY_STATUS: + return visitor.visitMilitaryStatus(); + case ZIP: + return visitor.visitZip(); + case DOB: + return visitor.visitDob(); + case DATE_TIME: + return visitor.visitDateTime(); + case FULL_NAME: + return visitor.visitFullName(); + case FIRST_NAME: + return visitor.visitFirstName(); + case COMPANY_NAME: + return visitor.visitCompanyName(); + case EMAIL: + return visitor.visitEmail(); + case WORK_EMAIL: + return visitor.visitWorkEmail(); + case MARITAL_STATUS: + return visitor.visitMaritalStatus(); + case CITY: + return visitor.visitCity(); + case RELATIONSHIP_STATUS: + return visitor.visitRelationshipStatus(); + case CUSTOM: + return visitor.visitCustom(); + case JOB_TITLE: + return visitor.visitJobTitle(); + case STATE: + return visitor.visitState(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdsRequestLeadFormQuestionsItemType valueOf(String value) { + switch (value) { + case "gender": + return GENDER; + case "street_address": + return STREET_ADDRESS; + case "last_name": + return LAST_NAME; + case "country": + return COUNTRY; + case "work_phone_number": + return WORK_PHONE_NUMBER; + case "phone": + return PHONE; + case "military_status": + return MILITARY_STATUS; + case "zip": + return ZIP; + case "dob": + return DOB; + case "date_time": + return DATE_TIME; + case "full_name": + return FULL_NAME; + case "first_name": + return FIRST_NAME; + case "company_name": + return COMPANY_NAME; + case "email": + return EMAIL; + case "work_email": + return WORK_EMAIL; + case "marital_status": + return MARITAL_STATUS; + case "city": + return CITY; + case "relationship_status": + return RELATIONSHIP_STATUS; + case "custom": + return CUSTOM; + case "job_title": + return JOB_TITLE; + case "state": + return STATE; + default: + return new UpdateAdsRequestLeadFormQuestionsItemType(Value.UNKNOWN, value); + } + } + + public enum Value { + EMAIL, + + PHONE, + + FULL_NAME, + + FIRST_NAME, + + LAST_NAME, + + CITY, + + STATE, + + ZIP, + + COUNTRY, + + STREET_ADDRESS, + + JOB_TITLE, + + COMPANY_NAME, + + WORK_EMAIL, + + WORK_PHONE_NUMBER, + + DOB, + + GENDER, + + MARITAL_STATUS, + + RELATIONSHIP_STATUS, + + MILITARY_STATUS, + + DATE_TIME, + + CUSTOM, + + UNKNOWN + } + + public interface Visitor { + T visitEmail(); + + T visitPhone(); + + T visitFullName(); + + T visitFirstName(); + + T visitLastName(); + + T visitCity(); + + T visitState(); + + T visitZip(); + + T visitCountry(); + + T visitStreetAddress(); + + T visitJobTitle(); + + T visitCompanyName(); + + T visitWorkEmail(); + + T visitWorkPhoneNumber(); + + T visitDob(); + + T visitGender(); + + T visitMaritalStatus(); + + T visitRelationshipStatus(); + + T visitMilitaryStatus(); + + T visitDateTime(); + + T visitCustom(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestMessagingConfig.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestMessagingConfig.java new file mode 100644 index 00000000..f83699ed --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestMessagingConfig.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdsRequestMessagingConfig.Builder.class) +public final class UpdateAdsRequestMessagingConfig { + private final Optional keyword; + + private final Optional message; + + private final Map additionalProperties; + + private UpdateAdsRequestMessagingConfig( + Optional keyword, Optional message, Map additionalProperties) { + this.keyword = keyword; + this.message = message; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("keyword") + public Optional getKeyword() { + return keyword; + } + + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdsRequestMessagingConfig && equalTo((UpdateAdsRequestMessagingConfig) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdsRequestMessagingConfig other) { + return keyword.equals(other.keyword) && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.keyword, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional keyword = Optional.empty(); + + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdsRequestMessagingConfig other) { + keyword(other.getKeyword()); + message(other.getMessage()); + return this; + } + + @JsonSetter(value = "keyword", nulls = Nulls.SKIP) + public Builder keyword(Optional keyword) { + this.keyword = keyword; + return this; + } + + public Builder keyword(String keyword) { + this.keyword = Optional.ofNullable(keyword); + return this; + } + + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public UpdateAdsRequestMessagingConfig build() { + return new UpdateAdsRequestMessagingConfig(keyword, message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestPostSource.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestPostSource.java new file mode 100644 index 00000000..197a0813 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestPostSource.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAdsRequestPostSource { + public static final UpdateAdsRequestPostSource INSTAGRAM = + new UpdateAdsRequestPostSource(Value.INSTAGRAM, "instagram"); + + public static final UpdateAdsRequestPostSource FACEBOOK = + new UpdateAdsRequestPostSource(Value.FACEBOOK, "facebook"); + + private final Value value; + + private final String string; + + UpdateAdsRequestPostSource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAdsRequestPostSource + && this.string.equals(((UpdateAdsRequestPostSource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTAGRAM: + return visitor.visitInstagram(); + case FACEBOOK: + return visitor.visitFacebook(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAdsRequestPostSource valueOf(String value) { + switch (value) { + case "instagram": + return INSTAGRAM; + case "facebook": + return FACEBOOK; + default: + return new UpdateAdsRequestPostSource(Value.UNKNOWN, value); + } + } + + public enum Value { + FACEBOOK, + + INSTAGRAM, + + UNKNOWN + } + + public interface Visitor { + T visitFacebook(); + + T visitInstagram(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestSocialAccountsItem.java b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestSocialAccountsItem.java new file mode 100644 index 00000000..03313f66 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ads/types/UpdateAdsRequestSocialAccountsItem.java @@ -0,0 +1,112 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAdsRequestSocialAccountsItem.Builder.class) +public final class UpdateAdsRequestSocialAccountsItem { + private final Optional id; + + private final Map additionalProperties; + + private UpdateAdsRequestSocialAccountsItem(Optional id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Social account ID, prefixed sacc_. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAdsRequestSocialAccountsItem + && equalTo((UpdateAdsRequestSocialAccountsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAdsRequestSocialAccountsItem other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAdsRequestSocialAccountsItem other) { + id(other.getId()); + return this; + } + + /** + *

Social account ID, prefixed sacc_.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdateAdsRequestSocialAccountsItem build() { + return new UpdateAdsRequestSocialAccountsItem(id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/AffiliatesClient.java b/src/main/java/com/whop/api/resources/affiliates/AffiliatesClient.java new file mode 100644 index 00000000..babc0600 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/AffiliatesClient.java @@ -0,0 +1,219 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.affiliates.overrides.OverridesClient; +import com.whop.api.resources.affiliates.requests.ArchiveAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.CreateAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.ListAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.RetrieveAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.UnarchiveAffiliatesRequest; +import com.whop.api.types.Affiliate; +import com.whop.api.types.AffiliateListItem; +import java.util.function.Supplier; + +public class AffiliatesClient { + protected final ClientOptions clientOptions; + + private final RawAffiliatesClient rawClient; + + protected final Supplier overridesClient; + + public AffiliatesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAffiliatesClient(clientOptions); + this.overridesClient = Suppliers.memoize(() -> new OverridesClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAffiliatesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of affiliates for the actor in context, with optional filtering by status, search, and sorting. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public SyncPagingIterable list(ListAffiliatesRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of affiliates for the actor in context, with optional filtering by status, search, and sorting. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public SyncPagingIterable list(ListAffiliatesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Creates or finds an affiliate for a company and user. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public Affiliate create(CreateAffiliatesRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Creates or finds an affiliate for a company and user. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public Affiliate create(CreateAffiliatesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public Affiliate retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public Affiliate retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public Affiliate retrieve(String id, RetrieveAffiliatesRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public Affiliate retrieve(String id, RetrieveAffiliatesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public boolean archive(String id) { + return this.rawClient.archive(id).body(); + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public boolean archive(String id, RequestOptions requestOptions) { + return this.rawClient.archive(id, requestOptions).body(); + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public boolean archive(String id, ArchiveAffiliatesRequest request) { + return this.rawClient.archive(id, request).body(); + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public boolean archive(String id, ArchiveAffiliatesRequest request, RequestOptions requestOptions) { + return this.rawClient.archive(id, request, requestOptions).body(); + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public boolean unarchive(String id) { + return this.rawClient.unarchive(id).body(); + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public boolean unarchive(String id, RequestOptions requestOptions) { + return this.rawClient.unarchive(id, requestOptions).body(); + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public boolean unarchive(String id, UnarchiveAffiliatesRequest request) { + return this.rawClient.unarchive(id, request).body(); + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public boolean unarchive(String id, UnarchiveAffiliatesRequest request, RequestOptions requestOptions) { + return this.rawClient.unarchive(id, request, requestOptions).body(); + } + + public OverridesClient overrides() { + return this.overridesClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/AsyncAffiliatesClient.java b/src/main/java/com/whop/api/resources/affiliates/AsyncAffiliatesClient.java new file mode 100644 index 00000000..8d45de10 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/AsyncAffiliatesClient.java @@ -0,0 +1,224 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.affiliates.overrides.AsyncOverridesClient; +import com.whop.api.resources.affiliates.requests.ArchiveAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.CreateAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.ListAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.RetrieveAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.UnarchiveAffiliatesRequest; +import com.whop.api.types.Affiliate; +import com.whop.api.types.AffiliateListItem; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class AsyncAffiliatesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAffiliatesClient rawClient; + + protected final Supplier overridesClient; + + public AsyncAffiliatesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAffiliatesClient(clientOptions); + this.overridesClient = Suppliers.memoize(() -> new AsyncOverridesClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAffiliatesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of affiliates for the actor in context, with optional filtering by status, search, and sorting. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture> list(ListAffiliatesRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of affiliates for the actor in context, with optional filtering by status, search, and sorting. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture> list( + ListAffiliatesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates or finds an affiliate for a company and user. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public CompletableFuture create(CreateAffiliatesRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Creates or finds an affiliate for a company and user. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public CompletableFuture create(CreateAffiliatesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveAffiliatesRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveAffiliatesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture archive(String id) { + return this.rawClient.archive(id).thenApply(response -> response.body()); + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture archive(String id, RequestOptions requestOptions) { + return this.rawClient.archive(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture archive(String id, ArchiveAffiliatesRequest request) { + return this.rawClient.archive(id, request).thenApply(response -> response.body()); + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture archive( + String id, ArchiveAffiliatesRequest request, RequestOptions requestOptions) { + return this.rawClient.archive(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture unarchive(String id) { + return this.rawClient.unarchive(id).thenApply(response -> response.body()); + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture unarchive(String id, RequestOptions requestOptions) { + return this.rawClient.unarchive(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture unarchive(String id, UnarchiveAffiliatesRequest request) { + return this.rawClient.unarchive(id, request).thenApply(response -> response.body()); + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture unarchive( + String id, UnarchiveAffiliatesRequest request, RequestOptions requestOptions) { + return this.rawClient.unarchive(id, request, requestOptions).thenApply(response -> response.body()); + } + + public AsyncOverridesClient overrides() { + return this.overridesClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/AsyncRawAffiliatesClient.java b/src/main/java/com/whop/api/resources/affiliates/AsyncRawAffiliatesClient.java new file mode 100644 index 00000000..96dc03c0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/AsyncRawAffiliatesClient.java @@ -0,0 +1,721 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.affiliates.requests.ArchiveAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.CreateAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.ListAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.RetrieveAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.UnarchiveAffiliatesRequest; +import com.whop.api.resources.affiliates.types.ListAffiliatesResponse; +import com.whop.api.types.Affiliate; +import com.whop.api.types.AffiliateListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAffiliatesClient { + protected final ClientOptions clientOptions; + + public AsyncRawAffiliatesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of affiliates for the actor in context, with optional filtering by status, search, and sorting. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture>> list( + ListAffiliatesRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of affiliates for the actor in context, with optional filtering by status, search, and sorting. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture>> list( + ListAffiliatesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAffiliatesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAffiliatesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListAffiliatesRequest nextRequest = ListAffiliatesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates or finds an affiliate for a company and user. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public CompletableFuture> create(CreateAffiliatesRequest request) { + return create(request, null); + } + + /** + * Creates or finds an affiliate for a company and user. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public CompletableFuture> create( + CreateAffiliatesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Affiliate.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveAffiliatesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAffiliatesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RetrieveAffiliatesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveAffiliatesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Affiliate.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> archive(String id) { + return archive(id, ArchiveAffiliatesRequest.builder().build()); + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> archive(String id, RequestOptions requestOptions) { + return archive(id, ArchiveAffiliatesRequest.builder().build(), requestOptions); + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> archive(String id, ArchiveAffiliatesRequest request) { + return archive(id, request, null); + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> archive( + String id, ArchiveAffiliatesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id) + .addPathSegments("archive"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> unarchive(String id) { + return unarchive(id, UnarchiveAffiliatesRequest.builder().build()); + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> unarchive(String id, RequestOptions requestOptions) { + return unarchive(id, UnarchiveAffiliatesRequest.builder().build(), requestOptions); + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> unarchive(String id, UnarchiveAffiliatesRequest request) { + return unarchive(id, request, null); + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> unarchive( + String id, UnarchiveAffiliatesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id) + .addPathSegments("unarchive"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/RawAffiliatesClient.java b/src/main/java/com/whop/api/resources/affiliates/RawAffiliatesClient.java new file mode 100644 index 00000000..7daebbff --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/RawAffiliatesClient.java @@ -0,0 +1,570 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.affiliates.requests.ArchiveAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.CreateAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.ListAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.RetrieveAffiliatesRequest; +import com.whop.api.resources.affiliates.requests.UnarchiveAffiliatesRequest; +import com.whop.api.resources.affiliates.types.ListAffiliatesResponse; +import com.whop.api.types.Affiliate; +import com.whop.api.types.AffiliateListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAffiliatesClient { + protected final ClientOptions clientOptions; + + public RawAffiliatesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of affiliates for the actor in context, with optional filtering by status, search, and sorting. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListAffiliatesRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of affiliates for the actor in context, with optional filtering by status, search, and sorting. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListAffiliatesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAffiliatesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAffiliatesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListAffiliatesRequest nextRequest = ListAffiliatesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates or finds an affiliate for a company and user. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public WhopApiHttpResponse create(CreateAffiliatesRequest request) { + return create(request, null); + } + + /** + * Creates or finds an affiliate for a company and user. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public WhopApiHttpResponse create(CreateAffiliatesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Affiliate.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveAffiliatesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAffiliatesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveAffiliatesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveAffiliatesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Affiliate.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse archive(String id) { + return archive(id, ArchiveAffiliatesRequest.builder().build()); + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse archive(String id, RequestOptions requestOptions) { + return archive(id, ArchiveAffiliatesRequest.builder().build(), requestOptions); + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse archive(String id, ArchiveAffiliatesRequest request) { + return archive(id, request, null); + } + + /** + * Archives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse archive( + String id, ArchiveAffiliatesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id) + .addPathSegments("archive"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse unarchive(String id) { + return unarchive(id, UnarchiveAffiliatesRequest.builder().build()); + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse unarchive(String id, RequestOptions requestOptions) { + return unarchive(id, UnarchiveAffiliatesRequest.builder().build(), requestOptions); + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse unarchive(String id, UnarchiveAffiliatesRequest request) { + return unarchive(id, request, null); + } + + /** + * Unarchives an existing Affiliate + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse unarchive( + String id, UnarchiveAffiliatesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id) + .addPathSegments("unarchive"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/AsyncOverridesClient.java b/src/main/java/com/whop/api/resources/affiliates/overrides/AsyncOverridesClient.java new file mode 100644 index 00000000..d4938a2c --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/AsyncOverridesClient.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.affiliates.overrides.requests.CreateOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.DeleteOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.ListOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.RetrieveOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.UpdateOverridesRequest; +import com.whop.api.resources.affiliates.overrides.types.CreateOverridesResponse; +import com.whop.api.resources.affiliates.overrides.types.ListOverridesResponseDataItem; +import com.whop.api.resources.affiliates.overrides.types.RetrieveOverridesResponse; +import com.whop.api.resources.affiliates.overrides.types.UpdateOverridesResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncOverridesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawOverridesClient rawClient; + + public AsyncOverridesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawOverridesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawOverridesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture> list(String id) { + return this.rawClient.list(id).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture> list( + String id, RequestOptions requestOptions) { + return this.rawClient.list(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture> list( + String id, ListOverridesRequest request) { + return this.rawClient.list(id, request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture> list( + String id, ListOverridesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates a commission override for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public CompletableFuture create(String id, CreateOverridesRequest request) { + return this.rawClient.create(id, request).thenApply(response -> response.body()); + } + + /** + * Creates a commission override for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public CompletableFuture create( + String id, CreateOverridesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id, String overrideId) { + return this.rawClient.retrieve(id, overrideId).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, String overrideId, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, overrideId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, String overrideId, RetrieveOverridesRequest request) { + return this.rawClient.retrieve(id, overrideId, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, String overrideId, RetrieveOverridesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, overrideId, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture delete(String id, String overrideId) { + return this.rawClient.delete(id, overrideId).thenApply(response -> response.body()); + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture delete(String id, String overrideId, RequestOptions requestOptions) { + return this.rawClient.delete(id, overrideId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture delete(String id, String overrideId, DeleteOverridesRequest request) { + return this.rawClient.delete(id, overrideId, request).thenApply(response -> response.body()); + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture delete( + String id, String overrideId, DeleteOverridesRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, overrideId, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture update(String id, String overrideId) { + return this.rawClient.update(id, overrideId).thenApply(response -> response.body()); + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture update( + String id, String overrideId, RequestOptions requestOptions) { + return this.rawClient.update(id, overrideId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture update( + String id, String overrideId, UpdateOverridesRequest request) { + return this.rawClient.update(id, overrideId, request).thenApply(response -> response.body()); + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture update( + String id, String overrideId, UpdateOverridesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, overrideId, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/AsyncRawOverridesClient.java b/src/main/java/com/whop/api/resources/affiliates/overrides/AsyncRawOverridesClient.java new file mode 100644 index 00000000..07d65f2c --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/AsyncRawOverridesClient.java @@ -0,0 +1,760 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.affiliates.overrides.requests.CreateOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.DeleteOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.ListOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.RetrieveOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.UpdateOverridesRequest; +import com.whop.api.resources.affiliates.overrides.types.CreateOverridesResponse; +import com.whop.api.resources.affiliates.overrides.types.ListOverridesResponse; +import com.whop.api.resources.affiliates.overrides.types.ListOverridesResponseDataItem; +import com.whop.api.resources.affiliates.overrides.types.RetrieveOverridesResponse; +import com.whop.api.resources.affiliates.overrides.types.UpdateOverridesResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawOverridesClient { + protected final ClientOptions clientOptions; + + public AsyncRawOverridesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture>> list(String id) { + return list(id, ListOverridesRequest.builder().build()); + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture>> list( + String id, RequestOptions requestOptions) { + return list(id, ListOverridesRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture>> list( + String id, ListOverridesRequest request) { + return list(id, request, null); + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture>> list( + String id, ListOverridesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id) + .addPathSegments("overrides"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getOverrideType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "override_type", request.getOverrideType().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListOverridesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListOverridesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListOverridesRequest nextRequest = ListOverridesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(id, nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates a commission override for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public CompletableFuture> create( + String id, CreateOverridesRequest request) { + return create(id, request, null); + } + + /** + * Creates a commission override for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public CompletableFuture> create( + String id, CreateOverridesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id) + .addPathSegments("overrides"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateOverridesResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, String overrideId) { + return retrieve(id, overrideId, RetrieveOverridesRequest.builder().build()); + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, String overrideId, RequestOptions requestOptions) { + return retrieve(id, overrideId, RetrieveOverridesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, String overrideId, RetrieveOverridesRequest request) { + return retrieve(id, overrideId, request, null); + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, String overrideId, RetrieveOverridesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id) + .addPathSegments("overrides") + .addPathSegment(overrideId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, RetrieveOverridesResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> delete(String id, String overrideId) { + return delete(id, overrideId, DeleteOverridesRequest.builder().build()); + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> delete( + String id, String overrideId, RequestOptions requestOptions) { + return delete(id, overrideId, DeleteOverridesRequest.builder().build(), requestOptions); + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> delete( + String id, String overrideId, DeleteOverridesRequest request) { + return delete(id, overrideId, request, null); + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> delete( + String id, String overrideId, DeleteOverridesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id) + .addPathSegments("overrides") + .addPathSegment(overrideId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> update(String id, String overrideId) { + return update(id, overrideId, UpdateOverridesRequest.builder().build()); + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> update( + String id, String overrideId, RequestOptions requestOptions) { + return update(id, overrideId, UpdateOverridesRequest.builder().build(), requestOptions); + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> update( + String id, String overrideId, UpdateOverridesRequest request) { + return update(id, overrideId, request, null); + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public CompletableFuture> update( + String id, String overrideId, UpdateOverridesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id) + .addPathSegments("overrides") + .addPathSegment(overrideId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateOverridesResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/OverridesClient.java b/src/main/java/com/whop/api/resources/affiliates/overrides/OverridesClient.java new file mode 100644 index 00000000..4a9a5e36 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/OverridesClient.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.affiliates.overrides.requests.CreateOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.DeleteOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.ListOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.RetrieveOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.UpdateOverridesRequest; +import com.whop.api.resources.affiliates.overrides.types.CreateOverridesResponse; +import com.whop.api.resources.affiliates.overrides.types.ListOverridesResponseDataItem; +import com.whop.api.resources.affiliates.overrides.types.RetrieveOverridesResponse; +import com.whop.api.resources.affiliates.overrides.types.UpdateOverridesResponse; + +public class OverridesClient { + protected final ClientOptions clientOptions; + + private final RawOverridesClient rawClient; + + public OverridesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawOverridesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawOverridesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public SyncPagingIterable list(String id) { + return this.rawClient.list(id).body(); + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public SyncPagingIterable list(String id, RequestOptions requestOptions) { + return this.rawClient.list(id, requestOptions).body(); + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public SyncPagingIterable list(String id, ListOverridesRequest request) { + return this.rawClient.list(id, request).body(); + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public SyncPagingIterable list( + String id, ListOverridesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(id, request, requestOptions).body(); + } + + /** + * Creates a commission override for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public CreateOverridesResponse create(String id, CreateOverridesRequest request) { + return this.rawClient.create(id, request).body(); + } + + /** + * Creates a commission override for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public CreateOverridesResponse create(String id, CreateOverridesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(id, request, requestOptions).body(); + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public RetrieveOverridesResponse retrieve(String id, String overrideId) { + return this.rawClient.retrieve(id, overrideId).body(); + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public RetrieveOverridesResponse retrieve(String id, String overrideId, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, overrideId, requestOptions).body(); + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public RetrieveOverridesResponse retrieve(String id, String overrideId, RetrieveOverridesRequest request) { + return this.rawClient.retrieve(id, overrideId, request).body(); + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public RetrieveOverridesResponse retrieve( + String id, String overrideId, RetrieveOverridesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, overrideId, request, requestOptions).body(); + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public boolean delete(String id, String overrideId) { + return this.rawClient.delete(id, overrideId).body(); + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public boolean delete(String id, String overrideId, RequestOptions requestOptions) { + return this.rawClient.delete(id, overrideId, requestOptions).body(); + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public boolean delete(String id, String overrideId, DeleteOverridesRequest request) { + return this.rawClient.delete(id, overrideId, request).body(); + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public boolean delete(String id, String overrideId, DeleteOverridesRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, overrideId, request, requestOptions).body(); + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public UpdateOverridesResponse update(String id, String overrideId) { + return this.rawClient.update(id, overrideId).body(); + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public UpdateOverridesResponse update(String id, String overrideId, RequestOptions requestOptions) { + return this.rawClient.update(id, overrideId, requestOptions).body(); + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public UpdateOverridesResponse update(String id, String overrideId, UpdateOverridesRequest request) { + return this.rawClient.update(id, overrideId, request).body(); + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public UpdateOverridesResponse update( + String id, String overrideId, UpdateOverridesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, overrideId, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/RawOverridesClient.java b/src/main/java/com/whop/api/resources/affiliates/overrides/RawOverridesClient.java new file mode 100644 index 00000000..a5f5c900 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/RawOverridesClient.java @@ -0,0 +1,608 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.affiliates.overrides.requests.CreateOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.DeleteOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.ListOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.RetrieveOverridesRequest; +import com.whop.api.resources.affiliates.overrides.requests.UpdateOverridesRequest; +import com.whop.api.resources.affiliates.overrides.types.CreateOverridesResponse; +import com.whop.api.resources.affiliates.overrides.types.ListOverridesResponse; +import com.whop.api.resources.affiliates.overrides.types.ListOverridesResponseDataItem; +import com.whop.api.resources.affiliates.overrides.types.RetrieveOverridesResponse; +import com.whop.api.resources.affiliates.overrides.types.UpdateOverridesResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawOverridesClient { + protected final ClientOptions clientOptions; + + public RawOverridesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list(String id) { + return list(id, ListOverridesRequest.builder().build()); + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list( + String id, RequestOptions requestOptions) { + return list(id, ListOverridesRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list( + String id, ListOverridesRequest request) { + return list(id, request, null); + } + + /** + * Returns a paginated list of overrides for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list( + String id, ListOverridesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id) + .addPathSegments("overrides"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getOverrideType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "override_type", request.getOverrideType().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListOverridesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListOverridesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListOverridesRequest nextRequest = ListOverridesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list( + id, nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates a commission override for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public WhopApiHttpResponse create(String id, CreateOverridesRequest request) { + return create(id, request, null); + } + + /** + * Creates a commission override for an affiliate. + *

Required permissions:

+ *
    + *
  • affiliate:create
  • + *
+ */ + public WhopApiHttpResponse create( + String id, CreateOverridesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id) + .addPathSegments("overrides"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateOverridesResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, String overrideId) { + return retrieve(id, overrideId, RetrieveOverridesRequest.builder().build()); + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, String overrideId, RequestOptions requestOptions) { + return retrieve(id, overrideId, RetrieveOverridesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, String overrideId, RetrieveOverridesRequest request) { + return retrieve(id, overrideId, request, null); + } + + /** + * Retrieves the details of a specific affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, String overrideId, RetrieveOverridesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id) + .addPathSegments("overrides") + .addPathSegment(overrideId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrieveOverridesResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id, String overrideId) { + return delete(id, overrideId, DeleteOverridesRequest.builder().build()); + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id, String overrideId, RequestOptions requestOptions) { + return delete(id, overrideId, DeleteOverridesRequest.builder().build(), requestOptions); + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id, String overrideId, DeleteOverridesRequest request) { + return delete(id, overrideId, request, null); + } + + /** + * Deletes an affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse delete( + String id, String overrideId, DeleteOverridesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id) + .addPathSegments("overrides") + .addPathSegment(overrideId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse update(String id, String overrideId) { + return update(id, overrideId, UpdateOverridesRequest.builder().build()); + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse update( + String id, String overrideId, RequestOptions requestOptions) { + return update(id, overrideId, UpdateOverridesRequest.builder().build(), requestOptions); + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse update( + String id, String overrideId, UpdateOverridesRequest request) { + return update(id, overrideId, request, null); + } + + /** + * Updates an existing affiliate override. + *

Required permissions:

+ *
    + *
  • affiliate:update
  • + *
+ */ + public WhopApiHttpResponse update( + String id, String overrideId, UpdateOverridesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("affiliates") + .addPathSegment(id) + .addPathSegments("overrides") + .addPathSegment(overrideId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateOverridesResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/requests/CreateOverridesRequest.java b/src/main/java/com/whop/api/resources/affiliates/overrides/requests/CreateOverridesRequest.java new file mode 100644 index 00000000..8866d107 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/requests/CreateOverridesRequest.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.affiliates.overrides.types.CreateOverridesRequestBody; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOverridesRequest.Builder.class) +public final class CreateOverridesRequest { + private final CreateOverridesRequestBody body; + + private final Map additionalProperties; + + private CreateOverridesRequest(CreateOverridesRequestBody body, Map additionalProperties) { + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return Parameters for CreateAffiliateOverride + */ + @JsonProperty("body") + public CreateOverridesRequestBody getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOverridesRequest && equalTo((CreateOverridesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOverridesRequest other) { + return body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + /** + *

Parameters for CreateAffiliateOverride

+ */ + _FinalStage body(@NotNull CreateOverridesRequestBody body); + + Builder from(CreateOverridesRequest other); + } + + public interface _FinalStage { + CreateOverridesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private CreateOverridesRequestBody body; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOverridesRequest other) { + body(other.getBody()); + return this; + } + + /** + *

Parameters for CreateAffiliateOverride

+ *

Parameters for CreateAffiliateOverride

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull CreateOverridesRequestBody body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public CreateOverridesRequest build() { + return new CreateOverridesRequest(body, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/requests/DeleteOverridesRequest.java b/src/main/java/com/whop/api/resources/affiliates/overrides/requests/DeleteOverridesRequest.java new file mode 100644 index 00000000..0746ba55 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/requests/DeleteOverridesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteOverridesRequest.Builder.class) +public final class DeleteOverridesRequest { + private final Map additionalProperties; + + private DeleteOverridesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteOverridesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteOverridesRequest other) { + return this; + } + + public DeleteOverridesRequest build() { + return new DeleteOverridesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/requests/ListOverridesRequest.java b/src/main/java/com/whop/api/resources/affiliates/overrides/requests/ListOverridesRequest.java new file mode 100644 index 00000000..7c4dee43 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/requests/ListOverridesRequest.java @@ -0,0 +1,228 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AffiliateOverrideRoles; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListOverridesRequest.Builder.class) +public final class ListOverridesRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Optional overrideType; + + private final Map additionalProperties; + + private ListOverridesRequest( + Optional after, + Optional before, + Optional first, + Optional last, + Optional overrideType, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.overrideType = overrideType; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + @JsonProperty("override_type") + public Optional getOverrideType() { + return overrideType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListOverridesRequest && equalTo((ListOverridesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListOverridesRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && overrideType.equals(other.overrideType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last, this.overrideType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional overrideType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListOverridesRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + overrideType(other.getOverrideType()); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + @JsonSetter(value = "override_type", nulls = Nulls.SKIP) + public Builder overrideType(Optional overrideType) { + this.overrideType = overrideType; + return this; + } + + public Builder overrideType(AffiliateOverrideRoles overrideType) { + this.overrideType = Optional.ofNullable(overrideType); + return this; + } + + public ListOverridesRequest build() { + return new ListOverridesRequest(after, before, first, last, overrideType, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/requests/RetrieveOverridesRequest.java b/src/main/java/com/whop/api/resources/affiliates/overrides/requests/RetrieveOverridesRequest.java new file mode 100644 index 00000000..f679c248 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/requests/RetrieveOverridesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveOverridesRequest.Builder.class) +public final class RetrieveOverridesRequest { + private final Map additionalProperties; + + private RetrieveOverridesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveOverridesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveOverridesRequest other) { + return this; + } + + public RetrieveOverridesRequest build() { + return new RetrieveOverridesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/requests/UpdateOverridesRequest.java b/src/main/java/com/whop/api/resources/affiliates/overrides/requests/UpdateOverridesRequest.java new file mode 100644 index 00000000..cef39f86 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/requests/UpdateOverridesRequest.java @@ -0,0 +1,290 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AffiliateAppliesToPayments; +import com.whop.api.types.AffiliatePayoutTypes; +import com.whop.api.types.AffiliateRevenueBases; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateOverridesRequest.Builder.class) +public final class UpdateOverridesRequest { + private final Optional appliesToPayments; + + private final Optional commissionType; + + private final Optional commissionValue; + + private final Optional revenueBasis; + + private final Map additionalProperties; + + private UpdateOverridesRequest( + Optional appliesToPayments, + Optional commissionType, + Optional commissionValue, + Optional revenueBasis, + Map additionalProperties) { + this.appliesToPayments = appliesToPayments; + this.commissionType = commissionType; + this.commissionValue = commissionValue; + this.revenueBasis = revenueBasis; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether commission applies to first payment or all payments (standard only). + */ + @JsonIgnore + public Optional getAppliesToPayments() { + if (appliesToPayments == null) { + return Optional.empty(); + } + return appliesToPayments; + } + + /** + * @return The commission type (percentage or flat_fee). + */ + @JsonIgnore + public Optional getCommissionType() { + if (commissionType == null) { + return Optional.empty(); + } + return commissionType; + } + + /** + * @return The commission value (percentage 1-100 or flat fee in dollars). + */ + @JsonIgnore + public Optional getCommissionValue() { + if (commissionValue == null) { + return Optional.empty(); + } + return commissionValue; + } + + /** + * @return The revenue calculation basis (rev-share only). + */ + @JsonIgnore + public Optional getRevenueBasis() { + if (revenueBasis == null) { + return Optional.empty(); + } + return revenueBasis; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("applies_to_payments") + private Optional _getAppliesToPayments() { + return appliesToPayments; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("commission_type") + private Optional _getCommissionType() { + return commissionType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("commission_value") + private Optional _getCommissionValue() { + return commissionValue; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("revenue_basis") + private Optional _getRevenueBasis() { + return revenueBasis; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateOverridesRequest && equalTo((UpdateOverridesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateOverridesRequest other) { + return appliesToPayments.equals(other.appliesToPayments) + && commissionType.equals(other.commissionType) + && commissionValue.equals(other.commissionValue) + && revenueBasis.equals(other.revenueBasis); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.appliesToPayments, this.commissionType, this.commissionValue, this.revenueBasis); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional appliesToPayments = Optional.empty(); + + private Optional commissionType = Optional.empty(); + + private Optional commissionValue = Optional.empty(); + + private Optional revenueBasis = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateOverridesRequest other) { + appliesToPayments(other.getAppliesToPayments()); + commissionType(other.getCommissionType()); + commissionValue(other.getCommissionValue()); + revenueBasis(other.getRevenueBasis()); + return this; + } + + /** + *

Whether commission applies to first payment or all payments (standard only).

+ */ + @JsonSetter(value = "applies_to_payments", nulls = Nulls.SKIP) + public Builder appliesToPayments(Optional appliesToPayments) { + this.appliesToPayments = appliesToPayments; + return this; + } + + public Builder appliesToPayments(AffiliateAppliesToPayments appliesToPayments) { + this.appliesToPayments = Optional.ofNullable(appliesToPayments); + return this; + } + + public Builder appliesToPayments(Nullable appliesToPayments) { + if (appliesToPayments.isNull()) { + this.appliesToPayments = null; + } else if (appliesToPayments.isEmpty()) { + this.appliesToPayments = Optional.empty(); + } else { + this.appliesToPayments = Optional.of(appliesToPayments.get()); + } + return this; + } + + /** + *

The commission type (percentage or flat_fee).

+ */ + @JsonSetter(value = "commission_type", nulls = Nulls.SKIP) + public Builder commissionType(Optional commissionType) { + this.commissionType = commissionType; + return this; + } + + public Builder commissionType(AffiliatePayoutTypes commissionType) { + this.commissionType = Optional.ofNullable(commissionType); + return this; + } + + public Builder commissionType(Nullable commissionType) { + if (commissionType.isNull()) { + this.commissionType = null; + } else if (commissionType.isEmpty()) { + this.commissionType = Optional.empty(); + } else { + this.commissionType = Optional.of(commissionType.get()); + } + return this; + } + + /** + *

The commission value (percentage 1-100 or flat fee in dollars).

+ */ + @JsonSetter(value = "commission_value", nulls = Nulls.SKIP) + public Builder commissionValue(Optional commissionValue) { + this.commissionValue = commissionValue; + return this; + } + + public Builder commissionValue(Double commissionValue) { + this.commissionValue = Optional.ofNullable(commissionValue); + return this; + } + + public Builder commissionValue(Nullable commissionValue) { + if (commissionValue.isNull()) { + this.commissionValue = null; + } else if (commissionValue.isEmpty()) { + this.commissionValue = Optional.empty(); + } else { + this.commissionValue = Optional.of(commissionValue.get()); + } + return this; + } + + /** + *

The revenue calculation basis (rev-share only).

+ */ + @JsonSetter(value = "revenue_basis", nulls = Nulls.SKIP) + public Builder revenueBasis(Optional revenueBasis) { + this.revenueBasis = revenueBasis; + return this; + } + + public Builder revenueBasis(AffiliateRevenueBases revenueBasis) { + this.revenueBasis = Optional.ofNullable(revenueBasis); + return this; + } + + public Builder revenueBasis(Nullable revenueBasis) { + if (revenueBasis.isNull()) { + this.revenueBasis = null; + } else if (revenueBasis.isEmpty()) { + this.revenueBasis = Optional.empty(); + } else { + this.revenueBasis = Optional.of(revenueBasis.get()); + } + return this; + } + + public UpdateOverridesRequest build() { + return new UpdateOverridesRequest( + appliesToPayments, commissionType, commissionValue, revenueBasis, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/types/CreateOverridesRequestBody.java b/src/main/java/com/whop/api/resources/affiliates/overrides/types/CreateOverridesRequestBody.java new file mode 100644 index 00000000..c1fe24c9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/types/CreateOverridesRequestBody.java @@ -0,0 +1,225 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateOverridesRequestBody { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateOverridesRequestBody(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateOverridesRequestBody standard(CreateOverridesRequestBodyStandard value) { + return new CreateOverridesRequestBody(new StandardValue(value)); + } + + public static CreateOverridesRequestBody revShare(CreateOverridesRequestBodyRevShare value) { + return new CreateOverridesRequestBody(new RevShareValue(value)); + } + + public boolean isStandard() { + return value instanceof StandardValue; + } + + public boolean isRevShare() { + return value instanceof RevShareValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getStandard() { + if (isStandard()) { + return Optional.of(((StandardValue) value).value); + } + return Optional.empty(); + } + + public Optional getRevShare() { + if (isRevShare()) { + return Optional.of(((RevShareValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOverridesRequestBody && value.equals(((CreateOverridesRequestBody) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitStandard(CreateOverridesRequestBodyStandard standard); + + T visitRevShare(CreateOverridesRequestBodyRevShare revShare); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + property = "override_type", + visible = true, + defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(StandardValue.class), @JsonSubTypes.Type(RevShareValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("standard") + @JsonIgnoreProperties("override_type") + private static final class StandardValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "override_type", allowSetters = true) + private CreateOverridesRequestBodyStandard value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private StandardValue() {} + + private StandardValue(CreateOverridesRequestBodyStandard value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitStandard(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StandardValue && equalTo((StandardValue) other); + } + + private boolean equalTo(StandardValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateOverridesRequestBody{" + "value: " + value + "}"; + } + } + + @JsonTypeName("rev_share") + @JsonIgnoreProperties("override_type") + private static final class RevShareValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "override_type", allowSetters = true) + private CreateOverridesRequestBodyRevShare value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RevShareValue() {} + + private RevShareValue(CreateOverridesRequestBodyRevShare value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRevShare(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RevShareValue && equalTo((RevShareValue) other); + } + + private boolean equalTo(RevShareValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateOverridesRequestBody{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("override_type") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateOverridesRequestBody{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/types/CreateOverridesRequestBodyRevShare.java b/src/main/java/com/whop/api/resources/affiliates/overrides/types/CreateOverridesRequestBodyRevShare.java new file mode 100644 index 00000000..55b170b1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/types/CreateOverridesRequestBodyRevShare.java @@ -0,0 +1,385 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AffiliatePayoutTypes; +import com.whop.api.types.AffiliateRevenueBases; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOverridesRequestBodyRevShare.Builder.class) +public final class CreateOverridesRequestBodyRevShare { + private final Optional commissionType; + + private final double commissionValue; + + private final String id; + + private final Optional productId; + + private final Optional revenueBasis; + + private final Map additionalProperties; + + private CreateOverridesRequestBodyRevShare( + Optional commissionType, + double commissionValue, + String id, + Optional productId, + Optional revenueBasis, + Map additionalProperties) { + this.commissionType = commissionType; + this.commissionValue = commissionValue; + this.id = id; + this.productId = productId; + this.revenueBasis = revenueBasis; + this.additionalProperties = additionalProperties; + } + + /** + * @return The commission type (percentage or flat_fee). + */ + @JsonIgnore + public Optional getCommissionType() { + if (commissionType == null) { + return Optional.empty(); + } + return commissionType; + } + + /** + * @return The commission value (percentage 1-100 or flat fee). + */ + @JsonProperty("commission_value") + public double getCommissionValue() { + return commissionValue; + } + + /** + * @return The affiliate ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The product ID (for rev-share overrides, omit for company-wide). + */ + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + /** + * @return The revenue calculation basis for rev-share overrides. Defaults to post_fees. + */ + @JsonIgnore + public Optional getRevenueBasis() { + if (revenueBasis == null) { + return Optional.empty(); + } + return revenueBasis; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("commission_type") + private Optional _getCommissionType() { + return commissionType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("revenue_basis") + private Optional _getRevenueBasis() { + return revenueBasis; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOverridesRequestBodyRevShare + && equalTo((CreateOverridesRequestBodyRevShare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOverridesRequestBodyRevShare other) { + return commissionType.equals(other.commissionType) + && commissionValue == other.commissionValue + && id.equals(other.id) + && productId.equals(other.productId) + && revenueBasis.equals(other.revenueBasis); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.commissionType, this.commissionValue, this.id, this.productId, this.revenueBasis); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CommissionValueStage builder() { + return new Builder(); + } + + public interface CommissionValueStage { + /** + *

The commission value (percentage 1-100 or flat fee).

+ */ + IdStage commissionValue(double commissionValue); + + Builder from(CreateOverridesRequestBodyRevShare other); + } + + public interface IdStage { + /** + *

The affiliate ID.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + CreateOverridesRequestBodyRevShare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The commission type (percentage or flat_fee).

+ */ + _FinalStage commissionType(Optional commissionType); + + _FinalStage commissionType(AffiliatePayoutTypes commissionType); + + _FinalStage commissionType(Nullable commissionType); + + /** + *

The product ID (for rev-share overrides, omit for company-wide).

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + + _FinalStage productId(Nullable productId); + + /** + *

The revenue calculation basis for rev-share overrides. Defaults to post_fees.

+ */ + _FinalStage revenueBasis(Optional revenueBasis); + + _FinalStage revenueBasis(AffiliateRevenueBases revenueBasis); + + _FinalStage revenueBasis(Nullable revenueBasis); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CommissionValueStage, IdStage, _FinalStage { + private double commissionValue; + + private String id; + + private Optional revenueBasis = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional commissionType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOverridesRequestBodyRevShare other) { + commissionType(other.getCommissionType()); + commissionValue(other.getCommissionValue()); + id(other.getId()); + productId(other.getProductId()); + revenueBasis(other.getRevenueBasis()); + return this; + } + + /** + *

The commission value (percentage 1-100 or flat fee).

+ *

The commission value (percentage 1-100 or flat fee).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("commission_value") + public IdStage commissionValue(double commissionValue) { + this.commissionValue = commissionValue; + return this; + } + + /** + *

The affiliate ID.

+ *

The affiliate ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The revenue calculation basis for rev-share overrides. Defaults to post_fees.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage revenueBasis(Nullable revenueBasis) { + if (revenueBasis.isNull()) { + this.revenueBasis = null; + } else if (revenueBasis.isEmpty()) { + this.revenueBasis = Optional.empty(); + } else { + this.revenueBasis = Optional.of(revenueBasis.get()); + } + return this; + } + + /** + *

The revenue calculation basis for rev-share overrides. Defaults to post_fees.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage revenueBasis(AffiliateRevenueBases revenueBasis) { + this.revenueBasis = Optional.ofNullable(revenueBasis); + return this; + } + + /** + *

The revenue calculation basis for rev-share overrides. Defaults to post_fees.

+ */ + @java.lang.Override + @JsonSetter(value = "revenue_basis", nulls = Nulls.SKIP) + public _FinalStage revenueBasis(Optional revenueBasis) { + this.revenueBasis = revenueBasis; + return this; + } + + /** + *

The product ID (for rev-share overrides, omit for company-wide).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + /** + *

The product ID (for rev-share overrides, omit for company-wide).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

The product ID (for rev-share overrides, omit for company-wide).

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

The commission type (percentage or flat_fee).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage commissionType(Nullable commissionType) { + if (commissionType.isNull()) { + this.commissionType = null; + } else if (commissionType.isEmpty()) { + this.commissionType = Optional.empty(); + } else { + this.commissionType = Optional.of(commissionType.get()); + } + return this; + } + + /** + *

The commission type (percentage or flat_fee).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage commissionType(AffiliatePayoutTypes commissionType) { + this.commissionType = Optional.ofNullable(commissionType); + return this; + } + + /** + *

The commission type (percentage or flat_fee).

+ */ + @java.lang.Override + @JsonSetter(value = "commission_type", nulls = Nulls.SKIP) + public _FinalStage commissionType(Optional commissionType) { + this.commissionType = commissionType; + return this; + } + + @java.lang.Override + public CreateOverridesRequestBodyRevShare build() { + return new CreateOverridesRequestBodyRevShare( + commissionType, commissionValue, id, productId, revenueBasis, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/types/CreateOverridesRequestBodyStandard.java b/src/main/java/com/whop/api/resources/affiliates/overrides/types/CreateOverridesRequestBodyStandard.java new file mode 100644 index 00000000..ef9696bc --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/types/CreateOverridesRequestBodyStandard.java @@ -0,0 +1,350 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AffiliateAppliesToPayments; +import com.whop.api.types.AffiliatePayoutTypes; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOverridesRequestBodyStandard.Builder.class) +public final class CreateOverridesRequestBodyStandard { + private final Optional appliesToPayments; + + private final Optional commissionType; + + private final double commissionValue; + + private final String id; + + private final String planId; + + private final Map additionalProperties; + + private CreateOverridesRequestBodyStandard( + Optional appliesToPayments, + Optional commissionType, + double commissionValue, + String id, + String planId, + Map additionalProperties) { + this.appliesToPayments = appliesToPayments; + this.commissionType = commissionType; + this.commissionValue = commissionValue; + this.id = id; + this.planId = planId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether commission applies to first payment or all payments (standard only). + */ + @JsonIgnore + public Optional getAppliesToPayments() { + if (appliesToPayments == null) { + return Optional.empty(); + } + return appliesToPayments; + } + + /** + * @return The commission type (percentage or flat_fee). + */ + @JsonIgnore + public Optional getCommissionType() { + if (commissionType == null) { + return Optional.empty(); + } + return commissionType; + } + + /** + * @return The commission value (percentage 1-100 or flat fee). + */ + @JsonProperty("commission_value") + public double getCommissionValue() { + return commissionValue; + } + + /** + * @return The affiliate ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The plan ID (required for standard overrides). + */ + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("applies_to_payments") + private Optional _getAppliesToPayments() { + return appliesToPayments; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("commission_type") + private Optional _getCommissionType() { + return commissionType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOverridesRequestBodyStandard + && equalTo((CreateOverridesRequestBodyStandard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOverridesRequestBodyStandard other) { + return appliesToPayments.equals(other.appliesToPayments) + && commissionType.equals(other.commissionType) + && commissionValue == other.commissionValue + && id.equals(other.id) + && planId.equals(other.planId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.appliesToPayments, this.commissionType, this.commissionValue, this.id, this.planId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CommissionValueStage builder() { + return new Builder(); + } + + public interface CommissionValueStage { + /** + *

The commission value (percentage 1-100 or flat fee).

+ */ + IdStage commissionValue(double commissionValue); + + Builder from(CreateOverridesRequestBodyStandard other); + } + + public interface IdStage { + /** + *

The affiliate ID.

+ */ + PlanIdStage id(@NotNull String id); + } + + public interface PlanIdStage { + /** + *

The plan ID (required for standard overrides).

+ */ + _FinalStage planId(@NotNull String planId); + } + + public interface _FinalStage { + CreateOverridesRequestBodyStandard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Whether commission applies to first payment or all payments (standard only).

+ */ + _FinalStage appliesToPayments(Optional appliesToPayments); + + _FinalStage appliesToPayments(AffiliateAppliesToPayments appliesToPayments); + + _FinalStage appliesToPayments(Nullable appliesToPayments); + + /** + *

The commission type (percentage or flat_fee).

+ */ + _FinalStage commissionType(Optional commissionType); + + _FinalStage commissionType(AffiliatePayoutTypes commissionType); + + _FinalStage commissionType(Nullable commissionType); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CommissionValueStage, IdStage, PlanIdStage, _FinalStage { + private double commissionValue; + + private String id; + + private String planId; + + private Optional commissionType = Optional.empty(); + + private Optional appliesToPayments = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOverridesRequestBodyStandard other) { + appliesToPayments(other.getAppliesToPayments()); + commissionType(other.getCommissionType()); + commissionValue(other.getCommissionValue()); + id(other.getId()); + planId(other.getPlanId()); + return this; + } + + /** + *

The commission value (percentage 1-100 or flat fee).

+ *

The commission value (percentage 1-100 or flat fee).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("commission_value") + public IdStage commissionValue(double commissionValue) { + this.commissionValue = commissionValue; + return this; + } + + /** + *

The affiliate ID.

+ *

The affiliate ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PlanIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The plan ID (required for standard overrides).

+ *

The plan ID (required for standard overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan_id") + public _FinalStage planId(@NotNull String planId) { + this.planId = Objects.requireNonNull(planId, "planId must not be null"); + return this; + } + + /** + *

The commission type (percentage or flat_fee).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage commissionType(Nullable commissionType) { + if (commissionType.isNull()) { + this.commissionType = null; + } else if (commissionType.isEmpty()) { + this.commissionType = Optional.empty(); + } else { + this.commissionType = Optional.of(commissionType.get()); + } + return this; + } + + /** + *

The commission type (percentage or flat_fee).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage commissionType(AffiliatePayoutTypes commissionType) { + this.commissionType = Optional.ofNullable(commissionType); + return this; + } + + /** + *

The commission type (percentage or flat_fee).

+ */ + @java.lang.Override + @JsonSetter(value = "commission_type", nulls = Nulls.SKIP) + public _FinalStage commissionType(Optional commissionType) { + this.commissionType = commissionType; + return this; + } + + /** + *

Whether commission applies to first payment or all payments (standard only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToPayments(Nullable appliesToPayments) { + if (appliesToPayments.isNull()) { + this.appliesToPayments = null; + } else if (appliesToPayments.isEmpty()) { + this.appliesToPayments = Optional.empty(); + } else { + this.appliesToPayments = Optional.of(appliesToPayments.get()); + } + return this; + } + + /** + *

Whether commission applies to first payment or all payments (standard only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToPayments(AffiliateAppliesToPayments appliesToPayments) { + this.appliesToPayments = Optional.ofNullable(appliesToPayments); + return this; + } + + /** + *

Whether commission applies to first payment or all payments (standard only).

+ */ + @java.lang.Override + @JsonSetter(value = "applies_to_payments", nulls = Nulls.SKIP) + public _FinalStage appliesToPayments(Optional appliesToPayments) { + this.appliesToPayments = appliesToPayments; + return this; + } + + @java.lang.Override + public CreateOverridesRequestBodyStandard build() { + return new CreateOverridesRequestBodyStandard( + appliesToPayments, commissionType, commissionValue, id, planId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/types/CreateOverridesResponse.java b/src/main/java/com/whop/api/resources/affiliates/overrides/types/CreateOverridesResponse.java new file mode 100644 index 00000000..7e51b777 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/types/CreateOverridesResponse.java @@ -0,0 +1,802 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AffiliateAppliesToPayments; +import com.whop.api.types.AffiliateAppliesToProducts; +import com.whop.api.types.AffiliateOverrideRoles; +import com.whop.api.types.AffiliatePayoutTypes; +import com.whop.api.types.AffiliateRevenueBases; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOverridesResponse.Builder.class) +public final class CreateOverridesResponse { + private final Optional appliesToPayments; + + private final Optional appliesToProducts; + + private final Optional checkoutDirectLink; + + private final AffiliatePayoutTypes commissionType; + + private final double commissionValue; + + private final String id; + + private final AffiliateOverrideRoles overrideType; + + private final Optional planId; + + private final Optional productDirectLink; + + private final Optional productId; + + private final Optional revenueBasis; + + private final double totalReferralEarningsUsd; + + private final Map additionalProperties; + + private CreateOverridesResponse( + Optional appliesToPayments, + Optional appliesToProducts, + Optional checkoutDirectLink, + AffiliatePayoutTypes commissionType, + double commissionValue, + String id, + AffiliateOverrideRoles overrideType, + Optional planId, + Optional productDirectLink, + Optional productId, + Optional revenueBasis, + double totalReferralEarningsUsd, + Map additionalProperties) { + this.appliesToPayments = appliesToPayments; + this.appliesToProducts = appliesToProducts; + this.checkoutDirectLink = checkoutDirectLink; + this.commissionType = commissionType; + this.commissionValue = commissionValue; + this.id = id; + this.overrideType = overrideType; + this.planId = planId; + this.productDirectLink = productDirectLink; + this.productId = productId; + this.revenueBasis = revenueBasis; + this.totalReferralEarningsUsd = totalReferralEarningsUsd; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the commission applies to the first payment only or all payments (standard overrides only). + */ + @JsonIgnore + public Optional getAppliesToPayments() { + if (appliesToPayments == null) { + return Optional.empty(); + } + return appliesToPayments; + } + + /** + * @return Whether this rev-share override applies to a single product or all products (rev-share only). + */ + @JsonIgnore + public Optional getAppliesToProducts() { + if (appliesToProducts == null) { + return Optional.empty(); + } + return appliesToProducts; + } + + /** + * @return The checkout direct link for referrals (standard overrides only). + */ + @JsonIgnore + public Optional getCheckoutDirectLink() { + if (checkoutDirectLink == null) { + return Optional.empty(); + } + return checkoutDirectLink; + } + + /** + * @return The type of commission (percentage or flat_fee). + */ + @JsonProperty("commission_type") + public AffiliatePayoutTypes getCommissionType() { + return commissionType; + } + + /** + * @return The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee. + */ + @JsonProperty("commission_value") + public double getCommissionValue() { + return commissionValue; + } + + /** + * @return The unique identifier for the affiliate override. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of override (standard or rev_share). + */ + @JsonProperty("override_type") + public AffiliateOverrideRoles getOverrideType() { + return overrideType; + } + + /** + * @return The plan ID (for standard overrides). + */ + @JsonIgnore + public Optional getPlanId() { + if (planId == null) { + return Optional.empty(); + } + return planId; + } + + /** + * @return The product page direct link for referrals (standard overrides only). + */ + @JsonIgnore + public Optional getProductDirectLink() { + if (productDirectLink == null) { + return Optional.empty(); + } + return productDirectLink; + } + + /** + * @return The product ID (for rev-share overrides). + */ + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + /** + * @return The revenue calculation basis (pre_fees or post_fees). + */ + @JsonIgnore + public Optional getRevenueBasis() { + if (revenueBasis == null) { + return Optional.empty(); + } + return revenueBasis; + } + + /** + * @return The total earnings paid to this affiliate for referrals to this specific plan, in USD. + */ + @JsonProperty("total_referral_earnings_usd") + public double getTotalReferralEarningsUsd() { + return totalReferralEarningsUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("applies_to_payments") + private Optional _getAppliesToPayments() { + return appliesToPayments; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("applies_to_products") + private Optional _getAppliesToProducts() { + return appliesToProducts; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_direct_link") + private Optional _getCheckoutDirectLink() { + return checkoutDirectLink; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan_id") + private Optional _getPlanId() { + return planId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_direct_link") + private Optional _getProductDirectLink() { + return productDirectLink; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("revenue_basis") + private Optional _getRevenueBasis() { + return revenueBasis; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOverridesResponse && equalTo((CreateOverridesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOverridesResponse other) { + return appliesToPayments.equals(other.appliesToPayments) + && appliesToProducts.equals(other.appliesToProducts) + && checkoutDirectLink.equals(other.checkoutDirectLink) + && commissionType.equals(other.commissionType) + && commissionValue == other.commissionValue + && id.equals(other.id) + && overrideType.equals(other.overrideType) + && planId.equals(other.planId) + && productDirectLink.equals(other.productDirectLink) + && productId.equals(other.productId) + && revenueBasis.equals(other.revenueBasis) + && totalReferralEarningsUsd == other.totalReferralEarningsUsd; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appliesToPayments, + this.appliesToProducts, + this.checkoutDirectLink, + this.commissionType, + this.commissionValue, + this.id, + this.overrideType, + this.planId, + this.productDirectLink, + this.productId, + this.revenueBasis, + this.totalReferralEarningsUsd); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CommissionTypeStage builder() { + return new Builder(); + } + + public interface CommissionTypeStage { + /** + *

The type of commission (percentage or flat_fee).

+ */ + CommissionValueStage commissionType(@NotNull AffiliatePayoutTypes commissionType); + + Builder from(CreateOverridesResponse other); + } + + public interface CommissionValueStage { + /** + *

The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee.

+ */ + IdStage commissionValue(double commissionValue); + } + + public interface IdStage { + /** + *

The unique identifier for the affiliate override.

+ */ + OverrideTypeStage id(@NotNull String id); + } + + public interface OverrideTypeStage { + /** + *

The type of override (standard or rev_share).

+ */ + TotalReferralEarningsUsdStage overrideType(@NotNull AffiliateOverrideRoles overrideType); + } + + public interface TotalReferralEarningsUsdStage { + /** + *

The total earnings paid to this affiliate for referrals to this specific plan, in USD.

+ */ + _FinalStage totalReferralEarningsUsd(double totalReferralEarningsUsd); + } + + public interface _FinalStage { + CreateOverridesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ */ + _FinalStage appliesToPayments(Optional appliesToPayments); + + _FinalStage appliesToPayments(AffiliateAppliesToPayments appliesToPayments); + + _FinalStage appliesToPayments(Nullable appliesToPayments); + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ */ + _FinalStage appliesToProducts(Optional appliesToProducts); + + _FinalStage appliesToProducts(AffiliateAppliesToProducts appliesToProducts); + + _FinalStage appliesToProducts(Nullable appliesToProducts); + + /** + *

The checkout direct link for referrals (standard overrides only).

+ */ + _FinalStage checkoutDirectLink(Optional checkoutDirectLink); + + _FinalStage checkoutDirectLink(String checkoutDirectLink); + + _FinalStage checkoutDirectLink(Nullable checkoutDirectLink); + + /** + *

The plan ID (for standard overrides).

+ */ + _FinalStage planId(Optional planId); + + _FinalStage planId(String planId); + + _FinalStage planId(Nullable planId); + + /** + *

The product page direct link for referrals (standard overrides only).

+ */ + _FinalStage productDirectLink(Optional productDirectLink); + + _FinalStage productDirectLink(String productDirectLink); + + _FinalStage productDirectLink(Nullable productDirectLink); + + /** + *

The product ID (for rev-share overrides).

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + + _FinalStage productId(Nullable productId); + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ */ + _FinalStage revenueBasis(Optional revenueBasis); + + _FinalStage revenueBasis(AffiliateRevenueBases revenueBasis); + + _FinalStage revenueBasis(Nullable revenueBasis); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CommissionTypeStage, + CommissionValueStage, + IdStage, + OverrideTypeStage, + TotalReferralEarningsUsdStage, + _FinalStage { + private AffiliatePayoutTypes commissionType; + + private double commissionValue; + + private String id; + + private AffiliateOverrideRoles overrideType; + + private double totalReferralEarningsUsd; + + private Optional revenueBasis = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional productDirectLink = Optional.empty(); + + private Optional planId = Optional.empty(); + + private Optional checkoutDirectLink = Optional.empty(); + + private Optional appliesToProducts = Optional.empty(); + + private Optional appliesToPayments = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOverridesResponse other) { + appliesToPayments(other.getAppliesToPayments()); + appliesToProducts(other.getAppliesToProducts()); + checkoutDirectLink(other.getCheckoutDirectLink()); + commissionType(other.getCommissionType()); + commissionValue(other.getCommissionValue()); + id(other.getId()); + overrideType(other.getOverrideType()); + planId(other.getPlanId()); + productDirectLink(other.getProductDirectLink()); + productId(other.getProductId()); + revenueBasis(other.getRevenueBasis()); + totalReferralEarningsUsd(other.getTotalReferralEarningsUsd()); + return this; + } + + /** + *

The type of commission (percentage or flat_fee).

+ *

The type of commission (percentage or flat_fee).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("commission_type") + public CommissionValueStage commissionType(@NotNull AffiliatePayoutTypes commissionType) { + this.commissionType = Objects.requireNonNull(commissionType, "commissionType must not be null"); + return this; + } + + /** + *

The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee.

+ *

The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("commission_value") + public IdStage commissionValue(double commissionValue) { + this.commissionValue = commissionValue; + return this; + } + + /** + *

The unique identifier for the affiliate override.

+ *

The unique identifier for the affiliate override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OverrideTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of override (standard or rev_share).

+ *

The type of override (standard or rev_share).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("override_type") + public TotalReferralEarningsUsdStage overrideType(@NotNull AffiliateOverrideRoles overrideType) { + this.overrideType = Objects.requireNonNull(overrideType, "overrideType must not be null"); + return this; + } + + /** + *

The total earnings paid to this affiliate for referrals to this specific plan, in USD.

+ *

The total earnings paid to this affiliate for referrals to this specific plan, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_referral_earnings_usd") + public _FinalStage totalReferralEarningsUsd(double totalReferralEarningsUsd) { + this.totalReferralEarningsUsd = totalReferralEarningsUsd; + return this; + } + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage revenueBasis(Nullable revenueBasis) { + if (revenueBasis.isNull()) { + this.revenueBasis = null; + } else if (revenueBasis.isEmpty()) { + this.revenueBasis = Optional.empty(); + } else { + this.revenueBasis = Optional.of(revenueBasis.get()); + } + return this; + } + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage revenueBasis(AffiliateRevenueBases revenueBasis) { + this.revenueBasis = Optional.ofNullable(revenueBasis); + return this; + } + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ */ + @java.lang.Override + @JsonSetter(value = "revenue_basis", nulls = Nulls.SKIP) + public _FinalStage revenueBasis(Optional revenueBasis) { + this.revenueBasis = revenueBasis; + return this; + } + + /** + *

The product ID (for rev-share overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + /** + *

The product ID (for rev-share overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

The product ID (for rev-share overrides).

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

The product page direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productDirectLink(Nullable productDirectLink) { + if (productDirectLink.isNull()) { + this.productDirectLink = null; + } else if (productDirectLink.isEmpty()) { + this.productDirectLink = Optional.empty(); + } else { + this.productDirectLink = Optional.of(productDirectLink.get()); + } + return this; + } + + /** + *

The product page direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productDirectLink(String productDirectLink) { + this.productDirectLink = Optional.ofNullable(productDirectLink); + return this; + } + + /** + *

The product page direct link for referrals (standard overrides only).

+ */ + @java.lang.Override + @JsonSetter(value = "product_direct_link", nulls = Nulls.SKIP) + public _FinalStage productDirectLink(Optional productDirectLink) { + this.productDirectLink = productDirectLink; + return this; + } + + /** + *

The plan ID (for standard overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planId(Nullable planId) { + if (planId.isNull()) { + this.planId = null; + } else if (planId.isEmpty()) { + this.planId = Optional.empty(); + } else { + this.planId = Optional.of(planId.get()); + } + return this; + } + + /** + *

The plan ID (for standard overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planId(String planId) { + this.planId = Optional.ofNullable(planId); + return this; + } + + /** + *

The plan ID (for standard overrides).

+ */ + @java.lang.Override + @JsonSetter(value = "plan_id", nulls = Nulls.SKIP) + public _FinalStage planId(Optional planId) { + this.planId = planId; + return this; + } + + /** + *

The checkout direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutDirectLink(Nullable checkoutDirectLink) { + if (checkoutDirectLink.isNull()) { + this.checkoutDirectLink = null; + } else if (checkoutDirectLink.isEmpty()) { + this.checkoutDirectLink = Optional.empty(); + } else { + this.checkoutDirectLink = Optional.of(checkoutDirectLink.get()); + } + return this; + } + + /** + *

The checkout direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutDirectLink(String checkoutDirectLink) { + this.checkoutDirectLink = Optional.ofNullable(checkoutDirectLink); + return this; + } + + /** + *

The checkout direct link for referrals (standard overrides only).

+ */ + @java.lang.Override + @JsonSetter(value = "checkout_direct_link", nulls = Nulls.SKIP) + public _FinalStage checkoutDirectLink(Optional checkoutDirectLink) { + this.checkoutDirectLink = checkoutDirectLink; + return this; + } + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToProducts(Nullable appliesToProducts) { + if (appliesToProducts.isNull()) { + this.appliesToProducts = null; + } else if (appliesToProducts.isEmpty()) { + this.appliesToProducts = Optional.empty(); + } else { + this.appliesToProducts = Optional.of(appliesToProducts.get()); + } + return this; + } + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToProducts(AffiliateAppliesToProducts appliesToProducts) { + this.appliesToProducts = Optional.ofNullable(appliesToProducts); + return this; + } + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ */ + @java.lang.Override + @JsonSetter(value = "applies_to_products", nulls = Nulls.SKIP) + public _FinalStage appliesToProducts(Optional appliesToProducts) { + this.appliesToProducts = appliesToProducts; + return this; + } + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToPayments(Nullable appliesToPayments) { + if (appliesToPayments.isNull()) { + this.appliesToPayments = null; + } else if (appliesToPayments.isEmpty()) { + this.appliesToPayments = Optional.empty(); + } else { + this.appliesToPayments = Optional.of(appliesToPayments.get()); + } + return this; + } + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToPayments(AffiliateAppliesToPayments appliesToPayments) { + this.appliesToPayments = Optional.ofNullable(appliesToPayments); + return this; + } + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ */ + @java.lang.Override + @JsonSetter(value = "applies_to_payments", nulls = Nulls.SKIP) + public _FinalStage appliesToPayments(Optional appliesToPayments) { + this.appliesToPayments = appliesToPayments; + return this; + } + + @java.lang.Override + public CreateOverridesResponse build() { + return new CreateOverridesResponse( + appliesToPayments, + appliesToProducts, + checkoutDirectLink, + commissionType, + commissionValue, + id, + overrideType, + planId, + productDirectLink, + productId, + revenueBasis, + totalReferralEarningsUsd, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/types/ListOverridesResponse.java b/src/main/java/com/whop/api/resources/affiliates/overrides/types/ListOverridesResponse.java new file mode 100644 index 00000000..67848be8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/types/ListOverridesResponse.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListOverridesResponse.Builder.class) +public final class ListOverridesResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListOverridesResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListOverridesResponse && equalTo((ListOverridesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListOverridesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListOverridesResponse other); + } + + public interface _FinalStage { + ListOverridesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(ListOverridesResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListOverridesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(ListOverridesResponseDataItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListOverridesResponse build() { + return new ListOverridesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/types/ListOverridesResponseDataItem.java b/src/main/java/com/whop/api/resources/affiliates/overrides/types/ListOverridesResponseDataItem.java new file mode 100644 index 00000000..cf2b2231 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/types/ListOverridesResponseDataItem.java @@ -0,0 +1,802 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AffiliateAppliesToPayments; +import com.whop.api.types.AffiliateAppliesToProducts; +import com.whop.api.types.AffiliateOverrideRoles; +import com.whop.api.types.AffiliatePayoutTypes; +import com.whop.api.types.AffiliateRevenueBases; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListOverridesResponseDataItem.Builder.class) +public final class ListOverridesResponseDataItem { + private final Optional appliesToPayments; + + private final Optional appliesToProducts; + + private final Optional checkoutDirectLink; + + private final AffiliatePayoutTypes commissionType; + + private final double commissionValue; + + private final String id; + + private final AffiliateOverrideRoles overrideType; + + private final Optional planId; + + private final Optional productDirectLink; + + private final Optional productId; + + private final Optional revenueBasis; + + private final double totalReferralEarningsUsd; + + private final Map additionalProperties; + + private ListOverridesResponseDataItem( + Optional appliesToPayments, + Optional appliesToProducts, + Optional checkoutDirectLink, + AffiliatePayoutTypes commissionType, + double commissionValue, + String id, + AffiliateOverrideRoles overrideType, + Optional planId, + Optional productDirectLink, + Optional productId, + Optional revenueBasis, + double totalReferralEarningsUsd, + Map additionalProperties) { + this.appliesToPayments = appliesToPayments; + this.appliesToProducts = appliesToProducts; + this.checkoutDirectLink = checkoutDirectLink; + this.commissionType = commissionType; + this.commissionValue = commissionValue; + this.id = id; + this.overrideType = overrideType; + this.planId = planId; + this.productDirectLink = productDirectLink; + this.productId = productId; + this.revenueBasis = revenueBasis; + this.totalReferralEarningsUsd = totalReferralEarningsUsd; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the commission applies to the first payment only or all payments (standard overrides only). + */ + @JsonIgnore + public Optional getAppliesToPayments() { + if (appliesToPayments == null) { + return Optional.empty(); + } + return appliesToPayments; + } + + /** + * @return Whether this rev-share override applies to a single product or all products (rev-share only). + */ + @JsonIgnore + public Optional getAppliesToProducts() { + if (appliesToProducts == null) { + return Optional.empty(); + } + return appliesToProducts; + } + + /** + * @return The checkout direct link for referrals (standard overrides only). + */ + @JsonIgnore + public Optional getCheckoutDirectLink() { + if (checkoutDirectLink == null) { + return Optional.empty(); + } + return checkoutDirectLink; + } + + /** + * @return The type of commission (percentage or flat_fee). + */ + @JsonProperty("commission_type") + public AffiliatePayoutTypes getCommissionType() { + return commissionType; + } + + /** + * @return The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee. + */ + @JsonProperty("commission_value") + public double getCommissionValue() { + return commissionValue; + } + + /** + * @return The unique identifier for the affiliate override. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of override (standard or rev_share). + */ + @JsonProperty("override_type") + public AffiliateOverrideRoles getOverrideType() { + return overrideType; + } + + /** + * @return The plan ID (for standard overrides). + */ + @JsonIgnore + public Optional getPlanId() { + if (planId == null) { + return Optional.empty(); + } + return planId; + } + + /** + * @return The product page direct link for referrals (standard overrides only). + */ + @JsonIgnore + public Optional getProductDirectLink() { + if (productDirectLink == null) { + return Optional.empty(); + } + return productDirectLink; + } + + /** + * @return The product ID (for rev-share overrides). + */ + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + /** + * @return The revenue calculation basis (pre_fees or post_fees). + */ + @JsonIgnore + public Optional getRevenueBasis() { + if (revenueBasis == null) { + return Optional.empty(); + } + return revenueBasis; + } + + /** + * @return The total earnings paid to this affiliate for referrals to this specific plan, in USD. + */ + @JsonProperty("total_referral_earnings_usd") + public double getTotalReferralEarningsUsd() { + return totalReferralEarningsUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("applies_to_payments") + private Optional _getAppliesToPayments() { + return appliesToPayments; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("applies_to_products") + private Optional _getAppliesToProducts() { + return appliesToProducts; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_direct_link") + private Optional _getCheckoutDirectLink() { + return checkoutDirectLink; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan_id") + private Optional _getPlanId() { + return planId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_direct_link") + private Optional _getProductDirectLink() { + return productDirectLink; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("revenue_basis") + private Optional _getRevenueBasis() { + return revenueBasis; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListOverridesResponseDataItem && equalTo((ListOverridesResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListOverridesResponseDataItem other) { + return appliesToPayments.equals(other.appliesToPayments) + && appliesToProducts.equals(other.appliesToProducts) + && checkoutDirectLink.equals(other.checkoutDirectLink) + && commissionType.equals(other.commissionType) + && commissionValue == other.commissionValue + && id.equals(other.id) + && overrideType.equals(other.overrideType) + && planId.equals(other.planId) + && productDirectLink.equals(other.productDirectLink) + && productId.equals(other.productId) + && revenueBasis.equals(other.revenueBasis) + && totalReferralEarningsUsd == other.totalReferralEarningsUsd; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appliesToPayments, + this.appliesToProducts, + this.checkoutDirectLink, + this.commissionType, + this.commissionValue, + this.id, + this.overrideType, + this.planId, + this.productDirectLink, + this.productId, + this.revenueBasis, + this.totalReferralEarningsUsd); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CommissionTypeStage builder() { + return new Builder(); + } + + public interface CommissionTypeStage { + /** + *

The type of commission (percentage or flat_fee).

+ */ + CommissionValueStage commissionType(@NotNull AffiliatePayoutTypes commissionType); + + Builder from(ListOverridesResponseDataItem other); + } + + public interface CommissionValueStage { + /** + *

The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee.

+ */ + IdStage commissionValue(double commissionValue); + } + + public interface IdStage { + /** + *

The unique identifier for the affiliate override.

+ */ + OverrideTypeStage id(@NotNull String id); + } + + public interface OverrideTypeStage { + /** + *

The type of override (standard or rev_share).

+ */ + TotalReferralEarningsUsdStage overrideType(@NotNull AffiliateOverrideRoles overrideType); + } + + public interface TotalReferralEarningsUsdStage { + /** + *

The total earnings paid to this affiliate for referrals to this specific plan, in USD.

+ */ + _FinalStage totalReferralEarningsUsd(double totalReferralEarningsUsd); + } + + public interface _FinalStage { + ListOverridesResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ */ + _FinalStage appliesToPayments(Optional appliesToPayments); + + _FinalStage appliesToPayments(AffiliateAppliesToPayments appliesToPayments); + + _FinalStage appliesToPayments(Nullable appliesToPayments); + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ */ + _FinalStage appliesToProducts(Optional appliesToProducts); + + _FinalStage appliesToProducts(AffiliateAppliesToProducts appliesToProducts); + + _FinalStage appliesToProducts(Nullable appliesToProducts); + + /** + *

The checkout direct link for referrals (standard overrides only).

+ */ + _FinalStage checkoutDirectLink(Optional checkoutDirectLink); + + _FinalStage checkoutDirectLink(String checkoutDirectLink); + + _FinalStage checkoutDirectLink(Nullable checkoutDirectLink); + + /** + *

The plan ID (for standard overrides).

+ */ + _FinalStage planId(Optional planId); + + _FinalStage planId(String planId); + + _FinalStage planId(Nullable planId); + + /** + *

The product page direct link for referrals (standard overrides only).

+ */ + _FinalStage productDirectLink(Optional productDirectLink); + + _FinalStage productDirectLink(String productDirectLink); + + _FinalStage productDirectLink(Nullable productDirectLink); + + /** + *

The product ID (for rev-share overrides).

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + + _FinalStage productId(Nullable productId); + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ */ + _FinalStage revenueBasis(Optional revenueBasis); + + _FinalStage revenueBasis(AffiliateRevenueBases revenueBasis); + + _FinalStage revenueBasis(Nullable revenueBasis); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CommissionTypeStage, + CommissionValueStage, + IdStage, + OverrideTypeStage, + TotalReferralEarningsUsdStage, + _FinalStage { + private AffiliatePayoutTypes commissionType; + + private double commissionValue; + + private String id; + + private AffiliateOverrideRoles overrideType; + + private double totalReferralEarningsUsd; + + private Optional revenueBasis = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional productDirectLink = Optional.empty(); + + private Optional planId = Optional.empty(); + + private Optional checkoutDirectLink = Optional.empty(); + + private Optional appliesToProducts = Optional.empty(); + + private Optional appliesToPayments = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListOverridesResponseDataItem other) { + appliesToPayments(other.getAppliesToPayments()); + appliesToProducts(other.getAppliesToProducts()); + checkoutDirectLink(other.getCheckoutDirectLink()); + commissionType(other.getCommissionType()); + commissionValue(other.getCommissionValue()); + id(other.getId()); + overrideType(other.getOverrideType()); + planId(other.getPlanId()); + productDirectLink(other.getProductDirectLink()); + productId(other.getProductId()); + revenueBasis(other.getRevenueBasis()); + totalReferralEarningsUsd(other.getTotalReferralEarningsUsd()); + return this; + } + + /** + *

The type of commission (percentage or flat_fee).

+ *

The type of commission (percentage or flat_fee).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("commission_type") + public CommissionValueStage commissionType(@NotNull AffiliatePayoutTypes commissionType) { + this.commissionType = Objects.requireNonNull(commissionType, "commissionType must not be null"); + return this; + } + + /** + *

The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee.

+ *

The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("commission_value") + public IdStage commissionValue(double commissionValue) { + this.commissionValue = commissionValue; + return this; + } + + /** + *

The unique identifier for the affiliate override.

+ *

The unique identifier for the affiliate override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OverrideTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of override (standard or rev_share).

+ *

The type of override (standard or rev_share).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("override_type") + public TotalReferralEarningsUsdStage overrideType(@NotNull AffiliateOverrideRoles overrideType) { + this.overrideType = Objects.requireNonNull(overrideType, "overrideType must not be null"); + return this; + } + + /** + *

The total earnings paid to this affiliate for referrals to this specific plan, in USD.

+ *

The total earnings paid to this affiliate for referrals to this specific plan, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_referral_earnings_usd") + public _FinalStage totalReferralEarningsUsd(double totalReferralEarningsUsd) { + this.totalReferralEarningsUsd = totalReferralEarningsUsd; + return this; + } + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage revenueBasis(Nullable revenueBasis) { + if (revenueBasis.isNull()) { + this.revenueBasis = null; + } else if (revenueBasis.isEmpty()) { + this.revenueBasis = Optional.empty(); + } else { + this.revenueBasis = Optional.of(revenueBasis.get()); + } + return this; + } + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage revenueBasis(AffiliateRevenueBases revenueBasis) { + this.revenueBasis = Optional.ofNullable(revenueBasis); + return this; + } + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ */ + @java.lang.Override + @JsonSetter(value = "revenue_basis", nulls = Nulls.SKIP) + public _FinalStage revenueBasis(Optional revenueBasis) { + this.revenueBasis = revenueBasis; + return this; + } + + /** + *

The product ID (for rev-share overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + /** + *

The product ID (for rev-share overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

The product ID (for rev-share overrides).

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

The product page direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productDirectLink(Nullable productDirectLink) { + if (productDirectLink.isNull()) { + this.productDirectLink = null; + } else if (productDirectLink.isEmpty()) { + this.productDirectLink = Optional.empty(); + } else { + this.productDirectLink = Optional.of(productDirectLink.get()); + } + return this; + } + + /** + *

The product page direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productDirectLink(String productDirectLink) { + this.productDirectLink = Optional.ofNullable(productDirectLink); + return this; + } + + /** + *

The product page direct link for referrals (standard overrides only).

+ */ + @java.lang.Override + @JsonSetter(value = "product_direct_link", nulls = Nulls.SKIP) + public _FinalStage productDirectLink(Optional productDirectLink) { + this.productDirectLink = productDirectLink; + return this; + } + + /** + *

The plan ID (for standard overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planId(Nullable planId) { + if (planId.isNull()) { + this.planId = null; + } else if (planId.isEmpty()) { + this.planId = Optional.empty(); + } else { + this.planId = Optional.of(planId.get()); + } + return this; + } + + /** + *

The plan ID (for standard overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planId(String planId) { + this.planId = Optional.ofNullable(planId); + return this; + } + + /** + *

The plan ID (for standard overrides).

+ */ + @java.lang.Override + @JsonSetter(value = "plan_id", nulls = Nulls.SKIP) + public _FinalStage planId(Optional planId) { + this.planId = planId; + return this; + } + + /** + *

The checkout direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutDirectLink(Nullable checkoutDirectLink) { + if (checkoutDirectLink.isNull()) { + this.checkoutDirectLink = null; + } else if (checkoutDirectLink.isEmpty()) { + this.checkoutDirectLink = Optional.empty(); + } else { + this.checkoutDirectLink = Optional.of(checkoutDirectLink.get()); + } + return this; + } + + /** + *

The checkout direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutDirectLink(String checkoutDirectLink) { + this.checkoutDirectLink = Optional.ofNullable(checkoutDirectLink); + return this; + } + + /** + *

The checkout direct link for referrals (standard overrides only).

+ */ + @java.lang.Override + @JsonSetter(value = "checkout_direct_link", nulls = Nulls.SKIP) + public _FinalStage checkoutDirectLink(Optional checkoutDirectLink) { + this.checkoutDirectLink = checkoutDirectLink; + return this; + } + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToProducts(Nullable appliesToProducts) { + if (appliesToProducts.isNull()) { + this.appliesToProducts = null; + } else if (appliesToProducts.isEmpty()) { + this.appliesToProducts = Optional.empty(); + } else { + this.appliesToProducts = Optional.of(appliesToProducts.get()); + } + return this; + } + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToProducts(AffiliateAppliesToProducts appliesToProducts) { + this.appliesToProducts = Optional.ofNullable(appliesToProducts); + return this; + } + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ */ + @java.lang.Override + @JsonSetter(value = "applies_to_products", nulls = Nulls.SKIP) + public _FinalStage appliesToProducts(Optional appliesToProducts) { + this.appliesToProducts = appliesToProducts; + return this; + } + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToPayments(Nullable appliesToPayments) { + if (appliesToPayments.isNull()) { + this.appliesToPayments = null; + } else if (appliesToPayments.isEmpty()) { + this.appliesToPayments = Optional.empty(); + } else { + this.appliesToPayments = Optional.of(appliesToPayments.get()); + } + return this; + } + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToPayments(AffiliateAppliesToPayments appliesToPayments) { + this.appliesToPayments = Optional.ofNullable(appliesToPayments); + return this; + } + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ */ + @java.lang.Override + @JsonSetter(value = "applies_to_payments", nulls = Nulls.SKIP) + public _FinalStage appliesToPayments(Optional appliesToPayments) { + this.appliesToPayments = appliesToPayments; + return this; + } + + @java.lang.Override + public ListOverridesResponseDataItem build() { + return new ListOverridesResponseDataItem( + appliesToPayments, + appliesToProducts, + checkoutDirectLink, + commissionType, + commissionValue, + id, + overrideType, + planId, + productDirectLink, + productId, + revenueBasis, + totalReferralEarningsUsd, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/types/RetrieveOverridesResponse.java b/src/main/java/com/whop/api/resources/affiliates/overrides/types/RetrieveOverridesResponse.java new file mode 100644 index 00000000..676f4abb --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/types/RetrieveOverridesResponse.java @@ -0,0 +1,802 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AffiliateAppliesToPayments; +import com.whop.api.types.AffiliateAppliesToProducts; +import com.whop.api.types.AffiliateOverrideRoles; +import com.whop.api.types.AffiliatePayoutTypes; +import com.whop.api.types.AffiliateRevenueBases; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveOverridesResponse.Builder.class) +public final class RetrieveOverridesResponse { + private final Optional appliesToPayments; + + private final Optional appliesToProducts; + + private final Optional checkoutDirectLink; + + private final AffiliatePayoutTypes commissionType; + + private final double commissionValue; + + private final String id; + + private final AffiliateOverrideRoles overrideType; + + private final Optional planId; + + private final Optional productDirectLink; + + private final Optional productId; + + private final Optional revenueBasis; + + private final double totalReferralEarningsUsd; + + private final Map additionalProperties; + + private RetrieveOverridesResponse( + Optional appliesToPayments, + Optional appliesToProducts, + Optional checkoutDirectLink, + AffiliatePayoutTypes commissionType, + double commissionValue, + String id, + AffiliateOverrideRoles overrideType, + Optional planId, + Optional productDirectLink, + Optional productId, + Optional revenueBasis, + double totalReferralEarningsUsd, + Map additionalProperties) { + this.appliesToPayments = appliesToPayments; + this.appliesToProducts = appliesToProducts; + this.checkoutDirectLink = checkoutDirectLink; + this.commissionType = commissionType; + this.commissionValue = commissionValue; + this.id = id; + this.overrideType = overrideType; + this.planId = planId; + this.productDirectLink = productDirectLink; + this.productId = productId; + this.revenueBasis = revenueBasis; + this.totalReferralEarningsUsd = totalReferralEarningsUsd; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the commission applies to the first payment only or all payments (standard overrides only). + */ + @JsonIgnore + public Optional getAppliesToPayments() { + if (appliesToPayments == null) { + return Optional.empty(); + } + return appliesToPayments; + } + + /** + * @return Whether this rev-share override applies to a single product or all products (rev-share only). + */ + @JsonIgnore + public Optional getAppliesToProducts() { + if (appliesToProducts == null) { + return Optional.empty(); + } + return appliesToProducts; + } + + /** + * @return The checkout direct link for referrals (standard overrides only). + */ + @JsonIgnore + public Optional getCheckoutDirectLink() { + if (checkoutDirectLink == null) { + return Optional.empty(); + } + return checkoutDirectLink; + } + + /** + * @return The type of commission (percentage or flat_fee). + */ + @JsonProperty("commission_type") + public AffiliatePayoutTypes getCommissionType() { + return commissionType; + } + + /** + * @return The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee. + */ + @JsonProperty("commission_value") + public double getCommissionValue() { + return commissionValue; + } + + /** + * @return The unique identifier for the affiliate override. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of override (standard or rev_share). + */ + @JsonProperty("override_type") + public AffiliateOverrideRoles getOverrideType() { + return overrideType; + } + + /** + * @return The plan ID (for standard overrides). + */ + @JsonIgnore + public Optional getPlanId() { + if (planId == null) { + return Optional.empty(); + } + return planId; + } + + /** + * @return The product page direct link for referrals (standard overrides only). + */ + @JsonIgnore + public Optional getProductDirectLink() { + if (productDirectLink == null) { + return Optional.empty(); + } + return productDirectLink; + } + + /** + * @return The product ID (for rev-share overrides). + */ + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + /** + * @return The revenue calculation basis (pre_fees or post_fees). + */ + @JsonIgnore + public Optional getRevenueBasis() { + if (revenueBasis == null) { + return Optional.empty(); + } + return revenueBasis; + } + + /** + * @return The total earnings paid to this affiliate for referrals to this specific plan, in USD. + */ + @JsonProperty("total_referral_earnings_usd") + public double getTotalReferralEarningsUsd() { + return totalReferralEarningsUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("applies_to_payments") + private Optional _getAppliesToPayments() { + return appliesToPayments; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("applies_to_products") + private Optional _getAppliesToProducts() { + return appliesToProducts; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_direct_link") + private Optional _getCheckoutDirectLink() { + return checkoutDirectLink; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan_id") + private Optional _getPlanId() { + return planId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_direct_link") + private Optional _getProductDirectLink() { + return productDirectLink; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("revenue_basis") + private Optional _getRevenueBasis() { + return revenueBasis; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveOverridesResponse && equalTo((RetrieveOverridesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveOverridesResponse other) { + return appliesToPayments.equals(other.appliesToPayments) + && appliesToProducts.equals(other.appliesToProducts) + && checkoutDirectLink.equals(other.checkoutDirectLink) + && commissionType.equals(other.commissionType) + && commissionValue == other.commissionValue + && id.equals(other.id) + && overrideType.equals(other.overrideType) + && planId.equals(other.planId) + && productDirectLink.equals(other.productDirectLink) + && productId.equals(other.productId) + && revenueBasis.equals(other.revenueBasis) + && totalReferralEarningsUsd == other.totalReferralEarningsUsd; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appliesToPayments, + this.appliesToProducts, + this.checkoutDirectLink, + this.commissionType, + this.commissionValue, + this.id, + this.overrideType, + this.planId, + this.productDirectLink, + this.productId, + this.revenueBasis, + this.totalReferralEarningsUsd); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CommissionTypeStage builder() { + return new Builder(); + } + + public interface CommissionTypeStage { + /** + *

The type of commission (percentage or flat_fee).

+ */ + CommissionValueStage commissionType(@NotNull AffiliatePayoutTypes commissionType); + + Builder from(RetrieveOverridesResponse other); + } + + public interface CommissionValueStage { + /** + *

The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee.

+ */ + IdStage commissionValue(double commissionValue); + } + + public interface IdStage { + /** + *

The unique identifier for the affiliate override.

+ */ + OverrideTypeStage id(@NotNull String id); + } + + public interface OverrideTypeStage { + /** + *

The type of override (standard or rev_share).

+ */ + TotalReferralEarningsUsdStage overrideType(@NotNull AffiliateOverrideRoles overrideType); + } + + public interface TotalReferralEarningsUsdStage { + /** + *

The total earnings paid to this affiliate for referrals to this specific plan, in USD.

+ */ + _FinalStage totalReferralEarningsUsd(double totalReferralEarningsUsd); + } + + public interface _FinalStage { + RetrieveOverridesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ */ + _FinalStage appliesToPayments(Optional appliesToPayments); + + _FinalStage appliesToPayments(AffiliateAppliesToPayments appliesToPayments); + + _FinalStage appliesToPayments(Nullable appliesToPayments); + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ */ + _FinalStage appliesToProducts(Optional appliesToProducts); + + _FinalStage appliesToProducts(AffiliateAppliesToProducts appliesToProducts); + + _FinalStage appliesToProducts(Nullable appliesToProducts); + + /** + *

The checkout direct link for referrals (standard overrides only).

+ */ + _FinalStage checkoutDirectLink(Optional checkoutDirectLink); + + _FinalStage checkoutDirectLink(String checkoutDirectLink); + + _FinalStage checkoutDirectLink(Nullable checkoutDirectLink); + + /** + *

The plan ID (for standard overrides).

+ */ + _FinalStage planId(Optional planId); + + _FinalStage planId(String planId); + + _FinalStage planId(Nullable planId); + + /** + *

The product page direct link for referrals (standard overrides only).

+ */ + _FinalStage productDirectLink(Optional productDirectLink); + + _FinalStage productDirectLink(String productDirectLink); + + _FinalStage productDirectLink(Nullable productDirectLink); + + /** + *

The product ID (for rev-share overrides).

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + + _FinalStage productId(Nullable productId); + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ */ + _FinalStage revenueBasis(Optional revenueBasis); + + _FinalStage revenueBasis(AffiliateRevenueBases revenueBasis); + + _FinalStage revenueBasis(Nullable revenueBasis); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CommissionTypeStage, + CommissionValueStage, + IdStage, + OverrideTypeStage, + TotalReferralEarningsUsdStage, + _FinalStage { + private AffiliatePayoutTypes commissionType; + + private double commissionValue; + + private String id; + + private AffiliateOverrideRoles overrideType; + + private double totalReferralEarningsUsd; + + private Optional revenueBasis = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional productDirectLink = Optional.empty(); + + private Optional planId = Optional.empty(); + + private Optional checkoutDirectLink = Optional.empty(); + + private Optional appliesToProducts = Optional.empty(); + + private Optional appliesToPayments = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveOverridesResponse other) { + appliesToPayments(other.getAppliesToPayments()); + appliesToProducts(other.getAppliesToProducts()); + checkoutDirectLink(other.getCheckoutDirectLink()); + commissionType(other.getCommissionType()); + commissionValue(other.getCommissionValue()); + id(other.getId()); + overrideType(other.getOverrideType()); + planId(other.getPlanId()); + productDirectLink(other.getProductDirectLink()); + productId(other.getProductId()); + revenueBasis(other.getRevenueBasis()); + totalReferralEarningsUsd(other.getTotalReferralEarningsUsd()); + return this; + } + + /** + *

The type of commission (percentage or flat_fee).

+ *

The type of commission (percentage or flat_fee).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("commission_type") + public CommissionValueStage commissionType(@NotNull AffiliatePayoutTypes commissionType) { + this.commissionType = Objects.requireNonNull(commissionType, "commissionType must not be null"); + return this; + } + + /** + *

The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee.

+ *

The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("commission_value") + public IdStage commissionValue(double commissionValue) { + this.commissionValue = commissionValue; + return this; + } + + /** + *

The unique identifier for the affiliate override.

+ *

The unique identifier for the affiliate override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OverrideTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of override (standard or rev_share).

+ *

The type of override (standard or rev_share).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("override_type") + public TotalReferralEarningsUsdStage overrideType(@NotNull AffiliateOverrideRoles overrideType) { + this.overrideType = Objects.requireNonNull(overrideType, "overrideType must not be null"); + return this; + } + + /** + *

The total earnings paid to this affiliate for referrals to this specific plan, in USD.

+ *

The total earnings paid to this affiliate for referrals to this specific plan, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_referral_earnings_usd") + public _FinalStage totalReferralEarningsUsd(double totalReferralEarningsUsd) { + this.totalReferralEarningsUsd = totalReferralEarningsUsd; + return this; + } + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage revenueBasis(Nullable revenueBasis) { + if (revenueBasis.isNull()) { + this.revenueBasis = null; + } else if (revenueBasis.isEmpty()) { + this.revenueBasis = Optional.empty(); + } else { + this.revenueBasis = Optional.of(revenueBasis.get()); + } + return this; + } + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage revenueBasis(AffiliateRevenueBases revenueBasis) { + this.revenueBasis = Optional.ofNullable(revenueBasis); + return this; + } + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ */ + @java.lang.Override + @JsonSetter(value = "revenue_basis", nulls = Nulls.SKIP) + public _FinalStage revenueBasis(Optional revenueBasis) { + this.revenueBasis = revenueBasis; + return this; + } + + /** + *

The product ID (for rev-share overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + /** + *

The product ID (for rev-share overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

The product ID (for rev-share overrides).

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

The product page direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productDirectLink(Nullable productDirectLink) { + if (productDirectLink.isNull()) { + this.productDirectLink = null; + } else if (productDirectLink.isEmpty()) { + this.productDirectLink = Optional.empty(); + } else { + this.productDirectLink = Optional.of(productDirectLink.get()); + } + return this; + } + + /** + *

The product page direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productDirectLink(String productDirectLink) { + this.productDirectLink = Optional.ofNullable(productDirectLink); + return this; + } + + /** + *

The product page direct link for referrals (standard overrides only).

+ */ + @java.lang.Override + @JsonSetter(value = "product_direct_link", nulls = Nulls.SKIP) + public _FinalStage productDirectLink(Optional productDirectLink) { + this.productDirectLink = productDirectLink; + return this; + } + + /** + *

The plan ID (for standard overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planId(Nullable planId) { + if (planId.isNull()) { + this.planId = null; + } else if (planId.isEmpty()) { + this.planId = Optional.empty(); + } else { + this.planId = Optional.of(planId.get()); + } + return this; + } + + /** + *

The plan ID (for standard overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planId(String planId) { + this.planId = Optional.ofNullable(planId); + return this; + } + + /** + *

The plan ID (for standard overrides).

+ */ + @java.lang.Override + @JsonSetter(value = "plan_id", nulls = Nulls.SKIP) + public _FinalStage planId(Optional planId) { + this.planId = planId; + return this; + } + + /** + *

The checkout direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutDirectLink(Nullable checkoutDirectLink) { + if (checkoutDirectLink.isNull()) { + this.checkoutDirectLink = null; + } else if (checkoutDirectLink.isEmpty()) { + this.checkoutDirectLink = Optional.empty(); + } else { + this.checkoutDirectLink = Optional.of(checkoutDirectLink.get()); + } + return this; + } + + /** + *

The checkout direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutDirectLink(String checkoutDirectLink) { + this.checkoutDirectLink = Optional.ofNullable(checkoutDirectLink); + return this; + } + + /** + *

The checkout direct link for referrals (standard overrides only).

+ */ + @java.lang.Override + @JsonSetter(value = "checkout_direct_link", nulls = Nulls.SKIP) + public _FinalStage checkoutDirectLink(Optional checkoutDirectLink) { + this.checkoutDirectLink = checkoutDirectLink; + return this; + } + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToProducts(Nullable appliesToProducts) { + if (appliesToProducts.isNull()) { + this.appliesToProducts = null; + } else if (appliesToProducts.isEmpty()) { + this.appliesToProducts = Optional.empty(); + } else { + this.appliesToProducts = Optional.of(appliesToProducts.get()); + } + return this; + } + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToProducts(AffiliateAppliesToProducts appliesToProducts) { + this.appliesToProducts = Optional.ofNullable(appliesToProducts); + return this; + } + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ */ + @java.lang.Override + @JsonSetter(value = "applies_to_products", nulls = Nulls.SKIP) + public _FinalStage appliesToProducts(Optional appliesToProducts) { + this.appliesToProducts = appliesToProducts; + return this; + } + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToPayments(Nullable appliesToPayments) { + if (appliesToPayments.isNull()) { + this.appliesToPayments = null; + } else if (appliesToPayments.isEmpty()) { + this.appliesToPayments = Optional.empty(); + } else { + this.appliesToPayments = Optional.of(appliesToPayments.get()); + } + return this; + } + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToPayments(AffiliateAppliesToPayments appliesToPayments) { + this.appliesToPayments = Optional.ofNullable(appliesToPayments); + return this; + } + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ */ + @java.lang.Override + @JsonSetter(value = "applies_to_payments", nulls = Nulls.SKIP) + public _FinalStage appliesToPayments(Optional appliesToPayments) { + this.appliesToPayments = appliesToPayments; + return this; + } + + @java.lang.Override + public RetrieveOverridesResponse build() { + return new RetrieveOverridesResponse( + appliesToPayments, + appliesToProducts, + checkoutDirectLink, + commissionType, + commissionValue, + id, + overrideType, + planId, + productDirectLink, + productId, + revenueBasis, + totalReferralEarningsUsd, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/overrides/types/UpdateOverridesResponse.java b/src/main/java/com/whop/api/resources/affiliates/overrides/types/UpdateOverridesResponse.java new file mode 100644 index 00000000..1a6ea069 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/overrides/types/UpdateOverridesResponse.java @@ -0,0 +1,802 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.overrides.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AffiliateAppliesToPayments; +import com.whop.api.types.AffiliateAppliesToProducts; +import com.whop.api.types.AffiliateOverrideRoles; +import com.whop.api.types.AffiliatePayoutTypes; +import com.whop.api.types.AffiliateRevenueBases; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateOverridesResponse.Builder.class) +public final class UpdateOverridesResponse { + private final Optional appliesToPayments; + + private final Optional appliesToProducts; + + private final Optional checkoutDirectLink; + + private final AffiliatePayoutTypes commissionType; + + private final double commissionValue; + + private final String id; + + private final AffiliateOverrideRoles overrideType; + + private final Optional planId; + + private final Optional productDirectLink; + + private final Optional productId; + + private final Optional revenueBasis; + + private final double totalReferralEarningsUsd; + + private final Map additionalProperties; + + private UpdateOverridesResponse( + Optional appliesToPayments, + Optional appliesToProducts, + Optional checkoutDirectLink, + AffiliatePayoutTypes commissionType, + double commissionValue, + String id, + AffiliateOverrideRoles overrideType, + Optional planId, + Optional productDirectLink, + Optional productId, + Optional revenueBasis, + double totalReferralEarningsUsd, + Map additionalProperties) { + this.appliesToPayments = appliesToPayments; + this.appliesToProducts = appliesToProducts; + this.checkoutDirectLink = checkoutDirectLink; + this.commissionType = commissionType; + this.commissionValue = commissionValue; + this.id = id; + this.overrideType = overrideType; + this.planId = planId; + this.productDirectLink = productDirectLink; + this.productId = productId; + this.revenueBasis = revenueBasis; + this.totalReferralEarningsUsd = totalReferralEarningsUsd; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the commission applies to the first payment only or all payments (standard overrides only). + */ + @JsonIgnore + public Optional getAppliesToPayments() { + if (appliesToPayments == null) { + return Optional.empty(); + } + return appliesToPayments; + } + + /** + * @return Whether this rev-share override applies to a single product or all products (rev-share only). + */ + @JsonIgnore + public Optional getAppliesToProducts() { + if (appliesToProducts == null) { + return Optional.empty(); + } + return appliesToProducts; + } + + /** + * @return The checkout direct link for referrals (standard overrides only). + */ + @JsonIgnore + public Optional getCheckoutDirectLink() { + if (checkoutDirectLink == null) { + return Optional.empty(); + } + return checkoutDirectLink; + } + + /** + * @return The type of commission (percentage or flat_fee). + */ + @JsonProperty("commission_type") + public AffiliatePayoutTypes getCommissionType() { + return commissionType; + } + + /** + * @return The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee. + */ + @JsonProperty("commission_value") + public double getCommissionValue() { + return commissionValue; + } + + /** + * @return The unique identifier for the affiliate override. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of override (standard or rev_share). + */ + @JsonProperty("override_type") + public AffiliateOverrideRoles getOverrideType() { + return overrideType; + } + + /** + * @return The plan ID (for standard overrides). + */ + @JsonIgnore + public Optional getPlanId() { + if (planId == null) { + return Optional.empty(); + } + return planId; + } + + /** + * @return The product page direct link for referrals (standard overrides only). + */ + @JsonIgnore + public Optional getProductDirectLink() { + if (productDirectLink == null) { + return Optional.empty(); + } + return productDirectLink; + } + + /** + * @return The product ID (for rev-share overrides). + */ + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + /** + * @return The revenue calculation basis (pre_fees or post_fees). + */ + @JsonIgnore + public Optional getRevenueBasis() { + if (revenueBasis == null) { + return Optional.empty(); + } + return revenueBasis; + } + + /** + * @return The total earnings paid to this affiliate for referrals to this specific plan, in USD. + */ + @JsonProperty("total_referral_earnings_usd") + public double getTotalReferralEarningsUsd() { + return totalReferralEarningsUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("applies_to_payments") + private Optional _getAppliesToPayments() { + return appliesToPayments; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("applies_to_products") + private Optional _getAppliesToProducts() { + return appliesToProducts; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_direct_link") + private Optional _getCheckoutDirectLink() { + return checkoutDirectLink; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan_id") + private Optional _getPlanId() { + return planId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_direct_link") + private Optional _getProductDirectLink() { + return productDirectLink; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("revenue_basis") + private Optional _getRevenueBasis() { + return revenueBasis; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateOverridesResponse && equalTo((UpdateOverridesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateOverridesResponse other) { + return appliesToPayments.equals(other.appliesToPayments) + && appliesToProducts.equals(other.appliesToProducts) + && checkoutDirectLink.equals(other.checkoutDirectLink) + && commissionType.equals(other.commissionType) + && commissionValue == other.commissionValue + && id.equals(other.id) + && overrideType.equals(other.overrideType) + && planId.equals(other.planId) + && productDirectLink.equals(other.productDirectLink) + && productId.equals(other.productId) + && revenueBasis.equals(other.revenueBasis) + && totalReferralEarningsUsd == other.totalReferralEarningsUsd; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appliesToPayments, + this.appliesToProducts, + this.checkoutDirectLink, + this.commissionType, + this.commissionValue, + this.id, + this.overrideType, + this.planId, + this.productDirectLink, + this.productId, + this.revenueBasis, + this.totalReferralEarningsUsd); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CommissionTypeStage builder() { + return new Builder(); + } + + public interface CommissionTypeStage { + /** + *

The type of commission (percentage or flat_fee).

+ */ + CommissionValueStage commissionType(@NotNull AffiliatePayoutTypes commissionType); + + Builder from(UpdateOverridesResponse other); + } + + public interface CommissionValueStage { + /** + *

The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee.

+ */ + IdStage commissionValue(double commissionValue); + } + + public interface IdStage { + /** + *

The unique identifier for the affiliate override.

+ */ + OverrideTypeStage id(@NotNull String id); + } + + public interface OverrideTypeStage { + /** + *

The type of override (standard or rev_share).

+ */ + TotalReferralEarningsUsdStage overrideType(@NotNull AffiliateOverrideRoles overrideType); + } + + public interface TotalReferralEarningsUsdStage { + /** + *

The total earnings paid to this affiliate for referrals to this specific plan, in USD.

+ */ + _FinalStage totalReferralEarningsUsd(double totalReferralEarningsUsd); + } + + public interface _FinalStage { + UpdateOverridesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ */ + _FinalStage appliesToPayments(Optional appliesToPayments); + + _FinalStage appliesToPayments(AffiliateAppliesToPayments appliesToPayments); + + _FinalStage appliesToPayments(Nullable appliesToPayments); + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ */ + _FinalStage appliesToProducts(Optional appliesToProducts); + + _FinalStage appliesToProducts(AffiliateAppliesToProducts appliesToProducts); + + _FinalStage appliesToProducts(Nullable appliesToProducts); + + /** + *

The checkout direct link for referrals (standard overrides only).

+ */ + _FinalStage checkoutDirectLink(Optional checkoutDirectLink); + + _FinalStage checkoutDirectLink(String checkoutDirectLink); + + _FinalStage checkoutDirectLink(Nullable checkoutDirectLink); + + /** + *

The plan ID (for standard overrides).

+ */ + _FinalStage planId(Optional planId); + + _FinalStage planId(String planId); + + _FinalStage planId(Nullable planId); + + /** + *

The product page direct link for referrals (standard overrides only).

+ */ + _FinalStage productDirectLink(Optional productDirectLink); + + _FinalStage productDirectLink(String productDirectLink); + + _FinalStage productDirectLink(Nullable productDirectLink); + + /** + *

The product ID (for rev-share overrides).

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + + _FinalStage productId(Nullable productId); + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ */ + _FinalStage revenueBasis(Optional revenueBasis); + + _FinalStage revenueBasis(AffiliateRevenueBases revenueBasis); + + _FinalStage revenueBasis(Nullable revenueBasis); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CommissionTypeStage, + CommissionValueStage, + IdStage, + OverrideTypeStage, + TotalReferralEarningsUsdStage, + _FinalStage { + private AffiliatePayoutTypes commissionType; + + private double commissionValue; + + private String id; + + private AffiliateOverrideRoles overrideType; + + private double totalReferralEarningsUsd; + + private Optional revenueBasis = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional productDirectLink = Optional.empty(); + + private Optional planId = Optional.empty(); + + private Optional checkoutDirectLink = Optional.empty(); + + private Optional appliesToProducts = Optional.empty(); + + private Optional appliesToPayments = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateOverridesResponse other) { + appliesToPayments(other.getAppliesToPayments()); + appliesToProducts(other.getAppliesToProducts()); + checkoutDirectLink(other.getCheckoutDirectLink()); + commissionType(other.getCommissionType()); + commissionValue(other.getCommissionValue()); + id(other.getId()); + overrideType(other.getOverrideType()); + planId(other.getPlanId()); + productDirectLink(other.getProductDirectLink()); + productId(other.getProductId()); + revenueBasis(other.getRevenueBasis()); + totalReferralEarningsUsd(other.getTotalReferralEarningsUsd()); + return this; + } + + /** + *

The type of commission (percentage or flat_fee).

+ *

The type of commission (percentage or flat_fee).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("commission_type") + public CommissionValueStage commissionType(@NotNull AffiliatePayoutTypes commissionType) { + this.commissionType = Objects.requireNonNull(commissionType, "commissionType must not be null"); + return this; + } + + /** + *

The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee.

+ *

The commission amount. A percentage (1-100) when commission_type is percentage, or a dollar amount when flat_fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("commission_value") + public IdStage commissionValue(double commissionValue) { + this.commissionValue = commissionValue; + return this; + } + + /** + *

The unique identifier for the affiliate override.

+ *

The unique identifier for the affiliate override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OverrideTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of override (standard or rev_share).

+ *

The type of override (standard or rev_share).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("override_type") + public TotalReferralEarningsUsdStage overrideType(@NotNull AffiliateOverrideRoles overrideType) { + this.overrideType = Objects.requireNonNull(overrideType, "overrideType must not be null"); + return this; + } + + /** + *

The total earnings paid to this affiliate for referrals to this specific plan, in USD.

+ *

The total earnings paid to this affiliate for referrals to this specific plan, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_referral_earnings_usd") + public _FinalStage totalReferralEarningsUsd(double totalReferralEarningsUsd) { + this.totalReferralEarningsUsd = totalReferralEarningsUsd; + return this; + } + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage revenueBasis(Nullable revenueBasis) { + if (revenueBasis.isNull()) { + this.revenueBasis = null; + } else if (revenueBasis.isEmpty()) { + this.revenueBasis = Optional.empty(); + } else { + this.revenueBasis = Optional.of(revenueBasis.get()); + } + return this; + } + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage revenueBasis(AffiliateRevenueBases revenueBasis) { + this.revenueBasis = Optional.ofNullable(revenueBasis); + return this; + } + + /** + *

The revenue calculation basis (pre_fees or post_fees).

+ */ + @java.lang.Override + @JsonSetter(value = "revenue_basis", nulls = Nulls.SKIP) + public _FinalStage revenueBasis(Optional revenueBasis) { + this.revenueBasis = revenueBasis; + return this; + } + + /** + *

The product ID (for rev-share overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + /** + *

The product ID (for rev-share overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

The product ID (for rev-share overrides).

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

The product page direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productDirectLink(Nullable productDirectLink) { + if (productDirectLink.isNull()) { + this.productDirectLink = null; + } else if (productDirectLink.isEmpty()) { + this.productDirectLink = Optional.empty(); + } else { + this.productDirectLink = Optional.of(productDirectLink.get()); + } + return this; + } + + /** + *

The product page direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productDirectLink(String productDirectLink) { + this.productDirectLink = Optional.ofNullable(productDirectLink); + return this; + } + + /** + *

The product page direct link for referrals (standard overrides only).

+ */ + @java.lang.Override + @JsonSetter(value = "product_direct_link", nulls = Nulls.SKIP) + public _FinalStage productDirectLink(Optional productDirectLink) { + this.productDirectLink = productDirectLink; + return this; + } + + /** + *

The plan ID (for standard overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planId(Nullable planId) { + if (planId.isNull()) { + this.planId = null; + } else if (planId.isEmpty()) { + this.planId = Optional.empty(); + } else { + this.planId = Optional.of(planId.get()); + } + return this; + } + + /** + *

The plan ID (for standard overrides).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planId(String planId) { + this.planId = Optional.ofNullable(planId); + return this; + } + + /** + *

The plan ID (for standard overrides).

+ */ + @java.lang.Override + @JsonSetter(value = "plan_id", nulls = Nulls.SKIP) + public _FinalStage planId(Optional planId) { + this.planId = planId; + return this; + } + + /** + *

The checkout direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutDirectLink(Nullable checkoutDirectLink) { + if (checkoutDirectLink.isNull()) { + this.checkoutDirectLink = null; + } else if (checkoutDirectLink.isEmpty()) { + this.checkoutDirectLink = Optional.empty(); + } else { + this.checkoutDirectLink = Optional.of(checkoutDirectLink.get()); + } + return this; + } + + /** + *

The checkout direct link for referrals (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutDirectLink(String checkoutDirectLink) { + this.checkoutDirectLink = Optional.ofNullable(checkoutDirectLink); + return this; + } + + /** + *

The checkout direct link for referrals (standard overrides only).

+ */ + @java.lang.Override + @JsonSetter(value = "checkout_direct_link", nulls = Nulls.SKIP) + public _FinalStage checkoutDirectLink(Optional checkoutDirectLink) { + this.checkoutDirectLink = checkoutDirectLink; + return this; + } + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToProducts(Nullable appliesToProducts) { + if (appliesToProducts.isNull()) { + this.appliesToProducts = null; + } else if (appliesToProducts.isEmpty()) { + this.appliesToProducts = Optional.empty(); + } else { + this.appliesToProducts = Optional.of(appliesToProducts.get()); + } + return this; + } + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToProducts(AffiliateAppliesToProducts appliesToProducts) { + this.appliesToProducts = Optional.ofNullable(appliesToProducts); + return this; + } + + /** + *

Whether this rev-share override applies to a single product or all products (rev-share only).

+ */ + @java.lang.Override + @JsonSetter(value = "applies_to_products", nulls = Nulls.SKIP) + public _FinalStage appliesToProducts(Optional appliesToProducts) { + this.appliesToProducts = appliesToProducts; + return this; + } + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToPayments(Nullable appliesToPayments) { + if (appliesToPayments.isNull()) { + this.appliesToPayments = null; + } else if (appliesToPayments.isEmpty()) { + this.appliesToPayments = Optional.empty(); + } else { + this.appliesToPayments = Optional.of(appliesToPayments.get()); + } + return this; + } + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appliesToPayments(AffiliateAppliesToPayments appliesToPayments) { + this.appliesToPayments = Optional.ofNullable(appliesToPayments); + return this; + } + + /** + *

Whether the commission applies to the first payment only or all payments (standard overrides only).

+ */ + @java.lang.Override + @JsonSetter(value = "applies_to_payments", nulls = Nulls.SKIP) + public _FinalStage appliesToPayments(Optional appliesToPayments) { + this.appliesToPayments = appliesToPayments; + return this; + } + + @java.lang.Override + public UpdateOverridesResponse build() { + return new UpdateOverridesResponse( + appliesToPayments, + appliesToProducts, + checkoutDirectLink, + commissionType, + commissionValue, + id, + overrideType, + planId, + productDirectLink, + productId, + revenueBasis, + totalReferralEarningsUsd, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/requests/ArchiveAffiliatesRequest.java b/src/main/java/com/whop/api/resources/affiliates/requests/ArchiveAffiliatesRequest.java new file mode 100644 index 00000000..05145a82 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/requests/ArchiveAffiliatesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ArchiveAffiliatesRequest.Builder.class) +public final class ArchiveAffiliatesRequest { + private final Map additionalProperties; + + private ArchiveAffiliatesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ArchiveAffiliatesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ArchiveAffiliatesRequest other) { + return this; + } + + public ArchiveAffiliatesRequest build() { + return new ArchiveAffiliatesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/requests/CreateAffiliatesRequest.java b/src/main/java/com/whop/api/resources/affiliates/requests/CreateAffiliatesRequest.java new file mode 100644 index 00000000..acdac300 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/requests/CreateAffiliatesRequest.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAffiliatesRequest.Builder.class) +public final class CreateAffiliatesRequest { + private final String companyId; + + private final String userIdentifier; + + private final Map additionalProperties; + + private CreateAffiliatesRequest(String companyId, String userIdentifier, Map additionalProperties) { + this.companyId = companyId; + this.userIdentifier = userIdentifier; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the company to create the affiliate for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return The user identifier (username, email, user ID, or Discord ID). + */ + @JsonProperty("user_identifier") + public String getUserIdentifier() { + return userIdentifier; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAffiliatesRequest && equalTo((CreateAffiliatesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAffiliatesRequest other) { + return companyId.equals(other.companyId) && userIdentifier.equals(other.userIdentifier); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.userIdentifier); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The ID of the company to create the affiliate for.

+ */ + UserIdentifierStage companyId(@NotNull String companyId); + + Builder from(CreateAffiliatesRequest other); + } + + public interface UserIdentifierStage { + /** + *

The user identifier (username, email, user ID, or Discord ID).

+ */ + _FinalStage userIdentifier(@NotNull String userIdentifier); + } + + public interface _FinalStage { + CreateAffiliatesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, UserIdentifierStage, _FinalStage { + private String companyId; + + private String userIdentifier; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAffiliatesRequest other) { + companyId(other.getCompanyId()); + userIdentifier(other.getUserIdentifier()); + return this; + } + + /** + *

The ID of the company to create the affiliate for.

+ *

The ID of the company to create the affiliate for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public UserIdentifierStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The user identifier (username, email, user ID, or Discord ID).

+ *

The user identifier (username, email, user ID, or Discord ID).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user_identifier") + public _FinalStage userIdentifier(@NotNull String userIdentifier) { + this.userIdentifier = Objects.requireNonNull(userIdentifier, "userIdentifier must not be null"); + return this; + } + + @java.lang.Override + public CreateAffiliatesRequest build() { + return new CreateAffiliatesRequest(companyId, userIdentifier, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/requests/ListAffiliatesRequest.java b/src/main/java/com/whop/api/resources/affiliates/requests/ListAffiliatesRequest.java new file mode 100644 index 00000000..86402585 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/requests/ListAffiliatesRequest.java @@ -0,0 +1,451 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AffiliatesSortableColumns; +import com.whop.api.types.Direction; +import com.whop.api.types.Status; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAffiliatesRequest.Builder.class) +public final class ListAffiliatesRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String companyId; + + private final Optional direction; + + private final Optional order; + + private final Optional query; + + private final Optional status; + + private final Map additionalProperties; + + private ListAffiliatesRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String companyId, + Optional direction, + Optional order, + Optional query, + Optional status, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.direction = direction; + this.order = order; + this.query = query; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to list affiliates for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Search affiliates by username. + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAffiliatesRequest && equalTo((ListAffiliatesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAffiliatesRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId) + && direction.equals(other.direction) + && order.equals(other.order) + && query.equals(other.query) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.after, + this.before, + this.first, + this.last, + this.companyId, + this.direction, + this.order, + this.query, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to list affiliates for.

+ */ + _FinalStage companyId(@NotNull String companyId); + + Builder from(ListAffiliatesRequest other); + } + + public interface _FinalStage { + ListAffiliatesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + _FinalStage direction(Optional direction); + + _FinalStage direction(Direction direction); + + _FinalStage order(Optional order); + + _FinalStage order(AffiliatesSortableColumns order); + + /** + *

Search affiliates by username.

+ */ + _FinalStage query(Optional query); + + _FinalStage query(String query); + + _FinalStage status(Optional status); + + _FinalStage status(Status status); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional status = Optional.empty(); + + private Optional query = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAffiliatesRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + direction(other.getDirection()); + order(other.getOrder()); + query(other.getQuery()); + status(other.getStatus()); + return this; + } + + /** + *

The unique identifier of the company to list affiliates for.

+ *

The unique identifier of the company to list affiliates for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage status(Status status) { + this.status = Optional.ofNullable(status); + return this; + } + + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

Search affiliates by username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + /** + *

Search affiliates by username.

+ */ + @java.lang.Override + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public _FinalStage query(Optional query) { + this.query = query; + return this; + } + + @java.lang.Override + public _FinalStage order(AffiliatesSortableColumns order) { + this.order = Optional.ofNullable(order); + return this; + } + + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + @java.lang.Override + public _FinalStage direction(Direction direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + @java.lang.Override + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public _FinalStage direction(Optional direction) { + this.direction = direction; + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListAffiliatesRequest build() { + return new ListAffiliatesRequest( + after, before, first, last, companyId, direction, order, query, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/requests/RetrieveAffiliatesRequest.java b/src/main/java/com/whop/api/resources/affiliates/requests/RetrieveAffiliatesRequest.java new file mode 100644 index 00000000..66fe6a5a --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/requests/RetrieveAffiliatesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveAffiliatesRequest.Builder.class) +public final class RetrieveAffiliatesRequest { + private final Map additionalProperties; + + private RetrieveAffiliatesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveAffiliatesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveAffiliatesRequest other) { + return this; + } + + public RetrieveAffiliatesRequest build() { + return new RetrieveAffiliatesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/requests/UnarchiveAffiliatesRequest.java b/src/main/java/com/whop/api/resources/affiliates/requests/UnarchiveAffiliatesRequest.java new file mode 100644 index 00000000..9b3f08c1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/requests/UnarchiveAffiliatesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UnarchiveAffiliatesRequest.Builder.class) +public final class UnarchiveAffiliatesRequest { + private final Map additionalProperties; + + private UnarchiveAffiliatesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UnarchiveAffiliatesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UnarchiveAffiliatesRequest other) { + return this; + } + + public UnarchiveAffiliatesRequest build() { + return new UnarchiveAffiliatesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/affiliates/types/ListAffiliatesResponse.java b/src/main/java/com/whop/api/resources/affiliates/types/ListAffiliatesResponse.java new file mode 100644 index 00000000..907b46b3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/affiliates/types/ListAffiliatesResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.affiliates.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AffiliateListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAffiliatesResponse.Builder.class) +public final class ListAffiliatesResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListAffiliatesResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAffiliatesResponse && equalTo((ListAffiliatesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAffiliatesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListAffiliatesResponse other); + } + + public interface _FinalStage { + ListAffiliatesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(AffiliateListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAffiliatesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(AffiliateListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListAffiliatesResponse build() { + return new ListAffiliatesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/aichats/AiChatsClient.java b/src/main/java/com/whop/api/resources/aichats/AiChatsClient.java new file mode 100644 index 00000000..7ab95768 --- /dev/null +++ b/src/main/java/com/whop/api/resources/aichats/AiChatsClient.java @@ -0,0 +1,199 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.aichats; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.aichats.requests.CreateAiChatsRequest; +import com.whop.api.resources.aichats.requests.DeleteAiChatsRequest; +import com.whop.api.resources.aichats.requests.ListAiChatsRequest; +import com.whop.api.resources.aichats.requests.RetrieveAiChatsRequest; +import com.whop.api.resources.aichats.requests.UpdateAiChatsRequest; +import com.whop.api.types.AiChat; +import com.whop.api.types.AiChatListItem; + +public class AiChatsClient { + protected final ClientOptions clientOptions; + + private final RawAiChatsClient rawClient; + + public AiChatsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAiChatsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAiChatsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public SyncPagingIterable list(ListAiChatsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public SyncPagingIterable list(ListAiChatsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Create a new AI chat thread and send the first message to the AI agent. + *

Required permissions:

+ *
    + *
  • ai_chat:create
  • + *
+ */ + public AiChat create(CreateAiChatsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Create a new AI chat thread and send the first message to the AI agent. + *

Required permissions:

+ *
    + *
  • ai_chat:create
  • + *
+ */ + public AiChat create(CreateAiChatsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing AI chat. + */ + public AiChat retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing AI chat. + */ + public AiChat retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing AI chat. + */ + public AiChat retrieve(String id, RetrieveAiChatsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing AI chat. + */ + public AiChat retrieve(String id, RetrieveAiChatsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public boolean delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public boolean delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public boolean delete(String id, DeleteAiChatsRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public boolean delete(String id, DeleteAiChatsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public AiChat update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public AiChat update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public AiChat update(String id, UpdateAiChatsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public AiChat update(String id, UpdateAiChatsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/aichats/AsyncAiChatsClient.java b/src/main/java/com/whop/api/resources/aichats/AsyncAiChatsClient.java new file mode 100644 index 00000000..438a2427 --- /dev/null +++ b/src/main/java/com/whop/api/resources/aichats/AsyncAiChatsClient.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.aichats; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.aichats.requests.CreateAiChatsRequest; +import com.whop.api.resources.aichats.requests.DeleteAiChatsRequest; +import com.whop.api.resources.aichats.requests.ListAiChatsRequest; +import com.whop.api.resources.aichats.requests.RetrieveAiChatsRequest; +import com.whop.api.resources.aichats.requests.UpdateAiChatsRequest; +import com.whop.api.types.AiChat; +import com.whop.api.types.AiChatListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncAiChatsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAiChatsClient rawClient; + + public AsyncAiChatsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAiChatsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAiChatsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public CompletableFuture> list(ListAiChatsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public CompletableFuture> list( + ListAiChatsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create a new AI chat thread and send the first message to the AI agent. + *

Required permissions:

+ *
    + *
  • ai_chat:create
  • + *
+ */ + public CompletableFuture create(CreateAiChatsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create a new AI chat thread and send the first message to the AI agent. + *

Required permissions:

+ *
    + *
  • ai_chat:create
  • + *
+ */ + public CompletableFuture create(CreateAiChatsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing AI chat. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing AI chat. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing AI chat. + */ + public CompletableFuture retrieve(String id, RetrieveAiChatsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing AI chat. + */ + public CompletableFuture retrieve( + String id, RetrieveAiChatsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public CompletableFuture delete(String id, DeleteAiChatsRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public CompletableFuture delete(String id, DeleteAiChatsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public CompletableFuture update(String id, UpdateAiChatsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public CompletableFuture update(String id, UpdateAiChatsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/aichats/AsyncRawAiChatsClient.java b/src/main/java/com/whop/api/resources/aichats/AsyncRawAiChatsClient.java new file mode 100644 index 00000000..a6ba24a3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/aichats/AsyncRawAiChatsClient.java @@ -0,0 +1,703 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.aichats; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.aichats.requests.CreateAiChatsRequest; +import com.whop.api.resources.aichats.requests.DeleteAiChatsRequest; +import com.whop.api.resources.aichats.requests.ListAiChatsRequest; +import com.whop.api.resources.aichats.requests.RetrieveAiChatsRequest; +import com.whop.api.resources.aichats.requests.UpdateAiChatsRequest; +import com.whop.api.resources.aichats.types.ListAiChatsResponse; +import com.whop.api.types.AiChat; +import com.whop.api.types.AiChatListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAiChatsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAiChatsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public CompletableFuture>> list() { + return list(ListAiChatsRequest.builder().build()); + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListAiChatsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public CompletableFuture>> list(ListAiChatsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public CompletableFuture>> list( + ListAiChatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ai_chats"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getOnlyActiveCrons().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "only_active_crons", request.getOnlyActiveCrons().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAiChatsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAiChatsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListAiChatsRequest nextRequest = ListAiChatsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create a new AI chat thread and send the first message to the AI agent. + *

Required permissions:

+ *
    + *
  • ai_chat:create
  • + *
+ */ + public CompletableFuture> create(CreateAiChatsRequest request) { + return create(request, null); + } + + /** + * Create a new AI chat thread and send the first message to the AI agent. + *

Required permissions:

+ *
    + *
  • ai_chat:create
  • + *
+ */ + public CompletableFuture> create( + CreateAiChatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ai_chats"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AiChat.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing AI chat. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveAiChatsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing AI chat. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAiChatsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing AI chat. + */ + public CompletableFuture> retrieve(String id, RetrieveAiChatsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing AI chat. + */ + public CompletableFuture> retrieve( + String id, RetrieveAiChatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ai_chats") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AiChat.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteAiChatsRequest.builder().build()); + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteAiChatsRequest.builder().build(), requestOptions); + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public CompletableFuture> delete(String id, DeleteAiChatsRequest request) { + return delete(id, request, null); + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public CompletableFuture> delete( + String id, DeleteAiChatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ai_chats") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public CompletableFuture> update(String id) { + return update(id, UpdateAiChatsRequest.builder().build()); + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateAiChatsRequest.builder().build(), requestOptions); + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public CompletableFuture> update(String id, UpdateAiChatsRequest request) { + return update(id, request, null); + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public CompletableFuture> update( + String id, UpdateAiChatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ai_chats") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AiChat.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/aichats/RawAiChatsClient.java b/src/main/java/com/whop/api/resources/aichats/RawAiChatsClient.java new file mode 100644 index 00000000..0bceffbc --- /dev/null +++ b/src/main/java/com/whop/api/resources/aichats/RawAiChatsClient.java @@ -0,0 +1,551 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.aichats; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.aichats.requests.CreateAiChatsRequest; +import com.whop.api.resources.aichats.requests.DeleteAiChatsRequest; +import com.whop.api.resources.aichats.requests.ListAiChatsRequest; +import com.whop.api.resources.aichats.requests.RetrieveAiChatsRequest; +import com.whop.api.resources.aichats.requests.UpdateAiChatsRequest; +import com.whop.api.resources.aichats.types.ListAiChatsResponse; +import com.whop.api.types.AiChat; +import com.whop.api.types.AiChatListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAiChatsClient { + protected final ClientOptions clientOptions; + + public RawAiChatsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public WhopApiHttpResponse> list() { + return list(ListAiChatsRequest.builder().build()); + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListAiChatsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public WhopApiHttpResponse> list(ListAiChatsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of AI chat threads for the current authenticated user. + */ + public WhopApiHttpResponse> list( + ListAiChatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ai_chats"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getOnlyActiveCrons().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "only_active_crons", request.getOnlyActiveCrons().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAiChatsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAiChatsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListAiChatsRequest nextRequest = ListAiChatsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Create a new AI chat thread and send the first message to the AI agent. + *

Required permissions:

+ *
    + *
  • ai_chat:create
  • + *
+ */ + public WhopApiHttpResponse create(CreateAiChatsRequest request) { + return create(request, null); + } + + /** + * Create a new AI chat thread and send the first message to the AI agent. + *

Required permissions:

+ *
    + *
  • ai_chat:create
  • + *
+ */ + public WhopApiHttpResponse create(CreateAiChatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ai_chats"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AiChat.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing AI chat. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveAiChatsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing AI chat. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAiChatsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing AI chat. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveAiChatsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing AI chat. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveAiChatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ai_chats") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AiChat.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteAiChatsRequest.builder().build()); + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteAiChatsRequest.builder().build(), requestOptions); + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public WhopApiHttpResponse delete(String id, DeleteAiChatsRequest request) { + return delete(id, request, null); + } + + /** + * Delete an AI chat thread so it no longer appears in the user's chat list. + *

Required permissions:

+ *
    + *
  • ai_chat:delete
  • + *
+ */ + public WhopApiHttpResponse delete(String id, DeleteAiChatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ai_chats") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateAiChatsRequest.builder().build()); + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateAiChatsRequest.builder().build(), requestOptions); + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateAiChatsRequest request) { + return update(id, request, null); + } + + /** + * Update an AI chat's title, notification preferences, or associated company context. + *

Required permissions:

+ *
    + *
  • ai_chat:update
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateAiChatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ai_chats") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AiChat.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/aichats/requests/CreateAiChatsRequest.java b/src/main/java/com/whop/api/resources/aichats/requests/CreateAiChatsRequest.java new file mode 100644 index 00000000..7a41d896 --- /dev/null +++ b/src/main/java/com/whop/api/resources/aichats/requests/CreateAiChatsRequest.java @@ -0,0 +1,504 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.aichats.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.aichats.types.CreateAiChatsRequestMessageAttachmentsItem; +import com.whop.api.types.AiChatMessageSourceTypes; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAiChatsRequest.Builder.class) +public final class CreateAiChatsRequest { + private final Optional currentCompanyId; + + private final Optional> messageAttachments; + + private final Optional messageSource; + + private final String messageText; + + private final Optional suggestionType; + + private final Optional title; + + private final Map additionalProperties; + + private CreateAiChatsRequest( + Optional currentCompanyId, + Optional> messageAttachments, + Optional messageSource, + String messageText, + Optional suggestionType, + Optional title, + Map additionalProperties) { + this.currentCompanyId = currentCompanyId; + this.messageAttachments = messageAttachments; + this.messageSource = messageSource; + this.messageText = messageText; + this.suggestionType = suggestionType; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the company to set as context for the AI chat (e.g., "biz_XXXXX"). + */ + @JsonIgnore + public Optional getCurrentCompanyId() { + if (currentCompanyId == null) { + return Optional.empty(); + } + return currentCompanyId; + } + + /** + * @return A list of previously uploaded file attachments to include with the first message. + */ + @JsonIgnore + public Optional> getMessageAttachments() { + if (messageAttachments == null) { + return Optional.empty(); + } + return messageAttachments; + } + + /** + * @return The source of the message. + */ + @JsonIgnore + public Optional getMessageSource() { + if (messageSource == null) { + return Optional.empty(); + } + return messageSource; + } + + /** + * @return The text content of the first message to send to the AI agent. + */ + @JsonProperty("message_text") + public String getMessageText() { + return messageText; + } + + /** + * @return The type of suggestion prompt that was clicked, when message_source is 'suggestion'. + */ + @JsonIgnore + public Optional getSuggestionType() { + if (suggestionType == null) { + return Optional.empty(); + } + return suggestionType; + } + + /** + * @return An optional display title for the AI chat thread (e.g., "Help with billing"). + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("current_company_id") + private Optional _getCurrentCompanyId() { + return currentCompanyId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("message_attachments") + private Optional> _getMessageAttachments() { + return messageAttachments; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("message_source") + private Optional _getMessageSource() { + return messageSource; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("suggestion_type") + private Optional _getSuggestionType() { + return suggestionType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAiChatsRequest && equalTo((CreateAiChatsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAiChatsRequest other) { + return currentCompanyId.equals(other.currentCompanyId) + && messageAttachments.equals(other.messageAttachments) + && messageSource.equals(other.messageSource) + && messageText.equals(other.messageText) + && suggestionType.equals(other.suggestionType) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.currentCompanyId, + this.messageAttachments, + this.messageSource, + this.messageText, + this.suggestionType, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageTextStage builder() { + return new Builder(); + } + + public interface MessageTextStage { + /** + *

The text content of the first message to send to the AI agent.

+ */ + _FinalStage messageText(@NotNull String messageText); + + Builder from(CreateAiChatsRequest other); + } + + public interface _FinalStage { + CreateAiChatsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The unique identifier of the company to set as context for the AI chat (e.g., "biz_XXXXX").

+ */ + _FinalStage currentCompanyId(Optional currentCompanyId); + + _FinalStage currentCompanyId(String currentCompanyId); + + _FinalStage currentCompanyId(Nullable currentCompanyId); + + /** + *

A list of previously uploaded file attachments to include with the first message.

+ */ + _FinalStage messageAttachments(Optional> messageAttachments); + + _FinalStage messageAttachments(List messageAttachments); + + _FinalStage messageAttachments(Nullable> messageAttachments); + + /** + *

The source of the message.

+ */ + _FinalStage messageSource(Optional messageSource); + + _FinalStage messageSource(AiChatMessageSourceTypes messageSource); + + _FinalStage messageSource(Nullable messageSource); + + /** + *

The type of suggestion prompt that was clicked, when message_source is 'suggestion'.

+ */ + _FinalStage suggestionType(Optional suggestionType); + + _FinalStage suggestionType(String suggestionType); + + _FinalStage suggestionType(Nullable suggestionType); + + /** + *

An optional display title for the AI chat thread (e.g., "Help with billing").

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageTextStage, _FinalStage { + private String messageText; + + private Optional title = Optional.empty(); + + private Optional suggestionType = Optional.empty(); + + private Optional messageSource = Optional.empty(); + + private Optional> messageAttachments = Optional.empty(); + + private Optional currentCompanyId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAiChatsRequest other) { + currentCompanyId(other.getCurrentCompanyId()); + messageAttachments(other.getMessageAttachments()); + messageSource(other.getMessageSource()); + messageText(other.getMessageText()); + suggestionType(other.getSuggestionType()); + title(other.getTitle()); + return this; + } + + /** + *

The text content of the first message to send to the AI agent.

+ *

The text content of the first message to send to the AI agent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message_text") + public _FinalStage messageText(@NotNull String messageText) { + this.messageText = Objects.requireNonNull(messageText, "messageText must not be null"); + return this; + } + + /** + *

An optional display title for the AI chat thread (e.g., "Help with billing").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

An optional display title for the AI chat thread (e.g., "Help with billing").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

An optional display title for the AI chat thread (e.g., "Help with billing").

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

The type of suggestion prompt that was clicked, when message_source is 'suggestion'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage suggestionType(Nullable suggestionType) { + if (suggestionType.isNull()) { + this.suggestionType = null; + } else if (suggestionType.isEmpty()) { + this.suggestionType = Optional.empty(); + } else { + this.suggestionType = Optional.of(suggestionType.get()); + } + return this; + } + + /** + *

The type of suggestion prompt that was clicked, when message_source is 'suggestion'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage suggestionType(String suggestionType) { + this.suggestionType = Optional.ofNullable(suggestionType); + return this; + } + + /** + *

The type of suggestion prompt that was clicked, when message_source is 'suggestion'.

+ */ + @java.lang.Override + @JsonSetter(value = "suggestion_type", nulls = Nulls.SKIP) + public _FinalStage suggestionType(Optional suggestionType) { + this.suggestionType = suggestionType; + return this; + } + + /** + *

The source of the message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messageSource(Nullable messageSource) { + if (messageSource.isNull()) { + this.messageSource = null; + } else if (messageSource.isEmpty()) { + this.messageSource = Optional.empty(); + } else { + this.messageSource = Optional.of(messageSource.get()); + } + return this; + } + + /** + *

The source of the message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messageSource(AiChatMessageSourceTypes messageSource) { + this.messageSource = Optional.ofNullable(messageSource); + return this; + } + + /** + *

The source of the message.

+ */ + @java.lang.Override + @JsonSetter(value = "message_source", nulls = Nulls.SKIP) + public _FinalStage messageSource(Optional messageSource) { + this.messageSource = messageSource; + return this; + } + + /** + *

A list of previously uploaded file attachments to include with the first message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messageAttachments( + Nullable> messageAttachments) { + if (messageAttachments.isNull()) { + this.messageAttachments = null; + } else if (messageAttachments.isEmpty()) { + this.messageAttachments = Optional.empty(); + } else { + this.messageAttachments = Optional.of(messageAttachments.get()); + } + return this; + } + + /** + *

A list of previously uploaded file attachments to include with the first message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messageAttachments(List messageAttachments) { + this.messageAttachments = Optional.ofNullable(messageAttachments); + return this; + } + + /** + *

A list of previously uploaded file attachments to include with the first message.

+ */ + @java.lang.Override + @JsonSetter(value = "message_attachments", nulls = Nulls.SKIP) + public _FinalStage messageAttachments( + Optional> messageAttachments) { + this.messageAttachments = messageAttachments; + return this; + } + + /** + *

The unique identifier of the company to set as context for the AI chat (e.g., "biz_XXXXX").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentCompanyId(Nullable currentCompanyId) { + if (currentCompanyId.isNull()) { + this.currentCompanyId = null; + } else if (currentCompanyId.isEmpty()) { + this.currentCompanyId = Optional.empty(); + } else { + this.currentCompanyId = Optional.of(currentCompanyId.get()); + } + return this; + } + + /** + *

The unique identifier of the company to set as context for the AI chat (e.g., "biz_XXXXX").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentCompanyId(String currentCompanyId) { + this.currentCompanyId = Optional.ofNullable(currentCompanyId); + return this; + } + + /** + *

The unique identifier of the company to set as context for the AI chat (e.g., "biz_XXXXX").

+ */ + @java.lang.Override + @JsonSetter(value = "current_company_id", nulls = Nulls.SKIP) + public _FinalStage currentCompanyId(Optional currentCompanyId) { + this.currentCompanyId = currentCompanyId; + return this; + } + + @java.lang.Override + public CreateAiChatsRequest build() { + return new CreateAiChatsRequest( + currentCompanyId, + messageAttachments, + messageSource, + messageText, + suggestionType, + title, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/aichats/requests/DeleteAiChatsRequest.java b/src/main/java/com/whop/api/resources/aichats/requests/DeleteAiChatsRequest.java new file mode 100644 index 00000000..3d216f40 --- /dev/null +++ b/src/main/java/com/whop/api/resources/aichats/requests/DeleteAiChatsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.aichats.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteAiChatsRequest.Builder.class) +public final class DeleteAiChatsRequest { + private final Map additionalProperties; + + private DeleteAiChatsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteAiChatsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteAiChatsRequest other) { + return this; + } + + public DeleteAiChatsRequest build() { + return new DeleteAiChatsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/aichats/requests/ListAiChatsRequest.java b/src/main/java/com/whop/api/resources/aichats/requests/ListAiChatsRequest.java new file mode 100644 index 00000000..71a800f7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/aichats/requests/ListAiChatsRequest.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.aichats.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAiChatsRequest.Builder.class) +public final class ListAiChatsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Optional onlyActiveCrons; + + private final Map additionalProperties; + + private ListAiChatsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + Optional onlyActiveCrons, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.onlyActiveCrons = onlyActiveCrons; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return When true, returns only chats with an active cron schedule + */ + @JsonProperty("only_active_crons") + public Optional getOnlyActiveCrons() { + return onlyActiveCrons; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAiChatsRequest && equalTo((ListAiChatsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAiChatsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && onlyActiveCrons.equals(other.onlyActiveCrons); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last, this.onlyActiveCrons); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional onlyActiveCrons = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListAiChatsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + onlyActiveCrons(other.getOnlyActiveCrons()); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

When true, returns only chats with an active cron schedule

+ */ + @JsonSetter(value = "only_active_crons", nulls = Nulls.SKIP) + public Builder onlyActiveCrons(Optional onlyActiveCrons) { + this.onlyActiveCrons = onlyActiveCrons; + return this; + } + + public Builder onlyActiveCrons(Boolean onlyActiveCrons) { + this.onlyActiveCrons = Optional.ofNullable(onlyActiveCrons); + return this; + } + + public ListAiChatsRequest build() { + return new ListAiChatsRequest(after, before, first, last, onlyActiveCrons, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/aichats/requests/RetrieveAiChatsRequest.java b/src/main/java/com/whop/api/resources/aichats/requests/RetrieveAiChatsRequest.java new file mode 100644 index 00000000..50ee5399 --- /dev/null +++ b/src/main/java/com/whop/api/resources/aichats/requests/RetrieveAiChatsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.aichats.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveAiChatsRequest.Builder.class) +public final class RetrieveAiChatsRequest { + private final Map additionalProperties; + + private RetrieveAiChatsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveAiChatsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveAiChatsRequest other) { + return this; + } + + public RetrieveAiChatsRequest build() { + return new RetrieveAiChatsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/aichats/requests/UpdateAiChatsRequest.java b/src/main/java/com/whop/api/resources/aichats/requests/UpdateAiChatsRequest.java new file mode 100644 index 00000000..c27209c1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/aichats/requests/UpdateAiChatsRequest.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.aichats.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AiChatNotificationPreferences; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAiChatsRequest.Builder.class) +public final class UpdateAiChatsRequest { + private final Optional currentCompanyId; + + private final Optional notificationPreference; + + private final Optional title; + + private final Map additionalProperties; + + private UpdateAiChatsRequest( + Optional currentCompanyId, + Optional notificationPreference, + Optional title, + Map additionalProperties) { + this.currentCompanyId = currentCompanyId; + this.notificationPreference = notificationPreference; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the company to set as context for the AI chat (e.g., "biz_XXXXX"). + */ + @JsonIgnore + public Optional getCurrentCompanyId() { + if (currentCompanyId == null) { + return Optional.empty(); + } + return currentCompanyId; + } + + /** + * @return The notification preference for the AI chat. + */ + @JsonIgnore + public Optional getNotificationPreference() { + if (notificationPreference == null) { + return Optional.empty(); + } + return notificationPreference; + } + + /** + * @return The new display title for the AI chat thread (e.g., "Help with billing"). + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("current_company_id") + private Optional _getCurrentCompanyId() { + return currentCompanyId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notification_preference") + private Optional _getNotificationPreference() { + return notificationPreference; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAiChatsRequest && equalTo((UpdateAiChatsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAiChatsRequest other) { + return currentCompanyId.equals(other.currentCompanyId) + && notificationPreference.equals(other.notificationPreference) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currentCompanyId, this.notificationPreference, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional currentCompanyId = Optional.empty(); + + private Optional notificationPreference = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAiChatsRequest other) { + currentCompanyId(other.getCurrentCompanyId()); + notificationPreference(other.getNotificationPreference()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier of the company to set as context for the AI chat (e.g., "biz_XXXXX").

+ */ + @JsonSetter(value = "current_company_id", nulls = Nulls.SKIP) + public Builder currentCompanyId(Optional currentCompanyId) { + this.currentCompanyId = currentCompanyId; + return this; + } + + public Builder currentCompanyId(String currentCompanyId) { + this.currentCompanyId = Optional.ofNullable(currentCompanyId); + return this; + } + + public Builder currentCompanyId(Nullable currentCompanyId) { + if (currentCompanyId.isNull()) { + this.currentCompanyId = null; + } else if (currentCompanyId.isEmpty()) { + this.currentCompanyId = Optional.empty(); + } else { + this.currentCompanyId = Optional.of(currentCompanyId.get()); + } + return this; + } + + /** + *

The notification preference for the AI chat.

+ */ + @JsonSetter(value = "notification_preference", nulls = Nulls.SKIP) + public Builder notificationPreference(Optional notificationPreference) { + this.notificationPreference = notificationPreference; + return this; + } + + public Builder notificationPreference(AiChatNotificationPreferences notificationPreference) { + this.notificationPreference = Optional.ofNullable(notificationPreference); + return this; + } + + public Builder notificationPreference(Nullable notificationPreference) { + if (notificationPreference.isNull()) { + this.notificationPreference = null; + } else if (notificationPreference.isEmpty()) { + this.notificationPreference = Optional.empty(); + } else { + this.notificationPreference = Optional.of(notificationPreference.get()); + } + return this; + } + + /** + *

The new display title for the AI chat thread (e.g., "Help with billing").

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + public UpdateAiChatsRequest build() { + return new UpdateAiChatsRequest(currentCompanyId, notificationPreference, title, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/aichats/types/CreateAiChatsRequestMessageAttachmentsItem.java b/src/main/java/com/whop/api/resources/aichats/types/CreateAiChatsRequestMessageAttachmentsItem.java new file mode 100644 index 00000000..6f4310ba --- /dev/null +++ b/src/main/java/com/whop/api/resources/aichats/types/CreateAiChatsRequestMessageAttachmentsItem.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.aichats.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAiChatsRequestMessageAttachmentsItem.Builder.class) +public final class CreateAiChatsRequestMessageAttachmentsItem { + private final String id; + + private final Map additionalProperties; + + private CreateAiChatsRequestMessageAttachmentsItem(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAiChatsRequestMessageAttachmentsItem + && equalTo((CreateAiChatsRequestMessageAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAiChatsRequestMessageAttachmentsItem other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CreateAiChatsRequestMessageAttachmentsItem other); + } + + public interface _FinalStage { + CreateAiChatsRequestMessageAttachmentsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAiChatsRequestMessageAttachmentsItem other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CreateAiChatsRequestMessageAttachmentsItem build() { + return new CreateAiChatsRequestMessageAttachmentsItem(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/aichats/types/ListAiChatsResponse.java b/src/main/java/com/whop/api/resources/aichats/types/ListAiChatsResponse.java new file mode 100644 index 00000000..a9ada81d --- /dev/null +++ b/src/main/java/com/whop/api/resources/aichats/types/ListAiChatsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.aichats.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AiChatListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAiChatsResponse.Builder.class) +public final class ListAiChatsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListAiChatsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAiChatsResponse && equalTo((ListAiChatsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAiChatsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListAiChatsResponse other); + } + + public interface _FinalStage { + ListAiChatsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(AiChatListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAiChatsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(AiChatListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListAiChatsResponse build() { + return new ListAiChatsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/ApiKeysClient.java b/src/main/java/com/whop/api/resources/apikeys/ApiKeysClient.java new file mode 100644 index 00000000..1a7def62 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/ApiKeysClient.java @@ -0,0 +1,189 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.apikeys.requests.CreateApiKeysRequest; +import com.whop.api.resources.apikeys.requests.DeleteApiKeysRequest; +import com.whop.api.resources.apikeys.requests.ListApiKeysRequest; +import com.whop.api.resources.apikeys.requests.RetrieveApiKeysRequest; +import com.whop.api.resources.apikeys.requests.RotateApiKeysRequest; +import com.whop.api.resources.apikeys.requests.UpdateApiKeysRequest; +import com.whop.api.resources.apikeys.types.DeleteApiKeysResponse; +import com.whop.api.resources.apikeys.types.ListPermissionsApiKeysResponse; +import com.whop.api.types.ApiKey; + +public class ApiKeysClient { + protected final ClientOptions clientOptions; + + private final RawApiKeysClient rawClient; + + public ApiKeysClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawApiKeysClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawApiKeysClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the API keys of an account or app, newest first. Responses never include the full secret — only its obfuscated form. + */ + public SyncPagingIterable list(ListApiKeysRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the API keys of an account or app, newest first. Responses never include the full secret — only its obfuscated form. + */ + public SyncPagingIterable list(ListApiKeysRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Creates an API key for an account or app. The response is the only place the full secret_key is returned — store it immediately. Requires a user session; API keys cannot manage API keys. + */ + public ApiKey create(CreateApiKeysRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Creates an API key for an account or app. The response is the only place the full secret_key is returned — store it immediately. Requires a user session; API keys cannot manage API keys. + */ + public ApiKey create(CreateApiKeysRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Lists the catalog of permission actions that can be granted to users, apps, and API keys — the source for the dashboard's permission pickers. Small and returned in full on one page. + */ + public ListPermissionsApiKeysResponse listPermissions() { + return this.rawClient.listPermissions().body(); + } + + /** + * Lists the catalog of permission actions that can be granted to users, apps, and API keys — the source for the dashboard's permission pickers. Small and returned in full on one page. + */ + public ListPermissionsApiKeysResponse listPermissions(RequestOptions requestOptions) { + return this.rawClient.listPermissions(requestOptions).body(); + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public ApiKey retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public ApiKey retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public ApiKey retrieve(String id, RetrieveApiKeysRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public ApiKey retrieve(String id, RetrieveApiKeysRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public DeleteApiKeysResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public DeleteApiKeysResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public DeleteApiKeysResponse delete(String id, DeleteApiKeysRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public DeleteApiKeysResponse delete(String id, DeleteApiKeysRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public ApiKey update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public ApiKey update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public ApiKey update(String id, UpdateApiKeysRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public ApiKey update(String id, UpdateApiKeysRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public ApiKey rotate(String id) { + return this.rawClient.rotate(id).body(); + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public ApiKey rotate(String id, RequestOptions requestOptions) { + return this.rawClient.rotate(id, requestOptions).body(); + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public ApiKey rotate(String id, RotateApiKeysRequest request) { + return this.rawClient.rotate(id, request).body(); + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public ApiKey rotate(String id, RotateApiKeysRequest request, RequestOptions requestOptions) { + return this.rawClient.rotate(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/AsyncApiKeysClient.java b/src/main/java/com/whop/api/resources/apikeys/AsyncApiKeysClient.java new file mode 100644 index 00000000..cebe19b9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/AsyncApiKeysClient.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.apikeys.requests.CreateApiKeysRequest; +import com.whop.api.resources.apikeys.requests.DeleteApiKeysRequest; +import com.whop.api.resources.apikeys.requests.ListApiKeysRequest; +import com.whop.api.resources.apikeys.requests.RetrieveApiKeysRequest; +import com.whop.api.resources.apikeys.requests.RotateApiKeysRequest; +import com.whop.api.resources.apikeys.requests.UpdateApiKeysRequest; +import com.whop.api.resources.apikeys.types.DeleteApiKeysResponse; +import com.whop.api.resources.apikeys.types.ListPermissionsApiKeysResponse; +import com.whop.api.types.ApiKey; +import java.util.concurrent.CompletableFuture; + +public class AsyncApiKeysClient { + protected final ClientOptions clientOptions; + + private final AsyncRawApiKeysClient rawClient; + + public AsyncApiKeysClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawApiKeysClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawApiKeysClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the API keys of an account or app, newest first. Responses never include the full secret — only its obfuscated form. + */ + public CompletableFuture> list(ListApiKeysRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the API keys of an account or app, newest first. Responses never include the full secret — only its obfuscated form. + */ + public CompletableFuture> list( + ListApiKeysRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates an API key for an account or app. The response is the only place the full secret_key is returned — store it immediately. Requires a user session; API keys cannot manage API keys. + */ + public CompletableFuture create(CreateApiKeysRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Creates an API key for an account or app. The response is the only place the full secret_key is returned — store it immediately. Requires a user session; API keys cannot manage API keys. + */ + public CompletableFuture create(CreateApiKeysRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the catalog of permission actions that can be granted to users, apps, and API keys — the source for the dashboard's permission pickers. Small and returned in full on one page. + */ + public CompletableFuture listPermissions() { + return this.rawClient.listPermissions().thenApply(response -> response.body()); + } + + /** + * Lists the catalog of permission actions that can be granted to users, apps, and API keys — the source for the dashboard's permission pickers. Small and returned in full on one page. + */ + public CompletableFuture listPermissions(RequestOptions requestOptions) { + return this.rawClient.listPermissions(requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public CompletableFuture retrieve(String id, RetrieveApiKeysRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public CompletableFuture retrieve( + String id, RetrieveApiKeysRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public CompletableFuture delete(String id, DeleteApiKeysRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public CompletableFuture delete( + String id, DeleteApiKeysRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public CompletableFuture update(String id, UpdateApiKeysRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public CompletableFuture update(String id, UpdateApiKeysRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public CompletableFuture rotate(String id) { + return this.rawClient.rotate(id).thenApply(response -> response.body()); + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public CompletableFuture rotate(String id, RequestOptions requestOptions) { + return this.rawClient.rotate(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public CompletableFuture rotate(String id, RotateApiKeysRequest request) { + return this.rawClient.rotate(id, request).thenApply(response -> response.body()); + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public CompletableFuture rotate(String id, RotateApiKeysRequest request, RequestOptions requestOptions) { + return this.rawClient.rotate(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/AsyncRawApiKeysClient.java b/src/main/java/com/whop/api/resources/apikeys/AsyncRawApiKeysClient.java new file mode 100644 index 00000000..9dc571ca --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/AsyncRawApiKeysClient.java @@ -0,0 +1,754 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.apikeys.requests.CreateApiKeysRequest; +import com.whop.api.resources.apikeys.requests.DeleteApiKeysRequest; +import com.whop.api.resources.apikeys.requests.ListApiKeysRequest; +import com.whop.api.resources.apikeys.requests.RetrieveApiKeysRequest; +import com.whop.api.resources.apikeys.requests.RotateApiKeysRequest; +import com.whop.api.resources.apikeys.requests.UpdateApiKeysRequest; +import com.whop.api.resources.apikeys.types.DeleteApiKeysResponse; +import com.whop.api.resources.apikeys.types.ListApiKeysResponse; +import com.whop.api.resources.apikeys.types.ListPermissionsApiKeysResponse; +import com.whop.api.types.ApiKey; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawApiKeysClient { + protected final ClientOptions clientOptions; + + public AsyncRawApiKeysClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the API keys of an account or app, newest first. Responses never include the full secret — only its obfuscated form. + */ + public CompletableFuture>> list(ListApiKeysRequest request) { + return list(request, null); + } + + /** + * Lists the API keys of an account or app, newest first. Responses never include the full secret — only its obfuscated form. + */ + public CompletableFuture>> list( + ListApiKeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api_keys"); + QueryStringMapper.addQueryParameter(httpUrl, "resource_id", request.getResourceId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "resource_type", request.getResourceType(), false); + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListApiKeysResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListApiKeysResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListApiKeysRequest nextRequest = ListApiKeysRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable(startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates an API key for an account or app. The response is the only place the full secret_key is returned — store it immediately. Requires a user session; API keys cannot manage API keys. + */ + public CompletableFuture> create(CreateApiKeysRequest request) { + return create(request, null); + } + + /** + * Creates an API key for an account or app. The response is the only place the full secret_key is returned — store it immediately. Requires a user session; API keys cannot manage API keys. + */ + public CompletableFuture> create( + CreateApiKeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api_keys"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiKey.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Lists the catalog of permission actions that can be granted to users, apps, and API keys — the source for the dashboard's permission pickers. Small and returned in full on one page. + */ + public CompletableFuture> listPermissions() { + return listPermissions(null); + } + + /** + * Lists the catalog of permission actions that can be granted to users, apps, and API keys — the source for the dashboard's permission pickers. Small and returned in full on one page. + */ + public CompletableFuture> listPermissions( + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api_keys/permissions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListPermissionsApiKeysResponse.class), + response)); + return; + } + try { + if (response.code() == 401) { + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveApiKeysRequest.builder().build()); + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveApiKeysRequest.builder().build(), requestOptions); + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public CompletableFuture> retrieve(String id, RetrieveApiKeysRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public CompletableFuture> retrieve( + String id, RetrieveApiKeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api_keys") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiKey.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteApiKeysRequest.builder().build()); + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public CompletableFuture> delete( + String id, RequestOptions requestOptions) { + return delete(id, DeleteApiKeysRequest.builder().build(), requestOptions); + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public CompletableFuture> delete( + String id, DeleteApiKeysRequest request) { + return delete(id, request, null); + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public CompletableFuture> delete( + String id, DeleteApiKeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api_keys") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteApiKeysResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateApiKeysRequest.builder().build()); + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateApiKeysRequest.builder().build(), requestOptions); + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public CompletableFuture> update(String id, UpdateApiKeysRequest request) { + return update(id, request, null); + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public CompletableFuture> update( + String id, UpdateApiKeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api_keys") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiKey.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public CompletableFuture> rotate(String id) { + return rotate(id, RotateApiKeysRequest.builder().build()); + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public CompletableFuture> rotate(String id, RequestOptions requestOptions) { + return rotate(id, RotateApiKeysRequest.builder().build(), requestOptions); + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public CompletableFuture> rotate(String id, RotateApiKeysRequest request) { + return rotate(id, request, null); + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public CompletableFuture> rotate( + String id, RotateApiKeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api_keys") + .addPathSegment(id) + .addPathSegments("rotate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiKey.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/RawApiKeysClient.java b/src/main/java/com/whop/api/resources/apikeys/RawApiKeysClient.java new file mode 100644 index 00000000..65e0881d --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/RawApiKeysClient.java @@ -0,0 +1,598 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.apikeys.requests.CreateApiKeysRequest; +import com.whop.api.resources.apikeys.requests.DeleteApiKeysRequest; +import com.whop.api.resources.apikeys.requests.ListApiKeysRequest; +import com.whop.api.resources.apikeys.requests.RetrieveApiKeysRequest; +import com.whop.api.resources.apikeys.requests.RotateApiKeysRequest; +import com.whop.api.resources.apikeys.requests.UpdateApiKeysRequest; +import com.whop.api.resources.apikeys.types.DeleteApiKeysResponse; +import com.whop.api.resources.apikeys.types.ListApiKeysResponse; +import com.whop.api.resources.apikeys.types.ListPermissionsApiKeysResponse; +import com.whop.api.types.ApiKey; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawApiKeysClient { + protected final ClientOptions clientOptions; + + public RawApiKeysClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the API keys of an account or app, newest first. Responses never include the full secret — only its obfuscated form. + */ + public WhopApiHttpResponse> list(ListApiKeysRequest request) { + return list(request, null); + } + + /** + * Lists the API keys of an account or app, newest first. Responses never include the full secret — only its obfuscated form. + */ + public WhopApiHttpResponse> list( + ListApiKeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api_keys"); + QueryStringMapper.addQueryParameter(httpUrl, "resource_id", request.getResourceId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "resource_type", request.getResourceType(), false); + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListApiKeysResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListApiKeysResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListApiKeysRequest nextRequest = ListApiKeysRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates an API key for an account or app. The response is the only place the full secret_key is returned — store it immediately. Requires a user session; API keys cannot manage API keys. + */ + public WhopApiHttpResponse create(CreateApiKeysRequest request) { + return create(request, null); + } + + /** + * Creates an API key for an account or app. The response is the only place the full secret_key is returned — store it immediately. Requires a user session; API keys cannot manage API keys. + */ + public WhopApiHttpResponse create(CreateApiKeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api_keys"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiKey.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Lists the catalog of permission actions that can be granted to users, apps, and API keys — the source for the dashboard's permission pickers. Small and returned in full on one page. + */ + public WhopApiHttpResponse listPermissions() { + return listPermissions(null); + } + + /** + * Lists the catalog of permission actions that can be granted to users, apps, and API keys — the source for the dashboard's permission pickers. Small and returned in full on one page. + */ + public WhopApiHttpResponse listPermissions(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api_keys/permissions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPermissionsApiKeysResponse.class), + response); + } + try { + if (response.code() == 401) { + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveApiKeysRequest.builder().build()); + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveApiKeysRequest.builder().build(), requestOptions); + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveApiKeysRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves an API key with its effective permission grants. The full secret is never returned — rotate the key if it was lost. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveApiKeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api_keys") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiKey.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteApiKeysRequest.builder().build()); + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteApiKeysRequest.builder().build(), requestOptions); + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public WhopApiHttpResponse delete(String id, DeleteApiKeysRequest request) { + return delete(id, request, null); + } + + /** + * Permanently revokes an API key; requests using its secret stop authenticating immediately. Default and agent-backend keys cannot be deleted. + */ + public WhopApiHttpResponse delete( + String id, DeleteApiKeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api_keys") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteApiKeysResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateApiKeysRequest.builder().build()); + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateApiKeysRequest.builder().build(), requestOptions); + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public WhopApiHttpResponse update(String id, UpdateApiKeysRequest request) { + return update(id, request, null); + } + + /** + * Updates an API key's name, permissions, API version, expiration, or IP allowlist. Fields that are omitted keep their current value; default keys cannot be modified. + */ + public WhopApiHttpResponse update(String id, UpdateApiKeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api_keys") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiKey.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public WhopApiHttpResponse rotate(String id) { + return rotate(id, RotateApiKeysRequest.builder().build()); + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public WhopApiHttpResponse rotate(String id, RequestOptions requestOptions) { + return rotate(id, RotateApiKeysRequest.builder().build(), requestOptions); + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public WhopApiHttpResponse rotate(String id, RotateApiKeysRequest request) { + return rotate(id, request, null); + } + + /** + * Rotates the API key's secret, invalidating the previous secret immediately. The response is the only place the new secret_key is returned. + */ + public WhopApiHttpResponse rotate(String id, RotateApiKeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api_keys") + .addPathSegment(id) + .addPathSegments("rotate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiKey.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/requests/CreateApiKeysRequest.java b/src/main/java/com/whop/api/resources/apikeys/requests/CreateApiKeysRequest.java new file mode 100644 index 00000000..f0d73fc8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/requests/CreateApiKeysRequest.java @@ -0,0 +1,444 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.apikeys.types.CreateApiKeysRequestApiVersionDate; +import com.whop.api.resources.apikeys.types.CreateApiKeysRequestPermissions; +import com.whop.api.resources.apikeys.types.CreateApiKeysRequestResourceType; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateApiKeysRequest.Builder.class) +public final class CreateApiKeysRequest { + private final Optional apiVersionDate; + + private final Optional expiresAt; + + private final Optional> ipAllowlist; + + private final String name; + + private final CreateApiKeysRequestPermissions permissions; + + private final String resourceId; + + private final CreateApiKeysRequestResourceType resourceType; + + private final Map additionalProperties; + + private CreateApiKeysRequest( + Optional apiVersionDate, + Optional expiresAt, + Optional> ipAllowlist, + String name, + CreateApiKeysRequestPermissions permissions, + String resourceId, + CreateApiKeysRequestResourceType resourceType, + Map additionalProperties) { + this.apiVersionDate = apiVersionDate; + this.expiresAt = expiresAt; + this.ipAllowlist = ipAllowlist; + this.name = name; + this.permissions = permissions; + this.resourceId = resourceId; + this.resourceType = resourceType; + this.additionalProperties = additionalProperties; + } + + /** + * @return Dated API version used when requests authenticated with this key omit the Api-Version-Date header. New keys default to the latest version. + */ + @JsonProperty("api_version_date") + public Optional getApiVersionDate() { + return apiVersionDate; + } + + /** + * @return When the API key should stop working, as an ISO 8601 timestamp. Omit (or pass null on update) for a key that never expires. + */ + @JsonIgnore + public Optional getExpiresAt() { + if (expiresAt == null) { + return Optional.empty(); + } + return expiresAt; + } + + /** + * @return IPv4/IPv6 CIDR ranges allowed to use this key, for example ["203.0.113.0/24"]. Empty or null allows any IP. + */ + @JsonIgnore + public Optional> getIpAllowlist() { + if (ipAllowlist == null) { + return Optional.empty(); + } + return ipAllowlist; + } + + /** + * @return A human-readable name for the API key, such as 'Production API Key'. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The permissions policy for the API key: explicit permission statements, or a system role to inherit from. Statements without a resources array default to the owning account (Account API keys) or every key-addressable resource (App API keys). + */ + @JsonProperty("permissions") + public CreateApiKeysRequestPermissions getPermissions() { + return permissions; + } + + /** + * @return The account (biz_) or app (app_) tag to create the API key for. + */ + @JsonProperty("resource_id") + public String getResourceId() { + return resourceId; + } + + /** + * @return The type of resource that will own this API key. + */ + @JsonProperty("resource_type") + public CreateApiKeysRequestResourceType getResourceType() { + return resourceType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expires_at") + private Optional _getExpiresAt() { + return expiresAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ip_allowlist") + private Optional> _getIpAllowlist() { + return ipAllowlist; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateApiKeysRequest && equalTo((CreateApiKeysRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateApiKeysRequest other) { + return apiVersionDate.equals(other.apiVersionDate) + && expiresAt.equals(other.expiresAt) + && ipAllowlist.equals(other.ipAllowlist) + && name.equals(other.name) + && permissions.equals(other.permissions) + && resourceId.equals(other.resourceId) + && resourceType.equals(other.resourceType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.apiVersionDate, + this.expiresAt, + this.ipAllowlist, + this.name, + this.permissions, + this.resourceId, + this.resourceType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

A human-readable name for the API key, such as 'Production API Key'.

+ */ + PermissionsStage name(@NotNull String name); + + Builder from(CreateApiKeysRequest other); + } + + public interface PermissionsStage { + /** + *

The permissions policy for the API key: explicit permission statements, or a system role to inherit from. Statements without a resources array default to the owning account (Account API keys) or every key-addressable resource (App API keys).

+ */ + ResourceIdStage permissions(@NotNull CreateApiKeysRequestPermissions permissions); + } + + public interface ResourceIdStage { + /** + *

The account (biz_) or app (app_) tag to create the API key for.

+ */ + ResourceTypeStage resourceId(@NotNull String resourceId); + } + + public interface ResourceTypeStage { + /** + *

The type of resource that will own this API key.

+ */ + _FinalStage resourceType(@NotNull CreateApiKeysRequestResourceType resourceType); + } + + public interface _FinalStage { + CreateApiKeysRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Dated API version used when requests authenticated with this key omit the Api-Version-Date header. New keys default to the latest version.

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(CreateApiKeysRequestApiVersionDate apiVersionDate); + + /** + *

When the API key should stop working, as an ISO 8601 timestamp. Omit (or pass null on update) for a key that never expires.

+ */ + _FinalStage expiresAt(Optional expiresAt); + + _FinalStage expiresAt(String expiresAt); + + _FinalStage expiresAt(Nullable expiresAt); + + /** + *

IPv4/IPv6 CIDR ranges allowed to use this key, for example ["203.0.113.0/24"]. Empty or null allows any IP.

+ */ + _FinalStage ipAllowlist(Optional> ipAllowlist); + + _FinalStage ipAllowlist(List ipAllowlist); + + _FinalStage ipAllowlist(Nullable> ipAllowlist); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements NameStage, PermissionsStage, ResourceIdStage, ResourceTypeStage, _FinalStage { + private String name; + + private CreateApiKeysRequestPermissions permissions; + + private String resourceId; + + private CreateApiKeysRequestResourceType resourceType; + + private Optional> ipAllowlist = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateApiKeysRequest other) { + apiVersionDate(other.getApiVersionDate()); + expiresAt(other.getExpiresAt()); + ipAllowlist(other.getIpAllowlist()); + name(other.getName()); + permissions(other.getPermissions()); + resourceId(other.getResourceId()); + resourceType(other.getResourceType()); + return this; + } + + /** + *

A human-readable name for the API key, such as 'Production API Key'.

+ *

A human-readable name for the API key, such as 'Production API Key'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public PermissionsStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The permissions policy for the API key: explicit permission statements, or a system role to inherit from. Statements without a resources array default to the owning account (Account API keys) or every key-addressable resource (App API keys).

+ *

The permissions policy for the API key: explicit permission statements, or a system role to inherit from. Statements without a resources array default to the owning account (Account API keys) or every key-addressable resource (App API keys).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("permissions") + public ResourceIdStage permissions(@NotNull CreateApiKeysRequestPermissions permissions) { + this.permissions = Objects.requireNonNull(permissions, "permissions must not be null"); + return this; + } + + /** + *

The account (biz_) or app (app_) tag to create the API key for.

+ *

The account (biz_) or app (app_) tag to create the API key for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_id") + public ResourceTypeStage resourceId(@NotNull String resourceId) { + this.resourceId = Objects.requireNonNull(resourceId, "resourceId must not be null"); + return this; + } + + /** + *

The type of resource that will own this API key.

+ *

The type of resource that will own this API key.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_type") + public _FinalStage resourceType(@NotNull CreateApiKeysRequestResourceType resourceType) { + this.resourceType = Objects.requireNonNull(resourceType, "resourceType must not be null"); + return this; + } + + /** + *

IPv4/IPv6 CIDR ranges allowed to use this key, for example ["203.0.113.0/24"]. Empty or null allows any IP.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage ipAllowlist(Nullable> ipAllowlist) { + if (ipAllowlist.isNull()) { + this.ipAllowlist = null; + } else if (ipAllowlist.isEmpty()) { + this.ipAllowlist = Optional.empty(); + } else { + this.ipAllowlist = Optional.of(ipAllowlist.get()); + } + return this; + } + + /** + *

IPv4/IPv6 CIDR ranges allowed to use this key, for example ["203.0.113.0/24"]. Empty or null allows any IP.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage ipAllowlist(List ipAllowlist) { + this.ipAllowlist = Optional.ofNullable(ipAllowlist); + return this; + } + + /** + *

IPv4/IPv6 CIDR ranges allowed to use this key, for example ["203.0.113.0/24"]. Empty or null allows any IP.

+ */ + @java.lang.Override + @JsonSetter(value = "ip_allowlist", nulls = Nulls.SKIP) + public _FinalStage ipAllowlist(Optional> ipAllowlist) { + this.ipAllowlist = ipAllowlist; + return this; + } + + /** + *

When the API key should stop working, as an ISO 8601 timestamp. Omit (or pass null on update) for a key that never expires.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expiresAt(Nullable expiresAt) { + if (expiresAt.isNull()) { + this.expiresAt = null; + } else if (expiresAt.isEmpty()) { + this.expiresAt = Optional.empty(); + } else { + this.expiresAt = Optional.of(expiresAt.get()); + } + return this; + } + + /** + *

When the API key should stop working, as an ISO 8601 timestamp. Omit (or pass null on update) for a key that never expires.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expiresAt(String expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + /** + *

When the API key should stop working, as an ISO 8601 timestamp. Omit (or pass null on update) for a key that never expires.

+ */ + @java.lang.Override + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public _FinalStage expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + *

Dated API version used when requests authenticated with this key omit the Api-Version-Date header. New keys default to the latest version.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(CreateApiKeysRequestApiVersionDate apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

Dated API version used when requests authenticated with this key omit the Api-Version-Date header. New keys default to the latest version.

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + @java.lang.Override + public CreateApiKeysRequest build() { + return new CreateApiKeysRequest( + apiVersionDate, + expiresAt, + ipAllowlist, + name, + permissions, + resourceId, + resourceType, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/requests/DeleteApiKeysRequest.java b/src/main/java/com/whop/api/resources/apikeys/requests/DeleteApiKeysRequest.java new file mode 100644 index 00000000..cf2335ff --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/requests/DeleteApiKeysRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteApiKeysRequest.Builder.class) +public final class DeleteApiKeysRequest { + private final Map additionalProperties; + + private DeleteApiKeysRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteApiKeysRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteApiKeysRequest other) { + return this; + } + + public DeleteApiKeysRequest build() { + return new DeleteApiKeysRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/requests/ListApiKeysRequest.java b/src/main/java/com/whop/api/resources/apikeys/requests/ListApiKeysRequest.java new file mode 100644 index 00000000..f3f201f3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/requests/ListApiKeysRequest.java @@ -0,0 +1,538 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.apikeys.types.ListApiKeysRequestDirection; +import com.whop.api.resources.apikeys.types.ListApiKeysRequestOrder; +import com.whop.api.resources.apikeys.types.ListApiKeysRequestResourceType; +import com.whop.api.types.ListApiKeysRequestCreatedAfter; +import com.whop.api.types.ListApiKeysRequestCreatedBefore; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListApiKeysRequest.Builder.class) +public final class ListApiKeysRequest { + private final String resourceId; + + private final ListApiKeysRequestResourceType resourceType; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Optional order; + + private final Optional direction; + + private final Map additionalProperties; + + private ListApiKeysRequest( + String resourceId, + ListApiKeysRequestResourceType resourceType, + Optional createdBefore, + Optional createdAfter, + Optional first, + Optional after, + Optional last, + Optional before, + Optional order, + Optional direction, + Map additionalProperties) { + this.resourceId = resourceId; + this.resourceType = resourceType; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.order = order; + this.direction = direction; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account (biz_) or app (app_) tag to list API keys for. + */ + @JsonProperty("resource_id") + public String getResourceId() { + return resourceId; + } + + /** + * @return The type of resource that owns the API keys. + */ + @JsonProperty("resource_type") + public ListApiKeysRequestResourceType getResourceType() { + return resourceType; + } + + /** + * @return Only return API keys created before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return API keys created after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return The number of API keys to return (default 20, max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns API keys after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of API keys to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns API keys before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The field to sort API keys by. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListApiKeysRequest && equalTo((ListApiKeysRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListApiKeysRequest other) { + return resourceId.equals(other.resourceId) + && resourceType.equals(other.resourceType) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before) + && order.equals(other.order) + && direction.equals(other.direction); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.resourceId, + this.resourceType, + this.createdBefore, + this.createdAfter, + this.first, + this.after, + this.last, + this.before, + this.order, + this.direction); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ResourceIdStage builder() { + return new Builder(); + } + + public interface ResourceIdStage { + /** + *

The account (biz_) or app (app_) tag to list API keys for.

+ */ + ResourceTypeStage resourceId(@NotNull String resourceId); + + Builder from(ListApiKeysRequest other); + } + + public interface ResourceTypeStage { + /** + *

The type of resource that owns the API keys.

+ */ + _FinalStage resourceType(@NotNull ListApiKeysRequestResourceType resourceType); + } + + public interface _FinalStage { + ListApiKeysRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Only return API keys created before this ISO 8601 timestamp.

+ */ + _FinalStage createdBefore(Optional createdBefore); + + _FinalStage createdBefore(ListApiKeysRequestCreatedBefore createdBefore); + + /** + *

Only return API keys created after this ISO 8601 timestamp.

+ */ + _FinalStage createdAfter(Optional createdAfter); + + _FinalStage createdAfter(ListApiKeysRequestCreatedAfter createdAfter); + + /** + *

The number of API keys to return (default 20, max 100).

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

A cursor; returns API keys after this position.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

The number of API keys to return from the end of the range.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + /** + *

A cursor; returns API keys before this position.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

The field to sort API keys by.

+ */ + _FinalStage order(Optional order); + + _FinalStage order(ListApiKeysRequestOrder order); + + /** + *

Sort direction.

+ */ + _FinalStage direction(Optional direction); + + _FinalStage direction(ListApiKeysRequestDirection direction); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ResourceIdStage, ResourceTypeStage, _FinalStage { + private String resourceId; + + private ListApiKeysRequestResourceType resourceType; + + private Optional direction = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListApiKeysRequest other) { + resourceId(other.getResourceId()); + resourceType(other.getResourceType()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + order(other.getOrder()); + direction(other.getDirection()); + return this; + } + + /** + *

The account (biz_) or app (app_) tag to list API keys for.

+ *

The account (biz_) or app (app_) tag to list API keys for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_id") + public ResourceTypeStage resourceId(@NotNull String resourceId) { + this.resourceId = Objects.requireNonNull(resourceId, "resourceId must not be null"); + return this; + } + + /** + *

The type of resource that owns the API keys.

+ *

The type of resource that owns the API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_type") + public _FinalStage resourceType(@NotNull ListApiKeysRequestResourceType resourceType) { + this.resourceType = Objects.requireNonNull(resourceType, "resourceType must not be null"); + return this; + } + + /** + *

Sort direction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage direction(ListApiKeysRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Sort direction.

+ */ + @java.lang.Override + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public _FinalStage direction(Optional direction) { + this.direction = direction; + return this; + } + + /** + *

The field to sort API keys by.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(ListApiKeysRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The field to sort API keys by.

+ */ + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + /** + *

A cursor; returns API keys before this position.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

A cursor; returns API keys before this position.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

The number of API keys to return from the end of the range.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The number of API keys to return from the end of the range.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

A cursor; returns API keys after this position.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

A cursor; returns API keys after this position.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + /** + *

The number of API keys to return (default 20, max 100).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

The number of API keys to return (default 20, max 100).

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Only return API keys created after this ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAfter(ListApiKeysRequestCreatedAfter createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only return API keys created after this ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public _FinalStage createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + /** + *

Only return API keys created before this ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdBefore(ListApiKeysRequestCreatedBefore createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return API keys created before this ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public _FinalStage createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + @java.lang.Override + public ListApiKeysRequest build() { + return new ListApiKeysRequest( + resourceId, + resourceType, + createdBefore, + createdAfter, + first, + after, + last, + before, + order, + direction, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/requests/RetrieveApiKeysRequest.java b/src/main/java/com/whop/api/resources/apikeys/requests/RetrieveApiKeysRequest.java new file mode 100644 index 00000000..f077ad39 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/requests/RetrieveApiKeysRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveApiKeysRequest.Builder.class) +public final class RetrieveApiKeysRequest { + private final Map additionalProperties; + + private RetrieveApiKeysRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveApiKeysRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveApiKeysRequest other) { + return this; + } + + public RetrieveApiKeysRequest build() { + return new RetrieveApiKeysRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/requests/RotateApiKeysRequest.java b/src/main/java/com/whop/api/resources/apikeys/requests/RotateApiKeysRequest.java new file mode 100644 index 00000000..156f3228 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/requests/RotateApiKeysRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RotateApiKeysRequest.Builder.class) +public final class RotateApiKeysRequest { + private final Map additionalProperties; + + private RotateApiKeysRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RotateApiKeysRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RotateApiKeysRequest other) { + return this; + } + + public RotateApiKeysRequest build() { + return new RotateApiKeysRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/requests/UpdateApiKeysRequest.java b/src/main/java/com/whop/api/resources/apikeys/requests/UpdateApiKeysRequest.java new file mode 100644 index 00000000..0654c244 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/requests/UpdateApiKeysRequest.java @@ -0,0 +1,300 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.apikeys.types.UpdateApiKeysRequestApiVersionDate; +import com.whop.api.resources.apikeys.types.UpdateApiKeysRequestPermissions; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateApiKeysRequest.Builder.class) +public final class UpdateApiKeysRequest { + private final Optional apiVersionDate; + + private final Optional expiresAt; + + private final Optional> ipAllowlist; + + private final Optional name; + + private final Optional permissions; + + private final Map additionalProperties; + + private UpdateApiKeysRequest( + Optional apiVersionDate, + Optional expiresAt, + Optional> ipAllowlist, + Optional name, + Optional permissions, + Map additionalProperties) { + this.apiVersionDate = apiVersionDate; + this.expiresAt = expiresAt; + this.ipAllowlist = ipAllowlist; + this.name = name; + this.permissions = permissions; + this.additionalProperties = additionalProperties; + } + + /** + * @return Dated API version used when requests authenticated with this key omit the Api-Version-Date header. New keys default to the latest version. + */ + @JsonProperty("api_version_date") + public Optional getApiVersionDate() { + return apiVersionDate; + } + + /** + * @return When the API key should stop working, as an ISO 8601 timestamp. Omit (or pass null on update) for a key that never expires. + */ + @JsonIgnore + public Optional getExpiresAt() { + if (expiresAt == null) { + return Optional.empty(); + } + return expiresAt; + } + + /** + * @return IPv4/IPv6 CIDR ranges allowed to use this key, for example ["203.0.113.0/24"]. Empty or null allows any IP. + */ + @JsonIgnore + public Optional> getIpAllowlist() { + if (ipAllowlist == null) { + return Optional.empty(); + } + return ipAllowlist; + } + + /** + * @return A new human-readable name for the API key. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The permissions policy for the API key: explicit permission statements, or a system role to inherit from. Statements without a resources array default to the owning account (Account API keys) or every key-addressable resource (App API keys). + */ + @JsonProperty("permissions") + public Optional getPermissions() { + return permissions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expires_at") + private Optional _getExpiresAt() { + return expiresAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ip_allowlist") + private Optional> _getIpAllowlist() { + return ipAllowlist; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateApiKeysRequest && equalTo((UpdateApiKeysRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateApiKeysRequest other) { + return apiVersionDate.equals(other.apiVersionDate) + && expiresAt.equals(other.expiresAt) + && ipAllowlist.equals(other.ipAllowlist) + && name.equals(other.name) + && permissions.equals(other.permissions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiVersionDate, this.expiresAt, this.ipAllowlist, this.name, this.permissions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional apiVersionDate = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + private Optional> ipAllowlist = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional permissions = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateApiKeysRequest other) { + apiVersionDate(other.getApiVersionDate()); + expiresAt(other.getExpiresAt()); + ipAllowlist(other.getIpAllowlist()); + name(other.getName()); + permissions(other.getPermissions()); + return this; + } + + /** + *

Dated API version used when requests authenticated with this key omit the Api-Version-Date header. New keys default to the latest version.

+ */ + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public Builder apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + public Builder apiVersionDate(UpdateApiKeysRequestApiVersionDate apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

When the API key should stop working, as an ISO 8601 timestamp. Omit (or pass null on update) for a key that never expires.

+ */ + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public Builder expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + public Builder expiresAt(String expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + public Builder expiresAt(Nullable expiresAt) { + if (expiresAt.isNull()) { + this.expiresAt = null; + } else if (expiresAt.isEmpty()) { + this.expiresAt = Optional.empty(); + } else { + this.expiresAt = Optional.of(expiresAt.get()); + } + return this; + } + + /** + *

IPv4/IPv6 CIDR ranges allowed to use this key, for example ["203.0.113.0/24"]. Empty or null allows any IP.

+ */ + @JsonSetter(value = "ip_allowlist", nulls = Nulls.SKIP) + public Builder ipAllowlist(Optional> ipAllowlist) { + this.ipAllowlist = ipAllowlist; + return this; + } + + public Builder ipAllowlist(List ipAllowlist) { + this.ipAllowlist = Optional.ofNullable(ipAllowlist); + return this; + } + + public Builder ipAllowlist(Nullable> ipAllowlist) { + if (ipAllowlist.isNull()) { + this.ipAllowlist = null; + } else if (ipAllowlist.isEmpty()) { + this.ipAllowlist = Optional.empty(); + } else { + this.ipAllowlist = Optional.of(ipAllowlist.get()); + } + return this; + } + + /** + *

A new human-readable name for the API key.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The permissions policy for the API key: explicit permission statements, or a system role to inherit from. Statements without a resources array default to the owning account (Account API keys) or every key-addressable resource (App API keys).

+ */ + @JsonSetter(value = "permissions", nulls = Nulls.SKIP) + public Builder permissions(Optional permissions) { + this.permissions = permissions; + return this; + } + + public Builder permissions(UpdateApiKeysRequestPermissions permissions) { + this.permissions = Optional.ofNullable(permissions); + return this; + } + + public UpdateApiKeysRequest build() { + return new UpdateApiKeysRequest( + apiVersionDate, expiresAt, ipAllowlist, name, permissions, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/CreateApiKeysRequestApiVersionDate.java b/src/main/java/com/whop/api/resources/apikeys/types/CreateApiKeysRequestApiVersionDate.java new file mode 100644 index 00000000..7fb864c7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/CreateApiKeysRequestApiVersionDate.java @@ -0,0 +1,339 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateApiKeysRequestApiVersionDate { + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0708 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0708, "2026-07-08"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX08051 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX08051, "2026-08-05-1"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0821 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0821, "2026-08-21"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX07291 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX07291, "2026-07-29-1"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0731 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0731, "2026-07-31"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0729 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0729, "2026-07-29"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0803 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0803, "2026-08-03"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0620 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0620, "2026-06-20"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_FIVE0101 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_FIVE0101, "2025-01-01"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX07081 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX07081, "2026-07-08-1"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0723 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0723, "2026-07-23"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0810 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0810, "2026-08-10"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0722 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0722, "2026-07-22"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0720 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0720, "2026-07-20"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0718 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0718, "2026-07-18"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0805 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0805, "2026-08-05"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0727 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0727, "2026-07-27"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0726 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0726, "2026-07-26"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0701 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0701, "2026-07-01"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0813 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0813, "2026-08-13"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0725 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0725, "2026-07-25"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0814 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0814, "2026-08-14"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0608 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0608, "2026-06-08"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0609 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0609, "2026-06-09"); + + public static final CreateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0812 = + new CreateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0812, "2026-08-12"); + + private final Value value; + + private final String string; + + CreateApiKeysRequestApiVersionDate(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateApiKeysRequestApiVersionDate + && this.string.equals(((CreateApiKeysRequestApiVersionDate) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TWO_THOUSAND_TWENTY_SIX0708: + return visitor.visitTwoThousandTwentySix0708(); + case TWO_THOUSAND_TWENTY_SIX08051: + return visitor.visitTwoThousandTwentySix08051(); + case TWO_THOUSAND_TWENTY_SIX0821: + return visitor.visitTwoThousandTwentySix0821(); + case TWO_THOUSAND_TWENTY_SIX07291: + return visitor.visitTwoThousandTwentySix07291(); + case TWO_THOUSAND_TWENTY_SIX0731: + return visitor.visitTwoThousandTwentySix0731(); + case TWO_THOUSAND_TWENTY_SIX0729: + return visitor.visitTwoThousandTwentySix0729(); + case TWO_THOUSAND_TWENTY_SIX0803: + return visitor.visitTwoThousandTwentySix0803(); + case TWO_THOUSAND_TWENTY_SIX0620: + return visitor.visitTwoThousandTwentySix0620(); + case TWO_THOUSAND_TWENTY_FIVE0101: + return visitor.visitTwoThousandTwentyFive0101(); + case TWO_THOUSAND_TWENTY_SIX07081: + return visitor.visitTwoThousandTwentySix07081(); + case TWO_THOUSAND_TWENTY_SIX0723: + return visitor.visitTwoThousandTwentySix0723(); + case TWO_THOUSAND_TWENTY_SIX0810: + return visitor.visitTwoThousandTwentySix0810(); + case TWO_THOUSAND_TWENTY_SIX0722: + return visitor.visitTwoThousandTwentySix0722(); + case TWO_THOUSAND_TWENTY_SIX0720: + return visitor.visitTwoThousandTwentySix0720(); + case TWO_THOUSAND_TWENTY_SIX0718: + return visitor.visitTwoThousandTwentySix0718(); + case TWO_THOUSAND_TWENTY_SIX0805: + return visitor.visitTwoThousandTwentySix0805(); + case TWO_THOUSAND_TWENTY_SIX0727: + return visitor.visitTwoThousandTwentySix0727(); + case TWO_THOUSAND_TWENTY_SIX0726: + return visitor.visitTwoThousandTwentySix0726(); + case TWO_THOUSAND_TWENTY_SIX0701: + return visitor.visitTwoThousandTwentySix0701(); + case TWO_THOUSAND_TWENTY_SIX0813: + return visitor.visitTwoThousandTwentySix0813(); + case TWO_THOUSAND_TWENTY_SIX0725: + return visitor.visitTwoThousandTwentySix0725(); + case TWO_THOUSAND_TWENTY_SIX0814: + return visitor.visitTwoThousandTwentySix0814(); + case TWO_THOUSAND_TWENTY_SIX0608: + return visitor.visitTwoThousandTwentySix0608(); + case TWO_THOUSAND_TWENTY_SIX0609: + return visitor.visitTwoThousandTwentySix0609(); + case TWO_THOUSAND_TWENTY_SIX0812: + return visitor.visitTwoThousandTwentySix0812(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateApiKeysRequestApiVersionDate valueOf(String value) { + switch (value) { + case "2026-07-08": + return TWO_THOUSAND_TWENTY_SIX0708; + case "2026-08-05-1": + return TWO_THOUSAND_TWENTY_SIX08051; + case "2026-08-21": + return TWO_THOUSAND_TWENTY_SIX0821; + case "2026-07-29-1": + return TWO_THOUSAND_TWENTY_SIX07291; + case "2026-07-31": + return TWO_THOUSAND_TWENTY_SIX0731; + case "2026-07-29": + return TWO_THOUSAND_TWENTY_SIX0729; + case "2026-08-03": + return TWO_THOUSAND_TWENTY_SIX0803; + case "2026-06-20": + return TWO_THOUSAND_TWENTY_SIX0620; + case "2025-01-01": + return TWO_THOUSAND_TWENTY_FIVE0101; + case "2026-07-08-1": + return TWO_THOUSAND_TWENTY_SIX07081; + case "2026-07-23": + return TWO_THOUSAND_TWENTY_SIX0723; + case "2026-08-10": + return TWO_THOUSAND_TWENTY_SIX0810; + case "2026-07-22": + return TWO_THOUSAND_TWENTY_SIX0722; + case "2026-07-20": + return TWO_THOUSAND_TWENTY_SIX0720; + case "2026-07-18": + return TWO_THOUSAND_TWENTY_SIX0718; + case "2026-08-05": + return TWO_THOUSAND_TWENTY_SIX0805; + case "2026-07-27": + return TWO_THOUSAND_TWENTY_SIX0727; + case "2026-07-26": + return TWO_THOUSAND_TWENTY_SIX0726; + case "2026-07-01": + return TWO_THOUSAND_TWENTY_SIX0701; + case "2026-08-13": + return TWO_THOUSAND_TWENTY_SIX0813; + case "2026-07-25": + return TWO_THOUSAND_TWENTY_SIX0725; + case "2026-08-14": + return TWO_THOUSAND_TWENTY_SIX0814; + case "2026-06-08": + return TWO_THOUSAND_TWENTY_SIX0608; + case "2026-06-09": + return TWO_THOUSAND_TWENTY_SIX0609; + case "2026-08-12": + return TWO_THOUSAND_TWENTY_SIX0812; + default: + return new CreateApiKeysRequestApiVersionDate(Value.UNKNOWN, value); + } + } + + public enum Value { + TWO_THOUSAND_TWENTY_FIVE0101, + + TWO_THOUSAND_TWENTY_SIX0608, + + TWO_THOUSAND_TWENTY_SIX0609, + + TWO_THOUSAND_TWENTY_SIX0620, + + TWO_THOUSAND_TWENTY_SIX0701, + + TWO_THOUSAND_TWENTY_SIX0708, + + TWO_THOUSAND_TWENTY_SIX07081, + + TWO_THOUSAND_TWENTY_SIX0718, + + TWO_THOUSAND_TWENTY_SIX0720, + + TWO_THOUSAND_TWENTY_SIX0722, + + TWO_THOUSAND_TWENTY_SIX0723, + + TWO_THOUSAND_TWENTY_SIX0725, + + TWO_THOUSAND_TWENTY_SIX0726, + + TWO_THOUSAND_TWENTY_SIX0727, + + TWO_THOUSAND_TWENTY_SIX0729, + + TWO_THOUSAND_TWENTY_SIX07291, + + TWO_THOUSAND_TWENTY_SIX0731, + + TWO_THOUSAND_TWENTY_SIX0803, + + TWO_THOUSAND_TWENTY_SIX0805, + + TWO_THOUSAND_TWENTY_SIX08051, + + TWO_THOUSAND_TWENTY_SIX0810, + + TWO_THOUSAND_TWENTY_SIX0812, + + TWO_THOUSAND_TWENTY_SIX0813, + + TWO_THOUSAND_TWENTY_SIX0814, + + TWO_THOUSAND_TWENTY_SIX0821, + + UNKNOWN + } + + public interface Visitor { + T visitTwoThousandTwentyFive0101(); + + T visitTwoThousandTwentySix0608(); + + T visitTwoThousandTwentySix0609(); + + T visitTwoThousandTwentySix0620(); + + T visitTwoThousandTwentySix0701(); + + T visitTwoThousandTwentySix0708(); + + T visitTwoThousandTwentySix07081(); + + T visitTwoThousandTwentySix0718(); + + T visitTwoThousandTwentySix0720(); + + T visitTwoThousandTwentySix0722(); + + T visitTwoThousandTwentySix0723(); + + T visitTwoThousandTwentySix0725(); + + T visitTwoThousandTwentySix0726(); + + T visitTwoThousandTwentySix0727(); + + T visitTwoThousandTwentySix0729(); + + T visitTwoThousandTwentySix07291(); + + T visitTwoThousandTwentySix0731(); + + T visitTwoThousandTwentySix0803(); + + T visitTwoThousandTwentySix0805(); + + T visitTwoThousandTwentySix08051(); + + T visitTwoThousandTwentySix0810(); + + T visitTwoThousandTwentySix0812(); + + T visitTwoThousandTwentySix0813(); + + T visitTwoThousandTwentySix0814(); + + T visitTwoThousandTwentySix0821(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/CreateApiKeysRequestPermissions.java b/src/main/java/com/whop/api/resources/apikeys/types/CreateApiKeysRequestPermissions.java new file mode 100644 index 00000000..c470a66e --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/CreateApiKeysRequestPermissions.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateApiKeysRequestPermissions.Builder.class) +public final class CreateApiKeysRequestPermissions { + private final Optional> statements; + + private final Optional systemRole; + + private final Map additionalProperties; + + private CreateApiKeysRequestPermissions( + Optional> statements, + Optional systemRole, + Map additionalProperties) { + this.statements = statements; + this.systemRole = systemRole; + this.additionalProperties = additionalProperties; + } + + /** + * @return Explicit permission statements. Required unless system_role is set. + */ + @JsonProperty("statements") + public Optional> getStatements() { + return statements; + } + + /** + * @return A system role to inherit permissions from. Only Account API keys can use a system role. + */ + @JsonIgnore + public Optional getSystemRole() { + if (systemRole == null) { + return Optional.empty(); + } + return systemRole; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("system_role") + private Optional _getSystemRole() { + return systemRole; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateApiKeysRequestPermissions && equalTo((CreateApiKeysRequestPermissions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateApiKeysRequestPermissions other) { + return statements.equals(other.statements) && systemRole.equals(other.systemRole); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.statements, this.systemRole); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> statements = Optional.empty(); + + private Optional systemRole = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateApiKeysRequestPermissions other) { + statements(other.getStatements()); + systemRole(other.getSystemRole()); + return this; + } + + /** + *

Explicit permission statements. Required unless system_role is set.

+ */ + @JsonSetter(value = "statements", nulls = Nulls.SKIP) + public Builder statements(Optional> statements) { + this.statements = statements; + return this; + } + + public Builder statements(List statements) { + this.statements = Optional.ofNullable(statements); + return this; + } + + /** + *

A system role to inherit permissions from. Only Account API keys can use a system role.

+ */ + @JsonSetter(value = "system_role", nulls = Nulls.SKIP) + public Builder systemRole(Optional systemRole) { + this.systemRole = systemRole; + return this; + } + + public Builder systemRole(CreateApiKeysRequestPermissionsSystemRole systemRole) { + this.systemRole = Optional.ofNullable(systemRole); + return this; + } + + public Builder systemRole(Nullable systemRole) { + if (systemRole.isNull()) { + this.systemRole = null; + } else if (systemRole.isEmpty()) { + this.systemRole = Optional.empty(); + } else { + this.systemRole = Optional.of(systemRole.get()); + } + return this; + } + + public CreateApiKeysRequestPermissions build() { + return new CreateApiKeysRequestPermissions(statements, systemRole, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/CreateApiKeysRequestPermissionsStatementsItem.java b/src/main/java/com/whop/api/resources/apikeys/types/CreateApiKeysRequestPermissionsStatementsItem.java new file mode 100644 index 00000000..090d2e63 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/CreateApiKeysRequestPermissionsStatementsItem.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateApiKeysRequestPermissionsStatementsItem.Builder.class) +public final class CreateApiKeysRequestPermissionsStatementsItem { + private final List actions; + + private final boolean grant; + + private final Optional> resources; + + private final Map additionalProperties; + + private CreateApiKeysRequestPermissionsStatementsItem( + List actions, + boolean grant, + Optional> resources, + Map additionalProperties) { + this.actions = actions; + this.grant = grant; + this.resources = resources; + this.additionalProperties = additionalProperties; + } + + /** + * @return Permission actions covered by this statement, for example company:basic:read. + */ + @JsonProperty("actions") + public List getActions() { + return actions; + } + + /** + * @return Whether the actions are granted (true) or denied (false). + */ + @JsonProperty("grant") + public boolean getGrant() { + return grant; + } + + /** + * @return Resource identifiers the statement applies to, for example biz_xxx or biz_xxx|pass_*. Defaults to the key's owning resource when omitted. + */ + @JsonProperty("resources") + public Optional> getResources() { + return resources; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateApiKeysRequestPermissionsStatementsItem + && equalTo((CreateApiKeysRequestPermissionsStatementsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateApiKeysRequestPermissionsStatementsItem other) { + return actions.equals(other.actions) && grant == other.grant && resources.equals(other.resources); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.actions, this.grant, this.resources); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static GrantStage builder() { + return new Builder(); + } + + public interface GrantStage { + /** + *

Whether the actions are granted (true) or denied (false).

+ */ + _FinalStage grant(boolean grant); + + Builder from(CreateApiKeysRequestPermissionsStatementsItem other); + } + + public interface _FinalStage { + CreateApiKeysRequestPermissionsStatementsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Permission actions covered by this statement, for example company:basic:read.

+ */ + _FinalStage actions(List actions); + + _FinalStage addActions(String actions); + + _FinalStage addAllActions(List actions); + + /** + *

Resource identifiers the statement applies to, for example biz_xxx or biz_xxx|pass_*. Defaults to the key's owning resource when omitted.

+ */ + _FinalStage resources(Optional> resources); + + _FinalStage resources(List resources); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements GrantStage, _FinalStage { + private boolean grant; + + private Optional> resources = Optional.empty(); + + private List actions = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateApiKeysRequestPermissionsStatementsItem other) { + actions(other.getActions()); + grant(other.getGrant()); + resources(other.getResources()); + return this; + } + + /** + *

Whether the actions are granted (true) or denied (false).

+ *

Whether the actions are granted (true) or denied (false).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("grant") + public _FinalStage grant(boolean grant) { + this.grant = grant; + return this; + } + + /** + *

Resource identifiers the statement applies to, for example biz_xxx or biz_xxx|pass_*. Defaults to the key's owning resource when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resources(List resources) { + this.resources = Optional.ofNullable(resources); + return this; + } + + /** + *

Resource identifiers the statement applies to, for example biz_xxx or biz_xxx|pass_*. Defaults to the key's owning resource when omitted.

+ */ + @java.lang.Override + @JsonSetter(value = "resources", nulls = Nulls.SKIP) + public _FinalStage resources(Optional> resources) { + this.resources = resources; + return this; + } + + /** + *

Permission actions covered by this statement, for example company:basic:read.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllActions(List actions) { + if (actions != null) { + this.actions.addAll(actions); + } + return this; + } + + /** + *

Permission actions covered by this statement, for example company:basic:read.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addActions(String actions) { + this.actions.add(actions); + return this; + } + + /** + *

Permission actions covered by this statement, for example company:basic:read.

+ */ + @java.lang.Override + @JsonSetter(value = "actions", nulls = Nulls.SKIP) + public _FinalStage actions(List actions) { + this.actions.clear(); + if (actions != null) { + this.actions.addAll(actions); + } + return this; + } + + @java.lang.Override + public CreateApiKeysRequestPermissionsStatementsItem build() { + return new CreateApiKeysRequestPermissionsStatementsItem(actions, grant, resources, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/CreateApiKeysRequestPermissionsSystemRole.java b/src/main/java/com/whop/api/resources/apikeys/types/CreateApiKeysRequestPermissionsSystemRole.java new file mode 100644 index 00000000..22fadeca --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/CreateApiKeysRequestPermissionsSystemRole.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateApiKeysRequestPermissionsSystemRole { + public static final CreateApiKeysRequestPermissionsSystemRole OWNER = + new CreateApiKeysRequestPermissionsSystemRole(Value.OWNER, "owner"); + + public static final CreateApiKeysRequestPermissionsSystemRole ADMIN = + new CreateApiKeysRequestPermissionsSystemRole(Value.ADMIN, "admin"); + + public static final CreateApiKeysRequestPermissionsSystemRole SALES_MANAGER = + new CreateApiKeysRequestPermissionsSystemRole(Value.SALES_MANAGER, "sales_manager"); + + public static final CreateApiKeysRequestPermissionsSystemRole MODERATOR = + new CreateApiKeysRequestPermissionsSystemRole(Value.MODERATOR, "moderator"); + + public static final CreateApiKeysRequestPermissionsSystemRole ADVERTISER = + new CreateApiKeysRequestPermissionsSystemRole(Value.ADVERTISER, "advertiser"); + + private final Value value; + + private final String string; + + CreateApiKeysRequestPermissionsSystemRole(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateApiKeysRequestPermissionsSystemRole + && this.string.equals(((CreateApiKeysRequestPermissionsSystemRole) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case OWNER: + return visitor.visitOwner(); + case ADMIN: + return visitor.visitAdmin(); + case SALES_MANAGER: + return visitor.visitSalesManager(); + case MODERATOR: + return visitor.visitModerator(); + case ADVERTISER: + return visitor.visitAdvertiser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateApiKeysRequestPermissionsSystemRole valueOf(String value) { + switch (value) { + case "owner": + return OWNER; + case "admin": + return ADMIN; + case "sales_manager": + return SALES_MANAGER; + case "moderator": + return MODERATOR; + case "advertiser": + return ADVERTISER; + default: + return new CreateApiKeysRequestPermissionsSystemRole(Value.UNKNOWN, value); + } + } + + public enum Value { + OWNER, + + ADMIN, + + MODERATOR, + + SALES_MANAGER, + + ADVERTISER, + + UNKNOWN + } + + public interface Visitor { + T visitOwner(); + + T visitAdmin(); + + T visitModerator(); + + T visitSalesManager(); + + T visitAdvertiser(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/CreateApiKeysRequestResourceType.java b/src/main/java/com/whop/api/resources/apikeys/types/CreateApiKeysRequestResourceType.java new file mode 100644 index 00000000..2652df7d --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/CreateApiKeysRequestResourceType.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateApiKeysRequestResourceType { + public static final CreateApiKeysRequestResourceType APP = new CreateApiKeysRequestResourceType(Value.APP, "app"); + + public static final CreateApiKeysRequestResourceType ACCOUNT = + new CreateApiKeysRequestResourceType(Value.ACCOUNT, "account"); + + private final Value value; + + private final String string; + + CreateApiKeysRequestResourceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateApiKeysRequestResourceType + && this.string.equals(((CreateApiKeysRequestResourceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APP: + return visitor.visitApp(); + case ACCOUNT: + return visitor.visitAccount(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateApiKeysRequestResourceType valueOf(String value) { + switch (value) { + case "app": + return APP; + case "account": + return ACCOUNT; + default: + return new CreateApiKeysRequestResourceType(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT, + + APP, + + UNKNOWN + } + + public interface Visitor { + T visitAccount(); + + T visitApp(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/DeleteApiKeysResponse.java b/src/main/java/com/whop/api/resources/apikeys/types/DeleteApiKeysResponse.java new file mode 100644 index 00000000..35538ddf --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/DeleteApiKeysResponse.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteApiKeysResponse.Builder.class) +public final class DeleteApiKeysResponse { + private final boolean deleted; + + private final String id; + + private final Map additionalProperties; + + private DeleteApiKeysResponse(boolean deleted, String id, Map additionalProperties) { + this.deleted = deleted; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Always true: the key was revoked. + */ + @JsonProperty("deleted") + public boolean getDeleted() { + return deleted; + } + + /** + * @return The ID of the revoked key. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteApiKeysResponse && equalTo((DeleteApiKeysResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteApiKeysResponse other) { + return deleted == other.deleted && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deleted, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeletedStage builder() { + return new Builder(); + } + + public interface DeletedStage { + /** + *

Always true: the key was revoked.

+ */ + IdStage deleted(boolean deleted); + + Builder from(DeleteApiKeysResponse other); + } + + public interface IdStage { + /** + *

The ID of the revoked key.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DeleteApiKeysResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeletedStage, IdStage, _FinalStage { + private boolean deleted; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeleteApiKeysResponse other) { + deleted(other.getDeleted()); + id(other.getId()); + return this; + } + + /** + *

Always true: the key was revoked.

+ *

Always true: the key was revoked.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("deleted") + public IdStage deleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + *

The ID of the revoked key.

+ *

The ID of the revoked key.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DeleteApiKeysResponse build() { + return new DeleteApiKeysResponse(deleted, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/ListApiKeysRequestDirection.java b/src/main/java/com/whop/api/resources/apikeys/types/ListApiKeysRequestDirection.java new file mode 100644 index 00000000..c4f2b7ae --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/ListApiKeysRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListApiKeysRequestDirection { + public static final ListApiKeysRequestDirection ASC = new ListApiKeysRequestDirection(Value.ASC, "asc"); + + public static final ListApiKeysRequestDirection DESC = new ListApiKeysRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListApiKeysRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListApiKeysRequestDirection + && this.string.equals(((ListApiKeysRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListApiKeysRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListApiKeysRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/ListApiKeysRequestOrder.java b/src/main/java/com/whop/api/resources/apikeys/types/ListApiKeysRequestOrder.java new file mode 100644 index 00000000..9b7203de --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/ListApiKeysRequestOrder.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListApiKeysRequestOrder { + public static final ListApiKeysRequestOrder CREATED_AT = + new ListApiKeysRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListApiKeysRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListApiKeysRequestOrder + && this.string.equals(((ListApiKeysRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListApiKeysRequestOrder valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + default: + return new ListApiKeysRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/ListApiKeysRequestResourceType.java b/src/main/java/com/whop/api/resources/apikeys/types/ListApiKeysRequestResourceType.java new file mode 100644 index 00000000..d95a4b91 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/ListApiKeysRequestResourceType.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListApiKeysRequestResourceType { + public static final ListApiKeysRequestResourceType APP = new ListApiKeysRequestResourceType(Value.APP, "app"); + + public static final ListApiKeysRequestResourceType ACCOUNT = + new ListApiKeysRequestResourceType(Value.ACCOUNT, "account"); + + private final Value value; + + private final String string; + + ListApiKeysRequestResourceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListApiKeysRequestResourceType + && this.string.equals(((ListApiKeysRequestResourceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APP: + return visitor.visitApp(); + case ACCOUNT: + return visitor.visitAccount(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListApiKeysRequestResourceType valueOf(String value) { + switch (value) { + case "app": + return APP; + case "account": + return ACCOUNT; + default: + return new ListApiKeysRequestResourceType(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT, + + APP, + + UNKNOWN + } + + public interface Visitor { + T visitAccount(); + + T visitApp(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/ListApiKeysResponse.java b/src/main/java/com/whop/api/resources/apikeys/types/ListApiKeysResponse.java new file mode 100644 index 00000000..b9d63ece --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/ListApiKeysResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.ApiKey; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListApiKeysResponse.Builder.class) +public final class ListApiKeysResponse { + private final List data; + + private final ListApiKeysResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListApiKeysResponse( + List data, ListApiKeysResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListApiKeysResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListApiKeysResponse && equalTo((ListApiKeysResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListApiKeysResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListApiKeysResponsePageInfo pageInfo); + + Builder from(ListApiKeysResponse other); + } + + public interface _FinalStage { + ListApiKeysResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ApiKey data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListApiKeysResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListApiKeysResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListApiKeysResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ApiKey data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListApiKeysResponse build() { + return new ListApiKeysResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/ListApiKeysResponsePageInfo.java b/src/main/java/com/whop/api/resources/apikeys/types/ListApiKeysResponsePageInfo.java new file mode 100644 index 00000000..2a8f78e8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/ListApiKeysResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListApiKeysResponsePageInfo.Builder.class) +public final class ListApiKeysResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListApiKeysResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListApiKeysResponsePageInfo && equalTo((ListApiKeysResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListApiKeysResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListApiKeysResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListApiKeysResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListApiKeysResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListApiKeysResponsePageInfo build() { + return new ListApiKeysResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/ListPermissionsApiKeysResponse.java b/src/main/java/com/whop/api/resources/apikeys/types/ListPermissionsApiKeysResponse.java new file mode 100644 index 00000000..dc4aeb51 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/ListPermissionsApiKeysResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Permission; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPermissionsApiKeysResponse.Builder.class) +public final class ListPermissionsApiKeysResponse { + private final List data; + + private final ListPermissionsApiKeysResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListPermissionsApiKeysResponse( + List data, + ListPermissionsApiKeysResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListPermissionsApiKeysResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPermissionsApiKeysResponse && equalTo((ListPermissionsApiKeysResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPermissionsApiKeysResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListPermissionsApiKeysResponsePageInfo pageInfo); + + Builder from(ListPermissionsApiKeysResponse other); + } + + public interface _FinalStage { + ListPermissionsApiKeysResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(Permission data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListPermissionsApiKeysResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPermissionsApiKeysResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListPermissionsApiKeysResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(Permission data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListPermissionsApiKeysResponse build() { + return new ListPermissionsApiKeysResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/ListPermissionsApiKeysResponsePageInfo.java b/src/main/java/com/whop/api/resources/apikeys/types/ListPermissionsApiKeysResponsePageInfo.java new file mode 100644 index 00000000..6bd37127 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/ListPermissionsApiKeysResponsePageInfo.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPermissionsApiKeysResponsePageInfo.Builder.class) +public final class ListPermissionsApiKeysResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListPermissionsApiKeysResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPermissionsApiKeysResponsePageInfo + && equalTo((ListPermissionsApiKeysResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPermissionsApiKeysResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListPermissionsApiKeysResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListPermissionsApiKeysResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPermissionsApiKeysResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListPermissionsApiKeysResponsePageInfo build() { + return new ListPermissionsApiKeysResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/UpdateApiKeysRequestApiVersionDate.java b/src/main/java/com/whop/api/resources/apikeys/types/UpdateApiKeysRequestApiVersionDate.java new file mode 100644 index 00000000..2066db32 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/UpdateApiKeysRequestApiVersionDate.java @@ -0,0 +1,339 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateApiKeysRequestApiVersionDate { + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0708 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0708, "2026-07-08"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX08051 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX08051, "2026-08-05-1"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0821 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0821, "2026-08-21"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX07291 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX07291, "2026-07-29-1"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0731 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0731, "2026-07-31"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0729 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0729, "2026-07-29"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0803 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0803, "2026-08-03"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0620 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0620, "2026-06-20"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_FIVE0101 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_FIVE0101, "2025-01-01"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX07081 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX07081, "2026-07-08-1"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0723 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0723, "2026-07-23"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0810 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0810, "2026-08-10"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0722 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0722, "2026-07-22"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0720 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0720, "2026-07-20"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0718 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0718, "2026-07-18"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0805 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0805, "2026-08-05"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0727 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0727, "2026-07-27"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0726 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0726, "2026-07-26"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0701 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0701, "2026-07-01"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0813 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0813, "2026-08-13"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0725 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0725, "2026-07-25"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0814 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0814, "2026-08-14"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0608 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0608, "2026-06-08"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0609 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0609, "2026-06-09"); + + public static final UpdateApiKeysRequestApiVersionDate TWO_THOUSAND_TWENTY_SIX0812 = + new UpdateApiKeysRequestApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0812, "2026-08-12"); + + private final Value value; + + private final String string; + + UpdateApiKeysRequestApiVersionDate(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateApiKeysRequestApiVersionDate + && this.string.equals(((UpdateApiKeysRequestApiVersionDate) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TWO_THOUSAND_TWENTY_SIX0708: + return visitor.visitTwoThousandTwentySix0708(); + case TWO_THOUSAND_TWENTY_SIX08051: + return visitor.visitTwoThousandTwentySix08051(); + case TWO_THOUSAND_TWENTY_SIX0821: + return visitor.visitTwoThousandTwentySix0821(); + case TWO_THOUSAND_TWENTY_SIX07291: + return visitor.visitTwoThousandTwentySix07291(); + case TWO_THOUSAND_TWENTY_SIX0731: + return visitor.visitTwoThousandTwentySix0731(); + case TWO_THOUSAND_TWENTY_SIX0729: + return visitor.visitTwoThousandTwentySix0729(); + case TWO_THOUSAND_TWENTY_SIX0803: + return visitor.visitTwoThousandTwentySix0803(); + case TWO_THOUSAND_TWENTY_SIX0620: + return visitor.visitTwoThousandTwentySix0620(); + case TWO_THOUSAND_TWENTY_FIVE0101: + return visitor.visitTwoThousandTwentyFive0101(); + case TWO_THOUSAND_TWENTY_SIX07081: + return visitor.visitTwoThousandTwentySix07081(); + case TWO_THOUSAND_TWENTY_SIX0723: + return visitor.visitTwoThousandTwentySix0723(); + case TWO_THOUSAND_TWENTY_SIX0810: + return visitor.visitTwoThousandTwentySix0810(); + case TWO_THOUSAND_TWENTY_SIX0722: + return visitor.visitTwoThousandTwentySix0722(); + case TWO_THOUSAND_TWENTY_SIX0720: + return visitor.visitTwoThousandTwentySix0720(); + case TWO_THOUSAND_TWENTY_SIX0718: + return visitor.visitTwoThousandTwentySix0718(); + case TWO_THOUSAND_TWENTY_SIX0805: + return visitor.visitTwoThousandTwentySix0805(); + case TWO_THOUSAND_TWENTY_SIX0727: + return visitor.visitTwoThousandTwentySix0727(); + case TWO_THOUSAND_TWENTY_SIX0726: + return visitor.visitTwoThousandTwentySix0726(); + case TWO_THOUSAND_TWENTY_SIX0701: + return visitor.visitTwoThousandTwentySix0701(); + case TWO_THOUSAND_TWENTY_SIX0813: + return visitor.visitTwoThousandTwentySix0813(); + case TWO_THOUSAND_TWENTY_SIX0725: + return visitor.visitTwoThousandTwentySix0725(); + case TWO_THOUSAND_TWENTY_SIX0814: + return visitor.visitTwoThousandTwentySix0814(); + case TWO_THOUSAND_TWENTY_SIX0608: + return visitor.visitTwoThousandTwentySix0608(); + case TWO_THOUSAND_TWENTY_SIX0609: + return visitor.visitTwoThousandTwentySix0609(); + case TWO_THOUSAND_TWENTY_SIX0812: + return visitor.visitTwoThousandTwentySix0812(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateApiKeysRequestApiVersionDate valueOf(String value) { + switch (value) { + case "2026-07-08": + return TWO_THOUSAND_TWENTY_SIX0708; + case "2026-08-05-1": + return TWO_THOUSAND_TWENTY_SIX08051; + case "2026-08-21": + return TWO_THOUSAND_TWENTY_SIX0821; + case "2026-07-29-1": + return TWO_THOUSAND_TWENTY_SIX07291; + case "2026-07-31": + return TWO_THOUSAND_TWENTY_SIX0731; + case "2026-07-29": + return TWO_THOUSAND_TWENTY_SIX0729; + case "2026-08-03": + return TWO_THOUSAND_TWENTY_SIX0803; + case "2026-06-20": + return TWO_THOUSAND_TWENTY_SIX0620; + case "2025-01-01": + return TWO_THOUSAND_TWENTY_FIVE0101; + case "2026-07-08-1": + return TWO_THOUSAND_TWENTY_SIX07081; + case "2026-07-23": + return TWO_THOUSAND_TWENTY_SIX0723; + case "2026-08-10": + return TWO_THOUSAND_TWENTY_SIX0810; + case "2026-07-22": + return TWO_THOUSAND_TWENTY_SIX0722; + case "2026-07-20": + return TWO_THOUSAND_TWENTY_SIX0720; + case "2026-07-18": + return TWO_THOUSAND_TWENTY_SIX0718; + case "2026-08-05": + return TWO_THOUSAND_TWENTY_SIX0805; + case "2026-07-27": + return TWO_THOUSAND_TWENTY_SIX0727; + case "2026-07-26": + return TWO_THOUSAND_TWENTY_SIX0726; + case "2026-07-01": + return TWO_THOUSAND_TWENTY_SIX0701; + case "2026-08-13": + return TWO_THOUSAND_TWENTY_SIX0813; + case "2026-07-25": + return TWO_THOUSAND_TWENTY_SIX0725; + case "2026-08-14": + return TWO_THOUSAND_TWENTY_SIX0814; + case "2026-06-08": + return TWO_THOUSAND_TWENTY_SIX0608; + case "2026-06-09": + return TWO_THOUSAND_TWENTY_SIX0609; + case "2026-08-12": + return TWO_THOUSAND_TWENTY_SIX0812; + default: + return new UpdateApiKeysRequestApiVersionDate(Value.UNKNOWN, value); + } + } + + public enum Value { + TWO_THOUSAND_TWENTY_FIVE0101, + + TWO_THOUSAND_TWENTY_SIX0608, + + TWO_THOUSAND_TWENTY_SIX0609, + + TWO_THOUSAND_TWENTY_SIX0620, + + TWO_THOUSAND_TWENTY_SIX0701, + + TWO_THOUSAND_TWENTY_SIX0708, + + TWO_THOUSAND_TWENTY_SIX07081, + + TWO_THOUSAND_TWENTY_SIX0718, + + TWO_THOUSAND_TWENTY_SIX0720, + + TWO_THOUSAND_TWENTY_SIX0722, + + TWO_THOUSAND_TWENTY_SIX0723, + + TWO_THOUSAND_TWENTY_SIX0725, + + TWO_THOUSAND_TWENTY_SIX0726, + + TWO_THOUSAND_TWENTY_SIX0727, + + TWO_THOUSAND_TWENTY_SIX0729, + + TWO_THOUSAND_TWENTY_SIX07291, + + TWO_THOUSAND_TWENTY_SIX0731, + + TWO_THOUSAND_TWENTY_SIX0803, + + TWO_THOUSAND_TWENTY_SIX0805, + + TWO_THOUSAND_TWENTY_SIX08051, + + TWO_THOUSAND_TWENTY_SIX0810, + + TWO_THOUSAND_TWENTY_SIX0812, + + TWO_THOUSAND_TWENTY_SIX0813, + + TWO_THOUSAND_TWENTY_SIX0814, + + TWO_THOUSAND_TWENTY_SIX0821, + + UNKNOWN + } + + public interface Visitor { + T visitTwoThousandTwentyFive0101(); + + T visitTwoThousandTwentySix0608(); + + T visitTwoThousandTwentySix0609(); + + T visitTwoThousandTwentySix0620(); + + T visitTwoThousandTwentySix0701(); + + T visitTwoThousandTwentySix0708(); + + T visitTwoThousandTwentySix07081(); + + T visitTwoThousandTwentySix0718(); + + T visitTwoThousandTwentySix0720(); + + T visitTwoThousandTwentySix0722(); + + T visitTwoThousandTwentySix0723(); + + T visitTwoThousandTwentySix0725(); + + T visitTwoThousandTwentySix0726(); + + T visitTwoThousandTwentySix0727(); + + T visitTwoThousandTwentySix0729(); + + T visitTwoThousandTwentySix07291(); + + T visitTwoThousandTwentySix0731(); + + T visitTwoThousandTwentySix0803(); + + T visitTwoThousandTwentySix0805(); + + T visitTwoThousandTwentySix08051(); + + T visitTwoThousandTwentySix0810(); + + T visitTwoThousandTwentySix0812(); + + T visitTwoThousandTwentySix0813(); + + T visitTwoThousandTwentySix0814(); + + T visitTwoThousandTwentySix0821(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/UpdateApiKeysRequestPermissions.java b/src/main/java/com/whop/api/resources/apikeys/types/UpdateApiKeysRequestPermissions.java new file mode 100644 index 00000000..3f41578f --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/UpdateApiKeysRequestPermissions.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateApiKeysRequestPermissions.Builder.class) +public final class UpdateApiKeysRequestPermissions { + private final Optional> statements; + + private final Optional systemRole; + + private final Map additionalProperties; + + private UpdateApiKeysRequestPermissions( + Optional> statements, + Optional systemRole, + Map additionalProperties) { + this.statements = statements; + this.systemRole = systemRole; + this.additionalProperties = additionalProperties; + } + + /** + * @return Explicit permission statements. Required unless system_role is set. + */ + @JsonProperty("statements") + public Optional> getStatements() { + return statements; + } + + /** + * @return A system role to inherit permissions from. Only Account API keys can use a system role. + */ + @JsonIgnore + public Optional getSystemRole() { + if (systemRole == null) { + return Optional.empty(); + } + return systemRole; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("system_role") + private Optional _getSystemRole() { + return systemRole; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateApiKeysRequestPermissions && equalTo((UpdateApiKeysRequestPermissions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateApiKeysRequestPermissions other) { + return statements.equals(other.statements) && systemRole.equals(other.systemRole); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.statements, this.systemRole); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> statements = Optional.empty(); + + private Optional systemRole = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateApiKeysRequestPermissions other) { + statements(other.getStatements()); + systemRole(other.getSystemRole()); + return this; + } + + /** + *

Explicit permission statements. Required unless system_role is set.

+ */ + @JsonSetter(value = "statements", nulls = Nulls.SKIP) + public Builder statements(Optional> statements) { + this.statements = statements; + return this; + } + + public Builder statements(List statements) { + this.statements = Optional.ofNullable(statements); + return this; + } + + /** + *

A system role to inherit permissions from. Only Account API keys can use a system role.

+ */ + @JsonSetter(value = "system_role", nulls = Nulls.SKIP) + public Builder systemRole(Optional systemRole) { + this.systemRole = systemRole; + return this; + } + + public Builder systemRole(UpdateApiKeysRequestPermissionsSystemRole systemRole) { + this.systemRole = Optional.ofNullable(systemRole); + return this; + } + + public Builder systemRole(Nullable systemRole) { + if (systemRole.isNull()) { + this.systemRole = null; + } else if (systemRole.isEmpty()) { + this.systemRole = Optional.empty(); + } else { + this.systemRole = Optional.of(systemRole.get()); + } + return this; + } + + public UpdateApiKeysRequestPermissions build() { + return new UpdateApiKeysRequestPermissions(statements, systemRole, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/UpdateApiKeysRequestPermissionsStatementsItem.java b/src/main/java/com/whop/api/resources/apikeys/types/UpdateApiKeysRequestPermissionsStatementsItem.java new file mode 100644 index 00000000..8ae3e9ef --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/UpdateApiKeysRequestPermissionsStatementsItem.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateApiKeysRequestPermissionsStatementsItem.Builder.class) +public final class UpdateApiKeysRequestPermissionsStatementsItem { + private final List actions; + + private final boolean grant; + + private final Optional> resources; + + private final Map additionalProperties; + + private UpdateApiKeysRequestPermissionsStatementsItem( + List actions, + boolean grant, + Optional> resources, + Map additionalProperties) { + this.actions = actions; + this.grant = grant; + this.resources = resources; + this.additionalProperties = additionalProperties; + } + + /** + * @return Permission actions covered by this statement, for example company:basic:read. + */ + @JsonProperty("actions") + public List getActions() { + return actions; + } + + /** + * @return Whether the actions are granted (true) or denied (false). + */ + @JsonProperty("grant") + public boolean getGrant() { + return grant; + } + + /** + * @return Resource identifiers the statement applies to, for example biz_xxx or biz_xxx|pass_*. Defaults to the key's owning resource when omitted. + */ + @JsonProperty("resources") + public Optional> getResources() { + return resources; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateApiKeysRequestPermissionsStatementsItem + && equalTo((UpdateApiKeysRequestPermissionsStatementsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateApiKeysRequestPermissionsStatementsItem other) { + return actions.equals(other.actions) && grant == other.grant && resources.equals(other.resources); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.actions, this.grant, this.resources); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static GrantStage builder() { + return new Builder(); + } + + public interface GrantStage { + /** + *

Whether the actions are granted (true) or denied (false).

+ */ + _FinalStage grant(boolean grant); + + Builder from(UpdateApiKeysRequestPermissionsStatementsItem other); + } + + public interface _FinalStage { + UpdateApiKeysRequestPermissionsStatementsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Permission actions covered by this statement, for example company:basic:read.

+ */ + _FinalStage actions(List actions); + + _FinalStage addActions(String actions); + + _FinalStage addAllActions(List actions); + + /** + *

Resource identifiers the statement applies to, for example biz_xxx or biz_xxx|pass_*. Defaults to the key's owning resource when omitted.

+ */ + _FinalStage resources(Optional> resources); + + _FinalStage resources(List resources); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements GrantStage, _FinalStage { + private boolean grant; + + private Optional> resources = Optional.empty(); + + private List actions = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateApiKeysRequestPermissionsStatementsItem other) { + actions(other.getActions()); + grant(other.getGrant()); + resources(other.getResources()); + return this; + } + + /** + *

Whether the actions are granted (true) or denied (false).

+ *

Whether the actions are granted (true) or denied (false).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("grant") + public _FinalStage grant(boolean grant) { + this.grant = grant; + return this; + } + + /** + *

Resource identifiers the statement applies to, for example biz_xxx or biz_xxx|pass_*. Defaults to the key's owning resource when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resources(List resources) { + this.resources = Optional.ofNullable(resources); + return this; + } + + /** + *

Resource identifiers the statement applies to, for example biz_xxx or biz_xxx|pass_*. Defaults to the key's owning resource when omitted.

+ */ + @java.lang.Override + @JsonSetter(value = "resources", nulls = Nulls.SKIP) + public _FinalStage resources(Optional> resources) { + this.resources = resources; + return this; + } + + /** + *

Permission actions covered by this statement, for example company:basic:read.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllActions(List actions) { + if (actions != null) { + this.actions.addAll(actions); + } + return this; + } + + /** + *

Permission actions covered by this statement, for example company:basic:read.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addActions(String actions) { + this.actions.add(actions); + return this; + } + + /** + *

Permission actions covered by this statement, for example company:basic:read.

+ */ + @java.lang.Override + @JsonSetter(value = "actions", nulls = Nulls.SKIP) + public _FinalStage actions(List actions) { + this.actions.clear(); + if (actions != null) { + this.actions.addAll(actions); + } + return this; + } + + @java.lang.Override + public UpdateApiKeysRequestPermissionsStatementsItem build() { + return new UpdateApiKeysRequestPermissionsStatementsItem(actions, grant, resources, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apikeys/types/UpdateApiKeysRequestPermissionsSystemRole.java b/src/main/java/com/whop/api/resources/apikeys/types/UpdateApiKeysRequestPermissionsSystemRole.java new file mode 100644 index 00000000..8d92c4a9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apikeys/types/UpdateApiKeysRequestPermissionsSystemRole.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apikeys.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateApiKeysRequestPermissionsSystemRole { + public static final UpdateApiKeysRequestPermissionsSystemRole OWNER = + new UpdateApiKeysRequestPermissionsSystemRole(Value.OWNER, "owner"); + + public static final UpdateApiKeysRequestPermissionsSystemRole ADMIN = + new UpdateApiKeysRequestPermissionsSystemRole(Value.ADMIN, "admin"); + + public static final UpdateApiKeysRequestPermissionsSystemRole SALES_MANAGER = + new UpdateApiKeysRequestPermissionsSystemRole(Value.SALES_MANAGER, "sales_manager"); + + public static final UpdateApiKeysRequestPermissionsSystemRole MODERATOR = + new UpdateApiKeysRequestPermissionsSystemRole(Value.MODERATOR, "moderator"); + + public static final UpdateApiKeysRequestPermissionsSystemRole ADVERTISER = + new UpdateApiKeysRequestPermissionsSystemRole(Value.ADVERTISER, "advertiser"); + + private final Value value; + + private final String string; + + UpdateApiKeysRequestPermissionsSystemRole(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateApiKeysRequestPermissionsSystemRole + && this.string.equals(((UpdateApiKeysRequestPermissionsSystemRole) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case OWNER: + return visitor.visitOwner(); + case ADMIN: + return visitor.visitAdmin(); + case SALES_MANAGER: + return visitor.visitSalesManager(); + case MODERATOR: + return visitor.visitModerator(); + case ADVERTISER: + return visitor.visitAdvertiser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateApiKeysRequestPermissionsSystemRole valueOf(String value) { + switch (value) { + case "owner": + return OWNER; + case "admin": + return ADMIN; + case "sales_manager": + return SALES_MANAGER; + case "moderator": + return MODERATOR; + case "advertiser": + return ADVERTISER; + default: + return new UpdateApiKeysRequestPermissionsSystemRole(Value.UNKNOWN, value); + } + } + + public enum Value { + OWNER, + + ADMIN, + + MODERATOR, + + SALES_MANAGER, + + ADVERTISER, + + UNKNOWN + } + + public interface Visitor { + T visitOwner(); + + T visitAdmin(); + + T visitModerator(); + + T visitSalesManager(); + + T visitAdvertiser(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/AppBuildsClient.java b/src/main/java/com/whop/api/resources/appbuilds/AppBuildsClient.java new file mode 100644 index 00000000..4d79fa08 --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/AppBuildsClient.java @@ -0,0 +1,115 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.appbuilds.requests.CreateAppBuildsRequest; +import com.whop.api.resources.appbuilds.requests.ListAppBuildsRequest; +import com.whop.api.resources.appbuilds.requests.PromoteAppBuildsRequest; +import com.whop.api.resources.appbuilds.requests.RetrieveAppBuildsRequest; +import com.whop.api.types.AppBuild; + +public class AppBuildsClient { + protected final ClientOptions clientOptions; + + private final RawAppBuildsClient rawClient; + + public AppBuildsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAppBuildsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAppBuildsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of build artifacts for an app, newest first, with optional platform, status, and creation-date filters. + */ + public SyncPagingIterable list(ListAppBuildsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of build artifacts for an app, newest first, with optional platform, status, and creation-date filters. + */ + public SyncPagingIterable list(ListAppBuildsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Uploads a new build artifact for an app. Upload the file first (POST /files or a direct upload), then reference it here; iOS and Android take a .zip bundle, web takes a JavaScript file or a .zip archive of the hosted site. + */ + public AppBuild create(CreateAppBuildsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Uploads a new build artifact for an app. Upload the file first (POST /files or a direct upload), then reference it here; iOS and Android take a .zip bundle, web takes a JavaScript file or a .zip archive of the hosted site. + */ + public AppBuild create(CreateAppBuildsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing app build. + */ + public AppBuild retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing app build. + */ + public AppBuild retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing app build. + */ + public AppBuild retrieve(String id, RetrieveAppBuildsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing app build. + */ + public AppBuild retrieve(String id, RetrieveAppBuildsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public AppBuild promote(String id) { + return this.rawClient.promote(id).body(); + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public AppBuild promote(String id, RequestOptions requestOptions) { + return this.rawClient.promote(id, requestOptions).body(); + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public AppBuild promote(String id, PromoteAppBuildsRequest request) { + return this.rawClient.promote(id, request).body(); + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public AppBuild promote(String id, PromoteAppBuildsRequest request, RequestOptions requestOptions) { + return this.rawClient.promote(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/AsyncAppBuildsClient.java b/src/main/java/com/whop/api/resources/appbuilds/AsyncAppBuildsClient.java new file mode 100644 index 00000000..8918d3fe --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/AsyncAppBuildsClient.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.appbuilds.requests.CreateAppBuildsRequest; +import com.whop.api.resources.appbuilds.requests.ListAppBuildsRequest; +import com.whop.api.resources.appbuilds.requests.PromoteAppBuildsRequest; +import com.whop.api.resources.appbuilds.requests.RetrieveAppBuildsRequest; +import com.whop.api.types.AppBuild; +import java.util.concurrent.CompletableFuture; + +public class AsyncAppBuildsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAppBuildsClient rawClient; + + public AsyncAppBuildsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAppBuildsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAppBuildsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of build artifacts for an app, newest first, with optional platform, status, and creation-date filters. + */ + public CompletableFuture> list(ListAppBuildsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of build artifacts for an app, newest first, with optional platform, status, and creation-date filters. + */ + public CompletableFuture> list( + ListAppBuildsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Uploads a new build artifact for an app. Upload the file first (POST /files or a direct upload), then reference it here; iOS and Android take a .zip bundle, web takes a JavaScript file or a .zip archive of the hosted site. + */ + public CompletableFuture create(CreateAppBuildsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Uploads a new build artifact for an app. Upload the file first (POST /files or a direct upload), then reference it here; iOS and Android take a .zip bundle, web takes a JavaScript file or a .zip archive of the hosted site. + */ + public CompletableFuture create(CreateAppBuildsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing app build. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing app build. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing app build. + */ + public CompletableFuture retrieve(String id, RetrieveAppBuildsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing app build. + */ + public CompletableFuture retrieve( + String id, RetrieveAppBuildsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public CompletableFuture promote(String id) { + return this.rawClient.promote(id).thenApply(response -> response.body()); + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public CompletableFuture promote(String id, RequestOptions requestOptions) { + return this.rawClient.promote(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public CompletableFuture promote(String id, PromoteAppBuildsRequest request) { + return this.rawClient.promote(id, request).thenApply(response -> response.body()); + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public CompletableFuture promote( + String id, PromoteAppBuildsRequest request, RequestOptions requestOptions) { + return this.rawClient.promote(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/AsyncRawAppBuildsClient.java b/src/main/java/com/whop/api/resources/appbuilds/AsyncRawAppBuildsClient.java new file mode 100644 index 00000000..08319a04 --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/AsyncRawAppBuildsClient.java @@ -0,0 +1,476 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.appbuilds.requests.CreateAppBuildsRequest; +import com.whop.api.resources.appbuilds.requests.ListAppBuildsRequest; +import com.whop.api.resources.appbuilds.requests.PromoteAppBuildsRequest; +import com.whop.api.resources.appbuilds.requests.RetrieveAppBuildsRequest; +import com.whop.api.resources.appbuilds.types.ListAppBuildsResponse; +import com.whop.api.types.AppBuild; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAppBuildsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAppBuildsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of build artifacts for an app, newest first, with optional platform, status, and creation-date filters. + */ + public CompletableFuture>> list(ListAppBuildsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of build artifacts for an app, newest first, with optional platform, status, and creation-date filters. + */ + public CompletableFuture>> list( + ListAppBuildsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("app_builds"); + QueryStringMapper.addQueryParameter(httpUrl, "app_id", request.getAppId(), false); + if (request.getPlatform().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "platform", request.getPlatform().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAppBuildsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAppBuildsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListAppBuildsRequest nextRequest = ListAppBuildsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable(startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Uploads a new build artifact for an app. Upload the file first (POST /files or a direct upload), then reference it here; iOS and Android take a .zip bundle, web takes a JavaScript file or a .zip archive of the hosted site. + */ + public CompletableFuture> create(CreateAppBuildsRequest request) { + return create(request, null); + } + + /** + * Uploads a new build artifact for an app. Upload the file first (POST /files or a direct upload), then reference it here; iOS and Android take a .zip bundle, web takes a JavaScript file or a .zip archive of the hosted site. + */ + public CompletableFuture> create( + CreateAppBuildsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("app_builds"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppBuild.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing app build. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveAppBuildsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing app build. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAppBuildsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing app build. + */ + public CompletableFuture> retrieve(String id, RetrieveAppBuildsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing app build. + */ + public CompletableFuture> retrieve( + String id, RetrieveAppBuildsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("app_builds") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppBuild.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public CompletableFuture> promote(String id) { + return promote(id, PromoteAppBuildsRequest.builder().build()); + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public CompletableFuture> promote(String id, RequestOptions requestOptions) { + return promote(id, PromoteAppBuildsRequest.builder().build(), requestOptions); + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public CompletableFuture> promote(String id, PromoteAppBuildsRequest request) { + return promote(id, request, null); + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public CompletableFuture> promote( + String id, PromoteAppBuildsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("app_builds") + .addPathSegment(id) + .addPathSegments("promote"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppBuild.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/RawAppBuildsClient.java b/src/main/java/com/whop/api/resources/appbuilds/RawAppBuildsClient.java new file mode 100644 index 00000000..c1aa8c00 --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/RawAppBuildsClient.java @@ -0,0 +1,381 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.appbuilds.requests.CreateAppBuildsRequest; +import com.whop.api.resources.appbuilds.requests.ListAppBuildsRequest; +import com.whop.api.resources.appbuilds.requests.PromoteAppBuildsRequest; +import com.whop.api.resources.appbuilds.requests.RetrieveAppBuildsRequest; +import com.whop.api.resources.appbuilds.types.ListAppBuildsResponse; +import com.whop.api.types.AppBuild; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAppBuildsClient { + protected final ClientOptions clientOptions; + + public RawAppBuildsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of build artifacts for an app, newest first, with optional platform, status, and creation-date filters. + */ + public WhopApiHttpResponse> list(ListAppBuildsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of build artifacts for an app, newest first, with optional platform, status, and creation-date filters. + */ + public WhopApiHttpResponse> list( + ListAppBuildsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("app_builds"); + QueryStringMapper.addQueryParameter(httpUrl, "app_id", request.getAppId(), false); + if (request.getPlatform().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "platform", request.getPlatform().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAppBuildsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAppBuildsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListAppBuildsRequest nextRequest = ListAppBuildsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Uploads a new build artifact for an app. Upload the file first (POST /files or a direct upload), then reference it here; iOS and Android take a .zip bundle, web takes a JavaScript file or a .zip archive of the hosted site. + */ + public WhopApiHttpResponse create(CreateAppBuildsRequest request) { + return create(request, null); + } + + /** + * Uploads a new build artifact for an app. Upload the file first (POST /files or a direct upload), then reference it here; iOS and Android take a .zip bundle, web takes a JavaScript file or a .zip archive of the hosted site. + */ + public WhopApiHttpResponse create(CreateAppBuildsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("app_builds"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppBuild.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing app build. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveAppBuildsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing app build. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAppBuildsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing app build. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveAppBuildsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing app build. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveAppBuildsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("app_builds") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppBuild.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public WhopApiHttpResponse promote(String id) { + return promote(id, PromoteAppBuildsRequest.builder().build()); + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public WhopApiHttpResponse promote(String id, RequestOptions requestOptions) { + return promote(id, PromoteAppBuildsRequest.builder().build(), requestOptions); + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public WhopApiHttpResponse promote(String id, PromoteAppBuildsRequest request) { + return promote(id, request, null); + } + + /** + * Promotes a draft or approved app build to production so it becomes the active version served to users. Draft builds enter review first. + */ + public WhopApiHttpResponse promote( + String id, PromoteAppBuildsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("app_builds") + .addPathSegment(id) + .addPathSegments("promote"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppBuild.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/requests/CreateAppBuildsRequest.java b/src/main/java/com/whop/api/resources/appbuilds/requests/CreateAppBuildsRequest.java new file mode 100644 index 00000000..08a9ca0d --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/requests/CreateAppBuildsRequest.java @@ -0,0 +1,399 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.appbuilds.types.CreateAppBuildsRequestAttachment; +import com.whop.api.resources.appbuilds.types.CreateAppBuildsRequestPlatform; +import com.whop.api.resources.appbuilds.types.CreateAppBuildsRequestSourceAttachment; +import com.whop.api.resources.appbuilds.types.CreateAppBuildsRequestSupportedAppViewTypesItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAppBuildsRequest.Builder.class) +public final class CreateAppBuildsRequest { + private final Optional aiPromptId; + + private final Optional appId; + + private final CreateAppBuildsRequestAttachment attachment; + + private final String checksum; + + private final CreateAppBuildsRequestPlatform platform; + + private final Optional sourceAttachment; + + private final Optional> supportedAppViewTypes; + + private final Map additionalProperties; + + private CreateAppBuildsRequest( + Optional aiPromptId, + Optional appId, + CreateAppBuildsRequestAttachment attachment, + String checksum, + CreateAppBuildsRequestPlatform platform, + Optional sourceAttachment, + Optional> supportedAppViewTypes, + Map additionalProperties) { + this.aiPromptId = aiPromptId; + this.appId = appId; + this.attachment = attachment; + this.checksum = checksum; + this.platform = platform; + this.sourceAttachment = sourceAttachment; + this.supportedAppViewTypes = supportedAppViewTypes; + this.additionalProperties = additionalProperties; + } + + /** + * @return The AI prompt that generated this build, if applicable. + */ + @JsonProperty("ai_prompt_id") + public Optional getAiPromptId() { + return aiPromptId; + } + + /** + * @return The app to create the build for, prefixed app_. Defaults to the app behind the presented credential. + */ + @JsonProperty("app_id") + public Optional getAppId() { + return appId; + } + + /** + * @return The uploaded build file: { id } for an existing file or { direct_upload_id } for a completed direct upload. + */ + @JsonProperty("attachment") + public CreateAppBuildsRequestAttachment getAttachment() { + return attachment; + } + + /** + * @return A client-generated checksum of the build file, used to verify file integrity when unpacked. + */ + @JsonProperty("checksum") + public String getChecksum() { + return checksum; + } + + /** + * @return The target platform for the build. + */ + @JsonProperty("platform") + public CreateAppBuildsRequestPlatform getPlatform() { + return platform; + } + + /** + * @return An optional compressed archive (.zip or .gz) of the source code that produced this build, stored alongside the build so it can be downloaded later. Referenced like attachment, and must be a different file. + */ + @JsonProperty("source_attachment") + public Optional getSourceAttachment() { + return sourceAttachment; + } + + /** + * @return The view types this build supports. Only list the ones its code implements. + */ + @JsonProperty("supported_app_view_types") + public Optional> getSupportedAppViewTypes() { + return supportedAppViewTypes; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAppBuildsRequest && equalTo((CreateAppBuildsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAppBuildsRequest other) { + return aiPromptId.equals(other.aiPromptId) + && appId.equals(other.appId) + && attachment.equals(other.attachment) + && checksum.equals(other.checksum) + && platform.equals(other.platform) + && sourceAttachment.equals(other.sourceAttachment) + && supportedAppViewTypes.equals(other.supportedAppViewTypes); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.aiPromptId, + this.appId, + this.attachment, + this.checksum, + this.platform, + this.sourceAttachment, + this.supportedAppViewTypes); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AttachmentStage builder() { + return new Builder(); + } + + public interface AttachmentStage { + /** + *

The uploaded build file: { id } for an existing file or { direct_upload_id } for a completed direct upload.

+ */ + ChecksumStage attachment(@NotNull CreateAppBuildsRequestAttachment attachment); + + Builder from(CreateAppBuildsRequest other); + } + + public interface ChecksumStage { + /** + *

A client-generated checksum of the build file, used to verify file integrity when unpacked.

+ */ + PlatformStage checksum(@NotNull String checksum); + } + + public interface PlatformStage { + /** + *

The target platform for the build.

+ */ + _FinalStage platform(@NotNull CreateAppBuildsRequestPlatform platform); + } + + public interface _FinalStage { + CreateAppBuildsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The AI prompt that generated this build, if applicable.

+ */ + _FinalStage aiPromptId(Optional aiPromptId); + + _FinalStage aiPromptId(String aiPromptId); + + /** + *

The app to create the build for, prefixed app_. Defaults to the app behind the presented credential.

+ */ + _FinalStage appId(Optional appId); + + _FinalStage appId(String appId); + + /** + *

An optional compressed archive (.zip or .gz) of the source code that produced this build, stored alongside the build so it can be downloaded later. Referenced like attachment, and must be a different file.

+ */ + _FinalStage sourceAttachment(Optional sourceAttachment); + + _FinalStage sourceAttachment(CreateAppBuildsRequestSourceAttachment sourceAttachment); + + /** + *

The view types this build supports. Only list the ones its code implements.

+ */ + _FinalStage supportedAppViewTypes( + Optional> supportedAppViewTypes); + + _FinalStage supportedAppViewTypes(List supportedAppViewTypes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AttachmentStage, ChecksumStage, PlatformStage, _FinalStage { + private CreateAppBuildsRequestAttachment attachment; + + private String checksum; + + private CreateAppBuildsRequestPlatform platform; + + private Optional> supportedAppViewTypes = + Optional.empty(); + + private Optional sourceAttachment = Optional.empty(); + + private Optional appId = Optional.empty(); + + private Optional aiPromptId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAppBuildsRequest other) { + aiPromptId(other.getAiPromptId()); + appId(other.getAppId()); + attachment(other.getAttachment()); + checksum(other.getChecksum()); + platform(other.getPlatform()); + sourceAttachment(other.getSourceAttachment()); + supportedAppViewTypes(other.getSupportedAppViewTypes()); + return this; + } + + /** + *

The uploaded build file: { id } for an existing file or { direct_upload_id } for a completed direct upload.

+ *

The uploaded build file: { id } for an existing file or { direct_upload_id } for a completed direct upload.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("attachment") + public ChecksumStage attachment(@NotNull CreateAppBuildsRequestAttachment attachment) { + this.attachment = Objects.requireNonNull(attachment, "attachment must not be null"); + return this; + } + + /** + *

A client-generated checksum of the build file, used to verify file integrity when unpacked.

+ *

A client-generated checksum of the build file, used to verify file integrity when unpacked.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("checksum") + public PlatformStage checksum(@NotNull String checksum) { + this.checksum = Objects.requireNonNull(checksum, "checksum must not be null"); + return this; + } + + /** + *

The target platform for the build.

+ *

The target platform for the build.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public _FinalStage platform(@NotNull CreateAppBuildsRequestPlatform platform) { + this.platform = Objects.requireNonNull(platform, "platform must not be null"); + return this; + } + + /** + *

The view types this build supports. Only list the ones its code implements.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage supportedAppViewTypes( + List supportedAppViewTypes) { + this.supportedAppViewTypes = Optional.ofNullable(supportedAppViewTypes); + return this; + } + + /** + *

The view types this build supports. Only list the ones its code implements.

+ */ + @java.lang.Override + @JsonSetter(value = "supported_app_view_types", nulls = Nulls.SKIP) + public _FinalStage supportedAppViewTypes( + Optional> supportedAppViewTypes) { + this.supportedAppViewTypes = supportedAppViewTypes; + return this; + } + + /** + *

An optional compressed archive (.zip or .gz) of the source code that produced this build, stored alongside the build so it can be downloaded later. Referenced like attachment, and must be a different file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sourceAttachment(CreateAppBuildsRequestSourceAttachment sourceAttachment) { + this.sourceAttachment = Optional.ofNullable(sourceAttachment); + return this; + } + + /** + *

An optional compressed archive (.zip or .gz) of the source code that produced this build, stored alongside the build so it can be downloaded later. Referenced like attachment, and must be a different file.

+ */ + @java.lang.Override + @JsonSetter(value = "source_attachment", nulls = Nulls.SKIP) + public _FinalStage sourceAttachment(Optional sourceAttachment) { + this.sourceAttachment = sourceAttachment; + return this; + } + + /** + *

The app to create the build for, prefixed app_. Defaults to the app behind the presented credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appId(String appId) { + this.appId = Optional.ofNullable(appId); + return this; + } + + /** + *

The app to create the build for, prefixed app_. Defaults to the app behind the presented credential.

+ */ + @java.lang.Override + @JsonSetter(value = "app_id", nulls = Nulls.SKIP) + public _FinalStage appId(Optional appId) { + this.appId = appId; + return this; + } + + /** + *

The AI prompt that generated this build, if applicable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage aiPromptId(String aiPromptId) { + this.aiPromptId = Optional.ofNullable(aiPromptId); + return this; + } + + /** + *

The AI prompt that generated this build, if applicable.

+ */ + @java.lang.Override + @JsonSetter(value = "ai_prompt_id", nulls = Nulls.SKIP) + public _FinalStage aiPromptId(Optional aiPromptId) { + this.aiPromptId = aiPromptId; + return this; + } + + @java.lang.Override + public CreateAppBuildsRequest build() { + return new CreateAppBuildsRequest( + aiPromptId, + appId, + attachment, + checksum, + platform, + sourceAttachment, + supportedAppViewTypes, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/requests/ListAppBuildsRequest.java b/src/main/java/com/whop/api/resources/appbuilds/requests/ListAppBuildsRequest.java new file mode 100644 index 00000000..ab3ef4b6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/requests/ListAppBuildsRequest.java @@ -0,0 +1,500 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.appbuilds.types.ListAppBuildsRequestPlatform; +import com.whop.api.resources.appbuilds.types.ListAppBuildsRequestStatus; +import com.whop.api.types.ListAppBuildsRequestCreatedAfter; +import com.whop.api.types.ListAppBuildsRequestCreatedBefore; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAppBuildsRequest.Builder.class) +public final class ListAppBuildsRequest { + private final String appId; + + private final Optional platform; + + private final Optional status; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListAppBuildsRequest( + String appId, + Optional platform, + Optional status, + Optional createdBefore, + Optional createdAfter, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.appId = appId; + this.platform = platform; + this.status = status; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app to list builds for, prefixed app_. + */ + @JsonProperty("app_id") + public String getAppId() { + return appId; + } + + /** + * @return Filter builds by target platform. + */ + @JsonProperty("platform") + public Optional getPlatform() { + return platform; + } + + /** + * @return Filter builds by review status. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Only return builds created before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return builds created after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return The number of builds to return (default 20, max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns builds after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of builds to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns builds before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAppBuildsRequest && equalTo((ListAppBuildsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAppBuildsRequest other) { + return appId.equals(other.appId) + && platform.equals(other.platform) + && status.equals(other.status) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appId, + this.platform, + this.status, + this.createdBefore, + this.createdAfter, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppIdStage builder() { + return new Builder(); + } + + public interface AppIdStage { + /** + *

The app to list builds for, prefixed app_.

+ */ + _FinalStage appId(@NotNull String appId); + + Builder from(ListAppBuildsRequest other); + } + + public interface _FinalStage { + ListAppBuildsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Filter builds by target platform.

+ */ + _FinalStage platform(Optional platform); + + _FinalStage platform(ListAppBuildsRequestPlatform platform); + + /** + *

Filter builds by review status.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(ListAppBuildsRequestStatus status); + + /** + *

Only return builds created before this ISO 8601 timestamp.

+ */ + _FinalStage createdBefore(Optional createdBefore); + + _FinalStage createdBefore(ListAppBuildsRequestCreatedBefore createdBefore); + + /** + *

Only return builds created after this ISO 8601 timestamp.

+ */ + _FinalStage createdAfter(Optional createdAfter); + + _FinalStage createdAfter(ListAppBuildsRequestCreatedAfter createdAfter); + + /** + *

The number of builds to return (default 20, max 100).

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

A cursor; returns builds after this position.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

The number of builds to return from the end of the range.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + /** + *

A cursor; returns builds before this position.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AppIdStage, _FinalStage { + private String appId; + + private Optional before = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional platform = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAppBuildsRequest other) { + appId(other.getAppId()); + platform(other.getPlatform()); + status(other.getStatus()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

The app to list builds for, prefixed app_.

+ *

The app to list builds for, prefixed app_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("app_id") + public _FinalStage appId(@NotNull String appId) { + this.appId = Objects.requireNonNull(appId, "appId must not be null"); + return this; + } + + /** + *

A cursor; returns builds before this position.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

A cursor; returns builds before this position.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

The number of builds to return from the end of the range.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The number of builds to return from the end of the range.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

A cursor; returns builds after this position.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

A cursor; returns builds after this position.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + /** + *

The number of builds to return (default 20, max 100).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

The number of builds to return (default 20, max 100).

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Only return builds created after this ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAfter(ListAppBuildsRequestCreatedAfter createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only return builds created after this ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public _FinalStage createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + /** + *

Only return builds created before this ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdBefore(ListAppBuildsRequestCreatedBefore createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return builds created before this ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public _FinalStage createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + /** + *

Filter builds by review status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(ListAppBuildsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Filter builds by review status.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

Filter builds by target platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage platform(ListAppBuildsRequestPlatform platform) { + this.platform = Optional.ofNullable(platform); + return this; + } + + /** + *

Filter builds by target platform.

+ */ + @java.lang.Override + @JsonSetter(value = "platform", nulls = Nulls.SKIP) + public _FinalStage platform(Optional platform) { + this.platform = platform; + return this; + } + + @java.lang.Override + public ListAppBuildsRequest build() { + return new ListAppBuildsRequest( + appId, + platform, + status, + createdBefore, + createdAfter, + first, + after, + last, + before, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/requests/PromoteAppBuildsRequest.java b/src/main/java/com/whop/api/resources/appbuilds/requests/PromoteAppBuildsRequest.java new file mode 100644 index 00000000..b176a5d5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/requests/PromoteAppBuildsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PromoteAppBuildsRequest.Builder.class) +public final class PromoteAppBuildsRequest { + private final Map additionalProperties; + + private PromoteAppBuildsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PromoteAppBuildsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PromoteAppBuildsRequest other) { + return this; + } + + public PromoteAppBuildsRequest build() { + return new PromoteAppBuildsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/requests/RetrieveAppBuildsRequest.java b/src/main/java/com/whop/api/resources/appbuilds/requests/RetrieveAppBuildsRequest.java new file mode 100644 index 00000000..6f4a06ba --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/requests/RetrieveAppBuildsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveAppBuildsRequest.Builder.class) +public final class RetrieveAppBuildsRequest { + private final Map additionalProperties; + + private RetrieveAppBuildsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveAppBuildsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveAppBuildsRequest other) { + return this; + } + + public RetrieveAppBuildsRequest build() { + return new RetrieveAppBuildsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/types/CreateAppBuildsRequestAttachment.java b/src/main/java/com/whop/api/resources/appbuilds/types/CreateAppBuildsRequestAttachment.java new file mode 100644 index 00000000..7c898344 --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/types/CreateAppBuildsRequestAttachment.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAppBuildsRequestAttachment.Builder.class) +public final class CreateAppBuildsRequestAttachment { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private CreateAppBuildsRequestAttachment( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The signed id of a completed direct upload. + */ + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + /** + * @return The tag of an already-uploaded file. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAppBuildsRequestAttachment && equalTo((CreateAppBuildsRequestAttachment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAppBuildsRequestAttachment other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAppBuildsRequestAttachment other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + /** + *

The signed id of a completed direct upload.

+ */ + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + /** + *

The tag of an already-uploaded file.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public CreateAppBuildsRequestAttachment build() { + return new CreateAppBuildsRequestAttachment(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/types/CreateAppBuildsRequestPlatform.java b/src/main/java/com/whop/api/resources/appbuilds/types/CreateAppBuildsRequestPlatform.java new file mode 100644 index 00000000..2bc50917 --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/types/CreateAppBuildsRequestPlatform.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAppBuildsRequestPlatform { + public static final CreateAppBuildsRequestPlatform WEB = new CreateAppBuildsRequestPlatform(Value.WEB, "web"); + + public static final CreateAppBuildsRequestPlatform IOS = new CreateAppBuildsRequestPlatform(Value.IOS, "ios"); + + public static final CreateAppBuildsRequestPlatform ANDROID = + new CreateAppBuildsRequestPlatform(Value.ANDROID, "android"); + + private final Value value; + + private final String string; + + CreateAppBuildsRequestPlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAppBuildsRequestPlatform + && this.string.equals(((CreateAppBuildsRequestPlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WEB: + return visitor.visitWeb(); + case IOS: + return visitor.visitIos(); + case ANDROID: + return visitor.visitAndroid(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAppBuildsRequestPlatform valueOf(String value) { + switch (value) { + case "web": + return WEB; + case "ios": + return IOS; + case "android": + return ANDROID; + default: + return new CreateAppBuildsRequestPlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + IOS, + + ANDROID, + + WEB, + + UNKNOWN + } + + public interface Visitor { + T visitIos(); + + T visitAndroid(); + + T visitWeb(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/types/CreateAppBuildsRequestSourceAttachment.java b/src/main/java/com/whop/api/resources/appbuilds/types/CreateAppBuildsRequestSourceAttachment.java new file mode 100644 index 00000000..3d2d1856 --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/types/CreateAppBuildsRequestSourceAttachment.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAppBuildsRequestSourceAttachment.Builder.class) +public final class CreateAppBuildsRequestSourceAttachment { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private CreateAppBuildsRequestSourceAttachment( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The signed id of a completed direct upload. + */ + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + /** + * @return The tag of an already-uploaded file. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAppBuildsRequestSourceAttachment + && equalTo((CreateAppBuildsRequestSourceAttachment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAppBuildsRequestSourceAttachment other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAppBuildsRequestSourceAttachment other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + /** + *

The signed id of a completed direct upload.

+ */ + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + /** + *

The tag of an already-uploaded file.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public CreateAppBuildsRequestSourceAttachment build() { + return new CreateAppBuildsRequestSourceAttachment(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/types/CreateAppBuildsRequestSupportedAppViewTypesItem.java b/src/main/java/com/whop/api/resources/appbuilds/types/CreateAppBuildsRequestSupportedAppViewTypesItem.java new file mode 100644 index 00000000..dcd985ef --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/types/CreateAppBuildsRequestSupportedAppViewTypesItem.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAppBuildsRequestSupportedAppViewTypesItem { + public static final CreateAppBuildsRequestSupportedAppViewTypesItem DASHBOARD = + new CreateAppBuildsRequestSupportedAppViewTypesItem(Value.DASHBOARD, "dashboard"); + + public static final CreateAppBuildsRequestSupportedAppViewTypesItem OPENAPI = + new CreateAppBuildsRequestSupportedAppViewTypesItem(Value.OPENAPI, "openapi"); + + public static final CreateAppBuildsRequestSupportedAppViewTypesItem SKILLS = + new CreateAppBuildsRequestSupportedAppViewTypesItem(Value.SKILLS, "skills"); + + public static final CreateAppBuildsRequestSupportedAppViewTypesItem ANALYTICS = + new CreateAppBuildsRequestSupportedAppViewTypesItem(Value.ANALYTICS, "analytics"); + + public static final CreateAppBuildsRequestSupportedAppViewTypesItem DISCOVER = + new CreateAppBuildsRequestSupportedAppViewTypesItem(Value.DISCOVER, "discover"); + + public static final CreateAppBuildsRequestSupportedAppViewTypesItem DASH = + new CreateAppBuildsRequestSupportedAppViewTypesItem(Value.DASH, "dash"); + + public static final CreateAppBuildsRequestSupportedAppViewTypesItem HUB = + new CreateAppBuildsRequestSupportedAppViewTypesItem(Value.HUB, "hub"); + + private final Value value; + + private final String string; + + CreateAppBuildsRequestSupportedAppViewTypesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAppBuildsRequestSupportedAppViewTypesItem + && this.string.equals(((CreateAppBuildsRequestSupportedAppViewTypesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DASHBOARD: + return visitor.visitDashboard(); + case OPENAPI: + return visitor.visitOpenapi(); + case SKILLS: + return visitor.visitSkills(); + case ANALYTICS: + return visitor.visitAnalytics(); + case DISCOVER: + return visitor.visitDiscover(); + case DASH: + return visitor.visitDash(); + case HUB: + return visitor.visitHub(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAppBuildsRequestSupportedAppViewTypesItem valueOf(String value) { + switch (value) { + case "dashboard": + return DASHBOARD; + case "openapi": + return OPENAPI; + case "skills": + return SKILLS; + case "analytics": + return ANALYTICS; + case "discover": + return DISCOVER; + case "dash": + return DASH; + case "hub": + return HUB; + default: + return new CreateAppBuildsRequestSupportedAppViewTypesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + HUB, + + DISCOVER, + + DASH, + + DASHBOARD, + + ANALYTICS, + + SKILLS, + + OPENAPI, + + UNKNOWN + } + + public interface Visitor { + T visitHub(); + + T visitDiscover(); + + T visitDash(); + + T visitDashboard(); + + T visitAnalytics(); + + T visitSkills(); + + T visitOpenapi(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/types/ListAppBuildsRequestPlatform.java b/src/main/java/com/whop/api/resources/appbuilds/types/ListAppBuildsRequestPlatform.java new file mode 100644 index 00000000..a434fdfa --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/types/ListAppBuildsRequestPlatform.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAppBuildsRequestPlatform { + public static final ListAppBuildsRequestPlatform WEB = new ListAppBuildsRequestPlatform(Value.WEB, "web"); + + public static final ListAppBuildsRequestPlatform IOS = new ListAppBuildsRequestPlatform(Value.IOS, "ios"); + + public static final ListAppBuildsRequestPlatform ANDROID = + new ListAppBuildsRequestPlatform(Value.ANDROID, "android"); + + private final Value value; + + private final String string; + + ListAppBuildsRequestPlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAppBuildsRequestPlatform + && this.string.equals(((ListAppBuildsRequestPlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WEB: + return visitor.visitWeb(); + case IOS: + return visitor.visitIos(); + case ANDROID: + return visitor.visitAndroid(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAppBuildsRequestPlatform valueOf(String value) { + switch (value) { + case "web": + return WEB; + case "ios": + return IOS; + case "android": + return ANDROID; + default: + return new ListAppBuildsRequestPlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + IOS, + + ANDROID, + + WEB, + + UNKNOWN + } + + public interface Visitor { + T visitIos(); + + T visitAndroid(); + + T visitWeb(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/types/ListAppBuildsRequestStatus.java b/src/main/java/com/whop/api/resources/appbuilds/types/ListAppBuildsRequestStatus.java new file mode 100644 index 00000000..29882e1e --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/types/ListAppBuildsRequestStatus.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAppBuildsRequestStatus { + public static final ListAppBuildsRequestStatus APPROVED = + new ListAppBuildsRequestStatus(Value.APPROVED, "approved"); + + public static final ListAppBuildsRequestStatus PENDING = new ListAppBuildsRequestStatus(Value.PENDING, "pending"); + + public static final ListAppBuildsRequestStatus DRAFT = new ListAppBuildsRequestStatus(Value.DRAFT, "draft"); + + public static final ListAppBuildsRequestStatus REJECTED = + new ListAppBuildsRequestStatus(Value.REJECTED, "rejected"); + + private final Value value; + + private final String string; + + ListAppBuildsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAppBuildsRequestStatus + && this.string.equals(((ListAppBuildsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case PENDING: + return visitor.visitPending(); + case DRAFT: + return visitor.visitDraft(); + case REJECTED: + return visitor.visitRejected(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAppBuildsRequestStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "pending": + return PENDING; + case "draft": + return DRAFT; + case "rejected": + return REJECTED; + default: + return new ListAppBuildsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + DRAFT, + + PENDING, + + APPROVED, + + REJECTED, + + UNKNOWN + } + + public interface Visitor { + T visitDraft(); + + T visitPending(); + + T visitApproved(); + + T visitRejected(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/types/ListAppBuildsResponse.java b/src/main/java/com/whop/api/resources/appbuilds/types/ListAppBuildsResponse.java new file mode 100644 index 00000000..a20787d4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/types/ListAppBuildsResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AppBuild; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAppBuildsResponse.Builder.class) +public final class ListAppBuildsResponse { + private final List data; + + private final ListAppBuildsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListAppBuildsResponse( + List data, ListAppBuildsResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListAppBuildsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAppBuildsResponse && equalTo((ListAppBuildsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAppBuildsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListAppBuildsResponsePageInfo pageInfo); + + Builder from(ListAppBuildsResponse other); + } + + public interface _FinalStage { + ListAppBuildsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(AppBuild data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListAppBuildsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAppBuildsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListAppBuildsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(AppBuild data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListAppBuildsResponse build() { + return new ListAppBuildsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/appbuilds/types/ListAppBuildsResponsePageInfo.java b/src/main/java/com/whop/api/resources/appbuilds/types/ListAppBuildsResponsePageInfo.java new file mode 100644 index 00000000..ad17ee7e --- /dev/null +++ b/src/main/java/com/whop/api/resources/appbuilds/types/ListAppBuildsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.appbuilds.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAppBuildsResponsePageInfo.Builder.class) +public final class ListAppBuildsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListAppBuildsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAppBuildsResponsePageInfo && equalTo((ListAppBuildsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAppBuildsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListAppBuildsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListAppBuildsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAppBuildsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListAppBuildsResponsePageInfo build() { + return new ListAppBuildsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/AppsClient.java b/src/main/java/com/whop/api/resources/apps/AppsClient.java new file mode 100644 index 00000000..9e095386 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/AppsClient.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.apps.requests.CreateAppsRequest; +import com.whop.api.resources.apps.requests.DeleteAppsRequest; +import com.whop.api.resources.apps.requests.DeployAppsRequest; +import com.whop.api.resources.apps.requests.ListAppsRequest; +import com.whop.api.resources.apps.requests.LogsAppsRequest; +import com.whop.api.resources.apps.requests.RetrieveAppsRequest; +import com.whop.api.resources.apps.requests.UpdateAppsRequest; +import com.whop.api.resources.apps.requests.UpdatePermissionsAppRequest; +import com.whop.api.resources.apps.requests.UpdatePermissionsAppsRequest; +import com.whop.api.resources.apps.types.DeleteAppsResponse; +import com.whop.api.resources.apps.types.LogsAppsResponseDataItem; +import com.whop.api.types.App; +import com.whop.api.types.AppDeployment; +import com.whop.api.types.AppListItem; + +public class AppsClient { + protected final ClientOptions clientOptions; + + private final RawAppsClient rawClient; + + public AppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAppsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAppsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public SyncPagingIterable list(ListAppsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public SyncPagingIterable list(ListAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Registers a new app on the Whop developer platform. Apps provide custom experiences that can be added to products. + */ + public App create(CreateAppsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Registers a new app on the Whop developer platform. Apps provide custom experiences that can be added to products. + */ + public App create(CreateAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Updates the permission requirements for an app + *

Required permissions:

+ *
    + *
  • developer:update_app_authorization
  • + *
+ */ + public boolean updatePermissionsApp(String appId, UpdatePermissionsAppRequest request) { + return this.rawClient.updatePermissionsApp(appId, request).body(); + } + + /** + * Updates the permission requirements for an app + *

Required permissions:

+ *
    + *
  • developer:update_app_authorization
  • + *
+ */ + public boolean updatePermissionsApp( + String appId, UpdatePermissionsAppRequest request, RequestOptions requestOptions) { + return this.rawClient + .updatePermissionsApp(appId, request, requestOptions) + .body(); + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public App retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public App retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public App retrieve(String id, RetrieveAppsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public App retrieve(String id, RetrieveAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public DeleteAppsResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public DeleteAppsResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public DeleteAppsResponse delete(String id, DeleteAppsRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public DeleteAppsResponse delete(String id, DeleteAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public App update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public App update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public App update(String id, UpdateAppsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public App update(String id, UpdateAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public AppDeployment deploy(String id) { + return this.rawClient.deploy(id).body(); + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public AppDeployment deploy(String id, RequestOptions requestOptions) { + return this.rawClient.deploy(id, requestOptions).body(); + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public AppDeployment deploy(String id, DeployAppsRequest request) { + return this.rawClient.deploy(id, request).body(); + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public AppDeployment deploy(String id, DeployAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.deploy(id, request, requestOptions).body(); + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public SyncPagingIterable logs(String id) { + return this.rawClient.logs(id).body(); + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public SyncPagingIterable logs(String id, RequestOptions requestOptions) { + return this.rawClient.logs(id, requestOptions).body(); + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public SyncPagingIterable logs(String id, LogsAppsRequest request) { + return this.rawClient.logs(id, request).body(); + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public SyncPagingIterable logs( + String id, LogsAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.logs(id, request, requestOptions).body(); + } + + /** + * Replaces the set of permissions the app requests from users when they install it. Requires a user session: the developer:update_app_authorization scope cannot be delegated to API keys. Sensitive permissions require step-up verification. + */ + public App updatePermissions(String id, UpdatePermissionsAppsRequest request) { + return this.rawClient.updatePermissions(id, request).body(); + } + + /** + * Replaces the set of permissions the app requests from users when they install it. Requires a user session: the developer:update_app_authorization scope cannot be delegated to API keys. Sensitive permissions require step-up verification. + */ + public App updatePermissions(String id, UpdatePermissionsAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.updatePermissions(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/apps/AsyncAppsClient.java b/src/main/java/com/whop/api/resources/apps/AsyncAppsClient.java new file mode 100644 index 00000000..0ea96c5c --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/AsyncAppsClient.java @@ -0,0 +1,268 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.apps.requests.CreateAppsRequest; +import com.whop.api.resources.apps.requests.DeleteAppsRequest; +import com.whop.api.resources.apps.requests.DeployAppsRequest; +import com.whop.api.resources.apps.requests.ListAppsRequest; +import com.whop.api.resources.apps.requests.LogsAppsRequest; +import com.whop.api.resources.apps.requests.RetrieveAppsRequest; +import com.whop.api.resources.apps.requests.UpdateAppsRequest; +import com.whop.api.resources.apps.requests.UpdatePermissionsAppRequest; +import com.whop.api.resources.apps.requests.UpdatePermissionsAppsRequest; +import com.whop.api.resources.apps.types.DeleteAppsResponse; +import com.whop.api.resources.apps.types.LogsAppsResponseDataItem; +import com.whop.api.types.App; +import com.whop.api.types.AppDeployment; +import com.whop.api.types.AppListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncAppsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAppsClient rawClient; + + public AsyncAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAppsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAppsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public CompletableFuture> list(ListAppsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public CompletableFuture> list( + ListAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Registers a new app on the Whop developer platform. Apps provide custom experiences that can be added to products. + */ + public CompletableFuture create(CreateAppsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Registers a new app on the Whop developer platform. Apps provide custom experiences that can be added to products. + */ + public CompletableFuture create(CreateAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates the permission requirements for an app + *

Required permissions:

+ *
    + *
  • developer:update_app_authorization
  • + *
+ */ + public CompletableFuture updatePermissionsApp(String appId, UpdatePermissionsAppRequest request) { + return this.rawClient.updatePermissionsApp(appId, request).thenApply(response -> response.body()); + } + + /** + * Updates the permission requirements for an app + *

Required permissions:

+ *
    + *
  • developer:update_app_authorization
  • + *
+ */ + public CompletableFuture updatePermissionsApp( + String appId, UpdatePermissionsAppRequest request, RequestOptions requestOptions) { + return this.rawClient + .updatePermissionsApp(appId, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public CompletableFuture retrieve(String id, RetrieveAppsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public CompletableFuture retrieve(String id, RetrieveAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public CompletableFuture delete(String id, DeleteAppsRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public CompletableFuture delete( + String id, DeleteAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public CompletableFuture update(String id, UpdateAppsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public CompletableFuture update(String id, UpdateAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public CompletableFuture deploy(String id) { + return this.rawClient.deploy(id).thenApply(response -> response.body()); + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public CompletableFuture deploy(String id, RequestOptions requestOptions) { + return this.rawClient.deploy(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public CompletableFuture deploy(String id, DeployAppsRequest request) { + return this.rawClient.deploy(id, request).thenApply(response -> response.body()); + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public CompletableFuture deploy( + String id, DeployAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.deploy(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public CompletableFuture> logs(String id) { + return this.rawClient.logs(id).thenApply(response -> response.body()); + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public CompletableFuture> logs( + String id, RequestOptions requestOptions) { + return this.rawClient.logs(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public CompletableFuture> logs(String id, LogsAppsRequest request) { + return this.rawClient.logs(id, request).thenApply(response -> response.body()); + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public CompletableFuture> logs( + String id, LogsAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.logs(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Replaces the set of permissions the app requests from users when they install it. Requires a user session: the developer:update_app_authorization scope cannot be delegated to API keys. Sensitive permissions require step-up verification. + */ + public CompletableFuture updatePermissions(String id, UpdatePermissionsAppsRequest request) { + return this.rawClient.updatePermissions(id, request).thenApply(response -> response.body()); + } + + /** + * Replaces the set of permissions the app requests from users when they install it. Requires a user session: the developer:update_app_authorization scope cannot be delegated to API keys. Sensitive permissions require step-up verification. + */ + public CompletableFuture updatePermissions( + String id, UpdatePermissionsAppsRequest request, RequestOptions requestOptions) { + return this.rawClient.updatePermissions(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/apps/AsyncRawAppsClient.java b/src/main/java/com/whop/api/resources/apps/AsyncRawAppsClient.java new file mode 100644 index 00000000..cfb4ef91 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/AsyncRawAppsClient.java @@ -0,0 +1,1056 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.apps.requests.CreateAppsRequest; +import com.whop.api.resources.apps.requests.DeleteAppsRequest; +import com.whop.api.resources.apps.requests.DeployAppsRequest; +import com.whop.api.resources.apps.requests.ListAppsRequest; +import com.whop.api.resources.apps.requests.LogsAppsRequest; +import com.whop.api.resources.apps.requests.RetrieveAppsRequest; +import com.whop.api.resources.apps.requests.UpdateAppsRequest; +import com.whop.api.resources.apps.requests.UpdatePermissionsAppRequest; +import com.whop.api.resources.apps.requests.UpdatePermissionsAppsRequest; +import com.whop.api.resources.apps.types.DeleteAppsResponse; +import com.whop.api.resources.apps.types.ListAppsResponse; +import com.whop.api.resources.apps.types.LogsAppsResponse; +import com.whop.api.resources.apps.types.LogsAppsResponseDataItem; +import com.whop.api.types.App; +import com.whop.api.types.AppDeployment; +import com.whop.api.types.AppListItem; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAppsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public CompletableFuture>> list() { + return list(ListAppsRequest.builder().build()); + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(ListAppsRequest.builder().build(), requestOptions); + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public CompletableFuture>> list(ListAppsRequest request) { + return list(request, null); + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public CompletableFuture>> list( + ListAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getAppType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_type", request.getAppType().get(), false); + } + if (request.getViewType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "view_type", request.getViewType().get(), false); + } + if (request.getVerifiedAppsOnly().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "verified_apps_only", request.getVerifiedAppsOnly().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAppsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAppsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListAppsRequest nextRequest = ListAppsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Registers a new app on the Whop developer platform. Apps provide custom experiences that can be added to products. + */ + public CompletableFuture> create(CreateAppsRequest request) { + return create(request, null); + } + + /** + * Registers a new app on the Whop developer platform. Apps provide custom experiences that can be added to products. + */ + public CompletableFuture> create( + CreateAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, App.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates the permission requirements for an app + *

Required permissions:

+ *
    + *
  • developer:update_app_authorization
  • + *
+ */ + public CompletableFuture> updatePermissionsApp( + String appId, UpdatePermissionsAppRequest request) { + return updatePermissionsApp(appId, request, null); + } + + /** + * Updates the permission requirements for an app + *

Required permissions:

+ *
    + *
  • developer:update_app_authorization
  • + *
+ */ + public CompletableFuture> updatePermissionsApp( + String appId, UpdatePermissionsAppRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps") + .addPathSegment(appId) + .addPathSegments("permissions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveAppsRequest.builder().build()); + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAppsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public CompletableFuture> retrieve(String id, RetrieveAppsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public CompletableFuture> retrieve( + String id, RetrieveAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, App.class), response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteAppsRequest.builder().build()); + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteAppsRequest.builder().build(), requestOptions); + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public CompletableFuture> delete(String id, DeleteAppsRequest request) { + return delete(id, request, null); + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public CompletableFuture> delete( + String id, DeleteAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteAppsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateAppsRequest.builder().build()); + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateAppsRequest.builder().build(), requestOptions); + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public CompletableFuture> update(String id, UpdateAppsRequest request) { + return update(id, request, null); + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public CompletableFuture> update( + String id, UpdateAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, App.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public CompletableFuture> deploy(String id) { + return deploy(id, DeployAppsRequest.builder().build()); + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public CompletableFuture> deploy(String id, RequestOptions requestOptions) { + return deploy(id, DeployAppsRequest.builder().build(), requestOptions); + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public CompletableFuture> deploy(String id, DeployAppsRequest request) { + return deploy(id, request, null); + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public CompletableFuture> deploy( + String id, DeployAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps") + .addPathSegment(id) + .addPathSegments("deploy"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppDeployment.class), + response)); + return; + } + try { + switch (response.code()) { + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public CompletableFuture>> logs(String id) { + return logs(id, LogsAppsRequest.builder().build()); + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public CompletableFuture>> logs( + String id, RequestOptions requestOptions) { + return logs(id, LogsAppsRequest.builder().build(), requestOptions); + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public CompletableFuture>> logs( + String id, LogsAppsRequest request) { + return logs(id, request, null); + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public CompletableFuture>> logs( + String id, LogsAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps") + .addPathSegment(id) + .addPathSegments("logs"); + if (request.getAppBuildId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_build_id", request.getAppBuildId().get(), false); + } + if (request.getLevel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "level", request.getLevel().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + LogsAppsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LogsAppsResponse.class); + String startingAfter = + parsedResponse.getPageInfo().getEndCursor().orElse(null); + LogsAppsRequest nextRequest = LogsAppsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + !startingAfter.isEmpty(), result, parsedResponse, () -> { + try { + return logs(id, nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Replaces the set of permissions the app requests from users when they install it. Requires a user session: the developer:update_app_authorization scope cannot be delegated to API keys. Sensitive permissions require step-up verification. + */ + public CompletableFuture> updatePermissions( + String id, UpdatePermissionsAppsRequest request) { + return updatePermissions(id, request, null); + } + + /** + * Replaces the set of permissions the app requests from users when they install it. Requires a user session: the developer:update_app_authorization scope cannot be delegated to API keys. Sensitive permissions require step-up verification. + */ + public CompletableFuture> updatePermissions( + String id, UpdatePermissionsAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps") + .addPathSegment(id) + .addPathSegments("permissions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, App.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/apps/RawAppsClient.java b/src/main/java/com/whop/api/resources/apps/RawAppsClient.java new file mode 100644 index 00000000..ab35280d --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/RawAppsClient.java @@ -0,0 +1,852 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.apps.requests.CreateAppsRequest; +import com.whop.api.resources.apps.requests.DeleteAppsRequest; +import com.whop.api.resources.apps.requests.DeployAppsRequest; +import com.whop.api.resources.apps.requests.ListAppsRequest; +import com.whop.api.resources.apps.requests.LogsAppsRequest; +import com.whop.api.resources.apps.requests.RetrieveAppsRequest; +import com.whop.api.resources.apps.requests.UpdateAppsRequest; +import com.whop.api.resources.apps.requests.UpdatePermissionsAppRequest; +import com.whop.api.resources.apps.requests.UpdatePermissionsAppsRequest; +import com.whop.api.resources.apps.types.DeleteAppsResponse; +import com.whop.api.resources.apps.types.ListAppsResponse; +import com.whop.api.resources.apps.types.LogsAppsResponse; +import com.whop.api.resources.apps.types.LogsAppsResponseDataItem; +import com.whop.api.types.App; +import com.whop.api.types.AppDeployment; +import com.whop.api.types.AppListItem; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAppsClient { + protected final ClientOptions clientOptions; + + public RawAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public WhopApiHttpResponse> list() { + return list(ListAppsRequest.builder().build()); + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListAppsRequest.builder().build(), requestOptions); + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public WhopApiHttpResponse> list(ListAppsRequest request) { + return list(request, null); + } + + /** + * Lists apps on the Whop platform: the app store's live apps, or — with account_id and developer access to that account — every app the account owns. Requires authentication, except for the publicly readable lists: verified_apps_only=true, and app_type=website with no account_id, which returns every live deployed website that Whop has not verified — verified templates are the curated verified_apps_only=true list instead. + */ + public WhopApiHttpResponse> list( + ListAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getAppType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_type", request.getAppType().get(), false); + } + if (request.getViewType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "view_type", request.getViewType().get(), false); + } + if (request.getVerifiedAppsOnly().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "verified_apps_only", request.getVerifiedAppsOnly().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAppsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAppsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListAppsRequest nextRequest = ListAppsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Registers a new app on the Whop developer platform. Apps provide custom experiences that can be added to products. + */ + public WhopApiHttpResponse create(CreateAppsRequest request) { + return create(request, null); + } + + /** + * Registers a new app on the Whop developer platform. Apps provide custom experiences that can be added to products. + */ + public WhopApiHttpResponse create(CreateAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, App.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates the permission requirements for an app + *

Required permissions:

+ *
    + *
  • developer:update_app_authorization
  • + *
+ */ + public WhopApiHttpResponse updatePermissionsApp(String appId, UpdatePermissionsAppRequest request) { + return updatePermissionsApp(appId, request, null); + } + + /** + * Updates the permission requirements for an app + *

Required permissions:

+ *
    + *
  • developer:update_app_authorization
  • + *
+ */ + public WhopApiHttpResponse updatePermissionsApp( + String appId, UpdatePermissionsAppRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps") + .addPathSegment(appId) + .addPathSegments("permissions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveAppsRequest.builder().build()); + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAppsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveAppsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves an app by ID, claimed route, or proxy domain id. Credential fields (api_key, default_api_key, secrets) render null unless the caller has the corresponding developer permission on the owning account. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, App.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteAppsRequest.builder().build()); + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteAppsRequest.builder().build(), requestOptions); + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public WhopApiHttpResponse delete(String id, DeleteAppsRequest request) { + return delete(id, request, null); + } + + /** + * Deletes an app. The app stops resolving within seconds — a website's site stops serving, and any claimed subdomain is reserved for a month before it can be claimed again. + */ + public WhopApiHttpResponse delete( + String id, DeleteAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteAppsResponse.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateAppsRequest.builder().build()); + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateAppsRequest.builder().build(), requestOptions); + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public WhopApiHttpResponse update(String id, UpdateAppsRequest request) { + return update(id, request, null); + } + + /** + * Updates the settings, metadata, or status of an app. Fields that are omitted keep their current value. + */ + public WhopApiHttpResponse update(String id, UpdateAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, App.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public WhopApiHttpResponse deploy(String id) { + return deploy(id, DeployAppsRequest.builder().build()); + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public WhopApiHttpResponse deploy(String id, RequestOptions requestOptions) { + return deploy(id, DeployAppsRequest.builder().build(), requestOptions); + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public WhopApiHttpResponse deploy(String id, DeployAppsRequest request) { + return deploy(id, request, null); + } + + /** + * Builds the app's current source and ships it. Returns the run it started, so the caller can render progress from this response and then follow it on the app's deployment field. Only one deployment runs per app at a time — calling this while one is in flight reports that run rather than starting a second, and calling it with nothing to publish reports that instead of starting one. + */ + public WhopApiHttpResponse deploy( + String id, DeployAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps") + .addPathSegment(id) + .addPathSegments("deploy"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AppDeployment.class), response); + } + try { + switch (response.code()) { + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public WhopApiHttpResponse> logs(String id) { + return logs(id, LogsAppsRequest.builder().build()); + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public WhopApiHttpResponse> logs( + String id, RequestOptions requestOptions) { + return logs(id, LogsAppsRequest.builder().build(), requestOptions); + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public WhopApiHttpResponse> logs(String id, LogsAppsRequest request) { + return logs(id, request, null); + } + + /** + * Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days. + */ + public WhopApiHttpResponse> logs( + String id, LogsAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps") + .addPathSegment(id) + .addPathSegments("logs"); + if (request.getAppBuildId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_build_id", request.getAppBuildId().get(), false); + } + if (request.getLevel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "level", request.getLevel().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + LogsAppsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LogsAppsResponse.class); + String startingAfter = + parsedResponse.getPageInfo().getEndCursor().orElse(null); + LogsAppsRequest nextRequest = LogsAppsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + !startingAfter.isEmpty(), result, parsedResponse, () -> logs( + id, nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Replaces the set of permissions the app requests from users when they install it. Requires a user session: the developer:update_app_authorization scope cannot be delegated to API keys. Sensitive permissions require step-up verification. + */ + public WhopApiHttpResponse updatePermissions(String id, UpdatePermissionsAppsRequest request) { + return updatePermissions(id, request, null); + } + + /** + * Replaces the set of permissions the app requests from users when they install it. Requires a user session: the developer:update_app_authorization scope cannot be delegated to API keys. Sensitive permissions require step-up verification. + */ + public WhopApiHttpResponse updatePermissions( + String id, UpdatePermissionsAppsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("apps") + .addPathSegment(id) + .addPathSegments("permissions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, App.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/requests/CreateAppsRequest.java b/src/main/java/com/whop/api/resources/apps/requests/CreateAppsRequest.java new file mode 100644 index 00000000..5ca4f0be --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/requests/CreateAppsRequest.java @@ -0,0 +1,453 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.apps.types.CreateAppsRequestAppType; +import com.whop.api.resources.apps.types.CreateAppsRequestIcon; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAppsRequest.Builder.class) +public final class CreateAppsRequest { + private final Optional accountId; + + private final Optional appType; + + private final Optional baseUrl; + + private final Optional icon; + + private final String name; + + private final Optional> redirectUris; + + private final Optional route; + + private final Map additionalProperties; + + private CreateAppsRequest( + Optional accountId, + Optional appType, + Optional baseUrl, + Optional icon, + String name, + Optional> redirectUris, + Optional route, + Map additionalProperties) { + this.accountId = accountId; + this.appType = appType; + this.baseUrl = baseUrl; + this.icon = icon; + this.name = name; + this.redirectUris = redirectUris; + this.route = route; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account to create the app for (biz_ tag). Defaults to the account behind the presented credential. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The type of app to create. Defaults to b2c_app. + */ + @JsonProperty("app_type") + public Optional getAppType() { + return appType; + } + + /** + * @return The base production URL where the app is hosted, such as https://myapp.example.com. + */ + @JsonIgnore + public Optional getBaseUrl() { + if (baseUrl == null) { + return Optional.empty(); + } + return baseUrl; + } + + /** + * @return The icon image for the app in PNG, JPEG, or GIF format, referencing an uploaded file: { id } for an existing attachment or { direct_upload_id } for a new direct upload. + */ + @JsonProperty("icon") + public Optional getIcon() { + return icon; + } + + /** + * @return The display name for the app, shown to users on the app store and product pages. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The whitelisted OAuth callback URLs that users are redirected to after authorizing the app. + */ + @JsonProperty("redirect_uris") + public Optional> getRedirectUris() { + return redirectUris; + } + + /** + * @return The subdomain route where the app's hosted web builds are served, such as myapp for myapp.whop.app. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("base_url") + private Optional _getBaseUrl() { + return baseUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAppsRequest && equalTo((CreateAppsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAppsRequest other) { + return accountId.equals(other.accountId) + && appType.equals(other.appType) + && baseUrl.equals(other.baseUrl) + && icon.equals(other.icon) + && name.equals(other.name) + && redirectUris.equals(other.redirectUris) + && route.equals(other.route); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, this.appType, this.baseUrl, this.icon, this.name, this.redirectUris, this.route); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

The display name for the app, shown to users on the app store and product pages.

+ */ + _FinalStage name(@NotNull String name); + + Builder from(CreateAppsRequest other); + } + + public interface _FinalStage { + CreateAppsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account to create the app for (biz_ tag). Defaults to the account behind the presented credential.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + /** + *

The type of app to create. Defaults to b2c_app.

+ */ + _FinalStage appType(Optional appType); + + _FinalStage appType(CreateAppsRequestAppType appType); + + /** + *

The base production URL where the app is hosted, such as https://myapp.example.com.

+ */ + _FinalStage baseUrl(Optional baseUrl); + + _FinalStage baseUrl(String baseUrl); + + _FinalStage baseUrl(Nullable baseUrl); + + /** + *

The icon image for the app in PNG, JPEG, or GIF format, referencing an uploaded file: { id } for an existing attachment or { direct_upload_id } for a new direct upload.

+ */ + _FinalStage icon(Optional icon); + + _FinalStage icon(CreateAppsRequestIcon icon); + + /** + *

The whitelisted OAuth callback URLs that users are redirected to after authorizing the app.

+ */ + _FinalStage redirectUris(Optional> redirectUris); + + _FinalStage redirectUris(List redirectUris); + + /** + *

The subdomain route where the app's hosted web builds are served, such as myapp for myapp.whop.app.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + private Optional route = Optional.empty(); + + private Optional> redirectUris = Optional.empty(); + + private Optional icon = Optional.empty(); + + private Optional baseUrl = Optional.empty(); + + private Optional appType = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAppsRequest other) { + accountId(other.getAccountId()); + appType(other.getAppType()); + baseUrl(other.getBaseUrl()); + icon(other.getIcon()); + name(other.getName()); + redirectUris(other.getRedirectUris()); + route(other.getRoute()); + return this; + } + + /** + *

The display name for the app, shown to users on the app store and product pages.

+ *

The display name for the app, shown to users on the app store and product pages.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The subdomain route where the app's hosted web builds are served, such as myapp for myapp.whop.app.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

The subdomain route where the app's hosted web builds are served, such as myapp for myapp.whop.app.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

The subdomain route where the app's hosted web builds are served, such as myapp for myapp.whop.app.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + /** + *

The whitelisted OAuth callback URLs that users are redirected to after authorizing the app.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectUris(List redirectUris) { + this.redirectUris = Optional.ofNullable(redirectUris); + return this; + } + + /** + *

The whitelisted OAuth callback URLs that users are redirected to after authorizing the app.

+ */ + @java.lang.Override + @JsonSetter(value = "redirect_uris", nulls = Nulls.SKIP) + public _FinalStage redirectUris(Optional> redirectUris) { + this.redirectUris = redirectUris; + return this; + } + + /** + *

The icon image for the app in PNG, JPEG, or GIF format, referencing an uploaded file: { id } for an existing attachment or { direct_upload_id } for a new direct upload.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage icon(CreateAppsRequestIcon icon) { + this.icon = Optional.ofNullable(icon); + return this; + } + + /** + *

The icon image for the app in PNG, JPEG, or GIF format, referencing an uploaded file: { id } for an existing attachment or { direct_upload_id } for a new direct upload.

+ */ + @java.lang.Override + @JsonSetter(value = "icon", nulls = Nulls.SKIP) + public _FinalStage icon(Optional icon) { + this.icon = icon; + return this; + } + + /** + *

The base production URL where the app is hosted, such as https://myapp.example.com.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage baseUrl(Nullable baseUrl) { + if (baseUrl.isNull()) { + this.baseUrl = null; + } else if (baseUrl.isEmpty()) { + this.baseUrl = Optional.empty(); + } else { + this.baseUrl = Optional.of(baseUrl.get()); + } + return this; + } + + /** + *

The base production URL where the app is hosted, such as https://myapp.example.com.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage baseUrl(String baseUrl) { + this.baseUrl = Optional.ofNullable(baseUrl); + return this; + } + + /** + *

The base production URL where the app is hosted, such as https://myapp.example.com.

+ */ + @java.lang.Override + @JsonSetter(value = "base_url", nulls = Nulls.SKIP) + public _FinalStage baseUrl(Optional baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + /** + *

The type of app to create. Defaults to b2c_app.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appType(CreateAppsRequestAppType appType) { + this.appType = Optional.ofNullable(appType); + return this; + } + + /** + *

The type of app to create. Defaults to b2c_app.

+ */ + @java.lang.Override + @JsonSetter(value = "app_type", nulls = Nulls.SKIP) + public _FinalStage appType(Optional appType) { + this.appType = appType; + return this; + } + + /** + *

The account to create the app for (biz_ tag). Defaults to the account behind the presented credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account to create the app for (biz_ tag). Defaults to the account behind the presented credential.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public CreateAppsRequest build() { + return new CreateAppsRequest( + accountId, appType, baseUrl, icon, name, redirectUris, route, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/requests/DeleteAppsRequest.java b/src/main/java/com/whop/api/resources/apps/requests/DeleteAppsRequest.java new file mode 100644 index 00000000..00cb6aec --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/requests/DeleteAppsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteAppsRequest.Builder.class) +public final class DeleteAppsRequest { + private final Map additionalProperties; + + private DeleteAppsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteAppsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteAppsRequest other) { + return this; + } + + public DeleteAppsRequest build() { + return new DeleteAppsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/requests/DeployAppsRequest.java b/src/main/java/com/whop/api/resources/apps/requests/DeployAppsRequest.java new file mode 100644 index 00000000..65762f6e --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/requests/DeployAppsRequest.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployAppsRequest.Builder.class) +public final class DeployAppsRequest { + private final Optional draft; + + private final Map additionalProperties; + + private DeployAppsRequest(Optional draft, Map additionalProperties) { + this.draft = draft; + this.additionalProperties = additionalProperties; + } + + /** + * @return Upload the build without making it live. Defaults to false, which deploys and promotes in one step. + */ + @JsonProperty("draft") + public Optional getDraft() { + return draft; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployAppsRequest && equalTo((DeployAppsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployAppsRequest other) { + return draft.equals(other.draft); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.draft); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional draft = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeployAppsRequest other) { + draft(other.getDraft()); + return this; + } + + /** + *

Upload the build without making it live. Defaults to false, which deploys and promotes in one step.

+ */ + @JsonSetter(value = "draft", nulls = Nulls.SKIP) + public Builder draft(Optional draft) { + this.draft = draft; + return this; + } + + public Builder draft(Boolean draft) { + this.draft = Optional.ofNullable(draft); + return this; + } + + public DeployAppsRequest build() { + return new DeployAppsRequest(draft, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/requests/ListAppsRequest.java b/src/main/java/com/whop/api/resources/apps/requests/ListAppsRequest.java new file mode 100644 index 00000000..d0332397 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/requests/ListAppsRequest.java @@ -0,0 +1,440 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.apps.types.ListAppsRequestAppType; +import com.whop.api.resources.apps.types.ListAppsRequestDirection; +import com.whop.api.resources.apps.types.ListAppsRequestOrder; +import com.whop.api.resources.apps.types.ListAppsRequestViewType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAppsRequest.Builder.class) +public final class ListAppsRequest { + private final Optional accountId; + + private final Optional appType; + + private final Optional viewType; + + private final Optional verifiedAppsOnly; + + private final Optional query; + + private final Optional order; + + private final Optional direction; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListAppsRequest( + Optional accountId, + Optional appType, + Optional viewType, + Optional verifiedAppsOnly, + Optional query, + Optional order, + Optional direction, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.accountId = accountId; + this.appType = appType; + this.viewType = viewType; + this.verifiedAppsOnly = verifiedAppsOnly; + this.query = query; + this.order = order; + this.direction = direction; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only return apps created by this account (biz_ tag). With developer access to the account this includes its unlisted and hidden apps. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Filter apps by the type of end-user they are built for. Apps of type website are left out unless you ask for them by name. + */ + @JsonProperty("app_type") + public Optional getAppType() { + return appType; + } + + /** + * @return Only return apps supporting this view type, such as dashboard or hub. + */ + @JsonProperty("view_type") + public Optional getViewType() { + return viewType; + } + + /** + * @return Whether to only return apps verified by Whop. Verified website templates — websites with a published web build — are included, even though websites are otherwise left out of app lists. + */ + @JsonProperty("verified_apps_only") + public Optional getVerifiedAppsOnly() { + return verifiedAppsOnly; + } + + /** + * @return A search string matched against app names. + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + /** + * @return The field to sort apps by. Defaults to discoverable_at, showing the most recently published apps first. template_usage ranks Whop-verified apps first, then apps with a banner image, then by how many apps were created from each app as a template. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return The number of apps to return (default 20, max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns apps after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of apps to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns apps before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAppsRequest && equalTo((ListAppsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAppsRequest other) { + return accountId.equals(other.accountId) + && appType.equals(other.appType) + && viewType.equals(other.viewType) + && verifiedAppsOnly.equals(other.verifiedAppsOnly) + && query.equals(other.query) + && order.equals(other.order) + && direction.equals(other.direction) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.appType, + this.viewType, + this.verifiedAppsOnly, + this.query, + this.order, + this.direction, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional appType = Optional.empty(); + + private Optional viewType = Optional.empty(); + + private Optional verifiedAppsOnly = Optional.empty(); + + private Optional query = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListAppsRequest other) { + accountId(other.getAccountId()); + appType(other.getAppType()); + viewType(other.getViewType()); + verifiedAppsOnly(other.getVerifiedAppsOnly()); + query(other.getQuery()); + order(other.getOrder()); + direction(other.getDirection()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

Only return apps created by this account (biz_ tag). With developer access to the account this includes its unlisted and hidden apps.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Filter apps by the type of end-user they are built for. Apps of type website are left out unless you ask for them by name.

+ */ + @JsonSetter(value = "app_type", nulls = Nulls.SKIP) + public Builder appType(Optional appType) { + this.appType = appType; + return this; + } + + public Builder appType(ListAppsRequestAppType appType) { + this.appType = Optional.ofNullable(appType); + return this; + } + + /** + *

Only return apps supporting this view type, such as dashboard or hub.

+ */ + @JsonSetter(value = "view_type", nulls = Nulls.SKIP) + public Builder viewType(Optional viewType) { + this.viewType = viewType; + return this; + } + + public Builder viewType(ListAppsRequestViewType viewType) { + this.viewType = Optional.ofNullable(viewType); + return this; + } + + /** + *

Whether to only return apps verified by Whop. Verified website templates — websites with a published web build — are included, even though websites are otherwise left out of app lists.

+ */ + @JsonSetter(value = "verified_apps_only", nulls = Nulls.SKIP) + public Builder verifiedAppsOnly(Optional verifiedAppsOnly) { + this.verifiedAppsOnly = verifiedAppsOnly; + return this; + } + + public Builder verifiedAppsOnly(Boolean verifiedAppsOnly) { + this.verifiedAppsOnly = Optional.ofNullable(verifiedAppsOnly); + return this; + } + + /** + *

A search string matched against app names.

+ */ + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public Builder query(Optional query) { + this.query = query; + return this; + } + + public Builder query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + /** + *

The field to sort apps by. Defaults to discoverable_at, showing the most recently published apps first. template_usage ranks Whop-verified apps first, then apps with a banner image, then by how many apps were created from each app as a template.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListAppsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListAppsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

The number of apps to return (default 20, max 100).

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor; returns apps after this position.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The number of apps to return from the end of the range.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

A cursor; returns apps before this position.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListAppsRequest build() { + return new ListAppsRequest( + accountId, + appType, + viewType, + verifiedAppsOnly, + query, + order, + direction, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/requests/LogsAppsRequest.java b/src/main/java/com/whop/api/resources/apps/requests/LogsAppsRequest.java new file mode 100644 index 00000000..c3c210fc --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/requests/LogsAppsRequest.java @@ -0,0 +1,334 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.apps.types.LogsAppsRequestLevel; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LogsAppsRequest.Builder.class) +public final class LogsAppsRequest { + private final Optional appBuildId; + + private final Optional level; + + private final Optional query; + + private final Optional createdAfter; + + private final Optional createdBefore; + + private final Optional first; + + private final Optional after; + + private final Optional before; + + private final Map additionalProperties; + + private LogsAppsRequest( + Optional appBuildId, + Optional level, + Optional query, + Optional createdAfter, + Optional createdBefore, + Optional first, + Optional after, + Optional before, + Map additionalProperties) { + this.appBuildId = appBuildId; + this.level = level; + this.query = query; + this.createdAfter = createdAfter; + this.createdBefore = createdBefore; + this.first = first; + this.after = after; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only return logs from this build. + */ + @JsonProperty("app_build_id") + public Optional getAppBuildId() { + return appBuildId; + } + + /** + * @return Only return console lines of this level. + */ + @JsonProperty("level") + public Optional getLevel() { + return level; + } + + /** + * @return Only return logs whose message contains this text (case-insensitive). + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + /** + * @return Start of the time window as an ISO 8601 timestamp. Defaults to 7 days before created_before. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return End of the time window as an ISO 8601 timestamp. Defaults to now. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return The number of log lines to return (max 500). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor for fetching logs after a previous page. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return A cursor for fetching logs before a later page. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LogsAppsRequest && equalTo((LogsAppsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LogsAppsRequest other) { + return appBuildId.equals(other.appBuildId) + && level.equals(other.level) + && query.equals(other.query) + && createdAfter.equals(other.createdAfter) + && createdBefore.equals(other.createdBefore) + && first.equals(other.first) + && after.equals(other.after) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appBuildId, + this.level, + this.query, + this.createdAfter, + this.createdBefore, + this.first, + this.after, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional appBuildId = Optional.empty(); + + private Optional level = Optional.empty(); + + private Optional query = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(LogsAppsRequest other) { + appBuildId(other.getAppBuildId()); + level(other.getLevel()); + query(other.getQuery()); + createdAfter(other.getCreatedAfter()); + createdBefore(other.getCreatedBefore()); + first(other.getFirst()); + after(other.getAfter()); + before(other.getBefore()); + return this; + } + + /** + *

Only return logs from this build.

+ */ + @JsonSetter(value = "app_build_id", nulls = Nulls.SKIP) + public Builder appBuildId(Optional appBuildId) { + this.appBuildId = appBuildId; + return this; + } + + public Builder appBuildId(String appBuildId) { + this.appBuildId = Optional.ofNullable(appBuildId); + return this; + } + + /** + *

Only return console lines of this level.

+ */ + @JsonSetter(value = "level", nulls = Nulls.SKIP) + public Builder level(Optional level) { + this.level = level; + return this; + } + + public Builder level(LogsAppsRequestLevel level) { + this.level = Optional.ofNullable(level); + return this; + } + + /** + *

Only return logs whose message contains this text (case-insensitive).

+ */ + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public Builder query(Optional query) { + this.query = query; + return this; + } + + public Builder query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + /** + *

Start of the time window as an ISO 8601 timestamp. Defaults to 7 days before created_before.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

End of the time window as an ISO 8601 timestamp. Defaults to now.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

The number of log lines to return (max 500).

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor for fetching logs after a previous page.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

A cursor for fetching logs before a later page.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public LogsAppsRequest build() { + return new LogsAppsRequest( + appBuildId, level, query, createdAfter, createdBefore, first, after, before, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/requests/RetrieveAppsRequest.java b/src/main/java/com/whop/api/resources/apps/requests/RetrieveAppsRequest.java new file mode 100644 index 00000000..34b6c2d3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/requests/RetrieveAppsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveAppsRequest.Builder.class) +public final class RetrieveAppsRequest { + private final Map additionalProperties; + + private RetrieveAppsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveAppsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveAppsRequest other) { + return this; + } + + public RetrieveAppsRequest build() { + return new RetrieveAppsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/requests/UpdateAppsRequest.java b/src/main/java/com/whop/api/resources/apps/requests/UpdateAppsRequest.java new file mode 100644 index 00000000..63ff6357 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/requests/UpdateAppsRequest.java @@ -0,0 +1,912 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.apps.types.UpdateAppsRequestAppType; +import com.whop.api.resources.apps.types.UpdateAppsRequestIcon; +import com.whop.api.resources.apps.types.UpdateAppsRequestOauthClientType; +import com.whop.api.resources.apps.types.UpdateAppsRequestStatus; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAppsRequest.Builder.class) +public final class UpdateAppsRequest { + private final Optional appStoreDescription; + + private final Optional appType; + + private final Optional baseUrl; + + private final Optional dashboardPath; + + private final Optional description; + + private final Optional discoverPath; + + private final Optional experiencePath; + + private final Optional icon; + + private final Optional name; + + private final Optional oauthClientType; + + private final Optional openapiPath; + + private final Optional productionAndroidBuildId; + + private final Optional productionIosBuildId; + + private final Optional productionWebBuildId; + + private final Optional> redirectUris; + + private final Optional> requiredScopes; + + private final Optional route; + + private final Optional> secrets; + + private final Optional skillsPath; + + private final Optional status; + + private final Map additionalProperties; + + private UpdateAppsRequest( + Optional appStoreDescription, + Optional appType, + Optional baseUrl, + Optional dashboardPath, + Optional description, + Optional discoverPath, + Optional experiencePath, + Optional icon, + Optional name, + Optional oauthClientType, + Optional openapiPath, + Optional productionAndroidBuildId, + Optional productionIosBuildId, + Optional productionWebBuildId, + Optional> redirectUris, + Optional> requiredScopes, + Optional route, + Optional> secrets, + Optional skillsPath, + Optional status, + Map additionalProperties) { + this.appStoreDescription = appStoreDescription; + this.appType = appType; + this.baseUrl = baseUrl; + this.dashboardPath = dashboardPath; + this.description = description; + this.discoverPath = discoverPath; + this.experiencePath = experiencePath; + this.icon = icon; + this.name = name; + this.oauthClientType = oauthClientType; + this.openapiPath = openapiPath; + this.productionAndroidBuildId = productionAndroidBuildId; + this.productionIosBuildId = productionIosBuildId; + this.productionWebBuildId = productionWebBuildId; + this.redirectUris = redirectUris; + this.requiredScopes = requiredScopes; + this.route = route; + this.secrets = secrets; + this.skillsPath = skillsPath; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The detailed description shown on the app store's in-depth app view page. + */ + @JsonProperty("app_store_description") + public Optional getAppStoreDescription() { + return appStoreDescription; + } + + /** + * @return The type of end-user the app is built for. Cannot be changed on an app whose type is already website. + */ + @JsonProperty("app_type") + public Optional getAppType() { + return appType; + } + + /** + * @return The base production URL where the app is hosted. Set to null to take the app proxy offline. + */ + @JsonIgnore + public Optional getBaseUrl() { + if (baseUrl == null) { + return Optional.empty(); + } + return baseUrl; + } + + /** + * @return The URL path for the account dashboard view. + */ + @JsonIgnore + public Optional getDashboardPath() { + if (dashboardPath == null) { + return Optional.empty(); + } + return dashboardPath; + } + + /** + * @return A short description of the app shown in listings and search results. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The URL path for the discover view. + */ + @JsonIgnore + public Optional getDiscoverPath() { + if (discoverPath == null) { + return Optional.empty(); + } + return discoverPath; + } + + /** + * @return The URL path for the member-facing hub view, such as /experiences/[experienceId]. + */ + @JsonIgnore + public Optional getExperiencePath() { + if (experiencePath == null) { + return Optional.empty(); + } + return experiencePath; + } + + /** + * @return The icon image for the app in PNG, JPEG, or GIF format, referencing an uploaded file: { id } for an existing attachment or { direct_upload_id } for a new direct upload. + */ + @JsonProperty("icon") + public Optional getIcon() { + return icon; + } + + /** + * @return The display name for the app, shown to users on the app store and product pages. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return How the app authenticates at the OAuth token endpoint. + */ + @JsonProperty("oauth_client_type") + public Optional getOauthClientType() { + return oauthClientType; + } + + /** + * @return The URL path to the app's OpenAPI spec file (requires the ai_chat capability). + */ + @JsonIgnore + public Optional getOpenapiPath() { + if (openapiPath == null) { + return Optional.empty(); + } + return openapiPath; + } + + /** + * @return The app build (abld_ tag) to serve as the Android production build, or null to unassign it. Same rules as production_web_build_id. + */ + @JsonIgnore + public Optional getProductionAndroidBuildId() { + if (productionAndroidBuildId == null) { + return Optional.empty(); + } + return productionAndroidBuildId; + } + + /** + * @return The app build (abld_ tag) to serve as the iOS production build, or null to unassign it. Same rules as production_web_build_id. + */ + @JsonIgnore + public Optional getProductionIosBuildId() { + if (productionIosBuildId == null) { + return Optional.empty(); + } + return productionIosBuildId; + } + + /** + * @return The app build (abld_ tag) to serve as the web production build, or null to unassign it. The build must belong to this app, target web, and be in the draft or approved status; a draft build is queued for approval and takes over once approved. Requires the developer:manage_builds scope. + */ + @JsonIgnore + public Optional getProductionWebBuildId() { + if (productionWebBuildId == null) { + return Optional.empty(); + } + return productionWebBuildId; + } + + /** + * @return The whitelisted OAuth callback URLs users are redirected to after authorizing the app. + */ + @JsonProperty("redirect_uris") + public Optional> getRedirectUris() { + return redirectUris; + } + + /** + * @return The OAuth scopes the app requests from users when they install it. + */ + @JsonProperty("required_scopes") + public Optional> getRequiredScopes() { + return requiredScopes; + } + + /** + * @return The subdomain route where the app's hosted web builds are served. + */ + @JsonProperty("route") + public Optional getRoute() { + return route; + } + + /** + * @return Secrets to add or overwrite on the app, as an object of string values. Keys not included are left untouched; pass null or an empty string as the value to delete a secret. Encrypted at rest and injected into the app's hosted server runtime. + */ + @JsonProperty("secrets") + public Optional> getSecrets() { + return secrets; + } + + /** + * @return The URL path to the app's skills directory (requires the ai_chat capability). + */ + @JsonIgnore + public Optional getSkillsPath() { + if (skillsPath == null) { + return Optional.empty(); + } + return skillsPath; + } + + /** + * @return Controls whether the app is published on Whop discovery or accessible only through its direct link. Publishing requires a name, icon, and description. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("base_url") + private Optional _getBaseUrl() { + return baseUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("dashboard_path") + private Optional _getDashboardPath() { + return dashboardPath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("discover_path") + private Optional _getDiscoverPath() { + return discoverPath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("experience_path") + private Optional _getExperiencePath() { + return experiencePath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("openapi_path") + private Optional _getOpenapiPath() { + return openapiPath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("production_android_build_id") + private Optional _getProductionAndroidBuildId() { + return productionAndroidBuildId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("production_ios_build_id") + private Optional _getProductionIosBuildId() { + return productionIosBuildId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("production_web_build_id") + private Optional _getProductionWebBuildId() { + return productionWebBuildId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("skills_path") + private Optional _getSkillsPath() { + return skillsPath; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAppsRequest && equalTo((UpdateAppsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAppsRequest other) { + return appStoreDescription.equals(other.appStoreDescription) + && appType.equals(other.appType) + && baseUrl.equals(other.baseUrl) + && dashboardPath.equals(other.dashboardPath) + && description.equals(other.description) + && discoverPath.equals(other.discoverPath) + && experiencePath.equals(other.experiencePath) + && icon.equals(other.icon) + && name.equals(other.name) + && oauthClientType.equals(other.oauthClientType) + && openapiPath.equals(other.openapiPath) + && productionAndroidBuildId.equals(other.productionAndroidBuildId) + && productionIosBuildId.equals(other.productionIosBuildId) + && productionWebBuildId.equals(other.productionWebBuildId) + && redirectUris.equals(other.redirectUris) + && requiredScopes.equals(other.requiredScopes) + && route.equals(other.route) + && secrets.equals(other.secrets) + && skillsPath.equals(other.skillsPath) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appStoreDescription, + this.appType, + this.baseUrl, + this.dashboardPath, + this.description, + this.discoverPath, + this.experiencePath, + this.icon, + this.name, + this.oauthClientType, + this.openapiPath, + this.productionAndroidBuildId, + this.productionIosBuildId, + this.productionWebBuildId, + this.redirectUris, + this.requiredScopes, + this.route, + this.secrets, + this.skillsPath, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional appStoreDescription = Optional.empty(); + + private Optional appType = Optional.empty(); + + private Optional baseUrl = Optional.empty(); + + private Optional dashboardPath = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional discoverPath = Optional.empty(); + + private Optional experiencePath = Optional.empty(); + + private Optional icon = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional oauthClientType = Optional.empty(); + + private Optional openapiPath = Optional.empty(); + + private Optional productionAndroidBuildId = Optional.empty(); + + private Optional productionIosBuildId = Optional.empty(); + + private Optional productionWebBuildId = Optional.empty(); + + private Optional> redirectUris = Optional.empty(); + + private Optional> requiredScopes = Optional.empty(); + + private Optional route = Optional.empty(); + + private Optional> secrets = Optional.empty(); + + private Optional skillsPath = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAppsRequest other) { + appStoreDescription(other.getAppStoreDescription()); + appType(other.getAppType()); + baseUrl(other.getBaseUrl()); + dashboardPath(other.getDashboardPath()); + description(other.getDescription()); + discoverPath(other.getDiscoverPath()); + experiencePath(other.getExperiencePath()); + icon(other.getIcon()); + name(other.getName()); + oauthClientType(other.getOauthClientType()); + openapiPath(other.getOpenapiPath()); + productionAndroidBuildId(other.getProductionAndroidBuildId()); + productionIosBuildId(other.getProductionIosBuildId()); + productionWebBuildId(other.getProductionWebBuildId()); + redirectUris(other.getRedirectUris()); + requiredScopes(other.getRequiredScopes()); + route(other.getRoute()); + secrets(other.getSecrets()); + skillsPath(other.getSkillsPath()); + status(other.getStatus()); + return this; + } + + /** + *

The detailed description shown on the app store's in-depth app view page.

+ */ + @JsonSetter(value = "app_store_description", nulls = Nulls.SKIP) + public Builder appStoreDescription(Optional appStoreDescription) { + this.appStoreDescription = appStoreDescription; + return this; + } + + public Builder appStoreDescription(String appStoreDescription) { + this.appStoreDescription = Optional.ofNullable(appStoreDescription); + return this; + } + + /** + *

The type of end-user the app is built for. Cannot be changed on an app whose type is already website.

+ */ + @JsonSetter(value = "app_type", nulls = Nulls.SKIP) + public Builder appType(Optional appType) { + this.appType = appType; + return this; + } + + public Builder appType(UpdateAppsRequestAppType appType) { + this.appType = Optional.ofNullable(appType); + return this; + } + + /** + *

The base production URL where the app is hosted. Set to null to take the app proxy offline.

+ */ + @JsonSetter(value = "base_url", nulls = Nulls.SKIP) + public Builder baseUrl(Optional baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder baseUrl(String baseUrl) { + this.baseUrl = Optional.ofNullable(baseUrl); + return this; + } + + public Builder baseUrl(Nullable baseUrl) { + if (baseUrl.isNull()) { + this.baseUrl = null; + } else if (baseUrl.isEmpty()) { + this.baseUrl = Optional.empty(); + } else { + this.baseUrl = Optional.of(baseUrl.get()); + } + return this; + } + + /** + *

The URL path for the account dashboard view.

+ */ + @JsonSetter(value = "dashboard_path", nulls = Nulls.SKIP) + public Builder dashboardPath(Optional dashboardPath) { + this.dashboardPath = dashboardPath; + return this; + } + + public Builder dashboardPath(String dashboardPath) { + this.dashboardPath = Optional.ofNullable(dashboardPath); + return this; + } + + public Builder dashboardPath(Nullable dashboardPath) { + if (dashboardPath.isNull()) { + this.dashboardPath = null; + } else if (dashboardPath.isEmpty()) { + this.dashboardPath = Optional.empty(); + } else { + this.dashboardPath = Optional.of(dashboardPath.get()); + } + return this; + } + + /** + *

A short description of the app shown in listings and search results.

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

The URL path for the discover view.

+ */ + @JsonSetter(value = "discover_path", nulls = Nulls.SKIP) + public Builder discoverPath(Optional discoverPath) { + this.discoverPath = discoverPath; + return this; + } + + public Builder discoverPath(String discoverPath) { + this.discoverPath = Optional.ofNullable(discoverPath); + return this; + } + + public Builder discoverPath(Nullable discoverPath) { + if (discoverPath.isNull()) { + this.discoverPath = null; + } else if (discoverPath.isEmpty()) { + this.discoverPath = Optional.empty(); + } else { + this.discoverPath = Optional.of(discoverPath.get()); + } + return this; + } + + /** + *

The URL path for the member-facing hub view, such as /experiences/[experienceId].

+ */ + @JsonSetter(value = "experience_path", nulls = Nulls.SKIP) + public Builder experiencePath(Optional experiencePath) { + this.experiencePath = experiencePath; + return this; + } + + public Builder experiencePath(String experiencePath) { + this.experiencePath = Optional.ofNullable(experiencePath); + return this; + } + + public Builder experiencePath(Nullable experiencePath) { + if (experiencePath.isNull()) { + this.experiencePath = null; + } else if (experiencePath.isEmpty()) { + this.experiencePath = Optional.empty(); + } else { + this.experiencePath = Optional.of(experiencePath.get()); + } + return this; + } + + /** + *

The icon image for the app in PNG, JPEG, or GIF format, referencing an uploaded file: { id } for an existing attachment or { direct_upload_id } for a new direct upload.

+ */ + @JsonSetter(value = "icon", nulls = Nulls.SKIP) + public Builder icon(Optional icon) { + this.icon = icon; + return this; + } + + public Builder icon(UpdateAppsRequestIcon icon) { + this.icon = Optional.ofNullable(icon); + return this; + } + + /** + *

The display name for the app, shown to users on the app store and product pages.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

How the app authenticates at the OAuth token endpoint.

+ */ + @JsonSetter(value = "oauth_client_type", nulls = Nulls.SKIP) + public Builder oauthClientType(Optional oauthClientType) { + this.oauthClientType = oauthClientType; + return this; + } + + public Builder oauthClientType(UpdateAppsRequestOauthClientType oauthClientType) { + this.oauthClientType = Optional.ofNullable(oauthClientType); + return this; + } + + /** + *

The URL path to the app's OpenAPI spec file (requires the ai_chat capability).

+ */ + @JsonSetter(value = "openapi_path", nulls = Nulls.SKIP) + public Builder openapiPath(Optional openapiPath) { + this.openapiPath = openapiPath; + return this; + } + + public Builder openapiPath(String openapiPath) { + this.openapiPath = Optional.ofNullable(openapiPath); + return this; + } + + public Builder openapiPath(Nullable openapiPath) { + if (openapiPath.isNull()) { + this.openapiPath = null; + } else if (openapiPath.isEmpty()) { + this.openapiPath = Optional.empty(); + } else { + this.openapiPath = Optional.of(openapiPath.get()); + } + return this; + } + + /** + *

The app build (abld_ tag) to serve as the Android production build, or null to unassign it. Same rules as production_web_build_id.

+ */ + @JsonSetter(value = "production_android_build_id", nulls = Nulls.SKIP) + public Builder productionAndroidBuildId(Optional productionAndroidBuildId) { + this.productionAndroidBuildId = productionAndroidBuildId; + return this; + } + + public Builder productionAndroidBuildId(String productionAndroidBuildId) { + this.productionAndroidBuildId = Optional.ofNullable(productionAndroidBuildId); + return this; + } + + public Builder productionAndroidBuildId(Nullable productionAndroidBuildId) { + if (productionAndroidBuildId.isNull()) { + this.productionAndroidBuildId = null; + } else if (productionAndroidBuildId.isEmpty()) { + this.productionAndroidBuildId = Optional.empty(); + } else { + this.productionAndroidBuildId = Optional.of(productionAndroidBuildId.get()); + } + return this; + } + + /** + *

The app build (abld_ tag) to serve as the iOS production build, or null to unassign it. Same rules as production_web_build_id.

+ */ + @JsonSetter(value = "production_ios_build_id", nulls = Nulls.SKIP) + public Builder productionIosBuildId(Optional productionIosBuildId) { + this.productionIosBuildId = productionIosBuildId; + return this; + } + + public Builder productionIosBuildId(String productionIosBuildId) { + this.productionIosBuildId = Optional.ofNullable(productionIosBuildId); + return this; + } + + public Builder productionIosBuildId(Nullable productionIosBuildId) { + if (productionIosBuildId.isNull()) { + this.productionIosBuildId = null; + } else if (productionIosBuildId.isEmpty()) { + this.productionIosBuildId = Optional.empty(); + } else { + this.productionIosBuildId = Optional.of(productionIosBuildId.get()); + } + return this; + } + + /** + *

The app build (abld_ tag) to serve as the web production build, or null to unassign it. The build must belong to this app, target web, and be in the draft or approved status; a draft build is queued for approval and takes over once approved. Requires the developer:manage_builds scope.

+ */ + @JsonSetter(value = "production_web_build_id", nulls = Nulls.SKIP) + public Builder productionWebBuildId(Optional productionWebBuildId) { + this.productionWebBuildId = productionWebBuildId; + return this; + } + + public Builder productionWebBuildId(String productionWebBuildId) { + this.productionWebBuildId = Optional.ofNullable(productionWebBuildId); + return this; + } + + public Builder productionWebBuildId(Nullable productionWebBuildId) { + if (productionWebBuildId.isNull()) { + this.productionWebBuildId = null; + } else if (productionWebBuildId.isEmpty()) { + this.productionWebBuildId = Optional.empty(); + } else { + this.productionWebBuildId = Optional.of(productionWebBuildId.get()); + } + return this; + } + + /** + *

The whitelisted OAuth callback URLs users are redirected to after authorizing the app.

+ */ + @JsonSetter(value = "redirect_uris", nulls = Nulls.SKIP) + public Builder redirectUris(Optional> redirectUris) { + this.redirectUris = redirectUris; + return this; + } + + public Builder redirectUris(List redirectUris) { + this.redirectUris = Optional.ofNullable(redirectUris); + return this; + } + + /** + *

The OAuth scopes the app requests from users when they install it.

+ */ + @JsonSetter(value = "required_scopes", nulls = Nulls.SKIP) + public Builder requiredScopes(Optional> requiredScopes) { + this.requiredScopes = requiredScopes; + return this; + } + + public Builder requiredScopes(List requiredScopes) { + this.requiredScopes = Optional.ofNullable(requiredScopes); + return this; + } + + /** + *

The subdomain route where the app's hosted web builds are served.

+ */ + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public Builder route(Optional route) { + this.route = route; + return this; + } + + public Builder route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Secrets to add or overwrite on the app, as an object of string values. Keys not included are left untouched; pass null or an empty string as the value to delete a secret. Encrypted at rest and injected into the app's hosted server runtime.

+ */ + @JsonSetter(value = "secrets", nulls = Nulls.SKIP) + public Builder secrets(Optional> secrets) { + this.secrets = secrets; + return this; + } + + public Builder secrets(Map secrets) { + this.secrets = Optional.ofNullable(secrets); + return this; + } + + /** + *

The URL path to the app's skills directory (requires the ai_chat capability).

+ */ + @JsonSetter(value = "skills_path", nulls = Nulls.SKIP) + public Builder skillsPath(Optional skillsPath) { + this.skillsPath = skillsPath; + return this; + } + + public Builder skillsPath(String skillsPath) { + this.skillsPath = Optional.ofNullable(skillsPath); + return this; + } + + public Builder skillsPath(Nullable skillsPath) { + if (skillsPath.isNull()) { + this.skillsPath = null; + } else if (skillsPath.isEmpty()) { + this.skillsPath = Optional.empty(); + } else { + this.skillsPath = Optional.of(skillsPath.get()); + } + return this; + } + + /** + *

Controls whether the app is published on Whop discovery or accessible only through its direct link. Publishing requires a name, icon, and description.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(UpdateAppsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public UpdateAppsRequest build() { + return new UpdateAppsRequest( + appStoreDescription, + appType, + baseUrl, + dashboardPath, + description, + discoverPath, + experiencePath, + icon, + name, + oauthClientType, + openapiPath, + productionAndroidBuildId, + productionIosBuildId, + productionWebBuildId, + redirectUris, + requiredScopes, + route, + secrets, + skillsPath, + status, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/requests/UpdatePermissionsAppRequest.java b/src/main/java/com/whop/api/resources/apps/requests/UpdatePermissionsAppRequest.java new file mode 100644 index 00000000..c26f2125 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/requests/UpdatePermissionsAppRequest.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.apps.types.UpdatePermissionsAppRequestRequestedPermissionsItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePermissionsAppRequest.Builder.class) +public final class UpdatePermissionsAppRequest { + private final List requestedPermissions; + + private final Map additionalProperties; + + private UpdatePermissionsAppRequest( + List requestedPermissions, + Map additionalProperties) { + this.requestedPermissions = requestedPermissions; + this.additionalProperties = additionalProperties; + } + + /** + * @return The permissions that the app will request off of users when a user installs the app. + */ + @JsonProperty("requested_permissions") + public List getRequestedPermissions() { + return requestedPermissions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePermissionsAppRequest && equalTo((UpdatePermissionsAppRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePermissionsAppRequest other) { + return requestedPermissions.equals(other.requestedPermissions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.requestedPermissions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List requestedPermissions = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdatePermissionsAppRequest other) { + requestedPermissions(other.getRequestedPermissions()); + return this; + } + + /** + *

The permissions that the app will request off of users when a user installs the app.

+ */ + @JsonSetter(value = "requested_permissions", nulls = Nulls.SKIP) + public Builder requestedPermissions( + List requestedPermissions) { + this.requestedPermissions.clear(); + if (requestedPermissions != null) { + this.requestedPermissions.addAll(requestedPermissions); + } + return this; + } + + public Builder addRequestedPermissions( + UpdatePermissionsAppRequestRequestedPermissionsItem requestedPermissions) { + this.requestedPermissions.add(requestedPermissions); + return this; + } + + public Builder addAllRequestedPermissions( + List requestedPermissions) { + if (requestedPermissions != null) { + this.requestedPermissions.addAll(requestedPermissions); + } + return this; + } + + public UpdatePermissionsAppRequest build() { + return new UpdatePermissionsAppRequest(requestedPermissions, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/requests/UpdatePermissionsAppsRequest.java b/src/main/java/com/whop/api/resources/apps/requests/UpdatePermissionsAppsRequest.java new file mode 100644 index 00000000..c51a6286 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/requests/UpdatePermissionsAppsRequest.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.apps.types.UpdatePermissionsAppsRequestRequestedPermissionsItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePermissionsAppsRequest.Builder.class) +public final class UpdatePermissionsAppsRequest { + private final List requestedPermissions; + + private final Map additionalProperties; + + private UpdatePermissionsAppsRequest( + List requestedPermissions, + Map additionalProperties) { + this.requestedPermissions = requestedPermissions; + this.additionalProperties = additionalProperties; + } + + /** + * @return The full set of permissions the app requests on install; permissions not listed are removed. + */ + @JsonProperty("requested_permissions") + public List getRequestedPermissions() { + return requestedPermissions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePermissionsAppsRequest && equalTo((UpdatePermissionsAppsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePermissionsAppsRequest other) { + return requestedPermissions.equals(other.requestedPermissions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.requestedPermissions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List requestedPermissions = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdatePermissionsAppsRequest other) { + requestedPermissions(other.getRequestedPermissions()); + return this; + } + + /** + *

The full set of permissions the app requests on install; permissions not listed are removed.

+ */ + @JsonSetter(value = "requested_permissions", nulls = Nulls.SKIP) + public Builder requestedPermissions( + List requestedPermissions) { + this.requestedPermissions.clear(); + if (requestedPermissions != null) { + this.requestedPermissions.addAll(requestedPermissions); + } + return this; + } + + public Builder addRequestedPermissions( + UpdatePermissionsAppsRequestRequestedPermissionsItem requestedPermissions) { + this.requestedPermissions.add(requestedPermissions); + return this; + } + + public Builder addAllRequestedPermissions( + List requestedPermissions) { + if (requestedPermissions != null) { + this.requestedPermissions.addAll(requestedPermissions); + } + return this; + } + + public UpdatePermissionsAppsRequest build() { + return new UpdatePermissionsAppsRequest(requestedPermissions, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/CreateAppsRequestAppType.java b/src/main/java/com/whop/api/resources/apps/types/CreateAppsRequestAppType.java new file mode 100644 index 00000000..6a729eb9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/CreateAppsRequestAppType.java @@ -0,0 +1,115 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAppsRequestAppType { + public static final CreateAppsRequestAppType COMPONENT = new CreateAppsRequestAppType(Value.COMPONENT, "component"); + + public static final CreateAppsRequestAppType WEBSITE = new CreateAppsRequestAppType(Value.WEBSITE, "website"); + + public static final CreateAppsRequestAppType B2B_APP = new CreateAppsRequestAppType(Value.B2B_APP, "b2b_app"); + + public static final CreateAppsRequestAppType B2C_APP = new CreateAppsRequestAppType(Value.B2C_APP, "b2c_app"); + + public static final CreateAppsRequestAppType COMPANY_APP = + new CreateAppsRequestAppType(Value.COMPANY_APP, "company_app"); + + private final Value value; + + private final String string; + + CreateAppsRequestAppType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAppsRequestAppType + && this.string.equals(((CreateAppsRequestAppType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case COMPONENT: + return visitor.visitComponent(); + case WEBSITE: + return visitor.visitWebsite(); + case B2B_APP: + return visitor.visitB2BApp(); + case B2C_APP: + return visitor.visitB2CApp(); + case COMPANY_APP: + return visitor.visitCompanyApp(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAppsRequestAppType valueOf(String value) { + switch (value) { + case "component": + return COMPONENT; + case "website": + return WEBSITE; + case "b2b_app": + return B2B_APP; + case "b2c_app": + return B2C_APP; + case "company_app": + return COMPANY_APP; + default: + return new CreateAppsRequestAppType(Value.UNKNOWN, value); + } + } + + public enum Value { + B2B_APP, + + B2C_APP, + + COMPANY_APP, + + COMPONENT, + + WEBSITE, + + UNKNOWN + } + + public interface Visitor { + T visitB2BApp(); + + T visitB2CApp(); + + T visitCompanyApp(); + + T visitComponent(); + + T visitWebsite(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/CreateAppsRequestIcon.java b/src/main/java/com/whop/api/resources/apps/types/CreateAppsRequestIcon.java new file mode 100644 index 00000000..7aeab35e --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/CreateAppsRequestIcon.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAppsRequestIcon.Builder.class) +public final class CreateAppsRequestIcon { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private CreateAppsRequestIcon( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The signed id of a completed direct upload. + */ + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + /** + * @return The tag of an already-uploaded attachment. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAppsRequestIcon && equalTo((CreateAppsRequestIcon) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAppsRequestIcon other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAppsRequestIcon other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + /** + *

The signed id of a completed direct upload.

+ */ + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + /** + *

The tag of an already-uploaded attachment.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public CreateAppsRequestIcon build() { + return new CreateAppsRequestIcon(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/DeleteAppsResponse.java b/src/main/java/com/whop/api/resources/apps/types/DeleteAppsResponse.java new file mode 100644 index 00000000..db2000df --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/DeleteAppsResponse.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteAppsResponse.Builder.class) +public final class DeleteAppsResponse { + private final boolean deleted; + + private final String id; + + private final Map additionalProperties; + + private DeleteAppsResponse(boolean deleted, String id, Map additionalProperties) { + this.deleted = deleted; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Always true. + */ + @JsonProperty("deleted") + public boolean getDeleted() { + return deleted; + } + + /** + * @return ID of the deleted app. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteAppsResponse && equalTo((DeleteAppsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteAppsResponse other) { + return deleted == other.deleted && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deleted, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeletedStage builder() { + return new Builder(); + } + + public interface DeletedStage { + /** + *

Always true.

+ */ + IdStage deleted(boolean deleted); + + Builder from(DeleteAppsResponse other); + } + + public interface IdStage { + /** + *

ID of the deleted app.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DeleteAppsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeletedStage, IdStage, _FinalStage { + private boolean deleted; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeleteAppsResponse other) { + deleted(other.getDeleted()); + id(other.getId()); + return this; + } + + /** + *

Always true.

+ *

Always true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("deleted") + public IdStage deleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + *

ID of the deleted app.

+ *

ID of the deleted app.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DeleteAppsResponse build() { + return new DeleteAppsResponse(deleted, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/ListAppsRequestAppType.java b/src/main/java/com/whop/api/resources/apps/types/ListAppsRequestAppType.java new file mode 100644 index 00000000..4ee6ebb1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/ListAppsRequestAppType.java @@ -0,0 +1,115 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAppsRequestAppType { + public static final ListAppsRequestAppType COMPONENT = new ListAppsRequestAppType(Value.COMPONENT, "component"); + + public static final ListAppsRequestAppType WEBSITE = new ListAppsRequestAppType(Value.WEBSITE, "website"); + + public static final ListAppsRequestAppType B2B_APP = new ListAppsRequestAppType(Value.B2B_APP, "b2b_app"); + + public static final ListAppsRequestAppType B2C_APP = new ListAppsRequestAppType(Value.B2C_APP, "b2c_app"); + + public static final ListAppsRequestAppType COMPANY_APP = + new ListAppsRequestAppType(Value.COMPANY_APP, "company_app"); + + private final Value value; + + private final String string; + + ListAppsRequestAppType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAppsRequestAppType + && this.string.equals(((ListAppsRequestAppType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case COMPONENT: + return visitor.visitComponent(); + case WEBSITE: + return visitor.visitWebsite(); + case B2B_APP: + return visitor.visitB2BApp(); + case B2C_APP: + return visitor.visitB2CApp(); + case COMPANY_APP: + return visitor.visitCompanyApp(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAppsRequestAppType valueOf(String value) { + switch (value) { + case "component": + return COMPONENT; + case "website": + return WEBSITE; + case "b2b_app": + return B2B_APP; + case "b2c_app": + return B2C_APP; + case "company_app": + return COMPANY_APP; + default: + return new ListAppsRequestAppType(Value.UNKNOWN, value); + } + } + + public enum Value { + B2B_APP, + + B2C_APP, + + COMPANY_APP, + + COMPONENT, + + WEBSITE, + + UNKNOWN + } + + public interface Visitor { + T visitB2BApp(); + + T visitB2CApp(); + + T visitCompanyApp(); + + T visitComponent(); + + T visitWebsite(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/ListAppsRequestDirection.java b/src/main/java/com/whop/api/resources/apps/types/ListAppsRequestDirection.java new file mode 100644 index 00000000..2284eb97 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/ListAppsRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAppsRequestDirection { + public static final ListAppsRequestDirection ASC = new ListAppsRequestDirection(Value.ASC, "asc"); + + public static final ListAppsRequestDirection DESC = new ListAppsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListAppsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAppsRequestDirection + && this.string.equals(((ListAppsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAppsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListAppsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/ListAppsRequestOrder.java b/src/main/java/com/whop/api/resources/apps/types/ListAppsRequestOrder.java new file mode 100644 index 00000000..49102de3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/ListAppsRequestOrder.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAppsRequestOrder { + public static final ListAppsRequestOrder CREATED_AT = new ListAppsRequestOrder(Value.CREATED_AT, "created_at"); + + public static final ListAppsRequestOrder TEMPLATE_USAGE = + new ListAppsRequestOrder(Value.TEMPLATE_USAGE, "template_usage"); + + public static final ListAppsRequestOrder TOTAL_INSTALLS_LAST7DAYS = + new ListAppsRequestOrder(Value.TOTAL_INSTALLS_LAST7DAYS, "total_installs_last_7_days"); + + public static final ListAppsRequestOrder DISCOVERABLE_AT = + new ListAppsRequestOrder(Value.DISCOVERABLE_AT, "discoverable_at"); + + public static final ListAppsRequestOrder TOTAL_INSTALLS_LAST30DAYS = + new ListAppsRequestOrder(Value.TOTAL_INSTALLS_LAST30DAYS, "total_installs_last_30_days"); + + private final Value value; + + private final String string; + + ListAppsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAppsRequestOrder && this.string.equals(((ListAppsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case TEMPLATE_USAGE: + return visitor.visitTemplateUsage(); + case TOTAL_INSTALLS_LAST7DAYS: + return visitor.visitTotalInstallsLast7Days(); + case DISCOVERABLE_AT: + return visitor.visitDiscoverableAt(); + case TOTAL_INSTALLS_LAST30DAYS: + return visitor.visitTotalInstallsLast30Days(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAppsRequestOrder valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + case "template_usage": + return TEMPLATE_USAGE; + case "total_installs_last_7_days": + return TOTAL_INSTALLS_LAST7DAYS; + case "discoverable_at": + return DISCOVERABLE_AT; + case "total_installs_last_30_days": + return TOTAL_INSTALLS_LAST30DAYS; + default: + return new ListAppsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + DISCOVERABLE_AT, + + TEMPLATE_USAGE, + + TOTAL_INSTALLS_LAST30DAYS, + + TOTAL_INSTALLS_LAST7DAYS, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitDiscoverableAt(); + + T visitTemplateUsage(); + + T visitTotalInstallsLast30Days(); + + T visitTotalInstallsLast7Days(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/ListAppsRequestViewType.java b/src/main/java/com/whop/api/resources/apps/types/ListAppsRequestViewType.java new file mode 100644 index 00000000..6c242cbe --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/ListAppsRequestViewType.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAppsRequestViewType { + public static final ListAppsRequestViewType DASHBOARD = new ListAppsRequestViewType(Value.DASHBOARD, "dashboard"); + + public static final ListAppsRequestViewType OPENAPI = new ListAppsRequestViewType(Value.OPENAPI, "openapi"); + + public static final ListAppsRequestViewType SKILLS = new ListAppsRequestViewType(Value.SKILLS, "skills"); + + public static final ListAppsRequestViewType ANALYTICS = new ListAppsRequestViewType(Value.ANALYTICS, "analytics"); + + public static final ListAppsRequestViewType DISCOVER = new ListAppsRequestViewType(Value.DISCOVER, "discover"); + + public static final ListAppsRequestViewType DASH = new ListAppsRequestViewType(Value.DASH, "dash"); + + public static final ListAppsRequestViewType HUB = new ListAppsRequestViewType(Value.HUB, "hub"); + + private final Value value; + + private final String string; + + ListAppsRequestViewType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAppsRequestViewType + && this.string.equals(((ListAppsRequestViewType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DASHBOARD: + return visitor.visitDashboard(); + case OPENAPI: + return visitor.visitOpenapi(); + case SKILLS: + return visitor.visitSkills(); + case ANALYTICS: + return visitor.visitAnalytics(); + case DISCOVER: + return visitor.visitDiscover(); + case DASH: + return visitor.visitDash(); + case HUB: + return visitor.visitHub(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAppsRequestViewType valueOf(String value) { + switch (value) { + case "dashboard": + return DASHBOARD; + case "openapi": + return OPENAPI; + case "skills": + return SKILLS; + case "analytics": + return ANALYTICS; + case "discover": + return DISCOVER; + case "dash": + return DASH; + case "hub": + return HUB; + default: + return new ListAppsRequestViewType(Value.UNKNOWN, value); + } + } + + public enum Value { + HUB, + + DISCOVER, + + DASH, + + DASHBOARD, + + ANALYTICS, + + SKILLS, + + OPENAPI, + + UNKNOWN + } + + public interface Visitor { + T visitHub(); + + T visitDiscover(); + + T visitDash(); + + T visitDashboard(); + + T visitAnalytics(); + + T visitSkills(); + + T visitOpenapi(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/ListAppsResponse.java b/src/main/java/com/whop/api/resources/apps/types/ListAppsResponse.java new file mode 100644 index 00000000..dceefbf7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/ListAppsResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AppListItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAppsResponse.Builder.class) +public final class ListAppsResponse { + private final List data; + + private final ListAppsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListAppsResponse( + List data, ListAppsResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListAppsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAppsResponse && equalTo((ListAppsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAppsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListAppsResponsePageInfo pageInfo); + + Builder from(ListAppsResponse other); + } + + public interface _FinalStage { + ListAppsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(AppListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListAppsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAppsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListAppsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(AppListItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListAppsResponse build() { + return new ListAppsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/ListAppsResponsePageInfo.java b/src/main/java/com/whop/api/resources/apps/types/ListAppsResponsePageInfo.java new file mode 100644 index 00000000..662f6cfb --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/ListAppsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAppsResponsePageInfo.Builder.class) +public final class ListAppsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListAppsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAppsResponsePageInfo && equalTo((ListAppsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAppsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListAppsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListAppsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAppsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListAppsResponsePageInfo build() { + return new ListAppsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/LogsAppsRequestLevel.java b/src/main/java/com/whop/api/resources/apps/types/LogsAppsRequestLevel.java new file mode 100644 index 00000000..aa394e77 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/LogsAppsRequestLevel.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LogsAppsRequestLevel { + public static final LogsAppsRequestLevel WARN = new LogsAppsRequestLevel(Value.WARN, "warn"); + + public static final LogsAppsRequestLevel INFO = new LogsAppsRequestLevel(Value.INFO, "info"); + + public static final LogsAppsRequestLevel LOG = new LogsAppsRequestLevel(Value.LOG, "log"); + + public static final LogsAppsRequestLevel DEBUG = new LogsAppsRequestLevel(Value.DEBUG, "debug"); + + public static final LogsAppsRequestLevel ERROR = new LogsAppsRequestLevel(Value.ERROR, "error"); + + private final Value value; + + private final String string; + + LogsAppsRequestLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LogsAppsRequestLevel && this.string.equals(((LogsAppsRequestLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WARN: + return visitor.visitWarn(); + case INFO: + return visitor.visitInfo(); + case LOG: + return visitor.visitLog(); + case DEBUG: + return visitor.visitDebug(); + case ERROR: + return visitor.visitError(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LogsAppsRequestLevel valueOf(String value) { + switch (value) { + case "warn": + return WARN; + case "info": + return INFO; + case "log": + return LOG; + case "debug": + return DEBUG; + case "error": + return ERROR; + default: + return new LogsAppsRequestLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + LOG, + + DEBUG, + + INFO, + + WARN, + + ERROR, + + UNKNOWN + } + + public interface Visitor { + T visitLog(); + + T visitDebug(); + + T visitInfo(); + + T visitWarn(); + + T visitError(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/LogsAppsResponse.java b/src/main/java/com/whop/api/resources/apps/types/LogsAppsResponse.java new file mode 100644 index 00000000..64de35c3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/LogsAppsResponse.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LogsAppsResponse.Builder.class) +public final class LogsAppsResponse { + private final List data; + + private final LogsAppsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private LogsAppsResponse( + List data, + LogsAppsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public LogsAppsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LogsAppsResponse && equalTo((LogsAppsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LogsAppsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull LogsAppsResponsePageInfo pageInfo); + + Builder from(LogsAppsResponse other); + } + + public interface _FinalStage { + LogsAppsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(LogsAppsResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private LogsAppsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LogsAppsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull LogsAppsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(LogsAppsResponseDataItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public LogsAppsResponse build() { + return new LogsAppsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/LogsAppsResponseDataItem.java b/src/main/java/com/whop/api/resources/apps/types/LogsAppsResponseDataItem.java new file mode 100644 index 00000000..83e43c93 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/LogsAppsResponseDataItem.java @@ -0,0 +1,664 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LogsAppsResponseDataItem.Builder.class) +public final class LogsAppsResponseDataItem { + private final String appBuildId; + + private final String appId; + + private final Optional cpuTimeMs; + + private final OffsetDateTime createdAt; + + private final LogsAppsResponseDataItemLevel level; + + private final String message; + + private final Optional outcome; + + private final String requestId; + + private final Optional requestMethod; + + private final Optional requestPath; + + private final Optional responseStatus; + + private final LogsAppsResponseDataItemSource source; + + private final Optional stack; + + private final Optional truncated; + + private final Optional wallTimeMs; + + private final Map additionalProperties; + + private LogsAppsResponseDataItem( + String appBuildId, + String appId, + Optional cpuTimeMs, + OffsetDateTime createdAt, + LogsAppsResponseDataItemLevel level, + String message, + Optional outcome, + String requestId, + Optional requestMethod, + Optional requestPath, + Optional responseStatus, + LogsAppsResponseDataItemSource source, + Optional stack, + Optional truncated, + Optional wallTimeMs, + Map additionalProperties) { + this.appBuildId = appBuildId; + this.appId = appId; + this.cpuTimeMs = cpuTimeMs; + this.createdAt = createdAt; + this.level = level; + this.message = message; + this.outcome = outcome; + this.requestId = requestId; + this.requestMethod = requestMethod; + this.requestPath = requestPath; + this.responseStatus = responseStatus; + this.source = source; + this.stack = stack; + this.truncated = truncated; + this.wallTimeMs = wallTimeMs; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("app_build_id") + public String getAppBuildId() { + return appBuildId; + } + + @JsonProperty("app_id") + public String getAppId() { + return appId; + } + + @JsonProperty("cpu_time_ms") + public Optional getCpuTimeMs() { + return cpuTimeMs; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("level") + public LogsAppsResponseDataItemLevel getLevel() { + return level; + } + + @JsonProperty("message") + public String getMessage() { + return message; + } + + @JsonIgnore + public Optional getOutcome() { + if (outcome == null) { + return Optional.empty(); + } + return outcome; + } + + @JsonProperty("request_id") + public String getRequestId() { + return requestId; + } + + @JsonIgnore + public Optional getRequestMethod() { + if (requestMethod == null) { + return Optional.empty(); + } + return requestMethod; + } + + @JsonIgnore + public Optional getRequestPath() { + if (requestPath == null) { + return Optional.empty(); + } + return requestPath; + } + + @JsonIgnore + public Optional getResponseStatus() { + if (responseStatus == null) { + return Optional.empty(); + } + return responseStatus; + } + + @JsonProperty("source") + public LogsAppsResponseDataItemSource getSource() { + return source; + } + + @JsonIgnore + public Optional getStack() { + if (stack == null) { + return Optional.empty(); + } + return stack; + } + + @JsonProperty("truncated") + public Optional getTruncated() { + return truncated; + } + + @JsonProperty("wall_time_ms") + public Optional getWallTimeMs() { + return wallTimeMs; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("outcome") + private Optional _getOutcome() { + return outcome; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("request_method") + private Optional _getRequestMethod() { + return requestMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("request_path") + private Optional _getRequestPath() { + return requestPath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("response_status") + private Optional _getResponseStatus() { + return responseStatus; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("stack") + private Optional _getStack() { + return stack; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LogsAppsResponseDataItem && equalTo((LogsAppsResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LogsAppsResponseDataItem other) { + return appBuildId.equals(other.appBuildId) + && appId.equals(other.appId) + && cpuTimeMs.equals(other.cpuTimeMs) + && createdAt.equals(other.createdAt) + && level.equals(other.level) + && message.equals(other.message) + && outcome.equals(other.outcome) + && requestId.equals(other.requestId) + && requestMethod.equals(other.requestMethod) + && requestPath.equals(other.requestPath) + && responseStatus.equals(other.responseStatus) + && source.equals(other.source) + && stack.equals(other.stack) + && truncated.equals(other.truncated) + && wallTimeMs.equals(other.wallTimeMs); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appBuildId, + this.appId, + this.cpuTimeMs, + this.createdAt, + this.level, + this.message, + this.outcome, + this.requestId, + this.requestMethod, + this.requestPath, + this.responseStatus, + this.source, + this.stack, + this.truncated, + this.wallTimeMs); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppBuildIdStage builder() { + return new Builder(); + } + + public interface AppBuildIdStage { + AppIdStage appBuildId(@NotNull String appBuildId); + + Builder from(LogsAppsResponseDataItem other); + } + + public interface AppIdStage { + CreatedAtStage appId(@NotNull String appId); + } + + public interface CreatedAtStage { + LevelStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface LevelStage { + MessageStage level(@NotNull LogsAppsResponseDataItemLevel level); + } + + public interface MessageStage { + RequestIdStage message(@NotNull String message); + } + + public interface RequestIdStage { + SourceStage requestId(@NotNull String requestId); + } + + public interface SourceStage { + _FinalStage source(@NotNull LogsAppsResponseDataItemSource source); + } + + public interface _FinalStage { + LogsAppsResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage cpuTimeMs(Optional cpuTimeMs); + + _FinalStage cpuTimeMs(Integer cpuTimeMs); + + _FinalStage outcome(Optional outcome); + + _FinalStage outcome(String outcome); + + _FinalStage outcome(Nullable outcome); + + _FinalStage requestMethod(Optional requestMethod); + + _FinalStage requestMethod(String requestMethod); + + _FinalStage requestMethod(Nullable requestMethod); + + _FinalStage requestPath(Optional requestPath); + + _FinalStage requestPath(String requestPath); + + _FinalStage requestPath(Nullable requestPath); + + _FinalStage responseStatus(Optional responseStatus); + + _FinalStage responseStatus(Integer responseStatus); + + _FinalStage responseStatus(Nullable responseStatus); + + _FinalStage stack(Optional stack); + + _FinalStage stack(String stack); + + _FinalStage stack(Nullable stack); + + _FinalStage truncated(Optional truncated); + + _FinalStage truncated(Boolean truncated); + + _FinalStage wallTimeMs(Optional wallTimeMs); + + _FinalStage wallTimeMs(Integer wallTimeMs); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AppBuildIdStage, + AppIdStage, + CreatedAtStage, + LevelStage, + MessageStage, + RequestIdStage, + SourceStage, + _FinalStage { + private String appBuildId; + + private String appId; + + private OffsetDateTime createdAt; + + private LogsAppsResponseDataItemLevel level; + + private String message; + + private String requestId; + + private LogsAppsResponseDataItemSource source; + + private Optional wallTimeMs = Optional.empty(); + + private Optional truncated = Optional.empty(); + + private Optional stack = Optional.empty(); + + private Optional responseStatus = Optional.empty(); + + private Optional requestPath = Optional.empty(); + + private Optional requestMethod = Optional.empty(); + + private Optional outcome = Optional.empty(); + + private Optional cpuTimeMs = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LogsAppsResponseDataItem other) { + appBuildId(other.getAppBuildId()); + appId(other.getAppId()); + cpuTimeMs(other.getCpuTimeMs()); + createdAt(other.getCreatedAt()); + level(other.getLevel()); + message(other.getMessage()); + outcome(other.getOutcome()); + requestId(other.getRequestId()); + requestMethod(other.getRequestMethod()); + requestPath(other.getRequestPath()); + responseStatus(other.getResponseStatus()); + source(other.getSource()); + stack(other.getStack()); + truncated(other.getTruncated()); + wallTimeMs(other.getWallTimeMs()); + return this; + } + + @java.lang.Override + @JsonSetter("app_build_id") + public AppIdStage appBuildId(@NotNull String appBuildId) { + this.appBuildId = Objects.requireNonNull(appBuildId, "appBuildId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("app_id") + public CreatedAtStage appId(@NotNull String appId) { + this.appId = Objects.requireNonNull(appId, "appId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public LevelStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("level") + public MessageStage level(@NotNull LogsAppsResponseDataItemLevel level) { + this.level = Objects.requireNonNull(level, "level must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("message") + public RequestIdStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("request_id") + public SourceStage requestId(@NotNull String requestId) { + this.requestId = Objects.requireNonNull(requestId, "requestId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("source") + public _FinalStage source(@NotNull LogsAppsResponseDataItemSource source) { + this.source = Objects.requireNonNull(source, "source must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage wallTimeMs(Integer wallTimeMs) { + this.wallTimeMs = Optional.ofNullable(wallTimeMs); + return this; + } + + @java.lang.Override + @JsonSetter(value = "wall_time_ms", nulls = Nulls.SKIP) + public _FinalStage wallTimeMs(Optional wallTimeMs) { + this.wallTimeMs = wallTimeMs; + return this; + } + + @java.lang.Override + public _FinalStage truncated(Boolean truncated) { + this.truncated = Optional.ofNullable(truncated); + return this; + } + + @java.lang.Override + @JsonSetter(value = "truncated", nulls = Nulls.SKIP) + public _FinalStage truncated(Optional truncated) { + this.truncated = truncated; + return this; + } + + @java.lang.Override + public _FinalStage stack(Nullable stack) { + if (stack.isNull()) { + this.stack = null; + } else if (stack.isEmpty()) { + this.stack = Optional.empty(); + } else { + this.stack = Optional.of(stack.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage stack(String stack) { + this.stack = Optional.ofNullable(stack); + return this; + } + + @java.lang.Override + @JsonSetter(value = "stack", nulls = Nulls.SKIP) + public _FinalStage stack(Optional stack) { + this.stack = stack; + return this; + } + + @java.lang.Override + public _FinalStage responseStatus(Nullable responseStatus) { + if (responseStatus.isNull()) { + this.responseStatus = null; + } else if (responseStatus.isEmpty()) { + this.responseStatus = Optional.empty(); + } else { + this.responseStatus = Optional.of(responseStatus.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage responseStatus(Integer responseStatus) { + this.responseStatus = Optional.ofNullable(responseStatus); + return this; + } + + @java.lang.Override + @JsonSetter(value = "response_status", nulls = Nulls.SKIP) + public _FinalStage responseStatus(Optional responseStatus) { + this.responseStatus = responseStatus; + return this; + } + + @java.lang.Override + public _FinalStage requestPath(Nullable requestPath) { + if (requestPath.isNull()) { + this.requestPath = null; + } else if (requestPath.isEmpty()) { + this.requestPath = Optional.empty(); + } else { + this.requestPath = Optional.of(requestPath.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage requestPath(String requestPath) { + this.requestPath = Optional.ofNullable(requestPath); + return this; + } + + @java.lang.Override + @JsonSetter(value = "request_path", nulls = Nulls.SKIP) + public _FinalStage requestPath(Optional requestPath) { + this.requestPath = requestPath; + return this; + } + + @java.lang.Override + public _FinalStage requestMethod(Nullable requestMethod) { + if (requestMethod.isNull()) { + this.requestMethod = null; + } else if (requestMethod.isEmpty()) { + this.requestMethod = Optional.empty(); + } else { + this.requestMethod = Optional.of(requestMethod.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage requestMethod(String requestMethod) { + this.requestMethod = Optional.ofNullable(requestMethod); + return this; + } + + @java.lang.Override + @JsonSetter(value = "request_method", nulls = Nulls.SKIP) + public _FinalStage requestMethod(Optional requestMethod) { + this.requestMethod = requestMethod; + return this; + } + + @java.lang.Override + public _FinalStage outcome(Nullable outcome) { + if (outcome.isNull()) { + this.outcome = null; + } else if (outcome.isEmpty()) { + this.outcome = Optional.empty(); + } else { + this.outcome = Optional.of(outcome.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage outcome(String outcome) { + this.outcome = Optional.ofNullable(outcome); + return this; + } + + @java.lang.Override + @JsonSetter(value = "outcome", nulls = Nulls.SKIP) + public _FinalStage outcome(Optional outcome) { + this.outcome = outcome; + return this; + } + + @java.lang.Override + public _FinalStage cpuTimeMs(Integer cpuTimeMs) { + this.cpuTimeMs = Optional.ofNullable(cpuTimeMs); + return this; + } + + @java.lang.Override + @JsonSetter(value = "cpu_time_ms", nulls = Nulls.SKIP) + public _FinalStage cpuTimeMs(Optional cpuTimeMs) { + this.cpuTimeMs = cpuTimeMs; + return this; + } + + @java.lang.Override + public LogsAppsResponseDataItem build() { + return new LogsAppsResponseDataItem( + appBuildId, + appId, + cpuTimeMs, + createdAt, + level, + message, + outcome, + requestId, + requestMethod, + requestPath, + responseStatus, + source, + stack, + truncated, + wallTimeMs, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/LogsAppsResponseDataItemLevel.java b/src/main/java/com/whop/api/resources/apps/types/LogsAppsResponseDataItemLevel.java new file mode 100644 index 00000000..f48bf7e0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/LogsAppsResponseDataItemLevel.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LogsAppsResponseDataItemLevel { + public static final LogsAppsResponseDataItemLevel WARN = new LogsAppsResponseDataItemLevel(Value.WARN, "warn"); + + public static final LogsAppsResponseDataItemLevel INFO = new LogsAppsResponseDataItemLevel(Value.INFO, "info"); + + public static final LogsAppsResponseDataItemLevel LOG = new LogsAppsResponseDataItemLevel(Value.LOG, "log"); + + public static final LogsAppsResponseDataItemLevel DEBUG = new LogsAppsResponseDataItemLevel(Value.DEBUG, "debug"); + + public static final LogsAppsResponseDataItemLevel ERROR = new LogsAppsResponseDataItemLevel(Value.ERROR, "error"); + + private final Value value; + + private final String string; + + LogsAppsResponseDataItemLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LogsAppsResponseDataItemLevel + && this.string.equals(((LogsAppsResponseDataItemLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WARN: + return visitor.visitWarn(); + case INFO: + return visitor.visitInfo(); + case LOG: + return visitor.visitLog(); + case DEBUG: + return visitor.visitDebug(); + case ERROR: + return visitor.visitError(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LogsAppsResponseDataItemLevel valueOf(String value) { + switch (value) { + case "warn": + return WARN; + case "info": + return INFO; + case "log": + return LOG; + case "debug": + return DEBUG; + case "error": + return ERROR; + default: + return new LogsAppsResponseDataItemLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + LOG, + + DEBUG, + + INFO, + + WARN, + + ERROR, + + UNKNOWN + } + + public interface Visitor { + T visitLog(); + + T visitDebug(); + + T visitInfo(); + + T visitWarn(); + + T visitError(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/LogsAppsResponseDataItemSource.java b/src/main/java/com/whop/api/resources/apps/types/LogsAppsResponseDataItemSource.java new file mode 100644 index 00000000..cf73c8e7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/LogsAppsResponseDataItemSource.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LogsAppsResponseDataItemSource { + public static final LogsAppsResponseDataItemSource CONSOLE = + new LogsAppsResponseDataItemSource(Value.CONSOLE, "console"); + + public static final LogsAppsResponseDataItemSource EXCEPTION = + new LogsAppsResponseDataItemSource(Value.EXCEPTION, "exception"); + + public static final LogsAppsResponseDataItemSource REQUEST = + new LogsAppsResponseDataItemSource(Value.REQUEST, "request"); + + private final Value value; + + private final String string; + + LogsAppsResponseDataItemSource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LogsAppsResponseDataItemSource + && this.string.equals(((LogsAppsResponseDataItemSource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CONSOLE: + return visitor.visitConsole(); + case EXCEPTION: + return visitor.visitException(); + case REQUEST: + return visitor.visitRequest(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LogsAppsResponseDataItemSource valueOf(String value) { + switch (value) { + case "console": + return CONSOLE; + case "exception": + return EXCEPTION; + case "request": + return REQUEST; + default: + return new LogsAppsResponseDataItemSource(Value.UNKNOWN, value); + } + } + + public enum Value { + CONSOLE, + + EXCEPTION, + + REQUEST, + + UNKNOWN + } + + public interface Visitor { + T visitConsole(); + + T visitException(); + + T visitRequest(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/LogsAppsResponsePageInfo.java b/src/main/java/com/whop/api/resources/apps/types/LogsAppsResponsePageInfo.java new file mode 100644 index 00000000..d9473859 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/LogsAppsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LogsAppsResponsePageInfo.Builder.class) +public final class LogsAppsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private LogsAppsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LogsAppsResponsePageInfo && equalTo((LogsAppsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LogsAppsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(LogsAppsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + LogsAppsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LogsAppsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public LogsAppsResponsePageInfo build() { + return new LogsAppsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/UpdateAppsRequestAppType.java b/src/main/java/com/whop/api/resources/apps/types/UpdateAppsRequestAppType.java new file mode 100644 index 00000000..0c530d26 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/UpdateAppsRequestAppType.java @@ -0,0 +1,115 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAppsRequestAppType { + public static final UpdateAppsRequestAppType COMPONENT = new UpdateAppsRequestAppType(Value.COMPONENT, "component"); + + public static final UpdateAppsRequestAppType WEBSITE = new UpdateAppsRequestAppType(Value.WEBSITE, "website"); + + public static final UpdateAppsRequestAppType B2B_APP = new UpdateAppsRequestAppType(Value.B2B_APP, "b2b_app"); + + public static final UpdateAppsRequestAppType B2C_APP = new UpdateAppsRequestAppType(Value.B2C_APP, "b2c_app"); + + public static final UpdateAppsRequestAppType COMPANY_APP = + new UpdateAppsRequestAppType(Value.COMPANY_APP, "company_app"); + + private final Value value; + + private final String string; + + UpdateAppsRequestAppType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAppsRequestAppType + && this.string.equals(((UpdateAppsRequestAppType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case COMPONENT: + return visitor.visitComponent(); + case WEBSITE: + return visitor.visitWebsite(); + case B2B_APP: + return visitor.visitB2BApp(); + case B2C_APP: + return visitor.visitB2CApp(); + case COMPANY_APP: + return visitor.visitCompanyApp(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAppsRequestAppType valueOf(String value) { + switch (value) { + case "component": + return COMPONENT; + case "website": + return WEBSITE; + case "b2b_app": + return B2B_APP; + case "b2c_app": + return B2C_APP; + case "company_app": + return COMPANY_APP; + default: + return new UpdateAppsRequestAppType(Value.UNKNOWN, value); + } + } + + public enum Value { + B2B_APP, + + B2C_APP, + + COMPANY_APP, + + COMPONENT, + + WEBSITE, + + UNKNOWN + } + + public interface Visitor { + T visitB2BApp(); + + T visitB2CApp(); + + T visitCompanyApp(); + + T visitComponent(); + + T visitWebsite(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/UpdateAppsRequestIcon.java b/src/main/java/com/whop/api/resources/apps/types/UpdateAppsRequestIcon.java new file mode 100644 index 00000000..a095b681 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/UpdateAppsRequestIcon.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAppsRequestIcon.Builder.class) +public final class UpdateAppsRequestIcon { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private UpdateAppsRequestIcon( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The signed id of a completed direct upload. + */ + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + /** + * @return The tag of an already-uploaded attachment. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAppsRequestIcon && equalTo((UpdateAppsRequestIcon) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAppsRequestIcon other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAppsRequestIcon other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + /** + *

The signed id of a completed direct upload.

+ */ + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + /** + *

The tag of an already-uploaded attachment.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdateAppsRequestIcon build() { + return new UpdateAppsRequestIcon(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/UpdateAppsRequestOauthClientType.java b/src/main/java/com/whop/api/resources/apps/types/UpdateAppsRequestOauthClientType.java new file mode 100644 index 00000000..a484cb34 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/UpdateAppsRequestOauthClientType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAppsRequestOauthClientType { + public static final UpdateAppsRequestOauthClientType PUBLIC = + new UpdateAppsRequestOauthClientType(Value.PUBLIC, "public"); + + public static final UpdateAppsRequestOauthClientType CONFIDENTIAL = + new UpdateAppsRequestOauthClientType(Value.CONFIDENTIAL, "confidential"); + + private final Value value; + + private final String string; + + UpdateAppsRequestOauthClientType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAppsRequestOauthClientType + && this.string.equals(((UpdateAppsRequestOauthClientType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PUBLIC: + return visitor.visitPublic(); + case CONFIDENTIAL: + return visitor.visitConfidential(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAppsRequestOauthClientType valueOf(String value) { + switch (value) { + case "public": + return PUBLIC; + case "confidential": + return CONFIDENTIAL; + default: + return new UpdateAppsRequestOauthClientType(Value.UNKNOWN, value); + } + } + + public enum Value { + PUBLIC, + + CONFIDENTIAL, + + UNKNOWN + } + + public interface Visitor { + T visitPublic(); + + T visitConfidential(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/UpdateAppsRequestStatus.java b/src/main/java/com/whop/api/resources/apps/types/UpdateAppsRequestStatus.java new file mode 100644 index 00000000..b9a770b1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/UpdateAppsRequestStatus.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateAppsRequestStatus { + public static final UpdateAppsRequestStatus LIVE = new UpdateAppsRequestStatus(Value.LIVE, "live"); + + public static final UpdateAppsRequestStatus HIDDEN = new UpdateAppsRequestStatus(Value.HIDDEN, "hidden"); + + public static final UpdateAppsRequestStatus UNLISTED = new UpdateAppsRequestStatus(Value.UNLISTED, "unlisted"); + + private final Value value; + + private final String string; + + UpdateAppsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateAppsRequestStatus + && this.string.equals(((UpdateAppsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LIVE: + return visitor.visitLive(); + case HIDDEN: + return visitor.visitHidden(); + case UNLISTED: + return visitor.visitUnlisted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateAppsRequestStatus valueOf(String value) { + switch (value) { + case "live": + return LIVE; + case "hidden": + return HIDDEN; + case "unlisted": + return UNLISTED; + default: + return new UpdateAppsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + LIVE, + + UNLISTED, + + HIDDEN, + + UNKNOWN + } + + public interface Visitor { + T visitLive(); + + T visitUnlisted(); + + T visitHidden(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/UpdatePermissionsAppRequestRequestedPermissionsItem.java b/src/main/java/com/whop/api/resources/apps/types/UpdatePermissionsAppRequestRequestedPermissionsItem.java new file mode 100644 index 00000000..5b532506 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/UpdatePermissionsAppRequestRequestedPermissionsItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePermissionsAppRequestRequestedPermissionsItem.Builder.class) +public final class UpdatePermissionsAppRequestRequestedPermissionsItem { + private final String action; + + private final boolean isRequired; + + private final String justification; + + private final Map additionalProperties; + + private UpdatePermissionsAppRequestRequestedPermissionsItem( + String action, boolean isRequired, String justification, Map additionalProperties) { + this.action = action; + this.isRequired = isRequired; + this.justification = justification; + this.additionalProperties = additionalProperties; + } + + /** + * @return The action that the app will request off of users when a user installs the app. + */ + @JsonProperty("action") + public String getAction() { + return action; + } + + /** + * @return Whether the action is required for the app to function. + */ + @JsonProperty("is_required") + public boolean getIsRequired() { + return isRequired; + } + + /** + * @return The reason for requesting the action. + */ + @JsonProperty("justification") + public String getJustification() { + return justification; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePermissionsAppRequestRequestedPermissionsItem + && equalTo((UpdatePermissionsAppRequestRequestedPermissionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePermissionsAppRequestRequestedPermissionsItem other) { + return action.equals(other.action) + && isRequired == other.isRequired + && justification.equals(other.justification); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.action, this.isRequired, this.justification); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + /** + *

The action that the app will request off of users when a user installs the app.

+ */ + IsRequiredStage action(@NotNull String action); + + Builder from(UpdatePermissionsAppRequestRequestedPermissionsItem other); + } + + public interface IsRequiredStage { + /** + *

Whether the action is required for the app to function.

+ */ + JustificationStage isRequired(boolean isRequired); + } + + public interface JustificationStage { + /** + *

The reason for requesting the action.

+ */ + _FinalStage justification(@NotNull String justification); + } + + public interface _FinalStage { + UpdatePermissionsAppRequestRequestedPermissionsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ActionStage, IsRequiredStage, JustificationStage, _FinalStage { + private String action; + + private boolean isRequired; + + private String justification; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdatePermissionsAppRequestRequestedPermissionsItem other) { + action(other.getAction()); + isRequired(other.getIsRequired()); + justification(other.getJustification()); + return this; + } + + /** + *

The action that the app will request off of users when a user installs the app.

+ *

The action that the app will request off of users when a user installs the app.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("action") + public IsRequiredStage action(@NotNull String action) { + this.action = Objects.requireNonNull(action, "action must not be null"); + return this; + } + + /** + *

Whether the action is required for the app to function.

+ *

Whether the action is required for the app to function.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_required") + public JustificationStage isRequired(boolean isRequired) { + this.isRequired = isRequired; + return this; + } + + /** + *

The reason for requesting the action.

+ *

The reason for requesting the action.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("justification") + public _FinalStage justification(@NotNull String justification) { + this.justification = Objects.requireNonNull(justification, "justification must not be null"); + return this; + } + + @java.lang.Override + public UpdatePermissionsAppRequestRequestedPermissionsItem build() { + return new UpdatePermissionsAppRequestRequestedPermissionsItem( + action, isRequired, justification, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/apps/types/UpdatePermissionsAppsRequestRequestedPermissionsItem.java b/src/main/java/com/whop/api/resources/apps/types/UpdatePermissionsAppsRequestRequestedPermissionsItem.java new file mode 100644 index 00000000..43ceace6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/apps/types/UpdatePermissionsAppsRequestRequestedPermissionsItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePermissionsAppsRequestRequestedPermissionsItem.Builder.class) +public final class UpdatePermissionsAppsRequestRequestedPermissionsItem { + private final String action; + + private final boolean isRequired; + + private final String justification; + + private final Map additionalProperties; + + private UpdatePermissionsAppsRequestRequestedPermissionsItem( + String action, boolean isRequired, String justification, Map additionalProperties) { + this.action = action; + this.isRequired = isRequired; + this.justification = justification; + this.additionalProperties = additionalProperties; + } + + /** + * @return The permission action, for example company:basic:read. + */ + @JsonProperty("action") + public String getAction() { + return action; + } + + /** + * @return Whether installing the app requires granting this permission. + */ + @JsonProperty("is_required") + public boolean getIsRequired() { + return isRequired; + } + + /** + * @return Why the app needs this permission (20-512 characters), shown to the installing user. + */ + @JsonProperty("justification") + public String getJustification() { + return justification; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePermissionsAppsRequestRequestedPermissionsItem + && equalTo((UpdatePermissionsAppsRequestRequestedPermissionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePermissionsAppsRequestRequestedPermissionsItem other) { + return action.equals(other.action) + && isRequired == other.isRequired + && justification.equals(other.justification); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.action, this.isRequired, this.justification); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + /** + *

The permission action, for example company:basic:read.

+ */ + IsRequiredStage action(@NotNull String action); + + Builder from(UpdatePermissionsAppsRequestRequestedPermissionsItem other); + } + + public interface IsRequiredStage { + /** + *

Whether installing the app requires granting this permission.

+ */ + JustificationStage isRequired(boolean isRequired); + } + + public interface JustificationStage { + /** + *

Why the app needs this permission (20-512 characters), shown to the installing user.

+ */ + _FinalStage justification(@NotNull String justification); + } + + public interface _FinalStage { + UpdatePermissionsAppsRequestRequestedPermissionsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ActionStage, IsRequiredStage, JustificationStage, _FinalStage { + private String action; + + private boolean isRequired; + + private String justification; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdatePermissionsAppsRequestRequestedPermissionsItem other) { + action(other.getAction()); + isRequired(other.getIsRequired()); + justification(other.getJustification()); + return this; + } + + /** + *

The permission action, for example company:basic:read.

+ *

The permission action, for example company:basic:read.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("action") + public IsRequiredStage action(@NotNull String action) { + this.action = Objects.requireNonNull(action, "action must not be null"); + return this; + } + + /** + *

Whether installing the app requires granting this permission.

+ *

Whether installing the app requires granting this permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_required") + public JustificationStage isRequired(boolean isRequired) { + this.isRequired = isRequired; + return this; + } + + /** + *

Why the app needs this permission (20-512 characters), shown to the installing user.

+ *

Why the app needs this permission (20-512 characters), shown to the installing user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("justification") + public _FinalStage justification(@NotNull String justification) { + this.justification = Objects.requireNonNull(justification, "justification must not be null"); + return this; + } + + @java.lang.Override + public UpdatePermissionsAppsRequestRequestedPermissionsItem build() { + return new UpdatePermissionsAppsRequestRequestedPermissionsItem( + action, isRequired, justification, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/AsyncAudiencesClient.java b/src/main/java/com/whop/api/resources/audiences/AsyncAudiencesClient.java new file mode 100644 index 00000000..be260b02 --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/AsyncAudiencesClient.java @@ -0,0 +1,138 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.audiences.requests.AddPeopleAudiencesRequest; +import com.whop.api.resources.audiences.requests.CreateAudiencesRequest; +import com.whop.api.resources.audiences.requests.DeleteAudiencesRequest; +import com.whop.api.resources.audiences.requests.ListAudiencesRequest; +import com.whop.api.resources.audiences.requests.UpdateAudiencesRequest; +import com.whop.api.resources.audiences.types.CreateAudiencesResponse; +import com.whop.api.resources.audiences.types.DeleteAudiencesResponse; +import com.whop.api.types.Audience; +import java.util.concurrent.CompletableFuture; + +public class AsyncAudiencesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAudiencesClient rawClient; + + public AsyncAudiencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAudiencesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAudiencesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists uploaded customer-list audiences for an account. Pass audience_id to return a specific audience. + */ + public CompletableFuture> list(ListAudiencesRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists uploaded customer-list audiences for an account. Pass audience_id to return a specific audience. + */ + public CompletableFuture> list( + ListAudiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates an audience. Default (audience_type omitted or custom): creates one audience from an uploaded customer identity CSV file (name, column_mapping, and file_id required) and starts processing it; responds with the audience object. With filters: creates an audience from saved People filters (name required) — membership is built from the account's People data, and auto_refresh decides whether it keeps tracking the filters or keeps whoever matched at creation. With audience_type: lookalike: creates a ladder of Meta lookalike audiences from an existing ready custom audience (source_audience_id, count, and percentage required) — count equal similarity bands slicing the top percentage% (3 audiences at 6% = 0–2%, 2–4%, 4–6%), each returned as its own audience in a { data: [...] } envelope. + */ + public CompletableFuture create(CreateAudiencesRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Creates an audience. Default (audience_type omitted or custom): creates one audience from an uploaded customer identity CSV file (name, column_mapping, and file_id required) and starts processing it; responds with the audience object. With filters: creates an audience from saved People filters (name required) — membership is built from the account's People data, and auto_refresh decides whether it keeps tracking the filters or keeps whoever matched at creation. With audience_type: lookalike: creates a ladder of Meta lookalike audiences from an existing ready custom audience (source_audience_id, count, and percentage required) — count equal similarity bands slicing the top percentage% (3 audiences at 6% = 0–2%, 2–4%, 4–6%), each returned as its own audience in a { data: [...] } envelope. + */ + public CompletableFuture create( + CreateAudiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public CompletableFuture delete(String id, DeleteAudiencesRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public CompletableFuture delete( + String id, DeleteAudiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public CompletableFuture update(String id, UpdateAudiencesRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public CompletableFuture update( + String id, UpdateAudiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Adds users from a new CSV file to an existing uploaded custom audience. The file uses the audience's saved column mapping, processing happens in the background, and existing audience members remain unchanged. + */ + public CompletableFuture addPeople(String id, AddPeopleAudiencesRequest request) { + return this.rawClient.addPeople(id, request).thenApply(response -> response.body()); + } + + /** + * Adds users from a new CSV file to an existing uploaded custom audience. The file uses the audience's saved column mapping, processing happens in the background, and existing audience members remain unchanged. + */ + public CompletableFuture addPeople( + String id, AddPeopleAudiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.addPeople(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/AsyncRawAudiencesClient.java b/src/main/java/com/whop/api/resources/audiences/AsyncRawAudiencesClient.java new file mode 100644 index 00000000..af841195 --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/AsyncRawAudiencesClient.java @@ -0,0 +1,489 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.audiences.requests.AddPeopleAudiencesRequest; +import com.whop.api.resources.audiences.requests.CreateAudiencesRequest; +import com.whop.api.resources.audiences.requests.DeleteAudiencesRequest; +import com.whop.api.resources.audiences.requests.ListAudiencesRequest; +import com.whop.api.resources.audiences.requests.UpdateAudiencesRequest; +import com.whop.api.resources.audiences.types.CreateAudiencesResponse; +import com.whop.api.resources.audiences.types.DeleteAudiencesResponse; +import com.whop.api.resources.audiences.types.ListAudiencesResponse; +import com.whop.api.types.Audience; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAudiencesClient { + protected final ClientOptions clientOptions; + + public AsyncRawAudiencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists uploaded customer-list audiences for an account. Pass audience_id to return a specific audience. + */ + public CompletableFuture>> list(ListAudiencesRequest request) { + return list(request, null); + } + + /** + * Lists uploaded customer-list audiences for an account. Pass audience_id to return a specific audience. + */ + public CompletableFuture>> list( + ListAudiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audiences"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getAudienceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "audience_id", request.getAudienceId().get(), false); + } + if (request.getAudienceType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "audience_type", request.getAudienceType().get(), false); + } + if (request.getSourceType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "source_type", request.getSourceType().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAudiencesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAudiencesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListAudiencesRequest nextRequest = ListAudiencesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable(startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + if (response.code() == 401) { + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates an audience. Default (audience_type omitted or custom): creates one audience from an uploaded customer identity CSV file (name, column_mapping, and file_id required) and starts processing it; responds with the audience object. With filters: creates an audience from saved People filters (name required) — membership is built from the account's People data, and auto_refresh decides whether it keeps tracking the filters or keeps whoever matched at creation. With audience_type: lookalike: creates a ladder of Meta lookalike audiences from an existing ready custom audience (source_audience_id, count, and percentage required) — count equal similarity bands slicing the top percentage% (3 audiences at 6% = 0–2%, 2–4%, 4–6%), each returned as its own audience in a { data: [...] } envelope. + */ + public CompletableFuture> create(CreateAudiencesRequest request) { + return create(request, null); + } + + /** + * Creates an audience. Default (audience_type omitted or custom): creates one audience from an uploaded customer identity CSV file (name, column_mapping, and file_id required) and starts processing it; responds with the audience object. With filters: creates an audience from saved People filters (name required) — membership is built from the account's People data, and auto_refresh decides whether it keeps tracking the filters or keeps whoever matched at creation. With audience_type: lookalike: creates a ladder of Meta lookalike audiences from an existing ready custom audience (source_audience_id, count, and percentage required) — count equal similarity bands slicing the top percentage% (3 audiences at 6% = 0–2%, 2–4%, 4–6%), each returned as its own audience in a { data: [...] } envelope. + */ + public CompletableFuture> create( + CreateAudiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audiences"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateAudiencesResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteAudiencesRequest.builder().build()); + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public CompletableFuture> delete( + String id, RequestOptions requestOptions) { + return delete(id, DeleteAudiencesRequest.builder().build(), requestOptions); + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public CompletableFuture> delete( + String id, DeleteAudiencesRequest request) { + return delete(id, request, null); + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public CompletableFuture> delete( + String id, DeleteAudiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audiences") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteAudiencesResponse.class), + response)); + return; + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateAudiencesRequest.builder().build()); + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateAudiencesRequest.builder().build(), requestOptions); + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public CompletableFuture> update(String id, UpdateAudiencesRequest request) { + return update(id, request, null); + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public CompletableFuture> update( + String id, UpdateAudiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audiences") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Audience.class), response)); + return; + } + try { + if (response.code() == 401) { + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Adds users from a new CSV file to an existing uploaded custom audience. The file uses the audience's saved column mapping, processing happens in the background, and existing audience members remain unchanged. + */ + public CompletableFuture> addPeople(String id, AddPeopleAudiencesRequest request) { + return addPeople(id, request, null); + } + + /** + * Adds users from a new CSV file to an existing uploaded custom audience. The file uses the audience's saved column mapping, processing happens in the background, and existing audience members remain unchanged. + */ + public CompletableFuture> addPeople( + String id, AddPeopleAudiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audiences") + .addPathSegment(id) + .addPathSegments("add_people"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Audience.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/AudiencesClient.java b/src/main/java/com/whop/api/resources/audiences/AudiencesClient.java new file mode 100644 index 00000000..672aab2f --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/AudiencesClient.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.audiences.requests.AddPeopleAudiencesRequest; +import com.whop.api.resources.audiences.requests.CreateAudiencesRequest; +import com.whop.api.resources.audiences.requests.DeleteAudiencesRequest; +import com.whop.api.resources.audiences.requests.ListAudiencesRequest; +import com.whop.api.resources.audiences.requests.UpdateAudiencesRequest; +import com.whop.api.resources.audiences.types.CreateAudiencesResponse; +import com.whop.api.resources.audiences.types.DeleteAudiencesResponse; +import com.whop.api.types.Audience; + +public class AudiencesClient { + protected final ClientOptions clientOptions; + + private final RawAudiencesClient rawClient; + + public AudiencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAudiencesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAudiencesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists uploaded customer-list audiences for an account. Pass audience_id to return a specific audience. + */ + public SyncPagingIterable list(ListAudiencesRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists uploaded customer-list audiences for an account. Pass audience_id to return a specific audience. + */ + public SyncPagingIterable list(ListAudiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Creates an audience. Default (audience_type omitted or custom): creates one audience from an uploaded customer identity CSV file (name, column_mapping, and file_id required) and starts processing it; responds with the audience object. With filters: creates an audience from saved People filters (name required) — membership is built from the account's People data, and auto_refresh decides whether it keeps tracking the filters or keeps whoever matched at creation. With audience_type: lookalike: creates a ladder of Meta lookalike audiences from an existing ready custom audience (source_audience_id, count, and percentage required) — count equal similarity bands slicing the top percentage% (3 audiences at 6% = 0–2%, 2–4%, 4–6%), each returned as its own audience in a { data: [...] } envelope. + */ + public CreateAudiencesResponse create(CreateAudiencesRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Creates an audience. Default (audience_type omitted or custom): creates one audience from an uploaded customer identity CSV file (name, column_mapping, and file_id required) and starts processing it; responds with the audience object. With filters: creates an audience from saved People filters (name required) — membership is built from the account's People data, and auto_refresh decides whether it keeps tracking the filters or keeps whoever matched at creation. With audience_type: lookalike: creates a ladder of Meta lookalike audiences from an existing ready custom audience (source_audience_id, count, and percentage required) — count equal similarity bands slicing the top percentage% (3 audiences at 6% = 0–2%, 2–4%, 4–6%), each returned as its own audience in a { data: [...] } envelope. + */ + public CreateAudiencesResponse create(CreateAudiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public DeleteAudiencesResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public DeleteAudiencesResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public DeleteAudiencesResponse delete(String id, DeleteAudiencesRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public DeleteAudiencesResponse delete(String id, DeleteAudiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public Audience update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public Audience update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public Audience update(String id, UpdateAudiencesRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public Audience update(String id, UpdateAudiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Adds users from a new CSV file to an existing uploaded custom audience. The file uses the audience's saved column mapping, processing happens in the background, and existing audience members remain unchanged. + */ + public Audience addPeople(String id, AddPeopleAudiencesRequest request) { + return this.rawClient.addPeople(id, request).body(); + } + + /** + * Adds users from a new CSV file to an existing uploaded custom audience. The file uses the audience's saved column mapping, processing happens in the background, and existing audience members remain unchanged. + */ + public Audience addPeople(String id, AddPeopleAudiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.addPeople(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/RawAudiencesClient.java b/src/main/java/com/whop/api/resources/audiences/RawAudiencesClient.java new file mode 100644 index 00000000..2966a1d2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/RawAudiencesClient.java @@ -0,0 +1,402 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.audiences.requests.AddPeopleAudiencesRequest; +import com.whop.api.resources.audiences.requests.CreateAudiencesRequest; +import com.whop.api.resources.audiences.requests.DeleteAudiencesRequest; +import com.whop.api.resources.audiences.requests.ListAudiencesRequest; +import com.whop.api.resources.audiences.requests.UpdateAudiencesRequest; +import com.whop.api.resources.audiences.types.CreateAudiencesResponse; +import com.whop.api.resources.audiences.types.DeleteAudiencesResponse; +import com.whop.api.resources.audiences.types.ListAudiencesResponse; +import com.whop.api.types.Audience; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAudiencesClient { + protected final ClientOptions clientOptions; + + public RawAudiencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists uploaded customer-list audiences for an account. Pass audience_id to return a specific audience. + */ + public WhopApiHttpResponse> list(ListAudiencesRequest request) { + return list(request, null); + } + + /** + * Lists uploaded customer-list audiences for an account. Pass audience_id to return a specific audience. + */ + public WhopApiHttpResponse> list( + ListAudiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audiences"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getAudienceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "audience_id", request.getAudienceId().get(), false); + } + if (request.getAudienceType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "audience_type", request.getAudienceType().get(), false); + } + if (request.getSourceType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "source_type", request.getSourceType().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAudiencesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAudiencesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListAudiencesRequest nextRequest = ListAudiencesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + if (response.code() == 401) { + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates an audience. Default (audience_type omitted or custom): creates one audience from an uploaded customer identity CSV file (name, column_mapping, and file_id required) and starts processing it; responds with the audience object. With filters: creates an audience from saved People filters (name required) — membership is built from the account's People data, and auto_refresh decides whether it keeps tracking the filters or keeps whoever matched at creation. With audience_type: lookalike: creates a ladder of Meta lookalike audiences from an existing ready custom audience (source_audience_id, count, and percentage required) — count equal similarity bands slicing the top percentage% (3 audiences at 6% = 0–2%, 2–4%, 4–6%), each returned as its own audience in a { data: [...] } envelope. + */ + public WhopApiHttpResponse create(CreateAudiencesRequest request) { + return create(request, null); + } + + /** + * Creates an audience. Default (audience_type omitted or custom): creates one audience from an uploaded customer identity CSV file (name, column_mapping, and file_id required) and starts processing it; responds with the audience object. With filters: creates an audience from saved People filters (name required) — membership is built from the account's People data, and auto_refresh decides whether it keeps tracking the filters or keeps whoever matched at creation. With audience_type: lookalike: creates a ladder of Meta lookalike audiences from an existing ready custom audience (source_audience_id, count, and percentage required) — count equal similarity bands slicing the top percentage% (3 audiences at 6% = 0–2%, 2–4%, 4–6%), each returned as its own audience in a { data: [...] } envelope. + */ + public WhopApiHttpResponse create( + CreateAudiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audiences"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateAudiencesResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteAudiencesRequest.builder().build()); + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteAudiencesRequest.builder().build(), requestOptions); + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public WhopApiHttpResponse delete(String id, DeleteAudiencesRequest request) { + return delete(id, request, null); + } + + /** + * Deletes an audience so it is no longer available for targeting. + */ + public WhopApiHttpResponse delete( + String id, DeleteAudiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audiences") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteAudiencesResponse.class), + response); + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateAudiencesRequest.builder().build()); + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateAudiencesRequest.builder().build(), requestOptions); + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public WhopApiHttpResponse update(String id, UpdateAudiencesRequest request) { + return update(id, request, null); + } + + /** + * Renames an audience. For an audience built from People filters that keeps itself up to date, pass filters to replace them, which rebuilds membership immediately. Whether an audience auto refreshes is set when it is created. + */ + public WhopApiHttpResponse update( + String id, UpdateAudiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audiences") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Audience.class), response); + } + try { + if (response.code() == 401) { + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Adds users from a new CSV file to an existing uploaded custom audience. The file uses the audience's saved column mapping, processing happens in the background, and existing audience members remain unchanged. + */ + public WhopApiHttpResponse addPeople(String id, AddPeopleAudiencesRequest request) { + return addPeople(id, request, null); + } + + /** + * Adds users from a new CSV file to an existing uploaded custom audience. The file uses the audience's saved column mapping, processing happens in the background, and existing audience members remain unchanged. + */ + public WhopApiHttpResponse addPeople( + String id, AddPeopleAudiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audiences") + .addPathSegment(id) + .addPathSegments("add_people"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Audience.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/requests/AddPeopleAudiencesRequest.java b/src/main/java/com/whop/api/resources/audiences/requests/AddPeopleAudiencesRequest.java new file mode 100644 index 00000000..340a26b4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/requests/AddPeopleAudiencesRequest.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AddPeopleAudiencesRequest.Builder.class) +public final class AddPeopleAudiencesRequest { + private final String fileId; + + private final Map additionalProperties; + + private AddPeopleAudiencesRequest(String fileId, Map additionalProperties) { + this.fileId = fileId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The new customer CSV — a file id (file_...) returned by POST /files. Its headers must match the audience's saved column mapping. + */ + @JsonProperty("file_id") + public String getFileId() { + return fileId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AddPeopleAudiencesRequest && equalTo((AddPeopleAudiencesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AddPeopleAudiencesRequest other) { + return fileId.equals(other.fileId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fileId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FileIdStage builder() { + return new Builder(); + } + + public interface FileIdStage { + /** + *

The new customer CSV — a file id (file_...) returned by POST /files. Its headers must match the audience's saved column mapping.

+ */ + _FinalStage fileId(@NotNull String fileId); + + Builder from(AddPeopleAudiencesRequest other); + } + + public interface _FinalStage { + AddPeopleAudiencesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FileIdStage, _FinalStage { + private String fileId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AddPeopleAudiencesRequest other) { + fileId(other.getFileId()); + return this; + } + + /** + *

The new customer CSV — a file id (file_...) returned by POST /files. Its headers must match the audience's saved column mapping.

+ *

The new customer CSV — a file id (file_...) returned by POST /files. Its headers must match the audience's saved column mapping.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("file_id") + public _FinalStage fileId(@NotNull String fileId) { + this.fileId = Objects.requireNonNull(fileId, "fileId must not be null"); + return this; + } + + @java.lang.Override + public AddPeopleAudiencesRequest build() { + return new AddPeopleAudiencesRequest(fileId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/requests/CreateAudiencesRequest.java b/src/main/java/com/whop/api/resources/audiences/requests/CreateAudiencesRequest.java new file mode 100644 index 00000000..4550399c --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/requests/CreateAudiencesRequest.java @@ -0,0 +1,543 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.audiences.types.CreateAudiencesRequestAudienceType; +import com.whop.api.resources.audiences.types.CreateAudiencesRequestColumnMapping; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAudiencesRequest.Builder.class) +public final class CreateAudiencesRequest { + private final String accountId; + + private final Optional audienceType; + + private final Optional autoRefresh; + + private final Optional columnMapping; + + private final Optional count; + + private final Optional fileId; + + private final Optional> filters; + + private final Optional name; + + private final Optional percentage; + + private final Optional sourceAudienceId; + + private final Map additionalProperties; + + private CreateAudiencesRequest( + String accountId, + Optional audienceType, + Optional autoRefresh, + Optional columnMapping, + Optional count, + Optional fileId, + Optional> filters, + Optional name, + Optional percentage, + Optional sourceAudienceId, + Map additionalProperties) { + this.accountId = accountId; + this.audienceType = audienceType; + this.autoRefresh = autoRefresh; + this.columnMapping = columnMapping; + this.count = count; + this.fileId = fileId; + this.filters = filters; + this.name = name; + this.percentage = percentage; + this.sourceAudienceId = sourceAudienceId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return What to create. Defaults to custom (CSV upload). + */ + @JsonProperty("audience_type") + public Optional getAudienceType() { + return audienceType; + } + + /** + * @return Filter audiences only, and set only at creation. true (the default) rebuilds membership from the filters twice a day. false keeps whoever matched at creation and never rebuilds. + */ + @JsonProperty("auto_refresh") + public Optional getAutoRefresh() { + return autoRefresh; + } + + /** + * @return Custom audiences only. Maps supported identity fields to CSV column headers. Map at least one of email or phone. + */ + @JsonProperty("column_mapping") + public Optional getColumnMapping() { + return columnMapping; + } + + /** + * @return Lookalikes only. Number of lookalike audiences to create (1–6). + */ + @JsonProperty("count") + public Optional getCount() { + return count; + } + + /** + * @return Custom audiences only. The uploaded customer CSV — a file id (file_...) returned by POST /files. + */ + @JsonProperty("file_id") + public Optional getFileId() { + return fileId; + } + + /** + * @return Filter audiences only. The People filters that define membership, keyed exactly as GET /people accepts them — for example {"os": "iOS", "country": "US"}. Date filters must be rolling windows — first_seen_within_days or last_seen_within_days — so the audience re-anchors on every refresh; fixed dates such as first_seen_after are rejected. Source values are canonical source paths (whop:<campaign>:<group>:<ad>, ext:<platform>:..., referrer:<domain>, direct), exact or with a trailing :* wildcard. + */ + @JsonProperty("filters") + public Optional> getFilters() { + return filters; + } + + /** + * @return Audience display name. Required for custom audiences; lookalike names are generated from the source audience. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Lookalikes only. Total similarity reach as a whole percent (1–20), sliced evenly across count — must be divisible by count. + */ + @JsonProperty("percentage") + public Optional getPercentage() { + return percentage; + } + + /** + * @return Lookalikes only. The ready custom audience (adaud_) to build from; it needs at least 100 matched people. + */ + @JsonProperty("source_audience_id") + public Optional getSourceAudienceId() { + return sourceAudienceId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAudiencesRequest && equalTo((CreateAudiencesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAudiencesRequest other) { + return accountId.equals(other.accountId) + && audienceType.equals(other.audienceType) + && autoRefresh.equals(other.autoRefresh) + && columnMapping.equals(other.columnMapping) + && count.equals(other.count) + && fileId.equals(other.fileId) + && filters.equals(other.filters) + && name.equals(other.name) + && percentage.equals(other.percentage) + && sourceAudienceId.equals(other.sourceAudienceId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.audienceType, + this.autoRefresh, + this.columnMapping, + this.count, + this.fileId, + this.filters, + this.name, + this.percentage, + this.sourceAudienceId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Account ID, prefixed biz_.

+ */ + _FinalStage accountId(@NotNull String accountId); + + Builder from(CreateAudiencesRequest other); + } + + public interface _FinalStage { + CreateAudiencesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

What to create. Defaults to custom (CSV upload).

+ */ + _FinalStage audienceType(Optional audienceType); + + _FinalStage audienceType(CreateAudiencesRequestAudienceType audienceType); + + /** + *

Filter audiences only, and set only at creation. true (the default) rebuilds membership from the filters twice a day. false keeps whoever matched at creation and never rebuilds.

+ */ + _FinalStage autoRefresh(Optional autoRefresh); + + _FinalStage autoRefresh(Boolean autoRefresh); + + /** + *

Custom audiences only. Maps supported identity fields to CSV column headers. Map at least one of email or phone.

+ */ + _FinalStage columnMapping(Optional columnMapping); + + _FinalStage columnMapping(CreateAudiencesRequestColumnMapping columnMapping); + + /** + *

Lookalikes only. Number of lookalike audiences to create (1–6).

+ */ + _FinalStage count(Optional count); + + _FinalStage count(Integer count); + + /** + *

Custom audiences only. The uploaded customer CSV — a file id (file_...) returned by POST /files.

+ */ + _FinalStage fileId(Optional fileId); + + _FinalStage fileId(String fileId); + + /** + *

Filter audiences only. The People filters that define membership, keyed exactly as GET /people accepts them — for example {"os": "iOS", "country": "US"}. Date filters must be rolling windows — first_seen_within_days or last_seen_within_days — so the audience re-anchors on every refresh; fixed dates such as first_seen_after are rejected. Source values are canonical source paths (whop:<campaign>:<group>:<ad>, ext:<platform>:..., referrer:<domain>, direct), exact or with a trailing :* wildcard.

+ */ + _FinalStage filters(Optional> filters); + + _FinalStage filters(Map filters); + + /** + *

Audience display name. Required for custom audiences; lookalike names are generated from the source audience.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + /** + *

Lookalikes only. Total similarity reach as a whole percent (1–20), sliced evenly across count — must be divisible by count.

+ */ + _FinalStage percentage(Optional percentage); + + _FinalStage percentage(Integer percentage); + + /** + *

Lookalikes only. The ready custom audience (adaud_) to build from; it needs at least 100 matched people.

+ */ + _FinalStage sourceAudienceId(Optional sourceAudienceId); + + _FinalStage sourceAudienceId(String sourceAudienceId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, _FinalStage { + private String accountId; + + private Optional sourceAudienceId = Optional.empty(); + + private Optional percentage = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional> filters = Optional.empty(); + + private Optional fileId = Optional.empty(); + + private Optional count = Optional.empty(); + + private Optional columnMapping = Optional.empty(); + + private Optional autoRefresh = Optional.empty(); + + private Optional audienceType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAudiencesRequest other) { + accountId(other.getAccountId()); + audienceType(other.getAudienceType()); + autoRefresh(other.getAutoRefresh()); + columnMapping(other.getColumnMapping()); + count(other.getCount()); + fileId(other.getFileId()); + filters(other.getFilters()); + name(other.getName()); + percentage(other.getPercentage()); + sourceAudienceId(other.getSourceAudienceId()); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ *

Account ID, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

Lookalikes only. The ready custom audience (adaud_) to build from; it needs at least 100 matched people.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sourceAudienceId(String sourceAudienceId) { + this.sourceAudienceId = Optional.ofNullable(sourceAudienceId); + return this; + } + + /** + *

Lookalikes only. The ready custom audience (adaud_) to build from; it needs at least 100 matched people.

+ */ + @java.lang.Override + @JsonSetter(value = "source_audience_id", nulls = Nulls.SKIP) + public _FinalStage sourceAudienceId(Optional sourceAudienceId) { + this.sourceAudienceId = sourceAudienceId; + return this; + } + + /** + *

Lookalikes only. Total similarity reach as a whole percent (1–20), sliced evenly across count — must be divisible by count.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage percentage(Integer percentage) { + this.percentage = Optional.ofNullable(percentage); + return this; + } + + /** + *

Lookalikes only. Total similarity reach as a whole percent (1–20), sliced evenly across count — must be divisible by count.

+ */ + @java.lang.Override + @JsonSetter(value = "percentage", nulls = Nulls.SKIP) + public _FinalStage percentage(Optional percentage) { + this.percentage = percentage; + return this; + } + + /** + *

Audience display name. Required for custom audiences; lookalike names are generated from the source audience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Audience display name. Required for custom audiences; lookalike names are generated from the source audience.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

Filter audiences only. The People filters that define membership, keyed exactly as GET /people accepts them — for example {"os": "iOS", "country": "US"}. Date filters must be rolling windows — first_seen_within_days or last_seen_within_days — so the audience re-anchors on every refresh; fixed dates such as first_seen_after are rejected. Source values are canonical source paths (whop:<campaign>:<group>:<ad>, ext:<platform>:..., referrer:<domain>, direct), exact or with a trailing :* wildcard.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filters(Map filters) { + this.filters = Optional.ofNullable(filters); + return this; + } + + /** + *

Filter audiences only. The People filters that define membership, keyed exactly as GET /people accepts them — for example {"os": "iOS", "country": "US"}. Date filters must be rolling windows — first_seen_within_days or last_seen_within_days — so the audience re-anchors on every refresh; fixed dates such as first_seen_after are rejected. Source values are canonical source paths (whop:<campaign>:<group>:<ad>, ext:<platform>:..., referrer:<domain>, direct), exact or with a trailing :* wildcard.

+ */ + @java.lang.Override + @JsonSetter(value = "filters", nulls = Nulls.SKIP) + public _FinalStage filters(Optional> filters) { + this.filters = filters; + return this; + } + + /** + *

Custom audiences only. The uploaded customer CSV — a file id (file_...) returned by POST /files.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fileId(String fileId) { + this.fileId = Optional.ofNullable(fileId); + return this; + } + + /** + *

Custom audiences only. The uploaded customer CSV — a file id (file_...) returned by POST /files.

+ */ + @java.lang.Override + @JsonSetter(value = "file_id", nulls = Nulls.SKIP) + public _FinalStage fileId(Optional fileId) { + this.fileId = fileId; + return this; + } + + /** + *

Lookalikes only. Number of lookalike audiences to create (1–6).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage count(Integer count) { + this.count = Optional.ofNullable(count); + return this; + } + + /** + *

Lookalikes only. Number of lookalike audiences to create (1–6).

+ */ + @java.lang.Override + @JsonSetter(value = "count", nulls = Nulls.SKIP) + public _FinalStage count(Optional count) { + this.count = count; + return this; + } + + /** + *

Custom audiences only. Maps supported identity fields to CSV column headers. Map at least one of email or phone.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage columnMapping(CreateAudiencesRequestColumnMapping columnMapping) { + this.columnMapping = Optional.ofNullable(columnMapping); + return this; + } + + /** + *

Custom audiences only. Maps supported identity fields to CSV column headers. Map at least one of email or phone.

+ */ + @java.lang.Override + @JsonSetter(value = "column_mapping", nulls = Nulls.SKIP) + public _FinalStage columnMapping(Optional columnMapping) { + this.columnMapping = columnMapping; + return this; + } + + /** + *

Filter audiences only, and set only at creation. true (the default) rebuilds membership from the filters twice a day. false keeps whoever matched at creation and never rebuilds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage autoRefresh(Boolean autoRefresh) { + this.autoRefresh = Optional.ofNullable(autoRefresh); + return this; + } + + /** + *

Filter audiences only, and set only at creation. true (the default) rebuilds membership from the filters twice a day. false keeps whoever matched at creation and never rebuilds.

+ */ + @java.lang.Override + @JsonSetter(value = "auto_refresh", nulls = Nulls.SKIP) + public _FinalStage autoRefresh(Optional autoRefresh) { + this.autoRefresh = autoRefresh; + return this; + } + + /** + *

What to create. Defaults to custom (CSV upload).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage audienceType(CreateAudiencesRequestAudienceType audienceType) { + this.audienceType = Optional.ofNullable(audienceType); + return this; + } + + /** + *

What to create. Defaults to custom (CSV upload).

+ */ + @java.lang.Override + @JsonSetter(value = "audience_type", nulls = Nulls.SKIP) + public _FinalStage audienceType(Optional audienceType) { + this.audienceType = audienceType; + return this; + } + + @java.lang.Override + public CreateAudiencesRequest build() { + return new CreateAudiencesRequest( + accountId, + audienceType, + autoRefresh, + columnMapping, + count, + fileId, + filters, + name, + percentage, + sourceAudienceId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/requests/DeleteAudiencesRequest.java b/src/main/java/com/whop/api/resources/audiences/requests/DeleteAudiencesRequest.java new file mode 100644 index 00000000..b31de6bc --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/requests/DeleteAudiencesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteAudiencesRequest.Builder.class) +public final class DeleteAudiencesRequest { + private final Map additionalProperties; + + private DeleteAudiencesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteAudiencesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteAudiencesRequest other) { + return this; + } + + public DeleteAudiencesRequest build() { + return new DeleteAudiencesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/requests/ListAudiencesRequest.java b/src/main/java/com/whop/api/resources/audiences/requests/ListAudiencesRequest.java new file mode 100644 index 00000000..82af6d84 --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/requests/ListAudiencesRequest.java @@ -0,0 +1,352 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.audiences.types.ListAudiencesRequestAudienceType; +import com.whop.api.resources.audiences.types.ListAudiencesRequestSourceType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAudiencesRequest.Builder.class) +public final class ListAudiencesRequest { + private final String accountId; + + private final Optional audienceId; + + private final Optional audienceType; + + private final Optional sourceType; + + private final Optional first; + + private final Optional after; + + private final Map additionalProperties; + + private ListAudiencesRequest( + String accountId, + Optional audienceId, + Optional audienceType, + Optional sourceType, + Optional first, + Optional after, + Map additionalProperties) { + this.accountId = accountId; + this.audienceId = audienceId; + this.audienceType = audienceType; + this.sourceType = sourceType; + this.first = first; + this.after = after; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Audience ID, prefixed adaud_, used to filter the response to one audience. + */ + @JsonProperty("audience_id") + public Optional getAudienceId() { + return audienceId; + } + + /** + * @return Filter by audience type: custom (uploaded lists) or lookalike. + */ + @JsonProperty("audience_type") + public Optional getAudienceType() { + return audienceType; + } + + /** + * @return Filter by member source: csv_upload (uploaded lists) or people_filter (automatic audiences built from saved People filters). + */ + @JsonProperty("source_type") + public Optional getSourceType() { + return sourceType; + } + + /** + * @return Number of audiences to return. Defaults to 20; maximum 100. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor for the next page of audiences. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAudiencesRequest && equalTo((ListAudiencesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAudiencesRequest other) { + return accountId.equals(other.accountId) + && audienceId.equals(other.audienceId) + && audienceType.equals(other.audienceType) + && sourceType.equals(other.sourceType) + && first.equals(other.first) + && after.equals(other.after); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, this.audienceId, this.audienceType, this.sourceType, this.first, this.after); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Account ID, prefixed biz_.

+ */ + _FinalStage accountId(@NotNull String accountId); + + Builder from(ListAudiencesRequest other); + } + + public interface _FinalStage { + ListAudiencesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Audience ID, prefixed adaud_, used to filter the response to one audience.

+ */ + _FinalStage audienceId(Optional audienceId); + + _FinalStage audienceId(String audienceId); + + /** + *

Filter by audience type: custom (uploaded lists) or lookalike.

+ */ + _FinalStage audienceType(Optional audienceType); + + _FinalStage audienceType(ListAudiencesRequestAudienceType audienceType); + + /** + *

Filter by member source: csv_upload (uploaded lists) or people_filter (automatic audiences built from saved People filters).

+ */ + _FinalStage sourceType(Optional sourceType); + + _FinalStage sourceType(ListAudiencesRequestSourceType sourceType); + + /** + *

Number of audiences to return. Defaults to 20; maximum 100.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Cursor for the next page of audiences.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, _FinalStage { + private String accountId; + + private Optional after = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional sourceType = Optional.empty(); + + private Optional audienceType = Optional.empty(); + + private Optional audienceId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAudiencesRequest other) { + accountId(other.getAccountId()); + audienceId(other.getAudienceId()); + audienceType(other.getAudienceType()); + sourceType(other.getSourceType()); + first(other.getFirst()); + after(other.getAfter()); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ *

Account ID, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

Cursor for the next page of audiences.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Cursor for the next page of audiences.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + /** + *

Number of audiences to return. Defaults to 20; maximum 100.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Number of audiences to return. Defaults to 20; maximum 100.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Filter by member source: csv_upload (uploaded lists) or people_filter (automatic audiences built from saved People filters).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sourceType(ListAudiencesRequestSourceType sourceType) { + this.sourceType = Optional.ofNullable(sourceType); + return this; + } + + /** + *

Filter by member source: csv_upload (uploaded lists) or people_filter (automatic audiences built from saved People filters).

+ */ + @java.lang.Override + @JsonSetter(value = "source_type", nulls = Nulls.SKIP) + public _FinalStage sourceType(Optional sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + *

Filter by audience type: custom (uploaded lists) or lookalike.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage audienceType(ListAudiencesRequestAudienceType audienceType) { + this.audienceType = Optional.ofNullable(audienceType); + return this; + } + + /** + *

Filter by audience type: custom (uploaded lists) or lookalike.

+ */ + @java.lang.Override + @JsonSetter(value = "audience_type", nulls = Nulls.SKIP) + public _FinalStage audienceType(Optional audienceType) { + this.audienceType = audienceType; + return this; + } + + /** + *

Audience ID, prefixed adaud_, used to filter the response to one audience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage audienceId(String audienceId) { + this.audienceId = Optional.ofNullable(audienceId); + return this; + } + + /** + *

Audience ID, prefixed adaud_, used to filter the response to one audience.

+ */ + @java.lang.Override + @JsonSetter(value = "audience_id", nulls = Nulls.SKIP) + public _FinalStage audienceId(Optional audienceId) { + this.audienceId = audienceId; + return this; + } + + @java.lang.Override + public ListAudiencesRequest build() { + return new ListAudiencesRequest( + accountId, audienceId, audienceType, sourceType, first, after, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/requests/UpdateAudiencesRequest.java b/src/main/java/com/whop/api/resources/audiences/requests/UpdateAudiencesRequest.java new file mode 100644 index 00000000..975eed8a --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/requests/UpdateAudiencesRequest.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAudiencesRequest.Builder.class) +public final class UpdateAudiencesRequest { + private final Optional> filters; + + private final Optional name; + + private final Map additionalProperties; + + private UpdateAudiencesRequest( + Optional> filters, Optional name, Map additionalProperties) { + this.filters = filters; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return Replaces the People filters that define membership. The whole definition is replaced rather than merged, so send every filter you want to keep — a filter you leave out stops applying. Keys and values are the ones GET /people accepts, such as an os of iOS or a country of US, and at least one filter is required. Date filters must be rolling windows — first_seen_within_days or last_seen_within_days — so the audience re-anchors every time it rebuilds; fixed dates such as first_seen_after are rejected, as is audience_id. An array value holds at most 500 items, and each value at most 10 KB. Only an audience with a source_type of people_filter and auto_refresh of true accepts filters: an uploaded list has no filters to replace, and with auto refresh off the audience keeps the people it matched when it was built, so create a new audience instead. + */ + @JsonProperty("filters") + public Optional> getFilters() { + return filters; + } + + /** + * @return New audience display name. A blank value is ignored rather than clearing the name. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAudiencesRequest && equalTo((UpdateAudiencesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAudiencesRequest other) { + return filters.equals(other.filters) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.filters, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> filters = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAudiencesRequest other) { + filters(other.getFilters()); + name(other.getName()); + return this; + } + + /** + *

Replaces the People filters that define membership. The whole definition is replaced rather than merged, so send every filter you want to keep — a filter you leave out stops applying. Keys and values are the ones GET /people accepts, such as an os of iOS or a country of US, and at least one filter is required. Date filters must be rolling windows — first_seen_within_days or last_seen_within_days — so the audience re-anchors every time it rebuilds; fixed dates such as first_seen_after are rejected, as is audience_id. An array value holds at most 500 items, and each value at most 10 KB. Only an audience with a source_type of people_filter and auto_refresh of true accepts filters: an uploaded list has no filters to replace, and with auto refresh off the audience keeps the people it matched when it was built, so create a new audience instead.

+ */ + @JsonSetter(value = "filters", nulls = Nulls.SKIP) + public Builder filters(Optional> filters) { + this.filters = filters; + return this; + } + + public Builder filters(Map filters) { + this.filters = Optional.ofNullable(filters); + return this; + } + + /** + *

New audience display name. A blank value is ignored rather than clearing the name.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public UpdateAudiencesRequest build() { + return new UpdateAudiencesRequest(filters, name, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/types/CreateAudiencesRequestAudienceType.java b/src/main/java/com/whop/api/resources/audiences/types/CreateAudiencesRequestAudienceType.java new file mode 100644 index 00000000..2bb3c331 --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/types/CreateAudiencesRequestAudienceType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateAudiencesRequestAudienceType { + public static final CreateAudiencesRequestAudienceType CUSTOM = + new CreateAudiencesRequestAudienceType(Value.CUSTOM, "custom"); + + public static final CreateAudiencesRequestAudienceType LOOKALIKE = + new CreateAudiencesRequestAudienceType(Value.LOOKALIKE, "lookalike"); + + private final Value value; + + private final String string; + + CreateAudiencesRequestAudienceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateAudiencesRequestAudienceType + && this.string.equals(((CreateAudiencesRequestAudienceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CUSTOM: + return visitor.visitCustom(); + case LOOKALIKE: + return visitor.visitLookalike(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateAudiencesRequestAudienceType valueOf(String value) { + switch (value) { + case "custom": + return CUSTOM; + case "lookalike": + return LOOKALIKE; + default: + return new CreateAudiencesRequestAudienceType(Value.UNKNOWN, value); + } + } + + public enum Value { + CUSTOM, + + LOOKALIKE, + + UNKNOWN + } + + public interface Visitor { + T visitCustom(); + + T visitLookalike(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/types/CreateAudiencesRequestColumnMapping.java b/src/main/java/com/whop/api/resources/audiences/types/CreateAudiencesRequestColumnMapping.java new file mode 100644 index 00000000..312dd99e --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/types/CreateAudiencesRequestColumnMapping.java @@ -0,0 +1,265 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAudiencesRequestColumnMapping.Builder.class) +public final class CreateAudiencesRequestColumnMapping { + private final Optional country; + + private final Optional email; + + private final Optional firstName; + + private final Optional lastName; + + private final Optional ltv; + + private final Optional phone; + + private final Map additionalProperties; + + private CreateAudiencesRequestColumnMapping( + Optional country, + Optional email, + Optional firstName, + Optional lastName, + Optional ltv, + Optional phone, + Map additionalProperties) { + this.country = country; + this.email = email; + this.firstName = firstName; + this.lastName = lastName; + this.ltv = ltv; + this.phone = phone; + this.additionalProperties = additionalProperties; + } + + /** + * @return CSV header for ISO 3166-1 alpha-2 country codes, such as US. + */ + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + /** + * @return CSV header for email addresses. + */ + @JsonProperty("email") + public Optional getEmail() { + return email; + } + + /** + * @return CSV header for first names. + */ + @JsonProperty("first_name") + public Optional getFirstName() { + return firstName; + } + + /** + * @return CSV header for last names. + */ + @JsonProperty("last_name") + public Optional getLastName() { + return lastName; + } + + /** + * @return CSV header for each customer's lifetime value — a non-negative number, currency symbols allowed. When mapped, Meta creates the audience as value-based, so lookalikes built from it favor people similar to the highest-value customers. + */ + @JsonProperty("ltv") + public Optional getLtv() { + return ltv; + } + + /** + * @return CSV header for phone numbers. + */ + @JsonProperty("phone") + public Optional getPhone() { + return phone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAudiencesRequestColumnMapping + && equalTo((CreateAudiencesRequestColumnMapping) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAudiencesRequestColumnMapping other) { + return country.equals(other.country) + && email.equals(other.email) + && firstName.equals(other.firstName) + && lastName.equals(other.lastName) + && ltv.equals(other.ltv) + && phone.equals(other.phone); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.country, this.email, this.firstName, this.lastName, this.ltv, this.phone); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional country = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional lastName = Optional.empty(); + + private Optional ltv = Optional.empty(); + + private Optional phone = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAudiencesRequestColumnMapping other) { + country(other.getCountry()); + email(other.getEmail()); + firstName(other.getFirstName()); + lastName(other.getLastName()); + ltv(other.getLtv()); + phone(other.getPhone()); + return this; + } + + /** + *

CSV header for ISO 3166-1 alpha-2 country codes, such as US.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

CSV header for email addresses.

+ */ + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

CSV header for first names.

+ */ + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public Builder firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + /** + *

CSV header for last names.

+ */ + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public Builder lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + /** + *

CSV header for each customer's lifetime value — a non-negative number, currency symbols allowed. When mapped, Meta creates the audience as value-based, so lookalikes built from it favor people similar to the highest-value customers.

+ */ + @JsonSetter(value = "ltv", nulls = Nulls.SKIP) + public Builder ltv(Optional ltv) { + this.ltv = ltv; + return this; + } + + public Builder ltv(String ltv) { + this.ltv = Optional.ofNullable(ltv); + return this; + } + + /** + *

CSV header for phone numbers.

+ */ + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + public CreateAudiencesRequestColumnMapping build() { + return new CreateAudiencesRequestColumnMapping( + country, email, firstName, lastName, ltv, phone, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/types/CreateAudiencesResponse.java b/src/main/java/com/whop/api/resources/audiences/types/CreateAudiencesResponse.java new file mode 100644 index 00000000..bc27e517 --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/types/CreateAudiencesResponse.java @@ -0,0 +1,115 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Audience; +import java.io.IOException; +import java.util.Map; +import java.util.Objects; + +@JsonDeserialize(using = CreateAudiencesResponse.Deserializer.class) +public final class CreateAudiencesResponse { + private final Object value; + + private final int type; + + private CreateAudiencesResponse(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((Audience) this.value); + } else if (this.type == 1) { + return visitor.visit((CreateAudiencesResponseData) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAudiencesResponse && equalTo((CreateAudiencesResponse) other); + } + + private boolean equalTo(CreateAudiencesResponse other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static CreateAudiencesResponse of(Audience value) { + return new CreateAudiencesResponse(value, 0); + } + + public static CreateAudiencesResponse of(CreateAudiencesResponseData value) { + return new CreateAudiencesResponse(value, 1); + } + + public interface Visitor { + T visit(Audience value); + + T visit(CreateAudiencesResponseData value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(CreateAudiencesResponse.class); + } + + @java.lang.Override + public CreateAudiencesResponse deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Map + && ((Map) value).containsKey("audience_type") + && ((Map) value).containsKey("auto_refresh") + && ((Map) value).containsKey("created_at") + && ((Map) value).containsKey("id") + && ((Map) value).containsKey("match_rates") + && ((Map) value).containsKey("matched_rows") + && ((Map) value).containsKey("name") + && ((Map) value).containsKey("platform_audience_ids") + && ((Map) value).containsKey("processed_rows") + && ((Map) value).containsKey("progress_percent") + && ((Map) value).containsKey("source_type") + && ((Map) value).containsKey("status") + && ((Map) value).containsKey("total_rows") + && ((Map) value).containsKey("updated_at")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, Audience.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map && ((Map) value).containsKey("data")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, CreateAudiencesResponseData.class)); + } catch (RuntimeException e) { + } + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/types/CreateAudiencesResponseData.java b/src/main/java/com/whop/api/resources/audiences/types/CreateAudiencesResponseData.java new file mode 100644 index 00000000..7cbd8a85 --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/types/CreateAudiencesResponseData.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Audience; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAudiencesResponseData.Builder.class) +public final class CreateAudiencesResponseData { + private final List data; + + private final Map additionalProperties; + + private CreateAudiencesResponseData(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAudiencesResponseData && equalTo((CreateAudiencesResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAudiencesResponseData other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAudiencesResponseData other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(Audience data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public CreateAudiencesResponseData build() { + return new CreateAudiencesResponseData(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/types/DeleteAudiencesResponse.java b/src/main/java/com/whop/api/resources/audiences/types/DeleteAudiencesResponse.java new file mode 100644 index 00000000..017ecce1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/types/DeleteAudiencesResponse.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteAudiencesResponse.Builder.class) +public final class DeleteAudiencesResponse { + private final boolean success; + + private final Map additionalProperties; + + private DeleteAudiencesResponse(boolean success, Map additionalProperties) { + this.success = success; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("success") + public boolean getSuccess() { + return success; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteAudiencesResponse && equalTo((DeleteAudiencesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteAudiencesResponse other) { + return success == other.success; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.success); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SuccessStage builder() { + return new Builder(); + } + + public interface SuccessStage { + _FinalStage success(boolean success); + + Builder from(DeleteAudiencesResponse other); + } + + public interface _FinalStage { + DeleteAudiencesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SuccessStage, _FinalStage { + private boolean success; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeleteAudiencesResponse other) { + success(other.getSuccess()); + return this; + } + + @java.lang.Override + @JsonSetter("success") + public _FinalStage success(boolean success) { + this.success = success; + return this; + } + + @java.lang.Override + public DeleteAudiencesResponse build() { + return new DeleteAudiencesResponse(success, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/types/ListAudiencesRequestAudienceType.java b/src/main/java/com/whop/api/resources/audiences/types/ListAudiencesRequestAudienceType.java new file mode 100644 index 00000000..8028289f --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/types/ListAudiencesRequestAudienceType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAudiencesRequestAudienceType { + public static final ListAudiencesRequestAudienceType CUSTOM = + new ListAudiencesRequestAudienceType(Value.CUSTOM, "custom"); + + public static final ListAudiencesRequestAudienceType LOOKALIKE = + new ListAudiencesRequestAudienceType(Value.LOOKALIKE, "lookalike"); + + private final Value value; + + private final String string; + + ListAudiencesRequestAudienceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAudiencesRequestAudienceType + && this.string.equals(((ListAudiencesRequestAudienceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CUSTOM: + return visitor.visitCustom(); + case LOOKALIKE: + return visitor.visitLookalike(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAudiencesRequestAudienceType valueOf(String value) { + switch (value) { + case "custom": + return CUSTOM; + case "lookalike": + return LOOKALIKE; + default: + return new ListAudiencesRequestAudienceType(Value.UNKNOWN, value); + } + } + + public enum Value { + CUSTOM, + + LOOKALIKE, + + UNKNOWN + } + + public interface Visitor { + T visitCustom(); + + T visitLookalike(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/types/ListAudiencesRequestSourceType.java b/src/main/java/com/whop/api/resources/audiences/types/ListAudiencesRequestSourceType.java new file mode 100644 index 00000000..17ae2d7d --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/types/ListAudiencesRequestSourceType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListAudiencesRequestSourceType { + public static final ListAudiencesRequestSourceType CSV_UPLOAD = + new ListAudiencesRequestSourceType(Value.CSV_UPLOAD, "csv_upload"); + + public static final ListAudiencesRequestSourceType PEOPLE_FILTER = + new ListAudiencesRequestSourceType(Value.PEOPLE_FILTER, "people_filter"); + + private final Value value; + + private final String string; + + ListAudiencesRequestSourceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListAudiencesRequestSourceType + && this.string.equals(((ListAudiencesRequestSourceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CSV_UPLOAD: + return visitor.visitCsvUpload(); + case PEOPLE_FILTER: + return visitor.visitPeopleFilter(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListAudiencesRequestSourceType valueOf(String value) { + switch (value) { + case "csv_upload": + return CSV_UPLOAD; + case "people_filter": + return PEOPLE_FILTER; + default: + return new ListAudiencesRequestSourceType(Value.UNKNOWN, value); + } + } + + public enum Value { + CSV_UPLOAD, + + PEOPLE_FILTER, + + UNKNOWN + } + + public interface Visitor { + T visitCsvUpload(); + + T visitPeopleFilter(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/types/ListAudiencesResponse.java b/src/main/java/com/whop/api/resources/audiences/types/ListAudiencesResponse.java new file mode 100644 index 00000000..3b455771 --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/types/ListAudiencesResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Audience; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAudiencesResponse.Builder.class) +public final class ListAudiencesResponse { + private final List data; + + private final ListAudiencesResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListAudiencesResponse( + List data, ListAudiencesResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListAudiencesResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAudiencesResponse && equalTo((ListAudiencesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAudiencesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListAudiencesResponsePageInfo pageInfo); + + Builder from(ListAudiencesResponse other); + } + + public interface _FinalStage { + ListAudiencesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(Audience data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListAudiencesResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAudiencesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListAudiencesResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(Audience data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListAudiencesResponse build() { + return new ListAudiencesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/audiences/types/ListAudiencesResponsePageInfo.java b/src/main/java/com/whop/api/resources/audiences/types/ListAudiencesResponsePageInfo.java new file mode 100644 index 00000000..5965790d --- /dev/null +++ b/src/main/java/com/whop/api/resources/audiences/types/ListAudiencesResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.audiences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAudiencesResponsePageInfo.Builder.class) +public final class ListAudiencesResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListAudiencesResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAudiencesResponsePageInfo && equalTo((ListAudiencesResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAudiencesResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListAudiencesResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListAudiencesResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAudiencesResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListAudiencesResponsePageInfo build() { + return new ListAudiencesResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/authorizedusers/AsyncAuthorizedUsersClient.java b/src/main/java/com/whop/api/resources/authorizedusers/AsyncAuthorizedUsersClient.java new file mode 100644 index 00000000..aba0b932 --- /dev/null +++ b/src/main/java/com/whop/api/resources/authorizedusers/AsyncAuthorizedUsersClient.java @@ -0,0 +1,201 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.authorizedusers; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.authorizedusers.requests.CreateAuthorizedUsersRequest; +import com.whop.api.resources.authorizedusers.requests.DeleteAuthorizedUsersRequest; +import com.whop.api.resources.authorizedusers.requests.ListAuthorizedUsersRequest; +import com.whop.api.resources.authorizedusers.requests.RetrieveAuthorizedUsersRequest; +import com.whop.api.types.AuthorizedUser; +import com.whop.api.types.AuthorizedUserListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncAuthorizedUsersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAuthorizedUsersClient rawClient; + + public AsyncAuthorizedUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAuthorizedUsersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAuthorizedUsersClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> list(ListAuthorizedUsersRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> list( + ListAuthorizedUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Add a new authorized user to a company. + *

Required permissions:

+ *
    + *
  • authorized_user:create
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture create(CreateAuthorizedUsersRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Add a new authorized user to a company. + *

Required permissions:

+ *
    + *
  • authorized_user:create
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture create( + CreateAuthorizedUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveAuthorizedUsersRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveAuthorizedUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public CompletableFuture delete(String id, DeleteAuthorizedUsersRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public CompletableFuture delete( + String id, DeleteAuthorizedUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/authorizedusers/AsyncRawAuthorizedUsersClient.java b/src/main/java/com/whop/api/resources/authorizedusers/AsyncRawAuthorizedUsersClient.java new file mode 100644 index 00000000..a2eac820 --- /dev/null +++ b/src/main/java/com/whop/api/resources/authorizedusers/AsyncRawAuthorizedUsersClient.java @@ -0,0 +1,631 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.authorizedusers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.authorizedusers.requests.CreateAuthorizedUsersRequest; +import com.whop.api.resources.authorizedusers.requests.DeleteAuthorizedUsersRequest; +import com.whop.api.resources.authorizedusers.requests.ListAuthorizedUsersRequest; +import com.whop.api.resources.authorizedusers.requests.RetrieveAuthorizedUsersRequest; +import com.whop.api.resources.authorizedusers.types.ListAuthorizedUsersResponse; +import com.whop.api.types.AuthorizedUser; +import com.whop.api.types.AuthorizedUserListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAuthorizedUsersClient { + protected final ClientOptions clientOptions; + + public AsyncRawAuthorizedUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture>> list() { + return list(ListAuthorizedUsersRequest.builder().build()); + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListAuthorizedUsersRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture>> list( + ListAuthorizedUsersRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture>> list( + ListAuthorizedUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("authorized_users"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getRole().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "role", request.getRole().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAuthorizedUsersResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListAuthorizedUsersResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListAuthorizedUsersRequest nextRequest = ListAuthorizedUsersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Add a new authorized user to a company. + *

Required permissions:

+ *
    + *
  • authorized_user:create
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> create(CreateAuthorizedUsersRequest request) { + return create(request, null); + } + + /** + * Add a new authorized user to a company. + *

Required permissions:

+ *
    + *
  • authorized_user:create
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> create( + CreateAuthorizedUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("authorized_users"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AuthorizedUser.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveAuthorizedUsersRequest.builder().build()); + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAuthorizedUsersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveAuthorizedUsersRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveAuthorizedUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("authorized_users") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AuthorizedUser.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteAuthorizedUsersRequest.builder().build()); + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteAuthorizedUsersRequest.builder().build(), requestOptions); + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public CompletableFuture> delete(String id, DeleteAuthorizedUsersRequest request) { + return delete(id, request, null); + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public CompletableFuture> delete( + String id, DeleteAuthorizedUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("authorized_users") + .addPathSegment(id); + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/authorizedusers/AuthorizedUsersClient.java b/src/main/java/com/whop/api/resources/authorizedusers/AuthorizedUsersClient.java new file mode 100644 index 00000000..f3f3ff5e --- /dev/null +++ b/src/main/java/com/whop/api/resources/authorizedusers/AuthorizedUsersClient.java @@ -0,0 +1,197 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.authorizedusers; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.authorizedusers.requests.CreateAuthorizedUsersRequest; +import com.whop.api.resources.authorizedusers.requests.DeleteAuthorizedUsersRequest; +import com.whop.api.resources.authorizedusers.requests.ListAuthorizedUsersRequest; +import com.whop.api.resources.authorizedusers.requests.RetrieveAuthorizedUsersRequest; +import com.whop.api.types.AuthorizedUser; +import com.whop.api.types.AuthorizedUserListItem; + +public class AuthorizedUsersClient { + protected final ClientOptions clientOptions; + + private final RawAuthorizedUsersClient rawClient; + + public AuthorizedUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAuthorizedUsersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAuthorizedUsersClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public SyncPagingIterable list(ListAuthorizedUsersRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public SyncPagingIterable list( + ListAuthorizedUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Add a new authorized user to a company. + *

Required permissions:

+ *
    + *
  • authorized_user:create
  • + *
  • member:email:read
  • + *
+ */ + public AuthorizedUser create(CreateAuthorizedUsersRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Add a new authorized user to a company. + *

Required permissions:

+ *
    + *
  • authorized_user:create
  • + *
  • member:email:read
  • + *
+ */ + public AuthorizedUser create(CreateAuthorizedUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public AuthorizedUser retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public AuthorizedUser retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public AuthorizedUser retrieve(String id, RetrieveAuthorizedUsersRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public AuthorizedUser retrieve(String id, RetrieveAuthorizedUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public boolean delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public boolean delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public boolean delete(String id, DeleteAuthorizedUsersRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public boolean delete(String id, DeleteAuthorizedUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/authorizedusers/RawAuthorizedUsersClient.java b/src/main/java/com/whop/api/resources/authorizedusers/RawAuthorizedUsersClient.java new file mode 100644 index 00000000..2f5d88cc --- /dev/null +++ b/src/main/java/com/whop/api/resources/authorizedusers/RawAuthorizedUsersClient.java @@ -0,0 +1,504 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.authorizedusers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.authorizedusers.requests.CreateAuthorizedUsersRequest; +import com.whop.api.resources.authorizedusers.requests.DeleteAuthorizedUsersRequest; +import com.whop.api.resources.authorizedusers.requests.ListAuthorizedUsersRequest; +import com.whop.api.resources.authorizedusers.requests.RetrieveAuthorizedUsersRequest; +import com.whop.api.resources.authorizedusers.types.ListAuthorizedUsersResponse; +import com.whop.api.types.AuthorizedUser; +import com.whop.api.types.AuthorizedUserListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAuthorizedUsersClient { + protected final ClientOptions clientOptions; + + public RawAuthorizedUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse> list() { + return list(ListAuthorizedUsersRequest.builder().build()); + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListAuthorizedUsersRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListAuthorizedUsersRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of authorized team members for a company, with optional filtering by user, role, and creation date. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListAuthorizedUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("authorized_users"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getRole().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "role", request.getRole().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListAuthorizedUsersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAuthorizedUsersResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListAuthorizedUsersRequest nextRequest = ListAuthorizedUsersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Add a new authorized user to a company. + *

Required permissions:

+ *
    + *
  • authorized_user:create
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse create(CreateAuthorizedUsersRequest request) { + return create(request, null); + } + + /** + * Add a new authorized user to a company. + *

Required permissions:

+ *
    + *
  • authorized_user:create
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse create( + CreateAuthorizedUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("authorized_users"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AuthorizedUser.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveAuthorizedUsersRequest.builder().build()); + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveAuthorizedUsersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveAuthorizedUsersRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing authorized user. + *

Required permissions:

+ *
    + *
  • company:authorized_user:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveAuthorizedUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("authorized_users") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AuthorizedUser.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteAuthorizedUsersRequest.builder().build()); + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteAuthorizedUsersRequest.builder().build(), requestOptions); + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public WhopApiHttpResponse delete(String id, DeleteAuthorizedUsersRequest request) { + return delete(id, request, null); + } + + /** + * Remove an authorized user from a company. + *

Required permissions:

+ *
    + *
  • authorized_user:delete
  • + *
+ */ + public WhopApiHttpResponse delete( + String id, DeleteAuthorizedUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("authorized_users") + .addPathSegment(id); + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/authorizedusers/requests/CreateAuthorizedUsersRequest.java b/src/main/java/com/whop/api/resources/authorizedusers/requests/CreateAuthorizedUsersRequest.java new file mode 100644 index 00000000..8b4f2cdb --- /dev/null +++ b/src/main/java/com/whop/api/resources/authorizedusers/requests/CreateAuthorizedUsersRequest.java @@ -0,0 +1,349 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.authorizedusers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.authorizedusers.types.CreateAuthorizedUsersRequestElevation; +import com.whop.api.types.GrantableAuthorizedUserRoles; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAuthorizedUsersRequest.Builder.class) +public final class CreateAuthorizedUsersRequest { + private final String companyId; + + private final Optional elevation; + + private final GrantableAuthorizedUserRoles role; + + private final Optional sendEmails; + + private final String userId; + + private final Map additionalProperties; + + private CreateAuthorizedUsersRequest( + String companyId, + Optional elevation, + GrantableAuthorizedUserRoles role, + Optional sendEmails, + String userId, + Map additionalProperties) { + this.companyId = companyId; + this.elevation = elevation; + this.role = role; + this.sendEmails = sendEmails; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the company to add the authorized user to. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return Re-authentication proof required to perform this sensitive action. + */ + @JsonIgnore + public Optional getElevation() { + if (elevation == null) { + return Optional.empty(); + } + return elevation; + } + + /** + * @return The role to assign to the authorized user within the company. Supported roles: 'moderator', 'sales_manager'. + */ + @JsonProperty("role") + public GrantableAuthorizedUserRoles getRole() { + return role; + } + + /** + * @return Whether to send notification emails to the user on creation. + */ + @JsonIgnore + public Optional getSendEmails() { + if (sendEmails == null) { + return Optional.empty(); + } + return sendEmails; + } + + /** + * @return The ID of the user to add as an authorized user. + */ + @JsonProperty("user_id") + public String getUserId() { + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("elevation") + private Optional _getElevation() { + return elevation; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("send_emails") + private Optional _getSendEmails() { + return sendEmails; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAuthorizedUsersRequest && equalTo((CreateAuthorizedUsersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAuthorizedUsersRequest other) { + return companyId.equals(other.companyId) + && elevation.equals(other.elevation) + && role.equals(other.role) + && sendEmails.equals(other.sendEmails) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.elevation, this.role, this.sendEmails, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The ID of the company to add the authorized user to.

+ */ + RoleStage companyId(@NotNull String companyId); + + Builder from(CreateAuthorizedUsersRequest other); + } + + public interface RoleStage { + /** + *

The role to assign to the authorized user within the company. Supported roles: 'moderator', 'sales_manager'.

+ */ + UserIdStage role(@NotNull GrantableAuthorizedUserRoles role); + } + + public interface UserIdStage { + /** + *

The ID of the user to add as an authorized user.

+ */ + _FinalStage userId(@NotNull String userId); + } + + public interface _FinalStage { + CreateAuthorizedUsersRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Re-authentication proof required to perform this sensitive action.

+ */ + _FinalStage elevation(Optional elevation); + + _FinalStage elevation(CreateAuthorizedUsersRequestElevation elevation); + + _FinalStage elevation(Nullable elevation); + + /** + *

Whether to send notification emails to the user on creation.

+ */ + _FinalStage sendEmails(Optional sendEmails); + + _FinalStage sendEmails(Boolean sendEmails); + + _FinalStage sendEmails(Nullable sendEmails); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, RoleStage, UserIdStage, _FinalStage { + private String companyId; + + private GrantableAuthorizedUserRoles role; + + private String userId; + + private Optional sendEmails = Optional.empty(); + + private Optional elevation = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAuthorizedUsersRequest other) { + companyId(other.getCompanyId()); + elevation(other.getElevation()); + role(other.getRole()); + sendEmails(other.getSendEmails()); + userId(other.getUserId()); + return this; + } + + /** + *

The ID of the company to add the authorized user to.

+ *

The ID of the company to add the authorized user to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public RoleStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The role to assign to the authorized user within the company. Supported roles: 'moderator', 'sales_manager'.

+ *

The role to assign to the authorized user within the company. Supported roles: 'moderator', 'sales_manager'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("role") + public UserIdStage role(@NotNull GrantableAuthorizedUserRoles role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + /** + *

The ID of the user to add as an authorized user.

+ *

The ID of the user to add as an authorized user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user_id") + public _FinalStage userId(@NotNull String userId) { + this.userId = Objects.requireNonNull(userId, "userId must not be null"); + return this; + } + + /** + *

Whether to send notification emails to the user on creation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sendEmails(Nullable sendEmails) { + if (sendEmails.isNull()) { + this.sendEmails = null; + } else if (sendEmails.isEmpty()) { + this.sendEmails = Optional.empty(); + } else { + this.sendEmails = Optional.of(sendEmails.get()); + } + return this; + } + + /** + *

Whether to send notification emails to the user on creation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sendEmails(Boolean sendEmails) { + this.sendEmails = Optional.ofNullable(sendEmails); + return this; + } + + /** + *

Whether to send notification emails to the user on creation.

+ */ + @java.lang.Override + @JsonSetter(value = "send_emails", nulls = Nulls.SKIP) + public _FinalStage sendEmails(Optional sendEmails) { + this.sendEmails = sendEmails; + return this; + } + + /** + *

Re-authentication proof required to perform this sensitive action.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage elevation(Nullable elevation) { + if (elevation.isNull()) { + this.elevation = null; + } else if (elevation.isEmpty()) { + this.elevation = Optional.empty(); + } else { + this.elevation = Optional.of(elevation.get()); + } + return this; + } + + /** + *

Re-authentication proof required to perform this sensitive action.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage elevation(CreateAuthorizedUsersRequestElevation elevation) { + this.elevation = Optional.ofNullable(elevation); + return this; + } + + /** + *

Re-authentication proof required to perform this sensitive action.

+ */ + @java.lang.Override + @JsonSetter(value = "elevation", nulls = Nulls.SKIP) + public _FinalStage elevation(Optional elevation) { + this.elevation = elevation; + return this; + } + + @java.lang.Override + public CreateAuthorizedUsersRequest build() { + return new CreateAuthorizedUsersRequest( + companyId, elevation, role, sendEmails, userId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/authorizedusers/requests/DeleteAuthorizedUsersRequest.java b/src/main/java/com/whop/api/resources/authorizedusers/requests/DeleteAuthorizedUsersRequest.java new file mode 100644 index 00000000..0264c395 --- /dev/null +++ b/src/main/java/com/whop/api/resources/authorizedusers/requests/DeleteAuthorizedUsersRequest.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.authorizedusers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteAuthorizedUsersRequest.Builder.class) +public final class DeleteAuthorizedUsersRequest { + private final Optional companyId; + + private final Map additionalProperties; + + private DeleteAuthorizedUsersRequest(Optional companyId, Map additionalProperties) { + this.companyId = companyId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the company the authorized user belongs to. Optional if the authorized user ID is provided. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteAuthorizedUsersRequest && equalTo((DeleteAuthorizedUsersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteAuthorizedUsersRequest other) { + return companyId.equals(other.companyId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional companyId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteAuthorizedUsersRequest other) { + companyId(other.getCompanyId()); + return this; + } + + /** + *

The ID of the company the authorized user belongs to. Optional if the authorized user ID is provided.

+ */ + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + public DeleteAuthorizedUsersRequest build() { + return new DeleteAuthorizedUsersRequest(companyId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/authorizedusers/requests/ListAuthorizedUsersRequest.java b/src/main/java/com/whop/api/resources/authorizedusers/requests/ListAuthorizedUsersRequest.java new file mode 100644 index 00000000..6d9b6bd8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/authorizedusers/requests/ListAuthorizedUsersRequest.java @@ -0,0 +1,368 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.authorizedusers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AuthorizedUserRoles; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAuthorizedUsersRequest.Builder.class) +public final class ListAuthorizedUsersRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Optional companyId; + + private final Optional userId; + + private final Optional role; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Map additionalProperties; + + private ListAuthorizedUsersRequest( + Optional after, + Optional before, + Optional first, + Optional last, + Optional companyId, + Optional userId, + Optional role, + Optional createdBefore, + Optional createdAfter, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.userId = userId; + this.role = role; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to list authorized users for. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + /** + * @return Filter results to a specific user to check if they are an authorized team member. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @JsonProperty("role") + public Optional getRole() { + return role; + } + + /** + * @return Only return authorized users created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return authorized users created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAuthorizedUsersRequest && equalTo((ListAuthorizedUsersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAuthorizedUsersRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId) + && userId.equals(other.userId) + && role.equals(other.role) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.after, + this.before, + this.first, + this.last, + this.companyId, + this.userId, + this.role, + this.createdBefore, + this.createdAfter); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional companyId = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional role = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListAuthorizedUsersRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + userId(other.getUserId()); + role(other.getRole()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The unique identifier of the company to list authorized users for.

+ */ + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + /** + *

Filter results to a specific user to check if they are an authorized team member.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + @JsonSetter(value = "role", nulls = Nulls.SKIP) + public Builder role(Optional role) { + this.role = role; + return this; + } + + public Builder role(AuthorizedUserRoles role) { + this.role = Optional.ofNullable(role); + return this; + } + + /** + *

Only return authorized users created before this timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return authorized users created after this timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + public ListAuthorizedUsersRequest build() { + return new ListAuthorizedUsersRequest( + after, + before, + first, + last, + companyId, + userId, + role, + createdBefore, + createdAfter, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/authorizedusers/requests/RetrieveAuthorizedUsersRequest.java b/src/main/java/com/whop/api/resources/authorizedusers/requests/RetrieveAuthorizedUsersRequest.java new file mode 100644 index 00000000..c26ba04c --- /dev/null +++ b/src/main/java/com/whop/api/resources/authorizedusers/requests/RetrieveAuthorizedUsersRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.authorizedusers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveAuthorizedUsersRequest.Builder.class) +public final class RetrieveAuthorizedUsersRequest { + private final Map additionalProperties; + + private RetrieveAuthorizedUsersRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveAuthorizedUsersRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveAuthorizedUsersRequest other) { + return this; + } + + public RetrieveAuthorizedUsersRequest build() { + return new RetrieveAuthorizedUsersRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/authorizedusers/types/CreateAuthorizedUsersRequestElevation.java b/src/main/java/com/whop/api/resources/authorizedusers/types/CreateAuthorizedUsersRequestElevation.java new file mode 100644 index 00000000..3b9bd073 --- /dev/null +++ b/src/main/java/com/whop/api/resources/authorizedusers/types/CreateAuthorizedUsersRequestElevation.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.authorizedusers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAuthorizedUsersRequestElevation.Builder.class) +public final class CreateAuthorizedUsersRequestElevation { + private final Optional authenticatorData; + + private final Optional clientDataJson; + + private final Optional credentialId; + + private final Optional emailCode; + + private final Optional signature; + + private final Optional totpCode; + + private final Optional useFinanceSession; + + private final Map additionalProperties; + + private CreateAuthorizedUsersRequestElevation( + Optional authenticatorData, + Optional clientDataJson, + Optional credentialId, + Optional emailCode, + Optional signature, + Optional totpCode, + Optional useFinanceSession, + Map additionalProperties) { + this.authenticatorData = authenticatorData; + this.clientDataJson = clientDataJson; + this.credentialId = credentialId; + this.emailCode = emailCode; + this.signature = signature; + this.totpCode = totpCode; + this.useFinanceSession = useFinanceSession; + this.additionalProperties = additionalProperties; + } + + /** + * @return The WebAuthn authenticator data (base64). + */ + @JsonIgnore + public Optional getAuthenticatorData() { + if (authenticatorData == null) { + return Optional.empty(); + } + return authenticatorData; + } + + /** + * @return The WebAuthn client data JSON (base64). + */ + @JsonIgnore + public Optional getClientDataJson() { + if (clientDataJson == null) { + return Optional.empty(); + } + return clientDataJson; + } + + /** + * @return The WebAuthn credential ID (base64). + */ + @JsonIgnore + public Optional getCredentialId() { + if (credentialId == null) { + return Optional.empty(); + } + return credentialId; + } + + /** + * @return The 6-digit code emailed to the user. + */ + @JsonIgnore + public Optional getEmailCode() { + if (emailCode == null) { + return Optional.empty(); + } + return emailCode; + } + + /** + * @return The WebAuthn signature (base64). + */ + @JsonIgnore + public Optional getSignature() { + if (signature == null) { + return Optional.empty(); + } + return signature; + } + + /** + * @return The 6-digit code from the authenticator app or SMS. + */ + @JsonIgnore + public Optional getTotpCode() { + if (totpCode == null) { + return Optional.empty(); + } + return totpCode; + } + + /** + * @return Reuse an existing elevated session (for SMS/email 2FA users). + */ + @JsonIgnore + public Optional getUseFinanceSession() { + if (useFinanceSession == null) { + return Optional.empty(); + } + return useFinanceSession; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("authenticator_data") + private Optional _getAuthenticatorData() { + return authenticatorData; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("client_data_json") + private Optional _getClientDataJson() { + return clientDataJson; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("credential_id") + private Optional _getCredentialId() { + return credentialId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email_code") + private Optional _getEmailCode() { + return emailCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("signature") + private Optional _getSignature() { + return signature; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("totp_code") + private Optional _getTotpCode() { + return totpCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("use_finance_session") + private Optional _getUseFinanceSession() { + return useFinanceSession; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAuthorizedUsersRequestElevation + && equalTo((CreateAuthorizedUsersRequestElevation) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAuthorizedUsersRequestElevation other) { + return authenticatorData.equals(other.authenticatorData) + && clientDataJson.equals(other.clientDataJson) + && credentialId.equals(other.credentialId) + && emailCode.equals(other.emailCode) + && signature.equals(other.signature) + && totpCode.equals(other.totpCode) + && useFinanceSession.equals(other.useFinanceSession); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.authenticatorData, + this.clientDataJson, + this.credentialId, + this.emailCode, + this.signature, + this.totpCode, + this.useFinanceSession); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional authenticatorData = Optional.empty(); + + private Optional clientDataJson = Optional.empty(); + + private Optional credentialId = Optional.empty(); + + private Optional emailCode = Optional.empty(); + + private Optional signature = Optional.empty(); + + private Optional totpCode = Optional.empty(); + + private Optional useFinanceSession = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAuthorizedUsersRequestElevation other) { + authenticatorData(other.getAuthenticatorData()); + clientDataJson(other.getClientDataJson()); + credentialId(other.getCredentialId()); + emailCode(other.getEmailCode()); + signature(other.getSignature()); + totpCode(other.getTotpCode()); + useFinanceSession(other.getUseFinanceSession()); + return this; + } + + /** + *

The WebAuthn authenticator data (base64).

+ */ + @JsonSetter(value = "authenticator_data", nulls = Nulls.SKIP) + public Builder authenticatorData(Optional authenticatorData) { + this.authenticatorData = authenticatorData; + return this; + } + + public Builder authenticatorData(String authenticatorData) { + this.authenticatorData = Optional.ofNullable(authenticatorData); + return this; + } + + public Builder authenticatorData(Nullable authenticatorData) { + if (authenticatorData.isNull()) { + this.authenticatorData = null; + } else if (authenticatorData.isEmpty()) { + this.authenticatorData = Optional.empty(); + } else { + this.authenticatorData = Optional.of(authenticatorData.get()); + } + return this; + } + + /** + *

The WebAuthn client data JSON (base64).

+ */ + @JsonSetter(value = "client_data_json", nulls = Nulls.SKIP) + public Builder clientDataJson(Optional clientDataJson) { + this.clientDataJson = clientDataJson; + return this; + } + + public Builder clientDataJson(String clientDataJson) { + this.clientDataJson = Optional.ofNullable(clientDataJson); + return this; + } + + public Builder clientDataJson(Nullable clientDataJson) { + if (clientDataJson.isNull()) { + this.clientDataJson = null; + } else if (clientDataJson.isEmpty()) { + this.clientDataJson = Optional.empty(); + } else { + this.clientDataJson = Optional.of(clientDataJson.get()); + } + return this; + } + + /** + *

The WebAuthn credential ID (base64).

+ */ + @JsonSetter(value = "credential_id", nulls = Nulls.SKIP) + public Builder credentialId(Optional credentialId) { + this.credentialId = credentialId; + return this; + } + + public Builder credentialId(String credentialId) { + this.credentialId = Optional.ofNullable(credentialId); + return this; + } + + public Builder credentialId(Nullable credentialId) { + if (credentialId.isNull()) { + this.credentialId = null; + } else if (credentialId.isEmpty()) { + this.credentialId = Optional.empty(); + } else { + this.credentialId = Optional.of(credentialId.get()); + } + return this; + } + + /** + *

The 6-digit code emailed to the user.

+ */ + @JsonSetter(value = "email_code", nulls = Nulls.SKIP) + public Builder emailCode(Optional emailCode) { + this.emailCode = emailCode; + return this; + } + + public Builder emailCode(String emailCode) { + this.emailCode = Optional.ofNullable(emailCode); + return this; + } + + public Builder emailCode(Nullable emailCode) { + if (emailCode.isNull()) { + this.emailCode = null; + } else if (emailCode.isEmpty()) { + this.emailCode = Optional.empty(); + } else { + this.emailCode = Optional.of(emailCode.get()); + } + return this; + } + + /** + *

The WebAuthn signature (base64).

+ */ + @JsonSetter(value = "signature", nulls = Nulls.SKIP) + public Builder signature(Optional signature) { + this.signature = signature; + return this; + } + + public Builder signature(String signature) { + this.signature = Optional.ofNullable(signature); + return this; + } + + public Builder signature(Nullable signature) { + if (signature.isNull()) { + this.signature = null; + } else if (signature.isEmpty()) { + this.signature = Optional.empty(); + } else { + this.signature = Optional.of(signature.get()); + } + return this; + } + + /** + *

The 6-digit code from the authenticator app or SMS.

+ */ + @JsonSetter(value = "totp_code", nulls = Nulls.SKIP) + public Builder totpCode(Optional totpCode) { + this.totpCode = totpCode; + return this; + } + + public Builder totpCode(String totpCode) { + this.totpCode = Optional.ofNullable(totpCode); + return this; + } + + public Builder totpCode(Nullable totpCode) { + if (totpCode.isNull()) { + this.totpCode = null; + } else if (totpCode.isEmpty()) { + this.totpCode = Optional.empty(); + } else { + this.totpCode = Optional.of(totpCode.get()); + } + return this; + } + + /** + *

Reuse an existing elevated session (for SMS/email 2FA users).

+ */ + @JsonSetter(value = "use_finance_session", nulls = Nulls.SKIP) + public Builder useFinanceSession(Optional useFinanceSession) { + this.useFinanceSession = useFinanceSession; + return this; + } + + public Builder useFinanceSession(Boolean useFinanceSession) { + this.useFinanceSession = Optional.ofNullable(useFinanceSession); + return this; + } + + public Builder useFinanceSession(Nullable useFinanceSession) { + if (useFinanceSession.isNull()) { + this.useFinanceSession = null; + } else if (useFinanceSession.isEmpty()) { + this.useFinanceSession = Optional.empty(); + } else { + this.useFinanceSession = Optional.of(useFinanceSession.get()); + } + return this; + } + + public CreateAuthorizedUsersRequestElevation build() { + return new CreateAuthorizedUsersRequestElevation( + authenticatorData, + clientDataJson, + credentialId, + emailCode, + signature, + totpCode, + useFinanceSession, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/authorizedusers/types/ListAuthorizedUsersResponse.java b/src/main/java/com/whop/api/resources/authorizedusers/types/ListAuthorizedUsersResponse.java new file mode 100644 index 00000000..bd11e4b8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/authorizedusers/types/ListAuthorizedUsersResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.authorizedusers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AuthorizedUserListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAuthorizedUsersResponse.Builder.class) +public final class ListAuthorizedUsersResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListAuthorizedUsersResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAuthorizedUsersResponse && equalTo((ListAuthorizedUsersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAuthorizedUsersResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListAuthorizedUsersResponse other); + } + + public interface _FinalStage { + ListAuthorizedUsersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(AuthorizedUserListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAuthorizedUsersResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(AuthorizedUserListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListAuthorizedUsersResponse build() { + return new ListAuthorizedUsersResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/AsyncBountiesClient.java b/src/main/java/com/whop/api/resources/bounties/AsyncBountiesClient.java new file mode 100644 index 00000000..b3b2a4a1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/AsyncBountiesClient.java @@ -0,0 +1,172 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.bounties.requests.CancelBountiesRequest; +import com.whop.api.resources.bounties.requests.CreateBountiesRequest; +import com.whop.api.resources.bounties.requests.ListBountiesRequest; +import com.whop.api.resources.bounties.requests.RetrieveBountiesRequest; +import com.whop.api.resources.bounties.requests.UpdateBountiesRequest; +import com.whop.api.resources.bounties.submissions.AsyncSubmissionsClient; +import com.whop.api.types.Bounty; +import com.whop.api.types.BountyListItem; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class AsyncBountiesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawBountiesClient rawClient; + + protected final Supplier submissionsClient; + + public AsyncBountiesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawBountiesClient(clientOptions); + this.submissionsClient = Suppliers.memoize(() -> new AsyncSubmissionsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawBountiesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public CompletableFuture> list(ListBountiesRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public CompletableFuture> list( + ListBountiesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates a bounty and escrows its reward pool. Publishes immediately, or as a scheduled draft when you set publish_at. + */ + public CompletableFuture create(CreateBountiesRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Creates a bounty and escrows its reward pool. Publishes immediately, or as a scheduled draft when you set publish_at. + */ + public CompletableFuture create(CreateBountiesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public CompletableFuture retrieve(String id, RetrieveBountiesRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public CompletableFuture retrieve( + String id, RetrieveBountiesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public CompletableFuture update(String id, UpdateBountiesRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public CompletableFuture update(String id, UpdateBountiesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public CompletableFuture cancel(String id) { + return this.rawClient.cancel(id).thenApply(response -> response.body()); + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public CompletableFuture cancel(String id, RequestOptions requestOptions) { + return this.rawClient.cancel(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public CompletableFuture cancel(String id, CancelBountiesRequest request) { + return this.rawClient.cancel(id, request).thenApply(response -> response.body()); + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public CompletableFuture cancel(String id, CancelBountiesRequest request, RequestOptions requestOptions) { + return this.rawClient.cancel(id, request, requestOptions).thenApply(response -> response.body()); + } + + public AsyncSubmissionsClient submissions() { + return this.submissionsClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/AsyncRawBountiesClient.java b/src/main/java/com/whop/api/resources/bounties/AsyncRawBountiesClient.java new file mode 100644 index 00000000..e2370cf8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/AsyncRawBountiesClient.java @@ -0,0 +1,590 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.bounties.requests.CancelBountiesRequest; +import com.whop.api.resources.bounties.requests.CreateBountiesRequest; +import com.whop.api.resources.bounties.requests.ListBountiesRequest; +import com.whop.api.resources.bounties.requests.RetrieveBountiesRequest; +import com.whop.api.resources.bounties.requests.UpdateBountiesRequest; +import com.whop.api.resources.bounties.types.ListBountiesResponse; +import com.whop.api.types.Bounty; +import com.whop.api.types.BountyListItem; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawBountiesClient { + protected final ClientOptions clientOptions; + + public AsyncRawBountiesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public CompletableFuture>> list() { + return list(ListBountiesRequest.builder().build()); + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListBountiesRequest.builder().build(), requestOptions); + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public CompletableFuture>> list( + ListBountiesRequest request) { + return list(request, null); + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public CompletableFuture>> list( + ListBountiesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounties"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getBusinessGoalType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "business_goal_type", request.getBusinessGoalType().get(), false); + } + if (request.getCountry().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "country", request.getCountry().get(), false); + } + if (request.getExperienceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "experience_id", request.getExperienceId().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListBountiesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListBountiesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListBountiesRequest nextRequest = ListBountiesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates a bounty and escrows its reward pool. Publishes immediately, or as a scheduled draft when you set publish_at. + */ + public CompletableFuture> create(CreateBountiesRequest request) { + return create(request, null); + } + + /** + * Creates a bounty and escrows its reward pool. Publishes immediately, or as a scheduled draft when you set publish_at. + */ + public CompletableFuture> create( + CreateBountiesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounties"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Bounty.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveBountiesRequest.builder().build()); + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveBountiesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public CompletableFuture> retrieve(String id, RetrieveBountiesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public CompletableFuture> retrieve( + String id, RetrieveBountiesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounties") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Bounty.class), response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateBountiesRequest.builder().build()); + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateBountiesRequest.builder().build(), requestOptions); + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public CompletableFuture> update(String id, UpdateBountiesRequest request) { + return update(id, request, null); + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public CompletableFuture> update( + String id, UpdateBountiesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounties") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Bounty.class), response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public CompletableFuture> cancel(String id) { + return cancel(id, CancelBountiesRequest.builder().build()); + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public CompletableFuture> cancel(String id, RequestOptions requestOptions) { + return cancel(id, CancelBountiesRequest.builder().build(), requestOptions); + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public CompletableFuture> cancel(String id, CancelBountiesRequest request) { + return cancel(id, request, null); + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public CompletableFuture> cancel( + String id, CancelBountiesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounties") + .addPathSegment(id) + .addPathSegments("cancel"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Bounty.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/BountiesClient.java b/src/main/java/com/whop/api/resources/bounties/BountiesClient.java new file mode 100644 index 00000000..c0f99cb9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/BountiesClient.java @@ -0,0 +1,169 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.bounties.requests.CancelBountiesRequest; +import com.whop.api.resources.bounties.requests.CreateBountiesRequest; +import com.whop.api.resources.bounties.requests.ListBountiesRequest; +import com.whop.api.resources.bounties.requests.RetrieveBountiesRequest; +import com.whop.api.resources.bounties.requests.UpdateBountiesRequest; +import com.whop.api.resources.bounties.submissions.SubmissionsClient; +import com.whop.api.types.Bounty; +import com.whop.api.types.BountyListItem; +import java.util.function.Supplier; + +public class BountiesClient { + protected final ClientOptions clientOptions; + + private final RawBountiesClient rawClient; + + protected final Supplier submissionsClient; + + public BountiesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawBountiesClient(clientOptions); + this.submissionsClient = Suppliers.memoize(() -> new SubmissionsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawBountiesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public SyncPagingIterable list(ListBountiesRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public SyncPagingIterable list(ListBountiesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Creates a bounty and escrows its reward pool. Publishes immediately, or as a scheduled draft when you set publish_at. + */ + public Bounty create(CreateBountiesRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Creates a bounty and escrows its reward pool. Publishes immediately, or as a scheduled draft when you set publish_at. + */ + public Bounty create(CreateBountiesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public Bounty retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public Bounty retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public Bounty retrieve(String id, RetrieveBountiesRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public Bounty retrieve(String id, RetrieveBountiesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public Bounty update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public Bounty update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public Bounty update(String id, UpdateBountiesRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public Bounty update(String id, UpdateBountiesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public Bounty cancel(String id) { + return this.rawClient.cancel(id).body(); + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public Bounty cancel(String id, RequestOptions requestOptions) { + return this.rawClient.cancel(id, requestOptions).body(); + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public Bounty cancel(String id, CancelBountiesRequest request) { + return this.rawClient.cancel(id, request).body(); + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public Bounty cancel(String id, CancelBountiesRequest request, RequestOptions requestOptions) { + return this.rawClient.cancel(id, request, requestOptions).body(); + } + + public SubmissionsClient submissions() { + return this.submissionsClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/RawBountiesClient.java b/src/main/java/com/whop/api/resources/bounties/RawBountiesClient.java new file mode 100644 index 00000000..6354c06e --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/RawBountiesClient.java @@ -0,0 +1,485 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.bounties.requests.CancelBountiesRequest; +import com.whop.api.resources.bounties.requests.CreateBountiesRequest; +import com.whop.api.resources.bounties.requests.ListBountiesRequest; +import com.whop.api.resources.bounties.requests.RetrieveBountiesRequest; +import com.whop.api.resources.bounties.requests.UpdateBountiesRequest; +import com.whop.api.resources.bounties.types.ListBountiesResponse; +import com.whop.api.types.Bounty; +import com.whop.api.types.BountyListItem; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawBountiesClient { + protected final ClientOptions clientOptions; + + public RawBountiesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public WhopApiHttpResponse> list() { + return list(ListBountiesRequest.builder().build()); + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListBountiesRequest.builder().build(), requestOptions); + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public WhopApiHttpResponse> list(ListBountiesRequest request) { + return list(request, null); + } + + /** + * Lists bounties visible to the credential — for an account API key, the account's bounties including scheduled drafts; for a user token, the bounties the user can see and work. + */ + public WhopApiHttpResponse> list( + ListBountiesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounties"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getBusinessGoalType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "business_goal_type", request.getBusinessGoalType().get(), false); + } + if (request.getCountry().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "country", request.getCountry().get(), false); + } + if (request.getExperienceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "experience_id", request.getExperienceId().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListBountiesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListBountiesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListBountiesRequest nextRequest = ListBountiesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates a bounty and escrows its reward pool. Publishes immediately, or as a scheduled draft when you set publish_at. + */ + public WhopApiHttpResponse create(CreateBountiesRequest request) { + return create(request, null); + } + + /** + * Creates a bounty and escrows its reward pool. Publishes immediately, or as a scheduled draft when you set publish_at. + */ + public WhopApiHttpResponse create(CreateBountiesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounties"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Bounty.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveBountiesRequest.builder().build()); + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveBountiesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveBountiesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a bounty by ID. Authentication is optional: a request with no credential reads the bounty when it is publicly visible — published or completed, and not restricted to a private experience's members. Bounties outside the caller's scope, and bounties not publicly visible to an anonymous caller, return 404. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveBountiesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounties") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Bounty.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateBountiesRequest.builder().build()); + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateBountiesRequest.builder().build(), requestOptions); + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public WhopApiHttpResponse update(String id, UpdateBountiesRequest request) { + return update(id, request, null); + } + + /** + * Updates a bounty. A published bounty accepts title, description, and country targeting while it is still open with nothing under review. A scheduled (not-yet-published) draft additionally accepts the reward, winner slots, and schedule. + */ + public WhopApiHttpResponse update(String id, UpdateBountiesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounties") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Bounty.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public WhopApiHttpResponse cancel(String id) { + return cancel(id, CancelBountiesRequest.builder().build()); + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public WhopApiHttpResponse cancel(String id, RequestOptions requestOptions) { + return cancel(id, CancelBountiesRequest.builder().build(), requestOptions); + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public WhopApiHttpResponse cancel(String id, CancelBountiesRequest request) { + return cancel(id, request, null); + } + + /** + * Cancels a bounty. With no in-flight work, it cancels immediately and refunds the funder. Otherwise it stops new submissions and cancels once the in-flight work resolves and pays out. Repeating the request is a no-op. A bounty that already paid out every slot returns 400. + */ + public WhopApiHttpResponse cancel(String id, CancelBountiesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounties") + .addPathSegment(id) + .addPathSegments("cancel"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Bounty.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/requests/CancelBountiesRequest.java b/src/main/java/com/whop/api/resources/bounties/requests/CancelBountiesRequest.java new file mode 100644 index 00000000..951536c6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/requests/CancelBountiesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CancelBountiesRequest.Builder.class) +public final class CancelBountiesRequest { + private final Map additionalProperties; + + private CancelBountiesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CancelBountiesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CancelBountiesRequest other) { + return this; + } + + public CancelBountiesRequest build() { + return new CancelBountiesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/requests/CreateBountiesRequest.java b/src/main/java/com/whop/api/resources/bounties/requests/CreateBountiesRequest.java new file mode 100644 index 00000000..b1139e9b --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/requests/CreateBountiesRequest.java @@ -0,0 +1,856 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.bounties.types.CreateBountiesRequestBusinessGoalType; +import com.whop.api.resources.bounties.types.CreateBountiesRequestCaptureSpec; +import com.whop.api.resources.bounties.types.CreateBountiesRequestFrequency; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateBountiesRequest.Builder.class) +public final class CreateBountiesRequest { + private final Optional acceptedSubmissionsLimit; + + private final Optional acceptedSubmissionsPerUserLimit; + + private final Optional accountId; + + private final Optional> allowedCountryCodes; + + private final Optional businessGoalType; + + private final Optional captureSpec; + + private final String description; + + private final Optional experienceId; + + private final Optional frequency; + + private final double grossRewardAmount; + + private final Optional publishAt; + + private final Optional publishAtTimezone; + + private final String title; + + private final Map additionalProperties; + + private CreateBountiesRequest( + Optional acceptedSubmissionsLimit, + Optional acceptedSubmissionsPerUserLimit, + Optional accountId, + Optional> allowedCountryCodes, + Optional businessGoalType, + Optional captureSpec, + String description, + Optional experienceId, + Optional frequency, + double grossRewardAmount, + Optional publishAt, + Optional publishAtTimezone, + String title, + Map additionalProperties) { + this.acceptedSubmissionsLimit = acceptedSubmissionsLimit; + this.acceptedSubmissionsPerUserLimit = acceptedSubmissionsPerUserLimit; + this.accountId = accountId; + this.allowedCountryCodes = allowedCountryCodes; + this.businessGoalType = businessGoalType; + this.captureSpec = captureSpec; + this.description = description; + this.experienceId = experienceId; + this.frequency = frequency; + this.grossRewardAmount = grossRewardAmount; + this.publishAt = publishAt; + this.publishAtTimezone = publishAtTimezone; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Number of submissions that can be accepted (winner slots). Defaults to 1. The escrowed total is gross_reward_amount times this limit and must be at least $5. + */ + @JsonIgnore + public Optional getAcceptedSubmissionsLimit() { + if (acceptedSubmissionsLimit == null) { + return Optional.empty(); + } + return acceptedSubmissionsLimit; + } + + /** + * @return How many winner slots one worker can win. Defaults to 1. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed accepted_submissions_limit. + */ + @JsonIgnore + public Optional getAcceptedSubmissionsPerUserLimit() { + if (acceptedSubmissionsPerUserLimit == null) { + return Optional.empty(); + } + return acceptedSubmissionsPerUserLimit; + } + + /** + * @return Account whose balance funds the bounty pool (biz_ tag). Defaults to the caller's personal balance. Requires permission to move the account's funds. + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return Countries whose residents can work the bounty, as ISO 3166 alpha-2 codes. Empty means worldwide. + */ + @JsonIgnore + public Optional> getAllowedCountryCodes() { + if (allowedCountryCodes == null) { + return Optional.empty(); + } + return allowedCountryCodes; + } + + /** + * @return What the poster wants the work to achieve, declared once here. + */ + @JsonProperty("business_goal_type") + public Optional getBusinessGoalType() { + return businessGoalType; + } + + /** + * @return Per-bounty overrides of the served capture contract. Only accepted when business_goal_type is data_capture; omitted fields keep the platform defaults, and the resulting contract is echoed back as capture_spec on the bounty. + */ + @JsonProperty("capture_spec") + public Optional getCaptureSpec() { + return captureSpec; + } + + /** + * @return Full task instructions shown to workers. + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * @return Experience to host the bounty in (exp_ tag). Any visibility — public for an open bounty, private for an invited one. Required unless account_id is set, in which case the bounty anchors in that account's public forum. + */ + @JsonIgnore + public Optional getExperienceId() { + if (experienceId == null) { + return Optional.empty(); + } + return experienceId; + } + + /** + * @return How often the schedule creates a new bounty. Each occurrence is a separate bounty. Defaults to once; only applies with publish_at. + */ + @JsonProperty("frequency") + public Optional getFrequency() { + return frequency; + } + + /** + * @return Gross bounty-pool amount (USD) escrowed per accepted submission, in whole dollars. Platform fees and affiliate shares are paid from this amount. + */ + @JsonProperty("gross_reward_amount") + public double getGrossRewardAmount() { + return grossRewardAmount; + } + + /** + * @return ISO 8601 time to publish the bounty. When set, the bounty is created as a hidden draft and funded + published at this time instead of immediately. + */ + @JsonIgnore + public Optional getPublishAt() { + if (publishAt == null) { + return Optional.empty(); + } + return publishAt; + } + + /** + * @return IANA timezone for recurring occurrences. Required when publish_at is set. + */ + @JsonIgnore + public Optional getPublishAtTimezone() { + if (publishAtTimezone == null) { + return Optional.empty(); + } + return publishAtTimezone; + } + + /** + * @return Short name of the task shown to workers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("accepted_submissions_limit") + private Optional _getAcceptedSubmissionsLimit() { + return acceptedSubmissionsLimit; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("accepted_submissions_per_user_limit") + private Optional _getAcceptedSubmissionsPerUserLimit() { + return acceptedSubmissionsPerUserLimit; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("allowed_country_codes") + private Optional> _getAllowedCountryCodes() { + return allowedCountryCodes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("experience_id") + private Optional _getExperienceId() { + return experienceId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("publish_at") + private Optional _getPublishAt() { + return publishAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("publish_at_timezone") + private Optional _getPublishAtTimezone() { + return publishAtTimezone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateBountiesRequest && equalTo((CreateBountiesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateBountiesRequest other) { + return acceptedSubmissionsLimit.equals(other.acceptedSubmissionsLimit) + && acceptedSubmissionsPerUserLimit.equals(other.acceptedSubmissionsPerUserLimit) + && accountId.equals(other.accountId) + && allowedCountryCodes.equals(other.allowedCountryCodes) + && businessGoalType.equals(other.businessGoalType) + && captureSpec.equals(other.captureSpec) + && description.equals(other.description) + && experienceId.equals(other.experienceId) + && frequency.equals(other.frequency) + && grossRewardAmount == other.grossRewardAmount + && publishAt.equals(other.publishAt) + && publishAtTimezone.equals(other.publishAtTimezone) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.acceptedSubmissionsLimit, + this.acceptedSubmissionsPerUserLimit, + this.accountId, + this.allowedCountryCodes, + this.businessGoalType, + this.captureSpec, + this.description, + this.experienceId, + this.frequency, + this.grossRewardAmount, + this.publishAt, + this.publishAtTimezone, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DescriptionStage builder() { + return new Builder(); + } + + public interface DescriptionStage { + /** + *

Full task instructions shown to workers.

+ */ + GrossRewardAmountStage description(@NotNull String description); + + Builder from(CreateBountiesRequest other); + } + + public interface GrossRewardAmountStage { + /** + *

Gross bounty-pool amount (USD) escrowed per accepted submission, in whole dollars. Platform fees and affiliate shares are paid from this amount.

+ */ + TitleStage grossRewardAmount(double grossRewardAmount); + } + + public interface TitleStage { + /** + *

Short name of the task shown to workers.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + CreateBountiesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Number of submissions that can be accepted (winner slots). Defaults to 1. The escrowed total is gross_reward_amount times this limit and must be at least $5.

+ */ + _FinalStage acceptedSubmissionsLimit(Optional acceptedSubmissionsLimit); + + _FinalStage acceptedSubmissionsLimit(Integer acceptedSubmissionsLimit); + + _FinalStage acceptedSubmissionsLimit(Nullable acceptedSubmissionsLimit); + + /** + *

How many winner slots one worker can win. Defaults to 1. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed accepted_submissions_limit.

+ */ + _FinalStage acceptedSubmissionsPerUserLimit(Optional acceptedSubmissionsPerUserLimit); + + _FinalStage acceptedSubmissionsPerUserLimit(Integer acceptedSubmissionsPerUserLimit); + + _FinalStage acceptedSubmissionsPerUserLimit(Nullable acceptedSubmissionsPerUserLimit); + + /** + *

Account whose balance funds the bounty pool (biz_ tag). Defaults to the caller's personal balance. Requires permission to move the account's funds.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

Countries whose residents can work the bounty, as ISO 3166 alpha-2 codes. Empty means worldwide.

+ */ + _FinalStage allowedCountryCodes(Optional> allowedCountryCodes); + + _FinalStage allowedCountryCodes(List allowedCountryCodes); + + _FinalStage allowedCountryCodes(Nullable> allowedCountryCodes); + + /** + *

What the poster wants the work to achieve, declared once here.

+ */ + _FinalStage businessGoalType(Optional businessGoalType); + + _FinalStage businessGoalType(CreateBountiesRequestBusinessGoalType businessGoalType); + + /** + *

Per-bounty overrides of the served capture contract. Only accepted when business_goal_type is data_capture; omitted fields keep the platform defaults, and the resulting contract is echoed back as capture_spec on the bounty.

+ */ + _FinalStage captureSpec(Optional captureSpec); + + _FinalStage captureSpec(CreateBountiesRequestCaptureSpec captureSpec); + + /** + *

Experience to host the bounty in (exp_ tag). Any visibility — public for an open bounty, private for an invited one. Required unless account_id is set, in which case the bounty anchors in that account's public forum.

+ */ + _FinalStage experienceId(Optional experienceId); + + _FinalStage experienceId(String experienceId); + + _FinalStage experienceId(Nullable experienceId); + + /** + *

How often the schedule creates a new bounty. Each occurrence is a separate bounty. Defaults to once; only applies with publish_at.

+ */ + _FinalStage frequency(Optional frequency); + + _FinalStage frequency(CreateBountiesRequestFrequency frequency); + + /** + *

ISO 8601 time to publish the bounty. When set, the bounty is created as a hidden draft and funded + published at this time instead of immediately.

+ */ + _FinalStage publishAt(Optional publishAt); + + _FinalStage publishAt(String publishAt); + + _FinalStage publishAt(Nullable publishAt); + + /** + *

IANA timezone for recurring occurrences. Required when publish_at is set.

+ */ + _FinalStage publishAtTimezone(Optional publishAtTimezone); + + _FinalStage publishAtTimezone(String publishAtTimezone); + + _FinalStage publishAtTimezone(Nullable publishAtTimezone); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DescriptionStage, GrossRewardAmountStage, TitleStage, _FinalStage { + private String description; + + private double grossRewardAmount; + + private String title; + + private Optional publishAtTimezone = Optional.empty(); + + private Optional publishAt = Optional.empty(); + + private Optional frequency = Optional.empty(); + + private Optional experienceId = Optional.empty(); + + private Optional captureSpec = Optional.empty(); + + private Optional businessGoalType = Optional.empty(); + + private Optional> allowedCountryCodes = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional acceptedSubmissionsPerUserLimit = Optional.empty(); + + private Optional acceptedSubmissionsLimit = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateBountiesRequest other) { + acceptedSubmissionsLimit(other.getAcceptedSubmissionsLimit()); + acceptedSubmissionsPerUserLimit(other.getAcceptedSubmissionsPerUserLimit()); + accountId(other.getAccountId()); + allowedCountryCodes(other.getAllowedCountryCodes()); + businessGoalType(other.getBusinessGoalType()); + captureSpec(other.getCaptureSpec()); + description(other.getDescription()); + experienceId(other.getExperienceId()); + frequency(other.getFrequency()); + grossRewardAmount(other.getGrossRewardAmount()); + publishAt(other.getPublishAt()); + publishAtTimezone(other.getPublishAtTimezone()); + title(other.getTitle()); + return this; + } + + /** + *

Full task instructions shown to workers.

+ *

Full task instructions shown to workers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("description") + public GrossRewardAmountStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + /** + *

Gross bounty-pool amount (USD) escrowed per accepted submission, in whole dollars. Platform fees and affiliate shares are paid from this amount.

+ *

Gross bounty-pool amount (USD) escrowed per accepted submission, in whole dollars. Platform fees and affiliate shares are paid from this amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("gross_reward_amount") + public TitleStage grossRewardAmount(double grossRewardAmount) { + this.grossRewardAmount = grossRewardAmount; + return this; + } + + /** + *

Short name of the task shown to workers.

+ *

Short name of the task shown to workers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

IANA timezone for recurring occurrences. Required when publish_at is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage publishAtTimezone(Nullable publishAtTimezone) { + if (publishAtTimezone.isNull()) { + this.publishAtTimezone = null; + } else if (publishAtTimezone.isEmpty()) { + this.publishAtTimezone = Optional.empty(); + } else { + this.publishAtTimezone = Optional.of(publishAtTimezone.get()); + } + return this; + } + + /** + *

IANA timezone for recurring occurrences. Required when publish_at is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage publishAtTimezone(String publishAtTimezone) { + this.publishAtTimezone = Optional.ofNullable(publishAtTimezone); + return this; + } + + /** + *

IANA timezone for recurring occurrences. Required when publish_at is set.

+ */ + @java.lang.Override + @JsonSetter(value = "publish_at_timezone", nulls = Nulls.SKIP) + public _FinalStage publishAtTimezone(Optional publishAtTimezone) { + this.publishAtTimezone = publishAtTimezone; + return this; + } + + /** + *

ISO 8601 time to publish the bounty. When set, the bounty is created as a hidden draft and funded + published at this time instead of immediately.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage publishAt(Nullable publishAt) { + if (publishAt.isNull()) { + this.publishAt = null; + } else if (publishAt.isEmpty()) { + this.publishAt = Optional.empty(); + } else { + this.publishAt = Optional.of(publishAt.get()); + } + return this; + } + + /** + *

ISO 8601 time to publish the bounty. When set, the bounty is created as a hidden draft and funded + published at this time instead of immediately.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage publishAt(String publishAt) { + this.publishAt = Optional.ofNullable(publishAt); + return this; + } + + /** + *

ISO 8601 time to publish the bounty. When set, the bounty is created as a hidden draft and funded + published at this time instead of immediately.

+ */ + @java.lang.Override + @JsonSetter(value = "publish_at", nulls = Nulls.SKIP) + public _FinalStage publishAt(Optional publishAt) { + this.publishAt = publishAt; + return this; + } + + /** + *

How often the schedule creates a new bounty. Each occurrence is a separate bounty. Defaults to once; only applies with publish_at.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frequency(CreateBountiesRequestFrequency frequency) { + this.frequency = Optional.ofNullable(frequency); + return this; + } + + /** + *

How often the schedule creates a new bounty. Each occurrence is a separate bounty. Defaults to once; only applies with publish_at.

+ */ + @java.lang.Override + @JsonSetter(value = "frequency", nulls = Nulls.SKIP) + public _FinalStage frequency(Optional frequency) { + this.frequency = frequency; + return this; + } + + /** + *

Experience to host the bounty in (exp_ tag). Any visibility — public for an open bounty, private for an invited one. Required unless account_id is set, in which case the bounty anchors in that account's public forum.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage experienceId(Nullable experienceId) { + if (experienceId.isNull()) { + this.experienceId = null; + } else if (experienceId.isEmpty()) { + this.experienceId = Optional.empty(); + } else { + this.experienceId = Optional.of(experienceId.get()); + } + return this; + } + + /** + *

Experience to host the bounty in (exp_ tag). Any visibility — public for an open bounty, private for an invited one. Required unless account_id is set, in which case the bounty anchors in that account's public forum.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage experienceId(String experienceId) { + this.experienceId = Optional.ofNullable(experienceId); + return this; + } + + /** + *

Experience to host the bounty in (exp_ tag). Any visibility — public for an open bounty, private for an invited one. Required unless account_id is set, in which case the bounty anchors in that account's public forum.

+ */ + @java.lang.Override + @JsonSetter(value = "experience_id", nulls = Nulls.SKIP) + public _FinalStage experienceId(Optional experienceId) { + this.experienceId = experienceId; + return this; + } + + /** + *

Per-bounty overrides of the served capture contract. Only accepted when business_goal_type is data_capture; omitted fields keep the platform defaults, and the resulting contract is echoed back as capture_spec on the bounty.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage captureSpec(CreateBountiesRequestCaptureSpec captureSpec) { + this.captureSpec = Optional.ofNullable(captureSpec); + return this; + } + + /** + *

Per-bounty overrides of the served capture contract. Only accepted when business_goal_type is data_capture; omitted fields keep the platform defaults, and the resulting contract is echoed back as capture_spec on the bounty.

+ */ + @java.lang.Override + @JsonSetter(value = "capture_spec", nulls = Nulls.SKIP) + public _FinalStage captureSpec(Optional captureSpec) { + this.captureSpec = captureSpec; + return this; + } + + /** + *

What the poster wants the work to achieve, declared once here.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessGoalType(CreateBountiesRequestBusinessGoalType businessGoalType) { + this.businessGoalType = Optional.ofNullable(businessGoalType); + return this; + } + + /** + *

What the poster wants the work to achieve, declared once here.

+ */ + @java.lang.Override + @JsonSetter(value = "business_goal_type", nulls = Nulls.SKIP) + public _FinalStage businessGoalType(Optional businessGoalType) { + this.businessGoalType = businessGoalType; + return this; + } + + /** + *

Countries whose residents can work the bounty, as ISO 3166 alpha-2 codes. Empty means worldwide.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage allowedCountryCodes(Nullable> allowedCountryCodes) { + if (allowedCountryCodes.isNull()) { + this.allowedCountryCodes = null; + } else if (allowedCountryCodes.isEmpty()) { + this.allowedCountryCodes = Optional.empty(); + } else { + this.allowedCountryCodes = Optional.of(allowedCountryCodes.get()); + } + return this; + } + + /** + *

Countries whose residents can work the bounty, as ISO 3166 alpha-2 codes. Empty means worldwide.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage allowedCountryCodes(List allowedCountryCodes) { + this.allowedCountryCodes = Optional.ofNullable(allowedCountryCodes); + return this; + } + + /** + *

Countries whose residents can work the bounty, as ISO 3166 alpha-2 codes. Empty means worldwide.

+ */ + @java.lang.Override + @JsonSetter(value = "allowed_country_codes", nulls = Nulls.SKIP) + public _FinalStage allowedCountryCodes(Optional> allowedCountryCodes) { + this.allowedCountryCodes = allowedCountryCodes; + return this; + } + + /** + *

Account whose balance funds the bounty pool (biz_ tag). Defaults to the caller's personal balance. Requires permission to move the account's funds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

Account whose balance funds the bounty pool (biz_ tag). Defaults to the caller's personal balance. Requires permission to move the account's funds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Account whose balance funds the bounty pool (biz_ tag). Defaults to the caller's personal balance. Requires permission to move the account's funds.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + /** + *

How many winner slots one worker can win. Defaults to 1. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed accepted_submissions_limit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage acceptedSubmissionsPerUserLimit(Nullable acceptedSubmissionsPerUserLimit) { + if (acceptedSubmissionsPerUserLimit.isNull()) { + this.acceptedSubmissionsPerUserLimit = null; + } else if (acceptedSubmissionsPerUserLimit.isEmpty()) { + this.acceptedSubmissionsPerUserLimit = Optional.empty(); + } else { + this.acceptedSubmissionsPerUserLimit = Optional.of(acceptedSubmissionsPerUserLimit.get()); + } + return this; + } + + /** + *

How many winner slots one worker can win. Defaults to 1. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed accepted_submissions_limit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage acceptedSubmissionsPerUserLimit(Integer acceptedSubmissionsPerUserLimit) { + this.acceptedSubmissionsPerUserLimit = Optional.ofNullable(acceptedSubmissionsPerUserLimit); + return this; + } + + /** + *

How many winner slots one worker can win. Defaults to 1. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed accepted_submissions_limit.

+ */ + @java.lang.Override + @JsonSetter(value = "accepted_submissions_per_user_limit", nulls = Nulls.SKIP) + public _FinalStage acceptedSubmissionsPerUserLimit(Optional acceptedSubmissionsPerUserLimit) { + this.acceptedSubmissionsPerUserLimit = acceptedSubmissionsPerUserLimit; + return this; + } + + /** + *

Number of submissions that can be accepted (winner slots). Defaults to 1. The escrowed total is gross_reward_amount times this limit and must be at least $5.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage acceptedSubmissionsLimit(Nullable acceptedSubmissionsLimit) { + if (acceptedSubmissionsLimit.isNull()) { + this.acceptedSubmissionsLimit = null; + } else if (acceptedSubmissionsLimit.isEmpty()) { + this.acceptedSubmissionsLimit = Optional.empty(); + } else { + this.acceptedSubmissionsLimit = Optional.of(acceptedSubmissionsLimit.get()); + } + return this; + } + + /** + *

Number of submissions that can be accepted (winner slots). Defaults to 1. The escrowed total is gross_reward_amount times this limit and must be at least $5.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage acceptedSubmissionsLimit(Integer acceptedSubmissionsLimit) { + this.acceptedSubmissionsLimit = Optional.ofNullable(acceptedSubmissionsLimit); + return this; + } + + /** + *

Number of submissions that can be accepted (winner slots). Defaults to 1. The escrowed total is gross_reward_amount times this limit and must be at least $5.

+ */ + @java.lang.Override + @JsonSetter(value = "accepted_submissions_limit", nulls = Nulls.SKIP) + public _FinalStage acceptedSubmissionsLimit(Optional acceptedSubmissionsLimit) { + this.acceptedSubmissionsLimit = acceptedSubmissionsLimit; + return this; + } + + @java.lang.Override + public CreateBountiesRequest build() { + return new CreateBountiesRequest( + acceptedSubmissionsLimit, + acceptedSubmissionsPerUserLimit, + accountId, + allowedCountryCodes, + businessGoalType, + captureSpec, + description, + experienceId, + frequency, + grossRewardAmount, + publishAt, + publishAtTimezone, + title, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/requests/ListBountiesRequest.java b/src/main/java/com/whop/api/resources/bounties/requests/ListBountiesRequest.java new file mode 100644 index 00000000..c0d607b6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/requests/ListBountiesRequest.java @@ -0,0 +1,568 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.bounties.types.ListBountiesRequestBusinessGoalType; +import com.whop.api.resources.bounties.types.ListBountiesRequestDirection; +import com.whop.api.resources.bounties.types.ListBountiesRequestOrder; +import com.whop.api.resources.bounties.types.ListBountiesRequestStatus; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBountiesRequest.Builder.class) +public final class ListBountiesRequest { + private final Optional accountId; + + private final Optional userId; + + private final Optional status; + + private final Optional businessGoalType; + + private final Optional country; + + private final Optional experienceId; + + private final Optional query; + + private final Optional createdAfter; + + private final Optional createdBefore; + + private final Optional order; + + private final Optional direction; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListBountiesRequest( + Optional accountId, + Optional userId, + Optional status, + Optional businessGoalType, + Optional country, + Optional experienceId, + Optional query, + Optional createdAfter, + Optional createdBefore, + Optional order, + Optional direction, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.accountId = accountId; + this.userId = userId; + this.status = status; + this.businessGoalType = businessGoalType; + this.country = country; + this.experienceId = experienceId; + this.query = query; + this.createdAfter = createdAfter; + this.createdBefore = createdBefore; + this.order = order; + this.direction = direction; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Scope the list to this account (biz_ tag). Requires read access to the account; account API keys may pass their own account or a connected account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return List the bounties this user participated in (user_ tag). Must be the authenticated user. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + /** + * @return Filter by lifecycle state. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Filter by the poster's declared goal. Bounties created before the goal taxonomy carry no goal and never match this filter. + */ + @JsonProperty("business_goal_type") + public Optional getBusinessGoalType() { + return businessGoalType; + } + + /** + * @return Only bounties workable from this country, as an ISO 3166-1 alpha-2 code. Bounties with no country targeting are workable worldwide and always match. + */ + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + /** + * @return Only bounties posted to this forum experience, prefixed exp_. An unknown experience, or one outside the caller's scope, matches nothing. + */ + @JsonProperty("experience_id") + public Optional getExperienceId() { + return experienceId; + } + + /** + * @return Substring match on the bounty title or ID. + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + /** + * @return Only bounties created after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Only bounties created before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Sort field. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Number of bounties to return from the start of the window. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to paginate forwards from. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return Number of bounties to return from the end of the window. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to paginate backwards from. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBountiesRequest && equalTo((ListBountiesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBountiesRequest other) { + return accountId.equals(other.accountId) + && userId.equals(other.userId) + && status.equals(other.status) + && businessGoalType.equals(other.businessGoalType) + && country.equals(other.country) + && experienceId.equals(other.experienceId) + && query.equals(other.query) + && createdAfter.equals(other.createdAfter) + && createdBefore.equals(other.createdBefore) + && order.equals(other.order) + && direction.equals(other.direction) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.userId, + this.status, + this.businessGoalType, + this.country, + this.experienceId, + this.query, + this.createdAfter, + this.createdBefore, + this.order, + this.direction, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional businessGoalType = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional experienceId = Optional.empty(); + + private Optional query = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListBountiesRequest other) { + accountId(other.getAccountId()); + userId(other.getUserId()); + status(other.getStatus()); + businessGoalType(other.getBusinessGoalType()); + country(other.getCountry()); + experienceId(other.getExperienceId()); + query(other.getQuery()); + createdAfter(other.getCreatedAfter()); + createdBefore(other.getCreatedBefore()); + order(other.getOrder()); + direction(other.getDirection()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

Scope the list to this account (biz_ tag). Requires read access to the account; account API keys may pass their own account or a connected account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

List the bounties this user participated in (user_ tag). Must be the authenticated user.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Filter by lifecycle state.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListBountiesRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Filter by the poster's declared goal. Bounties created before the goal taxonomy carry no goal and never match this filter.

+ */ + @JsonSetter(value = "business_goal_type", nulls = Nulls.SKIP) + public Builder businessGoalType(Optional businessGoalType) { + this.businessGoalType = businessGoalType; + return this; + } + + public Builder businessGoalType(ListBountiesRequestBusinessGoalType businessGoalType) { + this.businessGoalType = Optional.ofNullable(businessGoalType); + return this; + } + + /** + *

Only bounties workable from this country, as an ISO 3166-1 alpha-2 code. Bounties with no country targeting are workable worldwide and always match.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

Only bounties posted to this forum experience, prefixed exp_. An unknown experience, or one outside the caller's scope, matches nothing.

+ */ + @JsonSetter(value = "experience_id", nulls = Nulls.SKIP) + public Builder experienceId(Optional experienceId) { + this.experienceId = experienceId; + return this; + } + + public Builder experienceId(String experienceId) { + this.experienceId = Optional.ofNullable(experienceId); + return this; + } + + /** + *

Substring match on the bounty title or ID.

+ */ + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public Builder query(Optional query) { + this.query = query; + return this; + } + + public Builder query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + /** + *

Only bounties created after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only bounties created before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Sort field.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListBountiesRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListBountiesRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Number of bounties to return from the start of the window.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to paginate forwards from.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Number of bounties to return from the end of the window.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to paginate backwards from.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListBountiesRequest build() { + return new ListBountiesRequest( + accountId, + userId, + status, + businessGoalType, + country, + experienceId, + query, + createdAfter, + createdBefore, + order, + direction, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/requests/RetrieveBountiesRequest.java b/src/main/java/com/whop/api/resources/bounties/requests/RetrieveBountiesRequest.java new file mode 100644 index 00000000..210c4761 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/requests/RetrieveBountiesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveBountiesRequest.Builder.class) +public final class RetrieveBountiesRequest { + private final Map additionalProperties; + + private RetrieveBountiesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveBountiesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveBountiesRequest other) { + return this; + } + + public RetrieveBountiesRequest build() { + return new RetrieveBountiesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/requests/UpdateBountiesRequest.java b/src/main/java/com/whop/api/resources/bounties/requests/UpdateBountiesRequest.java new file mode 100644 index 00000000..8be6da15 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/requests/UpdateBountiesRequest.java @@ -0,0 +1,530 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.bounties.types.UpdateBountiesRequestBusinessGoalType; +import com.whop.api.resources.bounties.types.UpdateBountiesRequestFrequency; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateBountiesRequest.Builder.class) +public final class UpdateBountiesRequest { + private final Optional acceptedSubmissionsLimit; + + private final Optional acceptedSubmissionsPerUserLimit; + + private final Optional> allowedCountryCodes; + + private final Optional businessGoalType; + + private final Optional description; + + private final Optional frequency; + + private final Optional grossRewardAmount; + + private final Optional publishAt; + + private final Optional publishAtTimezone; + + private final Optional title; + + private final Map additionalProperties; + + private UpdateBountiesRequest( + Optional acceptedSubmissionsLimit, + Optional acceptedSubmissionsPerUserLimit, + Optional> allowedCountryCodes, + Optional businessGoalType, + Optional description, + Optional frequency, + Optional grossRewardAmount, + Optional publishAt, + Optional publishAtTimezone, + Optional title, + Map additionalProperties) { + this.acceptedSubmissionsLimit = acceptedSubmissionsLimit; + this.acceptedSubmissionsPerUserLimit = acceptedSubmissionsPerUserLimit; + this.allowedCountryCodes = allowedCountryCodes; + this.businessGoalType = businessGoalType; + this.description = description; + this.frequency = frequency; + this.grossRewardAmount = grossRewardAmount; + this.publishAt = publishAt; + this.publishAtTimezone = publishAtTimezone; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Scheduled drafts only. Number of submissions that can be accepted (winner slots). + */ + @JsonIgnore + public Optional getAcceptedSubmissionsLimit() { + if (acceptedSubmissionsLimit == null) { + return Optional.empty(); + } + return acceptedSubmissionsLimit; + } + + /** + * @return How many winner slots one worker can win. Defaults to 1. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed accepted_submissions_limit. Editable while the bounty is still open with nothing under review. + */ + @JsonIgnore + public Optional getAcceptedSubmissionsPerUserLimit() { + if (acceptedSubmissionsPerUserLimit == null) { + return Optional.empty(); + } + return acceptedSubmissionsPerUserLimit; + } + + /** + * @return Replace the countries whose residents can work the bounty, as ISO 3166 alpha-2 codes. Empty means worldwide. + */ + @JsonIgnore + public Optional> getAllowedCountryCodes() { + if (allowedCountryCodes == null) { + return Optional.empty(); + } + return allowedCountryCodes; + } + + /** + * @return What the poster wants the work to achieve, declared once here. + */ + @JsonProperty("business_goal_type") + public Optional getBusinessGoalType() { + return businessGoalType; + } + + /** + * @return New full task instructions. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return Scheduled drafts only. How often the schedule creates a new bounty. + */ + @JsonProperty("frequency") + public Optional getFrequency() { + return frequency; + } + + /** + * @return Scheduled drafts only. Gross bounty-pool amount (USD) escrowed per accepted submission. The escrowed total (this times accepted_submissions_limit) must stay at least $5. + */ + @JsonIgnore + public Optional getGrossRewardAmount() { + if (grossRewardAmount == null) { + return Optional.empty(); + } + return grossRewardAmount; + } + + /** + * @return Scheduled drafts only. New ISO 8601 time to publish the draft. Must be in the future. + */ + @JsonIgnore + public Optional getPublishAt() { + if (publishAt == null) { + return Optional.empty(); + } + return publishAt; + } + + /** + * @return Scheduled drafts only. IANA timezone for recurring occurrences. + */ + @JsonIgnore + public Optional getPublishAtTimezone() { + if (publishAtTimezone == null) { + return Optional.empty(); + } + return publishAtTimezone; + } + + /** + * @return New short name of the task. + */ + @JsonProperty("title") + public Optional getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("accepted_submissions_limit") + private Optional _getAcceptedSubmissionsLimit() { + return acceptedSubmissionsLimit; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("accepted_submissions_per_user_limit") + private Optional _getAcceptedSubmissionsPerUserLimit() { + return acceptedSubmissionsPerUserLimit; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("allowed_country_codes") + private Optional> _getAllowedCountryCodes() { + return allowedCountryCodes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("gross_reward_amount") + private Optional _getGrossRewardAmount() { + return grossRewardAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("publish_at") + private Optional _getPublishAt() { + return publishAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("publish_at_timezone") + private Optional _getPublishAtTimezone() { + return publishAtTimezone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateBountiesRequest && equalTo((UpdateBountiesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateBountiesRequest other) { + return acceptedSubmissionsLimit.equals(other.acceptedSubmissionsLimit) + && acceptedSubmissionsPerUserLimit.equals(other.acceptedSubmissionsPerUserLimit) + && allowedCountryCodes.equals(other.allowedCountryCodes) + && businessGoalType.equals(other.businessGoalType) + && description.equals(other.description) + && frequency.equals(other.frequency) + && grossRewardAmount.equals(other.grossRewardAmount) + && publishAt.equals(other.publishAt) + && publishAtTimezone.equals(other.publishAtTimezone) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.acceptedSubmissionsLimit, + this.acceptedSubmissionsPerUserLimit, + this.allowedCountryCodes, + this.businessGoalType, + this.description, + this.frequency, + this.grossRewardAmount, + this.publishAt, + this.publishAtTimezone, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional acceptedSubmissionsLimit = Optional.empty(); + + private Optional acceptedSubmissionsPerUserLimit = Optional.empty(); + + private Optional> allowedCountryCodes = Optional.empty(); + + private Optional businessGoalType = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional frequency = Optional.empty(); + + private Optional grossRewardAmount = Optional.empty(); + + private Optional publishAt = Optional.empty(); + + private Optional publishAtTimezone = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateBountiesRequest other) { + acceptedSubmissionsLimit(other.getAcceptedSubmissionsLimit()); + acceptedSubmissionsPerUserLimit(other.getAcceptedSubmissionsPerUserLimit()); + allowedCountryCodes(other.getAllowedCountryCodes()); + businessGoalType(other.getBusinessGoalType()); + description(other.getDescription()); + frequency(other.getFrequency()); + grossRewardAmount(other.getGrossRewardAmount()); + publishAt(other.getPublishAt()); + publishAtTimezone(other.getPublishAtTimezone()); + title(other.getTitle()); + return this; + } + + /** + *

Scheduled drafts only. Number of submissions that can be accepted (winner slots).

+ */ + @JsonSetter(value = "accepted_submissions_limit", nulls = Nulls.SKIP) + public Builder acceptedSubmissionsLimit(Optional acceptedSubmissionsLimit) { + this.acceptedSubmissionsLimit = acceptedSubmissionsLimit; + return this; + } + + public Builder acceptedSubmissionsLimit(Integer acceptedSubmissionsLimit) { + this.acceptedSubmissionsLimit = Optional.ofNullable(acceptedSubmissionsLimit); + return this; + } + + public Builder acceptedSubmissionsLimit(Nullable acceptedSubmissionsLimit) { + if (acceptedSubmissionsLimit.isNull()) { + this.acceptedSubmissionsLimit = null; + } else if (acceptedSubmissionsLimit.isEmpty()) { + this.acceptedSubmissionsLimit = Optional.empty(); + } else { + this.acceptedSubmissionsLimit = Optional.of(acceptedSubmissionsLimit.get()); + } + return this; + } + + /** + *

How many winner slots one worker can win. Defaults to 1. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed accepted_submissions_limit. Editable while the bounty is still open with nothing under review.

+ */ + @JsonSetter(value = "accepted_submissions_per_user_limit", nulls = Nulls.SKIP) + public Builder acceptedSubmissionsPerUserLimit(Optional acceptedSubmissionsPerUserLimit) { + this.acceptedSubmissionsPerUserLimit = acceptedSubmissionsPerUserLimit; + return this; + } + + public Builder acceptedSubmissionsPerUserLimit(Integer acceptedSubmissionsPerUserLimit) { + this.acceptedSubmissionsPerUserLimit = Optional.ofNullable(acceptedSubmissionsPerUserLimit); + return this; + } + + public Builder acceptedSubmissionsPerUserLimit(Nullable acceptedSubmissionsPerUserLimit) { + if (acceptedSubmissionsPerUserLimit.isNull()) { + this.acceptedSubmissionsPerUserLimit = null; + } else if (acceptedSubmissionsPerUserLimit.isEmpty()) { + this.acceptedSubmissionsPerUserLimit = Optional.empty(); + } else { + this.acceptedSubmissionsPerUserLimit = Optional.of(acceptedSubmissionsPerUserLimit.get()); + } + return this; + } + + /** + *

Replace the countries whose residents can work the bounty, as ISO 3166 alpha-2 codes. Empty means worldwide.

+ */ + @JsonSetter(value = "allowed_country_codes", nulls = Nulls.SKIP) + public Builder allowedCountryCodes(Optional> allowedCountryCodes) { + this.allowedCountryCodes = allowedCountryCodes; + return this; + } + + public Builder allowedCountryCodes(List allowedCountryCodes) { + this.allowedCountryCodes = Optional.ofNullable(allowedCountryCodes); + return this; + } + + public Builder allowedCountryCodes(Nullable> allowedCountryCodes) { + if (allowedCountryCodes.isNull()) { + this.allowedCountryCodes = null; + } else if (allowedCountryCodes.isEmpty()) { + this.allowedCountryCodes = Optional.empty(); + } else { + this.allowedCountryCodes = Optional.of(allowedCountryCodes.get()); + } + return this; + } + + /** + *

What the poster wants the work to achieve, declared once here.

+ */ + @JsonSetter(value = "business_goal_type", nulls = Nulls.SKIP) + public Builder businessGoalType(Optional businessGoalType) { + this.businessGoalType = businessGoalType; + return this; + } + + public Builder businessGoalType(UpdateBountiesRequestBusinessGoalType businessGoalType) { + this.businessGoalType = Optional.ofNullable(businessGoalType); + return this; + } + + /** + *

New full task instructions.

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

Scheduled drafts only. How often the schedule creates a new bounty.

+ */ + @JsonSetter(value = "frequency", nulls = Nulls.SKIP) + public Builder frequency(Optional frequency) { + this.frequency = frequency; + return this; + } + + public Builder frequency(UpdateBountiesRequestFrequency frequency) { + this.frequency = Optional.ofNullable(frequency); + return this; + } + + /** + *

Scheduled drafts only. Gross bounty-pool amount (USD) escrowed per accepted submission. The escrowed total (this times accepted_submissions_limit) must stay at least $5.

+ */ + @JsonSetter(value = "gross_reward_amount", nulls = Nulls.SKIP) + public Builder grossRewardAmount(Optional grossRewardAmount) { + this.grossRewardAmount = grossRewardAmount; + return this; + } + + public Builder grossRewardAmount(Double grossRewardAmount) { + this.grossRewardAmount = Optional.ofNullable(grossRewardAmount); + return this; + } + + public Builder grossRewardAmount(Nullable grossRewardAmount) { + if (grossRewardAmount.isNull()) { + this.grossRewardAmount = null; + } else if (grossRewardAmount.isEmpty()) { + this.grossRewardAmount = Optional.empty(); + } else { + this.grossRewardAmount = Optional.of(grossRewardAmount.get()); + } + return this; + } + + /** + *

Scheduled drafts only. New ISO 8601 time to publish the draft. Must be in the future.

+ */ + @JsonSetter(value = "publish_at", nulls = Nulls.SKIP) + public Builder publishAt(Optional publishAt) { + this.publishAt = publishAt; + return this; + } + + public Builder publishAt(String publishAt) { + this.publishAt = Optional.ofNullable(publishAt); + return this; + } + + public Builder publishAt(Nullable publishAt) { + if (publishAt.isNull()) { + this.publishAt = null; + } else if (publishAt.isEmpty()) { + this.publishAt = Optional.empty(); + } else { + this.publishAt = Optional.of(publishAt.get()); + } + return this; + } + + /** + *

Scheduled drafts only. IANA timezone for recurring occurrences.

+ */ + @JsonSetter(value = "publish_at_timezone", nulls = Nulls.SKIP) + public Builder publishAtTimezone(Optional publishAtTimezone) { + this.publishAtTimezone = publishAtTimezone; + return this; + } + + public Builder publishAtTimezone(String publishAtTimezone) { + this.publishAtTimezone = Optional.ofNullable(publishAtTimezone); + return this; + } + + public Builder publishAtTimezone(Nullable publishAtTimezone) { + if (publishAtTimezone.isNull()) { + this.publishAtTimezone = null; + } else if (publishAtTimezone.isEmpty()) { + this.publishAtTimezone = Optional.empty(); + } else { + this.publishAtTimezone = Optional.of(publishAtTimezone.get()); + } + return this; + } + + /** + *

New short name of the task.

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public UpdateBountiesRequest build() { + return new UpdateBountiesRequest( + acceptedSubmissionsLimit, + acceptedSubmissionsPerUserLimit, + allowedCountryCodes, + businessGoalType, + description, + frequency, + grossRewardAmount, + publishAt, + publishAtTimezone, + title, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/submissions/AsyncRawSubmissionsClient.java b/src/main/java/com/whop/api/resources/bounties/submissions/AsyncRawSubmissionsClient.java new file mode 100644 index 00000000..6ca27dac --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/submissions/AsyncRawSubmissionsClient.java @@ -0,0 +1,277 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.submissions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.resources.bounties.submissions.requests.ListSubmissionsRequest; +import com.whop.api.resources.bounties.submissions.requests.RetrieveSubmissionsRequest; +import com.whop.api.resources.bounties.submissions.types.ListSubmissionsResponse; +import com.whop.api.types.PublicBountySubmission; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawSubmissionsClient { + protected final ClientOptions clientOptions; + + public AsyncRawSubmissionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public CompletableFuture>> list(String bountyId) { + return list(bountyId, ListSubmissionsRequest.builder().build()); + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public CompletableFuture>> list( + String bountyId, RequestOptions requestOptions) { + return list(bountyId, ListSubmissionsRequest.builder().build(), requestOptions); + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public CompletableFuture>> list( + String bountyId, ListSubmissionsRequest request) { + return list(bountyId, request, null); + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public CompletableFuture>> list( + String bountyId, ListSubmissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounties") + .addPathSegment(bountyId) + .addPathSegments("submissions"); + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListSubmissionsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListSubmissionsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListSubmissionsRequest nextRequest = ListSubmissionsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(bountyId, nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public CompletableFuture> retrieve(String bountyId, String id) { + return retrieve(bountyId, id, RetrieveSubmissionsRequest.builder().build()); + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public CompletableFuture> retrieve( + String bountyId, String id, RequestOptions requestOptions) { + return retrieve(bountyId, id, RetrieveSubmissionsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public CompletableFuture> retrieve( + String bountyId, String id, RetrieveSubmissionsRequest request) { + return retrieve(bountyId, id, request, null); + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public CompletableFuture> retrieve( + String bountyId, String id, RetrieveSubmissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounties") + .addPathSegment(bountyId) + .addPathSegments("submissions") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PublicBountySubmission.class), + response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/submissions/AsyncSubmissionsClient.java b/src/main/java/com/whop/api/resources/bounties/submissions/AsyncSubmissionsClient.java new file mode 100644 index 00000000..684915f4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/submissions/AsyncSubmissionsClient.java @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.submissions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.bounties.submissions.requests.ListSubmissionsRequest; +import com.whop.api.resources.bounties.submissions.requests.RetrieveSubmissionsRequest; +import com.whop.api.types.PublicBountySubmission; +import java.util.concurrent.CompletableFuture; + +public class AsyncSubmissionsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawSubmissionsClient rawClient; + + public AsyncSubmissionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawSubmissionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawSubmissionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public CompletableFuture> list(String bountyId) { + return this.rawClient.list(bountyId).thenApply(response -> response.body()); + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public CompletableFuture> list( + String bountyId, RequestOptions requestOptions) { + return this.rawClient.list(bountyId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public CompletableFuture> list( + String bountyId, ListSubmissionsRequest request) { + return this.rawClient.list(bountyId, request).thenApply(response -> response.body()); + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public CompletableFuture> list( + String bountyId, ListSubmissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(bountyId, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public CompletableFuture retrieve(String bountyId, String id) { + return this.rawClient.retrieve(bountyId, id).thenApply(response -> response.body()); + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public CompletableFuture retrieve( + String bountyId, String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(bountyId, id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public CompletableFuture retrieve( + String bountyId, String id, RetrieveSubmissionsRequest request) { + return this.rawClient.retrieve(bountyId, id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public CompletableFuture retrieve( + String bountyId, String id, RetrieveSubmissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(bountyId, id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/submissions/RawSubmissionsClient.java b/src/main/java/com/whop/api/resources/bounties/submissions/RawSubmissionsClient.java new file mode 100644 index 00000000..b652f156 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/submissions/RawSubmissionsClient.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.submissions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.resources.bounties.submissions.requests.ListSubmissionsRequest; +import com.whop.api.resources.bounties.submissions.requests.RetrieveSubmissionsRequest; +import com.whop.api.resources.bounties.submissions.types.ListSubmissionsResponse; +import com.whop.api.types.PublicBountySubmission; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawSubmissionsClient { + protected final ClientOptions clientOptions; + + public RawSubmissionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public WhopApiHttpResponse> list(String bountyId) { + return list(bountyId, ListSubmissionsRequest.builder().build()); + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public WhopApiHttpResponse> list( + String bountyId, RequestOptions requestOptions) { + return list(bountyId, ListSubmissionsRequest.builder().build(), requestOptions); + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public WhopApiHttpResponse> list( + String bountyId, ListSubmissionsRequest request) { + return list(bountyId, request, null); + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public WhopApiHttpResponse> list( + String bountyId, ListSubmissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounties") + .addPathSegment(bountyId) + .addPathSegments("submissions"); + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListSubmissionsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListSubmissionsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListSubmissionsRequest nextRequest = ListSubmissionsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list( + bountyId, nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public WhopApiHttpResponse retrieve(String bountyId, String id) { + return retrieve(bountyId, id, RetrieveSubmissionsRequest.builder().build()); + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public WhopApiHttpResponse retrieve( + String bountyId, String id, RequestOptions requestOptions) { + return retrieve(bountyId, id, RetrieveSubmissionsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public WhopApiHttpResponse retrieve( + String bountyId, String id, RetrieveSubmissionsRequest request) { + return retrieve(bountyId, id, request, null); + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public WhopApiHttpResponse retrieve( + String bountyId, String id, RetrieveSubmissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounties") + .addPathSegment(bountyId) + .addPathSegments("submissions") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PublicBountySubmission.class), + response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/submissions/SubmissionsClient.java b/src/main/java/com/whop/api/resources/bounties/submissions/SubmissionsClient.java new file mode 100644 index 00000000..28a4a89f --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/submissions/SubmissionsClient.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.submissions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.bounties.submissions.requests.ListSubmissionsRequest; +import com.whop.api.resources.bounties.submissions.requests.RetrieveSubmissionsRequest; +import com.whop.api.types.PublicBountySubmission; + +public class SubmissionsClient { + protected final ClientOptions clientOptions; + + private final RawSubmissionsClient rawClient; + + public SubmissionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawSubmissionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawSubmissionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public SyncPagingIterable list(String bountyId) { + return this.rawClient.list(bountyId).body(); + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public SyncPagingIterable list(String bountyId, RequestOptions requestOptions) { + return this.rawClient.list(bountyId, requestOptions).body(); + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public SyncPagingIterable list(String bountyId, ListSubmissionsRequest request) { + return this.rawClient.list(bountyId, request).body(); + } + + /** + * Lists a bounty's publicly visible work — submitted, approved, and denied submissions in the reduced public shape. Authentication is optional; a bounty that is not publicly visible returns 404. + */ + public SyncPagingIterable list( + String bountyId, ListSubmissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(bountyId, request, requestOptions).body(); + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public PublicBountySubmission retrieve(String bountyId, String id) { + return this.rawClient.retrieve(bountyId, id).body(); + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public PublicBountySubmission retrieve(String bountyId, String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(bountyId, id, requestOptions).body(); + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public PublicBountySubmission retrieve(String bountyId, String id, RetrieveSubmissionsRequest request) { + return this.rawClient.retrieve(bountyId, id, request).body(); + } + + /** + * Retrieves one of a bounty's publicly visible submissions in the reduced public shape — the read behind a shared proof link, whose submission is usually outside the bounty page's capped preview. Authentication is optional; a bounty that is not publicly visible, and a submission that is not publicly visible work on it, both return 404. + */ + public PublicBountySubmission retrieve( + String bountyId, String id, RetrieveSubmissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(bountyId, id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/submissions/requests/ListSubmissionsRequest.java b/src/main/java/com/whop/api/resources/bounties/submissions/requests/ListSubmissionsRequest.java new file mode 100644 index 00000000..0f5c478c --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/submissions/requests/ListSubmissionsRequest.java @@ -0,0 +1,375 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.submissions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.bounties.submissions.types.ListSubmissionsRequestDirection; +import com.whop.api.resources.bounties.submissions.types.ListSubmissionsRequestOrder; +import com.whop.api.resources.bounties.submissions.types.ListSubmissionsRequestStatus; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSubmissionsRequest.Builder.class) +public final class ListSubmissionsRequest { + private final Optional status; + + private final Optional createdAfter; + + private final Optional createdBefore; + + private final Optional order; + + private final Optional direction; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListSubmissionsRequest( + Optional status, + Optional createdAfter, + Optional createdBefore, + Optional order, + Optional direction, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.status = status; + this.createdAfter = createdAfter; + this.createdBefore = createdBefore; + this.order = order; + this.direction = direction; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Filter by lifecycle state. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Only submissions created after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Only submissions created before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Sort field. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Number of submissions to return from the start of the window. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to paginate forwards from. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return Number of submissions to return from the end of the window. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to paginate backwards from. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSubmissionsRequest && equalTo((ListSubmissionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSubmissionsRequest other) { + return status.equals(other.status) + && createdAfter.equals(other.createdAfter) + && createdBefore.equals(other.createdBefore) + && order.equals(other.order) + && direction.equals(other.direction) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.status, + this.createdAfter, + this.createdBefore, + this.order, + this.direction, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional status = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListSubmissionsRequest other) { + status(other.getStatus()); + createdAfter(other.getCreatedAfter()); + createdBefore(other.getCreatedBefore()); + order(other.getOrder()); + direction(other.getDirection()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

Filter by lifecycle state.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListSubmissionsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Only submissions created after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only submissions created before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Sort field.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListSubmissionsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListSubmissionsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Number of submissions to return from the start of the window.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to paginate forwards from.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Number of submissions to return from the end of the window.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to paginate backwards from.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListSubmissionsRequest build() { + return new ListSubmissionsRequest( + status, + createdAfter, + createdBefore, + order, + direction, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/submissions/requests/RetrieveSubmissionsRequest.java b/src/main/java/com/whop/api/resources/bounties/submissions/requests/RetrieveSubmissionsRequest.java new file mode 100644 index 00000000..d3516c6b --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/submissions/requests/RetrieveSubmissionsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.submissions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveSubmissionsRequest.Builder.class) +public final class RetrieveSubmissionsRequest { + private final Map additionalProperties; + + private RetrieveSubmissionsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveSubmissionsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveSubmissionsRequest other) { + return this; + } + + public RetrieveSubmissionsRequest build() { + return new RetrieveSubmissionsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/submissions/types/ListSubmissionsRequestDirection.java b/src/main/java/com/whop/api/resources/bounties/submissions/types/ListSubmissionsRequestDirection.java new file mode 100644 index 00000000..bd7733f9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/submissions/types/ListSubmissionsRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.submissions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListSubmissionsRequestDirection { + public static final ListSubmissionsRequestDirection ASC = new ListSubmissionsRequestDirection(Value.ASC, "asc"); + + public static final ListSubmissionsRequestDirection DESC = new ListSubmissionsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListSubmissionsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListSubmissionsRequestDirection + && this.string.equals(((ListSubmissionsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListSubmissionsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListSubmissionsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/submissions/types/ListSubmissionsRequestOrder.java b/src/main/java/com/whop/api/resources/bounties/submissions/types/ListSubmissionsRequestOrder.java new file mode 100644 index 00000000..814418c4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/submissions/types/ListSubmissionsRequestOrder.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.submissions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListSubmissionsRequestOrder { + public static final ListSubmissionsRequestOrder UPDATED_AT = + new ListSubmissionsRequestOrder(Value.UPDATED_AT, "updated_at"); + + public static final ListSubmissionsRequestOrder CREATED_AT = + new ListSubmissionsRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListSubmissionsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListSubmissionsRequestOrder + && this.string.equals(((ListSubmissionsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case UPDATED_AT: + return visitor.visitUpdatedAt(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListSubmissionsRequestOrder valueOf(String value) { + switch (value) { + case "updated_at": + return UPDATED_AT; + case "created_at": + return CREATED_AT; + default: + return new ListSubmissionsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UPDATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUpdatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/submissions/types/ListSubmissionsRequestStatus.java b/src/main/java/com/whop/api/resources/bounties/submissions/types/ListSubmissionsRequestStatus.java new file mode 100644 index 00000000..d0ec4de6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/submissions/types/ListSubmissionsRequestStatus.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.submissions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListSubmissionsRequestStatus { + public static final ListSubmissionsRequestStatus APPROVED = + new ListSubmissionsRequestStatus(Value.APPROVED, "approved"); + + public static final ListSubmissionsRequestStatus DENIED = new ListSubmissionsRequestStatus(Value.DENIED, "denied"); + + public static final ListSubmissionsRequestStatus SUBMITTED = + new ListSubmissionsRequestStatus(Value.SUBMITTED, "submitted"); + + private final Value value; + + private final String string; + + ListSubmissionsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListSubmissionsRequestStatus + && this.string.equals(((ListSubmissionsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case DENIED: + return visitor.visitDenied(); + case SUBMITTED: + return visitor.visitSubmitted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListSubmissionsRequestStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "denied": + return DENIED; + case "submitted": + return SUBMITTED; + default: + return new ListSubmissionsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + SUBMITTED, + + APPROVED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitSubmitted(); + + T visitApproved(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/submissions/types/ListSubmissionsResponse.java b/src/main/java/com/whop/api/resources/bounties/submissions/types/ListSubmissionsResponse.java new file mode 100644 index 00000000..149cbba5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/submissions/types/ListSubmissionsResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.submissions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PublicBountySubmission; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSubmissionsResponse.Builder.class) +public final class ListSubmissionsResponse { + private final List data; + + private final ListSubmissionsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListSubmissionsResponse( + List data, + ListSubmissionsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListSubmissionsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSubmissionsResponse && equalTo((ListSubmissionsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSubmissionsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListSubmissionsResponsePageInfo pageInfo); + + Builder from(ListSubmissionsResponse other); + } + + public interface _FinalStage { + ListSubmissionsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(PublicBountySubmission data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListSubmissionsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSubmissionsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListSubmissionsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(PublicBountySubmission data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListSubmissionsResponse build() { + return new ListSubmissionsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/submissions/types/ListSubmissionsResponsePageInfo.java b/src/main/java/com/whop/api/resources/bounties/submissions/types/ListSubmissionsResponsePageInfo.java new file mode 100644 index 00000000..a49e2b88 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/submissions/types/ListSubmissionsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.submissions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSubmissionsResponsePageInfo.Builder.class) +public final class ListSubmissionsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListSubmissionsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSubmissionsResponsePageInfo && equalTo((ListSubmissionsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSubmissionsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListSubmissionsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListSubmissionsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSubmissionsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListSubmissionsResponsePageInfo build() { + return new ListSubmissionsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/types/CreateBountiesRequestBusinessGoalType.java b/src/main/java/com/whop/api/resources/bounties/types/CreateBountiesRequestBusinessGoalType.java new file mode 100644 index 00000000..62383e31 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/types/CreateBountiesRequestBusinessGoalType.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateBountiesRequestBusinessGoalType { + public static final CreateBountiesRequestBusinessGoalType LOCAL_ACTIVATION = + new CreateBountiesRequestBusinessGoalType(Value.LOCAL_ACTIVATION, "local_activation"); + + public static final CreateBountiesRequestBusinessGoalType OTHER = + new CreateBountiesRequestBusinessGoalType(Value.OTHER, "other"); + + public static final CreateBountiesRequestBusinessGoalType UGC_CONTENT = + new CreateBountiesRequestBusinessGoalType(Value.UGC_CONTENT, "ugc_content"); + + public static final CreateBountiesRequestBusinessGoalType CLIPPING = + new CreateBountiesRequestBusinessGoalType(Value.CLIPPING, "clipping"); + + public static final CreateBountiesRequestBusinessGoalType POST_ENGAGEMENT = + new CreateBountiesRequestBusinessGoalType(Value.POST_ENGAGEMENT, "post_engagement"); + + public static final CreateBountiesRequestBusinessGoalType OWNED_ACCOUNT_GROWTH = + new CreateBountiesRequestBusinessGoalType(Value.OWNED_ACCOUNT_GROWTH, "owned_account_growth"); + + public static final CreateBountiesRequestBusinessGoalType DATA_CAPTURE = + new CreateBountiesRequestBusinessGoalType(Value.DATA_CAPTURE, "data_capture"); + + private final Value value; + + private final String string; + + CreateBountiesRequestBusinessGoalType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateBountiesRequestBusinessGoalType + && this.string.equals(((CreateBountiesRequestBusinessGoalType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LOCAL_ACTIVATION: + return visitor.visitLocalActivation(); + case OTHER: + return visitor.visitOther(); + case UGC_CONTENT: + return visitor.visitUgcContent(); + case CLIPPING: + return visitor.visitClipping(); + case POST_ENGAGEMENT: + return visitor.visitPostEngagement(); + case OWNED_ACCOUNT_GROWTH: + return visitor.visitOwnedAccountGrowth(); + case DATA_CAPTURE: + return visitor.visitDataCapture(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateBountiesRequestBusinessGoalType valueOf(String value) { + switch (value) { + case "local_activation": + return LOCAL_ACTIVATION; + case "other": + return OTHER; + case "ugc_content": + return UGC_CONTENT; + case "clipping": + return CLIPPING; + case "post_engagement": + return POST_ENGAGEMENT; + case "owned_account_growth": + return OWNED_ACCOUNT_GROWTH; + case "data_capture": + return DATA_CAPTURE; + default: + return new CreateBountiesRequestBusinessGoalType(Value.UNKNOWN, value); + } + } + + public enum Value { + CLIPPING, + + POST_ENGAGEMENT, + + OWNED_ACCOUNT_GROWTH, + + UGC_CONTENT, + + LOCAL_ACTIVATION, + + DATA_CAPTURE, + + OTHER, + + UNKNOWN + } + + public interface Visitor { + T visitClipping(); + + T visitPostEngagement(); + + T visitOwnedAccountGrowth(); + + T visitUgcContent(); + + T visitLocalActivation(); + + T visitDataCapture(); + + T visitOther(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/types/CreateBountiesRequestCaptureSpec.java b/src/main/java/com/whop/api/resources/bounties/types/CreateBountiesRequestCaptureSpec.java new file mode 100644 index 00000000..ea536fc0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/types/CreateBountiesRequestCaptureSpec.java @@ -0,0 +1,277 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateBountiesRequestCaptureSpec.Builder.class) +public final class CreateBountiesRequestCaptureSpec { + private final Optional bitrateTargetMbps; + + private final Optional embedCameraMetadata; + + private final Optional frameGapToleranceMs; + + private final Optional minClipDurationSeconds; + + private final Optional minTotalVerifiedDurationSeconds; + + private final Optional stabilizationMode; + + private final Map additionalProperties; + + private CreateBountiesRequestCaptureSpec( + Optional bitrateTargetMbps, + Optional embedCameraMetadata, + Optional frameGapToleranceMs, + Optional minClipDurationSeconds, + Optional minTotalVerifiedDurationSeconds, + Optional stabilizationMode, + Map additionalProperties) { + this.bitrateTargetMbps = bitrateTargetMbps; + this.embedCameraMetadata = embedCameraMetadata; + this.frameGapToleranceMs = frameGapToleranceMs; + this.minClipDurationSeconds = minClipDurationSeconds; + this.minTotalVerifiedDurationSeconds = minTotalVerifiedDurationSeconds; + this.stabilizationMode = stabilizationMode; + this.additionalProperties = additionalProperties; + } + + /** + * @return Average bitrate the recorder encodes at, in megabits per second. Must sit within the served floor and ceiling. + */ + @JsonProperty("bitrate_target_mbps") + public Optional getBitrateTargetMbps() { + return bitrateTargetMbps; + } + + /** + * @return Whether the recorder also writes camera make and model into the video container's metadata. + */ + @JsonProperty("embed_camera_metadata") + public Optional getEmbedCameraMetadata() { + return embedCameraMetadata; + } + + /** + * @return Longest stall between consecutive frames a clip may contain before the client rejects it, in milliseconds. Unlike the recording fields this one can also be tuned after the bounty is created, since it bounds what is accepted rather than how footage is captured. + */ + @JsonProperty("frame_gap_tolerance_ms") + public Optional getFrameGapToleranceMs() { + return frameGapToleranceMs; + } + + /** + * @return Minimum length of a single clip, in seconds. + */ + @JsonProperty("min_clip_duration_seconds") + public Optional getMinClipDurationSeconds() { + return minClipDurationSeconds; + } + + /** + * @return Total verified footage a submission must accumulate across all its clips before it can be submitted, in seconds. Must be a whole number of hours between 1 and 12. Editable after create, until someone starts an attempt. + */ + @JsonProperty("min_total_verified_duration_seconds") + public Optional getMinTotalVerifiedDurationSeconds() { + return minTotalVerifiedDurationSeconds; + } + + /** + * @return How the recorder configures video stabilization. off preserves raw motion for pose extraction. + */ + @JsonProperty("stabilization_mode") + public Optional getStabilizationMode() { + return stabilizationMode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateBountiesRequestCaptureSpec && equalTo((CreateBountiesRequestCaptureSpec) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateBountiesRequestCaptureSpec other) { + return bitrateTargetMbps.equals(other.bitrateTargetMbps) + && embedCameraMetadata.equals(other.embedCameraMetadata) + && frameGapToleranceMs.equals(other.frameGapToleranceMs) + && minClipDurationSeconds.equals(other.minClipDurationSeconds) + && minTotalVerifiedDurationSeconds.equals(other.minTotalVerifiedDurationSeconds) + && stabilizationMode.equals(other.stabilizationMode); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bitrateTargetMbps, + this.embedCameraMetadata, + this.frameGapToleranceMs, + this.minClipDurationSeconds, + this.minTotalVerifiedDurationSeconds, + this.stabilizationMode); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional bitrateTargetMbps = Optional.empty(); + + private Optional embedCameraMetadata = Optional.empty(); + + private Optional frameGapToleranceMs = Optional.empty(); + + private Optional minClipDurationSeconds = Optional.empty(); + + private Optional minTotalVerifiedDurationSeconds = Optional.empty(); + + private Optional stabilizationMode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateBountiesRequestCaptureSpec other) { + bitrateTargetMbps(other.getBitrateTargetMbps()); + embedCameraMetadata(other.getEmbedCameraMetadata()); + frameGapToleranceMs(other.getFrameGapToleranceMs()); + minClipDurationSeconds(other.getMinClipDurationSeconds()); + minTotalVerifiedDurationSeconds(other.getMinTotalVerifiedDurationSeconds()); + stabilizationMode(other.getStabilizationMode()); + return this; + } + + /** + *

Average bitrate the recorder encodes at, in megabits per second. Must sit within the served floor and ceiling.

+ */ + @JsonSetter(value = "bitrate_target_mbps", nulls = Nulls.SKIP) + public Builder bitrateTargetMbps(Optional bitrateTargetMbps) { + this.bitrateTargetMbps = bitrateTargetMbps; + return this; + } + + public Builder bitrateTargetMbps(Integer bitrateTargetMbps) { + this.bitrateTargetMbps = Optional.ofNullable(bitrateTargetMbps); + return this; + } + + /** + *

Whether the recorder also writes camera make and model into the video container's metadata.

+ */ + @JsonSetter(value = "embed_camera_metadata", nulls = Nulls.SKIP) + public Builder embedCameraMetadata(Optional embedCameraMetadata) { + this.embedCameraMetadata = embedCameraMetadata; + return this; + } + + public Builder embedCameraMetadata(Boolean embedCameraMetadata) { + this.embedCameraMetadata = Optional.ofNullable(embedCameraMetadata); + return this; + } + + /** + *

Longest stall between consecutive frames a clip may contain before the client rejects it, in milliseconds. Unlike the recording fields this one can also be tuned after the bounty is created, since it bounds what is accepted rather than how footage is captured.

+ */ + @JsonSetter(value = "frame_gap_tolerance_ms", nulls = Nulls.SKIP) + public Builder frameGapToleranceMs(Optional frameGapToleranceMs) { + this.frameGapToleranceMs = frameGapToleranceMs; + return this; + } + + public Builder frameGapToleranceMs(Integer frameGapToleranceMs) { + this.frameGapToleranceMs = Optional.ofNullable(frameGapToleranceMs); + return this; + } + + /** + *

Minimum length of a single clip, in seconds.

+ */ + @JsonSetter(value = "min_clip_duration_seconds", nulls = Nulls.SKIP) + public Builder minClipDurationSeconds(Optional minClipDurationSeconds) { + this.minClipDurationSeconds = minClipDurationSeconds; + return this; + } + + public Builder minClipDurationSeconds(Integer minClipDurationSeconds) { + this.minClipDurationSeconds = Optional.ofNullable(minClipDurationSeconds); + return this; + } + + /** + *

Total verified footage a submission must accumulate across all its clips before it can be submitted, in seconds. Must be a whole number of hours between 1 and 12. Editable after create, until someone starts an attempt.

+ */ + @JsonSetter(value = "min_total_verified_duration_seconds", nulls = Nulls.SKIP) + public Builder minTotalVerifiedDurationSeconds(Optional minTotalVerifiedDurationSeconds) { + this.minTotalVerifiedDurationSeconds = minTotalVerifiedDurationSeconds; + return this; + } + + public Builder minTotalVerifiedDurationSeconds(Integer minTotalVerifiedDurationSeconds) { + this.minTotalVerifiedDurationSeconds = Optional.ofNullable(minTotalVerifiedDurationSeconds); + return this; + } + + /** + *

How the recorder configures video stabilization. off preserves raw motion for pose extraction.

+ */ + @JsonSetter(value = "stabilization_mode", nulls = Nulls.SKIP) + public Builder stabilizationMode( + Optional stabilizationMode) { + this.stabilizationMode = stabilizationMode; + return this; + } + + public Builder stabilizationMode(CreateBountiesRequestCaptureSpecStabilizationMode stabilizationMode) { + this.stabilizationMode = Optional.ofNullable(stabilizationMode); + return this; + } + + public CreateBountiesRequestCaptureSpec build() { + return new CreateBountiesRequestCaptureSpec( + bitrateTargetMbps, + embedCameraMetadata, + frameGapToleranceMs, + minClipDurationSeconds, + minTotalVerifiedDurationSeconds, + stabilizationMode, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/types/CreateBountiesRequestCaptureSpecStabilizationMode.java b/src/main/java/com/whop/api/resources/bounties/types/CreateBountiesRequestCaptureSpecStabilizationMode.java new file mode 100644 index 00000000..41816dc2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/types/CreateBountiesRequestCaptureSpecStabilizationMode.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateBountiesRequestCaptureSpecStabilizationMode { + public static final CreateBountiesRequestCaptureSpecStabilizationMode OFF = + new CreateBountiesRequestCaptureSpecStabilizationMode(Value.OFF, "off"); + + public static final CreateBountiesRequestCaptureSpecStabilizationMode ANY = + new CreateBountiesRequestCaptureSpecStabilizationMode(Value.ANY, "any"); + + public static final CreateBountiesRequestCaptureSpecStabilizationMode ON = + new CreateBountiesRequestCaptureSpecStabilizationMode(Value.ON, "on"); + + private final Value value; + + private final String string; + + CreateBountiesRequestCaptureSpecStabilizationMode(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateBountiesRequestCaptureSpecStabilizationMode + && this.string.equals(((CreateBountiesRequestCaptureSpecStabilizationMode) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case OFF: + return visitor.visitOff(); + case ANY: + return visitor.visitAny(); + case ON: + return visitor.visitOn(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateBountiesRequestCaptureSpecStabilizationMode valueOf(String value) { + switch (value) { + case "off": + return OFF; + case "any": + return ANY; + case "on": + return ON; + default: + return new CreateBountiesRequestCaptureSpecStabilizationMode(Value.UNKNOWN, value); + } + } + + public enum Value { + OFF, + + ON, + + ANY, + + UNKNOWN + } + + public interface Visitor { + T visitOff(); + + T visitOn(); + + T visitAny(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/types/CreateBountiesRequestFrequency.java b/src/main/java/com/whop/api/resources/bounties/types/CreateBountiesRequestFrequency.java new file mode 100644 index 00000000..c6b4729c --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/types/CreateBountiesRequestFrequency.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateBountiesRequestFrequency { + public static final CreateBountiesRequestFrequency HOURLY = + new CreateBountiesRequestFrequency(Value.HOURLY, "hourly"); + + public static final CreateBountiesRequestFrequency ONCE = new CreateBountiesRequestFrequency(Value.ONCE, "once"); + + public static final CreateBountiesRequestFrequency DAILY = new CreateBountiesRequestFrequency(Value.DAILY, "daily"); + + public static final CreateBountiesRequestFrequency WEEKLY = + new CreateBountiesRequestFrequency(Value.WEEKLY, "weekly"); + + public static final CreateBountiesRequestFrequency MONTHLY = + new CreateBountiesRequestFrequency(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + CreateBountiesRequestFrequency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateBountiesRequestFrequency + && this.string.equals(((CreateBountiesRequestFrequency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HOURLY: + return visitor.visitHourly(); + case ONCE: + return visitor.visitOnce(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateBountiesRequestFrequency valueOf(String value) { + switch (value) { + case "hourly": + return HOURLY; + case "once": + return ONCE; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new CreateBountiesRequestFrequency(Value.UNKNOWN, value); + } + } + + public enum Value { + ONCE, + + HOURLY, + + DAILY, + + WEEKLY, + + MONTHLY, + + UNKNOWN + } + + public interface Visitor { + T visitOnce(); + + T visitHourly(); + + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/types/ListBountiesRequestBusinessGoalType.java b/src/main/java/com/whop/api/resources/bounties/types/ListBountiesRequestBusinessGoalType.java new file mode 100644 index 00000000..2fc57f1c --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/types/ListBountiesRequestBusinessGoalType.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListBountiesRequestBusinessGoalType { + public static final ListBountiesRequestBusinessGoalType LOCAL_ACTIVATION = + new ListBountiesRequestBusinessGoalType(Value.LOCAL_ACTIVATION, "local_activation"); + + public static final ListBountiesRequestBusinessGoalType OTHER = + new ListBountiesRequestBusinessGoalType(Value.OTHER, "other"); + + public static final ListBountiesRequestBusinessGoalType UGC_CONTENT = + new ListBountiesRequestBusinessGoalType(Value.UGC_CONTENT, "ugc_content"); + + public static final ListBountiesRequestBusinessGoalType CLIPPING = + new ListBountiesRequestBusinessGoalType(Value.CLIPPING, "clipping"); + + public static final ListBountiesRequestBusinessGoalType POST_ENGAGEMENT = + new ListBountiesRequestBusinessGoalType(Value.POST_ENGAGEMENT, "post_engagement"); + + public static final ListBountiesRequestBusinessGoalType OWNED_ACCOUNT_GROWTH = + new ListBountiesRequestBusinessGoalType(Value.OWNED_ACCOUNT_GROWTH, "owned_account_growth"); + + public static final ListBountiesRequestBusinessGoalType DATA_CAPTURE = + new ListBountiesRequestBusinessGoalType(Value.DATA_CAPTURE, "data_capture"); + + private final Value value; + + private final String string; + + ListBountiesRequestBusinessGoalType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListBountiesRequestBusinessGoalType + && this.string.equals(((ListBountiesRequestBusinessGoalType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LOCAL_ACTIVATION: + return visitor.visitLocalActivation(); + case OTHER: + return visitor.visitOther(); + case UGC_CONTENT: + return visitor.visitUgcContent(); + case CLIPPING: + return visitor.visitClipping(); + case POST_ENGAGEMENT: + return visitor.visitPostEngagement(); + case OWNED_ACCOUNT_GROWTH: + return visitor.visitOwnedAccountGrowth(); + case DATA_CAPTURE: + return visitor.visitDataCapture(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListBountiesRequestBusinessGoalType valueOf(String value) { + switch (value) { + case "local_activation": + return LOCAL_ACTIVATION; + case "other": + return OTHER; + case "ugc_content": + return UGC_CONTENT; + case "clipping": + return CLIPPING; + case "post_engagement": + return POST_ENGAGEMENT; + case "owned_account_growth": + return OWNED_ACCOUNT_GROWTH; + case "data_capture": + return DATA_CAPTURE; + default: + return new ListBountiesRequestBusinessGoalType(Value.UNKNOWN, value); + } + } + + public enum Value { + CLIPPING, + + POST_ENGAGEMENT, + + OWNED_ACCOUNT_GROWTH, + + UGC_CONTENT, + + LOCAL_ACTIVATION, + + DATA_CAPTURE, + + OTHER, + + UNKNOWN + } + + public interface Visitor { + T visitClipping(); + + T visitPostEngagement(); + + T visitOwnedAccountGrowth(); + + T visitUgcContent(); + + T visitLocalActivation(); + + T visitDataCapture(); + + T visitOther(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/types/ListBountiesRequestDirection.java b/src/main/java/com/whop/api/resources/bounties/types/ListBountiesRequestDirection.java new file mode 100644 index 00000000..4ac2b083 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/types/ListBountiesRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListBountiesRequestDirection { + public static final ListBountiesRequestDirection ASC = new ListBountiesRequestDirection(Value.ASC, "asc"); + + public static final ListBountiesRequestDirection DESC = new ListBountiesRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListBountiesRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListBountiesRequestDirection + && this.string.equals(((ListBountiesRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListBountiesRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListBountiesRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/types/ListBountiesRequestOrder.java b/src/main/java/com/whop/api/resources/bounties/types/ListBountiesRequestOrder.java new file mode 100644 index 00000000..a80e47d8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/types/ListBountiesRequestOrder.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListBountiesRequestOrder { + public static final ListBountiesRequestOrder GROSS_PAID_OUT_AMOUNT = + new ListBountiesRequestOrder(Value.GROSS_PAID_OUT_AMOUNT, "gross_paid_out_amount"); + + public static final ListBountiesRequestOrder GROSS_REWARD_AMOUNT = + new ListBountiesRequestOrder(Value.GROSS_REWARD_AMOUNT, "gross_reward_amount"); + + public static final ListBountiesRequestOrder CREATED_AT = + new ListBountiesRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListBountiesRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListBountiesRequestOrder + && this.string.equals(((ListBountiesRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case GROSS_PAID_OUT_AMOUNT: + return visitor.visitGrossPaidOutAmount(); + case GROSS_REWARD_AMOUNT: + return visitor.visitGrossRewardAmount(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListBountiesRequestOrder valueOf(String value) { + switch (value) { + case "gross_paid_out_amount": + return GROSS_PAID_OUT_AMOUNT; + case "gross_reward_amount": + return GROSS_REWARD_AMOUNT; + case "created_at": + return CREATED_AT; + default: + return new ListBountiesRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + GROSS_PAID_OUT_AMOUNT, + + GROSS_REWARD_AMOUNT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitGrossPaidOutAmount(); + + T visitGrossRewardAmount(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/types/ListBountiesRequestStatus.java b/src/main/java/com/whop/api/resources/bounties/types/ListBountiesRequestStatus.java new file mode 100644 index 00000000..e78fc863 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/types/ListBountiesRequestStatus.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListBountiesRequestStatus { + public static final ListBountiesRequestStatus CLOSED = new ListBountiesRequestStatus(Value.CLOSED, "closed"); + + public static final ListBountiesRequestStatus CANCELED = new ListBountiesRequestStatus(Value.CANCELED, "canceled"); + + public static final ListBountiesRequestStatus COMPLETED = + new ListBountiesRequestStatus(Value.COMPLETED, "completed"); + + public static final ListBountiesRequestStatus SCHEDULED = + new ListBountiesRequestStatus(Value.SCHEDULED, "scheduled"); + + public static final ListBountiesRequestStatus OPEN = new ListBountiesRequestStatus(Value.OPEN, "open"); + + private final Value value; + + private final String string; + + ListBountiesRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListBountiesRequestStatus + && this.string.equals(((ListBountiesRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CLOSED: + return visitor.visitClosed(); + case CANCELED: + return visitor.visitCanceled(); + case COMPLETED: + return visitor.visitCompleted(); + case SCHEDULED: + return visitor.visitScheduled(); + case OPEN: + return visitor.visitOpen(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListBountiesRequestStatus valueOf(String value) { + switch (value) { + case "closed": + return CLOSED; + case "canceled": + return CANCELED; + case "completed": + return COMPLETED; + case "scheduled": + return SCHEDULED; + case "open": + return OPEN; + default: + return new ListBountiesRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + SCHEDULED, + + OPEN, + + CLOSED, + + COMPLETED, + + CANCELED, + + UNKNOWN + } + + public interface Visitor { + T visitScheduled(); + + T visitOpen(); + + T visitClosed(); + + T visitCompleted(); + + T visitCanceled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/types/ListBountiesResponse.java b/src/main/java/com/whop/api/resources/bounties/types/ListBountiesResponse.java new file mode 100644 index 00000000..2631db3b --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/types/ListBountiesResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.BountyListItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBountiesResponse.Builder.class) +public final class ListBountiesResponse { + private final List data; + + private final ListBountiesResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListBountiesResponse( + List data, + ListBountiesResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListBountiesResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBountiesResponse && equalTo((ListBountiesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBountiesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListBountiesResponsePageInfo pageInfo); + + Builder from(ListBountiesResponse other); + } + + public interface _FinalStage { + ListBountiesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(BountyListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListBountiesResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBountiesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListBountiesResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(BountyListItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListBountiesResponse build() { + return new ListBountiesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/types/ListBountiesResponsePageInfo.java b/src/main/java/com/whop/api/resources/bounties/types/ListBountiesResponsePageInfo.java new file mode 100644 index 00000000..5e958c01 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/types/ListBountiesResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBountiesResponsePageInfo.Builder.class) +public final class ListBountiesResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListBountiesResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBountiesResponsePageInfo && equalTo((ListBountiesResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBountiesResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListBountiesResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListBountiesResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBountiesResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListBountiesResponsePageInfo build() { + return new ListBountiesResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/types/UpdateBountiesRequestBusinessGoalType.java b/src/main/java/com/whop/api/resources/bounties/types/UpdateBountiesRequestBusinessGoalType.java new file mode 100644 index 00000000..3fb53f3b --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/types/UpdateBountiesRequestBusinessGoalType.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateBountiesRequestBusinessGoalType { + public static final UpdateBountiesRequestBusinessGoalType LOCAL_ACTIVATION = + new UpdateBountiesRequestBusinessGoalType(Value.LOCAL_ACTIVATION, "local_activation"); + + public static final UpdateBountiesRequestBusinessGoalType OTHER = + new UpdateBountiesRequestBusinessGoalType(Value.OTHER, "other"); + + public static final UpdateBountiesRequestBusinessGoalType UGC_CONTENT = + new UpdateBountiesRequestBusinessGoalType(Value.UGC_CONTENT, "ugc_content"); + + public static final UpdateBountiesRequestBusinessGoalType CLIPPING = + new UpdateBountiesRequestBusinessGoalType(Value.CLIPPING, "clipping"); + + public static final UpdateBountiesRequestBusinessGoalType POST_ENGAGEMENT = + new UpdateBountiesRequestBusinessGoalType(Value.POST_ENGAGEMENT, "post_engagement"); + + public static final UpdateBountiesRequestBusinessGoalType OWNED_ACCOUNT_GROWTH = + new UpdateBountiesRequestBusinessGoalType(Value.OWNED_ACCOUNT_GROWTH, "owned_account_growth"); + + public static final UpdateBountiesRequestBusinessGoalType DATA_CAPTURE = + new UpdateBountiesRequestBusinessGoalType(Value.DATA_CAPTURE, "data_capture"); + + private final Value value; + + private final String string; + + UpdateBountiesRequestBusinessGoalType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateBountiesRequestBusinessGoalType + && this.string.equals(((UpdateBountiesRequestBusinessGoalType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LOCAL_ACTIVATION: + return visitor.visitLocalActivation(); + case OTHER: + return visitor.visitOther(); + case UGC_CONTENT: + return visitor.visitUgcContent(); + case CLIPPING: + return visitor.visitClipping(); + case POST_ENGAGEMENT: + return visitor.visitPostEngagement(); + case OWNED_ACCOUNT_GROWTH: + return visitor.visitOwnedAccountGrowth(); + case DATA_CAPTURE: + return visitor.visitDataCapture(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateBountiesRequestBusinessGoalType valueOf(String value) { + switch (value) { + case "local_activation": + return LOCAL_ACTIVATION; + case "other": + return OTHER; + case "ugc_content": + return UGC_CONTENT; + case "clipping": + return CLIPPING; + case "post_engagement": + return POST_ENGAGEMENT; + case "owned_account_growth": + return OWNED_ACCOUNT_GROWTH; + case "data_capture": + return DATA_CAPTURE; + default: + return new UpdateBountiesRequestBusinessGoalType(Value.UNKNOWN, value); + } + } + + public enum Value { + CLIPPING, + + POST_ENGAGEMENT, + + OWNED_ACCOUNT_GROWTH, + + UGC_CONTENT, + + LOCAL_ACTIVATION, + + DATA_CAPTURE, + + OTHER, + + UNKNOWN + } + + public interface Visitor { + T visitClipping(); + + T visitPostEngagement(); + + T visitOwnedAccountGrowth(); + + T visitUgcContent(); + + T visitLocalActivation(); + + T visitDataCapture(); + + T visitOther(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bounties/types/UpdateBountiesRequestFrequency.java b/src/main/java/com/whop/api/resources/bounties/types/UpdateBountiesRequestFrequency.java new file mode 100644 index 00000000..53483c1e --- /dev/null +++ b/src/main/java/com/whop/api/resources/bounties/types/UpdateBountiesRequestFrequency.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bounties.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateBountiesRequestFrequency { + public static final UpdateBountiesRequestFrequency HOURLY = + new UpdateBountiesRequestFrequency(Value.HOURLY, "hourly"); + + public static final UpdateBountiesRequestFrequency ONCE = new UpdateBountiesRequestFrequency(Value.ONCE, "once"); + + public static final UpdateBountiesRequestFrequency DAILY = new UpdateBountiesRequestFrequency(Value.DAILY, "daily"); + + public static final UpdateBountiesRequestFrequency WEEKLY = + new UpdateBountiesRequestFrequency(Value.WEEKLY, "weekly"); + + public static final UpdateBountiesRequestFrequency MONTHLY = + new UpdateBountiesRequestFrequency(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + UpdateBountiesRequestFrequency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateBountiesRequestFrequency + && this.string.equals(((UpdateBountiesRequestFrequency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HOURLY: + return visitor.visitHourly(); + case ONCE: + return visitor.visitOnce(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateBountiesRequestFrequency valueOf(String value) { + switch (value) { + case "hourly": + return HOURLY; + case "once": + return ONCE; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new UpdateBountiesRequestFrequency(Value.UNKNOWN, value); + } + } + + public enum Value { + ONCE, + + HOURLY, + + DAILY, + + WEEKLY, + + MONTHLY, + + UNKNOWN + } + + public interface Visitor { + T visitOnce(); + + T visitHourly(); + + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/AsyncBountySubmissionsClient.java b/src/main/java/com/whop/api/resources/bountysubmissions/AsyncBountySubmissionsClient.java new file mode 100644 index 00000000..c071e094 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/AsyncBountySubmissionsClient.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.bountysubmissions.requests.CreateBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.DeleteBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.ListBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.RetrieveBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.SubmitBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.types.DeleteBountySubmissionsResponse; +import com.whop.api.types.BountySubmission; +import java.util.concurrent.CompletableFuture; + +public class AsyncBountySubmissionsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawBountySubmissionsClient rawClient; + + public AsyncBountySubmissionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawBountySubmissionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawBountySubmissionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public CompletableFuture> list(ListBountySubmissionsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public CompletableFuture> list( + ListBountySubmissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates a submission on a workforce bounty. Include a deliverable payload — any combination of links and uploaded files, with at least one of the two — and the submission goes straight to review; create is the only step. For data_capture bounties, omit the deliverable: this starts a claimed attempt whose proof accumulates server-side, and the separate submit endpoint sends it to review once complete. Requires a user credential — account API keys cannot author submissions. + */ + public CompletableFuture create(CreateBountySubmissionsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Creates a submission on a workforce bounty. Include a deliverable payload — any combination of links and uploaded files, with at least one of the two — and the submission goes straight to review; create is the only step. For data_capture bounties, omit the deliverable: this starts a claimed attempt whose proof accumulates server-side, and the separate submit endpoint sends it to review once complete. Requires a user credential — account API keys cannot author submissions. + */ + public CompletableFuture create( + CreateBountySubmissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public CompletableFuture retrieve(String id, RetrieveBountySubmissionsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public CompletableFuture retrieve( + String id, RetrieveBountySubmissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public CompletableFuture delete( + String id, DeleteBountySubmissionsRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public CompletableFuture delete( + String id, DeleteBountySubmissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public CompletableFuture submit(String id) { + return this.rawClient.submit(id).thenApply(response -> response.body()); + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public CompletableFuture submit(String id, RequestOptions requestOptions) { + return this.rawClient.submit(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public CompletableFuture submit(String id, SubmitBountySubmissionsRequest request) { + return this.rawClient.submit(id, request).thenApply(response -> response.body()); + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public CompletableFuture submit( + String id, SubmitBountySubmissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.submit(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/AsyncRawBountySubmissionsClient.java b/src/main/java/com/whop/api/resources/bountysubmissions/AsyncRawBountySubmissionsClient.java new file mode 100644 index 00000000..20c0a5cc --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/AsyncRawBountySubmissionsClient.java @@ -0,0 +1,616 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.bountysubmissions.requests.CreateBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.DeleteBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.ListBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.RetrieveBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.SubmitBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.types.DeleteBountySubmissionsResponse; +import com.whop.api.resources.bountysubmissions.types.ListBountySubmissionsResponse; +import com.whop.api.types.BountySubmission; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawBountySubmissionsClient { + protected final ClientOptions clientOptions; + + public AsyncRawBountySubmissionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public CompletableFuture>> list() { + return list(ListBountySubmissionsRequest.builder().build()); + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListBountySubmissionsRequest.builder().build(), requestOptions); + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public CompletableFuture>> list( + ListBountySubmissionsRequest request) { + return list(request, null); + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public CompletableFuture>> list( + ListBountySubmissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounty_submissions"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getBountyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "bounty_id", request.getBountyId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListBountySubmissionsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListBountySubmissionsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListBountySubmissionsRequest nextRequest = ListBountySubmissionsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates a submission on a workforce bounty. Include a deliverable payload — any combination of links and uploaded files, with at least one of the two — and the submission goes straight to review; create is the only step. For data_capture bounties, omit the deliverable: this starts a claimed attempt whose proof accumulates server-side, and the separate submit endpoint sends it to review once complete. Requires a user credential — account API keys cannot author submissions. + */ + public CompletableFuture> create(CreateBountySubmissionsRequest request) { + return create(request, null); + } + + /** + * Creates a submission on a workforce bounty. Include a deliverable payload — any combination of links and uploaded files, with at least one of the two — and the submission goes straight to review; create is the only step. For data_capture bounties, omit the deliverable: this starts a claimed attempt whose proof accumulates server-side, and the separate submit endpoint sends it to review once complete. Requires a user credential — account API keys cannot author submissions. + */ + public CompletableFuture> create( + CreateBountySubmissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounty_submissions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BountySubmission.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveBountySubmissionsRequest.builder().build()); + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveBountySubmissionsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public CompletableFuture> retrieve( + String id, RetrieveBountySubmissionsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public CompletableFuture> retrieve( + String id, RetrieveBountySubmissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounty_submissions") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BountySubmission.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteBountySubmissionsRequest.builder().build()); + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public CompletableFuture> delete( + String id, RequestOptions requestOptions) { + return delete(id, DeleteBountySubmissionsRequest.builder().build(), requestOptions); + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public CompletableFuture> delete( + String id, DeleteBountySubmissionsRequest request) { + return delete(id, request, null); + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public CompletableFuture> delete( + String id, DeleteBountySubmissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounty_submissions") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DeleteBountySubmissionsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public CompletableFuture> submit(String id) { + return submit(id, SubmitBountySubmissionsRequest.builder().build()); + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public CompletableFuture> submit(String id, RequestOptions requestOptions) { + return submit(id, SubmitBountySubmissionsRequest.builder().build(), requestOptions); + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public CompletableFuture> submit( + String id, SubmitBountySubmissionsRequest request) { + return submit(id, request, null); + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public CompletableFuture> submit( + String id, SubmitBountySubmissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounty_submissions") + .addPathSegment(id) + .addPathSegments("submit"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BountySubmission.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/BountySubmissionsClient.java b/src/main/java/com/whop/api/resources/bountysubmissions/BountySubmissionsClient.java new file mode 100644 index 00000000..6d5440d8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/BountySubmissionsClient.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.bountysubmissions.requests.CreateBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.DeleteBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.ListBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.RetrieveBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.SubmitBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.types.DeleteBountySubmissionsResponse; +import com.whop.api.types.BountySubmission; + +public class BountySubmissionsClient { + protected final ClientOptions clientOptions; + + private final RawBountySubmissionsClient rawClient; + + public BountySubmissionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawBountySubmissionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawBountySubmissionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public SyncPagingIterable list(ListBountySubmissionsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public SyncPagingIterable list( + ListBountySubmissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Creates a submission on a workforce bounty. Include a deliverable payload — any combination of links and uploaded files, with at least one of the two — and the submission goes straight to review; create is the only step. For data_capture bounties, omit the deliverable: this starts a claimed attempt whose proof accumulates server-side, and the separate submit endpoint sends it to review once complete. Requires a user credential — account API keys cannot author submissions. + */ + public BountySubmission create(CreateBountySubmissionsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Creates a submission on a workforce bounty. Include a deliverable payload — any combination of links and uploaded files, with at least one of the two — and the submission goes straight to review; create is the only step. For data_capture bounties, omit the deliverable: this starts a claimed attempt whose proof accumulates server-side, and the separate submit endpoint sends it to review once complete. Requires a user credential — account API keys cannot author submissions. + */ + public BountySubmission create(CreateBountySubmissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public BountySubmission retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public BountySubmission retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public BountySubmission retrieve(String id, RetrieveBountySubmissionsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public BountySubmission retrieve( + String id, RetrieveBountySubmissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public DeleteBountySubmissionsResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public DeleteBountySubmissionsResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public DeleteBountySubmissionsResponse delete(String id, DeleteBountySubmissionsRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public DeleteBountySubmissionsResponse delete( + String id, DeleteBountySubmissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public BountySubmission submit(String id) { + return this.rawClient.submit(id).body(); + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public BountySubmission submit(String id, RequestOptions requestOptions) { + return this.rawClient.submit(id, requestOptions).body(); + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public BountySubmission submit(String id, SubmitBountySubmissionsRequest request) { + return this.rawClient.submit(id, request).body(); + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public BountySubmission submit(String id, SubmitBountySubmissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.submit(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/RawBountySubmissionsClient.java b/src/main/java/com/whop/api/resources/bountysubmissions/RawBountySubmissionsClient.java new file mode 100644 index 00000000..5416611c --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/RawBountySubmissionsClient.java @@ -0,0 +1,495 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.bountysubmissions.requests.CreateBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.DeleteBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.ListBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.RetrieveBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.requests.SubmitBountySubmissionsRequest; +import com.whop.api.resources.bountysubmissions.types.DeleteBountySubmissionsResponse; +import com.whop.api.resources.bountysubmissions.types.ListBountySubmissionsResponse; +import com.whop.api.types.BountySubmission; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawBountySubmissionsClient { + protected final ClientOptions clientOptions; + + public RawBountySubmissionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public WhopApiHttpResponse> list() { + return list(ListBountySubmissionsRequest.builder().build()); + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListBountySubmissionsRequest.builder().build(), requestOptions); + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public WhopApiHttpResponse> list(ListBountySubmissionsRequest request) { + return list(request, null); + } + + /** + * Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead. + */ + public WhopApiHttpResponse> list( + ListBountySubmissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounty_submissions"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getBountyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "bounty_id", request.getBountyId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListBountySubmissionsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListBountySubmissionsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListBountySubmissionsRequest nextRequest = ListBountySubmissionsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates a submission on a workforce bounty. Include a deliverable payload — any combination of links and uploaded files, with at least one of the two — and the submission goes straight to review; create is the only step. For data_capture bounties, omit the deliverable: this starts a claimed attempt whose proof accumulates server-side, and the separate submit endpoint sends it to review once complete. Requires a user credential — account API keys cannot author submissions. + */ + public WhopApiHttpResponse create(CreateBountySubmissionsRequest request) { + return create(request, null); + } + + /** + * Creates a submission on a workforce bounty. Include a deliverable payload — any combination of links and uploaded files, with at least one of the two — and the submission goes straight to review; create is the only step. For data_capture bounties, omit the deliverable: this starts a claimed attempt whose proof accumulates server-side, and the separate submit endpoint sends it to review once complete. Requires a user credential — account API keys cannot author submissions. + */ + public WhopApiHttpResponse create( + CreateBountySubmissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounty_submissions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BountySubmission.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveBountySubmissionsRequest.builder().build()); + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveBountySubmissionsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveBountySubmissionsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the list does. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveBountySubmissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounty_submissions") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BountySubmission.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteBountySubmissionsRequest.builder().build()); + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteBountySubmissionsRequest.builder().build(), requestOptions); + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public WhopApiHttpResponse delete( + String id, DeleteBountySubmissionsRequest request) { + return delete(id, request, null); + } + + /** + * Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot. + */ + public WhopApiHttpResponse delete( + String id, DeleteBountySubmissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounty_submissions") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteBountySubmissionsResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public WhopApiHttpResponse submit(String id) { + return submit(id, SubmitBountySubmissionsRequest.builder().build()); + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public WhopApiHttpResponse submit(String id, RequestOptions requestOptions) { + return submit(id, SubmitBountySubmissionsRequest.builder().build(), requestOptions); + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public WhopApiHttpResponse submit(String id, SubmitBountySubmissionsRequest request) { + return submit(id, request, null); + } + + /** + * Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an optional deliverable — links, files, and a caption in any combination; if the attempt already went to review when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can submit it — account API keys cannot. + */ + public WhopApiHttpResponse submit( + String id, SubmitBountySubmissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("bounty_submissions") + .addPathSegment(id) + .addPathSegments("submit"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BountySubmission.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/requests/CreateBountySubmissionsRequest.java b/src/main/java/com/whop/api/resources/bountysubmissions/requests/CreateBountySubmissionsRequest.java new file mode 100644 index 00000000..aaccf1cc --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/requests/CreateBountySubmissionsRequest.java @@ -0,0 +1,349 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.bountysubmissions.types.CreateBountySubmissionsRequestDeliverable; +import com.whop.api.resources.bountysubmissions.types.CreateBountySubmissionsRequestMetadata; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateBountySubmissionsRequest.Builder.class) +public final class CreateBountySubmissionsRequest { + private final Optional affiliateCode; + + private final String bountyId; + + private final Optional deliverable; + + private final Optional metadata; + + private final Map additionalProperties; + + private CreateBountySubmissionsRequest( + Optional affiliateCode, + String bountyId, + Optional deliverable, + Optional metadata, + Map additionalProperties) { + this.affiliateCode = affiliateCode; + this.bountyId = bountyId; + this.deliverable = deliverable; + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + /** + * @return Affiliate code crediting the referrer, when the worker arrived through one. + */ + @JsonIgnore + public Optional getAffiliateCode() { + if (affiliateCode == null) { + return Optional.empty(); + } + return affiliateCode; + } + + /** + * @return The bounty to submit to (bnty_ tag). + */ + @JsonProperty("bounty_id") + public String getBountyId() { + return bountyId; + } + + /** + * @return The submitted work. Combine urls, file_ids, and caption freely; at least one link or file is required. + */ + @JsonIgnore + public Optional getDeliverable() { + if (deliverable == null) { + return Optional.empty(); + } + return deliverable; + } + + /** + * @return Optional capture metadata describing where and how the footage was recorded. Persisted on the submission. On a data_capture bounty every field except fov is required whenever metadata is provided. + */ + @JsonIgnore + public Optional getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("affiliate_code") + private Optional _getAffiliateCode() { + return affiliateCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("deliverable") + private Optional _getDeliverable() { + return deliverable; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional _getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateBountySubmissionsRequest && equalTo((CreateBountySubmissionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateBountySubmissionsRequest other) { + return affiliateCode.equals(other.affiliateCode) + && bountyId.equals(other.bountyId) + && deliverable.equals(other.deliverable) + && metadata.equals(other.metadata); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.affiliateCode, this.bountyId, this.deliverable, this.metadata); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BountyIdStage builder() { + return new Builder(); + } + + public interface BountyIdStage { + /** + *

The bounty to submit to (bnty_ tag).

+ */ + _FinalStage bountyId(@NotNull String bountyId); + + Builder from(CreateBountySubmissionsRequest other); + } + + public interface _FinalStage { + CreateBountySubmissionsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Affiliate code crediting the referrer, when the worker arrived through one.

+ */ + _FinalStage affiliateCode(Optional affiliateCode); + + _FinalStage affiliateCode(String affiliateCode); + + _FinalStage affiliateCode(Nullable affiliateCode); + + /** + *

The submitted work. Combine urls, file_ids, and caption freely; at least one link or file is required.

+ */ + _FinalStage deliverable(Optional deliverable); + + _FinalStage deliverable(CreateBountySubmissionsRequestDeliverable deliverable); + + _FinalStage deliverable(Nullable deliverable); + + /** + *

Optional capture metadata describing where and how the footage was recorded. Persisted on the submission. On a data_capture bounty every field except fov is required whenever metadata is provided.

+ */ + _FinalStage metadata(Optional metadata); + + _FinalStage metadata(CreateBountySubmissionsRequestMetadata metadata); + + _FinalStage metadata(Nullable metadata); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BountyIdStage, _FinalStage { + private String bountyId; + + private Optional metadata = Optional.empty(); + + private Optional deliverable = Optional.empty(); + + private Optional affiliateCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateBountySubmissionsRequest other) { + affiliateCode(other.getAffiliateCode()); + bountyId(other.getBountyId()); + deliverable(other.getDeliverable()); + metadata(other.getMetadata()); + return this; + } + + /** + *

The bounty to submit to (bnty_ tag).

+ *

The bounty to submit to (bnty_ tag).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bounty_id") + public _FinalStage bountyId(@NotNull String bountyId) { + this.bountyId = Objects.requireNonNull(bountyId, "bountyId must not be null"); + return this; + } + + /** + *

Optional capture metadata describing where and how the footage was recorded. Persisted on the submission. On a data_capture bounty every field except fov is required whenever metadata is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Optional capture metadata describing where and how the footage was recorded. Persisted on the submission. On a data_capture bounty every field except fov is required whenever metadata is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(CreateBountySubmissionsRequestMetadata metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Optional capture metadata describing where and how the footage was recorded. Persisted on the submission. On a data_capture bounty every field except fov is required whenever metadata is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The submitted work. Combine urls, file_ids, and caption freely; at least one link or file is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage deliverable(Nullable deliverable) { + if (deliverable.isNull()) { + this.deliverable = null; + } else if (deliverable.isEmpty()) { + this.deliverable = Optional.empty(); + } else { + this.deliverable = Optional.of(deliverable.get()); + } + return this; + } + + /** + *

The submitted work. Combine urls, file_ids, and caption freely; at least one link or file is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage deliverable(CreateBountySubmissionsRequestDeliverable deliverable) { + this.deliverable = Optional.ofNullable(deliverable); + return this; + } + + /** + *

The submitted work. Combine urls, file_ids, and caption freely; at least one link or file is required.

+ */ + @java.lang.Override + @JsonSetter(value = "deliverable", nulls = Nulls.SKIP) + public _FinalStage deliverable(Optional deliverable) { + this.deliverable = deliverable; + return this; + } + + /** + *

Affiliate code crediting the referrer, when the worker arrived through one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage affiliateCode(Nullable affiliateCode) { + if (affiliateCode.isNull()) { + this.affiliateCode = null; + } else if (affiliateCode.isEmpty()) { + this.affiliateCode = Optional.empty(); + } else { + this.affiliateCode = Optional.of(affiliateCode.get()); + } + return this; + } + + /** + *

Affiliate code crediting the referrer, when the worker arrived through one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage affiliateCode(String affiliateCode) { + this.affiliateCode = Optional.ofNullable(affiliateCode); + return this; + } + + /** + *

Affiliate code crediting the referrer, when the worker arrived through one.

+ */ + @java.lang.Override + @JsonSetter(value = "affiliate_code", nulls = Nulls.SKIP) + public _FinalStage affiliateCode(Optional affiliateCode) { + this.affiliateCode = affiliateCode; + return this; + } + + @java.lang.Override + public CreateBountySubmissionsRequest build() { + return new CreateBountySubmissionsRequest( + affiliateCode, bountyId, deliverable, metadata, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/requests/DeleteBountySubmissionsRequest.java b/src/main/java/com/whop/api/resources/bountysubmissions/requests/DeleteBountySubmissionsRequest.java new file mode 100644 index 00000000..2db6b42c --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/requests/DeleteBountySubmissionsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteBountySubmissionsRequest.Builder.class) +public final class DeleteBountySubmissionsRequest { + private final Map additionalProperties; + + private DeleteBountySubmissionsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteBountySubmissionsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteBountySubmissionsRequest other) { + return this; + } + + public DeleteBountySubmissionsRequest build() { + return new DeleteBountySubmissionsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/requests/ListBountySubmissionsRequest.java b/src/main/java/com/whop/api/resources/bountysubmissions/requests/ListBountySubmissionsRequest.java new file mode 100644 index 00000000..5c351ac9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/requests/ListBountySubmissionsRequest.java @@ -0,0 +1,439 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.bountysubmissions.types.ListBountySubmissionsRequestDirection; +import com.whop.api.resources.bountysubmissions.types.ListBountySubmissionsRequestOrder; +import com.whop.api.resources.bountysubmissions.types.ListBountySubmissionsRequestStatus; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBountySubmissionsRequest.Builder.class) +public final class ListBountySubmissionsRequest { + private final Optional accountId; + + private final Optional bountyId; + + private final Optional status; + + private final Optional createdAfter; + + private final Optional createdBefore; + + private final Optional order; + + private final Optional direction; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListBountySubmissionsRequest( + Optional accountId, + Optional bountyId, + Optional status, + Optional createdAfter, + Optional createdBefore, + Optional order, + Optional direction, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.accountId = accountId; + this.bountyId = bountyId; + this.status = status; + this.createdAfter = createdAfter; + this.createdBefore = createdBefore; + this.order = order; + this.direction = direction; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Scope the list to submissions on this account's bounties (biz_ tag). Requires read access to the account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Only submissions on this bounty (bnty_ tag). + */ + @JsonProperty("bounty_id") + public Optional getBountyId() { + return bountyId; + } + + /** + * @return Filter by lifecycle state. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Only submissions created after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Only submissions created before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Sort field. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Number of submissions to return from the start of the window. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to paginate forwards from. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return Number of submissions to return from the end of the window. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to paginate backwards from. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBountySubmissionsRequest && equalTo((ListBountySubmissionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBountySubmissionsRequest other) { + return accountId.equals(other.accountId) + && bountyId.equals(other.bountyId) + && status.equals(other.status) + && createdAfter.equals(other.createdAfter) + && createdBefore.equals(other.createdBefore) + && order.equals(other.order) + && direction.equals(other.direction) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.bountyId, + this.status, + this.createdAfter, + this.createdBefore, + this.order, + this.direction, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional bountyId = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListBountySubmissionsRequest other) { + accountId(other.getAccountId()); + bountyId(other.getBountyId()); + status(other.getStatus()); + createdAfter(other.getCreatedAfter()); + createdBefore(other.getCreatedBefore()); + order(other.getOrder()); + direction(other.getDirection()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

Scope the list to submissions on this account's bounties (biz_ tag). Requires read access to the account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Only submissions on this bounty (bnty_ tag).

+ */ + @JsonSetter(value = "bounty_id", nulls = Nulls.SKIP) + public Builder bountyId(Optional bountyId) { + this.bountyId = bountyId; + return this; + } + + public Builder bountyId(String bountyId) { + this.bountyId = Optional.ofNullable(bountyId); + return this; + } + + /** + *

Filter by lifecycle state.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListBountySubmissionsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Only submissions created after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only submissions created before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Sort field.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListBountySubmissionsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListBountySubmissionsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Number of submissions to return from the start of the window.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to paginate forwards from.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Number of submissions to return from the end of the window.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to paginate backwards from.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListBountySubmissionsRequest build() { + return new ListBountySubmissionsRequest( + accountId, + bountyId, + status, + createdAfter, + createdBefore, + order, + direction, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/requests/RetrieveBountySubmissionsRequest.java b/src/main/java/com/whop/api/resources/bountysubmissions/requests/RetrieveBountySubmissionsRequest.java new file mode 100644 index 00000000..09d5df14 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/requests/RetrieveBountySubmissionsRequest.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveBountySubmissionsRequest.Builder.class) +public final class RetrieveBountySubmissionsRequest { + private final Optional accountId; + + private final Map additionalProperties; + + private RetrieveBountySubmissionsRequest(Optional accountId, Map additionalProperties) { + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Read the submission as this account (biz_ tag), scoping the lookup to its bounties rather than the caller's own work. Requires read access to the account. Without it the lookup covers only what the credential owns — the submissions the caller authored plus those on bounties they posted. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveBountySubmissionsRequest && equalTo((RetrieveBountySubmissionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveBountySubmissionsRequest other) { + return accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveBountySubmissionsRequest other) { + accountId(other.getAccountId()); + return this; + } + + /** + *

Read the submission as this account (biz_ tag), scoping the lookup to its bounties rather than the caller's own work. Requires read access to the account. Without it the lookup covers only what the credential owns — the submissions the caller authored plus those on bounties they posted.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + public RetrieveBountySubmissionsRequest build() { + return new RetrieveBountySubmissionsRequest(accountId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/requests/SubmitBountySubmissionsRequest.java b/src/main/java/com/whop/api/resources/bountysubmissions/requests/SubmitBountySubmissionsRequest.java new file mode 100644 index 00000000..6a1d07d2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/requests/SubmitBountySubmissionsRequest.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.bountysubmissions.types.SubmitBountySubmissionsRequestDeliverable; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SubmitBountySubmissionsRequest.Builder.class) +public final class SubmitBountySubmissionsRequest { + private final Optional deliverable; + + private final Map additionalProperties; + + private SubmitBountySubmissionsRequest( + Optional deliverable, Map additionalProperties) { + this.deliverable = deliverable; + this.additionalProperties = additionalProperties; + } + + /** + * @return Work to attach to the submission. Combine urls, file_ids, and caption freely; all are optional. + */ + @JsonIgnore + public Optional getDeliverable() { + if (deliverable == null) { + return Optional.empty(); + } + return deliverable; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("deliverable") + private Optional _getDeliverable() { + return deliverable; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SubmitBountySubmissionsRequest && equalTo((SubmitBountySubmissionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SubmitBountySubmissionsRequest other) { + return deliverable.equals(other.deliverable); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deliverable); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional deliverable = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SubmitBountySubmissionsRequest other) { + deliverable(other.getDeliverable()); + return this; + } + + /** + *

Work to attach to the submission. Combine urls, file_ids, and caption freely; all are optional.

+ */ + @JsonSetter(value = "deliverable", nulls = Nulls.SKIP) + public Builder deliverable(Optional deliverable) { + this.deliverable = deliverable; + return this; + } + + public Builder deliverable(SubmitBountySubmissionsRequestDeliverable deliverable) { + this.deliverable = Optional.ofNullable(deliverable); + return this; + } + + public Builder deliverable(Nullable deliverable) { + if (deliverable.isNull()) { + this.deliverable = null; + } else if (deliverable.isEmpty()) { + this.deliverable = Optional.empty(); + } else { + this.deliverable = Optional.of(deliverable.get()); + } + return this; + } + + public SubmitBountySubmissionsRequest build() { + return new SubmitBountySubmissionsRequest(deliverable, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/types/CreateBountySubmissionsRequestDeliverable.java b/src/main/java/com/whop/api/resources/bountysubmissions/types/CreateBountySubmissionsRequestDeliverable.java new file mode 100644 index 00000000..684f82c1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/types/CreateBountySubmissionsRequestDeliverable.java @@ -0,0 +1,248 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateBountySubmissionsRequestDeliverable.Builder.class) +public final class CreateBountySubmissionsRequestDeliverable { + private final Optional caption; + + private final Optional> fileIds; + + private final Optional type; + + private final Optional> urls; + + private final Map additionalProperties; + + private CreateBountySubmissionsRequestDeliverable( + Optional caption, + Optional> fileIds, + Optional type, + Optional> urls, + Map additionalProperties) { + this.caption = caption; + this.fileIds = fileIds; + this.type = type; + this.urls = urls; + this.additionalProperties = additionalProperties; + } + + /** + * @return Written context shown to reviewers alongside the work. + */ + @JsonIgnore + public Optional getCaption() { + if (caption == null) { + return Optional.empty(); + } + return caption; + } + + /** + * @return IDs of uploaded files attached as work, up to 10, each prefixed file_. Combinable with urls and caption. + */ + @JsonProperty("file_ids") + public Optional> getFileIds() { + return fileIds; + } + + /** + * @return Legacy shape selector; no longer selects anything. When present it must name an inline shape (content_url or media). + */ + @JsonIgnore + public Optional getType() { + if (type == null) { + return Optional.empty(); + } + return type; + } + + /** + * @return Links to the posted work, up to 10. Combinable with file_ids and caption. + */ + @JsonProperty("urls") + public Optional> getUrls() { + return urls; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("caption") + private Optional _getCaption() { + return caption; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("type") + private Optional _getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateBountySubmissionsRequestDeliverable + && equalTo((CreateBountySubmissionsRequestDeliverable) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateBountySubmissionsRequestDeliverable other) { + return caption.equals(other.caption) + && fileIds.equals(other.fileIds) + && type.equals(other.type) + && urls.equals(other.urls); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.caption, this.fileIds, this.type, this.urls); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional caption = Optional.empty(); + + private Optional> fileIds = Optional.empty(); + + private Optional type = Optional.empty(); + + private Optional> urls = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateBountySubmissionsRequestDeliverable other) { + caption(other.getCaption()); + fileIds(other.getFileIds()); + type(other.getType()); + urls(other.getUrls()); + return this; + } + + /** + *

Written context shown to reviewers alongside the work.

+ */ + @JsonSetter(value = "caption", nulls = Nulls.SKIP) + public Builder caption(Optional caption) { + this.caption = caption; + return this; + } + + public Builder caption(String caption) { + this.caption = Optional.ofNullable(caption); + return this; + } + + public Builder caption(Nullable caption) { + if (caption.isNull()) { + this.caption = null; + } else if (caption.isEmpty()) { + this.caption = Optional.empty(); + } else { + this.caption = Optional.of(caption.get()); + } + return this; + } + + /** + *

IDs of uploaded files attached as work, up to 10, each prefixed file_. Combinable with urls and caption.

+ */ + @JsonSetter(value = "file_ids", nulls = Nulls.SKIP) + public Builder fileIds(Optional> fileIds) { + this.fileIds = fileIds; + return this; + } + + public Builder fileIds(List fileIds) { + this.fileIds = Optional.ofNullable(fileIds); + return this; + } + + /** + *

Legacy shape selector; no longer selects anything. When present it must name an inline shape (content_url or media).

+ */ + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(CreateBountySubmissionsRequestDeliverableType type) { + this.type = Optional.ofNullable(type); + return this; + } + + public Builder type(Nullable type) { + if (type.isNull()) { + this.type = null; + } else if (type.isEmpty()) { + this.type = Optional.empty(); + } else { + this.type = Optional.of(type.get()); + } + return this; + } + + /** + *

Links to the posted work, up to 10. Combinable with file_ids and caption.

+ */ + @JsonSetter(value = "urls", nulls = Nulls.SKIP) + public Builder urls(Optional> urls) { + this.urls = urls; + return this; + } + + public Builder urls(List urls) { + this.urls = Optional.ofNullable(urls); + return this; + } + + public CreateBountySubmissionsRequestDeliverable build() { + return new CreateBountySubmissionsRequestDeliverable(caption, fileIds, type, urls, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/types/CreateBountySubmissionsRequestDeliverableType.java b/src/main/java/com/whop/api/resources/bountysubmissions/types/CreateBountySubmissionsRequestDeliverableType.java new file mode 100644 index 00000000..220f0a0f --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/types/CreateBountySubmissionsRequestDeliverableType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateBountySubmissionsRequestDeliverableType { + public static final CreateBountySubmissionsRequestDeliverableType CONTENT_URL = + new CreateBountySubmissionsRequestDeliverableType(Value.CONTENT_URL, "content_url"); + + public static final CreateBountySubmissionsRequestDeliverableType MEDIA = + new CreateBountySubmissionsRequestDeliverableType(Value.MEDIA, "media"); + + private final Value value; + + private final String string; + + CreateBountySubmissionsRequestDeliverableType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateBountySubmissionsRequestDeliverableType + && this.string.equals(((CreateBountySubmissionsRequestDeliverableType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CONTENT_URL: + return visitor.visitContentUrl(); + case MEDIA: + return visitor.visitMedia(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateBountySubmissionsRequestDeliverableType valueOf(String value) { + switch (value) { + case "content_url": + return CONTENT_URL; + case "media": + return MEDIA; + default: + return new CreateBountySubmissionsRequestDeliverableType(Value.UNKNOWN, value); + } + } + + public enum Value { + CONTENT_URL, + + MEDIA, + + UNKNOWN + } + + public interface Visitor { + T visitContentUrl(); + + T visitMedia(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/types/CreateBountySubmissionsRequestMetadata.java b/src/main/java/com/whop/api/resources/bountysubmissions/types/CreateBountySubmissionsRequestMetadata.java new file mode 100644 index 00000000..ec7af244 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/types/CreateBountySubmissionsRequestMetadata.java @@ -0,0 +1,438 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateBountySubmissionsRequestMetadata.Builder.class) +public final class CreateBountySubmissionsRequestMetadata { + private final Optional city; + + private final Optional country; + + private final Optional device; + + private final Optional fov; + + private final Optional operator; + + private final Optional site; + + private final Optional station; + + private final Map additionalProperties; + + private CreateBountySubmissionsRequestMetadata( + Optional city, + Optional country, + Optional device, + Optional fov, + Optional operator, + Optional site, + Optional station, + Map additionalProperties) { + this.city = city; + this.country = country; + this.device = device; + this.fov = fov; + this.operator = operator; + this.site = site; + this.station = station; + this.additionalProperties = additionalProperties; + } + + /** + * @return City the footage was recorded in. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Country the footage was recorded in. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return Device the footage was recorded on. + */ + @JsonIgnore + public Optional getDevice() { + if (device == null) { + return Optional.empty(); + } + return device; + } + + /** + * @return Horizontal field of view in degrees. + */ + @JsonIgnore + public Optional getFov() { + if (fov == null) { + return Optional.empty(); + } + return fov; + } + + /** + * @return Identifier of the person who recorded the footage. + */ + @JsonIgnore + public Optional getOperator() { + if (operator == null) { + return Optional.empty(); + } + return operator; + } + + /** + * @return Site or venue the footage was recorded at. + */ + @JsonIgnore + public Optional getSite() { + if (site == null) { + return Optional.empty(); + } + return site; + } + + /** + * @return Station or position within the site. + */ + @JsonIgnore + public Optional getStation() { + if (station == null) { + return Optional.empty(); + } + return station; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("device") + private Optional _getDevice() { + return device; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fov") + private Optional _getFov() { + return fov; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("operator") + private Optional _getOperator() { + return operator; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("site") + private Optional _getSite() { + return site; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("station") + private Optional _getStation() { + return station; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateBountySubmissionsRequestMetadata + && equalTo((CreateBountySubmissionsRequestMetadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateBountySubmissionsRequestMetadata other) { + return city.equals(other.city) + && country.equals(other.country) + && device.equals(other.device) + && fov.equals(other.fov) + && operator.equals(other.operator) + && site.equals(other.site) + && station.equals(other.station); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.device, this.fov, this.operator, this.site, this.station); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional device = Optional.empty(); + + private Optional fov = Optional.empty(); + + private Optional operator = Optional.empty(); + + private Optional site = Optional.empty(); + + private Optional station = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateBountySubmissionsRequestMetadata other) { + city(other.getCity()); + country(other.getCountry()); + device(other.getDevice()); + fov(other.getFov()); + operator(other.getOperator()); + site(other.getSite()); + station(other.getStation()); + return this; + } + + /** + *

City the footage was recorded in.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Country the footage was recorded in.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

Device the footage was recorded on.

+ */ + @JsonSetter(value = "device", nulls = Nulls.SKIP) + public Builder device(Optional device) { + this.device = device; + return this; + } + + public Builder device(String device) { + this.device = Optional.ofNullable(device); + return this; + } + + public Builder device(Nullable device) { + if (device.isNull()) { + this.device = null; + } else if (device.isEmpty()) { + this.device = Optional.empty(); + } else { + this.device = Optional.of(device.get()); + } + return this; + } + + /** + *

Horizontal field of view in degrees.

+ */ + @JsonSetter(value = "fov", nulls = Nulls.SKIP) + public Builder fov(Optional fov) { + this.fov = fov; + return this; + } + + public Builder fov(Integer fov) { + this.fov = Optional.ofNullable(fov); + return this; + } + + public Builder fov(Nullable fov) { + if (fov.isNull()) { + this.fov = null; + } else if (fov.isEmpty()) { + this.fov = Optional.empty(); + } else { + this.fov = Optional.of(fov.get()); + } + return this; + } + + /** + *

Identifier of the person who recorded the footage.

+ */ + @JsonSetter(value = "operator", nulls = Nulls.SKIP) + public Builder operator(Optional operator) { + this.operator = operator; + return this; + } + + public Builder operator(String operator) { + this.operator = Optional.ofNullable(operator); + return this; + } + + public Builder operator(Nullable operator) { + if (operator.isNull()) { + this.operator = null; + } else if (operator.isEmpty()) { + this.operator = Optional.empty(); + } else { + this.operator = Optional.of(operator.get()); + } + return this; + } + + /** + *

Site or venue the footage was recorded at.

+ */ + @JsonSetter(value = "site", nulls = Nulls.SKIP) + public Builder site(Optional site) { + this.site = site; + return this; + } + + public Builder site(String site) { + this.site = Optional.ofNullable(site); + return this; + } + + public Builder site(Nullable site) { + if (site.isNull()) { + this.site = null; + } else if (site.isEmpty()) { + this.site = Optional.empty(); + } else { + this.site = Optional.of(site.get()); + } + return this; + } + + /** + *

Station or position within the site.

+ */ + @JsonSetter(value = "station", nulls = Nulls.SKIP) + public Builder station(Optional station) { + this.station = station; + return this; + } + + public Builder station(String station) { + this.station = Optional.ofNullable(station); + return this; + } + + public Builder station(Nullable station) { + if (station.isNull()) { + this.station = null; + } else if (station.isEmpty()) { + this.station = Optional.empty(); + } else { + this.station = Optional.of(station.get()); + } + return this; + } + + public CreateBountySubmissionsRequestMetadata build() { + return new CreateBountySubmissionsRequestMetadata( + city, country, device, fov, operator, site, station, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/types/DeleteBountySubmissionsResponse.java b/src/main/java/com/whop/api/resources/bountysubmissions/types/DeleteBountySubmissionsResponse.java new file mode 100644 index 00000000..d864c1d0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/types/DeleteBountySubmissionsResponse.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteBountySubmissionsResponse.Builder.class) +public final class DeleteBountySubmissionsResponse { + private final boolean deleted; + + private final String id; + + private final Map additionalProperties; + + private DeleteBountySubmissionsResponse(boolean deleted, String id, Map additionalProperties) { + this.deleted = deleted; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Always true. + */ + @JsonProperty("deleted") + public boolean getDeleted() { + return deleted; + } + + /** + * @return ID of the cancelled submission. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteBountySubmissionsResponse && equalTo((DeleteBountySubmissionsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteBountySubmissionsResponse other) { + return deleted == other.deleted && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deleted, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeletedStage builder() { + return new Builder(); + } + + public interface DeletedStage { + /** + *

Always true.

+ */ + IdStage deleted(boolean deleted); + + Builder from(DeleteBountySubmissionsResponse other); + } + + public interface IdStage { + /** + *

ID of the cancelled submission.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DeleteBountySubmissionsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeletedStage, IdStage, _FinalStage { + private boolean deleted; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeleteBountySubmissionsResponse other) { + deleted(other.getDeleted()); + id(other.getId()); + return this; + } + + /** + *

Always true.

+ *

Always true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("deleted") + public IdStage deleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + *

ID of the cancelled submission.

+ *

ID of the cancelled submission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DeleteBountySubmissionsResponse build() { + return new DeleteBountySubmissionsResponse(deleted, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/types/ListBountySubmissionsRequestDirection.java b/src/main/java/com/whop/api/resources/bountysubmissions/types/ListBountySubmissionsRequestDirection.java new file mode 100644 index 00000000..abad7285 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/types/ListBountySubmissionsRequestDirection.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListBountySubmissionsRequestDirection { + public static final ListBountySubmissionsRequestDirection ASC = + new ListBountySubmissionsRequestDirection(Value.ASC, "asc"); + + public static final ListBountySubmissionsRequestDirection DESC = + new ListBountySubmissionsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListBountySubmissionsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListBountySubmissionsRequestDirection + && this.string.equals(((ListBountySubmissionsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListBountySubmissionsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListBountySubmissionsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/types/ListBountySubmissionsRequestOrder.java b/src/main/java/com/whop/api/resources/bountysubmissions/types/ListBountySubmissionsRequestOrder.java new file mode 100644 index 00000000..3e37b760 --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/types/ListBountySubmissionsRequestOrder.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListBountySubmissionsRequestOrder { + public static final ListBountySubmissionsRequestOrder UPDATED_AT = + new ListBountySubmissionsRequestOrder(Value.UPDATED_AT, "updated_at"); + + public static final ListBountySubmissionsRequestOrder CREATED_AT = + new ListBountySubmissionsRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListBountySubmissionsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListBountySubmissionsRequestOrder + && this.string.equals(((ListBountySubmissionsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case UPDATED_AT: + return visitor.visitUpdatedAt(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListBountySubmissionsRequestOrder valueOf(String value) { + switch (value) { + case "updated_at": + return UPDATED_AT; + case "created_at": + return CREATED_AT; + default: + return new ListBountySubmissionsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UPDATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUpdatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/types/ListBountySubmissionsRequestStatus.java b/src/main/java/com/whop/api/resources/bountysubmissions/types/ListBountySubmissionsRequestStatus.java new file mode 100644 index 00000000..bfaa413c --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/types/ListBountySubmissionsRequestStatus.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListBountySubmissionsRequestStatus { + public static final ListBountySubmissionsRequestStatus APPROVED = + new ListBountySubmissionsRequestStatus(Value.APPROVED, "approved"); + + public static final ListBountySubmissionsRequestStatus IN_PROGRESS = + new ListBountySubmissionsRequestStatus(Value.IN_PROGRESS, "in_progress"); + + public static final ListBountySubmissionsRequestStatus DENIED = + new ListBountySubmissionsRequestStatus(Value.DENIED, "denied"); + + public static final ListBountySubmissionsRequestStatus SUBMITTED = + new ListBountySubmissionsRequestStatus(Value.SUBMITTED, "submitted"); + + private final Value value; + + private final String string; + + ListBountySubmissionsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListBountySubmissionsRequestStatus + && this.string.equals(((ListBountySubmissionsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case IN_PROGRESS: + return visitor.visitInProgress(); + case DENIED: + return visitor.visitDenied(); + case SUBMITTED: + return visitor.visitSubmitted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListBountySubmissionsRequestStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "in_progress": + return IN_PROGRESS; + case "denied": + return DENIED; + case "submitted": + return SUBMITTED; + default: + return new ListBountySubmissionsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + IN_PROGRESS, + + SUBMITTED, + + APPROVED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitInProgress(); + + T visitSubmitted(); + + T visitApproved(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/types/ListBountySubmissionsResponse.java b/src/main/java/com/whop/api/resources/bountysubmissions/types/ListBountySubmissionsResponse.java new file mode 100644 index 00000000..83a942cd --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/types/ListBountySubmissionsResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.BountySubmission; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBountySubmissionsResponse.Builder.class) +public final class ListBountySubmissionsResponse { + private final List data; + + private final ListBountySubmissionsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListBountySubmissionsResponse( + List data, + ListBountySubmissionsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListBountySubmissionsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBountySubmissionsResponse && equalTo((ListBountySubmissionsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBountySubmissionsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListBountySubmissionsResponsePageInfo pageInfo); + + Builder from(ListBountySubmissionsResponse other); + } + + public interface _FinalStage { + ListBountySubmissionsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(BountySubmission data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListBountySubmissionsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBountySubmissionsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListBountySubmissionsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(BountySubmission data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListBountySubmissionsResponse build() { + return new ListBountySubmissionsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/types/ListBountySubmissionsResponsePageInfo.java b/src/main/java/com/whop/api/resources/bountysubmissions/types/ListBountySubmissionsResponsePageInfo.java new file mode 100644 index 00000000..b2630ded --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/types/ListBountySubmissionsResponsePageInfo.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBountySubmissionsResponsePageInfo.Builder.class) +public final class ListBountySubmissionsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListBountySubmissionsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBountySubmissionsResponsePageInfo + && equalTo((ListBountySubmissionsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBountySubmissionsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListBountySubmissionsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListBountySubmissionsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBountySubmissionsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListBountySubmissionsResponsePageInfo build() { + return new ListBountySubmissionsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/bountysubmissions/types/SubmitBountySubmissionsRequestDeliverable.java b/src/main/java/com/whop/api/resources/bountysubmissions/types/SubmitBountySubmissionsRequestDeliverable.java new file mode 100644 index 00000000..7d6a568e --- /dev/null +++ b/src/main/java/com/whop/api/resources/bountysubmissions/types/SubmitBountySubmissionsRequestDeliverable.java @@ -0,0 +1,196 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.bountysubmissions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SubmitBountySubmissionsRequestDeliverable.Builder.class) +public final class SubmitBountySubmissionsRequestDeliverable { + private final Optional caption; + + private final Optional> fileIds; + + private final Optional> urls; + + private final Map additionalProperties; + + private SubmitBountySubmissionsRequestDeliverable( + Optional caption, + Optional> fileIds, + Optional> urls, + Map additionalProperties) { + this.caption = caption; + this.fileIds = fileIds; + this.urls = urls; + this.additionalProperties = additionalProperties; + } + + /** + * @return Written context shown to reviewers alongside the work. + */ + @JsonIgnore + public Optional getCaption() { + if (caption == null) { + return Optional.empty(); + } + return caption; + } + + /** + * @return IDs of uploaded files attached as work, up to 10, each prefixed file_. Combinable with urls and caption. + */ + @JsonProperty("file_ids") + public Optional> getFileIds() { + return fileIds; + } + + /** + * @return Links to the posted work, up to 10. Combinable with file_ids and caption. + */ + @JsonProperty("urls") + public Optional> getUrls() { + return urls; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("caption") + private Optional _getCaption() { + return caption; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SubmitBountySubmissionsRequestDeliverable + && equalTo((SubmitBountySubmissionsRequestDeliverable) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SubmitBountySubmissionsRequestDeliverable other) { + return caption.equals(other.caption) && fileIds.equals(other.fileIds) && urls.equals(other.urls); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.caption, this.fileIds, this.urls); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional caption = Optional.empty(); + + private Optional> fileIds = Optional.empty(); + + private Optional> urls = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SubmitBountySubmissionsRequestDeliverable other) { + caption(other.getCaption()); + fileIds(other.getFileIds()); + urls(other.getUrls()); + return this; + } + + /** + *

Written context shown to reviewers alongside the work.

+ */ + @JsonSetter(value = "caption", nulls = Nulls.SKIP) + public Builder caption(Optional caption) { + this.caption = caption; + return this; + } + + public Builder caption(String caption) { + this.caption = Optional.ofNullable(caption); + return this; + } + + public Builder caption(Nullable caption) { + if (caption.isNull()) { + this.caption = null; + } else if (caption.isEmpty()) { + this.caption = Optional.empty(); + } else { + this.caption = Optional.of(caption.get()); + } + return this; + } + + /** + *

IDs of uploaded files attached as work, up to 10, each prefixed file_. Combinable with urls and caption.

+ */ + @JsonSetter(value = "file_ids", nulls = Nulls.SKIP) + public Builder fileIds(Optional> fileIds) { + this.fileIds = fileIds; + return this; + } + + public Builder fileIds(List fileIds) { + this.fileIds = Optional.ofNullable(fileIds); + return this; + } + + /** + *

Links to the posted work, up to 10. Combinable with file_ids and caption.

+ */ + @JsonSetter(value = "urls", nulls = Nulls.SKIP) + public Builder urls(Optional> urls) { + this.urls = urls; + return this; + } + + public Builder urls(List urls) { + this.urls = Optional.ofNullable(urls); + return this; + } + + public SubmitBountySubmissionsRequestDeliverable build() { + return new SubmitBountySubmissionsRequestDeliverable(caption, fileIds, urls, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/AsyncCardsClient.java b/src/main/java/com/whop/api/resources/cards/AsyncCardsClient.java new file mode 100644 index 00000000..cca3f869 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/AsyncCardsClient.java @@ -0,0 +1,148 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.cards.requests.CreateCardsRequest; +import com.whop.api.resources.cards.requests.ListCardsRequest; +import com.whop.api.resources.cards.requests.RetrieveCardsRequest; +import com.whop.api.resources.cards.requests.UpdateCardsRequest; +import com.whop.api.resources.cards.types.CreateCardsResponse; +import com.whop.api.resources.cards.types.ListCardsResponse; +import com.whop.api.resources.cards.types.RetrieveCardsResponse; +import com.whop.api.resources.cards.types.UpdateCardsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncCardsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawCardsClient rawClient; + + public AsyncCardsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawCardsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawCardsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public CompletableFuture list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public CompletableFuture list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public CompletableFuture list(ListCardsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public CompletableFuture list(ListCardsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public CompletableFuture create() { + return this.rawClient.create().thenApply(response -> response.body()); + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public CompletableFuture create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).thenApply(response -> response.body()); + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public CompletableFuture create(CreateCardsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public CompletableFuture create(CreateCardsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieve a single card. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieve a single card. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieve a single card. + */ + public CompletableFuture retrieve(String id, RetrieveCardsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieve a single card. + */ + public CompletableFuture retrieve( + String id, RetrieveCardsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public CompletableFuture update(String id, UpdateCardsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public CompletableFuture update( + String id, UpdateCardsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/AsyncRawCardsClient.java b/src/main/java/com/whop/api/resources/cards/AsyncRawCardsClient.java new file mode 100644 index 00000000..72874d32 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/AsyncRawCardsClient.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.cards.requests.CreateCardsRequest; +import com.whop.api.resources.cards.requests.ListCardsRequest; +import com.whop.api.resources.cards.requests.RetrieveCardsRequest; +import com.whop.api.resources.cards.requests.UpdateCardsRequest; +import com.whop.api.resources.cards.types.CreateCardsResponse; +import com.whop.api.resources.cards.types.ListCardsResponse; +import com.whop.api.resources.cards.types.RetrieveCardsResponse; +import com.whop.api.resources.cards.types.UpdateCardsResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawCardsClient { + protected final ClientOptions clientOptions; + + public AsyncRawCardsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public CompletableFuture> list() { + return list(ListCardsRequest.builder().build()); + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return list(ListCardsRequest.builder().build(), requestOptions); + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public CompletableFuture> list(ListCardsRequest request) { + return list(request, null); + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public CompletableFuture> list( + ListCardsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("cards"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCardsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public CompletableFuture> create() { + return create(CreateCardsRequest.builder().build()); + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public CompletableFuture> create(RequestOptions requestOptions) { + return create(CreateCardsRequest.builder().build(), requestOptions); + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public CompletableFuture> create(CreateCardsRequest request) { + return create(request, null); + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public CompletableFuture> create( + CreateCardsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("cards"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateCardsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieve a single card. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveCardsRequest.builder().build()); + } + + /** + * Retrieve a single card. + */ + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCardsRequest.builder().build(), requestOptions); + } + + /** + * Retrieve a single card. + */ + public CompletableFuture> retrieve( + String id, RetrieveCardsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieve a single card. + */ + public CompletableFuture> retrieve( + String id, RetrieveCardsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("cards") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrieveCardsResponse.class), + response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateCardsRequest.builder().build()); + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public CompletableFuture> update( + String id, RequestOptions requestOptions) { + return update(id, UpdateCardsRequest.builder().build(), requestOptions); + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public CompletableFuture> update(String id, UpdateCardsRequest request) { + return update(id, request, null); + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public CompletableFuture> update( + String id, UpdateCardsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("cards") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateCardsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/cards/CardsClient.java b/src/main/java/com/whop/api/resources/cards/CardsClient.java new file mode 100644 index 00000000..2687fa96 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/CardsClient.java @@ -0,0 +1,145 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.cards.requests.CreateCardsRequest; +import com.whop.api.resources.cards.requests.ListCardsRequest; +import com.whop.api.resources.cards.requests.RetrieveCardsRequest; +import com.whop.api.resources.cards.requests.UpdateCardsRequest; +import com.whop.api.resources.cards.types.CreateCardsResponse; +import com.whop.api.resources.cards.types.ListCardsResponse; +import com.whop.api.resources.cards.types.RetrieveCardsResponse; +import com.whop.api.resources.cards.types.UpdateCardsResponse; + +public class CardsClient { + protected final ClientOptions clientOptions; + + private final RawCardsClient rawClient; + + public CardsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawCardsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawCardsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public ListCardsResponse list() { + return this.rawClient.list().body(); + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public ListCardsResponse list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public ListCardsResponse list(ListCardsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public ListCardsResponse list(ListCardsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public CreateCardsResponse create() { + return this.rawClient.create().body(); + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public CreateCardsResponse create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).body(); + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public CreateCardsResponse create(CreateCardsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public CreateCardsResponse create(CreateCardsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieve a single card. + */ + public RetrieveCardsResponse retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieve a single card. + */ + public RetrieveCardsResponse retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieve a single card. + */ + public RetrieveCardsResponse retrieve(String id, RetrieveCardsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieve a single card. + */ + public RetrieveCardsResponse retrieve(String id, RetrieveCardsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public UpdateCardsResponse update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public UpdateCardsResponse update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public UpdateCardsResponse update(String id, UpdateCardsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public UpdateCardsResponse update(String id, UpdateCardsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/RawCardsClient.java b/src/main/java/com/whop/api/resources/cards/RawCardsClient.java new file mode 100644 index 00000000..129b2fcc --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/RawCardsClient.java @@ -0,0 +1,379 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.cards.requests.CreateCardsRequest; +import com.whop.api.resources.cards.requests.ListCardsRequest; +import com.whop.api.resources.cards.requests.RetrieveCardsRequest; +import com.whop.api.resources.cards.requests.UpdateCardsRequest; +import com.whop.api.resources.cards.types.CreateCardsResponse; +import com.whop.api.resources.cards.types.ListCardsResponse; +import com.whop.api.resources.cards.types.RetrieveCardsResponse; +import com.whop.api.resources.cards.types.UpdateCardsResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawCardsClient { + protected final ClientOptions clientOptions; + + public RawCardsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public WhopApiHttpResponse list() { + return list(ListCardsRequest.builder().build()); + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public WhopApiHttpResponse list(RequestOptions requestOptions) { + return list(ListCardsRequest.builder().build(), requestOptions); + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public WhopApiHttpResponse list(ListCardsRequest request) { + return list(request, null); + } + + /** + * Lists the Whop cards of an account or user, including ones still being set up. Team members only see the cards assigned to them. + */ + public WhopApiHttpResponse list(ListCardsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("cards"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCardsResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public WhopApiHttpResponse create() { + return create(CreateCardsRequest.builder().build()); + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public WhopApiHttpResponse create(RequestOptions requestOptions) { + return create(CreateCardsRequest.builder().build(), requestOptions); + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public WhopApiHttpResponse create(CreateCardsRequest request) { + return create(request, null); + } + + /** + * Issue a virtual card, or apply for card issuing. + */ + public WhopApiHttpResponse create(CreateCardsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("cards"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateCardsResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieve a single card. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveCardsRequest.builder().build()); + } + + /** + * Retrieve a single card. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCardsRequest.builder().build(), requestOptions); + } + + /** + * Retrieve a single card. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveCardsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieve a single card. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveCardsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("cards") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrieveCardsResponse.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateCardsRequest.builder().build()); + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateCardsRequest.builder().build(), requestOptions); + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public WhopApiHttpResponse update(String id, UpdateCardsRequest request) { + return update(id, request, null); + } + + /** + * Update, freeze, or cancel a card. Updating the card's name, billing address, or limits requires both payout:account:update and company:balance:read; a card's assigned holder may update their own card's pin and frozen state with any user token. + */ + public WhopApiHttpResponse update( + String id, UpdateCardsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("cards") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateCardsResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/requests/CreateCardsRequest.java b/src/main/java/com/whop/api/resources/cards/requests/CreateCardsRequest.java new file mode 100644 index 00000000..f8ec40d5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/requests/CreateCardsRequest.java @@ -0,0 +1,309 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.cards.types.CreateCardsRequestSpendLimitFrequency; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCardsRequest.Builder.class) +public final class CreateCardsRequest { + private final Optional accountId; + + private final Optional assignedUserId; + + private final Optional name; + + private final Optional spendLimit; + + private final Optional spendLimitFrequency; + + private final Optional transactionLimit; + + private final Optional userId; + + private final Map additionalProperties; + + private CreateCardsRequest( + Optional accountId, + Optional assignedUserId, + Optional name, + Optional spendLimit, + Optional spendLimitFrequency, + Optional transactionLimit, + Optional userId, + Map additionalProperties) { + this.accountId = accountId; + this.assignedUserId = assignedUserId; + this.name = name; + this.spendLimit = spendLimit; + this.spendLimitFrequency = spendLimitFrequency; + this.transactionLimit = transactionLimit; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The owning account ID (a biz_ identifier). Provide this or user_id. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The account member (a user_ identifier) to assign the card to. Required for business card issuing accounts. + */ + @JsonProperty("assigned_user_id") + public Optional getAssignedUserId() { + return assignedUserId; + } + + /** + * @return A display name for the card. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Spending limit amount, in dollars. + */ + @JsonProperty("spend_limit") + public Optional getSpendLimit() { + return spendLimit; + } + + /** + * @return The window the spend limit applies to. + */ + @JsonProperty("spend_limit_frequency") + public Optional getSpendLimitFrequency() { + return spendLimitFrequency; + } + + /** + * @return Per-transaction limit amount, in dollars. + */ + @JsonProperty("transaction_limit") + public Optional getTransactionLimit() { + return transactionLimit; + } + + /** + * @return The owning user ID (a user_ identifier). Provide this or account_id. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCardsRequest && equalTo((CreateCardsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCardsRequest other) { + return accountId.equals(other.accountId) + && assignedUserId.equals(other.assignedUserId) + && name.equals(other.name) + && spendLimit.equals(other.spendLimit) + && spendLimitFrequency.equals(other.spendLimitFrequency) + && transactionLimit.equals(other.transactionLimit) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.assignedUserId, + this.name, + this.spendLimit, + this.spendLimitFrequency, + this.transactionLimit, + this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional assignedUserId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional spendLimit = Optional.empty(); + + private Optional spendLimitFrequency = Optional.empty(); + + private Optional transactionLimit = Optional.empty(); + + private Optional userId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateCardsRequest other) { + accountId(other.getAccountId()); + assignedUserId(other.getAssignedUserId()); + name(other.getName()); + spendLimit(other.getSpendLimit()); + spendLimitFrequency(other.getSpendLimitFrequency()); + transactionLimit(other.getTransactionLimit()); + userId(other.getUserId()); + return this; + } + + /** + *

The owning account ID (a biz_ identifier). Provide this or user_id.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account member (a user_ identifier) to assign the card to. Required for business card issuing accounts.

+ */ + @JsonSetter(value = "assigned_user_id", nulls = Nulls.SKIP) + public Builder assignedUserId(Optional assignedUserId) { + this.assignedUserId = assignedUserId; + return this; + } + + public Builder assignedUserId(String assignedUserId) { + this.assignedUserId = Optional.ofNullable(assignedUserId); + return this; + } + + /** + *

A display name for the card.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Spending limit amount, in dollars.

+ */ + @JsonSetter(value = "spend_limit", nulls = Nulls.SKIP) + public Builder spendLimit(Optional spendLimit) { + this.spendLimit = spendLimit; + return this; + } + + public Builder spendLimit(Double spendLimit) { + this.spendLimit = Optional.ofNullable(spendLimit); + return this; + } + + /** + *

The window the spend limit applies to.

+ */ + @JsonSetter(value = "spend_limit_frequency", nulls = Nulls.SKIP) + public Builder spendLimitFrequency(Optional spendLimitFrequency) { + this.spendLimitFrequency = spendLimitFrequency; + return this; + } + + public Builder spendLimitFrequency(CreateCardsRequestSpendLimitFrequency spendLimitFrequency) { + this.spendLimitFrequency = Optional.ofNullable(spendLimitFrequency); + return this; + } + + /** + *

Per-transaction limit amount, in dollars.

+ */ + @JsonSetter(value = "transaction_limit", nulls = Nulls.SKIP) + public Builder transactionLimit(Optional transactionLimit) { + this.transactionLimit = transactionLimit; + return this; + } + + public Builder transactionLimit(Double transactionLimit) { + this.transactionLimit = Optional.ofNullable(transactionLimit); + return this; + } + + /** + *

The owning user ID (a user_ identifier). Provide this or account_id.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + public CreateCardsRequest build() { + return new CreateCardsRequest( + accountId, + assignedUserId, + name, + spendLimit, + spendLimitFrequency, + transactionLimit, + userId, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/requests/ListCardsRequest.java b/src/main/java/com/whop/api/resources/cards/requests/ListCardsRequest.java new file mode 100644 index 00000000..6c711359 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/requests/ListCardsRequest.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCardsRequest.Builder.class) +public final class ListCardsRequest { + private final Optional accountId; + + private final Optional userId; + + private final Map additionalProperties; + + private ListCardsRequest( + Optional accountId, Optional userId, Map additionalProperties) { + this.accountId = accountId; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The owning account ID (a biz_ identifier). Provide this or user_id. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The owning user ID (a user_ identifier). Provide this or account_id. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCardsRequest && equalTo((ListCardsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCardsRequest other) { + return accountId.equals(other.accountId) && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional userId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListCardsRequest other) { + accountId(other.getAccountId()); + userId(other.getUserId()); + return this; + } + + /** + *

The owning account ID (a biz_ identifier). Provide this or user_id.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The owning user ID (a user_ identifier). Provide this or account_id.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + public ListCardsRequest build() { + return new ListCardsRequest(accountId, userId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/requests/RetrieveCardsRequest.java b/src/main/java/com/whop/api/resources/cards/requests/RetrieveCardsRequest.java new file mode 100644 index 00000000..7d9afe85 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/requests/RetrieveCardsRequest.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCardsRequest.Builder.class) +public final class RetrieveCardsRequest { + private final Optional accountId; + + private final Optional userId; + + private final Map additionalProperties; + + private RetrieveCardsRequest( + Optional accountId, Optional userId, Map additionalProperties) { + this.accountId = accountId; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The owning account ID (a biz_ identifier). Provide this or user_id. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The owning user ID (a user_ identifier). Provide this or account_id. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCardsRequest && equalTo((RetrieveCardsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveCardsRequest other) { + return accountId.equals(other.accountId) && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional userId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveCardsRequest other) { + accountId(other.getAccountId()); + userId(other.getUserId()); + return this; + } + + /** + *

The owning account ID (a biz_ identifier). Provide this or user_id.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The owning user ID (a user_ identifier). Provide this or account_id.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + public RetrieveCardsRequest build() { + return new RetrieveCardsRequest(accountId, userId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/requests/UpdateCardsRequest.java b/src/main/java/com/whop/api/resources/cards/requests/UpdateCardsRequest.java new file mode 100644 index 00000000..c5347b7f --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/requests/UpdateCardsRequest.java @@ -0,0 +1,438 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.cards.types.UpdateCardsRequestBilling; +import com.whop.api.resources.cards.types.UpdateCardsRequestSpendLimitFrequency; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCardsRequest.Builder.class) +public final class UpdateCardsRequest { + private final Optional accountId; + + private final Optional billing; + + private final Optional canceled; + + private final Optional frozen; + + private final Optional name; + + private final Optional pin; + + private final Optional removeLimit; + + private final Optional spendLimit; + + private final Optional spendLimitFrequency; + + private final Optional transactionLimit; + + private final Optional userId; + + private final Map additionalProperties; + + private UpdateCardsRequest( + Optional accountId, + Optional billing, + Optional canceled, + Optional frozen, + Optional name, + Optional pin, + Optional removeLimit, + Optional spendLimit, + Optional spendLimitFrequency, + Optional transactionLimit, + Optional userId, + Map additionalProperties) { + this.accountId = accountId; + this.billing = billing; + this.canceled = canceled; + this.frozen = frozen; + this.name = name; + this.pin = pin; + this.removeLimit = removeLimit; + this.spendLimit = spendLimit; + this.spendLimitFrequency = spendLimitFrequency; + this.transactionLimit = transactionLimit; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The owning account ID (a biz_ identifier). Provide this or user_id. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return New billing address. Requires line1, city, region, postal_code, and country_code. On an invited card, passing billing alone (as the invited user) completes onboarding and starts card provisioning. + */ + @JsonProperty("billing") + public Optional getBilling() { + return billing; + } + + /** + * @return Pass true to permanently cancel the card. A canceled card cannot be uncanceled. Cannot be combined with other fields. + */ + @JsonProperty("canceled") + public Optional getCanceled() { + return canceled; + } + + /** + * @return Pass true to freeze the card, false to unfreeze it. The assigned cardholder may freeze their own card without the payout:account:update scope. + */ + @JsonProperty("frozen") + public Optional getFrozen() { + return frozen; + } + + /** + * @return A display name for the card. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return New 4-digit PIN. Can only be set on a card assigned to the acting user, who may set it without the payout:account:update scope. + */ + @JsonProperty("pin") + public Optional getPin() { + return pin; + } + + /** + * @return Pass true to remove the spending limit (make the card unlimited). + */ + @JsonProperty("remove_limit") + public Optional getRemoveLimit() { + return removeLimit; + } + + /** + * @return Spending limit amount, in dollars. + */ + @JsonProperty("spend_limit") + public Optional getSpendLimit() { + return spendLimit; + } + + /** + * @return The window the spend limit applies to. + */ + @JsonProperty("spend_limit_frequency") + public Optional getSpendLimitFrequency() { + return spendLimitFrequency; + } + + /** + * @return Per-transaction limit amount, in dollars. + */ + @JsonProperty("transaction_limit") + public Optional getTransactionLimit() { + return transactionLimit; + } + + /** + * @return The owning user ID (a user_ identifier). Provide this or account_id. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCardsRequest && equalTo((UpdateCardsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCardsRequest other) { + return accountId.equals(other.accountId) + && billing.equals(other.billing) + && canceled.equals(other.canceled) + && frozen.equals(other.frozen) + && name.equals(other.name) + && pin.equals(other.pin) + && removeLimit.equals(other.removeLimit) + && spendLimit.equals(other.spendLimit) + && spendLimitFrequency.equals(other.spendLimitFrequency) + && transactionLimit.equals(other.transactionLimit) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.billing, + this.canceled, + this.frozen, + this.name, + this.pin, + this.removeLimit, + this.spendLimit, + this.spendLimitFrequency, + this.transactionLimit, + this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional billing = Optional.empty(); + + private Optional canceled = Optional.empty(); + + private Optional frozen = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional pin = Optional.empty(); + + private Optional removeLimit = Optional.empty(); + + private Optional spendLimit = Optional.empty(); + + private Optional spendLimitFrequency = Optional.empty(); + + private Optional transactionLimit = Optional.empty(); + + private Optional userId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateCardsRequest other) { + accountId(other.getAccountId()); + billing(other.getBilling()); + canceled(other.getCanceled()); + frozen(other.getFrozen()); + name(other.getName()); + pin(other.getPin()); + removeLimit(other.getRemoveLimit()); + spendLimit(other.getSpendLimit()); + spendLimitFrequency(other.getSpendLimitFrequency()); + transactionLimit(other.getTransactionLimit()); + userId(other.getUserId()); + return this; + } + + /** + *

The owning account ID (a biz_ identifier). Provide this or user_id.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

New billing address. Requires line1, city, region, postal_code, and country_code. On an invited card, passing billing alone (as the invited user) completes onboarding and starts card provisioning.

+ */ + @JsonSetter(value = "billing", nulls = Nulls.SKIP) + public Builder billing(Optional billing) { + this.billing = billing; + return this; + } + + public Builder billing(UpdateCardsRequestBilling billing) { + this.billing = Optional.ofNullable(billing); + return this; + } + + /** + *

Pass true to permanently cancel the card. A canceled card cannot be uncanceled. Cannot be combined with other fields.

+ */ + @JsonSetter(value = "canceled", nulls = Nulls.SKIP) + public Builder canceled(Optional canceled) { + this.canceled = canceled; + return this; + } + + public Builder canceled(Boolean canceled) { + this.canceled = Optional.ofNullable(canceled); + return this; + } + + /** + *

Pass true to freeze the card, false to unfreeze it. The assigned cardholder may freeze their own card without the payout:account:update scope.

+ */ + @JsonSetter(value = "frozen", nulls = Nulls.SKIP) + public Builder frozen(Optional frozen) { + this.frozen = frozen; + return this; + } + + public Builder frozen(Boolean frozen) { + this.frozen = Optional.ofNullable(frozen); + return this; + } + + /** + *

A display name for the card.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

New 4-digit PIN. Can only be set on a card assigned to the acting user, who may set it without the payout:account:update scope.

+ */ + @JsonSetter(value = "pin", nulls = Nulls.SKIP) + public Builder pin(Optional pin) { + this.pin = pin; + return this; + } + + public Builder pin(String pin) { + this.pin = Optional.ofNullable(pin); + return this; + } + + /** + *

Pass true to remove the spending limit (make the card unlimited).

+ */ + @JsonSetter(value = "remove_limit", nulls = Nulls.SKIP) + public Builder removeLimit(Optional removeLimit) { + this.removeLimit = removeLimit; + return this; + } + + public Builder removeLimit(Boolean removeLimit) { + this.removeLimit = Optional.ofNullable(removeLimit); + return this; + } + + /** + *

Spending limit amount, in dollars.

+ */ + @JsonSetter(value = "spend_limit", nulls = Nulls.SKIP) + public Builder spendLimit(Optional spendLimit) { + this.spendLimit = spendLimit; + return this; + } + + public Builder spendLimit(Double spendLimit) { + this.spendLimit = Optional.ofNullable(spendLimit); + return this; + } + + /** + *

The window the spend limit applies to.

+ */ + @JsonSetter(value = "spend_limit_frequency", nulls = Nulls.SKIP) + public Builder spendLimitFrequency(Optional spendLimitFrequency) { + this.spendLimitFrequency = spendLimitFrequency; + return this; + } + + public Builder spendLimitFrequency(UpdateCardsRequestSpendLimitFrequency spendLimitFrequency) { + this.spendLimitFrequency = Optional.ofNullable(spendLimitFrequency); + return this; + } + + /** + *

Per-transaction limit amount, in dollars.

+ */ + @JsonSetter(value = "transaction_limit", nulls = Nulls.SKIP) + public Builder transactionLimit(Optional transactionLimit) { + this.transactionLimit = transactionLimit; + return this; + } + + public Builder transactionLimit(Double transactionLimit) { + this.transactionLimit = Optional.ofNullable(transactionLimit); + return this; + } + + /** + *

The owning user ID (a user_ identifier). Provide this or account_id.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + public UpdateCardsRequest build() { + return new UpdateCardsRequest( + accountId, + billing, + canceled, + frozen, + name, + pin, + removeLimit, + spendLimit, + spendLimitFrequency, + transactionLimit, + userId, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/CreateCardsRequestSpendLimitFrequency.java b/src/main/java/com/whop/api/resources/cards/types/CreateCardsRequestSpendLimitFrequency.java new file mode 100644 index 00000000..5d0be710 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/CreateCardsRequestSpendLimitFrequency.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCardsRequestSpendLimitFrequency { + public static final CreateCardsRequestSpendLimitFrequency ONE_TIME = + new CreateCardsRequestSpendLimitFrequency(Value.ONE_TIME, "one_time"); + + public static final CreateCardsRequestSpendLimitFrequency DAILY = + new CreateCardsRequestSpendLimitFrequency(Value.DAILY, "daily"); + + public static final CreateCardsRequestSpendLimitFrequency WEEKLY = + new CreateCardsRequestSpendLimitFrequency(Value.WEEKLY, "weekly"); + + public static final CreateCardsRequestSpendLimitFrequency MONTHLY = + new CreateCardsRequestSpendLimitFrequency(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + CreateCardsRequestSpendLimitFrequency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCardsRequestSpendLimitFrequency + && this.string.equals(((CreateCardsRequestSpendLimitFrequency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ONE_TIME: + return visitor.visitOneTime(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCardsRequestSpendLimitFrequency valueOf(String value) { + switch (value) { + case "one_time": + return ONE_TIME; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new CreateCardsRequestSpendLimitFrequency(Value.UNKNOWN, value); + } + } + + public enum Value { + DAILY, + + WEEKLY, + + MONTHLY, + + ONE_TIME, + + UNKNOWN + } + + public interface Visitor { + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitOneTime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponse.java b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponse.java new file mode 100644 index 00000000..9a10e062 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponse.java @@ -0,0 +1,1102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCardsResponse.Builder.class) +public final class CreateCardsResponse { + private final Optional billing; + + private final Optional canceledAt; + + private final Optional createdAt; + + private final Optional expirationMonth; + + private final Optional expirationYear; + + private final String id; + + private final Optional last4; + + private final Optional limit; + + private final Optional name; + + private final CreateCardsResponseObject object; + + private final Optional secrets; + + private final Optional spentLastMonth; + + private final Optional status; + + private final Optional type; + + private final Optional userId; + + private final Map additionalProperties; + + private CreateCardsResponse( + Optional billing, + Optional canceledAt, + Optional createdAt, + Optional expirationMonth, + Optional expirationYear, + String id, + Optional last4, + Optional limit, + Optional name, + CreateCardsResponseObject object, + Optional secrets, + Optional spentLastMonth, + Optional status, + Optional type, + Optional userId, + Map additionalProperties) { + this.billing = billing; + this.canceledAt = canceledAt; + this.createdAt = createdAt; + this.expirationMonth = expirationMonth; + this.expirationYear = expirationYear; + this.id = id; + this.last4 = last4; + this.limit = limit; + this.name = name; + this.object = object; + this.secrets = secrets; + this.spentLastMonth = spentLastMonth; + this.status = status; + this.type = type; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The billing address. + */ + @JsonIgnore + public Optional getBilling() { + if (billing == null) { + return Optional.empty(); + } + return billing; + } + + /** + * @return When the card was canceled. + */ + @JsonIgnore + public Optional getCanceledAt() { + if (canceledAt == null) { + return Optional.empty(); + } + return canceledAt; + } + + /** + * @return When the card was created. + */ + @JsonIgnore + public Optional getCreatedAt() { + if (createdAt == null) { + return Optional.empty(); + } + return createdAt; + } + + /** + * @return Card expiration month. + */ + @JsonIgnore + public Optional getExpirationMonth() { + if (expirationMonth == null) { + return Optional.empty(); + } + return expirationMonth; + } + + /** + * @return Card expiration year. + */ + @JsonIgnore + public Optional getExpirationYear() { + if (expirationYear == null) { + return Optional.empty(); + } + return expirationYear; + } + + /** + * @return Card ID, prefixed icrd_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Last four digits of the card number. null for pending invitation cards. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + /** + * @return The spending limit configuration. + */ + @JsonIgnore + public Optional getLimit() { + if (limit == null) { + return Optional.empty(); + } + return limit; + } + + /** + * @return Card display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("object") + public CreateCardsResponseObject getObject() { + return object; + } + + /** + * @return Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved. + */ + @JsonIgnore + public Optional getSecrets() { + if (secrets == null) { + return Optional.empty(); + } + return secrets; + } + + /** + * @return Total spend in the last 30 days, in cents. + */ + @JsonIgnore + public Optional getSpentLastMonth() { + if (spentLastMonth == null) { + return Optional.empty(); + } + return spentLastMonth; + } + + /** + * @return The card status. denied means the issuer declined the cardholder, so the card will never be issued. + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The card type. + */ + @JsonIgnore + public Optional getType() { + if (type == null) { + return Optional.empty(); + } + return type; + } + + /** + * @return Cardholder user ID, prefixed user_, when assigned. + */ + @JsonIgnore + public Optional getUserId() { + if (userId == null) { + return Optional.empty(); + } + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing") + private Optional _getBilling() { + return billing; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("canceled_at") + private Optional _getCanceledAt() { + return canceledAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_at") + private Optional _getCreatedAt() { + return createdAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_month") + private Optional _getExpirationMonth() { + return expirationMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_year") + private Optional _getExpirationYear() { + return expirationYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("limit") + private Optional _getLimit() { + return limit; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("secrets") + private Optional _getSecrets() { + return secrets; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("spent_last_month") + private Optional _getSpentLastMonth() { + return spentLastMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("type") + private Optional _getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_id") + private Optional _getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCardsResponse && equalTo((CreateCardsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCardsResponse other) { + return billing.equals(other.billing) + && canceledAt.equals(other.canceledAt) + && createdAt.equals(other.createdAt) + && expirationMonth.equals(other.expirationMonth) + && expirationYear.equals(other.expirationYear) + && id.equals(other.id) + && last4.equals(other.last4) + && limit.equals(other.limit) + && name.equals(other.name) + && object.equals(other.object) + && secrets.equals(other.secrets) + && spentLastMonth.equals(other.spentLastMonth) + && status.equals(other.status) + && type.equals(other.type) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billing, + this.canceledAt, + this.createdAt, + this.expirationMonth, + this.expirationYear, + this.id, + this.last4, + this.limit, + this.name, + this.object, + this.secrets, + this.spentLastMonth, + this.status, + this.type, + this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Card ID, prefixed icrd_.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(CreateCardsResponse other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull CreateCardsResponseObject object); + } + + public interface _FinalStage { + CreateCardsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The billing address.

+ */ + _FinalStage billing(Optional billing); + + _FinalStage billing(CreateCardsResponseBilling billing); + + _FinalStage billing(Nullable billing); + + /** + *

When the card was canceled.

+ */ + _FinalStage canceledAt(Optional canceledAt); + + _FinalStage canceledAt(OffsetDateTime canceledAt); + + _FinalStage canceledAt(Nullable canceledAt); + + /** + *

When the card was created.

+ */ + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage createdAt(Nullable createdAt); + + /** + *

Card expiration month.

+ */ + _FinalStage expirationMonth(Optional expirationMonth); + + _FinalStage expirationMonth(String expirationMonth); + + _FinalStage expirationMonth(Nullable expirationMonth); + + /** + *

Card expiration year.

+ */ + _FinalStage expirationYear(Optional expirationYear); + + _FinalStage expirationYear(String expirationYear); + + _FinalStage expirationYear(Nullable expirationYear); + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + + /** + *

The spending limit configuration.

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(CreateCardsResponseLimit limit); + + _FinalStage limit(Nullable limit); + + /** + *

Card display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + _FinalStage secrets(Optional secrets); + + _FinalStage secrets(CreateCardsResponseSecrets secrets); + + _FinalStage secrets(Nullable secrets); + + /** + *

Total spend in the last 30 days, in cents.

+ */ + _FinalStage spentLastMonth(Optional spentLastMonth); + + _FinalStage spentLastMonth(Integer spentLastMonth); + + _FinalStage spentLastMonth(Nullable spentLastMonth); + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(CreateCardsResponseStatus status); + + _FinalStage status(Nullable status); + + /** + *

The card type.

+ */ + _FinalStage type(Optional type); + + _FinalStage type(CreateCardsResponseType type); + + _FinalStage type(Nullable type); + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + + _FinalStage userId(Nullable userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private CreateCardsResponseObject object; + + private Optional userId = Optional.empty(); + + private Optional type = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional spentLastMonth = Optional.empty(); + + private Optional secrets = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional last4 = Optional.empty(); + + private Optional expirationYear = Optional.empty(); + + private Optional expirationMonth = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional canceledAt = Optional.empty(); + + private Optional billing = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCardsResponse other) { + billing(other.getBilling()); + canceledAt(other.getCanceledAt()); + createdAt(other.getCreatedAt()); + expirationMonth(other.getExpirationMonth()); + expirationYear(other.getExpirationYear()); + id(other.getId()); + last4(other.getLast4()); + limit(other.getLimit()); + name(other.getName()); + object(other.getObject()); + secrets(other.getSecrets()); + spentLastMonth(other.getSpentLastMonth()); + status(other.getStatus()); + type(other.getType()); + userId(other.getUserId()); + return this; + } + + /** + *

Card ID, prefixed icrd_.

+ *

Card ID, prefixed icrd_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull CreateCardsResponseObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(Nullable userId) { + if (userId.isNull()) { + this.userId = null; + } else if (userId.isEmpty()) { + this.userId = Optional.empty(); + } else { + this.userId = Optional.of(userId.get()); + } + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(Nullable type) { + if (type.isNull()) { + this.type = null; + } else if (type.isEmpty()) { + this.type = Optional.empty(); + } else { + this.type = Optional.of(type.get()); + } + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(CreateCardsResponseType type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

The card type.

+ */ + @java.lang.Override + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public _FinalStage type(Optional type) { + this.type = type; + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(CreateCardsResponseStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Nullable spentLastMonth) { + if (spentLastMonth.isNull()) { + this.spentLastMonth = null; + } else if (spentLastMonth.isEmpty()) { + this.spentLastMonth = Optional.empty(); + } else { + this.spentLastMonth = Optional.of(spentLastMonth.get()); + } + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Integer spentLastMonth) { + this.spentLastMonth = Optional.ofNullable(spentLastMonth); + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ */ + @java.lang.Override + @JsonSetter(value = "spent_last_month", nulls = Nulls.SKIP) + public _FinalStage spentLastMonth(Optional spentLastMonth) { + this.spentLastMonth = spentLastMonth; + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(Nullable secrets) { + if (secrets.isNull()) { + this.secrets = null; + } else if (secrets.isEmpty()) { + this.secrets = Optional.empty(); + } else { + this.secrets = Optional.of(secrets.get()); + } + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(CreateCardsResponseSecrets secrets) { + this.secrets = Optional.ofNullable(secrets); + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + @java.lang.Override + @JsonSetter(value = "secrets", nulls = Nulls.SKIP) + public _FinalStage secrets(Optional secrets) { + this.secrets = secrets; + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Card display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(Nullable limit) { + if (limit.isNull()) { + this.limit = null; + } else if (limit.isEmpty()) { + this.limit = Optional.empty(); + } else { + this.limit = Optional.of(limit.get()); + } + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(CreateCardsResponseLimit limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

The spending limit configuration.

+ */ + @java.lang.Override + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public _FinalStage limit(Optional limit) { + this.limit = limit; + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(Nullable expirationYear) { + if (expirationYear.isNull()) { + this.expirationYear = null; + } else if (expirationYear.isEmpty()) { + this.expirationYear = Optional.empty(); + } else { + this.expirationYear = Optional.of(expirationYear.get()); + } + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(String expirationYear) { + this.expirationYear = Optional.ofNullable(expirationYear); + return this; + } + + /** + *

Card expiration year.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_year", nulls = Nulls.SKIP) + public _FinalStage expirationYear(Optional expirationYear) { + this.expirationYear = expirationYear; + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(Nullable expirationMonth) { + if (expirationMonth.isNull()) { + this.expirationMonth = null; + } else if (expirationMonth.isEmpty()) { + this.expirationMonth = Optional.empty(); + } else { + this.expirationMonth = Optional.of(expirationMonth.get()); + } + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(String expirationMonth) { + this.expirationMonth = Optional.ofNullable(expirationMonth); + return this; + } + + /** + *

Card expiration month.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_month", nulls = Nulls.SKIP) + public _FinalStage expirationMonth(Optional expirationMonth) { + this.expirationMonth = expirationMonth; + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(Nullable createdAt) { + if (createdAt.isNull()) { + this.createdAt = null; + } else if (createdAt.isEmpty()) { + this.createdAt = Optional.empty(); + } else { + this.createdAt = Optional.of(createdAt.get()); + } + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

When the card was created.

+ */ + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(Nullable canceledAt) { + if (canceledAt.isNull()) { + this.canceledAt = null; + } else if (canceledAt.isEmpty()) { + this.canceledAt = Optional.empty(); + } else { + this.canceledAt = Optional.of(canceledAt.get()); + } + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(OffsetDateTime canceledAt) { + this.canceledAt = Optional.ofNullable(canceledAt); + return this; + } + + /** + *

When the card was canceled.

+ */ + @java.lang.Override + @JsonSetter(value = "canceled_at", nulls = Nulls.SKIP) + public _FinalStage canceledAt(Optional canceledAt) { + this.canceledAt = canceledAt; + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(Nullable billing) { + if (billing.isNull()) { + this.billing = null; + } else if (billing.isEmpty()) { + this.billing = Optional.empty(); + } else { + this.billing = Optional.of(billing.get()); + } + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(CreateCardsResponseBilling billing) { + this.billing = Optional.ofNullable(billing); + return this; + } + + /** + *

The billing address.

+ */ + @java.lang.Override + @JsonSetter(value = "billing", nulls = Nulls.SKIP) + public _FinalStage billing(Optional billing) { + this.billing = billing; + return this; + } + + @java.lang.Override + public CreateCardsResponse build() { + return new CreateCardsResponse( + billing, + canceledAt, + createdAt, + expirationMonth, + expirationYear, + id, + last4, + limit, + name, + object, + secrets, + spentLastMonth, + status, + type, + userId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseBilling.java b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseBilling.java new file mode 100644 index 00000000..c929bd6d --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseBilling.java @@ -0,0 +1,387 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCardsResponseBilling.Builder.class) +public final class CreateCardsResponseBilling { + private final Optional city; + + private final Optional countryCode; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional region; + + private final Map additionalProperties; + + private CreateCardsResponseBilling( + Optional city, + Optional countryCode, + Optional line1, + Optional line2, + Optional postalCode, + Optional region, + Map additionalProperties) { + this.city = city; + this.countryCode = countryCode; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.region = region; + this.additionalProperties = additionalProperties; + } + + /** + * @return Billing city. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Billing country code. + */ + @JsonIgnore + public Optional getCountryCode() { + if (countryCode == null) { + return Optional.empty(); + } + return countryCode; + } + + /** + * @return Street address line 1. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return Street address line 2. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Billing postal code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return Billing region or state. + */ + @JsonIgnore + public Optional getRegion() { + if (region == null) { + return Optional.empty(); + } + return region; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country_code") + private Optional _getCountryCode() { + return countryCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("region") + private Optional _getRegion() { + return region; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCardsResponseBilling && equalTo((CreateCardsResponseBilling) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCardsResponseBilling other) { + return city.equals(other.city) + && countryCode.equals(other.countryCode) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && region.equals(other.region); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.countryCode, this.line1, this.line2, this.postalCode, this.region); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional countryCode = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional region = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateCardsResponseBilling other) { + city(other.getCity()); + countryCode(other.getCountryCode()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + region(other.getRegion()); + return this; + } + + /** + *

Billing city.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Billing country code.

+ */ + @JsonSetter(value = "country_code", nulls = Nulls.SKIP) + public Builder countryCode(Optional countryCode) { + this.countryCode = countryCode; + return this; + } + + public Builder countryCode(String countryCode) { + this.countryCode = Optional.ofNullable(countryCode); + return this; + } + + public Builder countryCode(Nullable countryCode) { + if (countryCode.isNull()) { + this.countryCode = null; + } else if (countryCode.isEmpty()) { + this.countryCode = Optional.empty(); + } else { + this.countryCode = Optional.of(countryCode.get()); + } + return this; + } + + /** + *

Street address line 1.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

Street address line 2.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Billing postal code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

Billing region or state.

+ */ + @JsonSetter(value = "region", nulls = Nulls.SKIP) + public Builder region(Optional region) { + this.region = region; + return this; + } + + public Builder region(String region) { + this.region = Optional.ofNullable(region); + return this; + } + + public Builder region(Nullable region) { + if (region.isNull()) { + this.region = null; + } else if (region.isEmpty()) { + this.region = Optional.empty(); + } else { + this.region = Optional.of(region.get()); + } + return this; + } + + public CreateCardsResponseBilling build() { + return new CreateCardsResponseBilling( + city, countryCode, line1, line2, postalCode, region, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseLimit.java b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseLimit.java new file mode 100644 index 00000000..71236718 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseLimit.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCardsResponseLimit.Builder.class) +public final class CreateCardsResponseLimit { + private final double amount; + + private final CreateCardsResponseLimitFrequency frequency; + + private final Map additionalProperties; + + private CreateCardsResponseLimit( + double amount, CreateCardsResponseLimitFrequency frequency, Map additionalProperties) { + this.amount = amount; + this.frequency = frequency; + this.additionalProperties = additionalProperties; + } + + /** + * @return The limit amount in dollars. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports. + */ + @JsonProperty("frequency") + public CreateCardsResponseLimitFrequency getFrequency() { + return frequency; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCardsResponseLimit && equalTo((CreateCardsResponseLimit) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCardsResponseLimit other) { + return amount == other.amount && frequency.equals(other.frequency); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.frequency); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The limit amount in dollars.

+ */ + FrequencyStage amount(double amount); + + Builder from(CreateCardsResponseLimit other); + } + + public interface FrequencyStage { + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ */ + _FinalStage frequency(@NotNull CreateCardsResponseLimitFrequency frequency); + } + + public interface _FinalStage { + CreateCardsResponseLimit build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, FrequencyStage, _FinalStage { + private double amount; + + private CreateCardsResponseLimitFrequency frequency; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCardsResponseLimit other) { + amount(other.getAmount()); + frequency(other.getFrequency()); + return this; + } + + /** + *

The limit amount in dollars.

+ *

The limit amount in dollars.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public FrequencyStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("frequency") + public _FinalStage frequency(@NotNull CreateCardsResponseLimitFrequency frequency) { + this.frequency = Objects.requireNonNull(frequency, "frequency must not be null"); + return this; + } + + @java.lang.Override + public CreateCardsResponseLimit build() { + return new CreateCardsResponseLimit(amount, frequency, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseLimitFrequency.java b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseLimitFrequency.java new file mode 100644 index 00000000..79ab68d2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseLimitFrequency.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCardsResponseLimitFrequency { + public static final CreateCardsResponseLimitFrequency PER_TRANSACTION = + new CreateCardsResponseLimitFrequency(Value.PER_TRANSACTION, "per_transaction"); + + public static final CreateCardsResponseLimitFrequency ONE_TIME = + new CreateCardsResponseLimitFrequency(Value.ONE_TIME, "one_time"); + + public static final CreateCardsResponseLimitFrequency DAILY = + new CreateCardsResponseLimitFrequency(Value.DAILY, "daily"); + + public static final CreateCardsResponseLimitFrequency WEEKLY = + new CreateCardsResponseLimitFrequency(Value.WEEKLY, "weekly"); + + public static final CreateCardsResponseLimitFrequency MONTHLY = + new CreateCardsResponseLimitFrequency(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + CreateCardsResponseLimitFrequency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCardsResponseLimitFrequency + && this.string.equals(((CreateCardsResponseLimitFrequency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PER_TRANSACTION: + return visitor.visitPerTransaction(); + case ONE_TIME: + return visitor.visitOneTime(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCardsResponseLimitFrequency valueOf(String value) { + switch (value) { + case "per_transaction": + return PER_TRANSACTION; + case "one_time": + return ONE_TIME; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new CreateCardsResponseLimitFrequency(Value.UNKNOWN, value); + } + } + + public enum Value { + DAILY, + + WEEKLY, + + MONTHLY, + + ONE_TIME, + + PER_TRANSACTION, + + UNKNOWN + } + + public interface Visitor { + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitOneTime(); + + T visitPerTransaction(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseObject.java b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseObject.java new file mode 100644 index 00000000..b8a52dee --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseObject.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCardsResponseObject { + public static final CreateCardsResponseObject CARD = new CreateCardsResponseObject(Value.CARD, "card"); + + private final Value value; + + private final String string; + + CreateCardsResponseObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCardsResponseObject + && this.string.equals(((CreateCardsResponseObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD: + return visitor.visitCard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCardsResponseObject valueOf(String value) { + switch (value) { + case "card": + return CARD; + default: + return new CreateCardsResponseObject(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD, + + UNKNOWN + } + + public interface Visitor { + T visitCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseSecrets.java b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseSecrets.java new file mode 100644 index 00000000..8c662b8d --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseSecrets.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCardsResponseSecrets.Builder.class) +public final class CreateCardsResponseSecrets { + private final String cardNumber; + + private final String cvc; + + private final Optional nameOnCard; + + private final Optional pin; + + private final Map additionalProperties; + + private CreateCardsResponseSecrets( + String cardNumber, + String cvc, + Optional nameOnCard, + Optional pin, + Map additionalProperties) { + this.cardNumber = cardNumber; + this.cvc = cvc; + this.nameOnCard = nameOnCard; + this.pin = pin; + this.additionalProperties = additionalProperties; + } + + /** + * @return Full card number. + */ + @JsonProperty("card_number") + public String getCardNumber() { + return cardNumber; + } + + /** + * @return Card verification code. + */ + @JsonProperty("cvc") + public String getCvc() { + return cvc; + } + + /** + * @return Cardholder name printed on the card. + */ + @JsonIgnore + public Optional getNameOnCard() { + if (nameOnCard == null) { + return Optional.empty(); + } + return nameOnCard; + } + + /** + * @return The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys. + */ + @JsonIgnore + public Optional getPin() { + if (pin == null) { + return Optional.empty(); + } + return pin; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name_on_card") + private Optional _getNameOnCard() { + return nameOnCard; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("pin") + private Optional _getPin() { + return pin; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCardsResponseSecrets && equalTo((CreateCardsResponseSecrets) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCardsResponseSecrets other) { + return cardNumber.equals(other.cardNumber) + && cvc.equals(other.cvc) + && nameOnCard.equals(other.nameOnCard) + && pin.equals(other.pin); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cardNumber, this.cvc, this.nameOnCard, this.pin); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardNumberStage builder() { + return new Builder(); + } + + public interface CardNumberStage { + /** + *

Full card number.

+ */ + CvcStage cardNumber(@NotNull String cardNumber); + + Builder from(CreateCardsResponseSecrets other); + } + + public interface CvcStage { + /** + *

Card verification code.

+ */ + _FinalStage cvc(@NotNull String cvc); + } + + public interface _FinalStage { + CreateCardsResponseSecrets build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Cardholder name printed on the card.

+ */ + _FinalStage nameOnCard(Optional nameOnCard); + + _FinalStage nameOnCard(String nameOnCard); + + _FinalStage nameOnCard(Nullable nameOnCard); + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + _FinalStage pin(Optional pin); + + _FinalStage pin(String pin); + + _FinalStage pin(Nullable pin); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardNumberStage, CvcStage, _FinalStage { + private String cardNumber; + + private String cvc; + + private Optional pin = Optional.empty(); + + private Optional nameOnCard = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCardsResponseSecrets other) { + cardNumber(other.getCardNumber()); + cvc(other.getCvc()); + nameOnCard(other.getNameOnCard()); + pin(other.getPin()); + return this; + } + + /** + *

Full card number.

+ *

Full card number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card_number") + public CvcStage cardNumber(@NotNull String cardNumber) { + this.cardNumber = Objects.requireNonNull(cardNumber, "cardNumber must not be null"); + return this; + } + + /** + *

Card verification code.

+ *

Card verification code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cvc") + public _FinalStage cvc(@NotNull String cvc) { + this.cvc = Objects.requireNonNull(cvc, "cvc must not be null"); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(Nullable pin) { + if (pin.isNull()) { + this.pin = null; + } else if (pin.isEmpty()) { + this.pin = Optional.empty(); + } else { + this.pin = Optional.of(pin.get()); + } + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(String pin) { + this.pin = Optional.ofNullable(pin); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + @java.lang.Override + @JsonSetter(value = "pin", nulls = Nulls.SKIP) + public _FinalStage pin(Optional pin) { + this.pin = pin; + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(Nullable nameOnCard) { + if (nameOnCard.isNull()) { + this.nameOnCard = null; + } else if (nameOnCard.isEmpty()) { + this.nameOnCard = Optional.empty(); + } else { + this.nameOnCard = Optional.of(nameOnCard.get()); + } + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(String nameOnCard) { + this.nameOnCard = Optional.ofNullable(nameOnCard); + return this; + } + + /** + *

Cardholder name printed on the card.

+ */ + @java.lang.Override + @JsonSetter(value = "name_on_card", nulls = Nulls.SKIP) + public _FinalStage nameOnCard(Optional nameOnCard) { + this.nameOnCard = nameOnCard; + return this; + } + + @java.lang.Override + public CreateCardsResponseSecrets build() { + return new CreateCardsResponseSecrets(cardNumber, cvc, nameOnCard, pin, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseStatus.java b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseStatus.java new file mode 100644 index 00000000..19996ed3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseStatus.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCardsResponseStatus { + public static final CreateCardsResponseStatus INVITED = new CreateCardsResponseStatus(Value.INVITED, "invited"); + + public static final CreateCardsResponseStatus CANCELED = new CreateCardsResponseStatus(Value.CANCELED, "canceled"); + + public static final CreateCardsResponseStatus DENIED = new CreateCardsResponseStatus(Value.DENIED, "denied"); + + public static final CreateCardsResponseStatus FROZEN = new CreateCardsResponseStatus(Value.FROZEN, "frozen"); + + public static final CreateCardsResponseStatus ACTIVE = new CreateCardsResponseStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + CreateCardsResponseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCardsResponseStatus + && this.string.equals(((CreateCardsResponseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INVITED: + return visitor.visitInvited(); + case CANCELED: + return visitor.visitCanceled(); + case DENIED: + return visitor.visitDenied(); + case FROZEN: + return visitor.visitFrozen(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCardsResponseStatus valueOf(String value) { + switch (value) { + case "invited": + return INVITED; + case "canceled": + return CANCELED; + case "denied": + return DENIED; + case "frozen": + return FROZEN; + case "active": + return ACTIVE; + default: + return new CreateCardsResponseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + FROZEN, + + CANCELED, + + INVITED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitFrozen(); + + T visitCanceled(); + + T visitInvited(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseType.java b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseType.java new file mode 100644 index 00000000..eeed12a0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/CreateCardsResponseType.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCardsResponseType { + public static final CreateCardsResponseType PHYSICAL = new CreateCardsResponseType(Value.PHYSICAL, "physical"); + + public static final CreateCardsResponseType VIRTUAL = new CreateCardsResponseType(Value.VIRTUAL, "virtual"); + + private final Value value; + + private final String string; + + CreateCardsResponseType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCardsResponseType + && this.string.equals(((CreateCardsResponseType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PHYSICAL: + return visitor.visitPhysical(); + case VIRTUAL: + return visitor.visitVirtual(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCardsResponseType valueOf(String value) { + switch (value) { + case "physical": + return PHYSICAL; + case "virtual": + return VIRTUAL; + default: + return new CreateCardsResponseType(Value.UNKNOWN, value); + } + } + + public enum Value { + VIRTUAL, + + PHYSICAL, + + UNKNOWN + } + + public interface Visitor { + T visitVirtual(); + + T visitPhysical(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/ListCardsResponse.java b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponse.java new file mode 100644 index 00000000..6bcde2e6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponse.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCardsResponse.Builder.class) +public final class ListCardsResponse { + private final List data; + + private final Map additionalProperties; + + private ListCardsResponse(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCardsResponse && equalTo((ListCardsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCardsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListCardsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(ListCardsResponseDataItem data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public ListCardsResponse build() { + return new ListCardsResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItem.java b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItem.java new file mode 100644 index 00000000..81cfb5bf --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItem.java @@ -0,0 +1,1102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCardsResponseDataItem.Builder.class) +public final class ListCardsResponseDataItem { + private final Optional billing; + + private final Optional canceledAt; + + private final Optional createdAt; + + private final Optional expirationMonth; + + private final Optional expirationYear; + + private final String id; + + private final Optional last4; + + private final Optional limit; + + private final Optional name; + + private final ListCardsResponseDataItemObject object; + + private final Optional secrets; + + private final Optional spentLastMonth; + + private final Optional status; + + private final Optional type; + + private final Optional userId; + + private final Map additionalProperties; + + private ListCardsResponseDataItem( + Optional billing, + Optional canceledAt, + Optional createdAt, + Optional expirationMonth, + Optional expirationYear, + String id, + Optional last4, + Optional limit, + Optional name, + ListCardsResponseDataItemObject object, + Optional secrets, + Optional spentLastMonth, + Optional status, + Optional type, + Optional userId, + Map additionalProperties) { + this.billing = billing; + this.canceledAt = canceledAt; + this.createdAt = createdAt; + this.expirationMonth = expirationMonth; + this.expirationYear = expirationYear; + this.id = id; + this.last4 = last4; + this.limit = limit; + this.name = name; + this.object = object; + this.secrets = secrets; + this.spentLastMonth = spentLastMonth; + this.status = status; + this.type = type; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The billing address. + */ + @JsonIgnore + public Optional getBilling() { + if (billing == null) { + return Optional.empty(); + } + return billing; + } + + /** + * @return When the card was canceled. + */ + @JsonIgnore + public Optional getCanceledAt() { + if (canceledAt == null) { + return Optional.empty(); + } + return canceledAt; + } + + /** + * @return When the card was created. + */ + @JsonIgnore + public Optional getCreatedAt() { + if (createdAt == null) { + return Optional.empty(); + } + return createdAt; + } + + /** + * @return Card expiration month. + */ + @JsonIgnore + public Optional getExpirationMonth() { + if (expirationMonth == null) { + return Optional.empty(); + } + return expirationMonth; + } + + /** + * @return Card expiration year. + */ + @JsonIgnore + public Optional getExpirationYear() { + if (expirationYear == null) { + return Optional.empty(); + } + return expirationYear; + } + + /** + * @return Card ID, prefixed icrd_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Last four digits of the card number. null for pending invitation cards. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + /** + * @return The spending limit configuration. + */ + @JsonIgnore + public Optional getLimit() { + if (limit == null) { + return Optional.empty(); + } + return limit; + } + + /** + * @return Card display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("object") + public ListCardsResponseDataItemObject getObject() { + return object; + } + + /** + * @return Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved. + */ + @JsonIgnore + public Optional getSecrets() { + if (secrets == null) { + return Optional.empty(); + } + return secrets; + } + + /** + * @return Total spend in the last 30 days, in cents. + */ + @JsonIgnore + public Optional getSpentLastMonth() { + if (spentLastMonth == null) { + return Optional.empty(); + } + return spentLastMonth; + } + + /** + * @return The card status. denied means the issuer declined the cardholder, so the card will never be issued. + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The card type. + */ + @JsonIgnore + public Optional getType() { + if (type == null) { + return Optional.empty(); + } + return type; + } + + /** + * @return Cardholder user ID, prefixed user_, when assigned. + */ + @JsonIgnore + public Optional getUserId() { + if (userId == null) { + return Optional.empty(); + } + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing") + private Optional _getBilling() { + return billing; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("canceled_at") + private Optional _getCanceledAt() { + return canceledAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_at") + private Optional _getCreatedAt() { + return createdAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_month") + private Optional _getExpirationMonth() { + return expirationMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_year") + private Optional _getExpirationYear() { + return expirationYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("limit") + private Optional _getLimit() { + return limit; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("secrets") + private Optional _getSecrets() { + return secrets; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("spent_last_month") + private Optional _getSpentLastMonth() { + return spentLastMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("type") + private Optional _getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_id") + private Optional _getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCardsResponseDataItem && equalTo((ListCardsResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCardsResponseDataItem other) { + return billing.equals(other.billing) + && canceledAt.equals(other.canceledAt) + && createdAt.equals(other.createdAt) + && expirationMonth.equals(other.expirationMonth) + && expirationYear.equals(other.expirationYear) + && id.equals(other.id) + && last4.equals(other.last4) + && limit.equals(other.limit) + && name.equals(other.name) + && object.equals(other.object) + && secrets.equals(other.secrets) + && spentLastMonth.equals(other.spentLastMonth) + && status.equals(other.status) + && type.equals(other.type) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billing, + this.canceledAt, + this.createdAt, + this.expirationMonth, + this.expirationYear, + this.id, + this.last4, + this.limit, + this.name, + this.object, + this.secrets, + this.spentLastMonth, + this.status, + this.type, + this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Card ID, prefixed icrd_.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(ListCardsResponseDataItem other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull ListCardsResponseDataItemObject object); + } + + public interface _FinalStage { + ListCardsResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The billing address.

+ */ + _FinalStage billing(Optional billing); + + _FinalStage billing(ListCardsResponseDataItemBilling billing); + + _FinalStage billing(Nullable billing); + + /** + *

When the card was canceled.

+ */ + _FinalStage canceledAt(Optional canceledAt); + + _FinalStage canceledAt(OffsetDateTime canceledAt); + + _FinalStage canceledAt(Nullable canceledAt); + + /** + *

When the card was created.

+ */ + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage createdAt(Nullable createdAt); + + /** + *

Card expiration month.

+ */ + _FinalStage expirationMonth(Optional expirationMonth); + + _FinalStage expirationMonth(String expirationMonth); + + _FinalStage expirationMonth(Nullable expirationMonth); + + /** + *

Card expiration year.

+ */ + _FinalStage expirationYear(Optional expirationYear); + + _FinalStage expirationYear(String expirationYear); + + _FinalStage expirationYear(Nullable expirationYear); + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + + /** + *

The spending limit configuration.

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(ListCardsResponseDataItemLimit limit); + + _FinalStage limit(Nullable limit); + + /** + *

Card display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + _FinalStage secrets(Optional secrets); + + _FinalStage secrets(ListCardsResponseDataItemSecrets secrets); + + _FinalStage secrets(Nullable secrets); + + /** + *

Total spend in the last 30 days, in cents.

+ */ + _FinalStage spentLastMonth(Optional spentLastMonth); + + _FinalStage spentLastMonth(Integer spentLastMonth); + + _FinalStage spentLastMonth(Nullable spentLastMonth); + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(ListCardsResponseDataItemStatus status); + + _FinalStage status(Nullable status); + + /** + *

The card type.

+ */ + _FinalStage type(Optional type); + + _FinalStage type(ListCardsResponseDataItemType type); + + _FinalStage type(Nullable type); + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + + _FinalStage userId(Nullable userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private ListCardsResponseDataItemObject object; + + private Optional userId = Optional.empty(); + + private Optional type = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional spentLastMonth = Optional.empty(); + + private Optional secrets = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional last4 = Optional.empty(); + + private Optional expirationYear = Optional.empty(); + + private Optional expirationMonth = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional canceledAt = Optional.empty(); + + private Optional billing = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCardsResponseDataItem other) { + billing(other.getBilling()); + canceledAt(other.getCanceledAt()); + createdAt(other.getCreatedAt()); + expirationMonth(other.getExpirationMonth()); + expirationYear(other.getExpirationYear()); + id(other.getId()); + last4(other.getLast4()); + limit(other.getLimit()); + name(other.getName()); + object(other.getObject()); + secrets(other.getSecrets()); + spentLastMonth(other.getSpentLastMonth()); + status(other.getStatus()); + type(other.getType()); + userId(other.getUserId()); + return this; + } + + /** + *

Card ID, prefixed icrd_.

+ *

Card ID, prefixed icrd_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull ListCardsResponseDataItemObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(Nullable userId) { + if (userId.isNull()) { + this.userId = null; + } else if (userId.isEmpty()) { + this.userId = Optional.empty(); + } else { + this.userId = Optional.of(userId.get()); + } + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(Nullable type) { + if (type.isNull()) { + this.type = null; + } else if (type.isEmpty()) { + this.type = Optional.empty(); + } else { + this.type = Optional.of(type.get()); + } + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(ListCardsResponseDataItemType type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

The card type.

+ */ + @java.lang.Override + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public _FinalStage type(Optional type) { + this.type = type; + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(ListCardsResponseDataItemStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Nullable spentLastMonth) { + if (spentLastMonth.isNull()) { + this.spentLastMonth = null; + } else if (spentLastMonth.isEmpty()) { + this.spentLastMonth = Optional.empty(); + } else { + this.spentLastMonth = Optional.of(spentLastMonth.get()); + } + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Integer spentLastMonth) { + this.spentLastMonth = Optional.ofNullable(spentLastMonth); + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ */ + @java.lang.Override + @JsonSetter(value = "spent_last_month", nulls = Nulls.SKIP) + public _FinalStage spentLastMonth(Optional spentLastMonth) { + this.spentLastMonth = spentLastMonth; + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(Nullable secrets) { + if (secrets.isNull()) { + this.secrets = null; + } else if (secrets.isEmpty()) { + this.secrets = Optional.empty(); + } else { + this.secrets = Optional.of(secrets.get()); + } + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(ListCardsResponseDataItemSecrets secrets) { + this.secrets = Optional.ofNullable(secrets); + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + @java.lang.Override + @JsonSetter(value = "secrets", nulls = Nulls.SKIP) + public _FinalStage secrets(Optional secrets) { + this.secrets = secrets; + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Card display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(Nullable limit) { + if (limit.isNull()) { + this.limit = null; + } else if (limit.isEmpty()) { + this.limit = Optional.empty(); + } else { + this.limit = Optional.of(limit.get()); + } + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(ListCardsResponseDataItemLimit limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

The spending limit configuration.

+ */ + @java.lang.Override + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public _FinalStage limit(Optional limit) { + this.limit = limit; + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(Nullable expirationYear) { + if (expirationYear.isNull()) { + this.expirationYear = null; + } else if (expirationYear.isEmpty()) { + this.expirationYear = Optional.empty(); + } else { + this.expirationYear = Optional.of(expirationYear.get()); + } + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(String expirationYear) { + this.expirationYear = Optional.ofNullable(expirationYear); + return this; + } + + /** + *

Card expiration year.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_year", nulls = Nulls.SKIP) + public _FinalStage expirationYear(Optional expirationYear) { + this.expirationYear = expirationYear; + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(Nullable expirationMonth) { + if (expirationMonth.isNull()) { + this.expirationMonth = null; + } else if (expirationMonth.isEmpty()) { + this.expirationMonth = Optional.empty(); + } else { + this.expirationMonth = Optional.of(expirationMonth.get()); + } + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(String expirationMonth) { + this.expirationMonth = Optional.ofNullable(expirationMonth); + return this; + } + + /** + *

Card expiration month.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_month", nulls = Nulls.SKIP) + public _FinalStage expirationMonth(Optional expirationMonth) { + this.expirationMonth = expirationMonth; + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(Nullable createdAt) { + if (createdAt.isNull()) { + this.createdAt = null; + } else if (createdAt.isEmpty()) { + this.createdAt = Optional.empty(); + } else { + this.createdAt = Optional.of(createdAt.get()); + } + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

When the card was created.

+ */ + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(Nullable canceledAt) { + if (canceledAt.isNull()) { + this.canceledAt = null; + } else if (canceledAt.isEmpty()) { + this.canceledAt = Optional.empty(); + } else { + this.canceledAt = Optional.of(canceledAt.get()); + } + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(OffsetDateTime canceledAt) { + this.canceledAt = Optional.ofNullable(canceledAt); + return this; + } + + /** + *

When the card was canceled.

+ */ + @java.lang.Override + @JsonSetter(value = "canceled_at", nulls = Nulls.SKIP) + public _FinalStage canceledAt(Optional canceledAt) { + this.canceledAt = canceledAt; + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(Nullable billing) { + if (billing.isNull()) { + this.billing = null; + } else if (billing.isEmpty()) { + this.billing = Optional.empty(); + } else { + this.billing = Optional.of(billing.get()); + } + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(ListCardsResponseDataItemBilling billing) { + this.billing = Optional.ofNullable(billing); + return this; + } + + /** + *

The billing address.

+ */ + @java.lang.Override + @JsonSetter(value = "billing", nulls = Nulls.SKIP) + public _FinalStage billing(Optional billing) { + this.billing = billing; + return this; + } + + @java.lang.Override + public ListCardsResponseDataItem build() { + return new ListCardsResponseDataItem( + billing, + canceledAt, + createdAt, + expirationMonth, + expirationYear, + id, + last4, + limit, + name, + object, + secrets, + spentLastMonth, + status, + type, + userId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemBilling.java b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemBilling.java new file mode 100644 index 00000000..9702b309 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemBilling.java @@ -0,0 +1,387 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCardsResponseDataItemBilling.Builder.class) +public final class ListCardsResponseDataItemBilling { + private final Optional city; + + private final Optional countryCode; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional region; + + private final Map additionalProperties; + + private ListCardsResponseDataItemBilling( + Optional city, + Optional countryCode, + Optional line1, + Optional line2, + Optional postalCode, + Optional region, + Map additionalProperties) { + this.city = city; + this.countryCode = countryCode; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.region = region; + this.additionalProperties = additionalProperties; + } + + /** + * @return Billing city. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Billing country code. + */ + @JsonIgnore + public Optional getCountryCode() { + if (countryCode == null) { + return Optional.empty(); + } + return countryCode; + } + + /** + * @return Street address line 1. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return Street address line 2. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Billing postal code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return Billing region or state. + */ + @JsonIgnore + public Optional getRegion() { + if (region == null) { + return Optional.empty(); + } + return region; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country_code") + private Optional _getCountryCode() { + return countryCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("region") + private Optional _getRegion() { + return region; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCardsResponseDataItemBilling && equalTo((ListCardsResponseDataItemBilling) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCardsResponseDataItemBilling other) { + return city.equals(other.city) + && countryCode.equals(other.countryCode) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && region.equals(other.region); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.countryCode, this.line1, this.line2, this.postalCode, this.region); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional countryCode = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional region = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListCardsResponseDataItemBilling other) { + city(other.getCity()); + countryCode(other.getCountryCode()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + region(other.getRegion()); + return this; + } + + /** + *

Billing city.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Billing country code.

+ */ + @JsonSetter(value = "country_code", nulls = Nulls.SKIP) + public Builder countryCode(Optional countryCode) { + this.countryCode = countryCode; + return this; + } + + public Builder countryCode(String countryCode) { + this.countryCode = Optional.ofNullable(countryCode); + return this; + } + + public Builder countryCode(Nullable countryCode) { + if (countryCode.isNull()) { + this.countryCode = null; + } else if (countryCode.isEmpty()) { + this.countryCode = Optional.empty(); + } else { + this.countryCode = Optional.of(countryCode.get()); + } + return this; + } + + /** + *

Street address line 1.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

Street address line 2.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Billing postal code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

Billing region or state.

+ */ + @JsonSetter(value = "region", nulls = Nulls.SKIP) + public Builder region(Optional region) { + this.region = region; + return this; + } + + public Builder region(String region) { + this.region = Optional.ofNullable(region); + return this; + } + + public Builder region(Nullable region) { + if (region.isNull()) { + this.region = null; + } else if (region.isEmpty()) { + this.region = Optional.empty(); + } else { + this.region = Optional.of(region.get()); + } + return this; + } + + public ListCardsResponseDataItemBilling build() { + return new ListCardsResponseDataItemBilling( + city, countryCode, line1, line2, postalCode, region, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemLimit.java b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemLimit.java new file mode 100644 index 00000000..1df43fed --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemLimit.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCardsResponseDataItemLimit.Builder.class) +public final class ListCardsResponseDataItemLimit { + private final double amount; + + private final ListCardsResponseDataItemLimitFrequency frequency; + + private final Map additionalProperties; + + private ListCardsResponseDataItemLimit( + double amount, + ListCardsResponseDataItemLimitFrequency frequency, + Map additionalProperties) { + this.amount = amount; + this.frequency = frequency; + this.additionalProperties = additionalProperties; + } + + /** + * @return The limit amount in dollars. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports. + */ + @JsonProperty("frequency") + public ListCardsResponseDataItemLimitFrequency getFrequency() { + return frequency; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCardsResponseDataItemLimit && equalTo((ListCardsResponseDataItemLimit) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCardsResponseDataItemLimit other) { + return amount == other.amount && frequency.equals(other.frequency); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.frequency); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The limit amount in dollars.

+ */ + FrequencyStage amount(double amount); + + Builder from(ListCardsResponseDataItemLimit other); + } + + public interface FrequencyStage { + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ */ + _FinalStage frequency(@NotNull ListCardsResponseDataItemLimitFrequency frequency); + } + + public interface _FinalStage { + ListCardsResponseDataItemLimit build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, FrequencyStage, _FinalStage { + private double amount; + + private ListCardsResponseDataItemLimitFrequency frequency; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCardsResponseDataItemLimit other) { + amount(other.getAmount()); + frequency(other.getFrequency()); + return this; + } + + /** + *

The limit amount in dollars.

+ *

The limit amount in dollars.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public FrequencyStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("frequency") + public _FinalStage frequency(@NotNull ListCardsResponseDataItemLimitFrequency frequency) { + this.frequency = Objects.requireNonNull(frequency, "frequency must not be null"); + return this; + } + + @java.lang.Override + public ListCardsResponseDataItemLimit build() { + return new ListCardsResponseDataItemLimit(amount, frequency, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemLimitFrequency.java b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemLimitFrequency.java new file mode 100644 index 00000000..4fe3d3ac --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemLimitFrequency.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListCardsResponseDataItemLimitFrequency { + public static final ListCardsResponseDataItemLimitFrequency PER_TRANSACTION = + new ListCardsResponseDataItemLimitFrequency(Value.PER_TRANSACTION, "per_transaction"); + + public static final ListCardsResponseDataItemLimitFrequency ONE_TIME = + new ListCardsResponseDataItemLimitFrequency(Value.ONE_TIME, "one_time"); + + public static final ListCardsResponseDataItemLimitFrequency DAILY = + new ListCardsResponseDataItemLimitFrequency(Value.DAILY, "daily"); + + public static final ListCardsResponseDataItemLimitFrequency WEEKLY = + new ListCardsResponseDataItemLimitFrequency(Value.WEEKLY, "weekly"); + + public static final ListCardsResponseDataItemLimitFrequency MONTHLY = + new ListCardsResponseDataItemLimitFrequency(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + ListCardsResponseDataItemLimitFrequency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListCardsResponseDataItemLimitFrequency + && this.string.equals(((ListCardsResponseDataItemLimitFrequency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PER_TRANSACTION: + return visitor.visitPerTransaction(); + case ONE_TIME: + return visitor.visitOneTime(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListCardsResponseDataItemLimitFrequency valueOf(String value) { + switch (value) { + case "per_transaction": + return PER_TRANSACTION; + case "one_time": + return ONE_TIME; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new ListCardsResponseDataItemLimitFrequency(Value.UNKNOWN, value); + } + } + + public enum Value { + DAILY, + + WEEKLY, + + MONTHLY, + + ONE_TIME, + + PER_TRANSACTION, + + UNKNOWN + } + + public interface Visitor { + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitOneTime(); + + T visitPerTransaction(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemObject.java b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemObject.java new file mode 100644 index 00000000..22e4e2b0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemObject.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListCardsResponseDataItemObject { + public static final ListCardsResponseDataItemObject CARD = new ListCardsResponseDataItemObject(Value.CARD, "card"); + + private final Value value; + + private final String string; + + ListCardsResponseDataItemObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListCardsResponseDataItemObject + && this.string.equals(((ListCardsResponseDataItemObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD: + return visitor.visitCard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListCardsResponseDataItemObject valueOf(String value) { + switch (value) { + case "card": + return CARD; + default: + return new ListCardsResponseDataItemObject(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD, + + UNKNOWN + } + + public interface Visitor { + T visitCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemSecrets.java b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemSecrets.java new file mode 100644 index 00000000..f6cf4fbd --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemSecrets.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCardsResponseDataItemSecrets.Builder.class) +public final class ListCardsResponseDataItemSecrets { + private final String cardNumber; + + private final String cvc; + + private final Optional nameOnCard; + + private final Optional pin; + + private final Map additionalProperties; + + private ListCardsResponseDataItemSecrets( + String cardNumber, + String cvc, + Optional nameOnCard, + Optional pin, + Map additionalProperties) { + this.cardNumber = cardNumber; + this.cvc = cvc; + this.nameOnCard = nameOnCard; + this.pin = pin; + this.additionalProperties = additionalProperties; + } + + /** + * @return Full card number. + */ + @JsonProperty("card_number") + public String getCardNumber() { + return cardNumber; + } + + /** + * @return Card verification code. + */ + @JsonProperty("cvc") + public String getCvc() { + return cvc; + } + + /** + * @return Cardholder name printed on the card. + */ + @JsonIgnore + public Optional getNameOnCard() { + if (nameOnCard == null) { + return Optional.empty(); + } + return nameOnCard; + } + + /** + * @return The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys. + */ + @JsonIgnore + public Optional getPin() { + if (pin == null) { + return Optional.empty(); + } + return pin; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name_on_card") + private Optional _getNameOnCard() { + return nameOnCard; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("pin") + private Optional _getPin() { + return pin; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCardsResponseDataItemSecrets && equalTo((ListCardsResponseDataItemSecrets) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCardsResponseDataItemSecrets other) { + return cardNumber.equals(other.cardNumber) + && cvc.equals(other.cvc) + && nameOnCard.equals(other.nameOnCard) + && pin.equals(other.pin); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cardNumber, this.cvc, this.nameOnCard, this.pin); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardNumberStage builder() { + return new Builder(); + } + + public interface CardNumberStage { + /** + *

Full card number.

+ */ + CvcStage cardNumber(@NotNull String cardNumber); + + Builder from(ListCardsResponseDataItemSecrets other); + } + + public interface CvcStage { + /** + *

Card verification code.

+ */ + _FinalStage cvc(@NotNull String cvc); + } + + public interface _FinalStage { + ListCardsResponseDataItemSecrets build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Cardholder name printed on the card.

+ */ + _FinalStage nameOnCard(Optional nameOnCard); + + _FinalStage nameOnCard(String nameOnCard); + + _FinalStage nameOnCard(Nullable nameOnCard); + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + _FinalStage pin(Optional pin); + + _FinalStage pin(String pin); + + _FinalStage pin(Nullable pin); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardNumberStage, CvcStage, _FinalStage { + private String cardNumber; + + private String cvc; + + private Optional pin = Optional.empty(); + + private Optional nameOnCard = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCardsResponseDataItemSecrets other) { + cardNumber(other.getCardNumber()); + cvc(other.getCvc()); + nameOnCard(other.getNameOnCard()); + pin(other.getPin()); + return this; + } + + /** + *

Full card number.

+ *

Full card number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card_number") + public CvcStage cardNumber(@NotNull String cardNumber) { + this.cardNumber = Objects.requireNonNull(cardNumber, "cardNumber must not be null"); + return this; + } + + /** + *

Card verification code.

+ *

Card verification code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cvc") + public _FinalStage cvc(@NotNull String cvc) { + this.cvc = Objects.requireNonNull(cvc, "cvc must not be null"); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(Nullable pin) { + if (pin.isNull()) { + this.pin = null; + } else if (pin.isEmpty()) { + this.pin = Optional.empty(); + } else { + this.pin = Optional.of(pin.get()); + } + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(String pin) { + this.pin = Optional.ofNullable(pin); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + @java.lang.Override + @JsonSetter(value = "pin", nulls = Nulls.SKIP) + public _FinalStage pin(Optional pin) { + this.pin = pin; + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(Nullable nameOnCard) { + if (nameOnCard.isNull()) { + this.nameOnCard = null; + } else if (nameOnCard.isEmpty()) { + this.nameOnCard = Optional.empty(); + } else { + this.nameOnCard = Optional.of(nameOnCard.get()); + } + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(String nameOnCard) { + this.nameOnCard = Optional.ofNullable(nameOnCard); + return this; + } + + /** + *

Cardholder name printed on the card.

+ */ + @java.lang.Override + @JsonSetter(value = "name_on_card", nulls = Nulls.SKIP) + public _FinalStage nameOnCard(Optional nameOnCard) { + this.nameOnCard = nameOnCard; + return this; + } + + @java.lang.Override + public ListCardsResponseDataItemSecrets build() { + return new ListCardsResponseDataItemSecrets(cardNumber, cvc, nameOnCard, pin, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemStatus.java b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemStatus.java new file mode 100644 index 00000000..16286349 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemStatus.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListCardsResponseDataItemStatus { + public static final ListCardsResponseDataItemStatus INVITED = + new ListCardsResponseDataItemStatus(Value.INVITED, "invited"); + + public static final ListCardsResponseDataItemStatus CANCELED = + new ListCardsResponseDataItemStatus(Value.CANCELED, "canceled"); + + public static final ListCardsResponseDataItemStatus DENIED = + new ListCardsResponseDataItemStatus(Value.DENIED, "denied"); + + public static final ListCardsResponseDataItemStatus FROZEN = + new ListCardsResponseDataItemStatus(Value.FROZEN, "frozen"); + + public static final ListCardsResponseDataItemStatus ACTIVE = + new ListCardsResponseDataItemStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + ListCardsResponseDataItemStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListCardsResponseDataItemStatus + && this.string.equals(((ListCardsResponseDataItemStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INVITED: + return visitor.visitInvited(); + case CANCELED: + return visitor.visitCanceled(); + case DENIED: + return visitor.visitDenied(); + case FROZEN: + return visitor.visitFrozen(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListCardsResponseDataItemStatus valueOf(String value) { + switch (value) { + case "invited": + return INVITED; + case "canceled": + return CANCELED; + case "denied": + return DENIED; + case "frozen": + return FROZEN; + case "active": + return ACTIVE; + default: + return new ListCardsResponseDataItemStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + FROZEN, + + CANCELED, + + INVITED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitFrozen(); + + T visitCanceled(); + + T visitInvited(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemType.java b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemType.java new file mode 100644 index 00000000..2bb5ac3d --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/ListCardsResponseDataItemType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListCardsResponseDataItemType { + public static final ListCardsResponseDataItemType PHYSICAL = + new ListCardsResponseDataItemType(Value.PHYSICAL, "physical"); + + public static final ListCardsResponseDataItemType VIRTUAL = + new ListCardsResponseDataItemType(Value.VIRTUAL, "virtual"); + + private final Value value; + + private final String string; + + ListCardsResponseDataItemType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListCardsResponseDataItemType + && this.string.equals(((ListCardsResponseDataItemType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PHYSICAL: + return visitor.visitPhysical(); + case VIRTUAL: + return visitor.visitVirtual(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListCardsResponseDataItemType valueOf(String value) { + switch (value) { + case "physical": + return PHYSICAL; + case "virtual": + return VIRTUAL; + default: + return new ListCardsResponseDataItemType(Value.UNKNOWN, value); + } + } + + public enum Value { + VIRTUAL, + + PHYSICAL, + + UNKNOWN + } + + public interface Visitor { + T visitVirtual(); + + T visitPhysical(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayload.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayload.java new file mode 100644 index 00000000..581394c7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardApplicationApprovedPayload.Builder.class) +public final class PostCardApplicationApprovedPayload { + private final Optional accountId; + + private final PostCardApplicationApprovedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostCardApplicationApprovedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostCardApplicationApprovedPayloadType type; + + private final Map additionalProperties; + + private PostCardApplicationApprovedPayload( + Optional accountId, + PostCardApplicationApprovedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostCardApplicationApprovedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostCardApplicationApprovedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostCardApplicationApprovedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PostCardApplicationApprovedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostCardApplicationApprovedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardApplicationApprovedPayload + && equalTo((PostCardApplicationApprovedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardApplicationApprovedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostCardApplicationApprovedPayloadApiVersion apiVersion); + + Builder from(PostCardApplicationApprovedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PostCardApplicationApprovedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostCardApplicationApprovedPayloadType type); + } + + public interface _FinalStage { + PostCardApplicationApprovedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostCardApplicationApprovedPayloadApiVersion apiVersion; + + private PostCardApplicationApprovedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostCardApplicationApprovedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardApplicationApprovedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostCardApplicationApprovedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostCardApplicationApprovedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostCardApplicationApprovedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostCardApplicationApprovedPayload build() { + return new PostCardApplicationApprovedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayloadApiVersion.java new file mode 100644 index 00000000..50f61d29 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationApprovedPayloadApiVersion { + public static final PostCardApplicationApprovedPayloadApiVersion V1 = + new PostCardApplicationApprovedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostCardApplicationApprovedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationApprovedPayloadApiVersion + && this.string.equals(((PostCardApplicationApprovedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationApprovedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostCardApplicationApprovedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayloadData.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayloadData.java new file mode 100644 index 00000000..8db50061 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayloadData.java @@ -0,0 +1,266 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardApplicationApprovedPayloadData.Builder.class) +public final class PostCardApplicationApprovedPayloadData { + private final Optional hostedUrl; + + private final String id; + + private final PostCardApplicationApprovedPayloadDataObject object; + + private final PostCardApplicationApprovedPayloadDataStatus status; + + private final Map additionalProperties; + + private PostCardApplicationApprovedPayloadData( + Optional hostedUrl, + String id, + PostCardApplicationApprovedPayloadDataObject object, + PostCardApplicationApprovedPayloadDataStatus status, + Map additionalProperties) { + this.hostedUrl = hostedUrl; + this.id = id; + this.object = object; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return URL where the applicant completes additional identity verification. + */ + @JsonIgnore + public Optional getHostedUrl() { + if (hostedUrl == null) { + return Optional.empty(); + } + return hostedUrl; + } + + /** + * @return Card application ID, prefixed ciac_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("object") + public PostCardApplicationApprovedPayloadDataObject getObject() { + return object; + } + + /** + * @return The application status. + */ + @JsonProperty("status") + public PostCardApplicationApprovedPayloadDataStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("hosted_url") + private Optional _getHostedUrl() { + return hostedUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardApplicationApprovedPayloadData + && equalTo((PostCardApplicationApprovedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardApplicationApprovedPayloadData other) { + return hostedUrl.equals(other.hostedUrl) + && id.equals(other.id) + && object.equals(other.object) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.hostedUrl, this.id, this.object, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Card application ID, prefixed ciac_.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(PostCardApplicationApprovedPayloadData other); + } + + public interface ObjectStage { + StatusStage object(@NotNull PostCardApplicationApprovedPayloadDataObject object); + } + + public interface StatusStage { + /** + *

The application status.

+ */ + _FinalStage status(@NotNull PostCardApplicationApprovedPayloadDataStatus status); + } + + public interface _FinalStage { + PostCardApplicationApprovedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

URL where the applicant completes additional identity verification.

+ */ + _FinalStage hostedUrl(Optional hostedUrl); + + _FinalStage hostedUrl(String hostedUrl); + + _FinalStage hostedUrl(Nullable hostedUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, StatusStage, _FinalStage { + private String id; + + private PostCardApplicationApprovedPayloadDataObject object; + + private PostCardApplicationApprovedPayloadDataStatus status; + + private Optional hostedUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardApplicationApprovedPayloadData other) { + hostedUrl(other.getHostedUrl()); + id(other.getId()); + object(other.getObject()); + status(other.getStatus()); + return this; + } + + /** + *

Card application ID, prefixed ciac_.

+ *

Card application ID, prefixed ciac_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public StatusStage object(@NotNull PostCardApplicationApprovedPayloadDataObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

The application status.

+ *

The application status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull PostCardApplicationApprovedPayloadDataStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

URL where the applicant completes additional identity verification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostedUrl(Nullable hostedUrl) { + if (hostedUrl.isNull()) { + this.hostedUrl = null; + } else if (hostedUrl.isEmpty()) { + this.hostedUrl = Optional.empty(); + } else { + this.hostedUrl = Optional.of(hostedUrl.get()); + } + return this; + } + + /** + *

URL where the applicant completes additional identity verification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostedUrl(String hostedUrl) { + this.hostedUrl = Optional.ofNullable(hostedUrl); + return this; + } + + /** + *

URL where the applicant completes additional identity verification.

+ */ + @java.lang.Override + @JsonSetter(value = "hosted_url", nulls = Nulls.SKIP) + public _FinalStage hostedUrl(Optional hostedUrl) { + this.hostedUrl = hostedUrl; + return this; + } + + @java.lang.Override + public PostCardApplicationApprovedPayloadData build() { + return new PostCardApplicationApprovedPayloadData(hostedUrl, id, object, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayloadDataObject.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayloadDataObject.java new file mode 100644 index 00000000..06b7f845 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayloadDataObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationApprovedPayloadDataObject { + public static final PostCardApplicationApprovedPayloadDataObject CARD_APPLICATION = + new PostCardApplicationApprovedPayloadDataObject(Value.CARD_APPLICATION, "card_application"); + + private final Value value; + + private final String string; + + PostCardApplicationApprovedPayloadDataObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationApprovedPayloadDataObject + && this.string.equals(((PostCardApplicationApprovedPayloadDataObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_APPLICATION: + return visitor.visitCardApplication(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationApprovedPayloadDataObject valueOf(String value) { + switch (value) { + case "card_application": + return CARD_APPLICATION; + default: + return new PostCardApplicationApprovedPayloadDataObject(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_APPLICATION, + + UNKNOWN + } + + public interface Visitor { + T visitCardApplication(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayloadDataStatus.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayloadDataStatus.java new file mode 100644 index 00000000..ad8a3383 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayloadDataStatus.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationApprovedPayloadDataStatus { + public static final PostCardApplicationApprovedPayloadDataStatus APPROVED = + new PostCardApplicationApprovedPayloadDataStatus(Value.APPROVED, "approved"); + + public static final PostCardApplicationApprovedPayloadDataStatus NEEDS_VERIFICATION = + new PostCardApplicationApprovedPayloadDataStatus(Value.NEEDS_VERIFICATION, "needs_verification"); + + public static final PostCardApplicationApprovedPayloadDataStatus MANUAL_REVIEW = + new PostCardApplicationApprovedPayloadDataStatus(Value.MANUAL_REVIEW, "manual_review"); + + public static final PostCardApplicationApprovedPayloadDataStatus PENDING = + new PostCardApplicationApprovedPayloadDataStatus(Value.PENDING, "pending"); + + public static final PostCardApplicationApprovedPayloadDataStatus CANCELED = + new PostCardApplicationApprovedPayloadDataStatus(Value.CANCELED, "canceled"); + + public static final PostCardApplicationApprovedPayloadDataStatus NEEDS_INFORMATION = + new PostCardApplicationApprovedPayloadDataStatus(Value.NEEDS_INFORMATION, "needs_information"); + + public static final PostCardApplicationApprovedPayloadDataStatus DENIED = + new PostCardApplicationApprovedPayloadDataStatus(Value.DENIED, "denied"); + + public static final PostCardApplicationApprovedPayloadDataStatus LOCKED = + new PostCardApplicationApprovedPayloadDataStatus(Value.LOCKED, "locked"); + + private final Value value; + + private final String string; + + PostCardApplicationApprovedPayloadDataStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationApprovedPayloadDataStatus + && this.string.equals(((PostCardApplicationApprovedPayloadDataStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case NEEDS_VERIFICATION: + return visitor.visitNeedsVerification(); + case MANUAL_REVIEW: + return visitor.visitManualReview(); + case PENDING: + return visitor.visitPending(); + case CANCELED: + return visitor.visitCanceled(); + case NEEDS_INFORMATION: + return visitor.visitNeedsInformation(); + case DENIED: + return visitor.visitDenied(); + case LOCKED: + return visitor.visitLocked(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationApprovedPayloadDataStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "needs_verification": + return NEEDS_VERIFICATION; + case "manual_review": + return MANUAL_REVIEW; + case "pending": + return PENDING; + case "canceled": + return CANCELED; + case "needs_information": + return NEEDS_INFORMATION; + case "denied": + return DENIED; + case "locked": + return LOCKED; + default: + return new PostCardApplicationApprovedPayloadDataStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + APPROVED, + + PENDING, + + MANUAL_REVIEW, + + DENIED, + + LOCKED, + + CANCELED, + + NEEDS_VERIFICATION, + + NEEDS_INFORMATION, + + UNKNOWN + } + + public interface Visitor { + T visitApproved(); + + T visitPending(); + + T visitManualReview(); + + T visitDenied(); + + T visitLocked(); + + T visitCanceled(); + + T visitNeedsVerification(); + + T visitNeedsInformation(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayloadType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayloadType.java new file mode 100644 index 00000000..21219872 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationApprovedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationApprovedPayloadType { + public static final PostCardApplicationApprovedPayloadType CARD_APPLICATION_APPROVED = + new PostCardApplicationApprovedPayloadType(Value.CARD_APPLICATION_APPROVED, "card_application.approved"); + + private final Value value; + + private final String string; + + PostCardApplicationApprovedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationApprovedPayloadType + && this.string.equals(((PostCardApplicationApprovedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_APPLICATION_APPROVED: + return visitor.visitCardApplicationApproved(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationApprovedPayloadType valueOf(String value) { + switch (value) { + case "card_application.approved": + return CARD_APPLICATION_APPROVED; + default: + return new PostCardApplicationApprovedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_APPLICATION_APPROVED, + + UNKNOWN + } + + public interface Visitor { + T visitCardApplicationApproved(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayload.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayload.java new file mode 100644 index 00000000..e4b32ff4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayload.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardApplicationCreatedPayload.Builder.class) +public final class PostCardApplicationCreatedPayload { + private final Optional accountId; + + private final PostCardApplicationCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostCardApplicationCreatedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostCardApplicationCreatedPayloadType type; + + private final Map additionalProperties; + + private PostCardApplicationCreatedPayload( + Optional accountId, + PostCardApplicationCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostCardApplicationCreatedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostCardApplicationCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostCardApplicationCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PostCardApplicationCreatedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostCardApplicationCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardApplicationCreatedPayload && equalTo((PostCardApplicationCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardApplicationCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostCardApplicationCreatedPayloadApiVersion apiVersion); + + Builder from(PostCardApplicationCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PostCardApplicationCreatedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostCardApplicationCreatedPayloadType type); + } + + public interface _FinalStage { + PostCardApplicationCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostCardApplicationCreatedPayloadApiVersion apiVersion; + + private PostCardApplicationCreatedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostCardApplicationCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardApplicationCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostCardApplicationCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostCardApplicationCreatedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostCardApplicationCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostCardApplicationCreatedPayload build() { + return new PostCardApplicationCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayloadApiVersion.java new file mode 100644 index 00000000..cf1fbfdf --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationCreatedPayloadApiVersion { + public static final PostCardApplicationCreatedPayloadApiVersion V1 = + new PostCardApplicationCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostCardApplicationCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationCreatedPayloadApiVersion + && this.string.equals(((PostCardApplicationCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostCardApplicationCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayloadData.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayloadData.java new file mode 100644 index 00000000..e18bc2eb --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayloadData.java @@ -0,0 +1,266 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardApplicationCreatedPayloadData.Builder.class) +public final class PostCardApplicationCreatedPayloadData { + private final Optional hostedUrl; + + private final String id; + + private final PostCardApplicationCreatedPayloadDataObject object; + + private final PostCardApplicationCreatedPayloadDataStatus status; + + private final Map additionalProperties; + + private PostCardApplicationCreatedPayloadData( + Optional hostedUrl, + String id, + PostCardApplicationCreatedPayloadDataObject object, + PostCardApplicationCreatedPayloadDataStatus status, + Map additionalProperties) { + this.hostedUrl = hostedUrl; + this.id = id; + this.object = object; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return URL where the applicant completes additional identity verification. + */ + @JsonIgnore + public Optional getHostedUrl() { + if (hostedUrl == null) { + return Optional.empty(); + } + return hostedUrl; + } + + /** + * @return Card application ID, prefixed ciac_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("object") + public PostCardApplicationCreatedPayloadDataObject getObject() { + return object; + } + + /** + * @return The application status. + */ + @JsonProperty("status") + public PostCardApplicationCreatedPayloadDataStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("hosted_url") + private Optional _getHostedUrl() { + return hostedUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardApplicationCreatedPayloadData + && equalTo((PostCardApplicationCreatedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardApplicationCreatedPayloadData other) { + return hostedUrl.equals(other.hostedUrl) + && id.equals(other.id) + && object.equals(other.object) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.hostedUrl, this.id, this.object, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Card application ID, prefixed ciac_.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(PostCardApplicationCreatedPayloadData other); + } + + public interface ObjectStage { + StatusStage object(@NotNull PostCardApplicationCreatedPayloadDataObject object); + } + + public interface StatusStage { + /** + *

The application status.

+ */ + _FinalStage status(@NotNull PostCardApplicationCreatedPayloadDataStatus status); + } + + public interface _FinalStage { + PostCardApplicationCreatedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

URL where the applicant completes additional identity verification.

+ */ + _FinalStage hostedUrl(Optional hostedUrl); + + _FinalStage hostedUrl(String hostedUrl); + + _FinalStage hostedUrl(Nullable hostedUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, StatusStage, _FinalStage { + private String id; + + private PostCardApplicationCreatedPayloadDataObject object; + + private PostCardApplicationCreatedPayloadDataStatus status; + + private Optional hostedUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardApplicationCreatedPayloadData other) { + hostedUrl(other.getHostedUrl()); + id(other.getId()); + object(other.getObject()); + status(other.getStatus()); + return this; + } + + /** + *

Card application ID, prefixed ciac_.

+ *

Card application ID, prefixed ciac_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public StatusStage object(@NotNull PostCardApplicationCreatedPayloadDataObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

The application status.

+ *

The application status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull PostCardApplicationCreatedPayloadDataStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

URL where the applicant completes additional identity verification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostedUrl(Nullable hostedUrl) { + if (hostedUrl.isNull()) { + this.hostedUrl = null; + } else if (hostedUrl.isEmpty()) { + this.hostedUrl = Optional.empty(); + } else { + this.hostedUrl = Optional.of(hostedUrl.get()); + } + return this; + } + + /** + *

URL where the applicant completes additional identity verification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostedUrl(String hostedUrl) { + this.hostedUrl = Optional.ofNullable(hostedUrl); + return this; + } + + /** + *

URL where the applicant completes additional identity verification.

+ */ + @java.lang.Override + @JsonSetter(value = "hosted_url", nulls = Nulls.SKIP) + public _FinalStage hostedUrl(Optional hostedUrl) { + this.hostedUrl = hostedUrl; + return this; + } + + @java.lang.Override + public PostCardApplicationCreatedPayloadData build() { + return new PostCardApplicationCreatedPayloadData(hostedUrl, id, object, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayloadDataObject.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayloadDataObject.java new file mode 100644 index 00000000..e9e88520 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayloadDataObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationCreatedPayloadDataObject { + public static final PostCardApplicationCreatedPayloadDataObject CARD_APPLICATION = + new PostCardApplicationCreatedPayloadDataObject(Value.CARD_APPLICATION, "card_application"); + + private final Value value; + + private final String string; + + PostCardApplicationCreatedPayloadDataObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationCreatedPayloadDataObject + && this.string.equals(((PostCardApplicationCreatedPayloadDataObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_APPLICATION: + return visitor.visitCardApplication(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationCreatedPayloadDataObject valueOf(String value) { + switch (value) { + case "card_application": + return CARD_APPLICATION; + default: + return new PostCardApplicationCreatedPayloadDataObject(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_APPLICATION, + + UNKNOWN + } + + public interface Visitor { + T visitCardApplication(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayloadDataStatus.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayloadDataStatus.java new file mode 100644 index 00000000..756e4a04 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayloadDataStatus.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationCreatedPayloadDataStatus { + public static final PostCardApplicationCreatedPayloadDataStatus APPROVED = + new PostCardApplicationCreatedPayloadDataStatus(Value.APPROVED, "approved"); + + public static final PostCardApplicationCreatedPayloadDataStatus NEEDS_VERIFICATION = + new PostCardApplicationCreatedPayloadDataStatus(Value.NEEDS_VERIFICATION, "needs_verification"); + + public static final PostCardApplicationCreatedPayloadDataStatus MANUAL_REVIEW = + new PostCardApplicationCreatedPayloadDataStatus(Value.MANUAL_REVIEW, "manual_review"); + + public static final PostCardApplicationCreatedPayloadDataStatus PENDING = + new PostCardApplicationCreatedPayloadDataStatus(Value.PENDING, "pending"); + + public static final PostCardApplicationCreatedPayloadDataStatus CANCELED = + new PostCardApplicationCreatedPayloadDataStatus(Value.CANCELED, "canceled"); + + public static final PostCardApplicationCreatedPayloadDataStatus NEEDS_INFORMATION = + new PostCardApplicationCreatedPayloadDataStatus(Value.NEEDS_INFORMATION, "needs_information"); + + public static final PostCardApplicationCreatedPayloadDataStatus DENIED = + new PostCardApplicationCreatedPayloadDataStatus(Value.DENIED, "denied"); + + public static final PostCardApplicationCreatedPayloadDataStatus LOCKED = + new PostCardApplicationCreatedPayloadDataStatus(Value.LOCKED, "locked"); + + private final Value value; + + private final String string; + + PostCardApplicationCreatedPayloadDataStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationCreatedPayloadDataStatus + && this.string.equals(((PostCardApplicationCreatedPayloadDataStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case NEEDS_VERIFICATION: + return visitor.visitNeedsVerification(); + case MANUAL_REVIEW: + return visitor.visitManualReview(); + case PENDING: + return visitor.visitPending(); + case CANCELED: + return visitor.visitCanceled(); + case NEEDS_INFORMATION: + return visitor.visitNeedsInformation(); + case DENIED: + return visitor.visitDenied(); + case LOCKED: + return visitor.visitLocked(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationCreatedPayloadDataStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "needs_verification": + return NEEDS_VERIFICATION; + case "manual_review": + return MANUAL_REVIEW; + case "pending": + return PENDING; + case "canceled": + return CANCELED; + case "needs_information": + return NEEDS_INFORMATION; + case "denied": + return DENIED; + case "locked": + return LOCKED; + default: + return new PostCardApplicationCreatedPayloadDataStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + APPROVED, + + PENDING, + + MANUAL_REVIEW, + + DENIED, + + LOCKED, + + CANCELED, + + NEEDS_VERIFICATION, + + NEEDS_INFORMATION, + + UNKNOWN + } + + public interface Visitor { + T visitApproved(); + + T visitPending(); + + T visitManualReview(); + + T visitDenied(); + + T visitLocked(); + + T visitCanceled(); + + T visitNeedsVerification(); + + T visitNeedsInformation(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayloadType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayloadType.java new file mode 100644 index 00000000..ac9a339d --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationCreatedPayloadType { + public static final PostCardApplicationCreatedPayloadType CARD_APPLICATION_CREATED = + new PostCardApplicationCreatedPayloadType(Value.CARD_APPLICATION_CREATED, "card_application.created"); + + private final Value value; + + private final String string; + + PostCardApplicationCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationCreatedPayloadType + && this.string.equals(((PostCardApplicationCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_APPLICATION_CREATED: + return visitor.visitCardApplicationCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationCreatedPayloadType valueOf(String value) { + switch (value) { + case "card_application.created": + return CARD_APPLICATION_CREATED; + default: + return new PostCardApplicationCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_APPLICATION_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitCardApplicationCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayload.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayload.java new file mode 100644 index 00000000..c1873ca2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayload.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardApplicationDeniedPayload.Builder.class) +public final class PostCardApplicationDeniedPayload { + private final Optional accountId; + + private final PostCardApplicationDeniedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostCardApplicationDeniedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostCardApplicationDeniedPayloadType type; + + private final Map additionalProperties; + + private PostCardApplicationDeniedPayload( + Optional accountId, + PostCardApplicationDeniedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostCardApplicationDeniedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostCardApplicationDeniedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostCardApplicationDeniedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PostCardApplicationDeniedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostCardApplicationDeniedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardApplicationDeniedPayload && equalTo((PostCardApplicationDeniedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardApplicationDeniedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostCardApplicationDeniedPayloadApiVersion apiVersion); + + Builder from(PostCardApplicationDeniedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PostCardApplicationDeniedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostCardApplicationDeniedPayloadType type); + } + + public interface _FinalStage { + PostCardApplicationDeniedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostCardApplicationDeniedPayloadApiVersion apiVersion; + + private PostCardApplicationDeniedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostCardApplicationDeniedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardApplicationDeniedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostCardApplicationDeniedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostCardApplicationDeniedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostCardApplicationDeniedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostCardApplicationDeniedPayload build() { + return new PostCardApplicationDeniedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayloadApiVersion.java new file mode 100644 index 00000000..0dd2d6f5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationDeniedPayloadApiVersion { + public static final PostCardApplicationDeniedPayloadApiVersion V1 = + new PostCardApplicationDeniedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostCardApplicationDeniedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationDeniedPayloadApiVersion + && this.string.equals(((PostCardApplicationDeniedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationDeniedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostCardApplicationDeniedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayloadData.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayloadData.java new file mode 100644 index 00000000..5f05f91c --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayloadData.java @@ -0,0 +1,266 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardApplicationDeniedPayloadData.Builder.class) +public final class PostCardApplicationDeniedPayloadData { + private final Optional hostedUrl; + + private final String id; + + private final PostCardApplicationDeniedPayloadDataObject object; + + private final PostCardApplicationDeniedPayloadDataStatus status; + + private final Map additionalProperties; + + private PostCardApplicationDeniedPayloadData( + Optional hostedUrl, + String id, + PostCardApplicationDeniedPayloadDataObject object, + PostCardApplicationDeniedPayloadDataStatus status, + Map additionalProperties) { + this.hostedUrl = hostedUrl; + this.id = id; + this.object = object; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return URL where the applicant completes additional identity verification. + */ + @JsonIgnore + public Optional getHostedUrl() { + if (hostedUrl == null) { + return Optional.empty(); + } + return hostedUrl; + } + + /** + * @return Card application ID, prefixed ciac_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("object") + public PostCardApplicationDeniedPayloadDataObject getObject() { + return object; + } + + /** + * @return The application status. + */ + @JsonProperty("status") + public PostCardApplicationDeniedPayloadDataStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("hosted_url") + private Optional _getHostedUrl() { + return hostedUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardApplicationDeniedPayloadData + && equalTo((PostCardApplicationDeniedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardApplicationDeniedPayloadData other) { + return hostedUrl.equals(other.hostedUrl) + && id.equals(other.id) + && object.equals(other.object) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.hostedUrl, this.id, this.object, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Card application ID, prefixed ciac_.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(PostCardApplicationDeniedPayloadData other); + } + + public interface ObjectStage { + StatusStage object(@NotNull PostCardApplicationDeniedPayloadDataObject object); + } + + public interface StatusStage { + /** + *

The application status.

+ */ + _FinalStage status(@NotNull PostCardApplicationDeniedPayloadDataStatus status); + } + + public interface _FinalStage { + PostCardApplicationDeniedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

URL where the applicant completes additional identity verification.

+ */ + _FinalStage hostedUrl(Optional hostedUrl); + + _FinalStage hostedUrl(String hostedUrl); + + _FinalStage hostedUrl(Nullable hostedUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, StatusStage, _FinalStage { + private String id; + + private PostCardApplicationDeniedPayloadDataObject object; + + private PostCardApplicationDeniedPayloadDataStatus status; + + private Optional hostedUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardApplicationDeniedPayloadData other) { + hostedUrl(other.getHostedUrl()); + id(other.getId()); + object(other.getObject()); + status(other.getStatus()); + return this; + } + + /** + *

Card application ID, prefixed ciac_.

+ *

Card application ID, prefixed ciac_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public StatusStage object(@NotNull PostCardApplicationDeniedPayloadDataObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

The application status.

+ *

The application status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull PostCardApplicationDeniedPayloadDataStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

URL where the applicant completes additional identity verification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostedUrl(Nullable hostedUrl) { + if (hostedUrl.isNull()) { + this.hostedUrl = null; + } else if (hostedUrl.isEmpty()) { + this.hostedUrl = Optional.empty(); + } else { + this.hostedUrl = Optional.of(hostedUrl.get()); + } + return this; + } + + /** + *

URL where the applicant completes additional identity verification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostedUrl(String hostedUrl) { + this.hostedUrl = Optional.ofNullable(hostedUrl); + return this; + } + + /** + *

URL where the applicant completes additional identity verification.

+ */ + @java.lang.Override + @JsonSetter(value = "hosted_url", nulls = Nulls.SKIP) + public _FinalStage hostedUrl(Optional hostedUrl) { + this.hostedUrl = hostedUrl; + return this; + } + + @java.lang.Override + public PostCardApplicationDeniedPayloadData build() { + return new PostCardApplicationDeniedPayloadData(hostedUrl, id, object, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayloadDataObject.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayloadDataObject.java new file mode 100644 index 00000000..af899606 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayloadDataObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationDeniedPayloadDataObject { + public static final PostCardApplicationDeniedPayloadDataObject CARD_APPLICATION = + new PostCardApplicationDeniedPayloadDataObject(Value.CARD_APPLICATION, "card_application"); + + private final Value value; + + private final String string; + + PostCardApplicationDeniedPayloadDataObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationDeniedPayloadDataObject + && this.string.equals(((PostCardApplicationDeniedPayloadDataObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_APPLICATION: + return visitor.visitCardApplication(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationDeniedPayloadDataObject valueOf(String value) { + switch (value) { + case "card_application": + return CARD_APPLICATION; + default: + return new PostCardApplicationDeniedPayloadDataObject(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_APPLICATION, + + UNKNOWN + } + + public interface Visitor { + T visitCardApplication(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayloadDataStatus.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayloadDataStatus.java new file mode 100644 index 00000000..7c827792 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayloadDataStatus.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationDeniedPayloadDataStatus { + public static final PostCardApplicationDeniedPayloadDataStatus APPROVED = + new PostCardApplicationDeniedPayloadDataStatus(Value.APPROVED, "approved"); + + public static final PostCardApplicationDeniedPayloadDataStatus NEEDS_VERIFICATION = + new PostCardApplicationDeniedPayloadDataStatus(Value.NEEDS_VERIFICATION, "needs_verification"); + + public static final PostCardApplicationDeniedPayloadDataStatus MANUAL_REVIEW = + new PostCardApplicationDeniedPayloadDataStatus(Value.MANUAL_REVIEW, "manual_review"); + + public static final PostCardApplicationDeniedPayloadDataStatus PENDING = + new PostCardApplicationDeniedPayloadDataStatus(Value.PENDING, "pending"); + + public static final PostCardApplicationDeniedPayloadDataStatus CANCELED = + new PostCardApplicationDeniedPayloadDataStatus(Value.CANCELED, "canceled"); + + public static final PostCardApplicationDeniedPayloadDataStatus NEEDS_INFORMATION = + new PostCardApplicationDeniedPayloadDataStatus(Value.NEEDS_INFORMATION, "needs_information"); + + public static final PostCardApplicationDeniedPayloadDataStatus DENIED = + new PostCardApplicationDeniedPayloadDataStatus(Value.DENIED, "denied"); + + public static final PostCardApplicationDeniedPayloadDataStatus LOCKED = + new PostCardApplicationDeniedPayloadDataStatus(Value.LOCKED, "locked"); + + private final Value value; + + private final String string; + + PostCardApplicationDeniedPayloadDataStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationDeniedPayloadDataStatus + && this.string.equals(((PostCardApplicationDeniedPayloadDataStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case NEEDS_VERIFICATION: + return visitor.visitNeedsVerification(); + case MANUAL_REVIEW: + return visitor.visitManualReview(); + case PENDING: + return visitor.visitPending(); + case CANCELED: + return visitor.visitCanceled(); + case NEEDS_INFORMATION: + return visitor.visitNeedsInformation(); + case DENIED: + return visitor.visitDenied(); + case LOCKED: + return visitor.visitLocked(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationDeniedPayloadDataStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "needs_verification": + return NEEDS_VERIFICATION; + case "manual_review": + return MANUAL_REVIEW; + case "pending": + return PENDING; + case "canceled": + return CANCELED; + case "needs_information": + return NEEDS_INFORMATION; + case "denied": + return DENIED; + case "locked": + return LOCKED; + default: + return new PostCardApplicationDeniedPayloadDataStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + APPROVED, + + PENDING, + + MANUAL_REVIEW, + + DENIED, + + LOCKED, + + CANCELED, + + NEEDS_VERIFICATION, + + NEEDS_INFORMATION, + + UNKNOWN + } + + public interface Visitor { + T visitApproved(); + + T visitPending(); + + T visitManualReview(); + + T visitDenied(); + + T visitLocked(); + + T visitCanceled(); + + T visitNeedsVerification(); + + T visitNeedsInformation(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayloadType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayloadType.java new file mode 100644 index 00000000..b331ce32 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationDeniedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationDeniedPayloadType { + public static final PostCardApplicationDeniedPayloadType CARD_APPLICATION_DENIED = + new PostCardApplicationDeniedPayloadType(Value.CARD_APPLICATION_DENIED, "card_application.denied"); + + private final Value value; + + private final String string; + + PostCardApplicationDeniedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationDeniedPayloadType + && this.string.equals(((PostCardApplicationDeniedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_APPLICATION_DENIED: + return visitor.visitCardApplicationDenied(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationDeniedPayloadType valueOf(String value) { + switch (value) { + case "card_application.denied": + return CARD_APPLICATION_DENIED; + default: + return new PostCardApplicationDeniedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_APPLICATION_DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitCardApplicationDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayload.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayload.java new file mode 100644 index 00000000..4a3619ab --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayload.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardApplicationUpdatedPayload.Builder.class) +public final class PostCardApplicationUpdatedPayload { + private final Optional accountId; + + private final PostCardApplicationUpdatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostCardApplicationUpdatedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostCardApplicationUpdatedPayloadType type; + + private final Map additionalProperties; + + private PostCardApplicationUpdatedPayload( + Optional accountId, + PostCardApplicationUpdatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostCardApplicationUpdatedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostCardApplicationUpdatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostCardApplicationUpdatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PostCardApplicationUpdatedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostCardApplicationUpdatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardApplicationUpdatedPayload && equalTo((PostCardApplicationUpdatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardApplicationUpdatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostCardApplicationUpdatedPayloadApiVersion apiVersion); + + Builder from(PostCardApplicationUpdatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PostCardApplicationUpdatedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostCardApplicationUpdatedPayloadType type); + } + + public interface _FinalStage { + PostCardApplicationUpdatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostCardApplicationUpdatedPayloadApiVersion apiVersion; + + private PostCardApplicationUpdatedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostCardApplicationUpdatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardApplicationUpdatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostCardApplicationUpdatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostCardApplicationUpdatedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostCardApplicationUpdatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostCardApplicationUpdatedPayload build() { + return new PostCardApplicationUpdatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayloadApiVersion.java new file mode 100644 index 00000000..e967d034 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationUpdatedPayloadApiVersion { + public static final PostCardApplicationUpdatedPayloadApiVersion V1 = + new PostCardApplicationUpdatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostCardApplicationUpdatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationUpdatedPayloadApiVersion + && this.string.equals(((PostCardApplicationUpdatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationUpdatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostCardApplicationUpdatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayloadData.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayloadData.java new file mode 100644 index 00000000..0a1c5839 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayloadData.java @@ -0,0 +1,266 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardApplicationUpdatedPayloadData.Builder.class) +public final class PostCardApplicationUpdatedPayloadData { + private final Optional hostedUrl; + + private final String id; + + private final PostCardApplicationUpdatedPayloadDataObject object; + + private final PostCardApplicationUpdatedPayloadDataStatus status; + + private final Map additionalProperties; + + private PostCardApplicationUpdatedPayloadData( + Optional hostedUrl, + String id, + PostCardApplicationUpdatedPayloadDataObject object, + PostCardApplicationUpdatedPayloadDataStatus status, + Map additionalProperties) { + this.hostedUrl = hostedUrl; + this.id = id; + this.object = object; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return URL where the applicant completes additional identity verification. + */ + @JsonIgnore + public Optional getHostedUrl() { + if (hostedUrl == null) { + return Optional.empty(); + } + return hostedUrl; + } + + /** + * @return Card application ID, prefixed ciac_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("object") + public PostCardApplicationUpdatedPayloadDataObject getObject() { + return object; + } + + /** + * @return The application status. + */ + @JsonProperty("status") + public PostCardApplicationUpdatedPayloadDataStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("hosted_url") + private Optional _getHostedUrl() { + return hostedUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardApplicationUpdatedPayloadData + && equalTo((PostCardApplicationUpdatedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardApplicationUpdatedPayloadData other) { + return hostedUrl.equals(other.hostedUrl) + && id.equals(other.id) + && object.equals(other.object) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.hostedUrl, this.id, this.object, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Card application ID, prefixed ciac_.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(PostCardApplicationUpdatedPayloadData other); + } + + public interface ObjectStage { + StatusStage object(@NotNull PostCardApplicationUpdatedPayloadDataObject object); + } + + public interface StatusStage { + /** + *

The application status.

+ */ + _FinalStage status(@NotNull PostCardApplicationUpdatedPayloadDataStatus status); + } + + public interface _FinalStage { + PostCardApplicationUpdatedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

URL where the applicant completes additional identity verification.

+ */ + _FinalStage hostedUrl(Optional hostedUrl); + + _FinalStage hostedUrl(String hostedUrl); + + _FinalStage hostedUrl(Nullable hostedUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, StatusStage, _FinalStage { + private String id; + + private PostCardApplicationUpdatedPayloadDataObject object; + + private PostCardApplicationUpdatedPayloadDataStatus status; + + private Optional hostedUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardApplicationUpdatedPayloadData other) { + hostedUrl(other.getHostedUrl()); + id(other.getId()); + object(other.getObject()); + status(other.getStatus()); + return this; + } + + /** + *

Card application ID, prefixed ciac_.

+ *

Card application ID, prefixed ciac_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public StatusStage object(@NotNull PostCardApplicationUpdatedPayloadDataObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

The application status.

+ *

The application status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull PostCardApplicationUpdatedPayloadDataStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

URL where the applicant completes additional identity verification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostedUrl(Nullable hostedUrl) { + if (hostedUrl.isNull()) { + this.hostedUrl = null; + } else if (hostedUrl.isEmpty()) { + this.hostedUrl = Optional.empty(); + } else { + this.hostedUrl = Optional.of(hostedUrl.get()); + } + return this; + } + + /** + *

URL where the applicant completes additional identity verification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostedUrl(String hostedUrl) { + this.hostedUrl = Optional.ofNullable(hostedUrl); + return this; + } + + /** + *

URL where the applicant completes additional identity verification.

+ */ + @java.lang.Override + @JsonSetter(value = "hosted_url", nulls = Nulls.SKIP) + public _FinalStage hostedUrl(Optional hostedUrl) { + this.hostedUrl = hostedUrl; + return this; + } + + @java.lang.Override + public PostCardApplicationUpdatedPayloadData build() { + return new PostCardApplicationUpdatedPayloadData(hostedUrl, id, object, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayloadDataObject.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayloadDataObject.java new file mode 100644 index 00000000..572b5c5a --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayloadDataObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationUpdatedPayloadDataObject { + public static final PostCardApplicationUpdatedPayloadDataObject CARD_APPLICATION = + new PostCardApplicationUpdatedPayloadDataObject(Value.CARD_APPLICATION, "card_application"); + + private final Value value; + + private final String string; + + PostCardApplicationUpdatedPayloadDataObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationUpdatedPayloadDataObject + && this.string.equals(((PostCardApplicationUpdatedPayloadDataObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_APPLICATION: + return visitor.visitCardApplication(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationUpdatedPayloadDataObject valueOf(String value) { + switch (value) { + case "card_application": + return CARD_APPLICATION; + default: + return new PostCardApplicationUpdatedPayloadDataObject(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_APPLICATION, + + UNKNOWN + } + + public interface Visitor { + T visitCardApplication(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayloadDataStatus.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayloadDataStatus.java new file mode 100644 index 00000000..b3f82d5d --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayloadDataStatus.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationUpdatedPayloadDataStatus { + public static final PostCardApplicationUpdatedPayloadDataStatus APPROVED = + new PostCardApplicationUpdatedPayloadDataStatus(Value.APPROVED, "approved"); + + public static final PostCardApplicationUpdatedPayloadDataStatus NEEDS_VERIFICATION = + new PostCardApplicationUpdatedPayloadDataStatus(Value.NEEDS_VERIFICATION, "needs_verification"); + + public static final PostCardApplicationUpdatedPayloadDataStatus MANUAL_REVIEW = + new PostCardApplicationUpdatedPayloadDataStatus(Value.MANUAL_REVIEW, "manual_review"); + + public static final PostCardApplicationUpdatedPayloadDataStatus PENDING = + new PostCardApplicationUpdatedPayloadDataStatus(Value.PENDING, "pending"); + + public static final PostCardApplicationUpdatedPayloadDataStatus CANCELED = + new PostCardApplicationUpdatedPayloadDataStatus(Value.CANCELED, "canceled"); + + public static final PostCardApplicationUpdatedPayloadDataStatus NEEDS_INFORMATION = + new PostCardApplicationUpdatedPayloadDataStatus(Value.NEEDS_INFORMATION, "needs_information"); + + public static final PostCardApplicationUpdatedPayloadDataStatus DENIED = + new PostCardApplicationUpdatedPayloadDataStatus(Value.DENIED, "denied"); + + public static final PostCardApplicationUpdatedPayloadDataStatus LOCKED = + new PostCardApplicationUpdatedPayloadDataStatus(Value.LOCKED, "locked"); + + private final Value value; + + private final String string; + + PostCardApplicationUpdatedPayloadDataStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationUpdatedPayloadDataStatus + && this.string.equals(((PostCardApplicationUpdatedPayloadDataStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case NEEDS_VERIFICATION: + return visitor.visitNeedsVerification(); + case MANUAL_REVIEW: + return visitor.visitManualReview(); + case PENDING: + return visitor.visitPending(); + case CANCELED: + return visitor.visitCanceled(); + case NEEDS_INFORMATION: + return visitor.visitNeedsInformation(); + case DENIED: + return visitor.visitDenied(); + case LOCKED: + return visitor.visitLocked(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationUpdatedPayloadDataStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "needs_verification": + return NEEDS_VERIFICATION; + case "manual_review": + return MANUAL_REVIEW; + case "pending": + return PENDING; + case "canceled": + return CANCELED; + case "needs_information": + return NEEDS_INFORMATION; + case "denied": + return DENIED; + case "locked": + return LOCKED; + default: + return new PostCardApplicationUpdatedPayloadDataStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + APPROVED, + + PENDING, + + MANUAL_REVIEW, + + DENIED, + + LOCKED, + + CANCELED, + + NEEDS_VERIFICATION, + + NEEDS_INFORMATION, + + UNKNOWN + } + + public interface Visitor { + T visitApproved(); + + T visitPending(); + + T visitManualReview(); + + T visitDenied(); + + T visitLocked(); + + T visitCanceled(); + + T visitNeedsVerification(); + + T visitNeedsInformation(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayloadType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayloadType.java new file mode 100644 index 00000000..b98a3ba8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardApplicationUpdatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardApplicationUpdatedPayloadType { + public static final PostCardApplicationUpdatedPayloadType CARD_APPLICATION_UPDATED = + new PostCardApplicationUpdatedPayloadType(Value.CARD_APPLICATION_UPDATED, "card_application.updated"); + + private final Value value; + + private final String string; + + PostCardApplicationUpdatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardApplicationUpdatedPayloadType + && this.string.equals(((PostCardApplicationUpdatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_APPLICATION_UPDATED: + return visitor.visitCardApplicationUpdated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardApplicationUpdatedPayloadType valueOf(String value) { + switch (value) { + case "card_application.updated": + return CARD_APPLICATION_UPDATED; + default: + return new PostCardApplicationUpdatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_APPLICATION_UPDATED, + + UNKNOWN + } + + public interface Visitor { + T visitCardApplicationUpdated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayload.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayload.java new file mode 100644 index 00000000..f4ebe094 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayload.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardCanceledPayload.Builder.class) +public final class PostCardCanceledPayload { + private final Optional accountId; + + private final PostCardCanceledPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostCardCanceledPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostCardCanceledPayloadType type; + + private final Map additionalProperties; + + private PostCardCanceledPayload( + Optional accountId, + PostCardCanceledPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostCardCanceledPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostCardCanceledPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostCardCanceledPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PostCardCanceledPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostCardCanceledPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardCanceledPayload && equalTo((PostCardCanceledPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardCanceledPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostCardCanceledPayloadApiVersion apiVersion); + + Builder from(PostCardCanceledPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PostCardCanceledPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostCardCanceledPayloadType type); + } + + public interface _FinalStage { + PostCardCanceledPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostCardCanceledPayloadApiVersion apiVersion; + + private PostCardCanceledPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostCardCanceledPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardCanceledPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostCardCanceledPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostCardCanceledPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostCardCanceledPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostCardCanceledPayload build() { + return new PostCardCanceledPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadApiVersion.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadApiVersion.java new file mode 100644 index 00000000..8c388005 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardCanceledPayloadApiVersion { + public static final PostCardCanceledPayloadApiVersion V1 = new PostCardCanceledPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostCardCanceledPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardCanceledPayloadApiVersion + && this.string.equals(((PostCardCanceledPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardCanceledPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostCardCanceledPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadData.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadData.java new file mode 100644 index 00000000..bf30143f --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadData.java @@ -0,0 +1,1102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardCanceledPayloadData.Builder.class) +public final class PostCardCanceledPayloadData { + private final Optional billing; + + private final Optional canceledAt; + + private final Optional createdAt; + + private final Optional expirationMonth; + + private final Optional expirationYear; + + private final String id; + + private final Optional last4; + + private final Optional limit; + + private final Optional name; + + private final PostCardCanceledPayloadDataObject object; + + private final Optional secrets; + + private final Optional spentLastMonth; + + private final Optional status; + + private final Optional type; + + private final Optional userId; + + private final Map additionalProperties; + + private PostCardCanceledPayloadData( + Optional billing, + Optional canceledAt, + Optional createdAt, + Optional expirationMonth, + Optional expirationYear, + String id, + Optional last4, + Optional limit, + Optional name, + PostCardCanceledPayloadDataObject object, + Optional secrets, + Optional spentLastMonth, + Optional status, + Optional type, + Optional userId, + Map additionalProperties) { + this.billing = billing; + this.canceledAt = canceledAt; + this.createdAt = createdAt; + this.expirationMonth = expirationMonth; + this.expirationYear = expirationYear; + this.id = id; + this.last4 = last4; + this.limit = limit; + this.name = name; + this.object = object; + this.secrets = secrets; + this.spentLastMonth = spentLastMonth; + this.status = status; + this.type = type; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The billing address. + */ + @JsonIgnore + public Optional getBilling() { + if (billing == null) { + return Optional.empty(); + } + return billing; + } + + /** + * @return When the card was canceled. + */ + @JsonIgnore + public Optional getCanceledAt() { + if (canceledAt == null) { + return Optional.empty(); + } + return canceledAt; + } + + /** + * @return When the card was created. + */ + @JsonIgnore + public Optional getCreatedAt() { + if (createdAt == null) { + return Optional.empty(); + } + return createdAt; + } + + /** + * @return Card expiration month. + */ + @JsonIgnore + public Optional getExpirationMonth() { + if (expirationMonth == null) { + return Optional.empty(); + } + return expirationMonth; + } + + /** + * @return Card expiration year. + */ + @JsonIgnore + public Optional getExpirationYear() { + if (expirationYear == null) { + return Optional.empty(); + } + return expirationYear; + } + + /** + * @return Card ID, prefixed icrd_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Last four digits of the card number. null for pending invitation cards. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + /** + * @return The spending limit configuration. + */ + @JsonIgnore + public Optional getLimit() { + if (limit == null) { + return Optional.empty(); + } + return limit; + } + + /** + * @return Card display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("object") + public PostCardCanceledPayloadDataObject getObject() { + return object; + } + + /** + * @return Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved. + */ + @JsonIgnore + public Optional getSecrets() { + if (secrets == null) { + return Optional.empty(); + } + return secrets; + } + + /** + * @return Total spend in the last 30 days, in cents. + */ + @JsonIgnore + public Optional getSpentLastMonth() { + if (spentLastMonth == null) { + return Optional.empty(); + } + return spentLastMonth; + } + + /** + * @return The card status. denied means the issuer declined the cardholder, so the card will never be issued. + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The card type. + */ + @JsonIgnore + public Optional getType() { + if (type == null) { + return Optional.empty(); + } + return type; + } + + /** + * @return Cardholder user ID, prefixed user_, when assigned. + */ + @JsonIgnore + public Optional getUserId() { + if (userId == null) { + return Optional.empty(); + } + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing") + private Optional _getBilling() { + return billing; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("canceled_at") + private Optional _getCanceledAt() { + return canceledAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_at") + private Optional _getCreatedAt() { + return createdAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_month") + private Optional _getExpirationMonth() { + return expirationMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_year") + private Optional _getExpirationYear() { + return expirationYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("limit") + private Optional _getLimit() { + return limit; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("secrets") + private Optional _getSecrets() { + return secrets; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("spent_last_month") + private Optional _getSpentLastMonth() { + return spentLastMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("type") + private Optional _getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_id") + private Optional _getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardCanceledPayloadData && equalTo((PostCardCanceledPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardCanceledPayloadData other) { + return billing.equals(other.billing) + && canceledAt.equals(other.canceledAt) + && createdAt.equals(other.createdAt) + && expirationMonth.equals(other.expirationMonth) + && expirationYear.equals(other.expirationYear) + && id.equals(other.id) + && last4.equals(other.last4) + && limit.equals(other.limit) + && name.equals(other.name) + && object.equals(other.object) + && secrets.equals(other.secrets) + && spentLastMonth.equals(other.spentLastMonth) + && status.equals(other.status) + && type.equals(other.type) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billing, + this.canceledAt, + this.createdAt, + this.expirationMonth, + this.expirationYear, + this.id, + this.last4, + this.limit, + this.name, + this.object, + this.secrets, + this.spentLastMonth, + this.status, + this.type, + this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Card ID, prefixed icrd_.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(PostCardCanceledPayloadData other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull PostCardCanceledPayloadDataObject object); + } + + public interface _FinalStage { + PostCardCanceledPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The billing address.

+ */ + _FinalStage billing(Optional billing); + + _FinalStage billing(PostCardCanceledPayloadDataBilling billing); + + _FinalStage billing(Nullable billing); + + /** + *

When the card was canceled.

+ */ + _FinalStage canceledAt(Optional canceledAt); + + _FinalStage canceledAt(OffsetDateTime canceledAt); + + _FinalStage canceledAt(Nullable canceledAt); + + /** + *

When the card was created.

+ */ + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage createdAt(Nullable createdAt); + + /** + *

Card expiration month.

+ */ + _FinalStage expirationMonth(Optional expirationMonth); + + _FinalStage expirationMonth(String expirationMonth); + + _FinalStage expirationMonth(Nullable expirationMonth); + + /** + *

Card expiration year.

+ */ + _FinalStage expirationYear(Optional expirationYear); + + _FinalStage expirationYear(String expirationYear); + + _FinalStage expirationYear(Nullable expirationYear); + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + + /** + *

The spending limit configuration.

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(PostCardCanceledPayloadDataLimit limit); + + _FinalStage limit(Nullable limit); + + /** + *

Card display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + _FinalStage secrets(Optional secrets); + + _FinalStage secrets(PostCardCanceledPayloadDataSecrets secrets); + + _FinalStage secrets(Nullable secrets); + + /** + *

Total spend in the last 30 days, in cents.

+ */ + _FinalStage spentLastMonth(Optional spentLastMonth); + + _FinalStage spentLastMonth(Integer spentLastMonth); + + _FinalStage spentLastMonth(Nullable spentLastMonth); + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(PostCardCanceledPayloadDataStatus status); + + _FinalStage status(Nullable status); + + /** + *

The card type.

+ */ + _FinalStage type(Optional type); + + _FinalStage type(PostCardCanceledPayloadDataType type); + + _FinalStage type(Nullable type); + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + + _FinalStage userId(Nullable userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private PostCardCanceledPayloadDataObject object; + + private Optional userId = Optional.empty(); + + private Optional type = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional spentLastMonth = Optional.empty(); + + private Optional secrets = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional last4 = Optional.empty(); + + private Optional expirationYear = Optional.empty(); + + private Optional expirationMonth = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional canceledAt = Optional.empty(); + + private Optional billing = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardCanceledPayloadData other) { + billing(other.getBilling()); + canceledAt(other.getCanceledAt()); + createdAt(other.getCreatedAt()); + expirationMonth(other.getExpirationMonth()); + expirationYear(other.getExpirationYear()); + id(other.getId()); + last4(other.getLast4()); + limit(other.getLimit()); + name(other.getName()); + object(other.getObject()); + secrets(other.getSecrets()); + spentLastMonth(other.getSpentLastMonth()); + status(other.getStatus()); + type(other.getType()); + userId(other.getUserId()); + return this; + } + + /** + *

Card ID, prefixed icrd_.

+ *

Card ID, prefixed icrd_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull PostCardCanceledPayloadDataObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(Nullable userId) { + if (userId.isNull()) { + this.userId = null; + } else if (userId.isEmpty()) { + this.userId = Optional.empty(); + } else { + this.userId = Optional.of(userId.get()); + } + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(Nullable type) { + if (type.isNull()) { + this.type = null; + } else if (type.isEmpty()) { + this.type = Optional.empty(); + } else { + this.type = Optional.of(type.get()); + } + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(PostCardCanceledPayloadDataType type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

The card type.

+ */ + @java.lang.Override + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public _FinalStage type(Optional type) { + this.type = type; + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(PostCardCanceledPayloadDataStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Nullable spentLastMonth) { + if (spentLastMonth.isNull()) { + this.spentLastMonth = null; + } else if (spentLastMonth.isEmpty()) { + this.spentLastMonth = Optional.empty(); + } else { + this.spentLastMonth = Optional.of(spentLastMonth.get()); + } + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Integer spentLastMonth) { + this.spentLastMonth = Optional.ofNullable(spentLastMonth); + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ */ + @java.lang.Override + @JsonSetter(value = "spent_last_month", nulls = Nulls.SKIP) + public _FinalStage spentLastMonth(Optional spentLastMonth) { + this.spentLastMonth = spentLastMonth; + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(Nullable secrets) { + if (secrets.isNull()) { + this.secrets = null; + } else if (secrets.isEmpty()) { + this.secrets = Optional.empty(); + } else { + this.secrets = Optional.of(secrets.get()); + } + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(PostCardCanceledPayloadDataSecrets secrets) { + this.secrets = Optional.ofNullable(secrets); + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + @java.lang.Override + @JsonSetter(value = "secrets", nulls = Nulls.SKIP) + public _FinalStage secrets(Optional secrets) { + this.secrets = secrets; + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Card display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(Nullable limit) { + if (limit.isNull()) { + this.limit = null; + } else if (limit.isEmpty()) { + this.limit = Optional.empty(); + } else { + this.limit = Optional.of(limit.get()); + } + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(PostCardCanceledPayloadDataLimit limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

The spending limit configuration.

+ */ + @java.lang.Override + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public _FinalStage limit(Optional limit) { + this.limit = limit; + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(Nullable expirationYear) { + if (expirationYear.isNull()) { + this.expirationYear = null; + } else if (expirationYear.isEmpty()) { + this.expirationYear = Optional.empty(); + } else { + this.expirationYear = Optional.of(expirationYear.get()); + } + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(String expirationYear) { + this.expirationYear = Optional.ofNullable(expirationYear); + return this; + } + + /** + *

Card expiration year.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_year", nulls = Nulls.SKIP) + public _FinalStage expirationYear(Optional expirationYear) { + this.expirationYear = expirationYear; + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(Nullable expirationMonth) { + if (expirationMonth.isNull()) { + this.expirationMonth = null; + } else if (expirationMonth.isEmpty()) { + this.expirationMonth = Optional.empty(); + } else { + this.expirationMonth = Optional.of(expirationMonth.get()); + } + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(String expirationMonth) { + this.expirationMonth = Optional.ofNullable(expirationMonth); + return this; + } + + /** + *

Card expiration month.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_month", nulls = Nulls.SKIP) + public _FinalStage expirationMonth(Optional expirationMonth) { + this.expirationMonth = expirationMonth; + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(Nullable createdAt) { + if (createdAt.isNull()) { + this.createdAt = null; + } else if (createdAt.isEmpty()) { + this.createdAt = Optional.empty(); + } else { + this.createdAt = Optional.of(createdAt.get()); + } + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

When the card was created.

+ */ + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(Nullable canceledAt) { + if (canceledAt.isNull()) { + this.canceledAt = null; + } else if (canceledAt.isEmpty()) { + this.canceledAt = Optional.empty(); + } else { + this.canceledAt = Optional.of(canceledAt.get()); + } + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(OffsetDateTime canceledAt) { + this.canceledAt = Optional.ofNullable(canceledAt); + return this; + } + + /** + *

When the card was canceled.

+ */ + @java.lang.Override + @JsonSetter(value = "canceled_at", nulls = Nulls.SKIP) + public _FinalStage canceledAt(Optional canceledAt) { + this.canceledAt = canceledAt; + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(Nullable billing) { + if (billing.isNull()) { + this.billing = null; + } else if (billing.isEmpty()) { + this.billing = Optional.empty(); + } else { + this.billing = Optional.of(billing.get()); + } + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(PostCardCanceledPayloadDataBilling billing) { + this.billing = Optional.ofNullable(billing); + return this; + } + + /** + *

The billing address.

+ */ + @java.lang.Override + @JsonSetter(value = "billing", nulls = Nulls.SKIP) + public _FinalStage billing(Optional billing) { + this.billing = billing; + return this; + } + + @java.lang.Override + public PostCardCanceledPayloadData build() { + return new PostCardCanceledPayloadData( + billing, + canceledAt, + createdAt, + expirationMonth, + expirationYear, + id, + last4, + limit, + name, + object, + secrets, + spentLastMonth, + status, + type, + userId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataBilling.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataBilling.java new file mode 100644 index 00000000..2546f1ed --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataBilling.java @@ -0,0 +1,388 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardCanceledPayloadDataBilling.Builder.class) +public final class PostCardCanceledPayloadDataBilling { + private final Optional city; + + private final Optional countryCode; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional region; + + private final Map additionalProperties; + + private PostCardCanceledPayloadDataBilling( + Optional city, + Optional countryCode, + Optional line1, + Optional line2, + Optional postalCode, + Optional region, + Map additionalProperties) { + this.city = city; + this.countryCode = countryCode; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.region = region; + this.additionalProperties = additionalProperties; + } + + /** + * @return Billing city. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Billing country code. + */ + @JsonIgnore + public Optional getCountryCode() { + if (countryCode == null) { + return Optional.empty(); + } + return countryCode; + } + + /** + * @return Street address line 1. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return Street address line 2. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Billing postal code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return Billing region or state. + */ + @JsonIgnore + public Optional getRegion() { + if (region == null) { + return Optional.empty(); + } + return region; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country_code") + private Optional _getCountryCode() { + return countryCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("region") + private Optional _getRegion() { + return region; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardCanceledPayloadDataBilling + && equalTo((PostCardCanceledPayloadDataBilling) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardCanceledPayloadDataBilling other) { + return city.equals(other.city) + && countryCode.equals(other.countryCode) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && region.equals(other.region); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.countryCode, this.line1, this.line2, this.postalCode, this.region); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional countryCode = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional region = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PostCardCanceledPayloadDataBilling other) { + city(other.getCity()); + countryCode(other.getCountryCode()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + region(other.getRegion()); + return this; + } + + /** + *

Billing city.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Billing country code.

+ */ + @JsonSetter(value = "country_code", nulls = Nulls.SKIP) + public Builder countryCode(Optional countryCode) { + this.countryCode = countryCode; + return this; + } + + public Builder countryCode(String countryCode) { + this.countryCode = Optional.ofNullable(countryCode); + return this; + } + + public Builder countryCode(Nullable countryCode) { + if (countryCode.isNull()) { + this.countryCode = null; + } else if (countryCode.isEmpty()) { + this.countryCode = Optional.empty(); + } else { + this.countryCode = Optional.of(countryCode.get()); + } + return this; + } + + /** + *

Street address line 1.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

Street address line 2.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Billing postal code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

Billing region or state.

+ */ + @JsonSetter(value = "region", nulls = Nulls.SKIP) + public Builder region(Optional region) { + this.region = region; + return this; + } + + public Builder region(String region) { + this.region = Optional.ofNullable(region); + return this; + } + + public Builder region(Nullable region) { + if (region.isNull()) { + this.region = null; + } else if (region.isEmpty()) { + this.region = Optional.empty(); + } else { + this.region = Optional.of(region.get()); + } + return this; + } + + public PostCardCanceledPayloadDataBilling build() { + return new PostCardCanceledPayloadDataBilling( + city, countryCode, line1, line2, postalCode, region, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataLimit.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataLimit.java new file mode 100644 index 00000000..80775e0c --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataLimit.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardCanceledPayloadDataLimit.Builder.class) +public final class PostCardCanceledPayloadDataLimit { + private final double amount; + + private final PostCardCanceledPayloadDataLimitFrequency frequency; + + private final Map additionalProperties; + + private PostCardCanceledPayloadDataLimit( + double amount, + PostCardCanceledPayloadDataLimitFrequency frequency, + Map additionalProperties) { + this.amount = amount; + this.frequency = frequency; + this.additionalProperties = additionalProperties; + } + + /** + * @return The limit amount in dollars. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports. + */ + @JsonProperty("frequency") + public PostCardCanceledPayloadDataLimitFrequency getFrequency() { + return frequency; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardCanceledPayloadDataLimit && equalTo((PostCardCanceledPayloadDataLimit) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardCanceledPayloadDataLimit other) { + return amount == other.amount && frequency.equals(other.frequency); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.frequency); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The limit amount in dollars.

+ */ + FrequencyStage amount(double amount); + + Builder from(PostCardCanceledPayloadDataLimit other); + } + + public interface FrequencyStage { + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ */ + _FinalStage frequency(@NotNull PostCardCanceledPayloadDataLimitFrequency frequency); + } + + public interface _FinalStage { + PostCardCanceledPayloadDataLimit build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, FrequencyStage, _FinalStage { + private double amount; + + private PostCardCanceledPayloadDataLimitFrequency frequency; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardCanceledPayloadDataLimit other) { + amount(other.getAmount()); + frequency(other.getFrequency()); + return this; + } + + /** + *

The limit amount in dollars.

+ *

The limit amount in dollars.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public FrequencyStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("frequency") + public _FinalStage frequency(@NotNull PostCardCanceledPayloadDataLimitFrequency frequency) { + this.frequency = Objects.requireNonNull(frequency, "frequency must not be null"); + return this; + } + + @java.lang.Override + public PostCardCanceledPayloadDataLimit build() { + return new PostCardCanceledPayloadDataLimit(amount, frequency, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataLimitFrequency.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataLimitFrequency.java new file mode 100644 index 00000000..9fbd39b3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataLimitFrequency.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardCanceledPayloadDataLimitFrequency { + public static final PostCardCanceledPayloadDataLimitFrequency PER_TRANSACTION = + new PostCardCanceledPayloadDataLimitFrequency(Value.PER_TRANSACTION, "per_transaction"); + + public static final PostCardCanceledPayloadDataLimitFrequency ONE_TIME = + new PostCardCanceledPayloadDataLimitFrequency(Value.ONE_TIME, "one_time"); + + public static final PostCardCanceledPayloadDataLimitFrequency DAILY = + new PostCardCanceledPayloadDataLimitFrequency(Value.DAILY, "daily"); + + public static final PostCardCanceledPayloadDataLimitFrequency WEEKLY = + new PostCardCanceledPayloadDataLimitFrequency(Value.WEEKLY, "weekly"); + + public static final PostCardCanceledPayloadDataLimitFrequency MONTHLY = + new PostCardCanceledPayloadDataLimitFrequency(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + PostCardCanceledPayloadDataLimitFrequency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardCanceledPayloadDataLimitFrequency + && this.string.equals(((PostCardCanceledPayloadDataLimitFrequency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PER_TRANSACTION: + return visitor.visitPerTransaction(); + case ONE_TIME: + return visitor.visitOneTime(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardCanceledPayloadDataLimitFrequency valueOf(String value) { + switch (value) { + case "per_transaction": + return PER_TRANSACTION; + case "one_time": + return ONE_TIME; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new PostCardCanceledPayloadDataLimitFrequency(Value.UNKNOWN, value); + } + } + + public enum Value { + DAILY, + + WEEKLY, + + MONTHLY, + + ONE_TIME, + + PER_TRANSACTION, + + UNKNOWN + } + + public interface Visitor { + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitOneTime(); + + T visitPerTransaction(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataObject.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataObject.java new file mode 100644 index 00000000..e050ec09 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardCanceledPayloadDataObject { + public static final PostCardCanceledPayloadDataObject CARD = + new PostCardCanceledPayloadDataObject(Value.CARD, "card"); + + private final Value value; + + private final String string; + + PostCardCanceledPayloadDataObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardCanceledPayloadDataObject + && this.string.equals(((PostCardCanceledPayloadDataObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD: + return visitor.visitCard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardCanceledPayloadDataObject valueOf(String value) { + switch (value) { + case "card": + return CARD; + default: + return new PostCardCanceledPayloadDataObject(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD, + + UNKNOWN + } + + public interface Visitor { + T visitCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataSecrets.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataSecrets.java new file mode 100644 index 00000000..5418de20 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataSecrets.java @@ -0,0 +1,312 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardCanceledPayloadDataSecrets.Builder.class) +public final class PostCardCanceledPayloadDataSecrets { + private final String cardNumber; + + private final String cvc; + + private final Optional nameOnCard; + + private final Optional pin; + + private final Map additionalProperties; + + private PostCardCanceledPayloadDataSecrets( + String cardNumber, + String cvc, + Optional nameOnCard, + Optional pin, + Map additionalProperties) { + this.cardNumber = cardNumber; + this.cvc = cvc; + this.nameOnCard = nameOnCard; + this.pin = pin; + this.additionalProperties = additionalProperties; + } + + /** + * @return Full card number. + */ + @JsonProperty("card_number") + public String getCardNumber() { + return cardNumber; + } + + /** + * @return Card verification code. + */ + @JsonProperty("cvc") + public String getCvc() { + return cvc; + } + + /** + * @return Cardholder name printed on the card. + */ + @JsonIgnore + public Optional getNameOnCard() { + if (nameOnCard == null) { + return Optional.empty(); + } + return nameOnCard; + } + + /** + * @return The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys. + */ + @JsonIgnore + public Optional getPin() { + if (pin == null) { + return Optional.empty(); + } + return pin; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name_on_card") + private Optional _getNameOnCard() { + return nameOnCard; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("pin") + private Optional _getPin() { + return pin; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardCanceledPayloadDataSecrets + && equalTo((PostCardCanceledPayloadDataSecrets) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardCanceledPayloadDataSecrets other) { + return cardNumber.equals(other.cardNumber) + && cvc.equals(other.cvc) + && nameOnCard.equals(other.nameOnCard) + && pin.equals(other.pin); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cardNumber, this.cvc, this.nameOnCard, this.pin); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardNumberStage builder() { + return new Builder(); + } + + public interface CardNumberStage { + /** + *

Full card number.

+ */ + CvcStage cardNumber(@NotNull String cardNumber); + + Builder from(PostCardCanceledPayloadDataSecrets other); + } + + public interface CvcStage { + /** + *

Card verification code.

+ */ + _FinalStage cvc(@NotNull String cvc); + } + + public interface _FinalStage { + PostCardCanceledPayloadDataSecrets build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Cardholder name printed on the card.

+ */ + _FinalStage nameOnCard(Optional nameOnCard); + + _FinalStage nameOnCard(String nameOnCard); + + _FinalStage nameOnCard(Nullable nameOnCard); + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + _FinalStage pin(Optional pin); + + _FinalStage pin(String pin); + + _FinalStage pin(Nullable pin); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardNumberStage, CvcStage, _FinalStage { + private String cardNumber; + + private String cvc; + + private Optional pin = Optional.empty(); + + private Optional nameOnCard = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardCanceledPayloadDataSecrets other) { + cardNumber(other.getCardNumber()); + cvc(other.getCvc()); + nameOnCard(other.getNameOnCard()); + pin(other.getPin()); + return this; + } + + /** + *

Full card number.

+ *

Full card number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card_number") + public CvcStage cardNumber(@NotNull String cardNumber) { + this.cardNumber = Objects.requireNonNull(cardNumber, "cardNumber must not be null"); + return this; + } + + /** + *

Card verification code.

+ *

Card verification code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cvc") + public _FinalStage cvc(@NotNull String cvc) { + this.cvc = Objects.requireNonNull(cvc, "cvc must not be null"); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(Nullable pin) { + if (pin.isNull()) { + this.pin = null; + } else if (pin.isEmpty()) { + this.pin = Optional.empty(); + } else { + this.pin = Optional.of(pin.get()); + } + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(String pin) { + this.pin = Optional.ofNullable(pin); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + @java.lang.Override + @JsonSetter(value = "pin", nulls = Nulls.SKIP) + public _FinalStage pin(Optional pin) { + this.pin = pin; + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(Nullable nameOnCard) { + if (nameOnCard.isNull()) { + this.nameOnCard = null; + } else if (nameOnCard.isEmpty()) { + this.nameOnCard = Optional.empty(); + } else { + this.nameOnCard = Optional.of(nameOnCard.get()); + } + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(String nameOnCard) { + this.nameOnCard = Optional.ofNullable(nameOnCard); + return this; + } + + /** + *

Cardholder name printed on the card.

+ */ + @java.lang.Override + @JsonSetter(value = "name_on_card", nulls = Nulls.SKIP) + public _FinalStage nameOnCard(Optional nameOnCard) { + this.nameOnCard = nameOnCard; + return this; + } + + @java.lang.Override + public PostCardCanceledPayloadDataSecrets build() { + return new PostCardCanceledPayloadDataSecrets(cardNumber, cvc, nameOnCard, pin, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataStatus.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataStatus.java new file mode 100644 index 00000000..d196e208 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataStatus.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardCanceledPayloadDataStatus { + public static final PostCardCanceledPayloadDataStatus INVITED = + new PostCardCanceledPayloadDataStatus(Value.INVITED, "invited"); + + public static final PostCardCanceledPayloadDataStatus CANCELED = + new PostCardCanceledPayloadDataStatus(Value.CANCELED, "canceled"); + + public static final PostCardCanceledPayloadDataStatus DENIED = + new PostCardCanceledPayloadDataStatus(Value.DENIED, "denied"); + + public static final PostCardCanceledPayloadDataStatus FROZEN = + new PostCardCanceledPayloadDataStatus(Value.FROZEN, "frozen"); + + public static final PostCardCanceledPayloadDataStatus ACTIVE = + new PostCardCanceledPayloadDataStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + PostCardCanceledPayloadDataStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardCanceledPayloadDataStatus + && this.string.equals(((PostCardCanceledPayloadDataStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INVITED: + return visitor.visitInvited(); + case CANCELED: + return visitor.visitCanceled(); + case DENIED: + return visitor.visitDenied(); + case FROZEN: + return visitor.visitFrozen(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardCanceledPayloadDataStatus valueOf(String value) { + switch (value) { + case "invited": + return INVITED; + case "canceled": + return CANCELED; + case "denied": + return DENIED; + case "frozen": + return FROZEN; + case "active": + return ACTIVE; + default: + return new PostCardCanceledPayloadDataStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + FROZEN, + + CANCELED, + + INVITED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitFrozen(); + + T visitCanceled(); + + T visitInvited(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataType.java new file mode 100644 index 00000000..16c751be --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadDataType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardCanceledPayloadDataType { + public static final PostCardCanceledPayloadDataType PHYSICAL = + new PostCardCanceledPayloadDataType(Value.PHYSICAL, "physical"); + + public static final PostCardCanceledPayloadDataType VIRTUAL = + new PostCardCanceledPayloadDataType(Value.VIRTUAL, "virtual"); + + private final Value value; + + private final String string; + + PostCardCanceledPayloadDataType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardCanceledPayloadDataType + && this.string.equals(((PostCardCanceledPayloadDataType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PHYSICAL: + return visitor.visitPhysical(); + case VIRTUAL: + return visitor.visitVirtual(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardCanceledPayloadDataType valueOf(String value) { + switch (value) { + case "physical": + return PHYSICAL; + case "virtual": + return VIRTUAL; + default: + return new PostCardCanceledPayloadDataType(Value.UNKNOWN, value); + } + } + + public enum Value { + VIRTUAL, + + PHYSICAL, + + UNKNOWN + } + + public interface Visitor { + T visitVirtual(); + + T visitPhysical(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadType.java new file mode 100644 index 00000000..c3284561 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCanceledPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardCanceledPayloadType { + public static final PostCardCanceledPayloadType CARD_CANCELED = + new PostCardCanceledPayloadType(Value.CARD_CANCELED, "card.canceled"); + + private final Value value; + + private final String string; + + PostCardCanceledPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardCanceledPayloadType + && this.string.equals(((PostCardCanceledPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_CANCELED: + return visitor.visitCardCanceled(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardCanceledPayloadType valueOf(String value) { + switch (value) { + case "card.canceled": + return CARD_CANCELED; + default: + return new PostCardCanceledPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_CANCELED, + + UNKNOWN + } + + public interface Visitor { + T visitCardCanceled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayload.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayload.java new file mode 100644 index 00000000..ee04324a --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayload.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardCreatedPayload.Builder.class) +public final class PostCardCreatedPayload { + private final Optional accountId; + + private final PostCardCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostCardCreatedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostCardCreatedPayloadType type; + + private final Map additionalProperties; + + private PostCardCreatedPayload( + Optional accountId, + PostCardCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostCardCreatedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostCardCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostCardCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PostCardCreatedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostCardCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardCreatedPayload && equalTo((PostCardCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostCardCreatedPayloadApiVersion apiVersion); + + Builder from(PostCardCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PostCardCreatedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostCardCreatedPayloadType type); + } + + public interface _FinalStage { + PostCardCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostCardCreatedPayloadApiVersion apiVersion; + + private PostCardCreatedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostCardCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostCardCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostCardCreatedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostCardCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostCardCreatedPayload build() { + return new PostCardCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadApiVersion.java new file mode 100644 index 00000000..8bd2c296 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardCreatedPayloadApiVersion { + public static final PostCardCreatedPayloadApiVersion V1 = new PostCardCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostCardCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardCreatedPayloadApiVersion + && this.string.equals(((PostCardCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostCardCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadData.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadData.java new file mode 100644 index 00000000..5d38d69d --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadData.java @@ -0,0 +1,1102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardCreatedPayloadData.Builder.class) +public final class PostCardCreatedPayloadData { + private final Optional billing; + + private final Optional canceledAt; + + private final Optional createdAt; + + private final Optional expirationMonth; + + private final Optional expirationYear; + + private final String id; + + private final Optional last4; + + private final Optional limit; + + private final Optional name; + + private final PostCardCreatedPayloadDataObject object; + + private final Optional secrets; + + private final Optional spentLastMonth; + + private final Optional status; + + private final Optional type; + + private final Optional userId; + + private final Map additionalProperties; + + private PostCardCreatedPayloadData( + Optional billing, + Optional canceledAt, + Optional createdAt, + Optional expirationMonth, + Optional expirationYear, + String id, + Optional last4, + Optional limit, + Optional name, + PostCardCreatedPayloadDataObject object, + Optional secrets, + Optional spentLastMonth, + Optional status, + Optional type, + Optional userId, + Map additionalProperties) { + this.billing = billing; + this.canceledAt = canceledAt; + this.createdAt = createdAt; + this.expirationMonth = expirationMonth; + this.expirationYear = expirationYear; + this.id = id; + this.last4 = last4; + this.limit = limit; + this.name = name; + this.object = object; + this.secrets = secrets; + this.spentLastMonth = spentLastMonth; + this.status = status; + this.type = type; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The billing address. + */ + @JsonIgnore + public Optional getBilling() { + if (billing == null) { + return Optional.empty(); + } + return billing; + } + + /** + * @return When the card was canceled. + */ + @JsonIgnore + public Optional getCanceledAt() { + if (canceledAt == null) { + return Optional.empty(); + } + return canceledAt; + } + + /** + * @return When the card was created. + */ + @JsonIgnore + public Optional getCreatedAt() { + if (createdAt == null) { + return Optional.empty(); + } + return createdAt; + } + + /** + * @return Card expiration month. + */ + @JsonIgnore + public Optional getExpirationMonth() { + if (expirationMonth == null) { + return Optional.empty(); + } + return expirationMonth; + } + + /** + * @return Card expiration year. + */ + @JsonIgnore + public Optional getExpirationYear() { + if (expirationYear == null) { + return Optional.empty(); + } + return expirationYear; + } + + /** + * @return Card ID, prefixed icrd_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Last four digits of the card number. null for pending invitation cards. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + /** + * @return The spending limit configuration. + */ + @JsonIgnore + public Optional getLimit() { + if (limit == null) { + return Optional.empty(); + } + return limit; + } + + /** + * @return Card display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("object") + public PostCardCreatedPayloadDataObject getObject() { + return object; + } + + /** + * @return Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved. + */ + @JsonIgnore + public Optional getSecrets() { + if (secrets == null) { + return Optional.empty(); + } + return secrets; + } + + /** + * @return Total spend in the last 30 days, in cents. + */ + @JsonIgnore + public Optional getSpentLastMonth() { + if (spentLastMonth == null) { + return Optional.empty(); + } + return spentLastMonth; + } + + /** + * @return The card status. denied means the issuer declined the cardholder, so the card will never be issued. + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The card type. + */ + @JsonIgnore + public Optional getType() { + if (type == null) { + return Optional.empty(); + } + return type; + } + + /** + * @return Cardholder user ID, prefixed user_, when assigned. + */ + @JsonIgnore + public Optional getUserId() { + if (userId == null) { + return Optional.empty(); + } + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing") + private Optional _getBilling() { + return billing; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("canceled_at") + private Optional _getCanceledAt() { + return canceledAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_at") + private Optional _getCreatedAt() { + return createdAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_month") + private Optional _getExpirationMonth() { + return expirationMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_year") + private Optional _getExpirationYear() { + return expirationYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("limit") + private Optional _getLimit() { + return limit; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("secrets") + private Optional _getSecrets() { + return secrets; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("spent_last_month") + private Optional _getSpentLastMonth() { + return spentLastMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("type") + private Optional _getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_id") + private Optional _getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardCreatedPayloadData && equalTo((PostCardCreatedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardCreatedPayloadData other) { + return billing.equals(other.billing) + && canceledAt.equals(other.canceledAt) + && createdAt.equals(other.createdAt) + && expirationMonth.equals(other.expirationMonth) + && expirationYear.equals(other.expirationYear) + && id.equals(other.id) + && last4.equals(other.last4) + && limit.equals(other.limit) + && name.equals(other.name) + && object.equals(other.object) + && secrets.equals(other.secrets) + && spentLastMonth.equals(other.spentLastMonth) + && status.equals(other.status) + && type.equals(other.type) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billing, + this.canceledAt, + this.createdAt, + this.expirationMonth, + this.expirationYear, + this.id, + this.last4, + this.limit, + this.name, + this.object, + this.secrets, + this.spentLastMonth, + this.status, + this.type, + this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Card ID, prefixed icrd_.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(PostCardCreatedPayloadData other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull PostCardCreatedPayloadDataObject object); + } + + public interface _FinalStage { + PostCardCreatedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The billing address.

+ */ + _FinalStage billing(Optional billing); + + _FinalStage billing(PostCardCreatedPayloadDataBilling billing); + + _FinalStage billing(Nullable billing); + + /** + *

When the card was canceled.

+ */ + _FinalStage canceledAt(Optional canceledAt); + + _FinalStage canceledAt(OffsetDateTime canceledAt); + + _FinalStage canceledAt(Nullable canceledAt); + + /** + *

When the card was created.

+ */ + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage createdAt(Nullable createdAt); + + /** + *

Card expiration month.

+ */ + _FinalStage expirationMonth(Optional expirationMonth); + + _FinalStage expirationMonth(String expirationMonth); + + _FinalStage expirationMonth(Nullable expirationMonth); + + /** + *

Card expiration year.

+ */ + _FinalStage expirationYear(Optional expirationYear); + + _FinalStage expirationYear(String expirationYear); + + _FinalStage expirationYear(Nullable expirationYear); + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + + /** + *

The spending limit configuration.

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(PostCardCreatedPayloadDataLimit limit); + + _FinalStage limit(Nullable limit); + + /** + *

Card display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + _FinalStage secrets(Optional secrets); + + _FinalStage secrets(PostCardCreatedPayloadDataSecrets secrets); + + _FinalStage secrets(Nullable secrets); + + /** + *

Total spend in the last 30 days, in cents.

+ */ + _FinalStage spentLastMonth(Optional spentLastMonth); + + _FinalStage spentLastMonth(Integer spentLastMonth); + + _FinalStage spentLastMonth(Nullable spentLastMonth); + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(PostCardCreatedPayloadDataStatus status); + + _FinalStage status(Nullable status); + + /** + *

The card type.

+ */ + _FinalStage type(Optional type); + + _FinalStage type(PostCardCreatedPayloadDataType type); + + _FinalStage type(Nullable type); + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + + _FinalStage userId(Nullable userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private PostCardCreatedPayloadDataObject object; + + private Optional userId = Optional.empty(); + + private Optional type = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional spentLastMonth = Optional.empty(); + + private Optional secrets = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional last4 = Optional.empty(); + + private Optional expirationYear = Optional.empty(); + + private Optional expirationMonth = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional canceledAt = Optional.empty(); + + private Optional billing = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardCreatedPayloadData other) { + billing(other.getBilling()); + canceledAt(other.getCanceledAt()); + createdAt(other.getCreatedAt()); + expirationMonth(other.getExpirationMonth()); + expirationYear(other.getExpirationYear()); + id(other.getId()); + last4(other.getLast4()); + limit(other.getLimit()); + name(other.getName()); + object(other.getObject()); + secrets(other.getSecrets()); + spentLastMonth(other.getSpentLastMonth()); + status(other.getStatus()); + type(other.getType()); + userId(other.getUserId()); + return this; + } + + /** + *

Card ID, prefixed icrd_.

+ *

Card ID, prefixed icrd_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull PostCardCreatedPayloadDataObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(Nullable userId) { + if (userId.isNull()) { + this.userId = null; + } else if (userId.isEmpty()) { + this.userId = Optional.empty(); + } else { + this.userId = Optional.of(userId.get()); + } + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(Nullable type) { + if (type.isNull()) { + this.type = null; + } else if (type.isEmpty()) { + this.type = Optional.empty(); + } else { + this.type = Optional.of(type.get()); + } + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(PostCardCreatedPayloadDataType type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

The card type.

+ */ + @java.lang.Override + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public _FinalStage type(Optional type) { + this.type = type; + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(PostCardCreatedPayloadDataStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Nullable spentLastMonth) { + if (spentLastMonth.isNull()) { + this.spentLastMonth = null; + } else if (spentLastMonth.isEmpty()) { + this.spentLastMonth = Optional.empty(); + } else { + this.spentLastMonth = Optional.of(spentLastMonth.get()); + } + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Integer spentLastMonth) { + this.spentLastMonth = Optional.ofNullable(spentLastMonth); + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ */ + @java.lang.Override + @JsonSetter(value = "spent_last_month", nulls = Nulls.SKIP) + public _FinalStage spentLastMonth(Optional spentLastMonth) { + this.spentLastMonth = spentLastMonth; + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(Nullable secrets) { + if (secrets.isNull()) { + this.secrets = null; + } else if (secrets.isEmpty()) { + this.secrets = Optional.empty(); + } else { + this.secrets = Optional.of(secrets.get()); + } + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(PostCardCreatedPayloadDataSecrets secrets) { + this.secrets = Optional.ofNullable(secrets); + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + @java.lang.Override + @JsonSetter(value = "secrets", nulls = Nulls.SKIP) + public _FinalStage secrets(Optional secrets) { + this.secrets = secrets; + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Card display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(Nullable limit) { + if (limit.isNull()) { + this.limit = null; + } else if (limit.isEmpty()) { + this.limit = Optional.empty(); + } else { + this.limit = Optional.of(limit.get()); + } + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(PostCardCreatedPayloadDataLimit limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

The spending limit configuration.

+ */ + @java.lang.Override + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public _FinalStage limit(Optional limit) { + this.limit = limit; + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(Nullable expirationYear) { + if (expirationYear.isNull()) { + this.expirationYear = null; + } else if (expirationYear.isEmpty()) { + this.expirationYear = Optional.empty(); + } else { + this.expirationYear = Optional.of(expirationYear.get()); + } + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(String expirationYear) { + this.expirationYear = Optional.ofNullable(expirationYear); + return this; + } + + /** + *

Card expiration year.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_year", nulls = Nulls.SKIP) + public _FinalStage expirationYear(Optional expirationYear) { + this.expirationYear = expirationYear; + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(Nullable expirationMonth) { + if (expirationMonth.isNull()) { + this.expirationMonth = null; + } else if (expirationMonth.isEmpty()) { + this.expirationMonth = Optional.empty(); + } else { + this.expirationMonth = Optional.of(expirationMonth.get()); + } + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(String expirationMonth) { + this.expirationMonth = Optional.ofNullable(expirationMonth); + return this; + } + + /** + *

Card expiration month.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_month", nulls = Nulls.SKIP) + public _FinalStage expirationMonth(Optional expirationMonth) { + this.expirationMonth = expirationMonth; + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(Nullable createdAt) { + if (createdAt.isNull()) { + this.createdAt = null; + } else if (createdAt.isEmpty()) { + this.createdAt = Optional.empty(); + } else { + this.createdAt = Optional.of(createdAt.get()); + } + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

When the card was created.

+ */ + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(Nullable canceledAt) { + if (canceledAt.isNull()) { + this.canceledAt = null; + } else if (canceledAt.isEmpty()) { + this.canceledAt = Optional.empty(); + } else { + this.canceledAt = Optional.of(canceledAt.get()); + } + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(OffsetDateTime canceledAt) { + this.canceledAt = Optional.ofNullable(canceledAt); + return this; + } + + /** + *

When the card was canceled.

+ */ + @java.lang.Override + @JsonSetter(value = "canceled_at", nulls = Nulls.SKIP) + public _FinalStage canceledAt(Optional canceledAt) { + this.canceledAt = canceledAt; + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(Nullable billing) { + if (billing.isNull()) { + this.billing = null; + } else if (billing.isEmpty()) { + this.billing = Optional.empty(); + } else { + this.billing = Optional.of(billing.get()); + } + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(PostCardCreatedPayloadDataBilling billing) { + this.billing = Optional.ofNullable(billing); + return this; + } + + /** + *

The billing address.

+ */ + @java.lang.Override + @JsonSetter(value = "billing", nulls = Nulls.SKIP) + public _FinalStage billing(Optional billing) { + this.billing = billing; + return this; + } + + @java.lang.Override + public PostCardCreatedPayloadData build() { + return new PostCardCreatedPayloadData( + billing, + canceledAt, + createdAt, + expirationMonth, + expirationYear, + id, + last4, + limit, + name, + object, + secrets, + spentLastMonth, + status, + type, + userId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataBilling.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataBilling.java new file mode 100644 index 00000000..98e95736 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataBilling.java @@ -0,0 +1,387 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardCreatedPayloadDataBilling.Builder.class) +public final class PostCardCreatedPayloadDataBilling { + private final Optional city; + + private final Optional countryCode; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional region; + + private final Map additionalProperties; + + private PostCardCreatedPayloadDataBilling( + Optional city, + Optional countryCode, + Optional line1, + Optional line2, + Optional postalCode, + Optional region, + Map additionalProperties) { + this.city = city; + this.countryCode = countryCode; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.region = region; + this.additionalProperties = additionalProperties; + } + + /** + * @return Billing city. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Billing country code. + */ + @JsonIgnore + public Optional getCountryCode() { + if (countryCode == null) { + return Optional.empty(); + } + return countryCode; + } + + /** + * @return Street address line 1. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return Street address line 2. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Billing postal code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return Billing region or state. + */ + @JsonIgnore + public Optional getRegion() { + if (region == null) { + return Optional.empty(); + } + return region; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country_code") + private Optional _getCountryCode() { + return countryCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("region") + private Optional _getRegion() { + return region; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardCreatedPayloadDataBilling && equalTo((PostCardCreatedPayloadDataBilling) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardCreatedPayloadDataBilling other) { + return city.equals(other.city) + && countryCode.equals(other.countryCode) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && region.equals(other.region); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.countryCode, this.line1, this.line2, this.postalCode, this.region); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional countryCode = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional region = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PostCardCreatedPayloadDataBilling other) { + city(other.getCity()); + countryCode(other.getCountryCode()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + region(other.getRegion()); + return this; + } + + /** + *

Billing city.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Billing country code.

+ */ + @JsonSetter(value = "country_code", nulls = Nulls.SKIP) + public Builder countryCode(Optional countryCode) { + this.countryCode = countryCode; + return this; + } + + public Builder countryCode(String countryCode) { + this.countryCode = Optional.ofNullable(countryCode); + return this; + } + + public Builder countryCode(Nullable countryCode) { + if (countryCode.isNull()) { + this.countryCode = null; + } else if (countryCode.isEmpty()) { + this.countryCode = Optional.empty(); + } else { + this.countryCode = Optional.of(countryCode.get()); + } + return this; + } + + /** + *

Street address line 1.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

Street address line 2.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Billing postal code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

Billing region or state.

+ */ + @JsonSetter(value = "region", nulls = Nulls.SKIP) + public Builder region(Optional region) { + this.region = region; + return this; + } + + public Builder region(String region) { + this.region = Optional.ofNullable(region); + return this; + } + + public Builder region(Nullable region) { + if (region.isNull()) { + this.region = null; + } else if (region.isEmpty()) { + this.region = Optional.empty(); + } else { + this.region = Optional.of(region.get()); + } + return this; + } + + public PostCardCreatedPayloadDataBilling build() { + return new PostCardCreatedPayloadDataBilling( + city, countryCode, line1, line2, postalCode, region, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataLimit.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataLimit.java new file mode 100644 index 00000000..95fa6ba9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataLimit.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardCreatedPayloadDataLimit.Builder.class) +public final class PostCardCreatedPayloadDataLimit { + private final double amount; + + private final PostCardCreatedPayloadDataLimitFrequency frequency; + + private final Map additionalProperties; + + private PostCardCreatedPayloadDataLimit( + double amount, + PostCardCreatedPayloadDataLimitFrequency frequency, + Map additionalProperties) { + this.amount = amount; + this.frequency = frequency; + this.additionalProperties = additionalProperties; + } + + /** + * @return The limit amount in dollars. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports. + */ + @JsonProperty("frequency") + public PostCardCreatedPayloadDataLimitFrequency getFrequency() { + return frequency; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardCreatedPayloadDataLimit && equalTo((PostCardCreatedPayloadDataLimit) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardCreatedPayloadDataLimit other) { + return amount == other.amount && frequency.equals(other.frequency); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.frequency); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The limit amount in dollars.

+ */ + FrequencyStage amount(double amount); + + Builder from(PostCardCreatedPayloadDataLimit other); + } + + public interface FrequencyStage { + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ */ + _FinalStage frequency(@NotNull PostCardCreatedPayloadDataLimitFrequency frequency); + } + + public interface _FinalStage { + PostCardCreatedPayloadDataLimit build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, FrequencyStage, _FinalStage { + private double amount; + + private PostCardCreatedPayloadDataLimitFrequency frequency; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardCreatedPayloadDataLimit other) { + amount(other.getAmount()); + frequency(other.getFrequency()); + return this; + } + + /** + *

The limit amount in dollars.

+ *

The limit amount in dollars.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public FrequencyStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("frequency") + public _FinalStage frequency(@NotNull PostCardCreatedPayloadDataLimitFrequency frequency) { + this.frequency = Objects.requireNonNull(frequency, "frequency must not be null"); + return this; + } + + @java.lang.Override + public PostCardCreatedPayloadDataLimit build() { + return new PostCardCreatedPayloadDataLimit(amount, frequency, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataLimitFrequency.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataLimitFrequency.java new file mode 100644 index 00000000..8033dec8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataLimitFrequency.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardCreatedPayloadDataLimitFrequency { + public static final PostCardCreatedPayloadDataLimitFrequency PER_TRANSACTION = + new PostCardCreatedPayloadDataLimitFrequency(Value.PER_TRANSACTION, "per_transaction"); + + public static final PostCardCreatedPayloadDataLimitFrequency ONE_TIME = + new PostCardCreatedPayloadDataLimitFrequency(Value.ONE_TIME, "one_time"); + + public static final PostCardCreatedPayloadDataLimitFrequency DAILY = + new PostCardCreatedPayloadDataLimitFrequency(Value.DAILY, "daily"); + + public static final PostCardCreatedPayloadDataLimitFrequency WEEKLY = + new PostCardCreatedPayloadDataLimitFrequency(Value.WEEKLY, "weekly"); + + public static final PostCardCreatedPayloadDataLimitFrequency MONTHLY = + new PostCardCreatedPayloadDataLimitFrequency(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + PostCardCreatedPayloadDataLimitFrequency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardCreatedPayloadDataLimitFrequency + && this.string.equals(((PostCardCreatedPayloadDataLimitFrequency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PER_TRANSACTION: + return visitor.visitPerTransaction(); + case ONE_TIME: + return visitor.visitOneTime(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardCreatedPayloadDataLimitFrequency valueOf(String value) { + switch (value) { + case "per_transaction": + return PER_TRANSACTION; + case "one_time": + return ONE_TIME; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new PostCardCreatedPayloadDataLimitFrequency(Value.UNKNOWN, value); + } + } + + public enum Value { + DAILY, + + WEEKLY, + + MONTHLY, + + ONE_TIME, + + PER_TRANSACTION, + + UNKNOWN + } + + public interface Visitor { + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitOneTime(); + + T visitPerTransaction(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataObject.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataObject.java new file mode 100644 index 00000000..9a68cd50 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardCreatedPayloadDataObject { + public static final PostCardCreatedPayloadDataObject CARD = + new PostCardCreatedPayloadDataObject(Value.CARD, "card"); + + private final Value value; + + private final String string; + + PostCardCreatedPayloadDataObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardCreatedPayloadDataObject + && this.string.equals(((PostCardCreatedPayloadDataObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD: + return visitor.visitCard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardCreatedPayloadDataObject valueOf(String value) { + switch (value) { + case "card": + return CARD; + default: + return new PostCardCreatedPayloadDataObject(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD, + + UNKNOWN + } + + public interface Visitor { + T visitCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataSecrets.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataSecrets.java new file mode 100644 index 00000000..0f37044e --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataSecrets.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardCreatedPayloadDataSecrets.Builder.class) +public final class PostCardCreatedPayloadDataSecrets { + private final String cardNumber; + + private final String cvc; + + private final Optional nameOnCard; + + private final Optional pin; + + private final Map additionalProperties; + + private PostCardCreatedPayloadDataSecrets( + String cardNumber, + String cvc, + Optional nameOnCard, + Optional pin, + Map additionalProperties) { + this.cardNumber = cardNumber; + this.cvc = cvc; + this.nameOnCard = nameOnCard; + this.pin = pin; + this.additionalProperties = additionalProperties; + } + + /** + * @return Full card number. + */ + @JsonProperty("card_number") + public String getCardNumber() { + return cardNumber; + } + + /** + * @return Card verification code. + */ + @JsonProperty("cvc") + public String getCvc() { + return cvc; + } + + /** + * @return Cardholder name printed on the card. + */ + @JsonIgnore + public Optional getNameOnCard() { + if (nameOnCard == null) { + return Optional.empty(); + } + return nameOnCard; + } + + /** + * @return The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys. + */ + @JsonIgnore + public Optional getPin() { + if (pin == null) { + return Optional.empty(); + } + return pin; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name_on_card") + private Optional _getNameOnCard() { + return nameOnCard; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("pin") + private Optional _getPin() { + return pin; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardCreatedPayloadDataSecrets && equalTo((PostCardCreatedPayloadDataSecrets) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardCreatedPayloadDataSecrets other) { + return cardNumber.equals(other.cardNumber) + && cvc.equals(other.cvc) + && nameOnCard.equals(other.nameOnCard) + && pin.equals(other.pin); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cardNumber, this.cvc, this.nameOnCard, this.pin); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardNumberStage builder() { + return new Builder(); + } + + public interface CardNumberStage { + /** + *

Full card number.

+ */ + CvcStage cardNumber(@NotNull String cardNumber); + + Builder from(PostCardCreatedPayloadDataSecrets other); + } + + public interface CvcStage { + /** + *

Card verification code.

+ */ + _FinalStage cvc(@NotNull String cvc); + } + + public interface _FinalStage { + PostCardCreatedPayloadDataSecrets build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Cardholder name printed on the card.

+ */ + _FinalStage nameOnCard(Optional nameOnCard); + + _FinalStage nameOnCard(String nameOnCard); + + _FinalStage nameOnCard(Nullable nameOnCard); + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + _FinalStage pin(Optional pin); + + _FinalStage pin(String pin); + + _FinalStage pin(Nullable pin); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardNumberStage, CvcStage, _FinalStage { + private String cardNumber; + + private String cvc; + + private Optional pin = Optional.empty(); + + private Optional nameOnCard = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardCreatedPayloadDataSecrets other) { + cardNumber(other.getCardNumber()); + cvc(other.getCvc()); + nameOnCard(other.getNameOnCard()); + pin(other.getPin()); + return this; + } + + /** + *

Full card number.

+ *

Full card number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card_number") + public CvcStage cardNumber(@NotNull String cardNumber) { + this.cardNumber = Objects.requireNonNull(cardNumber, "cardNumber must not be null"); + return this; + } + + /** + *

Card verification code.

+ *

Card verification code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cvc") + public _FinalStage cvc(@NotNull String cvc) { + this.cvc = Objects.requireNonNull(cvc, "cvc must not be null"); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(Nullable pin) { + if (pin.isNull()) { + this.pin = null; + } else if (pin.isEmpty()) { + this.pin = Optional.empty(); + } else { + this.pin = Optional.of(pin.get()); + } + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(String pin) { + this.pin = Optional.ofNullable(pin); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + @java.lang.Override + @JsonSetter(value = "pin", nulls = Nulls.SKIP) + public _FinalStage pin(Optional pin) { + this.pin = pin; + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(Nullable nameOnCard) { + if (nameOnCard.isNull()) { + this.nameOnCard = null; + } else if (nameOnCard.isEmpty()) { + this.nameOnCard = Optional.empty(); + } else { + this.nameOnCard = Optional.of(nameOnCard.get()); + } + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(String nameOnCard) { + this.nameOnCard = Optional.ofNullable(nameOnCard); + return this; + } + + /** + *

Cardholder name printed on the card.

+ */ + @java.lang.Override + @JsonSetter(value = "name_on_card", nulls = Nulls.SKIP) + public _FinalStage nameOnCard(Optional nameOnCard) { + this.nameOnCard = nameOnCard; + return this; + } + + @java.lang.Override + public PostCardCreatedPayloadDataSecrets build() { + return new PostCardCreatedPayloadDataSecrets(cardNumber, cvc, nameOnCard, pin, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataStatus.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataStatus.java new file mode 100644 index 00000000..68e3b511 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataStatus.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardCreatedPayloadDataStatus { + public static final PostCardCreatedPayloadDataStatus INVITED = + new PostCardCreatedPayloadDataStatus(Value.INVITED, "invited"); + + public static final PostCardCreatedPayloadDataStatus CANCELED = + new PostCardCreatedPayloadDataStatus(Value.CANCELED, "canceled"); + + public static final PostCardCreatedPayloadDataStatus DENIED = + new PostCardCreatedPayloadDataStatus(Value.DENIED, "denied"); + + public static final PostCardCreatedPayloadDataStatus FROZEN = + new PostCardCreatedPayloadDataStatus(Value.FROZEN, "frozen"); + + public static final PostCardCreatedPayloadDataStatus ACTIVE = + new PostCardCreatedPayloadDataStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + PostCardCreatedPayloadDataStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardCreatedPayloadDataStatus + && this.string.equals(((PostCardCreatedPayloadDataStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INVITED: + return visitor.visitInvited(); + case CANCELED: + return visitor.visitCanceled(); + case DENIED: + return visitor.visitDenied(); + case FROZEN: + return visitor.visitFrozen(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardCreatedPayloadDataStatus valueOf(String value) { + switch (value) { + case "invited": + return INVITED; + case "canceled": + return CANCELED; + case "denied": + return DENIED; + case "frozen": + return FROZEN; + case "active": + return ACTIVE; + default: + return new PostCardCreatedPayloadDataStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + FROZEN, + + CANCELED, + + INVITED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitFrozen(); + + T visitCanceled(); + + T visitInvited(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataType.java new file mode 100644 index 00000000..1474c8c9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadDataType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardCreatedPayloadDataType { + public static final PostCardCreatedPayloadDataType PHYSICAL = + new PostCardCreatedPayloadDataType(Value.PHYSICAL, "physical"); + + public static final PostCardCreatedPayloadDataType VIRTUAL = + new PostCardCreatedPayloadDataType(Value.VIRTUAL, "virtual"); + + private final Value value; + + private final String string; + + PostCardCreatedPayloadDataType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardCreatedPayloadDataType + && this.string.equals(((PostCardCreatedPayloadDataType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PHYSICAL: + return visitor.visitPhysical(); + case VIRTUAL: + return visitor.visitVirtual(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardCreatedPayloadDataType valueOf(String value) { + switch (value) { + case "physical": + return PHYSICAL; + case "virtual": + return VIRTUAL; + default: + return new PostCardCreatedPayloadDataType(Value.UNKNOWN, value); + } + } + + public enum Value { + VIRTUAL, + + PHYSICAL, + + UNKNOWN + } + + public interface Visitor { + T visitVirtual(); + + T visitPhysical(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadType.java new file mode 100644 index 00000000..23c5bac2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardCreatedPayloadType { + public static final PostCardCreatedPayloadType CARD_CREATED = + new PostCardCreatedPayloadType(Value.CARD_CREATED, "card.created"); + + private final Value value; + + private final String string; + + PostCardCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardCreatedPayloadType + && this.string.equals(((PostCardCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_CREATED: + return visitor.visitCardCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardCreatedPayloadType valueOf(String value) { + switch (value) { + case "card.created": + return CARD_CREATED; + default: + return new PostCardCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitCardCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayload.java b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayload.java new file mode 100644 index 00000000..e747a56c --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayload.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardFrozenPayload.Builder.class) +public final class PostCardFrozenPayload { + private final Optional accountId; + + private final PostCardFrozenPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostCardFrozenPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostCardFrozenPayloadType type; + + private final Map additionalProperties; + + private PostCardFrozenPayload( + Optional accountId, + PostCardFrozenPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostCardFrozenPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostCardFrozenPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostCardFrozenPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PostCardFrozenPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostCardFrozenPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardFrozenPayload && equalTo((PostCardFrozenPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardFrozenPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostCardFrozenPayloadApiVersion apiVersion); + + Builder from(PostCardFrozenPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PostCardFrozenPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostCardFrozenPayloadType type); + } + + public interface _FinalStage { + PostCardFrozenPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostCardFrozenPayloadApiVersion apiVersion; + + private PostCardFrozenPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostCardFrozenPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardFrozenPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostCardFrozenPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostCardFrozenPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostCardFrozenPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostCardFrozenPayload build() { + return new PostCardFrozenPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadApiVersion.java b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadApiVersion.java new file mode 100644 index 00000000..b77f502e --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardFrozenPayloadApiVersion { + public static final PostCardFrozenPayloadApiVersion V1 = new PostCardFrozenPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostCardFrozenPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardFrozenPayloadApiVersion + && this.string.equals(((PostCardFrozenPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardFrozenPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostCardFrozenPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadData.java b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadData.java new file mode 100644 index 00000000..100242ef --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadData.java @@ -0,0 +1,1102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardFrozenPayloadData.Builder.class) +public final class PostCardFrozenPayloadData { + private final Optional billing; + + private final Optional canceledAt; + + private final Optional createdAt; + + private final Optional expirationMonth; + + private final Optional expirationYear; + + private final String id; + + private final Optional last4; + + private final Optional limit; + + private final Optional name; + + private final PostCardFrozenPayloadDataObject object; + + private final Optional secrets; + + private final Optional spentLastMonth; + + private final Optional status; + + private final Optional type; + + private final Optional userId; + + private final Map additionalProperties; + + private PostCardFrozenPayloadData( + Optional billing, + Optional canceledAt, + Optional createdAt, + Optional expirationMonth, + Optional expirationYear, + String id, + Optional last4, + Optional limit, + Optional name, + PostCardFrozenPayloadDataObject object, + Optional secrets, + Optional spentLastMonth, + Optional status, + Optional type, + Optional userId, + Map additionalProperties) { + this.billing = billing; + this.canceledAt = canceledAt; + this.createdAt = createdAt; + this.expirationMonth = expirationMonth; + this.expirationYear = expirationYear; + this.id = id; + this.last4 = last4; + this.limit = limit; + this.name = name; + this.object = object; + this.secrets = secrets; + this.spentLastMonth = spentLastMonth; + this.status = status; + this.type = type; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The billing address. + */ + @JsonIgnore + public Optional getBilling() { + if (billing == null) { + return Optional.empty(); + } + return billing; + } + + /** + * @return When the card was canceled. + */ + @JsonIgnore + public Optional getCanceledAt() { + if (canceledAt == null) { + return Optional.empty(); + } + return canceledAt; + } + + /** + * @return When the card was created. + */ + @JsonIgnore + public Optional getCreatedAt() { + if (createdAt == null) { + return Optional.empty(); + } + return createdAt; + } + + /** + * @return Card expiration month. + */ + @JsonIgnore + public Optional getExpirationMonth() { + if (expirationMonth == null) { + return Optional.empty(); + } + return expirationMonth; + } + + /** + * @return Card expiration year. + */ + @JsonIgnore + public Optional getExpirationYear() { + if (expirationYear == null) { + return Optional.empty(); + } + return expirationYear; + } + + /** + * @return Card ID, prefixed icrd_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Last four digits of the card number. null for pending invitation cards. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + /** + * @return The spending limit configuration. + */ + @JsonIgnore + public Optional getLimit() { + if (limit == null) { + return Optional.empty(); + } + return limit; + } + + /** + * @return Card display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("object") + public PostCardFrozenPayloadDataObject getObject() { + return object; + } + + /** + * @return Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved. + */ + @JsonIgnore + public Optional getSecrets() { + if (secrets == null) { + return Optional.empty(); + } + return secrets; + } + + /** + * @return Total spend in the last 30 days, in cents. + */ + @JsonIgnore + public Optional getSpentLastMonth() { + if (spentLastMonth == null) { + return Optional.empty(); + } + return spentLastMonth; + } + + /** + * @return The card status. denied means the issuer declined the cardholder, so the card will never be issued. + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The card type. + */ + @JsonIgnore + public Optional getType() { + if (type == null) { + return Optional.empty(); + } + return type; + } + + /** + * @return Cardholder user ID, prefixed user_, when assigned. + */ + @JsonIgnore + public Optional getUserId() { + if (userId == null) { + return Optional.empty(); + } + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing") + private Optional _getBilling() { + return billing; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("canceled_at") + private Optional _getCanceledAt() { + return canceledAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_at") + private Optional _getCreatedAt() { + return createdAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_month") + private Optional _getExpirationMonth() { + return expirationMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_year") + private Optional _getExpirationYear() { + return expirationYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("limit") + private Optional _getLimit() { + return limit; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("secrets") + private Optional _getSecrets() { + return secrets; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("spent_last_month") + private Optional _getSpentLastMonth() { + return spentLastMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("type") + private Optional _getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_id") + private Optional _getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardFrozenPayloadData && equalTo((PostCardFrozenPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardFrozenPayloadData other) { + return billing.equals(other.billing) + && canceledAt.equals(other.canceledAt) + && createdAt.equals(other.createdAt) + && expirationMonth.equals(other.expirationMonth) + && expirationYear.equals(other.expirationYear) + && id.equals(other.id) + && last4.equals(other.last4) + && limit.equals(other.limit) + && name.equals(other.name) + && object.equals(other.object) + && secrets.equals(other.secrets) + && spentLastMonth.equals(other.spentLastMonth) + && status.equals(other.status) + && type.equals(other.type) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billing, + this.canceledAt, + this.createdAt, + this.expirationMonth, + this.expirationYear, + this.id, + this.last4, + this.limit, + this.name, + this.object, + this.secrets, + this.spentLastMonth, + this.status, + this.type, + this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Card ID, prefixed icrd_.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(PostCardFrozenPayloadData other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull PostCardFrozenPayloadDataObject object); + } + + public interface _FinalStage { + PostCardFrozenPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The billing address.

+ */ + _FinalStage billing(Optional billing); + + _FinalStage billing(PostCardFrozenPayloadDataBilling billing); + + _FinalStage billing(Nullable billing); + + /** + *

When the card was canceled.

+ */ + _FinalStage canceledAt(Optional canceledAt); + + _FinalStage canceledAt(OffsetDateTime canceledAt); + + _FinalStage canceledAt(Nullable canceledAt); + + /** + *

When the card was created.

+ */ + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage createdAt(Nullable createdAt); + + /** + *

Card expiration month.

+ */ + _FinalStage expirationMonth(Optional expirationMonth); + + _FinalStage expirationMonth(String expirationMonth); + + _FinalStage expirationMonth(Nullable expirationMonth); + + /** + *

Card expiration year.

+ */ + _FinalStage expirationYear(Optional expirationYear); + + _FinalStage expirationYear(String expirationYear); + + _FinalStage expirationYear(Nullable expirationYear); + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + + /** + *

The spending limit configuration.

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(PostCardFrozenPayloadDataLimit limit); + + _FinalStage limit(Nullable limit); + + /** + *

Card display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + _FinalStage secrets(Optional secrets); + + _FinalStage secrets(PostCardFrozenPayloadDataSecrets secrets); + + _FinalStage secrets(Nullable secrets); + + /** + *

Total spend in the last 30 days, in cents.

+ */ + _FinalStage spentLastMonth(Optional spentLastMonth); + + _FinalStage spentLastMonth(Integer spentLastMonth); + + _FinalStage spentLastMonth(Nullable spentLastMonth); + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(PostCardFrozenPayloadDataStatus status); + + _FinalStage status(Nullable status); + + /** + *

The card type.

+ */ + _FinalStage type(Optional type); + + _FinalStage type(PostCardFrozenPayloadDataType type); + + _FinalStage type(Nullable type); + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + + _FinalStage userId(Nullable userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private PostCardFrozenPayloadDataObject object; + + private Optional userId = Optional.empty(); + + private Optional type = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional spentLastMonth = Optional.empty(); + + private Optional secrets = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional last4 = Optional.empty(); + + private Optional expirationYear = Optional.empty(); + + private Optional expirationMonth = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional canceledAt = Optional.empty(); + + private Optional billing = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardFrozenPayloadData other) { + billing(other.getBilling()); + canceledAt(other.getCanceledAt()); + createdAt(other.getCreatedAt()); + expirationMonth(other.getExpirationMonth()); + expirationYear(other.getExpirationYear()); + id(other.getId()); + last4(other.getLast4()); + limit(other.getLimit()); + name(other.getName()); + object(other.getObject()); + secrets(other.getSecrets()); + spentLastMonth(other.getSpentLastMonth()); + status(other.getStatus()); + type(other.getType()); + userId(other.getUserId()); + return this; + } + + /** + *

Card ID, prefixed icrd_.

+ *

Card ID, prefixed icrd_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull PostCardFrozenPayloadDataObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(Nullable userId) { + if (userId.isNull()) { + this.userId = null; + } else if (userId.isEmpty()) { + this.userId = Optional.empty(); + } else { + this.userId = Optional.of(userId.get()); + } + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(Nullable type) { + if (type.isNull()) { + this.type = null; + } else if (type.isEmpty()) { + this.type = Optional.empty(); + } else { + this.type = Optional.of(type.get()); + } + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(PostCardFrozenPayloadDataType type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

The card type.

+ */ + @java.lang.Override + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public _FinalStage type(Optional type) { + this.type = type; + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(PostCardFrozenPayloadDataStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Nullable spentLastMonth) { + if (spentLastMonth.isNull()) { + this.spentLastMonth = null; + } else if (spentLastMonth.isEmpty()) { + this.spentLastMonth = Optional.empty(); + } else { + this.spentLastMonth = Optional.of(spentLastMonth.get()); + } + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Integer spentLastMonth) { + this.spentLastMonth = Optional.ofNullable(spentLastMonth); + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ */ + @java.lang.Override + @JsonSetter(value = "spent_last_month", nulls = Nulls.SKIP) + public _FinalStage spentLastMonth(Optional spentLastMonth) { + this.spentLastMonth = spentLastMonth; + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(Nullable secrets) { + if (secrets.isNull()) { + this.secrets = null; + } else if (secrets.isEmpty()) { + this.secrets = Optional.empty(); + } else { + this.secrets = Optional.of(secrets.get()); + } + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(PostCardFrozenPayloadDataSecrets secrets) { + this.secrets = Optional.ofNullable(secrets); + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + @java.lang.Override + @JsonSetter(value = "secrets", nulls = Nulls.SKIP) + public _FinalStage secrets(Optional secrets) { + this.secrets = secrets; + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Card display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(Nullable limit) { + if (limit.isNull()) { + this.limit = null; + } else if (limit.isEmpty()) { + this.limit = Optional.empty(); + } else { + this.limit = Optional.of(limit.get()); + } + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(PostCardFrozenPayloadDataLimit limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

The spending limit configuration.

+ */ + @java.lang.Override + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public _FinalStage limit(Optional limit) { + this.limit = limit; + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(Nullable expirationYear) { + if (expirationYear.isNull()) { + this.expirationYear = null; + } else if (expirationYear.isEmpty()) { + this.expirationYear = Optional.empty(); + } else { + this.expirationYear = Optional.of(expirationYear.get()); + } + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(String expirationYear) { + this.expirationYear = Optional.ofNullable(expirationYear); + return this; + } + + /** + *

Card expiration year.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_year", nulls = Nulls.SKIP) + public _FinalStage expirationYear(Optional expirationYear) { + this.expirationYear = expirationYear; + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(Nullable expirationMonth) { + if (expirationMonth.isNull()) { + this.expirationMonth = null; + } else if (expirationMonth.isEmpty()) { + this.expirationMonth = Optional.empty(); + } else { + this.expirationMonth = Optional.of(expirationMonth.get()); + } + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(String expirationMonth) { + this.expirationMonth = Optional.ofNullable(expirationMonth); + return this; + } + + /** + *

Card expiration month.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_month", nulls = Nulls.SKIP) + public _FinalStage expirationMonth(Optional expirationMonth) { + this.expirationMonth = expirationMonth; + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(Nullable createdAt) { + if (createdAt.isNull()) { + this.createdAt = null; + } else if (createdAt.isEmpty()) { + this.createdAt = Optional.empty(); + } else { + this.createdAt = Optional.of(createdAt.get()); + } + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

When the card was created.

+ */ + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(Nullable canceledAt) { + if (canceledAt.isNull()) { + this.canceledAt = null; + } else if (canceledAt.isEmpty()) { + this.canceledAt = Optional.empty(); + } else { + this.canceledAt = Optional.of(canceledAt.get()); + } + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(OffsetDateTime canceledAt) { + this.canceledAt = Optional.ofNullable(canceledAt); + return this; + } + + /** + *

When the card was canceled.

+ */ + @java.lang.Override + @JsonSetter(value = "canceled_at", nulls = Nulls.SKIP) + public _FinalStage canceledAt(Optional canceledAt) { + this.canceledAt = canceledAt; + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(Nullable billing) { + if (billing.isNull()) { + this.billing = null; + } else if (billing.isEmpty()) { + this.billing = Optional.empty(); + } else { + this.billing = Optional.of(billing.get()); + } + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(PostCardFrozenPayloadDataBilling billing) { + this.billing = Optional.ofNullable(billing); + return this; + } + + /** + *

The billing address.

+ */ + @java.lang.Override + @JsonSetter(value = "billing", nulls = Nulls.SKIP) + public _FinalStage billing(Optional billing) { + this.billing = billing; + return this; + } + + @java.lang.Override + public PostCardFrozenPayloadData build() { + return new PostCardFrozenPayloadData( + billing, + canceledAt, + createdAt, + expirationMonth, + expirationYear, + id, + last4, + limit, + name, + object, + secrets, + spentLastMonth, + status, + type, + userId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataBilling.java b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataBilling.java new file mode 100644 index 00000000..37a49fd5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataBilling.java @@ -0,0 +1,387 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardFrozenPayloadDataBilling.Builder.class) +public final class PostCardFrozenPayloadDataBilling { + private final Optional city; + + private final Optional countryCode; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional region; + + private final Map additionalProperties; + + private PostCardFrozenPayloadDataBilling( + Optional city, + Optional countryCode, + Optional line1, + Optional line2, + Optional postalCode, + Optional region, + Map additionalProperties) { + this.city = city; + this.countryCode = countryCode; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.region = region; + this.additionalProperties = additionalProperties; + } + + /** + * @return Billing city. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Billing country code. + */ + @JsonIgnore + public Optional getCountryCode() { + if (countryCode == null) { + return Optional.empty(); + } + return countryCode; + } + + /** + * @return Street address line 1. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return Street address line 2. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Billing postal code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return Billing region or state. + */ + @JsonIgnore + public Optional getRegion() { + if (region == null) { + return Optional.empty(); + } + return region; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country_code") + private Optional _getCountryCode() { + return countryCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("region") + private Optional _getRegion() { + return region; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardFrozenPayloadDataBilling && equalTo((PostCardFrozenPayloadDataBilling) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardFrozenPayloadDataBilling other) { + return city.equals(other.city) + && countryCode.equals(other.countryCode) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && region.equals(other.region); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.countryCode, this.line1, this.line2, this.postalCode, this.region); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional countryCode = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional region = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PostCardFrozenPayloadDataBilling other) { + city(other.getCity()); + countryCode(other.getCountryCode()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + region(other.getRegion()); + return this; + } + + /** + *

Billing city.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Billing country code.

+ */ + @JsonSetter(value = "country_code", nulls = Nulls.SKIP) + public Builder countryCode(Optional countryCode) { + this.countryCode = countryCode; + return this; + } + + public Builder countryCode(String countryCode) { + this.countryCode = Optional.ofNullable(countryCode); + return this; + } + + public Builder countryCode(Nullable countryCode) { + if (countryCode.isNull()) { + this.countryCode = null; + } else if (countryCode.isEmpty()) { + this.countryCode = Optional.empty(); + } else { + this.countryCode = Optional.of(countryCode.get()); + } + return this; + } + + /** + *

Street address line 1.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

Street address line 2.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Billing postal code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

Billing region or state.

+ */ + @JsonSetter(value = "region", nulls = Nulls.SKIP) + public Builder region(Optional region) { + this.region = region; + return this; + } + + public Builder region(String region) { + this.region = Optional.ofNullable(region); + return this; + } + + public Builder region(Nullable region) { + if (region.isNull()) { + this.region = null; + } else if (region.isEmpty()) { + this.region = Optional.empty(); + } else { + this.region = Optional.of(region.get()); + } + return this; + } + + public PostCardFrozenPayloadDataBilling build() { + return new PostCardFrozenPayloadDataBilling( + city, countryCode, line1, line2, postalCode, region, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataLimit.java b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataLimit.java new file mode 100644 index 00000000..73ef67e5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataLimit.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardFrozenPayloadDataLimit.Builder.class) +public final class PostCardFrozenPayloadDataLimit { + private final double amount; + + private final PostCardFrozenPayloadDataLimitFrequency frequency; + + private final Map additionalProperties; + + private PostCardFrozenPayloadDataLimit( + double amount, + PostCardFrozenPayloadDataLimitFrequency frequency, + Map additionalProperties) { + this.amount = amount; + this.frequency = frequency; + this.additionalProperties = additionalProperties; + } + + /** + * @return The limit amount in dollars. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports. + */ + @JsonProperty("frequency") + public PostCardFrozenPayloadDataLimitFrequency getFrequency() { + return frequency; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardFrozenPayloadDataLimit && equalTo((PostCardFrozenPayloadDataLimit) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardFrozenPayloadDataLimit other) { + return amount == other.amount && frequency.equals(other.frequency); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.frequency); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The limit amount in dollars.

+ */ + FrequencyStage amount(double amount); + + Builder from(PostCardFrozenPayloadDataLimit other); + } + + public interface FrequencyStage { + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ */ + _FinalStage frequency(@NotNull PostCardFrozenPayloadDataLimitFrequency frequency); + } + + public interface _FinalStage { + PostCardFrozenPayloadDataLimit build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, FrequencyStage, _FinalStage { + private double amount; + + private PostCardFrozenPayloadDataLimitFrequency frequency; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardFrozenPayloadDataLimit other) { + amount(other.getAmount()); + frequency(other.getFrequency()); + return this; + } + + /** + *

The limit amount in dollars.

+ *

The limit amount in dollars.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public FrequencyStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("frequency") + public _FinalStage frequency(@NotNull PostCardFrozenPayloadDataLimitFrequency frequency) { + this.frequency = Objects.requireNonNull(frequency, "frequency must not be null"); + return this; + } + + @java.lang.Override + public PostCardFrozenPayloadDataLimit build() { + return new PostCardFrozenPayloadDataLimit(amount, frequency, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataLimitFrequency.java b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataLimitFrequency.java new file mode 100644 index 00000000..c1c313f0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataLimitFrequency.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardFrozenPayloadDataLimitFrequency { + public static final PostCardFrozenPayloadDataLimitFrequency PER_TRANSACTION = + new PostCardFrozenPayloadDataLimitFrequency(Value.PER_TRANSACTION, "per_transaction"); + + public static final PostCardFrozenPayloadDataLimitFrequency ONE_TIME = + new PostCardFrozenPayloadDataLimitFrequency(Value.ONE_TIME, "one_time"); + + public static final PostCardFrozenPayloadDataLimitFrequency DAILY = + new PostCardFrozenPayloadDataLimitFrequency(Value.DAILY, "daily"); + + public static final PostCardFrozenPayloadDataLimitFrequency WEEKLY = + new PostCardFrozenPayloadDataLimitFrequency(Value.WEEKLY, "weekly"); + + public static final PostCardFrozenPayloadDataLimitFrequency MONTHLY = + new PostCardFrozenPayloadDataLimitFrequency(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + PostCardFrozenPayloadDataLimitFrequency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardFrozenPayloadDataLimitFrequency + && this.string.equals(((PostCardFrozenPayloadDataLimitFrequency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PER_TRANSACTION: + return visitor.visitPerTransaction(); + case ONE_TIME: + return visitor.visitOneTime(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardFrozenPayloadDataLimitFrequency valueOf(String value) { + switch (value) { + case "per_transaction": + return PER_TRANSACTION; + case "one_time": + return ONE_TIME; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new PostCardFrozenPayloadDataLimitFrequency(Value.UNKNOWN, value); + } + } + + public enum Value { + DAILY, + + WEEKLY, + + MONTHLY, + + ONE_TIME, + + PER_TRANSACTION, + + UNKNOWN + } + + public interface Visitor { + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitOneTime(); + + T visitPerTransaction(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataObject.java b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataObject.java new file mode 100644 index 00000000..2c36d8c8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataObject.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardFrozenPayloadDataObject { + public static final PostCardFrozenPayloadDataObject CARD = new PostCardFrozenPayloadDataObject(Value.CARD, "card"); + + private final Value value; + + private final String string; + + PostCardFrozenPayloadDataObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardFrozenPayloadDataObject + && this.string.equals(((PostCardFrozenPayloadDataObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD: + return visitor.visitCard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardFrozenPayloadDataObject valueOf(String value) { + switch (value) { + case "card": + return CARD; + default: + return new PostCardFrozenPayloadDataObject(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD, + + UNKNOWN + } + + public interface Visitor { + T visitCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataSecrets.java b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataSecrets.java new file mode 100644 index 00000000..62694a66 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataSecrets.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardFrozenPayloadDataSecrets.Builder.class) +public final class PostCardFrozenPayloadDataSecrets { + private final String cardNumber; + + private final String cvc; + + private final Optional nameOnCard; + + private final Optional pin; + + private final Map additionalProperties; + + private PostCardFrozenPayloadDataSecrets( + String cardNumber, + String cvc, + Optional nameOnCard, + Optional pin, + Map additionalProperties) { + this.cardNumber = cardNumber; + this.cvc = cvc; + this.nameOnCard = nameOnCard; + this.pin = pin; + this.additionalProperties = additionalProperties; + } + + /** + * @return Full card number. + */ + @JsonProperty("card_number") + public String getCardNumber() { + return cardNumber; + } + + /** + * @return Card verification code. + */ + @JsonProperty("cvc") + public String getCvc() { + return cvc; + } + + /** + * @return Cardholder name printed on the card. + */ + @JsonIgnore + public Optional getNameOnCard() { + if (nameOnCard == null) { + return Optional.empty(); + } + return nameOnCard; + } + + /** + * @return The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys. + */ + @JsonIgnore + public Optional getPin() { + if (pin == null) { + return Optional.empty(); + } + return pin; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name_on_card") + private Optional _getNameOnCard() { + return nameOnCard; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("pin") + private Optional _getPin() { + return pin; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardFrozenPayloadDataSecrets && equalTo((PostCardFrozenPayloadDataSecrets) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardFrozenPayloadDataSecrets other) { + return cardNumber.equals(other.cardNumber) + && cvc.equals(other.cvc) + && nameOnCard.equals(other.nameOnCard) + && pin.equals(other.pin); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cardNumber, this.cvc, this.nameOnCard, this.pin); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardNumberStage builder() { + return new Builder(); + } + + public interface CardNumberStage { + /** + *

Full card number.

+ */ + CvcStage cardNumber(@NotNull String cardNumber); + + Builder from(PostCardFrozenPayloadDataSecrets other); + } + + public interface CvcStage { + /** + *

Card verification code.

+ */ + _FinalStage cvc(@NotNull String cvc); + } + + public interface _FinalStage { + PostCardFrozenPayloadDataSecrets build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Cardholder name printed on the card.

+ */ + _FinalStage nameOnCard(Optional nameOnCard); + + _FinalStage nameOnCard(String nameOnCard); + + _FinalStage nameOnCard(Nullable nameOnCard); + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + _FinalStage pin(Optional pin); + + _FinalStage pin(String pin); + + _FinalStage pin(Nullable pin); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardNumberStage, CvcStage, _FinalStage { + private String cardNumber; + + private String cvc; + + private Optional pin = Optional.empty(); + + private Optional nameOnCard = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardFrozenPayloadDataSecrets other) { + cardNumber(other.getCardNumber()); + cvc(other.getCvc()); + nameOnCard(other.getNameOnCard()); + pin(other.getPin()); + return this; + } + + /** + *

Full card number.

+ *

Full card number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card_number") + public CvcStage cardNumber(@NotNull String cardNumber) { + this.cardNumber = Objects.requireNonNull(cardNumber, "cardNumber must not be null"); + return this; + } + + /** + *

Card verification code.

+ *

Card verification code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cvc") + public _FinalStage cvc(@NotNull String cvc) { + this.cvc = Objects.requireNonNull(cvc, "cvc must not be null"); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(Nullable pin) { + if (pin.isNull()) { + this.pin = null; + } else if (pin.isEmpty()) { + this.pin = Optional.empty(); + } else { + this.pin = Optional.of(pin.get()); + } + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(String pin) { + this.pin = Optional.ofNullable(pin); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + @java.lang.Override + @JsonSetter(value = "pin", nulls = Nulls.SKIP) + public _FinalStage pin(Optional pin) { + this.pin = pin; + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(Nullable nameOnCard) { + if (nameOnCard.isNull()) { + this.nameOnCard = null; + } else if (nameOnCard.isEmpty()) { + this.nameOnCard = Optional.empty(); + } else { + this.nameOnCard = Optional.of(nameOnCard.get()); + } + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(String nameOnCard) { + this.nameOnCard = Optional.ofNullable(nameOnCard); + return this; + } + + /** + *

Cardholder name printed on the card.

+ */ + @java.lang.Override + @JsonSetter(value = "name_on_card", nulls = Nulls.SKIP) + public _FinalStage nameOnCard(Optional nameOnCard) { + this.nameOnCard = nameOnCard; + return this; + } + + @java.lang.Override + public PostCardFrozenPayloadDataSecrets build() { + return new PostCardFrozenPayloadDataSecrets(cardNumber, cvc, nameOnCard, pin, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataStatus.java b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataStatus.java new file mode 100644 index 00000000..6b02e8b6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataStatus.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardFrozenPayloadDataStatus { + public static final PostCardFrozenPayloadDataStatus INVITED = + new PostCardFrozenPayloadDataStatus(Value.INVITED, "invited"); + + public static final PostCardFrozenPayloadDataStatus CANCELED = + new PostCardFrozenPayloadDataStatus(Value.CANCELED, "canceled"); + + public static final PostCardFrozenPayloadDataStatus DENIED = + new PostCardFrozenPayloadDataStatus(Value.DENIED, "denied"); + + public static final PostCardFrozenPayloadDataStatus FROZEN = + new PostCardFrozenPayloadDataStatus(Value.FROZEN, "frozen"); + + public static final PostCardFrozenPayloadDataStatus ACTIVE = + new PostCardFrozenPayloadDataStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + PostCardFrozenPayloadDataStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardFrozenPayloadDataStatus + && this.string.equals(((PostCardFrozenPayloadDataStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INVITED: + return visitor.visitInvited(); + case CANCELED: + return visitor.visitCanceled(); + case DENIED: + return visitor.visitDenied(); + case FROZEN: + return visitor.visitFrozen(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardFrozenPayloadDataStatus valueOf(String value) { + switch (value) { + case "invited": + return INVITED; + case "canceled": + return CANCELED; + case "denied": + return DENIED; + case "frozen": + return FROZEN; + case "active": + return ACTIVE; + default: + return new PostCardFrozenPayloadDataStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + FROZEN, + + CANCELED, + + INVITED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitFrozen(); + + T visitCanceled(); + + T visitInvited(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataType.java new file mode 100644 index 00000000..60e34679 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadDataType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardFrozenPayloadDataType { + public static final PostCardFrozenPayloadDataType PHYSICAL = + new PostCardFrozenPayloadDataType(Value.PHYSICAL, "physical"); + + public static final PostCardFrozenPayloadDataType VIRTUAL = + new PostCardFrozenPayloadDataType(Value.VIRTUAL, "virtual"); + + private final Value value; + + private final String string; + + PostCardFrozenPayloadDataType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardFrozenPayloadDataType + && this.string.equals(((PostCardFrozenPayloadDataType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PHYSICAL: + return visitor.visitPhysical(); + case VIRTUAL: + return visitor.visitVirtual(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardFrozenPayloadDataType valueOf(String value) { + switch (value) { + case "physical": + return PHYSICAL; + case "virtual": + return VIRTUAL; + default: + return new PostCardFrozenPayloadDataType(Value.UNKNOWN, value); + } + } + + public enum Value { + VIRTUAL, + + PHYSICAL, + + UNKNOWN + } + + public interface Visitor { + T visitVirtual(); + + T visitPhysical(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadType.java new file mode 100644 index 00000000..b0f044b3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardFrozenPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardFrozenPayloadType { + public static final PostCardFrozenPayloadType CARD_FROZEN = + new PostCardFrozenPayloadType(Value.CARD_FROZEN, "card.frozen"); + + private final Value value; + + private final String string; + + PostCardFrozenPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardFrozenPayloadType + && this.string.equals(((PostCardFrozenPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_FROZEN: + return visitor.visitCardFrozen(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardFrozenPayloadType valueOf(String value) { + switch (value) { + case "card.frozen": + return CARD_FROZEN; + default: + return new PostCardFrozenPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_FROZEN, + + UNKNOWN + } + + public interface Visitor { + T visitCardFrozen(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCompletedPayload.java b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCompletedPayload.java new file mode 100644 index 00000000..3316bb51 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCompletedPayload.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CardTransaction; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardTransactionCompletedPayload.Builder.class) +public final class PostCardTransactionCompletedPayload { + private final Optional accountId; + + private final PostCardTransactionCompletedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final CardTransaction data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostCardTransactionCompletedPayloadType type; + + private final Map additionalProperties; + + private PostCardTransactionCompletedPayload( + Optional accountId, + PostCardTransactionCompletedPayloadApiVersion apiVersion, + Optional apiVersionDate, + CardTransaction data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostCardTransactionCompletedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostCardTransactionCompletedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public CardTransaction getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostCardTransactionCompletedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardTransactionCompletedPayload + && equalTo((PostCardTransactionCompletedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardTransactionCompletedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostCardTransactionCompletedPayloadApiVersion apiVersion); + + Builder from(PostCardTransactionCompletedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull CardTransaction data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostCardTransactionCompletedPayloadType type); + } + + public interface _FinalStage { + PostCardTransactionCompletedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostCardTransactionCompletedPayloadApiVersion apiVersion; + + private CardTransaction data; + + private String id; + + private OffsetDateTime timestamp; + + private PostCardTransactionCompletedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardTransactionCompletedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostCardTransactionCompletedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull CardTransaction data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostCardTransactionCompletedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostCardTransactionCompletedPayload build() { + return new PostCardTransactionCompletedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCompletedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCompletedPayloadApiVersion.java new file mode 100644 index 00000000..9eed2898 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCompletedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardTransactionCompletedPayloadApiVersion { + public static final PostCardTransactionCompletedPayloadApiVersion V1 = + new PostCardTransactionCompletedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostCardTransactionCompletedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardTransactionCompletedPayloadApiVersion + && this.string.equals(((PostCardTransactionCompletedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardTransactionCompletedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostCardTransactionCompletedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCompletedPayloadType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCompletedPayloadType.java new file mode 100644 index 00000000..2f9471b2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCompletedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardTransactionCompletedPayloadType { + public static final PostCardTransactionCompletedPayloadType CARD_TRANSACTION_COMPLETED = + new PostCardTransactionCompletedPayloadType(Value.CARD_TRANSACTION_COMPLETED, "card_transaction.completed"); + + private final Value value; + + private final String string; + + PostCardTransactionCompletedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardTransactionCompletedPayloadType + && this.string.equals(((PostCardTransactionCompletedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_TRANSACTION_COMPLETED: + return visitor.visitCardTransactionCompleted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardTransactionCompletedPayloadType valueOf(String value) { + switch (value) { + case "card_transaction.completed": + return CARD_TRANSACTION_COMPLETED; + default: + return new PostCardTransactionCompletedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_TRANSACTION_COMPLETED, + + UNKNOWN + } + + public interface Visitor { + T visitCardTransactionCompleted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCreatedPayload.java b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCreatedPayload.java new file mode 100644 index 00000000..bd6e56c0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCreatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CardTransaction; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardTransactionCreatedPayload.Builder.class) +public final class PostCardTransactionCreatedPayload { + private final Optional accountId; + + private final PostCardTransactionCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final CardTransaction data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostCardTransactionCreatedPayloadType type; + + private final Map additionalProperties; + + private PostCardTransactionCreatedPayload( + Optional accountId, + PostCardTransactionCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + CardTransaction data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostCardTransactionCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostCardTransactionCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public CardTransaction getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostCardTransactionCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardTransactionCreatedPayload && equalTo((PostCardTransactionCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardTransactionCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostCardTransactionCreatedPayloadApiVersion apiVersion); + + Builder from(PostCardTransactionCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull CardTransaction data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostCardTransactionCreatedPayloadType type); + } + + public interface _FinalStage { + PostCardTransactionCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostCardTransactionCreatedPayloadApiVersion apiVersion; + + private CardTransaction data; + + private String id; + + private OffsetDateTime timestamp; + + private PostCardTransactionCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardTransactionCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostCardTransactionCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull CardTransaction data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostCardTransactionCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostCardTransactionCreatedPayload build() { + return new PostCardTransactionCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCreatedPayloadApiVersion.java new file mode 100644 index 00000000..4e734c78 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCreatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardTransactionCreatedPayloadApiVersion { + public static final PostCardTransactionCreatedPayloadApiVersion V1 = + new PostCardTransactionCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostCardTransactionCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardTransactionCreatedPayloadApiVersion + && this.string.equals(((PostCardTransactionCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardTransactionCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostCardTransactionCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCreatedPayloadType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCreatedPayloadType.java new file mode 100644 index 00000000..9b2f27e3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardTransactionCreatedPayloadType { + public static final PostCardTransactionCreatedPayloadType CARD_TRANSACTION_CREATED = + new PostCardTransactionCreatedPayloadType(Value.CARD_TRANSACTION_CREATED, "card_transaction.created"); + + private final Value value; + + private final String string; + + PostCardTransactionCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardTransactionCreatedPayloadType + && this.string.equals(((PostCardTransactionCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_TRANSACTION_CREATED: + return visitor.visitCardTransactionCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardTransactionCreatedPayloadType valueOf(String value) { + switch (value) { + case "card_transaction.created": + return CARD_TRANSACTION_CREATED; + default: + return new PostCardTransactionCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_TRANSACTION_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitCardTransactionCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionDeclinedPayload.java b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionDeclinedPayload.java new file mode 100644 index 00000000..469e35ce --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionDeclinedPayload.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CardTransaction; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardTransactionDeclinedPayload.Builder.class) +public final class PostCardTransactionDeclinedPayload { + private final Optional accountId; + + private final PostCardTransactionDeclinedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final CardTransaction data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostCardTransactionDeclinedPayloadType type; + + private final Map additionalProperties; + + private PostCardTransactionDeclinedPayload( + Optional accountId, + PostCardTransactionDeclinedPayloadApiVersion apiVersion, + Optional apiVersionDate, + CardTransaction data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostCardTransactionDeclinedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostCardTransactionDeclinedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public CardTransaction getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostCardTransactionDeclinedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardTransactionDeclinedPayload + && equalTo((PostCardTransactionDeclinedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardTransactionDeclinedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostCardTransactionDeclinedPayloadApiVersion apiVersion); + + Builder from(PostCardTransactionDeclinedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull CardTransaction data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostCardTransactionDeclinedPayloadType type); + } + + public interface _FinalStage { + PostCardTransactionDeclinedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostCardTransactionDeclinedPayloadApiVersion apiVersion; + + private CardTransaction data; + + private String id; + + private OffsetDateTime timestamp; + + private PostCardTransactionDeclinedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardTransactionDeclinedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostCardTransactionDeclinedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull CardTransaction data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostCardTransactionDeclinedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostCardTransactionDeclinedPayload build() { + return new PostCardTransactionDeclinedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionDeclinedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionDeclinedPayloadApiVersion.java new file mode 100644 index 00000000..f5d154a0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionDeclinedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardTransactionDeclinedPayloadApiVersion { + public static final PostCardTransactionDeclinedPayloadApiVersion V1 = + new PostCardTransactionDeclinedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostCardTransactionDeclinedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardTransactionDeclinedPayloadApiVersion + && this.string.equals(((PostCardTransactionDeclinedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardTransactionDeclinedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostCardTransactionDeclinedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionDeclinedPayloadType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionDeclinedPayloadType.java new file mode 100644 index 00000000..20bf5de8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionDeclinedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardTransactionDeclinedPayloadType { + public static final PostCardTransactionDeclinedPayloadType CARD_TRANSACTION_DECLINED = + new PostCardTransactionDeclinedPayloadType(Value.CARD_TRANSACTION_DECLINED, "card_transaction.declined"); + + private final Value value; + + private final String string; + + PostCardTransactionDeclinedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardTransactionDeclinedPayloadType + && this.string.equals(((PostCardTransactionDeclinedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_TRANSACTION_DECLINED: + return visitor.visitCardTransactionDeclined(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardTransactionDeclinedPayloadType valueOf(String value) { + switch (value) { + case "card_transaction.declined": + return CARD_TRANSACTION_DECLINED; + default: + return new PostCardTransactionDeclinedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_TRANSACTION_DECLINED, + + UNKNOWN + } + + public interface Visitor { + T visitCardTransactionDeclined(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionReversedPayload.java b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionReversedPayload.java new file mode 100644 index 00000000..cfaa9b74 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionReversedPayload.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CardTransaction; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardTransactionReversedPayload.Builder.class) +public final class PostCardTransactionReversedPayload { + private final Optional accountId; + + private final PostCardTransactionReversedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final CardTransaction data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostCardTransactionReversedPayloadType type; + + private final Map additionalProperties; + + private PostCardTransactionReversedPayload( + Optional accountId, + PostCardTransactionReversedPayloadApiVersion apiVersion, + Optional apiVersionDate, + CardTransaction data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostCardTransactionReversedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostCardTransactionReversedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public CardTransaction getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostCardTransactionReversedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardTransactionReversedPayload + && equalTo((PostCardTransactionReversedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardTransactionReversedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostCardTransactionReversedPayloadApiVersion apiVersion); + + Builder from(PostCardTransactionReversedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull CardTransaction data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostCardTransactionReversedPayloadType type); + } + + public interface _FinalStage { + PostCardTransactionReversedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostCardTransactionReversedPayloadApiVersion apiVersion; + + private CardTransaction data; + + private String id; + + private OffsetDateTime timestamp; + + private PostCardTransactionReversedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardTransactionReversedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostCardTransactionReversedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull CardTransaction data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostCardTransactionReversedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostCardTransactionReversedPayload build() { + return new PostCardTransactionReversedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionReversedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionReversedPayloadApiVersion.java new file mode 100644 index 00000000..1a666fa3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionReversedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardTransactionReversedPayloadApiVersion { + public static final PostCardTransactionReversedPayloadApiVersion V1 = + new PostCardTransactionReversedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostCardTransactionReversedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardTransactionReversedPayloadApiVersion + && this.string.equals(((PostCardTransactionReversedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardTransactionReversedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostCardTransactionReversedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionReversedPayloadType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionReversedPayloadType.java new file mode 100644 index 00000000..87dca187 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionReversedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardTransactionReversedPayloadType { + public static final PostCardTransactionReversedPayloadType CARD_TRANSACTION_REVERSED = + new PostCardTransactionReversedPayloadType(Value.CARD_TRANSACTION_REVERSED, "card_transaction.reversed"); + + private final Value value; + + private final String string; + + PostCardTransactionReversedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardTransactionReversedPayloadType + && this.string.equals(((PostCardTransactionReversedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_TRANSACTION_REVERSED: + return visitor.visitCardTransactionReversed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardTransactionReversedPayloadType valueOf(String value) { + switch (value) { + case "card_transaction.reversed": + return CARD_TRANSACTION_REVERSED; + default: + return new PostCardTransactionReversedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_TRANSACTION_REVERSED, + + UNKNOWN + } + + public interface Visitor { + T visitCardTransactionReversed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionUpdatedPayload.java b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionUpdatedPayload.java new file mode 100644 index 00000000..aa13d95e --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionUpdatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CardTransaction; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardTransactionUpdatedPayload.Builder.class) +public final class PostCardTransactionUpdatedPayload { + private final Optional accountId; + + private final PostCardTransactionUpdatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final CardTransaction data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostCardTransactionUpdatedPayloadType type; + + private final Map additionalProperties; + + private PostCardTransactionUpdatedPayload( + Optional accountId, + PostCardTransactionUpdatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + CardTransaction data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostCardTransactionUpdatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostCardTransactionUpdatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public CardTransaction getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostCardTransactionUpdatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardTransactionUpdatedPayload && equalTo((PostCardTransactionUpdatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardTransactionUpdatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostCardTransactionUpdatedPayloadApiVersion apiVersion); + + Builder from(PostCardTransactionUpdatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull CardTransaction data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostCardTransactionUpdatedPayloadType type); + } + + public interface _FinalStage { + PostCardTransactionUpdatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostCardTransactionUpdatedPayloadApiVersion apiVersion; + + private CardTransaction data; + + private String id; + + private OffsetDateTime timestamp; + + private PostCardTransactionUpdatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardTransactionUpdatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostCardTransactionUpdatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull CardTransaction data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostCardTransactionUpdatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostCardTransactionUpdatedPayload build() { + return new PostCardTransactionUpdatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionUpdatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionUpdatedPayloadApiVersion.java new file mode 100644 index 00000000..9fa5da87 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionUpdatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardTransactionUpdatedPayloadApiVersion { + public static final PostCardTransactionUpdatedPayloadApiVersion V1 = + new PostCardTransactionUpdatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostCardTransactionUpdatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardTransactionUpdatedPayloadApiVersion + && this.string.equals(((PostCardTransactionUpdatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardTransactionUpdatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostCardTransactionUpdatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionUpdatedPayloadType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionUpdatedPayloadType.java new file mode 100644 index 00000000..4e26808b --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardTransactionUpdatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardTransactionUpdatedPayloadType { + public static final PostCardTransactionUpdatedPayloadType CARD_TRANSACTION_UPDATED = + new PostCardTransactionUpdatedPayloadType(Value.CARD_TRANSACTION_UPDATED, "card_transaction.updated"); + + private final Value value; + + private final String string; + + PostCardTransactionUpdatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardTransactionUpdatedPayloadType + && this.string.equals(((PostCardTransactionUpdatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_TRANSACTION_UPDATED: + return visitor.visitCardTransactionUpdated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardTransactionUpdatedPayloadType valueOf(String value) { + switch (value) { + case "card_transaction.updated": + return CARD_TRANSACTION_UPDATED; + default: + return new PostCardTransactionUpdatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_TRANSACTION_UPDATED, + + UNKNOWN + } + + public interface Visitor { + T visitCardTransactionUpdated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayload.java b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayload.java new file mode 100644 index 00000000..40152a2a --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayload.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardUpdatedPayload.Builder.class) +public final class PostCardUpdatedPayload { + private final Optional accountId; + + private final PostCardUpdatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostCardUpdatedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostCardUpdatedPayloadType type; + + private final Map additionalProperties; + + private PostCardUpdatedPayload( + Optional accountId, + PostCardUpdatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostCardUpdatedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostCardUpdatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostCardUpdatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PostCardUpdatedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostCardUpdatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardUpdatedPayload && equalTo((PostCardUpdatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardUpdatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostCardUpdatedPayloadApiVersion apiVersion); + + Builder from(PostCardUpdatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PostCardUpdatedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostCardUpdatedPayloadType type); + } + + public interface _FinalStage { + PostCardUpdatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostCardUpdatedPayloadApiVersion apiVersion; + + private PostCardUpdatedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostCardUpdatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardUpdatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostCardUpdatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostCardUpdatedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostCardUpdatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostCardUpdatedPayload build() { + return new PostCardUpdatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadApiVersion.java new file mode 100644 index 00000000..3e576b58 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardUpdatedPayloadApiVersion { + public static final PostCardUpdatedPayloadApiVersion V1 = new PostCardUpdatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostCardUpdatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardUpdatedPayloadApiVersion + && this.string.equals(((PostCardUpdatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardUpdatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostCardUpdatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadData.java b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadData.java new file mode 100644 index 00000000..2079f627 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadData.java @@ -0,0 +1,1102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardUpdatedPayloadData.Builder.class) +public final class PostCardUpdatedPayloadData { + private final Optional billing; + + private final Optional canceledAt; + + private final Optional createdAt; + + private final Optional expirationMonth; + + private final Optional expirationYear; + + private final String id; + + private final Optional last4; + + private final Optional limit; + + private final Optional name; + + private final PostCardUpdatedPayloadDataObject object; + + private final Optional secrets; + + private final Optional spentLastMonth; + + private final Optional status; + + private final Optional type; + + private final Optional userId; + + private final Map additionalProperties; + + private PostCardUpdatedPayloadData( + Optional billing, + Optional canceledAt, + Optional createdAt, + Optional expirationMonth, + Optional expirationYear, + String id, + Optional last4, + Optional limit, + Optional name, + PostCardUpdatedPayloadDataObject object, + Optional secrets, + Optional spentLastMonth, + Optional status, + Optional type, + Optional userId, + Map additionalProperties) { + this.billing = billing; + this.canceledAt = canceledAt; + this.createdAt = createdAt; + this.expirationMonth = expirationMonth; + this.expirationYear = expirationYear; + this.id = id; + this.last4 = last4; + this.limit = limit; + this.name = name; + this.object = object; + this.secrets = secrets; + this.spentLastMonth = spentLastMonth; + this.status = status; + this.type = type; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The billing address. + */ + @JsonIgnore + public Optional getBilling() { + if (billing == null) { + return Optional.empty(); + } + return billing; + } + + /** + * @return When the card was canceled. + */ + @JsonIgnore + public Optional getCanceledAt() { + if (canceledAt == null) { + return Optional.empty(); + } + return canceledAt; + } + + /** + * @return When the card was created. + */ + @JsonIgnore + public Optional getCreatedAt() { + if (createdAt == null) { + return Optional.empty(); + } + return createdAt; + } + + /** + * @return Card expiration month. + */ + @JsonIgnore + public Optional getExpirationMonth() { + if (expirationMonth == null) { + return Optional.empty(); + } + return expirationMonth; + } + + /** + * @return Card expiration year. + */ + @JsonIgnore + public Optional getExpirationYear() { + if (expirationYear == null) { + return Optional.empty(); + } + return expirationYear; + } + + /** + * @return Card ID, prefixed icrd_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Last four digits of the card number. null for pending invitation cards. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + /** + * @return The spending limit configuration. + */ + @JsonIgnore + public Optional getLimit() { + if (limit == null) { + return Optional.empty(); + } + return limit; + } + + /** + * @return Card display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("object") + public PostCardUpdatedPayloadDataObject getObject() { + return object; + } + + /** + * @return Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved. + */ + @JsonIgnore + public Optional getSecrets() { + if (secrets == null) { + return Optional.empty(); + } + return secrets; + } + + /** + * @return Total spend in the last 30 days, in cents. + */ + @JsonIgnore + public Optional getSpentLastMonth() { + if (spentLastMonth == null) { + return Optional.empty(); + } + return spentLastMonth; + } + + /** + * @return The card status. denied means the issuer declined the cardholder, so the card will never be issued. + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The card type. + */ + @JsonIgnore + public Optional getType() { + if (type == null) { + return Optional.empty(); + } + return type; + } + + /** + * @return Cardholder user ID, prefixed user_, when assigned. + */ + @JsonIgnore + public Optional getUserId() { + if (userId == null) { + return Optional.empty(); + } + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing") + private Optional _getBilling() { + return billing; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("canceled_at") + private Optional _getCanceledAt() { + return canceledAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_at") + private Optional _getCreatedAt() { + return createdAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_month") + private Optional _getExpirationMonth() { + return expirationMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_year") + private Optional _getExpirationYear() { + return expirationYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("limit") + private Optional _getLimit() { + return limit; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("secrets") + private Optional _getSecrets() { + return secrets; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("spent_last_month") + private Optional _getSpentLastMonth() { + return spentLastMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("type") + private Optional _getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_id") + private Optional _getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardUpdatedPayloadData && equalTo((PostCardUpdatedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardUpdatedPayloadData other) { + return billing.equals(other.billing) + && canceledAt.equals(other.canceledAt) + && createdAt.equals(other.createdAt) + && expirationMonth.equals(other.expirationMonth) + && expirationYear.equals(other.expirationYear) + && id.equals(other.id) + && last4.equals(other.last4) + && limit.equals(other.limit) + && name.equals(other.name) + && object.equals(other.object) + && secrets.equals(other.secrets) + && spentLastMonth.equals(other.spentLastMonth) + && status.equals(other.status) + && type.equals(other.type) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billing, + this.canceledAt, + this.createdAt, + this.expirationMonth, + this.expirationYear, + this.id, + this.last4, + this.limit, + this.name, + this.object, + this.secrets, + this.spentLastMonth, + this.status, + this.type, + this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Card ID, prefixed icrd_.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(PostCardUpdatedPayloadData other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull PostCardUpdatedPayloadDataObject object); + } + + public interface _FinalStage { + PostCardUpdatedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The billing address.

+ */ + _FinalStage billing(Optional billing); + + _FinalStage billing(PostCardUpdatedPayloadDataBilling billing); + + _FinalStage billing(Nullable billing); + + /** + *

When the card was canceled.

+ */ + _FinalStage canceledAt(Optional canceledAt); + + _FinalStage canceledAt(OffsetDateTime canceledAt); + + _FinalStage canceledAt(Nullable canceledAt); + + /** + *

When the card was created.

+ */ + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage createdAt(Nullable createdAt); + + /** + *

Card expiration month.

+ */ + _FinalStage expirationMonth(Optional expirationMonth); + + _FinalStage expirationMonth(String expirationMonth); + + _FinalStage expirationMonth(Nullable expirationMonth); + + /** + *

Card expiration year.

+ */ + _FinalStage expirationYear(Optional expirationYear); + + _FinalStage expirationYear(String expirationYear); + + _FinalStage expirationYear(Nullable expirationYear); + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + + /** + *

The spending limit configuration.

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(PostCardUpdatedPayloadDataLimit limit); + + _FinalStage limit(Nullable limit); + + /** + *

Card display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + _FinalStage secrets(Optional secrets); + + _FinalStage secrets(PostCardUpdatedPayloadDataSecrets secrets); + + _FinalStage secrets(Nullable secrets); + + /** + *

Total spend in the last 30 days, in cents.

+ */ + _FinalStage spentLastMonth(Optional spentLastMonth); + + _FinalStage spentLastMonth(Integer spentLastMonth); + + _FinalStage spentLastMonth(Nullable spentLastMonth); + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(PostCardUpdatedPayloadDataStatus status); + + _FinalStage status(Nullable status); + + /** + *

The card type.

+ */ + _FinalStage type(Optional type); + + _FinalStage type(PostCardUpdatedPayloadDataType type); + + _FinalStage type(Nullable type); + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + + _FinalStage userId(Nullable userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private PostCardUpdatedPayloadDataObject object; + + private Optional userId = Optional.empty(); + + private Optional type = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional spentLastMonth = Optional.empty(); + + private Optional secrets = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional last4 = Optional.empty(); + + private Optional expirationYear = Optional.empty(); + + private Optional expirationMonth = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional canceledAt = Optional.empty(); + + private Optional billing = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardUpdatedPayloadData other) { + billing(other.getBilling()); + canceledAt(other.getCanceledAt()); + createdAt(other.getCreatedAt()); + expirationMonth(other.getExpirationMonth()); + expirationYear(other.getExpirationYear()); + id(other.getId()); + last4(other.getLast4()); + limit(other.getLimit()); + name(other.getName()); + object(other.getObject()); + secrets(other.getSecrets()); + spentLastMonth(other.getSpentLastMonth()); + status(other.getStatus()); + type(other.getType()); + userId(other.getUserId()); + return this; + } + + /** + *

Card ID, prefixed icrd_.

+ *

Card ID, prefixed icrd_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull PostCardUpdatedPayloadDataObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(Nullable userId) { + if (userId.isNull()) { + this.userId = null; + } else if (userId.isEmpty()) { + this.userId = Optional.empty(); + } else { + this.userId = Optional.of(userId.get()); + } + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(Nullable type) { + if (type.isNull()) { + this.type = null; + } else if (type.isEmpty()) { + this.type = Optional.empty(); + } else { + this.type = Optional.of(type.get()); + } + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(PostCardUpdatedPayloadDataType type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

The card type.

+ */ + @java.lang.Override + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public _FinalStage type(Optional type) { + this.type = type; + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(PostCardUpdatedPayloadDataStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Nullable spentLastMonth) { + if (spentLastMonth.isNull()) { + this.spentLastMonth = null; + } else if (spentLastMonth.isEmpty()) { + this.spentLastMonth = Optional.empty(); + } else { + this.spentLastMonth = Optional.of(spentLastMonth.get()); + } + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Integer spentLastMonth) { + this.spentLastMonth = Optional.ofNullable(spentLastMonth); + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ */ + @java.lang.Override + @JsonSetter(value = "spent_last_month", nulls = Nulls.SKIP) + public _FinalStage spentLastMonth(Optional spentLastMonth) { + this.spentLastMonth = spentLastMonth; + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(Nullable secrets) { + if (secrets.isNull()) { + this.secrets = null; + } else if (secrets.isEmpty()) { + this.secrets = Optional.empty(); + } else { + this.secrets = Optional.of(secrets.get()); + } + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(PostCardUpdatedPayloadDataSecrets secrets) { + this.secrets = Optional.ofNullable(secrets); + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + @java.lang.Override + @JsonSetter(value = "secrets", nulls = Nulls.SKIP) + public _FinalStage secrets(Optional secrets) { + this.secrets = secrets; + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Card display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(Nullable limit) { + if (limit.isNull()) { + this.limit = null; + } else if (limit.isEmpty()) { + this.limit = Optional.empty(); + } else { + this.limit = Optional.of(limit.get()); + } + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(PostCardUpdatedPayloadDataLimit limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

The spending limit configuration.

+ */ + @java.lang.Override + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public _FinalStage limit(Optional limit) { + this.limit = limit; + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(Nullable expirationYear) { + if (expirationYear.isNull()) { + this.expirationYear = null; + } else if (expirationYear.isEmpty()) { + this.expirationYear = Optional.empty(); + } else { + this.expirationYear = Optional.of(expirationYear.get()); + } + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(String expirationYear) { + this.expirationYear = Optional.ofNullable(expirationYear); + return this; + } + + /** + *

Card expiration year.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_year", nulls = Nulls.SKIP) + public _FinalStage expirationYear(Optional expirationYear) { + this.expirationYear = expirationYear; + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(Nullable expirationMonth) { + if (expirationMonth.isNull()) { + this.expirationMonth = null; + } else if (expirationMonth.isEmpty()) { + this.expirationMonth = Optional.empty(); + } else { + this.expirationMonth = Optional.of(expirationMonth.get()); + } + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(String expirationMonth) { + this.expirationMonth = Optional.ofNullable(expirationMonth); + return this; + } + + /** + *

Card expiration month.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_month", nulls = Nulls.SKIP) + public _FinalStage expirationMonth(Optional expirationMonth) { + this.expirationMonth = expirationMonth; + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(Nullable createdAt) { + if (createdAt.isNull()) { + this.createdAt = null; + } else if (createdAt.isEmpty()) { + this.createdAt = Optional.empty(); + } else { + this.createdAt = Optional.of(createdAt.get()); + } + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

When the card was created.

+ */ + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(Nullable canceledAt) { + if (canceledAt.isNull()) { + this.canceledAt = null; + } else if (canceledAt.isEmpty()) { + this.canceledAt = Optional.empty(); + } else { + this.canceledAt = Optional.of(canceledAt.get()); + } + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(OffsetDateTime canceledAt) { + this.canceledAt = Optional.ofNullable(canceledAt); + return this; + } + + /** + *

When the card was canceled.

+ */ + @java.lang.Override + @JsonSetter(value = "canceled_at", nulls = Nulls.SKIP) + public _FinalStage canceledAt(Optional canceledAt) { + this.canceledAt = canceledAt; + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(Nullable billing) { + if (billing.isNull()) { + this.billing = null; + } else if (billing.isEmpty()) { + this.billing = Optional.empty(); + } else { + this.billing = Optional.of(billing.get()); + } + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(PostCardUpdatedPayloadDataBilling billing) { + this.billing = Optional.ofNullable(billing); + return this; + } + + /** + *

The billing address.

+ */ + @java.lang.Override + @JsonSetter(value = "billing", nulls = Nulls.SKIP) + public _FinalStage billing(Optional billing) { + this.billing = billing; + return this; + } + + @java.lang.Override + public PostCardUpdatedPayloadData build() { + return new PostCardUpdatedPayloadData( + billing, + canceledAt, + createdAt, + expirationMonth, + expirationYear, + id, + last4, + limit, + name, + object, + secrets, + spentLastMonth, + status, + type, + userId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataBilling.java b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataBilling.java new file mode 100644 index 00000000..b7529b4e --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataBilling.java @@ -0,0 +1,387 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardUpdatedPayloadDataBilling.Builder.class) +public final class PostCardUpdatedPayloadDataBilling { + private final Optional city; + + private final Optional countryCode; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional region; + + private final Map additionalProperties; + + private PostCardUpdatedPayloadDataBilling( + Optional city, + Optional countryCode, + Optional line1, + Optional line2, + Optional postalCode, + Optional region, + Map additionalProperties) { + this.city = city; + this.countryCode = countryCode; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.region = region; + this.additionalProperties = additionalProperties; + } + + /** + * @return Billing city. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Billing country code. + */ + @JsonIgnore + public Optional getCountryCode() { + if (countryCode == null) { + return Optional.empty(); + } + return countryCode; + } + + /** + * @return Street address line 1. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return Street address line 2. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Billing postal code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return Billing region or state. + */ + @JsonIgnore + public Optional getRegion() { + if (region == null) { + return Optional.empty(); + } + return region; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country_code") + private Optional _getCountryCode() { + return countryCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("region") + private Optional _getRegion() { + return region; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardUpdatedPayloadDataBilling && equalTo((PostCardUpdatedPayloadDataBilling) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardUpdatedPayloadDataBilling other) { + return city.equals(other.city) + && countryCode.equals(other.countryCode) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && region.equals(other.region); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.countryCode, this.line1, this.line2, this.postalCode, this.region); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional countryCode = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional region = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PostCardUpdatedPayloadDataBilling other) { + city(other.getCity()); + countryCode(other.getCountryCode()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + region(other.getRegion()); + return this; + } + + /** + *

Billing city.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Billing country code.

+ */ + @JsonSetter(value = "country_code", nulls = Nulls.SKIP) + public Builder countryCode(Optional countryCode) { + this.countryCode = countryCode; + return this; + } + + public Builder countryCode(String countryCode) { + this.countryCode = Optional.ofNullable(countryCode); + return this; + } + + public Builder countryCode(Nullable countryCode) { + if (countryCode.isNull()) { + this.countryCode = null; + } else if (countryCode.isEmpty()) { + this.countryCode = Optional.empty(); + } else { + this.countryCode = Optional.of(countryCode.get()); + } + return this; + } + + /** + *

Street address line 1.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

Street address line 2.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Billing postal code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

Billing region or state.

+ */ + @JsonSetter(value = "region", nulls = Nulls.SKIP) + public Builder region(Optional region) { + this.region = region; + return this; + } + + public Builder region(String region) { + this.region = Optional.ofNullable(region); + return this; + } + + public Builder region(Nullable region) { + if (region.isNull()) { + this.region = null; + } else if (region.isEmpty()) { + this.region = Optional.empty(); + } else { + this.region = Optional.of(region.get()); + } + return this; + } + + public PostCardUpdatedPayloadDataBilling build() { + return new PostCardUpdatedPayloadDataBilling( + city, countryCode, line1, line2, postalCode, region, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataLimit.java b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataLimit.java new file mode 100644 index 00000000..5181bfc4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataLimit.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardUpdatedPayloadDataLimit.Builder.class) +public final class PostCardUpdatedPayloadDataLimit { + private final double amount; + + private final PostCardUpdatedPayloadDataLimitFrequency frequency; + + private final Map additionalProperties; + + private PostCardUpdatedPayloadDataLimit( + double amount, + PostCardUpdatedPayloadDataLimitFrequency frequency, + Map additionalProperties) { + this.amount = amount; + this.frequency = frequency; + this.additionalProperties = additionalProperties; + } + + /** + * @return The limit amount in dollars. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports. + */ + @JsonProperty("frequency") + public PostCardUpdatedPayloadDataLimitFrequency getFrequency() { + return frequency; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardUpdatedPayloadDataLimit && equalTo((PostCardUpdatedPayloadDataLimit) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardUpdatedPayloadDataLimit other) { + return amount == other.amount && frequency.equals(other.frequency); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.frequency); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The limit amount in dollars.

+ */ + FrequencyStage amount(double amount); + + Builder from(PostCardUpdatedPayloadDataLimit other); + } + + public interface FrequencyStage { + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ */ + _FinalStage frequency(@NotNull PostCardUpdatedPayloadDataLimitFrequency frequency); + } + + public interface _FinalStage { + PostCardUpdatedPayloadDataLimit build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, FrequencyStage, _FinalStage { + private double amount; + + private PostCardUpdatedPayloadDataLimitFrequency frequency; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardUpdatedPayloadDataLimit other) { + amount(other.getAmount()); + frequency(other.getFrequency()); + return this; + } + + /** + *

The limit amount in dollars.

+ *

The limit amount in dollars.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public FrequencyStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("frequency") + public _FinalStage frequency(@NotNull PostCardUpdatedPayloadDataLimitFrequency frequency) { + this.frequency = Objects.requireNonNull(frequency, "frequency must not be null"); + return this; + } + + @java.lang.Override + public PostCardUpdatedPayloadDataLimit build() { + return new PostCardUpdatedPayloadDataLimit(amount, frequency, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataLimitFrequency.java b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataLimitFrequency.java new file mode 100644 index 00000000..503eb2d0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataLimitFrequency.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardUpdatedPayloadDataLimitFrequency { + public static final PostCardUpdatedPayloadDataLimitFrequency PER_TRANSACTION = + new PostCardUpdatedPayloadDataLimitFrequency(Value.PER_TRANSACTION, "per_transaction"); + + public static final PostCardUpdatedPayloadDataLimitFrequency ONE_TIME = + new PostCardUpdatedPayloadDataLimitFrequency(Value.ONE_TIME, "one_time"); + + public static final PostCardUpdatedPayloadDataLimitFrequency DAILY = + new PostCardUpdatedPayloadDataLimitFrequency(Value.DAILY, "daily"); + + public static final PostCardUpdatedPayloadDataLimitFrequency WEEKLY = + new PostCardUpdatedPayloadDataLimitFrequency(Value.WEEKLY, "weekly"); + + public static final PostCardUpdatedPayloadDataLimitFrequency MONTHLY = + new PostCardUpdatedPayloadDataLimitFrequency(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + PostCardUpdatedPayloadDataLimitFrequency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardUpdatedPayloadDataLimitFrequency + && this.string.equals(((PostCardUpdatedPayloadDataLimitFrequency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PER_TRANSACTION: + return visitor.visitPerTransaction(); + case ONE_TIME: + return visitor.visitOneTime(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardUpdatedPayloadDataLimitFrequency valueOf(String value) { + switch (value) { + case "per_transaction": + return PER_TRANSACTION; + case "one_time": + return ONE_TIME; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new PostCardUpdatedPayloadDataLimitFrequency(Value.UNKNOWN, value); + } + } + + public enum Value { + DAILY, + + WEEKLY, + + MONTHLY, + + ONE_TIME, + + PER_TRANSACTION, + + UNKNOWN + } + + public interface Visitor { + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitOneTime(); + + T visitPerTransaction(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataObject.java b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataObject.java new file mode 100644 index 00000000..d56235c2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardUpdatedPayloadDataObject { + public static final PostCardUpdatedPayloadDataObject CARD = + new PostCardUpdatedPayloadDataObject(Value.CARD, "card"); + + private final Value value; + + private final String string; + + PostCardUpdatedPayloadDataObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardUpdatedPayloadDataObject + && this.string.equals(((PostCardUpdatedPayloadDataObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD: + return visitor.visitCard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardUpdatedPayloadDataObject valueOf(String value) { + switch (value) { + case "card": + return CARD; + default: + return new PostCardUpdatedPayloadDataObject(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD, + + UNKNOWN + } + + public interface Visitor { + T visitCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataSecrets.java b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataSecrets.java new file mode 100644 index 00000000..d5d1eecb --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataSecrets.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCardUpdatedPayloadDataSecrets.Builder.class) +public final class PostCardUpdatedPayloadDataSecrets { + private final String cardNumber; + + private final String cvc; + + private final Optional nameOnCard; + + private final Optional pin; + + private final Map additionalProperties; + + private PostCardUpdatedPayloadDataSecrets( + String cardNumber, + String cvc, + Optional nameOnCard, + Optional pin, + Map additionalProperties) { + this.cardNumber = cardNumber; + this.cvc = cvc; + this.nameOnCard = nameOnCard; + this.pin = pin; + this.additionalProperties = additionalProperties; + } + + /** + * @return Full card number. + */ + @JsonProperty("card_number") + public String getCardNumber() { + return cardNumber; + } + + /** + * @return Card verification code. + */ + @JsonProperty("cvc") + public String getCvc() { + return cvc; + } + + /** + * @return Cardholder name printed on the card. + */ + @JsonIgnore + public Optional getNameOnCard() { + if (nameOnCard == null) { + return Optional.empty(); + } + return nameOnCard; + } + + /** + * @return The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys. + */ + @JsonIgnore + public Optional getPin() { + if (pin == null) { + return Optional.empty(); + } + return pin; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name_on_card") + private Optional _getNameOnCard() { + return nameOnCard; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("pin") + private Optional _getPin() { + return pin; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCardUpdatedPayloadDataSecrets && equalTo((PostCardUpdatedPayloadDataSecrets) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCardUpdatedPayloadDataSecrets other) { + return cardNumber.equals(other.cardNumber) + && cvc.equals(other.cvc) + && nameOnCard.equals(other.nameOnCard) + && pin.equals(other.pin); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cardNumber, this.cvc, this.nameOnCard, this.pin); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardNumberStage builder() { + return new Builder(); + } + + public interface CardNumberStage { + /** + *

Full card number.

+ */ + CvcStage cardNumber(@NotNull String cardNumber); + + Builder from(PostCardUpdatedPayloadDataSecrets other); + } + + public interface CvcStage { + /** + *

Card verification code.

+ */ + _FinalStage cvc(@NotNull String cvc); + } + + public interface _FinalStage { + PostCardUpdatedPayloadDataSecrets build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Cardholder name printed on the card.

+ */ + _FinalStage nameOnCard(Optional nameOnCard); + + _FinalStage nameOnCard(String nameOnCard); + + _FinalStage nameOnCard(Nullable nameOnCard); + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + _FinalStage pin(Optional pin); + + _FinalStage pin(String pin); + + _FinalStage pin(Nullable pin); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardNumberStage, CvcStage, _FinalStage { + private String cardNumber; + + private String cvc; + + private Optional pin = Optional.empty(); + + private Optional nameOnCard = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCardUpdatedPayloadDataSecrets other) { + cardNumber(other.getCardNumber()); + cvc(other.getCvc()); + nameOnCard(other.getNameOnCard()); + pin(other.getPin()); + return this; + } + + /** + *

Full card number.

+ *

Full card number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card_number") + public CvcStage cardNumber(@NotNull String cardNumber) { + this.cardNumber = Objects.requireNonNull(cardNumber, "cardNumber must not be null"); + return this; + } + + /** + *

Card verification code.

+ *

Card verification code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cvc") + public _FinalStage cvc(@NotNull String cvc) { + this.cvc = Objects.requireNonNull(cvc, "cvc must not be null"); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(Nullable pin) { + if (pin.isNull()) { + this.pin = null; + } else if (pin.isEmpty()) { + this.pin = Optional.empty(); + } else { + this.pin = Optional.of(pin.get()); + } + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(String pin) { + this.pin = Optional.ofNullable(pin); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + @java.lang.Override + @JsonSetter(value = "pin", nulls = Nulls.SKIP) + public _FinalStage pin(Optional pin) { + this.pin = pin; + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(Nullable nameOnCard) { + if (nameOnCard.isNull()) { + this.nameOnCard = null; + } else if (nameOnCard.isEmpty()) { + this.nameOnCard = Optional.empty(); + } else { + this.nameOnCard = Optional.of(nameOnCard.get()); + } + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(String nameOnCard) { + this.nameOnCard = Optional.ofNullable(nameOnCard); + return this; + } + + /** + *

Cardholder name printed on the card.

+ */ + @java.lang.Override + @JsonSetter(value = "name_on_card", nulls = Nulls.SKIP) + public _FinalStage nameOnCard(Optional nameOnCard) { + this.nameOnCard = nameOnCard; + return this; + } + + @java.lang.Override + public PostCardUpdatedPayloadDataSecrets build() { + return new PostCardUpdatedPayloadDataSecrets(cardNumber, cvc, nameOnCard, pin, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataStatus.java b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataStatus.java new file mode 100644 index 00000000..c9d72677 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataStatus.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardUpdatedPayloadDataStatus { + public static final PostCardUpdatedPayloadDataStatus INVITED = + new PostCardUpdatedPayloadDataStatus(Value.INVITED, "invited"); + + public static final PostCardUpdatedPayloadDataStatus CANCELED = + new PostCardUpdatedPayloadDataStatus(Value.CANCELED, "canceled"); + + public static final PostCardUpdatedPayloadDataStatus DENIED = + new PostCardUpdatedPayloadDataStatus(Value.DENIED, "denied"); + + public static final PostCardUpdatedPayloadDataStatus FROZEN = + new PostCardUpdatedPayloadDataStatus(Value.FROZEN, "frozen"); + + public static final PostCardUpdatedPayloadDataStatus ACTIVE = + new PostCardUpdatedPayloadDataStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + PostCardUpdatedPayloadDataStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardUpdatedPayloadDataStatus + && this.string.equals(((PostCardUpdatedPayloadDataStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INVITED: + return visitor.visitInvited(); + case CANCELED: + return visitor.visitCanceled(); + case DENIED: + return visitor.visitDenied(); + case FROZEN: + return visitor.visitFrozen(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardUpdatedPayloadDataStatus valueOf(String value) { + switch (value) { + case "invited": + return INVITED; + case "canceled": + return CANCELED; + case "denied": + return DENIED; + case "frozen": + return FROZEN; + case "active": + return ACTIVE; + default: + return new PostCardUpdatedPayloadDataStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + FROZEN, + + CANCELED, + + INVITED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitFrozen(); + + T visitCanceled(); + + T visitInvited(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataType.java new file mode 100644 index 00000000..5005b98d --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadDataType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardUpdatedPayloadDataType { + public static final PostCardUpdatedPayloadDataType PHYSICAL = + new PostCardUpdatedPayloadDataType(Value.PHYSICAL, "physical"); + + public static final PostCardUpdatedPayloadDataType VIRTUAL = + new PostCardUpdatedPayloadDataType(Value.VIRTUAL, "virtual"); + + private final Value value; + + private final String string; + + PostCardUpdatedPayloadDataType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardUpdatedPayloadDataType + && this.string.equals(((PostCardUpdatedPayloadDataType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PHYSICAL: + return visitor.visitPhysical(); + case VIRTUAL: + return visitor.visitVirtual(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardUpdatedPayloadDataType valueOf(String value) { + switch (value) { + case "physical": + return PHYSICAL; + case "virtual": + return VIRTUAL; + default: + return new PostCardUpdatedPayloadDataType(Value.UNKNOWN, value); + } + } + + public enum Value { + VIRTUAL, + + PHYSICAL, + + UNKNOWN + } + + public interface Visitor { + T visitVirtual(); + + T visitPhysical(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadType.java b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadType.java new file mode 100644 index 00000000..aaa33b66 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/PostCardUpdatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCardUpdatedPayloadType { + public static final PostCardUpdatedPayloadType CARD_UPDATED = + new PostCardUpdatedPayloadType(Value.CARD_UPDATED, "card.updated"); + + private final Value value; + + private final String string; + + PostCardUpdatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCardUpdatedPayloadType + && this.string.equals(((PostCardUpdatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_UPDATED: + return visitor.visitCardUpdated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCardUpdatedPayloadType valueOf(String value) { + switch (value) { + case "card.updated": + return CARD_UPDATED; + default: + return new PostCardUpdatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_UPDATED, + + UNKNOWN + } + + public interface Visitor { + T visitCardUpdated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponse.java b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponse.java new file mode 100644 index 00000000..8f99f5e4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponse.java @@ -0,0 +1,1102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCardsResponse.Builder.class) +public final class RetrieveCardsResponse { + private final Optional billing; + + private final Optional canceledAt; + + private final Optional createdAt; + + private final Optional expirationMonth; + + private final Optional expirationYear; + + private final String id; + + private final Optional last4; + + private final Optional limit; + + private final Optional name; + + private final RetrieveCardsResponseObject object; + + private final Optional secrets; + + private final Optional spentLastMonth; + + private final Optional status; + + private final Optional type; + + private final Optional userId; + + private final Map additionalProperties; + + private RetrieveCardsResponse( + Optional billing, + Optional canceledAt, + Optional createdAt, + Optional expirationMonth, + Optional expirationYear, + String id, + Optional last4, + Optional limit, + Optional name, + RetrieveCardsResponseObject object, + Optional secrets, + Optional spentLastMonth, + Optional status, + Optional type, + Optional userId, + Map additionalProperties) { + this.billing = billing; + this.canceledAt = canceledAt; + this.createdAt = createdAt; + this.expirationMonth = expirationMonth; + this.expirationYear = expirationYear; + this.id = id; + this.last4 = last4; + this.limit = limit; + this.name = name; + this.object = object; + this.secrets = secrets; + this.spentLastMonth = spentLastMonth; + this.status = status; + this.type = type; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The billing address. + */ + @JsonIgnore + public Optional getBilling() { + if (billing == null) { + return Optional.empty(); + } + return billing; + } + + /** + * @return When the card was canceled. + */ + @JsonIgnore + public Optional getCanceledAt() { + if (canceledAt == null) { + return Optional.empty(); + } + return canceledAt; + } + + /** + * @return When the card was created. + */ + @JsonIgnore + public Optional getCreatedAt() { + if (createdAt == null) { + return Optional.empty(); + } + return createdAt; + } + + /** + * @return Card expiration month. + */ + @JsonIgnore + public Optional getExpirationMonth() { + if (expirationMonth == null) { + return Optional.empty(); + } + return expirationMonth; + } + + /** + * @return Card expiration year. + */ + @JsonIgnore + public Optional getExpirationYear() { + if (expirationYear == null) { + return Optional.empty(); + } + return expirationYear; + } + + /** + * @return Card ID, prefixed icrd_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Last four digits of the card number. null for pending invitation cards. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + /** + * @return The spending limit configuration. + */ + @JsonIgnore + public Optional getLimit() { + if (limit == null) { + return Optional.empty(); + } + return limit; + } + + /** + * @return Card display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("object") + public RetrieveCardsResponseObject getObject() { + return object; + } + + /** + * @return Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved. + */ + @JsonIgnore + public Optional getSecrets() { + if (secrets == null) { + return Optional.empty(); + } + return secrets; + } + + /** + * @return Total spend in the last 30 days, in cents. + */ + @JsonIgnore + public Optional getSpentLastMonth() { + if (spentLastMonth == null) { + return Optional.empty(); + } + return spentLastMonth; + } + + /** + * @return The card status. denied means the issuer declined the cardholder, so the card will never be issued. + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The card type. + */ + @JsonIgnore + public Optional getType() { + if (type == null) { + return Optional.empty(); + } + return type; + } + + /** + * @return Cardholder user ID, prefixed user_, when assigned. + */ + @JsonIgnore + public Optional getUserId() { + if (userId == null) { + return Optional.empty(); + } + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing") + private Optional _getBilling() { + return billing; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("canceled_at") + private Optional _getCanceledAt() { + return canceledAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_at") + private Optional _getCreatedAt() { + return createdAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_month") + private Optional _getExpirationMonth() { + return expirationMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_year") + private Optional _getExpirationYear() { + return expirationYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("limit") + private Optional _getLimit() { + return limit; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("secrets") + private Optional _getSecrets() { + return secrets; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("spent_last_month") + private Optional _getSpentLastMonth() { + return spentLastMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("type") + private Optional _getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_id") + private Optional _getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCardsResponse && equalTo((RetrieveCardsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveCardsResponse other) { + return billing.equals(other.billing) + && canceledAt.equals(other.canceledAt) + && createdAt.equals(other.createdAt) + && expirationMonth.equals(other.expirationMonth) + && expirationYear.equals(other.expirationYear) + && id.equals(other.id) + && last4.equals(other.last4) + && limit.equals(other.limit) + && name.equals(other.name) + && object.equals(other.object) + && secrets.equals(other.secrets) + && spentLastMonth.equals(other.spentLastMonth) + && status.equals(other.status) + && type.equals(other.type) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billing, + this.canceledAt, + this.createdAt, + this.expirationMonth, + this.expirationYear, + this.id, + this.last4, + this.limit, + this.name, + this.object, + this.secrets, + this.spentLastMonth, + this.status, + this.type, + this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Card ID, prefixed icrd_.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(RetrieveCardsResponse other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull RetrieveCardsResponseObject object); + } + + public interface _FinalStage { + RetrieveCardsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The billing address.

+ */ + _FinalStage billing(Optional billing); + + _FinalStage billing(RetrieveCardsResponseBilling billing); + + _FinalStage billing(Nullable billing); + + /** + *

When the card was canceled.

+ */ + _FinalStage canceledAt(Optional canceledAt); + + _FinalStage canceledAt(OffsetDateTime canceledAt); + + _FinalStage canceledAt(Nullable canceledAt); + + /** + *

When the card was created.

+ */ + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage createdAt(Nullable createdAt); + + /** + *

Card expiration month.

+ */ + _FinalStage expirationMonth(Optional expirationMonth); + + _FinalStage expirationMonth(String expirationMonth); + + _FinalStage expirationMonth(Nullable expirationMonth); + + /** + *

Card expiration year.

+ */ + _FinalStage expirationYear(Optional expirationYear); + + _FinalStage expirationYear(String expirationYear); + + _FinalStage expirationYear(Nullable expirationYear); + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + + /** + *

The spending limit configuration.

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(RetrieveCardsResponseLimit limit); + + _FinalStage limit(Nullable limit); + + /** + *

Card display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + _FinalStage secrets(Optional secrets); + + _FinalStage secrets(RetrieveCardsResponseSecrets secrets); + + _FinalStage secrets(Nullable secrets); + + /** + *

Total spend in the last 30 days, in cents.

+ */ + _FinalStage spentLastMonth(Optional spentLastMonth); + + _FinalStage spentLastMonth(Integer spentLastMonth); + + _FinalStage spentLastMonth(Nullable spentLastMonth); + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(RetrieveCardsResponseStatus status); + + _FinalStage status(Nullable status); + + /** + *

The card type.

+ */ + _FinalStage type(Optional type); + + _FinalStage type(RetrieveCardsResponseType type); + + _FinalStage type(Nullable type); + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + + _FinalStage userId(Nullable userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private RetrieveCardsResponseObject object; + + private Optional userId = Optional.empty(); + + private Optional type = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional spentLastMonth = Optional.empty(); + + private Optional secrets = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional last4 = Optional.empty(); + + private Optional expirationYear = Optional.empty(); + + private Optional expirationMonth = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional canceledAt = Optional.empty(); + + private Optional billing = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveCardsResponse other) { + billing(other.getBilling()); + canceledAt(other.getCanceledAt()); + createdAt(other.getCreatedAt()); + expirationMonth(other.getExpirationMonth()); + expirationYear(other.getExpirationYear()); + id(other.getId()); + last4(other.getLast4()); + limit(other.getLimit()); + name(other.getName()); + object(other.getObject()); + secrets(other.getSecrets()); + spentLastMonth(other.getSpentLastMonth()); + status(other.getStatus()); + type(other.getType()); + userId(other.getUserId()); + return this; + } + + /** + *

Card ID, prefixed icrd_.

+ *

Card ID, prefixed icrd_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull RetrieveCardsResponseObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(Nullable userId) { + if (userId.isNull()) { + this.userId = null; + } else if (userId.isEmpty()) { + this.userId = Optional.empty(); + } else { + this.userId = Optional.of(userId.get()); + } + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(Nullable type) { + if (type.isNull()) { + this.type = null; + } else if (type.isEmpty()) { + this.type = Optional.empty(); + } else { + this.type = Optional.of(type.get()); + } + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(RetrieveCardsResponseType type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

The card type.

+ */ + @java.lang.Override + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public _FinalStage type(Optional type) { + this.type = type; + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(RetrieveCardsResponseStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Nullable spentLastMonth) { + if (spentLastMonth.isNull()) { + this.spentLastMonth = null; + } else if (spentLastMonth.isEmpty()) { + this.spentLastMonth = Optional.empty(); + } else { + this.spentLastMonth = Optional.of(spentLastMonth.get()); + } + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Integer spentLastMonth) { + this.spentLastMonth = Optional.ofNullable(spentLastMonth); + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ */ + @java.lang.Override + @JsonSetter(value = "spent_last_month", nulls = Nulls.SKIP) + public _FinalStage spentLastMonth(Optional spentLastMonth) { + this.spentLastMonth = spentLastMonth; + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(Nullable secrets) { + if (secrets.isNull()) { + this.secrets = null; + } else if (secrets.isEmpty()) { + this.secrets = Optional.empty(); + } else { + this.secrets = Optional.of(secrets.get()); + } + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(RetrieveCardsResponseSecrets secrets) { + this.secrets = Optional.ofNullable(secrets); + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + @java.lang.Override + @JsonSetter(value = "secrets", nulls = Nulls.SKIP) + public _FinalStage secrets(Optional secrets) { + this.secrets = secrets; + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Card display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(Nullable limit) { + if (limit.isNull()) { + this.limit = null; + } else if (limit.isEmpty()) { + this.limit = Optional.empty(); + } else { + this.limit = Optional.of(limit.get()); + } + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(RetrieveCardsResponseLimit limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

The spending limit configuration.

+ */ + @java.lang.Override + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public _FinalStage limit(Optional limit) { + this.limit = limit; + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(Nullable expirationYear) { + if (expirationYear.isNull()) { + this.expirationYear = null; + } else if (expirationYear.isEmpty()) { + this.expirationYear = Optional.empty(); + } else { + this.expirationYear = Optional.of(expirationYear.get()); + } + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(String expirationYear) { + this.expirationYear = Optional.ofNullable(expirationYear); + return this; + } + + /** + *

Card expiration year.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_year", nulls = Nulls.SKIP) + public _FinalStage expirationYear(Optional expirationYear) { + this.expirationYear = expirationYear; + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(Nullable expirationMonth) { + if (expirationMonth.isNull()) { + this.expirationMonth = null; + } else if (expirationMonth.isEmpty()) { + this.expirationMonth = Optional.empty(); + } else { + this.expirationMonth = Optional.of(expirationMonth.get()); + } + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(String expirationMonth) { + this.expirationMonth = Optional.ofNullable(expirationMonth); + return this; + } + + /** + *

Card expiration month.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_month", nulls = Nulls.SKIP) + public _FinalStage expirationMonth(Optional expirationMonth) { + this.expirationMonth = expirationMonth; + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(Nullable createdAt) { + if (createdAt.isNull()) { + this.createdAt = null; + } else if (createdAt.isEmpty()) { + this.createdAt = Optional.empty(); + } else { + this.createdAt = Optional.of(createdAt.get()); + } + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

When the card was created.

+ */ + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(Nullable canceledAt) { + if (canceledAt.isNull()) { + this.canceledAt = null; + } else if (canceledAt.isEmpty()) { + this.canceledAt = Optional.empty(); + } else { + this.canceledAt = Optional.of(canceledAt.get()); + } + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(OffsetDateTime canceledAt) { + this.canceledAt = Optional.ofNullable(canceledAt); + return this; + } + + /** + *

When the card was canceled.

+ */ + @java.lang.Override + @JsonSetter(value = "canceled_at", nulls = Nulls.SKIP) + public _FinalStage canceledAt(Optional canceledAt) { + this.canceledAt = canceledAt; + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(Nullable billing) { + if (billing.isNull()) { + this.billing = null; + } else if (billing.isEmpty()) { + this.billing = Optional.empty(); + } else { + this.billing = Optional.of(billing.get()); + } + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(RetrieveCardsResponseBilling billing) { + this.billing = Optional.ofNullable(billing); + return this; + } + + /** + *

The billing address.

+ */ + @java.lang.Override + @JsonSetter(value = "billing", nulls = Nulls.SKIP) + public _FinalStage billing(Optional billing) { + this.billing = billing; + return this; + } + + @java.lang.Override + public RetrieveCardsResponse build() { + return new RetrieveCardsResponse( + billing, + canceledAt, + createdAt, + expirationMonth, + expirationYear, + id, + last4, + limit, + name, + object, + secrets, + spentLastMonth, + status, + type, + userId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseBilling.java b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseBilling.java new file mode 100644 index 00000000..eb291ef5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseBilling.java @@ -0,0 +1,387 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCardsResponseBilling.Builder.class) +public final class RetrieveCardsResponseBilling { + private final Optional city; + + private final Optional countryCode; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional region; + + private final Map additionalProperties; + + private RetrieveCardsResponseBilling( + Optional city, + Optional countryCode, + Optional line1, + Optional line2, + Optional postalCode, + Optional region, + Map additionalProperties) { + this.city = city; + this.countryCode = countryCode; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.region = region; + this.additionalProperties = additionalProperties; + } + + /** + * @return Billing city. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Billing country code. + */ + @JsonIgnore + public Optional getCountryCode() { + if (countryCode == null) { + return Optional.empty(); + } + return countryCode; + } + + /** + * @return Street address line 1. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return Street address line 2. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Billing postal code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return Billing region or state. + */ + @JsonIgnore + public Optional getRegion() { + if (region == null) { + return Optional.empty(); + } + return region; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country_code") + private Optional _getCountryCode() { + return countryCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("region") + private Optional _getRegion() { + return region; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCardsResponseBilling && equalTo((RetrieveCardsResponseBilling) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveCardsResponseBilling other) { + return city.equals(other.city) + && countryCode.equals(other.countryCode) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && region.equals(other.region); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.countryCode, this.line1, this.line2, this.postalCode, this.region); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional countryCode = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional region = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveCardsResponseBilling other) { + city(other.getCity()); + countryCode(other.getCountryCode()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + region(other.getRegion()); + return this; + } + + /** + *

Billing city.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Billing country code.

+ */ + @JsonSetter(value = "country_code", nulls = Nulls.SKIP) + public Builder countryCode(Optional countryCode) { + this.countryCode = countryCode; + return this; + } + + public Builder countryCode(String countryCode) { + this.countryCode = Optional.ofNullable(countryCode); + return this; + } + + public Builder countryCode(Nullable countryCode) { + if (countryCode.isNull()) { + this.countryCode = null; + } else if (countryCode.isEmpty()) { + this.countryCode = Optional.empty(); + } else { + this.countryCode = Optional.of(countryCode.get()); + } + return this; + } + + /** + *

Street address line 1.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

Street address line 2.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Billing postal code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

Billing region or state.

+ */ + @JsonSetter(value = "region", nulls = Nulls.SKIP) + public Builder region(Optional region) { + this.region = region; + return this; + } + + public Builder region(String region) { + this.region = Optional.ofNullable(region); + return this; + } + + public Builder region(Nullable region) { + if (region.isNull()) { + this.region = null; + } else if (region.isEmpty()) { + this.region = Optional.empty(); + } else { + this.region = Optional.of(region.get()); + } + return this; + } + + public RetrieveCardsResponseBilling build() { + return new RetrieveCardsResponseBilling( + city, countryCode, line1, line2, postalCode, region, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseLimit.java b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseLimit.java new file mode 100644 index 00000000..27e6bf35 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseLimit.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCardsResponseLimit.Builder.class) +public final class RetrieveCardsResponseLimit { + private final double amount; + + private final RetrieveCardsResponseLimitFrequency frequency; + + private final Map additionalProperties; + + private RetrieveCardsResponseLimit( + double amount, RetrieveCardsResponseLimitFrequency frequency, Map additionalProperties) { + this.amount = amount; + this.frequency = frequency; + this.additionalProperties = additionalProperties; + } + + /** + * @return The limit amount in dollars. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports. + */ + @JsonProperty("frequency") + public RetrieveCardsResponseLimitFrequency getFrequency() { + return frequency; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCardsResponseLimit && equalTo((RetrieveCardsResponseLimit) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveCardsResponseLimit other) { + return amount == other.amount && frequency.equals(other.frequency); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.frequency); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The limit amount in dollars.

+ */ + FrequencyStage amount(double amount); + + Builder from(RetrieveCardsResponseLimit other); + } + + public interface FrequencyStage { + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ */ + _FinalStage frequency(@NotNull RetrieveCardsResponseLimitFrequency frequency); + } + + public interface _FinalStage { + RetrieveCardsResponseLimit build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, FrequencyStage, _FinalStage { + private double amount; + + private RetrieveCardsResponseLimitFrequency frequency; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveCardsResponseLimit other) { + amount(other.getAmount()); + frequency(other.getFrequency()); + return this; + } + + /** + *

The limit amount in dollars.

+ *

The limit amount in dollars.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public FrequencyStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("frequency") + public _FinalStage frequency(@NotNull RetrieveCardsResponseLimitFrequency frequency) { + this.frequency = Objects.requireNonNull(frequency, "frequency must not be null"); + return this; + } + + @java.lang.Override + public RetrieveCardsResponseLimit build() { + return new RetrieveCardsResponseLimit(amount, frequency, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseLimitFrequency.java b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseLimitFrequency.java new file mode 100644 index 00000000..76a6efc8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseLimitFrequency.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveCardsResponseLimitFrequency { + public static final RetrieveCardsResponseLimitFrequency PER_TRANSACTION = + new RetrieveCardsResponseLimitFrequency(Value.PER_TRANSACTION, "per_transaction"); + + public static final RetrieveCardsResponseLimitFrequency ONE_TIME = + new RetrieveCardsResponseLimitFrequency(Value.ONE_TIME, "one_time"); + + public static final RetrieveCardsResponseLimitFrequency DAILY = + new RetrieveCardsResponseLimitFrequency(Value.DAILY, "daily"); + + public static final RetrieveCardsResponseLimitFrequency WEEKLY = + new RetrieveCardsResponseLimitFrequency(Value.WEEKLY, "weekly"); + + public static final RetrieveCardsResponseLimitFrequency MONTHLY = + new RetrieveCardsResponseLimitFrequency(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + RetrieveCardsResponseLimitFrequency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveCardsResponseLimitFrequency + && this.string.equals(((RetrieveCardsResponseLimitFrequency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PER_TRANSACTION: + return visitor.visitPerTransaction(); + case ONE_TIME: + return visitor.visitOneTime(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveCardsResponseLimitFrequency valueOf(String value) { + switch (value) { + case "per_transaction": + return PER_TRANSACTION; + case "one_time": + return ONE_TIME; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new RetrieveCardsResponseLimitFrequency(Value.UNKNOWN, value); + } + } + + public enum Value { + DAILY, + + WEEKLY, + + MONTHLY, + + ONE_TIME, + + PER_TRANSACTION, + + UNKNOWN + } + + public interface Visitor { + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitOneTime(); + + T visitPerTransaction(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseObject.java b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseObject.java new file mode 100644 index 00000000..e307742f --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseObject.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveCardsResponseObject { + public static final RetrieveCardsResponseObject CARD = new RetrieveCardsResponseObject(Value.CARD, "card"); + + private final Value value; + + private final String string; + + RetrieveCardsResponseObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveCardsResponseObject + && this.string.equals(((RetrieveCardsResponseObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD: + return visitor.visitCard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveCardsResponseObject valueOf(String value) { + switch (value) { + case "card": + return CARD; + default: + return new RetrieveCardsResponseObject(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD, + + UNKNOWN + } + + public interface Visitor { + T visitCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseSecrets.java b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseSecrets.java new file mode 100644 index 00000000..83460a46 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseSecrets.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCardsResponseSecrets.Builder.class) +public final class RetrieveCardsResponseSecrets { + private final String cardNumber; + + private final String cvc; + + private final Optional nameOnCard; + + private final Optional pin; + + private final Map additionalProperties; + + private RetrieveCardsResponseSecrets( + String cardNumber, + String cvc, + Optional nameOnCard, + Optional pin, + Map additionalProperties) { + this.cardNumber = cardNumber; + this.cvc = cvc; + this.nameOnCard = nameOnCard; + this.pin = pin; + this.additionalProperties = additionalProperties; + } + + /** + * @return Full card number. + */ + @JsonProperty("card_number") + public String getCardNumber() { + return cardNumber; + } + + /** + * @return Card verification code. + */ + @JsonProperty("cvc") + public String getCvc() { + return cvc; + } + + /** + * @return Cardholder name printed on the card. + */ + @JsonIgnore + public Optional getNameOnCard() { + if (nameOnCard == null) { + return Optional.empty(); + } + return nameOnCard; + } + + /** + * @return The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys. + */ + @JsonIgnore + public Optional getPin() { + if (pin == null) { + return Optional.empty(); + } + return pin; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name_on_card") + private Optional _getNameOnCard() { + return nameOnCard; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("pin") + private Optional _getPin() { + return pin; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCardsResponseSecrets && equalTo((RetrieveCardsResponseSecrets) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveCardsResponseSecrets other) { + return cardNumber.equals(other.cardNumber) + && cvc.equals(other.cvc) + && nameOnCard.equals(other.nameOnCard) + && pin.equals(other.pin); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cardNumber, this.cvc, this.nameOnCard, this.pin); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardNumberStage builder() { + return new Builder(); + } + + public interface CardNumberStage { + /** + *

Full card number.

+ */ + CvcStage cardNumber(@NotNull String cardNumber); + + Builder from(RetrieveCardsResponseSecrets other); + } + + public interface CvcStage { + /** + *

Card verification code.

+ */ + _FinalStage cvc(@NotNull String cvc); + } + + public interface _FinalStage { + RetrieveCardsResponseSecrets build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Cardholder name printed on the card.

+ */ + _FinalStage nameOnCard(Optional nameOnCard); + + _FinalStage nameOnCard(String nameOnCard); + + _FinalStage nameOnCard(Nullable nameOnCard); + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + _FinalStage pin(Optional pin); + + _FinalStage pin(String pin); + + _FinalStage pin(Nullable pin); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardNumberStage, CvcStage, _FinalStage { + private String cardNumber; + + private String cvc; + + private Optional pin = Optional.empty(); + + private Optional nameOnCard = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveCardsResponseSecrets other) { + cardNumber(other.getCardNumber()); + cvc(other.getCvc()); + nameOnCard(other.getNameOnCard()); + pin(other.getPin()); + return this; + } + + /** + *

Full card number.

+ *

Full card number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card_number") + public CvcStage cardNumber(@NotNull String cardNumber) { + this.cardNumber = Objects.requireNonNull(cardNumber, "cardNumber must not be null"); + return this; + } + + /** + *

Card verification code.

+ *

Card verification code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cvc") + public _FinalStage cvc(@NotNull String cvc) { + this.cvc = Objects.requireNonNull(cvc, "cvc must not be null"); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(Nullable pin) { + if (pin.isNull()) { + this.pin = null; + } else if (pin.isEmpty()) { + this.pin = Optional.empty(); + } else { + this.pin = Optional.of(pin.get()); + } + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(String pin) { + this.pin = Optional.ofNullable(pin); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + @java.lang.Override + @JsonSetter(value = "pin", nulls = Nulls.SKIP) + public _FinalStage pin(Optional pin) { + this.pin = pin; + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(Nullable nameOnCard) { + if (nameOnCard.isNull()) { + this.nameOnCard = null; + } else if (nameOnCard.isEmpty()) { + this.nameOnCard = Optional.empty(); + } else { + this.nameOnCard = Optional.of(nameOnCard.get()); + } + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(String nameOnCard) { + this.nameOnCard = Optional.ofNullable(nameOnCard); + return this; + } + + /** + *

Cardholder name printed on the card.

+ */ + @java.lang.Override + @JsonSetter(value = "name_on_card", nulls = Nulls.SKIP) + public _FinalStage nameOnCard(Optional nameOnCard) { + this.nameOnCard = nameOnCard; + return this; + } + + @java.lang.Override + public RetrieveCardsResponseSecrets build() { + return new RetrieveCardsResponseSecrets(cardNumber, cvc, nameOnCard, pin, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseStatus.java b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseStatus.java new file mode 100644 index 00000000..544216ec --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseStatus.java @@ -0,0 +1,115 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveCardsResponseStatus { + public static final RetrieveCardsResponseStatus INVITED = new RetrieveCardsResponseStatus(Value.INVITED, "invited"); + + public static final RetrieveCardsResponseStatus CANCELED = + new RetrieveCardsResponseStatus(Value.CANCELED, "canceled"); + + public static final RetrieveCardsResponseStatus DENIED = new RetrieveCardsResponseStatus(Value.DENIED, "denied"); + + public static final RetrieveCardsResponseStatus FROZEN = new RetrieveCardsResponseStatus(Value.FROZEN, "frozen"); + + public static final RetrieveCardsResponseStatus ACTIVE = new RetrieveCardsResponseStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + RetrieveCardsResponseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveCardsResponseStatus + && this.string.equals(((RetrieveCardsResponseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INVITED: + return visitor.visitInvited(); + case CANCELED: + return visitor.visitCanceled(); + case DENIED: + return visitor.visitDenied(); + case FROZEN: + return visitor.visitFrozen(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveCardsResponseStatus valueOf(String value) { + switch (value) { + case "invited": + return INVITED; + case "canceled": + return CANCELED; + case "denied": + return DENIED; + case "frozen": + return FROZEN; + case "active": + return ACTIVE; + default: + return new RetrieveCardsResponseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + FROZEN, + + CANCELED, + + INVITED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitFrozen(); + + T visitCanceled(); + + T visitInvited(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseType.java b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseType.java new file mode 100644 index 00000000..1ff02ea6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/RetrieveCardsResponseType.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveCardsResponseType { + public static final RetrieveCardsResponseType PHYSICAL = new RetrieveCardsResponseType(Value.PHYSICAL, "physical"); + + public static final RetrieveCardsResponseType VIRTUAL = new RetrieveCardsResponseType(Value.VIRTUAL, "virtual"); + + private final Value value; + + private final String string; + + RetrieveCardsResponseType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveCardsResponseType + && this.string.equals(((RetrieveCardsResponseType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PHYSICAL: + return visitor.visitPhysical(); + case VIRTUAL: + return visitor.visitVirtual(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveCardsResponseType valueOf(String value) { + switch (value) { + case "physical": + return PHYSICAL; + case "virtual": + return VIRTUAL; + default: + return new RetrieveCardsResponseType(Value.UNKNOWN, value); + } + } + + public enum Value { + VIRTUAL, + + PHYSICAL, + + UNKNOWN + } + + public interface Visitor { + T visitVirtual(); + + T visitPhysical(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/UpdateCardsRequestBilling.java b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsRequestBilling.java new file mode 100644 index 00000000..6a7a7596 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsRequestBilling.java @@ -0,0 +1,318 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCardsRequestBilling.Builder.class) +public final class UpdateCardsRequestBilling { + private final String city; + + private final String countryCode; + + private final String line1; + + private final Optional line2; + + private final String postalCode; + + private final String region; + + private final Map additionalProperties; + + private UpdateCardsRequestBilling( + String city, + String countryCode, + String line1, + Optional line2, + String postalCode, + String region, + Map additionalProperties) { + this.city = city; + this.countryCode = countryCode; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.region = region; + this.additionalProperties = additionalProperties; + } + + /** + * @return Billing city. + */ + @JsonProperty("city") + public String getCity() { + return city; + } + + /** + * @return Billing country code, ISO 3166-1 alpha-2. + */ + @JsonProperty("country_code") + public String getCountryCode() { + return countryCode; + } + + /** + * @return Street address line 1. + */ + @JsonProperty("line1") + public String getLine1() { + return line1; + } + + /** + * @return Street address line 2. + */ + @JsonProperty("line2") + public Optional getLine2() { + return line2; + } + + /** + * @return Billing postal code. + */ + @JsonProperty("postal_code") + public String getPostalCode() { + return postalCode; + } + + /** + * @return Billing region or state. + */ + @JsonProperty("region") + public String getRegion() { + return region; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCardsRequestBilling && equalTo((UpdateCardsRequestBilling) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCardsRequestBilling other) { + return city.equals(other.city) + && countryCode.equals(other.countryCode) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && region.equals(other.region); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.countryCode, this.line1, this.line2, this.postalCode, this.region); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CityStage builder() { + return new Builder(); + } + + public interface CityStage { + /** + *

Billing city.

+ */ + CountryCodeStage city(@NotNull String city); + + Builder from(UpdateCardsRequestBilling other); + } + + public interface CountryCodeStage { + /** + *

Billing country code, ISO 3166-1 alpha-2.

+ */ + Line1Stage countryCode(@NotNull String countryCode); + } + + public interface Line1Stage { + /** + *

Street address line 1.

+ */ + PostalCodeStage line1(@NotNull String line1); + } + + public interface PostalCodeStage { + /** + *

Billing postal code.

+ */ + RegionStage postalCode(@NotNull String postalCode); + } + + public interface RegionStage { + /** + *

Billing region or state.

+ */ + _FinalStage region(@NotNull String region); + } + + public interface _FinalStage { + UpdateCardsRequestBilling build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Street address line 2.

+ */ + _FinalStage line2(Optional line2); + + _FinalStage line2(String line2); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CityStage, CountryCodeStage, Line1Stage, PostalCodeStage, RegionStage, _FinalStage { + private String city; + + private String countryCode; + + private String line1; + + private String postalCode; + + private String region; + + private Optional line2 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCardsRequestBilling other) { + city(other.getCity()); + countryCode(other.getCountryCode()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + region(other.getRegion()); + return this; + } + + /** + *

Billing city.

+ *

Billing city.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("city") + public CountryCodeStage city(@NotNull String city) { + this.city = Objects.requireNonNull(city, "city must not be null"); + return this; + } + + /** + *

Billing country code, ISO 3166-1 alpha-2.

+ *

Billing country code, ISO 3166-1 alpha-2.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("country_code") + public Line1Stage countryCode(@NotNull String countryCode) { + this.countryCode = Objects.requireNonNull(countryCode, "countryCode must not be null"); + return this; + } + + /** + *

Street address line 1.

+ *

Street address line 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("line1") + public PostalCodeStage line1(@NotNull String line1) { + this.line1 = Objects.requireNonNull(line1, "line1 must not be null"); + return this; + } + + /** + *

Billing postal code.

+ *

Billing postal code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("postal_code") + public RegionStage postalCode(@NotNull String postalCode) { + this.postalCode = Objects.requireNonNull(postalCode, "postalCode must not be null"); + return this; + } + + /** + *

Billing region or state.

+ *

Billing region or state.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("region") + public _FinalStage region(@NotNull String region) { + this.region = Objects.requireNonNull(region, "region must not be null"); + return this; + } + + /** + *

Street address line 2.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + /** + *

Street address line 2.

+ */ + @java.lang.Override + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public _FinalStage line2(Optional line2) { + this.line2 = line2; + return this; + } + + @java.lang.Override + public UpdateCardsRequestBilling build() { + return new UpdateCardsRequestBilling( + city, countryCode, line1, line2, postalCode, region, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/UpdateCardsRequestSpendLimitFrequency.java b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsRequestSpendLimitFrequency.java new file mode 100644 index 00000000..88549bc1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsRequestSpendLimitFrequency.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateCardsRequestSpendLimitFrequency { + public static final UpdateCardsRequestSpendLimitFrequency ONE_TIME = + new UpdateCardsRequestSpendLimitFrequency(Value.ONE_TIME, "one_time"); + + public static final UpdateCardsRequestSpendLimitFrequency DAILY = + new UpdateCardsRequestSpendLimitFrequency(Value.DAILY, "daily"); + + public static final UpdateCardsRequestSpendLimitFrequency WEEKLY = + new UpdateCardsRequestSpendLimitFrequency(Value.WEEKLY, "weekly"); + + public static final UpdateCardsRequestSpendLimitFrequency MONTHLY = + new UpdateCardsRequestSpendLimitFrequency(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + UpdateCardsRequestSpendLimitFrequency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateCardsRequestSpendLimitFrequency + && this.string.equals(((UpdateCardsRequestSpendLimitFrequency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ONE_TIME: + return visitor.visitOneTime(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateCardsRequestSpendLimitFrequency valueOf(String value) { + switch (value) { + case "one_time": + return ONE_TIME; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new UpdateCardsRequestSpendLimitFrequency(Value.UNKNOWN, value); + } + } + + public enum Value { + DAILY, + + WEEKLY, + + MONTHLY, + + ONE_TIME, + + UNKNOWN + } + + public interface Visitor { + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitOneTime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponse.java b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponse.java new file mode 100644 index 00000000..eb5bf3ea --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponse.java @@ -0,0 +1,1102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCardsResponse.Builder.class) +public final class UpdateCardsResponse { + private final Optional billing; + + private final Optional canceledAt; + + private final Optional createdAt; + + private final Optional expirationMonth; + + private final Optional expirationYear; + + private final String id; + + private final Optional last4; + + private final Optional limit; + + private final Optional name; + + private final UpdateCardsResponseObject object; + + private final Optional secrets; + + private final Optional spentLastMonth; + + private final Optional status; + + private final Optional type; + + private final Optional userId; + + private final Map additionalProperties; + + private UpdateCardsResponse( + Optional billing, + Optional canceledAt, + Optional createdAt, + Optional expirationMonth, + Optional expirationYear, + String id, + Optional last4, + Optional limit, + Optional name, + UpdateCardsResponseObject object, + Optional secrets, + Optional spentLastMonth, + Optional status, + Optional type, + Optional userId, + Map additionalProperties) { + this.billing = billing; + this.canceledAt = canceledAt; + this.createdAt = createdAt; + this.expirationMonth = expirationMonth; + this.expirationYear = expirationYear; + this.id = id; + this.last4 = last4; + this.limit = limit; + this.name = name; + this.object = object; + this.secrets = secrets; + this.spentLastMonth = spentLastMonth; + this.status = status; + this.type = type; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The billing address. + */ + @JsonIgnore + public Optional getBilling() { + if (billing == null) { + return Optional.empty(); + } + return billing; + } + + /** + * @return When the card was canceled. + */ + @JsonIgnore + public Optional getCanceledAt() { + if (canceledAt == null) { + return Optional.empty(); + } + return canceledAt; + } + + /** + * @return When the card was created. + */ + @JsonIgnore + public Optional getCreatedAt() { + if (createdAt == null) { + return Optional.empty(); + } + return createdAt; + } + + /** + * @return Card expiration month. + */ + @JsonIgnore + public Optional getExpirationMonth() { + if (expirationMonth == null) { + return Optional.empty(); + } + return expirationMonth; + } + + /** + * @return Card expiration year. + */ + @JsonIgnore + public Optional getExpirationYear() { + if (expirationYear == null) { + return Optional.empty(); + } + return expirationYear; + } + + /** + * @return Card ID, prefixed icrd_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Last four digits of the card number. null for pending invitation cards. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + /** + * @return The spending limit configuration. + */ + @JsonIgnore + public Optional getLimit() { + if (limit == null) { + return Optional.empty(); + } + return limit; + } + + /** + * @return Card display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("object") + public UpdateCardsResponseObject getObject() { + return object; + } + + /** + * @return Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved. + */ + @JsonIgnore + public Optional getSecrets() { + if (secrets == null) { + return Optional.empty(); + } + return secrets; + } + + /** + * @return Total spend in the last 30 days, in cents. + */ + @JsonIgnore + public Optional getSpentLastMonth() { + if (spentLastMonth == null) { + return Optional.empty(); + } + return spentLastMonth; + } + + /** + * @return The card status. denied means the issuer declined the cardholder, so the card will never be issued. + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The card type. + */ + @JsonIgnore + public Optional getType() { + if (type == null) { + return Optional.empty(); + } + return type; + } + + /** + * @return Cardholder user ID, prefixed user_, when assigned. + */ + @JsonIgnore + public Optional getUserId() { + if (userId == null) { + return Optional.empty(); + } + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing") + private Optional _getBilling() { + return billing; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("canceled_at") + private Optional _getCanceledAt() { + return canceledAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_at") + private Optional _getCreatedAt() { + return createdAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_month") + private Optional _getExpirationMonth() { + return expirationMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_year") + private Optional _getExpirationYear() { + return expirationYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("limit") + private Optional _getLimit() { + return limit; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("secrets") + private Optional _getSecrets() { + return secrets; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("spent_last_month") + private Optional _getSpentLastMonth() { + return spentLastMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("type") + private Optional _getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_id") + private Optional _getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCardsResponse && equalTo((UpdateCardsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCardsResponse other) { + return billing.equals(other.billing) + && canceledAt.equals(other.canceledAt) + && createdAt.equals(other.createdAt) + && expirationMonth.equals(other.expirationMonth) + && expirationYear.equals(other.expirationYear) + && id.equals(other.id) + && last4.equals(other.last4) + && limit.equals(other.limit) + && name.equals(other.name) + && object.equals(other.object) + && secrets.equals(other.secrets) + && spentLastMonth.equals(other.spentLastMonth) + && status.equals(other.status) + && type.equals(other.type) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billing, + this.canceledAt, + this.createdAt, + this.expirationMonth, + this.expirationYear, + this.id, + this.last4, + this.limit, + this.name, + this.object, + this.secrets, + this.spentLastMonth, + this.status, + this.type, + this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Card ID, prefixed icrd_.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(UpdateCardsResponse other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull UpdateCardsResponseObject object); + } + + public interface _FinalStage { + UpdateCardsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The billing address.

+ */ + _FinalStage billing(Optional billing); + + _FinalStage billing(UpdateCardsResponseBilling billing); + + _FinalStage billing(Nullable billing); + + /** + *

When the card was canceled.

+ */ + _FinalStage canceledAt(Optional canceledAt); + + _FinalStage canceledAt(OffsetDateTime canceledAt); + + _FinalStage canceledAt(Nullable canceledAt); + + /** + *

When the card was created.

+ */ + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage createdAt(Nullable createdAt); + + /** + *

Card expiration month.

+ */ + _FinalStage expirationMonth(Optional expirationMonth); + + _FinalStage expirationMonth(String expirationMonth); + + _FinalStage expirationMonth(Nullable expirationMonth); + + /** + *

Card expiration year.

+ */ + _FinalStage expirationYear(Optional expirationYear); + + _FinalStage expirationYear(String expirationYear); + + _FinalStage expirationYear(Nullable expirationYear); + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + + /** + *

The spending limit configuration.

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(UpdateCardsResponseLimit limit); + + _FinalStage limit(Nullable limit); + + /** + *

Card display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + _FinalStage secrets(Optional secrets); + + _FinalStage secrets(UpdateCardsResponseSecrets secrets); + + _FinalStage secrets(Nullable secrets); + + /** + *

Total spend in the last 30 days, in cents.

+ */ + _FinalStage spentLastMonth(Optional spentLastMonth); + + _FinalStage spentLastMonth(Integer spentLastMonth); + + _FinalStage spentLastMonth(Nullable spentLastMonth); + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(UpdateCardsResponseStatus status); + + _FinalStage status(Nullable status); + + /** + *

The card type.

+ */ + _FinalStage type(Optional type); + + _FinalStage type(UpdateCardsResponseType type); + + _FinalStage type(Nullable type); + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + + _FinalStage userId(Nullable userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private UpdateCardsResponseObject object; + + private Optional userId = Optional.empty(); + + private Optional type = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional spentLastMonth = Optional.empty(); + + private Optional secrets = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional last4 = Optional.empty(); + + private Optional expirationYear = Optional.empty(); + + private Optional expirationMonth = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional canceledAt = Optional.empty(); + + private Optional billing = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCardsResponse other) { + billing(other.getBilling()); + canceledAt(other.getCanceledAt()); + createdAt(other.getCreatedAt()); + expirationMonth(other.getExpirationMonth()); + expirationYear(other.getExpirationYear()); + id(other.getId()); + last4(other.getLast4()); + limit(other.getLimit()); + name(other.getName()); + object(other.getObject()); + secrets(other.getSecrets()); + spentLastMonth(other.getSpentLastMonth()); + status(other.getStatus()); + type(other.getType()); + userId(other.getUserId()); + return this; + } + + /** + *

Card ID, prefixed icrd_.

+ *

Card ID, prefixed icrd_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull UpdateCardsResponseObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(Nullable userId) { + if (userId.isNull()) { + this.userId = null; + } else if (userId.isEmpty()) { + this.userId = Optional.empty(); + } else { + this.userId = Optional.of(userId.get()); + } + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Cardholder user ID, prefixed user_, when assigned.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(Nullable type) { + if (type.isNull()) { + this.type = null; + } else if (type.isEmpty()) { + this.type = Optional.empty(); + } else { + this.type = Optional.of(type.get()); + } + return this; + } + + /** + *

The card type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(UpdateCardsResponseType type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

The card type.

+ */ + @java.lang.Override + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public _FinalStage type(Optional type) { + this.type = type; + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(UpdateCardsResponseStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The card status. denied means the issuer declined the cardholder, so the card will never be issued.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Nullable spentLastMonth) { + if (spentLastMonth.isNull()) { + this.spentLastMonth = null; + } else if (spentLastMonth.isEmpty()) { + this.spentLastMonth = Optional.empty(); + } else { + this.spentLastMonth = Optional.of(spentLastMonth.get()); + } + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spentLastMonth(Integer spentLastMonth) { + this.spentLastMonth = Optional.ofNullable(spentLastMonth); + return this; + } + + /** + *

Total spend in the last 30 days, in cents.

+ */ + @java.lang.Override + @JsonSetter(value = "spent_last_month", nulls = Nulls.SKIP) + public _FinalStage spentLastMonth(Optional spentLastMonth) { + this.spentLastMonth = spentLastMonth; + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(Nullable secrets) { + if (secrets.isNull()) { + this.secrets = null; + } else if (secrets.isEmpty()) { + this.secrets = Optional.empty(); + } else { + this.secrets = Optional.of(secrets.get()); + } + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(UpdateCardsResponseSecrets secrets) { + this.secrets = Optional.ofNullable(secrets); + return this; + } + + /** + *

Sensitive card details. Present only on GET /cards/:id for active cards; null when the card is inactive or details cannot be retrieved.

+ */ + @java.lang.Override + @JsonSetter(value = "secrets", nulls = Nulls.SKIP) + public _FinalStage secrets(Optional secrets) { + this.secrets = secrets; + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Card display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Card display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(Nullable limit) { + if (limit.isNull()) { + this.limit = null; + } else if (limit.isEmpty()) { + this.limit = Optional.empty(); + } else { + this.limit = Optional.of(limit.get()); + } + return this; + } + + /** + *

The spending limit configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(UpdateCardsResponseLimit limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

The spending limit configuration.

+ */ + @java.lang.Override + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public _FinalStage limit(Optional limit) { + this.limit = limit; + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

Last four digits of the card number. null for pending invitation cards.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(Nullable expirationYear) { + if (expirationYear.isNull()) { + this.expirationYear = null; + } else if (expirationYear.isEmpty()) { + this.expirationYear = Optional.empty(); + } else { + this.expirationYear = Optional.of(expirationYear.get()); + } + return this; + } + + /** + *

Card expiration year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationYear(String expirationYear) { + this.expirationYear = Optional.ofNullable(expirationYear); + return this; + } + + /** + *

Card expiration year.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_year", nulls = Nulls.SKIP) + public _FinalStage expirationYear(Optional expirationYear) { + this.expirationYear = expirationYear; + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(Nullable expirationMonth) { + if (expirationMonth.isNull()) { + this.expirationMonth = null; + } else if (expirationMonth.isEmpty()) { + this.expirationMonth = Optional.empty(); + } else { + this.expirationMonth = Optional.of(expirationMonth.get()); + } + return this; + } + + /** + *

Card expiration month.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationMonth(String expirationMonth) { + this.expirationMonth = Optional.ofNullable(expirationMonth); + return this; + } + + /** + *

Card expiration month.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_month", nulls = Nulls.SKIP) + public _FinalStage expirationMonth(Optional expirationMonth) { + this.expirationMonth = expirationMonth; + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(Nullable createdAt) { + if (createdAt.isNull()) { + this.createdAt = null; + } else if (createdAt.isEmpty()) { + this.createdAt = Optional.empty(); + } else { + this.createdAt = Optional.of(createdAt.get()); + } + return this; + } + + /** + *

When the card was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

When the card was created.

+ */ + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(Nullable canceledAt) { + if (canceledAt.isNull()) { + this.canceledAt = null; + } else if (canceledAt.isEmpty()) { + this.canceledAt = Optional.empty(); + } else { + this.canceledAt = Optional.of(canceledAt.get()); + } + return this; + } + + /** + *

When the card was canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(OffsetDateTime canceledAt) { + this.canceledAt = Optional.ofNullable(canceledAt); + return this; + } + + /** + *

When the card was canceled.

+ */ + @java.lang.Override + @JsonSetter(value = "canceled_at", nulls = Nulls.SKIP) + public _FinalStage canceledAt(Optional canceledAt) { + this.canceledAt = canceledAt; + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(Nullable billing) { + if (billing.isNull()) { + this.billing = null; + } else if (billing.isEmpty()) { + this.billing = Optional.empty(); + } else { + this.billing = Optional.of(billing.get()); + } + return this; + } + + /** + *

The billing address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billing(UpdateCardsResponseBilling billing) { + this.billing = Optional.ofNullable(billing); + return this; + } + + /** + *

The billing address.

+ */ + @java.lang.Override + @JsonSetter(value = "billing", nulls = Nulls.SKIP) + public _FinalStage billing(Optional billing) { + this.billing = billing; + return this; + } + + @java.lang.Override + public UpdateCardsResponse build() { + return new UpdateCardsResponse( + billing, + canceledAt, + createdAt, + expirationMonth, + expirationYear, + id, + last4, + limit, + name, + object, + secrets, + spentLastMonth, + status, + type, + userId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseBilling.java b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseBilling.java new file mode 100644 index 00000000..afa61fd0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseBilling.java @@ -0,0 +1,387 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCardsResponseBilling.Builder.class) +public final class UpdateCardsResponseBilling { + private final Optional city; + + private final Optional countryCode; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional region; + + private final Map additionalProperties; + + private UpdateCardsResponseBilling( + Optional city, + Optional countryCode, + Optional line1, + Optional line2, + Optional postalCode, + Optional region, + Map additionalProperties) { + this.city = city; + this.countryCode = countryCode; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.region = region; + this.additionalProperties = additionalProperties; + } + + /** + * @return Billing city. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Billing country code. + */ + @JsonIgnore + public Optional getCountryCode() { + if (countryCode == null) { + return Optional.empty(); + } + return countryCode; + } + + /** + * @return Street address line 1. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return Street address line 2. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Billing postal code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return Billing region or state. + */ + @JsonIgnore + public Optional getRegion() { + if (region == null) { + return Optional.empty(); + } + return region; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country_code") + private Optional _getCountryCode() { + return countryCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("region") + private Optional _getRegion() { + return region; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCardsResponseBilling && equalTo((UpdateCardsResponseBilling) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCardsResponseBilling other) { + return city.equals(other.city) + && countryCode.equals(other.countryCode) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && region.equals(other.region); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.countryCode, this.line1, this.line2, this.postalCode, this.region); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional countryCode = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional region = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateCardsResponseBilling other) { + city(other.getCity()); + countryCode(other.getCountryCode()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + region(other.getRegion()); + return this; + } + + /** + *

Billing city.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Billing country code.

+ */ + @JsonSetter(value = "country_code", nulls = Nulls.SKIP) + public Builder countryCode(Optional countryCode) { + this.countryCode = countryCode; + return this; + } + + public Builder countryCode(String countryCode) { + this.countryCode = Optional.ofNullable(countryCode); + return this; + } + + public Builder countryCode(Nullable countryCode) { + if (countryCode.isNull()) { + this.countryCode = null; + } else if (countryCode.isEmpty()) { + this.countryCode = Optional.empty(); + } else { + this.countryCode = Optional.of(countryCode.get()); + } + return this; + } + + /** + *

Street address line 1.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

Street address line 2.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Billing postal code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

Billing region or state.

+ */ + @JsonSetter(value = "region", nulls = Nulls.SKIP) + public Builder region(Optional region) { + this.region = region; + return this; + } + + public Builder region(String region) { + this.region = Optional.ofNullable(region); + return this; + } + + public Builder region(Nullable region) { + if (region.isNull()) { + this.region = null; + } else if (region.isEmpty()) { + this.region = Optional.empty(); + } else { + this.region = Optional.of(region.get()); + } + return this; + } + + public UpdateCardsResponseBilling build() { + return new UpdateCardsResponseBilling( + city, countryCode, line1, line2, postalCode, region, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseLimit.java b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseLimit.java new file mode 100644 index 00000000..0a033b54 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseLimit.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCardsResponseLimit.Builder.class) +public final class UpdateCardsResponseLimit { + private final double amount; + + private final UpdateCardsResponseLimitFrequency frequency; + + private final Map additionalProperties; + + private UpdateCardsResponseLimit( + double amount, UpdateCardsResponseLimitFrequency frequency, Map additionalProperties) { + this.amount = amount; + this.frequency = frequency; + this.additionalProperties = additionalProperties; + } + + /** + * @return The limit amount in dollars. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports. + */ + @JsonProperty("frequency") + public UpdateCardsResponseLimitFrequency getFrequency() { + return frequency; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCardsResponseLimit && equalTo((UpdateCardsResponseLimit) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCardsResponseLimit other) { + return amount == other.amount && frequency.equals(other.frequency); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.frequency); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The limit amount in dollars.

+ */ + FrequencyStage amount(double amount); + + Builder from(UpdateCardsResponseLimit other); + } + + public interface FrequencyStage { + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ */ + _FinalStage frequency(@NotNull UpdateCardsResponseLimitFrequency frequency); + } + + public interface _FinalStage { + UpdateCardsResponseLimit build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, FrequencyStage, _FinalStage { + private double amount; + + private UpdateCardsResponseLimitFrequency frequency; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCardsResponseLimit other) { + amount(other.getAmount()); + frequency(other.getFrequency()); + return this; + } + + /** + *

The limit amount in dollars.

+ *

The limit amount in dollars.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public FrequencyStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ *

The window the limit amount applies to. per_transaction caps each individual authorization and is what a limit set with transaction_limit reports.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("frequency") + public _FinalStage frequency(@NotNull UpdateCardsResponseLimitFrequency frequency) { + this.frequency = Objects.requireNonNull(frequency, "frequency must not be null"); + return this; + } + + @java.lang.Override + public UpdateCardsResponseLimit build() { + return new UpdateCardsResponseLimit(amount, frequency, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseLimitFrequency.java b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseLimitFrequency.java new file mode 100644 index 00000000..8aa57d46 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseLimitFrequency.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateCardsResponseLimitFrequency { + public static final UpdateCardsResponseLimitFrequency PER_TRANSACTION = + new UpdateCardsResponseLimitFrequency(Value.PER_TRANSACTION, "per_transaction"); + + public static final UpdateCardsResponseLimitFrequency ONE_TIME = + new UpdateCardsResponseLimitFrequency(Value.ONE_TIME, "one_time"); + + public static final UpdateCardsResponseLimitFrequency DAILY = + new UpdateCardsResponseLimitFrequency(Value.DAILY, "daily"); + + public static final UpdateCardsResponseLimitFrequency WEEKLY = + new UpdateCardsResponseLimitFrequency(Value.WEEKLY, "weekly"); + + public static final UpdateCardsResponseLimitFrequency MONTHLY = + new UpdateCardsResponseLimitFrequency(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + UpdateCardsResponseLimitFrequency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateCardsResponseLimitFrequency + && this.string.equals(((UpdateCardsResponseLimitFrequency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PER_TRANSACTION: + return visitor.visitPerTransaction(); + case ONE_TIME: + return visitor.visitOneTime(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateCardsResponseLimitFrequency valueOf(String value) { + switch (value) { + case "per_transaction": + return PER_TRANSACTION; + case "one_time": + return ONE_TIME; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new UpdateCardsResponseLimitFrequency(Value.UNKNOWN, value); + } + } + + public enum Value { + DAILY, + + WEEKLY, + + MONTHLY, + + ONE_TIME, + + PER_TRANSACTION, + + UNKNOWN + } + + public interface Visitor { + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitOneTime(); + + T visitPerTransaction(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseObject.java b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseObject.java new file mode 100644 index 00000000..b546b1f7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseObject.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateCardsResponseObject { + public static final UpdateCardsResponseObject CARD = new UpdateCardsResponseObject(Value.CARD, "card"); + + private final Value value; + + private final String string; + + UpdateCardsResponseObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateCardsResponseObject + && this.string.equals(((UpdateCardsResponseObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD: + return visitor.visitCard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateCardsResponseObject valueOf(String value) { + switch (value) { + case "card": + return CARD; + default: + return new UpdateCardsResponseObject(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD, + + UNKNOWN + } + + public interface Visitor { + T visitCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseSecrets.java b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseSecrets.java new file mode 100644 index 00000000..d8bf0bb5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseSecrets.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCardsResponseSecrets.Builder.class) +public final class UpdateCardsResponseSecrets { + private final String cardNumber; + + private final String cvc; + + private final Optional nameOnCard; + + private final Optional pin; + + private final Map additionalProperties; + + private UpdateCardsResponseSecrets( + String cardNumber, + String cvc, + Optional nameOnCard, + Optional pin, + Map additionalProperties) { + this.cardNumber = cardNumber; + this.cvc = cvc; + this.nameOnCard = nameOnCard; + this.pin = pin; + this.additionalProperties = additionalProperties; + } + + /** + * @return Full card number. + */ + @JsonProperty("card_number") + public String getCardNumber() { + return cardNumber; + } + + /** + * @return Card verification code. + */ + @JsonProperty("cvc") + public String getCvc() { + return cvc; + } + + /** + * @return Cardholder name printed on the card. + */ + @JsonIgnore + public Optional getNameOnCard() { + if (nameOnCard == null) { + return Optional.empty(); + } + return nameOnCard; + } + + /** + * @return The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys. + */ + @JsonIgnore + public Optional getPin() { + if (pin == null) { + return Optional.empty(); + } + return pin; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name_on_card") + private Optional _getNameOnCard() { + return nameOnCard; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("pin") + private Optional _getPin() { + return pin; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCardsResponseSecrets && equalTo((UpdateCardsResponseSecrets) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCardsResponseSecrets other) { + return cardNumber.equals(other.cardNumber) + && cvc.equals(other.cvc) + && nameOnCard.equals(other.nameOnCard) + && pin.equals(other.pin); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cardNumber, this.cvc, this.nameOnCard, this.pin); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardNumberStage builder() { + return new Builder(); + } + + public interface CardNumberStage { + /** + *

Full card number.

+ */ + CvcStage cardNumber(@NotNull String cardNumber); + + Builder from(UpdateCardsResponseSecrets other); + } + + public interface CvcStage { + /** + *

Card verification code.

+ */ + _FinalStage cvc(@NotNull String cvc); + } + + public interface _FinalStage { + UpdateCardsResponseSecrets build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Cardholder name printed on the card.

+ */ + _FinalStage nameOnCard(Optional nameOnCard); + + _FinalStage nameOnCard(String nameOnCard); + + _FinalStage nameOnCard(Nullable nameOnCard); + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + _FinalStage pin(Optional pin); + + _FinalStage pin(String pin); + + _FinalStage pin(Nullable pin); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardNumberStage, CvcStage, _FinalStage { + private String cardNumber; + + private String cvc; + + private Optional pin = Optional.empty(); + + private Optional nameOnCard = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCardsResponseSecrets other) { + cardNumber(other.getCardNumber()); + cvc(other.getCvc()); + nameOnCard(other.getNameOnCard()); + pin(other.getPin()); + return this; + } + + /** + *

Full card number.

+ *

Full card number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card_number") + public CvcStage cardNumber(@NotNull String cardNumber) { + this.cardNumber = Objects.requireNonNull(cardNumber, "cardNumber must not be null"); + return this; + } + + /** + *

Card verification code.

+ *

Card verification code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cvc") + public _FinalStage cvc(@NotNull String cvc) { + this.cvc = Objects.requireNonNull(cvc, "cvc must not be null"); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(Nullable pin) { + if (pin.isNull()) { + this.pin = null; + } else if (pin.isEmpty()) { + this.pin = Optional.empty(); + } else { + this.pin = Optional.of(pin.get()); + } + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pin(String pin) { + this.pin = Optional.ofNullable(pin); + return this; + } + + /** + *

The card PIN. Only returned when the request is authenticated as the user the card is assigned to; null for all other callers, including account API keys.

+ */ + @java.lang.Override + @JsonSetter(value = "pin", nulls = Nulls.SKIP) + public _FinalStage pin(Optional pin) { + this.pin = pin; + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(Nullable nameOnCard) { + if (nameOnCard.isNull()) { + this.nameOnCard = null; + } else if (nameOnCard.isEmpty()) { + this.nameOnCard = Optional.empty(); + } else { + this.nameOnCard = Optional.of(nameOnCard.get()); + } + return this; + } + + /** + *

Cardholder name printed on the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nameOnCard(String nameOnCard) { + this.nameOnCard = Optional.ofNullable(nameOnCard); + return this; + } + + /** + *

Cardholder name printed on the card.

+ */ + @java.lang.Override + @JsonSetter(value = "name_on_card", nulls = Nulls.SKIP) + public _FinalStage nameOnCard(Optional nameOnCard) { + this.nameOnCard = nameOnCard; + return this; + } + + @java.lang.Override + public UpdateCardsResponseSecrets build() { + return new UpdateCardsResponseSecrets(cardNumber, cvc, nameOnCard, pin, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseStatus.java b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseStatus.java new file mode 100644 index 00000000..83889adc --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseStatus.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateCardsResponseStatus { + public static final UpdateCardsResponseStatus INVITED = new UpdateCardsResponseStatus(Value.INVITED, "invited"); + + public static final UpdateCardsResponseStatus CANCELED = new UpdateCardsResponseStatus(Value.CANCELED, "canceled"); + + public static final UpdateCardsResponseStatus DENIED = new UpdateCardsResponseStatus(Value.DENIED, "denied"); + + public static final UpdateCardsResponseStatus FROZEN = new UpdateCardsResponseStatus(Value.FROZEN, "frozen"); + + public static final UpdateCardsResponseStatus ACTIVE = new UpdateCardsResponseStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + UpdateCardsResponseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateCardsResponseStatus + && this.string.equals(((UpdateCardsResponseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INVITED: + return visitor.visitInvited(); + case CANCELED: + return visitor.visitCanceled(); + case DENIED: + return visitor.visitDenied(); + case FROZEN: + return visitor.visitFrozen(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateCardsResponseStatus valueOf(String value) { + switch (value) { + case "invited": + return INVITED; + case "canceled": + return CANCELED; + case "denied": + return DENIED; + case "frozen": + return FROZEN; + case "active": + return ACTIVE; + default: + return new UpdateCardsResponseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + FROZEN, + + CANCELED, + + INVITED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitFrozen(); + + T visitCanceled(); + + T visitInvited(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseType.java b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseType.java new file mode 100644 index 00000000..8cfc521d --- /dev/null +++ b/src/main/java/com/whop/api/resources/cards/types/UpdateCardsResponseType.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cards.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateCardsResponseType { + public static final UpdateCardsResponseType PHYSICAL = new UpdateCardsResponseType(Value.PHYSICAL, "physical"); + + public static final UpdateCardsResponseType VIRTUAL = new UpdateCardsResponseType(Value.VIRTUAL, "virtual"); + + private final Value value; + + private final String string; + + UpdateCardsResponseType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateCardsResponseType + && this.string.equals(((UpdateCardsResponseType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PHYSICAL: + return visitor.visitPhysical(); + case VIRTUAL: + return visitor.visitVirtual(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateCardsResponseType valueOf(String value) { + switch (value) { + case "physical": + return PHYSICAL; + case "virtual": + return VIRTUAL; + default: + return new UpdateCardsResponseType(Value.UNKNOWN, value); + } + } + + public enum Value { + VIRTUAL, + + PHYSICAL, + + UNKNOWN + } + + public interface Visitor { + T visitVirtual(); + + T visitPhysical(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cardtransactions/AsyncCardTransactionsClient.java b/src/main/java/com/whop/api/resources/cardtransactions/AsyncCardTransactionsClient.java new file mode 100644 index 00000000..4e9a4557 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cardtransactions/AsyncCardTransactionsClient.java @@ -0,0 +1,88 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cardtransactions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.cardtransactions.requests.ListCardTransactionsRequest; +import com.whop.api.resources.cardtransactions.requests.RetrieveCardTransactionsRequest; +import com.whop.api.types.CardTransaction; +import java.util.concurrent.CompletableFuture; + +public class AsyncCardTransactionsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawCardTransactionsClient rawClient; + + public AsyncCardTransactionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawCardTransactionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawCardTransactionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public CompletableFuture> list(ListCardTransactionsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public CompletableFuture> list( + ListCardTransactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public CompletableFuture retrieve(String id, RetrieveCardTransactionsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public CompletableFuture retrieve( + String id, RetrieveCardTransactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/cardtransactions/AsyncRawCardTransactionsClient.java b/src/main/java/com/whop/api/resources/cardtransactions/AsyncRawCardTransactionsClient.java new file mode 100644 index 00000000..4a4120c2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cardtransactions/AsyncRawCardTransactionsClient.java @@ -0,0 +1,310 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cardtransactions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.cardtransactions.requests.ListCardTransactionsRequest; +import com.whop.api.resources.cardtransactions.requests.RetrieveCardTransactionsRequest; +import com.whop.api.resources.cardtransactions.types.ListCardTransactionsResponse; +import com.whop.api.types.CardTransaction; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawCardTransactionsClient { + protected final ClientOptions clientOptions; + + public AsyncRawCardTransactionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public CompletableFuture>> list() { + return list(ListCardTransactionsRequest.builder().build()); + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListCardTransactionsRequest.builder().build(), requestOptions); + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public CompletableFuture>> list( + ListCardTransactionsRequest request) { + return list(request, null); + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public CompletableFuture>> list( + ListCardTransactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("card_transactions"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getTransactionIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "transaction_ids", request.getTransactionIds().get(), true); + } + if (request.getCardId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "card_id", request.getCardId().get(), true); + } + if (request.getCardholderId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "cardholder_id", request.getCardholderId().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCardTransactionsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListCardTransactionsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListCardTransactionsRequest nextRequest = ListCardTransactionsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveCardTransactionsRequest.builder().build()); + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCardTransactionsRequest.builder().build(), requestOptions); + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public CompletableFuture> retrieve( + String id, RetrieveCardTransactionsRequest request) { + return retrieve(id, request, null); + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public CompletableFuture> retrieve( + String id, RetrieveCardTransactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("card_transactions") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CardTransaction.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/cardtransactions/CardTransactionsClient.java b/src/main/java/com/whop/api/resources/cardtransactions/CardTransactionsClient.java new file mode 100644 index 00000000..3f2dfd09 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cardtransactions/CardTransactionsClient.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cardtransactions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.cardtransactions.requests.ListCardTransactionsRequest; +import com.whop.api.resources.cardtransactions.requests.RetrieveCardTransactionsRequest; +import com.whop.api.types.CardTransaction; + +public class CardTransactionsClient { + protected final ClientOptions clientOptions; + + private final RawCardTransactionsClient rawClient; + + public CardTransactionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawCardTransactionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawCardTransactionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public SyncPagingIterable list(ListCardTransactionsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public SyncPagingIterable list( + ListCardTransactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public CardTransaction retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public CardTransaction retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public CardTransaction retrieve(String id, RetrieveCardTransactionsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public CardTransaction retrieve(String id, RetrieveCardTransactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/cardtransactions/RawCardTransactionsClient.java b/src/main/java/com/whop/api/resources/cardtransactions/RawCardTransactionsClient.java new file mode 100644 index 00000000..1685799b --- /dev/null +++ b/src/main/java/com/whop/api/resources/cardtransactions/RawCardTransactionsClient.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cardtransactions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.cardtransactions.requests.ListCardTransactionsRequest; +import com.whop.api.resources.cardtransactions.requests.RetrieveCardTransactionsRequest; +import com.whop.api.resources.cardtransactions.types.ListCardTransactionsResponse; +import com.whop.api.types.CardTransaction; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawCardTransactionsClient { + protected final ClientOptions clientOptions; + + public RawCardTransactionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public WhopApiHttpResponse> list() { + return list(ListCardTransactionsRequest.builder().build()); + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListCardTransactionsRequest.builder().build(), requestOptions); + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public WhopApiHttpResponse> list(ListCardTransactionsRequest request) { + return list(request, null); + } + + /** + * Lists an account's card transactions, newest first. Defaults to the account the credential belongs to. Covers every card the owner has ever had, including canceled cards and spend that predates a re-application, and team members only see transactions on the cards assigned to them. Pass transaction_ids to fetch specific transactions instead of paging for them. + */ + public WhopApiHttpResponse> list( + ListCardTransactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("card_transactions"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getTransactionIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "transaction_ids", request.getTransactionIds().get(), true); + } + if (request.getCardId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "card_id", request.getCardId().get(), true); + } + if (request.getCardholderId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "cardholder_id", request.getCardholderId().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCardTransactionsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCardTransactionsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListCardTransactionsRequest nextRequest = ListCardTransactionsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveCardTransactionsRequest.builder().build()); + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCardTransactionsRequest.builder().build(), requestOptions); + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveCardTransactionsRequest request) { + return retrieve(id, request, null); + } + + /** + * Fetches a single card transaction by its citx_ identifier. The owner defaults to the account the credential belongs to. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveCardTransactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("card_transactions") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CardTransaction.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/cardtransactions/requests/ListCardTransactionsRequest.java b/src/main/java/com/whop/api/resources/cardtransactions/requests/ListCardTransactionsRequest.java new file mode 100644 index 00000000..23869b73 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cardtransactions/requests/ListCardTransactionsRequest.java @@ -0,0 +1,520 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cardtransactions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.cardtransactions.types.ListCardTransactionsRequestDirection; +import com.whop.api.resources.cardtransactions.types.ListCardTransactionsRequestOrder; +import com.whop.api.resources.cardtransactions.types.ListCardTransactionsRequestStatus; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCardTransactionsRequest.Builder.class) +public final class ListCardTransactionsRequest { + private final Optional> transactionIds; + + private final Optional> cardId; + + private final Optional> cardholderId; + + private final Optional accountId; + + private final Optional status; + + private final Optional createdAfter; + + private final Optional createdBefore; + + private final Optional order; + + private final Optional direction; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListCardTransactionsRequest( + Optional> transactionIds, + Optional> cardId, + Optional> cardholderId, + Optional accountId, + Optional status, + Optional createdAfter, + Optional createdBefore, + Optional order, + Optional direction, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.transactionIds = transactionIds; + this.cardId = cardId; + this.cardholderId = cardholderId; + this.accountId = accountId; + this.status = status; + this.createdAfter = createdAfter; + this.createdBefore = createdBefore; + this.order = order; + this.direction = direction; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Return only these card transactions, each prefixed citx_. Repeat the parameter, or pass one comma-separated value. + */ + @JsonProperty("transaction_ids") + public Optional> getTransactionIds() { + return transactionIds; + } + + /** + * @return Return only transactions charged to these cards, each prefixed icrd_. + */ + @JsonProperty("card_id") + public Optional> getCardId() { + return cardId; + } + + /** + * @return Return only transactions on cards assigned to these users, each prefixed user_. + */ + @JsonProperty("cardholder_id") + public Optional> getCardholderId() { + return cardholderId; + } + + /** + * @return The account whose card transactions to list, prefixed biz_. Defaults to the credential's account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Return only transactions with this status. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Return only transactions authorized at or after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Return only transactions authorized at or before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return The field to sort by. Defaults to created_at. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return The sort direction. Defaults to desc. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return The number of card transactions to return. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns card transactions after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of card transactions to return, counting back from the end. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns card transactions before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCardTransactionsRequest && equalTo((ListCardTransactionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCardTransactionsRequest other) { + return transactionIds.equals(other.transactionIds) + && cardId.equals(other.cardId) + && cardholderId.equals(other.cardholderId) + && accountId.equals(other.accountId) + && status.equals(other.status) + && createdAfter.equals(other.createdAfter) + && createdBefore.equals(other.createdBefore) + && order.equals(other.order) + && direction.equals(other.direction) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.transactionIds, + this.cardId, + this.cardholderId, + this.accountId, + this.status, + this.createdAfter, + this.createdBefore, + this.order, + this.direction, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> transactionIds = Optional.empty(); + + private Optional> cardId = Optional.empty(); + + private Optional> cardholderId = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListCardTransactionsRequest other) { + transactionIds(other.getTransactionIds()); + cardId(other.getCardId()); + cardholderId(other.getCardholderId()); + accountId(other.getAccountId()); + status(other.getStatus()); + createdAfter(other.getCreatedAfter()); + createdBefore(other.getCreatedBefore()); + order(other.getOrder()); + direction(other.getDirection()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

Return only these card transactions, each prefixed citx_. Repeat the parameter, or pass one comma-separated value.

+ */ + @JsonSetter(value = "transaction_ids", nulls = Nulls.SKIP) + public Builder transactionIds(Optional> transactionIds) { + this.transactionIds = transactionIds; + return this; + } + + public Builder transactionIds(List transactionIds) { + this.transactionIds = Optional.ofNullable(transactionIds); + return this; + } + + public Builder transactionIds(String transactionIds) { + this.transactionIds = Optional.of(Collections.singletonList(transactionIds)); + return this; + } + + /** + *

Return only transactions charged to these cards, each prefixed icrd_.

+ */ + @JsonSetter(value = "card_id", nulls = Nulls.SKIP) + public Builder cardId(Optional> cardId) { + this.cardId = cardId; + return this; + } + + public Builder cardId(List cardId) { + this.cardId = Optional.ofNullable(cardId); + return this; + } + + public Builder cardId(String cardId) { + this.cardId = Optional.of(Collections.singletonList(cardId)); + return this; + } + + /** + *

Return only transactions on cards assigned to these users, each prefixed user_.

+ */ + @JsonSetter(value = "cardholder_id", nulls = Nulls.SKIP) + public Builder cardholderId(Optional> cardholderId) { + this.cardholderId = cardholderId; + return this; + } + + public Builder cardholderId(List cardholderId) { + this.cardholderId = Optional.ofNullable(cardholderId); + return this; + } + + public Builder cardholderId(String cardholderId) { + this.cardholderId = Optional.of(Collections.singletonList(cardholderId)); + return this; + } + + /** + *

The account whose card transactions to list, prefixed biz_. Defaults to the credential's account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Return only transactions with this status.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListCardTransactionsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Return only transactions authorized at or after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Return only transactions authorized at or before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

The field to sort by. Defaults to created_at.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListCardTransactionsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The sort direction. Defaults to desc.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListCardTransactionsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

The number of card transactions to return.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor; returns card transactions after this position.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The number of card transactions to return, counting back from the end.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

A cursor; returns card transactions before this position.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListCardTransactionsRequest build() { + return new ListCardTransactionsRequest( + transactionIds, + cardId, + cardholderId, + accountId, + status, + createdAfter, + createdBefore, + order, + direction, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cardtransactions/requests/RetrieveCardTransactionsRequest.java b/src/main/java/com/whop/api/resources/cardtransactions/requests/RetrieveCardTransactionsRequest.java new file mode 100644 index 00000000..78d9797e --- /dev/null +++ b/src/main/java/com/whop/api/resources/cardtransactions/requests/RetrieveCardTransactionsRequest.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cardtransactions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCardTransactionsRequest.Builder.class) +public final class RetrieveCardTransactionsRequest { + private final Optional accountId; + + private final Map additionalProperties; + + private RetrieveCardTransactionsRequest(Optional accountId, Map additionalProperties) { + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account that owns the transaction, prefixed biz_. Defaults to the credential's account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCardTransactionsRequest && equalTo((RetrieveCardTransactionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveCardTransactionsRequest other) { + return accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveCardTransactionsRequest other) { + accountId(other.getAccountId()); + return this; + } + + /** + *

The account that owns the transaction, prefixed biz_. Defaults to the credential's account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + public RetrieveCardTransactionsRequest build() { + return new RetrieveCardTransactionsRequest(accountId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cardtransactions/types/ListCardTransactionsRequestDirection.java b/src/main/java/com/whop/api/resources/cardtransactions/types/ListCardTransactionsRequestDirection.java new file mode 100644 index 00000000..f989a110 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cardtransactions/types/ListCardTransactionsRequestDirection.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cardtransactions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListCardTransactionsRequestDirection { + public static final ListCardTransactionsRequestDirection ASC = + new ListCardTransactionsRequestDirection(Value.ASC, "asc"); + + public static final ListCardTransactionsRequestDirection DESC = + new ListCardTransactionsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListCardTransactionsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListCardTransactionsRequestDirection + && this.string.equals(((ListCardTransactionsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListCardTransactionsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListCardTransactionsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cardtransactions/types/ListCardTransactionsRequestOrder.java b/src/main/java/com/whop/api/resources/cardtransactions/types/ListCardTransactionsRequestOrder.java new file mode 100644 index 00000000..f4b16e90 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cardtransactions/types/ListCardTransactionsRequestOrder.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cardtransactions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListCardTransactionsRequestOrder { + public static final ListCardTransactionsRequestOrder CREATED_AT = + new ListCardTransactionsRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListCardTransactionsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListCardTransactionsRequestOrder + && this.string.equals(((ListCardTransactionsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListCardTransactionsRequestOrder valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + default: + return new ListCardTransactionsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cardtransactions/types/ListCardTransactionsRequestStatus.java b/src/main/java/com/whop/api/resources/cardtransactions/types/ListCardTransactionsRequestStatus.java new file mode 100644 index 00000000..74673fd6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cardtransactions/types/ListCardTransactionsRequestStatus.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cardtransactions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListCardTransactionsRequestStatus { + public static final ListCardTransactionsRequestStatus DECLINED = + new ListCardTransactionsRequestStatus(Value.DECLINED, "declined"); + + public static final ListCardTransactionsRequestStatus PENDING = + new ListCardTransactionsRequestStatus(Value.PENDING, "pending"); + + public static final ListCardTransactionsRequestStatus COMPLETED = + new ListCardTransactionsRequestStatus(Value.COMPLETED, "completed"); + + public static final ListCardTransactionsRequestStatus REVERSED = + new ListCardTransactionsRequestStatus(Value.REVERSED, "reversed"); + + private final Value value; + + private final String string; + + ListCardTransactionsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListCardTransactionsRequestStatus + && this.string.equals(((ListCardTransactionsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DECLINED: + return visitor.visitDeclined(); + case PENDING: + return visitor.visitPending(); + case COMPLETED: + return visitor.visitCompleted(); + case REVERSED: + return visitor.visitReversed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListCardTransactionsRequestStatus valueOf(String value) { + switch (value) { + case "declined": + return DECLINED; + case "pending": + return PENDING; + case "completed": + return COMPLETED; + case "reversed": + return REVERSED; + default: + return new ListCardTransactionsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + COMPLETED, + + REVERSED, + + DECLINED, + + UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitCompleted(); + + T visitReversed(); + + T visitDeclined(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/cardtransactions/types/ListCardTransactionsResponse.java b/src/main/java/com/whop/api/resources/cardtransactions/types/ListCardTransactionsResponse.java new file mode 100644 index 00000000..c969f67a --- /dev/null +++ b/src/main/java/com/whop/api/resources/cardtransactions/types/ListCardTransactionsResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cardtransactions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CardTransaction; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCardTransactionsResponse.Builder.class) +public final class ListCardTransactionsResponse { + private final List data; + + private final ListCardTransactionsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListCardTransactionsResponse( + List data, + ListCardTransactionsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListCardTransactionsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCardTransactionsResponse && equalTo((ListCardTransactionsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCardTransactionsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListCardTransactionsResponsePageInfo pageInfo); + + Builder from(ListCardTransactionsResponse other); + } + + public interface _FinalStage { + ListCardTransactionsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(CardTransaction data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListCardTransactionsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCardTransactionsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListCardTransactionsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(CardTransaction data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListCardTransactionsResponse build() { + return new ListCardTransactionsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/cardtransactions/types/ListCardTransactionsResponsePageInfo.java b/src/main/java/com/whop/api/resources/cardtransactions/types/ListCardTransactionsResponsePageInfo.java new file mode 100644 index 00000000..0069b8f3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/cardtransactions/types/ListCardTransactionsResponsePageInfo.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.cardtransactions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCardTransactionsResponsePageInfo.Builder.class) +public final class ListCardTransactionsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListCardTransactionsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCardTransactionsResponsePageInfo + && equalTo((ListCardTransactionsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCardTransactionsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListCardTransactionsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListCardTransactionsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCardTransactionsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListCardTransactionsResponsePageInfo build() { + return new ListCardTransactionsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/chatchannels/AsyncChatChannelsClient.java b/src/main/java/com/whop/api/resources/chatchannels/AsyncChatChannelsClient.java new file mode 100644 index 00000000..8bb6860e --- /dev/null +++ b/src/main/java/com/whop/api/resources/chatchannels/AsyncChatChannelsClient.java @@ -0,0 +1,145 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.chatchannels; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.chatchannels.requests.ListChatChannelsRequest; +import com.whop.api.resources.chatchannels.requests.RetrieveChatChannelsRequest; +import com.whop.api.resources.chatchannels.requests.UpdateChatChannelsRequest; +import com.whop.api.types.ChatChannel; +import com.whop.api.types.ChatChannelListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncChatChannelsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawChatChannelsClient rawClient; + + public AsyncChatChannelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawChatChannelsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawChatChannelsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of chat channels within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public CompletableFuture> list(ListChatChannelsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of chat channels within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public CompletableFuture> list( + ListChatChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveChatChannelsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveChatChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public CompletableFuture update(String id, UpdateChatChannelsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public CompletableFuture update( + String id, UpdateChatChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/chatchannels/AsyncRawChatChannelsClient.java b/src/main/java/com/whop/api/resources/chatchannels/AsyncRawChatChannelsClient.java new file mode 100644 index 00000000..d59666fc --- /dev/null +++ b/src/main/java/com/whop/api/resources/chatchannels/AsyncRawChatChannelsClient.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.chatchannels; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.chatchannels.requests.ListChatChannelsRequest; +import com.whop.api.resources.chatchannels.requests.RetrieveChatChannelsRequest; +import com.whop.api.resources.chatchannels.requests.UpdateChatChannelsRequest; +import com.whop.api.resources.chatchannels.types.ListChatChannelsResponse; +import com.whop.api.types.ChatChannel; +import com.whop.api.types.ChatChannelListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawChatChannelsClient { + protected final ClientOptions clientOptions; + + public AsyncRawChatChannelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of chat channels within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public CompletableFuture>> list( + ListChatChannelsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of chat channels within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public CompletableFuture>> list( + ListChatChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("chat_channels"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getProductId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_id", request.getProductId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListChatChannelsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListChatChannelsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListChatChannelsRequest nextRequest = ListChatChannelsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveChatChannelsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveChatChannelsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveChatChannelsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveChatChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("chat_channels") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ChatChannel.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public CompletableFuture> update(String id) { + return update(id, UpdateChatChannelsRequest.builder().build()); + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateChatChannelsRequest.builder().build(), requestOptions); + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public CompletableFuture> update(String id, UpdateChatChannelsRequest request) { + return update(id, request, null); + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public CompletableFuture> update( + String id, UpdateChatChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("chat_channels") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ChatChannel.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/chatchannels/ChatChannelsClient.java b/src/main/java/com/whop/api/resources/chatchannels/ChatChannelsClient.java new file mode 100644 index 00000000..50cc7372 --- /dev/null +++ b/src/main/java/com/whop/api/resources/chatchannels/ChatChannelsClient.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.chatchannels; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.chatchannels.requests.ListChatChannelsRequest; +import com.whop.api.resources.chatchannels.requests.RetrieveChatChannelsRequest; +import com.whop.api.resources.chatchannels.requests.UpdateChatChannelsRequest; +import com.whop.api.types.ChatChannel; +import com.whop.api.types.ChatChannelListItem; + +public class ChatChannelsClient { + protected final ClientOptions clientOptions; + + private final RawChatChannelsClient rawClient; + + public ChatChannelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawChatChannelsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawChatChannelsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of chat channels within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public SyncPagingIterable list(ListChatChannelsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of chat channels within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public SyncPagingIterable list( + ListChatChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public ChatChannel retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public ChatChannel retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public ChatChannel retrieve(String id, RetrieveChatChannelsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public ChatChannel retrieve(String id, RetrieveChatChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public ChatChannel update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public ChatChannel update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public ChatChannel update(String id, UpdateChatChannelsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public ChatChannel update(String id, UpdateChatChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/chatchannels/RawChatChannelsClient.java b/src/main/java/com/whop/api/resources/chatchannels/RawChatChannelsClient.java new file mode 100644 index 00000000..55e75530 --- /dev/null +++ b/src/main/java/com/whop/api/resources/chatchannels/RawChatChannelsClient.java @@ -0,0 +1,372 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.chatchannels; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.chatchannels.requests.ListChatChannelsRequest; +import com.whop.api.resources.chatchannels.requests.RetrieveChatChannelsRequest; +import com.whop.api.resources.chatchannels.requests.UpdateChatChannelsRequest; +import com.whop.api.resources.chatchannels.types.ListChatChannelsResponse; +import com.whop.api.types.ChatChannel; +import com.whop.api.types.ChatChannelListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawChatChannelsClient { + protected final ClientOptions clientOptions; + + public RawChatChannelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of chat channels within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListChatChannelsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of chat channels within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListChatChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("chat_channels"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getProductId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_id", request.getProductId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListChatChannelsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListChatChannelsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListChatChannelsRequest nextRequest = ListChatChannelsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveChatChannelsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveChatChannelsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveChatChannelsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing chat channel. + *

Required permissions:

+ *
    + *
  • chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveChatChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("chat_channels") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ChatChannel.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateChatChannelsRequest.builder().build()); + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateChatChannelsRequest.builder().build(), requestOptions); + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateChatChannelsRequest request) { + return update(id, request, null); + } + + /** + * Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions. + *

Required permissions:

+ *
    + *
  • chat:moderate
  • + *
+ */ + public WhopApiHttpResponse update( + String id, UpdateChatChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("chat_channels") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ChatChannel.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/chatchannels/requests/ListChatChannelsRequest.java b/src/main/java/com/whop/api/resources/chatchannels/requests/ListChatChannelsRequest.java new file mode 100644 index 00000000..4c028f10 --- /dev/null +++ b/src/main/java/com/whop/api/resources/chatchannels/requests/ListChatChannelsRequest.java @@ -0,0 +1,348 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.chatchannels.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListChatChannelsRequest.Builder.class) +public final class ListChatChannelsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String companyId; + + private final Optional productId; + + private final Map additionalProperties; + + private ListChatChannelsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String companyId, + Optional productId, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.productId = productId; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to list chat channels for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return The unique identifier of a product to filter by. When set, only chat channels connected to this product are returned. + */ + @JsonProperty("product_id") + public Optional getProductId() { + return productId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListChatChannelsRequest && equalTo((ListChatChannelsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListChatChannelsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId) + && productId.equals(other.productId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last, this.companyId, this.productId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to list chat channels for.

+ */ + _FinalStage companyId(@NotNull String companyId); + + Builder from(ListChatChannelsRequest other); + } + + public interface _FinalStage { + ListChatChannelsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + /** + *

The unique identifier of a product to filter by. When set, only chat channels connected to this product are returned.

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional productId = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListChatChannelsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + productId(other.getProductId()); + return this; + } + + /** + *

The unique identifier of the company to list chat channels for.

+ *

The unique identifier of the company to list chat channels for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The unique identifier of a product to filter by. When set, only chat channels connected to this product are returned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

The unique identifier of a product to filter by. When set, only chat channels connected to this product are returned.

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListChatChannelsRequest build() { + return new ListChatChannelsRequest(after, before, first, last, companyId, productId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/chatchannels/requests/RetrieveChatChannelsRequest.java b/src/main/java/com/whop/api/resources/chatchannels/requests/RetrieveChatChannelsRequest.java new file mode 100644 index 00000000..05c43da7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/chatchannels/requests/RetrieveChatChannelsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.chatchannels.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveChatChannelsRequest.Builder.class) +public final class RetrieveChatChannelsRequest { + private final Map additionalProperties; + + private RetrieveChatChannelsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveChatChannelsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveChatChannelsRequest other) { + return this; + } + + public RetrieveChatChannelsRequest build() { + return new RetrieveChatChannelsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/chatchannels/requests/UpdateChatChannelsRequest.java b/src/main/java/com/whop/api/resources/chatchannels/requests/UpdateChatChannelsRequest.java new file mode 100644 index 00000000..dbd5894d --- /dev/null +++ b/src/main/java/com/whop/api/resources/chatchannels/requests/UpdateChatChannelsRequest.java @@ -0,0 +1,402 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.chatchannels.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.WhoCanPostTypes; +import com.whop.api.types.WhoCanReactTypes; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateChatChannelsRequest.Builder.class) +public final class UpdateChatChannelsRequest { + private final Optional banMedia; + + private final Optional banUrls; + + private final Optional> bannedWords; + + private final Optional userPostsCooldownSeconds; + + private final Optional whoCanPost; + + private final Optional whoCanReact; + + private final Map additionalProperties; + + private UpdateChatChannelsRequest( + Optional banMedia, + Optional banUrls, + Optional> bannedWords, + Optional userPostsCooldownSeconds, + Optional whoCanPost, + Optional whoCanReact, + Map additionalProperties) { + this.banMedia = banMedia; + this.banUrls = banUrls; + this.bannedWords = bannedWords; + this.userPostsCooldownSeconds = userPostsCooldownSeconds; + this.whoCanPost = whoCanPost; + this.whoCanReact = whoCanReact; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether media uploads such as images and videos are banned in this chat channel. + */ + @JsonIgnore + public Optional getBanMedia() { + if (banMedia == null) { + return Optional.empty(); + } + return banMedia; + } + + /** + * @return Whether URLs and links are banned from being posted in this chat channel. + */ + @JsonIgnore + public Optional getBanUrls() { + if (banUrls == null) { + return Optional.empty(); + } + return banUrls; + } + + /** + * @return A list of words that are automatically blocked from messages in this chat channel. For example, ['spam', 'scam']. + */ + @JsonIgnore + public Optional> getBannedWords() { + if (bannedWords == null) { + return Optional.empty(); + } + return bannedWords; + } + + /** + * @return The minimum number of seconds a user must wait between sending messages in this chat channel. + */ + @JsonIgnore + public Optional getUserPostsCooldownSeconds() { + if (userPostsCooldownSeconds == null) { + return Optional.empty(); + } + return userPostsCooldownSeconds; + } + + /** + * @return Controls which roles are allowed to send messages in this chat channel. + */ + @JsonIgnore + public Optional getWhoCanPost() { + if (whoCanPost == null) { + return Optional.empty(); + } + return whoCanPost; + } + + /** + * @return Controls which roles are allowed to add reactions to messages in this chat channel. + */ + @JsonIgnore + public Optional getWhoCanReact() { + if (whoCanReact == null) { + return Optional.empty(); + } + return whoCanReact; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ban_media") + private Optional _getBanMedia() { + return banMedia; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ban_urls") + private Optional _getBanUrls() { + return banUrls; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("banned_words") + private Optional> _getBannedWords() { + return bannedWords; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_posts_cooldown_seconds") + private Optional _getUserPostsCooldownSeconds() { + return userPostsCooldownSeconds; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("who_can_post") + private Optional _getWhoCanPost() { + return whoCanPost; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("who_can_react") + private Optional _getWhoCanReact() { + return whoCanReact; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateChatChannelsRequest && equalTo((UpdateChatChannelsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateChatChannelsRequest other) { + return banMedia.equals(other.banMedia) + && banUrls.equals(other.banUrls) + && bannedWords.equals(other.bannedWords) + && userPostsCooldownSeconds.equals(other.userPostsCooldownSeconds) + && whoCanPost.equals(other.whoCanPost) + && whoCanReact.equals(other.whoCanReact); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.banMedia, + this.banUrls, + this.bannedWords, + this.userPostsCooldownSeconds, + this.whoCanPost, + this.whoCanReact); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional banMedia = Optional.empty(); + + private Optional banUrls = Optional.empty(); + + private Optional> bannedWords = Optional.empty(); + + private Optional userPostsCooldownSeconds = Optional.empty(); + + private Optional whoCanPost = Optional.empty(); + + private Optional whoCanReact = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateChatChannelsRequest other) { + banMedia(other.getBanMedia()); + banUrls(other.getBanUrls()); + bannedWords(other.getBannedWords()); + userPostsCooldownSeconds(other.getUserPostsCooldownSeconds()); + whoCanPost(other.getWhoCanPost()); + whoCanReact(other.getWhoCanReact()); + return this; + } + + /** + *

Whether media uploads such as images and videos are banned in this chat channel.

+ */ + @JsonSetter(value = "ban_media", nulls = Nulls.SKIP) + public Builder banMedia(Optional banMedia) { + this.banMedia = banMedia; + return this; + } + + public Builder banMedia(Boolean banMedia) { + this.banMedia = Optional.ofNullable(banMedia); + return this; + } + + public Builder banMedia(Nullable banMedia) { + if (banMedia.isNull()) { + this.banMedia = null; + } else if (banMedia.isEmpty()) { + this.banMedia = Optional.empty(); + } else { + this.banMedia = Optional.of(banMedia.get()); + } + return this; + } + + /** + *

Whether URLs and links are banned from being posted in this chat channel.

+ */ + @JsonSetter(value = "ban_urls", nulls = Nulls.SKIP) + public Builder banUrls(Optional banUrls) { + this.banUrls = banUrls; + return this; + } + + public Builder banUrls(Boolean banUrls) { + this.banUrls = Optional.ofNullable(banUrls); + return this; + } + + public Builder banUrls(Nullable banUrls) { + if (banUrls.isNull()) { + this.banUrls = null; + } else if (banUrls.isEmpty()) { + this.banUrls = Optional.empty(); + } else { + this.banUrls = Optional.of(banUrls.get()); + } + return this; + } + + /** + *

A list of words that are automatically blocked from messages in this chat channel. For example, ['spam', 'scam'].

+ */ + @JsonSetter(value = "banned_words", nulls = Nulls.SKIP) + public Builder bannedWords(Optional> bannedWords) { + this.bannedWords = bannedWords; + return this; + } + + public Builder bannedWords(List bannedWords) { + this.bannedWords = Optional.ofNullable(bannedWords); + return this; + } + + public Builder bannedWords(Nullable> bannedWords) { + if (bannedWords.isNull()) { + this.bannedWords = null; + } else if (bannedWords.isEmpty()) { + this.bannedWords = Optional.empty(); + } else { + this.bannedWords = Optional.of(bannedWords.get()); + } + return this; + } + + /** + *

The minimum number of seconds a user must wait between sending messages in this chat channel.

+ */ + @JsonSetter(value = "user_posts_cooldown_seconds", nulls = Nulls.SKIP) + public Builder userPostsCooldownSeconds(Optional userPostsCooldownSeconds) { + this.userPostsCooldownSeconds = userPostsCooldownSeconds; + return this; + } + + public Builder userPostsCooldownSeconds(Integer userPostsCooldownSeconds) { + this.userPostsCooldownSeconds = Optional.ofNullable(userPostsCooldownSeconds); + return this; + } + + public Builder userPostsCooldownSeconds(Nullable userPostsCooldownSeconds) { + if (userPostsCooldownSeconds.isNull()) { + this.userPostsCooldownSeconds = null; + } else if (userPostsCooldownSeconds.isEmpty()) { + this.userPostsCooldownSeconds = Optional.empty(); + } else { + this.userPostsCooldownSeconds = Optional.of(userPostsCooldownSeconds.get()); + } + return this; + } + + /** + *

Controls which roles are allowed to send messages in this chat channel.

+ */ + @JsonSetter(value = "who_can_post", nulls = Nulls.SKIP) + public Builder whoCanPost(Optional whoCanPost) { + this.whoCanPost = whoCanPost; + return this; + } + + public Builder whoCanPost(WhoCanPostTypes whoCanPost) { + this.whoCanPost = Optional.ofNullable(whoCanPost); + return this; + } + + public Builder whoCanPost(Nullable whoCanPost) { + if (whoCanPost.isNull()) { + this.whoCanPost = null; + } else if (whoCanPost.isEmpty()) { + this.whoCanPost = Optional.empty(); + } else { + this.whoCanPost = Optional.of(whoCanPost.get()); + } + return this; + } + + /** + *

Controls which roles are allowed to add reactions to messages in this chat channel.

+ */ + @JsonSetter(value = "who_can_react", nulls = Nulls.SKIP) + public Builder whoCanReact(Optional whoCanReact) { + this.whoCanReact = whoCanReact; + return this; + } + + public Builder whoCanReact(WhoCanReactTypes whoCanReact) { + this.whoCanReact = Optional.ofNullable(whoCanReact); + return this; + } + + public Builder whoCanReact(Nullable whoCanReact) { + if (whoCanReact.isNull()) { + this.whoCanReact = null; + } else if (whoCanReact.isEmpty()) { + this.whoCanReact = Optional.empty(); + } else { + this.whoCanReact = Optional.of(whoCanReact.get()); + } + return this; + } + + public UpdateChatChannelsRequest build() { + return new UpdateChatChannelsRequest( + banMedia, + banUrls, + bannedWords, + userPostsCooldownSeconds, + whoCanPost, + whoCanReact, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/chatchannels/types/ListChatChannelsResponse.java b/src/main/java/com/whop/api/resources/chatchannels/types/ListChatChannelsResponse.java new file mode 100644 index 00000000..7e3c308d --- /dev/null +++ b/src/main/java/com/whop/api/resources/chatchannels/types/ListChatChannelsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.chatchannels.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.ChatChannelListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListChatChannelsResponse.Builder.class) +public final class ListChatChannelsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListChatChannelsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListChatChannelsResponse && equalTo((ListChatChannelsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListChatChannelsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListChatChannelsResponse other); + } + + public interface _FinalStage { + ListChatChannelsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(ChatChannelListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListChatChannelsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(ChatChannelListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListChatChannelsResponse build() { + return new ListChatChannelsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/AsyncCheckoutConfigurationsClient.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/AsyncCheckoutConfigurationsClient.java new file mode 100644 index 00000000..4a5899a8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/AsyncCheckoutConfigurationsClient.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.checkoutconfigurations.requests.CreateCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.requests.DeleteCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.requests.ListCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.requests.RetrieveCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.types.CreateCheckoutConfigurationsResponse; +import com.whop.api.resources.checkoutconfigurations.types.DeleteCheckoutConfigurationsResponse; +import com.whop.api.resources.checkoutconfigurations.types.ListCheckoutConfigurationsResponseDataItem; +import com.whop.api.resources.checkoutconfigurations.types.RetrieveCheckoutConfigurationsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncCheckoutConfigurationsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawCheckoutConfigurationsClient rawClient; + + public AsyncCheckoutConfigurationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawCheckoutConfigurationsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawCheckoutConfigurationsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists checkout configurations for an account. + */ + public CompletableFuture> list( + ListCheckoutConfigurationsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists checkout configurations for an account. + */ + public CompletableFuture> list( + ListCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public CompletableFuture create() { + return this.rawClient.create().thenApply(response -> response.body()); + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public CompletableFuture create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public CompletableFuture create(CreateCheckoutConfigurationsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public CompletableFuture create( + CreateCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public CompletableFuture retrieve( + String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public CompletableFuture retrieve( + String id, RetrieveCheckoutConfigurationsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public CompletableFuture retrieve( + String id, RetrieveCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public CompletableFuture delete( + String id, DeleteCheckoutConfigurationsRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public CompletableFuture delete( + String id, DeleteCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/AsyncRawCheckoutConfigurationsClient.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/AsyncRawCheckoutConfigurationsClient.java new file mode 100644 index 00000000..666e4e36 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/AsyncRawCheckoutConfigurationsClient.java @@ -0,0 +1,456 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.checkoutconfigurations.requests.CreateCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.requests.DeleteCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.requests.ListCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.requests.RetrieveCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.types.CreateCheckoutConfigurationsResponse; +import com.whop.api.resources.checkoutconfigurations.types.DeleteCheckoutConfigurationsResponse; +import com.whop.api.resources.checkoutconfigurations.types.ListCheckoutConfigurationsResponse; +import com.whop.api.resources.checkoutconfigurations.types.ListCheckoutConfigurationsResponseDataItem; +import com.whop.api.resources.checkoutconfigurations.types.RetrieveCheckoutConfigurationsResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawCheckoutConfigurationsClient { + protected final ClientOptions clientOptions; + + public AsyncRawCheckoutConfigurationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists checkout configurations for an account. + */ + public CompletableFuture>> list( + ListCheckoutConfigurationsRequest request) { + return list(request, null); + } + + /** + * Lists checkout configurations for an account. + */ + public CompletableFuture>> list( + ListCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("checkout_configurations"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getPlanId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_id", request.getPlanId().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCheckoutConfigurationsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListCheckoutConfigurationsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListCheckoutConfigurationsRequest nextRequest = ListCheckoutConfigurationsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public CompletableFuture> create() { + return create(CreateCheckoutConfigurationsRequest.builder().build()); + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public CompletableFuture> create( + RequestOptions requestOptions) { + return create(CreateCheckoutConfigurationsRequest.builder().build(), requestOptions); + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public CompletableFuture> create( + CreateCheckoutConfigurationsRequest request) { + return create(request, null); + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public CompletableFuture> create( + CreateCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("checkout_configurations"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CreateCheckoutConfigurationsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveCheckoutConfigurationsRequest.builder().build()); + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCheckoutConfigurationsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public CompletableFuture> retrieve( + String id, RetrieveCheckoutConfigurationsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public CompletableFuture> retrieve( + String id, RetrieveCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("checkout_configurations") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, RetrieveCheckoutConfigurationsResponse.class), + response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteCheckoutConfigurationsRequest.builder().build()); + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public CompletableFuture> delete( + String id, RequestOptions requestOptions) { + return delete(id, DeleteCheckoutConfigurationsRequest.builder().build(), requestOptions); + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public CompletableFuture> delete( + String id, DeleteCheckoutConfigurationsRequest request) { + return delete(id, request, null); + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public CompletableFuture> delete( + String id, DeleteCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("checkout_configurations") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DeleteCheckoutConfigurationsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/CheckoutConfigurationsClient.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/CheckoutConfigurationsClient.java new file mode 100644 index 00000000..d9a18e9a --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/CheckoutConfigurationsClient.java @@ -0,0 +1,137 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.checkoutconfigurations.requests.CreateCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.requests.DeleteCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.requests.ListCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.requests.RetrieveCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.types.CreateCheckoutConfigurationsResponse; +import com.whop.api.resources.checkoutconfigurations.types.DeleteCheckoutConfigurationsResponse; +import com.whop.api.resources.checkoutconfigurations.types.ListCheckoutConfigurationsResponseDataItem; +import com.whop.api.resources.checkoutconfigurations.types.RetrieveCheckoutConfigurationsResponse; + +public class CheckoutConfigurationsClient { + protected final ClientOptions clientOptions; + + private final RawCheckoutConfigurationsClient rawClient; + + public CheckoutConfigurationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawCheckoutConfigurationsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawCheckoutConfigurationsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists checkout configurations for an account. + */ + public SyncPagingIterable list( + ListCheckoutConfigurationsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists checkout configurations for an account. + */ + public SyncPagingIterable list( + ListCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public CreateCheckoutConfigurationsResponse create() { + return this.rawClient.create().body(); + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public CreateCheckoutConfigurationsResponse create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).body(); + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public CreateCheckoutConfigurationsResponse create(CreateCheckoutConfigurationsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public CreateCheckoutConfigurationsResponse create( + CreateCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public RetrieveCheckoutConfigurationsResponse retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public RetrieveCheckoutConfigurationsResponse retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public RetrieveCheckoutConfigurationsResponse retrieve(String id, RetrieveCheckoutConfigurationsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public RetrieveCheckoutConfigurationsResponse retrieve( + String id, RetrieveCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public DeleteCheckoutConfigurationsResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public DeleteCheckoutConfigurationsResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public DeleteCheckoutConfigurationsResponse delete(String id, DeleteCheckoutConfigurationsRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public DeleteCheckoutConfigurationsResponse delete( + String id, DeleteCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/RawCheckoutConfigurationsClient.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/RawCheckoutConfigurationsClient.java new file mode 100644 index 00000000..66bbe0f7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/RawCheckoutConfigurationsClient.java @@ -0,0 +1,375 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.checkoutconfigurations.requests.CreateCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.requests.DeleteCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.requests.ListCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.requests.RetrieveCheckoutConfigurationsRequest; +import com.whop.api.resources.checkoutconfigurations.types.CreateCheckoutConfigurationsResponse; +import com.whop.api.resources.checkoutconfigurations.types.DeleteCheckoutConfigurationsResponse; +import com.whop.api.resources.checkoutconfigurations.types.ListCheckoutConfigurationsResponse; +import com.whop.api.resources.checkoutconfigurations.types.ListCheckoutConfigurationsResponseDataItem; +import com.whop.api.resources.checkoutconfigurations.types.RetrieveCheckoutConfigurationsResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawCheckoutConfigurationsClient { + protected final ClientOptions clientOptions; + + public RawCheckoutConfigurationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists checkout configurations for an account. + */ + public WhopApiHttpResponse> list( + ListCheckoutConfigurationsRequest request) { + return list(request, null); + } + + /** + * Lists checkout configurations for an account. + */ + public WhopApiHttpResponse> list( + ListCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("checkout_configurations"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getPlanId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_id", request.getPlanId().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCheckoutConfigurationsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListCheckoutConfigurationsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListCheckoutConfigurationsRequest nextRequest = ListCheckoutConfigurationsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public WhopApiHttpResponse create() { + return create(CreateCheckoutConfigurationsRequest.builder().build()); + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public WhopApiHttpResponse create(RequestOptions requestOptions) { + return create(CreateCheckoutConfigurationsRequest.builder().build(), requestOptions); + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public WhopApiHttpResponse create( + CreateCheckoutConfigurationsRequest request) { + return create(request, null); + } + + /** + * Creates a reusable checkout configuration for an existing or inline plan. + */ + public WhopApiHttpResponse create( + CreateCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("checkout_configurations"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CreateCheckoutConfigurationsResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveCheckoutConfigurationsRequest.builder().build()); + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public WhopApiHttpResponse retrieve( + String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCheckoutConfigurationsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveCheckoutConfigurationsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("checkout_configurations") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, RetrieveCheckoutConfigurationsResponse.class), + response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteCheckoutConfigurationsRequest.builder().build()); + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteCheckoutConfigurationsRequest.builder().build(), requestOptions); + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public WhopApiHttpResponse delete( + String id, DeleteCheckoutConfigurationsRequest request) { + return delete(id, request, null); + } + + /** + * Deletes a checkout configuration so its checkout URL can no longer be used. + */ + public WhopApiHttpResponse delete( + String id, DeleteCheckoutConfigurationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("checkout_configurations") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DeleteCheckoutConfigurationsResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/requests/CreateCheckoutConfigurationsRequest.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/requests/CreateCheckoutConfigurationsRequest.java new file mode 100644 index 00000000..9dab3484 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/requests/CreateCheckoutConfigurationsRequest.java @@ -0,0 +1,576 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.checkoutconfigurations.types.CreateCheckoutConfigurationsRequestMode; +import com.whop.api.resources.checkoutconfigurations.types.CreateCheckoutConfigurationsRequestPaymentMethodConfiguration; +import com.whop.api.resources.checkoutconfigurations.types.CreateCheckoutConfigurationsRequestPlan; +import com.whop.api.resources.checkoutconfigurations.types.CreateCheckoutConfigurationsRequestThreeDsLevel; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCheckoutConfigurationsRequest.Builder.class) +public final class CreateCheckoutConfigurationsRequest { + private final Optional accountId; + + private final Optional affiliateCode; + + private final Optional currency; + + private final Optional> metadata; + + private final Optional mode; + + private final Optional paymentMethodConfiguration; + + private final Optional plan; + + private final Optional planId; + + private final Optional redirectUrl; + + private final Optional threeDsLevel; + + private final Map additionalProperties; + + private CreateCheckoutConfigurationsRequest( + Optional accountId, + Optional affiliateCode, + Optional currency, + Optional> metadata, + Optional mode, + Optional paymentMethodConfiguration, + Optional plan, + Optional planId, + Optional redirectUrl, + Optional threeDsLevel, + Map additionalProperties) { + this.accountId = accountId; + this.affiliateCode = affiliateCode; + this.currency = currency; + this.metadata = metadata; + this.mode = mode; + this.paymentMethodConfiguration = paymentMethodConfiguration; + this.plan = plan; + this.planId = planId; + this.redirectUrl = redirectUrl; + this.threeDsLevel = threeDsLevel; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Affiliate code to apply to the checkout. + */ + @JsonIgnore + public Optional getAffiliateCode() { + if (affiliateCode == null) { + return Optional.empty(); + } + return affiliateCode; + } + + /** + * @return Currency used for setup-mode payment method availability. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return Custom key-value metadata copied to payments and memberships. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Controls whether checkout charges the buyer immediately or saves payment details for later. Defaults to payment. + */ + @JsonProperty("mode") + public Optional getMode() { + return mode; + } + + /** + * @return Payment method overrides for this checkout. null uses the plan or platform defaults. + */ + @JsonIgnore + public Optional getPaymentMethodConfiguration() { + if (paymentMethodConfiguration == null) { + return Optional.empty(); + } + return paymentMethodConfiguration; + } + + /** + * @return Plan attributes used to create or find a plan for this checkout configuration. Mutually exclusive with plan_id. + */ + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + /** + * @return Existing plan ID, prefixed plan_. Mutually exclusive with plan. + */ + @JsonIgnore + public Optional getPlanId() { + if (planId == null) { + return Optional.empty(); + } + return planId; + } + + /** + * @return URL customers are sent to after checkout. + */ + @JsonIgnore + public Optional getRedirectUrl() { + if (redirectUrl == null) { + return Optional.empty(); + } + return redirectUrl; + } + + /** + * @return 3D Secure behavior for this checkout. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("affiliate_code") + private Optional _getAffiliateCode() { + return affiliateCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_configuration") + private Optional _getPaymentMethodConfiguration() { + return paymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan_id") + private Optional _getPlanId() { + return planId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("redirect_url") + private Optional _getRedirectUrl() { + return redirectUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCheckoutConfigurationsRequest + && equalTo((CreateCheckoutConfigurationsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCheckoutConfigurationsRequest other) { + return accountId.equals(other.accountId) + && affiliateCode.equals(other.affiliateCode) + && currency.equals(other.currency) + && metadata.equals(other.metadata) + && mode.equals(other.mode) + && paymentMethodConfiguration.equals(other.paymentMethodConfiguration) + && plan.equals(other.plan) + && planId.equals(other.planId) + && redirectUrl.equals(other.redirectUrl) + && threeDsLevel.equals(other.threeDsLevel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.affiliateCode, + this.currency, + this.metadata, + this.mode, + this.paymentMethodConfiguration, + this.plan, + this.planId, + this.redirectUrl, + this.threeDsLevel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional affiliateCode = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional mode = Optional.empty(); + + private Optional paymentMethodConfiguration = + Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional planId = Optional.empty(); + + private Optional redirectUrl = Optional.empty(); + + private Optional threeDsLevel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateCheckoutConfigurationsRequest other) { + accountId(other.getAccountId()); + affiliateCode(other.getAffiliateCode()); + currency(other.getCurrency()); + metadata(other.getMetadata()); + mode(other.getMode()); + paymentMethodConfiguration(other.getPaymentMethodConfiguration()); + plan(other.getPlan()); + planId(other.getPlanId()); + redirectUrl(other.getRedirectUrl()); + threeDsLevel(other.getThreeDsLevel()); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Affiliate code to apply to the checkout.

+ */ + @JsonSetter(value = "affiliate_code", nulls = Nulls.SKIP) + public Builder affiliateCode(Optional affiliateCode) { + this.affiliateCode = affiliateCode; + return this; + } + + public Builder affiliateCode(String affiliateCode) { + this.affiliateCode = Optional.ofNullable(affiliateCode); + return this; + } + + public Builder affiliateCode(Nullable affiliateCode) { + if (affiliateCode.isNull()) { + this.affiliateCode = null; + } else if (affiliateCode.isEmpty()) { + this.affiliateCode = Optional.empty(); + } else { + this.affiliateCode = Optional.of(affiliateCode.get()); + } + return this; + } + + /** + *

Currency used for setup-mode payment method availability.

+ */ + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional currency) { + this.currency = currency; + return this; + } + + public Builder currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + public Builder currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

Custom key-value metadata copied to payments and memberships.

+ */ + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + public Builder metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Controls whether checkout charges the buyer immediately or saves payment details for later. Defaults to payment.

+ */ + @JsonSetter(value = "mode", nulls = Nulls.SKIP) + public Builder mode(Optional mode) { + this.mode = mode; + return this; + } + + public Builder mode(CreateCheckoutConfigurationsRequestMode mode) { + this.mode = Optional.ofNullable(mode); + return this; + } + + /** + *

Payment method overrides for this checkout. null uses the plan or platform defaults.

+ */ + @JsonSetter(value = "payment_method_configuration", nulls = Nulls.SKIP) + public Builder paymentMethodConfiguration( + Optional paymentMethodConfiguration) { + this.paymentMethodConfiguration = paymentMethodConfiguration; + return this; + } + + public Builder paymentMethodConfiguration( + CreateCheckoutConfigurationsRequestPaymentMethodConfiguration paymentMethodConfiguration) { + this.paymentMethodConfiguration = Optional.ofNullable(paymentMethodConfiguration); + return this; + } + + public Builder paymentMethodConfiguration( + Nullable paymentMethodConfiguration) { + if (paymentMethodConfiguration.isNull()) { + this.paymentMethodConfiguration = null; + } else if (paymentMethodConfiguration.isEmpty()) { + this.paymentMethodConfiguration = Optional.empty(); + } else { + this.paymentMethodConfiguration = Optional.of(paymentMethodConfiguration.get()); + } + return this; + } + + /** + *

Plan attributes used to create or find a plan for this checkout configuration. Mutually exclusive with plan_id.

+ */ + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public Builder plan(Optional plan) { + this.plan = plan; + return this; + } + + public Builder plan(CreateCheckoutConfigurationsRequestPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + public Builder plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + /** + *

Existing plan ID, prefixed plan_. Mutually exclusive with plan.

+ */ + @JsonSetter(value = "plan_id", nulls = Nulls.SKIP) + public Builder planId(Optional planId) { + this.planId = planId; + return this; + } + + public Builder planId(String planId) { + this.planId = Optional.ofNullable(planId); + return this; + } + + public Builder planId(Nullable planId) { + if (planId.isNull()) { + this.planId = null; + } else if (planId.isEmpty()) { + this.planId = Optional.empty(); + } else { + this.planId = Optional.of(planId.get()); + } + return this; + } + + /** + *

URL customers are sent to after checkout.

+ */ + @JsonSetter(value = "redirect_url", nulls = Nulls.SKIP) + public Builder redirectUrl(Optional redirectUrl) { + this.redirectUrl = redirectUrl; + return this; + } + + public Builder redirectUrl(String redirectUrl) { + this.redirectUrl = Optional.ofNullable(redirectUrl); + return this; + } + + public Builder redirectUrl(Nullable redirectUrl) { + if (redirectUrl.isNull()) { + this.redirectUrl = null; + } else if (redirectUrl.isEmpty()) { + this.redirectUrl = Optional.empty(); + } else { + this.redirectUrl = Optional.of(redirectUrl.get()); + } + return this; + } + + /** + *

3D Secure behavior for this checkout.

+ */ + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public Builder threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + public Builder threeDsLevel(CreateCheckoutConfigurationsRequestThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + public Builder threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + public CreateCheckoutConfigurationsRequest build() { + return new CreateCheckoutConfigurationsRequest( + accountId, + affiliateCode, + currency, + metadata, + mode, + paymentMethodConfiguration, + plan, + planId, + redirectUrl, + threeDsLevel, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/requests/DeleteCheckoutConfigurationsRequest.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/requests/DeleteCheckoutConfigurationsRequest.java new file mode 100644 index 00000000..55a1d43c --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/requests/DeleteCheckoutConfigurationsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteCheckoutConfigurationsRequest.Builder.class) +public final class DeleteCheckoutConfigurationsRequest { + private final Map additionalProperties; + + private DeleteCheckoutConfigurationsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteCheckoutConfigurationsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteCheckoutConfigurationsRequest other) { + return this; + } + + public DeleteCheckoutConfigurationsRequest build() { + return new DeleteCheckoutConfigurationsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/requests/ListCheckoutConfigurationsRequest.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/requests/ListCheckoutConfigurationsRequest.java new file mode 100644 index 00000000..8e8999c5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/requests/ListCheckoutConfigurationsRequest.java @@ -0,0 +1,453 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.checkoutconfigurations.types.ListCheckoutConfigurationsRequestDirection; +import com.whop.api.resources.checkoutconfigurations.types.ListCheckoutConfigurationsRequestOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCheckoutConfigurationsRequest.Builder.class) +public final class ListCheckoutConfigurationsRequest { + private final String accountId; + + private final Optional planId; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional order; + + private final Optional direction; + + private final Optional first; + + private final Optional after; + + private final Map additionalProperties; + + private ListCheckoutConfigurationsRequest( + String accountId, + Optional planId, + Optional createdBefore, + Optional createdAfter, + Optional order, + Optional direction, + Optional first, + Optional after, + Map additionalProperties) { + this.accountId = accountId; + this.planId = planId; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.order = order; + this.direction = direction; + this.first = first; + this.after = after; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Only return checkout configurations for this plan ID, prefixed plan_. + */ + @JsonProperty("plan_id") + public Optional getPlanId() { + return planId; + } + + /** + * @return Only return checkout configurations created before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return checkout configurations created after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Field used to sort checkout configurations. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. Defaults to desc. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Number of checkout configurations to return. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor for the next page of results. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCheckoutConfigurationsRequest && equalTo((ListCheckoutConfigurationsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCheckoutConfigurationsRequest other) { + return accountId.equals(other.accountId) + && planId.equals(other.planId) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && order.equals(other.order) + && direction.equals(other.direction) + && first.equals(other.first) + && after.equals(other.after); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.planId, + this.createdBefore, + this.createdAfter, + this.order, + this.direction, + this.first, + this.after); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Account ID, prefixed biz_.

+ */ + _FinalStage accountId(@NotNull String accountId); + + Builder from(ListCheckoutConfigurationsRequest other); + } + + public interface _FinalStage { + ListCheckoutConfigurationsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Only return checkout configurations for this plan ID, prefixed plan_.

+ */ + _FinalStage planId(Optional planId); + + _FinalStage planId(String planId); + + /** + *

Only return checkout configurations created before this ISO 8601 timestamp.

+ */ + _FinalStage createdBefore(Optional createdBefore); + + _FinalStage createdBefore(String createdBefore); + + /** + *

Only return checkout configurations created after this ISO 8601 timestamp.

+ */ + _FinalStage createdAfter(Optional createdAfter); + + _FinalStage createdAfter(String createdAfter); + + /** + *

Field used to sort checkout configurations.

+ */ + _FinalStage order(Optional order); + + _FinalStage order(ListCheckoutConfigurationsRequestOrder order); + + /** + *

Sort direction. Defaults to desc.

+ */ + _FinalStage direction(Optional direction); + + _FinalStage direction(ListCheckoutConfigurationsRequestDirection direction); + + /** + *

Number of checkout configurations to return.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Cursor for the next page of results.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, _FinalStage { + private String accountId; + + private Optional after = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional planId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCheckoutConfigurationsRequest other) { + accountId(other.getAccountId()); + planId(other.getPlanId()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + order(other.getOrder()); + direction(other.getDirection()); + first(other.getFirst()); + after(other.getAfter()); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ *

Account ID, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

Cursor for the next page of results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Cursor for the next page of results.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + /** + *

Number of checkout configurations to return.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Number of checkout configurations to return.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Sort direction. Defaults to desc.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage direction(ListCheckoutConfigurationsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Sort direction. Defaults to desc.

+ */ + @java.lang.Override + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public _FinalStage direction(Optional direction) { + this.direction = direction; + return this; + } + + /** + *

Field used to sort checkout configurations.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(ListCheckoutConfigurationsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Field used to sort checkout configurations.

+ */ + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + /** + *

Only return checkout configurations created after this ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only return checkout configurations created after this ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public _FinalStage createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + /** + *

Only return checkout configurations created before this ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return checkout configurations created before this ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public _FinalStage createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + /** + *

Only return checkout configurations for this plan ID, prefixed plan_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planId(String planId) { + this.planId = Optional.ofNullable(planId); + return this; + } + + /** + *

Only return checkout configurations for this plan ID, prefixed plan_.

+ */ + @java.lang.Override + @JsonSetter(value = "plan_id", nulls = Nulls.SKIP) + public _FinalStage planId(Optional planId) { + this.planId = planId; + return this; + } + + @java.lang.Override + public ListCheckoutConfigurationsRequest build() { + return new ListCheckoutConfigurationsRequest( + accountId, + planId, + createdBefore, + createdAfter, + order, + direction, + first, + after, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/requests/RetrieveCheckoutConfigurationsRequest.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/requests/RetrieveCheckoutConfigurationsRequest.java new file mode 100644 index 00000000..6ebd3de7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/requests/RetrieveCheckoutConfigurationsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCheckoutConfigurationsRequest.Builder.class) +public final class RetrieveCheckoutConfigurationsRequest { + private final Map additionalProperties; + + private RetrieveCheckoutConfigurationsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCheckoutConfigurationsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveCheckoutConfigurationsRequest other) { + return this; + } + + public RetrieveCheckoutConfigurationsRequest build() { + return new RetrieveCheckoutConfigurationsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestMode.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestMode.java new file mode 100644 index 00000000..fefeb696 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestMode.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCheckoutConfigurationsRequestMode { + public static final CreateCheckoutConfigurationsRequestMode SETUP = + new CreateCheckoutConfigurationsRequestMode(Value.SETUP, "setup"); + + public static final CreateCheckoutConfigurationsRequestMode PAYMENT = + new CreateCheckoutConfigurationsRequestMode(Value.PAYMENT, "payment"); + + private final Value value; + + private final String string; + + CreateCheckoutConfigurationsRequestMode(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCheckoutConfigurationsRequestMode + && this.string.equals(((CreateCheckoutConfigurationsRequestMode) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SETUP: + return visitor.visitSetup(); + case PAYMENT: + return visitor.visitPayment(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCheckoutConfigurationsRequestMode valueOf(String value) { + switch (value) { + case "setup": + return SETUP; + case "payment": + return PAYMENT; + default: + return new CreateCheckoutConfigurationsRequestMode(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYMENT, + + SETUP, + + UNKNOWN + } + + public interface Visitor { + T visitPayment(); + + T visitSetup(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPaymentMethodConfiguration.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPaymentMethodConfiguration.java new file mode 100644 index 00000000..67bc953d --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPaymentMethodConfiguration.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCheckoutConfigurationsRequestPaymentMethodConfiguration.Builder.class) +public final class CreateCheckoutConfigurationsRequestPaymentMethodConfiguration { + private final Optional> disabled; + + private final Optional> enabled; + + private final Optional includePlatformDefaults; + + private final Map additionalProperties; + + private CreateCheckoutConfigurationsRequestPaymentMethodConfiguration( + Optional> disabled, + Optional> enabled, + Optional includePlatformDefaults, + Map additionalProperties) { + this.disabled = disabled; + this.enabled = enabled; + this.includePlatformDefaults = includePlatformDefaults; + this.additionalProperties = additionalProperties; + } + + /** + * @return Payment methods explicitly disabled for checkout. + */ + @JsonProperty("disabled") + public Optional> getDisabled() { + return disabled; + } + + /** + * @return Payment methods explicitly enabled for checkout. + */ + @JsonProperty("enabled") + public Optional> getEnabled() { + return enabled; + } + + /** + * @return Whether platform default payment methods are included. + */ + @JsonProperty("include_platform_defaults") + public Optional getIncludePlatformDefaults() { + return includePlatformDefaults; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCheckoutConfigurationsRequestPaymentMethodConfiguration + && equalTo((CreateCheckoutConfigurationsRequestPaymentMethodConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCheckoutConfigurationsRequestPaymentMethodConfiguration other) { + return disabled.equals(other.disabled) + && enabled.equals(other.enabled) + && includePlatformDefaults.equals(other.includePlatformDefaults); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.disabled, this.enabled, this.includePlatformDefaults); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> disabled = Optional.empty(); + + private Optional> enabled = Optional.empty(); + + private Optional includePlatformDefaults = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateCheckoutConfigurationsRequestPaymentMethodConfiguration other) { + disabled(other.getDisabled()); + enabled(other.getEnabled()); + includePlatformDefaults(other.getIncludePlatformDefaults()); + return this; + } + + /** + *

Payment methods explicitly disabled for checkout.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional> disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(List disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

Payment methods explicitly enabled for checkout.

+ */ + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional> enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(List enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + /** + *

Whether platform default payment methods are included.

+ */ + @JsonSetter(value = "include_platform_defaults", nulls = Nulls.SKIP) + public Builder includePlatformDefaults(Optional includePlatformDefaults) { + this.includePlatformDefaults = includePlatformDefaults; + return this; + } + + public Builder includePlatformDefaults(Boolean includePlatformDefaults) { + this.includePlatformDefaults = Optional.ofNullable(includePlatformDefaults); + return this; + } + + public CreateCheckoutConfigurationsRequestPaymentMethodConfiguration build() { + return new CreateCheckoutConfigurationsRequestPaymentMethodConfiguration( + disabled, enabled, includePlatformDefaults, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlan.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlan.java new file mode 100644 index 00000000..b1d8e512 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlan.java @@ -0,0 +1,1136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCheckoutConfigurationsRequestPlan.Builder.class) +public final class CreateCheckoutConfigurationsRequestPlan { + private final Optional accountId; + + private final Optional billingPeriod; + + private final Optional currency; + + private final Optional description; + + private final Optional expirationDays; + + private final Optional forceCreateNewPlan; + + private final Optional initialPrice; + + private final Optional> metadata; + + private final Optional overrideTaxType; + + private final Optional + paymentMethodConfiguration; + + private final Optional planType; + + private final Optional productId; + + private final Optional releaseMethod; + + private final Optional renewalPrice; + + private final Optional stock; + + private final Optional threeDsLevel; + + private final Optional title; + + private final Optional trialPeriodDays; + + private final Optional unlimitedStock; + + private final Optional visibility; + + private final Map additionalProperties; + + private CreateCheckoutConfigurationsRequestPlan( + Optional accountId, + Optional billingPeriod, + Optional currency, + Optional description, + Optional expirationDays, + Optional forceCreateNewPlan, + Optional initialPrice, + Optional> metadata, + Optional overrideTaxType, + Optional paymentMethodConfiguration, + Optional planType, + Optional productId, + Optional releaseMethod, + Optional renewalPrice, + Optional stock, + Optional threeDsLevel, + Optional title, + Optional trialPeriodDays, + Optional unlimitedStock, + Optional visibility, + Map additionalProperties) { + this.accountId = accountId; + this.billingPeriod = billingPeriod; + this.currency = currency; + this.description = description; + this.expirationDays = expirationDays; + this.forceCreateNewPlan = forceCreateNewPlan; + this.initialPrice = initialPrice; + this.metadata = metadata; + this.overrideTaxType = overrideTaxType; + this.paymentMethodConfiguration = paymentMethodConfiguration; + this.planType = planType; + this.productId = productId; + this.releaseMethod = releaseMethod; + this.renewalPrice = renewalPrice; + this.stock = stock; + this.threeDsLevel = threeDsLevel; + this.title = title; + this.trialPeriodDays = trialPeriodDays; + this.unlimitedStock = unlimitedStock; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID for the inline plan, prefixed biz_. Defaults to the account resolved from the request. + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return Recurring billing interval in days, such as 30 for monthly or 365 for annual. + */ + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + /** + * @return Three-letter ISO currency code for the plan's prices. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return Customer-visible plan description. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return Access duration in days for expiration-based plans. + */ + @JsonIgnore + public Optional getExpirationDays() { + if (expirationDays == null) { + return Optional.empty(); + } + return expirationDays; + } + + /** + * @return Whether to create a new plan instead of reusing a matching one. + */ + @JsonIgnore + public Optional getForceCreateNewPlan() { + if (forceCreateNewPlan == null) { + return Optional.empty(); + } + return forceCreateNewPlan; + } + + /** + * @return Initial purchase price in the plan currency. + */ + @JsonIgnore + public Optional getInitialPrice() { + if (initialPrice == null) { + return Optional.empty(); + } + return initialPrice; + } + + /** + * @return Custom key-value metadata stored on the plan. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Tax classification override for this plan. + */ + @JsonIgnore + public Optional getOverrideTaxType() { + if (overrideTaxType == null) { + return Optional.empty(); + } + return overrideTaxType; + } + + /** + * @return Payment method overrides for the inline plan. null uses platform defaults. + */ + @JsonIgnore + public Optional getPaymentMethodConfiguration() { + if (paymentMethodConfiguration == null) { + return Optional.empty(); + } + return paymentMethodConfiguration; + } + + /** + * @return Billing model for the plan. + */ + @JsonIgnore + public Optional getPlanType() { + if (planType == null) { + return Optional.empty(); + } + return planType; + } + + /** + * @return Product ID the inline plan should belong to, prefixed prod_. + */ + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + /** + * @return Sales method for the plan. + */ + @JsonIgnore + public Optional getReleaseMethod() { + if (releaseMethod == null) { + return Optional.empty(); + } + return releaseMethod; + } + + /** + * @return Recurring price charged each billing period. + */ + @JsonIgnore + public Optional getRenewalPrice() { + if (renewalPrice == null) { + return Optional.empty(); + } + return renewalPrice; + } + + /** + * @return Units available for purchase. + */ + @JsonIgnore + public Optional getStock() { + if (stock == null) { + return Optional.empty(); + } + return stock; + } + + /** + * @return 3D Secure behavior for the inline plan, or null to use the account default. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return Plan display name shown to customers. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return Free trial days before the first renewal charge. + */ + @JsonIgnore + public Optional getTrialPeriodDays() { + if (trialPeriodDays == null) { + return Optional.empty(); + } + return trialPeriodDays; + } + + /** + * @return Whether the plan has unlimited stock. + */ + @JsonIgnore + public Optional getUnlimitedStock() { + if (unlimitedStock == null) { + return Optional.empty(); + } + return unlimitedStock; + } + + /** + * @return Whether the plan is visible to customers or hidden from public view. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_days") + private Optional _getExpirationDays() { + return expirationDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("force_create_new_plan") + private Optional _getForceCreateNewPlan() { + return forceCreateNewPlan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("initial_price") + private Optional _getInitialPrice() { + return initialPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("override_tax_type") + private Optional _getOverrideTaxType() { + return overrideTaxType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_configuration") + private Optional + _getPaymentMethodConfiguration() { + return paymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan_type") + private Optional _getPlanType() { + return planType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("release_method") + private Optional _getReleaseMethod() { + return releaseMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("renewal_price") + private Optional _getRenewalPrice() { + return renewalPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("stock") + private Optional _getStock() { + return stock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trial_period_days") + private Optional _getTrialPeriodDays() { + return trialPeriodDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("unlimited_stock") + private Optional _getUnlimitedStock() { + return unlimitedStock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCheckoutConfigurationsRequestPlan + && equalTo((CreateCheckoutConfigurationsRequestPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCheckoutConfigurationsRequestPlan other) { + return accountId.equals(other.accountId) + && billingPeriod.equals(other.billingPeriod) + && currency.equals(other.currency) + && description.equals(other.description) + && expirationDays.equals(other.expirationDays) + && forceCreateNewPlan.equals(other.forceCreateNewPlan) + && initialPrice.equals(other.initialPrice) + && metadata.equals(other.metadata) + && overrideTaxType.equals(other.overrideTaxType) + && paymentMethodConfiguration.equals(other.paymentMethodConfiguration) + && planType.equals(other.planType) + && productId.equals(other.productId) + && releaseMethod.equals(other.releaseMethod) + && renewalPrice.equals(other.renewalPrice) + && stock.equals(other.stock) + && threeDsLevel.equals(other.threeDsLevel) + && title.equals(other.title) + && trialPeriodDays.equals(other.trialPeriodDays) + && unlimitedStock.equals(other.unlimitedStock) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.billingPeriod, + this.currency, + this.description, + this.expirationDays, + this.forceCreateNewPlan, + this.initialPrice, + this.metadata, + this.overrideTaxType, + this.paymentMethodConfiguration, + this.planType, + this.productId, + this.releaseMethod, + this.renewalPrice, + this.stock, + this.threeDsLevel, + this.title, + this.trialPeriodDays, + this.unlimitedStock, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional billingPeriod = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional expirationDays = Optional.empty(); + + private Optional forceCreateNewPlan = Optional.empty(); + + private Optional initialPrice = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional overrideTaxType = Optional.empty(); + + private Optional paymentMethodConfiguration = + Optional.empty(); + + private Optional planType = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional releaseMethod = Optional.empty(); + + private Optional renewalPrice = Optional.empty(); + + private Optional stock = Optional.empty(); + + private Optional threeDsLevel = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional trialPeriodDays = Optional.empty(); + + private Optional unlimitedStock = Optional.empty(); + + private Optional visibility = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateCheckoutConfigurationsRequestPlan other) { + accountId(other.getAccountId()); + billingPeriod(other.getBillingPeriod()); + currency(other.getCurrency()); + description(other.getDescription()); + expirationDays(other.getExpirationDays()); + forceCreateNewPlan(other.getForceCreateNewPlan()); + initialPrice(other.getInitialPrice()); + metadata(other.getMetadata()); + overrideTaxType(other.getOverrideTaxType()); + paymentMethodConfiguration(other.getPaymentMethodConfiguration()); + planType(other.getPlanType()); + productId(other.getProductId()); + releaseMethod(other.getReleaseMethod()); + renewalPrice(other.getRenewalPrice()); + stock(other.getStock()); + threeDsLevel(other.getThreeDsLevel()); + title(other.getTitle()); + trialPeriodDays(other.getTrialPeriodDays()); + unlimitedStock(other.getUnlimitedStock()); + visibility(other.getVisibility()); + return this; + } + + /** + *

Account ID for the inline plan, prefixed biz_. Defaults to the account resolved from the request.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + public Builder accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

Recurring billing interval in days, such as 30 for monthly or 365 for annual.

+ */ + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public Builder billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + public Builder billingPeriod(Integer billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + public Builder billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + /** + *

Three-letter ISO currency code for the plan's prices.

+ */ + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional currency) { + this.currency = currency; + return this; + } + + public Builder currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + public Builder currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

Customer-visible plan description.

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public Builder description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

Access duration in days for expiration-based plans.

+ */ + @JsonSetter(value = "expiration_days", nulls = Nulls.SKIP) + public Builder expirationDays(Optional expirationDays) { + this.expirationDays = expirationDays; + return this; + } + + public Builder expirationDays(Integer expirationDays) { + this.expirationDays = Optional.ofNullable(expirationDays); + return this; + } + + public Builder expirationDays(Nullable expirationDays) { + if (expirationDays.isNull()) { + this.expirationDays = null; + } else if (expirationDays.isEmpty()) { + this.expirationDays = Optional.empty(); + } else { + this.expirationDays = Optional.of(expirationDays.get()); + } + return this; + } + + /** + *

Whether to create a new plan instead of reusing a matching one.

+ */ + @JsonSetter(value = "force_create_new_plan", nulls = Nulls.SKIP) + public Builder forceCreateNewPlan(Optional forceCreateNewPlan) { + this.forceCreateNewPlan = forceCreateNewPlan; + return this; + } + + public Builder forceCreateNewPlan(Boolean forceCreateNewPlan) { + this.forceCreateNewPlan = Optional.ofNullable(forceCreateNewPlan); + return this; + } + + public Builder forceCreateNewPlan(Nullable forceCreateNewPlan) { + if (forceCreateNewPlan.isNull()) { + this.forceCreateNewPlan = null; + } else if (forceCreateNewPlan.isEmpty()) { + this.forceCreateNewPlan = Optional.empty(); + } else { + this.forceCreateNewPlan = Optional.of(forceCreateNewPlan.get()); + } + return this; + } + + /** + *

Initial purchase price in the plan currency.

+ */ + @JsonSetter(value = "initial_price", nulls = Nulls.SKIP) + public Builder initialPrice(Optional initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + public Builder initialPrice(Double initialPrice) { + this.initialPrice = Optional.ofNullable(initialPrice); + return this; + } + + public Builder initialPrice(Nullable initialPrice) { + if (initialPrice.isNull()) { + this.initialPrice = null; + } else if (initialPrice.isEmpty()) { + this.initialPrice = Optional.empty(); + } else { + this.initialPrice = Optional.of(initialPrice.get()); + } + return this; + } + + /** + *

Custom key-value metadata stored on the plan.

+ */ + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + public Builder metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Tax classification override for this plan.

+ */ + @JsonSetter(value = "override_tax_type", nulls = Nulls.SKIP) + public Builder overrideTaxType(Optional overrideTaxType) { + this.overrideTaxType = overrideTaxType; + return this; + } + + public Builder overrideTaxType(String overrideTaxType) { + this.overrideTaxType = Optional.ofNullable(overrideTaxType); + return this; + } + + public Builder overrideTaxType(Nullable overrideTaxType) { + if (overrideTaxType.isNull()) { + this.overrideTaxType = null; + } else if (overrideTaxType.isEmpty()) { + this.overrideTaxType = Optional.empty(); + } else { + this.overrideTaxType = Optional.of(overrideTaxType.get()); + } + return this; + } + + /** + *

Payment method overrides for the inline plan. null uses platform defaults.

+ */ + @JsonSetter(value = "payment_method_configuration", nulls = Nulls.SKIP) + public Builder paymentMethodConfiguration( + Optional + paymentMethodConfiguration) { + this.paymentMethodConfiguration = paymentMethodConfiguration; + return this; + } + + public Builder paymentMethodConfiguration( + CreateCheckoutConfigurationsRequestPlanPaymentMethodConfiguration paymentMethodConfiguration) { + this.paymentMethodConfiguration = Optional.ofNullable(paymentMethodConfiguration); + return this; + } + + public Builder paymentMethodConfiguration( + Nullable + paymentMethodConfiguration) { + if (paymentMethodConfiguration.isNull()) { + this.paymentMethodConfiguration = null; + } else if (paymentMethodConfiguration.isEmpty()) { + this.paymentMethodConfiguration = Optional.empty(); + } else { + this.paymentMethodConfiguration = Optional.of(paymentMethodConfiguration.get()); + } + return this; + } + + /** + *

Billing model for the plan.

+ */ + @JsonSetter(value = "plan_type", nulls = Nulls.SKIP) + public Builder planType(Optional planType) { + this.planType = planType; + return this; + } + + public Builder planType(CreateCheckoutConfigurationsRequestPlanPlanType planType) { + this.planType = Optional.ofNullable(planType); + return this; + } + + public Builder planType(Nullable planType) { + if (planType.isNull()) { + this.planType = null; + } else if (planType.isEmpty()) { + this.planType = Optional.empty(); + } else { + this.planType = Optional.of(planType.get()); + } + return this; + } + + /** + *

Product ID the inline plan should belong to, prefixed prod_.

+ */ + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public Builder productId(Optional productId) { + this.productId = productId; + return this; + } + + public Builder productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + public Builder productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + /** + *

Sales method for the plan.

+ */ + @JsonSetter(value = "release_method", nulls = Nulls.SKIP) + public Builder releaseMethod(Optional releaseMethod) { + this.releaseMethod = releaseMethod; + return this; + } + + public Builder releaseMethod(CreateCheckoutConfigurationsRequestPlanReleaseMethod releaseMethod) { + this.releaseMethod = Optional.ofNullable(releaseMethod); + return this; + } + + public Builder releaseMethod(Nullable releaseMethod) { + if (releaseMethod.isNull()) { + this.releaseMethod = null; + } else if (releaseMethod.isEmpty()) { + this.releaseMethod = Optional.empty(); + } else { + this.releaseMethod = Optional.of(releaseMethod.get()); + } + return this; + } + + /** + *

Recurring price charged each billing period.

+ */ + @JsonSetter(value = "renewal_price", nulls = Nulls.SKIP) + public Builder renewalPrice(Optional renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + public Builder renewalPrice(Double renewalPrice) { + this.renewalPrice = Optional.ofNullable(renewalPrice); + return this; + } + + public Builder renewalPrice(Nullable renewalPrice) { + if (renewalPrice.isNull()) { + this.renewalPrice = null; + } else if (renewalPrice.isEmpty()) { + this.renewalPrice = Optional.empty(); + } else { + this.renewalPrice = Optional.of(renewalPrice.get()); + } + return this; + } + + /** + *

Units available for purchase.

+ */ + @JsonSetter(value = "stock", nulls = Nulls.SKIP) + public Builder stock(Optional stock) { + this.stock = stock; + return this; + } + + public Builder stock(Integer stock) { + this.stock = Optional.ofNullable(stock); + return this; + } + + public Builder stock(Nullable stock) { + if (stock.isNull()) { + this.stock = null; + } else if (stock.isEmpty()) { + this.stock = Optional.empty(); + } else { + this.stock = Optional.of(stock.get()); + } + return this; + } + + /** + *

3D Secure behavior for the inline plan, or null to use the account default.

+ */ + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public Builder threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + public Builder threeDsLevel(CreateCheckoutConfigurationsRequestPlanThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + public Builder threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

Plan display name shown to customers.

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Free trial days before the first renewal charge.

+ */ + @JsonSetter(value = "trial_period_days", nulls = Nulls.SKIP) + public Builder trialPeriodDays(Optional trialPeriodDays) { + this.trialPeriodDays = trialPeriodDays; + return this; + } + + public Builder trialPeriodDays(Integer trialPeriodDays) { + this.trialPeriodDays = Optional.ofNullable(trialPeriodDays); + return this; + } + + public Builder trialPeriodDays(Nullable trialPeriodDays) { + if (trialPeriodDays.isNull()) { + this.trialPeriodDays = null; + } else if (trialPeriodDays.isEmpty()) { + this.trialPeriodDays = Optional.empty(); + } else { + this.trialPeriodDays = Optional.of(trialPeriodDays.get()); + } + return this; + } + + /** + *

Whether the plan has unlimited stock.

+ */ + @JsonSetter(value = "unlimited_stock", nulls = Nulls.SKIP) + public Builder unlimitedStock(Optional unlimitedStock) { + this.unlimitedStock = unlimitedStock; + return this; + } + + public Builder unlimitedStock(Boolean unlimitedStock) { + this.unlimitedStock = Optional.ofNullable(unlimitedStock); + return this; + } + + public Builder unlimitedStock(Nullable unlimitedStock) { + if (unlimitedStock.isNull()) { + this.unlimitedStock = null; + } else if (unlimitedStock.isEmpty()) { + this.unlimitedStock = Optional.empty(); + } else { + this.unlimitedStock = Optional.of(unlimitedStock.get()); + } + return this; + } + + /** + *

Whether the plan is visible to customers or hidden from public view.

+ */ + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public Builder visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + public Builder visibility(CreateCheckoutConfigurationsRequestPlanVisibility visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + public Builder visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + public CreateCheckoutConfigurationsRequestPlan build() { + return new CreateCheckoutConfigurationsRequestPlan( + accountId, + billingPeriod, + currency, + description, + expirationDays, + forceCreateNewPlan, + initialPrice, + metadata, + overrideTaxType, + paymentMethodConfiguration, + planType, + productId, + releaseMethod, + renewalPrice, + stock, + threeDsLevel, + title, + trialPeriodDays, + unlimitedStock, + visibility, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlanPaymentMethodConfiguration.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlanPaymentMethodConfiguration.java new file mode 100644 index 00000000..ca74c884 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlanPaymentMethodConfiguration.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCheckoutConfigurationsRequestPlanPaymentMethodConfiguration.Builder.class) +public final class CreateCheckoutConfigurationsRequestPlanPaymentMethodConfiguration { + private final Optional> disabled; + + private final Optional> enabled; + + private final Optional includePlatformDefaults; + + private final Map additionalProperties; + + private CreateCheckoutConfigurationsRequestPlanPaymentMethodConfiguration( + Optional> disabled, + Optional> enabled, + Optional includePlatformDefaults, + Map additionalProperties) { + this.disabled = disabled; + this.enabled = enabled; + this.includePlatformDefaults = includePlatformDefaults; + this.additionalProperties = additionalProperties; + } + + /** + * @return Payment methods explicitly disabled for this plan. + */ + @JsonProperty("disabled") + public Optional> getDisabled() { + return disabled; + } + + /** + * @return Payment methods explicitly enabled for this plan. + */ + @JsonProperty("enabled") + public Optional> getEnabled() { + return enabled; + } + + /** + * @return Whether platform default payment methods are included. + */ + @JsonProperty("include_platform_defaults") + public Optional getIncludePlatformDefaults() { + return includePlatformDefaults; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCheckoutConfigurationsRequestPlanPaymentMethodConfiguration + && equalTo((CreateCheckoutConfigurationsRequestPlanPaymentMethodConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCheckoutConfigurationsRequestPlanPaymentMethodConfiguration other) { + return disabled.equals(other.disabled) + && enabled.equals(other.enabled) + && includePlatformDefaults.equals(other.includePlatformDefaults); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.disabled, this.enabled, this.includePlatformDefaults); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> disabled = Optional.empty(); + + private Optional> enabled = Optional.empty(); + + private Optional includePlatformDefaults = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateCheckoutConfigurationsRequestPlanPaymentMethodConfiguration other) { + disabled(other.getDisabled()); + enabled(other.getEnabled()); + includePlatformDefaults(other.getIncludePlatformDefaults()); + return this; + } + + /** + *

Payment methods explicitly disabled for this plan.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional> disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(List disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

Payment methods explicitly enabled for this plan.

+ */ + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional> enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(List enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + /** + *

Whether platform default payment methods are included.

+ */ + @JsonSetter(value = "include_platform_defaults", nulls = Nulls.SKIP) + public Builder includePlatformDefaults(Optional includePlatformDefaults) { + this.includePlatformDefaults = includePlatformDefaults; + return this; + } + + public Builder includePlatformDefaults(Boolean includePlatformDefaults) { + this.includePlatformDefaults = Optional.ofNullable(includePlatformDefaults); + return this; + } + + public CreateCheckoutConfigurationsRequestPlanPaymentMethodConfiguration build() { + return new CreateCheckoutConfigurationsRequestPlanPaymentMethodConfiguration( + disabled, enabled, includePlatformDefaults, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlanPlanType.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlanPlanType.java new file mode 100644 index 00000000..7f98e290 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlanPlanType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCheckoutConfigurationsRequestPlanPlanType { + public static final CreateCheckoutConfigurationsRequestPlanPlanType RENEWAL = + new CreateCheckoutConfigurationsRequestPlanPlanType(Value.RENEWAL, "renewal"); + + public static final CreateCheckoutConfigurationsRequestPlanPlanType ONE_TIME = + new CreateCheckoutConfigurationsRequestPlanPlanType(Value.ONE_TIME, "one_time"); + + private final Value value; + + private final String string; + + CreateCheckoutConfigurationsRequestPlanPlanType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCheckoutConfigurationsRequestPlanPlanType + && this.string.equals(((CreateCheckoutConfigurationsRequestPlanPlanType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RENEWAL: + return visitor.visitRenewal(); + case ONE_TIME: + return visitor.visitOneTime(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCheckoutConfigurationsRequestPlanPlanType valueOf(String value) { + switch (value) { + case "renewal": + return RENEWAL; + case "one_time": + return ONE_TIME; + default: + return new CreateCheckoutConfigurationsRequestPlanPlanType(Value.UNKNOWN, value); + } + } + + public enum Value { + RENEWAL, + + ONE_TIME, + + UNKNOWN + } + + public interface Visitor { + T visitRenewal(); + + T visitOneTime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlanReleaseMethod.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlanReleaseMethod.java new file mode 100644 index 00000000..46ca9500 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlanReleaseMethod.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCheckoutConfigurationsRequestPlanReleaseMethod { + public static final CreateCheckoutConfigurationsRequestPlanReleaseMethod WAITLIST = + new CreateCheckoutConfigurationsRequestPlanReleaseMethod(Value.WAITLIST, "waitlist"); + + public static final CreateCheckoutConfigurationsRequestPlanReleaseMethod BUY_NOW = + new CreateCheckoutConfigurationsRequestPlanReleaseMethod(Value.BUY_NOW, "buy_now"); + + private final Value value; + + private final String string; + + CreateCheckoutConfigurationsRequestPlanReleaseMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCheckoutConfigurationsRequestPlanReleaseMethod + && this.string.equals(((CreateCheckoutConfigurationsRequestPlanReleaseMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WAITLIST: + return visitor.visitWaitlist(); + case BUY_NOW: + return visitor.visitBuyNow(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCheckoutConfigurationsRequestPlanReleaseMethod valueOf(String value) { + switch (value) { + case "waitlist": + return WAITLIST; + case "buy_now": + return BUY_NOW; + default: + return new CreateCheckoutConfigurationsRequestPlanReleaseMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + BUY_NOW, + + WAITLIST, + + UNKNOWN + } + + public interface Visitor { + T visitBuyNow(); + + T visitWaitlist(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlanThreeDsLevel.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlanThreeDsLevel.java new file mode 100644 index 00000000..09fbf8fb --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlanThreeDsLevel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCheckoutConfigurationsRequestPlanThreeDsLevel { + public static final CreateCheckoutConfigurationsRequestPlanThreeDsLevel MANDATE_CHALLENGE = + new CreateCheckoutConfigurationsRequestPlanThreeDsLevel(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + public static final CreateCheckoutConfigurationsRequestPlanThreeDsLevel FRICTIONLESS = + new CreateCheckoutConfigurationsRequestPlanThreeDsLevel(Value.FRICTIONLESS, "frictionless"); + + private final Value value; + + private final String string; + + CreateCheckoutConfigurationsRequestPlanThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCheckoutConfigurationsRequestPlanThreeDsLevel + && this.string.equals(((CreateCheckoutConfigurationsRequestPlanThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case FRICTIONLESS: + return visitor.visitFrictionless(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCheckoutConfigurationsRequestPlanThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + case "frictionless": + return FRICTIONLESS; + default: + return new CreateCheckoutConfigurationsRequestPlanThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + FRICTIONLESS, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitFrictionless(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlanVisibility.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlanVisibility.java new file mode 100644 index 00000000..c45251c0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestPlanVisibility.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCheckoutConfigurationsRequestPlanVisibility { + public static final CreateCheckoutConfigurationsRequestPlanVisibility VISIBLE = + new CreateCheckoutConfigurationsRequestPlanVisibility(Value.VISIBLE, "visible"); + + public static final CreateCheckoutConfigurationsRequestPlanVisibility HIDDEN = + new CreateCheckoutConfigurationsRequestPlanVisibility(Value.HIDDEN, "hidden"); + + public static final CreateCheckoutConfigurationsRequestPlanVisibility QUICK_LINK = + new CreateCheckoutConfigurationsRequestPlanVisibility(Value.QUICK_LINK, "quick_link"); + + public static final CreateCheckoutConfigurationsRequestPlanVisibility ARCHIVED = + new CreateCheckoutConfigurationsRequestPlanVisibility(Value.ARCHIVED, "archived"); + + private final Value value; + + private final String string; + + CreateCheckoutConfigurationsRequestPlanVisibility(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCheckoutConfigurationsRequestPlanVisibility + && this.string.equals(((CreateCheckoutConfigurationsRequestPlanVisibility) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VISIBLE: + return visitor.visitVisible(); + case HIDDEN: + return visitor.visitHidden(); + case QUICK_LINK: + return visitor.visitQuickLink(); + case ARCHIVED: + return visitor.visitArchived(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCheckoutConfigurationsRequestPlanVisibility valueOf(String value) { + switch (value) { + case "visible": + return VISIBLE; + case "hidden": + return HIDDEN; + case "quick_link": + return QUICK_LINK; + case "archived": + return ARCHIVED; + default: + return new CreateCheckoutConfigurationsRequestPlanVisibility(Value.UNKNOWN, value); + } + } + + public enum Value { + VISIBLE, + + HIDDEN, + + ARCHIVED, + + QUICK_LINK, + + UNKNOWN + } + + public interface Visitor { + T visitVisible(); + + T visitHidden(); + + T visitArchived(); + + T visitQuickLink(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestThreeDsLevel.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestThreeDsLevel.java new file mode 100644 index 00000000..24da2304 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsRequestThreeDsLevel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCheckoutConfigurationsRequestThreeDsLevel { + public static final CreateCheckoutConfigurationsRequestThreeDsLevel MANDATE_CHALLENGE = + new CreateCheckoutConfigurationsRequestThreeDsLevel(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + public static final CreateCheckoutConfigurationsRequestThreeDsLevel FRICTIONLESS = + new CreateCheckoutConfigurationsRequestThreeDsLevel(Value.FRICTIONLESS, "frictionless"); + + private final Value value; + + private final String string; + + CreateCheckoutConfigurationsRequestThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCheckoutConfigurationsRequestThreeDsLevel + && this.string.equals(((CreateCheckoutConfigurationsRequestThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case FRICTIONLESS: + return visitor.visitFrictionless(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCheckoutConfigurationsRequestThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + case "frictionless": + return FRICTIONLESS; + default: + return new CreateCheckoutConfigurationsRequestThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + FRICTIONLESS, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitFrictionless(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponse.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponse.java new file mode 100644 index 00000000..d2279c86 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponse.java @@ -0,0 +1,961 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCheckoutConfigurationsResponse.Builder.class) +public final class CreateCheckoutConfigurationsResponse { + private final String accountId; + + private final Optional affiliateCode; + + private final String createdAt; + + private final Optional currency; + + private final Optional + effectivePaymentMethodConfiguration; + + private final String id; + + private final Optional> metadata; + + private final CreateCheckoutConfigurationsResponseMode mode; + + private final Optional paymentMethodConfiguration; + + private final Optional plan; + + private final Optional purchaseUrl; + + private final Optional redirectUrl; + + private final Optional threeDsLevel; + + private final String updatedAt; + + private final Map additionalProperties; + + private CreateCheckoutConfigurationsResponse( + String accountId, + Optional affiliateCode, + String createdAt, + Optional currency, + Optional + effectivePaymentMethodConfiguration, + String id, + Optional> metadata, + CreateCheckoutConfigurationsResponseMode mode, + Optional paymentMethodConfiguration, + Optional plan, + Optional purchaseUrl, + Optional redirectUrl, + Optional threeDsLevel, + String updatedAt, + Map additionalProperties) { + this.accountId = accountId; + this.affiliateCode = affiliateCode; + this.createdAt = createdAt; + this.currency = currency; + this.effectivePaymentMethodConfiguration = effectivePaymentMethodConfiguration; + this.id = id; + this.metadata = metadata; + this.mode = mode; + this.paymentMethodConfiguration = paymentMethodConfiguration; + this.plan = plan; + this.purchaseUrl = purchaseUrl; + this.redirectUrl = redirectUrl; + this.threeDsLevel = threeDsLevel; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Affiliate code applied at checkout, or null when none is set. + */ + @JsonIgnore + public Optional getAffiliateCode() { + if (affiliateCode == null) { + return Optional.empty(); + } + return affiliateCode; + } + + /** + * @return When the checkout configuration was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Currency used for setup-mode payment method availability; defaults to usd when omitted. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override. + */ + @JsonIgnore + public Optional + getEffectivePaymentMethodConfiguration() { + if (effectivePaymentMethodConfiguration == null) { + return Optional.empty(); + } + return effectivePaymentMethodConfiguration; + } + + /** + * @return Checkout configuration ID, prefixed ch_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Controls whether checkout charges the buyer immediately or saves payment details for later. + */ + @JsonProperty("mode") + public CreateCheckoutConfigurationsResponseMode getMode() { + return mode; + } + + /** + * @return Payment method overrides for this checkout. null when it uses the plan or platform defaults. + */ + @JsonIgnore + public Optional getPaymentMethodConfiguration() { + if (paymentMethodConfiguration == null) { + return Optional.empty(); + } + return paymentMethodConfiguration; + } + + /** + * @return Plan used for payment checkout. null in setup mode. + */ + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + /** + * @return Checkout URL you can send to customers. + */ + @JsonIgnore + public Optional getPurchaseUrl() { + if (purchaseUrl == null) { + return Optional.empty(); + } + return purchaseUrl; + } + + /** + * @return URL customers are sent to after checkout, or null when no redirect is configured. + */ + @JsonIgnore + public Optional getRedirectUrl() { + if (redirectUrl == null) { + return Optional.empty(); + } + return redirectUrl; + } + + /** + * @return 3D Secure behavior for this checkout, or null to use the account default. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return When the checkout configuration was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("affiliate_code") + private Optional _getAffiliateCode() { + return affiliateCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("effective_payment_method_configuration") + private Optional + _getEffectivePaymentMethodConfiguration() { + return effectivePaymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_configuration") + private Optional _getPaymentMethodConfiguration() { + return paymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("purchase_url") + private Optional _getPurchaseUrl() { + return purchaseUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("redirect_url") + private Optional _getRedirectUrl() { + return redirectUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCheckoutConfigurationsResponse + && equalTo((CreateCheckoutConfigurationsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCheckoutConfigurationsResponse other) { + return accountId.equals(other.accountId) + && affiliateCode.equals(other.affiliateCode) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && effectivePaymentMethodConfiguration.equals(other.effectivePaymentMethodConfiguration) + && id.equals(other.id) + && metadata.equals(other.metadata) + && mode.equals(other.mode) + && paymentMethodConfiguration.equals(other.paymentMethodConfiguration) + && plan.equals(other.plan) + && purchaseUrl.equals(other.purchaseUrl) + && redirectUrl.equals(other.redirectUrl) + && threeDsLevel.equals(other.threeDsLevel) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.affiliateCode, + this.createdAt, + this.currency, + this.effectivePaymentMethodConfiguration, + this.id, + this.metadata, + this.mode, + this.paymentMethodConfiguration, + this.plan, + this.purchaseUrl, + this.redirectUrl, + this.threeDsLevel, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Account ID, prefixed biz_.

+ */ + CreatedAtStage accountId(@NotNull String accountId); + + Builder from(CreateCheckoutConfigurationsResponse other); + } + + public interface CreatedAtStage { + /** + *

When the checkout configuration was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Checkout configuration ID, prefixed ch_.

+ */ + ModeStage id(@NotNull String id); + } + + public interface ModeStage { + /** + *

Controls whether checkout charges the buyer immediately or saves payment details for later.

+ */ + UpdatedAtStage mode(@NotNull CreateCheckoutConfigurationsResponseMode mode); + } + + public interface UpdatedAtStage { + /** + *

When the checkout configuration was last updated, as an ISO 8601 timestamp.

+ */ + _FinalStage updatedAt(@NotNull String updatedAt); + } + + public interface _FinalStage { + CreateCheckoutConfigurationsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ */ + _FinalStage affiliateCode(Optional affiliateCode); + + _FinalStage affiliateCode(String affiliateCode); + + _FinalStage affiliateCode(Nullable affiliateCode); + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + _FinalStage currency(Nullable currency); + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ */ + _FinalStage effectivePaymentMethodConfiguration( + Optional + effectivePaymentMethodConfiguration); + + _FinalStage effectivePaymentMethodConfiguration( + CreateCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration + effectivePaymentMethodConfiguration); + + _FinalStage effectivePaymentMethodConfiguration( + Nullable + effectivePaymentMethodConfiguration); + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ */ + _FinalStage paymentMethodConfiguration( + Optional paymentMethodConfiguration); + + _FinalStage paymentMethodConfiguration( + CreateCheckoutConfigurationsResponsePaymentMethodConfiguration paymentMethodConfiguration); + + _FinalStage paymentMethodConfiguration( + Nullable paymentMethodConfiguration); + + /** + *

Plan used for payment checkout. null in setup mode.

+ */ + _FinalStage plan(Optional plan); + + _FinalStage plan(CreateCheckoutConfigurationsResponsePlan plan); + + _FinalStage plan(Nullable plan); + + /** + *

Checkout URL you can send to customers.

+ */ + _FinalStage purchaseUrl(Optional purchaseUrl); + + _FinalStage purchaseUrl(String purchaseUrl); + + _FinalStage purchaseUrl(Nullable purchaseUrl); + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ */ + _FinalStage redirectUrl(Optional redirectUrl); + + _FinalStage redirectUrl(String redirectUrl); + + _FinalStage redirectUrl(Nullable redirectUrl); + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ */ + _FinalStage threeDsLevel(Optional threeDsLevel); + + _FinalStage threeDsLevel(CreateCheckoutConfigurationsResponseThreeDsLevel threeDsLevel); + + _FinalStage threeDsLevel(Nullable threeDsLevel); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, CreatedAtStage, IdStage, ModeStage, UpdatedAtStage, _FinalStage { + private String accountId; + + private String createdAt; + + private String id; + + private CreateCheckoutConfigurationsResponseMode mode; + + private String updatedAt; + + private Optional threeDsLevel = Optional.empty(); + + private Optional redirectUrl = Optional.empty(); + + private Optional purchaseUrl = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional paymentMethodConfiguration = + Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional + effectivePaymentMethodConfiguration = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional affiliateCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCheckoutConfigurationsResponse other) { + accountId(other.getAccountId()); + affiliateCode(other.getAffiliateCode()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + effectivePaymentMethodConfiguration(other.getEffectivePaymentMethodConfiguration()); + id(other.getId()); + metadata(other.getMetadata()); + mode(other.getMode()); + paymentMethodConfiguration(other.getPaymentMethodConfiguration()); + plan(other.getPlan()); + purchaseUrl(other.getPurchaseUrl()); + redirectUrl(other.getRedirectUrl()); + threeDsLevel(other.getThreeDsLevel()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ *

Account ID, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public CreatedAtStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

When the checkout configuration was created, as an ISO 8601 timestamp.

+ *

When the checkout configuration was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Checkout configuration ID, prefixed ch_.

+ *

Checkout configuration ID, prefixed ch_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ModeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Controls whether checkout charges the buyer immediately or saves payment details for later.

+ *

Controls whether checkout charges the buyer immediately or saves payment details for later.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("mode") + public UpdatedAtStage mode(@NotNull CreateCheckoutConfigurationsResponseMode mode) { + this.mode = Objects.requireNonNull(mode, "mode must not be null"); + return this; + } + + /** + *

When the checkout configuration was last updated, as an ISO 8601 timestamp.

+ *

When the checkout configuration was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(CreateCheckoutConfigurationsResponseThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ */ + @java.lang.Override + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public _FinalStage threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectUrl(Nullable redirectUrl) { + if (redirectUrl.isNull()) { + this.redirectUrl = null; + } else if (redirectUrl.isEmpty()) { + this.redirectUrl = Optional.empty(); + } else { + this.redirectUrl = Optional.of(redirectUrl.get()); + } + return this; + } + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectUrl(String redirectUrl) { + this.redirectUrl = Optional.ofNullable(redirectUrl); + return this; + } + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ */ + @java.lang.Override + @JsonSetter(value = "redirect_url", nulls = Nulls.SKIP) + public _FinalStage redirectUrl(Optional redirectUrl) { + this.redirectUrl = redirectUrl; + return this; + } + + /** + *

Checkout URL you can send to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage purchaseUrl(Nullable purchaseUrl) { + if (purchaseUrl.isNull()) { + this.purchaseUrl = null; + } else if (purchaseUrl.isEmpty()) { + this.purchaseUrl = Optional.empty(); + } else { + this.purchaseUrl = Optional.of(purchaseUrl.get()); + } + return this; + } + + /** + *

Checkout URL you can send to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage purchaseUrl(String purchaseUrl) { + this.purchaseUrl = Optional.ofNullable(purchaseUrl); + return this; + } + + /** + *

Checkout URL you can send to customers.

+ */ + @java.lang.Override + @JsonSetter(value = "purchase_url", nulls = Nulls.SKIP) + public _FinalStage purchaseUrl(Optional purchaseUrl) { + this.purchaseUrl = purchaseUrl; + return this; + } + + /** + *

Plan used for payment checkout. null in setup mode.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + /** + *

Plan used for payment checkout. null in setup mode.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(CreateCheckoutConfigurationsResponsePlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + /** + *

Plan used for payment checkout. null in setup mode.

+ */ + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodConfiguration( + Nullable paymentMethodConfiguration) { + if (paymentMethodConfiguration.isNull()) { + this.paymentMethodConfiguration = null; + } else if (paymentMethodConfiguration.isEmpty()) { + this.paymentMethodConfiguration = Optional.empty(); + } else { + this.paymentMethodConfiguration = Optional.of(paymentMethodConfiguration.get()); + } + return this; + } + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodConfiguration( + CreateCheckoutConfigurationsResponsePaymentMethodConfiguration paymentMethodConfiguration) { + this.paymentMethodConfiguration = Optional.ofNullable(paymentMethodConfiguration); + return this; + } + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_configuration", nulls = Nulls.SKIP) + public _FinalStage paymentMethodConfiguration( + Optional paymentMethodConfiguration) { + this.paymentMethodConfiguration = paymentMethodConfiguration; + return this; + } + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage effectivePaymentMethodConfiguration( + Nullable + effectivePaymentMethodConfiguration) { + if (effectivePaymentMethodConfiguration.isNull()) { + this.effectivePaymentMethodConfiguration = null; + } else if (effectivePaymentMethodConfiguration.isEmpty()) { + this.effectivePaymentMethodConfiguration = Optional.empty(); + } else { + this.effectivePaymentMethodConfiguration = Optional.of(effectivePaymentMethodConfiguration.get()); + } + return this; + } + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage effectivePaymentMethodConfiguration( + CreateCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration + effectivePaymentMethodConfiguration) { + this.effectivePaymentMethodConfiguration = Optional.ofNullable(effectivePaymentMethodConfiguration); + return this; + } + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ */ + @java.lang.Override + @JsonSetter(value = "effective_payment_method_configuration", nulls = Nulls.SKIP) + public _FinalStage effectivePaymentMethodConfiguration( + Optional + effectivePaymentMethodConfiguration) { + this.effectivePaymentMethodConfiguration = effectivePaymentMethodConfiguration; + return this; + } + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage affiliateCode(Nullable affiliateCode) { + if (affiliateCode.isNull()) { + this.affiliateCode = null; + } else if (affiliateCode.isEmpty()) { + this.affiliateCode = Optional.empty(); + } else { + this.affiliateCode = Optional.of(affiliateCode.get()); + } + return this; + } + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage affiliateCode(String affiliateCode) { + this.affiliateCode = Optional.ofNullable(affiliateCode); + return this; + } + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ */ + @java.lang.Override + @JsonSetter(value = "affiliate_code", nulls = Nulls.SKIP) + public _FinalStage affiliateCode(Optional affiliateCode) { + this.affiliateCode = affiliateCode; + return this; + } + + @java.lang.Override + public CreateCheckoutConfigurationsResponse build() { + return new CreateCheckoutConfigurationsResponse( + accountId, + affiliateCode, + createdAt, + currency, + effectivePaymentMethodConfiguration, + id, + metadata, + mode, + paymentMethodConfiguration, + plan, + purchaseUrl, + redirectUrl, + threeDsLevel, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration.java new file mode 100644 index 00000000..00c42c31 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration.Builder.class) +public final class CreateCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration { + private final Optional> disabled; + + private final Optional> enabled; + + private final Optional includePlatformDefaults; + + private final Map additionalProperties; + + private CreateCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration( + Optional> disabled, + Optional> enabled, + Optional includePlatformDefaults, + Map additionalProperties) { + this.disabled = disabled; + this.enabled = enabled; + this.includePlatformDefaults = includePlatformDefaults; + this.additionalProperties = additionalProperties; + } + + /** + * @return Payment methods explicitly disabled. + */ + @JsonProperty("disabled") + public Optional> getDisabled() { + return disabled; + } + + /** + * @return Payment methods explicitly enabled. + */ + @JsonProperty("enabled") + public Optional> getEnabled() { + return enabled; + } + + /** + * @return Whether platform default payment methods are included. + */ + @JsonProperty("include_platform_defaults") + public Optional getIncludePlatformDefaults() { + return includePlatformDefaults; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration + && equalTo((CreateCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration other) { + return disabled.equals(other.disabled) + && enabled.equals(other.enabled) + && includePlatformDefaults.equals(other.includePlatformDefaults); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.disabled, this.enabled, this.includePlatformDefaults); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> disabled = Optional.empty(); + + private Optional> enabled = Optional.empty(); + + private Optional includePlatformDefaults = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration other) { + disabled(other.getDisabled()); + enabled(other.getEnabled()); + includePlatformDefaults(other.getIncludePlatformDefaults()); + return this; + } + + /** + *

Payment methods explicitly disabled.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional> disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(List disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

Payment methods explicitly enabled.

+ */ + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional> enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(List enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + /** + *

Whether platform default payment methods are included.

+ */ + @JsonSetter(value = "include_platform_defaults", nulls = Nulls.SKIP) + public Builder includePlatformDefaults(Optional includePlatformDefaults) { + this.includePlatformDefaults = includePlatformDefaults; + return this; + } + + public Builder includePlatformDefaults(Boolean includePlatformDefaults) { + this.includePlatformDefaults = Optional.ofNullable(includePlatformDefaults); + return this; + } + + public CreateCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration build() { + return new CreateCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration( + disabled, enabled, includePlatformDefaults, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponseMode.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponseMode.java new file mode 100644 index 00000000..bd590064 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponseMode.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCheckoutConfigurationsResponseMode { + public static final CreateCheckoutConfigurationsResponseMode SETUP = + new CreateCheckoutConfigurationsResponseMode(Value.SETUP, "setup"); + + public static final CreateCheckoutConfigurationsResponseMode PAYMENT = + new CreateCheckoutConfigurationsResponseMode(Value.PAYMENT, "payment"); + + private final Value value; + + private final String string; + + CreateCheckoutConfigurationsResponseMode(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCheckoutConfigurationsResponseMode + && this.string.equals(((CreateCheckoutConfigurationsResponseMode) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SETUP: + return visitor.visitSetup(); + case PAYMENT: + return visitor.visitPayment(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCheckoutConfigurationsResponseMode valueOf(String value) { + switch (value) { + case "setup": + return SETUP; + case "payment": + return PAYMENT; + default: + return new CreateCheckoutConfigurationsResponseMode(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYMENT, + + SETUP, + + UNKNOWN + } + + public interface Visitor { + T visitPayment(); + + T visitSetup(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePaymentMethodConfiguration.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePaymentMethodConfiguration.java new file mode 100644 index 00000000..714433b9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePaymentMethodConfiguration.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCheckoutConfigurationsResponsePaymentMethodConfiguration.Builder.class) +public final class CreateCheckoutConfigurationsResponsePaymentMethodConfiguration { + private final Optional> disabled; + + private final Optional> enabled; + + private final Optional includePlatformDefaults; + + private final Map additionalProperties; + + private CreateCheckoutConfigurationsResponsePaymentMethodConfiguration( + Optional> disabled, + Optional> enabled, + Optional includePlatformDefaults, + Map additionalProperties) { + this.disabled = disabled; + this.enabled = enabled; + this.includePlatformDefaults = includePlatformDefaults; + this.additionalProperties = additionalProperties; + } + + /** + * @return Payment methods explicitly disabled for checkout. + */ + @JsonProperty("disabled") + public Optional> getDisabled() { + return disabled; + } + + /** + * @return Payment methods explicitly enabled for checkout. + */ + @JsonProperty("enabled") + public Optional> getEnabled() { + return enabled; + } + + /** + * @return Whether platform default payment methods are included. + */ + @JsonProperty("include_platform_defaults") + public Optional getIncludePlatformDefaults() { + return includePlatformDefaults; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCheckoutConfigurationsResponsePaymentMethodConfiguration + && equalTo((CreateCheckoutConfigurationsResponsePaymentMethodConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCheckoutConfigurationsResponsePaymentMethodConfiguration other) { + return disabled.equals(other.disabled) + && enabled.equals(other.enabled) + && includePlatformDefaults.equals(other.includePlatformDefaults); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.disabled, this.enabled, this.includePlatformDefaults); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> disabled = Optional.empty(); + + private Optional> enabled = Optional.empty(); + + private Optional includePlatformDefaults = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateCheckoutConfigurationsResponsePaymentMethodConfiguration other) { + disabled(other.getDisabled()); + enabled(other.getEnabled()); + includePlatformDefaults(other.getIncludePlatformDefaults()); + return this; + } + + /** + *

Payment methods explicitly disabled for checkout.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional> disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(List disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

Payment methods explicitly enabled for checkout.

+ */ + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional> enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(List enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + /** + *

Whether platform default payment methods are included.

+ */ + @JsonSetter(value = "include_platform_defaults", nulls = Nulls.SKIP) + public Builder includePlatformDefaults(Optional includePlatformDefaults) { + this.includePlatformDefaults = includePlatformDefaults; + return this; + } + + public Builder includePlatformDefaults(Boolean includePlatformDefaults) { + this.includePlatformDefaults = Optional.ofNullable(includePlatformDefaults); + return this; + } + + public CreateCheckoutConfigurationsResponsePaymentMethodConfiguration build() { + return new CreateCheckoutConfigurationsResponsePaymentMethodConfiguration( + disabled, enabled, includePlatformDefaults, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePlan.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePlan.java new file mode 100644 index 00000000..c922f75b --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePlan.java @@ -0,0 +1,697 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCheckoutConfigurationsResponsePlan.Builder.class) +public final class CreateCheckoutConfigurationsResponsePlan { + private final boolean adaptivePricingEnabled; + + private final Optional billingPeriod; + + private final String currency; + + private final Optional expirationDays; + + private final String id; + + private final double initialPrice; + + private final CreateCheckoutConfigurationsResponsePlanPlanType planType; + + private final CreateCheckoutConfigurationsResponsePlanReleaseMethod releaseMethod; + + private final double renewalPrice; + + private final Optional threeDsLevel; + + private final Optional trialPeriodDays; + + private final CreateCheckoutConfigurationsResponsePlanVisibility visibility; + + private final Map additionalProperties; + + private CreateCheckoutConfigurationsResponsePlan( + boolean adaptivePricingEnabled, + Optional billingPeriod, + String currency, + Optional expirationDays, + String id, + double initialPrice, + CreateCheckoutConfigurationsResponsePlanPlanType planType, + CreateCheckoutConfigurationsResponsePlanReleaseMethod releaseMethod, + double renewalPrice, + Optional threeDsLevel, + Optional trialPeriodDays, + CreateCheckoutConfigurationsResponsePlanVisibility visibility, + Map additionalProperties) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + this.billingPeriod = billingPeriod; + this.currency = currency; + this.expirationDays = expirationDays; + this.id = id; + this.initialPrice = initialPrice; + this.planType = planType; + this.releaseMethod = releaseMethod; + this.renewalPrice = renewalPrice; + this.threeDsLevel = threeDsLevel; + this.trialPeriodDays = trialPeriodDays; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether this plan accepts local currency payments via adaptive pricing. + */ + @JsonProperty("adaptive_pricing_enabled") + public boolean getAdaptivePricingEnabled() { + return adaptivePricingEnabled; + } + + /** + * @return Recurring billing interval in days, such as 30 for monthly or 365 for annual. null for one-time plans. + */ + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + /** + * @return Three-letter ISO currency code for the plan's prices. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Access duration in days for expiration-based plans. + */ + @JsonIgnore + public Optional getExpirationDays() { + if (expirationDays == null) { + return Optional.empty(); + } + return expirationDays; + } + + /** + * @return Plan ID, prefixed plan_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Initial purchase price in the plan currency. + */ + @JsonProperty("initial_price") + public double getInitialPrice() { + return initialPrice; + } + + /** + * @return Billing model for the plan. + */ + @JsonProperty("plan_type") + public CreateCheckoutConfigurationsResponsePlanPlanType getPlanType() { + return planType; + } + + /** + * @return Sales method for the plan. + */ + @JsonProperty("release_method") + public CreateCheckoutConfigurationsResponsePlanReleaseMethod getReleaseMethod() { + return releaseMethod; + } + + /** + * @return Recurring price charged each billing period. + */ + @JsonProperty("renewal_price") + public double getRenewalPrice() { + return renewalPrice; + } + + /** + * @return 3D Secure behavior for this plan, or null to use the account default. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return Free trial days before the first renewal charge. + */ + @JsonIgnore + public Optional getTrialPeriodDays() { + if (trialPeriodDays == null) { + return Optional.empty(); + } + return trialPeriodDays; + } + + /** + * @return Whether the plan is visible to customers or hidden from public view. + */ + @JsonProperty("visibility") + public CreateCheckoutConfigurationsResponsePlanVisibility getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_days") + private Optional _getExpirationDays() { + return expirationDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trial_period_days") + private Optional _getTrialPeriodDays() { + return trialPeriodDays; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCheckoutConfigurationsResponsePlan + && equalTo((CreateCheckoutConfigurationsResponsePlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCheckoutConfigurationsResponsePlan other) { + return adaptivePricingEnabled == other.adaptivePricingEnabled + && billingPeriod.equals(other.billingPeriod) + && currency.equals(other.currency) + && expirationDays.equals(other.expirationDays) + && id.equals(other.id) + && initialPrice == other.initialPrice + && planType.equals(other.planType) + && releaseMethod.equals(other.releaseMethod) + && renewalPrice == other.renewalPrice + && threeDsLevel.equals(other.threeDsLevel) + && trialPeriodDays.equals(other.trialPeriodDays) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adaptivePricingEnabled, + this.billingPeriod, + this.currency, + this.expirationDays, + this.id, + this.initialPrice, + this.planType, + this.releaseMethod, + this.renewalPrice, + this.threeDsLevel, + this.trialPeriodDays, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdaptivePricingEnabledStage builder() { + return new Builder(); + } + + public interface AdaptivePricingEnabledStage { + /** + *

Whether this plan accepts local currency payments via adaptive pricing.

+ */ + CurrencyStage adaptivePricingEnabled(boolean adaptivePricingEnabled); + + Builder from(CreateCheckoutConfigurationsResponsePlan other); + } + + public interface CurrencyStage { + /** + *

Three-letter ISO currency code for the plan's prices.

+ */ + IdStage currency(@NotNull String currency); + } + + public interface IdStage { + /** + *

Plan ID, prefixed plan_.

+ */ + InitialPriceStage id(@NotNull String id); + } + + public interface InitialPriceStage { + /** + *

Initial purchase price in the plan currency.

+ */ + PlanTypeStage initialPrice(double initialPrice); + } + + public interface PlanTypeStage { + /** + *

Billing model for the plan.

+ */ + ReleaseMethodStage planType(@NotNull CreateCheckoutConfigurationsResponsePlanPlanType planType); + } + + public interface ReleaseMethodStage { + /** + *

Sales method for the plan.

+ */ + RenewalPriceStage releaseMethod(@NotNull CreateCheckoutConfigurationsResponsePlanReleaseMethod releaseMethod); + } + + public interface RenewalPriceStage { + /** + *

Recurring price charged each billing period.

+ */ + VisibilityStage renewalPrice(double renewalPrice); + } + + public interface VisibilityStage { + /** + *

Whether the plan is visible to customers or hidden from public view.

+ */ + _FinalStage visibility(@NotNull CreateCheckoutConfigurationsResponsePlanVisibility visibility); + } + + public interface _FinalStage { + CreateCheckoutConfigurationsResponsePlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Recurring billing interval in days, such as 30 for monthly or 365 for annual. null for one-time plans.

+ */ + _FinalStage billingPeriod(Optional billingPeriod); + + _FinalStage billingPeriod(Integer billingPeriod); + + _FinalStage billingPeriod(Nullable billingPeriod); + + /** + *

Access duration in days for expiration-based plans.

+ */ + _FinalStage expirationDays(Optional expirationDays); + + _FinalStage expirationDays(Integer expirationDays); + + _FinalStage expirationDays(Nullable expirationDays); + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ */ + _FinalStage threeDsLevel(Optional threeDsLevel); + + _FinalStage threeDsLevel(CreateCheckoutConfigurationsResponsePlanThreeDsLevel threeDsLevel); + + _FinalStage threeDsLevel(Nullable threeDsLevel); + + /** + *

Free trial days before the first renewal charge.

+ */ + _FinalStage trialPeriodDays(Optional trialPeriodDays); + + _FinalStage trialPeriodDays(Integer trialPeriodDays); + + _FinalStage trialPeriodDays(Nullable trialPeriodDays); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AdaptivePricingEnabledStage, + CurrencyStage, + IdStage, + InitialPriceStage, + PlanTypeStage, + ReleaseMethodStage, + RenewalPriceStage, + VisibilityStage, + _FinalStage { + private boolean adaptivePricingEnabled; + + private String currency; + + private String id; + + private double initialPrice; + + private CreateCheckoutConfigurationsResponsePlanPlanType planType; + + private CreateCheckoutConfigurationsResponsePlanReleaseMethod releaseMethod; + + private double renewalPrice; + + private CreateCheckoutConfigurationsResponsePlanVisibility visibility; + + private Optional trialPeriodDays = Optional.empty(); + + private Optional threeDsLevel = Optional.empty(); + + private Optional expirationDays = Optional.empty(); + + private Optional billingPeriod = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCheckoutConfigurationsResponsePlan other) { + adaptivePricingEnabled(other.getAdaptivePricingEnabled()); + billingPeriod(other.getBillingPeriod()); + currency(other.getCurrency()); + expirationDays(other.getExpirationDays()); + id(other.getId()); + initialPrice(other.getInitialPrice()); + planType(other.getPlanType()); + releaseMethod(other.getReleaseMethod()); + renewalPrice(other.getRenewalPrice()); + threeDsLevel(other.getThreeDsLevel()); + trialPeriodDays(other.getTrialPeriodDays()); + visibility(other.getVisibility()); + return this; + } + + /** + *

Whether this plan accepts local currency payments via adaptive pricing.

+ *

Whether this plan accepts local currency payments via adaptive pricing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("adaptive_pricing_enabled") + public CurrencyStage adaptivePricingEnabled(boolean adaptivePricingEnabled) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + return this; + } + + /** + *

Three-letter ISO currency code for the plan's prices.

+ *

Three-letter ISO currency code for the plan's prices.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Plan ID, prefixed plan_.

+ *

Plan ID, prefixed plan_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public InitialPriceStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Initial purchase price in the plan currency.

+ *

Initial purchase price in the plan currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("initial_price") + public PlanTypeStage initialPrice(double initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + /** + *

Billing model for the plan.

+ *

Billing model for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan_type") + public ReleaseMethodStage planType(@NotNull CreateCheckoutConfigurationsResponsePlanPlanType planType) { + this.planType = Objects.requireNonNull(planType, "planType must not be null"); + return this; + } + + /** + *

Sales method for the plan.

+ *

Sales method for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("release_method") + public RenewalPriceStage releaseMethod( + @NotNull CreateCheckoutConfigurationsResponsePlanReleaseMethod releaseMethod) { + this.releaseMethod = Objects.requireNonNull(releaseMethod, "releaseMethod must not be null"); + return this; + } + + /** + *

Recurring price charged each billing period.

+ *

Recurring price charged each billing period.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("renewal_price") + public VisibilityStage renewalPrice(double renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + /** + *

Whether the plan is visible to customers or hidden from public view.

+ *

Whether the plan is visible to customers or hidden from public view.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("visibility") + public _FinalStage visibility(@NotNull CreateCheckoutConfigurationsResponsePlanVisibility visibility) { + this.visibility = Objects.requireNonNull(visibility, "visibility must not be null"); + return this; + } + + /** + *

Free trial days before the first renewal charge.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Nullable trialPeriodDays) { + if (trialPeriodDays.isNull()) { + this.trialPeriodDays = null; + } else if (trialPeriodDays.isEmpty()) { + this.trialPeriodDays = Optional.empty(); + } else { + this.trialPeriodDays = Optional.of(trialPeriodDays.get()); + } + return this; + } + + /** + *

Free trial days before the first renewal charge.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Integer trialPeriodDays) { + this.trialPeriodDays = Optional.ofNullable(trialPeriodDays); + return this; + } + + /** + *

Free trial days before the first renewal charge.

+ */ + @java.lang.Override + @JsonSetter(value = "trial_period_days", nulls = Nulls.SKIP) + public _FinalStage trialPeriodDays(Optional trialPeriodDays) { + this.trialPeriodDays = trialPeriodDays; + return this; + } + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(CreateCheckoutConfigurationsResponsePlanThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ */ + @java.lang.Override + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public _FinalStage threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + /** + *

Access duration in days for expiration-based plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Nullable expirationDays) { + if (expirationDays.isNull()) { + this.expirationDays = null; + } else if (expirationDays.isEmpty()) { + this.expirationDays = Optional.empty(); + } else { + this.expirationDays = Optional.of(expirationDays.get()); + } + return this; + } + + /** + *

Access duration in days for expiration-based plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Integer expirationDays) { + this.expirationDays = Optional.ofNullable(expirationDays); + return this; + } + + /** + *

Access duration in days for expiration-based plans.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_days", nulls = Nulls.SKIP) + public _FinalStage expirationDays(Optional expirationDays) { + this.expirationDays = expirationDays; + return this; + } + + /** + *

Recurring billing interval in days, such as 30 for monthly or 365 for annual. null for one-time plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + /** + *

Recurring billing interval in days, such as 30 for monthly or 365 for annual. null for one-time plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Integer billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + /** + *

Recurring billing interval in days, such as 30 for monthly or 365 for annual. null for one-time plans.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public _FinalStage billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + @java.lang.Override + public CreateCheckoutConfigurationsResponsePlan build() { + return new CreateCheckoutConfigurationsResponsePlan( + adaptivePricingEnabled, + billingPeriod, + currency, + expirationDays, + id, + initialPrice, + planType, + releaseMethod, + renewalPrice, + threeDsLevel, + trialPeriodDays, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePlanPlanType.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePlanPlanType.java new file mode 100644 index 00000000..6e765de7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePlanPlanType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCheckoutConfigurationsResponsePlanPlanType { + public static final CreateCheckoutConfigurationsResponsePlanPlanType RENEWAL = + new CreateCheckoutConfigurationsResponsePlanPlanType(Value.RENEWAL, "renewal"); + + public static final CreateCheckoutConfigurationsResponsePlanPlanType ONE_TIME = + new CreateCheckoutConfigurationsResponsePlanPlanType(Value.ONE_TIME, "one_time"); + + private final Value value; + + private final String string; + + CreateCheckoutConfigurationsResponsePlanPlanType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCheckoutConfigurationsResponsePlanPlanType + && this.string.equals(((CreateCheckoutConfigurationsResponsePlanPlanType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RENEWAL: + return visitor.visitRenewal(); + case ONE_TIME: + return visitor.visitOneTime(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCheckoutConfigurationsResponsePlanPlanType valueOf(String value) { + switch (value) { + case "renewal": + return RENEWAL; + case "one_time": + return ONE_TIME; + default: + return new CreateCheckoutConfigurationsResponsePlanPlanType(Value.UNKNOWN, value); + } + } + + public enum Value { + RENEWAL, + + ONE_TIME, + + UNKNOWN + } + + public interface Visitor { + T visitRenewal(); + + T visitOneTime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePlanReleaseMethod.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePlanReleaseMethod.java new file mode 100644 index 00000000..05d3cc2c --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePlanReleaseMethod.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCheckoutConfigurationsResponsePlanReleaseMethod { + public static final CreateCheckoutConfigurationsResponsePlanReleaseMethod WAITLIST = + new CreateCheckoutConfigurationsResponsePlanReleaseMethod(Value.WAITLIST, "waitlist"); + + public static final CreateCheckoutConfigurationsResponsePlanReleaseMethod BUY_NOW = + new CreateCheckoutConfigurationsResponsePlanReleaseMethod(Value.BUY_NOW, "buy_now"); + + private final Value value; + + private final String string; + + CreateCheckoutConfigurationsResponsePlanReleaseMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCheckoutConfigurationsResponsePlanReleaseMethod + && this.string.equals(((CreateCheckoutConfigurationsResponsePlanReleaseMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WAITLIST: + return visitor.visitWaitlist(); + case BUY_NOW: + return visitor.visitBuyNow(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCheckoutConfigurationsResponsePlanReleaseMethod valueOf(String value) { + switch (value) { + case "waitlist": + return WAITLIST; + case "buy_now": + return BUY_NOW; + default: + return new CreateCheckoutConfigurationsResponsePlanReleaseMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + BUY_NOW, + + WAITLIST, + + UNKNOWN + } + + public interface Visitor { + T visitBuyNow(); + + T visitWaitlist(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePlanThreeDsLevel.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePlanThreeDsLevel.java new file mode 100644 index 00000000..9cc86ce4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePlanThreeDsLevel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCheckoutConfigurationsResponsePlanThreeDsLevel { + public static final CreateCheckoutConfigurationsResponsePlanThreeDsLevel MANDATE_CHALLENGE = + new CreateCheckoutConfigurationsResponsePlanThreeDsLevel(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + public static final CreateCheckoutConfigurationsResponsePlanThreeDsLevel FRICTIONLESS = + new CreateCheckoutConfigurationsResponsePlanThreeDsLevel(Value.FRICTIONLESS, "frictionless"); + + private final Value value; + + private final String string; + + CreateCheckoutConfigurationsResponsePlanThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCheckoutConfigurationsResponsePlanThreeDsLevel + && this.string.equals(((CreateCheckoutConfigurationsResponsePlanThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case FRICTIONLESS: + return visitor.visitFrictionless(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCheckoutConfigurationsResponsePlanThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + case "frictionless": + return FRICTIONLESS; + default: + return new CreateCheckoutConfigurationsResponsePlanThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + FRICTIONLESS, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitFrictionless(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePlanVisibility.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePlanVisibility.java new file mode 100644 index 00000000..52d14373 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponsePlanVisibility.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCheckoutConfigurationsResponsePlanVisibility { + public static final CreateCheckoutConfigurationsResponsePlanVisibility VISIBLE = + new CreateCheckoutConfigurationsResponsePlanVisibility(Value.VISIBLE, "visible"); + + public static final CreateCheckoutConfigurationsResponsePlanVisibility HIDDEN = + new CreateCheckoutConfigurationsResponsePlanVisibility(Value.HIDDEN, "hidden"); + + public static final CreateCheckoutConfigurationsResponsePlanVisibility QUICK_LINK = + new CreateCheckoutConfigurationsResponsePlanVisibility(Value.QUICK_LINK, "quick_link"); + + public static final CreateCheckoutConfigurationsResponsePlanVisibility ARCHIVED = + new CreateCheckoutConfigurationsResponsePlanVisibility(Value.ARCHIVED, "archived"); + + private final Value value; + + private final String string; + + CreateCheckoutConfigurationsResponsePlanVisibility(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCheckoutConfigurationsResponsePlanVisibility + && this.string.equals(((CreateCheckoutConfigurationsResponsePlanVisibility) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VISIBLE: + return visitor.visitVisible(); + case HIDDEN: + return visitor.visitHidden(); + case QUICK_LINK: + return visitor.visitQuickLink(); + case ARCHIVED: + return visitor.visitArchived(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCheckoutConfigurationsResponsePlanVisibility valueOf(String value) { + switch (value) { + case "visible": + return VISIBLE; + case "hidden": + return HIDDEN; + case "quick_link": + return QUICK_LINK; + case "archived": + return ARCHIVED; + default: + return new CreateCheckoutConfigurationsResponsePlanVisibility(Value.UNKNOWN, value); + } + } + + public enum Value { + VISIBLE, + + HIDDEN, + + ARCHIVED, + + QUICK_LINK, + + UNKNOWN + } + + public interface Visitor { + T visitVisible(); + + T visitHidden(); + + T visitArchived(); + + T visitQuickLink(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponseThreeDsLevel.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponseThreeDsLevel.java new file mode 100644 index 00000000..08b83c4f --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/CreateCheckoutConfigurationsResponseThreeDsLevel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateCheckoutConfigurationsResponseThreeDsLevel { + public static final CreateCheckoutConfigurationsResponseThreeDsLevel MANDATE_CHALLENGE = + new CreateCheckoutConfigurationsResponseThreeDsLevel(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + public static final CreateCheckoutConfigurationsResponseThreeDsLevel FRICTIONLESS = + new CreateCheckoutConfigurationsResponseThreeDsLevel(Value.FRICTIONLESS, "frictionless"); + + private final Value value; + + private final String string; + + CreateCheckoutConfigurationsResponseThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateCheckoutConfigurationsResponseThreeDsLevel + && this.string.equals(((CreateCheckoutConfigurationsResponseThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case FRICTIONLESS: + return visitor.visitFrictionless(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateCheckoutConfigurationsResponseThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + case "frictionless": + return FRICTIONLESS; + default: + return new CreateCheckoutConfigurationsResponseThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + FRICTIONLESS, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitFrictionless(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/DeleteCheckoutConfigurationsResponse.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/DeleteCheckoutConfigurationsResponse.java new file mode 100644 index 00000000..76b476fc --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/DeleteCheckoutConfigurationsResponse.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteCheckoutConfigurationsResponse.Builder.class) +public final class DeleteCheckoutConfigurationsResponse { + private final boolean deleted; + + private final String id; + + private final Map additionalProperties; + + private DeleteCheckoutConfigurationsResponse(boolean deleted, String id, Map additionalProperties) { + this.deleted = deleted; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Always true. + */ + @JsonProperty("deleted") + public boolean getDeleted() { + return deleted; + } + + /** + * @return ID of the deleted checkout configuration. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteCheckoutConfigurationsResponse + && equalTo((DeleteCheckoutConfigurationsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteCheckoutConfigurationsResponse other) { + return deleted == other.deleted && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deleted, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeletedStage builder() { + return new Builder(); + } + + public interface DeletedStage { + /** + *

Always true.

+ */ + IdStage deleted(boolean deleted); + + Builder from(DeleteCheckoutConfigurationsResponse other); + } + + public interface IdStage { + /** + *

ID of the deleted checkout configuration.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DeleteCheckoutConfigurationsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeletedStage, IdStage, _FinalStage { + private boolean deleted; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeleteCheckoutConfigurationsResponse other) { + deleted(other.getDeleted()); + id(other.getId()); + return this; + } + + /** + *

Always true.

+ *

Always true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("deleted") + public IdStage deleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + *

ID of the deleted checkout configuration.

+ *

ID of the deleted checkout configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DeleteCheckoutConfigurationsResponse build() { + return new DeleteCheckoutConfigurationsResponse(deleted, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsRequestDirection.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsRequestDirection.java new file mode 100644 index 00000000..27ff36f8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsRequestDirection.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListCheckoutConfigurationsRequestDirection { + public static final ListCheckoutConfigurationsRequestDirection ASC = + new ListCheckoutConfigurationsRequestDirection(Value.ASC, "asc"); + + public static final ListCheckoutConfigurationsRequestDirection DESC = + new ListCheckoutConfigurationsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListCheckoutConfigurationsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListCheckoutConfigurationsRequestDirection + && this.string.equals(((ListCheckoutConfigurationsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListCheckoutConfigurationsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListCheckoutConfigurationsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsRequestOrder.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsRequestOrder.java new file mode 100644 index 00000000..8ebd8146 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsRequestOrder.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListCheckoutConfigurationsRequestOrder { + public static final ListCheckoutConfigurationsRequestOrder CREATED_AT = + new ListCheckoutConfigurationsRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListCheckoutConfigurationsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListCheckoutConfigurationsRequestOrder + && this.string.equals(((ListCheckoutConfigurationsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListCheckoutConfigurationsRequestOrder valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + default: + return new ListCheckoutConfigurationsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponse.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponse.java new file mode 100644 index 00000000..ba59acbd --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCheckoutConfigurationsResponse.Builder.class) +public final class ListCheckoutConfigurationsResponse { + private final List data; + + private final ListCheckoutConfigurationsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListCheckoutConfigurationsResponse( + List data, + ListCheckoutConfigurationsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListCheckoutConfigurationsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCheckoutConfigurationsResponse + && equalTo((ListCheckoutConfigurationsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCheckoutConfigurationsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListCheckoutConfigurationsResponsePageInfo pageInfo); + + Builder from(ListCheckoutConfigurationsResponse other); + } + + public interface _FinalStage { + ListCheckoutConfigurationsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ListCheckoutConfigurationsResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListCheckoutConfigurationsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCheckoutConfigurationsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListCheckoutConfigurationsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ListCheckoutConfigurationsResponseDataItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListCheckoutConfigurationsResponse build() { + return new ListCheckoutConfigurationsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItem.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItem.java new file mode 100644 index 00000000..f1e30e94 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItem.java @@ -0,0 +1,968 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCheckoutConfigurationsResponseDataItem.Builder.class) +public final class ListCheckoutConfigurationsResponseDataItem { + private final String accountId; + + private final Optional affiliateCode; + + private final String createdAt; + + private final Optional currency; + + private final Optional + effectivePaymentMethodConfiguration; + + private final String id; + + private final Optional> metadata; + + private final ListCheckoutConfigurationsResponseDataItemMode mode; + + private final Optional + paymentMethodConfiguration; + + private final Optional plan; + + private final Optional purchaseUrl; + + private final Optional redirectUrl; + + private final Optional threeDsLevel; + + private final String updatedAt; + + private final Map additionalProperties; + + private ListCheckoutConfigurationsResponseDataItem( + String accountId, + Optional affiliateCode, + String createdAt, + Optional currency, + Optional + effectivePaymentMethodConfiguration, + String id, + Optional> metadata, + ListCheckoutConfigurationsResponseDataItemMode mode, + Optional paymentMethodConfiguration, + Optional plan, + Optional purchaseUrl, + Optional redirectUrl, + Optional threeDsLevel, + String updatedAt, + Map additionalProperties) { + this.accountId = accountId; + this.affiliateCode = affiliateCode; + this.createdAt = createdAt; + this.currency = currency; + this.effectivePaymentMethodConfiguration = effectivePaymentMethodConfiguration; + this.id = id; + this.metadata = metadata; + this.mode = mode; + this.paymentMethodConfiguration = paymentMethodConfiguration; + this.plan = plan; + this.purchaseUrl = purchaseUrl; + this.redirectUrl = redirectUrl; + this.threeDsLevel = threeDsLevel; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Affiliate code applied at checkout, or null when none is set. + */ + @JsonIgnore + public Optional getAffiliateCode() { + if (affiliateCode == null) { + return Optional.empty(); + } + return affiliateCode; + } + + /** + * @return When the checkout configuration was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Currency used for setup-mode payment method availability; defaults to usd when omitted. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override. + */ + @JsonIgnore + public Optional + getEffectivePaymentMethodConfiguration() { + if (effectivePaymentMethodConfiguration == null) { + return Optional.empty(); + } + return effectivePaymentMethodConfiguration; + } + + /** + * @return Checkout configuration ID, prefixed ch_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Controls whether checkout charges the buyer immediately or saves payment details for later. + */ + @JsonProperty("mode") + public ListCheckoutConfigurationsResponseDataItemMode getMode() { + return mode; + } + + /** + * @return Payment method overrides for this checkout. null when it uses the plan or platform defaults. + */ + @JsonIgnore + public Optional + getPaymentMethodConfiguration() { + if (paymentMethodConfiguration == null) { + return Optional.empty(); + } + return paymentMethodConfiguration; + } + + /** + * @return Plan used for payment checkout. null in setup mode. + */ + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + /** + * @return Checkout URL you can send to customers. + */ + @JsonIgnore + public Optional getPurchaseUrl() { + if (purchaseUrl == null) { + return Optional.empty(); + } + return purchaseUrl; + } + + /** + * @return URL customers are sent to after checkout, or null when no redirect is configured. + */ + @JsonIgnore + public Optional getRedirectUrl() { + if (redirectUrl == null) { + return Optional.empty(); + } + return redirectUrl; + } + + /** + * @return 3D Secure behavior for this checkout, or null to use the account default. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return When the checkout configuration was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("affiliate_code") + private Optional _getAffiliateCode() { + return affiliateCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("effective_payment_method_configuration") + private Optional + _getEffectivePaymentMethodConfiguration() { + return effectivePaymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_configuration") + private Optional + _getPaymentMethodConfiguration() { + return paymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("purchase_url") + private Optional _getPurchaseUrl() { + return purchaseUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("redirect_url") + private Optional _getRedirectUrl() { + return redirectUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCheckoutConfigurationsResponseDataItem + && equalTo((ListCheckoutConfigurationsResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCheckoutConfigurationsResponseDataItem other) { + return accountId.equals(other.accountId) + && affiliateCode.equals(other.affiliateCode) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && effectivePaymentMethodConfiguration.equals(other.effectivePaymentMethodConfiguration) + && id.equals(other.id) + && metadata.equals(other.metadata) + && mode.equals(other.mode) + && paymentMethodConfiguration.equals(other.paymentMethodConfiguration) + && plan.equals(other.plan) + && purchaseUrl.equals(other.purchaseUrl) + && redirectUrl.equals(other.redirectUrl) + && threeDsLevel.equals(other.threeDsLevel) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.affiliateCode, + this.createdAt, + this.currency, + this.effectivePaymentMethodConfiguration, + this.id, + this.metadata, + this.mode, + this.paymentMethodConfiguration, + this.plan, + this.purchaseUrl, + this.redirectUrl, + this.threeDsLevel, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Account ID, prefixed biz_.

+ */ + CreatedAtStage accountId(@NotNull String accountId); + + Builder from(ListCheckoutConfigurationsResponseDataItem other); + } + + public interface CreatedAtStage { + /** + *

When the checkout configuration was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Checkout configuration ID, prefixed ch_.

+ */ + ModeStage id(@NotNull String id); + } + + public interface ModeStage { + /** + *

Controls whether checkout charges the buyer immediately or saves payment details for later.

+ */ + UpdatedAtStage mode(@NotNull ListCheckoutConfigurationsResponseDataItemMode mode); + } + + public interface UpdatedAtStage { + /** + *

When the checkout configuration was last updated, as an ISO 8601 timestamp.

+ */ + _FinalStage updatedAt(@NotNull String updatedAt); + } + + public interface _FinalStage { + ListCheckoutConfigurationsResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ */ + _FinalStage affiliateCode(Optional affiliateCode); + + _FinalStage affiliateCode(String affiliateCode); + + _FinalStage affiliateCode(Nullable affiliateCode); + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + _FinalStage currency(Nullable currency); + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ */ + _FinalStage effectivePaymentMethodConfiguration( + Optional + effectivePaymentMethodConfiguration); + + _FinalStage effectivePaymentMethodConfiguration( + ListCheckoutConfigurationsResponseDataItemEffectivePaymentMethodConfiguration + effectivePaymentMethodConfiguration); + + _FinalStage effectivePaymentMethodConfiguration( + Nullable + effectivePaymentMethodConfiguration); + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ */ + _FinalStage paymentMethodConfiguration( + Optional + paymentMethodConfiguration); + + _FinalStage paymentMethodConfiguration( + ListCheckoutConfigurationsResponseDataItemPaymentMethodConfiguration paymentMethodConfiguration); + + _FinalStage paymentMethodConfiguration( + Nullable + paymentMethodConfiguration); + + /** + *

Plan used for payment checkout. null in setup mode.

+ */ + _FinalStage plan(Optional plan); + + _FinalStage plan(ListCheckoutConfigurationsResponseDataItemPlan plan); + + _FinalStage plan(Nullable plan); + + /** + *

Checkout URL you can send to customers.

+ */ + _FinalStage purchaseUrl(Optional purchaseUrl); + + _FinalStage purchaseUrl(String purchaseUrl); + + _FinalStage purchaseUrl(Nullable purchaseUrl); + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ */ + _FinalStage redirectUrl(Optional redirectUrl); + + _FinalStage redirectUrl(String redirectUrl); + + _FinalStage redirectUrl(Nullable redirectUrl); + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ */ + _FinalStage threeDsLevel(Optional threeDsLevel); + + _FinalStage threeDsLevel(ListCheckoutConfigurationsResponseDataItemThreeDsLevel threeDsLevel); + + _FinalStage threeDsLevel(Nullable threeDsLevel); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, CreatedAtStage, IdStage, ModeStage, UpdatedAtStage, _FinalStage { + private String accountId; + + private String createdAt; + + private String id; + + private ListCheckoutConfigurationsResponseDataItemMode mode; + + private String updatedAt; + + private Optional threeDsLevel = Optional.empty(); + + private Optional redirectUrl = Optional.empty(); + + private Optional purchaseUrl = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional + paymentMethodConfiguration = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional + effectivePaymentMethodConfiguration = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional affiliateCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCheckoutConfigurationsResponseDataItem other) { + accountId(other.getAccountId()); + affiliateCode(other.getAffiliateCode()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + effectivePaymentMethodConfiguration(other.getEffectivePaymentMethodConfiguration()); + id(other.getId()); + metadata(other.getMetadata()); + mode(other.getMode()); + paymentMethodConfiguration(other.getPaymentMethodConfiguration()); + plan(other.getPlan()); + purchaseUrl(other.getPurchaseUrl()); + redirectUrl(other.getRedirectUrl()); + threeDsLevel(other.getThreeDsLevel()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ *

Account ID, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public CreatedAtStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

When the checkout configuration was created, as an ISO 8601 timestamp.

+ *

When the checkout configuration was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Checkout configuration ID, prefixed ch_.

+ *

Checkout configuration ID, prefixed ch_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ModeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Controls whether checkout charges the buyer immediately or saves payment details for later.

+ *

Controls whether checkout charges the buyer immediately or saves payment details for later.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("mode") + public UpdatedAtStage mode(@NotNull ListCheckoutConfigurationsResponseDataItemMode mode) { + this.mode = Objects.requireNonNull(mode, "mode must not be null"); + return this; + } + + /** + *

When the checkout configuration was last updated, as an ISO 8601 timestamp.

+ *

When the checkout configuration was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(ListCheckoutConfigurationsResponseDataItemThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ */ + @java.lang.Override + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public _FinalStage threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectUrl(Nullable redirectUrl) { + if (redirectUrl.isNull()) { + this.redirectUrl = null; + } else if (redirectUrl.isEmpty()) { + this.redirectUrl = Optional.empty(); + } else { + this.redirectUrl = Optional.of(redirectUrl.get()); + } + return this; + } + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectUrl(String redirectUrl) { + this.redirectUrl = Optional.ofNullable(redirectUrl); + return this; + } + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ */ + @java.lang.Override + @JsonSetter(value = "redirect_url", nulls = Nulls.SKIP) + public _FinalStage redirectUrl(Optional redirectUrl) { + this.redirectUrl = redirectUrl; + return this; + } + + /** + *

Checkout URL you can send to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage purchaseUrl(Nullable purchaseUrl) { + if (purchaseUrl.isNull()) { + this.purchaseUrl = null; + } else if (purchaseUrl.isEmpty()) { + this.purchaseUrl = Optional.empty(); + } else { + this.purchaseUrl = Optional.of(purchaseUrl.get()); + } + return this; + } + + /** + *

Checkout URL you can send to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage purchaseUrl(String purchaseUrl) { + this.purchaseUrl = Optional.ofNullable(purchaseUrl); + return this; + } + + /** + *

Checkout URL you can send to customers.

+ */ + @java.lang.Override + @JsonSetter(value = "purchase_url", nulls = Nulls.SKIP) + public _FinalStage purchaseUrl(Optional purchaseUrl) { + this.purchaseUrl = purchaseUrl; + return this; + } + + /** + *

Plan used for payment checkout. null in setup mode.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + /** + *

Plan used for payment checkout. null in setup mode.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(ListCheckoutConfigurationsResponseDataItemPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + /** + *

Plan used for payment checkout. null in setup mode.

+ */ + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodConfiguration( + Nullable + paymentMethodConfiguration) { + if (paymentMethodConfiguration.isNull()) { + this.paymentMethodConfiguration = null; + } else if (paymentMethodConfiguration.isEmpty()) { + this.paymentMethodConfiguration = Optional.empty(); + } else { + this.paymentMethodConfiguration = Optional.of(paymentMethodConfiguration.get()); + } + return this; + } + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodConfiguration( + ListCheckoutConfigurationsResponseDataItemPaymentMethodConfiguration paymentMethodConfiguration) { + this.paymentMethodConfiguration = Optional.ofNullable(paymentMethodConfiguration); + return this; + } + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_configuration", nulls = Nulls.SKIP) + public _FinalStage paymentMethodConfiguration( + Optional + paymentMethodConfiguration) { + this.paymentMethodConfiguration = paymentMethodConfiguration; + return this; + } + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage effectivePaymentMethodConfiguration( + Nullable + effectivePaymentMethodConfiguration) { + if (effectivePaymentMethodConfiguration.isNull()) { + this.effectivePaymentMethodConfiguration = null; + } else if (effectivePaymentMethodConfiguration.isEmpty()) { + this.effectivePaymentMethodConfiguration = Optional.empty(); + } else { + this.effectivePaymentMethodConfiguration = Optional.of(effectivePaymentMethodConfiguration.get()); + } + return this; + } + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage effectivePaymentMethodConfiguration( + ListCheckoutConfigurationsResponseDataItemEffectivePaymentMethodConfiguration + effectivePaymentMethodConfiguration) { + this.effectivePaymentMethodConfiguration = Optional.ofNullable(effectivePaymentMethodConfiguration); + return this; + } + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ */ + @java.lang.Override + @JsonSetter(value = "effective_payment_method_configuration", nulls = Nulls.SKIP) + public _FinalStage effectivePaymentMethodConfiguration( + Optional + effectivePaymentMethodConfiguration) { + this.effectivePaymentMethodConfiguration = effectivePaymentMethodConfiguration; + return this; + } + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage affiliateCode(Nullable affiliateCode) { + if (affiliateCode.isNull()) { + this.affiliateCode = null; + } else if (affiliateCode.isEmpty()) { + this.affiliateCode = Optional.empty(); + } else { + this.affiliateCode = Optional.of(affiliateCode.get()); + } + return this; + } + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage affiliateCode(String affiliateCode) { + this.affiliateCode = Optional.ofNullable(affiliateCode); + return this; + } + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ */ + @java.lang.Override + @JsonSetter(value = "affiliate_code", nulls = Nulls.SKIP) + public _FinalStage affiliateCode(Optional affiliateCode) { + this.affiliateCode = affiliateCode; + return this; + } + + @java.lang.Override + public ListCheckoutConfigurationsResponseDataItem build() { + return new ListCheckoutConfigurationsResponseDataItem( + accountId, + affiliateCode, + createdAt, + currency, + effectivePaymentMethodConfiguration, + id, + metadata, + mode, + paymentMethodConfiguration, + plan, + purchaseUrl, + redirectUrl, + threeDsLevel, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemEffectivePaymentMethodConfiguration.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemEffectivePaymentMethodConfiguration.java new file mode 100644 index 00000000..675c92af --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemEffectivePaymentMethodConfiguration.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCheckoutConfigurationsResponseDataItemEffectivePaymentMethodConfiguration.Builder.class) +public final class ListCheckoutConfigurationsResponseDataItemEffectivePaymentMethodConfiguration { + private final Optional> disabled; + + private final Optional> enabled; + + private final Optional includePlatformDefaults; + + private final Map additionalProperties; + + private ListCheckoutConfigurationsResponseDataItemEffectivePaymentMethodConfiguration( + Optional> disabled, + Optional> enabled, + Optional includePlatformDefaults, + Map additionalProperties) { + this.disabled = disabled; + this.enabled = enabled; + this.includePlatformDefaults = includePlatformDefaults; + this.additionalProperties = additionalProperties; + } + + /** + * @return Payment methods explicitly disabled. + */ + @JsonProperty("disabled") + public Optional> getDisabled() { + return disabled; + } + + /** + * @return Payment methods explicitly enabled. + */ + @JsonProperty("enabled") + public Optional> getEnabled() { + return enabled; + } + + /** + * @return Whether platform default payment methods are included. + */ + @JsonProperty("include_platform_defaults") + public Optional getIncludePlatformDefaults() { + return includePlatformDefaults; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCheckoutConfigurationsResponseDataItemEffectivePaymentMethodConfiguration + && equalTo((ListCheckoutConfigurationsResponseDataItemEffectivePaymentMethodConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCheckoutConfigurationsResponseDataItemEffectivePaymentMethodConfiguration other) { + return disabled.equals(other.disabled) + && enabled.equals(other.enabled) + && includePlatformDefaults.equals(other.includePlatformDefaults); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.disabled, this.enabled, this.includePlatformDefaults); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> disabled = Optional.empty(); + + private Optional> enabled = Optional.empty(); + + private Optional includePlatformDefaults = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListCheckoutConfigurationsResponseDataItemEffectivePaymentMethodConfiguration other) { + disabled(other.getDisabled()); + enabled(other.getEnabled()); + includePlatformDefaults(other.getIncludePlatformDefaults()); + return this; + } + + /** + *

Payment methods explicitly disabled.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional> disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(List disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

Payment methods explicitly enabled.

+ */ + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional> enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(List enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + /** + *

Whether platform default payment methods are included.

+ */ + @JsonSetter(value = "include_platform_defaults", nulls = Nulls.SKIP) + public Builder includePlatformDefaults(Optional includePlatformDefaults) { + this.includePlatformDefaults = includePlatformDefaults; + return this; + } + + public Builder includePlatformDefaults(Boolean includePlatformDefaults) { + this.includePlatformDefaults = Optional.ofNullable(includePlatformDefaults); + return this; + } + + public ListCheckoutConfigurationsResponseDataItemEffectivePaymentMethodConfiguration build() { + return new ListCheckoutConfigurationsResponseDataItemEffectivePaymentMethodConfiguration( + disabled, enabled, includePlatformDefaults, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemMode.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemMode.java new file mode 100644 index 00000000..c16929c8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemMode.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListCheckoutConfigurationsResponseDataItemMode { + public static final ListCheckoutConfigurationsResponseDataItemMode SETUP = + new ListCheckoutConfigurationsResponseDataItemMode(Value.SETUP, "setup"); + + public static final ListCheckoutConfigurationsResponseDataItemMode PAYMENT = + new ListCheckoutConfigurationsResponseDataItemMode(Value.PAYMENT, "payment"); + + private final Value value; + + private final String string; + + ListCheckoutConfigurationsResponseDataItemMode(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListCheckoutConfigurationsResponseDataItemMode + && this.string.equals(((ListCheckoutConfigurationsResponseDataItemMode) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SETUP: + return visitor.visitSetup(); + case PAYMENT: + return visitor.visitPayment(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListCheckoutConfigurationsResponseDataItemMode valueOf(String value) { + switch (value) { + case "setup": + return SETUP; + case "payment": + return PAYMENT; + default: + return new ListCheckoutConfigurationsResponseDataItemMode(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYMENT, + + SETUP, + + UNKNOWN + } + + public interface Visitor { + T visitPayment(); + + T visitSetup(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPaymentMethodConfiguration.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPaymentMethodConfiguration.java new file mode 100644 index 00000000..bacb5f49 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPaymentMethodConfiguration.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCheckoutConfigurationsResponseDataItemPaymentMethodConfiguration.Builder.class) +public final class ListCheckoutConfigurationsResponseDataItemPaymentMethodConfiguration { + private final Optional> disabled; + + private final Optional> enabled; + + private final Optional includePlatformDefaults; + + private final Map additionalProperties; + + private ListCheckoutConfigurationsResponseDataItemPaymentMethodConfiguration( + Optional> disabled, + Optional> enabled, + Optional includePlatformDefaults, + Map additionalProperties) { + this.disabled = disabled; + this.enabled = enabled; + this.includePlatformDefaults = includePlatformDefaults; + this.additionalProperties = additionalProperties; + } + + /** + * @return Payment methods explicitly disabled for checkout. + */ + @JsonProperty("disabled") + public Optional> getDisabled() { + return disabled; + } + + /** + * @return Payment methods explicitly enabled for checkout. + */ + @JsonProperty("enabled") + public Optional> getEnabled() { + return enabled; + } + + /** + * @return Whether platform default payment methods are included. + */ + @JsonProperty("include_platform_defaults") + public Optional getIncludePlatformDefaults() { + return includePlatformDefaults; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCheckoutConfigurationsResponseDataItemPaymentMethodConfiguration + && equalTo((ListCheckoutConfigurationsResponseDataItemPaymentMethodConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCheckoutConfigurationsResponseDataItemPaymentMethodConfiguration other) { + return disabled.equals(other.disabled) + && enabled.equals(other.enabled) + && includePlatformDefaults.equals(other.includePlatformDefaults); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.disabled, this.enabled, this.includePlatformDefaults); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> disabled = Optional.empty(); + + private Optional> enabled = Optional.empty(); + + private Optional includePlatformDefaults = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListCheckoutConfigurationsResponseDataItemPaymentMethodConfiguration other) { + disabled(other.getDisabled()); + enabled(other.getEnabled()); + includePlatformDefaults(other.getIncludePlatformDefaults()); + return this; + } + + /** + *

Payment methods explicitly disabled for checkout.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional> disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(List disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

Payment methods explicitly enabled for checkout.

+ */ + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional> enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(List enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + /** + *

Whether platform default payment methods are included.

+ */ + @JsonSetter(value = "include_platform_defaults", nulls = Nulls.SKIP) + public Builder includePlatformDefaults(Optional includePlatformDefaults) { + this.includePlatformDefaults = includePlatformDefaults; + return this; + } + + public Builder includePlatformDefaults(Boolean includePlatformDefaults) { + this.includePlatformDefaults = Optional.ofNullable(includePlatformDefaults); + return this; + } + + public ListCheckoutConfigurationsResponseDataItemPaymentMethodConfiguration build() { + return new ListCheckoutConfigurationsResponseDataItemPaymentMethodConfiguration( + disabled, enabled, includePlatformDefaults, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPlan.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPlan.java new file mode 100644 index 00000000..7dce7ba6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPlan.java @@ -0,0 +1,700 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCheckoutConfigurationsResponseDataItemPlan.Builder.class) +public final class ListCheckoutConfigurationsResponseDataItemPlan { + private final boolean adaptivePricingEnabled; + + private final Optional billingPeriod; + + private final String currency; + + private final Optional expirationDays; + + private final String id; + + private final double initialPrice; + + private final ListCheckoutConfigurationsResponseDataItemPlanPlanType planType; + + private final ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod releaseMethod; + + private final double renewalPrice; + + private final Optional threeDsLevel; + + private final Optional trialPeriodDays; + + private final ListCheckoutConfigurationsResponseDataItemPlanVisibility visibility; + + private final Map additionalProperties; + + private ListCheckoutConfigurationsResponseDataItemPlan( + boolean adaptivePricingEnabled, + Optional billingPeriod, + String currency, + Optional expirationDays, + String id, + double initialPrice, + ListCheckoutConfigurationsResponseDataItemPlanPlanType planType, + ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod releaseMethod, + double renewalPrice, + Optional threeDsLevel, + Optional trialPeriodDays, + ListCheckoutConfigurationsResponseDataItemPlanVisibility visibility, + Map additionalProperties) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + this.billingPeriod = billingPeriod; + this.currency = currency; + this.expirationDays = expirationDays; + this.id = id; + this.initialPrice = initialPrice; + this.planType = planType; + this.releaseMethod = releaseMethod; + this.renewalPrice = renewalPrice; + this.threeDsLevel = threeDsLevel; + this.trialPeriodDays = trialPeriodDays; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether this plan accepts local currency payments via adaptive pricing. + */ + @JsonProperty("adaptive_pricing_enabled") + public boolean getAdaptivePricingEnabled() { + return adaptivePricingEnabled; + } + + /** + * @return Recurring billing interval in days, such as 30 for monthly or 365 for annual. null for one-time plans. + */ + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + /** + * @return Three-letter ISO currency code for the plan's prices. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Access duration in days for expiration-based plans. + */ + @JsonIgnore + public Optional getExpirationDays() { + if (expirationDays == null) { + return Optional.empty(); + } + return expirationDays; + } + + /** + * @return Plan ID, prefixed plan_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Initial purchase price in the plan currency. + */ + @JsonProperty("initial_price") + public double getInitialPrice() { + return initialPrice; + } + + /** + * @return Billing model for the plan. + */ + @JsonProperty("plan_type") + public ListCheckoutConfigurationsResponseDataItemPlanPlanType getPlanType() { + return planType; + } + + /** + * @return Sales method for the plan. + */ + @JsonProperty("release_method") + public ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod getReleaseMethod() { + return releaseMethod; + } + + /** + * @return Recurring price charged each billing period. + */ + @JsonProperty("renewal_price") + public double getRenewalPrice() { + return renewalPrice; + } + + /** + * @return 3D Secure behavior for this plan, or null to use the account default. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return Free trial days before the first renewal charge. + */ + @JsonIgnore + public Optional getTrialPeriodDays() { + if (trialPeriodDays == null) { + return Optional.empty(); + } + return trialPeriodDays; + } + + /** + * @return Whether the plan is visible to customers or hidden from public view. + */ + @JsonProperty("visibility") + public ListCheckoutConfigurationsResponseDataItemPlanVisibility getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_days") + private Optional _getExpirationDays() { + return expirationDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trial_period_days") + private Optional _getTrialPeriodDays() { + return trialPeriodDays; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCheckoutConfigurationsResponseDataItemPlan + && equalTo((ListCheckoutConfigurationsResponseDataItemPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCheckoutConfigurationsResponseDataItemPlan other) { + return adaptivePricingEnabled == other.adaptivePricingEnabled + && billingPeriod.equals(other.billingPeriod) + && currency.equals(other.currency) + && expirationDays.equals(other.expirationDays) + && id.equals(other.id) + && initialPrice == other.initialPrice + && planType.equals(other.planType) + && releaseMethod.equals(other.releaseMethod) + && renewalPrice == other.renewalPrice + && threeDsLevel.equals(other.threeDsLevel) + && trialPeriodDays.equals(other.trialPeriodDays) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adaptivePricingEnabled, + this.billingPeriod, + this.currency, + this.expirationDays, + this.id, + this.initialPrice, + this.planType, + this.releaseMethod, + this.renewalPrice, + this.threeDsLevel, + this.trialPeriodDays, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdaptivePricingEnabledStage builder() { + return new Builder(); + } + + public interface AdaptivePricingEnabledStage { + /** + *

Whether this plan accepts local currency payments via adaptive pricing.

+ */ + CurrencyStage adaptivePricingEnabled(boolean adaptivePricingEnabled); + + Builder from(ListCheckoutConfigurationsResponseDataItemPlan other); + } + + public interface CurrencyStage { + /** + *

Three-letter ISO currency code for the plan's prices.

+ */ + IdStage currency(@NotNull String currency); + } + + public interface IdStage { + /** + *

Plan ID, prefixed plan_.

+ */ + InitialPriceStage id(@NotNull String id); + } + + public interface InitialPriceStage { + /** + *

Initial purchase price in the plan currency.

+ */ + PlanTypeStage initialPrice(double initialPrice); + } + + public interface PlanTypeStage { + /** + *

Billing model for the plan.

+ */ + ReleaseMethodStage planType(@NotNull ListCheckoutConfigurationsResponseDataItemPlanPlanType planType); + } + + public interface ReleaseMethodStage { + /** + *

Sales method for the plan.

+ */ + RenewalPriceStage releaseMethod( + @NotNull ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod releaseMethod); + } + + public interface RenewalPriceStage { + /** + *

Recurring price charged each billing period.

+ */ + VisibilityStage renewalPrice(double renewalPrice); + } + + public interface VisibilityStage { + /** + *

Whether the plan is visible to customers or hidden from public view.

+ */ + _FinalStage visibility(@NotNull ListCheckoutConfigurationsResponseDataItemPlanVisibility visibility); + } + + public interface _FinalStage { + ListCheckoutConfigurationsResponseDataItemPlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Recurring billing interval in days, such as 30 for monthly or 365 for annual. null for one-time plans.

+ */ + _FinalStage billingPeriod(Optional billingPeriod); + + _FinalStage billingPeriod(Integer billingPeriod); + + _FinalStage billingPeriod(Nullable billingPeriod); + + /** + *

Access duration in days for expiration-based plans.

+ */ + _FinalStage expirationDays(Optional expirationDays); + + _FinalStage expirationDays(Integer expirationDays); + + _FinalStage expirationDays(Nullable expirationDays); + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ */ + _FinalStage threeDsLevel(Optional threeDsLevel); + + _FinalStage threeDsLevel(ListCheckoutConfigurationsResponseDataItemPlanThreeDsLevel threeDsLevel); + + _FinalStage threeDsLevel(Nullable threeDsLevel); + + /** + *

Free trial days before the first renewal charge.

+ */ + _FinalStage trialPeriodDays(Optional trialPeriodDays); + + _FinalStage trialPeriodDays(Integer trialPeriodDays); + + _FinalStage trialPeriodDays(Nullable trialPeriodDays); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AdaptivePricingEnabledStage, + CurrencyStage, + IdStage, + InitialPriceStage, + PlanTypeStage, + ReleaseMethodStage, + RenewalPriceStage, + VisibilityStage, + _FinalStage { + private boolean adaptivePricingEnabled; + + private String currency; + + private String id; + + private double initialPrice; + + private ListCheckoutConfigurationsResponseDataItemPlanPlanType planType; + + private ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod releaseMethod; + + private double renewalPrice; + + private ListCheckoutConfigurationsResponseDataItemPlanVisibility visibility; + + private Optional trialPeriodDays = Optional.empty(); + + private Optional threeDsLevel = Optional.empty(); + + private Optional expirationDays = Optional.empty(); + + private Optional billingPeriod = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCheckoutConfigurationsResponseDataItemPlan other) { + adaptivePricingEnabled(other.getAdaptivePricingEnabled()); + billingPeriod(other.getBillingPeriod()); + currency(other.getCurrency()); + expirationDays(other.getExpirationDays()); + id(other.getId()); + initialPrice(other.getInitialPrice()); + planType(other.getPlanType()); + releaseMethod(other.getReleaseMethod()); + renewalPrice(other.getRenewalPrice()); + threeDsLevel(other.getThreeDsLevel()); + trialPeriodDays(other.getTrialPeriodDays()); + visibility(other.getVisibility()); + return this; + } + + /** + *

Whether this plan accepts local currency payments via adaptive pricing.

+ *

Whether this plan accepts local currency payments via adaptive pricing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("adaptive_pricing_enabled") + public CurrencyStage adaptivePricingEnabled(boolean adaptivePricingEnabled) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + return this; + } + + /** + *

Three-letter ISO currency code for the plan's prices.

+ *

Three-letter ISO currency code for the plan's prices.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Plan ID, prefixed plan_.

+ *

Plan ID, prefixed plan_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public InitialPriceStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Initial purchase price in the plan currency.

+ *

Initial purchase price in the plan currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("initial_price") + public PlanTypeStage initialPrice(double initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + /** + *

Billing model for the plan.

+ *

Billing model for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan_type") + public ReleaseMethodStage planType(@NotNull ListCheckoutConfigurationsResponseDataItemPlanPlanType planType) { + this.planType = Objects.requireNonNull(planType, "planType must not be null"); + return this; + } + + /** + *

Sales method for the plan.

+ *

Sales method for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("release_method") + public RenewalPriceStage releaseMethod( + @NotNull ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod releaseMethod) { + this.releaseMethod = Objects.requireNonNull(releaseMethod, "releaseMethod must not be null"); + return this; + } + + /** + *

Recurring price charged each billing period.

+ *

Recurring price charged each billing period.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("renewal_price") + public VisibilityStage renewalPrice(double renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + /** + *

Whether the plan is visible to customers or hidden from public view.

+ *

Whether the plan is visible to customers or hidden from public view.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("visibility") + public _FinalStage visibility(@NotNull ListCheckoutConfigurationsResponseDataItemPlanVisibility visibility) { + this.visibility = Objects.requireNonNull(visibility, "visibility must not be null"); + return this; + } + + /** + *

Free trial days before the first renewal charge.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Nullable trialPeriodDays) { + if (trialPeriodDays.isNull()) { + this.trialPeriodDays = null; + } else if (trialPeriodDays.isEmpty()) { + this.trialPeriodDays = Optional.empty(); + } else { + this.trialPeriodDays = Optional.of(trialPeriodDays.get()); + } + return this; + } + + /** + *

Free trial days before the first renewal charge.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Integer trialPeriodDays) { + this.trialPeriodDays = Optional.ofNullable(trialPeriodDays); + return this; + } + + /** + *

Free trial days before the first renewal charge.

+ */ + @java.lang.Override + @JsonSetter(value = "trial_period_days", nulls = Nulls.SKIP) + public _FinalStage trialPeriodDays(Optional trialPeriodDays) { + this.trialPeriodDays = trialPeriodDays; + return this; + } + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel( + Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(ListCheckoutConfigurationsResponseDataItemPlanThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ */ + @java.lang.Override + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public _FinalStage threeDsLevel( + Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + /** + *

Access duration in days for expiration-based plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Nullable expirationDays) { + if (expirationDays.isNull()) { + this.expirationDays = null; + } else if (expirationDays.isEmpty()) { + this.expirationDays = Optional.empty(); + } else { + this.expirationDays = Optional.of(expirationDays.get()); + } + return this; + } + + /** + *

Access duration in days for expiration-based plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Integer expirationDays) { + this.expirationDays = Optional.ofNullable(expirationDays); + return this; + } + + /** + *

Access duration in days for expiration-based plans.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_days", nulls = Nulls.SKIP) + public _FinalStage expirationDays(Optional expirationDays) { + this.expirationDays = expirationDays; + return this; + } + + /** + *

Recurring billing interval in days, such as 30 for monthly or 365 for annual. null for one-time plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + /** + *

Recurring billing interval in days, such as 30 for monthly or 365 for annual. null for one-time plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Integer billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + /** + *

Recurring billing interval in days, such as 30 for monthly or 365 for annual. null for one-time plans.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public _FinalStage billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + @java.lang.Override + public ListCheckoutConfigurationsResponseDataItemPlan build() { + return new ListCheckoutConfigurationsResponseDataItemPlan( + adaptivePricingEnabled, + billingPeriod, + currency, + expirationDays, + id, + initialPrice, + planType, + releaseMethod, + renewalPrice, + threeDsLevel, + trialPeriodDays, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPlanPlanType.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPlanPlanType.java new file mode 100644 index 00000000..74fa2ac0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPlanPlanType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListCheckoutConfigurationsResponseDataItemPlanPlanType { + public static final ListCheckoutConfigurationsResponseDataItemPlanPlanType RENEWAL = + new ListCheckoutConfigurationsResponseDataItemPlanPlanType(Value.RENEWAL, "renewal"); + + public static final ListCheckoutConfigurationsResponseDataItemPlanPlanType ONE_TIME = + new ListCheckoutConfigurationsResponseDataItemPlanPlanType(Value.ONE_TIME, "one_time"); + + private final Value value; + + private final String string; + + ListCheckoutConfigurationsResponseDataItemPlanPlanType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListCheckoutConfigurationsResponseDataItemPlanPlanType + && this.string.equals(((ListCheckoutConfigurationsResponseDataItemPlanPlanType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RENEWAL: + return visitor.visitRenewal(); + case ONE_TIME: + return visitor.visitOneTime(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListCheckoutConfigurationsResponseDataItemPlanPlanType valueOf(String value) { + switch (value) { + case "renewal": + return RENEWAL; + case "one_time": + return ONE_TIME; + default: + return new ListCheckoutConfigurationsResponseDataItemPlanPlanType(Value.UNKNOWN, value); + } + } + + public enum Value { + RENEWAL, + + ONE_TIME, + + UNKNOWN + } + + public interface Visitor { + T visitRenewal(); + + T visitOneTime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod.java new file mode 100644 index 00000000..62213437 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod { + public static final ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod WAITLIST = + new ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod(Value.WAITLIST, "waitlist"); + + public static final ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod BUY_NOW = + new ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod(Value.BUY_NOW, "buy_now"); + + private final Value value; + + private final String string; + + ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod + && this.string.equals( + ((ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WAITLIST: + return visitor.visitWaitlist(); + case BUY_NOW: + return visitor.visitBuyNow(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod valueOf(String value) { + switch (value) { + case "waitlist": + return WAITLIST; + case "buy_now": + return BUY_NOW; + default: + return new ListCheckoutConfigurationsResponseDataItemPlanReleaseMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + BUY_NOW, + + WAITLIST, + + UNKNOWN + } + + public interface Visitor { + T visitBuyNow(); + + T visitWaitlist(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPlanThreeDsLevel.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPlanThreeDsLevel.java new file mode 100644 index 00000000..10b2a04a --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPlanThreeDsLevel.java @@ -0,0 +1,88 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListCheckoutConfigurationsResponseDataItemPlanThreeDsLevel { + public static final ListCheckoutConfigurationsResponseDataItemPlanThreeDsLevel MANDATE_CHALLENGE = + new ListCheckoutConfigurationsResponseDataItemPlanThreeDsLevel( + Value.MANDATE_CHALLENGE, "mandate_challenge"); + + public static final ListCheckoutConfigurationsResponseDataItemPlanThreeDsLevel FRICTIONLESS = + new ListCheckoutConfigurationsResponseDataItemPlanThreeDsLevel(Value.FRICTIONLESS, "frictionless"); + + private final Value value; + + private final String string; + + ListCheckoutConfigurationsResponseDataItemPlanThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListCheckoutConfigurationsResponseDataItemPlanThreeDsLevel + && this.string.equals( + ((ListCheckoutConfigurationsResponseDataItemPlanThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case FRICTIONLESS: + return visitor.visitFrictionless(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListCheckoutConfigurationsResponseDataItemPlanThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + case "frictionless": + return FRICTIONLESS; + default: + return new ListCheckoutConfigurationsResponseDataItemPlanThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + FRICTIONLESS, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitFrictionless(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPlanVisibility.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPlanVisibility.java new file mode 100644 index 00000000..ab9a8e67 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemPlanVisibility.java @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListCheckoutConfigurationsResponseDataItemPlanVisibility { + public static final ListCheckoutConfigurationsResponseDataItemPlanVisibility VISIBLE = + new ListCheckoutConfigurationsResponseDataItemPlanVisibility(Value.VISIBLE, "visible"); + + public static final ListCheckoutConfigurationsResponseDataItemPlanVisibility HIDDEN = + new ListCheckoutConfigurationsResponseDataItemPlanVisibility(Value.HIDDEN, "hidden"); + + public static final ListCheckoutConfigurationsResponseDataItemPlanVisibility QUICK_LINK = + new ListCheckoutConfigurationsResponseDataItemPlanVisibility(Value.QUICK_LINK, "quick_link"); + + public static final ListCheckoutConfigurationsResponseDataItemPlanVisibility ARCHIVED = + new ListCheckoutConfigurationsResponseDataItemPlanVisibility(Value.ARCHIVED, "archived"); + + private final Value value; + + private final String string; + + ListCheckoutConfigurationsResponseDataItemPlanVisibility(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListCheckoutConfigurationsResponseDataItemPlanVisibility + && this.string.equals( + ((ListCheckoutConfigurationsResponseDataItemPlanVisibility) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VISIBLE: + return visitor.visitVisible(); + case HIDDEN: + return visitor.visitHidden(); + case QUICK_LINK: + return visitor.visitQuickLink(); + case ARCHIVED: + return visitor.visitArchived(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListCheckoutConfigurationsResponseDataItemPlanVisibility valueOf(String value) { + switch (value) { + case "visible": + return VISIBLE; + case "hidden": + return HIDDEN; + case "quick_link": + return QUICK_LINK; + case "archived": + return ARCHIVED; + default: + return new ListCheckoutConfigurationsResponseDataItemPlanVisibility(Value.UNKNOWN, value); + } + } + + public enum Value { + VISIBLE, + + HIDDEN, + + ARCHIVED, + + QUICK_LINK, + + UNKNOWN + } + + public interface Visitor { + T visitVisible(); + + T visitHidden(); + + T visitArchived(); + + T visitQuickLink(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemThreeDsLevel.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemThreeDsLevel.java new file mode 100644 index 00000000..29612006 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponseDataItemThreeDsLevel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListCheckoutConfigurationsResponseDataItemThreeDsLevel { + public static final ListCheckoutConfigurationsResponseDataItemThreeDsLevel MANDATE_CHALLENGE = + new ListCheckoutConfigurationsResponseDataItemThreeDsLevel(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + public static final ListCheckoutConfigurationsResponseDataItemThreeDsLevel FRICTIONLESS = + new ListCheckoutConfigurationsResponseDataItemThreeDsLevel(Value.FRICTIONLESS, "frictionless"); + + private final Value value; + + private final String string; + + ListCheckoutConfigurationsResponseDataItemThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListCheckoutConfigurationsResponseDataItemThreeDsLevel + && this.string.equals(((ListCheckoutConfigurationsResponseDataItemThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case FRICTIONLESS: + return visitor.visitFrictionless(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListCheckoutConfigurationsResponseDataItemThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + case "frictionless": + return FRICTIONLESS; + default: + return new ListCheckoutConfigurationsResponseDataItemThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + FRICTIONLESS, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitFrictionless(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponsePageInfo.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponsePageInfo.java new file mode 100644 index 00000000..ef78dced --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/ListCheckoutConfigurationsResponsePageInfo.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCheckoutConfigurationsResponsePageInfo.Builder.class) +public final class ListCheckoutConfigurationsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListCheckoutConfigurationsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCheckoutConfigurationsResponsePageInfo + && equalTo((ListCheckoutConfigurationsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCheckoutConfigurationsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListCheckoutConfigurationsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListCheckoutConfigurationsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCheckoutConfigurationsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListCheckoutConfigurationsResponsePageInfo build() { + return new ListCheckoutConfigurationsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponse.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponse.java new file mode 100644 index 00000000..6a56a24f --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponse.java @@ -0,0 +1,962 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCheckoutConfigurationsResponse.Builder.class) +public final class RetrieveCheckoutConfigurationsResponse { + private final String accountId; + + private final Optional affiliateCode; + + private final String createdAt; + + private final Optional currency; + + private final Optional + effectivePaymentMethodConfiguration; + + private final String id; + + private final Optional> metadata; + + private final RetrieveCheckoutConfigurationsResponseMode mode; + + private final Optional paymentMethodConfiguration; + + private final Optional plan; + + private final Optional purchaseUrl; + + private final Optional redirectUrl; + + private final Optional threeDsLevel; + + private final String updatedAt; + + private final Map additionalProperties; + + private RetrieveCheckoutConfigurationsResponse( + String accountId, + Optional affiliateCode, + String createdAt, + Optional currency, + Optional + effectivePaymentMethodConfiguration, + String id, + Optional> metadata, + RetrieveCheckoutConfigurationsResponseMode mode, + Optional paymentMethodConfiguration, + Optional plan, + Optional purchaseUrl, + Optional redirectUrl, + Optional threeDsLevel, + String updatedAt, + Map additionalProperties) { + this.accountId = accountId; + this.affiliateCode = affiliateCode; + this.createdAt = createdAt; + this.currency = currency; + this.effectivePaymentMethodConfiguration = effectivePaymentMethodConfiguration; + this.id = id; + this.metadata = metadata; + this.mode = mode; + this.paymentMethodConfiguration = paymentMethodConfiguration; + this.plan = plan; + this.purchaseUrl = purchaseUrl; + this.redirectUrl = redirectUrl; + this.threeDsLevel = threeDsLevel; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Affiliate code applied at checkout, or null when none is set. + */ + @JsonIgnore + public Optional getAffiliateCode() { + if (affiliateCode == null) { + return Optional.empty(); + } + return affiliateCode; + } + + /** + * @return When the checkout configuration was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Currency used for setup-mode payment method availability; defaults to usd when omitted. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override. + */ + @JsonIgnore + public Optional + getEffectivePaymentMethodConfiguration() { + if (effectivePaymentMethodConfiguration == null) { + return Optional.empty(); + } + return effectivePaymentMethodConfiguration; + } + + /** + * @return Checkout configuration ID, prefixed ch_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Controls whether checkout charges the buyer immediately or saves payment details for later. + */ + @JsonProperty("mode") + public RetrieveCheckoutConfigurationsResponseMode getMode() { + return mode; + } + + /** + * @return Payment method overrides for this checkout. null when it uses the plan or platform defaults. + */ + @JsonIgnore + public Optional getPaymentMethodConfiguration() { + if (paymentMethodConfiguration == null) { + return Optional.empty(); + } + return paymentMethodConfiguration; + } + + /** + * @return Plan used for payment checkout. null in setup mode. + */ + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + /** + * @return Checkout URL you can send to customers. + */ + @JsonIgnore + public Optional getPurchaseUrl() { + if (purchaseUrl == null) { + return Optional.empty(); + } + return purchaseUrl; + } + + /** + * @return URL customers are sent to after checkout, or null when no redirect is configured. + */ + @JsonIgnore + public Optional getRedirectUrl() { + if (redirectUrl == null) { + return Optional.empty(); + } + return redirectUrl; + } + + /** + * @return 3D Secure behavior for this checkout, or null to use the account default. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return When the checkout configuration was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("affiliate_code") + private Optional _getAffiliateCode() { + return affiliateCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("effective_payment_method_configuration") + private Optional + _getEffectivePaymentMethodConfiguration() { + return effectivePaymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_configuration") + private Optional + _getPaymentMethodConfiguration() { + return paymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("purchase_url") + private Optional _getPurchaseUrl() { + return purchaseUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("redirect_url") + private Optional _getRedirectUrl() { + return redirectUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCheckoutConfigurationsResponse + && equalTo((RetrieveCheckoutConfigurationsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveCheckoutConfigurationsResponse other) { + return accountId.equals(other.accountId) + && affiliateCode.equals(other.affiliateCode) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && effectivePaymentMethodConfiguration.equals(other.effectivePaymentMethodConfiguration) + && id.equals(other.id) + && metadata.equals(other.metadata) + && mode.equals(other.mode) + && paymentMethodConfiguration.equals(other.paymentMethodConfiguration) + && plan.equals(other.plan) + && purchaseUrl.equals(other.purchaseUrl) + && redirectUrl.equals(other.redirectUrl) + && threeDsLevel.equals(other.threeDsLevel) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.affiliateCode, + this.createdAt, + this.currency, + this.effectivePaymentMethodConfiguration, + this.id, + this.metadata, + this.mode, + this.paymentMethodConfiguration, + this.plan, + this.purchaseUrl, + this.redirectUrl, + this.threeDsLevel, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Account ID, prefixed biz_.

+ */ + CreatedAtStage accountId(@NotNull String accountId); + + Builder from(RetrieveCheckoutConfigurationsResponse other); + } + + public interface CreatedAtStage { + /** + *

When the checkout configuration was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Checkout configuration ID, prefixed ch_.

+ */ + ModeStage id(@NotNull String id); + } + + public interface ModeStage { + /** + *

Controls whether checkout charges the buyer immediately or saves payment details for later.

+ */ + UpdatedAtStage mode(@NotNull RetrieveCheckoutConfigurationsResponseMode mode); + } + + public interface UpdatedAtStage { + /** + *

When the checkout configuration was last updated, as an ISO 8601 timestamp.

+ */ + _FinalStage updatedAt(@NotNull String updatedAt); + } + + public interface _FinalStage { + RetrieveCheckoutConfigurationsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ */ + _FinalStage affiliateCode(Optional affiliateCode); + + _FinalStage affiliateCode(String affiliateCode); + + _FinalStage affiliateCode(Nullable affiliateCode); + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + _FinalStage currency(Nullable currency); + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ */ + _FinalStage effectivePaymentMethodConfiguration( + Optional + effectivePaymentMethodConfiguration); + + _FinalStage effectivePaymentMethodConfiguration( + RetrieveCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration + effectivePaymentMethodConfiguration); + + _FinalStage effectivePaymentMethodConfiguration( + Nullable + effectivePaymentMethodConfiguration); + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ */ + _FinalStage paymentMethodConfiguration( + Optional paymentMethodConfiguration); + + _FinalStage paymentMethodConfiguration( + RetrieveCheckoutConfigurationsResponsePaymentMethodConfiguration paymentMethodConfiguration); + + _FinalStage paymentMethodConfiguration( + Nullable paymentMethodConfiguration); + + /** + *

Plan used for payment checkout. null in setup mode.

+ */ + _FinalStage plan(Optional plan); + + _FinalStage plan(RetrieveCheckoutConfigurationsResponsePlan plan); + + _FinalStage plan(Nullable plan); + + /** + *

Checkout URL you can send to customers.

+ */ + _FinalStage purchaseUrl(Optional purchaseUrl); + + _FinalStage purchaseUrl(String purchaseUrl); + + _FinalStage purchaseUrl(Nullable purchaseUrl); + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ */ + _FinalStage redirectUrl(Optional redirectUrl); + + _FinalStage redirectUrl(String redirectUrl); + + _FinalStage redirectUrl(Nullable redirectUrl); + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ */ + _FinalStage threeDsLevel(Optional threeDsLevel); + + _FinalStage threeDsLevel(RetrieveCheckoutConfigurationsResponseThreeDsLevel threeDsLevel); + + _FinalStage threeDsLevel(Nullable threeDsLevel); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, CreatedAtStage, IdStage, ModeStage, UpdatedAtStage, _FinalStage { + private String accountId; + + private String createdAt; + + private String id; + + private RetrieveCheckoutConfigurationsResponseMode mode; + + private String updatedAt; + + private Optional threeDsLevel = Optional.empty(); + + private Optional redirectUrl = Optional.empty(); + + private Optional purchaseUrl = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional paymentMethodConfiguration = + Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional + effectivePaymentMethodConfiguration = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional affiliateCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveCheckoutConfigurationsResponse other) { + accountId(other.getAccountId()); + affiliateCode(other.getAffiliateCode()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + effectivePaymentMethodConfiguration(other.getEffectivePaymentMethodConfiguration()); + id(other.getId()); + metadata(other.getMetadata()); + mode(other.getMode()); + paymentMethodConfiguration(other.getPaymentMethodConfiguration()); + plan(other.getPlan()); + purchaseUrl(other.getPurchaseUrl()); + redirectUrl(other.getRedirectUrl()); + threeDsLevel(other.getThreeDsLevel()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ *

Account ID, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public CreatedAtStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

When the checkout configuration was created, as an ISO 8601 timestamp.

+ *

When the checkout configuration was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Checkout configuration ID, prefixed ch_.

+ *

Checkout configuration ID, prefixed ch_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ModeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Controls whether checkout charges the buyer immediately or saves payment details for later.

+ *

Controls whether checkout charges the buyer immediately or saves payment details for later.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("mode") + public UpdatedAtStage mode(@NotNull RetrieveCheckoutConfigurationsResponseMode mode) { + this.mode = Objects.requireNonNull(mode, "mode must not be null"); + return this; + } + + /** + *

When the checkout configuration was last updated, as an ISO 8601 timestamp.

+ *

When the checkout configuration was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(RetrieveCheckoutConfigurationsResponseThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ */ + @java.lang.Override + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public _FinalStage threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectUrl(Nullable redirectUrl) { + if (redirectUrl.isNull()) { + this.redirectUrl = null; + } else if (redirectUrl.isEmpty()) { + this.redirectUrl = Optional.empty(); + } else { + this.redirectUrl = Optional.of(redirectUrl.get()); + } + return this; + } + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectUrl(String redirectUrl) { + this.redirectUrl = Optional.ofNullable(redirectUrl); + return this; + } + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ */ + @java.lang.Override + @JsonSetter(value = "redirect_url", nulls = Nulls.SKIP) + public _FinalStage redirectUrl(Optional redirectUrl) { + this.redirectUrl = redirectUrl; + return this; + } + + /** + *

Checkout URL you can send to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage purchaseUrl(Nullable purchaseUrl) { + if (purchaseUrl.isNull()) { + this.purchaseUrl = null; + } else if (purchaseUrl.isEmpty()) { + this.purchaseUrl = Optional.empty(); + } else { + this.purchaseUrl = Optional.of(purchaseUrl.get()); + } + return this; + } + + /** + *

Checkout URL you can send to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage purchaseUrl(String purchaseUrl) { + this.purchaseUrl = Optional.ofNullable(purchaseUrl); + return this; + } + + /** + *

Checkout URL you can send to customers.

+ */ + @java.lang.Override + @JsonSetter(value = "purchase_url", nulls = Nulls.SKIP) + public _FinalStage purchaseUrl(Optional purchaseUrl) { + this.purchaseUrl = purchaseUrl; + return this; + } + + /** + *

Plan used for payment checkout. null in setup mode.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + /** + *

Plan used for payment checkout. null in setup mode.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(RetrieveCheckoutConfigurationsResponsePlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + /** + *

Plan used for payment checkout. null in setup mode.

+ */ + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodConfiguration( + Nullable paymentMethodConfiguration) { + if (paymentMethodConfiguration.isNull()) { + this.paymentMethodConfiguration = null; + } else if (paymentMethodConfiguration.isEmpty()) { + this.paymentMethodConfiguration = Optional.empty(); + } else { + this.paymentMethodConfiguration = Optional.of(paymentMethodConfiguration.get()); + } + return this; + } + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodConfiguration( + RetrieveCheckoutConfigurationsResponsePaymentMethodConfiguration paymentMethodConfiguration) { + this.paymentMethodConfiguration = Optional.ofNullable(paymentMethodConfiguration); + return this; + } + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_configuration", nulls = Nulls.SKIP) + public _FinalStage paymentMethodConfiguration( + Optional paymentMethodConfiguration) { + this.paymentMethodConfiguration = paymentMethodConfiguration; + return this; + } + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage effectivePaymentMethodConfiguration( + Nullable + effectivePaymentMethodConfiguration) { + if (effectivePaymentMethodConfiguration.isNull()) { + this.effectivePaymentMethodConfiguration = null; + } else if (effectivePaymentMethodConfiguration.isEmpty()) { + this.effectivePaymentMethodConfiguration = Optional.empty(); + } else { + this.effectivePaymentMethodConfiguration = Optional.of(effectivePaymentMethodConfiguration.get()); + } + return this; + } + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage effectivePaymentMethodConfiguration( + RetrieveCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration + effectivePaymentMethodConfiguration) { + this.effectivePaymentMethodConfiguration = Optional.ofNullable(effectivePaymentMethodConfiguration); + return this; + } + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ */ + @java.lang.Override + @JsonSetter(value = "effective_payment_method_configuration", nulls = Nulls.SKIP) + public _FinalStage effectivePaymentMethodConfiguration( + Optional + effectivePaymentMethodConfiguration) { + this.effectivePaymentMethodConfiguration = effectivePaymentMethodConfiguration; + return this; + } + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage affiliateCode(Nullable affiliateCode) { + if (affiliateCode.isNull()) { + this.affiliateCode = null; + } else if (affiliateCode.isEmpty()) { + this.affiliateCode = Optional.empty(); + } else { + this.affiliateCode = Optional.of(affiliateCode.get()); + } + return this; + } + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage affiliateCode(String affiliateCode) { + this.affiliateCode = Optional.ofNullable(affiliateCode); + return this; + } + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ */ + @java.lang.Override + @JsonSetter(value = "affiliate_code", nulls = Nulls.SKIP) + public _FinalStage affiliateCode(Optional affiliateCode) { + this.affiliateCode = affiliateCode; + return this; + } + + @java.lang.Override + public RetrieveCheckoutConfigurationsResponse build() { + return new RetrieveCheckoutConfigurationsResponse( + accountId, + affiliateCode, + createdAt, + currency, + effectivePaymentMethodConfiguration, + id, + metadata, + mode, + paymentMethodConfiguration, + plan, + purchaseUrl, + redirectUrl, + threeDsLevel, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration.java new file mode 100644 index 00000000..8a9125f0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration.Builder.class) +public final class RetrieveCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration { + private final Optional> disabled; + + private final Optional> enabled; + + private final Optional includePlatformDefaults; + + private final Map additionalProperties; + + private RetrieveCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration( + Optional> disabled, + Optional> enabled, + Optional includePlatformDefaults, + Map additionalProperties) { + this.disabled = disabled; + this.enabled = enabled; + this.includePlatformDefaults = includePlatformDefaults; + this.additionalProperties = additionalProperties; + } + + /** + * @return Payment methods explicitly disabled. + */ + @JsonProperty("disabled") + public Optional> getDisabled() { + return disabled; + } + + /** + * @return Payment methods explicitly enabled. + */ + @JsonProperty("enabled") + public Optional> getEnabled() { + return enabled; + } + + /** + * @return Whether platform default payment methods are included. + */ + @JsonProperty("include_platform_defaults") + public Optional getIncludePlatformDefaults() { + return includePlatformDefaults; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration + && equalTo((RetrieveCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration other) { + return disabled.equals(other.disabled) + && enabled.equals(other.enabled) + && includePlatformDefaults.equals(other.includePlatformDefaults); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.disabled, this.enabled, this.includePlatformDefaults); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> disabled = Optional.empty(); + + private Optional> enabled = Optional.empty(); + + private Optional includePlatformDefaults = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration other) { + disabled(other.getDisabled()); + enabled(other.getEnabled()); + includePlatformDefaults(other.getIncludePlatformDefaults()); + return this; + } + + /** + *

Payment methods explicitly disabled.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional> disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(List disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

Payment methods explicitly enabled.

+ */ + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional> enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(List enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + /** + *

Whether platform default payment methods are included.

+ */ + @JsonSetter(value = "include_platform_defaults", nulls = Nulls.SKIP) + public Builder includePlatformDefaults(Optional includePlatformDefaults) { + this.includePlatformDefaults = includePlatformDefaults; + return this; + } + + public Builder includePlatformDefaults(Boolean includePlatformDefaults) { + this.includePlatformDefaults = Optional.ofNullable(includePlatformDefaults); + return this; + } + + public RetrieveCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration build() { + return new RetrieveCheckoutConfigurationsResponseEffectivePaymentMethodConfiguration( + disabled, enabled, includePlatformDefaults, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponseMode.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponseMode.java new file mode 100644 index 00000000..503035c7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponseMode.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveCheckoutConfigurationsResponseMode { + public static final RetrieveCheckoutConfigurationsResponseMode SETUP = + new RetrieveCheckoutConfigurationsResponseMode(Value.SETUP, "setup"); + + public static final RetrieveCheckoutConfigurationsResponseMode PAYMENT = + new RetrieveCheckoutConfigurationsResponseMode(Value.PAYMENT, "payment"); + + private final Value value; + + private final String string; + + RetrieveCheckoutConfigurationsResponseMode(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveCheckoutConfigurationsResponseMode + && this.string.equals(((RetrieveCheckoutConfigurationsResponseMode) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SETUP: + return visitor.visitSetup(); + case PAYMENT: + return visitor.visitPayment(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveCheckoutConfigurationsResponseMode valueOf(String value) { + switch (value) { + case "setup": + return SETUP; + case "payment": + return PAYMENT; + default: + return new RetrieveCheckoutConfigurationsResponseMode(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYMENT, + + SETUP, + + UNKNOWN + } + + public interface Visitor { + T visitPayment(); + + T visitSetup(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePaymentMethodConfiguration.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePaymentMethodConfiguration.java new file mode 100644 index 00000000..c4a3a51a --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePaymentMethodConfiguration.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCheckoutConfigurationsResponsePaymentMethodConfiguration.Builder.class) +public final class RetrieveCheckoutConfigurationsResponsePaymentMethodConfiguration { + private final Optional> disabled; + + private final Optional> enabled; + + private final Optional includePlatformDefaults; + + private final Map additionalProperties; + + private RetrieveCheckoutConfigurationsResponsePaymentMethodConfiguration( + Optional> disabled, + Optional> enabled, + Optional includePlatformDefaults, + Map additionalProperties) { + this.disabled = disabled; + this.enabled = enabled; + this.includePlatformDefaults = includePlatformDefaults; + this.additionalProperties = additionalProperties; + } + + /** + * @return Payment methods explicitly disabled for checkout. + */ + @JsonProperty("disabled") + public Optional> getDisabled() { + return disabled; + } + + /** + * @return Payment methods explicitly enabled for checkout. + */ + @JsonProperty("enabled") + public Optional> getEnabled() { + return enabled; + } + + /** + * @return Whether platform default payment methods are included. + */ + @JsonProperty("include_platform_defaults") + public Optional getIncludePlatformDefaults() { + return includePlatformDefaults; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCheckoutConfigurationsResponsePaymentMethodConfiguration + && equalTo((RetrieveCheckoutConfigurationsResponsePaymentMethodConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveCheckoutConfigurationsResponsePaymentMethodConfiguration other) { + return disabled.equals(other.disabled) + && enabled.equals(other.enabled) + && includePlatformDefaults.equals(other.includePlatformDefaults); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.disabled, this.enabled, this.includePlatformDefaults); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> disabled = Optional.empty(); + + private Optional> enabled = Optional.empty(); + + private Optional includePlatformDefaults = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveCheckoutConfigurationsResponsePaymentMethodConfiguration other) { + disabled(other.getDisabled()); + enabled(other.getEnabled()); + includePlatformDefaults(other.getIncludePlatformDefaults()); + return this; + } + + /** + *

Payment methods explicitly disabled for checkout.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional> disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(List disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

Payment methods explicitly enabled for checkout.

+ */ + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional> enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(List enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + /** + *

Whether platform default payment methods are included.

+ */ + @JsonSetter(value = "include_platform_defaults", nulls = Nulls.SKIP) + public Builder includePlatformDefaults(Optional includePlatformDefaults) { + this.includePlatformDefaults = includePlatformDefaults; + return this; + } + + public Builder includePlatformDefaults(Boolean includePlatformDefaults) { + this.includePlatformDefaults = Optional.ofNullable(includePlatformDefaults); + return this; + } + + public RetrieveCheckoutConfigurationsResponsePaymentMethodConfiguration build() { + return new RetrieveCheckoutConfigurationsResponsePaymentMethodConfiguration( + disabled, enabled, includePlatformDefaults, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePlan.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePlan.java new file mode 100644 index 00000000..40e44782 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePlan.java @@ -0,0 +1,697 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCheckoutConfigurationsResponsePlan.Builder.class) +public final class RetrieveCheckoutConfigurationsResponsePlan { + private final boolean adaptivePricingEnabled; + + private final Optional billingPeriod; + + private final String currency; + + private final Optional expirationDays; + + private final String id; + + private final double initialPrice; + + private final RetrieveCheckoutConfigurationsResponsePlanPlanType planType; + + private final RetrieveCheckoutConfigurationsResponsePlanReleaseMethod releaseMethod; + + private final double renewalPrice; + + private final Optional threeDsLevel; + + private final Optional trialPeriodDays; + + private final RetrieveCheckoutConfigurationsResponsePlanVisibility visibility; + + private final Map additionalProperties; + + private RetrieveCheckoutConfigurationsResponsePlan( + boolean adaptivePricingEnabled, + Optional billingPeriod, + String currency, + Optional expirationDays, + String id, + double initialPrice, + RetrieveCheckoutConfigurationsResponsePlanPlanType planType, + RetrieveCheckoutConfigurationsResponsePlanReleaseMethod releaseMethod, + double renewalPrice, + Optional threeDsLevel, + Optional trialPeriodDays, + RetrieveCheckoutConfigurationsResponsePlanVisibility visibility, + Map additionalProperties) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + this.billingPeriod = billingPeriod; + this.currency = currency; + this.expirationDays = expirationDays; + this.id = id; + this.initialPrice = initialPrice; + this.planType = planType; + this.releaseMethod = releaseMethod; + this.renewalPrice = renewalPrice; + this.threeDsLevel = threeDsLevel; + this.trialPeriodDays = trialPeriodDays; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether this plan accepts local currency payments via adaptive pricing. + */ + @JsonProperty("adaptive_pricing_enabled") + public boolean getAdaptivePricingEnabled() { + return adaptivePricingEnabled; + } + + /** + * @return Recurring billing interval in days, such as 30 for monthly or 365 for annual. null for one-time plans. + */ + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + /** + * @return Three-letter ISO currency code for the plan's prices. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Access duration in days for expiration-based plans. + */ + @JsonIgnore + public Optional getExpirationDays() { + if (expirationDays == null) { + return Optional.empty(); + } + return expirationDays; + } + + /** + * @return Plan ID, prefixed plan_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Initial purchase price in the plan currency. + */ + @JsonProperty("initial_price") + public double getInitialPrice() { + return initialPrice; + } + + /** + * @return Billing model for the plan. + */ + @JsonProperty("plan_type") + public RetrieveCheckoutConfigurationsResponsePlanPlanType getPlanType() { + return planType; + } + + /** + * @return Sales method for the plan. + */ + @JsonProperty("release_method") + public RetrieveCheckoutConfigurationsResponsePlanReleaseMethod getReleaseMethod() { + return releaseMethod; + } + + /** + * @return Recurring price charged each billing period. + */ + @JsonProperty("renewal_price") + public double getRenewalPrice() { + return renewalPrice; + } + + /** + * @return 3D Secure behavior for this plan, or null to use the account default. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return Free trial days before the first renewal charge. + */ + @JsonIgnore + public Optional getTrialPeriodDays() { + if (trialPeriodDays == null) { + return Optional.empty(); + } + return trialPeriodDays; + } + + /** + * @return Whether the plan is visible to customers or hidden from public view. + */ + @JsonProperty("visibility") + public RetrieveCheckoutConfigurationsResponsePlanVisibility getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_days") + private Optional _getExpirationDays() { + return expirationDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trial_period_days") + private Optional _getTrialPeriodDays() { + return trialPeriodDays; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCheckoutConfigurationsResponsePlan + && equalTo((RetrieveCheckoutConfigurationsResponsePlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveCheckoutConfigurationsResponsePlan other) { + return adaptivePricingEnabled == other.adaptivePricingEnabled + && billingPeriod.equals(other.billingPeriod) + && currency.equals(other.currency) + && expirationDays.equals(other.expirationDays) + && id.equals(other.id) + && initialPrice == other.initialPrice + && planType.equals(other.planType) + && releaseMethod.equals(other.releaseMethod) + && renewalPrice == other.renewalPrice + && threeDsLevel.equals(other.threeDsLevel) + && trialPeriodDays.equals(other.trialPeriodDays) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adaptivePricingEnabled, + this.billingPeriod, + this.currency, + this.expirationDays, + this.id, + this.initialPrice, + this.planType, + this.releaseMethod, + this.renewalPrice, + this.threeDsLevel, + this.trialPeriodDays, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdaptivePricingEnabledStage builder() { + return new Builder(); + } + + public interface AdaptivePricingEnabledStage { + /** + *

Whether this plan accepts local currency payments via adaptive pricing.

+ */ + CurrencyStage adaptivePricingEnabled(boolean adaptivePricingEnabled); + + Builder from(RetrieveCheckoutConfigurationsResponsePlan other); + } + + public interface CurrencyStage { + /** + *

Three-letter ISO currency code for the plan's prices.

+ */ + IdStage currency(@NotNull String currency); + } + + public interface IdStage { + /** + *

Plan ID, prefixed plan_.

+ */ + InitialPriceStage id(@NotNull String id); + } + + public interface InitialPriceStage { + /** + *

Initial purchase price in the plan currency.

+ */ + PlanTypeStage initialPrice(double initialPrice); + } + + public interface PlanTypeStage { + /** + *

Billing model for the plan.

+ */ + ReleaseMethodStage planType(@NotNull RetrieveCheckoutConfigurationsResponsePlanPlanType planType); + } + + public interface ReleaseMethodStage { + /** + *

Sales method for the plan.

+ */ + RenewalPriceStage releaseMethod(@NotNull RetrieveCheckoutConfigurationsResponsePlanReleaseMethod releaseMethod); + } + + public interface RenewalPriceStage { + /** + *

Recurring price charged each billing period.

+ */ + VisibilityStage renewalPrice(double renewalPrice); + } + + public interface VisibilityStage { + /** + *

Whether the plan is visible to customers or hidden from public view.

+ */ + _FinalStage visibility(@NotNull RetrieveCheckoutConfigurationsResponsePlanVisibility visibility); + } + + public interface _FinalStage { + RetrieveCheckoutConfigurationsResponsePlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Recurring billing interval in days, such as 30 for monthly or 365 for annual. null for one-time plans.

+ */ + _FinalStage billingPeriod(Optional billingPeriod); + + _FinalStage billingPeriod(Integer billingPeriod); + + _FinalStage billingPeriod(Nullable billingPeriod); + + /** + *

Access duration in days for expiration-based plans.

+ */ + _FinalStage expirationDays(Optional expirationDays); + + _FinalStage expirationDays(Integer expirationDays); + + _FinalStage expirationDays(Nullable expirationDays); + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ */ + _FinalStage threeDsLevel(Optional threeDsLevel); + + _FinalStage threeDsLevel(RetrieveCheckoutConfigurationsResponsePlanThreeDsLevel threeDsLevel); + + _FinalStage threeDsLevel(Nullable threeDsLevel); + + /** + *

Free trial days before the first renewal charge.

+ */ + _FinalStage trialPeriodDays(Optional trialPeriodDays); + + _FinalStage trialPeriodDays(Integer trialPeriodDays); + + _FinalStage trialPeriodDays(Nullable trialPeriodDays); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AdaptivePricingEnabledStage, + CurrencyStage, + IdStage, + InitialPriceStage, + PlanTypeStage, + ReleaseMethodStage, + RenewalPriceStage, + VisibilityStage, + _FinalStage { + private boolean adaptivePricingEnabled; + + private String currency; + + private String id; + + private double initialPrice; + + private RetrieveCheckoutConfigurationsResponsePlanPlanType planType; + + private RetrieveCheckoutConfigurationsResponsePlanReleaseMethod releaseMethod; + + private double renewalPrice; + + private RetrieveCheckoutConfigurationsResponsePlanVisibility visibility; + + private Optional trialPeriodDays = Optional.empty(); + + private Optional threeDsLevel = Optional.empty(); + + private Optional expirationDays = Optional.empty(); + + private Optional billingPeriod = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveCheckoutConfigurationsResponsePlan other) { + adaptivePricingEnabled(other.getAdaptivePricingEnabled()); + billingPeriod(other.getBillingPeriod()); + currency(other.getCurrency()); + expirationDays(other.getExpirationDays()); + id(other.getId()); + initialPrice(other.getInitialPrice()); + planType(other.getPlanType()); + releaseMethod(other.getReleaseMethod()); + renewalPrice(other.getRenewalPrice()); + threeDsLevel(other.getThreeDsLevel()); + trialPeriodDays(other.getTrialPeriodDays()); + visibility(other.getVisibility()); + return this; + } + + /** + *

Whether this plan accepts local currency payments via adaptive pricing.

+ *

Whether this plan accepts local currency payments via adaptive pricing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("adaptive_pricing_enabled") + public CurrencyStage adaptivePricingEnabled(boolean adaptivePricingEnabled) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + return this; + } + + /** + *

Three-letter ISO currency code for the plan's prices.

+ *

Three-letter ISO currency code for the plan's prices.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Plan ID, prefixed plan_.

+ *

Plan ID, prefixed plan_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public InitialPriceStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Initial purchase price in the plan currency.

+ *

Initial purchase price in the plan currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("initial_price") + public PlanTypeStage initialPrice(double initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + /** + *

Billing model for the plan.

+ *

Billing model for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan_type") + public ReleaseMethodStage planType(@NotNull RetrieveCheckoutConfigurationsResponsePlanPlanType planType) { + this.planType = Objects.requireNonNull(planType, "planType must not be null"); + return this; + } + + /** + *

Sales method for the plan.

+ *

Sales method for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("release_method") + public RenewalPriceStage releaseMethod( + @NotNull RetrieveCheckoutConfigurationsResponsePlanReleaseMethod releaseMethod) { + this.releaseMethod = Objects.requireNonNull(releaseMethod, "releaseMethod must not be null"); + return this; + } + + /** + *

Recurring price charged each billing period.

+ *

Recurring price charged each billing period.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("renewal_price") + public VisibilityStage renewalPrice(double renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + /** + *

Whether the plan is visible to customers or hidden from public view.

+ *

Whether the plan is visible to customers or hidden from public view.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("visibility") + public _FinalStage visibility(@NotNull RetrieveCheckoutConfigurationsResponsePlanVisibility visibility) { + this.visibility = Objects.requireNonNull(visibility, "visibility must not be null"); + return this; + } + + /** + *

Free trial days before the first renewal charge.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Nullable trialPeriodDays) { + if (trialPeriodDays.isNull()) { + this.trialPeriodDays = null; + } else if (trialPeriodDays.isEmpty()) { + this.trialPeriodDays = Optional.empty(); + } else { + this.trialPeriodDays = Optional.of(trialPeriodDays.get()); + } + return this; + } + + /** + *

Free trial days before the first renewal charge.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Integer trialPeriodDays) { + this.trialPeriodDays = Optional.ofNullable(trialPeriodDays); + return this; + } + + /** + *

Free trial days before the first renewal charge.

+ */ + @java.lang.Override + @JsonSetter(value = "trial_period_days", nulls = Nulls.SKIP) + public _FinalStage trialPeriodDays(Optional trialPeriodDays) { + this.trialPeriodDays = trialPeriodDays; + return this; + } + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(RetrieveCheckoutConfigurationsResponsePlanThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ */ + @java.lang.Override + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public _FinalStage threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + /** + *

Access duration in days for expiration-based plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Nullable expirationDays) { + if (expirationDays.isNull()) { + this.expirationDays = null; + } else if (expirationDays.isEmpty()) { + this.expirationDays = Optional.empty(); + } else { + this.expirationDays = Optional.of(expirationDays.get()); + } + return this; + } + + /** + *

Access duration in days for expiration-based plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Integer expirationDays) { + this.expirationDays = Optional.ofNullable(expirationDays); + return this; + } + + /** + *

Access duration in days for expiration-based plans.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_days", nulls = Nulls.SKIP) + public _FinalStage expirationDays(Optional expirationDays) { + this.expirationDays = expirationDays; + return this; + } + + /** + *

Recurring billing interval in days, such as 30 for monthly or 365 for annual. null for one-time plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + /** + *

Recurring billing interval in days, such as 30 for monthly or 365 for annual. null for one-time plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Integer billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + /** + *

Recurring billing interval in days, such as 30 for monthly or 365 for annual. null for one-time plans.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public _FinalStage billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + @java.lang.Override + public RetrieveCheckoutConfigurationsResponsePlan build() { + return new RetrieveCheckoutConfigurationsResponsePlan( + adaptivePricingEnabled, + billingPeriod, + currency, + expirationDays, + id, + initialPrice, + planType, + releaseMethod, + renewalPrice, + threeDsLevel, + trialPeriodDays, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePlanPlanType.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePlanPlanType.java new file mode 100644 index 00000000..99537bcd --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePlanPlanType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveCheckoutConfigurationsResponsePlanPlanType { + public static final RetrieveCheckoutConfigurationsResponsePlanPlanType RENEWAL = + new RetrieveCheckoutConfigurationsResponsePlanPlanType(Value.RENEWAL, "renewal"); + + public static final RetrieveCheckoutConfigurationsResponsePlanPlanType ONE_TIME = + new RetrieveCheckoutConfigurationsResponsePlanPlanType(Value.ONE_TIME, "one_time"); + + private final Value value; + + private final String string; + + RetrieveCheckoutConfigurationsResponsePlanPlanType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveCheckoutConfigurationsResponsePlanPlanType + && this.string.equals(((RetrieveCheckoutConfigurationsResponsePlanPlanType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RENEWAL: + return visitor.visitRenewal(); + case ONE_TIME: + return visitor.visitOneTime(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveCheckoutConfigurationsResponsePlanPlanType valueOf(String value) { + switch (value) { + case "renewal": + return RENEWAL; + case "one_time": + return ONE_TIME; + default: + return new RetrieveCheckoutConfigurationsResponsePlanPlanType(Value.UNKNOWN, value); + } + } + + public enum Value { + RENEWAL, + + ONE_TIME, + + UNKNOWN + } + + public interface Visitor { + T visitRenewal(); + + T visitOneTime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePlanReleaseMethod.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePlanReleaseMethod.java new file mode 100644 index 00000000..e686c841 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePlanReleaseMethod.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveCheckoutConfigurationsResponsePlanReleaseMethod { + public static final RetrieveCheckoutConfigurationsResponsePlanReleaseMethod WAITLIST = + new RetrieveCheckoutConfigurationsResponsePlanReleaseMethod(Value.WAITLIST, "waitlist"); + + public static final RetrieveCheckoutConfigurationsResponsePlanReleaseMethod BUY_NOW = + new RetrieveCheckoutConfigurationsResponsePlanReleaseMethod(Value.BUY_NOW, "buy_now"); + + private final Value value; + + private final String string; + + RetrieveCheckoutConfigurationsResponsePlanReleaseMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveCheckoutConfigurationsResponsePlanReleaseMethod + && this.string.equals( + ((RetrieveCheckoutConfigurationsResponsePlanReleaseMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WAITLIST: + return visitor.visitWaitlist(); + case BUY_NOW: + return visitor.visitBuyNow(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveCheckoutConfigurationsResponsePlanReleaseMethod valueOf(String value) { + switch (value) { + case "waitlist": + return WAITLIST; + case "buy_now": + return BUY_NOW; + default: + return new RetrieveCheckoutConfigurationsResponsePlanReleaseMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + BUY_NOW, + + WAITLIST, + + UNKNOWN + } + + public interface Visitor { + T visitBuyNow(); + + T visitWaitlist(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePlanThreeDsLevel.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePlanThreeDsLevel.java new file mode 100644 index 00000000..dd758321 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePlanThreeDsLevel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveCheckoutConfigurationsResponsePlanThreeDsLevel { + public static final RetrieveCheckoutConfigurationsResponsePlanThreeDsLevel MANDATE_CHALLENGE = + new RetrieveCheckoutConfigurationsResponsePlanThreeDsLevel(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + public static final RetrieveCheckoutConfigurationsResponsePlanThreeDsLevel FRICTIONLESS = + new RetrieveCheckoutConfigurationsResponsePlanThreeDsLevel(Value.FRICTIONLESS, "frictionless"); + + private final Value value; + + private final String string; + + RetrieveCheckoutConfigurationsResponsePlanThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveCheckoutConfigurationsResponsePlanThreeDsLevel + && this.string.equals(((RetrieveCheckoutConfigurationsResponsePlanThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case FRICTIONLESS: + return visitor.visitFrictionless(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveCheckoutConfigurationsResponsePlanThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + case "frictionless": + return FRICTIONLESS; + default: + return new RetrieveCheckoutConfigurationsResponsePlanThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + FRICTIONLESS, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitFrictionless(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePlanVisibility.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePlanVisibility.java new file mode 100644 index 00000000..83cd8897 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponsePlanVisibility.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveCheckoutConfigurationsResponsePlanVisibility { + public static final RetrieveCheckoutConfigurationsResponsePlanVisibility VISIBLE = + new RetrieveCheckoutConfigurationsResponsePlanVisibility(Value.VISIBLE, "visible"); + + public static final RetrieveCheckoutConfigurationsResponsePlanVisibility HIDDEN = + new RetrieveCheckoutConfigurationsResponsePlanVisibility(Value.HIDDEN, "hidden"); + + public static final RetrieveCheckoutConfigurationsResponsePlanVisibility QUICK_LINK = + new RetrieveCheckoutConfigurationsResponsePlanVisibility(Value.QUICK_LINK, "quick_link"); + + public static final RetrieveCheckoutConfigurationsResponsePlanVisibility ARCHIVED = + new RetrieveCheckoutConfigurationsResponsePlanVisibility(Value.ARCHIVED, "archived"); + + private final Value value; + + private final String string; + + RetrieveCheckoutConfigurationsResponsePlanVisibility(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveCheckoutConfigurationsResponsePlanVisibility + && this.string.equals(((RetrieveCheckoutConfigurationsResponsePlanVisibility) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VISIBLE: + return visitor.visitVisible(); + case HIDDEN: + return visitor.visitHidden(); + case QUICK_LINK: + return visitor.visitQuickLink(); + case ARCHIVED: + return visitor.visitArchived(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveCheckoutConfigurationsResponsePlanVisibility valueOf(String value) { + switch (value) { + case "visible": + return VISIBLE; + case "hidden": + return HIDDEN; + case "quick_link": + return QUICK_LINK; + case "archived": + return ARCHIVED; + default: + return new RetrieveCheckoutConfigurationsResponsePlanVisibility(Value.UNKNOWN, value); + } + } + + public enum Value { + VISIBLE, + + HIDDEN, + + ARCHIVED, + + QUICK_LINK, + + UNKNOWN + } + + public interface Visitor { + T visitVisible(); + + T visitHidden(); + + T visitArchived(); + + T visitQuickLink(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponseThreeDsLevel.java b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponseThreeDsLevel.java new file mode 100644 index 00000000..32df7241 --- /dev/null +++ b/src/main/java/com/whop/api/resources/checkoutconfigurations/types/RetrieveCheckoutConfigurationsResponseThreeDsLevel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.checkoutconfigurations.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveCheckoutConfigurationsResponseThreeDsLevel { + public static final RetrieveCheckoutConfigurationsResponseThreeDsLevel MANDATE_CHALLENGE = + new RetrieveCheckoutConfigurationsResponseThreeDsLevel(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + public static final RetrieveCheckoutConfigurationsResponseThreeDsLevel FRICTIONLESS = + new RetrieveCheckoutConfigurationsResponseThreeDsLevel(Value.FRICTIONLESS, "frictionless"); + + private final Value value; + + private final String string; + + RetrieveCheckoutConfigurationsResponseThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveCheckoutConfigurationsResponseThreeDsLevel + && this.string.equals(((RetrieveCheckoutConfigurationsResponseThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case FRICTIONLESS: + return visitor.visitFrictionless(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveCheckoutConfigurationsResponseThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + case "frictionless": + return FRICTIONLESS; + default: + return new RetrieveCheckoutConfigurationsResponseThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + FRICTIONLESS, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitFrictionless(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/companies/AsyncCompaniesClient.java b/src/main/java/com/whop/api/resources/companies/AsyncCompaniesClient.java new file mode 100644 index 00000000..c81fd521 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/AsyncCompaniesClient.java @@ -0,0 +1,215 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.companies.requests.CreateApiKeyCompaniesRequest; +import com.whop.api.resources.companies.requests.CreateCompaniesRequest; +import com.whop.api.resources.companies.requests.ListCompaniesRequest; +import com.whop.api.resources.companies.requests.RetrieveCompaniesRequest; +import com.whop.api.resources.companies.requests.UpdateCompaniesRequest; +import com.whop.api.resources.companies.types.CreateApiKeyCompaniesResponse; +import com.whop.api.types.Company; +import com.whop.api.types.CompanyListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncCompaniesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawCompaniesClient rawClient; + + public AsyncCompaniesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawCompaniesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawCompaniesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> list(ListCompaniesRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> list( + ListCompaniesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create a new company. Pass parent_company_id to create a connected account under a platform, or omit it to create a company for the current user. + *

Required permissions:

+ *
    + *
  • company:create
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture create(CreateCompaniesRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create a new company. Pass parent_company_id to create a connected account under a platform, or omit it to create a company for the current user. + *

Required permissions:

+ *
    + *
  • company:create
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture create(CreateCompaniesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveCompaniesRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveCompaniesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture update(String id, UpdateCompaniesRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture update(String id, UpdateCompaniesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create an API key for a connected account (child company) owned by a parent company. + */ + public CompletableFuture createApiKey( + String parentCompanyId, CreateApiKeyCompaniesRequest request) { + return this.rawClient.createApiKey(parentCompanyId, request).thenApply(response -> response.body()); + } + + /** + * Create an API key for a connected account (child company) owned by a parent company. + */ + public CompletableFuture createApiKey( + String parentCompanyId, CreateApiKeyCompaniesRequest request, RequestOptions requestOptions) { + return this.rawClient + .createApiKey(parentCompanyId, request, requestOptions) + .thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/companies/AsyncRawCompaniesClient.java b/src/main/java/com/whop/api/resources/companies/AsyncRawCompaniesClient.java new file mode 100644 index 00000000..87986251 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/AsyncRawCompaniesClient.java @@ -0,0 +1,737 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.companies.requests.CreateApiKeyCompaniesRequest; +import com.whop.api.resources.companies.requests.CreateCompaniesRequest; +import com.whop.api.resources.companies.requests.ListCompaniesRequest; +import com.whop.api.resources.companies.requests.RetrieveCompaniesRequest; +import com.whop.api.resources.companies.requests.UpdateCompaniesRequest; +import com.whop.api.resources.companies.types.CreateApiKeyCompaniesResponse; +import com.whop.api.resources.companies.types.ListCompaniesResponse; +import com.whop.api.types.Company; +import com.whop.api.types.CompanyListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawCompaniesClient { + protected final ClientOptions clientOptions; + + public AsyncRawCompaniesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture>> list() { + return list(ListCompaniesRequest.builder().build()); + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListCompaniesRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture>> list( + ListCompaniesRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture>> list( + ListCompaniesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("companies"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getParentCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "parent_company_id", request.getParentCompanyId().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCompaniesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCompaniesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListCompaniesRequest nextRequest = ListCompaniesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create a new company. Pass parent_company_id to create a connected account under a platform, or omit it to create a company for the current user. + *

Required permissions:

+ *
    + *
  • company:create
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> create(CreateCompaniesRequest request) { + return create(request, null); + } + + /** + * Create a new company. Pass parent_company_id to create a connected account under a platform, or omit it to create a company for the current user. + *

Required permissions:

+ *
    + *
  • company:create
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> create( + CreateCompaniesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("companies"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Company.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveCompaniesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCompaniesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RetrieveCompaniesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveCompaniesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("companies") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Company.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> update(String id) { + return update(id, UpdateCompaniesRequest.builder().build()); + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateCompaniesRequest.builder().build(), requestOptions); + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> update(String id, UpdateCompaniesRequest request) { + return update(id, request, null); + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> update( + String id, UpdateCompaniesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("companies") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Company.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create an API key for a connected account (child company) owned by a parent company. + */ + public CompletableFuture> createApiKey( + String parentCompanyId, CreateApiKeyCompaniesRequest request) { + return createApiKey(parentCompanyId, request, null); + } + + /** + * Create an API key for a connected account (child company) owned by a parent company. + */ + public CompletableFuture> createApiKey( + String parentCompanyId, CreateApiKeyCompaniesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("companies") + .addPathSegment(parentCompanyId) + .addPathSegments("api_keys"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CreateApiKeyCompaniesResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/companies/CompaniesClient.java b/src/main/java/com/whop/api/resources/companies/CompaniesClient.java new file mode 100644 index 00000000..3359de32 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/CompaniesClient.java @@ -0,0 +1,211 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.companies.requests.CreateApiKeyCompaniesRequest; +import com.whop.api.resources.companies.requests.CreateCompaniesRequest; +import com.whop.api.resources.companies.requests.ListCompaniesRequest; +import com.whop.api.resources.companies.requests.RetrieveCompaniesRequest; +import com.whop.api.resources.companies.requests.UpdateCompaniesRequest; +import com.whop.api.resources.companies.types.CreateApiKeyCompaniesResponse; +import com.whop.api.types.Company; +import com.whop.api.types.CompanyListItem; + +public class CompaniesClient { + protected final ClientOptions clientOptions; + + private final RawCompaniesClient rawClient; + + public CompaniesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawCompaniesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawCompaniesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public SyncPagingIterable list(ListCompaniesRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public SyncPagingIterable list(ListCompaniesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Create a new company. Pass parent_company_id to create a connected account under a platform, or omit it to create a company for the current user. + *

Required permissions:

+ *
    + *
  • company:create
  • + *
  • company:basic:read
  • + *
+ */ + public Company create(CreateCompaniesRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Create a new company. Pass parent_company_id to create a connected account under a platform, or omit it to create a company for the current user. + *

Required permissions:

+ *
    + *
  • company:create
  • + *
  • company:basic:read
  • + *
+ */ + public Company create(CreateCompaniesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public Company retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public Company retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public Company retrieve(String id, RetrieveCompaniesRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public Company retrieve(String id, RetrieveCompaniesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public Company update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public Company update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public Company update(String id, UpdateCompaniesRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public Company update(String id, UpdateCompaniesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Create an API key for a connected account (child company) owned by a parent company. + */ + public CreateApiKeyCompaniesResponse createApiKey(String parentCompanyId, CreateApiKeyCompaniesRequest request) { + return this.rawClient.createApiKey(parentCompanyId, request).body(); + } + + /** + * Create an API key for a connected account (child company) owned by a parent company. + */ + public CreateApiKeyCompaniesResponse createApiKey( + String parentCompanyId, CreateApiKeyCompaniesRequest request, RequestOptions requestOptions) { + return this.rawClient + .createApiKey(parentCompanyId, request, requestOptions) + .body(); + } +} diff --git a/src/main/java/com/whop/api/resources/companies/RawCompaniesClient.java b/src/main/java/com/whop/api/resources/companies/RawCompaniesClient.java new file mode 100644 index 00000000..627bb273 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/RawCompaniesClient.java @@ -0,0 +1,585 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.companies.requests.CreateApiKeyCompaniesRequest; +import com.whop.api.resources.companies.requests.CreateCompaniesRequest; +import com.whop.api.resources.companies.requests.ListCompaniesRequest; +import com.whop.api.resources.companies.requests.RetrieveCompaniesRequest; +import com.whop.api.resources.companies.requests.UpdateCompaniesRequest; +import com.whop.api.resources.companies.types.CreateApiKeyCompaniesResponse; +import com.whop.api.resources.companies.types.ListCompaniesResponse; +import com.whop.api.types.Company; +import com.whop.api.types.CompanyListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawCompaniesClient { + protected final ClientOptions clientOptions; + + public RawCompaniesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list() { + return list(ListCompaniesRequest.builder().build()); + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListCompaniesRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListCompaniesRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListCompaniesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("companies"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getParentCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "parent_company_id", request.getParentCompanyId().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCompaniesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCompaniesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListCompaniesRequest nextRequest = ListCompaniesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Create a new company. Pass parent_company_id to create a connected account under a platform, or omit it to create a company for the current user. + *

Required permissions:

+ *
    + *
  • company:create
  • + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse create(CreateCompaniesRequest request) { + return create(request, null); + } + + /** + * Create a new company. Pass parent_company_id to create a connected account under a platform, or omit it to create a company for the current user. + *

Required permissions:

+ *
    + *
  • company:create
  • + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse create(CreateCompaniesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("companies"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Company.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveCompaniesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCompaniesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveCompaniesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing company. + *

Required permissions:

+ *
    + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveCompaniesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("companies") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Company.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateCompaniesRequest.builder().build()); + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateCompaniesRequest.builder().build(), requestOptions); + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateCompaniesRequest request) { + return update(id, request, null); + } + + /** + * Update a company's title, description, logo, and other settings. + *

Required permissions:

+ *
    + *
  • company:update
  • + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse update( + String id, UpdateCompaniesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("companies") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Company.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Create an API key for a connected account (child company) owned by a parent company. + */ + public WhopApiHttpResponse createApiKey( + String parentCompanyId, CreateApiKeyCompaniesRequest request) { + return createApiKey(parentCompanyId, request, null); + } + + /** + * Create an API key for a connected account (child company) owned by a parent company. + */ + public WhopApiHttpResponse createApiKey( + String parentCompanyId, CreateApiKeyCompaniesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("companies") + .addPathSegment(parentCompanyId) + .addPathSegments("api_keys"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateApiKeyCompaniesResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/companies/requests/CreateApiKeyCompaniesRequest.java b/src/main/java/com/whop/api/resources/companies/requests/CreateApiKeyCompaniesRequest.java new file mode 100644 index 00000000..ed518ef4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/requests/CreateApiKeyCompaniesRequest.java @@ -0,0 +1,349 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.companies.types.CreateApiKeyCompaniesRequestPermissionsItem; +import com.whop.api.types.PermissionSystemRoles; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateApiKeyCompaniesRequest.Builder.class) +public final class CreateApiKeyCompaniesRequest { + private final String childCompanyId; + + private final Optional name; + + private final Optional> permissions; + + private final Optional role; + + private final Map additionalProperties; + + private CreateApiKeyCompaniesRequest( + String childCompanyId, + Optional name, + Optional> permissions, + Optional role, + Map additionalProperties) { + this.childCompanyId = childCompanyId; + this.name = name; + this.permissions = permissions; + this.role = role; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the connected account to create the API key for (e.g. 'biz_xxx'). + */ + @JsonProperty("child_company_id") + public String getChildCompanyId() { + return childCompanyId; + } + + /** + * @return A human-readable name for the API key, such as 'Production API Key'. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return Granular permission statements defining which actions this API key can perform. Either permissions or role must be provided. + */ + @JsonIgnore + public Optional> getPermissions() { + if (permissions == null) { + return Optional.empty(); + } + return permissions; + } + + /** + * @return A system role to inherit permissions from (e.g. owner, admin, moderator). Either role or permissions must be provided. + */ + @JsonIgnore + public Optional getRole() { + if (role == null) { + return Optional.empty(); + } + return role; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("permissions") + private Optional> _getPermissions() { + return permissions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("role") + private Optional _getRole() { + return role; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateApiKeyCompaniesRequest && equalTo((CreateApiKeyCompaniesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateApiKeyCompaniesRequest other) { + return childCompanyId.equals(other.childCompanyId) + && name.equals(other.name) + && permissions.equals(other.permissions) + && role.equals(other.role); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.childCompanyId, this.name, this.permissions, this.role); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChildCompanyIdStage builder() { + return new Builder(); + } + + public interface ChildCompanyIdStage { + /** + *

The unique identifier of the connected account to create the API key for (e.g. 'biz_xxx').

+ */ + _FinalStage childCompanyId(@NotNull String childCompanyId); + + Builder from(CreateApiKeyCompaniesRequest other); + } + + public interface _FinalStage { + CreateApiKeyCompaniesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A human-readable name for the API key, such as 'Production API Key'.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

Granular permission statements defining which actions this API key can perform. Either permissions or role must be provided.

+ */ + _FinalStage permissions(Optional> permissions); + + _FinalStage permissions(List permissions); + + _FinalStage permissions(Nullable> permissions); + + /** + *

A system role to inherit permissions from (e.g. owner, admin, moderator). Either role or permissions must be provided.

+ */ + _FinalStage role(Optional role); + + _FinalStage role(PermissionSystemRoles role); + + _FinalStage role(Nullable role); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ChildCompanyIdStage, _FinalStage { + private String childCompanyId; + + private Optional role = Optional.empty(); + + private Optional> permissions = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateApiKeyCompaniesRequest other) { + childCompanyId(other.getChildCompanyId()); + name(other.getName()); + permissions(other.getPermissions()); + role(other.getRole()); + return this; + } + + /** + *

The unique identifier of the connected account to create the API key for (e.g. 'biz_xxx').

+ *

The unique identifier of the connected account to create the API key for (e.g. 'biz_xxx').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("child_company_id") + public _FinalStage childCompanyId(@NotNull String childCompanyId) { + this.childCompanyId = Objects.requireNonNull(childCompanyId, "childCompanyId must not be null"); + return this; + } + + /** + *

A system role to inherit permissions from (e.g. owner, admin, moderator). Either role or permissions must be provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage role(Nullable role) { + if (role.isNull()) { + this.role = null; + } else if (role.isEmpty()) { + this.role = Optional.empty(); + } else { + this.role = Optional.of(role.get()); + } + return this; + } + + /** + *

A system role to inherit permissions from (e.g. owner, admin, moderator). Either role or permissions must be provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage role(PermissionSystemRoles role) { + this.role = Optional.ofNullable(role); + return this; + } + + /** + *

A system role to inherit permissions from (e.g. owner, admin, moderator). Either role or permissions must be provided.

+ */ + @java.lang.Override + @JsonSetter(value = "role", nulls = Nulls.SKIP) + public _FinalStage role(Optional role) { + this.role = role; + return this; + } + + /** + *

Granular permission statements defining which actions this API key can perform. Either permissions or role must be provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage permissions(Nullable> permissions) { + if (permissions.isNull()) { + this.permissions = null; + } else if (permissions.isEmpty()) { + this.permissions = Optional.empty(); + } else { + this.permissions = Optional.of(permissions.get()); + } + return this; + } + + /** + *

Granular permission statements defining which actions this API key can perform. Either permissions or role must be provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage permissions(List permissions) { + this.permissions = Optional.ofNullable(permissions); + return this; + } + + /** + *

Granular permission statements defining which actions this API key can perform. Either permissions or role must be provided.

+ */ + @java.lang.Override + @JsonSetter(value = "permissions", nulls = Nulls.SKIP) + public _FinalStage permissions(Optional> permissions) { + this.permissions = permissions; + return this; + } + + /** + *

A human-readable name for the API key, such as 'Production API Key'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

A human-readable name for the API key, such as 'Production API Key'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

A human-readable name for the API key, such as 'Production API Key'.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public CreateApiKeyCompaniesRequest build() { + return new CreateApiKeyCompaniesRequest(childCompanyId, name, permissions, role, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companies/requests/CreateCompaniesRequest.java b/src/main/java/com/whop/api/resources/companies/requests/CreateCompaniesRequest.java new file mode 100644 index 00000000..9248adcd --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/requests/CreateCompaniesRequest.java @@ -0,0 +1,645 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.companies.types.CreateCompaniesRequestLogo; +import com.whop.api.types.Countries; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCompaniesRequest.Builder.class) +public final class CreateCompaniesRequest { + private final Optional country; + + private final Optional description; + + private final Optional email; + + private final Optional logo; + + private final Optional> metadata; + + private final Optional parentCompanyId; + + private final Optional sendCustomerEmails; + + private final String title; + + private final Map additionalProperties; + + private CreateCompaniesRequest( + Optional country, + Optional description, + Optional email, + Optional logo, + Optional> metadata, + Optional parentCompanyId, + Optional sendCustomerEmails, + String title, + Map additionalProperties) { + this.country = country; + this.description = description; + this.email = email; + this.logo = logo; + this.metadata = metadata; + this.parentCompanyId = parentCompanyId; + this.sendCustomerEmails = sendCustomerEmails; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The country the company is located in. Defaults to the parent company's country for connected accounts, or the owner's IP-derived country. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return A promotional pitch displayed to potential customers on the company's store page. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The email address of the user who will own the connected account. Required when parent_company_id is provided. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The company's logo image. Accepts PNG, JPEG, or GIF format. + */ + @JsonIgnore + public Optional getLogo() { + if (logo == null) { + return Optional.empty(); + } + return logo; + } + + /** + * @return A key-value JSON object of custom metadata to store on the company. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The unique identifier of the parent platform company. When provided, creates a connected account under that platform. Omit to create a company for the current user. + */ + @JsonIgnore + public Optional getParentCompanyId() { + if (parentCompanyId == null) { + return Optional.empty(); + } + return parentCompanyId; + } + + /** + * @return Whether Whop sends transactional emails to customers on behalf of this company. Only applies when creating a connected account. + */ + @JsonIgnore + public Optional getSendCustomerEmails() { + if (sendCustomerEmails == null) { + return Optional.empty(); + } + return sendCustomerEmails; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo") + private Optional _getLogo() { + return logo; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("parent_company_id") + private Optional _getParentCompanyId() { + return parentCompanyId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("send_customer_emails") + private Optional _getSendCustomerEmails() { + return sendCustomerEmails; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCompaniesRequest && equalTo((CreateCompaniesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCompaniesRequest other) { + return country.equals(other.country) + && description.equals(other.description) + && email.equals(other.email) + && logo.equals(other.logo) + && metadata.equals(other.metadata) + && parentCompanyId.equals(other.parentCompanyId) + && sendCustomerEmails.equals(other.sendCustomerEmails) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.country, + this.description, + this.email, + this.logo, + this.metadata, + this.parentCompanyId, + this.sendCustomerEmails, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TitleStage builder() { + return new Builder(); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + _FinalStage title(@NotNull String title); + + Builder from(CreateCompaniesRequest other); + } + + public interface _FinalStage { + CreateCompaniesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The country the company is located in. Defaults to the parent company's country for connected accounts, or the owner's IP-derived country.

+ */ + _FinalStage country(Optional country); + + _FinalStage country(Countries country); + + _FinalStage country(Nullable country); + + /** + *

A promotional pitch displayed to potential customers on the company's store page.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

The email address of the user who will own the connected account. Required when parent_company_id is provided.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The company's logo image. Accepts PNG, JPEG, or GIF format.

+ */ + _FinalStage logo(Optional logo); + + _FinalStage logo(CreateCompaniesRequestLogo logo); + + _FinalStage logo(Nullable logo); + + /** + *

A key-value JSON object of custom metadata to store on the company.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The unique identifier of the parent platform company. When provided, creates a connected account under that platform. Omit to create a company for the current user.

+ */ + _FinalStage parentCompanyId(Optional parentCompanyId); + + _FinalStage parentCompanyId(String parentCompanyId); + + _FinalStage parentCompanyId(Nullable parentCompanyId); + + /** + *

Whether Whop sends transactional emails to customers on behalf of this company. Only applies when creating a connected account.

+ */ + _FinalStage sendCustomerEmails(Optional sendCustomerEmails); + + _FinalStage sendCustomerEmails(Boolean sendCustomerEmails); + + _FinalStage sendCustomerEmails(Nullable sendCustomerEmails); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TitleStage, _FinalStage { + private String title; + + private Optional sendCustomerEmails = Optional.empty(); + + private Optional parentCompanyId = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional logo = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional country = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCompaniesRequest other) { + country(other.getCountry()); + description(other.getDescription()); + email(other.getEmail()); + logo(other.getLogo()); + metadata(other.getMetadata()); + parentCompanyId(other.getParentCompanyId()); + sendCustomerEmails(other.getSendCustomerEmails()); + title(other.getTitle()); + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Whether Whop sends transactional emails to customers on behalf of this company. Only applies when creating a connected account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sendCustomerEmails(Nullable sendCustomerEmails) { + if (sendCustomerEmails.isNull()) { + this.sendCustomerEmails = null; + } else if (sendCustomerEmails.isEmpty()) { + this.sendCustomerEmails = Optional.empty(); + } else { + this.sendCustomerEmails = Optional.of(sendCustomerEmails.get()); + } + return this; + } + + /** + *

Whether Whop sends transactional emails to customers on behalf of this company. Only applies when creating a connected account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sendCustomerEmails(Boolean sendCustomerEmails) { + this.sendCustomerEmails = Optional.ofNullable(sendCustomerEmails); + return this; + } + + /** + *

Whether Whop sends transactional emails to customers on behalf of this company. Only applies when creating a connected account.

+ */ + @java.lang.Override + @JsonSetter(value = "send_customer_emails", nulls = Nulls.SKIP) + public _FinalStage sendCustomerEmails(Optional sendCustomerEmails) { + this.sendCustomerEmails = sendCustomerEmails; + return this; + } + + /** + *

The unique identifier of the parent platform company. When provided, creates a connected account under that platform. Omit to create a company for the current user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage parentCompanyId(Nullable parentCompanyId) { + if (parentCompanyId.isNull()) { + this.parentCompanyId = null; + } else if (parentCompanyId.isEmpty()) { + this.parentCompanyId = Optional.empty(); + } else { + this.parentCompanyId = Optional.of(parentCompanyId.get()); + } + return this; + } + + /** + *

The unique identifier of the parent platform company. When provided, creates a connected account under that platform. Omit to create a company for the current user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage parentCompanyId(String parentCompanyId) { + this.parentCompanyId = Optional.ofNullable(parentCompanyId); + return this; + } + + /** + *

The unique identifier of the parent platform company. When provided, creates a connected account under that platform. Omit to create a company for the current user.

+ */ + @java.lang.Override + @JsonSetter(value = "parent_company_id", nulls = Nulls.SKIP) + public _FinalStage parentCompanyId(Optional parentCompanyId) { + this.parentCompanyId = parentCompanyId; + return this; + } + + /** + *

A key-value JSON object of custom metadata to store on the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

A key-value JSON object of custom metadata to store on the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

A key-value JSON object of custom metadata to store on the company.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The company's logo image. Accepts PNG, JPEG, or GIF format.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logo(Nullable logo) { + if (logo.isNull()) { + this.logo = null; + } else if (logo.isEmpty()) { + this.logo = Optional.empty(); + } else { + this.logo = Optional.of(logo.get()); + } + return this; + } + + /** + *

The company's logo image. Accepts PNG, JPEG, or GIF format.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logo(CreateCompaniesRequestLogo logo) { + this.logo = Optional.ofNullable(logo); + return this; + } + + /** + *

The company's logo image. Accepts PNG, JPEG, or GIF format.

+ */ + @java.lang.Override + @JsonSetter(value = "logo", nulls = Nulls.SKIP) + public _FinalStage logo(Optional logo) { + this.logo = logo; + return this; + } + + /** + *

The email address of the user who will own the connected account. Required when parent_company_id is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The email address of the user who will own the connected account. Required when parent_company_id is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The email address of the user who will own the connected account. Required when parent_company_id is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + /** + *

A promotional pitch displayed to potential customers on the company's store page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

A promotional pitch displayed to potential customers on the company's store page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

A promotional pitch displayed to potential customers on the company's store page.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

The country the company is located in. Defaults to the parent company's country for connected accounts, or the owner's IP-derived country.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The country the company is located in. Defaults to the parent company's country for connected accounts, or the owner's IP-derived country.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage country(Countries country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

The country the company is located in. Defaults to the parent company's country for connected accounts, or the owner's IP-derived country.

+ */ + @java.lang.Override + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public _FinalStage country(Optional country) { + this.country = country; + return this; + } + + @java.lang.Override + public CreateCompaniesRequest build() { + return new CreateCompaniesRequest( + country, + description, + email, + logo, + metadata, + parentCompanyId, + sendCustomerEmails, + title, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companies/requests/ListCompaniesRequest.java b/src/main/java/com/whop/api/resources/companies/requests/ListCompaniesRequest.java new file mode 100644 index 00000000..942913af --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/requests/ListCompaniesRequest.java @@ -0,0 +1,336 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Direction; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCompaniesRequest.Builder.class) +public final class ListCompaniesRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Optional parentCompanyId; + + private final Optional direction; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Map additionalProperties; + + private ListCompaniesRequest( + Optional after, + Optional before, + Optional first, + Optional last, + Optional parentCompanyId, + Optional direction, + Optional createdBefore, + Optional createdAfter, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.parentCompanyId = parentCompanyId; + this.direction = direction; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the parent platform company. When provided, lists connected accounts under that platform. Omit to list the current user's own companies. + */ + @JsonProperty("parent_company_id") + public Optional getParentCompanyId() { + return parentCompanyId; + } + + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Only return companies created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return companies created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCompaniesRequest && equalTo((ListCompaniesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCompaniesRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && parentCompanyId.equals(other.parentCompanyId) + && direction.equals(other.direction) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.after, + this.before, + this.first, + this.last, + this.parentCompanyId, + this.direction, + this.createdBefore, + this.createdAfter); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional parentCompanyId = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListCompaniesRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + parentCompanyId(other.getParentCompanyId()); + direction(other.getDirection()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The unique identifier of the parent platform company. When provided, lists connected accounts under that platform. Omit to list the current user's own companies.

+ */ + @JsonSetter(value = "parent_company_id", nulls = Nulls.SKIP) + public Builder parentCompanyId(Optional parentCompanyId) { + this.parentCompanyId = parentCompanyId; + return this; + } + + public Builder parentCompanyId(String parentCompanyId) { + this.parentCompanyId = Optional.ofNullable(parentCompanyId); + return this; + } + + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(Direction direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Only return companies created before this timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return companies created after this timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + public ListCompaniesRequest build() { + return new ListCompaniesRequest( + after, + before, + first, + last, + parentCompanyId, + direction, + createdBefore, + createdAfter, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companies/requests/RetrieveCompaniesRequest.java b/src/main/java/com/whop/api/resources/companies/requests/RetrieveCompaniesRequest.java new file mode 100644 index 00000000..28aabfc3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/requests/RetrieveCompaniesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCompaniesRequest.Builder.class) +public final class RetrieveCompaniesRequest { + private final Map additionalProperties; + + private RetrieveCompaniesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCompaniesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveCompaniesRequest other) { + return this; + } + + public RetrieveCompaniesRequest build() { + return new RetrieveCompaniesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companies/requests/UpdateCompaniesRequest.java b/src/main/java/com/whop/api/resources/companies/requests/UpdateCompaniesRequest.java new file mode 100644 index 00000000..022e7185 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/requests/UpdateCompaniesRequest.java @@ -0,0 +1,663 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.companies.types.UpdateCompaniesRequestBannerImage; +import com.whop.api.resources.companies.types.UpdateCompaniesRequestLogo; +import com.whop.api.resources.companies.types.UpdateCompaniesRequestSocialLinksItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCompaniesRequest.Builder.class) +public final class UpdateCompaniesRequest { + private final Optional affiliateApplicationRequired; + + private final Optional affiliateInstructions; + + private final Optional bannerImage; + + private final Optional description; + + private final Optional featuredAffiliateProductId; + + private final Optional logo; + + private final Optional route; + + private final Optional sendCustomerEmails; + + private final Optional> socialLinks; + + private final Optional targetAudience; + + private final Optional title; + + private final Map additionalProperties; + + private UpdateCompaniesRequest( + Optional affiliateApplicationRequired, + Optional affiliateInstructions, + Optional bannerImage, + Optional description, + Optional featuredAffiliateProductId, + Optional logo, + Optional route, + Optional sendCustomerEmails, + Optional> socialLinks, + Optional targetAudience, + Optional title, + Map additionalProperties) { + this.affiliateApplicationRequired = affiliateApplicationRequired; + this.affiliateInstructions = affiliateInstructions; + this.bannerImage = bannerImage; + this.description = description; + this.featuredAffiliateProductId = featuredAffiliateProductId; + this.logo = logo; + this.route = route; + this.sendCustomerEmails = sendCustomerEmails; + this.socialLinks = socialLinks; + this.targetAudience = targetAudience; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether prospective affiliates must submit an application before they can promote this company. + */ + @JsonIgnore + public Optional getAffiliateApplicationRequired() { + if (affiliateApplicationRequired == null) { + return Optional.empty(); + } + return affiliateApplicationRequired; + } + + /** + * @return Guidelines and instructions shown to affiliates explaining how to promote this company's products. + */ + @JsonIgnore + public Optional getAffiliateInstructions() { + if (affiliateInstructions == null) { + return Optional.empty(); + } + return affiliateInstructions; + } + + /** + * @return The company's banner image. Accepts PNG or JPEG format. + */ + @JsonIgnore + public Optional getBannerImage() { + if (bannerImage == null) { + return Optional.empty(); + } + return bannerImage; + } + + /** + * @return A promotional pitch displayed to potential customers on the company's store page. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The ID of the product to feature on this company's affiliate page. Pass null to clear. + */ + @JsonIgnore + public Optional getFeaturedAffiliateProductId() { + if (featuredAffiliateProductId == null) { + return Optional.empty(); + } + return featuredAffiliateProductId; + } + + /** + * @return The company's logo image. Accepts PNG, JPEG, or GIF format. + */ + @JsonIgnore + public Optional getLogo() { + if (logo == null) { + return Optional.empty(); + } + return logo; + } + + /** + * @return The unique URL slug for the company's store page. Must be lowercase and can include hyphens (e.g., 'my-company'). If not provided, the route will remain unchanged. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Whether Whop sends transactional emails (receipts, renewals, cancelations) to customers on behalf of this company. + */ + @JsonIgnore + public Optional getSendCustomerEmails() { + if (sendCustomerEmails == null) { + return Optional.empty(); + } + return sendCustomerEmails; + } + + /** + * @return The social media links to display on the company's store page. Pass the full list of desired social links — any existing links not included will be removed. + */ + @JsonIgnore + public Optional> getSocialLinks() { + if (socialLinks == null) { + return Optional.empty(); + } + return socialLinks; + } + + /** + * @return The target audience for this company (e.g., 'beginner day traders aged 18-25 looking to learn options'). + */ + @JsonIgnore + public Optional getTargetAudience() { + if (targetAudience == null) { + return Optional.empty(); + } + return targetAudience; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("affiliate_application_required") + private Optional _getAffiliateApplicationRequired() { + return affiliateApplicationRequired; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("affiliate_instructions") + private Optional _getAffiliateInstructions() { + return affiliateInstructions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("banner_image") + private Optional _getBannerImage() { + return bannerImage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("featured_affiliate_product_id") + private Optional _getFeaturedAffiliateProductId() { + return featuredAffiliateProductId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo") + private Optional _getLogo() { + return logo; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("send_customer_emails") + private Optional _getSendCustomerEmails() { + return sendCustomerEmails; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("social_links") + private Optional> _getSocialLinks() { + return socialLinks; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("target_audience") + private Optional _getTargetAudience() { + return targetAudience; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCompaniesRequest && equalTo((UpdateCompaniesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCompaniesRequest other) { + return affiliateApplicationRequired.equals(other.affiliateApplicationRequired) + && affiliateInstructions.equals(other.affiliateInstructions) + && bannerImage.equals(other.bannerImage) + && description.equals(other.description) + && featuredAffiliateProductId.equals(other.featuredAffiliateProductId) + && logo.equals(other.logo) + && route.equals(other.route) + && sendCustomerEmails.equals(other.sendCustomerEmails) + && socialLinks.equals(other.socialLinks) + && targetAudience.equals(other.targetAudience) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.affiliateApplicationRequired, + this.affiliateInstructions, + this.bannerImage, + this.description, + this.featuredAffiliateProductId, + this.logo, + this.route, + this.sendCustomerEmails, + this.socialLinks, + this.targetAudience, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional affiliateApplicationRequired = Optional.empty(); + + private Optional affiliateInstructions = Optional.empty(); + + private Optional bannerImage = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional featuredAffiliateProductId = Optional.empty(); + + private Optional logo = Optional.empty(); + + private Optional route = Optional.empty(); + + private Optional sendCustomerEmails = Optional.empty(); + + private Optional> socialLinks = Optional.empty(); + + private Optional targetAudience = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateCompaniesRequest other) { + affiliateApplicationRequired(other.getAffiliateApplicationRequired()); + affiliateInstructions(other.getAffiliateInstructions()); + bannerImage(other.getBannerImage()); + description(other.getDescription()); + featuredAffiliateProductId(other.getFeaturedAffiliateProductId()); + logo(other.getLogo()); + route(other.getRoute()); + sendCustomerEmails(other.getSendCustomerEmails()); + socialLinks(other.getSocialLinks()); + targetAudience(other.getTargetAudience()); + title(other.getTitle()); + return this; + } + + /** + *

Whether prospective affiliates must submit an application before they can promote this company.

+ */ + @JsonSetter(value = "affiliate_application_required", nulls = Nulls.SKIP) + public Builder affiliateApplicationRequired(Optional affiliateApplicationRequired) { + this.affiliateApplicationRequired = affiliateApplicationRequired; + return this; + } + + public Builder affiliateApplicationRequired(Boolean affiliateApplicationRequired) { + this.affiliateApplicationRequired = Optional.ofNullable(affiliateApplicationRequired); + return this; + } + + public Builder affiliateApplicationRequired(Nullable affiliateApplicationRequired) { + if (affiliateApplicationRequired.isNull()) { + this.affiliateApplicationRequired = null; + } else if (affiliateApplicationRequired.isEmpty()) { + this.affiliateApplicationRequired = Optional.empty(); + } else { + this.affiliateApplicationRequired = Optional.of(affiliateApplicationRequired.get()); + } + return this; + } + + /** + *

Guidelines and instructions shown to affiliates explaining how to promote this company's products.

+ */ + @JsonSetter(value = "affiliate_instructions", nulls = Nulls.SKIP) + public Builder affiliateInstructions(Optional affiliateInstructions) { + this.affiliateInstructions = affiliateInstructions; + return this; + } + + public Builder affiliateInstructions(String affiliateInstructions) { + this.affiliateInstructions = Optional.ofNullable(affiliateInstructions); + return this; + } + + public Builder affiliateInstructions(Nullable affiliateInstructions) { + if (affiliateInstructions.isNull()) { + this.affiliateInstructions = null; + } else if (affiliateInstructions.isEmpty()) { + this.affiliateInstructions = Optional.empty(); + } else { + this.affiliateInstructions = Optional.of(affiliateInstructions.get()); + } + return this; + } + + /** + *

The company's banner image. Accepts PNG or JPEG format.

+ */ + @JsonSetter(value = "banner_image", nulls = Nulls.SKIP) + public Builder bannerImage(Optional bannerImage) { + this.bannerImage = bannerImage; + return this; + } + + public Builder bannerImage(UpdateCompaniesRequestBannerImage bannerImage) { + this.bannerImage = Optional.ofNullable(bannerImage); + return this; + } + + public Builder bannerImage(Nullable bannerImage) { + if (bannerImage.isNull()) { + this.bannerImage = null; + } else if (bannerImage.isEmpty()) { + this.bannerImage = Optional.empty(); + } else { + this.bannerImage = Optional.of(bannerImage.get()); + } + return this; + } + + /** + *

A promotional pitch displayed to potential customers on the company's store page.

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public Builder description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

The ID of the product to feature on this company's affiliate page. Pass null to clear.

+ */ + @JsonSetter(value = "featured_affiliate_product_id", nulls = Nulls.SKIP) + public Builder featuredAffiliateProductId(Optional featuredAffiliateProductId) { + this.featuredAffiliateProductId = featuredAffiliateProductId; + return this; + } + + public Builder featuredAffiliateProductId(String featuredAffiliateProductId) { + this.featuredAffiliateProductId = Optional.ofNullable(featuredAffiliateProductId); + return this; + } + + public Builder featuredAffiliateProductId(Nullable featuredAffiliateProductId) { + if (featuredAffiliateProductId.isNull()) { + this.featuredAffiliateProductId = null; + } else if (featuredAffiliateProductId.isEmpty()) { + this.featuredAffiliateProductId = Optional.empty(); + } else { + this.featuredAffiliateProductId = Optional.of(featuredAffiliateProductId.get()); + } + return this; + } + + /** + *

The company's logo image. Accepts PNG, JPEG, or GIF format.

+ */ + @JsonSetter(value = "logo", nulls = Nulls.SKIP) + public Builder logo(Optional logo) { + this.logo = logo; + return this; + } + + public Builder logo(UpdateCompaniesRequestLogo logo) { + this.logo = Optional.ofNullable(logo); + return this; + } + + public Builder logo(Nullable logo) { + if (logo.isNull()) { + this.logo = null; + } else if (logo.isEmpty()) { + this.logo = Optional.empty(); + } else { + this.logo = Optional.of(logo.get()); + } + return this; + } + + /** + *

The unique URL slug for the company's store page. Must be lowercase and can include hyphens (e.g., 'my-company'). If not provided, the route will remain unchanged.

+ */ + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public Builder route(Optional route) { + this.route = route; + return this; + } + + public Builder route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + public Builder route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Whether Whop sends transactional emails (receipts, renewals, cancelations) to customers on behalf of this company.

+ */ + @JsonSetter(value = "send_customer_emails", nulls = Nulls.SKIP) + public Builder sendCustomerEmails(Optional sendCustomerEmails) { + this.sendCustomerEmails = sendCustomerEmails; + return this; + } + + public Builder sendCustomerEmails(Boolean sendCustomerEmails) { + this.sendCustomerEmails = Optional.ofNullable(sendCustomerEmails); + return this; + } + + public Builder sendCustomerEmails(Nullable sendCustomerEmails) { + if (sendCustomerEmails.isNull()) { + this.sendCustomerEmails = null; + } else if (sendCustomerEmails.isEmpty()) { + this.sendCustomerEmails = Optional.empty(); + } else { + this.sendCustomerEmails = Optional.of(sendCustomerEmails.get()); + } + return this; + } + + /** + *

The social media links to display on the company's store page. Pass the full list of desired social links — any existing links not included will be removed.

+ */ + @JsonSetter(value = "social_links", nulls = Nulls.SKIP) + public Builder socialLinks(Optional> socialLinks) { + this.socialLinks = socialLinks; + return this; + } + + public Builder socialLinks(List socialLinks) { + this.socialLinks = Optional.ofNullable(socialLinks); + return this; + } + + public Builder socialLinks(Nullable> socialLinks) { + if (socialLinks.isNull()) { + this.socialLinks = null; + } else if (socialLinks.isEmpty()) { + this.socialLinks = Optional.empty(); + } else { + this.socialLinks = Optional.of(socialLinks.get()); + } + return this; + } + + /** + *

The target audience for this company (e.g., 'beginner day traders aged 18-25 looking to learn options').

+ */ + @JsonSetter(value = "target_audience", nulls = Nulls.SKIP) + public Builder targetAudience(Optional targetAudience) { + this.targetAudience = targetAudience; + return this; + } + + public Builder targetAudience(String targetAudience) { + this.targetAudience = Optional.ofNullable(targetAudience); + return this; + } + + public Builder targetAudience(Nullable targetAudience) { + if (targetAudience.isNull()) { + this.targetAudience = null; + } else if (targetAudience.isEmpty()) { + this.targetAudience = Optional.empty(); + } else { + this.targetAudience = Optional.of(targetAudience.get()); + } + return this; + } + + /** + *

The display name of the company shown to customers.

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + public UpdateCompaniesRequest build() { + return new UpdateCompaniesRequest( + affiliateApplicationRequired, + affiliateInstructions, + bannerImage, + description, + featuredAffiliateProductId, + logo, + route, + sendCustomerEmails, + socialLinks, + targetAudience, + title, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companies/types/CreateApiKeyCompaniesRequestPermissionsItem.java b/src/main/java/com/whop/api/resources/companies/types/CreateApiKeyCompaniesRequestPermissionsItem.java new file mode 100644 index 00000000..dd2583d2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/types/CreateApiKeyCompaniesRequestPermissionsItem.java @@ -0,0 +1,249 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateApiKeyCompaniesRequestPermissionsItem.Builder.class) +public final class CreateApiKeyCompaniesRequestPermissionsItem { + private final List actions; + + private final boolean grant; + + private final List resources; + + private final Map additionalProperties; + + private CreateApiKeyCompaniesRequestPermissionsItem( + List actions, boolean grant, List resources, Map additionalProperties) { + this.actions = actions; + this.grant = grant; + this.resources = resources; + this.additionalProperties = additionalProperties; + } + + /** + * @return Actions covered by this statement + */ + @JsonProperty("actions") + public List getActions() { + return actions; + } + + /** + * @return Whether the actions are granted or denied + */ + @JsonProperty("grant") + public boolean getGrant() { + return grant; + } + + /** + * @return Resource identifiers. Can look like 'biz_xxxx' or 'biz_xxx|pass_|exp_xxx' or 'biz_xxx|app_xxx' or 'biz_xxx|pass_xxx|exp_xxx' or 'biz_xxx|pass_xxx' or 'biz_xxx|pass_' + */ + @JsonProperty("resources") + public List getResources() { + return resources; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateApiKeyCompaniesRequestPermissionsItem + && equalTo((CreateApiKeyCompaniesRequestPermissionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateApiKeyCompaniesRequestPermissionsItem other) { + return actions.equals(other.actions) && grant == other.grant && resources.equals(other.resources); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.actions, this.grant, this.resources); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static GrantStage builder() { + return new Builder(); + } + + public interface GrantStage { + /** + *

Whether the actions are granted or denied

+ */ + _FinalStage grant(boolean grant); + + Builder from(CreateApiKeyCompaniesRequestPermissionsItem other); + } + + public interface _FinalStage { + CreateApiKeyCompaniesRequestPermissionsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Actions covered by this statement

+ */ + _FinalStage actions(List actions); + + _FinalStage addActions(String actions); + + _FinalStage addAllActions(List actions); + + /** + *

Resource identifiers. Can look like 'biz_xxxx' or 'biz_xxx|pass_|exp_xxx' or 'biz_xxx|app_xxx' or 'biz_xxx|pass_xxx|exp_xxx' or 'biz_xxx|pass_xxx' or 'biz_xxx|pass_'

+ */ + _FinalStage resources(List resources); + + _FinalStage addResources(String resources); + + _FinalStage addAllResources(List resources); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements GrantStage, _FinalStage { + private boolean grant; + + private List resources = new ArrayList<>(); + + private List actions = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateApiKeyCompaniesRequestPermissionsItem other) { + actions(other.getActions()); + grant(other.getGrant()); + resources(other.getResources()); + return this; + } + + /** + *

Whether the actions are granted or denied

+ *

Whether the actions are granted or denied

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("grant") + public _FinalStage grant(boolean grant) { + this.grant = grant; + return this; + } + + /** + *

Resource identifiers. Can look like 'biz_xxxx' or 'biz_xxx|pass_|exp_xxx' or 'biz_xxx|app_xxx' or 'biz_xxx|pass_xxx|exp_xxx' or 'biz_xxx|pass_xxx' or 'biz_xxx|pass_'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllResources(List resources) { + if (resources != null) { + this.resources.addAll(resources); + } + return this; + } + + /** + *

Resource identifiers. Can look like 'biz_xxxx' or 'biz_xxx|pass_|exp_xxx' or 'biz_xxx|app_xxx' or 'biz_xxx|pass_xxx|exp_xxx' or 'biz_xxx|pass_xxx' or 'biz_xxx|pass_'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addResources(String resources) { + this.resources.add(resources); + return this; + } + + /** + *

Resource identifiers. Can look like 'biz_xxxx' or 'biz_xxx|pass_|exp_xxx' or 'biz_xxx|app_xxx' or 'biz_xxx|pass_xxx|exp_xxx' or 'biz_xxx|pass_xxx' or 'biz_xxx|pass_'

+ */ + @java.lang.Override + @JsonSetter(value = "resources", nulls = Nulls.SKIP) + public _FinalStage resources(List resources) { + this.resources.clear(); + if (resources != null) { + this.resources.addAll(resources); + } + return this; + } + + /** + *

Actions covered by this statement

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllActions(List actions) { + if (actions != null) { + this.actions.addAll(actions); + } + return this; + } + + /** + *

Actions covered by this statement

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addActions(String actions) { + this.actions.add(actions); + return this; + } + + /** + *

Actions covered by this statement

+ */ + @java.lang.Override + @JsonSetter(value = "actions", nulls = Nulls.SKIP) + public _FinalStage actions(List actions) { + this.actions.clear(); + if (actions != null) { + this.actions.addAll(actions); + } + return this; + } + + @java.lang.Override + public CreateApiKeyCompaniesRequestPermissionsItem build() { + return new CreateApiKeyCompaniesRequestPermissionsItem(actions, grant, resources, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companies/types/CreateApiKeyCompaniesResponse.java b/src/main/java/com/whop/api/resources/companies/types/CreateApiKeyCompaniesResponse.java new file mode 100644 index 00000000..52e1b5e1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/types/CreateApiKeyCompaniesResponse.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateApiKeyCompaniesResponse.Builder.class) +public final class CreateApiKeyCompaniesResponse { + private final String id; + + private final Optional name; + + private final String secretKey; + + private final Map additionalProperties; + + private CreateApiKeyCompaniesResponse( + String id, Optional name, String secretKey, Map additionalProperties) { + this.id = id; + this.name = name; + this.secretKey = secretKey; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the authorized api key. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A user set name to identify an API key + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The secret key used to authenticate requests. Only returned at creation time. + */ + @JsonProperty("secret_key") + public String getSecretKey() { + return secretKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateApiKeyCompaniesResponse && equalTo((CreateApiKeyCompaniesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateApiKeyCompaniesResponse other) { + return id.equals(other.id) && name.equals(other.name) && secretKey.equals(other.secretKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.secretKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the authorized api key.

+ */ + SecretKeyStage id(@NotNull String id); + + Builder from(CreateApiKeyCompaniesResponse other); + } + + public interface SecretKeyStage { + /** + *

The secret key used to authenticate requests. Only returned at creation time.

+ */ + _FinalStage secretKey(@NotNull String secretKey); + } + + public interface _FinalStage { + CreateApiKeyCompaniesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A user set name to identify an API key

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, SecretKeyStage, _FinalStage { + private String id; + + private String secretKey; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateApiKeyCompaniesResponse other) { + id(other.getId()); + name(other.getName()); + secretKey(other.getSecretKey()); + return this; + } + + /** + *

The unique identifier for the authorized api key.

+ *

The unique identifier for the authorized api key.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public SecretKeyStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The secret key used to authenticate requests. Only returned at creation time.

+ *

The secret key used to authenticate requests. Only returned at creation time.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("secret_key") + public _FinalStage secretKey(@NotNull String secretKey) { + this.secretKey = Objects.requireNonNull(secretKey, "secretKey must not be null"); + return this; + } + + /** + *

A user set name to identify an API key

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

A user set name to identify an API key

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

A user set name to identify an API key

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public CreateApiKeyCompaniesResponse build() { + return new CreateApiKeyCompaniesResponse(id, name, secretKey, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companies/types/CreateCompaniesRequestLogo.java b/src/main/java/com/whop/api/resources/companies/types/CreateCompaniesRequestLogo.java new file mode 100644 index 00000000..5f4955c9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/types/CreateCompaniesRequestLogo.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCompaniesRequestLogo.Builder.class) +public final class CreateCompaniesRequestLogo { + private final String id; + + private final Map additionalProperties; + + private CreateCompaniesRequestLogo(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCompaniesRequestLogo && equalTo((CreateCompaniesRequestLogo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCompaniesRequestLogo other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CreateCompaniesRequestLogo other); + } + + public interface _FinalStage { + CreateCompaniesRequestLogo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCompaniesRequestLogo other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CreateCompaniesRequestLogo build() { + return new CreateCompaniesRequestLogo(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companies/types/ListCompaniesResponse.java b/src/main/java/com/whop/api/resources/companies/types/ListCompaniesResponse.java new file mode 100644 index 00000000..b50b9164 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/types/ListCompaniesResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CompanyListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCompaniesResponse.Builder.class) +public final class ListCompaniesResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListCompaniesResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCompaniesResponse && equalTo((ListCompaniesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCompaniesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListCompaniesResponse other); + } + + public interface _FinalStage { + ListCompaniesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(CompanyListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCompaniesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(CompanyListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListCompaniesResponse build() { + return new ListCompaniesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companies/types/UpdateCompaniesRequestBannerImage.java b/src/main/java/com/whop/api/resources/companies/types/UpdateCompaniesRequestBannerImage.java new file mode 100644 index 00000000..7f91e193 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/types/UpdateCompaniesRequestBannerImage.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCompaniesRequestBannerImage.Builder.class) +public final class UpdateCompaniesRequestBannerImage { + private final String id; + + private final Map additionalProperties; + + private UpdateCompaniesRequestBannerImage(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCompaniesRequestBannerImage && equalTo((UpdateCompaniesRequestBannerImage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCompaniesRequestBannerImage other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateCompaniesRequestBannerImage other); + } + + public interface _FinalStage { + UpdateCompaniesRequestBannerImage build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCompaniesRequestBannerImage other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateCompaniesRequestBannerImage build() { + return new UpdateCompaniesRequestBannerImage(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companies/types/UpdateCompaniesRequestLogo.java b/src/main/java/com/whop/api/resources/companies/types/UpdateCompaniesRequestLogo.java new file mode 100644 index 00000000..477cb001 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/types/UpdateCompaniesRequestLogo.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCompaniesRequestLogo.Builder.class) +public final class UpdateCompaniesRequestLogo { + private final String id; + + private final Map additionalProperties; + + private UpdateCompaniesRequestLogo(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCompaniesRequestLogo && equalTo((UpdateCompaniesRequestLogo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCompaniesRequestLogo other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateCompaniesRequestLogo other); + } + + public interface _FinalStage { + UpdateCompaniesRequestLogo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCompaniesRequestLogo other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateCompaniesRequestLogo build() { + return new UpdateCompaniesRequestLogo(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companies/types/UpdateCompaniesRequestSocialLinksItem.java b/src/main/java/com/whop/api/resources/companies/types/UpdateCompaniesRequestSocialLinksItem.java new file mode 100644 index 00000000..18ccaf4a --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/types/UpdateCompaniesRequestSocialLinksItem.java @@ -0,0 +1,454 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.SocialLinkWebsites; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCompaniesRequestSocialLinksItem.Builder.class) +public final class UpdateCompaniesRequestSocialLinksItem { + private final Optional image; + + private final Optional order; + + private final Optional title; + + private final String url; + + private final SocialLinkWebsites website; + + private final Optional websiteOrder; + + private final Map additionalProperties; + + private UpdateCompaniesRequestSocialLinksItem( + Optional image, + Optional order, + Optional title, + String url, + SocialLinkWebsites website, + Optional websiteOrder, + Map additionalProperties) { + this.image = image; + this.order = order; + this.title = title; + this.url = url; + this.website = website; + this.websiteOrder = websiteOrder; + this.additionalProperties = additionalProperties; + } + + /** + * @return The custom image for the social link + */ + @JsonIgnore + public Optional getImage() { + if (image == null) { + return Optional.empty(); + } + return image; + } + + /** + * @return The order of the social link + */ + @JsonIgnore + public Optional getOrder() { + if (order == null) { + return Optional.empty(); + } + return order; + } + + /** + * @return The title of the social link + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The URL of the social link + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + /** + * @return The website this link is for + */ + @JsonProperty("website") + public SocialLinkWebsites getWebsite() { + return website; + } + + /** + * @return The order of the website social link + */ + @JsonIgnore + public Optional getWebsiteOrder() { + if (websiteOrder == null) { + return Optional.empty(); + } + return websiteOrder; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("image") + private Optional _getImage() { + return image; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("order") + private Optional _getOrder() { + return order; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("website_order") + private Optional _getWebsiteOrder() { + return websiteOrder; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCompaniesRequestSocialLinksItem + && equalTo((UpdateCompaniesRequestSocialLinksItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCompaniesRequestSocialLinksItem other) { + return image.equals(other.image) + && order.equals(other.order) + && title.equals(other.title) + && url.equals(other.url) + && website.equals(other.website) + && websiteOrder.equals(other.websiteOrder); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.image, this.order, this.title, this.url, this.website, this.websiteOrder); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

The URL of the social link

+ */ + WebsiteStage url(@NotNull String url); + + Builder from(UpdateCompaniesRequestSocialLinksItem other); + } + + public interface WebsiteStage { + /** + *

The website this link is for

+ */ + _FinalStage website(@NotNull SocialLinkWebsites website); + } + + public interface _FinalStage { + UpdateCompaniesRequestSocialLinksItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The custom image for the social link

+ */ + _FinalStage image(Optional image); + + _FinalStage image(UpdateCompaniesRequestSocialLinksItemImage image); + + _FinalStage image(Nullable image); + + /** + *

The order of the social link

+ */ + _FinalStage order(Optional order); + + _FinalStage order(String order); + + _FinalStage order(Nullable order); + + /** + *

The title of the social link

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + + /** + *

The order of the website social link

+ */ + _FinalStage websiteOrder(Optional websiteOrder); + + _FinalStage websiteOrder(String websiteOrder); + + _FinalStage websiteOrder(Nullable websiteOrder); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, WebsiteStage, _FinalStage { + private String url; + + private SocialLinkWebsites website; + + private Optional websiteOrder = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional image = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCompaniesRequestSocialLinksItem other) { + image(other.getImage()); + order(other.getOrder()); + title(other.getTitle()); + url(other.getUrl()); + website(other.getWebsite()); + websiteOrder(other.getWebsiteOrder()); + return this; + } + + /** + *

The URL of the social link

+ *

The URL of the social link

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public WebsiteStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + /** + *

The website this link is for

+ *

The website this link is for

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("website") + public _FinalStage website(@NotNull SocialLinkWebsites website) { + this.website = Objects.requireNonNull(website, "website must not be null"); + return this; + } + + /** + *

The order of the website social link

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage websiteOrder(Nullable websiteOrder) { + if (websiteOrder.isNull()) { + this.websiteOrder = null; + } else if (websiteOrder.isEmpty()) { + this.websiteOrder = Optional.empty(); + } else { + this.websiteOrder = Optional.of(websiteOrder.get()); + } + return this; + } + + /** + *

The order of the website social link

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage websiteOrder(String websiteOrder) { + this.websiteOrder = Optional.ofNullable(websiteOrder); + return this; + } + + /** + *

The order of the website social link

+ */ + @java.lang.Override + @JsonSetter(value = "website_order", nulls = Nulls.SKIP) + public _FinalStage websiteOrder(Optional websiteOrder) { + this.websiteOrder = websiteOrder; + return this; + } + + /** + *

The title of the social link

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

The title of the social link

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The title of the social link

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

The order of the social link

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(Nullable order) { + if (order.isNull()) { + this.order = null; + } else if (order.isEmpty()) { + this.order = Optional.empty(); + } else { + this.order = Optional.of(order.get()); + } + return this; + } + + /** + *

The order of the social link

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(String order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The order of the social link

+ */ + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + /** + *

The custom image for the social link

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage image(Nullable image) { + if (image.isNull()) { + this.image = null; + } else if (image.isEmpty()) { + this.image = Optional.empty(); + } else { + this.image = Optional.of(image.get()); + } + return this; + } + + /** + *

The custom image for the social link

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage image(UpdateCompaniesRequestSocialLinksItemImage image) { + this.image = Optional.ofNullable(image); + return this; + } + + /** + *

The custom image for the social link

+ */ + @java.lang.Override + @JsonSetter(value = "image", nulls = Nulls.SKIP) + public _FinalStage image(Optional image) { + this.image = image; + return this; + } + + @java.lang.Override + public UpdateCompaniesRequestSocialLinksItem build() { + return new UpdateCompaniesRequestSocialLinksItem( + image, order, title, url, website, websiteOrder, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companies/types/UpdateCompaniesRequestSocialLinksItemImage.java b/src/main/java/com/whop/api/resources/companies/types/UpdateCompaniesRequestSocialLinksItemImage.java new file mode 100644 index 00000000..e2b29a3a --- /dev/null +++ b/src/main/java/com/whop/api/resources/companies/types/UpdateCompaniesRequestSocialLinksItemImage.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companies.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCompaniesRequestSocialLinksItemImage.Builder.class) +public final class UpdateCompaniesRequestSocialLinksItemImage { + private final String id; + + private final Map additionalProperties; + + private UpdateCompaniesRequestSocialLinksItemImage(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCompaniesRequestSocialLinksItemImage + && equalTo((UpdateCompaniesRequestSocialLinksItemImage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCompaniesRequestSocialLinksItemImage other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateCompaniesRequestSocialLinksItemImage other); + } + + public interface _FinalStage { + UpdateCompaniesRequestSocialLinksItemImage build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCompaniesRequestSocialLinksItemImage other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateCompaniesRequestSocialLinksItemImage build() { + return new UpdateCompaniesRequestSocialLinksItemImage(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companytokentransactions/AsyncCompanyTokenTransactionsClient.java b/src/main/java/com/whop/api/resources/companytokentransactions/AsyncCompanyTokenTransactionsClient.java new file mode 100644 index 00000000..3062b844 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companytokentransactions/AsyncCompanyTokenTransactionsClient.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companytokentransactions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.companytokentransactions.requests.ListCompanyTokenTransactionsRequest; +import com.whop.api.resources.companytokentransactions.requests.RetrieveCompanyTokenTransactionsRequest; +import com.whop.api.resources.companytokentransactions.types.CreateCompanyTokenTransactionsRequest; +import com.whop.api.types.CompanyTokenTransaction; +import com.whop.api.types.CompanyTokenTransactionListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncCompanyTokenTransactionsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawCompanyTokenTransactionsClient rawClient; + + public AsyncCompanyTokenTransactionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawCompanyTokenTransactionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawCompanyTokenTransactionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of token transactions for a user or company, depending on the authenticated actor, with optional filtering by user and transaction type. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> list( + ListCompanyTokenTransactionsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of token transactions for a user or company, depending on the authenticated actor, with optional filtering by user and transaction type. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> list( + ListCompanyTokenTransactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create a token transaction to add, subtract, or transfer tokens for a member within a company. + *

Required permissions:

+ *
    + *
  • company_token_transaction:create
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture create(CreateCompanyTokenTransactionsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create a token transaction to add, subtract, or transfer tokens for a member within a company. + *

Required permissions:

+ *
    + *
  • company_token_transaction:create
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture create( + CreateCompanyTokenTransactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveCompanyTokenTransactionsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveCompanyTokenTransactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/companytokentransactions/AsyncRawCompanyTokenTransactionsClient.java b/src/main/java/com/whop/api/resources/companytokentransactions/AsyncRawCompanyTokenTransactionsClient.java new file mode 100644 index 00000000..9369a6c6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companytokentransactions/AsyncRawCompanyTokenTransactionsClient.java @@ -0,0 +1,470 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companytokentransactions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.companytokentransactions.requests.ListCompanyTokenTransactionsRequest; +import com.whop.api.resources.companytokentransactions.requests.RetrieveCompanyTokenTransactionsRequest; +import com.whop.api.resources.companytokentransactions.types.CreateCompanyTokenTransactionsRequest; +import com.whop.api.resources.companytokentransactions.types.ListCompanyTokenTransactionsResponse; +import com.whop.api.types.CompanyTokenTransaction; +import com.whop.api.types.CompanyTokenTransactionListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawCompanyTokenTransactionsClient { + protected final ClientOptions clientOptions; + + public AsyncRawCompanyTokenTransactionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of token transactions for a user or company, depending on the authenticated actor, with optional filtering by user and transaction type. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture>> list( + ListCompanyTokenTransactionsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of token transactions for a user or company, depending on the authenticated actor, with optional filtering by user and transaction type. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture>> list( + ListCompanyTokenTransactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("company_token_transactions"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getTransactionType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "transaction_type", request.getTransactionType().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCompanyTokenTransactionsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListCompanyTokenTransactionsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListCompanyTokenTransactionsRequest nextRequest = ListCompanyTokenTransactionsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create a token transaction to add, subtract, or transfer tokens for a member within a company. + *

Required permissions:

+ *
    + *
  • company_token_transaction:create
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> create( + CreateCompanyTokenTransactionsRequest request) { + return create(request, null); + } + + /** + * Create a token transaction to add, subtract, or transfer tokens for a member within a company. + *

Required permissions:

+ *
    + *
  • company_token_transaction:create
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> create( + CreateCompanyTokenTransactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("company_token_transactions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CompanyTokenTransaction.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveCompanyTokenTransactionsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCompanyTokenTransactionsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveCompanyTokenTransactionsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveCompanyTokenTransactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("company_token_transactions") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CompanyTokenTransaction.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/companytokentransactions/CompanyTokenTransactionsClient.java b/src/main/java/com/whop/api/resources/companytokentransactions/CompanyTokenTransactionsClient.java new file mode 100644 index 00000000..474d8082 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companytokentransactions/CompanyTokenTransactionsClient.java @@ -0,0 +1,138 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companytokentransactions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.companytokentransactions.requests.ListCompanyTokenTransactionsRequest; +import com.whop.api.resources.companytokentransactions.requests.RetrieveCompanyTokenTransactionsRequest; +import com.whop.api.resources.companytokentransactions.types.CreateCompanyTokenTransactionsRequest; +import com.whop.api.types.CompanyTokenTransaction; +import com.whop.api.types.CompanyTokenTransactionListItem; + +public class CompanyTokenTransactionsClient { + protected final ClientOptions clientOptions; + + private final RawCompanyTokenTransactionsClient rawClient; + + public CompanyTokenTransactionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawCompanyTokenTransactionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawCompanyTokenTransactionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of token transactions for a user or company, depending on the authenticated actor, with optional filtering by user and transaction type. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public SyncPagingIterable list(ListCompanyTokenTransactionsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of token transactions for a user or company, depending on the authenticated actor, with optional filtering by user and transaction type. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public SyncPagingIterable list( + ListCompanyTokenTransactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Create a token transaction to add, subtract, or transfer tokens for a member within a company. + *

Required permissions:

+ *
    + *
  • company_token_transaction:create
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompanyTokenTransaction create(CreateCompanyTokenTransactionsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Create a token transaction to add, subtract, or transfer tokens for a member within a company. + *

Required permissions:

+ *
    + *
  • company_token_transaction:create
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompanyTokenTransaction create( + CreateCompanyTokenTransactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompanyTokenTransaction retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompanyTokenTransaction retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompanyTokenTransaction retrieve(String id, RetrieveCompanyTokenTransactionsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public CompanyTokenTransaction retrieve( + String id, RetrieveCompanyTokenTransactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/companytokentransactions/RawCompanyTokenTransactionsClient.java b/src/main/java/com/whop/api/resources/companytokentransactions/RawCompanyTokenTransactionsClient.java new file mode 100644 index 00000000..0dee6656 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companytokentransactions/RawCompanyTokenTransactionsClient.java @@ -0,0 +1,373 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companytokentransactions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.companytokentransactions.requests.ListCompanyTokenTransactionsRequest; +import com.whop.api.resources.companytokentransactions.requests.RetrieveCompanyTokenTransactionsRequest; +import com.whop.api.resources.companytokentransactions.types.CreateCompanyTokenTransactionsRequest; +import com.whop.api.resources.companytokentransactions.types.ListCompanyTokenTransactionsResponse; +import com.whop.api.types.CompanyTokenTransaction; +import com.whop.api.types.CompanyTokenTransactionListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawCompanyTokenTransactionsClient { + protected final ClientOptions clientOptions; + + public RawCompanyTokenTransactionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of token transactions for a user or company, depending on the authenticated actor, with optional filtering by user and transaction type. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListCompanyTokenTransactionsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of token transactions for a user or company, depending on the authenticated actor, with optional filtering by user and transaction type. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListCompanyTokenTransactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("company_token_transactions"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getTransactionType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "transaction_type", request.getTransactionType().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCompanyTokenTransactionsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListCompanyTokenTransactionsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListCompanyTokenTransactionsRequest nextRequest = ListCompanyTokenTransactionsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Create a token transaction to add, subtract, or transfer tokens for a member within a company. + *

Required permissions:

+ *
    + *
  • company_token_transaction:create
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse create(CreateCompanyTokenTransactionsRequest request) { + return create(request, null); + } + + /** + * Create a token transaction to add, subtract, or transfer tokens for a member within a company. + *

Required permissions:

+ *
    + *
  • company_token_transaction:create
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse create( + CreateCompanyTokenTransactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("company_token_transactions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CompanyTokenTransaction.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveCompanyTokenTransactionsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCompanyTokenTransactionsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveCompanyTokenTransactionsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing company token transaction. + *

Required permissions:

+ *
    + *
  • company_token_transaction:read
  • + *
  • member:basic:read
  • + *
  • company:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveCompanyTokenTransactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("company_token_transactions") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CompanyTokenTransaction.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/companytokentransactions/requests/ListCompanyTokenTransactionsRequest.java b/src/main/java/com/whop/api/resources/companytokentransactions/requests/ListCompanyTokenTransactionsRequest.java new file mode 100644 index 00000000..feb3036c --- /dev/null +++ b/src/main/java/com/whop/api/resources/companytokentransactions/requests/ListCompanyTokenTransactionsRequest.java @@ -0,0 +1,382 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companytokentransactions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CompanyTokenTransactionTypes; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCompanyTokenTransactionsRequest.Builder.class) +public final class ListCompanyTokenTransactionsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String companyId; + + private final Optional userId; + + private final Optional transactionType; + + private final Map additionalProperties; + + private ListCompanyTokenTransactionsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String companyId, + Optional userId, + Optional transactionType, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.userId = userId; + this.transactionType = transactionType; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to list token transactions for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return Filter transactions to only those involving this specific user. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @JsonProperty("transaction_type") + public Optional getTransactionType() { + return transactionType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCompanyTokenTransactionsRequest + && equalTo((ListCompanyTokenTransactionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCompanyTokenTransactionsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId) + && userId.equals(other.userId) + && transactionType.equals(other.transactionType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.after, this.before, this.first, this.last, this.companyId, this.userId, this.transactionType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to list token transactions for.

+ */ + _FinalStage companyId(@NotNull String companyId); + + Builder from(ListCompanyTokenTransactionsRequest other); + } + + public interface _FinalStage { + ListCompanyTokenTransactionsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + /** + *

Filter transactions to only those involving this specific user.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + + _FinalStage transactionType(Optional transactionType); + + _FinalStage transactionType(CompanyTokenTransactionTypes transactionType); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional transactionType = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCompanyTokenTransactionsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + userId(other.getUserId()); + transactionType(other.getTransactionType()); + return this; + } + + /** + *

The unique identifier of the company to list token transactions for.

+ *

The unique identifier of the company to list token transactions for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage transactionType(CompanyTokenTransactionTypes transactionType) { + this.transactionType = Optional.ofNullable(transactionType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transaction_type", nulls = Nulls.SKIP) + public _FinalStage transactionType(Optional transactionType) { + this.transactionType = transactionType; + return this; + } + + /** + *

Filter transactions to only those involving this specific user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Filter transactions to only those involving this specific user.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListCompanyTokenTransactionsRequest build() { + return new ListCompanyTokenTransactionsRequest( + after, before, first, last, companyId, userId, transactionType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companytokentransactions/requests/RetrieveCompanyTokenTransactionsRequest.java b/src/main/java/com/whop/api/resources/companytokentransactions/requests/RetrieveCompanyTokenTransactionsRequest.java new file mode 100644 index 00000000..2a07f94a --- /dev/null +++ b/src/main/java/com/whop/api/resources/companytokentransactions/requests/RetrieveCompanyTokenTransactionsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companytokentransactions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCompanyTokenTransactionsRequest.Builder.class) +public final class RetrieveCompanyTokenTransactionsRequest { + private final Map additionalProperties; + + private RetrieveCompanyTokenTransactionsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCompanyTokenTransactionsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveCompanyTokenTransactionsRequest other) { + return this; + } + + public RetrieveCompanyTokenTransactionsRequest build() { + return new RetrieveCompanyTokenTransactionsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companytokentransactions/types/CreateCompanyTokenTransactionsRequest.java b/src/main/java/com/whop/api/resources/companytokentransactions/types/CreateCompanyTokenTransactionsRequest.java new file mode 100644 index 00000000..3823f86b --- /dev/null +++ b/src/main/java/com/whop/api/resources/companytokentransactions/types/CreateCompanyTokenTransactionsRequest.java @@ -0,0 +1,287 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companytokentransactions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateCompanyTokenTransactionsRequest { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateCompanyTokenTransactionsRequest(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateCompanyTokenTransactionsRequest transfer(CreateCompanyTokenTransactionsRequestTransfer value) { + return new CreateCompanyTokenTransactionsRequest(new TransferValue(value)); + } + + public static CreateCompanyTokenTransactionsRequest add(CreateCompanyTokenTransactionsRequestAdd value) { + return new CreateCompanyTokenTransactionsRequest(new AddValue(value)); + } + + public static CreateCompanyTokenTransactionsRequest subtract(CreateCompanyTokenTransactionsRequestSubtract value) { + return new CreateCompanyTokenTransactionsRequest(new SubtractValue(value)); + } + + public boolean isTransfer() { + return value instanceof TransferValue; + } + + public boolean isAdd() { + return value instanceof AddValue; + } + + public boolean isSubtract() { + return value instanceof SubtractValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getTransfer() { + if (isTransfer()) { + return Optional.of(((TransferValue) value).value); + } + return Optional.empty(); + } + + public Optional getAdd() { + if (isAdd()) { + return Optional.of(((AddValue) value).value); + } + return Optional.empty(); + } + + public Optional getSubtract() { + if (isSubtract()) { + return Optional.of(((SubtractValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCompanyTokenTransactionsRequest + && value.equals(((CreateCompanyTokenTransactionsRequest) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitTransfer(CreateCompanyTokenTransactionsRequestTransfer transfer); + + T visitAdd(CreateCompanyTokenTransactionsRequestAdd add); + + T visitSubtract(CreateCompanyTokenTransactionsRequestSubtract subtract); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + property = "transaction_type", + visible = true, + defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(TransferValue.class), + @JsonSubTypes.Type(AddValue.class), + @JsonSubTypes.Type(SubtractValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("transfer") + @JsonIgnoreProperties("transaction_type") + private static final class TransferValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "transaction_type", allowSetters = true) + private CreateCompanyTokenTransactionsRequestTransfer value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferValue() {} + + private TransferValue(CreateCompanyTokenTransactionsRequestTransfer value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransfer(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferValue && equalTo((TransferValue) other); + } + + private boolean equalTo(TransferValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateCompanyTokenTransactionsRequest{" + "value: " + value + "}"; + } + } + + @JsonTypeName("add") + @JsonIgnoreProperties("transaction_type") + private static final class AddValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "transaction_type", allowSetters = true) + private CreateCompanyTokenTransactionsRequestAdd value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AddValue() {} + + private AddValue(CreateCompanyTokenTransactionsRequestAdd value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAdd(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AddValue && equalTo((AddValue) other); + } + + private boolean equalTo(AddValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateCompanyTokenTransactionsRequest{" + "value: " + value + "}"; + } + } + + @JsonTypeName("subtract") + @JsonIgnoreProperties("transaction_type") + private static final class SubtractValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "transaction_type", allowSetters = true) + private CreateCompanyTokenTransactionsRequestSubtract value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SubtractValue() {} + + private SubtractValue(CreateCompanyTokenTransactionsRequestSubtract value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSubtract(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SubtractValue && equalTo((SubtractValue) other); + } + + private boolean equalTo(SubtractValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateCompanyTokenTransactionsRequest{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("transaction_type") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateCompanyTokenTransactionsRequest{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companytokentransactions/types/CreateCompanyTokenTransactionsRequestAdd.java b/src/main/java/com/whop/api/resources/companytokentransactions/types/CreateCompanyTokenTransactionsRequestAdd.java new file mode 100644 index 00000000..17ebf125 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companytokentransactions/types/CreateCompanyTokenTransactionsRequestAdd.java @@ -0,0 +1,348 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companytokentransactions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCompanyTokenTransactionsRequestAdd.Builder.class) +public final class CreateCompanyTokenTransactionsRequestAdd { + private final double amount; + + private final String companyId; + + private final Optional description; + + private final Optional idempotencyKey; + + private final String userId; + + private final Map additionalProperties; + + private CreateCompanyTokenTransactionsRequestAdd( + double amount, + String companyId, + Optional description, + Optional idempotencyKey, + String userId, + Map additionalProperties) { + this.amount = amount; + this.companyId = companyId; + this.description = description; + this.idempotencyKey = idempotencyKey; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The positive number of tokens to transact. For example, 100.0 for 100 tokens. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The unique identifier of the company to create the transaction in, starting with 'biz_'. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return A human-readable description of why the transaction was created. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return A unique key to prevent duplicate transactions. Use a UUID or similar unique string. + */ + @JsonIgnore + public Optional getIdempotencyKey() { + if (idempotencyKey == null) { + return Optional.empty(); + } + return idempotencyKey; + } + + /** + * @return The unique identifier of the user whose token balance will be affected, starting with 'user_'. + */ + @JsonProperty("user_id") + public String getUserId() { + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("idempotency_key") + private Optional _getIdempotencyKey() { + return idempotencyKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCompanyTokenTransactionsRequestAdd + && equalTo((CreateCompanyTokenTransactionsRequestAdd) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCompanyTokenTransactionsRequestAdd other) { + return amount == other.amount + && companyId.equals(other.companyId) + && description.equals(other.description) + && idempotencyKey.equals(other.idempotencyKey) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.companyId, this.description, this.idempotencyKey, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The positive number of tokens to transact. For example, 100.0 for 100 tokens.

+ */ + CompanyIdStage amount(double amount); + + Builder from(CreateCompanyTokenTransactionsRequestAdd other); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to create the transaction in, starting with 'biz_'.

+ */ + UserIdStage companyId(@NotNull String companyId); + } + + public interface UserIdStage { + /** + *

The unique identifier of the user whose token balance will be affected, starting with 'user_'.

+ */ + _FinalStage userId(@NotNull String userId); + } + + public interface _FinalStage { + CreateCompanyTokenTransactionsRequestAdd build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A human-readable description of why the transaction was created.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

A unique key to prevent duplicate transactions. Use a UUID or similar unique string.

+ */ + _FinalStage idempotencyKey(Optional idempotencyKey); + + _FinalStage idempotencyKey(String idempotencyKey); + + _FinalStage idempotencyKey(Nullable idempotencyKey); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, CompanyIdStage, UserIdStage, _FinalStage { + private double amount; + + private String companyId; + + private String userId; + + private Optional idempotencyKey = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCompanyTokenTransactionsRequestAdd other) { + amount(other.getAmount()); + companyId(other.getCompanyId()); + description(other.getDescription()); + idempotencyKey(other.getIdempotencyKey()); + userId(other.getUserId()); + return this; + } + + /** + *

The positive number of tokens to transact. For example, 100.0 for 100 tokens.

+ *

The positive number of tokens to transact. For example, 100.0 for 100 tokens.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CompanyIdStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The unique identifier of the company to create the transaction in, starting with 'biz_'.

+ *

The unique identifier of the company to create the transaction in, starting with 'biz_'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public UserIdStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The unique identifier of the user whose token balance will be affected, starting with 'user_'.

+ *

The unique identifier of the user whose token balance will be affected, starting with 'user_'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user_id") + public _FinalStage userId(@NotNull String userId) { + this.userId = Objects.requireNonNull(userId, "userId must not be null"); + return this; + } + + /** + *

A unique key to prevent duplicate transactions. Use a UUID or similar unique string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage idempotencyKey(Nullable idempotencyKey) { + if (idempotencyKey.isNull()) { + this.idempotencyKey = null; + } else if (idempotencyKey.isEmpty()) { + this.idempotencyKey = Optional.empty(); + } else { + this.idempotencyKey = Optional.of(idempotencyKey.get()); + } + return this; + } + + /** + *

A unique key to prevent duplicate transactions. Use a UUID or similar unique string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage idempotencyKey(String idempotencyKey) { + this.idempotencyKey = Optional.ofNullable(idempotencyKey); + return this; + } + + /** + *

A unique key to prevent duplicate transactions. Use a UUID or similar unique string.

+ */ + @java.lang.Override + @JsonSetter(value = "idempotency_key", nulls = Nulls.SKIP) + public _FinalStage idempotencyKey(Optional idempotencyKey) { + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + *

A human-readable description of why the transaction was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

A human-readable description of why the transaction was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

A human-readable description of why the transaction was created.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public CreateCompanyTokenTransactionsRequestAdd build() { + return new CreateCompanyTokenTransactionsRequestAdd( + amount, companyId, description, idempotencyKey, userId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companytokentransactions/types/CreateCompanyTokenTransactionsRequestSubtract.java b/src/main/java/com/whop/api/resources/companytokentransactions/types/CreateCompanyTokenTransactionsRequestSubtract.java new file mode 100644 index 00000000..9f81f7d1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companytokentransactions/types/CreateCompanyTokenTransactionsRequestSubtract.java @@ -0,0 +1,348 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companytokentransactions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCompanyTokenTransactionsRequestSubtract.Builder.class) +public final class CreateCompanyTokenTransactionsRequestSubtract { + private final double amount; + + private final String companyId; + + private final Optional description; + + private final Optional idempotencyKey; + + private final String userId; + + private final Map additionalProperties; + + private CreateCompanyTokenTransactionsRequestSubtract( + double amount, + String companyId, + Optional description, + Optional idempotencyKey, + String userId, + Map additionalProperties) { + this.amount = amount; + this.companyId = companyId; + this.description = description; + this.idempotencyKey = idempotencyKey; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The positive number of tokens to transact. For example, 100.0 for 100 tokens. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The unique identifier of the company to create the transaction in, starting with 'biz_'. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return A human-readable description of why the transaction was created. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return A unique key to prevent duplicate transactions. Use a UUID or similar unique string. + */ + @JsonIgnore + public Optional getIdempotencyKey() { + if (idempotencyKey == null) { + return Optional.empty(); + } + return idempotencyKey; + } + + /** + * @return The unique identifier of the user whose token balance will be affected, starting with 'user_'. + */ + @JsonProperty("user_id") + public String getUserId() { + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("idempotency_key") + private Optional _getIdempotencyKey() { + return idempotencyKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCompanyTokenTransactionsRequestSubtract + && equalTo((CreateCompanyTokenTransactionsRequestSubtract) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCompanyTokenTransactionsRequestSubtract other) { + return amount == other.amount + && companyId.equals(other.companyId) + && description.equals(other.description) + && idempotencyKey.equals(other.idempotencyKey) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.companyId, this.description, this.idempotencyKey, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The positive number of tokens to transact. For example, 100.0 for 100 tokens.

+ */ + CompanyIdStage amount(double amount); + + Builder from(CreateCompanyTokenTransactionsRequestSubtract other); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to create the transaction in, starting with 'biz_'.

+ */ + UserIdStage companyId(@NotNull String companyId); + } + + public interface UserIdStage { + /** + *

The unique identifier of the user whose token balance will be affected, starting with 'user_'.

+ */ + _FinalStage userId(@NotNull String userId); + } + + public interface _FinalStage { + CreateCompanyTokenTransactionsRequestSubtract build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A human-readable description of why the transaction was created.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

A unique key to prevent duplicate transactions. Use a UUID or similar unique string.

+ */ + _FinalStage idempotencyKey(Optional idempotencyKey); + + _FinalStage idempotencyKey(String idempotencyKey); + + _FinalStage idempotencyKey(Nullable idempotencyKey); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, CompanyIdStage, UserIdStage, _FinalStage { + private double amount; + + private String companyId; + + private String userId; + + private Optional idempotencyKey = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCompanyTokenTransactionsRequestSubtract other) { + amount(other.getAmount()); + companyId(other.getCompanyId()); + description(other.getDescription()); + idempotencyKey(other.getIdempotencyKey()); + userId(other.getUserId()); + return this; + } + + /** + *

The positive number of tokens to transact. For example, 100.0 for 100 tokens.

+ *

The positive number of tokens to transact. For example, 100.0 for 100 tokens.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CompanyIdStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The unique identifier of the company to create the transaction in, starting with 'biz_'.

+ *

The unique identifier of the company to create the transaction in, starting with 'biz_'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public UserIdStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The unique identifier of the user whose token balance will be affected, starting with 'user_'.

+ *

The unique identifier of the user whose token balance will be affected, starting with 'user_'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user_id") + public _FinalStage userId(@NotNull String userId) { + this.userId = Objects.requireNonNull(userId, "userId must not be null"); + return this; + } + + /** + *

A unique key to prevent duplicate transactions. Use a UUID or similar unique string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage idempotencyKey(Nullable idempotencyKey) { + if (idempotencyKey.isNull()) { + this.idempotencyKey = null; + } else if (idempotencyKey.isEmpty()) { + this.idempotencyKey = Optional.empty(); + } else { + this.idempotencyKey = Optional.of(idempotencyKey.get()); + } + return this; + } + + /** + *

A unique key to prevent duplicate transactions. Use a UUID or similar unique string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage idempotencyKey(String idempotencyKey) { + this.idempotencyKey = Optional.ofNullable(idempotencyKey); + return this; + } + + /** + *

A unique key to prevent duplicate transactions. Use a UUID or similar unique string.

+ */ + @java.lang.Override + @JsonSetter(value = "idempotency_key", nulls = Nulls.SKIP) + public _FinalStage idempotencyKey(Optional idempotencyKey) { + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + *

A human-readable description of why the transaction was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

A human-readable description of why the transaction was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

A human-readable description of why the transaction was created.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public CreateCompanyTokenTransactionsRequestSubtract build() { + return new CreateCompanyTokenTransactionsRequestSubtract( + amount, companyId, description, idempotencyKey, userId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companytokentransactions/types/CreateCompanyTokenTransactionsRequestTransfer.java b/src/main/java/com/whop/api/resources/companytokentransactions/types/CreateCompanyTokenTransactionsRequestTransfer.java new file mode 100644 index 00000000..5c438b01 --- /dev/null +++ b/src/main/java/com/whop/api/resources/companytokentransactions/types/CreateCompanyTokenTransactionsRequestTransfer.java @@ -0,0 +1,390 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companytokentransactions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCompanyTokenTransactionsRequestTransfer.Builder.class) +public final class CreateCompanyTokenTransactionsRequestTransfer { + private final double amount; + + private final String companyId; + + private final Optional description; + + private final String destinationUserId; + + private final Optional idempotencyKey; + + private final String userId; + + private final Map additionalProperties; + + private CreateCompanyTokenTransactionsRequestTransfer( + double amount, + String companyId, + Optional description, + String destinationUserId, + Optional idempotencyKey, + String userId, + Map additionalProperties) { + this.amount = amount; + this.companyId = companyId; + this.description = description; + this.destinationUserId = destinationUserId; + this.idempotencyKey = idempotencyKey; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The positive number of tokens to transact. For example, 100.0 for 100 tokens. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The unique identifier of the company to create the transaction in, starting with 'biz_'. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return A human-readable description of why the transaction was created. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The unique identifier of the user receiving the tokens. Required when the transaction type is 'transfer'. + */ + @JsonProperty("destination_user_id") + public String getDestinationUserId() { + return destinationUserId; + } + + /** + * @return A unique key to prevent duplicate transactions. Use a UUID or similar unique string. + */ + @JsonIgnore + public Optional getIdempotencyKey() { + if (idempotencyKey == null) { + return Optional.empty(); + } + return idempotencyKey; + } + + /** + * @return The unique identifier of the user whose token balance will be affected, starting with 'user_'. + */ + @JsonProperty("user_id") + public String getUserId() { + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("idempotency_key") + private Optional _getIdempotencyKey() { + return idempotencyKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCompanyTokenTransactionsRequestTransfer + && equalTo((CreateCompanyTokenTransactionsRequestTransfer) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCompanyTokenTransactionsRequestTransfer other) { + return amount == other.amount + && companyId.equals(other.companyId) + && description.equals(other.description) + && destinationUserId.equals(other.destinationUserId) + && idempotencyKey.equals(other.idempotencyKey) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.companyId, + this.description, + this.destinationUserId, + this.idempotencyKey, + this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The positive number of tokens to transact. For example, 100.0 for 100 tokens.

+ */ + CompanyIdStage amount(double amount); + + Builder from(CreateCompanyTokenTransactionsRequestTransfer other); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to create the transaction in, starting with 'biz_'.

+ */ + DestinationUserIdStage companyId(@NotNull String companyId); + } + + public interface DestinationUserIdStage { + /** + *

The unique identifier of the user receiving the tokens. Required when the transaction type is 'transfer'.

+ */ + UserIdStage destinationUserId(@NotNull String destinationUserId); + } + + public interface UserIdStage { + /** + *

The unique identifier of the user whose token balance will be affected, starting with 'user_'.

+ */ + _FinalStage userId(@NotNull String userId); + } + + public interface _FinalStage { + CreateCompanyTokenTransactionsRequestTransfer build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A human-readable description of why the transaction was created.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

A unique key to prevent duplicate transactions. Use a UUID or similar unique string.

+ */ + _FinalStage idempotencyKey(Optional idempotencyKey); + + _FinalStage idempotencyKey(String idempotencyKey); + + _FinalStage idempotencyKey(Nullable idempotencyKey); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, CompanyIdStage, DestinationUserIdStage, UserIdStage, _FinalStage { + private double amount; + + private String companyId; + + private String destinationUserId; + + private String userId; + + private Optional idempotencyKey = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCompanyTokenTransactionsRequestTransfer other) { + amount(other.getAmount()); + companyId(other.getCompanyId()); + description(other.getDescription()); + destinationUserId(other.getDestinationUserId()); + idempotencyKey(other.getIdempotencyKey()); + userId(other.getUserId()); + return this; + } + + /** + *

The positive number of tokens to transact. For example, 100.0 for 100 tokens.

+ *

The positive number of tokens to transact. For example, 100.0 for 100 tokens.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CompanyIdStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The unique identifier of the company to create the transaction in, starting with 'biz_'.

+ *

The unique identifier of the company to create the transaction in, starting with 'biz_'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public DestinationUserIdStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The unique identifier of the user receiving the tokens. Required when the transaction type is 'transfer'.

+ *

The unique identifier of the user receiving the tokens. Required when the transaction type is 'transfer'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination_user_id") + public UserIdStage destinationUserId(@NotNull String destinationUserId) { + this.destinationUserId = Objects.requireNonNull(destinationUserId, "destinationUserId must not be null"); + return this; + } + + /** + *

The unique identifier of the user whose token balance will be affected, starting with 'user_'.

+ *

The unique identifier of the user whose token balance will be affected, starting with 'user_'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user_id") + public _FinalStage userId(@NotNull String userId) { + this.userId = Objects.requireNonNull(userId, "userId must not be null"); + return this; + } + + /** + *

A unique key to prevent duplicate transactions. Use a UUID or similar unique string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage idempotencyKey(Nullable idempotencyKey) { + if (idempotencyKey.isNull()) { + this.idempotencyKey = null; + } else if (idempotencyKey.isEmpty()) { + this.idempotencyKey = Optional.empty(); + } else { + this.idempotencyKey = Optional.of(idempotencyKey.get()); + } + return this; + } + + /** + *

A unique key to prevent duplicate transactions. Use a UUID or similar unique string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage idempotencyKey(String idempotencyKey) { + this.idempotencyKey = Optional.ofNullable(idempotencyKey); + return this; + } + + /** + *

A unique key to prevent duplicate transactions. Use a UUID or similar unique string.

+ */ + @java.lang.Override + @JsonSetter(value = "idempotency_key", nulls = Nulls.SKIP) + public _FinalStage idempotencyKey(Optional idempotencyKey) { + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + *

A human-readable description of why the transaction was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

A human-readable description of why the transaction was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

A human-readable description of why the transaction was created.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public CreateCompanyTokenTransactionsRequestTransfer build() { + return new CreateCompanyTokenTransactionsRequestTransfer( + amount, companyId, description, destinationUserId, idempotencyKey, userId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/companytokentransactions/types/ListCompanyTokenTransactionsResponse.java b/src/main/java/com/whop/api/resources/companytokentransactions/types/ListCompanyTokenTransactionsResponse.java new file mode 100644 index 00000000..0cf5984b --- /dev/null +++ b/src/main/java/com/whop/api/resources/companytokentransactions/types/ListCompanyTokenTransactionsResponse.java @@ -0,0 +1,194 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.companytokentransactions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CompanyTokenTransactionListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCompanyTokenTransactionsResponse.Builder.class) +public final class ListCompanyTokenTransactionsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListCompanyTokenTransactionsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCompanyTokenTransactionsResponse + && equalTo((ListCompanyTokenTransactionsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCompanyTokenTransactionsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListCompanyTokenTransactionsResponse other); + } + + public interface _FinalStage { + ListCompanyTokenTransactionsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(CompanyTokenTransactionListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCompanyTokenTransactionsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(CompanyTokenTransactionListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListCompanyTokenTransactionsResponse build() { + return new ListCompanyTokenTransactionsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/coursechapters/AsyncCourseChaptersClient.java b/src/main/java/com/whop/api/resources/coursechapters/AsyncCourseChaptersClient.java new file mode 100644 index 00000000..cf04e5fe --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursechapters/AsyncCourseChaptersClient.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursechapters; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.coursechapters.requests.CreateCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.DeleteCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.ListCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.RetrieveCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.UpdateCourseChaptersRequest; +import com.whop.api.types.CourseChapter; +import com.whop.api.types.CourseChapterListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncCourseChaptersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawCourseChaptersClient rawClient; + + public AsyncCourseChaptersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawCourseChaptersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawCourseChaptersClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of chapters within a course, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> list(ListCourseChaptersRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of chapters within a course, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> list( + ListCourseChaptersRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create a new chapter within a course to organize lessons into sections. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture create(CreateCourseChaptersRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create a new chapter within a course to organize lessons into sections. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture create(CreateCourseChaptersRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveCourseChaptersRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveCourseChaptersRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture delete(String id, DeleteCourseChaptersRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture delete( + String id, DeleteCourseChaptersRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a chapter's title within a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture update(String id, UpdateCourseChaptersRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Update a chapter's title within a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture update( + String id, UpdateCourseChaptersRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/coursechapters/AsyncRawCourseChaptersClient.java b/src/main/java/com/whop/api/resources/coursechapters/AsyncRawCourseChaptersClient.java new file mode 100644 index 00000000..39bd417b --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursechapters/AsyncRawCourseChaptersClient.java @@ -0,0 +1,694 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursechapters; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.coursechapters.requests.CreateCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.DeleteCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.ListCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.RetrieveCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.UpdateCourseChaptersRequest; +import com.whop.api.resources.coursechapters.types.ListCourseChaptersResponse; +import com.whop.api.types.CourseChapter; +import com.whop.api.types.CourseChapterListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawCourseChaptersClient { + protected final ClientOptions clientOptions; + + public AsyncRawCourseChaptersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of chapters within a course, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture>> list( + ListCourseChaptersRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of chapters within a course, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture>> list( + ListCourseChaptersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_chapters"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "course_id", request.getCourseId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCourseChaptersResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListCourseChaptersResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListCourseChaptersRequest nextRequest = ListCourseChaptersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create a new chapter within a course to organize lessons into sections. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> create(CreateCourseChaptersRequest request) { + return create(request, null); + } + + /** + * Create a new chapter within a course to organize lessons into sections. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> create( + CreateCourseChaptersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_chapters"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseChapter.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveCourseChaptersRequest.builder().build()); + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCourseChaptersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveCourseChaptersRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveCourseChaptersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_chapters") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseChapter.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteCourseChaptersRequest.builder().build()); + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteCourseChaptersRequest.builder().build(), requestOptions); + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> delete(String id, DeleteCourseChaptersRequest request) { + return delete(id, request, null); + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> delete( + String id, DeleteCourseChaptersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_chapters") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Update a chapter's title within a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> update( + String id, UpdateCourseChaptersRequest request) { + return update(id, request, null); + } + + /** + * Update a chapter's title within a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> update( + String id, UpdateCourseChaptersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_chapters") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseChapter.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/coursechapters/CourseChaptersClient.java b/src/main/java/com/whop/api/resources/coursechapters/CourseChaptersClient.java new file mode 100644 index 00000000..80bc998c --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursechapters/CourseChaptersClient.java @@ -0,0 +1,188 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursechapters; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.coursechapters.requests.CreateCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.DeleteCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.ListCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.RetrieveCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.UpdateCourseChaptersRequest; +import com.whop.api.types.CourseChapter; +import com.whop.api.types.CourseChapterListItem; + +public class CourseChaptersClient { + protected final ClientOptions clientOptions; + + private final RawCourseChaptersClient rawClient; + + public CourseChaptersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawCourseChaptersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawCourseChaptersClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of chapters within a course, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public SyncPagingIterable list(ListCourseChaptersRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of chapters within a course, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public SyncPagingIterable list( + ListCourseChaptersRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Create a new chapter within a course to organize lessons into sections. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CourseChapter create(CreateCourseChaptersRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Create a new chapter within a course to organize lessons into sections. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CourseChapter create(CreateCourseChaptersRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CourseChapter retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CourseChapter retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CourseChapter retrieve(String id, RetrieveCourseChaptersRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CourseChapter retrieve(String id, RetrieveCourseChaptersRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public boolean delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public boolean delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public boolean delete(String id, DeleteCourseChaptersRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public boolean delete(String id, DeleteCourseChaptersRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Update a chapter's title within a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CourseChapter update(String id, UpdateCourseChaptersRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Update a chapter's title within a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CourseChapter update(String id, UpdateCourseChaptersRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/coursechapters/RawCourseChaptersClient.java b/src/main/java/com/whop/api/resources/coursechapters/RawCourseChaptersClient.java new file mode 100644 index 00000000..b4c69a12 --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursechapters/RawCourseChaptersClient.java @@ -0,0 +1,539 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursechapters; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.coursechapters.requests.CreateCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.DeleteCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.ListCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.RetrieveCourseChaptersRequest; +import com.whop.api.resources.coursechapters.requests.UpdateCourseChaptersRequest; +import com.whop.api.resources.coursechapters.types.ListCourseChaptersResponse; +import com.whop.api.types.CourseChapter; +import com.whop.api.types.CourseChapterListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawCourseChaptersClient { + protected final ClientOptions clientOptions; + + public RawCourseChaptersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of chapters within a course, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListCourseChaptersRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of chapters within a course, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListCourseChaptersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_chapters"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "course_id", request.getCourseId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCourseChaptersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCourseChaptersResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListCourseChaptersRequest nextRequest = ListCourseChaptersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Create a new chapter within a course to organize lessons into sections. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse create(CreateCourseChaptersRequest request) { + return create(request, null); + } + + /** + * Create a new chapter within a course to organize lessons into sections. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse create( + CreateCourseChaptersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_chapters"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseChapter.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveCourseChaptersRequest.builder().build()); + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCourseChaptersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveCourseChaptersRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing course chapter. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveCourseChaptersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_chapters") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseChapter.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteCourseChaptersRequest.builder().build()); + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteCourseChaptersRequest.builder().build(), requestOptions); + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id, DeleteCourseChaptersRequest request) { + return delete(id, request, null); + } + + /** + * Permanently delete a chapter and all of its lessons from a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse delete( + String id, DeleteCourseChaptersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_chapters") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Update a chapter's title within a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateCourseChaptersRequest request) { + return update(id, request, null); + } + + /** + * Update a chapter's title within a course. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse update( + String id, UpdateCourseChaptersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_chapters") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseChapter.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/coursechapters/requests/CreateCourseChaptersRequest.java b/src/main/java/com/whop/api/resources/coursechapters/requests/CreateCourseChaptersRequest.java new file mode 100644 index 00000000..7832f891 --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursechapters/requests/CreateCourseChaptersRequest.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursechapters.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCourseChaptersRequest.Builder.class) +public final class CreateCourseChaptersRequest { + private final String courseId; + + private final Optional title; + + private final Map additionalProperties; + + private CreateCourseChaptersRequest( + String courseId, Optional title, Map additionalProperties) { + this.courseId = courseId; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the course to create the chapter in (e.g., "course_XXXXX"). + */ + @JsonProperty("course_id") + public String getCourseId() { + return courseId; + } + + /** + * @return The display title of the chapter (e.g., "Module 1: Introduction"). + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCourseChaptersRequest && equalTo((CreateCourseChaptersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCourseChaptersRequest other) { + return courseId.equals(other.courseId) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.courseId, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CourseIdStage builder() { + return new Builder(); + } + + public interface CourseIdStage { + /** + *

The unique identifier of the course to create the chapter in (e.g., "course_XXXXX").

+ */ + _FinalStage courseId(@NotNull String courseId); + + Builder from(CreateCourseChaptersRequest other); + } + + public interface _FinalStage { + CreateCourseChaptersRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The display title of the chapter (e.g., "Module 1: Introduction").

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CourseIdStage, _FinalStage { + private String courseId; + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCourseChaptersRequest other) { + courseId(other.getCourseId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier of the course to create the chapter in (e.g., "course_XXXXX").

+ *

The unique identifier of the course to create the chapter in (e.g., "course_XXXXX").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("course_id") + public _FinalStage courseId(@NotNull String courseId) { + this.courseId = Objects.requireNonNull(courseId, "courseId must not be null"); + return this; + } + + /** + *

The display title of the chapter (e.g., "Module 1: Introduction").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

The display title of the chapter (e.g., "Module 1: Introduction").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The display title of the chapter (e.g., "Module 1: Introduction").

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + @java.lang.Override + public CreateCourseChaptersRequest build() { + return new CreateCourseChaptersRequest(courseId, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/coursechapters/requests/DeleteCourseChaptersRequest.java b/src/main/java/com/whop/api/resources/coursechapters/requests/DeleteCourseChaptersRequest.java new file mode 100644 index 00000000..cbd3fb31 --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursechapters/requests/DeleteCourseChaptersRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursechapters.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteCourseChaptersRequest.Builder.class) +public final class DeleteCourseChaptersRequest { + private final Map additionalProperties; + + private DeleteCourseChaptersRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteCourseChaptersRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteCourseChaptersRequest other) { + return this; + } + + public DeleteCourseChaptersRequest build() { + return new DeleteCourseChaptersRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/coursechapters/requests/ListCourseChaptersRequest.java b/src/main/java/com/whop/api/resources/coursechapters/requests/ListCourseChaptersRequest.java new file mode 100644 index 00000000..f8ed53a6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursechapters/requests/ListCourseChaptersRequest.java @@ -0,0 +1,305 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursechapters.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCourseChaptersRequest.Builder.class) +public final class ListCourseChaptersRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String courseId; + + private final Map additionalProperties; + + private ListCourseChaptersRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String courseId, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.courseId = courseId; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the course to list chapters for. + */ + @JsonProperty("course_id") + public String getCourseId() { + return courseId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCourseChaptersRequest && equalTo((ListCourseChaptersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCourseChaptersRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && courseId.equals(other.courseId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last, this.courseId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CourseIdStage builder() { + return new Builder(); + } + + public interface CourseIdStage { + /** + *

The unique identifier of the course to list chapters for.

+ */ + _FinalStage courseId(@NotNull String courseId); + + Builder from(ListCourseChaptersRequest other); + } + + public interface _FinalStage { + ListCourseChaptersRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CourseIdStage, _FinalStage { + private String courseId; + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCourseChaptersRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + courseId(other.getCourseId()); + return this; + } + + /** + *

The unique identifier of the course to list chapters for.

+ *

The unique identifier of the course to list chapters for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("course_id") + public _FinalStage courseId(@NotNull String courseId) { + this.courseId = Objects.requireNonNull(courseId, "courseId must not be null"); + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListCourseChaptersRequest build() { + return new ListCourseChaptersRequest(after, before, first, last, courseId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/coursechapters/requests/RetrieveCourseChaptersRequest.java b/src/main/java/com/whop/api/resources/coursechapters/requests/RetrieveCourseChaptersRequest.java new file mode 100644 index 00000000..c48057df --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursechapters/requests/RetrieveCourseChaptersRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursechapters.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCourseChaptersRequest.Builder.class) +public final class RetrieveCourseChaptersRequest { + private final Map additionalProperties; + + private RetrieveCourseChaptersRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCourseChaptersRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveCourseChaptersRequest other) { + return this; + } + + public RetrieveCourseChaptersRequest build() { + return new RetrieveCourseChaptersRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/coursechapters/requests/UpdateCourseChaptersRequest.java b/src/main/java/com/whop/api/resources/coursechapters/requests/UpdateCourseChaptersRequest.java new file mode 100644 index 00000000..f082d848 --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursechapters/requests/UpdateCourseChaptersRequest.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursechapters.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCourseChaptersRequest.Builder.class) +public final class UpdateCourseChaptersRequest { + private final String title; + + private final Map additionalProperties; + + private UpdateCourseChaptersRequest(String title, Map additionalProperties) { + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The new display title of the chapter (e.g., "Module 1: Introduction"). + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCourseChaptersRequest && equalTo((UpdateCourseChaptersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCourseChaptersRequest other) { + return title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TitleStage builder() { + return new Builder(); + } + + public interface TitleStage { + /** + *

The new display title of the chapter (e.g., "Module 1: Introduction").

+ */ + _FinalStage title(@NotNull String title); + + Builder from(UpdateCourseChaptersRequest other); + } + + public interface _FinalStage { + UpdateCourseChaptersRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TitleStage, _FinalStage { + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCourseChaptersRequest other) { + title(other.getTitle()); + return this; + } + + /** + *

The new display title of the chapter (e.g., "Module 1: Introduction").

+ *

The new display title of the chapter (e.g., "Module 1: Introduction").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public UpdateCourseChaptersRequest build() { + return new UpdateCourseChaptersRequest(title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/coursechapters/types/ListCourseChaptersResponse.java b/src/main/java/com/whop/api/resources/coursechapters/types/ListCourseChaptersResponse.java new file mode 100644 index 00000000..c25e6a7d --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursechapters/types/ListCourseChaptersResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursechapters.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CourseChapterListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCourseChaptersResponse.Builder.class) +public final class ListCourseChaptersResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListCourseChaptersResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCourseChaptersResponse && equalTo((ListCourseChaptersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCourseChaptersResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListCourseChaptersResponse other); + } + + public interface _FinalStage { + ListCourseChaptersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(CourseChapterListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCourseChaptersResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(CourseChapterListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListCourseChaptersResponse build() { + return new ListCourseChaptersResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessoninteractions/AsyncCourseLessonInteractionsClient.java b/src/main/java/com/whop/api/resources/courselessoninteractions/AsyncCourseLessonInteractionsClient.java new file mode 100644 index 00000000..6728c4b6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessoninteractions/AsyncCourseLessonInteractionsClient.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessoninteractions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.courselessoninteractions.requests.ListCourseLessonInteractionsRequest; +import com.whop.api.resources.courselessoninteractions.requests.RetrieveCourseLessonInteractionsRequest; +import com.whop.api.types.CourseLessonInteraction; +import com.whop.api.types.CourseLessonInteractionListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncCourseLessonInteractionsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawCourseLessonInteractionsClient rawClient; + + public AsyncCourseLessonInteractionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawCourseLessonInteractionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawCourseLessonInteractionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture> list( + ListCourseLessonInteractionsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture> list( + ListCourseLessonInteractionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveCourseLessonInteractionsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveCourseLessonInteractionsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/courselessoninteractions/AsyncRawCourseLessonInteractionsClient.java b/src/main/java/com/whop/api/resources/courselessoninteractions/AsyncRawCourseLessonInteractionsClient.java new file mode 100644 index 00000000..3264d6d2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessoninteractions/AsyncRawCourseLessonInteractionsClient.java @@ -0,0 +1,372 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessoninteractions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.courselessoninteractions.requests.ListCourseLessonInteractionsRequest; +import com.whop.api.resources.courselessoninteractions.requests.RetrieveCourseLessonInteractionsRequest; +import com.whop.api.resources.courselessoninteractions.types.ListCourseLessonInteractionsResponse; +import com.whop.api.types.CourseLessonInteraction; +import com.whop.api.types.CourseLessonInteractionListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawCourseLessonInteractionsClient { + protected final ClientOptions clientOptions; + + public AsyncRawCourseLessonInteractionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture>> list() { + return list(ListCourseLessonInteractionsRequest.builder().build()); + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListCourseLessonInteractionsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture>> list( + ListCourseLessonInteractionsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture>> list( + ListCourseLessonInteractionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lesson_interactions"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getLessonId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "lesson_id", request.getLessonId().get(), false); + } + if (request.getCourseId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "course_id", request.getCourseId().get(), false); + } + if (request.getCompleted().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "completed", request.getCompleted().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCourseLessonInteractionsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListCourseLessonInteractionsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListCourseLessonInteractionsRequest nextRequest = ListCourseLessonInteractionsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveCourseLessonInteractionsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCourseLessonInteractionsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveCourseLessonInteractionsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveCourseLessonInteractionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lesson_interactions") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseLessonInteraction.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/courselessoninteractions/CourseLessonInteractionsClient.java b/src/main/java/com/whop/api/resources/courselessoninteractions/CourseLessonInteractionsClient.java new file mode 100644 index 00000000..f77b534b --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessoninteractions/CourseLessonInteractionsClient.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessoninteractions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.courselessoninteractions.requests.ListCourseLessonInteractionsRequest; +import com.whop.api.resources.courselessoninteractions.requests.RetrieveCourseLessonInteractionsRequest; +import com.whop.api.types.CourseLessonInteraction; +import com.whop.api.types.CourseLessonInteractionListItem; + +public class CourseLessonInteractionsClient { + protected final ClientOptions clientOptions; + + private final RawCourseLessonInteractionsClient rawClient; + + public CourseLessonInteractionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawCourseLessonInteractionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawCourseLessonInteractionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public SyncPagingIterable list(ListCourseLessonInteractionsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public SyncPagingIterable list( + ListCourseLessonInteractionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CourseLessonInteraction retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CourseLessonInteraction retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CourseLessonInteraction retrieve(String id, RetrieveCourseLessonInteractionsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CourseLessonInteraction retrieve( + String id, RetrieveCourseLessonInteractionsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/courselessoninteractions/RawCourseLessonInteractionsClient.java b/src/main/java/com/whop/api/resources/courselessoninteractions/RawCourseLessonInteractionsClient.java new file mode 100644 index 00000000..26ad9d6c --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessoninteractions/RawCourseLessonInteractionsClient.java @@ -0,0 +1,303 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessoninteractions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.courselessoninteractions.requests.ListCourseLessonInteractionsRequest; +import com.whop.api.resources.courselessoninteractions.requests.RetrieveCourseLessonInteractionsRequest; +import com.whop.api.resources.courselessoninteractions.types.ListCourseLessonInteractionsResponse; +import com.whop.api.types.CourseLessonInteraction; +import com.whop.api.types.CourseLessonInteractionListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawCourseLessonInteractionsClient { + protected final ClientOptions clientOptions; + + public RawCourseLessonInteractionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public WhopApiHttpResponse> list() { + return list(ListCourseLessonInteractionsRequest.builder().build()); + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public WhopApiHttpResponse> list( + RequestOptions requestOptions) { + return list(ListCourseLessonInteractionsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListCourseLessonInteractionsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of lesson interactions, filtered by lesson, course, user, or completion status. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListCourseLessonInteractionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lesson_interactions"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getLessonId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "lesson_id", request.getLessonId().get(), false); + } + if (request.getCourseId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "course_id", request.getCourseId().get(), false); + } + if (request.getCompleted().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "completed", request.getCompleted().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCourseLessonInteractionsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListCourseLessonInteractionsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListCourseLessonInteractionsRequest nextRequest = ListCourseLessonInteractionsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveCourseLessonInteractionsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCourseLessonInteractionsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveCourseLessonInteractionsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing course lesson interaction. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveCourseLessonInteractionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lesson_interactions") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseLessonInteraction.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessoninteractions/requests/ListCourseLessonInteractionsRequest.java b/src/main/java/com/whop/api/resources/courselessoninteractions/requests/ListCourseLessonInteractionsRequest.java new file mode 100644 index 00000000..d948462b --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessoninteractions/requests/ListCourseLessonInteractionsRequest.java @@ -0,0 +1,333 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessoninteractions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCourseLessonInteractionsRequest.Builder.class) +public final class ListCourseLessonInteractionsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Optional userId; + + private final Optional lessonId; + + private final Optional courseId; + + private final Optional completed; + + private final Map additionalProperties; + + private ListCourseLessonInteractionsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + Optional userId, + Optional lessonId, + Optional courseId, + Optional completed, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.userId = userId; + this.lessonId = lessonId; + this.courseId = courseId; + this.completed = completed; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the user to filter lesson interactions for. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + /** + * @return The unique identifier of the lesson to filter interactions for. + */ + @JsonProperty("lesson_id") + public Optional getLessonId() { + return lessonId; + } + + /** + * @return The unique identifier of the course to filter interactions for. + */ + @JsonProperty("course_id") + public Optional getCourseId() { + return courseId; + } + + /** + * @return Whether to filter for completed or in-progress lesson interactions. + */ + @JsonProperty("completed") + public Optional getCompleted() { + return completed; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCourseLessonInteractionsRequest + && equalTo((ListCourseLessonInteractionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCourseLessonInteractionsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && userId.equals(other.userId) + && lessonId.equals(other.lessonId) + && courseId.equals(other.courseId) + && completed.equals(other.completed); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.after, + this.before, + this.first, + this.last, + this.userId, + this.lessonId, + this.courseId, + this.completed); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional lessonId = Optional.empty(); + + private Optional courseId = Optional.empty(); + + private Optional completed = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListCourseLessonInteractionsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + userId(other.getUserId()); + lessonId(other.getLessonId()); + courseId(other.getCourseId()); + completed(other.getCompleted()); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The unique identifier of the user to filter lesson interactions for.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

The unique identifier of the lesson to filter interactions for.

+ */ + @JsonSetter(value = "lesson_id", nulls = Nulls.SKIP) + public Builder lessonId(Optional lessonId) { + this.lessonId = lessonId; + return this; + } + + public Builder lessonId(String lessonId) { + this.lessonId = Optional.ofNullable(lessonId); + return this; + } + + /** + *

The unique identifier of the course to filter interactions for.

+ */ + @JsonSetter(value = "course_id", nulls = Nulls.SKIP) + public Builder courseId(Optional courseId) { + this.courseId = courseId; + return this; + } + + public Builder courseId(String courseId) { + this.courseId = Optional.ofNullable(courseId); + return this; + } + + /** + *

Whether to filter for completed or in-progress lesson interactions.

+ */ + @JsonSetter(value = "completed", nulls = Nulls.SKIP) + public Builder completed(Optional completed) { + this.completed = completed; + return this; + } + + public Builder completed(Boolean completed) { + this.completed = Optional.ofNullable(completed); + return this; + } + + public ListCourseLessonInteractionsRequest build() { + return new ListCourseLessonInteractionsRequest( + after, before, first, last, userId, lessonId, courseId, completed, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessoninteractions/requests/RetrieveCourseLessonInteractionsRequest.java b/src/main/java/com/whop/api/resources/courselessoninteractions/requests/RetrieveCourseLessonInteractionsRequest.java new file mode 100644 index 00000000..8091708d --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessoninteractions/requests/RetrieveCourseLessonInteractionsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessoninteractions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCourseLessonInteractionsRequest.Builder.class) +public final class RetrieveCourseLessonInteractionsRequest { + private final Map additionalProperties; + + private RetrieveCourseLessonInteractionsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCourseLessonInteractionsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveCourseLessonInteractionsRequest other) { + return this; + } + + public RetrieveCourseLessonInteractionsRequest build() { + return new RetrieveCourseLessonInteractionsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessoninteractions/types/ListCourseLessonInteractionsResponse.java b/src/main/java/com/whop/api/resources/courselessoninteractions/types/ListCourseLessonInteractionsResponse.java new file mode 100644 index 00000000..7809dd4d --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessoninteractions/types/ListCourseLessonInteractionsResponse.java @@ -0,0 +1,194 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessoninteractions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CourseLessonInteractionListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCourseLessonInteractionsResponse.Builder.class) +public final class ListCourseLessonInteractionsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListCourseLessonInteractionsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCourseLessonInteractionsResponse + && equalTo((ListCourseLessonInteractionsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCourseLessonInteractionsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListCourseLessonInteractionsResponse other); + } + + public interface _FinalStage { + ListCourseLessonInteractionsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(CourseLessonInteractionListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCourseLessonInteractionsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(CourseLessonInteractionListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListCourseLessonInteractionsResponse build() { + return new ListCourseLessonInteractionsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessoninteractions/types/PostCourseLessonInteractionCompletedPayload.java b/src/main/java/com/whop/api/resources/courselessoninteractions/types/PostCourseLessonInteractionCompletedPayload.java new file mode 100644 index 00000000..7df29478 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessoninteractions/types/PostCourseLessonInteractionCompletedPayload.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessoninteractions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CourseLessonInteraction; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostCourseLessonInteractionCompletedPayload.Builder.class) +public final class PostCourseLessonInteractionCompletedPayload { + private final Optional accountId; + + private final PostCourseLessonInteractionCompletedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final CourseLessonInteraction data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostCourseLessonInteractionCompletedPayloadType type; + + private final Map additionalProperties; + + private PostCourseLessonInteractionCompletedPayload( + Optional accountId, + PostCourseLessonInteractionCompletedPayloadApiVersion apiVersion, + Optional apiVersionDate, + CourseLessonInteraction data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostCourseLessonInteractionCompletedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostCourseLessonInteractionCompletedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public CourseLessonInteraction getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostCourseLessonInteractionCompletedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostCourseLessonInteractionCompletedPayload + && equalTo((PostCourseLessonInteractionCompletedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostCourseLessonInteractionCompletedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostCourseLessonInteractionCompletedPayloadApiVersion apiVersion); + + Builder from(PostCourseLessonInteractionCompletedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull CourseLessonInteraction data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostCourseLessonInteractionCompletedPayloadType type); + } + + public interface _FinalStage { + PostCourseLessonInteractionCompletedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostCourseLessonInteractionCompletedPayloadApiVersion apiVersion; + + private CourseLessonInteraction data; + + private String id; + + private OffsetDateTime timestamp; + + private PostCourseLessonInteractionCompletedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostCourseLessonInteractionCompletedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostCourseLessonInteractionCompletedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull CourseLessonInteraction data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostCourseLessonInteractionCompletedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostCourseLessonInteractionCompletedPayload build() { + return new PostCourseLessonInteractionCompletedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessoninteractions/types/PostCourseLessonInteractionCompletedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/courselessoninteractions/types/PostCourseLessonInteractionCompletedPayloadApiVersion.java new file mode 100644 index 00000000..90814a45 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessoninteractions/types/PostCourseLessonInteractionCompletedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessoninteractions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCourseLessonInteractionCompletedPayloadApiVersion { + public static final PostCourseLessonInteractionCompletedPayloadApiVersion V1 = + new PostCourseLessonInteractionCompletedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostCourseLessonInteractionCompletedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCourseLessonInteractionCompletedPayloadApiVersion + && this.string.equals(((PostCourseLessonInteractionCompletedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCourseLessonInteractionCompletedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostCourseLessonInteractionCompletedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/courselessoninteractions/types/PostCourseLessonInteractionCompletedPayloadType.java b/src/main/java/com/whop/api/resources/courselessoninteractions/types/PostCourseLessonInteractionCompletedPayloadType.java new file mode 100644 index 00000000..a00f49bf --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessoninteractions/types/PostCourseLessonInteractionCompletedPayloadType.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessoninteractions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostCourseLessonInteractionCompletedPayloadType { + public static final PostCourseLessonInteractionCompletedPayloadType COURSE_LESSON_INTERACTION_COMPLETED = + new PostCourseLessonInteractionCompletedPayloadType( + Value.COURSE_LESSON_INTERACTION_COMPLETED, "course_lesson_interaction.completed"); + + private final Value value; + + private final String string; + + PostCourseLessonInteractionCompletedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostCourseLessonInteractionCompletedPayloadType + && this.string.equals(((PostCourseLessonInteractionCompletedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case COURSE_LESSON_INTERACTION_COMPLETED: + return visitor.visitCourseLessonInteractionCompleted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostCourseLessonInteractionCompletedPayloadType valueOf(String value) { + switch (value) { + case "course_lesson_interaction.completed": + return COURSE_LESSON_INTERACTION_COMPLETED; + default: + return new PostCourseLessonInteractionCompletedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + COURSE_LESSON_INTERACTION_COMPLETED, + + UNKNOWN + } + + public interface Visitor { + T visitCourseLessonInteractionCompleted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/AsyncCourseLessonsClient.java b/src/main/java/com/whop/api/resources/courselessons/AsyncCourseLessonsClient.java new file mode 100644 index 00000000..d5b2cb9d --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/AsyncCourseLessonsClient.java @@ -0,0 +1,316 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.courselessons.requests.CreateCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.DeleteCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.ListCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.MarkAsCompletedCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.RetrieveCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.StartCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.SubmitAssessmentCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.UpdateCourseLessonsRequest; +import com.whop.api.resources.courselessons.types.SubmitAssessmentCourseLessonsResponse; +import com.whop.api.types.CourseLesson; +import com.whop.api.types.CourseLessonListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncCourseLessonsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawCourseLessonsClient rawClient; + + public AsyncCourseLessonsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawCourseLessonsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawCourseLessonsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> list(ListCourseLessonsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> list( + ListCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create a new lesson within a course chapter. Lessons can contain video, text, or assessment content. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture create(CreateCourseLessonsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create a new lesson within a course chapter. Lessons can contain video, text, or assessment content. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture create(CreateCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveCourseLessonsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture delete(String id, DeleteCourseLessonsRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture delete( + String id, DeleteCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture update(String id, UpdateCourseLessonsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture update( + String id, UpdateCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public CompletableFuture markAsCompleted(String lessonId) { + return this.rawClient.markAsCompleted(lessonId).thenApply(response -> response.body()); + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public CompletableFuture markAsCompleted(String lessonId, RequestOptions requestOptions) { + return this.rawClient.markAsCompleted(lessonId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public CompletableFuture markAsCompleted(String lessonId, MarkAsCompletedCourseLessonsRequest request) { + return this.rawClient.markAsCompleted(lessonId, request).thenApply(response -> response.body()); + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public CompletableFuture markAsCompleted( + String lessonId, MarkAsCompletedCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient.markAsCompleted(lessonId, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public CompletableFuture start(String lessonId) { + return this.rawClient.start(lessonId).thenApply(response -> response.body()); + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public CompletableFuture start(String lessonId, RequestOptions requestOptions) { + return this.rawClient.start(lessonId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public CompletableFuture start(String lessonId, StartCourseLessonsRequest request) { + return this.rawClient.start(lessonId, request).thenApply(response -> response.body()); + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public CompletableFuture start( + String lessonId, StartCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient.start(lessonId, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Submit answers for a quiz or knowledge check lesson and receive a graded result. + */ + public CompletableFuture submitAssessment( + String lessonId, SubmitAssessmentCourseLessonsRequest request) { + return this.rawClient.submitAssessment(lessonId, request).thenApply(response -> response.body()); + } + + /** + * Submit answers for a quiz or knowledge check lesson and receive a graded result. + */ + public CompletableFuture submitAssessment( + String lessonId, SubmitAssessmentCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient + .submitAssessment(lessonId, request, requestOptions) + .thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/AsyncRawCourseLessonsClient.java b/src/main/java/com/whop/api/resources/courselessons/AsyncRawCourseLessonsClient.java new file mode 100644 index 00000000..545ed1c1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/AsyncRawCourseLessonsClient.java @@ -0,0 +1,1093 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.courselessons.requests.CreateCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.DeleteCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.ListCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.MarkAsCompletedCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.RetrieveCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.StartCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.SubmitAssessmentCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.UpdateCourseLessonsRequest; +import com.whop.api.resources.courselessons.types.ListCourseLessonsResponse; +import com.whop.api.resources.courselessons.types.SubmitAssessmentCourseLessonsResponse; +import com.whop.api.types.CourseLesson; +import com.whop.api.types.CourseLessonListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawCourseLessonsClient { + protected final ClientOptions clientOptions; + + public AsyncRawCourseLessonsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture>> list() { + return list(ListCourseLessonsRequest.builder().build()); + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListCourseLessonsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture>> list( + ListCourseLessonsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture>> list( + ListCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getCourseId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "course_id", request.getCourseId().get(), false); + } + if (request.getChapterId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "chapter_id", request.getChapterId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCourseLessonsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListCourseLessonsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListCourseLessonsRequest nextRequest = ListCourseLessonsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create a new lesson within a course chapter. Lessons can contain video, text, or assessment content. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> create(CreateCourseLessonsRequest request) { + return create(request, null); + } + + /** + * Create a new lesson within a course chapter. Lessons can contain video, text, or assessment content. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> create( + CreateCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseLesson.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveCourseLessonsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCourseLessonsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveCourseLessonsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseLesson.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteCourseLessonsRequest.builder().build()); + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteCourseLessonsRequest.builder().build(), requestOptions); + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> delete(String id, DeleteCourseLessonsRequest request) { + return delete(id, request, null); + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> delete( + String id, DeleteCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> update(String id) { + return update(id, UpdateCourseLessonsRequest.builder().build()); + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateCourseLessonsRequest.builder().build(), requestOptions); + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> update(String id, UpdateCourseLessonsRequest request) { + return update(id, request, null); + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> update( + String id, UpdateCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseLesson.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public CompletableFuture> markAsCompleted(String lessonId) { + return markAsCompleted( + lessonId, MarkAsCompletedCourseLessonsRequest.builder().build()); + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public CompletableFuture> markAsCompleted( + String lessonId, RequestOptions requestOptions) { + return markAsCompleted( + lessonId, MarkAsCompletedCourseLessonsRequest.builder().build(), requestOptions); + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public CompletableFuture> markAsCompleted( + String lessonId, MarkAsCompletedCourseLessonsRequest request) { + return markAsCompleted(lessonId, request, null); + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public CompletableFuture> markAsCompleted( + String lessonId, MarkAsCompletedCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons") + .addPathSegment(lessonId) + .addPathSegments("mark_as_completed"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public CompletableFuture> start(String lessonId) { + return start(lessonId, StartCourseLessonsRequest.builder().build()); + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public CompletableFuture> start(String lessonId, RequestOptions requestOptions) { + return start(lessonId, StartCourseLessonsRequest.builder().build(), requestOptions); + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public CompletableFuture> start(String lessonId, StartCourseLessonsRequest request) { + return start(lessonId, request, null); + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public CompletableFuture> start( + String lessonId, StartCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons") + .addPathSegment(lessonId) + .addPathSegments("start"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Submit answers for a quiz or knowledge check lesson and receive a graded result. + */ + public CompletableFuture> submitAssessment( + String lessonId, SubmitAssessmentCourseLessonsRequest request) { + return submitAssessment(lessonId, request, null); + } + + /** + * Submit answers for a quiz or knowledge check lesson and receive a graded result. + */ + public CompletableFuture> submitAssessment( + String lessonId, SubmitAssessmentCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons") + .addPathSegment(lessonId) + .addPathSegments("submit_assessment"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, SubmitAssessmentCourseLessonsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/CourseLessonsClient.java b/src/main/java/com/whop/api/resources/courselessons/CourseLessonsClient.java new file mode 100644 index 00000000..bb3feed5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/CourseLessonsClient.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.courselessons.requests.CreateCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.DeleteCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.ListCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.MarkAsCompletedCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.RetrieveCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.StartCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.SubmitAssessmentCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.UpdateCourseLessonsRequest; +import com.whop.api.resources.courselessons.types.SubmitAssessmentCourseLessonsResponse; +import com.whop.api.types.CourseLesson; +import com.whop.api.types.CourseLessonListItem; + +public class CourseLessonsClient { + protected final ClientOptions clientOptions; + + private final RawCourseLessonsClient rawClient; + + public CourseLessonsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawCourseLessonsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawCourseLessonsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public SyncPagingIterable list(ListCourseLessonsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public SyncPagingIterable list( + ListCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Create a new lesson within a course chapter. Lessons can contain video, text, or assessment content. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CourseLesson create(CreateCourseLessonsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Create a new lesson within a course chapter. Lessons can contain video, text, or assessment content. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CourseLesson create(CreateCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CourseLesson retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CourseLesson retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CourseLesson retrieve(String id, RetrieveCourseLessonsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CourseLesson retrieve(String id, RetrieveCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public boolean delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public boolean delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public boolean delete(String id, DeleteCourseLessonsRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public boolean delete(String id, DeleteCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CourseLesson update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CourseLesson update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CourseLesson update(String id, UpdateCourseLessonsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CourseLesson update(String id, UpdateCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public boolean markAsCompleted(String lessonId) { + return this.rawClient.markAsCompleted(lessonId).body(); + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public boolean markAsCompleted(String lessonId, RequestOptions requestOptions) { + return this.rawClient.markAsCompleted(lessonId, requestOptions).body(); + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public boolean markAsCompleted(String lessonId, MarkAsCompletedCourseLessonsRequest request) { + return this.rawClient.markAsCompleted(lessonId, request).body(); + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public boolean markAsCompleted( + String lessonId, MarkAsCompletedCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient.markAsCompleted(lessonId, request, requestOptions).body(); + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public boolean start(String lessonId) { + return this.rawClient.start(lessonId).body(); + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public boolean start(String lessonId, RequestOptions requestOptions) { + return this.rawClient.start(lessonId, requestOptions).body(); + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public boolean start(String lessonId, StartCourseLessonsRequest request) { + return this.rawClient.start(lessonId, request).body(); + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public boolean start(String lessonId, StartCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient.start(lessonId, request, requestOptions).body(); + } + + /** + * Submit answers for a quiz or knowledge check lesson and receive a graded result. + */ + public SubmitAssessmentCourseLessonsResponse submitAssessment( + String lessonId, SubmitAssessmentCourseLessonsRequest request) { + return this.rawClient.submitAssessment(lessonId, request).body(); + } + + /** + * Submit answers for a quiz or knowledge check lesson and receive a graded result. + */ + public SubmitAssessmentCourseLessonsResponse submitAssessment( + String lessonId, SubmitAssessmentCourseLessonsRequest request, RequestOptions requestOptions) { + return this.rawClient + .submitAssessment(lessonId, request, requestOptions) + .body(); + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/RawCourseLessonsClient.java b/src/main/java/com/whop/api/resources/courselessons/RawCourseLessonsClient.java new file mode 100644 index 00000000..ea8cf849 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/RawCourseLessonsClient.java @@ -0,0 +1,856 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.courselessons.requests.CreateCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.DeleteCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.ListCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.MarkAsCompletedCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.RetrieveCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.StartCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.SubmitAssessmentCourseLessonsRequest; +import com.whop.api.resources.courselessons.requests.UpdateCourseLessonsRequest; +import com.whop.api.resources.courselessons.types.ListCourseLessonsResponse; +import com.whop.api.resources.courselessons.types.SubmitAssessmentCourseLessonsResponse; +import com.whop.api.types.CourseLesson; +import com.whop.api.types.CourseLessonListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawCourseLessonsClient { + protected final ClientOptions clientOptions; + + public RawCourseLessonsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse> list() { + return list(ListCourseLessonsRequest.builder().build()); + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListCourseLessonsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListCourseLessonsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of lessons within a course or chapter, ordered by position. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getCourseId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "course_id", request.getCourseId().get(), false); + } + if (request.getChapterId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "chapter_id", request.getChapterId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCourseLessonsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCourseLessonsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListCourseLessonsRequest nextRequest = ListCourseLessonsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Create a new lesson within a course chapter. Lessons can contain video, text, or assessment content. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse create(CreateCourseLessonsRequest request) { + return create(request, null); + } + + /** + * Create a new lesson within a course chapter. Lessons can contain video, text, or assessment content. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse create(CreateCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseLesson.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveCourseLessonsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCourseLessonsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveCourseLessonsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing course lesson. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseLesson.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteCourseLessonsRequest.builder().build()); + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteCourseLessonsRequest.builder().build(), requestOptions); + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id, DeleteCourseLessonsRequest request) { + return delete(id, request, null); + } + + /** + * Permanently delete a lesson and remove it from its chapter. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse delete( + String id, DeleteCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateCourseLessonsRequest.builder().build()); + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateCourseLessonsRequest.builder().build(), requestOptions); + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateCourseLessonsRequest request) { + return update(id, request, null); + } + + /** + * Update a lesson's content, type, visibility, assessment questions, or media attachments. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse update( + String id, UpdateCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseLesson.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public WhopApiHttpResponse markAsCompleted(String lessonId) { + return markAsCompleted( + lessonId, MarkAsCompletedCourseLessonsRequest.builder().build()); + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public WhopApiHttpResponse markAsCompleted(String lessonId, RequestOptions requestOptions) { + return markAsCompleted( + lessonId, MarkAsCompletedCourseLessonsRequest.builder().build(), requestOptions); + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public WhopApiHttpResponse markAsCompleted(String lessonId, MarkAsCompletedCourseLessonsRequest request) { + return markAsCompleted(lessonId, request, null); + } + + /** + * Mark a lesson as completed for the current user after they finish the content. + */ + public WhopApiHttpResponse markAsCompleted( + String lessonId, MarkAsCompletedCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons") + .addPathSegment(lessonId) + .addPathSegments("mark_as_completed"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public WhopApiHttpResponse start(String lessonId) { + return start(lessonId, StartCourseLessonsRequest.builder().build()); + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public WhopApiHttpResponse start(String lessonId, RequestOptions requestOptions) { + return start(lessonId, StartCourseLessonsRequest.builder().build(), requestOptions); + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public WhopApiHttpResponse start(String lessonId, StartCourseLessonsRequest request) { + return start(lessonId, request, null); + } + + /** + * Record that the current user has started viewing a lesson, creating progress tracking records. + */ + public WhopApiHttpResponse start( + String lessonId, StartCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons") + .addPathSegment(lessonId) + .addPathSegments("start"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Submit answers for a quiz or knowledge check lesson and receive a graded result. + */ + public WhopApiHttpResponse submitAssessment( + String lessonId, SubmitAssessmentCourseLessonsRequest request) { + return submitAssessment(lessonId, request, null); + } + + /** + * Submit answers for a quiz or knowledge check lesson and receive a graded result. + */ + public WhopApiHttpResponse submitAssessment( + String lessonId, SubmitAssessmentCourseLessonsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_lessons") + .addPathSegment(lessonId) + .addPathSegments("submit_assessment"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, SubmitAssessmentCourseLessonsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/requests/CreateCourseLessonsRequest.java b/src/main/java/com/whop/api/resources/courselessons/requests/CreateCourseLessonsRequest.java new file mode 100644 index 00000000..f55f1de3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/requests/CreateCourseLessonsRequest.java @@ -0,0 +1,611 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.courselessons.types.CreateCourseLessonsRequestThumbnail; +import com.whop.api.types.EmbedTypes; +import com.whop.api.types.LessonTypes; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCourseLessonsRequest.Builder.class) +public final class CreateCourseLessonsRequest { + private final String chapterId; + + private final Optional content; + + private final Optional daysFromCourseStartUntilUnlock; + + private final Optional embedId; + + private final Optional embedType; + + private final LessonTypes lessonType; + + private final Optional thumbnail; + + private final Optional title; + + private final Map additionalProperties; + + private CreateCourseLessonsRequest( + String chapterId, + Optional content, + Optional daysFromCourseStartUntilUnlock, + Optional embedId, + Optional embedType, + LessonTypes lessonType, + Optional thumbnail, + Optional title, + Map additionalProperties) { + this.chapterId = chapterId; + this.content = content; + this.daysFromCourseStartUntilUnlock = daysFromCourseStartUntilUnlock; + this.embedId = embedId; + this.embedType = embedType; + this.lessonType = lessonType; + this.thumbnail = thumbnail; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the chapter to create the lesson in (e.g., "chap_XXXXX"). + */ + @JsonProperty("chapter_id") + public String getChapterId() { + return chapterId; + } + + /** + * @return The Markdown content body of the lesson. + */ + @JsonIgnore + public Optional getContent() { + if (content == null) { + return Optional.empty(); + } + return content; + } + + /** + * @return The number of days after a student starts the course before this lesson becomes accessible. + */ + @JsonIgnore + public Optional getDaysFromCourseStartUntilUnlock() { + if (daysFromCourseStartUntilUnlock == null) { + return Optional.empty(); + } + return daysFromCourseStartUntilUnlock; + } + + /** + * @return The external video identifier for embedded content (e.g., a YouTube video ID or Loom share ID). + */ + @JsonIgnore + public Optional getEmbedId() { + if (embedId == null) { + return Optional.empty(); + } + return embedId; + } + + /** + * @return The type of video embed for this lesson, such as YouTube or Loom. + */ + @JsonIgnore + public Optional getEmbedType() { + if (embedType == null) { + return Optional.empty(); + } + return embedType; + } + + /** + * @return The content type of the lesson, such as video, text, quiz, or knowledge check. + */ + @JsonProperty("lesson_type") + public LessonTypes getLessonType() { + return lessonType; + } + + /** + * @return The thumbnail image for the lesson in PNG, JPEG, or GIF format. + */ + @JsonIgnore + public Optional getThumbnail() { + if (thumbnail == null) { + return Optional.empty(); + } + return thumbnail; + } + + /** + * @return The display title of the lesson (e.g., "Getting Started with APIs"). + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content") + private Optional _getContent() { + return content; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("days_from_course_start_until_unlock") + private Optional _getDaysFromCourseStartUntilUnlock() { + return daysFromCourseStartUntilUnlock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("embed_id") + private Optional _getEmbedId() { + return embedId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("embed_type") + private Optional _getEmbedType() { + return embedType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail") + private Optional _getThumbnail() { + return thumbnail; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCourseLessonsRequest && equalTo((CreateCourseLessonsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCourseLessonsRequest other) { + return chapterId.equals(other.chapterId) + && content.equals(other.content) + && daysFromCourseStartUntilUnlock.equals(other.daysFromCourseStartUntilUnlock) + && embedId.equals(other.embedId) + && embedType.equals(other.embedType) + && lessonType.equals(other.lessonType) + && thumbnail.equals(other.thumbnail) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.chapterId, + this.content, + this.daysFromCourseStartUntilUnlock, + this.embedId, + this.embedType, + this.lessonType, + this.thumbnail, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChapterIdStage builder() { + return new Builder(); + } + + public interface ChapterIdStage { + /** + *

The unique identifier of the chapter to create the lesson in (e.g., "chap_XXXXX").

+ */ + LessonTypeStage chapterId(@NotNull String chapterId); + + Builder from(CreateCourseLessonsRequest other); + } + + public interface LessonTypeStage { + /** + *

The content type of the lesson, such as video, text, quiz, or knowledge check.

+ */ + _FinalStage lessonType(@NotNull LessonTypes lessonType); + } + + public interface _FinalStage { + CreateCourseLessonsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The Markdown content body of the lesson.

+ */ + _FinalStage content(Optional content); + + _FinalStage content(String content); + + _FinalStage content(Nullable content); + + /** + *

The number of days after a student starts the course before this lesson becomes accessible.

+ */ + _FinalStage daysFromCourseStartUntilUnlock(Optional daysFromCourseStartUntilUnlock); + + _FinalStage daysFromCourseStartUntilUnlock(Integer daysFromCourseStartUntilUnlock); + + _FinalStage daysFromCourseStartUntilUnlock(Nullable daysFromCourseStartUntilUnlock); + + /** + *

The external video identifier for embedded content (e.g., a YouTube video ID or Loom share ID).

+ */ + _FinalStage embedId(Optional embedId); + + _FinalStage embedId(String embedId); + + _FinalStage embedId(Nullable embedId); + + /** + *

The type of video embed for this lesson, such as YouTube or Loom.

+ */ + _FinalStage embedType(Optional embedType); + + _FinalStage embedType(EmbedTypes embedType); + + _FinalStage embedType(Nullable embedType); + + /** + *

The thumbnail image for the lesson in PNG, JPEG, or GIF format.

+ */ + _FinalStage thumbnail(Optional thumbnail); + + _FinalStage thumbnail(CreateCourseLessonsRequestThumbnail thumbnail); + + _FinalStage thumbnail(Nullable thumbnail); + + /** + *

The display title of the lesson (e.g., "Getting Started with APIs").

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ChapterIdStage, LessonTypeStage, _FinalStage { + private String chapterId; + + private LessonTypes lessonType; + + private Optional title = Optional.empty(); + + private Optional thumbnail = Optional.empty(); + + private Optional embedType = Optional.empty(); + + private Optional embedId = Optional.empty(); + + private Optional daysFromCourseStartUntilUnlock = Optional.empty(); + + private Optional content = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCourseLessonsRequest other) { + chapterId(other.getChapterId()); + content(other.getContent()); + daysFromCourseStartUntilUnlock(other.getDaysFromCourseStartUntilUnlock()); + embedId(other.getEmbedId()); + embedType(other.getEmbedType()); + lessonType(other.getLessonType()); + thumbnail(other.getThumbnail()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier of the chapter to create the lesson in (e.g., "chap_XXXXX").

+ *

The unique identifier of the chapter to create the lesson in (e.g., "chap_XXXXX").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("chapter_id") + public LessonTypeStage chapterId(@NotNull String chapterId) { + this.chapterId = Objects.requireNonNull(chapterId, "chapterId must not be null"); + return this; + } + + /** + *

The content type of the lesson, such as video, text, quiz, or knowledge check.

+ *

The content type of the lesson, such as video, text, quiz, or knowledge check.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("lesson_type") + public _FinalStage lessonType(@NotNull LessonTypes lessonType) { + this.lessonType = Objects.requireNonNull(lessonType, "lessonType must not be null"); + return this; + } + + /** + *

The display title of the lesson (e.g., "Getting Started with APIs").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

The display title of the lesson (e.g., "Getting Started with APIs").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The display title of the lesson (e.g., "Getting Started with APIs").

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

The thumbnail image for the lesson in PNG, JPEG, or GIF format.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnail(Nullable thumbnail) { + if (thumbnail.isNull()) { + this.thumbnail = null; + } else if (thumbnail.isEmpty()) { + this.thumbnail = Optional.empty(); + } else { + this.thumbnail = Optional.of(thumbnail.get()); + } + return this; + } + + /** + *

The thumbnail image for the lesson in PNG, JPEG, or GIF format.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnail(CreateCourseLessonsRequestThumbnail thumbnail) { + this.thumbnail = Optional.ofNullable(thumbnail); + return this; + } + + /** + *

The thumbnail image for the lesson in PNG, JPEG, or GIF format.

+ */ + @java.lang.Override + @JsonSetter(value = "thumbnail", nulls = Nulls.SKIP) + public _FinalStage thumbnail(Optional thumbnail) { + this.thumbnail = thumbnail; + return this; + } + + /** + *

The type of video embed for this lesson, such as YouTube or Loom.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage embedType(Nullable embedType) { + if (embedType.isNull()) { + this.embedType = null; + } else if (embedType.isEmpty()) { + this.embedType = Optional.empty(); + } else { + this.embedType = Optional.of(embedType.get()); + } + return this; + } + + /** + *

The type of video embed for this lesson, such as YouTube or Loom.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage embedType(EmbedTypes embedType) { + this.embedType = Optional.ofNullable(embedType); + return this; + } + + /** + *

The type of video embed for this lesson, such as YouTube or Loom.

+ */ + @java.lang.Override + @JsonSetter(value = "embed_type", nulls = Nulls.SKIP) + public _FinalStage embedType(Optional embedType) { + this.embedType = embedType; + return this; + } + + /** + *

The external video identifier for embedded content (e.g., a YouTube video ID or Loom share ID).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage embedId(Nullable embedId) { + if (embedId.isNull()) { + this.embedId = null; + } else if (embedId.isEmpty()) { + this.embedId = Optional.empty(); + } else { + this.embedId = Optional.of(embedId.get()); + } + return this; + } + + /** + *

The external video identifier for embedded content (e.g., a YouTube video ID or Loom share ID).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage embedId(String embedId) { + this.embedId = Optional.ofNullable(embedId); + return this; + } + + /** + *

The external video identifier for embedded content (e.g., a YouTube video ID or Loom share ID).

+ */ + @java.lang.Override + @JsonSetter(value = "embed_id", nulls = Nulls.SKIP) + public _FinalStage embedId(Optional embedId) { + this.embedId = embedId; + return this; + } + + /** + *

The number of days after a student starts the course before this lesson becomes accessible.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage daysFromCourseStartUntilUnlock(Nullable daysFromCourseStartUntilUnlock) { + if (daysFromCourseStartUntilUnlock.isNull()) { + this.daysFromCourseStartUntilUnlock = null; + } else if (daysFromCourseStartUntilUnlock.isEmpty()) { + this.daysFromCourseStartUntilUnlock = Optional.empty(); + } else { + this.daysFromCourseStartUntilUnlock = Optional.of(daysFromCourseStartUntilUnlock.get()); + } + return this; + } + + /** + *

The number of days after a student starts the course before this lesson becomes accessible.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage daysFromCourseStartUntilUnlock(Integer daysFromCourseStartUntilUnlock) { + this.daysFromCourseStartUntilUnlock = Optional.ofNullable(daysFromCourseStartUntilUnlock); + return this; + } + + /** + *

The number of days after a student starts the course before this lesson becomes accessible.

+ */ + @java.lang.Override + @JsonSetter(value = "days_from_course_start_until_unlock", nulls = Nulls.SKIP) + public _FinalStage daysFromCourseStartUntilUnlock(Optional daysFromCourseStartUntilUnlock) { + this.daysFromCourseStartUntilUnlock = daysFromCourseStartUntilUnlock; + return this; + } + + /** + *

The Markdown content body of the lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(Nullable content) { + if (content.isNull()) { + this.content = null; + } else if (content.isEmpty()) { + this.content = Optional.empty(); + } else { + this.content = Optional.of(content.get()); + } + return this; + } + + /** + *

The Markdown content body of the lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

The Markdown content body of the lesson.

+ */ + @java.lang.Override + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public _FinalStage content(Optional content) { + this.content = content; + return this; + } + + @java.lang.Override + public CreateCourseLessonsRequest build() { + return new CreateCourseLessonsRequest( + chapterId, + content, + daysFromCourseStartUntilUnlock, + embedId, + embedType, + lessonType, + thumbnail, + title, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/requests/DeleteCourseLessonsRequest.java b/src/main/java/com/whop/api/resources/courselessons/requests/DeleteCourseLessonsRequest.java new file mode 100644 index 00000000..ba179164 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/requests/DeleteCourseLessonsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteCourseLessonsRequest.Builder.class) +public final class DeleteCourseLessonsRequest { + private final Map additionalProperties; + + private DeleteCourseLessonsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteCourseLessonsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteCourseLessonsRequest other) { + return this; + } + + public DeleteCourseLessonsRequest build() { + return new DeleteCourseLessonsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/requests/ListCourseLessonsRequest.java b/src/main/java/com/whop/api/resources/courselessons/requests/ListCourseLessonsRequest.java new file mode 100644 index 00000000..39014e43 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/requests/ListCourseLessonsRequest.java @@ -0,0 +1,263 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCourseLessonsRequest.Builder.class) +public final class ListCourseLessonsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Optional courseId; + + private final Optional chapterId; + + private final Map additionalProperties; + + private ListCourseLessonsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + Optional courseId, + Optional chapterId, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.courseId = courseId; + this.chapterId = chapterId; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the course to return all lessons across all chapters. + */ + @JsonProperty("course_id") + public Optional getCourseId() { + return courseId; + } + + /** + * @return The unique identifier of a chapter to return only its lessons. + */ + @JsonProperty("chapter_id") + public Optional getChapterId() { + return chapterId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCourseLessonsRequest && equalTo((ListCourseLessonsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCourseLessonsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && courseId.equals(other.courseId) + && chapterId.equals(other.chapterId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last, this.courseId, this.chapterId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional courseId = Optional.empty(); + + private Optional chapterId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListCourseLessonsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + courseId(other.getCourseId()); + chapterId(other.getChapterId()); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The unique identifier of the course to return all lessons across all chapters.

+ */ + @JsonSetter(value = "course_id", nulls = Nulls.SKIP) + public Builder courseId(Optional courseId) { + this.courseId = courseId; + return this; + } + + public Builder courseId(String courseId) { + this.courseId = Optional.ofNullable(courseId); + return this; + } + + /** + *

The unique identifier of a chapter to return only its lessons.

+ */ + @JsonSetter(value = "chapter_id", nulls = Nulls.SKIP) + public Builder chapterId(Optional chapterId) { + this.chapterId = chapterId; + return this; + } + + public Builder chapterId(String chapterId) { + this.chapterId = Optional.ofNullable(chapterId); + return this; + } + + public ListCourseLessonsRequest build() { + return new ListCourseLessonsRequest(after, before, first, last, courseId, chapterId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/requests/MarkAsCompletedCourseLessonsRequest.java b/src/main/java/com/whop/api/resources/courselessons/requests/MarkAsCompletedCourseLessonsRequest.java new file mode 100644 index 00000000..fc2bea8c --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/requests/MarkAsCompletedCourseLessonsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MarkAsCompletedCourseLessonsRequest.Builder.class) +public final class MarkAsCompletedCourseLessonsRequest { + private final Map additionalProperties; + + private MarkAsCompletedCourseLessonsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MarkAsCompletedCourseLessonsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MarkAsCompletedCourseLessonsRequest other) { + return this; + } + + public MarkAsCompletedCourseLessonsRequest build() { + return new MarkAsCompletedCourseLessonsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/requests/RetrieveCourseLessonsRequest.java b/src/main/java/com/whop/api/resources/courselessons/requests/RetrieveCourseLessonsRequest.java new file mode 100644 index 00000000..b3c82d50 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/requests/RetrieveCourseLessonsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCourseLessonsRequest.Builder.class) +public final class RetrieveCourseLessonsRequest { + private final Map additionalProperties; + + private RetrieveCourseLessonsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCourseLessonsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveCourseLessonsRequest other) { + return this; + } + + public RetrieveCourseLessonsRequest build() { + return new RetrieveCourseLessonsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/requests/StartCourseLessonsRequest.java b/src/main/java/com/whop/api/resources/courselessons/requests/StartCourseLessonsRequest.java new file mode 100644 index 00000000..27c0b814 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/requests/StartCourseLessonsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = StartCourseLessonsRequest.Builder.class) +public final class StartCourseLessonsRequest { + private final Map additionalProperties; + + private StartCourseLessonsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StartCourseLessonsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(StartCourseLessonsRequest other) { + return this; + } + + public StartCourseLessonsRequest build() { + return new StartCourseLessonsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/requests/SubmitAssessmentCourseLessonsRequest.java b/src/main/java/com/whop/api/resources/courselessons/requests/SubmitAssessmentCourseLessonsRequest.java new file mode 100644 index 00000000..beb55acd --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/requests/SubmitAssessmentCourseLessonsRequest.java @@ -0,0 +1,125 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.courselessons.types.SubmitAssessmentCourseLessonsRequestAnswersItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SubmitAssessmentCourseLessonsRequest.Builder.class) +public final class SubmitAssessmentCourseLessonsRequest { + private final List answers; + + private final Map additionalProperties; + + private SubmitAssessmentCourseLessonsRequest( + List answers, Map additionalProperties) { + this.answers = answers; + this.additionalProperties = additionalProperties; + } + + /** + * @return The list of answers to submit for each assessment question. + */ + @JsonProperty("answers") + public List getAnswers() { + return answers; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SubmitAssessmentCourseLessonsRequest + && equalTo((SubmitAssessmentCourseLessonsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SubmitAssessmentCourseLessonsRequest other) { + return answers.equals(other.answers); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.answers); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List answers = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SubmitAssessmentCourseLessonsRequest other) { + answers(other.getAnswers()); + return this; + } + + /** + *

The list of answers to submit for each assessment question.

+ */ + @JsonSetter(value = "answers", nulls = Nulls.SKIP) + public Builder answers(List answers) { + this.answers.clear(); + if (answers != null) { + this.answers.addAll(answers); + } + return this; + } + + public Builder addAnswers(SubmitAssessmentCourseLessonsRequestAnswersItem answers) { + this.answers.add(answers); + return this; + } + + public Builder addAllAnswers(List answers) { + if (answers != null) { + this.answers.addAll(answers); + } + return this; + } + + public SubmitAssessmentCourseLessonsRequest build() { + return new SubmitAssessmentCourseLessonsRequest(answers, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/requests/UpdateCourseLessonsRequest.java b/src/main/java/com/whop/api/resources/courselessons/requests/UpdateCourseLessonsRequest.java new file mode 100644 index 00000000..8c01eee1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/requests/UpdateCourseLessonsRequest.java @@ -0,0 +1,832 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.courselessons.types.UpdateCourseLessonsRequestAssessmentCompletionRequirement; +import com.whop.api.resources.courselessons.types.UpdateCourseLessonsRequestAssessmentQuestionsItem; +import com.whop.api.resources.courselessons.types.UpdateCourseLessonsRequestAttachmentsItem; +import com.whop.api.resources.courselessons.types.UpdateCourseLessonsRequestMainPdf; +import com.whop.api.resources.courselessons.types.UpdateCourseLessonsRequestThumbnail; +import com.whop.api.types.EmbedTypes; +import com.whop.api.types.LessonTypes; +import com.whop.api.types.LessonVisibilities; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCourseLessonsRequest.Builder.class) +public final class UpdateCourseLessonsRequest { + private final Optional assessmentCompletionRequirement; + + private final Optional> assessmentQuestions; + + private final Optional> attachments; + + private final Optional content; + + private final Optional daysFromCourseStartUntilUnlock; + + private final Optional embedId; + + private final Optional embedType; + + private final Optional lessonType; + + private final Optional mainPdf; + + private final Optional maxAttempts; + + private final Optional muxAssetId; + + private final Optional thumbnail; + + private final Optional title; + + private final Optional visibility; + + private final Map additionalProperties; + + private UpdateCourseLessonsRequest( + Optional assessmentCompletionRequirement, + Optional> assessmentQuestions, + Optional> attachments, + Optional content, + Optional daysFromCourseStartUntilUnlock, + Optional embedId, + Optional embedType, + Optional lessonType, + Optional mainPdf, + Optional maxAttempts, + Optional muxAssetId, + Optional thumbnail, + Optional title, + Optional visibility, + Map additionalProperties) { + this.assessmentCompletionRequirement = assessmentCompletionRequirement; + this.assessmentQuestions = assessmentQuestions; + this.attachments = attachments; + this.content = content; + this.daysFromCourseStartUntilUnlock = daysFromCourseStartUntilUnlock; + this.embedId = embedId; + this.embedType = embedType; + this.lessonType = lessonType; + this.mainPdf = mainPdf; + this.maxAttempts = maxAttempts; + this.muxAssetId = muxAssetId; + this.thumbnail = thumbnail; + this.title = title; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return The passing criteria for quiz or knowledge check lessons, such as minimum grade or correct answers. + */ + @JsonIgnore + public Optional getAssessmentCompletionRequirement() { + if (assessmentCompletionRequirement == null) { + return Optional.empty(); + } + return assessmentCompletionRequirement; + } + + /** + * @return The full list of assessment questions for quiz or knowledge check lessons. Replaces all existing questions. + */ + @JsonIgnore + public Optional> getAssessmentQuestions() { + if (assessmentQuestions == null) { + return Optional.empty(); + } + return assessmentQuestions; + } + + /** + * @return File attachments for the lesson such as PDFs or documents. Replaces all existing attachments. + */ + @JsonIgnore + public Optional> getAttachments() { + if (attachments == null) { + return Optional.empty(); + } + return attachments; + } + + /** + * @return The Markdown content body of the lesson. + */ + @JsonIgnore + public Optional getContent() { + if (content == null) { + return Optional.empty(); + } + return content; + } + + /** + * @return The number of days after a student starts the course before this lesson becomes accessible. + */ + @JsonIgnore + public Optional getDaysFromCourseStartUntilUnlock() { + if (daysFromCourseStartUntilUnlock == null) { + return Optional.empty(); + } + return daysFromCourseStartUntilUnlock; + } + + /** + * @return The external video identifier for embedded content (e.g., a YouTube video ID or Loom share ID). + */ + @JsonIgnore + public Optional getEmbedId() { + if (embedId == null) { + return Optional.empty(); + } + return embedId; + } + + /** + * @return The type of video embed for this lesson, such as YouTube or Loom. + */ + @JsonIgnore + public Optional getEmbedType() { + if (embedType == null) { + return Optional.empty(); + } + return embedType; + } + + /** + * @return The content type of the lesson, such as video, text, quiz, or knowledge check. + */ + @JsonIgnore + public Optional getLessonType() { + if (lessonType == null) { + return Optional.empty(); + } + return lessonType; + } + + /** + * @return The primary PDF document attached to this lesson for student reference. + */ + @JsonIgnore + public Optional getMainPdf() { + if (mainPdf == null) { + return Optional.empty(); + } + return mainPdf; + } + + /** + * @return The maximum number of attempts a student is allowed for assessment lessons. + */ + @JsonIgnore + public Optional getMaxAttempts() { + if (maxAttempts == null) { + return Optional.empty(); + } + return maxAttempts; + } + + /** + * @return The identifier of a Mux video asset to attach to this lesson (e.g., "mux_XXXXX"). + */ + @JsonIgnore + public Optional getMuxAssetId() { + if (muxAssetId == null) { + return Optional.empty(); + } + return muxAssetId; + } + + /** + * @return The thumbnail image for the lesson in PNG, JPEG, or GIF format. + */ + @JsonIgnore + public Optional getThumbnail() { + if (thumbnail == null) { + return Optional.empty(); + } + return thumbnail; + } + + /** + * @return The display title of the lesson (e.g., "Getting Started with APIs"). + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return Controls whether this lesson is visible to students or hidden as a draft. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("assessment_completion_requirement") + private Optional _getAssessmentCompletionRequirement() { + return assessmentCompletionRequirement; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("assessment_questions") + private Optional> _getAssessmentQuestions() { + return assessmentQuestions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("attachments") + private Optional> _getAttachments() { + return attachments; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content") + private Optional _getContent() { + return content; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("days_from_course_start_until_unlock") + private Optional _getDaysFromCourseStartUntilUnlock() { + return daysFromCourseStartUntilUnlock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("embed_id") + private Optional _getEmbedId() { + return embedId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("embed_type") + private Optional _getEmbedType() { + return embedType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("lesson_type") + private Optional _getLessonType() { + return lessonType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("main_pdf") + private Optional _getMainPdf() { + return mainPdf; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("max_attempts") + private Optional _getMaxAttempts() { + return maxAttempts; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("mux_asset_id") + private Optional _getMuxAssetId() { + return muxAssetId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail") + private Optional _getThumbnail() { + return thumbnail; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCourseLessonsRequest && equalTo((UpdateCourseLessonsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCourseLessonsRequest other) { + return assessmentCompletionRequirement.equals(other.assessmentCompletionRequirement) + && assessmentQuestions.equals(other.assessmentQuestions) + && attachments.equals(other.attachments) + && content.equals(other.content) + && daysFromCourseStartUntilUnlock.equals(other.daysFromCourseStartUntilUnlock) + && embedId.equals(other.embedId) + && embedType.equals(other.embedType) + && lessonType.equals(other.lessonType) + && mainPdf.equals(other.mainPdf) + && maxAttempts.equals(other.maxAttempts) + && muxAssetId.equals(other.muxAssetId) + && thumbnail.equals(other.thumbnail) + && title.equals(other.title) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.assessmentCompletionRequirement, + this.assessmentQuestions, + this.attachments, + this.content, + this.daysFromCourseStartUntilUnlock, + this.embedId, + this.embedType, + this.lessonType, + this.mainPdf, + this.maxAttempts, + this.muxAssetId, + this.thumbnail, + this.title, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional assessmentCompletionRequirement = + Optional.empty(); + + private Optional> assessmentQuestions = + Optional.empty(); + + private Optional> attachments = Optional.empty(); + + private Optional content = Optional.empty(); + + private Optional daysFromCourseStartUntilUnlock = Optional.empty(); + + private Optional embedId = Optional.empty(); + + private Optional embedType = Optional.empty(); + + private Optional lessonType = Optional.empty(); + + private Optional mainPdf = Optional.empty(); + + private Optional maxAttempts = Optional.empty(); + + private Optional muxAssetId = Optional.empty(); + + private Optional thumbnail = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional visibility = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateCourseLessonsRequest other) { + assessmentCompletionRequirement(other.getAssessmentCompletionRequirement()); + assessmentQuestions(other.getAssessmentQuestions()); + attachments(other.getAttachments()); + content(other.getContent()); + daysFromCourseStartUntilUnlock(other.getDaysFromCourseStartUntilUnlock()); + embedId(other.getEmbedId()); + embedType(other.getEmbedType()); + lessonType(other.getLessonType()); + mainPdf(other.getMainPdf()); + maxAttempts(other.getMaxAttempts()); + muxAssetId(other.getMuxAssetId()); + thumbnail(other.getThumbnail()); + title(other.getTitle()); + visibility(other.getVisibility()); + return this; + } + + /** + *

The passing criteria for quiz or knowledge check lessons, such as minimum grade or correct answers.

+ */ + @JsonSetter(value = "assessment_completion_requirement", nulls = Nulls.SKIP) + public Builder assessmentCompletionRequirement( + Optional assessmentCompletionRequirement) { + this.assessmentCompletionRequirement = assessmentCompletionRequirement; + return this; + } + + public Builder assessmentCompletionRequirement( + UpdateCourseLessonsRequestAssessmentCompletionRequirement assessmentCompletionRequirement) { + this.assessmentCompletionRequirement = Optional.ofNullable(assessmentCompletionRequirement); + return this; + } + + public Builder assessmentCompletionRequirement( + Nullable assessmentCompletionRequirement) { + if (assessmentCompletionRequirement.isNull()) { + this.assessmentCompletionRequirement = null; + } else if (assessmentCompletionRequirement.isEmpty()) { + this.assessmentCompletionRequirement = Optional.empty(); + } else { + this.assessmentCompletionRequirement = Optional.of(assessmentCompletionRequirement.get()); + } + return this; + } + + /** + *

The full list of assessment questions for quiz or knowledge check lessons. Replaces all existing questions.

+ */ + @JsonSetter(value = "assessment_questions", nulls = Nulls.SKIP) + public Builder assessmentQuestions( + Optional> assessmentQuestions) { + this.assessmentQuestions = assessmentQuestions; + return this; + } + + public Builder assessmentQuestions( + List assessmentQuestions) { + this.assessmentQuestions = Optional.ofNullable(assessmentQuestions); + return this; + } + + public Builder assessmentQuestions( + Nullable> assessmentQuestions) { + if (assessmentQuestions.isNull()) { + this.assessmentQuestions = null; + } else if (assessmentQuestions.isEmpty()) { + this.assessmentQuestions = Optional.empty(); + } else { + this.assessmentQuestions = Optional.of(assessmentQuestions.get()); + } + return this; + } + + /** + *

File attachments for the lesson such as PDFs or documents. Replaces all existing attachments.

+ */ + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public Builder attachments(Optional> attachments) { + this.attachments = attachments; + return this; + } + + public Builder attachments(List attachments) { + this.attachments = Optional.ofNullable(attachments); + return this; + } + + public Builder attachments(Nullable> attachments) { + if (attachments.isNull()) { + this.attachments = null; + } else if (attachments.isEmpty()) { + this.attachments = Optional.empty(); + } else { + this.attachments = Optional.of(attachments.get()); + } + return this; + } + + /** + *

The Markdown content body of the lesson.

+ */ + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public Builder content(Optional content) { + this.content = content; + return this; + } + + public Builder content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + public Builder content(Nullable content) { + if (content.isNull()) { + this.content = null; + } else if (content.isEmpty()) { + this.content = Optional.empty(); + } else { + this.content = Optional.of(content.get()); + } + return this; + } + + /** + *

The number of days after a student starts the course before this lesson becomes accessible.

+ */ + @JsonSetter(value = "days_from_course_start_until_unlock", nulls = Nulls.SKIP) + public Builder daysFromCourseStartUntilUnlock(Optional daysFromCourseStartUntilUnlock) { + this.daysFromCourseStartUntilUnlock = daysFromCourseStartUntilUnlock; + return this; + } + + public Builder daysFromCourseStartUntilUnlock(Integer daysFromCourseStartUntilUnlock) { + this.daysFromCourseStartUntilUnlock = Optional.ofNullable(daysFromCourseStartUntilUnlock); + return this; + } + + public Builder daysFromCourseStartUntilUnlock(Nullable daysFromCourseStartUntilUnlock) { + if (daysFromCourseStartUntilUnlock.isNull()) { + this.daysFromCourseStartUntilUnlock = null; + } else if (daysFromCourseStartUntilUnlock.isEmpty()) { + this.daysFromCourseStartUntilUnlock = Optional.empty(); + } else { + this.daysFromCourseStartUntilUnlock = Optional.of(daysFromCourseStartUntilUnlock.get()); + } + return this; + } + + /** + *

The external video identifier for embedded content (e.g., a YouTube video ID or Loom share ID).

+ */ + @JsonSetter(value = "embed_id", nulls = Nulls.SKIP) + public Builder embedId(Optional embedId) { + this.embedId = embedId; + return this; + } + + public Builder embedId(String embedId) { + this.embedId = Optional.ofNullable(embedId); + return this; + } + + public Builder embedId(Nullable embedId) { + if (embedId.isNull()) { + this.embedId = null; + } else if (embedId.isEmpty()) { + this.embedId = Optional.empty(); + } else { + this.embedId = Optional.of(embedId.get()); + } + return this; + } + + /** + *

The type of video embed for this lesson, such as YouTube or Loom.

+ */ + @JsonSetter(value = "embed_type", nulls = Nulls.SKIP) + public Builder embedType(Optional embedType) { + this.embedType = embedType; + return this; + } + + public Builder embedType(EmbedTypes embedType) { + this.embedType = Optional.ofNullable(embedType); + return this; + } + + public Builder embedType(Nullable embedType) { + if (embedType.isNull()) { + this.embedType = null; + } else if (embedType.isEmpty()) { + this.embedType = Optional.empty(); + } else { + this.embedType = Optional.of(embedType.get()); + } + return this; + } + + /** + *

The content type of the lesson, such as video, text, quiz, or knowledge check.

+ */ + @JsonSetter(value = "lesson_type", nulls = Nulls.SKIP) + public Builder lessonType(Optional lessonType) { + this.lessonType = lessonType; + return this; + } + + public Builder lessonType(LessonTypes lessonType) { + this.lessonType = Optional.ofNullable(lessonType); + return this; + } + + public Builder lessonType(Nullable lessonType) { + if (lessonType.isNull()) { + this.lessonType = null; + } else if (lessonType.isEmpty()) { + this.lessonType = Optional.empty(); + } else { + this.lessonType = Optional.of(lessonType.get()); + } + return this; + } + + /** + *

The primary PDF document attached to this lesson for student reference.

+ */ + @JsonSetter(value = "main_pdf", nulls = Nulls.SKIP) + public Builder mainPdf(Optional mainPdf) { + this.mainPdf = mainPdf; + return this; + } + + public Builder mainPdf(UpdateCourseLessonsRequestMainPdf mainPdf) { + this.mainPdf = Optional.ofNullable(mainPdf); + return this; + } + + public Builder mainPdf(Nullable mainPdf) { + if (mainPdf.isNull()) { + this.mainPdf = null; + } else if (mainPdf.isEmpty()) { + this.mainPdf = Optional.empty(); + } else { + this.mainPdf = Optional.of(mainPdf.get()); + } + return this; + } + + /** + *

The maximum number of attempts a student is allowed for assessment lessons.

+ */ + @JsonSetter(value = "max_attempts", nulls = Nulls.SKIP) + public Builder maxAttempts(Optional maxAttempts) { + this.maxAttempts = maxAttempts; + return this; + } + + public Builder maxAttempts(Integer maxAttempts) { + this.maxAttempts = Optional.ofNullable(maxAttempts); + return this; + } + + public Builder maxAttempts(Nullable maxAttempts) { + if (maxAttempts.isNull()) { + this.maxAttempts = null; + } else if (maxAttempts.isEmpty()) { + this.maxAttempts = Optional.empty(); + } else { + this.maxAttempts = Optional.of(maxAttempts.get()); + } + return this; + } + + /** + *

The identifier of a Mux video asset to attach to this lesson (e.g., "mux_XXXXX").

+ */ + @JsonSetter(value = "mux_asset_id", nulls = Nulls.SKIP) + public Builder muxAssetId(Optional muxAssetId) { + this.muxAssetId = muxAssetId; + return this; + } + + public Builder muxAssetId(String muxAssetId) { + this.muxAssetId = Optional.ofNullable(muxAssetId); + return this; + } + + public Builder muxAssetId(Nullable muxAssetId) { + if (muxAssetId.isNull()) { + this.muxAssetId = null; + } else if (muxAssetId.isEmpty()) { + this.muxAssetId = Optional.empty(); + } else { + this.muxAssetId = Optional.of(muxAssetId.get()); + } + return this; + } + + /** + *

The thumbnail image for the lesson in PNG, JPEG, or GIF format.

+ */ + @JsonSetter(value = "thumbnail", nulls = Nulls.SKIP) + public Builder thumbnail(Optional thumbnail) { + this.thumbnail = thumbnail; + return this; + } + + public Builder thumbnail(UpdateCourseLessonsRequestThumbnail thumbnail) { + this.thumbnail = Optional.ofNullable(thumbnail); + return this; + } + + public Builder thumbnail(Nullable thumbnail) { + if (thumbnail.isNull()) { + this.thumbnail = null; + } else if (thumbnail.isEmpty()) { + this.thumbnail = Optional.empty(); + } else { + this.thumbnail = Optional.of(thumbnail.get()); + } + return this; + } + + /** + *

The display title of the lesson (e.g., "Getting Started with APIs").

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Controls whether this lesson is visible to students or hidden as a draft.

+ */ + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public Builder visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + public Builder visibility(LessonVisibilities visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + public Builder visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + public UpdateCourseLessonsRequest build() { + return new UpdateCourseLessonsRequest( + assessmentCompletionRequirement, + assessmentQuestions, + attachments, + content, + daysFromCourseStartUntilUnlock, + embedId, + embedType, + lessonType, + mainPdf, + maxAttempts, + muxAssetId, + thumbnail, + title, + visibility, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/types/CreateCourseLessonsRequestThumbnail.java b/src/main/java/com/whop/api/resources/courselessons/types/CreateCourseLessonsRequestThumbnail.java new file mode 100644 index 00000000..d4b3819d --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/types/CreateCourseLessonsRequestThumbnail.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCourseLessonsRequestThumbnail.Builder.class) +public final class CreateCourseLessonsRequestThumbnail { + private final String id; + + private final Map additionalProperties; + + private CreateCourseLessonsRequestThumbnail(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCourseLessonsRequestThumbnail + && equalTo((CreateCourseLessonsRequestThumbnail) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCourseLessonsRequestThumbnail other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CreateCourseLessonsRequestThumbnail other); + } + + public interface _FinalStage { + CreateCourseLessonsRequestThumbnail build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCourseLessonsRequestThumbnail other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CreateCourseLessonsRequestThumbnail build() { + return new CreateCourseLessonsRequestThumbnail(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/types/ListCourseLessonsResponse.java b/src/main/java/com/whop/api/resources/courselessons/types/ListCourseLessonsResponse.java new file mode 100644 index 00000000..c0bdad2b --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/types/ListCourseLessonsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CourseLessonListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCourseLessonsResponse.Builder.class) +public final class ListCourseLessonsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListCourseLessonsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCourseLessonsResponse && equalTo((ListCourseLessonsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCourseLessonsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListCourseLessonsResponse other); + } + + public interface _FinalStage { + ListCourseLessonsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(CourseLessonListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCourseLessonsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(CourseLessonListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListCourseLessonsResponse build() { + return new ListCourseLessonsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/types/SubmitAssessmentCourseLessonsRequestAnswersItem.java b/src/main/java/com/whop/api/resources/courselessons/types/SubmitAssessmentCourseLessonsRequestAnswersItem.java new file mode 100644 index 00000000..24975745 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/types/SubmitAssessmentCourseLessonsRequestAnswersItem.java @@ -0,0 +1,279 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SubmitAssessmentCourseLessonsRequestAnswersItem.Builder.class) +public final class SubmitAssessmentCourseLessonsRequestAnswersItem { + private final Optional answerText; + + private final String questionId; + + private final Optional> selectedOptionIds; + + private final Map additionalProperties; + + private SubmitAssessmentCourseLessonsRequestAnswersItem( + Optional answerText, + String questionId, + Optional> selectedOptionIds, + Map additionalProperties) { + this.answerText = answerText; + this.questionId = questionId; + this.selectedOptionIds = selectedOptionIds; + this.additionalProperties = additionalProperties; + } + + /** + * @return The text answer provided by the user (for short answer questions) + */ + @JsonIgnore + public Optional getAnswerText() { + if (answerText == null) { + return Optional.empty(); + } + return answerText; + } + + /** + * @return The ID of the question being answered + */ + @JsonProperty("question_id") + public String getQuestionId() { + return questionId; + } + + /** + * @return The IDs of the selected options (for multiple choice/select questions) + */ + @JsonIgnore + public Optional> getSelectedOptionIds() { + if (selectedOptionIds == null) { + return Optional.empty(); + } + return selectedOptionIds; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("answer_text") + private Optional _getAnswerText() { + return answerText; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("selected_option_ids") + private Optional> _getSelectedOptionIds() { + return selectedOptionIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SubmitAssessmentCourseLessonsRequestAnswersItem + && equalTo((SubmitAssessmentCourseLessonsRequestAnswersItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SubmitAssessmentCourseLessonsRequestAnswersItem other) { + return answerText.equals(other.answerText) + && questionId.equals(other.questionId) + && selectedOptionIds.equals(other.selectedOptionIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.answerText, this.questionId, this.selectedOptionIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static QuestionIdStage builder() { + return new Builder(); + } + + public interface QuestionIdStage { + /** + *

The ID of the question being answered

+ */ + _FinalStage questionId(@NotNull String questionId); + + Builder from(SubmitAssessmentCourseLessonsRequestAnswersItem other); + } + + public interface _FinalStage { + SubmitAssessmentCourseLessonsRequestAnswersItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The text answer provided by the user (for short answer questions)

+ */ + _FinalStage answerText(Optional answerText); + + _FinalStage answerText(String answerText); + + _FinalStage answerText(Nullable answerText); + + /** + *

The IDs of the selected options (for multiple choice/select questions)

+ */ + _FinalStage selectedOptionIds(Optional> selectedOptionIds); + + _FinalStage selectedOptionIds(List selectedOptionIds); + + _FinalStage selectedOptionIds(Nullable> selectedOptionIds); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements QuestionIdStage, _FinalStage { + private String questionId; + + private Optional> selectedOptionIds = Optional.empty(); + + private Optional answerText = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SubmitAssessmentCourseLessonsRequestAnswersItem other) { + answerText(other.getAnswerText()); + questionId(other.getQuestionId()); + selectedOptionIds(other.getSelectedOptionIds()); + return this; + } + + /** + *

The ID of the question being answered

+ *

The ID of the question being answered

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("question_id") + public _FinalStage questionId(@NotNull String questionId) { + this.questionId = Objects.requireNonNull(questionId, "questionId must not be null"); + return this; + } + + /** + *

The IDs of the selected options (for multiple choice/select questions)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage selectedOptionIds(Nullable> selectedOptionIds) { + if (selectedOptionIds.isNull()) { + this.selectedOptionIds = null; + } else if (selectedOptionIds.isEmpty()) { + this.selectedOptionIds = Optional.empty(); + } else { + this.selectedOptionIds = Optional.of(selectedOptionIds.get()); + } + return this; + } + + /** + *

The IDs of the selected options (for multiple choice/select questions)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage selectedOptionIds(List selectedOptionIds) { + this.selectedOptionIds = Optional.ofNullable(selectedOptionIds); + return this; + } + + /** + *

The IDs of the selected options (for multiple choice/select questions)

+ */ + @java.lang.Override + @JsonSetter(value = "selected_option_ids", nulls = Nulls.SKIP) + public _FinalStage selectedOptionIds(Optional> selectedOptionIds) { + this.selectedOptionIds = selectedOptionIds; + return this; + } + + /** + *

The text answer provided by the user (for short answer questions)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage answerText(Nullable answerText) { + if (answerText.isNull()) { + this.answerText = null; + } else if (answerText.isEmpty()) { + this.answerText = Optional.empty(); + } else { + this.answerText = Optional.of(answerText.get()); + } + return this; + } + + /** + *

The text answer provided by the user (for short answer questions)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage answerText(String answerText) { + this.answerText = Optional.ofNullable(answerText); + return this; + } + + /** + *

The text answer provided by the user (for short answer questions)

+ */ + @java.lang.Override + @JsonSetter(value = "answer_text", nulls = Nulls.SKIP) + public _FinalStage answerText(Optional answerText) { + this.answerText = answerText; + return this; + } + + @java.lang.Override + public SubmitAssessmentCourseLessonsRequestAnswersItem build() { + return new SubmitAssessmentCourseLessonsRequestAnswersItem( + answerText, questionId, selectedOptionIds, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/types/SubmitAssessmentCourseLessonsResponse.java b/src/main/java/com/whop/api/resources/courselessons/types/SubmitAssessmentCourseLessonsResponse.java new file mode 100644 index 00000000..b4c976eb --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/types/SubmitAssessmentCourseLessonsResponse.java @@ -0,0 +1,544 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SubmitAssessmentCourseLessonsResponse.Builder.class) +public final class SubmitAssessmentCourseLessonsResponse { + private final OffsetDateTime createdAt; + + private final String id; + + private final SubmitAssessmentCourseLessonsResponseLesson lesson; + + private final int resultCorrect; + + private final double resultGrade; + + private final Map resultGradedQuestions; + + private final boolean resultPassingGrade; + + private final int resultQuestionCount; + + private final double scorePercent; + + private final OffsetDateTime updatedAt; + + private final SubmitAssessmentCourseLessonsResponseUser user; + + private final Map additionalProperties; + + private SubmitAssessmentCourseLessonsResponse( + OffsetDateTime createdAt, + String id, + SubmitAssessmentCourseLessonsResponseLesson lesson, + int resultCorrect, + double resultGrade, + Map resultGradedQuestions, + boolean resultPassingGrade, + int resultQuestionCount, + double scorePercent, + OffsetDateTime updatedAt, + SubmitAssessmentCourseLessonsResponseUser user, + Map additionalProperties) { + this.createdAt = createdAt; + this.id = id; + this.lesson = lesson; + this.resultCorrect = resultCorrect; + this.resultGrade = resultGrade; + this.resultGradedQuestions = resultGradedQuestions; + this.resultPassingGrade = resultPassingGrade; + this.resultQuestionCount = resultQuestionCount; + this.scorePercent = scorePercent; + this.updatedAt = updatedAt; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The datetime the assessment result was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the assessment result. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The lesson this assessment result is for + */ + @JsonProperty("lesson") + public SubmitAssessmentCourseLessonsResponseLesson getLesson() { + return lesson; + } + + /** + * @return The number of correct answers + */ + @JsonProperty("result_correct") + public int getResultCorrect() { + return resultCorrect; + } + + /** + * @return The grade achieved on the assessment + */ + @JsonProperty("result_grade") + public double getResultGrade() { + return resultGrade; + } + + /** + * @return Array of graded questions with details + */ + @JsonProperty("result_graded_questions") + public Map getResultGradedQuestions() { + return resultGradedQuestions; + } + + /** + * @return Whether the user achieved a passing grade + */ + @JsonProperty("result_passing_grade") + public boolean getResultPassingGrade() { + return resultPassingGrade; + } + + /** + * @return The total number of questions in the assessment + */ + @JsonProperty("result_question_count") + public int getResultQuestionCount() { + return resultQuestionCount; + } + + /** + * @return The percentage score achieved on the assessment + */ + @JsonProperty("score_percent") + public double getScorePercent() { + return scorePercent; + } + + /** + * @return The datetime the assessment result was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user who took the assessment + */ + @JsonProperty("user") + public SubmitAssessmentCourseLessonsResponseUser getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SubmitAssessmentCourseLessonsResponse + && equalTo((SubmitAssessmentCourseLessonsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SubmitAssessmentCourseLessonsResponse other) { + return createdAt.equals(other.createdAt) + && id.equals(other.id) + && lesson.equals(other.lesson) + && resultCorrect == other.resultCorrect + && resultGrade == other.resultGrade + && resultGradedQuestions.equals(other.resultGradedQuestions) + && resultPassingGrade == other.resultPassingGrade + && resultQuestionCount == other.resultQuestionCount + && scorePercent == other.scorePercent + && updatedAt.equals(other.updatedAt) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, + this.id, + this.lesson, + this.resultCorrect, + this.resultGrade, + this.resultGradedQuestions, + this.resultPassingGrade, + this.resultQuestionCount, + this.scorePercent, + this.updatedAt, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the assessment result was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(SubmitAssessmentCourseLessonsResponse other); + } + + public interface IdStage { + /** + *

The unique identifier for the assessment result.

+ */ + LessonStage id(@NotNull String id); + } + + public interface LessonStage { + /** + *

The lesson this assessment result is for

+ */ + ResultCorrectStage lesson(@NotNull SubmitAssessmentCourseLessonsResponseLesson lesson); + } + + public interface ResultCorrectStage { + /** + *

The number of correct answers

+ */ + ResultGradeStage resultCorrect(int resultCorrect); + } + + public interface ResultGradeStage { + /** + *

The grade achieved on the assessment

+ */ + ResultPassingGradeStage resultGrade(double resultGrade); + } + + public interface ResultPassingGradeStage { + /** + *

Whether the user achieved a passing grade

+ */ + ResultQuestionCountStage resultPassingGrade(boolean resultPassingGrade); + } + + public interface ResultQuestionCountStage { + /** + *

The total number of questions in the assessment

+ */ + ScorePercentStage resultQuestionCount(int resultQuestionCount); + } + + public interface ScorePercentStage { + /** + *

The percentage score achieved on the assessment

+ */ + UpdatedAtStage scorePercent(double scorePercent); + } + + public interface UpdatedAtStage { + /** + *

The datetime the assessment result was last updated.

+ */ + UserStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UserStage { + /** + *

The user who took the assessment

+ */ + _FinalStage user(@NotNull SubmitAssessmentCourseLessonsResponseUser user); + } + + public interface _FinalStage { + SubmitAssessmentCourseLessonsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Array of graded questions with details

+ */ + _FinalStage resultGradedQuestions(Map resultGradedQuestions); + + _FinalStage putAllResultGradedQuestions(Map resultGradedQuestions); + + _FinalStage resultGradedQuestions(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + IdStage, + LessonStage, + ResultCorrectStage, + ResultGradeStage, + ResultPassingGradeStage, + ResultQuestionCountStage, + ScorePercentStage, + UpdatedAtStage, + UserStage, + _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private SubmitAssessmentCourseLessonsResponseLesson lesson; + + private int resultCorrect; + + private double resultGrade; + + private boolean resultPassingGrade; + + private int resultQuestionCount; + + private double scorePercent; + + private OffsetDateTime updatedAt; + + private SubmitAssessmentCourseLessonsResponseUser user; + + private Map resultGradedQuestions = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SubmitAssessmentCourseLessonsResponse other) { + createdAt(other.getCreatedAt()); + id(other.getId()); + lesson(other.getLesson()); + resultCorrect(other.getResultCorrect()); + resultGrade(other.getResultGrade()); + resultGradedQuestions(other.getResultGradedQuestions()); + resultPassingGrade(other.getResultPassingGrade()); + resultQuestionCount(other.getResultQuestionCount()); + scorePercent(other.getScorePercent()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + return this; + } + + /** + *

The datetime the assessment result was created.

+ *

The datetime the assessment result was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the assessment result.

+ *

The unique identifier for the assessment result.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LessonStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The lesson this assessment result is for

+ *

The lesson this assessment result is for

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("lesson") + public ResultCorrectStage lesson(@NotNull SubmitAssessmentCourseLessonsResponseLesson lesson) { + this.lesson = Objects.requireNonNull(lesson, "lesson must not be null"); + return this; + } + + /** + *

The number of correct answers

+ *

The number of correct answers

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("result_correct") + public ResultGradeStage resultCorrect(int resultCorrect) { + this.resultCorrect = resultCorrect; + return this; + } + + /** + *

The grade achieved on the assessment

+ *

The grade achieved on the assessment

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("result_grade") + public ResultPassingGradeStage resultGrade(double resultGrade) { + this.resultGrade = resultGrade; + return this; + } + + /** + *

Whether the user achieved a passing grade

+ *

Whether the user achieved a passing grade

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("result_passing_grade") + public ResultQuestionCountStage resultPassingGrade(boolean resultPassingGrade) { + this.resultPassingGrade = resultPassingGrade; + return this; + } + + /** + *

The total number of questions in the assessment

+ *

The total number of questions in the assessment

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("result_question_count") + public ScorePercentStage resultQuestionCount(int resultQuestionCount) { + this.resultQuestionCount = resultQuestionCount; + return this; + } + + /** + *

The percentage score achieved on the assessment

+ *

The percentage score achieved on the assessment

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("score_percent") + public UpdatedAtStage scorePercent(double scorePercent) { + this.scorePercent = scorePercent; + return this; + } + + /** + *

The datetime the assessment result was last updated.

+ *

The datetime the assessment result was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UserStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user who took the assessment

+ *

The user who took the assessment

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull SubmitAssessmentCourseLessonsResponseUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

Array of graded questions with details

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultGradedQuestions(String key, Object value) { + this.resultGradedQuestions.put(key, value); + return this; + } + + /** + *

Array of graded questions with details

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllResultGradedQuestions(Map resultGradedQuestions) { + if (resultGradedQuestions != null) { + this.resultGradedQuestions.putAll(resultGradedQuestions); + } + return this; + } + + /** + *

Array of graded questions with details

+ */ + @java.lang.Override + @JsonSetter(value = "result_graded_questions", nulls = Nulls.SKIP) + public _FinalStage resultGradedQuestions(Map resultGradedQuestions) { + this.resultGradedQuestions.clear(); + if (resultGradedQuestions != null) { + this.resultGradedQuestions.putAll(resultGradedQuestions); + } + return this; + } + + @java.lang.Override + public SubmitAssessmentCourseLessonsResponse build() { + return new SubmitAssessmentCourseLessonsResponse( + createdAt, + id, + lesson, + resultCorrect, + resultGrade, + resultGradedQuestions, + resultPassingGrade, + resultQuestionCount, + scorePercent, + updatedAt, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/types/SubmitAssessmentCourseLessonsResponseLesson.java b/src/main/java/com/whop/api/resources/courselessons/types/SubmitAssessmentCourseLessonsResponseLesson.java new file mode 100644 index 00000000..ae4e15ad --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/types/SubmitAssessmentCourseLessonsResponseLesson.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SubmitAssessmentCourseLessonsResponseLesson.Builder.class) +public final class SubmitAssessmentCourseLessonsResponseLesson { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private SubmitAssessmentCourseLessonsResponseLesson( + String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the lesson. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the lesson shown to students. Maximum 120 characters. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SubmitAssessmentCourseLessonsResponseLesson + && equalTo((SubmitAssessmentCourseLessonsResponseLesson) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SubmitAssessmentCourseLessonsResponseLesson other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the lesson.

+ */ + TitleStage id(@NotNull String id); + + Builder from(SubmitAssessmentCourseLessonsResponseLesson other); + } + + public interface TitleStage { + /** + *

The display name of the lesson shown to students. Maximum 120 characters.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + SubmitAssessmentCourseLessonsResponseLesson build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SubmitAssessmentCourseLessonsResponseLesson other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the lesson.

+ *

The unique identifier for the lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the lesson shown to students. Maximum 120 characters.

+ *

The display name of the lesson shown to students. Maximum 120 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public SubmitAssessmentCourseLessonsResponseLesson build() { + return new SubmitAssessmentCourseLessonsResponseLesson(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/types/SubmitAssessmentCourseLessonsResponseUser.java b/src/main/java/com/whop/api/resources/courselessons/types/SubmitAssessmentCourseLessonsResponseUser.java new file mode 100644 index 00000000..95fd70e1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/types/SubmitAssessmentCourseLessonsResponseUser.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SubmitAssessmentCourseLessonsResponseUser.Builder.class) +public final class SubmitAssessmentCourseLessonsResponseUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private SubmitAssessmentCourseLessonsResponseUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SubmitAssessmentCourseLessonsResponseUser + && equalTo((SubmitAssessmentCourseLessonsResponseUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SubmitAssessmentCourseLessonsResponseUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(SubmitAssessmentCourseLessonsResponseUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + SubmitAssessmentCourseLessonsResponseUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SubmitAssessmentCourseLessonsResponseUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public SubmitAssessmentCourseLessonsResponseUser build() { + return new SubmitAssessmentCourseLessonsResponseUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestAssessmentCompletionRequirement.java b/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestAssessmentCompletionRequirement.java new file mode 100644 index 00000000..48d46f74 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestAssessmentCompletionRequirement.java @@ -0,0 +1,188 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCourseLessonsRequestAssessmentCompletionRequirement.Builder.class) +public final class UpdateCourseLessonsRequestAssessmentCompletionRequirement { + private final Optional minimumGradePercent; + + private final Optional minimumQuestionsCorrect; + + private final Map additionalProperties; + + private UpdateCourseLessonsRequestAssessmentCompletionRequirement( + Optional minimumGradePercent, + Optional minimumQuestionsCorrect, + Map additionalProperties) { + this.minimumGradePercent = minimumGradePercent; + this.minimumQuestionsCorrect = minimumQuestionsCorrect; + this.additionalProperties = additionalProperties; + } + + /** + * @return The minimum grade percentage required to pass (0-100). Cannot be set together with minimum_questions_correct. + */ + @JsonIgnore + public Optional getMinimumGradePercent() { + if (minimumGradePercent == null) { + return Optional.empty(); + } + return minimumGradePercent; + } + + /** + * @return The minimum number of questions that must be answered correctly. Cannot be set together with minimum_grade_percent. + */ + @JsonIgnore + public Optional getMinimumQuestionsCorrect() { + if (minimumQuestionsCorrect == null) { + return Optional.empty(); + } + return minimumQuestionsCorrect; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("minimum_grade_percent") + private Optional _getMinimumGradePercent() { + return minimumGradePercent; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("minimum_questions_correct") + private Optional _getMinimumQuestionsCorrect() { + return minimumQuestionsCorrect; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCourseLessonsRequestAssessmentCompletionRequirement + && equalTo((UpdateCourseLessonsRequestAssessmentCompletionRequirement) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCourseLessonsRequestAssessmentCompletionRequirement other) { + return minimumGradePercent.equals(other.minimumGradePercent) + && minimumQuestionsCorrect.equals(other.minimumQuestionsCorrect); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.minimumGradePercent, this.minimumQuestionsCorrect); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional minimumGradePercent = Optional.empty(); + + private Optional minimumQuestionsCorrect = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateCourseLessonsRequestAssessmentCompletionRequirement other) { + minimumGradePercent(other.getMinimumGradePercent()); + minimumQuestionsCorrect(other.getMinimumQuestionsCorrect()); + return this; + } + + /** + *

The minimum grade percentage required to pass (0-100). Cannot be set together with minimum_questions_correct.

+ */ + @JsonSetter(value = "minimum_grade_percent", nulls = Nulls.SKIP) + public Builder minimumGradePercent(Optional minimumGradePercent) { + this.minimumGradePercent = minimumGradePercent; + return this; + } + + public Builder minimumGradePercent(Double minimumGradePercent) { + this.minimumGradePercent = Optional.ofNullable(minimumGradePercent); + return this; + } + + public Builder minimumGradePercent(Nullable minimumGradePercent) { + if (minimumGradePercent.isNull()) { + this.minimumGradePercent = null; + } else if (minimumGradePercent.isEmpty()) { + this.minimumGradePercent = Optional.empty(); + } else { + this.minimumGradePercent = Optional.of(minimumGradePercent.get()); + } + return this; + } + + /** + *

The minimum number of questions that must be answered correctly. Cannot be set together with minimum_grade_percent.

+ */ + @JsonSetter(value = "minimum_questions_correct", nulls = Nulls.SKIP) + public Builder minimumQuestionsCorrect(Optional minimumQuestionsCorrect) { + this.minimumQuestionsCorrect = minimumQuestionsCorrect; + return this; + } + + public Builder minimumQuestionsCorrect(Integer minimumQuestionsCorrect) { + this.minimumQuestionsCorrect = Optional.ofNullable(minimumQuestionsCorrect); + return this; + } + + public Builder minimumQuestionsCorrect(Nullable minimumQuestionsCorrect) { + if (minimumQuestionsCorrect.isNull()) { + this.minimumQuestionsCorrect = null; + } else if (minimumQuestionsCorrect.isEmpty()) { + this.minimumQuestionsCorrect = Optional.empty(); + } else { + this.minimumQuestionsCorrect = Optional.of(minimumQuestionsCorrect.get()); + } + return this; + } + + public UpdateCourseLessonsRequestAssessmentCompletionRequirement build() { + return new UpdateCourseLessonsRequestAssessmentCompletionRequirement( + minimumGradePercent, minimumQuestionsCorrect, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestAssessmentQuestionsItem.java b/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestAssessmentQuestionsItem.java new file mode 100644 index 00000000..49fe6894 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestAssessmentQuestionsItem.java @@ -0,0 +1,423 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CoursesAssessmentQuestionTypes; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCourseLessonsRequestAssessmentQuestionsItem.Builder.class) +public final class UpdateCourseLessonsRequestAssessmentQuestionsItem { + private final String correctAnswer; + + private final Optional id; + + private final Optional image; + + private final Optional> options; + + private final String questionText; + + private final CoursesAssessmentQuestionTypes questionType; + + private final Map additionalProperties; + + private UpdateCourseLessonsRequestAssessmentQuestionsItem( + String correctAnswer, + Optional id, + Optional image, + Optional> options, + String questionText, + CoursesAssessmentQuestionTypes questionType, + Map additionalProperties) { + this.correctAnswer = correctAnswer; + this.id = id; + this.image = image; + this.options = options; + this.questionText = questionText; + this.questionType = questionType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The correct answer for the question. Used for short answer questions + */ + @JsonProperty("correct_answer") + public String getCorrectAnswer() { + return correctAnswer; + } + + /** + * @return The ID of an existing question. If provided, the question will be updated. If not provided, a new question will be created. + */ + @JsonIgnore + public Optional getId() { + if (id == null) { + return Optional.empty(); + } + return id; + } + + /** + * @return Optional image attachment for the question + */ + @JsonIgnore + public Optional getImage() { + if (image == null) { + return Optional.empty(); + } + return image; + } + + /** + * @return The answer options for multiple choice/select questions + */ + @JsonIgnore + public Optional> getOptions() { + if (options == null) { + return Optional.empty(); + } + return options; + } + + /** + * @return The text of the question + */ + @JsonProperty("question_text") + public String getQuestionText() { + return questionText; + } + + /** + * @return The type of the question + */ + @JsonProperty("question_type") + public CoursesAssessmentQuestionTypes getQuestionType() { + return questionType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("id") + private Optional _getId() { + return id; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("image") + private Optional _getImage() { + return image; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("options") + private Optional> _getOptions() { + return options; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCourseLessonsRequestAssessmentQuestionsItem + && equalTo((UpdateCourseLessonsRequestAssessmentQuestionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCourseLessonsRequestAssessmentQuestionsItem other) { + return correctAnswer.equals(other.correctAnswer) + && id.equals(other.id) + && image.equals(other.image) + && options.equals(other.options) + && questionText.equals(other.questionText) + && questionType.equals(other.questionType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.correctAnswer, this.id, this.image, this.options, this.questionText, this.questionType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CorrectAnswerStage builder() { + return new Builder(); + } + + public interface CorrectAnswerStage { + /** + *

The correct answer for the question. Used for short answer questions

+ */ + QuestionTextStage correctAnswer(@NotNull String correctAnswer); + + Builder from(UpdateCourseLessonsRequestAssessmentQuestionsItem other); + } + + public interface QuestionTextStage { + /** + *

The text of the question

+ */ + QuestionTypeStage questionText(@NotNull String questionText); + } + + public interface QuestionTypeStage { + /** + *

The type of the question

+ */ + _FinalStage questionType(@NotNull CoursesAssessmentQuestionTypes questionType); + } + + public interface _FinalStage { + UpdateCourseLessonsRequestAssessmentQuestionsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The ID of an existing question. If provided, the question will be updated. If not provided, a new question will be created.

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + + _FinalStage id(Nullable id); + + /** + *

Optional image attachment for the question

+ */ + _FinalStage image(Optional image); + + _FinalStage image(UpdateCourseLessonsRequestAssessmentQuestionsItemImage image); + + _FinalStage image(Nullable image); + + /** + *

The answer options for multiple choice/select questions

+ */ + _FinalStage options(Optional> options); + + _FinalStage options(List options); + + _FinalStage options(Nullable> options); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CorrectAnswerStage, QuestionTextStage, QuestionTypeStage, _FinalStage { + private String correctAnswer; + + private String questionText; + + private CoursesAssessmentQuestionTypes questionType; + + private Optional> options = Optional.empty(); + + private Optional image = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCourseLessonsRequestAssessmentQuestionsItem other) { + correctAnswer(other.getCorrectAnswer()); + id(other.getId()); + image(other.getImage()); + options(other.getOptions()); + questionText(other.getQuestionText()); + questionType(other.getQuestionType()); + return this; + } + + /** + *

The correct answer for the question. Used for short answer questions

+ *

The correct answer for the question. Used for short answer questions

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("correct_answer") + public QuestionTextStage correctAnswer(@NotNull String correctAnswer) { + this.correctAnswer = Objects.requireNonNull(correctAnswer, "correctAnswer must not be null"); + return this; + } + + /** + *

The text of the question

+ *

The text of the question

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("question_text") + public QuestionTypeStage questionText(@NotNull String questionText) { + this.questionText = Objects.requireNonNull(questionText, "questionText must not be null"); + return this; + } + + /** + *

The type of the question

+ *

The type of the question

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("question_type") + public _FinalStage questionType(@NotNull CoursesAssessmentQuestionTypes questionType) { + this.questionType = Objects.requireNonNull(questionType, "questionType must not be null"); + return this; + } + + /** + *

The answer options for multiple choice/select questions

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage options( + Nullable> options) { + if (options.isNull()) { + this.options = null; + } else if (options.isEmpty()) { + this.options = Optional.empty(); + } else { + this.options = Optional.of(options.get()); + } + return this; + } + + /** + *

The answer options for multiple choice/select questions

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + /** + *

The answer options for multiple choice/select questions

+ */ + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options( + Optional> options) { + this.options = options; + return this; + } + + /** + *

Optional image attachment for the question

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage image(Nullable image) { + if (image.isNull()) { + this.image = null; + } else if (image.isEmpty()) { + this.image = Optional.empty(); + } else { + this.image = Optional.of(image.get()); + } + return this; + } + + /** + *

Optional image attachment for the question

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage image(UpdateCourseLessonsRequestAssessmentQuestionsItemImage image) { + this.image = Optional.ofNullable(image); + return this; + } + + /** + *

Optional image attachment for the question

+ */ + @java.lang.Override + @JsonSetter(value = "image", nulls = Nulls.SKIP) + public _FinalStage image(Optional image) { + this.image = image; + return this; + } + + /** + *

The ID of an existing question. If provided, the question will be updated. If not provided, a new question will be created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(Nullable id) { + if (id.isNull()) { + this.id = null; + } else if (id.isEmpty()) { + this.id = Optional.empty(); + } else { + this.id = Optional.of(id.get()); + } + return this; + } + + /** + *

The ID of an existing question. If provided, the question will be updated. If not provided, a new question will be created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The ID of an existing question. If provided, the question will be updated. If not provided, a new question will be created.

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public UpdateCourseLessonsRequestAssessmentQuestionsItem build() { + return new UpdateCourseLessonsRequestAssessmentQuestionsItem( + correctAnswer, id, image, options, questionText, questionType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestAssessmentQuestionsItemImage.java b/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestAssessmentQuestionsItemImage.java new file mode 100644 index 00000000..5c31e88d --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestAssessmentQuestionsItemImage.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCourseLessonsRequestAssessmentQuestionsItemImage.Builder.class) +public final class UpdateCourseLessonsRequestAssessmentQuestionsItemImage { + private final String id; + + private final Map additionalProperties; + + private UpdateCourseLessonsRequestAssessmentQuestionsItemImage( + String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCourseLessonsRequestAssessmentQuestionsItemImage + && equalTo((UpdateCourseLessonsRequestAssessmentQuestionsItemImage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCourseLessonsRequestAssessmentQuestionsItemImage other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateCourseLessonsRequestAssessmentQuestionsItemImage other); + } + + public interface _FinalStage { + UpdateCourseLessonsRequestAssessmentQuestionsItemImage build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCourseLessonsRequestAssessmentQuestionsItemImage other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateCourseLessonsRequestAssessmentQuestionsItemImage build() { + return new UpdateCourseLessonsRequestAssessmentQuestionsItemImage(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestAssessmentQuestionsItemOptionsItem.java b/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestAssessmentQuestionsItemOptionsItem.java new file mode 100644 index 00000000..698c2457 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestAssessmentQuestionsItemOptionsItem.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCourseLessonsRequestAssessmentQuestionsItemOptionsItem.Builder.class) +public final class UpdateCourseLessonsRequestAssessmentQuestionsItemOptionsItem { + private final Optional id; + + private final boolean isCorrect; + + private final String optionText; + + private final Map additionalProperties; + + private UpdateCourseLessonsRequestAssessmentQuestionsItemOptionsItem( + Optional id, boolean isCorrect, String optionText, Map additionalProperties) { + this.id = id; + this.isCorrect = isCorrect; + this.optionText = optionText; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing option. If provided, the option will be updated. If not provided, a new option will be created. + */ + @JsonIgnore + public Optional getId() { + if (id == null) { + return Optional.empty(); + } + return id; + } + + /** + * @return Whether this option is a correct answer + */ + @JsonProperty("is_correct") + public boolean getIsCorrect() { + return isCorrect; + } + + /** + * @return The text of the answer option + */ + @JsonProperty("option_text") + public String getOptionText() { + return optionText; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("id") + private Optional _getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCourseLessonsRequestAssessmentQuestionsItemOptionsItem + && equalTo((UpdateCourseLessonsRequestAssessmentQuestionsItemOptionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCourseLessonsRequestAssessmentQuestionsItemOptionsItem other) { + return id.equals(other.id) && isCorrect == other.isCorrect && optionText.equals(other.optionText); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.isCorrect, this.optionText); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IsCorrectStage builder() { + return new Builder(); + } + + public interface IsCorrectStage { + /** + *

Whether this option is a correct answer

+ */ + OptionTextStage isCorrect(boolean isCorrect); + + Builder from(UpdateCourseLessonsRequestAssessmentQuestionsItemOptionsItem other); + } + + public interface OptionTextStage { + /** + *

The text of the answer option

+ */ + _FinalStage optionText(@NotNull String optionText); + } + + public interface _FinalStage { + UpdateCourseLessonsRequestAssessmentQuestionsItemOptionsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The ID of an existing option. If provided, the option will be updated. If not provided, a new option will be created.

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + + _FinalStage id(Nullable id); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IsCorrectStage, OptionTextStage, _FinalStage { + private boolean isCorrect; + + private String optionText; + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCourseLessonsRequestAssessmentQuestionsItemOptionsItem other) { + id(other.getId()); + isCorrect(other.getIsCorrect()); + optionText(other.getOptionText()); + return this; + } + + /** + *

Whether this option is a correct answer

+ *

Whether this option is a correct answer

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_correct") + public OptionTextStage isCorrect(boolean isCorrect) { + this.isCorrect = isCorrect; + return this; + } + + /** + *

The text of the answer option

+ *

The text of the answer option

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("option_text") + public _FinalStage optionText(@NotNull String optionText) { + this.optionText = Objects.requireNonNull(optionText, "optionText must not be null"); + return this; + } + + /** + *

The ID of an existing option. If provided, the option will be updated. If not provided, a new option will be created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(Nullable id) { + if (id.isNull()) { + this.id = null; + } else if (id.isEmpty()) { + this.id = Optional.empty(); + } else { + this.id = Optional.of(id.get()); + } + return this; + } + + /** + *

The ID of an existing option. If provided, the option will be updated. If not provided, a new option will be created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The ID of an existing option. If provided, the option will be updated. If not provided, a new option will be created.

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public UpdateCourseLessonsRequestAssessmentQuestionsItemOptionsItem build() { + return new UpdateCourseLessonsRequestAssessmentQuestionsItemOptionsItem( + id, isCorrect, optionText, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestAttachmentsItem.java b/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestAttachmentsItem.java new file mode 100644 index 00000000..7896f551 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestAttachmentsItem.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCourseLessonsRequestAttachmentsItem.Builder.class) +public final class UpdateCourseLessonsRequestAttachmentsItem { + private final String id; + + private final Map additionalProperties; + + private UpdateCourseLessonsRequestAttachmentsItem(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCourseLessonsRequestAttachmentsItem + && equalTo((UpdateCourseLessonsRequestAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCourseLessonsRequestAttachmentsItem other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateCourseLessonsRequestAttachmentsItem other); + } + + public interface _FinalStage { + UpdateCourseLessonsRequestAttachmentsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCourseLessonsRequestAttachmentsItem other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateCourseLessonsRequestAttachmentsItem build() { + return new UpdateCourseLessonsRequestAttachmentsItem(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestMainPdf.java b/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestMainPdf.java new file mode 100644 index 00000000..b2c735d1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestMainPdf.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCourseLessonsRequestMainPdf.Builder.class) +public final class UpdateCourseLessonsRequestMainPdf { + private final String id; + + private final Map additionalProperties; + + private UpdateCourseLessonsRequestMainPdf(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCourseLessonsRequestMainPdf && equalTo((UpdateCourseLessonsRequestMainPdf) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCourseLessonsRequestMainPdf other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateCourseLessonsRequestMainPdf other); + } + + public interface _FinalStage { + UpdateCourseLessonsRequestMainPdf build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCourseLessonsRequestMainPdf other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateCourseLessonsRequestMainPdf build() { + return new UpdateCourseLessonsRequestMainPdf(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestThumbnail.java b/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestThumbnail.java new file mode 100644 index 00000000..c24fa325 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courselessons/types/UpdateCourseLessonsRequestThumbnail.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courselessons.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCourseLessonsRequestThumbnail.Builder.class) +public final class UpdateCourseLessonsRequestThumbnail { + private final String id; + + private final Map additionalProperties; + + private UpdateCourseLessonsRequestThumbnail(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCourseLessonsRequestThumbnail + && equalTo((UpdateCourseLessonsRequestThumbnail) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCourseLessonsRequestThumbnail other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateCourseLessonsRequestThumbnail other); + } + + public interface _FinalStage { + UpdateCourseLessonsRequestThumbnail build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCourseLessonsRequestThumbnail other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateCourseLessonsRequestThumbnail build() { + return new UpdateCourseLessonsRequestThumbnail(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courses/AsyncCoursesClient.java b/src/main/java/com/whop/api/resources/courses/AsyncCoursesClient.java new file mode 100644 index 00000000..65de0190 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courses/AsyncCoursesClient.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courses; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.courses.requests.CreateCoursesRequest; +import com.whop.api.resources.courses.requests.DeleteCoursesRequest; +import com.whop.api.resources.courses.requests.ListCoursesRequest; +import com.whop.api.resources.courses.requests.RetrieveCoursesRequest; +import com.whop.api.resources.courses.requests.UpdateCoursesRequest; +import com.whop.api.types.Course; +import com.whop.api.types.CourseListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncCoursesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawCoursesClient rawClient; + + public AsyncCoursesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawCoursesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawCoursesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> list(ListCoursesRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> list( + ListCoursesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create a new course within an experience, with optional chapters, lessons, and a certificate. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture create(CreateCoursesRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create a new course within an experience, with optional chapters, lessons, and a certificate. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture create(CreateCoursesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveCoursesRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveCoursesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture delete(String id, DeleteCoursesRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture delete(String id, DeleteCoursesRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture update(String id, UpdateCoursesRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture update(String id, UpdateCoursesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/courses/AsyncRawCoursesClient.java b/src/main/java/com/whop/api/resources/courses/AsyncRawCoursesClient.java new file mode 100644 index 00000000..6d3047a5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courses/AsyncRawCoursesClient.java @@ -0,0 +1,739 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courses; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.courses.requests.CreateCoursesRequest; +import com.whop.api.resources.courses.requests.DeleteCoursesRequest; +import com.whop.api.resources.courses.requests.ListCoursesRequest; +import com.whop.api.resources.courses.requests.RetrieveCoursesRequest; +import com.whop.api.resources.courses.requests.UpdateCoursesRequest; +import com.whop.api.resources.courses.types.ListCoursesResponse; +import com.whop.api.types.Course; +import com.whop.api.types.CourseListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawCoursesClient { + protected final ClientOptions clientOptions; + + public AsyncRawCoursesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture>> list() { + return list(ListCoursesRequest.builder().build()); + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListCoursesRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture>> list(ListCoursesRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture>> list( + ListCoursesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("courses"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getExperienceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "experience_id", request.getExperienceId().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCoursesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCoursesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListCoursesRequest nextRequest = ListCoursesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create a new course within an experience, with optional chapters, lessons, and a certificate. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> create(CreateCoursesRequest request) { + return create(request, null); + } + + /** + * Create a new course within an experience, with optional chapters, lessons, and a certificate. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> create( + CreateCoursesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("courses"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Course.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveCoursesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCoursesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RetrieveCoursesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveCoursesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("courses") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Course.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteCoursesRequest.builder().build()); + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteCoursesRequest.builder().build(), requestOptions); + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> delete(String id, DeleteCoursesRequest request) { + return delete(id, request, null); + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> delete( + String id, DeleteCoursesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("courses") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> update(String id) { + return update(id, UpdateCoursesRequest.builder().build()); + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateCoursesRequest.builder().build(), requestOptions); + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> update(String id, UpdateCoursesRequest request) { + return update(id, request, null); + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public CompletableFuture> update( + String id, UpdateCoursesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("courses") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Course.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/courses/CoursesClient.java b/src/main/java/com/whop/api/resources/courses/CoursesClient.java new file mode 100644 index 00000000..30ae98a9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courses/CoursesClient.java @@ -0,0 +1,231 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courses; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.courses.requests.CreateCoursesRequest; +import com.whop.api.resources.courses.requests.DeleteCoursesRequest; +import com.whop.api.resources.courses.requests.ListCoursesRequest; +import com.whop.api.resources.courses.requests.RetrieveCoursesRequest; +import com.whop.api.resources.courses.requests.UpdateCoursesRequest; +import com.whop.api.types.Course; +import com.whop.api.types.CourseListItem; + +public class CoursesClient { + protected final ClientOptions clientOptions; + + private final RawCoursesClient rawClient; + + public CoursesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawCoursesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawCoursesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public SyncPagingIterable list(ListCoursesRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public SyncPagingIterable list(ListCoursesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Create a new course within an experience, with optional chapters, lessons, and a certificate. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public Course create(CreateCoursesRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Create a new course within an experience, with optional chapters, lessons, and a certificate. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public Course create(CreateCoursesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public Course retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public Course retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public Course retrieve(String id, RetrieveCoursesRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public Course retrieve(String id, RetrieveCoursesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public boolean delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public boolean delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public boolean delete(String id, DeleteCoursesRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public boolean delete(String id, DeleteCoursesRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public Course update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public Course update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public Course update(String id, UpdateCoursesRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public Course update(String id, UpdateCoursesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/courses/RawCoursesClient.java b/src/main/java/com/whop/api/resources/courses/RawCoursesClient.java new file mode 100644 index 00000000..077f6c9d --- /dev/null +++ b/src/main/java/com/whop/api/resources/courses/RawCoursesClient.java @@ -0,0 +1,587 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courses; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.courses.requests.CreateCoursesRequest; +import com.whop.api.resources.courses.requests.DeleteCoursesRequest; +import com.whop.api.resources.courses.requests.ListCoursesRequest; +import com.whop.api.resources.courses.requests.RetrieveCoursesRequest; +import com.whop.api.resources.courses.requests.UpdateCoursesRequest; +import com.whop.api.resources.courses.types.ListCoursesResponse; +import com.whop.api.types.Course; +import com.whop.api.types.CourseListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawCoursesClient { + protected final ClientOptions clientOptions; + + public RawCoursesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse> list() { + return list(ListCoursesRequest.builder().build()); + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListCoursesRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListCoursesRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of courses, filtered by either an experience or a company. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListCoursesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("courses"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getExperienceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "experience_id", request.getExperienceId().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCoursesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCoursesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListCoursesRequest nextRequest = ListCoursesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Create a new course within an experience, with optional chapters, lessons, and a certificate. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse create(CreateCoursesRequest request) { + return create(request, null); + } + + /** + * Create a new course within an experience, with optional chapters, lessons, and a certificate. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse create(CreateCoursesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("courses"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Course.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveCoursesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCoursesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveCoursesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing course. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveCoursesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("courses") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Course.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteCoursesRequest.builder().build()); + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteCoursesRequest.builder().build(), requestOptions); + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id, DeleteCoursesRequest request) { + return delete(id, request, null); + } + + /** + * Permanently delete a course and all of its chapters, lessons, and student progress. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id, DeleteCoursesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("courses") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateCoursesRequest.builder().build()); + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateCoursesRequest.builder().build(), requestOptions); + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateCoursesRequest request) { + return update(id, request, null); + } + + /** + * Update a course's title, description, visibility, thumbnail, or chapter ordering. + *

Required permissions:

+ *
    + *
  • courses:update
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateCoursesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("courses") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Course.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/courses/requests/CreateCoursesRequest.java b/src/main/java/com/whop/api/resources/courses/requests/CreateCoursesRequest.java new file mode 100644 index 00000000..36a550f6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courses/requests/CreateCoursesRequest.java @@ -0,0 +1,610 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courses.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.courses.types.CreateCoursesRequestThumbnail; +import com.whop.api.types.CourseVisibilities; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCoursesRequest.Builder.class) +public final class CreateCoursesRequest { + private final Optional certificateAfterCompletionEnabled; + + private final String experienceId; + + private final Optional order; + + private final Optional requireCompletingLessonsInOrder; + + private final Optional tagline; + + private final Optional thumbnail; + + private final String title; + + private final Optional visibility; + + private final Map additionalProperties; + + private CreateCoursesRequest( + Optional certificateAfterCompletionEnabled, + String experienceId, + Optional order, + Optional requireCompletingLessonsInOrder, + Optional tagline, + Optional thumbnail, + String title, + Optional visibility, + Map additionalProperties) { + this.certificateAfterCompletionEnabled = certificateAfterCompletionEnabled; + this.experienceId = experienceId; + this.order = order; + this.requireCompletingLessonsInOrder = requireCompletingLessonsInOrder; + this.tagline = tagline; + this.thumbnail = thumbnail; + this.title = title; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the course awards students a PDF certificate after completing all lessons. + */ + @JsonIgnore + public Optional getCertificateAfterCompletionEnabled() { + if (certificateAfterCompletionEnabled == null) { + return Optional.empty(); + } + return certificateAfterCompletionEnabled; + } + + /** + * @return The unique identifier of the experience to create the course in (e.g., "exp_XXXXX"). + */ + @JsonProperty("experience_id") + public String getExperienceId() { + return experienceId; + } + + /** + * @return The decimal order position of the course within its experience. Use fractional values (e.g., "1.5") to place between existing courses. + */ + @JsonIgnore + public Optional getOrder() { + if (order == null) { + return Optional.empty(); + } + return order; + } + + /** + * @return Whether students must complete each lesson sequentially before advancing to the next one. + */ + @JsonIgnore + public Optional getRequireCompletingLessonsInOrder() { + if (requireCompletingLessonsInOrder == null) { + return Optional.empty(); + } + return requireCompletingLessonsInOrder; + } + + /** + * @return A short tagline displayed beneath the course title (e.g., "Master the fundamentals of design"). + */ + @JsonIgnore + public Optional getTagline() { + if (tagline == null) { + return Optional.empty(); + } + return tagline; + } + + /** + * @return The thumbnail image for the course in PNG, JPEG, or GIF format. + */ + @JsonIgnore + public Optional getThumbnail() { + if (thumbnail == null) { + return Optional.empty(); + } + return thumbnail; + } + + /** + * @return The display title of the course (e.g., "Introduction to Web Development"). + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return Controls whether this course is visible to students or hidden as a draft. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("certificate_after_completion_enabled") + private Optional _getCertificateAfterCompletionEnabled() { + return certificateAfterCompletionEnabled; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("order") + private Optional _getOrder() { + return order; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("require_completing_lessons_in_order") + private Optional _getRequireCompletingLessonsInOrder() { + return requireCompletingLessonsInOrder; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tagline") + private Optional _getTagline() { + return tagline; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail") + private Optional _getThumbnail() { + return thumbnail; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCoursesRequest && equalTo((CreateCoursesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCoursesRequest other) { + return certificateAfterCompletionEnabled.equals(other.certificateAfterCompletionEnabled) + && experienceId.equals(other.experienceId) + && order.equals(other.order) + && requireCompletingLessonsInOrder.equals(other.requireCompletingLessonsInOrder) + && tagline.equals(other.tagline) + && thumbnail.equals(other.thumbnail) + && title.equals(other.title) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.certificateAfterCompletionEnabled, + this.experienceId, + this.order, + this.requireCompletingLessonsInOrder, + this.tagline, + this.thumbnail, + this.title, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExperienceIdStage builder() { + return new Builder(); + } + + public interface ExperienceIdStage { + /** + *

The unique identifier of the experience to create the course in (e.g., "exp_XXXXX").

+ */ + TitleStage experienceId(@NotNull String experienceId); + + Builder from(CreateCoursesRequest other); + } + + public interface TitleStage { + /** + *

The display title of the course (e.g., "Introduction to Web Development").

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + CreateCoursesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Whether the course awards students a PDF certificate after completing all lessons.

+ */ + _FinalStage certificateAfterCompletionEnabled(Optional certificateAfterCompletionEnabled); + + _FinalStage certificateAfterCompletionEnabled(Boolean certificateAfterCompletionEnabled); + + _FinalStage certificateAfterCompletionEnabled(Nullable certificateAfterCompletionEnabled); + + /** + *

The decimal order position of the course within its experience. Use fractional values (e.g., "1.5") to place between existing courses.

+ */ + _FinalStage order(Optional order); + + _FinalStage order(String order); + + _FinalStage order(Nullable order); + + /** + *

Whether students must complete each lesson sequentially before advancing to the next one.

+ */ + _FinalStage requireCompletingLessonsInOrder(Optional requireCompletingLessonsInOrder); + + _FinalStage requireCompletingLessonsInOrder(Boolean requireCompletingLessonsInOrder); + + _FinalStage requireCompletingLessonsInOrder(Nullable requireCompletingLessonsInOrder); + + /** + *

A short tagline displayed beneath the course title (e.g., "Master the fundamentals of design").

+ */ + _FinalStage tagline(Optional tagline); + + _FinalStage tagline(String tagline); + + _FinalStage tagline(Nullable tagline); + + /** + *

The thumbnail image for the course in PNG, JPEG, or GIF format.

+ */ + _FinalStage thumbnail(Optional thumbnail); + + _FinalStage thumbnail(CreateCoursesRequestThumbnail thumbnail); + + _FinalStage thumbnail(Nullable thumbnail); + + /** + *

Controls whether this course is visible to students or hidden as a draft.

+ */ + _FinalStage visibility(Optional visibility); + + _FinalStage visibility(CourseVisibilities visibility); + + _FinalStage visibility(Nullable visibility); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExperienceIdStage, TitleStage, _FinalStage { + private String experienceId; + + private String title; + + private Optional visibility = Optional.empty(); + + private Optional thumbnail = Optional.empty(); + + private Optional tagline = Optional.empty(); + + private Optional requireCompletingLessonsInOrder = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional certificateAfterCompletionEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCoursesRequest other) { + certificateAfterCompletionEnabled(other.getCertificateAfterCompletionEnabled()); + experienceId(other.getExperienceId()); + order(other.getOrder()); + requireCompletingLessonsInOrder(other.getRequireCompletingLessonsInOrder()); + tagline(other.getTagline()); + thumbnail(other.getThumbnail()); + title(other.getTitle()); + visibility(other.getVisibility()); + return this; + } + + /** + *

The unique identifier of the experience to create the course in (e.g., "exp_XXXXX").

+ *

The unique identifier of the experience to create the course in (e.g., "exp_XXXXX").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("experience_id") + public TitleStage experienceId(@NotNull String experienceId) { + this.experienceId = Objects.requireNonNull(experienceId, "experienceId must not be null"); + return this; + } + + /** + *

The display title of the course (e.g., "Introduction to Web Development").

+ *

The display title of the course (e.g., "Introduction to Web Development").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Controls whether this course is visible to students or hidden as a draft.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + /** + *

Controls whether this course is visible to students or hidden as a draft.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(CourseVisibilities visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + /** + *

Controls whether this course is visible to students or hidden as a draft.

+ */ + @java.lang.Override + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public _FinalStage visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + /** + *

The thumbnail image for the course in PNG, JPEG, or GIF format.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnail(Nullable thumbnail) { + if (thumbnail.isNull()) { + this.thumbnail = null; + } else if (thumbnail.isEmpty()) { + this.thumbnail = Optional.empty(); + } else { + this.thumbnail = Optional.of(thumbnail.get()); + } + return this; + } + + /** + *

The thumbnail image for the course in PNG, JPEG, or GIF format.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnail(CreateCoursesRequestThumbnail thumbnail) { + this.thumbnail = Optional.ofNullable(thumbnail); + return this; + } + + /** + *

The thumbnail image for the course in PNG, JPEG, or GIF format.

+ */ + @java.lang.Override + @JsonSetter(value = "thumbnail", nulls = Nulls.SKIP) + public _FinalStage thumbnail(Optional thumbnail) { + this.thumbnail = thumbnail; + return this; + } + + /** + *

A short tagline displayed beneath the course title (e.g., "Master the fundamentals of design").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tagline(Nullable tagline) { + if (tagline.isNull()) { + this.tagline = null; + } else if (tagline.isEmpty()) { + this.tagline = Optional.empty(); + } else { + this.tagline = Optional.of(tagline.get()); + } + return this; + } + + /** + *

A short tagline displayed beneath the course title (e.g., "Master the fundamentals of design").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tagline(String tagline) { + this.tagline = Optional.ofNullable(tagline); + return this; + } + + /** + *

A short tagline displayed beneath the course title (e.g., "Master the fundamentals of design").

+ */ + @java.lang.Override + @JsonSetter(value = "tagline", nulls = Nulls.SKIP) + public _FinalStage tagline(Optional tagline) { + this.tagline = tagline; + return this; + } + + /** + *

Whether students must complete each lesson sequentially before advancing to the next one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requireCompletingLessonsInOrder(Nullable requireCompletingLessonsInOrder) { + if (requireCompletingLessonsInOrder.isNull()) { + this.requireCompletingLessonsInOrder = null; + } else if (requireCompletingLessonsInOrder.isEmpty()) { + this.requireCompletingLessonsInOrder = Optional.empty(); + } else { + this.requireCompletingLessonsInOrder = Optional.of(requireCompletingLessonsInOrder.get()); + } + return this; + } + + /** + *

Whether students must complete each lesson sequentially before advancing to the next one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requireCompletingLessonsInOrder(Boolean requireCompletingLessonsInOrder) { + this.requireCompletingLessonsInOrder = Optional.ofNullable(requireCompletingLessonsInOrder); + return this; + } + + /** + *

Whether students must complete each lesson sequentially before advancing to the next one.

+ */ + @java.lang.Override + @JsonSetter(value = "require_completing_lessons_in_order", nulls = Nulls.SKIP) + public _FinalStage requireCompletingLessonsInOrder(Optional requireCompletingLessonsInOrder) { + this.requireCompletingLessonsInOrder = requireCompletingLessonsInOrder; + return this; + } + + /** + *

The decimal order position of the course within its experience. Use fractional values (e.g., "1.5") to place between existing courses.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(Nullable order) { + if (order.isNull()) { + this.order = null; + } else if (order.isEmpty()) { + this.order = Optional.empty(); + } else { + this.order = Optional.of(order.get()); + } + return this; + } + + /** + *

The decimal order position of the course within its experience. Use fractional values (e.g., "1.5") to place between existing courses.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(String order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The decimal order position of the course within its experience. Use fractional values (e.g., "1.5") to place between existing courses.

+ */ + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + /** + *

Whether the course awards students a PDF certificate after completing all lessons.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage certificateAfterCompletionEnabled(Nullable certificateAfterCompletionEnabled) { + if (certificateAfterCompletionEnabled.isNull()) { + this.certificateAfterCompletionEnabled = null; + } else if (certificateAfterCompletionEnabled.isEmpty()) { + this.certificateAfterCompletionEnabled = Optional.empty(); + } else { + this.certificateAfterCompletionEnabled = Optional.of(certificateAfterCompletionEnabled.get()); + } + return this; + } + + /** + *

Whether the course awards students a PDF certificate after completing all lessons.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage certificateAfterCompletionEnabled(Boolean certificateAfterCompletionEnabled) { + this.certificateAfterCompletionEnabled = Optional.ofNullable(certificateAfterCompletionEnabled); + return this; + } + + /** + *

Whether the course awards students a PDF certificate after completing all lessons.

+ */ + @java.lang.Override + @JsonSetter(value = "certificate_after_completion_enabled", nulls = Nulls.SKIP) + public _FinalStage certificateAfterCompletionEnabled(Optional certificateAfterCompletionEnabled) { + this.certificateAfterCompletionEnabled = certificateAfterCompletionEnabled; + return this; + } + + @java.lang.Override + public CreateCoursesRequest build() { + return new CreateCoursesRequest( + certificateAfterCompletionEnabled, + experienceId, + order, + requireCompletingLessonsInOrder, + tagline, + thumbnail, + title, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courses/requests/DeleteCoursesRequest.java b/src/main/java/com/whop/api/resources/courses/requests/DeleteCoursesRequest.java new file mode 100644 index 00000000..38f3bce1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courses/requests/DeleteCoursesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courses.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteCoursesRequest.Builder.class) +public final class DeleteCoursesRequest { + private final Map additionalProperties; + + private DeleteCoursesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteCoursesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteCoursesRequest other) { + return this; + } + + public DeleteCoursesRequest build() { + return new DeleteCoursesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courses/requests/ListCoursesRequest.java b/src/main/java/com/whop/api/resources/courses/requests/ListCoursesRequest.java new file mode 100644 index 00000000..4ff51fcb --- /dev/null +++ b/src/main/java/com/whop/api/resources/courses/requests/ListCoursesRequest.java @@ -0,0 +1,263 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courses.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCoursesRequest.Builder.class) +public final class ListCoursesRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Optional experienceId; + + private final Optional companyId; + + private final Map additionalProperties; + + private ListCoursesRequest( + Optional after, + Optional before, + Optional first, + Optional last, + Optional experienceId, + Optional companyId, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.experienceId = experienceId; + this.companyId = companyId; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the experience to list courses for. + */ + @JsonProperty("experience_id") + public Optional getExperienceId() { + return experienceId; + } + + /** + * @return The unique identifier of the company to list courses for. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCoursesRequest && equalTo((ListCoursesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCoursesRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && experienceId.equals(other.experienceId) + && companyId.equals(other.companyId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last, this.experienceId, this.companyId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional experienceId = Optional.empty(); + + private Optional companyId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListCoursesRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + experienceId(other.getExperienceId()); + companyId(other.getCompanyId()); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The unique identifier of the experience to list courses for.

+ */ + @JsonSetter(value = "experience_id", nulls = Nulls.SKIP) + public Builder experienceId(Optional experienceId) { + this.experienceId = experienceId; + return this; + } + + public Builder experienceId(String experienceId) { + this.experienceId = Optional.ofNullable(experienceId); + return this; + } + + /** + *

The unique identifier of the company to list courses for.

+ */ + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + public ListCoursesRequest build() { + return new ListCoursesRequest(after, before, first, last, experienceId, companyId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courses/requests/RetrieveCoursesRequest.java b/src/main/java/com/whop/api/resources/courses/requests/RetrieveCoursesRequest.java new file mode 100644 index 00000000..6e72f619 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courses/requests/RetrieveCoursesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courses.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCoursesRequest.Builder.class) +public final class RetrieveCoursesRequest { + private final Map additionalProperties; + + private RetrieveCoursesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCoursesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveCoursesRequest other) { + return this; + } + + public RetrieveCoursesRequest build() { + return new RetrieveCoursesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courses/requests/UpdateCoursesRequest.java b/src/main/java/com/whop/api/resources/courses/requests/UpdateCoursesRequest.java new file mode 100644 index 00000000..ed09556a --- /dev/null +++ b/src/main/java/com/whop/api/resources/courses/requests/UpdateCoursesRequest.java @@ -0,0 +1,612 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courses.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.courses.types.UpdateCoursesRequestChaptersItem; +import com.whop.api.resources.courses.types.UpdateCoursesRequestThumbnail; +import com.whop.api.types.CourseVisibilities; +import com.whop.api.types.Languages; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCoursesRequest.Builder.class) +public final class UpdateCoursesRequest { + private final Optional certificateAfterCompletionEnabled; + + private final Optional> chapters; + + private final Optional description; + + private final Optional language; + + private final Optional order; + + private final Optional requireCompletingLessonsInOrder; + + private final Optional tagline; + + private final Optional thumbnail; + + private final Optional title; + + private final Optional visibility; + + private final Map additionalProperties; + + private UpdateCoursesRequest( + Optional certificateAfterCompletionEnabled, + Optional> chapters, + Optional description, + Optional language, + Optional order, + Optional requireCompletingLessonsInOrder, + Optional tagline, + Optional thumbnail, + Optional title, + Optional visibility, + Map additionalProperties) { + this.certificateAfterCompletionEnabled = certificateAfterCompletionEnabled; + this.chapters = chapters; + this.description = description; + this.language = language; + this.order = order; + this.requireCompletingLessonsInOrder = requireCompletingLessonsInOrder; + this.tagline = tagline; + this.thumbnail = thumbnail; + this.title = title; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the course awards students a PDF certificate after completing all lessons. + */ + @JsonIgnore + public Optional getCertificateAfterCompletionEnabled() { + if (certificateAfterCompletionEnabled == null) { + return Optional.empty(); + } + return certificateAfterCompletionEnabled; + } + + /** + * @return A list of chapters with nested lessons to reorder or rename in bulk. + */ + @JsonIgnore + public Optional> getChapters() { + if (chapters == null) { + return Optional.empty(); + } + return chapters; + } + + /** + * @return A short description of the course displayed to students on the course page. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The primary language spoken in the video content of the course. + */ + @JsonIgnore + public Optional getLanguage() { + if (language == null) { + return Optional.empty(); + } + return language; + } + + /** + * @return The decimal order position of the course within its experience. Use fractional values (e.g., "1.5") to place between existing courses. + */ + @JsonIgnore + public Optional getOrder() { + if (order == null) { + return Optional.empty(); + } + return order; + } + + /** + * @return Whether students must complete each lesson sequentially before advancing to the next one. + */ + @JsonIgnore + public Optional getRequireCompletingLessonsInOrder() { + if (requireCompletingLessonsInOrder == null) { + return Optional.empty(); + } + return requireCompletingLessonsInOrder; + } + + /** + * @return A short tagline displayed beneath the course title (e.g., "Master the fundamentals of design"). + */ + @JsonIgnore + public Optional getTagline() { + if (tagline == null) { + return Optional.empty(); + } + return tagline; + } + + /** + * @return The thumbnail image for the course in PNG, JPEG, or GIF format. + */ + @JsonIgnore + public Optional getThumbnail() { + if (thumbnail == null) { + return Optional.empty(); + } + return thumbnail; + } + + /** + * @return The display title of the course (e.g., "Introduction to Web Development"). + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return Controls whether this course is visible to students or hidden as a draft. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("certificate_after_completion_enabled") + private Optional _getCertificateAfterCompletionEnabled() { + return certificateAfterCompletionEnabled; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("chapters") + private Optional> _getChapters() { + return chapters; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("language") + private Optional _getLanguage() { + return language; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("order") + private Optional _getOrder() { + return order; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("require_completing_lessons_in_order") + private Optional _getRequireCompletingLessonsInOrder() { + return requireCompletingLessonsInOrder; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tagline") + private Optional _getTagline() { + return tagline; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail") + private Optional _getThumbnail() { + return thumbnail; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCoursesRequest && equalTo((UpdateCoursesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCoursesRequest other) { + return certificateAfterCompletionEnabled.equals(other.certificateAfterCompletionEnabled) + && chapters.equals(other.chapters) + && description.equals(other.description) + && language.equals(other.language) + && order.equals(other.order) + && requireCompletingLessonsInOrder.equals(other.requireCompletingLessonsInOrder) + && tagline.equals(other.tagline) + && thumbnail.equals(other.thumbnail) + && title.equals(other.title) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.certificateAfterCompletionEnabled, + this.chapters, + this.description, + this.language, + this.order, + this.requireCompletingLessonsInOrder, + this.tagline, + this.thumbnail, + this.title, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional certificateAfterCompletionEnabled = Optional.empty(); + + private Optional> chapters = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional requireCompletingLessonsInOrder = Optional.empty(); + + private Optional tagline = Optional.empty(); + + private Optional thumbnail = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional visibility = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateCoursesRequest other) { + certificateAfterCompletionEnabled(other.getCertificateAfterCompletionEnabled()); + chapters(other.getChapters()); + description(other.getDescription()); + language(other.getLanguage()); + order(other.getOrder()); + requireCompletingLessonsInOrder(other.getRequireCompletingLessonsInOrder()); + tagline(other.getTagline()); + thumbnail(other.getThumbnail()); + title(other.getTitle()); + visibility(other.getVisibility()); + return this; + } + + /** + *

Whether the course awards students a PDF certificate after completing all lessons.

+ */ + @JsonSetter(value = "certificate_after_completion_enabled", nulls = Nulls.SKIP) + public Builder certificateAfterCompletionEnabled(Optional certificateAfterCompletionEnabled) { + this.certificateAfterCompletionEnabled = certificateAfterCompletionEnabled; + return this; + } + + public Builder certificateAfterCompletionEnabled(Boolean certificateAfterCompletionEnabled) { + this.certificateAfterCompletionEnabled = Optional.ofNullable(certificateAfterCompletionEnabled); + return this; + } + + public Builder certificateAfterCompletionEnabled(Nullable certificateAfterCompletionEnabled) { + if (certificateAfterCompletionEnabled.isNull()) { + this.certificateAfterCompletionEnabled = null; + } else if (certificateAfterCompletionEnabled.isEmpty()) { + this.certificateAfterCompletionEnabled = Optional.empty(); + } else { + this.certificateAfterCompletionEnabled = Optional.of(certificateAfterCompletionEnabled.get()); + } + return this; + } + + /** + *

A list of chapters with nested lessons to reorder or rename in bulk.

+ */ + @JsonSetter(value = "chapters", nulls = Nulls.SKIP) + public Builder chapters(Optional> chapters) { + this.chapters = chapters; + return this; + } + + public Builder chapters(List chapters) { + this.chapters = Optional.ofNullable(chapters); + return this; + } + + public Builder chapters(Nullable> chapters) { + if (chapters.isNull()) { + this.chapters = null; + } else if (chapters.isEmpty()) { + this.chapters = Optional.empty(); + } else { + this.chapters = Optional.of(chapters.get()); + } + return this; + } + + /** + *

A short description of the course displayed to students on the course page.

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public Builder description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

The primary language spoken in the video content of the course.

+ */ + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public Builder language(Optional language) { + this.language = language; + return this; + } + + public Builder language(Languages language) { + this.language = Optional.ofNullable(language); + return this; + } + + public Builder language(Nullable language) { + if (language.isNull()) { + this.language = null; + } else if (language.isEmpty()) { + this.language = Optional.empty(); + } else { + this.language = Optional.of(language.get()); + } + return this; + } + + /** + *

The decimal order position of the course within its experience. Use fractional values (e.g., "1.5") to place between existing courses.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(String order) { + this.order = Optional.ofNullable(order); + return this; + } + + public Builder order(Nullable order) { + if (order.isNull()) { + this.order = null; + } else if (order.isEmpty()) { + this.order = Optional.empty(); + } else { + this.order = Optional.of(order.get()); + } + return this; + } + + /** + *

Whether students must complete each lesson sequentially before advancing to the next one.

+ */ + @JsonSetter(value = "require_completing_lessons_in_order", nulls = Nulls.SKIP) + public Builder requireCompletingLessonsInOrder(Optional requireCompletingLessonsInOrder) { + this.requireCompletingLessonsInOrder = requireCompletingLessonsInOrder; + return this; + } + + public Builder requireCompletingLessonsInOrder(Boolean requireCompletingLessonsInOrder) { + this.requireCompletingLessonsInOrder = Optional.ofNullable(requireCompletingLessonsInOrder); + return this; + } + + public Builder requireCompletingLessonsInOrder(Nullable requireCompletingLessonsInOrder) { + if (requireCompletingLessonsInOrder.isNull()) { + this.requireCompletingLessonsInOrder = null; + } else if (requireCompletingLessonsInOrder.isEmpty()) { + this.requireCompletingLessonsInOrder = Optional.empty(); + } else { + this.requireCompletingLessonsInOrder = Optional.of(requireCompletingLessonsInOrder.get()); + } + return this; + } + + /** + *

A short tagline displayed beneath the course title (e.g., "Master the fundamentals of design").

+ */ + @JsonSetter(value = "tagline", nulls = Nulls.SKIP) + public Builder tagline(Optional tagline) { + this.tagline = tagline; + return this; + } + + public Builder tagline(String tagline) { + this.tagline = Optional.ofNullable(tagline); + return this; + } + + public Builder tagline(Nullable tagline) { + if (tagline.isNull()) { + this.tagline = null; + } else if (tagline.isEmpty()) { + this.tagline = Optional.empty(); + } else { + this.tagline = Optional.of(tagline.get()); + } + return this; + } + + /** + *

The thumbnail image for the course in PNG, JPEG, or GIF format.

+ */ + @JsonSetter(value = "thumbnail", nulls = Nulls.SKIP) + public Builder thumbnail(Optional thumbnail) { + this.thumbnail = thumbnail; + return this; + } + + public Builder thumbnail(UpdateCoursesRequestThumbnail thumbnail) { + this.thumbnail = Optional.ofNullable(thumbnail); + return this; + } + + public Builder thumbnail(Nullable thumbnail) { + if (thumbnail.isNull()) { + this.thumbnail = null; + } else if (thumbnail.isEmpty()) { + this.thumbnail = Optional.empty(); + } else { + this.thumbnail = Optional.of(thumbnail.get()); + } + return this; + } + + /** + *

The display title of the course (e.g., "Introduction to Web Development").

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Controls whether this course is visible to students or hidden as a draft.

+ */ + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public Builder visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + public Builder visibility(CourseVisibilities visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + public Builder visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + public UpdateCoursesRequest build() { + return new UpdateCoursesRequest( + certificateAfterCompletionEnabled, + chapters, + description, + language, + order, + requireCompletingLessonsInOrder, + tagline, + thumbnail, + title, + visibility, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courses/types/CreateCoursesRequestThumbnail.java b/src/main/java/com/whop/api/resources/courses/types/CreateCoursesRequestThumbnail.java new file mode 100644 index 00000000..7357ab0d --- /dev/null +++ b/src/main/java/com/whop/api/resources/courses/types/CreateCoursesRequestThumbnail.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCoursesRequestThumbnail.Builder.class) +public final class CreateCoursesRequestThumbnail { + private final String id; + + private final Map additionalProperties; + + private CreateCoursesRequestThumbnail(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCoursesRequestThumbnail && equalTo((CreateCoursesRequestThumbnail) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCoursesRequestThumbnail other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CreateCoursesRequestThumbnail other); + } + + public interface _FinalStage { + CreateCoursesRequestThumbnail build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCoursesRequestThumbnail other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CreateCoursesRequestThumbnail build() { + return new CreateCoursesRequestThumbnail(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courses/types/ListCoursesResponse.java b/src/main/java/com/whop/api/resources/courses/types/ListCoursesResponse.java new file mode 100644 index 00000000..5b438352 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courses/types/ListCoursesResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CourseListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCoursesResponse.Builder.class) +public final class ListCoursesResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListCoursesResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCoursesResponse && equalTo((ListCoursesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCoursesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListCoursesResponse other); + } + + public interface _FinalStage { + ListCoursesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(CourseListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCoursesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(CourseListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListCoursesResponse build() { + return new ListCoursesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courses/types/UpdateCoursesRequestChaptersItem.java b/src/main/java/com/whop/api/resources/courses/types/UpdateCoursesRequestChaptersItem.java new file mode 100644 index 00000000..56d4123c --- /dev/null +++ b/src/main/java/com/whop/api/resources/courses/types/UpdateCoursesRequestChaptersItem.java @@ -0,0 +1,277 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCoursesRequestChaptersItem.Builder.class) +public final class UpdateCoursesRequestChaptersItem { + private final String id; + + private final Optional> lessons; + + private final int order; + + private final String title; + + private final Map additionalProperties; + + private UpdateCoursesRequestChaptersItem( + String id, + Optional> lessons, + int order, + String title, + Map additionalProperties) { + this.id = id; + this.lessons = lessons; + this.order = order; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the chapter to update + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The lessons to update within this chapter + */ + @JsonIgnore + public Optional> getLessons() { + if (lessons == null) { + return Optional.empty(); + } + return lessons; + } + + /** + * @return The order of the chapter within its course + */ + @JsonProperty("order") + public int getOrder() { + return order; + } + + /** + * @return The title of the chapter + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("lessons") + private Optional> _getLessons() { + return lessons; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCoursesRequestChaptersItem && equalTo((UpdateCoursesRequestChaptersItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCoursesRequestChaptersItem other) { + return id.equals(other.id) + && lessons.equals(other.lessons) + && order == other.order + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.lessons, this.order, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of the chapter to update

+ */ + OrderStage id(@NotNull String id); + + Builder from(UpdateCoursesRequestChaptersItem other); + } + + public interface OrderStage { + /** + *

The order of the chapter within its course

+ */ + TitleStage order(int order); + } + + public interface TitleStage { + /** + *

The title of the chapter

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + UpdateCoursesRequestChaptersItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The lessons to update within this chapter

+ */ + _FinalStage lessons(Optional> lessons); + + _FinalStage lessons(List lessons); + + _FinalStage lessons(Nullable> lessons); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrderStage, TitleStage, _FinalStage { + private String id; + + private int order; + + private String title; + + private Optional> lessons = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCoursesRequestChaptersItem other) { + id(other.getId()); + lessons(other.getLessons()); + order(other.getOrder()); + title(other.getTitle()); + return this; + } + + /** + *

The ID of the chapter to update

+ *

The ID of the chapter to update

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrderStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The order of the chapter within its course

+ *

The order of the chapter within its course

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("order") + public TitleStage order(int order) { + this.order = order; + return this; + } + + /** + *

The title of the chapter

+ *

The title of the chapter

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

The lessons to update within this chapter

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lessons(Nullable> lessons) { + if (lessons.isNull()) { + this.lessons = null; + } else if (lessons.isEmpty()) { + this.lessons = Optional.empty(); + } else { + this.lessons = Optional.of(lessons.get()); + } + return this; + } + + /** + *

The lessons to update within this chapter

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lessons(List lessons) { + this.lessons = Optional.ofNullable(lessons); + return this; + } + + /** + *

The lessons to update within this chapter

+ */ + @java.lang.Override + @JsonSetter(value = "lessons", nulls = Nulls.SKIP) + public _FinalStage lessons(Optional> lessons) { + this.lessons = lessons; + return this; + } + + @java.lang.Override + public UpdateCoursesRequestChaptersItem build() { + return new UpdateCoursesRequestChaptersItem(id, lessons, order, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courses/types/UpdateCoursesRequestChaptersItemLessonsItem.java b/src/main/java/com/whop/api/resources/courses/types/UpdateCoursesRequestChaptersItemLessonsItem.java new file mode 100644 index 00000000..3eeb8cdd --- /dev/null +++ b/src/main/java/com/whop/api/resources/courses/types/UpdateCoursesRequestChaptersItemLessonsItem.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCoursesRequestChaptersItemLessonsItem.Builder.class) +public final class UpdateCoursesRequestChaptersItemLessonsItem { + private final String chapterId; + + private final String id; + + private final int order; + + private final String title; + + private final Map additionalProperties; + + private UpdateCoursesRequestChaptersItemLessonsItem( + String chapterId, String id, int order, String title, Map additionalProperties) { + this.chapterId = chapterId; + this.id = id; + this.order = order; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the chapter this lesson belongs to (for moving between chapters) + */ + @JsonProperty("chapter_id") + public String getChapterId() { + return chapterId; + } + + /** + * @return The ID of the lesson to update + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The order of the lesson within its chapter + */ + @JsonProperty("order") + public int getOrder() { + return order; + } + + /** + * @return The title of the lesson + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCoursesRequestChaptersItemLessonsItem + && equalTo((UpdateCoursesRequestChaptersItemLessonsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCoursesRequestChaptersItemLessonsItem other) { + return chapterId.equals(other.chapterId) + && id.equals(other.id) + && order == other.order + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.chapterId, this.id, this.order, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChapterIdStage builder() { + return new Builder(); + } + + public interface ChapterIdStage { + /** + *

The ID of the chapter this lesson belongs to (for moving between chapters)

+ */ + IdStage chapterId(@NotNull String chapterId); + + Builder from(UpdateCoursesRequestChaptersItemLessonsItem other); + } + + public interface IdStage { + /** + *

The ID of the lesson to update

+ */ + OrderStage id(@NotNull String id); + } + + public interface OrderStage { + /** + *

The order of the lesson within its chapter

+ */ + TitleStage order(int order); + } + + public interface TitleStage { + /** + *

The title of the lesson

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + UpdateCoursesRequestChaptersItemLessonsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ChapterIdStage, IdStage, OrderStage, TitleStage, _FinalStage { + private String chapterId; + + private String id; + + private int order; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCoursesRequestChaptersItemLessonsItem other) { + chapterId(other.getChapterId()); + id(other.getId()); + order(other.getOrder()); + title(other.getTitle()); + return this; + } + + /** + *

The ID of the chapter this lesson belongs to (for moving between chapters)

+ *

The ID of the chapter this lesson belongs to (for moving between chapters)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("chapter_id") + public IdStage chapterId(@NotNull String chapterId) { + this.chapterId = Objects.requireNonNull(chapterId, "chapterId must not be null"); + return this; + } + + /** + *

The ID of the lesson to update

+ *

The ID of the lesson to update

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrderStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The order of the lesson within its chapter

+ *

The order of the lesson within its chapter

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("order") + public TitleStage order(int order) { + this.order = order; + return this; + } + + /** + *

The title of the lesson

+ *

The title of the lesson

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public UpdateCoursesRequestChaptersItemLessonsItem build() { + return new UpdateCoursesRequestChaptersItemLessonsItem(chapterId, id, order, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/courses/types/UpdateCoursesRequestThumbnail.java b/src/main/java/com/whop/api/resources/courses/types/UpdateCoursesRequestThumbnail.java new file mode 100644 index 00000000..546f5d74 --- /dev/null +++ b/src/main/java/com/whop/api/resources/courses/types/UpdateCoursesRequestThumbnail.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.courses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCoursesRequestThumbnail.Builder.class) +public final class UpdateCoursesRequestThumbnail { + private final String id; + + private final Map additionalProperties; + + private UpdateCoursesRequestThumbnail(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCoursesRequestThumbnail && equalTo((UpdateCoursesRequestThumbnail) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCoursesRequestThumbnail other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateCoursesRequestThumbnail other); + } + + public interface _FinalStage { + UpdateCoursesRequestThumbnail build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCoursesRequestThumbnail other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateCoursesRequestThumbnail build() { + return new UpdateCoursesRequestThumbnail(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/coursestudents/AsyncCourseStudentsClient.java b/src/main/java/com/whop/api/resources/coursestudents/AsyncCourseStudentsClient.java new file mode 100644 index 00000000..6be47273 --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursestudents/AsyncCourseStudentsClient.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursestudents; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.coursestudents.requests.ListCourseStudentsRequest; +import com.whop.api.resources.coursestudents.requests.RetrieveCourseStudentsRequest; +import com.whop.api.types.CourseStudent; +import com.whop.api.types.CourseStudentListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncCourseStudentsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawCourseStudentsClient rawClient; + + public AsyncCourseStudentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawCourseStudentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawCourseStudentsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of students enrolled in a course, with optional name filtering. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture> list(ListCourseStudentsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of students enrolled in a course, with optional name filtering. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture> list( + ListCourseStudentsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveCourseStudentsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveCourseStudentsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/coursestudents/AsyncRawCourseStudentsClient.java b/src/main/java/com/whop/api/resources/coursestudents/AsyncRawCourseStudentsClient.java new file mode 100644 index 00000000..bbb9a031 --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursestudents/AsyncRawCourseStudentsClient.java @@ -0,0 +1,335 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursestudents; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.coursestudents.requests.ListCourseStudentsRequest; +import com.whop.api.resources.coursestudents.requests.RetrieveCourseStudentsRequest; +import com.whop.api.resources.coursestudents.types.ListCourseStudentsResponse; +import com.whop.api.types.CourseStudent; +import com.whop.api.types.CourseStudentListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawCourseStudentsClient { + protected final ClientOptions clientOptions; + + public AsyncRawCourseStudentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of students enrolled in a course, with optional name filtering. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture>> list( + ListCourseStudentsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of students enrolled in a course, with optional name filtering. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture>> list( + ListCourseStudentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_students"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "course_id", request.getCourseId(), false); + if (request.getKeyword().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keyword", request.getKeyword().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCourseStudentsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListCourseStudentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListCourseStudentsRequest nextRequest = ListCourseStudentsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveCourseStudentsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCourseStudentsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveCourseStudentsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveCourseStudentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_students") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseStudent.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/coursestudents/CourseStudentsClient.java b/src/main/java/com/whop/api/resources/coursestudents/CourseStudentsClient.java new file mode 100644 index 00000000..589e12de --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursestudents/CourseStudentsClient.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursestudents; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.coursestudents.requests.ListCourseStudentsRequest; +import com.whop.api.resources.coursestudents.requests.RetrieveCourseStudentsRequest; +import com.whop.api.types.CourseStudent; +import com.whop.api.types.CourseStudentListItem; + +public class CourseStudentsClient { + protected final ClientOptions clientOptions; + + private final RawCourseStudentsClient rawClient; + + public CourseStudentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawCourseStudentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawCourseStudentsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of students enrolled in a course, with optional name filtering. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public SyncPagingIterable list(ListCourseStudentsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of students enrolled in a course, with optional name filtering. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public SyncPagingIterable list( + ListCourseStudentsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CourseStudent retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CourseStudent retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CourseStudent retrieve(String id, RetrieveCourseStudentsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public CourseStudent retrieve(String id, RetrieveCourseStudentsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/coursestudents/RawCourseStudentsClient.java b/src/main/java/com/whop/api/resources/coursestudents/RawCourseStudentsClient.java new file mode 100644 index 00000000..6198d4d9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursestudents/RawCourseStudentsClient.java @@ -0,0 +1,264 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursestudents; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.coursestudents.requests.ListCourseStudentsRequest; +import com.whop.api.resources.coursestudents.requests.RetrieveCourseStudentsRequest; +import com.whop.api.resources.coursestudents.types.ListCourseStudentsResponse; +import com.whop.api.types.CourseStudent; +import com.whop.api.types.CourseStudentListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawCourseStudentsClient { + protected final ClientOptions clientOptions; + + public RawCourseStudentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of students enrolled in a course, with optional name filtering. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListCourseStudentsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of students enrolled in a course, with optional name filtering. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListCourseStudentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_students"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "course_id", request.getCourseId(), false); + if (request.getKeyword().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keyword", request.getKeyword().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListCourseStudentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCourseStudentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListCourseStudentsRequest nextRequest = ListCourseStudentsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveCourseStudentsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveCourseStudentsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveCourseStudentsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing course student. + *

Required permissions:

+ *
    + *
  • courses:read
  • + *
  • course_analytics:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveCourseStudentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("course_students") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CourseStudent.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/coursestudents/requests/ListCourseStudentsRequest.java b/src/main/java/com/whop/api/resources/coursestudents/requests/ListCourseStudentsRequest.java new file mode 100644 index 00000000..0b1ef37e --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursestudents/requests/ListCourseStudentsRequest.java @@ -0,0 +1,348 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursestudents.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCourseStudentsRequest.Builder.class) +public final class ListCourseStudentsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String courseId; + + private final Optional keyword; + + private final Map additionalProperties; + + private ListCourseStudentsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String courseId, + Optional keyword, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.courseId = courseId; + this.keyword = keyword; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the course to list enrolled students for. + */ + @JsonProperty("course_id") + public String getCourseId() { + return courseId; + } + + /** + * @return A search term to filter students by name or username. + */ + @JsonProperty("keyword") + public Optional getKeyword() { + return keyword; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCourseStudentsRequest && equalTo((ListCourseStudentsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCourseStudentsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && courseId.equals(other.courseId) + && keyword.equals(other.keyword); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last, this.courseId, this.keyword); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CourseIdStage builder() { + return new Builder(); + } + + public interface CourseIdStage { + /** + *

The unique identifier of the course to list enrolled students for.

+ */ + _FinalStage courseId(@NotNull String courseId); + + Builder from(ListCourseStudentsRequest other); + } + + public interface _FinalStage { + ListCourseStudentsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + /** + *

A search term to filter students by name or username.

+ */ + _FinalStage keyword(Optional keyword); + + _FinalStage keyword(String keyword); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CourseIdStage, _FinalStage { + private String courseId; + + private Optional keyword = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCourseStudentsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + courseId(other.getCourseId()); + keyword(other.getKeyword()); + return this; + } + + /** + *

The unique identifier of the course to list enrolled students for.

+ *

The unique identifier of the course to list enrolled students for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("course_id") + public _FinalStage courseId(@NotNull String courseId) { + this.courseId = Objects.requireNonNull(courseId, "courseId must not be null"); + return this; + } + + /** + *

A search term to filter students by name or username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage keyword(String keyword) { + this.keyword = Optional.ofNullable(keyword); + return this; + } + + /** + *

A search term to filter students by name or username.

+ */ + @java.lang.Override + @JsonSetter(value = "keyword", nulls = Nulls.SKIP) + public _FinalStage keyword(Optional keyword) { + this.keyword = keyword; + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListCourseStudentsRequest build() { + return new ListCourseStudentsRequest(after, before, first, last, courseId, keyword, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/coursestudents/requests/RetrieveCourseStudentsRequest.java b/src/main/java/com/whop/api/resources/coursestudents/requests/RetrieveCourseStudentsRequest.java new file mode 100644 index 00000000..59e26cab --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursestudents/requests/RetrieveCourseStudentsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursestudents.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveCourseStudentsRequest.Builder.class) +public final class RetrieveCourseStudentsRequest { + private final Map additionalProperties; + + private RetrieveCourseStudentsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveCourseStudentsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveCourseStudentsRequest other) { + return this; + } + + public RetrieveCourseStudentsRequest build() { + return new RetrieveCourseStudentsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/coursestudents/types/ListCourseStudentsResponse.java b/src/main/java/com/whop/api/resources/coursestudents/types/ListCourseStudentsResponse.java new file mode 100644 index 00000000..81a82271 --- /dev/null +++ b/src/main/java/com/whop/api/resources/coursestudents/types/ListCourseStudentsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.coursestudents.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CourseStudentListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCourseStudentsResponse.Builder.class) +public final class ListCourseStudentsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListCourseStudentsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCourseStudentsResponse && equalTo((ListCourseStudentsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCourseStudentsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListCourseStudentsResponse other); + } + + public interface _FinalStage { + ListCourseStudentsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(CourseStudentListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCourseStudentsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(CourseStudentListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListCourseStudentsResponse build() { + return new ListCourseStudentsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/AsyncDepositsClient.java b/src/main/java/com/whop/api/resources/deposits/AsyncDepositsClient.java new file mode 100644 index 00000000..ad658a56 --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/AsyncDepositsClient.java @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.deposits.requests.CreateDepositsRequest; +import com.whop.api.resources.deposits.types.CreateDepositsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncDepositsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawDepositsClient rawClient; + + public AsyncDepositsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawDepositsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawDepositsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieve the deposit methods for an account, including crypto and bank transfer. + */ + public CompletableFuture create(CreateDepositsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Retrieve the deposit methods for an account, including crypto and bank transfer. + */ + public CompletableFuture create( + CreateDepositsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/AsyncRawDepositsClient.java b/src/main/java/com/whop/api/resources/deposits/AsyncRawDepositsClient.java new file mode 100644 index 00000000..ac6b1233 --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/AsyncRawDepositsClient.java @@ -0,0 +1,121 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.resources.deposits.requests.CreateDepositsRequest; +import com.whop.api.resources.deposits.types.CreateDepositsResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawDepositsClient { + protected final ClientOptions clientOptions; + + public AsyncRawDepositsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieve the deposit methods for an account, including crypto and bank transfer. + */ + public CompletableFuture> create(CreateDepositsRequest request) { + return create(request, null); + } + + /** + * Retrieve the deposit methods for an account, including crypto and bank transfer. + */ + public CompletableFuture> create( + CreateDepositsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("deposits"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateDepositsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/DepositsClient.java b/src/main/java/com/whop/api/resources/deposits/DepositsClient.java new file mode 100644 index 00000000..4031d6e3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/DepositsClient.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.deposits.requests.CreateDepositsRequest; +import com.whop.api.resources.deposits.types.CreateDepositsResponse; + +public class DepositsClient { + protected final ClientOptions clientOptions; + + private final RawDepositsClient rawClient; + + public DepositsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawDepositsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawDepositsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieve the deposit methods for an account, including crypto and bank transfer. + */ + public CreateDepositsResponse create(CreateDepositsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Retrieve the deposit methods for an account, including crypto and bank transfer. + */ + public CreateDepositsResponse create(CreateDepositsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/RawDepositsClient.java b/src/main/java/com/whop/api/resources/deposits/RawDepositsClient.java new file mode 100644 index 00000000..1cfcb32b --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/RawDepositsClient.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.resources.deposits.requests.CreateDepositsRequest; +import com.whop.api.resources.deposits.types.CreateDepositsResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawDepositsClient { + protected final ClientOptions clientOptions; + + public RawDepositsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieve the deposit methods for an account, including crypto and bank transfer. + */ + public WhopApiHttpResponse create(CreateDepositsRequest request) { + return create(request, null); + } + + /** + * Retrieve the deposit methods for an account, including crypto and bank transfer. + */ + public WhopApiHttpResponse create( + CreateDepositsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("deposits"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateDepositsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/requests/CreateDepositsRequest.java b/src/main/java/com/whop/api/resources/deposits/requests/CreateDepositsRequest.java new file mode 100644 index 00000000..fd494176 --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/requests/CreateDepositsRequest.java @@ -0,0 +1,294 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.deposits.types.CreateDepositsRequestDestination; +import com.whop.api.resources.deposits.types.CreateDepositsRequestNetwork; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateDepositsRequest.Builder.class) +public final class CreateDepositsRequest { + private final Optional amount; + + private final CreateDepositsRequestDestination destination; + + private final Optional> metadata; + + private final Optional network; + + private final Map additionalProperties; + + private CreateDepositsRequest( + Optional amount, + CreateDepositsRequestDestination destination, + Optional> metadata, + Optional network, + Map additionalProperties) { + this.amount = amount; + this.destination = destination; + this.metadata = metadata; + this.network = network; + this.additionalProperties = additionalProperties; + } + + /** + * @return Amount to prefill on hosted deposit page. + */ + @JsonProperty("amount") + public Optional getAmount() { + return amount; + } + + /** + * @return Destination account ID or wallet address. Object form is supported for compatibility. Any business resolves by its account ID without authentication; a user account resolves only for that same authenticated user. + */ + @JsonProperty("destination") + public CreateDepositsRequestDestination getDestination() { + return destination; + } + + /** + * @return Metadata to include with the deposit response. + */ + @JsonProperty("metadata") + public Optional> getMetadata() { + return metadata; + } + + /** + * @return Destination network override. Defaults to the destination wallet's own network. + */ + @JsonIgnore + public Optional getNetwork() { + if (network == null) { + return Optional.empty(); + } + return network; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("network") + private Optional _getNetwork() { + return network; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateDepositsRequest && equalTo((CreateDepositsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateDepositsRequest other) { + return amount.equals(other.amount) + && destination.equals(other.destination) + && metadata.equals(other.metadata) + && network.equals(other.network); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.destination, this.metadata, this.network); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DestinationStage builder() { + return new Builder(); + } + + public interface DestinationStage { + /** + *

Destination account ID or wallet address. Object form is supported for compatibility. Any business resolves by its account ID without authentication; a user account resolves only for that same authenticated user.

+ */ + _FinalStage destination(@NotNull CreateDepositsRequestDestination destination); + + Builder from(CreateDepositsRequest other); + } + + public interface _FinalStage { + CreateDepositsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Amount to prefill on hosted deposit page.

+ */ + _FinalStage amount(Optional amount); + + _FinalStage amount(Double amount); + + /** + *

Metadata to include with the deposit response.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + /** + *

Destination network override. Defaults to the destination wallet's own network.

+ */ + _FinalStage network(Optional network); + + _FinalStage network(CreateDepositsRequestNetwork network); + + _FinalStage network(Nullable network); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DestinationStage, _FinalStage { + private CreateDepositsRequestDestination destination; + + private Optional network = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional amount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateDepositsRequest other) { + amount(other.getAmount()); + destination(other.getDestination()); + metadata(other.getMetadata()); + network(other.getNetwork()); + return this; + } + + /** + *

Destination account ID or wallet address. Object form is supported for compatibility. Any business resolves by its account ID without authentication; a user account resolves only for that same authenticated user.

+ *

Destination account ID or wallet address. Object form is supported for compatibility. Any business resolves by its account ID without authentication; a user account resolves only for that same authenticated user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination") + public _FinalStage destination(@NotNull CreateDepositsRequestDestination destination) { + this.destination = Objects.requireNonNull(destination, "destination must not be null"); + return this; + } + + /** + *

Destination network override. Defaults to the destination wallet's own network.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage network(Nullable network) { + if (network.isNull()) { + this.network = null; + } else if (network.isEmpty()) { + this.network = Optional.empty(); + } else { + this.network = Optional.of(network.get()); + } + return this; + } + + /** + *

Destination network override. Defaults to the destination wallet's own network.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage network(CreateDepositsRequestNetwork network) { + this.network = Optional.ofNullable(network); + return this; + } + + /** + *

Destination network override. Defaults to the destination wallet's own network.

+ */ + @java.lang.Override + @JsonSetter(value = "network", nulls = Nulls.SKIP) + public _FinalStage network(Optional network) { + this.network = network; + return this; + } + + /** + *

Metadata to include with the deposit response.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Metadata to include with the deposit response.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Amount to prefill on hosted deposit page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amount(Double amount) { + this.amount = Optional.ofNullable(amount); + return this; + } + + /** + *

Amount to prefill on hosted deposit page.

+ */ + @java.lang.Override + @JsonSetter(value = "amount", nulls = Nulls.SKIP) + public _FinalStage amount(Optional amount) { + this.amount = amount; + return this; + } + + @java.lang.Override + public CreateDepositsRequest build() { + return new CreateDepositsRequest(amount, destination, metadata, network, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsRequestDestination.java b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsRequestDestination.java new file mode 100644 index 00000000..e80b453c --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsRequestDestination.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = CreateDepositsRequestDestination.Deserializer.class) +public final class CreateDepositsRequestDestination { + private final Object value; + + private final int type; + + private CreateDepositsRequestDestination(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((String) this.value); + } else if (this.type == 1) { + return visitor.visit((CreateDepositsRequestDestinationAccountId) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateDepositsRequestDestination && equalTo((CreateDepositsRequestDestination) other); + } + + private boolean equalTo(CreateDepositsRequestDestination other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static CreateDepositsRequestDestination of(String value) { + return new CreateDepositsRequestDestination(value, 0); + } + + public static CreateDepositsRequestDestination of(CreateDepositsRequestDestinationAccountId value) { + return new CreateDepositsRequestDestination(value, 1); + } + + public interface Visitor { + T visit(String value); + + T visit(CreateDepositsRequestDestinationAccountId value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(CreateDepositsRequestDestination.class); + } + + @java.lang.Override + public CreateDepositsRequestDestination deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + try { + return of( + ObjectMappers.JSON_MAPPER.convertValue(value, CreateDepositsRequestDestinationAccountId.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsRequestDestinationAccountId.java b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsRequestDestinationAccountId.java new file mode 100644 index 00000000..3866a3c1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsRequestDestinationAccountId.java @@ -0,0 +1,172 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateDepositsRequestDestinationAccountId.Builder.class) +public final class CreateDepositsRequestDestinationAccountId { + private final Optional accountId; + + private final Optional address; + + private final Optional network; + + private final Map additionalProperties; + + private CreateDepositsRequestDestinationAccountId( + Optional accountId, + Optional address, + Optional network, + Map additionalProperties) { + this.accountId = accountId; + this.address = address; + this.network = network; + this.additionalProperties = additionalProperties; + } + + /** + * @return Destination account ID. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Destination wallet address. + */ + @JsonProperty("address") + public Optional getAddress() { + return address; + } + + /** + * @return Destination wallet network. + */ + @JsonProperty("network") + public Optional getNetwork() { + return network; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateDepositsRequestDestinationAccountId + && equalTo((CreateDepositsRequestDestinationAccountId) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateDepositsRequestDestinationAccountId other) { + return accountId.equals(other.accountId) && address.equals(other.address) && network.equals(other.network); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.address, this.network); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional address = Optional.empty(); + + private Optional network = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateDepositsRequestDestinationAccountId other) { + accountId(other.getAccountId()); + address(other.getAddress()); + network(other.getNetwork()); + return this; + } + + /** + *

Destination account ID.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Destination wallet address.

+ */ + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public Builder address(Optional address) { + this.address = address; + return this; + } + + public Builder address(String address) { + this.address = Optional.ofNullable(address); + return this; + } + + /** + *

Destination wallet network.

+ */ + @JsonSetter(value = "network", nulls = Nulls.SKIP) + public Builder network(Optional network) { + this.network = network; + return this; + } + + public Builder network(CreateDepositsRequestDestinationAccountIdNetwork network) { + this.network = Optional.ofNullable(network); + return this; + } + + public CreateDepositsRequestDestinationAccountId build() { + return new CreateDepositsRequestDestinationAccountId(accountId, address, network, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsRequestDestinationAccountIdNetwork.java b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsRequestDestinationAccountIdNetwork.java new file mode 100644 index 00000000..3f4f1304 --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsRequestDestinationAccountIdNetwork.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateDepositsRequestDestinationAccountIdNetwork { + public static final CreateDepositsRequestDestinationAccountIdNetwork BASE = + new CreateDepositsRequestDestinationAccountIdNetwork(Value.BASE, "base"); + + public static final CreateDepositsRequestDestinationAccountIdNetwork SOLANA = + new CreateDepositsRequestDestinationAccountIdNetwork(Value.SOLANA, "solana"); + + public static final CreateDepositsRequestDestinationAccountIdNetwork ETHEREUM = + new CreateDepositsRequestDestinationAccountIdNetwork(Value.ETHEREUM, "ethereum"); + + public static final CreateDepositsRequestDestinationAccountIdNetwork POLYGON = + new CreateDepositsRequestDestinationAccountIdNetwork(Value.POLYGON, "polygon"); + + private final Value value; + + private final String string; + + CreateDepositsRequestDestinationAccountIdNetwork(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateDepositsRequestDestinationAccountIdNetwork + && this.string.equals(((CreateDepositsRequestDestinationAccountIdNetwork) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case BASE: + return visitor.visitBase(); + case SOLANA: + return visitor.visitSolana(); + case ETHEREUM: + return visitor.visitEthereum(); + case POLYGON: + return visitor.visitPolygon(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateDepositsRequestDestinationAccountIdNetwork valueOf(String value) { + switch (value) { + case "base": + return BASE; + case "solana": + return SOLANA; + case "ethereum": + return ETHEREUM; + case "polygon": + return POLYGON; + default: + return new CreateDepositsRequestDestinationAccountIdNetwork(Value.UNKNOWN, value); + } + } + + public enum Value { + ETHEREUM, + + POLYGON, + + BASE, + + SOLANA, + + UNKNOWN + } + + public interface Visitor { + T visitEthereum(); + + T visitPolygon(); + + T visitBase(); + + T visitSolana(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsRequestNetwork.java b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsRequestNetwork.java new file mode 100644 index 00000000..9afbeabf --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsRequestNetwork.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateDepositsRequestNetwork { + public static final CreateDepositsRequestNetwork BASE = new CreateDepositsRequestNetwork(Value.BASE, "base"); + + public static final CreateDepositsRequestNetwork SOLANA = new CreateDepositsRequestNetwork(Value.SOLANA, "solana"); + + public static final CreateDepositsRequestNetwork ETHEREUM = + new CreateDepositsRequestNetwork(Value.ETHEREUM, "ethereum"); + + public static final CreateDepositsRequestNetwork POLYGON = + new CreateDepositsRequestNetwork(Value.POLYGON, "polygon"); + + private final Value value; + + private final String string; + + CreateDepositsRequestNetwork(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateDepositsRequestNetwork + && this.string.equals(((CreateDepositsRequestNetwork) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case BASE: + return visitor.visitBase(); + case SOLANA: + return visitor.visitSolana(); + case ETHEREUM: + return visitor.visitEthereum(); + case POLYGON: + return visitor.visitPolygon(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateDepositsRequestNetwork valueOf(String value) { + switch (value) { + case "base": + return BASE; + case "solana": + return SOLANA; + case "ethereum": + return ETHEREUM; + case "polygon": + return POLYGON; + default: + return new CreateDepositsRequestNetwork(Value.UNKNOWN, value); + } + } + + public enum Value { + ETHEREUM, + + POLYGON, + + BASE, + + SOLANA, + + UNKNOWN + } + + public interface Visitor { + T visitEthereum(); + + T visitPolygon(); + + T visitBase(); + + T visitSolana(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponse.java b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponse.java new file mode 100644 index 00000000..76e5e2de --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponse.java @@ -0,0 +1,405 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateDepositsResponse.Builder.class) +public final class CreateDepositsResponse { + private final Optional accountId; + + private final Optional amount; + + private final Optional hostedUrl; + + private final Map metadata; + + private final CreateDepositsResponseMethods methods; + + private final CreateDepositsResponseObject object; + + private final Map additionalProperties; + + private CreateDepositsResponse( + Optional accountId, + Optional amount, + Optional hostedUrl, + Map metadata, + CreateDepositsResponseMethods methods, + CreateDepositsResponseObject object, + Map additionalProperties) { + this.accountId = accountId; + this.amount = amount; + this.hostedUrl = hostedUrl; + this.metadata = metadata; + this.methods = methods; + this.object = object; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID of the destination owner. Null for raw wallet address destinations. + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return Requested deposit amount. + */ + @JsonProperty("amount") + public Optional getAmount() { + return amount; + } + + /** + * @return URL of the hosted deposit page. Only present for business destinations. + */ + @JsonIgnore + public Optional getHostedUrl() { + if (hostedUrl == null) { + return Optional.empty(); + } + return hostedUrl; + } + + /** + * @return Metadata from the request. + */ + @JsonProperty("metadata") + public Map getMetadata() { + return metadata; + } + + /** + * @return Available deposit methods for destination. + */ + @JsonProperty("methods") + public CreateDepositsResponseMethods getMethods() { + return methods; + } + + @JsonProperty("object") + public CreateDepositsResponseObject getObject() { + return object; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("hosted_url") + private Optional _getHostedUrl() { + return hostedUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateDepositsResponse && equalTo((CreateDepositsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateDepositsResponse other) { + return accountId.equals(other.accountId) + && amount.equals(other.amount) + && hostedUrl.equals(other.hostedUrl) + && metadata.equals(other.metadata) + && methods.equals(other.methods) + && object.equals(other.object); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.amount, this.hostedUrl, this.metadata, this.methods, this.object); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MethodsStage builder() { + return new Builder(); + } + + public interface MethodsStage { + /** + *

Available deposit methods for destination.

+ */ + ObjectStage methods(@NotNull CreateDepositsResponseMethods methods); + + Builder from(CreateDepositsResponse other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull CreateDepositsResponseObject object); + } + + public interface _FinalStage { + CreateDepositsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account ID of the destination owner. Null for raw wallet address destinations.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

Requested deposit amount.

+ */ + _FinalStage amount(Optional amount); + + _FinalStage amount(String amount); + + /** + *

URL of the hosted deposit page. Only present for business destinations.

+ */ + _FinalStage hostedUrl(Optional hostedUrl); + + _FinalStage hostedUrl(String hostedUrl); + + _FinalStage hostedUrl(Nullable hostedUrl); + + /** + *

Metadata from the request.

+ */ + _FinalStage metadata(Map metadata); + + _FinalStage putAllMetadata(Map metadata); + + _FinalStage metadata(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MethodsStage, ObjectStage, _FinalStage { + private CreateDepositsResponseMethods methods; + + private CreateDepositsResponseObject object; + + private Map metadata = new LinkedHashMap<>(); + + private Optional hostedUrl = Optional.empty(); + + private Optional amount = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateDepositsResponse other) { + accountId(other.getAccountId()); + amount(other.getAmount()); + hostedUrl(other.getHostedUrl()); + metadata(other.getMetadata()); + methods(other.getMethods()); + object(other.getObject()); + return this; + } + + /** + *

Available deposit methods for destination.

+ *

Available deposit methods for destination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("methods") + public ObjectStage methods(@NotNull CreateDepositsResponseMethods methods) { + this.methods = Objects.requireNonNull(methods, "methods must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull CreateDepositsResponseObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Metadata from the request.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(String key, Object value) { + this.metadata.put(key, value); + return this; + } + + /** + *

Metadata from the request.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllMetadata(Map metadata) { + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Metadata from the request.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Map metadata) { + this.metadata.clear(); + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

URL of the hosted deposit page. Only present for business destinations.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostedUrl(Nullable hostedUrl) { + if (hostedUrl.isNull()) { + this.hostedUrl = null; + } else if (hostedUrl.isEmpty()) { + this.hostedUrl = Optional.empty(); + } else { + this.hostedUrl = Optional.of(hostedUrl.get()); + } + return this; + } + + /** + *

URL of the hosted deposit page. Only present for business destinations.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostedUrl(String hostedUrl) { + this.hostedUrl = Optional.ofNullable(hostedUrl); + return this; + } + + /** + *

URL of the hosted deposit page. Only present for business destinations.

+ */ + @java.lang.Override + @JsonSetter(value = "hosted_url", nulls = Nulls.SKIP) + public _FinalStage hostedUrl(Optional hostedUrl) { + this.hostedUrl = hostedUrl; + return this; + } + + /** + *

Requested deposit amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amount(String amount) { + this.amount = Optional.ofNullable(amount); + return this; + } + + /** + *

Requested deposit amount.

+ */ + @java.lang.Override + @JsonSetter(value = "amount", nulls = Nulls.SKIP) + public _FinalStage amount(Optional amount) { + this.amount = amount; + return this; + } + + /** + *

Account ID of the destination owner. Null for raw wallet address destinations.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

Account ID of the destination owner. Null for raw wallet address destinations.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Account ID of the destination owner. Null for raw wallet address destinations.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public CreateDepositsResponse build() { + return new CreateDepositsResponse( + accountId, amount, hostedUrl, metadata, methods, object, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethods.java b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethods.java new file mode 100644 index 00000000..fb4e2ded --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethods.java @@ -0,0 +1,177 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateDepositsResponseMethods.Builder.class) +public final class CreateDepositsResponseMethods { + private final Optional bank; + + private final List crypto; + + private final Map additionalProperties; + + private CreateDepositsResponseMethods( + Optional bank, + List crypto, + Map additionalProperties) { + this.bank = bank; + this.crypto = crypto; + this.additionalProperties = additionalProperties; + } + + /** + * @return Bank deposit details. Only present when bank deposits are active for the destination account. + */ + @JsonIgnore + public Optional getBank() { + if (bank == null) { + return Optional.empty(); + } + return bank; + } + + /** + * @return Crypto networks available for this deposit, each with its on-chain deposit address and the tokens accepted on that network. + */ + @JsonProperty("crypto") + public List getCrypto() { + return crypto; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bank") + private Optional _getBank() { + return bank; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateDepositsResponseMethods && equalTo((CreateDepositsResponseMethods) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateDepositsResponseMethods other) { + return bank.equals(other.bank) && crypto.equals(other.crypto); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.bank, this.crypto); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional bank = Optional.empty(); + + private List crypto = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateDepositsResponseMethods other) { + bank(other.getBank()); + crypto(other.getCrypto()); + return this; + } + + /** + *

Bank deposit details. Only present when bank deposits are active for the destination account.

+ */ + @JsonSetter(value = "bank", nulls = Nulls.SKIP) + public Builder bank(Optional bank) { + this.bank = bank; + return this; + } + + public Builder bank(CreateDepositsResponseMethodsBank bank) { + this.bank = Optional.ofNullable(bank); + return this; + } + + public Builder bank(Nullable bank) { + if (bank.isNull()) { + this.bank = null; + } else if (bank.isEmpty()) { + this.bank = Optional.empty(); + } else { + this.bank = Optional.of(bank.get()); + } + return this; + } + + /** + *

Crypto networks available for this deposit, each with its on-chain deposit address and the tokens accepted on that network.

+ */ + @JsonSetter(value = "crypto", nulls = Nulls.SKIP) + public Builder crypto(List crypto) { + this.crypto.clear(); + if (crypto != null) { + this.crypto.addAll(crypto); + } + return this; + } + + public Builder addCrypto(CreateDepositsResponseMethodsCryptoItem crypto) { + this.crypto.add(crypto); + return this; + } + + public Builder addAllCrypto(List crypto) { + if (crypto != null) { + this.crypto.addAll(crypto); + } + return this; + } + + public CreateDepositsResponseMethods build() { + return new CreateDepositsResponseMethods(bank, crypto, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsBank.java b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsBank.java new file mode 100644 index 00000000..bb7de650 --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsBank.java @@ -0,0 +1,124 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateDepositsResponseMethodsBank.Builder.class) +public final class CreateDepositsResponseMethodsBank { + private final List currencies; + + private final Map additionalProperties; + + private CreateDepositsResponseMethodsBank( + List currencies, + Map additionalProperties) { + this.currencies = currencies; + this.additionalProperties = additionalProperties; + } + + /** + * @return Bank transfer currencies available for this deposit. + */ + @JsonProperty("currencies") + public List getCurrencies() { + return currencies; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateDepositsResponseMethodsBank && equalTo((CreateDepositsResponseMethodsBank) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateDepositsResponseMethodsBank other) { + return currencies.equals(other.currencies); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currencies); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List currencies = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateDepositsResponseMethodsBank other) { + currencies(other.getCurrencies()); + return this; + } + + /** + *

Bank transfer currencies available for this deposit.

+ */ + @JsonSetter(value = "currencies", nulls = Nulls.SKIP) + public Builder currencies(List currencies) { + this.currencies.clear(); + if (currencies != null) { + this.currencies.addAll(currencies); + } + return this; + } + + public Builder addCurrencies(CreateDepositsResponseMethodsBankCurrenciesItem currencies) { + this.currencies.add(currencies); + return this; + } + + public Builder addAllCurrencies(List currencies) { + if (currencies != null) { + this.currencies.addAll(currencies); + } + return this; + } + + public CreateDepositsResponseMethodsBank build() { + return new CreateDepositsResponseMethodsBank(currencies, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsBankCurrenciesItem.java b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsBankCurrenciesItem.java new file mode 100644 index 00000000..d62334dc --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsBankCurrenciesItem.java @@ -0,0 +1,708 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateDepositsResponseMethodsBankCurrenciesItem.Builder.class) +public final class CreateDepositsResponseMethodsBankCurrenciesItem { + private final Optional accountNumber; + + private final String currency; + + private final Optional depositBankAddress; + + private final Optional depositBankName; + + private final Optional depositBeneficiaryName; + + private final Optional depositReference; + + private final List rails; + + private final Optional routingNumber; + + private final Optional swiftBic; + + private final Map additionalProperties; + + private CreateDepositsResponseMethodsBankCurrenciesItem( + Optional accountNumber, + String currency, + Optional depositBankAddress, + Optional depositBankName, + Optional depositBeneficiaryName, + Optional depositReference, + List rails, + Optional routingNumber, + Optional swiftBic, + Map additionalProperties) { + this.accountNumber = accountNumber; + this.currency = currency; + this.depositBankAddress = depositBankAddress; + this.depositBankName = depositBankName; + this.depositBeneficiaryName = depositBeneficiaryName; + this.depositReference = depositReference; + this.rails = rails; + this.routingNumber = routingNumber; + this.swiftBic = swiftBic; + this.additionalProperties = additionalProperties; + } + + /** + * @return Bank account number for deposits in this currency. + */ + @JsonIgnore + public Optional getAccountNumber() { + if (accountNumber == null) { + return Optional.empty(); + } + return accountNumber; + } + + /** + * @return Currency supported by these bank instructions. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Receiving bank address. + */ + @JsonIgnore + public Optional getDepositBankAddress() { + if (depositBankAddress == null) { + return Optional.empty(); + } + return depositBankAddress; + } + + /** + * @return Receiving bank name. + */ + @JsonIgnore + public Optional getDepositBankName() { + if (depositBankName == null) { + return Optional.empty(); + } + return depositBankName; + } + + /** + * @return Beneficiary name to use for transfer. + */ + @JsonIgnore + public Optional getDepositBeneficiaryName() { + if (depositBeneficiaryName == null) { + return Optional.empty(); + } + return depositBeneficiaryName; + } + + /** + * @return Reference to include with bank transfer. + */ + @JsonIgnore + public Optional getDepositReference() { + if (depositReference == null) { + return Optional.empty(); + } + return depositReference; + } + + /** + * @return Active deposit rails for this currency. + */ + @JsonProperty("rails") + public List getRails() { + return rails; + } + + /** + * @return Bank routing number for deposits in this currency. + */ + @JsonIgnore + public Optional getRoutingNumber() { + if (routingNumber == null) { + return Optional.empty(); + } + return routingNumber; + } + + /** + * @return SWIFT/BIC code for international wires, when available. + */ + @JsonIgnore + public Optional getSwiftBic() { + if (swiftBic == null) { + return Optional.empty(); + } + return swiftBic; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_number") + private Optional _getAccountNumber() { + return accountNumber; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("deposit_bank_address") + private Optional _getDepositBankAddress() { + return depositBankAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("deposit_bank_name") + private Optional _getDepositBankName() { + return depositBankName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("deposit_beneficiary_name") + private Optional _getDepositBeneficiaryName() { + return depositBeneficiaryName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("deposit_reference") + private Optional _getDepositReference() { + return depositReference; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("routing_number") + private Optional _getRoutingNumber() { + return routingNumber; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("swift_bic") + private Optional _getSwiftBic() { + return swiftBic; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateDepositsResponseMethodsBankCurrenciesItem + && equalTo((CreateDepositsResponseMethodsBankCurrenciesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateDepositsResponseMethodsBankCurrenciesItem other) { + return accountNumber.equals(other.accountNumber) + && currency.equals(other.currency) + && depositBankAddress.equals(other.depositBankAddress) + && depositBankName.equals(other.depositBankName) + && depositBeneficiaryName.equals(other.depositBeneficiaryName) + && depositReference.equals(other.depositReference) + && rails.equals(other.rails) + && routingNumber.equals(other.routingNumber) + && swiftBic.equals(other.swiftBic); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountNumber, + this.currency, + this.depositBankAddress, + this.depositBankName, + this.depositBeneficiaryName, + this.depositReference, + this.rails, + this.routingNumber, + this.swiftBic); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + /** + *

Currency supported by these bank instructions.

+ */ + _FinalStage currency(@NotNull String currency); + + Builder from(CreateDepositsResponseMethodsBankCurrenciesItem other); + } + + public interface _FinalStage { + CreateDepositsResponseMethodsBankCurrenciesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Bank account number for deposits in this currency.

+ */ + _FinalStage accountNumber(Optional accountNumber); + + _FinalStage accountNumber(String accountNumber); + + _FinalStage accountNumber(Nullable accountNumber); + + /** + *

Receiving bank address.

+ */ + _FinalStage depositBankAddress(Optional depositBankAddress); + + _FinalStage depositBankAddress(String depositBankAddress); + + _FinalStage depositBankAddress(Nullable depositBankAddress); + + /** + *

Receiving bank name.

+ */ + _FinalStage depositBankName(Optional depositBankName); + + _FinalStage depositBankName(String depositBankName); + + _FinalStage depositBankName(Nullable depositBankName); + + /** + *

Beneficiary name to use for transfer.

+ */ + _FinalStage depositBeneficiaryName(Optional depositBeneficiaryName); + + _FinalStage depositBeneficiaryName(String depositBeneficiaryName); + + _FinalStage depositBeneficiaryName(Nullable depositBeneficiaryName); + + /** + *

Reference to include with bank transfer.

+ */ + _FinalStage depositReference(Optional depositReference); + + _FinalStage depositReference(String depositReference); + + _FinalStage depositReference(Nullable depositReference); + + /** + *

Active deposit rails for this currency.

+ */ + _FinalStage rails(List rails); + + _FinalStage addRails(CreateDepositsResponseMethodsBankCurrenciesItemRailsItem rails); + + _FinalStage addAllRails(List rails); + + /** + *

Bank routing number for deposits in this currency.

+ */ + _FinalStage routingNumber(Optional routingNumber); + + _FinalStage routingNumber(String routingNumber); + + _FinalStage routingNumber(Nullable routingNumber); + + /** + *

SWIFT/BIC code for international wires, when available.

+ */ + _FinalStage swiftBic(Optional swiftBic); + + _FinalStage swiftBic(String swiftBic); + + _FinalStage swiftBic(Nullable swiftBic); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, _FinalStage { + private String currency; + + private Optional swiftBic = Optional.empty(); + + private Optional routingNumber = Optional.empty(); + + private List rails = new ArrayList<>(); + + private Optional depositReference = Optional.empty(); + + private Optional depositBeneficiaryName = Optional.empty(); + + private Optional depositBankName = Optional.empty(); + + private Optional depositBankAddress = Optional.empty(); + + private Optional accountNumber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateDepositsResponseMethodsBankCurrenciesItem other) { + accountNumber(other.getAccountNumber()); + currency(other.getCurrency()); + depositBankAddress(other.getDepositBankAddress()); + depositBankName(other.getDepositBankName()); + depositBeneficiaryName(other.getDepositBeneficiaryName()); + depositReference(other.getDepositReference()); + rails(other.getRails()); + routingNumber(other.getRoutingNumber()); + swiftBic(other.getSwiftBic()); + return this; + } + + /** + *

Currency supported by these bank instructions.

+ *

Currency supported by these bank instructions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

SWIFT/BIC code for international wires, when available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage swiftBic(Nullable swiftBic) { + if (swiftBic.isNull()) { + this.swiftBic = null; + } else if (swiftBic.isEmpty()) { + this.swiftBic = Optional.empty(); + } else { + this.swiftBic = Optional.of(swiftBic.get()); + } + return this; + } + + /** + *

SWIFT/BIC code for international wires, when available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage swiftBic(String swiftBic) { + this.swiftBic = Optional.ofNullable(swiftBic); + return this; + } + + /** + *

SWIFT/BIC code for international wires, when available.

+ */ + @java.lang.Override + @JsonSetter(value = "swift_bic", nulls = Nulls.SKIP) + public _FinalStage swiftBic(Optional swiftBic) { + this.swiftBic = swiftBic; + return this; + } + + /** + *

Bank routing number for deposits in this currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage routingNumber(Nullable routingNumber) { + if (routingNumber.isNull()) { + this.routingNumber = null; + } else if (routingNumber.isEmpty()) { + this.routingNumber = Optional.empty(); + } else { + this.routingNumber = Optional.of(routingNumber.get()); + } + return this; + } + + /** + *

Bank routing number for deposits in this currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage routingNumber(String routingNumber) { + this.routingNumber = Optional.ofNullable(routingNumber); + return this; + } + + /** + *

Bank routing number for deposits in this currency.

+ */ + @java.lang.Override + @JsonSetter(value = "routing_number", nulls = Nulls.SKIP) + public _FinalStage routingNumber(Optional routingNumber) { + this.routingNumber = routingNumber; + return this; + } + + /** + *

Active deposit rails for this currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllRails(List rails) { + if (rails != null) { + this.rails.addAll(rails); + } + return this; + } + + /** + *

Active deposit rails for this currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addRails(CreateDepositsResponseMethodsBankCurrenciesItemRailsItem rails) { + this.rails.add(rails); + return this; + } + + /** + *

Active deposit rails for this currency.

+ */ + @java.lang.Override + @JsonSetter(value = "rails", nulls = Nulls.SKIP) + public _FinalStage rails(List rails) { + this.rails.clear(); + if (rails != null) { + this.rails.addAll(rails); + } + return this; + } + + /** + *

Reference to include with bank transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage depositReference(Nullable depositReference) { + if (depositReference.isNull()) { + this.depositReference = null; + } else if (depositReference.isEmpty()) { + this.depositReference = Optional.empty(); + } else { + this.depositReference = Optional.of(depositReference.get()); + } + return this; + } + + /** + *

Reference to include with bank transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage depositReference(String depositReference) { + this.depositReference = Optional.ofNullable(depositReference); + return this; + } + + /** + *

Reference to include with bank transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "deposit_reference", nulls = Nulls.SKIP) + public _FinalStage depositReference(Optional depositReference) { + this.depositReference = depositReference; + return this; + } + + /** + *

Beneficiary name to use for transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage depositBeneficiaryName(Nullable depositBeneficiaryName) { + if (depositBeneficiaryName.isNull()) { + this.depositBeneficiaryName = null; + } else if (depositBeneficiaryName.isEmpty()) { + this.depositBeneficiaryName = Optional.empty(); + } else { + this.depositBeneficiaryName = Optional.of(depositBeneficiaryName.get()); + } + return this; + } + + /** + *

Beneficiary name to use for transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage depositBeneficiaryName(String depositBeneficiaryName) { + this.depositBeneficiaryName = Optional.ofNullable(depositBeneficiaryName); + return this; + } + + /** + *

Beneficiary name to use for transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "deposit_beneficiary_name", nulls = Nulls.SKIP) + public _FinalStage depositBeneficiaryName(Optional depositBeneficiaryName) { + this.depositBeneficiaryName = depositBeneficiaryName; + return this; + } + + /** + *

Receiving bank name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage depositBankName(Nullable depositBankName) { + if (depositBankName.isNull()) { + this.depositBankName = null; + } else if (depositBankName.isEmpty()) { + this.depositBankName = Optional.empty(); + } else { + this.depositBankName = Optional.of(depositBankName.get()); + } + return this; + } + + /** + *

Receiving bank name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage depositBankName(String depositBankName) { + this.depositBankName = Optional.ofNullable(depositBankName); + return this; + } + + /** + *

Receiving bank name.

+ */ + @java.lang.Override + @JsonSetter(value = "deposit_bank_name", nulls = Nulls.SKIP) + public _FinalStage depositBankName(Optional depositBankName) { + this.depositBankName = depositBankName; + return this; + } + + /** + *

Receiving bank address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage depositBankAddress(Nullable depositBankAddress) { + if (depositBankAddress.isNull()) { + this.depositBankAddress = null; + } else if (depositBankAddress.isEmpty()) { + this.depositBankAddress = Optional.empty(); + } else { + this.depositBankAddress = Optional.of(depositBankAddress.get()); + } + return this; + } + + /** + *

Receiving bank address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage depositBankAddress(String depositBankAddress) { + this.depositBankAddress = Optional.ofNullable(depositBankAddress); + return this; + } + + /** + *

Receiving bank address.

+ */ + @java.lang.Override + @JsonSetter(value = "deposit_bank_address", nulls = Nulls.SKIP) + public _FinalStage depositBankAddress(Optional depositBankAddress) { + this.depositBankAddress = depositBankAddress; + return this; + } + + /** + *

Bank account number for deposits in this currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountNumber(Nullable accountNumber) { + if (accountNumber.isNull()) { + this.accountNumber = null; + } else if (accountNumber.isEmpty()) { + this.accountNumber = Optional.empty(); + } else { + this.accountNumber = Optional.of(accountNumber.get()); + } + return this; + } + + /** + *

Bank account number for deposits in this currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountNumber(String accountNumber) { + this.accountNumber = Optional.ofNullable(accountNumber); + return this; + } + + /** + *

Bank account number for deposits in this currency.

+ */ + @java.lang.Override + @JsonSetter(value = "account_number", nulls = Nulls.SKIP) + public _FinalStage accountNumber(Optional accountNumber) { + this.accountNumber = accountNumber; + return this; + } + + @java.lang.Override + public CreateDepositsResponseMethodsBankCurrenciesItem build() { + return new CreateDepositsResponseMethodsBankCurrenciesItem( + accountNumber, + currency, + depositBankAddress, + depositBankName, + depositBeneficiaryName, + depositReference, + rails, + routingNumber, + swiftBic, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsBankCurrenciesItemRailsItem.java b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsBankCurrenciesItemRailsItem.java new file mode 100644 index 00000000..f8529127 --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsBankCurrenciesItemRailsItem.java @@ -0,0 +1,120 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateDepositsResponseMethodsBankCurrenciesItemRailsItem { + public static final CreateDepositsResponseMethodsBankCurrenciesItemRailsItem ACH = + new CreateDepositsResponseMethodsBankCurrenciesItemRailsItem(Value.ACH, "ach"); + + public static final CreateDepositsResponseMethodsBankCurrenciesItemRailsItem FPS = + new CreateDepositsResponseMethodsBankCurrenciesItemRailsItem(Value.FPS, "fps"); + + public static final CreateDepositsResponseMethodsBankCurrenciesItemRailsItem WIRE = + new CreateDepositsResponseMethodsBankCurrenciesItemRailsItem(Value.WIRE, "wire"); + + public static final CreateDepositsResponseMethodsBankCurrenciesItemRailsItem SEPA = + new CreateDepositsResponseMethodsBankCurrenciesItemRailsItem(Value.SEPA, "sepa"); + + public static final CreateDepositsResponseMethodsBankCurrenciesItemRailsItem CHAPS = + new CreateDepositsResponseMethodsBankCurrenciesItemRailsItem(Value.CHAPS, "chaps"); + + private final Value value; + + private final String string; + + CreateDepositsResponseMethodsBankCurrenciesItemRailsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateDepositsResponseMethodsBankCurrenciesItemRailsItem + && this.string.equals( + ((CreateDepositsResponseMethodsBankCurrenciesItemRailsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ACH: + return visitor.visitAch(); + case FPS: + return visitor.visitFps(); + case WIRE: + return visitor.visitWire(); + case SEPA: + return visitor.visitSepa(); + case CHAPS: + return visitor.visitChaps(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateDepositsResponseMethodsBankCurrenciesItemRailsItem valueOf(String value) { + switch (value) { + case "ach": + return ACH; + case "fps": + return FPS; + case "wire": + return WIRE; + case "sepa": + return SEPA; + case "chaps": + return CHAPS; + default: + return new CreateDepositsResponseMethodsBankCurrenciesItemRailsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + ACH, + + WIRE, + + SEPA, + + FPS, + + CHAPS, + + UNKNOWN + } + + public interface Visitor { + T visitAch(); + + T visitWire(); + + T visitSepa(); + + T visitFps(); + + T visitChaps(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsCryptoItem.java b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsCryptoItem.java new file mode 100644 index 00000000..accb0f37 --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsCryptoItem.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateDepositsResponseMethodsCryptoItem.Builder.class) +public final class CreateDepositsResponseMethodsCryptoItem { + private final Optional depositAddress; + + private final Optional iconUrl; + + private final CreateDepositsResponseMethodsCryptoItemName name; + + private final List supportedCurrencies; + + private final Map additionalProperties; + + private CreateDepositsResponseMethodsCryptoItem( + Optional depositAddress, + Optional iconUrl, + CreateDepositsResponseMethodsCryptoItemName name, + List supportedCurrencies, + Map additionalProperties) { + this.depositAddress = depositAddress; + this.iconUrl = iconUrl; + this.name = name; + this.supportedCurrencies = supportedCurrencies; + this.additionalProperties = additionalProperties; + } + + /** + * @return Address to send funds to on this network. Null when the provider has not issued one yet. + */ + @JsonIgnore + public Optional getDepositAddress() { + if (depositAddress == null) { + return Optional.empty(); + } + return depositAddress; + } + + /** + * @return Network icon URL. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return Network display name. + */ + @JsonProperty("name") + public CreateDepositsResponseMethodsCryptoItemName getName() { + return name; + } + + /** + * @return Tokens accepted for deposit on this network. + */ + @JsonProperty("supported_currencies") + public List getSupportedCurrencies() { + return supportedCurrencies; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("deposit_address") + private Optional _getDepositAddress() { + return depositAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateDepositsResponseMethodsCryptoItem + && equalTo((CreateDepositsResponseMethodsCryptoItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateDepositsResponseMethodsCryptoItem other) { + return depositAddress.equals(other.depositAddress) + && iconUrl.equals(other.iconUrl) + && name.equals(other.name) + && supportedCurrencies.equals(other.supportedCurrencies); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.depositAddress, this.iconUrl, this.name, this.supportedCurrencies); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

Network display name.

+ */ + _FinalStage name(@NotNull CreateDepositsResponseMethodsCryptoItemName name); + + Builder from(CreateDepositsResponseMethodsCryptoItem other); + } + + public interface _FinalStage { + CreateDepositsResponseMethodsCryptoItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Address to send funds to on this network. Null when the provider has not issued one yet.

+ */ + _FinalStage depositAddress(Optional depositAddress); + + _FinalStage depositAddress(String depositAddress); + + _FinalStage depositAddress(Nullable depositAddress); + + /** + *

Network icon URL.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Tokens accepted for deposit on this network.

+ */ + _FinalStage supportedCurrencies( + List supportedCurrencies); + + _FinalStage addSupportedCurrencies( + CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem supportedCurrencies); + + _FinalStage addAllSupportedCurrencies( + List supportedCurrencies); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private CreateDepositsResponseMethodsCryptoItemName name; + + private List supportedCurrencies = + new ArrayList<>(); + + private Optional iconUrl = Optional.empty(); + + private Optional depositAddress = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateDepositsResponseMethodsCryptoItem other) { + depositAddress(other.getDepositAddress()); + iconUrl(other.getIconUrl()); + name(other.getName()); + supportedCurrencies(other.getSupportedCurrencies()); + return this; + } + + /** + *

Network display name.

+ *

Network display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull CreateDepositsResponseMethodsCryptoItemName name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

Tokens accepted for deposit on this network.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllSupportedCurrencies( + List supportedCurrencies) { + if (supportedCurrencies != null) { + this.supportedCurrencies.addAll(supportedCurrencies); + } + return this; + } + + /** + *

Tokens accepted for deposit on this network.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addSupportedCurrencies( + CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem supportedCurrencies) { + this.supportedCurrencies.add(supportedCurrencies); + return this; + } + + /** + *

Tokens accepted for deposit on this network.

+ */ + @java.lang.Override + @JsonSetter(value = "supported_currencies", nulls = Nulls.SKIP) + public _FinalStage supportedCurrencies( + List supportedCurrencies) { + this.supportedCurrencies.clear(); + if (supportedCurrencies != null) { + this.supportedCurrencies.addAll(supportedCurrencies); + } + return this; + } + + /** + *

Network icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Network icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Network icon URL.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + /** + *

Address to send funds to on this network. Null when the provider has not issued one yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage depositAddress(Nullable depositAddress) { + if (depositAddress.isNull()) { + this.depositAddress = null; + } else if (depositAddress.isEmpty()) { + this.depositAddress = Optional.empty(); + } else { + this.depositAddress = Optional.of(depositAddress.get()); + } + return this; + } + + /** + *

Address to send funds to on this network. Null when the provider has not issued one yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage depositAddress(String depositAddress) { + this.depositAddress = Optional.ofNullable(depositAddress); + return this; + } + + /** + *

Address to send funds to on this network. Null when the provider has not issued one yet.

+ */ + @java.lang.Override + @JsonSetter(value = "deposit_address", nulls = Nulls.SKIP) + public _FinalStage depositAddress(Optional depositAddress) { + this.depositAddress = depositAddress; + return this; + } + + @java.lang.Override + public CreateDepositsResponseMethodsCryptoItem build() { + return new CreateDepositsResponseMethodsCryptoItem( + depositAddress, iconUrl, name, supportedCurrencies, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsCryptoItemName.java b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsCryptoItemName.java new file mode 100644 index 00000000..135f677f --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsCryptoItemName.java @@ -0,0 +1,174 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateDepositsResponseMethodsCryptoItemName { + public static final CreateDepositsResponseMethodsCryptoItemName PLASMA = + new CreateDepositsResponseMethodsCryptoItemName(Value.PLASMA, "Plasma"); + + public static final CreateDepositsResponseMethodsCryptoItemName MEGA_ETH = + new CreateDepositsResponseMethodsCryptoItemName(Value.MEGA_ETH, "MegaETH"); + + public static final CreateDepositsResponseMethodsCryptoItemName POLYGON = + new CreateDepositsResponseMethodsCryptoItemName(Value.POLYGON, "Polygon"); + + public static final CreateDepositsResponseMethodsCryptoItemName HYPERLIQUID = + new CreateDepositsResponseMethodsCryptoItemName(Value.HYPERLIQUID, "Hyperliquid"); + + public static final CreateDepositsResponseMethodsCryptoItemName ETHEREUM = + new CreateDepositsResponseMethodsCryptoItemName(Value.ETHEREUM, "Ethereum"); + + public static final CreateDepositsResponseMethodsCryptoItemName ARBITRUM = + new CreateDepositsResponseMethodsCryptoItemName(Value.ARBITRUM, "Arbitrum"); + + public static final CreateDepositsResponseMethodsCryptoItemName BASE = + new CreateDepositsResponseMethodsCryptoItemName(Value.BASE, "Base"); + + public static final CreateDepositsResponseMethodsCryptoItemName BNB_SMART_CHAIN = + new CreateDepositsResponseMethodsCryptoItemName(Value.BNB_SMART_CHAIN, "BNB Smart Chain"); + + public static final CreateDepositsResponseMethodsCryptoItemName HYPERCORE = + new CreateDepositsResponseMethodsCryptoItemName(Value.HYPERCORE, "Hypercore"); + + public static final CreateDepositsResponseMethodsCryptoItemName SOLANA = + new CreateDepositsResponseMethodsCryptoItemName(Value.SOLANA, "Solana"); + + private final Value value; + + private final String string; + + CreateDepositsResponseMethodsCryptoItemName(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateDepositsResponseMethodsCryptoItemName + && this.string.equals(((CreateDepositsResponseMethodsCryptoItemName) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PLASMA: + return visitor.visitPlasma(); + case MEGA_ETH: + return visitor.visitMegaEth(); + case POLYGON: + return visitor.visitPolygon(); + case HYPERLIQUID: + return visitor.visitHyperliquid(); + case ETHEREUM: + return visitor.visitEthereum(); + case ARBITRUM: + return visitor.visitArbitrum(); + case BASE: + return visitor.visitBase(); + case BNB_SMART_CHAIN: + return visitor.visitBnbSmartChain(); + case HYPERCORE: + return visitor.visitHypercore(); + case SOLANA: + return visitor.visitSolana(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateDepositsResponseMethodsCryptoItemName valueOf(String value) { + switch (value) { + case "Plasma": + return PLASMA; + case "MegaETH": + return MEGA_ETH; + case "Polygon": + return POLYGON; + case "Hyperliquid": + return HYPERLIQUID; + case "Ethereum": + return ETHEREUM; + case "Arbitrum": + return ARBITRUM; + case "Base": + return BASE; + case "BNB Smart Chain": + return BNB_SMART_CHAIN; + case "Hypercore": + return HYPERCORE; + case "Solana": + return SOLANA; + default: + return new CreateDepositsResponseMethodsCryptoItemName(Value.UNKNOWN, value); + } + } + + public enum Value { + ETHEREUM, + + SOLANA, + + BASE, + + BNB_SMART_CHAIN, + + HYPERLIQUID, + + HYPERCORE, + + MEGA_ETH, + + POLYGON, + + PLASMA, + + ARBITRUM, + + UNKNOWN + } + + public interface Visitor { + T visitEthereum(); + + T visitSolana(); + + T visitBase(); + + T visitBnbSmartChain(); + + T visitHyperliquid(); + + T visitHypercore(); + + T visitMegaEth(); + + T visitPolygon(); + + T visitPlasma(); + + T visitArbitrum(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem.java b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem.java new file mode 100644 index 00000000..15f990a5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem.java @@ -0,0 +1,207 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem.Builder.class) +public final class CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem { + private final Optional iconUrl; + + private final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName name; + + private final Map additionalProperties; + + private CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem( + Optional iconUrl, + CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName name, + Map additionalProperties) { + this.iconUrl = iconUrl; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return Token icon URL. Null when no icon is available. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return Token symbol. + */ + @JsonProperty("name") + public CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem + && equalTo((CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem other) { + return iconUrl.equals(other.iconUrl) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.iconUrl, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

Token symbol.

+ */ + _FinalStage name(@NotNull CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName name); + + Builder from(CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem other); + } + + public interface _FinalStage { + CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Token icon URL. Null when no icon is available.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName name; + + private Optional iconUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem other) { + iconUrl(other.getIconUrl()); + name(other.getName()); + return this; + } + + /** + *

Token symbol.

+ *

Token symbol.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

Token icon URL. Null when no icon is available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Token icon URL. Null when no icon is available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Token icon URL. Null when no icon is available.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + @java.lang.Override + public CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem build() { + return new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItem( + iconUrl, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName.java b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName.java new file mode 100644 index 00000000..f69633f2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName.java @@ -0,0 +1,274 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName { + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName USDC_E = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.USDC_E, "USDC.e"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName USDC = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.USDC, "USDC"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName XO = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.XO, "XO"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName ARB = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.ARB, "ARB"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName W_ETH = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.W_ETH, "wETH"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName BNB = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.BNB, "BNB"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName USDT0 = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.USDT0, "USDT0"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName XPL = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.XPL, "XPL"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName HYPE = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.HYPE, "HYPE"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName SOL = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.SOL, "SOL"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName USDG = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.USDG, "USDG"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName US_DM = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.US_DM, "USDm"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName EURC = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.EURC, "EURC"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName USD1 = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.USD1, "USD1"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName ETH = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.ETH, "ETH"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName USDT = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.USDT, "USDT"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName P_USD = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.P_USD, "pUSD"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName PYUSD = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.PYUSD, "PYUSD"); + + public static final CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName US_DE = + new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.US_DE, "USDe"); + + private final Value value; + + private final String string; + + CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName + && this.string.equals( + ((CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case USDC_E: + return visitor.visitUsdcE(); + case USDC: + return visitor.visitUsdc(); + case XO: + return visitor.visitXo(); + case ARB: + return visitor.visitArb(); + case W_ETH: + return visitor.visitWEth(); + case BNB: + return visitor.visitBnb(); + case USDT0: + return visitor.visitUsdt0(); + case XPL: + return visitor.visitXpl(); + case HYPE: + return visitor.visitHype(); + case SOL: + return visitor.visitSol(); + case USDG: + return visitor.visitUsdg(); + case US_DM: + return visitor.visitUsDm(); + case EURC: + return visitor.visitEurc(); + case USD1: + return visitor.visitUsd1(); + case ETH: + return visitor.visitEth(); + case USDT: + return visitor.visitUsdt(); + case P_USD: + return visitor.visitPUsd(); + case PYUSD: + return visitor.visitPyusd(); + case US_DE: + return visitor.visitUsDe(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName valueOf(String value) { + switch (value) { + case "USDC.e": + return USDC_E; + case "USDC": + return USDC; + case "XO": + return XO; + case "ARB": + return ARB; + case "wETH": + return W_ETH; + case "BNB": + return BNB; + case "USDT0": + return USDT0; + case "XPL": + return XPL; + case "HYPE": + return HYPE; + case "SOL": + return SOL; + case "USDG": + return USDG; + case "USDm": + return US_DM; + case "EURC": + return EURC; + case "USD1": + return USD1; + case "ETH": + return ETH; + case "USDT": + return USDT; + case "pUSD": + return P_USD; + case "PYUSD": + return PYUSD; + case "USDe": + return US_DE; + default: + return new CreateDepositsResponseMethodsCryptoItemSupportedCurrenciesItemName(Value.UNKNOWN, value); + } + } + + public enum Value { + ARB, + + BNB, + + ETH, + + EURC, + + HYPE, + + PYUSD, + + SOL, + + USD1, + + USDC, + + USDC_E, + + USDG, + + USDT, + + USDT0, + + US_DE, + + US_DM, + + XO, + + XPL, + + P_USD, + + W_ETH, + + UNKNOWN + } + + public interface Visitor { + T visitArb(); + + T visitBnb(); + + T visitEth(); + + T visitEurc(); + + T visitHype(); + + T visitPyusd(); + + T visitSol(); + + T visitUsd1(); + + T visitUsdc(); + + T visitUsdcE(); + + T visitUsdg(); + + T visitUsdt(); + + T visitUsdt0(); + + T visitUsDe(); + + T visitUsDm(); + + T visitXo(); + + T visitXpl(); + + T visitPUsd(); + + T visitWEth(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseObject.java b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseObject.java new file mode 100644 index 00000000..06f58a14 --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/CreateDepositsResponseObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateDepositsResponseObject { + public static final CreateDepositsResponseObject DEPOSIT = + new CreateDepositsResponseObject(Value.DEPOSIT, "deposit"); + + private final Value value; + + private final String string; + + CreateDepositsResponseObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateDepositsResponseObject + && this.string.equals(((CreateDepositsResponseObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DEPOSIT: + return visitor.visitDeposit(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateDepositsResponseObject valueOf(String value) { + switch (value) { + case "deposit": + return DEPOSIT; + default: + return new CreateDepositsResponseObject(Value.UNKNOWN, value); + } + } + + public enum Value { + DEPOSIT, + + UNKNOWN + } + + public interface Visitor { + T visitDeposit(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/PostDepositSucceededPayload.java b/src/main/java/com/whop/api/resources/deposits/types/PostDepositSucceededPayload.java new file mode 100644 index 00000000..6e76b456 --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/PostDepositSucceededPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.LedgerActivity; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostDepositSucceededPayload.Builder.class) +public final class PostDepositSucceededPayload { + private final Optional accountId; + + private final PostDepositSucceededPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final LedgerActivity data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostDepositSucceededPayloadType type; + + private final Map additionalProperties; + + private PostDepositSucceededPayload( + Optional accountId, + PostDepositSucceededPayloadApiVersion apiVersion, + Optional apiVersionDate, + LedgerActivity data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostDepositSucceededPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostDepositSucceededPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public LedgerActivity getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostDepositSucceededPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostDepositSucceededPayload && equalTo((PostDepositSucceededPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostDepositSucceededPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostDepositSucceededPayloadApiVersion apiVersion); + + Builder from(PostDepositSucceededPayload other); + } + + public interface DataStage { + IdStage data(@NotNull LedgerActivity data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostDepositSucceededPayloadType type); + } + + public interface _FinalStage { + PostDepositSucceededPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostDepositSucceededPayloadApiVersion apiVersion; + + private LedgerActivity data; + + private String id; + + private OffsetDateTime timestamp; + + private PostDepositSucceededPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostDepositSucceededPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostDepositSucceededPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull LedgerActivity data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostDepositSucceededPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostDepositSucceededPayload build() { + return new PostDepositSucceededPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/PostDepositSucceededPayloadApiVersion.java b/src/main/java/com/whop/api/resources/deposits/types/PostDepositSucceededPayloadApiVersion.java new file mode 100644 index 00000000..c2e1c4fd --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/PostDepositSucceededPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostDepositSucceededPayloadApiVersion { + public static final PostDepositSucceededPayloadApiVersion V1 = + new PostDepositSucceededPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostDepositSucceededPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostDepositSucceededPayloadApiVersion + && this.string.equals(((PostDepositSucceededPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostDepositSucceededPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostDepositSucceededPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/deposits/types/PostDepositSucceededPayloadType.java b/src/main/java/com/whop/api/resources/deposits/types/PostDepositSucceededPayloadType.java new file mode 100644 index 00000000..58b440da --- /dev/null +++ b/src/main/java/com/whop/api/resources/deposits/types/PostDepositSucceededPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.deposits.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostDepositSucceededPayloadType { + public static final PostDepositSucceededPayloadType DEPOSIT_SUCCEEDED = + new PostDepositSucceededPayloadType(Value.DEPOSIT_SUCCEEDED, "deposit.succeeded"); + + private final Value value; + + private final String string; + + PostDepositSucceededPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostDepositSucceededPayloadType + && this.string.equals(((PostDepositSucceededPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DEPOSIT_SUCCEEDED: + return visitor.visitDepositSucceeded(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostDepositSucceededPayloadType valueOf(String value) { + switch (value) { + case "deposit.succeeded": + return DEPOSIT_SUCCEEDED; + default: + return new PostDepositSucceededPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + DEPOSIT_SUCCEEDED, + + UNKNOWN + } + + public interface Visitor { + T visitDepositSucceeded(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/disputealerts/AsyncDisputeAlertsClient.java b/src/main/java/com/whop/api/resources/disputealerts/AsyncDisputeAlertsClient.java new file mode 100644 index 00000000..ade7dee2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputealerts/AsyncDisputeAlertsClient.java @@ -0,0 +1,88 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputealerts; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.disputealerts.requests.ListDisputeAlertsRequest; +import com.whop.api.resources.disputealerts.requests.RetrieveDisputeAlertsRequest; +import com.whop.api.types.DisputeAlert; +import java.util.concurrent.CompletableFuture; + +public class AsyncDisputeAlertsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawDisputeAlertsClient rawClient; + + public AsyncDisputeAlertsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawDisputeAlertsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawDisputeAlertsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public CompletableFuture> list(ListDisputeAlertsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public CompletableFuture> list( + ListDisputeAlertsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public CompletableFuture retrieve(String id, RetrieveDisputeAlertsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public CompletableFuture retrieve( + String id, RetrieveDisputeAlertsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/disputealerts/AsyncRawDisputeAlertsClient.java b/src/main/java/com/whop/api/resources/disputealerts/AsyncRawDisputeAlertsClient.java new file mode 100644 index 00000000..ec452ec2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputealerts/AsyncRawDisputeAlertsClient.java @@ -0,0 +1,297 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputealerts; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.disputealerts.requests.ListDisputeAlertsRequest; +import com.whop.api.resources.disputealerts.requests.RetrieveDisputeAlertsRequest; +import com.whop.api.resources.disputealerts.types.ListDisputeAlertsResponse; +import com.whop.api.types.DisputeAlert; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawDisputeAlertsClient { + protected final ClientOptions clientOptions; + + public AsyncRawDisputeAlertsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public CompletableFuture>> list() { + return list(ListDisputeAlertsRequest.builder().build()); + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListDisputeAlertsRequest.builder().build(), requestOptions); + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public CompletableFuture>> list( + ListDisputeAlertsRequest request) { + return list(request, null); + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public CompletableFuture>> list( + ListDisputeAlertsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dispute_alerts"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getPaymentId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "payment_id", request.getPaymentId().get(), false); + } + if (request.getType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "type", request.getType().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListDisputeAlertsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListDisputeAlertsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListDisputeAlertsRequest nextRequest = ListDisputeAlertsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveDisputeAlertsRequest.builder().build()); + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveDisputeAlertsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public CompletableFuture> retrieve( + String id, RetrieveDisputeAlertsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public CompletableFuture> retrieve( + String id, RetrieveDisputeAlertsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dispute_alerts") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DisputeAlert.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/disputealerts/DisputeAlertsClient.java b/src/main/java/com/whop/api/resources/disputealerts/DisputeAlertsClient.java new file mode 100644 index 00000000..c4e13bea --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputealerts/DisputeAlertsClient.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputealerts; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.disputealerts.requests.ListDisputeAlertsRequest; +import com.whop.api.resources.disputealerts.requests.RetrieveDisputeAlertsRequest; +import com.whop.api.types.DisputeAlert; + +public class DisputeAlertsClient { + protected final ClientOptions clientOptions; + + private final RawDisputeAlertsClient rawClient; + + public DisputeAlertsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawDisputeAlertsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawDisputeAlertsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public SyncPagingIterable list(ListDisputeAlertsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public SyncPagingIterable list(ListDisputeAlertsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public DisputeAlert retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public DisputeAlert retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public DisputeAlert retrieve(String id, RetrieveDisputeAlertsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public DisputeAlert retrieve(String id, RetrieveDisputeAlertsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/disputealerts/RawDisputeAlertsClient.java b/src/main/java/com/whop/api/resources/disputealerts/RawDisputeAlertsClient.java new file mode 100644 index 00000000..4655feb7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputealerts/RawDisputeAlertsClient.java @@ -0,0 +1,243 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputealerts; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.disputealerts.requests.ListDisputeAlertsRequest; +import com.whop.api.resources.disputealerts.requests.RetrieveDisputeAlertsRequest; +import com.whop.api.resources.disputealerts.types.ListDisputeAlertsResponse; +import com.whop.api.types.DisputeAlert; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawDisputeAlertsClient { + protected final ClientOptions clientOptions; + + public RawDisputeAlertsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public WhopApiHttpResponse> list() { + return list(ListDisputeAlertsRequest.builder().build()); + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListDisputeAlertsRequest.builder().build(), requestOptions); + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public WhopApiHttpResponse> list(ListDisputeAlertsRequest request) { + return list(request, null); + } + + /** + * Lists the dispute alerts and early fraud warnings across the accounts you can read. + */ + public WhopApiHttpResponse> list( + ListDisputeAlertsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dispute_alerts"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getPaymentId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "payment_id", request.getPaymentId().get(), false); + } + if (request.getType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "type", request.getType().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListDisputeAlertsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListDisputeAlertsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListDisputeAlertsRequest nextRequest = ListDisputeAlertsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveDisputeAlertsRequest.builder().build()); + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveDisputeAlertsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveDisputeAlertsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single dispute alert or early fraud warning by ID. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveDisputeAlertsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dispute_alerts") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DisputeAlert.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputealerts/requests/ListDisputeAlertsRequest.java b/src/main/java/com/whop/api/resources/disputealerts/requests/ListDisputeAlertsRequest.java new file mode 100644 index 00000000..34f0aa51 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputealerts/requests/ListDisputeAlertsRequest.java @@ -0,0 +1,439 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputealerts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.disputealerts.types.ListDisputeAlertsRequestDirection; +import com.whop.api.resources.disputealerts.types.ListDisputeAlertsRequestOrder; +import com.whop.api.resources.disputealerts.types.ListDisputeAlertsRequestType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDisputeAlertsRequest.Builder.class) +public final class ListDisputeAlertsRequest { + private final Optional accountId; + + private final Optional paymentId; + + private final Optional type; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Optional order; + + private final Optional direction; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Map additionalProperties; + + private ListDisputeAlertsRequest( + Optional accountId, + Optional paymentId, + Optional type, + Optional first, + Optional after, + Optional last, + Optional before, + Optional order, + Optional direction, + Optional createdBefore, + Optional createdAfter, + Map additionalProperties) { + this.accountId = accountId; + this.paymentId = paymentId; + this.type = type; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.order = order; + this.direction = direction; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only alerts on this account's payments (biz_ tag). Omit it to cover every account you can read. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Only alerts on this payment (pay_ tag). A payment can carry several. + */ + @JsonProperty("payment_id") + public Optional getPaymentId() { + return paymentId; + } + + /** + * @return Only alerts of this kind. early_fraud_warning for issuer fraud reports, dispute_alert for pre-dispute notices, rapid_dispute_resolution for Visa RDR cases the network already closed. + */ + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return The number of alerts to return (default 20, max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns alerts after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of alerts to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns alerts before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The field to sort alerts by. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Only alerts Whop received before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only alerts Whop received after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListDisputeAlertsRequest && equalTo((ListDisputeAlertsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDisputeAlertsRequest other) { + return accountId.equals(other.accountId) + && paymentId.equals(other.paymentId) + && type.equals(other.type) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before) + && order.equals(other.order) + && direction.equals(other.direction) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.paymentId, + this.type, + this.first, + this.after, + this.last, + this.before, + this.order, + this.direction, + this.createdBefore, + this.createdAfter); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional paymentId = Optional.empty(); + + private Optional type = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListDisputeAlertsRequest other) { + accountId(other.getAccountId()); + paymentId(other.getPaymentId()); + type(other.getType()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + order(other.getOrder()); + direction(other.getDirection()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + return this; + } + + /** + *

Only alerts on this account's payments (biz_ tag). Omit it to cover every account you can read.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Only alerts on this payment (pay_ tag). A payment can carry several.

+ */ + @JsonSetter(value = "payment_id", nulls = Nulls.SKIP) + public Builder paymentId(Optional paymentId) { + this.paymentId = paymentId; + return this; + } + + public Builder paymentId(String paymentId) { + this.paymentId = Optional.ofNullable(paymentId); + return this; + } + + /** + *

Only alerts of this kind. early_fraud_warning for issuer fraud reports, dispute_alert for pre-dispute notices, rapid_dispute_resolution for Visa RDR cases the network already closed.

+ */ + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(ListDisputeAlertsRequestType type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

The number of alerts to return (default 20, max 100).

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor; returns alerts after this position.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The number of alerts to return from the end of the range.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

A cursor; returns alerts before this position.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The field to sort alerts by.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListDisputeAlertsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListDisputeAlertsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Only alerts Whop received before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only alerts Whop received after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + public ListDisputeAlertsRequest build() { + return new ListDisputeAlertsRequest( + accountId, + paymentId, + type, + first, + after, + last, + before, + order, + direction, + createdBefore, + createdAfter, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputealerts/requests/RetrieveDisputeAlertsRequest.java b/src/main/java/com/whop/api/resources/disputealerts/requests/RetrieveDisputeAlertsRequest.java new file mode 100644 index 00000000..b4b838b2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputealerts/requests/RetrieveDisputeAlertsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputealerts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveDisputeAlertsRequest.Builder.class) +public final class RetrieveDisputeAlertsRequest { + private final Map additionalProperties; + + private RetrieveDisputeAlertsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveDisputeAlertsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveDisputeAlertsRequest other) { + return this; + } + + public RetrieveDisputeAlertsRequest build() { + return new RetrieveDisputeAlertsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputealerts/types/ListDisputeAlertsRequestDirection.java b/src/main/java/com/whop/api/resources/disputealerts/types/ListDisputeAlertsRequestDirection.java new file mode 100644 index 00000000..ddddf3dc --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputealerts/types/ListDisputeAlertsRequestDirection.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputealerts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListDisputeAlertsRequestDirection { + public static final ListDisputeAlertsRequestDirection ASC = new ListDisputeAlertsRequestDirection(Value.ASC, "asc"); + + public static final ListDisputeAlertsRequestDirection DESC = + new ListDisputeAlertsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListDisputeAlertsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListDisputeAlertsRequestDirection + && this.string.equals(((ListDisputeAlertsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListDisputeAlertsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListDisputeAlertsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/disputealerts/types/ListDisputeAlertsRequestOrder.java b/src/main/java/com/whop/api/resources/disputealerts/types/ListDisputeAlertsRequestOrder.java new file mode 100644 index 00000000..7e9c37d9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputealerts/types/ListDisputeAlertsRequestOrder.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputealerts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListDisputeAlertsRequestOrder { + public static final ListDisputeAlertsRequestOrder REPORTED_AT = + new ListDisputeAlertsRequestOrder(Value.REPORTED_AT, "reported_at"); + + public static final ListDisputeAlertsRequestOrder AMOUNT = + new ListDisputeAlertsRequestOrder(Value.AMOUNT, "amount"); + + public static final ListDisputeAlertsRequestOrder CREATED_AT = + new ListDisputeAlertsRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListDisputeAlertsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListDisputeAlertsRequestOrder + && this.string.equals(((ListDisputeAlertsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REPORTED_AT: + return visitor.visitReportedAt(); + case AMOUNT: + return visitor.visitAmount(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListDisputeAlertsRequestOrder valueOf(String value) { + switch (value) { + case "reported_at": + return REPORTED_AT; + case "amount": + return AMOUNT; + case "created_at": + return CREATED_AT; + default: + return new ListDisputeAlertsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + REPORTED_AT, + + AMOUNT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitReportedAt(); + + T visitAmount(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/disputealerts/types/ListDisputeAlertsRequestType.java b/src/main/java/com/whop/api/resources/disputealerts/types/ListDisputeAlertsRequestType.java new file mode 100644 index 00000000..eaf8c43b --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputealerts/types/ListDisputeAlertsRequestType.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputealerts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListDisputeAlertsRequestType { + public static final ListDisputeAlertsRequestType RAPID_DISPUTE_RESOLUTION = + new ListDisputeAlertsRequestType(Value.RAPID_DISPUTE_RESOLUTION, "rapid_dispute_resolution"); + + public static final ListDisputeAlertsRequestType EARLY_FRAUD_WARNING = + new ListDisputeAlertsRequestType(Value.EARLY_FRAUD_WARNING, "early_fraud_warning"); + + public static final ListDisputeAlertsRequestType DISPUTE_ALERT = + new ListDisputeAlertsRequestType(Value.DISPUTE_ALERT, "dispute_alert"); + + private final Value value; + + private final String string; + + ListDisputeAlertsRequestType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListDisputeAlertsRequestType + && this.string.equals(((ListDisputeAlertsRequestType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RAPID_DISPUTE_RESOLUTION: + return visitor.visitRapidDisputeResolution(); + case EARLY_FRAUD_WARNING: + return visitor.visitEarlyFraudWarning(); + case DISPUTE_ALERT: + return visitor.visitDisputeAlert(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListDisputeAlertsRequestType valueOf(String value) { + switch (value) { + case "rapid_dispute_resolution": + return RAPID_DISPUTE_RESOLUTION; + case "early_fraud_warning": + return EARLY_FRAUD_WARNING; + case "dispute_alert": + return DISPUTE_ALERT; + default: + return new ListDisputeAlertsRequestType(Value.UNKNOWN, value); + } + } + + public enum Value { + EARLY_FRAUD_WARNING, + + DISPUTE_ALERT, + + RAPID_DISPUTE_RESOLUTION, + + UNKNOWN + } + + public interface Visitor { + T visitEarlyFraudWarning(); + + T visitDisputeAlert(); + + T visitRapidDisputeResolution(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/disputealerts/types/ListDisputeAlertsResponse.java b/src/main/java/com/whop/api/resources/disputealerts/types/ListDisputeAlertsResponse.java new file mode 100644 index 00000000..b70c456e --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputealerts/types/ListDisputeAlertsResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputealerts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.DisputeAlert; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDisputeAlertsResponse.Builder.class) +public final class ListDisputeAlertsResponse { + private final List data; + + private final ListDisputeAlertsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListDisputeAlertsResponse( + List data, + ListDisputeAlertsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListDisputeAlertsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListDisputeAlertsResponse && equalTo((ListDisputeAlertsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDisputeAlertsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListDisputeAlertsResponsePageInfo pageInfo); + + Builder from(ListDisputeAlertsResponse other); + } + + public interface _FinalStage { + ListDisputeAlertsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(DisputeAlert data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListDisputeAlertsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListDisputeAlertsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListDisputeAlertsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(DisputeAlert data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListDisputeAlertsResponse build() { + return new ListDisputeAlertsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputealerts/types/ListDisputeAlertsResponsePageInfo.java b/src/main/java/com/whop/api/resources/disputealerts/types/ListDisputeAlertsResponsePageInfo.java new file mode 100644 index 00000000..035abc31 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputealerts/types/ListDisputeAlertsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputealerts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDisputeAlertsResponsePageInfo.Builder.class) +public final class ListDisputeAlertsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListDisputeAlertsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListDisputeAlertsResponsePageInfo && equalTo((ListDisputeAlertsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDisputeAlertsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListDisputeAlertsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListDisputeAlertsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListDisputeAlertsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListDisputeAlertsResponsePageInfo build() { + return new ListDisputeAlertsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputealerts/types/PostDisputeAlertCreatedPayload.java b/src/main/java/com/whop/api/resources/disputealerts/types/PostDisputeAlertCreatedPayload.java new file mode 100644 index 00000000..c3784346 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputealerts/types/PostDisputeAlertCreatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputealerts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.DisputeAlert; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostDisputeAlertCreatedPayload.Builder.class) +public final class PostDisputeAlertCreatedPayload { + private final Optional accountId; + + private final PostDisputeAlertCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final DisputeAlert data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostDisputeAlertCreatedPayloadType type; + + private final Map additionalProperties; + + private PostDisputeAlertCreatedPayload( + Optional accountId, + PostDisputeAlertCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + DisputeAlert data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostDisputeAlertCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostDisputeAlertCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public DisputeAlert getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostDisputeAlertCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostDisputeAlertCreatedPayload && equalTo((PostDisputeAlertCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostDisputeAlertCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostDisputeAlertCreatedPayloadApiVersion apiVersion); + + Builder from(PostDisputeAlertCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull DisputeAlert data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostDisputeAlertCreatedPayloadType type); + } + + public interface _FinalStage { + PostDisputeAlertCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostDisputeAlertCreatedPayloadApiVersion apiVersion; + + private DisputeAlert data; + + private String id; + + private OffsetDateTime timestamp; + + private PostDisputeAlertCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostDisputeAlertCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostDisputeAlertCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull DisputeAlert data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostDisputeAlertCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostDisputeAlertCreatedPayload build() { + return new PostDisputeAlertCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputealerts/types/PostDisputeAlertCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/disputealerts/types/PostDisputeAlertCreatedPayloadApiVersion.java new file mode 100644 index 00000000..7324e774 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputealerts/types/PostDisputeAlertCreatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputealerts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostDisputeAlertCreatedPayloadApiVersion { + public static final PostDisputeAlertCreatedPayloadApiVersion V1 = + new PostDisputeAlertCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostDisputeAlertCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostDisputeAlertCreatedPayloadApiVersion + && this.string.equals(((PostDisputeAlertCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostDisputeAlertCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostDisputeAlertCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/disputealerts/types/PostDisputeAlertCreatedPayloadType.java b/src/main/java/com/whop/api/resources/disputealerts/types/PostDisputeAlertCreatedPayloadType.java new file mode 100644 index 00000000..96c8744f --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputealerts/types/PostDisputeAlertCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputealerts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostDisputeAlertCreatedPayloadType { + public static final PostDisputeAlertCreatedPayloadType DISPUTE_ALERT_CREATED = + new PostDisputeAlertCreatedPayloadType(Value.DISPUTE_ALERT_CREATED, "dispute_alert.created"); + + private final Value value; + + private final String string; + + PostDisputeAlertCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostDisputeAlertCreatedPayloadType + && this.string.equals(((PostDisputeAlertCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DISPUTE_ALERT_CREATED: + return visitor.visitDisputeAlertCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostDisputeAlertCreatedPayloadType valueOf(String value) { + switch (value) { + case "dispute_alert.created": + return DISPUTE_ALERT_CREATED; + default: + return new PostDisputeAlertCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + DISPUTE_ALERT_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitDisputeAlertCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/AsyncDisputesClient.java b/src/main/java/com/whop/api/resources/disputes/AsyncDisputesClient.java new file mode 100644 index 00000000..662e0be9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/AsyncDisputesClient.java @@ -0,0 +1,341 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.disputes.requests.ListDisputesRequest; +import com.whop.api.resources.disputes.requests.RetrieveDisputesRequest; +import com.whop.api.resources.disputes.requests.SubmitDisputesRequest; +import com.whop.api.resources.disputes.requests.SubmitEvidenceDisputeRequest; +import com.whop.api.resources.disputes.requests.SummaryDisputesRequest; +import com.whop.api.resources.disputes.requests.UpdateDisputesRequest; +import com.whop.api.resources.disputes.requests.UpdateEvidenceDisputeRequest; +import com.whop.api.resources.disputes.requests.UploadEvidenceDisputesRequest; +import com.whop.api.resources.disputes.types.SummaryDisputesResponse; +import com.whop.api.types.Dispute; +import java.util.concurrent.CompletableFuture; + +public class AsyncDisputesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawDisputesClient rawClient; + + public AsyncDisputesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawDisputesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawDisputesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the disputes across the accounts you can read. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the disputes across the accounts you can read. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the disputes across the accounts you can read. + */ + public CompletableFuture> list(ListDisputesRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the disputes across the accounts you can read. + */ + public CompletableFuture> list( + ListDisputesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public CompletableFuture summary() { + return this.rawClient.summary().thenApply(response -> response.body()); + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public CompletableFuture summary(RequestOptions requestOptions) { + return this.rawClient.summary(requestOptions).thenApply(response -> response.body()); + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public CompletableFuture summary(SummaryDisputesRequest request) { + return this.rawClient.summary(request).thenApply(response -> response.body()); + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public CompletableFuture summary( + SummaryDisputesRequest request, RequestOptions requestOptions) { + return this.rawClient.summary(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single dispute. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a single dispute. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single dispute. + */ + public CompletableFuture retrieve(String id, RetrieveDisputesRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a single dispute. + */ + public CompletableFuture retrieve( + String id, RetrieveDisputesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public CompletableFuture update(String id, UpdateDisputesRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public CompletableFuture update(String id, UpdateDisputesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public CompletableFuture submit(String id) { + return this.rawClient.submit(id).thenApply(response -> response.body()); + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public CompletableFuture submit(String id, RequestOptions requestOptions) { + return this.rawClient.submit(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public CompletableFuture submit(String id, SubmitDisputesRequest request) { + return this.rawClient.submit(id, request).thenApply(response -> response.body()); + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public CompletableFuture submit(String id, SubmitDisputesRequest request, RequestOptions requestOptions) { + return this.rawClient.submit(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture submitEvidenceDispute(String id) { + return this.rawClient.submitEvidenceDispute(id).thenApply(response -> response.body()); + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture submitEvidenceDispute(String id, RequestOptions requestOptions) { + return this.rawClient.submitEvidenceDispute(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture submitEvidenceDispute(String id, SubmitEvidenceDisputeRequest request) { + return this.rawClient.submitEvidenceDispute(id, request).thenApply(response -> response.body()); + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture submitEvidenceDispute( + String id, SubmitEvidenceDisputeRequest request, RequestOptions requestOptions) { + return this.rawClient.submitEvidenceDispute(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture updateEvidenceDispute(String id) { + return this.rawClient.updateEvidenceDispute(id).thenApply(response -> response.body()); + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture updateEvidenceDispute(String id, RequestOptions requestOptions) { + return this.rawClient.updateEvidenceDispute(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture updateEvidenceDispute(String id, UpdateEvidenceDisputeRequest request) { + return this.rawClient.updateEvidenceDispute(id, request).thenApply(response -> response.body()); + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture updateEvidenceDispute( + String id, UpdateEvidenceDisputeRequest request, RequestOptions requestOptions) { + return this.rawClient.updateEvidenceDispute(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Replaces the full set of uploaded evidence documents on a dispute, beyond the four fixed evidence slots. Send the files as multipart file parts to upload and attach in one call, or reference files already stored by id/direct_upload_id. Send every document the packet should carry — up to 10, 10MB each and 25MB in total; an empty list removes them all. Accepted content types: application/pdf, application/json, image/jpeg, image/png, image/webp — any other type is rejected. + */ + public CompletableFuture uploadEvidence(String id, UploadEvidenceDisputesRequest request) { + return this.rawClient.uploadEvidence(id, request).thenApply(response -> response.body()); + } + + /** + * Replaces the full set of uploaded evidence documents on a dispute, beyond the four fixed evidence slots. Send the files as multipart file parts to upload and attach in one call, or reference files already stored by id/direct_upload_id. Send every document the packet should carry — up to 10, 10MB each and 25MB in total; an empty list removes them all. Accepted content types: application/pdf, application/json, image/jpeg, image/png, image/webp — any other type is rejected. + */ + public CompletableFuture uploadEvidence( + String id, UploadEvidenceDisputesRequest request, RequestOptions requestOptions) { + return this.rawClient.uploadEvidence(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/AsyncRawDisputesClient.java b/src/main/java/com/whop/api/resources/disputes/AsyncRawDisputesClient.java new file mode 100644 index 00000000..b3836d39 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/AsyncRawDisputesClient.java @@ -0,0 +1,1042 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.disputes.requests.ListDisputesRequest; +import com.whop.api.resources.disputes.requests.RetrieveDisputesRequest; +import com.whop.api.resources.disputes.requests.SubmitDisputesRequest; +import com.whop.api.resources.disputes.requests.SubmitEvidenceDisputeRequest; +import com.whop.api.resources.disputes.requests.SummaryDisputesRequest; +import com.whop.api.resources.disputes.requests.UpdateDisputesRequest; +import com.whop.api.resources.disputes.requests.UpdateEvidenceDisputeRequest; +import com.whop.api.resources.disputes.requests.UploadEvidenceDisputesRequest; +import com.whop.api.resources.disputes.types.ListDisputesResponse; +import com.whop.api.resources.disputes.types.SummaryDisputesResponse; +import com.whop.api.types.Dispute; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawDisputesClient { + protected final ClientOptions clientOptions; + + public AsyncRawDisputesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the disputes across the accounts you can read. + */ + public CompletableFuture>> list() { + return list(ListDisputesRequest.builder().build()); + } + + /** + * Lists the disputes across the accounts you can read. + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(ListDisputesRequest.builder().build(), requestOptions); + } + + /** + * Lists the disputes across the accounts you can read. + */ + public CompletableFuture>> list(ListDisputesRequest request) { + return list(request, null); + } + + /** + * Lists the disputes across the accounts you can read. + */ + public CompletableFuture>> list( + ListDisputesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListDisputesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListDisputesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListDisputesRequest nextRequest = ListDisputesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable(startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public CompletableFuture> summary() { + return summary(SummaryDisputesRequest.builder().build()); + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public CompletableFuture> summary(RequestOptions requestOptions) { + return summary(SummaryDisputesRequest.builder().build(), requestOptions); + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public CompletableFuture> summary(SummaryDisputesRequest request) { + return summary(request, null); + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public CompletableFuture> summary( + SummaryDisputesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes/summary"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getGroups().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "groups", request.getGroups().get(), true); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SummaryDisputesResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a single dispute. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveDisputesRequest.builder().build()); + } + + /** + * Retrieves a single dispute. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveDisputesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single dispute. + */ + public CompletableFuture> retrieve(String id, RetrieveDisputesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single dispute. + */ + public CompletableFuture> retrieve( + String id, RetrieveDisputesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Dispute.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateDisputesRequest.builder().build()); + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateDisputesRequest.builder().build(), requestOptions); + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public CompletableFuture> update(String id, UpdateDisputesRequest request) { + return update(id, request, null); + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public CompletableFuture> update( + String id, UpdateDisputesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Dispute.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public CompletableFuture> submit(String id) { + return submit(id, SubmitDisputesRequest.builder().build()); + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public CompletableFuture> submit(String id, RequestOptions requestOptions) { + return submit(id, SubmitDisputesRequest.builder().build(), requestOptions); + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public CompletableFuture> submit(String id, SubmitDisputesRequest request) { + return submit(id, request, null); + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public CompletableFuture> submit( + String id, SubmitDisputesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes") + .addPathSegment(id) + .addPathSegments("submit"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Dispute.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture> submitEvidenceDispute(String id) { + return submitEvidenceDispute(id, SubmitEvidenceDisputeRequest.builder().build()); + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture> submitEvidenceDispute( + String id, RequestOptions requestOptions) { + return submitEvidenceDispute(id, SubmitEvidenceDisputeRequest.builder().build(), requestOptions); + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture> submitEvidenceDispute( + String id, SubmitEvidenceDisputeRequest request) { + return submitEvidenceDispute(id, request, null); + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture> submitEvidenceDispute( + String id, SubmitEvidenceDisputeRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes") + .addPathSegment(id) + .addPathSegments("submit_evidence"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Dispute.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture> updateEvidenceDispute(String id) { + return updateEvidenceDispute(id, UpdateEvidenceDisputeRequest.builder().build()); + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture> updateEvidenceDispute( + String id, RequestOptions requestOptions) { + return updateEvidenceDispute(id, UpdateEvidenceDisputeRequest.builder().build(), requestOptions); + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture> updateEvidenceDispute( + String id, UpdateEvidenceDisputeRequest request) { + return updateEvidenceDispute(id, request, null); + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture> updateEvidenceDispute( + String id, UpdateEvidenceDisputeRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes") + .addPathSegment(id) + .addPathSegments("update_evidence"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Dispute.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Replaces the full set of uploaded evidence documents on a dispute, beyond the four fixed evidence slots. Send the files as multipart file parts to upload and attach in one call, or reference files already stored by id/direct_upload_id. Send every document the packet should carry — up to 10, 10MB each and 25MB in total; an empty list removes them all. Accepted content types: application/pdf, application/json, image/jpeg, image/png, image/webp — any other type is rejected. + */ + public CompletableFuture> uploadEvidence( + String id, UploadEvidenceDisputesRequest request) { + return uploadEvidence(id, request, null); + } + + /** + * Replaces the full set of uploaded evidence documents on a dispute, beyond the four fixed evidence slots. Send the files as multipart file parts to upload and attach in one call, or reference files already stored by id/direct_upload_id. Send every document the packet should carry — up to 10, 10MB each and 25MB in total; an empty list removes them all. Accepted content types: application/pdf, application/json, image/jpeg, image/png, image/webp — any other type is rejected. + */ + public CompletableFuture> uploadEvidence( + String id, UploadEvidenceDisputesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes") + .addPathSegment(id) + .addPathSegments("upload_evidence"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Dispute.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/DisputesClient.java b/src/main/java/com/whop/api/resources/disputes/DisputesClient.java new file mode 100644 index 00000000..68b49f30 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/DisputesClient.java @@ -0,0 +1,336 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.disputes.requests.ListDisputesRequest; +import com.whop.api.resources.disputes.requests.RetrieveDisputesRequest; +import com.whop.api.resources.disputes.requests.SubmitDisputesRequest; +import com.whop.api.resources.disputes.requests.SubmitEvidenceDisputeRequest; +import com.whop.api.resources.disputes.requests.SummaryDisputesRequest; +import com.whop.api.resources.disputes.requests.UpdateDisputesRequest; +import com.whop.api.resources.disputes.requests.UpdateEvidenceDisputeRequest; +import com.whop.api.resources.disputes.requests.UploadEvidenceDisputesRequest; +import com.whop.api.resources.disputes.types.SummaryDisputesResponse; +import com.whop.api.types.Dispute; + +public class DisputesClient { + protected final ClientOptions clientOptions; + + private final RawDisputesClient rawClient; + + public DisputesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawDisputesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawDisputesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the disputes across the accounts you can read. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the disputes across the accounts you can read. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the disputes across the accounts you can read. + */ + public SyncPagingIterable list(ListDisputesRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the disputes across the accounts you can read. + */ + public SyncPagingIterable list(ListDisputesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public SummaryDisputesResponse summary() { + return this.rawClient.summary().body(); + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public SummaryDisputesResponse summary(RequestOptions requestOptions) { + return this.rawClient.summary(requestOptions).body(); + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public SummaryDisputesResponse summary(SummaryDisputesRequest request) { + return this.rawClient.summary(request).body(); + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public SummaryDisputesResponse summary(SummaryDisputesRequest request, RequestOptions requestOptions) { + return this.rawClient.summary(request, requestOptions).body(); + } + + /** + * Retrieves a single dispute. + */ + public Dispute retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a single dispute. + */ + public Dispute retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a single dispute. + */ + public Dispute retrieve(String id, RetrieveDisputesRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a single dispute. + */ + public Dispute retrieve(String id, RetrieveDisputesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public Dispute update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public Dispute update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public Dispute update(String id, UpdateDisputesRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public Dispute update(String id, UpdateDisputesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public Dispute submit(String id) { + return this.rawClient.submit(id).body(); + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public Dispute submit(String id, RequestOptions requestOptions) { + return this.rawClient.submit(id, requestOptions).body(); + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public Dispute submit(String id, SubmitDisputesRequest request) { + return this.rawClient.submit(id, request).body(); + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public Dispute submit(String id, SubmitDisputesRequest request, RequestOptions requestOptions) { + return this.rawClient.submit(id, request, requestOptions).body(); + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public Dispute submitEvidenceDispute(String id) { + return this.rawClient.submitEvidenceDispute(id).body(); + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public Dispute submitEvidenceDispute(String id, RequestOptions requestOptions) { + return this.rawClient.submitEvidenceDispute(id, requestOptions).body(); + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public Dispute submitEvidenceDispute(String id, SubmitEvidenceDisputeRequest request) { + return this.rawClient.submitEvidenceDispute(id, request).body(); + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public Dispute submitEvidenceDispute( + String id, SubmitEvidenceDisputeRequest request, RequestOptions requestOptions) { + return this.rawClient.submitEvidenceDispute(id, request, requestOptions).body(); + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public Dispute updateEvidenceDispute(String id) { + return this.rawClient.updateEvidenceDispute(id).body(); + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public Dispute updateEvidenceDispute(String id, RequestOptions requestOptions) { + return this.rawClient.updateEvidenceDispute(id, requestOptions).body(); + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public Dispute updateEvidenceDispute(String id, UpdateEvidenceDisputeRequest request) { + return this.rawClient.updateEvidenceDispute(id, request).body(); + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public Dispute updateEvidenceDispute( + String id, UpdateEvidenceDisputeRequest request, RequestOptions requestOptions) { + return this.rawClient.updateEvidenceDispute(id, request, requestOptions).body(); + } + + /** + * Replaces the full set of uploaded evidence documents on a dispute, beyond the four fixed evidence slots. Send the files as multipart file parts to upload and attach in one call, or reference files already stored by id/direct_upload_id. Send every document the packet should carry — up to 10, 10MB each and 25MB in total; an empty list removes them all. Accepted content types: application/pdf, application/json, image/jpeg, image/png, image/webp — any other type is rejected. + */ + public Dispute uploadEvidence(String id, UploadEvidenceDisputesRequest request) { + return this.rawClient.uploadEvidence(id, request).body(); + } + + /** + * Replaces the full set of uploaded evidence documents on a dispute, beyond the four fixed evidence slots. Send the files as multipart file parts to upload and attach in one call, or reference files already stored by id/direct_upload_id. Send every document the packet should carry — up to 10, 10MB each and 25MB in total; an empty list removes them all. Accepted content types: application/pdf, application/json, image/jpeg, image/png, image/webp — any other type is rejected. + */ + public Dispute uploadEvidence(String id, UploadEvidenceDisputesRequest request, RequestOptions requestOptions) { + return this.rawClient.uploadEvidence(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/RawDisputesClient.java b/src/main/java/com/whop/api/resources/disputes/RawDisputesClient.java new file mode 100644 index 00000000..62331d95 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/RawDisputesClient.java @@ -0,0 +1,859 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.disputes.requests.ListDisputesRequest; +import com.whop.api.resources.disputes.requests.RetrieveDisputesRequest; +import com.whop.api.resources.disputes.requests.SubmitDisputesRequest; +import com.whop.api.resources.disputes.requests.SubmitEvidenceDisputeRequest; +import com.whop.api.resources.disputes.requests.SummaryDisputesRequest; +import com.whop.api.resources.disputes.requests.UpdateDisputesRequest; +import com.whop.api.resources.disputes.requests.UpdateEvidenceDisputeRequest; +import com.whop.api.resources.disputes.requests.UploadEvidenceDisputesRequest; +import com.whop.api.resources.disputes.types.ListDisputesResponse; +import com.whop.api.resources.disputes.types.SummaryDisputesResponse; +import com.whop.api.types.Dispute; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawDisputesClient { + protected final ClientOptions clientOptions; + + public RawDisputesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the disputes across the accounts you can read. + */ + public WhopApiHttpResponse> list() { + return list(ListDisputesRequest.builder().build()); + } + + /** + * Lists the disputes across the accounts you can read. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListDisputesRequest.builder().build(), requestOptions); + } + + /** + * Lists the disputes across the accounts you can read. + */ + public WhopApiHttpResponse> list(ListDisputesRequest request) { + return list(request, null); + } + + /** + * Lists the disputes across the accounts you can read. + */ + public WhopApiHttpResponse> list( + ListDisputesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListDisputesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListDisputesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListDisputesRequest nextRequest = ListDisputesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public WhopApiHttpResponse summary() { + return summary(SummaryDisputesRequest.builder().build()); + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public WhopApiHttpResponse summary(RequestOptions requestOptions) { + return summary(SummaryDisputesRequest.builder().build(), requestOptions); + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public WhopApiHttpResponse summary(SummaryDisputesRequest request) { + return summary(request, null); + } + + /** + * Totals up the same disputes the list returns, so you can build status tabs and totals without paging through them. + */ + public WhopApiHttpResponse summary( + SummaryDisputesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes/summary"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getGroups().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "groups", request.getGroups().get(), true); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SummaryDisputesResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a single dispute. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveDisputesRequest.builder().build()); + } + + /** + * Retrieves a single dispute. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveDisputesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single dispute. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveDisputesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single dispute. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveDisputesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Dispute.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateDisputesRequest.builder().build()); + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateDisputesRequest.builder().build(), requestOptions); + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public WhopApiHttpResponse update(String id, UpdateDisputesRequest request) { + return update(id, request, null); + } + + /** + * Edits a dispute's evidence, while it is still editable. Sending it is a separate call. + */ + public WhopApiHttpResponse update( + String id, UpdateDisputesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Dispute.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public WhopApiHttpResponse submit(String id) { + return submit(id, SubmitDisputesRequest.builder().build()); + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public WhopApiHttpResponse submit(String id, RequestOptions requestOptions) { + return submit(id, SubmitDisputesRequest.builder().build(), requestOptions); + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public WhopApiHttpResponse submit(String id, SubmitDisputesRequest request) { + return submit(id, request, null); + } + + /** + * Sends a dispute's evidence to the payment processor. This is final — it cannot be edited or sent again. + */ + public WhopApiHttpResponse submit( + String id, SubmitDisputesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes") + .addPathSegment(id) + .addPathSegments("submit"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Dispute.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public WhopApiHttpResponse submitEvidenceDispute(String id) { + return submitEvidenceDispute(id, SubmitEvidenceDisputeRequest.builder().build()); + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public WhopApiHttpResponse submitEvidenceDispute(String id, RequestOptions requestOptions) { + return submitEvidenceDispute(id, SubmitEvidenceDisputeRequest.builder().build(), requestOptions); + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public WhopApiHttpResponse submitEvidenceDispute(String id, SubmitEvidenceDisputeRequest request) { + return submitEvidenceDispute(id, request, null); + } + + /** + * Submit a payment dispute to the payment processor for review. Once submitted, no further edits can be made. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public WhopApiHttpResponse submitEvidenceDispute( + String id, SubmitEvidenceDisputeRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes") + .addPathSegment(id) + .addPathSegments("submit_evidence"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Dispute.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public WhopApiHttpResponse updateEvidenceDispute(String id) { + return updateEvidenceDispute(id, UpdateEvidenceDisputeRequest.builder().build()); + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public WhopApiHttpResponse updateEvidenceDispute(String id, RequestOptions requestOptions) { + return updateEvidenceDispute(id, UpdateEvidenceDisputeRequest.builder().build(), requestOptions); + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public WhopApiHttpResponse updateEvidenceDispute(String id, UpdateEvidenceDisputeRequest request) { + return updateEvidenceDispute(id, request, null); + } + + /** + * Update a dispute with evidence data to attempt to win the dispute. + *

Required permissions:

+ *
    + *
  • payment:dispute
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • company:basic:read
  • + *
  • payment:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public WhopApiHttpResponse updateEvidenceDispute( + String id, UpdateEvidenceDisputeRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes") + .addPathSegment(id) + .addPathSegments("update_evidence"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Dispute.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Replaces the full set of uploaded evidence documents on a dispute, beyond the four fixed evidence slots. Send the files as multipart file parts to upload and attach in one call, or reference files already stored by id/direct_upload_id. Send every document the packet should carry — up to 10, 10MB each and 25MB in total; an empty list removes them all. Accepted content types: application/pdf, application/json, image/jpeg, image/png, image/webp — any other type is rejected. + */ + public WhopApiHttpResponse uploadEvidence(String id, UploadEvidenceDisputesRequest request) { + return uploadEvidence(id, request, null); + } + + /** + * Replaces the full set of uploaded evidence documents on a dispute, beyond the four fixed evidence slots. Send the files as multipart file parts to upload and attach in one call, or reference files already stored by id/direct_upload_id. Send every document the packet should carry — up to 10, 10MB each and 25MB in total; an empty list removes them all. Accepted content types: application/pdf, application/json, image/jpeg, image/png, image/webp — any other type is rejected. + */ + public WhopApiHttpResponse uploadEvidence( + String id, UploadEvidenceDisputesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("disputes") + .addPathSegment(id) + .addPathSegments("upload_evidence"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Dispute.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/requests/ListDisputesRequest.java b/src/main/java/com/whop/api/resources/disputes/requests/ListDisputesRequest.java new file mode 100644 index 00000000..f7402b40 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/requests/ListDisputesRequest.java @@ -0,0 +1,446 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.disputes.types.ListDisputesRequestDirection; +import com.whop.api.resources.disputes.types.ListDisputesRequestOrder; +import com.whop.api.resources.disputes.types.ListDisputesRequestStatusItem; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDisputesRequest.Builder.class) +public final class ListDisputesRequest { + private final Optional> status; + + private final Optional accountId; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Optional order; + + private final Optional direction; + + private final Optional currency; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Map additionalProperties; + + private ListDisputesRequest( + Optional> status, + Optional accountId, + Optional first, + Optional after, + Optional last, + Optional before, + Optional order, + Optional direction, + Optional currency, + Optional createdBefore, + Optional createdAfter, + Map additionalProperties) { + this.status = status; + this.accountId = accountId; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.order = order; + this.direction = direction; + this.currency = currency; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only disputes in these statuses. Repeat the parameter to pass several — one paginated list covers all of them. Covers both chargebacks and inquiries at each stage. A needs_response dispute whose evidence deadline has passed reports and filters as under_review instead. + */ + @JsonProperty("status") + public Optional> getStatus() { + return status; + } + + /** + * @return Only disputes filed against this account (biz_ tag). Omit it to cover every account you can read. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The number of disputes to return (default 20, max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns disputes after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of disputes to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns disputes before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The field to sort disputes by. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Only disputes in this three-letter ISO currency. + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + /** + * @return Only disputes opened before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only disputes opened after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListDisputesRequest && equalTo((ListDisputesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDisputesRequest other) { + return status.equals(other.status) + && accountId.equals(other.accountId) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before) + && order.equals(other.order) + && direction.equals(other.direction) + && currency.equals(other.currency) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.status, + this.accountId, + this.first, + this.after, + this.last, + this.before, + this.order, + this.direction, + this.currency, + this.createdBefore, + this.createdAfter); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> status = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListDisputesRequest other) { + status(other.getStatus()); + accountId(other.getAccountId()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + order(other.getOrder()); + direction(other.getDirection()); + currency(other.getCurrency()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + return this; + } + + /** + *

Only disputes in these statuses. Repeat the parameter to pass several — one paginated list covers all of them. Covers both chargebacks and inquiries at each stage. A needs_response dispute whose evidence deadline has passed reports and filters as under_review instead.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional> status) { + this.status = status; + return this; + } + + public Builder status(List status) { + this.status = Optional.ofNullable(status); + return this; + } + + public Builder status(ListDisputesRequestStatusItem status) { + this.status = Optional.of(Collections.singletonList(status)); + return this; + } + + /** + *

Only disputes filed against this account (biz_ tag). Omit it to cover every account you can read.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The number of disputes to return (default 20, max 100).

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor; returns disputes after this position.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The number of disputes to return from the end of the range.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

A cursor; returns disputes before this position.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The field to sort disputes by.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListDisputesRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListDisputesRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Only disputes in this three-letter ISO currency.

+ */ + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional currency) { + this.currency = currency; + return this; + } + + public Builder currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

Only disputes opened before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only disputes opened after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + public ListDisputesRequest build() { + return new ListDisputesRequest( + status, + accountId, + first, + after, + last, + before, + order, + direction, + currency, + createdBefore, + createdAfter, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/requests/RetrieveDisputesRequest.java b/src/main/java/com/whop/api/resources/disputes/requests/RetrieveDisputesRequest.java new file mode 100644 index 00000000..1b275f3d --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/requests/RetrieveDisputesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveDisputesRequest.Builder.class) +public final class RetrieveDisputesRequest { + private final Map additionalProperties; + + private RetrieveDisputesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveDisputesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveDisputesRequest other) { + return this; + } + + public RetrieveDisputesRequest build() { + return new RetrieveDisputesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/requests/SubmitDisputesRequest.java b/src/main/java/com/whop/api/resources/disputes/requests/SubmitDisputesRequest.java new file mode 100644 index 00000000..83d800c7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/requests/SubmitDisputesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SubmitDisputesRequest.Builder.class) +public final class SubmitDisputesRequest { + private final Map additionalProperties; + + private SubmitDisputesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SubmitDisputesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SubmitDisputesRequest other) { + return this; + } + + public SubmitDisputesRequest build() { + return new SubmitDisputesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/requests/SubmitEvidenceDisputeRequest.java b/src/main/java/com/whop/api/resources/disputes/requests/SubmitEvidenceDisputeRequest.java new file mode 100644 index 00000000..2248beb4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/requests/SubmitEvidenceDisputeRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SubmitEvidenceDisputeRequest.Builder.class) +public final class SubmitEvidenceDisputeRequest { + private final Map additionalProperties; + + private SubmitEvidenceDisputeRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SubmitEvidenceDisputeRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SubmitEvidenceDisputeRequest other) { + return this; + } + + public SubmitEvidenceDisputeRequest build() { + return new SubmitEvidenceDisputeRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/requests/SummaryDisputesRequest.java b/src/main/java/com/whop/api/resources/disputes/requests/SummaryDisputesRequest.java new file mode 100644 index 00000000..18838d24 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/requests/SummaryDisputesRequest.java @@ -0,0 +1,279 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.disputes.types.SummaryDisputesRequestGroupsItem; +import com.whop.api.resources.disputes.types.SummaryDisputesRequestStatusItem; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SummaryDisputesRequest.Builder.class) +public final class SummaryDisputesRequest { + private final Optional> groups; + + private final Optional> status; + + private final Optional accountId; + + private final Optional currency; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Map additionalProperties; + + private SummaryDisputesRequest( + Optional> groups, + Optional> status, + Optional accountId, + Optional currency, + Optional createdBefore, + Optional createdAfter, + Map additionalProperties) { + this.groups = groups; + this.status = status; + this.accountId = accountId; + this.currency = currency; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.additionalProperties = additionalProperties; + } + + /** + * @return Which breakdowns to return, keyed by these names under groups. Repeat the parameter to ask for several; omit it for all of them. + */ + @JsonProperty("groups") + public Optional> getGroups() { + return groups; + } + + /** + * @return Only disputes in these statuses. Repeat the parameter to pass several. A needs_response dispute whose evidence deadline has passed reports and filters as under_review instead. + */ + @JsonProperty("status") + public Optional> getStatus() { + return status; + } + + /** + * @return Only disputes filed against this account (biz_ tag). Omit it to cover every account you can read. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Only disputes in this three-letter ISO currency. + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + /** + * @return Only disputes opened before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only disputes opened after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SummaryDisputesRequest && equalTo((SummaryDisputesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SummaryDisputesRequest other) { + return groups.equals(other.groups) + && status.equals(other.status) + && accountId.equals(other.accountId) + && currency.equals(other.currency) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.groups, this.status, this.accountId, this.currency, this.createdBefore, this.createdAfter); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> groups = Optional.empty(); + + private Optional> status = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SummaryDisputesRequest other) { + groups(other.getGroups()); + status(other.getStatus()); + accountId(other.getAccountId()); + currency(other.getCurrency()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + return this; + } + + /** + *

Which breakdowns to return, keyed by these names under groups. Repeat the parameter to ask for several; omit it for all of them.

+ */ + @JsonSetter(value = "groups", nulls = Nulls.SKIP) + public Builder groups(Optional> groups) { + this.groups = groups; + return this; + } + + public Builder groups(List groups) { + this.groups = Optional.ofNullable(groups); + return this; + } + + public Builder groups(SummaryDisputesRequestGroupsItem groups) { + this.groups = Optional.of(Collections.singletonList(groups)); + return this; + } + + /** + *

Only disputes in these statuses. Repeat the parameter to pass several. A needs_response dispute whose evidence deadline has passed reports and filters as under_review instead.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional> status) { + this.status = status; + return this; + } + + public Builder status(List status) { + this.status = Optional.ofNullable(status); + return this; + } + + public Builder status(SummaryDisputesRequestStatusItem status) { + this.status = Optional.of(Collections.singletonList(status)); + return this; + } + + /** + *

Only disputes filed against this account (biz_ tag). Omit it to cover every account you can read.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Only disputes in this three-letter ISO currency.

+ */ + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional currency) { + this.currency = currency; + return this; + } + + public Builder currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

Only disputes opened before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only disputes opened after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + public SummaryDisputesRequest build() { + return new SummaryDisputesRequest( + groups, status, accountId, currency, createdBefore, createdAfter, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/requests/UpdateDisputesRequest.java b/src/main/java/com/whop/api/resources/disputes/requests/UpdateDisputesRequest.java new file mode 100644 index 00000000..c2306e1b --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/requests/UpdateDisputesRequest.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.disputes.types.UpdateDisputesRequestEvidence; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateDisputesRequest.Builder.class) +public final class UpdateDisputesRequest { + private final Optional evidence; + + private final Map additionalProperties; + + private UpdateDisputesRequest( + Optional evidence, Map additionalProperties) { + this.evidence = evidence; + this.additionalProperties = additionalProperties; + } + + /** + * @return The evidence packet to send to the processor. Only the fields you provide are changed. + */ + @JsonProperty("evidence") + public Optional getEvidence() { + return evidence; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateDisputesRequest && equalTo((UpdateDisputesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateDisputesRequest other) { + return evidence.equals(other.evidence); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.evidence); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional evidence = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateDisputesRequest other) { + evidence(other.getEvidence()); + return this; + } + + /** + *

The evidence packet to send to the processor. Only the fields you provide are changed.

+ */ + @JsonSetter(value = "evidence", nulls = Nulls.SKIP) + public Builder evidence(Optional evidence) { + this.evidence = evidence; + return this; + } + + public Builder evidence(UpdateDisputesRequestEvidence evidence) { + this.evidence = Optional.ofNullable(evidence); + return this; + } + + public UpdateDisputesRequest build() { + return new UpdateDisputesRequest(evidence, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/requests/UpdateEvidenceDisputeRequest.java b/src/main/java/com/whop/api/resources/disputes/requests/UpdateEvidenceDisputeRequest.java new file mode 100644 index 00000000..96913d55 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/requests/UpdateEvidenceDisputeRequest.java @@ -0,0 +1,835 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.disputes.types.UpdateEvidenceDisputeRequestCancellationPolicyAttachment; +import com.whop.api.resources.disputes.types.UpdateEvidenceDisputeRequestCustomerCommunicationAttachment; +import com.whop.api.resources.disputes.types.UpdateEvidenceDisputeRequestRefundPolicyAttachment; +import com.whop.api.resources.disputes.types.UpdateEvidenceDisputeRequestUncategorizedAttachment; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateEvidenceDisputeRequest.Builder.class) +public final class UpdateEvidenceDisputeRequest { + private final Optional accessActivityLog; + + private final Optional billingAddress; + + private final Optional cancellationPolicyAttachment; + + private final Optional cancellationPolicyDisclosure; + + private final Optional customerCommunicationAttachment; + + private final Optional customerEmailAddress; + + private final Optional customerName; + + private final Optional notes; + + private final Optional productDescription; + + private final Optional refundPolicyAttachment; + + private final Optional refundPolicyDisclosure; + + private final Optional refundRefusalExplanation; + + private final Optional serviceDate; + + private final Optional uncategorizedAttachment; + + private final Map additionalProperties; + + private UpdateEvidenceDisputeRequest( + Optional accessActivityLog, + Optional billingAddress, + Optional cancellationPolicyAttachment, + Optional cancellationPolicyDisclosure, + Optional customerCommunicationAttachment, + Optional customerEmailAddress, + Optional customerName, + Optional notes, + Optional productDescription, + Optional refundPolicyAttachment, + Optional refundPolicyDisclosure, + Optional refundRefusalExplanation, + Optional serviceDate, + Optional uncategorizedAttachment, + Map additionalProperties) { + this.accessActivityLog = accessActivityLog; + this.billingAddress = billingAddress; + this.cancellationPolicyAttachment = cancellationPolicyAttachment; + this.cancellationPolicyDisclosure = cancellationPolicyDisclosure; + this.customerCommunicationAttachment = customerCommunicationAttachment; + this.customerEmailAddress = customerEmailAddress; + this.customerName = customerName; + this.notes = notes; + this.productDescription = productDescription; + this.refundPolicyAttachment = refundPolicyAttachment; + this.refundPolicyDisclosure = refundPolicyDisclosure; + this.refundRefusalExplanation = refundRefusalExplanation; + this.serviceDate = serviceDate; + this.uncategorizedAttachment = uncategorizedAttachment; + this.additionalProperties = additionalProperties; + } + + /** + * @return An IP access activity log showing the customer used the service. + */ + @JsonIgnore + public Optional getAccessActivityLog() { + if (accessActivityLog == null) { + return Optional.empty(); + } + return accessActivityLog; + } + + /** + * @return The billing address associated with the customer's payment method. + */ + @JsonIgnore + public Optional getBillingAddress() { + if (billingAddress == null) { + return Optional.empty(); + } + return billingAddress; + } + + /** + * @return A file upload containing the company's cancellation policy document. + */ + @JsonIgnore + public Optional getCancellationPolicyAttachment() { + if (cancellationPolicyAttachment == null) { + return Optional.empty(); + } + return cancellationPolicyAttachment; + } + + /** + * @return The company's cancellation policy text to submit as evidence. + */ + @JsonIgnore + public Optional getCancellationPolicyDisclosure() { + if (cancellationPolicyDisclosure == null) { + return Optional.empty(); + } + return cancellationPolicyDisclosure; + } + + /** + * @return A file upload containing evidence of customer communication. Must be a JPEG, PNG, GIF, or PDF. + */ + @JsonIgnore + public Optional getCustomerCommunicationAttachment() { + if (customerCommunicationAttachment == null) { + return Optional.empty(); + } + return customerCommunicationAttachment; + } + + /** + * @return The email address of the customer associated with the disputed payment. + */ + @JsonIgnore + public Optional getCustomerEmailAddress() { + if (customerEmailAddress == null) { + return Optional.empty(); + } + return customerEmailAddress; + } + + /** + * @return The full name of the customer associated with the disputed payment. + */ + @JsonIgnore + public Optional getCustomerName() { + if (customerName == null) { + return Optional.empty(); + } + return customerName; + } + + /** + * @return Additional notes or context to submit as part of the dispute evidence. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + /** + * @return A description of the product or service that was provided to the customer. + */ + @JsonIgnore + public Optional getProductDescription() { + if (productDescription == null) { + return Optional.empty(); + } + return productDescription; + } + + /** + * @return A file upload containing the company's refund policy document. + */ + @JsonIgnore + public Optional getRefundPolicyAttachment() { + if (refundPolicyAttachment == null) { + return Optional.empty(); + } + return refundPolicyAttachment; + } + + /** + * @return The company's refund policy text to submit as evidence. + */ + @JsonIgnore + public Optional getRefundPolicyDisclosure() { + if (refundPolicyDisclosure == null) { + return Optional.empty(); + } + return refundPolicyDisclosure; + } + + /** + * @return An explanation of why the refund request was refused. + */ + @JsonIgnore + public Optional getRefundRefusalExplanation() { + if (refundRefusalExplanation == null) { + return Optional.empty(); + } + return refundRefusalExplanation; + } + + /** + * @return The date when the product or service was delivered to the customer. + */ + @JsonIgnore + public Optional getServiceDate() { + if (serviceDate == null) { + return Optional.empty(); + } + return serviceDate; + } + + /** + * @return A file upload for evidence that does not fit into the other categories. + */ + @JsonIgnore + public Optional getUncategorizedAttachment() { + if (uncategorizedAttachment == null) { + return Optional.empty(); + } + return uncategorizedAttachment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("access_activity_log") + private Optional _getAccessActivityLog() { + return accessActivityLog; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_address") + private Optional _getBillingAddress() { + return billingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancellation_policy_attachment") + private Optional _getCancellationPolicyAttachment() { + return cancellationPolicyAttachment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancellation_policy_disclosure") + private Optional _getCancellationPolicyDisclosure() { + return cancellationPolicyDisclosure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_communication_attachment") + private Optional + _getCustomerCommunicationAttachment() { + return customerCommunicationAttachment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_email_address") + private Optional _getCustomerEmailAddress() { + return customerEmailAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_name") + private Optional _getCustomerName() { + return customerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_description") + private Optional _getProductDescription() { + return productDescription; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refund_policy_attachment") + private Optional _getRefundPolicyAttachment() { + return refundPolicyAttachment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refund_policy_disclosure") + private Optional _getRefundPolicyDisclosure() { + return refundPolicyDisclosure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refund_refusal_explanation") + private Optional _getRefundRefusalExplanation() { + return refundRefusalExplanation; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("service_date") + private Optional _getServiceDate() { + return serviceDate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("uncategorized_attachment") + private Optional _getUncategorizedAttachment() { + return uncategorizedAttachment; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateEvidenceDisputeRequest && equalTo((UpdateEvidenceDisputeRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateEvidenceDisputeRequest other) { + return accessActivityLog.equals(other.accessActivityLog) + && billingAddress.equals(other.billingAddress) + && cancellationPolicyAttachment.equals(other.cancellationPolicyAttachment) + && cancellationPolicyDisclosure.equals(other.cancellationPolicyDisclosure) + && customerCommunicationAttachment.equals(other.customerCommunicationAttachment) + && customerEmailAddress.equals(other.customerEmailAddress) + && customerName.equals(other.customerName) + && notes.equals(other.notes) + && productDescription.equals(other.productDescription) + && refundPolicyAttachment.equals(other.refundPolicyAttachment) + && refundPolicyDisclosure.equals(other.refundPolicyDisclosure) + && refundRefusalExplanation.equals(other.refundRefusalExplanation) + && serviceDate.equals(other.serviceDate) + && uncategorizedAttachment.equals(other.uncategorizedAttachment); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accessActivityLog, + this.billingAddress, + this.cancellationPolicyAttachment, + this.cancellationPolicyDisclosure, + this.customerCommunicationAttachment, + this.customerEmailAddress, + this.customerName, + this.notes, + this.productDescription, + this.refundPolicyAttachment, + this.refundPolicyDisclosure, + this.refundRefusalExplanation, + this.serviceDate, + this.uncategorizedAttachment); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accessActivityLog = Optional.empty(); + + private Optional billingAddress = Optional.empty(); + + private Optional cancellationPolicyAttachment = + Optional.empty(); + + private Optional cancellationPolicyDisclosure = Optional.empty(); + + private Optional customerCommunicationAttachment = + Optional.empty(); + + private Optional customerEmailAddress = Optional.empty(); + + private Optional customerName = Optional.empty(); + + private Optional notes = Optional.empty(); + + private Optional productDescription = Optional.empty(); + + private Optional refundPolicyAttachment = Optional.empty(); + + private Optional refundPolicyDisclosure = Optional.empty(); + + private Optional refundRefusalExplanation = Optional.empty(); + + private Optional serviceDate = Optional.empty(); + + private Optional uncategorizedAttachment = + Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateEvidenceDisputeRequest other) { + accessActivityLog(other.getAccessActivityLog()); + billingAddress(other.getBillingAddress()); + cancellationPolicyAttachment(other.getCancellationPolicyAttachment()); + cancellationPolicyDisclosure(other.getCancellationPolicyDisclosure()); + customerCommunicationAttachment(other.getCustomerCommunicationAttachment()); + customerEmailAddress(other.getCustomerEmailAddress()); + customerName(other.getCustomerName()); + notes(other.getNotes()); + productDescription(other.getProductDescription()); + refundPolicyAttachment(other.getRefundPolicyAttachment()); + refundPolicyDisclosure(other.getRefundPolicyDisclosure()); + refundRefusalExplanation(other.getRefundRefusalExplanation()); + serviceDate(other.getServiceDate()); + uncategorizedAttachment(other.getUncategorizedAttachment()); + return this; + } + + /** + *

An IP access activity log showing the customer used the service.

+ */ + @JsonSetter(value = "access_activity_log", nulls = Nulls.SKIP) + public Builder accessActivityLog(Optional accessActivityLog) { + this.accessActivityLog = accessActivityLog; + return this; + } + + public Builder accessActivityLog(String accessActivityLog) { + this.accessActivityLog = Optional.ofNullable(accessActivityLog); + return this; + } + + public Builder accessActivityLog(Nullable accessActivityLog) { + if (accessActivityLog.isNull()) { + this.accessActivityLog = null; + } else if (accessActivityLog.isEmpty()) { + this.accessActivityLog = Optional.empty(); + } else { + this.accessActivityLog = Optional.of(accessActivityLog.get()); + } + return this; + } + + /** + *

The billing address associated with the customer's payment method.

+ */ + @JsonSetter(value = "billing_address", nulls = Nulls.SKIP) + public Builder billingAddress(Optional billingAddress) { + this.billingAddress = billingAddress; + return this; + } + + public Builder billingAddress(String billingAddress) { + this.billingAddress = Optional.ofNullable(billingAddress); + return this; + } + + public Builder billingAddress(Nullable billingAddress) { + if (billingAddress.isNull()) { + this.billingAddress = null; + } else if (billingAddress.isEmpty()) { + this.billingAddress = Optional.empty(); + } else { + this.billingAddress = Optional.of(billingAddress.get()); + } + return this; + } + + /** + *

A file upload containing the company's cancellation policy document.

+ */ + @JsonSetter(value = "cancellation_policy_attachment", nulls = Nulls.SKIP) + public Builder cancellationPolicyAttachment( + Optional cancellationPolicyAttachment) { + this.cancellationPolicyAttachment = cancellationPolicyAttachment; + return this; + } + + public Builder cancellationPolicyAttachment( + UpdateEvidenceDisputeRequestCancellationPolicyAttachment cancellationPolicyAttachment) { + this.cancellationPolicyAttachment = Optional.ofNullable(cancellationPolicyAttachment); + return this; + } + + public Builder cancellationPolicyAttachment( + Nullable cancellationPolicyAttachment) { + if (cancellationPolicyAttachment.isNull()) { + this.cancellationPolicyAttachment = null; + } else if (cancellationPolicyAttachment.isEmpty()) { + this.cancellationPolicyAttachment = Optional.empty(); + } else { + this.cancellationPolicyAttachment = Optional.of(cancellationPolicyAttachment.get()); + } + return this; + } + + /** + *

The company's cancellation policy text to submit as evidence.

+ */ + @JsonSetter(value = "cancellation_policy_disclosure", nulls = Nulls.SKIP) + public Builder cancellationPolicyDisclosure(Optional cancellationPolicyDisclosure) { + this.cancellationPolicyDisclosure = cancellationPolicyDisclosure; + return this; + } + + public Builder cancellationPolicyDisclosure(String cancellationPolicyDisclosure) { + this.cancellationPolicyDisclosure = Optional.ofNullable(cancellationPolicyDisclosure); + return this; + } + + public Builder cancellationPolicyDisclosure(Nullable cancellationPolicyDisclosure) { + if (cancellationPolicyDisclosure.isNull()) { + this.cancellationPolicyDisclosure = null; + } else if (cancellationPolicyDisclosure.isEmpty()) { + this.cancellationPolicyDisclosure = Optional.empty(); + } else { + this.cancellationPolicyDisclosure = Optional.of(cancellationPolicyDisclosure.get()); + } + return this; + } + + /** + *

A file upload containing evidence of customer communication. Must be a JPEG, PNG, GIF, or PDF.

+ */ + @JsonSetter(value = "customer_communication_attachment", nulls = Nulls.SKIP) + public Builder customerCommunicationAttachment( + Optional customerCommunicationAttachment) { + this.customerCommunicationAttachment = customerCommunicationAttachment; + return this; + } + + public Builder customerCommunicationAttachment( + UpdateEvidenceDisputeRequestCustomerCommunicationAttachment customerCommunicationAttachment) { + this.customerCommunicationAttachment = Optional.ofNullable(customerCommunicationAttachment); + return this; + } + + public Builder customerCommunicationAttachment( + Nullable customerCommunicationAttachment) { + if (customerCommunicationAttachment.isNull()) { + this.customerCommunicationAttachment = null; + } else if (customerCommunicationAttachment.isEmpty()) { + this.customerCommunicationAttachment = Optional.empty(); + } else { + this.customerCommunicationAttachment = Optional.of(customerCommunicationAttachment.get()); + } + return this; + } + + /** + *

The email address of the customer associated with the disputed payment.

+ */ + @JsonSetter(value = "customer_email_address", nulls = Nulls.SKIP) + public Builder customerEmailAddress(Optional customerEmailAddress) { + this.customerEmailAddress = customerEmailAddress; + return this; + } + + public Builder customerEmailAddress(String customerEmailAddress) { + this.customerEmailAddress = Optional.ofNullable(customerEmailAddress); + return this; + } + + public Builder customerEmailAddress(Nullable customerEmailAddress) { + if (customerEmailAddress.isNull()) { + this.customerEmailAddress = null; + } else if (customerEmailAddress.isEmpty()) { + this.customerEmailAddress = Optional.empty(); + } else { + this.customerEmailAddress = Optional.of(customerEmailAddress.get()); + } + return this; + } + + /** + *

The full name of the customer associated with the disputed payment.

+ */ + @JsonSetter(value = "customer_name", nulls = Nulls.SKIP) + public Builder customerName(Optional customerName) { + this.customerName = customerName; + return this; + } + + public Builder customerName(String customerName) { + this.customerName = Optional.ofNullable(customerName); + return this; + } + + public Builder customerName(Nullable customerName) { + if (customerName.isNull()) { + this.customerName = null; + } else if (customerName.isEmpty()) { + this.customerName = Optional.empty(); + } else { + this.customerName = Optional.of(customerName.get()); + } + return this; + } + + /** + *

Additional notes or context to submit as part of the dispute evidence.

+ */ + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public Builder notes(Optional notes) { + this.notes = notes; + return this; + } + + public Builder notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + public Builder notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

A description of the product or service that was provided to the customer.

+ */ + @JsonSetter(value = "product_description", nulls = Nulls.SKIP) + public Builder productDescription(Optional productDescription) { + this.productDescription = productDescription; + return this; + } + + public Builder productDescription(String productDescription) { + this.productDescription = Optional.ofNullable(productDescription); + return this; + } + + public Builder productDescription(Nullable productDescription) { + if (productDescription.isNull()) { + this.productDescription = null; + } else if (productDescription.isEmpty()) { + this.productDescription = Optional.empty(); + } else { + this.productDescription = Optional.of(productDescription.get()); + } + return this; + } + + /** + *

A file upload containing the company's refund policy document.

+ */ + @JsonSetter(value = "refund_policy_attachment", nulls = Nulls.SKIP) + public Builder refundPolicyAttachment( + Optional refundPolicyAttachment) { + this.refundPolicyAttachment = refundPolicyAttachment; + return this; + } + + public Builder refundPolicyAttachment( + UpdateEvidenceDisputeRequestRefundPolicyAttachment refundPolicyAttachment) { + this.refundPolicyAttachment = Optional.ofNullable(refundPolicyAttachment); + return this; + } + + public Builder refundPolicyAttachment( + Nullable refundPolicyAttachment) { + if (refundPolicyAttachment.isNull()) { + this.refundPolicyAttachment = null; + } else if (refundPolicyAttachment.isEmpty()) { + this.refundPolicyAttachment = Optional.empty(); + } else { + this.refundPolicyAttachment = Optional.of(refundPolicyAttachment.get()); + } + return this; + } + + /** + *

The company's refund policy text to submit as evidence.

+ */ + @JsonSetter(value = "refund_policy_disclosure", nulls = Nulls.SKIP) + public Builder refundPolicyDisclosure(Optional refundPolicyDisclosure) { + this.refundPolicyDisclosure = refundPolicyDisclosure; + return this; + } + + public Builder refundPolicyDisclosure(String refundPolicyDisclosure) { + this.refundPolicyDisclosure = Optional.ofNullable(refundPolicyDisclosure); + return this; + } + + public Builder refundPolicyDisclosure(Nullable refundPolicyDisclosure) { + if (refundPolicyDisclosure.isNull()) { + this.refundPolicyDisclosure = null; + } else if (refundPolicyDisclosure.isEmpty()) { + this.refundPolicyDisclosure = Optional.empty(); + } else { + this.refundPolicyDisclosure = Optional.of(refundPolicyDisclosure.get()); + } + return this; + } + + /** + *

An explanation of why the refund request was refused.

+ */ + @JsonSetter(value = "refund_refusal_explanation", nulls = Nulls.SKIP) + public Builder refundRefusalExplanation(Optional refundRefusalExplanation) { + this.refundRefusalExplanation = refundRefusalExplanation; + return this; + } + + public Builder refundRefusalExplanation(String refundRefusalExplanation) { + this.refundRefusalExplanation = Optional.ofNullable(refundRefusalExplanation); + return this; + } + + public Builder refundRefusalExplanation(Nullable refundRefusalExplanation) { + if (refundRefusalExplanation.isNull()) { + this.refundRefusalExplanation = null; + } else if (refundRefusalExplanation.isEmpty()) { + this.refundRefusalExplanation = Optional.empty(); + } else { + this.refundRefusalExplanation = Optional.of(refundRefusalExplanation.get()); + } + return this; + } + + /** + *

The date when the product or service was delivered to the customer.

+ */ + @JsonSetter(value = "service_date", nulls = Nulls.SKIP) + public Builder serviceDate(Optional serviceDate) { + this.serviceDate = serviceDate; + return this; + } + + public Builder serviceDate(String serviceDate) { + this.serviceDate = Optional.ofNullable(serviceDate); + return this; + } + + public Builder serviceDate(Nullable serviceDate) { + if (serviceDate.isNull()) { + this.serviceDate = null; + } else if (serviceDate.isEmpty()) { + this.serviceDate = Optional.empty(); + } else { + this.serviceDate = Optional.of(serviceDate.get()); + } + return this; + } + + /** + *

A file upload for evidence that does not fit into the other categories.

+ */ + @JsonSetter(value = "uncategorized_attachment", nulls = Nulls.SKIP) + public Builder uncategorizedAttachment( + Optional uncategorizedAttachment) { + this.uncategorizedAttachment = uncategorizedAttachment; + return this; + } + + public Builder uncategorizedAttachment( + UpdateEvidenceDisputeRequestUncategorizedAttachment uncategorizedAttachment) { + this.uncategorizedAttachment = Optional.ofNullable(uncategorizedAttachment); + return this; + } + + public Builder uncategorizedAttachment( + Nullable uncategorizedAttachment) { + if (uncategorizedAttachment.isNull()) { + this.uncategorizedAttachment = null; + } else if (uncategorizedAttachment.isEmpty()) { + this.uncategorizedAttachment = Optional.empty(); + } else { + this.uncategorizedAttachment = Optional.of(uncategorizedAttachment.get()); + } + return this; + } + + public UpdateEvidenceDisputeRequest build() { + return new UpdateEvidenceDisputeRequest( + accessActivityLog, + billingAddress, + cancellationPolicyAttachment, + cancellationPolicyDisclosure, + customerCommunicationAttachment, + customerEmailAddress, + customerName, + notes, + productDescription, + refundPolicyAttachment, + refundPolicyDisclosure, + refundRefusalExplanation, + serviceDate, + uncategorizedAttachment, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/requests/UploadEvidenceDisputesRequest.java b/src/main/java/com/whop/api/resources/disputes/requests/UploadEvidenceDisputesRequest.java new file mode 100644 index 00000000..6fea0963 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/requests/UploadEvidenceDisputesRequest.java @@ -0,0 +1,124 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.disputes.types.UploadEvidenceDisputesRequestDocumentsItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UploadEvidenceDisputesRequest.Builder.class) +public final class UploadEvidenceDisputesRequest { + private final List documents; + + private final Map additionalProperties; + + private UploadEvidenceDisputesRequest( + List documents, Map additionalProperties) { + this.documents = documents; + this.additionalProperties = additionalProperties; + } + + /** + * @return The full set of evidence documents the dispute should carry. Replaces all previously uploaded documents. + */ + @JsonProperty("documents") + public List getDocuments() { + return documents; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UploadEvidenceDisputesRequest && equalTo((UploadEvidenceDisputesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UploadEvidenceDisputesRequest other) { + return documents.equals(other.documents); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.documents); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List documents = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UploadEvidenceDisputesRequest other) { + documents(other.getDocuments()); + return this; + } + + /** + *

The full set of evidence documents the dispute should carry. Replaces all previously uploaded documents.

+ */ + @JsonSetter(value = "documents", nulls = Nulls.SKIP) + public Builder documents(List documents) { + this.documents.clear(); + if (documents != null) { + this.documents.addAll(documents); + } + return this; + } + + public Builder addDocuments(UploadEvidenceDisputesRequestDocumentsItem documents) { + this.documents.add(documents); + return this; + } + + public Builder addAllDocuments(List documents) { + if (documents != null) { + this.documents.addAll(documents); + } + return this; + } + + public UploadEvidenceDisputesRequest build() { + return new UploadEvidenceDisputesRequest(documents, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/ListDisputesRequestDirection.java b/src/main/java/com/whop/api/resources/disputes/types/ListDisputesRequestDirection.java new file mode 100644 index 00000000..95e13a28 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/ListDisputesRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListDisputesRequestDirection { + public static final ListDisputesRequestDirection ASC = new ListDisputesRequestDirection(Value.ASC, "asc"); + + public static final ListDisputesRequestDirection DESC = new ListDisputesRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListDisputesRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListDisputesRequestDirection + && this.string.equals(((ListDisputesRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListDisputesRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListDisputesRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/ListDisputesRequestOrder.java b/src/main/java/com/whop/api/resources/disputes/types/ListDisputesRequestOrder.java new file mode 100644 index 00000000..c4e7ad99 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/ListDisputesRequestOrder.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListDisputesRequestOrder { + public static final ListDisputesRequestOrder AMOUNT = new ListDisputesRequestOrder(Value.AMOUNT, "amount"); + + public static final ListDisputesRequestOrder CREATED_AT = + new ListDisputesRequestOrder(Value.CREATED_AT, "created_at"); + + public static final ListDisputesRequestOrder EVIDENCE_DUE_AT = + new ListDisputesRequestOrder(Value.EVIDENCE_DUE_AT, "evidence_due_at"); + + private final Value value; + + private final String string; + + ListDisputesRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListDisputesRequestOrder + && this.string.equals(((ListDisputesRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AMOUNT: + return visitor.visitAmount(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case EVIDENCE_DUE_AT: + return visitor.visitEvidenceDueAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListDisputesRequestOrder valueOf(String value) { + switch (value) { + case "amount": + return AMOUNT; + case "created_at": + return CREATED_AT; + case "evidence_due_at": + return EVIDENCE_DUE_AT; + default: + return new ListDisputesRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + AMOUNT, + + EVIDENCE_DUE_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitAmount(); + + T visitEvidenceDueAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/ListDisputesRequestStatusItem.java b/src/main/java/com/whop/api/resources/disputes/types/ListDisputesRequestStatusItem.java new file mode 100644 index 00000000..9022c668 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/ListDisputesRequestStatusItem.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListDisputesRequestStatusItem { + public static final ListDisputesRequestStatusItem NEEDS_RESPONSE = + new ListDisputesRequestStatusItem(Value.NEEDS_RESPONSE, "needs_response"); + + public static final ListDisputesRequestStatusItem WON = new ListDisputesRequestStatusItem(Value.WON, "won"); + + public static final ListDisputesRequestStatusItem CLOSED = + new ListDisputesRequestStatusItem(Value.CLOSED, "closed"); + + public static final ListDisputesRequestStatusItem UNDER_REVIEW = + new ListDisputesRequestStatusItem(Value.UNDER_REVIEW, "under_review"); + + public static final ListDisputesRequestStatusItem LOST = new ListDisputesRequestStatusItem(Value.LOST, "lost"); + + private final Value value; + + private final String string; + + ListDisputesRequestStatusItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListDisputesRequestStatusItem + && this.string.equals(((ListDisputesRequestStatusItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NEEDS_RESPONSE: + return visitor.visitNeedsResponse(); + case WON: + return visitor.visitWon(); + case CLOSED: + return visitor.visitClosed(); + case UNDER_REVIEW: + return visitor.visitUnderReview(); + case LOST: + return visitor.visitLost(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListDisputesRequestStatusItem valueOf(String value) { + switch (value) { + case "needs_response": + return NEEDS_RESPONSE; + case "won": + return WON; + case "closed": + return CLOSED; + case "under_review": + return UNDER_REVIEW; + case "lost": + return LOST; + default: + return new ListDisputesRequestStatusItem(Value.UNKNOWN, value); + } + } + + public enum Value { + NEEDS_RESPONSE, + + UNDER_REVIEW, + + WON, + + LOST, + + CLOSED, + + UNKNOWN + } + + public interface Visitor { + T visitNeedsResponse(); + + T visitUnderReview(); + + T visitWon(); + + T visitLost(); + + T visitClosed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/ListDisputesResponse.java b/src/main/java/com/whop/api/resources/disputes/types/ListDisputesResponse.java new file mode 100644 index 00000000..045996ed --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/ListDisputesResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Dispute; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDisputesResponse.Builder.class) +public final class ListDisputesResponse { + private final List data; + + private final ListDisputesResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListDisputesResponse( + List data, ListDisputesResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListDisputesResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListDisputesResponse && equalTo((ListDisputesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDisputesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListDisputesResponsePageInfo pageInfo); + + Builder from(ListDisputesResponse other); + } + + public interface _FinalStage { + ListDisputesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(Dispute data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListDisputesResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListDisputesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListDisputesResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(Dispute data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListDisputesResponse build() { + return new ListDisputesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/ListDisputesResponsePageInfo.java b/src/main/java/com/whop/api/resources/disputes/types/ListDisputesResponsePageInfo.java new file mode 100644 index 00000000..0dc51468 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/ListDisputesResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDisputesResponsePageInfo.Builder.class) +public final class ListDisputesResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListDisputesResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListDisputesResponsePageInfo && equalTo((ListDisputesResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDisputesResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListDisputesResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListDisputesResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListDisputesResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListDisputesResponsePageInfo build() { + return new ListDisputesResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/PostDisputeCreatedPayload.java b/src/main/java/com/whop/api/resources/disputes/types/PostDisputeCreatedPayload.java new file mode 100644 index 00000000..bea795fe --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/PostDisputeCreatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Dispute; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostDisputeCreatedPayload.Builder.class) +public final class PostDisputeCreatedPayload { + private final Optional accountId; + + private final PostDisputeCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Dispute data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostDisputeCreatedPayloadType type; + + private final Map additionalProperties; + + private PostDisputeCreatedPayload( + Optional accountId, + PostDisputeCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Dispute data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostDisputeCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostDisputeCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Dispute getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostDisputeCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostDisputeCreatedPayload && equalTo((PostDisputeCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostDisputeCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostDisputeCreatedPayloadApiVersion apiVersion); + + Builder from(PostDisputeCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Dispute data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostDisputeCreatedPayloadType type); + } + + public interface _FinalStage { + PostDisputeCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostDisputeCreatedPayloadApiVersion apiVersion; + + private Dispute data; + + private String id; + + private OffsetDateTime timestamp; + + private PostDisputeCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostDisputeCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostDisputeCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Dispute data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostDisputeCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostDisputeCreatedPayload build() { + return new PostDisputeCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/PostDisputeCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/disputes/types/PostDisputeCreatedPayloadApiVersion.java new file mode 100644 index 00000000..a0ef8b3a --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/PostDisputeCreatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostDisputeCreatedPayloadApiVersion { + public static final PostDisputeCreatedPayloadApiVersion V1 = + new PostDisputeCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostDisputeCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostDisputeCreatedPayloadApiVersion + && this.string.equals(((PostDisputeCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostDisputeCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostDisputeCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/PostDisputeCreatedPayloadType.java b/src/main/java/com/whop/api/resources/disputes/types/PostDisputeCreatedPayloadType.java new file mode 100644 index 00000000..c84d44b8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/PostDisputeCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostDisputeCreatedPayloadType { + public static final PostDisputeCreatedPayloadType DISPUTE_CREATED = + new PostDisputeCreatedPayloadType(Value.DISPUTE_CREATED, "dispute.created"); + + private final Value value; + + private final String string; + + PostDisputeCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostDisputeCreatedPayloadType + && this.string.equals(((PostDisputeCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DISPUTE_CREATED: + return visitor.visitDisputeCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostDisputeCreatedPayloadType valueOf(String value) { + switch (value) { + case "dispute.created": + return DISPUTE_CREATED; + default: + return new PostDisputeCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + DISPUTE_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitDisputeCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/PostDisputeUpdatedPayload.java b/src/main/java/com/whop/api/resources/disputes/types/PostDisputeUpdatedPayload.java new file mode 100644 index 00000000..a4c20f9d --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/PostDisputeUpdatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Dispute; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostDisputeUpdatedPayload.Builder.class) +public final class PostDisputeUpdatedPayload { + private final Optional accountId; + + private final PostDisputeUpdatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Dispute data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostDisputeUpdatedPayloadType type; + + private final Map additionalProperties; + + private PostDisputeUpdatedPayload( + Optional accountId, + PostDisputeUpdatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Dispute data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostDisputeUpdatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostDisputeUpdatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Dispute getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostDisputeUpdatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostDisputeUpdatedPayload && equalTo((PostDisputeUpdatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostDisputeUpdatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostDisputeUpdatedPayloadApiVersion apiVersion); + + Builder from(PostDisputeUpdatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Dispute data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostDisputeUpdatedPayloadType type); + } + + public interface _FinalStage { + PostDisputeUpdatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostDisputeUpdatedPayloadApiVersion apiVersion; + + private Dispute data; + + private String id; + + private OffsetDateTime timestamp; + + private PostDisputeUpdatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostDisputeUpdatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostDisputeUpdatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Dispute data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostDisputeUpdatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostDisputeUpdatedPayload build() { + return new PostDisputeUpdatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/PostDisputeUpdatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/disputes/types/PostDisputeUpdatedPayloadApiVersion.java new file mode 100644 index 00000000..567be30b --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/PostDisputeUpdatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostDisputeUpdatedPayloadApiVersion { + public static final PostDisputeUpdatedPayloadApiVersion V1 = + new PostDisputeUpdatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostDisputeUpdatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostDisputeUpdatedPayloadApiVersion + && this.string.equals(((PostDisputeUpdatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostDisputeUpdatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostDisputeUpdatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/PostDisputeUpdatedPayloadType.java b/src/main/java/com/whop/api/resources/disputes/types/PostDisputeUpdatedPayloadType.java new file mode 100644 index 00000000..c36a8fc2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/PostDisputeUpdatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostDisputeUpdatedPayloadType { + public static final PostDisputeUpdatedPayloadType DISPUTE_UPDATED = + new PostDisputeUpdatedPayloadType(Value.DISPUTE_UPDATED, "dispute.updated"); + + private final Value value; + + private final String string; + + PostDisputeUpdatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostDisputeUpdatedPayloadType + && this.string.equals(((PostDisputeUpdatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DISPUTE_UPDATED: + return visitor.visitDisputeUpdated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostDisputeUpdatedPayloadType valueOf(String value) { + switch (value) { + case "dispute.updated": + return DISPUTE_UPDATED; + default: + return new PostDisputeUpdatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + DISPUTE_UPDATED, + + UNKNOWN + } + + public interface Visitor { + T visitDisputeUpdated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/SummaryDisputesRequestGroupsItem.java b/src/main/java/com/whop/api/resources/disputes/types/SummaryDisputesRequestGroupsItem.java new file mode 100644 index 00000000..1978233b --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/SummaryDisputesRequestGroupsItem.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SummaryDisputesRequestGroupsItem { + public static final SummaryDisputesRequestGroupsItem STATUS = + new SummaryDisputesRequestGroupsItem(Value.STATUS, "status"); + + public static final SummaryDisputesRequestGroupsItem CURRENCY = + new SummaryDisputesRequestGroupsItem(Value.CURRENCY, "currency"); + + private final Value value; + + private final String string; + + SummaryDisputesRequestGroupsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SummaryDisputesRequestGroupsItem + && this.string.equals(((SummaryDisputesRequestGroupsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case STATUS: + return visitor.visitStatus(); + case CURRENCY: + return visitor.visitCurrency(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SummaryDisputesRequestGroupsItem valueOf(String value) { + switch (value) { + case "status": + return STATUS; + case "currency": + return CURRENCY; + default: + return new SummaryDisputesRequestGroupsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + STATUS, + + CURRENCY, + + UNKNOWN + } + + public interface Visitor { + T visitStatus(); + + T visitCurrency(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/SummaryDisputesRequestStatusItem.java b/src/main/java/com/whop/api/resources/disputes/types/SummaryDisputesRequestStatusItem.java new file mode 100644 index 00000000..75b83b80 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/SummaryDisputesRequestStatusItem.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SummaryDisputesRequestStatusItem { + public static final SummaryDisputesRequestStatusItem NEEDS_RESPONSE = + new SummaryDisputesRequestStatusItem(Value.NEEDS_RESPONSE, "needs_response"); + + public static final SummaryDisputesRequestStatusItem WON = new SummaryDisputesRequestStatusItem(Value.WON, "won"); + + public static final SummaryDisputesRequestStatusItem CLOSED = + new SummaryDisputesRequestStatusItem(Value.CLOSED, "closed"); + + public static final SummaryDisputesRequestStatusItem UNDER_REVIEW = + new SummaryDisputesRequestStatusItem(Value.UNDER_REVIEW, "under_review"); + + public static final SummaryDisputesRequestStatusItem LOST = + new SummaryDisputesRequestStatusItem(Value.LOST, "lost"); + + private final Value value; + + private final String string; + + SummaryDisputesRequestStatusItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SummaryDisputesRequestStatusItem + && this.string.equals(((SummaryDisputesRequestStatusItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NEEDS_RESPONSE: + return visitor.visitNeedsResponse(); + case WON: + return visitor.visitWon(); + case CLOSED: + return visitor.visitClosed(); + case UNDER_REVIEW: + return visitor.visitUnderReview(); + case LOST: + return visitor.visitLost(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SummaryDisputesRequestStatusItem valueOf(String value) { + switch (value) { + case "needs_response": + return NEEDS_RESPONSE; + case "won": + return WON; + case "closed": + return CLOSED; + case "under_review": + return UNDER_REVIEW; + case "lost": + return LOST; + default: + return new SummaryDisputesRequestStatusItem(Value.UNKNOWN, value); + } + } + + public enum Value { + NEEDS_RESPONSE, + + UNDER_REVIEW, + + WON, + + LOST, + + CLOSED, + + UNKNOWN + } + + public interface Visitor { + T visitNeedsResponse(); + + T visitUnderReview(); + + T visitWon(); + + T visitLost(); + + T visitClosed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/SummaryDisputesResponse.java b/src/main/java/com/whop/api/resources/disputes/types/SummaryDisputesResponse.java new file mode 100644 index 00000000..07199a65 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/SummaryDisputesResponse.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SummaryDisputesResponse.Builder.class) +public final class SummaryDisputesResponse { + private final SummaryDisputesResponseGroups groups; + + private final int total; + + private final Map additionalProperties; + + private SummaryDisputesResponse( + SummaryDisputesResponseGroups groups, int total, Map additionalProperties) { + this.groups = groups; + this.total = total; + this.additionalProperties = additionalProperties; + } + + /** + * @return One entry per requested breakdown, keyed by the field it groups on. A field you did not ask for is absent. + */ + @JsonProperty("groups") + public SummaryDisputesResponseGroups getGroups() { + return groups; + } + + /** + * @return How many disputes match the filters. + */ + @JsonProperty("total") + public int getTotal() { + return total; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SummaryDisputesResponse && equalTo((SummaryDisputesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SummaryDisputesResponse other) { + return groups.equals(other.groups) && total == other.total; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.groups, this.total); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static GroupsStage builder() { + return new Builder(); + } + + public interface GroupsStage { + /** + *

One entry per requested breakdown, keyed by the field it groups on. A field you did not ask for is absent.

+ */ + TotalStage groups(@NotNull SummaryDisputesResponseGroups groups); + + Builder from(SummaryDisputesResponse other); + } + + public interface TotalStage { + /** + *

How many disputes match the filters.

+ */ + _FinalStage total(int total); + } + + public interface _FinalStage { + SummaryDisputesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements GroupsStage, TotalStage, _FinalStage { + private SummaryDisputesResponseGroups groups; + + private int total; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SummaryDisputesResponse other) { + groups(other.getGroups()); + total(other.getTotal()); + return this; + } + + /** + *

One entry per requested breakdown, keyed by the field it groups on. A field you did not ask for is absent.

+ *

One entry per requested breakdown, keyed by the field it groups on. A field you did not ask for is absent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("groups") + public TotalStage groups(@NotNull SummaryDisputesResponseGroups groups) { + this.groups = Objects.requireNonNull(groups, "groups must not be null"); + return this; + } + + /** + *

How many disputes match the filters.

+ *

How many disputes match the filters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total") + public _FinalStage total(int total) { + this.total = total; + return this; + } + + @java.lang.Override + public SummaryDisputesResponse build() { + return new SummaryDisputesResponse(groups, total, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/SummaryDisputesResponseGroups.java b/src/main/java/com/whop/api/resources/disputes/types/SummaryDisputesResponseGroups.java new file mode 100644 index 00000000..2b51407b --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/SummaryDisputesResponseGroups.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SummaryDisputesResponseGroups.Builder.class) +public final class SummaryDisputesResponseGroups { + private final Optional> currency; + + private final Optional status; + + private final Map additionalProperties; + + private SummaryDisputesResponseGroups( + Optional> currency, + Optional status, + Map additionalProperties) { + this.currency = currency; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return How many of the matching disputes are in each currency, keyed by three-letter ISO code. Only currencies with at least one dispute are present. + */ + @JsonProperty("currency") + public Optional> getCurrency() { + return currency; + } + + /** + * @return How many of the matching disputes are in each status. Every status is present, including those with a count of zero. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SummaryDisputesResponseGroups && equalTo((SummaryDisputesResponseGroups) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SummaryDisputesResponseGroups other) { + return currency.equals(other.currency) && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> currency = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SummaryDisputesResponseGroups other) { + currency(other.getCurrency()); + status(other.getStatus()); + return this; + } + + /** + *

How many of the matching disputes are in each currency, keyed by three-letter ISO code. Only currencies with at least one dispute are present.

+ */ + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional> currency) { + this.currency = currency; + return this; + } + + public Builder currency(Map currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

How many of the matching disputes are in each status. Every status is present, including those with a count of zero.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(SummaryDisputesResponseGroupsStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public SummaryDisputesResponseGroups build() { + return new SummaryDisputesResponseGroups(currency, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/SummaryDisputesResponseGroupsStatus.java b/src/main/java/com/whop/api/resources/disputes/types/SummaryDisputesResponseGroupsStatus.java new file mode 100644 index 00000000..3e4046cb --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/SummaryDisputesResponseGroupsStatus.java @@ -0,0 +1,218 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SummaryDisputesResponseGroupsStatus.Builder.class) +public final class SummaryDisputesResponseGroupsStatus { + private final int closed; + + private final int lost; + + private final int needsResponse; + + private final int underReview; + + private final int won; + + private final Map additionalProperties; + + private SummaryDisputesResponseGroupsStatus( + int closed, + int lost, + int needsResponse, + int underReview, + int won, + Map additionalProperties) { + this.closed = closed; + this.lost = lost; + this.needsResponse = needsResponse; + this.underReview = underReview; + this.won = won; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("closed") + public int getClosed() { + return closed; + } + + @JsonProperty("lost") + public int getLost() { + return lost; + } + + @JsonProperty("needs_response") + public int getNeedsResponse() { + return needsResponse; + } + + @JsonProperty("under_review") + public int getUnderReview() { + return underReview; + } + + @JsonProperty("won") + public int getWon() { + return won; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SummaryDisputesResponseGroupsStatus + && equalTo((SummaryDisputesResponseGroupsStatus) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SummaryDisputesResponseGroupsStatus other) { + return closed == other.closed + && lost == other.lost + && needsResponse == other.needsResponse + && underReview == other.underReview + && won == other.won; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.closed, this.lost, this.needsResponse, this.underReview, this.won); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ClosedStage builder() { + return new Builder(); + } + + public interface ClosedStage { + LostStage closed(int closed); + + Builder from(SummaryDisputesResponseGroupsStatus other); + } + + public interface LostStage { + NeedsResponseStage lost(int lost); + } + + public interface NeedsResponseStage { + UnderReviewStage needsResponse(int needsResponse); + } + + public interface UnderReviewStage { + WonStage underReview(int underReview); + } + + public interface WonStage { + _FinalStage won(int won); + } + + public interface _FinalStage { + SummaryDisputesResponseGroupsStatus build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ClosedStage, LostStage, NeedsResponseStage, UnderReviewStage, WonStage, _FinalStage { + private int closed; + + private int lost; + + private int needsResponse; + + private int underReview; + + private int won; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SummaryDisputesResponseGroupsStatus other) { + closed(other.getClosed()); + lost(other.getLost()); + needsResponse(other.getNeedsResponse()); + underReview(other.getUnderReview()); + won(other.getWon()); + return this; + } + + @java.lang.Override + @JsonSetter("closed") + public LostStage closed(int closed) { + this.closed = closed; + return this; + } + + @java.lang.Override + @JsonSetter("lost") + public NeedsResponseStage lost(int lost) { + this.lost = lost; + return this; + } + + @java.lang.Override + @JsonSetter("needs_response") + public UnderReviewStage needsResponse(int needsResponse) { + this.needsResponse = needsResponse; + return this; + } + + @java.lang.Override + @JsonSetter("under_review") + public WonStage underReview(int underReview) { + this.underReview = underReview; + return this; + } + + @java.lang.Override + @JsonSetter("won") + public _FinalStage won(int won) { + this.won = won; + return this; + } + + @java.lang.Override + public SummaryDisputesResponseGroupsStatus build() { + return new SummaryDisputesResponseGroupsStatus( + closed, lost, needsResponse, underReview, won, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/UpdateDisputesRequestEvidence.java b/src/main/java/com/whop/api/resources/disputes/types/UpdateDisputesRequestEvidence.java new file mode 100644 index 00000000..339c59f8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/UpdateDisputesRequestEvidence.java @@ -0,0 +1,834 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateDisputesRequestEvidence.Builder.class) +public final class UpdateDisputesRequestEvidence { + private final Optional accessActivityLog; + + private final Optional billingAddress; + + private final Optional cancellationPolicyAttachment; + + private final Optional cancellationPolicyDisclosure; + + private final Optional + customerCommunicationAttachment; + + private final Optional customerEmailAddress; + + private final Optional customerName; + + private final Optional notes; + + private final Optional productDescription; + + private final Optional refundPolicyAttachment; + + private final Optional refundPolicyDisclosure; + + private final Optional refundRefusalExplanation; + + private final Optional serviceDate; + + private final Optional uncategorizedAttachment; + + private final Map additionalProperties; + + private UpdateDisputesRequestEvidence( + Optional accessActivityLog, + Optional billingAddress, + Optional cancellationPolicyAttachment, + Optional cancellationPolicyDisclosure, + Optional customerCommunicationAttachment, + Optional customerEmailAddress, + Optional customerName, + Optional notes, + Optional productDescription, + Optional refundPolicyAttachment, + Optional refundPolicyDisclosure, + Optional refundRefusalExplanation, + Optional serviceDate, + Optional uncategorizedAttachment, + Map additionalProperties) { + this.accessActivityLog = accessActivityLog; + this.billingAddress = billingAddress; + this.cancellationPolicyAttachment = cancellationPolicyAttachment; + this.cancellationPolicyDisclosure = cancellationPolicyDisclosure; + this.customerCommunicationAttachment = customerCommunicationAttachment; + this.customerEmailAddress = customerEmailAddress; + this.customerName = customerName; + this.notes = notes; + this.productDescription = productDescription; + this.refundPolicyAttachment = refundPolicyAttachment; + this.refundPolicyDisclosure = refundPolicyDisclosure; + this.refundRefusalExplanation = refundRefusalExplanation; + this.serviceDate = serviceDate; + this.uncategorizedAttachment = uncategorizedAttachment; + this.additionalProperties = additionalProperties; + } + + /** + * @return Log of the customer's access to the product, such as sign-in or download activity. + */ + @JsonIgnore + public Optional getAccessActivityLog() { + if (accessActivityLog == null) { + return Optional.empty(); + } + return accessActivityLog; + } + + /** + * @return The billing address the customer provided at checkout. + */ + @JsonIgnore + public Optional getBillingAddress() { + if (billingAddress == null) { + return Optional.empty(); + } + return billingAddress; + } + + /** + * @return The cancellation policy document. + */ + @JsonIgnore + public Optional getCancellationPolicyAttachment() { + if (cancellationPolicyAttachment == null) { + return Optional.empty(); + } + return cancellationPolicyAttachment; + } + + /** + * @return How the cancellation policy was shown to the customer before purchase. + */ + @JsonIgnore + public Optional getCancellationPolicyDisclosure() { + if (cancellationPolicyDisclosure == null) { + return Optional.empty(); + } + return cancellationPolicyDisclosure; + } + + /** + * @return Correspondence with the customer, or proof they used the product. + */ + @JsonIgnore + public Optional getCustomerCommunicationAttachment() { + if (customerCommunicationAttachment == null) { + return Optional.empty(); + } + return customerCommunicationAttachment; + } + + /** + * @return The email address the customer used at checkout. + */ + @JsonIgnore + public Optional getCustomerEmailAddress() { + if (customerEmailAddress == null) { + return Optional.empty(); + } + return customerEmailAddress; + } + + /** + * @return The customer's name as given at checkout. + */ + @JsonIgnore + public Optional getCustomerName() { + if (customerName == null) { + return Optional.empty(); + } + return customerName; + } + + /** + * @return Any additional context for the processor reviewing the dispute. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + /** + * @return What the customer purchased, in the seller's own words. + */ + @JsonIgnore + public Optional getProductDescription() { + if (productDescription == null) { + return Optional.empty(); + } + return productDescription; + } + + /** + * @return The refund policy document. + */ + @JsonIgnore + public Optional getRefundPolicyAttachment() { + if (refundPolicyAttachment == null) { + return Optional.empty(); + } + return refundPolicyAttachment; + } + + /** + * @return How the refund policy was shown to the customer before purchase. + */ + @JsonIgnore + public Optional getRefundPolicyDisclosure() { + if (refundPolicyDisclosure == null) { + return Optional.empty(); + } + return refundPolicyDisclosure; + } + + /** + * @return Why a refund was refused, when one was requested and denied. + */ + @JsonIgnore + public Optional getRefundRefusalExplanation() { + if (refundRefusalExplanation == null) { + return Optional.empty(); + } + return refundRefusalExplanation; + } + + /** + * @return When the product or service was delivered. + */ + @JsonIgnore + public Optional getServiceDate() { + if (serviceDate == null) { + return Optional.empty(); + } + return serviceDate; + } + + /** + * @return Supporting evidence that does not fit the other categories. + */ + @JsonIgnore + public Optional getUncategorizedAttachment() { + if (uncategorizedAttachment == null) { + return Optional.empty(); + } + return uncategorizedAttachment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("access_activity_log") + private Optional _getAccessActivityLog() { + return accessActivityLog; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_address") + private Optional _getBillingAddress() { + return billingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancellation_policy_attachment") + private Optional _getCancellationPolicyAttachment() { + return cancellationPolicyAttachment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancellation_policy_disclosure") + private Optional _getCancellationPolicyDisclosure() { + return cancellationPolicyDisclosure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_communication_attachment") + private Optional + _getCustomerCommunicationAttachment() { + return customerCommunicationAttachment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_email_address") + private Optional _getCustomerEmailAddress() { + return customerEmailAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_name") + private Optional _getCustomerName() { + return customerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_description") + private Optional _getProductDescription() { + return productDescription; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refund_policy_attachment") + private Optional _getRefundPolicyAttachment() { + return refundPolicyAttachment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refund_policy_disclosure") + private Optional _getRefundPolicyDisclosure() { + return refundPolicyDisclosure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refund_refusal_explanation") + private Optional _getRefundRefusalExplanation() { + return refundRefusalExplanation; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("service_date") + private Optional _getServiceDate() { + return serviceDate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("uncategorized_attachment") + private Optional _getUncategorizedAttachment() { + return uncategorizedAttachment; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateDisputesRequestEvidence && equalTo((UpdateDisputesRequestEvidence) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateDisputesRequestEvidence other) { + return accessActivityLog.equals(other.accessActivityLog) + && billingAddress.equals(other.billingAddress) + && cancellationPolicyAttachment.equals(other.cancellationPolicyAttachment) + && cancellationPolicyDisclosure.equals(other.cancellationPolicyDisclosure) + && customerCommunicationAttachment.equals(other.customerCommunicationAttachment) + && customerEmailAddress.equals(other.customerEmailAddress) + && customerName.equals(other.customerName) + && notes.equals(other.notes) + && productDescription.equals(other.productDescription) + && refundPolicyAttachment.equals(other.refundPolicyAttachment) + && refundPolicyDisclosure.equals(other.refundPolicyDisclosure) + && refundRefusalExplanation.equals(other.refundRefusalExplanation) + && serviceDate.equals(other.serviceDate) + && uncategorizedAttachment.equals(other.uncategorizedAttachment); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accessActivityLog, + this.billingAddress, + this.cancellationPolicyAttachment, + this.cancellationPolicyDisclosure, + this.customerCommunicationAttachment, + this.customerEmailAddress, + this.customerName, + this.notes, + this.productDescription, + this.refundPolicyAttachment, + this.refundPolicyDisclosure, + this.refundRefusalExplanation, + this.serviceDate, + this.uncategorizedAttachment); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accessActivityLog = Optional.empty(); + + private Optional billingAddress = Optional.empty(); + + private Optional cancellationPolicyAttachment = + Optional.empty(); + + private Optional cancellationPolicyDisclosure = Optional.empty(); + + private Optional customerCommunicationAttachment = + Optional.empty(); + + private Optional customerEmailAddress = Optional.empty(); + + private Optional customerName = Optional.empty(); + + private Optional notes = Optional.empty(); + + private Optional productDescription = Optional.empty(); + + private Optional refundPolicyAttachment = Optional.empty(); + + private Optional refundPolicyDisclosure = Optional.empty(); + + private Optional refundRefusalExplanation = Optional.empty(); + + private Optional serviceDate = Optional.empty(); + + private Optional uncategorizedAttachment = + Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateDisputesRequestEvidence other) { + accessActivityLog(other.getAccessActivityLog()); + billingAddress(other.getBillingAddress()); + cancellationPolicyAttachment(other.getCancellationPolicyAttachment()); + cancellationPolicyDisclosure(other.getCancellationPolicyDisclosure()); + customerCommunicationAttachment(other.getCustomerCommunicationAttachment()); + customerEmailAddress(other.getCustomerEmailAddress()); + customerName(other.getCustomerName()); + notes(other.getNotes()); + productDescription(other.getProductDescription()); + refundPolicyAttachment(other.getRefundPolicyAttachment()); + refundPolicyDisclosure(other.getRefundPolicyDisclosure()); + refundRefusalExplanation(other.getRefundRefusalExplanation()); + serviceDate(other.getServiceDate()); + uncategorizedAttachment(other.getUncategorizedAttachment()); + return this; + } + + /** + *

Log of the customer's access to the product, such as sign-in or download activity.

+ */ + @JsonSetter(value = "access_activity_log", nulls = Nulls.SKIP) + public Builder accessActivityLog(Optional accessActivityLog) { + this.accessActivityLog = accessActivityLog; + return this; + } + + public Builder accessActivityLog(String accessActivityLog) { + this.accessActivityLog = Optional.ofNullable(accessActivityLog); + return this; + } + + public Builder accessActivityLog(Nullable accessActivityLog) { + if (accessActivityLog.isNull()) { + this.accessActivityLog = null; + } else if (accessActivityLog.isEmpty()) { + this.accessActivityLog = Optional.empty(); + } else { + this.accessActivityLog = Optional.of(accessActivityLog.get()); + } + return this; + } + + /** + *

The billing address the customer provided at checkout.

+ */ + @JsonSetter(value = "billing_address", nulls = Nulls.SKIP) + public Builder billingAddress(Optional billingAddress) { + this.billingAddress = billingAddress; + return this; + } + + public Builder billingAddress(String billingAddress) { + this.billingAddress = Optional.ofNullable(billingAddress); + return this; + } + + public Builder billingAddress(Nullable billingAddress) { + if (billingAddress.isNull()) { + this.billingAddress = null; + } else if (billingAddress.isEmpty()) { + this.billingAddress = Optional.empty(); + } else { + this.billingAddress = Optional.of(billingAddress.get()); + } + return this; + } + + /** + *

The cancellation policy document.

+ */ + @JsonSetter(value = "cancellation_policy_attachment", nulls = Nulls.SKIP) + public Builder cancellationPolicyAttachment( + Optional cancellationPolicyAttachment) { + this.cancellationPolicyAttachment = cancellationPolicyAttachment; + return this; + } + + public Builder cancellationPolicyAttachment( + UpdateDisputesRequestEvidenceCancellationPolicyAttachment cancellationPolicyAttachment) { + this.cancellationPolicyAttachment = Optional.ofNullable(cancellationPolicyAttachment); + return this; + } + + public Builder cancellationPolicyAttachment( + Nullable cancellationPolicyAttachment) { + if (cancellationPolicyAttachment.isNull()) { + this.cancellationPolicyAttachment = null; + } else if (cancellationPolicyAttachment.isEmpty()) { + this.cancellationPolicyAttachment = Optional.empty(); + } else { + this.cancellationPolicyAttachment = Optional.of(cancellationPolicyAttachment.get()); + } + return this; + } + + /** + *

How the cancellation policy was shown to the customer before purchase.

+ */ + @JsonSetter(value = "cancellation_policy_disclosure", nulls = Nulls.SKIP) + public Builder cancellationPolicyDisclosure(Optional cancellationPolicyDisclosure) { + this.cancellationPolicyDisclosure = cancellationPolicyDisclosure; + return this; + } + + public Builder cancellationPolicyDisclosure(String cancellationPolicyDisclosure) { + this.cancellationPolicyDisclosure = Optional.ofNullable(cancellationPolicyDisclosure); + return this; + } + + public Builder cancellationPolicyDisclosure(Nullable cancellationPolicyDisclosure) { + if (cancellationPolicyDisclosure.isNull()) { + this.cancellationPolicyDisclosure = null; + } else if (cancellationPolicyDisclosure.isEmpty()) { + this.cancellationPolicyDisclosure = Optional.empty(); + } else { + this.cancellationPolicyDisclosure = Optional.of(cancellationPolicyDisclosure.get()); + } + return this; + } + + /** + *

Correspondence with the customer, or proof they used the product.

+ */ + @JsonSetter(value = "customer_communication_attachment", nulls = Nulls.SKIP) + public Builder customerCommunicationAttachment( + Optional + customerCommunicationAttachment) { + this.customerCommunicationAttachment = customerCommunicationAttachment; + return this; + } + + public Builder customerCommunicationAttachment( + UpdateDisputesRequestEvidenceCustomerCommunicationAttachment customerCommunicationAttachment) { + this.customerCommunicationAttachment = Optional.ofNullable(customerCommunicationAttachment); + return this; + } + + public Builder customerCommunicationAttachment( + Nullable + customerCommunicationAttachment) { + if (customerCommunicationAttachment.isNull()) { + this.customerCommunicationAttachment = null; + } else if (customerCommunicationAttachment.isEmpty()) { + this.customerCommunicationAttachment = Optional.empty(); + } else { + this.customerCommunicationAttachment = Optional.of(customerCommunicationAttachment.get()); + } + return this; + } + + /** + *

The email address the customer used at checkout.

+ */ + @JsonSetter(value = "customer_email_address", nulls = Nulls.SKIP) + public Builder customerEmailAddress(Optional customerEmailAddress) { + this.customerEmailAddress = customerEmailAddress; + return this; + } + + public Builder customerEmailAddress(String customerEmailAddress) { + this.customerEmailAddress = Optional.ofNullable(customerEmailAddress); + return this; + } + + public Builder customerEmailAddress(Nullable customerEmailAddress) { + if (customerEmailAddress.isNull()) { + this.customerEmailAddress = null; + } else if (customerEmailAddress.isEmpty()) { + this.customerEmailAddress = Optional.empty(); + } else { + this.customerEmailAddress = Optional.of(customerEmailAddress.get()); + } + return this; + } + + /** + *

The customer's name as given at checkout.

+ */ + @JsonSetter(value = "customer_name", nulls = Nulls.SKIP) + public Builder customerName(Optional customerName) { + this.customerName = customerName; + return this; + } + + public Builder customerName(String customerName) { + this.customerName = Optional.ofNullable(customerName); + return this; + } + + public Builder customerName(Nullable customerName) { + if (customerName.isNull()) { + this.customerName = null; + } else if (customerName.isEmpty()) { + this.customerName = Optional.empty(); + } else { + this.customerName = Optional.of(customerName.get()); + } + return this; + } + + /** + *

Any additional context for the processor reviewing the dispute.

+ */ + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public Builder notes(Optional notes) { + this.notes = notes; + return this; + } + + public Builder notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + public Builder notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

What the customer purchased, in the seller's own words.

+ */ + @JsonSetter(value = "product_description", nulls = Nulls.SKIP) + public Builder productDescription(Optional productDescription) { + this.productDescription = productDescription; + return this; + } + + public Builder productDescription(String productDescription) { + this.productDescription = Optional.ofNullable(productDescription); + return this; + } + + public Builder productDescription(Nullable productDescription) { + if (productDescription.isNull()) { + this.productDescription = null; + } else if (productDescription.isEmpty()) { + this.productDescription = Optional.empty(); + } else { + this.productDescription = Optional.of(productDescription.get()); + } + return this; + } + + /** + *

The refund policy document.

+ */ + @JsonSetter(value = "refund_policy_attachment", nulls = Nulls.SKIP) + public Builder refundPolicyAttachment( + Optional refundPolicyAttachment) { + this.refundPolicyAttachment = refundPolicyAttachment; + return this; + } + + public Builder refundPolicyAttachment( + UpdateDisputesRequestEvidenceRefundPolicyAttachment refundPolicyAttachment) { + this.refundPolicyAttachment = Optional.ofNullable(refundPolicyAttachment); + return this; + } + + public Builder refundPolicyAttachment( + Nullable refundPolicyAttachment) { + if (refundPolicyAttachment.isNull()) { + this.refundPolicyAttachment = null; + } else if (refundPolicyAttachment.isEmpty()) { + this.refundPolicyAttachment = Optional.empty(); + } else { + this.refundPolicyAttachment = Optional.of(refundPolicyAttachment.get()); + } + return this; + } + + /** + *

How the refund policy was shown to the customer before purchase.

+ */ + @JsonSetter(value = "refund_policy_disclosure", nulls = Nulls.SKIP) + public Builder refundPolicyDisclosure(Optional refundPolicyDisclosure) { + this.refundPolicyDisclosure = refundPolicyDisclosure; + return this; + } + + public Builder refundPolicyDisclosure(String refundPolicyDisclosure) { + this.refundPolicyDisclosure = Optional.ofNullable(refundPolicyDisclosure); + return this; + } + + public Builder refundPolicyDisclosure(Nullable refundPolicyDisclosure) { + if (refundPolicyDisclosure.isNull()) { + this.refundPolicyDisclosure = null; + } else if (refundPolicyDisclosure.isEmpty()) { + this.refundPolicyDisclosure = Optional.empty(); + } else { + this.refundPolicyDisclosure = Optional.of(refundPolicyDisclosure.get()); + } + return this; + } + + /** + *

Why a refund was refused, when one was requested and denied.

+ */ + @JsonSetter(value = "refund_refusal_explanation", nulls = Nulls.SKIP) + public Builder refundRefusalExplanation(Optional refundRefusalExplanation) { + this.refundRefusalExplanation = refundRefusalExplanation; + return this; + } + + public Builder refundRefusalExplanation(String refundRefusalExplanation) { + this.refundRefusalExplanation = Optional.ofNullable(refundRefusalExplanation); + return this; + } + + public Builder refundRefusalExplanation(Nullable refundRefusalExplanation) { + if (refundRefusalExplanation.isNull()) { + this.refundRefusalExplanation = null; + } else if (refundRefusalExplanation.isEmpty()) { + this.refundRefusalExplanation = Optional.empty(); + } else { + this.refundRefusalExplanation = Optional.of(refundRefusalExplanation.get()); + } + return this; + } + + /** + *

When the product or service was delivered.

+ */ + @JsonSetter(value = "service_date", nulls = Nulls.SKIP) + public Builder serviceDate(Optional serviceDate) { + this.serviceDate = serviceDate; + return this; + } + + public Builder serviceDate(String serviceDate) { + this.serviceDate = Optional.ofNullable(serviceDate); + return this; + } + + public Builder serviceDate(Nullable serviceDate) { + if (serviceDate.isNull()) { + this.serviceDate = null; + } else if (serviceDate.isEmpty()) { + this.serviceDate = Optional.empty(); + } else { + this.serviceDate = Optional.of(serviceDate.get()); + } + return this; + } + + /** + *

Supporting evidence that does not fit the other categories.

+ */ + @JsonSetter(value = "uncategorized_attachment", nulls = Nulls.SKIP) + public Builder uncategorizedAttachment( + Optional uncategorizedAttachment) { + this.uncategorizedAttachment = uncategorizedAttachment; + return this; + } + + public Builder uncategorizedAttachment( + UpdateDisputesRequestEvidenceUncategorizedAttachment uncategorizedAttachment) { + this.uncategorizedAttachment = Optional.ofNullable(uncategorizedAttachment); + return this; + } + + public Builder uncategorizedAttachment( + Nullable uncategorizedAttachment) { + if (uncategorizedAttachment.isNull()) { + this.uncategorizedAttachment = null; + } else if (uncategorizedAttachment.isEmpty()) { + this.uncategorizedAttachment = Optional.empty(); + } else { + this.uncategorizedAttachment = Optional.of(uncategorizedAttachment.get()); + } + return this; + } + + public UpdateDisputesRequestEvidence build() { + return new UpdateDisputesRequestEvidence( + accessActivityLog, + billingAddress, + cancellationPolicyAttachment, + cancellationPolicyDisclosure, + customerCommunicationAttachment, + customerEmailAddress, + customerName, + notes, + productDescription, + refundPolicyAttachment, + refundPolicyDisclosure, + refundRefusalExplanation, + serviceDate, + uncategorizedAttachment, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/UpdateDisputesRequestEvidenceCancellationPolicyAttachment.java b/src/main/java/com/whop/api/resources/disputes/types/UpdateDisputesRequestEvidenceCancellationPolicyAttachment.java new file mode 100644 index 00000000..b4dbf96f --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/UpdateDisputesRequestEvidenceCancellationPolicyAttachment.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateDisputesRequestEvidenceCancellationPolicyAttachment.Builder.class) +public final class UpdateDisputesRequestEvidenceCancellationPolicyAttachment { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private UpdateDisputesRequestEvidenceCancellationPolicyAttachment( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID returned by a direct upload. + */ + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + /** + * @return The ID of an already-uploaded file. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateDisputesRequestEvidenceCancellationPolicyAttachment + && equalTo((UpdateDisputesRequestEvidenceCancellationPolicyAttachment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateDisputesRequestEvidenceCancellationPolicyAttachment other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateDisputesRequestEvidenceCancellationPolicyAttachment other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + /** + *

The ID returned by a direct upload.

+ */ + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + /** + *

The ID of an already-uploaded file.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdateDisputesRequestEvidenceCancellationPolicyAttachment build() { + return new UpdateDisputesRequestEvidenceCancellationPolicyAttachment( + directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/UpdateDisputesRequestEvidenceCustomerCommunicationAttachment.java b/src/main/java/com/whop/api/resources/disputes/types/UpdateDisputesRequestEvidenceCustomerCommunicationAttachment.java new file mode 100644 index 00000000..debc9ef9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/UpdateDisputesRequestEvidenceCustomerCommunicationAttachment.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateDisputesRequestEvidenceCustomerCommunicationAttachment.Builder.class) +public final class UpdateDisputesRequestEvidenceCustomerCommunicationAttachment { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private UpdateDisputesRequestEvidenceCustomerCommunicationAttachment( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID returned by a direct upload. + */ + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + /** + * @return The ID of an already-uploaded file. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateDisputesRequestEvidenceCustomerCommunicationAttachment + && equalTo((UpdateDisputesRequestEvidenceCustomerCommunicationAttachment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateDisputesRequestEvidenceCustomerCommunicationAttachment other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateDisputesRequestEvidenceCustomerCommunicationAttachment other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + /** + *

The ID returned by a direct upload.

+ */ + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + /** + *

The ID of an already-uploaded file.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdateDisputesRequestEvidenceCustomerCommunicationAttachment build() { + return new UpdateDisputesRequestEvidenceCustomerCommunicationAttachment( + directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/UpdateDisputesRequestEvidenceRefundPolicyAttachment.java b/src/main/java/com/whop/api/resources/disputes/types/UpdateDisputesRequestEvidenceRefundPolicyAttachment.java new file mode 100644 index 00000000..9e708c7d --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/UpdateDisputesRequestEvidenceRefundPolicyAttachment.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateDisputesRequestEvidenceRefundPolicyAttachment.Builder.class) +public final class UpdateDisputesRequestEvidenceRefundPolicyAttachment { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private UpdateDisputesRequestEvidenceRefundPolicyAttachment( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID returned by a direct upload. + */ + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + /** + * @return The ID of an already-uploaded file. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateDisputesRequestEvidenceRefundPolicyAttachment + && equalTo((UpdateDisputesRequestEvidenceRefundPolicyAttachment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateDisputesRequestEvidenceRefundPolicyAttachment other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateDisputesRequestEvidenceRefundPolicyAttachment other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + /** + *

The ID returned by a direct upload.

+ */ + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + /** + *

The ID of an already-uploaded file.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdateDisputesRequestEvidenceRefundPolicyAttachment build() { + return new UpdateDisputesRequestEvidenceRefundPolicyAttachment(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/UpdateDisputesRequestEvidenceUncategorizedAttachment.java b/src/main/java/com/whop/api/resources/disputes/types/UpdateDisputesRequestEvidenceUncategorizedAttachment.java new file mode 100644 index 00000000..89b55450 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/UpdateDisputesRequestEvidenceUncategorizedAttachment.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateDisputesRequestEvidenceUncategorizedAttachment.Builder.class) +public final class UpdateDisputesRequestEvidenceUncategorizedAttachment { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private UpdateDisputesRequestEvidenceUncategorizedAttachment( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID returned by a direct upload. + */ + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + /** + * @return The ID of an already-uploaded file. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateDisputesRequestEvidenceUncategorizedAttachment + && equalTo((UpdateDisputesRequestEvidenceUncategorizedAttachment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateDisputesRequestEvidenceUncategorizedAttachment other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateDisputesRequestEvidenceUncategorizedAttachment other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + /** + *

The ID returned by a direct upload.

+ */ + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + /** + *

The ID of an already-uploaded file.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdateDisputesRequestEvidenceUncategorizedAttachment build() { + return new UpdateDisputesRequestEvidenceUncategorizedAttachment(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/UpdateEvidenceDisputeRequestCancellationPolicyAttachment.java b/src/main/java/com/whop/api/resources/disputes/types/UpdateEvidenceDisputeRequestCancellationPolicyAttachment.java new file mode 100644 index 00000000..a8a44967 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/UpdateEvidenceDisputeRequestCancellationPolicyAttachment.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateEvidenceDisputeRequestCancellationPolicyAttachment.Builder.class) +public final class UpdateEvidenceDisputeRequestCancellationPolicyAttachment { + private final String id; + + private final Map additionalProperties; + + private UpdateEvidenceDisputeRequestCancellationPolicyAttachment( + String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateEvidenceDisputeRequestCancellationPolicyAttachment + && equalTo((UpdateEvidenceDisputeRequestCancellationPolicyAttachment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateEvidenceDisputeRequestCancellationPolicyAttachment other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateEvidenceDisputeRequestCancellationPolicyAttachment other); + } + + public interface _FinalStage { + UpdateEvidenceDisputeRequestCancellationPolicyAttachment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateEvidenceDisputeRequestCancellationPolicyAttachment other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateEvidenceDisputeRequestCancellationPolicyAttachment build() { + return new UpdateEvidenceDisputeRequestCancellationPolicyAttachment(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/UpdateEvidenceDisputeRequestCustomerCommunicationAttachment.java b/src/main/java/com/whop/api/resources/disputes/types/UpdateEvidenceDisputeRequestCustomerCommunicationAttachment.java new file mode 100644 index 00000000..54ebdeb7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/UpdateEvidenceDisputeRequestCustomerCommunicationAttachment.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateEvidenceDisputeRequestCustomerCommunicationAttachment.Builder.class) +public final class UpdateEvidenceDisputeRequestCustomerCommunicationAttachment { + private final String id; + + private final Map additionalProperties; + + private UpdateEvidenceDisputeRequestCustomerCommunicationAttachment( + String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateEvidenceDisputeRequestCustomerCommunicationAttachment + && equalTo((UpdateEvidenceDisputeRequestCustomerCommunicationAttachment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateEvidenceDisputeRequestCustomerCommunicationAttachment other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateEvidenceDisputeRequestCustomerCommunicationAttachment other); + } + + public interface _FinalStage { + UpdateEvidenceDisputeRequestCustomerCommunicationAttachment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateEvidenceDisputeRequestCustomerCommunicationAttachment other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateEvidenceDisputeRequestCustomerCommunicationAttachment build() { + return new UpdateEvidenceDisputeRequestCustomerCommunicationAttachment(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/UpdateEvidenceDisputeRequestRefundPolicyAttachment.java b/src/main/java/com/whop/api/resources/disputes/types/UpdateEvidenceDisputeRequestRefundPolicyAttachment.java new file mode 100644 index 00000000..2df0694b --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/UpdateEvidenceDisputeRequestRefundPolicyAttachment.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateEvidenceDisputeRequestRefundPolicyAttachment.Builder.class) +public final class UpdateEvidenceDisputeRequestRefundPolicyAttachment { + private final String id; + + private final Map additionalProperties; + + private UpdateEvidenceDisputeRequestRefundPolicyAttachment(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateEvidenceDisputeRequestRefundPolicyAttachment + && equalTo((UpdateEvidenceDisputeRequestRefundPolicyAttachment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateEvidenceDisputeRequestRefundPolicyAttachment other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateEvidenceDisputeRequestRefundPolicyAttachment other); + } + + public interface _FinalStage { + UpdateEvidenceDisputeRequestRefundPolicyAttachment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateEvidenceDisputeRequestRefundPolicyAttachment other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateEvidenceDisputeRequestRefundPolicyAttachment build() { + return new UpdateEvidenceDisputeRequestRefundPolicyAttachment(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/UpdateEvidenceDisputeRequestUncategorizedAttachment.java b/src/main/java/com/whop/api/resources/disputes/types/UpdateEvidenceDisputeRequestUncategorizedAttachment.java new file mode 100644 index 00000000..ca2e59fa --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/UpdateEvidenceDisputeRequestUncategorizedAttachment.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateEvidenceDisputeRequestUncategorizedAttachment.Builder.class) +public final class UpdateEvidenceDisputeRequestUncategorizedAttachment { + private final String id; + + private final Map additionalProperties; + + private UpdateEvidenceDisputeRequestUncategorizedAttachment(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateEvidenceDisputeRequestUncategorizedAttachment + && equalTo((UpdateEvidenceDisputeRequestUncategorizedAttachment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateEvidenceDisputeRequestUncategorizedAttachment other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateEvidenceDisputeRequestUncategorizedAttachment other); + } + + public interface _FinalStage { + UpdateEvidenceDisputeRequestUncategorizedAttachment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateEvidenceDisputeRequestUncategorizedAttachment other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateEvidenceDisputeRequestUncategorizedAttachment build() { + return new UpdateEvidenceDisputeRequestUncategorizedAttachment(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/UploadEvidenceDisputesRequestDocumentsItem.java b/src/main/java/com/whop/api/resources/disputes/types/UploadEvidenceDisputesRequestDocumentsItem.java new file mode 100644 index 00000000..7a72da3c --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/UploadEvidenceDisputesRequestDocumentsItem.java @@ -0,0 +1,264 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UploadEvidenceDisputesRequestDocumentsItem.Builder.class) +public final class UploadEvidenceDisputesRequestDocumentsItem { + private final Optional directUploadId; + + private final UploadEvidenceDisputesRequestDocumentsItemDocumentType documentType; + + private final Optional file; + + private final Optional id; + + private final Map additionalProperties; + + private UploadEvidenceDisputesRequestDocumentsItem( + Optional directUploadId, + UploadEvidenceDisputesRequestDocumentsItemDocumentType documentType, + Optional file, + Optional id, + Map additionalProperties) { + this.directUploadId = directUploadId; + this.documentType = documentType; + this.file = file; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID returned by a direct upload. + */ + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + /** + * @return What kind of evidence the document is. + */ + @JsonProperty("document_type") + public UploadEvidenceDisputesRequestDocumentsItemDocumentType getDocumentType() { + return documentType; + } + + /** + * @return The file itself. Send it as a file part to upload and attach in one call, or use id/direct_upload_id for a file that is already stored. + */ + @JsonProperty("file") + public Optional getFile() { + return file; + } + + /** + * @return The ID of a file already stored on Whop, prefixed file_. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UploadEvidenceDisputesRequestDocumentsItem + && equalTo((UploadEvidenceDisputesRequestDocumentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UploadEvidenceDisputesRequestDocumentsItem other) { + return directUploadId.equals(other.directUploadId) + && documentType.equals(other.documentType) + && file.equals(other.file) + && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.documentType, this.file, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DocumentTypeStage builder() { + return new Builder(); + } + + public interface DocumentTypeStage { + /** + *

What kind of evidence the document is.

+ */ + _FinalStage documentType(@NotNull UploadEvidenceDisputesRequestDocumentsItemDocumentType documentType); + + Builder from(UploadEvidenceDisputesRequestDocumentsItem other); + } + + public interface _FinalStage { + UploadEvidenceDisputesRequestDocumentsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The ID returned by a direct upload.

+ */ + _FinalStage directUploadId(Optional directUploadId); + + _FinalStage directUploadId(String directUploadId); + + /** + *

The file itself. Send it as a file part to upload and attach in one call, or use id/direct_upload_id for a file that is already stored.

+ */ + _FinalStage file(Optional file); + + _FinalStage file(String file); + + /** + *

The ID of a file already stored on Whop, prefixed file_.

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DocumentTypeStage, _FinalStage { + private UploadEvidenceDisputesRequestDocumentsItemDocumentType documentType; + + private Optional id = Optional.empty(); + + private Optional file = Optional.empty(); + + private Optional directUploadId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UploadEvidenceDisputesRequestDocumentsItem other) { + directUploadId(other.getDirectUploadId()); + documentType(other.getDocumentType()); + file(other.getFile()); + id(other.getId()); + return this; + } + + /** + *

What kind of evidence the document is.

+ *

What kind of evidence the document is.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("document_type") + public _FinalStage documentType(@NotNull UploadEvidenceDisputesRequestDocumentsItemDocumentType documentType) { + this.documentType = Objects.requireNonNull(documentType, "documentType must not be null"); + return this; + } + + /** + *

The ID of a file already stored on Whop, prefixed file_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The ID of a file already stored on Whop, prefixed file_.

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + /** + *

The file itself. Send it as a file part to upload and attach in one call, or use id/direct_upload_id for a file that is already stored.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage file(String file) { + this.file = Optional.ofNullable(file); + return this; + } + + /** + *

The file itself. Send it as a file part to upload and attach in one call, or use id/direct_upload_id for a file that is already stored.

+ */ + @java.lang.Override + @JsonSetter(value = "file", nulls = Nulls.SKIP) + public _FinalStage file(Optional file) { + this.file = file; + return this; + } + + /** + *

The ID returned by a direct upload.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + /** + *

The ID returned by a direct upload.

+ */ + @java.lang.Override + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public _FinalStage directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + @java.lang.Override + public UploadEvidenceDisputesRequestDocumentsItem build() { + return new UploadEvidenceDisputesRequestDocumentsItem( + directUploadId, documentType, file, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/disputes/types/UploadEvidenceDisputesRequestDocumentsItemDocumentType.java b/src/main/java/com/whop/api/resources/disputes/types/UploadEvidenceDisputesRequestDocumentsItemDocumentType.java new file mode 100644 index 00000000..e54649a4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/disputes/types/UploadEvidenceDisputesRequestDocumentsItemDocumentType.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.disputes.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UploadEvidenceDisputesRequestDocumentsItemDocumentType { + public static final UploadEvidenceDisputesRequestDocumentsItemDocumentType DIGITAL_FULFILLMENT = + new UploadEvidenceDisputesRequestDocumentsItemDocumentType( + Value.DIGITAL_FULFILLMENT, "digital_fulfillment"); + + public static final UploadEvidenceDisputesRequestDocumentsItemDocumentType RETURN_POLICY = + new UploadEvidenceDisputesRequestDocumentsItemDocumentType(Value.RETURN_POLICY, "return_policy"); + + public static final UploadEvidenceDisputesRequestDocumentsItemDocumentType SHIPPING_POLICY = + new UploadEvidenceDisputesRequestDocumentsItemDocumentType(Value.SHIPPING_POLICY, "shipping_policy"); + + public static final UploadEvidenceDisputesRequestDocumentsItemDocumentType CUSTOMER_ORDER_HISTORY = + new UploadEvidenceDisputesRequestDocumentsItemDocumentType( + Value.CUSTOMER_ORDER_HISTORY, "customer_order_history"); + + public static final UploadEvidenceDisputesRequestDocumentsItemDocumentType SUBSCRIPTION = + new UploadEvidenceDisputesRequestDocumentsItemDocumentType(Value.SUBSCRIPTION, "subscription"); + + public static final UploadEvidenceDisputesRequestDocumentsItemDocumentType PRODUCT_IMAGE = + new UploadEvidenceDisputesRequestDocumentsItemDocumentType(Value.PRODUCT_IMAGE, "product_image"); + + public static final UploadEvidenceDisputesRequestDocumentsItemDocumentType PHYSICAL_FULFILLMENT = + new UploadEvidenceDisputesRequestDocumentsItemDocumentType( + Value.PHYSICAL_FULFILLMENT, "physical_fulfillment"); + + public static final UploadEvidenceDisputesRequestDocumentsItemDocumentType CUSTOMER_SESSION = + new UploadEvidenceDisputesRequestDocumentsItemDocumentType(Value.CUSTOMER_SESSION, "customer_session"); + + public static final UploadEvidenceDisputesRequestDocumentsItemDocumentType PRIOR_TRANSACTIONS = + new UploadEvidenceDisputesRequestDocumentsItemDocumentType(Value.PRIOR_TRANSACTIONS, "prior_transactions"); + + private final Value value; + + private final String string; + + UploadEvidenceDisputesRequestDocumentsItemDocumentType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UploadEvidenceDisputesRequestDocumentsItemDocumentType + && this.string.equals(((UploadEvidenceDisputesRequestDocumentsItemDocumentType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DIGITAL_FULFILLMENT: + return visitor.visitDigitalFulfillment(); + case RETURN_POLICY: + return visitor.visitReturnPolicy(); + case SHIPPING_POLICY: + return visitor.visitShippingPolicy(); + case CUSTOMER_ORDER_HISTORY: + return visitor.visitCustomerOrderHistory(); + case SUBSCRIPTION: + return visitor.visitSubscription(); + case PRODUCT_IMAGE: + return visitor.visitProductImage(); + case PHYSICAL_FULFILLMENT: + return visitor.visitPhysicalFulfillment(); + case CUSTOMER_SESSION: + return visitor.visitCustomerSession(); + case PRIOR_TRANSACTIONS: + return visitor.visitPriorTransactions(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UploadEvidenceDisputesRequestDocumentsItemDocumentType valueOf(String value) { + switch (value) { + case "digital_fulfillment": + return DIGITAL_FULFILLMENT; + case "return_policy": + return RETURN_POLICY; + case "shipping_policy": + return SHIPPING_POLICY; + case "customer_order_history": + return CUSTOMER_ORDER_HISTORY; + case "subscription": + return SUBSCRIPTION; + case "product_image": + return PRODUCT_IMAGE; + case "physical_fulfillment": + return PHYSICAL_FULFILLMENT; + case "customer_session": + return CUSTOMER_SESSION; + case "prior_transactions": + return PRIOR_TRANSACTIONS; + default: + return new UploadEvidenceDisputesRequestDocumentsItemDocumentType(Value.UNKNOWN, value); + } + } + + public enum Value { + RETURN_POLICY, + + SHIPPING_POLICY, + + PHYSICAL_FULFILLMENT, + + CUSTOMER_ORDER_HISTORY, + + PRODUCT_IMAGE, + + PRIOR_TRANSACTIONS, + + CUSTOMER_SESSION, + + DIGITAL_FULFILLMENT, + + SUBSCRIPTION, + + UNKNOWN + } + + public interface Visitor { + T visitReturnPolicy(); + + T visitShippingPolicy(); + + T visitPhysicalFulfillment(); + + T visitCustomerOrderHistory(); + + T visitProductImage(); + + T visitPriorTransactions(); + + T visitCustomerSession(); + + T visitDigitalFulfillment(); + + T visitSubscription(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/dmchannels/AsyncDmChannelsClient.java b/src/main/java/com/whop/api/resources/dmchannels/AsyncDmChannelsClient.java new file mode 100644 index 00000000..283c8bfb --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmchannels/AsyncDmChannelsClient.java @@ -0,0 +1,248 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmchannels; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.dmchannels.requests.CreateDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.DeleteDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.ListDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.RetrieveDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.UpdateDmChannelsRequest; +import com.whop.api.types.DmChannel; +import com.whop.api.types.DmChannelListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncDmChannelsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawDmChannelsClient rawClient; + + public AsyncDmChannelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawDmChannelsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawDmChannelsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public CompletableFuture> list(ListDmChannelsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public CompletableFuture> list( + ListDmChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create a new DM channel between two or more users, optionally scoped to a specific company. Returns the existing channel if one already exists. + *

Required permissions:

+ *
    + *
  • dms:channel:manage
  • + *
+ */ + public CompletableFuture create(CreateDmChannelsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create a new DM channel between two or more users, optionally scoped to a specific company. Returns the existing channel if one already exists. + *

Required permissions:

+ *
    + *
  • dms:channel:manage
  • + *
+ */ + public CompletableFuture create(CreateDmChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveDmChannelsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveDmChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture delete(String id, DeleteDmChannelsRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture delete( + String id, DeleteDmChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture update(String id, UpdateDmChannelsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture update( + String id, UpdateDmChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/dmchannels/AsyncRawDmChannelsClient.java b/src/main/java/com/whop/api/resources/dmchannels/AsyncRawDmChannelsClient.java new file mode 100644 index 00000000..70d68d7f --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmchannels/AsyncRawDmChannelsClient.java @@ -0,0 +1,749 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmchannels; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.dmchannels.requests.CreateDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.DeleteDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.ListDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.RetrieveDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.UpdateDmChannelsRequest; +import com.whop.api.resources.dmchannels.types.ListDmChannelsResponse; +import com.whop.api.types.DmChannel; +import com.whop.api.types.DmChannelListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawDmChannelsClient { + protected final ClientOptions clientOptions; + + public AsyncRawDmChannelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public CompletableFuture>> list() { + return list(ListDmChannelsRequest.builder().build()); + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListDmChannelsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public CompletableFuture>> list( + ListDmChannelsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public CompletableFuture>> list( + ListDmChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_channels"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListDmChannelsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListDmChannelsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListDmChannelsRequest nextRequest = ListDmChannelsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create a new DM channel between two or more users, optionally scoped to a specific company. Returns the existing channel if one already exists. + *

Required permissions:

+ *
    + *
  • dms:channel:manage
  • + *
+ */ + public CompletableFuture> create(CreateDmChannelsRequest request) { + return create(request, null); + } + + /** + * Create a new DM channel between two or more users, optionally scoped to a specific company. Returns the existing channel if one already exists. + *

Required permissions:

+ *
    + *
  • dms:channel:manage
  • + *
+ */ + public CompletableFuture> create( + CreateDmChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_channels"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DmChannel.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveDmChannelsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveDmChannelsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RetrieveDmChannelsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveDmChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_channels") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DmChannel.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteDmChannelsRequest.builder().build()); + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteDmChannelsRequest.builder().build(), requestOptions); + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture> delete(String id, DeleteDmChannelsRequest request) { + return delete(id, request, null); + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture> delete( + String id, DeleteDmChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_channels") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture> update(String id) { + return update(id, UpdateDmChannelsRequest.builder().build()); + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateDmChannelsRequest.builder().build(), requestOptions); + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture> update(String id, UpdateDmChannelsRequest request) { + return update(id, request, null); + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture> update( + String id, UpdateDmChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_channels") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DmChannel.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/dmchannels/DmChannelsClient.java b/src/main/java/com/whop/api/resources/dmchannels/DmChannelsClient.java new file mode 100644 index 00000000..aa833535 --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmchannels/DmChannelsClient.java @@ -0,0 +1,243 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmchannels; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.dmchannels.requests.CreateDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.DeleteDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.ListDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.RetrieveDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.UpdateDmChannelsRequest; +import com.whop.api.types.DmChannel; +import com.whop.api.types.DmChannelListItem; + +public class DmChannelsClient { + protected final ClientOptions clientOptions; + + private final RawDmChannelsClient rawClient; + + public DmChannelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawDmChannelsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawDmChannelsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public SyncPagingIterable list(ListDmChannelsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public SyncPagingIterable list(ListDmChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Create a new DM channel between two or more users, optionally scoped to a specific company. Returns the existing channel if one already exists. + *

Required permissions:

+ *
    + *
  • dms:channel:manage
  • + *
+ */ + public DmChannel create(CreateDmChannelsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Create a new DM channel between two or more users, optionally scoped to a specific company. Returns the existing channel if one already exists. + *

Required permissions:

+ *
    + *
  • dms:channel:manage
  • + *
+ */ + public DmChannel create(CreateDmChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public DmChannel retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public DmChannel retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public DmChannel retrieve(String id, RetrieveDmChannelsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public DmChannel retrieve(String id, RetrieveDmChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public boolean delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public boolean delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public boolean delete(String id, DeleteDmChannelsRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public boolean delete(String id, DeleteDmChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public DmChannel update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public DmChannel update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public DmChannel update(String id, UpdateDmChannelsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public DmChannel update(String id, UpdateDmChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/dmchannels/RawDmChannelsClient.java b/src/main/java/com/whop/api/resources/dmchannels/RawDmChannelsClient.java new file mode 100644 index 00000000..a380cacc --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmchannels/RawDmChannelsClient.java @@ -0,0 +1,597 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmchannels; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.dmchannels.requests.CreateDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.DeleteDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.ListDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.RetrieveDmChannelsRequest; +import com.whop.api.resources.dmchannels.requests.UpdateDmChannelsRequest; +import com.whop.api.resources.dmchannels.types.ListDmChannelsResponse; +import com.whop.api.types.DmChannel; +import com.whop.api.types.DmChannelListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawDmChannelsClient { + protected final ClientOptions clientOptions; + + public RawDmChannelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public WhopApiHttpResponse> list() { + return list(ListDmChannelsRequest.builder().build()); + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListDmChannelsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListDmChannelsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active. + *

Required permissions:

+ *
    + *
  • dms:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListDmChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_channels"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListDmChannelsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListDmChannelsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListDmChannelsRequest nextRequest = ListDmChannelsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Create a new DM channel between two or more users, optionally scoped to a specific company. Returns the existing channel if one already exists. + *

Required permissions:

+ *
    + *
  • dms:channel:manage
  • + *
+ */ + public WhopApiHttpResponse create(CreateDmChannelsRequest request) { + return create(request, null); + } + + /** + * Create a new DM channel between two or more users, optionally scoped to a specific company. Returns the existing channel if one already exists. + *

Required permissions:

+ *
    + *
  • dms:channel:manage
  • + *
+ */ + public WhopApiHttpResponse create(CreateDmChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_channels"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DmChannel.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveDmChannelsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveDmChannelsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveDmChannelsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing DM channel. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveDmChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_channels") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DmChannel.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteDmChannelsRequest.builder().build()); + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteDmChannelsRequest.builder().build(), requestOptions); + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public WhopApiHttpResponse delete(String id, DeleteDmChannelsRequest request) { + return delete(id, request, null); + } + + /** + * Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public WhopApiHttpResponse delete( + String id, DeleteDmChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_channels") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateDmChannelsRequest.builder().build()); + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateDmChannelsRequest.builder().build(), requestOptions); + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateDmChannelsRequest request) { + return update(id, request, null); + } + + /** + * Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action. + *

Required permissions (one of):

+ *
    + *
  • dms:channel:manage
  • + *
  • support_chat:create
  • + *
+ */ + public WhopApiHttpResponse update( + String id, UpdateDmChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_channels") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DmChannel.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/dmchannels/requests/CreateDmChannelsRequest.java b/src/main/java/com/whop/api/resources/dmchannels/requests/CreateDmChannelsRequest.java new file mode 100644 index 00000000..bae1d1c7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmchannels/requests/CreateDmChannelsRequest.java @@ -0,0 +1,279 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmchannels.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateDmChannelsRequest.Builder.class) +public final class CreateDmChannelsRequest { + private final Optional companyId; + + private final Optional customName; + + private final Optional notificationsEnabled; + + private final List withUserIds; + + private final Map additionalProperties; + + private CreateDmChannelsRequest( + Optional companyId, + Optional customName, + Optional notificationsEnabled, + List withUserIds, + Map additionalProperties) { + this.companyId = companyId; + this.customName = customName; + this.notificationsEnabled = notificationsEnabled; + this.withUserIds = withUserIds; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the company to scope this DM channel to. When set, the channel is visible only within that company context. + */ + @JsonIgnore + public Optional getCompanyId() { + if (companyId == null) { + return Optional.empty(); + } + return companyId; + } + + /** + * @return A custom display name for the DM channel. For example, 'Project Discussion'. + */ + @JsonIgnore + public Optional getCustomName() { + if (customName == null) { + return Optional.empty(); + } + return customName; + } + + /** + * @return Whether Whop app notifications are enabled for this direct message channel. Webhooks still fire. + */ + @JsonIgnore + public Optional getNotificationsEnabled() { + if (notificationsEnabled == null) { + return Optional.empty(); + } + return notificationsEnabled; + } + + /** + * @return The list of user identifiers to include in the DM channel. Each entry can be an email, username, or user ID (e.g. 'user_xxxxx'). + */ + @JsonProperty("with_user_ids") + public List getWithUserIds() { + return withUserIds; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company_id") + private Optional _getCompanyId() { + return companyId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_name") + private Optional _getCustomName() { + return customName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notifications_enabled") + private Optional _getNotificationsEnabled() { + return notificationsEnabled; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateDmChannelsRequest && equalTo((CreateDmChannelsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateDmChannelsRequest other) { + return companyId.equals(other.companyId) + && customName.equals(other.customName) + && notificationsEnabled.equals(other.notificationsEnabled) + && withUserIds.equals(other.withUserIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.customName, this.notificationsEnabled, this.withUserIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional companyId = Optional.empty(); + + private Optional customName = Optional.empty(); + + private Optional notificationsEnabled = Optional.empty(); + + private List withUserIds = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateDmChannelsRequest other) { + companyId(other.getCompanyId()); + customName(other.getCustomName()); + notificationsEnabled(other.getNotificationsEnabled()); + withUserIds(other.getWithUserIds()); + return this; + } + + /** + *

The unique identifier of the company to scope this DM channel to. When set, the channel is visible only within that company context.

+ */ + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + public Builder companyId(Nullable companyId) { + if (companyId.isNull()) { + this.companyId = null; + } else if (companyId.isEmpty()) { + this.companyId = Optional.empty(); + } else { + this.companyId = Optional.of(companyId.get()); + } + return this; + } + + /** + *

A custom display name for the DM channel. For example, 'Project Discussion'.

+ */ + @JsonSetter(value = "custom_name", nulls = Nulls.SKIP) + public Builder customName(Optional customName) { + this.customName = customName; + return this; + } + + public Builder customName(String customName) { + this.customName = Optional.ofNullable(customName); + return this; + } + + public Builder customName(Nullable customName) { + if (customName.isNull()) { + this.customName = null; + } else if (customName.isEmpty()) { + this.customName = Optional.empty(); + } else { + this.customName = Optional.of(customName.get()); + } + return this; + } + + /** + *

Whether Whop app notifications are enabled for this direct message channel. Webhooks still fire.

+ */ + @JsonSetter(value = "notifications_enabled", nulls = Nulls.SKIP) + public Builder notificationsEnabled(Optional notificationsEnabled) { + this.notificationsEnabled = notificationsEnabled; + return this; + } + + public Builder notificationsEnabled(Boolean notificationsEnabled) { + this.notificationsEnabled = Optional.ofNullable(notificationsEnabled); + return this; + } + + public Builder notificationsEnabled(Nullable notificationsEnabled) { + if (notificationsEnabled.isNull()) { + this.notificationsEnabled = null; + } else if (notificationsEnabled.isEmpty()) { + this.notificationsEnabled = Optional.empty(); + } else { + this.notificationsEnabled = Optional.of(notificationsEnabled.get()); + } + return this; + } + + /** + *

The list of user identifiers to include in the DM channel. Each entry can be an email, username, or user ID (e.g. 'user_xxxxx').

+ */ + @JsonSetter(value = "with_user_ids", nulls = Nulls.SKIP) + public Builder withUserIds(List withUserIds) { + this.withUserIds.clear(); + if (withUserIds != null) { + this.withUserIds.addAll(withUserIds); + } + return this; + } + + public Builder addWithUserIds(String withUserIds) { + this.withUserIds.add(withUserIds); + return this; + } + + public Builder addAllWithUserIds(List withUserIds) { + if (withUserIds != null) { + this.withUserIds.addAll(withUserIds); + } + return this; + } + + public CreateDmChannelsRequest build() { + return new CreateDmChannelsRequest( + companyId, customName, notificationsEnabled, withUserIds, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/dmchannels/requests/DeleteDmChannelsRequest.java b/src/main/java/com/whop/api/resources/dmchannels/requests/DeleteDmChannelsRequest.java new file mode 100644 index 00000000..4fd2020f --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmchannels/requests/DeleteDmChannelsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmchannels.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteDmChannelsRequest.Builder.class) +public final class DeleteDmChannelsRequest { + private final Map additionalProperties; + + private DeleteDmChannelsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteDmChannelsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteDmChannelsRequest other) { + return this; + } + + public DeleteDmChannelsRequest build() { + return new DeleteDmChannelsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/dmchannels/requests/ListDmChannelsRequest.java b/src/main/java/com/whop/api/resources/dmchannels/requests/ListDmChannelsRequest.java new file mode 100644 index 00000000..5151e00c --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmchannels/requests/ListDmChannelsRequest.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmchannels.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDmChannelsRequest.Builder.class) +public final class ListDmChannelsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Optional companyId; + + private final Map additionalProperties; + + private ListDmChannelsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + Optional companyId, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of a company to filter DM channels by. Only returns channels scoped to this company. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListDmChannelsRequest && equalTo((ListDmChannelsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDmChannelsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last, this.companyId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional companyId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListDmChannelsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The unique identifier of a company to filter DM channels by. Only returns channels scoped to this company.

+ */ + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + public ListDmChannelsRequest build() { + return new ListDmChannelsRequest(after, before, first, last, companyId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/dmchannels/requests/RetrieveDmChannelsRequest.java b/src/main/java/com/whop/api/resources/dmchannels/requests/RetrieveDmChannelsRequest.java new file mode 100644 index 00000000..492f5eca --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmchannels/requests/RetrieveDmChannelsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmchannels.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveDmChannelsRequest.Builder.class) +public final class RetrieveDmChannelsRequest { + private final Map additionalProperties; + + private RetrieveDmChannelsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveDmChannelsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveDmChannelsRequest other) { + return this; + } + + public RetrieveDmChannelsRequest build() { + return new RetrieveDmChannelsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/dmchannels/requests/UpdateDmChannelsRequest.java b/src/main/java/com/whop/api/resources/dmchannels/requests/UpdateDmChannelsRequest.java new file mode 100644 index 00000000..94e05752 --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmchannels/requests/UpdateDmChannelsRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmchannels.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateDmChannelsRequest.Builder.class) +public final class UpdateDmChannelsRequest { + private final Optional customName; + + private final Map additionalProperties; + + private UpdateDmChannelsRequest(Optional customName, Map additionalProperties) { + this.customName = customName; + this.additionalProperties = additionalProperties; + } + + /** + * @return A new custom display name for the DM channel. For example, 'Project Discussion'. + */ + @JsonIgnore + public Optional getCustomName() { + if (customName == null) { + return Optional.empty(); + } + return customName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_name") + private Optional _getCustomName() { + return customName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateDmChannelsRequest && equalTo((UpdateDmChannelsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateDmChannelsRequest other) { + return customName.equals(other.customName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.customName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional customName = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateDmChannelsRequest other) { + customName(other.getCustomName()); + return this; + } + + /** + *

A new custom display name for the DM channel. For example, 'Project Discussion'.

+ */ + @JsonSetter(value = "custom_name", nulls = Nulls.SKIP) + public Builder customName(Optional customName) { + this.customName = customName; + return this; + } + + public Builder customName(String customName) { + this.customName = Optional.ofNullable(customName); + return this; + } + + public Builder customName(Nullable customName) { + if (customName.isNull()) { + this.customName = null; + } else if (customName.isEmpty()) { + this.customName = Optional.empty(); + } else { + this.customName = Optional.of(customName.get()); + } + return this; + } + + public UpdateDmChannelsRequest build() { + return new UpdateDmChannelsRequest(customName, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/dmchannels/types/ListDmChannelsResponse.java b/src/main/java/com/whop/api/resources/dmchannels/types/ListDmChannelsResponse.java new file mode 100644 index 00000000..0569b3e0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmchannels/types/ListDmChannelsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmchannels.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.DmChannelListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDmChannelsResponse.Builder.class) +public final class ListDmChannelsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListDmChannelsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListDmChannelsResponse && equalTo((ListDmChannelsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDmChannelsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListDmChannelsResponse other); + } + + public interface _FinalStage { + ListDmChannelsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(DmChannelListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListDmChannelsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(DmChannelListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListDmChannelsResponse build() { + return new ListDmChannelsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/dmmembers/AsyncDmMembersClient.java b/src/main/java/com/whop/api/resources/dmmembers/AsyncDmMembersClient.java new file mode 100644 index 00000000..55a129b1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmmembers/AsyncDmMembersClient.java @@ -0,0 +1,229 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmmembers; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.dmmembers.requests.CreateDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.DeleteDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.ListDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.RetrieveDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.UpdateDmMembersRequest; +import com.whop.api.types.DmMember; +import com.whop.api.types.DmMemberListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncDmMembersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawDmMembersClient rawClient; + + public AsyncDmMembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawDmMembersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawDmMembersClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of members in a specific DM channel, sorted by the date they were added. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> list(ListDmMembersRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of members in a specific DM channel, sorted by the date they were added. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> list( + ListDmMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Add a new user to an existing DM channel. Only an admin of the channel can add members. + *

Required permissions (one of):

+ *
    + *
  • dms:message:manage
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture create(CreateDmMembersRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Add a new user to an existing DM channel. Only an admin of the channel can add members. + *

Required permissions (one of):

+ *
    + *
  • dms:message:manage
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture create(CreateDmMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveDmMembersRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveDmMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture delete(String id, DeleteDmMembersRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture delete(String id, DeleteDmMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture update(String id, UpdateDmMembersRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture update( + String id, UpdateDmMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/dmmembers/AsyncRawDmMembersClient.java b/src/main/java/com/whop/api/resources/dmmembers/AsyncRawDmMembersClient.java new file mode 100644 index 00000000..0ac149c2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmmembers/AsyncRawDmMembersClient.java @@ -0,0 +1,726 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmmembers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.dmmembers.requests.CreateDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.DeleteDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.ListDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.RetrieveDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.UpdateDmMembersRequest; +import com.whop.api.resources.dmmembers.types.ListDmMembersResponse; +import com.whop.api.types.DmMember; +import com.whop.api.types.DmMemberListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawDmMembersClient { + protected final ClientOptions clientOptions; + + public AsyncRawDmMembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of members in a specific DM channel, sorted by the date they were added. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture>> list( + ListDmMembersRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of members in a specific DM channel, sorted by the date they were added. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture>> list( + ListDmMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_members"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "channel_id", request.getChannelId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListDmMembersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListDmMembersResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListDmMembersRequest nextRequest = ListDmMembersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Add a new user to an existing DM channel. Only an admin of the channel can add members. + *

Required permissions (one of):

+ *
    + *
  • dms:message:manage
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture> create(CreateDmMembersRequest request) { + return create(request, null); + } + + /** + * Add a new user to an existing DM channel. Only an admin of the channel can add members. + *

Required permissions (one of):

+ *
    + *
  • dms:message:manage
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture> create( + CreateDmMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_members"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DmMember.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveDmMembersRequest.builder().build()); + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveDmMembersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RetrieveDmMembersRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveDmMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_members") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DmMember.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteDmMembersRequest.builder().build()); + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteDmMembersRequest.builder().build(), requestOptions); + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> delete(String id, DeleteDmMembersRequest request) { + return delete(id, request, null); + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> delete( + String id, DeleteDmMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_members") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> update(String id) { + return update(id, UpdateDmMembersRequest.builder().build()); + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateDmMembersRequest.builder().build(), requestOptions); + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> update(String id, UpdateDmMembersRequest request) { + return update(id, request, null); + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> update( + String id, UpdateDmMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_members") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DmMember.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/dmmembers/DmMembersClient.java b/src/main/java/com/whop/api/resources/dmmembers/DmMembersClient.java new file mode 100644 index 00000000..75dc3ac9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmmembers/DmMembersClient.java @@ -0,0 +1,225 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmmembers; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.dmmembers.requests.CreateDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.DeleteDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.ListDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.RetrieveDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.UpdateDmMembersRequest; +import com.whop.api.types.DmMember; +import com.whop.api.types.DmMemberListItem; + +public class DmMembersClient { + protected final ClientOptions clientOptions; + + private final RawDmMembersClient rawClient; + + public DmMembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawDmMembersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawDmMembersClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of members in a specific DM channel, sorted by the date they were added. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public SyncPagingIterable list(ListDmMembersRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of members in a specific DM channel, sorted by the date they were added. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public SyncPagingIterable list(ListDmMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Add a new user to an existing DM channel. Only an admin of the channel can add members. + *

Required permissions (one of):

+ *
    + *
  • dms:message:manage
  • + *
  • support_chat:message:create
  • + *
+ */ + public DmMember create(CreateDmMembersRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Add a new user to an existing DM channel. Only an admin of the channel can add members. + *

Required permissions (one of):

+ *
    + *
  • dms:message:manage
  • + *
  • support_chat:message:create
  • + *
+ */ + public DmMember create(CreateDmMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public DmMember retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public DmMember retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public DmMember retrieve(String id, RetrieveDmMembersRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public DmMember retrieve(String id, RetrieveDmMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public boolean delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public boolean delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public boolean delete(String id, DeleteDmMembersRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public boolean delete(String id, DeleteDmMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public DmMember update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public DmMember update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public DmMember update(String id, UpdateDmMembersRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public DmMember update(String id, UpdateDmMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/dmmembers/RawDmMembersClient.java b/src/main/java/com/whop/api/resources/dmmembers/RawDmMembersClient.java new file mode 100644 index 00000000..f585ce7d --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmmembers/RawDmMembersClient.java @@ -0,0 +1,576 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmmembers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.dmmembers.requests.CreateDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.DeleteDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.ListDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.RetrieveDmMembersRequest; +import com.whop.api.resources.dmmembers.requests.UpdateDmMembersRequest; +import com.whop.api.resources.dmmembers.types.ListDmMembersResponse; +import com.whop.api.types.DmMember; +import com.whop.api.types.DmMemberListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawDmMembersClient { + protected final ClientOptions clientOptions; + + public RawDmMembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of members in a specific DM channel, sorted by the date they were added. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListDmMembersRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of members in a specific DM channel, sorted by the date they were added. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListDmMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_members"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "channel_id", request.getChannelId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListDmMembersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListDmMembersResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListDmMembersRequest nextRequest = ListDmMembersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Add a new user to an existing DM channel. Only an admin of the channel can add members. + *

Required permissions (one of):

+ *
    + *
  • dms:message:manage
  • + *
  • support_chat:message:create
  • + *
+ */ + public WhopApiHttpResponse create(CreateDmMembersRequest request) { + return create(request, null); + } + + /** + * Add a new user to an existing DM channel. Only an admin of the channel can add members. + *

Required permissions (one of):

+ *
    + *
  • dms:message:manage
  • + *
  • support_chat:message:create
  • + *
+ */ + public WhopApiHttpResponse create(CreateDmMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_members"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DmMember.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveDmMembersRequest.builder().build()); + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveDmMembersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveDmMembersRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing DM member. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveDmMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_members") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DmMember.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteDmMembersRequest.builder().build()); + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteDmMembersRequest.builder().build(), requestOptions); + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse delete(String id, DeleteDmMembersRequest request) { + return delete(id, request, null); + } + + /** + * Remove a user from a DM channel. An admin can remove any member, and a member can remove themselves. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse delete( + String id, DeleteDmMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_members") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateDmMembersRequest.builder().build()); + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateDmMembersRequest.builder().build(), requestOptions); + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateDmMembersRequest request) { + return update(id, request, null); + } + + /** + * Update a DM channel member's settings, such as their notification preferences or membership status. + *

Required permissions (one of):

+ *
    + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse update( + String id, UpdateDmMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("dm_members") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DmMember.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/dmmembers/requests/CreateDmMembersRequest.java b/src/main/java/com/whop/api/resources/dmmembers/requests/CreateDmMembersRequest.java new file mode 100644 index 00000000..4e2a609c --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmmembers/requests/CreateDmMembersRequest.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmmembers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateDmMembersRequest.Builder.class) +public final class CreateDmMembersRequest { + private final String channelId; + + private final String userId; + + private final Map additionalProperties; + + private CreateDmMembersRequest(String channelId, String userId, Map additionalProperties) { + this.channelId = channelId; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the DM channel to add the new member to. + */ + @JsonProperty("channel_id") + public String getChannelId() { + return channelId; + } + + /** + * @return The unique identifier of the user to add to the DM channel. For example, 'user_xxxxx'. + */ + @JsonProperty("user_id") + public String getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateDmMembersRequest && equalTo((CreateDmMembersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateDmMembersRequest other) { + return channelId.equals(other.channelId) && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.channelId, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChannelIdStage builder() { + return new Builder(); + } + + public interface ChannelIdStage { + /** + *

The unique identifier of the DM channel to add the new member to.

+ */ + UserIdStage channelId(@NotNull String channelId); + + Builder from(CreateDmMembersRequest other); + } + + public interface UserIdStage { + /** + *

The unique identifier of the user to add to the DM channel. For example, 'user_xxxxx'.

+ */ + _FinalStage userId(@NotNull String userId); + } + + public interface _FinalStage { + CreateDmMembersRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ChannelIdStage, UserIdStage, _FinalStage { + private String channelId; + + private String userId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateDmMembersRequest other) { + channelId(other.getChannelId()); + userId(other.getUserId()); + return this; + } + + /** + *

The unique identifier of the DM channel to add the new member to.

+ *

The unique identifier of the DM channel to add the new member to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("channel_id") + public UserIdStage channelId(@NotNull String channelId) { + this.channelId = Objects.requireNonNull(channelId, "channelId must not be null"); + return this; + } + + /** + *

The unique identifier of the user to add to the DM channel. For example, 'user_xxxxx'.

+ *

The unique identifier of the user to add to the DM channel. For example, 'user_xxxxx'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user_id") + public _FinalStage userId(@NotNull String userId) { + this.userId = Objects.requireNonNull(userId, "userId must not be null"); + return this; + } + + @java.lang.Override + public CreateDmMembersRequest build() { + return new CreateDmMembersRequest(channelId, userId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/dmmembers/requests/DeleteDmMembersRequest.java b/src/main/java/com/whop/api/resources/dmmembers/requests/DeleteDmMembersRequest.java new file mode 100644 index 00000000..79f0e3eb --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmmembers/requests/DeleteDmMembersRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmmembers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteDmMembersRequest.Builder.class) +public final class DeleteDmMembersRequest { + private final Map additionalProperties; + + private DeleteDmMembersRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteDmMembersRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteDmMembersRequest other) { + return this; + } + + public DeleteDmMembersRequest build() { + return new DeleteDmMembersRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/dmmembers/requests/ListDmMembersRequest.java b/src/main/java/com/whop/api/resources/dmmembers/requests/ListDmMembersRequest.java new file mode 100644 index 00000000..0e1e267d --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmmembers/requests/ListDmMembersRequest.java @@ -0,0 +1,305 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmmembers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDmMembersRequest.Builder.class) +public final class ListDmMembersRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String channelId; + + private final Map additionalProperties; + + private ListDmMembersRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String channelId, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.channelId = channelId; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the DM channel to list members for. + */ + @JsonProperty("channel_id") + public String getChannelId() { + return channelId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListDmMembersRequest && equalTo((ListDmMembersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDmMembersRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && channelId.equals(other.channelId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last, this.channelId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChannelIdStage builder() { + return new Builder(); + } + + public interface ChannelIdStage { + /** + *

The unique identifier of the DM channel to list members for.

+ */ + _FinalStage channelId(@NotNull String channelId); + + Builder from(ListDmMembersRequest other); + } + + public interface _FinalStage { + ListDmMembersRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ChannelIdStage, _FinalStage { + private String channelId; + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListDmMembersRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + channelId(other.getChannelId()); + return this; + } + + /** + *

The unique identifier of the DM channel to list members for.

+ *

The unique identifier of the DM channel to list members for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("channel_id") + public _FinalStage channelId(@NotNull String channelId) { + this.channelId = Objects.requireNonNull(channelId, "channelId must not be null"); + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListDmMembersRequest build() { + return new ListDmMembersRequest(after, before, first, last, channelId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/dmmembers/requests/RetrieveDmMembersRequest.java b/src/main/java/com/whop/api/resources/dmmembers/requests/RetrieveDmMembersRequest.java new file mode 100644 index 00000000..f5ba5999 --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmmembers/requests/RetrieveDmMembersRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmmembers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveDmMembersRequest.Builder.class) +public final class RetrieveDmMembersRequest { + private final Map additionalProperties; + + private RetrieveDmMembersRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveDmMembersRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveDmMembersRequest other) { + return this; + } + + public RetrieveDmMembersRequest build() { + return new RetrieveDmMembersRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/dmmembers/requests/UpdateDmMembersRequest.java b/src/main/java/com/whop/api/resources/dmmembers/requests/UpdateDmMembersRequest.java new file mode 100644 index 00000000..9cac9c46 --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmmembers/requests/UpdateDmMembersRequest.java @@ -0,0 +1,187 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmmembers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.DmsFeedMemberNotificationPreferences; +import com.whop.api.types.DmsFeedMemberStatuses; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateDmMembersRequest.Builder.class) +public final class UpdateDmMembersRequest { + private final Optional notificationPreference; + + private final Optional status; + + private final Map additionalProperties; + + private UpdateDmMembersRequest( + Optional notificationPreference, + Optional status, + Map additionalProperties) { + this.notificationPreference = notificationPreference; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The notification setting for this member, controlling how they receive alerts for new messages in this channel. + */ + @JsonIgnore + public Optional getNotificationPreference() { + if (notificationPreference == null) { + return Optional.empty(); + } + return notificationPreference; + } + + /** + * @return The membership status for this member in the DM channel. + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notification_preference") + private Optional _getNotificationPreference() { + return notificationPreference; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateDmMembersRequest && equalTo((UpdateDmMembersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateDmMembersRequest other) { + return notificationPreference.equals(other.notificationPreference) && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.notificationPreference, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional notificationPreference = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateDmMembersRequest other) { + notificationPreference(other.getNotificationPreference()); + status(other.getStatus()); + return this; + } + + /** + *

The notification setting for this member, controlling how they receive alerts for new messages in this channel.

+ */ + @JsonSetter(value = "notification_preference", nulls = Nulls.SKIP) + public Builder notificationPreference(Optional notificationPreference) { + this.notificationPreference = notificationPreference; + return this; + } + + public Builder notificationPreference(DmsFeedMemberNotificationPreferences notificationPreference) { + this.notificationPreference = Optional.ofNullable(notificationPreference); + return this; + } + + public Builder notificationPreference(Nullable notificationPreference) { + if (notificationPreference.isNull()) { + this.notificationPreference = null; + } else if (notificationPreference.isEmpty()) { + this.notificationPreference = Optional.empty(); + } else { + this.notificationPreference = Optional.of(notificationPreference.get()); + } + return this; + } + + /** + *

The membership status for this member in the DM channel.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(DmsFeedMemberStatuses status) { + this.status = Optional.ofNullable(status); + return this; + } + + public Builder status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + public UpdateDmMembersRequest build() { + return new UpdateDmMembersRequest(notificationPreference, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/dmmembers/types/ListDmMembersResponse.java b/src/main/java/com/whop/api/resources/dmmembers/types/ListDmMembersResponse.java new file mode 100644 index 00000000..0f4145f8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/dmmembers/types/ListDmMembersResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.dmmembers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.DmMemberListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDmMembersResponse.Builder.class) +public final class ListDmMembersResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListDmMembersResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListDmMembersResponse && equalTo((ListDmMembersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDmMembersResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListDmMembersResponse other); + } + + public interface _FinalStage { + ListDmMembersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(DmMemberListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListDmMembersResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(DmMemberListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListDmMembersResponse build() { + return new ListDmMembersResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/entries/AsyncEntriesClient.java b/src/main/java/com/whop/api/resources/entries/AsyncEntriesClient.java new file mode 100644 index 00000000..49a2548e --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/AsyncEntriesClient.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.entries.requests.ApproveEntriesRequest; +import com.whop.api.resources.entries.requests.DenyEntriesRequest; +import com.whop.api.resources.entries.requests.ListEntriesRequest; +import com.whop.api.resources.entries.requests.RetrieveEntriesRequest; +import com.whop.api.resources.entries.types.ApproveEntriesResponse; +import com.whop.api.types.Entry; +import com.whop.api.types.EntryListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncEntriesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawEntriesClient rawClient; + + public AsyncEntriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawEntriesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawEntriesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of waitlist entries for a company, with optional filtering by product, plan, status, and creation date. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> list(ListEntriesRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of waitlist entries for a company, with optional filtering by product, plan, status, and creation date. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> list( + ListEntriesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveEntriesRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveEntriesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public CompletableFuture approve(String id) { + return this.rawClient.approve(id).thenApply(response -> response.body()); + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public CompletableFuture approve(String id, RequestOptions requestOptions) { + return this.rawClient.approve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public CompletableFuture approve(String id, ApproveEntriesRequest request) { + return this.rawClient.approve(id, request).thenApply(response -> response.body()); + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public CompletableFuture approve( + String id, ApproveEntriesRequest request, RequestOptions requestOptions) { + return this.rawClient.approve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture deny(String id) { + return this.rawClient.deny(id).thenApply(response -> response.body()); + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture deny(String id, RequestOptions requestOptions) { + return this.rawClient.deny(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture deny(String id, DenyEntriesRequest request) { + return this.rawClient.deny(id, request).thenApply(response -> response.body()); + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture deny(String id, DenyEntriesRequest request, RequestOptions requestOptions) { + return this.rawClient.deny(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/entries/AsyncRawEntriesClient.java b/src/main/java/com/whop/api/resources/entries/AsyncRawEntriesClient.java new file mode 100644 index 00000000..d01bb0dd --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/AsyncRawEntriesClient.java @@ -0,0 +1,632 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.entries.requests.ApproveEntriesRequest; +import com.whop.api.resources.entries.requests.DenyEntriesRequest; +import com.whop.api.resources.entries.requests.ListEntriesRequest; +import com.whop.api.resources.entries.requests.RetrieveEntriesRequest; +import com.whop.api.resources.entries.types.ApproveEntriesResponse; +import com.whop.api.resources.entries.types.ListEntriesResponse; +import com.whop.api.types.Entry; +import com.whop.api.types.EntryListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawEntriesClient { + protected final ClientOptions clientOptions; + + public AsyncRawEntriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of waitlist entries for a company, with optional filtering by product, plan, status, and creation date. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture>> list(ListEntriesRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of waitlist entries for a company, with optional filtering by product, plan, status, and creation date. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture>> list( + ListEntriesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("entries"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } + if (request.getPlanIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_ids", request.getPlanIds().get(), true); + } + if (request.getStatuses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "statuses", request.getStatuses().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListEntriesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListEntriesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListEntriesRequest nextRequest = ListEntriesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveEntriesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveEntriesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RetrieveEntriesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveEntriesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("entries") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Entry.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public CompletableFuture> approve(String id) { + return approve(id, ApproveEntriesRequest.builder().build()); + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public CompletableFuture> approve( + String id, RequestOptions requestOptions) { + return approve(id, ApproveEntriesRequest.builder().build(), requestOptions); + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public CompletableFuture> approve( + String id, ApproveEntriesRequest request) { + return approve(id, request, null); + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public CompletableFuture> approve( + String id, ApproveEntriesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("entries") + .addPathSegment(id) + .addPathSegments("approve"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApproveEntriesResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> deny(String id) { + return deny(id, DenyEntriesRequest.builder().build()); + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> deny(String id, RequestOptions requestOptions) { + return deny(id, DenyEntriesRequest.builder().build(), requestOptions); + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> deny(String id, DenyEntriesRequest request) { + return deny(id, request, null); + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> deny( + String id, DenyEntriesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("entries") + .addPathSegment(id) + .addPathSegments("deny"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Entry.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/entries/EntriesClient.java b/src/main/java/com/whop/api/resources/entries/EntriesClient.java new file mode 100644 index 00000000..9e27fd3f --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/EntriesClient.java @@ -0,0 +1,201 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.entries.requests.ApproveEntriesRequest; +import com.whop.api.resources.entries.requests.DenyEntriesRequest; +import com.whop.api.resources.entries.requests.ListEntriesRequest; +import com.whop.api.resources.entries.requests.RetrieveEntriesRequest; +import com.whop.api.resources.entries.types.ApproveEntriesResponse; +import com.whop.api.types.Entry; +import com.whop.api.types.EntryListItem; + +public class EntriesClient { + protected final ClientOptions clientOptions; + + private final RawEntriesClient rawClient; + + public EntriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawEntriesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawEntriesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of waitlist entries for a company, with optional filtering by product, plan, status, and creation date. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public SyncPagingIterable list(ListEntriesRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of waitlist entries for a company, with optional filtering by product, plan, status, and creation date. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public SyncPagingIterable list(ListEntriesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public Entry retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public Entry retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public Entry retrieve(String id, RetrieveEntriesRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public Entry retrieve(String id, RetrieveEntriesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public ApproveEntriesResponse approve(String id) { + return this.rawClient.approve(id).body(); + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public ApproveEntriesResponse approve(String id, RequestOptions requestOptions) { + return this.rawClient.approve(id, requestOptions).body(); + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public ApproveEntriesResponse approve(String id, ApproveEntriesRequest request) { + return this.rawClient.approve(id, request).body(); + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public ApproveEntriesResponse approve(String id, ApproveEntriesRequest request, RequestOptions requestOptions) { + return this.rawClient.approve(id, request, requestOptions).body(); + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public Entry deny(String id) { + return this.rawClient.deny(id).body(); + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public Entry deny(String id, RequestOptions requestOptions) { + return this.rawClient.deny(id, requestOptions).body(); + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public Entry deny(String id, DenyEntriesRequest request) { + return this.rawClient.deny(id, request).body(); + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public Entry deny(String id, DenyEntriesRequest request, RequestOptions requestOptions) { + return this.rawClient.deny(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/entries/RawEntriesClient.java b/src/main/java/com/whop/api/resources/entries/RawEntriesClient.java new file mode 100644 index 00000000..79a855d6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/RawEntriesClient.java @@ -0,0 +1,508 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.entries.requests.ApproveEntriesRequest; +import com.whop.api.resources.entries.requests.DenyEntriesRequest; +import com.whop.api.resources.entries.requests.ListEntriesRequest; +import com.whop.api.resources.entries.requests.RetrieveEntriesRequest; +import com.whop.api.resources.entries.types.ApproveEntriesResponse; +import com.whop.api.resources.entries.types.ListEntriesResponse; +import com.whop.api.types.Entry; +import com.whop.api.types.EntryListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawEntriesClient { + protected final ClientOptions clientOptions; + + public RawEntriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of waitlist entries for a company, with optional filtering by product, plan, status, and creation date. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListEntriesRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of waitlist entries for a company, with optional filtering by product, plan, status, and creation date. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListEntriesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("entries"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } + if (request.getPlanIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_ids", request.getPlanIds().get(), true); + } + if (request.getStatuses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "statuses", request.getStatuses().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListEntriesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListEntriesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListEntriesRequest nextRequest = ListEntriesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveEntriesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveEntriesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveEntriesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing waitlist entry. + *

Required permissions:

+ *
    + *
  • plan:waitlist:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveEntriesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("entries") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Entry.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public WhopApiHttpResponse approve(String id) { + return approve(id, ApproveEntriesRequest.builder().build()); + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public WhopApiHttpResponse approve(String id, RequestOptions requestOptions) { + return approve(id, ApproveEntriesRequest.builder().build(), requestOptions); + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public WhopApiHttpResponse approve(String id, ApproveEntriesRequest request) { + return approve(id, request, null); + } + + /** + * Approve a pending waitlist entry, triggering the checkout process to grant the user access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
+ */ + public WhopApiHttpResponse approve( + String id, ApproveEntriesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("entries") + .addPathSegment(id) + .addPathSegments("approve"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApproveEntriesResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse deny(String id) { + return deny(id, DenyEntriesRequest.builder().build()); + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse deny(String id, RequestOptions requestOptions) { + return deny(id, DenyEntriesRequest.builder().build(), requestOptions); + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse deny(String id, DenyEntriesRequest request) { + return deny(id, request, null); + } + + /** + * Deny a pending waitlist entry, preventing the user from gaining access to the plan. + *

Required permissions:

+ *
    + *
  • plan:waitlist:manage
  • + *
  • plan:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse deny(String id, DenyEntriesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("entries") + .addPathSegment(id) + .addPathSegments("deny"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Entry.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/entries/requests/ApproveEntriesRequest.java b/src/main/java/com/whop/api/resources/entries/requests/ApproveEntriesRequest.java new file mode 100644 index 00000000..4df7a57c --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/requests/ApproveEntriesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ApproveEntriesRequest.Builder.class) +public final class ApproveEntriesRequest { + private final Map additionalProperties; + + private ApproveEntriesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ApproveEntriesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ApproveEntriesRequest other) { + return this; + } + + public ApproveEntriesRequest build() { + return new ApproveEntriesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/entries/requests/DenyEntriesRequest.java b/src/main/java/com/whop/api/resources/entries/requests/DenyEntriesRequest.java new file mode 100644 index 00000000..415404fb --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/requests/DenyEntriesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DenyEntriesRequest.Builder.class) +public final class DenyEntriesRequest { + private final Map additionalProperties; + + private DenyEntriesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DenyEntriesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DenyEntriesRequest other) { + return this; + } + + public DenyEntriesRequest build() { + return new DenyEntriesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/entries/requests/ListEntriesRequest.java b/src/main/java/com/whop/api/resources/entries/requests/ListEntriesRequest.java new file mode 100644 index 00000000..9eb0ae12 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/requests/ListEntriesRequest.java @@ -0,0 +1,635 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Direction; +import com.whop.api.types.EntriesSortableColumns; +import com.whop.api.types.EntryStatus; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEntriesRequest.Builder.class) +public final class ListEntriesRequest { + private final Optional> productIds; + + private final Optional> planIds; + + private final Optional> statuses; + + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String companyId; + + private final Optional direction; + + private final Optional order; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Map additionalProperties; + + private ListEntriesRequest( + Optional> productIds, + Optional> planIds, + Optional> statuses, + Optional after, + Optional before, + Optional first, + Optional last, + String companyId, + Optional direction, + Optional order, + Optional createdBefore, + Optional createdAfter, + Map additionalProperties) { + this.productIds = productIds; + this.planIds = planIds; + this.statuses = statuses; + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.direction = direction; + this.order = order; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.additionalProperties = additionalProperties; + } + + /** + * @return Filter entries to only those for specific products. + */ + @JsonProperty("product_ids") + public Optional> getProductIds() { + return productIds; + } + + /** + * @return Filter entries to only those for specific plans. + */ + @JsonProperty("plan_ids") + public Optional> getPlanIds() { + return planIds; + } + + /** + * @return Filter entries by their current status. + */ + @JsonProperty("statuses") + public Optional> getStatuses() { + return statuses; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to list waitlist entries for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Only return entries created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return entries created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEntriesRequest && equalTo((ListEntriesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEntriesRequest other) { + return productIds.equals(other.productIds) + && planIds.equals(other.planIds) + && statuses.equals(other.statuses) + && after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId) + && direction.equals(other.direction) + && order.equals(other.order) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.productIds, + this.planIds, + this.statuses, + this.after, + this.before, + this.first, + this.last, + this.companyId, + this.direction, + this.order, + this.createdBefore, + this.createdAfter); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to list waitlist entries for.

+ */ + _FinalStage companyId(@NotNull String companyId); + + Builder from(ListEntriesRequest other); + } + + public interface _FinalStage { + ListEntriesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Filter entries to only those for specific products.

+ */ + _FinalStage productIds(Optional> productIds); + + _FinalStage productIds(List productIds); + + _FinalStage productIds(String productIds); + + /** + *

Filter entries to only those for specific plans.

+ */ + _FinalStage planIds(Optional> planIds); + + _FinalStage planIds(List planIds); + + _FinalStage planIds(String planIds); + + /** + *

Filter entries by their current status.

+ */ + _FinalStage statuses(Optional> statuses); + + _FinalStage statuses(List statuses); + + _FinalStage statuses(EntryStatus statuses); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + _FinalStage direction(Optional direction); + + _FinalStage direction(Direction direction); + + _FinalStage order(Optional order); + + _FinalStage order(EntriesSortableColumns order); + + /** + *

Only return entries created before this timestamp.

+ */ + _FinalStage createdBefore(Optional createdBefore); + + _FinalStage createdBefore(OffsetDateTime createdBefore); + + /** + *

Only return entries created after this timestamp.

+ */ + _FinalStage createdAfter(Optional createdAfter); + + _FinalStage createdAfter(OffsetDateTime createdAfter); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional> statuses = Optional.empty(); + + private Optional> planIds = Optional.empty(); + + private Optional> productIds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListEntriesRequest other) { + productIds(other.getProductIds()); + planIds(other.getPlanIds()); + statuses(other.getStatuses()); + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + direction(other.getDirection()); + order(other.getOrder()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + return this; + } + + /** + *

The unique identifier of the company to list waitlist entries for.

+ *

The unique identifier of the company to list waitlist entries for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

Only return entries created after this timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only return entries created after this timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public _FinalStage createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + /** + *

Only return entries created before this timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return entries created before this timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public _FinalStage createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + @java.lang.Override + public _FinalStage order(EntriesSortableColumns order) { + this.order = Optional.ofNullable(order); + return this; + } + + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + @java.lang.Override + public _FinalStage direction(Direction direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + @java.lang.Override + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public _FinalStage direction(Optional direction) { + this.direction = direction; + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public _FinalStage statuses(EntryStatus statuses) { + this.statuses = Optional.of(Collections.singletonList(statuses)); + return this; + } + + /** + *

Filter entries by their current status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statuses(List statuses) { + this.statuses = Optional.ofNullable(statuses); + return this; + } + + /** + *

Filter entries by their current status.

+ */ + @java.lang.Override + @JsonSetter(value = "statuses", nulls = Nulls.SKIP) + public _FinalStage statuses(Optional> statuses) { + this.statuses = statuses; + return this; + } + + @java.lang.Override + public _FinalStage planIds(String planIds) { + this.planIds = Optional.of(Collections.singletonList(planIds)); + return this; + } + + /** + *

Filter entries to only those for specific plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planIds(List planIds) { + this.planIds = Optional.ofNullable(planIds); + return this; + } + + /** + *

Filter entries to only those for specific plans.

+ */ + @java.lang.Override + @JsonSetter(value = "plan_ids", nulls = Nulls.SKIP) + public _FinalStage planIds(Optional> planIds) { + this.planIds = planIds; + return this; + } + + @java.lang.Override + public _FinalStage productIds(String productIds) { + this.productIds = Optional.of(Collections.singletonList(productIds)); + return this; + } + + /** + *

Filter entries to only those for specific products.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productIds(List productIds) { + this.productIds = Optional.ofNullable(productIds); + return this; + } + + /** + *

Filter entries to only those for specific products.

+ */ + @java.lang.Override + @JsonSetter(value = "product_ids", nulls = Nulls.SKIP) + public _FinalStage productIds(Optional> productIds) { + this.productIds = productIds; + return this; + } + + @java.lang.Override + public ListEntriesRequest build() { + return new ListEntriesRequest( + productIds, + planIds, + statuses, + after, + before, + first, + last, + companyId, + direction, + order, + createdBefore, + createdAfter, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/entries/requests/RetrieveEntriesRequest.java b/src/main/java/com/whop/api/resources/entries/requests/RetrieveEntriesRequest.java new file mode 100644 index 00000000..dfde9dd0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/requests/RetrieveEntriesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveEntriesRequest.Builder.class) +public final class RetrieveEntriesRequest { + private final Map additionalProperties; + + private RetrieveEntriesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveEntriesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveEntriesRequest other) { + return this; + } + + public RetrieveEntriesRequest build() { + return new RetrieveEntriesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/entries/types/ApproveEntriesResponse.java b/src/main/java/com/whop/api/resources/entries/types/ApproveEntriesResponse.java new file mode 100644 index 00000000..ddaccab0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/types/ApproveEntriesResponse.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ApproveEntriesResponse.Builder.class) +public final class ApproveEntriesResponse { + private final String jobId; + + private final Map additionalProperties; + + private ApproveEntriesResponse(String jobId, Map additionalProperties) { + this.jobId = jobId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the job. + */ + @JsonProperty("job_id") + public String getJobId() { + return jobId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ApproveEntriesResponse && equalTo((ApproveEntriesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ApproveEntriesResponse other) { + return jobId.equals(other.jobId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.jobId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static JobIdStage builder() { + return new Builder(); + } + + public interface JobIdStage { + /** + *

The ID of the job.

+ */ + _FinalStage jobId(@NotNull String jobId); + + Builder from(ApproveEntriesResponse other); + } + + public interface _FinalStage { + ApproveEntriesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements JobIdStage, _FinalStage { + private String jobId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ApproveEntriesResponse other) { + jobId(other.getJobId()); + return this; + } + + /** + *

The ID of the job.

+ *

The ID of the job.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("job_id") + public _FinalStage jobId(@NotNull String jobId) { + this.jobId = Objects.requireNonNull(jobId, "jobId must not be null"); + return this; + } + + @java.lang.Override + public ApproveEntriesResponse build() { + return new ApproveEntriesResponse(jobId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/entries/types/ListEntriesResponse.java b/src/main/java/com/whop/api/resources/entries/types/ListEntriesResponse.java new file mode 100644 index 00000000..e0fddcc7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/types/ListEntriesResponse.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.EntryListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEntriesResponse.Builder.class) +public final class ListEntriesResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListEntriesResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEntriesResponse && equalTo((ListEntriesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEntriesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListEntriesResponse other); + } + + public interface _FinalStage { + ListEntriesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(EntryListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListEntriesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(EntryListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListEntriesResponse build() { + return new ListEntriesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/entries/types/PostEntryApprovedPayload.java b/src/main/java/com/whop/api/resources/entries/types/PostEntryApprovedPayload.java new file mode 100644 index 00000000..2fca6e60 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/types/PostEntryApprovedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Entry; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostEntryApprovedPayload.Builder.class) +public final class PostEntryApprovedPayload { + private final Optional accountId; + + private final PostEntryApprovedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Entry data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostEntryApprovedPayloadType type; + + private final Map additionalProperties; + + private PostEntryApprovedPayload( + Optional accountId, + PostEntryApprovedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Entry data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostEntryApprovedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostEntryApprovedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Entry getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostEntryApprovedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostEntryApprovedPayload && equalTo((PostEntryApprovedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostEntryApprovedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostEntryApprovedPayloadApiVersion apiVersion); + + Builder from(PostEntryApprovedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Entry data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostEntryApprovedPayloadType type); + } + + public interface _FinalStage { + PostEntryApprovedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostEntryApprovedPayloadApiVersion apiVersion; + + private Entry data; + + private String id; + + private OffsetDateTime timestamp; + + private PostEntryApprovedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostEntryApprovedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostEntryApprovedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Entry data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostEntryApprovedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostEntryApprovedPayload build() { + return new PostEntryApprovedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/entries/types/PostEntryApprovedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/entries/types/PostEntryApprovedPayloadApiVersion.java new file mode 100644 index 00000000..c27d72ca --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/types/PostEntryApprovedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostEntryApprovedPayloadApiVersion { + public static final PostEntryApprovedPayloadApiVersion V1 = new PostEntryApprovedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostEntryApprovedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostEntryApprovedPayloadApiVersion + && this.string.equals(((PostEntryApprovedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostEntryApprovedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostEntryApprovedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/entries/types/PostEntryApprovedPayloadType.java b/src/main/java/com/whop/api/resources/entries/types/PostEntryApprovedPayloadType.java new file mode 100644 index 00000000..a5a77b18 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/types/PostEntryApprovedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostEntryApprovedPayloadType { + public static final PostEntryApprovedPayloadType ENTRY_APPROVED = + new PostEntryApprovedPayloadType(Value.ENTRY_APPROVED, "entry.approved"); + + private final Value value; + + private final String string; + + PostEntryApprovedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostEntryApprovedPayloadType + && this.string.equals(((PostEntryApprovedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ENTRY_APPROVED: + return visitor.visitEntryApproved(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostEntryApprovedPayloadType valueOf(String value) { + switch (value) { + case "entry.approved": + return ENTRY_APPROVED; + default: + return new PostEntryApprovedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + ENTRY_APPROVED, + + UNKNOWN + } + + public interface Visitor { + T visitEntryApproved(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/entries/types/PostEntryCreatedPayload.java b/src/main/java/com/whop/api/resources/entries/types/PostEntryCreatedPayload.java new file mode 100644 index 00000000..ffc25367 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/types/PostEntryCreatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Entry; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostEntryCreatedPayload.Builder.class) +public final class PostEntryCreatedPayload { + private final Optional accountId; + + private final PostEntryCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Entry data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostEntryCreatedPayloadType type; + + private final Map additionalProperties; + + private PostEntryCreatedPayload( + Optional accountId, + PostEntryCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Entry data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostEntryCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostEntryCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Entry getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostEntryCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostEntryCreatedPayload && equalTo((PostEntryCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostEntryCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostEntryCreatedPayloadApiVersion apiVersion); + + Builder from(PostEntryCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Entry data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostEntryCreatedPayloadType type); + } + + public interface _FinalStage { + PostEntryCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostEntryCreatedPayloadApiVersion apiVersion; + + private Entry data; + + private String id; + + private OffsetDateTime timestamp; + + private PostEntryCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostEntryCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostEntryCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Entry data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostEntryCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostEntryCreatedPayload build() { + return new PostEntryCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/entries/types/PostEntryCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/entries/types/PostEntryCreatedPayloadApiVersion.java new file mode 100644 index 00000000..27825dc9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/types/PostEntryCreatedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostEntryCreatedPayloadApiVersion { + public static final PostEntryCreatedPayloadApiVersion V1 = new PostEntryCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostEntryCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostEntryCreatedPayloadApiVersion + && this.string.equals(((PostEntryCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostEntryCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostEntryCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/entries/types/PostEntryCreatedPayloadType.java b/src/main/java/com/whop/api/resources/entries/types/PostEntryCreatedPayloadType.java new file mode 100644 index 00000000..b73dd958 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/types/PostEntryCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostEntryCreatedPayloadType { + public static final PostEntryCreatedPayloadType ENTRY_CREATED = + new PostEntryCreatedPayloadType(Value.ENTRY_CREATED, "entry.created"); + + private final Value value; + + private final String string; + + PostEntryCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostEntryCreatedPayloadType + && this.string.equals(((PostEntryCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ENTRY_CREATED: + return visitor.visitEntryCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostEntryCreatedPayloadType valueOf(String value) { + switch (value) { + case "entry.created": + return ENTRY_CREATED; + default: + return new PostEntryCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + ENTRY_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitEntryCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/entries/types/PostEntryDeletedPayload.java b/src/main/java/com/whop/api/resources/entries/types/PostEntryDeletedPayload.java new file mode 100644 index 00000000..6dd5d812 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/types/PostEntryDeletedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Entry; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostEntryDeletedPayload.Builder.class) +public final class PostEntryDeletedPayload { + private final Optional accountId; + + private final PostEntryDeletedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Entry data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostEntryDeletedPayloadType type; + + private final Map additionalProperties; + + private PostEntryDeletedPayload( + Optional accountId, + PostEntryDeletedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Entry data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostEntryDeletedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostEntryDeletedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Entry getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostEntryDeletedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostEntryDeletedPayload && equalTo((PostEntryDeletedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostEntryDeletedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostEntryDeletedPayloadApiVersion apiVersion); + + Builder from(PostEntryDeletedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Entry data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostEntryDeletedPayloadType type); + } + + public interface _FinalStage { + PostEntryDeletedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostEntryDeletedPayloadApiVersion apiVersion; + + private Entry data; + + private String id; + + private OffsetDateTime timestamp; + + private PostEntryDeletedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostEntryDeletedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostEntryDeletedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Entry data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostEntryDeletedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostEntryDeletedPayload build() { + return new PostEntryDeletedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/entries/types/PostEntryDeletedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/entries/types/PostEntryDeletedPayloadApiVersion.java new file mode 100644 index 00000000..6ef7ee11 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/types/PostEntryDeletedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostEntryDeletedPayloadApiVersion { + public static final PostEntryDeletedPayloadApiVersion V1 = new PostEntryDeletedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostEntryDeletedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostEntryDeletedPayloadApiVersion + && this.string.equals(((PostEntryDeletedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostEntryDeletedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostEntryDeletedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/entries/types/PostEntryDeletedPayloadType.java b/src/main/java/com/whop/api/resources/entries/types/PostEntryDeletedPayloadType.java new file mode 100644 index 00000000..2803b988 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/types/PostEntryDeletedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostEntryDeletedPayloadType { + public static final PostEntryDeletedPayloadType ENTRY_DELETED = + new PostEntryDeletedPayloadType(Value.ENTRY_DELETED, "entry.deleted"); + + private final Value value; + + private final String string; + + PostEntryDeletedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostEntryDeletedPayloadType + && this.string.equals(((PostEntryDeletedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ENTRY_DELETED: + return visitor.visitEntryDeleted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostEntryDeletedPayloadType valueOf(String value) { + switch (value) { + case "entry.deleted": + return ENTRY_DELETED; + default: + return new PostEntryDeletedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + ENTRY_DELETED, + + UNKNOWN + } + + public interface Visitor { + T visitEntryDeleted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/entries/types/PostEntryDeniedPayload.java b/src/main/java/com/whop/api/resources/entries/types/PostEntryDeniedPayload.java new file mode 100644 index 00000000..adf3ddd2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/types/PostEntryDeniedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Entry; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostEntryDeniedPayload.Builder.class) +public final class PostEntryDeniedPayload { + private final Optional accountId; + + private final PostEntryDeniedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Entry data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostEntryDeniedPayloadType type; + + private final Map additionalProperties; + + private PostEntryDeniedPayload( + Optional accountId, + PostEntryDeniedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Entry data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostEntryDeniedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostEntryDeniedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Entry getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostEntryDeniedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostEntryDeniedPayload && equalTo((PostEntryDeniedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostEntryDeniedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostEntryDeniedPayloadApiVersion apiVersion); + + Builder from(PostEntryDeniedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Entry data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostEntryDeniedPayloadType type); + } + + public interface _FinalStage { + PostEntryDeniedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostEntryDeniedPayloadApiVersion apiVersion; + + private Entry data; + + private String id; + + private OffsetDateTime timestamp; + + private PostEntryDeniedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostEntryDeniedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostEntryDeniedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Entry data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostEntryDeniedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostEntryDeniedPayload build() { + return new PostEntryDeniedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/entries/types/PostEntryDeniedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/entries/types/PostEntryDeniedPayloadApiVersion.java new file mode 100644 index 00000000..269c6fe3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/types/PostEntryDeniedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostEntryDeniedPayloadApiVersion { + public static final PostEntryDeniedPayloadApiVersion V1 = new PostEntryDeniedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostEntryDeniedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostEntryDeniedPayloadApiVersion + && this.string.equals(((PostEntryDeniedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostEntryDeniedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostEntryDeniedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/entries/types/PostEntryDeniedPayloadType.java b/src/main/java/com/whop/api/resources/entries/types/PostEntryDeniedPayloadType.java new file mode 100644 index 00000000..178e1164 --- /dev/null +++ b/src/main/java/com/whop/api/resources/entries/types/PostEntryDeniedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.entries.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostEntryDeniedPayloadType { + public static final PostEntryDeniedPayloadType ENTRY_DENIED = + new PostEntryDeniedPayloadType(Value.ENTRY_DENIED, "entry.denied"); + + private final Value value; + + private final String string; + + PostEntryDeniedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostEntryDeniedPayloadType + && this.string.equals(((PostEntryDeniedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ENTRY_DENIED: + return visitor.visitEntryDenied(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostEntryDeniedPayloadType valueOf(String value) { + switch (value) { + case "entry.denied": + return ENTRY_DENIED; + default: + return new PostEntryDeniedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + ENTRY_DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitEntryDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/events/AsyncEventsClient.java b/src/main/java/com/whop/api/resources/events/AsyncEventsClient.java new file mode 100644 index 00000000..15195aac --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/AsyncEventsClient.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.events.requests.CreateEventsRequest; +import com.whop.api.resources.events.requests.ListEventsRequest; +import com.whop.api.resources.events.requests.PulseEventsRequest; +import com.whop.api.resources.events.requests.ValidatePixelEventsRequest; +import com.whop.api.resources.events.types.CreateEventsResponse; +import com.whop.api.resources.events.types.ListEventsResponseDataItem; +import com.whop.api.resources.events.types.PulseEventsResponseDataItem; +import com.whop.api.types.PixelValidation; +import java.util.concurrent.CompletableFuture; + +public class AsyncEventsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawEventsClient rawClient; + + public AsyncEventsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawEventsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawEventsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public CompletableFuture> list(ListEventsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public CompletableFuture> list( + ListEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Tracks a conversion or engagement event for an account. + */ + public CompletableFuture create(CreateEventsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Tracks a conversion or engagement event for an account. + */ + public CompletableFuture create(CreateEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public CompletableFuture> pulse() { + return this.rawClient.pulse().thenApply(response -> response.body()); + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public CompletableFuture> pulse(RequestOptions requestOptions) { + return this.rawClient.pulse(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public CompletableFuture> pulse(PulseEventsRequest request) { + return this.rawClient.pulse(request).thenApply(response -> response.body()); + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public CompletableFuture> pulse( + PulseEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.pulse(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public CompletableFuture validatePixel() { + return this.rawClient.validatePixel().thenApply(response -> response.body()); + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public CompletableFuture validatePixel(RequestOptions requestOptions) { + return this.rawClient.validatePixel(requestOptions).thenApply(response -> response.body()); + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public CompletableFuture validatePixel(ValidatePixelEventsRequest request) { + return this.rawClient.validatePixel(request).thenApply(response -> response.body()); + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public CompletableFuture validatePixel( + ValidatePixelEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.validatePixel(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/events/AsyncRawEventsClient.java b/src/main/java/com/whop/api/resources/events/AsyncRawEventsClient.java new file mode 100644 index 00000000..d4156345 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/AsyncRawEventsClient.java @@ -0,0 +1,540 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.events.requests.CreateEventsRequest; +import com.whop.api.resources.events.requests.ListEventsRequest; +import com.whop.api.resources.events.requests.PulseEventsRequest; +import com.whop.api.resources.events.requests.ValidatePixelEventsRequest; +import com.whop.api.resources.events.types.CreateEventsResponse; +import com.whop.api.resources.events.types.ListEventsResponse; +import com.whop.api.resources.events.types.ListEventsResponseDataItem; +import com.whop.api.resources.events.types.PulseEventsResponse; +import com.whop.api.resources.events.types.PulseEventsResponseDataItem; +import com.whop.api.types.PixelValidation; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawEventsClient { + protected final ClientOptions clientOptions; + + public AsyncRawEventsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public CompletableFuture>> list() { + return list(ListEventsRequest.builder().build()); + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListEventsRequest.builder().build(), requestOptions); + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public CompletableFuture>> list( + ListEventsRequest request) { + return list(request, null); + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public CompletableFuture>> list( + ListEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("events"); + if (request.getIdentifier().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "identifier", request.getIdentifier().get(), false); + } + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().get(), false); + } + if (request.getTo().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "to", request.getTo().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getEvent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event", request.getEvent().get(), false); + } + if (request.getSource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "source", request.getSource().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (request.getCountry().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "country", request.getCountry().get(), false); + } + if (request.getCity().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "city", request.getCity().get(), false); + } + if (request.getDevice().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "device", request.getDevice().get(), false); + } + if (request.getBrowser().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "browser", request.getBrowser().get(), false); + } + if (request.getOs().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "os", request.getOs().get(), false); + } + if (request.getUtmSource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utm_source", request.getUtmSource().get(), false); + } + if (request.getHostname().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "hostname", request.getHostname().get(), false); + } + if (request.getPage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "page", request.getPage().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListEventsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListEventsResponse.class); + String startingAfter = + parsedResponse.getPageInfo().getEndCursor().orElse(null); + ListEventsRequest nextRequest = ListEventsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + !startingAfter.isEmpty(), result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Tracks a conversion or engagement event for an account. + */ + public CompletableFuture> create(CreateEventsRequest request) { + return create(request, null); + } + + /** + * Tracks a conversion or engagement event for an account. + */ + public CompletableFuture> create( + CreateEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("events"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateEventsResponse.class), + response)); + return; + } + try { + if (response.code() == 409) { + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public CompletableFuture>> pulse() { + return pulse(PulseEventsRequest.builder().build()); + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public CompletableFuture>> pulse( + RequestOptions requestOptions) { + return pulse(PulseEventsRequest.builder().build(), requestOptions); + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public CompletableFuture>> pulse( + PulseEventsRequest request) { + return pulse(request, null); + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public CompletableFuture>> pulse( + PulseEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("events/pulse"); + if (request.getEvent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event", request.getEvent().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + PulseEventsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PulseEventsResponse.class); + String startingAfter = + parsedResponse.getPageInfo().getEndCursor().orElse(null); + PulseEventsRequest nextRequest = PulseEventsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + !startingAfter.isEmpty(), result, parsedResponse, () -> { + try { + return pulse(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public CompletableFuture> validatePixel() { + return validatePixel(ValidatePixelEventsRequest.builder().build()); + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public CompletableFuture> validatePixel(RequestOptions requestOptions) { + return validatePixel(ValidatePixelEventsRequest.builder().build(), requestOptions); + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public CompletableFuture> validatePixel(ValidatePixelEventsRequest request) { + return validatePixel(request, null); + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public CompletableFuture> validatePixel( + ValidatePixelEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("events/validate_pixel"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PixelValidation.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/events/EventsClient.java b/src/main/java/com/whop/api/resources/events/EventsClient.java new file mode 100644 index 00000000..51a46c8e --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/EventsClient.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.events.requests.CreateEventsRequest; +import com.whop.api.resources.events.requests.ListEventsRequest; +import com.whop.api.resources.events.requests.PulseEventsRequest; +import com.whop.api.resources.events.requests.ValidatePixelEventsRequest; +import com.whop.api.resources.events.types.CreateEventsResponse; +import com.whop.api.resources.events.types.ListEventsResponseDataItem; +import com.whop.api.resources.events.types.PulseEventsResponseDataItem; +import com.whop.api.types.PixelValidation; + +public class EventsClient { + protected final ClientOptions clientOptions; + + private final RawEventsClient rawClient; + + public EventsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawEventsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawEventsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public SyncPagingIterable list(ListEventsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public SyncPagingIterable list( + ListEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Tracks a conversion or engagement event for an account. + */ + public CreateEventsResponse create(CreateEventsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Tracks a conversion or engagement event for an account. + */ + public CreateEventsResponse create(CreateEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public SyncPagingIterable pulse() { + return this.rawClient.pulse().body(); + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public SyncPagingIterable pulse(RequestOptions requestOptions) { + return this.rawClient.pulse(requestOptions).body(); + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public SyncPagingIterable pulse(PulseEventsRequest request) { + return this.rawClient.pulse(request).body(); + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public SyncPagingIterable pulse( + PulseEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.pulse(request, requestOptions).body(); + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public PixelValidation validatePixel() { + return this.rawClient.validatePixel().body(); + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public PixelValidation validatePixel(RequestOptions requestOptions) { + return this.rawClient.validatePixel(requestOptions).body(); + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public PixelValidation validatePixel(ValidatePixelEventsRequest request) { + return this.rawClient.validatePixel(request).body(); + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public PixelValidation validatePixel(ValidatePixelEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.validatePixel(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/events/RawEventsClient.java b/src/main/java/com/whop/api/resources/events/RawEventsClient.java new file mode 100644 index 00000000..7851195f --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/RawEventsClient.java @@ -0,0 +1,449 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.events.requests.CreateEventsRequest; +import com.whop.api.resources.events.requests.ListEventsRequest; +import com.whop.api.resources.events.requests.PulseEventsRequest; +import com.whop.api.resources.events.requests.ValidatePixelEventsRequest; +import com.whop.api.resources.events.types.CreateEventsResponse; +import com.whop.api.resources.events.types.ListEventsResponse; +import com.whop.api.resources.events.types.ListEventsResponseDataItem; +import com.whop.api.resources.events.types.PulseEventsResponse; +import com.whop.api.resources.events.types.PulseEventsResponseDataItem; +import com.whop.api.types.PixelValidation; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawEventsClient { + protected final ClientOptions clientOptions; + + public RawEventsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public WhopApiHttpResponse> list() { + return list(ListEventsRequest.builder().build()); + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListEventsRequest.builder().build(), requestOptions); + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public WhopApiHttpResponse> list(ListEventsRequest request) { + return list(request, null); + } + + /** + * Lists identity-linked events, most recent first by default. Pass identifier for one person's journey, or omit it to list events for an account within an explicit time range. Pass direction=asc to read a journey forwards from where it starts. Events are shaped like the POST /events intake: attribution in context, identity in user. + */ + public WhopApiHttpResponse> list( + ListEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("events"); + if (request.getIdentifier().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "identifier", request.getIdentifier().get(), false); + } + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().get(), false); + } + if (request.getTo().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "to", request.getTo().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getEvent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event", request.getEvent().get(), false); + } + if (request.getSource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "source", request.getSource().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (request.getCountry().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "country", request.getCountry().get(), false); + } + if (request.getCity().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "city", request.getCity().get(), false); + } + if (request.getDevice().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "device", request.getDevice().get(), false); + } + if (request.getBrowser().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "browser", request.getBrowser().get(), false); + } + if (request.getOs().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "os", request.getOs().get(), false); + } + if (request.getUtmSource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utm_source", request.getUtmSource().get(), false); + } + if (request.getHostname().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "hostname", request.getHostname().get(), false); + } + if (request.getPage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "page", request.getPage().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListEventsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListEventsResponse.class); + String startingAfter = + parsedResponse.getPageInfo().getEndCursor().orElse(null); + ListEventsRequest nextRequest = ListEventsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + !startingAfter.isEmpty(), result, parsedResponse, () -> list( + nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Tracks a conversion or engagement event for an account. + */ + public WhopApiHttpResponse create(CreateEventsRequest request) { + return create(request, null); + } + + /** + * Tracks a conversion or engagement event for an account. + */ + public WhopApiHttpResponse create( + CreateEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("events"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateEventsResponse.class), response); + } + try { + if (response.code() == 409) { + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public WhopApiHttpResponse> pulse() { + return pulse(PulseEventsRequest.builder().build()); + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public WhopApiHttpResponse> pulse(RequestOptions requestOptions) { + return pulse(PulseEventsRequest.builder().build(), requestOptions); + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public WhopApiHttpResponse> pulse(PulseEventsRequest request) { + return pulse(request, null); + } + + /** + * Returns a fully anonymized feed of recent platform-wide money movement, most recent first: purchases, affiliate commissions, card and ad spend, app revenue, off-platform sales, wallet deposits, card loads, claimed drops, transfers between accounts, and referral bonuses. Items carry only a type, the underlying event name, a USD amount, a coarse location under user, and a timestamp coarsened to the start of the minute; missing fields are omitted, not nulled. The payload is identical for every caller; no auth is required. + */ + public WhopApiHttpResponse> pulse( + PulseEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("events/pulse"); + if (request.getEvent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event", request.getEvent().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + PulseEventsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PulseEventsResponse.class); + String startingAfter = + parsedResponse.getPageInfo().getEndCursor().orElse(null); + PulseEventsRequest nextRequest = PulseEventsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + !startingAfter.isEmpty(), result, parsedResponse, () -> pulse( + nextRequest, requestOptions) + .body()), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public WhopApiHttpResponse validatePixel() { + return validatePixel(ValidatePixelEventsRequest.builder().build()); + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public WhopApiHttpResponse validatePixel(RequestOptions requestOptions) { + return validatePixel(ValidatePixelEventsRequest.builder().build(), requestOptions); + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public WhopApiHttpResponse validatePixel(ValidatePixelEventsRequest request) { + return validatePixel(request, null); + } + + /** + * Checks whether the Whop pixel is installed for an account. Recent pixel events count as proof on their own, so an account that has sent data lately comes back installed without a url. Pass a url and events from that page settle it; conversion events are also read across the hostname because they commonly fire on a later confirmation page. If the requested page hasn't sent any events lately, it is fetched and read for the pixel and conversion events wired on it. installed is only true when the pixel was actually seen — in the account's events or in the page. + */ + public WhopApiHttpResponse validatePixel( + ValidatePixelEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("events/validate_pixel"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PixelValidation.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/requests/CreateEventsRequest.java b/src/main/java/com/whop/api/resources/events/requests/CreateEventsRequest.java new file mode 100644 index 00000000..c071fee2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/requests/CreateEventsRequest.java @@ -0,0 +1,1337 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.events.types.CreateEventsRequestActionSource; +import com.whop.api.resources.events.types.CreateEventsRequestContext; +import com.whop.api.resources.events.types.CreateEventsRequestCurrency; +import com.whop.api.resources.events.types.CreateEventsRequestUser; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateEventsRequest.Builder.class) +public final class CreateEventsRequest { + private final String accountId; + + private final Optional actionSource; + + private final Optional context; + + private final Optional currency; + + private final Optional customName; + + private final Optional duration; + + private final Optional eventId; + + private final String eventName; + + private final Optional eventTime; + + private final Optional planId; + + private final Optional productId; + + private final Optional referrerUrl; + + private final Optional resumed; + + private final Optional source; + + private final Optional title; + + private final Optional url; + + private final Optional user; + + private final Optional value; + + private final Map additionalProperties; + + private CreateEventsRequest( + String accountId, + Optional actionSource, + Optional context, + Optional currency, + Optional customName, + Optional duration, + Optional eventId, + String eventName, + Optional eventTime, + Optional planId, + Optional productId, + Optional referrerUrl, + Optional resumed, + Optional source, + Optional title, + Optional url, + Optional user, + Optional value, + Map additionalProperties) { + this.accountId = accountId; + this.actionSource = actionSource; + this.context = context; + this.currency = currency; + this.customName = customName; + this.duration = duration; + this.eventId = eventId; + this.eventName = eventName; + this.eventTime = eventTime; + this.planId = planId; + this.productId = productId; + this.referrerUrl = referrerUrl; + this.resumed = resumed; + this.source = source; + this.title = title; + this.url = url; + this.user = user; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account to associate with this event. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Where the event originated. + */ + @JsonIgnore + public Optional getActionSource() { + if (actionSource == null) { + return Optional.empty(); + } + return actionSource; + } + + /** + * @return Tracking and attribution context. + */ + @JsonIgnore + public Optional getContext() { + if (context == null) { + return Optional.empty(); + } + return context; + } + + /** + * @return ISO 4217 currency code. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return Custom event name when event_name is 'custom'. Maximum 35 chars for this value. + */ + @JsonIgnore + public Optional getCustomName() { + if (customName == null) { + return Optional.empty(); + } + return customName; + } + + /** + * @return For 'leave' events: milliseconds the visitor spent on the page. + */ + @JsonIgnore + public Optional getDuration() { + if (duration == null) { + return Optional.empty(); + } + return duration; + } + + /** + * @return Client-provided identifier for deduplication. Generated if omitted. + */ + @JsonIgnore + public Optional getEventId() { + if (eventId == null) { + return Optional.empty(); + } + return eventId; + } + + /** + * @return The type of event. + *

Use a standard event (lead, submit_application, contact, complete_registration, schedule, view_content, add_to_cart) or pass your own name directly for a custom event.

+ */ + @JsonProperty("event_name") + public String getEventName() { + return eventName; + } + + /** + * @return When the event occurred. Defaults to now. + */ + @JsonIgnore + public Optional getEventTime() { + if (eventTime == null) { + return Optional.empty(); + } + return eventTime; + } + + /** + * @return The plan associated with the event. + */ + @JsonIgnore + public Optional getPlanId() { + if (planId == null) { + return Optional.empty(); + } + return planId; + } + + /** + * @return The product associated with the event. + */ + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + /** + * @return The referring URL. + */ + @JsonIgnore + public Optional getReferrerUrl() { + if (referrerUrl == null) { + return Optional.empty(); + } + return referrerUrl; + } + + /** + * @return For 'page' events: true when the page was restored from the back/forward cache. + */ + @JsonIgnore + public Optional getResumed() { + if (resumed == null) { + return Optional.empty(); + } + return resumed; + } + + /** + * @return For 'identify' events: where the identity was captured (url, form, manual, iframe). + */ + @JsonIgnore + public Optional getSource() { + if (source == null) { + return Optional.empty(); + } + return source; + } + + /** + * @return For 'page' events: the document title. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The URL where the event occurred. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + /** + * @return User identity and profile data. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + /** + * @return Monetary value associated with the event. + */ + @JsonIgnore + public Optional getValue() { + if (value == null) { + return Optional.empty(); + } + return value; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("action_source") + private Optional _getActionSource() { + return actionSource; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("context") + private Optional _getContext() { + return context; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_name") + private Optional _getCustomName() { + return customName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("duration") + private Optional _getDuration() { + return duration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("event_id") + private Optional _getEventId() { + return eventId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("event_time") + private Optional _getEventTime() { + return eventTime; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan_id") + private Optional _getPlanId() { + return planId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("referrer_url") + private Optional _getReferrerUrl() { + return referrerUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resumed") + private Optional _getResumed() { + return resumed; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source") + private Optional _getSource() { + return source; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("value") + private Optional _getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateEventsRequest && equalTo((CreateEventsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateEventsRequest other) { + return accountId.equals(other.accountId) + && actionSource.equals(other.actionSource) + && context.equals(other.context) + && currency.equals(other.currency) + && customName.equals(other.customName) + && duration.equals(other.duration) + && eventId.equals(other.eventId) + && eventName.equals(other.eventName) + && eventTime.equals(other.eventTime) + && planId.equals(other.planId) + && productId.equals(other.productId) + && referrerUrl.equals(other.referrerUrl) + && resumed.equals(other.resumed) + && source.equals(other.source) + && title.equals(other.title) + && url.equals(other.url) + && user.equals(other.user) + && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.actionSource, + this.context, + this.currency, + this.customName, + this.duration, + this.eventId, + this.eventName, + this.eventTime, + this.planId, + this.productId, + this.referrerUrl, + this.resumed, + this.source, + this.title, + this.url, + this.user, + this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

The account to associate with this event.

+ */ + EventNameStage accountId(@NotNull String accountId); + + Builder from(CreateEventsRequest other); + } + + public interface EventNameStage { + /** + *

The type of event.

+ *

Use a standard event (lead, submit_application, contact, complete_registration, schedule, view_content, add_to_cart) or pass your own name directly for a custom event.

+ */ + _FinalStage eventName(@NotNull String eventName); + } + + public interface _FinalStage { + CreateEventsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Where the event originated.

+ */ + _FinalStage actionSource(Optional actionSource); + + _FinalStage actionSource(CreateEventsRequestActionSource actionSource); + + _FinalStage actionSource(Nullable actionSource); + + /** + *

Tracking and attribution context.

+ */ + _FinalStage context(Optional context); + + _FinalStage context(CreateEventsRequestContext context); + + _FinalStage context(Nullable context); + + /** + *

ISO 4217 currency code.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(CreateEventsRequestCurrency currency); + + _FinalStage currency(Nullable currency); + + /** + *

Custom event name when event_name is 'custom'. Maximum 35 chars for this value.

+ */ + _FinalStage customName(Optional customName); + + _FinalStage customName(String customName); + + _FinalStage customName(Nullable customName); + + /** + *

For 'leave' events: milliseconds the visitor spent on the page.

+ */ + _FinalStage duration(Optional duration); + + _FinalStage duration(Integer duration); + + _FinalStage duration(Nullable duration); + + /** + *

Client-provided identifier for deduplication. Generated if omitted.

+ */ + _FinalStage eventId(Optional eventId); + + _FinalStage eventId(String eventId); + + _FinalStage eventId(Nullable eventId); + + /** + *

When the event occurred. Defaults to now.

+ */ + _FinalStage eventTime(Optional eventTime); + + _FinalStage eventTime(OffsetDateTime eventTime); + + _FinalStage eventTime(Nullable eventTime); + + /** + *

The plan associated with the event.

+ */ + _FinalStage planId(Optional planId); + + _FinalStage planId(String planId); + + _FinalStage planId(Nullable planId); + + /** + *

The product associated with the event.

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + + _FinalStage productId(Nullable productId); + + /** + *

The referring URL.

+ */ + _FinalStage referrerUrl(Optional referrerUrl); + + _FinalStage referrerUrl(String referrerUrl); + + _FinalStage referrerUrl(Nullable referrerUrl); + + /** + *

For 'page' events: true when the page was restored from the back/forward cache.

+ */ + _FinalStage resumed(Optional resumed); + + _FinalStage resumed(Boolean resumed); + + _FinalStage resumed(Nullable resumed); + + /** + *

For 'identify' events: where the identity was captured (url, form, manual, iframe).

+ */ + _FinalStage source(Optional source); + + _FinalStage source(String source); + + _FinalStage source(Nullable source); + + /** + *

For 'page' events: the document title.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + + /** + *

The URL where the event occurred.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + + /** + *

User identity and profile data.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(CreateEventsRequestUser user); + + _FinalStage user(Nullable user); + + /** + *

Monetary value associated with the event.

+ */ + _FinalStage value(Optional value); + + _FinalStage value(Double value); + + _FinalStage value(Nullable value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, EventNameStage, _FinalStage { + private String accountId; + + private String eventName; + + private Optional value = Optional.empty(); + + private Optional user = Optional.empty(); + + private Optional url = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional source = Optional.empty(); + + private Optional resumed = Optional.empty(); + + private Optional referrerUrl = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional planId = Optional.empty(); + + private Optional eventTime = Optional.empty(); + + private Optional eventId = Optional.empty(); + + private Optional duration = Optional.empty(); + + private Optional customName = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional context = Optional.empty(); + + private Optional actionSource = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateEventsRequest other) { + accountId(other.getAccountId()); + actionSource(other.getActionSource()); + context(other.getContext()); + currency(other.getCurrency()); + customName(other.getCustomName()); + duration(other.getDuration()); + eventId(other.getEventId()); + eventName(other.getEventName()); + eventTime(other.getEventTime()); + planId(other.getPlanId()); + productId(other.getProductId()); + referrerUrl(other.getReferrerUrl()); + resumed(other.getResumed()); + source(other.getSource()); + title(other.getTitle()); + url(other.getUrl()); + user(other.getUser()); + value(other.getValue()); + return this; + } + + /** + *

The account to associate with this event.

+ *

The account to associate with this event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public EventNameStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

The type of event.

+ *

Use a standard event (lead, submit_application, contact, complete_registration, schedule, view_content, add_to_cart) or pass your own name directly for a custom event.

+ *

The type of event.

+ *

Use a standard event (lead, submit_application, contact, complete_registration, schedule, view_content, add_to_cart) or pass your own name directly for a custom event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("event_name") + public _FinalStage eventName(@NotNull String eventName) { + this.eventName = Objects.requireNonNull(eventName, "eventName must not be null"); + return this; + } + + /** + *

Monetary value associated with the event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage value(Nullable value) { + if (value.isNull()) { + this.value = null; + } else if (value.isEmpty()) { + this.value = Optional.empty(); + } else { + this.value = Optional.of(value.get()); + } + return this; + } + + /** + *

Monetary value associated with the event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage value(Double value) { + this.value = Optional.ofNullable(value); + return this; + } + + /** + *

Monetary value associated with the event.

+ */ + @java.lang.Override + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public _FinalStage value(Optional value) { + this.value = value; + return this; + } + + /** + *

User identity and profile data.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

User identity and profile data.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(CreateEventsRequestUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

User identity and profile data.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + /** + *

The URL where the event occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

The URL where the event occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

The URL where the event occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

For 'page' events: the document title.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

For 'page' events: the document title.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

For 'page' events: the document title.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

For 'identify' events: where the identity was captured (url, form, manual, iframe).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(Nullable source) { + if (source.isNull()) { + this.source = null; + } else if (source.isEmpty()) { + this.source = Optional.empty(); + } else { + this.source = Optional.of(source.get()); + } + return this; + } + + /** + *

For 'identify' events: where the identity was captured (url, form, manual, iframe).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(String source) { + this.source = Optional.ofNullable(source); + return this; + } + + /** + *

For 'identify' events: where the identity was captured (url, form, manual, iframe).

+ */ + @java.lang.Override + @JsonSetter(value = "source", nulls = Nulls.SKIP) + public _FinalStage source(Optional source) { + this.source = source; + return this; + } + + /** + *

For 'page' events: true when the page was restored from the back/forward cache.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resumed(Nullable resumed) { + if (resumed.isNull()) { + this.resumed = null; + } else if (resumed.isEmpty()) { + this.resumed = Optional.empty(); + } else { + this.resumed = Optional.of(resumed.get()); + } + return this; + } + + /** + *

For 'page' events: true when the page was restored from the back/forward cache.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resumed(Boolean resumed) { + this.resumed = Optional.ofNullable(resumed); + return this; + } + + /** + *

For 'page' events: true when the page was restored from the back/forward cache.

+ */ + @java.lang.Override + @JsonSetter(value = "resumed", nulls = Nulls.SKIP) + public _FinalStage resumed(Optional resumed) { + this.resumed = resumed; + return this; + } + + /** + *

The referring URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referrerUrl(Nullable referrerUrl) { + if (referrerUrl.isNull()) { + this.referrerUrl = null; + } else if (referrerUrl.isEmpty()) { + this.referrerUrl = Optional.empty(); + } else { + this.referrerUrl = Optional.of(referrerUrl.get()); + } + return this; + } + + /** + *

The referring URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referrerUrl(String referrerUrl) { + this.referrerUrl = Optional.ofNullable(referrerUrl); + return this; + } + + /** + *

The referring URL.

+ */ + @java.lang.Override + @JsonSetter(value = "referrer_url", nulls = Nulls.SKIP) + public _FinalStage referrerUrl(Optional referrerUrl) { + this.referrerUrl = referrerUrl; + return this; + } + + /** + *

The product associated with the event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + /** + *

The product associated with the event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

The product associated with the event.

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

The plan associated with the event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planId(Nullable planId) { + if (planId.isNull()) { + this.planId = null; + } else if (planId.isEmpty()) { + this.planId = Optional.empty(); + } else { + this.planId = Optional.of(planId.get()); + } + return this; + } + + /** + *

The plan associated with the event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planId(String planId) { + this.planId = Optional.ofNullable(planId); + return this; + } + + /** + *

The plan associated with the event.

+ */ + @java.lang.Override + @JsonSetter(value = "plan_id", nulls = Nulls.SKIP) + public _FinalStage planId(Optional planId) { + this.planId = planId; + return this; + } + + /** + *

When the event occurred. Defaults to now.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage eventTime(Nullable eventTime) { + if (eventTime.isNull()) { + this.eventTime = null; + } else if (eventTime.isEmpty()) { + this.eventTime = Optional.empty(); + } else { + this.eventTime = Optional.of(eventTime.get()); + } + return this; + } + + /** + *

When the event occurred. Defaults to now.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage eventTime(OffsetDateTime eventTime) { + this.eventTime = Optional.ofNullable(eventTime); + return this; + } + + /** + *

When the event occurred. Defaults to now.

+ */ + @java.lang.Override + @JsonSetter(value = "event_time", nulls = Nulls.SKIP) + public _FinalStage eventTime(Optional eventTime) { + this.eventTime = eventTime; + return this; + } + + /** + *

Client-provided identifier for deduplication. Generated if omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage eventId(Nullable eventId) { + if (eventId.isNull()) { + this.eventId = null; + } else if (eventId.isEmpty()) { + this.eventId = Optional.empty(); + } else { + this.eventId = Optional.of(eventId.get()); + } + return this; + } + + /** + *

Client-provided identifier for deduplication. Generated if omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage eventId(String eventId) { + this.eventId = Optional.ofNullable(eventId); + return this; + } + + /** + *

Client-provided identifier for deduplication. Generated if omitted.

+ */ + @java.lang.Override + @JsonSetter(value = "event_id", nulls = Nulls.SKIP) + public _FinalStage eventId(Optional eventId) { + this.eventId = eventId; + return this; + } + + /** + *

For 'leave' events: milliseconds the visitor spent on the page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage duration(Nullable duration) { + if (duration.isNull()) { + this.duration = null; + } else if (duration.isEmpty()) { + this.duration = Optional.empty(); + } else { + this.duration = Optional.of(duration.get()); + } + return this; + } + + /** + *

For 'leave' events: milliseconds the visitor spent on the page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage duration(Integer duration) { + this.duration = Optional.ofNullable(duration); + return this; + } + + /** + *

For 'leave' events: milliseconds the visitor spent on the page.

+ */ + @java.lang.Override + @JsonSetter(value = "duration", nulls = Nulls.SKIP) + public _FinalStage duration(Optional duration) { + this.duration = duration; + return this; + } + + /** + *

Custom event name when event_name is 'custom'. Maximum 35 chars for this value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customName(Nullable customName) { + if (customName.isNull()) { + this.customName = null; + } else if (customName.isEmpty()) { + this.customName = Optional.empty(); + } else { + this.customName = Optional.of(customName.get()); + } + return this; + } + + /** + *

Custom event name when event_name is 'custom'. Maximum 35 chars for this value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customName(String customName) { + this.customName = Optional.ofNullable(customName); + return this; + } + + /** + *

Custom event name when event_name is 'custom'. Maximum 35 chars for this value.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_name", nulls = Nulls.SKIP) + public _FinalStage customName(Optional customName) { + this.customName = customName; + return this; + } + + /** + *

ISO 4217 currency code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

ISO 4217 currency code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(CreateEventsRequestCurrency currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

ISO 4217 currency code.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + /** + *

Tracking and attribution context.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage context(Nullable context) { + if (context.isNull()) { + this.context = null; + } else if (context.isEmpty()) { + this.context = Optional.empty(); + } else { + this.context = Optional.of(context.get()); + } + return this; + } + + /** + *

Tracking and attribution context.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage context(CreateEventsRequestContext context) { + this.context = Optional.ofNullable(context); + return this; + } + + /** + *

Tracking and attribution context.

+ */ + @java.lang.Override + @JsonSetter(value = "context", nulls = Nulls.SKIP) + public _FinalStage context(Optional context) { + this.context = context; + return this; + } + + /** + *

Where the event originated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage actionSource(Nullable actionSource) { + if (actionSource.isNull()) { + this.actionSource = null; + } else if (actionSource.isEmpty()) { + this.actionSource = Optional.empty(); + } else { + this.actionSource = Optional.of(actionSource.get()); + } + return this; + } + + /** + *

Where the event originated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage actionSource(CreateEventsRequestActionSource actionSource) { + this.actionSource = Optional.ofNullable(actionSource); + return this; + } + + /** + *

Where the event originated.

+ */ + @java.lang.Override + @JsonSetter(value = "action_source", nulls = Nulls.SKIP) + public _FinalStage actionSource(Optional actionSource) { + this.actionSource = actionSource; + return this; + } + + @java.lang.Override + public CreateEventsRequest build() { + return new CreateEventsRequest( + accountId, + actionSource, + context, + currency, + customName, + duration, + eventId, + eventName, + eventTime, + planId, + productId, + referrerUrl, + resumed, + source, + title, + url, + user, + value, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/requests/ListEventsRequest.java b/src/main/java/com/whop/api/resources/events/requests/ListEventsRequest.java new file mode 100644 index 00000000..de91c6cc --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/requests/ListEventsRequest.java @@ -0,0 +1,695 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.events.types.ListEventsRequestAttributionModel; +import com.whop.api.resources.events.types.ListEventsRequestDirection; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsRequest.Builder.class) +public final class ListEventsRequest { + private final Optional identifier; + + private final Optional accountId; + + private final Optional from; + + private final Optional to; + + private final Optional first; + + private final Optional after; + + private final Optional before; + + private final Optional direction; + + private final Optional event; + + private final Optional source; + + private final Optional attributionModel; + + private final Optional country; + + private final Optional city; + + private final Optional device; + + private final Optional browser; + + private final Optional os; + + private final Optional utmSource; + + private final Optional hostname; + + private final Optional page; + + private final Map additionalProperties; + + private ListEventsRequest( + Optional identifier, + Optional accountId, + Optional from, + Optional to, + Optional first, + Optional after, + Optional before, + Optional direction, + Optional event, + Optional source, + Optional attributionModel, + Optional country, + Optional city, + Optional device, + Optional browser, + Optional os, + Optional utmSource, + Optional hostname, + Optional page, + Map additionalProperties) { + this.identifier = identifier; + this.accountId = accountId; + this.from = from; + this.to = to; + this.first = first; + this.after = after; + this.before = before; + this.direction = direction; + this.event = event; + this.source = source; + this.attributionModel = attributionModel; + this.country = country; + this.city = city; + this.device = device; + this.browser = browser; + this.os = os; + this.utmSource = utmSource; + this.hostname = hostname; + this.page = page; + this.additionalProperties = additionalProperties; + } + + /** + * @return Any hard identifier of the person: a person ID (prsn_*), user ID, email, phone number, or a tracking cookie value (wuid, anonymous ID, fbp/fbc/ttp/ga). Omit to list recent events for the account. + */ + @JsonProperty("identifier") + public Optional getIdentifier() { + return identifier; + } + + /** + * @return Account ID, prefixed biz_. Optional for account API keys; required for credentials that can access multiple accounts. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Start of the time range as an ISO 8601 timestamp. Required when identifier is omitted. + */ + @JsonProperty("from") + public Optional getFrom() { + return from; + } + + /** + * @return End of the time range as an ISO 8601 timestamp. Required when identifier is omitted; otherwise defaults to now. + */ + @JsonProperty("to") + public Optional getTo() { + return to; + } + + /** + * @return The number of events to return. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor for fetching events after a previous page. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return A cursor for fetching events before a later page. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The order events are returned in by time. Defaults to desc (most recent first); asc reads a journey forwards from where it starts. after and before always page forwards and backwards through that order. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Full event names to filter by, comma-separated (payment.completed, pixel.lead, pixel.page, pixel.custom:<name>) — the same vocabulary the events / people metrics use. + */ + @JsonProperty("event") + public Optional getEvent() { + return event; + } + + /** + * @return Canonical source path, exact or with a trailing :* prefix (whop:<campaign>:, ext:meta:, referrer:<domain>, direct). Restricts the list to conversion targets attributed to that source — the debuggability twin of a metric cell's source parameter. + */ + @JsonProperty("source") + public Optional getSource() { + return source; + } + + /** + * @return Attribution model for the source filter (defaults to last_touch). + */ + @JsonProperty("attribution_model") + public Optional getAttributionModel() { + return attributionModel; + } + + /** + * @return Country codes to filter by, comma-separated. + */ + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + /** + * @return Cities to filter by, comma-separated. + */ + @JsonProperty("city") + public Optional getCity() { + return city; + } + + /** + * @return Device families to filter by, comma-separated (e.g. iPhone, Mac). + */ + @JsonProperty("device") + public Optional getDevice() { + return device; + } + + /** + * @return Browser families to filter by, comma-separated (e.g. Chrome, Mobile Safari). + */ + @JsonProperty("browser") + public Optional getBrowser() { + return browser; + } + + /** + * @return Operating system families to filter by, comma-separated (e.g. iOS, Windows). + */ + @JsonProperty("os") + public Optional getOs() { + return os; + } + + /** + * @return utm_source values to filter by, comma-separated. + */ + @JsonProperty("utm_source") + public Optional getUtmSource() { + return utmSource; + } + + /** + * @return Page hostnames to filter by, comma-separated. + */ + @JsonProperty("hostname") + public Optional getHostname() { + return hostname; + } + + /** + * @return Page paths to filter by, comma-separated. + */ + @JsonProperty("page") + public Optional getPage() { + return page; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsRequest && equalTo((ListEventsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsRequest other) { + return identifier.equals(other.identifier) + && accountId.equals(other.accountId) + && from.equals(other.from) + && to.equals(other.to) + && first.equals(other.first) + && after.equals(other.after) + && before.equals(other.before) + && direction.equals(other.direction) + && event.equals(other.event) + && source.equals(other.source) + && attributionModel.equals(other.attributionModel) + && country.equals(other.country) + && city.equals(other.city) + && device.equals(other.device) + && browser.equals(other.browser) + && os.equals(other.os) + && utmSource.equals(other.utmSource) + && hostname.equals(other.hostname) + && page.equals(other.page); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.identifier, + this.accountId, + this.from, + this.to, + this.first, + this.after, + this.before, + this.direction, + this.event, + this.source, + this.attributionModel, + this.country, + this.city, + this.device, + this.browser, + this.os, + this.utmSource, + this.hostname, + this.page); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional identifier = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional from = Optional.empty(); + + private Optional to = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional event = Optional.empty(); + + private Optional source = Optional.empty(); + + private Optional attributionModel = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional city = Optional.empty(); + + private Optional device = Optional.empty(); + + private Optional browser = Optional.empty(); + + private Optional os = Optional.empty(); + + private Optional utmSource = Optional.empty(); + + private Optional hostname = Optional.empty(); + + private Optional page = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEventsRequest other) { + identifier(other.getIdentifier()); + accountId(other.getAccountId()); + from(other.getFrom()); + to(other.getTo()); + first(other.getFirst()); + after(other.getAfter()); + before(other.getBefore()); + direction(other.getDirection()); + event(other.getEvent()); + source(other.getSource()); + attributionModel(other.getAttributionModel()); + country(other.getCountry()); + city(other.getCity()); + device(other.getDevice()); + browser(other.getBrowser()); + os(other.getOs()); + utmSource(other.getUtmSource()); + hostname(other.getHostname()); + page(other.getPage()); + return this; + } + + /** + *

Any hard identifier of the person: a person ID (prsn_*), user ID, email, phone number, or a tracking cookie value (wuid, anonymous ID, fbp/fbc/ttp/ga). Omit to list recent events for the account.

+ */ + @JsonSetter(value = "identifier", nulls = Nulls.SKIP) + public Builder identifier(Optional identifier) { + this.identifier = identifier; + return this; + } + + public Builder identifier(String identifier) { + this.identifier = Optional.ofNullable(identifier); + return this; + } + + /** + *

Account ID, prefixed biz_. Optional for account API keys; required for credentials that can access multiple accounts.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Start of the time range as an ISO 8601 timestamp. Required when identifier is omitted.

+ */ + @JsonSetter(value = "from", nulls = Nulls.SKIP) + public Builder from(Optional from) { + this.from = from; + return this; + } + + public Builder from(OffsetDateTime from) { + this.from = Optional.ofNullable(from); + return this; + } + + /** + *

End of the time range as an ISO 8601 timestamp. Required when identifier is omitted; otherwise defaults to now.

+ */ + @JsonSetter(value = "to", nulls = Nulls.SKIP) + public Builder to(Optional to) { + this.to = to; + return this; + } + + public Builder to(OffsetDateTime to) { + this.to = Optional.ofNullable(to); + return this; + } + + /** + *

The number of events to return.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor for fetching events after a previous page.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

A cursor for fetching events before a later page.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The order events are returned in by time. Defaults to desc (most recent first); asc reads a journey forwards from where it starts. after and before always page forwards and backwards through that order.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListEventsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Full event names to filter by, comma-separated (payment.completed, pixel.lead, pixel.page, pixel.custom:<name>) — the same vocabulary the events / people metrics use.

+ */ + @JsonSetter(value = "event", nulls = Nulls.SKIP) + public Builder event(Optional event) { + this.event = event; + return this; + } + + public Builder event(String event) { + this.event = Optional.ofNullable(event); + return this; + } + + /** + *

Canonical source path, exact or with a trailing :* prefix (whop:<campaign>:, ext:meta:, referrer:<domain>, direct). Restricts the list to conversion targets attributed to that source — the debuggability twin of a metric cell's source parameter.

+ */ + @JsonSetter(value = "source", nulls = Nulls.SKIP) + public Builder source(Optional source) { + this.source = source; + return this; + } + + public Builder source(String source) { + this.source = Optional.ofNullable(source); + return this; + } + + /** + *

Attribution model for the source filter (defaults to last_touch).

+ */ + @JsonSetter(value = "attribution_model", nulls = Nulls.SKIP) + public Builder attributionModel(Optional attributionModel) { + this.attributionModel = attributionModel; + return this; + } + + public Builder attributionModel(ListEventsRequestAttributionModel attributionModel) { + this.attributionModel = Optional.ofNullable(attributionModel); + return this; + } + + /** + *

Country codes to filter by, comma-separated.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

Cities to filter by, comma-separated.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + /** + *

Device families to filter by, comma-separated (e.g. iPhone, Mac).

+ */ + @JsonSetter(value = "device", nulls = Nulls.SKIP) + public Builder device(Optional device) { + this.device = device; + return this; + } + + public Builder device(String device) { + this.device = Optional.ofNullable(device); + return this; + } + + /** + *

Browser families to filter by, comma-separated (e.g. Chrome, Mobile Safari).

+ */ + @JsonSetter(value = "browser", nulls = Nulls.SKIP) + public Builder browser(Optional browser) { + this.browser = browser; + return this; + } + + public Builder browser(String browser) { + this.browser = Optional.ofNullable(browser); + return this; + } + + /** + *

Operating system families to filter by, comma-separated (e.g. iOS, Windows).

+ */ + @JsonSetter(value = "os", nulls = Nulls.SKIP) + public Builder os(Optional os) { + this.os = os; + return this; + } + + public Builder os(String os) { + this.os = Optional.ofNullable(os); + return this; + } + + /** + *

utm_source values to filter by, comma-separated.

+ */ + @JsonSetter(value = "utm_source", nulls = Nulls.SKIP) + public Builder utmSource(Optional utmSource) { + this.utmSource = utmSource; + return this; + } + + public Builder utmSource(String utmSource) { + this.utmSource = Optional.ofNullable(utmSource); + return this; + } + + /** + *

Page hostnames to filter by, comma-separated.

+ */ + @JsonSetter(value = "hostname", nulls = Nulls.SKIP) + public Builder hostname(Optional hostname) { + this.hostname = hostname; + return this; + } + + public Builder hostname(String hostname) { + this.hostname = Optional.ofNullable(hostname); + return this; + } + + /** + *

Page paths to filter by, comma-separated.

+ */ + @JsonSetter(value = "page", nulls = Nulls.SKIP) + public Builder page(Optional page) { + this.page = page; + return this; + } + + public Builder page(String page) { + this.page = Optional.ofNullable(page); + return this; + } + + public ListEventsRequest build() { + return new ListEventsRequest( + identifier, + accountId, + from, + to, + first, + after, + before, + direction, + event, + source, + attributionModel, + country, + city, + device, + browser, + os, + utmSource, + hostname, + page, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/requests/PulseEventsRequest.java b/src/main/java/com/whop/api/resources/events/requests/PulseEventsRequest.java new file mode 100644 index 00000000..d5de3571 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/requests/PulseEventsRequest.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PulseEventsRequest.Builder.class) +public final class PulseEventsRequest { + private final Optional event; + + private final Optional first; + + private final Optional after; + + private final Optional before; + + private final Map additionalProperties; + + private PulseEventsRequest( + Optional event, + Optional first, + Optional after, + Optional before, + Map additionalProperties) { + this.event = event; + this.first = first; + this.after = after; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Filter to one or more types, comma separated — for example purchase,card_spend. These are the item's type, not its event_name: several types share the ledger_line.created event name. Omit for every type in the feed. Values outside the feed's own set are rejected. + */ + @JsonProperty("event") + public Optional getEvent() { + return event; + } + + /** + * @return The number of events to return. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor for fetching events after a previous page. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return A cursor for fetching events before a later page. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PulseEventsRequest && equalTo((PulseEventsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PulseEventsRequest other) { + return event.equals(other.event) + && first.equals(other.first) + && after.equals(other.after) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.event, this.first, this.after, this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional event = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PulseEventsRequest other) { + event(other.getEvent()); + first(other.getFirst()); + after(other.getAfter()); + before(other.getBefore()); + return this; + } + + /** + *

Filter to one or more types, comma separated — for example purchase,card_spend. These are the item's type, not its event_name: several types share the ledger_line.created event name. Omit for every type in the feed. Values outside the feed's own set are rejected.

+ */ + @JsonSetter(value = "event", nulls = Nulls.SKIP) + public Builder event(Optional event) { + this.event = event; + return this; + } + + public Builder event(String event) { + this.event = Optional.ofNullable(event); + return this; + } + + /** + *

The number of events to return.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor for fetching events after a previous page.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

A cursor for fetching events before a later page.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public PulseEventsRequest build() { + return new PulseEventsRequest(event, first, after, before, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/requests/ValidatePixelEventsRequest.java b/src/main/java/com/whop/api/resources/events/requests/ValidatePixelEventsRequest.java new file mode 100644 index 00000000..61882345 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/requests/ValidatePixelEventsRequest.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ValidatePixelEventsRequest.Builder.class) +public final class ValidatePixelEventsRequest { + private final Optional accountId; + + private final Optional url; + + private final Map additionalProperties; + + private ValidatePixelEventsRequest( + Optional accountId, Optional url, Map additionalProperties) { + this.accountId = accountId; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account to check. Defaults to the authenticated account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return A page to read for the pixel, e.g. an ad destination. Omit it to check the account from its events alone. + */ + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ValidatePixelEventsRequest && equalTo((ValidatePixelEventsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ValidatePixelEventsRequest other) { + return accountId.equals(other.accountId) && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ValidatePixelEventsRequest other) { + accountId(other.getAccountId()); + url(other.getUrl()); + return this; + } + + /** + *

Account to check. Defaults to the authenticated account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

A page to read for the pixel, e.g. an ad destination. Omit it to check the account from its events alone.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public ValidatePixelEventsRequest build() { + return new ValidatePixelEventsRequest(accountId, url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/CreateEventsRequestActionSource.java b/src/main/java/com/whop/api/resources/events/types/CreateEventsRequestActionSource.java new file mode 100644 index 00000000..4ddf69d6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/CreateEventsRequestActionSource.java @@ -0,0 +1,161 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateEventsRequestActionSource { + public static final CreateEventsRequestActionSource PHYSICAL_STORE = + new CreateEventsRequestActionSource(Value.PHYSICAL_STORE, "physical_store"); + + public static final CreateEventsRequestActionSource WEBSITE = + new CreateEventsRequestActionSource(Value.WEBSITE, "website"); + + public static final CreateEventsRequestActionSource EMAIL = + new CreateEventsRequestActionSource(Value.EMAIL, "email"); + + public static final CreateEventsRequestActionSource OTHER = + new CreateEventsRequestActionSource(Value.OTHER, "other"); + + public static final CreateEventsRequestActionSource APP = new CreateEventsRequestActionSource(Value.APP, "app"); + + public static final CreateEventsRequestActionSource BUSINESS_MESSAGING = + new CreateEventsRequestActionSource(Value.BUSINESS_MESSAGING, "business_messaging"); + + public static final CreateEventsRequestActionSource PHONE_CALL = + new CreateEventsRequestActionSource(Value.PHONE_CALL, "phone_call"); + + public static final CreateEventsRequestActionSource SYSTEM_GENERATED = + new CreateEventsRequestActionSource(Value.SYSTEM_GENERATED, "system_generated"); + + public static final CreateEventsRequestActionSource CHAT = new CreateEventsRequestActionSource(Value.CHAT, "chat"); + + private final Value value; + + private final String string; + + CreateEventsRequestActionSource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateEventsRequestActionSource + && this.string.equals(((CreateEventsRequestActionSource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PHYSICAL_STORE: + return visitor.visitPhysicalStore(); + case WEBSITE: + return visitor.visitWebsite(); + case EMAIL: + return visitor.visitEmail(); + case OTHER: + return visitor.visitOther(); + case APP: + return visitor.visitApp(); + case BUSINESS_MESSAGING: + return visitor.visitBusinessMessaging(); + case PHONE_CALL: + return visitor.visitPhoneCall(); + case SYSTEM_GENERATED: + return visitor.visitSystemGenerated(); + case CHAT: + return visitor.visitChat(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateEventsRequestActionSource valueOf(String value) { + switch (value) { + case "physical_store": + return PHYSICAL_STORE; + case "website": + return WEBSITE; + case "email": + return EMAIL; + case "other": + return OTHER; + case "app": + return APP; + case "business_messaging": + return BUSINESS_MESSAGING; + case "phone_call": + return PHONE_CALL; + case "system_generated": + return SYSTEM_GENERATED; + case "chat": + return CHAT; + default: + return new CreateEventsRequestActionSource(Value.UNKNOWN, value); + } + } + + public enum Value { + EMAIL, + + WEBSITE, + + APP, + + PHONE_CALL, + + CHAT, + + PHYSICAL_STORE, + + SYSTEM_GENERATED, + + BUSINESS_MESSAGING, + + OTHER, + + UNKNOWN + } + + public interface Visitor { + T visitEmail(); + + T visitWebsite(); + + T visitApp(); + + T visitPhoneCall(); + + T visitChat(); + + T visitPhysicalStore(); + + T visitSystemGenerated(); + + T visitBusinessMessaging(); + + T visitOther(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/CreateEventsRequestContext.java b/src/main/java/com/whop/api/resources/events/types/CreateEventsRequestContext.java new file mode 100644 index 00000000..3a514342 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/CreateEventsRequestContext.java @@ -0,0 +1,1699 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateEventsRequestContext.Builder.class) +public final class CreateEventsRequestContext { + private final Optional adCampaignId; + + private final Optional adId; + + private final Optional adSetId; + + private final Optional fbc; + + private final Optional fbclid; + + private final Optional fbp; + + private final Optional fingerprint; + + private final Optional fingerprintConfidence; + + private final Optional ga; + + private final Optional gbraid; + + private final Optional gclid; + + private final Optional igSid; + + private final Optional ipAddress; + + private final Optional language; + + private final Optional liFatId; + + private final Optional msclkid; + + private final Optional rdtCid; + + private final Optional sccid; + + private final Optional screenResolution; + + private final Optional timezone; + + private final Optional ttclid; + + private final Optional ttp; + + private final Optional twclid; + + private final Optional userAgent; + + private final Optional utmCampaign; + + private final Optional utmContent; + + private final Optional utmId; + + private final Optional utmMedium; + + private final Optional utmSource; + + private final Optional utmTerm; + + private final Optional wbraid; + + private final Map additionalProperties; + + private CreateEventsRequestContext( + Optional adCampaignId, + Optional adId, + Optional adSetId, + Optional fbc, + Optional fbclid, + Optional fbp, + Optional fingerprint, + Optional fingerprintConfidence, + Optional ga, + Optional gbraid, + Optional gclid, + Optional igSid, + Optional ipAddress, + Optional language, + Optional liFatId, + Optional msclkid, + Optional rdtCid, + Optional sccid, + Optional screenResolution, + Optional timezone, + Optional ttclid, + Optional ttp, + Optional twclid, + Optional userAgent, + Optional utmCampaign, + Optional utmContent, + Optional utmId, + Optional utmMedium, + Optional utmSource, + Optional utmTerm, + Optional wbraid, + Map additionalProperties) { + this.adCampaignId = adCampaignId; + this.adId = adId; + this.adSetId = adSetId; + this.fbc = fbc; + this.fbclid = fbclid; + this.fbp = fbp; + this.fingerprint = fingerprint; + this.fingerprintConfidence = fingerprintConfidence; + this.ga = ga; + this.gbraid = gbraid; + this.gclid = gclid; + this.igSid = igSid; + this.ipAddress = ipAddress; + this.language = language; + this.liFatId = liFatId; + this.msclkid = msclkid; + this.rdtCid = rdtCid; + this.sccid = sccid; + this.screenResolution = screenResolution; + this.timezone = timezone; + this.ttclid = ttclid; + this.ttp = ttp; + this.twclid = twclid; + this.userAgent = userAgent; + this.utmCampaign = utmCampaign; + this.utmContent = utmContent; + this.utmId = utmId; + this.utmMedium = utmMedium; + this.utmSource = utmSource; + this.utmTerm = utmTerm; + this.wbraid = wbraid; + this.additionalProperties = additionalProperties; + } + + /** + * @return Ad campaign ID. + */ + @JsonIgnore + public Optional getAdCampaignId() { + if (adCampaignId == null) { + return Optional.empty(); + } + return adCampaignId; + } + + /** + * @return Ad ID. + */ + @JsonIgnore + public Optional getAdId() { + if (adId == null) { + return Optional.empty(); + } + return adId; + } + + /** + * @return Ad set ID. + */ + @JsonIgnore + public Optional getAdSetId() { + if (adSetId == null) { + return Optional.empty(); + } + return adSetId; + } + + /** + * @return Facebook click cookie (_fbc, format fb.1.{timestamp}.{fbclid}). + */ + @JsonIgnore + public Optional getFbc() { + if (fbc == null) { + return Optional.empty(); + } + return fbc; + } + + /** + * @return Facebook click ID. + */ + @JsonIgnore + public Optional getFbclid() { + if (fbclid == null) { + return Optional.empty(); + } + return fbclid; + } + + /** + * @return Facebook browser pixel ID. + */ + @JsonIgnore + public Optional getFbp() { + if (fbp == null) { + return Optional.empty(); + } + return fbp; + } + + /** + * @return Client-side device fingerprint. + */ + @JsonIgnore + public Optional getFingerprint() { + if (fingerprint == null) { + return Optional.empty(); + } + return fingerprint; + } + + /** + * @return Confidence score (0-1) for the device fingerprint. + */ + @JsonIgnore + public Optional getFingerprintConfidence() { + if (fingerprintConfidence == null) { + return Optional.empty(); + } + return fingerprintConfidence; + } + + /** + * @return Google Analytics client ID. + */ + @JsonIgnore + public Optional getGa() { + if (ga == null) { + return Optional.empty(); + } + return ga; + } + + /** + * @return Google Ads gbraid click ID (iOS privacy). + */ + @JsonIgnore + public Optional getGbraid() { + if (gbraid == null) { + return Optional.empty(); + } + return gbraid; + } + + /** + * @return Google click ID. + */ + @JsonIgnore + public Optional getGclid() { + if (gclid == null) { + return Optional.empty(); + } + return gclid; + } + + /** + * @return Instagram session ID. + */ + @JsonIgnore + public Optional getIgSid() { + if (igSid == null) { + return Optional.empty(); + } + return igSid; + } + + /** + * @return IP address. + */ + @JsonIgnore + public Optional getIpAddress() { + if (ipAddress == null) { + return Optional.empty(); + } + return ipAddress; + } + + /** + * @return Browser language (e.g. en-US). + */ + @JsonIgnore + public Optional getLanguage() { + if (language == null) { + return Optional.empty(); + } + return language; + } + + /** + * @return LinkedIn click ID. + */ + @JsonIgnore + public Optional getLiFatId() { + if (liFatId == null) { + return Optional.empty(); + } + return liFatId; + } + + /** + * @return Microsoft Advertising (Bing) click ID. + */ + @JsonIgnore + public Optional getMsclkid() { + if (msclkid == null) { + return Optional.empty(); + } + return msclkid; + } + + /** + * @return Reddit click ID. + */ + @JsonIgnore + public Optional getRdtCid() { + if (rdtCid == null) { + return Optional.empty(); + } + return rdtCid; + } + + /** + * @return Snapchat click ID. + */ + @JsonIgnore + public Optional getSccid() { + if (sccid == null) { + return Optional.empty(); + } + return sccid; + } + + /** + * @return Screen resolution (e.g. 1920x1080). + */ + @JsonIgnore + public Optional getScreenResolution() { + if (screenResolution == null) { + return Optional.empty(); + } + return screenResolution; + } + + /** + * @return IANA timezone (e.g. America/New_York). + */ + @JsonIgnore + public Optional getTimezone() { + if (timezone == null) { + return Optional.empty(); + } + return timezone; + } + + /** + * @return TikTok click ID. + */ + @JsonIgnore + public Optional getTtclid() { + if (ttclid == null) { + return Optional.empty(); + } + return ttclid; + } + + /** + * @return TikTok pixel ID. + */ + @JsonIgnore + public Optional getTtp() { + if (ttp == null) { + return Optional.empty(); + } + return ttp; + } + + /** + * @return X (Twitter) click ID. + */ + @JsonIgnore + public Optional getTwclid() { + if (twclid == null) { + return Optional.empty(); + } + return twclid; + } + + /** + * @return Browser user agent string. + */ + @JsonIgnore + public Optional getUserAgent() { + if (userAgent == null) { + return Optional.empty(); + } + return userAgent; + } + + /** + * @return UTM campaign parameter. + */ + @JsonIgnore + public Optional getUtmCampaign() { + if (utmCampaign == null) { + return Optional.empty(); + } + return utmCampaign; + } + + /** + * @return UTM content parameter. + */ + @JsonIgnore + public Optional getUtmContent() { + if (utmContent == null) { + return Optional.empty(); + } + return utmContent; + } + + /** + * @return UTM ID parameter. + */ + @JsonIgnore + public Optional getUtmId() { + if (utmId == null) { + return Optional.empty(); + } + return utmId; + } + + /** + * @return UTM medium parameter. + */ + @JsonIgnore + public Optional getUtmMedium() { + if (utmMedium == null) { + return Optional.empty(); + } + return utmMedium; + } + + /** + * @return UTM source parameter. + */ + @JsonIgnore + public Optional getUtmSource() { + if (utmSource == null) { + return Optional.empty(); + } + return utmSource; + } + + /** + * @return UTM term parameter. + */ + @JsonIgnore + public Optional getUtmTerm() { + if (utmTerm == null) { + return Optional.empty(); + } + return utmTerm; + } + + /** + * @return Google Ads wbraid click ID (iOS privacy). + */ + @JsonIgnore + public Optional getWbraid() { + if (wbraid == null) { + return Optional.empty(); + } + return wbraid; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_campaign_id") + private Optional _getAdCampaignId() { + return adCampaignId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_id") + private Optional _getAdId() { + return adId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_set_id") + private Optional _getAdSetId() { + return adSetId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fbc") + private Optional _getFbc() { + return fbc; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fbclid") + private Optional _getFbclid() { + return fbclid; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fbp") + private Optional _getFbp() { + return fbp; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fingerprint") + private Optional _getFingerprint() { + return fingerprint; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fingerprint_confidence") + private Optional _getFingerprintConfidence() { + return fingerprintConfidence; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ga") + private Optional _getGa() { + return ga; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("gbraid") + private Optional _getGbraid() { + return gbraid; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("gclid") + private Optional _getGclid() { + return gclid; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ig_sid") + private Optional _getIgSid() { + return igSid; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ip_address") + private Optional _getIpAddress() { + return ipAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("language") + private Optional _getLanguage() { + return language; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("li_fat_id") + private Optional _getLiFatId() { + return liFatId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("msclkid") + private Optional _getMsclkid() { + return msclkid; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("rdt_cid") + private Optional _getRdtCid() { + return rdtCid; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("sccid") + private Optional _getSccid() { + return sccid; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("screen_resolution") + private Optional _getScreenResolution() { + return screenResolution; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("timezone") + private Optional _getTimezone() { + return timezone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ttclid") + private Optional _getTtclid() { + return ttclid; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ttp") + private Optional _getTtp() { + return ttp; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("twclid") + private Optional _getTwclid() { + return twclid; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_agent") + private Optional _getUserAgent() { + return userAgent; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_campaign") + private Optional _getUtmCampaign() { + return utmCampaign; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_content") + private Optional _getUtmContent() { + return utmContent; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_id") + private Optional _getUtmId() { + return utmId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_medium") + private Optional _getUtmMedium() { + return utmMedium; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_source") + private Optional _getUtmSource() { + return utmSource; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_term") + private Optional _getUtmTerm() { + return utmTerm; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("wbraid") + private Optional _getWbraid() { + return wbraid; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateEventsRequestContext && equalTo((CreateEventsRequestContext) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateEventsRequestContext other) { + return adCampaignId.equals(other.adCampaignId) + && adId.equals(other.adId) + && adSetId.equals(other.adSetId) + && fbc.equals(other.fbc) + && fbclid.equals(other.fbclid) + && fbp.equals(other.fbp) + && fingerprint.equals(other.fingerprint) + && fingerprintConfidence.equals(other.fingerprintConfidence) + && ga.equals(other.ga) + && gbraid.equals(other.gbraid) + && gclid.equals(other.gclid) + && igSid.equals(other.igSid) + && ipAddress.equals(other.ipAddress) + && language.equals(other.language) + && liFatId.equals(other.liFatId) + && msclkid.equals(other.msclkid) + && rdtCid.equals(other.rdtCid) + && sccid.equals(other.sccid) + && screenResolution.equals(other.screenResolution) + && timezone.equals(other.timezone) + && ttclid.equals(other.ttclid) + && ttp.equals(other.ttp) + && twclid.equals(other.twclid) + && userAgent.equals(other.userAgent) + && utmCampaign.equals(other.utmCampaign) + && utmContent.equals(other.utmContent) + && utmId.equals(other.utmId) + && utmMedium.equals(other.utmMedium) + && utmSource.equals(other.utmSource) + && utmTerm.equals(other.utmTerm) + && wbraid.equals(other.wbraid); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adCampaignId, + this.adId, + this.adSetId, + this.fbc, + this.fbclid, + this.fbp, + this.fingerprint, + this.fingerprintConfidence, + this.ga, + this.gbraid, + this.gclid, + this.igSid, + this.ipAddress, + this.language, + this.liFatId, + this.msclkid, + this.rdtCid, + this.sccid, + this.screenResolution, + this.timezone, + this.ttclid, + this.ttp, + this.twclid, + this.userAgent, + this.utmCampaign, + this.utmContent, + this.utmId, + this.utmMedium, + this.utmSource, + this.utmTerm, + this.wbraid); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional adCampaignId = Optional.empty(); + + private Optional adId = Optional.empty(); + + private Optional adSetId = Optional.empty(); + + private Optional fbc = Optional.empty(); + + private Optional fbclid = Optional.empty(); + + private Optional fbp = Optional.empty(); + + private Optional fingerprint = Optional.empty(); + + private Optional fingerprintConfidence = Optional.empty(); + + private Optional ga = Optional.empty(); + + private Optional gbraid = Optional.empty(); + + private Optional gclid = Optional.empty(); + + private Optional igSid = Optional.empty(); + + private Optional ipAddress = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional liFatId = Optional.empty(); + + private Optional msclkid = Optional.empty(); + + private Optional rdtCid = Optional.empty(); + + private Optional sccid = Optional.empty(); + + private Optional screenResolution = Optional.empty(); + + private Optional timezone = Optional.empty(); + + private Optional ttclid = Optional.empty(); + + private Optional ttp = Optional.empty(); + + private Optional twclid = Optional.empty(); + + private Optional userAgent = Optional.empty(); + + private Optional utmCampaign = Optional.empty(); + + private Optional utmContent = Optional.empty(); + + private Optional utmId = Optional.empty(); + + private Optional utmMedium = Optional.empty(); + + private Optional utmSource = Optional.empty(); + + private Optional utmTerm = Optional.empty(); + + private Optional wbraid = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateEventsRequestContext other) { + adCampaignId(other.getAdCampaignId()); + adId(other.getAdId()); + adSetId(other.getAdSetId()); + fbc(other.getFbc()); + fbclid(other.getFbclid()); + fbp(other.getFbp()); + fingerprint(other.getFingerprint()); + fingerprintConfidence(other.getFingerprintConfidence()); + ga(other.getGa()); + gbraid(other.getGbraid()); + gclid(other.getGclid()); + igSid(other.getIgSid()); + ipAddress(other.getIpAddress()); + language(other.getLanguage()); + liFatId(other.getLiFatId()); + msclkid(other.getMsclkid()); + rdtCid(other.getRdtCid()); + sccid(other.getSccid()); + screenResolution(other.getScreenResolution()); + timezone(other.getTimezone()); + ttclid(other.getTtclid()); + ttp(other.getTtp()); + twclid(other.getTwclid()); + userAgent(other.getUserAgent()); + utmCampaign(other.getUtmCampaign()); + utmContent(other.getUtmContent()); + utmId(other.getUtmId()); + utmMedium(other.getUtmMedium()); + utmSource(other.getUtmSource()); + utmTerm(other.getUtmTerm()); + wbraid(other.getWbraid()); + return this; + } + + /** + *

Ad campaign ID.

+ */ + @JsonSetter(value = "ad_campaign_id", nulls = Nulls.SKIP) + public Builder adCampaignId(Optional adCampaignId) { + this.adCampaignId = adCampaignId; + return this; + } + + public Builder adCampaignId(String adCampaignId) { + this.adCampaignId = Optional.ofNullable(adCampaignId); + return this; + } + + public Builder adCampaignId(Nullable adCampaignId) { + if (adCampaignId.isNull()) { + this.adCampaignId = null; + } else if (adCampaignId.isEmpty()) { + this.adCampaignId = Optional.empty(); + } else { + this.adCampaignId = Optional.of(adCampaignId.get()); + } + return this; + } + + /** + *

Ad ID.

+ */ + @JsonSetter(value = "ad_id", nulls = Nulls.SKIP) + public Builder adId(Optional adId) { + this.adId = adId; + return this; + } + + public Builder adId(String adId) { + this.adId = Optional.ofNullable(adId); + return this; + } + + public Builder adId(Nullable adId) { + if (adId.isNull()) { + this.adId = null; + } else if (adId.isEmpty()) { + this.adId = Optional.empty(); + } else { + this.adId = Optional.of(adId.get()); + } + return this; + } + + /** + *

Ad set ID.

+ */ + @JsonSetter(value = "ad_set_id", nulls = Nulls.SKIP) + public Builder adSetId(Optional adSetId) { + this.adSetId = adSetId; + return this; + } + + public Builder adSetId(String adSetId) { + this.adSetId = Optional.ofNullable(adSetId); + return this; + } + + public Builder adSetId(Nullable adSetId) { + if (adSetId.isNull()) { + this.adSetId = null; + } else if (adSetId.isEmpty()) { + this.adSetId = Optional.empty(); + } else { + this.adSetId = Optional.of(adSetId.get()); + } + return this; + } + + /** + *

Facebook click cookie (_fbc, format fb.1.{timestamp}.{fbclid}).

+ */ + @JsonSetter(value = "fbc", nulls = Nulls.SKIP) + public Builder fbc(Optional fbc) { + this.fbc = fbc; + return this; + } + + public Builder fbc(String fbc) { + this.fbc = Optional.ofNullable(fbc); + return this; + } + + public Builder fbc(Nullable fbc) { + if (fbc.isNull()) { + this.fbc = null; + } else if (fbc.isEmpty()) { + this.fbc = Optional.empty(); + } else { + this.fbc = Optional.of(fbc.get()); + } + return this; + } + + /** + *

Facebook click ID.

+ */ + @JsonSetter(value = "fbclid", nulls = Nulls.SKIP) + public Builder fbclid(Optional fbclid) { + this.fbclid = fbclid; + return this; + } + + public Builder fbclid(String fbclid) { + this.fbclid = Optional.ofNullable(fbclid); + return this; + } + + public Builder fbclid(Nullable fbclid) { + if (fbclid.isNull()) { + this.fbclid = null; + } else if (fbclid.isEmpty()) { + this.fbclid = Optional.empty(); + } else { + this.fbclid = Optional.of(fbclid.get()); + } + return this; + } + + /** + *

Facebook browser pixel ID.

+ */ + @JsonSetter(value = "fbp", nulls = Nulls.SKIP) + public Builder fbp(Optional fbp) { + this.fbp = fbp; + return this; + } + + public Builder fbp(String fbp) { + this.fbp = Optional.ofNullable(fbp); + return this; + } + + public Builder fbp(Nullable fbp) { + if (fbp.isNull()) { + this.fbp = null; + } else if (fbp.isEmpty()) { + this.fbp = Optional.empty(); + } else { + this.fbp = Optional.of(fbp.get()); + } + return this; + } + + /** + *

Client-side device fingerprint.

+ */ + @JsonSetter(value = "fingerprint", nulls = Nulls.SKIP) + public Builder fingerprint(Optional fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public Builder fingerprint(String fingerprint) { + this.fingerprint = Optional.ofNullable(fingerprint); + return this; + } + + public Builder fingerprint(Nullable fingerprint) { + if (fingerprint.isNull()) { + this.fingerprint = null; + } else if (fingerprint.isEmpty()) { + this.fingerprint = Optional.empty(); + } else { + this.fingerprint = Optional.of(fingerprint.get()); + } + return this; + } + + /** + *

Confidence score (0-1) for the device fingerprint.

+ */ + @JsonSetter(value = "fingerprint_confidence", nulls = Nulls.SKIP) + public Builder fingerprintConfidence(Optional fingerprintConfidence) { + this.fingerprintConfidence = fingerprintConfidence; + return this; + } + + public Builder fingerprintConfidence(Double fingerprintConfidence) { + this.fingerprintConfidence = Optional.ofNullable(fingerprintConfidence); + return this; + } + + public Builder fingerprintConfidence(Nullable fingerprintConfidence) { + if (fingerprintConfidence.isNull()) { + this.fingerprintConfidence = null; + } else if (fingerprintConfidence.isEmpty()) { + this.fingerprintConfidence = Optional.empty(); + } else { + this.fingerprintConfidence = Optional.of(fingerprintConfidence.get()); + } + return this; + } + + /** + *

Google Analytics client ID.

+ */ + @JsonSetter(value = "ga", nulls = Nulls.SKIP) + public Builder ga(Optional ga) { + this.ga = ga; + return this; + } + + public Builder ga(String ga) { + this.ga = Optional.ofNullable(ga); + return this; + } + + public Builder ga(Nullable ga) { + if (ga.isNull()) { + this.ga = null; + } else if (ga.isEmpty()) { + this.ga = Optional.empty(); + } else { + this.ga = Optional.of(ga.get()); + } + return this; + } + + /** + *

Google Ads gbraid click ID (iOS privacy).

+ */ + @JsonSetter(value = "gbraid", nulls = Nulls.SKIP) + public Builder gbraid(Optional gbraid) { + this.gbraid = gbraid; + return this; + } + + public Builder gbraid(String gbraid) { + this.gbraid = Optional.ofNullable(gbraid); + return this; + } + + public Builder gbraid(Nullable gbraid) { + if (gbraid.isNull()) { + this.gbraid = null; + } else if (gbraid.isEmpty()) { + this.gbraid = Optional.empty(); + } else { + this.gbraid = Optional.of(gbraid.get()); + } + return this; + } + + /** + *

Google click ID.

+ */ + @JsonSetter(value = "gclid", nulls = Nulls.SKIP) + public Builder gclid(Optional gclid) { + this.gclid = gclid; + return this; + } + + public Builder gclid(String gclid) { + this.gclid = Optional.ofNullable(gclid); + return this; + } + + public Builder gclid(Nullable gclid) { + if (gclid.isNull()) { + this.gclid = null; + } else if (gclid.isEmpty()) { + this.gclid = Optional.empty(); + } else { + this.gclid = Optional.of(gclid.get()); + } + return this; + } + + /** + *

Instagram session ID.

+ */ + @JsonSetter(value = "ig_sid", nulls = Nulls.SKIP) + public Builder igSid(Optional igSid) { + this.igSid = igSid; + return this; + } + + public Builder igSid(String igSid) { + this.igSid = Optional.ofNullable(igSid); + return this; + } + + public Builder igSid(Nullable igSid) { + if (igSid.isNull()) { + this.igSid = null; + } else if (igSid.isEmpty()) { + this.igSid = Optional.empty(); + } else { + this.igSid = Optional.of(igSid.get()); + } + return this; + } + + /** + *

IP address.

+ */ + @JsonSetter(value = "ip_address", nulls = Nulls.SKIP) + public Builder ipAddress(Optional ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + public Builder ipAddress(String ipAddress) { + this.ipAddress = Optional.ofNullable(ipAddress); + return this; + } + + public Builder ipAddress(Nullable ipAddress) { + if (ipAddress.isNull()) { + this.ipAddress = null; + } else if (ipAddress.isEmpty()) { + this.ipAddress = Optional.empty(); + } else { + this.ipAddress = Optional.of(ipAddress.get()); + } + return this; + } + + /** + *

Browser language (e.g. en-US).

+ */ + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public Builder language(Optional language) { + this.language = language; + return this; + } + + public Builder language(String language) { + this.language = Optional.ofNullable(language); + return this; + } + + public Builder language(Nullable language) { + if (language.isNull()) { + this.language = null; + } else if (language.isEmpty()) { + this.language = Optional.empty(); + } else { + this.language = Optional.of(language.get()); + } + return this; + } + + /** + *

LinkedIn click ID.

+ */ + @JsonSetter(value = "li_fat_id", nulls = Nulls.SKIP) + public Builder liFatId(Optional liFatId) { + this.liFatId = liFatId; + return this; + } + + public Builder liFatId(String liFatId) { + this.liFatId = Optional.ofNullable(liFatId); + return this; + } + + public Builder liFatId(Nullable liFatId) { + if (liFatId.isNull()) { + this.liFatId = null; + } else if (liFatId.isEmpty()) { + this.liFatId = Optional.empty(); + } else { + this.liFatId = Optional.of(liFatId.get()); + } + return this; + } + + /** + *

Microsoft Advertising (Bing) click ID.

+ */ + @JsonSetter(value = "msclkid", nulls = Nulls.SKIP) + public Builder msclkid(Optional msclkid) { + this.msclkid = msclkid; + return this; + } + + public Builder msclkid(String msclkid) { + this.msclkid = Optional.ofNullable(msclkid); + return this; + } + + public Builder msclkid(Nullable msclkid) { + if (msclkid.isNull()) { + this.msclkid = null; + } else if (msclkid.isEmpty()) { + this.msclkid = Optional.empty(); + } else { + this.msclkid = Optional.of(msclkid.get()); + } + return this; + } + + /** + *

Reddit click ID.

+ */ + @JsonSetter(value = "rdt_cid", nulls = Nulls.SKIP) + public Builder rdtCid(Optional rdtCid) { + this.rdtCid = rdtCid; + return this; + } + + public Builder rdtCid(String rdtCid) { + this.rdtCid = Optional.ofNullable(rdtCid); + return this; + } + + public Builder rdtCid(Nullable rdtCid) { + if (rdtCid.isNull()) { + this.rdtCid = null; + } else if (rdtCid.isEmpty()) { + this.rdtCid = Optional.empty(); + } else { + this.rdtCid = Optional.of(rdtCid.get()); + } + return this; + } + + /** + *

Snapchat click ID.

+ */ + @JsonSetter(value = "sccid", nulls = Nulls.SKIP) + public Builder sccid(Optional sccid) { + this.sccid = sccid; + return this; + } + + public Builder sccid(String sccid) { + this.sccid = Optional.ofNullable(sccid); + return this; + } + + public Builder sccid(Nullable sccid) { + if (sccid.isNull()) { + this.sccid = null; + } else if (sccid.isEmpty()) { + this.sccid = Optional.empty(); + } else { + this.sccid = Optional.of(sccid.get()); + } + return this; + } + + /** + *

Screen resolution (e.g. 1920x1080).

+ */ + @JsonSetter(value = "screen_resolution", nulls = Nulls.SKIP) + public Builder screenResolution(Optional screenResolution) { + this.screenResolution = screenResolution; + return this; + } + + public Builder screenResolution(String screenResolution) { + this.screenResolution = Optional.ofNullable(screenResolution); + return this; + } + + public Builder screenResolution(Nullable screenResolution) { + if (screenResolution.isNull()) { + this.screenResolution = null; + } else if (screenResolution.isEmpty()) { + this.screenResolution = Optional.empty(); + } else { + this.screenResolution = Optional.of(screenResolution.get()); + } + return this; + } + + /** + *

IANA timezone (e.g. America/New_York).

+ */ + @JsonSetter(value = "timezone", nulls = Nulls.SKIP) + public Builder timezone(Optional timezone) { + this.timezone = timezone; + return this; + } + + public Builder timezone(String timezone) { + this.timezone = Optional.ofNullable(timezone); + return this; + } + + public Builder timezone(Nullable timezone) { + if (timezone.isNull()) { + this.timezone = null; + } else if (timezone.isEmpty()) { + this.timezone = Optional.empty(); + } else { + this.timezone = Optional.of(timezone.get()); + } + return this; + } + + /** + *

TikTok click ID.

+ */ + @JsonSetter(value = "ttclid", nulls = Nulls.SKIP) + public Builder ttclid(Optional ttclid) { + this.ttclid = ttclid; + return this; + } + + public Builder ttclid(String ttclid) { + this.ttclid = Optional.ofNullable(ttclid); + return this; + } + + public Builder ttclid(Nullable ttclid) { + if (ttclid.isNull()) { + this.ttclid = null; + } else if (ttclid.isEmpty()) { + this.ttclid = Optional.empty(); + } else { + this.ttclid = Optional.of(ttclid.get()); + } + return this; + } + + /** + *

TikTok pixel ID.

+ */ + @JsonSetter(value = "ttp", nulls = Nulls.SKIP) + public Builder ttp(Optional ttp) { + this.ttp = ttp; + return this; + } + + public Builder ttp(String ttp) { + this.ttp = Optional.ofNullable(ttp); + return this; + } + + public Builder ttp(Nullable ttp) { + if (ttp.isNull()) { + this.ttp = null; + } else if (ttp.isEmpty()) { + this.ttp = Optional.empty(); + } else { + this.ttp = Optional.of(ttp.get()); + } + return this; + } + + /** + *

X (Twitter) click ID.

+ */ + @JsonSetter(value = "twclid", nulls = Nulls.SKIP) + public Builder twclid(Optional twclid) { + this.twclid = twclid; + return this; + } + + public Builder twclid(String twclid) { + this.twclid = Optional.ofNullable(twclid); + return this; + } + + public Builder twclid(Nullable twclid) { + if (twclid.isNull()) { + this.twclid = null; + } else if (twclid.isEmpty()) { + this.twclid = Optional.empty(); + } else { + this.twclid = Optional.of(twclid.get()); + } + return this; + } + + /** + *

Browser user agent string.

+ */ + @JsonSetter(value = "user_agent", nulls = Nulls.SKIP) + public Builder userAgent(Optional userAgent) { + this.userAgent = userAgent; + return this; + } + + public Builder userAgent(String userAgent) { + this.userAgent = Optional.ofNullable(userAgent); + return this; + } + + public Builder userAgent(Nullable userAgent) { + if (userAgent.isNull()) { + this.userAgent = null; + } else if (userAgent.isEmpty()) { + this.userAgent = Optional.empty(); + } else { + this.userAgent = Optional.of(userAgent.get()); + } + return this; + } + + /** + *

UTM campaign parameter.

+ */ + @JsonSetter(value = "utm_campaign", nulls = Nulls.SKIP) + public Builder utmCampaign(Optional utmCampaign) { + this.utmCampaign = utmCampaign; + return this; + } + + public Builder utmCampaign(String utmCampaign) { + this.utmCampaign = Optional.ofNullable(utmCampaign); + return this; + } + + public Builder utmCampaign(Nullable utmCampaign) { + if (utmCampaign.isNull()) { + this.utmCampaign = null; + } else if (utmCampaign.isEmpty()) { + this.utmCampaign = Optional.empty(); + } else { + this.utmCampaign = Optional.of(utmCampaign.get()); + } + return this; + } + + /** + *

UTM content parameter.

+ */ + @JsonSetter(value = "utm_content", nulls = Nulls.SKIP) + public Builder utmContent(Optional utmContent) { + this.utmContent = utmContent; + return this; + } + + public Builder utmContent(String utmContent) { + this.utmContent = Optional.ofNullable(utmContent); + return this; + } + + public Builder utmContent(Nullable utmContent) { + if (utmContent.isNull()) { + this.utmContent = null; + } else if (utmContent.isEmpty()) { + this.utmContent = Optional.empty(); + } else { + this.utmContent = Optional.of(utmContent.get()); + } + return this; + } + + /** + *

UTM ID parameter.

+ */ + @JsonSetter(value = "utm_id", nulls = Nulls.SKIP) + public Builder utmId(Optional utmId) { + this.utmId = utmId; + return this; + } + + public Builder utmId(String utmId) { + this.utmId = Optional.ofNullable(utmId); + return this; + } + + public Builder utmId(Nullable utmId) { + if (utmId.isNull()) { + this.utmId = null; + } else if (utmId.isEmpty()) { + this.utmId = Optional.empty(); + } else { + this.utmId = Optional.of(utmId.get()); + } + return this; + } + + /** + *

UTM medium parameter.

+ */ + @JsonSetter(value = "utm_medium", nulls = Nulls.SKIP) + public Builder utmMedium(Optional utmMedium) { + this.utmMedium = utmMedium; + return this; + } + + public Builder utmMedium(String utmMedium) { + this.utmMedium = Optional.ofNullable(utmMedium); + return this; + } + + public Builder utmMedium(Nullable utmMedium) { + if (utmMedium.isNull()) { + this.utmMedium = null; + } else if (utmMedium.isEmpty()) { + this.utmMedium = Optional.empty(); + } else { + this.utmMedium = Optional.of(utmMedium.get()); + } + return this; + } + + /** + *

UTM source parameter.

+ */ + @JsonSetter(value = "utm_source", nulls = Nulls.SKIP) + public Builder utmSource(Optional utmSource) { + this.utmSource = utmSource; + return this; + } + + public Builder utmSource(String utmSource) { + this.utmSource = Optional.ofNullable(utmSource); + return this; + } + + public Builder utmSource(Nullable utmSource) { + if (utmSource.isNull()) { + this.utmSource = null; + } else if (utmSource.isEmpty()) { + this.utmSource = Optional.empty(); + } else { + this.utmSource = Optional.of(utmSource.get()); + } + return this; + } + + /** + *

UTM term parameter.

+ */ + @JsonSetter(value = "utm_term", nulls = Nulls.SKIP) + public Builder utmTerm(Optional utmTerm) { + this.utmTerm = utmTerm; + return this; + } + + public Builder utmTerm(String utmTerm) { + this.utmTerm = Optional.ofNullable(utmTerm); + return this; + } + + public Builder utmTerm(Nullable utmTerm) { + if (utmTerm.isNull()) { + this.utmTerm = null; + } else if (utmTerm.isEmpty()) { + this.utmTerm = Optional.empty(); + } else { + this.utmTerm = Optional.of(utmTerm.get()); + } + return this; + } + + /** + *

Google Ads wbraid click ID (iOS privacy).

+ */ + @JsonSetter(value = "wbraid", nulls = Nulls.SKIP) + public Builder wbraid(Optional wbraid) { + this.wbraid = wbraid; + return this; + } + + public Builder wbraid(String wbraid) { + this.wbraid = Optional.ofNullable(wbraid); + return this; + } + + public Builder wbraid(Nullable wbraid) { + if (wbraid.isNull()) { + this.wbraid = null; + } else if (wbraid.isEmpty()) { + this.wbraid = Optional.empty(); + } else { + this.wbraid = Optional.of(wbraid.get()); + } + return this; + } + + public CreateEventsRequestContext build() { + return new CreateEventsRequestContext( + adCampaignId, + adId, + adSetId, + fbc, + fbclid, + fbp, + fingerprint, + fingerprintConfidence, + ga, + gbraid, + gclid, + igSid, + ipAddress, + language, + liFatId, + msclkid, + rdtCid, + sccid, + screenResolution, + timezone, + ttclid, + ttp, + twclid, + userAgent, + utmCampaign, + utmContent, + utmId, + utmMedium, + utmSource, + utmTerm, + wbraid, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/CreateEventsRequestCurrency.java b/src/main/java/com/whop/api/resources/events/types/CreateEventsRequestCurrency.java new file mode 100644 index 00000000..220fdfd7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/CreateEventsRequestCurrency.java @@ -0,0 +1,965 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateEventsRequestCurrency { + public static final CreateEventsRequestCurrency CRC = new CreateEventsRequestCurrency(Value.CRC, "crc"); + + public static final CreateEventsRequestCurrency OMR = new CreateEventsRequestCurrency(Value.OMR, "omr"); + + public static final CreateEventsRequestCurrency RUB = new CreateEventsRequestCurrency(Value.RUB, "rub"); + + public static final CreateEventsRequestCurrency BGN = new CreateEventsRequestCurrency(Value.BGN, "bgn"); + + public static final CreateEventsRequestCurrency SAR = new CreateEventsRequestCurrency(Value.SAR, "sar"); + + public static final CreateEventsRequestCurrency UYU = new CreateEventsRequestCurrency(Value.UYU, "uyu"); + + public static final CreateEventsRequestCurrency TZS = new CreateEventsRequestCurrency(Value.TZS, "tzs"); + + public static final CreateEventsRequestCurrency XCD = new CreateEventsRequestCurrency(Value.XCD, "xcd"); + + public static final CreateEventsRequestCurrency GTQ = new CreateEventsRequestCurrency(Value.GTQ, "gtq"); + + public static final CreateEventsRequestCurrency CHF = new CreateEventsRequestCurrency(Value.CHF, "chf"); + + public static final CreateEventsRequestCurrency RON = new CreateEventsRequestCurrency(Value.RON, "ron"); + + public static final CreateEventsRequestCurrency PHP = new CreateEventsRequestCurrency(Value.PHP, "php"); + + public static final CreateEventsRequestCurrency KES = new CreateEventsRequestCurrency(Value.KES, "kes"); + + public static final CreateEventsRequestCurrency XAU = new CreateEventsRequestCurrency(Value.XAU, "xau"); + + public static final CreateEventsRequestCurrency BSD = new CreateEventsRequestCurrency(Value.BSD, "bsd"); + + public static final CreateEventsRequestCurrency INR = new CreateEventsRequestCurrency(Value.INR, "inr"); + + public static final CreateEventsRequestCurrency HKD = new CreateEventsRequestCurrency(Value.HKD, "hkd"); + + public static final CreateEventsRequestCurrency JOD = new CreateEventsRequestCurrency(Value.JOD, "jod"); + + public static final CreateEventsRequestCurrency MKD = new CreateEventsRequestCurrency(Value.MKD, "mkd"); + + public static final CreateEventsRequestCurrency CLP = new CreateEventsRequestCurrency(Value.CLP, "clp"); + + public static final CreateEventsRequestCurrency NZD = new CreateEventsRequestCurrency(Value.NZD, "nzd"); + + public static final CreateEventsRequestCurrency IDR = new CreateEventsRequestCurrency(Value.IDR, "idr"); + + public static final CreateEventsRequestCurrency MOP = new CreateEventsRequestCurrency(Value.MOP, "mop"); + + public static final CreateEventsRequestCurrency HUF = new CreateEventsRequestCurrency(Value.HUF, "huf"); + + public static final CreateEventsRequestCurrency MAD = new CreateEventsRequestCurrency(Value.MAD, "mad"); + + public static final CreateEventsRequestCurrency KHR = new CreateEventsRequestCurrency(Value.KHR, "khr"); + + public static final CreateEventsRequestCurrency NGN = new CreateEventsRequestCurrency(Value.NGN, "ngn"); + + public static final CreateEventsRequestCurrency THB = new CreateEventsRequestCurrency(Value.THB, "thb"); + + public static final CreateEventsRequestCurrency DZD = new CreateEventsRequestCurrency(Value.DZD, "dzd"); + + public static final CreateEventsRequestCurrency ARS = new CreateEventsRequestCurrency(Value.ARS, "ars"); + + public static final CreateEventsRequestCurrency CAD = new CreateEventsRequestCurrency(Value.CAD, "cad"); + + public static final CreateEventsRequestCurrency MYR = new CreateEventsRequestCurrency(Value.MYR, "myr"); + + public static final CreateEventsRequestCurrency KRW = new CreateEventsRequestCurrency(Value.KRW, "krw"); + + public static final CreateEventsRequestCurrency KZT = new CreateEventsRequestCurrency(Value.KZT, "kzt"); + + public static final CreateEventsRequestCurrency ETH = new CreateEventsRequestCurrency(Value.ETH, "eth"); + + public static final CreateEventsRequestCurrency COP = new CreateEventsRequestCurrency(Value.COP, "cop"); + + public static final CreateEventsRequestCurrency JMD = new CreateEventsRequestCurrency(Value.JMD, "jmd"); + + public static final CreateEventsRequestCurrency NAD = new CreateEventsRequestCurrency(Value.NAD, "nad"); + + public static final CreateEventsRequestCurrency GYD = new CreateEventsRequestCurrency(Value.GYD, "gyd"); + + public static final CreateEventsRequestCurrency KWD = new CreateEventsRequestCurrency(Value.KWD, "kwd"); + + public static final CreateEventsRequestCurrency DOP = new CreateEventsRequestCurrency(Value.DOP, "dop"); + + public static final CreateEventsRequestCurrency BTC = new CreateEventsRequestCurrency(Value.BTC, "btc"); + + public static final CreateEventsRequestCurrency AMD = new CreateEventsRequestCurrency(Value.AMD, "amd"); + + public static final CreateEventsRequestCurrency LKR = new CreateEventsRequestCurrency(Value.LKR, "lkr"); + + public static final CreateEventsRequestCurrency ALL = new CreateEventsRequestCurrency(Value.ALL, "all"); + + public static final CreateEventsRequestCurrency USDT = new CreateEventsRequestCurrency(Value.USDT, "usdt"); + + public static final CreateEventsRequestCurrency TND = new CreateEventsRequestCurrency(Value.TND, "tnd"); + + public static final CreateEventsRequestCurrency MUR = new CreateEventsRequestCurrency(Value.MUR, "mur"); + + public static final CreateEventsRequestCurrency PEN = new CreateEventsRequestCurrency(Value.PEN, "pen"); + + public static final CreateEventsRequestCurrency USD = new CreateEventsRequestCurrency(Value.USD, "usd"); + + public static final CreateEventsRequestCurrency APE = new CreateEventsRequestCurrency(Value.APE, "ape"); + + public static final CreateEventsRequestCurrency BHD = new CreateEventsRequestCurrency(Value.BHD, "bhd"); + + public static final CreateEventsRequestCurrency XOF = new CreateEventsRequestCurrency(Value.XOF, "xof"); + + public static final CreateEventsRequestCurrency RWF = new CreateEventsRequestCurrency(Value.RWF, "rwf"); + + public static final CreateEventsRequestCurrency GBP = new CreateEventsRequestCurrency(Value.GBP, "gbp"); + + public static final CreateEventsRequestCurrency VND = new CreateEventsRequestCurrency(Value.VND, "vnd"); + + public static final CreateEventsRequestCurrency MNT = new CreateEventsRequestCurrency(Value.MNT, "mnt"); + + public static final CreateEventsRequestCurrency ETB = new CreateEventsRequestCurrency(Value.ETB, "etb"); + + public static final CreateEventsRequestCurrency TTD = new CreateEventsRequestCurrency(Value.TTD, "ttd"); + + public static final CreateEventsRequestCurrency EUR = new CreateEventsRequestCurrency(Value.EUR, "eur"); + + public static final CreateEventsRequestCurrency BRL = new CreateEventsRequestCurrency(Value.BRL, "brl"); + + public static final CreateEventsRequestCurrency SEK = new CreateEventsRequestCurrency(Value.SEK, "sek"); + + public static final CreateEventsRequestCurrency RSD = new CreateEventsRequestCurrency(Value.RSD, "rsd"); + + public static final CreateEventsRequestCurrency UZS = new CreateEventsRequestCurrency(Value.UZS, "uzs"); + + public static final CreateEventsRequestCurrency TWD = new CreateEventsRequestCurrency(Value.TWD, "twd"); + + public static final CreateEventsRequestCurrency NOK = new CreateEventsRequestCurrency(Value.NOK, "nok"); + + public static final CreateEventsRequestCurrency WHOP_USD = + new CreateEventsRequestCurrency(Value.WHOP_USD, "whop_usd"); + + public static final CreateEventsRequestCurrency PYG = new CreateEventsRequestCurrency(Value.PYG, "pyg"); + + public static final CreateEventsRequestCurrency TRY = new CreateEventsRequestCurrency(Value.TRY, "try"); + + public static final CreateEventsRequestCurrency ZAR = new CreateEventsRequestCurrency(Value.ZAR, "zar"); + + public static final CreateEventsRequestCurrency PKR = new CreateEventsRequestCurrency(Value.PKR, "pkr"); + + public static final CreateEventsRequestCurrency CNY = new CreateEventsRequestCurrency(Value.CNY, "cny"); + + public static final CreateEventsRequestCurrency CZK = new CreateEventsRequestCurrency(Value.CZK, "czk"); + + public static final CreateEventsRequestCurrency ILS = new CreateEventsRequestCurrency(Value.ILS, "ils"); + + public static final CreateEventsRequestCurrency MGA = new CreateEventsRequestCurrency(Value.MGA, "mga"); + + public static final CreateEventsRequestCurrency AED = new CreateEventsRequestCurrency(Value.AED, "aed"); + + public static final CreateEventsRequestCurrency GHS = new CreateEventsRequestCurrency(Value.GHS, "ghs"); + + public static final CreateEventsRequestCurrency BAM = new CreateEventsRequestCurrency(Value.BAM, "bam"); + + public static final CreateEventsRequestCurrency JPY = new CreateEventsRequestCurrency(Value.JPY, "jpy"); + + public static final CreateEventsRequestCurrency PLN = new CreateEventsRequestCurrency(Value.PLN, "pln"); + + public static final CreateEventsRequestCurrency BOB = new CreateEventsRequestCurrency(Value.BOB, "bob"); + + public static final CreateEventsRequestCurrency QAR = new CreateEventsRequestCurrency(Value.QAR, "qar"); + + public static final CreateEventsRequestCurrency EGP = new CreateEventsRequestCurrency(Value.EGP, "egp"); + + public static final CreateEventsRequestCurrency AWG = new CreateEventsRequestCurrency(Value.AWG, "awg"); + + public static final CreateEventsRequestCurrency DKK = new CreateEventsRequestCurrency(Value.DKK, "dkk"); + + public static final CreateEventsRequestCurrency MDL = new CreateEventsRequestCurrency(Value.MDL, "mdl"); + + public static final CreateEventsRequestCurrency MXN = new CreateEventsRequestCurrency(Value.MXN, "mxn"); + + public static final CreateEventsRequestCurrency SGD = new CreateEventsRequestCurrency(Value.SGD, "sgd"); + + public static final CreateEventsRequestCurrency AUD = new CreateEventsRequestCurrency(Value.AUD, "aud"); + + public static final CreateEventsRequestCurrency GMD = new CreateEventsRequestCurrency(Value.GMD, "gmd"); + + private final Value value; + + private final String string; + + CreateEventsRequestCurrency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateEventsRequestCurrency + && this.string.equals(((CreateEventsRequestCurrency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CRC: + return visitor.visitCrc(); + case OMR: + return visitor.visitOmr(); + case RUB: + return visitor.visitRub(); + case BGN: + return visitor.visitBgn(); + case SAR: + return visitor.visitSar(); + case UYU: + return visitor.visitUyu(); + case TZS: + return visitor.visitTzs(); + case XCD: + return visitor.visitXcd(); + case GTQ: + return visitor.visitGtq(); + case CHF: + return visitor.visitChf(); + case RON: + return visitor.visitRon(); + case PHP: + return visitor.visitPhp(); + case KES: + return visitor.visitKes(); + case XAU: + return visitor.visitXau(); + case BSD: + return visitor.visitBsd(); + case INR: + return visitor.visitInr(); + case HKD: + return visitor.visitHkd(); + case JOD: + return visitor.visitJod(); + case MKD: + return visitor.visitMkd(); + case CLP: + return visitor.visitClp(); + case NZD: + return visitor.visitNzd(); + case IDR: + return visitor.visitIdr(); + case MOP: + return visitor.visitMop(); + case HUF: + return visitor.visitHuf(); + case MAD: + return visitor.visitMad(); + case KHR: + return visitor.visitKhr(); + case NGN: + return visitor.visitNgn(); + case THB: + return visitor.visitThb(); + case DZD: + return visitor.visitDzd(); + case ARS: + return visitor.visitArs(); + case CAD: + return visitor.visitCad(); + case MYR: + return visitor.visitMyr(); + case KRW: + return visitor.visitKrw(); + case KZT: + return visitor.visitKzt(); + case ETH: + return visitor.visitEth(); + case COP: + return visitor.visitCop(); + case JMD: + return visitor.visitJmd(); + case NAD: + return visitor.visitNad(); + case GYD: + return visitor.visitGyd(); + case KWD: + return visitor.visitKwd(); + case DOP: + return visitor.visitDop(); + case BTC: + return visitor.visitBtc(); + case AMD: + return visitor.visitAmd(); + case LKR: + return visitor.visitLkr(); + case ALL: + return visitor.visitAll(); + case USDT: + return visitor.visitUsdt(); + case TND: + return visitor.visitTnd(); + case MUR: + return visitor.visitMur(); + case PEN: + return visitor.visitPen(); + case USD: + return visitor.visitUsd(); + case APE: + return visitor.visitApe(); + case BHD: + return visitor.visitBhd(); + case XOF: + return visitor.visitXof(); + case RWF: + return visitor.visitRwf(); + case GBP: + return visitor.visitGbp(); + case VND: + return visitor.visitVnd(); + case MNT: + return visitor.visitMnt(); + case ETB: + return visitor.visitEtb(); + case TTD: + return visitor.visitTtd(); + case EUR: + return visitor.visitEur(); + case BRL: + return visitor.visitBrl(); + case SEK: + return visitor.visitSek(); + case RSD: + return visitor.visitRsd(); + case UZS: + return visitor.visitUzs(); + case TWD: + return visitor.visitTwd(); + case NOK: + return visitor.visitNok(); + case WHOP_USD: + return visitor.visitWhopUsd(); + case PYG: + return visitor.visitPyg(); + case TRY: + return visitor.visitTry(); + case ZAR: + return visitor.visitZar(); + case PKR: + return visitor.visitPkr(); + case CNY: + return visitor.visitCny(); + case CZK: + return visitor.visitCzk(); + case ILS: + return visitor.visitIls(); + case MGA: + return visitor.visitMga(); + case AED: + return visitor.visitAed(); + case GHS: + return visitor.visitGhs(); + case BAM: + return visitor.visitBam(); + case JPY: + return visitor.visitJpy(); + case PLN: + return visitor.visitPln(); + case BOB: + return visitor.visitBob(); + case QAR: + return visitor.visitQar(); + case EGP: + return visitor.visitEgp(); + case AWG: + return visitor.visitAwg(); + case DKK: + return visitor.visitDkk(); + case MDL: + return visitor.visitMdl(); + case MXN: + return visitor.visitMxn(); + case SGD: + return visitor.visitSgd(); + case AUD: + return visitor.visitAud(); + case GMD: + return visitor.visitGmd(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateEventsRequestCurrency valueOf(String value) { + switch (value) { + case "crc": + return CRC; + case "omr": + return OMR; + case "rub": + return RUB; + case "bgn": + return BGN; + case "sar": + return SAR; + case "uyu": + return UYU; + case "tzs": + return TZS; + case "xcd": + return XCD; + case "gtq": + return GTQ; + case "chf": + return CHF; + case "ron": + return RON; + case "php": + return PHP; + case "kes": + return KES; + case "xau": + return XAU; + case "bsd": + return BSD; + case "inr": + return INR; + case "hkd": + return HKD; + case "jod": + return JOD; + case "mkd": + return MKD; + case "clp": + return CLP; + case "nzd": + return NZD; + case "idr": + return IDR; + case "mop": + return MOP; + case "huf": + return HUF; + case "mad": + return MAD; + case "khr": + return KHR; + case "ngn": + return NGN; + case "thb": + return THB; + case "dzd": + return DZD; + case "ars": + return ARS; + case "cad": + return CAD; + case "myr": + return MYR; + case "krw": + return KRW; + case "kzt": + return KZT; + case "eth": + return ETH; + case "cop": + return COP; + case "jmd": + return JMD; + case "nad": + return NAD; + case "gyd": + return GYD; + case "kwd": + return KWD; + case "dop": + return DOP; + case "btc": + return BTC; + case "amd": + return AMD; + case "lkr": + return LKR; + case "all": + return ALL; + case "usdt": + return USDT; + case "tnd": + return TND; + case "mur": + return MUR; + case "pen": + return PEN; + case "usd": + return USD; + case "ape": + return APE; + case "bhd": + return BHD; + case "xof": + return XOF; + case "rwf": + return RWF; + case "gbp": + return GBP; + case "vnd": + return VND; + case "mnt": + return MNT; + case "etb": + return ETB; + case "ttd": + return TTD; + case "eur": + return EUR; + case "brl": + return BRL; + case "sek": + return SEK; + case "rsd": + return RSD; + case "uzs": + return UZS; + case "twd": + return TWD; + case "nok": + return NOK; + case "whop_usd": + return WHOP_USD; + case "pyg": + return PYG; + case "try": + return TRY; + case "zar": + return ZAR; + case "pkr": + return PKR; + case "cny": + return CNY; + case "czk": + return CZK; + case "ils": + return ILS; + case "mga": + return MGA; + case "aed": + return AED; + case "ghs": + return GHS; + case "bam": + return BAM; + case "jpy": + return JPY; + case "pln": + return PLN; + case "bob": + return BOB; + case "qar": + return QAR; + case "egp": + return EGP; + case "awg": + return AWG; + case "dkk": + return DKK; + case "mdl": + return MDL; + case "mxn": + return MXN; + case "sgd": + return SGD; + case "aud": + return AUD; + case "gmd": + return GMD; + default: + return new CreateEventsRequestCurrency(Value.UNKNOWN, value); + } + } + + public enum Value { + USD, + + SGD, + + INR, + + AUD, + + BRL, + + CAD, + + DKK, + + EUR, + + NOK, + + GBP, + + SEK, + + CHF, + + HKD, + + HUF, + + JPY, + + MXN, + + MYR, + + PLN, + + CZK, + + NZD, + + AED, + + ETH, + + APE, + + COP, + + RON, + + THB, + + BGN, + + IDR, + + DOP, + + PHP, + + TRY, + + KRW, + + TWD, + + VND, + + PKR, + + CLP, + + UYU, + + ARS, + + ZAR, + + DZD, + + TND, + + MAD, + + KES, + + KWD, + + JOD, + + ALL, + + XCD, + + AMD, + + BSD, + + BHD, + + BOB, + + BAM, + + KHR, + + CRC, + + XOF, + + EGP, + + ETB, + + GMD, + + GHS, + + GTQ, + + GYD, + + ILS, + + JMD, + + MOP, + + MGA, + + MUR, + + MDL, + + MNT, + + NAD, + + NGN, + + MKD, + + OMR, + + PYG, + + PEN, + + QAR, + + RWF, + + SAR, + + RSD, + + LKR, + + TZS, + + TTD, + + UZS, + + RUB, + + BTC, + + CNY, + + USDT, + + KZT, + + AWG, + + WHOP_USD, + + XAU, + + UNKNOWN + } + + public interface Visitor { + T visitUsd(); + + T visitSgd(); + + T visitInr(); + + T visitAud(); + + T visitBrl(); + + T visitCad(); + + T visitDkk(); + + T visitEur(); + + T visitNok(); + + T visitGbp(); + + T visitSek(); + + T visitChf(); + + T visitHkd(); + + T visitHuf(); + + T visitJpy(); + + T visitMxn(); + + T visitMyr(); + + T visitPln(); + + T visitCzk(); + + T visitNzd(); + + T visitAed(); + + T visitEth(); + + T visitApe(); + + T visitCop(); + + T visitRon(); + + T visitThb(); + + T visitBgn(); + + T visitIdr(); + + T visitDop(); + + T visitPhp(); + + T visitTry(); + + T visitKrw(); + + T visitTwd(); + + T visitVnd(); + + T visitPkr(); + + T visitClp(); + + T visitUyu(); + + T visitArs(); + + T visitZar(); + + T visitDzd(); + + T visitTnd(); + + T visitMad(); + + T visitKes(); + + T visitKwd(); + + T visitJod(); + + T visitAll(); + + T visitXcd(); + + T visitAmd(); + + T visitBsd(); + + T visitBhd(); + + T visitBob(); + + T visitBam(); + + T visitKhr(); + + T visitCrc(); + + T visitXof(); + + T visitEgp(); + + T visitEtb(); + + T visitGmd(); + + T visitGhs(); + + T visitGtq(); + + T visitGyd(); + + T visitIls(); + + T visitJmd(); + + T visitMop(); + + T visitMga(); + + T visitMur(); + + T visitMdl(); + + T visitMnt(); + + T visitNad(); + + T visitNgn(); + + T visitMkd(); + + T visitOmr(); + + T visitPyg(); + + T visitPen(); + + T visitQar(); + + T visitRwf(); + + T visitSar(); + + T visitRsd(); + + T visitLkr(); + + T visitTzs(); + + T visitTtd(); + + T visitUzs(); + + T visitRub(); + + T visitBtc(); + + T visitCny(); + + T visitUsdt(); + + T visitKzt(); + + T visitAwg(); + + T visitWhopUsd(); + + T visitXau(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/CreateEventsRequestUser.java b/src/main/java/com/whop/api/resources/events/types/CreateEventsRequestUser.java new file mode 100644 index 00000000..9905ee96 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/CreateEventsRequestUser.java @@ -0,0 +1,1075 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateEventsRequestUser.Builder.class) +public final class CreateEventsRequestUser { + private final Optional anonymousId; + + private final Optional birthdate; + + private final Optional city; + + private final Optional country; + + private final Optional email; + + private final Optional externalId; + + private final Optional firstName; + + private final Optional gender; + + private final Optional lastName; + + private final Optional linkedAnonymousId; + + private final Optional linkedWuid; + + private final Optional memberId; + + private final Optional membershipId; + + private final Optional name; + + private final Optional phone; + + private final Optional postalCode; + + private final Optional state; + + private final Optional userId; + + private final Optional username; + + private final Map additionalProperties; + + private CreateEventsRequestUser( + Optional anonymousId, + Optional birthdate, + Optional city, + Optional country, + Optional email, + Optional externalId, + Optional firstName, + Optional gender, + Optional lastName, + Optional linkedAnonymousId, + Optional linkedWuid, + Optional memberId, + Optional membershipId, + Optional name, + Optional phone, + Optional postalCode, + Optional state, + Optional userId, + Optional username, + Map additionalProperties) { + this.anonymousId = anonymousId; + this.birthdate = birthdate; + this.city = city; + this.country = country; + this.email = email; + this.externalId = externalId; + this.firstName = firstName; + this.gender = gender; + this.lastName = lastName; + this.linkedAnonymousId = linkedAnonymousId; + this.linkedWuid = linkedWuid; + this.memberId = memberId; + this.membershipId = membershipId; + this.name = name; + this.phone = phone; + this.postalCode = postalCode; + this.state = state; + this.userId = userId; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return An anonymous identifier for the user. + */ + @JsonIgnore + public Optional getAnonymousId() { + if (anonymousId == null) { + return Optional.empty(); + } + return anonymousId; + } + + /** + * @return Date of birth (YYYY-MM-DD). + */ + @JsonIgnore + public Optional getBirthdate() { + if (birthdate == null) { + return Optional.empty(); + } + return birthdate; + } + + /** + * @return City. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Country. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return Email address. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return An external identifier for the user. + */ + @JsonIgnore + public Optional getExternalId() { + if (externalId == null) { + return Optional.empty(); + } + return externalId; + } + + /** + * @return First name. + */ + @JsonIgnore + public Optional getFirstName() { + if (firstName == null) { + return Optional.empty(); + } + return firstName; + } + + /** + * @return Gender. + */ + @JsonIgnore + public Optional getGender() { + if (gender == null) { + return Optional.empty(); + } + return gender; + } + + /** + * @return Last name. + */ + @JsonIgnore + public Optional getLastName() { + if (lastName == null) { + return Optional.empty(); + } + return lastName; + } + + /** + * @return A second anonymous identifier to link to this user (e.g. captured across an iframe boundary). + */ + @JsonIgnore + public Optional getLinkedAnonymousId() { + if (linkedAnonymousId == null) { + return Optional.empty(); + } + return linkedAnonymousId; + } + + /** + * @return A wuid from a linked frame, captured across an iframe boundary. + */ + @JsonIgnore + public Optional getLinkedWuid() { + if (linkedWuid == null) { + return Optional.empty(); + } + return linkedWuid; + } + + /** + * @return The Whop member ID. + */ + @JsonIgnore + public Optional getMemberId() { + if (memberId == null) { + return Optional.empty(); + } + return memberId; + } + + /** + * @return The Whop membership ID. + */ + @JsonIgnore + public Optional getMembershipId() { + if (membershipId == null) { + return Optional.empty(); + } + return membershipId; + } + + /** + * @return Full display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return Phone number. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + /** + * @return Postal code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return State or region. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + /** + * @return The Whop user ID. + */ + @JsonIgnore + public Optional getUserId() { + if (userId == null) { + return Optional.empty(); + } + return userId; + } + + /** + * @return Username. + */ + @JsonIgnore + public Optional getUsername() { + if (username == null) { + return Optional.empty(); + } + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("anonymous_id") + private Optional _getAnonymousId() { + return anonymousId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("birthdate") + private Optional _getBirthdate() { + return birthdate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("external_id") + private Optional _getExternalId() { + return externalId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_name") + private Optional _getFirstName() { + return firstName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("gender") + private Optional _getGender() { + return gender; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_name") + private Optional _getLastName() { + return lastName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("linked_anonymous_id") + private Optional _getLinkedAnonymousId() { + return linkedAnonymousId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("linked_wuid") + private Optional _getLinkedWuid() { + return linkedWuid; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member_id") + private Optional _getMemberId() { + return memberId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("membership_id") + private Optional _getMembershipId() { + return membershipId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_id") + private Optional _getUserId() { + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("username") + private Optional _getUsername() { + return username; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateEventsRequestUser && equalTo((CreateEventsRequestUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateEventsRequestUser other) { + return anonymousId.equals(other.anonymousId) + && birthdate.equals(other.birthdate) + && city.equals(other.city) + && country.equals(other.country) + && email.equals(other.email) + && externalId.equals(other.externalId) + && firstName.equals(other.firstName) + && gender.equals(other.gender) + && lastName.equals(other.lastName) + && linkedAnonymousId.equals(other.linkedAnonymousId) + && linkedWuid.equals(other.linkedWuid) + && memberId.equals(other.memberId) + && membershipId.equals(other.membershipId) + && name.equals(other.name) + && phone.equals(other.phone) + && postalCode.equals(other.postalCode) + && state.equals(other.state) + && userId.equals(other.userId) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.anonymousId, + this.birthdate, + this.city, + this.country, + this.email, + this.externalId, + this.firstName, + this.gender, + this.lastName, + this.linkedAnonymousId, + this.linkedWuid, + this.memberId, + this.membershipId, + this.name, + this.phone, + this.postalCode, + this.state, + this.userId, + this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional anonymousId = Optional.empty(); + + private Optional birthdate = Optional.empty(); + + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional externalId = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional gender = Optional.empty(); + + private Optional lastName = Optional.empty(); + + private Optional linkedAnonymousId = Optional.empty(); + + private Optional linkedWuid = Optional.empty(); + + private Optional memberId = Optional.empty(); + + private Optional membershipId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional username = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateEventsRequestUser other) { + anonymousId(other.getAnonymousId()); + birthdate(other.getBirthdate()); + city(other.getCity()); + country(other.getCountry()); + email(other.getEmail()); + externalId(other.getExternalId()); + firstName(other.getFirstName()); + gender(other.getGender()); + lastName(other.getLastName()); + linkedAnonymousId(other.getLinkedAnonymousId()); + linkedWuid(other.getLinkedWuid()); + memberId(other.getMemberId()); + membershipId(other.getMembershipId()); + name(other.getName()); + phone(other.getPhone()); + postalCode(other.getPostalCode()); + state(other.getState()); + userId(other.getUserId()); + username(other.getUsername()); + return this; + } + + /** + *

An anonymous identifier for the user.

+ */ + @JsonSetter(value = "anonymous_id", nulls = Nulls.SKIP) + public Builder anonymousId(Optional anonymousId) { + this.anonymousId = anonymousId; + return this; + } + + public Builder anonymousId(String anonymousId) { + this.anonymousId = Optional.ofNullable(anonymousId); + return this; + } + + public Builder anonymousId(Nullable anonymousId) { + if (anonymousId.isNull()) { + this.anonymousId = null; + } else if (anonymousId.isEmpty()) { + this.anonymousId = Optional.empty(); + } else { + this.anonymousId = Optional.of(anonymousId.get()); + } + return this; + } + + /** + *

Date of birth (YYYY-MM-DD).

+ */ + @JsonSetter(value = "birthdate", nulls = Nulls.SKIP) + public Builder birthdate(Optional birthdate) { + this.birthdate = birthdate; + return this; + } + + public Builder birthdate(String birthdate) { + this.birthdate = Optional.ofNullable(birthdate); + return this; + } + + public Builder birthdate(Nullable birthdate) { + if (birthdate.isNull()) { + this.birthdate = null; + } else if (birthdate.isEmpty()) { + this.birthdate = Optional.empty(); + } else { + this.birthdate = Optional.of(birthdate.get()); + } + return this; + } + + /** + *

City.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Country.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

Email address.

+ */ + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + public Builder email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

An external identifier for the user.

+ */ + @JsonSetter(value = "external_id", nulls = Nulls.SKIP) + public Builder externalId(Optional externalId) { + this.externalId = externalId; + return this; + } + + public Builder externalId(String externalId) { + this.externalId = Optional.ofNullable(externalId); + return this; + } + + public Builder externalId(Nullable externalId) { + if (externalId.isNull()) { + this.externalId = null; + } else if (externalId.isEmpty()) { + this.externalId = Optional.empty(); + } else { + this.externalId = Optional.of(externalId.get()); + } + return this; + } + + /** + *

First name.

+ */ + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public Builder firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + public Builder firstName(Nullable firstName) { + if (firstName.isNull()) { + this.firstName = null; + } else if (firstName.isEmpty()) { + this.firstName = Optional.empty(); + } else { + this.firstName = Optional.of(firstName.get()); + } + return this; + } + + /** + *

Gender.

+ */ + @JsonSetter(value = "gender", nulls = Nulls.SKIP) + public Builder gender(Optional gender) { + this.gender = gender; + return this; + } + + public Builder gender(CreateEventsRequestUserGender gender) { + this.gender = Optional.ofNullable(gender); + return this; + } + + public Builder gender(Nullable gender) { + if (gender.isNull()) { + this.gender = null; + } else if (gender.isEmpty()) { + this.gender = Optional.empty(); + } else { + this.gender = Optional.of(gender.get()); + } + return this; + } + + /** + *

Last name.

+ */ + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public Builder lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + public Builder lastName(Nullable lastName) { + if (lastName.isNull()) { + this.lastName = null; + } else if (lastName.isEmpty()) { + this.lastName = Optional.empty(); + } else { + this.lastName = Optional.of(lastName.get()); + } + return this; + } + + /** + *

A second anonymous identifier to link to this user (e.g. captured across an iframe boundary).

+ */ + @JsonSetter(value = "linked_anonymous_id", nulls = Nulls.SKIP) + public Builder linkedAnonymousId(Optional linkedAnonymousId) { + this.linkedAnonymousId = linkedAnonymousId; + return this; + } + + public Builder linkedAnonymousId(String linkedAnonymousId) { + this.linkedAnonymousId = Optional.ofNullable(linkedAnonymousId); + return this; + } + + public Builder linkedAnonymousId(Nullable linkedAnonymousId) { + if (linkedAnonymousId.isNull()) { + this.linkedAnonymousId = null; + } else if (linkedAnonymousId.isEmpty()) { + this.linkedAnonymousId = Optional.empty(); + } else { + this.linkedAnonymousId = Optional.of(linkedAnonymousId.get()); + } + return this; + } + + /** + *

A wuid from a linked frame, captured across an iframe boundary.

+ */ + @JsonSetter(value = "linked_wuid", nulls = Nulls.SKIP) + public Builder linkedWuid(Optional linkedWuid) { + this.linkedWuid = linkedWuid; + return this; + } + + public Builder linkedWuid(String linkedWuid) { + this.linkedWuid = Optional.ofNullable(linkedWuid); + return this; + } + + public Builder linkedWuid(Nullable linkedWuid) { + if (linkedWuid.isNull()) { + this.linkedWuid = null; + } else if (linkedWuid.isEmpty()) { + this.linkedWuid = Optional.empty(); + } else { + this.linkedWuid = Optional.of(linkedWuid.get()); + } + return this; + } + + /** + *

The Whop member ID.

+ */ + @JsonSetter(value = "member_id", nulls = Nulls.SKIP) + public Builder memberId(Optional memberId) { + this.memberId = memberId; + return this; + } + + public Builder memberId(String memberId) { + this.memberId = Optional.ofNullable(memberId); + return this; + } + + public Builder memberId(Nullable memberId) { + if (memberId.isNull()) { + this.memberId = null; + } else if (memberId.isEmpty()) { + this.memberId = Optional.empty(); + } else { + this.memberId = Optional.of(memberId.get()); + } + return this; + } + + /** + *

The Whop membership ID.

+ */ + @JsonSetter(value = "membership_id", nulls = Nulls.SKIP) + public Builder membershipId(Optional membershipId) { + this.membershipId = membershipId; + return this; + } + + public Builder membershipId(String membershipId) { + this.membershipId = Optional.ofNullable(membershipId); + return this; + } + + public Builder membershipId(Nullable membershipId) { + if (membershipId.isNull()) { + this.membershipId = null; + } else if (membershipId.isEmpty()) { + this.membershipId = Optional.empty(); + } else { + this.membershipId = Optional.of(membershipId.get()); + } + return this; + } + + /** + *

Full display name.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Phone number.

+ */ + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + public Builder phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

Postal code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

State or region.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + /** + *

The Whop user ID.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + public Builder userId(Nullable userId) { + if (userId.isNull()) { + this.userId = null; + } else if (userId.isEmpty()) { + this.userId = Optional.empty(); + } else { + this.userId = Optional.of(userId.get()); + } + return this; + } + + /** + *

Username.

+ */ + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public Builder username(Optional username) { + this.username = username; + return this; + } + + public Builder username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + public Builder username(Nullable username) { + if (username.isNull()) { + this.username = null; + } else if (username.isEmpty()) { + this.username = Optional.empty(); + } else { + this.username = Optional.of(username.get()); + } + return this; + } + + public CreateEventsRequestUser build() { + return new CreateEventsRequestUser( + anonymousId, + birthdate, + city, + country, + email, + externalId, + firstName, + gender, + lastName, + linkedAnonymousId, + linkedWuid, + memberId, + membershipId, + name, + phone, + postalCode, + state, + userId, + username, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/CreateEventsRequestUserGender.java b/src/main/java/com/whop/api/resources/events/types/CreateEventsRequestUserGender.java new file mode 100644 index 00000000..02f70bd1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/CreateEventsRequestUserGender.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateEventsRequestUserGender { + public static final CreateEventsRequestUserGender MALE = new CreateEventsRequestUserGender(Value.MALE, "male"); + + public static final CreateEventsRequestUserGender FEMALE = + new CreateEventsRequestUserGender(Value.FEMALE, "female"); + + private final Value value; + + private final String string; + + CreateEventsRequestUserGender(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateEventsRequestUserGender + && this.string.equals(((CreateEventsRequestUserGender) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MALE: + return visitor.visitMale(); + case FEMALE: + return visitor.visitFemale(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateEventsRequestUserGender valueOf(String value) { + switch (value) { + case "male": + return MALE; + case "female": + return FEMALE; + default: + return new CreateEventsRequestUserGender(Value.UNKNOWN, value); + } + } + + public enum Value { + MALE, + + FEMALE, + + UNKNOWN + } + + public interface Visitor { + T visitMale(); + + T visitFemale(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/CreateEventsResponse.java b/src/main/java/com/whop/api/resources/events/types/CreateEventsResponse.java new file mode 100644 index 00000000..8b8a7ca9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/CreateEventsResponse.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateEventsResponse.Builder.class) +public final class CreateEventsResponse { + private final String id; + + private final Map additionalProperties; + + private CreateEventsResponse(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateEventsResponse && equalTo((CreateEventsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateEventsResponse other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(CreateEventsResponse other); + } + + public interface _FinalStage { + CreateEventsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateEventsResponse other) { + id(other.getId()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CreateEventsResponse build() { + return new CreateEventsResponse(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsRequestAttributionModel.java b/src/main/java/com/whop/api/resources/events/types/ListEventsRequestAttributionModel.java new file mode 100644 index 00000000..95967adc --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsRequestAttributionModel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEventsRequestAttributionModel { + public static final ListEventsRequestAttributionModel FIRST_TOUCH = + new ListEventsRequestAttributionModel(Value.FIRST_TOUCH, "first_touch"); + + public static final ListEventsRequestAttributionModel LAST_TOUCH = + new ListEventsRequestAttributionModel(Value.LAST_TOUCH, "last_touch"); + + private final Value value; + + private final String string; + + ListEventsRequestAttributionModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEventsRequestAttributionModel + && this.string.equals(((ListEventsRequestAttributionModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FIRST_TOUCH: + return visitor.visitFirstTouch(); + case LAST_TOUCH: + return visitor.visitLastTouch(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEventsRequestAttributionModel valueOf(String value) { + switch (value) { + case "first_touch": + return FIRST_TOUCH; + case "last_touch": + return LAST_TOUCH; + default: + return new ListEventsRequestAttributionModel(Value.UNKNOWN, value); + } + } + + public enum Value { + LAST_TOUCH, + + FIRST_TOUCH, + + UNKNOWN + } + + public interface Visitor { + T visitLastTouch(); + + T visitFirstTouch(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsRequestDirection.java b/src/main/java/com/whop/api/resources/events/types/ListEventsRequestDirection.java new file mode 100644 index 00000000..116c9ade --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEventsRequestDirection { + public static final ListEventsRequestDirection ASC = new ListEventsRequestDirection(Value.ASC, "asc"); + + public static final ListEventsRequestDirection DESC = new ListEventsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListEventsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEventsRequestDirection + && this.string.equals(((ListEventsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEventsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListEventsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponse.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponse.java new file mode 100644 index 00000000..41302b4a --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponse.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponse.Builder.class) +public final class ListEventsResponse { + private final List data; + + private final ListEventsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListEventsResponse( + List data, + ListEventsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListEventsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponse && equalTo((ListEventsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListEventsResponsePageInfo pageInfo); + + Builder from(ListEventsResponse other); + } + + public interface _FinalStage { + ListEventsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ListEventsResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListEventsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListEventsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListEventsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ListEventsResponseDataItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListEventsResponse build() { + return new ListEventsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItem.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItem.java new file mode 100644 index 00000000..a169199e --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItem.java @@ -0,0 +1,967 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponseDataItem.Builder.class) +public final class ListEventsResponseDataItem { + private final Optional context; + + private final Optional currency; + + private final Optional customName; + + private final String eventId; + + private final String eventName; + + private final OffsetDateTime eventTime; + + private final String id; + + private final Optional path; + + private final String personId; + + private final Optional> questions; + + private final Optional recommendedActionChainId; + + private final Optional recommendedActionShownPosition; + + private final Optional referrerUrl; + + private final Optional related; + + private final Optional totalUsdAmount; + + private final Optional url; + + private final Optional user; + + private final Optional value; + + private final Map additionalProperties; + + private ListEventsResponseDataItem( + Optional context, + Optional currency, + Optional customName, + String eventId, + String eventName, + OffsetDateTime eventTime, + String id, + Optional path, + String personId, + Optional> questions, + Optional recommendedActionChainId, + Optional recommendedActionShownPosition, + Optional referrerUrl, + Optional related, + Optional totalUsdAmount, + Optional url, + Optional user, + Optional value, + Map additionalProperties) { + this.context = context; + this.currency = currency; + this.customName = customName; + this.eventId = eventId; + this.eventName = eventName; + this.eventTime = eventTime; + this.id = id; + this.path = path; + this.personId = personId; + this.questions = questions; + this.recommendedActionChainId = recommendedActionChainId; + this.recommendedActionShownPosition = recommendedActionShownPosition; + this.referrerUrl = referrerUrl; + this.related = related; + this.totalUsdAmount = totalUsdAmount; + this.url = url; + this.user = user; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getContext() { + if (context == null) { + return Optional.empty(); + } + return context; + } + + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + @JsonIgnore + public Optional getCustomName() { + if (customName == null) { + return Optional.empty(); + } + return customName; + } + + @JsonProperty("event_id") + public String getEventId() { + return eventId; + } + + @JsonProperty("event_name") + public String getEventName() { + return eventName; + } + + @JsonProperty("event_time") + public OffsetDateTime getEventTime() { + return eventTime; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getPath() { + if (path == null) { + return Optional.empty(); + } + return path; + } + + @JsonProperty("person_id") + public String getPersonId() { + return personId; + } + + @JsonIgnore + public Optional> getQuestions() { + if (questions == null) { + return Optional.empty(); + } + return questions; + } + + @JsonIgnore + public Optional getRecommendedActionChainId() { + if (recommendedActionChainId == null) { + return Optional.empty(); + } + return recommendedActionChainId; + } + + @JsonIgnore + public Optional getRecommendedActionShownPosition() { + if (recommendedActionShownPosition == null) { + return Optional.empty(); + } + return recommendedActionShownPosition; + } + + @JsonIgnore + public Optional getReferrerUrl() { + if (referrerUrl == null) { + return Optional.empty(); + } + return referrerUrl; + } + + /** + * @return Hydrated details for the records this event references. Only present keys resolved. + */ + @JsonIgnore + public Optional getRelated() { + if (related == null) { + return Optional.empty(); + } + return related; + } + + @JsonIgnore + public Optional getTotalUsdAmount() { + if (totalUsdAmount == null) { + return Optional.empty(); + } + return totalUsdAmount; + } + + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + @JsonIgnore + public Optional getValue() { + if (value == null) { + return Optional.empty(); + } + return value; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("context") + private Optional _getContext() { + return context; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_name") + private Optional _getCustomName() { + return customName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("path") + private Optional _getPath() { + return path; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("questions") + private Optional> _getQuestions() { + return questions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("recommended_action_chain_id") + private Optional _getRecommendedActionChainId() { + return recommendedActionChainId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("recommended_action_shown_position") + private Optional _getRecommendedActionShownPosition() { + return recommendedActionShownPosition; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("referrer_url") + private Optional _getReferrerUrl() { + return referrerUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("related") + private Optional _getRelated() { + return related; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("total_usd_amount") + private Optional _getTotalUsdAmount() { + return totalUsdAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("value") + private Optional _getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponseDataItem && equalTo((ListEventsResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponseDataItem other) { + return context.equals(other.context) + && currency.equals(other.currency) + && customName.equals(other.customName) + && eventId.equals(other.eventId) + && eventName.equals(other.eventName) + && eventTime.equals(other.eventTime) + && id.equals(other.id) + && path.equals(other.path) + && personId.equals(other.personId) + && questions.equals(other.questions) + && recommendedActionChainId.equals(other.recommendedActionChainId) + && recommendedActionShownPosition.equals(other.recommendedActionShownPosition) + && referrerUrl.equals(other.referrerUrl) + && related.equals(other.related) + && totalUsdAmount.equals(other.totalUsdAmount) + && url.equals(other.url) + && user.equals(other.user) + && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.context, + this.currency, + this.customName, + this.eventId, + this.eventName, + this.eventTime, + this.id, + this.path, + this.personId, + this.questions, + this.recommendedActionChainId, + this.recommendedActionShownPosition, + this.referrerUrl, + this.related, + this.totalUsdAmount, + this.url, + this.user, + this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EventIdStage builder() { + return new Builder(); + } + + public interface EventIdStage { + EventNameStage eventId(@NotNull String eventId); + + Builder from(ListEventsResponseDataItem other); + } + + public interface EventNameStage { + EventTimeStage eventName(@NotNull String eventName); + } + + public interface EventTimeStage { + IdStage eventTime(@NotNull OffsetDateTime eventTime); + } + + public interface IdStage { + PersonIdStage id(@NotNull String id); + } + + public interface PersonIdStage { + _FinalStage personId(@NotNull String personId); + } + + public interface _FinalStage { + ListEventsResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage context(Optional context); + + _FinalStage context(ListEventsResponseDataItemContext context); + + _FinalStage context(Nullable context); + + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + _FinalStage currency(Nullable currency); + + _FinalStage customName(Optional customName); + + _FinalStage customName(String customName); + + _FinalStage customName(Nullable customName); + + _FinalStage path(Optional path); + + _FinalStage path(String path); + + _FinalStage path(Nullable path); + + _FinalStage questions(Optional> questions); + + _FinalStage questions(List questions); + + _FinalStage questions(Nullable> questions); + + _FinalStage recommendedActionChainId(Optional recommendedActionChainId); + + _FinalStage recommendedActionChainId(String recommendedActionChainId); + + _FinalStage recommendedActionChainId(Nullable recommendedActionChainId); + + _FinalStage recommendedActionShownPosition(Optional recommendedActionShownPosition); + + _FinalStage recommendedActionShownPosition(Integer recommendedActionShownPosition); + + _FinalStage recommendedActionShownPosition(Nullable recommendedActionShownPosition); + + _FinalStage referrerUrl(Optional referrerUrl); + + _FinalStage referrerUrl(String referrerUrl); + + _FinalStage referrerUrl(Nullable referrerUrl); + + /** + *

Hydrated details for the records this event references. Only present keys resolved.

+ */ + _FinalStage related(Optional related); + + _FinalStage related(ListEventsResponseDataItemRelated related); + + _FinalStage related(Nullable related); + + _FinalStage totalUsdAmount(Optional totalUsdAmount); + + _FinalStage totalUsdAmount(Double totalUsdAmount); + + _FinalStage totalUsdAmount(Nullable totalUsdAmount); + + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + + _FinalStage user(Optional user); + + _FinalStage user(ListEventsResponseDataItemUser user); + + _FinalStage user(Nullable user); + + _FinalStage value(Optional value); + + _FinalStage value(Double value); + + _FinalStage value(Nullable value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements EventIdStage, EventNameStage, EventTimeStage, IdStage, PersonIdStage, _FinalStage { + private String eventId; + + private String eventName; + + private OffsetDateTime eventTime; + + private String id; + + private String personId; + + private Optional value = Optional.empty(); + + private Optional user = Optional.empty(); + + private Optional url = Optional.empty(); + + private Optional totalUsdAmount = Optional.empty(); + + private Optional related = Optional.empty(); + + private Optional referrerUrl = Optional.empty(); + + private Optional recommendedActionShownPosition = Optional.empty(); + + private Optional recommendedActionChainId = Optional.empty(); + + private Optional> questions = Optional.empty(); + + private Optional path = Optional.empty(); + + private Optional customName = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional context = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListEventsResponseDataItem other) { + context(other.getContext()); + currency(other.getCurrency()); + customName(other.getCustomName()); + eventId(other.getEventId()); + eventName(other.getEventName()); + eventTime(other.getEventTime()); + id(other.getId()); + path(other.getPath()); + personId(other.getPersonId()); + questions(other.getQuestions()); + recommendedActionChainId(other.getRecommendedActionChainId()); + recommendedActionShownPosition(other.getRecommendedActionShownPosition()); + referrerUrl(other.getReferrerUrl()); + related(other.getRelated()); + totalUsdAmount(other.getTotalUsdAmount()); + url(other.getUrl()); + user(other.getUser()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("event_id") + public EventNameStage eventId(@NotNull String eventId) { + this.eventId = Objects.requireNonNull(eventId, "eventId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("event_name") + public EventTimeStage eventName(@NotNull String eventName) { + this.eventName = Objects.requireNonNull(eventName, "eventName must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("event_time") + public IdStage eventTime(@NotNull OffsetDateTime eventTime) { + this.eventTime = Objects.requireNonNull(eventTime, "eventTime must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public PersonIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("person_id") + public _FinalStage personId(@NotNull String personId) { + this.personId = Objects.requireNonNull(personId, "personId must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage value(Nullable value) { + if (value.isNull()) { + this.value = null; + } else if (value.isEmpty()) { + this.value = Optional.empty(); + } else { + this.value = Optional.of(value.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage value(Double value) { + this.value = Optional.ofNullable(value); + return this; + } + + @java.lang.Override + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public _FinalStage value(Optional value) { + this.value = value; + return this; + } + + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage user(ListEventsResponseDataItemUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + @java.lang.Override + public _FinalStage totalUsdAmount(Nullable totalUsdAmount) { + if (totalUsdAmount.isNull()) { + this.totalUsdAmount = null; + } else if (totalUsdAmount.isEmpty()) { + this.totalUsdAmount = Optional.empty(); + } else { + this.totalUsdAmount = Optional.of(totalUsdAmount.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage totalUsdAmount(Double totalUsdAmount) { + this.totalUsdAmount = Optional.ofNullable(totalUsdAmount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "total_usd_amount", nulls = Nulls.SKIP) + public _FinalStage totalUsdAmount(Optional totalUsdAmount) { + this.totalUsdAmount = totalUsdAmount; + return this; + } + + /** + *

Hydrated details for the records this event references. Only present keys resolved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage related(Nullable related) { + if (related.isNull()) { + this.related = null; + } else if (related.isEmpty()) { + this.related = Optional.empty(); + } else { + this.related = Optional.of(related.get()); + } + return this; + } + + /** + *

Hydrated details for the records this event references. Only present keys resolved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage related(ListEventsResponseDataItemRelated related) { + this.related = Optional.ofNullable(related); + return this; + } + + /** + *

Hydrated details for the records this event references. Only present keys resolved.

+ */ + @java.lang.Override + @JsonSetter(value = "related", nulls = Nulls.SKIP) + public _FinalStage related(Optional related) { + this.related = related; + return this; + } + + @java.lang.Override + public _FinalStage referrerUrl(Nullable referrerUrl) { + if (referrerUrl.isNull()) { + this.referrerUrl = null; + } else if (referrerUrl.isEmpty()) { + this.referrerUrl = Optional.empty(); + } else { + this.referrerUrl = Optional.of(referrerUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage referrerUrl(String referrerUrl) { + this.referrerUrl = Optional.ofNullable(referrerUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "referrer_url", nulls = Nulls.SKIP) + public _FinalStage referrerUrl(Optional referrerUrl) { + this.referrerUrl = referrerUrl; + return this; + } + + @java.lang.Override + public _FinalStage recommendedActionShownPosition(Nullable recommendedActionShownPosition) { + if (recommendedActionShownPosition.isNull()) { + this.recommendedActionShownPosition = null; + } else if (recommendedActionShownPosition.isEmpty()) { + this.recommendedActionShownPosition = Optional.empty(); + } else { + this.recommendedActionShownPosition = Optional.of(recommendedActionShownPosition.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage recommendedActionShownPosition(Integer recommendedActionShownPosition) { + this.recommendedActionShownPosition = Optional.ofNullable(recommendedActionShownPosition); + return this; + } + + @java.lang.Override + @JsonSetter(value = "recommended_action_shown_position", nulls = Nulls.SKIP) + public _FinalStage recommendedActionShownPosition(Optional recommendedActionShownPosition) { + this.recommendedActionShownPosition = recommendedActionShownPosition; + return this; + } + + @java.lang.Override + public _FinalStage recommendedActionChainId(Nullable recommendedActionChainId) { + if (recommendedActionChainId.isNull()) { + this.recommendedActionChainId = null; + } else if (recommendedActionChainId.isEmpty()) { + this.recommendedActionChainId = Optional.empty(); + } else { + this.recommendedActionChainId = Optional.of(recommendedActionChainId.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage recommendedActionChainId(String recommendedActionChainId) { + this.recommendedActionChainId = Optional.ofNullable(recommendedActionChainId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "recommended_action_chain_id", nulls = Nulls.SKIP) + public _FinalStage recommendedActionChainId(Optional recommendedActionChainId) { + this.recommendedActionChainId = recommendedActionChainId; + return this; + } + + @java.lang.Override + public _FinalStage questions(Nullable> questions) { + if (questions.isNull()) { + this.questions = null; + } else if (questions.isEmpty()) { + this.questions = Optional.empty(); + } else { + this.questions = Optional.of(questions.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage questions(List questions) { + this.questions = Optional.ofNullable(questions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "questions", nulls = Nulls.SKIP) + public _FinalStage questions(Optional> questions) { + this.questions = questions; + return this; + } + + @java.lang.Override + public _FinalStage path(Nullable path) { + if (path.isNull()) { + this.path = null; + } else if (path.isEmpty()) { + this.path = Optional.empty(); + } else { + this.path = Optional.of(path.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage path(String path) { + this.path = Optional.ofNullable(path); + return this; + } + + @java.lang.Override + @JsonSetter(value = "path", nulls = Nulls.SKIP) + public _FinalStage path(Optional path) { + this.path = path; + return this; + } + + @java.lang.Override + public _FinalStage customName(Nullable customName) { + if (customName.isNull()) { + this.customName = null; + } else if (customName.isEmpty()) { + this.customName = Optional.empty(); + } else { + this.customName = Optional.of(customName.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage customName(String customName) { + this.customName = Optional.ofNullable(customName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_name", nulls = Nulls.SKIP) + public _FinalStage customName(Optional customName) { + this.customName = customName; + return this; + } + + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + @java.lang.Override + public _FinalStage context(Nullable context) { + if (context.isNull()) { + this.context = null; + } else if (context.isEmpty()) { + this.context = Optional.empty(); + } else { + this.context = Optional.of(context.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage context(ListEventsResponseDataItemContext context) { + this.context = Optional.ofNullable(context); + return this; + } + + @java.lang.Override + @JsonSetter(value = "context", nulls = Nulls.SKIP) + public _FinalStage context(Optional context) { + this.context = context; + return this; + } + + @java.lang.Override + public ListEventsResponseDataItem build() { + return new ListEventsResponseDataItem( + context, + currency, + customName, + eventId, + eventName, + eventTime, + id, + path, + personId, + questions, + recommendedActionChainId, + recommendedActionShownPosition, + referrerUrl, + related, + totalUsdAmount, + url, + user, + value, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemContext.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemContext.java new file mode 100644 index 00000000..bcd798e6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemContext.java @@ -0,0 +1,611 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponseDataItemContext.Builder.class) +public final class ListEventsResponseDataItemContext { + private final Optional adCampaignId; + + private final Optional adClickId; + + private final Optional adClickType; + + private final Optional adId; + + private final Optional adSetId; + + private final Optional sourceType; + + private final Optional utmCampaign; + + private final Optional utmContent; + + private final Optional utmMedium; + + private final Optional utmSource; + + private final Optional utmTerm; + + private final Map additionalProperties; + + private ListEventsResponseDataItemContext( + Optional adCampaignId, + Optional adClickId, + Optional adClickType, + Optional adId, + Optional adSetId, + Optional sourceType, + Optional utmCampaign, + Optional utmContent, + Optional utmMedium, + Optional utmSource, + Optional utmTerm, + Map additionalProperties) { + this.adCampaignId = adCampaignId; + this.adClickId = adClickId; + this.adClickType = adClickType; + this.adId = adId; + this.adSetId = adSetId; + this.sourceType = sourceType; + this.utmCampaign = utmCampaign; + this.utmContent = utmContent; + this.utmMedium = utmMedium; + this.utmSource = utmSource; + this.utmTerm = utmTerm; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getAdCampaignId() { + if (adCampaignId == null) { + return Optional.empty(); + } + return adCampaignId; + } + + /** + * @return Stable identity for the ad click this event belongs to. Every event from one click carries the same value, so events group into clicks without re-deriving them. + */ + @JsonIgnore + public Optional getAdClickId() { + if (adClickId == null) { + return Optional.empty(); + } + return adClickId; + } + + /** + * @return How the ad click was identified: the network's click-id param (fbclid, ttclid, gclid, gbraid, wbraid, twclid) or synthetic when the click carried none. + */ + @JsonIgnore + public Optional getAdClickType() { + if (adClickType == null) { + return Optional.empty(); + } + return adClickType; + } + + @JsonIgnore + public Optional getAdId() { + if (adId == null) { + return Optional.empty(); + } + return adId; + } + + @JsonIgnore + public Optional getAdSetId() { + if (adSetId == null) { + return Optional.empty(); + } + return adSetId; + } + + /** + * @return How this event counts as an acquisition touch, using the same rule attribution credits a conversion with. ad_click and lead_form resolved to a Whop ad; external_ad_click is a paid click on a campaign run outside Whop; referrer is organic. Null when the event is not a touch. + */ + @JsonIgnore + public Optional getSourceType() { + if (sourceType == null) { + return Optional.empty(); + } + return sourceType; + } + + @JsonIgnore + public Optional getUtmCampaign() { + if (utmCampaign == null) { + return Optional.empty(); + } + return utmCampaign; + } + + @JsonIgnore + public Optional getUtmContent() { + if (utmContent == null) { + return Optional.empty(); + } + return utmContent; + } + + @JsonIgnore + public Optional getUtmMedium() { + if (utmMedium == null) { + return Optional.empty(); + } + return utmMedium; + } + + @JsonIgnore + public Optional getUtmSource() { + if (utmSource == null) { + return Optional.empty(); + } + return utmSource; + } + + @JsonIgnore + public Optional getUtmTerm() { + if (utmTerm == null) { + return Optional.empty(); + } + return utmTerm; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_campaign_id") + private Optional _getAdCampaignId() { + return adCampaignId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_click_id") + private Optional _getAdClickId() { + return adClickId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_click_type") + private Optional _getAdClickType() { + return adClickType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_id") + private Optional _getAdId() { + return adId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_set_id") + private Optional _getAdSetId() { + return adSetId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source_type") + private Optional _getSourceType() { + return sourceType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_campaign") + private Optional _getUtmCampaign() { + return utmCampaign; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_content") + private Optional _getUtmContent() { + return utmContent; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_medium") + private Optional _getUtmMedium() { + return utmMedium; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_source") + private Optional _getUtmSource() { + return utmSource; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_term") + private Optional _getUtmTerm() { + return utmTerm; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponseDataItemContext && equalTo((ListEventsResponseDataItemContext) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponseDataItemContext other) { + return adCampaignId.equals(other.adCampaignId) + && adClickId.equals(other.adClickId) + && adClickType.equals(other.adClickType) + && adId.equals(other.adId) + && adSetId.equals(other.adSetId) + && sourceType.equals(other.sourceType) + && utmCampaign.equals(other.utmCampaign) + && utmContent.equals(other.utmContent) + && utmMedium.equals(other.utmMedium) + && utmSource.equals(other.utmSource) + && utmTerm.equals(other.utmTerm); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adCampaignId, + this.adClickId, + this.adClickType, + this.adId, + this.adSetId, + this.sourceType, + this.utmCampaign, + this.utmContent, + this.utmMedium, + this.utmSource, + this.utmTerm); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional adCampaignId = Optional.empty(); + + private Optional adClickId = Optional.empty(); + + private Optional adClickType = Optional.empty(); + + private Optional adId = Optional.empty(); + + private Optional adSetId = Optional.empty(); + + private Optional sourceType = Optional.empty(); + + private Optional utmCampaign = Optional.empty(); + + private Optional utmContent = Optional.empty(); + + private Optional utmMedium = Optional.empty(); + + private Optional utmSource = Optional.empty(); + + private Optional utmTerm = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEventsResponseDataItemContext other) { + adCampaignId(other.getAdCampaignId()); + adClickId(other.getAdClickId()); + adClickType(other.getAdClickType()); + adId(other.getAdId()); + adSetId(other.getAdSetId()); + sourceType(other.getSourceType()); + utmCampaign(other.getUtmCampaign()); + utmContent(other.getUtmContent()); + utmMedium(other.getUtmMedium()); + utmSource(other.getUtmSource()); + utmTerm(other.getUtmTerm()); + return this; + } + + @JsonSetter(value = "ad_campaign_id", nulls = Nulls.SKIP) + public Builder adCampaignId(Optional adCampaignId) { + this.adCampaignId = adCampaignId; + return this; + } + + public Builder adCampaignId(String adCampaignId) { + this.adCampaignId = Optional.ofNullable(adCampaignId); + return this; + } + + public Builder adCampaignId(Nullable adCampaignId) { + if (adCampaignId.isNull()) { + this.adCampaignId = null; + } else if (adCampaignId.isEmpty()) { + this.adCampaignId = Optional.empty(); + } else { + this.adCampaignId = Optional.of(adCampaignId.get()); + } + return this; + } + + /** + *

Stable identity for the ad click this event belongs to. Every event from one click carries the same value, so events group into clicks without re-deriving them.

+ */ + @JsonSetter(value = "ad_click_id", nulls = Nulls.SKIP) + public Builder adClickId(Optional adClickId) { + this.adClickId = adClickId; + return this; + } + + public Builder adClickId(String adClickId) { + this.adClickId = Optional.ofNullable(adClickId); + return this; + } + + public Builder adClickId(Nullable adClickId) { + if (adClickId.isNull()) { + this.adClickId = null; + } else if (adClickId.isEmpty()) { + this.adClickId = Optional.empty(); + } else { + this.adClickId = Optional.of(adClickId.get()); + } + return this; + } + + /** + *

How the ad click was identified: the network's click-id param (fbclid, ttclid, gclid, gbraid, wbraid, twclid) or synthetic when the click carried none.

+ */ + @JsonSetter(value = "ad_click_type", nulls = Nulls.SKIP) + public Builder adClickType(Optional adClickType) { + this.adClickType = adClickType; + return this; + } + + public Builder adClickType(String adClickType) { + this.adClickType = Optional.ofNullable(adClickType); + return this; + } + + public Builder adClickType(Nullable adClickType) { + if (adClickType.isNull()) { + this.adClickType = null; + } else if (adClickType.isEmpty()) { + this.adClickType = Optional.empty(); + } else { + this.adClickType = Optional.of(adClickType.get()); + } + return this; + } + + @JsonSetter(value = "ad_id", nulls = Nulls.SKIP) + public Builder adId(Optional adId) { + this.adId = adId; + return this; + } + + public Builder adId(String adId) { + this.adId = Optional.ofNullable(adId); + return this; + } + + public Builder adId(Nullable adId) { + if (adId.isNull()) { + this.adId = null; + } else if (adId.isEmpty()) { + this.adId = Optional.empty(); + } else { + this.adId = Optional.of(adId.get()); + } + return this; + } + + @JsonSetter(value = "ad_set_id", nulls = Nulls.SKIP) + public Builder adSetId(Optional adSetId) { + this.adSetId = adSetId; + return this; + } + + public Builder adSetId(String adSetId) { + this.adSetId = Optional.ofNullable(adSetId); + return this; + } + + public Builder adSetId(Nullable adSetId) { + if (adSetId.isNull()) { + this.adSetId = null; + } else if (adSetId.isEmpty()) { + this.adSetId = Optional.empty(); + } else { + this.adSetId = Optional.of(adSetId.get()); + } + return this; + } + + /** + *

How this event counts as an acquisition touch, using the same rule attribution credits a conversion with. ad_click and lead_form resolved to a Whop ad; external_ad_click is a paid click on a campaign run outside Whop; referrer is organic. Null when the event is not a touch.

+ */ + @JsonSetter(value = "source_type", nulls = Nulls.SKIP) + public Builder sourceType(Optional sourceType) { + this.sourceType = sourceType; + return this; + } + + public Builder sourceType(ListEventsResponseDataItemContextSourceType sourceType) { + this.sourceType = Optional.ofNullable(sourceType); + return this; + } + + public Builder sourceType(Nullable sourceType) { + if (sourceType.isNull()) { + this.sourceType = null; + } else if (sourceType.isEmpty()) { + this.sourceType = Optional.empty(); + } else { + this.sourceType = Optional.of(sourceType.get()); + } + return this; + } + + @JsonSetter(value = "utm_campaign", nulls = Nulls.SKIP) + public Builder utmCampaign(Optional utmCampaign) { + this.utmCampaign = utmCampaign; + return this; + } + + public Builder utmCampaign(String utmCampaign) { + this.utmCampaign = Optional.ofNullable(utmCampaign); + return this; + } + + public Builder utmCampaign(Nullable utmCampaign) { + if (utmCampaign.isNull()) { + this.utmCampaign = null; + } else if (utmCampaign.isEmpty()) { + this.utmCampaign = Optional.empty(); + } else { + this.utmCampaign = Optional.of(utmCampaign.get()); + } + return this; + } + + @JsonSetter(value = "utm_content", nulls = Nulls.SKIP) + public Builder utmContent(Optional utmContent) { + this.utmContent = utmContent; + return this; + } + + public Builder utmContent(String utmContent) { + this.utmContent = Optional.ofNullable(utmContent); + return this; + } + + public Builder utmContent(Nullable utmContent) { + if (utmContent.isNull()) { + this.utmContent = null; + } else if (utmContent.isEmpty()) { + this.utmContent = Optional.empty(); + } else { + this.utmContent = Optional.of(utmContent.get()); + } + return this; + } + + @JsonSetter(value = "utm_medium", nulls = Nulls.SKIP) + public Builder utmMedium(Optional utmMedium) { + this.utmMedium = utmMedium; + return this; + } + + public Builder utmMedium(String utmMedium) { + this.utmMedium = Optional.ofNullable(utmMedium); + return this; + } + + public Builder utmMedium(Nullable utmMedium) { + if (utmMedium.isNull()) { + this.utmMedium = null; + } else if (utmMedium.isEmpty()) { + this.utmMedium = Optional.empty(); + } else { + this.utmMedium = Optional.of(utmMedium.get()); + } + return this; + } + + @JsonSetter(value = "utm_source", nulls = Nulls.SKIP) + public Builder utmSource(Optional utmSource) { + this.utmSource = utmSource; + return this; + } + + public Builder utmSource(String utmSource) { + this.utmSource = Optional.ofNullable(utmSource); + return this; + } + + public Builder utmSource(Nullable utmSource) { + if (utmSource.isNull()) { + this.utmSource = null; + } else if (utmSource.isEmpty()) { + this.utmSource = Optional.empty(); + } else { + this.utmSource = Optional.of(utmSource.get()); + } + return this; + } + + @JsonSetter(value = "utm_term", nulls = Nulls.SKIP) + public Builder utmTerm(Optional utmTerm) { + this.utmTerm = utmTerm; + return this; + } + + public Builder utmTerm(String utmTerm) { + this.utmTerm = Optional.ofNullable(utmTerm); + return this; + } + + public Builder utmTerm(Nullable utmTerm) { + if (utmTerm.isNull()) { + this.utmTerm = null; + } else if (utmTerm.isEmpty()) { + this.utmTerm = Optional.empty(); + } else { + this.utmTerm = Optional.of(utmTerm.get()); + } + return this; + } + + public ListEventsResponseDataItemContext build() { + return new ListEventsResponseDataItemContext( + adCampaignId, + adClickId, + adClickType, + adId, + adSetId, + sourceType, + utmCampaign, + utmContent, + utmMedium, + utmSource, + utmTerm, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemContextSourceType.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemContextSourceType.java new file mode 100644 index 00000000..f0274bcf --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemContextSourceType.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEventsResponseDataItemContextSourceType { + public static final ListEventsResponseDataItemContextSourceType REFERRER = + new ListEventsResponseDataItemContextSourceType(Value.REFERRER, "referrer"); + + public static final ListEventsResponseDataItemContextSourceType LEAD_FORM = + new ListEventsResponseDataItemContextSourceType(Value.LEAD_FORM, "lead_form"); + + public static final ListEventsResponseDataItemContextSourceType EXTERNAL_AD_CLICK = + new ListEventsResponseDataItemContextSourceType(Value.EXTERNAL_AD_CLICK, "external_ad_click"); + + public static final ListEventsResponseDataItemContextSourceType AD_CLICK = + new ListEventsResponseDataItemContextSourceType(Value.AD_CLICK, "ad_click"); + + private final Value value; + + private final String string; + + ListEventsResponseDataItemContextSourceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEventsResponseDataItemContextSourceType + && this.string.equals(((ListEventsResponseDataItemContextSourceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REFERRER: + return visitor.visitReferrer(); + case LEAD_FORM: + return visitor.visitLeadForm(); + case EXTERNAL_AD_CLICK: + return visitor.visitExternalAdClick(); + case AD_CLICK: + return visitor.visitAdClick(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEventsResponseDataItemContextSourceType valueOf(String value) { + switch (value) { + case "referrer": + return REFERRER; + case "lead_form": + return LEAD_FORM; + case "external_ad_click": + return EXTERNAL_AD_CLICK; + case "ad_click": + return AD_CLICK; + default: + return new ListEventsResponseDataItemContextSourceType(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_CLICK, + + LEAD_FORM, + + EXTERNAL_AD_CLICK, + + REFERRER, + + UNKNOWN + } + + public interface Visitor { + T visitAdClick(); + + T visitLeadForm(); + + T visitExternalAdClick(); + + T visitReferrer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemQuestionsItem.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemQuestionsItem.java new file mode 100644 index 00000000..7789a978 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemQuestionsItem.java @@ -0,0 +1,353 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponseDataItemQuestionsItem.Builder.class) +public final class ListEventsResponseDataItemQuestionsItem { + private final Optional answer; + + private final Optional id; + + private final Optional key; + + private final Optional> options; + + private final Optional question; + + private final Optional type; + + private final Map additionalProperties; + + private ListEventsResponseDataItemQuestionsItem( + Optional answer, + Optional id, + Optional key, + Optional> options, + Optional question, + Optional type, + Map additionalProperties) { + this.answer = answer; + this.id = id; + this.key = key; + this.options = options; + this.question = question; + this.type = type; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getAnswer() { + if (answer == null) { + return Optional.empty(); + } + return answer; + } + + @JsonIgnore + public Optional getId() { + if (id == null) { + return Optional.empty(); + } + return id; + } + + @JsonIgnore + public Optional getKey() { + if (key == null) { + return Optional.empty(); + } + return key; + } + + @JsonIgnore + public Optional> getOptions() { + if (options == null) { + return Optional.empty(); + } + return options; + } + + @JsonIgnore + public Optional getQuestion() { + if (question == null) { + return Optional.empty(); + } + return question; + } + + @JsonIgnore + public Optional getType() { + if (type == null) { + return Optional.empty(); + } + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("answer") + private Optional _getAnswer() { + return answer; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("id") + private Optional _getId() { + return id; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("key") + private Optional _getKey() { + return key; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("options") + private Optional> _getOptions() { + return options; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("question") + private Optional _getQuestion() { + return question; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("type") + private Optional _getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponseDataItemQuestionsItem + && equalTo((ListEventsResponseDataItemQuestionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponseDataItemQuestionsItem other) { + return answer.equals(other.answer) + && id.equals(other.id) + && key.equals(other.key) + && options.equals(other.options) + && question.equals(other.question) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.answer, this.id, this.key, this.options, this.question, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional answer = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional key = Optional.empty(); + + private Optional> options = Optional.empty(); + + private Optional question = Optional.empty(); + + private Optional type = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEventsResponseDataItemQuestionsItem other) { + answer(other.getAnswer()); + id(other.getId()); + key(other.getKey()); + options(other.getOptions()); + question(other.getQuestion()); + type(other.getType()); + return this; + } + + @JsonSetter(value = "answer", nulls = Nulls.SKIP) + public Builder answer(Optional answer) { + this.answer = answer; + return this; + } + + public Builder answer(String answer) { + this.answer = Optional.ofNullable(answer); + return this; + } + + public Builder answer(Nullable answer) { + if (answer.isNull()) { + this.answer = null; + } else if (answer.isEmpty()) { + this.answer = Optional.empty(); + } else { + this.answer = Optional.of(answer.get()); + } + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public Builder id(Nullable id) { + if (id.isNull()) { + this.id = null; + } else if (id.isEmpty()) { + this.id = Optional.empty(); + } else { + this.id = Optional.of(id.get()); + } + return this; + } + + @JsonSetter(value = "key", nulls = Nulls.SKIP) + public Builder key(Optional key) { + this.key = key; + return this; + } + + public Builder key(String key) { + this.key = Optional.ofNullable(key); + return this; + } + + public Builder key(Nullable key) { + if (key.isNull()) { + this.key = null; + } else if (key.isEmpty()) { + this.key = Optional.empty(); + } else { + this.key = Optional.of(key.get()); + } + return this; + } + + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public Builder options(Optional> options) { + this.options = options; + return this; + } + + public Builder options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + public Builder options(Nullable> options) { + if (options.isNull()) { + this.options = null; + } else if (options.isEmpty()) { + this.options = Optional.empty(); + } else { + this.options = Optional.of(options.get()); + } + return this; + } + + @JsonSetter(value = "question", nulls = Nulls.SKIP) + public Builder question(Optional question) { + this.question = question; + return this; + } + + public Builder question(String question) { + this.question = Optional.ofNullable(question); + return this; + } + + public Builder question(Nullable question) { + if (question.isNull()) { + this.question = null; + } else if (question.isEmpty()) { + this.question = Optional.empty(); + } else { + this.question = Optional.of(question.get()); + } + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + public Builder type(Nullable type) { + if (type.isNull()) { + this.type = null; + } else if (type.isEmpty()) { + this.type = Optional.empty(); + } else { + this.type = Optional.of(type.get()); + } + return this; + } + + public ListEventsResponseDataItemQuestionsItem build() { + return new ListEventsResponseDataItemQuestionsItem( + answer, id, key, options, question, type, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelated.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelated.java new file mode 100644 index 00000000..4dacb3d5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelated.java @@ -0,0 +1,571 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponseDataItemRelated.Builder.class) +public final class ListEventsResponseDataItemRelated { + private final Optional account; + + private final Optional ad; + + private final Optional adCampaign; + + private final Optional adGroup; + + private final Optional app; + + private final Optional audience; + + private final Optional payment; + + private final Optional plan; + + private final Optional product; + + private final Optional user; + + private final Map additionalProperties; + + private ListEventsResponseDataItemRelated( + Optional account, + Optional ad, + Optional adCampaign, + Optional adGroup, + Optional app, + Optional audience, + Optional payment, + Optional plan, + Optional product, + Optional user, + Map additionalProperties) { + this.account = account; + this.ad = ad; + this.adCampaign = adCampaign; + this.adGroup = adGroup; + this.app = app; + this.audience = audience; + this.payment = payment; + this.plan = plan; + this.product = product; + this.user = user; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getAccount() { + if (account == null) { + return Optional.empty(); + } + return account; + } + + /** + * @return The Whop ad this event's click resolved to. + */ + @JsonIgnore + public Optional getAd() { + if (ad == null) { + return Optional.empty(); + } + return ad; + } + + /** + * @return The Whop ad campaign this event's click resolved to, read from the ad entity tree rather than the click's url params. + */ + @JsonIgnore + public Optional getAdCampaign() { + if (adCampaign == null) { + return Optional.empty(); + } + return adCampaign; + } + + /** + * @return The Whop ad group this event's click resolved to. + */ + @JsonIgnore + public Optional getAdGroup() { + if (adGroup == null) { + return Optional.empty(); + } + return adGroup; + } + + @JsonIgnore + public Optional getApp() { + if (app == null) { + return Optional.empty(); + } + return app; + } + + /** + * @return The saved audience this event came from. Present on the identify events an audience ingest writes for each of its members. + */ + @JsonIgnore + public Optional getAudience() { + if (audience == null) { + return Optional.empty(); + } + return audience; + } + + @JsonIgnore + public Optional getPayment() { + if (payment == null) { + return Optional.empty(); + } + return payment; + } + + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account") + private Optional _getAccount() { + return account; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad") + private Optional _getAd() { + return ad; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_campaign") + private Optional _getAdCampaign() { + return adCampaign; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_group") + private Optional _getAdGroup() { + return adGroup; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("app") + private Optional _getApp() { + return app; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("audience") + private Optional _getAudience() { + return audience; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment") + private Optional _getPayment() { + return payment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponseDataItemRelated && equalTo((ListEventsResponseDataItemRelated) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponseDataItemRelated other) { + return account.equals(other.account) + && ad.equals(other.ad) + && adCampaign.equals(other.adCampaign) + && adGroup.equals(other.adGroup) + && app.equals(other.app) + && audience.equals(other.audience) + && payment.equals(other.payment) + && plan.equals(other.plan) + && product.equals(other.product) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.account, + this.ad, + this.adCampaign, + this.adGroup, + this.app, + this.audience, + this.payment, + this.plan, + this.product, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional account = Optional.empty(); + + private Optional ad = Optional.empty(); + + private Optional adCampaign = Optional.empty(); + + private Optional adGroup = Optional.empty(); + + private Optional app = Optional.empty(); + + private Optional audience = Optional.empty(); + + private Optional payment = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional product = Optional.empty(); + + private Optional user = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEventsResponseDataItemRelated other) { + account(other.getAccount()); + ad(other.getAd()); + adCampaign(other.getAdCampaign()); + adGroup(other.getAdGroup()); + app(other.getApp()); + audience(other.getAudience()); + payment(other.getPayment()); + plan(other.getPlan()); + product(other.getProduct()); + user(other.getUser()); + return this; + } + + @JsonSetter(value = "account", nulls = Nulls.SKIP) + public Builder account(Optional account) { + this.account = account; + return this; + } + + public Builder account(ListEventsResponseDataItemRelatedAccount account) { + this.account = Optional.ofNullable(account); + return this; + } + + public Builder account(Nullable account) { + if (account.isNull()) { + this.account = null; + } else if (account.isEmpty()) { + this.account = Optional.empty(); + } else { + this.account = Optional.of(account.get()); + } + return this; + } + + /** + *

The Whop ad this event's click resolved to.

+ */ + @JsonSetter(value = "ad", nulls = Nulls.SKIP) + public Builder ad(Optional ad) { + this.ad = ad; + return this; + } + + public Builder ad(ListEventsResponseDataItemRelatedAd ad) { + this.ad = Optional.ofNullable(ad); + return this; + } + + public Builder ad(Nullable ad) { + if (ad.isNull()) { + this.ad = null; + } else if (ad.isEmpty()) { + this.ad = Optional.empty(); + } else { + this.ad = Optional.of(ad.get()); + } + return this; + } + + /** + *

The Whop ad campaign this event's click resolved to, read from the ad entity tree rather than the click's url params.

+ */ + @JsonSetter(value = "ad_campaign", nulls = Nulls.SKIP) + public Builder adCampaign(Optional adCampaign) { + this.adCampaign = adCampaign; + return this; + } + + public Builder adCampaign(ListEventsResponseDataItemRelatedAdCampaign adCampaign) { + this.adCampaign = Optional.ofNullable(adCampaign); + return this; + } + + public Builder adCampaign(Nullable adCampaign) { + if (adCampaign.isNull()) { + this.adCampaign = null; + } else if (adCampaign.isEmpty()) { + this.adCampaign = Optional.empty(); + } else { + this.adCampaign = Optional.of(adCampaign.get()); + } + return this; + } + + /** + *

The Whop ad group this event's click resolved to.

+ */ + @JsonSetter(value = "ad_group", nulls = Nulls.SKIP) + public Builder adGroup(Optional adGroup) { + this.adGroup = adGroup; + return this; + } + + public Builder adGroup(ListEventsResponseDataItemRelatedAdGroup adGroup) { + this.adGroup = Optional.ofNullable(adGroup); + return this; + } + + public Builder adGroup(Nullable adGroup) { + if (adGroup.isNull()) { + this.adGroup = null; + } else if (adGroup.isEmpty()) { + this.adGroup = Optional.empty(); + } else { + this.adGroup = Optional.of(adGroup.get()); + } + return this; + } + + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(ListEventsResponseDataItemRelatedApp app) { + this.app = Optional.ofNullable(app); + return this; + } + + public Builder app(Nullable app) { + if (app.isNull()) { + this.app = null; + } else if (app.isEmpty()) { + this.app = Optional.empty(); + } else { + this.app = Optional.of(app.get()); + } + return this; + } + + /** + *

The saved audience this event came from. Present on the identify events an audience ingest writes for each of its members.

+ */ + @JsonSetter(value = "audience", nulls = Nulls.SKIP) + public Builder audience(Optional audience) { + this.audience = audience; + return this; + } + + public Builder audience(ListEventsResponseDataItemRelatedAudience audience) { + this.audience = Optional.ofNullable(audience); + return this; + } + + public Builder audience(Nullable audience) { + if (audience.isNull()) { + this.audience = null; + } else if (audience.isEmpty()) { + this.audience = Optional.empty(); + } else { + this.audience = Optional.of(audience.get()); + } + return this; + } + + @JsonSetter(value = "payment", nulls = Nulls.SKIP) + public Builder payment(Optional payment) { + this.payment = payment; + return this; + } + + public Builder payment(ListEventsResponseDataItemRelatedPayment payment) { + this.payment = Optional.ofNullable(payment); + return this; + } + + public Builder payment(Nullable payment) { + if (payment.isNull()) { + this.payment = null; + } else if (payment.isEmpty()) { + this.payment = Optional.empty(); + } else { + this.payment = Optional.of(payment.get()); + } + return this; + } + + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public Builder plan(Optional plan) { + this.plan = plan; + return this; + } + + public Builder plan(ListEventsResponseDataItemRelatedPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + public Builder plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public Builder product(Optional product) { + this.product = product; + return this; + } + + public Builder product(ListEventsResponseDataItemRelatedProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + public Builder product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public Builder user(Optional user) { + this.user = user; + return this; + } + + public Builder user(ListEventsResponseDataItemRelatedUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + public Builder user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + public ListEventsResponseDataItemRelated build() { + return new ListEventsResponseDataItemRelated( + account, + ad, + adCampaign, + adGroup, + app, + audience, + payment, + plan, + product, + user, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAccount.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAccount.java new file mode 100644 index 00000000..5c020821 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAccount.java @@ -0,0 +1,243 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponseDataItemRelatedAccount.Builder.class) +public final class ListEventsResponseDataItemRelatedAccount { + private final Optional id; + + private final Optional logoUrl; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private ListEventsResponseDataItemRelatedAccount( + Optional id, + Optional logoUrl, + Optional route, + Optional title, + Map additionalProperties) { + this.id = id; + this.logoUrl = logoUrl; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonIgnore + public Optional getLogoUrl() { + if (logoUrl == null) { + return Optional.empty(); + } + return logoUrl; + } + + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo_url") + private Optional _getLogoUrl() { + return logoUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponseDataItemRelatedAccount + && equalTo((ListEventsResponseDataItemRelatedAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponseDataItemRelatedAccount other) { + return id.equals(other.id) + && logoUrl.equals(other.logoUrl) + && route.equals(other.route) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.logoUrl, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + private Optional logoUrl = Optional.empty(); + + private Optional route = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEventsResponseDataItemRelatedAccount other) { + id(other.getId()); + logoUrl(other.getLogoUrl()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "logo_url", nulls = Nulls.SKIP) + public Builder logoUrl(Optional logoUrl) { + this.logoUrl = logoUrl; + return this; + } + + public Builder logoUrl(String logoUrl) { + this.logoUrl = Optional.ofNullable(logoUrl); + return this; + } + + public Builder logoUrl(Nullable logoUrl) { + if (logoUrl.isNull()) { + this.logoUrl = null; + } else if (logoUrl.isEmpty()) { + this.logoUrl = Optional.empty(); + } else { + this.logoUrl = Optional.of(logoUrl.get()); + } + return this; + } + + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public Builder route(Optional route) { + this.route = route; + return this; + } + + public Builder route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + public Builder route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + public ListEventsResponseDataItemRelatedAccount build() { + return new ListEventsResponseDataItemRelatedAccount(id, logoUrl, route, title, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAd.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAd.java new file mode 100644 index 00000000..735fe1fb --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAd.java @@ -0,0 +1,197 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponseDataItemRelatedAd.Builder.class) +public final class ListEventsResponseDataItemRelatedAd { + private final Optional id; + + private final Optional thumbnailUrl; + + private final Optional title; + + private final Map additionalProperties; + + private ListEventsResponseDataItemRelatedAd( + Optional id, + Optional thumbnailUrl, + Optional title, + Map additionalProperties) { + this.id = id; + this.thumbnailUrl = thumbnailUrl; + this.title = title; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponseDataItemRelatedAd + && equalTo((ListEventsResponseDataItemRelatedAd) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponseDataItemRelatedAd other) { + return id.equals(other.id) && thumbnailUrl.equals(other.thumbnailUrl) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.thumbnailUrl, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + private Optional thumbnailUrl = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEventsResponseDataItemRelatedAd other) { + id(other.getId()); + thumbnailUrl(other.getThumbnailUrl()); + title(other.getTitle()); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public Builder thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + public Builder thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + public Builder thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + public ListEventsResponseDataItemRelatedAd build() { + return new ListEventsResponseDataItemRelatedAd(id, thumbnailUrl, title, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAdCampaign.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAdCampaign.java new file mode 100644 index 00000000..fe280ddd --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAdCampaign.java @@ -0,0 +1,197 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponseDataItemRelatedAdCampaign.Builder.class) +public final class ListEventsResponseDataItemRelatedAdCampaign { + private final Optional id; + + private final Optional platform; + + private final Optional title; + + private final Map additionalProperties; + + private ListEventsResponseDataItemRelatedAdCampaign( + Optional id, + Optional platform, + Optional title, + Map additionalProperties) { + this.id = id; + this.platform = platform; + this.title = title; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonIgnore + public Optional getPlatform() { + if (platform == null) { + return Optional.empty(); + } + return platform; + } + + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("platform") + private Optional _getPlatform() { + return platform; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponseDataItemRelatedAdCampaign + && equalTo((ListEventsResponseDataItemRelatedAdCampaign) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponseDataItemRelatedAdCampaign other) { + return id.equals(other.id) && platform.equals(other.platform) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.platform, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + private Optional platform = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEventsResponseDataItemRelatedAdCampaign other) { + id(other.getId()); + platform(other.getPlatform()); + title(other.getTitle()); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "platform", nulls = Nulls.SKIP) + public Builder platform(Optional platform) { + this.platform = platform; + return this; + } + + public Builder platform(String platform) { + this.platform = Optional.ofNullable(platform); + return this; + } + + public Builder platform(Nullable platform) { + if (platform.isNull()) { + this.platform = null; + } else if (platform.isEmpty()) { + this.platform = Optional.empty(); + } else { + this.platform = Optional.of(platform.get()); + } + return this; + } + + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + public ListEventsResponseDataItemRelatedAdCampaign build() { + return new ListEventsResponseDataItemRelatedAdCampaign(id, platform, title, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAdGroup.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAdGroup.java new file mode 100644 index 00000000..5f7756d9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAdGroup.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponseDataItemRelatedAdGroup.Builder.class) +public final class ListEventsResponseDataItemRelatedAdGroup { + private final Optional id; + + private final Optional title; + + private final Map additionalProperties; + + private ListEventsResponseDataItemRelatedAdGroup( + Optional id, Optional title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponseDataItemRelatedAdGroup + && equalTo((ListEventsResponseDataItemRelatedAdGroup) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponseDataItemRelatedAdGroup other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEventsResponseDataItemRelatedAdGroup other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + public ListEventsResponseDataItemRelatedAdGroup build() { + return new ListEventsResponseDataItemRelatedAdGroup(id, title, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedApp.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedApp.java new file mode 100644 index 00000000..0b9c50ae --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedApp.java @@ -0,0 +1,243 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponseDataItemRelatedApp.Builder.class) +public final class ListEventsResponseDataItemRelatedApp { + private final Optional domainId; + + private final Optional iconUrl; + + private final Optional id; + + private final Optional title; + + private final Map additionalProperties; + + private ListEventsResponseDataItemRelatedApp( + Optional domainId, + Optional iconUrl, + Optional id, + Optional title, + Map additionalProperties) { + this.domainId = domainId; + this.iconUrl = iconUrl; + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getDomainId() { + if (domainId == null) { + return Optional.empty(); + } + return domainId; + } + + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("domain_id") + private Optional _getDomainId() { + return domainId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponseDataItemRelatedApp + && equalTo((ListEventsResponseDataItemRelatedApp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponseDataItemRelatedApp other) { + return domainId.equals(other.domainId) + && iconUrl.equals(other.iconUrl) + && id.equals(other.id) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.domainId, this.iconUrl, this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional domainId = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEventsResponseDataItemRelatedApp other) { + domainId(other.getDomainId()); + iconUrl(other.getIconUrl()); + id(other.getId()); + title(other.getTitle()); + return this; + } + + @JsonSetter(value = "domain_id", nulls = Nulls.SKIP) + public Builder domainId(Optional domainId) { + this.domainId = domainId; + return this; + } + + public Builder domainId(String domainId) { + this.domainId = Optional.ofNullable(domainId); + return this; + } + + public Builder domainId(Nullable domainId) { + if (domainId.isNull()) { + this.domainId = null; + } else if (domainId.isEmpty()) { + this.domainId = Optional.empty(); + } else { + this.domainId = Optional.of(domainId.get()); + } + return this; + } + + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public Builder iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + public Builder iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + public Builder iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + public ListEventsResponseDataItemRelatedApp build() { + return new ListEventsResponseDataItemRelatedApp(domainId, iconUrl, id, title, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAudience.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAudience.java new file mode 100644 index 00000000..ff84bc9a --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAudience.java @@ -0,0 +1,288 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponseDataItemRelatedAudience.Builder.class) +public final class ListEventsResponseDataItemRelatedAudience { + private final Optional audienceType; + + private final Optional fileName; + + private final Optional id; + + private final Optional sourceType; + + private final Optional title; + + private final Map additionalProperties; + + private ListEventsResponseDataItemRelatedAudience( + Optional audienceType, + Optional fileName, + Optional id, + Optional sourceType, + Optional title, + Map additionalProperties) { + this.audienceType = audienceType; + this.fileName = fileName; + this.id = id; + this.sourceType = sourceType; + this.title = title; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getAudienceType() { + if (audienceType == null) { + return Optional.empty(); + } + return audienceType; + } + + @JsonIgnore + public Optional getFileName() { + if (fileName == null) { + return Optional.empty(); + } + return fileName; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonIgnore + public Optional getSourceType() { + if (sourceType == null) { + return Optional.empty(); + } + return sourceType; + } + + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("audience_type") + private Optional _getAudienceType() { + return audienceType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("file_name") + private Optional _getFileName() { + return fileName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source_type") + private Optional _getSourceType() { + return sourceType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponseDataItemRelatedAudience + && equalTo((ListEventsResponseDataItemRelatedAudience) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponseDataItemRelatedAudience other) { + return audienceType.equals(other.audienceType) + && fileName.equals(other.fileName) + && id.equals(other.id) + && sourceType.equals(other.sourceType) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.audienceType, this.fileName, this.id, this.sourceType, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional audienceType = Optional.empty(); + + private Optional fileName = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional sourceType = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEventsResponseDataItemRelatedAudience other) { + audienceType(other.getAudienceType()); + fileName(other.getFileName()); + id(other.getId()); + sourceType(other.getSourceType()); + title(other.getTitle()); + return this; + } + + @JsonSetter(value = "audience_type", nulls = Nulls.SKIP) + public Builder audienceType(Optional audienceType) { + this.audienceType = audienceType; + return this; + } + + public Builder audienceType(ListEventsResponseDataItemRelatedAudienceAudienceType audienceType) { + this.audienceType = Optional.ofNullable(audienceType); + return this; + } + + public Builder audienceType(Nullable audienceType) { + if (audienceType.isNull()) { + this.audienceType = null; + } else if (audienceType.isEmpty()) { + this.audienceType = Optional.empty(); + } else { + this.audienceType = Optional.of(audienceType.get()); + } + return this; + } + + @JsonSetter(value = "file_name", nulls = Nulls.SKIP) + public Builder fileName(Optional fileName) { + this.fileName = fileName; + return this; + } + + public Builder fileName(String fileName) { + this.fileName = Optional.ofNullable(fileName); + return this; + } + + public Builder fileName(Nullable fileName) { + if (fileName.isNull()) { + this.fileName = null; + } else if (fileName.isEmpty()) { + this.fileName = Optional.empty(); + } else { + this.fileName = Optional.of(fileName.get()); + } + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "source_type", nulls = Nulls.SKIP) + public Builder sourceType(Optional sourceType) { + this.sourceType = sourceType; + return this; + } + + public Builder sourceType(ListEventsResponseDataItemRelatedAudienceSourceType sourceType) { + this.sourceType = Optional.ofNullable(sourceType); + return this; + } + + public Builder sourceType(Nullable sourceType) { + if (sourceType.isNull()) { + this.sourceType = null; + } else if (sourceType.isEmpty()) { + this.sourceType = Optional.empty(); + } else { + this.sourceType = Optional.of(sourceType.get()); + } + return this; + } + + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + public ListEventsResponseDataItemRelatedAudience build() { + return new ListEventsResponseDataItemRelatedAudience( + audienceType, fileName, id, sourceType, title, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAudienceAudienceType.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAudienceAudienceType.java new file mode 100644 index 00000000..ea096820 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAudienceAudienceType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEventsResponseDataItemRelatedAudienceAudienceType { + public static final ListEventsResponseDataItemRelatedAudienceAudienceType CUSTOM = + new ListEventsResponseDataItemRelatedAudienceAudienceType(Value.CUSTOM, "custom"); + + public static final ListEventsResponseDataItemRelatedAudienceAudienceType LOOKALIKE = + new ListEventsResponseDataItemRelatedAudienceAudienceType(Value.LOOKALIKE, "lookalike"); + + private final Value value; + + private final String string; + + ListEventsResponseDataItemRelatedAudienceAudienceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEventsResponseDataItemRelatedAudienceAudienceType + && this.string.equals(((ListEventsResponseDataItemRelatedAudienceAudienceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CUSTOM: + return visitor.visitCustom(); + case LOOKALIKE: + return visitor.visitLookalike(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEventsResponseDataItemRelatedAudienceAudienceType valueOf(String value) { + switch (value) { + case "custom": + return CUSTOM; + case "lookalike": + return LOOKALIKE; + default: + return new ListEventsResponseDataItemRelatedAudienceAudienceType(Value.UNKNOWN, value); + } + } + + public enum Value { + CUSTOM, + + LOOKALIKE, + + UNKNOWN + } + + public interface Visitor { + T visitCustom(); + + T visitLookalike(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAudienceSourceType.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAudienceSourceType.java new file mode 100644 index 00000000..205d402e --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedAudienceSourceType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEventsResponseDataItemRelatedAudienceSourceType { + public static final ListEventsResponseDataItemRelatedAudienceSourceType CSV_UPLOAD = + new ListEventsResponseDataItemRelatedAudienceSourceType(Value.CSV_UPLOAD, "csv_upload"); + + public static final ListEventsResponseDataItemRelatedAudienceSourceType PEOPLE_FILTER = + new ListEventsResponseDataItemRelatedAudienceSourceType(Value.PEOPLE_FILTER, "people_filter"); + + private final Value value; + + private final String string; + + ListEventsResponseDataItemRelatedAudienceSourceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEventsResponseDataItemRelatedAudienceSourceType + && this.string.equals(((ListEventsResponseDataItemRelatedAudienceSourceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CSV_UPLOAD: + return visitor.visitCsvUpload(); + case PEOPLE_FILTER: + return visitor.visitPeopleFilter(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEventsResponseDataItemRelatedAudienceSourceType valueOf(String value) { + switch (value) { + case "csv_upload": + return CSV_UPLOAD; + case "people_filter": + return PEOPLE_FILTER; + default: + return new ListEventsResponseDataItemRelatedAudienceSourceType(Value.UNKNOWN, value); + } + } + + public enum Value { + CSV_UPLOAD, + + PEOPLE_FILTER, + + UNKNOWN + } + + public interface Visitor { + T visitCsvUpload(); + + T visitPeopleFilter(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedPayment.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedPayment.java new file mode 100644 index 00000000..5789c9db --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedPayment.java @@ -0,0 +1,244 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponseDataItemRelatedPayment.Builder.class) +public final class ListEventsResponseDataItemRelatedPayment { + private final Optional cardBrand; + + private final Optional cardLast4; + + private final Optional id; + + private final Optional provider; + + private final Map additionalProperties; + + private ListEventsResponseDataItemRelatedPayment( + Optional cardBrand, + Optional cardLast4, + Optional id, + Optional provider, + Map additionalProperties) { + this.cardBrand = cardBrand; + this.cardLast4 = cardLast4; + this.id = id; + this.provider = provider; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getCardBrand() { + if (cardBrand == null) { + return Optional.empty(); + } + return cardBrand; + } + + @JsonIgnore + public Optional getCardLast4() { + if (cardLast4 == null) { + return Optional.empty(); + } + return cardLast4; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonIgnore + public Optional getProvider() { + if (provider == null) { + return Optional.empty(); + } + return provider; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_brand") + private Optional _getCardBrand() { + return cardBrand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_last4") + private Optional _getCardLast4() { + return cardLast4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("provider") + private Optional _getProvider() { + return provider; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponseDataItemRelatedPayment + && equalTo((ListEventsResponseDataItemRelatedPayment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponseDataItemRelatedPayment other) { + return cardBrand.equals(other.cardBrand) + && cardLast4.equals(other.cardLast4) + && id.equals(other.id) + && provider.equals(other.provider); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cardBrand, this.cardLast4, this.id, this.provider); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional cardBrand = Optional.empty(); + + private Optional cardLast4 = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional provider = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEventsResponseDataItemRelatedPayment other) { + cardBrand(other.getCardBrand()); + cardLast4(other.getCardLast4()); + id(other.getId()); + provider(other.getProvider()); + return this; + } + + @JsonSetter(value = "card_brand", nulls = Nulls.SKIP) + public Builder cardBrand(Optional cardBrand) { + this.cardBrand = cardBrand; + return this; + } + + public Builder cardBrand(String cardBrand) { + this.cardBrand = Optional.ofNullable(cardBrand); + return this; + } + + public Builder cardBrand(Nullable cardBrand) { + if (cardBrand.isNull()) { + this.cardBrand = null; + } else if (cardBrand.isEmpty()) { + this.cardBrand = Optional.empty(); + } else { + this.cardBrand = Optional.of(cardBrand.get()); + } + return this; + } + + @JsonSetter(value = "card_last4", nulls = Nulls.SKIP) + public Builder cardLast4(Optional cardLast4) { + this.cardLast4 = cardLast4; + return this; + } + + public Builder cardLast4(String cardLast4) { + this.cardLast4 = Optional.ofNullable(cardLast4); + return this; + } + + public Builder cardLast4(Nullable cardLast4) { + if (cardLast4.isNull()) { + this.cardLast4 = null; + } else if (cardLast4.isEmpty()) { + this.cardLast4 = Optional.empty(); + } else { + this.cardLast4 = Optional.of(cardLast4.get()); + } + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "provider", nulls = Nulls.SKIP) + public Builder provider(Optional provider) { + this.provider = provider; + return this; + } + + public Builder provider(String provider) { + this.provider = Optional.ofNullable(provider); + return this; + } + + public Builder provider(Nullable provider) { + if (provider.isNull()) { + this.provider = null; + } else if (provider.isEmpty()) { + this.provider = Optional.empty(); + } else { + this.provider = Optional.of(provider.get()); + } + return this; + } + + public ListEventsResponseDataItemRelatedPayment build() { + return new ListEventsResponseDataItemRelatedPayment( + cardBrand, cardLast4, id, provider, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedPlan.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedPlan.java new file mode 100644 index 00000000..33a17868 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedPlan.java @@ -0,0 +1,333 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponseDataItemRelatedPlan.Builder.class) +public final class ListEventsResponseDataItemRelatedPlan { + private final Optional billingPeriod; + + private final Optional currency; + + private final Optional id; + + private final Optional initialPrice; + + private final Optional renewalPrice; + + private final Optional title; + + private final Map additionalProperties; + + private ListEventsResponseDataItemRelatedPlan( + Optional billingPeriod, + Optional currency, + Optional id, + Optional initialPrice, + Optional renewalPrice, + Optional title, + Map additionalProperties) { + this.billingPeriod = billingPeriod; + this.currency = currency; + this.id = id; + this.initialPrice = initialPrice; + this.renewalPrice = renewalPrice; + this.title = title; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonIgnore + public Optional getInitialPrice() { + if (initialPrice == null) { + return Optional.empty(); + } + return initialPrice; + } + + @JsonIgnore + public Optional getRenewalPrice() { + if (renewalPrice == null) { + return Optional.empty(); + } + return renewalPrice; + } + + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("initial_price") + private Optional _getInitialPrice() { + return initialPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("renewal_price") + private Optional _getRenewalPrice() { + return renewalPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponseDataItemRelatedPlan + && equalTo((ListEventsResponseDataItemRelatedPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponseDataItemRelatedPlan other) { + return billingPeriod.equals(other.billingPeriod) + && currency.equals(other.currency) + && id.equals(other.id) + && initialPrice.equals(other.initialPrice) + && renewalPrice.equals(other.renewalPrice) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billingPeriod, this.currency, this.id, this.initialPrice, this.renewalPrice, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional billingPeriod = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional initialPrice = Optional.empty(); + + private Optional renewalPrice = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEventsResponseDataItemRelatedPlan other) { + billingPeriod(other.getBillingPeriod()); + currency(other.getCurrency()); + id(other.getId()); + initialPrice(other.getInitialPrice()); + renewalPrice(other.getRenewalPrice()); + title(other.getTitle()); + return this; + } + + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public Builder billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + public Builder billingPeriod(Integer billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + public Builder billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional currency) { + this.currency = currency; + return this; + } + + public Builder currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + public Builder currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "initial_price", nulls = Nulls.SKIP) + public Builder initialPrice(Optional initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + public Builder initialPrice(Double initialPrice) { + this.initialPrice = Optional.ofNullable(initialPrice); + return this; + } + + public Builder initialPrice(Nullable initialPrice) { + if (initialPrice.isNull()) { + this.initialPrice = null; + } else if (initialPrice.isEmpty()) { + this.initialPrice = Optional.empty(); + } else { + this.initialPrice = Optional.of(initialPrice.get()); + } + return this; + } + + @JsonSetter(value = "renewal_price", nulls = Nulls.SKIP) + public Builder renewalPrice(Optional renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + public Builder renewalPrice(Double renewalPrice) { + this.renewalPrice = Optional.ofNullable(renewalPrice); + return this; + } + + public Builder renewalPrice(Nullable renewalPrice) { + if (renewalPrice.isNull()) { + this.renewalPrice = null; + } else if (renewalPrice.isEmpty()) { + this.renewalPrice = Optional.empty(); + } else { + this.renewalPrice = Optional.of(renewalPrice.get()); + } + return this; + } + + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + public ListEventsResponseDataItemRelatedPlan build() { + return new ListEventsResponseDataItemRelatedPlan( + billingPeriod, currency, id, initialPrice, renewalPrice, title, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedProduct.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedProduct.java new file mode 100644 index 00000000..5c08b58a --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedProduct.java @@ -0,0 +1,197 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponseDataItemRelatedProduct.Builder.class) +public final class ListEventsResponseDataItemRelatedProduct { + private final Optional id; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private ListEventsResponseDataItemRelatedProduct( + Optional id, + Optional route, + Optional title, + Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponseDataItemRelatedProduct + && equalTo((ListEventsResponseDataItemRelatedProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponseDataItemRelatedProduct other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + private Optional route = Optional.empty(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEventsResponseDataItemRelatedProduct other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public Builder route(Optional route) { + this.route = route; + return this; + } + + public Builder route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + public Builder route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + public ListEventsResponseDataItemRelatedProduct build() { + return new ListEventsResponseDataItemRelatedProduct(id, route, title, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedUser.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedUser.java new file mode 100644 index 00000000..f4de749d --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemRelatedUser.java @@ -0,0 +1,243 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponseDataItemRelatedUser.Builder.class) +public final class ListEventsResponseDataItemRelatedUser { + private final Optional avatarUrl; + + private final Optional id; + + private final Optional name; + + private final Optional username; + + private final Map additionalProperties; + + private ListEventsResponseDataItemRelatedUser( + Optional avatarUrl, + Optional id, + Optional name, + Optional username, + Map additionalProperties) { + this.avatarUrl = avatarUrl; + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getAvatarUrl() { + if (avatarUrl == null) { + return Optional.empty(); + } + return avatarUrl; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getUsername() { + if (username == null) { + return Optional.empty(); + } + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("avatar_url") + private Optional _getAvatarUrl() { + return avatarUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("username") + private Optional _getUsername() { + return username; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponseDataItemRelatedUser + && equalTo((ListEventsResponseDataItemRelatedUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponseDataItemRelatedUser other) { + return avatarUrl.equals(other.avatarUrl) + && id.equals(other.id) + && name.equals(other.name) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.avatarUrl, this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional avatarUrl = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional username = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEventsResponseDataItemRelatedUser other) { + avatarUrl(other.getAvatarUrl()); + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + @JsonSetter(value = "avatar_url", nulls = Nulls.SKIP) + public Builder avatarUrl(Optional avatarUrl) { + this.avatarUrl = avatarUrl; + return this; + } + + public Builder avatarUrl(String avatarUrl) { + this.avatarUrl = Optional.ofNullable(avatarUrl); + return this; + } + + public Builder avatarUrl(Nullable avatarUrl) { + if (avatarUrl.isNull()) { + this.avatarUrl = null; + } else if (avatarUrl.isEmpty()) { + this.avatarUrl = Optional.empty(); + } else { + this.avatarUrl = Optional.of(avatarUrl.get()); + } + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public Builder username(Optional username) { + this.username = username; + return this; + } + + public Builder username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + public Builder username(Nullable username) { + if (username.isNull()) { + this.username = null; + } else if (username.isEmpty()) { + this.username = Optional.empty(); + } else { + this.username = Optional.of(username.get()); + } + return this; + } + + public ListEventsResponseDataItemRelatedUser build() { + return new ListEventsResponseDataItemRelatedUser(avatarUrl, id, name, username, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemUser.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemUser.java new file mode 100644 index 00000000..450308b0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponseDataItemUser.java @@ -0,0 +1,395 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponseDataItemUser.Builder.class) +public final class ListEventsResponseDataItemUser { + private final Optional city; + + private final Optional country; + + private final Optional email; + + private final Optional firstName; + + private final Optional lastName; + + private final Optional name; + + private final Optional phone; + + private final Map additionalProperties; + + private ListEventsResponseDataItemUser( + Optional city, + Optional country, + Optional email, + Optional firstName, + Optional lastName, + Optional name, + Optional phone, + Map additionalProperties) { + this.city = city; + this.country = country; + this.email = email; + this.firstName = firstName; + this.lastName = lastName; + this.name = name; + this.phone = phone; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + @JsonIgnore + public Optional getFirstName() { + if (firstName == null) { + return Optional.empty(); + } + return firstName; + } + + @JsonIgnore + public Optional getLastName() { + if (lastName == null) { + return Optional.empty(); + } + return lastName; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_name") + private Optional _getFirstName() { + return firstName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_name") + private Optional _getLastName() { + return lastName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponseDataItemUser && equalTo((ListEventsResponseDataItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponseDataItemUser other) { + return city.equals(other.city) + && country.equals(other.country) + && email.equals(other.email) + && firstName.equals(other.firstName) + && lastName.equals(other.lastName) + && name.equals(other.name) + && phone.equals(other.phone); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.email, this.firstName, this.lastName, this.name, this.phone); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional lastName = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional phone = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEventsResponseDataItemUser other) { + city(other.getCity()); + country(other.getCountry()); + email(other.getEmail()); + firstName(other.getFirstName()); + lastName(other.getLastName()); + name(other.getName()); + phone(other.getPhone()); + return this; + } + + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + public Builder email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public Builder firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + public Builder firstName(Nullable firstName) { + if (firstName.isNull()) { + this.firstName = null; + } else if (firstName.isEmpty()) { + this.firstName = Optional.empty(); + } else { + this.firstName = Optional.of(firstName.get()); + } + return this; + } + + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public Builder lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + public Builder lastName(Nullable lastName) { + if (lastName.isNull()) { + this.lastName = null; + } else if (lastName.isEmpty()) { + this.lastName = Optional.empty(); + } else { + this.lastName = Optional.of(lastName.get()); + } + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + public Builder phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + public ListEventsResponseDataItemUser build() { + return new ListEventsResponseDataItemUser( + city, country, email, firstName, lastName, name, phone, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/ListEventsResponsePageInfo.java b/src/main/java/com/whop/api/resources/events/types/ListEventsResponsePageInfo.java new file mode 100644 index 00000000..a487c101 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/ListEventsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEventsResponsePageInfo.Builder.class) +public final class ListEventsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListEventsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEventsResponsePageInfo && equalTo((ListEventsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEventsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListEventsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListEventsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListEventsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListEventsResponsePageInfo build() { + return new ListEventsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/PulseEventsResponse.java b/src/main/java/com/whop/api/resources/events/types/PulseEventsResponse.java new file mode 100644 index 00000000..27c5dfe5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/PulseEventsResponse.java @@ -0,0 +1,182 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PulseEventsResponse.Builder.class) +public final class PulseEventsResponse { + private final List data; + + private final PulseEventsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private PulseEventsResponse( + List data, + PulseEventsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return Recent anonymized money-movement events, newest first. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PulseEventsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PulseEventsResponse && equalTo((PulseEventsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PulseEventsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PulseEventsResponsePageInfo pageInfo); + + Builder from(PulseEventsResponse other); + } + + public interface _FinalStage { + PulseEventsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Recent anonymized money-movement events, newest first.

+ */ + _FinalStage data(List data); + + _FinalStage addData(PulseEventsResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PulseEventsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PulseEventsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PulseEventsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

Recent anonymized money-movement events, newest first.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

Recent anonymized money-movement events, newest first.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(PulseEventsResponseDataItem data) { + this.data.add(data); + return this; + } + + /** + *

Recent anonymized money-movement events, newest first.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public PulseEventsResponse build() { + return new PulseEventsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/PulseEventsResponseDataItem.java b/src/main/java/com/whop/api/resources/events/types/PulseEventsResponseDataItem.java new file mode 100644 index 00000000..56074245 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/PulseEventsResponseDataItem.java @@ -0,0 +1,321 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PulseEventsResponseDataItem.Builder.class) +public final class PulseEventsResponseDataItem { + private final PulseEventsResponseDataItemEventName eventName; + + private final OffsetDateTime eventTime; + + private final Optional totalUsdAmount; + + private final PulseEventsResponseDataItemType type; + + private final Optional user; + + private final Map additionalProperties; + + private PulseEventsResponseDataItem( + PulseEventsResponseDataItemEventName eventName, + OffsetDateTime eventTime, + Optional totalUsdAmount, + PulseEventsResponseDataItemType type, + Optional user, + Map additionalProperties) { + this.eventName = eventName; + this.eventTime = eventTime; + this.totalUsdAmount = totalUsdAmount; + this.type = type; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The underlying event recorded. Every movement on this feed is a ledger line, so switch on type rather than this. + */ + @JsonProperty("event_name") + public PulseEventsResponseDataItemEventName getEventName() { + return eventName; + } + + /** + * @return When the event happened, coarsened to the start of the minute. + */ + @JsonProperty("event_time") + public OffsetDateTime getEventTime() { + return eventTime; + } + + /** + * @return The USD amount of the event. + */ + @JsonIgnore + public Optional getTotalUsdAmount() { + if (totalUsdAmount == null) { + return Optional.empty(); + } + return totalUsdAmount; + } + + /** + * @return What moved: a purchase, an affiliate commission, Whop card spend, ad spend, app revenue, an off-platform sale, a wallet deposit, a card load, a claimed drop, a transfer between accounts, or a referral bonus. + */ + @JsonProperty("type") + public PulseEventsResponseDataItemType getType() { + return type; + } + + /** + * @return Coarse location, shaped like the event user block. It belongs to the owner of the wallet the money moved into or out of — the party the event is about, never their counterparty. Omitted entirely when nothing is known. + */ + @JsonProperty("user") + public Optional getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("total_usd_amount") + private Optional _getTotalUsdAmount() { + return totalUsdAmount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PulseEventsResponseDataItem && equalTo((PulseEventsResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PulseEventsResponseDataItem other) { + return eventName.equals(other.eventName) + && eventTime.equals(other.eventTime) + && totalUsdAmount.equals(other.totalUsdAmount) + && type.equals(other.type) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.eventName, this.eventTime, this.totalUsdAmount, this.type, this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EventNameStage builder() { + return new Builder(); + } + + public interface EventNameStage { + /** + *

The underlying event recorded. Every movement on this feed is a ledger line, so switch on type rather than this.

+ */ + EventTimeStage eventName(@NotNull PulseEventsResponseDataItemEventName eventName); + + Builder from(PulseEventsResponseDataItem other); + } + + public interface EventTimeStage { + /** + *

When the event happened, coarsened to the start of the minute.

+ */ + TypeStage eventTime(@NotNull OffsetDateTime eventTime); + } + + public interface TypeStage { + /** + *

What moved: a purchase, an affiliate commission, Whop card spend, ad spend, app revenue, an off-platform sale, a wallet deposit, a card load, a claimed drop, a transfer between accounts, or a referral bonus.

+ */ + _FinalStage type(@NotNull PulseEventsResponseDataItemType type); + } + + public interface _FinalStage { + PulseEventsResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The USD amount of the event.

+ */ + _FinalStage totalUsdAmount(Optional totalUsdAmount); + + _FinalStage totalUsdAmount(Double totalUsdAmount); + + _FinalStage totalUsdAmount(Nullable totalUsdAmount); + + /** + *

Coarse location, shaped like the event user block. It belongs to the owner of the wallet the money moved into or out of — the party the event is about, never their counterparty. Omitted entirely when nothing is known.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(PulseEventsResponseDataItemUser user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EventNameStage, EventTimeStage, TypeStage, _FinalStage { + private PulseEventsResponseDataItemEventName eventName; + + private OffsetDateTime eventTime; + + private PulseEventsResponseDataItemType type; + + private Optional user = Optional.empty(); + + private Optional totalUsdAmount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PulseEventsResponseDataItem other) { + eventName(other.getEventName()); + eventTime(other.getEventTime()); + totalUsdAmount(other.getTotalUsdAmount()); + type(other.getType()); + user(other.getUser()); + return this; + } + + /** + *

The underlying event recorded. Every movement on this feed is a ledger line, so switch on type rather than this.

+ *

The underlying event recorded. Every movement on this feed is a ledger line, so switch on type rather than this.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("event_name") + public EventTimeStage eventName(@NotNull PulseEventsResponseDataItemEventName eventName) { + this.eventName = Objects.requireNonNull(eventName, "eventName must not be null"); + return this; + } + + /** + *

When the event happened, coarsened to the start of the minute.

+ *

When the event happened, coarsened to the start of the minute.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("event_time") + public TypeStage eventTime(@NotNull OffsetDateTime eventTime) { + this.eventTime = Objects.requireNonNull(eventTime, "eventTime must not be null"); + return this; + } + + /** + *

What moved: a purchase, an affiliate commission, Whop card spend, ad spend, app revenue, an off-platform sale, a wallet deposit, a card load, a claimed drop, a transfer between accounts, or a referral bonus.

+ *

What moved: a purchase, an affiliate commission, Whop card spend, ad spend, app revenue, an off-platform sale, a wallet deposit, a card load, a claimed drop, a transfer between accounts, or a referral bonus.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PulseEventsResponseDataItemType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

Coarse location, shaped like the event user block. It belongs to the owner of the wallet the money moved into or out of — the party the event is about, never their counterparty. Omitted entirely when nothing is known.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(PulseEventsResponseDataItemUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

Coarse location, shaped like the event user block. It belongs to the owner of the wallet the money moved into or out of — the party the event is about, never their counterparty. Omitted entirely when nothing is known.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + /** + *

The USD amount of the event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage totalUsdAmount(Nullable totalUsdAmount) { + if (totalUsdAmount.isNull()) { + this.totalUsdAmount = null; + } else if (totalUsdAmount.isEmpty()) { + this.totalUsdAmount = Optional.empty(); + } else { + this.totalUsdAmount = Optional.of(totalUsdAmount.get()); + } + return this; + } + + /** + *

The USD amount of the event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage totalUsdAmount(Double totalUsdAmount) { + this.totalUsdAmount = Optional.ofNullable(totalUsdAmount); + return this; + } + + /** + *

The USD amount of the event.

+ */ + @java.lang.Override + @JsonSetter(value = "total_usd_amount", nulls = Nulls.SKIP) + public _FinalStage totalUsdAmount(Optional totalUsdAmount) { + this.totalUsdAmount = totalUsdAmount; + return this; + } + + @java.lang.Override + public PulseEventsResponseDataItem build() { + return new PulseEventsResponseDataItem( + eventName, eventTime, totalUsdAmount, type, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/PulseEventsResponseDataItemEventName.java b/src/main/java/com/whop/api/resources/events/types/PulseEventsResponseDataItemEventName.java new file mode 100644 index 00000000..40771344 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/PulseEventsResponseDataItemEventName.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PulseEventsResponseDataItemEventName { + public static final PulseEventsResponseDataItemEventName LEDGER_LINE_CREATED = + new PulseEventsResponseDataItemEventName(Value.LEDGER_LINE_CREATED, "ledger_line.created"); + + private final Value value; + + private final String string; + + PulseEventsResponseDataItemEventName(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PulseEventsResponseDataItemEventName + && this.string.equals(((PulseEventsResponseDataItemEventName) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LEDGER_LINE_CREATED: + return visitor.visitLedgerLineCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PulseEventsResponseDataItemEventName valueOf(String value) { + switch (value) { + case "ledger_line.created": + return LEDGER_LINE_CREATED; + default: + return new PulseEventsResponseDataItemEventName(Value.UNKNOWN, value); + } + } + + public enum Value { + LEDGER_LINE_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitLedgerLineCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/PulseEventsResponseDataItemType.java b/src/main/java/com/whop/api/resources/events/types/PulseEventsResponseDataItemType.java new file mode 100644 index 00000000..4fab9f14 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/PulseEventsResponseDataItemType.java @@ -0,0 +1,185 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PulseEventsResponseDataItemType { + public static final PulseEventsResponseDataItemType PURCHASE = + new PulseEventsResponseDataItemType(Value.PURCHASE, "purchase"); + + public static final PulseEventsResponseDataItemType DEPOSIT = + new PulseEventsResponseDataItemType(Value.DEPOSIT, "deposit"); + + public static final PulseEventsResponseDataItemType CARD_LOAD = + new PulseEventsResponseDataItemType(Value.CARD_LOAD, "card_load"); + + public static final PulseEventsResponseDataItemType AFFILIATE_COMMISSION = + new PulseEventsResponseDataItemType(Value.AFFILIATE_COMMISSION, "affiliate_commission"); + + public static final PulseEventsResponseDataItemType APP_REVENUE = + new PulseEventsResponseDataItemType(Value.APP_REVENUE, "app_revenue"); + + public static final PulseEventsResponseDataItemType TRANSFER = + new PulseEventsResponseDataItemType(Value.TRANSFER, "transfer"); + + public static final PulseEventsResponseDataItemType AIRDROP_CLAIM = + new PulseEventsResponseDataItemType(Value.AIRDROP_CLAIM, "airdrop_claim"); + + public static final PulseEventsResponseDataItemType AD_SPEND = + new PulseEventsResponseDataItemType(Value.AD_SPEND, "ad_spend"); + + public static final PulseEventsResponseDataItemType REFERRAL_BONUS = + new PulseEventsResponseDataItemType(Value.REFERRAL_BONUS, "referral_bonus"); + + public static final PulseEventsResponseDataItemType CARD_SPEND = + new PulseEventsResponseDataItemType(Value.CARD_SPEND, "card_spend"); + + public static final PulseEventsResponseDataItemType OFF_PLATFORM_SALE = + new PulseEventsResponseDataItemType(Value.OFF_PLATFORM_SALE, "off_platform_sale"); + + private final Value value; + + private final String string; + + PulseEventsResponseDataItemType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PulseEventsResponseDataItemType + && this.string.equals(((PulseEventsResponseDataItemType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PURCHASE: + return visitor.visitPurchase(); + case DEPOSIT: + return visitor.visitDeposit(); + case CARD_LOAD: + return visitor.visitCardLoad(); + case AFFILIATE_COMMISSION: + return visitor.visitAffiliateCommission(); + case APP_REVENUE: + return visitor.visitAppRevenue(); + case TRANSFER: + return visitor.visitTransfer(); + case AIRDROP_CLAIM: + return visitor.visitAirdropClaim(); + case AD_SPEND: + return visitor.visitAdSpend(); + case REFERRAL_BONUS: + return visitor.visitReferralBonus(); + case CARD_SPEND: + return visitor.visitCardSpend(); + case OFF_PLATFORM_SALE: + return visitor.visitOffPlatformSale(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PulseEventsResponseDataItemType valueOf(String value) { + switch (value) { + case "purchase": + return PURCHASE; + case "deposit": + return DEPOSIT; + case "card_load": + return CARD_LOAD; + case "affiliate_commission": + return AFFILIATE_COMMISSION; + case "app_revenue": + return APP_REVENUE; + case "transfer": + return TRANSFER; + case "airdrop_claim": + return AIRDROP_CLAIM; + case "ad_spend": + return AD_SPEND; + case "referral_bonus": + return REFERRAL_BONUS; + case "card_spend": + return CARD_SPEND; + case "off_platform_sale": + return OFF_PLATFORM_SALE; + default: + return new PulseEventsResponseDataItemType(Value.UNKNOWN, value); + } + } + + public enum Value { + PURCHASE, + + AFFILIATE_COMMISSION, + + CARD_SPEND, + + AD_SPEND, + + APP_REVENUE, + + OFF_PLATFORM_SALE, + + DEPOSIT, + + CARD_LOAD, + + AIRDROP_CLAIM, + + TRANSFER, + + REFERRAL_BONUS, + + UNKNOWN + } + + public interface Visitor { + T visitPurchase(); + + T visitAffiliateCommission(); + + T visitCardSpend(); + + T visitAdSpend(); + + T visitAppRevenue(); + + T visitOffPlatformSale(); + + T visitDeposit(); + + T visitCardLoad(); + + T visitAirdropClaim(); + + T visitTransfer(); + + T visitReferralBonus(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/PulseEventsResponseDataItemUser.java b/src/main/java/com/whop/api/resources/events/types/PulseEventsResponseDataItemUser.java new file mode 100644 index 00000000..848d2c71 --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/PulseEventsResponseDataItemUser.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PulseEventsResponseDataItemUser.Builder.class) +public final class PulseEventsResponseDataItemUser { + private final Optional city; + + private final Optional country; + + private final Map additionalProperties; + + private PulseEventsResponseDataItemUser( + Optional city, Optional country, Map additionalProperties) { + this.city = city; + this.country = country; + this.additionalProperties = additionalProperties; + } + + /** + * @return City name. Omitted when unknown. + */ + @JsonProperty("city") + public Optional getCity() { + return city; + } + + /** + * @return ISO 3166-1 alpha-2 country code. Omitted when unknown. + */ + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PulseEventsResponseDataItemUser && equalTo((PulseEventsResponseDataItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PulseEventsResponseDataItemUser other) { + return city.equals(other.city) && country.equals(other.country); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PulseEventsResponseDataItemUser other) { + city(other.getCity()); + country(other.getCountry()); + return this; + } + + /** + *

City name. Omitted when unknown.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + /** + *

ISO 3166-1 alpha-2 country code. Omitted when unknown.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public PulseEventsResponseDataItemUser build() { + return new PulseEventsResponseDataItemUser(city, country, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/events/types/PulseEventsResponsePageInfo.java b/src/main/java/com/whop/api/resources/events/types/PulseEventsResponsePageInfo.java new file mode 100644 index 00000000..8c88a50d --- /dev/null +++ b/src/main/java/com/whop/api/resources/events/types/PulseEventsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.events.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PulseEventsResponsePageInfo.Builder.class) +public final class PulseEventsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private PulseEventsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PulseEventsResponsePageInfo && equalTo((PulseEventsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PulseEventsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(PulseEventsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + PulseEventsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PulseEventsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public PulseEventsResponsePageInfo build() { + return new PulseEventsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/experiences/AsyncExperiencesClient.java b/src/main/java/com/whop/api/resources/experiences/AsyncExperiencesClient.java new file mode 100644 index 00000000..978da76c --- /dev/null +++ b/src/main/java/com/whop/api/resources/experiences/AsyncExperiencesClient.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.experiences; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.experiences.requests.AttachExperiencesRequest; +import com.whop.api.resources.experiences.requests.CreateExperiencesRequest; +import com.whop.api.resources.experiences.requests.DeleteExperiencesRequest; +import com.whop.api.resources.experiences.requests.DetachExperiencesRequest; +import com.whop.api.resources.experiences.requests.DuplicateExperiencesRequest; +import com.whop.api.resources.experiences.requests.ListExperiencesRequest; +import com.whop.api.resources.experiences.requests.RetrieveExperiencesRequest; +import com.whop.api.resources.experiences.requests.UpdateExperiencesRequest; +import com.whop.api.types.Experience; +import com.whop.api.types.ExperienceListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncExperiencesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawExperiencesClient rawClient; + + public AsyncExperiencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawExperiencesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawExperiencesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of experiences belonging to a company, with optional filtering by product and app. + */ + public CompletableFuture> list(ListExperiencesRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of experiences belonging to a company, with optional filtering by product and app. + */ + public CompletableFuture> list( + ListExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Required permissions: + *
    + *
  • experience:create
  • + *
+ */ + public CompletableFuture create(CreateExperiencesRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Required permissions: + *
    + *
  • experience:create
  • + *
+ */ + public CompletableFuture create(CreateExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing experience. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing experience. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing experience. + */ + public CompletableFuture retrieve(String id, RetrieveExperiencesRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing experience. + */ + public CompletableFuture retrieve( + String id, RetrieveExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public CompletableFuture delete(String id, DeleteExperiencesRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public CompletableFuture delete( + String id, DeleteExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public CompletableFuture update(String id, UpdateExperiencesRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public CompletableFuture update( + String id, UpdateExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Attach an experience to a product, making it accessible to the product's customers. + *

Required permissions:

+ *
    + *
  • experience:attach
  • + *
+ */ + public CompletableFuture attach(String id, AttachExperiencesRequest request) { + return this.rawClient.attach(id, request).thenApply(response -> response.body()); + } + + /** + * Attach an experience to a product, making it accessible to the product's customers. + *

Required permissions:

+ *
    + *
  • experience:attach
  • + *
+ */ + public CompletableFuture attach( + String id, AttachExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.attach(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Detach an experience from a product, removing customer access to it through that product. + *

Required permissions:

+ *
    + *
  • experience:detach
  • + *
+ */ + public CompletableFuture detach(String id, DetachExperiencesRequest request) { + return this.rawClient.detach(id, request).thenApply(response -> response.body()); + } + + /** + * Detach an experience from a product, removing customer access to it through that product. + *

Required permissions:

+ *
    + *
  • experience:detach
  • + *
+ */ + public CompletableFuture detach( + String id, DetachExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.detach(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public CompletableFuture duplicate(String id) { + return this.rawClient.duplicate(id).thenApply(response -> response.body()); + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public CompletableFuture duplicate(String id, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public CompletableFuture duplicate(String id, DuplicateExperiencesRequest request) { + return this.rawClient.duplicate(id, request).thenApply(response -> response.body()); + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public CompletableFuture duplicate( + String id, DuplicateExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/experiences/AsyncRawExperiencesClient.java b/src/main/java/com/whop/api/resources/experiences/AsyncRawExperiencesClient.java new file mode 100644 index 00000000..5b51a69b --- /dev/null +++ b/src/main/java/com/whop/api/resources/experiences/AsyncRawExperiencesClient.java @@ -0,0 +1,1078 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.experiences; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.experiences.requests.AttachExperiencesRequest; +import com.whop.api.resources.experiences.requests.CreateExperiencesRequest; +import com.whop.api.resources.experiences.requests.DeleteExperiencesRequest; +import com.whop.api.resources.experiences.requests.DetachExperiencesRequest; +import com.whop.api.resources.experiences.requests.DuplicateExperiencesRequest; +import com.whop.api.resources.experiences.requests.ListExperiencesRequest; +import com.whop.api.resources.experiences.requests.RetrieveExperiencesRequest; +import com.whop.api.resources.experiences.requests.UpdateExperiencesRequest; +import com.whop.api.resources.experiences.types.ListExperiencesResponse; +import com.whop.api.types.Experience; +import com.whop.api.types.ExperienceListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawExperiencesClient { + protected final ClientOptions clientOptions; + + public AsyncRawExperiencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of experiences belonging to a company, with optional filtering by product and app. + */ + public CompletableFuture>> list( + ListExperiencesRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of experiences belonging to a company, with optional filtering by product and app. + */ + public CompletableFuture>> list( + ListExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getProductId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_id", request.getProductId().get(), false); + } + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListExperiencesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListExperiencesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListExperiencesRequest nextRequest = ListExperiencesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Required permissions: + *
    + *
  • experience:create
  • + *
+ */ + public CompletableFuture> create(CreateExperiencesRequest request) { + return create(request, null); + } + + /** + * Required permissions: + *
    + *
  • experience:create
  • + *
+ */ + public CompletableFuture> create( + CreateExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Experience.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing experience. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveExperiencesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing experience. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveExperiencesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing experience. + */ + public CompletableFuture> retrieve(String id, RetrieveExperiencesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing experience. + */ + public CompletableFuture> retrieve( + String id, RetrieveExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Experience.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteExperiencesRequest.builder().build()); + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteExperiencesRequest.builder().build(), requestOptions); + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public CompletableFuture> delete(String id, DeleteExperiencesRequest request) { + return delete(id, request, null); + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public CompletableFuture> delete( + String id, DeleteExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public CompletableFuture> update(String id) { + return update(id, UpdateExperiencesRequest.builder().build()); + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateExperiencesRequest.builder().build(), requestOptions); + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public CompletableFuture> update(String id, UpdateExperiencesRequest request) { + return update(id, request, null); + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public CompletableFuture> update( + String id, UpdateExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Experience.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Attach an experience to a product, making it accessible to the product's customers. + *

Required permissions:

+ *
    + *
  • experience:attach
  • + *
+ */ + public CompletableFuture> attach(String id, AttachExperiencesRequest request) { + return attach(id, request, null); + } + + /** + * Attach an experience to a product, making it accessible to the product's customers. + *

Required permissions:

+ *
    + *
  • experience:attach
  • + *
+ */ + public CompletableFuture> attach( + String id, AttachExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences") + .addPathSegment(id) + .addPathSegments("attach"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Experience.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Detach an experience from a product, removing customer access to it through that product. + *

Required permissions:

+ *
    + *
  • experience:detach
  • + *
+ */ + public CompletableFuture> detach(String id, DetachExperiencesRequest request) { + return detach(id, request, null); + } + + /** + * Detach an experience from a product, removing customer access to it through that product. + *

Required permissions:

+ *
    + *
  • experience:detach
  • + *
+ */ + public CompletableFuture> detach( + String id, DetachExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences") + .addPathSegment(id) + .addPathSegments("detach"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Experience.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public CompletableFuture> duplicate(String id) { + return duplicate(id, DuplicateExperiencesRequest.builder().build()); + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public CompletableFuture> duplicate(String id, RequestOptions requestOptions) { + return duplicate(id, DuplicateExperiencesRequest.builder().build(), requestOptions); + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public CompletableFuture> duplicate( + String id, DuplicateExperiencesRequest request) { + return duplicate(id, request, null); + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public CompletableFuture> duplicate( + String id, DuplicateExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences") + .addPathSegment(id) + .addPathSegments("duplicate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Experience.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/experiences/ExperiencesClient.java b/src/main/java/com/whop/api/resources/experiences/ExperiencesClient.java new file mode 100644 index 00000000..57900f81 --- /dev/null +++ b/src/main/java/com/whop/api/resources/experiences/ExperiencesClient.java @@ -0,0 +1,274 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.experiences; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.experiences.requests.AttachExperiencesRequest; +import com.whop.api.resources.experiences.requests.CreateExperiencesRequest; +import com.whop.api.resources.experiences.requests.DeleteExperiencesRequest; +import com.whop.api.resources.experiences.requests.DetachExperiencesRequest; +import com.whop.api.resources.experiences.requests.DuplicateExperiencesRequest; +import com.whop.api.resources.experiences.requests.ListExperiencesRequest; +import com.whop.api.resources.experiences.requests.RetrieveExperiencesRequest; +import com.whop.api.resources.experiences.requests.UpdateExperiencesRequest; +import com.whop.api.types.Experience; +import com.whop.api.types.ExperienceListItem; + +public class ExperiencesClient { + protected final ClientOptions clientOptions; + + private final RawExperiencesClient rawClient; + + public ExperiencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawExperiencesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawExperiencesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of experiences belonging to a company, with optional filtering by product and app. + */ + public SyncPagingIterable list(ListExperiencesRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of experiences belonging to a company, with optional filtering by product and app. + */ + public SyncPagingIterable list(ListExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Required permissions: + *
    + *
  • experience:create
  • + *
+ */ + public Experience create(CreateExperiencesRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Required permissions: + *
    + *
  • experience:create
  • + *
+ */ + public Experience create(CreateExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing experience. + */ + public Experience retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing experience. + */ + public Experience retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing experience. + */ + public Experience retrieve(String id, RetrieveExperiencesRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing experience. + */ + public Experience retrieve(String id, RetrieveExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public boolean delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public boolean delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public boolean delete(String id, DeleteExperiencesRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public boolean delete(String id, DeleteExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public Experience update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public Experience update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public Experience update(String id, UpdateExperiencesRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public Experience update(String id, UpdateExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Attach an experience to a product, making it accessible to the product's customers. + *

Required permissions:

+ *
    + *
  • experience:attach
  • + *
+ */ + public Experience attach(String id, AttachExperiencesRequest request) { + return this.rawClient.attach(id, request).body(); + } + + /** + * Attach an experience to a product, making it accessible to the product's customers. + *

Required permissions:

+ *
    + *
  • experience:attach
  • + *
+ */ + public Experience attach(String id, AttachExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.attach(id, request, requestOptions).body(); + } + + /** + * Detach an experience from a product, removing customer access to it through that product. + *

Required permissions:

+ *
    + *
  • experience:detach
  • + *
+ */ + public Experience detach(String id, DetachExperiencesRequest request) { + return this.rawClient.detach(id, request).body(); + } + + /** + * Detach an experience from a product, removing customer access to it through that product. + *

Required permissions:

+ *
    + *
  • experience:detach
  • + *
+ */ + public Experience detach(String id, DetachExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.detach(id, request, requestOptions).body(); + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public Experience duplicate(String id) { + return this.rawClient.duplicate(id).body(); + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public Experience duplicate(String id, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, requestOptions).body(); + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public Experience duplicate(String id, DuplicateExperiencesRequest request) { + return this.rawClient.duplicate(id, request).body(); + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public Experience duplicate(String id, DuplicateExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.duplicate(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/experiences/RawExperiencesClient.java b/src/main/java/com/whop/api/resources/experiences/RawExperiencesClient.java new file mode 100644 index 00000000..155bb3dc --- /dev/null +++ b/src/main/java/com/whop/api/resources/experiences/RawExperiencesClient.java @@ -0,0 +1,845 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.experiences; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.experiences.requests.AttachExperiencesRequest; +import com.whop.api.resources.experiences.requests.CreateExperiencesRequest; +import com.whop.api.resources.experiences.requests.DeleteExperiencesRequest; +import com.whop.api.resources.experiences.requests.DetachExperiencesRequest; +import com.whop.api.resources.experiences.requests.DuplicateExperiencesRequest; +import com.whop.api.resources.experiences.requests.ListExperiencesRequest; +import com.whop.api.resources.experiences.requests.RetrieveExperiencesRequest; +import com.whop.api.resources.experiences.requests.UpdateExperiencesRequest; +import com.whop.api.resources.experiences.types.ListExperiencesResponse; +import com.whop.api.types.Experience; +import com.whop.api.types.ExperienceListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawExperiencesClient { + protected final ClientOptions clientOptions; + + public RawExperiencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of experiences belonging to a company, with optional filtering by product and app. + */ + public WhopApiHttpResponse> list(ListExperiencesRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of experiences belonging to a company, with optional filtering by product and app. + */ + public WhopApiHttpResponse> list( + ListExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getProductId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_id", request.getProductId().get(), false); + } + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListExperiencesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListExperiencesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListExperiencesRequest nextRequest = ListExperiencesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Required permissions: + *
    + *
  • experience:create
  • + *
+ */ + public WhopApiHttpResponse create(CreateExperiencesRequest request) { + return create(request, null); + } + + /** + * Required permissions: + *
    + *
  • experience:create
  • + *
+ */ + public WhopApiHttpResponse create(CreateExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Experience.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing experience. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveExperiencesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing experience. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveExperiencesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing experience. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveExperiencesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing experience. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Experience.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteExperiencesRequest.builder().build()); + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteExperiencesRequest.builder().build(), requestOptions); + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public WhopApiHttpResponse delete(String id, DeleteExperiencesRequest request) { + return delete(id, request, null); + } + + /** + * Required permissions: + *
    + *
  • experience:delete
  • + *
+ */ + public WhopApiHttpResponse delete( + String id, DeleteExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateExperiencesRequest.builder().build()); + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateExperiencesRequest.builder().build(), requestOptions); + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateExperiencesRequest request) { + return update(id, request, null); + } + + /** + * Required permissions: + *
    + *
  • experience:update
  • + *
+ */ + public WhopApiHttpResponse update( + String id, UpdateExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Experience.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Attach an experience to a product, making it accessible to the product's customers. + *

Required permissions:

+ *
    + *
  • experience:attach
  • + *
+ */ + public WhopApiHttpResponse attach(String id, AttachExperiencesRequest request) { + return attach(id, request, null); + } + + /** + * Attach an experience to a product, making it accessible to the product's customers. + *

Required permissions:

+ *
    + *
  • experience:attach
  • + *
+ */ + public WhopApiHttpResponse attach( + String id, AttachExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences") + .addPathSegment(id) + .addPathSegments("attach"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Experience.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Detach an experience from a product, removing customer access to it through that product. + *

Required permissions:

+ *
    + *
  • experience:detach
  • + *
+ */ + public WhopApiHttpResponse detach(String id, DetachExperiencesRequest request) { + return detach(id, request, null); + } + + /** + * Detach an experience from a product, removing customer access to it through that product. + *

Required permissions:

+ *
    + *
  • experience:detach
  • + *
+ */ + public WhopApiHttpResponse detach( + String id, DetachExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences") + .addPathSegment(id) + .addPathSegments("detach"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Experience.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public WhopApiHttpResponse duplicate(String id) { + return duplicate(id, DuplicateExperiencesRequest.builder().build()); + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public WhopApiHttpResponse duplicate(String id, RequestOptions requestOptions) { + return duplicate(id, DuplicateExperiencesRequest.builder().build(), requestOptions); + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public WhopApiHttpResponse duplicate(String id, DuplicateExperiencesRequest request) { + return duplicate(id, request, null); + } + + /** + * Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. + * If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. + * No content, e.g. posts, messages, lessons from within the original experience will be copied. + *

Required permissions:

+ *
    + *
  • experience:create
  • + *
+ */ + public WhopApiHttpResponse duplicate( + String id, DuplicateExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("experiences") + .addPathSegment(id) + .addPathSegments("duplicate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Experience.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/experiences/requests/AttachExperiencesRequest.java b/src/main/java/com/whop/api/resources/experiences/requests/AttachExperiencesRequest.java new file mode 100644 index 00000000..daa14145 --- /dev/null +++ b/src/main/java/com/whop/api/resources/experiences/requests/AttachExperiencesRequest.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.experiences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AttachExperiencesRequest.Builder.class) +public final class AttachExperiencesRequest { + private final String productId; + + private final Map additionalProperties; + + private AttachExperiencesRequest(String productId, Map additionalProperties) { + this.productId = productId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the product to attach the experience to. + */ + @JsonProperty("product_id") + public String getProductId() { + return productId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AttachExperiencesRequest && equalTo((AttachExperiencesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AttachExperiencesRequest other) { + return productId.equals(other.productId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.productId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ProductIdStage builder() { + return new Builder(); + } + + public interface ProductIdStage { + /** + *

The unique identifier of the product to attach the experience to.

+ */ + _FinalStage productId(@NotNull String productId); + + Builder from(AttachExperiencesRequest other); + } + + public interface _FinalStage { + AttachExperiencesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ProductIdStage, _FinalStage { + private String productId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AttachExperiencesRequest other) { + productId(other.getProductId()); + return this; + } + + /** + *

The unique identifier of the product to attach the experience to.

+ *

The unique identifier of the product to attach the experience to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("product_id") + public _FinalStage productId(@NotNull String productId) { + this.productId = Objects.requireNonNull(productId, "productId must not be null"); + return this; + } + + @java.lang.Override + public AttachExperiencesRequest build() { + return new AttachExperiencesRequest(productId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/experiences/requests/CreateExperiencesRequest.java b/src/main/java/com/whop/api/resources/experiences/requests/CreateExperiencesRequest.java new file mode 100644 index 00000000..c2a2b8c6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/experiences/requests/CreateExperiencesRequest.java @@ -0,0 +1,530 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.experiences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.experiences.types.CreateExperiencesRequestLogo; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateExperiencesRequest.Builder.class) +public final class CreateExperiencesRequest { + private final String appId; + + private final String companyId; + + private final Optional isPublic; + + private final Optional logo; + + private final Optional name; + + private final Optional notificationsEnabled; + + private final Optional sectionId; + + private final Map additionalProperties; + + private CreateExperiencesRequest( + String appId, + String companyId, + Optional isPublic, + Optional logo, + Optional name, + Optional notificationsEnabled, + Optional sectionId, + Map additionalProperties) { + this.appId = appId; + this.companyId = companyId; + this.isPublic = isPublic; + this.logo = logo; + this.name = name; + this.notificationsEnabled = notificationsEnabled; + this.sectionId = sectionId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the app that powers this experience. + */ + @JsonProperty("app_id") + public String getAppId() { + return appId; + } + + /** + * @return The unique identifier of the company to create this experience for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return Whether the experience is publicly accessible without a membership. + */ + @JsonIgnore + public Optional getIsPublic() { + if (isPublic == null) { + return Optional.empty(); + } + return isPublic; + } + + /** + * @return A logo image displayed alongside the experience name. + */ + @JsonIgnore + public Optional getLogo() { + if (logo == null) { + return Optional.empty(); + } + return logo; + } + + /** + * @return The display name of the experience. Defaults to the app's name if not provided. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return Whether Whop app notifications are enabled for this experience. Webhooks still fire. + */ + @JsonIgnore + public Optional getNotificationsEnabled() { + if (notificationsEnabled == null) { + return Optional.empty(); + } + return notificationsEnabled; + } + + /** + * @return The unique identifier of the section to place the experience in. + */ + @JsonIgnore + public Optional getSectionId() { + if (sectionId == null) { + return Optional.empty(); + } + return sectionId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("is_public") + private Optional _getIsPublic() { + return isPublic; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo") + private Optional _getLogo() { + return logo; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notifications_enabled") + private Optional _getNotificationsEnabled() { + return notificationsEnabled; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("section_id") + private Optional _getSectionId() { + return sectionId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateExperiencesRequest && equalTo((CreateExperiencesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateExperiencesRequest other) { + return appId.equals(other.appId) + && companyId.equals(other.companyId) + && isPublic.equals(other.isPublic) + && logo.equals(other.logo) + && name.equals(other.name) + && notificationsEnabled.equals(other.notificationsEnabled) + && sectionId.equals(other.sectionId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appId, + this.companyId, + this.isPublic, + this.logo, + this.name, + this.notificationsEnabled, + this.sectionId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppIdStage builder() { + return new Builder(); + } + + public interface AppIdStage { + /** + *

The unique identifier of the app that powers this experience.

+ */ + CompanyIdStage appId(@NotNull String appId); + + Builder from(CreateExperiencesRequest other); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to create this experience for.

+ */ + _FinalStage companyId(@NotNull String companyId); + } + + public interface _FinalStage { + CreateExperiencesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Whether the experience is publicly accessible without a membership.

+ */ + _FinalStage isPublic(Optional isPublic); + + _FinalStage isPublic(Boolean isPublic); + + _FinalStage isPublic(Nullable isPublic); + + /** + *

A logo image displayed alongside the experience name.

+ */ + _FinalStage logo(Optional logo); + + _FinalStage logo(CreateExperiencesRequestLogo logo); + + _FinalStage logo(Nullable logo); + + /** + *

The display name of the experience. Defaults to the app's name if not provided.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

Whether Whop app notifications are enabled for this experience. Webhooks still fire.

+ */ + _FinalStage notificationsEnabled(Optional notificationsEnabled); + + _FinalStage notificationsEnabled(Boolean notificationsEnabled); + + _FinalStage notificationsEnabled(Nullable notificationsEnabled); + + /** + *

The unique identifier of the section to place the experience in.

+ */ + _FinalStage sectionId(Optional sectionId); + + _FinalStage sectionId(String sectionId); + + _FinalStage sectionId(Nullable sectionId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AppIdStage, CompanyIdStage, _FinalStage { + private String appId; + + private String companyId; + + private Optional sectionId = Optional.empty(); + + private Optional notificationsEnabled = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional logo = Optional.empty(); + + private Optional isPublic = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateExperiencesRequest other) { + appId(other.getAppId()); + companyId(other.getCompanyId()); + isPublic(other.getIsPublic()); + logo(other.getLogo()); + name(other.getName()); + notificationsEnabled(other.getNotificationsEnabled()); + sectionId(other.getSectionId()); + return this; + } + + /** + *

The unique identifier of the app that powers this experience.

+ *

The unique identifier of the app that powers this experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("app_id") + public CompanyIdStage appId(@NotNull String appId) { + this.appId = Objects.requireNonNull(appId, "appId must not be null"); + return this; + } + + /** + *

The unique identifier of the company to create this experience for.

+ *

The unique identifier of the company to create this experience for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The unique identifier of the section to place the experience in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sectionId(Nullable sectionId) { + if (sectionId.isNull()) { + this.sectionId = null; + } else if (sectionId.isEmpty()) { + this.sectionId = Optional.empty(); + } else { + this.sectionId = Optional.of(sectionId.get()); + } + return this; + } + + /** + *

The unique identifier of the section to place the experience in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sectionId(String sectionId) { + this.sectionId = Optional.ofNullable(sectionId); + return this; + } + + /** + *

The unique identifier of the section to place the experience in.

+ */ + @java.lang.Override + @JsonSetter(value = "section_id", nulls = Nulls.SKIP) + public _FinalStage sectionId(Optional sectionId) { + this.sectionId = sectionId; + return this; + } + + /** + *

Whether Whop app notifications are enabled for this experience. Webhooks still fire.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notificationsEnabled(Nullable notificationsEnabled) { + if (notificationsEnabled.isNull()) { + this.notificationsEnabled = null; + } else if (notificationsEnabled.isEmpty()) { + this.notificationsEnabled = Optional.empty(); + } else { + this.notificationsEnabled = Optional.of(notificationsEnabled.get()); + } + return this; + } + + /** + *

Whether Whop app notifications are enabled for this experience. Webhooks still fire.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notificationsEnabled(Boolean notificationsEnabled) { + this.notificationsEnabled = Optional.ofNullable(notificationsEnabled); + return this; + } + + /** + *

Whether Whop app notifications are enabled for this experience. Webhooks still fire.

+ */ + @java.lang.Override + @JsonSetter(value = "notifications_enabled", nulls = Nulls.SKIP) + public _FinalStage notificationsEnabled(Optional notificationsEnabled) { + this.notificationsEnabled = notificationsEnabled; + return this; + } + + /** + *

The display name of the experience. Defaults to the app's name if not provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The display name of the experience. Defaults to the app's name if not provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The display name of the experience. Defaults to the app's name if not provided.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

A logo image displayed alongside the experience name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logo(Nullable logo) { + if (logo.isNull()) { + this.logo = null; + } else if (logo.isEmpty()) { + this.logo = Optional.empty(); + } else { + this.logo = Optional.of(logo.get()); + } + return this; + } + + /** + *

A logo image displayed alongside the experience name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logo(CreateExperiencesRequestLogo logo) { + this.logo = Optional.ofNullable(logo); + return this; + } + + /** + *

A logo image displayed alongside the experience name.

+ */ + @java.lang.Override + @JsonSetter(value = "logo", nulls = Nulls.SKIP) + public _FinalStage logo(Optional logo) { + this.logo = logo; + return this; + } + + /** + *

Whether the experience is publicly accessible without a membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage isPublic(Nullable isPublic) { + if (isPublic.isNull()) { + this.isPublic = null; + } else if (isPublic.isEmpty()) { + this.isPublic = Optional.empty(); + } else { + this.isPublic = Optional.of(isPublic.get()); + } + return this; + } + + /** + *

Whether the experience is publicly accessible without a membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage isPublic(Boolean isPublic) { + this.isPublic = Optional.ofNullable(isPublic); + return this; + } + + /** + *

Whether the experience is publicly accessible without a membership.

+ */ + @java.lang.Override + @JsonSetter(value = "is_public", nulls = Nulls.SKIP) + public _FinalStage isPublic(Optional isPublic) { + this.isPublic = isPublic; + return this; + } + + @java.lang.Override + public CreateExperiencesRequest build() { + return new CreateExperiencesRequest( + appId, companyId, isPublic, logo, name, notificationsEnabled, sectionId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/experiences/requests/DeleteExperiencesRequest.java b/src/main/java/com/whop/api/resources/experiences/requests/DeleteExperiencesRequest.java new file mode 100644 index 00000000..a037c31d --- /dev/null +++ b/src/main/java/com/whop/api/resources/experiences/requests/DeleteExperiencesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.experiences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteExperiencesRequest.Builder.class) +public final class DeleteExperiencesRequest { + private final Map additionalProperties; + + private DeleteExperiencesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteExperiencesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteExperiencesRequest other) { + return this; + } + + public DeleteExperiencesRequest build() { + return new DeleteExperiencesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/experiences/requests/DetachExperiencesRequest.java b/src/main/java/com/whop/api/resources/experiences/requests/DetachExperiencesRequest.java new file mode 100644 index 00000000..9c0ce4c4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/experiences/requests/DetachExperiencesRequest.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.experiences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DetachExperiencesRequest.Builder.class) +public final class DetachExperiencesRequest { + private final String productId; + + private final Map additionalProperties; + + private DetachExperiencesRequest(String productId, Map additionalProperties) { + this.productId = productId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the product to detach the experience from. + */ + @JsonProperty("product_id") + public String getProductId() { + return productId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DetachExperiencesRequest && equalTo((DetachExperiencesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DetachExperiencesRequest other) { + return productId.equals(other.productId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.productId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ProductIdStage builder() { + return new Builder(); + } + + public interface ProductIdStage { + /** + *

The unique identifier of the product to detach the experience from.

+ */ + _FinalStage productId(@NotNull String productId); + + Builder from(DetachExperiencesRequest other); + } + + public interface _FinalStage { + DetachExperiencesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ProductIdStage, _FinalStage { + private String productId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DetachExperiencesRequest other) { + productId(other.getProductId()); + return this; + } + + /** + *

The unique identifier of the product to detach the experience from.

+ *

The unique identifier of the product to detach the experience from.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("product_id") + public _FinalStage productId(@NotNull String productId) { + this.productId = Objects.requireNonNull(productId, "productId must not be null"); + return this; + } + + @java.lang.Override + public DetachExperiencesRequest build() { + return new DetachExperiencesRequest(productId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/experiences/requests/DuplicateExperiencesRequest.java b/src/main/java/com/whop/api/resources/experiences/requests/DuplicateExperiencesRequest.java new file mode 100644 index 00000000..a5632217 --- /dev/null +++ b/src/main/java/com/whop/api/resources/experiences/requests/DuplicateExperiencesRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.experiences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DuplicateExperiencesRequest.Builder.class) +public final class DuplicateExperiencesRequest { + private final Optional name; + + private final Map additionalProperties; + + private DuplicateExperiencesRequest(Optional name, Map additionalProperties) { + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The display name for the duplicated experience. Defaults to the original experience's name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DuplicateExperiencesRequest && equalTo((DuplicateExperiencesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DuplicateExperiencesRequest other) { + return name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DuplicateExperiencesRequest other) { + name(other.getName()); + return this; + } + + /** + *

The display name for the duplicated experience. Defaults to the original experience's name.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + public DuplicateExperiencesRequest build() { + return new DuplicateExperiencesRequest(name, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/experiences/requests/ListExperiencesRequest.java b/src/main/java/com/whop/api/resources/experiences/requests/ListExperiencesRequest.java new file mode 100644 index 00000000..96b2b534 --- /dev/null +++ b/src/main/java/com/whop/api/resources/experiences/requests/ListExperiencesRequest.java @@ -0,0 +1,497 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.experiences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListExperiencesRequest.Builder.class) +public final class ListExperiencesRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String companyId; + + private final Optional productId; + + private final Optional appId; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Map additionalProperties; + + private ListExperiencesRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String companyId, + Optional productId, + Optional appId, + Optional createdBefore, + Optional createdAfter, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.productId = productId; + this.appId = appId; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to list experiences for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return Filter to only experiences attached to this product identifier. + */ + @JsonProperty("product_id") + public Optional getProductId() { + return productId; + } + + /** + * @return Filter to only experiences powered by this app identifier. + */ + @JsonProperty("app_id") + public Optional getAppId() { + return appId; + } + + /** + * @return Only return experiences created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return experiences created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListExperiencesRequest && equalTo((ListExperiencesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListExperiencesRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId) + && productId.equals(other.productId) + && appId.equals(other.appId) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.after, + this.before, + this.first, + this.last, + this.companyId, + this.productId, + this.appId, + this.createdBefore, + this.createdAfter); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to list experiences for.

+ */ + _FinalStage companyId(@NotNull String companyId); + + Builder from(ListExperiencesRequest other); + } + + public interface _FinalStage { + ListExperiencesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + /** + *

Filter to only experiences attached to this product identifier.

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + + /** + *

Filter to only experiences powered by this app identifier.

+ */ + _FinalStage appId(Optional appId); + + _FinalStage appId(String appId); + + /** + *

Only return experiences created before this timestamp.

+ */ + _FinalStage createdBefore(Optional createdBefore); + + _FinalStage createdBefore(OffsetDateTime createdBefore); + + /** + *

Only return experiences created after this timestamp.

+ */ + _FinalStage createdAfter(Optional createdAfter); + + _FinalStage createdAfter(OffsetDateTime createdAfter); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional appId = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListExperiencesRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + productId(other.getProductId()); + appId(other.getAppId()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + return this; + } + + /** + *

The unique identifier of the company to list experiences for.

+ *

The unique identifier of the company to list experiences for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

Only return experiences created after this timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only return experiences created after this timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public _FinalStage createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + /** + *

Only return experiences created before this timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return experiences created before this timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public _FinalStage createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + /** + *

Filter to only experiences powered by this app identifier.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appId(String appId) { + this.appId = Optional.ofNullable(appId); + return this; + } + + /** + *

Filter to only experiences powered by this app identifier.

+ */ + @java.lang.Override + @JsonSetter(value = "app_id", nulls = Nulls.SKIP) + public _FinalStage appId(Optional appId) { + this.appId = appId; + return this; + } + + /** + *

Filter to only experiences attached to this product identifier.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

Filter to only experiences attached to this product identifier.

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListExperiencesRequest build() { + return new ListExperiencesRequest( + after, + before, + first, + last, + companyId, + productId, + appId, + createdBefore, + createdAfter, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/experiences/requests/RetrieveExperiencesRequest.java b/src/main/java/com/whop/api/resources/experiences/requests/RetrieveExperiencesRequest.java new file mode 100644 index 00000000..6f8775b5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/experiences/requests/RetrieveExperiencesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.experiences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveExperiencesRequest.Builder.class) +public final class RetrieveExperiencesRequest { + private final Map additionalProperties; + + private RetrieveExperiencesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveExperiencesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveExperiencesRequest other) { + return this; + } + + public RetrieveExperiencesRequest build() { + return new RetrieveExperiencesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/experiences/requests/UpdateExperiencesRequest.java b/src/main/java/com/whop/api/resources/experiences/requests/UpdateExperiencesRequest.java new file mode 100644 index 00000000..e30c76fc --- /dev/null +++ b/src/main/java/com/whop/api/resources/experiences/requests/UpdateExperiencesRequest.java @@ -0,0 +1,446 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.experiences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.experiences.types.UpdateExperiencesRequestLogo; +import com.whop.api.types.ExperienceAccessLevels; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateExperiencesRequest.Builder.class) +public final class UpdateExperiencesRequest { + private final Optional accessLevel; + + private final Optional isPublic; + + private final Optional logo; + + private final Optional name; + + private final Optional notificationsEnabled; + + private final Optional order; + + private final Optional sectionId; + + private final Map additionalProperties; + + private UpdateExperiencesRequest( + Optional accessLevel, + Optional isPublic, + Optional logo, + Optional name, + Optional notificationsEnabled, + Optional order, + Optional sectionId, + Map additionalProperties) { + this.accessLevel = accessLevel; + this.isPublic = isPublic; + this.logo = logo; + this.name = name; + this.notificationsEnabled = notificationsEnabled; + this.order = order; + this.sectionId = sectionId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The access level of the experience. + */ + @JsonIgnore + public Optional getAccessLevel() { + if (accessLevel == null) { + return Optional.empty(); + } + return accessLevel; + } + + /** + * @return Whether the experience is publicly accessible without a membership. + */ + @JsonIgnore + public Optional getIsPublic() { + if (isPublic == null) { + return Optional.empty(); + } + return isPublic; + } + + /** + * @return A logo image displayed alongside the experience name. + */ + @JsonIgnore + public Optional getLogo() { + if (logo == null) { + return Optional.empty(); + } + return logo; + } + + /** + * @return The display name of the experience. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return Whether Whop app notifications are enabled for this experience. Webhooks still fire. + */ + @JsonIgnore + public Optional getNotificationsEnabled() { + if (notificationsEnabled == null) { + return Optional.empty(); + } + return notificationsEnabled; + } + + /** + * @return The position of the experience within its section for display ordering. + */ + @JsonIgnore + public Optional getOrder() { + if (order == null) { + return Optional.empty(); + } + return order; + } + + /** + * @return The unique identifier of the section to move the experience into. + */ + @JsonIgnore + public Optional getSectionId() { + if (sectionId == null) { + return Optional.empty(); + } + return sectionId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("access_level") + private Optional _getAccessLevel() { + return accessLevel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("is_public") + private Optional _getIsPublic() { + return isPublic; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo") + private Optional _getLogo() { + return logo; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notifications_enabled") + private Optional _getNotificationsEnabled() { + return notificationsEnabled; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("order") + private Optional _getOrder() { + return order; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("section_id") + private Optional _getSectionId() { + return sectionId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateExperiencesRequest && equalTo((UpdateExperiencesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateExperiencesRequest other) { + return accessLevel.equals(other.accessLevel) + && isPublic.equals(other.isPublic) + && logo.equals(other.logo) + && name.equals(other.name) + && notificationsEnabled.equals(other.notificationsEnabled) + && order.equals(other.order) + && sectionId.equals(other.sectionId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accessLevel, + this.isPublic, + this.logo, + this.name, + this.notificationsEnabled, + this.order, + this.sectionId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accessLevel = Optional.empty(); + + private Optional isPublic = Optional.empty(); + + private Optional logo = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional notificationsEnabled = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional sectionId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateExperiencesRequest other) { + accessLevel(other.getAccessLevel()); + isPublic(other.getIsPublic()); + logo(other.getLogo()); + name(other.getName()); + notificationsEnabled(other.getNotificationsEnabled()); + order(other.getOrder()); + sectionId(other.getSectionId()); + return this; + } + + /** + *

The access level of the experience.

+ */ + @JsonSetter(value = "access_level", nulls = Nulls.SKIP) + public Builder accessLevel(Optional accessLevel) { + this.accessLevel = accessLevel; + return this; + } + + public Builder accessLevel(ExperienceAccessLevels accessLevel) { + this.accessLevel = Optional.ofNullable(accessLevel); + return this; + } + + public Builder accessLevel(Nullable accessLevel) { + if (accessLevel.isNull()) { + this.accessLevel = null; + } else if (accessLevel.isEmpty()) { + this.accessLevel = Optional.empty(); + } else { + this.accessLevel = Optional.of(accessLevel.get()); + } + return this; + } + + /** + *

Whether the experience is publicly accessible without a membership.

+ */ + @JsonSetter(value = "is_public", nulls = Nulls.SKIP) + public Builder isPublic(Optional isPublic) { + this.isPublic = isPublic; + return this; + } + + public Builder isPublic(Boolean isPublic) { + this.isPublic = Optional.ofNullable(isPublic); + return this; + } + + public Builder isPublic(Nullable isPublic) { + if (isPublic.isNull()) { + this.isPublic = null; + } else if (isPublic.isEmpty()) { + this.isPublic = Optional.empty(); + } else { + this.isPublic = Optional.of(isPublic.get()); + } + return this; + } + + /** + *

A logo image displayed alongside the experience name.

+ */ + @JsonSetter(value = "logo", nulls = Nulls.SKIP) + public Builder logo(Optional logo) { + this.logo = logo; + return this; + } + + public Builder logo(UpdateExperiencesRequestLogo logo) { + this.logo = Optional.ofNullable(logo); + return this; + } + + public Builder logo(Nullable logo) { + if (logo.isNull()) { + this.logo = null; + } else if (logo.isEmpty()) { + this.logo = Optional.empty(); + } else { + this.logo = Optional.of(logo.get()); + } + return this; + } + + /** + *

The display name of the experience.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Whether Whop app notifications are enabled for this experience. Webhooks still fire.

+ */ + @JsonSetter(value = "notifications_enabled", nulls = Nulls.SKIP) + public Builder notificationsEnabled(Optional notificationsEnabled) { + this.notificationsEnabled = notificationsEnabled; + return this; + } + + public Builder notificationsEnabled(Boolean notificationsEnabled) { + this.notificationsEnabled = Optional.ofNullable(notificationsEnabled); + return this; + } + + public Builder notificationsEnabled(Nullable notificationsEnabled) { + if (notificationsEnabled.isNull()) { + this.notificationsEnabled = null; + } else if (notificationsEnabled.isEmpty()) { + this.notificationsEnabled = Optional.empty(); + } else { + this.notificationsEnabled = Optional.of(notificationsEnabled.get()); + } + return this; + } + + /** + *

The position of the experience within its section for display ordering.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(String order) { + this.order = Optional.ofNullable(order); + return this; + } + + public Builder order(Nullable order) { + if (order.isNull()) { + this.order = null; + } else if (order.isEmpty()) { + this.order = Optional.empty(); + } else { + this.order = Optional.of(order.get()); + } + return this; + } + + /** + *

The unique identifier of the section to move the experience into.

+ */ + @JsonSetter(value = "section_id", nulls = Nulls.SKIP) + public Builder sectionId(Optional sectionId) { + this.sectionId = sectionId; + return this; + } + + public Builder sectionId(String sectionId) { + this.sectionId = Optional.ofNullable(sectionId); + return this; + } + + public Builder sectionId(Nullable sectionId) { + if (sectionId.isNull()) { + this.sectionId = null; + } else if (sectionId.isEmpty()) { + this.sectionId = Optional.empty(); + } else { + this.sectionId = Optional.of(sectionId.get()); + } + return this; + } + + public UpdateExperiencesRequest build() { + return new UpdateExperiencesRequest( + accessLevel, isPublic, logo, name, notificationsEnabled, order, sectionId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/experiences/types/CreateExperiencesRequestLogo.java b/src/main/java/com/whop/api/resources/experiences/types/CreateExperiencesRequestLogo.java new file mode 100644 index 00000000..263b894b --- /dev/null +++ b/src/main/java/com/whop/api/resources/experiences/types/CreateExperiencesRequestLogo.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.experiences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateExperiencesRequestLogo.Builder.class) +public final class CreateExperiencesRequestLogo { + private final String id; + + private final Map additionalProperties; + + private CreateExperiencesRequestLogo(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateExperiencesRequestLogo && equalTo((CreateExperiencesRequestLogo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateExperiencesRequestLogo other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CreateExperiencesRequestLogo other); + } + + public interface _FinalStage { + CreateExperiencesRequestLogo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateExperiencesRequestLogo other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CreateExperiencesRequestLogo build() { + return new CreateExperiencesRequestLogo(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/experiences/types/ListExperiencesResponse.java b/src/main/java/com/whop/api/resources/experiences/types/ListExperiencesResponse.java new file mode 100644 index 00000000..910c7f3f --- /dev/null +++ b/src/main/java/com/whop/api/resources/experiences/types/ListExperiencesResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.experiences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.ExperienceListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListExperiencesResponse.Builder.class) +public final class ListExperiencesResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListExperiencesResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListExperiencesResponse && equalTo((ListExperiencesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListExperiencesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListExperiencesResponse other); + } + + public interface _FinalStage { + ListExperiencesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(ExperienceListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListExperiencesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(ExperienceListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListExperiencesResponse build() { + return new ListExperiencesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/experiences/types/UpdateExperiencesRequestLogo.java b/src/main/java/com/whop/api/resources/experiences/types/UpdateExperiencesRequestLogo.java new file mode 100644 index 00000000..937fc05e --- /dev/null +++ b/src/main/java/com/whop/api/resources/experiences/types/UpdateExperiencesRequestLogo.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.experiences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateExperiencesRequestLogo.Builder.class) +public final class UpdateExperiencesRequestLogo { + private final String id; + + private final Map additionalProperties; + + private UpdateExperiencesRequestLogo(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateExperiencesRequestLogo && equalTo((UpdateExperiencesRequestLogo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateExperiencesRequestLogo other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateExperiencesRequestLogo other); + } + + public interface _FinalStage { + UpdateExperiencesRequestLogo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateExperiencesRequestLogo other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateExperiencesRequestLogo build() { + return new UpdateExperiencesRequestLogo(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/exports/AsyncExportsClient.java b/src/main/java/com/whop/api/resources/exports/AsyncExportsClient.java new file mode 100644 index 00000000..1384ae22 --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/AsyncExportsClient.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.exports.requests.CreateExportsRequest; +import com.whop.api.resources.exports.requests.ListExportsRequest; +import com.whop.api.resources.exports.requests.RetrieveExportsRequest; +import com.whop.api.resources.exports.types.ListExportsResponse; +import com.whop.api.types.Export; +import java.util.concurrent.CompletableFuture; + +public class AsyncExportsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawExportsClient rawClient; + + public AsyncExportsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawExportsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawExportsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public CompletableFuture list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public CompletableFuture list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public CompletableFuture list(ListExportsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public CompletableFuture list(ListExportsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Starts an asynchronous CSV export of a resource for an account. Returns the export in pending; poll GET /exports/{id} until download_url is set. + */ + public CompletableFuture create(CreateExportsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Starts an asynchronous CSV export of a resource for an account. Returns the export in pending; poll GET /exports/{id} until download_url is set. + */ + public CompletableFuture create(CreateExportsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public CompletableFuture retrieve(String id, RetrieveExportsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public CompletableFuture retrieve( + String id, RetrieveExportsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/exports/AsyncRawExportsClient.java b/src/main/java/com/whop/api/resources/exports/AsyncRawExportsClient.java new file mode 100644 index 00000000..88852961 --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/AsyncRawExportsClient.java @@ -0,0 +1,353 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.exports.requests.CreateExportsRequest; +import com.whop.api.resources.exports.requests.ListExportsRequest; +import com.whop.api.resources.exports.requests.RetrieveExportsRequest; +import com.whop.api.resources.exports.types.ListExportsResponse; +import com.whop.api.types.Export; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawExportsClient { + protected final ClientOptions clientOptions; + + public AsyncRawExportsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public CompletableFuture> list() { + return list(ListExportsRequest.builder().build()); + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return list(ListExportsRequest.builder().build(), requestOptions); + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public CompletableFuture> list(ListExportsRequest request) { + return list(request, null); + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public CompletableFuture> list( + ListExportsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("exports"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getResource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "resource", request.getResource().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListExportsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Starts an asynchronous CSV export of a resource for an account. Returns the export in pending; poll GET /exports/{id} until download_url is set. + */ + public CompletableFuture> create(CreateExportsRequest request) { + return create(request, null); + } + + /** + * Starts an asynchronous CSV export of a resource for an account. Returns the export in pending; poll GET /exports/{id} until download_url is set. + */ + public CompletableFuture> create( + CreateExportsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("exports"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Export.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveExportsRequest.builder().build()); + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveExportsRequest.builder().build(), requestOptions); + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public CompletableFuture> retrieve(String id, RetrieveExportsRequest request) { + return retrieve(id, request, null); + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public CompletableFuture> retrieve( + String id, RetrieveExportsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("exports") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Export.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/exports/ExportsClient.java b/src/main/java/com/whop/api/resources/exports/ExportsClient.java new file mode 100644 index 00000000..0b9bbfd1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/ExportsClient.java @@ -0,0 +1,100 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.exports.requests.CreateExportsRequest; +import com.whop.api.resources.exports.requests.ListExportsRequest; +import com.whop.api.resources.exports.requests.RetrieveExportsRequest; +import com.whop.api.resources.exports.types.ListExportsResponse; +import com.whop.api.types.Export; + +public class ExportsClient { + protected final ClientOptions clientOptions; + + private final RawExportsClient rawClient; + + public ExportsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawExportsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawExportsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public ListExportsResponse list() { + return this.rawClient.list().body(); + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public ListExportsResponse list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public ListExportsResponse list(ListExportsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public ListExportsResponse list(ListExportsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Starts an asynchronous CSV export of a resource for an account. Returns the export in pending; poll GET /exports/{id} until download_url is set. + */ + public Export create(CreateExportsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Starts an asynchronous CSV export of a resource for an account. Returns the export in pending; poll GET /exports/{id} until download_url is set. + */ + public Export create(CreateExportsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public Export retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public Export retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public Export retrieve(String id, RetrieveExportsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public Export retrieve(String id, RetrieveExportsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/exports/RawExportsClient.java b/src/main/java/com/whop/api/resources/exports/RawExportsClient.java new file mode 100644 index 00000000..79380ac1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/RawExportsClient.java @@ -0,0 +1,288 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.exports.requests.CreateExportsRequest; +import com.whop.api.resources.exports.requests.ListExportsRequest; +import com.whop.api.resources.exports.requests.RetrieveExportsRequest; +import com.whop.api.resources.exports.types.ListExportsResponse; +import com.whop.api.types.Export; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawExportsClient { + protected final ClientOptions clientOptions; + + public RawExportsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public WhopApiHttpResponse list() { + return list(ListExportsRequest.builder().build()); + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public WhopApiHttpResponse list(RequestOptions requestOptions) { + return list(ListExportsRequest.builder().build(), requestOptions); + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public WhopApiHttpResponse list(ListExportsRequest request) { + return list(request, null); + } + + /** + * Lists the exports requested for an account, newest first. Only exports of resources the credential is allowed to export are returned. + */ + public WhopApiHttpResponse list(ListExportsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("exports"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getResource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "resource", request.getResource().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListExportsResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Starts an asynchronous CSV export of a resource for an account. Returns the export in pending; poll GET /exports/{id} until download_url is set. + */ + public WhopApiHttpResponse create(CreateExportsRequest request) { + return create(request, null); + } + + /** + * Starts an asynchronous CSV export of a resource for an account. Returns the export in pending; poll GET /exports/{id} until download_url is set. + */ + public WhopApiHttpResponse create(CreateExportsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("exports"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Export.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveExportsRequest.builder().build()); + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveExportsRequest.builder().build(), requestOptions); + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveExportsRequest request) { + return retrieve(id, request, null); + } + + /** + * Fetches an export's status and, once complete, its download link. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveExportsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("exports") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Export.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/exports/requests/CreateExportsRequest.java b/src/main/java/com/whop/api/resources/exports/requests/CreateExportsRequest.java new file mode 100644 index 00000000..5fce2577 --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/requests/CreateExportsRequest.java @@ -0,0 +1,307 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.exports.types.CreateExportsRequestResource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateExportsRequest.Builder.class) +public final class CreateExportsRequest { + private final Optional accountId; + + private final Optional> columns; + + private final Optional> filters; + + private final CreateExportsRequestResource resource; + + private final Optional timezone; + + private final Map additionalProperties; + + private CreateExportsRequest( + Optional accountId, + Optional> columns, + Optional> filters, + CreateExportsRequestResource resource, + Optional timezone, + Map additionalProperties) { + this.accountId = accountId; + this.columns = columns; + this.filters = filters; + this.resource = resource; + this.timezone = timezone; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account to export from, prefixed biz_. Defaults to the credential's account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Column keys to include. Empty means all columns for the resource. + */ + @JsonProperty("columns") + public Optional> getColumns() { + return columns; + } + + /** + * @return Resource-specific filters. For native REST resources (payouts, transfers, memberships) these are the resource's own list query params; for dashboard tables they mirror the dashboard table filters. + */ + @JsonProperty("filters") + public Optional> getFilters() { + return filters; + } + + /** + * @return The resource to export, e.g. payouts, receipts, or members. + */ + @JsonProperty("resource") + public CreateExportsRequestResource getResource() { + return resource; + } + + /** + * @return IANA timezone for date columns, e.g. America/New_York. Defaults to UTC. + */ + @JsonProperty("timezone") + public Optional getTimezone() { + return timezone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateExportsRequest && equalTo((CreateExportsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateExportsRequest other) { + return accountId.equals(other.accountId) + && columns.equals(other.columns) + && filters.equals(other.filters) + && resource.equals(other.resource) + && timezone.equals(other.timezone); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.columns, this.filters, this.resource, this.timezone); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ResourceStage builder() { + return new Builder(); + } + + public interface ResourceStage { + /** + *

The resource to export, e.g. payouts, receipts, or members.

+ */ + _FinalStage resource(@NotNull CreateExportsRequestResource resource); + + Builder from(CreateExportsRequest other); + } + + public interface _FinalStage { + CreateExportsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account to export from, prefixed biz_. Defaults to the credential's account.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + /** + *

Column keys to include. Empty means all columns for the resource.

+ */ + _FinalStage columns(Optional> columns); + + _FinalStage columns(List columns); + + /** + *

Resource-specific filters. For native REST resources (payouts, transfers, memberships) these are the resource's own list query params; for dashboard tables they mirror the dashboard table filters.

+ */ + _FinalStage filters(Optional> filters); + + _FinalStage filters(Map filters); + + /** + *

IANA timezone for date columns, e.g. America/New_York. Defaults to UTC.

+ */ + _FinalStage timezone(Optional timezone); + + _FinalStage timezone(String timezone); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ResourceStage, _FinalStage { + private CreateExportsRequestResource resource; + + private Optional timezone = Optional.empty(); + + private Optional> filters = Optional.empty(); + + private Optional> columns = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateExportsRequest other) { + accountId(other.getAccountId()); + columns(other.getColumns()); + filters(other.getFilters()); + resource(other.getResource()); + timezone(other.getTimezone()); + return this; + } + + /** + *

The resource to export, e.g. payouts, receipts, or members.

+ *

The resource to export, e.g. payouts, receipts, or members.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource") + public _FinalStage resource(@NotNull CreateExportsRequestResource resource) { + this.resource = Objects.requireNonNull(resource, "resource must not be null"); + return this; + } + + /** + *

IANA timezone for date columns, e.g. America/New_York. Defaults to UTC.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timezone(String timezone) { + this.timezone = Optional.ofNullable(timezone); + return this; + } + + /** + *

IANA timezone for date columns, e.g. America/New_York. Defaults to UTC.

+ */ + @java.lang.Override + @JsonSetter(value = "timezone", nulls = Nulls.SKIP) + public _FinalStage timezone(Optional timezone) { + this.timezone = timezone; + return this; + } + + /** + *

Resource-specific filters. For native REST resources (payouts, transfers, memberships) these are the resource's own list query params; for dashboard tables they mirror the dashboard table filters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filters(Map filters) { + this.filters = Optional.ofNullable(filters); + return this; + } + + /** + *

Resource-specific filters. For native REST resources (payouts, transfers, memberships) these are the resource's own list query params; for dashboard tables they mirror the dashboard table filters.

+ */ + @java.lang.Override + @JsonSetter(value = "filters", nulls = Nulls.SKIP) + public _FinalStage filters(Optional> filters) { + this.filters = filters; + return this; + } + + /** + *

Column keys to include. Empty means all columns for the resource.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage columns(List columns) { + this.columns = Optional.ofNullable(columns); + return this; + } + + /** + *

Column keys to include. Empty means all columns for the resource.

+ */ + @java.lang.Override + @JsonSetter(value = "columns", nulls = Nulls.SKIP) + public _FinalStage columns(Optional> columns) { + this.columns = columns; + return this; + } + + /** + *

The account to export from, prefixed biz_. Defaults to the credential's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account to export from, prefixed biz_. Defaults to the credential's account.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public CreateExportsRequest build() { + return new CreateExportsRequest(accountId, columns, filters, resource, timezone, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/exports/requests/ListExportsRequest.java b/src/main/java/com/whop/api/resources/exports/requests/ListExportsRequest.java new file mode 100644 index 00000000..d9c1967b --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/requests/ListExportsRequest.java @@ -0,0 +1,305 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.exports.types.ListExportsRequestDirection; +import com.whop.api.resources.exports.types.ListExportsRequestOrder; +import com.whop.api.resources.exports.types.ListExportsRequestResource; +import com.whop.api.resources.exports.types.ListExportsRequestStatus; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListExportsRequest.Builder.class) +public final class ListExportsRequest { + private final Optional accountId; + + private final Optional resource; + + private final Optional status; + + private final Optional createdAfter; + + private final Optional createdBefore; + + private final Optional order; + + private final Optional direction; + + private final Map additionalProperties; + + private ListExportsRequest( + Optional accountId, + Optional resource, + Optional status, + Optional createdAfter, + Optional createdBefore, + Optional order, + Optional direction, + Map additionalProperties) { + this.accountId = accountId; + this.resource = resource; + this.status = status; + this.createdAfter = createdAfter; + this.createdBefore = createdBefore; + this.order = order; + this.direction = direction; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account to list exports for, prefixed biz_. Defaults to the credential's account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Only return exports of this resource. + */ + @JsonProperty("resource") + public Optional getResource() { + return resource; + } + + /** + * @return Only return exports in this status. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Only return exports created at or after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Only return exports created at or before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return The field to sort by. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return The sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListExportsRequest && equalTo((ListExportsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListExportsRequest other) { + return accountId.equals(other.accountId) + && resource.equals(other.resource) + && status.equals(other.status) + && createdAfter.equals(other.createdAfter) + && createdBefore.equals(other.createdBefore) + && order.equals(other.order) + && direction.equals(other.direction); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.resource, + this.status, + this.createdAfter, + this.createdBefore, + this.order, + this.direction); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional resource = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListExportsRequest other) { + accountId(other.getAccountId()); + resource(other.getResource()); + status(other.getStatus()); + createdAfter(other.getCreatedAfter()); + createdBefore(other.getCreatedBefore()); + order(other.getOrder()); + direction(other.getDirection()); + return this; + } + + /** + *

The account to list exports for, prefixed biz_. Defaults to the credential's account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Only return exports of this resource.

+ */ + @JsonSetter(value = "resource", nulls = Nulls.SKIP) + public Builder resource(Optional resource) { + this.resource = resource; + return this; + } + + public Builder resource(ListExportsRequestResource resource) { + this.resource = Optional.ofNullable(resource); + return this; + } + + /** + *

Only return exports in this status.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListExportsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Only return exports created at or after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only return exports created at or before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

The field to sort by.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListExportsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListExportsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + public ListExportsRequest build() { + return new ListExportsRequest( + accountId, resource, status, createdAfter, createdBefore, order, direction, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/exports/requests/RetrieveExportsRequest.java b/src/main/java/com/whop/api/resources/exports/requests/RetrieveExportsRequest.java new file mode 100644 index 00000000..0f1e8a96 --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/requests/RetrieveExportsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveExportsRequest.Builder.class) +public final class RetrieveExportsRequest { + private final Map additionalProperties; + + private RetrieveExportsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveExportsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveExportsRequest other) { + return this; + } + + public RetrieveExportsRequest build() { + return new RetrieveExportsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/exports/types/CreateExportsRequestResource.java b/src/main/java/com/whop/api/resources/exports/types/CreateExportsRequestResource.java new file mode 100644 index 00000000..18b1aff4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/types/CreateExportsRequestResource.java @@ -0,0 +1,454 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateExportsRequestResource { + public static final CreateExportsRequestResource RECEIPTS = + new CreateExportsRequestResource(Value.RECEIPTS, "receipts"); + + public static final CreateExportsRequestResource AD_GROUPS = + new CreateExportsRequestResource(Value.AD_GROUPS, "ad_groups"); + + public static final CreateExportsRequestResource MEMBERS = + new CreateExportsRequestResource(Value.MEMBERS, "members"); + + public static final CreateExportsRequestResource PEOPLE = new CreateExportsRequestResource(Value.PEOPLE, "people"); + + public static final CreateExportsRequestResource TEAM_MEMBERS = + new CreateExportsRequestResource(Value.TEAM_MEMBERS, "team_members"); + + public static final CreateExportsRequestResource PROMO_CODES = + new CreateExportsRequestResource(Value.PROMO_CODES, "promo_codes"); + + public static final CreateExportsRequestResource CARD_TRANSACTIONS = + new CreateExportsRequestResource(Value.CARD_TRANSACTIONS, "card_transactions"); + + public static final CreateExportsRequestResource PAYOUTS = + new CreateExportsRequestResource(Value.PAYOUTS, "payouts"); + + public static final CreateExportsRequestResource FINANCIAL_ACTIVITY = + new CreateExportsRequestResource(Value.FINANCIAL_ACTIVITY, "financial-activity"); + + public static final CreateExportsRequestResource CONTENT_REWARDS_SUBMISSIONS = + new CreateExportsRequestResource(Value.CONTENT_REWARDS_SUBMISSIONS, "content_rewards_submissions"); + + public static final CreateExportsRequestResource LEADS = new CreateExportsRequestResource(Value.LEADS, "leads"); + + public static final CreateExportsRequestResource TRACKING_LINKS = + new CreateExportsRequestResource(Value.TRACKING_LINKS, "tracking_links"); + + public static final CreateExportsRequestResource AUDIENCES = + new CreateExportsRequestResource(Value.AUDIENCES, "audiences"); + + public static final CreateExportsRequestResource BOUNTY_SUBMISSIONS = + new CreateExportsRequestResource(Value.BOUNTY_SUBMISSIONS, "bounty_submissions"); + + public static final CreateExportsRequestResource SHIPMENTS = + new CreateExportsRequestResource(Value.SHIPMENTS, "shipments"); + + public static final CreateExportsRequestResource ENTRIES = + new CreateExportsRequestResource(Value.ENTRIES, "entries"); + + public static final CreateExportsRequestResource MEMBERSHIPS = + new CreateExportsRequestResource(Value.MEMBERSHIPS, "memberships"); + + public static final CreateExportsRequestResource TRANSFERS = + new CreateExportsRequestResource(Value.TRANSFERS, "transfers"); + + public static final CreateExportsRequestResource CHILD_COMPANIES = + new CreateExportsRequestResource(Value.CHILD_COMPANIES, "child_companies"); + + public static final CreateExportsRequestResource CHECKOUT_CONFIGURATIONS = + new CreateExportsRequestResource(Value.CHECKOUT_CONFIGURATIONS, "checkout_configurations"); + + public static final CreateExportsRequestResource PAYOUT_METHODS = + new CreateExportsRequestResource(Value.PAYOUT_METHODS, "payout_methods"); + + public static final CreateExportsRequestResource CANCELATION_REASONS = + new CreateExportsRequestResource(Value.CANCELATION_REASONS, "cancelation_reasons"); + + public static final CreateExportsRequestResource BOUNTIES = + new CreateExportsRequestResource(Value.BOUNTIES, "bounties"); + + public static final CreateExportsRequestResource UNCLAIMED_MEMBERSHIPS = + new CreateExportsRequestResource(Value.UNCLAIMED_MEMBERSHIPS, "unclaimed_memberships"); + + public static final CreateExportsRequestResource INVOICES = + new CreateExportsRequestResource(Value.INVOICES, "invoices"); + + public static final CreateExportsRequestResource DISPUTES = + new CreateExportsRequestResource(Value.DISPUTES, "disputes"); + + public static final CreateExportsRequestResource WEBHOOKS = + new CreateExportsRequestResource(Value.WEBHOOKS, "webhooks"); + + public static final CreateExportsRequestResource RESOLUTION_CENTER_CASES = + new CreateExportsRequestResource(Value.RESOLUTION_CENTER_CASES, "resolution_center_cases"); + + public static final CreateExportsRequestResource PLANS = new CreateExportsRequestResource(Value.PLANS, "plans"); + + public static final CreateExportsRequestResource RESOLUTIONS = + new CreateExportsRequestResource(Value.RESOLUTIONS, "resolutions"); + + public static final CreateExportsRequestResource PRODUCTS = + new CreateExportsRequestResource(Value.PRODUCTS, "products"); + + public static final CreateExportsRequestResource EVENTS = new CreateExportsRequestResource(Value.EVENTS, "events"); + + public static final CreateExportsRequestResource APPS = new CreateExportsRequestResource(Value.APPS, "apps"); + + public static final CreateExportsRequestResource SOCIAL_ACCOUNTS = + new CreateExportsRequestResource(Value.SOCIAL_ACCOUNTS, "social_accounts"); + + public static final CreateExportsRequestResource ADS = new CreateExportsRequestResource(Value.ADS, "ads"); + + public static final CreateExportsRequestResource AD_CAMPAIGNS = + new CreateExportsRequestResource(Value.AD_CAMPAIGNS, "ad_campaigns"); + + private final Value value; + + private final String string; + + CreateExportsRequestResource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateExportsRequestResource + && this.string.equals(((CreateExportsRequestResource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RECEIPTS: + return visitor.visitReceipts(); + case AD_GROUPS: + return visitor.visitAdGroups(); + case MEMBERS: + return visitor.visitMembers(); + case PEOPLE: + return visitor.visitPeople(); + case TEAM_MEMBERS: + return visitor.visitTeamMembers(); + case PROMO_CODES: + return visitor.visitPromoCodes(); + case CARD_TRANSACTIONS: + return visitor.visitCardTransactions(); + case PAYOUTS: + return visitor.visitPayouts(); + case FINANCIAL_ACTIVITY: + return visitor.visitFinancialActivity(); + case CONTENT_REWARDS_SUBMISSIONS: + return visitor.visitContentRewardsSubmissions(); + case LEADS: + return visitor.visitLeads(); + case TRACKING_LINKS: + return visitor.visitTrackingLinks(); + case AUDIENCES: + return visitor.visitAudiences(); + case BOUNTY_SUBMISSIONS: + return visitor.visitBountySubmissions(); + case SHIPMENTS: + return visitor.visitShipments(); + case ENTRIES: + return visitor.visitEntries(); + case MEMBERSHIPS: + return visitor.visitMemberships(); + case TRANSFERS: + return visitor.visitTransfers(); + case CHILD_COMPANIES: + return visitor.visitChildCompanies(); + case CHECKOUT_CONFIGURATIONS: + return visitor.visitCheckoutConfigurations(); + case PAYOUT_METHODS: + return visitor.visitPayoutMethods(); + case CANCELATION_REASONS: + return visitor.visitCancelationReasons(); + case BOUNTIES: + return visitor.visitBounties(); + case UNCLAIMED_MEMBERSHIPS: + return visitor.visitUnclaimedMemberships(); + case INVOICES: + return visitor.visitInvoices(); + case DISPUTES: + return visitor.visitDisputes(); + case WEBHOOKS: + return visitor.visitWebhooks(); + case RESOLUTION_CENTER_CASES: + return visitor.visitResolutionCenterCases(); + case PLANS: + return visitor.visitPlans(); + case RESOLUTIONS: + return visitor.visitResolutions(); + case PRODUCTS: + return visitor.visitProducts(); + case EVENTS: + return visitor.visitEvents(); + case APPS: + return visitor.visitApps(); + case SOCIAL_ACCOUNTS: + return visitor.visitSocialAccounts(); + case ADS: + return visitor.visitAds(); + case AD_CAMPAIGNS: + return visitor.visitAdCampaigns(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateExportsRequestResource valueOf(String value) { + switch (value) { + case "receipts": + return RECEIPTS; + case "ad_groups": + return AD_GROUPS; + case "members": + return MEMBERS; + case "people": + return PEOPLE; + case "team_members": + return TEAM_MEMBERS; + case "promo_codes": + return PROMO_CODES; + case "card_transactions": + return CARD_TRANSACTIONS; + case "payouts": + return PAYOUTS; + case "financial-activity": + return FINANCIAL_ACTIVITY; + case "content_rewards_submissions": + return CONTENT_REWARDS_SUBMISSIONS; + case "leads": + return LEADS; + case "tracking_links": + return TRACKING_LINKS; + case "audiences": + return AUDIENCES; + case "bounty_submissions": + return BOUNTY_SUBMISSIONS; + case "shipments": + return SHIPMENTS; + case "entries": + return ENTRIES; + case "memberships": + return MEMBERSHIPS; + case "transfers": + return TRANSFERS; + case "child_companies": + return CHILD_COMPANIES; + case "checkout_configurations": + return CHECKOUT_CONFIGURATIONS; + case "payout_methods": + return PAYOUT_METHODS; + case "cancelation_reasons": + return CANCELATION_REASONS; + case "bounties": + return BOUNTIES; + case "unclaimed_memberships": + return UNCLAIMED_MEMBERSHIPS; + case "invoices": + return INVOICES; + case "disputes": + return DISPUTES; + case "webhooks": + return WEBHOOKS; + case "resolution_center_cases": + return RESOLUTION_CENTER_CASES; + case "plans": + return PLANS; + case "resolutions": + return RESOLUTIONS; + case "products": + return PRODUCTS; + case "events": + return EVENTS; + case "apps": + return APPS; + case "social_accounts": + return SOCIAL_ACCOUNTS; + case "ads": + return ADS; + case "ad_campaigns": + return AD_CAMPAIGNS; + default: + return new CreateExportsRequestResource(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_CAMPAIGNS, + + AD_GROUPS, + + ADS, + + APPS, + + AUDIENCES, + + BOUNTIES, + + BOUNTY_SUBMISSIONS, + + CARD_TRANSACTIONS, + + CHECKOUT_CONFIGURATIONS, + + DISPUTES, + + EVENTS, + + FINANCIAL_ACTIVITY, + + MEMBERS, + + MEMBERSHIPS, + + PAYOUT_METHODS, + + PAYOUTS, + + PEOPLE, + + PLANS, + + PRODUCTS, + + RESOLUTION_CENTER_CASES, + + SHIPMENTS, + + SOCIAL_ACCOUNTS, + + TEAM_MEMBERS, + + TRANSFERS, + + WEBHOOKS, + + RECEIPTS, + + UNCLAIMED_MEMBERSHIPS, + + TRACKING_LINKS, + + PROMO_CODES, + + RESOLUTIONS, + + ENTRIES, + + LEADS, + + CONTENT_REWARDS_SUBMISSIONS, + + INVOICES, + + CANCELATION_REASONS, + + CHILD_COMPANIES, + + UNKNOWN + } + + public interface Visitor { + T visitAdCampaigns(); + + T visitAdGroups(); + + T visitAds(); + + T visitApps(); + + T visitAudiences(); + + T visitBounties(); + + T visitBountySubmissions(); + + T visitCardTransactions(); + + T visitCheckoutConfigurations(); + + T visitDisputes(); + + T visitEvents(); + + T visitFinancialActivity(); + + T visitMembers(); + + T visitMemberships(); + + T visitPayoutMethods(); + + T visitPayouts(); + + T visitPeople(); + + T visitPlans(); + + T visitProducts(); + + T visitResolutionCenterCases(); + + T visitShipments(); + + T visitSocialAccounts(); + + T visitTeamMembers(); + + T visitTransfers(); + + T visitWebhooks(); + + T visitReceipts(); + + T visitUnclaimedMemberships(); + + T visitTrackingLinks(); + + T visitPromoCodes(); + + T visitResolutions(); + + T visitEntries(); + + T visitLeads(); + + T visitContentRewardsSubmissions(); + + T visitInvoices(); + + T visitCancelationReasons(); + + T visitChildCompanies(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/exports/types/ListExportsRequestDirection.java b/src/main/java/com/whop/api/resources/exports/types/ListExportsRequestDirection.java new file mode 100644 index 00000000..96d99232 --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/types/ListExportsRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListExportsRequestDirection { + public static final ListExportsRequestDirection ASC = new ListExportsRequestDirection(Value.ASC, "asc"); + + public static final ListExportsRequestDirection DESC = new ListExportsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListExportsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListExportsRequestDirection + && this.string.equals(((ListExportsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListExportsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListExportsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/exports/types/ListExportsRequestOrder.java b/src/main/java/com/whop/api/resources/exports/types/ListExportsRequestOrder.java new file mode 100644 index 00000000..b8ecc543 --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/types/ListExportsRequestOrder.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListExportsRequestOrder { + public static final ListExportsRequestOrder CREATED_AT = + new ListExportsRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListExportsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListExportsRequestOrder + && this.string.equals(((ListExportsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListExportsRequestOrder valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + default: + return new ListExportsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/exports/types/ListExportsRequestResource.java b/src/main/java/com/whop/api/resources/exports/types/ListExportsRequestResource.java new file mode 100644 index 00000000..a724c845 --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/types/ListExportsRequestResource.java @@ -0,0 +1,473 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListExportsRequestResource { + public static final ListExportsRequestResource RECEIPTS = + new ListExportsRequestResource(Value.RECEIPTS, "receipts"); + + public static final ListExportsRequestResource AD_GROUPS = + new ListExportsRequestResource(Value.AD_GROUPS, "ad_groups"); + + public static final ListExportsRequestResource MEMBERS = new ListExportsRequestResource(Value.MEMBERS, "members"); + + public static final ListExportsRequestResource PEOPLE = new ListExportsRequestResource(Value.PEOPLE, "people"); + + public static final ListExportsRequestResource TEAM_MEMBERS = + new ListExportsRequestResource(Value.TEAM_MEMBERS, "team_members"); + + public static final ListExportsRequestResource PROMO_CODES = + new ListExportsRequestResource(Value.PROMO_CODES, "promo_codes"); + + public static final ListExportsRequestResource CARD_TRANSACTIONS = + new ListExportsRequestResource(Value.CARD_TRANSACTIONS, "card_transactions"); + + public static final ListExportsRequestResource PAYOUTS = new ListExportsRequestResource(Value.PAYOUTS, "payouts"); + + public static final ListExportsRequestResource FINANCIAL_ACTIVITY = + new ListExportsRequestResource(Value.FINANCIAL_ACTIVITY, "financial-activity"); + + public static final ListExportsRequestResource CONTENT_REWARDS_SUBMISSIONS = + new ListExportsRequestResource(Value.CONTENT_REWARDS_SUBMISSIONS, "content_rewards_submissions"); + + public static final ListExportsRequestResource LEADS = new ListExportsRequestResource(Value.LEADS, "leads"); + + public static final ListExportsRequestResource TRACKING_LINKS = + new ListExportsRequestResource(Value.TRACKING_LINKS, "tracking_links"); + + public static final ListExportsRequestResource LEDGER_LINES = + new ListExportsRequestResource(Value.LEDGER_LINES, "ledger_lines"); + + public static final ListExportsRequestResource AUDIENCES = + new ListExportsRequestResource(Value.AUDIENCES, "audiences"); + + public static final ListExportsRequestResource BOUNTY_SUBMISSIONS = + new ListExportsRequestResource(Value.BOUNTY_SUBMISSIONS, "bounty_submissions"); + + public static final ListExportsRequestResource SHIPMENTS = + new ListExportsRequestResource(Value.SHIPMENTS, "shipments"); + + public static final ListExportsRequestResource ENTRIES = new ListExportsRequestResource(Value.ENTRIES, "entries"); + + public static final ListExportsRequestResource MEMBERSHIPS = + new ListExportsRequestResource(Value.MEMBERSHIPS, "memberships"); + + public static final ListExportsRequestResource TRANSFERS = + new ListExportsRequestResource(Value.TRANSFERS, "transfers"); + + public static final ListExportsRequestResource CHILD_COMPANIES = + new ListExportsRequestResource(Value.CHILD_COMPANIES, "child_companies"); + + public static final ListExportsRequestResource WITHDRAWAL_LINES = + new ListExportsRequestResource(Value.WITHDRAWAL_LINES, "withdrawal_lines"); + + public static final ListExportsRequestResource CHECKOUT_CONFIGURATIONS = + new ListExportsRequestResource(Value.CHECKOUT_CONFIGURATIONS, "checkout_configurations"); + + public static final ListExportsRequestResource PAYOUT_METHODS = + new ListExportsRequestResource(Value.PAYOUT_METHODS, "payout_methods"); + + public static final ListExportsRequestResource CANCELATION_REASONS = + new ListExportsRequestResource(Value.CANCELATION_REASONS, "cancelation_reasons"); + + public static final ListExportsRequestResource BOUNTIES = + new ListExportsRequestResource(Value.BOUNTIES, "bounties"); + + public static final ListExportsRequestResource UNCLAIMED_MEMBERSHIPS = + new ListExportsRequestResource(Value.UNCLAIMED_MEMBERSHIPS, "unclaimed_memberships"); + + public static final ListExportsRequestResource INVOICES = + new ListExportsRequestResource(Value.INVOICES, "invoices"); + + public static final ListExportsRequestResource DISPUTES = + new ListExportsRequestResource(Value.DISPUTES, "disputes"); + + public static final ListExportsRequestResource WEBHOOKS = + new ListExportsRequestResource(Value.WEBHOOKS, "webhooks"); + + public static final ListExportsRequestResource RESOLUTION_CENTER_CASES = + new ListExportsRequestResource(Value.RESOLUTION_CENTER_CASES, "resolution_center_cases"); + + public static final ListExportsRequestResource PLANS = new ListExportsRequestResource(Value.PLANS, "plans"); + + public static final ListExportsRequestResource RESOLUTIONS = + new ListExportsRequestResource(Value.RESOLUTIONS, "resolutions"); + + public static final ListExportsRequestResource PRODUCTS = + new ListExportsRequestResource(Value.PRODUCTS, "products"); + + public static final ListExportsRequestResource EVENTS = new ListExportsRequestResource(Value.EVENTS, "events"); + + public static final ListExportsRequestResource APPS = new ListExportsRequestResource(Value.APPS, "apps"); + + public static final ListExportsRequestResource SOCIAL_ACCOUNTS = + new ListExportsRequestResource(Value.SOCIAL_ACCOUNTS, "social_accounts"); + + public static final ListExportsRequestResource ADS = new ListExportsRequestResource(Value.ADS, "ads"); + + public static final ListExportsRequestResource AD_CAMPAIGNS = + new ListExportsRequestResource(Value.AD_CAMPAIGNS, "ad_campaigns"); + + private final Value value; + + private final String string; + + ListExportsRequestResource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListExportsRequestResource + && this.string.equals(((ListExportsRequestResource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RECEIPTS: + return visitor.visitReceipts(); + case AD_GROUPS: + return visitor.visitAdGroups(); + case MEMBERS: + return visitor.visitMembers(); + case PEOPLE: + return visitor.visitPeople(); + case TEAM_MEMBERS: + return visitor.visitTeamMembers(); + case PROMO_CODES: + return visitor.visitPromoCodes(); + case CARD_TRANSACTIONS: + return visitor.visitCardTransactions(); + case PAYOUTS: + return visitor.visitPayouts(); + case FINANCIAL_ACTIVITY: + return visitor.visitFinancialActivity(); + case CONTENT_REWARDS_SUBMISSIONS: + return visitor.visitContentRewardsSubmissions(); + case LEADS: + return visitor.visitLeads(); + case TRACKING_LINKS: + return visitor.visitTrackingLinks(); + case LEDGER_LINES: + return visitor.visitLedgerLines(); + case AUDIENCES: + return visitor.visitAudiences(); + case BOUNTY_SUBMISSIONS: + return visitor.visitBountySubmissions(); + case SHIPMENTS: + return visitor.visitShipments(); + case ENTRIES: + return visitor.visitEntries(); + case MEMBERSHIPS: + return visitor.visitMemberships(); + case TRANSFERS: + return visitor.visitTransfers(); + case CHILD_COMPANIES: + return visitor.visitChildCompanies(); + case WITHDRAWAL_LINES: + return visitor.visitWithdrawalLines(); + case CHECKOUT_CONFIGURATIONS: + return visitor.visitCheckoutConfigurations(); + case PAYOUT_METHODS: + return visitor.visitPayoutMethods(); + case CANCELATION_REASONS: + return visitor.visitCancelationReasons(); + case BOUNTIES: + return visitor.visitBounties(); + case UNCLAIMED_MEMBERSHIPS: + return visitor.visitUnclaimedMemberships(); + case INVOICES: + return visitor.visitInvoices(); + case DISPUTES: + return visitor.visitDisputes(); + case WEBHOOKS: + return visitor.visitWebhooks(); + case RESOLUTION_CENTER_CASES: + return visitor.visitResolutionCenterCases(); + case PLANS: + return visitor.visitPlans(); + case RESOLUTIONS: + return visitor.visitResolutions(); + case PRODUCTS: + return visitor.visitProducts(); + case EVENTS: + return visitor.visitEvents(); + case APPS: + return visitor.visitApps(); + case SOCIAL_ACCOUNTS: + return visitor.visitSocialAccounts(); + case ADS: + return visitor.visitAds(); + case AD_CAMPAIGNS: + return visitor.visitAdCampaigns(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListExportsRequestResource valueOf(String value) { + switch (value) { + case "receipts": + return RECEIPTS; + case "ad_groups": + return AD_GROUPS; + case "members": + return MEMBERS; + case "people": + return PEOPLE; + case "team_members": + return TEAM_MEMBERS; + case "promo_codes": + return PROMO_CODES; + case "card_transactions": + return CARD_TRANSACTIONS; + case "payouts": + return PAYOUTS; + case "financial-activity": + return FINANCIAL_ACTIVITY; + case "content_rewards_submissions": + return CONTENT_REWARDS_SUBMISSIONS; + case "leads": + return LEADS; + case "tracking_links": + return TRACKING_LINKS; + case "ledger_lines": + return LEDGER_LINES; + case "audiences": + return AUDIENCES; + case "bounty_submissions": + return BOUNTY_SUBMISSIONS; + case "shipments": + return SHIPMENTS; + case "entries": + return ENTRIES; + case "memberships": + return MEMBERSHIPS; + case "transfers": + return TRANSFERS; + case "child_companies": + return CHILD_COMPANIES; + case "withdrawal_lines": + return WITHDRAWAL_LINES; + case "checkout_configurations": + return CHECKOUT_CONFIGURATIONS; + case "payout_methods": + return PAYOUT_METHODS; + case "cancelation_reasons": + return CANCELATION_REASONS; + case "bounties": + return BOUNTIES; + case "unclaimed_memberships": + return UNCLAIMED_MEMBERSHIPS; + case "invoices": + return INVOICES; + case "disputes": + return DISPUTES; + case "webhooks": + return WEBHOOKS; + case "resolution_center_cases": + return RESOLUTION_CENTER_CASES; + case "plans": + return PLANS; + case "resolutions": + return RESOLUTIONS; + case "products": + return PRODUCTS; + case "events": + return EVENTS; + case "apps": + return APPS; + case "social_accounts": + return SOCIAL_ACCOUNTS; + case "ads": + return ADS; + case "ad_campaigns": + return AD_CAMPAIGNS; + default: + return new ListExportsRequestResource(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_CAMPAIGNS, + + AD_GROUPS, + + ADS, + + APPS, + + AUDIENCES, + + BOUNTIES, + + BOUNTY_SUBMISSIONS, + + CARD_TRANSACTIONS, + + CHECKOUT_CONFIGURATIONS, + + DISPUTES, + + EVENTS, + + FINANCIAL_ACTIVITY, + + MEMBERS, + + MEMBERSHIPS, + + PAYOUT_METHODS, + + PAYOUTS, + + PEOPLE, + + PLANS, + + PRODUCTS, + + RESOLUTION_CENTER_CASES, + + SHIPMENTS, + + SOCIAL_ACCOUNTS, + + TEAM_MEMBERS, + + TRANSFERS, + + WEBHOOKS, + + RECEIPTS, + + UNCLAIMED_MEMBERSHIPS, + + TRACKING_LINKS, + + PROMO_CODES, + + RESOLUTIONS, + + ENTRIES, + + LEADS, + + CONTENT_REWARDS_SUBMISSIONS, + + INVOICES, + + CANCELATION_REASONS, + + CHILD_COMPANIES, + + LEDGER_LINES, + + WITHDRAWAL_LINES, + + UNKNOWN + } + + public interface Visitor { + T visitAdCampaigns(); + + T visitAdGroups(); + + T visitAds(); + + T visitApps(); + + T visitAudiences(); + + T visitBounties(); + + T visitBountySubmissions(); + + T visitCardTransactions(); + + T visitCheckoutConfigurations(); + + T visitDisputes(); + + T visitEvents(); + + T visitFinancialActivity(); + + T visitMembers(); + + T visitMemberships(); + + T visitPayoutMethods(); + + T visitPayouts(); + + T visitPeople(); + + T visitPlans(); + + T visitProducts(); + + T visitResolutionCenterCases(); + + T visitShipments(); + + T visitSocialAccounts(); + + T visitTeamMembers(); + + T visitTransfers(); + + T visitWebhooks(); + + T visitReceipts(); + + T visitUnclaimedMemberships(); + + T visitTrackingLinks(); + + T visitPromoCodes(); + + T visitResolutions(); + + T visitEntries(); + + T visitLeads(); + + T visitContentRewardsSubmissions(); + + T visitInvoices(); + + T visitCancelationReasons(); + + T visitChildCompanies(); + + T visitLedgerLines(); + + T visitWithdrawalLines(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/exports/types/ListExportsRequestStatus.java b/src/main/java/com/whop/api/resources/exports/types/ListExportsRequestStatus.java new file mode 100644 index 00000000..0cfeb4fa --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/types/ListExportsRequestStatus.java @@ -0,0 +1,115 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListExportsRequestStatus { + public static final ListExportsRequestStatus FAILED = new ListExportsRequestStatus(Value.FAILED, "failed"); + + public static final ListExportsRequestStatus PENDING = new ListExportsRequestStatus(Value.PENDING, "pending"); + + public static final ListExportsRequestStatus PROCESSING = + new ListExportsRequestStatus(Value.PROCESSING, "processing"); + + public static final ListExportsRequestStatus COMPLETED = new ListExportsRequestStatus(Value.COMPLETED, "completed"); + + public static final ListExportsRequestStatus EXPIRED = new ListExportsRequestStatus(Value.EXPIRED, "expired"); + + private final Value value; + + private final String string; + + ListExportsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListExportsRequestStatus + && this.string.equals(((ListExportsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case PENDING: + return visitor.visitPending(); + case PROCESSING: + return visitor.visitProcessing(); + case COMPLETED: + return visitor.visitCompleted(); + case EXPIRED: + return visitor.visitExpired(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListExportsRequestStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "pending": + return PENDING; + case "processing": + return PROCESSING; + case "completed": + return COMPLETED; + case "expired": + return EXPIRED; + default: + return new ListExportsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + PROCESSING, + + COMPLETED, + + FAILED, + + EXPIRED, + + UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitProcessing(); + + T visitCompleted(); + + T visitFailed(); + + T visitExpired(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/exports/types/ListExportsResponse.java b/src/main/java/com/whop/api/resources/exports/types/ListExportsResponse.java new file mode 100644 index 00000000..20a80aec --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/types/ListExportsResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Export; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListExportsResponse.Builder.class) +public final class ListExportsResponse { + private final List data; + + private final ListExportsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListExportsResponse( + List data, ListExportsResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListExportsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListExportsResponse && equalTo((ListExportsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListExportsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListExportsResponsePageInfo pageInfo); + + Builder from(ListExportsResponse other); + } + + public interface _FinalStage { + ListExportsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(Export data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListExportsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListExportsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListExportsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(Export data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListExportsResponse build() { + return new ListExportsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/exports/types/ListExportsResponsePageInfo.java b/src/main/java/com/whop/api/resources/exports/types/ListExportsResponsePageInfo.java new file mode 100644 index 00000000..2c2061e7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/types/ListExportsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListExportsResponsePageInfo.Builder.class) +public final class ListExportsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListExportsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListExportsResponsePageInfo && equalTo((ListExportsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListExportsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListExportsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListExportsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListExportsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListExportsResponsePageInfo build() { + return new ListExportsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/exports/types/PostExportCompletedPayload.java b/src/main/java/com/whop/api/resources/exports/types/PostExportCompletedPayload.java new file mode 100644 index 00000000..adb3d023 --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/types/PostExportCompletedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Export; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostExportCompletedPayload.Builder.class) +public final class PostExportCompletedPayload { + private final Optional accountId; + + private final PostExportCompletedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Export data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostExportCompletedPayloadType type; + + private final Map additionalProperties; + + private PostExportCompletedPayload( + Optional accountId, + PostExportCompletedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Export data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostExportCompletedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostExportCompletedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Export getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostExportCompletedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostExportCompletedPayload && equalTo((PostExportCompletedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostExportCompletedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostExportCompletedPayloadApiVersion apiVersion); + + Builder from(PostExportCompletedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Export data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostExportCompletedPayloadType type); + } + + public interface _FinalStage { + PostExportCompletedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostExportCompletedPayloadApiVersion apiVersion; + + private Export data; + + private String id; + + private OffsetDateTime timestamp; + + private PostExportCompletedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostExportCompletedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostExportCompletedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Export data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostExportCompletedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostExportCompletedPayload build() { + return new PostExportCompletedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/exports/types/PostExportCompletedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/exports/types/PostExportCompletedPayloadApiVersion.java new file mode 100644 index 00000000..b48fa41e --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/types/PostExportCompletedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostExportCompletedPayloadApiVersion { + public static final PostExportCompletedPayloadApiVersion V1 = + new PostExportCompletedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostExportCompletedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostExportCompletedPayloadApiVersion + && this.string.equals(((PostExportCompletedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostExportCompletedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostExportCompletedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/exports/types/PostExportCompletedPayloadType.java b/src/main/java/com/whop/api/resources/exports/types/PostExportCompletedPayloadType.java new file mode 100644 index 00000000..030d5cdb --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/types/PostExportCompletedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostExportCompletedPayloadType { + public static final PostExportCompletedPayloadType EXPORT_COMPLETED = + new PostExportCompletedPayloadType(Value.EXPORT_COMPLETED, "export.completed"); + + private final Value value; + + private final String string; + + PostExportCompletedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostExportCompletedPayloadType + && this.string.equals(((PostExportCompletedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EXPORT_COMPLETED: + return visitor.visitExportCompleted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostExportCompletedPayloadType valueOf(String value) { + switch (value) { + case "export.completed": + return EXPORT_COMPLETED; + default: + return new PostExportCompletedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + EXPORT_COMPLETED, + + UNKNOWN + } + + public interface Visitor { + T visitExportCompleted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/exports/types/PostExportFailedPayload.java b/src/main/java/com/whop/api/resources/exports/types/PostExportFailedPayload.java new file mode 100644 index 00000000..650dc0b0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/types/PostExportFailedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Export; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostExportFailedPayload.Builder.class) +public final class PostExportFailedPayload { + private final Optional accountId; + + private final PostExportFailedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Export data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostExportFailedPayloadType type; + + private final Map additionalProperties; + + private PostExportFailedPayload( + Optional accountId, + PostExportFailedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Export data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostExportFailedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostExportFailedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Export getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostExportFailedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostExportFailedPayload && equalTo((PostExportFailedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostExportFailedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostExportFailedPayloadApiVersion apiVersion); + + Builder from(PostExportFailedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Export data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostExportFailedPayloadType type); + } + + public interface _FinalStage { + PostExportFailedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostExportFailedPayloadApiVersion apiVersion; + + private Export data; + + private String id; + + private OffsetDateTime timestamp; + + private PostExportFailedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostExportFailedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostExportFailedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Export data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostExportFailedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostExportFailedPayload build() { + return new PostExportFailedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/exports/types/PostExportFailedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/exports/types/PostExportFailedPayloadApiVersion.java new file mode 100644 index 00000000..26697e32 --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/types/PostExportFailedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostExportFailedPayloadApiVersion { + public static final PostExportFailedPayloadApiVersion V1 = new PostExportFailedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostExportFailedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostExportFailedPayloadApiVersion + && this.string.equals(((PostExportFailedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostExportFailedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostExportFailedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/exports/types/PostExportFailedPayloadType.java b/src/main/java/com/whop/api/resources/exports/types/PostExportFailedPayloadType.java new file mode 100644 index 00000000..39918659 --- /dev/null +++ b/src/main/java/com/whop/api/resources/exports/types/PostExportFailedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.exports.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostExportFailedPayloadType { + public static final PostExportFailedPayloadType EXPORT_FAILED = + new PostExportFailedPayloadType(Value.EXPORT_FAILED, "export.failed"); + + private final Value value; + + private final String string; + + PostExportFailedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostExportFailedPayloadType + && this.string.equals(((PostExportFailedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EXPORT_FAILED: + return visitor.visitExportFailed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostExportFailedPayloadType valueOf(String value) { + switch (value) { + case "export.failed": + return EXPORT_FAILED; + default: + return new PostExportFailedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + EXPORT_FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitExportFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/feemarkups/AsyncFeeMarkupsClient.java b/src/main/java/com/whop/api/resources/feemarkups/AsyncFeeMarkupsClient.java new file mode 100644 index 00000000..0aad4386 --- /dev/null +++ b/src/main/java/com/whop/api/resources/feemarkups/AsyncFeeMarkupsClient.java @@ -0,0 +1,122 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.feemarkups; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.feemarkups.requests.CreateFeeMarkupsRequest; +import com.whop.api.resources.feemarkups.requests.DeleteFeeMarkupsRequest; +import com.whop.api.resources.feemarkups.requests.ListFeeMarkupsRequest; +import com.whop.api.types.FeeMarkup; +import com.whop.api.types.FeeMarkupListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncFeeMarkupsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawFeeMarkupsClient rawClient; + + public AsyncFeeMarkupsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawFeeMarkupsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawFeeMarkupsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of fee markups configured for a company. If the company is a platform account, returns the platform default markups. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture> list(ListFeeMarkupsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of fee markups configured for a company. If the company is a platform account, returns the platform default markups. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture> list( + ListFeeMarkupsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create or update a fee markup for a company. If a markup for the specified fee type already exists, it will be updated with the new values. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture create(CreateFeeMarkupsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create or update a fee markup for a company. If a markup for the specified fee type already exists, it will be updated with the new values. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture create(CreateFeeMarkupsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture delete(String id, DeleteFeeMarkupsRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture delete( + String id, DeleteFeeMarkupsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/feemarkups/AsyncRawFeeMarkupsClient.java b/src/main/java/com/whop/api/resources/feemarkups/AsyncRawFeeMarkupsClient.java new file mode 100644 index 00000000..4b57a17c --- /dev/null +++ b/src/main/java/com/whop/api/resources/feemarkups/AsyncRawFeeMarkupsClient.java @@ -0,0 +1,441 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.feemarkups; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.feemarkups.requests.CreateFeeMarkupsRequest; +import com.whop.api.resources.feemarkups.requests.DeleteFeeMarkupsRequest; +import com.whop.api.resources.feemarkups.requests.ListFeeMarkupsRequest; +import com.whop.api.resources.feemarkups.types.ListFeeMarkupsResponse; +import com.whop.api.types.FeeMarkup; +import com.whop.api.types.FeeMarkupListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawFeeMarkupsClient { + protected final ClientOptions clientOptions; + + public AsyncRawFeeMarkupsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of fee markups configured for a company. If the company is a platform account, returns the platform default markups. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture>> list( + ListFeeMarkupsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of fee markups configured for a company. If the company is a platform account, returns the platform default markups. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture>> list( + ListFeeMarkupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("fee_markups"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListFeeMarkupsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListFeeMarkupsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListFeeMarkupsRequest nextRequest = ListFeeMarkupsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create or update a fee markup for a company. If a markup for the specified fee type already exists, it will be updated with the new values. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture> create(CreateFeeMarkupsRequest request) { + return create(request, null); + } + + /** + * Create or update a fee markup for a company. If a markup for the specified fee type already exists, it will be updated with the new values. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture> create( + CreateFeeMarkupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("fee_markups"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, FeeMarkup.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteFeeMarkupsRequest.builder().build()); + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteFeeMarkupsRequest.builder().build(), requestOptions); + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture> delete(String id, DeleteFeeMarkupsRequest request) { + return delete(id, request, null); + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public CompletableFuture> delete( + String id, DeleteFeeMarkupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("fee_markups") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/feemarkups/FeeMarkupsClient.java b/src/main/java/com/whop/api/resources/feemarkups/FeeMarkupsClient.java new file mode 100644 index 00000000..741220ac --- /dev/null +++ b/src/main/java/com/whop/api/resources/feemarkups/FeeMarkupsClient.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.feemarkups; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.feemarkups.requests.CreateFeeMarkupsRequest; +import com.whop.api.resources.feemarkups.requests.DeleteFeeMarkupsRequest; +import com.whop.api.resources.feemarkups.requests.ListFeeMarkupsRequest; +import com.whop.api.types.FeeMarkup; +import com.whop.api.types.FeeMarkupListItem; + +public class FeeMarkupsClient { + protected final ClientOptions clientOptions; + + private final RawFeeMarkupsClient rawClient; + + public FeeMarkupsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawFeeMarkupsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawFeeMarkupsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of fee markups configured for a company. If the company is a platform account, returns the platform default markups. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public SyncPagingIterable list(ListFeeMarkupsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of fee markups configured for a company. If the company is a platform account, returns the platform default markups. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public SyncPagingIterable list(ListFeeMarkupsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Create or update a fee markup for a company. If a markup for the specified fee type already exists, it will be updated with the new values. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public FeeMarkup create(CreateFeeMarkupsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Create or update a fee markup for a company. If a markup for the specified fee type already exists, it will be updated with the new values. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public FeeMarkup create(CreateFeeMarkupsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public boolean delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public boolean delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public boolean delete(String id, DeleteFeeMarkupsRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public boolean delete(String id, DeleteFeeMarkupsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/feemarkups/RawFeeMarkupsClient.java b/src/main/java/com/whop/api/resources/feemarkups/RawFeeMarkupsClient.java new file mode 100644 index 00000000..dba4c276 --- /dev/null +++ b/src/main/java/com/whop/api/resources/feemarkups/RawFeeMarkupsClient.java @@ -0,0 +1,344 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.feemarkups; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.feemarkups.requests.CreateFeeMarkupsRequest; +import com.whop.api.resources.feemarkups.requests.DeleteFeeMarkupsRequest; +import com.whop.api.resources.feemarkups.requests.ListFeeMarkupsRequest; +import com.whop.api.resources.feemarkups.types.ListFeeMarkupsResponse; +import com.whop.api.types.FeeMarkup; +import com.whop.api.types.FeeMarkupListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawFeeMarkupsClient { + protected final ClientOptions clientOptions; + + public RawFeeMarkupsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of fee markups configured for a company. If the company is a platform account, returns the platform default markups. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public WhopApiHttpResponse> list(ListFeeMarkupsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of fee markups configured for a company. If the company is a platform account, returns the platform default markups. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public WhopApiHttpResponse> list( + ListFeeMarkupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("fee_markups"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListFeeMarkupsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListFeeMarkupsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListFeeMarkupsRequest nextRequest = ListFeeMarkupsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Create or update a fee markup for a company. If a markup for the specified fee type already exists, it will be updated with the new values. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public WhopApiHttpResponse create(CreateFeeMarkupsRequest request) { + return create(request, null); + } + + /** + * Create or update a fee markup for a company. If a markup for the specified fee type already exists, it will be updated with the new values. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public WhopApiHttpResponse create(CreateFeeMarkupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("fee_markups"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, FeeMarkup.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteFeeMarkupsRequest.builder().build()); + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteFeeMarkupsRequest.builder().build(), requestOptions); + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public WhopApiHttpResponse delete(String id, DeleteFeeMarkupsRequest request) { + return delete(id, request, null); + } + + /** + * Delete a fee markup configuration for a company. This removes the custom fee override and reverts to the parent company's default fees. + *

Required permissions:

+ *
    + *
  • company:update_child_fees
  • + *
+ */ + public WhopApiHttpResponse delete( + String id, DeleteFeeMarkupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("fee_markups") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/feemarkups/requests/CreateFeeMarkupsRequest.java b/src/main/java/com/whop/api/resources/feemarkups/requests/CreateFeeMarkupsRequest.java new file mode 100644 index 00000000..8d70a18f --- /dev/null +++ b/src/main/java/com/whop/api/resources/feemarkups/requests/CreateFeeMarkupsRequest.java @@ -0,0 +1,454 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.feemarkups.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.FeeMarkupTypes; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateFeeMarkupsRequest.Builder.class) +public final class CreateFeeMarkupsRequest { + private final String companyId; + + private final FeeMarkupTypes feeType; + + private final Optional fixedFeeUsd; + + private final Optional> metadata; + + private final Optional notes; + + private final Optional percentageFee; + + private final Map additionalProperties; + + private CreateFeeMarkupsRequest( + String companyId, + FeeMarkupTypes feeType, + Optional fixedFeeUsd, + Optional> metadata, + Optional notes, + Optional percentageFee, + Map additionalProperties) { + this.companyId = companyId; + this.feeType = feeType; + this.fixedFeeUsd = fixedFeeUsd; + this.metadata = metadata; + this.notes = notes; + this.percentageFee = percentageFee; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the company to create or update the fee markup for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return The type of fee this markup applies to, such as processing or platform fees. + */ + @JsonProperty("fee_type") + public FeeMarkupTypes getFeeType() { + return feeType; + } + + /** + * @return The fixed fee amount in USD to charge per transaction. Must be between 0 and 50. + */ + @JsonIgnore + public Optional getFixedFeeUsd() { + if (fixedFeeUsd == null) { + return Optional.empty(); + } + return fixedFeeUsd; + } + + /** + * @return Custom key-value metadata to attach to this fee markup. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Internal notes about this fee markup for record-keeping purposes. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + /** + * @return The percentage fee to charge per transaction. Must be between 0 and 25. + */ + @JsonIgnore + public Optional getPercentageFee() { + if (percentageFee == null) { + return Optional.empty(); + } + return percentageFee; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fixed_fee_usd") + private Optional _getFixedFeeUsd() { + return fixedFeeUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("percentage_fee") + private Optional _getPercentageFee() { + return percentageFee; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateFeeMarkupsRequest && equalTo((CreateFeeMarkupsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateFeeMarkupsRequest other) { + return companyId.equals(other.companyId) + && feeType.equals(other.feeType) + && fixedFeeUsd.equals(other.fixedFeeUsd) + && metadata.equals(other.metadata) + && notes.equals(other.notes) + && percentageFee.equals(other.percentageFee); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyId, this.feeType, this.fixedFeeUsd, this.metadata, this.notes, this.percentageFee); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to create or update the fee markup for.

+ */ + FeeTypeStage companyId(@NotNull String companyId); + + Builder from(CreateFeeMarkupsRequest other); + } + + public interface FeeTypeStage { + /** + *

The type of fee this markup applies to, such as processing or platform fees.

+ */ + _FinalStage feeType(@NotNull FeeMarkupTypes feeType); + } + + public interface _FinalStage { + CreateFeeMarkupsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The fixed fee amount in USD to charge per transaction. Must be between 0 and 50.

+ */ + _FinalStage fixedFeeUsd(Optional fixedFeeUsd); + + _FinalStage fixedFeeUsd(Double fixedFeeUsd); + + _FinalStage fixedFeeUsd(Nullable fixedFeeUsd); + + /** + *

Custom key-value metadata to attach to this fee markup.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Internal notes about this fee markup for record-keeping purposes.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + + /** + *

The percentage fee to charge per transaction. Must be between 0 and 25.

+ */ + _FinalStage percentageFee(Optional percentageFee); + + _FinalStage percentageFee(Double percentageFee); + + _FinalStage percentageFee(Nullable percentageFee); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, FeeTypeStage, _FinalStage { + private String companyId; + + private FeeMarkupTypes feeType; + + private Optional percentageFee = Optional.empty(); + + private Optional notes = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional fixedFeeUsd = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateFeeMarkupsRequest other) { + companyId(other.getCompanyId()); + feeType(other.getFeeType()); + fixedFeeUsd(other.getFixedFeeUsd()); + metadata(other.getMetadata()); + notes(other.getNotes()); + percentageFee(other.getPercentageFee()); + return this; + } + + /** + *

The unique identifier of the company to create or update the fee markup for.

+ *

The unique identifier of the company to create or update the fee markup for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public FeeTypeStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The type of fee this markup applies to, such as processing or platform fees.

+ *

The type of fee this markup applies to, such as processing or platform fees.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_type") + public _FinalStage feeType(@NotNull FeeMarkupTypes feeType) { + this.feeType = Objects.requireNonNull(feeType, "feeType must not be null"); + return this; + } + + /** + *

The percentage fee to charge per transaction. Must be between 0 and 25.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage percentageFee(Nullable percentageFee) { + if (percentageFee.isNull()) { + this.percentageFee = null; + } else if (percentageFee.isEmpty()) { + this.percentageFee = Optional.empty(); + } else { + this.percentageFee = Optional.of(percentageFee.get()); + } + return this; + } + + /** + *

The percentage fee to charge per transaction. Must be between 0 and 25.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage percentageFee(Double percentageFee) { + this.percentageFee = Optional.ofNullable(percentageFee); + return this; + } + + /** + *

The percentage fee to charge per transaction. Must be between 0 and 25.

+ */ + @java.lang.Override + @JsonSetter(value = "percentage_fee", nulls = Nulls.SKIP) + public _FinalStage percentageFee(Optional percentageFee) { + this.percentageFee = percentageFee; + return this; + } + + /** + *

Internal notes about this fee markup for record-keeping purposes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Internal notes about this fee markup for record-keeping purposes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Internal notes about this fee markup for record-keeping purposes.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

Custom key-value metadata to attach to this fee markup.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value metadata to attach to this fee markup.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value metadata to attach to this fee markup.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The fixed fee amount in USD to charge per transaction. Must be between 0 and 50.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fixedFeeUsd(Nullable fixedFeeUsd) { + if (fixedFeeUsd.isNull()) { + this.fixedFeeUsd = null; + } else if (fixedFeeUsd.isEmpty()) { + this.fixedFeeUsd = Optional.empty(); + } else { + this.fixedFeeUsd = Optional.of(fixedFeeUsd.get()); + } + return this; + } + + /** + *

The fixed fee amount in USD to charge per transaction. Must be between 0 and 50.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fixedFeeUsd(Double fixedFeeUsd) { + this.fixedFeeUsd = Optional.ofNullable(fixedFeeUsd); + return this; + } + + /** + *

The fixed fee amount in USD to charge per transaction. Must be between 0 and 50.

+ */ + @java.lang.Override + @JsonSetter(value = "fixed_fee_usd", nulls = Nulls.SKIP) + public _FinalStage fixedFeeUsd(Optional fixedFeeUsd) { + this.fixedFeeUsd = fixedFeeUsd; + return this; + } + + @java.lang.Override + public CreateFeeMarkupsRequest build() { + return new CreateFeeMarkupsRequest( + companyId, feeType, fixedFeeUsd, metadata, notes, percentageFee, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/feemarkups/requests/DeleteFeeMarkupsRequest.java b/src/main/java/com/whop/api/resources/feemarkups/requests/DeleteFeeMarkupsRequest.java new file mode 100644 index 00000000..2fbd8da9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/feemarkups/requests/DeleteFeeMarkupsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.feemarkups.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteFeeMarkupsRequest.Builder.class) +public final class DeleteFeeMarkupsRequest { + private final Map additionalProperties; + + private DeleteFeeMarkupsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteFeeMarkupsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteFeeMarkupsRequest other) { + return this; + } + + public DeleteFeeMarkupsRequest build() { + return new DeleteFeeMarkupsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/feemarkups/requests/ListFeeMarkupsRequest.java b/src/main/java/com/whop/api/resources/feemarkups/requests/ListFeeMarkupsRequest.java new file mode 100644 index 00000000..73dbe8de --- /dev/null +++ b/src/main/java/com/whop/api/resources/feemarkups/requests/ListFeeMarkupsRequest.java @@ -0,0 +1,305 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.feemarkups.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListFeeMarkupsRequest.Builder.class) +public final class ListFeeMarkupsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String companyId; + + private final Map additionalProperties; + + private ListFeeMarkupsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String companyId, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to list fee markups for. Pass a platform account identifier to retrieve platform default markups. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListFeeMarkupsRequest && equalTo((ListFeeMarkupsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListFeeMarkupsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last, this.companyId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to list fee markups for. Pass a platform account identifier to retrieve platform default markups.

+ */ + _FinalStage companyId(@NotNull String companyId); + + Builder from(ListFeeMarkupsRequest other); + } + + public interface _FinalStage { + ListFeeMarkupsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListFeeMarkupsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + return this; + } + + /** + *

The unique identifier of the company to list fee markups for. Pass a platform account identifier to retrieve platform default markups.

+ *

The unique identifier of the company to list fee markups for. Pass a platform account identifier to retrieve platform default markups.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListFeeMarkupsRequest build() { + return new ListFeeMarkupsRequest(after, before, first, last, companyId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/feemarkups/types/ListFeeMarkupsResponse.java b/src/main/java/com/whop/api/resources/feemarkups/types/ListFeeMarkupsResponse.java new file mode 100644 index 00000000..36b8f5d0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/feemarkups/types/ListFeeMarkupsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.feemarkups.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.FeeMarkupListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListFeeMarkupsResponse.Builder.class) +public final class ListFeeMarkupsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListFeeMarkupsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListFeeMarkupsResponse && equalTo((ListFeeMarkupsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListFeeMarkupsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListFeeMarkupsResponse other); + } + + public interface _FinalStage { + ListFeeMarkupsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(FeeMarkupListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListFeeMarkupsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(FeeMarkupListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListFeeMarkupsResponse build() { + return new ListFeeMarkupsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/files/AsyncFilesClient.java b/src/main/java/com/whop/api/resources/files/AsyncFilesClient.java new file mode 100644 index 00000000..fc5a1e0b --- /dev/null +++ b/src/main/java/com/whop/api/resources/files/AsyncFilesClient.java @@ -0,0 +1,72 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.files; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.files.requests.CreateFilesRequest; +import com.whop.api.resources.files.requests.RetrieveFilesRequest; +import com.whop.api.resources.files.types.CreateFilesResponse; +import com.whop.api.types.File; +import java.util.concurrent.CompletableFuture; + +public class AsyncFilesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawFilesClient rawClient; + + public AsyncFilesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawFilesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawFilesClient withRawResponse() { + return this.rawClient; + } + + /** + * Create a new file record and receive a presigned URL for uploading content to S3. + */ + public CompletableFuture create(CreateFilesRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create a new file record and receive a presigned URL for uploading content to S3. + */ + public CompletableFuture create(CreateFilesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing file. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing file. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing file. + */ + public CompletableFuture retrieve(String id, RetrieveFilesRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing file. + */ + public CompletableFuture retrieve(String id, RetrieveFilesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/files/AsyncRawFilesClient.java b/src/main/java/com/whop/api/resources/files/AsyncRawFilesClient.java new file mode 100644 index 00000000..c5b07afa --- /dev/null +++ b/src/main/java/com/whop/api/resources/files/AsyncRawFilesClient.java @@ -0,0 +1,266 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.files; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.files.requests.CreateFilesRequest; +import com.whop.api.resources.files.requests.RetrieveFilesRequest; +import com.whop.api.resources.files.types.CreateFilesResponse; +import com.whop.api.types.File; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawFilesClient { + protected final ClientOptions clientOptions; + + public AsyncRawFilesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Create a new file record and receive a presigned URL for uploading content to S3. + */ + public CompletableFuture> create(CreateFilesRequest request) { + return create(request, null); + } + + /** + * Create a new file record and receive a presigned URL for uploading content to S3. + */ + public CompletableFuture> create( + CreateFilesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("files"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateFilesResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing file. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveFilesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing file. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveFilesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing file. + */ + public CompletableFuture> retrieve(String id, RetrieveFilesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing file. + */ + public CompletableFuture> retrieve( + String id, RetrieveFilesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("files") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, File.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/files/FilesClient.java b/src/main/java/com/whop/api/resources/files/FilesClient.java new file mode 100644 index 00000000..b6e6ca08 --- /dev/null +++ b/src/main/java/com/whop/api/resources/files/FilesClient.java @@ -0,0 +1,71 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.files; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.files.requests.CreateFilesRequest; +import com.whop.api.resources.files.requests.RetrieveFilesRequest; +import com.whop.api.resources.files.types.CreateFilesResponse; +import com.whop.api.types.File; + +public class FilesClient { + protected final ClientOptions clientOptions; + + private final RawFilesClient rawClient; + + public FilesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawFilesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawFilesClient withRawResponse() { + return this.rawClient; + } + + /** + * Create a new file record and receive a presigned URL for uploading content to S3. + */ + public CreateFilesResponse create(CreateFilesRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Create a new file record and receive a presigned URL for uploading content to S3. + */ + public CreateFilesResponse create(CreateFilesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing file. + */ + public File retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing file. + */ + public File retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing file. + */ + public File retrieve(String id, RetrieveFilesRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing file. + */ + public File retrieve(String id, RetrieveFilesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/files/RawFilesClient.java b/src/main/java/com/whop/api/resources/files/RawFilesClient.java new file mode 100644 index 00000000..5b3f69f5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/files/RawFilesClient.java @@ -0,0 +1,205 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.files; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.files.requests.CreateFilesRequest; +import com.whop.api.resources.files.requests.RetrieveFilesRequest; +import com.whop.api.resources.files.types.CreateFilesResponse; +import com.whop.api.types.File; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawFilesClient { + protected final ClientOptions clientOptions; + + public RawFilesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Create a new file record and receive a presigned URL for uploading content to S3. + */ + public WhopApiHttpResponse create(CreateFilesRequest request) { + return create(request, null); + } + + /** + * Create a new file record and receive a presigned URL for uploading content to S3. + */ + public WhopApiHttpResponse create(CreateFilesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("files"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateFilesResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing file. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveFilesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing file. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveFilesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing file. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveFilesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing file. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveFilesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("files") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, File.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/files/requests/CreateFilesRequest.java b/src/main/java/com/whop/api/resources/files/requests/CreateFilesRequest.java new file mode 100644 index 00000000..9d26cf10 --- /dev/null +++ b/src/main/java/com/whop/api/resources/files/requests/CreateFilesRequest.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.files.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.FileVisibility; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateFilesRequest.Builder.class) +public final class CreateFilesRequest { + private final String filename; + + private final Optional visibility; + + private final Map additionalProperties; + + private CreateFilesRequest( + String filename, Optional visibility, Map additionalProperties) { + this.filename = filename; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return The name of the file including its extension (e.g., "photo.png" or "document.pdf"). + */ + @JsonProperty("filename") + public String getFilename() { + return filename; + } + + /** + * @return Controls whether the file is publicly accessible via CDN or requires authentication. Defaults to private. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateFilesRequest && equalTo((CreateFilesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateFilesRequest other) { + return filename.equals(other.filename) && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.filename, this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FilenameStage builder() { + return new Builder(); + } + + public interface FilenameStage { + /** + *

The name of the file including its extension (e.g., "photo.png" or "document.pdf").

+ */ + _FinalStage filename(@NotNull String filename); + + Builder from(CreateFilesRequest other); + } + + public interface _FinalStage { + CreateFilesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Controls whether the file is publicly accessible via CDN or requires authentication. Defaults to private.

+ */ + _FinalStage visibility(Optional visibility); + + _FinalStage visibility(FileVisibility visibility); + + _FinalStage visibility(Nullable visibility); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FilenameStage, _FinalStage { + private String filename; + + private Optional visibility = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateFilesRequest other) { + filename(other.getFilename()); + visibility(other.getVisibility()); + return this; + } + + /** + *

The name of the file including its extension (e.g., "photo.png" or "document.pdf").

+ *

The name of the file including its extension (e.g., "photo.png" or "document.pdf").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("filename") + public _FinalStage filename(@NotNull String filename) { + this.filename = Objects.requireNonNull(filename, "filename must not be null"); + return this; + } + + /** + *

Controls whether the file is publicly accessible via CDN or requires authentication. Defaults to private.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + /** + *

Controls whether the file is publicly accessible via CDN or requires authentication. Defaults to private.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(FileVisibility visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + /** + *

Controls whether the file is publicly accessible via CDN or requires authentication. Defaults to private.

+ */ + @java.lang.Override + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public _FinalStage visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + @java.lang.Override + public CreateFilesRequest build() { + return new CreateFilesRequest(filename, visibility, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/files/requests/RetrieveFilesRequest.java b/src/main/java/com/whop/api/resources/files/requests/RetrieveFilesRequest.java new file mode 100644 index 00000000..5c964028 --- /dev/null +++ b/src/main/java/com/whop/api/resources/files/requests/RetrieveFilesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.files.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveFilesRequest.Builder.class) +public final class RetrieveFilesRequest { + private final Map additionalProperties; + + private RetrieveFilesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveFilesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveFilesRequest other) { + return this; + } + + public RetrieveFilesRequest build() { + return new RetrieveFilesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/files/types/CreateFilesResponse.java b/src/main/java/com/whop/api/resources/files/types/CreateFilesResponse.java new file mode 100644 index 00000000..54301990 --- /dev/null +++ b/src/main/java/com/whop/api/resources/files/types/CreateFilesResponse.java @@ -0,0 +1,647 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.files.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.FileVisibility; +import com.whop.api.types.UploadStatuses; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateFilesResponse.Builder.class) +public final class CreateFilesResponse { + private final Optional contentType; + + private final Optional filename; + + private final String id; + + private final Optional size; + + private final Optional> uploadHeaders; + + private final UploadStatuses uploadStatus; + + private final Optional uploadUrl; + + private final Optional url; + + private final FileVisibility visibility; + + private final Map additionalProperties; + + private CreateFilesResponse( + Optional contentType, + Optional filename, + String id, + Optional size, + Optional> uploadHeaders, + UploadStatuses uploadStatus, + Optional uploadUrl, + Optional url, + FileVisibility visibility, + Map additionalProperties) { + this.contentType = contentType; + this.filename = filename; + this.id = id; + this.size = size; + this.uploadHeaders = uploadHeaders; + this.uploadStatus = uploadStatus; + this.uploadUrl = uploadUrl; + this.url = url; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return The MIME type of the uploaded file (e.g., image/jpeg, video/mp4, audio/mpeg). + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return The original filename of the uploaded file, including its file extension. + */ + @JsonIgnore + public Optional getFilename() { + if (filename == null) { + return Optional.empty(); + } + return filename; + } + + /** + * @return The unique identifier for the file. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The file size in bytes. Null if the file has not finished uploading. + */ + @JsonIgnore + public Optional getSize() { + if (size == null) { + return Optional.empty(); + } + return size; + } + + /** + * @return Headers to include in the upload request. Only present in the response from the create mutation. + */ + @JsonIgnore + public Optional> getUploadHeaders() { + if (uploadHeaders == null) { + return Optional.empty(); + } + return uploadHeaders; + } + + /** + * @return The current upload status of the file (e.g., pending, ready). + */ + @JsonProperty("upload_status") + public UploadStatuses getUploadStatus() { + return uploadStatus; + } + + /** + * @return The presigned URL to upload the file contents to. Only present in the response from the create mutation. + */ + @JsonIgnore + public Optional getUploadUrl() { + if (uploadUrl == null) { + return Optional.empty(); + } + return uploadUrl; + } + + /** + * @return The URL for accessing the file. For public files, this is a permanent CDN URL. For private files, this is a signed URL that expires. Null if the file has not finished uploading. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + /** + * @return Whether the file is publicly accessible or requires authentication. + */ + @JsonProperty("visibility") + public FileVisibility getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filename") + private Optional _getFilename() { + return filename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("size") + private Optional _getSize() { + return size; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("upload_headers") + private Optional> _getUploadHeaders() { + return uploadHeaders; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("upload_url") + private Optional _getUploadUrl() { + return uploadUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateFilesResponse && equalTo((CreateFilesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateFilesResponse other) { + return contentType.equals(other.contentType) + && filename.equals(other.filename) + && id.equals(other.id) + && size.equals(other.size) + && uploadHeaders.equals(other.uploadHeaders) + && uploadStatus.equals(other.uploadStatus) + && uploadUrl.equals(other.uploadUrl) + && url.equals(other.url) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.contentType, + this.filename, + this.id, + this.size, + this.uploadHeaders, + this.uploadStatus, + this.uploadUrl, + this.url, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the file.

+ */ + UploadStatusStage id(@NotNull String id); + + Builder from(CreateFilesResponse other); + } + + public interface UploadStatusStage { + /** + *

The current upload status of the file (e.g., pending, ready).

+ */ + VisibilityStage uploadStatus(@NotNull UploadStatuses uploadStatus); + } + + public interface VisibilityStage { + /** + *

Whether the file is publicly accessible or requires authentication.

+ */ + _FinalStage visibility(@NotNull FileVisibility visibility); + } + + public interface _FinalStage { + CreateFilesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The MIME type of the uploaded file (e.g., image/jpeg, video/mp4, audio/mpeg).

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

The original filename of the uploaded file, including its file extension.

+ */ + _FinalStage filename(Optional filename); + + _FinalStage filename(String filename); + + _FinalStage filename(Nullable filename); + + /** + *

The file size in bytes. Null if the file has not finished uploading.

+ */ + _FinalStage size(Optional size); + + _FinalStage size(String size); + + _FinalStage size(Nullable size); + + /** + *

Headers to include in the upload request. Only present in the response from the create mutation.

+ */ + _FinalStage uploadHeaders(Optional> uploadHeaders); + + _FinalStage uploadHeaders(Map uploadHeaders); + + _FinalStage uploadHeaders(Nullable> uploadHeaders); + + /** + *

The presigned URL to upload the file contents to. Only present in the response from the create mutation.

+ */ + _FinalStage uploadUrl(Optional uploadUrl); + + _FinalStage uploadUrl(String uploadUrl); + + _FinalStage uploadUrl(Nullable uploadUrl); + + /** + *

The URL for accessing the file. For public files, this is a permanent CDN URL. For private files, this is a signed URL that expires. Null if the file has not finished uploading.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UploadStatusStage, VisibilityStage, _FinalStage { + private String id; + + private UploadStatuses uploadStatus; + + private FileVisibility visibility; + + private Optional url = Optional.empty(); + + private Optional uploadUrl = Optional.empty(); + + private Optional> uploadHeaders = Optional.empty(); + + private Optional size = Optional.empty(); + + private Optional filename = Optional.empty(); + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateFilesResponse other) { + contentType(other.getContentType()); + filename(other.getFilename()); + id(other.getId()); + size(other.getSize()); + uploadHeaders(other.getUploadHeaders()); + uploadStatus(other.getUploadStatus()); + uploadUrl(other.getUploadUrl()); + url(other.getUrl()); + visibility(other.getVisibility()); + return this; + } + + /** + *

The unique identifier for the file.

+ *

The unique identifier for the file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UploadStatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current upload status of the file (e.g., pending, ready).

+ *

The current upload status of the file (e.g., pending, ready).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("upload_status") + public VisibilityStage uploadStatus(@NotNull UploadStatuses uploadStatus) { + this.uploadStatus = Objects.requireNonNull(uploadStatus, "uploadStatus must not be null"); + return this; + } + + /** + *

Whether the file is publicly accessible or requires authentication.

+ *

Whether the file is publicly accessible or requires authentication.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("visibility") + public _FinalStage visibility(@NotNull FileVisibility visibility) { + this.visibility = Objects.requireNonNull(visibility, "visibility must not be null"); + return this; + } + + /** + *

The URL for accessing the file. For public files, this is a permanent CDN URL. For private files, this is a signed URL that expires. Null if the file has not finished uploading.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

The URL for accessing the file. For public files, this is a permanent CDN URL. For private files, this is a signed URL that expires. Null if the file has not finished uploading.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

The URL for accessing the file. For public files, this is a permanent CDN URL. For private files, this is a signed URL that expires. Null if the file has not finished uploading.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

The presigned URL to upload the file contents to. Only present in the response from the create mutation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage uploadUrl(Nullable uploadUrl) { + if (uploadUrl.isNull()) { + this.uploadUrl = null; + } else if (uploadUrl.isEmpty()) { + this.uploadUrl = Optional.empty(); + } else { + this.uploadUrl = Optional.of(uploadUrl.get()); + } + return this; + } + + /** + *

The presigned URL to upload the file contents to. Only present in the response from the create mutation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage uploadUrl(String uploadUrl) { + this.uploadUrl = Optional.ofNullable(uploadUrl); + return this; + } + + /** + *

The presigned URL to upload the file contents to. Only present in the response from the create mutation.

+ */ + @java.lang.Override + @JsonSetter(value = "upload_url", nulls = Nulls.SKIP) + public _FinalStage uploadUrl(Optional uploadUrl) { + this.uploadUrl = uploadUrl; + return this; + } + + /** + *

Headers to include in the upload request. Only present in the response from the create mutation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage uploadHeaders(Nullable> uploadHeaders) { + if (uploadHeaders.isNull()) { + this.uploadHeaders = null; + } else if (uploadHeaders.isEmpty()) { + this.uploadHeaders = Optional.empty(); + } else { + this.uploadHeaders = Optional.of(uploadHeaders.get()); + } + return this; + } + + /** + *

Headers to include in the upload request. Only present in the response from the create mutation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage uploadHeaders(Map uploadHeaders) { + this.uploadHeaders = Optional.ofNullable(uploadHeaders); + return this; + } + + /** + *

Headers to include in the upload request. Only present in the response from the create mutation.

+ */ + @java.lang.Override + @JsonSetter(value = "upload_headers", nulls = Nulls.SKIP) + public _FinalStage uploadHeaders(Optional> uploadHeaders) { + this.uploadHeaders = uploadHeaders; + return this; + } + + /** + *

The file size in bytes. Null if the file has not finished uploading.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage size(Nullable size) { + if (size.isNull()) { + this.size = null; + } else if (size.isEmpty()) { + this.size = Optional.empty(); + } else { + this.size = Optional.of(size.get()); + } + return this; + } + + /** + *

The file size in bytes. Null if the file has not finished uploading.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage size(String size) { + this.size = Optional.ofNullable(size); + return this; + } + + /** + *

The file size in bytes. Null if the file has not finished uploading.

+ */ + @java.lang.Override + @JsonSetter(value = "size", nulls = Nulls.SKIP) + public _FinalStage size(Optional size) { + this.size = size; + return this; + } + + /** + *

The original filename of the uploaded file, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(Nullable filename) { + if (filename.isNull()) { + this.filename = null; + } else if (filename.isEmpty()) { + this.filename = Optional.empty(); + } else { + this.filename = Optional.of(filename.get()); + } + return this; + } + + /** + *

The original filename of the uploaded file, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(String filename) { + this.filename = Optional.ofNullable(filename); + return this; + } + + /** + *

The original filename of the uploaded file, including its file extension.

+ */ + @java.lang.Override + @JsonSetter(value = "filename", nulls = Nulls.SKIP) + public _FinalStage filename(Optional filename) { + this.filename = filename; + return this; + } + + /** + *

The MIME type of the uploaded file (e.g., image/jpeg, video/mp4, audio/mpeg).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

The MIME type of the uploaded file (e.g., image/jpeg, video/mp4, audio/mpeg).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

The MIME type of the uploaded file (e.g., image/jpeg, video/mp4, audio/mpeg).

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public CreateFilesResponse build() { + return new CreateFilesResponse( + contentType, + filename, + id, + size, + uploadHeaders, + uploadStatus, + uploadUrl, + url, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/financialactivity/AsyncFinancialActivityClient.java b/src/main/java/com/whop/api/resources/financialactivity/AsyncFinancialActivityClient.java new file mode 100644 index 00000000..7ac08899 --- /dev/null +++ b/src/main/java/com/whop/api/resources/financialactivity/AsyncFinancialActivityClient.java @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.financialactivity; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.financialactivity.requests.ListFinancialActivityRequest; +import com.whop.api.resources.financialactivity.types.ListFinancialActivityResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncFinancialActivityClient { + protected final ClientOptions clientOptions; + + private final AsyncRawFinancialActivityClient rawClient; + + public AsyncFinancialActivityClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawFinancialActivityClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawFinancialActivityClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public CompletableFuture list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public CompletableFuture list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public CompletableFuture list(ListFinancialActivityRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public CompletableFuture list( + ListFinancialActivityRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/financialactivity/AsyncRawFinancialActivityClient.java b/src/main/java/com/whop/api/resources/financialactivity/AsyncRawFinancialActivityClient.java new file mode 100644 index 00000000..27ca8731 --- /dev/null +++ b/src/main/java/com/whop/api/resources/financialactivity/AsyncRawFinancialActivityClient.java @@ -0,0 +1,190 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.financialactivity; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.financialactivity.requests.ListFinancialActivityRequest; +import com.whop.api.resources.financialactivity.types.ListFinancialActivityResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawFinancialActivityClient { + protected final ClientOptions clientOptions; + + public AsyncRawFinancialActivityClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public CompletableFuture> list() { + return list(ListFinancialActivityRequest.builder().build()); + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return list(ListFinancialActivityRequest.builder().build(), requestOptions); + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public CompletableFuture> list( + ListFinancialActivityRequest request) { + return list(request, null); + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public CompletableFuture> list( + ListFinancialActivityRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("financial-activity"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getIncludeOwnedAccounts().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_owned_accounts", + request.getIncludeOwnedAccounts().get(), + false); + } + if (request.getIncludeResource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "include_resource", request.getIncludeResource().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getPostedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "posted_after", request.getPostedAfter().get(), false); + } + if (request.getPostedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "posted_before", request.getPostedBefore().get(), false); + } + if (request.getAvailableAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "available_after", request.getAvailableAfter().get(), false); + } + if (request.getAvailableBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "available_before", request.getAvailableBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getCursor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "cursor", request.getCursor().get(), false); + } + if (request.getLineTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "line_types", request.getLineTypes().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListFinancialActivityResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/financialactivity/FinancialActivityClient.java b/src/main/java/com/whop/api/resources/financialactivity/FinancialActivityClient.java new file mode 100644 index 00000000..ac2a62d8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/financialactivity/FinancialActivityClient.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.financialactivity; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.financialactivity.requests.ListFinancialActivityRequest; +import com.whop.api.resources.financialactivity.types.ListFinancialActivityResponse; + +public class FinancialActivityClient { + protected final ClientOptions clientOptions; + + private final RawFinancialActivityClient rawClient; + + public FinancialActivityClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawFinancialActivityClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawFinancialActivityClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public ListFinancialActivityResponse list() { + return this.rawClient.list().body(); + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public ListFinancialActivityResponse list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public ListFinancialActivityResponse list(ListFinancialActivityRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public ListFinancialActivityResponse list(ListFinancialActivityRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/financialactivity/RawFinancialActivityClient.java b/src/main/java/com/whop/api/resources/financialactivity/RawFinancialActivityClient.java new file mode 100644 index 00000000..0a7acf4d --- /dev/null +++ b/src/main/java/com/whop/api/resources/financialactivity/RawFinancialActivityClient.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.financialactivity; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.financialactivity.requests.ListFinancialActivityRequest; +import com.whop.api.resources.financialactivity.types.ListFinancialActivityResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawFinancialActivityClient { + protected final ClientOptions clientOptions; + + public RawFinancialActivityClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public WhopApiHttpResponse list() { + return list(ListFinancialActivityRequest.builder().build()); + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public WhopApiHttpResponse list(RequestOptions requestOptions) { + return list(ListFinancialActivityRequest.builder().build(), requestOptions); + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public WhopApiHttpResponse list(ListFinancialActivityRequest request) { + return list(request, null); + } + + /** + * Returns an account's or user's activity feed: every movement of money in or out. + */ + public WhopApiHttpResponse list( + ListFinancialActivityRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("financial-activity"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getIncludeOwnedAccounts().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_owned_accounts", + request.getIncludeOwnedAccounts().get(), + false); + } + if (request.getIncludeResource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "include_resource", request.getIncludeResource().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getPostedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "posted_after", request.getPostedAfter().get(), false); + } + if (request.getPostedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "posted_before", request.getPostedBefore().get(), false); + } + if (request.getAvailableAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "available_after", request.getAvailableAfter().get(), false); + } + if (request.getAvailableBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "available_before", request.getAvailableBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getCursor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "cursor", request.getCursor().get(), false); + } + if (request.getLineTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "line_types", request.getLineTypes().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListFinancialActivityResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/financialactivity/requests/ListFinancialActivityRequest.java b/src/main/java/com/whop/api/resources/financialactivity/requests/ListFinancialActivityRequest.java new file mode 100644 index 00000000..9edd04b0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/financialactivity/requests/ListFinancialActivityRequest.java @@ -0,0 +1,477 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.financialactivity.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.financialactivity.types.ListFinancialActivityRequestLineTypesItem; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListFinancialActivityRequest.Builder.class) +public final class ListFinancialActivityRequest { + private final Optional> lineTypes; + + private final Optional accountId; + + private final Optional userId; + + private final Optional includeOwnedAccounts; + + private final Optional includeResource; + + private final Optional currency; + + private final Optional postedAfter; + + private final Optional postedBefore; + + private final Optional availableAfter; + + private final Optional availableBefore; + + private final Optional limit; + + private final Optional cursor; + + private final Map additionalProperties; + + private ListFinancialActivityRequest( + Optional> lineTypes, + Optional accountId, + Optional userId, + Optional includeOwnedAccounts, + Optional includeResource, + Optional currency, + Optional postedAfter, + Optional postedBefore, + Optional availableAfter, + Optional availableBefore, + Optional limit, + Optional cursor, + Map additionalProperties) { + this.lineTypes = lineTypes; + this.accountId = accountId; + this.userId = userId; + this.includeOwnedAccounts = includeOwnedAccounts; + this.includeResource = includeResource; + this.currency = currency; + this.postedAfter = postedAfter; + this.postedBefore = postedBefore; + this.availableAfter = availableAfter; + this.availableBefore = availableBefore; + this.limit = limit; + this.cursor = cursor; + this.additionalProperties = additionalProperties; + } + + /** + * @return Optional ledger line categories to include. Some categories (for example onchain_deposit, which covers inbound crypto deposits such as MoonPay onramps) are only returned when explicitly requested here. + */ + @JsonProperty("line_types") + public Optional> getLineTypes() { + return lineTypes; + } + + /** + * @return The owning account ID (a biz_ identifier). Provide this or user_id. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The owning user ID (a user_ identifier). Provide this or account_id. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + /** + * @return When true, aggregates the authenticated user's personal ledger with the businesses they own (owner role with balance read) into one feed. Requires user_id to be the authenticated user; cannot be combined with account_id or the settlement-date filters. Each returned row includes the owning account. + */ + @JsonProperty("include_owned_accounts") + public Optional getIncludeOwnedAccounts() { + return includeOwnedAccounts; + } + + /** + * @return Whether to include the resource field in the response or not. Consider passing false if you need a fast response without as many rich details. + */ + @JsonProperty("include_resource") + public Optional getIncludeResource() { + return includeResource; + } + + /** + * @return Optional currency code filter, for example usd. + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + /** + * @return Only include rows posted after this ISO 8601 timestamp. + */ + @JsonProperty("posted_after") + public Optional getPostedAfter() { + return postedAfter; + } + + /** + * @return Only include rows posted before this ISO 8601 timestamp. + */ + @JsonProperty("posted_before") + public Optional getPostedBefore() { + return postedBefore; + } + + /** + * @return Only include rows whose funds became withdrawable on or after this YYYY-MM-DD settlement date (UTC), distinct from posted_at. Requires currency. + */ + @JsonProperty("available_after") + public Optional getAvailableAfter() { + return availableAfter; + } + + /** + * @return Only include rows whose funds became withdrawable on or before this YYYY-MM-DD settlement date (UTC). Set equal to available_after for a single day. Requires currency. + */ + @JsonProperty("available_before") + public Optional getAvailableBefore() { + return availableBefore; + } + + /** + * @return Maximum number of rows to return. + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Cursor returned by the previous page. + */ + @JsonProperty("cursor") + public Optional getCursor() { + return cursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListFinancialActivityRequest && equalTo((ListFinancialActivityRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListFinancialActivityRequest other) { + return lineTypes.equals(other.lineTypes) + && accountId.equals(other.accountId) + && userId.equals(other.userId) + && includeOwnedAccounts.equals(other.includeOwnedAccounts) + && includeResource.equals(other.includeResource) + && currency.equals(other.currency) + && postedAfter.equals(other.postedAfter) + && postedBefore.equals(other.postedBefore) + && availableAfter.equals(other.availableAfter) + && availableBefore.equals(other.availableBefore) + && limit.equals(other.limit) + && cursor.equals(other.cursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.lineTypes, + this.accountId, + this.userId, + this.includeOwnedAccounts, + this.includeResource, + this.currency, + this.postedAfter, + this.postedBefore, + this.availableAfter, + this.availableBefore, + this.limit, + this.cursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> lineTypes = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional includeOwnedAccounts = Optional.empty(); + + private Optional includeResource = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional postedAfter = Optional.empty(); + + private Optional postedBefore = Optional.empty(); + + private Optional availableAfter = Optional.empty(); + + private Optional availableBefore = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional cursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListFinancialActivityRequest other) { + lineTypes(other.getLineTypes()); + accountId(other.getAccountId()); + userId(other.getUserId()); + includeOwnedAccounts(other.getIncludeOwnedAccounts()); + includeResource(other.getIncludeResource()); + currency(other.getCurrency()); + postedAfter(other.getPostedAfter()); + postedBefore(other.getPostedBefore()); + availableAfter(other.getAvailableAfter()); + availableBefore(other.getAvailableBefore()); + limit(other.getLimit()); + cursor(other.getCursor()); + return this; + } + + /** + *

Optional ledger line categories to include. Some categories (for example onchain_deposit, which covers inbound crypto deposits such as MoonPay onramps) are only returned when explicitly requested here.

+ */ + @JsonSetter(value = "line_types", nulls = Nulls.SKIP) + public Builder lineTypes(Optional> lineTypes) { + this.lineTypes = lineTypes; + return this; + } + + public Builder lineTypes(List lineTypes) { + this.lineTypes = Optional.ofNullable(lineTypes); + return this; + } + + public Builder lineTypes(ListFinancialActivityRequestLineTypesItem lineTypes) { + this.lineTypes = Optional.of(Collections.singletonList(lineTypes)); + return this; + } + + /** + *

The owning account ID (a biz_ identifier). Provide this or user_id.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The owning user ID (a user_ identifier). Provide this or account_id.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

When true, aggregates the authenticated user's personal ledger with the businesses they own (owner role with balance read) into one feed. Requires user_id to be the authenticated user; cannot be combined with account_id or the settlement-date filters. Each returned row includes the owning account.

+ */ + @JsonSetter(value = "include_owned_accounts", nulls = Nulls.SKIP) + public Builder includeOwnedAccounts(Optional includeOwnedAccounts) { + this.includeOwnedAccounts = includeOwnedAccounts; + return this; + } + + public Builder includeOwnedAccounts(Boolean includeOwnedAccounts) { + this.includeOwnedAccounts = Optional.ofNullable(includeOwnedAccounts); + return this; + } + + /** + *

Whether to include the resource field in the response or not. Consider passing false if you need a fast response without as many rich details.

+ */ + @JsonSetter(value = "include_resource", nulls = Nulls.SKIP) + public Builder includeResource(Optional includeResource) { + this.includeResource = includeResource; + return this; + } + + public Builder includeResource(Boolean includeResource) { + this.includeResource = Optional.ofNullable(includeResource); + return this; + } + + /** + *

Optional currency code filter, for example usd.

+ */ + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional currency) { + this.currency = currency; + return this; + } + + public Builder currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

Only include rows posted after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "posted_after", nulls = Nulls.SKIP) + public Builder postedAfter(Optional postedAfter) { + this.postedAfter = postedAfter; + return this; + } + + public Builder postedAfter(OffsetDateTime postedAfter) { + this.postedAfter = Optional.ofNullable(postedAfter); + return this; + } + + /** + *

Only include rows posted before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "posted_before", nulls = Nulls.SKIP) + public Builder postedBefore(Optional postedBefore) { + this.postedBefore = postedBefore; + return this; + } + + public Builder postedBefore(OffsetDateTime postedBefore) { + this.postedBefore = Optional.ofNullable(postedBefore); + return this; + } + + /** + *

Only include rows whose funds became withdrawable on or after this YYYY-MM-DD settlement date (UTC), distinct from posted_at. Requires currency.

+ */ + @JsonSetter(value = "available_after", nulls = Nulls.SKIP) + public Builder availableAfter(Optional availableAfter) { + this.availableAfter = availableAfter; + return this; + } + + public Builder availableAfter(String availableAfter) { + this.availableAfter = Optional.ofNullable(availableAfter); + return this; + } + + /** + *

Only include rows whose funds became withdrawable on or before this YYYY-MM-DD settlement date (UTC). Set equal to available_after for a single day. Requires currency.

+ */ + @JsonSetter(value = "available_before", nulls = Nulls.SKIP) + public Builder availableBefore(Optional availableBefore) { + this.availableBefore = availableBefore; + return this; + } + + public Builder availableBefore(String availableBefore) { + this.availableBefore = Optional.ofNullable(availableBefore); + return this; + } + + /** + *

Maximum number of rows to return.

+ */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

Cursor returned by the previous page.

+ */ + @JsonSetter(value = "cursor", nulls = Nulls.SKIP) + public Builder cursor(Optional cursor) { + this.cursor = cursor; + return this; + } + + public Builder cursor(String cursor) { + this.cursor = Optional.ofNullable(cursor); + return this; + } + + public ListFinancialActivityRequest build() { + return new ListFinancialActivityRequest( + lineTypes, + accountId, + userId, + includeOwnedAccounts, + includeResource, + currency, + postedAfter, + postedBefore, + availableAfter, + availableBefore, + limit, + cursor, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/financialactivity/types/ListFinancialActivityRequestLineTypesItem.java b/src/main/java/com/whop/api/resources/financialactivity/types/ListFinancialActivityRequestLineTypesItem.java new file mode 100644 index 00000000..63096148 --- /dev/null +++ b/src/main/java/com/whop/api/resources/financialactivity/types/ListFinancialActivityRequestLineTypesItem.java @@ -0,0 +1,1145 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.financialactivity.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListFinancialActivityRequestLineTypesItem { + public static final ListFinancialActivityRequestLineTypesItem DISPUTE_REPRESENTMENT_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.DISPUTE_REPRESENTMENT_FEE, "dispute_representment_fee"); + + public static final ListFinancialActivityRequestLineTypesItem PLATFORM_BALANCE_PAYMENT_REFUND = + new ListFinancialActivityRequestLineTypesItem( + Value.PLATFORM_BALANCE_PAYMENT_REFUND, "platform_balance_payment_refund"); + + public static final ListFinancialActivityRequestLineTypesItem STRIPE_INTERNATIONAL_PROCESSING_FEE = + new ListFinancialActivityRequestLineTypesItem( + Value.STRIPE_INTERNATIONAL_PROCESSING_FEE, "stripe_international_processing_fee"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_DISPUTE_REVERSAL = + new ListFinancialActivityRequestLineTypesItem(Value.PAYMENT_DISPUTE_REVERSAL, "payment_dispute_reversal"); + + public static final ListFinancialActivityRequestLineTypesItem TREASURY_PAYIN = + new ListFinancialActivityRequestLineTypesItem(Value.TREASURY_PAYIN, "treasury_payin"); + + public static final ListFinancialActivityRequestLineTypesItem PLATFORM_COVERED_DISPUTE = + new ListFinancialActivityRequestLineTypesItem(Value.PLATFORM_COVERED_DISPUTE, "platform_covered_dispute"); + + public static final ListFinancialActivityRequestLineTypesItem RESOLUTION_CENTER_REFUND = + new ListFinancialActivityRequestLineTypesItem(Value.RESOLUTION_CENTER_REFUND, "resolution_center_refund"); + + public static final ListFinancialActivityRequestLineTypesItem AD_PUBLISHER_PAYOUT = + new ListFinancialActivityRequestLineTypesItem(Value.AD_PUBLISHER_PAYOUT, "ad_publisher_payout"); + + public static final ListFinancialActivityRequestLineTypesItem BILLING_PERCENTAGE_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.BILLING_PERCENTAGE_FEE, "billing_percentage_fee"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_DISPUTE = + new ListFinancialActivityRequestLineTypesItem(Value.PAYMENT_DISPUTE, "payment_dispute"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_DISPUTE_ADJUSTMENT = + new ListFinancialActivityRequestLineTypesItem( + Value.PAYMENT_DISPUTE_ADJUSTMENT, "payment_dispute_adjustment"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_PROCESSING_PERCENTAGE_FEE = + new ListFinancialActivityRequestLineTypesItem( + Value.PAYMENT_PROCESSING_PERCENTAGE_FEE, "payment_processing_percentage_fee"); + + public static final ListFinancialActivityRequestLineTypesItem THREE_DS_FIXED_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.THREE_DS_FIXED_FEE, "three_ds_fixed_fee"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_REVSHARE_REFUND = + new ListFinancialActivityRequestLineTypesItem(Value.PAYMENT_REVSHARE_REFUND, "payment_revshare_refund"); + + public static final ListFinancialActivityRequestLineTypesItem DISPUTE_ALERT_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.DISPUTE_ALERT_FEE, "dispute_alert_fee"); + + public static final ListFinancialActivityRequestLineTypesItem APPLICATION_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.APPLICATION_FEE, "application_fee"); + + public static final ListFinancialActivityRequestLineTypesItem AIRDROP_LINK_RETURNED = + new ListFinancialActivityRequestLineTypesItem(Value.AIRDROP_LINK_RETURNED, "airdrop_link_returned"); + + public static final ListFinancialActivityRequestLineTypesItem WITHDRAWAL = + new ListFinancialActivityRequestLineTypesItem(Value.WITHDRAWAL, "withdrawal"); + + public static final ListFinancialActivityRequestLineTypesItem PAYOUT_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.PAYOUT_FEE, "payout_fee"); + + public static final ListFinancialActivityRequestLineTypesItem INSTALLMENT_DEFAULT = + new ListFinancialActivityRequestLineTypesItem(Value.INSTALLMENT_DEFAULT, "installment_default"); + + public static final ListFinancialActivityRequestLineTypesItem ONCHAIN_WALLET_TRANSFER_OUTGOING = + new ListFinancialActivityRequestLineTypesItem( + Value.ONCHAIN_WALLET_TRANSFER_OUTGOING, "onchain_wallet_transfer_outgoing"); + + public static final ListFinancialActivityRequestLineTypesItem LICENSE_SALE = + new ListFinancialActivityRequestLineTypesItem(Value.LICENSE_SALE, "license_sale"); + + public static final ListFinancialActivityRequestLineTypesItem APPLICATION_FEE_PAYOUT = + new ListFinancialActivityRequestLineTypesItem(Value.APPLICATION_FEE_PAYOUT, "application_fee_payout"); + + public static final ListFinancialActivityRequestLineTypesItem PLATFORM_BALANCE_PAYMENT = + new ListFinancialActivityRequestLineTypesItem(Value.PLATFORM_BALANCE_PAYMENT, "platform_balance_payment"); + + public static final ListFinancialActivityRequestLineTypesItem LEGACY_PAYMENT = + new ListFinancialActivityRequestLineTypesItem(Value.LEGACY_PAYMENT, "legacy_payment"); + + public static final ListFinancialActivityRequestLineTypesItem AD_PUBLISHER_PAYOUT_RECEIVED = + new ListFinancialActivityRequestLineTypesItem( + Value.AD_PUBLISHER_PAYOUT_RECEIVED, "ad_publisher_payout_received"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_REFERRAL_REVERSAL = + new ListFinancialActivityRequestLineTypesItem(Value.PAYMENT_REFERRAL_REVERSAL, "payment_referral_reversal"); + + public static final ListFinancialActivityRequestLineTypesItem LEGACY_CRYPTO_PAYMENT = + new ListFinancialActivityRequestLineTypesItem(Value.LEGACY_CRYPTO_PAYMENT, "legacy_crypto_payment"); + + public static final ListFinancialActivityRequestLineTypesItem AD_BUDGET_RELEASE = + new ListFinancialActivityRequestLineTypesItem(Value.AD_BUDGET_RELEASE, "ad_budget_release"); + + public static final ListFinancialActivityRequestLineTypesItem AD_SPEND_CHARGE = + new ListFinancialActivityRequestLineTypesItem(Value.AD_SPEND_CHARGE, "ad_spend_charge"); + + public static final ListFinancialActivityRequestLineTypesItem PLATFORM_BALANCE_TRANSFER_INCOMING = + new ListFinancialActivityRequestLineTypesItem( + Value.PLATFORM_BALANCE_TRANSFER_INCOMING, "platform_balance_transfer_incoming"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_REFERRAL = + new ListFinancialActivityRequestLineTypesItem(Value.PAYMENT_REFERRAL, "payment_referral"); + + public static final ListFinancialActivityRequestLineTypesItem PROMO_REVERSAL = + new ListFinancialActivityRequestLineTypesItem(Value.PROMO_REVERSAL, "promo_reversal"); + + public static final ListFinancialActivityRequestLineTypesItem TOPUP_REVERSAL = + new ListFinancialActivityRequestLineTypesItem(Value.TOPUP_REVERSAL, "topup_reversal"); + + public static final ListFinancialActivityRequestLineTypesItem PLATFORM_AFFILIATE_PAYMENT_REVERSAL = + new ListFinancialActivityRequestLineTypesItem( + Value.PLATFORM_AFFILIATE_PAYMENT_REVERSAL, "platform_affiliate_payment_reversal"); + + public static final ListFinancialActivityRequestLineTypesItem AIRDROP = + new ListFinancialActivityRequestLineTypesItem(Value.AIRDROP, "airdrop"); + + public static final ListFinancialActivityRequestLineTypesItem WITHDRAWAL_CLAWBACK_REVERSAL = + new ListFinancialActivityRequestLineTypesItem( + Value.WITHDRAWAL_CLAWBACK_REVERSAL, "withdrawal_clawback_reversal"); + + public static final ListFinancialActivityRequestLineTypesItem CARD_SPEND_AUTHORIZATION = + new ListFinancialActivityRequestLineTypesItem(Value.CARD_SPEND_AUTHORIZATION, "card_spend_authorization"); + + public static final ListFinancialActivityRequestLineTypesItem LICENSE_SALE_REVENUE = + new ListFinancialActivityRequestLineTypesItem(Value.LICENSE_SALE_REVENUE, "license_sale_revenue"); + + public static final ListFinancialActivityRequestLineTypesItem TOPUP = + new ListFinancialActivityRequestLineTypesItem(Value.TOPUP, "topup"); + + public static final ListFinancialActivityRequestLineTypesItem HIGH_RISK_MERCHANT_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.HIGH_RISK_MERCHANT_FEE, "high_risk_merchant_fee"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_REVSHARE_PAYOUT = + new ListFinancialActivityRequestLineTypesItem(Value.PAYMENT_REVSHARE_PAYOUT, "payment_revshare_payout"); + + public static final ListFinancialActivityRequestLineTypesItem INTERNAL_BALANCE_TRANSFER_INCOMING = + new ListFinancialActivityRequestLineTypesItem( + Value.INTERNAL_BALANCE_TRANSFER_INCOMING, "internal_balance_transfer_incoming"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_REFUND_REVERSAL = + new ListFinancialActivityRequestLineTypesItem(Value.PAYMENT_REFUND_REVERSAL, "payment_refund_reversal"); + + public static final ListFinancialActivityRequestLineTypesItem ONCHAIN_DEPOSIT = + new ListFinancialActivityRequestLineTypesItem(Value.ONCHAIN_DEPOSIT, "onchain_deposit"); + + public static final ListFinancialActivityRequestLineTypesItem WITHDRAWAL_RECLASSIFICATION = + new ListFinancialActivityRequestLineTypesItem( + Value.WITHDRAWAL_RECLASSIFICATION, "withdrawal_reclassification"); + + public static final ListFinancialActivityRequestLineTypesItem FRAUD_PREVENTION_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.FRAUD_PREVENTION_FEE, "fraud_prevention_fee"); + + public static final ListFinancialActivityRequestLineTypesItem STRIPE_DOMESTIC_PROCESSING_FEE = + new ListFinancialActivityRequestLineTypesItem( + Value.STRIPE_DOMESTIC_PROCESSING_FEE, "stripe_domestic_processing_fee"); + + public static final ListFinancialActivityRequestLineTypesItem MISC_PURCHASE = + new ListFinancialActivityRequestLineTypesItem(Value.MISC_PURCHASE, "misc_purchase"); + + public static final ListFinancialActivityRequestLineTypesItem PLATFORM_BALANCE_TRANSFER_OUTGOING = + new ListFinancialActivityRequestLineTypesItem( + Value.PLATFORM_BALANCE_TRANSFER_OUTGOING, "platform_balance_transfer_outgoing"); + + public static final ListFinancialActivityRequestLineTypesItem MISC_REVERSAL = + new ListFinancialActivityRequestLineTypesItem(Value.MISC_REVERSAL, "misc_reversal"); + + public static final ListFinancialActivityRequestLineTypesItem AIRDROP_LINK_REDEEMED = + new ListFinancialActivityRequestLineTypesItem(Value.AIRDROP_LINK_REDEEMED, "airdrop_link_redeemed"); + + public static final ListFinancialActivityRequestLineTypesItem ONCHAIN_SWAP_TARGET = + new ListFinancialActivityRequestLineTypesItem(Value.ONCHAIN_SWAP_TARGET, "onchain_swap_target"); + + public static final ListFinancialActivityRequestLineTypesItem AD_CAMPAIGN_BUDGET = + new ListFinancialActivityRequestLineTypesItem(Value.AD_CAMPAIGN_BUDGET, "ad_campaign_budget"); + + public static final ListFinancialActivityRequestLineTypesItem SOFTWARE_RENTAL_TRANSACTION = + new ListFinancialActivityRequestLineTypesItem( + Value.SOFTWARE_RENTAL_TRANSACTION, "software_rental_transaction"); + + public static final ListFinancialActivityRequestLineTypesItem CURRENCY_CONVERSION_INCOMING = + new ListFinancialActivityRequestLineTypesItem( + Value.CURRENCY_CONVERSION_INCOMING, "currency_conversion_incoming"); + + public static final ListFinancialActivityRequestLineTypesItem FEES = + new ListFinancialActivityRequestLineTypesItem(Value.FEES, "fees"); + + public static final ListFinancialActivityRequestLineTypesItem AFFILIATE_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.AFFILIATE_FEE, "affiliate_fee"); + + public static final ListFinancialActivityRequestLineTypesItem CARD_SPEND_AUTHORIZATION_VOID = + new ListFinancialActivityRequestLineTypesItem( + Value.CARD_SPEND_AUTHORIZATION_VOID, "card_spend_authorization_void"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_GROSS_REVERSAL = + new ListFinancialActivityRequestLineTypesItem(Value.PAYMENT_GROSS_REVERSAL, "payment_gross_reversal"); + + public static final ListFinancialActivityRequestLineTypesItem LEGACY_PAYMENT_REFUND = + new ListFinancialActivityRequestLineTypesItem(Value.LEGACY_PAYMENT_REFUND, "legacy_payment_refund"); + + public static final ListFinancialActivityRequestLineTypesItem PASSTHROUGH_GMV = + new ListFinancialActivityRequestLineTypesItem(Value.PASSTHROUGH_GMV, "passthrough_gmv"); + + public static final ListFinancialActivityRequestLineTypesItem DISPUTE_HOLD_ADJUSTMENT = + new ListFinancialActivityRequestLineTypesItem(Value.DISPUTE_HOLD_ADJUSTMENT, "dispute_hold_adjustment"); + + public static final ListFinancialActivityRequestLineTypesItem INTERNAL_WITHDRAWAL = + new ListFinancialActivityRequestLineTypesItem(Value.INTERNAL_WITHDRAWAL, "internal_withdrawal"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_GROSS = + new ListFinancialActivityRequestLineTypesItem(Value.PAYMENT_GROSS, "payment_gross"); + + public static final ListFinancialActivityRequestLineTypesItem BANK_TRANSFER = + new ListFinancialActivityRequestLineTypesItem(Value.BANK_TRANSFER, "bank_transfer"); + + public static final ListFinancialActivityRequestLineTypesItem REFERRAL_BONUS = + new ListFinancialActivityRequestLineTypesItem(Value.REFERRAL_BONUS, "referral_bonus"); + + public static final ListFinancialActivityRequestLineTypesItem INTERNAL_BALANCE_TRANSFER_OUTGOING = + new ListFinancialActivityRequestLineTypesItem( + Value.INTERNAL_BALANCE_TRANSFER_OUTGOING, "internal_balance_transfer_outgoing"); + + public static final ListFinancialActivityRequestLineTypesItem SALES_TAX_REMITTANCE_REVERSAL = + new ListFinancialActivityRequestLineTypesItem( + Value.SALES_TAX_REMITTANCE_REVERSAL, "sales_tax_remittance_reversal"); + + public static final ListFinancialActivityRequestLineTypesItem WITHDRAWAL_CLAWBACK = + new ListFinancialActivityRequestLineTypesItem(Value.WITHDRAWAL_CLAWBACK, "withdrawal_clawback"); + + public static final ListFinancialActivityRequestLineTypesItem LICENSE_SALE_COMMISSION = + new ListFinancialActivityRequestLineTypesItem(Value.LICENSE_SALE_COMMISSION, "license_sale_commission"); + + public static final ListFinancialActivityRequestLineTypesItem REVSHARE_PERCENTAGE_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.REVSHARE_PERCENTAGE_FEE, "revshare_percentage_fee"); + + public static final ListFinancialActivityRequestLineTypesItem SALES_TAX_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.SALES_TAX_FEE, "sales_tax_fee"); + + public static final ListFinancialActivityRequestLineTypesItem WITHDRAWAL_REVERSAL = + new ListFinancialActivityRequestLineTypesItem(Value.WITHDRAWAL_REVERSAL, "withdrawal_reversal"); + + public static final ListFinancialActivityRequestLineTypesItem AIRDROP_REVERSAL = + new ListFinancialActivityRequestLineTypesItem(Value.AIRDROP_REVERSAL, "airdrop_reversal"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_REFUND = + new ListFinancialActivityRequestLineTypesItem(Value.PAYMENT_REFUND, "payment_refund"); + + public static final ListFinancialActivityRequestLineTypesItem CROSS_BORDER_PERCENTAGE_FEE = + new ListFinancialActivityRequestLineTypesItem( + Value.CROSS_BORDER_PERCENTAGE_FEE, "cross_border_percentage_fee"); + + public static final ListFinancialActivityRequestLineTypesItem TOPUP_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.TOPUP_FEE, "topup_fee"); + + public static final ListFinancialActivityRequestLineTypesItem AIRDROP_LINK_CREATED = + new ListFinancialActivityRequestLineTypesItem(Value.AIRDROP_LINK_CREATED, "airdrop_link_created"); + + public static final ListFinancialActivityRequestLineTypesItem FX_PERCENTAGE_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.FX_PERCENTAGE_FEE, "fx_percentage_fee"); + + public static final ListFinancialActivityRequestLineTypesItem CURRENCY_CONVERSION_OUTGOING = + new ListFinancialActivityRequestLineTypesItem( + Value.CURRENCY_CONVERSION_OUTGOING, "currency_conversion_outgoing"); + + public static final ListFinancialActivityRequestLineTypesItem COMPANY_REFERRAL = + new ListFinancialActivityRequestLineTypesItem(Value.COMPANY_REFERRAL, "company_referral"); + + public static final ListFinancialActivityRequestLineTypesItem ORCHESTRATION_PERCENTAGE_FEE = + new ListFinancialActivityRequestLineTypesItem( + Value.ORCHESTRATION_PERCENTAGE_FEE, "orchestration_percentage_fee"); + + public static final ListFinancialActivityRequestLineTypesItem CARD_SPEND_REFUND = + new ListFinancialActivityRequestLineTypesItem(Value.CARD_SPEND_REFUND, "card_spend_refund"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_REVSHARE_REVERSAL = + new ListFinancialActivityRequestLineTypesItem(Value.PAYMENT_REVSHARE_REVERSAL, "payment_revshare_reversal"); + + public static final ListFinancialActivityRequestLineTypesItem PLATFORM_AFFILIATE_PAYMENT = + new ListFinancialActivityRequestLineTypesItem( + Value.PLATFORM_AFFILIATE_PAYMENT, "platform_affiliate_payment"); + + public static final ListFinancialActivityRequestLineTypesItem SALES_TAX_REMITTANCE = + new ListFinancialActivityRequestLineTypesItem(Value.SALES_TAX_REMITTANCE, "sales_tax_remittance"); + + public static final ListFinancialActivityRequestLineTypesItem MISC_REFUND = + new ListFinancialActivityRequestLineTypesItem(Value.MISC_REFUND, "misc_refund"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_PROCESSING_FIXED_FEE = + new ListFinancialActivityRequestLineTypesItem( + Value.PAYMENT_PROCESSING_FIXED_FEE, "payment_processing_fixed_fee"); + + public static final ListFinancialActivityRequestLineTypesItem INTERNAL_WITHDRAWAL_REVERSAL = + new ListFinancialActivityRequestLineTypesItem( + Value.INTERNAL_WITHDRAWAL_REVERSAL, "internal_withdrawal_reversal"); + + public static final ListFinancialActivityRequestLineTypesItem SOFTWARE_RENTAL_REVSHARE = + new ListFinancialActivityRequestLineTypesItem(Value.SOFTWARE_RENTAL_REVSHARE, "software_rental_revshare"); + + public static final ListFinancialActivityRequestLineTypesItem BUYER_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.BUYER_FEE, "buyer_fee"); + + public static final ListFinancialActivityRequestLineTypesItem WHOP_PROCESSING_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.WHOP_PROCESSING_FEE, "whop_processing_fee"); + + public static final ListFinancialActivityRequestLineTypesItem ONCHAIN_WALLET_TRANSFER_INCOMING = + new ListFinancialActivityRequestLineTypesItem( + Value.ONCHAIN_WALLET_TRANSFER_INCOMING, "onchain_wallet_transfer_incoming"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_REVSHARE = + new ListFinancialActivityRequestLineTypesItem(Value.PAYMENT_REVSHARE, "payment_revshare"); + + public static final ListFinancialActivityRequestLineTypesItem PAYMENT_DISPUTE_FEE = + new ListFinancialActivityRequestLineTypesItem(Value.PAYMENT_DISPUTE_FEE, "payment_dispute_fee"); + + private final Value value; + + private final String string; + + ListFinancialActivityRequestLineTypesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListFinancialActivityRequestLineTypesItem + && this.string.equals(((ListFinancialActivityRequestLineTypesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DISPUTE_REPRESENTMENT_FEE: + return visitor.visitDisputeRepresentmentFee(); + case PLATFORM_BALANCE_PAYMENT_REFUND: + return visitor.visitPlatformBalancePaymentRefund(); + case STRIPE_INTERNATIONAL_PROCESSING_FEE: + return visitor.visitStripeInternationalProcessingFee(); + case PAYMENT_DISPUTE_REVERSAL: + return visitor.visitPaymentDisputeReversal(); + case TREASURY_PAYIN: + return visitor.visitTreasuryPayin(); + case PLATFORM_COVERED_DISPUTE: + return visitor.visitPlatformCoveredDispute(); + case RESOLUTION_CENTER_REFUND: + return visitor.visitResolutionCenterRefund(); + case AD_PUBLISHER_PAYOUT: + return visitor.visitAdPublisherPayout(); + case BILLING_PERCENTAGE_FEE: + return visitor.visitBillingPercentageFee(); + case PAYMENT_DISPUTE: + return visitor.visitPaymentDispute(); + case PAYMENT_DISPUTE_ADJUSTMENT: + return visitor.visitPaymentDisputeAdjustment(); + case PAYMENT_PROCESSING_PERCENTAGE_FEE: + return visitor.visitPaymentProcessingPercentageFee(); + case THREE_DS_FIXED_FEE: + return visitor.visitThreeDsFixedFee(); + case PAYMENT_REVSHARE_REFUND: + return visitor.visitPaymentRevshareRefund(); + case DISPUTE_ALERT_FEE: + return visitor.visitDisputeAlertFee(); + case APPLICATION_FEE: + return visitor.visitApplicationFee(); + case AIRDROP_LINK_RETURNED: + return visitor.visitAirdropLinkReturned(); + case WITHDRAWAL: + return visitor.visitWithdrawal(); + case PAYOUT_FEE: + return visitor.visitPayoutFee(); + case INSTALLMENT_DEFAULT: + return visitor.visitInstallmentDefault(); + case ONCHAIN_WALLET_TRANSFER_OUTGOING: + return visitor.visitOnchainWalletTransferOutgoing(); + case LICENSE_SALE: + return visitor.visitLicenseSale(); + case APPLICATION_FEE_PAYOUT: + return visitor.visitApplicationFeePayout(); + case PLATFORM_BALANCE_PAYMENT: + return visitor.visitPlatformBalancePayment(); + case LEGACY_PAYMENT: + return visitor.visitLegacyPayment(); + case AD_PUBLISHER_PAYOUT_RECEIVED: + return visitor.visitAdPublisherPayoutReceived(); + case PAYMENT_REFERRAL_REVERSAL: + return visitor.visitPaymentReferralReversal(); + case LEGACY_CRYPTO_PAYMENT: + return visitor.visitLegacyCryptoPayment(); + case AD_BUDGET_RELEASE: + return visitor.visitAdBudgetRelease(); + case AD_SPEND_CHARGE: + return visitor.visitAdSpendCharge(); + case PLATFORM_BALANCE_TRANSFER_INCOMING: + return visitor.visitPlatformBalanceTransferIncoming(); + case PAYMENT_REFERRAL: + return visitor.visitPaymentReferral(); + case PROMO_REVERSAL: + return visitor.visitPromoReversal(); + case TOPUP_REVERSAL: + return visitor.visitTopupReversal(); + case PLATFORM_AFFILIATE_PAYMENT_REVERSAL: + return visitor.visitPlatformAffiliatePaymentReversal(); + case AIRDROP: + return visitor.visitAirdrop(); + case WITHDRAWAL_CLAWBACK_REVERSAL: + return visitor.visitWithdrawalClawbackReversal(); + case CARD_SPEND_AUTHORIZATION: + return visitor.visitCardSpendAuthorization(); + case LICENSE_SALE_REVENUE: + return visitor.visitLicenseSaleRevenue(); + case TOPUP: + return visitor.visitTopup(); + case HIGH_RISK_MERCHANT_FEE: + return visitor.visitHighRiskMerchantFee(); + case PAYMENT_REVSHARE_PAYOUT: + return visitor.visitPaymentRevsharePayout(); + case INTERNAL_BALANCE_TRANSFER_INCOMING: + return visitor.visitInternalBalanceTransferIncoming(); + case PAYMENT_REFUND_REVERSAL: + return visitor.visitPaymentRefundReversal(); + case ONCHAIN_DEPOSIT: + return visitor.visitOnchainDeposit(); + case WITHDRAWAL_RECLASSIFICATION: + return visitor.visitWithdrawalReclassification(); + case FRAUD_PREVENTION_FEE: + return visitor.visitFraudPreventionFee(); + case STRIPE_DOMESTIC_PROCESSING_FEE: + return visitor.visitStripeDomesticProcessingFee(); + case MISC_PURCHASE: + return visitor.visitMiscPurchase(); + case PLATFORM_BALANCE_TRANSFER_OUTGOING: + return visitor.visitPlatformBalanceTransferOutgoing(); + case MISC_REVERSAL: + return visitor.visitMiscReversal(); + case AIRDROP_LINK_REDEEMED: + return visitor.visitAirdropLinkRedeemed(); + case ONCHAIN_SWAP_TARGET: + return visitor.visitOnchainSwapTarget(); + case AD_CAMPAIGN_BUDGET: + return visitor.visitAdCampaignBudget(); + case SOFTWARE_RENTAL_TRANSACTION: + return visitor.visitSoftwareRentalTransaction(); + case CURRENCY_CONVERSION_INCOMING: + return visitor.visitCurrencyConversionIncoming(); + case FEES: + return visitor.visitFees(); + case AFFILIATE_FEE: + return visitor.visitAffiliateFee(); + case CARD_SPEND_AUTHORIZATION_VOID: + return visitor.visitCardSpendAuthorizationVoid(); + case PAYMENT_GROSS_REVERSAL: + return visitor.visitPaymentGrossReversal(); + case LEGACY_PAYMENT_REFUND: + return visitor.visitLegacyPaymentRefund(); + case PASSTHROUGH_GMV: + return visitor.visitPassthroughGmv(); + case DISPUTE_HOLD_ADJUSTMENT: + return visitor.visitDisputeHoldAdjustment(); + case INTERNAL_WITHDRAWAL: + return visitor.visitInternalWithdrawal(); + case PAYMENT_GROSS: + return visitor.visitPaymentGross(); + case BANK_TRANSFER: + return visitor.visitBankTransfer(); + case REFERRAL_BONUS: + return visitor.visitReferralBonus(); + case INTERNAL_BALANCE_TRANSFER_OUTGOING: + return visitor.visitInternalBalanceTransferOutgoing(); + case SALES_TAX_REMITTANCE_REVERSAL: + return visitor.visitSalesTaxRemittanceReversal(); + case WITHDRAWAL_CLAWBACK: + return visitor.visitWithdrawalClawback(); + case LICENSE_SALE_COMMISSION: + return visitor.visitLicenseSaleCommission(); + case REVSHARE_PERCENTAGE_FEE: + return visitor.visitRevsharePercentageFee(); + case SALES_TAX_FEE: + return visitor.visitSalesTaxFee(); + case WITHDRAWAL_REVERSAL: + return visitor.visitWithdrawalReversal(); + case AIRDROP_REVERSAL: + return visitor.visitAirdropReversal(); + case PAYMENT_REFUND: + return visitor.visitPaymentRefund(); + case CROSS_BORDER_PERCENTAGE_FEE: + return visitor.visitCrossBorderPercentageFee(); + case TOPUP_FEE: + return visitor.visitTopupFee(); + case AIRDROP_LINK_CREATED: + return visitor.visitAirdropLinkCreated(); + case FX_PERCENTAGE_FEE: + return visitor.visitFxPercentageFee(); + case CURRENCY_CONVERSION_OUTGOING: + return visitor.visitCurrencyConversionOutgoing(); + case COMPANY_REFERRAL: + return visitor.visitCompanyReferral(); + case ORCHESTRATION_PERCENTAGE_FEE: + return visitor.visitOrchestrationPercentageFee(); + case CARD_SPEND_REFUND: + return visitor.visitCardSpendRefund(); + case PAYMENT_REVSHARE_REVERSAL: + return visitor.visitPaymentRevshareReversal(); + case PLATFORM_AFFILIATE_PAYMENT: + return visitor.visitPlatformAffiliatePayment(); + case SALES_TAX_REMITTANCE: + return visitor.visitSalesTaxRemittance(); + case MISC_REFUND: + return visitor.visitMiscRefund(); + case PAYMENT_PROCESSING_FIXED_FEE: + return visitor.visitPaymentProcessingFixedFee(); + case INTERNAL_WITHDRAWAL_REVERSAL: + return visitor.visitInternalWithdrawalReversal(); + case SOFTWARE_RENTAL_REVSHARE: + return visitor.visitSoftwareRentalRevshare(); + case BUYER_FEE: + return visitor.visitBuyerFee(); + case WHOP_PROCESSING_FEE: + return visitor.visitWhopProcessingFee(); + case ONCHAIN_WALLET_TRANSFER_INCOMING: + return visitor.visitOnchainWalletTransferIncoming(); + case PAYMENT_REVSHARE: + return visitor.visitPaymentRevshare(); + case PAYMENT_DISPUTE_FEE: + return visitor.visitPaymentDisputeFee(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListFinancialActivityRequestLineTypesItem valueOf(String value) { + switch (value) { + case "dispute_representment_fee": + return DISPUTE_REPRESENTMENT_FEE; + case "platform_balance_payment_refund": + return PLATFORM_BALANCE_PAYMENT_REFUND; + case "stripe_international_processing_fee": + return STRIPE_INTERNATIONAL_PROCESSING_FEE; + case "payment_dispute_reversal": + return PAYMENT_DISPUTE_REVERSAL; + case "treasury_payin": + return TREASURY_PAYIN; + case "platform_covered_dispute": + return PLATFORM_COVERED_DISPUTE; + case "resolution_center_refund": + return RESOLUTION_CENTER_REFUND; + case "ad_publisher_payout": + return AD_PUBLISHER_PAYOUT; + case "billing_percentage_fee": + return BILLING_PERCENTAGE_FEE; + case "payment_dispute": + return PAYMENT_DISPUTE; + case "payment_dispute_adjustment": + return PAYMENT_DISPUTE_ADJUSTMENT; + case "payment_processing_percentage_fee": + return PAYMENT_PROCESSING_PERCENTAGE_FEE; + case "three_ds_fixed_fee": + return THREE_DS_FIXED_FEE; + case "payment_revshare_refund": + return PAYMENT_REVSHARE_REFUND; + case "dispute_alert_fee": + return DISPUTE_ALERT_FEE; + case "application_fee": + return APPLICATION_FEE; + case "airdrop_link_returned": + return AIRDROP_LINK_RETURNED; + case "withdrawal": + return WITHDRAWAL; + case "payout_fee": + return PAYOUT_FEE; + case "installment_default": + return INSTALLMENT_DEFAULT; + case "onchain_wallet_transfer_outgoing": + return ONCHAIN_WALLET_TRANSFER_OUTGOING; + case "license_sale": + return LICENSE_SALE; + case "application_fee_payout": + return APPLICATION_FEE_PAYOUT; + case "platform_balance_payment": + return PLATFORM_BALANCE_PAYMENT; + case "legacy_payment": + return LEGACY_PAYMENT; + case "ad_publisher_payout_received": + return AD_PUBLISHER_PAYOUT_RECEIVED; + case "payment_referral_reversal": + return PAYMENT_REFERRAL_REVERSAL; + case "legacy_crypto_payment": + return LEGACY_CRYPTO_PAYMENT; + case "ad_budget_release": + return AD_BUDGET_RELEASE; + case "ad_spend_charge": + return AD_SPEND_CHARGE; + case "platform_balance_transfer_incoming": + return PLATFORM_BALANCE_TRANSFER_INCOMING; + case "payment_referral": + return PAYMENT_REFERRAL; + case "promo_reversal": + return PROMO_REVERSAL; + case "topup_reversal": + return TOPUP_REVERSAL; + case "platform_affiliate_payment_reversal": + return PLATFORM_AFFILIATE_PAYMENT_REVERSAL; + case "airdrop": + return AIRDROP; + case "withdrawal_clawback_reversal": + return WITHDRAWAL_CLAWBACK_REVERSAL; + case "card_spend_authorization": + return CARD_SPEND_AUTHORIZATION; + case "license_sale_revenue": + return LICENSE_SALE_REVENUE; + case "topup": + return TOPUP; + case "high_risk_merchant_fee": + return HIGH_RISK_MERCHANT_FEE; + case "payment_revshare_payout": + return PAYMENT_REVSHARE_PAYOUT; + case "internal_balance_transfer_incoming": + return INTERNAL_BALANCE_TRANSFER_INCOMING; + case "payment_refund_reversal": + return PAYMENT_REFUND_REVERSAL; + case "onchain_deposit": + return ONCHAIN_DEPOSIT; + case "withdrawal_reclassification": + return WITHDRAWAL_RECLASSIFICATION; + case "fraud_prevention_fee": + return FRAUD_PREVENTION_FEE; + case "stripe_domestic_processing_fee": + return STRIPE_DOMESTIC_PROCESSING_FEE; + case "misc_purchase": + return MISC_PURCHASE; + case "platform_balance_transfer_outgoing": + return PLATFORM_BALANCE_TRANSFER_OUTGOING; + case "misc_reversal": + return MISC_REVERSAL; + case "airdrop_link_redeemed": + return AIRDROP_LINK_REDEEMED; + case "onchain_swap_target": + return ONCHAIN_SWAP_TARGET; + case "ad_campaign_budget": + return AD_CAMPAIGN_BUDGET; + case "software_rental_transaction": + return SOFTWARE_RENTAL_TRANSACTION; + case "currency_conversion_incoming": + return CURRENCY_CONVERSION_INCOMING; + case "fees": + return FEES; + case "affiliate_fee": + return AFFILIATE_FEE; + case "card_spend_authorization_void": + return CARD_SPEND_AUTHORIZATION_VOID; + case "payment_gross_reversal": + return PAYMENT_GROSS_REVERSAL; + case "legacy_payment_refund": + return LEGACY_PAYMENT_REFUND; + case "passthrough_gmv": + return PASSTHROUGH_GMV; + case "dispute_hold_adjustment": + return DISPUTE_HOLD_ADJUSTMENT; + case "internal_withdrawal": + return INTERNAL_WITHDRAWAL; + case "payment_gross": + return PAYMENT_GROSS; + case "bank_transfer": + return BANK_TRANSFER; + case "referral_bonus": + return REFERRAL_BONUS; + case "internal_balance_transfer_outgoing": + return INTERNAL_BALANCE_TRANSFER_OUTGOING; + case "sales_tax_remittance_reversal": + return SALES_TAX_REMITTANCE_REVERSAL; + case "withdrawal_clawback": + return WITHDRAWAL_CLAWBACK; + case "license_sale_commission": + return LICENSE_SALE_COMMISSION; + case "revshare_percentage_fee": + return REVSHARE_PERCENTAGE_FEE; + case "sales_tax_fee": + return SALES_TAX_FEE; + case "withdrawal_reversal": + return WITHDRAWAL_REVERSAL; + case "airdrop_reversal": + return AIRDROP_REVERSAL; + case "payment_refund": + return PAYMENT_REFUND; + case "cross_border_percentage_fee": + return CROSS_BORDER_PERCENTAGE_FEE; + case "topup_fee": + return TOPUP_FEE; + case "airdrop_link_created": + return AIRDROP_LINK_CREATED; + case "fx_percentage_fee": + return FX_PERCENTAGE_FEE; + case "currency_conversion_outgoing": + return CURRENCY_CONVERSION_OUTGOING; + case "company_referral": + return COMPANY_REFERRAL; + case "orchestration_percentage_fee": + return ORCHESTRATION_PERCENTAGE_FEE; + case "card_spend_refund": + return CARD_SPEND_REFUND; + case "payment_revshare_reversal": + return PAYMENT_REVSHARE_REVERSAL; + case "platform_affiliate_payment": + return PLATFORM_AFFILIATE_PAYMENT; + case "sales_tax_remittance": + return SALES_TAX_REMITTANCE; + case "misc_refund": + return MISC_REFUND; + case "payment_processing_fixed_fee": + return PAYMENT_PROCESSING_FIXED_FEE; + case "internal_withdrawal_reversal": + return INTERNAL_WITHDRAWAL_REVERSAL; + case "software_rental_revshare": + return SOFTWARE_RENTAL_REVSHARE; + case "buyer_fee": + return BUYER_FEE; + case "whop_processing_fee": + return WHOP_PROCESSING_FEE; + case "onchain_wallet_transfer_incoming": + return ONCHAIN_WALLET_TRANSFER_INCOMING; + case "payment_revshare": + return PAYMENT_REVSHARE; + case "payment_dispute_fee": + return PAYMENT_DISPUTE_FEE; + default: + return new ListFinancialActivityRequestLineTypesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_BUDGET_RELEASE, + + AD_CAMPAIGN_BUDGET, + + AD_PUBLISHER_PAYOUT, + + AD_PUBLISHER_PAYOUT_RECEIVED, + + AD_SPEND_CHARGE, + + AFFILIATE_FEE, + + AIRDROP, + + AIRDROP_LINK_CREATED, + + AIRDROP_LINK_REDEEMED, + + AIRDROP_LINK_RETURNED, + + AIRDROP_REVERSAL, + + APPLICATION_FEE, + + APPLICATION_FEE_PAYOUT, + + BANK_TRANSFER, + + BILLING_PERCENTAGE_FEE, + + BUYER_FEE, + + CARD_SPEND_AUTHORIZATION, + + CARD_SPEND_AUTHORIZATION_VOID, + + CARD_SPEND_REFUND, + + COMPANY_REFERRAL, + + CROSS_BORDER_PERCENTAGE_FEE, + + CURRENCY_CONVERSION_INCOMING, + + CURRENCY_CONVERSION_OUTGOING, + + DISPUTE_ALERT_FEE, + + DISPUTE_HOLD_ADJUSTMENT, + + DISPUTE_REPRESENTMENT_FEE, + + FEES, + + FRAUD_PREVENTION_FEE, + + FX_PERCENTAGE_FEE, + + HIGH_RISK_MERCHANT_FEE, + + INSTALLMENT_DEFAULT, + + INTERNAL_BALANCE_TRANSFER_INCOMING, + + INTERNAL_BALANCE_TRANSFER_OUTGOING, + + INTERNAL_WITHDRAWAL, + + INTERNAL_WITHDRAWAL_REVERSAL, + + LEGACY_CRYPTO_PAYMENT, + + LEGACY_PAYMENT, + + LEGACY_PAYMENT_REFUND, + + LICENSE_SALE, + + LICENSE_SALE_COMMISSION, + + LICENSE_SALE_REVENUE, + + MISC_PURCHASE, + + MISC_REFUND, + + MISC_REVERSAL, + + ONCHAIN_DEPOSIT, + + ONCHAIN_SWAP_TARGET, + + ONCHAIN_WALLET_TRANSFER_INCOMING, + + ONCHAIN_WALLET_TRANSFER_OUTGOING, + + ORCHESTRATION_PERCENTAGE_FEE, + + PASSTHROUGH_GMV, + + PAYMENT_DISPUTE, + + PAYMENT_DISPUTE_ADJUSTMENT, + + PAYMENT_DISPUTE_FEE, + + PAYMENT_DISPUTE_REVERSAL, + + PAYMENT_GROSS, + + PAYMENT_GROSS_REVERSAL, + + PAYMENT_PROCESSING_FIXED_FEE, + + PAYMENT_PROCESSING_PERCENTAGE_FEE, + + PAYMENT_REFERRAL, + + PAYMENT_REFERRAL_REVERSAL, + + PAYMENT_REFUND, + + PAYMENT_REFUND_REVERSAL, + + PAYMENT_REVSHARE, + + PAYMENT_REVSHARE_PAYOUT, + + PAYMENT_REVSHARE_REFUND, + + PAYMENT_REVSHARE_REVERSAL, + + PAYOUT_FEE, + + PLATFORM_AFFILIATE_PAYMENT, + + PLATFORM_AFFILIATE_PAYMENT_REVERSAL, + + PLATFORM_BALANCE_PAYMENT, + + PLATFORM_BALANCE_PAYMENT_REFUND, + + PLATFORM_BALANCE_TRANSFER_INCOMING, + + PLATFORM_BALANCE_TRANSFER_OUTGOING, + + PLATFORM_COVERED_DISPUTE, + + PROMO_REVERSAL, + + REFERRAL_BONUS, + + RESOLUTION_CENTER_REFUND, + + REVSHARE_PERCENTAGE_FEE, + + SALES_TAX_FEE, + + SALES_TAX_REMITTANCE, + + SALES_TAX_REMITTANCE_REVERSAL, + + SOFTWARE_RENTAL_REVSHARE, + + SOFTWARE_RENTAL_TRANSACTION, + + STRIPE_DOMESTIC_PROCESSING_FEE, + + STRIPE_INTERNATIONAL_PROCESSING_FEE, + + THREE_DS_FIXED_FEE, + + TOPUP, + + TOPUP_FEE, + + TOPUP_REVERSAL, + + TREASURY_PAYIN, + + WHOP_PROCESSING_FEE, + + WITHDRAWAL, + + WITHDRAWAL_CLAWBACK, + + WITHDRAWAL_CLAWBACK_REVERSAL, + + WITHDRAWAL_RECLASSIFICATION, + + WITHDRAWAL_REVERSAL, + + UNKNOWN + } + + public interface Visitor { + T visitAdBudgetRelease(); + + T visitAdCampaignBudget(); + + T visitAdPublisherPayout(); + + T visitAdPublisherPayoutReceived(); + + T visitAdSpendCharge(); + + T visitAffiliateFee(); + + T visitAirdrop(); + + T visitAirdropLinkCreated(); + + T visitAirdropLinkRedeemed(); + + T visitAirdropLinkReturned(); + + T visitAirdropReversal(); + + T visitApplicationFee(); + + T visitApplicationFeePayout(); + + T visitBankTransfer(); + + T visitBillingPercentageFee(); + + T visitBuyerFee(); + + T visitCardSpendAuthorization(); + + T visitCardSpendAuthorizationVoid(); + + T visitCardSpendRefund(); + + T visitCompanyReferral(); + + T visitCrossBorderPercentageFee(); + + T visitCurrencyConversionIncoming(); + + T visitCurrencyConversionOutgoing(); + + T visitDisputeAlertFee(); + + T visitDisputeHoldAdjustment(); + + T visitDisputeRepresentmentFee(); + + T visitFees(); + + T visitFraudPreventionFee(); + + T visitFxPercentageFee(); + + T visitHighRiskMerchantFee(); + + T visitInstallmentDefault(); + + T visitInternalBalanceTransferIncoming(); + + T visitInternalBalanceTransferOutgoing(); + + T visitInternalWithdrawal(); + + T visitInternalWithdrawalReversal(); + + T visitLegacyCryptoPayment(); + + T visitLegacyPayment(); + + T visitLegacyPaymentRefund(); + + T visitLicenseSale(); + + T visitLicenseSaleCommission(); + + T visitLicenseSaleRevenue(); + + T visitMiscPurchase(); + + T visitMiscRefund(); + + T visitMiscReversal(); + + T visitOnchainDeposit(); + + T visitOnchainSwapTarget(); + + T visitOnchainWalletTransferIncoming(); + + T visitOnchainWalletTransferOutgoing(); + + T visitOrchestrationPercentageFee(); + + T visitPassthroughGmv(); + + T visitPaymentDispute(); + + T visitPaymentDisputeAdjustment(); + + T visitPaymentDisputeFee(); + + T visitPaymentDisputeReversal(); + + T visitPaymentGross(); + + T visitPaymentGrossReversal(); + + T visitPaymentProcessingFixedFee(); + + T visitPaymentProcessingPercentageFee(); + + T visitPaymentReferral(); + + T visitPaymentReferralReversal(); + + T visitPaymentRefund(); + + T visitPaymentRefundReversal(); + + T visitPaymentRevshare(); + + T visitPaymentRevsharePayout(); + + T visitPaymentRevshareRefund(); + + T visitPaymentRevshareReversal(); + + T visitPayoutFee(); + + T visitPlatformAffiliatePayment(); + + T visitPlatformAffiliatePaymentReversal(); + + T visitPlatformBalancePayment(); + + T visitPlatformBalancePaymentRefund(); + + T visitPlatformBalanceTransferIncoming(); + + T visitPlatformBalanceTransferOutgoing(); + + T visitPlatformCoveredDispute(); + + T visitPromoReversal(); + + T visitReferralBonus(); + + T visitResolutionCenterRefund(); + + T visitRevsharePercentageFee(); + + T visitSalesTaxFee(); + + T visitSalesTaxRemittance(); + + T visitSalesTaxRemittanceReversal(); + + T visitSoftwareRentalRevshare(); + + T visitSoftwareRentalTransaction(); + + T visitStripeDomesticProcessingFee(); + + T visitStripeInternationalProcessingFee(); + + T visitThreeDsFixedFee(); + + T visitTopup(); + + T visitTopupFee(); + + T visitTopupReversal(); + + T visitTreasuryPayin(); + + T visitWhopProcessingFee(); + + T visitWithdrawal(); + + T visitWithdrawalClawback(); + + T visitWithdrawalClawbackReversal(); + + T visitWithdrawalReclassification(); + + T visitWithdrawalReversal(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/financialactivity/types/ListFinancialActivityResponse.java b/src/main/java/com/whop/api/resources/financialactivity/types/ListFinancialActivityResponse.java new file mode 100644 index 00000000..1119a92f --- /dev/null +++ b/src/main/java/com/whop/api/resources/financialactivity/types/ListFinancialActivityResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.financialactivity.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.LedgerActivity; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListFinancialActivityResponse.Builder.class) +public final class ListFinancialActivityResponse { + private final List data; + + private final ListFinancialActivityResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListFinancialActivityResponse( + List data, + ListFinancialActivityResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListFinancialActivityResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListFinancialActivityResponse && equalTo((ListFinancialActivityResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListFinancialActivityResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListFinancialActivityResponsePageInfo pageInfo); + + Builder from(ListFinancialActivityResponse other); + } + + public interface _FinalStage { + ListFinancialActivityResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(LedgerActivity data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListFinancialActivityResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListFinancialActivityResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListFinancialActivityResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(LedgerActivity data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListFinancialActivityResponse build() { + return new ListFinancialActivityResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/financialactivity/types/ListFinancialActivityResponsePageInfo.java b/src/main/java/com/whop/api/resources/financialactivity/types/ListFinancialActivityResponsePageInfo.java new file mode 100644 index 00000000..3c4d4eac --- /dev/null +++ b/src/main/java/com/whop/api/resources/financialactivity/types/ListFinancialActivityResponsePageInfo.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.financialactivity.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListFinancialActivityResponsePageInfo.Builder.class) +public final class ListFinancialActivityResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListFinancialActivityResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListFinancialActivityResponsePageInfo + && equalTo((ListFinancialActivityResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListFinancialActivityResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListFinancialActivityResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListFinancialActivityResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListFinancialActivityResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListFinancialActivityResponsePageInfo build() { + return new ListFinancialActivityResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/forumposts/AsyncForumPostsClient.java b/src/main/java/com/whop/api/resources/forumposts/AsyncForumPostsClient.java new file mode 100644 index 00000000..ccf340e3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forumposts/AsyncForumPostsClient.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forumposts; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.forumposts.requests.CreateForumPostsRequest; +import com.whop.api.resources.forumposts.requests.ListForumPostsRequest; +import com.whop.api.resources.forumposts.requests.RetrieveForumPostsRequest; +import com.whop.api.resources.forumposts.requests.UpdateForumPostsRequest; +import com.whop.api.types.ForumPost; +import com.whop.api.types.ForumPostListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncForumPostsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawForumPostsClient rawClient; + + public AsyncForumPostsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawForumPostsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawForumPostsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of forum posts within a specific experience, with optional filtering by parent post or pinned status. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture> list(ListForumPostsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of forum posts within a specific experience, with optional filtering by parent post or pinned status. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture> list( + ListForumPostsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create a new forum post or comment within an experience. Supports text content, attachments, polls, paywalling, and pinning. Pass experience_id 'public' with a company_id to post to a company's public forum. + *

Required permissions:

+ *
    + *
  • forum:post:create
  • + *
+ */ + public CompletableFuture create(CreateForumPostsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create a new forum post or comment within an experience. Supports text content, attachments, polls, paywalling, and pinning. Pass experience_id 'public' with a company_id to post to a company's public forum. + *

Required permissions:

+ *
    + *
  • forum:post:create
  • + *
+ */ + public CompletableFuture create(CreateForumPostsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveForumPostsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveForumPostsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public CompletableFuture update(String id, UpdateForumPostsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public CompletableFuture update( + String id, UpdateForumPostsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/forumposts/AsyncRawForumPostsClient.java b/src/main/java/com/whop/api/resources/forumposts/AsyncRawForumPostsClient.java new file mode 100644 index 00000000..997d812f --- /dev/null +++ b/src/main/java/com/whop/api/resources/forumposts/AsyncRawForumPostsClient.java @@ -0,0 +1,579 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forumposts; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.forumposts.requests.CreateForumPostsRequest; +import com.whop.api.resources.forumposts.requests.ListForumPostsRequest; +import com.whop.api.resources.forumposts.requests.RetrieveForumPostsRequest; +import com.whop.api.resources.forumposts.requests.UpdateForumPostsRequest; +import com.whop.api.resources.forumposts.types.ListForumPostsResponse; +import com.whop.api.types.ForumPost; +import com.whop.api.types.ForumPostListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawForumPostsClient { + protected final ClientOptions clientOptions; + + public AsyncRawForumPostsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of forum posts within a specific experience, with optional filtering by parent post or pinned status. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture>> list( + ListForumPostsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of forum posts within a specific experience, with optional filtering by parent post or pinned status. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture>> list( + ListForumPostsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("forum_posts"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "experience_id", request.getExperienceId(), false); + if (request.getIncludeBountyAnchors().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_bounty_anchors", + request.getIncludeBountyAnchors().get(), + false); + } + if (request.getParentId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "parent_id", request.getParentId().get(), false); + } + if (request.getPinned().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "pinned", request.getPinned().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListForumPostsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListForumPostsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListForumPostsRequest nextRequest = ListForumPostsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create a new forum post or comment within an experience. Supports text content, attachments, polls, paywalling, and pinning. Pass experience_id 'public' with a company_id to post to a company's public forum. + *

Required permissions:

+ *
    + *
  • forum:post:create
  • + *
+ */ + public CompletableFuture> create(CreateForumPostsRequest request) { + return create(request, null); + } + + /** + * Create a new forum post or comment within an experience. Supports text content, attachments, polls, paywalling, and pinning. Pass experience_id 'public' with a company_id to post to a company's public forum. + *

Required permissions:

+ *
    + *
  • forum:post:create
  • + *
+ */ + public CompletableFuture> create( + CreateForumPostsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("forum_posts"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ForumPost.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveForumPostsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveForumPostsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RetrieveForumPostsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveForumPostsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("forum_posts") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ForumPost.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateForumPostsRequest.builder().build()); + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateForumPostsRequest.builder().build(), requestOptions); + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public CompletableFuture> update(String id, UpdateForumPostsRequest request) { + return update(id, request, null); + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public CompletableFuture> update( + String id, UpdateForumPostsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("forum_posts") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ForumPost.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/forumposts/ForumPostsClient.java b/src/main/java/com/whop/api/resources/forumposts/ForumPostsClient.java new file mode 100644 index 00000000..37722244 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forumposts/ForumPostsClient.java @@ -0,0 +1,148 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forumposts; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.forumposts.requests.CreateForumPostsRequest; +import com.whop.api.resources.forumposts.requests.ListForumPostsRequest; +import com.whop.api.resources.forumposts.requests.RetrieveForumPostsRequest; +import com.whop.api.resources.forumposts.requests.UpdateForumPostsRequest; +import com.whop.api.types.ForumPost; +import com.whop.api.types.ForumPostListItem; + +public class ForumPostsClient { + protected final ClientOptions clientOptions; + + private final RawForumPostsClient rawClient; + + public ForumPostsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawForumPostsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawForumPostsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of forum posts within a specific experience, with optional filtering by parent post or pinned status. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public SyncPagingIterable list(ListForumPostsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of forum posts within a specific experience, with optional filtering by parent post or pinned status. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public SyncPagingIterable list(ListForumPostsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Create a new forum post or comment within an experience. Supports text content, attachments, polls, paywalling, and pinning. Pass experience_id 'public' with a company_id to post to a company's public forum. + *

Required permissions:

+ *
    + *
  • forum:post:create
  • + *
+ */ + public ForumPost create(CreateForumPostsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Create a new forum post or comment within an experience. Supports text content, attachments, polls, paywalling, and pinning. Pass experience_id 'public' with a company_id to post to a company's public forum. + *

Required permissions:

+ *
    + *
  • forum:post:create
  • + *
+ */ + public ForumPost create(CreateForumPostsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public ForumPost retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public ForumPost retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public ForumPost retrieve(String id, RetrieveForumPostsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public ForumPost retrieve(String id, RetrieveForumPostsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public ForumPost update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public ForumPost update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public ForumPost update(String id, UpdateForumPostsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public ForumPost update(String id, UpdateForumPostsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/forumposts/RawForumPostsClient.java b/src/main/java/com/whop/api/resources/forumposts/RawForumPostsClient.java new file mode 100644 index 00000000..f3b18e42 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forumposts/RawForumPostsClient.java @@ -0,0 +1,455 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forumposts; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.forumposts.requests.CreateForumPostsRequest; +import com.whop.api.resources.forumposts.requests.ListForumPostsRequest; +import com.whop.api.resources.forumposts.requests.RetrieveForumPostsRequest; +import com.whop.api.resources.forumposts.requests.UpdateForumPostsRequest; +import com.whop.api.resources.forumposts.types.ListForumPostsResponse; +import com.whop.api.types.ForumPost; +import com.whop.api.types.ForumPostListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawForumPostsClient { + protected final ClientOptions clientOptions; + + public RawForumPostsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of forum posts within a specific experience, with optional filtering by parent post or pinned status. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListForumPostsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of forum posts within a specific experience, with optional filtering by parent post or pinned status. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListForumPostsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("forum_posts"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "experience_id", request.getExperienceId(), false); + if (request.getIncludeBountyAnchors().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_bounty_anchors", + request.getIncludeBountyAnchors().get(), + false); + } + if (request.getParentId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "parent_id", request.getParentId().get(), false); + } + if (request.getPinned().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "pinned", request.getPinned().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListForumPostsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListForumPostsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListForumPostsRequest nextRequest = ListForumPostsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Create a new forum post or comment within an experience. Supports text content, attachments, polls, paywalling, and pinning. Pass experience_id 'public' with a company_id to post to a company's public forum. + *

Required permissions:

+ *
    + *
  • forum:post:create
  • + *
+ */ + public WhopApiHttpResponse create(CreateForumPostsRequest request) { + return create(request, null); + } + + /** + * Create a new forum post or comment within an experience. Supports text content, attachments, polls, paywalling, and pinning. Pass experience_id 'public' with a company_id to post to a company's public forum. + *

Required permissions:

+ *
    + *
  • forum:post:create
  • + *
+ */ + public WhopApiHttpResponse create(CreateForumPostsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("forum_posts"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ForumPost.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveForumPostsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveForumPostsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveForumPostsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing forum post. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveForumPostsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("forum_posts") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ForumPost.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateForumPostsRequest.builder().build()); + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateForumPostsRequest.builder().build(), requestOptions); + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public WhopApiHttpResponse update(String id, UpdateForumPostsRequest request) { + return update(id, request, null); + } + + /** + * Edit the content, attachments, pinned status, or visibility of an existing forum post or comment. + */ + public WhopApiHttpResponse update( + String id, UpdateForumPostsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("forum_posts") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ForumPost.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/forumposts/requests/CreateForumPostsRequest.java b/src/main/java/com/whop/api/resources/forumposts/requests/CreateForumPostsRequest.java new file mode 100644 index 00000000..ca6a55eb --- /dev/null +++ b/src/main/java/com/whop/api/resources/forumposts/requests/CreateForumPostsRequest.java @@ -0,0 +1,1008 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forumposts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.forumposts.types.CreateForumPostsRequestAttachmentsItem; +import com.whop.api.resources.forumposts.types.CreateForumPostsRequestPoll; +import com.whop.api.types.Currencies; +import com.whop.api.types.ForumPostVisibilityTypes; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateForumPostsRequest.Builder.class) +public final class CreateForumPostsRequest { + private final Optional> attachments; + + private final Optional companyId; + + private final Optional content; + + private final String experienceId; + + private final Optional isMention; + + private final Optional parentId; + + private final Optional paywallAmount; + + private final Optional paywallCurrency; + + private final Optional pinned; + + private final Optional poll; + + private final Optional richContent; + + private final Optional title; + + private final Optional visibility; + + private final Map additionalProperties; + + private CreateForumPostsRequest( + Optional> attachments, + Optional companyId, + Optional content, + String experienceId, + Optional isMention, + Optional parentId, + Optional paywallAmount, + Optional paywallCurrency, + Optional pinned, + Optional poll, + Optional richContent, + Optional title, + Optional visibility, + Map additionalProperties) { + this.attachments = attachments; + this.companyId = companyId; + this.content = content; + this.experienceId = experienceId; + this.isMention = isMention; + this.parentId = parentId; + this.paywallAmount = paywallAmount; + this.paywallCurrency = paywallCurrency; + this.pinned = pinned; + this.poll = poll; + this.richContent = richContent; + this.title = title; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of file attachments to include with the post, such as images or videos. + */ + @JsonIgnore + public Optional> getAttachments() { + if (attachments == null) { + return Optional.empty(); + } + return attachments; + } + + /** + * @return The unique identifier of the company whose public forum to post in. Required when experience_id is 'public'. For example, 'biz_xxxxx'. + */ + @JsonIgnore + public Optional getCompanyId() { + if (companyId == null) { + return Optional.empty(); + } + return companyId; + } + + /** + * @return The main body of the post in Markdown format. For example, 'Check out this update'. Hidden if the post is paywalled and the viewer has not purchased access. + */ + @JsonIgnore + public Optional getContent() { + if (content == null) { + return Optional.empty(); + } + return content; + } + + /** + * @return The unique identifier of the experience to create this post in. For example, 'exp_xxxxx'. Pass 'public' along with company_id to automatically use the company's public forum. + */ + @JsonProperty("experience_id") + public String getExperienceId() { + return experienceId; + } + + /** + * @return Whether to send this post as a mention notification to all users in the experience who have mentions enabled. + */ + @JsonIgnore + public Optional getIsMention() { + if (isMention == null) { + return Optional.empty(); + } + return isMention; + } + + /** + * @return The unique identifier of the parent post to comment on. Omit this field to create a top-level post. + */ + @JsonIgnore + public Optional getParentId() { + if (parentId == null) { + return Optional.empty(); + } + return parentId; + } + + /** + * @return The price to unlock this post in the specified paywall currency. For example, 5.00 for $5.00. When set, users must purchase access to view the post content. + */ + @JsonIgnore + public Optional getPaywallAmount() { + if (paywallAmount == null) { + return Optional.empty(); + } + return paywallAmount; + } + + /** + * @return The currency for the paywall price on this post. When set along with paywall_amount, users must purchase access to view the post content. + */ + @JsonIgnore + public Optional getPaywallCurrency() { + if (paywallCurrency == null) { + return Optional.empty(); + } + return paywallCurrency; + } + + /** + * @return Whether this post should be pinned to the top of the forum. + */ + @JsonIgnore + public Optional getPinned() { + if (pinned == null) { + return Optional.empty(); + } + return pinned; + } + + /** + * @return A poll to attach to this post, allowing members to vote on options. + */ + @JsonIgnore + public Optional getPoll() { + if (poll == null) { + return Optional.empty(); + } + return poll; + } + + /** + * @return The rich content of the post in Tiptap JSON format. When provided, takes priority over the markdown content field for rendering. + */ + @JsonIgnore + public Optional getRichContent() { + if (richContent == null) { + return Optional.empty(); + } + return richContent; + } + + /** + * @return The title of the post, displayed prominently at the top. Required for paywalled posts as it remains visible to non-purchasers. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return Controls who can see this forum post, such as members only or public. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("attachments") + private Optional> _getAttachments() { + return attachments; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company_id") + private Optional _getCompanyId() { + return companyId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content") + private Optional _getContent() { + return content; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("is_mention") + private Optional _getIsMention() { + return isMention; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("parent_id") + private Optional _getParentId() { + return parentId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("paywall_amount") + private Optional _getPaywallAmount() { + return paywallAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("paywall_currency") + private Optional _getPaywallCurrency() { + return paywallCurrency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("pinned") + private Optional _getPinned() { + return pinned; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("poll") + private Optional _getPoll() { + return poll; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("rich_content") + private Optional _getRichContent() { + return richContent; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateForumPostsRequest && equalTo((CreateForumPostsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateForumPostsRequest other) { + return attachments.equals(other.attachments) + && companyId.equals(other.companyId) + && content.equals(other.content) + && experienceId.equals(other.experienceId) + && isMention.equals(other.isMention) + && parentId.equals(other.parentId) + && paywallAmount.equals(other.paywallAmount) + && paywallCurrency.equals(other.paywallCurrency) + && pinned.equals(other.pinned) + && poll.equals(other.poll) + && richContent.equals(other.richContent) + && title.equals(other.title) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.attachments, + this.companyId, + this.content, + this.experienceId, + this.isMention, + this.parentId, + this.paywallAmount, + this.paywallCurrency, + this.pinned, + this.poll, + this.richContent, + this.title, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExperienceIdStage builder() { + return new Builder(); + } + + public interface ExperienceIdStage { + /** + *

The unique identifier of the experience to create this post in. For example, 'exp_xxxxx'. Pass 'public' along with company_id to automatically use the company's public forum.

+ */ + _FinalStage experienceId(@NotNull String experienceId); + + Builder from(CreateForumPostsRequest other); + } + + public interface _FinalStage { + CreateForumPostsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of file attachments to include with the post, such as images or videos.

+ */ + _FinalStage attachments(Optional> attachments); + + _FinalStage attachments(List attachments); + + _FinalStage attachments(Nullable> attachments); + + /** + *

The unique identifier of the company whose public forum to post in. Required when experience_id is 'public'. For example, 'biz_xxxxx'.

+ */ + _FinalStage companyId(Optional companyId); + + _FinalStage companyId(String companyId); + + _FinalStage companyId(Nullable companyId); + + /** + *

The main body of the post in Markdown format. For example, 'Check out this update'. Hidden if the post is paywalled and the viewer has not purchased access.

+ */ + _FinalStage content(Optional content); + + _FinalStage content(String content); + + _FinalStage content(Nullable content); + + /** + *

Whether to send this post as a mention notification to all users in the experience who have mentions enabled.

+ */ + _FinalStage isMention(Optional isMention); + + _FinalStage isMention(Boolean isMention); + + _FinalStage isMention(Nullable isMention); + + /** + *

The unique identifier of the parent post to comment on. Omit this field to create a top-level post.

+ */ + _FinalStage parentId(Optional parentId); + + _FinalStage parentId(String parentId); + + _FinalStage parentId(Nullable parentId); + + /** + *

The price to unlock this post in the specified paywall currency. For example, 5.00 for $5.00. When set, users must purchase access to view the post content.

+ */ + _FinalStage paywallAmount(Optional paywallAmount); + + _FinalStage paywallAmount(Double paywallAmount); + + _FinalStage paywallAmount(Nullable paywallAmount); + + /** + *

The currency for the paywall price on this post. When set along with paywall_amount, users must purchase access to view the post content.

+ */ + _FinalStage paywallCurrency(Optional paywallCurrency); + + _FinalStage paywallCurrency(Currencies paywallCurrency); + + _FinalStage paywallCurrency(Nullable paywallCurrency); + + /** + *

Whether this post should be pinned to the top of the forum.

+ */ + _FinalStage pinned(Optional pinned); + + _FinalStage pinned(Boolean pinned); + + _FinalStage pinned(Nullable pinned); + + /** + *

A poll to attach to this post, allowing members to vote on options.

+ */ + _FinalStage poll(Optional poll); + + _FinalStage poll(CreateForumPostsRequestPoll poll); + + _FinalStage poll(Nullable poll); + + /** + *

The rich content of the post in Tiptap JSON format. When provided, takes priority over the markdown content field for rendering.

+ */ + _FinalStage richContent(Optional richContent); + + _FinalStage richContent(String richContent); + + _FinalStage richContent(Nullable richContent); + + /** + *

The title of the post, displayed prominently at the top. Required for paywalled posts as it remains visible to non-purchasers.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + + /** + *

Controls who can see this forum post, such as members only or public.

+ */ + _FinalStage visibility(Optional visibility); + + _FinalStage visibility(ForumPostVisibilityTypes visibility); + + _FinalStage visibility(Nullable visibility); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExperienceIdStage, _FinalStage { + private String experienceId; + + private Optional visibility = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional richContent = Optional.empty(); + + private Optional poll = Optional.empty(); + + private Optional pinned = Optional.empty(); + + private Optional paywallCurrency = Optional.empty(); + + private Optional paywallAmount = Optional.empty(); + + private Optional parentId = Optional.empty(); + + private Optional isMention = Optional.empty(); + + private Optional content = Optional.empty(); + + private Optional companyId = Optional.empty(); + + private Optional> attachments = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateForumPostsRequest other) { + attachments(other.getAttachments()); + companyId(other.getCompanyId()); + content(other.getContent()); + experienceId(other.getExperienceId()); + isMention(other.getIsMention()); + parentId(other.getParentId()); + paywallAmount(other.getPaywallAmount()); + paywallCurrency(other.getPaywallCurrency()); + pinned(other.getPinned()); + poll(other.getPoll()); + richContent(other.getRichContent()); + title(other.getTitle()); + visibility(other.getVisibility()); + return this; + } + + /** + *

The unique identifier of the experience to create this post in. For example, 'exp_xxxxx'. Pass 'public' along with company_id to automatically use the company's public forum.

+ *

The unique identifier of the experience to create this post in. For example, 'exp_xxxxx'. Pass 'public' along with company_id to automatically use the company's public forum.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("experience_id") + public _FinalStage experienceId(@NotNull String experienceId) { + this.experienceId = Objects.requireNonNull(experienceId, "experienceId must not be null"); + return this; + } + + /** + *

Controls who can see this forum post, such as members only or public.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + /** + *

Controls who can see this forum post, such as members only or public.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(ForumPostVisibilityTypes visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + /** + *

Controls who can see this forum post, such as members only or public.

+ */ + @java.lang.Override + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public _FinalStage visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + /** + *

The title of the post, displayed prominently at the top. Required for paywalled posts as it remains visible to non-purchasers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

The title of the post, displayed prominently at the top. Required for paywalled posts as it remains visible to non-purchasers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The title of the post, displayed prominently at the top. Required for paywalled posts as it remains visible to non-purchasers.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

The rich content of the post in Tiptap JSON format. When provided, takes priority over the markdown content field for rendering.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage richContent(Nullable richContent) { + if (richContent.isNull()) { + this.richContent = null; + } else if (richContent.isEmpty()) { + this.richContent = Optional.empty(); + } else { + this.richContent = Optional.of(richContent.get()); + } + return this; + } + + /** + *

The rich content of the post in Tiptap JSON format. When provided, takes priority over the markdown content field for rendering.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage richContent(String richContent) { + this.richContent = Optional.ofNullable(richContent); + return this; + } + + /** + *

The rich content of the post in Tiptap JSON format. When provided, takes priority over the markdown content field for rendering.

+ */ + @java.lang.Override + @JsonSetter(value = "rich_content", nulls = Nulls.SKIP) + public _FinalStage richContent(Optional richContent) { + this.richContent = richContent; + return this; + } + + /** + *

A poll to attach to this post, allowing members to vote on options.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage poll(Nullable poll) { + if (poll.isNull()) { + this.poll = null; + } else if (poll.isEmpty()) { + this.poll = Optional.empty(); + } else { + this.poll = Optional.of(poll.get()); + } + return this; + } + + /** + *

A poll to attach to this post, allowing members to vote on options.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage poll(CreateForumPostsRequestPoll poll) { + this.poll = Optional.ofNullable(poll); + return this; + } + + /** + *

A poll to attach to this post, allowing members to vote on options.

+ */ + @java.lang.Override + @JsonSetter(value = "poll", nulls = Nulls.SKIP) + public _FinalStage poll(Optional poll) { + this.poll = poll; + return this; + } + + /** + *

Whether this post should be pinned to the top of the forum.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pinned(Nullable pinned) { + if (pinned.isNull()) { + this.pinned = null; + } else if (pinned.isEmpty()) { + this.pinned = Optional.empty(); + } else { + this.pinned = Optional.of(pinned.get()); + } + return this; + } + + /** + *

Whether this post should be pinned to the top of the forum.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pinned(Boolean pinned) { + this.pinned = Optional.ofNullable(pinned); + return this; + } + + /** + *

Whether this post should be pinned to the top of the forum.

+ */ + @java.lang.Override + @JsonSetter(value = "pinned", nulls = Nulls.SKIP) + public _FinalStage pinned(Optional pinned) { + this.pinned = pinned; + return this; + } + + /** + *

The currency for the paywall price on this post. When set along with paywall_amount, users must purchase access to view the post content.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paywallCurrency(Nullable paywallCurrency) { + if (paywallCurrency.isNull()) { + this.paywallCurrency = null; + } else if (paywallCurrency.isEmpty()) { + this.paywallCurrency = Optional.empty(); + } else { + this.paywallCurrency = Optional.of(paywallCurrency.get()); + } + return this; + } + + /** + *

The currency for the paywall price on this post. When set along with paywall_amount, users must purchase access to view the post content.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paywallCurrency(Currencies paywallCurrency) { + this.paywallCurrency = Optional.ofNullable(paywallCurrency); + return this; + } + + /** + *

The currency for the paywall price on this post. When set along with paywall_amount, users must purchase access to view the post content.

+ */ + @java.lang.Override + @JsonSetter(value = "paywall_currency", nulls = Nulls.SKIP) + public _FinalStage paywallCurrency(Optional paywallCurrency) { + this.paywallCurrency = paywallCurrency; + return this; + } + + /** + *

The price to unlock this post in the specified paywall currency. For example, 5.00 for $5.00. When set, users must purchase access to view the post content.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paywallAmount(Nullable paywallAmount) { + if (paywallAmount.isNull()) { + this.paywallAmount = null; + } else if (paywallAmount.isEmpty()) { + this.paywallAmount = Optional.empty(); + } else { + this.paywallAmount = Optional.of(paywallAmount.get()); + } + return this; + } + + /** + *

The price to unlock this post in the specified paywall currency. For example, 5.00 for $5.00. When set, users must purchase access to view the post content.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paywallAmount(Double paywallAmount) { + this.paywallAmount = Optional.ofNullable(paywallAmount); + return this; + } + + /** + *

The price to unlock this post in the specified paywall currency. For example, 5.00 for $5.00. When set, users must purchase access to view the post content.

+ */ + @java.lang.Override + @JsonSetter(value = "paywall_amount", nulls = Nulls.SKIP) + public _FinalStage paywallAmount(Optional paywallAmount) { + this.paywallAmount = paywallAmount; + return this; + } + + /** + *

The unique identifier of the parent post to comment on. Omit this field to create a top-level post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage parentId(Nullable parentId) { + if (parentId.isNull()) { + this.parentId = null; + } else if (parentId.isEmpty()) { + this.parentId = Optional.empty(); + } else { + this.parentId = Optional.of(parentId.get()); + } + return this; + } + + /** + *

The unique identifier of the parent post to comment on. Omit this field to create a top-level post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage parentId(String parentId) { + this.parentId = Optional.ofNullable(parentId); + return this; + } + + /** + *

The unique identifier of the parent post to comment on. Omit this field to create a top-level post.

+ */ + @java.lang.Override + @JsonSetter(value = "parent_id", nulls = Nulls.SKIP) + public _FinalStage parentId(Optional parentId) { + this.parentId = parentId; + return this; + } + + /** + *

Whether to send this post as a mention notification to all users in the experience who have mentions enabled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage isMention(Nullable isMention) { + if (isMention.isNull()) { + this.isMention = null; + } else if (isMention.isEmpty()) { + this.isMention = Optional.empty(); + } else { + this.isMention = Optional.of(isMention.get()); + } + return this; + } + + /** + *

Whether to send this post as a mention notification to all users in the experience who have mentions enabled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage isMention(Boolean isMention) { + this.isMention = Optional.ofNullable(isMention); + return this; + } + + /** + *

Whether to send this post as a mention notification to all users in the experience who have mentions enabled.

+ */ + @java.lang.Override + @JsonSetter(value = "is_mention", nulls = Nulls.SKIP) + public _FinalStage isMention(Optional isMention) { + this.isMention = isMention; + return this; + } + + /** + *

The main body of the post in Markdown format. For example, 'Check out this update'. Hidden if the post is paywalled and the viewer has not purchased access.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(Nullable content) { + if (content.isNull()) { + this.content = null; + } else if (content.isEmpty()) { + this.content = Optional.empty(); + } else { + this.content = Optional.of(content.get()); + } + return this; + } + + /** + *

The main body of the post in Markdown format. For example, 'Check out this update'. Hidden if the post is paywalled and the viewer has not purchased access.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

The main body of the post in Markdown format. For example, 'Check out this update'. Hidden if the post is paywalled and the viewer has not purchased access.

+ */ + @java.lang.Override + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public _FinalStage content(Optional content) { + this.content = content; + return this; + } + + /** + *

The unique identifier of the company whose public forum to post in. Required when experience_id is 'public'. For example, 'biz_xxxxx'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage companyId(Nullable companyId) { + if (companyId.isNull()) { + this.companyId = null; + } else if (companyId.isEmpty()) { + this.companyId = Optional.empty(); + } else { + this.companyId = Optional.of(companyId.get()); + } + return this; + } + + /** + *

The unique identifier of the company whose public forum to post in. Required when experience_id is 'public'. For example, 'biz_xxxxx'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + /** + *

The unique identifier of the company whose public forum to post in. Required when experience_id is 'public'. For example, 'biz_xxxxx'.

+ */ + @java.lang.Override + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public _FinalStage companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + /** + *

A list of file attachments to include with the post, such as images or videos.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage attachments(Nullable> attachments) { + if (attachments.isNull()) { + this.attachments = null; + } else if (attachments.isEmpty()) { + this.attachments = Optional.empty(); + } else { + this.attachments = Optional.of(attachments.get()); + } + return this; + } + + /** + *

A list of file attachments to include with the post, such as images or videos.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage attachments(List attachments) { + this.attachments = Optional.ofNullable(attachments); + return this; + } + + /** + *

A list of file attachments to include with the post, such as images or videos.

+ */ + @java.lang.Override + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public _FinalStage attachments(Optional> attachments) { + this.attachments = attachments; + return this; + } + + @java.lang.Override + public CreateForumPostsRequest build() { + return new CreateForumPostsRequest( + attachments, + companyId, + content, + experienceId, + isMention, + parentId, + paywallAmount, + paywallCurrency, + pinned, + poll, + richContent, + title, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/forumposts/requests/ListForumPostsRequest.java b/src/main/java/com/whop/api/resources/forumposts/requests/ListForumPostsRequest.java new file mode 100644 index 00000000..82ec2158 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forumposts/requests/ListForumPostsRequest.java @@ -0,0 +1,451 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forumposts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListForumPostsRequest.Builder.class) +public final class ListForumPostsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String experienceId; + + private final Optional includeBountyAnchors; + + private final Optional parentId; + + private final Optional pinned; + + private final Map additionalProperties; + + private ListForumPostsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String experienceId, + Optional includeBountyAnchors, + Optional parentId, + Optional pinned, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.experienceId = experienceId; + this.includeBountyAnchors = includeBountyAnchors; + this.parentId = parentId; + this.pinned = pinned; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the experience to list forum posts for. + */ + @JsonProperty("experience_id") + public String getExperienceId() { + return experienceId; + } + + /** + * @return Whether to include top-level bounty discussion anchors as rich forum items. + */ + @JsonProperty("include_bounty_anchors") + public Optional getIncludeBountyAnchors() { + return includeBountyAnchors; + } + + /** + * @return The unique identifier of a parent post to list comments for. When set, returns replies to that post. + */ + @JsonProperty("parent_id") + public Optional getParentId() { + return parentId; + } + + /** + * @return Whether to filter for only pinned posts. Set to true to return only pinned posts. + */ + @JsonProperty("pinned") + public Optional getPinned() { + return pinned; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListForumPostsRequest && equalTo((ListForumPostsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListForumPostsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && experienceId.equals(other.experienceId) + && includeBountyAnchors.equals(other.includeBountyAnchors) + && parentId.equals(other.parentId) + && pinned.equals(other.pinned); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.after, + this.before, + this.first, + this.last, + this.experienceId, + this.includeBountyAnchors, + this.parentId, + this.pinned); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExperienceIdStage builder() { + return new Builder(); + } + + public interface ExperienceIdStage { + /** + *

The unique identifier of the experience to list forum posts for.

+ */ + _FinalStage experienceId(@NotNull String experienceId); + + Builder from(ListForumPostsRequest other); + } + + public interface _FinalStage { + ListForumPostsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + /** + *

Whether to include top-level bounty discussion anchors as rich forum items.

+ */ + _FinalStage includeBountyAnchors(Optional includeBountyAnchors); + + _FinalStage includeBountyAnchors(Boolean includeBountyAnchors); + + /** + *

The unique identifier of a parent post to list comments for. When set, returns replies to that post.

+ */ + _FinalStage parentId(Optional parentId); + + _FinalStage parentId(String parentId); + + /** + *

Whether to filter for only pinned posts. Set to true to return only pinned posts.

+ */ + _FinalStage pinned(Optional pinned); + + _FinalStage pinned(Boolean pinned); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExperienceIdStage, _FinalStage { + private String experienceId; + + private Optional pinned = Optional.empty(); + + private Optional parentId = Optional.empty(); + + private Optional includeBountyAnchors = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListForumPostsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + experienceId(other.getExperienceId()); + includeBountyAnchors(other.getIncludeBountyAnchors()); + parentId(other.getParentId()); + pinned(other.getPinned()); + return this; + } + + /** + *

The unique identifier of the experience to list forum posts for.

+ *

The unique identifier of the experience to list forum posts for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("experience_id") + public _FinalStage experienceId(@NotNull String experienceId) { + this.experienceId = Objects.requireNonNull(experienceId, "experienceId must not be null"); + return this; + } + + /** + *

Whether to filter for only pinned posts. Set to true to return only pinned posts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pinned(Boolean pinned) { + this.pinned = Optional.ofNullable(pinned); + return this; + } + + /** + *

Whether to filter for only pinned posts. Set to true to return only pinned posts.

+ */ + @java.lang.Override + @JsonSetter(value = "pinned", nulls = Nulls.SKIP) + public _FinalStage pinned(Optional pinned) { + this.pinned = pinned; + return this; + } + + /** + *

The unique identifier of a parent post to list comments for. When set, returns replies to that post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage parentId(String parentId) { + this.parentId = Optional.ofNullable(parentId); + return this; + } + + /** + *

The unique identifier of a parent post to list comments for. When set, returns replies to that post.

+ */ + @java.lang.Override + @JsonSetter(value = "parent_id", nulls = Nulls.SKIP) + public _FinalStage parentId(Optional parentId) { + this.parentId = parentId; + return this; + } + + /** + *

Whether to include top-level bounty discussion anchors as rich forum items.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage includeBountyAnchors(Boolean includeBountyAnchors) { + this.includeBountyAnchors = Optional.ofNullable(includeBountyAnchors); + return this; + } + + /** + *

Whether to include top-level bounty discussion anchors as rich forum items.

+ */ + @java.lang.Override + @JsonSetter(value = "include_bounty_anchors", nulls = Nulls.SKIP) + public _FinalStage includeBountyAnchors(Optional includeBountyAnchors) { + this.includeBountyAnchors = includeBountyAnchors; + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListForumPostsRequest build() { + return new ListForumPostsRequest( + after, + before, + first, + last, + experienceId, + includeBountyAnchors, + parentId, + pinned, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/forumposts/requests/RetrieveForumPostsRequest.java b/src/main/java/com/whop/api/resources/forumposts/requests/RetrieveForumPostsRequest.java new file mode 100644 index 00000000..a9961138 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forumposts/requests/RetrieveForumPostsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forumposts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveForumPostsRequest.Builder.class) +public final class RetrieveForumPostsRequest { + private final Map additionalProperties; + + private RetrieveForumPostsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveForumPostsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveForumPostsRequest other) { + return this; + } + + public RetrieveForumPostsRequest build() { + return new RetrieveForumPostsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/forumposts/requests/UpdateForumPostsRequest.java b/src/main/java/com/whop/api/resources/forumposts/requests/UpdateForumPostsRequest.java new file mode 100644 index 00000000..c2c52e41 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forumposts/requests/UpdateForumPostsRequest.java @@ -0,0 +1,339 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forumposts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.forumposts.types.UpdateForumPostsRequestAttachmentsItem; +import com.whop.api.types.ForumPostVisibilityTypes; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateForumPostsRequest.Builder.class) +public final class UpdateForumPostsRequest { + private final Optional> attachments; + + private final Optional content; + + private final Optional isPinned; + + private final Optional title; + + private final Optional visibility; + + private final Map additionalProperties; + + private UpdateForumPostsRequest( + Optional> attachments, + Optional content, + Optional isPinned, + Optional title, + Optional visibility, + Map additionalProperties) { + this.attachments = attachments; + this.content = content; + this.isPinned = isPinned; + this.title = title; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return A replacement list of file attachments for this post, such as images or videos. + */ + @JsonIgnore + public Optional> getAttachments() { + if (attachments == null) { + return Optional.empty(); + } + return attachments; + } + + /** + * @return The updated body of the post in Markdown format. For example, 'Check out this update'. Hidden if the post is paywalled and the viewer has not purchased access. + */ + @JsonIgnore + public Optional getContent() { + if (content == null) { + return Optional.empty(); + } + return content; + } + + /** + * @return Whether this post should be pinned to the top of the forum. Only top-level posts can be pinned, not comments. + */ + @JsonIgnore + public Optional getIsPinned() { + if (isPinned == null) { + return Optional.empty(); + } + return isPinned; + } + + /** + * @return The updated title of the post, displayed prominently at the top. Required for paywalled posts as it remains visible to non-purchasers. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return Controls who can see this forum post, such as members only or public. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("attachments") + private Optional> _getAttachments() { + return attachments; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content") + private Optional _getContent() { + return content; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("is_pinned") + private Optional _getIsPinned() { + return isPinned; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateForumPostsRequest && equalTo((UpdateForumPostsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateForumPostsRequest other) { + return attachments.equals(other.attachments) + && content.equals(other.content) + && isPinned.equals(other.isPinned) + && title.equals(other.title) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.attachments, this.content, this.isPinned, this.title, this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> attachments = Optional.empty(); + + private Optional content = Optional.empty(); + + private Optional isPinned = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional visibility = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateForumPostsRequest other) { + attachments(other.getAttachments()); + content(other.getContent()); + isPinned(other.getIsPinned()); + title(other.getTitle()); + visibility(other.getVisibility()); + return this; + } + + /** + *

A replacement list of file attachments for this post, such as images or videos.

+ */ + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public Builder attachments(Optional> attachments) { + this.attachments = attachments; + return this; + } + + public Builder attachments(List attachments) { + this.attachments = Optional.ofNullable(attachments); + return this; + } + + public Builder attachments(Nullable> attachments) { + if (attachments.isNull()) { + this.attachments = null; + } else if (attachments.isEmpty()) { + this.attachments = Optional.empty(); + } else { + this.attachments = Optional.of(attachments.get()); + } + return this; + } + + /** + *

The updated body of the post in Markdown format. For example, 'Check out this update'. Hidden if the post is paywalled and the viewer has not purchased access.

+ */ + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public Builder content(Optional content) { + this.content = content; + return this; + } + + public Builder content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + public Builder content(Nullable content) { + if (content.isNull()) { + this.content = null; + } else if (content.isEmpty()) { + this.content = Optional.empty(); + } else { + this.content = Optional.of(content.get()); + } + return this; + } + + /** + *

Whether this post should be pinned to the top of the forum. Only top-level posts can be pinned, not comments.

+ */ + @JsonSetter(value = "is_pinned", nulls = Nulls.SKIP) + public Builder isPinned(Optional isPinned) { + this.isPinned = isPinned; + return this; + } + + public Builder isPinned(Boolean isPinned) { + this.isPinned = Optional.ofNullable(isPinned); + return this; + } + + public Builder isPinned(Nullable isPinned) { + if (isPinned.isNull()) { + this.isPinned = null; + } else if (isPinned.isEmpty()) { + this.isPinned = Optional.empty(); + } else { + this.isPinned = Optional.of(isPinned.get()); + } + return this; + } + + /** + *

The updated title of the post, displayed prominently at the top. Required for paywalled posts as it remains visible to non-purchasers.

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Controls who can see this forum post, such as members only or public.

+ */ + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public Builder visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + public Builder visibility(ForumPostVisibilityTypes visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + public Builder visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + public UpdateForumPostsRequest build() { + return new UpdateForumPostsRequest(attachments, content, isPinned, title, visibility, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/forumposts/types/CreateForumPostsRequestAttachmentsItem.java b/src/main/java/com/whop/api/resources/forumposts/types/CreateForumPostsRequestAttachmentsItem.java new file mode 100644 index 00000000..0616e308 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forumposts/types/CreateForumPostsRequestAttachmentsItem.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forumposts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateForumPostsRequestAttachmentsItem.Builder.class) +public final class CreateForumPostsRequestAttachmentsItem { + private final String id; + + private final Map additionalProperties; + + private CreateForumPostsRequestAttachmentsItem(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateForumPostsRequestAttachmentsItem + && equalTo((CreateForumPostsRequestAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateForumPostsRequestAttachmentsItem other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CreateForumPostsRequestAttachmentsItem other); + } + + public interface _FinalStage { + CreateForumPostsRequestAttachmentsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateForumPostsRequestAttachmentsItem other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CreateForumPostsRequestAttachmentsItem build() { + return new CreateForumPostsRequestAttachmentsItem(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/forumposts/types/CreateForumPostsRequestPoll.java b/src/main/java/com/whop/api/resources/forumposts/types/CreateForumPostsRequestPoll.java new file mode 100644 index 00000000..3603d01e --- /dev/null +++ b/src/main/java/com/whop/api/resources/forumposts/types/CreateForumPostsRequestPoll.java @@ -0,0 +1,123 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forumposts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateForumPostsRequestPoll.Builder.class) +public final class CreateForumPostsRequestPoll { + private final List options; + + private final Map additionalProperties; + + private CreateForumPostsRequestPoll( + List options, Map additionalProperties) { + this.options = options; + this.additionalProperties = additionalProperties; + } + + /** + * @return The options for the poll. Must have sequential IDs starting from 1 + */ + @JsonProperty("options") + public List getOptions() { + return options; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateForumPostsRequestPoll && equalTo((CreateForumPostsRequestPoll) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateForumPostsRequestPoll other) { + return options.equals(other.options); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.options); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List options = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateForumPostsRequestPoll other) { + options(other.getOptions()); + return this; + } + + /** + *

The options for the poll. Must have sequential IDs starting from 1

+ */ + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public Builder options(List options) { + this.options.clear(); + if (options != null) { + this.options.addAll(options); + } + return this; + } + + public Builder addOptions(CreateForumPostsRequestPollOptionsItem options) { + this.options.add(options); + return this; + } + + public Builder addAllOptions(List options) { + if (options != null) { + this.options.addAll(options); + } + return this; + } + + public CreateForumPostsRequestPoll build() { + return new CreateForumPostsRequestPoll(options, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/forumposts/types/CreateForumPostsRequestPollOptionsItem.java b/src/main/java/com/whop/api/resources/forumposts/types/CreateForumPostsRequestPollOptionsItem.java new file mode 100644 index 00000000..2f56fa76 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forumposts/types/CreateForumPostsRequestPollOptionsItem.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forumposts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateForumPostsRequestPollOptionsItem.Builder.class) +public final class CreateForumPostsRequestPollOptionsItem { + private final String id; + + private final String text; + + private final Map additionalProperties; + + private CreateForumPostsRequestPollOptionsItem(String id, String text, Map additionalProperties) { + this.id = id; + this.text = text; + this.additionalProperties = additionalProperties; + } + + /** + * @return Sequential ID for the poll option (starting from '1') + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The text of the poll option + */ + @JsonProperty("text") + public String getText() { + return text; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateForumPostsRequestPollOptionsItem + && equalTo((CreateForumPostsRequestPollOptionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateForumPostsRequestPollOptionsItem other) { + return id.equals(other.id) && text.equals(other.text); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.text); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Sequential ID for the poll option (starting from '1')

+ */ + TextStage id(@NotNull String id); + + Builder from(CreateForumPostsRequestPollOptionsItem other); + } + + public interface TextStage { + /** + *

The text of the poll option

+ */ + _FinalStage text(@NotNull String text); + } + + public interface _FinalStage { + CreateForumPostsRequestPollOptionsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TextStage, _FinalStage { + private String id; + + private String text; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateForumPostsRequestPollOptionsItem other) { + id(other.getId()); + text(other.getText()); + return this; + } + + /** + *

Sequential ID for the poll option (starting from '1')

+ *

Sequential ID for the poll option (starting from '1')

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TextStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The text of the poll option

+ *

The text of the poll option

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("text") + public _FinalStage text(@NotNull String text) { + this.text = Objects.requireNonNull(text, "text must not be null"); + return this; + } + + @java.lang.Override + public CreateForumPostsRequestPollOptionsItem build() { + return new CreateForumPostsRequestPollOptionsItem(id, text, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/forumposts/types/ListForumPostsResponse.java b/src/main/java/com/whop/api/resources/forumposts/types/ListForumPostsResponse.java new file mode 100644 index 00000000..e4ff642f --- /dev/null +++ b/src/main/java/com/whop/api/resources/forumposts/types/ListForumPostsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forumposts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.ForumPostListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListForumPostsResponse.Builder.class) +public final class ListForumPostsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListForumPostsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListForumPostsResponse && equalTo((ListForumPostsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListForumPostsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListForumPostsResponse other); + } + + public interface _FinalStage { + ListForumPostsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(ForumPostListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListForumPostsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(ForumPostListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListForumPostsResponse build() { + return new ListForumPostsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/forumposts/types/UpdateForumPostsRequestAttachmentsItem.java b/src/main/java/com/whop/api/resources/forumposts/types/UpdateForumPostsRequestAttachmentsItem.java new file mode 100644 index 00000000..60b3b502 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forumposts/types/UpdateForumPostsRequestAttachmentsItem.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forumposts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateForumPostsRequestAttachmentsItem.Builder.class) +public final class UpdateForumPostsRequestAttachmentsItem { + private final String id; + + private final Map additionalProperties; + + private UpdateForumPostsRequestAttachmentsItem(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateForumPostsRequestAttachmentsItem + && equalTo((UpdateForumPostsRequestAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateForumPostsRequestAttachmentsItem other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateForumPostsRequestAttachmentsItem other); + } + + public interface _FinalStage { + UpdateForumPostsRequestAttachmentsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateForumPostsRequestAttachmentsItem other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateForumPostsRequestAttachmentsItem build() { + return new UpdateForumPostsRequestAttachmentsItem(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/forums/AsyncForumsClient.java b/src/main/java/com/whop/api/resources/forums/AsyncForumsClient.java new file mode 100644 index 00000000..248b8690 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forums/AsyncForumsClient.java @@ -0,0 +1,143 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forums; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.forums.requests.ListForumsRequest; +import com.whop.api.resources.forums.requests.RetrieveForumsRequest; +import com.whop.api.resources.forums.requests.UpdateForumsRequest; +import com.whop.api.types.Forum; +import com.whop.api.types.ForumListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncForumsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawForumsClient rawClient; + + public AsyncForumsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawForumsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawForumsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of forums within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture> list(ListForumsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of forums within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture> list( + ListForumsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveForumsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveForumsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public CompletableFuture update(String id, UpdateForumsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public CompletableFuture update(String id, UpdateForumsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/forums/AsyncRawForumsClient.java b/src/main/java/com/whop/api/resources/forums/AsyncRawForumsClient.java new file mode 100644 index 00000000..220d3743 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forums/AsyncRawForumsClient.java @@ -0,0 +1,466 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forums; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.forums.requests.ListForumsRequest; +import com.whop.api.resources.forums.requests.RetrieveForumsRequest; +import com.whop.api.resources.forums.requests.UpdateForumsRequest; +import com.whop.api.resources.forums.types.ListForumsResponse; +import com.whop.api.types.Forum; +import com.whop.api.types.ForumListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawForumsClient { + protected final ClientOptions clientOptions; + + public AsyncRawForumsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of forums within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture>> list(ListForumsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of forums within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture>> list( + ListForumsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("forums"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getProductId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_id", request.getProductId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListForumsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListForumsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListForumsRequest nextRequest = ListForumsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveForumsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveForumsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RetrieveForumsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveForumsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("forums") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Forum.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public CompletableFuture> update(String id) { + return update(id, UpdateForumsRequest.builder().build()); + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateForumsRequest.builder().build(), requestOptions); + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public CompletableFuture> update(String id, UpdateForumsRequest request) { + return update(id, request, null); + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public CompletableFuture> update( + String id, UpdateForumsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("forums") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Forum.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/forums/ForumsClient.java b/src/main/java/com/whop/api/resources/forums/ForumsClient.java new file mode 100644 index 00000000..b6aba96c --- /dev/null +++ b/src/main/java/com/whop/api/resources/forums/ForumsClient.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forums; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.forums.requests.ListForumsRequest; +import com.whop.api.resources.forums.requests.RetrieveForumsRequest; +import com.whop.api.resources.forums.requests.UpdateForumsRequest; +import com.whop.api.types.Forum; +import com.whop.api.types.ForumListItem; + +public class ForumsClient { + protected final ClientOptions clientOptions; + + private final RawForumsClient rawClient; + + public ForumsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawForumsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawForumsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of forums within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public SyncPagingIterable list(ListForumsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of forums within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public SyncPagingIterable list(ListForumsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public Forum retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public Forum retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public Forum retrieve(String id, RetrieveForumsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public Forum retrieve(String id, RetrieveForumsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public Forum update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public Forum update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public Forum update(String id, UpdateForumsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public Forum update(String id, UpdateForumsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/forums/RawForumsClient.java b/src/main/java/com/whop/api/resources/forums/RawForumsClient.java new file mode 100644 index 00000000..1b1dffb4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forums/RawForumsClient.java @@ -0,0 +1,371 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forums; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.forums.requests.ListForumsRequest; +import com.whop.api.resources.forums.requests.RetrieveForumsRequest; +import com.whop.api.resources.forums.requests.UpdateForumsRequest; +import com.whop.api.resources.forums.types.ListForumsResponse; +import com.whop.api.types.Forum; +import com.whop.api.types.ForumListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawForumsClient { + protected final ClientOptions clientOptions; + + public RawForumsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of forums within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListForumsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of forums within a specific company, with optional filtering by product. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListForumsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("forums"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getProductId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_id", request.getProductId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListForumsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListForumsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListForumsRequest nextRequest = ListForumsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveForumsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveForumsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveForumsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing forum. + *

Required permissions:

+ *
    + *
  • forum:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveForumsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("forums") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Forum.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateForumsRequest.builder().build()); + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateForumsRequest.builder().build(), requestOptions); + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateForumsRequest request) { + return update(id, request, null); + } + + /** + * Update moderation and notification settings for a forum, such as who can post, who can comment, and email notification preferences. + *

Required permissions:

+ *
    + *
  • forum:moderate
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateForumsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("forums") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Forum.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/forums/requests/ListForumsRequest.java b/src/main/java/com/whop/api/resources/forums/requests/ListForumsRequest.java new file mode 100644 index 00000000..e58e1f67 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forums/requests/ListForumsRequest.java @@ -0,0 +1,348 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forums.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListForumsRequest.Builder.class) +public final class ListForumsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String companyId; + + private final Optional productId; + + private final Map additionalProperties; + + private ListForumsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String companyId, + Optional productId, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.productId = productId; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to list forums for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return The unique identifier of a product to filter by. When set, only forums connected to this product are returned. + */ + @JsonProperty("product_id") + public Optional getProductId() { + return productId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListForumsRequest && equalTo((ListForumsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListForumsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId) + && productId.equals(other.productId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last, this.companyId, this.productId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to list forums for.

+ */ + _FinalStage companyId(@NotNull String companyId); + + Builder from(ListForumsRequest other); + } + + public interface _FinalStage { + ListForumsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + /** + *

The unique identifier of a product to filter by. When set, only forums connected to this product are returned.

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional productId = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListForumsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + productId(other.getProductId()); + return this; + } + + /** + *

The unique identifier of the company to list forums for.

+ *

The unique identifier of the company to list forums for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The unique identifier of a product to filter by. When set, only forums connected to this product are returned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

The unique identifier of a product to filter by. When set, only forums connected to this product are returned.

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListForumsRequest build() { + return new ListForumsRequest(after, before, first, last, companyId, productId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/forums/requests/RetrieveForumsRequest.java b/src/main/java/com/whop/api/resources/forums/requests/RetrieveForumsRequest.java new file mode 100644 index 00000000..dfe3d1d5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forums/requests/RetrieveForumsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forums.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveForumsRequest.Builder.class) +public final class RetrieveForumsRequest { + private final Map additionalProperties; + + private RetrieveForumsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveForumsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveForumsRequest other) { + return this; + } + + public RetrieveForumsRequest build() { + return new RetrieveForumsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/forums/requests/UpdateForumsRequest.java b/src/main/java/com/whop/api/resources/forums/requests/UpdateForumsRequest.java new file mode 100644 index 00000000..4139bb93 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forums/requests/UpdateForumsRequest.java @@ -0,0 +1,354 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forums.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.forums.types.UpdateForumsRequestBannerImage; +import com.whop.api.types.ForumEmailNotificationPreferences; +import com.whop.api.types.ForumWhoCanCommentTypes; +import com.whop.api.types.ForumWhoCanPostTypes; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateForumsRequest.Builder.class) +public final class UpdateForumsRequest { + private final Optional> bannedWords; + + private final Optional bannerImage; + + private final Optional emailNotificationPreference; + + private final Optional whoCanComment; + + private final Optional whoCanPost; + + private final Map additionalProperties; + + private UpdateForumsRequest( + Optional> bannedWords, + Optional bannerImage, + Optional emailNotificationPreference, + Optional whoCanComment, + Optional whoCanPost, + Map additionalProperties) { + this.bannedWords = bannedWords; + this.bannerImage = bannerImage; + this.emailNotificationPreference = emailNotificationPreference; + this.whoCanComment = whoCanComment; + this.whoCanPost = whoCanPost; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of words that are automatically blocked from posts in this forum. For example, ['spam', 'scam']. + */ + @JsonIgnore + public Optional> getBannedWords() { + if (bannedWords == null) { + return Optional.empty(); + } + return bannedWords; + } + + /** + * @return The banner image displayed at the top of the forum page. Pass null to remove the existing banner. + */ + @JsonIgnore + public Optional getBannerImage() { + if (bannerImage == null) { + return Optional.empty(); + } + return bannerImage; + } + + /** + * @return Controls how email notifications are sent to members when new posts are created in this forum. + */ + @JsonIgnore + public Optional getEmailNotificationPreference() { + if (emailNotificationPreference == null) { + return Optional.empty(); + } + return emailNotificationPreference; + } + + /** + * @return Controls which roles are allowed to comment on posts in this forum. + */ + @JsonIgnore + public Optional getWhoCanComment() { + if (whoCanComment == null) { + return Optional.empty(); + } + return whoCanComment; + } + + /** + * @return Controls which roles are allowed to create new posts in this forum. + */ + @JsonIgnore + public Optional getWhoCanPost() { + if (whoCanPost == null) { + return Optional.empty(); + } + return whoCanPost; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("banned_words") + private Optional> _getBannedWords() { + return bannedWords; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("banner_image") + private Optional _getBannerImage() { + return bannerImage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email_notification_preference") + private Optional _getEmailNotificationPreference() { + return emailNotificationPreference; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("who_can_comment") + private Optional _getWhoCanComment() { + return whoCanComment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("who_can_post") + private Optional _getWhoCanPost() { + return whoCanPost; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateForumsRequest && equalTo((UpdateForumsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateForumsRequest other) { + return bannedWords.equals(other.bannedWords) + && bannerImage.equals(other.bannerImage) + && emailNotificationPreference.equals(other.emailNotificationPreference) + && whoCanComment.equals(other.whoCanComment) + && whoCanPost.equals(other.whoCanPost); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bannedWords, + this.bannerImage, + this.emailNotificationPreference, + this.whoCanComment, + this.whoCanPost); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> bannedWords = Optional.empty(); + + private Optional bannerImage = Optional.empty(); + + private Optional emailNotificationPreference = Optional.empty(); + + private Optional whoCanComment = Optional.empty(); + + private Optional whoCanPost = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateForumsRequest other) { + bannedWords(other.getBannedWords()); + bannerImage(other.getBannerImage()); + emailNotificationPreference(other.getEmailNotificationPreference()); + whoCanComment(other.getWhoCanComment()); + whoCanPost(other.getWhoCanPost()); + return this; + } + + /** + *

A list of words that are automatically blocked from posts in this forum. For example, ['spam', 'scam'].

+ */ + @JsonSetter(value = "banned_words", nulls = Nulls.SKIP) + public Builder bannedWords(Optional> bannedWords) { + this.bannedWords = bannedWords; + return this; + } + + public Builder bannedWords(List bannedWords) { + this.bannedWords = Optional.ofNullable(bannedWords); + return this; + } + + public Builder bannedWords(Nullable> bannedWords) { + if (bannedWords.isNull()) { + this.bannedWords = null; + } else if (bannedWords.isEmpty()) { + this.bannedWords = Optional.empty(); + } else { + this.bannedWords = Optional.of(bannedWords.get()); + } + return this; + } + + /** + *

The banner image displayed at the top of the forum page. Pass null to remove the existing banner.

+ */ + @JsonSetter(value = "banner_image", nulls = Nulls.SKIP) + public Builder bannerImage(Optional bannerImage) { + this.bannerImage = bannerImage; + return this; + } + + public Builder bannerImage(UpdateForumsRequestBannerImage bannerImage) { + this.bannerImage = Optional.ofNullable(bannerImage); + return this; + } + + public Builder bannerImage(Nullable bannerImage) { + if (bannerImage.isNull()) { + this.bannerImage = null; + } else if (bannerImage.isEmpty()) { + this.bannerImage = Optional.empty(); + } else { + this.bannerImage = Optional.of(bannerImage.get()); + } + return this; + } + + /** + *

Controls how email notifications are sent to members when new posts are created in this forum.

+ */ + @JsonSetter(value = "email_notification_preference", nulls = Nulls.SKIP) + public Builder emailNotificationPreference( + Optional emailNotificationPreference) { + this.emailNotificationPreference = emailNotificationPreference; + return this; + } + + public Builder emailNotificationPreference(ForumEmailNotificationPreferences emailNotificationPreference) { + this.emailNotificationPreference = Optional.ofNullable(emailNotificationPreference); + return this; + } + + public Builder emailNotificationPreference( + Nullable emailNotificationPreference) { + if (emailNotificationPreference.isNull()) { + this.emailNotificationPreference = null; + } else if (emailNotificationPreference.isEmpty()) { + this.emailNotificationPreference = Optional.empty(); + } else { + this.emailNotificationPreference = Optional.of(emailNotificationPreference.get()); + } + return this; + } + + /** + *

Controls which roles are allowed to comment on posts in this forum.

+ */ + @JsonSetter(value = "who_can_comment", nulls = Nulls.SKIP) + public Builder whoCanComment(Optional whoCanComment) { + this.whoCanComment = whoCanComment; + return this; + } + + public Builder whoCanComment(ForumWhoCanCommentTypes whoCanComment) { + this.whoCanComment = Optional.ofNullable(whoCanComment); + return this; + } + + public Builder whoCanComment(Nullable whoCanComment) { + if (whoCanComment.isNull()) { + this.whoCanComment = null; + } else if (whoCanComment.isEmpty()) { + this.whoCanComment = Optional.empty(); + } else { + this.whoCanComment = Optional.of(whoCanComment.get()); + } + return this; + } + + /** + *

Controls which roles are allowed to create new posts in this forum.

+ */ + @JsonSetter(value = "who_can_post", nulls = Nulls.SKIP) + public Builder whoCanPost(Optional whoCanPost) { + this.whoCanPost = whoCanPost; + return this; + } + + public Builder whoCanPost(ForumWhoCanPostTypes whoCanPost) { + this.whoCanPost = Optional.ofNullable(whoCanPost); + return this; + } + + public Builder whoCanPost(Nullable whoCanPost) { + if (whoCanPost.isNull()) { + this.whoCanPost = null; + } else if (whoCanPost.isEmpty()) { + this.whoCanPost = Optional.empty(); + } else { + this.whoCanPost = Optional.of(whoCanPost.get()); + } + return this; + } + + public UpdateForumsRequest build() { + return new UpdateForumsRequest( + bannedWords, + bannerImage, + emailNotificationPreference, + whoCanComment, + whoCanPost, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/forums/types/ListForumsResponse.java b/src/main/java/com/whop/api/resources/forums/types/ListForumsResponse.java new file mode 100644 index 00000000..a3cbe728 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forums/types/ListForumsResponse.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forums.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.ForumListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListForumsResponse.Builder.class) +public final class ListForumsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListForumsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListForumsResponse && equalTo((ListForumsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListForumsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListForumsResponse other); + } + + public interface _FinalStage { + ListForumsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(ForumListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListForumsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(ForumListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListForumsResponse build() { + return new ListForumsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/forums/types/UpdateForumsRequestBannerImage.java b/src/main/java/com/whop/api/resources/forums/types/UpdateForumsRequestBannerImage.java new file mode 100644 index 00000000..0ef1e2b8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/forums/types/UpdateForumsRequestBannerImage.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.forums.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateForumsRequestBannerImage.Builder.class) +public final class UpdateForumsRequestBannerImage { + private final String id; + + private final Map additionalProperties; + + private UpdateForumsRequestBannerImage(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateForumsRequestBannerImage && equalTo((UpdateForumsRequestBannerImage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateForumsRequestBannerImage other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateForumsRequestBannerImage other); + } + + public interface _FinalStage { + UpdateForumsRequestBannerImage build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateForumsRequestBannerImage other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateForumsRequestBannerImage build() { + return new UpdateForumsRequestBannerImage(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/identityprofiles/AsyncIdentityProfilesClient.java b/src/main/java/com/whop/api/resources/identityprofiles/AsyncIdentityProfilesClient.java new file mode 100644 index 00000000..b1cffbbe --- /dev/null +++ b/src/main/java/com/whop/api/resources/identityprofiles/AsyncIdentityProfilesClient.java @@ -0,0 +1,197 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.identityprofiles; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.identityprofiles.requests.ListIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.requests.ListVerificationsIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.requests.RetrieveIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.requests.UnlinkIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.types.ListVerificationsIdentityProfileResponseDataItem; +import com.whop.api.types.IdentityProfile; +import com.whop.api.types.IdentityProfileListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncIdentityProfilesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawIdentityProfilesClient rawClient; + + public AsyncIdentityProfilesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawIdentityProfilesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawIdentityProfilesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture> listIdentityProfile() { + return this.rawClient.listIdentityProfile().thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture> listIdentityProfile( + RequestOptions requestOptions) { + return this.rawClient.listIdentityProfile(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture> listIdentityProfile( + ListIdentityProfileRequest request) { + return this.rawClient.listIdentityProfile(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture> listIdentityProfile( + ListIdentityProfileRequest request, RequestOptions requestOptions) { + return this.rawClient.listIdentityProfile(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture retrieveIdentityProfile(String id) { + return this.rawClient.retrieveIdentityProfile(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture retrieveIdentityProfile(String id, RequestOptions requestOptions) { + return this.rawClient.retrieveIdentityProfile(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture retrieveIdentityProfile( + String id, RetrieveIdentityProfileRequest request) { + return this.rawClient.retrieveIdentityProfile(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture retrieveIdentityProfile( + String id, RetrieveIdentityProfileRequest request, RequestOptions requestOptions) { + return this.rawClient + .retrieveIdentityProfile(id, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Unlinks an IdentityProfile from a LedgerAccount (flips the matching link to is_current=false). + */ + public CompletableFuture unlinkIdentityProfile(String id, UnlinkIdentityProfileRequest request) { + return this.rawClient.unlinkIdentityProfile(id, request).thenApply(response -> response.body()); + } + + /** + * Unlinks an IdentityProfile from a LedgerAccount (flips the matching link to is_current=false). + */ + public CompletableFuture unlinkIdentityProfile( + String id, UnlinkIdentityProfileRequest request, RequestOptions requestOptions) { + return this.rawClient.unlinkIdentityProfile(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture> + listVerificationsIdentityProfile(String id) { + return this.rawClient.listVerificationsIdentityProfile(id).thenApply(response -> response.body()); + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture> + listVerificationsIdentityProfile(String id, RequestOptions requestOptions) { + return this.rawClient + .listVerificationsIdentityProfile(id, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture> + listVerificationsIdentityProfile(String id, ListVerificationsIdentityProfileRequest request) { + return this.rawClient.listVerificationsIdentityProfile(id, request).thenApply(response -> response.body()); + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture> + listVerificationsIdentityProfile( + String id, ListVerificationsIdentityProfileRequest request, RequestOptions requestOptions) { + return this.rawClient + .listVerificationsIdentityProfile(id, request, requestOptions) + .thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/identityprofiles/AsyncRawIdentityProfilesClient.java b/src/main/java/com/whop/api/resources/identityprofiles/AsyncRawIdentityProfilesClient.java new file mode 100644 index 00000000..111c4eff --- /dev/null +++ b/src/main/java/com/whop/api/resources/identityprofiles/AsyncRawIdentityProfilesClient.java @@ -0,0 +1,643 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.identityprofiles; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.identityprofiles.requests.ListIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.requests.ListVerificationsIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.requests.RetrieveIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.requests.UnlinkIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.types.ListIdentityProfileResponse; +import com.whop.api.resources.identityprofiles.types.ListVerificationsIdentityProfileResponse; +import com.whop.api.resources.identityprofiles.types.ListVerificationsIdentityProfileResponseDataItem; +import com.whop.api.types.IdentityProfile; +import com.whop.api.types.IdentityProfileListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawIdentityProfilesClient { + protected final ClientOptions clientOptions; + + public AsyncRawIdentityProfilesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture>> listIdentityProfile() { + return listIdentityProfile(ListIdentityProfileRequest.builder().build()); + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture>> listIdentityProfile( + RequestOptions requestOptions) { + return listIdentityProfile(ListIdentityProfileRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture>> listIdentityProfile( + ListIdentityProfileRequest request) { + return listIdentityProfile(request, null); + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture>> listIdentityProfile( + ListIdentityProfileRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("identity_profiles"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getProfileType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "profile_type", request.getProfileType().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListIdentityProfileResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListIdentityProfileResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListIdentityProfileRequest nextRequest = ListIdentityProfileRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return listIdentityProfile(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture> retrieveIdentityProfile(String id) { + return retrieveIdentityProfile( + id, RetrieveIdentityProfileRequest.builder().build()); + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture> retrieveIdentityProfile( + String id, RequestOptions requestOptions) { + return retrieveIdentityProfile( + id, RetrieveIdentityProfileRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture> retrieveIdentityProfile( + String id, RetrieveIdentityProfileRequest request) { + return retrieveIdentityProfile(id, request, null); + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture> retrieveIdentityProfile( + String id, RetrieveIdentityProfileRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("identity_profiles") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, IdentityProfile.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Unlinks an IdentityProfile from a LedgerAccount (flips the matching link to is_current=false). + */ + public CompletableFuture> unlinkIdentityProfile( + String id, UnlinkIdentityProfileRequest request) { + return unlinkIdentityProfile(id, request, null); + } + + /** + * Unlinks an IdentityProfile from a LedgerAccount (flips the matching link to is_current=false). + */ + public CompletableFuture> unlinkIdentityProfile( + String id, UnlinkIdentityProfileRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("identity_profiles") + .addPathSegment(id); + QueryStringMapper.addQueryParameter(httpUrl, "ledger_account_id", request.getLedgerAccountId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, IdentityProfile.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture>> + listVerificationsIdentityProfile(String id) { + return listVerificationsIdentityProfile( + id, ListVerificationsIdentityProfileRequest.builder().build()); + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture>> + listVerificationsIdentityProfile(String id, RequestOptions requestOptions) { + return listVerificationsIdentityProfile( + id, ListVerificationsIdentityProfileRequest.builder().build(), requestOptions); + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture>> + listVerificationsIdentityProfile(String id, ListVerificationsIdentityProfileRequest request) { + return listVerificationsIdentityProfile(id, request, null); + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public CompletableFuture>> + listVerificationsIdentityProfile( + String id, ListVerificationsIdentityProfileRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("identity_profiles") + .addPathSegment(id) + .addPathSegments("verifications"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> + future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListVerificationsIdentityProfileResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListVerificationsIdentityProfileResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListVerificationsIdentityProfileRequest nextRequest = + ListVerificationsIdentityProfileRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return listVerificationsIdentityProfile(id, nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/identityprofiles/IdentityProfilesClient.java b/src/main/java/com/whop/api/resources/identityprofiles/IdentityProfilesClient.java new file mode 100644 index 00000000..773453b4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/identityprofiles/IdentityProfilesClient.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.identityprofiles; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.identityprofiles.requests.ListIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.requests.ListVerificationsIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.requests.RetrieveIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.requests.UnlinkIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.types.ListVerificationsIdentityProfileResponseDataItem; +import com.whop.api.types.IdentityProfile; +import com.whop.api.types.IdentityProfileListItem; + +public class IdentityProfilesClient { + protected final ClientOptions clientOptions; + + private final RawIdentityProfilesClient rawClient; + + public IdentityProfilesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawIdentityProfilesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawIdentityProfilesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public SyncPagingIterable listIdentityProfile() { + return this.rawClient.listIdentityProfile().body(); + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public SyncPagingIterable listIdentityProfile(RequestOptions requestOptions) { + return this.rawClient.listIdentityProfile(requestOptions).body(); + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public SyncPagingIterable listIdentityProfile(ListIdentityProfileRequest request) { + return this.rawClient.listIdentityProfile(request).body(); + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public SyncPagingIterable listIdentityProfile( + ListIdentityProfileRequest request, RequestOptions requestOptions) { + return this.rawClient.listIdentityProfile(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public IdentityProfile retrieveIdentityProfile(String id) { + return this.rawClient.retrieveIdentityProfile(id).body(); + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public IdentityProfile retrieveIdentityProfile(String id, RequestOptions requestOptions) { + return this.rawClient.retrieveIdentityProfile(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public IdentityProfile retrieveIdentityProfile(String id, RetrieveIdentityProfileRequest request) { + return this.rawClient.retrieveIdentityProfile(id, request).body(); + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public IdentityProfile retrieveIdentityProfile( + String id, RetrieveIdentityProfileRequest request, RequestOptions requestOptions) { + return this.rawClient + .retrieveIdentityProfile(id, request, requestOptions) + .body(); + } + + /** + * Unlinks an IdentityProfile from a LedgerAccount (flips the matching link to is_current=false). + */ + public IdentityProfile unlinkIdentityProfile(String id, UnlinkIdentityProfileRequest request) { + return this.rawClient.unlinkIdentityProfile(id, request).body(); + } + + /** + * Unlinks an IdentityProfile from a LedgerAccount (flips the matching link to is_current=false). + */ + public IdentityProfile unlinkIdentityProfile( + String id, UnlinkIdentityProfileRequest request, RequestOptions requestOptions) { + return this.rawClient.unlinkIdentityProfile(id, request, requestOptions).body(); + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public SyncPagingIterable listVerificationsIdentityProfile( + String id) { + return this.rawClient.listVerificationsIdentityProfile(id).body(); + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public SyncPagingIterable listVerificationsIdentityProfile( + String id, RequestOptions requestOptions) { + return this.rawClient + .listVerificationsIdentityProfile(id, requestOptions) + .body(); + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public SyncPagingIterable listVerificationsIdentityProfile( + String id, ListVerificationsIdentityProfileRequest request) { + return this.rawClient.listVerificationsIdentityProfile(id, request).body(); + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public SyncPagingIterable listVerificationsIdentityProfile( + String id, ListVerificationsIdentityProfileRequest request, RequestOptions requestOptions) { + return this.rawClient + .listVerificationsIdentityProfile(id, request, requestOptions) + .body(); + } +} diff --git a/src/main/java/com/whop/api/resources/identityprofiles/RawIdentityProfilesClient.java b/src/main/java/com/whop/api/resources/identityprofiles/RawIdentityProfilesClient.java new file mode 100644 index 00000000..f672556c --- /dev/null +++ b/src/main/java/com/whop/api/resources/identityprofiles/RawIdentityProfilesClient.java @@ -0,0 +1,509 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.identityprofiles; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.identityprofiles.requests.ListIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.requests.ListVerificationsIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.requests.RetrieveIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.requests.UnlinkIdentityProfileRequest; +import com.whop.api.resources.identityprofiles.types.ListIdentityProfileResponse; +import com.whop.api.resources.identityprofiles.types.ListVerificationsIdentityProfileResponse; +import com.whop.api.resources.identityprofiles.types.ListVerificationsIdentityProfileResponseDataItem; +import com.whop.api.types.IdentityProfile; +import com.whop.api.types.IdentityProfileListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawIdentityProfilesClient { + protected final ClientOptions clientOptions; + + public RawIdentityProfilesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public WhopApiHttpResponse> listIdentityProfile() { + return listIdentityProfile(ListIdentityProfileRequest.builder().build()); + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public WhopApiHttpResponse> listIdentityProfile( + RequestOptions requestOptions) { + return listIdentityProfile(ListIdentityProfileRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public WhopApiHttpResponse> listIdentityProfile( + ListIdentityProfileRequest request) { + return listIdentityProfile(request, null); + } + + /** + * Returns a paginated list of identity profiles. When company_id is provided, lists IPs currently linked to that company's ledger. When omitted, lists IPs linked to any ledger the actor can read (including child companies under a parent). + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public WhopApiHttpResponse> listIdentityProfile( + ListIdentityProfileRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("identity_profiles"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getProfileType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "profile_type", request.getProfileType().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListIdentityProfileResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListIdentityProfileResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListIdentityProfileRequest nextRequest = ListIdentityProfileRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> listIdentityProfile( + nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public WhopApiHttpResponse retrieveIdentityProfile(String id) { + return retrieveIdentityProfile( + id, RetrieveIdentityProfileRequest.builder().build()); + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public WhopApiHttpResponse retrieveIdentityProfile(String id, RequestOptions requestOptions) { + return retrieveIdentityProfile( + id, RetrieveIdentityProfileRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public WhopApiHttpResponse retrieveIdentityProfile( + String id, RetrieveIdentityProfileRequest request) { + return retrieveIdentityProfile(id, request, null); + } + + /** + * Retrieves the details of an existing identity profile. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public WhopApiHttpResponse retrieveIdentityProfile( + String id, RetrieveIdentityProfileRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("identity_profiles") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, IdentityProfile.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Unlinks an IdentityProfile from a LedgerAccount (flips the matching link to is_current=false). + */ + public WhopApiHttpResponse unlinkIdentityProfile(String id, UnlinkIdentityProfileRequest request) { + return unlinkIdentityProfile(id, request, null); + } + + /** + * Unlinks an IdentityProfile from a LedgerAccount (flips the matching link to is_current=false). + */ + public WhopApiHttpResponse unlinkIdentityProfile( + String id, UnlinkIdentityProfileRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("identity_profiles") + .addPathSegment(id); + QueryStringMapper.addQueryParameter(httpUrl, "ledger_account_id", request.getLedgerAccountId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, IdentityProfile.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public WhopApiHttpResponse> + listVerificationsIdentityProfile(String id) { + return listVerificationsIdentityProfile( + id, ListVerificationsIdentityProfileRequest.builder().build()); + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public WhopApiHttpResponse> + listVerificationsIdentityProfile(String id, RequestOptions requestOptions) { + return listVerificationsIdentityProfile( + id, ListVerificationsIdentityProfileRequest.builder().build(), requestOptions); + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public WhopApiHttpResponse> + listVerificationsIdentityProfile(String id, ListVerificationsIdentityProfileRequest request) { + return listVerificationsIdentityProfile(id, request, null); + } + + /** + * Returns a list of verifications attached to an identity profile, ordered by most recent first. + *

Required permissions:

+ *
    + *
  • identity:read
  • + *
+ */ + public WhopApiHttpResponse> + listVerificationsIdentityProfile( + String id, ListVerificationsIdentityProfileRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("identity_profiles") + .addPathSegment(id) + .addPathSegments("verifications"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListVerificationsIdentityProfileResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListVerificationsIdentityProfileResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListVerificationsIdentityProfileRequest nextRequest = ListVerificationsIdentityProfileRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> listVerificationsIdentityProfile( + id, nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/identityprofiles/requests/ListIdentityProfileRequest.java b/src/main/java/com/whop/api/resources/identityprofiles/requests/ListIdentityProfileRequest.java new file mode 100644 index 00000000..b5609695 --- /dev/null +++ b/src/main/java/com/whop/api/resources/identityprofiles/requests/ListIdentityProfileRequest.java @@ -0,0 +1,285 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.identityprofiles.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.IdentityProfileKinds; +import com.whop.api.types.IdentityProfileStatuses; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListIdentityProfileRequest.Builder.class) +public final class ListIdentityProfileRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Optional companyId; + + private final Optional profileType; + + private final Optional status; + + private final Map additionalProperties; + + private ListIdentityProfileRequest( + Optional after, + Optional before, + Optional first, + Optional last, + Optional companyId, + Optional profileType, + Optional status, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.profileType = profileType; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to filter to. When omitted, returns IPs across all ledgers the actor can read. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("profile_type") + public Optional getProfileType() { + return profileType; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListIdentityProfileRequest && equalTo((ListIdentityProfileRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListIdentityProfileRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId) + && profileType.equals(other.profileType) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.after, this.before, this.first, this.last, this.companyId, this.profileType, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional companyId = Optional.empty(); + + private Optional profileType = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListIdentityProfileRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + profileType(other.getProfileType()); + status(other.getStatus()); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The unique identifier of the company to filter to. When omitted, returns IPs across all ledgers the actor can read.

+ */ + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + @JsonSetter(value = "profile_type", nulls = Nulls.SKIP) + public Builder profileType(Optional profileType) { + this.profileType = profileType; + return this; + } + + public Builder profileType(IdentityProfileKinds profileType) { + this.profileType = Optional.ofNullable(profileType); + return this; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(IdentityProfileStatuses status) { + this.status = Optional.ofNullable(status); + return this; + } + + public ListIdentityProfileRequest build() { + return new ListIdentityProfileRequest( + after, before, first, last, companyId, profileType, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/identityprofiles/requests/ListVerificationsIdentityProfileRequest.java b/src/main/java/com/whop/api/resources/identityprofiles/requests/ListVerificationsIdentityProfileRequest.java new file mode 100644 index 00000000..06dd21ce --- /dev/null +++ b/src/main/java/com/whop/api/resources/identityprofiles/requests/ListVerificationsIdentityProfileRequest.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.identityprofiles.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListVerificationsIdentityProfileRequest.Builder.class) +public final class ListVerificationsIdentityProfileRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Map additionalProperties; + + private ListVerificationsIdentityProfileRequest( + Optional after, + Optional before, + Optional first, + Optional last, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListVerificationsIdentityProfileRequest + && equalTo((ListVerificationsIdentityProfileRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListVerificationsIdentityProfileRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListVerificationsIdentityProfileRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + public ListVerificationsIdentityProfileRequest build() { + return new ListVerificationsIdentityProfileRequest(after, before, first, last, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/identityprofiles/requests/RetrieveIdentityProfileRequest.java b/src/main/java/com/whop/api/resources/identityprofiles/requests/RetrieveIdentityProfileRequest.java new file mode 100644 index 00000000..5b973516 --- /dev/null +++ b/src/main/java/com/whop/api/resources/identityprofiles/requests/RetrieveIdentityProfileRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.identityprofiles.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveIdentityProfileRequest.Builder.class) +public final class RetrieveIdentityProfileRequest { + private final Map additionalProperties; + + private RetrieveIdentityProfileRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveIdentityProfileRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveIdentityProfileRequest other) { + return this; + } + + public RetrieveIdentityProfileRequest build() { + return new RetrieveIdentityProfileRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/identityprofiles/requests/UnlinkIdentityProfileRequest.java b/src/main/java/com/whop/api/resources/identityprofiles/requests/UnlinkIdentityProfileRequest.java new file mode 100644 index 00000000..9f47b8d8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/identityprofiles/requests/UnlinkIdentityProfileRequest.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.identityprofiles.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UnlinkIdentityProfileRequest.Builder.class) +public final class UnlinkIdentityProfileRequest { + private final String ledgerAccountId; + + private final Map additionalProperties; + + private UnlinkIdentityProfileRequest(String ledgerAccountId, Map additionalProperties) { + this.ledgerAccountId = ledgerAccountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the LedgerAccount to unlink the identity profile from. + */ + @JsonProperty("ledger_account_id") + public String getLedgerAccountId() { + return ledgerAccountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UnlinkIdentityProfileRequest && equalTo((UnlinkIdentityProfileRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UnlinkIdentityProfileRequest other) { + return ledgerAccountId.equals(other.ledgerAccountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.ledgerAccountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LedgerAccountIdStage builder() { + return new Builder(); + } + + public interface LedgerAccountIdStage { + /** + *

The ID of the LedgerAccount to unlink the identity profile from.

+ */ + _FinalStage ledgerAccountId(@NotNull String ledgerAccountId); + + Builder from(UnlinkIdentityProfileRequest other); + } + + public interface _FinalStage { + UnlinkIdentityProfileRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LedgerAccountIdStage, _FinalStage { + private String ledgerAccountId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UnlinkIdentityProfileRequest other) { + ledgerAccountId(other.getLedgerAccountId()); + return this; + } + + /** + *

The ID of the LedgerAccount to unlink the identity profile from.

+ *

The ID of the LedgerAccount to unlink the identity profile from.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ledger_account_id") + public _FinalStage ledgerAccountId(@NotNull String ledgerAccountId) { + this.ledgerAccountId = Objects.requireNonNull(ledgerAccountId, "ledgerAccountId must not be null"); + return this; + } + + @java.lang.Override + public UnlinkIdentityProfileRequest build() { + return new UnlinkIdentityProfileRequest(ledgerAccountId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/identityprofiles/types/ListIdentityProfileResponse.java b/src/main/java/com/whop/api/resources/identityprofiles/types/ListIdentityProfileResponse.java new file mode 100644 index 00000000..3f21bb7d --- /dev/null +++ b/src/main/java/com/whop/api/resources/identityprofiles/types/ListIdentityProfileResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.identityprofiles.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.IdentityProfileListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListIdentityProfileResponse.Builder.class) +public final class ListIdentityProfileResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListIdentityProfileResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListIdentityProfileResponse && equalTo((ListIdentityProfileResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListIdentityProfileResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListIdentityProfileResponse other); + } + + public interface _FinalStage { + ListIdentityProfileResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(IdentityProfileListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListIdentityProfileResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(IdentityProfileListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListIdentityProfileResponse build() { + return new ListIdentityProfileResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/identityprofiles/types/ListVerificationsIdentityProfileResponse.java b/src/main/java/com/whop/api/resources/identityprofiles/types/ListVerificationsIdentityProfileResponse.java new file mode 100644 index 00000000..1a47cdef --- /dev/null +++ b/src/main/java/com/whop/api/resources/identityprofiles/types/ListVerificationsIdentityProfileResponse.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.identityprofiles.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListVerificationsIdentityProfileResponse.Builder.class) +public final class ListVerificationsIdentityProfileResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListVerificationsIdentityProfileResponse( + List data, + PageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListVerificationsIdentityProfileResponse + && equalTo((ListVerificationsIdentityProfileResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListVerificationsIdentityProfileResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListVerificationsIdentityProfileResponse other); + } + + public interface _FinalStage { + ListVerificationsIdentityProfileResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(ListVerificationsIdentityProfileResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListVerificationsIdentityProfileResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(ListVerificationsIdentityProfileResponseDataItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListVerificationsIdentityProfileResponse build() { + return new ListVerificationsIdentityProfileResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/identityprofiles/types/ListVerificationsIdentityProfileResponseDataItem.java b/src/main/java/com/whop/api/resources/identityprofiles/types/ListVerificationsIdentityProfileResponseDataItem.java new file mode 100644 index 00000000..1eea49e9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/identityprofiles/types/ListVerificationsIdentityProfileResponseDataItem.java @@ -0,0 +1,422 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.identityprofiles.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.VerificationErrorCodes; +import com.whop.api.types.VerificationStatuses; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListVerificationsIdentityProfileResponseDataItem.Builder.class) +public final class ListVerificationsIdentityProfileResponseDataItem { + private final OffsetDateTime createdAt; + + private final String id; + + private final Optional lastErrorCode; + + private final Optional lastErrorReason; + + private final Optional sessionUrl; + + private final VerificationStatuses status; + + private final Map additionalProperties; + + private ListVerificationsIdentityProfileResponseDataItem( + OffsetDateTime createdAt, + String id, + Optional lastErrorCode, + Optional lastErrorReason, + Optional sessionUrl, + VerificationStatuses status, + Map additionalProperties) { + this.createdAt = createdAt; + this.id = id; + this.lastErrorCode = lastErrorCode; + this.lastErrorReason = lastErrorReason; + this.sessionUrl = sessionUrl; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the verification record was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The numeric id of the verification record. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The most recent error code returned during verification. Null if no error has occurred. + */ + @JsonIgnore + public Optional getLastErrorCode() { + if (lastErrorCode == null) { + return Optional.empty(); + } + return lastErrorCode; + } + + /** + * @return A human-readable explanation of the most recent verification error. Null if no error has occurred. + */ + @JsonIgnore + public Optional getLastErrorReason() { + if (lastErrorReason == null) { + return Optional.empty(); + } + return lastErrorReason; + } + + /** + * @return A URL the user can visit to complete the verification process. Null if the session does not require user interaction. + */ + @JsonIgnore + public Optional getSessionUrl() { + if (sessionUrl == null) { + return Optional.empty(); + } + return sessionUrl; + } + + /** + * @return The current status of this verification session. + */ + @JsonProperty("status") + public VerificationStatuses getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_error_code") + private Optional _getLastErrorCode() { + return lastErrorCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_error_reason") + private Optional _getLastErrorReason() { + return lastErrorReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("session_url") + private Optional _getSessionUrl() { + return sessionUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListVerificationsIdentityProfileResponseDataItem + && equalTo((ListVerificationsIdentityProfileResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListVerificationsIdentityProfileResponseDataItem other) { + return createdAt.equals(other.createdAt) + && id.equals(other.id) + && lastErrorCode.equals(other.lastErrorCode) + && lastErrorReason.equals(other.lastErrorReason) + && sessionUrl.equals(other.sessionUrl) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, this.id, this.lastErrorCode, this.lastErrorReason, this.sessionUrl, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the verification record was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(ListVerificationsIdentityProfileResponseDataItem other); + } + + public interface IdStage { + /** + *

The numeric id of the verification record.

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

The current status of this verification session.

+ */ + _FinalStage status(@NotNull VerificationStatuses status); + } + + public interface _FinalStage { + ListVerificationsIdentityProfileResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ */ + _FinalStage lastErrorCode(Optional lastErrorCode); + + _FinalStage lastErrorCode(VerificationErrorCodes lastErrorCode); + + _FinalStage lastErrorCode(Nullable lastErrorCode); + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ */ + _FinalStage lastErrorReason(Optional lastErrorReason); + + _FinalStage lastErrorReason(String lastErrorReason); + + _FinalStage lastErrorReason(Nullable lastErrorReason); + + /** + *

A URL the user can visit to complete the verification process. Null if the session does not require user interaction.

+ */ + _FinalStage sessionUrl(Optional sessionUrl); + + _FinalStage sessionUrl(String sessionUrl); + + _FinalStage sessionUrl(Nullable sessionUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, StatusStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private VerificationStatuses status; + + private Optional sessionUrl = Optional.empty(); + + private Optional lastErrorReason = Optional.empty(); + + private Optional lastErrorCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListVerificationsIdentityProfileResponseDataItem other) { + createdAt(other.getCreatedAt()); + id(other.getId()); + lastErrorCode(other.getLastErrorCode()); + lastErrorReason(other.getLastErrorReason()); + sessionUrl(other.getSessionUrl()); + status(other.getStatus()); + return this; + } + + /** + *

When the verification record was created.

+ *

When the verification record was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The numeric id of the verification record.

+ *

The numeric id of the verification record.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current status of this verification session.

+ *

The current status of this verification session.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull VerificationStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

A URL the user can visit to complete the verification process. Null if the session does not require user interaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sessionUrl(Nullable sessionUrl) { + if (sessionUrl.isNull()) { + this.sessionUrl = null; + } else if (sessionUrl.isEmpty()) { + this.sessionUrl = Optional.empty(); + } else { + this.sessionUrl = Optional.of(sessionUrl.get()); + } + return this; + } + + /** + *

A URL the user can visit to complete the verification process. Null if the session does not require user interaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sessionUrl(String sessionUrl) { + this.sessionUrl = Optional.ofNullable(sessionUrl); + return this; + } + + /** + *

A URL the user can visit to complete the verification process. Null if the session does not require user interaction.

+ */ + @java.lang.Override + @JsonSetter(value = "session_url", nulls = Nulls.SKIP) + public _FinalStage sessionUrl(Optional sessionUrl) { + this.sessionUrl = sessionUrl; + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorReason(Nullable lastErrorReason) { + if (lastErrorReason.isNull()) { + this.lastErrorReason = null; + } else if (lastErrorReason.isEmpty()) { + this.lastErrorReason = Optional.empty(); + } else { + this.lastErrorReason = Optional.of(lastErrorReason.get()); + } + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorReason(String lastErrorReason) { + this.lastErrorReason = Optional.ofNullable(lastErrorReason); + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "last_error_reason", nulls = Nulls.SKIP) + public _FinalStage lastErrorReason(Optional lastErrorReason) { + this.lastErrorReason = lastErrorReason; + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorCode(Nullable lastErrorCode) { + if (lastErrorCode.isNull()) { + this.lastErrorCode = null; + } else if (lastErrorCode.isEmpty()) { + this.lastErrorCode = Optional.empty(); + } else { + this.lastErrorCode = Optional.of(lastErrorCode.get()); + } + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorCode(VerificationErrorCodes lastErrorCode) { + this.lastErrorCode = Optional.ofNullable(lastErrorCode); + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "last_error_code", nulls = Nulls.SKIP) + public _FinalStage lastErrorCode(Optional lastErrorCode) { + this.lastErrorCode = lastErrorCode; + return this; + } + + @java.lang.Override + public ListVerificationsIdentityProfileResponseDataItem build() { + return new ListVerificationsIdentityProfileResponseDataItem( + createdAt, id, lastErrorCode, lastErrorReason, sessionUrl, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/AsyncInvoicesClient.java b/src/main/java/com/whop/api/resources/invoices/AsyncInvoicesClient.java new file mode 100644 index 00000000..bfb9a519 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/AsyncInvoicesClient.java @@ -0,0 +1,446 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.invoices.requests.DeleteInvoicesRequest; +import com.whop.api.resources.invoices.requests.ListInvoicesRequest; +import com.whop.api.resources.invoices.requests.MarkPaidInvoicesRequest; +import com.whop.api.resources.invoices.requests.MarkUncollectibleInvoicesRequest; +import com.whop.api.resources.invoices.requests.ResendInvoicesRequest; +import com.whop.api.resources.invoices.requests.RetrieveInvoicesRequest; +import com.whop.api.resources.invoices.requests.UpdateInvoicesRequest; +import com.whop.api.resources.invoices.requests.VoidInvoicesRequest; +import com.whop.api.resources.invoices.types.CreateInvoicesRequest; +import com.whop.api.types.Invoice; +import com.whop.api.types.InvoiceListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncInvoicesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawInvoicesClient rawClient; + + public AsyncInvoicesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawInvoicesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawInvoicesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public CompletableFuture> list(ListInvoicesRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public CompletableFuture> list( + ListInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create an invoice for a customer. The invoice can be charged automatically using a stored payment method, or sent to the customer for manual payment. + *

Required permissions:

+ *
    + *
  • invoice:create
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture create(CreateInvoicesRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create an invoice for a customer. The invoice can be charged automatically using a stored payment method, or sent to the customer for manual payment. + *

Required permissions:

+ *
    + *
  • invoice:create
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture create(CreateInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveInvoicesRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture delete(String id, DeleteInvoicesRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture delete(String id, DeleteInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture update(String id, UpdateInvoicesRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture update(String id, UpdateInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture markPaid(String id) { + return this.rawClient.markPaid(id).thenApply(response -> response.body()); + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture markPaid(String id, RequestOptions requestOptions) { + return this.rawClient.markPaid(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture markPaid(String id, MarkPaidInvoicesRequest request) { + return this.rawClient.markPaid(id, request).thenApply(response -> response.body()); + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture markPaid( + String id, MarkPaidInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.markPaid(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture markUncollectible(String id) { + return this.rawClient.markUncollectible(id).thenApply(response -> response.body()); + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture markUncollectible(String id, RequestOptions requestOptions) { + return this.rawClient.markUncollectible(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture markUncollectible(String id, MarkUncollectibleInvoicesRequest request) { + return this.rawClient.markUncollectible(id, request).thenApply(response -> response.body()); + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture markUncollectible( + String id, MarkUncollectibleInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.markUncollectible(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture resend(String id) { + return this.rawClient.resend(id).thenApply(response -> response.body()); + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture resend(String id, RequestOptions requestOptions) { + return this.rawClient.resend(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture resend(String id, ResendInvoicesRequest request) { + return this.rawClient.resend(id, request).thenApply(response -> response.body()); + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture resend(String id, ResendInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.resend(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture void_(String id) { + return this.rawClient.void_(id).thenApply(response -> response.body()); + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture void_(String id, RequestOptions requestOptions) { + return this.rawClient.void_(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture void_(String id, VoidInvoicesRequest request) { + return this.rawClient.void_(id, request).thenApply(response -> response.body()); + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture void_(String id, VoidInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.void_(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/AsyncRawInvoicesClient.java b/src/main/java/com/whop/api/resources/invoices/AsyncRawInvoicesClient.java new file mode 100644 index 00000000..484cf39a --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/AsyncRawInvoicesClient.java @@ -0,0 +1,1326 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.invoices.requests.DeleteInvoicesRequest; +import com.whop.api.resources.invoices.requests.ListInvoicesRequest; +import com.whop.api.resources.invoices.requests.MarkPaidInvoicesRequest; +import com.whop.api.resources.invoices.requests.MarkUncollectibleInvoicesRequest; +import com.whop.api.resources.invoices.requests.ResendInvoicesRequest; +import com.whop.api.resources.invoices.requests.RetrieveInvoicesRequest; +import com.whop.api.resources.invoices.requests.UpdateInvoicesRequest; +import com.whop.api.resources.invoices.requests.VoidInvoicesRequest; +import com.whop.api.resources.invoices.types.CreateInvoicesRequest; +import com.whop.api.resources.invoices.types.ListInvoicesResponse; +import com.whop.api.types.Invoice; +import com.whop.api.types.InvoiceListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawInvoicesClient { + protected final ClientOptions clientOptions; + + public AsyncRawInvoicesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public CompletableFuture>> list() { + return list(ListInvoicesRequest.builder().build()); + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public CompletableFuture>> list( + ListInvoicesRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public CompletableFuture>> list( + ListInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } + if (request.getCollectionMethods().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "collection_methods", + request.getCollectionMethods().get(), + true); + } + if (request.getStatuses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "statuses", request.getStatuses().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListInvoicesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListInvoicesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListInvoicesRequest nextRequest = ListInvoicesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create an invoice for a customer. The invoice can be charged automatically using a stored payment method, or sent to the customer for manual payment. + *

Required permissions:

+ *
    + *
  • invoice:create
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> create(CreateInvoicesRequest request) { + return create(request, null); + } + + /** + * Create an invoice for a customer. The invoice can be charged automatically using a stored payment method, or sent to the customer for manual payment. + *

Required permissions:

+ *
    + *
  • invoice:create
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> create( + CreateInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Invoice.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveInvoicesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RetrieveInvoicesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Invoice.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteInvoicesRequest.builder().build()); + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> delete(String id, DeleteInvoicesRequest request) { + return delete(id, request, null); + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> delete( + String id, DeleteInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> update(String id) { + return update(id, UpdateInvoicesRequest.builder().build()); + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> update(String id, UpdateInvoicesRequest request) { + return update(id, request, null); + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> update( + String id, UpdateInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Invoice.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> markPaid(String id) { + return markPaid(id, MarkPaidInvoicesRequest.builder().build()); + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> markPaid(String id, RequestOptions requestOptions) { + return markPaid(id, MarkPaidInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> markPaid(String id, MarkPaidInvoicesRequest request) { + return markPaid(id, request, null); + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> markPaid( + String id, MarkPaidInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices") + .addPathSegment(id) + .addPathSegments("mark_paid"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> markUncollectible(String id) { + return markUncollectible(id, MarkUncollectibleInvoicesRequest.builder().build()); + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> markUncollectible(String id, RequestOptions requestOptions) { + return markUncollectible(id, MarkUncollectibleInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> markUncollectible( + String id, MarkUncollectibleInvoicesRequest request) { + return markUncollectible(id, request, null); + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> markUncollectible( + String id, MarkUncollectibleInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices") + .addPathSegment(id) + .addPathSegments("mark_uncollectible"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> resend(String id) { + return resend(id, ResendInvoicesRequest.builder().build()); + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> resend(String id, RequestOptions requestOptions) { + return resend(id, ResendInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> resend(String id, ResendInvoicesRequest request) { + return resend(id, request, null); + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> resend( + String id, ResendInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices") + .addPathSegment(id) + .addPathSegments("resend"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> void_(String id) { + return void_(id, VoidInvoicesRequest.builder().build()); + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> void_(String id, RequestOptions requestOptions) { + return void_(id, VoidInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> void_(String id, VoidInvoicesRequest request) { + return void_(id, request, null); + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public CompletableFuture> void_( + String id, VoidInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices") + .addPathSegment(id) + .addPathSegments("void"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/InvoicesClient.java b/src/main/java/com/whop/api/resources/invoices/InvoicesClient.java new file mode 100644 index 00000000..e1b81741 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/InvoicesClient.java @@ -0,0 +1,442 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.invoices.requests.DeleteInvoicesRequest; +import com.whop.api.resources.invoices.requests.ListInvoicesRequest; +import com.whop.api.resources.invoices.requests.MarkPaidInvoicesRequest; +import com.whop.api.resources.invoices.requests.MarkUncollectibleInvoicesRequest; +import com.whop.api.resources.invoices.requests.ResendInvoicesRequest; +import com.whop.api.resources.invoices.requests.RetrieveInvoicesRequest; +import com.whop.api.resources.invoices.requests.UpdateInvoicesRequest; +import com.whop.api.resources.invoices.requests.VoidInvoicesRequest; +import com.whop.api.resources.invoices.types.CreateInvoicesRequest; +import com.whop.api.types.Invoice; +import com.whop.api.types.InvoiceListItem; + +public class InvoicesClient { + protected final ClientOptions clientOptions; + + private final RawInvoicesClient rawClient; + + public InvoicesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawInvoicesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawInvoicesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public SyncPagingIterable list(ListInvoicesRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public SyncPagingIterable list(ListInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Create an invoice for a customer. The invoice can be charged automatically using a stored payment method, or sent to the customer for manual payment. + *

Required permissions:

+ *
    + *
  • invoice:create
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public Invoice create(CreateInvoicesRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Create an invoice for a customer. The invoice can be charged automatically using a stored payment method, or sent to the customer for manual payment. + *

Required permissions:

+ *
    + *
  • invoice:create
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public Invoice create(CreateInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public Invoice retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public Invoice retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public Invoice retrieve(String id, RetrieveInvoicesRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public Invoice retrieve(String id, RetrieveInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean delete(String id, DeleteInvoicesRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean delete(String id, DeleteInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public Invoice update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public Invoice update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public Invoice update(String id, UpdateInvoicesRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public Invoice update(String id, UpdateInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean markPaid(String id) { + return this.rawClient.markPaid(id).body(); + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean markPaid(String id, RequestOptions requestOptions) { + return this.rawClient.markPaid(id, requestOptions).body(); + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean markPaid(String id, MarkPaidInvoicesRequest request) { + return this.rawClient.markPaid(id, request).body(); + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean markPaid(String id, MarkPaidInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.markPaid(id, request, requestOptions).body(); + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean markUncollectible(String id) { + return this.rawClient.markUncollectible(id).body(); + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean markUncollectible(String id, RequestOptions requestOptions) { + return this.rawClient.markUncollectible(id, requestOptions).body(); + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean markUncollectible(String id, MarkUncollectibleInvoicesRequest request) { + return this.rawClient.markUncollectible(id, request).body(); + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean markUncollectible( + String id, MarkUncollectibleInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.markUncollectible(id, request, requestOptions).body(); + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean resend(String id) { + return this.rawClient.resend(id).body(); + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean resend(String id, RequestOptions requestOptions) { + return this.rawClient.resend(id, requestOptions).body(); + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean resend(String id, ResendInvoicesRequest request) { + return this.rawClient.resend(id, request).body(); + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean resend(String id, ResendInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.resend(id, request, requestOptions).body(); + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean void_(String id) { + return this.rawClient.void_(id).body(); + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean void_(String id, RequestOptions requestOptions) { + return this.rawClient.void_(id, requestOptions).body(); + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean void_(String id, VoidInvoicesRequest request) { + return this.rawClient.void_(id, request).body(); + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public boolean void_(String id, VoidInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.void_(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/RawInvoicesClient.java b/src/main/java/com/whop/api/resources/invoices/RawInvoicesClient.java new file mode 100644 index 00000000..4e1f87a8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/RawInvoicesClient.java @@ -0,0 +1,1065 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.invoices.requests.DeleteInvoicesRequest; +import com.whop.api.resources.invoices.requests.ListInvoicesRequest; +import com.whop.api.resources.invoices.requests.MarkPaidInvoicesRequest; +import com.whop.api.resources.invoices.requests.MarkUncollectibleInvoicesRequest; +import com.whop.api.resources.invoices.requests.ResendInvoicesRequest; +import com.whop.api.resources.invoices.requests.RetrieveInvoicesRequest; +import com.whop.api.resources.invoices.requests.UpdateInvoicesRequest; +import com.whop.api.resources.invoices.requests.VoidInvoicesRequest; +import com.whop.api.resources.invoices.types.CreateInvoicesRequest; +import com.whop.api.resources.invoices.types.ListInvoicesResponse; +import com.whop.api.types.Invoice; +import com.whop.api.types.InvoiceListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawInvoicesClient { + protected final ClientOptions clientOptions; + + public RawInvoicesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list() { + return list(ListInvoicesRequest.builder().build()); + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListInvoicesRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of invoices for a company, with optional filtering by product, status, collection method, and creation date. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } + if (request.getCollectionMethods().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "collection_methods", + request.getCollectionMethods().get(), + true); + } + if (request.getStatuses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "statuses", request.getStatuses().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListInvoicesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListInvoicesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListInvoicesRequest nextRequest = ListInvoicesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Create an invoice for a customer. The invoice can be charged automatically using a stored payment method, or sent to the customer for manual payment. + *

Required permissions:

+ *
    + *
  • invoice:create
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse create(CreateInvoicesRequest request) { + return create(request, null); + } + + /** + * Create an invoice for a customer. The invoice can be charged automatically using a stored payment method, or sent to the customer for manual payment. + *

Required permissions:

+ *
    + *
  • invoice:create
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse create(CreateInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Invoice.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveInvoicesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveInvoicesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing invoice. + *

Required permissions:

+ *
    + *
  • invoice:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Invoice.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteInvoicesRequest.builder().build()); + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse delete(String id, DeleteInvoicesRequest request) { + return delete(id, request, null); + } + + /** + * Delete a draft invoice. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse delete( + String id, DeleteInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateInvoicesRequest.builder().build()); + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateInvoicesRequest request) { + return update(id, request, null); + } + + /** + * Update a draft invoice's details. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse update( + String id, UpdateInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Invoice.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse markPaid(String id) { + return markPaid(id, MarkPaidInvoicesRequest.builder().build()); + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse markPaid(String id, RequestOptions requestOptions) { + return markPaid(id, MarkPaidInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse markPaid(String id, MarkPaidInvoicesRequest request) { + return markPaid(id, request, null); + } + + /** + * Mark an open invoice as paid when payment was collected outside of Whop. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse markPaid( + String id, MarkPaidInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices") + .addPathSegment(id) + .addPathSegments("mark_paid"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse markUncollectible(String id) { + return markUncollectible(id, MarkUncollectibleInvoicesRequest.builder().build()); + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse markUncollectible(String id, RequestOptions requestOptions) { + return markUncollectible(id, MarkUncollectibleInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse markUncollectible(String id, MarkUncollectibleInvoicesRequest request) { + return markUncollectible(id, request, null); + } + + /** + * Mark an open invoice as uncollectible when payment is not expected. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse markUncollectible( + String id, MarkUncollectibleInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices") + .addPathSegment(id) + .addPathSegments("mark_uncollectible"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse resend(String id) { + return resend(id, ResendInvoicesRequest.builder().build()); + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse resend(String id, RequestOptions requestOptions) { + return resend(id, ResendInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse resend(String id, ResendInvoicesRequest request) { + return resend(id, request, null); + } + + /** + * Resend the notification email for an existing invoice to the customer. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse resend( + String id, ResendInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices") + .addPathSegment(id) + .addPathSegments("resend"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse void_(String id) { + return void_(id, VoidInvoicesRequest.builder().build()); + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse void_(String id, RequestOptions requestOptions) { + return void_(id, VoidInvoicesRequest.builder().build(), requestOptions); + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse void_(String id, VoidInvoicesRequest request) { + return void_(id, request, null); + } + + /** + * Void an open invoice so it can no longer be paid. Voiding is permanent and cannot be undone. + *

Required permissions:

+ *
    + *
  • invoice:update
  • + *
+ */ + public WhopApiHttpResponse void_(String id, VoidInvoicesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("invoices") + .addPathSegment(id) + .addPathSegments("void"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/requests/DeleteInvoicesRequest.java b/src/main/java/com/whop/api/resources/invoices/requests/DeleteInvoicesRequest.java new file mode 100644 index 00000000..7dd759ec --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/requests/DeleteInvoicesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteInvoicesRequest.Builder.class) +public final class DeleteInvoicesRequest { + private final Map additionalProperties; + + private DeleteInvoicesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteInvoicesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteInvoicesRequest other) { + return this; + } + + public DeleteInvoicesRequest build() { + return new DeleteInvoicesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/requests/ListInvoicesRequest.java b/src/main/java/com/whop/api/resources/invoices/requests/ListInvoicesRequest.java new file mode 100644 index 00000000..7649d8d1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/requests/ListInvoicesRequest.java @@ -0,0 +1,478 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Direction; +import com.whop.api.types.InvoiceCollectionMethods; +import com.whop.api.types.InvoiceStatuses; +import com.whop.api.types.InvoicesSortableColumns; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListInvoicesRequest.Builder.class) +public final class ListInvoicesRequest { + private final Optional> productIds; + + private final Optional> collectionMethods; + + private final Optional> statuses; + + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Optional companyId; + + private final Optional direction; + + private final Optional order; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Map additionalProperties; + + private ListInvoicesRequest( + Optional> productIds, + Optional> collectionMethods, + Optional> statuses, + Optional after, + Optional before, + Optional first, + Optional last, + Optional companyId, + Optional direction, + Optional order, + Optional createdBefore, + Optional createdAfter, + Map additionalProperties) { + this.productIds = productIds; + this.collectionMethods = collectionMethods; + this.statuses = statuses; + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.direction = direction; + this.order = order; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.additionalProperties = additionalProperties; + } + + /** + * @return Filter invoices to only those associated with these specific product identifiers. + */ + @JsonProperty("product_ids") + public Optional> getProductIds() { + return productIds; + } + + /** + * @return Filter invoices by their collection method. + */ + @JsonProperty("collection_methods") + public Optional> getCollectionMethods() { + return collectionMethods; + } + + /** + * @return Filter invoices by their current status. + */ + @JsonProperty("statuses") + public Optional> getStatuses() { + return statuses; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to list invoices for. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Only return invoices created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return invoices created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListInvoicesRequest && equalTo((ListInvoicesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListInvoicesRequest other) { + return productIds.equals(other.productIds) + && collectionMethods.equals(other.collectionMethods) + && statuses.equals(other.statuses) + && after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId) + && direction.equals(other.direction) + && order.equals(other.order) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.productIds, + this.collectionMethods, + this.statuses, + this.after, + this.before, + this.first, + this.last, + this.companyId, + this.direction, + this.order, + this.createdBefore, + this.createdAfter); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> productIds = Optional.empty(); + + private Optional> collectionMethods = Optional.empty(); + + private Optional> statuses = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional companyId = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListInvoicesRequest other) { + productIds(other.getProductIds()); + collectionMethods(other.getCollectionMethods()); + statuses(other.getStatuses()); + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + direction(other.getDirection()); + order(other.getOrder()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + return this; + } + + /** + *

Filter invoices to only those associated with these specific product identifiers.

+ */ + @JsonSetter(value = "product_ids", nulls = Nulls.SKIP) + public Builder productIds(Optional> productIds) { + this.productIds = productIds; + return this; + } + + public Builder productIds(List productIds) { + this.productIds = Optional.ofNullable(productIds); + return this; + } + + public Builder productIds(String productIds) { + this.productIds = Optional.of(Collections.singletonList(productIds)); + return this; + } + + /** + *

Filter invoices by their collection method.

+ */ + @JsonSetter(value = "collection_methods", nulls = Nulls.SKIP) + public Builder collectionMethods(Optional> collectionMethods) { + this.collectionMethods = collectionMethods; + return this; + } + + public Builder collectionMethods(List collectionMethods) { + this.collectionMethods = Optional.ofNullable(collectionMethods); + return this; + } + + public Builder collectionMethods(InvoiceCollectionMethods collectionMethods) { + this.collectionMethods = Optional.of(Collections.singletonList(collectionMethods)); + return this; + } + + /** + *

Filter invoices by their current status.

+ */ + @JsonSetter(value = "statuses", nulls = Nulls.SKIP) + public Builder statuses(Optional> statuses) { + this.statuses = statuses; + return this; + } + + public Builder statuses(List statuses) { + this.statuses = Optional.ofNullable(statuses); + return this; + } + + public Builder statuses(InvoiceStatuses statuses) { + this.statuses = Optional.of(Collections.singletonList(statuses)); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The unique identifier of the company to list invoices for.

+ */ + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(Direction direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(InvoicesSortableColumns order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Only return invoices created before this timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return invoices created after this timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + public ListInvoicesRequest build() { + return new ListInvoicesRequest( + productIds, + collectionMethods, + statuses, + after, + before, + first, + last, + companyId, + direction, + order, + createdBefore, + createdAfter, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/requests/MarkPaidInvoicesRequest.java b/src/main/java/com/whop/api/resources/invoices/requests/MarkPaidInvoicesRequest.java new file mode 100644 index 00000000..9d225ad5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/requests/MarkPaidInvoicesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MarkPaidInvoicesRequest.Builder.class) +public final class MarkPaidInvoicesRequest { + private final Map additionalProperties; + + private MarkPaidInvoicesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MarkPaidInvoicesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MarkPaidInvoicesRequest other) { + return this; + } + + public MarkPaidInvoicesRequest build() { + return new MarkPaidInvoicesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/requests/MarkUncollectibleInvoicesRequest.java b/src/main/java/com/whop/api/resources/invoices/requests/MarkUncollectibleInvoicesRequest.java new file mode 100644 index 00000000..e3af9e06 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/requests/MarkUncollectibleInvoicesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MarkUncollectibleInvoicesRequest.Builder.class) +public final class MarkUncollectibleInvoicesRequest { + private final Map additionalProperties; + + private MarkUncollectibleInvoicesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MarkUncollectibleInvoicesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MarkUncollectibleInvoicesRequest other) { + return this; + } + + public MarkUncollectibleInvoicesRequest build() { + return new MarkUncollectibleInvoicesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/requests/ResendInvoicesRequest.java b/src/main/java/com/whop/api/resources/invoices/requests/ResendInvoicesRequest.java new file mode 100644 index 00000000..d091f323 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/requests/ResendInvoicesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ResendInvoicesRequest.Builder.class) +public final class ResendInvoicesRequest { + private final Map additionalProperties; + + private ResendInvoicesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ResendInvoicesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ResendInvoicesRequest other) { + return this; + } + + public ResendInvoicesRequest build() { + return new ResendInvoicesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/requests/RetrieveInvoicesRequest.java b/src/main/java/com/whop/api/resources/invoices/requests/RetrieveInvoicesRequest.java new file mode 100644 index 00000000..9fbd23e2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/requests/RetrieveInvoicesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveInvoicesRequest.Builder.class) +public final class RetrieveInvoicesRequest { + private final Map additionalProperties; + + private RetrieveInvoicesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveInvoicesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveInvoicesRequest other) { + return this; + } + + public RetrieveInvoicesRequest build() { + return new RetrieveInvoicesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/requests/UpdateInvoicesRequest.java b/src/main/java/com/whop/api/resources/invoices/requests/UpdateInvoicesRequest.java new file mode 100644 index 00000000..29332abc --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/requests/UpdateInvoicesRequest.java @@ -0,0 +1,821 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.invoices.types.UpdateInvoicesRequestBillingAddress; +import com.whop.api.resources.invoices.types.UpdateInvoicesRequestLineItemsItem; +import com.whop.api.resources.invoices.types.UpdateInvoicesRequestPlan; +import com.whop.api.types.InvoiceCollectionMethods; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateInvoicesRequest.Builder.class) +public final class UpdateInvoicesRequest { + private final Optional automaticallyFinalizesAt; + + private final Optional billingAddress; + + private final Optional chargeBuyerFee; + + private final Optional collectionMethod; + + private final Optional customerName; + + private final Optional dueDate; + + private final Optional emailAddress; + + private final Optional> lineItems; + + private final Optional mailingAddressId; + + private final Optional memberId; + + private final Optional paymentMethodId; + + private final Optional plan; + + private final Optional productId; + + private final Optional subscriptionBillingAnchorAt; + + private final Map additionalProperties; + + private UpdateInvoicesRequest( + Optional automaticallyFinalizesAt, + Optional billingAddress, + Optional chargeBuyerFee, + Optional collectionMethod, + Optional customerName, + Optional dueDate, + Optional emailAddress, + Optional> lineItems, + Optional mailingAddressId, + Optional memberId, + Optional paymentMethodId, + Optional plan, + Optional productId, + Optional subscriptionBillingAnchorAt, + Map additionalProperties) { + this.automaticallyFinalizesAt = automaticallyFinalizesAt; + this.billingAddress = billingAddress; + this.chargeBuyerFee = chargeBuyerFee; + this.collectionMethod = collectionMethod; + this.customerName = customerName; + this.dueDate = dueDate; + this.emailAddress = emailAddress; + this.lineItems = lineItems; + this.mailingAddressId = mailingAddressId; + this.memberId = memberId; + this.paymentMethodId = paymentMethodId; + this.plan = plan; + this.productId = productId; + this.subscriptionBillingAnchorAt = subscriptionBillingAnchorAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email at the specified time. + */ + @JsonIgnore + public Optional getAutomaticallyFinalizesAt() { + if (automaticallyFinalizesAt == null) { + return Optional.empty(); + } + return automaticallyFinalizesAt; + } + + /** + * @return Inline billing address to create or update a mailing address for this invoice. + */ + @JsonIgnore + public Optional getBillingAddress() { + if (billingAddress == null) { + return Optional.empty(); + } + return billingAddress; + } + + /** + * @return Whether to charge the customer a buyer fee on this invoice. + */ + @JsonIgnore + public Optional getChargeBuyerFee() { + if (chargeBuyerFee == null) { + return Optional.empty(); + } + return chargeBuyerFee; + } + + /** + * @return How the invoice should be collected. + */ + @JsonIgnore + public Optional getCollectionMethod() { + if (collectionMethod == null) { + return Optional.empty(); + } + return collectionMethod; + } + + /** + * @return The name of the customer. + */ + @JsonIgnore + public Optional getCustomerName() { + if (customerName == null) { + return Optional.empty(); + } + return customerName; + } + + /** + * @return The date by which the invoice must be paid. + */ + @JsonIgnore + public Optional getDueDate() { + if (dueDate == null) { + return Optional.empty(); + } + return dueDate; + } + + /** + * @return The email address of the customer. + */ + @JsonIgnore + public Optional getEmailAddress() { + if (emailAddress == null) { + return Optional.empty(); + } + return emailAddress; + } + + /** + * @return Line items that break down the invoice total. + */ + @JsonIgnore + public Optional> getLineItems() { + if (lineItems == null) { + return Optional.empty(); + } + return lineItems; + } + + /** + * @return The unique identifier of an existing mailing address to attach. + */ + @JsonIgnore + public Optional getMailingAddressId() { + if (mailingAddressId == null) { + return Optional.empty(); + } + return mailingAddressId; + } + + /** + * @return The unique identifier of a member to assign as the customer. + */ + @JsonIgnore + public Optional getMemberId() { + if (memberId == null) { + return Optional.empty(); + } + return memberId; + } + + /** + * @return The unique identifier of the payment method to charge. + */ + @JsonIgnore + public Optional getPaymentMethodId() { + if (paymentMethodId == null) { + return Optional.empty(); + } + return paymentMethodId; + } + + /** + * @return Updated plan attributes. + */ + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + /** + * @return The unique identifier of an existing product to attach to this invoice. Only allowed while the invoice is still a draft. + */ + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + /** + * @return The date that defines when the subscription billing cycle should start. + */ + @JsonIgnore + public Optional getSubscriptionBillingAnchorAt() { + if (subscriptionBillingAnchorAt == null) { + return Optional.empty(); + } + return subscriptionBillingAnchorAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("automatically_finalizes_at") + private Optional _getAutomaticallyFinalizesAt() { + return automaticallyFinalizesAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_address") + private Optional _getBillingAddress() { + return billingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("charge_buyer_fee") + private Optional _getChargeBuyerFee() { + return chargeBuyerFee; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("collection_method") + private Optional _getCollectionMethod() { + return collectionMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_name") + private Optional _getCustomerName() { + return customerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("due_date") + private Optional _getDueDate() { + return dueDate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email_address") + private Optional _getEmailAddress() { + return emailAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line_items") + private Optional> _getLineItems() { + return lineItems; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("mailing_address_id") + private Optional _getMailingAddressId() { + return mailingAddressId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member_id") + private Optional _getMemberId() { + return memberId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_id") + private Optional _getPaymentMethodId() { + return paymentMethodId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("subscription_billing_anchor_at") + private Optional _getSubscriptionBillingAnchorAt() { + return subscriptionBillingAnchorAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateInvoicesRequest && equalTo((UpdateInvoicesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateInvoicesRequest other) { + return automaticallyFinalizesAt.equals(other.automaticallyFinalizesAt) + && billingAddress.equals(other.billingAddress) + && chargeBuyerFee.equals(other.chargeBuyerFee) + && collectionMethod.equals(other.collectionMethod) + && customerName.equals(other.customerName) + && dueDate.equals(other.dueDate) + && emailAddress.equals(other.emailAddress) + && lineItems.equals(other.lineItems) + && mailingAddressId.equals(other.mailingAddressId) + && memberId.equals(other.memberId) + && paymentMethodId.equals(other.paymentMethodId) + && plan.equals(other.plan) + && productId.equals(other.productId) + && subscriptionBillingAnchorAt.equals(other.subscriptionBillingAnchorAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.automaticallyFinalizesAt, + this.billingAddress, + this.chargeBuyerFee, + this.collectionMethod, + this.customerName, + this.dueDate, + this.emailAddress, + this.lineItems, + this.mailingAddressId, + this.memberId, + this.paymentMethodId, + this.plan, + this.productId, + this.subscriptionBillingAnchorAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional automaticallyFinalizesAt = Optional.empty(); + + private Optional billingAddress = Optional.empty(); + + private Optional chargeBuyerFee = Optional.empty(); + + private Optional collectionMethod = Optional.empty(); + + private Optional customerName = Optional.empty(); + + private Optional dueDate = Optional.empty(); + + private Optional emailAddress = Optional.empty(); + + private Optional> lineItems = Optional.empty(); + + private Optional mailingAddressId = Optional.empty(); + + private Optional memberId = Optional.empty(); + + private Optional paymentMethodId = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional subscriptionBillingAnchorAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateInvoicesRequest other) { + automaticallyFinalizesAt(other.getAutomaticallyFinalizesAt()); + billingAddress(other.getBillingAddress()); + chargeBuyerFee(other.getChargeBuyerFee()); + collectionMethod(other.getCollectionMethod()); + customerName(other.getCustomerName()); + dueDate(other.getDueDate()); + emailAddress(other.getEmailAddress()); + lineItems(other.getLineItems()); + mailingAddressId(other.getMailingAddressId()); + memberId(other.getMemberId()); + paymentMethodId(other.getPaymentMethodId()); + plan(other.getPlan()); + productId(other.getProductId()); + subscriptionBillingAnchorAt(other.getSubscriptionBillingAnchorAt()); + return this; + } + + /** + *

The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email at the specified time.

+ */ + @JsonSetter(value = "automatically_finalizes_at", nulls = Nulls.SKIP) + public Builder automaticallyFinalizesAt(Optional automaticallyFinalizesAt) { + this.automaticallyFinalizesAt = automaticallyFinalizesAt; + return this; + } + + public Builder automaticallyFinalizesAt(OffsetDateTime automaticallyFinalizesAt) { + this.automaticallyFinalizesAt = Optional.ofNullable(automaticallyFinalizesAt); + return this; + } + + public Builder automaticallyFinalizesAt(Nullable automaticallyFinalizesAt) { + if (automaticallyFinalizesAt.isNull()) { + this.automaticallyFinalizesAt = null; + } else if (automaticallyFinalizesAt.isEmpty()) { + this.automaticallyFinalizesAt = Optional.empty(); + } else { + this.automaticallyFinalizesAt = Optional.of(automaticallyFinalizesAt.get()); + } + return this; + } + + /** + *

Inline billing address to create or update a mailing address for this invoice.

+ */ + @JsonSetter(value = "billing_address", nulls = Nulls.SKIP) + public Builder billingAddress(Optional billingAddress) { + this.billingAddress = billingAddress; + return this; + } + + public Builder billingAddress(UpdateInvoicesRequestBillingAddress billingAddress) { + this.billingAddress = Optional.ofNullable(billingAddress); + return this; + } + + public Builder billingAddress(Nullable billingAddress) { + if (billingAddress.isNull()) { + this.billingAddress = null; + } else if (billingAddress.isEmpty()) { + this.billingAddress = Optional.empty(); + } else { + this.billingAddress = Optional.of(billingAddress.get()); + } + return this; + } + + /** + *

Whether to charge the customer a buyer fee on this invoice.

+ */ + @JsonSetter(value = "charge_buyer_fee", nulls = Nulls.SKIP) + public Builder chargeBuyerFee(Optional chargeBuyerFee) { + this.chargeBuyerFee = chargeBuyerFee; + return this; + } + + public Builder chargeBuyerFee(Boolean chargeBuyerFee) { + this.chargeBuyerFee = Optional.ofNullable(chargeBuyerFee); + return this; + } + + public Builder chargeBuyerFee(Nullable chargeBuyerFee) { + if (chargeBuyerFee.isNull()) { + this.chargeBuyerFee = null; + } else if (chargeBuyerFee.isEmpty()) { + this.chargeBuyerFee = Optional.empty(); + } else { + this.chargeBuyerFee = Optional.of(chargeBuyerFee.get()); + } + return this; + } + + /** + *

How the invoice should be collected.

+ */ + @JsonSetter(value = "collection_method", nulls = Nulls.SKIP) + public Builder collectionMethod(Optional collectionMethod) { + this.collectionMethod = collectionMethod; + return this; + } + + public Builder collectionMethod(InvoiceCollectionMethods collectionMethod) { + this.collectionMethod = Optional.ofNullable(collectionMethod); + return this; + } + + public Builder collectionMethod(Nullable collectionMethod) { + if (collectionMethod.isNull()) { + this.collectionMethod = null; + } else if (collectionMethod.isEmpty()) { + this.collectionMethod = Optional.empty(); + } else { + this.collectionMethod = Optional.of(collectionMethod.get()); + } + return this; + } + + /** + *

The name of the customer.

+ */ + @JsonSetter(value = "customer_name", nulls = Nulls.SKIP) + public Builder customerName(Optional customerName) { + this.customerName = customerName; + return this; + } + + public Builder customerName(String customerName) { + this.customerName = Optional.ofNullable(customerName); + return this; + } + + public Builder customerName(Nullable customerName) { + if (customerName.isNull()) { + this.customerName = null; + } else if (customerName.isEmpty()) { + this.customerName = Optional.empty(); + } else { + this.customerName = Optional.of(customerName.get()); + } + return this; + } + + /** + *

The date by which the invoice must be paid.

+ */ + @JsonSetter(value = "due_date", nulls = Nulls.SKIP) + public Builder dueDate(Optional dueDate) { + this.dueDate = dueDate; + return this; + } + + public Builder dueDate(OffsetDateTime dueDate) { + this.dueDate = Optional.ofNullable(dueDate); + return this; + } + + public Builder dueDate(Nullable dueDate) { + if (dueDate.isNull()) { + this.dueDate = null; + } else if (dueDate.isEmpty()) { + this.dueDate = Optional.empty(); + } else { + this.dueDate = Optional.of(dueDate.get()); + } + return this; + } + + /** + *

The email address of the customer.

+ */ + @JsonSetter(value = "email_address", nulls = Nulls.SKIP) + public Builder emailAddress(Optional emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + public Builder emailAddress(String emailAddress) { + this.emailAddress = Optional.ofNullable(emailAddress); + return this; + } + + public Builder emailAddress(Nullable emailAddress) { + if (emailAddress.isNull()) { + this.emailAddress = null; + } else if (emailAddress.isEmpty()) { + this.emailAddress = Optional.empty(); + } else { + this.emailAddress = Optional.of(emailAddress.get()); + } + return this; + } + + /** + *

Line items that break down the invoice total.

+ */ + @JsonSetter(value = "line_items", nulls = Nulls.SKIP) + public Builder lineItems(Optional> lineItems) { + this.lineItems = lineItems; + return this; + } + + public Builder lineItems(List lineItems) { + this.lineItems = Optional.ofNullable(lineItems); + return this; + } + + public Builder lineItems(Nullable> lineItems) { + if (lineItems.isNull()) { + this.lineItems = null; + } else if (lineItems.isEmpty()) { + this.lineItems = Optional.empty(); + } else { + this.lineItems = Optional.of(lineItems.get()); + } + return this; + } + + /** + *

The unique identifier of an existing mailing address to attach.

+ */ + @JsonSetter(value = "mailing_address_id", nulls = Nulls.SKIP) + public Builder mailingAddressId(Optional mailingAddressId) { + this.mailingAddressId = mailingAddressId; + return this; + } + + public Builder mailingAddressId(String mailingAddressId) { + this.mailingAddressId = Optional.ofNullable(mailingAddressId); + return this; + } + + public Builder mailingAddressId(Nullable mailingAddressId) { + if (mailingAddressId.isNull()) { + this.mailingAddressId = null; + } else if (mailingAddressId.isEmpty()) { + this.mailingAddressId = Optional.empty(); + } else { + this.mailingAddressId = Optional.of(mailingAddressId.get()); + } + return this; + } + + /** + *

The unique identifier of a member to assign as the customer.

+ */ + @JsonSetter(value = "member_id", nulls = Nulls.SKIP) + public Builder memberId(Optional memberId) { + this.memberId = memberId; + return this; + } + + public Builder memberId(String memberId) { + this.memberId = Optional.ofNullable(memberId); + return this; + } + + public Builder memberId(Nullable memberId) { + if (memberId.isNull()) { + this.memberId = null; + } else if (memberId.isEmpty()) { + this.memberId = Optional.empty(); + } else { + this.memberId = Optional.of(memberId.get()); + } + return this; + } + + /** + *

The unique identifier of the payment method to charge.

+ */ + @JsonSetter(value = "payment_method_id", nulls = Nulls.SKIP) + public Builder paymentMethodId(Optional paymentMethodId) { + this.paymentMethodId = paymentMethodId; + return this; + } + + public Builder paymentMethodId(String paymentMethodId) { + this.paymentMethodId = Optional.ofNullable(paymentMethodId); + return this; + } + + public Builder paymentMethodId(Nullable paymentMethodId) { + if (paymentMethodId.isNull()) { + this.paymentMethodId = null; + } else if (paymentMethodId.isEmpty()) { + this.paymentMethodId = Optional.empty(); + } else { + this.paymentMethodId = Optional.of(paymentMethodId.get()); + } + return this; + } + + /** + *

Updated plan attributes.

+ */ + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public Builder plan(Optional plan) { + this.plan = plan; + return this; + } + + public Builder plan(UpdateInvoicesRequestPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + public Builder plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + /** + *

The unique identifier of an existing product to attach to this invoice. Only allowed while the invoice is still a draft.

+ */ + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public Builder productId(Optional productId) { + this.productId = productId; + return this; + } + + public Builder productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + public Builder productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + /** + *

The date that defines when the subscription billing cycle should start.

+ */ + @JsonSetter(value = "subscription_billing_anchor_at", nulls = Nulls.SKIP) + public Builder subscriptionBillingAnchorAt(Optional subscriptionBillingAnchorAt) { + this.subscriptionBillingAnchorAt = subscriptionBillingAnchorAt; + return this; + } + + public Builder subscriptionBillingAnchorAt(OffsetDateTime subscriptionBillingAnchorAt) { + this.subscriptionBillingAnchorAt = Optional.ofNullable(subscriptionBillingAnchorAt); + return this; + } + + public Builder subscriptionBillingAnchorAt(Nullable subscriptionBillingAnchorAt) { + if (subscriptionBillingAnchorAt.isNull()) { + this.subscriptionBillingAnchorAt = null; + } else if (subscriptionBillingAnchorAt.isEmpty()) { + this.subscriptionBillingAnchorAt = Optional.empty(); + } else { + this.subscriptionBillingAnchorAt = Optional.of(subscriptionBillingAnchorAt.get()); + } + return this; + } + + public UpdateInvoicesRequest build() { + return new UpdateInvoicesRequest( + automaticallyFinalizesAt, + billingAddress, + chargeBuyerFee, + collectionMethod, + customerName, + dueDate, + emailAddress, + lineItems, + mailingAddressId, + memberId, + paymentMethodId, + plan, + productId, + subscriptionBillingAnchorAt, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/requests/VoidInvoicesRequest.java b/src/main/java/com/whop/api/resources/invoices/requests/VoidInvoicesRequest.java new file mode 100644 index 00000000..f6954ac5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/requests/VoidInvoicesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = VoidInvoicesRequest.Builder.class) +public final class VoidInvoicesRequest { + private final Map additionalProperties; + + private VoidInvoicesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoidInvoicesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(VoidInvoicesRequest other) { + return this; + } + + public VoidInvoicesRequest build() { + return new VoidInvoicesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequest.java b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequest.java new file mode 100644 index 00000000..93dee924 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequest.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Map; +import java.util.Objects; + +@JsonDeserialize(using = CreateInvoicesRequest.Deserializer.class) +public final class CreateInvoicesRequest { + private final Object value; + + private final int type; + + private CreateInvoicesRequest(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((CreateInvoicesRequestProduct) this.value); + } else if (this.type == 1) { + return visitor.visit((CreateInvoicesRequestProductId) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateInvoicesRequest && equalTo((CreateInvoicesRequest) other); + } + + private boolean equalTo(CreateInvoicesRequest other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static CreateInvoicesRequest of(CreateInvoicesRequestProduct value) { + return new CreateInvoicesRequest(value, 0); + } + + public static CreateInvoicesRequest of(CreateInvoicesRequestProductId value) { + return new CreateInvoicesRequest(value, 1); + } + + public interface Visitor { + T visit(CreateInvoicesRequestProduct value); + + T visit(CreateInvoicesRequestProductId value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(CreateInvoicesRequest.class); + } + + @java.lang.Override + public CreateInvoicesRequest deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Map + && ((Map) value).containsKey("collection_method") + && ((Map) value).containsKey("company_id") + && ((Map) value).containsKey("plan") + && ((Map) value).containsKey("product")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, CreateInvoicesRequestProduct.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map + && ((Map) value).containsKey("collection_method") + && ((Map) value).containsKey("company_id") + && ((Map) value).containsKey("plan") + && ((Map) value).containsKey("product_id")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, CreateInvoicesRequestProductId.class)); + } catch (RuntimeException e) { + } + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProduct.java b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProduct.java new file mode 100644 index 00000000..c15bbde2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProduct.java @@ -0,0 +1,1190 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.InvoiceCollectionMethods; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateInvoicesRequestProduct.Builder.class) +public final class CreateInvoicesRequestProduct { + private final Optional automaticallyFinalizesAt; + + private final Optional billingAddress; + + private final Optional chargeBuyerFee; + + private final InvoiceCollectionMethods collectionMethod; + + private final String companyId; + + private final Optional customerName; + + private final Optional dueDate; + + private final Optional emailAddress; + + private final Optional> lineItems; + + private final Optional mailingAddressId; + + private final Optional memberId; + + private final Optional paymentMethodId; + + private final Optional paymentTokenId; + + private final CreateInvoicesRequestProductPlan plan; + + private final CreateInvoicesRequestProductProduct product; + + private final Optional saveAsDraft; + + private final Optional subscriptionBillingAnchorAt; + + private final Map additionalProperties; + + private CreateInvoicesRequestProduct( + Optional automaticallyFinalizesAt, + Optional billingAddress, + Optional chargeBuyerFee, + InvoiceCollectionMethods collectionMethod, + String companyId, + Optional customerName, + Optional dueDate, + Optional emailAddress, + Optional> lineItems, + Optional mailingAddressId, + Optional memberId, + Optional paymentMethodId, + Optional paymentTokenId, + CreateInvoicesRequestProductPlan plan, + CreateInvoicesRequestProductProduct product, + Optional saveAsDraft, + Optional subscriptionBillingAnchorAt, + Map additionalProperties) { + this.automaticallyFinalizesAt = automaticallyFinalizesAt; + this.billingAddress = billingAddress; + this.chargeBuyerFee = chargeBuyerFee; + this.collectionMethod = collectionMethod; + this.companyId = companyId; + this.customerName = customerName; + this.dueDate = dueDate; + this.emailAddress = emailAddress; + this.lineItems = lineItems; + this.mailingAddressId = mailingAddressId; + this.memberId = memberId; + this.paymentMethodId = paymentMethodId; + this.paymentTokenId = paymentTokenId; + this.plan = plan; + this.product = product; + this.saveAsDraft = saveAsDraft; + this.subscriptionBillingAnchorAt = subscriptionBillingAnchorAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email to the customer at the specified time. + */ + @JsonIgnore + public Optional getAutomaticallyFinalizesAt() { + if (automaticallyFinalizesAt == null) { + return Optional.empty(); + } + return automaticallyFinalizesAt; + } + + /** + * @return Inline billing address to create a new mailing address for this invoice. Cannot be used together with mailing_address_id. + */ + @JsonIgnore + public Optional getBillingAddress() { + if (billingAddress == null) { + return Optional.empty(); + } + return billingAddress; + } + + /** + * @return Whether to charge the customer a buyer fee on this invoice. + */ + @JsonIgnore + public Optional getChargeBuyerFee() { + if (chargeBuyerFee == null) { + return Optional.empty(); + } + return chargeBuyerFee; + } + + /** + * @return How the invoice should be collected. Use charge_automatically to charge a stored payment method, or send_invoice to email the customer. + */ + @JsonProperty("collection_method") + public InvoiceCollectionMethods getCollectionMethod() { + return collectionMethod; + } + + /** + * @return The unique identifier of the company to create this invoice for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return The name of the customer. Required when creating an invoice for a customer who is not yet a member of the company. + */ + @JsonIgnore + public Optional getCustomerName() { + if (customerName == null) { + return Optional.empty(); + } + return customerName; + } + + /** + * @return The date by which the invoice must be paid. Required unless save_as_draft is true. + */ + @JsonIgnore + public Optional getDueDate() { + if (dueDate == null) { + return Optional.empty(); + } + return dueDate; + } + + /** + * @return The email address of the customer. Required when creating an invoice for a customer who is not yet a member of the company. + */ + @JsonIgnore + public Optional getEmailAddress() { + if (emailAddress == null) { + return Optional.empty(); + } + return emailAddress; + } + + /** + * @return Optional line items that break down the invoice total. When provided, the sum of (quantity * unit_price) for all items must equal the plan price. + */ + @JsonIgnore + public Optional> getLineItems() { + if (lineItems == null) { + return Optional.empty(); + } + return lineItems; + } + + /** + * @return The unique identifier of an existing mailing address to attach to this invoice. Cannot be used together with billing_address. + */ + @JsonIgnore + public Optional getMailingAddressId() { + if (mailingAddressId == null) { + return Optional.empty(); + } + return mailingAddressId; + } + + /** + * @return The unique identifier of an existing member to create this invoice for. If not provided, you must supply an email_address and customer_name. + */ + @JsonIgnore + public Optional getMemberId() { + if (memberId == null) { + return Optional.empty(); + } + return memberId; + } + + /** + * @return The unique identifier of the payment method to charge. Required when collection_method is charge_automatically. + */ + @JsonIgnore + public Optional getPaymentMethodId() { + if (paymentMethodId == null) { + return Optional.empty(); + } + return paymentMethodId; + } + + /** + * @return The payment token ID to use for this invoice. If using charge_automatically, you must provide a payment_token. + */ + @JsonIgnore + public Optional getPaymentTokenId() { + if (paymentTokenId == null) { + return Optional.empty(); + } + return paymentTokenId; + } + + /** + * @return The plan attributes defining the price, currency, and billing interval for this invoice. + */ + @JsonProperty("plan") + public CreateInvoicesRequestProductPlan getPlan() { + return plan; + } + + /** + * @return The properties of the product to create for this invoice. Provide this to create a new product inline. + */ + @JsonProperty("product") + public CreateInvoicesRequestProductProduct getProduct() { + return product; + } + + /** + * @return When true, creates the invoice as a draft without sending or charging. Relaxes customer and due date requirements. + */ + @JsonIgnore + public Optional getSaveAsDraft() { + if (saveAsDraft == null) { + return Optional.empty(); + } + return saveAsDraft; + } + + /** + * @return The date that defines when the subscription billing cycle should start. When set on a renewal plan invoice, this anchors all future billing periods to this date. + */ + @JsonIgnore + public Optional getSubscriptionBillingAnchorAt() { + if (subscriptionBillingAnchorAt == null) { + return Optional.empty(); + } + return subscriptionBillingAnchorAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("automatically_finalizes_at") + private Optional _getAutomaticallyFinalizesAt() { + return automaticallyFinalizesAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_address") + private Optional _getBillingAddress() { + return billingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("charge_buyer_fee") + private Optional _getChargeBuyerFee() { + return chargeBuyerFee; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_name") + private Optional _getCustomerName() { + return customerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("due_date") + private Optional _getDueDate() { + return dueDate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email_address") + private Optional _getEmailAddress() { + return emailAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line_items") + private Optional> _getLineItems() { + return lineItems; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("mailing_address_id") + private Optional _getMailingAddressId() { + return mailingAddressId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member_id") + private Optional _getMemberId() { + return memberId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_id") + private Optional _getPaymentMethodId() { + return paymentMethodId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_token_id") + private Optional _getPaymentTokenId() { + return paymentTokenId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("save_as_draft") + private Optional _getSaveAsDraft() { + return saveAsDraft; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("subscription_billing_anchor_at") + private Optional _getSubscriptionBillingAnchorAt() { + return subscriptionBillingAnchorAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateInvoicesRequestProduct && equalTo((CreateInvoicesRequestProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateInvoicesRequestProduct other) { + return automaticallyFinalizesAt.equals(other.automaticallyFinalizesAt) + && billingAddress.equals(other.billingAddress) + && chargeBuyerFee.equals(other.chargeBuyerFee) + && collectionMethod.equals(other.collectionMethod) + && companyId.equals(other.companyId) + && customerName.equals(other.customerName) + && dueDate.equals(other.dueDate) + && emailAddress.equals(other.emailAddress) + && lineItems.equals(other.lineItems) + && mailingAddressId.equals(other.mailingAddressId) + && memberId.equals(other.memberId) + && paymentMethodId.equals(other.paymentMethodId) + && paymentTokenId.equals(other.paymentTokenId) + && plan.equals(other.plan) + && product.equals(other.product) + && saveAsDraft.equals(other.saveAsDraft) + && subscriptionBillingAnchorAt.equals(other.subscriptionBillingAnchorAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.automaticallyFinalizesAt, + this.billingAddress, + this.chargeBuyerFee, + this.collectionMethod, + this.companyId, + this.customerName, + this.dueDate, + this.emailAddress, + this.lineItems, + this.mailingAddressId, + this.memberId, + this.paymentMethodId, + this.paymentTokenId, + this.plan, + this.product, + this.saveAsDraft, + this.subscriptionBillingAnchorAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CollectionMethodStage builder() { + return new Builder(); + } + + public interface CollectionMethodStage { + /** + *

How the invoice should be collected. Use charge_automatically to charge a stored payment method, or send_invoice to email the customer.

+ */ + CompanyIdStage collectionMethod(@NotNull InvoiceCollectionMethods collectionMethod); + + Builder from(CreateInvoicesRequestProduct other); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to create this invoice for.

+ */ + PlanStage companyId(@NotNull String companyId); + } + + public interface PlanStage { + /** + *

The plan attributes defining the price, currency, and billing interval for this invoice.

+ */ + ProductStage plan(@NotNull CreateInvoicesRequestProductPlan plan); + } + + public interface ProductStage { + /** + *

The properties of the product to create for this invoice. Provide this to create a new product inline.

+ */ + _FinalStage product(@NotNull CreateInvoicesRequestProductProduct product); + } + + public interface _FinalStage { + CreateInvoicesRequestProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email to the customer at the specified time.

+ */ + _FinalStage automaticallyFinalizesAt(Optional automaticallyFinalizesAt); + + _FinalStage automaticallyFinalizesAt(OffsetDateTime automaticallyFinalizesAt); + + _FinalStage automaticallyFinalizesAt(Nullable automaticallyFinalizesAt); + + /** + *

Inline billing address to create a new mailing address for this invoice. Cannot be used together with mailing_address_id.

+ */ + _FinalStage billingAddress(Optional billingAddress); + + _FinalStage billingAddress(CreateInvoicesRequestProductBillingAddress billingAddress); + + _FinalStage billingAddress(Nullable billingAddress); + + /** + *

Whether to charge the customer a buyer fee on this invoice.

+ */ + _FinalStage chargeBuyerFee(Optional chargeBuyerFee); + + _FinalStage chargeBuyerFee(Boolean chargeBuyerFee); + + _FinalStage chargeBuyerFee(Nullable chargeBuyerFee); + + /** + *

The name of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ */ + _FinalStage customerName(Optional customerName); + + _FinalStage customerName(String customerName); + + _FinalStage customerName(Nullable customerName); + + /** + *

The date by which the invoice must be paid. Required unless save_as_draft is true.

+ */ + _FinalStage dueDate(Optional dueDate); + + _FinalStage dueDate(OffsetDateTime dueDate); + + _FinalStage dueDate(Nullable dueDate); + + /** + *

The email address of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ */ + _FinalStage emailAddress(Optional emailAddress); + + _FinalStage emailAddress(String emailAddress); + + _FinalStage emailAddress(Nullable emailAddress); + + /** + *

Optional line items that break down the invoice total. When provided, the sum of (quantity * unit_price) for all items must equal the plan price.

+ */ + _FinalStage lineItems(Optional> lineItems); + + _FinalStage lineItems(List lineItems); + + _FinalStage lineItems(Nullable> lineItems); + + /** + *

The unique identifier of an existing mailing address to attach to this invoice. Cannot be used together with billing_address.

+ */ + _FinalStage mailingAddressId(Optional mailingAddressId); + + _FinalStage mailingAddressId(String mailingAddressId); + + _FinalStage mailingAddressId(Nullable mailingAddressId); + + /** + *

The unique identifier of an existing member to create this invoice for. If not provided, you must supply an email_address and customer_name.

+ */ + _FinalStage memberId(Optional memberId); + + _FinalStage memberId(String memberId); + + _FinalStage memberId(Nullable memberId); + + /** + *

The unique identifier of the payment method to charge. Required when collection_method is charge_automatically.

+ */ + _FinalStage paymentMethodId(Optional paymentMethodId); + + _FinalStage paymentMethodId(String paymentMethodId); + + _FinalStage paymentMethodId(Nullable paymentMethodId); + + /** + *

The payment token ID to use for this invoice. If using charge_automatically, you must provide a payment_token.

+ */ + _FinalStage paymentTokenId(Optional paymentTokenId); + + _FinalStage paymentTokenId(String paymentTokenId); + + _FinalStage paymentTokenId(Nullable paymentTokenId); + + /** + *

When true, creates the invoice as a draft without sending or charging. Relaxes customer and due date requirements.

+ */ + _FinalStage saveAsDraft(Optional saveAsDraft); + + _FinalStage saveAsDraft(Boolean saveAsDraft); + + _FinalStage saveAsDraft(Nullable saveAsDraft); + + /** + *

The date that defines when the subscription billing cycle should start. When set on a renewal plan invoice, this anchors all future billing periods to this date.

+ */ + _FinalStage subscriptionBillingAnchorAt(Optional subscriptionBillingAnchorAt); + + _FinalStage subscriptionBillingAnchorAt(OffsetDateTime subscriptionBillingAnchorAt); + + _FinalStage subscriptionBillingAnchorAt(Nullable subscriptionBillingAnchorAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CollectionMethodStage, CompanyIdStage, PlanStage, ProductStage, _FinalStage { + private InvoiceCollectionMethods collectionMethod; + + private String companyId; + + private CreateInvoicesRequestProductPlan plan; + + private CreateInvoicesRequestProductProduct product; + + private Optional subscriptionBillingAnchorAt = Optional.empty(); + + private Optional saveAsDraft = Optional.empty(); + + private Optional paymentTokenId = Optional.empty(); + + private Optional paymentMethodId = Optional.empty(); + + private Optional memberId = Optional.empty(); + + private Optional mailingAddressId = Optional.empty(); + + private Optional> lineItems = Optional.empty(); + + private Optional emailAddress = Optional.empty(); + + private Optional dueDate = Optional.empty(); + + private Optional customerName = Optional.empty(); + + private Optional chargeBuyerFee = Optional.empty(); + + private Optional billingAddress = Optional.empty(); + + private Optional automaticallyFinalizesAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateInvoicesRequestProduct other) { + automaticallyFinalizesAt(other.getAutomaticallyFinalizesAt()); + billingAddress(other.getBillingAddress()); + chargeBuyerFee(other.getChargeBuyerFee()); + collectionMethod(other.getCollectionMethod()); + companyId(other.getCompanyId()); + customerName(other.getCustomerName()); + dueDate(other.getDueDate()); + emailAddress(other.getEmailAddress()); + lineItems(other.getLineItems()); + mailingAddressId(other.getMailingAddressId()); + memberId(other.getMemberId()); + paymentMethodId(other.getPaymentMethodId()); + paymentTokenId(other.getPaymentTokenId()); + plan(other.getPlan()); + product(other.getProduct()); + saveAsDraft(other.getSaveAsDraft()); + subscriptionBillingAnchorAt(other.getSubscriptionBillingAnchorAt()); + return this; + } + + /** + *

How the invoice should be collected. Use charge_automatically to charge a stored payment method, or send_invoice to email the customer.

+ *

How the invoice should be collected. Use charge_automatically to charge a stored payment method, or send_invoice to email the customer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("collection_method") + public CompanyIdStage collectionMethod(@NotNull InvoiceCollectionMethods collectionMethod) { + this.collectionMethod = Objects.requireNonNull(collectionMethod, "collectionMethod must not be null"); + return this; + } + + /** + *

The unique identifier of the company to create this invoice for.

+ *

The unique identifier of the company to create this invoice for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public PlanStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The plan attributes defining the price, currency, and billing interval for this invoice.

+ *

The plan attributes defining the price, currency, and billing interval for this invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan") + public ProductStage plan(@NotNull CreateInvoicesRequestProductPlan plan) { + this.plan = Objects.requireNonNull(plan, "plan must not be null"); + return this; + } + + /** + *

The properties of the product to create for this invoice. Provide this to create a new product inline.

+ *

The properties of the product to create for this invoice. Provide this to create a new product inline.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("product") + public _FinalStage product(@NotNull CreateInvoicesRequestProductProduct product) { + this.product = Objects.requireNonNull(product, "product must not be null"); + return this; + } + + /** + *

The date that defines when the subscription billing cycle should start. When set on a renewal plan invoice, this anchors all future billing periods to this date.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subscriptionBillingAnchorAt(Nullable subscriptionBillingAnchorAt) { + if (subscriptionBillingAnchorAt.isNull()) { + this.subscriptionBillingAnchorAt = null; + } else if (subscriptionBillingAnchorAt.isEmpty()) { + this.subscriptionBillingAnchorAt = Optional.empty(); + } else { + this.subscriptionBillingAnchorAt = Optional.of(subscriptionBillingAnchorAt.get()); + } + return this; + } + + /** + *

The date that defines when the subscription billing cycle should start. When set on a renewal plan invoice, this anchors all future billing periods to this date.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subscriptionBillingAnchorAt(OffsetDateTime subscriptionBillingAnchorAt) { + this.subscriptionBillingAnchorAt = Optional.ofNullable(subscriptionBillingAnchorAt); + return this; + } + + /** + *

The date that defines when the subscription billing cycle should start. When set on a renewal plan invoice, this anchors all future billing periods to this date.

+ */ + @java.lang.Override + @JsonSetter(value = "subscription_billing_anchor_at", nulls = Nulls.SKIP) + public _FinalStage subscriptionBillingAnchorAt(Optional subscriptionBillingAnchorAt) { + this.subscriptionBillingAnchorAt = subscriptionBillingAnchorAt; + return this; + } + + /** + *

When true, creates the invoice as a draft without sending or charging. Relaxes customer and due date requirements.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage saveAsDraft(Nullable saveAsDraft) { + if (saveAsDraft.isNull()) { + this.saveAsDraft = null; + } else if (saveAsDraft.isEmpty()) { + this.saveAsDraft = Optional.empty(); + } else { + this.saveAsDraft = Optional.of(saveAsDraft.get()); + } + return this; + } + + /** + *

When true, creates the invoice as a draft without sending or charging. Relaxes customer and due date requirements.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage saveAsDraft(Boolean saveAsDraft) { + this.saveAsDraft = Optional.ofNullable(saveAsDraft); + return this; + } + + /** + *

When true, creates the invoice as a draft without sending or charging. Relaxes customer and due date requirements.

+ */ + @java.lang.Override + @JsonSetter(value = "save_as_draft", nulls = Nulls.SKIP) + public _FinalStage saveAsDraft(Optional saveAsDraft) { + this.saveAsDraft = saveAsDraft; + return this; + } + + /** + *

The payment token ID to use for this invoice. If using charge_automatically, you must provide a payment_token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentTokenId(Nullable paymentTokenId) { + if (paymentTokenId.isNull()) { + this.paymentTokenId = null; + } else if (paymentTokenId.isEmpty()) { + this.paymentTokenId = Optional.empty(); + } else { + this.paymentTokenId = Optional.of(paymentTokenId.get()); + } + return this; + } + + /** + *

The payment token ID to use for this invoice. If using charge_automatically, you must provide a payment_token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentTokenId(String paymentTokenId) { + this.paymentTokenId = Optional.ofNullable(paymentTokenId); + return this; + } + + /** + *

The payment token ID to use for this invoice. If using charge_automatically, you must provide a payment_token.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_token_id", nulls = Nulls.SKIP) + public _FinalStage paymentTokenId(Optional paymentTokenId) { + this.paymentTokenId = paymentTokenId; + return this; + } + + /** + *

The unique identifier of the payment method to charge. Required when collection_method is charge_automatically.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodId(Nullable paymentMethodId) { + if (paymentMethodId.isNull()) { + this.paymentMethodId = null; + } else if (paymentMethodId.isEmpty()) { + this.paymentMethodId = Optional.empty(); + } else { + this.paymentMethodId = Optional.of(paymentMethodId.get()); + } + return this; + } + + /** + *

The unique identifier of the payment method to charge. Required when collection_method is charge_automatically.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodId(String paymentMethodId) { + this.paymentMethodId = Optional.ofNullable(paymentMethodId); + return this; + } + + /** + *

The unique identifier of the payment method to charge. Required when collection_method is charge_automatically.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_id", nulls = Nulls.SKIP) + public _FinalStage paymentMethodId(Optional paymentMethodId) { + this.paymentMethodId = paymentMethodId; + return this; + } + + /** + *

The unique identifier of an existing member to create this invoice for. If not provided, you must supply an email_address and customer_name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memberId(Nullable memberId) { + if (memberId.isNull()) { + this.memberId = null; + } else if (memberId.isEmpty()) { + this.memberId = Optional.empty(); + } else { + this.memberId = Optional.of(memberId.get()); + } + return this; + } + + /** + *

The unique identifier of an existing member to create this invoice for. If not provided, you must supply an email_address and customer_name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memberId(String memberId) { + this.memberId = Optional.ofNullable(memberId); + return this; + } + + /** + *

The unique identifier of an existing member to create this invoice for. If not provided, you must supply an email_address and customer_name.

+ */ + @java.lang.Override + @JsonSetter(value = "member_id", nulls = Nulls.SKIP) + public _FinalStage memberId(Optional memberId) { + this.memberId = memberId; + return this; + } + + /** + *

The unique identifier of an existing mailing address to attach to this invoice. Cannot be used together with billing_address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mailingAddressId(Nullable mailingAddressId) { + if (mailingAddressId.isNull()) { + this.mailingAddressId = null; + } else if (mailingAddressId.isEmpty()) { + this.mailingAddressId = Optional.empty(); + } else { + this.mailingAddressId = Optional.of(mailingAddressId.get()); + } + return this; + } + + /** + *

The unique identifier of an existing mailing address to attach to this invoice. Cannot be used together with billing_address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mailingAddressId(String mailingAddressId) { + this.mailingAddressId = Optional.ofNullable(mailingAddressId); + return this; + } + + /** + *

The unique identifier of an existing mailing address to attach to this invoice. Cannot be used together with billing_address.

+ */ + @java.lang.Override + @JsonSetter(value = "mailing_address_id", nulls = Nulls.SKIP) + public _FinalStage mailingAddressId(Optional mailingAddressId) { + this.mailingAddressId = mailingAddressId; + return this; + } + + /** + *

Optional line items that break down the invoice total. When provided, the sum of (quantity * unit_price) for all items must equal the plan price.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lineItems(Nullable> lineItems) { + if (lineItems.isNull()) { + this.lineItems = null; + } else if (lineItems.isEmpty()) { + this.lineItems = Optional.empty(); + } else { + this.lineItems = Optional.of(lineItems.get()); + } + return this; + } + + /** + *

Optional line items that break down the invoice total. When provided, the sum of (quantity * unit_price) for all items must equal the plan price.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lineItems(List lineItems) { + this.lineItems = Optional.ofNullable(lineItems); + return this; + } + + /** + *

Optional line items that break down the invoice total. When provided, the sum of (quantity * unit_price) for all items must equal the plan price.

+ */ + @java.lang.Override + @JsonSetter(value = "line_items", nulls = Nulls.SKIP) + public _FinalStage lineItems(Optional> lineItems) { + this.lineItems = lineItems; + return this; + } + + /** + *

The email address of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emailAddress(Nullable emailAddress) { + if (emailAddress.isNull()) { + this.emailAddress = null; + } else if (emailAddress.isEmpty()) { + this.emailAddress = Optional.empty(); + } else { + this.emailAddress = Optional.of(emailAddress.get()); + } + return this; + } + + /** + *

The email address of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emailAddress(String emailAddress) { + this.emailAddress = Optional.ofNullable(emailAddress); + return this; + } + + /** + *

The email address of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ */ + @java.lang.Override + @JsonSetter(value = "email_address", nulls = Nulls.SKIP) + public _FinalStage emailAddress(Optional emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + *

The date by which the invoice must be paid. Required unless save_as_draft is true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dueDate(Nullable dueDate) { + if (dueDate.isNull()) { + this.dueDate = null; + } else if (dueDate.isEmpty()) { + this.dueDate = Optional.empty(); + } else { + this.dueDate = Optional.of(dueDate.get()); + } + return this; + } + + /** + *

The date by which the invoice must be paid. Required unless save_as_draft is true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dueDate(OffsetDateTime dueDate) { + this.dueDate = Optional.ofNullable(dueDate); + return this; + } + + /** + *

The date by which the invoice must be paid. Required unless save_as_draft is true.

+ */ + @java.lang.Override + @JsonSetter(value = "due_date", nulls = Nulls.SKIP) + public _FinalStage dueDate(Optional dueDate) { + this.dueDate = dueDate; + return this; + } + + /** + *

The name of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerName(Nullable customerName) { + if (customerName.isNull()) { + this.customerName = null; + } else if (customerName.isEmpty()) { + this.customerName = Optional.empty(); + } else { + this.customerName = Optional.of(customerName.get()); + } + return this; + } + + /** + *

The name of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerName(String customerName) { + this.customerName = Optional.ofNullable(customerName); + return this; + } + + /** + *

The name of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ */ + @java.lang.Override + @JsonSetter(value = "customer_name", nulls = Nulls.SKIP) + public _FinalStage customerName(Optional customerName) { + this.customerName = customerName; + return this; + } + + /** + *

Whether to charge the customer a buyer fee on this invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage chargeBuyerFee(Nullable chargeBuyerFee) { + if (chargeBuyerFee.isNull()) { + this.chargeBuyerFee = null; + } else if (chargeBuyerFee.isEmpty()) { + this.chargeBuyerFee = Optional.empty(); + } else { + this.chargeBuyerFee = Optional.of(chargeBuyerFee.get()); + } + return this; + } + + /** + *

Whether to charge the customer a buyer fee on this invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage chargeBuyerFee(Boolean chargeBuyerFee) { + this.chargeBuyerFee = Optional.ofNullable(chargeBuyerFee); + return this; + } + + /** + *

Whether to charge the customer a buyer fee on this invoice.

+ */ + @java.lang.Override + @JsonSetter(value = "charge_buyer_fee", nulls = Nulls.SKIP) + public _FinalStage chargeBuyerFee(Optional chargeBuyerFee) { + this.chargeBuyerFee = chargeBuyerFee; + return this; + } + + /** + *

Inline billing address to create a new mailing address for this invoice. Cannot be used together with mailing_address_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingAddress(Nullable billingAddress) { + if (billingAddress.isNull()) { + this.billingAddress = null; + } else if (billingAddress.isEmpty()) { + this.billingAddress = Optional.empty(); + } else { + this.billingAddress = Optional.of(billingAddress.get()); + } + return this; + } + + /** + *

Inline billing address to create a new mailing address for this invoice. Cannot be used together with mailing_address_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingAddress(CreateInvoicesRequestProductBillingAddress billingAddress) { + this.billingAddress = Optional.ofNullable(billingAddress); + return this; + } + + /** + *

Inline billing address to create a new mailing address for this invoice. Cannot be used together with mailing_address_id.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_address", nulls = Nulls.SKIP) + public _FinalStage billingAddress(Optional billingAddress) { + this.billingAddress = billingAddress; + return this; + } + + /** + *

The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email to the customer at the specified time.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage automaticallyFinalizesAt(Nullable automaticallyFinalizesAt) { + if (automaticallyFinalizesAt.isNull()) { + this.automaticallyFinalizesAt = null; + } else if (automaticallyFinalizesAt.isEmpty()) { + this.automaticallyFinalizesAt = Optional.empty(); + } else { + this.automaticallyFinalizesAt = Optional.of(automaticallyFinalizesAt.get()); + } + return this; + } + + /** + *

The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email to the customer at the specified time.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage automaticallyFinalizesAt(OffsetDateTime automaticallyFinalizesAt) { + this.automaticallyFinalizesAt = Optional.ofNullable(automaticallyFinalizesAt); + return this; + } + + /** + *

The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email to the customer at the specified time.

+ */ + @java.lang.Override + @JsonSetter(value = "automatically_finalizes_at", nulls = Nulls.SKIP) + public _FinalStage automaticallyFinalizesAt(Optional automaticallyFinalizesAt) { + this.automaticallyFinalizesAt = automaticallyFinalizesAt; + return this; + } + + @java.lang.Override + public CreateInvoicesRequestProduct build() { + return new CreateInvoicesRequestProduct( + automaticallyFinalizesAt, + billingAddress, + chargeBuyerFee, + collectionMethod, + companyId, + customerName, + dueDate, + emailAddress, + lineItems, + mailingAddressId, + memberId, + paymentMethodId, + paymentTokenId, + plan, + product, + saveAsDraft, + subscriptionBillingAnchorAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductBillingAddress.java b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductBillingAddress.java new file mode 100644 index 00000000..4bdc43a0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductBillingAddress.java @@ -0,0 +1,609 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.TaxIdentifierTypes; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateInvoicesRequestProductBillingAddress.Builder.class) +public final class CreateInvoicesRequestProductBillingAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional name; + + private final Optional phone; + + private final Optional postalCode; + + private final Optional state; + + private final Optional taxIdType; + + private final Optional taxIdValue; + + private final Map additionalProperties; + + private CreateInvoicesRequestProductBillingAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional name, + Optional phone, + Optional postalCode, + Optional state, + Optional taxIdType, + Optional taxIdValue, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.name = name; + this.phone = phone; + this.postalCode = postalCode; + this.state = state; + this.taxIdType = taxIdType; + this.taxIdValue = taxIdValue; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The name of the customer. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The phone number of the customer. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + /** + * @return The type of tax identifier. + */ + @JsonIgnore + public Optional getTaxIdType() { + if (taxIdType == null) { + return Optional.empty(); + } + return taxIdType; + } + + /** + * @return The value of the tax identifier. + */ + @JsonIgnore + public Optional getTaxIdValue() { + if (taxIdValue == null) { + return Optional.empty(); + } + return taxIdValue; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_id_type") + private Optional _getTaxIdType() { + return taxIdType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_id_value") + private Optional _getTaxIdValue() { + return taxIdValue; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateInvoicesRequestProductBillingAddress + && equalTo((CreateInvoicesRequestProductBillingAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateInvoicesRequestProductBillingAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && name.equals(other.name) + && phone.equals(other.phone) + && postalCode.equals(other.postalCode) + && state.equals(other.state) + && taxIdType.equals(other.taxIdType) + && taxIdValue.equals(other.taxIdValue); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.city, + this.country, + this.line1, + this.line2, + this.name, + this.phone, + this.postalCode, + this.state, + this.taxIdType, + this.taxIdValue); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + private Optional taxIdType = Optional.empty(); + + private Optional taxIdValue = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateInvoicesRequestProductBillingAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + name(other.getName()); + phone(other.getPhone()); + postalCode(other.getPostalCode()); + state(other.getState()); + taxIdType(other.getTaxIdType()); + taxIdValue(other.getTaxIdValue()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The name of the customer.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The phone number of the customer.

+ */ + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + public Builder phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + /** + *

The type of tax identifier.

+ */ + @JsonSetter(value = "tax_id_type", nulls = Nulls.SKIP) + public Builder taxIdType(Optional taxIdType) { + this.taxIdType = taxIdType; + return this; + } + + public Builder taxIdType(TaxIdentifierTypes taxIdType) { + this.taxIdType = Optional.ofNullable(taxIdType); + return this; + } + + public Builder taxIdType(Nullable taxIdType) { + if (taxIdType.isNull()) { + this.taxIdType = null; + } else if (taxIdType.isEmpty()) { + this.taxIdType = Optional.empty(); + } else { + this.taxIdType = Optional.of(taxIdType.get()); + } + return this; + } + + /** + *

The value of the tax identifier.

+ */ + @JsonSetter(value = "tax_id_value", nulls = Nulls.SKIP) + public Builder taxIdValue(Optional taxIdValue) { + this.taxIdValue = taxIdValue; + return this; + } + + public Builder taxIdValue(String taxIdValue) { + this.taxIdValue = Optional.ofNullable(taxIdValue); + return this; + } + + public Builder taxIdValue(Nullable taxIdValue) { + if (taxIdValue.isNull()) { + this.taxIdValue = null; + } else if (taxIdValue.isEmpty()) { + this.taxIdValue = Optional.empty(); + } else { + this.taxIdValue = Optional.of(taxIdValue.get()); + } + return this; + } + + public CreateInvoicesRequestProductBillingAddress build() { + return new CreateInvoicesRequestProductBillingAddress( + city, + country, + line1, + line2, + name, + phone, + postalCode, + state, + taxIdType, + taxIdValue, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductId.java b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductId.java new file mode 100644 index 00000000..b785f990 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductId.java @@ -0,0 +1,1190 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.InvoiceCollectionMethods; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateInvoicesRequestProductId.Builder.class) +public final class CreateInvoicesRequestProductId { + private final Optional automaticallyFinalizesAt; + + private final Optional billingAddress; + + private final Optional chargeBuyerFee; + + private final InvoiceCollectionMethods collectionMethod; + + private final String companyId; + + private final Optional customerName; + + private final Optional dueDate; + + private final Optional emailAddress; + + private final Optional> lineItems; + + private final Optional mailingAddressId; + + private final Optional memberId; + + private final Optional paymentMethodId; + + private final Optional paymentTokenId; + + private final CreateInvoicesRequestProductIdPlan plan; + + private final String productId; + + private final Optional saveAsDraft; + + private final Optional subscriptionBillingAnchorAt; + + private final Map additionalProperties; + + private CreateInvoicesRequestProductId( + Optional automaticallyFinalizesAt, + Optional billingAddress, + Optional chargeBuyerFee, + InvoiceCollectionMethods collectionMethod, + String companyId, + Optional customerName, + Optional dueDate, + Optional emailAddress, + Optional> lineItems, + Optional mailingAddressId, + Optional memberId, + Optional paymentMethodId, + Optional paymentTokenId, + CreateInvoicesRequestProductIdPlan plan, + String productId, + Optional saveAsDraft, + Optional subscriptionBillingAnchorAt, + Map additionalProperties) { + this.automaticallyFinalizesAt = automaticallyFinalizesAt; + this.billingAddress = billingAddress; + this.chargeBuyerFee = chargeBuyerFee; + this.collectionMethod = collectionMethod; + this.companyId = companyId; + this.customerName = customerName; + this.dueDate = dueDate; + this.emailAddress = emailAddress; + this.lineItems = lineItems; + this.mailingAddressId = mailingAddressId; + this.memberId = memberId; + this.paymentMethodId = paymentMethodId; + this.paymentTokenId = paymentTokenId; + this.plan = plan; + this.productId = productId; + this.saveAsDraft = saveAsDraft; + this.subscriptionBillingAnchorAt = subscriptionBillingAnchorAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email to the customer at the specified time. + */ + @JsonIgnore + public Optional getAutomaticallyFinalizesAt() { + if (automaticallyFinalizesAt == null) { + return Optional.empty(); + } + return automaticallyFinalizesAt; + } + + /** + * @return Inline billing address to create a new mailing address for this invoice. Cannot be used together with mailing_address_id. + */ + @JsonIgnore + public Optional getBillingAddress() { + if (billingAddress == null) { + return Optional.empty(); + } + return billingAddress; + } + + /** + * @return Whether to charge the customer a buyer fee on this invoice. + */ + @JsonIgnore + public Optional getChargeBuyerFee() { + if (chargeBuyerFee == null) { + return Optional.empty(); + } + return chargeBuyerFee; + } + + /** + * @return How the invoice should be collected. Use charge_automatically to charge a stored payment method, or send_invoice to email the customer. + */ + @JsonProperty("collection_method") + public InvoiceCollectionMethods getCollectionMethod() { + return collectionMethod; + } + + /** + * @return The unique identifier of the company to create this invoice for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return The name of the customer. Required when creating an invoice for a customer who is not yet a member of the company. + */ + @JsonIgnore + public Optional getCustomerName() { + if (customerName == null) { + return Optional.empty(); + } + return customerName; + } + + /** + * @return The date by which the invoice must be paid. Required unless save_as_draft is true. + */ + @JsonIgnore + public Optional getDueDate() { + if (dueDate == null) { + return Optional.empty(); + } + return dueDate; + } + + /** + * @return The email address of the customer. Required when creating an invoice for a customer who is not yet a member of the company. + */ + @JsonIgnore + public Optional getEmailAddress() { + if (emailAddress == null) { + return Optional.empty(); + } + return emailAddress; + } + + /** + * @return Optional line items that break down the invoice total. When provided, the sum of (quantity * unit_price) for all items must equal the plan price. + */ + @JsonIgnore + public Optional> getLineItems() { + if (lineItems == null) { + return Optional.empty(); + } + return lineItems; + } + + /** + * @return The unique identifier of an existing mailing address to attach to this invoice. Cannot be used together with billing_address. + */ + @JsonIgnore + public Optional getMailingAddressId() { + if (mailingAddressId == null) { + return Optional.empty(); + } + return mailingAddressId; + } + + /** + * @return The unique identifier of an existing member to create this invoice for. If not provided, you must supply an email_address and customer_name. + */ + @JsonIgnore + public Optional getMemberId() { + if (memberId == null) { + return Optional.empty(); + } + return memberId; + } + + /** + * @return The unique identifier of the payment method to charge. Required when collection_method is charge_automatically. + */ + @JsonIgnore + public Optional getPaymentMethodId() { + if (paymentMethodId == null) { + return Optional.empty(); + } + return paymentMethodId; + } + + /** + * @return The payment token ID to use for this invoice. If using charge_automatically, you must provide a payment_token. + */ + @JsonIgnore + public Optional getPaymentTokenId() { + if (paymentTokenId == null) { + return Optional.empty(); + } + return paymentTokenId; + } + + /** + * @return The plan attributes defining the price, currency, and billing interval for this invoice. + */ + @JsonProperty("plan") + public CreateInvoicesRequestProductIdPlan getPlan() { + return plan; + } + + /** + * @return The unique identifier of an existing product to create this invoice for. + */ + @JsonProperty("product_id") + public String getProductId() { + return productId; + } + + /** + * @return When true, creates the invoice as a draft without sending or charging. Relaxes customer and due date requirements. + */ + @JsonIgnore + public Optional getSaveAsDraft() { + if (saveAsDraft == null) { + return Optional.empty(); + } + return saveAsDraft; + } + + /** + * @return The date that defines when the subscription billing cycle should start. When set on a renewal plan invoice, this anchors all future billing periods to this date. + */ + @JsonIgnore + public Optional getSubscriptionBillingAnchorAt() { + if (subscriptionBillingAnchorAt == null) { + return Optional.empty(); + } + return subscriptionBillingAnchorAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("automatically_finalizes_at") + private Optional _getAutomaticallyFinalizesAt() { + return automaticallyFinalizesAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_address") + private Optional _getBillingAddress() { + return billingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("charge_buyer_fee") + private Optional _getChargeBuyerFee() { + return chargeBuyerFee; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_name") + private Optional _getCustomerName() { + return customerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("due_date") + private Optional _getDueDate() { + return dueDate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email_address") + private Optional _getEmailAddress() { + return emailAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line_items") + private Optional> _getLineItems() { + return lineItems; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("mailing_address_id") + private Optional _getMailingAddressId() { + return mailingAddressId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member_id") + private Optional _getMemberId() { + return memberId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_id") + private Optional _getPaymentMethodId() { + return paymentMethodId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_token_id") + private Optional _getPaymentTokenId() { + return paymentTokenId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("save_as_draft") + private Optional _getSaveAsDraft() { + return saveAsDraft; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("subscription_billing_anchor_at") + private Optional _getSubscriptionBillingAnchorAt() { + return subscriptionBillingAnchorAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateInvoicesRequestProductId && equalTo((CreateInvoicesRequestProductId) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateInvoicesRequestProductId other) { + return automaticallyFinalizesAt.equals(other.automaticallyFinalizesAt) + && billingAddress.equals(other.billingAddress) + && chargeBuyerFee.equals(other.chargeBuyerFee) + && collectionMethod.equals(other.collectionMethod) + && companyId.equals(other.companyId) + && customerName.equals(other.customerName) + && dueDate.equals(other.dueDate) + && emailAddress.equals(other.emailAddress) + && lineItems.equals(other.lineItems) + && mailingAddressId.equals(other.mailingAddressId) + && memberId.equals(other.memberId) + && paymentMethodId.equals(other.paymentMethodId) + && paymentTokenId.equals(other.paymentTokenId) + && plan.equals(other.plan) + && productId.equals(other.productId) + && saveAsDraft.equals(other.saveAsDraft) + && subscriptionBillingAnchorAt.equals(other.subscriptionBillingAnchorAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.automaticallyFinalizesAt, + this.billingAddress, + this.chargeBuyerFee, + this.collectionMethod, + this.companyId, + this.customerName, + this.dueDate, + this.emailAddress, + this.lineItems, + this.mailingAddressId, + this.memberId, + this.paymentMethodId, + this.paymentTokenId, + this.plan, + this.productId, + this.saveAsDraft, + this.subscriptionBillingAnchorAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CollectionMethodStage builder() { + return new Builder(); + } + + public interface CollectionMethodStage { + /** + *

How the invoice should be collected. Use charge_automatically to charge a stored payment method, or send_invoice to email the customer.

+ */ + CompanyIdStage collectionMethod(@NotNull InvoiceCollectionMethods collectionMethod); + + Builder from(CreateInvoicesRequestProductId other); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to create this invoice for.

+ */ + PlanStage companyId(@NotNull String companyId); + } + + public interface PlanStage { + /** + *

The plan attributes defining the price, currency, and billing interval for this invoice.

+ */ + ProductIdStage plan(@NotNull CreateInvoicesRequestProductIdPlan plan); + } + + public interface ProductIdStage { + /** + *

The unique identifier of an existing product to create this invoice for.

+ */ + _FinalStage productId(@NotNull String productId); + } + + public interface _FinalStage { + CreateInvoicesRequestProductId build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email to the customer at the specified time.

+ */ + _FinalStage automaticallyFinalizesAt(Optional automaticallyFinalizesAt); + + _FinalStage automaticallyFinalizesAt(OffsetDateTime automaticallyFinalizesAt); + + _FinalStage automaticallyFinalizesAt(Nullable automaticallyFinalizesAt); + + /** + *

Inline billing address to create a new mailing address for this invoice. Cannot be used together with mailing_address_id.

+ */ + _FinalStage billingAddress(Optional billingAddress); + + _FinalStage billingAddress(CreateInvoicesRequestProductIdBillingAddress billingAddress); + + _FinalStage billingAddress(Nullable billingAddress); + + /** + *

Whether to charge the customer a buyer fee on this invoice.

+ */ + _FinalStage chargeBuyerFee(Optional chargeBuyerFee); + + _FinalStage chargeBuyerFee(Boolean chargeBuyerFee); + + _FinalStage chargeBuyerFee(Nullable chargeBuyerFee); + + /** + *

The name of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ */ + _FinalStage customerName(Optional customerName); + + _FinalStage customerName(String customerName); + + _FinalStage customerName(Nullable customerName); + + /** + *

The date by which the invoice must be paid. Required unless save_as_draft is true.

+ */ + _FinalStage dueDate(Optional dueDate); + + _FinalStage dueDate(OffsetDateTime dueDate); + + _FinalStage dueDate(Nullable dueDate); + + /** + *

The email address of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ */ + _FinalStage emailAddress(Optional emailAddress); + + _FinalStage emailAddress(String emailAddress); + + _FinalStage emailAddress(Nullable emailAddress); + + /** + *

Optional line items that break down the invoice total. When provided, the sum of (quantity * unit_price) for all items must equal the plan price.

+ */ + _FinalStage lineItems(Optional> lineItems); + + _FinalStage lineItems(List lineItems); + + _FinalStage lineItems(Nullable> lineItems); + + /** + *

The unique identifier of an existing mailing address to attach to this invoice. Cannot be used together with billing_address.

+ */ + _FinalStage mailingAddressId(Optional mailingAddressId); + + _FinalStage mailingAddressId(String mailingAddressId); + + _FinalStage mailingAddressId(Nullable mailingAddressId); + + /** + *

The unique identifier of an existing member to create this invoice for. If not provided, you must supply an email_address and customer_name.

+ */ + _FinalStage memberId(Optional memberId); + + _FinalStage memberId(String memberId); + + _FinalStage memberId(Nullable memberId); + + /** + *

The unique identifier of the payment method to charge. Required when collection_method is charge_automatically.

+ */ + _FinalStage paymentMethodId(Optional paymentMethodId); + + _FinalStage paymentMethodId(String paymentMethodId); + + _FinalStage paymentMethodId(Nullable paymentMethodId); + + /** + *

The payment token ID to use for this invoice. If using charge_automatically, you must provide a payment_token.

+ */ + _FinalStage paymentTokenId(Optional paymentTokenId); + + _FinalStage paymentTokenId(String paymentTokenId); + + _FinalStage paymentTokenId(Nullable paymentTokenId); + + /** + *

When true, creates the invoice as a draft without sending or charging. Relaxes customer and due date requirements.

+ */ + _FinalStage saveAsDraft(Optional saveAsDraft); + + _FinalStage saveAsDraft(Boolean saveAsDraft); + + _FinalStage saveAsDraft(Nullable saveAsDraft); + + /** + *

The date that defines when the subscription billing cycle should start. When set on a renewal plan invoice, this anchors all future billing periods to this date.

+ */ + _FinalStage subscriptionBillingAnchorAt(Optional subscriptionBillingAnchorAt); + + _FinalStage subscriptionBillingAnchorAt(OffsetDateTime subscriptionBillingAnchorAt); + + _FinalStage subscriptionBillingAnchorAt(Nullable subscriptionBillingAnchorAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CollectionMethodStage, CompanyIdStage, PlanStage, ProductIdStage, _FinalStage { + private InvoiceCollectionMethods collectionMethod; + + private String companyId; + + private CreateInvoicesRequestProductIdPlan plan; + + private String productId; + + private Optional subscriptionBillingAnchorAt = Optional.empty(); + + private Optional saveAsDraft = Optional.empty(); + + private Optional paymentTokenId = Optional.empty(); + + private Optional paymentMethodId = Optional.empty(); + + private Optional memberId = Optional.empty(); + + private Optional mailingAddressId = Optional.empty(); + + private Optional> lineItems = Optional.empty(); + + private Optional emailAddress = Optional.empty(); + + private Optional dueDate = Optional.empty(); + + private Optional customerName = Optional.empty(); + + private Optional chargeBuyerFee = Optional.empty(); + + private Optional billingAddress = Optional.empty(); + + private Optional automaticallyFinalizesAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateInvoicesRequestProductId other) { + automaticallyFinalizesAt(other.getAutomaticallyFinalizesAt()); + billingAddress(other.getBillingAddress()); + chargeBuyerFee(other.getChargeBuyerFee()); + collectionMethod(other.getCollectionMethod()); + companyId(other.getCompanyId()); + customerName(other.getCustomerName()); + dueDate(other.getDueDate()); + emailAddress(other.getEmailAddress()); + lineItems(other.getLineItems()); + mailingAddressId(other.getMailingAddressId()); + memberId(other.getMemberId()); + paymentMethodId(other.getPaymentMethodId()); + paymentTokenId(other.getPaymentTokenId()); + plan(other.getPlan()); + productId(other.getProductId()); + saveAsDraft(other.getSaveAsDraft()); + subscriptionBillingAnchorAt(other.getSubscriptionBillingAnchorAt()); + return this; + } + + /** + *

How the invoice should be collected. Use charge_automatically to charge a stored payment method, or send_invoice to email the customer.

+ *

How the invoice should be collected. Use charge_automatically to charge a stored payment method, or send_invoice to email the customer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("collection_method") + public CompanyIdStage collectionMethod(@NotNull InvoiceCollectionMethods collectionMethod) { + this.collectionMethod = Objects.requireNonNull(collectionMethod, "collectionMethod must not be null"); + return this; + } + + /** + *

The unique identifier of the company to create this invoice for.

+ *

The unique identifier of the company to create this invoice for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public PlanStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The plan attributes defining the price, currency, and billing interval for this invoice.

+ *

The plan attributes defining the price, currency, and billing interval for this invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan") + public ProductIdStage plan(@NotNull CreateInvoicesRequestProductIdPlan plan) { + this.plan = Objects.requireNonNull(plan, "plan must not be null"); + return this; + } + + /** + *

The unique identifier of an existing product to create this invoice for.

+ *

The unique identifier of an existing product to create this invoice for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("product_id") + public _FinalStage productId(@NotNull String productId) { + this.productId = Objects.requireNonNull(productId, "productId must not be null"); + return this; + } + + /** + *

The date that defines when the subscription billing cycle should start. When set on a renewal plan invoice, this anchors all future billing periods to this date.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subscriptionBillingAnchorAt(Nullable subscriptionBillingAnchorAt) { + if (subscriptionBillingAnchorAt.isNull()) { + this.subscriptionBillingAnchorAt = null; + } else if (subscriptionBillingAnchorAt.isEmpty()) { + this.subscriptionBillingAnchorAt = Optional.empty(); + } else { + this.subscriptionBillingAnchorAt = Optional.of(subscriptionBillingAnchorAt.get()); + } + return this; + } + + /** + *

The date that defines when the subscription billing cycle should start. When set on a renewal plan invoice, this anchors all future billing periods to this date.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subscriptionBillingAnchorAt(OffsetDateTime subscriptionBillingAnchorAt) { + this.subscriptionBillingAnchorAt = Optional.ofNullable(subscriptionBillingAnchorAt); + return this; + } + + /** + *

The date that defines when the subscription billing cycle should start. When set on a renewal plan invoice, this anchors all future billing periods to this date.

+ */ + @java.lang.Override + @JsonSetter(value = "subscription_billing_anchor_at", nulls = Nulls.SKIP) + public _FinalStage subscriptionBillingAnchorAt(Optional subscriptionBillingAnchorAt) { + this.subscriptionBillingAnchorAt = subscriptionBillingAnchorAt; + return this; + } + + /** + *

When true, creates the invoice as a draft without sending or charging. Relaxes customer and due date requirements.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage saveAsDraft(Nullable saveAsDraft) { + if (saveAsDraft.isNull()) { + this.saveAsDraft = null; + } else if (saveAsDraft.isEmpty()) { + this.saveAsDraft = Optional.empty(); + } else { + this.saveAsDraft = Optional.of(saveAsDraft.get()); + } + return this; + } + + /** + *

When true, creates the invoice as a draft without sending or charging. Relaxes customer and due date requirements.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage saveAsDraft(Boolean saveAsDraft) { + this.saveAsDraft = Optional.ofNullable(saveAsDraft); + return this; + } + + /** + *

When true, creates the invoice as a draft without sending or charging. Relaxes customer and due date requirements.

+ */ + @java.lang.Override + @JsonSetter(value = "save_as_draft", nulls = Nulls.SKIP) + public _FinalStage saveAsDraft(Optional saveAsDraft) { + this.saveAsDraft = saveAsDraft; + return this; + } + + /** + *

The payment token ID to use for this invoice. If using charge_automatically, you must provide a payment_token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentTokenId(Nullable paymentTokenId) { + if (paymentTokenId.isNull()) { + this.paymentTokenId = null; + } else if (paymentTokenId.isEmpty()) { + this.paymentTokenId = Optional.empty(); + } else { + this.paymentTokenId = Optional.of(paymentTokenId.get()); + } + return this; + } + + /** + *

The payment token ID to use for this invoice. If using charge_automatically, you must provide a payment_token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentTokenId(String paymentTokenId) { + this.paymentTokenId = Optional.ofNullable(paymentTokenId); + return this; + } + + /** + *

The payment token ID to use for this invoice. If using charge_automatically, you must provide a payment_token.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_token_id", nulls = Nulls.SKIP) + public _FinalStage paymentTokenId(Optional paymentTokenId) { + this.paymentTokenId = paymentTokenId; + return this; + } + + /** + *

The unique identifier of the payment method to charge. Required when collection_method is charge_automatically.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodId(Nullable paymentMethodId) { + if (paymentMethodId.isNull()) { + this.paymentMethodId = null; + } else if (paymentMethodId.isEmpty()) { + this.paymentMethodId = Optional.empty(); + } else { + this.paymentMethodId = Optional.of(paymentMethodId.get()); + } + return this; + } + + /** + *

The unique identifier of the payment method to charge. Required when collection_method is charge_automatically.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodId(String paymentMethodId) { + this.paymentMethodId = Optional.ofNullable(paymentMethodId); + return this; + } + + /** + *

The unique identifier of the payment method to charge. Required when collection_method is charge_automatically.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_id", nulls = Nulls.SKIP) + public _FinalStage paymentMethodId(Optional paymentMethodId) { + this.paymentMethodId = paymentMethodId; + return this; + } + + /** + *

The unique identifier of an existing member to create this invoice for. If not provided, you must supply an email_address and customer_name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memberId(Nullable memberId) { + if (memberId.isNull()) { + this.memberId = null; + } else if (memberId.isEmpty()) { + this.memberId = Optional.empty(); + } else { + this.memberId = Optional.of(memberId.get()); + } + return this; + } + + /** + *

The unique identifier of an existing member to create this invoice for. If not provided, you must supply an email_address and customer_name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memberId(String memberId) { + this.memberId = Optional.ofNullable(memberId); + return this; + } + + /** + *

The unique identifier of an existing member to create this invoice for. If not provided, you must supply an email_address and customer_name.

+ */ + @java.lang.Override + @JsonSetter(value = "member_id", nulls = Nulls.SKIP) + public _FinalStage memberId(Optional memberId) { + this.memberId = memberId; + return this; + } + + /** + *

The unique identifier of an existing mailing address to attach to this invoice. Cannot be used together with billing_address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mailingAddressId(Nullable mailingAddressId) { + if (mailingAddressId.isNull()) { + this.mailingAddressId = null; + } else if (mailingAddressId.isEmpty()) { + this.mailingAddressId = Optional.empty(); + } else { + this.mailingAddressId = Optional.of(mailingAddressId.get()); + } + return this; + } + + /** + *

The unique identifier of an existing mailing address to attach to this invoice. Cannot be used together with billing_address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mailingAddressId(String mailingAddressId) { + this.mailingAddressId = Optional.ofNullable(mailingAddressId); + return this; + } + + /** + *

The unique identifier of an existing mailing address to attach to this invoice. Cannot be used together with billing_address.

+ */ + @java.lang.Override + @JsonSetter(value = "mailing_address_id", nulls = Nulls.SKIP) + public _FinalStage mailingAddressId(Optional mailingAddressId) { + this.mailingAddressId = mailingAddressId; + return this; + } + + /** + *

Optional line items that break down the invoice total. When provided, the sum of (quantity * unit_price) for all items must equal the plan price.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lineItems(Nullable> lineItems) { + if (lineItems.isNull()) { + this.lineItems = null; + } else if (lineItems.isEmpty()) { + this.lineItems = Optional.empty(); + } else { + this.lineItems = Optional.of(lineItems.get()); + } + return this; + } + + /** + *

Optional line items that break down the invoice total. When provided, the sum of (quantity * unit_price) for all items must equal the plan price.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lineItems(List lineItems) { + this.lineItems = Optional.ofNullable(lineItems); + return this; + } + + /** + *

Optional line items that break down the invoice total. When provided, the sum of (quantity * unit_price) for all items must equal the plan price.

+ */ + @java.lang.Override + @JsonSetter(value = "line_items", nulls = Nulls.SKIP) + public _FinalStage lineItems(Optional> lineItems) { + this.lineItems = lineItems; + return this; + } + + /** + *

The email address of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emailAddress(Nullable emailAddress) { + if (emailAddress.isNull()) { + this.emailAddress = null; + } else if (emailAddress.isEmpty()) { + this.emailAddress = Optional.empty(); + } else { + this.emailAddress = Optional.of(emailAddress.get()); + } + return this; + } + + /** + *

The email address of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emailAddress(String emailAddress) { + this.emailAddress = Optional.ofNullable(emailAddress); + return this; + } + + /** + *

The email address of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ */ + @java.lang.Override + @JsonSetter(value = "email_address", nulls = Nulls.SKIP) + public _FinalStage emailAddress(Optional emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + *

The date by which the invoice must be paid. Required unless save_as_draft is true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dueDate(Nullable dueDate) { + if (dueDate.isNull()) { + this.dueDate = null; + } else if (dueDate.isEmpty()) { + this.dueDate = Optional.empty(); + } else { + this.dueDate = Optional.of(dueDate.get()); + } + return this; + } + + /** + *

The date by which the invoice must be paid. Required unless save_as_draft is true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dueDate(OffsetDateTime dueDate) { + this.dueDate = Optional.ofNullable(dueDate); + return this; + } + + /** + *

The date by which the invoice must be paid. Required unless save_as_draft is true.

+ */ + @java.lang.Override + @JsonSetter(value = "due_date", nulls = Nulls.SKIP) + public _FinalStage dueDate(Optional dueDate) { + this.dueDate = dueDate; + return this; + } + + /** + *

The name of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerName(Nullable customerName) { + if (customerName.isNull()) { + this.customerName = null; + } else if (customerName.isEmpty()) { + this.customerName = Optional.empty(); + } else { + this.customerName = Optional.of(customerName.get()); + } + return this; + } + + /** + *

The name of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerName(String customerName) { + this.customerName = Optional.ofNullable(customerName); + return this; + } + + /** + *

The name of the customer. Required when creating an invoice for a customer who is not yet a member of the company.

+ */ + @java.lang.Override + @JsonSetter(value = "customer_name", nulls = Nulls.SKIP) + public _FinalStage customerName(Optional customerName) { + this.customerName = customerName; + return this; + } + + /** + *

Whether to charge the customer a buyer fee on this invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage chargeBuyerFee(Nullable chargeBuyerFee) { + if (chargeBuyerFee.isNull()) { + this.chargeBuyerFee = null; + } else if (chargeBuyerFee.isEmpty()) { + this.chargeBuyerFee = Optional.empty(); + } else { + this.chargeBuyerFee = Optional.of(chargeBuyerFee.get()); + } + return this; + } + + /** + *

Whether to charge the customer a buyer fee on this invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage chargeBuyerFee(Boolean chargeBuyerFee) { + this.chargeBuyerFee = Optional.ofNullable(chargeBuyerFee); + return this; + } + + /** + *

Whether to charge the customer a buyer fee on this invoice.

+ */ + @java.lang.Override + @JsonSetter(value = "charge_buyer_fee", nulls = Nulls.SKIP) + public _FinalStage chargeBuyerFee(Optional chargeBuyerFee) { + this.chargeBuyerFee = chargeBuyerFee; + return this; + } + + /** + *

Inline billing address to create a new mailing address for this invoice. Cannot be used together with mailing_address_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingAddress(Nullable billingAddress) { + if (billingAddress.isNull()) { + this.billingAddress = null; + } else if (billingAddress.isEmpty()) { + this.billingAddress = Optional.empty(); + } else { + this.billingAddress = Optional.of(billingAddress.get()); + } + return this; + } + + /** + *

Inline billing address to create a new mailing address for this invoice. Cannot be used together with mailing_address_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingAddress(CreateInvoicesRequestProductIdBillingAddress billingAddress) { + this.billingAddress = Optional.ofNullable(billingAddress); + return this; + } + + /** + *

Inline billing address to create a new mailing address for this invoice. Cannot be used together with mailing_address_id.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_address", nulls = Nulls.SKIP) + public _FinalStage billingAddress(Optional billingAddress) { + this.billingAddress = billingAddress; + return this; + } + + /** + *

The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email to the customer at the specified time.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage automaticallyFinalizesAt(Nullable automaticallyFinalizesAt) { + if (automaticallyFinalizesAt.isNull()) { + this.automaticallyFinalizesAt = null; + } else if (automaticallyFinalizesAt.isEmpty()) { + this.automaticallyFinalizesAt = Optional.empty(); + } else { + this.automaticallyFinalizesAt = Optional.of(automaticallyFinalizesAt.get()); + } + return this; + } + + /** + *

The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email to the customer at the specified time.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage automaticallyFinalizesAt(OffsetDateTime automaticallyFinalizesAt) { + this.automaticallyFinalizesAt = Optional.ofNullable(automaticallyFinalizesAt); + return this; + } + + /** + *

The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email to the customer at the specified time.

+ */ + @java.lang.Override + @JsonSetter(value = "automatically_finalizes_at", nulls = Nulls.SKIP) + public _FinalStage automaticallyFinalizesAt(Optional automaticallyFinalizesAt) { + this.automaticallyFinalizesAt = automaticallyFinalizesAt; + return this; + } + + @java.lang.Override + public CreateInvoicesRequestProductId build() { + return new CreateInvoicesRequestProductId( + automaticallyFinalizesAt, + billingAddress, + chargeBuyerFee, + collectionMethod, + companyId, + customerName, + dueDate, + emailAddress, + lineItems, + mailingAddressId, + memberId, + paymentMethodId, + paymentTokenId, + plan, + productId, + saveAsDraft, + subscriptionBillingAnchorAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductIdBillingAddress.java b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductIdBillingAddress.java new file mode 100644 index 00000000..2088ed80 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductIdBillingAddress.java @@ -0,0 +1,609 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.TaxIdentifierTypes; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateInvoicesRequestProductIdBillingAddress.Builder.class) +public final class CreateInvoicesRequestProductIdBillingAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional name; + + private final Optional phone; + + private final Optional postalCode; + + private final Optional state; + + private final Optional taxIdType; + + private final Optional taxIdValue; + + private final Map additionalProperties; + + private CreateInvoicesRequestProductIdBillingAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional name, + Optional phone, + Optional postalCode, + Optional state, + Optional taxIdType, + Optional taxIdValue, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.name = name; + this.phone = phone; + this.postalCode = postalCode; + this.state = state; + this.taxIdType = taxIdType; + this.taxIdValue = taxIdValue; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The name of the customer. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The phone number of the customer. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + /** + * @return The type of tax identifier. + */ + @JsonIgnore + public Optional getTaxIdType() { + if (taxIdType == null) { + return Optional.empty(); + } + return taxIdType; + } + + /** + * @return The value of the tax identifier. + */ + @JsonIgnore + public Optional getTaxIdValue() { + if (taxIdValue == null) { + return Optional.empty(); + } + return taxIdValue; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_id_type") + private Optional _getTaxIdType() { + return taxIdType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_id_value") + private Optional _getTaxIdValue() { + return taxIdValue; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateInvoicesRequestProductIdBillingAddress + && equalTo((CreateInvoicesRequestProductIdBillingAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateInvoicesRequestProductIdBillingAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && name.equals(other.name) + && phone.equals(other.phone) + && postalCode.equals(other.postalCode) + && state.equals(other.state) + && taxIdType.equals(other.taxIdType) + && taxIdValue.equals(other.taxIdValue); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.city, + this.country, + this.line1, + this.line2, + this.name, + this.phone, + this.postalCode, + this.state, + this.taxIdType, + this.taxIdValue); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + private Optional taxIdType = Optional.empty(); + + private Optional taxIdValue = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateInvoicesRequestProductIdBillingAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + name(other.getName()); + phone(other.getPhone()); + postalCode(other.getPostalCode()); + state(other.getState()); + taxIdType(other.getTaxIdType()); + taxIdValue(other.getTaxIdValue()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The name of the customer.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The phone number of the customer.

+ */ + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + public Builder phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + /** + *

The type of tax identifier.

+ */ + @JsonSetter(value = "tax_id_type", nulls = Nulls.SKIP) + public Builder taxIdType(Optional taxIdType) { + this.taxIdType = taxIdType; + return this; + } + + public Builder taxIdType(TaxIdentifierTypes taxIdType) { + this.taxIdType = Optional.ofNullable(taxIdType); + return this; + } + + public Builder taxIdType(Nullable taxIdType) { + if (taxIdType.isNull()) { + this.taxIdType = null; + } else if (taxIdType.isEmpty()) { + this.taxIdType = Optional.empty(); + } else { + this.taxIdType = Optional.of(taxIdType.get()); + } + return this; + } + + /** + *

The value of the tax identifier.

+ */ + @JsonSetter(value = "tax_id_value", nulls = Nulls.SKIP) + public Builder taxIdValue(Optional taxIdValue) { + this.taxIdValue = taxIdValue; + return this; + } + + public Builder taxIdValue(String taxIdValue) { + this.taxIdValue = Optional.ofNullable(taxIdValue); + return this; + } + + public Builder taxIdValue(Nullable taxIdValue) { + if (taxIdValue.isNull()) { + this.taxIdValue = null; + } else if (taxIdValue.isEmpty()) { + this.taxIdValue = Optional.empty(); + } else { + this.taxIdValue = Optional.of(taxIdValue.get()); + } + return this; + } + + public CreateInvoicesRequestProductIdBillingAddress build() { + return new CreateInvoicesRequestProductIdBillingAddress( + city, + country, + line1, + line2, + name, + phone, + postalCode, + state, + taxIdType, + taxIdValue, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductIdLineItemsItem.java b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductIdLineItemsItem.java new file mode 100644 index 00000000..48fa2676 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductIdLineItemsItem.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateInvoicesRequestProductIdLineItemsItem.Builder.class) +public final class CreateInvoicesRequestProductIdLineItemsItem { + private final String label; + + private final Optional quantity; + + private final double unitPrice; + + private final Map additionalProperties; + + private CreateInvoicesRequestProductIdLineItemsItem( + String label, Optional quantity, double unitPrice, Map additionalProperties) { + this.label = label; + this.quantity = quantity; + this.unitPrice = unitPrice; + this.additionalProperties = additionalProperties; + } + + /** + * @return The label or description for this line item. + */ + @JsonProperty("label") + public String getLabel() { + return label; + } + + /** + * @return The quantity of this line item. Defaults to 1. + */ + @JsonIgnore + public Optional getQuantity() { + if (quantity == null) { + return Optional.empty(); + } + return quantity; + } + + /** + * @return The unit price for this line item. Provided as a number in the specified currency. Eg: 10.43 for $10.43 + */ + @JsonProperty("unit_price") + public double getUnitPrice() { + return unitPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("quantity") + private Optional _getQuantity() { + return quantity; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateInvoicesRequestProductIdLineItemsItem + && equalTo((CreateInvoicesRequestProductIdLineItemsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateInvoicesRequestProductIdLineItemsItem other) { + return label.equals(other.label) && quantity.equals(other.quantity) && unitPrice == other.unitPrice; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.label, this.quantity, this.unitPrice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LabelStage builder() { + return new Builder(); + } + + public interface LabelStage { + /** + *

The label or description for this line item.

+ */ + UnitPriceStage label(@NotNull String label); + + Builder from(CreateInvoicesRequestProductIdLineItemsItem other); + } + + public interface UnitPriceStage { + /** + *

The unit price for this line item. Provided as a number in the specified currency. Eg: 10.43 for $10.43

+ */ + _FinalStage unitPrice(double unitPrice); + } + + public interface _FinalStage { + CreateInvoicesRequestProductIdLineItemsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The quantity of this line item. Defaults to 1.

+ */ + _FinalStage quantity(Optional quantity); + + _FinalStage quantity(Double quantity); + + _FinalStage quantity(Nullable quantity); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LabelStage, UnitPriceStage, _FinalStage { + private String label; + + private double unitPrice; + + private Optional quantity = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateInvoicesRequestProductIdLineItemsItem other) { + label(other.getLabel()); + quantity(other.getQuantity()); + unitPrice(other.getUnitPrice()); + return this; + } + + /** + *

The label or description for this line item.

+ *

The label or description for this line item.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("label") + public UnitPriceStage label(@NotNull String label) { + this.label = Objects.requireNonNull(label, "label must not be null"); + return this; + } + + /** + *

The unit price for this line item. Provided as a number in the specified currency. Eg: 10.43 for $10.43

+ *

The unit price for this line item. Provided as a number in the specified currency. Eg: 10.43 for $10.43

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("unit_price") + public _FinalStage unitPrice(double unitPrice) { + this.unitPrice = unitPrice; + return this; + } + + /** + *

The quantity of this line item. Defaults to 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quantity(Nullable quantity) { + if (quantity.isNull()) { + this.quantity = null; + } else if (quantity.isEmpty()) { + this.quantity = Optional.empty(); + } else { + this.quantity = Optional.of(quantity.get()); + } + return this; + } + + /** + *

The quantity of this line item. Defaults to 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quantity(Double quantity) { + this.quantity = Optional.ofNullable(quantity); + return this; + } + + /** + *

The quantity of this line item. Defaults to 1.

+ */ + @java.lang.Override + @JsonSetter(value = "quantity", nulls = Nulls.SKIP) + public _FinalStage quantity(Optional quantity) { + this.quantity = quantity; + return this; + } + + @java.lang.Override + public CreateInvoicesRequestProductIdLineItemsItem build() { + return new CreateInvoicesRequestProductIdLineItemsItem(label, quantity, unitPrice, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductIdPlan.java b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductIdPlan.java new file mode 100644 index 00000000..32f64fae --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductIdPlan.java @@ -0,0 +1,981 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Currencies; +import com.whop.api.types.PlanTypes; +import com.whop.api.types.ReleaseMethod; +import com.whop.api.types.Visibility; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateInvoicesRequestProductIdPlan.Builder.class) +public final class CreateInvoicesRequestProductIdPlan { + private final Optional adaptivePricingEnabled; + + private final Optional billingPeriod; + + private final Optional currency; + + private final Optional> customFields; + + private final Optional description; + + private final Optional expirationDays; + + private final Optional initialPrice; + + private final Optional internalNotes; + + private final Optional legacyPaymentMethodControls; + + private final Optional paymentMethodConfiguration; + + private final Optional planType; + + private final Optional releaseMethod; + + private final Optional renewalPrice; + + private final Optional stock; + + private final Optional trialPeriodDays; + + private final Optional unlimitedStock; + + private final Optional visibility; + + private final Map additionalProperties; + + private CreateInvoicesRequestProductIdPlan( + Optional adaptivePricingEnabled, + Optional billingPeriod, + Optional currency, + Optional> customFields, + Optional description, + Optional expirationDays, + Optional initialPrice, + Optional internalNotes, + Optional legacyPaymentMethodControls, + Optional paymentMethodConfiguration, + Optional planType, + Optional releaseMethod, + Optional renewalPrice, + Optional stock, + Optional trialPeriodDays, + Optional unlimitedStock, + Optional visibility, + Map additionalProperties) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + this.billingPeriod = billingPeriod; + this.currency = currency; + this.customFields = customFields; + this.description = description; + this.expirationDays = expirationDays; + this.initialPrice = initialPrice; + this.internalNotes = internalNotes; + this.legacyPaymentMethodControls = legacyPaymentMethodControls; + this.paymentMethodConfiguration = paymentMethodConfiguration; + this.planType = planType; + this.releaseMethod = releaseMethod; + this.renewalPrice = renewalPrice; + this.stock = stock; + this.trialPeriodDays = trialPeriodDays; + this.unlimitedStock = unlimitedStock; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether this plan accepts local currency payments via adaptive pricing. + */ + @JsonIgnore + public Optional getAdaptivePricingEnabled() { + if (adaptivePricingEnabled == null) { + return Optional.empty(); + } + return adaptivePricingEnabled; + } + + /** + * @return The interval in days at which the plan charges (renewal plans). + */ + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + /** + * @return The three-letter ISO currency code for the plan's pricing. Defaults to USD. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return An array of custom field objects. + */ + @JsonIgnore + public Optional> getCustomFields() { + if (customFields == null) { + return Optional.empty(); + } + return customFields; + } + + /** + * @return The description of the plan. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The number of days until the membership expires and revokes access (expiration plans). For example, 365 for a one-year access period. + */ + @JsonIgnore + public Optional getExpirationDays() { + if (expirationDays == null) { + return Optional.empty(); + } + return expirationDays; + } + + /** + * @return An additional amount charged upon first purchase. Use only if a one time payment OR you want to charge an additional amount on top of the renewal price. Provided as a number in the specified currency. Eg: 10.43 for $10.43 + */ + @JsonIgnore + public Optional getInitialPrice() { + if (initialPrice == null) { + return Optional.empty(); + } + return initialPrice; + } + + /** + * @return A personal description or notes section for the business. + */ + @JsonIgnore + public Optional getInternalNotes() { + if (internalNotes == null) { + return Optional.empty(); + } + return internalNotes; + } + + /** + * @return Whether this plan uses legacy payment method controls + */ + @JsonIgnore + public Optional getLegacyPaymentMethodControls() { + if (legacyPaymentMethodControls == null) { + return Optional.empty(); + } + return legacyPaymentMethodControls; + } + + /** + * @return The explicit payment method configuration for the plan. If not provided, the platform or company's defaults will apply. + */ + @JsonIgnore + public Optional getPaymentMethodConfiguration() { + if (paymentMethodConfiguration == null) { + return Optional.empty(); + } + return paymentMethodConfiguration; + } + + /** + * @return Indicates if the plan is a one time payment or recurring. + */ + @JsonIgnore + public Optional getPlanType() { + if (planType == null) { + return Optional.empty(); + } + return planType; + } + + /** + * @return This is the release method the business uses to sell this plan. + */ + @JsonIgnore + public Optional getReleaseMethod() { + if (releaseMethod == null) { + return Optional.empty(); + } + return releaseMethod; + } + + /** + * @return The amount the customer is charged every billing period. Use only if a recurring payment. Provided as a number in the specified currency. Eg: 10.43 for $10.43 + */ + @JsonIgnore + public Optional getRenewalPrice() { + if (renewalPrice == null) { + return Optional.empty(); + } + return renewalPrice; + } + + /** + * @return The number of units available for purchase. + */ + @JsonIgnore + public Optional getStock() { + if (stock == null) { + return Optional.empty(); + } + return stock; + } + + /** + * @return The number of free trial days added before a renewal plan. + */ + @JsonIgnore + public Optional getTrialPeriodDays() { + if (trialPeriodDays == null) { + return Optional.empty(); + } + return trialPeriodDays; + } + + /** + * @return When true, the plan has unlimited stock (stock field is ignored). When false, purchases are limited by the stock field. + */ + @JsonIgnore + public Optional getUnlimitedStock() { + if (unlimitedStock == null) { + return Optional.empty(); + } + return unlimitedStock; + } + + /** + * @return Shows or hides the plan from public/business view. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("adaptive_pricing_enabled") + private Optional _getAdaptivePricingEnabled() { + return adaptivePricingEnabled; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_fields") + private Optional> _getCustomFields() { + return customFields; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_days") + private Optional _getExpirationDays() { + return expirationDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("initial_price") + private Optional _getInitialPrice() { + return initialPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("internal_notes") + private Optional _getInternalNotes() { + return internalNotes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("legacy_payment_method_controls") + private Optional _getLegacyPaymentMethodControls() { + return legacyPaymentMethodControls; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_configuration") + private Optional _getPaymentMethodConfiguration() { + return paymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan_type") + private Optional _getPlanType() { + return planType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("release_method") + private Optional _getReleaseMethod() { + return releaseMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("renewal_price") + private Optional _getRenewalPrice() { + return renewalPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("stock") + private Optional _getStock() { + return stock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trial_period_days") + private Optional _getTrialPeriodDays() { + return trialPeriodDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("unlimited_stock") + private Optional _getUnlimitedStock() { + return unlimitedStock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateInvoicesRequestProductIdPlan + && equalTo((CreateInvoicesRequestProductIdPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateInvoicesRequestProductIdPlan other) { + return adaptivePricingEnabled.equals(other.adaptivePricingEnabled) + && billingPeriod.equals(other.billingPeriod) + && currency.equals(other.currency) + && customFields.equals(other.customFields) + && description.equals(other.description) + && expirationDays.equals(other.expirationDays) + && initialPrice.equals(other.initialPrice) + && internalNotes.equals(other.internalNotes) + && legacyPaymentMethodControls.equals(other.legacyPaymentMethodControls) + && paymentMethodConfiguration.equals(other.paymentMethodConfiguration) + && planType.equals(other.planType) + && releaseMethod.equals(other.releaseMethod) + && renewalPrice.equals(other.renewalPrice) + && stock.equals(other.stock) + && trialPeriodDays.equals(other.trialPeriodDays) + && unlimitedStock.equals(other.unlimitedStock) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adaptivePricingEnabled, + this.billingPeriod, + this.currency, + this.customFields, + this.description, + this.expirationDays, + this.initialPrice, + this.internalNotes, + this.legacyPaymentMethodControls, + this.paymentMethodConfiguration, + this.planType, + this.releaseMethod, + this.renewalPrice, + this.stock, + this.trialPeriodDays, + this.unlimitedStock, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional adaptivePricingEnabled = Optional.empty(); + + private Optional billingPeriod = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional> customFields = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional expirationDays = Optional.empty(); + + private Optional initialPrice = Optional.empty(); + + private Optional internalNotes = Optional.empty(); + + private Optional legacyPaymentMethodControls = Optional.empty(); + + private Optional paymentMethodConfiguration = + Optional.empty(); + + private Optional planType = Optional.empty(); + + private Optional releaseMethod = Optional.empty(); + + private Optional renewalPrice = Optional.empty(); + + private Optional stock = Optional.empty(); + + private Optional trialPeriodDays = Optional.empty(); + + private Optional unlimitedStock = Optional.empty(); + + private Optional visibility = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateInvoicesRequestProductIdPlan other) { + adaptivePricingEnabled(other.getAdaptivePricingEnabled()); + billingPeriod(other.getBillingPeriod()); + currency(other.getCurrency()); + customFields(other.getCustomFields()); + description(other.getDescription()); + expirationDays(other.getExpirationDays()); + initialPrice(other.getInitialPrice()); + internalNotes(other.getInternalNotes()); + legacyPaymentMethodControls(other.getLegacyPaymentMethodControls()); + paymentMethodConfiguration(other.getPaymentMethodConfiguration()); + planType(other.getPlanType()); + releaseMethod(other.getReleaseMethod()); + renewalPrice(other.getRenewalPrice()); + stock(other.getStock()); + trialPeriodDays(other.getTrialPeriodDays()); + unlimitedStock(other.getUnlimitedStock()); + visibility(other.getVisibility()); + return this; + } + + /** + *

Whether this plan accepts local currency payments via adaptive pricing.

+ */ + @JsonSetter(value = "adaptive_pricing_enabled", nulls = Nulls.SKIP) + public Builder adaptivePricingEnabled(Optional adaptivePricingEnabled) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + return this; + } + + public Builder adaptivePricingEnabled(Boolean adaptivePricingEnabled) { + this.adaptivePricingEnabled = Optional.ofNullable(adaptivePricingEnabled); + return this; + } + + public Builder adaptivePricingEnabled(Nullable adaptivePricingEnabled) { + if (adaptivePricingEnabled.isNull()) { + this.adaptivePricingEnabled = null; + } else if (adaptivePricingEnabled.isEmpty()) { + this.adaptivePricingEnabled = Optional.empty(); + } else { + this.adaptivePricingEnabled = Optional.of(adaptivePricingEnabled.get()); + } + return this; + } + + /** + *

The interval in days at which the plan charges (renewal plans).

+ */ + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public Builder billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + public Builder billingPeriod(Integer billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + public Builder billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + /** + *

The three-letter ISO currency code for the plan's pricing. Defaults to USD.

+ */ + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional currency) { + this.currency = currency; + return this; + } + + public Builder currency(Currencies currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + public Builder currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

An array of custom field objects.

+ */ + @JsonSetter(value = "custom_fields", nulls = Nulls.SKIP) + public Builder customFields(Optional> customFields) { + this.customFields = customFields; + return this; + } + + public Builder customFields(List customFields) { + this.customFields = Optional.ofNullable(customFields); + return this; + } + + public Builder customFields(Nullable> customFields) { + if (customFields.isNull()) { + this.customFields = null; + } else if (customFields.isEmpty()) { + this.customFields = Optional.empty(); + } else { + this.customFields = Optional.of(customFields.get()); + } + return this; + } + + /** + *

The description of the plan.

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public Builder description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

The number of days until the membership expires and revokes access (expiration plans). For example, 365 for a one-year access period.

+ */ + @JsonSetter(value = "expiration_days", nulls = Nulls.SKIP) + public Builder expirationDays(Optional expirationDays) { + this.expirationDays = expirationDays; + return this; + } + + public Builder expirationDays(Integer expirationDays) { + this.expirationDays = Optional.ofNullable(expirationDays); + return this; + } + + public Builder expirationDays(Nullable expirationDays) { + if (expirationDays.isNull()) { + this.expirationDays = null; + } else if (expirationDays.isEmpty()) { + this.expirationDays = Optional.empty(); + } else { + this.expirationDays = Optional.of(expirationDays.get()); + } + return this; + } + + /** + *

An additional amount charged upon first purchase. Use only if a one time payment OR you want to charge an additional amount on top of the renewal price. Provided as a number in the specified currency. Eg: 10.43 for $10.43

+ */ + @JsonSetter(value = "initial_price", nulls = Nulls.SKIP) + public Builder initialPrice(Optional initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + public Builder initialPrice(Double initialPrice) { + this.initialPrice = Optional.ofNullable(initialPrice); + return this; + } + + public Builder initialPrice(Nullable initialPrice) { + if (initialPrice.isNull()) { + this.initialPrice = null; + } else if (initialPrice.isEmpty()) { + this.initialPrice = Optional.empty(); + } else { + this.initialPrice = Optional.of(initialPrice.get()); + } + return this; + } + + /** + *

A personal description or notes section for the business.

+ */ + @JsonSetter(value = "internal_notes", nulls = Nulls.SKIP) + public Builder internalNotes(Optional internalNotes) { + this.internalNotes = internalNotes; + return this; + } + + public Builder internalNotes(String internalNotes) { + this.internalNotes = Optional.ofNullable(internalNotes); + return this; + } + + public Builder internalNotes(Nullable internalNotes) { + if (internalNotes.isNull()) { + this.internalNotes = null; + } else if (internalNotes.isEmpty()) { + this.internalNotes = Optional.empty(); + } else { + this.internalNotes = Optional.of(internalNotes.get()); + } + return this; + } + + /** + *

Whether this plan uses legacy payment method controls

+ */ + @JsonSetter(value = "legacy_payment_method_controls", nulls = Nulls.SKIP) + public Builder legacyPaymentMethodControls(Optional legacyPaymentMethodControls) { + this.legacyPaymentMethodControls = legacyPaymentMethodControls; + return this; + } + + public Builder legacyPaymentMethodControls(Boolean legacyPaymentMethodControls) { + this.legacyPaymentMethodControls = Optional.ofNullable(legacyPaymentMethodControls); + return this; + } + + public Builder legacyPaymentMethodControls(Nullable legacyPaymentMethodControls) { + if (legacyPaymentMethodControls.isNull()) { + this.legacyPaymentMethodControls = null; + } else if (legacyPaymentMethodControls.isEmpty()) { + this.legacyPaymentMethodControls = Optional.empty(); + } else { + this.legacyPaymentMethodControls = Optional.of(legacyPaymentMethodControls.get()); + } + return this; + } + + /** + *

The explicit payment method configuration for the plan. If not provided, the platform or company's defaults will apply.

+ */ + @JsonSetter(value = "payment_method_configuration", nulls = Nulls.SKIP) + public Builder paymentMethodConfiguration( + Optional paymentMethodConfiguration) { + this.paymentMethodConfiguration = paymentMethodConfiguration; + return this; + } + + public Builder paymentMethodConfiguration( + CreateInvoicesRequestProductIdPlanPaymentMethodConfiguration paymentMethodConfiguration) { + this.paymentMethodConfiguration = Optional.ofNullable(paymentMethodConfiguration); + return this; + } + + public Builder paymentMethodConfiguration( + Nullable paymentMethodConfiguration) { + if (paymentMethodConfiguration.isNull()) { + this.paymentMethodConfiguration = null; + } else if (paymentMethodConfiguration.isEmpty()) { + this.paymentMethodConfiguration = Optional.empty(); + } else { + this.paymentMethodConfiguration = Optional.of(paymentMethodConfiguration.get()); + } + return this; + } + + /** + *

Indicates if the plan is a one time payment or recurring.

+ */ + @JsonSetter(value = "plan_type", nulls = Nulls.SKIP) + public Builder planType(Optional planType) { + this.planType = planType; + return this; + } + + public Builder planType(PlanTypes planType) { + this.planType = Optional.ofNullable(planType); + return this; + } + + public Builder planType(Nullable planType) { + if (planType.isNull()) { + this.planType = null; + } else if (planType.isEmpty()) { + this.planType = Optional.empty(); + } else { + this.planType = Optional.of(planType.get()); + } + return this; + } + + /** + *

This is the release method the business uses to sell this plan.

+ */ + @JsonSetter(value = "release_method", nulls = Nulls.SKIP) + public Builder releaseMethod(Optional releaseMethod) { + this.releaseMethod = releaseMethod; + return this; + } + + public Builder releaseMethod(ReleaseMethod releaseMethod) { + this.releaseMethod = Optional.ofNullable(releaseMethod); + return this; + } + + public Builder releaseMethod(Nullable releaseMethod) { + if (releaseMethod.isNull()) { + this.releaseMethod = null; + } else if (releaseMethod.isEmpty()) { + this.releaseMethod = Optional.empty(); + } else { + this.releaseMethod = Optional.of(releaseMethod.get()); + } + return this; + } + + /** + *

The amount the customer is charged every billing period. Use only if a recurring payment. Provided as a number in the specified currency. Eg: 10.43 for $10.43

+ */ + @JsonSetter(value = "renewal_price", nulls = Nulls.SKIP) + public Builder renewalPrice(Optional renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + public Builder renewalPrice(Double renewalPrice) { + this.renewalPrice = Optional.ofNullable(renewalPrice); + return this; + } + + public Builder renewalPrice(Nullable renewalPrice) { + if (renewalPrice.isNull()) { + this.renewalPrice = null; + } else if (renewalPrice.isEmpty()) { + this.renewalPrice = Optional.empty(); + } else { + this.renewalPrice = Optional.of(renewalPrice.get()); + } + return this; + } + + /** + *

The number of units available for purchase.

+ */ + @JsonSetter(value = "stock", nulls = Nulls.SKIP) + public Builder stock(Optional stock) { + this.stock = stock; + return this; + } + + public Builder stock(Integer stock) { + this.stock = Optional.ofNullable(stock); + return this; + } + + public Builder stock(Nullable stock) { + if (stock.isNull()) { + this.stock = null; + } else if (stock.isEmpty()) { + this.stock = Optional.empty(); + } else { + this.stock = Optional.of(stock.get()); + } + return this; + } + + /** + *

The number of free trial days added before a renewal plan.

+ */ + @JsonSetter(value = "trial_period_days", nulls = Nulls.SKIP) + public Builder trialPeriodDays(Optional trialPeriodDays) { + this.trialPeriodDays = trialPeriodDays; + return this; + } + + public Builder trialPeriodDays(Integer trialPeriodDays) { + this.trialPeriodDays = Optional.ofNullable(trialPeriodDays); + return this; + } + + public Builder trialPeriodDays(Nullable trialPeriodDays) { + if (trialPeriodDays.isNull()) { + this.trialPeriodDays = null; + } else if (trialPeriodDays.isEmpty()) { + this.trialPeriodDays = Optional.empty(); + } else { + this.trialPeriodDays = Optional.of(trialPeriodDays.get()); + } + return this; + } + + /** + *

When true, the plan has unlimited stock (stock field is ignored). When false, purchases are limited by the stock field.

+ */ + @JsonSetter(value = "unlimited_stock", nulls = Nulls.SKIP) + public Builder unlimitedStock(Optional unlimitedStock) { + this.unlimitedStock = unlimitedStock; + return this; + } + + public Builder unlimitedStock(Boolean unlimitedStock) { + this.unlimitedStock = Optional.ofNullable(unlimitedStock); + return this; + } + + public Builder unlimitedStock(Nullable unlimitedStock) { + if (unlimitedStock.isNull()) { + this.unlimitedStock = null; + } else if (unlimitedStock.isEmpty()) { + this.unlimitedStock = Optional.empty(); + } else { + this.unlimitedStock = Optional.of(unlimitedStock.get()); + } + return this; + } + + /** + *

Shows or hides the plan from public/business view.

+ */ + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public Builder visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + public Builder visibility(Visibility visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + public Builder visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + public CreateInvoicesRequestProductIdPlan build() { + return new CreateInvoicesRequestProductIdPlan( + adaptivePricingEnabled, + billingPeriod, + currency, + customFields, + description, + expirationDays, + initialPrice, + internalNotes, + legacyPaymentMethodControls, + paymentMethodConfiguration, + planType, + releaseMethod, + renewalPrice, + stock, + trialPeriodDays, + unlimitedStock, + visibility, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductIdPlanCustomFieldsItem.java b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductIdPlanCustomFieldsItem.java new file mode 100644 index 00000000..45583de8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductIdPlanCustomFieldsItem.java @@ -0,0 +1,454 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CustomFieldTypes; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateInvoicesRequestProductIdPlanCustomFieldsItem.Builder.class) +public final class CreateInvoicesRequestProductIdPlanCustomFieldsItem { + private final CustomFieldTypes fieldType; + + private final Optional id; + + private final String name; + + private final Optional order; + + private final Optional placeholder; + + private final Optional required; + + private final Map additionalProperties; + + private CreateInvoicesRequestProductIdPlanCustomFieldsItem( + CustomFieldTypes fieldType, + Optional id, + String name, + Optional order, + Optional placeholder, + Optional required, + Map additionalProperties) { + this.fieldType = fieldType; + this.id = id; + this.name = name; + this.order = order; + this.placeholder = placeholder; + this.required = required; + this.additionalProperties = additionalProperties; + } + + /** + * @return The type of the custom field. + */ + @JsonProperty("field_type") + public CustomFieldTypes getFieldType() { + return fieldType; + } + + /** + * @return The ID of the custom field (if being updated) + */ + @JsonIgnore + public Optional getId() { + if (id == null) { + return Optional.empty(); + } + return id; + } + + /** + * @return The name of the custom field. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The order of the field. + */ + @JsonIgnore + public Optional getOrder() { + if (order == null) { + return Optional.empty(); + } + return order; + } + + /** + * @return The placeholder value of the field. + */ + @JsonIgnore + public Optional getPlaceholder() { + if (placeholder == null) { + return Optional.empty(); + } + return placeholder; + } + + /** + * @return Whether or not the field is required. + */ + @JsonIgnore + public Optional getRequired() { + if (required == null) { + return Optional.empty(); + } + return required; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("id") + private Optional _getId() { + return id; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("order") + private Optional _getOrder() { + return order; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("placeholder") + private Optional _getPlaceholder() { + return placeholder; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("required") + private Optional _getRequired() { + return required; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateInvoicesRequestProductIdPlanCustomFieldsItem + && equalTo((CreateInvoicesRequestProductIdPlanCustomFieldsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateInvoicesRequestProductIdPlanCustomFieldsItem other) { + return fieldType.equals(other.fieldType) + && id.equals(other.id) + && name.equals(other.name) + && order.equals(other.order) + && placeholder.equals(other.placeholder) + && required.equals(other.required); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fieldType, this.id, this.name, this.order, this.placeholder, this.required); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FieldTypeStage builder() { + return new Builder(); + } + + public interface FieldTypeStage { + /** + *

The type of the custom field.

+ */ + NameStage fieldType(@NotNull CustomFieldTypes fieldType); + + Builder from(CreateInvoicesRequestProductIdPlanCustomFieldsItem other); + } + + public interface NameStage { + /** + *

The name of the custom field.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + CreateInvoicesRequestProductIdPlanCustomFieldsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The ID of the custom field (if being updated)

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + + _FinalStage id(Nullable id); + + /** + *

The order of the field.

+ */ + _FinalStage order(Optional order); + + _FinalStage order(Integer order); + + _FinalStage order(Nullable order); + + /** + *

The placeholder value of the field.

+ */ + _FinalStage placeholder(Optional placeholder); + + _FinalStage placeholder(String placeholder); + + _FinalStage placeholder(Nullable placeholder); + + /** + *

Whether or not the field is required.

+ */ + _FinalStage required(Optional required); + + _FinalStage required(Boolean required); + + _FinalStage required(Nullable required); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FieldTypeStage, NameStage, _FinalStage { + private CustomFieldTypes fieldType; + + private String name; + + private Optional required = Optional.empty(); + + private Optional placeholder = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateInvoicesRequestProductIdPlanCustomFieldsItem other) { + fieldType(other.getFieldType()); + id(other.getId()); + name(other.getName()); + order(other.getOrder()); + placeholder(other.getPlaceholder()); + required(other.getRequired()); + return this; + } + + /** + *

The type of the custom field.

+ *

The type of the custom field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("field_type") + public NameStage fieldType(@NotNull CustomFieldTypes fieldType) { + this.fieldType = Objects.requireNonNull(fieldType, "fieldType must not be null"); + return this; + } + + /** + *

The name of the custom field.

+ *

The name of the custom field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

Whether or not the field is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage required(Nullable required) { + if (required.isNull()) { + this.required = null; + } else if (required.isEmpty()) { + this.required = Optional.empty(); + } else { + this.required = Optional.of(required.get()); + } + return this; + } + + /** + *

Whether or not the field is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage required(Boolean required) { + this.required = Optional.ofNullable(required); + return this; + } + + /** + *

Whether or not the field is required.

+ */ + @java.lang.Override + @JsonSetter(value = "required", nulls = Nulls.SKIP) + public _FinalStage required(Optional required) { + this.required = required; + return this; + } + + /** + *

The placeholder value of the field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage placeholder(Nullable placeholder) { + if (placeholder.isNull()) { + this.placeholder = null; + } else if (placeholder.isEmpty()) { + this.placeholder = Optional.empty(); + } else { + this.placeholder = Optional.of(placeholder.get()); + } + return this; + } + + /** + *

The placeholder value of the field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage placeholder(String placeholder) { + this.placeholder = Optional.ofNullable(placeholder); + return this; + } + + /** + *

The placeholder value of the field.

+ */ + @java.lang.Override + @JsonSetter(value = "placeholder", nulls = Nulls.SKIP) + public _FinalStage placeholder(Optional placeholder) { + this.placeholder = placeholder; + return this; + } + + /** + *

The order of the field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(Nullable order) { + if (order.isNull()) { + this.order = null; + } else if (order.isEmpty()) { + this.order = Optional.empty(); + } else { + this.order = Optional.of(order.get()); + } + return this; + } + + /** + *

The order of the field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(Integer order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The order of the field.

+ */ + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + /** + *

The ID of the custom field (if being updated)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(Nullable id) { + if (id.isNull()) { + this.id = null; + } else if (id.isEmpty()) { + this.id = Optional.empty(); + } else { + this.id = Optional.of(id.get()); + } + return this; + } + + /** + *

The ID of the custom field (if being updated)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The ID of the custom field (if being updated)

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public CreateInvoicesRequestProductIdPlanCustomFieldsItem build() { + return new CreateInvoicesRequestProductIdPlanCustomFieldsItem( + fieldType, id, name, order, placeholder, required, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductIdPlanPaymentMethodConfiguration.java b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductIdPlanPaymentMethodConfiguration.java new file mode 100644 index 00000000..dba69c1f --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductIdPlanPaymentMethodConfiguration.java @@ -0,0 +1,221 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PaymentMethodTypes; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateInvoicesRequestProductIdPlanPaymentMethodConfiguration.Builder.class) +public final class CreateInvoicesRequestProductIdPlanPaymentMethodConfiguration { + private final List disabled; + + private final List enabled; + + private final Optional includePlatformDefaults; + + private final Map additionalProperties; + + private CreateInvoicesRequestProductIdPlanPaymentMethodConfiguration( + List disabled, + List enabled, + Optional includePlatformDefaults, + Map additionalProperties) { + this.disabled = disabled; + this.enabled = enabled; + this.includePlatformDefaults = includePlatformDefaults; + this.additionalProperties = additionalProperties; + } + + /** + * @return An array of payment method identifiers that are explicitly disabled. Only applies if the include_platform_defaults is true. + */ + @JsonProperty("disabled") + public List getDisabled() { + return disabled; + } + + /** + * @return An array of payment method identifiers that are explicitly enabled. This means these payment methods will be shown on checkout. Example use case is to only enable a specific payment method like cashapp, or extending the platform defaults with additional methods. + */ + @JsonProperty("enabled") + public List getEnabled() { + return enabled; + } + + /** + * @return Whether Whop's platform default payment method enablement settings are included in this configuration. The full list of default payment methods can be found in the documentation at docs.whop.com/payments. + */ + @JsonIgnore + public Optional getIncludePlatformDefaults() { + if (includePlatformDefaults == null) { + return Optional.empty(); + } + return includePlatformDefaults; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("include_platform_defaults") + private Optional _getIncludePlatformDefaults() { + return includePlatformDefaults; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateInvoicesRequestProductIdPlanPaymentMethodConfiguration + && equalTo((CreateInvoicesRequestProductIdPlanPaymentMethodConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateInvoicesRequestProductIdPlanPaymentMethodConfiguration other) { + return disabled.equals(other.disabled) + && enabled.equals(other.enabled) + && includePlatformDefaults.equals(other.includePlatformDefaults); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.disabled, this.enabled, this.includePlatformDefaults); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List disabled = new ArrayList<>(); + + private List enabled = new ArrayList<>(); + + private Optional includePlatformDefaults = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateInvoicesRequestProductIdPlanPaymentMethodConfiguration other) { + disabled(other.getDisabled()); + enabled(other.getEnabled()); + includePlatformDefaults(other.getIncludePlatformDefaults()); + return this; + } + + /** + *

An array of payment method identifiers that are explicitly disabled. Only applies if the include_platform_defaults is true.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(List disabled) { + this.disabled.clear(); + if (disabled != null) { + this.disabled.addAll(disabled); + } + return this; + } + + public Builder addDisabled(PaymentMethodTypes disabled) { + this.disabled.add(disabled); + return this; + } + + public Builder addAllDisabled(List disabled) { + if (disabled != null) { + this.disabled.addAll(disabled); + } + return this; + } + + /** + *

An array of payment method identifiers that are explicitly enabled. This means these payment methods will be shown on checkout. Example use case is to only enable a specific payment method like cashapp, or extending the platform defaults with additional methods.

+ */ + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(List enabled) { + this.enabled.clear(); + if (enabled != null) { + this.enabled.addAll(enabled); + } + return this; + } + + public Builder addEnabled(PaymentMethodTypes enabled) { + this.enabled.add(enabled); + return this; + } + + public Builder addAllEnabled(List enabled) { + if (enabled != null) { + this.enabled.addAll(enabled); + } + return this; + } + + /** + *

Whether Whop's platform default payment method enablement settings are included in this configuration. The full list of default payment methods can be found in the documentation at docs.whop.com/payments.

+ */ + @JsonSetter(value = "include_platform_defaults", nulls = Nulls.SKIP) + public Builder includePlatformDefaults(Optional includePlatformDefaults) { + this.includePlatformDefaults = includePlatformDefaults; + return this; + } + + public Builder includePlatformDefaults(Boolean includePlatformDefaults) { + this.includePlatformDefaults = Optional.ofNullable(includePlatformDefaults); + return this; + } + + public Builder includePlatformDefaults(Nullable includePlatformDefaults) { + if (includePlatformDefaults.isNull()) { + this.includePlatformDefaults = null; + } else if (includePlatformDefaults.isEmpty()) { + this.includePlatformDefaults = Optional.empty(); + } else { + this.includePlatformDefaults = Optional.of(includePlatformDefaults.get()); + } + return this; + } + + public CreateInvoicesRequestProductIdPlanPaymentMethodConfiguration build() { + return new CreateInvoicesRequestProductIdPlanPaymentMethodConfiguration( + disabled, enabled, includePlatformDefaults, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductLineItemsItem.java b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductLineItemsItem.java new file mode 100644 index 00000000..23bf2766 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductLineItemsItem.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateInvoicesRequestProductLineItemsItem.Builder.class) +public final class CreateInvoicesRequestProductLineItemsItem { + private final String label; + + private final Optional quantity; + + private final double unitPrice; + + private final Map additionalProperties; + + private CreateInvoicesRequestProductLineItemsItem( + String label, Optional quantity, double unitPrice, Map additionalProperties) { + this.label = label; + this.quantity = quantity; + this.unitPrice = unitPrice; + this.additionalProperties = additionalProperties; + } + + /** + * @return The label or description for this line item. + */ + @JsonProperty("label") + public String getLabel() { + return label; + } + + /** + * @return The quantity of this line item. Defaults to 1. + */ + @JsonIgnore + public Optional getQuantity() { + if (quantity == null) { + return Optional.empty(); + } + return quantity; + } + + /** + * @return The unit price for this line item. Provided as a number in the specified currency. Eg: 10.43 for $10.43 + */ + @JsonProperty("unit_price") + public double getUnitPrice() { + return unitPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("quantity") + private Optional _getQuantity() { + return quantity; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateInvoicesRequestProductLineItemsItem + && equalTo((CreateInvoicesRequestProductLineItemsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateInvoicesRequestProductLineItemsItem other) { + return label.equals(other.label) && quantity.equals(other.quantity) && unitPrice == other.unitPrice; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.label, this.quantity, this.unitPrice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LabelStage builder() { + return new Builder(); + } + + public interface LabelStage { + /** + *

The label or description for this line item.

+ */ + UnitPriceStage label(@NotNull String label); + + Builder from(CreateInvoicesRequestProductLineItemsItem other); + } + + public interface UnitPriceStage { + /** + *

The unit price for this line item. Provided as a number in the specified currency. Eg: 10.43 for $10.43

+ */ + _FinalStage unitPrice(double unitPrice); + } + + public interface _FinalStage { + CreateInvoicesRequestProductLineItemsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The quantity of this line item. Defaults to 1.

+ */ + _FinalStage quantity(Optional quantity); + + _FinalStage quantity(Double quantity); + + _FinalStage quantity(Nullable quantity); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LabelStage, UnitPriceStage, _FinalStage { + private String label; + + private double unitPrice; + + private Optional quantity = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateInvoicesRequestProductLineItemsItem other) { + label(other.getLabel()); + quantity(other.getQuantity()); + unitPrice(other.getUnitPrice()); + return this; + } + + /** + *

The label or description for this line item.

+ *

The label or description for this line item.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("label") + public UnitPriceStage label(@NotNull String label) { + this.label = Objects.requireNonNull(label, "label must not be null"); + return this; + } + + /** + *

The unit price for this line item. Provided as a number in the specified currency. Eg: 10.43 for $10.43

+ *

The unit price for this line item. Provided as a number in the specified currency. Eg: 10.43 for $10.43

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("unit_price") + public _FinalStage unitPrice(double unitPrice) { + this.unitPrice = unitPrice; + return this; + } + + /** + *

The quantity of this line item. Defaults to 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quantity(Nullable quantity) { + if (quantity.isNull()) { + this.quantity = null; + } else if (quantity.isEmpty()) { + this.quantity = Optional.empty(); + } else { + this.quantity = Optional.of(quantity.get()); + } + return this; + } + + /** + *

The quantity of this line item. Defaults to 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quantity(Double quantity) { + this.quantity = Optional.ofNullable(quantity); + return this; + } + + /** + *

The quantity of this line item. Defaults to 1.

+ */ + @java.lang.Override + @JsonSetter(value = "quantity", nulls = Nulls.SKIP) + public _FinalStage quantity(Optional quantity) { + this.quantity = quantity; + return this; + } + + @java.lang.Override + public CreateInvoicesRequestProductLineItemsItem build() { + return new CreateInvoicesRequestProductLineItemsItem(label, quantity, unitPrice, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductPlan.java b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductPlan.java new file mode 100644 index 00000000..c10710af --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductPlan.java @@ -0,0 +1,980 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Currencies; +import com.whop.api.types.PlanTypes; +import com.whop.api.types.ReleaseMethod; +import com.whop.api.types.Visibility; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateInvoicesRequestProductPlan.Builder.class) +public final class CreateInvoicesRequestProductPlan { + private final Optional adaptivePricingEnabled; + + private final Optional billingPeriod; + + private final Optional currency; + + private final Optional> customFields; + + private final Optional description; + + private final Optional expirationDays; + + private final Optional initialPrice; + + private final Optional internalNotes; + + private final Optional legacyPaymentMethodControls; + + private final Optional paymentMethodConfiguration; + + private final Optional planType; + + private final Optional releaseMethod; + + private final Optional renewalPrice; + + private final Optional stock; + + private final Optional trialPeriodDays; + + private final Optional unlimitedStock; + + private final Optional visibility; + + private final Map additionalProperties; + + private CreateInvoicesRequestProductPlan( + Optional adaptivePricingEnabled, + Optional billingPeriod, + Optional currency, + Optional> customFields, + Optional description, + Optional expirationDays, + Optional initialPrice, + Optional internalNotes, + Optional legacyPaymentMethodControls, + Optional paymentMethodConfiguration, + Optional planType, + Optional releaseMethod, + Optional renewalPrice, + Optional stock, + Optional trialPeriodDays, + Optional unlimitedStock, + Optional visibility, + Map additionalProperties) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + this.billingPeriod = billingPeriod; + this.currency = currency; + this.customFields = customFields; + this.description = description; + this.expirationDays = expirationDays; + this.initialPrice = initialPrice; + this.internalNotes = internalNotes; + this.legacyPaymentMethodControls = legacyPaymentMethodControls; + this.paymentMethodConfiguration = paymentMethodConfiguration; + this.planType = planType; + this.releaseMethod = releaseMethod; + this.renewalPrice = renewalPrice; + this.stock = stock; + this.trialPeriodDays = trialPeriodDays; + this.unlimitedStock = unlimitedStock; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether this plan accepts local currency payments via adaptive pricing. + */ + @JsonIgnore + public Optional getAdaptivePricingEnabled() { + if (adaptivePricingEnabled == null) { + return Optional.empty(); + } + return adaptivePricingEnabled; + } + + /** + * @return The interval in days at which the plan charges (renewal plans). + */ + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + /** + * @return The three-letter ISO currency code for the plan's pricing. Defaults to USD. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return An array of custom field objects. + */ + @JsonIgnore + public Optional> getCustomFields() { + if (customFields == null) { + return Optional.empty(); + } + return customFields; + } + + /** + * @return The description of the plan. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The number of days until the membership expires and revokes access (expiration plans). For example, 365 for a one-year access period. + */ + @JsonIgnore + public Optional getExpirationDays() { + if (expirationDays == null) { + return Optional.empty(); + } + return expirationDays; + } + + /** + * @return An additional amount charged upon first purchase. Use only if a one time payment OR you want to charge an additional amount on top of the renewal price. Provided as a number in the specified currency. Eg: 10.43 for $10.43 + */ + @JsonIgnore + public Optional getInitialPrice() { + if (initialPrice == null) { + return Optional.empty(); + } + return initialPrice; + } + + /** + * @return A personal description or notes section for the business. + */ + @JsonIgnore + public Optional getInternalNotes() { + if (internalNotes == null) { + return Optional.empty(); + } + return internalNotes; + } + + /** + * @return Whether this plan uses legacy payment method controls + */ + @JsonIgnore + public Optional getLegacyPaymentMethodControls() { + if (legacyPaymentMethodControls == null) { + return Optional.empty(); + } + return legacyPaymentMethodControls; + } + + /** + * @return The explicit payment method configuration for the plan. If not provided, the platform or company's defaults will apply. + */ + @JsonIgnore + public Optional getPaymentMethodConfiguration() { + if (paymentMethodConfiguration == null) { + return Optional.empty(); + } + return paymentMethodConfiguration; + } + + /** + * @return Indicates if the plan is a one time payment or recurring. + */ + @JsonIgnore + public Optional getPlanType() { + if (planType == null) { + return Optional.empty(); + } + return planType; + } + + /** + * @return This is the release method the business uses to sell this plan. + */ + @JsonIgnore + public Optional getReleaseMethod() { + if (releaseMethod == null) { + return Optional.empty(); + } + return releaseMethod; + } + + /** + * @return The amount the customer is charged every billing period. Use only if a recurring payment. Provided as a number in the specified currency. Eg: 10.43 for $10.43 + */ + @JsonIgnore + public Optional getRenewalPrice() { + if (renewalPrice == null) { + return Optional.empty(); + } + return renewalPrice; + } + + /** + * @return The number of units available for purchase. + */ + @JsonIgnore + public Optional getStock() { + if (stock == null) { + return Optional.empty(); + } + return stock; + } + + /** + * @return The number of free trial days added before a renewal plan. + */ + @JsonIgnore + public Optional getTrialPeriodDays() { + if (trialPeriodDays == null) { + return Optional.empty(); + } + return trialPeriodDays; + } + + /** + * @return When true, the plan has unlimited stock (stock field is ignored). When false, purchases are limited by the stock field. + */ + @JsonIgnore + public Optional getUnlimitedStock() { + if (unlimitedStock == null) { + return Optional.empty(); + } + return unlimitedStock; + } + + /** + * @return Shows or hides the plan from public/business view. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("adaptive_pricing_enabled") + private Optional _getAdaptivePricingEnabled() { + return adaptivePricingEnabled; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_fields") + private Optional> _getCustomFields() { + return customFields; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_days") + private Optional _getExpirationDays() { + return expirationDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("initial_price") + private Optional _getInitialPrice() { + return initialPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("internal_notes") + private Optional _getInternalNotes() { + return internalNotes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("legacy_payment_method_controls") + private Optional _getLegacyPaymentMethodControls() { + return legacyPaymentMethodControls; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_configuration") + private Optional _getPaymentMethodConfiguration() { + return paymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan_type") + private Optional _getPlanType() { + return planType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("release_method") + private Optional _getReleaseMethod() { + return releaseMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("renewal_price") + private Optional _getRenewalPrice() { + return renewalPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("stock") + private Optional _getStock() { + return stock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trial_period_days") + private Optional _getTrialPeriodDays() { + return trialPeriodDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("unlimited_stock") + private Optional _getUnlimitedStock() { + return unlimitedStock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateInvoicesRequestProductPlan && equalTo((CreateInvoicesRequestProductPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateInvoicesRequestProductPlan other) { + return adaptivePricingEnabled.equals(other.adaptivePricingEnabled) + && billingPeriod.equals(other.billingPeriod) + && currency.equals(other.currency) + && customFields.equals(other.customFields) + && description.equals(other.description) + && expirationDays.equals(other.expirationDays) + && initialPrice.equals(other.initialPrice) + && internalNotes.equals(other.internalNotes) + && legacyPaymentMethodControls.equals(other.legacyPaymentMethodControls) + && paymentMethodConfiguration.equals(other.paymentMethodConfiguration) + && planType.equals(other.planType) + && releaseMethod.equals(other.releaseMethod) + && renewalPrice.equals(other.renewalPrice) + && stock.equals(other.stock) + && trialPeriodDays.equals(other.trialPeriodDays) + && unlimitedStock.equals(other.unlimitedStock) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adaptivePricingEnabled, + this.billingPeriod, + this.currency, + this.customFields, + this.description, + this.expirationDays, + this.initialPrice, + this.internalNotes, + this.legacyPaymentMethodControls, + this.paymentMethodConfiguration, + this.planType, + this.releaseMethod, + this.renewalPrice, + this.stock, + this.trialPeriodDays, + this.unlimitedStock, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional adaptivePricingEnabled = Optional.empty(); + + private Optional billingPeriod = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional> customFields = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional expirationDays = Optional.empty(); + + private Optional initialPrice = Optional.empty(); + + private Optional internalNotes = Optional.empty(); + + private Optional legacyPaymentMethodControls = Optional.empty(); + + private Optional paymentMethodConfiguration = + Optional.empty(); + + private Optional planType = Optional.empty(); + + private Optional releaseMethod = Optional.empty(); + + private Optional renewalPrice = Optional.empty(); + + private Optional stock = Optional.empty(); + + private Optional trialPeriodDays = Optional.empty(); + + private Optional unlimitedStock = Optional.empty(); + + private Optional visibility = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateInvoicesRequestProductPlan other) { + adaptivePricingEnabled(other.getAdaptivePricingEnabled()); + billingPeriod(other.getBillingPeriod()); + currency(other.getCurrency()); + customFields(other.getCustomFields()); + description(other.getDescription()); + expirationDays(other.getExpirationDays()); + initialPrice(other.getInitialPrice()); + internalNotes(other.getInternalNotes()); + legacyPaymentMethodControls(other.getLegacyPaymentMethodControls()); + paymentMethodConfiguration(other.getPaymentMethodConfiguration()); + planType(other.getPlanType()); + releaseMethod(other.getReleaseMethod()); + renewalPrice(other.getRenewalPrice()); + stock(other.getStock()); + trialPeriodDays(other.getTrialPeriodDays()); + unlimitedStock(other.getUnlimitedStock()); + visibility(other.getVisibility()); + return this; + } + + /** + *

Whether this plan accepts local currency payments via adaptive pricing.

+ */ + @JsonSetter(value = "adaptive_pricing_enabled", nulls = Nulls.SKIP) + public Builder adaptivePricingEnabled(Optional adaptivePricingEnabled) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + return this; + } + + public Builder adaptivePricingEnabled(Boolean adaptivePricingEnabled) { + this.adaptivePricingEnabled = Optional.ofNullable(adaptivePricingEnabled); + return this; + } + + public Builder adaptivePricingEnabled(Nullable adaptivePricingEnabled) { + if (adaptivePricingEnabled.isNull()) { + this.adaptivePricingEnabled = null; + } else if (adaptivePricingEnabled.isEmpty()) { + this.adaptivePricingEnabled = Optional.empty(); + } else { + this.adaptivePricingEnabled = Optional.of(adaptivePricingEnabled.get()); + } + return this; + } + + /** + *

The interval in days at which the plan charges (renewal plans).

+ */ + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public Builder billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + public Builder billingPeriod(Integer billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + public Builder billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + /** + *

The three-letter ISO currency code for the plan's pricing. Defaults to USD.

+ */ + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional currency) { + this.currency = currency; + return this; + } + + public Builder currency(Currencies currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + public Builder currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

An array of custom field objects.

+ */ + @JsonSetter(value = "custom_fields", nulls = Nulls.SKIP) + public Builder customFields(Optional> customFields) { + this.customFields = customFields; + return this; + } + + public Builder customFields(List customFields) { + this.customFields = Optional.ofNullable(customFields); + return this; + } + + public Builder customFields(Nullable> customFields) { + if (customFields.isNull()) { + this.customFields = null; + } else if (customFields.isEmpty()) { + this.customFields = Optional.empty(); + } else { + this.customFields = Optional.of(customFields.get()); + } + return this; + } + + /** + *

The description of the plan.

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public Builder description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

The number of days until the membership expires and revokes access (expiration plans). For example, 365 for a one-year access period.

+ */ + @JsonSetter(value = "expiration_days", nulls = Nulls.SKIP) + public Builder expirationDays(Optional expirationDays) { + this.expirationDays = expirationDays; + return this; + } + + public Builder expirationDays(Integer expirationDays) { + this.expirationDays = Optional.ofNullable(expirationDays); + return this; + } + + public Builder expirationDays(Nullable expirationDays) { + if (expirationDays.isNull()) { + this.expirationDays = null; + } else if (expirationDays.isEmpty()) { + this.expirationDays = Optional.empty(); + } else { + this.expirationDays = Optional.of(expirationDays.get()); + } + return this; + } + + /** + *

An additional amount charged upon first purchase. Use only if a one time payment OR you want to charge an additional amount on top of the renewal price. Provided as a number in the specified currency. Eg: 10.43 for $10.43

+ */ + @JsonSetter(value = "initial_price", nulls = Nulls.SKIP) + public Builder initialPrice(Optional initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + public Builder initialPrice(Double initialPrice) { + this.initialPrice = Optional.ofNullable(initialPrice); + return this; + } + + public Builder initialPrice(Nullable initialPrice) { + if (initialPrice.isNull()) { + this.initialPrice = null; + } else if (initialPrice.isEmpty()) { + this.initialPrice = Optional.empty(); + } else { + this.initialPrice = Optional.of(initialPrice.get()); + } + return this; + } + + /** + *

A personal description or notes section for the business.

+ */ + @JsonSetter(value = "internal_notes", nulls = Nulls.SKIP) + public Builder internalNotes(Optional internalNotes) { + this.internalNotes = internalNotes; + return this; + } + + public Builder internalNotes(String internalNotes) { + this.internalNotes = Optional.ofNullable(internalNotes); + return this; + } + + public Builder internalNotes(Nullable internalNotes) { + if (internalNotes.isNull()) { + this.internalNotes = null; + } else if (internalNotes.isEmpty()) { + this.internalNotes = Optional.empty(); + } else { + this.internalNotes = Optional.of(internalNotes.get()); + } + return this; + } + + /** + *

Whether this plan uses legacy payment method controls

+ */ + @JsonSetter(value = "legacy_payment_method_controls", nulls = Nulls.SKIP) + public Builder legacyPaymentMethodControls(Optional legacyPaymentMethodControls) { + this.legacyPaymentMethodControls = legacyPaymentMethodControls; + return this; + } + + public Builder legacyPaymentMethodControls(Boolean legacyPaymentMethodControls) { + this.legacyPaymentMethodControls = Optional.ofNullable(legacyPaymentMethodControls); + return this; + } + + public Builder legacyPaymentMethodControls(Nullable legacyPaymentMethodControls) { + if (legacyPaymentMethodControls.isNull()) { + this.legacyPaymentMethodControls = null; + } else if (legacyPaymentMethodControls.isEmpty()) { + this.legacyPaymentMethodControls = Optional.empty(); + } else { + this.legacyPaymentMethodControls = Optional.of(legacyPaymentMethodControls.get()); + } + return this; + } + + /** + *

The explicit payment method configuration for the plan. If not provided, the platform or company's defaults will apply.

+ */ + @JsonSetter(value = "payment_method_configuration", nulls = Nulls.SKIP) + public Builder paymentMethodConfiguration( + Optional paymentMethodConfiguration) { + this.paymentMethodConfiguration = paymentMethodConfiguration; + return this; + } + + public Builder paymentMethodConfiguration( + CreateInvoicesRequestProductPlanPaymentMethodConfiguration paymentMethodConfiguration) { + this.paymentMethodConfiguration = Optional.ofNullable(paymentMethodConfiguration); + return this; + } + + public Builder paymentMethodConfiguration( + Nullable paymentMethodConfiguration) { + if (paymentMethodConfiguration.isNull()) { + this.paymentMethodConfiguration = null; + } else if (paymentMethodConfiguration.isEmpty()) { + this.paymentMethodConfiguration = Optional.empty(); + } else { + this.paymentMethodConfiguration = Optional.of(paymentMethodConfiguration.get()); + } + return this; + } + + /** + *

Indicates if the plan is a one time payment or recurring.

+ */ + @JsonSetter(value = "plan_type", nulls = Nulls.SKIP) + public Builder planType(Optional planType) { + this.planType = planType; + return this; + } + + public Builder planType(PlanTypes planType) { + this.planType = Optional.ofNullable(planType); + return this; + } + + public Builder planType(Nullable planType) { + if (planType.isNull()) { + this.planType = null; + } else if (planType.isEmpty()) { + this.planType = Optional.empty(); + } else { + this.planType = Optional.of(planType.get()); + } + return this; + } + + /** + *

This is the release method the business uses to sell this plan.

+ */ + @JsonSetter(value = "release_method", nulls = Nulls.SKIP) + public Builder releaseMethod(Optional releaseMethod) { + this.releaseMethod = releaseMethod; + return this; + } + + public Builder releaseMethod(ReleaseMethod releaseMethod) { + this.releaseMethod = Optional.ofNullable(releaseMethod); + return this; + } + + public Builder releaseMethod(Nullable releaseMethod) { + if (releaseMethod.isNull()) { + this.releaseMethod = null; + } else if (releaseMethod.isEmpty()) { + this.releaseMethod = Optional.empty(); + } else { + this.releaseMethod = Optional.of(releaseMethod.get()); + } + return this; + } + + /** + *

The amount the customer is charged every billing period. Use only if a recurring payment. Provided as a number in the specified currency. Eg: 10.43 for $10.43

+ */ + @JsonSetter(value = "renewal_price", nulls = Nulls.SKIP) + public Builder renewalPrice(Optional renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + public Builder renewalPrice(Double renewalPrice) { + this.renewalPrice = Optional.ofNullable(renewalPrice); + return this; + } + + public Builder renewalPrice(Nullable renewalPrice) { + if (renewalPrice.isNull()) { + this.renewalPrice = null; + } else if (renewalPrice.isEmpty()) { + this.renewalPrice = Optional.empty(); + } else { + this.renewalPrice = Optional.of(renewalPrice.get()); + } + return this; + } + + /** + *

The number of units available for purchase.

+ */ + @JsonSetter(value = "stock", nulls = Nulls.SKIP) + public Builder stock(Optional stock) { + this.stock = stock; + return this; + } + + public Builder stock(Integer stock) { + this.stock = Optional.ofNullable(stock); + return this; + } + + public Builder stock(Nullable stock) { + if (stock.isNull()) { + this.stock = null; + } else if (stock.isEmpty()) { + this.stock = Optional.empty(); + } else { + this.stock = Optional.of(stock.get()); + } + return this; + } + + /** + *

The number of free trial days added before a renewal plan.

+ */ + @JsonSetter(value = "trial_period_days", nulls = Nulls.SKIP) + public Builder trialPeriodDays(Optional trialPeriodDays) { + this.trialPeriodDays = trialPeriodDays; + return this; + } + + public Builder trialPeriodDays(Integer trialPeriodDays) { + this.trialPeriodDays = Optional.ofNullable(trialPeriodDays); + return this; + } + + public Builder trialPeriodDays(Nullable trialPeriodDays) { + if (trialPeriodDays.isNull()) { + this.trialPeriodDays = null; + } else if (trialPeriodDays.isEmpty()) { + this.trialPeriodDays = Optional.empty(); + } else { + this.trialPeriodDays = Optional.of(trialPeriodDays.get()); + } + return this; + } + + /** + *

When true, the plan has unlimited stock (stock field is ignored). When false, purchases are limited by the stock field.

+ */ + @JsonSetter(value = "unlimited_stock", nulls = Nulls.SKIP) + public Builder unlimitedStock(Optional unlimitedStock) { + this.unlimitedStock = unlimitedStock; + return this; + } + + public Builder unlimitedStock(Boolean unlimitedStock) { + this.unlimitedStock = Optional.ofNullable(unlimitedStock); + return this; + } + + public Builder unlimitedStock(Nullable unlimitedStock) { + if (unlimitedStock.isNull()) { + this.unlimitedStock = null; + } else if (unlimitedStock.isEmpty()) { + this.unlimitedStock = Optional.empty(); + } else { + this.unlimitedStock = Optional.of(unlimitedStock.get()); + } + return this; + } + + /** + *

Shows or hides the plan from public/business view.

+ */ + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public Builder visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + public Builder visibility(Visibility visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + public Builder visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + public CreateInvoicesRequestProductPlan build() { + return new CreateInvoicesRequestProductPlan( + adaptivePricingEnabled, + billingPeriod, + currency, + customFields, + description, + expirationDays, + initialPrice, + internalNotes, + legacyPaymentMethodControls, + paymentMethodConfiguration, + planType, + releaseMethod, + renewalPrice, + stock, + trialPeriodDays, + unlimitedStock, + visibility, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductPlanCustomFieldsItem.java b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductPlanCustomFieldsItem.java new file mode 100644 index 00000000..a7fb95e7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductPlanCustomFieldsItem.java @@ -0,0 +1,454 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CustomFieldTypes; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateInvoicesRequestProductPlanCustomFieldsItem.Builder.class) +public final class CreateInvoicesRequestProductPlanCustomFieldsItem { + private final CustomFieldTypes fieldType; + + private final Optional id; + + private final String name; + + private final Optional order; + + private final Optional placeholder; + + private final Optional required; + + private final Map additionalProperties; + + private CreateInvoicesRequestProductPlanCustomFieldsItem( + CustomFieldTypes fieldType, + Optional id, + String name, + Optional order, + Optional placeholder, + Optional required, + Map additionalProperties) { + this.fieldType = fieldType; + this.id = id; + this.name = name; + this.order = order; + this.placeholder = placeholder; + this.required = required; + this.additionalProperties = additionalProperties; + } + + /** + * @return The type of the custom field. + */ + @JsonProperty("field_type") + public CustomFieldTypes getFieldType() { + return fieldType; + } + + /** + * @return The ID of the custom field (if being updated) + */ + @JsonIgnore + public Optional getId() { + if (id == null) { + return Optional.empty(); + } + return id; + } + + /** + * @return The name of the custom field. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The order of the field. + */ + @JsonIgnore + public Optional getOrder() { + if (order == null) { + return Optional.empty(); + } + return order; + } + + /** + * @return The placeholder value of the field. + */ + @JsonIgnore + public Optional getPlaceholder() { + if (placeholder == null) { + return Optional.empty(); + } + return placeholder; + } + + /** + * @return Whether or not the field is required. + */ + @JsonIgnore + public Optional getRequired() { + if (required == null) { + return Optional.empty(); + } + return required; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("id") + private Optional _getId() { + return id; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("order") + private Optional _getOrder() { + return order; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("placeholder") + private Optional _getPlaceholder() { + return placeholder; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("required") + private Optional _getRequired() { + return required; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateInvoicesRequestProductPlanCustomFieldsItem + && equalTo((CreateInvoicesRequestProductPlanCustomFieldsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateInvoicesRequestProductPlanCustomFieldsItem other) { + return fieldType.equals(other.fieldType) + && id.equals(other.id) + && name.equals(other.name) + && order.equals(other.order) + && placeholder.equals(other.placeholder) + && required.equals(other.required); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fieldType, this.id, this.name, this.order, this.placeholder, this.required); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FieldTypeStage builder() { + return new Builder(); + } + + public interface FieldTypeStage { + /** + *

The type of the custom field.

+ */ + NameStage fieldType(@NotNull CustomFieldTypes fieldType); + + Builder from(CreateInvoicesRequestProductPlanCustomFieldsItem other); + } + + public interface NameStage { + /** + *

The name of the custom field.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + CreateInvoicesRequestProductPlanCustomFieldsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The ID of the custom field (if being updated)

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + + _FinalStage id(Nullable id); + + /** + *

The order of the field.

+ */ + _FinalStage order(Optional order); + + _FinalStage order(Integer order); + + _FinalStage order(Nullable order); + + /** + *

The placeholder value of the field.

+ */ + _FinalStage placeholder(Optional placeholder); + + _FinalStage placeholder(String placeholder); + + _FinalStage placeholder(Nullable placeholder); + + /** + *

Whether or not the field is required.

+ */ + _FinalStage required(Optional required); + + _FinalStage required(Boolean required); + + _FinalStage required(Nullable required); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FieldTypeStage, NameStage, _FinalStage { + private CustomFieldTypes fieldType; + + private String name; + + private Optional required = Optional.empty(); + + private Optional placeholder = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateInvoicesRequestProductPlanCustomFieldsItem other) { + fieldType(other.getFieldType()); + id(other.getId()); + name(other.getName()); + order(other.getOrder()); + placeholder(other.getPlaceholder()); + required(other.getRequired()); + return this; + } + + /** + *

The type of the custom field.

+ *

The type of the custom field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("field_type") + public NameStage fieldType(@NotNull CustomFieldTypes fieldType) { + this.fieldType = Objects.requireNonNull(fieldType, "fieldType must not be null"); + return this; + } + + /** + *

The name of the custom field.

+ *

The name of the custom field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

Whether or not the field is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage required(Nullable required) { + if (required.isNull()) { + this.required = null; + } else if (required.isEmpty()) { + this.required = Optional.empty(); + } else { + this.required = Optional.of(required.get()); + } + return this; + } + + /** + *

Whether or not the field is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage required(Boolean required) { + this.required = Optional.ofNullable(required); + return this; + } + + /** + *

Whether or not the field is required.

+ */ + @java.lang.Override + @JsonSetter(value = "required", nulls = Nulls.SKIP) + public _FinalStage required(Optional required) { + this.required = required; + return this; + } + + /** + *

The placeholder value of the field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage placeholder(Nullable placeholder) { + if (placeholder.isNull()) { + this.placeholder = null; + } else if (placeholder.isEmpty()) { + this.placeholder = Optional.empty(); + } else { + this.placeholder = Optional.of(placeholder.get()); + } + return this; + } + + /** + *

The placeholder value of the field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage placeholder(String placeholder) { + this.placeholder = Optional.ofNullable(placeholder); + return this; + } + + /** + *

The placeholder value of the field.

+ */ + @java.lang.Override + @JsonSetter(value = "placeholder", nulls = Nulls.SKIP) + public _FinalStage placeholder(Optional placeholder) { + this.placeholder = placeholder; + return this; + } + + /** + *

The order of the field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(Nullable order) { + if (order.isNull()) { + this.order = null; + } else if (order.isEmpty()) { + this.order = Optional.empty(); + } else { + this.order = Optional.of(order.get()); + } + return this; + } + + /** + *

The order of the field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(Integer order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The order of the field.

+ */ + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + /** + *

The ID of the custom field (if being updated)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(Nullable id) { + if (id.isNull()) { + this.id = null; + } else if (id.isEmpty()) { + this.id = Optional.empty(); + } else { + this.id = Optional.of(id.get()); + } + return this; + } + + /** + *

The ID of the custom field (if being updated)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The ID of the custom field (if being updated)

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public CreateInvoicesRequestProductPlanCustomFieldsItem build() { + return new CreateInvoicesRequestProductPlanCustomFieldsItem( + fieldType, id, name, order, placeholder, required, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductPlanPaymentMethodConfiguration.java b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductPlanPaymentMethodConfiguration.java new file mode 100644 index 00000000..f5d38a2c --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductPlanPaymentMethodConfiguration.java @@ -0,0 +1,221 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PaymentMethodTypes; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateInvoicesRequestProductPlanPaymentMethodConfiguration.Builder.class) +public final class CreateInvoicesRequestProductPlanPaymentMethodConfiguration { + private final List disabled; + + private final List enabled; + + private final Optional includePlatformDefaults; + + private final Map additionalProperties; + + private CreateInvoicesRequestProductPlanPaymentMethodConfiguration( + List disabled, + List enabled, + Optional includePlatformDefaults, + Map additionalProperties) { + this.disabled = disabled; + this.enabled = enabled; + this.includePlatformDefaults = includePlatformDefaults; + this.additionalProperties = additionalProperties; + } + + /** + * @return An array of payment method identifiers that are explicitly disabled. Only applies if the include_platform_defaults is true. + */ + @JsonProperty("disabled") + public List getDisabled() { + return disabled; + } + + /** + * @return An array of payment method identifiers that are explicitly enabled. This means these payment methods will be shown on checkout. Example use case is to only enable a specific payment method like cashapp, or extending the platform defaults with additional methods. + */ + @JsonProperty("enabled") + public List getEnabled() { + return enabled; + } + + /** + * @return Whether Whop's platform default payment method enablement settings are included in this configuration. The full list of default payment methods can be found in the documentation at docs.whop.com/payments. + */ + @JsonIgnore + public Optional getIncludePlatformDefaults() { + if (includePlatformDefaults == null) { + return Optional.empty(); + } + return includePlatformDefaults; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("include_platform_defaults") + private Optional _getIncludePlatformDefaults() { + return includePlatformDefaults; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateInvoicesRequestProductPlanPaymentMethodConfiguration + && equalTo((CreateInvoicesRequestProductPlanPaymentMethodConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateInvoicesRequestProductPlanPaymentMethodConfiguration other) { + return disabled.equals(other.disabled) + && enabled.equals(other.enabled) + && includePlatformDefaults.equals(other.includePlatformDefaults); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.disabled, this.enabled, this.includePlatformDefaults); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List disabled = new ArrayList<>(); + + private List enabled = new ArrayList<>(); + + private Optional includePlatformDefaults = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateInvoicesRequestProductPlanPaymentMethodConfiguration other) { + disabled(other.getDisabled()); + enabled(other.getEnabled()); + includePlatformDefaults(other.getIncludePlatformDefaults()); + return this; + } + + /** + *

An array of payment method identifiers that are explicitly disabled. Only applies if the include_platform_defaults is true.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(List disabled) { + this.disabled.clear(); + if (disabled != null) { + this.disabled.addAll(disabled); + } + return this; + } + + public Builder addDisabled(PaymentMethodTypes disabled) { + this.disabled.add(disabled); + return this; + } + + public Builder addAllDisabled(List disabled) { + if (disabled != null) { + this.disabled.addAll(disabled); + } + return this; + } + + /** + *

An array of payment method identifiers that are explicitly enabled. This means these payment methods will be shown on checkout. Example use case is to only enable a specific payment method like cashapp, or extending the platform defaults with additional methods.

+ */ + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(List enabled) { + this.enabled.clear(); + if (enabled != null) { + this.enabled.addAll(enabled); + } + return this; + } + + public Builder addEnabled(PaymentMethodTypes enabled) { + this.enabled.add(enabled); + return this; + } + + public Builder addAllEnabled(List enabled) { + if (enabled != null) { + this.enabled.addAll(enabled); + } + return this; + } + + /** + *

Whether Whop's platform default payment method enablement settings are included in this configuration. The full list of default payment methods can be found in the documentation at docs.whop.com/payments.

+ */ + @JsonSetter(value = "include_platform_defaults", nulls = Nulls.SKIP) + public Builder includePlatformDefaults(Optional includePlatformDefaults) { + this.includePlatformDefaults = includePlatformDefaults; + return this; + } + + public Builder includePlatformDefaults(Boolean includePlatformDefaults) { + this.includePlatformDefaults = Optional.ofNullable(includePlatformDefaults); + return this; + } + + public Builder includePlatformDefaults(Nullable includePlatformDefaults) { + if (includePlatformDefaults.isNull()) { + this.includePlatformDefaults = null; + } else if (includePlatformDefaults.isEmpty()) { + this.includePlatformDefaults = Optional.empty(); + } else { + this.includePlatformDefaults = Optional.of(includePlatformDefaults.get()); + } + return this; + } + + public CreateInvoicesRequestProductPlanPaymentMethodConfiguration build() { + return new CreateInvoicesRequestProductPlanPaymentMethodConfiguration( + disabled, enabled, includePlatformDefaults, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductProduct.java b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductProduct.java new file mode 100644 index 00000000..8140b7c6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/CreateInvoicesRequestProductProduct.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateInvoicesRequestProductProduct.Builder.class) +public final class CreateInvoicesRequestProductProduct { + private final Optional productTaxCodeId; + + private final String title; + + private final Map additionalProperties; + + private CreateInvoicesRequestProductProduct( + Optional productTaxCodeId, String title, Map additionalProperties) { + this.productTaxCodeId = productTaxCodeId; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the product tax code to apply to this product. + */ + @JsonIgnore + public Optional getProductTaxCodeId() { + if (productTaxCodeId == null) { + return Optional.empty(); + } + return productTaxCodeId; + } + + /** + * @return The title of the product. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_tax_code_id") + private Optional _getProductTaxCodeId() { + return productTaxCodeId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateInvoicesRequestProductProduct + && equalTo((CreateInvoicesRequestProductProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateInvoicesRequestProductProduct other) { + return productTaxCodeId.equals(other.productTaxCodeId) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.productTaxCodeId, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TitleStage builder() { + return new Builder(); + } + + public interface TitleStage { + /** + *

The title of the product.

+ */ + _FinalStage title(@NotNull String title); + + Builder from(CreateInvoicesRequestProductProduct other); + } + + public interface _FinalStage { + CreateInvoicesRequestProductProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The ID of the product tax code to apply to this product.

+ */ + _FinalStage productTaxCodeId(Optional productTaxCodeId); + + _FinalStage productTaxCodeId(String productTaxCodeId); + + _FinalStage productTaxCodeId(Nullable productTaxCodeId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TitleStage, _FinalStage { + private String title; + + private Optional productTaxCodeId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateInvoicesRequestProductProduct other) { + productTaxCodeId(other.getProductTaxCodeId()); + title(other.getTitle()); + return this; + } + + /** + *

The title of the product.

+ *

The title of the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

The ID of the product tax code to apply to this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productTaxCodeId(Nullable productTaxCodeId) { + if (productTaxCodeId.isNull()) { + this.productTaxCodeId = null; + } else if (productTaxCodeId.isEmpty()) { + this.productTaxCodeId = Optional.empty(); + } else { + this.productTaxCodeId = Optional.of(productTaxCodeId.get()); + } + return this; + } + + /** + *

The ID of the product tax code to apply to this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productTaxCodeId(String productTaxCodeId) { + this.productTaxCodeId = Optional.ofNullable(productTaxCodeId); + return this; + } + + /** + *

The ID of the product tax code to apply to this product.

+ */ + @java.lang.Override + @JsonSetter(value = "product_tax_code_id", nulls = Nulls.SKIP) + public _FinalStage productTaxCodeId(Optional productTaxCodeId) { + this.productTaxCodeId = productTaxCodeId; + return this; + } + + @java.lang.Override + public CreateInvoicesRequestProductProduct build() { + return new CreateInvoicesRequestProductProduct(productTaxCodeId, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/ListInvoicesResponse.java b/src/main/java/com/whop/api/resources/invoices/types/ListInvoicesResponse.java new file mode 100644 index 00000000..b26a2f10 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/ListInvoicesResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.InvoiceListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListInvoicesResponse.Builder.class) +public final class ListInvoicesResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListInvoicesResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListInvoicesResponse && equalTo((ListInvoicesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListInvoicesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListInvoicesResponse other); + } + + public interface _FinalStage { + ListInvoicesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(InvoiceListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListInvoicesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(InvoiceListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListInvoicesResponse build() { + return new ListInvoicesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceCreatedPayload.java b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceCreatedPayload.java new file mode 100644 index 00000000..238c79de --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceCreatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Invoice; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostInvoiceCreatedPayload.Builder.class) +public final class PostInvoiceCreatedPayload { + private final Optional accountId; + + private final PostInvoiceCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Invoice data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostInvoiceCreatedPayloadType type; + + private final Map additionalProperties; + + private PostInvoiceCreatedPayload( + Optional accountId, + PostInvoiceCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Invoice data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostInvoiceCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostInvoiceCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Invoice getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostInvoiceCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostInvoiceCreatedPayload && equalTo((PostInvoiceCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostInvoiceCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostInvoiceCreatedPayloadApiVersion apiVersion); + + Builder from(PostInvoiceCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Invoice data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostInvoiceCreatedPayloadType type); + } + + public interface _FinalStage { + PostInvoiceCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostInvoiceCreatedPayloadApiVersion apiVersion; + + private Invoice data; + + private String id; + + private OffsetDateTime timestamp; + + private PostInvoiceCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostInvoiceCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostInvoiceCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Invoice data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostInvoiceCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostInvoiceCreatedPayload build() { + return new PostInvoiceCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceCreatedPayloadApiVersion.java new file mode 100644 index 00000000..c4385fb5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceCreatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostInvoiceCreatedPayloadApiVersion { + public static final PostInvoiceCreatedPayloadApiVersion V1 = + new PostInvoiceCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostInvoiceCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostInvoiceCreatedPayloadApiVersion + && this.string.equals(((PostInvoiceCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostInvoiceCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostInvoiceCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceCreatedPayloadType.java b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceCreatedPayloadType.java new file mode 100644 index 00000000..9f4e820e --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostInvoiceCreatedPayloadType { + public static final PostInvoiceCreatedPayloadType INVOICE_CREATED = + new PostInvoiceCreatedPayloadType(Value.INVOICE_CREATED, "invoice.created"); + + private final Value value; + + private final String string; + + PostInvoiceCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostInvoiceCreatedPayloadType + && this.string.equals(((PostInvoiceCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INVOICE_CREATED: + return visitor.visitInvoiceCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostInvoiceCreatedPayloadType valueOf(String value) { + switch (value) { + case "invoice.created": + return INVOICE_CREATED; + default: + return new PostInvoiceCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + INVOICE_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitInvoiceCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceMarkedUncollectiblePayload.java b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceMarkedUncollectiblePayload.java new file mode 100644 index 00000000..d3b506e0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceMarkedUncollectiblePayload.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Invoice; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostInvoiceMarkedUncollectiblePayload.Builder.class) +public final class PostInvoiceMarkedUncollectiblePayload { + private final Optional accountId; + + private final PostInvoiceMarkedUncollectiblePayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Invoice data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostInvoiceMarkedUncollectiblePayloadType type; + + private final Map additionalProperties; + + private PostInvoiceMarkedUncollectiblePayload( + Optional accountId, + PostInvoiceMarkedUncollectiblePayloadApiVersion apiVersion, + Optional apiVersionDate, + Invoice data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostInvoiceMarkedUncollectiblePayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostInvoiceMarkedUncollectiblePayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Invoice getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostInvoiceMarkedUncollectiblePayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostInvoiceMarkedUncollectiblePayload + && equalTo((PostInvoiceMarkedUncollectiblePayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostInvoiceMarkedUncollectiblePayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostInvoiceMarkedUncollectiblePayloadApiVersion apiVersion); + + Builder from(PostInvoiceMarkedUncollectiblePayload other); + } + + public interface DataStage { + IdStage data(@NotNull Invoice data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostInvoiceMarkedUncollectiblePayloadType type); + } + + public interface _FinalStage { + PostInvoiceMarkedUncollectiblePayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostInvoiceMarkedUncollectiblePayloadApiVersion apiVersion; + + private Invoice data; + + private String id; + + private OffsetDateTime timestamp; + + private PostInvoiceMarkedUncollectiblePayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostInvoiceMarkedUncollectiblePayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostInvoiceMarkedUncollectiblePayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Invoice data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostInvoiceMarkedUncollectiblePayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostInvoiceMarkedUncollectiblePayload build() { + return new PostInvoiceMarkedUncollectiblePayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceMarkedUncollectiblePayloadApiVersion.java b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceMarkedUncollectiblePayloadApiVersion.java new file mode 100644 index 00000000..af8a3d5f --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceMarkedUncollectiblePayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostInvoiceMarkedUncollectiblePayloadApiVersion { + public static final PostInvoiceMarkedUncollectiblePayloadApiVersion V1 = + new PostInvoiceMarkedUncollectiblePayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostInvoiceMarkedUncollectiblePayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostInvoiceMarkedUncollectiblePayloadApiVersion + && this.string.equals(((PostInvoiceMarkedUncollectiblePayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostInvoiceMarkedUncollectiblePayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostInvoiceMarkedUncollectiblePayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceMarkedUncollectiblePayloadType.java b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceMarkedUncollectiblePayloadType.java new file mode 100644 index 00000000..b25f1932 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceMarkedUncollectiblePayloadType.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostInvoiceMarkedUncollectiblePayloadType { + public static final PostInvoiceMarkedUncollectiblePayloadType INVOICE_MARKED_UNCOLLECTIBLE = + new PostInvoiceMarkedUncollectiblePayloadType( + Value.INVOICE_MARKED_UNCOLLECTIBLE, "invoice.marked_uncollectible"); + + private final Value value; + + private final String string; + + PostInvoiceMarkedUncollectiblePayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostInvoiceMarkedUncollectiblePayloadType + && this.string.equals(((PostInvoiceMarkedUncollectiblePayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INVOICE_MARKED_UNCOLLECTIBLE: + return visitor.visitInvoiceMarkedUncollectible(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostInvoiceMarkedUncollectiblePayloadType valueOf(String value) { + switch (value) { + case "invoice.marked_uncollectible": + return INVOICE_MARKED_UNCOLLECTIBLE; + default: + return new PostInvoiceMarkedUncollectiblePayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + INVOICE_MARKED_UNCOLLECTIBLE, + + UNKNOWN + } + + public interface Visitor { + T visitInvoiceMarkedUncollectible(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePaidPayload.java b/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePaidPayload.java new file mode 100644 index 00000000..6ccf5ea5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePaidPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Invoice; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostInvoicePaidPayload.Builder.class) +public final class PostInvoicePaidPayload { + private final Optional accountId; + + private final PostInvoicePaidPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Invoice data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostInvoicePaidPayloadType type; + + private final Map additionalProperties; + + private PostInvoicePaidPayload( + Optional accountId, + PostInvoicePaidPayloadApiVersion apiVersion, + Optional apiVersionDate, + Invoice data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostInvoicePaidPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostInvoicePaidPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Invoice getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostInvoicePaidPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostInvoicePaidPayload && equalTo((PostInvoicePaidPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostInvoicePaidPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostInvoicePaidPayloadApiVersion apiVersion); + + Builder from(PostInvoicePaidPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Invoice data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostInvoicePaidPayloadType type); + } + + public interface _FinalStage { + PostInvoicePaidPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostInvoicePaidPayloadApiVersion apiVersion; + + private Invoice data; + + private String id; + + private OffsetDateTime timestamp; + + private PostInvoicePaidPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostInvoicePaidPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostInvoicePaidPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Invoice data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostInvoicePaidPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostInvoicePaidPayload build() { + return new PostInvoicePaidPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePaidPayloadApiVersion.java b/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePaidPayloadApiVersion.java new file mode 100644 index 00000000..c5b5f714 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePaidPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostInvoicePaidPayloadApiVersion { + public static final PostInvoicePaidPayloadApiVersion V1 = new PostInvoicePaidPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostInvoicePaidPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostInvoicePaidPayloadApiVersion + && this.string.equals(((PostInvoicePaidPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostInvoicePaidPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostInvoicePaidPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePaidPayloadType.java b/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePaidPayloadType.java new file mode 100644 index 00000000..519039f2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePaidPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostInvoicePaidPayloadType { + public static final PostInvoicePaidPayloadType INVOICE_PAID = + new PostInvoicePaidPayloadType(Value.INVOICE_PAID, "invoice.paid"); + + private final Value value; + + private final String string; + + PostInvoicePaidPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostInvoicePaidPayloadType + && this.string.equals(((PostInvoicePaidPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INVOICE_PAID: + return visitor.visitInvoicePaid(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostInvoicePaidPayloadType valueOf(String value) { + switch (value) { + case "invoice.paid": + return INVOICE_PAID; + default: + return new PostInvoicePaidPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + INVOICE_PAID, + + UNKNOWN + } + + public interface Visitor { + T visitInvoicePaid(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePastDuePayload.java b/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePastDuePayload.java new file mode 100644 index 00000000..c08cc1f2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePastDuePayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Invoice; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostInvoicePastDuePayload.Builder.class) +public final class PostInvoicePastDuePayload { + private final Optional accountId; + + private final PostInvoicePastDuePayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Invoice data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostInvoicePastDuePayloadType type; + + private final Map additionalProperties; + + private PostInvoicePastDuePayload( + Optional accountId, + PostInvoicePastDuePayloadApiVersion apiVersion, + Optional apiVersionDate, + Invoice data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostInvoicePastDuePayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostInvoicePastDuePayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Invoice getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostInvoicePastDuePayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostInvoicePastDuePayload && equalTo((PostInvoicePastDuePayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostInvoicePastDuePayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostInvoicePastDuePayloadApiVersion apiVersion); + + Builder from(PostInvoicePastDuePayload other); + } + + public interface DataStage { + IdStage data(@NotNull Invoice data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostInvoicePastDuePayloadType type); + } + + public interface _FinalStage { + PostInvoicePastDuePayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostInvoicePastDuePayloadApiVersion apiVersion; + + private Invoice data; + + private String id; + + private OffsetDateTime timestamp; + + private PostInvoicePastDuePayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostInvoicePastDuePayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostInvoicePastDuePayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Invoice data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostInvoicePastDuePayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostInvoicePastDuePayload build() { + return new PostInvoicePastDuePayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePastDuePayloadApiVersion.java b/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePastDuePayloadApiVersion.java new file mode 100644 index 00000000..be94069f --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePastDuePayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostInvoicePastDuePayloadApiVersion { + public static final PostInvoicePastDuePayloadApiVersion V1 = + new PostInvoicePastDuePayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostInvoicePastDuePayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostInvoicePastDuePayloadApiVersion + && this.string.equals(((PostInvoicePastDuePayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostInvoicePastDuePayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostInvoicePastDuePayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePastDuePayloadType.java b/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePastDuePayloadType.java new file mode 100644 index 00000000..a3502335 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/PostInvoicePastDuePayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostInvoicePastDuePayloadType { + public static final PostInvoicePastDuePayloadType INVOICE_PAST_DUE = + new PostInvoicePastDuePayloadType(Value.INVOICE_PAST_DUE, "invoice.past_due"); + + private final Value value; + + private final String string; + + PostInvoicePastDuePayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostInvoicePastDuePayloadType + && this.string.equals(((PostInvoicePastDuePayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INVOICE_PAST_DUE: + return visitor.visitInvoicePastDue(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostInvoicePastDuePayloadType valueOf(String value) { + switch (value) { + case "invoice.past_due": + return INVOICE_PAST_DUE; + default: + return new PostInvoicePastDuePayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + INVOICE_PAST_DUE, + + UNKNOWN + } + + public interface Visitor { + T visitInvoicePastDue(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceVoidedPayload.java b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceVoidedPayload.java new file mode 100644 index 00000000..78bdc2aa --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceVoidedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Invoice; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostInvoiceVoidedPayload.Builder.class) +public final class PostInvoiceVoidedPayload { + private final Optional accountId; + + private final PostInvoiceVoidedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Invoice data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostInvoiceVoidedPayloadType type; + + private final Map additionalProperties; + + private PostInvoiceVoidedPayload( + Optional accountId, + PostInvoiceVoidedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Invoice data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostInvoiceVoidedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostInvoiceVoidedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Invoice getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostInvoiceVoidedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostInvoiceVoidedPayload && equalTo((PostInvoiceVoidedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostInvoiceVoidedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostInvoiceVoidedPayloadApiVersion apiVersion); + + Builder from(PostInvoiceVoidedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Invoice data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostInvoiceVoidedPayloadType type); + } + + public interface _FinalStage { + PostInvoiceVoidedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostInvoiceVoidedPayloadApiVersion apiVersion; + + private Invoice data; + + private String id; + + private OffsetDateTime timestamp; + + private PostInvoiceVoidedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostInvoiceVoidedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostInvoiceVoidedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Invoice data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostInvoiceVoidedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostInvoiceVoidedPayload build() { + return new PostInvoiceVoidedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceVoidedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceVoidedPayloadApiVersion.java new file mode 100644 index 00000000..7a478d8c --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceVoidedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostInvoiceVoidedPayloadApiVersion { + public static final PostInvoiceVoidedPayloadApiVersion V1 = new PostInvoiceVoidedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostInvoiceVoidedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostInvoiceVoidedPayloadApiVersion + && this.string.equals(((PostInvoiceVoidedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostInvoiceVoidedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostInvoiceVoidedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceVoidedPayloadType.java b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceVoidedPayloadType.java new file mode 100644 index 00000000..64232a58 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/PostInvoiceVoidedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostInvoiceVoidedPayloadType { + public static final PostInvoiceVoidedPayloadType INVOICE_VOIDED = + new PostInvoiceVoidedPayloadType(Value.INVOICE_VOIDED, "invoice.voided"); + + private final Value value; + + private final String string; + + PostInvoiceVoidedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostInvoiceVoidedPayloadType + && this.string.equals(((PostInvoiceVoidedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INVOICE_VOIDED: + return visitor.visitInvoiceVoided(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostInvoiceVoidedPayloadType valueOf(String value) { + switch (value) { + case "invoice.voided": + return INVOICE_VOIDED; + default: + return new PostInvoiceVoidedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + INVOICE_VOIDED, + + UNKNOWN + } + + public interface Visitor { + T visitInvoiceVoided(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/UpdateInvoicesRequestBillingAddress.java b/src/main/java/com/whop/api/resources/invoices/types/UpdateInvoicesRequestBillingAddress.java new file mode 100644 index 00000000..4cec1501 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/UpdateInvoicesRequestBillingAddress.java @@ -0,0 +1,609 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.TaxIdentifierTypes; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateInvoicesRequestBillingAddress.Builder.class) +public final class UpdateInvoicesRequestBillingAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional name; + + private final Optional phone; + + private final Optional postalCode; + + private final Optional state; + + private final Optional taxIdType; + + private final Optional taxIdValue; + + private final Map additionalProperties; + + private UpdateInvoicesRequestBillingAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional name, + Optional phone, + Optional postalCode, + Optional state, + Optional taxIdType, + Optional taxIdValue, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.name = name; + this.phone = phone; + this.postalCode = postalCode; + this.state = state; + this.taxIdType = taxIdType; + this.taxIdValue = taxIdValue; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The name of the customer. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The phone number of the customer. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + /** + * @return The type of tax identifier. + */ + @JsonIgnore + public Optional getTaxIdType() { + if (taxIdType == null) { + return Optional.empty(); + } + return taxIdType; + } + + /** + * @return The value of the tax identifier. + */ + @JsonIgnore + public Optional getTaxIdValue() { + if (taxIdValue == null) { + return Optional.empty(); + } + return taxIdValue; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_id_type") + private Optional _getTaxIdType() { + return taxIdType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_id_value") + private Optional _getTaxIdValue() { + return taxIdValue; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateInvoicesRequestBillingAddress + && equalTo((UpdateInvoicesRequestBillingAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateInvoicesRequestBillingAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && name.equals(other.name) + && phone.equals(other.phone) + && postalCode.equals(other.postalCode) + && state.equals(other.state) + && taxIdType.equals(other.taxIdType) + && taxIdValue.equals(other.taxIdValue); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.city, + this.country, + this.line1, + this.line2, + this.name, + this.phone, + this.postalCode, + this.state, + this.taxIdType, + this.taxIdValue); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + private Optional taxIdType = Optional.empty(); + + private Optional taxIdValue = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateInvoicesRequestBillingAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + name(other.getName()); + phone(other.getPhone()); + postalCode(other.getPostalCode()); + state(other.getState()); + taxIdType(other.getTaxIdType()); + taxIdValue(other.getTaxIdValue()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The name of the customer.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The phone number of the customer.

+ */ + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + public Builder phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + /** + *

The type of tax identifier.

+ */ + @JsonSetter(value = "tax_id_type", nulls = Nulls.SKIP) + public Builder taxIdType(Optional taxIdType) { + this.taxIdType = taxIdType; + return this; + } + + public Builder taxIdType(TaxIdentifierTypes taxIdType) { + this.taxIdType = Optional.ofNullable(taxIdType); + return this; + } + + public Builder taxIdType(Nullable taxIdType) { + if (taxIdType.isNull()) { + this.taxIdType = null; + } else if (taxIdType.isEmpty()) { + this.taxIdType = Optional.empty(); + } else { + this.taxIdType = Optional.of(taxIdType.get()); + } + return this; + } + + /** + *

The value of the tax identifier.

+ */ + @JsonSetter(value = "tax_id_value", nulls = Nulls.SKIP) + public Builder taxIdValue(Optional taxIdValue) { + this.taxIdValue = taxIdValue; + return this; + } + + public Builder taxIdValue(String taxIdValue) { + this.taxIdValue = Optional.ofNullable(taxIdValue); + return this; + } + + public Builder taxIdValue(Nullable taxIdValue) { + if (taxIdValue.isNull()) { + this.taxIdValue = null; + } else if (taxIdValue.isEmpty()) { + this.taxIdValue = Optional.empty(); + } else { + this.taxIdValue = Optional.of(taxIdValue.get()); + } + return this; + } + + public UpdateInvoicesRequestBillingAddress build() { + return new UpdateInvoicesRequestBillingAddress( + city, + country, + line1, + line2, + name, + phone, + postalCode, + state, + taxIdType, + taxIdValue, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/UpdateInvoicesRequestLineItemsItem.java b/src/main/java/com/whop/api/resources/invoices/types/UpdateInvoicesRequestLineItemsItem.java new file mode 100644 index 00000000..8795836d --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/UpdateInvoicesRequestLineItemsItem.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateInvoicesRequestLineItemsItem.Builder.class) +public final class UpdateInvoicesRequestLineItemsItem { + private final String label; + + private final Optional quantity; + + private final double unitPrice; + + private final Map additionalProperties; + + private UpdateInvoicesRequestLineItemsItem( + String label, Optional quantity, double unitPrice, Map additionalProperties) { + this.label = label; + this.quantity = quantity; + this.unitPrice = unitPrice; + this.additionalProperties = additionalProperties; + } + + /** + * @return The label or description for this line item. + */ + @JsonProperty("label") + public String getLabel() { + return label; + } + + /** + * @return The quantity of this line item. Defaults to 1. + */ + @JsonIgnore + public Optional getQuantity() { + if (quantity == null) { + return Optional.empty(); + } + return quantity; + } + + /** + * @return The unit price for this line item. Provided as a number in the specified currency. Eg: 10.43 for $10.43 + */ + @JsonProperty("unit_price") + public double getUnitPrice() { + return unitPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("quantity") + private Optional _getQuantity() { + return quantity; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateInvoicesRequestLineItemsItem + && equalTo((UpdateInvoicesRequestLineItemsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateInvoicesRequestLineItemsItem other) { + return label.equals(other.label) && quantity.equals(other.quantity) && unitPrice == other.unitPrice; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.label, this.quantity, this.unitPrice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LabelStage builder() { + return new Builder(); + } + + public interface LabelStage { + /** + *

The label or description for this line item.

+ */ + UnitPriceStage label(@NotNull String label); + + Builder from(UpdateInvoicesRequestLineItemsItem other); + } + + public interface UnitPriceStage { + /** + *

The unit price for this line item. Provided as a number in the specified currency. Eg: 10.43 for $10.43

+ */ + _FinalStage unitPrice(double unitPrice); + } + + public interface _FinalStage { + UpdateInvoicesRequestLineItemsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The quantity of this line item. Defaults to 1.

+ */ + _FinalStage quantity(Optional quantity); + + _FinalStage quantity(Double quantity); + + _FinalStage quantity(Nullable quantity); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LabelStage, UnitPriceStage, _FinalStage { + private String label; + + private double unitPrice; + + private Optional quantity = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateInvoicesRequestLineItemsItem other) { + label(other.getLabel()); + quantity(other.getQuantity()); + unitPrice(other.getUnitPrice()); + return this; + } + + /** + *

The label or description for this line item.

+ *

The label or description for this line item.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("label") + public UnitPriceStage label(@NotNull String label) { + this.label = Objects.requireNonNull(label, "label must not be null"); + return this; + } + + /** + *

The unit price for this line item. Provided as a number in the specified currency. Eg: 10.43 for $10.43

+ *

The unit price for this line item. Provided as a number in the specified currency. Eg: 10.43 for $10.43

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("unit_price") + public _FinalStage unitPrice(double unitPrice) { + this.unitPrice = unitPrice; + return this; + } + + /** + *

The quantity of this line item. Defaults to 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quantity(Nullable quantity) { + if (quantity.isNull()) { + this.quantity = null; + } else if (quantity.isEmpty()) { + this.quantity = Optional.empty(); + } else { + this.quantity = Optional.of(quantity.get()); + } + return this; + } + + /** + *

The quantity of this line item. Defaults to 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quantity(Double quantity) { + this.quantity = Optional.ofNullable(quantity); + return this; + } + + /** + *

The quantity of this line item. Defaults to 1.

+ */ + @java.lang.Override + @JsonSetter(value = "quantity", nulls = Nulls.SKIP) + public _FinalStage quantity(Optional quantity) { + this.quantity = quantity; + return this; + } + + @java.lang.Override + public UpdateInvoicesRequestLineItemsItem build() { + return new UpdateInvoicesRequestLineItemsItem(label, quantity, unitPrice, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/UpdateInvoicesRequestPlan.java b/src/main/java/com/whop/api/resources/invoices/types/UpdateInvoicesRequestPlan.java new file mode 100644 index 00000000..9c85cfb5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/UpdateInvoicesRequestPlan.java @@ -0,0 +1,980 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Currencies; +import com.whop.api.types.PlanTypes; +import com.whop.api.types.ReleaseMethod; +import com.whop.api.types.Visibility; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateInvoicesRequestPlan.Builder.class) +public final class UpdateInvoicesRequestPlan { + private final Optional adaptivePricingEnabled; + + private final Optional billingPeriod; + + private final Optional currency; + + private final Optional> customFields; + + private final Optional description; + + private final Optional expirationDays; + + private final Optional initialPrice; + + private final Optional internalNotes; + + private final Optional legacyPaymentMethodControls; + + private final Optional paymentMethodConfiguration; + + private final Optional planType; + + private final Optional releaseMethod; + + private final Optional renewalPrice; + + private final Optional stock; + + private final Optional trialPeriodDays; + + private final Optional unlimitedStock; + + private final Optional visibility; + + private final Map additionalProperties; + + private UpdateInvoicesRequestPlan( + Optional adaptivePricingEnabled, + Optional billingPeriod, + Optional currency, + Optional> customFields, + Optional description, + Optional expirationDays, + Optional initialPrice, + Optional internalNotes, + Optional legacyPaymentMethodControls, + Optional paymentMethodConfiguration, + Optional planType, + Optional releaseMethod, + Optional renewalPrice, + Optional stock, + Optional trialPeriodDays, + Optional unlimitedStock, + Optional visibility, + Map additionalProperties) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + this.billingPeriod = billingPeriod; + this.currency = currency; + this.customFields = customFields; + this.description = description; + this.expirationDays = expirationDays; + this.initialPrice = initialPrice; + this.internalNotes = internalNotes; + this.legacyPaymentMethodControls = legacyPaymentMethodControls; + this.paymentMethodConfiguration = paymentMethodConfiguration; + this.planType = planType; + this.releaseMethod = releaseMethod; + this.renewalPrice = renewalPrice; + this.stock = stock; + this.trialPeriodDays = trialPeriodDays; + this.unlimitedStock = unlimitedStock; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether this plan accepts local currency payments via adaptive pricing. + */ + @JsonIgnore + public Optional getAdaptivePricingEnabled() { + if (adaptivePricingEnabled == null) { + return Optional.empty(); + } + return adaptivePricingEnabled; + } + + /** + * @return The interval in days at which the plan charges (renewal plans). + */ + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + /** + * @return The three-letter ISO currency code for the plan's pricing. Defaults to USD. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return An array of custom field objects. + */ + @JsonIgnore + public Optional> getCustomFields() { + if (customFields == null) { + return Optional.empty(); + } + return customFields; + } + + /** + * @return The description of the plan. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The number of days until the membership expires and revokes access (expiration plans). For example, 365 for a one-year access period. + */ + @JsonIgnore + public Optional getExpirationDays() { + if (expirationDays == null) { + return Optional.empty(); + } + return expirationDays; + } + + /** + * @return An additional amount charged upon first purchase. Use only if a one time payment OR you want to charge an additional amount on top of the renewal price. Provided as a number in the specified currency. Eg: 10.43 for $10.43 + */ + @JsonIgnore + public Optional getInitialPrice() { + if (initialPrice == null) { + return Optional.empty(); + } + return initialPrice; + } + + /** + * @return A personal description or notes section for the business. + */ + @JsonIgnore + public Optional getInternalNotes() { + if (internalNotes == null) { + return Optional.empty(); + } + return internalNotes; + } + + /** + * @return Whether this plan uses legacy payment method controls + */ + @JsonIgnore + public Optional getLegacyPaymentMethodControls() { + if (legacyPaymentMethodControls == null) { + return Optional.empty(); + } + return legacyPaymentMethodControls; + } + + /** + * @return The explicit payment method configuration for the plan. If not provided, the platform or company's defaults will apply. + */ + @JsonIgnore + public Optional getPaymentMethodConfiguration() { + if (paymentMethodConfiguration == null) { + return Optional.empty(); + } + return paymentMethodConfiguration; + } + + /** + * @return Indicates if the plan is a one time payment or recurring. + */ + @JsonIgnore + public Optional getPlanType() { + if (planType == null) { + return Optional.empty(); + } + return planType; + } + + /** + * @return This is the release method the business uses to sell this plan. + */ + @JsonIgnore + public Optional getReleaseMethod() { + if (releaseMethod == null) { + return Optional.empty(); + } + return releaseMethod; + } + + /** + * @return The amount the customer is charged every billing period. Use only if a recurring payment. Provided as a number in the specified currency. Eg: 10.43 for $10.43 + */ + @JsonIgnore + public Optional getRenewalPrice() { + if (renewalPrice == null) { + return Optional.empty(); + } + return renewalPrice; + } + + /** + * @return The number of units available for purchase. + */ + @JsonIgnore + public Optional getStock() { + if (stock == null) { + return Optional.empty(); + } + return stock; + } + + /** + * @return The number of free trial days added before a renewal plan. + */ + @JsonIgnore + public Optional getTrialPeriodDays() { + if (trialPeriodDays == null) { + return Optional.empty(); + } + return trialPeriodDays; + } + + /** + * @return When true, the plan has unlimited stock (stock field is ignored). When false, purchases are limited by the stock field. + */ + @JsonIgnore + public Optional getUnlimitedStock() { + if (unlimitedStock == null) { + return Optional.empty(); + } + return unlimitedStock; + } + + /** + * @return Shows or hides the plan from public/business view. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("adaptive_pricing_enabled") + private Optional _getAdaptivePricingEnabled() { + return adaptivePricingEnabled; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_fields") + private Optional> _getCustomFields() { + return customFields; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_days") + private Optional _getExpirationDays() { + return expirationDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("initial_price") + private Optional _getInitialPrice() { + return initialPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("internal_notes") + private Optional _getInternalNotes() { + return internalNotes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("legacy_payment_method_controls") + private Optional _getLegacyPaymentMethodControls() { + return legacyPaymentMethodControls; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_configuration") + private Optional _getPaymentMethodConfiguration() { + return paymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan_type") + private Optional _getPlanType() { + return planType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("release_method") + private Optional _getReleaseMethod() { + return releaseMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("renewal_price") + private Optional _getRenewalPrice() { + return renewalPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("stock") + private Optional _getStock() { + return stock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trial_period_days") + private Optional _getTrialPeriodDays() { + return trialPeriodDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("unlimited_stock") + private Optional _getUnlimitedStock() { + return unlimitedStock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateInvoicesRequestPlan && equalTo((UpdateInvoicesRequestPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateInvoicesRequestPlan other) { + return adaptivePricingEnabled.equals(other.adaptivePricingEnabled) + && billingPeriod.equals(other.billingPeriod) + && currency.equals(other.currency) + && customFields.equals(other.customFields) + && description.equals(other.description) + && expirationDays.equals(other.expirationDays) + && initialPrice.equals(other.initialPrice) + && internalNotes.equals(other.internalNotes) + && legacyPaymentMethodControls.equals(other.legacyPaymentMethodControls) + && paymentMethodConfiguration.equals(other.paymentMethodConfiguration) + && planType.equals(other.planType) + && releaseMethod.equals(other.releaseMethod) + && renewalPrice.equals(other.renewalPrice) + && stock.equals(other.stock) + && trialPeriodDays.equals(other.trialPeriodDays) + && unlimitedStock.equals(other.unlimitedStock) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adaptivePricingEnabled, + this.billingPeriod, + this.currency, + this.customFields, + this.description, + this.expirationDays, + this.initialPrice, + this.internalNotes, + this.legacyPaymentMethodControls, + this.paymentMethodConfiguration, + this.planType, + this.releaseMethod, + this.renewalPrice, + this.stock, + this.trialPeriodDays, + this.unlimitedStock, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional adaptivePricingEnabled = Optional.empty(); + + private Optional billingPeriod = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional> customFields = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional expirationDays = Optional.empty(); + + private Optional initialPrice = Optional.empty(); + + private Optional internalNotes = Optional.empty(); + + private Optional legacyPaymentMethodControls = Optional.empty(); + + private Optional paymentMethodConfiguration = + Optional.empty(); + + private Optional planType = Optional.empty(); + + private Optional releaseMethod = Optional.empty(); + + private Optional renewalPrice = Optional.empty(); + + private Optional stock = Optional.empty(); + + private Optional trialPeriodDays = Optional.empty(); + + private Optional unlimitedStock = Optional.empty(); + + private Optional visibility = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateInvoicesRequestPlan other) { + adaptivePricingEnabled(other.getAdaptivePricingEnabled()); + billingPeriod(other.getBillingPeriod()); + currency(other.getCurrency()); + customFields(other.getCustomFields()); + description(other.getDescription()); + expirationDays(other.getExpirationDays()); + initialPrice(other.getInitialPrice()); + internalNotes(other.getInternalNotes()); + legacyPaymentMethodControls(other.getLegacyPaymentMethodControls()); + paymentMethodConfiguration(other.getPaymentMethodConfiguration()); + planType(other.getPlanType()); + releaseMethod(other.getReleaseMethod()); + renewalPrice(other.getRenewalPrice()); + stock(other.getStock()); + trialPeriodDays(other.getTrialPeriodDays()); + unlimitedStock(other.getUnlimitedStock()); + visibility(other.getVisibility()); + return this; + } + + /** + *

Whether this plan accepts local currency payments via adaptive pricing.

+ */ + @JsonSetter(value = "adaptive_pricing_enabled", nulls = Nulls.SKIP) + public Builder adaptivePricingEnabled(Optional adaptivePricingEnabled) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + return this; + } + + public Builder adaptivePricingEnabled(Boolean adaptivePricingEnabled) { + this.adaptivePricingEnabled = Optional.ofNullable(adaptivePricingEnabled); + return this; + } + + public Builder adaptivePricingEnabled(Nullable adaptivePricingEnabled) { + if (adaptivePricingEnabled.isNull()) { + this.adaptivePricingEnabled = null; + } else if (adaptivePricingEnabled.isEmpty()) { + this.adaptivePricingEnabled = Optional.empty(); + } else { + this.adaptivePricingEnabled = Optional.of(adaptivePricingEnabled.get()); + } + return this; + } + + /** + *

The interval in days at which the plan charges (renewal plans).

+ */ + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public Builder billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + public Builder billingPeriod(Integer billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + public Builder billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + /** + *

The three-letter ISO currency code for the plan's pricing. Defaults to USD.

+ */ + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional currency) { + this.currency = currency; + return this; + } + + public Builder currency(Currencies currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + public Builder currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

An array of custom field objects.

+ */ + @JsonSetter(value = "custom_fields", nulls = Nulls.SKIP) + public Builder customFields(Optional> customFields) { + this.customFields = customFields; + return this; + } + + public Builder customFields(List customFields) { + this.customFields = Optional.ofNullable(customFields); + return this; + } + + public Builder customFields(Nullable> customFields) { + if (customFields.isNull()) { + this.customFields = null; + } else if (customFields.isEmpty()) { + this.customFields = Optional.empty(); + } else { + this.customFields = Optional.of(customFields.get()); + } + return this; + } + + /** + *

The description of the plan.

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public Builder description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

The number of days until the membership expires and revokes access (expiration plans). For example, 365 for a one-year access period.

+ */ + @JsonSetter(value = "expiration_days", nulls = Nulls.SKIP) + public Builder expirationDays(Optional expirationDays) { + this.expirationDays = expirationDays; + return this; + } + + public Builder expirationDays(Integer expirationDays) { + this.expirationDays = Optional.ofNullable(expirationDays); + return this; + } + + public Builder expirationDays(Nullable expirationDays) { + if (expirationDays.isNull()) { + this.expirationDays = null; + } else if (expirationDays.isEmpty()) { + this.expirationDays = Optional.empty(); + } else { + this.expirationDays = Optional.of(expirationDays.get()); + } + return this; + } + + /** + *

An additional amount charged upon first purchase. Use only if a one time payment OR you want to charge an additional amount on top of the renewal price. Provided as a number in the specified currency. Eg: 10.43 for $10.43

+ */ + @JsonSetter(value = "initial_price", nulls = Nulls.SKIP) + public Builder initialPrice(Optional initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + public Builder initialPrice(Double initialPrice) { + this.initialPrice = Optional.ofNullable(initialPrice); + return this; + } + + public Builder initialPrice(Nullable initialPrice) { + if (initialPrice.isNull()) { + this.initialPrice = null; + } else if (initialPrice.isEmpty()) { + this.initialPrice = Optional.empty(); + } else { + this.initialPrice = Optional.of(initialPrice.get()); + } + return this; + } + + /** + *

A personal description or notes section for the business.

+ */ + @JsonSetter(value = "internal_notes", nulls = Nulls.SKIP) + public Builder internalNotes(Optional internalNotes) { + this.internalNotes = internalNotes; + return this; + } + + public Builder internalNotes(String internalNotes) { + this.internalNotes = Optional.ofNullable(internalNotes); + return this; + } + + public Builder internalNotes(Nullable internalNotes) { + if (internalNotes.isNull()) { + this.internalNotes = null; + } else if (internalNotes.isEmpty()) { + this.internalNotes = Optional.empty(); + } else { + this.internalNotes = Optional.of(internalNotes.get()); + } + return this; + } + + /** + *

Whether this plan uses legacy payment method controls

+ */ + @JsonSetter(value = "legacy_payment_method_controls", nulls = Nulls.SKIP) + public Builder legacyPaymentMethodControls(Optional legacyPaymentMethodControls) { + this.legacyPaymentMethodControls = legacyPaymentMethodControls; + return this; + } + + public Builder legacyPaymentMethodControls(Boolean legacyPaymentMethodControls) { + this.legacyPaymentMethodControls = Optional.ofNullable(legacyPaymentMethodControls); + return this; + } + + public Builder legacyPaymentMethodControls(Nullable legacyPaymentMethodControls) { + if (legacyPaymentMethodControls.isNull()) { + this.legacyPaymentMethodControls = null; + } else if (legacyPaymentMethodControls.isEmpty()) { + this.legacyPaymentMethodControls = Optional.empty(); + } else { + this.legacyPaymentMethodControls = Optional.of(legacyPaymentMethodControls.get()); + } + return this; + } + + /** + *

The explicit payment method configuration for the plan. If not provided, the platform or company's defaults will apply.

+ */ + @JsonSetter(value = "payment_method_configuration", nulls = Nulls.SKIP) + public Builder paymentMethodConfiguration( + Optional paymentMethodConfiguration) { + this.paymentMethodConfiguration = paymentMethodConfiguration; + return this; + } + + public Builder paymentMethodConfiguration( + UpdateInvoicesRequestPlanPaymentMethodConfiguration paymentMethodConfiguration) { + this.paymentMethodConfiguration = Optional.ofNullable(paymentMethodConfiguration); + return this; + } + + public Builder paymentMethodConfiguration( + Nullable paymentMethodConfiguration) { + if (paymentMethodConfiguration.isNull()) { + this.paymentMethodConfiguration = null; + } else if (paymentMethodConfiguration.isEmpty()) { + this.paymentMethodConfiguration = Optional.empty(); + } else { + this.paymentMethodConfiguration = Optional.of(paymentMethodConfiguration.get()); + } + return this; + } + + /** + *

Indicates if the plan is a one time payment or recurring.

+ */ + @JsonSetter(value = "plan_type", nulls = Nulls.SKIP) + public Builder planType(Optional planType) { + this.planType = planType; + return this; + } + + public Builder planType(PlanTypes planType) { + this.planType = Optional.ofNullable(planType); + return this; + } + + public Builder planType(Nullable planType) { + if (planType.isNull()) { + this.planType = null; + } else if (planType.isEmpty()) { + this.planType = Optional.empty(); + } else { + this.planType = Optional.of(planType.get()); + } + return this; + } + + /** + *

This is the release method the business uses to sell this plan.

+ */ + @JsonSetter(value = "release_method", nulls = Nulls.SKIP) + public Builder releaseMethod(Optional releaseMethod) { + this.releaseMethod = releaseMethod; + return this; + } + + public Builder releaseMethod(ReleaseMethod releaseMethod) { + this.releaseMethod = Optional.ofNullable(releaseMethod); + return this; + } + + public Builder releaseMethod(Nullable releaseMethod) { + if (releaseMethod.isNull()) { + this.releaseMethod = null; + } else if (releaseMethod.isEmpty()) { + this.releaseMethod = Optional.empty(); + } else { + this.releaseMethod = Optional.of(releaseMethod.get()); + } + return this; + } + + /** + *

The amount the customer is charged every billing period. Use only if a recurring payment. Provided as a number in the specified currency. Eg: 10.43 for $10.43

+ */ + @JsonSetter(value = "renewal_price", nulls = Nulls.SKIP) + public Builder renewalPrice(Optional renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + public Builder renewalPrice(Double renewalPrice) { + this.renewalPrice = Optional.ofNullable(renewalPrice); + return this; + } + + public Builder renewalPrice(Nullable renewalPrice) { + if (renewalPrice.isNull()) { + this.renewalPrice = null; + } else if (renewalPrice.isEmpty()) { + this.renewalPrice = Optional.empty(); + } else { + this.renewalPrice = Optional.of(renewalPrice.get()); + } + return this; + } + + /** + *

The number of units available for purchase.

+ */ + @JsonSetter(value = "stock", nulls = Nulls.SKIP) + public Builder stock(Optional stock) { + this.stock = stock; + return this; + } + + public Builder stock(Integer stock) { + this.stock = Optional.ofNullable(stock); + return this; + } + + public Builder stock(Nullable stock) { + if (stock.isNull()) { + this.stock = null; + } else if (stock.isEmpty()) { + this.stock = Optional.empty(); + } else { + this.stock = Optional.of(stock.get()); + } + return this; + } + + /** + *

The number of free trial days added before a renewal plan.

+ */ + @JsonSetter(value = "trial_period_days", nulls = Nulls.SKIP) + public Builder trialPeriodDays(Optional trialPeriodDays) { + this.trialPeriodDays = trialPeriodDays; + return this; + } + + public Builder trialPeriodDays(Integer trialPeriodDays) { + this.trialPeriodDays = Optional.ofNullable(trialPeriodDays); + return this; + } + + public Builder trialPeriodDays(Nullable trialPeriodDays) { + if (trialPeriodDays.isNull()) { + this.trialPeriodDays = null; + } else if (trialPeriodDays.isEmpty()) { + this.trialPeriodDays = Optional.empty(); + } else { + this.trialPeriodDays = Optional.of(trialPeriodDays.get()); + } + return this; + } + + /** + *

When true, the plan has unlimited stock (stock field is ignored). When false, purchases are limited by the stock field.

+ */ + @JsonSetter(value = "unlimited_stock", nulls = Nulls.SKIP) + public Builder unlimitedStock(Optional unlimitedStock) { + this.unlimitedStock = unlimitedStock; + return this; + } + + public Builder unlimitedStock(Boolean unlimitedStock) { + this.unlimitedStock = Optional.ofNullable(unlimitedStock); + return this; + } + + public Builder unlimitedStock(Nullable unlimitedStock) { + if (unlimitedStock.isNull()) { + this.unlimitedStock = null; + } else if (unlimitedStock.isEmpty()) { + this.unlimitedStock = Optional.empty(); + } else { + this.unlimitedStock = Optional.of(unlimitedStock.get()); + } + return this; + } + + /** + *

Shows or hides the plan from public/business view.

+ */ + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public Builder visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + public Builder visibility(Visibility visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + public Builder visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + public UpdateInvoicesRequestPlan build() { + return new UpdateInvoicesRequestPlan( + adaptivePricingEnabled, + billingPeriod, + currency, + customFields, + description, + expirationDays, + initialPrice, + internalNotes, + legacyPaymentMethodControls, + paymentMethodConfiguration, + planType, + releaseMethod, + renewalPrice, + stock, + trialPeriodDays, + unlimitedStock, + visibility, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/UpdateInvoicesRequestPlanCustomFieldsItem.java b/src/main/java/com/whop/api/resources/invoices/types/UpdateInvoicesRequestPlanCustomFieldsItem.java new file mode 100644 index 00000000..28187d20 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/UpdateInvoicesRequestPlanCustomFieldsItem.java @@ -0,0 +1,454 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CustomFieldTypes; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateInvoicesRequestPlanCustomFieldsItem.Builder.class) +public final class UpdateInvoicesRequestPlanCustomFieldsItem { + private final CustomFieldTypes fieldType; + + private final Optional id; + + private final String name; + + private final Optional order; + + private final Optional placeholder; + + private final Optional required; + + private final Map additionalProperties; + + private UpdateInvoicesRequestPlanCustomFieldsItem( + CustomFieldTypes fieldType, + Optional id, + String name, + Optional order, + Optional placeholder, + Optional required, + Map additionalProperties) { + this.fieldType = fieldType; + this.id = id; + this.name = name; + this.order = order; + this.placeholder = placeholder; + this.required = required; + this.additionalProperties = additionalProperties; + } + + /** + * @return The type of the custom field. + */ + @JsonProperty("field_type") + public CustomFieldTypes getFieldType() { + return fieldType; + } + + /** + * @return The ID of the custom field (if being updated) + */ + @JsonIgnore + public Optional getId() { + if (id == null) { + return Optional.empty(); + } + return id; + } + + /** + * @return The name of the custom field. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The order of the field. + */ + @JsonIgnore + public Optional getOrder() { + if (order == null) { + return Optional.empty(); + } + return order; + } + + /** + * @return The placeholder value of the field. + */ + @JsonIgnore + public Optional getPlaceholder() { + if (placeholder == null) { + return Optional.empty(); + } + return placeholder; + } + + /** + * @return Whether or not the field is required. + */ + @JsonIgnore + public Optional getRequired() { + if (required == null) { + return Optional.empty(); + } + return required; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("id") + private Optional _getId() { + return id; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("order") + private Optional _getOrder() { + return order; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("placeholder") + private Optional _getPlaceholder() { + return placeholder; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("required") + private Optional _getRequired() { + return required; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateInvoicesRequestPlanCustomFieldsItem + && equalTo((UpdateInvoicesRequestPlanCustomFieldsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateInvoicesRequestPlanCustomFieldsItem other) { + return fieldType.equals(other.fieldType) + && id.equals(other.id) + && name.equals(other.name) + && order.equals(other.order) + && placeholder.equals(other.placeholder) + && required.equals(other.required); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fieldType, this.id, this.name, this.order, this.placeholder, this.required); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FieldTypeStage builder() { + return new Builder(); + } + + public interface FieldTypeStage { + /** + *

The type of the custom field.

+ */ + NameStage fieldType(@NotNull CustomFieldTypes fieldType); + + Builder from(UpdateInvoicesRequestPlanCustomFieldsItem other); + } + + public interface NameStage { + /** + *

The name of the custom field.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + UpdateInvoicesRequestPlanCustomFieldsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The ID of the custom field (if being updated)

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + + _FinalStage id(Nullable id); + + /** + *

The order of the field.

+ */ + _FinalStage order(Optional order); + + _FinalStage order(Integer order); + + _FinalStage order(Nullable order); + + /** + *

The placeholder value of the field.

+ */ + _FinalStage placeholder(Optional placeholder); + + _FinalStage placeholder(String placeholder); + + _FinalStage placeholder(Nullable placeholder); + + /** + *

Whether or not the field is required.

+ */ + _FinalStage required(Optional required); + + _FinalStage required(Boolean required); + + _FinalStage required(Nullable required); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FieldTypeStage, NameStage, _FinalStage { + private CustomFieldTypes fieldType; + + private String name; + + private Optional required = Optional.empty(); + + private Optional placeholder = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateInvoicesRequestPlanCustomFieldsItem other) { + fieldType(other.getFieldType()); + id(other.getId()); + name(other.getName()); + order(other.getOrder()); + placeholder(other.getPlaceholder()); + required(other.getRequired()); + return this; + } + + /** + *

The type of the custom field.

+ *

The type of the custom field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("field_type") + public NameStage fieldType(@NotNull CustomFieldTypes fieldType) { + this.fieldType = Objects.requireNonNull(fieldType, "fieldType must not be null"); + return this; + } + + /** + *

The name of the custom field.

+ *

The name of the custom field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

Whether or not the field is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage required(Nullable required) { + if (required.isNull()) { + this.required = null; + } else if (required.isEmpty()) { + this.required = Optional.empty(); + } else { + this.required = Optional.of(required.get()); + } + return this; + } + + /** + *

Whether or not the field is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage required(Boolean required) { + this.required = Optional.ofNullable(required); + return this; + } + + /** + *

Whether or not the field is required.

+ */ + @java.lang.Override + @JsonSetter(value = "required", nulls = Nulls.SKIP) + public _FinalStage required(Optional required) { + this.required = required; + return this; + } + + /** + *

The placeholder value of the field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage placeholder(Nullable placeholder) { + if (placeholder.isNull()) { + this.placeholder = null; + } else if (placeholder.isEmpty()) { + this.placeholder = Optional.empty(); + } else { + this.placeholder = Optional.of(placeholder.get()); + } + return this; + } + + /** + *

The placeholder value of the field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage placeholder(String placeholder) { + this.placeholder = Optional.ofNullable(placeholder); + return this; + } + + /** + *

The placeholder value of the field.

+ */ + @java.lang.Override + @JsonSetter(value = "placeholder", nulls = Nulls.SKIP) + public _FinalStage placeholder(Optional placeholder) { + this.placeholder = placeholder; + return this; + } + + /** + *

The order of the field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(Nullable order) { + if (order.isNull()) { + this.order = null; + } else if (order.isEmpty()) { + this.order = Optional.empty(); + } else { + this.order = Optional.of(order.get()); + } + return this; + } + + /** + *

The order of the field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(Integer order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The order of the field.

+ */ + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + /** + *

The ID of the custom field (if being updated)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(Nullable id) { + if (id.isNull()) { + this.id = null; + } else if (id.isEmpty()) { + this.id = Optional.empty(); + } else { + this.id = Optional.of(id.get()); + } + return this; + } + + /** + *

The ID of the custom field (if being updated)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The ID of the custom field (if being updated)

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public UpdateInvoicesRequestPlanCustomFieldsItem build() { + return new UpdateInvoicesRequestPlanCustomFieldsItem( + fieldType, id, name, order, placeholder, required, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/invoices/types/UpdateInvoicesRequestPlanPaymentMethodConfiguration.java b/src/main/java/com/whop/api/resources/invoices/types/UpdateInvoicesRequestPlanPaymentMethodConfiguration.java new file mode 100644 index 00000000..fe6596e2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/invoices/types/UpdateInvoicesRequestPlanPaymentMethodConfiguration.java @@ -0,0 +1,221 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.invoices.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PaymentMethodTypes; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateInvoicesRequestPlanPaymentMethodConfiguration.Builder.class) +public final class UpdateInvoicesRequestPlanPaymentMethodConfiguration { + private final List disabled; + + private final List enabled; + + private final Optional includePlatformDefaults; + + private final Map additionalProperties; + + private UpdateInvoicesRequestPlanPaymentMethodConfiguration( + List disabled, + List enabled, + Optional includePlatformDefaults, + Map additionalProperties) { + this.disabled = disabled; + this.enabled = enabled; + this.includePlatformDefaults = includePlatformDefaults; + this.additionalProperties = additionalProperties; + } + + /** + * @return An array of payment method identifiers that are explicitly disabled. Only applies if the include_platform_defaults is true. + */ + @JsonProperty("disabled") + public List getDisabled() { + return disabled; + } + + /** + * @return An array of payment method identifiers that are explicitly enabled. This means these payment methods will be shown on checkout. Example use case is to only enable a specific payment method like cashapp, or extending the platform defaults with additional methods. + */ + @JsonProperty("enabled") + public List getEnabled() { + return enabled; + } + + /** + * @return Whether Whop's platform default payment method enablement settings are included in this configuration. The full list of default payment methods can be found in the documentation at docs.whop.com/payments. + */ + @JsonIgnore + public Optional getIncludePlatformDefaults() { + if (includePlatformDefaults == null) { + return Optional.empty(); + } + return includePlatformDefaults; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("include_platform_defaults") + private Optional _getIncludePlatformDefaults() { + return includePlatformDefaults; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateInvoicesRequestPlanPaymentMethodConfiguration + && equalTo((UpdateInvoicesRequestPlanPaymentMethodConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateInvoicesRequestPlanPaymentMethodConfiguration other) { + return disabled.equals(other.disabled) + && enabled.equals(other.enabled) + && includePlatformDefaults.equals(other.includePlatformDefaults); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.disabled, this.enabled, this.includePlatformDefaults); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List disabled = new ArrayList<>(); + + private List enabled = new ArrayList<>(); + + private Optional includePlatformDefaults = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateInvoicesRequestPlanPaymentMethodConfiguration other) { + disabled(other.getDisabled()); + enabled(other.getEnabled()); + includePlatformDefaults(other.getIncludePlatformDefaults()); + return this; + } + + /** + *

An array of payment method identifiers that are explicitly disabled. Only applies if the include_platform_defaults is true.

+ */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(List disabled) { + this.disabled.clear(); + if (disabled != null) { + this.disabled.addAll(disabled); + } + return this; + } + + public Builder addDisabled(PaymentMethodTypes disabled) { + this.disabled.add(disabled); + return this; + } + + public Builder addAllDisabled(List disabled) { + if (disabled != null) { + this.disabled.addAll(disabled); + } + return this; + } + + /** + *

An array of payment method identifiers that are explicitly enabled. This means these payment methods will be shown on checkout. Example use case is to only enable a specific payment method like cashapp, or extending the platform defaults with additional methods.

+ */ + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(List enabled) { + this.enabled.clear(); + if (enabled != null) { + this.enabled.addAll(enabled); + } + return this; + } + + public Builder addEnabled(PaymentMethodTypes enabled) { + this.enabled.add(enabled); + return this; + } + + public Builder addAllEnabled(List enabled) { + if (enabled != null) { + this.enabled.addAll(enabled); + } + return this; + } + + /** + *

Whether Whop's platform default payment method enablement settings are included in this configuration. The full list of default payment methods can be found in the documentation at docs.whop.com/payments.

+ */ + @JsonSetter(value = "include_platform_defaults", nulls = Nulls.SKIP) + public Builder includePlatformDefaults(Optional includePlatformDefaults) { + this.includePlatformDefaults = includePlatformDefaults; + return this; + } + + public Builder includePlatformDefaults(Boolean includePlatformDefaults) { + this.includePlatformDefaults = Optional.ofNullable(includePlatformDefaults); + return this; + } + + public Builder includePlatformDefaults(Nullable includePlatformDefaults) { + if (includePlatformDefaults.isNull()) { + this.includePlatformDefaults = null; + } else if (includePlatformDefaults.isEmpty()) { + this.includePlatformDefaults = Optional.empty(); + } else { + this.includePlatformDefaults = Optional.of(includePlatformDefaults.get()); + } + return this; + } + + public UpdateInvoicesRequestPlanPaymentMethodConfiguration build() { + return new UpdateInvoicesRequestPlanPaymentMethodConfiguration( + disabled, enabled, includePlatformDefaults, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/leads/AsyncLeadsClient.java b/src/main/java/com/whop/api/resources/leads/AsyncLeadsClient.java new file mode 100644 index 00000000..1fc35eec --- /dev/null +++ b/src/main/java/com/whop/api/resources/leads/AsyncLeadsClient.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.leads; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.leads.requests.CreateLeadsRequest; +import com.whop.api.resources.leads.requests.ListLeadsRequest; +import com.whop.api.resources.leads.requests.RetrieveLeadsRequest; +import com.whop.api.resources.leads.requests.UpdateLeadsRequest; +import com.whop.api.types.Lead; +import com.whop.api.types.LeadListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncLeadsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawLeadsClient rawClient; + + public AsyncLeadsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawLeadsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawLeadsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of leads for a company, with optional filtering by product and creation date. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> list(ListLeadsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of leads for a company, with optional filtering by product and creation date. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> list( + ListLeadsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Record a new lead for a company, capturing a potential customer's interest in a specific product. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture create(CreateLeadsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Record a new lead for a company, capturing a potential customer's interest in a specific product. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture create(CreateLeadsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveLeadsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveLeadsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture update(String id, UpdateLeadsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture update(String id, UpdateLeadsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/leads/AsyncRawLeadsClient.java b/src/main/java/com/whop/api/resources/leads/AsyncRawLeadsClient.java new file mode 100644 index 00000000..c024f6d1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/leads/AsyncRawLeadsClient.java @@ -0,0 +1,626 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.leads; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.leads.requests.CreateLeadsRequest; +import com.whop.api.resources.leads.requests.ListLeadsRequest; +import com.whop.api.resources.leads.requests.RetrieveLeadsRequest; +import com.whop.api.resources.leads.requests.UpdateLeadsRequest; +import com.whop.api.resources.leads.types.ListLeadsResponse; +import com.whop.api.types.Lead; +import com.whop.api.types.LeadListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawLeadsClient { + protected final ClientOptions clientOptions; + + public AsyncRawLeadsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of leads for a company, with optional filtering by product and creation date. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture>> list(ListLeadsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of leads for a company, with optional filtering by product and creation date. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture>> list( + ListLeadsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("leads"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListLeadsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListLeadsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListLeadsRequest nextRequest = ListLeadsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Record a new lead for a company, capturing a potential customer's interest in a specific product. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> create(CreateLeadsRequest request) { + return create(request, null); + } + + /** + * Record a new lead for a company, capturing a potential customer's interest in a specific product. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> create( + CreateLeadsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("leads"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Lead.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveLeadsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveLeadsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RetrieveLeadsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveLeadsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("leads") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Lead.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> update(String id) { + return update(id, UpdateLeadsRequest.builder().build()); + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateLeadsRequest.builder().build(), requestOptions); + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> update(String id, UpdateLeadsRequest request) { + return update(id, request, null); + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> update( + String id, UpdateLeadsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("leads") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Lead.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/leads/LeadsClient.java b/src/main/java/com/whop/api/resources/leads/LeadsClient.java new file mode 100644 index 00000000..a0661f69 --- /dev/null +++ b/src/main/java/com/whop/api/resources/leads/LeadsClient.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.leads; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.leads.requests.CreateLeadsRequest; +import com.whop.api.resources.leads.requests.ListLeadsRequest; +import com.whop.api.resources.leads.requests.RetrieveLeadsRequest; +import com.whop.api.resources.leads.requests.UpdateLeadsRequest; +import com.whop.api.types.Lead; +import com.whop.api.types.LeadListItem; + +public class LeadsClient { + protected final ClientOptions clientOptions; + + private final RawLeadsClient rawClient; + + public LeadsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawLeadsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawLeadsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of leads for a company, with optional filtering by product and creation date. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public SyncPagingIterable list(ListLeadsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of leads for a company, with optional filtering by product and creation date. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public SyncPagingIterable list(ListLeadsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Record a new lead for a company, capturing a potential customer's interest in a specific product. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public Lead create(CreateLeadsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Record a new lead for a company, capturing a potential customer's interest in a specific product. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public Lead create(CreateLeadsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public Lead retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public Lead retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public Lead retrieve(String id, RetrieveLeadsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public Lead retrieve(String id, RetrieveLeadsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public Lead update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public Lead update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public Lead update(String id, UpdateLeadsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public Lead update(String id, UpdateLeadsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/leads/RawLeadsClient.java b/src/main/java/com/whop/api/resources/leads/RawLeadsClient.java new file mode 100644 index 00000000..2b68ea40 --- /dev/null +++ b/src/main/java/com/whop/api/resources/leads/RawLeadsClient.java @@ -0,0 +1,502 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.leads; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.leads.requests.CreateLeadsRequest; +import com.whop.api.resources.leads.requests.ListLeadsRequest; +import com.whop.api.resources.leads.requests.RetrieveLeadsRequest; +import com.whop.api.resources.leads.requests.UpdateLeadsRequest; +import com.whop.api.resources.leads.types.ListLeadsResponse; +import com.whop.api.types.Lead; +import com.whop.api.types.LeadListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawLeadsClient { + protected final ClientOptions clientOptions; + + public RawLeadsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of leads for a company, with optional filtering by product and creation date. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListLeadsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of leads for a company, with optional filtering by product and creation date. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListLeadsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("leads"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListLeadsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListLeadsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListLeadsRequest nextRequest = ListLeadsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Record a new lead for a company, capturing a potential customer's interest in a specific product. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse create(CreateLeadsRequest request) { + return create(request, null); + } + + /** + * Record a new lead for a company, capturing a potential customer's interest in a specific product. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse create(CreateLeadsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("leads"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Lead.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveLeadsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveLeadsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveLeadsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing lead. + *

Required permissions:

+ *
    + *
  • lead:basic:read
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveLeadsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("leads") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Lead.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateLeadsRequest.builder().build()); + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateLeadsRequest.builder().build(), requestOptions); + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateLeadsRequest request) { + return update(id, request, null); + } + + /** + * Update the metadata or referrer information on an existing lead record. + *

Required permissions:

+ *
    + *
  • lead:manage
  • + *
  • member:email:read
  • + *
  • access_pass:basic:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateLeadsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("leads") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Lead.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/leads/requests/CreateLeadsRequest.java b/src/main/java/com/whop/api/resources/leads/requests/CreateLeadsRequest.java new file mode 100644 index 00000000..17b2ea1b --- /dev/null +++ b/src/main/java/com/whop/api/resources/leads/requests/CreateLeadsRequest.java @@ -0,0 +1,416 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.leads.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateLeadsRequest.Builder.class) +public final class CreateLeadsRequest { + private final String companyId; + + private final Optional> metadata; + + private final Optional productId; + + private final Optional referrer; + + private final Optional userId; + + private final Map additionalProperties; + + private CreateLeadsRequest( + String companyId, + Optional> metadata, + Optional productId, + Optional referrer, + Optional userId, + Map additionalProperties) { + this.companyId = companyId; + this.metadata = metadata; + this.productId = productId; + this.referrer = referrer; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the company to create the lead for, starting with 'biz_'. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return A JSON object of custom metadata to attach to the lead for tracking purposes. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The unique identifier of the product the lead is interested in, starting with 'prod_'. + */ + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + /** + * @return The referral URL that brought the lead to the company, such as 'https://example.com/landing'. + */ + @JsonIgnore + public Optional getReferrer() { + if (referrer == null) { + return Optional.empty(); + } + return referrer; + } + + /** + * @return The unique identifier of the user to record as the lead. If authenticated as a user, that user is used automatically. + */ + @JsonIgnore + public Optional getUserId() { + if (userId == null) { + return Optional.empty(); + } + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("referrer") + private Optional _getReferrer() { + return referrer; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_id") + private Optional _getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateLeadsRequest && equalTo((CreateLeadsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateLeadsRequest other) { + return companyId.equals(other.companyId) + && metadata.equals(other.metadata) + && productId.equals(other.productId) + && referrer.equals(other.referrer) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.metadata, this.productId, this.referrer, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to create the lead for, starting with 'biz_'.

+ */ + _FinalStage companyId(@NotNull String companyId); + + Builder from(CreateLeadsRequest other); + } + + public interface _FinalStage { + CreateLeadsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A JSON object of custom metadata to attach to the lead for tracking purposes.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The unique identifier of the product the lead is interested in, starting with 'prod_'.

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + + _FinalStage productId(Nullable productId); + + /** + *

The referral URL that brought the lead to the company, such as 'https://example.com/landing'.

+ */ + _FinalStage referrer(Optional referrer); + + _FinalStage referrer(String referrer); + + _FinalStage referrer(Nullable referrer); + + /** + *

The unique identifier of the user to record as the lead. If authenticated as a user, that user is used automatically.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + + _FinalStage userId(Nullable userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional userId = Optional.empty(); + + private Optional referrer = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateLeadsRequest other) { + companyId(other.getCompanyId()); + metadata(other.getMetadata()); + productId(other.getProductId()); + referrer(other.getReferrer()); + userId(other.getUserId()); + return this; + } + + /** + *

The unique identifier of the company to create the lead for, starting with 'biz_'.

+ *

The unique identifier of the company to create the lead for, starting with 'biz_'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The unique identifier of the user to record as the lead. If authenticated as a user, that user is used automatically.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(Nullable userId) { + if (userId.isNull()) { + this.userId = null; + } else if (userId.isEmpty()) { + this.userId = Optional.empty(); + } else { + this.userId = Optional.of(userId.get()); + } + return this; + } + + /** + *

The unique identifier of the user to record as the lead. If authenticated as a user, that user is used automatically.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

The unique identifier of the user to record as the lead. If authenticated as a user, that user is used automatically.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

The referral URL that brought the lead to the company, such as 'https://example.com/landing'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referrer(Nullable referrer) { + if (referrer.isNull()) { + this.referrer = null; + } else if (referrer.isEmpty()) { + this.referrer = Optional.empty(); + } else { + this.referrer = Optional.of(referrer.get()); + } + return this; + } + + /** + *

The referral URL that brought the lead to the company, such as 'https://example.com/landing'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referrer(String referrer) { + this.referrer = Optional.ofNullable(referrer); + return this; + } + + /** + *

The referral URL that brought the lead to the company, such as 'https://example.com/landing'.

+ */ + @java.lang.Override + @JsonSetter(value = "referrer", nulls = Nulls.SKIP) + public _FinalStage referrer(Optional referrer) { + this.referrer = referrer; + return this; + } + + /** + *

The unique identifier of the product the lead is interested in, starting with 'prod_'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + /** + *

The unique identifier of the product the lead is interested in, starting with 'prod_'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

The unique identifier of the product the lead is interested in, starting with 'prod_'.

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

A JSON object of custom metadata to attach to the lead for tracking purposes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

A JSON object of custom metadata to attach to the lead for tracking purposes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

A JSON object of custom metadata to attach to the lead for tracking purposes.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + @java.lang.Override + public CreateLeadsRequest build() { + return new CreateLeadsRequest(companyId, metadata, productId, referrer, userId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/leads/requests/ListLeadsRequest.java b/src/main/java/com/whop/api/resources/leads/requests/ListLeadsRequest.java new file mode 100644 index 00000000..6db0cd87 --- /dev/null +++ b/src/main/java/com/whop/api/resources/leads/requests/ListLeadsRequest.java @@ -0,0 +1,462 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.leads.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListLeadsRequest.Builder.class) +public final class ListLeadsRequest { + private final Optional> productIds; + + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String companyId; + + private final Optional createdAfter; + + private final Optional createdBefore; + + private final Map additionalProperties; + + private ListLeadsRequest( + Optional> productIds, + Optional after, + Optional before, + Optional first, + Optional last, + String companyId, + Optional createdAfter, + Optional createdBefore, + Map additionalProperties) { + this.productIds = productIds; + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.createdAfter = createdAfter; + this.createdBefore = createdBefore; + this.additionalProperties = additionalProperties; + } + + /** + * @return Filter leads to only those associated with these specific product identifiers. + */ + @JsonProperty("product_ids") + public Optional> getProductIds() { + return productIds; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to list leads for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return Only return leads created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Only return leads created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListLeadsRequest && equalTo((ListLeadsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListLeadsRequest other) { + return productIds.equals(other.productIds) + && after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId) + && createdAfter.equals(other.createdAfter) + && createdBefore.equals(other.createdBefore); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.productIds, + this.after, + this.before, + this.first, + this.last, + this.companyId, + this.createdAfter, + this.createdBefore); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to list leads for.

+ */ + _FinalStage companyId(@NotNull String companyId); + + Builder from(ListLeadsRequest other); + } + + public interface _FinalStage { + ListLeadsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Filter leads to only those associated with these specific product identifiers.

+ */ + _FinalStage productIds(Optional> productIds); + + _FinalStage productIds(List productIds); + + _FinalStage productIds(String productIds); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + /** + *

Only return leads created after this timestamp.

+ */ + _FinalStage createdAfter(Optional createdAfter); + + _FinalStage createdAfter(OffsetDateTime createdAfter); + + /** + *

Only return leads created before this timestamp.

+ */ + _FinalStage createdBefore(Optional createdBefore); + + _FinalStage createdBefore(OffsetDateTime createdBefore); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional> productIds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListLeadsRequest other) { + productIds(other.getProductIds()); + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + createdAfter(other.getCreatedAfter()); + createdBefore(other.getCreatedBefore()); + return this; + } + + /** + *

The unique identifier of the company to list leads for.

+ *

The unique identifier of the company to list leads for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

Only return leads created before this timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return leads created before this timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public _FinalStage createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + /** + *

Only return leads created after this timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only return leads created after this timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public _FinalStage createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public _FinalStage productIds(String productIds) { + this.productIds = Optional.of(Collections.singletonList(productIds)); + return this; + } + + /** + *

Filter leads to only those associated with these specific product identifiers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productIds(List productIds) { + this.productIds = Optional.ofNullable(productIds); + return this; + } + + /** + *

Filter leads to only those associated with these specific product identifiers.

+ */ + @java.lang.Override + @JsonSetter(value = "product_ids", nulls = Nulls.SKIP) + public _FinalStage productIds(Optional> productIds) { + this.productIds = productIds; + return this; + } + + @java.lang.Override + public ListLeadsRequest build() { + return new ListLeadsRequest( + productIds, + after, + before, + first, + last, + companyId, + createdAfter, + createdBefore, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/leads/requests/RetrieveLeadsRequest.java b/src/main/java/com/whop/api/resources/leads/requests/RetrieveLeadsRequest.java new file mode 100644 index 00000000..8262d655 --- /dev/null +++ b/src/main/java/com/whop/api/resources/leads/requests/RetrieveLeadsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.leads.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveLeadsRequest.Builder.class) +public final class RetrieveLeadsRequest { + private final Map additionalProperties; + + private RetrieveLeadsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveLeadsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveLeadsRequest other) { + return this; + } + + public RetrieveLeadsRequest build() { + return new RetrieveLeadsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/leads/requests/UpdateLeadsRequest.java b/src/main/java/com/whop/api/resources/leads/requests/UpdateLeadsRequest.java new file mode 100644 index 00000000..053b49dc --- /dev/null +++ b/src/main/java/com/whop/api/resources/leads/requests/UpdateLeadsRequest.java @@ -0,0 +1,185 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.leads.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateLeadsRequest.Builder.class) +public final class UpdateLeadsRequest { + private final Optional> metadata; + + private final Optional referrer; + + private final Map additionalProperties; + + private UpdateLeadsRequest( + Optional> metadata, + Optional referrer, + Map additionalProperties) { + this.metadata = metadata; + this.referrer = referrer; + this.additionalProperties = additionalProperties; + } + + /** + * @return A JSON object of custom metadata to set on the lead, replacing any existing metadata. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The updated referral URL for the lead, such as 'https://example.com/landing'. + */ + @JsonIgnore + public Optional getReferrer() { + if (referrer == null) { + return Optional.empty(); + } + return referrer; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("referrer") + private Optional _getReferrer() { + return referrer; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateLeadsRequest && equalTo((UpdateLeadsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateLeadsRequest other) { + return metadata.equals(other.metadata) && referrer.equals(other.referrer); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.metadata, this.referrer); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> metadata = Optional.empty(); + + private Optional referrer = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateLeadsRequest other) { + metadata(other.getMetadata()); + referrer(other.getReferrer()); + return this; + } + + /** + *

A JSON object of custom metadata to set on the lead, replacing any existing metadata.

+ */ + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + public Builder metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

The updated referral URL for the lead, such as 'https://example.com/landing'.

+ */ + @JsonSetter(value = "referrer", nulls = Nulls.SKIP) + public Builder referrer(Optional referrer) { + this.referrer = referrer; + return this; + } + + public Builder referrer(String referrer) { + this.referrer = Optional.ofNullable(referrer); + return this; + } + + public Builder referrer(Nullable referrer) { + if (referrer.isNull()) { + this.referrer = null; + } else if (referrer.isEmpty()) { + this.referrer = Optional.empty(); + } else { + this.referrer = Optional.of(referrer.get()); + } + return this; + } + + public UpdateLeadsRequest build() { + return new UpdateLeadsRequest(metadata, referrer, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/leads/types/ListLeadsResponse.java b/src/main/java/com/whop/api/resources/leads/types/ListLeadsResponse.java new file mode 100644 index 00000000..02caddc5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/leads/types/ListLeadsResponse.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.leads.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.LeadListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListLeadsResponse.Builder.class) +public final class ListLeadsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListLeadsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListLeadsResponse && equalTo((ListLeadsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListLeadsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListLeadsResponse other); + } + + public interface _FinalStage { + ListLeadsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(LeadListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListLeadsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(LeadListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListLeadsResponse build() { + return new ListLeadsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ledgeraccounts/AsyncLedgerAccountsClient.java b/src/main/java/com/whop/api/resources/ledgeraccounts/AsyncLedgerAccountsClient.java new file mode 100644 index 00000000..ff4a81cf --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgeraccounts/AsyncLedgerAccountsClient.java @@ -0,0 +1,77 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgeraccounts; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.ledgeraccounts.requests.RetrieveLedgerAccountsRequest; +import com.whop.api.types.LedgerAccount; +import java.util.concurrent.CompletableFuture; + +public class AsyncLedgerAccountsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawLedgerAccountsClient rawClient; + + public AsyncLedgerAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawLedgerAccountsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawLedgerAccountsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveLedgerAccountsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveLedgerAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/ledgeraccounts/AsyncRawLedgerAccountsClient.java b/src/main/java/com/whop/api/resources/ledgeraccounts/AsyncRawLedgerAccountsClient.java new file mode 100644 index 00000000..4177dfc9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgeraccounts/AsyncRawLedgerAccountsClient.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgeraccounts; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.ledgeraccounts.requests.RetrieveLedgerAccountsRequest; +import com.whop.api.types.LedgerAccount; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawLedgerAccountsClient { + protected final ClientOptions clientOptions; + + public AsyncRawLedgerAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveLedgerAccountsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveLedgerAccountsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveLedgerAccountsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveLedgerAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ledger_accounts") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LedgerAccount.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/ledgeraccounts/LedgerAccountsClient.java b/src/main/java/com/whop/api/resources/ledgeraccounts/LedgerAccountsClient.java new file mode 100644 index 00000000..3ad26eb2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgeraccounts/LedgerAccountsClient.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgeraccounts; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.ledgeraccounts.requests.RetrieveLedgerAccountsRequest; +import com.whop.api.types.LedgerAccount; + +public class LedgerAccountsClient { + protected final ClientOptions clientOptions; + + private final RawLedgerAccountsClient rawClient; + + public LedgerAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawLedgerAccountsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawLedgerAccountsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public LedgerAccount retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public LedgerAccount retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public LedgerAccount retrieve(String id, RetrieveLedgerAccountsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public LedgerAccount retrieve(String id, RetrieveLedgerAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/ledgeraccounts/RawLedgerAccountsClient.java b/src/main/java/com/whop/api/resources/ledgeraccounts/RawLedgerAccountsClient.java new file mode 100644 index 00000000..c73e76a5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgeraccounts/RawLedgerAccountsClient.java @@ -0,0 +1,143 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgeraccounts; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.ledgeraccounts.requests.RetrieveLedgerAccountsRequest; +import com.whop.api.types.LedgerAccount; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawLedgerAccountsClient { + protected final ClientOptions clientOptions; + + public RawLedgerAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveLedgerAccountsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveLedgerAccountsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveLedgerAccountsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing ledger account. + *

Required permissions:

+ *
    + *
  • company:balance:read
  • + *
  • payout:account:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveLedgerAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("ledger_accounts") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LedgerAccount.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/ledgeraccounts/requests/RetrieveLedgerAccountsRequest.java b/src/main/java/com/whop/api/resources/ledgeraccounts/requests/RetrieveLedgerAccountsRequest.java new file mode 100644 index 00000000..31f421ce --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgeraccounts/requests/RetrieveLedgerAccountsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgeraccounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveLedgerAccountsRequest.Builder.class) +public final class RetrieveLedgerAccountsRequest { + private final Map additionalProperties; + + private RetrieveLedgerAccountsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveLedgerAccountsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveLedgerAccountsRequest other) { + return this; + } + + public RetrieveLedgerAccountsRequest build() { + return new RetrieveLedgerAccountsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ledgeraccounts/types/PostLedgerAccountFundsAvailablePayload.java b/src/main/java/com/whop/api/resources/ledgeraccounts/types/PostLedgerAccountFundsAvailablePayload.java new file mode 100644 index 00000000..c7014e81 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgeraccounts/types/PostLedgerAccountFundsAvailablePayload.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgeraccounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.LedgerAccount; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostLedgerAccountFundsAvailablePayload.Builder.class) +public final class PostLedgerAccountFundsAvailablePayload { + private final Optional accountId; + + private final PostLedgerAccountFundsAvailablePayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final LedgerAccount data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostLedgerAccountFundsAvailablePayloadType type; + + private final Map additionalProperties; + + private PostLedgerAccountFundsAvailablePayload( + Optional accountId, + PostLedgerAccountFundsAvailablePayloadApiVersion apiVersion, + Optional apiVersionDate, + LedgerAccount data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostLedgerAccountFundsAvailablePayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostLedgerAccountFundsAvailablePayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public LedgerAccount getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostLedgerAccountFundsAvailablePayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostLedgerAccountFundsAvailablePayload + && equalTo((PostLedgerAccountFundsAvailablePayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostLedgerAccountFundsAvailablePayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostLedgerAccountFundsAvailablePayloadApiVersion apiVersion); + + Builder from(PostLedgerAccountFundsAvailablePayload other); + } + + public interface DataStage { + IdStage data(@NotNull LedgerAccount data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostLedgerAccountFundsAvailablePayloadType type); + } + + public interface _FinalStage { + PostLedgerAccountFundsAvailablePayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostLedgerAccountFundsAvailablePayloadApiVersion apiVersion; + + private LedgerAccount data; + + private String id; + + private OffsetDateTime timestamp; + + private PostLedgerAccountFundsAvailablePayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostLedgerAccountFundsAvailablePayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostLedgerAccountFundsAvailablePayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull LedgerAccount data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostLedgerAccountFundsAvailablePayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostLedgerAccountFundsAvailablePayload build() { + return new PostLedgerAccountFundsAvailablePayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ledgeraccounts/types/PostLedgerAccountFundsAvailablePayloadApiVersion.java b/src/main/java/com/whop/api/resources/ledgeraccounts/types/PostLedgerAccountFundsAvailablePayloadApiVersion.java new file mode 100644 index 00000000..12855e31 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgeraccounts/types/PostLedgerAccountFundsAvailablePayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgeraccounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostLedgerAccountFundsAvailablePayloadApiVersion { + public static final PostLedgerAccountFundsAvailablePayloadApiVersion V1 = + new PostLedgerAccountFundsAvailablePayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostLedgerAccountFundsAvailablePayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostLedgerAccountFundsAvailablePayloadApiVersion + && this.string.equals(((PostLedgerAccountFundsAvailablePayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostLedgerAccountFundsAvailablePayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostLedgerAccountFundsAvailablePayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ledgeraccounts/types/PostLedgerAccountFundsAvailablePayloadType.java b/src/main/java/com/whop/api/resources/ledgeraccounts/types/PostLedgerAccountFundsAvailablePayloadType.java new file mode 100644 index 00000000..f42b7c91 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgeraccounts/types/PostLedgerAccountFundsAvailablePayloadType.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgeraccounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostLedgerAccountFundsAvailablePayloadType { + public static final PostLedgerAccountFundsAvailablePayloadType LEDGER_ACCOUNT_FUNDS_AVAILABLE = + new PostLedgerAccountFundsAvailablePayloadType( + Value.LEDGER_ACCOUNT_FUNDS_AVAILABLE, "ledger_account.funds_available"); + + private final Value value; + + private final String string; + + PostLedgerAccountFundsAvailablePayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostLedgerAccountFundsAvailablePayloadType + && this.string.equals(((PostLedgerAccountFundsAvailablePayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LEDGER_ACCOUNT_FUNDS_AVAILABLE: + return visitor.visitLedgerAccountFundsAvailable(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostLedgerAccountFundsAvailablePayloadType valueOf(String value) { + switch (value) { + case "ledger_account.funds_available": + return LEDGER_ACCOUNT_FUNDS_AVAILABLE; + default: + return new PostLedgerAccountFundsAvailablePayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + LEDGER_ACCOUNT_FUNDS_AVAILABLE, + + UNKNOWN + } + + public interface Visitor { + T visitLedgerAccountFundsAvailable(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ledgers/AsyncLedgersClient.java b/src/main/java/com/whop/api/resources/ledgers/AsyncLedgersClient.java new file mode 100644 index 00000000..618ac067 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgers/AsyncLedgersClient.java @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgers; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.ledgers.requests.GetFinancialReportRequest; +import com.whop.api.resources.ledgers.types.GetFinancialReportResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncLedgersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawLedgersClient rawClient; + + public AsyncLedgersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawLedgersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawLedgersClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a financial report — balance activity, income statement, or balance summary — for an account over a date range. + */ + public CompletableFuture getFinancialReport(GetFinancialReportRequest request) { + return this.rawClient.getFinancialReport(request).thenApply(response -> response.body()); + } + + /** + * Returns a financial report — balance activity, income statement, or balance summary — for an account over a date range. + */ + public CompletableFuture getFinancialReport( + GetFinancialReportRequest request, RequestOptions requestOptions) { + return this.rawClient.getFinancialReport(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/ledgers/AsyncRawLedgersClient.java b/src/main/java/com/whop/api/resources/ledgers/AsyncRawLedgersClient.java new file mode 100644 index 00000000..f6f9831f --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgers/AsyncRawLedgersClient.java @@ -0,0 +1,159 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.ledgers.requests.GetFinancialReportRequest; +import com.whop.api.resources.ledgers.types.GetFinancialReportResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawLedgersClient { + protected final ClientOptions clientOptions; + + public AsyncRawLedgersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a financial report — balance activity, income statement, or balance summary — for an account over a date range. + */ + public CompletableFuture> getFinancialReport( + GetFinancialReportRequest request) { + return getFinancialReport(request, null); + } + + /** + * Returns a financial report — balance activity, income statement, or balance summary — for an account over a date range. + */ + public CompletableFuture> getFinancialReport( + GetFinancialReportRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("financial_reports"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "report_type", request.getReportType(), false); + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getInCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "in_currency", request.getInCurrency().get(), false); + } + if (request.getFromDate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from_date", request.getFromDate().get(), false); + } + if (request.getToDate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "to_date", request.getToDate().get(), false); + } + if (request.getGroupBy().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "group_by", request.getGroupBy().get(), false); + } + if (request.getTimezone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "timezone", request.getTimezone().get(), false); + } + if (request.getCumulative().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "cumulative", request.getCumulative().get(), false); + } + if (request.getScopeAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "scope_account_id", request.getScopeAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetFinancialReportResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/ledgers/LedgersClient.java b/src/main/java/com/whop/api/resources/ledgers/LedgersClient.java new file mode 100644 index 00000000..0dfa0a96 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgers/LedgersClient.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgers; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.ledgers.requests.GetFinancialReportRequest; +import com.whop.api.resources.ledgers.types.GetFinancialReportResponse; + +public class LedgersClient { + protected final ClientOptions clientOptions; + + private final RawLedgersClient rawClient; + + public LedgersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawLedgersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawLedgersClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a financial report — balance activity, income statement, or balance summary — for an account over a date range. + */ + public GetFinancialReportResponse getFinancialReport(GetFinancialReportRequest request) { + return this.rawClient.getFinancialReport(request).body(); + } + + /** + * Returns a financial report — balance activity, income statement, or balance summary — for an account over a date range. + */ + public GetFinancialReportResponse getFinancialReport( + GetFinancialReportRequest request, RequestOptions requestOptions) { + return this.rawClient.getFinancialReport(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/ledgers/RawLedgersClient.java b/src/main/java/com/whop/api/resources/ledgers/RawLedgersClient.java new file mode 100644 index 00000000..6bd22f47 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgers/RawLedgersClient.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.ledgers.requests.GetFinancialReportRequest; +import com.whop.api.resources.ledgers.types.GetFinancialReportResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawLedgersClient { + protected final ClientOptions clientOptions; + + public RawLedgersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a financial report — balance activity, income statement, or balance summary — for an account over a date range. + */ + public WhopApiHttpResponse getFinancialReport(GetFinancialReportRequest request) { + return getFinancialReport(request, null); + } + + /** + * Returns a financial report — balance activity, income statement, or balance summary — for an account over a date range. + */ + public WhopApiHttpResponse getFinancialReport( + GetFinancialReportRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("financial_reports"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "report_type", request.getReportType(), false); + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getInCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "in_currency", request.getInCurrency().get(), false); + } + if (request.getFromDate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from_date", request.getFromDate().get(), false); + } + if (request.getToDate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "to_date", request.getToDate().get(), false); + } + if (request.getGroupBy().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "group_by", request.getGroupBy().get(), false); + } + if (request.getTimezone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "timezone", request.getTimezone().get(), false); + } + if (request.getCumulative().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "cumulative", request.getCumulative().get(), false); + } + if (request.getScopeAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "scope_account_id", request.getScopeAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetFinancialReportResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/ledgers/requests/GetFinancialReportRequest.java b/src/main/java/com/whop/api/resources/ledgers/requests/GetFinancialReportRequest.java new file mode 100644 index 00000000..e2d743db --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgers/requests/GetFinancialReportRequest.java @@ -0,0 +1,535 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.ledgers.types.GetFinancialReportRequestGroupBy; +import com.whop.api.resources.ledgers.types.GetFinancialReportRequestReportType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetFinancialReportRequest.Builder.class) +public final class GetFinancialReportRequest { + private final String accountId; + + private final GetFinancialReportRequestReportType reportType; + + private final Optional currency; + + private final Optional inCurrency; + + private final Optional fromDate; + + private final Optional toDate; + + private final Optional groupBy; + + private final Optional timezone; + + private final Optional cumulative; + + private final Optional scopeAccountId; + + private final Map additionalProperties; + + private GetFinancialReportRequest( + String accountId, + GetFinancialReportRequestReportType reportType, + Optional currency, + Optional inCurrency, + Optional fromDate, + Optional toDate, + Optional groupBy, + Optional timezone, + Optional cumulative, + Optional scopeAccountId, + Map additionalProperties) { + this.accountId = accountId; + this.reportType = reportType; + this.currency = currency; + this.inCurrency = inCurrency; + this.fromDate = fromDate; + this.toDate = toDate; + this.groupBy = groupBy; + this.timezone = timezone; + this.cumulative = cumulative; + this.scopeAccountId = scopeAccountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The owning account ID (a biz_ identifier), or global for a platform-wide report across all ledger accounts (requires internal admin access). + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return The type of financial report to generate. + */ + @JsonProperty("report_type") + public GetFinancialReportRequestReportType getReportType() { + return reportType; + } + + /** + * @return Filter rows to this currency, for example usd. Defaults to usd unless in_currency is provided. + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + /** + * @return Aggregate all activity into this display currency via FX conversion. + */ + @JsonProperty("in_currency") + public Optional getInCurrency() { + return inCurrency; + } + + /** + * @return Start of the report window as an ISO 8601 timestamp (UTC). Required for platform-wide (global) reports. + */ + @JsonProperty("from_date") + public Optional getFromDate() { + return fromDate; + } + + /** + * @return End of the report window as an ISO 8601 timestamp (UTC). Required for platform-wide (global) reports. + */ + @JsonProperty("to_date") + public Optional getToDate() { + return toDate; + } + + /** + * @return Grouping granularity for report rows. + */ + @JsonProperty("group_by") + public Optional getGroupBy() { + return groupBy; + } + + /** + * @return IANA timezone (for example America/New_York) used to bucket report periods and to interpret calendar-day boundaries for balance snapshots. Defaults to UTC. from_date/to_date remain exact instants regardless of this setting. + */ + @JsonProperty("timezone") + public Optional getTimezone() { + return timezone; + } + + /** + * @return Platform-wide (global) reports only: when true, return cumulative balances as of to_date (all history, no lower bound) instead of activity within the period. + */ + @JsonProperty("cumulative") + public Optional getCumulative() { + return cumulative; + } + + /** + * @return Platform-wide (global) reports only: narrow the report to ledger lines on the ledger account owned by this account ID (a biz_ identifier). Ignored unless account_id is global. + */ + @JsonProperty("scope_account_id") + public Optional getScopeAccountId() { + return scopeAccountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetFinancialReportRequest && equalTo((GetFinancialReportRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetFinancialReportRequest other) { + return accountId.equals(other.accountId) + && reportType.equals(other.reportType) + && currency.equals(other.currency) + && inCurrency.equals(other.inCurrency) + && fromDate.equals(other.fromDate) + && toDate.equals(other.toDate) + && groupBy.equals(other.groupBy) + && timezone.equals(other.timezone) + && cumulative.equals(other.cumulative) + && scopeAccountId.equals(other.scopeAccountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.reportType, + this.currency, + this.inCurrency, + this.fromDate, + this.toDate, + this.groupBy, + this.timezone, + this.cumulative, + this.scopeAccountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

The owning account ID (a biz_ identifier), or global for a platform-wide report across all ledger accounts (requires internal admin access).

+ */ + ReportTypeStage accountId(@NotNull String accountId); + + Builder from(GetFinancialReportRequest other); + } + + public interface ReportTypeStage { + /** + *

The type of financial report to generate.

+ */ + _FinalStage reportType(@NotNull GetFinancialReportRequestReportType reportType); + } + + public interface _FinalStage { + GetFinancialReportRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Filter rows to this currency, for example usd. Defaults to usd unless in_currency is provided.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + /** + *

Aggregate all activity into this display currency via FX conversion.

+ */ + _FinalStage inCurrency(Optional inCurrency); + + _FinalStage inCurrency(String inCurrency); + + /** + *

Start of the report window as an ISO 8601 timestamp (UTC). Required for platform-wide (global) reports.

+ */ + _FinalStage fromDate(Optional fromDate); + + _FinalStage fromDate(String fromDate); + + /** + *

End of the report window as an ISO 8601 timestamp (UTC). Required for platform-wide (global) reports.

+ */ + _FinalStage toDate(Optional toDate); + + _FinalStage toDate(String toDate); + + /** + *

Grouping granularity for report rows.

+ */ + _FinalStage groupBy(Optional groupBy); + + _FinalStage groupBy(GetFinancialReportRequestGroupBy groupBy); + + /** + *

IANA timezone (for example America/New_York) used to bucket report periods and to interpret calendar-day boundaries for balance snapshots. Defaults to UTC. from_date/to_date remain exact instants regardless of this setting.

+ */ + _FinalStage timezone(Optional timezone); + + _FinalStage timezone(String timezone); + + /** + *

Platform-wide (global) reports only: when true, return cumulative balances as of to_date (all history, no lower bound) instead of activity within the period.

+ */ + _FinalStage cumulative(Optional cumulative); + + _FinalStage cumulative(Boolean cumulative); + + /** + *

Platform-wide (global) reports only: narrow the report to ledger lines on the ledger account owned by this account ID (a biz_ identifier). Ignored unless account_id is global.

+ */ + _FinalStage scopeAccountId(Optional scopeAccountId); + + _FinalStage scopeAccountId(String scopeAccountId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, ReportTypeStage, _FinalStage { + private String accountId; + + private GetFinancialReportRequestReportType reportType; + + private Optional scopeAccountId = Optional.empty(); + + private Optional cumulative = Optional.empty(); + + private Optional timezone = Optional.empty(); + + private Optional groupBy = Optional.empty(); + + private Optional toDate = Optional.empty(); + + private Optional fromDate = Optional.empty(); + + private Optional inCurrency = Optional.empty(); + + private Optional currency = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetFinancialReportRequest other) { + accountId(other.getAccountId()); + reportType(other.getReportType()); + currency(other.getCurrency()); + inCurrency(other.getInCurrency()); + fromDate(other.getFromDate()); + toDate(other.getToDate()); + groupBy(other.getGroupBy()); + timezone(other.getTimezone()); + cumulative(other.getCumulative()); + scopeAccountId(other.getScopeAccountId()); + return this; + } + + /** + *

The owning account ID (a biz_ identifier), or global for a platform-wide report across all ledger accounts (requires internal admin access).

+ *

The owning account ID (a biz_ identifier), or global for a platform-wide report across all ledger accounts (requires internal admin access).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public ReportTypeStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

The type of financial report to generate.

+ *

The type of financial report to generate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("report_type") + public _FinalStage reportType(@NotNull GetFinancialReportRequestReportType reportType) { + this.reportType = Objects.requireNonNull(reportType, "reportType must not be null"); + return this; + } + + /** + *

Platform-wide (global) reports only: narrow the report to ledger lines on the ledger account owned by this account ID (a biz_ identifier). Ignored unless account_id is global.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage scopeAccountId(String scopeAccountId) { + this.scopeAccountId = Optional.ofNullable(scopeAccountId); + return this; + } + + /** + *

Platform-wide (global) reports only: narrow the report to ledger lines on the ledger account owned by this account ID (a biz_ identifier). Ignored unless account_id is global.

+ */ + @java.lang.Override + @JsonSetter(value = "scope_account_id", nulls = Nulls.SKIP) + public _FinalStage scopeAccountId(Optional scopeAccountId) { + this.scopeAccountId = scopeAccountId; + return this; + } + + /** + *

Platform-wide (global) reports only: when true, return cumulative balances as of to_date (all history, no lower bound) instead of activity within the period.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cumulative(Boolean cumulative) { + this.cumulative = Optional.ofNullable(cumulative); + return this; + } + + /** + *

Platform-wide (global) reports only: when true, return cumulative balances as of to_date (all history, no lower bound) instead of activity within the period.

+ */ + @java.lang.Override + @JsonSetter(value = "cumulative", nulls = Nulls.SKIP) + public _FinalStage cumulative(Optional cumulative) { + this.cumulative = cumulative; + return this; + } + + /** + *

IANA timezone (for example America/New_York) used to bucket report periods and to interpret calendar-day boundaries for balance snapshots. Defaults to UTC. from_date/to_date remain exact instants regardless of this setting.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timezone(String timezone) { + this.timezone = Optional.ofNullable(timezone); + return this; + } + + /** + *

IANA timezone (for example America/New_York) used to bucket report periods and to interpret calendar-day boundaries for balance snapshots. Defaults to UTC. from_date/to_date remain exact instants regardless of this setting.

+ */ + @java.lang.Override + @JsonSetter(value = "timezone", nulls = Nulls.SKIP) + public _FinalStage timezone(Optional timezone) { + this.timezone = timezone; + return this; + } + + /** + *

Grouping granularity for report rows.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage groupBy(GetFinancialReportRequestGroupBy groupBy) { + this.groupBy = Optional.ofNullable(groupBy); + return this; + } + + /** + *

Grouping granularity for report rows.

+ */ + @java.lang.Override + @JsonSetter(value = "group_by", nulls = Nulls.SKIP) + public _FinalStage groupBy(Optional groupBy) { + this.groupBy = groupBy; + return this; + } + + /** + *

End of the report window as an ISO 8601 timestamp (UTC). Required for platform-wide (global) reports.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toDate(String toDate) { + this.toDate = Optional.ofNullable(toDate); + return this; + } + + /** + *

End of the report window as an ISO 8601 timestamp (UTC). Required for platform-wide (global) reports.

+ */ + @java.lang.Override + @JsonSetter(value = "to_date", nulls = Nulls.SKIP) + public _FinalStage toDate(Optional toDate) { + this.toDate = toDate; + return this; + } + + /** + *

Start of the report window as an ISO 8601 timestamp (UTC). Required for platform-wide (global) reports.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromDate(String fromDate) { + this.fromDate = Optional.ofNullable(fromDate); + return this; + } + + /** + *

Start of the report window as an ISO 8601 timestamp (UTC). Required for platform-wide (global) reports.

+ */ + @java.lang.Override + @JsonSetter(value = "from_date", nulls = Nulls.SKIP) + public _FinalStage fromDate(Optional fromDate) { + this.fromDate = fromDate; + return this; + } + + /** + *

Aggregate all activity into this display currency via FX conversion.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage inCurrency(String inCurrency) { + this.inCurrency = Optional.ofNullable(inCurrency); + return this; + } + + /** + *

Aggregate all activity into this display currency via FX conversion.

+ */ + @java.lang.Override + @JsonSetter(value = "in_currency", nulls = Nulls.SKIP) + public _FinalStage inCurrency(Optional inCurrency) { + this.inCurrency = inCurrency; + return this; + } + + /** + *

Filter rows to this currency, for example usd. Defaults to usd unless in_currency is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

Filter rows to this currency, for example usd. Defaults to usd unless in_currency is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + @java.lang.Override + public GetFinancialReportRequest build() { + return new GetFinancialReportRequest( + accountId, + reportType, + currency, + inCurrency, + fromDate, + toDate, + groupBy, + timezone, + cumulative, + scopeAccountId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportRequestGroupBy.java b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportRequestGroupBy.java new file mode 100644 index 00000000..358d4406 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportRequestGroupBy.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class GetFinancialReportRequestGroupBy { + public static final GetFinancialReportRequestGroupBy MONTH = + new GetFinancialReportRequestGroupBy(Value.MONTH, "month"); + + public static final GetFinancialReportRequestGroupBy DAY = new GetFinancialReportRequestGroupBy(Value.DAY, "day"); + + public static final GetFinancialReportRequestGroupBy WEEK = + new GetFinancialReportRequestGroupBy(Value.WEEK, "week"); + + private final Value value; + + private final String string; + + GetFinancialReportRequestGroupBy(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof GetFinancialReportRequestGroupBy + && this.string.equals(((GetFinancialReportRequestGroupBy) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MONTH: + return visitor.visitMonth(); + case DAY: + return visitor.visitDay(); + case WEEK: + return visitor.visitWeek(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static GetFinancialReportRequestGroupBy valueOf(String value) { + switch (value) { + case "month": + return MONTH; + case "day": + return DAY; + case "week": + return WEEK; + default: + return new GetFinancialReportRequestGroupBy(Value.UNKNOWN, value); + } + } + + public enum Value { + DAY, + + WEEK, + + MONTH, + + UNKNOWN + } + + public interface Visitor { + T visitDay(); + + T visitWeek(); + + T visitMonth(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportRequestReportType.java b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportRequestReportType.java new file mode 100644 index 00000000..dd55c3b5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportRequestReportType.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class GetFinancialReportRequestReportType { + public static final GetFinancialReportRequestReportType INCOME_STATEMENT = + new GetFinancialReportRequestReportType(Value.INCOME_STATEMENT, "income_statement"); + + public static final GetFinancialReportRequestReportType BALANCE_ACTIVITY = + new GetFinancialReportRequestReportType(Value.BALANCE_ACTIVITY, "balance_activity"); + + public static final GetFinancialReportRequestReportType BALANCE_SUMMARY = + new GetFinancialReportRequestReportType(Value.BALANCE_SUMMARY, "balance_summary"); + + private final Value value; + + private final String string; + + GetFinancialReportRequestReportType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof GetFinancialReportRequestReportType + && this.string.equals(((GetFinancialReportRequestReportType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INCOME_STATEMENT: + return visitor.visitIncomeStatement(); + case BALANCE_ACTIVITY: + return visitor.visitBalanceActivity(); + case BALANCE_SUMMARY: + return visitor.visitBalanceSummary(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static GetFinancialReportRequestReportType valueOf(String value) { + switch (value) { + case "income_statement": + return INCOME_STATEMENT; + case "balance_activity": + return BALANCE_ACTIVITY; + case "balance_summary": + return BALANCE_SUMMARY; + default: + return new GetFinancialReportRequestReportType(Value.UNKNOWN, value); + } + } + + public enum Value { + BALANCE_SUMMARY, + + INCOME_STATEMENT, + + BALANCE_ACTIVITY, + + UNKNOWN + } + + public interface Visitor { + T visitBalanceSummary(); + + T visitIncomeStatement(); + + T visitBalanceActivity(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponse.java b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponse.java new file mode 100644 index 00000000..c0890a21 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponse.java @@ -0,0 +1,354 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetFinancialReportResponse.Builder.class) +public final class GetFinancialReportResponse { + private final Optional beginningBalance; + + private final Optional endingBalance; + + private final Optional> fxExcludedCurrencies; + + private final GetFinancialReportResponseReportType reportType; + + private final List rows; + + private final double total; + + private final Map additionalProperties; + + private GetFinancialReportResponse( + Optional beginningBalance, + Optional endingBalance, + Optional> fxExcludedCurrencies, + GetFinancialReportResponseReportType reportType, + List rows, + double total, + Map additionalProperties) { + this.beginningBalance = beginningBalance; + this.endingBalance = endingBalance; + this.fxExcludedCurrencies = fxExcludedCurrencies; + this.reportType = reportType; + this.rows = rows; + this.total = total; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getBeginningBalance() { + if (beginningBalance == null) { + return Optional.empty(); + } + return beginningBalance; + } + + @JsonIgnore + public Optional getEndingBalance() { + if (endingBalance == null) { + return Optional.empty(); + } + return endingBalance; + } + + @JsonProperty("fx_excluded_currencies") + public Optional> getFxExcludedCurrencies() { + return fxExcludedCurrencies; + } + + /** + * @return The report that was generated, echoing the requested report_type. + */ + @JsonProperty("report_type") + public GetFinancialReportResponseReportType getReportType() { + return reportType; + } + + @JsonProperty("rows") + public List getRows() { + return rows; + } + + @JsonProperty("total") + public double getTotal() { + return total; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("beginning_balance") + private Optional _getBeginningBalance() { + return beginningBalance; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ending_balance") + private Optional _getEndingBalance() { + return endingBalance; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetFinancialReportResponse && equalTo((GetFinancialReportResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetFinancialReportResponse other) { + return beginningBalance.equals(other.beginningBalance) + && endingBalance.equals(other.endingBalance) + && fxExcludedCurrencies.equals(other.fxExcludedCurrencies) + && reportType.equals(other.reportType) + && rows.equals(other.rows) + && total == other.total; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.beginningBalance, + this.endingBalance, + this.fxExcludedCurrencies, + this.reportType, + this.rows, + this.total); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ReportTypeStage builder() { + return new Builder(); + } + + public interface ReportTypeStage { + /** + *

The report that was generated, echoing the requested report_type.

+ */ + TotalStage reportType(@NotNull GetFinancialReportResponseReportType reportType); + + Builder from(GetFinancialReportResponse other); + } + + public interface TotalStage { + _FinalStage total(double total); + } + + public interface _FinalStage { + GetFinancialReportResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage beginningBalance(Optional beginningBalance); + + _FinalStage beginningBalance(Double beginningBalance); + + _FinalStage beginningBalance(Nullable beginningBalance); + + _FinalStage endingBalance(Optional endingBalance); + + _FinalStage endingBalance(Double endingBalance); + + _FinalStage endingBalance(Nullable endingBalance); + + _FinalStage fxExcludedCurrencies(Optional> fxExcludedCurrencies); + + _FinalStage fxExcludedCurrencies(List fxExcludedCurrencies); + + _FinalStage rows(List rows); + + _FinalStage addRows(GetFinancialReportResponseRowsItem rows); + + _FinalStage addAllRows(List rows); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ReportTypeStage, TotalStage, _FinalStage { + private GetFinancialReportResponseReportType reportType; + + private double total; + + private List rows = new ArrayList<>(); + + private Optional> fxExcludedCurrencies = Optional.empty(); + + private Optional endingBalance = Optional.empty(); + + private Optional beginningBalance = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetFinancialReportResponse other) { + beginningBalance(other.getBeginningBalance()); + endingBalance(other.getEndingBalance()); + fxExcludedCurrencies(other.getFxExcludedCurrencies()); + reportType(other.getReportType()); + rows(other.getRows()); + total(other.getTotal()); + return this; + } + + /** + *

The report that was generated, echoing the requested report_type.

+ *

The report that was generated, echoing the requested report_type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("report_type") + public TotalStage reportType(@NotNull GetFinancialReportResponseReportType reportType) { + this.reportType = Objects.requireNonNull(reportType, "reportType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("total") + public _FinalStage total(double total) { + this.total = total; + return this; + } + + @java.lang.Override + public _FinalStage addAllRows(List rows) { + if (rows != null) { + this.rows.addAll(rows); + } + return this; + } + + @java.lang.Override + public _FinalStage addRows(GetFinancialReportResponseRowsItem rows) { + this.rows.add(rows); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rows", nulls = Nulls.SKIP) + public _FinalStage rows(List rows) { + this.rows.clear(); + if (rows != null) { + this.rows.addAll(rows); + } + return this; + } + + @java.lang.Override + public _FinalStage fxExcludedCurrencies(List fxExcludedCurrencies) { + this.fxExcludedCurrencies = Optional.ofNullable(fxExcludedCurrencies); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fx_excluded_currencies", nulls = Nulls.SKIP) + public _FinalStage fxExcludedCurrencies(Optional> fxExcludedCurrencies) { + this.fxExcludedCurrencies = fxExcludedCurrencies; + return this; + } + + @java.lang.Override + public _FinalStage endingBalance(Nullable endingBalance) { + if (endingBalance.isNull()) { + this.endingBalance = null; + } else if (endingBalance.isEmpty()) { + this.endingBalance = Optional.empty(); + } else { + this.endingBalance = Optional.of(endingBalance.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endingBalance(Double endingBalance) { + this.endingBalance = Optional.ofNullable(endingBalance); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ending_balance", nulls = Nulls.SKIP) + public _FinalStage endingBalance(Optional endingBalance) { + this.endingBalance = endingBalance; + return this; + } + + @java.lang.Override + public _FinalStage beginningBalance(Nullable beginningBalance) { + if (beginningBalance.isNull()) { + this.beginningBalance = null; + } else if (beginningBalance.isEmpty()) { + this.beginningBalance = Optional.empty(); + } else { + this.beginningBalance = Optional.of(beginningBalance.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage beginningBalance(Double beginningBalance) { + this.beginningBalance = Optional.ofNullable(beginningBalance); + return this; + } + + @java.lang.Override + @JsonSetter(value = "beginning_balance", nulls = Nulls.SKIP) + public _FinalStage beginningBalance(Optional beginningBalance) { + this.beginningBalance = beginningBalance; + return this; + } + + @java.lang.Override + public GetFinancialReportResponse build() { + return new GetFinancialReportResponse( + beginningBalance, + endingBalance, + fxExcludedCurrencies, + reportType, + rows, + total, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponseReportType.java b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponseReportType.java new file mode 100644 index 00000000..367386f3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponseReportType.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class GetFinancialReportResponseReportType { + public static final GetFinancialReportResponseReportType INCOME_STATEMENT = + new GetFinancialReportResponseReportType(Value.INCOME_STATEMENT, "income_statement"); + + public static final GetFinancialReportResponseReportType BALANCE_ACTIVITY = + new GetFinancialReportResponseReportType(Value.BALANCE_ACTIVITY, "balance_activity"); + + public static final GetFinancialReportResponseReportType BALANCE_SUMMARY = + new GetFinancialReportResponseReportType(Value.BALANCE_SUMMARY, "balance_summary"); + + private final Value value; + + private final String string; + + GetFinancialReportResponseReportType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof GetFinancialReportResponseReportType + && this.string.equals(((GetFinancialReportResponseReportType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INCOME_STATEMENT: + return visitor.visitIncomeStatement(); + case BALANCE_ACTIVITY: + return visitor.visitBalanceActivity(); + case BALANCE_SUMMARY: + return visitor.visitBalanceSummary(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static GetFinancialReportResponseReportType valueOf(String value) { + switch (value) { + case "income_statement": + return INCOME_STATEMENT; + case "balance_activity": + return BALANCE_ACTIVITY; + case "balance_summary": + return BALANCE_SUMMARY; + default: + return new GetFinancialReportResponseReportType(Value.UNKNOWN, value); + } + } + + public enum Value { + BALANCE_SUMMARY, + + INCOME_STATEMENT, + + BALANCE_ACTIVITY, + + UNKNOWN + } + + public interface Visitor { + T visitBalanceSummary(); + + T visitIncomeStatement(); + + T visitBalanceActivity(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponseRowsItem.java b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponseRowsItem.java new file mode 100644 index 00000000..09bedcd0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponseRowsItem.java @@ -0,0 +1,539 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetFinancialReportResponseRowsItem.Builder.class) +public final class GetFinancialReportResponseRowsItem { + private final Optional accountIkPath; + + private final Optional accountName; + + private final Optional accountType; + + private final double amount; + + private final GetFinancialReportResponseRowsItemGrouping grouping; + + private final GetFinancialReportResponseRowsItemLineCategory lineCategory; + + private final Optional lineCount; + + private final String period; + + private final Optional profitAndLossSection; + + private final Map additionalProperties; + + private GetFinancialReportResponseRowsItem( + Optional accountIkPath, + Optional accountName, + Optional accountType, + double amount, + GetFinancialReportResponseRowsItemGrouping grouping, + GetFinancialReportResponseRowsItemLineCategory lineCategory, + Optional lineCount, + String period, + Optional profitAndLossSection, + Map additionalProperties) { + this.accountIkPath = accountIkPath; + this.accountName = accountName; + this.accountType = accountType; + this.amount = amount; + this.grouping = grouping; + this.lineCategory = lineCategory; + this.lineCount = lineCount; + this.period = period; + this.profitAndLossSection = profitAndLossSection; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getAccountIkPath() { + if (accountIkPath == null) { + return Optional.empty(); + } + return accountIkPath; + } + + @JsonIgnore + public Optional getAccountName() { + if (accountName == null) { + return Optional.empty(); + } + return accountName; + } + + @JsonIgnore + public Optional getAccountType() { + if (accountType == null) { + return Optional.empty(); + } + return accountType; + } + + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The family the row's line_category rolls up into. Balance summary rows are always balance. + */ + @JsonProperty("grouping") + public GetFinancialReportResponseRowsItemGrouping getGrouping() { + return grouping; + } + + /** + * @return The ledger line category the row aggregates. Balance summary rows carry the balance bucket instead. + */ + @JsonProperty("line_category") + public GetFinancialReportResponseRowsItemLineCategory getLineCategory() { + return lineCategory; + } + + @JsonIgnore + public Optional getLineCount() { + if (lineCount == null) { + return Optional.empty(); + } + return lineCount; + } + + /** + * @return Start of the time bucket this row covers, truncated to group_by. + */ + @JsonProperty("period") + public String getPeriod() { + return period; + } + + /** + * @return Which side of the income statement the category falls on, or null when it is not a P&L category. + */ + @JsonIgnore + public Optional getProfitAndLossSection() { + if (profitAndLossSection == null) { + return Optional.empty(); + } + return profitAndLossSection; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_ik_path") + private Optional _getAccountIkPath() { + return accountIkPath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_name") + private Optional _getAccountName() { + return accountName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_type") + private Optional _getAccountType() { + return accountType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line_count") + private Optional _getLineCount() { + return lineCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("profit_and_loss_section") + private Optional _getProfitAndLossSection() { + return profitAndLossSection; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetFinancialReportResponseRowsItem + && equalTo((GetFinancialReportResponseRowsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetFinancialReportResponseRowsItem other) { + return accountIkPath.equals(other.accountIkPath) + && accountName.equals(other.accountName) + && accountType.equals(other.accountType) + && amount == other.amount + && grouping.equals(other.grouping) + && lineCategory.equals(other.lineCategory) + && lineCount.equals(other.lineCount) + && period.equals(other.period) + && profitAndLossSection.equals(other.profitAndLossSection); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountIkPath, + this.accountName, + this.accountType, + this.amount, + this.grouping, + this.lineCategory, + this.lineCount, + this.period, + this.profitAndLossSection); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + GroupingStage amount(double amount); + + Builder from(GetFinancialReportResponseRowsItem other); + } + + public interface GroupingStage { + /** + *

The family the row's line_category rolls up into. Balance summary rows are always balance.

+ */ + LineCategoryStage grouping(@NotNull GetFinancialReportResponseRowsItemGrouping grouping); + } + + public interface LineCategoryStage { + /** + *

The ledger line category the row aggregates. Balance summary rows carry the balance bucket instead.

+ */ + PeriodStage lineCategory(@NotNull GetFinancialReportResponseRowsItemLineCategory lineCategory); + } + + public interface PeriodStage { + /** + *

Start of the time bucket this row covers, truncated to group_by.

+ */ + _FinalStage period(@NotNull String period); + } + + public interface _FinalStage { + GetFinancialReportResponseRowsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage accountIkPath(Optional accountIkPath); + + _FinalStage accountIkPath(String accountIkPath); + + _FinalStage accountIkPath(Nullable accountIkPath); + + _FinalStage accountName(Optional accountName); + + _FinalStage accountName(String accountName); + + _FinalStage accountName(Nullable accountName); + + _FinalStage accountType(Optional accountType); + + _FinalStage accountType(String accountType); + + _FinalStage accountType(Nullable accountType); + + _FinalStage lineCount(Optional lineCount); + + _FinalStage lineCount(Integer lineCount); + + _FinalStage lineCount(Nullable lineCount); + + /** + *

Which side of the income statement the category falls on, or null when it is not a P&L category.

+ */ + _FinalStage profitAndLossSection( + Optional profitAndLossSection); + + _FinalStage profitAndLossSection(GetFinancialReportResponseRowsItemProfitAndLossSection profitAndLossSection); + + _FinalStage profitAndLossSection( + Nullable profitAndLossSection); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, GroupingStage, LineCategoryStage, PeriodStage, _FinalStage { + private double amount; + + private GetFinancialReportResponseRowsItemGrouping grouping; + + private GetFinancialReportResponseRowsItemLineCategory lineCategory; + + private String period; + + private Optional profitAndLossSection = + Optional.empty(); + + private Optional lineCount = Optional.empty(); + + private Optional accountType = Optional.empty(); + + private Optional accountName = Optional.empty(); + + private Optional accountIkPath = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetFinancialReportResponseRowsItem other) { + accountIkPath(other.getAccountIkPath()); + accountName(other.getAccountName()); + accountType(other.getAccountType()); + amount(other.getAmount()); + grouping(other.getGrouping()); + lineCategory(other.getLineCategory()); + lineCount(other.getLineCount()); + period(other.getPeriod()); + profitAndLossSection(other.getProfitAndLossSection()); + return this; + } + + @java.lang.Override + @JsonSetter("amount") + public GroupingStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The family the row's line_category rolls up into. Balance summary rows are always balance.

+ *

The family the row's line_category rolls up into. Balance summary rows are always balance.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("grouping") + public LineCategoryStage grouping(@NotNull GetFinancialReportResponseRowsItemGrouping grouping) { + this.grouping = Objects.requireNonNull(grouping, "grouping must not be null"); + return this; + } + + /** + *

The ledger line category the row aggregates. Balance summary rows carry the balance bucket instead.

+ *

The ledger line category the row aggregates. Balance summary rows carry the balance bucket instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("line_category") + public PeriodStage lineCategory(@NotNull GetFinancialReportResponseRowsItemLineCategory lineCategory) { + this.lineCategory = Objects.requireNonNull(lineCategory, "lineCategory must not be null"); + return this; + } + + /** + *

Start of the time bucket this row covers, truncated to group_by.

+ *

Start of the time bucket this row covers, truncated to group_by.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("period") + public _FinalStage period(@NotNull String period) { + this.period = Objects.requireNonNull(period, "period must not be null"); + return this; + } + + /** + *

Which side of the income statement the category falls on, or null when it is not a P&L category.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profitAndLossSection( + Nullable profitAndLossSection) { + if (profitAndLossSection.isNull()) { + this.profitAndLossSection = null; + } else if (profitAndLossSection.isEmpty()) { + this.profitAndLossSection = Optional.empty(); + } else { + this.profitAndLossSection = Optional.of(profitAndLossSection.get()); + } + return this; + } + + /** + *

Which side of the income statement the category falls on, or null when it is not a P&L category.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profitAndLossSection( + GetFinancialReportResponseRowsItemProfitAndLossSection profitAndLossSection) { + this.profitAndLossSection = Optional.ofNullable(profitAndLossSection); + return this; + } + + /** + *

Which side of the income statement the category falls on, or null when it is not a P&L category.

+ */ + @java.lang.Override + @JsonSetter(value = "profit_and_loss_section", nulls = Nulls.SKIP) + public _FinalStage profitAndLossSection( + Optional profitAndLossSection) { + this.profitAndLossSection = profitAndLossSection; + return this; + } + + @java.lang.Override + public _FinalStage lineCount(Nullable lineCount) { + if (lineCount.isNull()) { + this.lineCount = null; + } else if (lineCount.isEmpty()) { + this.lineCount = Optional.empty(); + } else { + this.lineCount = Optional.of(lineCount.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage lineCount(Integer lineCount) { + this.lineCount = Optional.ofNullable(lineCount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "line_count", nulls = Nulls.SKIP) + public _FinalStage lineCount(Optional lineCount) { + this.lineCount = lineCount; + return this; + } + + @java.lang.Override + public _FinalStage accountType(Nullable accountType) { + if (accountType.isNull()) { + this.accountType = null; + } else if (accountType.isEmpty()) { + this.accountType = Optional.empty(); + } else { + this.accountType = Optional.of(accountType.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage accountType(String accountType) { + this.accountType = Optional.ofNullable(accountType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "account_type", nulls = Nulls.SKIP) + public _FinalStage accountType(Optional accountType) { + this.accountType = accountType; + return this; + } + + @java.lang.Override + public _FinalStage accountName(Nullable accountName) { + if (accountName.isNull()) { + this.accountName = null; + } else if (accountName.isEmpty()) { + this.accountName = Optional.empty(); + } else { + this.accountName = Optional.of(accountName.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage accountName(String accountName) { + this.accountName = Optional.ofNullable(accountName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "account_name", nulls = Nulls.SKIP) + public _FinalStage accountName(Optional accountName) { + this.accountName = accountName; + return this; + } + + @java.lang.Override + public _FinalStage accountIkPath(Nullable accountIkPath) { + if (accountIkPath.isNull()) { + this.accountIkPath = null; + } else if (accountIkPath.isEmpty()) { + this.accountIkPath = Optional.empty(); + } else { + this.accountIkPath = Optional.of(accountIkPath.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage accountIkPath(String accountIkPath) { + this.accountIkPath = Optional.ofNullable(accountIkPath); + return this; + } + + @java.lang.Override + @JsonSetter(value = "account_ik_path", nulls = Nulls.SKIP) + public _FinalStage accountIkPath(Optional accountIkPath) { + this.accountIkPath = accountIkPath; + return this; + } + + @java.lang.Override + public GetFinancialReportResponseRowsItem build() { + return new GetFinancialReportResponseRowsItem( + accountIkPath, + accountName, + accountType, + amount, + grouping, + lineCategory, + lineCount, + period, + profitAndLossSection, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponseRowsItemGrouping.java b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponseRowsItemGrouping.java new file mode 100644 index 00000000..fb26b79d --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponseRowsItemGrouping.java @@ -0,0 +1,284 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class GetFinancialReportResponseRowsItemGrouping { + public static final GetFinancialReportResponseRowsItemGrouping CLAWBACKS = + new GetFinancialReportResponseRowsItemGrouping(Value.CLAWBACKS, "clawbacks"); + + public static final GetFinancialReportResponseRowsItemGrouping RESERVES = + new GetFinancialReportResponseRowsItemGrouping(Value.RESERVES, "reserves"); + + public static final GetFinancialReportResponseRowsItemGrouping CRYPTO = + new GetFinancialReportResponseRowsItemGrouping(Value.CRYPTO, "crypto"); + + public static final GetFinancialReportResponseRowsItemGrouping ADVERTISING = + new GetFinancialReportResponseRowsItemGrouping(Value.ADVERTISING, "advertising"); + + public static final GetFinancialReportResponseRowsItemGrouping WALLETS_AND_BALANCE = + new GetFinancialReportResponseRowsItemGrouping(Value.WALLETS_AND_BALANCE, "wallets_and_balance"); + + public static final GetFinancialReportResponseRowsItemGrouping WITHDRAWALS = + new GetFinancialReportResponseRowsItemGrouping(Value.WITHDRAWALS, "withdrawals"); + + public static final GetFinancialReportResponseRowsItemGrouping TRANSFERS = + new GetFinancialReportResponseRowsItemGrouping(Value.TRANSFERS, "transfers"); + + public static final GetFinancialReportResponseRowsItemGrouping CONNECTED_ACCOUNTS = + new GetFinancialReportResponseRowsItemGrouping(Value.CONNECTED_ACCOUNTS, "connected_accounts"); + + public static final GetFinancialReportResponseRowsItemGrouping REFUNDS = + new GetFinancialReportResponseRowsItemGrouping(Value.REFUNDS, "refunds"); + + public static final GetFinancialReportResponseRowsItemGrouping FEES = + new GetFinancialReportResponseRowsItemGrouping(Value.FEES, "fees"); + + public static final GetFinancialReportResponseRowsItemGrouping BALANCE = + new GetFinancialReportResponseRowsItemGrouping(Value.BALANCE, "balance"); + + public static final GetFinancialReportResponseRowsItemGrouping OTHER = + new GetFinancialReportResponseRowsItemGrouping(Value.OTHER, "other"); + + public static final GetFinancialReportResponseRowsItemGrouping DISPUTES = + new GetFinancialReportResponseRowsItemGrouping(Value.DISPUTES, "disputes"); + + public static final GetFinancialReportResponseRowsItemGrouping PAYMENTS = + new GetFinancialReportResponseRowsItemGrouping(Value.PAYMENTS, "payments"); + + public static final GetFinancialReportResponseRowsItemGrouping AFFILIATES_AND_REVSHARE = + new GetFinancialReportResponseRowsItemGrouping(Value.AFFILIATES_AND_REVSHARE, "affiliates_and_revshare"); + + public static final GetFinancialReportResponseRowsItemGrouping FX = + new GetFinancialReportResponseRowsItemGrouping(Value.FX, "fx"); + + public static final GetFinancialReportResponseRowsItemGrouping LEGACY = + new GetFinancialReportResponseRowsItemGrouping(Value.LEGACY, "legacy"); + + public static final GetFinancialReportResponseRowsItemGrouping MISC = + new GetFinancialReportResponseRowsItemGrouping(Value.MISC, "misc"); + + public static final GetFinancialReportResponseRowsItemGrouping AIRDROPS = + new GetFinancialReportResponseRowsItemGrouping(Value.AIRDROPS, "airdrops"); + + public static final GetFinancialReportResponseRowsItemGrouping BAD_DEBT = + new GetFinancialReportResponseRowsItemGrouping(Value.BAD_DEBT, "bad_debt"); + + private final Value value; + + private final String string; + + GetFinancialReportResponseRowsItemGrouping(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof GetFinancialReportResponseRowsItemGrouping + && this.string.equals(((GetFinancialReportResponseRowsItemGrouping) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CLAWBACKS: + return visitor.visitClawbacks(); + case RESERVES: + return visitor.visitReserves(); + case CRYPTO: + return visitor.visitCrypto(); + case ADVERTISING: + return visitor.visitAdvertising(); + case WALLETS_AND_BALANCE: + return visitor.visitWalletsAndBalance(); + case WITHDRAWALS: + return visitor.visitWithdrawals(); + case TRANSFERS: + return visitor.visitTransfers(); + case CONNECTED_ACCOUNTS: + return visitor.visitConnectedAccounts(); + case REFUNDS: + return visitor.visitRefunds(); + case FEES: + return visitor.visitFees(); + case BALANCE: + return visitor.visitBalance(); + case OTHER: + return visitor.visitOther(); + case DISPUTES: + return visitor.visitDisputes(); + case PAYMENTS: + return visitor.visitPayments(); + case AFFILIATES_AND_REVSHARE: + return visitor.visitAffiliatesAndRevshare(); + case FX: + return visitor.visitFx(); + case LEGACY: + return visitor.visitLegacy(); + case MISC: + return visitor.visitMisc(); + case AIRDROPS: + return visitor.visitAirdrops(); + case BAD_DEBT: + return visitor.visitBadDebt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static GetFinancialReportResponseRowsItemGrouping valueOf(String value) { + switch (value) { + case "clawbacks": + return CLAWBACKS; + case "reserves": + return RESERVES; + case "crypto": + return CRYPTO; + case "advertising": + return ADVERTISING; + case "wallets_and_balance": + return WALLETS_AND_BALANCE; + case "withdrawals": + return WITHDRAWALS; + case "transfers": + return TRANSFERS; + case "connected_accounts": + return CONNECTED_ACCOUNTS; + case "refunds": + return REFUNDS; + case "fees": + return FEES; + case "balance": + return BALANCE; + case "other": + return OTHER; + case "disputes": + return DISPUTES; + case "payments": + return PAYMENTS; + case "affiliates_and_revshare": + return AFFILIATES_AND_REVSHARE; + case "fx": + return FX; + case "legacy": + return LEGACY; + case "misc": + return MISC; + case "airdrops": + return AIRDROPS; + case "bad_debt": + return BAD_DEBT; + default: + return new GetFinancialReportResponseRowsItemGrouping(Value.UNKNOWN, value); + } + } + + public enum Value { + ADVERTISING, + + AFFILIATES_AND_REVSHARE, + + AIRDROPS, + + BAD_DEBT, + + BALANCE, + + CLAWBACKS, + + CONNECTED_ACCOUNTS, + + CRYPTO, + + DISPUTES, + + FEES, + + FX, + + LEGACY, + + MISC, + + OTHER, + + PAYMENTS, + + REFUNDS, + + RESERVES, + + TRANSFERS, + + WALLETS_AND_BALANCE, + + WITHDRAWALS, + + UNKNOWN + } + + public interface Visitor { + T visitAdvertising(); + + T visitAffiliatesAndRevshare(); + + T visitAirdrops(); + + T visitBadDebt(); + + T visitBalance(); + + T visitClawbacks(); + + T visitConnectedAccounts(); + + T visitCrypto(); + + T visitDisputes(); + + T visitFees(); + + T visitFx(); + + T visitLegacy(); + + T visitMisc(); + + T visitOther(); + + T visitPayments(); + + T visitRefunds(); + + T visitReserves(); + + T visitTransfers(); + + T visitWalletsAndBalance(); + + T visitWithdrawals(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponseRowsItemLineCategory.java b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponseRowsItemLineCategory.java new file mode 100644 index 00000000..c7b7af15 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponseRowsItemLineCategory.java @@ -0,0 +1,3239 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class GetFinancialReportResponseRowsItemLineCategory { + public static final GetFinancialReportResponseRowsItemLineCategory PSP_COMMISSION_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_COMMISSION_FEE, "psp_commission_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory STRIPE_INTERNATIONAL_PROCESSING_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.STRIPE_INTERNATIONAL_PROCESSING_FEE, "stripe_international_processing_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_DISPUTE_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_DISPUTE_REVERSAL, "payment_dispute_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory TREASURY_PAYIN = + new GetFinancialReportResponseRowsItemLineCategory(Value.TREASURY_PAYIN, "treasury_payin"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_AUTHENTICATION_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_AUTHENTICATION_FEE, "psp_authentication_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PLATFORM_COVERED_DISPUTE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PLATFORM_COVERED_DISPUTE, "platform_covered_dispute"); + + public static final GetFinancialReportResponseRowsItemLineCategory REFUND_SETTLEMENT = + new GetFinancialReportResponseRowsItemLineCategory(Value.REFUND_SETTLEMENT, "refund_settlement"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_CLAWBACK_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_CLAWBACK_FEE, "psp_clawback_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_REVSHARE_REFUND = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_REVSHARE_REFUND, "payment_revshare_refund"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL_MARKUP_FEE_PAYOUT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.WITHDRAWAL_MARKUP_FEE_PAYOUT, "withdrawal_markup_fee_payout"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_VARIABLE_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_VARIABLE_FEE, "psp_variable_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYOUT_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PAYOUT_FEE, "payout_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_UNRECONCILED_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_UNRECONCILED_REVERSAL, "payment_unreconciled_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_REFERRAL_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_REFERRAL_REVERSAL, "payment_referral_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory DISPUTE_SETTLEMENT_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.DISPUTE_SETTLEMENT_REVERSAL, "dispute_settlement_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory AD_BALANCE_FUNDING_RECEIPT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.AD_BALANCE_FUNDING_RECEIPT, "ad_balance_funding_receipt"); + + public static final GetFinancialReportResponseRowsItemLineCategory PLATFORM_BALANCE_TRANSFER_INCOMING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PLATFORM_BALANCE_TRANSFER_INCOMING, "platform_balance_transfer_incoming"); + + public static final GetFinancialReportResponseRowsItemLineCategory CARD_LOAD_TRANSFER = + new GetFinancialReportResponseRowsItemLineCategory(Value.CARD_LOAD_TRANSFER, "card_load_transfer"); + + public static final GetFinancialReportResponseRowsItemLineCategory INTERNAL_WITHDRAWAL_MARKUP_FEE_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.INTERNAL_WITHDRAWAL_MARKUP_FEE_REVERSAL, "internal_withdrawal_markup_fee_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory INTERNAL_WITHDRAWAL_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.INTERNAL_WITHDRAWAL_FEE, "internal_withdrawal_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_ADJUSTED_PROCESSING_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_ADJUSTED_PROCESSING_FEE, "psp_adjusted_processing_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory TAX_FILING_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.TAX_FILING_FEE, "tax_filing_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory FX_MARKUP = + new GetFinancialReportResponseRowsItemLineCategory(Value.FX_MARKUP, "fx_markup"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_PROCESSING_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_PROCESSING_FEE, "psp_processing_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory TOPUP_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory(Value.TOPUP_REVERSAL, "topup_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory DISPUTE_PAYABLE_CLEARING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.DISPUTE_PAYABLE_CLEARING, "dispute_payable_clearing"); + + public static final GetFinancialReportResponseRowsItemLineCategory RESERVE = + new GetFinancialReportResponseRowsItemLineCategory(Value.RESERVE, "reserve"); + + public static final GetFinancialReportResponseRowsItemLineCategory ONCHAIN_WITHDRAWAL_OFFSET = + new GetFinancialReportResponseRowsItemLineCategory( + Value.ONCHAIN_WITHDRAWAL_OFFSET, "onchain_withdrawal_offset"); + + public static final GetFinancialReportResponseRowsItemLineCategory PASSTHROUGH_GMV_OFFSET = + new GetFinancialReportResponseRowsItemLineCategory(Value.PASSTHROUGH_GMV_OFFSET, "passthrough_gmv_offset"); + + public static final GetFinancialReportResponseRowsItemLineCategory REFUND_PAYABLE_CLEARING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.REFUND_PAYABLE_CLEARING, "refund_payable_clearing"); + + public static final GetFinancialReportResponseRowsItemLineCategory AD_SPEND_MARGIN = + new GetFinancialReportResponseRowsItemLineCategory(Value.AD_SPEND_MARGIN, "ad_spend_margin"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYOUT_UNRECONCILED_CLEARING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYOUT_UNRECONCILED_CLEARING, "payout_unreconciled_clearing"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_REVSHARE_PAYOUT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_REVSHARE_PAYOUT, "payment_revshare_payout"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_BANK_PULL_CLEARING = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_BANK_PULL_CLEARING, "psp_bank_pull_clearing"); + + public static final GetFinancialReportResponseRowsItemLineCategory PLATFORM_EARNING_UNRECONCILED_CLEARING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PLATFORM_EARNING_UNRECONCILED_CLEARING, "platform_earning_unreconciled_clearing"); + + public static final GetFinancialReportResponseRowsItemLineCategory FRAUD_PREVENTION_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.FRAUD_PREVENTION_FEE, "fraud_prevention_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory AD_INCOME_RECEIPT = + new GetFinancialReportResponseRowsItemLineCategory(Value.AD_INCOME_RECEIPT, "ad_income_receipt"); + + public static final GetFinancialReportResponseRowsItemLineCategory INTERNAL_WITHDRAWAL_PAYABLE_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.INTERNAL_WITHDRAWAL_PAYABLE_REVERSAL, "internal_withdrawal_payable_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_PAYOUT_RECEIVABLE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_PAYOUT_RECEIVABLE, "psp_payout_receivable"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_PAYOUT_CONSOLIDATION = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_PAYOUT_CONSOLIDATION, "psp_payout_consolidation"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_POOL_SETTLEMENT = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_POOL_SETTLEMENT, "psp_pool_settlement"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_REFERRAL_REFUND = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_REFERRAL_REFUND, "payment_referral_refund"); + + public static final GetFinancialReportResponseRowsItemLineCategory MISC_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory(Value.MISC_REVERSAL, "misc_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory ACCOUNT_SETTLEMENT = + new GetFinancialReportResponseRowsItemLineCategory(Value.ACCOUNT_SETTLEMENT, "account_settlement"); + + public static final GetFinancialReportResponseRowsItemLineCategory AD_CAMPAIGN_BUDGET = + new GetFinancialReportResponseRowsItemLineCategory(Value.AD_CAMPAIGN_BUDGET, "ad_campaign_budget"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_RECEIVABLE_POOLED = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_RECEIVABLE_POOLED, "psp_receivable_pooled"); + + public static final GetFinancialReportResponseRowsItemLineCategory DISPUTE_HOLD = + new GetFinancialReportResponseRowsItemLineCategory(Value.DISPUTE_HOLD, "dispute_hold"); + + public static final GetFinancialReportResponseRowsItemLineCategory ONCHAIN_WITHDRAWAL = + new GetFinancialReportResponseRowsItemLineCategory(Value.ONCHAIN_WITHDRAWAL, "onchain_withdrawal"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_CORRECTION = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_CORRECTION, "psp_correction"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_CURRENCY_CONVERSION_RECEIVABLE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_CURRENCY_CONVERSION_RECEIVABLE, "psp_currency_conversion_receivable"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_SERVICE_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_SERVICE_FEE, "psp_service_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory CARD_SPEND_AUTHORIZATION_VOID = + new GetFinancialReportResponseRowsItemLineCategory( + Value.CARD_SPEND_AUTHORIZATION_VOID, "card_spend_authorization_void"); + + public static final GetFinancialReportResponseRowsItemLineCategory EXTERNAL_ACCOUNT_CONNECTION_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.EXTERNAL_ACCOUNT_CONNECTION_FEE, "external_account_connection_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory LEGACY_PAYMENT_REFUND = + new GetFinancialReportResponseRowsItemLineCategory(Value.LEGACY_PAYMENT_REFUND, "legacy_payment_refund"); + + public static final GetFinancialReportResponseRowsItemLineCategory INTERNAL_WITHDRAWAL = + new GetFinancialReportResponseRowsItemLineCategory(Value.INTERNAL_WITHDRAWAL, "internal_withdrawal"); + + public static final GetFinancialReportResponseRowsItemLineCategory CARD_UNLOAD_TRANSFER = + new GetFinancialReportResponseRowsItemLineCategory(Value.CARD_UNLOAD_TRANSFER, "card_unload_transfer"); + + public static final GetFinancialReportResponseRowsItemLineCategory REFERRAL_BONUS = + new GetFinancialReportResponseRowsItemLineCategory(Value.REFERRAL_BONUS, "referral_bonus"); + + public static final GetFinancialReportResponseRowsItemLineCategory CLAWBACK_RECEIVABLE = + new GetFinancialReportResponseRowsItemLineCategory(Value.CLAWBACK_RECEIVABLE, "clawback_receivable"); + + public static final GetFinancialReportResponseRowsItemLineCategory INTERNAL_BALANCE_TRANSFER_OUTGOING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.INTERNAL_BALANCE_TRANSFER_OUTGOING, "internal_balance_transfer_outgoing"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_GATEWAY_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_GATEWAY_FEE, "psp_gateway_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory BALANCE_RESERVATION_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.BALANCE_RESERVATION_REVERSAL, "balance_reservation_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory INTERNAL_WITHDRAWAL_PAYABLE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.INTERNAL_WITHDRAWAL_PAYABLE, "internal_withdrawal_payable"); + + public static final GetFinancialReportResponseRowsItemLineCategory CONNECTED_ACCOUNT_NEGATIVE_BALANCE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.CONNECTED_ACCOUNT_NEGATIVE_BALANCE, "connected_account_negative_balance"); + + public static final GetFinancialReportResponseRowsItemLineCategory RECIPIENT_WALLET_LOAD = + new GetFinancialReportResponseRowsItemLineCategory(Value.RECIPIENT_WALLET_LOAD, "recipient_wallet_load"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_CURRENCY_CONVERSION_OUTGOING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_CURRENCY_CONVERSION_OUTGOING, "psp_currency_conversion_outgoing"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL_TOPUP_ADJUSTMENT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.WITHDRAWAL_TOPUP_ADJUSTMENT, "withdrawal_topup_adjustment"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_INVOICING_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_INVOICING_FEE, "psp_invoicing_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_DISPUTE_ALERT_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_DISPUTE_ALERT_FEE, "psp_dispute_alert_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL_MARKUP_FEE_PAYOUT_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.WITHDRAWAL_MARKUP_FEE_PAYOUT_REVERSAL, "withdrawal_markup_fee_payout_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory CARD_SPEND_REFUND = + new GetFinancialReportResponseRowsItemLineCategory(Value.CARD_SPEND_REFUND, "card_spend_refund"); + + public static final GetFinancialReportResponseRowsItemLineCategory CARD_SPEND_CAPTURE = + new GetFinancialReportResponseRowsItemLineCategory(Value.CARD_SPEND_CAPTURE, "card_spend_capture"); + + public static final GetFinancialReportResponseRowsItemLineCategory CLAWBACK_RECEIVABLE_SETTLEMENT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.CLAWBACK_RECEIVABLE_SETTLEMENT, "clawback_receivable_settlement"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_EXTERNAL_ACCOUNT_CONNECTION_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_EXTERNAL_ACCOUNT_CONNECTION_FEE, "psp_external_account_connection_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_REVSHARE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PAYMENT_REVSHARE, "payment_revshare"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_WITHHOLDING_TAX = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_WITHHOLDING_TAX, "psp_withholding_tax"); + + public static final GetFinancialReportResponseRowsItemLineCategory INTERNAL_WITHDRAWAL_MARKUP_FEE_PAYOUT_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.INTERNAL_WITHDRAWAL_MARKUP_FEE_PAYOUT_REVERSAL, + "internal_withdrawal_markup_fee_payout_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory REFUND_PAYABLE_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.REFUND_PAYABLE_REVERSAL, "refund_payable_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory BILLING_PERCENTAGE_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.BILLING_PERCENTAGE_FEE, "billing_percentage_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_DISPUTE_ADJUSTMENT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_DISPUTE_ADJUSTMENT, "payment_dispute_adjustment"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_CLAWBACK_SETTLEMENT_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_CLAWBACK_SETTLEMENT_REVERSAL, "psp_clawback_settlement_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory DISPUTE_ALERT_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.DISPUTE_ALERT_FEE, "dispute_alert_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_TREASURY_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_TREASURY_FEE, "psp_treasury_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory APPLICATION_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.APPLICATION_FEE, "application_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PLATFORM_EARNING_SETTLEMENT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PLATFORM_EARNING_SETTLEMENT, "platform_earning_settlement"); + + public static final GetFinancialReportResponseRowsItemLineCategory CARD_SPEND_AUTHORIZATION_HOLD = + new GetFinancialReportResponseRowsItemLineCategory( + Value.CARD_SPEND_AUTHORIZATION_HOLD, "card_spend_authorization_hold"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_UNRECONCILED_CLEARING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_UNRECONCILED_CLEARING, "payment_unreconciled_clearing"); + + public static final GetFinancialReportResponseRowsItemLineCategory ONCHAIN_WALLET_TRANSFER_OUTGOING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.ONCHAIN_WALLET_TRANSFER_OUTGOING, "onchain_wallet_transfer_outgoing"); + + public static final GetFinancialReportResponseRowsItemLineCategory LICENSE_SALE = + new GetFinancialReportResponseRowsItemLineCategory(Value.LICENSE_SALE, "license_sale"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_FIXED_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_FIXED_FEE, "psp_fixed_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory APPLICATION_FEE_PAYOUT = + new GetFinancialReportResponseRowsItemLineCategory(Value.APPLICATION_FEE_PAYOUT, "application_fee_payout"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_DISPUTE_MANAGEMENT_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_DISPUTE_MANAGEMENT_FEE, "psp_dispute_management_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory CLAWBACK_RECEIVABLE_SETTLEMENT_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.CLAWBACK_RECEIVABLE_SETTLEMENT_REVERSAL, "clawback_receivable_settlement_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory AD_SPEND_CHARGE = + new GetFinancialReportResponseRowsItemLineCategory(Value.AD_SPEND_CHARGE, "ad_spend_charge"); + + public static final GetFinancialReportResponseRowsItemLineCategory REFUND_UNRECONCILED_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.REFUND_UNRECONCILED_REVERSAL, "refund_unreconciled_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory PROMO_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory(Value.PROMO_REVERSAL, "promo_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_REFUND_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PAYMENT_REFUND_FEE, "payment_refund_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory SWAP_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.SWAP_FEE, "swap_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory AIRDROP = + new GetFinancialReportResponseRowsItemLineCategory(Value.AIRDROP, "airdrop"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_RECEIVABLE_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_RECEIVABLE_REVERSAL, "payment_receivable_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory LICENSE_SALE_REVENUE = + new GetFinancialReportResponseRowsItemLineCategory(Value.LICENSE_SALE_REVENUE, "license_sale_revenue"); + + public static final GetFinancialReportResponseRowsItemLineCategory TOPUP = + new GetFinancialReportResponseRowsItemLineCategory(Value.TOPUP, "topup"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_REFERRAL_PAYABLE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_REFERRAL_PAYABLE, "payment_referral_payable"); + + public static final GetFinancialReportResponseRowsItemLineCategory HIGH_RISK_MERCHANT_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.HIGH_RISK_MERCHANT_FEE, "high_risk_merchant_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_PAYOUT_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_PAYOUT_FEE, "psp_payout_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory INTERNAL_WITHDRAWAL_MARKUP_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.INTERNAL_WITHDRAWAL_MARKUP_FEE, "internal_withdrawal_markup_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory AD_INCOME_EXPENSE = + new GetFinancialReportResponseRowsItemLineCategory(Value.AD_INCOME_EXPENSE, "ad_income_expense"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_RISK_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_RISK_FEE, "psp_risk_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory BALANCE_RESERVATION_RELEASE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.BALANCE_RESERVATION_RELEASE, "balance_reservation_release"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL_RECLASSIFICATION = + new GetFinancialReportResponseRowsItemLineCategory( + Value.WITHDRAWAL_RECLASSIFICATION, "withdrawal_reclassification"); + + public static final GetFinancialReportResponseRowsItemLineCategory STRIPE_DOMESTIC_PROCESSING_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.STRIPE_DOMESTIC_PROCESSING_FEE, "stripe_domestic_processing_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory ONCHAIN_DEPOSIT_OFFSET = + new GetFinancialReportResponseRowsItemLineCategory(Value.ONCHAIN_DEPOSIT_OFFSET, "onchain_deposit_offset"); + + public static final GetFinancialReportResponseRowsItemLineCategory CONNECTED_ACCOUNT_CLAWBACK = + new GetFinancialReportResponseRowsItemLineCategory( + Value.CONNECTED_ACCOUNT_CLAWBACK, "connected_account_clawback"); + + public static final GetFinancialReportResponseRowsItemLineCategory ONCHAIN_SWAP_OFFSET = + new GetFinancialReportResponseRowsItemLineCategory(Value.ONCHAIN_SWAP_OFFSET, "onchain_swap_offset"); + + public static final GetFinancialReportResponseRowsItemLineCategory SOFTWARE_RENTAL_TRANSACTION = + new GetFinancialReportResponseRowsItemLineCategory( + Value.SOFTWARE_RENTAL_TRANSACTION, "software_rental_transaction"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL_FEE_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.WITHDRAWAL_FEE_REVERSAL, "withdrawal_fee_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_PAYOUT_SETTLEMENT_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_PAYOUT_SETTLEMENT_REVERSAL, "psp_payout_settlement_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYOUT_RECEIVABLE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PAYOUT_RECEIVABLE, "payout_receivable"); + + public static final GetFinancialReportResponseRowsItemLineCategory PENDING = + new GetFinancialReportResponseRowsItemLineCategory(Value.PENDING, "pending"); + + public static final GetFinancialReportResponseRowsItemLineCategory PASSTHROUGH_GMV = + new GetFinancialReportResponseRowsItemLineCategory(Value.PASSTHROUGH_GMV, "passthrough_gmv"); + + public static final GetFinancialReportResponseRowsItemLineCategory SALES_TAX_COLLECTED_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.SALES_TAX_COLLECTED_REVERSAL, "sales_tax_collected_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_PAYOUT_RECEIVABLE_CLEARING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_PAYOUT_RECEIVABLE_CLEARING, "psp_payout_receivable_clearing"); + + public static final GetFinancialReportResponseRowsItemLineCategory AD_NETWORK_SETTLEMENT = + new GetFinancialReportResponseRowsItemLineCategory(Value.AD_NETWORK_SETTLEMENT, "ad_network_settlement"); + + public static final GetFinancialReportResponseRowsItemLineCategory AIRDROP_LINK_CANCELED = + new GetFinancialReportResponseRowsItemLineCategory(Value.AIRDROP_LINK_CANCELED, "airdrop_link_canceled"); + + public static final GetFinancialReportResponseRowsItemLineCategory CARD_INTERCHANGE = + new GetFinancialReportResponseRowsItemLineCategory(Value.CARD_INTERCHANGE, "card_interchange"); + + public static final GetFinancialReportResponseRowsItemLineCategory AVAILABLE = + new GetFinancialReportResponseRowsItemLineCategory(Value.AVAILABLE, "available"); + + public static final GetFinancialReportResponseRowsItemLineCategory LICENSE_SALE_COMMISSION = + new GetFinancialReportResponseRowsItemLineCategory( + Value.LICENSE_SALE_COMMISSION, "license_sale_commission"); + + public static final GetFinancialReportResponseRowsItemLineCategory INTERNAL_WITHDRAWAL_IN_TRANSIT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.INTERNAL_WITHDRAWAL_IN_TRANSIT, "internal_withdrawal_in_transit"); + + public static final GetFinancialReportResponseRowsItemLineCategory SALES_TAX_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.SALES_TAX_FEE, "sales_tax_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_SCHEME_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_SCHEME_FEE, "psp_scheme_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory REFUND_UNRECONCILED_CLEARING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.REFUND_UNRECONCILED_CLEARING, "refund_unreconciled_clearing"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_ACCOUNT_UPDATER_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_ACCOUNT_UPDATER_FEE, "psp_account_updater_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory TOPUP_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.TOPUP_FEE, "topup_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_RECEIVABLE_SETTLEMENT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_RECEIVABLE_SETTLEMENT, "payment_receivable_settlement"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_BANK_PULL_SETTLEMENT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_BANK_PULL_SETTLEMENT, "psp_bank_pull_settlement"); + + public static final GetFinancialReportResponseRowsItemLineCategory FX_PERCENTAGE_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.FX_PERCENTAGE_FEE, "fx_percentage_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_RECEIVABLE_CLEARING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_RECEIVABLE_CLEARING, "payment_receivable_clearing"); + + public static final GetFinancialReportResponseRowsItemLineCategory DISPUTE_SETTLEMENT = + new GetFinancialReportResponseRowsItemLineCategory(Value.DISPUTE_SETTLEMENT, "dispute_settlement"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_CONNECT_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_CONNECT_FEE, "psp_connect_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_INTERCHANGE_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_INTERCHANGE_FEE, "psp_interchange_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PLATFORM_AFFILIATE_PAYMENT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PLATFORM_AFFILIATE_PAYMENT, "platform_affiliate_payment"); + + public static final GetFinancialReportResponseRowsItemLineCategory INTERNAL_WITHDRAWAL_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.INTERNAL_WITHDRAWAL_REVERSAL, "internal_withdrawal_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory CARD_SPEND_AUTHORIZATION_VOID_RELEASE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.CARD_SPEND_AUTHORIZATION_VOID_RELEASE, "card_spend_authorization_void_release"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL_PAYABLE_CLEARING_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.WITHDRAWAL_PAYABLE_CLEARING_REVERSAL, "withdrawal_payable_clearing_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_INVOICE_TAX_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_INVOICE_TAX_FEE, "psp_invoice_tax_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory DISPUTE_REPRESENTMENT_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.DISPUTE_REPRESENTMENT_FEE, "dispute_representment_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PLATFORM_BALANCE_PAYMENT_REFUND = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PLATFORM_BALANCE_PAYMENT_REFUND, "platform_balance_payment_refund"); + + public static final GetFinancialReportResponseRowsItemLineCategory RESOLUTION_CENTER_REFUND = + new GetFinancialReportResponseRowsItemLineCategory( + Value.RESOLUTION_CENTER_REFUND, "resolution_center_refund"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_RESERVE_HOLD = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_RESERVE_HOLD, "psp_reserve_hold"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_POOL_DISPUTE_SETTLEMENT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_POOL_DISPUTE_SETTLEMENT, "psp_pool_dispute_settlement"); + + public static final GetFinancialReportResponseRowsItemLineCategory THREE_DS_FIXED_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.THREE_DS_FIXED_FEE, "three_ds_fixed_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory AIRDROP_LINK_RETURNED = + new GetFinancialReportResponseRowsItemLineCategory(Value.AIRDROP_LINK_RETURNED, "airdrop_link_returned"); + + public static final GetFinancialReportResponseRowsItemLineCategory REFUND_SETTLEMENT_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.REFUND_SETTLEMENT_REVERSAL, "refund_settlement_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL_MARKUP_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.WITHDRAWAL_MARKUP_FEE, "withdrawal_markup_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory INSTALLMENT_DEFAULT = + new GetFinancialReportResponseRowsItemLineCategory(Value.INSTALLMENT_DEFAULT, "installment_default"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_TERMINAL_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_TERMINAL_FEE, "psp_terminal_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PLATFORM_BALANCE_PAYMENT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PLATFORM_BALANCE_PAYMENT, "platform_balance_payment"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_REFUND_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_REFUND_FEE, "psp_refund_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory AD_PUBLISHER_PAYOUT_RECEIVED = + new GetFinancialReportResponseRowsItemLineCategory( + Value.AD_PUBLISHER_PAYOUT_RECEIVED, "ad_publisher_payout_received"); + + public static final GetFinancialReportResponseRowsItemLineCategory LEGACY_CRYPTO_PAYMENT = + new GetFinancialReportResponseRowsItemLineCategory(Value.LEGACY_CRYPTO_PAYMENT, "legacy_crypto_payment"); + + public static final GetFinancialReportResponseRowsItemLineCategory CLAWBACK_RECEIVABLE_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.CLAWBACK_RECEIVABLE_REVERSAL, "clawback_receivable_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_REFUND_PAYABLE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_REFUND_PAYABLE, "psp_refund_payable"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_REFERRAL = + new GetFinancialReportResponseRowsItemLineCategory(Value.PAYMENT_REFERRAL, "payment_referral"); + + public static final GetFinancialReportResponseRowsItemLineCategory WHOP_SWAP_FEE_RECEIVED = + new GetFinancialReportResponseRowsItemLineCategory(Value.WHOP_SWAP_FEE_RECEIVED, "whop_swap_fee_received"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_MARKUP_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_MARKUP_FEE, "psp_markup_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL_CLAWBACK_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.WITHDRAWAL_CLAWBACK_REVERSAL, "withdrawal_clawback_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory CARD_SPEND_AUTHORIZATION = + new GetFinancialReportResponseRowsItemLineCategory( + Value.CARD_SPEND_AUTHORIZATION, "card_spend_authorization"); + + public static final GetFinancialReportResponseRowsItemLineCategory INTERNAL_WITHDRAWAL_MARKUP_FEE_PAYOUT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.INTERNAL_WITHDRAWAL_MARKUP_FEE_PAYOUT, "internal_withdrawal_markup_fee_payout"); + + public static final GetFinancialReportResponseRowsItemLineCategory EXTERNAL_CARD_LOAD_DEPOSIT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.EXTERNAL_CARD_LOAD_DEPOSIT, "external_card_load_deposit"); + + public static final GetFinancialReportResponseRowsItemLineCategory SALES_TAX_REMITTED = + new GetFinancialReportResponseRowsItemLineCategory(Value.SALES_TAX_REMITTED, "sales_tax_remitted"); + + public static final GetFinancialReportResponseRowsItemLineCategory CLAWBACK_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.CLAWBACK_FEE, "clawback_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_REFUND_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_REFUND_REVERSAL, "payment_refund_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL_PAYABLE_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.WITHDRAWAL_PAYABLE_REVERSAL, "withdrawal_payable_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory AIRDROP_EXPENSE = + new GetFinancialReportResponseRowsItemLineCategory(Value.AIRDROP_EXPENSE, "airdrop_expense"); + + public static final GetFinancialReportResponseRowsItemLineCategory AD_NETWORK_COST = + new GetFinancialReportResponseRowsItemLineCategory(Value.AD_NETWORK_COST, "ad_network_cost"); + + public static final GetFinancialReportResponseRowsItemLineCategory FX_SETTLEMENT_GAIN_LOSS = + new GetFinancialReportResponseRowsItemLineCategory( + Value.FX_SETTLEMENT_GAIN_LOSS, "fx_settlement_gain_loss"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_TAX_SERVICE_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_TAX_SERVICE_FEE, "psp_tax_service_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PLATFORM_BALANCE_TRANSFER_OUTGOING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PLATFORM_BALANCE_TRANSFER_OUTGOING, "platform_balance_transfer_outgoing"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_CURRENCY_CONVERSION_INCOMING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_CURRENCY_CONVERSION_INCOMING, "psp_currency_conversion_incoming"); + + public static final GetFinancialReportResponseRowsItemLineCategory AIRDROP_LINK_REDEEMED = + new GetFinancialReportResponseRowsItemLineCategory(Value.AIRDROP_LINK_REDEEMED, "airdrop_link_redeemed"); + + public static final GetFinancialReportResponseRowsItemLineCategory ONCHAIN_SWAP_TARGET = + new GetFinancialReportResponseRowsItemLineCategory(Value.ONCHAIN_SWAP_TARGET, "onchain_swap_target"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_CURRENCY_CONVERSION_RECEIVABLE_CLEARING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_CURRENCY_CONVERSION_RECEIVABLE_CLEARING, "psp_currency_conversion_receivable_clearing"); + + public static final GetFinancialReportResponseRowsItemLineCategory EXTERNAL_CARD_LOAD_OFFSET = + new GetFinancialReportResponseRowsItemLineCategory( + Value.EXTERNAL_CARD_LOAD_OFFSET, "external_card_load_offset"); + + public static final GetFinancialReportResponseRowsItemLineCategory AFFILIATE_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.AFFILIATE_FEE, "affiliate_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory ONCHAIN_SWAP_SOURCE = + new GetFinancialReportResponseRowsItemLineCategory(Value.ONCHAIN_SWAP_SOURCE, "onchain_swap_source"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_GROSS_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory(Value.PAYMENT_GROSS_REVERSAL, "payment_gross_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_PAYMENT_RECEIVABLE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_PAYMENT_RECEIVABLE, "psp_payment_receivable"); + + public static final GetFinancialReportResponseRowsItemLineCategory TREASURY_PAYIN_RECEIVABLE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.TREASURY_PAYIN_RECEIVABLE, "treasury_payin_receivable"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_IDENTITY_VERIFICATION_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_IDENTITY_VERIFICATION_FEE, "psp_identity_verification_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL_MARKUP_FEE_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.WITHDRAWAL_MARKUP_FEE_REVERSAL, "withdrawal_markup_fee_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory AD_FUNDING_DISBURSEMENT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.AD_FUNDING_DISBURSEMENT, "ad_funding_disbursement"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL_CLAWBACK = + new GetFinancialReportResponseRowsItemLineCategory(Value.WITHDRAWAL_CLAWBACK, "withdrawal_clawback"); + + public static final GetFinancialReportResponseRowsItemLineCategory PLATFORM_EARNING = + new GetFinancialReportResponseRowsItemLineCategory(Value.PLATFORM_EARNING, "platform_earning"); + + public static final GetFinancialReportResponseRowsItemLineCategory REVSHARE_PERCENTAGE_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.REVSHARE_PERCENTAGE_FEE, "revshare_percentage_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory AIRDROP_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory(Value.AIRDROP_REVERSAL, "airdrop_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_REFUND = + new GetFinancialReportResponseRowsItemLineCategory(Value.PAYMENT_REFUND, "payment_refund"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.WITHDRAWAL_FEE, "withdrawal_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory BAD_DEBT_OFFSET = + new GetFinancialReportResponseRowsItemLineCategory(Value.BAD_DEBT_OFFSET, "bad_debt_offset"); + + public static final GetFinancialReportResponseRowsItemLineCategory AIRDROP_LINK_CLAIMED = + new GetFinancialReportResponseRowsItemLineCategory(Value.AIRDROP_LINK_CLAIMED, "airdrop_link_claimed"); + + public static final GetFinancialReportResponseRowsItemLineCategory BALANCE_RESERVATION_HOLD = + new GetFinancialReportResponseRowsItemLineCategory( + Value.BALANCE_RESERVATION_HOLD, "balance_reservation_hold"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_DISPUTE_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_DISPUTE_FEE, "psp_dispute_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory AIRDROP_LINK_CREATED = + new GetFinancialReportResponseRowsItemLineCategory(Value.AIRDROP_LINK_CREATED, "airdrop_link_created"); + + public static final GetFinancialReportResponseRowsItemLineCategory CARD_UNLOAD_DEPOSIT = + new GetFinancialReportResponseRowsItemLineCategory(Value.CARD_UNLOAD_DEPOSIT, "card_unload_deposit"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_TRANSFER_SETTLEMENT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_TRANSFER_SETTLEMENT, "psp_transfer_settlement"); + + public static final GetFinancialReportResponseRowsItemLineCategory COMPANY_REFERRAL = + new GetFinancialReportResponseRowsItemLineCategory(Value.COMPANY_REFERRAL, "company_referral"); + + public static final GetFinancialReportResponseRowsItemLineCategory ORCHESTRATION_PERCENTAGE_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.ORCHESTRATION_PERCENTAGE_FEE, "orchestration_percentage_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory CARD_INTERCHANGE_RECEIVABLE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.CARD_INTERCHANGE_RECEIVABLE, "card_interchange_receivable"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_REVSHARE_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_REVSHARE_REVERSAL, "payment_revshare_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory CARD_LOAD_DEPOSIT = + new GetFinancialReportResponseRowsItemLineCategory(Value.CARD_LOAD_DEPOSIT, "card_load_deposit"); + + public static final GetFinancialReportResponseRowsItemLineCategory MISC_REFUND = + new GetFinancialReportResponseRowsItemLineCategory(Value.MISC_REFUND, "misc_refund"); + + public static final GetFinancialReportResponseRowsItemLineCategory DISPUTE_PAYABLE_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.DISPUTE_PAYABLE_REVERSAL, "dispute_payable_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory TREASURY_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.TREASURY_FEE, "treasury_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory ONCHAIN_WALLET_TRANSFER_INCOMING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.ONCHAIN_WALLET_TRANSFER_INCOMING, "onchain_wallet_transfer_incoming"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_TAX_FILING_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_TAX_FILING_FEE, "psp_tax_filing_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory BAD_DEBT_EXPENSE = + new GetFinancialReportResponseRowsItemLineCategory(Value.BAD_DEBT_EXPENSE, "bad_debt_expense"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_DISPUTE_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PAYMENT_DISPUTE_FEE, "payment_dispute_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory AIRDROP_EXPENSE_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.AIRDROP_EXPENSE_REVERSAL, "airdrop_expense_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory AD_PUBLISHER_PAYOUT = + new GetFinancialReportResponseRowsItemLineCategory(Value.AD_PUBLISHER_PAYOUT, "ad_publisher_payout"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_DISPUTE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PAYMENT_DISPUTE, "payment_dispute"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_PROCESSING_PERCENTAGE_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_PROCESSING_PERCENTAGE_FEE, "payment_processing_percentage_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory CARD_SPEND_CAPTURE_OFFSET = + new GetFinancialReportResponseRowsItemLineCategory( + Value.CARD_SPEND_CAPTURE_OFFSET, "card_spend_capture_offset"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_PAYOUT_DEPOSIT = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_PAYOUT_DEPOSIT, "psp_payout_deposit"); + + public static final GetFinancialReportResponseRowsItemLineCategory DISPUTE_MANAGEMENT_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.DISPUTE_MANAGEMENT_FEE, "dispute_management_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL = + new GetFinancialReportResponseRowsItemLineCategory(Value.WITHDRAWAL, "withdrawal"); + + public static final GetFinancialReportResponseRowsItemLineCategory SETTLEMENT_ROUNDING_VARIANCE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.SETTLEMENT_ROUNDING_VARIANCE, "settlement_rounding_variance"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_NETWORK_TOKEN_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_NETWORK_TOKEN_FEE, "psp_network_token_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory BALANCE_RESERVATION = + new GetFinancialReportResponseRowsItemLineCategory(Value.BALANCE_RESERVATION, "balance_reservation"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL_PAYABLE = + new GetFinancialReportResponseRowsItemLineCategory(Value.WITHDRAWAL_PAYABLE, "withdrawal_payable"); + + public static final GetFinancialReportResponseRowsItemLineCategory LEGACY_PAYMENT = + new GetFinancialReportResponseRowsItemLineCategory(Value.LEGACY_PAYMENT, "legacy_payment"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_RECIPIENT_WALLET_LOAD = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_RECIPIENT_WALLET_LOAD, "psp_recipient_wallet_load"); + + public static final GetFinancialReportResponseRowsItemLineCategory AD_BUDGET_RELEASE = + new GetFinancialReportResponseRowsItemLineCategory(Value.AD_BUDGET_RELEASE, "ad_budget_release"); + + public static final GetFinancialReportResponseRowsItemLineCategory CRYPTO = + new GetFinancialReportResponseRowsItemLineCategory(Value.CRYPTO, "crypto"); + + public static final GetFinancialReportResponseRowsItemLineCategory DISPUTE_UNRECONCILED_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.DISPUTE_UNRECONCILED_REVERSAL, "dispute_unreconciled_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory PLATFORM_AFFILIATE_PAYMENT_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PLATFORM_AFFILIATE_PAYMENT_REVERSAL, "platform_affiliate_payment_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory FX_GAIN_LOSS = + new GetFinancialReportResponseRowsItemLineCategory(Value.FX_GAIN_LOSS, "fx_gain_loss"); + + public static final GetFinancialReportResponseRowsItemLineCategory INTERNAL_WITHDRAWAL_FEE_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.INTERNAL_WITHDRAWAL_FEE_REVERSAL, "internal_withdrawal_fee_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_COLLECTION_SETTLEMENT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_COLLECTION_SETTLEMENT, "psp_collection_settlement"); + + public static final GetFinancialReportResponseRowsItemLineCategory IDENTITY_VERIFICATION_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.IDENTITY_VERIFICATION_FEE, "identity_verification_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory INTERNAL_BALANCE_TRANSFER_INCOMING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.INTERNAL_BALANCE_TRANSFER_INCOMING, "internal_balance_transfer_incoming"); + + public static final GetFinancialReportResponseRowsItemLineCategory ONCHAIN_DEPOSIT = + new GetFinancialReportResponseRowsItemLineCategory(Value.ONCHAIN_DEPOSIT, "onchain_deposit"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_PAYIN_CLEARING = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_PAYIN_CLEARING, "psp_payin_clearing"); + + public static final GetFinancialReportResponseRowsItemLineCategory MARKETPLACE_AFFILIATE_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.MARKETPLACE_AFFILIATE_FEE, "marketplace_affiliate_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory CARD_SPEND_REFUND_OFFSET = + new GetFinancialReportResponseRowsItemLineCategory( + Value.CARD_SPEND_REFUND_OFFSET, "card_spend_refund_offset"); + + public static final GetFinancialReportResponseRowsItemLineCategory MISC_PURCHASE = + new GetFinancialReportResponseRowsItemLineCategory(Value.MISC_PURCHASE, "misc_purchase"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_PAYMENT_METHOD_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_PAYMENT_METHOD_FEE, "psp_payment_method_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory APPLICATION_FEE_PAYABLE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.APPLICATION_FEE_PAYABLE, "application_fee_payable"); + + public static final GetFinancialReportResponseRowsItemLineCategory CURRENCY_CONVERSION_INCOMING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.CURRENCY_CONVERSION_INCOMING, "currency_conversion_incoming"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_PAYOUT_SETTLEMENT = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_PAYOUT_SETTLEMENT, "psp_payout_settlement"); + + public static final GetFinancialReportResponseRowsItemLineCategory DISPUTE_HOLD_BLOCKED = + new GetFinancialReportResponseRowsItemLineCategory(Value.DISPUTE_HOLD_BLOCKED, "dispute_hold_blocked"); + + public static final GetFinancialReportResponseRowsItemLineCategory DISPUTE_HOLD_ADJUSTMENT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.DISPUTE_HOLD_ADJUSTMENT, "dispute_hold_adjustment"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_GROSS = + new GetFinancialReportResponseRowsItemLineCategory(Value.PAYMENT_GROSS, "payment_gross"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_TRANSFER_SETTLEMENT_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_TRANSFER_SETTLEMENT_REVERSAL, "psp_transfer_settlement_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory AGGREGATED_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.AGGREGATED_FEE, "aggregated_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_RESERVE_RELEASE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_RESERVE_RELEASE, "psp_reserve_release"); + + public static final GetFinancialReportResponseRowsItemLineCategory ADS_CARD_SPREAD = + new GetFinancialReportResponseRowsItemLineCategory(Value.ADS_CARD_SPREAD, "ads_card_spread"); + + public static final GetFinancialReportResponseRowsItemLineCategory SALES_TAX_REMITTANCE_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.SALES_TAX_REMITTANCE_REVERSAL, "sales_tax_remittance_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory SALES_TAX_COLLECTED = + new GetFinancialReportResponseRowsItemLineCategory(Value.SALES_TAX_COLLECTED, "sales_tax_collected"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory(Value.WITHDRAWAL_REVERSAL, "withdrawal_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory DISPUTE_UNRECONCILED_CLEARING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.DISPUTE_UNRECONCILED_CLEARING, "dispute_unreconciled_clearing"); + + public static final GetFinancialReportResponseRowsItemLineCategory CROSS_BORDER_PERCENTAGE_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.CROSS_BORDER_PERCENTAGE_FEE, "cross_border_percentage_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_POOL_CLEARING = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_POOL_CLEARING, "psp_pool_clearing"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_BILLING_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_BILLING_FEE, "psp_billing_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory INTERNAL_WITHDRAWAL_COMPLETE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.INTERNAL_WITHDRAWAL_COMPLETE, "internal_withdrawal_complete"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_OPTIMIZATION_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_OPTIMIZATION_FEE, "psp_optimization_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory PLATFORM_BALANCE_TRANSFER_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PLATFORM_BALANCE_TRANSFER_FEE, "platform_balance_transfer_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory INTERNAL_WITHDRAWAL_IN_TRANSIT_REVERSAL = + new GetFinancialReportResponseRowsItemLineCategory( + Value.INTERNAL_WITHDRAWAL_IN_TRANSIT_REVERSAL, "internal_withdrawal_in_transit_reversal"); + + public static final GetFinancialReportResponseRowsItemLineCategory CURRENCY_CONVERSION_OUTGOING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.CURRENCY_CONVERSION_OUTGOING, "currency_conversion_outgoing"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_DISPUTE_PAYABLE = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_DISPUTE_PAYABLE, "psp_dispute_payable"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYOUT_SUBSIDY = + new GetFinancialReportResponseRowsItemLineCategory(Value.PAYOUT_SUBSIDY, "payout_subsidy"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_PAYIN_SETTLEMENT = + new GetFinancialReportResponseRowsItemLineCategory(Value.PSP_PAYIN_SETTLEMENT, "psp_payin_settlement"); + + public static final GetFinancialReportResponseRowsItemLineCategory PSP_CLAWBACK_SETTLEMENT = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PSP_CLAWBACK_SETTLEMENT, "psp_clawback_settlement"); + + public static final GetFinancialReportResponseRowsItemLineCategory SALES_TAX_REMITTANCE = + new GetFinancialReportResponseRowsItemLineCategory(Value.SALES_TAX_REMITTANCE, "sales_tax_remittance"); + + public static final GetFinancialReportResponseRowsItemLineCategory WITHDRAWAL_PAYABLE_CLEARING = + new GetFinancialReportResponseRowsItemLineCategory( + Value.WITHDRAWAL_PAYABLE_CLEARING, "withdrawal_payable_clearing"); + + public static final GetFinancialReportResponseRowsItemLineCategory PAYMENT_PROCESSING_FIXED_FEE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.PAYMENT_PROCESSING_FIXED_FEE, "payment_processing_fixed_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory SOFTWARE_RENTAL_REVSHARE = + new GetFinancialReportResponseRowsItemLineCategory( + Value.SOFTWARE_RENTAL_REVSHARE, "software_rental_revshare"); + + public static final GetFinancialReportResponseRowsItemLineCategory AIRDROP_LINK_FUNDED = + new GetFinancialReportResponseRowsItemLineCategory(Value.AIRDROP_LINK_FUNDED, "airdrop_link_funded"); + + public static final GetFinancialReportResponseRowsItemLineCategory BUYER_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.BUYER_FEE, "buyer_fee"); + + public static final GetFinancialReportResponseRowsItemLineCategory WHOP_PROCESSING_FEE = + new GetFinancialReportResponseRowsItemLineCategory(Value.WHOP_PROCESSING_FEE, "whop_processing_fee"); + + private final Value value; + + private final String string; + + GetFinancialReportResponseRowsItemLineCategory(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof GetFinancialReportResponseRowsItemLineCategory + && this.string.equals(((GetFinancialReportResponseRowsItemLineCategory) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PSP_COMMISSION_FEE: + return visitor.visitPspCommissionFee(); + case STRIPE_INTERNATIONAL_PROCESSING_FEE: + return visitor.visitStripeInternationalProcessingFee(); + case PAYMENT_DISPUTE_REVERSAL: + return visitor.visitPaymentDisputeReversal(); + case TREASURY_PAYIN: + return visitor.visitTreasuryPayin(); + case PSP_AUTHENTICATION_FEE: + return visitor.visitPspAuthenticationFee(); + case PLATFORM_COVERED_DISPUTE: + return visitor.visitPlatformCoveredDispute(); + case REFUND_SETTLEMENT: + return visitor.visitRefundSettlement(); + case PSP_CLAWBACK_FEE: + return visitor.visitPspClawbackFee(); + case PAYMENT_REVSHARE_REFUND: + return visitor.visitPaymentRevshareRefund(); + case WITHDRAWAL_MARKUP_FEE_PAYOUT: + return visitor.visitWithdrawalMarkupFeePayout(); + case PSP_VARIABLE_FEE: + return visitor.visitPspVariableFee(); + case PAYOUT_FEE: + return visitor.visitPayoutFee(); + case PAYMENT_UNRECONCILED_REVERSAL: + return visitor.visitPaymentUnreconciledReversal(); + case PAYMENT_REFERRAL_REVERSAL: + return visitor.visitPaymentReferralReversal(); + case DISPUTE_SETTLEMENT_REVERSAL: + return visitor.visitDisputeSettlementReversal(); + case AD_BALANCE_FUNDING_RECEIPT: + return visitor.visitAdBalanceFundingReceipt(); + case PLATFORM_BALANCE_TRANSFER_INCOMING: + return visitor.visitPlatformBalanceTransferIncoming(); + case CARD_LOAD_TRANSFER: + return visitor.visitCardLoadTransfer(); + case INTERNAL_WITHDRAWAL_MARKUP_FEE_REVERSAL: + return visitor.visitInternalWithdrawalMarkupFeeReversal(); + case INTERNAL_WITHDRAWAL_FEE: + return visitor.visitInternalWithdrawalFee(); + case PSP_ADJUSTED_PROCESSING_FEE: + return visitor.visitPspAdjustedProcessingFee(); + case TAX_FILING_FEE: + return visitor.visitTaxFilingFee(); + case FX_MARKUP: + return visitor.visitFxMarkup(); + case PSP_PROCESSING_FEE: + return visitor.visitPspProcessingFee(); + case TOPUP_REVERSAL: + return visitor.visitTopupReversal(); + case DISPUTE_PAYABLE_CLEARING: + return visitor.visitDisputePayableClearing(); + case RESERVE: + return visitor.visitReserve(); + case ONCHAIN_WITHDRAWAL_OFFSET: + return visitor.visitOnchainWithdrawalOffset(); + case PASSTHROUGH_GMV_OFFSET: + return visitor.visitPassthroughGmvOffset(); + case REFUND_PAYABLE_CLEARING: + return visitor.visitRefundPayableClearing(); + case AD_SPEND_MARGIN: + return visitor.visitAdSpendMargin(); + case PAYOUT_UNRECONCILED_CLEARING: + return visitor.visitPayoutUnreconciledClearing(); + case PAYMENT_REVSHARE_PAYOUT: + return visitor.visitPaymentRevsharePayout(); + case PSP_BANK_PULL_CLEARING: + return visitor.visitPspBankPullClearing(); + case PLATFORM_EARNING_UNRECONCILED_CLEARING: + return visitor.visitPlatformEarningUnreconciledClearing(); + case FRAUD_PREVENTION_FEE: + return visitor.visitFraudPreventionFee(); + case AD_INCOME_RECEIPT: + return visitor.visitAdIncomeReceipt(); + case INTERNAL_WITHDRAWAL_PAYABLE_REVERSAL: + return visitor.visitInternalWithdrawalPayableReversal(); + case PSP_PAYOUT_RECEIVABLE: + return visitor.visitPspPayoutReceivable(); + case PSP_PAYOUT_CONSOLIDATION: + return visitor.visitPspPayoutConsolidation(); + case PSP_POOL_SETTLEMENT: + return visitor.visitPspPoolSettlement(); + case PAYMENT_REFERRAL_REFUND: + return visitor.visitPaymentReferralRefund(); + case MISC_REVERSAL: + return visitor.visitMiscReversal(); + case ACCOUNT_SETTLEMENT: + return visitor.visitAccountSettlement(); + case AD_CAMPAIGN_BUDGET: + return visitor.visitAdCampaignBudget(); + case PSP_RECEIVABLE_POOLED: + return visitor.visitPspReceivablePooled(); + case DISPUTE_HOLD: + return visitor.visitDisputeHold(); + case ONCHAIN_WITHDRAWAL: + return visitor.visitOnchainWithdrawal(); + case PSP_CORRECTION: + return visitor.visitPspCorrection(); + case PSP_CURRENCY_CONVERSION_RECEIVABLE: + return visitor.visitPspCurrencyConversionReceivable(); + case PSP_SERVICE_FEE: + return visitor.visitPspServiceFee(); + case CARD_SPEND_AUTHORIZATION_VOID: + return visitor.visitCardSpendAuthorizationVoid(); + case EXTERNAL_ACCOUNT_CONNECTION_FEE: + return visitor.visitExternalAccountConnectionFee(); + case LEGACY_PAYMENT_REFUND: + return visitor.visitLegacyPaymentRefund(); + case INTERNAL_WITHDRAWAL: + return visitor.visitInternalWithdrawal(); + case CARD_UNLOAD_TRANSFER: + return visitor.visitCardUnloadTransfer(); + case REFERRAL_BONUS: + return visitor.visitReferralBonus(); + case CLAWBACK_RECEIVABLE: + return visitor.visitClawbackReceivable(); + case INTERNAL_BALANCE_TRANSFER_OUTGOING: + return visitor.visitInternalBalanceTransferOutgoing(); + case PSP_GATEWAY_FEE: + return visitor.visitPspGatewayFee(); + case BALANCE_RESERVATION_REVERSAL: + return visitor.visitBalanceReservationReversal(); + case INTERNAL_WITHDRAWAL_PAYABLE: + return visitor.visitInternalWithdrawalPayable(); + case CONNECTED_ACCOUNT_NEGATIVE_BALANCE: + return visitor.visitConnectedAccountNegativeBalance(); + case RECIPIENT_WALLET_LOAD: + return visitor.visitRecipientWalletLoad(); + case PSP_CURRENCY_CONVERSION_OUTGOING: + return visitor.visitPspCurrencyConversionOutgoing(); + case WITHDRAWAL_TOPUP_ADJUSTMENT: + return visitor.visitWithdrawalTopupAdjustment(); + case PSP_INVOICING_FEE: + return visitor.visitPspInvoicingFee(); + case PSP_DISPUTE_ALERT_FEE: + return visitor.visitPspDisputeAlertFee(); + case WITHDRAWAL_MARKUP_FEE_PAYOUT_REVERSAL: + return visitor.visitWithdrawalMarkupFeePayoutReversal(); + case CARD_SPEND_REFUND: + return visitor.visitCardSpendRefund(); + case CARD_SPEND_CAPTURE: + return visitor.visitCardSpendCapture(); + case CLAWBACK_RECEIVABLE_SETTLEMENT: + return visitor.visitClawbackReceivableSettlement(); + case PSP_EXTERNAL_ACCOUNT_CONNECTION_FEE: + return visitor.visitPspExternalAccountConnectionFee(); + case PAYMENT_REVSHARE: + return visitor.visitPaymentRevshare(); + case PSP_WITHHOLDING_TAX: + return visitor.visitPspWithholdingTax(); + case INTERNAL_WITHDRAWAL_MARKUP_FEE_PAYOUT_REVERSAL: + return visitor.visitInternalWithdrawalMarkupFeePayoutReversal(); + case REFUND_PAYABLE_REVERSAL: + return visitor.visitRefundPayableReversal(); + case BILLING_PERCENTAGE_FEE: + return visitor.visitBillingPercentageFee(); + case PAYMENT_DISPUTE_ADJUSTMENT: + return visitor.visitPaymentDisputeAdjustment(); + case PSP_CLAWBACK_SETTLEMENT_REVERSAL: + return visitor.visitPspClawbackSettlementReversal(); + case DISPUTE_ALERT_FEE: + return visitor.visitDisputeAlertFee(); + case PSP_TREASURY_FEE: + return visitor.visitPspTreasuryFee(); + case APPLICATION_FEE: + return visitor.visitApplicationFee(); + case PLATFORM_EARNING_SETTLEMENT: + return visitor.visitPlatformEarningSettlement(); + case CARD_SPEND_AUTHORIZATION_HOLD: + return visitor.visitCardSpendAuthorizationHold(); + case PAYMENT_UNRECONCILED_CLEARING: + return visitor.visitPaymentUnreconciledClearing(); + case ONCHAIN_WALLET_TRANSFER_OUTGOING: + return visitor.visitOnchainWalletTransferOutgoing(); + case LICENSE_SALE: + return visitor.visitLicenseSale(); + case PSP_FIXED_FEE: + return visitor.visitPspFixedFee(); + case APPLICATION_FEE_PAYOUT: + return visitor.visitApplicationFeePayout(); + case PSP_DISPUTE_MANAGEMENT_FEE: + return visitor.visitPspDisputeManagementFee(); + case CLAWBACK_RECEIVABLE_SETTLEMENT_REVERSAL: + return visitor.visitClawbackReceivableSettlementReversal(); + case AD_SPEND_CHARGE: + return visitor.visitAdSpendCharge(); + case REFUND_UNRECONCILED_REVERSAL: + return visitor.visitRefundUnreconciledReversal(); + case PROMO_REVERSAL: + return visitor.visitPromoReversal(); + case PAYMENT_REFUND_FEE: + return visitor.visitPaymentRefundFee(); + case SWAP_FEE: + return visitor.visitSwapFee(); + case AIRDROP: + return visitor.visitAirdrop(); + case PAYMENT_RECEIVABLE_REVERSAL: + return visitor.visitPaymentReceivableReversal(); + case LICENSE_SALE_REVENUE: + return visitor.visitLicenseSaleRevenue(); + case TOPUP: + return visitor.visitTopup(); + case PAYMENT_REFERRAL_PAYABLE: + return visitor.visitPaymentReferralPayable(); + case HIGH_RISK_MERCHANT_FEE: + return visitor.visitHighRiskMerchantFee(); + case PSP_PAYOUT_FEE: + return visitor.visitPspPayoutFee(); + case INTERNAL_WITHDRAWAL_MARKUP_FEE: + return visitor.visitInternalWithdrawalMarkupFee(); + case AD_INCOME_EXPENSE: + return visitor.visitAdIncomeExpense(); + case PSP_RISK_FEE: + return visitor.visitPspRiskFee(); + case BALANCE_RESERVATION_RELEASE: + return visitor.visitBalanceReservationRelease(); + case WITHDRAWAL_RECLASSIFICATION: + return visitor.visitWithdrawalReclassification(); + case STRIPE_DOMESTIC_PROCESSING_FEE: + return visitor.visitStripeDomesticProcessingFee(); + case ONCHAIN_DEPOSIT_OFFSET: + return visitor.visitOnchainDepositOffset(); + case CONNECTED_ACCOUNT_CLAWBACK: + return visitor.visitConnectedAccountClawback(); + case ONCHAIN_SWAP_OFFSET: + return visitor.visitOnchainSwapOffset(); + case SOFTWARE_RENTAL_TRANSACTION: + return visitor.visitSoftwareRentalTransaction(); + case WITHDRAWAL_FEE_REVERSAL: + return visitor.visitWithdrawalFeeReversal(); + case PSP_PAYOUT_SETTLEMENT_REVERSAL: + return visitor.visitPspPayoutSettlementReversal(); + case PAYOUT_RECEIVABLE: + return visitor.visitPayoutReceivable(); + case PENDING: + return visitor.visitPending(); + case PASSTHROUGH_GMV: + return visitor.visitPassthroughGmv(); + case SALES_TAX_COLLECTED_REVERSAL: + return visitor.visitSalesTaxCollectedReversal(); + case PSP_PAYOUT_RECEIVABLE_CLEARING: + return visitor.visitPspPayoutReceivableClearing(); + case AD_NETWORK_SETTLEMENT: + return visitor.visitAdNetworkSettlement(); + case AIRDROP_LINK_CANCELED: + return visitor.visitAirdropLinkCanceled(); + case CARD_INTERCHANGE: + return visitor.visitCardInterchange(); + case AVAILABLE: + return visitor.visitAvailable(); + case LICENSE_SALE_COMMISSION: + return visitor.visitLicenseSaleCommission(); + case INTERNAL_WITHDRAWAL_IN_TRANSIT: + return visitor.visitInternalWithdrawalInTransit(); + case SALES_TAX_FEE: + return visitor.visitSalesTaxFee(); + case PSP_SCHEME_FEE: + return visitor.visitPspSchemeFee(); + case REFUND_UNRECONCILED_CLEARING: + return visitor.visitRefundUnreconciledClearing(); + case PSP_ACCOUNT_UPDATER_FEE: + return visitor.visitPspAccountUpdaterFee(); + case TOPUP_FEE: + return visitor.visitTopupFee(); + case PAYMENT_RECEIVABLE_SETTLEMENT: + return visitor.visitPaymentReceivableSettlement(); + case PSP_BANK_PULL_SETTLEMENT: + return visitor.visitPspBankPullSettlement(); + case FX_PERCENTAGE_FEE: + return visitor.visitFxPercentageFee(); + case PAYMENT_RECEIVABLE_CLEARING: + return visitor.visitPaymentReceivableClearing(); + case DISPUTE_SETTLEMENT: + return visitor.visitDisputeSettlement(); + case PSP_CONNECT_FEE: + return visitor.visitPspConnectFee(); + case PSP_INTERCHANGE_FEE: + return visitor.visitPspInterchangeFee(); + case PLATFORM_AFFILIATE_PAYMENT: + return visitor.visitPlatformAffiliatePayment(); + case INTERNAL_WITHDRAWAL_REVERSAL: + return visitor.visitInternalWithdrawalReversal(); + case CARD_SPEND_AUTHORIZATION_VOID_RELEASE: + return visitor.visitCardSpendAuthorizationVoidRelease(); + case WITHDRAWAL_PAYABLE_CLEARING_REVERSAL: + return visitor.visitWithdrawalPayableClearingReversal(); + case PSP_INVOICE_TAX_FEE: + return visitor.visitPspInvoiceTaxFee(); + case DISPUTE_REPRESENTMENT_FEE: + return visitor.visitDisputeRepresentmentFee(); + case PLATFORM_BALANCE_PAYMENT_REFUND: + return visitor.visitPlatformBalancePaymentRefund(); + case RESOLUTION_CENTER_REFUND: + return visitor.visitResolutionCenterRefund(); + case PSP_RESERVE_HOLD: + return visitor.visitPspReserveHold(); + case PSP_POOL_DISPUTE_SETTLEMENT: + return visitor.visitPspPoolDisputeSettlement(); + case THREE_DS_FIXED_FEE: + return visitor.visitThreeDsFixedFee(); + case AIRDROP_LINK_RETURNED: + return visitor.visitAirdropLinkReturned(); + case REFUND_SETTLEMENT_REVERSAL: + return visitor.visitRefundSettlementReversal(); + case WITHDRAWAL_MARKUP_FEE: + return visitor.visitWithdrawalMarkupFee(); + case INSTALLMENT_DEFAULT: + return visitor.visitInstallmentDefault(); + case PSP_TERMINAL_FEE: + return visitor.visitPspTerminalFee(); + case PLATFORM_BALANCE_PAYMENT: + return visitor.visitPlatformBalancePayment(); + case PSP_REFUND_FEE: + return visitor.visitPspRefundFee(); + case AD_PUBLISHER_PAYOUT_RECEIVED: + return visitor.visitAdPublisherPayoutReceived(); + case LEGACY_CRYPTO_PAYMENT: + return visitor.visitLegacyCryptoPayment(); + case CLAWBACK_RECEIVABLE_REVERSAL: + return visitor.visitClawbackReceivableReversal(); + case PSP_REFUND_PAYABLE: + return visitor.visitPspRefundPayable(); + case PAYMENT_REFERRAL: + return visitor.visitPaymentReferral(); + case WHOP_SWAP_FEE_RECEIVED: + return visitor.visitWhopSwapFeeReceived(); + case PSP_MARKUP_FEE: + return visitor.visitPspMarkupFee(); + case WITHDRAWAL_CLAWBACK_REVERSAL: + return visitor.visitWithdrawalClawbackReversal(); + case CARD_SPEND_AUTHORIZATION: + return visitor.visitCardSpendAuthorization(); + case INTERNAL_WITHDRAWAL_MARKUP_FEE_PAYOUT: + return visitor.visitInternalWithdrawalMarkupFeePayout(); + case EXTERNAL_CARD_LOAD_DEPOSIT: + return visitor.visitExternalCardLoadDeposit(); + case SALES_TAX_REMITTED: + return visitor.visitSalesTaxRemitted(); + case CLAWBACK_FEE: + return visitor.visitClawbackFee(); + case PAYMENT_REFUND_REVERSAL: + return visitor.visitPaymentRefundReversal(); + case WITHDRAWAL_PAYABLE_REVERSAL: + return visitor.visitWithdrawalPayableReversal(); + case AIRDROP_EXPENSE: + return visitor.visitAirdropExpense(); + case AD_NETWORK_COST: + return visitor.visitAdNetworkCost(); + case FX_SETTLEMENT_GAIN_LOSS: + return visitor.visitFxSettlementGainLoss(); + case PSP_TAX_SERVICE_FEE: + return visitor.visitPspTaxServiceFee(); + case PLATFORM_BALANCE_TRANSFER_OUTGOING: + return visitor.visitPlatformBalanceTransferOutgoing(); + case PSP_CURRENCY_CONVERSION_INCOMING: + return visitor.visitPspCurrencyConversionIncoming(); + case AIRDROP_LINK_REDEEMED: + return visitor.visitAirdropLinkRedeemed(); + case ONCHAIN_SWAP_TARGET: + return visitor.visitOnchainSwapTarget(); + case PSP_CURRENCY_CONVERSION_RECEIVABLE_CLEARING: + return visitor.visitPspCurrencyConversionReceivableClearing(); + case EXTERNAL_CARD_LOAD_OFFSET: + return visitor.visitExternalCardLoadOffset(); + case AFFILIATE_FEE: + return visitor.visitAffiliateFee(); + case ONCHAIN_SWAP_SOURCE: + return visitor.visitOnchainSwapSource(); + case PAYMENT_GROSS_REVERSAL: + return visitor.visitPaymentGrossReversal(); + case PSP_PAYMENT_RECEIVABLE: + return visitor.visitPspPaymentReceivable(); + case TREASURY_PAYIN_RECEIVABLE: + return visitor.visitTreasuryPayinReceivable(); + case PSP_IDENTITY_VERIFICATION_FEE: + return visitor.visitPspIdentityVerificationFee(); + case WITHDRAWAL_MARKUP_FEE_REVERSAL: + return visitor.visitWithdrawalMarkupFeeReversal(); + case AD_FUNDING_DISBURSEMENT: + return visitor.visitAdFundingDisbursement(); + case WITHDRAWAL_CLAWBACK: + return visitor.visitWithdrawalClawback(); + case PLATFORM_EARNING: + return visitor.visitPlatformEarning(); + case REVSHARE_PERCENTAGE_FEE: + return visitor.visitRevsharePercentageFee(); + case AIRDROP_REVERSAL: + return visitor.visitAirdropReversal(); + case PAYMENT_REFUND: + return visitor.visitPaymentRefund(); + case WITHDRAWAL_FEE: + return visitor.visitWithdrawalFee(); + case BAD_DEBT_OFFSET: + return visitor.visitBadDebtOffset(); + case AIRDROP_LINK_CLAIMED: + return visitor.visitAirdropLinkClaimed(); + case BALANCE_RESERVATION_HOLD: + return visitor.visitBalanceReservationHold(); + case PSP_DISPUTE_FEE: + return visitor.visitPspDisputeFee(); + case AIRDROP_LINK_CREATED: + return visitor.visitAirdropLinkCreated(); + case CARD_UNLOAD_DEPOSIT: + return visitor.visitCardUnloadDeposit(); + case PSP_TRANSFER_SETTLEMENT: + return visitor.visitPspTransferSettlement(); + case COMPANY_REFERRAL: + return visitor.visitCompanyReferral(); + case ORCHESTRATION_PERCENTAGE_FEE: + return visitor.visitOrchestrationPercentageFee(); + case CARD_INTERCHANGE_RECEIVABLE: + return visitor.visitCardInterchangeReceivable(); + case PAYMENT_REVSHARE_REVERSAL: + return visitor.visitPaymentRevshareReversal(); + case CARD_LOAD_DEPOSIT: + return visitor.visitCardLoadDeposit(); + case MISC_REFUND: + return visitor.visitMiscRefund(); + case DISPUTE_PAYABLE_REVERSAL: + return visitor.visitDisputePayableReversal(); + case TREASURY_FEE: + return visitor.visitTreasuryFee(); + case ONCHAIN_WALLET_TRANSFER_INCOMING: + return visitor.visitOnchainWalletTransferIncoming(); + case PSP_TAX_FILING_FEE: + return visitor.visitPspTaxFilingFee(); + case BAD_DEBT_EXPENSE: + return visitor.visitBadDebtExpense(); + case PAYMENT_DISPUTE_FEE: + return visitor.visitPaymentDisputeFee(); + case AIRDROP_EXPENSE_REVERSAL: + return visitor.visitAirdropExpenseReversal(); + case AD_PUBLISHER_PAYOUT: + return visitor.visitAdPublisherPayout(); + case PAYMENT_DISPUTE: + return visitor.visitPaymentDispute(); + case PAYMENT_PROCESSING_PERCENTAGE_FEE: + return visitor.visitPaymentProcessingPercentageFee(); + case CARD_SPEND_CAPTURE_OFFSET: + return visitor.visitCardSpendCaptureOffset(); + case PSP_PAYOUT_DEPOSIT: + return visitor.visitPspPayoutDeposit(); + case DISPUTE_MANAGEMENT_FEE: + return visitor.visitDisputeManagementFee(); + case WITHDRAWAL: + return visitor.visitWithdrawal(); + case SETTLEMENT_ROUNDING_VARIANCE: + return visitor.visitSettlementRoundingVariance(); + case PSP_NETWORK_TOKEN_FEE: + return visitor.visitPspNetworkTokenFee(); + case BALANCE_RESERVATION: + return visitor.visitBalanceReservation(); + case WITHDRAWAL_PAYABLE: + return visitor.visitWithdrawalPayable(); + case LEGACY_PAYMENT: + return visitor.visitLegacyPayment(); + case PSP_RECIPIENT_WALLET_LOAD: + return visitor.visitPspRecipientWalletLoad(); + case AD_BUDGET_RELEASE: + return visitor.visitAdBudgetRelease(); + case CRYPTO: + return visitor.visitCrypto(); + case DISPUTE_UNRECONCILED_REVERSAL: + return visitor.visitDisputeUnreconciledReversal(); + case PLATFORM_AFFILIATE_PAYMENT_REVERSAL: + return visitor.visitPlatformAffiliatePaymentReversal(); + case FX_GAIN_LOSS: + return visitor.visitFxGainLoss(); + case INTERNAL_WITHDRAWAL_FEE_REVERSAL: + return visitor.visitInternalWithdrawalFeeReversal(); + case PSP_COLLECTION_SETTLEMENT: + return visitor.visitPspCollectionSettlement(); + case IDENTITY_VERIFICATION_FEE: + return visitor.visitIdentityVerificationFee(); + case INTERNAL_BALANCE_TRANSFER_INCOMING: + return visitor.visitInternalBalanceTransferIncoming(); + case ONCHAIN_DEPOSIT: + return visitor.visitOnchainDeposit(); + case PSP_PAYIN_CLEARING: + return visitor.visitPspPayinClearing(); + case MARKETPLACE_AFFILIATE_FEE: + return visitor.visitMarketplaceAffiliateFee(); + case CARD_SPEND_REFUND_OFFSET: + return visitor.visitCardSpendRefundOffset(); + case MISC_PURCHASE: + return visitor.visitMiscPurchase(); + case PSP_PAYMENT_METHOD_FEE: + return visitor.visitPspPaymentMethodFee(); + case APPLICATION_FEE_PAYABLE: + return visitor.visitApplicationFeePayable(); + case CURRENCY_CONVERSION_INCOMING: + return visitor.visitCurrencyConversionIncoming(); + case PSP_PAYOUT_SETTLEMENT: + return visitor.visitPspPayoutSettlement(); + case DISPUTE_HOLD_BLOCKED: + return visitor.visitDisputeHoldBlocked(); + case DISPUTE_HOLD_ADJUSTMENT: + return visitor.visitDisputeHoldAdjustment(); + case PAYMENT_GROSS: + return visitor.visitPaymentGross(); + case PSP_TRANSFER_SETTLEMENT_REVERSAL: + return visitor.visitPspTransferSettlementReversal(); + case AGGREGATED_FEE: + return visitor.visitAggregatedFee(); + case PSP_RESERVE_RELEASE: + return visitor.visitPspReserveRelease(); + case ADS_CARD_SPREAD: + return visitor.visitAdsCardSpread(); + case SALES_TAX_REMITTANCE_REVERSAL: + return visitor.visitSalesTaxRemittanceReversal(); + case SALES_TAX_COLLECTED: + return visitor.visitSalesTaxCollected(); + case WITHDRAWAL_REVERSAL: + return visitor.visitWithdrawalReversal(); + case DISPUTE_UNRECONCILED_CLEARING: + return visitor.visitDisputeUnreconciledClearing(); + case CROSS_BORDER_PERCENTAGE_FEE: + return visitor.visitCrossBorderPercentageFee(); + case PSP_POOL_CLEARING: + return visitor.visitPspPoolClearing(); + case PSP_BILLING_FEE: + return visitor.visitPspBillingFee(); + case INTERNAL_WITHDRAWAL_COMPLETE: + return visitor.visitInternalWithdrawalComplete(); + case PSP_OPTIMIZATION_FEE: + return visitor.visitPspOptimizationFee(); + case PLATFORM_BALANCE_TRANSFER_FEE: + return visitor.visitPlatformBalanceTransferFee(); + case INTERNAL_WITHDRAWAL_IN_TRANSIT_REVERSAL: + return visitor.visitInternalWithdrawalInTransitReversal(); + case CURRENCY_CONVERSION_OUTGOING: + return visitor.visitCurrencyConversionOutgoing(); + case PSP_DISPUTE_PAYABLE: + return visitor.visitPspDisputePayable(); + case PAYOUT_SUBSIDY: + return visitor.visitPayoutSubsidy(); + case PSP_PAYIN_SETTLEMENT: + return visitor.visitPspPayinSettlement(); + case PSP_CLAWBACK_SETTLEMENT: + return visitor.visitPspClawbackSettlement(); + case SALES_TAX_REMITTANCE: + return visitor.visitSalesTaxRemittance(); + case WITHDRAWAL_PAYABLE_CLEARING: + return visitor.visitWithdrawalPayableClearing(); + case PAYMENT_PROCESSING_FIXED_FEE: + return visitor.visitPaymentProcessingFixedFee(); + case SOFTWARE_RENTAL_REVSHARE: + return visitor.visitSoftwareRentalRevshare(); + case AIRDROP_LINK_FUNDED: + return visitor.visitAirdropLinkFunded(); + case BUYER_FEE: + return visitor.visitBuyerFee(); + case WHOP_PROCESSING_FEE: + return visitor.visitWhopProcessingFee(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static GetFinancialReportResponseRowsItemLineCategory valueOf(String value) { + switch (value) { + case "psp_commission_fee": + return PSP_COMMISSION_FEE; + case "stripe_international_processing_fee": + return STRIPE_INTERNATIONAL_PROCESSING_FEE; + case "payment_dispute_reversal": + return PAYMENT_DISPUTE_REVERSAL; + case "treasury_payin": + return TREASURY_PAYIN; + case "psp_authentication_fee": + return PSP_AUTHENTICATION_FEE; + case "platform_covered_dispute": + return PLATFORM_COVERED_DISPUTE; + case "refund_settlement": + return REFUND_SETTLEMENT; + case "psp_clawback_fee": + return PSP_CLAWBACK_FEE; + case "payment_revshare_refund": + return PAYMENT_REVSHARE_REFUND; + case "withdrawal_markup_fee_payout": + return WITHDRAWAL_MARKUP_FEE_PAYOUT; + case "psp_variable_fee": + return PSP_VARIABLE_FEE; + case "payout_fee": + return PAYOUT_FEE; + case "payment_unreconciled_reversal": + return PAYMENT_UNRECONCILED_REVERSAL; + case "payment_referral_reversal": + return PAYMENT_REFERRAL_REVERSAL; + case "dispute_settlement_reversal": + return DISPUTE_SETTLEMENT_REVERSAL; + case "ad_balance_funding_receipt": + return AD_BALANCE_FUNDING_RECEIPT; + case "platform_balance_transfer_incoming": + return PLATFORM_BALANCE_TRANSFER_INCOMING; + case "card_load_transfer": + return CARD_LOAD_TRANSFER; + case "internal_withdrawal_markup_fee_reversal": + return INTERNAL_WITHDRAWAL_MARKUP_FEE_REVERSAL; + case "internal_withdrawal_fee": + return INTERNAL_WITHDRAWAL_FEE; + case "psp_adjusted_processing_fee": + return PSP_ADJUSTED_PROCESSING_FEE; + case "tax_filing_fee": + return TAX_FILING_FEE; + case "fx_markup": + return FX_MARKUP; + case "psp_processing_fee": + return PSP_PROCESSING_FEE; + case "topup_reversal": + return TOPUP_REVERSAL; + case "dispute_payable_clearing": + return DISPUTE_PAYABLE_CLEARING; + case "reserve": + return RESERVE; + case "onchain_withdrawal_offset": + return ONCHAIN_WITHDRAWAL_OFFSET; + case "passthrough_gmv_offset": + return PASSTHROUGH_GMV_OFFSET; + case "refund_payable_clearing": + return REFUND_PAYABLE_CLEARING; + case "ad_spend_margin": + return AD_SPEND_MARGIN; + case "payout_unreconciled_clearing": + return PAYOUT_UNRECONCILED_CLEARING; + case "payment_revshare_payout": + return PAYMENT_REVSHARE_PAYOUT; + case "psp_bank_pull_clearing": + return PSP_BANK_PULL_CLEARING; + case "platform_earning_unreconciled_clearing": + return PLATFORM_EARNING_UNRECONCILED_CLEARING; + case "fraud_prevention_fee": + return FRAUD_PREVENTION_FEE; + case "ad_income_receipt": + return AD_INCOME_RECEIPT; + case "internal_withdrawal_payable_reversal": + return INTERNAL_WITHDRAWAL_PAYABLE_REVERSAL; + case "psp_payout_receivable": + return PSP_PAYOUT_RECEIVABLE; + case "psp_payout_consolidation": + return PSP_PAYOUT_CONSOLIDATION; + case "psp_pool_settlement": + return PSP_POOL_SETTLEMENT; + case "payment_referral_refund": + return PAYMENT_REFERRAL_REFUND; + case "misc_reversal": + return MISC_REVERSAL; + case "account_settlement": + return ACCOUNT_SETTLEMENT; + case "ad_campaign_budget": + return AD_CAMPAIGN_BUDGET; + case "psp_receivable_pooled": + return PSP_RECEIVABLE_POOLED; + case "dispute_hold": + return DISPUTE_HOLD; + case "onchain_withdrawal": + return ONCHAIN_WITHDRAWAL; + case "psp_correction": + return PSP_CORRECTION; + case "psp_currency_conversion_receivable": + return PSP_CURRENCY_CONVERSION_RECEIVABLE; + case "psp_service_fee": + return PSP_SERVICE_FEE; + case "card_spend_authorization_void": + return CARD_SPEND_AUTHORIZATION_VOID; + case "external_account_connection_fee": + return EXTERNAL_ACCOUNT_CONNECTION_FEE; + case "legacy_payment_refund": + return LEGACY_PAYMENT_REFUND; + case "internal_withdrawal": + return INTERNAL_WITHDRAWAL; + case "card_unload_transfer": + return CARD_UNLOAD_TRANSFER; + case "referral_bonus": + return REFERRAL_BONUS; + case "clawback_receivable": + return CLAWBACK_RECEIVABLE; + case "internal_balance_transfer_outgoing": + return INTERNAL_BALANCE_TRANSFER_OUTGOING; + case "psp_gateway_fee": + return PSP_GATEWAY_FEE; + case "balance_reservation_reversal": + return BALANCE_RESERVATION_REVERSAL; + case "internal_withdrawal_payable": + return INTERNAL_WITHDRAWAL_PAYABLE; + case "connected_account_negative_balance": + return CONNECTED_ACCOUNT_NEGATIVE_BALANCE; + case "recipient_wallet_load": + return RECIPIENT_WALLET_LOAD; + case "psp_currency_conversion_outgoing": + return PSP_CURRENCY_CONVERSION_OUTGOING; + case "withdrawal_topup_adjustment": + return WITHDRAWAL_TOPUP_ADJUSTMENT; + case "psp_invoicing_fee": + return PSP_INVOICING_FEE; + case "psp_dispute_alert_fee": + return PSP_DISPUTE_ALERT_FEE; + case "withdrawal_markup_fee_payout_reversal": + return WITHDRAWAL_MARKUP_FEE_PAYOUT_REVERSAL; + case "card_spend_refund": + return CARD_SPEND_REFUND; + case "card_spend_capture": + return CARD_SPEND_CAPTURE; + case "clawback_receivable_settlement": + return CLAWBACK_RECEIVABLE_SETTLEMENT; + case "psp_external_account_connection_fee": + return PSP_EXTERNAL_ACCOUNT_CONNECTION_FEE; + case "payment_revshare": + return PAYMENT_REVSHARE; + case "psp_withholding_tax": + return PSP_WITHHOLDING_TAX; + case "internal_withdrawal_markup_fee_payout_reversal": + return INTERNAL_WITHDRAWAL_MARKUP_FEE_PAYOUT_REVERSAL; + case "refund_payable_reversal": + return REFUND_PAYABLE_REVERSAL; + case "billing_percentage_fee": + return BILLING_PERCENTAGE_FEE; + case "payment_dispute_adjustment": + return PAYMENT_DISPUTE_ADJUSTMENT; + case "psp_clawback_settlement_reversal": + return PSP_CLAWBACK_SETTLEMENT_REVERSAL; + case "dispute_alert_fee": + return DISPUTE_ALERT_FEE; + case "psp_treasury_fee": + return PSP_TREASURY_FEE; + case "application_fee": + return APPLICATION_FEE; + case "platform_earning_settlement": + return PLATFORM_EARNING_SETTLEMENT; + case "card_spend_authorization_hold": + return CARD_SPEND_AUTHORIZATION_HOLD; + case "payment_unreconciled_clearing": + return PAYMENT_UNRECONCILED_CLEARING; + case "onchain_wallet_transfer_outgoing": + return ONCHAIN_WALLET_TRANSFER_OUTGOING; + case "license_sale": + return LICENSE_SALE; + case "psp_fixed_fee": + return PSP_FIXED_FEE; + case "application_fee_payout": + return APPLICATION_FEE_PAYOUT; + case "psp_dispute_management_fee": + return PSP_DISPUTE_MANAGEMENT_FEE; + case "clawback_receivable_settlement_reversal": + return CLAWBACK_RECEIVABLE_SETTLEMENT_REVERSAL; + case "ad_spend_charge": + return AD_SPEND_CHARGE; + case "refund_unreconciled_reversal": + return REFUND_UNRECONCILED_REVERSAL; + case "promo_reversal": + return PROMO_REVERSAL; + case "payment_refund_fee": + return PAYMENT_REFUND_FEE; + case "swap_fee": + return SWAP_FEE; + case "airdrop": + return AIRDROP; + case "payment_receivable_reversal": + return PAYMENT_RECEIVABLE_REVERSAL; + case "license_sale_revenue": + return LICENSE_SALE_REVENUE; + case "topup": + return TOPUP; + case "payment_referral_payable": + return PAYMENT_REFERRAL_PAYABLE; + case "high_risk_merchant_fee": + return HIGH_RISK_MERCHANT_FEE; + case "psp_payout_fee": + return PSP_PAYOUT_FEE; + case "internal_withdrawal_markup_fee": + return INTERNAL_WITHDRAWAL_MARKUP_FEE; + case "ad_income_expense": + return AD_INCOME_EXPENSE; + case "psp_risk_fee": + return PSP_RISK_FEE; + case "balance_reservation_release": + return BALANCE_RESERVATION_RELEASE; + case "withdrawal_reclassification": + return WITHDRAWAL_RECLASSIFICATION; + case "stripe_domestic_processing_fee": + return STRIPE_DOMESTIC_PROCESSING_FEE; + case "onchain_deposit_offset": + return ONCHAIN_DEPOSIT_OFFSET; + case "connected_account_clawback": + return CONNECTED_ACCOUNT_CLAWBACK; + case "onchain_swap_offset": + return ONCHAIN_SWAP_OFFSET; + case "software_rental_transaction": + return SOFTWARE_RENTAL_TRANSACTION; + case "withdrawal_fee_reversal": + return WITHDRAWAL_FEE_REVERSAL; + case "psp_payout_settlement_reversal": + return PSP_PAYOUT_SETTLEMENT_REVERSAL; + case "payout_receivable": + return PAYOUT_RECEIVABLE; + case "pending": + return PENDING; + case "passthrough_gmv": + return PASSTHROUGH_GMV; + case "sales_tax_collected_reversal": + return SALES_TAX_COLLECTED_REVERSAL; + case "psp_payout_receivable_clearing": + return PSP_PAYOUT_RECEIVABLE_CLEARING; + case "ad_network_settlement": + return AD_NETWORK_SETTLEMENT; + case "airdrop_link_canceled": + return AIRDROP_LINK_CANCELED; + case "card_interchange": + return CARD_INTERCHANGE; + case "available": + return AVAILABLE; + case "license_sale_commission": + return LICENSE_SALE_COMMISSION; + case "internal_withdrawal_in_transit": + return INTERNAL_WITHDRAWAL_IN_TRANSIT; + case "sales_tax_fee": + return SALES_TAX_FEE; + case "psp_scheme_fee": + return PSP_SCHEME_FEE; + case "refund_unreconciled_clearing": + return REFUND_UNRECONCILED_CLEARING; + case "psp_account_updater_fee": + return PSP_ACCOUNT_UPDATER_FEE; + case "topup_fee": + return TOPUP_FEE; + case "payment_receivable_settlement": + return PAYMENT_RECEIVABLE_SETTLEMENT; + case "psp_bank_pull_settlement": + return PSP_BANK_PULL_SETTLEMENT; + case "fx_percentage_fee": + return FX_PERCENTAGE_FEE; + case "payment_receivable_clearing": + return PAYMENT_RECEIVABLE_CLEARING; + case "dispute_settlement": + return DISPUTE_SETTLEMENT; + case "psp_connect_fee": + return PSP_CONNECT_FEE; + case "psp_interchange_fee": + return PSP_INTERCHANGE_FEE; + case "platform_affiliate_payment": + return PLATFORM_AFFILIATE_PAYMENT; + case "internal_withdrawal_reversal": + return INTERNAL_WITHDRAWAL_REVERSAL; + case "card_spend_authorization_void_release": + return CARD_SPEND_AUTHORIZATION_VOID_RELEASE; + case "withdrawal_payable_clearing_reversal": + return WITHDRAWAL_PAYABLE_CLEARING_REVERSAL; + case "psp_invoice_tax_fee": + return PSP_INVOICE_TAX_FEE; + case "dispute_representment_fee": + return DISPUTE_REPRESENTMENT_FEE; + case "platform_balance_payment_refund": + return PLATFORM_BALANCE_PAYMENT_REFUND; + case "resolution_center_refund": + return RESOLUTION_CENTER_REFUND; + case "psp_reserve_hold": + return PSP_RESERVE_HOLD; + case "psp_pool_dispute_settlement": + return PSP_POOL_DISPUTE_SETTLEMENT; + case "three_ds_fixed_fee": + return THREE_DS_FIXED_FEE; + case "airdrop_link_returned": + return AIRDROP_LINK_RETURNED; + case "refund_settlement_reversal": + return REFUND_SETTLEMENT_REVERSAL; + case "withdrawal_markup_fee": + return WITHDRAWAL_MARKUP_FEE; + case "installment_default": + return INSTALLMENT_DEFAULT; + case "psp_terminal_fee": + return PSP_TERMINAL_FEE; + case "platform_balance_payment": + return PLATFORM_BALANCE_PAYMENT; + case "psp_refund_fee": + return PSP_REFUND_FEE; + case "ad_publisher_payout_received": + return AD_PUBLISHER_PAYOUT_RECEIVED; + case "legacy_crypto_payment": + return LEGACY_CRYPTO_PAYMENT; + case "clawback_receivable_reversal": + return CLAWBACK_RECEIVABLE_REVERSAL; + case "psp_refund_payable": + return PSP_REFUND_PAYABLE; + case "payment_referral": + return PAYMENT_REFERRAL; + case "whop_swap_fee_received": + return WHOP_SWAP_FEE_RECEIVED; + case "psp_markup_fee": + return PSP_MARKUP_FEE; + case "withdrawal_clawback_reversal": + return WITHDRAWAL_CLAWBACK_REVERSAL; + case "card_spend_authorization": + return CARD_SPEND_AUTHORIZATION; + case "internal_withdrawal_markup_fee_payout": + return INTERNAL_WITHDRAWAL_MARKUP_FEE_PAYOUT; + case "external_card_load_deposit": + return EXTERNAL_CARD_LOAD_DEPOSIT; + case "sales_tax_remitted": + return SALES_TAX_REMITTED; + case "clawback_fee": + return CLAWBACK_FEE; + case "payment_refund_reversal": + return PAYMENT_REFUND_REVERSAL; + case "withdrawal_payable_reversal": + return WITHDRAWAL_PAYABLE_REVERSAL; + case "airdrop_expense": + return AIRDROP_EXPENSE; + case "ad_network_cost": + return AD_NETWORK_COST; + case "fx_settlement_gain_loss": + return FX_SETTLEMENT_GAIN_LOSS; + case "psp_tax_service_fee": + return PSP_TAX_SERVICE_FEE; + case "platform_balance_transfer_outgoing": + return PLATFORM_BALANCE_TRANSFER_OUTGOING; + case "psp_currency_conversion_incoming": + return PSP_CURRENCY_CONVERSION_INCOMING; + case "airdrop_link_redeemed": + return AIRDROP_LINK_REDEEMED; + case "onchain_swap_target": + return ONCHAIN_SWAP_TARGET; + case "psp_currency_conversion_receivable_clearing": + return PSP_CURRENCY_CONVERSION_RECEIVABLE_CLEARING; + case "external_card_load_offset": + return EXTERNAL_CARD_LOAD_OFFSET; + case "affiliate_fee": + return AFFILIATE_FEE; + case "onchain_swap_source": + return ONCHAIN_SWAP_SOURCE; + case "payment_gross_reversal": + return PAYMENT_GROSS_REVERSAL; + case "psp_payment_receivable": + return PSP_PAYMENT_RECEIVABLE; + case "treasury_payin_receivable": + return TREASURY_PAYIN_RECEIVABLE; + case "psp_identity_verification_fee": + return PSP_IDENTITY_VERIFICATION_FEE; + case "withdrawal_markup_fee_reversal": + return WITHDRAWAL_MARKUP_FEE_REVERSAL; + case "ad_funding_disbursement": + return AD_FUNDING_DISBURSEMENT; + case "withdrawal_clawback": + return WITHDRAWAL_CLAWBACK; + case "platform_earning": + return PLATFORM_EARNING; + case "revshare_percentage_fee": + return REVSHARE_PERCENTAGE_FEE; + case "airdrop_reversal": + return AIRDROP_REVERSAL; + case "payment_refund": + return PAYMENT_REFUND; + case "withdrawal_fee": + return WITHDRAWAL_FEE; + case "bad_debt_offset": + return BAD_DEBT_OFFSET; + case "airdrop_link_claimed": + return AIRDROP_LINK_CLAIMED; + case "balance_reservation_hold": + return BALANCE_RESERVATION_HOLD; + case "psp_dispute_fee": + return PSP_DISPUTE_FEE; + case "airdrop_link_created": + return AIRDROP_LINK_CREATED; + case "card_unload_deposit": + return CARD_UNLOAD_DEPOSIT; + case "psp_transfer_settlement": + return PSP_TRANSFER_SETTLEMENT; + case "company_referral": + return COMPANY_REFERRAL; + case "orchestration_percentage_fee": + return ORCHESTRATION_PERCENTAGE_FEE; + case "card_interchange_receivable": + return CARD_INTERCHANGE_RECEIVABLE; + case "payment_revshare_reversal": + return PAYMENT_REVSHARE_REVERSAL; + case "card_load_deposit": + return CARD_LOAD_DEPOSIT; + case "misc_refund": + return MISC_REFUND; + case "dispute_payable_reversal": + return DISPUTE_PAYABLE_REVERSAL; + case "treasury_fee": + return TREASURY_FEE; + case "onchain_wallet_transfer_incoming": + return ONCHAIN_WALLET_TRANSFER_INCOMING; + case "psp_tax_filing_fee": + return PSP_TAX_FILING_FEE; + case "bad_debt_expense": + return BAD_DEBT_EXPENSE; + case "payment_dispute_fee": + return PAYMENT_DISPUTE_FEE; + case "airdrop_expense_reversal": + return AIRDROP_EXPENSE_REVERSAL; + case "ad_publisher_payout": + return AD_PUBLISHER_PAYOUT; + case "payment_dispute": + return PAYMENT_DISPUTE; + case "payment_processing_percentage_fee": + return PAYMENT_PROCESSING_PERCENTAGE_FEE; + case "card_spend_capture_offset": + return CARD_SPEND_CAPTURE_OFFSET; + case "psp_payout_deposit": + return PSP_PAYOUT_DEPOSIT; + case "dispute_management_fee": + return DISPUTE_MANAGEMENT_FEE; + case "withdrawal": + return WITHDRAWAL; + case "settlement_rounding_variance": + return SETTLEMENT_ROUNDING_VARIANCE; + case "psp_network_token_fee": + return PSP_NETWORK_TOKEN_FEE; + case "balance_reservation": + return BALANCE_RESERVATION; + case "withdrawal_payable": + return WITHDRAWAL_PAYABLE; + case "legacy_payment": + return LEGACY_PAYMENT; + case "psp_recipient_wallet_load": + return PSP_RECIPIENT_WALLET_LOAD; + case "ad_budget_release": + return AD_BUDGET_RELEASE; + case "crypto": + return CRYPTO; + case "dispute_unreconciled_reversal": + return DISPUTE_UNRECONCILED_REVERSAL; + case "platform_affiliate_payment_reversal": + return PLATFORM_AFFILIATE_PAYMENT_REVERSAL; + case "fx_gain_loss": + return FX_GAIN_LOSS; + case "internal_withdrawal_fee_reversal": + return INTERNAL_WITHDRAWAL_FEE_REVERSAL; + case "psp_collection_settlement": + return PSP_COLLECTION_SETTLEMENT; + case "identity_verification_fee": + return IDENTITY_VERIFICATION_FEE; + case "internal_balance_transfer_incoming": + return INTERNAL_BALANCE_TRANSFER_INCOMING; + case "onchain_deposit": + return ONCHAIN_DEPOSIT; + case "psp_payin_clearing": + return PSP_PAYIN_CLEARING; + case "marketplace_affiliate_fee": + return MARKETPLACE_AFFILIATE_FEE; + case "card_spend_refund_offset": + return CARD_SPEND_REFUND_OFFSET; + case "misc_purchase": + return MISC_PURCHASE; + case "psp_payment_method_fee": + return PSP_PAYMENT_METHOD_FEE; + case "application_fee_payable": + return APPLICATION_FEE_PAYABLE; + case "currency_conversion_incoming": + return CURRENCY_CONVERSION_INCOMING; + case "psp_payout_settlement": + return PSP_PAYOUT_SETTLEMENT; + case "dispute_hold_blocked": + return DISPUTE_HOLD_BLOCKED; + case "dispute_hold_adjustment": + return DISPUTE_HOLD_ADJUSTMENT; + case "payment_gross": + return PAYMENT_GROSS; + case "psp_transfer_settlement_reversal": + return PSP_TRANSFER_SETTLEMENT_REVERSAL; + case "aggregated_fee": + return AGGREGATED_FEE; + case "psp_reserve_release": + return PSP_RESERVE_RELEASE; + case "ads_card_spread": + return ADS_CARD_SPREAD; + case "sales_tax_remittance_reversal": + return SALES_TAX_REMITTANCE_REVERSAL; + case "sales_tax_collected": + return SALES_TAX_COLLECTED; + case "withdrawal_reversal": + return WITHDRAWAL_REVERSAL; + case "dispute_unreconciled_clearing": + return DISPUTE_UNRECONCILED_CLEARING; + case "cross_border_percentage_fee": + return CROSS_BORDER_PERCENTAGE_FEE; + case "psp_pool_clearing": + return PSP_POOL_CLEARING; + case "psp_billing_fee": + return PSP_BILLING_FEE; + case "internal_withdrawal_complete": + return INTERNAL_WITHDRAWAL_COMPLETE; + case "psp_optimization_fee": + return PSP_OPTIMIZATION_FEE; + case "platform_balance_transfer_fee": + return PLATFORM_BALANCE_TRANSFER_FEE; + case "internal_withdrawal_in_transit_reversal": + return INTERNAL_WITHDRAWAL_IN_TRANSIT_REVERSAL; + case "currency_conversion_outgoing": + return CURRENCY_CONVERSION_OUTGOING; + case "psp_dispute_payable": + return PSP_DISPUTE_PAYABLE; + case "payout_subsidy": + return PAYOUT_SUBSIDY; + case "psp_payin_settlement": + return PSP_PAYIN_SETTLEMENT; + case "psp_clawback_settlement": + return PSP_CLAWBACK_SETTLEMENT; + case "sales_tax_remittance": + return SALES_TAX_REMITTANCE; + case "withdrawal_payable_clearing": + return WITHDRAWAL_PAYABLE_CLEARING; + case "payment_processing_fixed_fee": + return PAYMENT_PROCESSING_FIXED_FEE; + case "software_rental_revshare": + return SOFTWARE_RENTAL_REVSHARE; + case "airdrop_link_funded": + return AIRDROP_LINK_FUNDED; + case "buyer_fee": + return BUYER_FEE; + case "whop_processing_fee": + return WHOP_PROCESSING_FEE; + default: + return new GetFinancialReportResponseRowsItemLineCategory(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT_SETTLEMENT, + + AD_BALANCE_FUNDING_RECEIPT, + + AD_BUDGET_RELEASE, + + AD_CAMPAIGN_BUDGET, + + AD_FUNDING_DISBURSEMENT, + + AD_INCOME_EXPENSE, + + AD_INCOME_RECEIPT, + + AD_NETWORK_COST, + + AD_NETWORK_SETTLEMENT, + + AD_PUBLISHER_PAYOUT, + + AD_PUBLISHER_PAYOUT_RECEIVED, + + AD_SPEND_CHARGE, + + AD_SPEND_MARGIN, + + ADS_CARD_SPREAD, + + AFFILIATE_FEE, + + AGGREGATED_FEE, + + AIRDROP, + + AIRDROP_EXPENSE, + + AIRDROP_EXPENSE_REVERSAL, + + AIRDROP_LINK_CANCELED, + + AIRDROP_LINK_CLAIMED, + + AIRDROP_LINK_CREATED, + + AIRDROP_LINK_FUNDED, + + AIRDROP_LINK_REDEEMED, + + AIRDROP_LINK_RETURNED, + + AIRDROP_REVERSAL, + + APPLICATION_FEE, + + APPLICATION_FEE_PAYABLE, + + APPLICATION_FEE_PAYOUT, + + AVAILABLE, + + BAD_DEBT_EXPENSE, + + BAD_DEBT_OFFSET, + + BALANCE_RESERVATION, + + BALANCE_RESERVATION_HOLD, + + BALANCE_RESERVATION_RELEASE, + + BALANCE_RESERVATION_REVERSAL, + + BILLING_PERCENTAGE_FEE, + + BUYER_FEE, + + CARD_INTERCHANGE, + + CARD_INTERCHANGE_RECEIVABLE, + + CARD_LOAD_DEPOSIT, + + CARD_LOAD_TRANSFER, + + CARD_SPEND_AUTHORIZATION, + + CARD_SPEND_AUTHORIZATION_HOLD, + + CARD_SPEND_AUTHORIZATION_VOID, + + CARD_SPEND_AUTHORIZATION_VOID_RELEASE, + + CARD_SPEND_CAPTURE, + + CARD_SPEND_CAPTURE_OFFSET, + + CARD_SPEND_REFUND, + + CARD_SPEND_REFUND_OFFSET, + + CARD_UNLOAD_DEPOSIT, + + CARD_UNLOAD_TRANSFER, + + CLAWBACK_FEE, + + CLAWBACK_RECEIVABLE, + + CLAWBACK_RECEIVABLE_REVERSAL, + + CLAWBACK_RECEIVABLE_SETTLEMENT, + + CLAWBACK_RECEIVABLE_SETTLEMENT_REVERSAL, + + COMPANY_REFERRAL, + + CONNECTED_ACCOUNT_CLAWBACK, + + CONNECTED_ACCOUNT_NEGATIVE_BALANCE, + + CROSS_BORDER_PERCENTAGE_FEE, + + CRYPTO, + + CURRENCY_CONVERSION_INCOMING, + + CURRENCY_CONVERSION_OUTGOING, + + DISPUTE_ALERT_FEE, + + DISPUTE_HOLD, + + DISPUTE_HOLD_ADJUSTMENT, + + DISPUTE_HOLD_BLOCKED, + + DISPUTE_MANAGEMENT_FEE, + + DISPUTE_PAYABLE_CLEARING, + + DISPUTE_PAYABLE_REVERSAL, + + DISPUTE_REPRESENTMENT_FEE, + + DISPUTE_SETTLEMENT, + + DISPUTE_SETTLEMENT_REVERSAL, + + DISPUTE_UNRECONCILED_CLEARING, + + DISPUTE_UNRECONCILED_REVERSAL, + + EXTERNAL_ACCOUNT_CONNECTION_FEE, + + EXTERNAL_CARD_LOAD_DEPOSIT, + + EXTERNAL_CARD_LOAD_OFFSET, + + FRAUD_PREVENTION_FEE, + + FX_GAIN_LOSS, + + FX_MARKUP, + + FX_PERCENTAGE_FEE, + + FX_SETTLEMENT_GAIN_LOSS, + + HIGH_RISK_MERCHANT_FEE, + + IDENTITY_VERIFICATION_FEE, + + INSTALLMENT_DEFAULT, + + INTERNAL_BALANCE_TRANSFER_INCOMING, + + INTERNAL_BALANCE_TRANSFER_OUTGOING, + + INTERNAL_WITHDRAWAL, + + INTERNAL_WITHDRAWAL_COMPLETE, + + INTERNAL_WITHDRAWAL_FEE, + + INTERNAL_WITHDRAWAL_FEE_REVERSAL, + + INTERNAL_WITHDRAWAL_IN_TRANSIT, + + INTERNAL_WITHDRAWAL_IN_TRANSIT_REVERSAL, + + INTERNAL_WITHDRAWAL_MARKUP_FEE, + + INTERNAL_WITHDRAWAL_MARKUP_FEE_PAYOUT, + + INTERNAL_WITHDRAWAL_MARKUP_FEE_PAYOUT_REVERSAL, + + INTERNAL_WITHDRAWAL_MARKUP_FEE_REVERSAL, + + INTERNAL_WITHDRAWAL_PAYABLE, + + INTERNAL_WITHDRAWAL_PAYABLE_REVERSAL, + + INTERNAL_WITHDRAWAL_REVERSAL, + + LEGACY_CRYPTO_PAYMENT, + + LEGACY_PAYMENT, + + LEGACY_PAYMENT_REFUND, + + LICENSE_SALE, + + LICENSE_SALE_COMMISSION, + + LICENSE_SALE_REVENUE, + + MARKETPLACE_AFFILIATE_FEE, + + MISC_PURCHASE, + + MISC_REFUND, + + MISC_REVERSAL, + + ONCHAIN_DEPOSIT, + + ONCHAIN_DEPOSIT_OFFSET, + + ONCHAIN_SWAP_OFFSET, + + ONCHAIN_SWAP_SOURCE, + + ONCHAIN_SWAP_TARGET, + + ONCHAIN_WALLET_TRANSFER_INCOMING, + + ONCHAIN_WALLET_TRANSFER_OUTGOING, + + ONCHAIN_WITHDRAWAL, + + ONCHAIN_WITHDRAWAL_OFFSET, + + ORCHESTRATION_PERCENTAGE_FEE, + + PASSTHROUGH_GMV, + + PASSTHROUGH_GMV_OFFSET, + + PAYMENT_DISPUTE, + + PAYMENT_DISPUTE_ADJUSTMENT, + + PAYMENT_DISPUTE_FEE, + + PAYMENT_DISPUTE_REVERSAL, + + PAYMENT_GROSS, + + PAYMENT_GROSS_REVERSAL, + + PAYMENT_PROCESSING_FIXED_FEE, + + PAYMENT_PROCESSING_PERCENTAGE_FEE, + + PAYMENT_RECEIVABLE_CLEARING, + + PAYMENT_RECEIVABLE_REVERSAL, + + PAYMENT_RECEIVABLE_SETTLEMENT, + + PAYMENT_REFERRAL, + + PAYMENT_REFERRAL_PAYABLE, + + PAYMENT_REFERRAL_REFUND, + + PAYMENT_REFERRAL_REVERSAL, + + PAYMENT_REFUND, + + PAYMENT_REFUND_FEE, + + PAYMENT_REFUND_REVERSAL, + + PAYMENT_REVSHARE, + + PAYMENT_REVSHARE_PAYOUT, + + PAYMENT_REVSHARE_REFUND, + + PAYMENT_REVSHARE_REVERSAL, + + PAYMENT_UNRECONCILED_CLEARING, + + PAYMENT_UNRECONCILED_REVERSAL, + + PAYOUT_FEE, + + PAYOUT_RECEIVABLE, + + PAYOUT_SUBSIDY, + + PAYOUT_UNRECONCILED_CLEARING, + + PENDING, + + PLATFORM_AFFILIATE_PAYMENT, + + PLATFORM_AFFILIATE_PAYMENT_REVERSAL, + + PLATFORM_BALANCE_PAYMENT, + + PLATFORM_BALANCE_PAYMENT_REFUND, + + PLATFORM_BALANCE_TRANSFER_FEE, + + PLATFORM_BALANCE_TRANSFER_INCOMING, + + PLATFORM_BALANCE_TRANSFER_OUTGOING, + + PLATFORM_COVERED_DISPUTE, + + PLATFORM_EARNING, + + PLATFORM_EARNING_SETTLEMENT, + + PLATFORM_EARNING_UNRECONCILED_CLEARING, + + PROMO_REVERSAL, + + PSP_ACCOUNT_UPDATER_FEE, + + PSP_ADJUSTED_PROCESSING_FEE, + + PSP_AUTHENTICATION_FEE, + + PSP_BANK_PULL_CLEARING, + + PSP_BANK_PULL_SETTLEMENT, + + PSP_BILLING_FEE, + + PSP_CLAWBACK_FEE, + + PSP_CLAWBACK_SETTLEMENT, + + PSP_CLAWBACK_SETTLEMENT_REVERSAL, + + PSP_COLLECTION_SETTLEMENT, + + PSP_COMMISSION_FEE, + + PSP_CONNECT_FEE, + + PSP_CORRECTION, + + PSP_CURRENCY_CONVERSION_INCOMING, + + PSP_CURRENCY_CONVERSION_OUTGOING, + + PSP_CURRENCY_CONVERSION_RECEIVABLE, + + PSP_CURRENCY_CONVERSION_RECEIVABLE_CLEARING, + + PSP_DISPUTE_ALERT_FEE, + + PSP_DISPUTE_FEE, + + PSP_DISPUTE_MANAGEMENT_FEE, + + PSP_DISPUTE_PAYABLE, + + PSP_EXTERNAL_ACCOUNT_CONNECTION_FEE, + + PSP_FIXED_FEE, + + PSP_GATEWAY_FEE, + + PSP_IDENTITY_VERIFICATION_FEE, + + PSP_INTERCHANGE_FEE, + + PSP_INVOICE_TAX_FEE, + + PSP_INVOICING_FEE, + + PSP_MARKUP_FEE, + + PSP_NETWORK_TOKEN_FEE, + + PSP_OPTIMIZATION_FEE, + + PSP_PAYIN_CLEARING, + + PSP_PAYIN_SETTLEMENT, + + PSP_PAYMENT_METHOD_FEE, + + PSP_PAYMENT_RECEIVABLE, + + PSP_PAYOUT_CONSOLIDATION, + + PSP_PAYOUT_DEPOSIT, + + PSP_PAYOUT_FEE, + + PSP_PAYOUT_RECEIVABLE, + + PSP_PAYOUT_RECEIVABLE_CLEARING, + + PSP_PAYOUT_SETTLEMENT, + + PSP_PAYOUT_SETTLEMENT_REVERSAL, + + PSP_POOL_CLEARING, + + PSP_POOL_DISPUTE_SETTLEMENT, + + PSP_POOL_SETTLEMENT, + + PSP_PROCESSING_FEE, + + PSP_RECEIVABLE_POOLED, + + PSP_RECIPIENT_WALLET_LOAD, + + PSP_REFUND_FEE, + + PSP_REFUND_PAYABLE, + + PSP_RESERVE_HOLD, + + PSP_RESERVE_RELEASE, + + PSP_RISK_FEE, + + PSP_SCHEME_FEE, + + PSP_SERVICE_FEE, + + PSP_TAX_FILING_FEE, + + PSP_TAX_SERVICE_FEE, + + PSP_TERMINAL_FEE, + + PSP_TRANSFER_SETTLEMENT, + + PSP_TRANSFER_SETTLEMENT_REVERSAL, + + PSP_TREASURY_FEE, + + PSP_VARIABLE_FEE, + + PSP_WITHHOLDING_TAX, + + RECIPIENT_WALLET_LOAD, + + REFERRAL_BONUS, + + REFUND_PAYABLE_CLEARING, + + REFUND_PAYABLE_REVERSAL, + + REFUND_SETTLEMENT, + + REFUND_SETTLEMENT_REVERSAL, + + REFUND_UNRECONCILED_CLEARING, + + REFUND_UNRECONCILED_REVERSAL, + + RESERVE, + + RESOLUTION_CENTER_REFUND, + + REVSHARE_PERCENTAGE_FEE, + + SALES_TAX_COLLECTED, + + SALES_TAX_COLLECTED_REVERSAL, + + SALES_TAX_FEE, + + SALES_TAX_REMITTANCE, + + SALES_TAX_REMITTANCE_REVERSAL, + + SALES_TAX_REMITTED, + + SETTLEMENT_ROUNDING_VARIANCE, + + SOFTWARE_RENTAL_REVSHARE, + + SOFTWARE_RENTAL_TRANSACTION, + + STRIPE_DOMESTIC_PROCESSING_FEE, + + STRIPE_INTERNATIONAL_PROCESSING_FEE, + + SWAP_FEE, + + TAX_FILING_FEE, + + THREE_DS_FIXED_FEE, + + TOPUP, + + TOPUP_FEE, + + TOPUP_REVERSAL, + + TREASURY_FEE, + + TREASURY_PAYIN, + + TREASURY_PAYIN_RECEIVABLE, + + WHOP_PROCESSING_FEE, + + WHOP_SWAP_FEE_RECEIVED, + + WITHDRAWAL, + + WITHDRAWAL_CLAWBACK, + + WITHDRAWAL_CLAWBACK_REVERSAL, + + WITHDRAWAL_FEE, + + WITHDRAWAL_FEE_REVERSAL, + + WITHDRAWAL_MARKUP_FEE, + + WITHDRAWAL_MARKUP_FEE_PAYOUT, + + WITHDRAWAL_MARKUP_FEE_PAYOUT_REVERSAL, + + WITHDRAWAL_MARKUP_FEE_REVERSAL, + + WITHDRAWAL_PAYABLE, + + WITHDRAWAL_PAYABLE_CLEARING, + + WITHDRAWAL_PAYABLE_CLEARING_REVERSAL, + + WITHDRAWAL_PAYABLE_REVERSAL, + + WITHDRAWAL_RECLASSIFICATION, + + WITHDRAWAL_REVERSAL, + + WITHDRAWAL_TOPUP_ADJUSTMENT, + + UNKNOWN + } + + public interface Visitor { + T visitAccountSettlement(); + + T visitAdBalanceFundingReceipt(); + + T visitAdBudgetRelease(); + + T visitAdCampaignBudget(); + + T visitAdFundingDisbursement(); + + T visitAdIncomeExpense(); + + T visitAdIncomeReceipt(); + + T visitAdNetworkCost(); + + T visitAdNetworkSettlement(); + + T visitAdPublisherPayout(); + + T visitAdPublisherPayoutReceived(); + + T visitAdSpendCharge(); + + T visitAdSpendMargin(); + + T visitAdsCardSpread(); + + T visitAffiliateFee(); + + T visitAggregatedFee(); + + T visitAirdrop(); + + T visitAirdropExpense(); + + T visitAirdropExpenseReversal(); + + T visitAirdropLinkCanceled(); + + T visitAirdropLinkClaimed(); + + T visitAirdropLinkCreated(); + + T visitAirdropLinkFunded(); + + T visitAirdropLinkRedeemed(); + + T visitAirdropLinkReturned(); + + T visitAirdropReversal(); + + T visitApplicationFee(); + + T visitApplicationFeePayable(); + + T visitApplicationFeePayout(); + + T visitAvailable(); + + T visitBadDebtExpense(); + + T visitBadDebtOffset(); + + T visitBalanceReservation(); + + T visitBalanceReservationHold(); + + T visitBalanceReservationRelease(); + + T visitBalanceReservationReversal(); + + T visitBillingPercentageFee(); + + T visitBuyerFee(); + + T visitCardInterchange(); + + T visitCardInterchangeReceivable(); + + T visitCardLoadDeposit(); + + T visitCardLoadTransfer(); + + T visitCardSpendAuthorization(); + + T visitCardSpendAuthorizationHold(); + + T visitCardSpendAuthorizationVoid(); + + T visitCardSpendAuthorizationVoidRelease(); + + T visitCardSpendCapture(); + + T visitCardSpendCaptureOffset(); + + T visitCardSpendRefund(); + + T visitCardSpendRefundOffset(); + + T visitCardUnloadDeposit(); + + T visitCardUnloadTransfer(); + + T visitClawbackFee(); + + T visitClawbackReceivable(); + + T visitClawbackReceivableReversal(); + + T visitClawbackReceivableSettlement(); + + T visitClawbackReceivableSettlementReversal(); + + T visitCompanyReferral(); + + T visitConnectedAccountClawback(); + + T visitConnectedAccountNegativeBalance(); + + T visitCrossBorderPercentageFee(); + + T visitCrypto(); + + T visitCurrencyConversionIncoming(); + + T visitCurrencyConversionOutgoing(); + + T visitDisputeAlertFee(); + + T visitDisputeHold(); + + T visitDisputeHoldAdjustment(); + + T visitDisputeHoldBlocked(); + + T visitDisputeManagementFee(); + + T visitDisputePayableClearing(); + + T visitDisputePayableReversal(); + + T visitDisputeRepresentmentFee(); + + T visitDisputeSettlement(); + + T visitDisputeSettlementReversal(); + + T visitDisputeUnreconciledClearing(); + + T visitDisputeUnreconciledReversal(); + + T visitExternalAccountConnectionFee(); + + T visitExternalCardLoadDeposit(); + + T visitExternalCardLoadOffset(); + + T visitFraudPreventionFee(); + + T visitFxGainLoss(); + + T visitFxMarkup(); + + T visitFxPercentageFee(); + + T visitFxSettlementGainLoss(); + + T visitHighRiskMerchantFee(); + + T visitIdentityVerificationFee(); + + T visitInstallmentDefault(); + + T visitInternalBalanceTransferIncoming(); + + T visitInternalBalanceTransferOutgoing(); + + T visitInternalWithdrawal(); + + T visitInternalWithdrawalComplete(); + + T visitInternalWithdrawalFee(); + + T visitInternalWithdrawalFeeReversal(); + + T visitInternalWithdrawalInTransit(); + + T visitInternalWithdrawalInTransitReversal(); + + T visitInternalWithdrawalMarkupFee(); + + T visitInternalWithdrawalMarkupFeePayout(); + + T visitInternalWithdrawalMarkupFeePayoutReversal(); + + T visitInternalWithdrawalMarkupFeeReversal(); + + T visitInternalWithdrawalPayable(); + + T visitInternalWithdrawalPayableReversal(); + + T visitInternalWithdrawalReversal(); + + T visitLegacyCryptoPayment(); + + T visitLegacyPayment(); + + T visitLegacyPaymentRefund(); + + T visitLicenseSale(); + + T visitLicenseSaleCommission(); + + T visitLicenseSaleRevenue(); + + T visitMarketplaceAffiliateFee(); + + T visitMiscPurchase(); + + T visitMiscRefund(); + + T visitMiscReversal(); + + T visitOnchainDeposit(); + + T visitOnchainDepositOffset(); + + T visitOnchainSwapOffset(); + + T visitOnchainSwapSource(); + + T visitOnchainSwapTarget(); + + T visitOnchainWalletTransferIncoming(); + + T visitOnchainWalletTransferOutgoing(); + + T visitOnchainWithdrawal(); + + T visitOnchainWithdrawalOffset(); + + T visitOrchestrationPercentageFee(); + + T visitPassthroughGmv(); + + T visitPassthroughGmvOffset(); + + T visitPaymentDispute(); + + T visitPaymentDisputeAdjustment(); + + T visitPaymentDisputeFee(); + + T visitPaymentDisputeReversal(); + + T visitPaymentGross(); + + T visitPaymentGrossReversal(); + + T visitPaymentProcessingFixedFee(); + + T visitPaymentProcessingPercentageFee(); + + T visitPaymentReceivableClearing(); + + T visitPaymentReceivableReversal(); + + T visitPaymentReceivableSettlement(); + + T visitPaymentReferral(); + + T visitPaymentReferralPayable(); + + T visitPaymentReferralRefund(); + + T visitPaymentReferralReversal(); + + T visitPaymentRefund(); + + T visitPaymentRefundFee(); + + T visitPaymentRefundReversal(); + + T visitPaymentRevshare(); + + T visitPaymentRevsharePayout(); + + T visitPaymentRevshareRefund(); + + T visitPaymentRevshareReversal(); + + T visitPaymentUnreconciledClearing(); + + T visitPaymentUnreconciledReversal(); + + T visitPayoutFee(); + + T visitPayoutReceivable(); + + T visitPayoutSubsidy(); + + T visitPayoutUnreconciledClearing(); + + T visitPending(); + + T visitPlatformAffiliatePayment(); + + T visitPlatformAffiliatePaymentReversal(); + + T visitPlatformBalancePayment(); + + T visitPlatformBalancePaymentRefund(); + + T visitPlatformBalanceTransferFee(); + + T visitPlatformBalanceTransferIncoming(); + + T visitPlatformBalanceTransferOutgoing(); + + T visitPlatformCoveredDispute(); + + T visitPlatformEarning(); + + T visitPlatformEarningSettlement(); + + T visitPlatformEarningUnreconciledClearing(); + + T visitPromoReversal(); + + T visitPspAccountUpdaterFee(); + + T visitPspAdjustedProcessingFee(); + + T visitPspAuthenticationFee(); + + T visitPspBankPullClearing(); + + T visitPspBankPullSettlement(); + + T visitPspBillingFee(); + + T visitPspClawbackFee(); + + T visitPspClawbackSettlement(); + + T visitPspClawbackSettlementReversal(); + + T visitPspCollectionSettlement(); + + T visitPspCommissionFee(); + + T visitPspConnectFee(); + + T visitPspCorrection(); + + T visitPspCurrencyConversionIncoming(); + + T visitPspCurrencyConversionOutgoing(); + + T visitPspCurrencyConversionReceivable(); + + T visitPspCurrencyConversionReceivableClearing(); + + T visitPspDisputeAlertFee(); + + T visitPspDisputeFee(); + + T visitPspDisputeManagementFee(); + + T visitPspDisputePayable(); + + T visitPspExternalAccountConnectionFee(); + + T visitPspFixedFee(); + + T visitPspGatewayFee(); + + T visitPspIdentityVerificationFee(); + + T visitPspInterchangeFee(); + + T visitPspInvoiceTaxFee(); + + T visitPspInvoicingFee(); + + T visitPspMarkupFee(); + + T visitPspNetworkTokenFee(); + + T visitPspOptimizationFee(); + + T visitPspPayinClearing(); + + T visitPspPayinSettlement(); + + T visitPspPaymentMethodFee(); + + T visitPspPaymentReceivable(); + + T visitPspPayoutConsolidation(); + + T visitPspPayoutDeposit(); + + T visitPspPayoutFee(); + + T visitPspPayoutReceivable(); + + T visitPspPayoutReceivableClearing(); + + T visitPspPayoutSettlement(); + + T visitPspPayoutSettlementReversal(); + + T visitPspPoolClearing(); + + T visitPspPoolDisputeSettlement(); + + T visitPspPoolSettlement(); + + T visitPspProcessingFee(); + + T visitPspReceivablePooled(); + + T visitPspRecipientWalletLoad(); + + T visitPspRefundFee(); + + T visitPspRefundPayable(); + + T visitPspReserveHold(); + + T visitPspReserveRelease(); + + T visitPspRiskFee(); + + T visitPspSchemeFee(); + + T visitPspServiceFee(); + + T visitPspTaxFilingFee(); + + T visitPspTaxServiceFee(); + + T visitPspTerminalFee(); + + T visitPspTransferSettlement(); + + T visitPspTransferSettlementReversal(); + + T visitPspTreasuryFee(); + + T visitPspVariableFee(); + + T visitPspWithholdingTax(); + + T visitRecipientWalletLoad(); + + T visitReferralBonus(); + + T visitRefundPayableClearing(); + + T visitRefundPayableReversal(); + + T visitRefundSettlement(); + + T visitRefundSettlementReversal(); + + T visitRefundUnreconciledClearing(); + + T visitRefundUnreconciledReversal(); + + T visitReserve(); + + T visitResolutionCenterRefund(); + + T visitRevsharePercentageFee(); + + T visitSalesTaxCollected(); + + T visitSalesTaxCollectedReversal(); + + T visitSalesTaxFee(); + + T visitSalesTaxRemittance(); + + T visitSalesTaxRemittanceReversal(); + + T visitSalesTaxRemitted(); + + T visitSettlementRoundingVariance(); + + T visitSoftwareRentalRevshare(); + + T visitSoftwareRentalTransaction(); + + T visitStripeDomesticProcessingFee(); + + T visitStripeInternationalProcessingFee(); + + T visitSwapFee(); + + T visitTaxFilingFee(); + + T visitThreeDsFixedFee(); + + T visitTopup(); + + T visitTopupFee(); + + T visitTopupReversal(); + + T visitTreasuryFee(); + + T visitTreasuryPayin(); + + T visitTreasuryPayinReceivable(); + + T visitWhopProcessingFee(); + + T visitWhopSwapFeeReceived(); + + T visitWithdrawal(); + + T visitWithdrawalClawback(); + + T visitWithdrawalClawbackReversal(); + + T visitWithdrawalFee(); + + T visitWithdrawalFeeReversal(); + + T visitWithdrawalMarkupFee(); + + T visitWithdrawalMarkupFeePayout(); + + T visitWithdrawalMarkupFeePayoutReversal(); + + T visitWithdrawalMarkupFeeReversal(); + + T visitWithdrawalPayable(); + + T visitWithdrawalPayableClearing(); + + T visitWithdrawalPayableClearingReversal(); + + T visitWithdrawalPayableReversal(); + + T visitWithdrawalReclassification(); + + T visitWithdrawalReversal(); + + T visitWithdrawalTopupAdjustment(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponseRowsItemProfitAndLossSection.java b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponseRowsItemProfitAndLossSection.java new file mode 100644 index 00000000..5f121729 --- /dev/null +++ b/src/main/java/com/whop/api/resources/ledgers/types/GetFinancialReportResponseRowsItemProfitAndLossSection.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.ledgers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class GetFinancialReportResponseRowsItemProfitAndLossSection { + public static final GetFinancialReportResponseRowsItemProfitAndLossSection REVENUE = + new GetFinancialReportResponseRowsItemProfitAndLossSection(Value.REVENUE, "revenue"); + + public static final GetFinancialReportResponseRowsItemProfitAndLossSection COST_OF_REVENUE = + new GetFinancialReportResponseRowsItemProfitAndLossSection(Value.COST_OF_REVENUE, "cost_of_revenue"); + + private final Value value; + + private final String string; + + GetFinancialReportResponseRowsItemProfitAndLossSection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof GetFinancialReportResponseRowsItemProfitAndLossSection + && this.string.equals(((GetFinancialReportResponseRowsItemProfitAndLossSection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REVENUE: + return visitor.visitRevenue(); + case COST_OF_REVENUE: + return visitor.visitCostOfRevenue(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static GetFinancialReportResponseRowsItemProfitAndLossSection valueOf(String value) { + switch (value) { + case "revenue": + return REVENUE; + case "cost_of_revenue": + return COST_OF_REVENUE; + default: + return new GetFinancialReportResponseRowsItemProfitAndLossSection(Value.UNKNOWN, value); + } + } + + public enum Value { + REVENUE, + + COST_OF_REVENUE, + + UNKNOWN + } + + public interface Visitor { + T visitRevenue(); + + T visitCostOfRevenue(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/media/AsyncMediaClient.java b/src/main/java/com/whop/api/resources/media/AsyncMediaClient.java new file mode 100644 index 00000000..4f6f2cb7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/media/AsyncMediaClient.java @@ -0,0 +1,72 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.media; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.media.requests.GenerateMediaRequest; +import com.whop.api.resources.media.requests.RetrieveMediaRequest; +import com.whop.api.types.MediaAsset; +import java.util.concurrent.CompletableFuture; + +public class AsyncMediaClient { + protected final ClientOptions clientOptions; + + private final AsyncRawMediaClient rawClient; + + public AsyncMediaClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawMediaClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawMediaClient withRawResponse() { + return this.rawClient; + } + + /** + * Starts an AI media generation job billed from the account's balance. Generation is asynchronous — poll GET /media/{id} until the asset is ready, then use file.id anywhere attachments are accepted. + */ + public CompletableFuture generate(GenerateMediaRequest request) { + return this.rawClient.generate(request).thenApply(response -> response.body()); + } + + /** + * Starts an AI media generation job billed from the account's balance. Generation is asynchronous — poll GET /media/{id} until the asset is ready, then use file.id anywhere attachments are accepted. + */ + public CompletableFuture generate(GenerateMediaRequest request, RequestOptions requestOptions) { + return this.rawClient.generate(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public CompletableFuture retrieve(String id, RetrieveMediaRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public CompletableFuture retrieve( + String id, RetrieveMediaRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/media/AsyncRawMediaClient.java b/src/main/java/com/whop/api/resources/media/AsyncRawMediaClient.java new file mode 100644 index 00000000..f93bce83 --- /dev/null +++ b/src/main/java/com/whop/api/resources/media/AsyncRawMediaClient.java @@ -0,0 +1,224 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.media; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.PaymentRequiredError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.media.requests.GenerateMediaRequest; +import com.whop.api.resources.media.requests.RetrieveMediaRequest; +import com.whop.api.types.MediaAsset; +import com.whop.api.types.PaymentRequiredErrorBody; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawMediaClient { + protected final ClientOptions clientOptions; + + public AsyncRawMediaClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Starts an AI media generation job billed from the account's balance. Generation is asynchronous — poll GET /media/{id} until the asset is ready, then use file.id anywhere attachments are accepted. + */ + public CompletableFuture> generate(GenerateMediaRequest request) { + return generate(request, null); + } + + /** + * Starts an AI media generation job billed from the account's balance. Generation is asynchronous — poll GET /media/{id} until the asset is ready, then use file.id anywhere attachments are accepted. + */ + public CompletableFuture> generate( + GenerateMediaRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("media/generate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MediaAsset.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 402: + future.completeExceptionally(new PaymentRequiredError( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, PaymentRequiredErrorBody.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveMediaRequest.builder().build()); + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveMediaRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public CompletableFuture> retrieve(String id, RetrieveMediaRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public CompletableFuture> retrieve( + String id, RetrieveMediaRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("media") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MediaAsset.class), response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/media/MediaClient.java b/src/main/java/com/whop/api/resources/media/MediaClient.java new file mode 100644 index 00000000..bb1238d2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/media/MediaClient.java @@ -0,0 +1,70 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.media; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.media.requests.GenerateMediaRequest; +import com.whop.api.resources.media.requests.RetrieveMediaRequest; +import com.whop.api.types.MediaAsset; + +public class MediaClient { + protected final ClientOptions clientOptions; + + private final RawMediaClient rawClient; + + public MediaClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawMediaClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawMediaClient withRawResponse() { + return this.rawClient; + } + + /** + * Starts an AI media generation job billed from the account's balance. Generation is asynchronous — poll GET /media/{id} until the asset is ready, then use file.id anywhere attachments are accepted. + */ + public MediaAsset generate(GenerateMediaRequest request) { + return this.rawClient.generate(request).body(); + } + + /** + * Starts an AI media generation job billed from the account's balance. Generation is asynchronous — poll GET /media/{id} until the asset is ready, then use file.id anywhere attachments are accepted. + */ + public MediaAsset generate(GenerateMediaRequest request, RequestOptions requestOptions) { + return this.rawClient.generate(request, requestOptions).body(); + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public MediaAsset retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public MediaAsset retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public MediaAsset retrieve(String id, RetrieveMediaRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public MediaAsset retrieve(String id, RetrieveMediaRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/media/RawMediaClient.java b/src/main/java/com/whop/api/resources/media/RawMediaClient.java new file mode 100644 index 00000000..f690155b --- /dev/null +++ b/src/main/java/com/whop/api/resources/media/RawMediaClient.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.media; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.PaymentRequiredError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.media.requests.GenerateMediaRequest; +import com.whop.api.resources.media.requests.RetrieveMediaRequest; +import com.whop.api.types.MediaAsset; +import com.whop.api.types.PaymentRequiredErrorBody; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawMediaClient { + protected final ClientOptions clientOptions; + + public RawMediaClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Starts an AI media generation job billed from the account's balance. Generation is asynchronous — poll GET /media/{id} until the asset is ready, then use file.id anywhere attachments are accepted. + */ + public WhopApiHttpResponse generate(GenerateMediaRequest request) { + return generate(request, null); + } + + /** + * Starts an AI media generation job billed from the account's balance. Generation is asynchronous — poll GET /media/{id} until the asset is ready, then use file.id anywhere attachments are accepted. + */ + public WhopApiHttpResponse generate(GenerateMediaRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("media/generate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MediaAsset.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 402: + throw new PaymentRequiredError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaymentRequiredErrorBody.class), + response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveMediaRequest.builder().build()); + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveMediaRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveMediaRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a media asset by ID. Poll this while the asset is processing. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveMediaRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("media") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MediaAsset.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/media/requests/GenerateMediaRequest.java b/src/main/java/com/whop/api/resources/media/requests/GenerateMediaRequest.java new file mode 100644 index 00000000..07192849 --- /dev/null +++ b/src/main/java/com/whop/api/resources/media/requests/GenerateMediaRequest.java @@ -0,0 +1,345 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.media.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.media.types.GenerateMediaRequestResolution; +import com.whop.api.resources.media.types.GenerateMediaRequestType; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GenerateMediaRequest.Builder.class) +public final class GenerateMediaRequest { + private final Optional accountId; + + private final Optional durationSeconds; + + private final String prompt; + + private final Optional> referenceMedia; + + private final Optional resolution; + + private final GenerateMediaRequestType type; + + private final Map additionalProperties; + + private GenerateMediaRequest( + Optional accountId, + Optional durationSeconds, + String prompt, + Optional> referenceMedia, + Optional resolution, + GenerateMediaRequestType type, + Map additionalProperties) { + this.accountId = accountId; + this.durationSeconds = durationSeconds; + this.prompt = prompt; + this.referenceMedia = referenceMedia; + this.resolution = resolution; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. Defaults to the account the API key belongs to. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Video length in seconds. Video only; defaults to 5. + */ + @JsonProperty("duration_seconds") + public Optional getDurationSeconds() { + return durationSeconds; + } + + /** + * @return What to generate. Up to 2,000 characters. + */ + @JsonProperty("prompt") + public String getPrompt() { + return prompt; + } + + /** + * @return Optional reference image file IDs (file_ prefixed), up to 4. For video, a single reference seeds the opening frame; multiple references guide subject and style instead. + */ + @JsonProperty("reference_media") + public Optional> getReferenceMedia() { + return referenceMedia; + } + + /** + * @return Video resolution. Video only; defaults to 1080p. 1080p is not supported by Seedance 2.0 Fast or Mini; 4k is only supported by Seedance 2.0. + */ + @JsonProperty("resolution") + public Optional getResolution() { + return resolution; + } + + /** + * @return The kind of media to generate. + */ + @JsonProperty("type") + public GenerateMediaRequestType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GenerateMediaRequest && equalTo((GenerateMediaRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GenerateMediaRequest other) { + return accountId.equals(other.accountId) + && durationSeconds.equals(other.durationSeconds) + && prompt.equals(other.prompt) + && referenceMedia.equals(other.referenceMedia) + && resolution.equals(other.resolution) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, this.durationSeconds, this.prompt, this.referenceMedia, this.resolution, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PromptStage builder() { + return new Builder(); + } + + public interface PromptStage { + /** + *

What to generate. Up to 2,000 characters.

+ */ + TypeStage prompt(@NotNull String prompt); + + Builder from(GenerateMediaRequest other); + } + + public interface TypeStage { + /** + *

The kind of media to generate.

+ */ + _FinalStage type(@NotNull GenerateMediaRequestType type); + } + + public interface _FinalStage { + GenerateMediaRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account ID, prefixed biz_. Defaults to the account the API key belongs to.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + /** + *

Video length in seconds. Video only; defaults to 5.

+ */ + _FinalStage durationSeconds(Optional durationSeconds); + + _FinalStage durationSeconds(Integer durationSeconds); + + /** + *

Optional reference image file IDs (file_ prefixed), up to 4. For video, a single reference seeds the opening frame; multiple references guide subject and style instead.

+ */ + _FinalStage referenceMedia(Optional> referenceMedia); + + _FinalStage referenceMedia(List referenceMedia); + + /** + *

Video resolution. Video only; defaults to 1080p. 1080p is not supported by Seedance 2.0 Fast or Mini; 4k is only supported by Seedance 2.0.

+ */ + _FinalStage resolution(Optional resolution); + + _FinalStage resolution(GenerateMediaRequestResolution resolution); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PromptStage, TypeStage, _FinalStage { + private String prompt; + + private GenerateMediaRequestType type; + + private Optional resolution = Optional.empty(); + + private Optional> referenceMedia = Optional.empty(); + + private Optional durationSeconds = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GenerateMediaRequest other) { + accountId(other.getAccountId()); + durationSeconds(other.getDurationSeconds()); + prompt(other.getPrompt()); + referenceMedia(other.getReferenceMedia()); + resolution(other.getResolution()); + type(other.getType()); + return this; + } + + /** + *

What to generate. Up to 2,000 characters.

+ *

What to generate. Up to 2,000 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("prompt") + public TypeStage prompt(@NotNull String prompt) { + this.prompt = Objects.requireNonNull(prompt, "prompt must not be null"); + return this; + } + + /** + *

The kind of media to generate.

+ *

The kind of media to generate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull GenerateMediaRequestType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

Video resolution. Video only; defaults to 1080p. 1080p is not supported by Seedance 2.0 Fast or Mini; 4k is only supported by Seedance 2.0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolution(GenerateMediaRequestResolution resolution) { + this.resolution = Optional.ofNullable(resolution); + return this; + } + + /** + *

Video resolution. Video only; defaults to 1080p. 1080p is not supported by Seedance 2.0 Fast or Mini; 4k is only supported by Seedance 2.0.

+ */ + @java.lang.Override + @JsonSetter(value = "resolution", nulls = Nulls.SKIP) + public _FinalStage resolution(Optional resolution) { + this.resolution = resolution; + return this; + } + + /** + *

Optional reference image file IDs (file_ prefixed), up to 4. For video, a single reference seeds the opening frame; multiple references guide subject and style instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referenceMedia(List referenceMedia) { + this.referenceMedia = Optional.ofNullable(referenceMedia); + return this; + } + + /** + *

Optional reference image file IDs (file_ prefixed), up to 4. For video, a single reference seeds the opening frame; multiple references guide subject and style instead.

+ */ + @java.lang.Override + @JsonSetter(value = "reference_media", nulls = Nulls.SKIP) + public _FinalStage referenceMedia(Optional> referenceMedia) { + this.referenceMedia = referenceMedia; + return this; + } + + /** + *

Video length in seconds. Video only; defaults to 5.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage durationSeconds(Integer durationSeconds) { + this.durationSeconds = Optional.ofNullable(durationSeconds); + return this; + } + + /** + *

Video length in seconds. Video only; defaults to 5.

+ */ + @java.lang.Override + @JsonSetter(value = "duration_seconds", nulls = Nulls.SKIP) + public _FinalStage durationSeconds(Optional durationSeconds) { + this.durationSeconds = durationSeconds; + return this; + } + + /** + *

Account ID, prefixed biz_. Defaults to the account the API key belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Account ID, prefixed biz_. Defaults to the account the API key belongs to.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public GenerateMediaRequest build() { + return new GenerateMediaRequest( + accountId, durationSeconds, prompt, referenceMedia, resolution, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/media/requests/RetrieveMediaRequest.java b/src/main/java/com/whop/api/resources/media/requests/RetrieveMediaRequest.java new file mode 100644 index 00000000..f6deeccf --- /dev/null +++ b/src/main/java/com/whop/api/resources/media/requests/RetrieveMediaRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.media.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveMediaRequest.Builder.class) +public final class RetrieveMediaRequest { + private final Map additionalProperties; + + private RetrieveMediaRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveMediaRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveMediaRequest other) { + return this; + } + + public RetrieveMediaRequest build() { + return new RetrieveMediaRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/media/types/GenerateMediaRequestResolution.java b/src/main/java/com/whop/api/resources/media/types/GenerateMediaRequestResolution.java new file mode 100644 index 00000000..51ad4f63 --- /dev/null +++ b/src/main/java/com/whop/api/resources/media/types/GenerateMediaRequestResolution.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.media.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class GenerateMediaRequestResolution { + public static final GenerateMediaRequestResolution ONE_THOUSAND_EIGHTY_P = + new GenerateMediaRequestResolution(Value.ONE_THOUSAND_EIGHTY_P, "1080p"); + + public static final GenerateMediaRequestResolution FOUR_K = new GenerateMediaRequestResolution(Value.FOUR_K, "4k"); + + public static final GenerateMediaRequestResolution FOUR_HUNDRED_EIGHTY_P = + new GenerateMediaRequestResolution(Value.FOUR_HUNDRED_EIGHTY_P, "480p"); + + public static final GenerateMediaRequestResolution SEVEN_HUNDRED_TWENTY_P = + new GenerateMediaRequestResolution(Value.SEVEN_HUNDRED_TWENTY_P, "720p"); + + private final Value value; + + private final String string; + + GenerateMediaRequestResolution(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof GenerateMediaRequestResolution + && this.string.equals(((GenerateMediaRequestResolution) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ONE_THOUSAND_EIGHTY_P: + return visitor.visitOneThousandEightyP(); + case FOUR_K: + return visitor.visitFourK(); + case FOUR_HUNDRED_EIGHTY_P: + return visitor.visitFourHundredEightyP(); + case SEVEN_HUNDRED_TWENTY_P: + return visitor.visitSevenHundredTwentyP(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static GenerateMediaRequestResolution valueOf(String value) { + switch (value) { + case "1080p": + return ONE_THOUSAND_EIGHTY_P; + case "4k": + return FOUR_K; + case "480p": + return FOUR_HUNDRED_EIGHTY_P; + case "720p": + return SEVEN_HUNDRED_TWENTY_P; + default: + return new GenerateMediaRequestResolution(Value.UNKNOWN, value); + } + } + + public enum Value { + FOUR_HUNDRED_EIGHTY_P, + + SEVEN_HUNDRED_TWENTY_P, + + ONE_THOUSAND_EIGHTY_P, + + FOUR_K, + + UNKNOWN + } + + public interface Visitor { + T visitFourHundredEightyP(); + + T visitSevenHundredTwentyP(); + + T visitOneThousandEightyP(); + + T visitFourK(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/media/types/GenerateMediaRequestType.java b/src/main/java/com/whop/api/resources/media/types/GenerateMediaRequestType.java new file mode 100644 index 00000000..a3bb231a --- /dev/null +++ b/src/main/java/com/whop/api/resources/media/types/GenerateMediaRequestType.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.media.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class GenerateMediaRequestType { + public static final GenerateMediaRequestType IMAGE = new GenerateMediaRequestType(Value.IMAGE, "image"); + + public static final GenerateMediaRequestType VIDEO = new GenerateMediaRequestType(Value.VIDEO, "video"); + + private final Value value; + + private final String string; + + GenerateMediaRequestType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof GenerateMediaRequestType + && this.string.equals(((GenerateMediaRequestType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case IMAGE: + return visitor.visitImage(); + case VIDEO: + return visitor.visitVideo(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static GenerateMediaRequestType valueOf(String value) { + switch (value) { + case "image": + return IMAGE; + case "video": + return VIDEO; + default: + return new GenerateMediaRequestType(Value.UNKNOWN, value); + } + } + + public enum Value { + VIDEO, + + IMAGE, + + UNKNOWN + } + + public interface Visitor { + T visitVideo(); + + T visitImage(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/members/AsyncMembersClient.java b/src/main/java/com/whop/api/resources/members/AsyncMembersClient.java new file mode 100644 index 00000000..888105ce --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/AsyncMembersClient.java @@ -0,0 +1,98 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.members.logs.AsyncLogsClient; +import com.whop.api.resources.members.requests.ListMembersRequest; +import com.whop.api.resources.members.requests.RetrieveMembersRequest; +import com.whop.api.types.Member; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class AsyncMembersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawMembersClient rawClient; + + protected final Supplier logsClient; + + public AsyncMembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawMembersClient(clientOptions); + this.logsClient = Suppliers.memoize(() -> new AsyncLogsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawMembersClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public CompletableFuture> list(ListMembersRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public CompletableFuture> list( + ListMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public CompletableFuture retrieve(String id, RetrieveMembersRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public CompletableFuture retrieve( + String id, RetrieveMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + public AsyncLogsClient logs() { + return this.logsClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/members/AsyncRawMembersClient.java b/src/main/java/com/whop/api/resources/members/AsyncRawMembersClient.java new file mode 100644 index 00000000..f0a4d20f --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/AsyncRawMembersClient.java @@ -0,0 +1,292 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.members.requests.ListMembersRequest; +import com.whop.api.resources.members.requests.RetrieveMembersRequest; +import com.whop.api.resources.members.types.ListMembersResponse; +import com.whop.api.types.Member; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawMembersClient { + protected final ClientOptions clientOptions; + + public AsyncRawMembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public CompletableFuture>> list() { + return list(ListMembersRequest.builder().build()); + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(ListMembersRequest.builder().build(), requestOptions); + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public CompletableFuture>> list(ListMembersRequest request) { + return list(request, null); + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public CompletableFuture>> list( + ListMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("members"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getAccessLevel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "access_level", request.getAccessLevel().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListMembersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListMembersResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListMembersRequest nextRequest = ListMembersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable(startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveMembersRequest.builder().build()); + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveMembersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public CompletableFuture> retrieve(String id, RetrieveMembersRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public CompletableFuture> retrieve( + String id, RetrieveMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("members") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Member.class), response)); + return; + } + try { + switch (response.code()) { + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/members/MembersClient.java b/src/main/java/com/whop/api/resources/members/MembersClient.java new file mode 100644 index 00000000..931b2916 --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/MembersClient.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.members.logs.LogsClient; +import com.whop.api.resources.members.requests.ListMembersRequest; +import com.whop.api.resources.members.requests.RetrieveMembersRequest; +import com.whop.api.types.Member; +import java.util.function.Supplier; + +public class MembersClient { + protected final ClientOptions clientOptions; + + private final RawMembersClient rawClient; + + protected final Supplier logsClient; + + public MembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawMembersClient(clientOptions); + this.logsClient = Suppliers.memoize(() -> new LogsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawMembersClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public SyncPagingIterable list(ListMembersRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public SyncPagingIterable list(ListMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public Member retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public Member retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public Member retrieve(String id, RetrieveMembersRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public Member retrieve(String id, RetrieveMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + public LogsClient logs() { + return this.logsClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/members/RawMembersClient.java b/src/main/java/com/whop/api/resources/members/RawMembersClient.java new file mode 100644 index 00000000..d0c42b75 --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/RawMembersClient.java @@ -0,0 +1,244 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.members.requests.ListMembersRequest; +import com.whop.api.resources.members.requests.RetrieveMembersRequest; +import com.whop.api.resources.members.types.ListMembersResponse; +import com.whop.api.types.Member; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawMembersClient { + protected final ClientOptions clientOptions; + + public RawMembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public WhopApiHttpResponse> list() { + return list(ListMembersRequest.builder().build()); + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListMembersRequest.builder().build(), requestOptions); + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public WhopApiHttpResponse> list(ListMembersRequest request) { + return list(request, null); + } + + /** + * Lists the members of an account. A member is one buyer's relationship with the account, regardless of how many memberships they hold. + */ + public WhopApiHttpResponse> list( + ListMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("members"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getAccessLevel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "access_level", request.getAccessLevel().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListMembersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListMembersResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListMembersRequest nextRequest = ListMembersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveMembersRequest.builder().build()); + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveMembersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveMembersRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a member by ID. Accessible to the account and to the member's own user. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("members") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Member.class), response); + } + try { + switch (response.code()) { + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/members/logs/AsyncLogsClient.java b/src/main/java/com/whop/api/resources/members/logs/AsyncLogsClient.java new file mode 100644 index 00000000..4cba286f --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/logs/AsyncLogsClient.java @@ -0,0 +1,59 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.logs; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.members.logs.requests.ListLogsRequest; +import com.whop.api.resources.members.logs.types.ListLogsResponseDataItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncLogsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawLogsClient rawClient; + + public AsyncLogsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawLogsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawLogsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public CompletableFuture> list(String id) { + return this.rawClient.list(id).thenApply(response -> response.body()); + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public CompletableFuture> list( + String id, RequestOptions requestOptions) { + return this.rawClient.list(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public CompletableFuture> list(String id, ListLogsRequest request) { + return this.rawClient.list(id, request).thenApply(response -> response.body()); + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public CompletableFuture> list( + String id, ListLogsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/members/logs/AsyncRawLogsClient.java b/src/main/java/com/whop/api/resources/members/logs/AsyncRawLogsClient.java new file mode 100644 index 00000000..f4b53e9f --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/logs/AsyncRawLogsClient.java @@ -0,0 +1,169 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.logs; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.resources.members.logs.requests.ListLogsRequest; +import com.whop.api.resources.members.logs.types.ListLogsResponse; +import com.whop.api.resources.members.logs.types.ListLogsResponseDataItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawLogsClient { + protected final ClientOptions clientOptions; + + public AsyncRawLogsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public CompletableFuture>> list(String id) { + return list(id, ListLogsRequest.builder().build()); + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public CompletableFuture>> list( + String id, RequestOptions requestOptions) { + return list(id, ListLogsRequest.builder().build(), requestOptions); + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public CompletableFuture>> list( + String id, ListLogsRequest request) { + return list(id, request, null); + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public CompletableFuture>> list( + String id, ListLogsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("members") + .addPathSegment(id) + .addPathSegments("logs"); + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListLogsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListLogsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListLogsRequest nextRequest = ListLogsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(id, nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/members/logs/LogsClient.java b/src/main/java/com/whop/api/resources/members/logs/LogsClient.java new file mode 100644 index 00000000..5a686e75 --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/logs/LogsClient.java @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.logs; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.members.logs.requests.ListLogsRequest; +import com.whop.api.resources.members.logs.types.ListLogsResponseDataItem; + +public class LogsClient { + protected final ClientOptions clientOptions; + + private final RawLogsClient rawClient; + + public LogsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawLogsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawLogsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public SyncPagingIterable list(String id) { + return this.rawClient.list(id).body(); + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public SyncPagingIterable list(String id, RequestOptions requestOptions) { + return this.rawClient.list(id, requestOptions).body(); + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public SyncPagingIterable list(String id, ListLogsRequest request) { + return this.rawClient.list(id, request).body(); + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public SyncPagingIterable list( + String id, ListLogsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/members/logs/RawLogsClient.java b/src/main/java/com/whop/api/resources/members/logs/RawLogsClient.java new file mode 100644 index 00000000..2045cedb --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/logs/RawLogsClient.java @@ -0,0 +1,138 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.logs; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.resources.members.logs.requests.ListLogsRequest; +import com.whop.api.resources.members.logs.types.ListLogsResponse; +import com.whop.api.resources.members.logs.types.ListLogsResponseDataItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawLogsClient { + protected final ClientOptions clientOptions; + + public RawLogsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public WhopApiHttpResponse> list(String id) { + return list(id, ListLogsRequest.builder().build()); + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public WhopApiHttpResponse> list( + String id, RequestOptions requestOptions) { + return list(id, ListLogsRequest.builder().build(), requestOptions); + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public WhopApiHttpResponse> list(String id, ListLogsRequest request) { + return list(id, request, null); + } + + /** + * Lists activity for a member and all of their non-drafted memberships, most recent first. + */ + public WhopApiHttpResponse> list( + String id, ListLogsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("members") + .addPathSegment(id) + .addPathSegments("logs"); + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListLogsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListLogsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListLogsRequest nextRequest = ListLogsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list( + id, nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/members/logs/requests/ListLogsRequest.java b/src/main/java/com/whop/api/resources/members/logs/requests/ListLogsRequest.java new file mode 100644 index 00000000..0431f7fd --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/logs/requests/ListLogsRequest.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.logs.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListLogsRequest.Builder.class) +public final class ListLogsRequest { + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListLogsRequest( + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Number of log entries to return from the start of the window. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to paginate forwards from. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return Number of log entries to return from the end of the window. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to paginate backwards from. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListLogsRequest && equalTo((ListLogsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListLogsRequest other) { + return first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.first, this.after, this.last, this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListLogsRequest other) { + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

Number of log entries to return from the start of the window.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to paginate forwards from.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Number of log entries to return from the end of the window.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to paginate backwards from.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListLogsRequest build() { + return new ListLogsRequest(first, after, last, before, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/members/logs/types/ListLogsResponse.java b/src/main/java/com/whop/api/resources/members/logs/types/ListLogsResponse.java new file mode 100644 index 00000000..483946d9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/logs/types/ListLogsResponse.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.logs.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListLogsResponse.Builder.class) +public final class ListLogsResponse { + private final List data; + + private final ListLogsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListLogsResponse( + List data, + ListLogsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListLogsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListLogsResponse && equalTo((ListLogsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListLogsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListLogsResponsePageInfo pageInfo); + + Builder from(ListLogsResponse other); + } + + public interface _FinalStage { + ListLogsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ListLogsResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListLogsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListLogsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListLogsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ListLogsResponseDataItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListLogsResponse build() { + return new ListLogsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/members/logs/types/ListLogsResponseDataItem.java b/src/main/java/com/whop/api/resources/members/logs/types/ListLogsResponseDataItem.java new file mode 100644 index 00000000..9f209906 --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/logs/types/ListLogsResponseDataItem.java @@ -0,0 +1,230 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.logs.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListLogsResponseDataItem.Builder.class) +public final class ListLogsResponseDataItem { + private final Optional action; + + private final Optional actor; + + private final OffsetDateTime createdAt; + + private final Map additionalProperties; + + private ListLogsResponseDataItem( + Optional action, + Optional actor, + OffsetDateTime createdAt, + Map additionalProperties) { + this.action = action; + this.actor = actor; + this.createdAt = createdAt; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getAction() { + if (action == null) { + return Optional.empty(); + } + return action; + } + + @JsonIgnore + public Optional getActor() { + if (actor == null) { + return Optional.empty(); + } + return actor; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("action") + private Optional _getAction() { + return action; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("actor") + private Optional _getActor() { + return actor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListLogsResponseDataItem && equalTo((ListLogsResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListLogsResponseDataItem other) { + return action.equals(other.action) && actor.equals(other.actor) && createdAt.equals(other.createdAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.action, this.actor, this.createdAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + _FinalStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(ListLogsResponseDataItem other); + } + + public interface _FinalStage { + ListLogsResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage action(Optional action); + + _FinalStage action(String action); + + _FinalStage action(Nullable action); + + _FinalStage actor(Optional actor); + + _FinalStage actor(ListLogsResponseDataItemActor actor); + + _FinalStage actor(Nullable actor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, _FinalStage { + private OffsetDateTime createdAt; + + private Optional actor = Optional.empty(); + + private Optional action = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListLogsResponseDataItem other) { + action(other.getAction()); + actor(other.getActor()); + createdAt(other.getCreatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public _FinalStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage actor(Nullable actor) { + if (actor.isNull()) { + this.actor = null; + } else if (actor.isEmpty()) { + this.actor = Optional.empty(); + } else { + this.actor = Optional.of(actor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage actor(ListLogsResponseDataItemActor actor) { + this.actor = Optional.ofNullable(actor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "actor", nulls = Nulls.SKIP) + public _FinalStage actor(Optional actor) { + this.actor = actor; + return this; + } + + @java.lang.Override + public _FinalStage action(Nullable action) { + if (action.isNull()) { + this.action = null; + } else if (action.isEmpty()) { + this.action = Optional.empty(); + } else { + this.action = Optional.of(action.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage action(String action) { + this.action = Optional.ofNullable(action); + return this; + } + + @java.lang.Override + @JsonSetter(value = "action", nulls = Nulls.SKIP) + public _FinalStage action(Optional action) { + this.action = action; + return this; + } + + @java.lang.Override + public ListLogsResponseDataItem build() { + return new ListLogsResponseDataItem(action, actor, createdAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/members/logs/types/ListLogsResponseDataItemActor.java b/src/main/java/com/whop/api/resources/members/logs/types/ListLogsResponseDataItemActor.java new file mode 100644 index 00000000..229d2fd0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/logs/types/ListLogsResponseDataItemActor.java @@ -0,0 +1,226 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.logs.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListLogsResponseDataItemActor.Builder.class) +public final class ListLogsResponseDataItemActor { + private final String id; + + private final Optional name; + + private final Optional username; + + private final Map additionalProperties; + + private ListLogsResponseDataItemActor( + String id, Optional name, Optional username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getUsername() { + if (username == null) { + return Optional.empty(); + } + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("username") + private Optional _getUsername() { + return username; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListLogsResponseDataItemActor && equalTo((ListLogsResponseDataItemActor) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListLogsResponseDataItemActor other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(ListLogsResponseDataItemActor other); + } + + public interface _FinalStage { + ListLogsResponseDataItemActor build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage username(Optional username); + + _FinalStage username(String username); + + _FinalStage username(Nullable username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional username = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListLogsResponseDataItemActor other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage username(Nullable username) { + if (username.isNull()) { + this.username = null; + } else if (username.isEmpty()) { + this.username = Optional.empty(); + } else { + this.username = Optional.of(username.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ListLogsResponseDataItemActor build() { + return new ListLogsResponseDataItemActor(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/members/logs/types/ListLogsResponsePageInfo.java b/src/main/java/com/whop/api/resources/members/logs/types/ListLogsResponsePageInfo.java new file mode 100644 index 00000000..2d943c2d --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/logs/types/ListLogsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.logs.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListLogsResponsePageInfo.Builder.class) +public final class ListLogsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListLogsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListLogsResponsePageInfo && equalTo((ListLogsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListLogsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListLogsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListLogsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListLogsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListLogsResponsePageInfo build() { + return new ListLogsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/members/requests/ListMembersRequest.java b/src/main/java/com/whop/api/resources/members/requests/ListMembersRequest.java new file mode 100644 index 00000000..b9c66836 --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/requests/ListMembersRequest.java @@ -0,0 +1,472 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.members.types.ListMembersRequestAccessLevel; +import com.whop.api.resources.members.types.ListMembersRequestDirection; +import com.whop.api.resources.members.types.ListMembersRequestOrder; +import com.whop.api.resources.members.types.ListMembersRequestStatus; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMembersRequest.Builder.class) +public final class ListMembersRequest { + private final Optional accountId; + + private final Optional accessLevel; + + private final Optional status; + + private final Optional query; + + private final Optional createdAfter; + + private final Optional createdBefore; + + private final Optional order; + + private final Optional direction; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListMembersRequest( + Optional accountId, + Optional accessLevel, + Optional status, + Optional query, + Optional createdAfter, + Optional createdBefore, + Optional order, + Optional direction, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.accountId = accountId; + this.accessLevel = accessLevel; + this.status = status; + this.query = query; + this.createdAfter = createdAfter; + this.createdBefore = createdBefore; + this.order = order; + this.direction = direction; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account to list members for (biz_ tag). Defaults to the account the credential acts as. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Filter by what the member can reach on the account. + */ + @JsonProperty("access_level") + public Optional getAccessLevel() { + return accessLevel; + } + + /** + * @return Filter by whether the member is still part of the account. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Search members by name or username. An exact email address also matches when the credential holds the member:email:read scope. + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + /** + * @return Only members who joined after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Only members who joined before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Sort field. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Number of members to return from the start of the window. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to paginate forwards from. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return Number of members to return from the end of the window. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to paginate backwards from. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMembersRequest && equalTo((ListMembersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMembersRequest other) { + return accountId.equals(other.accountId) + && accessLevel.equals(other.accessLevel) + && status.equals(other.status) + && query.equals(other.query) + && createdAfter.equals(other.createdAfter) + && createdBefore.equals(other.createdBefore) + && order.equals(other.order) + && direction.equals(other.direction) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.accessLevel, + this.status, + this.query, + this.createdAfter, + this.createdBefore, + this.order, + this.direction, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional accessLevel = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional query = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListMembersRequest other) { + accountId(other.getAccountId()); + accessLevel(other.getAccessLevel()); + status(other.getStatus()); + query(other.getQuery()); + createdAfter(other.getCreatedAfter()); + createdBefore(other.getCreatedBefore()); + order(other.getOrder()); + direction(other.getDirection()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

The account to list members for (biz_ tag). Defaults to the account the credential acts as.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Filter by what the member can reach on the account.

+ */ + @JsonSetter(value = "access_level", nulls = Nulls.SKIP) + public Builder accessLevel(Optional accessLevel) { + this.accessLevel = accessLevel; + return this; + } + + public Builder accessLevel(ListMembersRequestAccessLevel accessLevel) { + this.accessLevel = Optional.ofNullable(accessLevel); + return this; + } + + /** + *

Filter by whether the member is still part of the account.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListMembersRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Search members by name or username. An exact email address also matches when the credential holds the member:email:read scope.

+ */ + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public Builder query(Optional query) { + this.query = query; + return this; + } + + public Builder query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + /** + *

Only members who joined after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only members who joined before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Sort field.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListMembersRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListMembersRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Number of members to return from the start of the window.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to paginate forwards from.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Number of members to return from the end of the window.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to paginate backwards from.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListMembersRequest build() { + return new ListMembersRequest( + accountId, + accessLevel, + status, + query, + createdAfter, + createdBefore, + order, + direction, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/members/requests/RetrieveMembersRequest.java b/src/main/java/com/whop/api/resources/members/requests/RetrieveMembersRequest.java new file mode 100644 index 00000000..cce204fe --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/requests/RetrieveMembersRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveMembersRequest.Builder.class) +public final class RetrieveMembersRequest { + private final Map additionalProperties; + + private RetrieveMembersRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveMembersRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveMembersRequest other) { + return this; + } + + public RetrieveMembersRequest build() { + return new RetrieveMembersRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/members/types/ListMembersRequestAccessLevel.java b/src/main/java/com/whop/api/resources/members/types/ListMembersRequestAccessLevel.java new file mode 100644 index 00000000..cfd4c07a --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/types/ListMembersRequestAccessLevel.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListMembersRequestAccessLevel { + public static final ListMembersRequestAccessLevel ADMIN = new ListMembersRequestAccessLevel(Value.ADMIN, "admin"); + + public static final ListMembersRequestAccessLevel CUSTOMER = + new ListMembersRequestAccessLevel(Value.CUSTOMER, "customer"); + + public static final ListMembersRequestAccessLevel NO_ACCESS = + new ListMembersRequestAccessLevel(Value.NO_ACCESS, "no_access"); + + private final Value value; + + private final String string; + + ListMembersRequestAccessLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListMembersRequestAccessLevel + && this.string.equals(((ListMembersRequestAccessLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ADMIN: + return visitor.visitAdmin(); + case CUSTOMER: + return visitor.visitCustomer(); + case NO_ACCESS: + return visitor.visitNoAccess(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListMembersRequestAccessLevel valueOf(String value) { + switch (value) { + case "admin": + return ADMIN; + case "customer": + return CUSTOMER; + case "no_access": + return NO_ACCESS; + default: + return new ListMembersRequestAccessLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + NO_ACCESS, + + ADMIN, + + CUSTOMER, + + UNKNOWN + } + + public interface Visitor { + T visitNoAccess(); + + T visitAdmin(); + + T visitCustomer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/members/types/ListMembersRequestDirection.java b/src/main/java/com/whop/api/resources/members/types/ListMembersRequestDirection.java new file mode 100644 index 00000000..d04305c5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/types/ListMembersRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListMembersRequestDirection { + public static final ListMembersRequestDirection ASC = new ListMembersRequestDirection(Value.ASC, "asc"); + + public static final ListMembersRequestDirection DESC = new ListMembersRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListMembersRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListMembersRequestDirection + && this.string.equals(((ListMembersRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListMembersRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListMembersRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/members/types/ListMembersRequestOrder.java b/src/main/java/com/whop/api/resources/members/types/ListMembersRequestOrder.java new file mode 100644 index 00000000..22d1c698 --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/types/ListMembersRequestOrder.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListMembersRequestOrder { + public static final ListMembersRequestOrder JOINED_AT = new ListMembersRequestOrder(Value.JOINED_AT, "joined_at"); + + public static final ListMembersRequestOrder USD_TOTAL_SPENT = + new ListMembersRequestOrder(Value.USD_TOTAL_SPENT, "usd_total_spent"); + + public static final ListMembersRequestOrder CREATED_AT = + new ListMembersRequestOrder(Value.CREATED_AT, "created_at"); + + public static final ListMembersRequestOrder LAST_ACCESSED_AT = + new ListMembersRequestOrder(Value.LAST_ACCESSED_AT, "last_accessed_at"); + + private final Value value; + + private final String string; + + ListMembersRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListMembersRequestOrder + && this.string.equals(((ListMembersRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case JOINED_AT: + return visitor.visitJoinedAt(); + case USD_TOTAL_SPENT: + return visitor.visitUsdTotalSpent(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case LAST_ACCESSED_AT: + return visitor.visitLastAccessedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListMembersRequestOrder valueOf(String value) { + switch (value) { + case "joined_at": + return JOINED_AT; + case "usd_total_spent": + return USD_TOTAL_SPENT; + case "created_at": + return CREATED_AT; + case "last_accessed_at": + return LAST_ACCESSED_AT; + default: + return new ListMembersRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + JOINED_AT, + + LAST_ACCESSED_AT, + + USD_TOTAL_SPENT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitJoinedAt(); + + T visitLastAccessedAt(); + + T visitUsdTotalSpent(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/members/types/ListMembersRequestStatus.java b/src/main/java/com/whop/api/resources/members/types/ListMembersRequestStatus.java new file mode 100644 index 00000000..55a891cc --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/types/ListMembersRequestStatus.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListMembersRequestStatus { + public static final ListMembersRequestStatus LEFT = new ListMembersRequestStatus(Value.LEFT, "left"); + + public static final ListMembersRequestStatus JOINED = new ListMembersRequestStatus(Value.JOINED, "joined"); + + private final Value value; + + private final String string; + + ListMembersRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListMembersRequestStatus + && this.string.equals(((ListMembersRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LEFT: + return visitor.visitLeft(); + case JOINED: + return visitor.visitJoined(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListMembersRequestStatus valueOf(String value) { + switch (value) { + case "left": + return LEFT; + case "joined": + return JOINED; + default: + return new ListMembersRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + JOINED, + + LEFT, + + UNKNOWN + } + + public interface Visitor { + T visitJoined(); + + T visitLeft(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/members/types/ListMembersResponse.java b/src/main/java/com/whop/api/resources/members/types/ListMembersResponse.java new file mode 100644 index 00000000..4d9d5243 --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/types/ListMembersResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Member; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMembersResponse.Builder.class) +public final class ListMembersResponse { + private final List data; + + private final ListMembersResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListMembersResponse( + List data, ListMembersResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListMembersResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMembersResponse && equalTo((ListMembersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMembersResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListMembersResponsePageInfo pageInfo); + + Builder from(ListMembersResponse other); + } + + public interface _FinalStage { + ListMembersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(Member data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListMembersResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMembersResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListMembersResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(Member data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListMembersResponse build() { + return new ListMembersResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/members/types/ListMembersResponsePageInfo.java b/src/main/java/com/whop/api/resources/members/types/ListMembersResponsePageInfo.java new file mode 100644 index 00000000..06970c35 --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/types/ListMembersResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMembersResponsePageInfo.Builder.class) +public final class ListMembersResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListMembersResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMembersResponsePageInfo && equalTo((ListMembersResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMembersResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListMembersResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListMembersResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMembersResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListMembersResponsePageInfo build() { + return new ListMembersResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/members/types/PostMemberCreatedPayload.java b/src/main/java/com/whop/api/resources/members/types/PostMemberCreatedPayload.java new file mode 100644 index 00000000..d937257c --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/types/PostMemberCreatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Member; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostMemberCreatedPayload.Builder.class) +public final class PostMemberCreatedPayload { + private final Optional accountId; + + private final PostMemberCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Member data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostMemberCreatedPayloadType type; + + private final Map additionalProperties; + + private PostMemberCreatedPayload( + Optional accountId, + PostMemberCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Member data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostMemberCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostMemberCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Member getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostMemberCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostMemberCreatedPayload && equalTo((PostMemberCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostMemberCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostMemberCreatedPayloadApiVersion apiVersion); + + Builder from(PostMemberCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Member data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostMemberCreatedPayloadType type); + } + + public interface _FinalStage { + PostMemberCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostMemberCreatedPayloadApiVersion apiVersion; + + private Member data; + + private String id; + + private OffsetDateTime timestamp; + + private PostMemberCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostMemberCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostMemberCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Member data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostMemberCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostMemberCreatedPayload build() { + return new PostMemberCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/members/types/PostMemberCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/members/types/PostMemberCreatedPayloadApiVersion.java new file mode 100644 index 00000000..172b514c --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/types/PostMemberCreatedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostMemberCreatedPayloadApiVersion { + public static final PostMemberCreatedPayloadApiVersion V1 = new PostMemberCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostMemberCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostMemberCreatedPayloadApiVersion + && this.string.equals(((PostMemberCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostMemberCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostMemberCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/members/types/PostMemberCreatedPayloadType.java b/src/main/java/com/whop/api/resources/members/types/PostMemberCreatedPayloadType.java new file mode 100644 index 00000000..fb3487c7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/members/types/PostMemberCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.members.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostMemberCreatedPayloadType { + public static final PostMemberCreatedPayloadType MEMBER_CREATED = + new PostMemberCreatedPayloadType(Value.MEMBER_CREATED, "member.created"); + + private final Value value; + + private final String string; + + PostMemberCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostMemberCreatedPayloadType + && this.string.equals(((PostMemberCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MEMBER_CREATED: + return visitor.visitMemberCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostMemberCreatedPayloadType valueOf(String value) { + switch (value) { + case "member.created": + return MEMBER_CREATED; + default: + return new PostMemberCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + MEMBER_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitMemberCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/AsyncMembershipsClient.java b/src/main/java/com/whop/api/resources/memberships/AsyncMembershipsClient.java new file mode 100644 index 00000000..7488ceff --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/AsyncMembershipsClient.java @@ -0,0 +1,410 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.memberships.requests.AddFreeDaysMembershipRequest; +import com.whop.api.resources.memberships.requests.CancelMembershipsRequest; +import com.whop.api.resources.memberships.requests.ExtendMembershipsRequest; +import com.whop.api.resources.memberships.requests.ListMembershipsRequest; +import com.whop.api.resources.memberships.requests.PauseMembershipsRequest; +import com.whop.api.resources.memberships.requests.ResumeMembershipsRequest; +import com.whop.api.resources.memberships.requests.ResyncAccessMembershipRequest; +import com.whop.api.resources.memberships.requests.RetrieveMembershipsRequest; +import com.whop.api.resources.memberships.requests.TransferMembershipsRequest; +import com.whop.api.resources.memberships.requests.UncancelMembershipRequest; +import com.whop.api.resources.memberships.requests.UpdateMembershipsRequest; +import com.whop.api.resources.memberships.types.InviteMembershipsRequestBody; +import com.whop.api.resources.memberships.types.InviteMembershipsResponse; +import com.whop.api.resources.memberships.types.TransferMembershipsResponse; +import com.whop.api.types.Membership; +import java.util.concurrent.CompletableFuture; + +public class AsyncMembershipsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawMembershipsClient rawClient; + + public AsyncMembershipsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawMembershipsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawMembershipsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public CompletableFuture> list(ListMembershipsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public CompletableFuture> list( + ListMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Sends an email inviting one recipient to join the account through a free plan. Identify the recipient by exactly one of user_id or email. The invitation is bound to that recipient; after signing in, accepting it immediately grants the membership without checkout. This Experimental endpoint is available only to accounts enabled for membership invitations. + */ + public CompletableFuture invite(InviteMembershipsRequestBody request) { + return this.rawClient.invite(request).thenApply(response -> response.body()); + } + + /** + * Sends an email inviting one recipient to join the account through a free plan. Identify the recipient by exactly one of user_id or email. The invitation is bound to that recipient; after signing in, accepting it immediately grants the membership without checkout. This Experimental endpoint is available only to accounts enabled for membership invitations. + */ + public CompletableFuture invite( + InviteMembershipsRequestBody request, RequestOptions requestOptions) { + return this.rawClient.invite(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public CompletableFuture retrieve(String id, RetrieveMembershipsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public CompletableFuture retrieve( + String id, RetrieveMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public CompletableFuture update(String id, UpdateMembershipsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public CompletableFuture update( + String id, UpdateMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Add free days to extend a membership's current billing period, expiration date, or Stripe trial. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture addFreeDaysMembership(String id, AddFreeDaysMembershipRequest request) { + return this.rawClient.addFreeDaysMembership(id, request).thenApply(response -> response.body()); + } + + /** + * Add free days to extend a membership's current billing period, expiration date, or Stripe trial. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture addFreeDaysMembership( + String id, AddFreeDaysMembershipRequest request, RequestOptions requestOptions) { + return this.rawClient.addFreeDaysMembership(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public CompletableFuture cancel(String id) { + return this.rawClient.cancel(id).thenApply(response -> response.body()); + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public CompletableFuture cancel(String id, RequestOptions requestOptions) { + return this.rawClient.cancel(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public CompletableFuture cancel(String id, CancelMembershipsRequest request) { + return this.rawClient.cancel(id, request).thenApply(response -> response.body()); + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public CompletableFuture cancel( + String id, CancelMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.cancel(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Adds free days to a membership, extending its current billing period, expiration date, or trial depending on the plan type. + */ + public CompletableFuture extend(String id, ExtendMembershipsRequest request) { + return this.rawClient.extend(id, request).thenApply(response -> response.body()); + } + + /** + * Adds free days to a membership, extending its current billing period, expiration date, or trial depending on the plan type. + */ + public CompletableFuture extend( + String id, ExtendMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.extend(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public CompletableFuture pause(String id) { + return this.rawClient.pause(id).thenApply(response -> response.body()); + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public CompletableFuture pause(String id, RequestOptions requestOptions) { + return this.rawClient.pause(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public CompletableFuture pause(String id, PauseMembershipsRequest request) { + return this.rawClient.pause(id, request).thenApply(response -> response.body()); + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public CompletableFuture pause( + String id, PauseMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.pause(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public CompletableFuture resume(String id) { + return this.rawClient.resume(id).thenApply(response -> response.body()); + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public CompletableFuture resume(String id, RequestOptions requestOptions) { + return this.rawClient.resume(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public CompletableFuture resume(String id, ResumeMembershipsRequest request) { + return this.rawClient.resume(id, request).thenApply(response -> response.body()); + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public CompletableFuture resume( + String id, ResumeMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.resume(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture resyncAccessMembership(String id) { + return this.rawClient.resyncAccessMembership(id).thenApply(response -> response.body()); + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture resyncAccessMembership(String id, RequestOptions requestOptions) { + return this.rawClient.resyncAccessMembership(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture resyncAccessMembership(String id, ResyncAccessMembershipRequest request) { + return this.rawClient.resyncAccessMembership(id, request).thenApply(response -> response.body()); + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture resyncAccessMembership( + String id, ResyncAccessMembershipRequest request, RequestOptions requestOptions) { + return this.rawClient + .resyncAccessMembership(id, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public CompletableFuture transfer(String id) { + return this.rawClient.transfer(id).thenApply(response -> response.body()); + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public CompletableFuture transfer(String id, RequestOptions requestOptions) { + return this.rawClient.transfer(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public CompletableFuture transfer(String id, TransferMembershipsRequest request) { + return this.rawClient.transfer(id, request).thenApply(response -> response.body()); + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public CompletableFuture transfer( + String id, TransferMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.transfer(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture uncancelMembership(String id) { + return this.rawClient.uncancelMembership(id).thenApply(response -> response.body()); + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture uncancelMembership(String id, RequestOptions requestOptions) { + return this.rawClient.uncancelMembership(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture uncancelMembership(String id, UncancelMembershipRequest request) { + return this.rawClient.uncancelMembership(id, request).thenApply(response -> response.body()); + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture uncancelMembership( + String id, UncancelMembershipRequest request, RequestOptions requestOptions) { + return this.rawClient.uncancelMembership(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/AsyncRawMembershipsClient.java b/src/main/java/com/whop/api/resources/memberships/AsyncRawMembershipsClient.java new file mode 100644 index 00000000..81f53d24 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/AsyncRawMembershipsClient.java @@ -0,0 +1,1418 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.memberships.requests.AddFreeDaysMembershipRequest; +import com.whop.api.resources.memberships.requests.CancelMembershipsRequest; +import com.whop.api.resources.memberships.requests.ExtendMembershipsRequest; +import com.whop.api.resources.memberships.requests.ListMembershipsRequest; +import com.whop.api.resources.memberships.requests.PauseMembershipsRequest; +import com.whop.api.resources.memberships.requests.ResumeMembershipsRequest; +import com.whop.api.resources.memberships.requests.ResyncAccessMembershipRequest; +import com.whop.api.resources.memberships.requests.RetrieveMembershipsRequest; +import com.whop.api.resources.memberships.requests.TransferMembershipsRequest; +import com.whop.api.resources.memberships.requests.UncancelMembershipRequest; +import com.whop.api.resources.memberships.requests.UpdateMembershipsRequest; +import com.whop.api.resources.memberships.types.InviteMembershipsRequestBody; +import com.whop.api.resources.memberships.types.InviteMembershipsResponse; +import com.whop.api.resources.memberships.types.ListMembershipsResponse; +import com.whop.api.resources.memberships.types.TransferMembershipsResponse; +import com.whop.api.types.Membership; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawMembershipsClient { + protected final ClientOptions clientOptions; + + public AsyncRawMembershipsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public CompletableFuture>> list() { + return list(ListMembershipsRequest.builder().build()); + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(ListMembershipsRequest.builder().build(), requestOptions); + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public CompletableFuture>> list(ListMembershipsRequest request) { + return list(request, null); + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public CompletableFuture>> list( + ListMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getProductId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_id", request.getProductId().get(), false); + } + if (request.getPlanId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_id", request.getPlanId().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListMembershipsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListMembershipsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListMembershipsRequest nextRequest = ListMembershipsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Sends an email inviting one recipient to join the account through a free plan. Identify the recipient by exactly one of user_id or email. The invitation is bound to that recipient; after signing in, accepting it immediately grants the membership without checkout. This Experimental endpoint is available only to accounts enabled for membership invitations. + */ + public CompletableFuture> invite( + InviteMembershipsRequestBody request) { + return invite(request, null); + } + + /** + * Sends an email inviting one recipient to join the account through a free plan. Identify the recipient by exactly one of user_id or email. The invitation is bound to that recipient; after signing in, accepting it immediately grants the membership without checkout. This Experimental endpoint is available only to accounts enabled for membership invitations. + */ + public CompletableFuture> invite( + InviteMembershipsRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships/invite"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, InviteMembershipsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveMembershipsRequest.builder().build()); + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveMembershipsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public CompletableFuture> retrieve(String id, RetrieveMembershipsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public CompletableFuture> retrieve( + String id, RetrieveMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response)); + return; + } + try { + switch (response.code()) { + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateMembershipsRequest.builder().build()); + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateMembershipsRequest.builder().build(), requestOptions); + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public CompletableFuture> update(String id, UpdateMembershipsRequest request) { + return update(id, request, null); + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public CompletableFuture> update( + String id, UpdateMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Add free days to extend a membership's current billing period, expiration date, or Stripe trial. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> addFreeDaysMembership( + String id, AddFreeDaysMembershipRequest request) { + return addFreeDaysMembership(id, request, null); + } + + /** + * Add free days to extend a membership's current billing period, expiration date, or Stripe trial. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> addFreeDaysMembership( + String id, AddFreeDaysMembershipRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("add_free_days"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public CompletableFuture> cancel(String id) { + return cancel(id, CancelMembershipsRequest.builder().build()); + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public CompletableFuture> cancel(String id, RequestOptions requestOptions) { + return cancel(id, CancelMembershipsRequest.builder().build(), requestOptions); + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public CompletableFuture> cancel(String id, CancelMembershipsRequest request) { + return cancel(id, request, null); + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public CompletableFuture> cancel( + String id, CancelMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("cancel"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response)); + return; + } + try { + switch (response.code()) { + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Adds free days to a membership, extending its current billing period, expiration date, or trial depending on the plan type. + */ + public CompletableFuture> extend(String id, ExtendMembershipsRequest request) { + return extend(id, request, null); + } + + /** + * Adds free days to a membership, extending its current billing period, expiration date, or trial depending on the plan type. + */ + public CompletableFuture> extend( + String id, ExtendMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("extend"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public CompletableFuture> pause(String id) { + return pause(id, PauseMembershipsRequest.builder().build()); + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public CompletableFuture> pause(String id, RequestOptions requestOptions) { + return pause(id, PauseMembershipsRequest.builder().build(), requestOptions); + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public CompletableFuture> pause(String id, PauseMembershipsRequest request) { + return pause(id, request, null); + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public CompletableFuture> pause( + String id, PauseMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("pause"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public CompletableFuture> resume(String id) { + return resume(id, ResumeMembershipsRequest.builder().build()); + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public CompletableFuture> resume(String id, RequestOptions requestOptions) { + return resume(id, ResumeMembershipsRequest.builder().build(), requestOptions); + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public CompletableFuture> resume(String id, ResumeMembershipsRequest request) { + return resume(id, request, null); + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public CompletableFuture> resume( + String id, ResumeMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("resume"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> resyncAccessMembership(String id) { + return resyncAccessMembership( + id, ResyncAccessMembershipRequest.builder().build()); + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> resyncAccessMembership( + String id, RequestOptions requestOptions) { + return resyncAccessMembership( + id, ResyncAccessMembershipRequest.builder().build(), requestOptions); + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> resyncAccessMembership( + String id, ResyncAccessMembershipRequest request) { + return resyncAccessMembership(id, request, null); + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> resyncAccessMembership( + String id, ResyncAccessMembershipRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("resync_access"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public CompletableFuture> transfer(String id) { + return transfer(id, TransferMembershipsRequest.builder().build()); + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public CompletableFuture> transfer( + String id, RequestOptions requestOptions) { + return transfer(id, TransferMembershipsRequest.builder().build(), requestOptions); + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public CompletableFuture> transfer( + String id, TransferMembershipsRequest request) { + return transfer(id, request, null); + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public CompletableFuture> transfer( + String id, TransferMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("transfer"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, TransferMembershipsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> uncancelMembership(String id) { + return uncancelMembership(id, UncancelMembershipRequest.builder().build()); + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> uncancelMembership( + String id, RequestOptions requestOptions) { + return uncancelMembership(id, UncancelMembershipRequest.builder().build(), requestOptions); + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> uncancelMembership( + String id, UncancelMembershipRequest request) { + return uncancelMembership(id, request, null); + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public CompletableFuture> uncancelMembership( + String id, UncancelMembershipRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("uncancel"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/MembershipsClient.java b/src/main/java/com/whop/api/resources/memberships/MembershipsClient.java new file mode 100644 index 00000000..42bfb069 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/MembershipsClient.java @@ -0,0 +1,400 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.memberships.requests.AddFreeDaysMembershipRequest; +import com.whop.api.resources.memberships.requests.CancelMembershipsRequest; +import com.whop.api.resources.memberships.requests.ExtendMembershipsRequest; +import com.whop.api.resources.memberships.requests.ListMembershipsRequest; +import com.whop.api.resources.memberships.requests.PauseMembershipsRequest; +import com.whop.api.resources.memberships.requests.ResumeMembershipsRequest; +import com.whop.api.resources.memberships.requests.ResyncAccessMembershipRequest; +import com.whop.api.resources.memberships.requests.RetrieveMembershipsRequest; +import com.whop.api.resources.memberships.requests.TransferMembershipsRequest; +import com.whop.api.resources.memberships.requests.UncancelMembershipRequest; +import com.whop.api.resources.memberships.requests.UpdateMembershipsRequest; +import com.whop.api.resources.memberships.types.InviteMembershipsRequestBody; +import com.whop.api.resources.memberships.types.InviteMembershipsResponse; +import com.whop.api.resources.memberships.types.TransferMembershipsResponse; +import com.whop.api.types.Membership; + +public class MembershipsClient { + protected final ClientOptions clientOptions; + + private final RawMembershipsClient rawClient; + + public MembershipsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawMembershipsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawMembershipsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public SyncPagingIterable list(ListMembershipsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public SyncPagingIterable list(ListMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Sends an email inviting one recipient to join the account through a free plan. Identify the recipient by exactly one of user_id or email. The invitation is bound to that recipient; after signing in, accepting it immediately grants the membership without checkout. This Experimental endpoint is available only to accounts enabled for membership invitations. + */ + public InviteMembershipsResponse invite(InviteMembershipsRequestBody request) { + return this.rawClient.invite(request).body(); + } + + /** + * Sends an email inviting one recipient to join the account through a free plan. Identify the recipient by exactly one of user_id or email. The invitation is bound to that recipient; after signing in, accepting it immediately grants the membership without checkout. This Experimental endpoint is available only to accounts enabled for membership invitations. + */ + public InviteMembershipsResponse invite(InviteMembershipsRequestBody request, RequestOptions requestOptions) { + return this.rawClient.invite(request, requestOptions).body(); + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public Membership retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public Membership retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public Membership retrieve(String id, RetrieveMembershipsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public Membership retrieve(String id, RetrieveMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public Membership update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public Membership update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public Membership update(String id, UpdateMembershipsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public Membership update(String id, UpdateMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Add free days to extend a membership's current billing period, expiration date, or Stripe trial. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public Membership addFreeDaysMembership(String id, AddFreeDaysMembershipRequest request) { + return this.rawClient.addFreeDaysMembership(id, request).body(); + } + + /** + * Add free days to extend a membership's current billing period, expiration date, or Stripe trial. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public Membership addFreeDaysMembership( + String id, AddFreeDaysMembershipRequest request, RequestOptions requestOptions) { + return this.rawClient.addFreeDaysMembership(id, request, requestOptions).body(); + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public Membership cancel(String id) { + return this.rawClient.cancel(id).body(); + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public Membership cancel(String id, RequestOptions requestOptions) { + return this.rawClient.cancel(id, requestOptions).body(); + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public Membership cancel(String id, CancelMembershipsRequest request) { + return this.rawClient.cancel(id, request).body(); + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public Membership cancel(String id, CancelMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.cancel(id, request, requestOptions).body(); + } + + /** + * Adds free days to a membership, extending its current billing period, expiration date, or trial depending on the plan type. + */ + public Membership extend(String id, ExtendMembershipsRequest request) { + return this.rawClient.extend(id, request).body(); + } + + /** + * Adds free days to a membership, extending its current billing period, expiration date, or trial depending on the plan type. + */ + public Membership extend(String id, ExtendMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.extend(id, request, requestOptions).body(); + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public Membership pause(String id) { + return this.rawClient.pause(id).body(); + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public Membership pause(String id, RequestOptions requestOptions) { + return this.rawClient.pause(id, requestOptions).body(); + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public Membership pause(String id, PauseMembershipsRequest request) { + return this.rawClient.pause(id, request).body(); + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public Membership pause(String id, PauseMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.pause(id, request, requestOptions).body(); + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public Membership resume(String id) { + return this.rawClient.resume(id).body(); + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public Membership resume(String id, RequestOptions requestOptions) { + return this.rawClient.resume(id, requestOptions).body(); + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public Membership resume(String id, ResumeMembershipsRequest request) { + return this.rawClient.resume(id, request).body(); + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public Membership resume(String id, ResumeMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.resume(id, request, requestOptions).body(); + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public Membership resyncAccessMembership(String id) { + return this.rawClient.resyncAccessMembership(id).body(); + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public Membership resyncAccessMembership(String id, RequestOptions requestOptions) { + return this.rawClient.resyncAccessMembership(id, requestOptions).body(); + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public Membership resyncAccessMembership(String id, ResyncAccessMembershipRequest request) { + return this.rawClient.resyncAccessMembership(id, request).body(); + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public Membership resyncAccessMembership( + String id, ResyncAccessMembershipRequest request, RequestOptions requestOptions) { + return this.rawClient + .resyncAccessMembership(id, request, requestOptions) + .body(); + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public TransferMembershipsResponse transfer(String id) { + return this.rawClient.transfer(id).body(); + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public TransferMembershipsResponse transfer(String id, RequestOptions requestOptions) { + return this.rawClient.transfer(id, requestOptions).body(); + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public TransferMembershipsResponse transfer(String id, TransferMembershipsRequest request) { + return this.rawClient.transfer(id, request).body(); + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public TransferMembershipsResponse transfer( + String id, TransferMembershipsRequest request, RequestOptions requestOptions) { + return this.rawClient.transfer(id, request, requestOptions).body(); + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public Membership uncancelMembership(String id) { + return this.rawClient.uncancelMembership(id).body(); + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public Membership uncancelMembership(String id, RequestOptions requestOptions) { + return this.rawClient.uncancelMembership(id, requestOptions).body(); + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public Membership uncancelMembership(String id, UncancelMembershipRequest request) { + return this.rawClient.uncancelMembership(id, request).body(); + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public Membership uncancelMembership(String id, UncancelMembershipRequest request, RequestOptions requestOptions) { + return this.rawClient.uncancelMembership(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/RawMembershipsClient.java b/src/main/java/com/whop/api/resources/memberships/RawMembershipsClient.java new file mode 100644 index 00000000..acc362f5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/RawMembershipsClient.java @@ -0,0 +1,1145 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.memberships.requests.AddFreeDaysMembershipRequest; +import com.whop.api.resources.memberships.requests.CancelMembershipsRequest; +import com.whop.api.resources.memberships.requests.ExtendMembershipsRequest; +import com.whop.api.resources.memberships.requests.ListMembershipsRequest; +import com.whop.api.resources.memberships.requests.PauseMembershipsRequest; +import com.whop.api.resources.memberships.requests.ResumeMembershipsRequest; +import com.whop.api.resources.memberships.requests.ResyncAccessMembershipRequest; +import com.whop.api.resources.memberships.requests.RetrieveMembershipsRequest; +import com.whop.api.resources.memberships.requests.TransferMembershipsRequest; +import com.whop.api.resources.memberships.requests.UncancelMembershipRequest; +import com.whop.api.resources.memberships.requests.UpdateMembershipsRequest; +import com.whop.api.resources.memberships.types.InviteMembershipsRequestBody; +import com.whop.api.resources.memberships.types.InviteMembershipsResponse; +import com.whop.api.resources.memberships.types.ListMembershipsResponse; +import com.whop.api.resources.memberships.types.TransferMembershipsResponse; +import com.whop.api.types.Membership; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawMembershipsClient { + protected final ClientOptions clientOptions; + + public RawMembershipsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public WhopApiHttpResponse> list() { + return list(ListMembershipsRequest.builder().build()); + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListMembershipsRequest.builder().build(), requestOptions); + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public WhopApiHttpResponse> list(ListMembershipsRequest request) { + return list(request, null); + } + + /** + * Lists every membership the caller can read: an account API key its account's; a user credential their own plus those of every account they manage. account_id and user_id only narrow that list — values outside the caller's reach return fewer results, not an error. + */ + public WhopApiHttpResponse> list( + ListMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getProductId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_id", request.getProductId().get(), false); + } + if (request.getPlanId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_id", request.getPlanId().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListMembershipsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListMembershipsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListMembershipsRequest nextRequest = ListMembershipsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Sends an email inviting one recipient to join the account through a free plan. Identify the recipient by exactly one of user_id or email. The invitation is bound to that recipient; after signing in, accepting it immediately grants the membership without checkout. This Experimental endpoint is available only to accounts enabled for membership invitations. + */ + public WhopApiHttpResponse invite(InviteMembershipsRequestBody request) { + return invite(request, null); + } + + /** + * Sends an email inviting one recipient to join the account through a free plan. Identify the recipient by exactly one of user_id or email. The invitation is bound to that recipient; after signing in, accepting it immediately grants the membership without checkout. This Experimental endpoint is available only to accounts enabled for membership invitations. + */ + public WhopApiHttpResponse invite( + InviteMembershipsRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships/invite"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, InviteMembershipsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveMembershipsRequest.builder().build()); + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveMembershipsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveMembershipsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a membership by ID or license key. Accessible to the account and to the membership's own user. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response); + } + try { + switch (response.code()) { + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateMembershipsRequest.builder().build()); + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateMembershipsRequest.builder().build(), requestOptions); + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public WhopApiHttpResponse update(String id, UpdateMembershipsRequest request) { + return update(id, request, null); + } + + /** + * Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one. + */ + public WhopApiHttpResponse update( + String id, UpdateMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Add free days to extend a membership's current billing period, expiration date, or Stripe trial. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse addFreeDaysMembership(String id, AddFreeDaysMembershipRequest request) { + return addFreeDaysMembership(id, request, null); + } + + /** + * Add free days to extend a membership's current billing period, expiration date, or Stripe trial. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse addFreeDaysMembership( + String id, AddFreeDaysMembershipRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("add_free_days"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public WhopApiHttpResponse cancel(String id) { + return cancel(id, CancelMembershipsRequest.builder().build()); + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public WhopApiHttpResponse cancel(String id, RequestOptions requestOptions) { + return cancel(id, CancelMembershipsRequest.builder().build(), requestOptions); + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public WhopApiHttpResponse cancel(String id, CancelMembershipsRequest request) { + return cancel(id, request, null); + } + + /** + * Cancels a membership. Pass cancel_at_period_end: true to stop auto-renewal and keep access until the current billing period ends. Omit it (or pass false) to revoke access immediately. Buyers cannot cancel buy-now-pay-later (splitit, sezzle) or non-trial split-pay memberships. + */ + public WhopApiHttpResponse cancel( + String id, CancelMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("cancel"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response); + } + try { + switch (response.code()) { + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Adds free days to a membership, extending its current billing period, expiration date, or trial depending on the plan type. + */ + public WhopApiHttpResponse extend(String id, ExtendMembershipsRequest request) { + return extend(id, request, null); + } + + /** + * Adds free days to a membership, extending its current billing period, expiration date, or trial depending on the plan type. + */ + public WhopApiHttpResponse extend( + String id, ExtendMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("extend"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public WhopApiHttpResponse pause(String id) { + return pause(id, PauseMembershipsRequest.builder().build()); + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public WhopApiHttpResponse pause(String id, RequestOptions requestOptions) { + return pause(id, PauseMembershipsRequest.builder().build(), requestOptions); + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public WhopApiHttpResponse pause(String id, PauseMembershipsRequest request) { + return pause(id, request, null); + } + + /** + * Pauses a membership's recurring payment collection. The customer keeps access but is not charged until the membership is resumed. + */ + public WhopApiHttpResponse pause( + String id, PauseMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("pause"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public WhopApiHttpResponse resume(String id) { + return resume(id, ResumeMembershipsRequest.builder().build()); + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public WhopApiHttpResponse resume(String id, RequestOptions requestOptions) { + return resume(id, ResumeMembershipsRequest.builder().build(), requestOptions); + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public WhopApiHttpResponse resume(String id, ResumeMembershipsRequest request) { + return resume(id, request, null); + } + + /** + * Resumes a previously paused membership's recurring payment collection. Billing resumes on the next cycle. + */ + public WhopApiHttpResponse resume( + String id, ResumeMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("resume"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse resyncAccessMembership(String id) { + return resyncAccessMembership( + id, ResyncAccessMembershipRequest.builder().build()); + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse resyncAccessMembership(String id, RequestOptions requestOptions) { + return resyncAccessMembership( + id, ResyncAccessMembershipRequest.builder().build(), requestOptions); + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse resyncAccessMembership(String id, ResyncAccessMembershipRequest request) { + return resyncAccessMembership(id, request, null); + } + + /** + * Re-run access fulfillment for a membership. Recomputes the member's content access on Whop, re-validates their Discord link (re-adding them to the server and re-assigning roles if needed), and re-fulfills TradingView indicator access. Telegram access is invite-based and cannot be resynced here. The outcome is written to the membership's logs. + *

Required permissions:

+ *
    + *
  • membership:resync_access
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse resyncAccessMembership( + String id, ResyncAccessMembershipRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("resync_access"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public WhopApiHttpResponse transfer(String id) { + return transfer(id, TransferMembershipsRequest.builder().build()); + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public WhopApiHttpResponse transfer(String id, RequestOptions requestOptions) { + return transfer(id, TransferMembershipsRequest.builder().build(), requestOptions); + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public WhopApiHttpResponse transfer(String id, TransferMembershipsRequest request) { + return transfer(id, request, null); + } + + /** + * Creates a one-use transfer URL for a membership. Opening the URL while logged into a different Whop account claims the membership onto that account. The membership's buyer can generate a link for their own membership with membership:transfer when the product allows transfers and the membership is trialing, active, or completed. An account credential with membership:update bypasses both restrictions. + */ + public WhopApiHttpResponse transfer( + String id, TransferMembershipsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("transfer"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, TransferMembershipsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse uncancelMembership(String id) { + return uncancelMembership(id, UncancelMembershipRequest.builder().build()); + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse uncancelMembership(String id, RequestOptions requestOptions) { + return uncancelMembership(id, UncancelMembershipRequest.builder().build(), requestOptions); + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse uncancelMembership(String id, UncancelMembershipRequest request) { + return uncancelMembership(id, request, null); + } + + /** + * Reverse a pending cancellation for a membership that was scheduled to cancel at period end. + *

Required permissions:

+ *
    + *
  • member:manage
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
+ */ + public WhopApiHttpResponse uncancelMembership( + String id, UncancelMembershipRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("memberships") + .addPathSegment(id) + .addPathSegments("uncancel"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Membership.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/requests/AddFreeDaysMembershipRequest.java b/src/main/java/com/whop/api/resources/memberships/requests/AddFreeDaysMembershipRequest.java new file mode 100644 index 00000000..0f85390c --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/requests/AddFreeDaysMembershipRequest.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AddFreeDaysMembershipRequest.Builder.class) +public final class AddFreeDaysMembershipRequest { + private final int freeDays; + + private final Map additionalProperties; + + private AddFreeDaysMembershipRequest(int freeDays, Map additionalProperties) { + this.freeDays = freeDays; + this.additionalProperties = additionalProperties; + } + + /** + * @return The number of free days to add (1-1095). Extends the billing period, expiration date, or Stripe trial depending on plan type. + */ + @JsonProperty("free_days") + public int getFreeDays() { + return freeDays; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AddFreeDaysMembershipRequest && equalTo((AddFreeDaysMembershipRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AddFreeDaysMembershipRequest other) { + return freeDays == other.freeDays; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.freeDays); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FreeDaysStage builder() { + return new Builder(); + } + + public interface FreeDaysStage { + /** + *

The number of free days to add (1-1095). Extends the billing period, expiration date, or Stripe trial depending on plan type.

+ */ + _FinalStage freeDays(int freeDays); + + Builder from(AddFreeDaysMembershipRequest other); + } + + public interface _FinalStage { + AddFreeDaysMembershipRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FreeDaysStage, _FinalStage { + private int freeDays; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AddFreeDaysMembershipRequest other) { + freeDays(other.getFreeDays()); + return this; + } + + /** + *

The number of free days to add (1-1095). Extends the billing period, expiration date, or Stripe trial depending on plan type.

+ *

The number of free days to add (1-1095). Extends the billing period, expiration date, or Stripe trial depending on plan type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("free_days") + public _FinalStage freeDays(int freeDays) { + this.freeDays = freeDays; + return this; + } + + @java.lang.Override + public AddFreeDaysMembershipRequest build() { + return new AddFreeDaysMembershipRequest(freeDays, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/requests/CancelMembershipsRequest.java b/src/main/java/com/whop/api/resources/memberships/requests/CancelMembershipsRequest.java new file mode 100644 index 00000000..177c98ac --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/requests/CancelMembershipsRequest.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CancelMembershipsRequest.Builder.class) +public final class CancelMembershipsRequest { + private final Optional cancelAtPeriodEnd; + + private final Optional reason; + + private final Map additionalProperties; + + private CancelMembershipsRequest( + Optional cancelAtPeriodEnd, Optional reason, Map additionalProperties) { + this.cancelAtPeriodEnd = cancelAtPeriodEnd; + this.reason = reason; + this.additionalProperties = additionalProperties; + } + + /** + * @return true stops auto-renewal and keeps access until the current billing period ends. Omit or false revokes access immediately. + */ + @JsonProperty("cancel_at_period_end") + public Optional getCancelAtPeriodEnd() { + return cancelAtPeriodEnd; + } + + /** + * @return Free-form note recording why the membership was canceled. + */ + @JsonProperty("reason") + public Optional getReason() { + return reason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CancelMembershipsRequest && equalTo((CancelMembershipsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CancelMembershipsRequest other) { + return cancelAtPeriodEnd.equals(other.cancelAtPeriodEnd) && reason.equals(other.reason); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cancelAtPeriodEnd, this.reason); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional cancelAtPeriodEnd = Optional.empty(); + + private Optional reason = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CancelMembershipsRequest other) { + cancelAtPeriodEnd(other.getCancelAtPeriodEnd()); + reason(other.getReason()); + return this; + } + + /** + *

true stops auto-renewal and keeps access until the current billing period ends. Omit or false revokes access immediately.

+ */ + @JsonSetter(value = "cancel_at_period_end", nulls = Nulls.SKIP) + public Builder cancelAtPeriodEnd(Optional cancelAtPeriodEnd) { + this.cancelAtPeriodEnd = cancelAtPeriodEnd; + return this; + } + + public Builder cancelAtPeriodEnd(Boolean cancelAtPeriodEnd) { + this.cancelAtPeriodEnd = Optional.ofNullable(cancelAtPeriodEnd); + return this; + } + + /** + *

Free-form note recording why the membership was canceled.

+ */ + @JsonSetter(value = "reason", nulls = Nulls.SKIP) + public Builder reason(Optional reason) { + this.reason = reason; + return this; + } + + public Builder reason(String reason) { + this.reason = Optional.ofNullable(reason); + return this; + } + + public CancelMembershipsRequest build() { + return new CancelMembershipsRequest(cancelAtPeriodEnd, reason, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/requests/ExtendMembershipsRequest.java b/src/main/java/com/whop/api/resources/memberships/requests/ExtendMembershipsRequest.java new file mode 100644 index 00000000..589756d0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/requests/ExtendMembershipsRequest.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExtendMembershipsRequest.Builder.class) +public final class ExtendMembershipsRequest { + private final int days; + + private final Map additionalProperties; + + private ExtendMembershipsRequest(int days, Map additionalProperties) { + this.days = days; + this.additionalProperties = additionalProperties; + } + + /** + * @return Number of free days to add (1-1095). + */ + @JsonProperty("days") + public int getDays() { + return days; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExtendMembershipsRequest && equalTo((ExtendMembershipsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExtendMembershipsRequest other) { + return days == other.days; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.days); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DaysStage builder() { + return new Builder(); + } + + public interface DaysStage { + /** + *

Number of free days to add (1-1095).

+ */ + _FinalStage days(int days); + + Builder from(ExtendMembershipsRequest other); + } + + public interface _FinalStage { + ExtendMembershipsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DaysStage, _FinalStage { + private int days; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ExtendMembershipsRequest other) { + days(other.getDays()); + return this; + } + + /** + *

Number of free days to add (1-1095).

+ *

Number of free days to add (1-1095).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("days") + public _FinalStage days(int days) { + this.days = days; + return this; + } + + @java.lang.Override + public ExtendMembershipsRequest build() { + return new ExtendMembershipsRequest(days, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/requests/ListMembershipsRequest.java b/src/main/java/com/whop/api/resources/memberships/requests/ListMembershipsRequest.java new file mode 100644 index 00000000..e370481f --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/requests/ListMembershipsRequest.java @@ -0,0 +1,503 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.memberships.types.ListMembershipsRequestDirection; +import com.whop.api.resources.memberships.types.ListMembershipsRequestOrder; +import com.whop.api.resources.memberships.types.ListMembershipsRequestStatus; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMembershipsRequest.Builder.class) +public final class ListMembershipsRequest { + private final Optional accountId; + + private final Optional userId; + + private final Optional status; + + private final Optional productId; + + private final Optional planId; + + private final Optional createdAfter; + + private final Optional createdBefore; + + private final Optional order; + + private final Optional direction; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListMembershipsRequest( + Optional accountId, + Optional userId, + Optional status, + Optional productId, + Optional planId, + Optional createdAfter, + Optional createdBefore, + Optional order, + Optional direction, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.accountId = accountId; + this.userId = userId; + this.status = status; + this.productId = productId; + this.planId = planId; + this.createdAfter = createdAfter; + this.createdBefore = createdBefore; + this.order = order; + this.direction = direction; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Narrow to one account (biz_ tag). With read access to the account this lists all of its memberships; without, only the caller's own memberships in it. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Narrow to one user's memberships (user_ tag, or me for the caller). A user outside the caller's visible set returns an empty list. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + /** + * @return Filter by billing state. canceling matches active memberships set to cancel at period end; paused matches memberships with payment collection paused. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Filter to memberships of this product (prod_ tag). Repeat as product_ids[] for several. + */ + @JsonProperty("product_id") + public Optional getProductId() { + return productId; + } + + /** + * @return Filter to memberships of this plan (plan_ tag). Repeat as plan_ids[] for several. + */ + @JsonProperty("plan_id") + public Optional getPlanId() { + return planId; + } + + /** + * @return Only memberships created after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Only memberships created before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Sort field. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Number of memberships to return from the start of the window. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to paginate forwards from. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return Number of memberships to return from the end of the window. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to paginate backwards from. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMembershipsRequest && equalTo((ListMembershipsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMembershipsRequest other) { + return accountId.equals(other.accountId) + && userId.equals(other.userId) + && status.equals(other.status) + && productId.equals(other.productId) + && planId.equals(other.planId) + && createdAfter.equals(other.createdAfter) + && createdBefore.equals(other.createdBefore) + && order.equals(other.order) + && direction.equals(other.direction) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.userId, + this.status, + this.productId, + this.planId, + this.createdAfter, + this.createdBefore, + this.order, + this.direction, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional planId = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListMembershipsRequest other) { + accountId(other.getAccountId()); + userId(other.getUserId()); + status(other.getStatus()); + productId(other.getProductId()); + planId(other.getPlanId()); + createdAfter(other.getCreatedAfter()); + createdBefore(other.getCreatedBefore()); + order(other.getOrder()); + direction(other.getDirection()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

Narrow to one account (biz_ tag). With read access to the account this lists all of its memberships; without, only the caller's own memberships in it.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Narrow to one user's memberships (user_ tag, or me for the caller). A user outside the caller's visible set returns an empty list.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Filter by billing state. canceling matches active memberships set to cancel at period end; paused matches memberships with payment collection paused.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListMembershipsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Filter to memberships of this product (prod_ tag). Repeat as product_ids[] for several.

+ */ + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public Builder productId(Optional productId) { + this.productId = productId; + return this; + } + + public Builder productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

Filter to memberships of this plan (plan_ tag). Repeat as plan_ids[] for several.

+ */ + @JsonSetter(value = "plan_id", nulls = Nulls.SKIP) + public Builder planId(Optional planId) { + this.planId = planId; + return this; + } + + public Builder planId(String planId) { + this.planId = Optional.ofNullable(planId); + return this; + } + + /** + *

Only memberships created after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only memberships created before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Sort field.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListMembershipsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListMembershipsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Number of memberships to return from the start of the window.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to paginate forwards from.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Number of memberships to return from the end of the window.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to paginate backwards from.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListMembershipsRequest build() { + return new ListMembershipsRequest( + accountId, + userId, + status, + productId, + planId, + createdAfter, + createdBefore, + order, + direction, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/requests/PauseMembershipsRequest.java b/src/main/java/com/whop/api/resources/memberships/requests/PauseMembershipsRequest.java new file mode 100644 index 00000000..7704061e --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/requests/PauseMembershipsRequest.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PauseMembershipsRequest.Builder.class) +public final class PauseMembershipsRequest { + private final Optional until; + + private final Map additionalProperties; + + private PauseMembershipsRequest(Optional until, Map additionalProperties) { + this.until = until; + this.additionalProperties = additionalProperties; + } + + /** + * @return ISO 8601 time to automatically resume payment collection. Must be in the future; only supported for memberships billed by Whop. + */ + @JsonProperty("until") + public Optional getUntil() { + return until; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PauseMembershipsRequest && equalTo((PauseMembershipsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PauseMembershipsRequest other) { + return until.equals(other.until); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.until); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional until = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PauseMembershipsRequest other) { + until(other.getUntil()); + return this; + } + + /** + *

ISO 8601 time to automatically resume payment collection. Must be in the future; only supported for memberships billed by Whop.

+ */ + @JsonSetter(value = "until", nulls = Nulls.SKIP) + public Builder until(Optional until) { + this.until = until; + return this; + } + + public Builder until(String until) { + this.until = Optional.ofNullable(until); + return this; + } + + public PauseMembershipsRequest build() { + return new PauseMembershipsRequest(until, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/requests/ResumeMembershipsRequest.java b/src/main/java/com/whop/api/resources/memberships/requests/ResumeMembershipsRequest.java new file mode 100644 index 00000000..4daecd69 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/requests/ResumeMembershipsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ResumeMembershipsRequest.Builder.class) +public final class ResumeMembershipsRequest { + private final Map additionalProperties; + + private ResumeMembershipsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ResumeMembershipsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ResumeMembershipsRequest other) { + return this; + } + + public ResumeMembershipsRequest build() { + return new ResumeMembershipsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/requests/ResyncAccessMembershipRequest.java b/src/main/java/com/whop/api/resources/memberships/requests/ResyncAccessMembershipRequest.java new file mode 100644 index 00000000..5df7bee2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/requests/ResyncAccessMembershipRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ResyncAccessMembershipRequest.Builder.class) +public final class ResyncAccessMembershipRequest { + private final Map additionalProperties; + + private ResyncAccessMembershipRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ResyncAccessMembershipRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ResyncAccessMembershipRequest other) { + return this; + } + + public ResyncAccessMembershipRequest build() { + return new ResyncAccessMembershipRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/requests/RetrieveMembershipsRequest.java b/src/main/java/com/whop/api/resources/memberships/requests/RetrieveMembershipsRequest.java new file mode 100644 index 00000000..2d4ea87f --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/requests/RetrieveMembershipsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveMembershipsRequest.Builder.class) +public final class RetrieveMembershipsRequest { + private final Map additionalProperties; + + private RetrieveMembershipsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveMembershipsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveMembershipsRequest other) { + return this; + } + + public RetrieveMembershipsRequest build() { + return new RetrieveMembershipsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/requests/TransferMembershipsRequest.java b/src/main/java/com/whop/api/resources/memberships/requests/TransferMembershipsRequest.java new file mode 100644 index 00000000..684eb3ce --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/requests/TransferMembershipsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TransferMembershipsRequest.Builder.class) +public final class TransferMembershipsRequest { + private final Map additionalProperties; + + private TransferMembershipsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferMembershipsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TransferMembershipsRequest other) { + return this; + } + + public TransferMembershipsRequest build() { + return new TransferMembershipsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/requests/UncancelMembershipRequest.java b/src/main/java/com/whop/api/resources/memberships/requests/UncancelMembershipRequest.java new file mode 100644 index 00000000..a4bde8df --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/requests/UncancelMembershipRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UncancelMembershipRequest.Builder.class) +public final class UncancelMembershipRequest { + private final Map additionalProperties; + + private UncancelMembershipRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UncancelMembershipRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UncancelMembershipRequest other) { + return this; + } + + public UncancelMembershipRequest build() { + return new UncancelMembershipRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/requests/UpdateMembershipsRequest.java b/src/main/java/com/whop/api/resources/memberships/requests/UpdateMembershipsRequest.java new file mode 100644 index 00000000..243936a9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/requests/UpdateMembershipsRequest.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateMembershipsRequest.Builder.class) +public final class UpdateMembershipsRequest { + private final Optional cancelAtPeriodEnd; + + private final Optional> metadata; + + private final Map additionalProperties; + + private UpdateMembershipsRequest( + Optional cancelAtPeriodEnd, + Optional> metadata, + Map additionalProperties) { + this.cancelAtPeriodEnd = cancelAtPeriodEnd; + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + /** + * @return true cancels at the end of the current billing period (the customer keeps access until then); false reverses a pending cancellation. + */ + @JsonProperty("cancel_at_period_end") + public Optional getCancelAtPeriodEnd() { + return cancelAtPeriodEnd; + } + + /** + * @return Key-value pairs to merge into the membership's metadata. Pass an empty object to clear it. + */ + @JsonProperty("metadata") + public Optional> getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateMembershipsRequest && equalTo((UpdateMembershipsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateMembershipsRequest other) { + return cancelAtPeriodEnd.equals(other.cancelAtPeriodEnd) && metadata.equals(other.metadata); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cancelAtPeriodEnd, this.metadata); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional cancelAtPeriodEnd = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateMembershipsRequest other) { + cancelAtPeriodEnd(other.getCancelAtPeriodEnd()); + metadata(other.getMetadata()); + return this; + } + + /** + *

true cancels at the end of the current billing period (the customer keeps access until then); false reverses a pending cancellation.

+ */ + @JsonSetter(value = "cancel_at_period_end", nulls = Nulls.SKIP) + public Builder cancelAtPeriodEnd(Optional cancelAtPeriodEnd) { + this.cancelAtPeriodEnd = cancelAtPeriodEnd; + return this; + } + + public Builder cancelAtPeriodEnd(Boolean cancelAtPeriodEnd) { + this.cancelAtPeriodEnd = Optional.ofNullable(cancelAtPeriodEnd); + return this; + } + + /** + *

Key-value pairs to merge into the membership's metadata. Pass an empty object to clear it.

+ */ + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + public UpdateMembershipsRequest build() { + return new UpdateMembershipsRequest(cancelAtPeriodEnd, metadata, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/InviteMembershipsRequestBody.java b/src/main/java/com/whop/api/resources/memberships/types/InviteMembershipsRequestBody.java new file mode 100644 index 00000000..c2fa0149 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/InviteMembershipsRequestBody.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Map; +import java.util.Objects; + +@JsonDeserialize(using = InviteMembershipsRequestBody.Deserializer.class) +public final class InviteMembershipsRequestBody { + private final Object value; + + private final int type; + + private InviteMembershipsRequestBody(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((InviteMembershipsRequestBodyUserId) this.value); + } else if (this.type == 1) { + return visitor.visit((InviteMembershipsRequestBodyEmail) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InviteMembershipsRequestBody && equalTo((InviteMembershipsRequestBody) other); + } + + private boolean equalTo(InviteMembershipsRequestBody other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static InviteMembershipsRequestBody of(InviteMembershipsRequestBodyUserId value) { + return new InviteMembershipsRequestBody(value, 0); + } + + public static InviteMembershipsRequestBody of(InviteMembershipsRequestBodyEmail value) { + return new InviteMembershipsRequestBody(value, 1); + } + + public interface Visitor { + T visit(InviteMembershipsRequestBodyUserId value); + + T visit(InviteMembershipsRequestBodyEmail value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(InviteMembershipsRequestBody.class); + } + + @java.lang.Override + public InviteMembershipsRequestBody deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Map + && ((Map) value).containsKey("plan_id") + && ((Map) value).containsKey("user_id")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, InviteMembershipsRequestBodyUserId.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map + && ((Map) value).containsKey("email") + && ((Map) value).containsKey("plan_id")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, InviteMembershipsRequestBodyEmail.class)); + } catch (RuntimeException e) { + } + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/InviteMembershipsRequestBodyEmail.java b/src/main/java/com/whop/api/resources/memberships/types/InviteMembershipsRequestBodyEmail.java new file mode 100644 index 00000000..41af7049 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/InviteMembershipsRequestBodyEmail.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InviteMembershipsRequestBodyEmail.Builder.class) +public final class InviteMembershipsRequestBodyEmail { + private final String email; + + private final String planId; + + private final Map additionalProperties; + + private InviteMembershipsRequestBodyEmail(String email, String planId, Map additionalProperties) { + this.email = email; + this.planId = planId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Recipient email address. + */ + @JsonProperty("email") + public String getEmail() { + return email; + } + + /** + * @return Free plan whose membership the recipient is invited to, prefixed plan_. + */ + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InviteMembershipsRequestBodyEmail && equalTo((InviteMembershipsRequestBodyEmail) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InviteMembershipsRequestBodyEmail other) { + return email.equals(other.email) && planId.equals(other.planId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.planId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EmailStage builder() { + return new Builder(); + } + + public interface EmailStage { + /** + *

Recipient email address.

+ */ + PlanIdStage email(@NotNull String email); + + Builder from(InviteMembershipsRequestBodyEmail other); + } + + public interface PlanIdStage { + /** + *

Free plan whose membership the recipient is invited to, prefixed plan_.

+ */ + _FinalStage planId(@NotNull String planId); + } + + public interface _FinalStage { + InviteMembershipsRequestBodyEmail build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EmailStage, PlanIdStage, _FinalStage { + private String email; + + private String planId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InviteMembershipsRequestBodyEmail other) { + email(other.getEmail()); + planId(other.getPlanId()); + return this; + } + + /** + *

Recipient email address.

+ *

Recipient email address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("email") + public PlanIdStage email(@NotNull String email) { + this.email = Objects.requireNonNull(email, "email must not be null"); + return this; + } + + /** + *

Free plan whose membership the recipient is invited to, prefixed plan_.

+ *

Free plan whose membership the recipient is invited to, prefixed plan_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan_id") + public _FinalStage planId(@NotNull String planId) { + this.planId = Objects.requireNonNull(planId, "planId must not be null"); + return this; + } + + @java.lang.Override + public InviteMembershipsRequestBodyEmail build() { + return new InviteMembershipsRequestBodyEmail(email, planId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/InviteMembershipsRequestBodyUserId.java b/src/main/java/com/whop/api/resources/memberships/types/InviteMembershipsRequestBodyUserId.java new file mode 100644 index 00000000..434d82ed --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/InviteMembershipsRequestBodyUserId.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InviteMembershipsRequestBodyUserId.Builder.class) +public final class InviteMembershipsRequestBodyUserId { + private final String planId; + + private final String userId; + + private final Map additionalProperties; + + private InviteMembershipsRequestBodyUserId(String planId, String userId, Map additionalProperties) { + this.planId = planId; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Free plan whose membership the recipient is invited to, prefixed plan_. + */ + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + /** + * @return Recipient user ID, prefixed user_. + */ + @JsonProperty("user_id") + public String getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InviteMembershipsRequestBodyUserId + && equalTo((InviteMembershipsRequestBodyUserId) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InviteMembershipsRequestBodyUserId other) { + return planId.equals(other.planId) && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.planId, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlanIdStage builder() { + return new Builder(); + } + + public interface PlanIdStage { + /** + *

Free plan whose membership the recipient is invited to, prefixed plan_.

+ */ + UserIdStage planId(@NotNull String planId); + + Builder from(InviteMembershipsRequestBodyUserId other); + } + + public interface UserIdStage { + /** + *

Recipient user ID, prefixed user_.

+ */ + _FinalStage userId(@NotNull String userId); + } + + public interface _FinalStage { + InviteMembershipsRequestBodyUserId build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlanIdStage, UserIdStage, _FinalStage { + private String planId; + + private String userId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InviteMembershipsRequestBodyUserId other) { + planId(other.getPlanId()); + userId(other.getUserId()); + return this; + } + + /** + *

Free plan whose membership the recipient is invited to, prefixed plan_.

+ *

Free plan whose membership the recipient is invited to, prefixed plan_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan_id") + public UserIdStage planId(@NotNull String planId) { + this.planId = Objects.requireNonNull(planId, "planId must not be null"); + return this; + } + + /** + *

Recipient user ID, prefixed user_.

+ *

Recipient user ID, prefixed user_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user_id") + public _FinalStage userId(@NotNull String userId) { + this.userId = Objects.requireNonNull(userId, "userId must not be null"); + return this; + } + + @java.lang.Override + public InviteMembershipsRequestBodyUserId build() { + return new InviteMembershipsRequestBodyUserId(planId, userId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/InviteMembershipsResponse.java b/src/main/java/com/whop/api/resources/memberships/types/InviteMembershipsResponse.java new file mode 100644 index 00000000..d53f871b --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/InviteMembershipsResponse.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InviteMembershipsResponse.Builder.class) +public final class InviteMembershipsResponse { + private final boolean invitationSent; + + private final Map additionalProperties; + + private InviteMembershipsResponse(boolean invitationSent, Map additionalProperties) { + this.invitationSent = invitationSent; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("invitation_sent") + public boolean getInvitationSent() { + return invitationSent; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InviteMembershipsResponse && equalTo((InviteMembershipsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InviteMembershipsResponse other) { + return invitationSent == other.invitationSent; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.invitationSent); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static InvitationSentStage builder() { + return new Builder(); + } + + public interface InvitationSentStage { + _FinalStage invitationSent(boolean invitationSent); + + Builder from(InviteMembershipsResponse other); + } + + public interface _FinalStage { + InviteMembershipsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements InvitationSentStage, _FinalStage { + private boolean invitationSent; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InviteMembershipsResponse other) { + invitationSent(other.getInvitationSent()); + return this; + } + + @java.lang.Override + @JsonSetter("invitation_sent") + public _FinalStage invitationSent(boolean invitationSent) { + this.invitationSent = invitationSent; + return this; + } + + @java.lang.Override + public InviteMembershipsResponse build() { + return new InviteMembershipsResponse(invitationSent, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/ListMembershipsRequestDirection.java b/src/main/java/com/whop/api/resources/memberships/types/ListMembershipsRequestDirection.java new file mode 100644 index 00000000..93452fce --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/ListMembershipsRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListMembershipsRequestDirection { + public static final ListMembershipsRequestDirection ASC = new ListMembershipsRequestDirection(Value.ASC, "asc"); + + public static final ListMembershipsRequestDirection DESC = new ListMembershipsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListMembershipsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListMembershipsRequestDirection + && this.string.equals(((ListMembershipsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListMembershipsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListMembershipsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/ListMembershipsRequestOrder.java b/src/main/java/com/whop/api/resources/memberships/types/ListMembershipsRequestOrder.java new file mode 100644 index 00000000..52b25f42 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/ListMembershipsRequestOrder.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListMembershipsRequestOrder { + public static final ListMembershipsRequestOrder CREATED_AT = + new ListMembershipsRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListMembershipsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListMembershipsRequestOrder + && this.string.equals(((ListMembershipsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListMembershipsRequestOrder valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + default: + return new ListMembershipsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/ListMembershipsRequestStatus.java b/src/main/java/com/whop/api/resources/memberships/types/ListMembershipsRequestStatus.java new file mode 100644 index 00000000..340f2669 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/ListMembershipsRequestStatus.java @@ -0,0 +1,150 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListMembershipsRequestStatus { + public static final ListMembershipsRequestStatus PAST_DUE = + new ListMembershipsRequestStatus(Value.PAST_DUE, "past_due"); + + public static final ListMembershipsRequestStatus CANCELED = + new ListMembershipsRequestStatus(Value.CANCELED, "canceled"); + + public static final ListMembershipsRequestStatus COMPLETED = + new ListMembershipsRequestStatus(Value.COMPLETED, "completed"); + + public static final ListMembershipsRequestStatus EXPIRED = + new ListMembershipsRequestStatus(Value.EXPIRED, "expired"); + + public static final ListMembershipsRequestStatus PAUSED = new ListMembershipsRequestStatus(Value.PAUSED, "paused"); + + public static final ListMembershipsRequestStatus CANCELING = + new ListMembershipsRequestStatus(Value.CANCELING, "canceling"); + + public static final ListMembershipsRequestStatus TRIALING = + new ListMembershipsRequestStatus(Value.TRIALING, "trialing"); + + public static final ListMembershipsRequestStatus ACTIVE = new ListMembershipsRequestStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + ListMembershipsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListMembershipsRequestStatus + && this.string.equals(((ListMembershipsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAST_DUE: + return visitor.visitPastDue(); + case CANCELED: + return visitor.visitCanceled(); + case COMPLETED: + return visitor.visitCompleted(); + case EXPIRED: + return visitor.visitExpired(); + case PAUSED: + return visitor.visitPaused(); + case CANCELING: + return visitor.visitCanceling(); + case TRIALING: + return visitor.visitTrialing(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListMembershipsRequestStatus valueOf(String value) { + switch (value) { + case "past_due": + return PAST_DUE; + case "canceled": + return CANCELED; + case "completed": + return COMPLETED; + case "expired": + return EXPIRED; + case "paused": + return PAUSED; + case "canceling": + return CANCELING; + case "trialing": + return TRIALING; + case "active": + return ACTIVE; + default: + return new ListMembershipsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + TRIALING, + + PAST_DUE, + + COMPLETED, + + CANCELED, + + EXPIRED, + + CANCELING, + + PAUSED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitTrialing(); + + T visitPastDue(); + + T visitCompleted(); + + T visitCanceled(); + + T visitExpired(); + + T visitCanceling(); + + T visitPaused(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/ListMembershipsResponse.java b/src/main/java/com/whop/api/resources/memberships/types/ListMembershipsResponse.java new file mode 100644 index 00000000..46b1666a --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/ListMembershipsResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Membership; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMembershipsResponse.Builder.class) +public final class ListMembershipsResponse { + private final List data; + + private final ListMembershipsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListMembershipsResponse( + List data, ListMembershipsResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListMembershipsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMembershipsResponse && equalTo((ListMembershipsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMembershipsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListMembershipsResponsePageInfo pageInfo); + + Builder from(ListMembershipsResponse other); + } + + public interface _FinalStage { + ListMembershipsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(Membership data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListMembershipsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMembershipsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListMembershipsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(Membership data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListMembershipsResponse build() { + return new ListMembershipsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/ListMembershipsResponsePageInfo.java b/src/main/java/com/whop/api/resources/memberships/types/ListMembershipsResponsePageInfo.java new file mode 100644 index 00000000..35498a7e --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/ListMembershipsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMembershipsResponsePageInfo.Builder.class) +public final class ListMembershipsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListMembershipsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMembershipsResponsePageInfo && equalTo((ListMembershipsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMembershipsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListMembershipsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListMembershipsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMembershipsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListMembershipsResponsePageInfo build() { + return new ListMembershipsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/PostMembershipActivatedPayload.java b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipActivatedPayload.java new file mode 100644 index 00000000..37e32ae5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipActivatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Membership; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostMembershipActivatedPayload.Builder.class) +public final class PostMembershipActivatedPayload { + private final Optional accountId; + + private final PostMembershipActivatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Membership data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostMembershipActivatedPayloadType type; + + private final Map additionalProperties; + + private PostMembershipActivatedPayload( + Optional accountId, + PostMembershipActivatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Membership data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostMembershipActivatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostMembershipActivatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Membership getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostMembershipActivatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostMembershipActivatedPayload && equalTo((PostMembershipActivatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostMembershipActivatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostMembershipActivatedPayloadApiVersion apiVersion); + + Builder from(PostMembershipActivatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Membership data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostMembershipActivatedPayloadType type); + } + + public interface _FinalStage { + PostMembershipActivatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostMembershipActivatedPayloadApiVersion apiVersion; + + private Membership data; + + private String id; + + private OffsetDateTime timestamp; + + private PostMembershipActivatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostMembershipActivatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostMembershipActivatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Membership data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostMembershipActivatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostMembershipActivatedPayload build() { + return new PostMembershipActivatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/PostMembershipActivatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipActivatedPayloadApiVersion.java new file mode 100644 index 00000000..9cb0a987 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipActivatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostMembershipActivatedPayloadApiVersion { + public static final PostMembershipActivatedPayloadApiVersion V1 = + new PostMembershipActivatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostMembershipActivatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostMembershipActivatedPayloadApiVersion + && this.string.equals(((PostMembershipActivatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostMembershipActivatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostMembershipActivatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/PostMembershipActivatedPayloadType.java b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipActivatedPayloadType.java new file mode 100644 index 00000000..d148a84c --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipActivatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostMembershipActivatedPayloadType { + public static final PostMembershipActivatedPayloadType MEMBERSHIP_ACTIVATED = + new PostMembershipActivatedPayloadType(Value.MEMBERSHIP_ACTIVATED, "membership.activated"); + + private final Value value; + + private final String string; + + PostMembershipActivatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostMembershipActivatedPayloadType + && this.string.equals(((PostMembershipActivatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MEMBERSHIP_ACTIVATED: + return visitor.visitMembershipActivated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostMembershipActivatedPayloadType valueOf(String value) { + switch (value) { + case "membership.activated": + return MEMBERSHIP_ACTIVATED; + default: + return new PostMembershipActivatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + MEMBERSHIP_ACTIVATED, + + UNKNOWN + } + + public interface Visitor { + T visitMembershipActivated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/PostMembershipCancelAtPeriodEndChangedPayload.java b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipCancelAtPeriodEndChangedPayload.java new file mode 100644 index 00000000..a6a3abf3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipCancelAtPeriodEndChangedPayload.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Membership; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostMembershipCancelAtPeriodEndChangedPayload.Builder.class) +public final class PostMembershipCancelAtPeriodEndChangedPayload { + private final Optional accountId; + + private final PostMembershipCancelAtPeriodEndChangedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Membership data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostMembershipCancelAtPeriodEndChangedPayloadType type; + + private final Map additionalProperties; + + private PostMembershipCancelAtPeriodEndChangedPayload( + Optional accountId, + PostMembershipCancelAtPeriodEndChangedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Membership data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostMembershipCancelAtPeriodEndChangedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostMembershipCancelAtPeriodEndChangedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Membership getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostMembershipCancelAtPeriodEndChangedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostMembershipCancelAtPeriodEndChangedPayload + && equalTo((PostMembershipCancelAtPeriodEndChangedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostMembershipCancelAtPeriodEndChangedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostMembershipCancelAtPeriodEndChangedPayloadApiVersion apiVersion); + + Builder from(PostMembershipCancelAtPeriodEndChangedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Membership data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostMembershipCancelAtPeriodEndChangedPayloadType type); + } + + public interface _FinalStage { + PostMembershipCancelAtPeriodEndChangedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostMembershipCancelAtPeriodEndChangedPayloadApiVersion apiVersion; + + private Membership data; + + private String id; + + private OffsetDateTime timestamp; + + private PostMembershipCancelAtPeriodEndChangedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostMembershipCancelAtPeriodEndChangedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostMembershipCancelAtPeriodEndChangedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Membership data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostMembershipCancelAtPeriodEndChangedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostMembershipCancelAtPeriodEndChangedPayload build() { + return new PostMembershipCancelAtPeriodEndChangedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/PostMembershipCancelAtPeriodEndChangedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipCancelAtPeriodEndChangedPayloadApiVersion.java new file mode 100644 index 00000000..b011a11c --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipCancelAtPeriodEndChangedPayloadApiVersion.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostMembershipCancelAtPeriodEndChangedPayloadApiVersion { + public static final PostMembershipCancelAtPeriodEndChangedPayloadApiVersion V1 = + new PostMembershipCancelAtPeriodEndChangedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostMembershipCancelAtPeriodEndChangedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostMembershipCancelAtPeriodEndChangedPayloadApiVersion + && this.string.equals( + ((PostMembershipCancelAtPeriodEndChangedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostMembershipCancelAtPeriodEndChangedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostMembershipCancelAtPeriodEndChangedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/PostMembershipCancelAtPeriodEndChangedPayloadType.java b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipCancelAtPeriodEndChangedPayloadType.java new file mode 100644 index 00000000..3e8c1cd9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipCancelAtPeriodEndChangedPayloadType.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostMembershipCancelAtPeriodEndChangedPayloadType { + public static final PostMembershipCancelAtPeriodEndChangedPayloadType MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED = + new PostMembershipCancelAtPeriodEndChangedPayloadType( + Value.MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, "membership.cancel_at_period_end_changed"); + + private final Value value; + + private final String string; + + PostMembershipCancelAtPeriodEndChangedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostMembershipCancelAtPeriodEndChangedPayloadType + && this.string.equals(((PostMembershipCancelAtPeriodEndChangedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED: + return visitor.visitMembershipCancelAtPeriodEndChanged(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostMembershipCancelAtPeriodEndChangedPayloadType valueOf(String value) { + switch (value) { + case "membership.cancel_at_period_end_changed": + return MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED; + default: + return new PostMembershipCancelAtPeriodEndChangedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, + + UNKNOWN + } + + public interface Visitor { + T visitMembershipCancelAtPeriodEndChanged(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/PostMembershipDeactivatedPayload.java b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipDeactivatedPayload.java new file mode 100644 index 00000000..95e59f7c --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipDeactivatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Membership; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostMembershipDeactivatedPayload.Builder.class) +public final class PostMembershipDeactivatedPayload { + private final Optional accountId; + + private final PostMembershipDeactivatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Membership data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostMembershipDeactivatedPayloadType type; + + private final Map additionalProperties; + + private PostMembershipDeactivatedPayload( + Optional accountId, + PostMembershipDeactivatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Membership data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostMembershipDeactivatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostMembershipDeactivatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Membership getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostMembershipDeactivatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostMembershipDeactivatedPayload && equalTo((PostMembershipDeactivatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostMembershipDeactivatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostMembershipDeactivatedPayloadApiVersion apiVersion); + + Builder from(PostMembershipDeactivatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Membership data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostMembershipDeactivatedPayloadType type); + } + + public interface _FinalStage { + PostMembershipDeactivatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostMembershipDeactivatedPayloadApiVersion apiVersion; + + private Membership data; + + private String id; + + private OffsetDateTime timestamp; + + private PostMembershipDeactivatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostMembershipDeactivatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostMembershipDeactivatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Membership data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostMembershipDeactivatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostMembershipDeactivatedPayload build() { + return new PostMembershipDeactivatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/PostMembershipDeactivatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipDeactivatedPayloadApiVersion.java new file mode 100644 index 00000000..96f3eb9e --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipDeactivatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostMembershipDeactivatedPayloadApiVersion { + public static final PostMembershipDeactivatedPayloadApiVersion V1 = + new PostMembershipDeactivatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostMembershipDeactivatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostMembershipDeactivatedPayloadApiVersion + && this.string.equals(((PostMembershipDeactivatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostMembershipDeactivatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostMembershipDeactivatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/PostMembershipDeactivatedPayloadType.java b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipDeactivatedPayloadType.java new file mode 100644 index 00000000..b9845628 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipDeactivatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostMembershipDeactivatedPayloadType { + public static final PostMembershipDeactivatedPayloadType MEMBERSHIP_DEACTIVATED = + new PostMembershipDeactivatedPayloadType(Value.MEMBERSHIP_DEACTIVATED, "membership.deactivated"); + + private final Value value; + + private final String string; + + PostMembershipDeactivatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostMembershipDeactivatedPayloadType + && this.string.equals(((PostMembershipDeactivatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MEMBERSHIP_DEACTIVATED: + return visitor.visitMembershipDeactivated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostMembershipDeactivatedPayloadType valueOf(String value) { + switch (value) { + case "membership.deactivated": + return MEMBERSHIP_DEACTIVATED; + default: + return new PostMembershipDeactivatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + MEMBERSHIP_DEACTIVATED, + + UNKNOWN + } + + public interface Visitor { + T visitMembershipDeactivated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/PostMembershipTrialEndingSoonPayload.java b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipTrialEndingSoonPayload.java new file mode 100644 index 00000000..33269b68 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipTrialEndingSoonPayload.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Membership; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostMembershipTrialEndingSoonPayload.Builder.class) +public final class PostMembershipTrialEndingSoonPayload { + private final Optional accountId; + + private final PostMembershipTrialEndingSoonPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Membership data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostMembershipTrialEndingSoonPayloadType type; + + private final Map additionalProperties; + + private PostMembershipTrialEndingSoonPayload( + Optional accountId, + PostMembershipTrialEndingSoonPayloadApiVersion apiVersion, + Optional apiVersionDate, + Membership data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostMembershipTrialEndingSoonPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostMembershipTrialEndingSoonPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Membership getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostMembershipTrialEndingSoonPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostMembershipTrialEndingSoonPayload + && equalTo((PostMembershipTrialEndingSoonPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostMembershipTrialEndingSoonPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostMembershipTrialEndingSoonPayloadApiVersion apiVersion); + + Builder from(PostMembershipTrialEndingSoonPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Membership data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostMembershipTrialEndingSoonPayloadType type); + } + + public interface _FinalStage { + PostMembershipTrialEndingSoonPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostMembershipTrialEndingSoonPayloadApiVersion apiVersion; + + private Membership data; + + private String id; + + private OffsetDateTime timestamp; + + private PostMembershipTrialEndingSoonPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostMembershipTrialEndingSoonPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostMembershipTrialEndingSoonPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Membership data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostMembershipTrialEndingSoonPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostMembershipTrialEndingSoonPayload build() { + return new PostMembershipTrialEndingSoonPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/PostMembershipTrialEndingSoonPayloadApiVersion.java b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipTrialEndingSoonPayloadApiVersion.java new file mode 100644 index 00000000..c0e4a7b5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipTrialEndingSoonPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostMembershipTrialEndingSoonPayloadApiVersion { + public static final PostMembershipTrialEndingSoonPayloadApiVersion V1 = + new PostMembershipTrialEndingSoonPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostMembershipTrialEndingSoonPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostMembershipTrialEndingSoonPayloadApiVersion + && this.string.equals(((PostMembershipTrialEndingSoonPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostMembershipTrialEndingSoonPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostMembershipTrialEndingSoonPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/PostMembershipTrialEndingSoonPayloadType.java b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipTrialEndingSoonPayloadType.java new file mode 100644 index 00000000..478188a9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/PostMembershipTrialEndingSoonPayloadType.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostMembershipTrialEndingSoonPayloadType { + public static final PostMembershipTrialEndingSoonPayloadType MEMBERSHIP_TRIAL_ENDING_SOON = + new PostMembershipTrialEndingSoonPayloadType( + Value.MEMBERSHIP_TRIAL_ENDING_SOON, "membership.trial_ending_soon"); + + private final Value value; + + private final String string; + + PostMembershipTrialEndingSoonPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostMembershipTrialEndingSoonPayloadType + && this.string.equals(((PostMembershipTrialEndingSoonPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MEMBERSHIP_TRIAL_ENDING_SOON: + return visitor.visitMembershipTrialEndingSoon(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostMembershipTrialEndingSoonPayloadType valueOf(String value) { + switch (value) { + case "membership.trial_ending_soon": + return MEMBERSHIP_TRIAL_ENDING_SOON; + default: + return new PostMembershipTrialEndingSoonPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + MEMBERSHIP_TRIAL_ENDING_SOON, + + UNKNOWN + } + + public interface Visitor { + T visitMembershipTrialEndingSoon(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/memberships/types/TransferMembershipsResponse.java b/src/main/java/com/whop/api/resources/memberships/types/TransferMembershipsResponse.java new file mode 100644 index 00000000..d1da4e58 --- /dev/null +++ b/src/main/java/com/whop/api/resources/memberships/types/TransferMembershipsResponse.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.memberships.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TransferMembershipsResponse.Builder.class) +public final class TransferMembershipsResponse { + private final String url; + + private final Map additionalProperties; + + private TransferMembershipsResponse(String url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return One-use URL the destination account opens to claim the membership. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferMembershipsResponse && equalTo((TransferMembershipsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TransferMembershipsResponse other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

One-use URL the destination account opens to claim the membership.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(TransferMembershipsResponse other); + } + + public interface _FinalStage { + TransferMembershipsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TransferMembershipsResponse other) { + url(other.getUrl()); + return this; + } + + /** + *

One-use URL the destination account opens to claim the membership.

+ *

One-use URL the destination account opens to claim the membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public TransferMembershipsResponse build() { + return new TransferMembershipsResponse(url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/messages/AsyncMessagesClient.java b/src/main/java/com/whop/api/resources/messages/AsyncMessagesClient.java new file mode 100644 index 00000000..d8a803e3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/AsyncMessagesClient.java @@ -0,0 +1,258 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.messages.requests.CreateMessagesRequest; +import com.whop.api.resources.messages.requests.DeleteMessagesRequest; +import com.whop.api.resources.messages.requests.ListMessagesRequest; +import com.whop.api.resources.messages.requests.RetrieveMessagesRequest; +import com.whop.api.resources.messages.requests.UpdateMessagesRequest; +import com.whop.api.types.Message; +import com.whop.api.types.MessageListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncMessagesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawMessagesClient rawClient; + + public AsyncMessagesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawMessagesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawMessagesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of messages within a specific experience chat, DM, or group chat channel, sorted by creation time. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> list(ListMessagesRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of messages within a specific experience chat, DM, or group chat channel, sorted by creation time. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> list( + ListMessagesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Send a new message in an experience chat, DM, or group chat channel. Supports text content, attachments, polls, and replies. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture create(CreateMessagesRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Send a new message in an experience chat, DM, or group chat channel. Supports text content, attachments, polls, and replies. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture create(CreateMessagesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveMessagesRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveMessagesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public CompletableFuture delete(String id, DeleteMessagesRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public CompletableFuture delete(String id, DeleteMessagesRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture update(String id, UpdateMessagesRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture update(String id, UpdateMessagesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/messages/AsyncRawMessagesClient.java b/src/main/java/com/whop/api/resources/messages/AsyncRawMessagesClient.java new file mode 100644 index 00000000..b6288a27 --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/AsyncRawMessagesClient.java @@ -0,0 +1,760 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.messages.requests.CreateMessagesRequest; +import com.whop.api.resources.messages.requests.DeleteMessagesRequest; +import com.whop.api.resources.messages.requests.ListMessagesRequest; +import com.whop.api.resources.messages.requests.RetrieveMessagesRequest; +import com.whop.api.resources.messages.requests.UpdateMessagesRequest; +import com.whop.api.resources.messages.types.ListMessagesResponse; +import com.whop.api.types.Message; +import com.whop.api.types.MessageListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawMessagesClient { + protected final ClientOptions clientOptions; + + public AsyncRawMessagesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of messages within a specific experience chat, DM, or group chat channel, sorted by creation time. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture>> list( + ListMessagesRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of messages within a specific experience chat, DM, or group chat channel, sorted by creation time. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture>> list( + ListMessagesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("messages"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "channel_id", request.getChannelId(), false); + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListMessagesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListMessagesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListMessagesRequest nextRequest = ListMessagesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Send a new message in an experience chat, DM, or group chat channel. Supports text content, attachments, polls, and replies. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture> create(CreateMessagesRequest request) { + return create(request, null); + } + + /** + * Send a new message in an experience chat, DM, or group chat channel. Supports text content, attachments, polls, and replies. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture> create( + CreateMessagesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("messages"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Message.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveMessagesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveMessagesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RetrieveMessagesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveMessagesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("messages") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Message.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteMessagesRequest.builder().build()); + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteMessagesRequest.builder().build(), requestOptions); + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public CompletableFuture> delete(String id, DeleteMessagesRequest request) { + return delete(id, request, null); + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public CompletableFuture> delete( + String id, DeleteMessagesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("messages") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture> update(String id) { + return update(id, UpdateMessagesRequest.builder().build()); + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateMessagesRequest.builder().build(), requestOptions); + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture> update(String id, UpdateMessagesRequest request) { + return update(id, request, null); + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public CompletableFuture> update( + String id, UpdateMessagesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("messages") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Message.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/messages/MessagesClient.java b/src/main/java/com/whop/api/resources/messages/MessagesClient.java new file mode 100644 index 00000000..d4e75cd5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/MessagesClient.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.messages.requests.CreateMessagesRequest; +import com.whop.api.resources.messages.requests.DeleteMessagesRequest; +import com.whop.api.resources.messages.requests.ListMessagesRequest; +import com.whop.api.resources.messages.requests.RetrieveMessagesRequest; +import com.whop.api.resources.messages.requests.UpdateMessagesRequest; +import com.whop.api.types.Message; +import com.whop.api.types.MessageListItem; + +public class MessagesClient { + protected final ClientOptions clientOptions; + + private final RawMessagesClient rawClient; + + public MessagesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawMessagesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawMessagesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of messages within a specific experience chat, DM, or group chat channel, sorted by creation time. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public SyncPagingIterable list(ListMessagesRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of messages within a specific experience chat, DM, or group chat channel, sorted by creation time. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public SyncPagingIterable list(ListMessagesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Send a new message in an experience chat, DM, or group chat channel. Supports text content, attachments, polls, and replies. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public Message create(CreateMessagesRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Send a new message in an experience chat, DM, or group chat channel. Supports text content, attachments, polls, and replies. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public Message create(CreateMessagesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public Message retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public Message retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public Message retrieve(String id, RetrieveMessagesRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public Message retrieve(String id, RetrieveMessagesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public boolean delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public boolean delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public boolean delete(String id, DeleteMessagesRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public boolean delete(String id, DeleteMessagesRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public Message update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public Message update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public Message update(String id, UpdateMessagesRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public Message update(String id, UpdateMessagesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/messages/RawMessagesClient.java b/src/main/java/com/whop/api/resources/messages/RawMessagesClient.java new file mode 100644 index 00000000..239f8356 --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/RawMessagesClient.java @@ -0,0 +1,610 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.messages.requests.CreateMessagesRequest; +import com.whop.api.resources.messages.requests.DeleteMessagesRequest; +import com.whop.api.resources.messages.requests.ListMessagesRequest; +import com.whop.api.resources.messages.requests.RetrieveMessagesRequest; +import com.whop.api.resources.messages.requests.UpdateMessagesRequest; +import com.whop.api.resources.messages.types.ListMessagesResponse; +import com.whop.api.types.Message; +import com.whop.api.types.MessageListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawMessagesClient { + protected final ClientOptions clientOptions; + + public RawMessagesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of messages within a specific experience chat, DM, or group chat channel, sorted by creation time. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListMessagesRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of messages within a specific experience chat, DM, or group chat channel, sorted by creation time. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListMessagesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("messages"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "channel_id", request.getChannelId(), false); + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListMessagesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListMessagesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListMessagesRequest nextRequest = ListMessagesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Send a new message in an experience chat, DM, or group chat channel. Supports text content, attachments, polls, and replies. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public WhopApiHttpResponse create(CreateMessagesRequest request) { + return create(request, null); + } + + /** + * Send a new message in an experience chat, DM, or group chat channel. Supports text content, attachments, polls, and replies. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public WhopApiHttpResponse create(CreateMessagesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("messages"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Message.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveMessagesRequest.builder().build()); + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveMessagesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveMessagesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing message. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveMessagesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("messages") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Message.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteMessagesRequest.builder().build()); + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteMessagesRequest.builder().build(), requestOptions); + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public WhopApiHttpResponse delete(String id, DeleteMessagesRequest request) { + return delete(id, request, null); + } + + /** + * Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create and chat:read
  • + *
  • dms:message:manage and dms:read
  • + *
  • livestream:chat:write and livestream:chat:read
  • + *
  • support_chat:message:create and support_chat:read
  • + *
+ */ + public WhopApiHttpResponse delete( + String id, DeleteMessagesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("messages") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateMessagesRequest.builder().build()); + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateMessagesRequest.builder().build(), requestOptions); + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public WhopApiHttpResponse update(String id, UpdateMessagesRequest request) { + return update(id, request, null); + } + + /** + * Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel. + *

Required permissions (one of):

+ *
    + *
  • chat:message:create
  • + *
  • dms:message:manage
  • + *
  • livestream:chat:write
  • + *
  • support_chat:message:create
  • + *
+ */ + public WhopApiHttpResponse update( + String id, UpdateMessagesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("messages") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Message.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/messages/requests/CreateMessagesRequest.java b/src/main/java/com/whop/api/resources/messages/requests/CreateMessagesRequest.java new file mode 100644 index 00000000..94acf6c8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/requests/CreateMessagesRequest.java @@ -0,0 +1,461 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.messages.types.CreateMessagesRequestAttachmentsItem; +import com.whop.api.resources.messages.types.CreateMessagesRequestPoll; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateMessagesRequest.Builder.class) +public final class CreateMessagesRequest { + private final Optional> attachments; + + private final Optional autoDetectLinks; + + private final String channelId; + + private final String content; + + private final Optional poll; + + private final Optional replyingToMessageId; + + private final Map additionalProperties; + + private CreateMessagesRequest( + Optional> attachments, + Optional autoDetectLinks, + String channelId, + String content, + Optional poll, + Optional replyingToMessageId, + Map additionalProperties) { + this.attachments = attachments; + this.autoDetectLinks = autoDetectLinks; + this.channelId = channelId; + this.content = content; + this.poll = poll; + this.replyingToMessageId = replyingToMessageId; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of file attachments to include with the message, such as images or videos. + */ + @JsonIgnore + public Optional> getAttachments() { + if (attachments == null) { + return Optional.empty(); + } + return attachments; + } + + /** + * @return Automatically detect URLs in the message and generate link previews. + */ + @JsonIgnore + public Optional getAutoDetectLinks() { + if (autoDetectLinks == null) { + return Optional.empty(); + } + return autoDetectLinks; + } + + /** + * @return The unique identifier of the channel or experience to send the message in. For example, 'exp_xxxxx' or 'feed_xxxxx'. + */ + @JsonProperty("channel_id") + public String getChannelId() { + return channelId; + } + + /** + * @return The body of the message in Markdown format. For example, 'Hello world'. + */ + @JsonProperty("content") + public String getContent() { + return content; + } + + /** + * @return A poll to attach to this message, allowing recipients to vote on options. + */ + @JsonIgnore + public Optional getPoll() { + if (poll == null) { + return Optional.empty(); + } + return poll; + } + + /** + * @return The unique identifier of the message this is replying to, creating a threaded reply. + */ + @JsonIgnore + public Optional getReplyingToMessageId() { + if (replyingToMessageId == null) { + return Optional.empty(); + } + return replyingToMessageId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("attachments") + private Optional> _getAttachments() { + return attachments; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("auto_detect_links") + private Optional _getAutoDetectLinks() { + return autoDetectLinks; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("poll") + private Optional _getPoll() { + return poll; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("replying_to_message_id") + private Optional _getReplyingToMessageId() { + return replyingToMessageId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateMessagesRequest && equalTo((CreateMessagesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateMessagesRequest other) { + return attachments.equals(other.attachments) + && autoDetectLinks.equals(other.autoDetectLinks) + && channelId.equals(other.channelId) + && content.equals(other.content) + && poll.equals(other.poll) + && replyingToMessageId.equals(other.replyingToMessageId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.attachments, + this.autoDetectLinks, + this.channelId, + this.content, + this.poll, + this.replyingToMessageId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChannelIdStage builder() { + return new Builder(); + } + + public interface ChannelIdStage { + /** + *

The unique identifier of the channel or experience to send the message in. For example, 'exp_xxxxx' or 'feed_xxxxx'.

+ */ + ContentStage channelId(@NotNull String channelId); + + Builder from(CreateMessagesRequest other); + } + + public interface ContentStage { + /** + *

The body of the message in Markdown format. For example, 'Hello world'.

+ */ + _FinalStage content(@NotNull String content); + } + + public interface _FinalStage { + CreateMessagesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of file attachments to include with the message, such as images or videos.

+ */ + _FinalStage attachments(Optional> attachments); + + _FinalStage attachments(List attachments); + + _FinalStage attachments(Nullable> attachments); + + /** + *

Automatically detect URLs in the message and generate link previews.

+ */ + _FinalStage autoDetectLinks(Optional autoDetectLinks); + + _FinalStage autoDetectLinks(Boolean autoDetectLinks); + + _FinalStage autoDetectLinks(Nullable autoDetectLinks); + + /** + *

A poll to attach to this message, allowing recipients to vote on options.

+ */ + _FinalStage poll(Optional poll); + + _FinalStage poll(CreateMessagesRequestPoll poll); + + _FinalStage poll(Nullable poll); + + /** + *

The unique identifier of the message this is replying to, creating a threaded reply.

+ */ + _FinalStage replyingToMessageId(Optional replyingToMessageId); + + _FinalStage replyingToMessageId(String replyingToMessageId); + + _FinalStage replyingToMessageId(Nullable replyingToMessageId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ChannelIdStage, ContentStage, _FinalStage { + private String channelId; + + private String content; + + private Optional replyingToMessageId = Optional.empty(); + + private Optional poll = Optional.empty(); + + private Optional autoDetectLinks = Optional.empty(); + + private Optional> attachments = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateMessagesRequest other) { + attachments(other.getAttachments()); + autoDetectLinks(other.getAutoDetectLinks()); + channelId(other.getChannelId()); + content(other.getContent()); + poll(other.getPoll()); + replyingToMessageId(other.getReplyingToMessageId()); + return this; + } + + /** + *

The unique identifier of the channel or experience to send the message in. For example, 'exp_xxxxx' or 'feed_xxxxx'.

+ *

The unique identifier of the channel or experience to send the message in. For example, 'exp_xxxxx' or 'feed_xxxxx'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("channel_id") + public ContentStage channelId(@NotNull String channelId) { + this.channelId = Objects.requireNonNull(channelId, "channelId must not be null"); + return this; + } + + /** + *

The body of the message in Markdown format. For example, 'Hello world'.

+ *

The body of the message in Markdown format. For example, 'Hello world'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("content") + public _FinalStage content(@NotNull String content) { + this.content = Objects.requireNonNull(content, "content must not be null"); + return this; + } + + /** + *

The unique identifier of the message this is replying to, creating a threaded reply.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage replyingToMessageId(Nullable replyingToMessageId) { + if (replyingToMessageId.isNull()) { + this.replyingToMessageId = null; + } else if (replyingToMessageId.isEmpty()) { + this.replyingToMessageId = Optional.empty(); + } else { + this.replyingToMessageId = Optional.of(replyingToMessageId.get()); + } + return this; + } + + /** + *

The unique identifier of the message this is replying to, creating a threaded reply.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage replyingToMessageId(String replyingToMessageId) { + this.replyingToMessageId = Optional.ofNullable(replyingToMessageId); + return this; + } + + /** + *

The unique identifier of the message this is replying to, creating a threaded reply.

+ */ + @java.lang.Override + @JsonSetter(value = "replying_to_message_id", nulls = Nulls.SKIP) + public _FinalStage replyingToMessageId(Optional replyingToMessageId) { + this.replyingToMessageId = replyingToMessageId; + return this; + } + + /** + *

A poll to attach to this message, allowing recipients to vote on options.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage poll(Nullable poll) { + if (poll.isNull()) { + this.poll = null; + } else if (poll.isEmpty()) { + this.poll = Optional.empty(); + } else { + this.poll = Optional.of(poll.get()); + } + return this; + } + + /** + *

A poll to attach to this message, allowing recipients to vote on options.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage poll(CreateMessagesRequestPoll poll) { + this.poll = Optional.ofNullable(poll); + return this; + } + + /** + *

A poll to attach to this message, allowing recipients to vote on options.

+ */ + @java.lang.Override + @JsonSetter(value = "poll", nulls = Nulls.SKIP) + public _FinalStage poll(Optional poll) { + this.poll = poll; + return this; + } + + /** + *

Automatically detect URLs in the message and generate link previews.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage autoDetectLinks(Nullable autoDetectLinks) { + if (autoDetectLinks.isNull()) { + this.autoDetectLinks = null; + } else if (autoDetectLinks.isEmpty()) { + this.autoDetectLinks = Optional.empty(); + } else { + this.autoDetectLinks = Optional.of(autoDetectLinks.get()); + } + return this; + } + + /** + *

Automatically detect URLs in the message and generate link previews.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage autoDetectLinks(Boolean autoDetectLinks) { + this.autoDetectLinks = Optional.ofNullable(autoDetectLinks); + return this; + } + + /** + *

Automatically detect URLs in the message and generate link previews.

+ */ + @java.lang.Override + @JsonSetter(value = "auto_detect_links", nulls = Nulls.SKIP) + public _FinalStage autoDetectLinks(Optional autoDetectLinks) { + this.autoDetectLinks = autoDetectLinks; + return this; + } + + /** + *

A list of file attachments to include with the message, such as images or videos.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage attachments(Nullable> attachments) { + if (attachments.isNull()) { + this.attachments = null; + } else if (attachments.isEmpty()) { + this.attachments = Optional.empty(); + } else { + this.attachments = Optional.of(attachments.get()); + } + return this; + } + + /** + *

A list of file attachments to include with the message, such as images or videos.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage attachments(List attachments) { + this.attachments = Optional.ofNullable(attachments); + return this; + } + + /** + *

A list of file attachments to include with the message, such as images or videos.

+ */ + @java.lang.Override + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public _FinalStage attachments(Optional> attachments) { + this.attachments = attachments; + return this; + } + + @java.lang.Override + public CreateMessagesRequest build() { + return new CreateMessagesRequest( + attachments, autoDetectLinks, channelId, content, poll, replyingToMessageId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/messages/requests/DeleteMessagesRequest.java b/src/main/java/com/whop/api/resources/messages/requests/DeleteMessagesRequest.java new file mode 100644 index 00000000..7f621a4f --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/requests/DeleteMessagesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteMessagesRequest.Builder.class) +public final class DeleteMessagesRequest { + private final Map additionalProperties; + + private DeleteMessagesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteMessagesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteMessagesRequest other) { + return this; + } + + public DeleteMessagesRequest build() { + return new DeleteMessagesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/messages/requests/ListMessagesRequest.java b/src/main/java/com/whop/api/resources/messages/requests/ListMessagesRequest.java new file mode 100644 index 00000000..d24237fb --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/requests/ListMessagesRequest.java @@ -0,0 +1,336 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Direction; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMessagesRequest.Builder.class) +public final class ListMessagesRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String channelId; + + private final Optional direction; + + private final Map additionalProperties; + + private ListMessagesRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String channelId, + Optional direction, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.channelId = channelId; + this.direction = direction; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the channel or experience to list messages for. + */ + @JsonProperty("channel_id") + public String getChannelId() { + return channelId; + } + + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMessagesRequest && equalTo((ListMessagesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMessagesRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && channelId.equals(other.channelId) + && direction.equals(other.direction); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last, this.channelId, this.direction); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChannelIdStage builder() { + return new Builder(); + } + + public interface ChannelIdStage { + /** + *

The unique identifier of the channel or experience to list messages for.

+ */ + _FinalStage channelId(@NotNull String channelId); + + Builder from(ListMessagesRequest other); + } + + public interface _FinalStage { + ListMessagesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + _FinalStage direction(Optional direction); + + _FinalStage direction(Direction direction); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ChannelIdStage, _FinalStage { + private String channelId; + + private Optional direction = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMessagesRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + channelId(other.getChannelId()); + direction(other.getDirection()); + return this; + } + + /** + *

The unique identifier of the channel or experience to list messages for.

+ *

The unique identifier of the channel or experience to list messages for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("channel_id") + public _FinalStage channelId(@NotNull String channelId) { + this.channelId = Objects.requireNonNull(channelId, "channelId must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage direction(Direction direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + @java.lang.Override + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public _FinalStage direction(Optional direction) { + this.direction = direction; + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListMessagesRequest build() { + return new ListMessagesRequest(after, before, first, last, channelId, direction, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/messages/requests/RetrieveMessagesRequest.java b/src/main/java/com/whop/api/resources/messages/requests/RetrieveMessagesRequest.java new file mode 100644 index 00000000..7fc3f64e --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/requests/RetrieveMessagesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveMessagesRequest.Builder.class) +public final class RetrieveMessagesRequest { + private final Map additionalProperties; + + private RetrieveMessagesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveMessagesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveMessagesRequest other) { + return this; + } + + public RetrieveMessagesRequest build() { + return new RetrieveMessagesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/messages/requests/UpdateMessagesRequest.java b/src/main/java/com/whop/api/resources/messages/requests/UpdateMessagesRequest.java new file mode 100644 index 00000000..e858f944 --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/requests/UpdateMessagesRequest.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.messages.types.UpdateMessagesRequestAttachmentsItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateMessagesRequest.Builder.class) +public final class UpdateMessagesRequest { + private final Optional> attachments; + + private final Optional content; + + private final Optional isPinned; + + private final Map additionalProperties; + + private UpdateMessagesRequest( + Optional> attachments, + Optional content, + Optional isPinned, + Map additionalProperties) { + this.attachments = attachments; + this.content = content; + this.isPinned = isPinned; + this.additionalProperties = additionalProperties; + } + + /** + * @return A replacement list of file attachments for this message, such as images or videos. + */ + @JsonIgnore + public Optional> getAttachments() { + if (attachments == null) { + return Optional.empty(); + } + return attachments; + } + + /** + * @return The updated body of the message in Markdown format. For example, 'Hello world'. + */ + @JsonIgnore + public Optional getContent() { + if (content == null) { + return Optional.empty(); + } + return content; + } + + /** + * @return Whether this message should be pinned to the top of the channel. + */ + @JsonIgnore + public Optional getIsPinned() { + if (isPinned == null) { + return Optional.empty(); + } + return isPinned; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("attachments") + private Optional> _getAttachments() { + return attachments; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content") + private Optional _getContent() { + return content; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("is_pinned") + private Optional _getIsPinned() { + return isPinned; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateMessagesRequest && equalTo((UpdateMessagesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateMessagesRequest other) { + return attachments.equals(other.attachments) + && content.equals(other.content) + && isPinned.equals(other.isPinned); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.attachments, this.content, this.isPinned); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> attachments = Optional.empty(); + + private Optional content = Optional.empty(); + + private Optional isPinned = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateMessagesRequest other) { + attachments(other.getAttachments()); + content(other.getContent()); + isPinned(other.getIsPinned()); + return this; + } + + /** + *

A replacement list of file attachments for this message, such as images or videos.

+ */ + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public Builder attachments(Optional> attachments) { + this.attachments = attachments; + return this; + } + + public Builder attachments(List attachments) { + this.attachments = Optional.ofNullable(attachments); + return this; + } + + public Builder attachments(Nullable> attachments) { + if (attachments.isNull()) { + this.attachments = null; + } else if (attachments.isEmpty()) { + this.attachments = Optional.empty(); + } else { + this.attachments = Optional.of(attachments.get()); + } + return this; + } + + /** + *

The updated body of the message in Markdown format. For example, 'Hello world'.

+ */ + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public Builder content(Optional content) { + this.content = content; + return this; + } + + public Builder content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + public Builder content(Nullable content) { + if (content.isNull()) { + this.content = null; + } else if (content.isEmpty()) { + this.content = Optional.empty(); + } else { + this.content = Optional.of(content.get()); + } + return this; + } + + /** + *

Whether this message should be pinned to the top of the channel.

+ */ + @JsonSetter(value = "is_pinned", nulls = Nulls.SKIP) + public Builder isPinned(Optional isPinned) { + this.isPinned = isPinned; + return this; + } + + public Builder isPinned(Boolean isPinned) { + this.isPinned = Optional.ofNullable(isPinned); + return this; + } + + public Builder isPinned(Nullable isPinned) { + if (isPinned.isNull()) { + this.isPinned = null; + } else if (isPinned.isEmpty()) { + this.isPinned = Optional.empty(); + } else { + this.isPinned = Optional.of(isPinned.get()); + } + return this; + } + + public UpdateMessagesRequest build() { + return new UpdateMessagesRequest(attachments, content, isPinned, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/messages/types/CreateMessagesRequestAttachmentsItem.java b/src/main/java/com/whop/api/resources/messages/types/CreateMessagesRequestAttachmentsItem.java new file mode 100644 index 00000000..b08abb61 --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/types/CreateMessagesRequestAttachmentsItem.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateMessagesRequestAttachmentsItem.Builder.class) +public final class CreateMessagesRequestAttachmentsItem { + private final String id; + + private final Map additionalProperties; + + private CreateMessagesRequestAttachmentsItem(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateMessagesRequestAttachmentsItem + && equalTo((CreateMessagesRequestAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateMessagesRequestAttachmentsItem other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CreateMessagesRequestAttachmentsItem other); + } + + public interface _FinalStage { + CreateMessagesRequestAttachmentsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateMessagesRequestAttachmentsItem other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CreateMessagesRequestAttachmentsItem build() { + return new CreateMessagesRequestAttachmentsItem(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/messages/types/CreateMessagesRequestPoll.java b/src/main/java/com/whop/api/resources/messages/types/CreateMessagesRequestPoll.java new file mode 100644 index 00000000..51ee9641 --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/types/CreateMessagesRequestPoll.java @@ -0,0 +1,123 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateMessagesRequestPoll.Builder.class) +public final class CreateMessagesRequestPoll { + private final List options; + + private final Map additionalProperties; + + private CreateMessagesRequestPoll( + List options, Map additionalProperties) { + this.options = options; + this.additionalProperties = additionalProperties; + } + + /** + * @return The options for the poll. Must have sequential IDs starting from 1 + */ + @JsonProperty("options") + public List getOptions() { + return options; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateMessagesRequestPoll && equalTo((CreateMessagesRequestPoll) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateMessagesRequestPoll other) { + return options.equals(other.options); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.options); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List options = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateMessagesRequestPoll other) { + options(other.getOptions()); + return this; + } + + /** + *

The options for the poll. Must have sequential IDs starting from 1

+ */ + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public Builder options(List options) { + this.options.clear(); + if (options != null) { + this.options.addAll(options); + } + return this; + } + + public Builder addOptions(CreateMessagesRequestPollOptionsItem options) { + this.options.add(options); + return this; + } + + public Builder addAllOptions(List options) { + if (options != null) { + this.options.addAll(options); + } + return this; + } + + public CreateMessagesRequestPoll build() { + return new CreateMessagesRequestPoll(options, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/messages/types/CreateMessagesRequestPollOptionsItem.java b/src/main/java/com/whop/api/resources/messages/types/CreateMessagesRequestPollOptionsItem.java new file mode 100644 index 00000000..5e08f2ca --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/types/CreateMessagesRequestPollOptionsItem.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateMessagesRequestPollOptionsItem.Builder.class) +public final class CreateMessagesRequestPollOptionsItem { + private final String id; + + private final String text; + + private final Map additionalProperties; + + private CreateMessagesRequestPollOptionsItem(String id, String text, Map additionalProperties) { + this.id = id; + this.text = text; + this.additionalProperties = additionalProperties; + } + + /** + * @return Sequential ID for the poll option (starting from '1') + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The text of the poll option + */ + @JsonProperty("text") + public String getText() { + return text; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateMessagesRequestPollOptionsItem + && equalTo((CreateMessagesRequestPollOptionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateMessagesRequestPollOptionsItem other) { + return id.equals(other.id) && text.equals(other.text); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.text); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Sequential ID for the poll option (starting from '1')

+ */ + TextStage id(@NotNull String id); + + Builder from(CreateMessagesRequestPollOptionsItem other); + } + + public interface TextStage { + /** + *

The text of the poll option

+ */ + _FinalStage text(@NotNull String text); + } + + public interface _FinalStage { + CreateMessagesRequestPollOptionsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TextStage, _FinalStage { + private String id; + + private String text; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateMessagesRequestPollOptionsItem other) { + id(other.getId()); + text(other.getText()); + return this; + } + + /** + *

Sequential ID for the poll option (starting from '1')

+ *

Sequential ID for the poll option (starting from '1')

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TextStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The text of the poll option

+ *

The text of the poll option

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("text") + public _FinalStage text(@NotNull String text) { + this.text = Objects.requireNonNull(text, "text must not be null"); + return this; + } + + @java.lang.Override + public CreateMessagesRequestPollOptionsItem build() { + return new CreateMessagesRequestPollOptionsItem(id, text, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/messages/types/ListMessagesResponse.java b/src/main/java/com/whop/api/resources/messages/types/ListMessagesResponse.java new file mode 100644 index 00000000..1a24ae4e --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/types/ListMessagesResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.MessageListItem; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMessagesResponse.Builder.class) +public final class ListMessagesResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListMessagesResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMessagesResponse && equalTo((ListMessagesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMessagesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListMessagesResponse other); + } + + public interface _FinalStage { + ListMessagesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(MessageListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMessagesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(MessageListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListMessagesResponse build() { + return new ListMessagesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayload.java b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayload.java new file mode 100644 index 00000000..0786ced5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayload.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostChatMessageCreatedPayload.Builder.class) +public final class PostChatMessageCreatedPayload { + private final Optional accountId; + + private final PostChatMessageCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostChatMessageCreatedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostChatMessageCreatedPayloadType type; + + private final Map additionalProperties; + + private PostChatMessageCreatedPayload( + Optional accountId, + PostChatMessageCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostChatMessageCreatedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostChatMessageCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostChatMessageCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PostChatMessageCreatedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostChatMessageCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostChatMessageCreatedPayload && equalTo((PostChatMessageCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostChatMessageCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostChatMessageCreatedPayloadApiVersion apiVersion); + + Builder from(PostChatMessageCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PostChatMessageCreatedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostChatMessageCreatedPayloadType type); + } + + public interface _FinalStage { + PostChatMessageCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostChatMessageCreatedPayloadApiVersion apiVersion; + + private PostChatMessageCreatedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostChatMessageCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostChatMessageCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostChatMessageCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostChatMessageCreatedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostChatMessageCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostChatMessageCreatedPayload build() { + return new PostChatMessageCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadApiVersion.java new file mode 100644 index 00000000..07821aea --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostChatMessageCreatedPayloadApiVersion { + public static final PostChatMessageCreatedPayloadApiVersion V1 = + new PostChatMessageCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostChatMessageCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostChatMessageCreatedPayloadApiVersion + && this.string.equals(((PostChatMessageCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostChatMessageCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostChatMessageCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadData.java b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadData.java new file mode 100644 index 00000000..c9d71e7f --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadData.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Message; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostChatMessageCreatedPayloadData.Builder.class) +public final class PostChatMessageCreatedPayloadData { + private final PostChatMessageCreatedPayloadDataAudience audience; + + private final PostChatMessageCreatedPayloadDataChannel channel; + + private final Message message; + + private final String reason; + + private final Map additionalProperties; + + private PostChatMessageCreatedPayloadData( + PostChatMessageCreatedPayloadDataAudience audience, + PostChatMessageCreatedPayloadDataChannel channel, + Message message, + String reason, + Map additionalProperties) { + this.audience = audience; + this.channel = channel; + this.message = message; + this.reason = reason; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("audience") + public PostChatMessageCreatedPayloadDataAudience getAudience() { + return audience; + } + + @JsonProperty("channel") + public PostChatMessageCreatedPayloadDataChannel getChannel() { + return channel; + } + + @JsonProperty("message") + public Message getMessage() { + return message; + } + + @JsonProperty("reason") + public String getReason() { + return reason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostChatMessageCreatedPayloadData && equalTo((PostChatMessageCreatedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostChatMessageCreatedPayloadData other) { + return audience.equals(other.audience) + && channel.equals(other.channel) + && message.equals(other.message) + && reason.equals(other.reason); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.audience, this.channel, this.message, this.reason); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AudienceStage builder() { + return new Builder(); + } + + public interface AudienceStage { + ChannelStage audience(@NotNull PostChatMessageCreatedPayloadDataAudience audience); + + Builder from(PostChatMessageCreatedPayloadData other); + } + + public interface ChannelStage { + MessageStage channel(@NotNull PostChatMessageCreatedPayloadDataChannel channel); + } + + public interface MessageStage { + ReasonStage message(@NotNull Message message); + } + + public interface ReasonStage { + _FinalStage reason(@NotNull String reason); + } + + public interface _FinalStage { + PostChatMessageCreatedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AudienceStage, ChannelStage, MessageStage, ReasonStage, _FinalStage { + private PostChatMessageCreatedPayloadDataAudience audience; + + private PostChatMessageCreatedPayloadDataChannel channel; + + private Message message; + + private String reason; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostChatMessageCreatedPayloadData other) { + audience(other.getAudience()); + channel(other.getChannel()); + message(other.getMessage()); + reason(other.getReason()); + return this; + } + + @java.lang.Override + @JsonSetter("audience") + public ChannelStage audience(@NotNull PostChatMessageCreatedPayloadDataAudience audience) { + this.audience = Objects.requireNonNull(audience, "audience must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("channel") + public MessageStage channel(@NotNull PostChatMessageCreatedPayloadDataChannel channel) { + this.channel = Objects.requireNonNull(channel, "channel must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("message") + public ReasonStage message(@NotNull Message message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("reason") + public _FinalStage reason(@NotNull String reason) { + this.reason = Objects.requireNonNull(reason, "reason must not be null"); + return this; + } + + @java.lang.Override + public PostChatMessageCreatedPayloadData build() { + return new PostChatMessageCreatedPayloadData(audience, channel, message, reason, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadDataAudience.java b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadDataAudience.java new file mode 100644 index 00000000..3c3c4487 --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadDataAudience.java @@ -0,0 +1,179 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostChatMessageCreatedPayloadDataAudience.Builder.class) +public final class PostChatMessageCreatedPayloadDataAudience { + private final PostChatMessageCreatedPayloadDataAudienceType type; + + private final Optional> userIds; + + private final Map additionalProperties; + + private PostChatMessageCreatedPayloadDataAudience( + PostChatMessageCreatedPayloadDataAudienceType type, + Optional> userIds, + Map additionalProperties) { + this.type = type; + this.userIds = userIds; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public PostChatMessageCreatedPayloadDataAudienceType getType() { + return type; + } + + @JsonIgnore + public Optional> getUserIds() { + if (userIds == null) { + return Optional.empty(); + } + return userIds; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_ids") + private Optional> _getUserIds() { + return userIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostChatMessageCreatedPayloadDataAudience + && equalTo((PostChatMessageCreatedPayloadDataAudience) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostChatMessageCreatedPayloadDataAudience other) { + return type.equals(other.type) && userIds.equals(other.userIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.userIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + _FinalStage type(@NotNull PostChatMessageCreatedPayloadDataAudienceType type); + + Builder from(PostChatMessageCreatedPayloadDataAudience other); + } + + public interface _FinalStage { + PostChatMessageCreatedPayloadDataAudience build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage userIds(Optional> userIds); + + _FinalStage userIds(List userIds); + + _FinalStage userIds(Nullable> userIds); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private PostChatMessageCreatedPayloadDataAudienceType type; + + private Optional> userIds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostChatMessageCreatedPayloadDataAudience other) { + type(other.getType()); + userIds(other.getUserIds()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostChatMessageCreatedPayloadDataAudienceType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage userIds(Nullable> userIds) { + if (userIds.isNull()) { + this.userIds = null; + } else if (userIds.isEmpty()) { + this.userIds = Optional.empty(); + } else { + this.userIds = Optional.of(userIds.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage userIds(List userIds) { + this.userIds = Optional.ofNullable(userIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "user_ids", nulls = Nulls.SKIP) + public _FinalStage userIds(Optional> userIds) { + this.userIds = userIds; + return this; + } + + @java.lang.Override + public PostChatMessageCreatedPayloadDataAudience build() { + return new PostChatMessageCreatedPayloadDataAudience(type, userIds, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadDataAudienceType.java b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadDataAudienceType.java new file mode 100644 index 00000000..6005bc14 --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadDataAudienceType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostChatMessageCreatedPayloadDataAudienceType { + public static final PostChatMessageCreatedPayloadDataAudienceType CHANNEL = + new PostChatMessageCreatedPayloadDataAudienceType(Value.CHANNEL, "channel"); + + public static final PostChatMessageCreatedPayloadDataAudienceType USERS = + new PostChatMessageCreatedPayloadDataAudienceType(Value.USERS, "users"); + + private final Value value; + + private final String string; + + PostChatMessageCreatedPayloadDataAudienceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostChatMessageCreatedPayloadDataAudienceType + && this.string.equals(((PostChatMessageCreatedPayloadDataAudienceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CHANNEL: + return visitor.visitChannel(); + case USERS: + return visitor.visitUsers(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostChatMessageCreatedPayloadDataAudienceType valueOf(String value) { + switch (value) { + case "channel": + return CHANNEL; + case "users": + return USERS; + default: + return new PostChatMessageCreatedPayloadDataAudienceType(Value.UNKNOWN, value); + } + } + + public enum Value { + CHANNEL, + + USERS, + + UNKNOWN + } + + public interface Visitor { + T visitChannel(); + + T visitUsers(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadDataChannel.java b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadDataChannel.java new file mode 100644 index 00000000..2f8b20fa --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadDataChannel.java @@ -0,0 +1,201 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostChatMessageCreatedPayloadDataChannel.Builder.class) +public final class PostChatMessageCreatedPayloadDataChannel { + private final Optional experienceId; + + private final String id; + + private final PostChatMessageCreatedPayloadDataChannelType type; + + private final Map additionalProperties; + + private PostChatMessageCreatedPayloadDataChannel( + Optional experienceId, + String id, + PostChatMessageCreatedPayloadDataChannelType type, + Map additionalProperties) { + this.experienceId = experienceId; + this.id = id; + this.type = type; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getExperienceId() { + if (experienceId == null) { + return Optional.empty(); + } + return experienceId; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("type") + public PostChatMessageCreatedPayloadDataChannelType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("experience_id") + private Optional _getExperienceId() { + return experienceId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostChatMessageCreatedPayloadDataChannel + && equalTo((PostChatMessageCreatedPayloadDataChannel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostChatMessageCreatedPayloadDataChannel other) { + return experienceId.equals(other.experienceId) && id.equals(other.id) && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.experienceId, this.id, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + TypeStage id(@NotNull String id); + + Builder from(PostChatMessageCreatedPayloadDataChannel other); + } + + public interface TypeStage { + _FinalStage type(@NotNull PostChatMessageCreatedPayloadDataChannelType type); + } + + public interface _FinalStage { + PostChatMessageCreatedPayloadDataChannel build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage experienceId(Optional experienceId); + + _FinalStage experienceId(String experienceId); + + _FinalStage experienceId(Nullable experienceId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TypeStage, _FinalStage { + private String id; + + private PostChatMessageCreatedPayloadDataChannelType type; + + private Optional experienceId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostChatMessageCreatedPayloadDataChannel other) { + experienceId(other.getExperienceId()); + id(other.getId()); + type(other.getType()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public TypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostChatMessageCreatedPayloadDataChannelType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage experienceId(Nullable experienceId) { + if (experienceId.isNull()) { + this.experienceId = null; + } else if (experienceId.isEmpty()) { + this.experienceId = Optional.empty(); + } else { + this.experienceId = Optional.of(experienceId.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage experienceId(String experienceId) { + this.experienceId = Optional.ofNullable(experienceId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "experience_id", nulls = Nulls.SKIP) + public _FinalStage experienceId(Optional experienceId) { + this.experienceId = experienceId; + return this; + } + + @java.lang.Override + public PostChatMessageCreatedPayloadDataChannel build() { + return new PostChatMessageCreatedPayloadDataChannel(experienceId, id, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadDataChannelType.java b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadDataChannelType.java new file mode 100644 index 00000000..3f13994a --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadDataChannelType.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostChatMessageCreatedPayloadDataChannelType { + public static final PostChatMessageCreatedPayloadDataChannelType SUPPORT = + new PostChatMessageCreatedPayloadDataChannelType(Value.SUPPORT, "support"); + + public static final PostChatMessageCreatedPayloadDataChannelType CHAT = + new PostChatMessageCreatedPayloadDataChannelType(Value.CHAT, "chat"); + + public static final PostChatMessageCreatedPayloadDataChannelType DIRECT_MESSAGE = + new PostChatMessageCreatedPayloadDataChannelType(Value.DIRECT_MESSAGE, "direct_message"); + + private final Value value; + + private final String string; + + PostChatMessageCreatedPayloadDataChannelType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostChatMessageCreatedPayloadDataChannelType + && this.string.equals(((PostChatMessageCreatedPayloadDataChannelType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SUPPORT: + return visitor.visitSupport(); + case CHAT: + return visitor.visitChat(); + case DIRECT_MESSAGE: + return visitor.visitDirectMessage(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostChatMessageCreatedPayloadDataChannelType valueOf(String value) { + switch (value) { + case "support": + return SUPPORT; + case "chat": + return CHAT; + case "direct_message": + return DIRECT_MESSAGE; + default: + return new PostChatMessageCreatedPayloadDataChannelType(Value.UNKNOWN, value); + } + } + + public enum Value { + CHAT, + + DIRECT_MESSAGE, + + SUPPORT, + + UNKNOWN + } + + public interface Visitor { + T visitChat(); + + T visitDirectMessage(); + + T visitSupport(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadType.java b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadType.java new file mode 100644 index 00000000..a0b2666d --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/types/PostChatMessageCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostChatMessageCreatedPayloadType { + public static final PostChatMessageCreatedPayloadType CHAT_MESSAGE_CREATED = + new PostChatMessageCreatedPayloadType(Value.CHAT_MESSAGE_CREATED, "chat.message.created"); + + private final Value value; + + private final String string; + + PostChatMessageCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostChatMessageCreatedPayloadType + && this.string.equals(((PostChatMessageCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CHAT_MESSAGE_CREATED: + return visitor.visitChatMessageCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostChatMessageCreatedPayloadType valueOf(String value) { + switch (value) { + case "chat.message.created": + return CHAT_MESSAGE_CREATED; + default: + return new PostChatMessageCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + CHAT_MESSAGE_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitChatMessageCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/messages/types/UpdateMessagesRequestAttachmentsItem.java b/src/main/java/com/whop/api/resources/messages/types/UpdateMessagesRequestAttachmentsItem.java new file mode 100644 index 00000000..bae5ec3f --- /dev/null +++ b/src/main/java/com/whop/api/resources/messages/types/UpdateMessagesRequestAttachmentsItem.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.messages.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateMessagesRequestAttachmentsItem.Builder.class) +public final class UpdateMessagesRequestAttachmentsItem { + private final String id; + + private final Map additionalProperties; + + private UpdateMessagesRequestAttachmentsItem(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of an existing file object. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateMessagesRequestAttachmentsItem + && equalTo((UpdateMessagesRequestAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateMessagesRequestAttachmentsItem other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of an existing file object.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateMessagesRequestAttachmentsItem other); + } + + public interface _FinalStage { + UpdateMessagesRequestAttachmentsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateMessagesRequestAttachmentsItem other) { + id(other.getId()); + return this; + } + + /** + *

The ID of an existing file object.

+ *

The ID of an existing file object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public UpdateMessagesRequestAttachmentsItem build() { + return new UpdateMessagesRequestAttachmentsItem(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/AsyncNotificationsClient.java b/src/main/java/com/whop/api/resources/notifications/AsyncNotificationsClient.java new file mode 100644 index 00000000..05ccddc6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/AsyncNotificationsClient.java @@ -0,0 +1,177 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.notifications.requests.BadgesNotificationsRequest; +import com.whop.api.resources.notifications.requests.CreateNotificationsRequest; +import com.whop.api.resources.notifications.requests.ListNotificationsRequest; +import com.whop.api.resources.notifications.requests.MarkReadNotificationsRequest; +import com.whop.api.resources.notifications.requests.RetrieveNotificationsRequest; +import com.whop.api.resources.notifications.topics.AsyncTopicsClient; +import com.whop.api.resources.notifications.types.BadgesNotificationsResponse; +import com.whop.api.resources.notifications.types.CreateNotificationsResponse; +import com.whop.api.resources.notifications.types.MarkReadNotificationsResponse; +import com.whop.api.types.Notification; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class AsyncNotificationsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawNotificationsClient rawClient; + + protected final Supplier topicsClient; + + public AsyncNotificationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawNotificationsClient(clientOptions); + this.topicsClient = Suppliers.memoize(() -> new AsyncTopicsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawNotificationsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public CompletableFuture> list(ListNotificationsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public CompletableFuture> list( + ListNotificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Queues a notification to every user of an experience or to an account's team, processed asynchronously. Every send is attributed to an app: use an app API key, or a credential acting on behalf of an app. Narrow the audience with user_ids to send a mention. + */ + public CompletableFuture create(CreateNotificationsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Queues a notification to every user of an experience or to an account's team, processed asynchronously. Every send is attributed to an app: use an app API key, or a credential acting on behalf of an app. Narrow the audience with user_ids to send a mention. + */ + public CompletableFuture create( + CreateNotificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public CompletableFuture badges() { + return this.rawClient.badges().thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public CompletableFuture badges(RequestOptions requestOptions) { + return this.rawClient.badges(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public CompletableFuture badges(BadgesNotificationsRequest request) { + return this.rawClient.badges(request).thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public CompletableFuture badges( + BadgesNotificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.badges(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public CompletableFuture markRead() { + return this.rawClient.markRead().thenApply(response -> response.body()); + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public CompletableFuture markRead(RequestOptions requestOptions) { + return this.rawClient.markRead(requestOptions).thenApply(response -> response.body()); + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public CompletableFuture markRead(MarkReadNotificationsRequest request) { + return this.rawClient.markRead(request).thenApply(response -> response.body()); + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public CompletableFuture markRead( + MarkReadNotificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.markRead(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public CompletableFuture retrieve(String id, RetrieveNotificationsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public CompletableFuture retrieve( + String id, RetrieveNotificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + public AsyncTopicsClient topics() { + return this.topicsClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/AsyncRawNotificationsClient.java b/src/main/java/com/whop/api/resources/notifications/AsyncRawNotificationsClient.java new file mode 100644 index 00000000..39445a53 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/AsyncRawNotificationsClient.java @@ -0,0 +1,591 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.notifications.requests.BadgesNotificationsRequest; +import com.whop.api.resources.notifications.requests.CreateNotificationsRequest; +import com.whop.api.resources.notifications.requests.ListNotificationsRequest; +import com.whop.api.resources.notifications.requests.MarkReadNotificationsRequest; +import com.whop.api.resources.notifications.requests.RetrieveNotificationsRequest; +import com.whop.api.resources.notifications.types.BadgesNotificationsResponse; +import com.whop.api.resources.notifications.types.CreateNotificationsResponse; +import com.whop.api.resources.notifications.types.ListNotificationsResponse; +import com.whop.api.resources.notifications.types.MarkReadNotificationsResponse; +import com.whop.api.types.Notification; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawNotificationsClient { + protected final ClientOptions clientOptions; + + public AsyncRawNotificationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public CompletableFuture>> list() { + return list(ListNotificationsRequest.builder().build()); + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListNotificationsRequest.builder().build(), requestOptions); + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public CompletableFuture>> list( + ListNotificationsRequest request) { + return list(request, null); + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public CompletableFuture>> list( + ListNotificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("notifications"); + if (request.getUnread().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "unread", request.getUnread().get(), false); + } + if (request.getExperienceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "experience_id", request.getExperienceId().get(), false); + } + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getMentions().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "mentions", request.getMentions().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListNotificationsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListNotificationsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListNotificationsRequest nextRequest = ListNotificationsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Queues a notification to every user of an experience or to an account's team, processed asynchronously. Every send is attributed to an app: use an app API key, or a credential acting on behalf of an app. Narrow the audience with user_ids to send a mention. + */ + public CompletableFuture> create( + CreateNotificationsRequest request) { + return create(request, null); + } + + /** + * Queues a notification to every user of an experience or to an account's team, processed asynchronously. Every send is attributed to an app: use an app API key, or a credential acting on behalf of an app. Narrow the audience with user_ids to send a mention. + */ + public CompletableFuture> create( + CreateNotificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("notifications"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CreateNotificationsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public CompletableFuture> badges() { + return badges(BadgesNotificationsRequest.builder().build()); + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public CompletableFuture> badges(RequestOptions requestOptions) { + return badges(BadgesNotificationsRequest.builder().build(), requestOptions); + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public CompletableFuture> badges( + BadgesNotificationsRequest request) { + return badges(request, null); + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public CompletableFuture> badges( + BadgesNotificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("notifications/badges"); + if (request.getLastFetchedAt().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last_fetched_at", request.getLastFetchedAt().get(), false); + } + if (request.getExperienceIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "experience_ids", request.getExperienceIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, BadgesNotificationsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public CompletableFuture> markRead() { + return markRead(MarkReadNotificationsRequest.builder().build()); + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public CompletableFuture> markRead( + RequestOptions requestOptions) { + return markRead(MarkReadNotificationsRequest.builder().build(), requestOptions); + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public CompletableFuture> markRead( + MarkReadNotificationsRequest request) { + return markRead(request, null); + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public CompletableFuture> markRead( + MarkReadNotificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("notifications/mark_read"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, MarkReadNotificationsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveNotificationsRequest.builder().build()); + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveNotificationsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public CompletableFuture> retrieve( + String id, RetrieveNotificationsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public CompletableFuture> retrieve( + String id, RetrieveNotificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("notifications") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Notification.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/NotificationsClient.java b/src/main/java/com/whop/api/resources/notifications/NotificationsClient.java new file mode 100644 index 00000000..a8815fbd --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/NotificationsClient.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.notifications.requests.BadgesNotificationsRequest; +import com.whop.api.resources.notifications.requests.CreateNotificationsRequest; +import com.whop.api.resources.notifications.requests.ListNotificationsRequest; +import com.whop.api.resources.notifications.requests.MarkReadNotificationsRequest; +import com.whop.api.resources.notifications.requests.RetrieveNotificationsRequest; +import com.whop.api.resources.notifications.topics.TopicsClient; +import com.whop.api.resources.notifications.types.BadgesNotificationsResponse; +import com.whop.api.resources.notifications.types.CreateNotificationsResponse; +import com.whop.api.resources.notifications.types.MarkReadNotificationsResponse; +import com.whop.api.types.Notification; +import java.util.function.Supplier; + +public class NotificationsClient { + protected final ClientOptions clientOptions; + + private final RawNotificationsClient rawClient; + + protected final Supplier topicsClient; + + public NotificationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawNotificationsClient(clientOptions); + this.topicsClient = Suppliers.memoize(() -> new TopicsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawNotificationsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public SyncPagingIterable list(ListNotificationsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public SyncPagingIterable list(ListNotificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Queues a notification to every user of an experience or to an account's team, processed asynchronously. Every send is attributed to an app: use an app API key, or a credential acting on behalf of an app. Narrow the audience with user_ids to send a mention. + */ + public CreateNotificationsResponse create(CreateNotificationsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Queues a notification to every user of an experience or to an account's team, processed asynchronously. Every send is attributed to an app: use an app API key, or a credential acting on behalf of an app. Narrow the audience with user_ids to send a mention. + */ + public CreateNotificationsResponse create(CreateNotificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public BadgesNotificationsResponse badges() { + return this.rawClient.badges().body(); + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public BadgesNotificationsResponse badges(RequestOptions requestOptions) { + return this.rawClient.badges(requestOptions).body(); + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public BadgesNotificationsResponse badges(BadgesNotificationsRequest request) { + return this.rawClient.badges(request).body(); + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public BadgesNotificationsResponse badges(BadgesNotificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.badges(request, requestOptions).body(); + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public MarkReadNotificationsResponse markRead() { + return this.rawClient.markRead().body(); + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public MarkReadNotificationsResponse markRead(RequestOptions requestOptions) { + return this.rawClient.markRead(requestOptions).body(); + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public MarkReadNotificationsResponse markRead(MarkReadNotificationsRequest request) { + return this.rawClient.markRead(request).body(); + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public MarkReadNotificationsResponse markRead(MarkReadNotificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.markRead(request, requestOptions).body(); + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public Notification retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public Notification retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public Notification retrieve(String id, RetrieveNotificationsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public Notification retrieve(String id, RetrieveNotificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + public TopicsClient topics() { + return this.topicsClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/RawNotificationsClient.java b/src/main/java/com/whop/api/resources/notifications/RawNotificationsClient.java new file mode 100644 index 00000000..d46cad09 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/RawNotificationsClient.java @@ -0,0 +1,473 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.notifications.requests.BadgesNotificationsRequest; +import com.whop.api.resources.notifications.requests.CreateNotificationsRequest; +import com.whop.api.resources.notifications.requests.ListNotificationsRequest; +import com.whop.api.resources.notifications.requests.MarkReadNotificationsRequest; +import com.whop.api.resources.notifications.requests.RetrieveNotificationsRequest; +import com.whop.api.resources.notifications.types.BadgesNotificationsResponse; +import com.whop.api.resources.notifications.types.CreateNotificationsResponse; +import com.whop.api.resources.notifications.types.ListNotificationsResponse; +import com.whop.api.resources.notifications.types.MarkReadNotificationsResponse; +import com.whop.api.types.Notification; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawNotificationsClient { + protected final ClientOptions clientOptions; + + public RawNotificationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public WhopApiHttpResponse> list() { + return list(ListNotificationsRequest.builder().build()); + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListNotificationsRequest.builder().build(), requestOptions); + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public WhopApiHttpResponse> list(ListNotificationsRequest request) { + return list(request, null); + } + + /** + * Lists the authenticated user's notifications, newest first. Requires a user credential — an account API key has no notification feed. Without filters the feed spans every experience the user belongs to plus the teams they are a member of. + */ + public WhopApiHttpResponse> list( + ListNotificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("notifications"); + if (request.getUnread().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "unread", request.getUnread().get(), false); + } + if (request.getExperienceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "experience_id", request.getExperienceId().get(), false); + } + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getMentions().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "mentions", request.getMentions().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListNotificationsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListNotificationsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListNotificationsRequest nextRequest = ListNotificationsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Queues a notification to every user of an experience or to an account's team, processed asynchronously. Every send is attributed to an app: use an app API key, or a credential acting on behalf of an app. Narrow the audience with user_ids to send a mention. + */ + public WhopApiHttpResponse create(CreateNotificationsRequest request) { + return create(request, null); + } + + /** + * Queues a notification to every user of an experience or to an account's team, processed asynchronously. Every send is attributed to an app: use an app API key, or a credential acting on behalf of an app. Narrow the audience with user_ids to send a mention. + */ + public WhopApiHttpResponse create( + CreateNotificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("notifications"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateNotificationsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public WhopApiHttpResponse badges() { + return badges(BadgesNotificationsRequest.builder().build()); + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public WhopApiHttpResponse badges(RequestOptions requestOptions) { + return badges(BadgesNotificationsRequest.builder().build(), requestOptions); + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public WhopApiHttpResponse badges(BadgesNotificationsRequest request) { + return badges(request, null); + } + + /** + * Lists the authenticated user's per-experience unread badge state. Requires a user credential. Returns one row per experience the user belongs to (or per requested experience). + */ + public WhopApiHttpResponse badges( + BadgesNotificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("notifications/badges"); + if (request.getLastFetchedAt().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last_fetched_at", request.getLastFetchedAt().get(), false); + } + if (request.getExperienceIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "experience_ids", request.getExperienceIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BadgesNotificationsResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public WhopApiHttpResponse markRead() { + return markRead(MarkReadNotificationsRequest.builder().build()); + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public WhopApiHttpResponse markRead(RequestOptions requestOptions) { + return markRead(MarkReadNotificationsRequest.builder().build(), requestOptions); + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public WhopApiHttpResponse markRead(MarkReadNotificationsRequest request) { + return markRead(request, null); + } + + /** + * Marks the authenticated user's notifications as read: one experience's (experience_id) or everything (all: true) — exactly one of the two. Requires a user credential. Responds with the refreshed badge rows for the affected scope. + */ + public WhopApiHttpResponse markRead( + MarkReadNotificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("notifications/mark_read"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MarkReadNotificationsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveNotificationsRequest.builder().build()); + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveNotificationsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveNotificationsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single notification by id — either an id returned by List Notifications, or the ephemeral id delivered with a push/websocket event. Requires a user credential. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveNotificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("notifications") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Notification.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/requests/BadgesNotificationsRequest.java b/src/main/java/com/whop/api/resources/notifications/requests/BadgesNotificationsRequest.java new file mode 100644 index 00000000..3d79f821 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/requests/BadgesNotificationsRequest.java @@ -0,0 +1,149 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BadgesNotificationsRequest.Builder.class) +public final class BadgesNotificationsRequest { + private final Optional> experienceIds; + + private final Optional lastFetchedAt; + + private final Map additionalProperties; + + private BadgesNotificationsRequest( + Optional> experienceIds, + Optional lastFetchedAt, + Map additionalProperties) { + this.experienceIds = experienceIds; + this.lastFetchedAt = lastFetchedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only return badges for these experiences (exp_ tags). + */ + @JsonProperty("experience_ids") + public Optional> getExperienceIds() { + return experienceIds; + } + + /** + * @return The client's last fetched-at ISO 8601 timestamp, used to partially refresh badges after a websocket message. + */ + @JsonProperty("last_fetched_at") + public Optional getLastFetchedAt() { + return lastFetchedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BadgesNotificationsRequest && equalTo((BadgesNotificationsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BadgesNotificationsRequest other) { + return experienceIds.equals(other.experienceIds) && lastFetchedAt.equals(other.lastFetchedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.experienceIds, this.lastFetchedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> experienceIds = Optional.empty(); + + private Optional lastFetchedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(BadgesNotificationsRequest other) { + experienceIds(other.getExperienceIds()); + lastFetchedAt(other.getLastFetchedAt()); + return this; + } + + /** + *

Only return badges for these experiences (exp_ tags).

+ */ + @JsonSetter(value = "experience_ids", nulls = Nulls.SKIP) + public Builder experienceIds(Optional> experienceIds) { + this.experienceIds = experienceIds; + return this; + } + + public Builder experienceIds(List experienceIds) { + this.experienceIds = Optional.ofNullable(experienceIds); + return this; + } + + public Builder experienceIds(String experienceIds) { + this.experienceIds = Optional.of(Collections.singletonList(experienceIds)); + return this; + } + + /** + *

The client's last fetched-at ISO 8601 timestamp, used to partially refresh badges after a websocket message.

+ */ + @JsonSetter(value = "last_fetched_at", nulls = Nulls.SKIP) + public Builder lastFetchedAt(Optional lastFetchedAt) { + this.lastFetchedAt = lastFetchedAt; + return this; + } + + public Builder lastFetchedAt(String lastFetchedAt) { + this.lastFetchedAt = Optional.ofNullable(lastFetchedAt); + return this; + } + + public BadgesNotificationsRequest build() { + return new BadgesNotificationsRequest(experienceIds, lastFetchedAt, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/requests/CreateNotificationsRequest.java b/src/main/java/com/whop/api/resources/notifications/requests/CreateNotificationsRequest.java new file mode 100644 index 00000000..33b9e47b --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/requests/CreateNotificationsRequest.java @@ -0,0 +1,528 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateNotificationsRequest.Builder.class) +public final class CreateNotificationsRequest { + private final Optional accountId; + + private final String content; + + private final Optional experienceId; + + private final Optional iconUserId; + + private final Optional restPath; + + private final Optional subtitle; + + private final String title; + + private final Optional> userIds; + + private final Map additionalProperties; + + private CreateNotificationsRequest( + Optional accountId, + String content, + Optional experienceId, + Optional iconUserId, + Optional restPath, + Optional subtitle, + String title, + Optional> userIds, + Map additionalProperties) { + this.accountId = accountId; + this.content = content; + this.experienceId = experienceId; + this.iconUserId = iconUserId; + this.restPath = restPath; + this.subtitle = subtitle; + this.title = title; + this.userIds = userIds; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account whose team members receive the notification (biz_ tag). Exactly one of experience_id or account_id is required. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Main body text of the notification. + */ + @JsonProperty("content") + public String getContent() { + return content; + } + + /** + * @return Experience whose users receive the notification (exp_ tag). Exactly one of experience_id or account_id is required. + */ + @JsonProperty("experience_id") + public Optional getExperienceId() { + return experienceId; + } + + /** + * @return User whose profile picture is used as the notification icon. Defaults to the experience or account avatar. + */ + @JsonIgnore + public Optional getIconUserId() { + if (iconUserId == null) { + return Optional.empty(); + } + return iconUserId; + } + + /** + * @return Path segment appended to the generated deep link that opens your app, for example /settings/billing. + */ + @JsonIgnore + public Optional getRestPath() { + if (restPath == null) { + return Optional.empty(); + } + return restPath; + } + + /** + * @return Optional secondary line displayed below the title. + */ + @JsonIgnore + public Optional getSubtitle() { + if (subtitle == null) { + return Optional.empty(); + } + return subtitle; + } + + /** + * @return Headline text of the notification. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return Optional user_ tags narrowing the audience. When provided, only these users are notified (as a mention), provided they are in the targeted experience or account. + */ + @JsonProperty("user_ids") + public Optional> getUserIds() { + return userIds; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_user_id") + private Optional _getIconUserId() { + return iconUserId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("rest_path") + private Optional _getRestPath() { + return restPath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("subtitle") + private Optional _getSubtitle() { + return subtitle; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateNotificationsRequest && equalTo((CreateNotificationsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateNotificationsRequest other) { + return accountId.equals(other.accountId) + && content.equals(other.content) + && experienceId.equals(other.experienceId) + && iconUserId.equals(other.iconUserId) + && restPath.equals(other.restPath) + && subtitle.equals(other.subtitle) + && title.equals(other.title) + && userIds.equals(other.userIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.content, + this.experienceId, + this.iconUserId, + this.restPath, + this.subtitle, + this.title, + this.userIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ContentStage builder() { + return new Builder(); + } + + public interface ContentStage { + /** + *

Main body text of the notification.

+ */ + TitleStage content(@NotNull String content); + + Builder from(CreateNotificationsRequest other); + } + + public interface TitleStage { + /** + *

Headline text of the notification.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + CreateNotificationsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account whose team members receive the notification (biz_ tag). Exactly one of experience_id or account_id is required.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + /** + *

Experience whose users receive the notification (exp_ tag). Exactly one of experience_id or account_id is required.

+ */ + _FinalStage experienceId(Optional experienceId); + + _FinalStage experienceId(String experienceId); + + /** + *

User whose profile picture is used as the notification icon. Defaults to the experience or account avatar.

+ */ + _FinalStage iconUserId(Optional iconUserId); + + _FinalStage iconUserId(String iconUserId); + + _FinalStage iconUserId(Nullable iconUserId); + + /** + *

Path segment appended to the generated deep link that opens your app, for example /settings/billing.

+ */ + _FinalStage restPath(Optional restPath); + + _FinalStage restPath(String restPath); + + _FinalStage restPath(Nullable restPath); + + /** + *

Optional secondary line displayed below the title.

+ */ + _FinalStage subtitle(Optional subtitle); + + _FinalStage subtitle(String subtitle); + + _FinalStage subtitle(Nullable subtitle); + + /** + *

Optional user_ tags narrowing the audience. When provided, only these users are notified (as a mention), provided they are in the targeted experience or account.

+ */ + _FinalStage userIds(Optional> userIds); + + _FinalStage userIds(List userIds); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ContentStage, TitleStage, _FinalStage { + private String content; + + private String title; + + private Optional> userIds = Optional.empty(); + + private Optional subtitle = Optional.empty(); + + private Optional restPath = Optional.empty(); + + private Optional iconUserId = Optional.empty(); + + private Optional experienceId = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateNotificationsRequest other) { + accountId(other.getAccountId()); + content(other.getContent()); + experienceId(other.getExperienceId()); + iconUserId(other.getIconUserId()); + restPath(other.getRestPath()); + subtitle(other.getSubtitle()); + title(other.getTitle()); + userIds(other.getUserIds()); + return this; + } + + /** + *

Main body text of the notification.

+ *

Main body text of the notification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("content") + public TitleStage content(@NotNull String content) { + this.content = Objects.requireNonNull(content, "content must not be null"); + return this; + } + + /** + *

Headline text of the notification.

+ *

Headline text of the notification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Optional user_ tags narrowing the audience. When provided, only these users are notified (as a mention), provided they are in the targeted experience or account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userIds(List userIds) { + this.userIds = Optional.ofNullable(userIds); + return this; + } + + /** + *

Optional user_ tags narrowing the audience. When provided, only these users are notified (as a mention), provided they are in the targeted experience or account.

+ */ + @java.lang.Override + @JsonSetter(value = "user_ids", nulls = Nulls.SKIP) + public _FinalStage userIds(Optional> userIds) { + this.userIds = userIds; + return this; + } + + /** + *

Optional secondary line displayed below the title.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subtitle(Nullable subtitle) { + if (subtitle.isNull()) { + this.subtitle = null; + } else if (subtitle.isEmpty()) { + this.subtitle = Optional.empty(); + } else { + this.subtitle = Optional.of(subtitle.get()); + } + return this; + } + + /** + *

Optional secondary line displayed below the title.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subtitle(String subtitle) { + this.subtitle = Optional.ofNullable(subtitle); + return this; + } + + /** + *

Optional secondary line displayed below the title.

+ */ + @java.lang.Override + @JsonSetter(value = "subtitle", nulls = Nulls.SKIP) + public _FinalStage subtitle(Optional subtitle) { + this.subtitle = subtitle; + return this; + } + + /** + *

Path segment appended to the generated deep link that opens your app, for example /settings/billing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage restPath(Nullable restPath) { + if (restPath.isNull()) { + this.restPath = null; + } else if (restPath.isEmpty()) { + this.restPath = Optional.empty(); + } else { + this.restPath = Optional.of(restPath.get()); + } + return this; + } + + /** + *

Path segment appended to the generated deep link that opens your app, for example /settings/billing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage restPath(String restPath) { + this.restPath = Optional.ofNullable(restPath); + return this; + } + + /** + *

Path segment appended to the generated deep link that opens your app, for example /settings/billing.

+ */ + @java.lang.Override + @JsonSetter(value = "rest_path", nulls = Nulls.SKIP) + public _FinalStage restPath(Optional restPath) { + this.restPath = restPath; + return this; + } + + /** + *

User whose profile picture is used as the notification icon. Defaults to the experience or account avatar.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUserId(Nullable iconUserId) { + if (iconUserId.isNull()) { + this.iconUserId = null; + } else if (iconUserId.isEmpty()) { + this.iconUserId = Optional.empty(); + } else { + this.iconUserId = Optional.of(iconUserId.get()); + } + return this; + } + + /** + *

User whose profile picture is used as the notification icon. Defaults to the experience or account avatar.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUserId(String iconUserId) { + this.iconUserId = Optional.ofNullable(iconUserId); + return this; + } + + /** + *

User whose profile picture is used as the notification icon. Defaults to the experience or account avatar.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_user_id", nulls = Nulls.SKIP) + public _FinalStage iconUserId(Optional iconUserId) { + this.iconUserId = iconUserId; + return this; + } + + /** + *

Experience whose users receive the notification (exp_ tag). Exactly one of experience_id or account_id is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage experienceId(String experienceId) { + this.experienceId = Optional.ofNullable(experienceId); + return this; + } + + /** + *

Experience whose users receive the notification (exp_ tag). Exactly one of experience_id or account_id is required.

+ */ + @java.lang.Override + @JsonSetter(value = "experience_id", nulls = Nulls.SKIP) + public _FinalStage experienceId(Optional experienceId) { + this.experienceId = experienceId; + return this; + } + + /** + *

Account whose team members receive the notification (biz_ tag). Exactly one of experience_id or account_id is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Account whose team members receive the notification (biz_ tag). Exactly one of experience_id or account_id is required.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public CreateNotificationsRequest build() { + return new CreateNotificationsRequest( + accountId, + content, + experienceId, + iconUserId, + restPath, + subtitle, + title, + userIds, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/requests/ListNotificationsRequest.java b/src/main/java/com/whop/api/resources/notifications/requests/ListNotificationsRequest.java new file mode 100644 index 00000000..164658e8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/requests/ListNotificationsRequest.java @@ -0,0 +1,264 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListNotificationsRequest.Builder.class) +public final class ListNotificationsRequest { + private final Optional unread; + + private final Optional experienceId; + + private final Optional accountId; + + private final Optional mentions; + + private final Optional first; + + private final Optional after; + + private final Map additionalProperties; + + private ListNotificationsRequest( + Optional unread, + Optional experienceId, + Optional accountId, + Optional mentions, + Optional first, + Optional after, + Map additionalProperties) { + this.unread = unread; + this.experienceId = experienceId; + this.accountId = accountId; + this.mentions = mentions; + this.first = first; + this.after = after; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only return notifications created since the user last viewed their source. + */ + @JsonProperty("unread") + public Optional getUnread() { + return unread; + } + + /** + * @return Only return notifications from this experience (exp_ tag). + */ + @JsonProperty("experience_id") + public Optional getExperienceId() { + return experienceId; + } + + /** + * @return Only return team notifications for this account (biz_ tag). + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Only return notifications that mention the user directly. + */ + @JsonProperty("mentions") + public Optional getMentions() { + return mentions; + } + + /** + * @return The number of notifications to return (default 20, max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor (a notification id from a previous page); returns notifications older than it. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListNotificationsRequest && equalTo((ListNotificationsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListNotificationsRequest other) { + return unread.equals(other.unread) + && experienceId.equals(other.experienceId) + && accountId.equals(other.accountId) + && mentions.equals(other.mentions) + && first.equals(other.first) + && after.equals(other.after); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.unread, this.experienceId, this.accountId, this.mentions, this.first, this.after); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional unread = Optional.empty(); + + private Optional experienceId = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional mentions = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListNotificationsRequest other) { + unread(other.getUnread()); + experienceId(other.getExperienceId()); + accountId(other.getAccountId()); + mentions(other.getMentions()); + first(other.getFirst()); + after(other.getAfter()); + return this; + } + + /** + *

Only return notifications created since the user last viewed their source.

+ */ + @JsonSetter(value = "unread", nulls = Nulls.SKIP) + public Builder unread(Optional unread) { + this.unread = unread; + return this; + } + + public Builder unread(Boolean unread) { + this.unread = Optional.ofNullable(unread); + return this; + } + + /** + *

Only return notifications from this experience (exp_ tag).

+ */ + @JsonSetter(value = "experience_id", nulls = Nulls.SKIP) + public Builder experienceId(Optional experienceId) { + this.experienceId = experienceId; + return this; + } + + public Builder experienceId(String experienceId) { + this.experienceId = Optional.ofNullable(experienceId); + return this; + } + + /** + *

Only return team notifications for this account (biz_ tag).

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Only return notifications that mention the user directly.

+ */ + @JsonSetter(value = "mentions", nulls = Nulls.SKIP) + public Builder mentions(Optional mentions) { + this.mentions = mentions; + return this; + } + + public Builder mentions(Boolean mentions) { + this.mentions = Optional.ofNullable(mentions); + return this; + } + + /** + *

The number of notifications to return (default 20, max 100).

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor (a notification id from a previous page); returns notifications older than it.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + public ListNotificationsRequest build() { + return new ListNotificationsRequest( + unread, experienceId, accountId, mentions, first, after, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/requests/MarkReadNotificationsRequest.java b/src/main/java/com/whop/api/resources/notifications/requests/MarkReadNotificationsRequest.java new file mode 100644 index 00000000..c867d1c7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/requests/MarkReadNotificationsRequest.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MarkReadNotificationsRequest.Builder.class) +public final class MarkReadNotificationsRequest { + private final Optional all; + + private final Optional experienceId; + + private final Map additionalProperties; + + private MarkReadNotificationsRequest( + Optional all, Optional experienceId, Map additionalProperties) { + this.all = all; + this.experienceId = experienceId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Pass true to mark every notification read. Exactly one of experience_id or all is required. + */ + @JsonProperty("all") + public Optional getAll() { + return all; + } + + /** + * @return Experience to mark read (exp_ tag). Exactly one of experience_id or all is required. + */ + @JsonProperty("experience_id") + public Optional getExperienceId() { + return experienceId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MarkReadNotificationsRequest && equalTo((MarkReadNotificationsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MarkReadNotificationsRequest other) { + return all.equals(other.all) && experienceId.equals(other.experienceId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.all, this.experienceId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional all = Optional.empty(); + + private Optional experienceId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MarkReadNotificationsRequest other) { + all(other.getAll()); + experienceId(other.getExperienceId()); + return this; + } + + /** + *

Pass true to mark every notification read. Exactly one of experience_id or all is required.

+ */ + @JsonSetter(value = "all", nulls = Nulls.SKIP) + public Builder all(Optional all) { + this.all = all; + return this; + } + + public Builder all(Boolean all) { + this.all = Optional.ofNullable(all); + return this; + } + + /** + *

Experience to mark read (exp_ tag). Exactly one of experience_id or all is required.

+ */ + @JsonSetter(value = "experience_id", nulls = Nulls.SKIP) + public Builder experienceId(Optional experienceId) { + this.experienceId = experienceId; + return this; + } + + public Builder experienceId(String experienceId) { + this.experienceId = Optional.ofNullable(experienceId); + return this; + } + + public MarkReadNotificationsRequest build() { + return new MarkReadNotificationsRequest(all, experienceId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/requests/RetrieveNotificationsRequest.java b/src/main/java/com/whop/api/resources/notifications/requests/RetrieveNotificationsRequest.java new file mode 100644 index 00000000..3ba127f6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/requests/RetrieveNotificationsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveNotificationsRequest.Builder.class) +public final class RetrieveNotificationsRequest { + private final Map additionalProperties; + + private RetrieveNotificationsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveNotificationsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveNotificationsRequest other) { + return this; + } + + public RetrieveNotificationsRequest build() { + return new RetrieveNotificationsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/topics/AsyncRawTopicsClient.java b/src/main/java/com/whop/api/resources/notifications/topics/AsyncRawTopicsClient.java new file mode 100644 index 00000000..400a04af --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/topics/AsyncRawTopicsClient.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.topics; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.notifications.topics.requests.ListTopicsRequest; +import com.whop.api.resources.notifications.topics.types.ListTopicsResponse; +import com.whop.api.types.NotificationTopic; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTopicsClient { + protected final ClientOptions clientOptions; + + public AsyncRawTopicsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public CompletableFuture>> list() { + return list(ListTopicsRequest.builder().build()); + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListTopicsRequest.builder().build(), requestOptions); + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public CompletableFuture>> list( + ListTopicsRequest request) { + return list(request, null); + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public CompletableFuture>> list( + ListTopicsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("notifications/topics"); + if (request.getTopicType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "topic_type", request.getTopicType().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListTopicsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListTopicsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListTopicsRequest nextRequest = ListTopicsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/topics/AsyncTopicsClient.java b/src/main/java/com/whop/api/resources/notifications/topics/AsyncTopicsClient.java new file mode 100644 index 00000000..4e9ac33c --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/topics/AsyncTopicsClient.java @@ -0,0 +1,58 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.topics; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.notifications.topics.requests.ListTopicsRequest; +import com.whop.api.types.NotificationTopic; +import java.util.concurrent.CompletableFuture; + +public class AsyncTopicsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTopicsClient rawClient; + + public AsyncTopicsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTopicsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTopicsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public CompletableFuture> list(ListTopicsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public CompletableFuture> list( + ListTopicsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/topics/RawTopicsClient.java b/src/main/java/com/whop/api/resources/notifications/topics/RawTopicsClient.java new file mode 100644 index 00000000..c3aa8c77 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/topics/RawTopicsClient.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.topics; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.notifications.topics.requests.ListTopicsRequest; +import com.whop.api.resources.notifications.topics.types.ListTopicsResponse; +import com.whop.api.types.NotificationTopic; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTopicsClient { + protected final ClientOptions clientOptions; + + public RawTopicsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public WhopApiHttpResponse> list() { + return list(ListTopicsRequest.builder().build()); + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListTopicsRequest.builder().build(), requestOptions); + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public WhopApiHttpResponse> list(ListTopicsRequest request) { + return list(request, null); + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public WhopApiHttpResponse> list( + ListTopicsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("notifications/topics"); + if (request.getTopicType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "topic_type", request.getTopicType().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListTopicsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListTopicsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListTopicsRequest nextRequest = ListTopicsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/topics/TopicsClient.java b/src/main/java/com/whop/api/resources/notifications/topics/TopicsClient.java new file mode 100644 index 00000000..12ade186 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/topics/TopicsClient.java @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.topics; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.notifications.topics.requests.ListTopicsRequest; +import com.whop.api.types.NotificationTopic; + +public class TopicsClient { + protected final ClientOptions clientOptions; + + private final RawTopicsClient rawClient; + + public TopicsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTopicsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTopicsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public SyncPagingIterable list(ListTopicsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the platform's visible notification topics — the categories users can set notification preferences on. App-created topics are internal and not returned. + */ + public SyncPagingIterable list(ListTopicsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/topics/requests/ListTopicsRequest.java b/src/main/java/com/whop/api/resources/notifications/topics/requests/ListTopicsRequest.java new file mode 100644 index 00000000..4821d729 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/topics/requests/ListTopicsRequest.java @@ -0,0 +1,172 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.topics.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.notifications.topics.types.ListTopicsRequestTopicType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListTopicsRequest.Builder.class) +public final class ListTopicsRequest { + private final Optional topicType; + + private final Optional first; + + private final Optional after; + + private final Map additionalProperties; + + private ListTopicsRequest( + Optional topicType, + Optional first, + Optional after, + Map additionalProperties) { + this.topicType = topicType; + this.first = first; + this.after = after; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only return topics of this scope: user (member notifications) or account_team (team notifications). + */ + @JsonProperty("topic_type") + public Optional getTopicType() { + return topicType; + } + + /** + * @return The number of topics to return (default 20, max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns topics after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListTopicsRequest && equalTo((ListTopicsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListTopicsRequest other) { + return topicType.equals(other.topicType) && first.equals(other.first) && after.equals(other.after); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.topicType, this.first, this.after); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional topicType = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListTopicsRequest other) { + topicType(other.getTopicType()); + first(other.getFirst()); + after(other.getAfter()); + return this; + } + + /** + *

Only return topics of this scope: user (member notifications) or account_team (team notifications).

+ */ + @JsonSetter(value = "topic_type", nulls = Nulls.SKIP) + public Builder topicType(Optional topicType) { + this.topicType = topicType; + return this; + } + + public Builder topicType(ListTopicsRequestTopicType topicType) { + this.topicType = Optional.ofNullable(topicType); + return this; + } + + /** + *

The number of topics to return (default 20, max 100).

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor; returns topics after this position.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + public ListTopicsRequest build() { + return new ListTopicsRequest(topicType, first, after, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/topics/types/ListTopicsRequestTopicType.java b/src/main/java/com/whop/api/resources/notifications/topics/types/ListTopicsRequestTopicType.java new file mode 100644 index 00000000..a3ec2014 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/topics/types/ListTopicsRequestTopicType.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.topics.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListTopicsRequestTopicType { + public static final ListTopicsRequestTopicType USER = new ListTopicsRequestTopicType(Value.USER, "user"); + + public static final ListTopicsRequestTopicType ACCOUNT_TEAM = + new ListTopicsRequestTopicType(Value.ACCOUNT_TEAM, "account_team"); + + private final Value value; + + private final String string; + + ListTopicsRequestTopicType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListTopicsRequestTopicType + && this.string.equals(((ListTopicsRequestTopicType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case USER: + return visitor.visitUser(); + case ACCOUNT_TEAM: + return visitor.visitAccountTeam(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListTopicsRequestTopicType valueOf(String value) { + switch (value) { + case "user": + return USER; + case "account_team": + return ACCOUNT_TEAM; + default: + return new ListTopicsRequestTopicType(Value.UNKNOWN, value); + } + } + + public enum Value { + USER, + + ACCOUNT_TEAM, + + UNKNOWN + } + + public interface Visitor { + T visitUser(); + + T visitAccountTeam(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/topics/types/ListTopicsResponse.java b/src/main/java/com/whop/api/resources/notifications/topics/types/ListTopicsResponse.java new file mode 100644 index 00000000..66483687 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/topics/types/ListTopicsResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.topics.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.NotificationTopic; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListTopicsResponse.Builder.class) +public final class ListTopicsResponse { + private final List data; + + private final ListTopicsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListTopicsResponse( + List data, + ListTopicsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListTopicsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListTopicsResponse && equalTo((ListTopicsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListTopicsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListTopicsResponsePageInfo pageInfo); + + Builder from(ListTopicsResponse other); + } + + public interface _FinalStage { + ListTopicsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(NotificationTopic data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListTopicsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListTopicsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListTopicsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(NotificationTopic data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListTopicsResponse build() { + return new ListTopicsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/topics/types/ListTopicsResponsePageInfo.java b/src/main/java/com/whop/api/resources/notifications/topics/types/ListTopicsResponsePageInfo.java new file mode 100644 index 00000000..1dd98a59 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/topics/types/ListTopicsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.topics.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListTopicsResponsePageInfo.Builder.class) +public final class ListTopicsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListTopicsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListTopicsResponsePageInfo && equalTo((ListTopicsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListTopicsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListTopicsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListTopicsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListTopicsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListTopicsResponsePageInfo build() { + return new ListTopicsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/types/BadgesNotificationsResponse.java b/src/main/java/com/whop/api/resources/notifications/types/BadgesNotificationsResponse.java new file mode 100644 index 00000000..cc127430 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/types/BadgesNotificationsResponse.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.NotificationBadge; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BadgesNotificationsResponse.Builder.class) +public final class BadgesNotificationsResponse { + private final List data; + + private final Map additionalProperties; + + private BadgesNotificationsResponse(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BadgesNotificationsResponse && equalTo((BadgesNotificationsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BadgesNotificationsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(BadgesNotificationsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(NotificationBadge data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public BadgesNotificationsResponse build() { + return new BadgesNotificationsResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/types/CreateNotificationsResponse.java b/src/main/java/com/whop/api/resources/notifications/types/CreateNotificationsResponse.java new file mode 100644 index 00000000..4187b6fe --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/types/CreateNotificationsResponse.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateNotificationsResponse.Builder.class) +public final class CreateNotificationsResponse { + private final boolean success; + + private final Map additionalProperties; + + private CreateNotificationsResponse(boolean success, Map additionalProperties) { + this.success = success; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("success") + public boolean getSuccess() { + return success; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateNotificationsResponse && equalTo((CreateNotificationsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateNotificationsResponse other) { + return success == other.success; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.success); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SuccessStage builder() { + return new Builder(); + } + + public interface SuccessStage { + _FinalStage success(boolean success); + + Builder from(CreateNotificationsResponse other); + } + + public interface _FinalStage { + CreateNotificationsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SuccessStage, _FinalStage { + private boolean success; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateNotificationsResponse other) { + success(other.getSuccess()); + return this; + } + + @java.lang.Override + @JsonSetter("success") + public _FinalStage success(boolean success) { + this.success = success; + return this; + } + + @java.lang.Override + public CreateNotificationsResponse build() { + return new CreateNotificationsResponse(success, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/types/ListNotificationsResponse.java b/src/main/java/com/whop/api/resources/notifications/types/ListNotificationsResponse.java new file mode 100644 index 00000000..b05f60c8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/types/ListNotificationsResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Notification; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListNotificationsResponse.Builder.class) +public final class ListNotificationsResponse { + private final List data; + + private final ListNotificationsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListNotificationsResponse( + List data, + ListNotificationsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListNotificationsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListNotificationsResponse && equalTo((ListNotificationsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListNotificationsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListNotificationsResponsePageInfo pageInfo); + + Builder from(ListNotificationsResponse other); + } + + public interface _FinalStage { + ListNotificationsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(Notification data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListNotificationsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListNotificationsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListNotificationsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(Notification data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListNotificationsResponse build() { + return new ListNotificationsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/types/ListNotificationsResponsePageInfo.java b/src/main/java/com/whop/api/resources/notifications/types/ListNotificationsResponsePageInfo.java new file mode 100644 index 00000000..e159f5bd --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/types/ListNotificationsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListNotificationsResponsePageInfo.Builder.class) +public final class ListNotificationsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListNotificationsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListNotificationsResponsePageInfo && equalTo((ListNotificationsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListNotificationsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListNotificationsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListNotificationsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListNotificationsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListNotificationsResponsePageInfo build() { + return new ListNotificationsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/notifications/types/MarkReadNotificationsResponse.java b/src/main/java/com/whop/api/resources/notifications/types/MarkReadNotificationsResponse.java new file mode 100644 index 00000000..c31e8817 --- /dev/null +++ b/src/main/java/com/whop/api/resources/notifications/types/MarkReadNotificationsResponse.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.notifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.NotificationBadge; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MarkReadNotificationsResponse.Builder.class) +public final class MarkReadNotificationsResponse { + private final List data; + + private final Map additionalProperties; + + private MarkReadNotificationsResponse(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MarkReadNotificationsResponse && equalTo((MarkReadNotificationsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MarkReadNotificationsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MarkReadNotificationsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(NotificationBadge data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public MarkReadNotificationsResponse build() { + return new MarkReadNotificationsResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/AsyncPartnersClient.java b/src/main/java/com/whop/api/resources/partners/AsyncPartnersClient.java new file mode 100644 index 00000000..318e1560 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/AsyncPartnersClient.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.partners.businesses.AsyncBusinessesClient; +import com.whop.api.resources.partners.requests.LeaderboardPartnersRequest; +import com.whop.api.resources.partners.requests.ReferredUsersPartnersRequest; +import com.whop.api.resources.partners.types.CreatePartnersResponse; +import com.whop.api.resources.partners.types.LeaderboardPartnersResponse; +import com.whop.api.resources.partners.types.ReferredUsersPartnersResponseDataItem; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class AsyncPartnersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPartnersClient rawClient; + + protected final Supplier businessesClient; + + public AsyncPartnersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPartnersClient(clientOptions); + this.businessesClient = Suppliers.memoize(() -> new AsyncBusinessesClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPartnersClient withRawResponse() { + return this.rawClient; + } + + /** + * Enrolls the calling user in the Whop partner program, making their partner businesses eligible for earnings. Idempotent — enrolling again keeps the original enrollment time. + */ + public CompletableFuture create() { + return this.rawClient.create().thenApply(response -> response.body()); + } + + /** + * Enrolls the calling user in the Whop partner program, making their partner businesses eligible for earnings. Idempotent — enrolling again keeps the original enrollment time. + */ + public CompletableFuture create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).thenApply(response -> response.body()); + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public CompletableFuture leaderboard() { + return this.rawClient.leaderboard().thenApply(response -> response.body()); + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public CompletableFuture leaderboard(RequestOptions requestOptions) { + return this.rawClient.leaderboard(requestOptions).thenApply(response -> response.body()); + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public CompletableFuture leaderboard(LeaderboardPartnersRequest request) { + return this.rawClient.leaderboard(request).thenApply(response -> response.body()); + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public CompletableFuture leaderboard( + LeaderboardPartnersRequest request, RequestOptions requestOptions) { + return this.rawClient.leaderboard(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public CompletableFuture> referredUsers() { + return this.rawClient.referredUsers().thenApply(response -> response.body()); + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public CompletableFuture> referredUsers( + RequestOptions requestOptions) { + return this.rawClient.referredUsers(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public CompletableFuture> referredUsers( + ReferredUsersPartnersRequest request) { + return this.rawClient.referredUsers(request).thenApply(response -> response.body()); + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public CompletableFuture> referredUsers( + ReferredUsersPartnersRequest request, RequestOptions requestOptions) { + return this.rawClient.referredUsers(request, requestOptions).thenApply(response -> response.body()); + } + + public AsyncBusinessesClient businesses() { + return this.businessesClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/AsyncRawPartnersClient.java b/src/main/java/com/whop/api/resources/partners/AsyncRawPartnersClient.java new file mode 100644 index 00000000..05745921 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/AsyncRawPartnersClient.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.partners.requests.LeaderboardPartnersRequest; +import com.whop.api.resources.partners.requests.ReferredUsersPartnersRequest; +import com.whop.api.resources.partners.types.CreatePartnersResponse; +import com.whop.api.resources.partners.types.LeaderboardPartnersResponse; +import com.whop.api.resources.partners.types.ReferredUsersPartnersResponse; +import com.whop.api.resources.partners.types.ReferredUsersPartnersResponseDataItem; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPartnersClient { + protected final ClientOptions clientOptions; + + public AsyncRawPartnersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Enrolls the calling user in the Whop partner program, making their partner businesses eligible for earnings. Idempotent — enrolling again keeps the original enrollment time. + */ + public CompletableFuture> create() { + return create(null); + } + + /** + * Enrolls the calling user in the Whop partner program, making their partner businesses eligible for earnings. Idempotent — enrolling again keeps the original enrollment time. + */ + public CompletableFuture> create(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("partners"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreatePartnersResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public CompletableFuture> leaderboard() { + return leaderboard(LeaderboardPartnersRequest.builder().build()); + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public CompletableFuture> leaderboard( + RequestOptions requestOptions) { + return leaderboard(LeaderboardPartnersRequest.builder().build(), requestOptions); + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public CompletableFuture> leaderboard( + LeaderboardPartnersRequest request) { + return leaderboard(request, null); + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public CompletableFuture> leaderboard( + LeaderboardPartnersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("partners/leaderboard"); + if (request.getPeriod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "period", request.getPeriod().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, LeaderboardPartnersResponse.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public CompletableFuture>> + referredUsers() { + return referredUsers(ReferredUsersPartnersRequest.builder().build()); + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public CompletableFuture>> + referredUsers(RequestOptions requestOptions) { + return referredUsers(ReferredUsersPartnersRequest.builder().build(), requestOptions); + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public CompletableFuture>> + referredUsers(ReferredUsersPartnersRequest request) { + return referredUsers(request, null); + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public CompletableFuture>> + referredUsers(ReferredUsersPartnersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("partners/referred_users"); + if (request.getHasBusinesses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "has_businesses", request.getHasBusinesses().get(), false); + } + if (request.getHasEarningBusinesses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "has_earning_businesses", + request.getHasEarningBusinesses().get(), + false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ReferredUsersPartnersResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ReferredUsersPartnersResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ReferredUsersPartnersRequest nextRequest = ReferredUsersPartnersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return referredUsers(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + if (response.code() == 401) { + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/partners/PartnersClient.java b/src/main/java/com/whop/api/resources/partners/PartnersClient.java new file mode 100644 index 00000000..fbf9e230 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/PartnersClient.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.partners.businesses.BusinessesClient; +import com.whop.api.resources.partners.requests.LeaderboardPartnersRequest; +import com.whop.api.resources.partners.requests.ReferredUsersPartnersRequest; +import com.whop.api.resources.partners.types.CreatePartnersResponse; +import com.whop.api.resources.partners.types.LeaderboardPartnersResponse; +import com.whop.api.resources.partners.types.ReferredUsersPartnersResponseDataItem; +import java.util.function.Supplier; + +public class PartnersClient { + protected final ClientOptions clientOptions; + + private final RawPartnersClient rawClient; + + protected final Supplier businessesClient; + + public PartnersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPartnersClient(clientOptions); + this.businessesClient = Suppliers.memoize(() -> new BusinessesClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPartnersClient withRawResponse() { + return this.rawClient; + } + + /** + * Enrolls the calling user in the Whop partner program, making their partner businesses eligible for earnings. Idempotent — enrolling again keeps the original enrollment time. + */ + public CreatePartnersResponse create() { + return this.rawClient.create().body(); + } + + /** + * Enrolls the calling user in the Whop partner program, making their partner businesses eligible for earnings. Idempotent — enrolling again keeps the original enrollment time. + */ + public CreatePartnersResponse create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).body(); + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public LeaderboardPartnersResponse leaderboard() { + return this.rawClient.leaderboard().body(); + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public LeaderboardPartnersResponse leaderboard(RequestOptions requestOptions) { + return this.rawClient.leaderboard(requestOptions).body(); + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public LeaderboardPartnersResponse leaderboard(LeaderboardPartnersRequest request) { + return this.rawClient.leaderboard(request).body(); + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public LeaderboardPartnersResponse leaderboard(LeaderboardPartnersRequest request, RequestOptions requestOptions) { + return this.rawClient.leaderboard(request, requestOptions).body(); + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public SyncPagingIterable referredUsers() { + return this.rawClient.referredUsers().body(); + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public SyncPagingIterable referredUsers(RequestOptions requestOptions) { + return this.rawClient.referredUsers(requestOptions).body(); + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public SyncPagingIterable referredUsers( + ReferredUsersPartnersRequest request) { + return this.rawClient.referredUsers(request).body(); + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public SyncPagingIterable referredUsers( + ReferredUsersPartnersRequest request, RequestOptions requestOptions) { + return this.rawClient.referredUsers(request, requestOptions).body(); + } + + public BusinessesClient businesses() { + return this.businessesClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/RawPartnersClient.java b/src/main/java/com/whop/api/resources/partners/RawPartnersClient.java new file mode 100644 index 00000000..87e13105 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/RawPartnersClient.java @@ -0,0 +1,284 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.partners.requests.LeaderboardPartnersRequest; +import com.whop.api.resources.partners.requests.ReferredUsersPartnersRequest; +import com.whop.api.resources.partners.types.CreatePartnersResponse; +import com.whop.api.resources.partners.types.LeaderboardPartnersResponse; +import com.whop.api.resources.partners.types.ReferredUsersPartnersResponse; +import com.whop.api.resources.partners.types.ReferredUsersPartnersResponseDataItem; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPartnersClient { + protected final ClientOptions clientOptions; + + public RawPartnersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Enrolls the calling user in the Whop partner program, making their partner businesses eligible for earnings. Idempotent — enrolling again keeps the original enrollment time. + */ + public WhopApiHttpResponse create() { + return create(null); + } + + /** + * Enrolls the calling user in the Whop partner program, making their partner businesses eligible for earnings. Idempotent — enrolling again keeps the original enrollment time. + */ + public WhopApiHttpResponse create(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("partners"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreatePartnersResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public WhopApiHttpResponse leaderboard() { + return leaderboard(LeaderboardPartnersRequest.builder().build()); + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public WhopApiHttpResponse leaderboard(RequestOptions requestOptions) { + return leaderboard(LeaderboardPartnersRequest.builder().build(), requestOptions); + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public WhopApiHttpResponse leaderboard(LeaderboardPartnersRequest request) { + return leaderboard(request, null); + } + + /** + * Ranks referrers by partner business earnings — all-time by default, or over the current day, month, year, or trailing 30 days. Authentication is optional: authenticated callers also get their own standing, anonymous callers get the rankings alone. + */ + public WhopApiHttpResponse leaderboard( + LeaderboardPartnersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("partners/leaderboard"); + if (request.getPeriod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "period", request.getPeriod().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LeaderboardPartnersResponse.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public WhopApiHttpResponse> referredUsers() { + return referredUsers(ReferredUsersPartnersRequest.builder().build()); + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public WhopApiHttpResponse> referredUsers( + RequestOptions requestOptions) { + return referredUsers(ReferredUsersPartnersRequest.builder().build(), requestOptions); + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public WhopApiHttpResponse> referredUsers( + ReferredUsersPartnersRequest request) { + return referredUsers(request, null); + } + + /** + * Lists the users the caller referred onto Whop (newest first), each with the second-tier earnings the caller has made from that user's businesses. + */ + public WhopApiHttpResponse> referredUsers( + ReferredUsersPartnersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("partners/referred_users"); + if (request.getHasBusinesses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "has_businesses", request.getHasBusinesses().get(), false); + } + if (request.getHasEarningBusinesses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "has_earning_businesses", + request.getHasEarningBusinesses().get(), + false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ReferredUsersPartnersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReferredUsersPartnersResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ReferredUsersPartnersRequest nextRequest = ReferredUsersPartnersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> referredUsers( + nextRequest, requestOptions) + .body()), + response); + } + try { + if (response.code() == 401) { + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/AsyncBusinessesClient.java b/src/main/java/com/whop/api/resources/partners/businesses/AsyncBusinessesClient.java new file mode 100644 index 00000000..4ce2420e --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/AsyncBusinessesClient.java @@ -0,0 +1,99 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.partners.businesses.earnings.AsyncEarningsClient; +import com.whop.api.resources.partners.businesses.requests.ListBusinessesRequest; +import com.whop.api.resources.partners.businesses.requests.RetrieveBusinessesRequest; +import com.whop.api.resources.partners.businesses.types.ListBusinessesResponseDataItem; +import com.whop.api.resources.partners.businesses.types.RetrieveBusinessesResponse; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class AsyncBusinessesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawBusinessesClient rawClient; + + protected final Supplier earningsClient; + + public AsyncBusinessesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawBusinessesClient(clientOptions); + this.earningsClient = Suppliers.memoize(() -> new AsyncEarningsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawBusinessesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public CompletableFuture> list(ListBusinessesRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public CompletableFuture> list( + ListBusinessesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public CompletableFuture retrieve(String id, RetrieveBusinessesRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public CompletableFuture retrieve( + String id, RetrieveBusinessesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + public AsyncEarningsClient earnings() { + return this.earningsClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/AsyncRawBusinessesClient.java b/src/main/java/com/whop/api/resources/partners/businesses/AsyncRawBusinessesClient.java new file mode 100644 index 00000000..7cf92e96 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/AsyncRawBusinessesClient.java @@ -0,0 +1,298 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.partners.businesses.requests.ListBusinessesRequest; +import com.whop.api.resources.partners.businesses.requests.RetrieveBusinessesRequest; +import com.whop.api.resources.partners.businesses.types.ListBusinessesResponse; +import com.whop.api.resources.partners.businesses.types.ListBusinessesResponseDataItem; +import com.whop.api.resources.partners.businesses.types.RetrieveBusinessesResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawBusinessesClient { + protected final ClientOptions clientOptions; + + public AsyncRawBusinessesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public CompletableFuture>> list() { + return list(ListBusinessesRequest.builder().build()); + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListBusinessesRequest.builder().build(), requestOptions); + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public CompletableFuture>> list( + ListBusinessesRequest request) { + return list(request, null); + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public CompletableFuture>> list( + ListBusinessesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("partners/businesses"); + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getHasEarnings().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "has_earnings", request.getHasEarnings().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getReferredUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "referred_user_id", request.getReferredUserId().get(), false); + } + if (request.getReferredUsername().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "referred_username", request.getReferredUsername().get(), false); + } + if (request.getTier().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "tier", request.getTier().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListBusinessesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListBusinessesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListBusinessesRequest nextRequest = ListBusinessesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveBusinessesRequest.builder().build()); + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveBusinessesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public CompletableFuture> retrieve( + String id, RetrieveBusinessesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public CompletableFuture> retrieve( + String id, RetrieveBusinessesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("partners/businesses") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, RetrieveBusinessesResponse.class), + response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/BusinessesClient.java b/src/main/java/com/whop/api/resources/partners/businesses/BusinessesClient.java new file mode 100644 index 00000000..f10e1b53 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/BusinessesClient.java @@ -0,0 +1,98 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.partners.businesses.earnings.EarningsClient; +import com.whop.api.resources.partners.businesses.requests.ListBusinessesRequest; +import com.whop.api.resources.partners.businesses.requests.RetrieveBusinessesRequest; +import com.whop.api.resources.partners.businesses.types.ListBusinessesResponseDataItem; +import com.whop.api.resources.partners.businesses.types.RetrieveBusinessesResponse; +import java.util.function.Supplier; + +public class BusinessesClient { + protected final ClientOptions clientOptions; + + private final RawBusinessesClient rawClient; + + protected final Supplier earningsClient; + + public BusinessesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawBusinessesClient(clientOptions); + this.earningsClient = Suppliers.memoize(() -> new EarningsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawBusinessesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public SyncPagingIterable list(ListBusinessesRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public SyncPagingIterable list( + ListBusinessesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public RetrieveBusinessesResponse retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public RetrieveBusinessesResponse retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public RetrieveBusinessesResponse retrieve(String id, RetrieveBusinessesRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public RetrieveBusinessesResponse retrieve( + String id, RetrieveBusinessesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + public EarningsClient earnings() { + return this.earningsClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/RawBusinessesClient.java b/src/main/java/com/whop/api/resources/partners/businesses/RawBusinessesClient.java new file mode 100644 index 00000000..777f4891 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/RawBusinessesClient.java @@ -0,0 +1,246 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.partners.businesses.requests.ListBusinessesRequest; +import com.whop.api.resources.partners.businesses.requests.RetrieveBusinessesRequest; +import com.whop.api.resources.partners.businesses.types.ListBusinessesResponse; +import com.whop.api.resources.partners.businesses.types.ListBusinessesResponseDataItem; +import com.whop.api.resources.partners.businesses.types.RetrieveBusinessesResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawBusinessesClient { + protected final ClientOptions clientOptions; + + public RawBusinessesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public WhopApiHttpResponse> list() { + return list(ListBusinessesRequest.builder().build()); + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListBusinessesRequest.builder().build(), requestOptions); + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public WhopApiHttpResponse> list(ListBusinessesRequest request) { + return list(request, null); + } + + /** + * Lists the businesses the authenticated user referred onto Whop, most recent first. + */ + public WhopApiHttpResponse> list( + ListBusinessesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("partners/businesses"); + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getHasEarnings().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "has_earnings", request.getHasEarnings().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getReferredUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "referred_user_id", request.getReferredUserId().get(), false); + } + if (request.getReferredUsername().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "referred_username", request.getReferredUsername().get(), false); + } + if (request.getTier().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "tier", request.getTier().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListBusinessesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListBusinessesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListBusinessesRequest nextRequest = ListBusinessesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveBusinessesRequest.builder().build()); + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveBusinessesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveBusinessesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single referred business and its referral terms. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveBusinessesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("partners/businesses") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrieveBusinessesResponse.class), + response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/AsyncEarningsClient.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/AsyncEarningsClient.java new file mode 100644 index 00000000..03509c5d --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/AsyncEarningsClient.java @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.partners.businesses.earnings.requests.ListEarningsRequest; +import com.whop.api.resources.partners.businesses.earnings.types.ListEarningsResponseDataItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncEarningsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawEarningsClient rawClient; + + public AsyncEarningsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawEarningsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawEarningsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public CompletableFuture> list(String id) { + return this.rawClient.list(id).thenApply(response -> response.body()); + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public CompletableFuture> list( + String id, RequestOptions requestOptions) { + return this.rawClient.list(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public CompletableFuture> list( + String id, ListEarningsRequest request) { + return this.rawClient.list(id, request).thenApply(response -> response.body()); + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public CompletableFuture> list( + String id, ListEarningsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/AsyncRawEarningsClient.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/AsyncRawEarningsClient.java new file mode 100644 index 00000000..46fb46e2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/AsyncRawEarningsClient.java @@ -0,0 +1,185 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.resources.partners.businesses.earnings.requests.ListEarningsRequest; +import com.whop.api.resources.partners.businesses.earnings.types.ListEarningsResponse; +import com.whop.api.resources.partners.businesses.earnings.types.ListEarningsResponseDataItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawEarningsClient { + protected final ClientOptions clientOptions; + + public AsyncRawEarningsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public CompletableFuture>> list(String id) { + return list(id, ListEarningsRequest.builder().build()); + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public CompletableFuture>> list( + String id, RequestOptions requestOptions) { + return list(id, ListEarningsRequest.builder().build(), requestOptions); + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public CompletableFuture>> list( + String id, ListEarningsRequest request) { + return list(id, request, null); + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public CompletableFuture>> list( + String id, ListEarningsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("partners/businesses") + .addPathSegment(id) + .addPathSegments("earnings"); + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getIncomeSource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "income_source", request.getIncomeSource().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListEarningsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListEarningsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListEarningsRequest nextRequest = ListEarningsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(id, nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/EarningsClient.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/EarningsClient.java new file mode 100644 index 00000000..486800c6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/EarningsClient.java @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.partners.businesses.earnings.requests.ListEarningsRequest; +import com.whop.api.resources.partners.businesses.earnings.types.ListEarningsResponseDataItem; + +public class EarningsClient { + protected final ClientOptions clientOptions; + + private final RawEarningsClient rawClient; + + public EarningsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawEarningsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawEarningsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public SyncPagingIterable list(String id) { + return this.rawClient.list(id).body(); + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public SyncPagingIterable list(String id, RequestOptions requestOptions) { + return this.rawClient.list(id, requestOptions).body(); + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public SyncPagingIterable list(String id, ListEarningsRequest request) { + return this.rawClient.list(id, request).body(); + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public SyncPagingIterable list( + String id, ListEarningsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/RawEarningsClient.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/RawEarningsClient.java new file mode 100644 index 00000000..403d1935 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/RawEarningsClient.java @@ -0,0 +1,158 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.resources.partners.businesses.earnings.requests.ListEarningsRequest; +import com.whop.api.resources.partners.businesses.earnings.types.ListEarningsResponse; +import com.whop.api.resources.partners.businesses.earnings.types.ListEarningsResponseDataItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawEarningsClient { + protected final ClientOptions clientOptions; + + public RawEarningsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public WhopApiHttpResponse> list(String id) { + return list(id, ListEarningsRequest.builder().build()); + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public WhopApiHttpResponse> list( + String id, RequestOptions requestOptions) { + return list(id, ListEarningsRequest.builder().build(), requestOptions); + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public WhopApiHttpResponse> list( + String id, ListEarningsRequest request) { + return list(id, request, null); + } + + /** + * Lists the earnings Whop pays out for one referred business's activity, most recent first. + */ + public WhopApiHttpResponse> list( + String id, ListEarningsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("partners/businesses") + .addPathSegment(id) + .addPathSegments("earnings"); + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getIncomeSource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "income_source", request.getIncomeSource().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListEarningsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListEarningsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListEarningsRequest nextRequest = ListEarningsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list( + id, nextRequest, requestOptions) + .body()), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/requests/ListEarningsRequest.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/requests/ListEarningsRequest.java new file mode 100644 index 00000000..661364cc --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/requests/ListEarningsRequest.java @@ -0,0 +1,391 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.partners.businesses.earnings.types.ListEarningsRequestDirection; +import com.whop.api.resources.partners.businesses.earnings.types.ListEarningsRequestIncomeSourceItem; +import com.whop.api.resources.partners.businesses.earnings.types.ListEarningsRequestOrder; +import com.whop.api.resources.partners.businesses.earnings.types.ListEarningsRequestStatus; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEarningsRequest.Builder.class) +public final class ListEarningsRequest { + private final Optional> incomeSource; + + private final Optional status; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Optional order; + + private final Optional direction; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Map additionalProperties; + + private ListEarningsRequest( + Optional> incomeSource, + Optional status, + Optional first, + Optional after, + Optional last, + Optional before, + Optional order, + Optional direction, + Optional createdBefore, + Optional createdAfter, + Map additionalProperties) { + this.incomeSource = incomeSource; + this.status = status; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.order = order; + this.direction = direction; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.additionalProperties = additionalProperties; + } + + /** + * @return Filter to earnings from these income sources. Repeat the parameter for each one (income_source=sales&income_source=ad_spend). + */ + @JsonProperty("income_source") + public Optional> getIncomeSource() { + return incomeSource; + } + + /** + * @return Filter by earning status. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + @JsonProperty("last") + public Optional getLast() { + return last; + } + + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The field to sort earnings by. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Only return earnings created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return earnings created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEarningsRequest && equalTo((ListEarningsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEarningsRequest other) { + return incomeSource.equals(other.incomeSource) + && status.equals(other.status) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before) + && order.equals(other.order) + && direction.equals(other.direction) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.incomeSource, + this.status, + this.first, + this.after, + this.last, + this.before, + this.order, + this.direction, + this.createdBefore, + this.createdAfter); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> incomeSource = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListEarningsRequest other) { + incomeSource(other.getIncomeSource()); + status(other.getStatus()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + order(other.getOrder()); + direction(other.getDirection()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + return this; + } + + /** + *

Filter to earnings from these income sources. Repeat the parameter for each one (income_source=sales&income_source=ad_spend).

+ */ + @JsonSetter(value = "income_source", nulls = Nulls.SKIP) + public Builder incomeSource(Optional> incomeSource) { + this.incomeSource = incomeSource; + return this; + } + + public Builder incomeSource(List incomeSource) { + this.incomeSource = Optional.ofNullable(incomeSource); + return this; + } + + public Builder incomeSource(ListEarningsRequestIncomeSourceItem incomeSource) { + this.incomeSource = Optional.of(Collections.singletonList(incomeSource)); + return this; + } + + /** + *

Filter by earning status.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListEarningsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The field to sort earnings by.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListEarningsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListEarningsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Only return earnings created before this timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return earnings created after this timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + public ListEarningsRequest build() { + return new ListEarningsRequest( + incomeSource, + status, + first, + after, + last, + before, + order, + direction, + createdBefore, + createdAfter, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsRequestDirection.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsRequestDirection.java new file mode 100644 index 00000000..5d7fb903 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEarningsRequestDirection { + public static final ListEarningsRequestDirection ASC = new ListEarningsRequestDirection(Value.ASC, "asc"); + + public static final ListEarningsRequestDirection DESC = new ListEarningsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListEarningsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEarningsRequestDirection + && this.string.equals(((ListEarningsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEarningsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListEarningsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsRequestIncomeSourceItem.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsRequestIncomeSourceItem.java new file mode 100644 index 00000000..0cb3586c --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsRequestIncomeSourceItem.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEarningsRequestIncomeSourceItem { + public static final ListEarningsRequestIncomeSourceItem CARD_INTERCHANGE = + new ListEarningsRequestIncomeSourceItem(Value.CARD_INTERCHANGE, "card_interchange"); + + public static final ListEarningsRequestIncomeSourceItem SALES = + new ListEarningsRequestIncomeSourceItem(Value.SALES, "sales"); + + public static final ListEarningsRequestIncomeSourceItem TRANSFER = + new ListEarningsRequestIncomeSourceItem(Value.TRANSFER, "transfer"); + + public static final ListEarningsRequestIncomeSourceItem AD_SPEND = + new ListEarningsRequestIncomeSourceItem(Value.AD_SPEND, "ad_spend"); + + private final Value value; + + private final String string; + + ListEarningsRequestIncomeSourceItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEarningsRequestIncomeSourceItem + && this.string.equals(((ListEarningsRequestIncomeSourceItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_INTERCHANGE: + return visitor.visitCardInterchange(); + case SALES: + return visitor.visitSales(); + case TRANSFER: + return visitor.visitTransfer(); + case AD_SPEND: + return visitor.visitAdSpend(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEarningsRequestIncomeSourceItem valueOf(String value) { + switch (value) { + case "card_interchange": + return CARD_INTERCHANGE; + case "sales": + return SALES; + case "transfer": + return TRANSFER; + case "ad_spend": + return AD_SPEND; + default: + return new ListEarningsRequestIncomeSourceItem(Value.UNKNOWN, value); + } + } + + public enum Value { + SALES, + + AD_SPEND, + + TRANSFER, + + CARD_INTERCHANGE, + + UNKNOWN + } + + public interface Visitor { + T visitSales(); + + T visitAdSpend(); + + T visitTransfer(); + + T visitCardInterchange(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsRequestOrder.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsRequestOrder.java new file mode 100644 index 00000000..1c465d73 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsRequestOrder.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEarningsRequestOrder { + public static final ListEarningsRequestOrder TRANSACTION_AMOUNT = + new ListEarningsRequestOrder(Value.TRANSACTION_AMOUNT, "transaction_amount"); + + public static final ListEarningsRequestOrder CREATED_AT = + new ListEarningsRequestOrder(Value.CREATED_AT, "created_at"); + + public static final ListEarningsRequestOrder COMMISSION_AMOUNT = + new ListEarningsRequestOrder(Value.COMMISSION_AMOUNT, "commission_amount"); + + public static final ListEarningsRequestOrder PAYOUT_AT = new ListEarningsRequestOrder(Value.PAYOUT_AT, "payout_at"); + + private final Value value; + + private final String string; + + ListEarningsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEarningsRequestOrder + && this.string.equals(((ListEarningsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TRANSACTION_AMOUNT: + return visitor.visitTransactionAmount(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case COMMISSION_AMOUNT: + return visitor.visitCommissionAmount(); + case PAYOUT_AT: + return visitor.visitPayoutAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEarningsRequestOrder valueOf(String value) { + switch (value) { + case "transaction_amount": + return TRANSACTION_AMOUNT; + case "created_at": + return CREATED_AT; + case "commission_amount": + return COMMISSION_AMOUNT; + case "payout_at": + return PAYOUT_AT; + default: + return new ListEarningsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + COMMISSION_AMOUNT, + + TRANSACTION_AMOUNT, + + PAYOUT_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitCommissionAmount(); + + T visitTransactionAmount(); + + T visitPayoutAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsRequestStatus.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsRequestStatus.java new file mode 100644 index 00000000..5c16fe7c --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsRequestStatus.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEarningsRequestStatus { + public static final ListEarningsRequestStatus PENDING = new ListEarningsRequestStatus(Value.PENDING, "pending"); + + public static final ListEarningsRequestStatus CANCELED = new ListEarningsRequestStatus(Value.CANCELED, "canceled"); + + public static final ListEarningsRequestStatus COMPLETED = + new ListEarningsRequestStatus(Value.COMPLETED, "completed"); + + public static final ListEarningsRequestStatus AWAITING_SETTLEMENT = + new ListEarningsRequestStatus(Value.AWAITING_SETTLEMENT, "awaiting_settlement"); + + public static final ListEarningsRequestStatus REVERSED = new ListEarningsRequestStatus(Value.REVERSED, "reversed"); + + private final Value value; + + private final String string; + + ListEarningsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEarningsRequestStatus + && this.string.equals(((ListEarningsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case CANCELED: + return visitor.visitCanceled(); + case COMPLETED: + return visitor.visitCompleted(); + case AWAITING_SETTLEMENT: + return visitor.visitAwaitingSettlement(); + case REVERSED: + return visitor.visitReversed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEarningsRequestStatus valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "canceled": + return CANCELED; + case "completed": + return COMPLETED; + case "awaiting_settlement": + return AWAITING_SETTLEMENT; + case "reversed": + return REVERSED; + default: + return new ListEarningsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + AWAITING_SETTLEMENT, + + PENDING, + + COMPLETED, + + CANCELED, + + REVERSED, + + UNKNOWN + } + + public interface Visitor { + T visitAwaitingSettlement(); + + T visitPending(); + + T visitCompleted(); + + T visitCanceled(); + + T visitReversed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponse.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponse.java new file mode 100644 index 00000000..edb0eb83 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponse.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEarningsResponse.Builder.class) +public final class ListEarningsResponse { + private final List data; + + private final ListEarningsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListEarningsResponse( + List data, + ListEarningsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListEarningsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEarningsResponse && equalTo((ListEarningsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEarningsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListEarningsResponsePageInfo pageInfo); + + Builder from(ListEarningsResponse other); + } + + public interface _FinalStage { + ListEarningsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ListEarningsResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListEarningsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListEarningsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListEarningsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ListEarningsResponseDataItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListEarningsResponse build() { + return new ListEarningsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItem.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItem.java new file mode 100644 index 00000000..7ad469fd --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItem.java @@ -0,0 +1,914 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEarningsResponseDataItem.Builder.class) +public final class ListEarningsResponseDataItem { + private final Optional account; + + private final Optional cancelationReason; + + private final Optional commissionAmountUsd; + + private final OffsetDateTime createdAt; + + private final Optional> financialActivity; + + private final Optional id; + + private final ListEarningsResponseDataItemIncomeSource incomeSource; + + private final ListEarningsResponseDataItemObject object; + + private final Optional payoutAt; + + private final Optional payoutPercentage; + + private final Optional product; + + private final Optional resource; + + private final boolean secondTier; + + private final ListEarningsResponseDataItemStatus status; + + private final String transactionAmountUsd; + + private final Map additionalProperties; + + private ListEarningsResponseDataItem( + Optional account, + Optional cancelationReason, + Optional commissionAmountUsd, + OffsetDateTime createdAt, + Optional> financialActivity, + Optional id, + ListEarningsResponseDataItemIncomeSource incomeSource, + ListEarningsResponseDataItemObject object, + Optional payoutAt, + Optional payoutPercentage, + Optional product, + Optional resource, + boolean secondTier, + ListEarningsResponseDataItemStatus status, + String transactionAmountUsd, + Map additionalProperties) { + this.account = account; + this.cancelationReason = cancelationReason; + this.commissionAmountUsd = commissionAmountUsd; + this.createdAt = createdAt; + this.financialActivity = financialActivity; + this.id = id; + this.incomeSource = incomeSource; + this.object = object; + this.payoutAt = payoutAt; + this.payoutPercentage = payoutPercentage; + this.product = product; + this.resource = resource; + this.secondTier = secondTier; + this.status = status; + this.transactionAmountUsd = transactionAmountUsd; + this.additionalProperties = additionalProperties; + } + + /** + * @return Referred account. + */ + @JsonIgnore + public Optional getAccount() { + if (account == null) { + return Optional.empty(); + } + return account; + } + + /** + * @return Why the earning was canceled or reversed, if applicable. + */ + @JsonIgnore + public Optional getCancelationReason() { + if (cancelationReason == null) { + return Optional.empty(); + } + return cancelationReason; + } + + /** + * @return What the referrer earns, in USD. Null until the earning settles. + */ + @JsonIgnore + public Optional getCommissionAmountUsd() { + if (commissionAmountUsd == null) { + return Optional.empty(); + } + return commissionAmountUsd; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Income and cost lines behind this earning's commission. Null for earnings settled before this data was recorded. + */ + @JsonIgnore + public Optional> getFinancialActivity() { + if (financialActivity == null) { + return Optional.empty(); + } + return financialActivity; + } + + @JsonIgnore + public Optional getId() { + if (id == null) { + return Optional.empty(); + } + return id; + } + + /** + * @return Which income source the commission is on: product-sales gross profit, Whop Ads spend billed to the business, platform balance transfer fees, or Whop Card interchange. + */ + @JsonProperty("income_source") + public ListEarningsResponseDataItemIncomeSource getIncomeSource() { + return incomeSource; + } + + @JsonProperty("object") + public ListEarningsResponseDataItemObject getObject() { + return object; + } + + @JsonIgnore + public Optional getPayoutAt() { + if (payoutAt == null) { + return Optional.empty(); + } + return payoutAt; + } + + /** + * @return The referrer's share of Whop's gross profit, as a fraction (0.3 = 30%). Null until the earning settles. + */ + @JsonIgnore + public Optional getPayoutPercentage() { + if (payoutPercentage == null) { + return Optional.empty(); + } + return payoutPercentage; + } + + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return The resource that generated the earning: the customer payment receipt for sales and ad spend earnings, the balance transfer for transfer earnings, or the card transaction for card interchange earnings. + */ + @JsonIgnore + public Optional getResource() { + if (resource == null) { + return Optional.empty(); + } + return resource; + } + + /** + * @return Whether this earning is a second-tier (grandparent) commission. + */ + @JsonProperty("second_tier") + public boolean getSecondTier() { + return secondTier; + } + + /** + * @return Current status of the earning. + */ + @JsonProperty("status") + public ListEarningsResponseDataItemStatus getStatus() { + return status; + } + + /** + * @return The underlying transaction amount the commission's income comes from, in USD. + */ + @JsonProperty("transaction_amount_usd") + public String getTransactionAmountUsd() { + return transactionAmountUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account") + private Optional _getAccount() { + return account; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancelation_reason") + private Optional _getCancelationReason() { + return cancelationReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("commission_amount_usd") + private Optional _getCommissionAmountUsd() { + return commissionAmountUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("financial_activity") + private Optional> _getFinancialActivity() { + return financialActivity; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("id") + private Optional _getId() { + return id; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_at") + private Optional _getPayoutAt() { + return payoutAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_percentage") + private Optional _getPayoutPercentage() { + return payoutPercentage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resource") + private Optional _getResource() { + return resource; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEarningsResponseDataItem && equalTo((ListEarningsResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEarningsResponseDataItem other) { + return account.equals(other.account) + && cancelationReason.equals(other.cancelationReason) + && commissionAmountUsd.equals(other.commissionAmountUsd) + && createdAt.equals(other.createdAt) + && financialActivity.equals(other.financialActivity) + && id.equals(other.id) + && incomeSource.equals(other.incomeSource) + && object.equals(other.object) + && payoutAt.equals(other.payoutAt) + && payoutPercentage.equals(other.payoutPercentage) + && product.equals(other.product) + && resource.equals(other.resource) + && secondTier == other.secondTier + && status.equals(other.status) + && transactionAmountUsd.equals(other.transactionAmountUsd); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.account, + this.cancelationReason, + this.commissionAmountUsd, + this.createdAt, + this.financialActivity, + this.id, + this.incomeSource, + this.object, + this.payoutAt, + this.payoutPercentage, + this.product, + this.resource, + this.secondTier, + this.status, + this.transactionAmountUsd); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + IncomeSourceStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(ListEarningsResponseDataItem other); + } + + public interface IncomeSourceStage { + /** + *

Which income source the commission is on: product-sales gross profit, Whop Ads spend billed to the business, platform balance transfer fees, or Whop Card interchange.

+ */ + ObjectStage incomeSource(@NotNull ListEarningsResponseDataItemIncomeSource incomeSource); + } + + public interface ObjectStage { + SecondTierStage object(@NotNull ListEarningsResponseDataItemObject object); + } + + public interface SecondTierStage { + /** + *

Whether this earning is a second-tier (grandparent) commission.

+ */ + StatusStage secondTier(boolean secondTier); + } + + public interface StatusStage { + /** + *

Current status of the earning.

+ */ + TransactionAmountUsdStage status(@NotNull ListEarningsResponseDataItemStatus status); + } + + public interface TransactionAmountUsdStage { + /** + *

The underlying transaction amount the commission's income comes from, in USD.

+ */ + _FinalStage transactionAmountUsd(@NotNull String transactionAmountUsd); + } + + public interface _FinalStage { + ListEarningsResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Referred account.

+ */ + _FinalStage account(Optional account); + + _FinalStage account(ListEarningsResponseDataItemAccount account); + + _FinalStage account(Nullable account); + + /** + *

Why the earning was canceled or reversed, if applicable.

+ */ + _FinalStage cancelationReason(Optional cancelationReason); + + _FinalStage cancelationReason(String cancelationReason); + + _FinalStage cancelationReason(Nullable cancelationReason); + + /** + *

What the referrer earns, in USD. Null until the earning settles.

+ */ + _FinalStage commissionAmountUsd(Optional commissionAmountUsd); + + _FinalStage commissionAmountUsd(String commissionAmountUsd); + + _FinalStage commissionAmountUsd(Nullable commissionAmountUsd); + + /** + *

Income and cost lines behind this earning's commission. Null for earnings settled before this data was recorded.

+ */ + _FinalStage financialActivity( + Optional> financialActivity); + + _FinalStage financialActivity(List financialActivity); + + _FinalStage financialActivity( + Nullable> financialActivity); + + _FinalStage id(Optional id); + + _FinalStage id(String id); + + _FinalStage id(Nullable id); + + _FinalStage payoutAt(Optional payoutAt); + + _FinalStage payoutAt(OffsetDateTime payoutAt); + + _FinalStage payoutAt(Nullable payoutAt); + + /** + *

The referrer's share of Whop's gross profit, as a fraction (0.3 = 30%). Null until the earning settles.

+ */ + _FinalStage payoutPercentage(Optional payoutPercentage); + + _FinalStage payoutPercentage(Float payoutPercentage); + + _FinalStage payoutPercentage(Nullable payoutPercentage); + + _FinalStage product(Optional product); + + _FinalStage product(ListEarningsResponseDataItemProduct product); + + _FinalStage product(Nullable product); + + /** + *

The resource that generated the earning: the customer payment receipt for sales and ad spend earnings, the balance transfer for transfer earnings, or the card transaction for card interchange earnings.

+ */ + _FinalStage resource(Optional resource); + + _FinalStage resource(ListEarningsResponseDataItemResource resource); + + _FinalStage resource(Nullable resource); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + IncomeSourceStage, + ObjectStage, + SecondTierStage, + StatusStage, + TransactionAmountUsdStage, + _FinalStage { + private OffsetDateTime createdAt; + + private ListEarningsResponseDataItemIncomeSource incomeSource; + + private ListEarningsResponseDataItemObject object; + + private boolean secondTier; + + private ListEarningsResponseDataItemStatus status; + + private String transactionAmountUsd; + + private Optional resource = Optional.empty(); + + private Optional product = Optional.empty(); + + private Optional payoutPercentage = Optional.empty(); + + private Optional payoutAt = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional> financialActivity = Optional.empty(); + + private Optional commissionAmountUsd = Optional.empty(); + + private Optional cancelationReason = Optional.empty(); + + private Optional account = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListEarningsResponseDataItem other) { + account(other.getAccount()); + cancelationReason(other.getCancelationReason()); + commissionAmountUsd(other.getCommissionAmountUsd()); + createdAt(other.getCreatedAt()); + financialActivity(other.getFinancialActivity()); + id(other.getId()); + incomeSource(other.getIncomeSource()); + object(other.getObject()); + payoutAt(other.getPayoutAt()); + payoutPercentage(other.getPayoutPercentage()); + product(other.getProduct()); + resource(other.getResource()); + secondTier(other.getSecondTier()); + status(other.getStatus()); + transactionAmountUsd(other.getTransactionAmountUsd()); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public IncomeSourceStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Which income source the commission is on: product-sales gross profit, Whop Ads spend billed to the business, platform balance transfer fees, or Whop Card interchange.

+ *

Which income source the commission is on: product-sales gross profit, Whop Ads spend billed to the business, platform balance transfer fees, or Whop Card interchange.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("income_source") + public ObjectStage incomeSource(@NotNull ListEarningsResponseDataItemIncomeSource incomeSource) { + this.incomeSource = Objects.requireNonNull(incomeSource, "incomeSource must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public SecondTierStage object(@NotNull ListEarningsResponseDataItemObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Whether this earning is a second-tier (grandparent) commission.

+ *

Whether this earning is a second-tier (grandparent) commission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("second_tier") + public StatusStage secondTier(boolean secondTier) { + this.secondTier = secondTier; + return this; + } + + /** + *

Current status of the earning.

+ *

Current status of the earning.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TransactionAmountUsdStage status(@NotNull ListEarningsResponseDataItemStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The underlying transaction amount the commission's income comes from, in USD.

+ *

The underlying transaction amount the commission's income comes from, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("transaction_amount_usd") + public _FinalStage transactionAmountUsd(@NotNull String transactionAmountUsd) { + this.transactionAmountUsd = + Objects.requireNonNull(transactionAmountUsd, "transactionAmountUsd must not be null"); + return this; + } + + /** + *

The resource that generated the earning: the customer payment receipt for sales and ad spend earnings, the balance transfer for transfer earnings, or the card transaction for card interchange earnings.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resource(Nullable resource) { + if (resource.isNull()) { + this.resource = null; + } else if (resource.isEmpty()) { + this.resource = Optional.empty(); + } else { + this.resource = Optional.of(resource.get()); + } + return this; + } + + /** + *

The resource that generated the earning: the customer payment receipt for sales and ad spend earnings, the balance transfer for transfer earnings, or the card transaction for card interchange earnings.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resource(ListEarningsResponseDataItemResource resource) { + this.resource = Optional.ofNullable(resource); + return this; + } + + /** + *

The resource that generated the earning: the customer payment receipt for sales and ad spend earnings, the balance transfer for transfer earnings, or the card transaction for card interchange earnings.

+ */ + @java.lang.Override + @JsonSetter(value = "resource", nulls = Nulls.SKIP) + public _FinalStage resource(Optional resource) { + this.resource = resource; + return this; + } + + @java.lang.Override + public _FinalStage product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage product(ListEarningsResponseDataItemProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

The referrer's share of Whop's gross profit, as a fraction (0.3 = 30%). Null until the earning settles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutPercentage(Nullable payoutPercentage) { + if (payoutPercentage.isNull()) { + this.payoutPercentage = null; + } else if (payoutPercentage.isEmpty()) { + this.payoutPercentage = Optional.empty(); + } else { + this.payoutPercentage = Optional.of(payoutPercentage.get()); + } + return this; + } + + /** + *

The referrer's share of Whop's gross profit, as a fraction (0.3 = 30%). Null until the earning settles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutPercentage(Float payoutPercentage) { + this.payoutPercentage = Optional.ofNullable(payoutPercentage); + return this; + } + + /** + *

The referrer's share of Whop's gross profit, as a fraction (0.3 = 30%). Null until the earning settles.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_percentage", nulls = Nulls.SKIP) + public _FinalStage payoutPercentage(Optional payoutPercentage) { + this.payoutPercentage = payoutPercentage; + return this; + } + + @java.lang.Override + public _FinalStage payoutAt(Nullable payoutAt) { + if (payoutAt.isNull()) { + this.payoutAt = null; + } else if (payoutAt.isEmpty()) { + this.payoutAt = Optional.empty(); + } else { + this.payoutAt = Optional.of(payoutAt.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage payoutAt(OffsetDateTime payoutAt) { + this.payoutAt = Optional.ofNullable(payoutAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "payout_at", nulls = Nulls.SKIP) + public _FinalStage payoutAt(Optional payoutAt) { + this.payoutAt = payoutAt; + return this; + } + + @java.lang.Override + public _FinalStage id(Nullable id) { + if (id.isNull()) { + this.id = null; + } else if (id.isEmpty()) { + this.id = Optional.empty(); + } else { + this.id = Optional.of(id.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + /** + *

Income and cost lines behind this earning's commission. Null for earnings settled before this data was recorded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage financialActivity( + Nullable> financialActivity) { + if (financialActivity.isNull()) { + this.financialActivity = null; + } else if (financialActivity.isEmpty()) { + this.financialActivity = Optional.empty(); + } else { + this.financialActivity = Optional.of(financialActivity.get()); + } + return this; + } + + /** + *

Income and cost lines behind this earning's commission. Null for earnings settled before this data was recorded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage financialActivity( + List financialActivity) { + this.financialActivity = Optional.ofNullable(financialActivity); + return this; + } + + /** + *

Income and cost lines behind this earning's commission. Null for earnings settled before this data was recorded.

+ */ + @java.lang.Override + @JsonSetter(value = "financial_activity", nulls = Nulls.SKIP) + public _FinalStage financialActivity( + Optional> financialActivity) { + this.financialActivity = financialActivity; + return this; + } + + /** + *

What the referrer earns, in USD. Null until the earning settles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage commissionAmountUsd(Nullable commissionAmountUsd) { + if (commissionAmountUsd.isNull()) { + this.commissionAmountUsd = null; + } else if (commissionAmountUsd.isEmpty()) { + this.commissionAmountUsd = Optional.empty(); + } else { + this.commissionAmountUsd = Optional.of(commissionAmountUsd.get()); + } + return this; + } + + /** + *

What the referrer earns, in USD. Null until the earning settles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage commissionAmountUsd(String commissionAmountUsd) { + this.commissionAmountUsd = Optional.ofNullable(commissionAmountUsd); + return this; + } + + /** + *

What the referrer earns, in USD. Null until the earning settles.

+ */ + @java.lang.Override + @JsonSetter(value = "commission_amount_usd", nulls = Nulls.SKIP) + public _FinalStage commissionAmountUsd(Optional commissionAmountUsd) { + this.commissionAmountUsd = commissionAmountUsd; + return this; + } + + /** + *

Why the earning was canceled or reversed, if applicable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelationReason(Nullable cancelationReason) { + if (cancelationReason.isNull()) { + this.cancelationReason = null; + } else if (cancelationReason.isEmpty()) { + this.cancelationReason = Optional.empty(); + } else { + this.cancelationReason = Optional.of(cancelationReason.get()); + } + return this; + } + + /** + *

Why the earning was canceled or reversed, if applicable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelationReason(String cancelationReason) { + this.cancelationReason = Optional.ofNullable(cancelationReason); + return this; + } + + /** + *

Why the earning was canceled or reversed, if applicable.

+ */ + @java.lang.Override + @JsonSetter(value = "cancelation_reason", nulls = Nulls.SKIP) + public _FinalStage cancelationReason(Optional cancelationReason) { + this.cancelationReason = cancelationReason; + return this; + } + + /** + *

Referred account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(Nullable account) { + if (account.isNull()) { + this.account = null; + } else if (account.isEmpty()) { + this.account = Optional.empty(); + } else { + this.account = Optional.of(account.get()); + } + return this; + } + + /** + *

Referred account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(ListEarningsResponseDataItemAccount account) { + this.account = Optional.ofNullable(account); + return this; + } + + /** + *

Referred account.

+ */ + @java.lang.Override + @JsonSetter(value = "account", nulls = Nulls.SKIP) + public _FinalStage account(Optional account) { + this.account = account; + return this; + } + + @java.lang.Override + public ListEarningsResponseDataItem build() { + return new ListEarningsResponseDataItem( + account, + cancelationReason, + commissionAmountUsd, + createdAt, + financialActivity, + id, + incomeSource, + object, + payoutAt, + payoutPercentage, + product, + resource, + secondTier, + status, + transactionAmountUsd, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemAccount.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemAccount.java new file mode 100644 index 00000000..93bb0a52 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemAccount.java @@ -0,0 +1,273 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEarningsResponseDataItemAccount.Builder.class) +public final class ListEarningsResponseDataItemAccount { + private final String id; + + private final Optional logoUrl; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private ListEarningsResponseDataItemAccount( + String id, Optional logoUrl, String route, String title, Map additionalProperties) { + this.id = id; + this.logoUrl = logoUrl; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Referred account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Referred account logo URL. + */ + @JsonIgnore + public Optional getLogoUrl() { + if (logoUrl == null) { + return Optional.empty(); + } + return logoUrl; + } + + /** + * @return Referred account route. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return Referred account display name. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo_url") + private Optional _getLogoUrl() { + return logoUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEarningsResponseDataItemAccount + && equalTo((ListEarningsResponseDataItemAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEarningsResponseDataItemAccount other) { + return id.equals(other.id) + && logoUrl.equals(other.logoUrl) + && route.equals(other.route) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.logoUrl, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Referred account ID.

+ */ + RouteStage id(@NotNull String id); + + Builder from(ListEarningsResponseDataItemAccount other); + } + + public interface RouteStage { + /** + *

Referred account route.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

Referred account display name.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + ListEarningsResponseDataItemAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Referred account logo URL.

+ */ + _FinalStage logoUrl(Optional logoUrl); + + _FinalStage logoUrl(String logoUrl); + + _FinalStage logoUrl(Nullable logoUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + private Optional logoUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListEarningsResponseDataItemAccount other) { + id(other.getId()); + logoUrl(other.getLogoUrl()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Referred account ID.

+ *

Referred account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Referred account route.

+ *

Referred account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

Referred account display name.

+ *

Referred account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Referred account logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(Nullable logoUrl) { + if (logoUrl.isNull()) { + this.logoUrl = null; + } else if (logoUrl.isEmpty()) { + this.logoUrl = Optional.empty(); + } else { + this.logoUrl = Optional.of(logoUrl.get()); + } + return this; + } + + /** + *

Referred account logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(String logoUrl) { + this.logoUrl = Optional.ofNullable(logoUrl); + return this; + } + + /** + *

Referred account logo URL.

+ */ + @java.lang.Override + @JsonSetter(value = "logo_url", nulls = Nulls.SKIP) + public _FinalStage logoUrl(Optional logoUrl) { + this.logoUrl = logoUrl; + return this; + } + + @java.lang.Override + public ListEarningsResponseDataItemAccount build() { + return new ListEarningsResponseDataItemAccount(id, logoUrl, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemFinancialActivityItem.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemFinancialActivityItem.java new file mode 100644 index 00000000..3f5c4231 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemFinancialActivityItem.java @@ -0,0 +1,367 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEarningsResponseDataItemFinancialActivityItem.Builder.class) +public final class ListEarningsResponseDataItemFinancialActivityItem { + private final String amount; + + private final String amountUsd; + + private final Optional category; + + private final Optional createdAt; + + private final String currency; + + private final ListEarningsResponseDataItemFinancialActivityItemType type; + + private final Map additionalProperties; + + private ListEarningsResponseDataItemFinancialActivityItem( + String amount, + String amountUsd, + Optional category, + Optional createdAt, + String currency, + ListEarningsResponseDataItemFinancialActivityItemType type, + Map additionalProperties) { + this.amount = amount; + this.amountUsd = amountUsd; + this.category = category; + this.createdAt = createdAt; + this.currency = currency; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Line amount in its native currency. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + /** + * @return Line amount in USD. + */ + @JsonProperty("amount_usd") + public String getAmountUsd() { + return amountUsd; + } + + /** + * @return Fee or cost category of the line. + */ + @JsonIgnore + public Optional getCategory() { + if (category == null) { + return Optional.empty(); + } + return category; + } + + @JsonIgnore + public Optional getCreatedAt() { + if (createdAt == null) { + return Optional.empty(); + } + return createdAt; + } + + /** + * @return Currency of the native amount. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Whether the line is income Whop collected or a cost Whop paid. + */ + @JsonProperty("type") + public ListEarningsResponseDataItemFinancialActivityItemType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("category") + private Optional _getCategory() { + return category; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_at") + private Optional _getCreatedAt() { + return createdAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEarningsResponseDataItemFinancialActivityItem + && equalTo((ListEarningsResponseDataItemFinancialActivityItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEarningsResponseDataItemFinancialActivityItem other) { + return amount.equals(other.amount) + && amountUsd.equals(other.amountUsd) + && category.equals(other.category) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.amountUsd, this.category, this.createdAt, this.currency, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

Line amount in its native currency.

+ */ + AmountUsdStage amount(@NotNull String amount); + + Builder from(ListEarningsResponseDataItemFinancialActivityItem other); + } + + public interface AmountUsdStage { + /** + *

Line amount in USD.

+ */ + CurrencyStage amountUsd(@NotNull String amountUsd); + } + + public interface CurrencyStage { + /** + *

Currency of the native amount.

+ */ + TypeStage currency(@NotNull String currency); + } + + public interface TypeStage { + /** + *

Whether the line is income Whop collected or a cost Whop paid.

+ */ + _FinalStage type(@NotNull ListEarningsResponseDataItemFinancialActivityItemType type); + } + + public interface _FinalStage { + ListEarningsResponseDataItemFinancialActivityItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Fee or cost category of the line.

+ */ + _FinalStage category(Optional category); + + _FinalStage category(String category); + + _FinalStage category(Nullable category); + + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage createdAt(Nullable createdAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, AmountUsdStage, CurrencyStage, TypeStage, _FinalStage { + private String amount; + + private String amountUsd; + + private String currency; + + private ListEarningsResponseDataItemFinancialActivityItemType type; + + private Optional createdAt = Optional.empty(); + + private Optional category = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListEarningsResponseDataItemFinancialActivityItem other) { + amount(other.getAmount()); + amountUsd(other.getAmountUsd()); + category(other.getCategory()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + type(other.getType()); + return this; + } + + /** + *

Line amount in its native currency.

+ *

Line amount in its native currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public AmountUsdStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

Line amount in USD.

+ *

Line amount in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount_usd") + public CurrencyStage amountUsd(@NotNull String amountUsd) { + this.amountUsd = Objects.requireNonNull(amountUsd, "amountUsd must not be null"); + return this; + } + + /** + *

Currency of the native amount.

+ *

Currency of the native amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public TypeStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Whether the line is income Whop collected or a cost Whop paid.

+ *

Whether the line is income Whop collected or a cost Whop paid.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull ListEarningsResponseDataItemFinancialActivityItemType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage createdAt(Nullable createdAt) { + if (createdAt.isNull()) { + this.createdAt = null; + } else if (createdAt.isEmpty()) { + this.createdAt = Optional.empty(); + } else { + this.createdAt = Optional.of(createdAt.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

Fee or cost category of the line.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage category(Nullable category) { + if (category.isNull()) { + this.category = null; + } else if (category.isEmpty()) { + this.category = Optional.empty(); + } else { + this.category = Optional.of(category.get()); + } + return this; + } + + /** + *

Fee or cost category of the line.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage category(String category) { + this.category = Optional.ofNullable(category); + return this; + } + + /** + *

Fee or cost category of the line.

+ */ + @java.lang.Override + @JsonSetter(value = "category", nulls = Nulls.SKIP) + public _FinalStage category(Optional category) { + this.category = category; + return this; + } + + @java.lang.Override + public ListEarningsResponseDataItemFinancialActivityItem build() { + return new ListEarningsResponseDataItemFinancialActivityItem( + amount, amountUsd, category, createdAt, currency, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemFinancialActivityItemType.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemFinancialActivityItemType.java new file mode 100644 index 00000000..ef21bcf1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemFinancialActivityItemType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEarningsResponseDataItemFinancialActivityItemType { + public static final ListEarningsResponseDataItemFinancialActivityItemType EXPENSE = + new ListEarningsResponseDataItemFinancialActivityItemType(Value.EXPENSE, "expense"); + + public static final ListEarningsResponseDataItemFinancialActivityItemType INCOME = + new ListEarningsResponseDataItemFinancialActivityItemType(Value.INCOME, "income"); + + private final Value value; + + private final String string; + + ListEarningsResponseDataItemFinancialActivityItemType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEarningsResponseDataItemFinancialActivityItemType + && this.string.equals(((ListEarningsResponseDataItemFinancialActivityItemType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EXPENSE: + return visitor.visitExpense(); + case INCOME: + return visitor.visitIncome(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEarningsResponseDataItemFinancialActivityItemType valueOf(String value) { + switch (value) { + case "expense": + return EXPENSE; + case "income": + return INCOME; + default: + return new ListEarningsResponseDataItemFinancialActivityItemType(Value.UNKNOWN, value); + } + } + + public enum Value { + INCOME, + + EXPENSE, + + UNKNOWN + } + + public interface Visitor { + T visitIncome(); + + T visitExpense(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemIncomeSource.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemIncomeSource.java new file mode 100644 index 00000000..86c7bc9b --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemIncomeSource.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEarningsResponseDataItemIncomeSource { + public static final ListEarningsResponseDataItemIncomeSource CARD_INTERCHANGE = + new ListEarningsResponseDataItemIncomeSource(Value.CARD_INTERCHANGE, "card_interchange"); + + public static final ListEarningsResponseDataItemIncomeSource SALES = + new ListEarningsResponseDataItemIncomeSource(Value.SALES, "sales"); + + public static final ListEarningsResponseDataItemIncomeSource TRANSFER = + new ListEarningsResponseDataItemIncomeSource(Value.TRANSFER, "transfer"); + + public static final ListEarningsResponseDataItemIncomeSource AD_SPEND = + new ListEarningsResponseDataItemIncomeSource(Value.AD_SPEND, "ad_spend"); + + private final Value value; + + private final String string; + + ListEarningsResponseDataItemIncomeSource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEarningsResponseDataItemIncomeSource + && this.string.equals(((ListEarningsResponseDataItemIncomeSource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_INTERCHANGE: + return visitor.visitCardInterchange(); + case SALES: + return visitor.visitSales(); + case TRANSFER: + return visitor.visitTransfer(); + case AD_SPEND: + return visitor.visitAdSpend(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEarningsResponseDataItemIncomeSource valueOf(String value) { + switch (value) { + case "card_interchange": + return CARD_INTERCHANGE; + case "sales": + return SALES; + case "transfer": + return TRANSFER; + case "ad_spend": + return AD_SPEND; + default: + return new ListEarningsResponseDataItemIncomeSource(Value.UNKNOWN, value); + } + } + + public enum Value { + SALES, + + AD_SPEND, + + TRANSFER, + + CARD_INTERCHANGE, + + UNKNOWN + } + + public interface Visitor { + T visitSales(); + + T visitAdSpend(); + + T visitTransfer(); + + T visitCardInterchange(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemObject.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemObject.java new file mode 100644 index 00000000..4f317bd1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEarningsResponseDataItemObject { + public static final ListEarningsResponseDataItemObject PARTNER_BUSINESS_EARNING = + new ListEarningsResponseDataItemObject(Value.PARTNER_BUSINESS_EARNING, "partner_business_earning"); + + private final Value value; + + private final String string; + + ListEarningsResponseDataItemObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEarningsResponseDataItemObject + && this.string.equals(((ListEarningsResponseDataItemObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PARTNER_BUSINESS_EARNING: + return visitor.visitPartnerBusinessEarning(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEarningsResponseDataItemObject valueOf(String value) { + switch (value) { + case "partner_business_earning": + return PARTNER_BUSINESS_EARNING; + default: + return new ListEarningsResponseDataItemObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PARTNER_BUSINESS_EARNING, + + UNKNOWN + } + + public interface Visitor { + T visitPartnerBusinessEarning(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemProduct.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemProduct.java new file mode 100644 index 00000000..99e0baf2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemProduct.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEarningsResponseDataItemProduct.Builder.class) +public final class ListEarningsResponseDataItemProduct { + private final String id; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private ListEarningsResponseDataItemProduct( + String id, String route, String title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("route") + public String getRoute() { + return route; + } + + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEarningsResponseDataItemProduct + && equalTo((ListEarningsResponseDataItemProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEarningsResponseDataItemProduct other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + RouteStage id(@NotNull String id); + + Builder from(ListEarningsResponseDataItemProduct other); + } + + public interface RouteStage { + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + ListEarningsResponseDataItemProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListEarningsResponseDataItemProduct other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public ListEarningsResponseDataItemProduct build() { + return new ListEarningsResponseDataItemProduct(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResource.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResource.java new file mode 100644 index 00000000..93d460cb --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResource.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonDeserialize(using = ListEarningsResponseDataItemResource.Deserializer.class) +public final class ListEarningsResponseDataItemResource { + private final Object value; + + private final int type; + + private ListEarningsResponseDataItemResource(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((Optional) this.value); + } else if (this.type == 1) { + return visitor.visit((ListEarningsResponseDataItemResourceOne) this.value); + } else if (this.type == 2) { + return visitor.visit((ListEarningsResponseDataItemResourceCreatedAt) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEarningsResponseDataItemResource + && equalTo((ListEarningsResponseDataItemResource) other); + } + + private boolean equalTo(ListEarningsResponseDataItemResource other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static ListEarningsResponseDataItemResource of( + Optional value) { + return new ListEarningsResponseDataItemResource(value, 0); + } + + public static ListEarningsResponseDataItemResource of(ListEarningsResponseDataItemResourceOne value) { + return new ListEarningsResponseDataItemResource(value, 1); + } + + public static ListEarningsResponseDataItemResource of(ListEarningsResponseDataItemResourceCreatedAt value) { + return new ListEarningsResponseDataItemResource(value, 2); + } + + public interface Visitor { + T visit(Optional value); + + T visit(ListEarningsResponseDataItemResourceOne value); + + T visit(ListEarningsResponseDataItemResourceCreatedAt value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(ListEarningsResponseDataItemResource.class); + } + + @java.lang.Override + public ListEarningsResponseDataItemResource deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Map + && ((Map) value).containsKey("created_at") + && ((Map) value).containsKey("currency") + && ((Map) value).containsKey("id") + && ((Map) value).containsKey("object")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, ListEarningsResponseDataItemResourceOne.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map + && ((Map) value).containsKey("created_at") + && ((Map) value).containsKey("id") + && ((Map) value).containsKey("object")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, ListEarningsResponseDataItemResourceCreatedAt.class)); + } catch (RuntimeException e) { + } + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, + new TypeReference< + Optional>() {})); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceAlternativePaymentMethod.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceAlternativePaymentMethod.java new file mode 100644 index 00000000..83a91be5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceAlternativePaymentMethod.java @@ -0,0 +1,500 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEarningsResponseDataItemResourceAlternativePaymentMethod.Builder.class) +public final class ListEarningsResponseDataItemResourceAlternativePaymentMethod { + private final Optional + alternativePaymentMethod; + + private final Optional brand; + + private final OffsetDateTime createdAt; + + private final String currency; + + private final String id; + + private final Optional last4; + + private final ListEarningsResponseDataItemResourceAlternativePaymentMethodObject object; + + private final Optional paymentMethodType; + + private final Optional processor; + + private final Map additionalProperties; + + private ListEarningsResponseDataItemResourceAlternativePaymentMethod( + Optional + alternativePaymentMethod, + Optional brand, + OffsetDateTime createdAt, + String currency, + String id, + Optional last4, + ListEarningsResponseDataItemResourceAlternativePaymentMethodObject object, + Optional paymentMethodType, + Optional processor, + Map additionalProperties) { + this.alternativePaymentMethod = alternativePaymentMethod; + this.brand = brand; + this.createdAt = createdAt; + this.currency = currency; + this.id = id; + this.last4 = last4; + this.object = object; + this.paymentMethodType = paymentMethodType; + this.processor = processor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional + getAlternativePaymentMethod() { + if (alternativePaymentMethod == null) { + return Optional.empty(); + } + return alternativePaymentMethod; + } + + @JsonIgnore + public Optional getBrand() { + if (brand == null) { + return Optional.empty(); + } + return brand; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + @JsonProperty("object") + public ListEarningsResponseDataItemResourceAlternativePaymentMethodObject getObject() { + return object; + } + + @JsonIgnore + public Optional getPaymentMethodType() { + if (paymentMethodType == null) { + return Optional.empty(); + } + return paymentMethodType; + } + + @JsonIgnore + public Optional getProcessor() { + if (processor == null) { + return Optional.empty(); + } + return processor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("alternative_payment_method") + private Optional + _getAlternativePaymentMethod() { + return alternativePaymentMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("brand") + private Optional _getBrand() { + return brand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_type") + private Optional _getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("processor") + private Optional _getProcessor() { + return processor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEarningsResponseDataItemResourceAlternativePaymentMethod + && equalTo((ListEarningsResponseDataItemResourceAlternativePaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEarningsResponseDataItemResourceAlternativePaymentMethod other) { + return alternativePaymentMethod.equals(other.alternativePaymentMethod) + && brand.equals(other.brand) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && id.equals(other.id) + && last4.equals(other.last4) + && object.equals(other.object) + && paymentMethodType.equals(other.paymentMethodType) + && processor.equals(other.processor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.alternativePaymentMethod, + this.brand, + this.createdAt, + this.currency, + this.id, + this.last4, + this.object, + this.paymentMethodType, + this.processor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(ListEarningsResponseDataItemResourceAlternativePaymentMethod other); + } + + public interface CurrencyStage { + IdStage currency(@NotNull String currency); + } + + public interface IdStage { + ObjectStage id(@NotNull String id); + } + + public interface ObjectStage { + _FinalStage object(@NotNull ListEarningsResponseDataItemResourceAlternativePaymentMethodObject object); + } + + public interface _FinalStage { + ListEarningsResponseDataItemResourceAlternativePaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage alternativePaymentMethod( + Optional + alternativePaymentMethod); + + _FinalStage alternativePaymentMethod( + ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod + alternativePaymentMethod); + + _FinalStage alternativePaymentMethod( + Nullable + alternativePaymentMethod); + + _FinalStage brand(Optional brand); + + _FinalStage brand(String brand); + + _FinalStage brand(Nullable brand); + + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + + _FinalStage paymentMethodType(Optional paymentMethodType); + + _FinalStage paymentMethodType(String paymentMethodType); + + _FinalStage paymentMethodType(Nullable paymentMethodType); + + _FinalStage processor(Optional processor); + + _FinalStage processor(String processor); + + _FinalStage processor(Nullable processor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, CurrencyStage, IdStage, ObjectStage, _FinalStage { + private OffsetDateTime createdAt; + + private String currency; + + private String id; + + private ListEarningsResponseDataItemResourceAlternativePaymentMethodObject object; + + private Optional processor = Optional.empty(); + + private Optional paymentMethodType = Optional.empty(); + + private Optional last4 = Optional.empty(); + + private Optional brand = Optional.empty(); + + private Optional + alternativePaymentMethod = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListEarningsResponseDataItemResourceAlternativePaymentMethod other) { + alternativePaymentMethod(other.getAlternativePaymentMethod()); + brand(other.getBrand()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + id(other.getId()); + last4(other.getLast4()); + object(other.getObject()); + paymentMethodType(other.getPaymentMethodType()); + processor(other.getProcessor()); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull ListEarningsResponseDataItemResourceAlternativePaymentMethodObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage processor(Nullable processor) { + if (processor.isNull()) { + this.processor = null; + } else if (processor.isEmpty()) { + this.processor = Optional.empty(); + } else { + this.processor = Optional.of(processor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage processor(String processor) { + this.processor = Optional.ofNullable(processor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "processor", nulls = Nulls.SKIP) + public _FinalStage processor(Optional processor) { + this.processor = processor; + return this; + } + + @java.lang.Override + public _FinalStage paymentMethodType(Nullable paymentMethodType) { + if (paymentMethodType.isNull()) { + this.paymentMethodType = null; + } else if (paymentMethodType.isEmpty()) { + this.paymentMethodType = Optional.empty(); + } else { + this.paymentMethodType = Optional.of(paymentMethodType.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage paymentMethodType(String paymentMethodType) { + this.paymentMethodType = Optional.ofNullable(paymentMethodType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "payment_method_type", nulls = Nulls.SKIP) + public _FinalStage paymentMethodType(Optional paymentMethodType) { + this.paymentMethodType = paymentMethodType; + return this; + } + + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + @java.lang.Override + public _FinalStage brand(Nullable brand) { + if (brand.isNull()) { + this.brand = null; + } else if (brand.isEmpty()) { + this.brand = Optional.empty(); + } else { + this.brand = Optional.of(brand.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage brand(String brand) { + this.brand = Optional.ofNullable(brand); + return this; + } + + @java.lang.Override + @JsonSetter(value = "brand", nulls = Nulls.SKIP) + public _FinalStage brand(Optional brand) { + this.brand = brand; + return this; + } + + @java.lang.Override + public _FinalStage alternativePaymentMethod( + Nullable + alternativePaymentMethod) { + if (alternativePaymentMethod.isNull()) { + this.alternativePaymentMethod = null; + } else if (alternativePaymentMethod.isEmpty()) { + this.alternativePaymentMethod = Optional.empty(); + } else { + this.alternativePaymentMethod = Optional.of(alternativePaymentMethod.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage alternativePaymentMethod( + ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod + alternativePaymentMethod) { + this.alternativePaymentMethod = Optional.ofNullable(alternativePaymentMethod); + return this; + } + + @java.lang.Override + @JsonSetter(value = "alternative_payment_method", nulls = Nulls.SKIP) + public _FinalStage alternativePaymentMethod( + Optional + alternativePaymentMethod) { + this.alternativePaymentMethod = alternativePaymentMethod; + return this; + } + + @java.lang.Override + public ListEarningsResponseDataItemResourceAlternativePaymentMethod build() { + return new ListEarningsResponseDataItemResourceAlternativePaymentMethod( + alternativePaymentMethod, + brand, + createdAt, + currency, + id, + last4, + object, + paymentMethodType, + processor, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod.java new file mode 100644 index 00000000..5eab4ef1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize( + builder = ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod.Builder.class) +public final class ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod { + private final Optional imageUrl; + + private final String name; + + private final Map additionalProperties; + + private ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod( + Optional imageUrl, String name, Map additionalProperties) { + this.imageUrl = imageUrl; + this.name = name; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getImageUrl() { + if (imageUrl == null) { + return Optional.empty(); + } + return imageUrl; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("image_url") + private Optional _getImageUrl() { + return imageUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod + && equalTo( + (ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo( + ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod other) { + return imageUrl.equals(other.imageUrl) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.imageUrl, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + + Builder from(ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod other); + } + + public interface _FinalStage { + ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage imageUrl(Optional imageUrl); + + _FinalStage imageUrl(String imageUrl); + + _FinalStage imageUrl(Nullable imageUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + private Optional imageUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from( + ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod other) { + imageUrl(other.getImageUrl()); + name(other.getName()); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage imageUrl(Nullable imageUrl) { + if (imageUrl.isNull()) { + this.imageUrl = null; + } else if (imageUrl.isEmpty()) { + this.imageUrl = Optional.empty(); + } else { + this.imageUrl = Optional.of(imageUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage imageUrl(String imageUrl) { + this.imageUrl = Optional.ofNullable(imageUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "image_url", nulls = Nulls.SKIP) + public _FinalStage imageUrl(Optional imageUrl) { + this.imageUrl = imageUrl; + return this; + } + + @java.lang.Override + public ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod build() { + return new ListEarningsResponseDataItemResourceAlternativePaymentMethodAlternativePaymentMethod( + imageUrl, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceAlternativePaymentMethodObject.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceAlternativePaymentMethodObject.java new file mode 100644 index 00000000..758e3a68 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceAlternativePaymentMethodObject.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEarningsResponseDataItemResourceAlternativePaymentMethodObject { + public static final ListEarningsResponseDataItemResourceAlternativePaymentMethodObject RECEIPT = + new ListEarningsResponseDataItemResourceAlternativePaymentMethodObject(Value.RECEIPT, "receipt"); + + private final Value value; + + private final String string; + + ListEarningsResponseDataItemResourceAlternativePaymentMethodObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEarningsResponseDataItemResourceAlternativePaymentMethodObject + && this.string.equals( + ((ListEarningsResponseDataItemResourceAlternativePaymentMethodObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RECEIPT: + return visitor.visitReceipt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEarningsResponseDataItemResourceAlternativePaymentMethodObject valueOf(String value) { + switch (value) { + case "receipt": + return RECEIPT; + default: + return new ListEarningsResponseDataItemResourceAlternativePaymentMethodObject(Value.UNKNOWN, value); + } + } + + public enum Value { + RECEIPT, + + UNKNOWN + } + + public interface Visitor { + T visitReceipt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceCreatedAt.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceCreatedAt.java new file mode 100644 index 00000000..c20c0ca0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceCreatedAt.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEarningsResponseDataItemResourceCreatedAt.Builder.class) +public final class ListEarningsResponseDataItemResourceCreatedAt { + private final OffsetDateTime createdAt; + + private final Optional currency; + + private final String id; + + private final Optional merchantName; + + private final ListEarningsResponseDataItemResourceCreatedAtObject object; + + private final Map additionalProperties; + + private ListEarningsResponseDataItemResourceCreatedAt( + OffsetDateTime createdAt, + Optional currency, + String id, + Optional merchantName, + ListEarningsResponseDataItemResourceCreatedAtObject object, + Map additionalProperties) { + this.createdAt = createdAt; + this.currency = currency; + this.id = id; + this.merchantName = merchantName; + this.object = object; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getMerchantName() { + if (merchantName == null) { + return Optional.empty(); + } + return merchantName; + } + + @JsonProperty("object") + public ListEarningsResponseDataItemResourceCreatedAtObject getObject() { + return object; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("merchant_name") + private Optional _getMerchantName() { + return merchantName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEarningsResponseDataItemResourceCreatedAt + && equalTo((ListEarningsResponseDataItemResourceCreatedAt) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEarningsResponseDataItemResourceCreatedAt other) { + return createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && id.equals(other.id) + && merchantName.equals(other.merchantName) + && object.equals(other.object); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.currency, this.id, this.merchantName, this.object); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(ListEarningsResponseDataItemResourceCreatedAt other); + } + + public interface IdStage { + ObjectStage id(@NotNull String id); + } + + public interface ObjectStage { + _FinalStage object(@NotNull ListEarningsResponseDataItemResourceCreatedAtObject object); + } + + public interface _FinalStage { + ListEarningsResponseDataItemResourceCreatedAt build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + _FinalStage currency(Nullable currency); + + _FinalStage merchantName(Optional merchantName); + + _FinalStage merchantName(String merchantName); + + _FinalStage merchantName(Nullable merchantName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, ObjectStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private ListEarningsResponseDataItemResourceCreatedAtObject object; + + private Optional merchantName = Optional.empty(); + + private Optional currency = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListEarningsResponseDataItemResourceCreatedAt other) { + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + id(other.getId()); + merchantName(other.getMerchantName()); + object(other.getObject()); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull ListEarningsResponseDataItemResourceCreatedAtObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage merchantName(Nullable merchantName) { + if (merchantName.isNull()) { + this.merchantName = null; + } else if (merchantName.isEmpty()) { + this.merchantName = Optional.empty(); + } else { + this.merchantName = Optional.of(merchantName.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage merchantName(String merchantName) { + this.merchantName = Optional.ofNullable(merchantName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "merchant_name", nulls = Nulls.SKIP) + public _FinalStage merchantName(Optional merchantName) { + this.merchantName = merchantName; + return this; + } + + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + @java.lang.Override + public ListEarningsResponseDataItemResourceCreatedAt build() { + return new ListEarningsResponseDataItemResourceCreatedAt( + createdAt, currency, id, merchantName, object, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceCreatedAtObject.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceCreatedAtObject.java new file mode 100644 index 00000000..f188d9aa --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceCreatedAtObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEarningsResponseDataItemResourceCreatedAtObject { + public static final ListEarningsResponseDataItemResourceCreatedAtObject CARD_TRANSACTION = + new ListEarningsResponseDataItemResourceCreatedAtObject(Value.CARD_TRANSACTION, "card_transaction"); + + private final Value value; + + private final String string; + + ListEarningsResponseDataItemResourceCreatedAtObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEarningsResponseDataItemResourceCreatedAtObject + && this.string.equals(((ListEarningsResponseDataItemResourceCreatedAtObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_TRANSACTION: + return visitor.visitCardTransaction(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEarningsResponseDataItemResourceCreatedAtObject valueOf(String value) { + switch (value) { + case "card_transaction": + return CARD_TRANSACTION; + default: + return new ListEarningsResponseDataItemResourceCreatedAtObject(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_TRANSACTION, + + UNKNOWN + } + + public interface Visitor { + T visitCardTransaction(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceOne.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceOne.java new file mode 100644 index 00000000..b6dc1519 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceOne.java @@ -0,0 +1,194 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEarningsResponseDataItemResourceOne.Builder.class) +public final class ListEarningsResponseDataItemResourceOne { + private final OffsetDateTime createdAt; + + private final String currency; + + private final String id; + + private final ListEarningsResponseDataItemResourceOneObject object; + + private final Map additionalProperties; + + private ListEarningsResponseDataItemResourceOne( + OffsetDateTime createdAt, + String currency, + String id, + ListEarningsResponseDataItemResourceOneObject object, + Map additionalProperties) { + this.createdAt = createdAt; + this.currency = currency; + this.id = id; + this.object = object; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("object") + public ListEarningsResponseDataItemResourceOneObject getObject() { + return object; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEarningsResponseDataItemResourceOne + && equalTo((ListEarningsResponseDataItemResourceOne) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEarningsResponseDataItemResourceOne other) { + return createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && id.equals(other.id) + && object.equals(other.object); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.currency, this.id, this.object); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(ListEarningsResponseDataItemResourceOne other); + } + + public interface CurrencyStage { + IdStage currency(@NotNull String currency); + } + + public interface IdStage { + ObjectStage id(@NotNull String id); + } + + public interface ObjectStage { + _FinalStage object(@NotNull ListEarningsResponseDataItemResourceOneObject object); + } + + public interface _FinalStage { + ListEarningsResponseDataItemResourceOne build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, CurrencyStage, IdStage, ObjectStage, _FinalStage { + private OffsetDateTime createdAt; + + private String currency; + + private String id; + + private ListEarningsResponseDataItemResourceOneObject object; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListEarningsResponseDataItemResourceOne other) { + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + id(other.getId()); + object(other.getObject()); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull ListEarningsResponseDataItemResourceOneObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + @java.lang.Override + public ListEarningsResponseDataItemResourceOne build() { + return new ListEarningsResponseDataItemResourceOne(createdAt, currency, id, object, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceOneObject.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceOneObject.java new file mode 100644 index 00000000..f85e59f7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemResourceOneObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEarningsResponseDataItemResourceOneObject { + public static final ListEarningsResponseDataItemResourceOneObject TRANSFER = + new ListEarningsResponseDataItemResourceOneObject(Value.TRANSFER, "transfer"); + + private final Value value; + + private final String string; + + ListEarningsResponseDataItemResourceOneObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEarningsResponseDataItemResourceOneObject + && this.string.equals(((ListEarningsResponseDataItemResourceOneObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TRANSFER: + return visitor.visitTransfer(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEarningsResponseDataItemResourceOneObject valueOf(String value) { + switch (value) { + case "transfer": + return TRANSFER; + default: + return new ListEarningsResponseDataItemResourceOneObject(Value.UNKNOWN, value); + } + } + + public enum Value { + TRANSFER, + + UNKNOWN + } + + public interface Visitor { + T visitTransfer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemStatus.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemStatus.java new file mode 100644 index 00000000..ac9d05cd --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponseDataItemStatus.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListEarningsResponseDataItemStatus { + public static final ListEarningsResponseDataItemStatus PENDING = + new ListEarningsResponseDataItemStatus(Value.PENDING, "pending"); + + public static final ListEarningsResponseDataItemStatus CANCELED = + new ListEarningsResponseDataItemStatus(Value.CANCELED, "canceled"); + + public static final ListEarningsResponseDataItemStatus COMPLETED = + new ListEarningsResponseDataItemStatus(Value.COMPLETED, "completed"); + + public static final ListEarningsResponseDataItemStatus AWAITING_SETTLEMENT = + new ListEarningsResponseDataItemStatus(Value.AWAITING_SETTLEMENT, "awaiting_settlement"); + + public static final ListEarningsResponseDataItemStatus REVERSED = + new ListEarningsResponseDataItemStatus(Value.REVERSED, "reversed"); + + private final Value value; + + private final String string; + + ListEarningsResponseDataItemStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListEarningsResponseDataItemStatus + && this.string.equals(((ListEarningsResponseDataItemStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case CANCELED: + return visitor.visitCanceled(); + case COMPLETED: + return visitor.visitCompleted(); + case AWAITING_SETTLEMENT: + return visitor.visitAwaitingSettlement(); + case REVERSED: + return visitor.visitReversed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListEarningsResponseDataItemStatus valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "canceled": + return CANCELED; + case "completed": + return COMPLETED; + case "awaiting_settlement": + return AWAITING_SETTLEMENT; + case "reversed": + return REVERSED; + default: + return new ListEarningsResponseDataItemStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + AWAITING_SETTLEMENT, + + PENDING, + + COMPLETED, + + CANCELED, + + REVERSED, + + UNKNOWN + } + + public interface Visitor { + T visitAwaitingSettlement(); + + T visitPending(); + + T visitCompleted(); + + T visitCanceled(); + + T visitReversed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponsePageInfo.java b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponsePageInfo.java new file mode 100644 index 00000000..3c36b6a8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/earnings/types/ListEarningsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.earnings.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListEarningsResponsePageInfo.Builder.class) +public final class ListEarningsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListEarningsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListEarningsResponsePageInfo && equalTo((ListEarningsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListEarningsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListEarningsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListEarningsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListEarningsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListEarningsResponsePageInfo build() { + return new ListEarningsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/requests/ListBusinessesRequest.java b/src/main/java/com/whop/api/resources/partners/businesses/requests/ListBusinessesRequest.java new file mode 100644 index 00000000..398a8072 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/requests/ListBusinessesRequest.java @@ -0,0 +1,504 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.partners.businesses.types.ListBusinessesRequestDirection; +import com.whop.api.resources.partners.businesses.types.ListBusinessesRequestOrder; +import com.whop.api.resources.partners.businesses.types.ListBusinessesRequestStatus; +import com.whop.api.resources.partners.businesses.types.ListBusinessesRequestTier; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBusinessesRequest.Builder.class) +public final class ListBusinessesRequest { + private final Optional status; + + private final Optional hasEarnings; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Optional order; + + private final Optional direction; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional referredUserId; + + private final Optional referredUsername; + + private final Optional tier; + + private final Map additionalProperties; + + private ListBusinessesRequest( + Optional status, + Optional hasEarnings, + Optional first, + Optional after, + Optional last, + Optional before, + Optional order, + Optional direction, + Optional createdBefore, + Optional createdAfter, + Optional referredUserId, + Optional referredUsername, + Optional tier, + Map additionalProperties) { + this.status = status; + this.hasEarnings = hasEarnings; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.order = order; + this.direction = direction; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.referredUserId = referredUserId; + this.referredUsername = referredUsername; + this.tier = tier; + this.additionalProperties = additionalProperties; + } + + /** + * @return Filter by referral status. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return When true, only businesses with pending or completed earnings paid to the caller. + */ + @JsonProperty("has_earnings") + public Optional getHasEarnings() { + return hasEarnings; + } + + /** + * @return Number of partner businesses to return from the start of the window. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to fetch the page after (from page_info.end_cursor). + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return Number of partner businesses to return from the end of the window. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to fetch the page before (from page_info.start_cursor). + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The field to sort partner businesses by. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Only return partner businesses created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return partner businesses created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Filter to referrals attributed to this user. For first-tier referrals, this is the referred account owner; for second-tier referrals, this is the partner you recruited. + */ + @JsonProperty("referred_user_id") + public Optional getReferredUserId() { + return referredUserId; + } + + /** + * @return Filter by the referred user's exact username. Ignored when referred_user_id is present. + */ + @JsonProperty("referred_username") + public Optional getReferredUsername() { + return referredUsername; + } + + /** + * @return Filter to only first-tier referrals or only second-tier referrals. + */ + @JsonProperty("tier") + public Optional getTier() { + return tier; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBusinessesRequest && equalTo((ListBusinessesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBusinessesRequest other) { + return status.equals(other.status) + && hasEarnings.equals(other.hasEarnings) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before) + && order.equals(other.order) + && direction.equals(other.direction) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && referredUserId.equals(other.referredUserId) + && referredUsername.equals(other.referredUsername) + && tier.equals(other.tier); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.status, + this.hasEarnings, + this.first, + this.after, + this.last, + this.before, + this.order, + this.direction, + this.createdBefore, + this.createdAfter, + this.referredUserId, + this.referredUsername, + this.tier); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional status = Optional.empty(); + + private Optional hasEarnings = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional referredUserId = Optional.empty(); + + private Optional referredUsername = Optional.empty(); + + private Optional tier = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListBusinessesRequest other) { + status(other.getStatus()); + hasEarnings(other.getHasEarnings()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + order(other.getOrder()); + direction(other.getDirection()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + referredUserId(other.getReferredUserId()); + referredUsername(other.getReferredUsername()); + tier(other.getTier()); + return this; + } + + /** + *

Filter by referral status.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListBusinessesRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

When true, only businesses with pending or completed earnings paid to the caller.

+ */ + @JsonSetter(value = "has_earnings", nulls = Nulls.SKIP) + public Builder hasEarnings(Optional hasEarnings) { + this.hasEarnings = hasEarnings; + return this; + } + + public Builder hasEarnings(Boolean hasEarnings) { + this.hasEarnings = Optional.ofNullable(hasEarnings); + return this; + } + + /** + *

Number of partner businesses to return from the start of the window.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Number of partner businesses to return from the end of the window.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to fetch the page before (from page_info.start_cursor).

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The field to sort partner businesses by.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListBusinessesRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListBusinessesRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Only return partner businesses created before this timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return partner businesses created after this timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Filter to referrals attributed to this user. For first-tier referrals, this is the referred account owner; for second-tier referrals, this is the partner you recruited.

+ */ + @JsonSetter(value = "referred_user_id", nulls = Nulls.SKIP) + public Builder referredUserId(Optional referredUserId) { + this.referredUserId = referredUserId; + return this; + } + + public Builder referredUserId(String referredUserId) { + this.referredUserId = Optional.ofNullable(referredUserId); + return this; + } + + /** + *

Filter by the referred user's exact username. Ignored when referred_user_id is present.

+ */ + @JsonSetter(value = "referred_username", nulls = Nulls.SKIP) + public Builder referredUsername(Optional referredUsername) { + this.referredUsername = referredUsername; + return this; + } + + public Builder referredUsername(String referredUsername) { + this.referredUsername = Optional.ofNullable(referredUsername); + return this; + } + + /** + *

Filter to only first-tier referrals or only second-tier referrals.

+ */ + @JsonSetter(value = "tier", nulls = Nulls.SKIP) + public Builder tier(Optional tier) { + this.tier = tier; + return this; + } + + public Builder tier(ListBusinessesRequestTier tier) { + this.tier = Optional.ofNullable(tier); + return this; + } + + public ListBusinessesRequest build() { + return new ListBusinessesRequest( + status, + hasEarnings, + first, + after, + last, + before, + order, + direction, + createdBefore, + createdAfter, + referredUserId, + referredUsername, + tier, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/requests/RetrieveBusinessesRequest.java b/src/main/java/com/whop/api/resources/partners/businesses/requests/RetrieveBusinessesRequest.java new file mode 100644 index 00000000..8a46ee38 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/requests/RetrieveBusinessesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveBusinessesRequest.Builder.class) +public final class RetrieveBusinessesRequest { + private final Map additionalProperties; + + private RetrieveBusinessesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveBusinessesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveBusinessesRequest other) { + return this; + } + + public RetrieveBusinessesRequest build() { + return new RetrieveBusinessesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesRequestDirection.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesRequestDirection.java new file mode 100644 index 00000000..0a9e11ee --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListBusinessesRequestDirection { + public static final ListBusinessesRequestDirection ASC = new ListBusinessesRequestDirection(Value.ASC, "asc"); + + public static final ListBusinessesRequestDirection DESC = new ListBusinessesRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListBusinessesRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListBusinessesRequestDirection + && this.string.equals(((ListBusinessesRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListBusinessesRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListBusinessesRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesRequestOrder.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesRequestOrder.java new file mode 100644 index 00000000..bdc43362 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesRequestOrder.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListBusinessesRequestOrder { + public static final ListBusinessesRequestOrder REFERRAL_EXPIRES_AT = + new ListBusinessesRequestOrder(Value.REFERRAL_EXPIRES_AT, "referral_expires_at"); + + public static final ListBusinessesRequestOrder PAYOUT_PERCENTAGE = + new ListBusinessesRequestOrder(Value.PAYOUT_PERCENTAGE, "payout_percentage"); + + public static final ListBusinessesRequestOrder REFERRAL_STARTED_AT = + new ListBusinessesRequestOrder(Value.REFERRAL_STARTED_AT, "referral_started_at"); + + public static final ListBusinessesRequestOrder CREATED_AT = + new ListBusinessesRequestOrder(Value.CREATED_AT, "created_at"); + + public static final ListBusinessesRequestOrder VOLUME_USD = + new ListBusinessesRequestOrder(Value.VOLUME_USD, "volume_usd"); + + public static final ListBusinessesRequestOrder EARNINGS_USD = + new ListBusinessesRequestOrder(Value.EARNINGS_USD, "earnings_usd"); + + private final Value value; + + private final String string; + + ListBusinessesRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListBusinessesRequestOrder + && this.string.equals(((ListBusinessesRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REFERRAL_EXPIRES_AT: + return visitor.visitReferralExpiresAt(); + case PAYOUT_PERCENTAGE: + return visitor.visitPayoutPercentage(); + case REFERRAL_STARTED_AT: + return visitor.visitReferralStartedAt(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case VOLUME_USD: + return visitor.visitVolumeUsd(); + case EARNINGS_USD: + return visitor.visitEarningsUsd(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListBusinessesRequestOrder valueOf(String value) { + switch (value) { + case "referral_expires_at": + return REFERRAL_EXPIRES_AT; + case "payout_percentage": + return PAYOUT_PERCENTAGE; + case "referral_started_at": + return REFERRAL_STARTED_AT; + case "created_at": + return CREATED_AT; + case "volume_usd": + return VOLUME_USD; + case "earnings_usd": + return EARNINGS_USD; + default: + return new ListBusinessesRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + REFERRAL_STARTED_AT, + + REFERRAL_EXPIRES_AT, + + PAYOUT_PERCENTAGE, + + VOLUME_USD, + + EARNINGS_USD, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitReferralStartedAt(); + + T visitReferralExpiresAt(); + + T visitPayoutPercentage(); + + T visitVolumeUsd(); + + T visitEarningsUsd(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesRequestStatus.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesRequestStatus.java new file mode 100644 index 00000000..2fa6c861 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesRequestStatus.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListBusinessesRequestStatus { + public static final ListBusinessesRequestStatus REMOVED = new ListBusinessesRequestStatus(Value.REMOVED, "removed"); + + public static final ListBusinessesRequestStatus ACTIVE = new ListBusinessesRequestStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + ListBusinessesRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListBusinessesRequestStatus + && this.string.equals(((ListBusinessesRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REMOVED: + return visitor.visitRemoved(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListBusinessesRequestStatus valueOf(String value) { + switch (value) { + case "removed": + return REMOVED; + case "active": + return ACTIVE; + default: + return new ListBusinessesRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + REMOVED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitRemoved(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesRequestTier.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesRequestTier.java new file mode 100644 index 00000000..73d0757c --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesRequestTier.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListBusinessesRequestTier { + public static final ListBusinessesRequestTier SECOND = new ListBusinessesRequestTier(Value.SECOND, "second"); + + public static final ListBusinessesRequestTier FIRST = new ListBusinessesRequestTier(Value.FIRST, "first"); + + private final Value value; + + private final String string; + + ListBusinessesRequestTier(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListBusinessesRequestTier + && this.string.equals(((ListBusinessesRequestTier) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SECOND: + return visitor.visitSecond(); + case FIRST: + return visitor.visitFirst(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListBusinessesRequestTier valueOf(String value) { + switch (value) { + case "second": + return SECOND; + case "first": + return FIRST; + default: + return new ListBusinessesRequestTier(Value.UNKNOWN, value); + } + } + + public enum Value { + FIRST, + + SECOND, + + UNKNOWN + } + + public interface Visitor { + T visitFirst(); + + T visitSecond(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponse.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponse.java new file mode 100644 index 00000000..7150005a --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponse.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBusinessesResponse.Builder.class) +public final class ListBusinessesResponse { + private final List data; + + private final ListBusinessesResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListBusinessesResponse( + List data, + ListBusinessesResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListBusinessesResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBusinessesResponse && equalTo((ListBusinessesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBusinessesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListBusinessesResponsePageInfo pageInfo); + + Builder from(ListBusinessesResponse other); + } + + public interface _FinalStage { + ListBusinessesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ListBusinessesResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListBusinessesResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBusinessesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListBusinessesResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ListBusinessesResponseDataItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListBusinessesResponse build() { + return new ListBusinessesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItem.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItem.java new file mode 100644 index 00000000..3a8c7535 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItem.java @@ -0,0 +1,810 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBusinessesResponseDataItem.Builder.class) +public final class ListBusinessesResponseDataItem { + private final Optional account; + + private final OffsetDateTime createdAt; + + private final ListBusinessesResponseDataItemEarningsUsd earningsUsd; + + private final Optional firstTierPartner; + + private final String id; + + private final ListBusinessesResponseDataItemMyPartnerTier myPartnerTier; + + private final ListBusinessesResponseDataItemObject object; + + private final Optional owner; + + private final ListBusinessesResponseDataItemPayoutPercentages payoutPercentages; + + private final Optional referralExpiresAt; + + private final Optional referralStartedAt; + + private final Optional secondTierPartner; + + private final ListBusinessesResponseDataItemStatus status; + + private final ListBusinessesResponseDataItemVolumeUsd volumeUsd; + + private final Map additionalProperties; + + private ListBusinessesResponseDataItem( + Optional account, + OffsetDateTime createdAt, + ListBusinessesResponseDataItemEarningsUsd earningsUsd, + Optional firstTierPartner, + String id, + ListBusinessesResponseDataItemMyPartnerTier myPartnerTier, + ListBusinessesResponseDataItemObject object, + Optional owner, + ListBusinessesResponseDataItemPayoutPercentages payoutPercentages, + Optional referralExpiresAt, + Optional referralStartedAt, + Optional secondTierPartner, + ListBusinessesResponseDataItemStatus status, + ListBusinessesResponseDataItemVolumeUsd volumeUsd, + Map additionalProperties) { + this.account = account; + this.createdAt = createdAt; + this.earningsUsd = earningsUsd; + this.firstTierPartner = firstTierPartner; + this.id = id; + this.myPartnerTier = myPartnerTier; + this.object = object; + this.owner = owner; + this.payoutPercentages = payoutPercentages; + this.referralExpiresAt = referralExpiresAt; + this.referralStartedAt = referralStartedAt; + this.secondTierPartner = secondTierPartner; + this.status = status; + this.volumeUsd = volumeUsd; + this.additionalProperties = additionalProperties; + } + + /** + * @return Referred account. + */ + @JsonIgnore + public Optional getAccount() { + if (account == null) { + return Optional.empty(); + } + return account; + } + + /** + * @return When the partner business was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("earnings_usd") + public ListBusinessesResponseDataItemEarningsUsd getEarningsUsd() { + return earningsUsd; + } + + /** + * @return The partner who referred the business owner onto Whop (first tier). Null if there is no active first-tier partner. + */ + @JsonIgnore + public Optional getFirstTierPartner() { + if (firstTierPartner == null) { + return Optional.empty(); + } + return firstTierPartner; + } + + /** + * @return Partner business ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Which tier the caller earns on for this business: first (they referred the owner) or second (they referred the first-tier partner). + */ + @JsonProperty("my_partner_tier") + public ListBusinessesResponseDataItemMyPartnerTier getMyPartnerTier() { + return myPartnerTier; + } + + @JsonProperty("object") + public ListBusinessesResponseDataItemObject getObject() { + return object; + } + + /** + * @return The owner of the referred business. + */ + @JsonIgnore + public Optional getOwner() { + if (owner == null) { + return Optional.empty(); + } + return owner; + } + + /** + * @return The referrer's commission rate for each income source, expressed as a fraction (0.3 = 30%). + */ + @JsonProperty("payout_percentages") + public ListBusinessesResponseDataItemPayoutPercentages getPayoutPercentages() { + return payoutPercentages; + } + + /** + * @return When the referral expires. + */ + @JsonIgnore + public Optional getReferralExpiresAt() { + if (referralExpiresAt == null) { + return Optional.empty(); + } + return referralExpiresAt; + } + + /** + * @return When the referral became active. + */ + @JsonIgnore + public Optional getReferralStartedAt() { + if (referralStartedAt == null) { + return Optional.empty(); + } + return referralStartedAt; + } + + /** + * @return The second-tier partner who earns on this business (referred the first-tier partner). Null if there is no active second-tier partner. + */ + @JsonIgnore + public Optional getSecondTierPartner() { + if (secondTierPartner == null) { + return Optional.empty(); + } + return secondTierPartner; + } + + /** + * @return Current referral status. + */ + @JsonProperty("status") + public ListBusinessesResponseDataItemStatus getStatus() { + return status; + } + + @JsonProperty("volume_usd") + public ListBusinessesResponseDataItemVolumeUsd getVolumeUsd() { + return volumeUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account") + private Optional _getAccount() { + return account; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_tier_partner") + private Optional _getFirstTierPartner() { + return firstTierPartner; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("owner") + private Optional _getOwner() { + return owner; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("referral_expires_at") + private Optional _getReferralExpiresAt() { + return referralExpiresAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("referral_started_at") + private Optional _getReferralStartedAt() { + return referralStartedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("second_tier_partner") + private Optional _getSecondTierPartner() { + return secondTierPartner; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBusinessesResponseDataItem && equalTo((ListBusinessesResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBusinessesResponseDataItem other) { + return account.equals(other.account) + && createdAt.equals(other.createdAt) + && earningsUsd.equals(other.earningsUsd) + && firstTierPartner.equals(other.firstTierPartner) + && id.equals(other.id) + && myPartnerTier.equals(other.myPartnerTier) + && object.equals(other.object) + && owner.equals(other.owner) + && payoutPercentages.equals(other.payoutPercentages) + && referralExpiresAt.equals(other.referralExpiresAt) + && referralStartedAt.equals(other.referralStartedAt) + && secondTierPartner.equals(other.secondTierPartner) + && status.equals(other.status) + && volumeUsd.equals(other.volumeUsd); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.account, + this.createdAt, + this.earningsUsd, + this.firstTierPartner, + this.id, + this.myPartnerTier, + this.object, + this.owner, + this.payoutPercentages, + this.referralExpiresAt, + this.referralStartedAt, + this.secondTierPartner, + this.status, + this.volumeUsd); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the partner business was created.

+ */ + EarningsUsdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(ListBusinessesResponseDataItem other); + } + + public interface EarningsUsdStage { + IdStage earningsUsd(@NotNull ListBusinessesResponseDataItemEarningsUsd earningsUsd); + } + + public interface IdStage { + /** + *

Partner business ID.

+ */ + MyPartnerTierStage id(@NotNull String id); + } + + public interface MyPartnerTierStage { + /** + *

Which tier the caller earns on for this business: first (they referred the owner) or second (they referred the first-tier partner).

+ */ + ObjectStage myPartnerTier(@NotNull ListBusinessesResponseDataItemMyPartnerTier myPartnerTier); + } + + public interface ObjectStage { + PayoutPercentagesStage object(@NotNull ListBusinessesResponseDataItemObject object); + } + + public interface PayoutPercentagesStage { + /** + *

The referrer's commission rate for each income source, expressed as a fraction (0.3 = 30%).

+ */ + StatusStage payoutPercentages(@NotNull ListBusinessesResponseDataItemPayoutPercentages payoutPercentages); + } + + public interface StatusStage { + /** + *

Current referral status.

+ */ + VolumeUsdStage status(@NotNull ListBusinessesResponseDataItemStatus status); + } + + public interface VolumeUsdStage { + _FinalStage volumeUsd(@NotNull ListBusinessesResponseDataItemVolumeUsd volumeUsd); + } + + public interface _FinalStage { + ListBusinessesResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Referred account.

+ */ + _FinalStage account(Optional account); + + _FinalStage account(ListBusinessesResponseDataItemAccount account); + + _FinalStage account(Nullable account); + + /** + *

The partner who referred the business owner onto Whop (first tier). Null if there is no active first-tier partner.

+ */ + _FinalStage firstTierPartner(Optional firstTierPartner); + + _FinalStage firstTierPartner(ListBusinessesResponseDataItemFirstTierPartner firstTierPartner); + + _FinalStage firstTierPartner(Nullable firstTierPartner); + + /** + *

The owner of the referred business.

+ */ + _FinalStage owner(Optional owner); + + _FinalStage owner(ListBusinessesResponseDataItemOwner owner); + + _FinalStage owner(Nullable owner); + + /** + *

When the referral expires.

+ */ + _FinalStage referralExpiresAt(Optional referralExpiresAt); + + _FinalStage referralExpiresAt(OffsetDateTime referralExpiresAt); + + _FinalStage referralExpiresAt(Nullable referralExpiresAt); + + /** + *

When the referral became active.

+ */ + _FinalStage referralStartedAt(Optional referralStartedAt); + + _FinalStage referralStartedAt(OffsetDateTime referralStartedAt); + + _FinalStage referralStartedAt(Nullable referralStartedAt); + + /** + *

The second-tier partner who earns on this business (referred the first-tier partner). Null if there is no active second-tier partner.

+ */ + _FinalStage secondTierPartner(Optional secondTierPartner); + + _FinalStage secondTierPartner(ListBusinessesResponseDataItemSecondTierPartner secondTierPartner); + + _FinalStage secondTierPartner(Nullable secondTierPartner); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + EarningsUsdStage, + IdStage, + MyPartnerTierStage, + ObjectStage, + PayoutPercentagesStage, + StatusStage, + VolumeUsdStage, + _FinalStage { + private OffsetDateTime createdAt; + + private ListBusinessesResponseDataItemEarningsUsd earningsUsd; + + private String id; + + private ListBusinessesResponseDataItemMyPartnerTier myPartnerTier; + + private ListBusinessesResponseDataItemObject object; + + private ListBusinessesResponseDataItemPayoutPercentages payoutPercentages; + + private ListBusinessesResponseDataItemStatus status; + + private ListBusinessesResponseDataItemVolumeUsd volumeUsd; + + private Optional secondTierPartner = Optional.empty(); + + private Optional referralStartedAt = Optional.empty(); + + private Optional referralExpiresAt = Optional.empty(); + + private Optional owner = Optional.empty(); + + private Optional firstTierPartner = Optional.empty(); + + private Optional account = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBusinessesResponseDataItem other) { + account(other.getAccount()); + createdAt(other.getCreatedAt()); + earningsUsd(other.getEarningsUsd()); + firstTierPartner(other.getFirstTierPartner()); + id(other.getId()); + myPartnerTier(other.getMyPartnerTier()); + object(other.getObject()); + owner(other.getOwner()); + payoutPercentages(other.getPayoutPercentages()); + referralExpiresAt(other.getReferralExpiresAt()); + referralStartedAt(other.getReferralStartedAt()); + secondTierPartner(other.getSecondTierPartner()); + status(other.getStatus()); + volumeUsd(other.getVolumeUsd()); + return this; + } + + /** + *

When the partner business was created.

+ *

When the partner business was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public EarningsUsdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("earnings_usd") + public IdStage earningsUsd(@NotNull ListBusinessesResponseDataItemEarningsUsd earningsUsd) { + this.earningsUsd = Objects.requireNonNull(earningsUsd, "earningsUsd must not be null"); + return this; + } + + /** + *

Partner business ID.

+ *

Partner business ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MyPartnerTierStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Which tier the caller earns on for this business: first (they referred the owner) or second (they referred the first-tier partner).

+ *

Which tier the caller earns on for this business: first (they referred the owner) or second (they referred the first-tier partner).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("my_partner_tier") + public ObjectStage myPartnerTier(@NotNull ListBusinessesResponseDataItemMyPartnerTier myPartnerTier) { + this.myPartnerTier = Objects.requireNonNull(myPartnerTier, "myPartnerTier must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public PayoutPercentagesStage object(@NotNull ListBusinessesResponseDataItemObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

The referrer's commission rate for each income source, expressed as a fraction (0.3 = 30%).

+ *

The referrer's commission rate for each income source, expressed as a fraction (0.3 = 30%).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payout_percentages") + public StatusStage payoutPercentages( + @NotNull ListBusinessesResponseDataItemPayoutPercentages payoutPercentages) { + this.payoutPercentages = Objects.requireNonNull(payoutPercentages, "payoutPercentages must not be null"); + return this; + } + + /** + *

Current referral status.

+ *

Current referral status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public VolumeUsdStage status(@NotNull ListBusinessesResponseDataItemStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("volume_usd") + public _FinalStage volumeUsd(@NotNull ListBusinessesResponseDataItemVolumeUsd volumeUsd) { + this.volumeUsd = Objects.requireNonNull(volumeUsd, "volumeUsd must not be null"); + return this; + } + + /** + *

The second-tier partner who earns on this business (referred the first-tier partner). Null if there is no active second-tier partner.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secondTierPartner( + Nullable secondTierPartner) { + if (secondTierPartner.isNull()) { + this.secondTierPartner = null; + } else if (secondTierPartner.isEmpty()) { + this.secondTierPartner = Optional.empty(); + } else { + this.secondTierPartner = Optional.of(secondTierPartner.get()); + } + return this; + } + + /** + *

The second-tier partner who earns on this business (referred the first-tier partner). Null if there is no active second-tier partner.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secondTierPartner(ListBusinessesResponseDataItemSecondTierPartner secondTierPartner) { + this.secondTierPartner = Optional.ofNullable(secondTierPartner); + return this; + } + + /** + *

The second-tier partner who earns on this business (referred the first-tier partner). Null if there is no active second-tier partner.

+ */ + @java.lang.Override + @JsonSetter(value = "second_tier_partner", nulls = Nulls.SKIP) + public _FinalStage secondTierPartner( + Optional secondTierPartner) { + this.secondTierPartner = secondTierPartner; + return this; + } + + /** + *

When the referral became active.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referralStartedAt(Nullable referralStartedAt) { + if (referralStartedAt.isNull()) { + this.referralStartedAt = null; + } else if (referralStartedAt.isEmpty()) { + this.referralStartedAt = Optional.empty(); + } else { + this.referralStartedAt = Optional.of(referralStartedAt.get()); + } + return this; + } + + /** + *

When the referral became active.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referralStartedAt(OffsetDateTime referralStartedAt) { + this.referralStartedAt = Optional.ofNullable(referralStartedAt); + return this; + } + + /** + *

When the referral became active.

+ */ + @java.lang.Override + @JsonSetter(value = "referral_started_at", nulls = Nulls.SKIP) + public _FinalStage referralStartedAt(Optional referralStartedAt) { + this.referralStartedAt = referralStartedAt; + return this; + } + + /** + *

When the referral expires.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referralExpiresAt(Nullable referralExpiresAt) { + if (referralExpiresAt.isNull()) { + this.referralExpiresAt = null; + } else if (referralExpiresAt.isEmpty()) { + this.referralExpiresAt = Optional.empty(); + } else { + this.referralExpiresAt = Optional.of(referralExpiresAt.get()); + } + return this; + } + + /** + *

When the referral expires.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referralExpiresAt(OffsetDateTime referralExpiresAt) { + this.referralExpiresAt = Optional.ofNullable(referralExpiresAt); + return this; + } + + /** + *

When the referral expires.

+ */ + @java.lang.Override + @JsonSetter(value = "referral_expires_at", nulls = Nulls.SKIP) + public _FinalStage referralExpiresAt(Optional referralExpiresAt) { + this.referralExpiresAt = referralExpiresAt; + return this; + } + + /** + *

The owner of the referred business.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage owner(Nullable owner) { + if (owner.isNull()) { + this.owner = null; + } else if (owner.isEmpty()) { + this.owner = Optional.empty(); + } else { + this.owner = Optional.of(owner.get()); + } + return this; + } + + /** + *

The owner of the referred business.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage owner(ListBusinessesResponseDataItemOwner owner) { + this.owner = Optional.ofNullable(owner); + return this; + } + + /** + *

The owner of the referred business.

+ */ + @java.lang.Override + @JsonSetter(value = "owner", nulls = Nulls.SKIP) + public _FinalStage owner(Optional owner) { + this.owner = owner; + return this; + } + + /** + *

The partner who referred the business owner onto Whop (first tier). Null if there is no active first-tier partner.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstTierPartner(Nullable firstTierPartner) { + if (firstTierPartner.isNull()) { + this.firstTierPartner = null; + } else if (firstTierPartner.isEmpty()) { + this.firstTierPartner = Optional.empty(); + } else { + this.firstTierPartner = Optional.of(firstTierPartner.get()); + } + return this; + } + + /** + *

The partner who referred the business owner onto Whop (first tier). Null if there is no active first-tier partner.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstTierPartner(ListBusinessesResponseDataItemFirstTierPartner firstTierPartner) { + this.firstTierPartner = Optional.ofNullable(firstTierPartner); + return this; + } + + /** + *

The partner who referred the business owner onto Whop (first tier). Null if there is no active first-tier partner.

+ */ + @java.lang.Override + @JsonSetter(value = "first_tier_partner", nulls = Nulls.SKIP) + public _FinalStage firstTierPartner(Optional firstTierPartner) { + this.firstTierPartner = firstTierPartner; + return this; + } + + /** + *

Referred account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(Nullable account) { + if (account.isNull()) { + this.account = null; + } else if (account.isEmpty()) { + this.account = Optional.empty(); + } else { + this.account = Optional.of(account.get()); + } + return this; + } + + /** + *

Referred account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(ListBusinessesResponseDataItemAccount account) { + this.account = Optional.ofNullable(account); + return this; + } + + /** + *

Referred account.

+ */ + @java.lang.Override + @JsonSetter(value = "account", nulls = Nulls.SKIP) + public _FinalStage account(Optional account) { + this.account = account; + return this; + } + + @java.lang.Override + public ListBusinessesResponseDataItem build() { + return new ListBusinessesResponseDataItem( + account, + createdAt, + earningsUsd, + firstTierPartner, + id, + myPartnerTier, + object, + owner, + payoutPercentages, + referralExpiresAt, + referralStartedAt, + secondTierPartner, + status, + volumeUsd, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemAccount.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemAccount.java new file mode 100644 index 00000000..8ac86377 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemAccount.java @@ -0,0 +1,273 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBusinessesResponseDataItemAccount.Builder.class) +public final class ListBusinessesResponseDataItemAccount { + private final String id; + + private final Optional logoUrl; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private ListBusinessesResponseDataItemAccount( + String id, Optional logoUrl, String route, String title, Map additionalProperties) { + this.id = id; + this.logoUrl = logoUrl; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Referred account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Referred account logo URL. + */ + @JsonIgnore + public Optional getLogoUrl() { + if (logoUrl == null) { + return Optional.empty(); + } + return logoUrl; + } + + /** + * @return Referred account route. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return Referred account display name. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo_url") + private Optional _getLogoUrl() { + return logoUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBusinessesResponseDataItemAccount + && equalTo((ListBusinessesResponseDataItemAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBusinessesResponseDataItemAccount other) { + return id.equals(other.id) + && logoUrl.equals(other.logoUrl) + && route.equals(other.route) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.logoUrl, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Referred account ID.

+ */ + RouteStage id(@NotNull String id); + + Builder from(ListBusinessesResponseDataItemAccount other); + } + + public interface RouteStage { + /** + *

Referred account route.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

Referred account display name.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + ListBusinessesResponseDataItemAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Referred account logo URL.

+ */ + _FinalStage logoUrl(Optional logoUrl); + + _FinalStage logoUrl(String logoUrl); + + _FinalStage logoUrl(Nullable logoUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + private Optional logoUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBusinessesResponseDataItemAccount other) { + id(other.getId()); + logoUrl(other.getLogoUrl()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Referred account ID.

+ *

Referred account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Referred account route.

+ *

Referred account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

Referred account display name.

+ *

Referred account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Referred account logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(Nullable logoUrl) { + if (logoUrl.isNull()) { + this.logoUrl = null; + } else if (logoUrl.isEmpty()) { + this.logoUrl = Optional.empty(); + } else { + this.logoUrl = Optional.of(logoUrl.get()); + } + return this; + } + + /** + *

Referred account logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(String logoUrl) { + this.logoUrl = Optional.ofNullable(logoUrl); + return this; + } + + /** + *

Referred account logo URL.

+ */ + @java.lang.Override + @JsonSetter(value = "logo_url", nulls = Nulls.SKIP) + public _FinalStage logoUrl(Optional logoUrl) { + this.logoUrl = logoUrl; + return this; + } + + @java.lang.Override + public ListBusinessesResponseDataItemAccount build() { + return new ListBusinessesResponseDataItemAccount(id, logoUrl, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemEarningsUsd.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemEarningsUsd.java new file mode 100644 index 00000000..2ffec59a --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemEarningsUsd.java @@ -0,0 +1,197 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBusinessesResponseDataItemEarningsUsd.Builder.class) +public final class ListBusinessesResponseDataItemEarningsUsd { + private final String completed; + + private final String pending; + + private final String total; + + private final Map additionalProperties; + + private ListBusinessesResponseDataItemEarningsUsd( + String completed, String pending, String total, Map additionalProperties) { + this.completed = completed; + this.pending = pending; + this.total = total; + this.additionalProperties = additionalProperties; + } + + /** + * @return Commission already paid out, in USD. + */ + @JsonProperty("completed") + public String getCompleted() { + return completed; + } + + /** + * @return Commission scheduled but not yet paid, in USD. + */ + @JsonProperty("pending") + public String getPending() { + return pending; + } + + /** + * @return Pending + completed commission, in USD. + */ + @JsonProperty("total") + public String getTotal() { + return total; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBusinessesResponseDataItemEarningsUsd + && equalTo((ListBusinessesResponseDataItemEarningsUsd) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBusinessesResponseDataItemEarningsUsd other) { + return completed.equals(other.completed) && pending.equals(other.pending) && total.equals(other.total); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.completed, this.pending, this.total); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompletedStage builder() { + return new Builder(); + } + + public interface CompletedStage { + /** + *

Commission already paid out, in USD.

+ */ + PendingStage completed(@NotNull String completed); + + Builder from(ListBusinessesResponseDataItemEarningsUsd other); + } + + public interface PendingStage { + /** + *

Commission scheduled but not yet paid, in USD.

+ */ + TotalStage pending(@NotNull String pending); + } + + public interface TotalStage { + /** + *

Pending + completed commission, in USD.

+ */ + _FinalStage total(@NotNull String total); + } + + public interface _FinalStage { + ListBusinessesResponseDataItemEarningsUsd build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompletedStage, PendingStage, TotalStage, _FinalStage { + private String completed; + + private String pending; + + private String total; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBusinessesResponseDataItemEarningsUsd other) { + completed(other.getCompleted()); + pending(other.getPending()); + total(other.getTotal()); + return this; + } + + /** + *

Commission already paid out, in USD.

+ *

Commission already paid out, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completed") + public PendingStage completed(@NotNull String completed) { + this.completed = Objects.requireNonNull(completed, "completed must not be null"); + return this; + } + + /** + *

Commission scheduled but not yet paid, in USD.

+ *

Commission scheduled but not yet paid, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("pending") + public TotalStage pending(@NotNull String pending) { + this.pending = Objects.requireNonNull(pending, "pending must not be null"); + return this; + } + + /** + *

Pending + completed commission, in USD.

+ *

Pending + completed commission, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total") + public _FinalStage total(@NotNull String total) { + this.total = Objects.requireNonNull(total, "total must not be null"); + return this; + } + + @java.lang.Override + public ListBusinessesResponseDataItemEarningsUsd build() { + return new ListBusinessesResponseDataItemEarningsUsd(completed, pending, total, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemFirstTierPartner.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemFirstTierPartner.java new file mode 100644 index 00000000..5bfa1bb4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemFirstTierPartner.java @@ -0,0 +1,280 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBusinessesResponseDataItemFirstTierPartner.Builder.class) +public final class ListBusinessesResponseDataItemFirstTierPartner { + private final String id; + + private final Optional name; + + private final ListBusinessesResponseDataItemFirstTierPartnerProfilePicture profilePicture; + + private final String username; + + private final Map additionalProperties; + + private ListBusinessesResponseDataItemFirstTierPartner( + String id, + Optional name, + ListBusinessesResponseDataItemFirstTierPartnerProfilePicture profilePicture, + String username, + Map additionalProperties) { + this.id = id; + this.name = name; + this.profilePicture = profilePicture; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID, prefixed user_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's profile picture. + */ + @JsonProperty("profile_picture") + public ListBusinessesResponseDataItemFirstTierPartnerProfilePicture getProfilePicture() { + return profilePicture; + } + + /** + * @return The user's unique username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBusinessesResponseDataItemFirstTierPartner + && equalTo((ListBusinessesResponseDataItemFirstTierPartner) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBusinessesResponseDataItemFirstTierPartner other) { + return id.equals(other.id) + && name.equals(other.name) + && profilePicture.equals(other.profilePicture) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.profilePicture, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID, prefixed user_.

+ */ + ProfilePictureStage id(@NotNull String id); + + Builder from(ListBusinessesResponseDataItemFirstTierPartner other); + } + + public interface ProfilePictureStage { + /** + *

The user's profile picture.

+ */ + UsernameStage profilePicture( + @NotNull ListBusinessesResponseDataItemFirstTierPartnerProfilePicture profilePicture); + } + + public interface UsernameStage { + /** + *

The user's unique username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + ListBusinessesResponseDataItemFirstTierPartner build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ProfilePictureStage, UsernameStage, _FinalStage { + private String id; + + private ListBusinessesResponseDataItemFirstTierPartnerProfilePicture profilePicture; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBusinessesResponseDataItemFirstTierPartner other) { + id(other.getId()); + name(other.getName()); + profilePicture(other.getProfilePicture()); + username(other.getUsername()); + return this; + } + + /** + *

User ID, prefixed user_.

+ *

User ID, prefixed user_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ProfilePictureStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's profile picture.

+ *

The user's profile picture.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("profile_picture") + public UsernameStage profilePicture( + @NotNull ListBusinessesResponseDataItemFirstTierPartnerProfilePicture profilePicture) { + this.profilePicture = Objects.requireNonNull(profilePicture, "profilePicture must not be null"); + return this; + } + + /** + *

The user's unique username.

+ *

The user's unique username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ListBusinessesResponseDataItemFirstTierPartner build() { + return new ListBusinessesResponseDataItemFirstTierPartner( + id, name, profilePicture, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemFirstTierPartnerProfilePicture.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemFirstTierPartnerProfilePicture.java new file mode 100644 index 00000000..e1e6c57c --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemFirstTierPartnerProfilePicture.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBusinessesResponseDataItemFirstTierPartnerProfilePicture.Builder.class) +public final class ListBusinessesResponseDataItemFirstTierPartnerProfilePicture { + private final String url; + + private final Map additionalProperties; + + private ListBusinessesResponseDataItemFirstTierPartnerProfilePicture( + String url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's profile picture URL. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBusinessesResponseDataItemFirstTierPartnerProfilePicture + && equalTo((ListBusinessesResponseDataItemFirstTierPartnerProfilePicture) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBusinessesResponseDataItemFirstTierPartnerProfilePicture other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

The user's profile picture URL.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(ListBusinessesResponseDataItemFirstTierPartnerProfilePicture other); + } + + public interface _FinalStage { + ListBusinessesResponseDataItemFirstTierPartnerProfilePicture build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBusinessesResponseDataItemFirstTierPartnerProfilePicture other) { + url(other.getUrl()); + return this; + } + + /** + *

The user's profile picture URL.

+ *

The user's profile picture URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public ListBusinessesResponseDataItemFirstTierPartnerProfilePicture build() { + return new ListBusinessesResponseDataItemFirstTierPartnerProfilePicture(url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemMyPartnerTier.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemMyPartnerTier.java new file mode 100644 index 00000000..2531713b --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemMyPartnerTier.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListBusinessesResponseDataItemMyPartnerTier { + public static final ListBusinessesResponseDataItemMyPartnerTier SECOND = + new ListBusinessesResponseDataItemMyPartnerTier(Value.SECOND, "second"); + + public static final ListBusinessesResponseDataItemMyPartnerTier FIRST = + new ListBusinessesResponseDataItemMyPartnerTier(Value.FIRST, "first"); + + private final Value value; + + private final String string; + + ListBusinessesResponseDataItemMyPartnerTier(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListBusinessesResponseDataItemMyPartnerTier + && this.string.equals(((ListBusinessesResponseDataItemMyPartnerTier) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SECOND: + return visitor.visitSecond(); + case FIRST: + return visitor.visitFirst(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListBusinessesResponseDataItemMyPartnerTier valueOf(String value) { + switch (value) { + case "second": + return SECOND; + case "first": + return FIRST; + default: + return new ListBusinessesResponseDataItemMyPartnerTier(Value.UNKNOWN, value); + } + } + + public enum Value { + FIRST, + + SECOND, + + UNKNOWN + } + + public interface Visitor { + T visitFirst(); + + T visitSecond(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemObject.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemObject.java new file mode 100644 index 00000000..595d0dcd --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListBusinessesResponseDataItemObject { + public static final ListBusinessesResponseDataItemObject PARTNER_BUSINESS = + new ListBusinessesResponseDataItemObject(Value.PARTNER_BUSINESS, "partner_business"); + + private final Value value; + + private final String string; + + ListBusinessesResponseDataItemObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListBusinessesResponseDataItemObject + && this.string.equals(((ListBusinessesResponseDataItemObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PARTNER_BUSINESS: + return visitor.visitPartnerBusiness(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListBusinessesResponseDataItemObject valueOf(String value) { + switch (value) { + case "partner_business": + return PARTNER_BUSINESS; + default: + return new ListBusinessesResponseDataItemObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PARTNER_BUSINESS, + + UNKNOWN + } + + public interface Visitor { + T visitPartnerBusiness(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemOwner.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemOwner.java new file mode 100644 index 00000000..9fc5c213 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemOwner.java @@ -0,0 +1,277 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBusinessesResponseDataItemOwner.Builder.class) +public final class ListBusinessesResponseDataItemOwner { + private final String id; + + private final Optional name; + + private final ListBusinessesResponseDataItemOwnerProfilePicture profilePicture; + + private final String username; + + private final Map additionalProperties; + + private ListBusinessesResponseDataItemOwner( + String id, + Optional name, + ListBusinessesResponseDataItemOwnerProfilePicture profilePicture, + String username, + Map additionalProperties) { + this.id = id; + this.name = name; + this.profilePicture = profilePicture; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID, prefixed user_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's profile picture. + */ + @JsonProperty("profile_picture") + public ListBusinessesResponseDataItemOwnerProfilePicture getProfilePicture() { + return profilePicture; + } + + /** + * @return The user's unique username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBusinessesResponseDataItemOwner + && equalTo((ListBusinessesResponseDataItemOwner) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBusinessesResponseDataItemOwner other) { + return id.equals(other.id) + && name.equals(other.name) + && profilePicture.equals(other.profilePicture) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.profilePicture, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID, prefixed user_.

+ */ + ProfilePictureStage id(@NotNull String id); + + Builder from(ListBusinessesResponseDataItemOwner other); + } + + public interface ProfilePictureStage { + /** + *

The user's profile picture.

+ */ + UsernameStage profilePicture(@NotNull ListBusinessesResponseDataItemOwnerProfilePicture profilePicture); + } + + public interface UsernameStage { + /** + *

The user's unique username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + ListBusinessesResponseDataItemOwner build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ProfilePictureStage, UsernameStage, _FinalStage { + private String id; + + private ListBusinessesResponseDataItemOwnerProfilePicture profilePicture; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBusinessesResponseDataItemOwner other) { + id(other.getId()); + name(other.getName()); + profilePicture(other.getProfilePicture()); + username(other.getUsername()); + return this; + } + + /** + *

User ID, prefixed user_.

+ *

User ID, prefixed user_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ProfilePictureStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's profile picture.

+ *

The user's profile picture.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("profile_picture") + public UsernameStage profilePicture(@NotNull ListBusinessesResponseDataItemOwnerProfilePicture profilePicture) { + this.profilePicture = Objects.requireNonNull(profilePicture, "profilePicture must not be null"); + return this; + } + + /** + *

The user's unique username.

+ *

The user's unique username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ListBusinessesResponseDataItemOwner build() { + return new ListBusinessesResponseDataItemOwner(id, name, profilePicture, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemOwnerProfilePicture.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemOwnerProfilePicture.java new file mode 100644 index 00000000..a2b561df --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemOwnerProfilePicture.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBusinessesResponseDataItemOwnerProfilePicture.Builder.class) +public final class ListBusinessesResponseDataItemOwnerProfilePicture { + private final String url; + + private final Map additionalProperties; + + private ListBusinessesResponseDataItemOwnerProfilePicture(String url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's profile picture URL. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBusinessesResponseDataItemOwnerProfilePicture + && equalTo((ListBusinessesResponseDataItemOwnerProfilePicture) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBusinessesResponseDataItemOwnerProfilePicture other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

The user's profile picture URL.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(ListBusinessesResponseDataItemOwnerProfilePicture other); + } + + public interface _FinalStage { + ListBusinessesResponseDataItemOwnerProfilePicture build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBusinessesResponseDataItemOwnerProfilePicture other) { + url(other.getUrl()); + return this; + } + + /** + *

The user's profile picture URL.

+ *

The user's profile picture URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public ListBusinessesResponseDataItemOwnerProfilePicture build() { + return new ListBusinessesResponseDataItemOwnerProfilePicture(url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemPayoutPercentages.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemPayoutPercentages.java new file mode 100644 index 00000000..30404a9e --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemPayoutPercentages.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBusinessesResponseDataItemPayoutPercentages.Builder.class) +public final class ListBusinessesResponseDataItemPayoutPercentages { + private final Optional adSpend; + + private final Optional cardInterchange; + + private final float sales; + + private final Optional transfer; + + private final Map additionalProperties; + + private ListBusinessesResponseDataItemPayoutPercentages( + Optional adSpend, + Optional cardInterchange, + float sales, + Optional transfer, + Map additionalProperties) { + this.adSpend = adSpend; + this.cardInterchange = cardInterchange; + this.sales = sales; + this.transfer = transfer; + this.additionalProperties = additionalProperties; + } + + /** + * @return Share of the referred business's Whop Ads spend. + */ + @JsonIgnore + public Optional getAdSpend() { + if (adSpend == null) { + return Optional.empty(); + } + return adSpend; + } + + /** + * @return Share of Whop's profit from card interchange. + */ + @JsonIgnore + public Optional getCardInterchange() { + if (cardInterchange == null) { + return Optional.empty(); + } + return cardInterchange; + } + + /** + * @return Share of Whop's profit from product sales. + */ + @JsonProperty("sales") + public float getSales() { + return sales; + } + + /** + * @return Share of Whop's profit from platform balance transfers. + */ + @JsonIgnore + public Optional getTransfer() { + if (transfer == null) { + return Optional.empty(); + } + return transfer; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_spend") + private Optional _getAdSpend() { + return adSpend; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_interchange") + private Optional _getCardInterchange() { + return cardInterchange; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("transfer") + private Optional _getTransfer() { + return transfer; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBusinessesResponseDataItemPayoutPercentages + && equalTo((ListBusinessesResponseDataItemPayoutPercentages) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBusinessesResponseDataItemPayoutPercentages other) { + return adSpend.equals(other.adSpend) + && cardInterchange.equals(other.cardInterchange) + && sales == other.sales + && transfer.equals(other.transfer); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.adSpend, this.cardInterchange, this.sales, this.transfer); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SalesStage builder() { + return new Builder(); + } + + public interface SalesStage { + /** + *

Share of Whop's profit from product sales.

+ */ + _FinalStage sales(float sales); + + Builder from(ListBusinessesResponseDataItemPayoutPercentages other); + } + + public interface _FinalStage { + ListBusinessesResponseDataItemPayoutPercentages build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Share of the referred business's Whop Ads spend.

+ */ + _FinalStage adSpend(Optional adSpend); + + _FinalStage adSpend(Float adSpend); + + _FinalStage adSpend(Nullable adSpend); + + /** + *

Share of Whop's profit from card interchange.

+ */ + _FinalStage cardInterchange(Optional cardInterchange); + + _FinalStage cardInterchange(Float cardInterchange); + + _FinalStage cardInterchange(Nullable cardInterchange); + + /** + *

Share of Whop's profit from platform balance transfers.

+ */ + _FinalStage transfer(Optional transfer); + + _FinalStage transfer(Float transfer); + + _FinalStage transfer(Nullable transfer); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SalesStage, _FinalStage { + private float sales; + + private Optional transfer = Optional.empty(); + + private Optional cardInterchange = Optional.empty(); + + private Optional adSpend = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBusinessesResponseDataItemPayoutPercentages other) { + adSpend(other.getAdSpend()); + cardInterchange(other.getCardInterchange()); + sales(other.getSales()); + transfer(other.getTransfer()); + return this; + } + + /** + *

Share of Whop's profit from product sales.

+ *

Share of Whop's profit from product sales.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sales") + public _FinalStage sales(float sales) { + this.sales = sales; + return this; + } + + /** + *

Share of Whop's profit from platform balance transfers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage transfer(Nullable transfer) { + if (transfer.isNull()) { + this.transfer = null; + } else if (transfer.isEmpty()) { + this.transfer = Optional.empty(); + } else { + this.transfer = Optional.of(transfer.get()); + } + return this; + } + + /** + *

Share of Whop's profit from platform balance transfers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage transfer(Float transfer) { + this.transfer = Optional.ofNullable(transfer); + return this; + } + + /** + *

Share of Whop's profit from platform balance transfers.

+ */ + @java.lang.Override + @JsonSetter(value = "transfer", nulls = Nulls.SKIP) + public _FinalStage transfer(Optional transfer) { + this.transfer = transfer; + return this; + } + + /** + *

Share of Whop's profit from card interchange.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardInterchange(Nullable cardInterchange) { + if (cardInterchange.isNull()) { + this.cardInterchange = null; + } else if (cardInterchange.isEmpty()) { + this.cardInterchange = Optional.empty(); + } else { + this.cardInterchange = Optional.of(cardInterchange.get()); + } + return this; + } + + /** + *

Share of Whop's profit from card interchange.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardInterchange(Float cardInterchange) { + this.cardInterchange = Optional.ofNullable(cardInterchange); + return this; + } + + /** + *

Share of Whop's profit from card interchange.

+ */ + @java.lang.Override + @JsonSetter(value = "card_interchange", nulls = Nulls.SKIP) + public _FinalStage cardInterchange(Optional cardInterchange) { + this.cardInterchange = cardInterchange; + return this; + } + + /** + *

Share of the referred business's Whop Ads spend.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adSpend(Nullable adSpend) { + if (adSpend.isNull()) { + this.adSpend = null; + } else if (adSpend.isEmpty()) { + this.adSpend = Optional.empty(); + } else { + this.adSpend = Optional.of(adSpend.get()); + } + return this; + } + + /** + *

Share of the referred business's Whop Ads spend.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adSpend(Float adSpend) { + this.adSpend = Optional.ofNullable(adSpend); + return this; + } + + /** + *

Share of the referred business's Whop Ads spend.

+ */ + @java.lang.Override + @JsonSetter(value = "ad_spend", nulls = Nulls.SKIP) + public _FinalStage adSpend(Optional adSpend) { + this.adSpend = adSpend; + return this; + } + + @java.lang.Override + public ListBusinessesResponseDataItemPayoutPercentages build() { + return new ListBusinessesResponseDataItemPayoutPercentages( + adSpend, cardInterchange, sales, transfer, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemSecondTierPartner.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemSecondTierPartner.java new file mode 100644 index 00000000..ac143c1e --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemSecondTierPartner.java @@ -0,0 +1,280 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBusinessesResponseDataItemSecondTierPartner.Builder.class) +public final class ListBusinessesResponseDataItemSecondTierPartner { + private final String id; + + private final Optional name; + + private final ListBusinessesResponseDataItemSecondTierPartnerProfilePicture profilePicture; + + private final String username; + + private final Map additionalProperties; + + private ListBusinessesResponseDataItemSecondTierPartner( + String id, + Optional name, + ListBusinessesResponseDataItemSecondTierPartnerProfilePicture profilePicture, + String username, + Map additionalProperties) { + this.id = id; + this.name = name; + this.profilePicture = profilePicture; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID, prefixed user_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's profile picture. + */ + @JsonProperty("profile_picture") + public ListBusinessesResponseDataItemSecondTierPartnerProfilePicture getProfilePicture() { + return profilePicture; + } + + /** + * @return The user's unique username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBusinessesResponseDataItemSecondTierPartner + && equalTo((ListBusinessesResponseDataItemSecondTierPartner) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBusinessesResponseDataItemSecondTierPartner other) { + return id.equals(other.id) + && name.equals(other.name) + && profilePicture.equals(other.profilePicture) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.profilePicture, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID, prefixed user_.

+ */ + ProfilePictureStage id(@NotNull String id); + + Builder from(ListBusinessesResponseDataItemSecondTierPartner other); + } + + public interface ProfilePictureStage { + /** + *

The user's profile picture.

+ */ + UsernameStage profilePicture( + @NotNull ListBusinessesResponseDataItemSecondTierPartnerProfilePicture profilePicture); + } + + public interface UsernameStage { + /** + *

The user's unique username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + ListBusinessesResponseDataItemSecondTierPartner build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ProfilePictureStage, UsernameStage, _FinalStage { + private String id; + + private ListBusinessesResponseDataItemSecondTierPartnerProfilePicture profilePicture; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBusinessesResponseDataItemSecondTierPartner other) { + id(other.getId()); + name(other.getName()); + profilePicture(other.getProfilePicture()); + username(other.getUsername()); + return this; + } + + /** + *

User ID, prefixed user_.

+ *

User ID, prefixed user_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ProfilePictureStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's profile picture.

+ *

The user's profile picture.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("profile_picture") + public UsernameStage profilePicture( + @NotNull ListBusinessesResponseDataItemSecondTierPartnerProfilePicture profilePicture) { + this.profilePicture = Objects.requireNonNull(profilePicture, "profilePicture must not be null"); + return this; + } + + /** + *

The user's unique username.

+ *

The user's unique username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ListBusinessesResponseDataItemSecondTierPartner build() { + return new ListBusinessesResponseDataItemSecondTierPartner( + id, name, profilePicture, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemSecondTierPartnerProfilePicture.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemSecondTierPartnerProfilePicture.java new file mode 100644 index 00000000..27f6cb05 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemSecondTierPartnerProfilePicture.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBusinessesResponseDataItemSecondTierPartnerProfilePicture.Builder.class) +public final class ListBusinessesResponseDataItemSecondTierPartnerProfilePicture { + private final String url; + + private final Map additionalProperties; + + private ListBusinessesResponseDataItemSecondTierPartnerProfilePicture( + String url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's profile picture URL. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBusinessesResponseDataItemSecondTierPartnerProfilePicture + && equalTo((ListBusinessesResponseDataItemSecondTierPartnerProfilePicture) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBusinessesResponseDataItemSecondTierPartnerProfilePicture other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

The user's profile picture URL.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(ListBusinessesResponseDataItemSecondTierPartnerProfilePicture other); + } + + public interface _FinalStage { + ListBusinessesResponseDataItemSecondTierPartnerProfilePicture build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBusinessesResponseDataItemSecondTierPartnerProfilePicture other) { + url(other.getUrl()); + return this; + } + + /** + *

The user's profile picture URL.

+ *

The user's profile picture URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public ListBusinessesResponseDataItemSecondTierPartnerProfilePicture build() { + return new ListBusinessesResponseDataItemSecondTierPartnerProfilePicture(url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemStatus.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemStatus.java new file mode 100644 index 00000000..5997cf50 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemStatus.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListBusinessesResponseDataItemStatus { + public static final ListBusinessesResponseDataItemStatus REMOVED = + new ListBusinessesResponseDataItemStatus(Value.REMOVED, "removed"); + + public static final ListBusinessesResponseDataItemStatus ACTIVE = + new ListBusinessesResponseDataItemStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + ListBusinessesResponseDataItemStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListBusinessesResponseDataItemStatus + && this.string.equals(((ListBusinessesResponseDataItemStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REMOVED: + return visitor.visitRemoved(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListBusinessesResponseDataItemStatus valueOf(String value) { + switch (value) { + case "removed": + return REMOVED; + case "active": + return ACTIVE; + default: + return new ListBusinessesResponseDataItemStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + REMOVED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitRemoved(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemVolumeUsd.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemVolumeUsd.java new file mode 100644 index 00000000..99e22026 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponseDataItemVolumeUsd.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBusinessesResponseDataItemVolumeUsd.Builder.class) +public final class ListBusinessesResponseDataItemVolumeUsd { + private final String attributed; + + private final String awaitingSettlement; + + private final String settled; + + private final Map additionalProperties; + + private ListBusinessesResponseDataItemVolumeUsd( + String attributed, String awaitingSettlement, String settled, Map additionalProperties) { + this.attributed = attributed; + this.awaitingSettlement = awaitingSettlement; + this.settled = settled; + this.additionalProperties = additionalProperties; + } + + /** + * @return Credited GMV (awaiting_settlement + settled); excludes canceled and reversed, in USD. + */ + @JsonProperty("attributed") + public String getAttributed() { + return attributed; + } + + /** + * @return GMV awaiting settlement (commission not yet computed), in USD. + */ + @JsonProperty("awaiting_settlement") + public String getAwaitingSettlement() { + return awaitingSettlement; + } + + /** + * @return GMV of pending + completed payments, in USD. + */ + @JsonProperty("settled") + public String getSettled() { + return settled; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBusinessesResponseDataItemVolumeUsd + && equalTo((ListBusinessesResponseDataItemVolumeUsd) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBusinessesResponseDataItemVolumeUsd other) { + return attributed.equals(other.attributed) + && awaitingSettlement.equals(other.awaitingSettlement) + && settled.equals(other.settled); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.attributed, this.awaitingSettlement, this.settled); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AttributedStage builder() { + return new Builder(); + } + + public interface AttributedStage { + /** + *

Credited GMV (awaiting_settlement + settled); excludes canceled and reversed, in USD.

+ */ + AwaitingSettlementStage attributed(@NotNull String attributed); + + Builder from(ListBusinessesResponseDataItemVolumeUsd other); + } + + public interface AwaitingSettlementStage { + /** + *

GMV awaiting settlement (commission not yet computed), in USD.

+ */ + SettledStage awaitingSettlement(@NotNull String awaitingSettlement); + } + + public interface SettledStage { + /** + *

GMV of pending + completed payments, in USD.

+ */ + _FinalStage settled(@NotNull String settled); + } + + public interface _FinalStage { + ListBusinessesResponseDataItemVolumeUsd build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AttributedStage, AwaitingSettlementStage, SettledStage, _FinalStage { + private String attributed; + + private String awaitingSettlement; + + private String settled; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBusinessesResponseDataItemVolumeUsd other) { + attributed(other.getAttributed()); + awaitingSettlement(other.getAwaitingSettlement()); + settled(other.getSettled()); + return this; + } + + /** + *

Credited GMV (awaiting_settlement + settled); excludes canceled and reversed, in USD.

+ *

Credited GMV (awaiting_settlement + settled); excludes canceled and reversed, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("attributed") + public AwaitingSettlementStage attributed(@NotNull String attributed) { + this.attributed = Objects.requireNonNull(attributed, "attributed must not be null"); + return this; + } + + /** + *

GMV awaiting settlement (commission not yet computed), in USD.

+ *

GMV awaiting settlement (commission not yet computed), in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("awaiting_settlement") + public SettledStage awaitingSettlement(@NotNull String awaitingSettlement) { + this.awaitingSettlement = Objects.requireNonNull(awaitingSettlement, "awaitingSettlement must not be null"); + return this; + } + + /** + *

GMV of pending + completed payments, in USD.

+ *

GMV of pending + completed payments, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("settled") + public _FinalStage settled(@NotNull String settled) { + this.settled = Objects.requireNonNull(settled, "settled must not be null"); + return this; + } + + @java.lang.Override + public ListBusinessesResponseDataItemVolumeUsd build() { + return new ListBusinessesResponseDataItemVolumeUsd( + attributed, awaitingSettlement, settled, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponsePageInfo.java b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponsePageInfo.java new file mode 100644 index 00000000..8f6f682c --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/ListBusinessesResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListBusinessesResponsePageInfo.Builder.class) +public final class ListBusinessesResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListBusinessesResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBusinessesResponsePageInfo && equalTo((ListBusinessesResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBusinessesResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListBusinessesResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListBusinessesResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBusinessesResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListBusinessesResponsePageInfo build() { + return new ListBusinessesResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponse.java b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponse.java new file mode 100644 index 00000000..bd32f544 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponse.java @@ -0,0 +1,807 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveBusinessesResponse.Builder.class) +public final class RetrieveBusinessesResponse { + private final Optional account; + + private final OffsetDateTime createdAt; + + private final RetrieveBusinessesResponseEarningsUsd earningsUsd; + + private final Optional firstTierPartner; + + private final String id; + + private final RetrieveBusinessesResponseMyPartnerTier myPartnerTier; + + private final RetrieveBusinessesResponseObject object; + + private final Optional owner; + + private final RetrieveBusinessesResponsePayoutPercentages payoutPercentages; + + private final Optional referralExpiresAt; + + private final Optional referralStartedAt; + + private final Optional secondTierPartner; + + private final RetrieveBusinessesResponseStatus status; + + private final RetrieveBusinessesResponseVolumeUsd volumeUsd; + + private final Map additionalProperties; + + private RetrieveBusinessesResponse( + Optional account, + OffsetDateTime createdAt, + RetrieveBusinessesResponseEarningsUsd earningsUsd, + Optional firstTierPartner, + String id, + RetrieveBusinessesResponseMyPartnerTier myPartnerTier, + RetrieveBusinessesResponseObject object, + Optional owner, + RetrieveBusinessesResponsePayoutPercentages payoutPercentages, + Optional referralExpiresAt, + Optional referralStartedAt, + Optional secondTierPartner, + RetrieveBusinessesResponseStatus status, + RetrieveBusinessesResponseVolumeUsd volumeUsd, + Map additionalProperties) { + this.account = account; + this.createdAt = createdAt; + this.earningsUsd = earningsUsd; + this.firstTierPartner = firstTierPartner; + this.id = id; + this.myPartnerTier = myPartnerTier; + this.object = object; + this.owner = owner; + this.payoutPercentages = payoutPercentages; + this.referralExpiresAt = referralExpiresAt; + this.referralStartedAt = referralStartedAt; + this.secondTierPartner = secondTierPartner; + this.status = status; + this.volumeUsd = volumeUsd; + this.additionalProperties = additionalProperties; + } + + /** + * @return Referred account. + */ + @JsonIgnore + public Optional getAccount() { + if (account == null) { + return Optional.empty(); + } + return account; + } + + /** + * @return When the partner business was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("earnings_usd") + public RetrieveBusinessesResponseEarningsUsd getEarningsUsd() { + return earningsUsd; + } + + /** + * @return The partner who referred the business owner onto Whop (first tier). Null if there is no active first-tier partner. + */ + @JsonIgnore + public Optional getFirstTierPartner() { + if (firstTierPartner == null) { + return Optional.empty(); + } + return firstTierPartner; + } + + /** + * @return Partner business ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Which tier the caller earns on for this business: first (they referred the owner) or second (they referred the first-tier partner). + */ + @JsonProperty("my_partner_tier") + public RetrieveBusinessesResponseMyPartnerTier getMyPartnerTier() { + return myPartnerTier; + } + + @JsonProperty("object") + public RetrieveBusinessesResponseObject getObject() { + return object; + } + + /** + * @return The owner of the referred business. + */ + @JsonIgnore + public Optional getOwner() { + if (owner == null) { + return Optional.empty(); + } + return owner; + } + + /** + * @return The referrer's commission rate for each income source, expressed as a fraction (0.3 = 30%). + */ + @JsonProperty("payout_percentages") + public RetrieveBusinessesResponsePayoutPercentages getPayoutPercentages() { + return payoutPercentages; + } + + /** + * @return When the referral expires. + */ + @JsonIgnore + public Optional getReferralExpiresAt() { + if (referralExpiresAt == null) { + return Optional.empty(); + } + return referralExpiresAt; + } + + /** + * @return When the referral became active. + */ + @JsonIgnore + public Optional getReferralStartedAt() { + if (referralStartedAt == null) { + return Optional.empty(); + } + return referralStartedAt; + } + + /** + * @return The second-tier partner who earns on this business (referred the first-tier partner). Null if there is no active second-tier partner. + */ + @JsonIgnore + public Optional getSecondTierPartner() { + if (secondTierPartner == null) { + return Optional.empty(); + } + return secondTierPartner; + } + + /** + * @return Current referral status. + */ + @JsonProperty("status") + public RetrieveBusinessesResponseStatus getStatus() { + return status; + } + + @JsonProperty("volume_usd") + public RetrieveBusinessesResponseVolumeUsd getVolumeUsd() { + return volumeUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account") + private Optional _getAccount() { + return account; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_tier_partner") + private Optional _getFirstTierPartner() { + return firstTierPartner; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("owner") + private Optional _getOwner() { + return owner; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("referral_expires_at") + private Optional _getReferralExpiresAt() { + return referralExpiresAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("referral_started_at") + private Optional _getReferralStartedAt() { + return referralStartedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("second_tier_partner") + private Optional _getSecondTierPartner() { + return secondTierPartner; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveBusinessesResponse && equalTo((RetrieveBusinessesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveBusinessesResponse other) { + return account.equals(other.account) + && createdAt.equals(other.createdAt) + && earningsUsd.equals(other.earningsUsd) + && firstTierPartner.equals(other.firstTierPartner) + && id.equals(other.id) + && myPartnerTier.equals(other.myPartnerTier) + && object.equals(other.object) + && owner.equals(other.owner) + && payoutPercentages.equals(other.payoutPercentages) + && referralExpiresAt.equals(other.referralExpiresAt) + && referralStartedAt.equals(other.referralStartedAt) + && secondTierPartner.equals(other.secondTierPartner) + && status.equals(other.status) + && volumeUsd.equals(other.volumeUsd); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.account, + this.createdAt, + this.earningsUsd, + this.firstTierPartner, + this.id, + this.myPartnerTier, + this.object, + this.owner, + this.payoutPercentages, + this.referralExpiresAt, + this.referralStartedAt, + this.secondTierPartner, + this.status, + this.volumeUsd); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the partner business was created.

+ */ + EarningsUsdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(RetrieveBusinessesResponse other); + } + + public interface EarningsUsdStage { + IdStage earningsUsd(@NotNull RetrieveBusinessesResponseEarningsUsd earningsUsd); + } + + public interface IdStage { + /** + *

Partner business ID.

+ */ + MyPartnerTierStage id(@NotNull String id); + } + + public interface MyPartnerTierStage { + /** + *

Which tier the caller earns on for this business: first (they referred the owner) or second (they referred the first-tier partner).

+ */ + ObjectStage myPartnerTier(@NotNull RetrieveBusinessesResponseMyPartnerTier myPartnerTier); + } + + public interface ObjectStage { + PayoutPercentagesStage object(@NotNull RetrieveBusinessesResponseObject object); + } + + public interface PayoutPercentagesStage { + /** + *

The referrer's commission rate for each income source, expressed as a fraction (0.3 = 30%).

+ */ + StatusStage payoutPercentages(@NotNull RetrieveBusinessesResponsePayoutPercentages payoutPercentages); + } + + public interface StatusStage { + /** + *

Current referral status.

+ */ + VolumeUsdStage status(@NotNull RetrieveBusinessesResponseStatus status); + } + + public interface VolumeUsdStage { + _FinalStage volumeUsd(@NotNull RetrieveBusinessesResponseVolumeUsd volumeUsd); + } + + public interface _FinalStage { + RetrieveBusinessesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Referred account.

+ */ + _FinalStage account(Optional account); + + _FinalStage account(RetrieveBusinessesResponseAccount account); + + _FinalStage account(Nullable account); + + /** + *

The partner who referred the business owner onto Whop (first tier). Null if there is no active first-tier partner.

+ */ + _FinalStage firstTierPartner(Optional firstTierPartner); + + _FinalStage firstTierPartner(RetrieveBusinessesResponseFirstTierPartner firstTierPartner); + + _FinalStage firstTierPartner(Nullable firstTierPartner); + + /** + *

The owner of the referred business.

+ */ + _FinalStage owner(Optional owner); + + _FinalStage owner(RetrieveBusinessesResponseOwner owner); + + _FinalStage owner(Nullable owner); + + /** + *

When the referral expires.

+ */ + _FinalStage referralExpiresAt(Optional referralExpiresAt); + + _FinalStage referralExpiresAt(OffsetDateTime referralExpiresAt); + + _FinalStage referralExpiresAt(Nullable referralExpiresAt); + + /** + *

When the referral became active.

+ */ + _FinalStage referralStartedAt(Optional referralStartedAt); + + _FinalStage referralStartedAt(OffsetDateTime referralStartedAt); + + _FinalStage referralStartedAt(Nullable referralStartedAt); + + /** + *

The second-tier partner who earns on this business (referred the first-tier partner). Null if there is no active second-tier partner.

+ */ + _FinalStage secondTierPartner(Optional secondTierPartner); + + _FinalStage secondTierPartner(RetrieveBusinessesResponseSecondTierPartner secondTierPartner); + + _FinalStage secondTierPartner(Nullable secondTierPartner); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + EarningsUsdStage, + IdStage, + MyPartnerTierStage, + ObjectStage, + PayoutPercentagesStage, + StatusStage, + VolumeUsdStage, + _FinalStage { + private OffsetDateTime createdAt; + + private RetrieveBusinessesResponseEarningsUsd earningsUsd; + + private String id; + + private RetrieveBusinessesResponseMyPartnerTier myPartnerTier; + + private RetrieveBusinessesResponseObject object; + + private RetrieveBusinessesResponsePayoutPercentages payoutPercentages; + + private RetrieveBusinessesResponseStatus status; + + private RetrieveBusinessesResponseVolumeUsd volumeUsd; + + private Optional secondTierPartner = Optional.empty(); + + private Optional referralStartedAt = Optional.empty(); + + private Optional referralExpiresAt = Optional.empty(); + + private Optional owner = Optional.empty(); + + private Optional firstTierPartner = Optional.empty(); + + private Optional account = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveBusinessesResponse other) { + account(other.getAccount()); + createdAt(other.getCreatedAt()); + earningsUsd(other.getEarningsUsd()); + firstTierPartner(other.getFirstTierPartner()); + id(other.getId()); + myPartnerTier(other.getMyPartnerTier()); + object(other.getObject()); + owner(other.getOwner()); + payoutPercentages(other.getPayoutPercentages()); + referralExpiresAt(other.getReferralExpiresAt()); + referralStartedAt(other.getReferralStartedAt()); + secondTierPartner(other.getSecondTierPartner()); + status(other.getStatus()); + volumeUsd(other.getVolumeUsd()); + return this; + } + + /** + *

When the partner business was created.

+ *

When the partner business was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public EarningsUsdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("earnings_usd") + public IdStage earningsUsd(@NotNull RetrieveBusinessesResponseEarningsUsd earningsUsd) { + this.earningsUsd = Objects.requireNonNull(earningsUsd, "earningsUsd must not be null"); + return this; + } + + /** + *

Partner business ID.

+ *

Partner business ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MyPartnerTierStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Which tier the caller earns on for this business: first (they referred the owner) or second (they referred the first-tier partner).

+ *

Which tier the caller earns on for this business: first (they referred the owner) or second (they referred the first-tier partner).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("my_partner_tier") + public ObjectStage myPartnerTier(@NotNull RetrieveBusinessesResponseMyPartnerTier myPartnerTier) { + this.myPartnerTier = Objects.requireNonNull(myPartnerTier, "myPartnerTier must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public PayoutPercentagesStage object(@NotNull RetrieveBusinessesResponseObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

The referrer's commission rate for each income source, expressed as a fraction (0.3 = 30%).

+ *

The referrer's commission rate for each income source, expressed as a fraction (0.3 = 30%).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payout_percentages") + public StatusStage payoutPercentages(@NotNull RetrieveBusinessesResponsePayoutPercentages payoutPercentages) { + this.payoutPercentages = Objects.requireNonNull(payoutPercentages, "payoutPercentages must not be null"); + return this; + } + + /** + *

Current referral status.

+ *

Current referral status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public VolumeUsdStage status(@NotNull RetrieveBusinessesResponseStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("volume_usd") + public _FinalStage volumeUsd(@NotNull RetrieveBusinessesResponseVolumeUsd volumeUsd) { + this.volumeUsd = Objects.requireNonNull(volumeUsd, "volumeUsd must not be null"); + return this; + } + + /** + *

The second-tier partner who earns on this business (referred the first-tier partner). Null if there is no active second-tier partner.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secondTierPartner(Nullable secondTierPartner) { + if (secondTierPartner.isNull()) { + this.secondTierPartner = null; + } else if (secondTierPartner.isEmpty()) { + this.secondTierPartner = Optional.empty(); + } else { + this.secondTierPartner = Optional.of(secondTierPartner.get()); + } + return this; + } + + /** + *

The second-tier partner who earns on this business (referred the first-tier partner). Null if there is no active second-tier partner.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secondTierPartner(RetrieveBusinessesResponseSecondTierPartner secondTierPartner) { + this.secondTierPartner = Optional.ofNullable(secondTierPartner); + return this; + } + + /** + *

The second-tier partner who earns on this business (referred the first-tier partner). Null if there is no active second-tier partner.

+ */ + @java.lang.Override + @JsonSetter(value = "second_tier_partner", nulls = Nulls.SKIP) + public _FinalStage secondTierPartner(Optional secondTierPartner) { + this.secondTierPartner = secondTierPartner; + return this; + } + + /** + *

When the referral became active.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referralStartedAt(Nullable referralStartedAt) { + if (referralStartedAt.isNull()) { + this.referralStartedAt = null; + } else if (referralStartedAt.isEmpty()) { + this.referralStartedAt = Optional.empty(); + } else { + this.referralStartedAt = Optional.of(referralStartedAt.get()); + } + return this; + } + + /** + *

When the referral became active.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referralStartedAt(OffsetDateTime referralStartedAt) { + this.referralStartedAt = Optional.ofNullable(referralStartedAt); + return this; + } + + /** + *

When the referral became active.

+ */ + @java.lang.Override + @JsonSetter(value = "referral_started_at", nulls = Nulls.SKIP) + public _FinalStage referralStartedAt(Optional referralStartedAt) { + this.referralStartedAt = referralStartedAt; + return this; + } + + /** + *

When the referral expires.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referralExpiresAt(Nullable referralExpiresAt) { + if (referralExpiresAt.isNull()) { + this.referralExpiresAt = null; + } else if (referralExpiresAt.isEmpty()) { + this.referralExpiresAt = Optional.empty(); + } else { + this.referralExpiresAt = Optional.of(referralExpiresAt.get()); + } + return this; + } + + /** + *

When the referral expires.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referralExpiresAt(OffsetDateTime referralExpiresAt) { + this.referralExpiresAt = Optional.ofNullable(referralExpiresAt); + return this; + } + + /** + *

When the referral expires.

+ */ + @java.lang.Override + @JsonSetter(value = "referral_expires_at", nulls = Nulls.SKIP) + public _FinalStage referralExpiresAt(Optional referralExpiresAt) { + this.referralExpiresAt = referralExpiresAt; + return this; + } + + /** + *

The owner of the referred business.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage owner(Nullable owner) { + if (owner.isNull()) { + this.owner = null; + } else if (owner.isEmpty()) { + this.owner = Optional.empty(); + } else { + this.owner = Optional.of(owner.get()); + } + return this; + } + + /** + *

The owner of the referred business.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage owner(RetrieveBusinessesResponseOwner owner) { + this.owner = Optional.ofNullable(owner); + return this; + } + + /** + *

The owner of the referred business.

+ */ + @java.lang.Override + @JsonSetter(value = "owner", nulls = Nulls.SKIP) + public _FinalStage owner(Optional owner) { + this.owner = owner; + return this; + } + + /** + *

The partner who referred the business owner onto Whop (first tier). Null if there is no active first-tier partner.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstTierPartner(Nullable firstTierPartner) { + if (firstTierPartner.isNull()) { + this.firstTierPartner = null; + } else if (firstTierPartner.isEmpty()) { + this.firstTierPartner = Optional.empty(); + } else { + this.firstTierPartner = Optional.of(firstTierPartner.get()); + } + return this; + } + + /** + *

The partner who referred the business owner onto Whop (first tier). Null if there is no active first-tier partner.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstTierPartner(RetrieveBusinessesResponseFirstTierPartner firstTierPartner) { + this.firstTierPartner = Optional.ofNullable(firstTierPartner); + return this; + } + + /** + *

The partner who referred the business owner onto Whop (first tier). Null if there is no active first-tier partner.

+ */ + @java.lang.Override + @JsonSetter(value = "first_tier_partner", nulls = Nulls.SKIP) + public _FinalStage firstTierPartner(Optional firstTierPartner) { + this.firstTierPartner = firstTierPartner; + return this; + } + + /** + *

Referred account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(Nullable account) { + if (account.isNull()) { + this.account = null; + } else if (account.isEmpty()) { + this.account = Optional.empty(); + } else { + this.account = Optional.of(account.get()); + } + return this; + } + + /** + *

Referred account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(RetrieveBusinessesResponseAccount account) { + this.account = Optional.ofNullable(account); + return this; + } + + /** + *

Referred account.

+ */ + @java.lang.Override + @JsonSetter(value = "account", nulls = Nulls.SKIP) + public _FinalStage account(Optional account) { + this.account = account; + return this; + } + + @java.lang.Override + public RetrieveBusinessesResponse build() { + return new RetrieveBusinessesResponse( + account, + createdAt, + earningsUsd, + firstTierPartner, + id, + myPartnerTier, + object, + owner, + payoutPercentages, + referralExpiresAt, + referralStartedAt, + secondTierPartner, + status, + volumeUsd, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseAccount.java b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseAccount.java new file mode 100644 index 00000000..a6d0a83c --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseAccount.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AccountCapabilities; +import com.whop.api.types.AccountRecommendedAction; +import com.whop.api.types.AccountRequiredAction; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveBusinessesResponseAccount.Builder.class) +public final class RetrieveBusinessesResponseAccount { + private final AccountCapabilities capabilities; + + private final String id; + + private final Optional logoUrl; + + private final Optional> recommendedActions; + + private final Optional> requiredActions; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private RetrieveBusinessesResponseAccount( + AccountCapabilities capabilities, + String id, + Optional logoUrl, + Optional> recommendedActions, + Optional> requiredActions, + String route, + String title, + Map additionalProperties) { + this.capabilities = capabilities; + this.id = id; + this.logoUrl = logoUrl; + this.recommendedActions = recommendedActions; + this.requiredActions = requiredActions; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("capabilities") + public AccountCapabilities getCapabilities() { + return capabilities; + } + + /** + * @return Referred account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Referred account logo URL. + */ + @JsonIgnore + public Optional getLogoUrl() { + if (logoUrl == null) { + return Optional.empty(); + } + return logoUrl; + } + + /** + * @return Optional actions that unlock capabilities or grow the referred account. + */ + @JsonIgnore + public Optional> getRecommendedActions() { + if (recommendedActions == null) { + return Optional.empty(); + } + return recommendedActions; + } + + /** + * @return Actions the referred account owner must take to unblock capabilities. + */ + @JsonIgnore + public Optional> getRequiredActions() { + if (requiredActions == null) { + return Optional.empty(); + } + return requiredActions; + } + + /** + * @return Referred account route. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return Referred account display name. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo_url") + private Optional _getLogoUrl() { + return logoUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("recommended_actions") + private Optional> _getRecommendedActions() { + return recommendedActions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("required_actions") + private Optional> _getRequiredActions() { + return requiredActions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveBusinessesResponseAccount && equalTo((RetrieveBusinessesResponseAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveBusinessesResponseAccount other) { + return capabilities.equals(other.capabilities) + && id.equals(other.id) + && logoUrl.equals(other.logoUrl) + && recommendedActions.equals(other.recommendedActions) + && requiredActions.equals(other.requiredActions) + && route.equals(other.route) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.capabilities, + this.id, + this.logoUrl, + this.recommendedActions, + this.requiredActions, + this.route, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CapabilitiesStage builder() { + return new Builder(); + } + + public interface CapabilitiesStage { + IdStage capabilities(@NotNull AccountCapabilities capabilities); + + Builder from(RetrieveBusinessesResponseAccount other); + } + + public interface IdStage { + /** + *

Referred account ID.

+ */ + RouteStage id(@NotNull String id); + } + + public interface RouteStage { + /** + *

Referred account route.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

Referred account display name.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + RetrieveBusinessesResponseAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Referred account logo URL.

+ */ + _FinalStage logoUrl(Optional logoUrl); + + _FinalStage logoUrl(String logoUrl); + + _FinalStage logoUrl(Nullable logoUrl); + + /** + *

Optional actions that unlock capabilities or grow the referred account.

+ */ + _FinalStage recommendedActions(Optional> recommendedActions); + + _FinalStage recommendedActions(List recommendedActions); + + _FinalStage recommendedActions(Nullable> recommendedActions); + + /** + *

Actions the referred account owner must take to unblock capabilities.

+ */ + _FinalStage requiredActions(Optional> requiredActions); + + _FinalStage requiredActions(List requiredActions); + + _FinalStage requiredActions(Nullable> requiredActions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CapabilitiesStage, IdStage, RouteStage, TitleStage, _FinalStage { + private AccountCapabilities capabilities; + + private String id; + + private String route; + + private String title; + + private Optional> requiredActions = Optional.empty(); + + private Optional> recommendedActions = Optional.empty(); + + private Optional logoUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveBusinessesResponseAccount other) { + capabilities(other.getCapabilities()); + id(other.getId()); + logoUrl(other.getLogoUrl()); + recommendedActions(other.getRecommendedActions()); + requiredActions(other.getRequiredActions()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + @java.lang.Override + @JsonSetter("capabilities") + public IdStage capabilities(@NotNull AccountCapabilities capabilities) { + this.capabilities = Objects.requireNonNull(capabilities, "capabilities must not be null"); + return this; + } + + /** + *

Referred account ID.

+ *

Referred account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Referred account route.

+ *

Referred account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

Referred account display name.

+ *

Referred account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Actions the referred account owner must take to unblock capabilities.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requiredActions(Nullable> requiredActions) { + if (requiredActions.isNull()) { + this.requiredActions = null; + } else if (requiredActions.isEmpty()) { + this.requiredActions = Optional.empty(); + } else { + this.requiredActions = Optional.of(requiredActions.get()); + } + return this; + } + + /** + *

Actions the referred account owner must take to unblock capabilities.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requiredActions(List requiredActions) { + this.requiredActions = Optional.ofNullable(requiredActions); + return this; + } + + /** + *

Actions the referred account owner must take to unblock capabilities.

+ */ + @java.lang.Override + @JsonSetter(value = "required_actions", nulls = Nulls.SKIP) + public _FinalStage requiredActions(Optional> requiredActions) { + this.requiredActions = requiredActions; + return this; + } + + /** + *

Optional actions that unlock capabilities or grow the referred account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage recommendedActions(Nullable> recommendedActions) { + if (recommendedActions.isNull()) { + this.recommendedActions = null; + } else if (recommendedActions.isEmpty()) { + this.recommendedActions = Optional.empty(); + } else { + this.recommendedActions = Optional.of(recommendedActions.get()); + } + return this; + } + + /** + *

Optional actions that unlock capabilities or grow the referred account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage recommendedActions(List recommendedActions) { + this.recommendedActions = Optional.ofNullable(recommendedActions); + return this; + } + + /** + *

Optional actions that unlock capabilities or grow the referred account.

+ */ + @java.lang.Override + @JsonSetter(value = "recommended_actions", nulls = Nulls.SKIP) + public _FinalStage recommendedActions(Optional> recommendedActions) { + this.recommendedActions = recommendedActions; + return this; + } + + /** + *

Referred account logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(Nullable logoUrl) { + if (logoUrl.isNull()) { + this.logoUrl = null; + } else if (logoUrl.isEmpty()) { + this.logoUrl = Optional.empty(); + } else { + this.logoUrl = Optional.of(logoUrl.get()); + } + return this; + } + + /** + *

Referred account logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(String logoUrl) { + this.logoUrl = Optional.ofNullable(logoUrl); + return this; + } + + /** + *

Referred account logo URL.

+ */ + @java.lang.Override + @JsonSetter(value = "logo_url", nulls = Nulls.SKIP) + public _FinalStage logoUrl(Optional logoUrl) { + this.logoUrl = logoUrl; + return this; + } + + @java.lang.Override + public RetrieveBusinessesResponseAccount build() { + return new RetrieveBusinessesResponseAccount( + capabilities, id, logoUrl, recommendedActions, requiredActions, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseEarningsUsd.java b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseEarningsUsd.java new file mode 100644 index 00000000..923094e7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseEarningsUsd.java @@ -0,0 +1,197 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveBusinessesResponseEarningsUsd.Builder.class) +public final class RetrieveBusinessesResponseEarningsUsd { + private final String completed; + + private final String pending; + + private final String total; + + private final Map additionalProperties; + + private RetrieveBusinessesResponseEarningsUsd( + String completed, String pending, String total, Map additionalProperties) { + this.completed = completed; + this.pending = pending; + this.total = total; + this.additionalProperties = additionalProperties; + } + + /** + * @return Commission already paid out, in USD. + */ + @JsonProperty("completed") + public String getCompleted() { + return completed; + } + + /** + * @return Commission scheduled but not yet paid, in USD. + */ + @JsonProperty("pending") + public String getPending() { + return pending; + } + + /** + * @return Pending + completed commission, in USD. + */ + @JsonProperty("total") + public String getTotal() { + return total; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveBusinessesResponseEarningsUsd + && equalTo((RetrieveBusinessesResponseEarningsUsd) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveBusinessesResponseEarningsUsd other) { + return completed.equals(other.completed) && pending.equals(other.pending) && total.equals(other.total); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.completed, this.pending, this.total); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompletedStage builder() { + return new Builder(); + } + + public interface CompletedStage { + /** + *

Commission already paid out, in USD.

+ */ + PendingStage completed(@NotNull String completed); + + Builder from(RetrieveBusinessesResponseEarningsUsd other); + } + + public interface PendingStage { + /** + *

Commission scheduled but not yet paid, in USD.

+ */ + TotalStage pending(@NotNull String pending); + } + + public interface TotalStage { + /** + *

Pending + completed commission, in USD.

+ */ + _FinalStage total(@NotNull String total); + } + + public interface _FinalStage { + RetrieveBusinessesResponseEarningsUsd build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompletedStage, PendingStage, TotalStage, _FinalStage { + private String completed; + + private String pending; + + private String total; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveBusinessesResponseEarningsUsd other) { + completed(other.getCompleted()); + pending(other.getPending()); + total(other.getTotal()); + return this; + } + + /** + *

Commission already paid out, in USD.

+ *

Commission already paid out, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completed") + public PendingStage completed(@NotNull String completed) { + this.completed = Objects.requireNonNull(completed, "completed must not be null"); + return this; + } + + /** + *

Commission scheduled but not yet paid, in USD.

+ *

Commission scheduled but not yet paid, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("pending") + public TotalStage pending(@NotNull String pending) { + this.pending = Objects.requireNonNull(pending, "pending must not be null"); + return this; + } + + /** + *

Pending + completed commission, in USD.

+ *

Pending + completed commission, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total") + public _FinalStage total(@NotNull String total) { + this.total = Objects.requireNonNull(total, "total must not be null"); + return this; + } + + @java.lang.Override + public RetrieveBusinessesResponseEarningsUsd build() { + return new RetrieveBusinessesResponseEarningsUsd(completed, pending, total, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseFirstTierPartner.java b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseFirstTierPartner.java new file mode 100644 index 00000000..0ecac155 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseFirstTierPartner.java @@ -0,0 +1,279 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveBusinessesResponseFirstTierPartner.Builder.class) +public final class RetrieveBusinessesResponseFirstTierPartner { + private final String id; + + private final Optional name; + + private final RetrieveBusinessesResponseFirstTierPartnerProfilePicture profilePicture; + + private final String username; + + private final Map additionalProperties; + + private RetrieveBusinessesResponseFirstTierPartner( + String id, + Optional name, + RetrieveBusinessesResponseFirstTierPartnerProfilePicture profilePicture, + String username, + Map additionalProperties) { + this.id = id; + this.name = name; + this.profilePicture = profilePicture; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID, prefixed user_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's profile picture. + */ + @JsonProperty("profile_picture") + public RetrieveBusinessesResponseFirstTierPartnerProfilePicture getProfilePicture() { + return profilePicture; + } + + /** + * @return The user's unique username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveBusinessesResponseFirstTierPartner + && equalTo((RetrieveBusinessesResponseFirstTierPartner) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveBusinessesResponseFirstTierPartner other) { + return id.equals(other.id) + && name.equals(other.name) + && profilePicture.equals(other.profilePicture) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.profilePicture, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID, prefixed user_.

+ */ + ProfilePictureStage id(@NotNull String id); + + Builder from(RetrieveBusinessesResponseFirstTierPartner other); + } + + public interface ProfilePictureStage { + /** + *

The user's profile picture.

+ */ + UsernameStage profilePicture(@NotNull RetrieveBusinessesResponseFirstTierPartnerProfilePicture profilePicture); + } + + public interface UsernameStage { + /** + *

The user's unique username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + RetrieveBusinessesResponseFirstTierPartner build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ProfilePictureStage, UsernameStage, _FinalStage { + private String id; + + private RetrieveBusinessesResponseFirstTierPartnerProfilePicture profilePicture; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveBusinessesResponseFirstTierPartner other) { + id(other.getId()); + name(other.getName()); + profilePicture(other.getProfilePicture()); + username(other.getUsername()); + return this; + } + + /** + *

User ID, prefixed user_.

+ *

User ID, prefixed user_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ProfilePictureStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's profile picture.

+ *

The user's profile picture.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("profile_picture") + public UsernameStage profilePicture( + @NotNull RetrieveBusinessesResponseFirstTierPartnerProfilePicture profilePicture) { + this.profilePicture = Objects.requireNonNull(profilePicture, "profilePicture must not be null"); + return this; + } + + /** + *

The user's unique username.

+ *

The user's unique username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrieveBusinessesResponseFirstTierPartner build() { + return new RetrieveBusinessesResponseFirstTierPartner( + id, name, profilePicture, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseFirstTierPartnerProfilePicture.java b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseFirstTierPartnerProfilePicture.java new file mode 100644 index 00000000..5eaa1451 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseFirstTierPartnerProfilePicture.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveBusinessesResponseFirstTierPartnerProfilePicture.Builder.class) +public final class RetrieveBusinessesResponseFirstTierPartnerProfilePicture { + private final String url; + + private final Map additionalProperties; + + private RetrieveBusinessesResponseFirstTierPartnerProfilePicture( + String url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's profile picture URL. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveBusinessesResponseFirstTierPartnerProfilePicture + && equalTo((RetrieveBusinessesResponseFirstTierPartnerProfilePicture) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveBusinessesResponseFirstTierPartnerProfilePicture other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

The user's profile picture URL.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(RetrieveBusinessesResponseFirstTierPartnerProfilePicture other); + } + + public interface _FinalStage { + RetrieveBusinessesResponseFirstTierPartnerProfilePicture build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveBusinessesResponseFirstTierPartnerProfilePicture other) { + url(other.getUrl()); + return this; + } + + /** + *

The user's profile picture URL.

+ *

The user's profile picture URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public RetrieveBusinessesResponseFirstTierPartnerProfilePicture build() { + return new RetrieveBusinessesResponseFirstTierPartnerProfilePicture(url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseMyPartnerTier.java b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseMyPartnerTier.java new file mode 100644 index 00000000..8f82eda2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseMyPartnerTier.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveBusinessesResponseMyPartnerTier { + public static final RetrieveBusinessesResponseMyPartnerTier SECOND = + new RetrieveBusinessesResponseMyPartnerTier(Value.SECOND, "second"); + + public static final RetrieveBusinessesResponseMyPartnerTier FIRST = + new RetrieveBusinessesResponseMyPartnerTier(Value.FIRST, "first"); + + private final Value value; + + private final String string; + + RetrieveBusinessesResponseMyPartnerTier(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveBusinessesResponseMyPartnerTier + && this.string.equals(((RetrieveBusinessesResponseMyPartnerTier) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SECOND: + return visitor.visitSecond(); + case FIRST: + return visitor.visitFirst(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveBusinessesResponseMyPartnerTier valueOf(String value) { + switch (value) { + case "second": + return SECOND; + case "first": + return FIRST; + default: + return new RetrieveBusinessesResponseMyPartnerTier(Value.UNKNOWN, value); + } + } + + public enum Value { + FIRST, + + SECOND, + + UNKNOWN + } + + public interface Visitor { + T visitFirst(); + + T visitSecond(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseObject.java b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseObject.java new file mode 100644 index 00000000..182fa584 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveBusinessesResponseObject { + public static final RetrieveBusinessesResponseObject PARTNER_BUSINESS = + new RetrieveBusinessesResponseObject(Value.PARTNER_BUSINESS, "partner_business"); + + private final Value value; + + private final String string; + + RetrieveBusinessesResponseObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveBusinessesResponseObject + && this.string.equals(((RetrieveBusinessesResponseObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PARTNER_BUSINESS: + return visitor.visitPartnerBusiness(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveBusinessesResponseObject valueOf(String value) { + switch (value) { + case "partner_business": + return PARTNER_BUSINESS; + default: + return new RetrieveBusinessesResponseObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PARTNER_BUSINESS, + + UNKNOWN + } + + public interface Visitor { + T visitPartnerBusiness(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseOwner.java b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseOwner.java new file mode 100644 index 00000000..b280b8e3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseOwner.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveBusinessesResponseOwner.Builder.class) +public final class RetrieveBusinessesResponseOwner { + private final String id; + + private final Optional name; + + private final RetrieveBusinessesResponseOwnerProfilePicture profilePicture; + + private final String username; + + private final Map additionalProperties; + + private RetrieveBusinessesResponseOwner( + String id, + Optional name, + RetrieveBusinessesResponseOwnerProfilePicture profilePicture, + String username, + Map additionalProperties) { + this.id = id; + this.name = name; + this.profilePicture = profilePicture; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID, prefixed user_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's profile picture. + */ + @JsonProperty("profile_picture") + public RetrieveBusinessesResponseOwnerProfilePicture getProfilePicture() { + return profilePicture; + } + + /** + * @return The user's unique username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveBusinessesResponseOwner && equalTo((RetrieveBusinessesResponseOwner) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveBusinessesResponseOwner other) { + return id.equals(other.id) + && name.equals(other.name) + && profilePicture.equals(other.profilePicture) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.profilePicture, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID, prefixed user_.

+ */ + ProfilePictureStage id(@NotNull String id); + + Builder from(RetrieveBusinessesResponseOwner other); + } + + public interface ProfilePictureStage { + /** + *

The user's profile picture.

+ */ + UsernameStage profilePicture(@NotNull RetrieveBusinessesResponseOwnerProfilePicture profilePicture); + } + + public interface UsernameStage { + /** + *

The user's unique username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + RetrieveBusinessesResponseOwner build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ProfilePictureStage, UsernameStage, _FinalStage { + private String id; + + private RetrieveBusinessesResponseOwnerProfilePicture profilePicture; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveBusinessesResponseOwner other) { + id(other.getId()); + name(other.getName()); + profilePicture(other.getProfilePicture()); + username(other.getUsername()); + return this; + } + + /** + *

User ID, prefixed user_.

+ *

User ID, prefixed user_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ProfilePictureStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's profile picture.

+ *

The user's profile picture.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("profile_picture") + public UsernameStage profilePicture(@NotNull RetrieveBusinessesResponseOwnerProfilePicture profilePicture) { + this.profilePicture = Objects.requireNonNull(profilePicture, "profilePicture must not be null"); + return this; + } + + /** + *

The user's unique username.

+ *

The user's unique username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrieveBusinessesResponseOwner build() { + return new RetrieveBusinessesResponseOwner(id, name, profilePicture, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseOwnerProfilePicture.java b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseOwnerProfilePicture.java new file mode 100644 index 00000000..31565ef7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseOwnerProfilePicture.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveBusinessesResponseOwnerProfilePicture.Builder.class) +public final class RetrieveBusinessesResponseOwnerProfilePicture { + private final String url; + + private final Map additionalProperties; + + private RetrieveBusinessesResponseOwnerProfilePicture(String url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's profile picture URL. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveBusinessesResponseOwnerProfilePicture + && equalTo((RetrieveBusinessesResponseOwnerProfilePicture) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveBusinessesResponseOwnerProfilePicture other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

The user's profile picture URL.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(RetrieveBusinessesResponseOwnerProfilePicture other); + } + + public interface _FinalStage { + RetrieveBusinessesResponseOwnerProfilePicture build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveBusinessesResponseOwnerProfilePicture other) { + url(other.getUrl()); + return this; + } + + /** + *

The user's profile picture URL.

+ *

The user's profile picture URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public RetrieveBusinessesResponseOwnerProfilePicture build() { + return new RetrieveBusinessesResponseOwnerProfilePicture(url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponsePayoutPercentages.java b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponsePayoutPercentages.java new file mode 100644 index 00000000..1dd8712a --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponsePayoutPercentages.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveBusinessesResponsePayoutPercentages.Builder.class) +public final class RetrieveBusinessesResponsePayoutPercentages { + private final Optional adSpend; + + private final Optional cardInterchange; + + private final float sales; + + private final Optional transfer; + + private final Map additionalProperties; + + private RetrieveBusinessesResponsePayoutPercentages( + Optional adSpend, + Optional cardInterchange, + float sales, + Optional transfer, + Map additionalProperties) { + this.adSpend = adSpend; + this.cardInterchange = cardInterchange; + this.sales = sales; + this.transfer = transfer; + this.additionalProperties = additionalProperties; + } + + /** + * @return Share of the referred business's Whop Ads spend. + */ + @JsonIgnore + public Optional getAdSpend() { + if (adSpend == null) { + return Optional.empty(); + } + return adSpend; + } + + /** + * @return Share of Whop's profit from card interchange. + */ + @JsonIgnore + public Optional getCardInterchange() { + if (cardInterchange == null) { + return Optional.empty(); + } + return cardInterchange; + } + + /** + * @return Share of Whop's profit from product sales. + */ + @JsonProperty("sales") + public float getSales() { + return sales; + } + + /** + * @return Share of Whop's profit from platform balance transfers. + */ + @JsonIgnore + public Optional getTransfer() { + if (transfer == null) { + return Optional.empty(); + } + return transfer; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_spend") + private Optional _getAdSpend() { + return adSpend; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_interchange") + private Optional _getCardInterchange() { + return cardInterchange; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("transfer") + private Optional _getTransfer() { + return transfer; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveBusinessesResponsePayoutPercentages + && equalTo((RetrieveBusinessesResponsePayoutPercentages) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveBusinessesResponsePayoutPercentages other) { + return adSpend.equals(other.adSpend) + && cardInterchange.equals(other.cardInterchange) + && sales == other.sales + && transfer.equals(other.transfer); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.adSpend, this.cardInterchange, this.sales, this.transfer); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SalesStage builder() { + return new Builder(); + } + + public interface SalesStage { + /** + *

Share of Whop's profit from product sales.

+ */ + _FinalStage sales(float sales); + + Builder from(RetrieveBusinessesResponsePayoutPercentages other); + } + + public interface _FinalStage { + RetrieveBusinessesResponsePayoutPercentages build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Share of the referred business's Whop Ads spend.

+ */ + _FinalStage adSpend(Optional adSpend); + + _FinalStage adSpend(Float adSpend); + + _FinalStage adSpend(Nullable adSpend); + + /** + *

Share of Whop's profit from card interchange.

+ */ + _FinalStage cardInterchange(Optional cardInterchange); + + _FinalStage cardInterchange(Float cardInterchange); + + _FinalStage cardInterchange(Nullable cardInterchange); + + /** + *

Share of Whop's profit from platform balance transfers.

+ */ + _FinalStage transfer(Optional transfer); + + _FinalStage transfer(Float transfer); + + _FinalStage transfer(Nullable transfer); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SalesStage, _FinalStage { + private float sales; + + private Optional transfer = Optional.empty(); + + private Optional cardInterchange = Optional.empty(); + + private Optional adSpend = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveBusinessesResponsePayoutPercentages other) { + adSpend(other.getAdSpend()); + cardInterchange(other.getCardInterchange()); + sales(other.getSales()); + transfer(other.getTransfer()); + return this; + } + + /** + *

Share of Whop's profit from product sales.

+ *

Share of Whop's profit from product sales.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sales") + public _FinalStage sales(float sales) { + this.sales = sales; + return this; + } + + /** + *

Share of Whop's profit from platform balance transfers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage transfer(Nullable transfer) { + if (transfer.isNull()) { + this.transfer = null; + } else if (transfer.isEmpty()) { + this.transfer = Optional.empty(); + } else { + this.transfer = Optional.of(transfer.get()); + } + return this; + } + + /** + *

Share of Whop's profit from platform balance transfers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage transfer(Float transfer) { + this.transfer = Optional.ofNullable(transfer); + return this; + } + + /** + *

Share of Whop's profit from platform balance transfers.

+ */ + @java.lang.Override + @JsonSetter(value = "transfer", nulls = Nulls.SKIP) + public _FinalStage transfer(Optional transfer) { + this.transfer = transfer; + return this; + } + + /** + *

Share of Whop's profit from card interchange.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardInterchange(Nullable cardInterchange) { + if (cardInterchange.isNull()) { + this.cardInterchange = null; + } else if (cardInterchange.isEmpty()) { + this.cardInterchange = Optional.empty(); + } else { + this.cardInterchange = Optional.of(cardInterchange.get()); + } + return this; + } + + /** + *

Share of Whop's profit from card interchange.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardInterchange(Float cardInterchange) { + this.cardInterchange = Optional.ofNullable(cardInterchange); + return this; + } + + /** + *

Share of Whop's profit from card interchange.

+ */ + @java.lang.Override + @JsonSetter(value = "card_interchange", nulls = Nulls.SKIP) + public _FinalStage cardInterchange(Optional cardInterchange) { + this.cardInterchange = cardInterchange; + return this; + } + + /** + *

Share of the referred business's Whop Ads spend.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adSpend(Nullable adSpend) { + if (adSpend.isNull()) { + this.adSpend = null; + } else if (adSpend.isEmpty()) { + this.adSpend = Optional.empty(); + } else { + this.adSpend = Optional.of(adSpend.get()); + } + return this; + } + + /** + *

Share of the referred business's Whop Ads spend.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adSpend(Float adSpend) { + this.adSpend = Optional.ofNullable(adSpend); + return this; + } + + /** + *

Share of the referred business's Whop Ads spend.

+ */ + @java.lang.Override + @JsonSetter(value = "ad_spend", nulls = Nulls.SKIP) + public _FinalStage adSpend(Optional adSpend) { + this.adSpend = adSpend; + return this; + } + + @java.lang.Override + public RetrieveBusinessesResponsePayoutPercentages build() { + return new RetrieveBusinessesResponsePayoutPercentages( + adSpend, cardInterchange, sales, transfer, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseSecondTierPartner.java b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseSecondTierPartner.java new file mode 100644 index 00000000..b8605292 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseSecondTierPartner.java @@ -0,0 +1,279 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveBusinessesResponseSecondTierPartner.Builder.class) +public final class RetrieveBusinessesResponseSecondTierPartner { + private final String id; + + private final Optional name; + + private final RetrieveBusinessesResponseSecondTierPartnerProfilePicture profilePicture; + + private final String username; + + private final Map additionalProperties; + + private RetrieveBusinessesResponseSecondTierPartner( + String id, + Optional name, + RetrieveBusinessesResponseSecondTierPartnerProfilePicture profilePicture, + String username, + Map additionalProperties) { + this.id = id; + this.name = name; + this.profilePicture = profilePicture; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID, prefixed user_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's profile picture. + */ + @JsonProperty("profile_picture") + public RetrieveBusinessesResponseSecondTierPartnerProfilePicture getProfilePicture() { + return profilePicture; + } + + /** + * @return The user's unique username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveBusinessesResponseSecondTierPartner + && equalTo((RetrieveBusinessesResponseSecondTierPartner) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveBusinessesResponseSecondTierPartner other) { + return id.equals(other.id) + && name.equals(other.name) + && profilePicture.equals(other.profilePicture) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.profilePicture, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID, prefixed user_.

+ */ + ProfilePictureStage id(@NotNull String id); + + Builder from(RetrieveBusinessesResponseSecondTierPartner other); + } + + public interface ProfilePictureStage { + /** + *

The user's profile picture.

+ */ + UsernameStage profilePicture(@NotNull RetrieveBusinessesResponseSecondTierPartnerProfilePicture profilePicture); + } + + public interface UsernameStage { + /** + *

The user's unique username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + RetrieveBusinessesResponseSecondTierPartner build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ProfilePictureStage, UsernameStage, _FinalStage { + private String id; + + private RetrieveBusinessesResponseSecondTierPartnerProfilePicture profilePicture; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveBusinessesResponseSecondTierPartner other) { + id(other.getId()); + name(other.getName()); + profilePicture(other.getProfilePicture()); + username(other.getUsername()); + return this; + } + + /** + *

User ID, prefixed user_.

+ *

User ID, prefixed user_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ProfilePictureStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's profile picture.

+ *

The user's profile picture.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("profile_picture") + public UsernameStage profilePicture( + @NotNull RetrieveBusinessesResponseSecondTierPartnerProfilePicture profilePicture) { + this.profilePicture = Objects.requireNonNull(profilePicture, "profilePicture must not be null"); + return this; + } + + /** + *

The user's unique username.

+ *

The user's unique username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrieveBusinessesResponseSecondTierPartner build() { + return new RetrieveBusinessesResponseSecondTierPartner( + id, name, profilePicture, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseSecondTierPartnerProfilePicture.java b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseSecondTierPartnerProfilePicture.java new file mode 100644 index 00000000..d9bd4c9f --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseSecondTierPartnerProfilePicture.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveBusinessesResponseSecondTierPartnerProfilePicture.Builder.class) +public final class RetrieveBusinessesResponseSecondTierPartnerProfilePicture { + private final String url; + + private final Map additionalProperties; + + private RetrieveBusinessesResponseSecondTierPartnerProfilePicture( + String url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's profile picture URL. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveBusinessesResponseSecondTierPartnerProfilePicture + && equalTo((RetrieveBusinessesResponseSecondTierPartnerProfilePicture) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveBusinessesResponseSecondTierPartnerProfilePicture other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

The user's profile picture URL.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(RetrieveBusinessesResponseSecondTierPartnerProfilePicture other); + } + + public interface _FinalStage { + RetrieveBusinessesResponseSecondTierPartnerProfilePicture build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveBusinessesResponseSecondTierPartnerProfilePicture other) { + url(other.getUrl()); + return this; + } + + /** + *

The user's profile picture URL.

+ *

The user's profile picture URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public RetrieveBusinessesResponseSecondTierPartnerProfilePicture build() { + return new RetrieveBusinessesResponseSecondTierPartnerProfilePicture(url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseStatus.java b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseStatus.java new file mode 100644 index 00000000..ad7b48a1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseStatus.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveBusinessesResponseStatus { + public static final RetrieveBusinessesResponseStatus REMOVED = + new RetrieveBusinessesResponseStatus(Value.REMOVED, "removed"); + + public static final RetrieveBusinessesResponseStatus ACTIVE = + new RetrieveBusinessesResponseStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + RetrieveBusinessesResponseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveBusinessesResponseStatus + && this.string.equals(((RetrieveBusinessesResponseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REMOVED: + return visitor.visitRemoved(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveBusinessesResponseStatus valueOf(String value) { + switch (value) { + case "removed": + return REMOVED; + case "active": + return ACTIVE; + default: + return new RetrieveBusinessesResponseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + REMOVED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitRemoved(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseVolumeUsd.java b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseVolumeUsd.java new file mode 100644 index 00000000..47790c22 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/businesses/types/RetrieveBusinessesResponseVolumeUsd.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.businesses.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveBusinessesResponseVolumeUsd.Builder.class) +public final class RetrieveBusinessesResponseVolumeUsd { + private final String attributed; + + private final String awaitingSettlement; + + private final String settled; + + private final Map additionalProperties; + + private RetrieveBusinessesResponseVolumeUsd( + String attributed, String awaitingSettlement, String settled, Map additionalProperties) { + this.attributed = attributed; + this.awaitingSettlement = awaitingSettlement; + this.settled = settled; + this.additionalProperties = additionalProperties; + } + + /** + * @return Credited GMV (awaiting_settlement + settled); excludes canceled and reversed, in USD. + */ + @JsonProperty("attributed") + public String getAttributed() { + return attributed; + } + + /** + * @return GMV awaiting settlement (commission not yet computed), in USD. + */ + @JsonProperty("awaiting_settlement") + public String getAwaitingSettlement() { + return awaitingSettlement; + } + + /** + * @return GMV of pending + completed payments, in USD. + */ + @JsonProperty("settled") + public String getSettled() { + return settled; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveBusinessesResponseVolumeUsd + && equalTo((RetrieveBusinessesResponseVolumeUsd) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveBusinessesResponseVolumeUsd other) { + return attributed.equals(other.attributed) + && awaitingSettlement.equals(other.awaitingSettlement) + && settled.equals(other.settled); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.attributed, this.awaitingSettlement, this.settled); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AttributedStage builder() { + return new Builder(); + } + + public interface AttributedStage { + /** + *

Credited GMV (awaiting_settlement + settled); excludes canceled and reversed, in USD.

+ */ + AwaitingSettlementStage attributed(@NotNull String attributed); + + Builder from(RetrieveBusinessesResponseVolumeUsd other); + } + + public interface AwaitingSettlementStage { + /** + *

GMV awaiting settlement (commission not yet computed), in USD.

+ */ + SettledStage awaitingSettlement(@NotNull String awaitingSettlement); + } + + public interface SettledStage { + /** + *

GMV of pending + completed payments, in USD.

+ */ + _FinalStage settled(@NotNull String settled); + } + + public interface _FinalStage { + RetrieveBusinessesResponseVolumeUsd build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AttributedStage, AwaitingSettlementStage, SettledStage, _FinalStage { + private String attributed; + + private String awaitingSettlement; + + private String settled; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveBusinessesResponseVolumeUsd other) { + attributed(other.getAttributed()); + awaitingSettlement(other.getAwaitingSettlement()); + settled(other.getSettled()); + return this; + } + + /** + *

Credited GMV (awaiting_settlement + settled); excludes canceled and reversed, in USD.

+ *

Credited GMV (awaiting_settlement + settled); excludes canceled and reversed, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("attributed") + public AwaitingSettlementStage attributed(@NotNull String attributed) { + this.attributed = Objects.requireNonNull(attributed, "attributed must not be null"); + return this; + } + + /** + *

GMV awaiting settlement (commission not yet computed), in USD.

+ *

GMV awaiting settlement (commission not yet computed), in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("awaiting_settlement") + public SettledStage awaitingSettlement(@NotNull String awaitingSettlement) { + this.awaitingSettlement = Objects.requireNonNull(awaitingSettlement, "awaitingSettlement must not be null"); + return this; + } + + /** + *

GMV of pending + completed payments, in USD.

+ *

GMV of pending + completed payments, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("settled") + public _FinalStage settled(@NotNull String settled) { + this.settled = Objects.requireNonNull(settled, "settled must not be null"); + return this; + } + + @java.lang.Override + public RetrieveBusinessesResponseVolumeUsd build() { + return new RetrieveBusinessesResponseVolumeUsd( + attributed, awaitingSettlement, settled, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/requests/LeaderboardPartnersRequest.java b/src/main/java/com/whop/api/resources/partners/requests/LeaderboardPartnersRequest.java new file mode 100644 index 00000000..23283f8c --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/requests/LeaderboardPartnersRequest.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.partners.types.LeaderboardPartnersRequestPeriod; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeaderboardPartnersRequest.Builder.class) +public final class LeaderboardPartnersRequest { + private final Optional period; + + private final Map additionalProperties; + + private LeaderboardPartnersRequest( + Optional period, Map additionalProperties) { + this.period = period; + this.additionalProperties = additionalProperties; + } + + /** + * @return Time window for the rankings. day, month, and year count earnings since the start of the current calendar day, month, or year; last_30_days counts earnings over the trailing 30 days; all_time ranks lifetime earnings. + */ + @JsonProperty("period") + public Optional getPeriod() { + return period; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeaderboardPartnersRequest && equalTo((LeaderboardPartnersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeaderboardPartnersRequest other) { + return period.equals(other.period); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.period); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional period = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(LeaderboardPartnersRequest other) { + period(other.getPeriod()); + return this; + } + + /** + *

Time window for the rankings. day, month, and year count earnings since the start of the current calendar day, month, or year; last_30_days counts earnings over the trailing 30 days; all_time ranks lifetime earnings.

+ */ + @JsonSetter(value = "period", nulls = Nulls.SKIP) + public Builder period(Optional period) { + this.period = period; + return this; + } + + public Builder period(LeaderboardPartnersRequestPeriod period) { + this.period = Optional.ofNullable(period); + return this; + } + + public LeaderboardPartnersRequest build() { + return new LeaderboardPartnersRequest(period, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/requests/ReferredUsersPartnersRequest.java b/src/main/java/com/whop/api/resources/partners/requests/ReferredUsersPartnersRequest.java new file mode 100644 index 00000000..846c54c5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/requests/ReferredUsersPartnersRequest.java @@ -0,0 +1,265 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReferredUsersPartnersRequest.Builder.class) +public final class ReferredUsersPartnersRequest { + private final Optional hasBusinesses; + + private final Optional hasEarningBusinesses; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ReferredUsersPartnersRequest( + Optional hasBusinesses, + Optional hasEarningBusinesses, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.hasBusinesses = hasBusinesses; + this.hasEarningBusinesses = hasEarningBusinesses; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return When true, only referred users who brought at least one business onto Whop. + */ + @JsonProperty("has_businesses") + public Optional getHasBusinesses() { + return hasBusinesses; + } + + /** + * @return When true, only referred users with at least one business that has generated earnings. + */ + @JsonProperty("has_earning_businesses") + public Optional getHasEarningBusinesses() { + return hasEarningBusinesses; + } + + /** + * @return Number of referred users to return from the start of the window. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to fetch the page after (from page_info.end_cursor). + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return Number of referred users to return from the end of the window. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to fetch the page before (from page_info.start_cursor). + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReferredUsersPartnersRequest && equalTo((ReferredUsersPartnersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReferredUsersPartnersRequest other) { + return hasBusinesses.equals(other.hasBusinesses) + && hasEarningBusinesses.equals(other.hasEarningBusinesses) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.hasBusinesses, this.hasEarningBusinesses, this.first, this.after, this.last, this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional hasBusinesses = Optional.empty(); + + private Optional hasEarningBusinesses = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReferredUsersPartnersRequest other) { + hasBusinesses(other.getHasBusinesses()); + hasEarningBusinesses(other.getHasEarningBusinesses()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

When true, only referred users who brought at least one business onto Whop.

+ */ + @JsonSetter(value = "has_businesses", nulls = Nulls.SKIP) + public Builder hasBusinesses(Optional hasBusinesses) { + this.hasBusinesses = hasBusinesses; + return this; + } + + public Builder hasBusinesses(Boolean hasBusinesses) { + this.hasBusinesses = Optional.ofNullable(hasBusinesses); + return this; + } + + /** + *

When true, only referred users with at least one business that has generated earnings.

+ */ + @JsonSetter(value = "has_earning_businesses", nulls = Nulls.SKIP) + public Builder hasEarningBusinesses(Optional hasEarningBusinesses) { + this.hasEarningBusinesses = hasEarningBusinesses; + return this; + } + + public Builder hasEarningBusinesses(Boolean hasEarningBusinesses) { + this.hasEarningBusinesses = Optional.ofNullable(hasEarningBusinesses); + return this; + } + + /** + *

Number of referred users to return from the start of the window.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Number of referred users to return from the end of the window.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to fetch the page before (from page_info.start_cursor).

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ReferredUsersPartnersRequest build() { + return new ReferredUsersPartnersRequest( + hasBusinesses, hasEarningBusinesses, first, after, last, before, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/types/CreatePartnersResponse.java b/src/main/java/com/whop/api/resources/partners/types/CreatePartnersResponse.java new file mode 100644 index 00000000..79ddec84 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/types/CreatePartnersResponse.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePartnersResponse.Builder.class) +public final class CreatePartnersResponse { + private final String referralLink; + + private final OffsetDateTime whopPartnerEnabledAt; + + private final Map additionalProperties; + + private CreatePartnersResponse( + String referralLink, OffsetDateTime whopPartnerEnabledAt, Map additionalProperties) { + this.referralLink = referralLink; + this.whopPartnerEnabledAt = whopPartnerEnabledAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The caller's referral link — businesses that sign up through it are attributed to the caller. + */ + @JsonProperty("referral_link") + public String getReferralLink() { + return referralLink; + } + + /** + * @return When the caller became a Whop partner. + */ + @JsonProperty("whop_partner_enabled_at") + public OffsetDateTime getWhopPartnerEnabledAt() { + return whopPartnerEnabledAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePartnersResponse && equalTo((CreatePartnersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePartnersResponse other) { + return referralLink.equals(other.referralLink) && whopPartnerEnabledAt.equals(other.whopPartnerEnabledAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.referralLink, this.whopPartnerEnabledAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ReferralLinkStage builder() { + return new Builder(); + } + + public interface ReferralLinkStage { + /** + *

The caller's referral link — businesses that sign up through it are attributed to the caller.

+ */ + WhopPartnerEnabledAtStage referralLink(@NotNull String referralLink); + + Builder from(CreatePartnersResponse other); + } + + public interface WhopPartnerEnabledAtStage { + /** + *

When the caller became a Whop partner.

+ */ + _FinalStage whopPartnerEnabledAt(@NotNull OffsetDateTime whopPartnerEnabledAt); + } + + public interface _FinalStage { + CreatePartnersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ReferralLinkStage, WhopPartnerEnabledAtStage, _FinalStage { + private String referralLink; + + private OffsetDateTime whopPartnerEnabledAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePartnersResponse other) { + referralLink(other.getReferralLink()); + whopPartnerEnabledAt(other.getWhopPartnerEnabledAt()); + return this; + } + + /** + *

The caller's referral link — businesses that sign up through it are attributed to the caller.

+ *

The caller's referral link — businesses that sign up through it are attributed to the caller.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("referral_link") + public WhopPartnerEnabledAtStage referralLink(@NotNull String referralLink) { + this.referralLink = Objects.requireNonNull(referralLink, "referralLink must not be null"); + return this; + } + + /** + *

When the caller became a Whop partner.

+ *

When the caller became a Whop partner.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("whop_partner_enabled_at") + public _FinalStage whopPartnerEnabledAt(@NotNull OffsetDateTime whopPartnerEnabledAt) { + this.whopPartnerEnabledAt = + Objects.requireNonNull(whopPartnerEnabledAt, "whopPartnerEnabledAt must not be null"); + return this; + } + + @java.lang.Override + public CreatePartnersResponse build() { + return new CreatePartnersResponse(referralLink, whopPartnerEnabledAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersRequestPeriod.java b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersRequestPeriod.java new file mode 100644 index 00000000..e414a0e5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersRequestPeriod.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LeaderboardPartnersRequestPeriod { + public static final LeaderboardPartnersRequestPeriod MONTH = + new LeaderboardPartnersRequestPeriod(Value.MONTH, "month"); + + public static final LeaderboardPartnersRequestPeriod DAY = new LeaderboardPartnersRequestPeriod(Value.DAY, "day"); + + public static final LeaderboardPartnersRequestPeriod ALL_TIME = + new LeaderboardPartnersRequestPeriod(Value.ALL_TIME, "all_time"); + + public static final LeaderboardPartnersRequestPeriod LAST30DAYS = + new LeaderboardPartnersRequestPeriod(Value.LAST30DAYS, "last_30_days"); + + public static final LeaderboardPartnersRequestPeriod YEAR = + new LeaderboardPartnersRequestPeriod(Value.YEAR, "year"); + + private final Value value; + + private final String string; + + LeaderboardPartnersRequestPeriod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LeaderboardPartnersRequestPeriod + && this.string.equals(((LeaderboardPartnersRequestPeriod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MONTH: + return visitor.visitMonth(); + case DAY: + return visitor.visitDay(); + case ALL_TIME: + return visitor.visitAllTime(); + case LAST30DAYS: + return visitor.visitLast30Days(); + case YEAR: + return visitor.visitYear(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LeaderboardPartnersRequestPeriod valueOf(String value) { + switch (value) { + case "month": + return MONTH; + case "day": + return DAY; + case "all_time": + return ALL_TIME; + case "last_30_days": + return LAST30DAYS; + case "year": + return YEAR; + default: + return new LeaderboardPartnersRequestPeriod(Value.UNKNOWN, value); + } + } + + public enum Value { + DAY, + + MONTH, + + YEAR, + + LAST30DAYS, + + ALL_TIME, + + UNKNOWN + } + + public interface Visitor { + T visitDay(); + + T visitMonth(); + + T visitYear(); + + T visitLast30Days(); + + T visitAllTime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponse.java b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponse.java new file mode 100644 index 00000000..9c156280 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponse.java @@ -0,0 +1,177 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeaderboardPartnersResponse.Builder.class) +public final class LeaderboardPartnersResponse { + private final List leaders; + + private final Optional me; + + private final Map additionalProperties; + + private LeaderboardPartnersResponse( + List leaders, + Optional me, + Map additionalProperties) { + this.leaders = leaders; + this.me = me; + this.additionalProperties = additionalProperties; + } + + /** + * @return The top referrers by total earnings, best first. + */ + @JsonProperty("leaders") + public List getLeaders() { + return leaders; + } + + /** + * @return The caller's own standing; null when the caller has no referral earnings. + */ + @JsonIgnore + public Optional getMe() { + if (me == null) { + return Optional.empty(); + } + return me; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("me") + private Optional _getMe() { + return me; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeaderboardPartnersResponse && equalTo((LeaderboardPartnersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeaderboardPartnersResponse other) { + return leaders.equals(other.leaders) && me.equals(other.me); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.leaders, this.me); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List leaders = new ArrayList<>(); + + private Optional me = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(LeaderboardPartnersResponse other) { + leaders(other.getLeaders()); + me(other.getMe()); + return this; + } + + /** + *

The top referrers by total earnings, best first.

+ */ + @JsonSetter(value = "leaders", nulls = Nulls.SKIP) + public Builder leaders(List leaders) { + this.leaders.clear(); + if (leaders != null) { + this.leaders.addAll(leaders); + } + return this; + } + + public Builder addLeaders(LeaderboardPartnersResponseLeadersItem leaders) { + this.leaders.add(leaders); + return this; + } + + public Builder addAllLeaders(List leaders) { + if (leaders != null) { + this.leaders.addAll(leaders); + } + return this; + } + + /** + *

The caller's own standing; null when the caller has no referral earnings.

+ */ + @JsonSetter(value = "me", nulls = Nulls.SKIP) + public Builder me(Optional me) { + this.me = me; + return this; + } + + public Builder me(LeaderboardPartnersResponseMe me) { + this.me = Optional.ofNullable(me); + return this; + } + + public Builder me(Nullable me) { + if (me.isNull()) { + this.me = null; + } else if (me.isEmpty()) { + this.me = Optional.empty(); + } else { + this.me = Optional.of(me.get()); + } + return this; + } + + public LeaderboardPartnersResponse build() { + return new LeaderboardPartnersResponse(leaders, me, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseLeadersItem.java b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseLeadersItem.java new file mode 100644 index 00000000..b9c1031a --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseLeadersItem.java @@ -0,0 +1,317 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeaderboardPartnersResponseLeadersItem.Builder.class) +public final class LeaderboardPartnersResponseLeadersItem { + private final OffsetDateTime firstReferralStartedAt; + + private final int rank; + + private final String totalEarningsUsd; + + private final String totalVolumeUsd; + + private final Optional user; + + private final Map additionalProperties; + + private LeaderboardPartnersResponseLeadersItem( + OffsetDateTime firstReferralStartedAt, + int rank, + String totalEarningsUsd, + String totalVolumeUsd, + Optional user, + Map additionalProperties) { + this.firstReferralStartedAt = firstReferralStartedAt; + this.rank = rank; + this.totalEarningsUsd = totalEarningsUsd; + this.totalVolumeUsd = totalVolumeUsd; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the referrer's earliest partner business became active. + */ + @JsonProperty("first_referral_started_at") + public OffsetDateTime getFirstReferralStartedAt() { + return firstReferralStartedAt; + } + + /** + * @return 1-based leaderboard position. + */ + @JsonProperty("rank") + public int getRank() { + return rank; + } + + /** + * @return The referrer's pending + completed earnings across all referred businesses, in USD. + */ + @JsonProperty("total_earnings_usd") + public String getTotalEarningsUsd() { + return totalEarningsUsd; + } + + /** + * @return Credited GMV across all the referrer's referred businesses, in USD. + */ + @JsonProperty("total_volume_usd") + public String getTotalVolumeUsd() { + return totalVolumeUsd; + } + + /** + * @return The ranked referrer. Identity fields (id, name, username, profile_picture) are returned only on the caller's own entry; other referrers expose coarse location only. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeaderboardPartnersResponseLeadersItem + && equalTo((LeaderboardPartnersResponseLeadersItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeaderboardPartnersResponseLeadersItem other) { + return firstReferralStartedAt.equals(other.firstReferralStartedAt) + && rank == other.rank + && totalEarningsUsd.equals(other.totalEarningsUsd) + && totalVolumeUsd.equals(other.totalVolumeUsd) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.firstReferralStartedAt, this.rank, this.totalEarningsUsd, this.totalVolumeUsd, this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FirstReferralStartedAtStage builder() { + return new Builder(); + } + + public interface FirstReferralStartedAtStage { + /** + *

When the referrer's earliest partner business became active.

+ */ + RankStage firstReferralStartedAt(@NotNull OffsetDateTime firstReferralStartedAt); + + Builder from(LeaderboardPartnersResponseLeadersItem other); + } + + public interface RankStage { + /** + *

1-based leaderboard position.

+ */ + TotalEarningsUsdStage rank(int rank); + } + + public interface TotalEarningsUsdStage { + /** + *

The referrer's pending + completed earnings across all referred businesses, in USD.

+ */ + TotalVolumeUsdStage totalEarningsUsd(@NotNull String totalEarningsUsd); + } + + public interface TotalVolumeUsdStage { + /** + *

Credited GMV across all the referrer's referred businesses, in USD.

+ */ + _FinalStage totalVolumeUsd(@NotNull String totalVolumeUsd); + } + + public interface _FinalStage { + LeaderboardPartnersResponseLeadersItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The ranked referrer. Identity fields (id, name, username, profile_picture) are returned only on the caller's own entry; other referrers expose coarse location only.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(LeaderboardPartnersResponseLeadersItemUser user); + + _FinalStage user(Nullable user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements FirstReferralStartedAtStage, RankStage, TotalEarningsUsdStage, TotalVolumeUsdStage, _FinalStage { + private OffsetDateTime firstReferralStartedAt; + + private int rank; + + private String totalEarningsUsd; + + private String totalVolumeUsd; + + private Optional user = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LeaderboardPartnersResponseLeadersItem other) { + firstReferralStartedAt(other.getFirstReferralStartedAt()); + rank(other.getRank()); + totalEarningsUsd(other.getTotalEarningsUsd()); + totalVolumeUsd(other.getTotalVolumeUsd()); + user(other.getUser()); + return this; + } + + /** + *

When the referrer's earliest partner business became active.

+ *

When the referrer's earliest partner business became active.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("first_referral_started_at") + public RankStage firstReferralStartedAt(@NotNull OffsetDateTime firstReferralStartedAt) { + this.firstReferralStartedAt = + Objects.requireNonNull(firstReferralStartedAt, "firstReferralStartedAt must not be null"); + return this; + } + + /** + *

1-based leaderboard position.

+ *

1-based leaderboard position.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("rank") + public TotalEarningsUsdStage rank(int rank) { + this.rank = rank; + return this; + } + + /** + *

The referrer's pending + completed earnings across all referred businesses, in USD.

+ *

The referrer's pending + completed earnings across all referred businesses, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_earnings_usd") + public TotalVolumeUsdStage totalEarningsUsd(@NotNull String totalEarningsUsd) { + this.totalEarningsUsd = Objects.requireNonNull(totalEarningsUsd, "totalEarningsUsd must not be null"); + return this; + } + + /** + *

Credited GMV across all the referrer's referred businesses, in USD.

+ *

Credited GMV across all the referrer's referred businesses, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_volume_usd") + public _FinalStage totalVolumeUsd(@NotNull String totalVolumeUsd) { + this.totalVolumeUsd = Objects.requireNonNull(totalVolumeUsd, "totalVolumeUsd must not be null"); + return this; + } + + /** + *

The ranked referrer. Identity fields (id, name, username, profile_picture) are returned only on the caller's own entry; other referrers expose coarse location only.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The ranked referrer. Identity fields (id, name, username, profile_picture) are returned only on the caller's own entry; other referrers expose coarse location only.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(LeaderboardPartnersResponseLeadersItemUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The ranked referrer. Identity fields (id, name, username, profile_picture) are returned only on the caller's own entry; other referrers expose coarse location only.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + @java.lang.Override + public LeaderboardPartnersResponseLeadersItem build() { + return new LeaderboardPartnersResponseLeadersItem( + firstReferralStartedAt, rank, totalEarningsUsd, totalVolumeUsd, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseLeadersItemUser.java b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseLeadersItemUser.java new file mode 100644 index 00000000..8aed7424 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseLeadersItemUser.java @@ -0,0 +1,329 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeaderboardPartnersResponseLeadersItemUser.Builder.class) +public final class LeaderboardPartnersResponseLeadersItemUser { + private final Optional city; + + private final Optional country; + + private final Optional id; + + private final Optional name; + + private final Optional profilePicture; + + private final Optional username; + + private final Map additionalProperties; + + private LeaderboardPartnersResponseLeadersItemUser( + Optional city, + Optional country, + Optional id, + Optional name, + Optional profilePicture, + Optional username, + Map additionalProperties) { + this.city = city; + this.country = country; + this.id = id; + this.name = name; + this.profilePicture = profilePicture; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city where the referrer is located, derived from their IP address. Null if location sharing is disabled. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country where the referrer is located, derived from their IP address. Null if location sharing is disabled. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return User ID, prefixed user_. Present only on the caller's own entry. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The user's display name. Present only on the caller's own entry. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's profile picture. Present only on the caller's own entry. + */ + @JsonProperty("profile_picture") + public Optional getProfilePicture() { + return profilePicture; + } + + /** + * @return The user's unique username. Present only on the caller's own entry. + */ + @JsonProperty("username") + public Optional getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeaderboardPartnersResponseLeadersItemUser + && equalTo((LeaderboardPartnersResponseLeadersItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeaderboardPartnersResponseLeadersItemUser other) { + return city.equals(other.city) + && country.equals(other.country) + && id.equals(other.id) + && name.equals(other.name) + && profilePicture.equals(other.profilePicture) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.id, this.name, this.profilePicture, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional profilePicture = Optional.empty(); + + private Optional username = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(LeaderboardPartnersResponseLeadersItemUser other) { + city(other.getCity()); + country(other.getCountry()); + id(other.getId()); + name(other.getName()); + profilePicture(other.getProfilePicture()); + username(other.getUsername()); + return this; + } + + /** + *

The city where the referrer is located, derived from their IP address. Null if location sharing is disabled.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country where the referrer is located, derived from their IP address. Null if location sharing is disabled.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

User ID, prefixed user_. Present only on the caller's own entry.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The user's display name. Present only on the caller's own entry.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's profile picture. Present only on the caller's own entry.

+ */ + @JsonSetter(value = "profile_picture", nulls = Nulls.SKIP) + public Builder profilePicture( + Optional profilePicture) { + this.profilePicture = profilePicture; + return this; + } + + public Builder profilePicture(LeaderboardPartnersResponseLeadersItemUserProfilePicture profilePicture) { + this.profilePicture = Optional.ofNullable(profilePicture); + return this; + } + + /** + *

The user's unique username. Present only on the caller's own entry.

+ */ + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public Builder username(Optional username) { + this.username = username; + return this; + } + + public Builder username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + public LeaderboardPartnersResponseLeadersItemUser build() { + return new LeaderboardPartnersResponseLeadersItemUser( + city, country, id, name, profilePicture, username, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseLeadersItemUserProfilePicture.java b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseLeadersItemUserProfilePicture.java new file mode 100644 index 00000000..cfdfe4e5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseLeadersItemUserProfilePicture.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeaderboardPartnersResponseLeadersItemUserProfilePicture.Builder.class) +public final class LeaderboardPartnersResponseLeadersItemUserProfilePicture { + private final String url; + + private final Map additionalProperties; + + private LeaderboardPartnersResponseLeadersItemUserProfilePicture( + String url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's profile picture URL. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeaderboardPartnersResponseLeadersItemUserProfilePicture + && equalTo((LeaderboardPartnersResponseLeadersItemUserProfilePicture) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeaderboardPartnersResponseLeadersItemUserProfilePicture other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

The user's profile picture URL.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(LeaderboardPartnersResponseLeadersItemUserProfilePicture other); + } + + public interface _FinalStage { + LeaderboardPartnersResponseLeadersItemUserProfilePicture build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LeaderboardPartnersResponseLeadersItemUserProfilePicture other) { + url(other.getUrl()); + return this; + } + + /** + *

The user's profile picture URL.

+ *

The user's profile picture URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public LeaderboardPartnersResponseLeadersItemUserProfilePicture build() { + return new LeaderboardPartnersResponseLeadersItemUserProfilePicture(url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseMe.java b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseMe.java new file mode 100644 index 00000000..01e89dab --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseMe.java @@ -0,0 +1,316 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeaderboardPartnersResponseMe.Builder.class) +public final class LeaderboardPartnersResponseMe { + private final OffsetDateTime firstReferralStartedAt; + + private final int rank; + + private final String totalEarningsUsd; + + private final String totalVolumeUsd; + + private final Optional user; + + private final Map additionalProperties; + + private LeaderboardPartnersResponseMe( + OffsetDateTime firstReferralStartedAt, + int rank, + String totalEarningsUsd, + String totalVolumeUsd, + Optional user, + Map additionalProperties) { + this.firstReferralStartedAt = firstReferralStartedAt; + this.rank = rank; + this.totalEarningsUsd = totalEarningsUsd; + this.totalVolumeUsd = totalVolumeUsd; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the referrer's earliest partner business became active. + */ + @JsonProperty("first_referral_started_at") + public OffsetDateTime getFirstReferralStartedAt() { + return firstReferralStartedAt; + } + + /** + * @return 1-based leaderboard position. + */ + @JsonProperty("rank") + public int getRank() { + return rank; + } + + /** + * @return The referrer's pending + completed earnings across all referred businesses, in USD. + */ + @JsonProperty("total_earnings_usd") + public String getTotalEarningsUsd() { + return totalEarningsUsd; + } + + /** + * @return Credited GMV across all the referrer's referred businesses, in USD. + */ + @JsonProperty("total_volume_usd") + public String getTotalVolumeUsd() { + return totalVolumeUsd; + } + + /** + * @return The ranked referrer. Identity fields (id, name, username, profile_picture) are returned only on the caller's own entry; other referrers expose coarse location only. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeaderboardPartnersResponseMe && equalTo((LeaderboardPartnersResponseMe) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeaderboardPartnersResponseMe other) { + return firstReferralStartedAt.equals(other.firstReferralStartedAt) + && rank == other.rank + && totalEarningsUsd.equals(other.totalEarningsUsd) + && totalVolumeUsd.equals(other.totalVolumeUsd) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.firstReferralStartedAt, this.rank, this.totalEarningsUsd, this.totalVolumeUsd, this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FirstReferralStartedAtStage builder() { + return new Builder(); + } + + public interface FirstReferralStartedAtStage { + /** + *

When the referrer's earliest partner business became active.

+ */ + RankStage firstReferralStartedAt(@NotNull OffsetDateTime firstReferralStartedAt); + + Builder from(LeaderboardPartnersResponseMe other); + } + + public interface RankStage { + /** + *

1-based leaderboard position.

+ */ + TotalEarningsUsdStage rank(int rank); + } + + public interface TotalEarningsUsdStage { + /** + *

The referrer's pending + completed earnings across all referred businesses, in USD.

+ */ + TotalVolumeUsdStage totalEarningsUsd(@NotNull String totalEarningsUsd); + } + + public interface TotalVolumeUsdStage { + /** + *

Credited GMV across all the referrer's referred businesses, in USD.

+ */ + _FinalStage totalVolumeUsd(@NotNull String totalVolumeUsd); + } + + public interface _FinalStage { + LeaderboardPartnersResponseMe build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The ranked referrer. Identity fields (id, name, username, profile_picture) are returned only on the caller's own entry; other referrers expose coarse location only.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(LeaderboardPartnersResponseMeUser user); + + _FinalStage user(Nullable user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements FirstReferralStartedAtStage, RankStage, TotalEarningsUsdStage, TotalVolumeUsdStage, _FinalStage { + private OffsetDateTime firstReferralStartedAt; + + private int rank; + + private String totalEarningsUsd; + + private String totalVolumeUsd; + + private Optional user = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LeaderboardPartnersResponseMe other) { + firstReferralStartedAt(other.getFirstReferralStartedAt()); + rank(other.getRank()); + totalEarningsUsd(other.getTotalEarningsUsd()); + totalVolumeUsd(other.getTotalVolumeUsd()); + user(other.getUser()); + return this; + } + + /** + *

When the referrer's earliest partner business became active.

+ *

When the referrer's earliest partner business became active.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("first_referral_started_at") + public RankStage firstReferralStartedAt(@NotNull OffsetDateTime firstReferralStartedAt) { + this.firstReferralStartedAt = + Objects.requireNonNull(firstReferralStartedAt, "firstReferralStartedAt must not be null"); + return this; + } + + /** + *

1-based leaderboard position.

+ *

1-based leaderboard position.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("rank") + public TotalEarningsUsdStage rank(int rank) { + this.rank = rank; + return this; + } + + /** + *

The referrer's pending + completed earnings across all referred businesses, in USD.

+ *

The referrer's pending + completed earnings across all referred businesses, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_earnings_usd") + public TotalVolumeUsdStage totalEarningsUsd(@NotNull String totalEarningsUsd) { + this.totalEarningsUsd = Objects.requireNonNull(totalEarningsUsd, "totalEarningsUsd must not be null"); + return this; + } + + /** + *

Credited GMV across all the referrer's referred businesses, in USD.

+ *

Credited GMV across all the referrer's referred businesses, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_volume_usd") + public _FinalStage totalVolumeUsd(@NotNull String totalVolumeUsd) { + this.totalVolumeUsd = Objects.requireNonNull(totalVolumeUsd, "totalVolumeUsd must not be null"); + return this; + } + + /** + *

The ranked referrer. Identity fields (id, name, username, profile_picture) are returned only on the caller's own entry; other referrers expose coarse location only.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The ranked referrer. Identity fields (id, name, username, profile_picture) are returned only on the caller's own entry; other referrers expose coarse location only.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(LeaderboardPartnersResponseMeUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The ranked referrer. Identity fields (id, name, username, profile_picture) are returned only on the caller's own entry; other referrers expose coarse location only.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + @java.lang.Override + public LeaderboardPartnersResponseMe build() { + return new LeaderboardPartnersResponseMe( + firstReferralStartedAt, rank, totalEarningsUsd, totalVolumeUsd, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseMeUser.java b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseMeUser.java new file mode 100644 index 00000000..fd07aa10 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseMeUser.java @@ -0,0 +1,327 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeaderboardPartnersResponseMeUser.Builder.class) +public final class LeaderboardPartnersResponseMeUser { + private final Optional city; + + private final Optional country; + + private final Optional id; + + private final Optional name; + + private final Optional profilePicture; + + private final Optional username; + + private final Map additionalProperties; + + private LeaderboardPartnersResponseMeUser( + Optional city, + Optional country, + Optional id, + Optional name, + Optional profilePicture, + Optional username, + Map additionalProperties) { + this.city = city; + this.country = country; + this.id = id; + this.name = name; + this.profilePicture = profilePicture; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city where the referrer is located, derived from their IP address. Null if location sharing is disabled. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country where the referrer is located, derived from their IP address. Null if location sharing is disabled. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return User ID, prefixed user_. Present only on the caller's own entry. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The user's display name. Present only on the caller's own entry. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's profile picture. Present only on the caller's own entry. + */ + @JsonProperty("profile_picture") + public Optional getProfilePicture() { + return profilePicture; + } + + /** + * @return The user's unique username. Present only on the caller's own entry. + */ + @JsonProperty("username") + public Optional getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeaderboardPartnersResponseMeUser && equalTo((LeaderboardPartnersResponseMeUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeaderboardPartnersResponseMeUser other) { + return city.equals(other.city) + && country.equals(other.country) + && id.equals(other.id) + && name.equals(other.name) + && profilePicture.equals(other.profilePicture) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.id, this.name, this.profilePicture, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional profilePicture = Optional.empty(); + + private Optional username = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(LeaderboardPartnersResponseMeUser other) { + city(other.getCity()); + country(other.getCountry()); + id(other.getId()); + name(other.getName()); + profilePicture(other.getProfilePicture()); + username(other.getUsername()); + return this; + } + + /** + *

The city where the referrer is located, derived from their IP address. Null if location sharing is disabled.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country where the referrer is located, derived from their IP address. Null if location sharing is disabled.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

User ID, prefixed user_. Present only on the caller's own entry.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The user's display name. Present only on the caller's own entry.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's profile picture. Present only on the caller's own entry.

+ */ + @JsonSetter(value = "profile_picture", nulls = Nulls.SKIP) + public Builder profilePicture(Optional profilePicture) { + this.profilePicture = profilePicture; + return this; + } + + public Builder profilePicture(LeaderboardPartnersResponseMeUserProfilePicture profilePicture) { + this.profilePicture = Optional.ofNullable(profilePicture); + return this; + } + + /** + *

The user's unique username. Present only on the caller's own entry.

+ */ + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public Builder username(Optional username) { + this.username = username; + return this; + } + + public Builder username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + public LeaderboardPartnersResponseMeUser build() { + return new LeaderboardPartnersResponseMeUser( + city, country, id, name, profilePicture, username, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseMeUserProfilePicture.java b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseMeUserProfilePicture.java new file mode 100644 index 00000000..693b1447 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/types/LeaderboardPartnersResponseMeUserProfilePicture.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeaderboardPartnersResponseMeUserProfilePicture.Builder.class) +public final class LeaderboardPartnersResponseMeUserProfilePicture { + private final String url; + + private final Map additionalProperties; + + private LeaderboardPartnersResponseMeUserProfilePicture(String url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's profile picture URL. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeaderboardPartnersResponseMeUserProfilePicture + && equalTo((LeaderboardPartnersResponseMeUserProfilePicture) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeaderboardPartnersResponseMeUserProfilePicture other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

The user's profile picture URL.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(LeaderboardPartnersResponseMeUserProfilePicture other); + } + + public interface _FinalStage { + LeaderboardPartnersResponseMeUserProfilePicture build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LeaderboardPartnersResponseMeUserProfilePicture other) { + url(other.getUrl()); + return this; + } + + /** + *

The user's profile picture URL.

+ *

The user's profile picture URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public LeaderboardPartnersResponseMeUserProfilePicture build() { + return new LeaderboardPartnersResponseMeUserProfilePicture(url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/types/ReferredUsersPartnersResponse.java b/src/main/java/com/whop/api/resources/partners/types/ReferredUsersPartnersResponse.java new file mode 100644 index 00000000..76e8ab9e --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/types/ReferredUsersPartnersResponse.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReferredUsersPartnersResponse.Builder.class) +public final class ReferredUsersPartnersResponse { + private final List data; + + private final ReferredUsersPartnersResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ReferredUsersPartnersResponse( + List data, + ReferredUsersPartnersResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ReferredUsersPartnersResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReferredUsersPartnersResponse && equalTo((ReferredUsersPartnersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReferredUsersPartnersResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ReferredUsersPartnersResponsePageInfo pageInfo); + + Builder from(ReferredUsersPartnersResponse other); + } + + public interface _FinalStage { + ReferredUsersPartnersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ReferredUsersPartnersResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ReferredUsersPartnersResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReferredUsersPartnersResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ReferredUsersPartnersResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ReferredUsersPartnersResponseDataItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ReferredUsersPartnersResponse build() { + return new ReferredUsersPartnersResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/types/ReferredUsersPartnersResponseDataItem.java b/src/main/java/com/whop/api/resources/partners/types/ReferredUsersPartnersResponseDataItem.java new file mode 100644 index 00000000..05309b4a --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/types/ReferredUsersPartnersResponseDataItem.java @@ -0,0 +1,170 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReferredUsersPartnersResponseDataItem.Builder.class) +public final class ReferredUsersPartnersResponseDataItem { + private final String totalEarningsUsd; + + private final String totalVolumeUsd; + + private final ReferredUsersPartnersResponseDataItemUser user; + + private final Map additionalProperties; + + private ReferredUsersPartnersResponseDataItem( + String totalEarningsUsd, + String totalVolumeUsd, + ReferredUsersPartnersResponseDataItemUser user, + Map additionalProperties) { + this.totalEarningsUsd = totalEarningsUsd; + this.totalVolumeUsd = totalVolumeUsd; + this.user = user; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("total_earnings_usd") + public String getTotalEarningsUsd() { + return totalEarningsUsd; + } + + @JsonProperty("total_volume_usd") + public String getTotalVolumeUsd() { + return totalVolumeUsd; + } + + @JsonProperty("user") + public ReferredUsersPartnersResponseDataItemUser getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReferredUsersPartnersResponseDataItem + && equalTo((ReferredUsersPartnersResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReferredUsersPartnersResponseDataItem other) { + return totalEarningsUsd.equals(other.totalEarningsUsd) + && totalVolumeUsd.equals(other.totalVolumeUsd) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.totalEarningsUsd, this.totalVolumeUsd, this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TotalEarningsUsdStage builder() { + return new Builder(); + } + + public interface TotalEarningsUsdStage { + TotalVolumeUsdStage totalEarningsUsd(@NotNull String totalEarningsUsd); + + Builder from(ReferredUsersPartnersResponseDataItem other); + } + + public interface TotalVolumeUsdStage { + UserStage totalVolumeUsd(@NotNull String totalVolumeUsd); + } + + public interface UserStage { + _FinalStage user(@NotNull ReferredUsersPartnersResponseDataItemUser user); + } + + public interface _FinalStage { + ReferredUsersPartnersResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TotalEarningsUsdStage, TotalVolumeUsdStage, UserStage, _FinalStage { + private String totalEarningsUsd; + + private String totalVolumeUsd; + + private ReferredUsersPartnersResponseDataItemUser user; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReferredUsersPartnersResponseDataItem other) { + totalEarningsUsd(other.getTotalEarningsUsd()); + totalVolumeUsd(other.getTotalVolumeUsd()); + user(other.getUser()); + return this; + } + + @java.lang.Override + @JsonSetter("total_earnings_usd") + public TotalVolumeUsdStage totalEarningsUsd(@NotNull String totalEarningsUsd) { + this.totalEarningsUsd = Objects.requireNonNull(totalEarningsUsd, "totalEarningsUsd must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("total_volume_usd") + public UserStage totalVolumeUsd(@NotNull String totalVolumeUsd) { + this.totalVolumeUsd = Objects.requireNonNull(totalVolumeUsd, "totalVolumeUsd must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull ReferredUsersPartnersResponseDataItemUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + @java.lang.Override + public ReferredUsersPartnersResponseDataItem build() { + return new ReferredUsersPartnersResponseDataItem( + totalEarningsUsd, totalVolumeUsd, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/types/ReferredUsersPartnersResponseDataItemUser.java b/src/main/java/com/whop/api/resources/partners/types/ReferredUsersPartnersResponseDataItemUser.java new file mode 100644 index 00000000..bb468c89 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/types/ReferredUsersPartnersResponseDataItemUser.java @@ -0,0 +1,341 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReferredUsersPartnersResponseDataItemUser.Builder.class) +public final class ReferredUsersPartnersResponseDataItemUser { + private final Optional city; + + private final Optional country; + + private final String id; + + private final Optional name; + + private final Optional profilePicture; + + private final String username; + + private final Map additionalProperties; + + private ReferredUsersPartnersResponseDataItemUser( + Optional city, + Optional country, + String id, + Optional name, + Optional profilePicture, + String username, + Map additionalProperties) { + this.city = city; + this.country = country; + this.id = id; + this.name = name; + this.profilePicture = profilePicture; + this.username = username; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("profile_picture") + public Optional getProfilePicture() { + return profilePicture; + } + + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReferredUsersPartnersResponseDataItemUser + && equalTo((ReferredUsersPartnersResponseDataItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReferredUsersPartnersResponseDataItemUser other) { + return city.equals(other.city) + && country.equals(other.country) + && id.equals(other.id) + && name.equals(other.name) + && profilePicture.equals(other.profilePicture) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.id, this.name, this.profilePicture, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + UsernameStage id(@NotNull String id); + + Builder from(ReferredUsersPartnersResponseDataItemUser other); + } + + public interface UsernameStage { + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + ReferredUsersPartnersResponseDataItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage city(Optional city); + + _FinalStage city(String city); + + _FinalStage city(Nullable city); + + _FinalStage country(Optional country); + + _FinalStage country(String country); + + _FinalStage country(Nullable country); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage profilePicture(Optional profilePicture); + + _FinalStage profilePicture(ReferredUsersPartnersResponseDataItemUserProfilePicture profilePicture); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional profilePicture = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional city = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReferredUsersPartnersResponseDataItemUser other) { + city(other.getCity()); + country(other.getCountry()); + id(other.getId()); + name(other.getName()); + profilePicture(other.getProfilePicture()); + username(other.getUsername()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage profilePicture(ReferredUsersPartnersResponseDataItemUserProfilePicture profilePicture) { + this.profilePicture = Optional.ofNullable(profilePicture); + return this; + } + + @java.lang.Override + @JsonSetter(value = "profile_picture", nulls = Nulls.SKIP) + public _FinalStage profilePicture( + Optional profilePicture) { + this.profilePicture = profilePicture; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public _FinalStage country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + @java.lang.Override + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public _FinalStage country(Optional country) { + this.country = country; + return this; + } + + @java.lang.Override + public _FinalStage city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + @java.lang.Override + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public _FinalStage city(Optional city) { + this.city = city; + return this; + } + + @java.lang.Override + public ReferredUsersPartnersResponseDataItemUser build() { + return new ReferredUsersPartnersResponseDataItemUser( + city, country, id, name, profilePicture, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/types/ReferredUsersPartnersResponseDataItemUserProfilePicture.java b/src/main/java/com/whop/api/resources/partners/types/ReferredUsersPartnersResponseDataItemUserProfilePicture.java new file mode 100644 index 00000000..94584124 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/types/ReferredUsersPartnersResponseDataItemUserProfilePicture.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReferredUsersPartnersResponseDataItemUserProfilePicture.Builder.class) +public final class ReferredUsersPartnersResponseDataItemUserProfilePicture { + private final Optional url; + + private final Map additionalProperties; + + private ReferredUsersPartnersResponseDataItemUserProfilePicture( + Optional url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReferredUsersPartnersResponseDataItemUserProfilePicture + && equalTo((ReferredUsersPartnersResponseDataItemUserProfilePicture) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReferredUsersPartnersResponseDataItemUserProfilePicture other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReferredUsersPartnersResponseDataItemUserProfilePicture other) { + url(other.getUrl()); + return this; + } + + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public Builder url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + public ReferredUsersPartnersResponseDataItemUserProfilePicture build() { + return new ReferredUsersPartnersResponseDataItemUserProfilePicture(url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/partners/types/ReferredUsersPartnersResponsePageInfo.java b/src/main/java/com/whop/api/resources/partners/types/ReferredUsersPartnersResponsePageInfo.java new file mode 100644 index 00000000..f4c27922 --- /dev/null +++ b/src/main/java/com/whop/api/resources/partners/types/ReferredUsersPartnersResponsePageInfo.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.partners.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReferredUsersPartnersResponsePageInfo.Builder.class) +public final class ReferredUsersPartnersResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ReferredUsersPartnersResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReferredUsersPartnersResponsePageInfo + && equalTo((ReferredUsersPartnersResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReferredUsersPartnersResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ReferredUsersPartnersResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ReferredUsersPartnersResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReferredUsersPartnersResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ReferredUsersPartnersResponsePageInfo build() { + return new ReferredUsersPartnersResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/AsyncPaymentMethodDomainsClient.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/AsyncPaymentMethodDomainsClient.java new file mode 100644 index 00000000..e34c4303 --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/AsyncPaymentMethodDomainsClient.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.paymentmethoddomains.requests.CreatePaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.DeletePaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.ListPaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.RetrievePaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.VerifyPaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.types.DeletePaymentMethodDomainsResponse; +import com.whop.api.types.PaymentMethodDomain; +import java.util.concurrent.CompletableFuture; + +public class AsyncPaymentMethodDomainsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPaymentMethodDomainsClient rawClient; + + public AsyncPaymentMethodDomainsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPaymentMethodDomainsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPaymentMethodDomainsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public CompletableFuture> list(ListPaymentMethodDomainsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public CompletableFuture> list( + ListPaymentMethodDomainsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Registers a hostname with the wallet provider and attempts verification inline. Returns verified when the provider fetched the domain-association file (for Apple Pay, /.well-known/apple-developer-merchantid-domain-association), or pending when it could not — host the file, then retry with the verify endpoint. + */ + public CompletableFuture create(CreatePaymentMethodDomainsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Registers a hostname with the wallet provider and attempts verification inline. Returns verified when the provider fetched the domain-association file (for Apple Pay, /.well-known/apple-developer-merchantid-domain-association), or pending when it could not — host the file, then retry with the verify endpoint. + */ + public CompletableFuture create( + CreatePaymentMethodDomainsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public CompletableFuture retrieve(String id, RetrievePaymentMethodDomainsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public CompletableFuture retrieve( + String id, RetrievePaymentMethodDomainsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public CompletableFuture delete( + String id, DeletePaymentMethodDomainsRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public CompletableFuture delete( + String id, DeletePaymentMethodDomainsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public CompletableFuture verify(String id) { + return this.rawClient.verify(id).thenApply(response -> response.body()); + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public CompletableFuture verify(String id, RequestOptions requestOptions) { + return this.rawClient.verify(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public CompletableFuture verify(String id, VerifyPaymentMethodDomainsRequest request) { + return this.rawClient.verify(id, request).thenApply(response -> response.body()); + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public CompletableFuture verify( + String id, VerifyPaymentMethodDomainsRequest request, RequestOptions requestOptions) { + return this.rawClient.verify(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/AsyncRawPaymentMethodDomainsClient.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/AsyncRawPaymentMethodDomainsClient.java new file mode 100644 index 00000000..437f28ba --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/AsyncRawPaymentMethodDomainsClient.java @@ -0,0 +1,622 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.paymentmethoddomains.requests.CreatePaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.DeletePaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.ListPaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.RetrievePaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.VerifyPaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.types.DeletePaymentMethodDomainsResponse; +import com.whop.api.resources.paymentmethoddomains.types.ListPaymentMethodDomainsResponse; +import com.whop.api.types.PaymentMethodDomain; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPaymentMethodDomainsClient { + protected final ClientOptions clientOptions; + + public AsyncRawPaymentMethodDomainsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public CompletableFuture>> list() { + return list(ListPaymentMethodDomainsRequest.builder().build()); + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListPaymentMethodDomainsRequest.builder().build(), requestOptions); + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public CompletableFuture>> list( + ListPaymentMethodDomainsRequest request) { + return list(request, null); + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public CompletableFuture>> list( + ListPaymentMethodDomainsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_method_domains"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getHostname().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "hostname", request.getHostname().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getProvider().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "provider", request.getProvider().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPaymentMethodDomainsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListPaymentMethodDomainsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListPaymentMethodDomainsRequest nextRequest = ListPaymentMethodDomainsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Registers a hostname with the wallet provider and attempts verification inline. Returns verified when the provider fetched the domain-association file (for Apple Pay, /.well-known/apple-developer-merchantid-domain-association), or pending when it could not — host the file, then retry with the verify endpoint. + */ + public CompletableFuture> create( + CreatePaymentMethodDomainsRequest request) { + return create(request, null); + } + + /** + * Registers a hostname with the wallet provider and attempts verification inline. Returns verified when the provider fetched the domain-association file (for Apple Pay, /.well-known/apple-developer-merchantid-domain-association), or pending when it could not — host the file, then retry with the verify endpoint. + */ + public CompletableFuture> create( + CreatePaymentMethodDomainsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_method_domains"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaymentMethodDomain.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrievePaymentMethodDomainsRequest.builder().build()); + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePaymentMethodDomainsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public CompletableFuture> retrieve( + String id, RetrievePaymentMethodDomainsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public CompletableFuture> retrieve( + String id, RetrievePaymentMethodDomainsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_method_domains") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaymentMethodDomain.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public CompletableFuture> delete(String id) { + return delete(id, DeletePaymentMethodDomainsRequest.builder().build()); + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public CompletableFuture> delete( + String id, RequestOptions requestOptions) { + return delete(id, DeletePaymentMethodDomainsRequest.builder().build(), requestOptions); + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public CompletableFuture> delete( + String id, DeletePaymentMethodDomainsRequest request) { + return delete(id, request, null); + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public CompletableFuture> delete( + String id, DeletePaymentMethodDomainsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_method_domains") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DeletePaymentMethodDomainsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public CompletableFuture> verify(String id) { + return verify(id, VerifyPaymentMethodDomainsRequest.builder().build()); + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public CompletableFuture> verify( + String id, RequestOptions requestOptions) { + return verify(id, VerifyPaymentMethodDomainsRequest.builder().build(), requestOptions); + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public CompletableFuture> verify( + String id, VerifyPaymentMethodDomainsRequest request) { + return verify(id, request, null); + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public CompletableFuture> verify( + String id, VerifyPaymentMethodDomainsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_method_domains") + .addPathSegment(id) + .addPathSegments("verify"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaymentMethodDomain.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/PaymentMethodDomainsClient.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/PaymentMethodDomainsClient.java new file mode 100644 index 00000000..05713168 --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/PaymentMethodDomainsClient.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.paymentmethoddomains.requests.CreatePaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.DeletePaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.ListPaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.RetrievePaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.VerifyPaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.types.DeletePaymentMethodDomainsResponse; +import com.whop.api.types.PaymentMethodDomain; + +public class PaymentMethodDomainsClient { + protected final ClientOptions clientOptions; + + private final RawPaymentMethodDomainsClient rawClient; + + public PaymentMethodDomainsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPaymentMethodDomainsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPaymentMethodDomainsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public SyncPagingIterable list(ListPaymentMethodDomainsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public SyncPagingIterable list( + ListPaymentMethodDomainsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Registers a hostname with the wallet provider and attempts verification inline. Returns verified when the provider fetched the domain-association file (for Apple Pay, /.well-known/apple-developer-merchantid-domain-association), or pending when it could not — host the file, then retry with the verify endpoint. + */ + public PaymentMethodDomain create(CreatePaymentMethodDomainsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Registers a hostname with the wallet provider and attempts verification inline. Returns verified when the provider fetched the domain-association file (for Apple Pay, /.well-known/apple-developer-merchantid-domain-association), or pending when it could not — host the file, then retry with the verify endpoint. + */ + public PaymentMethodDomain create(CreatePaymentMethodDomainsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public PaymentMethodDomain retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public PaymentMethodDomain retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public PaymentMethodDomain retrieve(String id, RetrievePaymentMethodDomainsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public PaymentMethodDomain retrieve( + String id, RetrievePaymentMethodDomainsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public DeletePaymentMethodDomainsResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public DeletePaymentMethodDomainsResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public DeletePaymentMethodDomainsResponse delete(String id, DeletePaymentMethodDomainsRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public DeletePaymentMethodDomainsResponse delete( + String id, DeletePaymentMethodDomainsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public PaymentMethodDomain verify(String id) { + return this.rawClient.verify(id).body(); + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public PaymentMethodDomain verify(String id, RequestOptions requestOptions) { + return this.rawClient.verify(id, requestOptions).body(); + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public PaymentMethodDomain verify(String id, VerifyPaymentMethodDomainsRequest request) { + return this.rawClient.verify(id, request).body(); + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public PaymentMethodDomain verify( + String id, VerifyPaymentMethodDomainsRequest request, RequestOptions requestOptions) { + return this.rawClient.verify(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/RawPaymentMethodDomainsClient.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/RawPaymentMethodDomainsClient.java new file mode 100644 index 00000000..a17b78cc --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/RawPaymentMethodDomainsClient.java @@ -0,0 +1,494 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.paymentmethoddomains.requests.CreatePaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.DeletePaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.ListPaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.RetrievePaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.requests.VerifyPaymentMethodDomainsRequest; +import com.whop.api.resources.paymentmethoddomains.types.DeletePaymentMethodDomainsResponse; +import com.whop.api.resources.paymentmethoddomains.types.ListPaymentMethodDomainsResponse; +import com.whop.api.types.PaymentMethodDomain; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPaymentMethodDomainsClient { + protected final ClientOptions clientOptions; + + public RawPaymentMethodDomainsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public WhopApiHttpResponse> list() { + return list(ListPaymentMethodDomainsRequest.builder().build()); + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListPaymentMethodDomainsRequest.builder().build(), requestOptions); + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public WhopApiHttpResponse> list(ListPaymentMethodDomainsRequest request) { + return list(request, null); + } + + /** + * Lists payment method domains. Without account_id, returns the caller's own domains and those of every connected account. + */ + public WhopApiHttpResponse> list( + ListPaymentMethodDomainsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_method_domains"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getHostname().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "hostname", request.getHostname().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getProvider().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "provider", request.getProvider().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPaymentMethodDomainsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPaymentMethodDomainsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListPaymentMethodDomainsRequest nextRequest = ListPaymentMethodDomainsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Registers a hostname with the wallet provider and attempts verification inline. Returns verified when the provider fetched the domain-association file (for Apple Pay, /.well-known/apple-developer-merchantid-domain-association), or pending when it could not — host the file, then retry with the verify endpoint. + */ + public WhopApiHttpResponse create(CreatePaymentMethodDomainsRequest request) { + return create(request, null); + } + + /** + * Registers a hostname with the wallet provider and attempts verification inline. Returns verified when the provider fetched the domain-association file (for Apple Pay, /.well-known/apple-developer-merchantid-domain-association), or pending when it could not — host the file, then retry with the verify endpoint. + */ + public WhopApiHttpResponse create( + CreatePaymentMethodDomainsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_method_domains"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaymentMethodDomain.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrievePaymentMethodDomainsRequest.builder().build()); + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePaymentMethodDomainsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public WhopApiHttpResponse retrieve(String id, RetrievePaymentMethodDomainsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a payment method domain to check its verification status. + */ + public WhopApiHttpResponse retrieve( + String id, RetrievePaymentMethodDomainsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_method_domains") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaymentMethodDomain.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeletePaymentMethodDomainsRequest.builder().build()); + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeletePaymentMethodDomainsRequest.builder().build(), requestOptions); + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public WhopApiHttpResponse delete( + String id, DeletePaymentMethodDomainsRequest request) { + return delete(id, request, null); + } + + /** + * Unregisters a payment method domain so its wallet payment methods stop rendering there. + */ + public WhopApiHttpResponse delete( + String id, DeletePaymentMethodDomainsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_method_domains") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DeletePaymentMethodDomainsResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public WhopApiHttpResponse verify(String id) { + return verify(id, VerifyPaymentMethodDomainsRequest.builder().build()); + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public WhopApiHttpResponse verify(String id, RequestOptions requestOptions) { + return verify(id, VerifyPaymentMethodDomainsRequest.builder().build(), requestOptions); + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public WhopApiHttpResponse verify(String id, VerifyPaymentMethodDomainsRequest request) { + return verify(id, request, null); + } + + /** + * Re-attempts provider verification of a pending domain once the association file is hosted. Fails with a bad_request explaining what to fix; verifying an already verified domain is a no-op. + */ + public WhopApiHttpResponse verify( + String id, VerifyPaymentMethodDomainsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_method_domains") + .addPathSegment(id) + .addPathSegments("verify"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaymentMethodDomain.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/requests/CreatePaymentMethodDomainsRequest.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/requests/CreatePaymentMethodDomainsRequest.java new file mode 100644 index 00000000..db291850 --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/requests/CreatePaymentMethodDomainsRequest.java @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePaymentMethodDomainsRequest.Builder.class) +public final class CreatePaymentMethodDomainsRequest { + private final Optional accountId; + + private final String hostname; + + private final Map additionalProperties; + + private CreatePaymentMethodDomainsRequest( + Optional accountId, String hostname, Map additionalProperties) { + this.accountId = accountId; + this.hostname = hostname; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account to register the domain for (biz_ tag). Defaults to the caller's account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Hostname to register (e.g. checkout.shinetime.example). + */ + @JsonProperty("hostname") + public String getHostname() { + return hostname; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePaymentMethodDomainsRequest && equalTo((CreatePaymentMethodDomainsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePaymentMethodDomainsRequest other) { + return accountId.equals(other.accountId) && hostname.equals(other.hostname); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.hostname); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HostnameStage builder() { + return new Builder(); + } + + public interface HostnameStage { + /** + *

Hostname to register (e.g. checkout.shinetime.example).

+ */ + _FinalStage hostname(@NotNull String hostname); + + Builder from(CreatePaymentMethodDomainsRequest other); + } + + public interface _FinalStage { + CreatePaymentMethodDomainsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account to register the domain for (biz_ tag). Defaults to the caller's account.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HostnameStage, _FinalStage { + private String hostname; + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePaymentMethodDomainsRequest other) { + accountId(other.getAccountId()); + hostname(other.getHostname()); + return this; + } + + /** + *

Hostname to register (e.g. checkout.shinetime.example).

+ *

Hostname to register (e.g. checkout.shinetime.example).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("hostname") + public _FinalStage hostname(@NotNull String hostname) { + this.hostname = Objects.requireNonNull(hostname, "hostname must not be null"); + return this; + } + + /** + *

Account to register the domain for (biz_ tag). Defaults to the caller's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Account to register the domain for (biz_ tag). Defaults to the caller's account.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public CreatePaymentMethodDomainsRequest build() { + return new CreatePaymentMethodDomainsRequest(accountId, hostname, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/requests/DeletePaymentMethodDomainsRequest.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/requests/DeletePaymentMethodDomainsRequest.java new file mode 100644 index 00000000..c182f04f --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/requests/DeletePaymentMethodDomainsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeletePaymentMethodDomainsRequest.Builder.class) +public final class DeletePaymentMethodDomainsRequest { + private final Map additionalProperties; + + private DeletePaymentMethodDomainsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeletePaymentMethodDomainsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeletePaymentMethodDomainsRequest other) { + return this; + } + + public DeletePaymentMethodDomainsRequest build() { + return new DeletePaymentMethodDomainsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/requests/ListPaymentMethodDomainsRequest.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/requests/ListPaymentMethodDomainsRequest.java new file mode 100644 index 00000000..386cd684 --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/requests/ListPaymentMethodDomainsRequest.java @@ -0,0 +1,473 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.paymentmethoddomains.types.ListPaymentMethodDomainsRequestDirection; +import com.whop.api.resources.paymentmethoddomains.types.ListPaymentMethodDomainsRequestOrder; +import com.whop.api.resources.paymentmethoddomains.types.ListPaymentMethodDomainsRequestProvider; +import com.whop.api.resources.paymentmethoddomains.types.ListPaymentMethodDomainsRequestStatus; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPaymentMethodDomainsRequest.Builder.class) +public final class ListPaymentMethodDomainsRequest { + private final Optional accountId; + + private final Optional hostname; + + private final Optional status; + + private final Optional provider; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional order; + + private final Optional direction; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListPaymentMethodDomainsRequest( + Optional accountId, + Optional hostname, + Optional status, + Optional provider, + Optional createdBefore, + Optional createdAfter, + Optional order, + Optional direction, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.accountId = accountId; + this.hostname = hostname; + this.status = status; + this.provider = provider; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.order = order; + this.direction = direction; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only domains registered for this account (biz_ tag). Defaults to the caller's account plus its connected accounts. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Only the domain with this exact hostname. + */ + @JsonProperty("hostname") + public Optional getHostname() { + return hostname; + } + + /** + * @return Only domains with this verification status. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Only domains registered with this wallet provider. + */ + @JsonProperty("provider") + public Optional getProvider() { + return provider; + } + + /** + * @return Only domains created before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only domains created after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Sort field. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Number of domains to return from the start of the window. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to paginate forwards from. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return Number of domains to return from the end of the window. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to paginate backwards from. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPaymentMethodDomainsRequest && equalTo((ListPaymentMethodDomainsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPaymentMethodDomainsRequest other) { + return accountId.equals(other.accountId) + && hostname.equals(other.hostname) + && status.equals(other.status) + && provider.equals(other.provider) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && order.equals(other.order) + && direction.equals(other.direction) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.hostname, + this.status, + this.provider, + this.createdBefore, + this.createdAfter, + this.order, + this.direction, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional hostname = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional provider = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListPaymentMethodDomainsRequest other) { + accountId(other.getAccountId()); + hostname(other.getHostname()); + status(other.getStatus()); + provider(other.getProvider()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + order(other.getOrder()); + direction(other.getDirection()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

Only domains registered for this account (biz_ tag). Defaults to the caller's account plus its connected accounts.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Only the domain with this exact hostname.

+ */ + @JsonSetter(value = "hostname", nulls = Nulls.SKIP) + public Builder hostname(Optional hostname) { + this.hostname = hostname; + return this; + } + + public Builder hostname(String hostname) { + this.hostname = Optional.ofNullable(hostname); + return this; + } + + /** + *

Only domains with this verification status.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListPaymentMethodDomainsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Only domains registered with this wallet provider.

+ */ + @JsonSetter(value = "provider", nulls = Nulls.SKIP) + public Builder provider(Optional provider) { + this.provider = provider; + return this; + } + + public Builder provider(ListPaymentMethodDomainsRequestProvider provider) { + this.provider = Optional.ofNullable(provider); + return this; + } + + /** + *

Only domains created before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only domains created after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Sort field.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListPaymentMethodDomainsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListPaymentMethodDomainsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Number of domains to return from the start of the window.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to paginate forwards from.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Number of domains to return from the end of the window.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to paginate backwards from.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListPaymentMethodDomainsRequest build() { + return new ListPaymentMethodDomainsRequest( + accountId, + hostname, + status, + provider, + createdBefore, + createdAfter, + order, + direction, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/requests/RetrievePaymentMethodDomainsRequest.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/requests/RetrievePaymentMethodDomainsRequest.java new file mode 100644 index 00000000..f96cda20 --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/requests/RetrievePaymentMethodDomainsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePaymentMethodDomainsRequest.Builder.class) +public final class RetrievePaymentMethodDomainsRequest { + private final Map additionalProperties; + + private RetrievePaymentMethodDomainsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePaymentMethodDomainsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePaymentMethodDomainsRequest other) { + return this; + } + + public RetrievePaymentMethodDomainsRequest build() { + return new RetrievePaymentMethodDomainsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/requests/VerifyPaymentMethodDomainsRequest.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/requests/VerifyPaymentMethodDomainsRequest.java new file mode 100644 index 00000000..cdc3521c --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/requests/VerifyPaymentMethodDomainsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = VerifyPaymentMethodDomainsRequest.Builder.class) +public final class VerifyPaymentMethodDomainsRequest { + private final Map additionalProperties; + + private VerifyPaymentMethodDomainsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VerifyPaymentMethodDomainsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(VerifyPaymentMethodDomainsRequest other) { + return this; + } + + public VerifyPaymentMethodDomainsRequest build() { + return new VerifyPaymentMethodDomainsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/types/DeletePaymentMethodDomainsResponse.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/types/DeletePaymentMethodDomainsResponse.java new file mode 100644 index 00000000..5f6c0f6b --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/types/DeletePaymentMethodDomainsResponse.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeletePaymentMethodDomainsResponse.Builder.class) +public final class DeletePaymentMethodDomainsResponse { + private final boolean deleted; + + private final String id; + + private final Map additionalProperties; + + private DeletePaymentMethodDomainsResponse(boolean deleted, String id, Map additionalProperties) { + this.deleted = deleted; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("deleted") + public boolean getDeleted() { + return deleted; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeletePaymentMethodDomainsResponse + && equalTo((DeletePaymentMethodDomainsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeletePaymentMethodDomainsResponse other) { + return deleted == other.deleted && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deleted, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeletedStage builder() { + return new Builder(); + } + + public interface DeletedStage { + IdStage deleted(boolean deleted); + + Builder from(DeletePaymentMethodDomainsResponse other); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DeletePaymentMethodDomainsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeletedStage, IdStage, _FinalStage { + private boolean deleted; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeletePaymentMethodDomainsResponse other) { + deleted(other.getDeleted()); + id(other.getId()); + return this; + } + + @java.lang.Override + @JsonSetter("deleted") + public IdStage deleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DeletePaymentMethodDomainsResponse build() { + return new DeletePaymentMethodDomainsResponse(deleted, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsRequestDirection.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsRequestDirection.java new file mode 100644 index 00000000..96cef93a --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsRequestDirection.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPaymentMethodDomainsRequestDirection { + public static final ListPaymentMethodDomainsRequestDirection ASC = + new ListPaymentMethodDomainsRequestDirection(Value.ASC, "asc"); + + public static final ListPaymentMethodDomainsRequestDirection DESC = + new ListPaymentMethodDomainsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListPaymentMethodDomainsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPaymentMethodDomainsRequestDirection + && this.string.equals(((ListPaymentMethodDomainsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPaymentMethodDomainsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListPaymentMethodDomainsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsRequestOrder.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsRequestOrder.java new file mode 100644 index 00000000..65856e36 --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsRequestOrder.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPaymentMethodDomainsRequestOrder { + public static final ListPaymentMethodDomainsRequestOrder CREATED_AT = + new ListPaymentMethodDomainsRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListPaymentMethodDomainsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPaymentMethodDomainsRequestOrder + && this.string.equals(((ListPaymentMethodDomainsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPaymentMethodDomainsRequestOrder valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + default: + return new ListPaymentMethodDomainsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsRequestProvider.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsRequestProvider.java new file mode 100644 index 00000000..3b30108b --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsRequestProvider.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPaymentMethodDomainsRequestProvider { + public static final ListPaymentMethodDomainsRequestProvider APPLE = + new ListPaymentMethodDomainsRequestProvider(Value.APPLE, "apple"); + + private final Value value; + + private final String string; + + ListPaymentMethodDomainsRequestProvider(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPaymentMethodDomainsRequestProvider + && this.string.equals(((ListPaymentMethodDomainsRequestProvider) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPLE: + return visitor.visitApple(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPaymentMethodDomainsRequestProvider valueOf(String value) { + switch (value) { + case "apple": + return APPLE; + default: + return new ListPaymentMethodDomainsRequestProvider(Value.UNKNOWN, value); + } + } + + public enum Value { + APPLE, + + UNKNOWN + } + + public interface Visitor { + T visitApple(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsRequestStatus.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsRequestStatus.java new file mode 100644 index 00000000..7ac685c3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsRequestStatus.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPaymentMethodDomainsRequestStatus { + public static final ListPaymentMethodDomainsRequestStatus PENDING = + new ListPaymentMethodDomainsRequestStatus(Value.PENDING, "pending"); + + public static final ListPaymentMethodDomainsRequestStatus VERIFIED = + new ListPaymentMethodDomainsRequestStatus(Value.VERIFIED, "verified"); + + private final Value value; + + private final String string; + + ListPaymentMethodDomainsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPaymentMethodDomainsRequestStatus + && this.string.equals(((ListPaymentMethodDomainsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case VERIFIED: + return visitor.visitVerified(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPaymentMethodDomainsRequestStatus valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "verified": + return VERIFIED; + default: + return new ListPaymentMethodDomainsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + VERIFIED, + + UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitVerified(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsResponse.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsResponse.java new file mode 100644 index 00000000..53603604 --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PaymentMethodDomain; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPaymentMethodDomainsResponse.Builder.class) +public final class ListPaymentMethodDomainsResponse { + private final List data; + + private final ListPaymentMethodDomainsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListPaymentMethodDomainsResponse( + List data, + ListPaymentMethodDomainsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListPaymentMethodDomainsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPaymentMethodDomainsResponse && equalTo((ListPaymentMethodDomainsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPaymentMethodDomainsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListPaymentMethodDomainsResponsePageInfo pageInfo); + + Builder from(ListPaymentMethodDomainsResponse other); + } + + public interface _FinalStage { + ListPaymentMethodDomainsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(PaymentMethodDomain data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListPaymentMethodDomainsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPaymentMethodDomainsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListPaymentMethodDomainsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(PaymentMethodDomain data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListPaymentMethodDomainsResponse build() { + return new ListPaymentMethodDomainsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsResponsePageInfo.java b/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsResponsePageInfo.java new file mode 100644 index 00000000..96d628be --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethoddomains/types/ListPaymentMethodDomainsResponsePageInfo.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethoddomains.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPaymentMethodDomainsResponsePageInfo.Builder.class) +public final class ListPaymentMethodDomainsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListPaymentMethodDomainsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPaymentMethodDomainsResponsePageInfo + && equalTo((ListPaymentMethodDomainsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPaymentMethodDomainsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListPaymentMethodDomainsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListPaymentMethodDomainsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPaymentMethodDomainsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListPaymentMethodDomainsResponsePageInfo build() { + return new ListPaymentMethodDomainsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethods/AsyncPaymentMethodsClient.java b/src/main/java/com/whop/api/resources/paymentmethods/AsyncPaymentMethodsClient.java new file mode 100644 index 00000000..fca85e82 --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethods/AsyncPaymentMethodsClient.java @@ -0,0 +1,167 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethods; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.paymentmethods.requests.DeletePaymentMethodRequest; +import com.whop.api.resources.paymentmethods.requests.ListPaymentMethodsRequest; +import com.whop.api.resources.paymentmethods.requests.RetrievePaymentMethodsRequest; +import com.whop.api.types.PaymentMethod; +import com.whop.api.types.PaymentMethodListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncPaymentMethodsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPaymentMethodsClient rawClient; + + public AsyncPaymentMethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPaymentMethodsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPaymentMethodsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture> list(ListPaymentMethodsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture> list( + ListPaymentMethodsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrievePaymentMethodsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrievePaymentMethodsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public CompletableFuture deletePaymentMethod(String id) { + return this.rawClient.deletePaymentMethod(id).thenApply(response -> response.body()); + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public CompletableFuture deletePaymentMethod(String id, RequestOptions requestOptions) { + return this.rawClient.deletePaymentMethod(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public CompletableFuture deletePaymentMethod(String id, DeletePaymentMethodRequest request) { + return this.rawClient.deletePaymentMethod(id, request).thenApply(response -> response.body()); + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public CompletableFuture deletePaymentMethod( + String id, DeletePaymentMethodRequest request, RequestOptions requestOptions) { + return this.rawClient.deletePaymentMethod(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethods/AsyncRawPaymentMethodsClient.java b/src/main/java/com/whop/api/resources/paymentmethods/AsyncRawPaymentMethodsClient.java new file mode 100644 index 00000000..047de866 --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethods/AsyncRawPaymentMethodsClient.java @@ -0,0 +1,547 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethods; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.paymentmethods.requests.DeletePaymentMethodRequest; +import com.whop.api.resources.paymentmethods.requests.ListPaymentMethodsRequest; +import com.whop.api.resources.paymentmethods.requests.RetrievePaymentMethodsRequest; +import com.whop.api.resources.paymentmethods.types.ListPaymentMethodsResponse; +import com.whop.api.types.PaymentMethod; +import com.whop.api.types.PaymentMethodListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPaymentMethodsClient { + protected final ClientOptions clientOptions; + + public AsyncRawPaymentMethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture>> list() { + return list(ListPaymentMethodsRequest.builder().build()); + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListPaymentMethodsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture>> list( + ListPaymentMethodsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture>> list( + ListPaymentMethodsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_methods"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getMemberId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "member_id", request.getMemberId().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getFutureUsage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "future_usage", request.getFutureUsage().get(), false); + } + if (request.getHasPayerDocument().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "has_payer_document", request.getHasPayerDocument().get(), false); + } + if (request.getExpired().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "expired", request.getExpired().get(), false); + } + if (request.getBroken().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "broken", request.getBroken().get(), false); + } + if (request.getPaymentMethodTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "payment_method_types", + request.getPaymentMethodTypes().get(), + true); + } + if (request.getCardBrands().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "card_brands", request.getCardBrands().get(), true); + } + if (request.getCardFundingTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "card_funding_types", request.getCardFundingTypes().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPaymentMethodsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListPaymentMethodsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListPaymentMethodsRequest nextRequest = ListPaymentMethodsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrievePaymentMethodsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePaymentMethodsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrievePaymentMethodsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrievePaymentMethodsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_methods") + .addPathSegment(id); + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getMemberId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "member_id", request.getMemberId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaymentMethod.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public CompletableFuture> deletePaymentMethod(String id) { + return deletePaymentMethod(id, DeletePaymentMethodRequest.builder().build()); + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public CompletableFuture> deletePaymentMethod( + String id, RequestOptions requestOptions) { + return deletePaymentMethod(id, DeletePaymentMethodRequest.builder().build(), requestOptions); + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public CompletableFuture> deletePaymentMethod( + String id, DeletePaymentMethodRequest request) { + return deletePaymentMethod(id, request, null); + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public CompletableFuture> deletePaymentMethod( + String id, DeletePaymentMethodRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_methods") + .addPathSegment(id); + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getMemberId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "member_id", request.getMemberId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethods/PaymentMethodsClient.java b/src/main/java/com/whop/api/resources/paymentmethods/PaymentMethodsClient.java new file mode 100644 index 00000000..767efaec --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethods/PaymentMethodsClient.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethods; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.paymentmethods.requests.DeletePaymentMethodRequest; +import com.whop.api.resources.paymentmethods.requests.ListPaymentMethodsRequest; +import com.whop.api.resources.paymentmethods.requests.RetrievePaymentMethodsRequest; +import com.whop.api.types.PaymentMethod; +import com.whop.api.types.PaymentMethodListItem; + +public class PaymentMethodsClient { + protected final ClientOptions clientOptions; + + private final RawPaymentMethodsClient rawClient; + + public PaymentMethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPaymentMethodsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPaymentMethodsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public SyncPagingIterable list(ListPaymentMethodsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public SyncPagingIterable list( + ListPaymentMethodsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public PaymentMethod retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public PaymentMethod retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public PaymentMethod retrieve(String id, RetrievePaymentMethodsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public PaymentMethod retrieve(String id, RetrievePaymentMethodsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public boolean deletePaymentMethod(String id) { + return this.rawClient.deletePaymentMethod(id).body(); + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public boolean deletePaymentMethod(String id, RequestOptions requestOptions) { + return this.rawClient.deletePaymentMethod(id, requestOptions).body(); + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public boolean deletePaymentMethod(String id, DeletePaymentMethodRequest request) { + return this.rawClient.deletePaymentMethod(id, request).body(); + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public boolean deletePaymentMethod(String id, DeletePaymentMethodRequest request, RequestOptions requestOptions) { + return this.rawClient.deletePaymentMethod(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethods/RawPaymentMethodsClient.java b/src/main/java/com/whop/api/resources/paymentmethods/RawPaymentMethodsClient.java new file mode 100644 index 00000000..a16a0624 --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethods/RawPaymentMethodsClient.java @@ -0,0 +1,446 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethods; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.paymentmethods.requests.DeletePaymentMethodRequest; +import com.whop.api.resources.paymentmethods.requests.ListPaymentMethodsRequest; +import com.whop.api.resources.paymentmethods.requests.RetrievePaymentMethodsRequest; +import com.whop.api.resources.paymentmethods.types.ListPaymentMethodsResponse; +import com.whop.api.types.PaymentMethod; +import com.whop.api.types.PaymentMethodListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPaymentMethodsClient { + protected final ClientOptions clientOptions; + + public RawPaymentMethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public WhopApiHttpResponse> list() { + return list(ListPaymentMethodsRequest.builder().build()); + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListPaymentMethodsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListPaymentMethodsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of payment methods for a member or company, or for the authenticated user when neither is given, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListPaymentMethodsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_methods"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getMemberId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "member_id", request.getMemberId().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getFutureUsage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "future_usage", request.getFutureUsage().get(), false); + } + if (request.getHasPayerDocument().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "has_payer_document", request.getHasPayerDocument().get(), false); + } + if (request.getExpired().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "expired", request.getExpired().get(), false); + } + if (request.getBroken().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "broken", request.getBroken().get(), false); + } + if (request.getPaymentMethodTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "payment_method_types", + request.getPaymentMethodTypes().get(), + true); + } + if (request.getCardBrands().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "card_brands", request.getCardBrands().get(), true); + } + if (request.getCardFundingTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "card_funding_types", request.getCardFundingTypes().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPaymentMethodsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPaymentMethodsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListPaymentMethodsRequest nextRequest = ListPaymentMethodsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrievePaymentMethodsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePaymentMethodsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrievePaymentMethodsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing payment method. Addresses a member's wallet when member_id or company_id is given, otherwise your own. + *

Required permissions:

+ *
    + *
  • member:payment_methods:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrievePaymentMethodsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_methods") + .addPathSegment(id); + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getMemberId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "member_id", request.getMemberId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaymentMethod.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public WhopApiHttpResponse deletePaymentMethod(String id) { + return deletePaymentMethod(id, DeletePaymentMethodRequest.builder().build()); + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public WhopApiHttpResponse deletePaymentMethod(String id, RequestOptions requestOptions) { + return deletePaymentMethod(id, DeletePaymentMethodRequest.builder().build(), requestOptions); + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public WhopApiHttpResponse deletePaymentMethod(String id, DeletePaymentMethodRequest request) { + return deletePaymentMethod(id, request, null); + } + + /** + * Delete a saved payment method. Cannot delete a payment method attached to an active subscription. + *

Required permissions:

+ *
    + *
  • member:payment_methods:manage
  • + *
+ */ + public WhopApiHttpResponse deletePaymentMethod( + String id, DeletePaymentMethodRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payment_methods") + .addPathSegment(id); + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getMemberId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "member_id", request.getMemberId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethods/requests/DeletePaymentMethodRequest.java b/src/main/java/com/whop/api/resources/paymentmethods/requests/DeletePaymentMethodRequest.java new file mode 100644 index 00000000..c5cb5b29 --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethods/requests/DeletePaymentMethodRequest.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethods.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeletePaymentMethodRequest.Builder.class) +public final class DeletePaymentMethodRequest { + private final Optional companyId; + + private final Optional memberId; + + private final Map additionalProperties; + + private DeletePaymentMethodRequest( + Optional companyId, Optional memberId, Map additionalProperties) { + this.companyId = companyId; + this.memberId = memberId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the company. Provide either this or member_id, not both. Omit both to address your own saved payment methods. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + /** + * @return The unique identifier of the member. Provide either this or company_id, not both. Omit both to address your own saved payment methods. + */ + @JsonProperty("member_id") + public Optional getMemberId() { + return memberId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeletePaymentMethodRequest && equalTo((DeletePaymentMethodRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeletePaymentMethodRequest other) { + return companyId.equals(other.companyId) && memberId.equals(other.memberId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.memberId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional companyId = Optional.empty(); + + private Optional memberId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeletePaymentMethodRequest other) { + companyId(other.getCompanyId()); + memberId(other.getMemberId()); + return this; + } + + /** + *

The unique identifier of the company. Provide either this or member_id, not both. Omit both to address your own saved payment methods.

+ */ + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + /** + *

The unique identifier of the member. Provide either this or company_id, not both. Omit both to address your own saved payment methods.

+ */ + @JsonSetter(value = "member_id", nulls = Nulls.SKIP) + public Builder memberId(Optional memberId) { + this.memberId = memberId; + return this; + } + + public Builder memberId(String memberId) { + this.memberId = Optional.ofNullable(memberId); + return this; + } + + public DeletePaymentMethodRequest build() { + return new DeletePaymentMethodRequest(companyId, memberId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethods/requests/ListPaymentMethodsRequest.java b/src/main/java/com/whop/api/resources/paymentmethods/requests/ListPaymentMethodsRequest.java new file mode 100644 index 00000000..0e2d6b91 --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethods/requests/ListPaymentMethodsRequest.java @@ -0,0 +1,607 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethods.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CardBrands; +import com.whop.api.types.CardFundingTypes; +import com.whop.api.types.Direction; +import com.whop.api.types.FutureUsageTypes; +import com.whop.api.types.PaymentMethodTypes; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPaymentMethodsRequest.Builder.class) +public final class ListPaymentMethodsRequest { + private final Optional> paymentMethodTypes; + + private final Optional> cardBrands; + + private final Optional> cardFundingTypes; + + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Optional memberId; + + private final Optional companyId; + + private final Optional direction; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional futureUsage; + + private final Optional hasPayerDocument; + + private final Optional expired; + + private final Optional broken; + + private final Map additionalProperties; + + private ListPaymentMethodsRequest( + Optional> paymentMethodTypes, + Optional> cardBrands, + Optional> cardFundingTypes, + Optional after, + Optional before, + Optional first, + Optional last, + Optional memberId, + Optional companyId, + Optional direction, + Optional createdBefore, + Optional createdAfter, + Optional futureUsage, + Optional hasPayerDocument, + Optional expired, + Optional broken, + Map additionalProperties) { + this.paymentMethodTypes = paymentMethodTypes; + this.cardBrands = cardBrands; + this.cardFundingTypes = cardFundingTypes; + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.memberId = memberId; + this.companyId = companyId; + this.direction = direction; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.futureUsage = futureUsage; + this.hasPayerDocument = hasPayerDocument; + this.expired = expired; + this.broken = broken; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only return payment methods of these types. Pass the eligible type values from the payment method types catalogue so the list holds nothing the purchase cannot take. An empty list returns no payment methods. + */ + @JsonProperty("payment_method_types") + public Optional> getPaymentMethodTypes() { + return paymentMethodTypes; + } + + /** + * @return Only return cards on these networks, such as the networks the seller accepts. Payment methods that are not cards are unaffected. + */ + @JsonProperty("card_brands") + public Optional> getCardBrands() { + return cardBrands; + } + + /** + * @return Only return cards funded this way. A card whose funding could not be determined is excluded, and payment methods that are not cards are unaffected. + */ + @JsonProperty("card_funding_types") + public Optional> getCardFundingTypes() { + return cardFundingTypes; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the member to list payment methods for. Omit this and company_id to list your own saved payment methods. + */ + @JsonProperty("member_id") + public Optional getMemberId() { + return memberId; + } + + /** + * @return The unique identifier of the company. Provide either this or member_id, not both. Omit both to address your own saved payment methods. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Only return payment methods created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return payment methods created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @JsonProperty("future_usage") + public Optional getFutureUsage() { + return futureUsage; + } + + /** + * @return Filter cards by whether they carry the payer identity document their payment provider requires. Payment methods that are not cards are unaffected. + */ + @JsonProperty("has_payer_document") + public Optional getHasPayerDocument() { + return hasPayerDocument; + } + + /** + * @return Filter by expiry. Only a card can expire, so false keeps every payment method that is not past its expiration month and true returns expired cards alone. + */ + @JsonProperty("expired") + public Optional getExpired() { + return expired; + } + + /** + * @return Filter by whether the stored credential has permanently stopped charging, such as a vault entry its provider closed. + */ + @JsonProperty("broken") + public Optional getBroken() { + return broken; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPaymentMethodsRequest && equalTo((ListPaymentMethodsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPaymentMethodsRequest other) { + return paymentMethodTypes.equals(other.paymentMethodTypes) + && cardBrands.equals(other.cardBrands) + && cardFundingTypes.equals(other.cardFundingTypes) + && after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && memberId.equals(other.memberId) + && companyId.equals(other.companyId) + && direction.equals(other.direction) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && futureUsage.equals(other.futureUsage) + && hasPayerDocument.equals(other.hasPayerDocument) + && expired.equals(other.expired) + && broken.equals(other.broken); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.paymentMethodTypes, + this.cardBrands, + this.cardFundingTypes, + this.after, + this.before, + this.first, + this.last, + this.memberId, + this.companyId, + this.direction, + this.createdBefore, + this.createdAfter, + this.futureUsage, + this.hasPayerDocument, + this.expired, + this.broken); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> paymentMethodTypes = Optional.empty(); + + private Optional> cardBrands = Optional.empty(); + + private Optional> cardFundingTypes = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional memberId = Optional.empty(); + + private Optional companyId = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional futureUsage = Optional.empty(); + + private Optional hasPayerDocument = Optional.empty(); + + private Optional expired = Optional.empty(); + + private Optional broken = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListPaymentMethodsRequest other) { + paymentMethodTypes(other.getPaymentMethodTypes()); + cardBrands(other.getCardBrands()); + cardFundingTypes(other.getCardFundingTypes()); + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + memberId(other.getMemberId()); + companyId(other.getCompanyId()); + direction(other.getDirection()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + futureUsage(other.getFutureUsage()); + hasPayerDocument(other.getHasPayerDocument()); + expired(other.getExpired()); + broken(other.getBroken()); + return this; + } + + /** + *

Only return payment methods of these types. Pass the eligible type values from the payment method types catalogue so the list holds nothing the purchase cannot take. An empty list returns no payment methods.

+ */ + @JsonSetter(value = "payment_method_types", nulls = Nulls.SKIP) + public Builder paymentMethodTypes(Optional> paymentMethodTypes) { + this.paymentMethodTypes = paymentMethodTypes; + return this; + } + + public Builder paymentMethodTypes(List paymentMethodTypes) { + this.paymentMethodTypes = Optional.ofNullable(paymentMethodTypes); + return this; + } + + public Builder paymentMethodTypes(PaymentMethodTypes paymentMethodTypes) { + this.paymentMethodTypes = Optional.of(Collections.singletonList(paymentMethodTypes)); + return this; + } + + /** + *

Only return cards on these networks, such as the networks the seller accepts. Payment methods that are not cards are unaffected.

+ */ + @JsonSetter(value = "card_brands", nulls = Nulls.SKIP) + public Builder cardBrands(Optional> cardBrands) { + this.cardBrands = cardBrands; + return this; + } + + public Builder cardBrands(List cardBrands) { + this.cardBrands = Optional.ofNullable(cardBrands); + return this; + } + + public Builder cardBrands(CardBrands cardBrands) { + this.cardBrands = Optional.of(Collections.singletonList(cardBrands)); + return this; + } + + /** + *

Only return cards funded this way. A card whose funding could not be determined is excluded, and payment methods that are not cards are unaffected.

+ */ + @JsonSetter(value = "card_funding_types", nulls = Nulls.SKIP) + public Builder cardFundingTypes(Optional> cardFundingTypes) { + this.cardFundingTypes = cardFundingTypes; + return this; + } + + public Builder cardFundingTypes(List cardFundingTypes) { + this.cardFundingTypes = Optional.ofNullable(cardFundingTypes); + return this; + } + + public Builder cardFundingTypes(CardFundingTypes cardFundingTypes) { + this.cardFundingTypes = Optional.of(Collections.singletonList(cardFundingTypes)); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The unique identifier of the member to list payment methods for. Omit this and company_id to list your own saved payment methods.

+ */ + @JsonSetter(value = "member_id", nulls = Nulls.SKIP) + public Builder memberId(Optional memberId) { + this.memberId = memberId; + return this; + } + + public Builder memberId(String memberId) { + this.memberId = Optional.ofNullable(memberId); + return this; + } + + /** + *

The unique identifier of the company. Provide either this or member_id, not both. Omit both to address your own saved payment methods.

+ */ + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(Direction direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Only return payment methods created before this timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return payment methods created after this timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + @JsonSetter(value = "future_usage", nulls = Nulls.SKIP) + public Builder futureUsage(Optional futureUsage) { + this.futureUsage = futureUsage; + return this; + } + + public Builder futureUsage(FutureUsageTypes futureUsage) { + this.futureUsage = Optional.ofNullable(futureUsage); + return this; + } + + /** + *

Filter cards by whether they carry the payer identity document their payment provider requires. Payment methods that are not cards are unaffected.

+ */ + @JsonSetter(value = "has_payer_document", nulls = Nulls.SKIP) + public Builder hasPayerDocument(Optional hasPayerDocument) { + this.hasPayerDocument = hasPayerDocument; + return this; + } + + public Builder hasPayerDocument(Boolean hasPayerDocument) { + this.hasPayerDocument = Optional.ofNullable(hasPayerDocument); + return this; + } + + /** + *

Filter by expiry. Only a card can expire, so false keeps every payment method that is not past its expiration month and true returns expired cards alone.

+ */ + @JsonSetter(value = "expired", nulls = Nulls.SKIP) + public Builder expired(Optional expired) { + this.expired = expired; + return this; + } + + public Builder expired(Boolean expired) { + this.expired = Optional.ofNullable(expired); + return this; + } + + /** + *

Filter by whether the stored credential has permanently stopped charging, such as a vault entry its provider closed.

+ */ + @JsonSetter(value = "broken", nulls = Nulls.SKIP) + public Builder broken(Optional broken) { + this.broken = broken; + return this; + } + + public Builder broken(Boolean broken) { + this.broken = Optional.ofNullable(broken); + return this; + } + + public ListPaymentMethodsRequest build() { + return new ListPaymentMethodsRequest( + paymentMethodTypes, + cardBrands, + cardFundingTypes, + after, + before, + first, + last, + memberId, + companyId, + direction, + createdBefore, + createdAfter, + futureUsage, + hasPayerDocument, + expired, + broken, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethods/requests/RetrievePaymentMethodsRequest.java b/src/main/java/com/whop/api/resources/paymentmethods/requests/RetrievePaymentMethodsRequest.java new file mode 100644 index 00000000..02a6734e --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethods/requests/RetrievePaymentMethodsRequest.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethods.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePaymentMethodsRequest.Builder.class) +public final class RetrievePaymentMethodsRequest { + private final Optional companyId; + + private final Optional memberId; + + private final Map additionalProperties; + + private RetrievePaymentMethodsRequest( + Optional companyId, Optional memberId, Map additionalProperties) { + this.companyId = companyId; + this.memberId = memberId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the company. Provide either this or member_id, not both. Omit both to address your own saved payment methods. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + /** + * @return The unique identifier of the member. Provide either this or company_id, not both. Omit both to address your own saved payment methods. + */ + @JsonProperty("member_id") + public Optional getMemberId() { + return memberId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePaymentMethodsRequest && equalTo((RetrievePaymentMethodsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePaymentMethodsRequest other) { + return companyId.equals(other.companyId) && memberId.equals(other.memberId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.memberId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional companyId = Optional.empty(); + + private Optional memberId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePaymentMethodsRequest other) { + companyId(other.getCompanyId()); + memberId(other.getMemberId()); + return this; + } + + /** + *

The unique identifier of the company. Provide either this or member_id, not both. Omit both to address your own saved payment methods.

+ */ + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + /** + *

The unique identifier of the member. Provide either this or company_id, not both. Omit both to address your own saved payment methods.

+ */ + @JsonSetter(value = "member_id", nulls = Nulls.SKIP) + public Builder memberId(Optional memberId) { + this.memberId = memberId; + return this; + } + + public Builder memberId(String memberId) { + this.memberId = Optional.ofNullable(memberId); + return this; + } + + public RetrievePaymentMethodsRequest build() { + return new RetrievePaymentMethodsRequest(companyId, memberId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/paymentmethods/types/ListPaymentMethodsResponse.java b/src/main/java/com/whop/api/resources/paymentmethods/types/ListPaymentMethodsResponse.java new file mode 100644 index 00000000..1cbdedd0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/paymentmethods/types/ListPaymentMethodsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.paymentmethods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PageInfo; +import com.whop.api.types.PaymentMethodListItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPaymentMethodsResponse.Builder.class) +public final class ListPaymentMethodsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListPaymentMethodsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPaymentMethodsResponse && equalTo((ListPaymentMethodsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPaymentMethodsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListPaymentMethodsResponse other); + } + + public interface _FinalStage { + ListPaymentMethodsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(PaymentMethodListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPaymentMethodsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(PaymentMethodListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListPaymentMethodsResponse build() { + return new ListPaymentMethodsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/AsyncPaymentsClient.java b/src/main/java/com/whop/api/resources/payments/AsyncPaymentsClient.java new file mode 100644 index 00000000..15ff32d0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/AsyncPaymentsClient.java @@ -0,0 +1,576 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.payments.requests.ListFeesPaymentsRequest; +import com.whop.api.resources.payments.requests.ListPaymentsRequest; +import com.whop.api.resources.payments.requests.RefundPaymentsRequest; +import com.whop.api.resources.payments.requests.RetrievePaymentsRequest; +import com.whop.api.resources.payments.requests.RetrieveStatusPaymentsRequest; +import com.whop.api.resources.payments.requests.RetryPaymentsRequest; +import com.whop.api.resources.payments.requests.UpdateReturnUrlPaymentsRequest; +import com.whop.api.resources.payments.requests.VoidPaymentsRequest; +import com.whop.api.resources.payments.types.CreatePaymentsRequest; +import com.whop.api.resources.payments.types.CreatePaymentsResponse; +import com.whop.api.resources.payments.types.ListFeesPaymentsResponseDataItem; +import com.whop.api.resources.payments.types.RetrievePaymentsResponse; +import com.whop.api.types.Payment; +import com.whop.api.types.PaymentListItem; +import com.whop.api.types.PaymentStatus; +import java.util.concurrent.CompletableFuture; + +public class AsyncPaymentsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPaymentsClient rawClient; + + public AsyncPaymentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPaymentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPaymentsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public CompletableFuture> list(ListPaymentsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public CompletableFuture> list( + ListPaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Charge an existing member off-session using one of their stored payment methods. You can provide an existing plan, or create a new one in-line. This endpoint will respond with a payment object immediately, but the payment is processed asynchronously in the background. Use webhooks to be notified when the payment succeeds or fails. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • plan:create
  • + *
  • access_pass:create
  • + *
  • access_pass:update
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture create(CreatePaymentsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Charge an existing member off-session using one of their stored payment methods. You can provide an existing plan, or create a new one in-line. This endpoint will respond with a payment object immediately, but the payment is processed asynchronously in the background. Use webhooks to be notified when the payment succeeds or fails. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • plan:create
  • + *
  • access_pass:create
  • + *
  • access_pass:update
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture create( + CreatePaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrievePaymentsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrievePaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> listFees(String id) { + return this.rawClient.listFees(id).thenApply(response -> response.body()); + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> listFees( + String id, RequestOptions requestOptions) { + return this.rawClient.listFees(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> listFees( + String id, ListFeesPaymentsRequest request) { + return this.rawClient.listFees(id, request).thenApply(response -> response.body()); + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> listFees( + String id, ListFeesPaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.listFees(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture refund(String id) { + return this.rawClient.refund(id).thenApply(response -> response.body()); + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture refund(String id, RequestOptions requestOptions) { + return this.rawClient.refund(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture refund(String id, RefundPaymentsRequest request) { + return this.rawClient.refund(id, request).thenApply(response -> response.body()); + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture refund(String id, RefundPaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.refund(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture retry(String id) { + return this.rawClient.retry(id).thenApply(response -> response.body()); + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture retry(String id, RequestOptions requestOptions) { + return this.rawClient.retry(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture retry(String id, RetryPaymentsRequest request) { + return this.rawClient.retry(id, request).thenApply(response -> response.body()); + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture retry(String id, RetryPaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.retry(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture void_(String id) { + return this.rawClient.void_(id).thenApply(response -> response.body()); + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture void_(String id, RequestOptions requestOptions) { + return this.rawClient.void_(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture void_(String id, VoidPaymentsRequest request) { + return this.rawClient.void_(id, request).thenApply(response -> response.body()); + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture void_(String id, VoidPaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.void_(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the payment's own client_secret, so the surface that knows the final destination can set it. + */ + public CompletableFuture updateReturnUrl(String paymentId, UpdateReturnUrlPaymentsRequest request) { + return this.rawClient.updateReturnUrl(paymentId, request).thenApply(response -> response.body()); + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the payment's own client_secret, so the surface that knows the final destination can set it. + */ + public CompletableFuture updateReturnUrl( + String paymentId, UpdateReturnUrlPaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient + .updateReturnUrl(paymentId, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public CompletableFuture retrieveStatus(String paymentId) { + return this.rawClient.retrieveStatus(paymentId).thenApply(response -> response.body()); + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public CompletableFuture retrieveStatus(String paymentId, RequestOptions requestOptions) { + return this.rawClient.retrieveStatus(paymentId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public CompletableFuture retrieveStatus(String paymentId, RetrieveStatusPaymentsRequest request) { + return this.rawClient.retrieveStatus(paymentId, request).thenApply(response -> response.body()); + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public CompletableFuture retrieveStatus( + String paymentId, RetrieveStatusPaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieveStatus(paymentId, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/payments/AsyncRawPaymentsClient.java b/src/main/java/com/whop/api/resources/payments/AsyncRawPaymentsClient.java new file mode 100644 index 00000000..603a9706 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/AsyncRawPaymentsClient.java @@ -0,0 +1,1495 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.payments.requests.ListFeesPaymentsRequest; +import com.whop.api.resources.payments.requests.ListPaymentsRequest; +import com.whop.api.resources.payments.requests.RefundPaymentsRequest; +import com.whop.api.resources.payments.requests.RetrievePaymentsRequest; +import com.whop.api.resources.payments.requests.RetrieveStatusPaymentsRequest; +import com.whop.api.resources.payments.requests.RetryPaymentsRequest; +import com.whop.api.resources.payments.requests.UpdateReturnUrlPaymentsRequest; +import com.whop.api.resources.payments.requests.VoidPaymentsRequest; +import com.whop.api.resources.payments.types.CreatePaymentsRequest; +import com.whop.api.resources.payments.types.CreatePaymentsResponse; +import com.whop.api.resources.payments.types.ListFeesPaymentsResponse; +import com.whop.api.resources.payments.types.ListFeesPaymentsResponseDataItem; +import com.whop.api.resources.payments.types.ListPaymentsResponse; +import com.whop.api.resources.payments.types.RetrievePaymentsResponse; +import com.whop.api.types.Payment; +import com.whop.api.types.PaymentListItem; +import com.whop.api.types.PaymentStatus; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPaymentsClient { + protected final ClientOptions clientOptions; + + public AsyncRawPaymentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public CompletableFuture>> list() { + return list(ListPaymentsRequest.builder().build()); + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListPaymentsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public CompletableFuture>> list( + ListPaymentsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public CompletableFuture>> list( + ListPaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getIncludeFree().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "include_free", request.getIncludeFree().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getUpdatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "updated_before", request.getUpdatedBefore().get(), false); + } + if (request.getUpdatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "updated_after", request.getUpdatedAfter().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } + if (request.getBillingReasons().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "billing_reasons", request.getBillingReasons().get(), true); + } + if (request.getCurrencies().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currencies", request.getCurrencies().get(), true); + } + if (request.getPlanIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_ids", request.getPlanIds().get(), true); + } + if (request.getStatuses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "statuses", request.getStatuses().get(), true); + } + if (request.getSubstatuses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "substatuses", request.getSubstatuses().get(), true); + } + if (request.getCheckoutConfigurationIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "checkout_configuration_ids", + request.getCheckoutConfigurationIds().get(), + true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPaymentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPaymentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListPaymentsRequest nextRequest = ListPaymentsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Charge an existing member off-session using one of their stored payment methods. You can provide an existing plan, or create a new one in-line. This endpoint will respond with a payment object immediately, but the payment is processed asynchronously in the background. Use webhooks to be notified when the payment succeeds or fails. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • plan:create
  • + *
  • access_pass:create
  • + *
  • access_pass:update
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> create(CreatePaymentsRequest request) { + return create(request, null); + } + + /** + * Charge an existing member off-session using one of their stored payment methods. You can provide an existing plan, or create a new one in-line. This endpoint will respond with a payment object immediately, but the payment is processed asynchronously in the background. Use webhooks to be notified when the payment succeeds or fails. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • plan:create
  • + *
  • access_pass:create
  • + *
  • access_pass:update
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> create( + CreatePaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreatePaymentsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrievePaymentsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePaymentsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrievePaymentsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrievePaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrievePaymentsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture>> listFees( + String id) { + return listFees(id, ListFeesPaymentsRequest.builder().build()); + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture>> listFees( + String id, RequestOptions requestOptions) { + return listFees(id, ListFeesPaymentsRequest.builder().build(), requestOptions); + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture>> listFees( + String id, ListFeesPaymentsRequest request) { + return listFees(id, request, null); + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture>> listFees( + String id, ListFeesPaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments") + .addPathSegment(id) + .addPathSegments("fees"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListFeesPaymentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListFeesPaymentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListFeesPaymentsRequest nextRequest = ListFeesPaymentsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return listFees(id, nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> refund(String id) { + return refund(id, RefundPaymentsRequest.builder().build()); + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> refund(String id, RequestOptions requestOptions) { + return refund(id, RefundPaymentsRequest.builder().build(), requestOptions); + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> refund(String id, RefundPaymentsRequest request) { + return refund(id, request, null); + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> refund( + String id, RefundPaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments") + .addPathSegment(id) + .addPathSegments("refund"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Payment.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> retry(String id) { + return retry(id, RetryPaymentsRequest.builder().build()); + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> retry(String id, RequestOptions requestOptions) { + return retry(id, RetryPaymentsRequest.builder().build(), requestOptions); + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> retry(String id, RetryPaymentsRequest request) { + return retry(id, request, null); + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> retry( + String id, RetryPaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments") + .addPathSegment(id) + .addPathSegments("retry"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Payment.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> void_(String id) { + return void_(id, VoidPaymentsRequest.builder().build()); + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> void_(String id, RequestOptions requestOptions) { + return void_(id, VoidPaymentsRequest.builder().build(), requestOptions); + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> void_(String id, VoidPaymentsRequest request) { + return void_(id, request, null); + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CompletableFuture> void_( + String id, VoidPaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments") + .addPathSegment(id) + .addPathSegments("void"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Payment.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the payment's own client_secret, so the surface that knows the final destination can set it. + */ + public CompletableFuture> updateReturnUrl( + String paymentId, UpdateReturnUrlPaymentsRequest request) { + return updateReturnUrl(paymentId, request, null); + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the payment's own client_secret, so the surface that knows the final destination can set it. + */ + public CompletableFuture> updateReturnUrl( + String paymentId, UpdateReturnUrlPaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments") + .addPathSegment(paymentId) + .addPathSegments("return_url"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaymentStatus.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public CompletableFuture> retrieveStatus(String paymentId) { + return retrieveStatus(paymentId, RetrieveStatusPaymentsRequest.builder().build()); + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public CompletableFuture> retrieveStatus( + String paymentId, RequestOptions requestOptions) { + return retrieveStatus(paymentId, RetrieveStatusPaymentsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public CompletableFuture> retrieveStatus( + String paymentId, RetrieveStatusPaymentsRequest request) { + return retrieveStatus(paymentId, request, null); + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public CompletableFuture> retrieveStatus( + String paymentId, RetrieveStatusPaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments") + .addPathSegment(paymentId) + .addPathSegments("status"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaymentStatus.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/payments/PaymentsClient.java b/src/main/java/com/whop/api/resources/payments/PaymentsClient.java new file mode 100644 index 00000000..83c7b708 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/PaymentsClient.java @@ -0,0 +1,571 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.payments.requests.ListFeesPaymentsRequest; +import com.whop.api.resources.payments.requests.ListPaymentsRequest; +import com.whop.api.resources.payments.requests.RefundPaymentsRequest; +import com.whop.api.resources.payments.requests.RetrievePaymentsRequest; +import com.whop.api.resources.payments.requests.RetrieveStatusPaymentsRequest; +import com.whop.api.resources.payments.requests.RetryPaymentsRequest; +import com.whop.api.resources.payments.requests.UpdateReturnUrlPaymentsRequest; +import com.whop.api.resources.payments.requests.VoidPaymentsRequest; +import com.whop.api.resources.payments.types.CreatePaymentsRequest; +import com.whop.api.resources.payments.types.CreatePaymentsResponse; +import com.whop.api.resources.payments.types.ListFeesPaymentsResponseDataItem; +import com.whop.api.resources.payments.types.RetrievePaymentsResponse; +import com.whop.api.types.Payment; +import com.whop.api.types.PaymentListItem; +import com.whop.api.types.PaymentStatus; + +public class PaymentsClient { + protected final ClientOptions clientOptions; + + private final RawPaymentsClient rawClient; + + public PaymentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPaymentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPaymentsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public SyncPagingIterable list(ListPaymentsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public SyncPagingIterable list(ListPaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Charge an existing member off-session using one of their stored payment methods. You can provide an existing plan, or create a new one in-line. This endpoint will respond with a payment object immediately, but the payment is processed asynchronously in the background. Use webhooks to be notified when the payment succeeds or fails. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • plan:create
  • + *
  • access_pass:create
  • + *
  • access_pass:update
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CreatePaymentsResponse create(CreatePaymentsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Charge an existing member off-session using one of their stored payment methods. You can provide an existing plan, or create a new one in-line. This endpoint will respond with a payment object immediately, but the payment is processed asynchronously in the background. Use webhooks to be notified when the payment succeeds or fails. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • plan:create
  • + *
  • access_pass:create
  • + *
  • access_pass:update
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public CreatePaymentsResponse create(CreatePaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public RetrievePaymentsResponse retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public RetrievePaymentsResponse retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public RetrievePaymentsResponse retrieve(String id, RetrievePaymentsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public RetrievePaymentsResponse retrieve( + String id, RetrievePaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public SyncPagingIterable listFees(String id) { + return this.rawClient.listFees(id).body(); + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public SyncPagingIterable listFees(String id, RequestOptions requestOptions) { + return this.rawClient.listFees(id, requestOptions).body(); + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public SyncPagingIterable listFees(String id, ListFeesPaymentsRequest request) { + return this.rawClient.listFees(id, request).body(); + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public SyncPagingIterable listFees( + String id, ListFeesPaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.listFees(id, request, requestOptions).body(); + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public Payment refund(String id) { + return this.rawClient.refund(id).body(); + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public Payment refund(String id, RequestOptions requestOptions) { + return this.rawClient.refund(id, requestOptions).body(); + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public Payment refund(String id, RefundPaymentsRequest request) { + return this.rawClient.refund(id, request).body(); + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public Payment refund(String id, RefundPaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.refund(id, request, requestOptions).body(); + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public Payment retry(String id) { + return this.rawClient.retry(id).body(); + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public Payment retry(String id, RequestOptions requestOptions) { + return this.rawClient.retry(id, requestOptions).body(); + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public Payment retry(String id, RetryPaymentsRequest request) { + return this.rawClient.retry(id, request).body(); + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public Payment retry(String id, RetryPaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.retry(id, request, requestOptions).body(); + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public Payment void_(String id) { + return this.rawClient.void_(id).body(); + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public Payment void_(String id, RequestOptions requestOptions) { + return this.rawClient.void_(id, requestOptions).body(); + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public Payment void_(String id, VoidPaymentsRequest request) { + return this.rawClient.void_(id, request).body(); + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public Payment void_(String id, VoidPaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.void_(id, request, requestOptions).body(); + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the payment's own client_secret, so the surface that knows the final destination can set it. + */ + public PaymentStatus updateReturnUrl(String paymentId, UpdateReturnUrlPaymentsRequest request) { + return this.rawClient.updateReturnUrl(paymentId, request).body(); + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the payment's own client_secret, so the surface that knows the final destination can set it. + */ + public PaymentStatus updateReturnUrl( + String paymentId, UpdateReturnUrlPaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient + .updateReturnUrl(paymentId, request, requestOptions) + .body(); + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public PaymentStatus retrieveStatus(String paymentId) { + return this.rawClient.retrieveStatus(paymentId).body(); + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public PaymentStatus retrieveStatus(String paymentId, RequestOptions requestOptions) { + return this.rawClient.retrieveStatus(paymentId, requestOptions).body(); + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public PaymentStatus retrieveStatus(String paymentId, RetrieveStatusPaymentsRequest request) { + return this.rawClient.retrieveStatus(paymentId, request).body(); + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public PaymentStatus retrieveStatus( + String paymentId, RetrieveStatusPaymentsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieveStatus(paymentId, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/payments/RawPaymentsClient.java b/src/main/java/com/whop/api/resources/payments/RawPaymentsClient.java new file mode 100644 index 00000000..c60991fb --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/RawPaymentsClient.java @@ -0,0 +1,1238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.payments.requests.ListFeesPaymentsRequest; +import com.whop.api.resources.payments.requests.ListPaymentsRequest; +import com.whop.api.resources.payments.requests.RefundPaymentsRequest; +import com.whop.api.resources.payments.requests.RetrievePaymentsRequest; +import com.whop.api.resources.payments.requests.RetrieveStatusPaymentsRequest; +import com.whop.api.resources.payments.requests.RetryPaymentsRequest; +import com.whop.api.resources.payments.requests.UpdateReturnUrlPaymentsRequest; +import com.whop.api.resources.payments.requests.VoidPaymentsRequest; +import com.whop.api.resources.payments.types.CreatePaymentsRequest; +import com.whop.api.resources.payments.types.CreatePaymentsResponse; +import com.whop.api.resources.payments.types.ListFeesPaymentsResponse; +import com.whop.api.resources.payments.types.ListFeesPaymentsResponseDataItem; +import com.whop.api.resources.payments.types.ListPaymentsResponse; +import com.whop.api.resources.payments.types.RetrievePaymentsResponse; +import com.whop.api.types.Payment; +import com.whop.api.types.PaymentListItem; +import com.whop.api.types.PaymentStatus; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPaymentsClient { + protected final ClientOptions clientOptions; + + public RawPaymentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list() { + return list(ListPaymentsRequest.builder().build()); + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListPaymentsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListPaymentsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of payments for the actor in context, with optional filtering by product, plan, status, billing reason, currency, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListPaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getIncludeFree().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "include_free", request.getIncludeFree().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getUpdatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "updated_before", request.getUpdatedBefore().get(), false); + } + if (request.getUpdatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "updated_after", request.getUpdatedAfter().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } + if (request.getBillingReasons().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "billing_reasons", request.getBillingReasons().get(), true); + } + if (request.getCurrencies().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currencies", request.getCurrencies().get(), true); + } + if (request.getPlanIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_ids", request.getPlanIds().get(), true); + } + if (request.getStatuses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "statuses", request.getStatuses().get(), true); + } + if (request.getSubstatuses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "substatuses", request.getSubstatuses().get(), true); + } + if (request.getCheckoutConfigurationIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "checkout_configuration_ids", + request.getCheckoutConfigurationIds().get(), + true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPaymentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPaymentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListPaymentsRequest nextRequest = ListPaymentsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Charge an existing member off-session using one of their stored payment methods. You can provide an existing plan, or create a new one in-line. This endpoint will respond with a payment object immediately, but the payment is processed asynchronously in the background. Use webhooks to be notified when the payment succeeds or fails. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • plan:create
  • + *
  • access_pass:create
  • + *
  • access_pass:update
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse create(CreatePaymentsRequest request) { + return create(request, null); + } + + /** + * Charge an existing member off-session using one of their stored payment methods. You can provide an existing plan, or create a new one in-line. This endpoint will respond with a payment object immediately, but the payment is processed asynchronously in the background. Use webhooks to be notified when the payment succeeds or fails. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • plan:create
  • + *
  • access_pass:create
  • + *
  • access_pass:update
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse create( + CreatePaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreatePaymentsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrievePaymentsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePaymentsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrievePaymentsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing payment. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrievePaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrievePaymentsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse> listFees(String id) { + return listFees(id, ListFeesPaymentsRequest.builder().build()); + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse> listFees( + String id, RequestOptions requestOptions) { + return listFees(id, ListFeesPaymentsRequest.builder().build(), requestOptions); + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse> listFees( + String id, ListFeesPaymentsRequest request) { + return listFees(id, request, null); + } + + /** + * Returns the list of fees associated with a specific payment, including platform fees and processing fees. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse> listFees( + String id, ListFeesPaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments") + .addPathSegment(id) + .addPathSegments("fees"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListFeesPaymentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListFeesPaymentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListFeesPaymentsRequest nextRequest = ListFeesPaymentsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> listFees( + id, nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse refund(String id) { + return refund(id, RefundPaymentsRequest.builder().build()); + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse refund(String id, RequestOptions requestOptions) { + return refund(id, RefundPaymentsRequest.builder().build(), requestOptions); + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse refund(String id, RefundPaymentsRequest request) { + return refund(id, request, null); + } + + /** + * Issue a full or partial refund for a payment. The refund is processed through the original payment processor and the membership status is updated accordingly. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse refund( + String id, RefundPaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments") + .addPathSegment(id) + .addPathSegments("refund"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Payment.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse retry(String id) { + return retry(id, RetryPaymentsRequest.builder().build()); + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse retry(String id, RequestOptions requestOptions) { + return retry(id, RetryPaymentsRequest.builder().build(), requestOptions); + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse retry(String id, RetryPaymentsRequest request) { + return retry(id, request, null); + } + + /** + * Retry a failed or pending payment. This re-attempts the charge using the original payment method and plan details. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse retry(String id, RetryPaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments") + .addPathSegment(id) + .addPathSegments("retry"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Payment.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse void_(String id) { + return void_(id, VoidPaymentsRequest.builder().build()); + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse void_(String id, RequestOptions requestOptions) { + return void_(id, VoidPaymentsRequest.builder().build(), requestOptions); + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse void_(String id, VoidPaymentsRequest request) { + return void_(id, request, null); + } + + /** + * Void a payment that has not yet been settled. Voiding cancels the payment before it is captured by the payment processor. + *

Required permissions:

+ *
    + *
  • payment:manage
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
  • promo_code:basic:read
  • + *
  • shipment:basic:read
  • + *
  • payment:dispute:read
  • + *
  • payment:resolution_center_case:read
  • + *
+ */ + public WhopApiHttpResponse void_(String id, VoidPaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments") + .addPathSegment(id) + .addPathSegments("void"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Payment.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the payment's own client_secret, so the surface that knows the final destination can set it. + */ + public WhopApiHttpResponse updateReturnUrl( + String paymentId, UpdateReturnUrlPaymentsRequest request) { + return updateReturnUrl(paymentId, request, null); + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the payment's own client_secret, so the surface that knows the final destination can set it. + */ + public WhopApiHttpResponse updateReturnUrl( + String paymentId, UpdateReturnUrlPaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments") + .addPathSegment(paymentId) + .addPathSegments("return_url"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaymentStatus.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public WhopApiHttpResponse retrieveStatus(String paymentId) { + return retrieveStatus(paymentId, RetrieveStatusPaymentsRequest.builder().build()); + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public WhopApiHttpResponse retrieveStatus(String paymentId, RequestOptions requestOptions) { + return retrieveStatus(paymentId, RetrieveStatusPaymentsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public WhopApiHttpResponse retrieveStatus(String paymentId, RetrieveStatusPaymentsRequest request) { + return retrieveStatus(paymentId, request, null); + } + + /** + * Retrieves how far a payment has got and what the buyer must do next, if anything. A payment is collected in the background, so poll this rather than reading the create response. Accepts either a secret key or the payment's own client_secret, so the surface collecting the payment can poll it directly. + */ + public WhopApiHttpResponse retrieveStatus( + String paymentId, RetrieveStatusPaymentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payments") + .addPathSegment(paymentId) + .addPathSegments("status"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaymentStatus.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/requests/ListFeesPaymentsRequest.java b/src/main/java/com/whop/api/resources/payments/requests/ListFeesPaymentsRequest.java new file mode 100644 index 00000000..87b8dce8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/requests/ListFeesPaymentsRequest.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListFeesPaymentsRequest.Builder.class) +public final class ListFeesPaymentsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Map additionalProperties; + + private ListFeesPaymentsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListFeesPaymentsRequest && equalTo((ListFeesPaymentsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListFeesPaymentsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListFeesPaymentsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + public ListFeesPaymentsRequest build() { + return new ListFeesPaymentsRequest(after, before, first, last, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/requests/ListPaymentsRequest.java b/src/main/java/com/whop/api/resources/payments/requests/ListPaymentsRequest.java new file mode 100644 index 00000000..de25ef4d --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/requests/ListPaymentsRequest.java @@ -0,0 +1,756 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.BillingReasons; +import com.whop.api.types.Currencies; +import com.whop.api.types.Direction; +import com.whop.api.types.FriendlyReceiptStatus; +import com.whop.api.types.ReceiptStatus; +import com.whop.api.types.ReceiptV2Order; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPaymentsRequest.Builder.class) +public final class ListPaymentsRequest { + private final Optional> productIds; + + private final Optional> billingReasons; + + private final Optional> currencies; + + private final Optional> planIds; + + private final Optional> statuses; + + private final Optional> substatuses; + + private final Optional> checkoutConfigurationIds; + + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Optional companyId; + + private final Optional direction; + + private final Optional order; + + private final Optional includeFree; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional updatedBefore; + + private final Optional updatedAfter; + + private final Optional query; + + private final Map additionalProperties; + + private ListPaymentsRequest( + Optional> productIds, + Optional> billingReasons, + Optional> currencies, + Optional> planIds, + Optional> statuses, + Optional> substatuses, + Optional> checkoutConfigurationIds, + Optional after, + Optional before, + Optional first, + Optional last, + Optional companyId, + Optional direction, + Optional order, + Optional includeFree, + Optional createdBefore, + Optional createdAfter, + Optional updatedBefore, + Optional updatedAfter, + Optional query, + Map additionalProperties) { + this.productIds = productIds; + this.billingReasons = billingReasons; + this.currencies = currencies; + this.planIds = planIds; + this.statuses = statuses; + this.substatuses = substatuses; + this.checkoutConfigurationIds = checkoutConfigurationIds; + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.direction = direction; + this.order = order; + this.includeFree = includeFree; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.updatedBefore = updatedBefore; + this.updatedAfter = updatedAfter; + this.query = query; + this.additionalProperties = additionalProperties; + } + + /** + * @return Filter payments to only those associated with these specific product identifiers. + */ + @JsonProperty("product_ids") + public Optional> getProductIds() { + return productIds; + } + + /** + * @return Filter payments by their billing reason. + */ + @JsonProperty("billing_reasons") + public Optional> getBillingReasons() { + return billingReasons; + } + + /** + * @return Filter payments by their currency code. + */ + @JsonProperty("currencies") + public Optional> getCurrencies() { + return currencies; + } + + /** + * @return Filter payments to only those associated with these specific plan identifiers. + */ + @JsonProperty("plan_ids") + public Optional> getPlanIds() { + return planIds; + } + + /** + * @return Filter payments by their current status. + */ + @JsonProperty("statuses") + public Optional> getStatuses() { + return statuses; + } + + /** + * @return Filter payments by their current substatus for more granular filtering. + */ + @JsonProperty("substatuses") + public Optional> getSubstatuses() { + return substatuses; + } + + /** + * @return Only return payments from these checkout configurations. + */ + @JsonProperty("checkout_configuration_ids") + public Optional> getCheckoutConfigurationIds() { + return checkoutConfigurationIds; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to list payments for. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Whether to include payments with a zero amount. + */ + @JsonProperty("include_free") + public Optional getIncludeFree() { + return includeFree; + } + + /** + * @return Only return payments created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return payments created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Only return payments last updated before this timestamp. + */ + @JsonProperty("updated_before") + public Optional getUpdatedBefore() { + return updatedBefore; + } + + /** + * @return Only return payments last updated after this timestamp. + */ + @JsonProperty("updated_after") + public Optional getUpdatedAfter() { + return updatedAfter; + } + + /** + * @return Search payments by user ID, membership ID, user email, name, or username. Email filtering requires the member:email:read permission. + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPaymentsRequest && equalTo((ListPaymentsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPaymentsRequest other) { + return productIds.equals(other.productIds) + && billingReasons.equals(other.billingReasons) + && currencies.equals(other.currencies) + && planIds.equals(other.planIds) + && statuses.equals(other.statuses) + && substatuses.equals(other.substatuses) + && checkoutConfigurationIds.equals(other.checkoutConfigurationIds) + && after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId) + && direction.equals(other.direction) + && order.equals(other.order) + && includeFree.equals(other.includeFree) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && updatedBefore.equals(other.updatedBefore) + && updatedAfter.equals(other.updatedAfter) + && query.equals(other.query); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.productIds, + this.billingReasons, + this.currencies, + this.planIds, + this.statuses, + this.substatuses, + this.checkoutConfigurationIds, + this.after, + this.before, + this.first, + this.last, + this.companyId, + this.direction, + this.order, + this.includeFree, + this.createdBefore, + this.createdAfter, + this.updatedBefore, + this.updatedAfter, + this.query); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> productIds = Optional.empty(); + + private Optional> billingReasons = Optional.empty(); + + private Optional> currencies = Optional.empty(); + + private Optional> planIds = Optional.empty(); + + private Optional> statuses = Optional.empty(); + + private Optional> substatuses = Optional.empty(); + + private Optional> checkoutConfigurationIds = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional companyId = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional includeFree = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional updatedBefore = Optional.empty(); + + private Optional updatedAfter = Optional.empty(); + + private Optional query = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListPaymentsRequest other) { + productIds(other.getProductIds()); + billingReasons(other.getBillingReasons()); + currencies(other.getCurrencies()); + planIds(other.getPlanIds()); + statuses(other.getStatuses()); + substatuses(other.getSubstatuses()); + checkoutConfigurationIds(other.getCheckoutConfigurationIds()); + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + direction(other.getDirection()); + order(other.getOrder()); + includeFree(other.getIncludeFree()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + updatedBefore(other.getUpdatedBefore()); + updatedAfter(other.getUpdatedAfter()); + query(other.getQuery()); + return this; + } + + /** + *

Filter payments to only those associated with these specific product identifiers.

+ */ + @JsonSetter(value = "product_ids", nulls = Nulls.SKIP) + public Builder productIds(Optional> productIds) { + this.productIds = productIds; + return this; + } + + public Builder productIds(List productIds) { + this.productIds = Optional.ofNullable(productIds); + return this; + } + + public Builder productIds(String productIds) { + this.productIds = Optional.of(Collections.singletonList(productIds)); + return this; + } + + /** + *

Filter payments by their billing reason.

+ */ + @JsonSetter(value = "billing_reasons", nulls = Nulls.SKIP) + public Builder billingReasons(Optional> billingReasons) { + this.billingReasons = billingReasons; + return this; + } + + public Builder billingReasons(List billingReasons) { + this.billingReasons = Optional.ofNullable(billingReasons); + return this; + } + + public Builder billingReasons(BillingReasons billingReasons) { + this.billingReasons = Optional.of(Collections.singletonList(billingReasons)); + return this; + } + + /** + *

Filter payments by their currency code.

+ */ + @JsonSetter(value = "currencies", nulls = Nulls.SKIP) + public Builder currencies(Optional> currencies) { + this.currencies = currencies; + return this; + } + + public Builder currencies(List currencies) { + this.currencies = Optional.ofNullable(currencies); + return this; + } + + public Builder currencies(Currencies currencies) { + this.currencies = Optional.of(Collections.singletonList(currencies)); + return this; + } + + /** + *

Filter payments to only those associated with these specific plan identifiers.

+ */ + @JsonSetter(value = "plan_ids", nulls = Nulls.SKIP) + public Builder planIds(Optional> planIds) { + this.planIds = planIds; + return this; + } + + public Builder planIds(List planIds) { + this.planIds = Optional.ofNullable(planIds); + return this; + } + + public Builder planIds(String planIds) { + this.planIds = Optional.of(Collections.singletonList(planIds)); + return this; + } + + /** + *

Filter payments by their current status.

+ */ + @JsonSetter(value = "statuses", nulls = Nulls.SKIP) + public Builder statuses(Optional> statuses) { + this.statuses = statuses; + return this; + } + + public Builder statuses(List statuses) { + this.statuses = Optional.ofNullable(statuses); + return this; + } + + public Builder statuses(ReceiptStatus statuses) { + this.statuses = Optional.of(Collections.singletonList(statuses)); + return this; + } + + /** + *

Filter payments by their current substatus for more granular filtering.

+ */ + @JsonSetter(value = "substatuses", nulls = Nulls.SKIP) + public Builder substatuses(Optional> substatuses) { + this.substatuses = substatuses; + return this; + } + + public Builder substatuses(List substatuses) { + this.substatuses = Optional.ofNullable(substatuses); + return this; + } + + public Builder substatuses(FriendlyReceiptStatus substatuses) { + this.substatuses = Optional.of(Collections.singletonList(substatuses)); + return this; + } + + /** + *

Only return payments from these checkout configurations.

+ */ + @JsonSetter(value = "checkout_configuration_ids", nulls = Nulls.SKIP) + public Builder checkoutConfigurationIds(Optional> checkoutConfigurationIds) { + this.checkoutConfigurationIds = checkoutConfigurationIds; + return this; + } + + public Builder checkoutConfigurationIds(List checkoutConfigurationIds) { + this.checkoutConfigurationIds = Optional.ofNullable(checkoutConfigurationIds); + return this; + } + + public Builder checkoutConfigurationIds(String checkoutConfigurationIds) { + this.checkoutConfigurationIds = Optional.of(Collections.singletonList(checkoutConfigurationIds)); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The unique identifier of the company to list payments for.

+ */ + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(Direction direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ReceiptV2Order order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Whether to include payments with a zero amount.

+ */ + @JsonSetter(value = "include_free", nulls = Nulls.SKIP) + public Builder includeFree(Optional includeFree) { + this.includeFree = includeFree; + return this; + } + + public Builder includeFree(Boolean includeFree) { + this.includeFree = Optional.ofNullable(includeFree); + return this; + } + + /** + *

Only return payments created before this timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return payments created after this timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only return payments last updated before this timestamp.

+ */ + @JsonSetter(value = "updated_before", nulls = Nulls.SKIP) + public Builder updatedBefore(Optional updatedBefore) { + this.updatedBefore = updatedBefore; + return this; + } + + public Builder updatedBefore(OffsetDateTime updatedBefore) { + this.updatedBefore = Optional.ofNullable(updatedBefore); + return this; + } + + /** + *

Only return payments last updated after this timestamp.

+ */ + @JsonSetter(value = "updated_after", nulls = Nulls.SKIP) + public Builder updatedAfter(Optional updatedAfter) { + this.updatedAfter = updatedAfter; + return this; + } + + public Builder updatedAfter(OffsetDateTime updatedAfter) { + this.updatedAfter = Optional.ofNullable(updatedAfter); + return this; + } + + /** + *

Search payments by user ID, membership ID, user email, name, or username. Email filtering requires the member:email:read permission.

+ */ + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public Builder query(Optional query) { + this.query = query; + return this; + } + + public Builder query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + public ListPaymentsRequest build() { + return new ListPaymentsRequest( + productIds, + billingReasons, + currencies, + planIds, + statuses, + substatuses, + checkoutConfigurationIds, + after, + before, + first, + last, + companyId, + direction, + order, + includeFree, + createdBefore, + createdAfter, + updatedBefore, + updatedAfter, + query, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/requests/RefundPaymentsRequest.java b/src/main/java/com/whop/api/resources/payments/requests/RefundPaymentsRequest.java new file mode 100644 index 00000000..078edb53 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/requests/RefundPaymentsRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RefundPaymentsRequest.Builder.class) +public final class RefundPaymentsRequest { + private final Optional partialAmount; + + private final Map additionalProperties; + + private RefundPaymentsRequest(Optional partialAmount, Map additionalProperties) { + this.partialAmount = partialAmount; + this.additionalProperties = additionalProperties; + } + + /** + * @return The amount to refund. For multi-currency payments, this is in the charge currency (what the buyer paid). For single-currency, this is in the payment currency. If omitted, the full payment amount is refunded. + */ + @JsonIgnore + public Optional getPartialAmount() { + if (partialAmount == null) { + return Optional.empty(); + } + return partialAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("partial_amount") + private Optional _getPartialAmount() { + return partialAmount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RefundPaymentsRequest && equalTo((RefundPaymentsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RefundPaymentsRequest other) { + return partialAmount.equals(other.partialAmount); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.partialAmount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional partialAmount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RefundPaymentsRequest other) { + partialAmount(other.getPartialAmount()); + return this; + } + + /** + *

The amount to refund. For multi-currency payments, this is in the charge currency (what the buyer paid). For single-currency, this is in the payment currency. If omitted, the full payment amount is refunded.

+ */ + @JsonSetter(value = "partial_amount", nulls = Nulls.SKIP) + public Builder partialAmount(Optional partialAmount) { + this.partialAmount = partialAmount; + return this; + } + + public Builder partialAmount(Double partialAmount) { + this.partialAmount = Optional.ofNullable(partialAmount); + return this; + } + + public Builder partialAmount(Nullable partialAmount) { + if (partialAmount.isNull()) { + this.partialAmount = null; + } else if (partialAmount.isEmpty()) { + this.partialAmount = Optional.empty(); + } else { + this.partialAmount = Optional.of(partialAmount.get()); + } + return this; + } + + public RefundPaymentsRequest build() { + return new RefundPaymentsRequest(partialAmount, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/requests/RetrievePaymentsRequest.java b/src/main/java/com/whop/api/resources/payments/requests/RetrievePaymentsRequest.java new file mode 100644 index 00000000..30b2a26c --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/requests/RetrievePaymentsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePaymentsRequest.Builder.class) +public final class RetrievePaymentsRequest { + private final Map additionalProperties; + + private RetrievePaymentsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePaymentsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePaymentsRequest other) { + return this; + } + + public RetrievePaymentsRequest build() { + return new RetrievePaymentsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/requests/RetrieveStatusPaymentsRequest.java b/src/main/java/com/whop/api/resources/payments/requests/RetrieveStatusPaymentsRequest.java new file mode 100644 index 00000000..4fad0fdb --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/requests/RetrieveStatusPaymentsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveStatusPaymentsRequest.Builder.class) +public final class RetrieveStatusPaymentsRequest { + private final Map additionalProperties; + + private RetrieveStatusPaymentsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveStatusPaymentsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveStatusPaymentsRequest other) { + return this; + } + + public RetrieveStatusPaymentsRequest build() { + return new RetrieveStatusPaymentsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/requests/RetryPaymentsRequest.java b/src/main/java/com/whop/api/resources/payments/requests/RetryPaymentsRequest.java new file mode 100644 index 00000000..de1a18b6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/requests/RetryPaymentsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetryPaymentsRequest.Builder.class) +public final class RetryPaymentsRequest { + private final Map additionalProperties; + + private RetryPaymentsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetryPaymentsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetryPaymentsRequest other) { + return this; + } + + public RetryPaymentsRequest build() { + return new RetryPaymentsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/requests/UpdateReturnUrlPaymentsRequest.java b/src/main/java/com/whop/api/resources/payments/requests/UpdateReturnUrlPaymentsRequest.java new file mode 100644 index 00000000..3d91bd0e --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/requests/UpdateReturnUrlPaymentsRequest.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateReturnUrlPaymentsRequest.Builder.class) +public final class UpdateReturnUrlPaymentsRequest { + private final String returnUrl; + + private final Map additionalProperties; + + private UpdateReturnUrlPaymentsRequest(String returnUrl, Map additionalProperties) { + this.returnUrl = returnUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. + */ + @JsonProperty("return_url") + public String getReturnUrl() { + return returnUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateReturnUrlPaymentsRequest && equalTo((UpdateReturnUrlPaymentsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateReturnUrlPaymentsRequest other) { + return returnUrl.equals(other.returnUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.returnUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ReturnUrlStage builder() { + return new Builder(); + } + + public interface ReturnUrlStage { + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters.

+ */ + _FinalStage returnUrl(@NotNull String returnUrl); + + Builder from(UpdateReturnUrlPaymentsRequest other); + } + + public interface _FinalStage { + UpdateReturnUrlPaymentsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ReturnUrlStage, _FinalStage { + private String returnUrl; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateReturnUrlPaymentsRequest other) { + returnUrl(other.getReturnUrl()); + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters.

+ *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("return_url") + public _FinalStage returnUrl(@NotNull String returnUrl) { + this.returnUrl = Objects.requireNonNull(returnUrl, "returnUrl must not be null"); + return this; + } + + @java.lang.Override + public UpdateReturnUrlPaymentsRequest build() { + return new UpdateReturnUrlPaymentsRequest(returnUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/requests/VoidPaymentsRequest.java b/src/main/java/com/whop/api/resources/payments/requests/VoidPaymentsRequest.java new file mode 100644 index 00000000..9e1cdbeb --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/requests/VoidPaymentsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = VoidPaymentsRequest.Builder.class) +public final class VoidPaymentsRequest { + private final Map additionalProperties; + + private VoidPaymentsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoidPaymentsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(VoidPaymentsRequest other) { + return this; + } + + public VoidPaymentsRequest build() { + return new VoidPaymentsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequest.java b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequest.java new file mode 100644 index 00000000..5905a92d --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequest.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Map; +import java.util.Objects; + +@JsonDeserialize(using = CreatePaymentsRequest.Deserializer.class) +public final class CreatePaymentsRequest { + private final Object value; + + private final int type; + + private CreatePaymentsRequest(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((CreatePaymentsRequestZero) this.value); + } else if (this.type == 1) { + return visitor.visit((CreatePaymentsRequestOne) this.value); + } else if (this.type == 2) { + return visitor.visit((CreatePaymentsRequestTwo) this.value); + } else if (this.type == 3) { + return visitor.visit((CreatePaymentsRequestThree) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePaymentsRequest && equalTo((CreatePaymentsRequest) other); + } + + private boolean equalTo(CreatePaymentsRequest other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static CreatePaymentsRequest of(CreatePaymentsRequestZero value) { + return new CreatePaymentsRequest(value, 0); + } + + public static CreatePaymentsRequest of(CreatePaymentsRequestOne value) { + return new CreatePaymentsRequest(value, 1); + } + + public static CreatePaymentsRequest of(CreatePaymentsRequestTwo value) { + return new CreatePaymentsRequest(value, 2); + } + + public static CreatePaymentsRequest of(CreatePaymentsRequestThree value) { + return new CreatePaymentsRequest(value, 3); + } + + public interface Visitor { + T visit(CreatePaymentsRequestZero value); + + T visit(CreatePaymentsRequestOne value); + + T visit(CreatePaymentsRequestTwo value); + + T visit(CreatePaymentsRequestThree value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(CreatePaymentsRequest.class); + } + + @java.lang.Override + public CreatePaymentsRequest deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Map + && ((Map) value).containsKey("company_id") + && ((Map) value).containsKey("confirmation_token") + && ((Map) value).containsKey("plan")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, CreatePaymentsRequestZero.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map + && ((Map) value).containsKey("company_id") + && ((Map) value).containsKey("member_id") + && ((Map) value).containsKey("plan")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, CreatePaymentsRequestOne.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map + && ((Map) value).containsKey("company_id") + && ((Map) value).containsKey("confirmation_token") + && ((Map) value).containsKey("plan_id")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, CreatePaymentsRequestTwo.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map + && ((Map) value).containsKey("company_id") + && ((Map) value).containsKey("member_id") + && ((Map) value).containsKey("plan_id")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, CreatePaymentsRequestThree.class)); + } catch (RuntimeException e) { + } + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestOne.java b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestOne.java new file mode 100644 index 00000000..e189ed1c --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestOne.java @@ -0,0 +1,573 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePaymentsRequestOne.Builder.class) +public final class CreatePaymentsRequestOne { + private final String companyId; + + private final Optional email; + + private final String memberId; + + private final Optional> metadata; + + private final Optional paymentMethodId; + + private final CreatePaymentsRequestOnePlan plan; + + private final Optional promoCodeId; + + private final Optional returnUrl; + + private final Map additionalProperties; + + private CreatePaymentsRequestOne( + String companyId, + Optional email, + String memberId, + Optional> metadata, + Optional paymentMethodId, + CreatePaymentsRequestOnePlan plan, + Optional promoCodeId, + Optional returnUrl, + Map additionalProperties) { + this.companyId = companyId; + this.email = email; + this.memberId = memberId; + this.metadata = metadata; + this.paymentMethodId = paymentMethodId; + this.plan = plan; + this.promoCodeId = promoCodeId; + this.returnUrl = returnUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the company to create the payment for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The ID of the member to create the payment for. Required unless confirmation_token is provided. + */ + @JsonProperty("member_id") + public String getMemberId() { + return memberId; + } + + /** + * @return Custom metadata to attach to the payment. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided. + */ + @JsonIgnore + public Optional getPaymentMethodId() { + if (paymentMethodId == null) { + return Optional.empty(); + } + return paymentMethodId; + } + + /** + * @return Pass this object to create a new plan for this payment + */ + @JsonProperty("plan") + public CreatePaymentsRequestOnePlan getPlan() { + return plan; + } + + /** + * @return The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases. + */ + @JsonIgnore + public Optional getPromoCodeId() { + if (promoCodeId == null) { + return Optional.empty(); + } + return promoCodeId; + } + + /** + * @return Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided. + */ + @JsonIgnore + public Optional getReturnUrl() { + if (returnUrl == null) { + return Optional.empty(); + } + return returnUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_id") + private Optional _getPaymentMethodId() { + return paymentMethodId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("promo_code_id") + private Optional _getPromoCodeId() { + return promoCodeId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("return_url") + private Optional _getReturnUrl() { + return returnUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePaymentsRequestOne && equalTo((CreatePaymentsRequestOne) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePaymentsRequestOne other) { + return companyId.equals(other.companyId) + && email.equals(other.email) + && memberId.equals(other.memberId) + && metadata.equals(other.metadata) + && paymentMethodId.equals(other.paymentMethodId) + && plan.equals(other.plan) + && promoCodeId.equals(other.promoCodeId) + && returnUrl.equals(other.returnUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyId, + this.email, + this.memberId, + this.metadata, + this.paymentMethodId, + this.plan, + this.promoCodeId, + this.returnUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The ID of the company to create the payment for.

+ */ + MemberIdStage companyId(@NotNull String companyId); + + Builder from(CreatePaymentsRequestOne other); + } + + public interface MemberIdStage { + /** + *

The ID of the member to create the payment for. Required unless confirmation_token is provided.

+ */ + PlanStage memberId(@NotNull String memberId); + } + + public interface PlanStage { + /** + *

Pass this object to create a new plan for this payment

+ */ + _FinalStage plan(@NotNull CreatePaymentsRequestOnePlan plan); + } + + public interface _FinalStage { + CreatePaymentsRequestOne build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

Custom metadata to attach to the payment.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ */ + _FinalStage paymentMethodId(Optional paymentMethodId); + + _FinalStage paymentMethodId(String paymentMethodId); + + _FinalStage paymentMethodId(Nullable paymentMethodId); + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ */ + _FinalStage promoCodeId(Optional promoCodeId); + + _FinalStage promoCodeId(String promoCodeId); + + _FinalStage promoCodeId(Nullable promoCodeId); + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ */ + _FinalStage returnUrl(Optional returnUrl); + + _FinalStage returnUrl(String returnUrl); + + _FinalStage returnUrl(Nullable returnUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, MemberIdStage, PlanStage, _FinalStage { + private String companyId; + + private String memberId; + + private CreatePaymentsRequestOnePlan plan; + + private Optional returnUrl = Optional.empty(); + + private Optional promoCodeId = Optional.empty(); + + private Optional paymentMethodId = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePaymentsRequestOne other) { + companyId(other.getCompanyId()); + email(other.getEmail()); + memberId(other.getMemberId()); + metadata(other.getMetadata()); + paymentMethodId(other.getPaymentMethodId()); + plan(other.getPlan()); + promoCodeId(other.getPromoCodeId()); + returnUrl(other.getReturnUrl()); + return this; + } + + /** + *

The ID of the company to create the payment for.

+ *

The ID of the company to create the payment for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public MemberIdStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The ID of the member to create the payment for. Required unless confirmation_token is provided.

+ *

The ID of the member to create the payment for. Required unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("member_id") + public PlanStage memberId(@NotNull String memberId) { + this.memberId = Objects.requireNonNull(memberId, "memberId must not be null"); + return this; + } + + /** + *

Pass this object to create a new plan for this payment

+ *

Pass this object to create a new plan for this payment

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan") + public _FinalStage plan(@NotNull CreatePaymentsRequestOnePlan plan) { + this.plan = Objects.requireNonNull(plan, "plan must not be null"); + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(Nullable returnUrl) { + if (returnUrl.isNull()) { + this.returnUrl = null; + } else if (returnUrl.isEmpty()) { + this.returnUrl = Optional.empty(); + } else { + this.returnUrl = Optional.of(returnUrl.get()); + } + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(String returnUrl) { + this.returnUrl = Optional.ofNullable(returnUrl); + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "return_url", nulls = Nulls.SKIP) + public _FinalStage returnUrl(Optional returnUrl) { + this.returnUrl = returnUrl; + return this; + } + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCodeId(Nullable promoCodeId) { + if (promoCodeId.isNull()) { + this.promoCodeId = null; + } else if (promoCodeId.isEmpty()) { + this.promoCodeId = Optional.empty(); + } else { + this.promoCodeId = Optional.of(promoCodeId.get()); + } + return this; + } + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCodeId(String promoCodeId) { + this.promoCodeId = Optional.ofNullable(promoCodeId); + return this; + } + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ */ + @java.lang.Override + @JsonSetter(value = "promo_code_id", nulls = Nulls.SKIP) + public _FinalStage promoCodeId(Optional promoCodeId) { + this.promoCodeId = promoCodeId; + return this; + } + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodId(Nullable paymentMethodId) { + if (paymentMethodId.isNull()) { + this.paymentMethodId = null; + } else if (paymentMethodId.isEmpty()) { + this.paymentMethodId = Optional.empty(); + } else { + this.paymentMethodId = Optional.of(paymentMethodId.get()); + } + return this; + } + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodId(String paymentMethodId) { + this.paymentMethodId = Optional.ofNullable(paymentMethodId); + return this; + } + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_id", nulls = Nulls.SKIP) + public _FinalStage paymentMethodId(Optional paymentMethodId) { + this.paymentMethodId = paymentMethodId; + return this; + } + + /** + *

Custom metadata to attach to the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom metadata to attach to the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom metadata to attach to the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public CreatePaymentsRequestOne build() { + return new CreatePaymentsRequestOne( + companyId, + email, + memberId, + metadata, + paymentMethodId, + plan, + promoCodeId, + returnUrl, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestOnePlan.java b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestOnePlan.java new file mode 100644 index 00000000..ca82c0aa --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestOnePlan.java @@ -0,0 +1,1150 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Currencies; +import com.whop.api.types.PlanTypes; +import com.whop.api.types.Visibility; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePaymentsRequestOnePlan.Builder.class) +public final class CreatePaymentsRequestOnePlan { + private final Optional applicationFeeAmount; + + private final Optional billingPeriod; + + private final Currencies currency; + + private final Optional description; + + private final Optional expirationDays; + + private final Optional forceCreateNewPlan; + + private final Optional initialPrice; + + private final Optional internalNotes; + + private final Optional planType; + + private final Optional product; + + private final Optional productId; + + private final Optional renewalPrice; + + private final Optional title; + + private final Optional trialPeriodDays; + + private final Optional visibility; + + private final Map additionalProperties; + + private CreatePaymentsRequestOnePlan( + Optional applicationFeeAmount, + Optional billingPeriod, + Currencies currency, + Optional description, + Optional expirationDays, + Optional forceCreateNewPlan, + Optional initialPrice, + Optional internalNotes, + Optional planType, + Optional product, + Optional productId, + Optional renewalPrice, + Optional title, + Optional trialPeriodDays, + Optional visibility, + Map additionalProperties) { + this.applicationFeeAmount = applicationFeeAmount; + this.billingPeriod = billingPeriod; + this.currency = currency; + this.description = description; + this.expirationDays = expirationDays; + this.forceCreateNewPlan = forceCreateNewPlan; + this.initialPrice = initialPrice; + this.internalNotes = internalNotes; + this.planType = planType; + this.product = product; + this.productId = productId; + this.renewalPrice = renewalPrice; + this.title = title; + this.trialPeriodDays = trialPeriodDays; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return The application fee amount collected by the platform from this connected account. Provided as a number in dollars (e.g., 5.00 for $5.00). Must be less than the total payment amount. Only valid for connected accounts with a parent company. + */ + @JsonIgnore + public Optional getApplicationFeeAmount() { + if (applicationFeeAmount == null) { + return Optional.empty(); + } + return applicationFeeAmount; + } + + /** + * @return The interval in days at which the plan charges (renewal plans). For example, 30 for monthly billing. + */ + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + /** + * @return The respective currency identifier for the plan. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The description of the plan. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The number of days until the membership expires and revokes access (expiration plans). For example, 365 for one year. + */ + @JsonIgnore + public Optional getExpirationDays() { + if (expirationDays == null) { + return Optional.empty(); + } + return expirationDays; + } + + /** + * @return Whether to force the creation of a new plan even if one with the same attributes already exists. + */ + @JsonIgnore + public Optional getForceCreateNewPlan() { + if (forceCreateNewPlan == null) { + return Optional.empty(); + } + return forceCreateNewPlan; + } + + /** + * @return An additional amount charged upon first purchase. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD. + */ + @JsonIgnore + public Optional getInitialPrice() { + if (initialPrice == null) { + return Optional.empty(); + } + return initialPrice; + } + + /** + * @return A personal description or notes section for the business. + */ + @JsonIgnore + public Optional getInternalNotes() { + if (internalNotes == null) { + return Optional.empty(); + } + return internalNotes; + } + + /** + * @return Indicates if the plan is a one time payment or recurring. + */ + @JsonIgnore + public Optional getPlanType() { + if (planType == null) { + return Optional.empty(); + } + return planType; + } + + /** + * @return Pass this object to create a new product for this plan. We will use the product external identifier to find or create an existing product. + */ + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return The product the plan is related to. Either this or product is required. + */ + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + /** + * @return The amount the customer is charged every billing period. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD. + */ + @JsonIgnore + public Optional getRenewalPrice() { + if (renewalPrice == null) { + return Optional.empty(); + } + return renewalPrice; + } + + /** + * @return The title of the plan. This will be visible on the product page to customers. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The number of free trial days added before a renewal plan. + */ + @JsonIgnore + public Optional getTrialPeriodDays() { + if (trialPeriodDays == null) { + return Optional.empty(); + } + return trialPeriodDays; + } + + /** + * @return Shows or hides the plan from public/business view. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("application_fee_amount") + private Optional _getApplicationFeeAmount() { + return applicationFeeAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_days") + private Optional _getExpirationDays() { + return expirationDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("force_create_new_plan") + private Optional _getForceCreateNewPlan() { + return forceCreateNewPlan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("initial_price") + private Optional _getInitialPrice() { + return initialPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("internal_notes") + private Optional _getInternalNotes() { + return internalNotes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan_type") + private Optional _getPlanType() { + return planType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("renewal_price") + private Optional _getRenewalPrice() { + return renewalPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trial_period_days") + private Optional _getTrialPeriodDays() { + return trialPeriodDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePaymentsRequestOnePlan && equalTo((CreatePaymentsRequestOnePlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePaymentsRequestOnePlan other) { + return applicationFeeAmount.equals(other.applicationFeeAmount) + && billingPeriod.equals(other.billingPeriod) + && currency.equals(other.currency) + && description.equals(other.description) + && expirationDays.equals(other.expirationDays) + && forceCreateNewPlan.equals(other.forceCreateNewPlan) + && initialPrice.equals(other.initialPrice) + && internalNotes.equals(other.internalNotes) + && planType.equals(other.planType) + && product.equals(other.product) + && productId.equals(other.productId) + && renewalPrice.equals(other.renewalPrice) + && title.equals(other.title) + && trialPeriodDays.equals(other.trialPeriodDays) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.applicationFeeAmount, + this.billingPeriod, + this.currency, + this.description, + this.expirationDays, + this.forceCreateNewPlan, + this.initialPrice, + this.internalNotes, + this.planType, + this.product, + this.productId, + this.renewalPrice, + this.title, + this.trialPeriodDays, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + /** + *

The respective currency identifier for the plan.

+ */ + _FinalStage currency(@NotNull Currencies currency); + + Builder from(CreatePaymentsRequestOnePlan other); + } + + public interface _FinalStage { + CreatePaymentsRequestOnePlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The application fee amount collected by the platform from this connected account. Provided as a number in dollars (e.g., 5.00 for $5.00). Must be less than the total payment amount. Only valid for connected accounts with a parent company.

+ */ + _FinalStage applicationFeeAmount(Optional applicationFeeAmount); + + _FinalStage applicationFeeAmount(Double applicationFeeAmount); + + _FinalStage applicationFeeAmount(Nullable applicationFeeAmount); + + /** + *

The interval in days at which the plan charges (renewal plans). For example, 30 for monthly billing.

+ */ + _FinalStage billingPeriod(Optional billingPeriod); + + _FinalStage billingPeriod(Integer billingPeriod); + + _FinalStage billingPeriod(Nullable billingPeriod); + + /** + *

The description of the plan.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

The number of days until the membership expires and revokes access (expiration plans). For example, 365 for one year.

+ */ + _FinalStage expirationDays(Optional expirationDays); + + _FinalStage expirationDays(Integer expirationDays); + + _FinalStage expirationDays(Nullable expirationDays); + + /** + *

Whether to force the creation of a new plan even if one with the same attributes already exists.

+ */ + _FinalStage forceCreateNewPlan(Optional forceCreateNewPlan); + + _FinalStage forceCreateNewPlan(Boolean forceCreateNewPlan); + + _FinalStage forceCreateNewPlan(Nullable forceCreateNewPlan); + + /** + *

An additional amount charged upon first purchase. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ */ + _FinalStage initialPrice(Optional initialPrice); + + _FinalStage initialPrice(Double initialPrice); + + _FinalStage initialPrice(Nullable initialPrice); + + /** + *

A personal description or notes section for the business.

+ */ + _FinalStage internalNotes(Optional internalNotes); + + _FinalStage internalNotes(String internalNotes); + + _FinalStage internalNotes(Nullable internalNotes); + + /** + *

Indicates if the plan is a one time payment or recurring.

+ */ + _FinalStage planType(Optional planType); + + _FinalStage planType(PlanTypes planType); + + _FinalStage planType(Nullable planType); + + /** + *

Pass this object to create a new product for this plan. We will use the product external identifier to find or create an existing product.

+ */ + _FinalStage product(Optional product); + + _FinalStage product(CreatePaymentsRequestOnePlanProduct product); + + _FinalStage product(Nullable product); + + /** + *

The product the plan is related to. Either this or product is required.

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + + _FinalStage productId(Nullable productId); + + /** + *

The amount the customer is charged every billing period. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ */ + _FinalStage renewalPrice(Optional renewalPrice); + + _FinalStage renewalPrice(Double renewalPrice); + + _FinalStage renewalPrice(Nullable renewalPrice); + + /** + *

The title of the plan. This will be visible on the product page to customers.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + + /** + *

The number of free trial days added before a renewal plan.

+ */ + _FinalStage trialPeriodDays(Optional trialPeriodDays); + + _FinalStage trialPeriodDays(Integer trialPeriodDays); + + _FinalStage trialPeriodDays(Nullable trialPeriodDays); + + /** + *

Shows or hides the plan from public/business view.

+ */ + _FinalStage visibility(Optional visibility); + + _FinalStage visibility(Visibility visibility); + + _FinalStage visibility(Nullable visibility); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, _FinalStage { + private Currencies currency; + + private Optional visibility = Optional.empty(); + + private Optional trialPeriodDays = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional renewalPrice = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional product = Optional.empty(); + + private Optional planType = Optional.empty(); + + private Optional internalNotes = Optional.empty(); + + private Optional initialPrice = Optional.empty(); + + private Optional forceCreateNewPlan = Optional.empty(); + + private Optional expirationDays = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional billingPeriod = Optional.empty(); + + private Optional applicationFeeAmount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePaymentsRequestOnePlan other) { + applicationFeeAmount(other.getApplicationFeeAmount()); + billingPeriod(other.getBillingPeriod()); + currency(other.getCurrency()); + description(other.getDescription()); + expirationDays(other.getExpirationDays()); + forceCreateNewPlan(other.getForceCreateNewPlan()); + initialPrice(other.getInitialPrice()); + internalNotes(other.getInternalNotes()); + planType(other.getPlanType()); + product(other.getProduct()); + productId(other.getProductId()); + renewalPrice(other.getRenewalPrice()); + title(other.getTitle()); + trialPeriodDays(other.getTrialPeriodDays()); + visibility(other.getVisibility()); + return this; + } + + /** + *

The respective currency identifier for the plan.

+ *

The respective currency identifier for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Shows or hides the plan from public/business view.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + /** + *

Shows or hides the plan from public/business view.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(Visibility visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + /** + *

Shows or hides the plan from public/business view.

+ */ + @java.lang.Override + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public _FinalStage visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + /** + *

The number of free trial days added before a renewal plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Nullable trialPeriodDays) { + if (trialPeriodDays.isNull()) { + this.trialPeriodDays = null; + } else if (trialPeriodDays.isEmpty()) { + this.trialPeriodDays = Optional.empty(); + } else { + this.trialPeriodDays = Optional.of(trialPeriodDays.get()); + } + return this; + } + + /** + *

The number of free trial days added before a renewal plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Integer trialPeriodDays) { + this.trialPeriodDays = Optional.ofNullable(trialPeriodDays); + return this; + } + + /** + *

The number of free trial days added before a renewal plan.

+ */ + @java.lang.Override + @JsonSetter(value = "trial_period_days", nulls = Nulls.SKIP) + public _FinalStage trialPeriodDays(Optional trialPeriodDays) { + this.trialPeriodDays = trialPeriodDays; + return this; + } + + /** + *

The title of the plan. This will be visible on the product page to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

The title of the plan. This will be visible on the product page to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The title of the plan. This will be visible on the product page to customers.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

The amount the customer is charged every billing period. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage renewalPrice(Nullable renewalPrice) { + if (renewalPrice.isNull()) { + this.renewalPrice = null; + } else if (renewalPrice.isEmpty()) { + this.renewalPrice = Optional.empty(); + } else { + this.renewalPrice = Optional.of(renewalPrice.get()); + } + return this; + } + + /** + *

The amount the customer is charged every billing period. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage renewalPrice(Double renewalPrice) { + this.renewalPrice = Optional.ofNullable(renewalPrice); + return this; + } + + /** + *

The amount the customer is charged every billing period. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ */ + @java.lang.Override + @JsonSetter(value = "renewal_price", nulls = Nulls.SKIP) + public _FinalStage renewalPrice(Optional renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + /** + *

The product the plan is related to. Either this or product is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + /** + *

The product the plan is related to. Either this or product is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

The product the plan is related to. Either this or product is required.

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

Pass this object to create a new product for this plan. We will use the product external identifier to find or create an existing product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

Pass this object to create a new product for this plan. We will use the product external identifier to find or create an existing product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(CreatePaymentsRequestOnePlanProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

Pass this object to create a new product for this plan. We will use the product external identifier to find or create an existing product.

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

Indicates if the plan is a one time payment or recurring.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planType(Nullable planType) { + if (planType.isNull()) { + this.planType = null; + } else if (planType.isEmpty()) { + this.planType = Optional.empty(); + } else { + this.planType = Optional.of(planType.get()); + } + return this; + } + + /** + *

Indicates if the plan is a one time payment or recurring.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planType(PlanTypes planType) { + this.planType = Optional.ofNullable(planType); + return this; + } + + /** + *

Indicates if the plan is a one time payment or recurring.

+ */ + @java.lang.Override + @JsonSetter(value = "plan_type", nulls = Nulls.SKIP) + public _FinalStage planType(Optional planType) { + this.planType = planType; + return this; + } + + /** + *

A personal description or notes section for the business.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage internalNotes(Nullable internalNotes) { + if (internalNotes.isNull()) { + this.internalNotes = null; + } else if (internalNotes.isEmpty()) { + this.internalNotes = Optional.empty(); + } else { + this.internalNotes = Optional.of(internalNotes.get()); + } + return this; + } + + /** + *

A personal description or notes section for the business.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage internalNotes(String internalNotes) { + this.internalNotes = Optional.ofNullable(internalNotes); + return this; + } + + /** + *

A personal description or notes section for the business.

+ */ + @java.lang.Override + @JsonSetter(value = "internal_notes", nulls = Nulls.SKIP) + public _FinalStage internalNotes(Optional internalNotes) { + this.internalNotes = internalNotes; + return this; + } + + /** + *

An additional amount charged upon first purchase. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage initialPrice(Nullable initialPrice) { + if (initialPrice.isNull()) { + this.initialPrice = null; + } else if (initialPrice.isEmpty()) { + this.initialPrice = Optional.empty(); + } else { + this.initialPrice = Optional.of(initialPrice.get()); + } + return this; + } + + /** + *

An additional amount charged upon first purchase. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage initialPrice(Double initialPrice) { + this.initialPrice = Optional.ofNullable(initialPrice); + return this; + } + + /** + *

An additional amount charged upon first purchase. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ */ + @java.lang.Override + @JsonSetter(value = "initial_price", nulls = Nulls.SKIP) + public _FinalStage initialPrice(Optional initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + /** + *

Whether to force the creation of a new plan even if one with the same attributes already exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage forceCreateNewPlan(Nullable forceCreateNewPlan) { + if (forceCreateNewPlan.isNull()) { + this.forceCreateNewPlan = null; + } else if (forceCreateNewPlan.isEmpty()) { + this.forceCreateNewPlan = Optional.empty(); + } else { + this.forceCreateNewPlan = Optional.of(forceCreateNewPlan.get()); + } + return this; + } + + /** + *

Whether to force the creation of a new plan even if one with the same attributes already exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage forceCreateNewPlan(Boolean forceCreateNewPlan) { + this.forceCreateNewPlan = Optional.ofNullable(forceCreateNewPlan); + return this; + } + + /** + *

Whether to force the creation of a new plan even if one with the same attributes already exists.

+ */ + @java.lang.Override + @JsonSetter(value = "force_create_new_plan", nulls = Nulls.SKIP) + public _FinalStage forceCreateNewPlan(Optional forceCreateNewPlan) { + this.forceCreateNewPlan = forceCreateNewPlan; + return this; + } + + /** + *

The number of days until the membership expires and revokes access (expiration plans). For example, 365 for one year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Nullable expirationDays) { + if (expirationDays.isNull()) { + this.expirationDays = null; + } else if (expirationDays.isEmpty()) { + this.expirationDays = Optional.empty(); + } else { + this.expirationDays = Optional.of(expirationDays.get()); + } + return this; + } + + /** + *

The number of days until the membership expires and revokes access (expiration plans). For example, 365 for one year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Integer expirationDays) { + this.expirationDays = Optional.ofNullable(expirationDays); + return this; + } + + /** + *

The number of days until the membership expires and revokes access (expiration plans). For example, 365 for one year.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_days", nulls = Nulls.SKIP) + public _FinalStage expirationDays(Optional expirationDays) { + this.expirationDays = expirationDays; + return this; + } + + /** + *

The description of the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

The description of the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

The description of the plan.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

The interval in days at which the plan charges (renewal plans). For example, 30 for monthly billing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + /** + *

The interval in days at which the plan charges (renewal plans). For example, 30 for monthly billing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Integer billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + /** + *

The interval in days at which the plan charges (renewal plans). For example, 30 for monthly billing.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public _FinalStage billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + /** + *

The application fee amount collected by the platform from this connected account. Provided as a number in dollars (e.g., 5.00 for $5.00). Must be less than the total payment amount. Only valid for connected accounts with a parent company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage applicationFeeAmount(Nullable applicationFeeAmount) { + if (applicationFeeAmount.isNull()) { + this.applicationFeeAmount = null; + } else if (applicationFeeAmount.isEmpty()) { + this.applicationFeeAmount = Optional.empty(); + } else { + this.applicationFeeAmount = Optional.of(applicationFeeAmount.get()); + } + return this; + } + + /** + *

The application fee amount collected by the platform from this connected account. Provided as a number in dollars (e.g., 5.00 for $5.00). Must be less than the total payment amount. Only valid for connected accounts with a parent company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage applicationFeeAmount(Double applicationFeeAmount) { + this.applicationFeeAmount = Optional.ofNullable(applicationFeeAmount); + return this; + } + + /** + *

The application fee amount collected by the platform from this connected account. Provided as a number in dollars (e.g., 5.00 for $5.00). Must be less than the total payment amount. Only valid for connected accounts with a parent company.

+ */ + @java.lang.Override + @JsonSetter(value = "application_fee_amount", nulls = Nulls.SKIP) + public _FinalStage applicationFeeAmount(Optional applicationFeeAmount) { + this.applicationFeeAmount = applicationFeeAmount; + return this; + } + + @java.lang.Override + public CreatePaymentsRequestOnePlan build() { + return new CreatePaymentsRequestOnePlan( + applicationFeeAmount, + billingPeriod, + currency, + description, + expirationDays, + forceCreateNewPlan, + initialPrice, + internalNotes, + planType, + product, + productId, + renewalPrice, + title, + trialPeriodDays, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestOnePlanProduct.java b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestOnePlanProduct.java new file mode 100644 index 00000000..15a06156 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestOnePlanProduct.java @@ -0,0 +1,899 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.GlobalAffiliateStatuses; +import com.whop.api.types.Visibility; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePaymentsRequestOnePlanProduct.Builder.class) +public final class CreatePaymentsRequestOnePlanProduct { + private final Optional collectShippingAddress; + + private final Optional customStatementDescriptor; + + private final Optional description; + + private final String externalIdentifier; + + private final Optional globalAffiliatePercentage; + + private final Optional globalAffiliateStatus; + + private final Optional headline; + + private final Optional productTaxCodeId; + + private final Optional redirectPurchaseUrl; + + private final Optional route; + + private final String title; + + private final Optional visibility; + + private final Map additionalProperties; + + private CreatePaymentsRequestOnePlanProduct( + Optional collectShippingAddress, + Optional customStatementDescriptor, + Optional description, + String externalIdentifier, + Optional globalAffiliatePercentage, + Optional globalAffiliateStatus, + Optional headline, + Optional productTaxCodeId, + Optional redirectPurchaseUrl, + Optional route, + String title, + Optional visibility, + Map additionalProperties) { + this.collectShippingAddress = collectShippingAddress; + this.customStatementDescriptor = customStatementDescriptor; + this.description = description; + this.externalIdentifier = externalIdentifier; + this.globalAffiliatePercentage = globalAffiliatePercentage; + this.globalAffiliateStatus = globalAffiliateStatus; + this.headline = headline; + this.productTaxCodeId = productTaxCodeId; + this.redirectPurchaseUrl = redirectPurchaseUrl; + this.route = route; + this.title = title; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether or not to collect shipping information at checkout from the customer. + */ + @JsonIgnore + public Optional getCollectShippingAddress() { + if (collectShippingAddress == null) { + return Optional.empty(); + } + return collectShippingAddress; + } + + /** + * @return The custom statement descriptor for the product i.e. WHOP*SPORTS, must be between 5 and 22 characters, contain at least one letter, and not contain any of the following characters: <, >, , ', " + */ + @JsonIgnore + public Optional getCustomStatementDescriptor() { + if (customStatementDescriptor == null) { + return Optional.empty(); + } + return customStatementDescriptor; + } + + /** + * @return A written description of the product. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return A unique ID used to find or create a product. When provided during creation, we will look for an existing product with this external identifier — if found, it will be updated; otherwise, a new product will be created. + */ + @JsonProperty("external_identifier") + public String getExternalIdentifier() { + return externalIdentifier; + } + + /** + * @return The percentage of the revenue that goes to the global affiliate program. + */ + @JsonIgnore + public Optional getGlobalAffiliatePercentage() { + if (globalAffiliatePercentage == null) { + return Optional.empty(); + } + return globalAffiliatePercentage; + } + + /** + * @return The status of the global affiliate program for this product. + */ + @JsonIgnore + public Optional getGlobalAffiliateStatus() { + if (globalAffiliateStatus == null) { + return Optional.empty(); + } + return globalAffiliateStatus; + } + + /** + * @return The headline of the product. + */ + @JsonIgnore + public Optional getHeadline() { + if (headline == null) { + return Optional.empty(); + } + return headline; + } + + /** + * @return The ID of the product tax code to apply to this product. + */ + @JsonIgnore + public Optional getProductTaxCodeId() { + if (productTaxCodeId == null) { + return Optional.empty(); + } + return productTaxCodeId; + } + + /** + * @return The URL to redirect the customer to after a purchase. + */ + @JsonIgnore + public Optional getRedirectPurchaseUrl() { + if (redirectPurchaseUrl == null) { + return Optional.empty(); + } + return redirectPurchaseUrl; + } + + /** + * @return The route of the product. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return The title of the product. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return This product will/will not be displayed publicly - default hidden. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("collect_shipping_address") + private Optional _getCollectShippingAddress() { + return collectShippingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_statement_descriptor") + private Optional _getCustomStatementDescriptor() { + return customStatementDescriptor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("global_affiliate_percentage") + private Optional _getGlobalAffiliatePercentage() { + return globalAffiliatePercentage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("global_affiliate_status") + private Optional _getGlobalAffiliateStatus() { + return globalAffiliateStatus; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("headline") + private Optional _getHeadline() { + return headline; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_tax_code_id") + private Optional _getProductTaxCodeId() { + return productTaxCodeId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("redirect_purchase_url") + private Optional _getRedirectPurchaseUrl() { + return redirectPurchaseUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePaymentsRequestOnePlanProduct + && equalTo((CreatePaymentsRequestOnePlanProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePaymentsRequestOnePlanProduct other) { + return collectShippingAddress.equals(other.collectShippingAddress) + && customStatementDescriptor.equals(other.customStatementDescriptor) + && description.equals(other.description) + && externalIdentifier.equals(other.externalIdentifier) + && globalAffiliatePercentage.equals(other.globalAffiliatePercentage) + && globalAffiliateStatus.equals(other.globalAffiliateStatus) + && headline.equals(other.headline) + && productTaxCodeId.equals(other.productTaxCodeId) + && redirectPurchaseUrl.equals(other.redirectPurchaseUrl) + && route.equals(other.route) + && title.equals(other.title) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.collectShippingAddress, + this.customStatementDescriptor, + this.description, + this.externalIdentifier, + this.globalAffiliatePercentage, + this.globalAffiliateStatus, + this.headline, + this.productTaxCodeId, + this.redirectPurchaseUrl, + this.route, + this.title, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalIdentifierStage builder() { + return new Builder(); + } + + public interface ExternalIdentifierStage { + /** + *

A unique ID used to find or create a product. When provided during creation, we will look for an existing product with this external identifier — if found, it will be updated; otherwise, a new product will be created.

+ */ + TitleStage externalIdentifier(@NotNull String externalIdentifier); + + Builder from(CreatePaymentsRequestOnePlanProduct other); + } + + public interface TitleStage { + /** + *

The title of the product.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + CreatePaymentsRequestOnePlanProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Whether or not to collect shipping information at checkout from the customer.

+ */ + _FinalStage collectShippingAddress(Optional collectShippingAddress); + + _FinalStage collectShippingAddress(Boolean collectShippingAddress); + + _FinalStage collectShippingAddress(Nullable collectShippingAddress); + + /** + *

The custom statement descriptor for the product i.e. WHOP*SPORTS, must be between 5 and 22 characters, contain at least one letter, and not contain any of the following characters: <, >, , ', "

+ */ + _FinalStage customStatementDescriptor(Optional customStatementDescriptor); + + _FinalStage customStatementDescriptor(String customStatementDescriptor); + + _FinalStage customStatementDescriptor(Nullable customStatementDescriptor); + + /** + *

A written description of the product.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

The percentage of the revenue that goes to the global affiliate program.

+ */ + _FinalStage globalAffiliatePercentage(Optional globalAffiliatePercentage); + + _FinalStage globalAffiliatePercentage(Double globalAffiliatePercentage); + + _FinalStage globalAffiliatePercentage(Nullable globalAffiliatePercentage); + + /** + *

The status of the global affiliate program for this product.

+ */ + _FinalStage globalAffiliateStatus(Optional globalAffiliateStatus); + + _FinalStage globalAffiliateStatus(GlobalAffiliateStatuses globalAffiliateStatus); + + _FinalStage globalAffiliateStatus(Nullable globalAffiliateStatus); + + /** + *

The headline of the product.

+ */ + _FinalStage headline(Optional headline); + + _FinalStage headline(String headline); + + _FinalStage headline(Nullable headline); + + /** + *

The ID of the product tax code to apply to this product.

+ */ + _FinalStage productTaxCodeId(Optional productTaxCodeId); + + _FinalStage productTaxCodeId(String productTaxCodeId); + + _FinalStage productTaxCodeId(Nullable productTaxCodeId); + + /** + *

The URL to redirect the customer to after a purchase.

+ */ + _FinalStage redirectPurchaseUrl(Optional redirectPurchaseUrl); + + _FinalStage redirectPurchaseUrl(String redirectPurchaseUrl); + + _FinalStage redirectPurchaseUrl(Nullable redirectPurchaseUrl); + + /** + *

The route of the product.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

This product will/will not be displayed publicly - default hidden.

+ */ + _FinalStage visibility(Optional visibility); + + _FinalStage visibility(Visibility visibility); + + _FinalStage visibility(Nullable visibility); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalIdentifierStage, TitleStage, _FinalStage { + private String externalIdentifier; + + private String title; + + private Optional visibility = Optional.empty(); + + private Optional route = Optional.empty(); + + private Optional redirectPurchaseUrl = Optional.empty(); + + private Optional productTaxCodeId = Optional.empty(); + + private Optional headline = Optional.empty(); + + private Optional globalAffiliateStatus = Optional.empty(); + + private Optional globalAffiliatePercentage = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional customStatementDescriptor = Optional.empty(); + + private Optional collectShippingAddress = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePaymentsRequestOnePlanProduct other) { + collectShippingAddress(other.getCollectShippingAddress()); + customStatementDescriptor(other.getCustomStatementDescriptor()); + description(other.getDescription()); + externalIdentifier(other.getExternalIdentifier()); + globalAffiliatePercentage(other.getGlobalAffiliatePercentage()); + globalAffiliateStatus(other.getGlobalAffiliateStatus()); + headline(other.getHeadline()); + productTaxCodeId(other.getProductTaxCodeId()); + redirectPurchaseUrl(other.getRedirectPurchaseUrl()); + route(other.getRoute()); + title(other.getTitle()); + visibility(other.getVisibility()); + return this; + } + + /** + *

A unique ID used to find or create a product. When provided during creation, we will look for an existing product with this external identifier — if found, it will be updated; otherwise, a new product will be created.

+ *

A unique ID used to find or create a product. When provided during creation, we will look for an existing product with this external identifier — if found, it will be updated; otherwise, a new product will be created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_identifier") + public TitleStage externalIdentifier(@NotNull String externalIdentifier) { + this.externalIdentifier = Objects.requireNonNull(externalIdentifier, "externalIdentifier must not be null"); + return this; + } + + /** + *

The title of the product.

+ *

The title of the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

This product will/will not be displayed publicly - default hidden.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + /** + *

This product will/will not be displayed publicly - default hidden.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(Visibility visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + /** + *

This product will/will not be displayed publicly - default hidden.

+ */ + @java.lang.Override + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public _FinalStage visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + /** + *

The route of the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

The route of the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

The route of the product.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + /** + *

The URL to redirect the customer to after a purchase.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectPurchaseUrl(Nullable redirectPurchaseUrl) { + if (redirectPurchaseUrl.isNull()) { + this.redirectPurchaseUrl = null; + } else if (redirectPurchaseUrl.isEmpty()) { + this.redirectPurchaseUrl = Optional.empty(); + } else { + this.redirectPurchaseUrl = Optional.of(redirectPurchaseUrl.get()); + } + return this; + } + + /** + *

The URL to redirect the customer to after a purchase.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectPurchaseUrl(String redirectPurchaseUrl) { + this.redirectPurchaseUrl = Optional.ofNullable(redirectPurchaseUrl); + return this; + } + + /** + *

The URL to redirect the customer to after a purchase.

+ */ + @java.lang.Override + @JsonSetter(value = "redirect_purchase_url", nulls = Nulls.SKIP) + public _FinalStage redirectPurchaseUrl(Optional redirectPurchaseUrl) { + this.redirectPurchaseUrl = redirectPurchaseUrl; + return this; + } + + /** + *

The ID of the product tax code to apply to this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productTaxCodeId(Nullable productTaxCodeId) { + if (productTaxCodeId.isNull()) { + this.productTaxCodeId = null; + } else if (productTaxCodeId.isEmpty()) { + this.productTaxCodeId = Optional.empty(); + } else { + this.productTaxCodeId = Optional.of(productTaxCodeId.get()); + } + return this; + } + + /** + *

The ID of the product tax code to apply to this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productTaxCodeId(String productTaxCodeId) { + this.productTaxCodeId = Optional.ofNullable(productTaxCodeId); + return this; + } + + /** + *

The ID of the product tax code to apply to this product.

+ */ + @java.lang.Override + @JsonSetter(value = "product_tax_code_id", nulls = Nulls.SKIP) + public _FinalStage productTaxCodeId(Optional productTaxCodeId) { + this.productTaxCodeId = productTaxCodeId; + return this; + } + + /** + *

The headline of the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage headline(Nullable headline) { + if (headline.isNull()) { + this.headline = null; + } else if (headline.isEmpty()) { + this.headline = Optional.empty(); + } else { + this.headline = Optional.of(headline.get()); + } + return this; + } + + /** + *

The headline of the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage headline(String headline) { + this.headline = Optional.ofNullable(headline); + return this; + } + + /** + *

The headline of the product.

+ */ + @java.lang.Override + @JsonSetter(value = "headline", nulls = Nulls.SKIP) + public _FinalStage headline(Optional headline) { + this.headline = headline; + return this; + } + + /** + *

The status of the global affiliate program for this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage globalAffiliateStatus(Nullable globalAffiliateStatus) { + if (globalAffiliateStatus.isNull()) { + this.globalAffiliateStatus = null; + } else if (globalAffiliateStatus.isEmpty()) { + this.globalAffiliateStatus = Optional.empty(); + } else { + this.globalAffiliateStatus = Optional.of(globalAffiliateStatus.get()); + } + return this; + } + + /** + *

The status of the global affiliate program for this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage globalAffiliateStatus(GlobalAffiliateStatuses globalAffiliateStatus) { + this.globalAffiliateStatus = Optional.ofNullable(globalAffiliateStatus); + return this; + } + + /** + *

The status of the global affiliate program for this product.

+ */ + @java.lang.Override + @JsonSetter(value = "global_affiliate_status", nulls = Nulls.SKIP) + public _FinalStage globalAffiliateStatus(Optional globalAffiliateStatus) { + this.globalAffiliateStatus = globalAffiliateStatus; + return this; + } + + /** + *

The percentage of the revenue that goes to the global affiliate program.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage globalAffiliatePercentage(Nullable globalAffiliatePercentage) { + if (globalAffiliatePercentage.isNull()) { + this.globalAffiliatePercentage = null; + } else if (globalAffiliatePercentage.isEmpty()) { + this.globalAffiliatePercentage = Optional.empty(); + } else { + this.globalAffiliatePercentage = Optional.of(globalAffiliatePercentage.get()); + } + return this; + } + + /** + *

The percentage of the revenue that goes to the global affiliate program.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage globalAffiliatePercentage(Double globalAffiliatePercentage) { + this.globalAffiliatePercentage = Optional.ofNullable(globalAffiliatePercentage); + return this; + } + + /** + *

The percentage of the revenue that goes to the global affiliate program.

+ */ + @java.lang.Override + @JsonSetter(value = "global_affiliate_percentage", nulls = Nulls.SKIP) + public _FinalStage globalAffiliatePercentage(Optional globalAffiliatePercentage) { + this.globalAffiliatePercentage = globalAffiliatePercentage; + return this; + } + + /** + *

A written description of the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

A written description of the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

A written description of the product.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

The custom statement descriptor for the product i.e. WHOP*SPORTS, must be between 5 and 22 characters, contain at least one letter, and not contain any of the following characters: <, >, , ', "

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customStatementDescriptor(Nullable customStatementDescriptor) { + if (customStatementDescriptor.isNull()) { + this.customStatementDescriptor = null; + } else if (customStatementDescriptor.isEmpty()) { + this.customStatementDescriptor = Optional.empty(); + } else { + this.customStatementDescriptor = Optional.of(customStatementDescriptor.get()); + } + return this; + } + + /** + *

The custom statement descriptor for the product i.e. WHOP*SPORTS, must be between 5 and 22 characters, contain at least one letter, and not contain any of the following characters: <, >, , ', "

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customStatementDescriptor(String customStatementDescriptor) { + this.customStatementDescriptor = Optional.ofNullable(customStatementDescriptor); + return this; + } + + /** + *

The custom statement descriptor for the product i.e. WHOP*SPORTS, must be between 5 and 22 characters, contain at least one letter, and not contain any of the following characters: <, >, , ', "

+ */ + @java.lang.Override + @JsonSetter(value = "custom_statement_descriptor", nulls = Nulls.SKIP) + public _FinalStage customStatementDescriptor(Optional customStatementDescriptor) { + this.customStatementDescriptor = customStatementDescriptor; + return this; + } + + /** + *

Whether or not to collect shipping information at checkout from the customer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage collectShippingAddress(Nullable collectShippingAddress) { + if (collectShippingAddress.isNull()) { + this.collectShippingAddress = null; + } else if (collectShippingAddress.isEmpty()) { + this.collectShippingAddress = Optional.empty(); + } else { + this.collectShippingAddress = Optional.of(collectShippingAddress.get()); + } + return this; + } + + /** + *

Whether or not to collect shipping information at checkout from the customer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage collectShippingAddress(Boolean collectShippingAddress) { + this.collectShippingAddress = Optional.ofNullable(collectShippingAddress); + return this; + } + + /** + *

Whether or not to collect shipping information at checkout from the customer.

+ */ + @java.lang.Override + @JsonSetter(value = "collect_shipping_address", nulls = Nulls.SKIP) + public _FinalStage collectShippingAddress(Optional collectShippingAddress) { + this.collectShippingAddress = collectShippingAddress; + return this; + } + + @java.lang.Override + public CreatePaymentsRequestOnePlanProduct build() { + return new CreatePaymentsRequestOnePlanProduct( + collectShippingAddress, + customStatementDescriptor, + description, + externalIdentifier, + globalAffiliatePercentage, + globalAffiliateStatus, + headline, + productTaxCodeId, + redirectPurchaseUrl, + route, + title, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestThree.java b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestThree.java new file mode 100644 index 00000000..d0ff912a --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestThree.java @@ -0,0 +1,573 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePaymentsRequestThree.Builder.class) +public final class CreatePaymentsRequestThree { + private final String companyId; + + private final Optional email; + + private final String memberId; + + private final Optional> metadata; + + private final Optional paymentMethodId; + + private final String planId; + + private final Optional promoCodeId; + + private final Optional returnUrl; + + private final Map additionalProperties; + + private CreatePaymentsRequestThree( + String companyId, + Optional email, + String memberId, + Optional> metadata, + Optional paymentMethodId, + String planId, + Optional promoCodeId, + Optional returnUrl, + Map additionalProperties) { + this.companyId = companyId; + this.email = email; + this.memberId = memberId; + this.metadata = metadata; + this.paymentMethodId = paymentMethodId; + this.planId = planId; + this.promoCodeId = promoCodeId; + this.returnUrl = returnUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the company to create the payment for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The ID of the member to create the payment for. Required unless confirmation_token is provided. + */ + @JsonProperty("member_id") + public String getMemberId() { + return memberId; + } + + /** + * @return Custom metadata to attach to the payment. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided. + */ + @JsonIgnore + public Optional getPaymentMethodId() { + if (paymentMethodId == null) { + return Optional.empty(); + } + return paymentMethodId; + } + + /** + * @return An ID of an existing plan to use for the payment. + */ + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + /** + * @return The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases. + */ + @JsonIgnore + public Optional getPromoCodeId() { + if (promoCodeId == null) { + return Optional.empty(); + } + return promoCodeId; + } + + /** + * @return Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided. + */ + @JsonIgnore + public Optional getReturnUrl() { + if (returnUrl == null) { + return Optional.empty(); + } + return returnUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_id") + private Optional _getPaymentMethodId() { + return paymentMethodId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("promo_code_id") + private Optional _getPromoCodeId() { + return promoCodeId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("return_url") + private Optional _getReturnUrl() { + return returnUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePaymentsRequestThree && equalTo((CreatePaymentsRequestThree) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePaymentsRequestThree other) { + return companyId.equals(other.companyId) + && email.equals(other.email) + && memberId.equals(other.memberId) + && metadata.equals(other.metadata) + && paymentMethodId.equals(other.paymentMethodId) + && planId.equals(other.planId) + && promoCodeId.equals(other.promoCodeId) + && returnUrl.equals(other.returnUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyId, + this.email, + this.memberId, + this.metadata, + this.paymentMethodId, + this.planId, + this.promoCodeId, + this.returnUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The ID of the company to create the payment for.

+ */ + MemberIdStage companyId(@NotNull String companyId); + + Builder from(CreatePaymentsRequestThree other); + } + + public interface MemberIdStage { + /** + *

The ID of the member to create the payment for. Required unless confirmation_token is provided.

+ */ + PlanIdStage memberId(@NotNull String memberId); + } + + public interface PlanIdStage { + /** + *

An ID of an existing plan to use for the payment.

+ */ + _FinalStage planId(@NotNull String planId); + } + + public interface _FinalStage { + CreatePaymentsRequestThree build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

Custom metadata to attach to the payment.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ */ + _FinalStage paymentMethodId(Optional paymentMethodId); + + _FinalStage paymentMethodId(String paymentMethodId); + + _FinalStage paymentMethodId(Nullable paymentMethodId); + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ */ + _FinalStage promoCodeId(Optional promoCodeId); + + _FinalStage promoCodeId(String promoCodeId); + + _FinalStage promoCodeId(Nullable promoCodeId); + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ */ + _FinalStage returnUrl(Optional returnUrl); + + _FinalStage returnUrl(String returnUrl); + + _FinalStage returnUrl(Nullable returnUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, MemberIdStage, PlanIdStage, _FinalStage { + private String companyId; + + private String memberId; + + private String planId; + + private Optional returnUrl = Optional.empty(); + + private Optional promoCodeId = Optional.empty(); + + private Optional paymentMethodId = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePaymentsRequestThree other) { + companyId(other.getCompanyId()); + email(other.getEmail()); + memberId(other.getMemberId()); + metadata(other.getMetadata()); + paymentMethodId(other.getPaymentMethodId()); + planId(other.getPlanId()); + promoCodeId(other.getPromoCodeId()); + returnUrl(other.getReturnUrl()); + return this; + } + + /** + *

The ID of the company to create the payment for.

+ *

The ID of the company to create the payment for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public MemberIdStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The ID of the member to create the payment for. Required unless confirmation_token is provided.

+ *

The ID of the member to create the payment for. Required unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("member_id") + public PlanIdStage memberId(@NotNull String memberId) { + this.memberId = Objects.requireNonNull(memberId, "memberId must not be null"); + return this; + } + + /** + *

An ID of an existing plan to use for the payment.

+ *

An ID of an existing plan to use for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan_id") + public _FinalStage planId(@NotNull String planId) { + this.planId = Objects.requireNonNull(planId, "planId must not be null"); + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(Nullable returnUrl) { + if (returnUrl.isNull()) { + this.returnUrl = null; + } else if (returnUrl.isEmpty()) { + this.returnUrl = Optional.empty(); + } else { + this.returnUrl = Optional.of(returnUrl.get()); + } + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(String returnUrl) { + this.returnUrl = Optional.ofNullable(returnUrl); + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "return_url", nulls = Nulls.SKIP) + public _FinalStage returnUrl(Optional returnUrl) { + this.returnUrl = returnUrl; + return this; + } + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCodeId(Nullable promoCodeId) { + if (promoCodeId.isNull()) { + this.promoCodeId = null; + } else if (promoCodeId.isEmpty()) { + this.promoCodeId = Optional.empty(); + } else { + this.promoCodeId = Optional.of(promoCodeId.get()); + } + return this; + } + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCodeId(String promoCodeId) { + this.promoCodeId = Optional.ofNullable(promoCodeId); + return this; + } + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ */ + @java.lang.Override + @JsonSetter(value = "promo_code_id", nulls = Nulls.SKIP) + public _FinalStage promoCodeId(Optional promoCodeId) { + this.promoCodeId = promoCodeId; + return this; + } + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodId(Nullable paymentMethodId) { + if (paymentMethodId.isNull()) { + this.paymentMethodId = null; + } else if (paymentMethodId.isEmpty()) { + this.paymentMethodId = Optional.empty(); + } else { + this.paymentMethodId = Optional.of(paymentMethodId.get()); + } + return this; + } + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodId(String paymentMethodId) { + this.paymentMethodId = Optional.ofNullable(paymentMethodId); + return this; + } + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_id", nulls = Nulls.SKIP) + public _FinalStage paymentMethodId(Optional paymentMethodId) { + this.paymentMethodId = paymentMethodId; + return this; + } + + /** + *

Custom metadata to attach to the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom metadata to attach to the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom metadata to attach to the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public CreatePaymentsRequestThree build() { + return new CreatePaymentsRequestThree( + companyId, + email, + memberId, + metadata, + paymentMethodId, + planId, + promoCodeId, + returnUrl, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestTwo.java b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestTwo.java new file mode 100644 index 00000000..e30a265a --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestTwo.java @@ -0,0 +1,573 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePaymentsRequestTwo.Builder.class) +public final class CreatePaymentsRequestTwo { + private final String companyId; + + private final String confirmationToken; + + private final Optional email; + + private final Optional> metadata; + + private final Optional paymentMethodId; + + private final String planId; + + private final Optional promoCodeId; + + private final Optional returnUrl; + + private final Map additionalProperties; + + private CreatePaymentsRequestTwo( + String companyId, + String confirmationToken, + Optional email, + Optional> metadata, + Optional paymentMethodId, + String planId, + Optional promoCodeId, + Optional returnUrl, + Map additionalProperties) { + this.companyId = companyId; + this.confirmationToken = confirmationToken; + this.email = email; + this.metadata = metadata; + this.paymentMethodId = paymentMethodId; + this.planId = planId; + this.promoCodeId = promoCodeId; + this.returnUrl = returnUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the company to create the payment for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return A confirmation token ID (ctok_) describing a payment method the buyer just supplied. Provide this INSTEAD of member_id and payment_method_id to charge a method that is not yet on file — the buyer is resolved from the token's billing email, or from email. The buyer may still have a step to complete (3DS, a redirect, linking a bank); poll the payment's status endpoint for what to do next. + */ + @JsonProperty("confirmation_token") + public String getConfirmationToken() { + return confirmationToken; + } + + /** + * @return Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return Custom metadata to attach to the payment. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided. + */ + @JsonIgnore + public Optional getPaymentMethodId() { + if (paymentMethodId == null) { + return Optional.empty(); + } + return paymentMethodId; + } + + /** + * @return An ID of an existing plan to use for the payment. + */ + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + /** + * @return The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases. + */ + @JsonIgnore + public Optional getPromoCodeId() { + if (promoCodeId == null) { + return Optional.empty(); + } + return promoCodeId; + } + + /** + * @return Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided. + */ + @JsonIgnore + public Optional getReturnUrl() { + if (returnUrl == null) { + return Optional.empty(); + } + return returnUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_id") + private Optional _getPaymentMethodId() { + return paymentMethodId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("promo_code_id") + private Optional _getPromoCodeId() { + return promoCodeId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("return_url") + private Optional _getReturnUrl() { + return returnUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePaymentsRequestTwo && equalTo((CreatePaymentsRequestTwo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePaymentsRequestTwo other) { + return companyId.equals(other.companyId) + && confirmationToken.equals(other.confirmationToken) + && email.equals(other.email) + && metadata.equals(other.metadata) + && paymentMethodId.equals(other.paymentMethodId) + && planId.equals(other.planId) + && promoCodeId.equals(other.promoCodeId) + && returnUrl.equals(other.returnUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyId, + this.confirmationToken, + this.email, + this.metadata, + this.paymentMethodId, + this.planId, + this.promoCodeId, + this.returnUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The ID of the company to create the payment for.

+ */ + ConfirmationTokenStage companyId(@NotNull String companyId); + + Builder from(CreatePaymentsRequestTwo other); + } + + public interface ConfirmationTokenStage { + /** + *

A confirmation token ID (ctok_) describing a payment method the buyer just supplied. Provide this INSTEAD of member_id and payment_method_id to charge a method that is not yet on file — the buyer is resolved from the token's billing email, or from email. The buyer may still have a step to complete (3DS, a redirect, linking a bank); poll the payment's status endpoint for what to do next.

+ */ + PlanIdStage confirmationToken(@NotNull String confirmationToken); + } + + public interface PlanIdStage { + /** + *

An ID of an existing plan to use for the payment.

+ */ + _FinalStage planId(@NotNull String planId); + } + + public interface _FinalStage { + CreatePaymentsRequestTwo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

Custom metadata to attach to the payment.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ */ + _FinalStage paymentMethodId(Optional paymentMethodId); + + _FinalStage paymentMethodId(String paymentMethodId); + + _FinalStage paymentMethodId(Nullable paymentMethodId); + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ */ + _FinalStage promoCodeId(Optional promoCodeId); + + _FinalStage promoCodeId(String promoCodeId); + + _FinalStage promoCodeId(Nullable promoCodeId); + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ */ + _FinalStage returnUrl(Optional returnUrl); + + _FinalStage returnUrl(String returnUrl); + + _FinalStage returnUrl(Nullable returnUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, ConfirmationTokenStage, PlanIdStage, _FinalStage { + private String companyId; + + private String confirmationToken; + + private String planId; + + private Optional returnUrl = Optional.empty(); + + private Optional promoCodeId = Optional.empty(); + + private Optional paymentMethodId = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePaymentsRequestTwo other) { + companyId(other.getCompanyId()); + confirmationToken(other.getConfirmationToken()); + email(other.getEmail()); + metadata(other.getMetadata()); + paymentMethodId(other.getPaymentMethodId()); + planId(other.getPlanId()); + promoCodeId(other.getPromoCodeId()); + returnUrl(other.getReturnUrl()); + return this; + } + + /** + *

The ID of the company to create the payment for.

+ *

The ID of the company to create the payment for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public ConfirmationTokenStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

A confirmation token ID (ctok_) describing a payment method the buyer just supplied. Provide this INSTEAD of member_id and payment_method_id to charge a method that is not yet on file — the buyer is resolved from the token's billing email, or from email. The buyer may still have a step to complete (3DS, a redirect, linking a bank); poll the payment's status endpoint for what to do next.

+ *

A confirmation token ID (ctok_) describing a payment method the buyer just supplied. Provide this INSTEAD of member_id and payment_method_id to charge a method that is not yet on file — the buyer is resolved from the token's billing email, or from email. The buyer may still have a step to complete (3DS, a redirect, linking a bank); poll the payment's status endpoint for what to do next.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("confirmation_token") + public PlanIdStage confirmationToken(@NotNull String confirmationToken) { + this.confirmationToken = Objects.requireNonNull(confirmationToken, "confirmationToken must not be null"); + return this; + } + + /** + *

An ID of an existing plan to use for the payment.

+ *

An ID of an existing plan to use for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan_id") + public _FinalStage planId(@NotNull String planId) { + this.planId = Objects.requireNonNull(planId, "planId must not be null"); + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(Nullable returnUrl) { + if (returnUrl.isNull()) { + this.returnUrl = null; + } else if (returnUrl.isEmpty()) { + this.returnUrl = Optional.empty(); + } else { + this.returnUrl = Optional.of(returnUrl.get()); + } + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(String returnUrl) { + this.returnUrl = Optional.ofNullable(returnUrl); + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "return_url", nulls = Nulls.SKIP) + public _FinalStage returnUrl(Optional returnUrl) { + this.returnUrl = returnUrl; + return this; + } + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCodeId(Nullable promoCodeId) { + if (promoCodeId.isNull()) { + this.promoCodeId = null; + } else if (promoCodeId.isEmpty()) { + this.promoCodeId = Optional.empty(); + } else { + this.promoCodeId = Optional.of(promoCodeId.get()); + } + return this; + } + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCodeId(String promoCodeId) { + this.promoCodeId = Optional.ofNullable(promoCodeId); + return this; + } + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ */ + @java.lang.Override + @JsonSetter(value = "promo_code_id", nulls = Nulls.SKIP) + public _FinalStage promoCodeId(Optional promoCodeId) { + this.promoCodeId = promoCodeId; + return this; + } + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodId(Nullable paymentMethodId) { + if (paymentMethodId.isNull()) { + this.paymentMethodId = null; + } else if (paymentMethodId.isEmpty()) { + this.paymentMethodId = Optional.empty(); + } else { + this.paymentMethodId = Optional.of(paymentMethodId.get()); + } + return this; + } + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodId(String paymentMethodId) { + this.paymentMethodId = Optional.ofNullable(paymentMethodId); + return this; + } + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_id", nulls = Nulls.SKIP) + public _FinalStage paymentMethodId(Optional paymentMethodId) { + this.paymentMethodId = paymentMethodId; + return this; + } + + /** + *

Custom metadata to attach to the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom metadata to attach to the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom metadata to attach to the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public CreatePaymentsRequestTwo build() { + return new CreatePaymentsRequestTwo( + companyId, + confirmationToken, + email, + metadata, + paymentMethodId, + planId, + promoCodeId, + returnUrl, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestZero.java b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestZero.java new file mode 100644 index 00000000..765543dd --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestZero.java @@ -0,0 +1,573 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePaymentsRequestZero.Builder.class) +public final class CreatePaymentsRequestZero { + private final String companyId; + + private final String confirmationToken; + + private final Optional email; + + private final Optional> metadata; + + private final Optional paymentMethodId; + + private final CreatePaymentsRequestZeroPlan plan; + + private final Optional promoCodeId; + + private final Optional returnUrl; + + private final Map additionalProperties; + + private CreatePaymentsRequestZero( + String companyId, + String confirmationToken, + Optional email, + Optional> metadata, + Optional paymentMethodId, + CreatePaymentsRequestZeroPlan plan, + Optional promoCodeId, + Optional returnUrl, + Map additionalProperties) { + this.companyId = companyId; + this.confirmationToken = confirmationToken; + this.email = email; + this.metadata = metadata; + this.paymentMethodId = paymentMethodId; + this.plan = plan; + this.promoCodeId = promoCodeId; + this.returnUrl = returnUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the company to create the payment for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return A confirmation token ID (ctok_) describing a payment method the buyer just supplied. Provide this INSTEAD of member_id and payment_method_id to charge a method that is not yet on file — the buyer is resolved from the token's billing email, or from email. The buyer may still have a step to complete (3DS, a redirect, linking a bank); poll the payment's status endpoint for what to do next. + */ + @JsonProperty("confirmation_token") + public String getConfirmationToken() { + return confirmationToken; + } + + /** + * @return Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return Custom metadata to attach to the payment. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided. + */ + @JsonIgnore + public Optional getPaymentMethodId() { + if (paymentMethodId == null) { + return Optional.empty(); + } + return paymentMethodId; + } + + /** + * @return Pass this object to create a new plan for this payment + */ + @JsonProperty("plan") + public CreatePaymentsRequestZeroPlan getPlan() { + return plan; + } + + /** + * @return The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases. + */ + @JsonIgnore + public Optional getPromoCodeId() { + if (promoCodeId == null) { + return Optional.empty(); + } + return promoCodeId; + } + + /** + * @return Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided. + */ + @JsonIgnore + public Optional getReturnUrl() { + if (returnUrl == null) { + return Optional.empty(); + } + return returnUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_id") + private Optional _getPaymentMethodId() { + return paymentMethodId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("promo_code_id") + private Optional _getPromoCodeId() { + return promoCodeId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("return_url") + private Optional _getReturnUrl() { + return returnUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePaymentsRequestZero && equalTo((CreatePaymentsRequestZero) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePaymentsRequestZero other) { + return companyId.equals(other.companyId) + && confirmationToken.equals(other.confirmationToken) + && email.equals(other.email) + && metadata.equals(other.metadata) + && paymentMethodId.equals(other.paymentMethodId) + && plan.equals(other.plan) + && promoCodeId.equals(other.promoCodeId) + && returnUrl.equals(other.returnUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyId, + this.confirmationToken, + this.email, + this.metadata, + this.paymentMethodId, + this.plan, + this.promoCodeId, + this.returnUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The ID of the company to create the payment for.

+ */ + ConfirmationTokenStage companyId(@NotNull String companyId); + + Builder from(CreatePaymentsRequestZero other); + } + + public interface ConfirmationTokenStage { + /** + *

A confirmation token ID (ctok_) describing a payment method the buyer just supplied. Provide this INSTEAD of member_id and payment_method_id to charge a method that is not yet on file — the buyer is resolved from the token's billing email, or from email. The buyer may still have a step to complete (3DS, a redirect, linking a bank); poll the payment's status endpoint for what to do next.

+ */ + PlanStage confirmationToken(@NotNull String confirmationToken); + } + + public interface PlanStage { + /** + *

Pass this object to create a new plan for this payment

+ */ + _FinalStage plan(@NotNull CreatePaymentsRequestZeroPlan plan); + } + + public interface _FinalStage { + CreatePaymentsRequestZero build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

Custom metadata to attach to the payment.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ */ + _FinalStage paymentMethodId(Optional paymentMethodId); + + _FinalStage paymentMethodId(String paymentMethodId); + + _FinalStage paymentMethodId(Nullable paymentMethodId); + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ */ + _FinalStage promoCodeId(Optional promoCodeId); + + _FinalStage promoCodeId(String promoCodeId); + + _FinalStage promoCodeId(Nullable promoCodeId); + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ */ + _FinalStage returnUrl(Optional returnUrl); + + _FinalStage returnUrl(String returnUrl); + + _FinalStage returnUrl(Nullable returnUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, ConfirmationTokenStage, PlanStage, _FinalStage { + private String companyId; + + private String confirmationToken; + + private CreatePaymentsRequestZeroPlan plan; + + private Optional returnUrl = Optional.empty(); + + private Optional promoCodeId = Optional.empty(); + + private Optional paymentMethodId = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePaymentsRequestZero other) { + companyId(other.getCompanyId()); + confirmationToken(other.getConfirmationToken()); + email(other.getEmail()); + metadata(other.getMetadata()); + paymentMethodId(other.getPaymentMethodId()); + plan(other.getPlan()); + promoCodeId(other.getPromoCodeId()); + returnUrl(other.getReturnUrl()); + return this; + } + + /** + *

The ID of the company to create the payment for.

+ *

The ID of the company to create the payment for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public ConfirmationTokenStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

A confirmation token ID (ctok_) describing a payment method the buyer just supplied. Provide this INSTEAD of member_id and payment_method_id to charge a method that is not yet on file — the buyer is resolved from the token's billing email, or from email. The buyer may still have a step to complete (3DS, a redirect, linking a bank); poll the payment's status endpoint for what to do next.

+ *

A confirmation token ID (ctok_) describing a payment method the buyer just supplied. Provide this INSTEAD of member_id and payment_method_id to charge a method that is not yet on file — the buyer is resolved from the token's billing email, or from email. The buyer may still have a step to complete (3DS, a redirect, linking a bank); poll the payment's status endpoint for what to do next.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("confirmation_token") + public PlanStage confirmationToken(@NotNull String confirmationToken) { + this.confirmationToken = Objects.requireNonNull(confirmationToken, "confirmationToken must not be null"); + return this; + } + + /** + *

Pass this object to create a new plan for this payment

+ *

Pass this object to create a new plan for this payment

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan") + public _FinalStage plan(@NotNull CreatePaymentsRequestZeroPlan plan) { + this.plan = Objects.requireNonNull(plan, "plan must not be null"); + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(Nullable returnUrl) { + if (returnUrl.isNull()) { + this.returnUrl = null; + } else if (returnUrl.isEmpty()) { + this.returnUrl = Optional.empty(); + } else { + this.returnUrl = Optional.of(returnUrl.get()); + } + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(String returnUrl) { + this.returnUrl = Optional.ofNullable(returnUrl); + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. Editable until they return — see the payment's update endpoint. Ignored unless confirmation_token is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "return_url", nulls = Nulls.SKIP) + public _FinalStage returnUrl(Optional returnUrl) { + this.returnUrl = returnUrl; + return this; + } + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCodeId(Nullable promoCodeId) { + if (promoCodeId.isNull()) { + this.promoCodeId = null; + } else if (promoCodeId.isEmpty()) { + this.promoCodeId = Optional.empty(); + } else { + this.promoCodeId = Optional.of(promoCodeId.get()); + } + return this; + } + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCodeId(String promoCodeId) { + this.promoCodeId = Optional.ofNullable(promoCodeId); + return this; + } + + /** + *

The ID of an active promo code to apply to this payment. The promo code must belong to the company and be valid for the plan being purchased. The plan must be attached to a product — promo codes are not eligible for one-off purchases.

+ */ + @java.lang.Override + @JsonSetter(value = "promo_code_id", nulls = Nulls.SKIP) + public _FinalStage promoCodeId(Optional promoCodeId) { + this.promoCodeId = promoCodeId; + return this; + } + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodId(Nullable paymentMethodId) { + if (paymentMethodId.isNull()) { + this.paymentMethodId = null; + } else if (paymentMethodId.isEmpty()) { + this.paymentMethodId = Optional.empty(); + } else { + this.paymentMethodId = Optional.of(paymentMethodId.get()); + } + return this; + } + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodId(String paymentMethodId) { + this.paymentMethodId = Optional.ofNullable(paymentMethodId); + return this; + } + + /** + *

The ID of the payment method to use for the payment. It must be connected to the Member being charged. Required unless confirmation_token is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_id", nulls = Nulls.SKIP) + public _FinalStage paymentMethodId(Optional paymentMethodId) { + this.paymentMethodId = paymentMethodId; + return this; + } + + /** + *

Custom metadata to attach to the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom metadata to attach to the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom metadata to attach to the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the payment belongs to. Ignored when the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public CreatePaymentsRequestZero build() { + return new CreatePaymentsRequestZero( + companyId, + confirmationToken, + email, + metadata, + paymentMethodId, + plan, + promoCodeId, + returnUrl, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestZeroPlan.java b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestZeroPlan.java new file mode 100644 index 00000000..5370e6e2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestZeroPlan.java @@ -0,0 +1,1150 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Currencies; +import com.whop.api.types.PlanTypes; +import com.whop.api.types.Visibility; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePaymentsRequestZeroPlan.Builder.class) +public final class CreatePaymentsRequestZeroPlan { + private final Optional applicationFeeAmount; + + private final Optional billingPeriod; + + private final Currencies currency; + + private final Optional description; + + private final Optional expirationDays; + + private final Optional forceCreateNewPlan; + + private final Optional initialPrice; + + private final Optional internalNotes; + + private final Optional planType; + + private final Optional product; + + private final Optional productId; + + private final Optional renewalPrice; + + private final Optional title; + + private final Optional trialPeriodDays; + + private final Optional visibility; + + private final Map additionalProperties; + + private CreatePaymentsRequestZeroPlan( + Optional applicationFeeAmount, + Optional billingPeriod, + Currencies currency, + Optional description, + Optional expirationDays, + Optional forceCreateNewPlan, + Optional initialPrice, + Optional internalNotes, + Optional planType, + Optional product, + Optional productId, + Optional renewalPrice, + Optional title, + Optional trialPeriodDays, + Optional visibility, + Map additionalProperties) { + this.applicationFeeAmount = applicationFeeAmount; + this.billingPeriod = billingPeriod; + this.currency = currency; + this.description = description; + this.expirationDays = expirationDays; + this.forceCreateNewPlan = forceCreateNewPlan; + this.initialPrice = initialPrice; + this.internalNotes = internalNotes; + this.planType = planType; + this.product = product; + this.productId = productId; + this.renewalPrice = renewalPrice; + this.title = title; + this.trialPeriodDays = trialPeriodDays; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return The application fee amount collected by the platform from this connected account. Provided as a number in dollars (e.g., 5.00 for $5.00). Must be less than the total payment amount. Only valid for connected accounts with a parent company. + */ + @JsonIgnore + public Optional getApplicationFeeAmount() { + if (applicationFeeAmount == null) { + return Optional.empty(); + } + return applicationFeeAmount; + } + + /** + * @return The interval in days at which the plan charges (renewal plans). For example, 30 for monthly billing. + */ + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + /** + * @return The respective currency identifier for the plan. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The description of the plan. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The number of days until the membership expires and revokes access (expiration plans). For example, 365 for one year. + */ + @JsonIgnore + public Optional getExpirationDays() { + if (expirationDays == null) { + return Optional.empty(); + } + return expirationDays; + } + + /** + * @return Whether to force the creation of a new plan even if one with the same attributes already exists. + */ + @JsonIgnore + public Optional getForceCreateNewPlan() { + if (forceCreateNewPlan == null) { + return Optional.empty(); + } + return forceCreateNewPlan; + } + + /** + * @return An additional amount charged upon first purchase. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD. + */ + @JsonIgnore + public Optional getInitialPrice() { + if (initialPrice == null) { + return Optional.empty(); + } + return initialPrice; + } + + /** + * @return A personal description or notes section for the business. + */ + @JsonIgnore + public Optional getInternalNotes() { + if (internalNotes == null) { + return Optional.empty(); + } + return internalNotes; + } + + /** + * @return Indicates if the plan is a one time payment or recurring. + */ + @JsonIgnore + public Optional getPlanType() { + if (planType == null) { + return Optional.empty(); + } + return planType; + } + + /** + * @return Pass this object to create a new product for this plan. We will use the product external identifier to find or create an existing product. + */ + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return The product the plan is related to. Either this or product is required. + */ + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + /** + * @return The amount the customer is charged every billing period. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD. + */ + @JsonIgnore + public Optional getRenewalPrice() { + if (renewalPrice == null) { + return Optional.empty(); + } + return renewalPrice; + } + + /** + * @return The title of the plan. This will be visible on the product page to customers. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The number of free trial days added before a renewal plan. + */ + @JsonIgnore + public Optional getTrialPeriodDays() { + if (trialPeriodDays == null) { + return Optional.empty(); + } + return trialPeriodDays; + } + + /** + * @return Shows or hides the plan from public/business view. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("application_fee_amount") + private Optional _getApplicationFeeAmount() { + return applicationFeeAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_days") + private Optional _getExpirationDays() { + return expirationDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("force_create_new_plan") + private Optional _getForceCreateNewPlan() { + return forceCreateNewPlan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("initial_price") + private Optional _getInitialPrice() { + return initialPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("internal_notes") + private Optional _getInternalNotes() { + return internalNotes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan_type") + private Optional _getPlanType() { + return planType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("renewal_price") + private Optional _getRenewalPrice() { + return renewalPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trial_period_days") + private Optional _getTrialPeriodDays() { + return trialPeriodDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePaymentsRequestZeroPlan && equalTo((CreatePaymentsRequestZeroPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePaymentsRequestZeroPlan other) { + return applicationFeeAmount.equals(other.applicationFeeAmount) + && billingPeriod.equals(other.billingPeriod) + && currency.equals(other.currency) + && description.equals(other.description) + && expirationDays.equals(other.expirationDays) + && forceCreateNewPlan.equals(other.forceCreateNewPlan) + && initialPrice.equals(other.initialPrice) + && internalNotes.equals(other.internalNotes) + && planType.equals(other.planType) + && product.equals(other.product) + && productId.equals(other.productId) + && renewalPrice.equals(other.renewalPrice) + && title.equals(other.title) + && trialPeriodDays.equals(other.trialPeriodDays) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.applicationFeeAmount, + this.billingPeriod, + this.currency, + this.description, + this.expirationDays, + this.forceCreateNewPlan, + this.initialPrice, + this.internalNotes, + this.planType, + this.product, + this.productId, + this.renewalPrice, + this.title, + this.trialPeriodDays, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + /** + *

The respective currency identifier for the plan.

+ */ + _FinalStage currency(@NotNull Currencies currency); + + Builder from(CreatePaymentsRequestZeroPlan other); + } + + public interface _FinalStage { + CreatePaymentsRequestZeroPlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The application fee amount collected by the platform from this connected account. Provided as a number in dollars (e.g., 5.00 for $5.00). Must be less than the total payment amount. Only valid for connected accounts with a parent company.

+ */ + _FinalStage applicationFeeAmount(Optional applicationFeeAmount); + + _FinalStage applicationFeeAmount(Double applicationFeeAmount); + + _FinalStage applicationFeeAmount(Nullable applicationFeeAmount); + + /** + *

The interval in days at which the plan charges (renewal plans). For example, 30 for monthly billing.

+ */ + _FinalStage billingPeriod(Optional billingPeriod); + + _FinalStage billingPeriod(Integer billingPeriod); + + _FinalStage billingPeriod(Nullable billingPeriod); + + /** + *

The description of the plan.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

The number of days until the membership expires and revokes access (expiration plans). For example, 365 for one year.

+ */ + _FinalStage expirationDays(Optional expirationDays); + + _FinalStage expirationDays(Integer expirationDays); + + _FinalStage expirationDays(Nullable expirationDays); + + /** + *

Whether to force the creation of a new plan even if one with the same attributes already exists.

+ */ + _FinalStage forceCreateNewPlan(Optional forceCreateNewPlan); + + _FinalStage forceCreateNewPlan(Boolean forceCreateNewPlan); + + _FinalStage forceCreateNewPlan(Nullable forceCreateNewPlan); + + /** + *

An additional amount charged upon first purchase. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ */ + _FinalStage initialPrice(Optional initialPrice); + + _FinalStage initialPrice(Double initialPrice); + + _FinalStage initialPrice(Nullable initialPrice); + + /** + *

A personal description or notes section for the business.

+ */ + _FinalStage internalNotes(Optional internalNotes); + + _FinalStage internalNotes(String internalNotes); + + _FinalStage internalNotes(Nullable internalNotes); + + /** + *

Indicates if the plan is a one time payment or recurring.

+ */ + _FinalStage planType(Optional planType); + + _FinalStage planType(PlanTypes planType); + + _FinalStage planType(Nullable planType); + + /** + *

Pass this object to create a new product for this plan. We will use the product external identifier to find or create an existing product.

+ */ + _FinalStage product(Optional product); + + _FinalStage product(CreatePaymentsRequestZeroPlanProduct product); + + _FinalStage product(Nullable product); + + /** + *

The product the plan is related to. Either this or product is required.

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + + _FinalStage productId(Nullable productId); + + /** + *

The amount the customer is charged every billing period. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ */ + _FinalStage renewalPrice(Optional renewalPrice); + + _FinalStage renewalPrice(Double renewalPrice); + + _FinalStage renewalPrice(Nullable renewalPrice); + + /** + *

The title of the plan. This will be visible on the product page to customers.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + + /** + *

The number of free trial days added before a renewal plan.

+ */ + _FinalStage trialPeriodDays(Optional trialPeriodDays); + + _FinalStage trialPeriodDays(Integer trialPeriodDays); + + _FinalStage trialPeriodDays(Nullable trialPeriodDays); + + /** + *

Shows or hides the plan from public/business view.

+ */ + _FinalStage visibility(Optional visibility); + + _FinalStage visibility(Visibility visibility); + + _FinalStage visibility(Nullable visibility); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, _FinalStage { + private Currencies currency; + + private Optional visibility = Optional.empty(); + + private Optional trialPeriodDays = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional renewalPrice = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional product = Optional.empty(); + + private Optional planType = Optional.empty(); + + private Optional internalNotes = Optional.empty(); + + private Optional initialPrice = Optional.empty(); + + private Optional forceCreateNewPlan = Optional.empty(); + + private Optional expirationDays = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional billingPeriod = Optional.empty(); + + private Optional applicationFeeAmount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePaymentsRequestZeroPlan other) { + applicationFeeAmount(other.getApplicationFeeAmount()); + billingPeriod(other.getBillingPeriod()); + currency(other.getCurrency()); + description(other.getDescription()); + expirationDays(other.getExpirationDays()); + forceCreateNewPlan(other.getForceCreateNewPlan()); + initialPrice(other.getInitialPrice()); + internalNotes(other.getInternalNotes()); + planType(other.getPlanType()); + product(other.getProduct()); + productId(other.getProductId()); + renewalPrice(other.getRenewalPrice()); + title(other.getTitle()); + trialPeriodDays(other.getTrialPeriodDays()); + visibility(other.getVisibility()); + return this; + } + + /** + *

The respective currency identifier for the plan.

+ *

The respective currency identifier for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Shows or hides the plan from public/business view.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + /** + *

Shows or hides the plan from public/business view.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(Visibility visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + /** + *

Shows or hides the plan from public/business view.

+ */ + @java.lang.Override + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public _FinalStage visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + /** + *

The number of free trial days added before a renewal plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Nullable trialPeriodDays) { + if (trialPeriodDays.isNull()) { + this.trialPeriodDays = null; + } else if (trialPeriodDays.isEmpty()) { + this.trialPeriodDays = Optional.empty(); + } else { + this.trialPeriodDays = Optional.of(trialPeriodDays.get()); + } + return this; + } + + /** + *

The number of free trial days added before a renewal plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Integer trialPeriodDays) { + this.trialPeriodDays = Optional.ofNullable(trialPeriodDays); + return this; + } + + /** + *

The number of free trial days added before a renewal plan.

+ */ + @java.lang.Override + @JsonSetter(value = "trial_period_days", nulls = Nulls.SKIP) + public _FinalStage trialPeriodDays(Optional trialPeriodDays) { + this.trialPeriodDays = trialPeriodDays; + return this; + } + + /** + *

The title of the plan. This will be visible on the product page to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

The title of the plan. This will be visible on the product page to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The title of the plan. This will be visible on the product page to customers.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

The amount the customer is charged every billing period. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage renewalPrice(Nullable renewalPrice) { + if (renewalPrice.isNull()) { + this.renewalPrice = null; + } else if (renewalPrice.isEmpty()) { + this.renewalPrice = Optional.empty(); + } else { + this.renewalPrice = Optional.of(renewalPrice.get()); + } + return this; + } + + /** + *

The amount the customer is charged every billing period. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage renewalPrice(Double renewalPrice) { + this.renewalPrice = Optional.ofNullable(renewalPrice); + return this; + } + + /** + *

The amount the customer is charged every billing period. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ */ + @java.lang.Override + @JsonSetter(value = "renewal_price", nulls = Nulls.SKIP) + public _FinalStage renewalPrice(Optional renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + /** + *

The product the plan is related to. Either this or product is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + /** + *

The product the plan is related to. Either this or product is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

The product the plan is related to. Either this or product is required.

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

Pass this object to create a new product for this plan. We will use the product external identifier to find or create an existing product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

Pass this object to create a new product for this plan. We will use the product external identifier to find or create an existing product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(CreatePaymentsRequestZeroPlanProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

Pass this object to create a new product for this plan. We will use the product external identifier to find or create an existing product.

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

Indicates if the plan is a one time payment or recurring.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planType(Nullable planType) { + if (planType.isNull()) { + this.planType = null; + } else if (planType.isEmpty()) { + this.planType = Optional.empty(); + } else { + this.planType = Optional.of(planType.get()); + } + return this; + } + + /** + *

Indicates if the plan is a one time payment or recurring.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planType(PlanTypes planType) { + this.planType = Optional.ofNullable(planType); + return this; + } + + /** + *

Indicates if the plan is a one time payment or recurring.

+ */ + @java.lang.Override + @JsonSetter(value = "plan_type", nulls = Nulls.SKIP) + public _FinalStage planType(Optional planType) { + this.planType = planType; + return this; + } + + /** + *

A personal description or notes section for the business.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage internalNotes(Nullable internalNotes) { + if (internalNotes.isNull()) { + this.internalNotes = null; + } else if (internalNotes.isEmpty()) { + this.internalNotes = Optional.empty(); + } else { + this.internalNotes = Optional.of(internalNotes.get()); + } + return this; + } + + /** + *

A personal description or notes section for the business.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage internalNotes(String internalNotes) { + this.internalNotes = Optional.ofNullable(internalNotes); + return this; + } + + /** + *

A personal description or notes section for the business.

+ */ + @java.lang.Override + @JsonSetter(value = "internal_notes", nulls = Nulls.SKIP) + public _FinalStage internalNotes(Optional internalNotes) { + this.internalNotes = internalNotes; + return this; + } + + /** + *

An additional amount charged upon first purchase. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage initialPrice(Nullable initialPrice) { + if (initialPrice.isNull()) { + this.initialPrice = null; + } else if (initialPrice.isEmpty()) { + this.initialPrice = Optional.empty(); + } else { + this.initialPrice = Optional.of(initialPrice.get()); + } + return this; + } + + /** + *

An additional amount charged upon first purchase. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage initialPrice(Double initialPrice) { + this.initialPrice = Optional.ofNullable(initialPrice); + return this; + } + + /** + *

An additional amount charged upon first purchase. Provided as a number in the specified currency. Eg: 10.43 for $10.43 USD.

+ */ + @java.lang.Override + @JsonSetter(value = "initial_price", nulls = Nulls.SKIP) + public _FinalStage initialPrice(Optional initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + /** + *

Whether to force the creation of a new plan even if one with the same attributes already exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage forceCreateNewPlan(Nullable forceCreateNewPlan) { + if (forceCreateNewPlan.isNull()) { + this.forceCreateNewPlan = null; + } else if (forceCreateNewPlan.isEmpty()) { + this.forceCreateNewPlan = Optional.empty(); + } else { + this.forceCreateNewPlan = Optional.of(forceCreateNewPlan.get()); + } + return this; + } + + /** + *

Whether to force the creation of a new plan even if one with the same attributes already exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage forceCreateNewPlan(Boolean forceCreateNewPlan) { + this.forceCreateNewPlan = Optional.ofNullable(forceCreateNewPlan); + return this; + } + + /** + *

Whether to force the creation of a new plan even if one with the same attributes already exists.

+ */ + @java.lang.Override + @JsonSetter(value = "force_create_new_plan", nulls = Nulls.SKIP) + public _FinalStage forceCreateNewPlan(Optional forceCreateNewPlan) { + this.forceCreateNewPlan = forceCreateNewPlan; + return this; + } + + /** + *

The number of days until the membership expires and revokes access (expiration plans). For example, 365 for one year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Nullable expirationDays) { + if (expirationDays.isNull()) { + this.expirationDays = null; + } else if (expirationDays.isEmpty()) { + this.expirationDays = Optional.empty(); + } else { + this.expirationDays = Optional.of(expirationDays.get()); + } + return this; + } + + /** + *

The number of days until the membership expires and revokes access (expiration plans). For example, 365 for one year.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Integer expirationDays) { + this.expirationDays = Optional.ofNullable(expirationDays); + return this; + } + + /** + *

The number of days until the membership expires and revokes access (expiration plans). For example, 365 for one year.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_days", nulls = Nulls.SKIP) + public _FinalStage expirationDays(Optional expirationDays) { + this.expirationDays = expirationDays; + return this; + } + + /** + *

The description of the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

The description of the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

The description of the plan.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

The interval in days at which the plan charges (renewal plans). For example, 30 for monthly billing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + /** + *

The interval in days at which the plan charges (renewal plans). For example, 30 for monthly billing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Integer billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + /** + *

The interval in days at which the plan charges (renewal plans). For example, 30 for monthly billing.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public _FinalStage billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + /** + *

The application fee amount collected by the platform from this connected account. Provided as a number in dollars (e.g., 5.00 for $5.00). Must be less than the total payment amount. Only valid for connected accounts with a parent company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage applicationFeeAmount(Nullable applicationFeeAmount) { + if (applicationFeeAmount.isNull()) { + this.applicationFeeAmount = null; + } else if (applicationFeeAmount.isEmpty()) { + this.applicationFeeAmount = Optional.empty(); + } else { + this.applicationFeeAmount = Optional.of(applicationFeeAmount.get()); + } + return this; + } + + /** + *

The application fee amount collected by the platform from this connected account. Provided as a number in dollars (e.g., 5.00 for $5.00). Must be less than the total payment amount. Only valid for connected accounts with a parent company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage applicationFeeAmount(Double applicationFeeAmount) { + this.applicationFeeAmount = Optional.ofNullable(applicationFeeAmount); + return this; + } + + /** + *

The application fee amount collected by the platform from this connected account. Provided as a number in dollars (e.g., 5.00 for $5.00). Must be less than the total payment amount. Only valid for connected accounts with a parent company.

+ */ + @java.lang.Override + @JsonSetter(value = "application_fee_amount", nulls = Nulls.SKIP) + public _FinalStage applicationFeeAmount(Optional applicationFeeAmount) { + this.applicationFeeAmount = applicationFeeAmount; + return this; + } + + @java.lang.Override + public CreatePaymentsRequestZeroPlan build() { + return new CreatePaymentsRequestZeroPlan( + applicationFeeAmount, + billingPeriod, + currency, + description, + expirationDays, + forceCreateNewPlan, + initialPrice, + internalNotes, + planType, + product, + productId, + renewalPrice, + title, + trialPeriodDays, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestZeroPlanProduct.java b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestZeroPlanProduct.java new file mode 100644 index 00000000..da2311e9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsRequestZeroPlanProduct.java @@ -0,0 +1,899 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.GlobalAffiliateStatuses; +import com.whop.api.types.Visibility; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePaymentsRequestZeroPlanProduct.Builder.class) +public final class CreatePaymentsRequestZeroPlanProduct { + private final Optional collectShippingAddress; + + private final Optional customStatementDescriptor; + + private final Optional description; + + private final String externalIdentifier; + + private final Optional globalAffiliatePercentage; + + private final Optional globalAffiliateStatus; + + private final Optional headline; + + private final Optional productTaxCodeId; + + private final Optional redirectPurchaseUrl; + + private final Optional route; + + private final String title; + + private final Optional visibility; + + private final Map additionalProperties; + + private CreatePaymentsRequestZeroPlanProduct( + Optional collectShippingAddress, + Optional customStatementDescriptor, + Optional description, + String externalIdentifier, + Optional globalAffiliatePercentage, + Optional globalAffiliateStatus, + Optional headline, + Optional productTaxCodeId, + Optional redirectPurchaseUrl, + Optional route, + String title, + Optional visibility, + Map additionalProperties) { + this.collectShippingAddress = collectShippingAddress; + this.customStatementDescriptor = customStatementDescriptor; + this.description = description; + this.externalIdentifier = externalIdentifier; + this.globalAffiliatePercentage = globalAffiliatePercentage; + this.globalAffiliateStatus = globalAffiliateStatus; + this.headline = headline; + this.productTaxCodeId = productTaxCodeId; + this.redirectPurchaseUrl = redirectPurchaseUrl; + this.route = route; + this.title = title; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether or not to collect shipping information at checkout from the customer. + */ + @JsonIgnore + public Optional getCollectShippingAddress() { + if (collectShippingAddress == null) { + return Optional.empty(); + } + return collectShippingAddress; + } + + /** + * @return The custom statement descriptor for the product i.e. WHOP*SPORTS, must be between 5 and 22 characters, contain at least one letter, and not contain any of the following characters: <, >, , ', " + */ + @JsonIgnore + public Optional getCustomStatementDescriptor() { + if (customStatementDescriptor == null) { + return Optional.empty(); + } + return customStatementDescriptor; + } + + /** + * @return A written description of the product. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return A unique ID used to find or create a product. When provided during creation, we will look for an existing product with this external identifier — if found, it will be updated; otherwise, a new product will be created. + */ + @JsonProperty("external_identifier") + public String getExternalIdentifier() { + return externalIdentifier; + } + + /** + * @return The percentage of the revenue that goes to the global affiliate program. + */ + @JsonIgnore + public Optional getGlobalAffiliatePercentage() { + if (globalAffiliatePercentage == null) { + return Optional.empty(); + } + return globalAffiliatePercentage; + } + + /** + * @return The status of the global affiliate program for this product. + */ + @JsonIgnore + public Optional getGlobalAffiliateStatus() { + if (globalAffiliateStatus == null) { + return Optional.empty(); + } + return globalAffiliateStatus; + } + + /** + * @return The headline of the product. + */ + @JsonIgnore + public Optional getHeadline() { + if (headline == null) { + return Optional.empty(); + } + return headline; + } + + /** + * @return The ID of the product tax code to apply to this product. + */ + @JsonIgnore + public Optional getProductTaxCodeId() { + if (productTaxCodeId == null) { + return Optional.empty(); + } + return productTaxCodeId; + } + + /** + * @return The URL to redirect the customer to after a purchase. + */ + @JsonIgnore + public Optional getRedirectPurchaseUrl() { + if (redirectPurchaseUrl == null) { + return Optional.empty(); + } + return redirectPurchaseUrl; + } + + /** + * @return The route of the product. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return The title of the product. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return This product will/will not be displayed publicly - default hidden. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("collect_shipping_address") + private Optional _getCollectShippingAddress() { + return collectShippingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_statement_descriptor") + private Optional _getCustomStatementDescriptor() { + return customStatementDescriptor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("global_affiliate_percentage") + private Optional _getGlobalAffiliatePercentage() { + return globalAffiliatePercentage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("global_affiliate_status") + private Optional _getGlobalAffiliateStatus() { + return globalAffiliateStatus; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("headline") + private Optional _getHeadline() { + return headline; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_tax_code_id") + private Optional _getProductTaxCodeId() { + return productTaxCodeId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("redirect_purchase_url") + private Optional _getRedirectPurchaseUrl() { + return redirectPurchaseUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePaymentsRequestZeroPlanProduct + && equalTo((CreatePaymentsRequestZeroPlanProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePaymentsRequestZeroPlanProduct other) { + return collectShippingAddress.equals(other.collectShippingAddress) + && customStatementDescriptor.equals(other.customStatementDescriptor) + && description.equals(other.description) + && externalIdentifier.equals(other.externalIdentifier) + && globalAffiliatePercentage.equals(other.globalAffiliatePercentage) + && globalAffiliateStatus.equals(other.globalAffiliateStatus) + && headline.equals(other.headline) + && productTaxCodeId.equals(other.productTaxCodeId) + && redirectPurchaseUrl.equals(other.redirectPurchaseUrl) + && route.equals(other.route) + && title.equals(other.title) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.collectShippingAddress, + this.customStatementDescriptor, + this.description, + this.externalIdentifier, + this.globalAffiliatePercentage, + this.globalAffiliateStatus, + this.headline, + this.productTaxCodeId, + this.redirectPurchaseUrl, + this.route, + this.title, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalIdentifierStage builder() { + return new Builder(); + } + + public interface ExternalIdentifierStage { + /** + *

A unique ID used to find or create a product. When provided during creation, we will look for an existing product with this external identifier — if found, it will be updated; otherwise, a new product will be created.

+ */ + TitleStage externalIdentifier(@NotNull String externalIdentifier); + + Builder from(CreatePaymentsRequestZeroPlanProduct other); + } + + public interface TitleStage { + /** + *

The title of the product.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + CreatePaymentsRequestZeroPlanProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Whether or not to collect shipping information at checkout from the customer.

+ */ + _FinalStage collectShippingAddress(Optional collectShippingAddress); + + _FinalStage collectShippingAddress(Boolean collectShippingAddress); + + _FinalStage collectShippingAddress(Nullable collectShippingAddress); + + /** + *

The custom statement descriptor for the product i.e. WHOP*SPORTS, must be between 5 and 22 characters, contain at least one letter, and not contain any of the following characters: <, >, , ', "

+ */ + _FinalStage customStatementDescriptor(Optional customStatementDescriptor); + + _FinalStage customStatementDescriptor(String customStatementDescriptor); + + _FinalStage customStatementDescriptor(Nullable customStatementDescriptor); + + /** + *

A written description of the product.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

The percentage of the revenue that goes to the global affiliate program.

+ */ + _FinalStage globalAffiliatePercentage(Optional globalAffiliatePercentage); + + _FinalStage globalAffiliatePercentage(Double globalAffiliatePercentage); + + _FinalStage globalAffiliatePercentage(Nullable globalAffiliatePercentage); + + /** + *

The status of the global affiliate program for this product.

+ */ + _FinalStage globalAffiliateStatus(Optional globalAffiliateStatus); + + _FinalStage globalAffiliateStatus(GlobalAffiliateStatuses globalAffiliateStatus); + + _FinalStage globalAffiliateStatus(Nullable globalAffiliateStatus); + + /** + *

The headline of the product.

+ */ + _FinalStage headline(Optional headline); + + _FinalStage headline(String headline); + + _FinalStage headline(Nullable headline); + + /** + *

The ID of the product tax code to apply to this product.

+ */ + _FinalStage productTaxCodeId(Optional productTaxCodeId); + + _FinalStage productTaxCodeId(String productTaxCodeId); + + _FinalStage productTaxCodeId(Nullable productTaxCodeId); + + /** + *

The URL to redirect the customer to after a purchase.

+ */ + _FinalStage redirectPurchaseUrl(Optional redirectPurchaseUrl); + + _FinalStage redirectPurchaseUrl(String redirectPurchaseUrl); + + _FinalStage redirectPurchaseUrl(Nullable redirectPurchaseUrl); + + /** + *

The route of the product.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

This product will/will not be displayed publicly - default hidden.

+ */ + _FinalStage visibility(Optional visibility); + + _FinalStage visibility(Visibility visibility); + + _FinalStage visibility(Nullable visibility); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalIdentifierStage, TitleStage, _FinalStage { + private String externalIdentifier; + + private String title; + + private Optional visibility = Optional.empty(); + + private Optional route = Optional.empty(); + + private Optional redirectPurchaseUrl = Optional.empty(); + + private Optional productTaxCodeId = Optional.empty(); + + private Optional headline = Optional.empty(); + + private Optional globalAffiliateStatus = Optional.empty(); + + private Optional globalAffiliatePercentage = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional customStatementDescriptor = Optional.empty(); + + private Optional collectShippingAddress = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePaymentsRequestZeroPlanProduct other) { + collectShippingAddress(other.getCollectShippingAddress()); + customStatementDescriptor(other.getCustomStatementDescriptor()); + description(other.getDescription()); + externalIdentifier(other.getExternalIdentifier()); + globalAffiliatePercentage(other.getGlobalAffiliatePercentage()); + globalAffiliateStatus(other.getGlobalAffiliateStatus()); + headline(other.getHeadline()); + productTaxCodeId(other.getProductTaxCodeId()); + redirectPurchaseUrl(other.getRedirectPurchaseUrl()); + route(other.getRoute()); + title(other.getTitle()); + visibility(other.getVisibility()); + return this; + } + + /** + *

A unique ID used to find or create a product. When provided during creation, we will look for an existing product with this external identifier — if found, it will be updated; otherwise, a new product will be created.

+ *

A unique ID used to find or create a product. When provided during creation, we will look for an existing product with this external identifier — if found, it will be updated; otherwise, a new product will be created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_identifier") + public TitleStage externalIdentifier(@NotNull String externalIdentifier) { + this.externalIdentifier = Objects.requireNonNull(externalIdentifier, "externalIdentifier must not be null"); + return this; + } + + /** + *

The title of the product.

+ *

The title of the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

This product will/will not be displayed publicly - default hidden.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + /** + *

This product will/will not be displayed publicly - default hidden.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(Visibility visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + /** + *

This product will/will not be displayed publicly - default hidden.

+ */ + @java.lang.Override + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public _FinalStage visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + /** + *

The route of the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

The route of the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

The route of the product.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + /** + *

The URL to redirect the customer to after a purchase.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectPurchaseUrl(Nullable redirectPurchaseUrl) { + if (redirectPurchaseUrl.isNull()) { + this.redirectPurchaseUrl = null; + } else if (redirectPurchaseUrl.isEmpty()) { + this.redirectPurchaseUrl = Optional.empty(); + } else { + this.redirectPurchaseUrl = Optional.of(redirectPurchaseUrl.get()); + } + return this; + } + + /** + *

The URL to redirect the customer to after a purchase.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectPurchaseUrl(String redirectPurchaseUrl) { + this.redirectPurchaseUrl = Optional.ofNullable(redirectPurchaseUrl); + return this; + } + + /** + *

The URL to redirect the customer to after a purchase.

+ */ + @java.lang.Override + @JsonSetter(value = "redirect_purchase_url", nulls = Nulls.SKIP) + public _FinalStage redirectPurchaseUrl(Optional redirectPurchaseUrl) { + this.redirectPurchaseUrl = redirectPurchaseUrl; + return this; + } + + /** + *

The ID of the product tax code to apply to this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productTaxCodeId(Nullable productTaxCodeId) { + if (productTaxCodeId.isNull()) { + this.productTaxCodeId = null; + } else if (productTaxCodeId.isEmpty()) { + this.productTaxCodeId = Optional.empty(); + } else { + this.productTaxCodeId = Optional.of(productTaxCodeId.get()); + } + return this; + } + + /** + *

The ID of the product tax code to apply to this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productTaxCodeId(String productTaxCodeId) { + this.productTaxCodeId = Optional.ofNullable(productTaxCodeId); + return this; + } + + /** + *

The ID of the product tax code to apply to this product.

+ */ + @java.lang.Override + @JsonSetter(value = "product_tax_code_id", nulls = Nulls.SKIP) + public _FinalStage productTaxCodeId(Optional productTaxCodeId) { + this.productTaxCodeId = productTaxCodeId; + return this; + } + + /** + *

The headline of the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage headline(Nullable headline) { + if (headline.isNull()) { + this.headline = null; + } else if (headline.isEmpty()) { + this.headline = Optional.empty(); + } else { + this.headline = Optional.of(headline.get()); + } + return this; + } + + /** + *

The headline of the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage headline(String headline) { + this.headline = Optional.ofNullable(headline); + return this; + } + + /** + *

The headline of the product.

+ */ + @java.lang.Override + @JsonSetter(value = "headline", nulls = Nulls.SKIP) + public _FinalStage headline(Optional headline) { + this.headline = headline; + return this; + } + + /** + *

The status of the global affiliate program for this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage globalAffiliateStatus(Nullable globalAffiliateStatus) { + if (globalAffiliateStatus.isNull()) { + this.globalAffiliateStatus = null; + } else if (globalAffiliateStatus.isEmpty()) { + this.globalAffiliateStatus = Optional.empty(); + } else { + this.globalAffiliateStatus = Optional.of(globalAffiliateStatus.get()); + } + return this; + } + + /** + *

The status of the global affiliate program for this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage globalAffiliateStatus(GlobalAffiliateStatuses globalAffiliateStatus) { + this.globalAffiliateStatus = Optional.ofNullable(globalAffiliateStatus); + return this; + } + + /** + *

The status of the global affiliate program for this product.

+ */ + @java.lang.Override + @JsonSetter(value = "global_affiliate_status", nulls = Nulls.SKIP) + public _FinalStage globalAffiliateStatus(Optional globalAffiliateStatus) { + this.globalAffiliateStatus = globalAffiliateStatus; + return this; + } + + /** + *

The percentage of the revenue that goes to the global affiliate program.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage globalAffiliatePercentage(Nullable globalAffiliatePercentage) { + if (globalAffiliatePercentage.isNull()) { + this.globalAffiliatePercentage = null; + } else if (globalAffiliatePercentage.isEmpty()) { + this.globalAffiliatePercentage = Optional.empty(); + } else { + this.globalAffiliatePercentage = Optional.of(globalAffiliatePercentage.get()); + } + return this; + } + + /** + *

The percentage of the revenue that goes to the global affiliate program.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage globalAffiliatePercentage(Double globalAffiliatePercentage) { + this.globalAffiliatePercentage = Optional.ofNullable(globalAffiliatePercentage); + return this; + } + + /** + *

The percentage of the revenue that goes to the global affiliate program.

+ */ + @java.lang.Override + @JsonSetter(value = "global_affiliate_percentage", nulls = Nulls.SKIP) + public _FinalStage globalAffiliatePercentage(Optional globalAffiliatePercentage) { + this.globalAffiliatePercentage = globalAffiliatePercentage; + return this; + } + + /** + *

A written description of the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

A written description of the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

A written description of the product.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

The custom statement descriptor for the product i.e. WHOP*SPORTS, must be between 5 and 22 characters, contain at least one letter, and not contain any of the following characters: <, >, , ', "

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customStatementDescriptor(Nullable customStatementDescriptor) { + if (customStatementDescriptor.isNull()) { + this.customStatementDescriptor = null; + } else if (customStatementDescriptor.isEmpty()) { + this.customStatementDescriptor = Optional.empty(); + } else { + this.customStatementDescriptor = Optional.of(customStatementDescriptor.get()); + } + return this; + } + + /** + *

The custom statement descriptor for the product i.e. WHOP*SPORTS, must be between 5 and 22 characters, contain at least one letter, and not contain any of the following characters: <, >, , ', "

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customStatementDescriptor(String customStatementDescriptor) { + this.customStatementDescriptor = Optional.ofNullable(customStatementDescriptor); + return this; + } + + /** + *

The custom statement descriptor for the product i.e. WHOP*SPORTS, must be between 5 and 22 characters, contain at least one letter, and not contain any of the following characters: <, >, , ', "

+ */ + @java.lang.Override + @JsonSetter(value = "custom_statement_descriptor", nulls = Nulls.SKIP) + public _FinalStage customStatementDescriptor(Optional customStatementDescriptor) { + this.customStatementDescriptor = customStatementDescriptor; + return this; + } + + /** + *

Whether or not to collect shipping information at checkout from the customer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage collectShippingAddress(Nullable collectShippingAddress) { + if (collectShippingAddress.isNull()) { + this.collectShippingAddress = null; + } else if (collectShippingAddress.isEmpty()) { + this.collectShippingAddress = Optional.empty(); + } else { + this.collectShippingAddress = Optional.of(collectShippingAddress.get()); + } + return this; + } + + /** + *

Whether or not to collect shipping information at checkout from the customer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage collectShippingAddress(Boolean collectShippingAddress) { + this.collectShippingAddress = Optional.ofNullable(collectShippingAddress); + return this; + } + + /** + *

Whether or not to collect shipping information at checkout from the customer.

+ */ + @java.lang.Override + @JsonSetter(value = "collect_shipping_address", nulls = Nulls.SKIP) + public _FinalStage collectShippingAddress(Optional collectShippingAddress) { + this.collectShippingAddress = collectShippingAddress; + return this; + } + + @java.lang.Override + public CreatePaymentsRequestZeroPlanProduct build() { + return new CreatePaymentsRequestZeroPlanProduct( + collectShippingAddress, + customStatementDescriptor, + description, + externalIdentifier, + globalAffiliatePercentage, + globalAffiliateStatus, + headline, + productTaxCodeId, + redirectPurchaseUrl, + route, + title, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsResponse.java b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsResponse.java new file mode 100644 index 00000000..d4785617 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/CreatePaymentsResponse.java @@ -0,0 +1,4251 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.BillingReasons; +import com.whop.api.types.CardBrands; +import com.whop.api.types.Currencies; +import com.whop.api.types.FriendlyReceiptStatus; +import com.whop.api.types.IPayment; +import com.whop.api.types.PaymentApplicationFee; +import com.whop.api.types.PaymentBillingAddress; +import com.whop.api.types.PaymentCompany; +import com.whop.api.types.PaymentDeclineCodes; +import com.whop.api.types.PaymentDisputesItem; +import com.whop.api.types.PaymentFinancingTransactionsItem; +import com.whop.api.types.PaymentMember; +import com.whop.api.types.PaymentMembership; +import com.whop.api.types.PaymentMethodTypes; +import com.whop.api.types.PaymentPaymentInstrument; +import com.whop.api.types.PaymentPaymentMethod; +import com.whop.api.types.PaymentPlan; +import com.whop.api.types.PaymentProduct; +import com.whop.api.types.PaymentPromoCode; +import com.whop.api.types.PaymentRefundsItem; +import com.whop.api.types.PaymentResolutionsItem; +import com.whop.api.types.PaymentShipment; +import com.whop.api.types.PaymentShippingAddress; +import com.whop.api.types.PaymentUser; +import com.whop.api.types.PaymentVerificationChecks; +import com.whop.api.types.ReceiptStatus; +import com.whop.api.types.ReceiptTaxBehaviors; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePaymentsResponse.Builder.class) +public final class CreatePaymentsResponse implements IPayment { + private final double amountAfterFees; + + private final Optional applicationFee; + + private final boolean autoRefunded; + + private final Optional billingAddress; + + private final Optional billingReason; + + private final Optional cardBrand; + + private final Optional cardExpMonth; + + private final Optional cardExpYear; + + private final Optional cardLast4; + + private final Optional checkoutConfigurationId; + + private final Optional company; + + private final OffsetDateTime createdAt; + + private final Currencies currency; + + private final Optional customerPhone; + + private final Optional declineCode; + + private final Optional disputeAlertedAt; + + private final Optional> disputes; + + private final Optional failureMessage; + + private final Optional financingInstallmentsCount; + + private final List financingTransactions; + + private final String id; + + private final Optional lastPaymentAttempt; + + private final Optional member; + + private final Optional membership; + + private final Optional> metadata; + + private final Optional needsTracking; + + private final Optional nextPaymentAttempt; + + private final Optional paidAt; + + private final Optional paymentInstrument; + + private final Optional paymentMethod; + + private final Optional paymentMethodType; + + private final Optional paymentsFailed; + + private final Optional plan; + + private final Optional product; + + private final Optional promoCode; + + private final boolean refundable; + + private final Optional refundedAmount; + + private final Optional refundedAt; + + private final List refunds; + + private final Optional> resolutions; + + private final boolean retryable; + + private final Optional riskScore; + + private final Optional> riskSignals; + + private final double settlementAmount; + + private final Currencies settlementCurrency; + + private final Optional settlementExchangeRate; + + private final Optional settlementTimeAt; + + private final Optional shipment; + + private final Optional shippingAddress; + + private final Optional status; + + private final FriendlyReceiptStatus substatus; + + private final Optional subtotal; + + private final Optional taxAmount; + + private final Optional taxBehavior; + + private final Optional taxRefundedAmount; + + private final boolean threeDsVerified; + + private final Optional total; + + private final OffsetDateTime updatedAt; + + private final Optional usdTotal; + + private final Optional user; + + private final Optional verificationChecks; + + private final boolean voidable; + + private final Optional clientSecret; + + private final Map additionalProperties; + + private CreatePaymentsResponse( + double amountAfterFees, + Optional applicationFee, + boolean autoRefunded, + Optional billingAddress, + Optional billingReason, + Optional cardBrand, + Optional cardExpMonth, + Optional cardExpYear, + Optional cardLast4, + Optional checkoutConfigurationId, + Optional company, + OffsetDateTime createdAt, + Currencies currency, + Optional customerPhone, + Optional declineCode, + Optional disputeAlertedAt, + Optional> disputes, + Optional failureMessage, + Optional financingInstallmentsCount, + List financingTransactions, + String id, + Optional lastPaymentAttempt, + Optional member, + Optional membership, + Optional> metadata, + Optional needsTracking, + Optional nextPaymentAttempt, + Optional paidAt, + Optional paymentInstrument, + Optional paymentMethod, + Optional paymentMethodType, + Optional paymentsFailed, + Optional plan, + Optional product, + Optional promoCode, + boolean refundable, + Optional refundedAmount, + Optional refundedAt, + List refunds, + Optional> resolutions, + boolean retryable, + Optional riskScore, + Optional> riskSignals, + double settlementAmount, + Currencies settlementCurrency, + Optional settlementExchangeRate, + Optional settlementTimeAt, + Optional shipment, + Optional shippingAddress, + Optional status, + FriendlyReceiptStatus substatus, + Optional subtotal, + Optional taxAmount, + Optional taxBehavior, + Optional taxRefundedAmount, + boolean threeDsVerified, + Optional total, + OffsetDateTime updatedAt, + Optional usdTotal, + Optional user, + Optional verificationChecks, + boolean voidable, + Optional clientSecret, + Map additionalProperties) { + this.amountAfterFees = amountAfterFees; + this.applicationFee = applicationFee; + this.autoRefunded = autoRefunded; + this.billingAddress = billingAddress; + this.billingReason = billingReason; + this.cardBrand = cardBrand; + this.cardExpMonth = cardExpMonth; + this.cardExpYear = cardExpYear; + this.cardLast4 = cardLast4; + this.checkoutConfigurationId = checkoutConfigurationId; + this.company = company; + this.createdAt = createdAt; + this.currency = currency; + this.customerPhone = customerPhone; + this.declineCode = declineCode; + this.disputeAlertedAt = disputeAlertedAt; + this.disputes = disputes; + this.failureMessage = failureMessage; + this.financingInstallmentsCount = financingInstallmentsCount; + this.financingTransactions = financingTransactions; + this.id = id; + this.lastPaymentAttempt = lastPaymentAttempt; + this.member = member; + this.membership = membership; + this.metadata = metadata; + this.needsTracking = needsTracking; + this.nextPaymentAttempt = nextPaymentAttempt; + this.paidAt = paidAt; + this.paymentInstrument = paymentInstrument; + this.paymentMethod = paymentMethod; + this.paymentMethodType = paymentMethodType; + this.paymentsFailed = paymentsFailed; + this.plan = plan; + this.product = product; + this.promoCode = promoCode; + this.refundable = refundable; + this.refundedAmount = refundedAmount; + this.refundedAt = refundedAt; + this.refunds = refunds; + this.resolutions = resolutions; + this.retryable = retryable; + this.riskScore = riskScore; + this.riskSignals = riskSignals; + this.settlementAmount = settlementAmount; + this.settlementCurrency = settlementCurrency; + this.settlementExchangeRate = settlementExchangeRate; + this.settlementTimeAt = settlementTimeAt; + this.shipment = shipment; + this.shippingAddress = shippingAddress; + this.status = status; + this.substatus = substatus; + this.subtotal = subtotal; + this.taxAmount = taxAmount; + this.taxBehavior = taxBehavior; + this.taxRefundedAmount = taxRefundedAmount; + this.threeDsVerified = threeDsVerified; + this.total = total; + this.updatedAt = updatedAt; + this.usdTotal = usdTotal; + this.user = user; + this.verificationChecks = verificationChecks; + this.voidable = voidable; + this.clientSecret = clientSecret; + this.additionalProperties = additionalProperties; + } + + /** + * @return How much the payment is for after fees + */ + @JsonProperty("amount_after_fees") + @java.lang.Override + public double getAmountAfterFees() { + return amountAfterFees; + } + + /** + * @return The application fee charged on this payment. + */ + @JsonIgnore + public Optional getApplicationFee() { + if (applicationFee == null) { + return Optional.empty(); + } + return applicationFee; + } + + /** + * @return Whether this payment was auto refunded or not + */ + @JsonProperty("auto_refunded") + @java.lang.Override + public boolean getAutoRefunded() { + return autoRefunded; + } + + /** + * @return The address of the user who made the payment. + */ + @JsonIgnore + public Optional getBillingAddress() { + if (billingAddress == null) { + return Optional.empty(); + } + return billingAddress; + } + + /** + * @return The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment. + */ + @JsonIgnore + @java.lang.Override + public Optional getBillingReason() { + if (billingReason == null) { + return Optional.empty(); + } + return billingReason; + } + + /** + * @return Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'. + */ + @JsonIgnore + @java.lang.Override + public Optional getCardBrand() { + if (cardBrand == null) { + return Optional.empty(); + } + return cardBrand; + } + + /** + * @return The expiration month (1-12) of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable. + */ + @JsonIgnore + @java.lang.Override + public Optional getCardExpMonth() { + if (cardExpMonth == null) { + return Optional.empty(); + } + return cardExpMonth; + } + + /** + * @return The four-digit expiration year of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable. + */ + @JsonIgnore + @java.lang.Override + public Optional getCardExpYear() { + if (cardExpYear == null) { + return Optional.empty(); + } + return cardExpYear; + } + + /** + * @return The last four digits of the card used to make this payment. Null if the payment was not made with a card. + */ + @JsonIgnore + @java.lang.Override + public Optional getCardLast4() { + if (cardLast4 == null) { + return Optional.empty(); + } + return cardLast4; + } + + /** + * @return The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them. + */ + @JsonIgnore + @java.lang.Override + public Optional getCheckoutConfigurationId() { + if (checkoutConfigurationId == null) { + return Optional.empty(); + } + return checkoutConfigurationId; + } + + /** + * @return The company for the payment. + */ + @JsonIgnore + public Optional getCompany() { + if (company == null) { + return Optional.empty(); + } + return company; + } + + /** + * @return The datetime the payment was created. + */ + @JsonProperty("created_at") + @java.lang.Override + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code for this payment (e.g., 'usd', 'eur'). + */ + @JsonProperty("currency") + @java.lang.Override + public Currencies getCurrency() { + return currency; + } + + /** + * @return Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected. + */ + @JsonIgnore + @java.lang.Override + public Optional getCustomerPhone() { + if (customerPhone == null) { + return Optional.empty(); + } + return customerPhone; + } + + /** + * @return The reason the payment was declined. Null if the payment did not fail. + */ + @JsonIgnore + @java.lang.Override + public Optional getDeclineCode() { + if (declineCode == null) { + return Optional.empty(); + } + return declineCode; + } + + /** + * @return When an alert came in that this transaction will be disputed + */ + @JsonIgnore + @java.lang.Override + public Optional getDisputeAlertedAt() { + if (disputeAlertedAt == null) { + return Optional.empty(); + } + return disputeAlertedAt; + } + + /** + * @return The disputes attached to this payment. Null if the actor in context does not have the payment:dispute:read permission. + */ + @JsonIgnore + public Optional> getDisputes() { + if (disputes == null) { + return Optional.empty(); + } + return disputes; + } + + /** + * @return If the payment failed, the reason for the failure. + */ + @JsonIgnore + @java.lang.Override + public Optional getFailureMessage() { + if (failureMessage == null) { + return Optional.empty(); + } + return failureMessage; + } + + /** + * @return The number of financing installments for the payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.). + */ + @JsonIgnore + @java.lang.Override + public Optional getFinancingInstallmentsCount() { + if (financingInstallmentsCount == null) { + return Optional.empty(); + } + return financingInstallmentsCount; + } + + /** + * @return The financing transactions attached to this payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.). + */ + @JsonProperty("financing_transactions") + public List getFinancingTransactions() { + return financingTransactions; + } + + /** + * @return The unique identifier for the payment. + */ + @JsonProperty("id") + @java.lang.Override + public String getId() { + return id; + } + + /** + * @return The time of the last payment attempt. + */ + @JsonIgnore + @java.lang.Override + public Optional getLastPaymentAttempt() { + if (lastPaymentAttempt == null) { + return Optional.empty(); + } + return lastPaymentAttempt; + } + + /** + * @return The member attached to this payment. + */ + @JsonIgnore + public Optional getMember() { + if (member == null) { + return Optional.empty(); + } + return member; + } + + /** + * @return The membership attached to this payment. + */ + @JsonIgnore + public Optional getMembership() { + if (membership == null) { + return Optional.empty(); + } + return membership; + } + + /** + * @return The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made + */ + @JsonIgnore + @java.lang.Override + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Whether this payment is holding funds until the order ships and has no tracking number yet. + */ + @JsonIgnore + @java.lang.Override + public Optional getNeedsTracking() { + if (needsTracking == null) { + return Optional.empty(); + } + return needsTracking; + } + + /** + * @return The time of the next schedule payment retry. + */ + @JsonIgnore + @java.lang.Override + public Optional getNextPaymentAttempt() { + if (nextPaymentAttempt == null) { + return Optional.empty(); + } + return nextPaymentAttempt; + } + + /** + * @return The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp. + */ + @JsonIgnore + @java.lang.Override + public Optional getPaidAt() { + if (paidAt == null) { + return Optional.empty(); + } + return paidAt; + } + + /** + * @return The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method. + */ + @JsonIgnore + public Optional getPaymentInstrument() { + if (paymentInstrument == null) { + return Optional.empty(); + } + return paymentInstrument; + } + + /** + * @return The tokenized payment method reference used for this payment. Null if no token was used. + */ + @JsonIgnore + public Optional getPaymentMethod() { + if (paymentMethod == null) { + return Optional.empty(); + } + return paymentMethod; + } + + /** + * @return The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type. + */ + @JsonIgnore + @java.lang.Override + public Optional getPaymentMethodType() { + if (paymentMethodType == null) { + return Optional.empty(); + } + return paymentMethodType; + } + + /** + * @return The number of failed payment attempts for the payment. + */ + @JsonIgnore + @java.lang.Override + public Optional getPaymentsFailed() { + if (paymentsFailed == null) { + return Optional.empty(); + } + return paymentsFailed; + } + + /** + * @return The plan attached to this payment. + */ + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + /** + * @return The product this payment was made for + */ + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return The promo code used for this payment. + */ + @JsonIgnore + public Optional getPromoCode() { + if (promoCode == null) { + return Optional.empty(); + } + return promoCode; + } + + /** + * @return True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds. + */ + @JsonProperty("refundable") + @java.lang.Override + public boolean getRefundable() { + return refundable; + } + + /** + * @return The payment refund amount(if applicable). + */ + @JsonIgnore + @java.lang.Override + public Optional getRefundedAmount() { + if (refundedAmount == null) { + return Optional.empty(); + } + return refundedAmount; + } + + /** + * @return When the payment was refunded (if applicable). + */ + @JsonIgnore + @java.lang.Override + public Optional getRefundedAt() { + if (refundedAt == null) { + return Optional.empty(); + } + return refundedAt; + } + + /** + * @return The refunds issued against this payment, newest first, including failed and canceled refund attempts. Limited to the 100 most recent. + */ + @JsonProperty("refunds") + public List getRefunds() { + return refunds; + } + + /** + * @return The resolution center cases opened by the customer on this payment. Null if the actor in context does not have the payment:resolution_center_case:read permission. + */ + @JsonIgnore + public Optional> getResolutions() { + if (resolutions == null) { + return Optional.empty(); + } + return resolutions; + } + + /** + * @return True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again. + */ + @JsonProperty("retryable") + @java.lang.Override + public boolean getRetryable() { + return retryable; + } + + /** + * @return Whop's in-house fraud risk score for this payment, from 0 (lowest risk) to 100 (highest risk). Null when the payment has not been scored or scoring has not yet completed. + */ + @JsonIgnore + @java.lang.Override + public Optional getRiskScore() { + if (riskScore == null) { + return Optional.empty(); + } + return riskScore; + } + + /** + * @return A curated set of factors behind the risk score, grouped by category (business transaction history, buyer, device). Each entry has a key, human-readable label, category, and value. Null when there is no risk assessment for this payment. + */ + @JsonIgnore + @java.lang.Override + public Optional> getRiskSignals() { + if (riskSignals == null) { + return Optional.empty(); + } + return riskSignals; + } + + /** + * @return The total amount charged to the customer for this payment, including taxes and after any discounts. In the currency specified by the currency field. + */ + @JsonProperty("settlement_amount") + @java.lang.Override + public double getSettlementAmount() { + return settlementAmount; + } + + /** + * @return The three-letter ISO currency code for this payment (e.g., 'usd', 'eur'). + */ + @JsonProperty("settlement_currency") + @java.lang.Override + public Currencies getSettlementCurrency() { + return settlementCurrency; + } + + /** + * @return Deprecated. Always returns null. + */ + @JsonIgnore + @java.lang.Override + public Optional getSettlementExchangeRate() { + if (settlementExchangeRate == null) { + return Optional.empty(); + } + return settlementExchangeRate; + } + + /** + * @return When this payment's funds post to the company's available balance, at midnight UTC. Known at payment time and never changes. The ledger_account.funds_available webhook carries the same settlement_time_at when that batch posts — match them to know these funds are now withdrawable. + */ + @JsonIgnore + @java.lang.Override + public Optional getSettlementTimeAt() { + if (settlementTimeAt == null) { + return Optional.empty(); + } + return settlementTimeAt; + } + + /** + * @return The shipment attached to this payment. + */ + @JsonIgnore + public Optional getShipment() { + if (shipment == null) { + return Optional.empty(); + } + return shipment; + } + + /** + * @return The shipping address provided by the customer for physical goods. Null if no shipping address was collected. + */ + @JsonIgnore + public Optional getShippingAddress() { + if (shippingAddress == null) { + return Optional.empty(); + } + return shippingAddress; + } + + /** + * @return The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void'). + */ + @JsonIgnore + @java.lang.Override + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The friendly status of the payment. + */ + @JsonProperty("substatus") + @java.lang.Override + public FriendlyReceiptStatus getSubstatus() { + return substatus; + } + + /** + * @return The subtotal to show to the creator (excluding buyer fees). + */ + @JsonIgnore + @java.lang.Override + public Optional getSubtotal() { + if (subtotal == null) { + return Optional.empty(); + } + return subtotal; + } + + /** + * @return The calculated amount of the sales/VAT tax (if applicable). + */ + @JsonIgnore + @java.lang.Override + public Optional getTaxAmount() { + if (taxAmount == null) { + return Optional.empty(); + } + return taxAmount; + } + + /** + * @return The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top. + */ + @JsonIgnore + @java.lang.Override + public Optional getTaxBehavior() { + if (taxBehavior == null) { + return Optional.empty(); + } + return taxBehavior; + } + + /** + * @return The amount of tax that has been refunded (if applicable). + */ + @JsonIgnore + @java.lang.Override + public Optional getTaxRefundedAmount() { + if (taxRefundedAmount == null) { + return Optional.empty(); + } + return taxRefundedAmount; + } + + /** + * @return Whether 3D Secure authentication was completed for this payment. + */ + @JsonProperty("three_ds_verified") + @java.lang.Override + public boolean getThreeDsVerified() { + return threeDsVerified; + } + + /** + * @return The total to show to the creator (excluding buyer fees). + */ + @JsonIgnore + @java.lang.Override + public Optional getTotal() { + if (total == null) { + return Optional.empty(); + } + return total; + } + + /** + * @return The datetime the payment was last updated. + */ + @JsonProperty("updated_at") + @java.lang.Override + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The total in USD to show to the creator (excluding buyer fees). + */ + @JsonIgnore + @java.lang.Override + public Optional getUsdTotal() { + if (usdTotal == null) { + return Optional.empty(); + } + return usdTotal; + } + + /** + * @return The user that made this payment. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + /** + * @return The issuer's address and card security code check results for this payment. Null when the processor returned none. + */ + @JsonIgnore + public Optional getVerificationChecks() { + if (verificationChecks == null) { + return Optional.empty(); + } + return verificationChecks; + } + + /** + * @return True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false. + */ + @JsonProperty("voidable") + @java.lang.Override + public boolean getVoidable() { + return voidable; + } + + /** + * @return The credential the buyer's surface presents to poll this payment and set its return URL. Returned when a payment created from a confirmation token is created or retrieved by a caller with the payment:charge permission. Null for payments created from a stored payment method or callers without payment:charge. It unlocks this payment and nothing else; treat it like a password for that one attempt. + */ + @JsonIgnore + public Optional getClientSecret() { + if (clientSecret == null) { + return Optional.empty(); + } + return clientSecret; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("application_fee") + private Optional _getApplicationFee() { + return applicationFee; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_address") + private Optional _getBillingAddress() { + return billingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_reason") + private Optional _getBillingReason() { + return billingReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_brand") + private Optional _getCardBrand() { + return cardBrand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_exp_month") + private Optional _getCardExpMonth() { + return cardExpMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_exp_year") + private Optional _getCardExpYear() { + return cardExpYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_last4") + private Optional _getCardLast4() { + return cardLast4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_configuration_id") + private Optional _getCheckoutConfigurationId() { + return checkoutConfigurationId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company") + private Optional _getCompany() { + return company; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_phone") + private Optional _getCustomerPhone() { + return customerPhone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("decline_code") + private Optional _getDeclineCode() { + return declineCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("dispute_alerted_at") + private Optional _getDisputeAlertedAt() { + return disputeAlertedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("disputes") + private Optional> _getDisputes() { + return disputes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_message") + private Optional _getFailureMessage() { + return failureMessage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("financing_installments_count") + private Optional _getFinancingInstallmentsCount() { + return financingInstallmentsCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_payment_attempt") + private Optional _getLastPaymentAttempt() { + return lastPaymentAttempt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member") + private Optional _getMember() { + return member; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("membership") + private Optional _getMembership() { + return membership; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("needs_tracking") + private Optional _getNeedsTracking() { + return needsTracking; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("next_payment_attempt") + private Optional _getNextPaymentAttempt() { + return nextPaymentAttempt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("paid_at") + private Optional _getPaidAt() { + return paidAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_instrument") + private Optional _getPaymentInstrument() { + return paymentInstrument; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method") + private Optional _getPaymentMethod() { + return paymentMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_type") + private Optional _getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payments_failed") + private Optional _getPaymentsFailed() { + return paymentsFailed; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("promo_code") + private Optional _getPromoCode() { + return promoCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refunded_amount") + private Optional _getRefundedAmount() { + return refundedAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refunded_at") + private Optional _getRefundedAt() { + return refundedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resolutions") + private Optional> _getResolutions() { + return resolutions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("risk_score") + private Optional _getRiskScore() { + return riskScore; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("risk_signals") + private Optional> _getRiskSignals() { + return riskSignals; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("settlement_exchange_rate") + private Optional _getSettlementExchangeRate() { + return settlementExchangeRate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("settlement_time_at") + private Optional _getSettlementTimeAt() { + return settlementTimeAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("shipment") + private Optional _getShipment() { + return shipment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("shipping_address") + private Optional _getShippingAddress() { + return shippingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("subtotal") + private Optional _getSubtotal() { + return subtotal; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_amount") + private Optional _getTaxAmount() { + return taxAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_behavior") + private Optional _getTaxBehavior() { + return taxBehavior; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_refunded_amount") + private Optional _getTaxRefundedAmount() { + return taxRefundedAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("total") + private Optional _getTotal() { + return total; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("usd_total") + private Optional _getUsdTotal() { + return usdTotal; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("verification_checks") + private Optional _getVerificationChecks() { + return verificationChecks; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("client_secret") + private Optional _getClientSecret() { + return clientSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePaymentsResponse && equalTo((CreatePaymentsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePaymentsResponse other) { + return amountAfterFees == other.amountAfterFees + && applicationFee.equals(other.applicationFee) + && autoRefunded == other.autoRefunded + && billingAddress.equals(other.billingAddress) + && billingReason.equals(other.billingReason) + && cardBrand.equals(other.cardBrand) + && cardExpMonth.equals(other.cardExpMonth) + && cardExpYear.equals(other.cardExpYear) + && cardLast4.equals(other.cardLast4) + && checkoutConfigurationId.equals(other.checkoutConfigurationId) + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && customerPhone.equals(other.customerPhone) + && declineCode.equals(other.declineCode) + && disputeAlertedAt.equals(other.disputeAlertedAt) + && disputes.equals(other.disputes) + && failureMessage.equals(other.failureMessage) + && financingInstallmentsCount.equals(other.financingInstallmentsCount) + && financingTransactions.equals(other.financingTransactions) + && id.equals(other.id) + && lastPaymentAttempt.equals(other.lastPaymentAttempt) + && member.equals(other.member) + && membership.equals(other.membership) + && metadata.equals(other.metadata) + && needsTracking.equals(other.needsTracking) + && nextPaymentAttempt.equals(other.nextPaymentAttempt) + && paidAt.equals(other.paidAt) + && paymentInstrument.equals(other.paymentInstrument) + && paymentMethod.equals(other.paymentMethod) + && paymentMethodType.equals(other.paymentMethodType) + && paymentsFailed.equals(other.paymentsFailed) + && plan.equals(other.plan) + && product.equals(other.product) + && promoCode.equals(other.promoCode) + && refundable == other.refundable + && refundedAmount.equals(other.refundedAmount) + && refundedAt.equals(other.refundedAt) + && refunds.equals(other.refunds) + && resolutions.equals(other.resolutions) + && retryable == other.retryable + && riskScore.equals(other.riskScore) + && riskSignals.equals(other.riskSignals) + && settlementAmount == other.settlementAmount + && settlementCurrency.equals(other.settlementCurrency) + && settlementExchangeRate.equals(other.settlementExchangeRate) + && settlementTimeAt.equals(other.settlementTimeAt) + && shipment.equals(other.shipment) + && shippingAddress.equals(other.shippingAddress) + && status.equals(other.status) + && substatus.equals(other.substatus) + && subtotal.equals(other.subtotal) + && taxAmount.equals(other.taxAmount) + && taxBehavior.equals(other.taxBehavior) + && taxRefundedAmount.equals(other.taxRefundedAmount) + && threeDsVerified == other.threeDsVerified + && total.equals(other.total) + && updatedAt.equals(other.updatedAt) + && usdTotal.equals(other.usdTotal) + && user.equals(other.user) + && verificationChecks.equals(other.verificationChecks) + && voidable == other.voidable + && clientSecret.equals(other.clientSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amountAfterFees, + this.applicationFee, + this.autoRefunded, + this.billingAddress, + this.billingReason, + this.cardBrand, + this.cardExpMonth, + this.cardExpYear, + this.cardLast4, + this.checkoutConfigurationId, + this.company, + this.createdAt, + this.currency, + this.customerPhone, + this.declineCode, + this.disputeAlertedAt, + this.disputes, + this.failureMessage, + this.financingInstallmentsCount, + this.financingTransactions, + this.id, + this.lastPaymentAttempt, + this.member, + this.membership, + this.metadata, + this.needsTracking, + this.nextPaymentAttempt, + this.paidAt, + this.paymentInstrument, + this.paymentMethod, + this.paymentMethodType, + this.paymentsFailed, + this.plan, + this.product, + this.promoCode, + this.refundable, + this.refundedAmount, + this.refundedAt, + this.refunds, + this.resolutions, + this.retryable, + this.riskScore, + this.riskSignals, + this.settlementAmount, + this.settlementCurrency, + this.settlementExchangeRate, + this.settlementTimeAt, + this.shipment, + this.shippingAddress, + this.status, + this.substatus, + this.subtotal, + this.taxAmount, + this.taxBehavior, + this.taxRefundedAmount, + this.threeDsVerified, + this.total, + this.updatedAt, + this.usdTotal, + this.user, + this.verificationChecks, + this.voidable, + this.clientSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountAfterFeesStage builder() { + return new Builder(); + } + + public interface AmountAfterFeesStage { + /** + *

How much the payment is for after fees

+ */ + AutoRefundedStage amountAfterFees(double amountAfterFees); + + Builder from(CreatePaymentsResponse other); + } + + public interface AutoRefundedStage { + /** + *

Whether this payment was auto refunded or not

+ */ + CreatedAtStage autoRefunded(boolean autoRefunded); + } + + public interface CreatedAtStage { + /** + *

The datetime the payment was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ */ + IdStage currency(@NotNull Currencies currency); + } + + public interface IdStage { + /** + *

The unique identifier for the payment.

+ */ + RefundableStage id(@NotNull String id); + } + + public interface RefundableStage { + /** + *

True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds.

+ */ + RetryableStage refundable(boolean refundable); + } + + public interface RetryableStage { + /** + *

True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again.

+ */ + SettlementAmountStage retryable(boolean retryable); + } + + public interface SettlementAmountStage { + /** + *

The total amount charged to the customer for this payment, including taxes and after any discounts. In the currency specified by the currency field.

+ */ + SettlementCurrencyStage settlementAmount(double settlementAmount); + } + + public interface SettlementCurrencyStage { + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ */ + SubstatusStage settlementCurrency(@NotNull Currencies settlementCurrency); + } + + public interface SubstatusStage { + /** + *

The friendly status of the payment.

+ */ + ThreeDsVerifiedStage substatus(@NotNull FriendlyReceiptStatus substatus); + } + + public interface ThreeDsVerifiedStage { + /** + *

Whether 3D Secure authentication was completed for this payment.

+ */ + UpdatedAtStage threeDsVerified(boolean threeDsVerified); + } + + public interface UpdatedAtStage { + /** + *

The datetime the payment was last updated.

+ */ + VoidableStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface VoidableStage { + /** + *

True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false.

+ */ + _FinalStage voidable(boolean voidable); + } + + public interface _FinalStage { + CreatePaymentsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The application fee charged on this payment.

+ */ + _FinalStage applicationFee(Optional applicationFee); + + _FinalStage applicationFee(PaymentApplicationFee applicationFee); + + _FinalStage applicationFee(Nullable applicationFee); + + /** + *

The address of the user who made the payment.

+ */ + _FinalStage billingAddress(Optional billingAddress); + + _FinalStage billingAddress(PaymentBillingAddress billingAddress); + + _FinalStage billingAddress(Nullable billingAddress); + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ */ + _FinalStage billingReason(Optional billingReason); + + _FinalStage billingReason(BillingReasons billingReason); + + _FinalStage billingReason(Nullable billingReason); + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ */ + _FinalStage cardBrand(Optional cardBrand); + + _FinalStage cardBrand(CardBrands cardBrand); + + _FinalStage cardBrand(Nullable cardBrand); + + /** + *

The expiration month (1-12) of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ */ + _FinalStage cardExpMonth(Optional cardExpMonth); + + _FinalStage cardExpMonth(Integer cardExpMonth); + + _FinalStage cardExpMonth(Nullable cardExpMonth); + + /** + *

The four-digit expiration year of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ */ + _FinalStage cardExpYear(Optional cardExpYear); + + _FinalStage cardExpYear(Integer cardExpYear); + + _FinalStage cardExpYear(Nullable cardExpYear); + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ */ + _FinalStage cardLast4(Optional cardLast4); + + _FinalStage cardLast4(String cardLast4); + + _FinalStage cardLast4(Nullable cardLast4); + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ */ + _FinalStage checkoutConfigurationId(Optional checkoutConfigurationId); + + _FinalStage checkoutConfigurationId(String checkoutConfigurationId); + + _FinalStage checkoutConfigurationId(Nullable checkoutConfigurationId); + + /** + *

The company for the payment.

+ */ + _FinalStage company(Optional company); + + _FinalStage company(PaymentCompany company); + + _FinalStage company(Nullable company); + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ */ + _FinalStage customerPhone(Optional customerPhone); + + _FinalStage customerPhone(String customerPhone); + + _FinalStage customerPhone(Nullable customerPhone); + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ */ + _FinalStage declineCode(Optional declineCode); + + _FinalStage declineCode(PaymentDeclineCodes declineCode); + + _FinalStage declineCode(Nullable declineCode); + + /** + *

When an alert came in that this transaction will be disputed

+ */ + _FinalStage disputeAlertedAt(Optional disputeAlertedAt); + + _FinalStage disputeAlertedAt(OffsetDateTime disputeAlertedAt); + + _FinalStage disputeAlertedAt(Nullable disputeAlertedAt); + + /** + *

The disputes attached to this payment. Null if the actor in context does not have the payment:dispute:read permission.

+ */ + _FinalStage disputes(Optional> disputes); + + _FinalStage disputes(List disputes); + + _FinalStage disputes(Nullable> disputes); + + /** + *

If the payment failed, the reason for the failure.

+ */ + _FinalStage failureMessage(Optional failureMessage); + + _FinalStage failureMessage(String failureMessage); + + _FinalStage failureMessage(Nullable failureMessage); + + /** + *

The number of financing installments for the payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ */ + _FinalStage financingInstallmentsCount(Optional financingInstallmentsCount); + + _FinalStage financingInstallmentsCount(Integer financingInstallmentsCount); + + _FinalStage financingInstallmentsCount(Nullable financingInstallmentsCount); + + /** + *

The financing transactions attached to this payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ */ + _FinalStage financingTransactions(List financingTransactions); + + _FinalStage addFinancingTransactions(PaymentFinancingTransactionsItem financingTransactions); + + _FinalStage addAllFinancingTransactions(List financingTransactions); + + /** + *

The time of the last payment attempt.

+ */ + _FinalStage lastPaymentAttempt(Optional lastPaymentAttempt); + + _FinalStage lastPaymentAttempt(OffsetDateTime lastPaymentAttempt); + + _FinalStage lastPaymentAttempt(Nullable lastPaymentAttempt); + + /** + *

The member attached to this payment.

+ */ + _FinalStage member(Optional member); + + _FinalStage member(PaymentMember member); + + _FinalStage member(Nullable member); + + /** + *

The membership attached to this payment.

+ */ + _FinalStage membership(Optional membership); + + _FinalStage membership(PaymentMembership membership); + + _FinalStage membership(Nullable membership); + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ */ + _FinalStage needsTracking(Optional needsTracking); + + _FinalStage needsTracking(Boolean needsTracking); + + _FinalStage needsTracking(Nullable needsTracking); + + /** + *

The time of the next schedule payment retry.

+ */ + _FinalStage nextPaymentAttempt(Optional nextPaymentAttempt); + + _FinalStage nextPaymentAttempt(OffsetDateTime nextPaymentAttempt); + + _FinalStage nextPaymentAttempt(Nullable nextPaymentAttempt); + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ */ + _FinalStage paidAt(Optional paidAt); + + _FinalStage paidAt(OffsetDateTime paidAt); + + _FinalStage paidAt(Nullable paidAt); + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ */ + _FinalStage paymentInstrument(Optional paymentInstrument); + + _FinalStage paymentInstrument(PaymentPaymentInstrument paymentInstrument); + + _FinalStage paymentInstrument(Nullable paymentInstrument); + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ */ + _FinalStage paymentMethod(Optional paymentMethod); + + _FinalStage paymentMethod(PaymentPaymentMethod paymentMethod); + + _FinalStage paymentMethod(Nullable paymentMethod); + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ */ + _FinalStage paymentMethodType(Optional paymentMethodType); + + _FinalStage paymentMethodType(PaymentMethodTypes paymentMethodType); + + _FinalStage paymentMethodType(Nullable paymentMethodType); + + /** + *

The number of failed payment attempts for the payment.

+ */ + _FinalStage paymentsFailed(Optional paymentsFailed); + + _FinalStage paymentsFailed(Integer paymentsFailed); + + _FinalStage paymentsFailed(Nullable paymentsFailed); + + /** + *

The plan attached to this payment.

+ */ + _FinalStage plan(Optional plan); + + _FinalStage plan(PaymentPlan plan); + + _FinalStage plan(Nullable plan); + + /** + *

The product this payment was made for

+ */ + _FinalStage product(Optional product); + + _FinalStage product(PaymentProduct product); + + _FinalStage product(Nullable product); + + /** + *

The promo code used for this payment.

+ */ + _FinalStage promoCode(Optional promoCode); + + _FinalStage promoCode(PaymentPromoCode promoCode); + + _FinalStage promoCode(Nullable promoCode); + + /** + *

The payment refund amount(if applicable).

+ */ + _FinalStage refundedAmount(Optional refundedAmount); + + _FinalStage refundedAmount(Double refundedAmount); + + _FinalStage refundedAmount(Nullable refundedAmount); + + /** + *

When the payment was refunded (if applicable).

+ */ + _FinalStage refundedAt(Optional refundedAt); + + _FinalStage refundedAt(OffsetDateTime refundedAt); + + _FinalStage refundedAt(Nullable refundedAt); + + /** + *

The refunds issued against this payment, newest first, including failed and canceled refund attempts. Limited to the 100 most recent.

+ */ + _FinalStage refunds(List refunds); + + _FinalStage addRefunds(PaymentRefundsItem refunds); + + _FinalStage addAllRefunds(List refunds); + + /** + *

The resolution center cases opened by the customer on this payment. Null if the actor in context does not have the payment:resolution_center_case:read permission.

+ */ + _FinalStage resolutions(Optional> resolutions); + + _FinalStage resolutions(List resolutions); + + _FinalStage resolutions(Nullable> resolutions); + + /** + *

Whop's in-house fraud risk score for this payment, from 0 (lowest risk) to 100 (highest risk). Null when the payment has not been scored or scoring has not yet completed.

+ */ + _FinalStage riskScore(Optional riskScore); + + _FinalStage riskScore(Integer riskScore); + + _FinalStage riskScore(Nullable riskScore); + + /** + *

A curated set of factors behind the risk score, grouped by category (business transaction history, buyer, device). Each entry has a key, human-readable label, category, and value. Null when there is no risk assessment for this payment.

+ */ + _FinalStage riskSignals(Optional> riskSignals); + + _FinalStage riskSignals(Map riskSignals); + + _FinalStage riskSignals(Nullable> riskSignals); + + /** + *

Deprecated. Always returns null.

+ */ + _FinalStage settlementExchangeRate(Optional settlementExchangeRate); + + _FinalStage settlementExchangeRate(Double settlementExchangeRate); + + _FinalStage settlementExchangeRate(Nullable settlementExchangeRate); + + /** + *

When this payment's funds post to the company's available balance, at midnight UTC. Known at payment time and never changes. The ledger_account.funds_available webhook carries the same settlement_time_at when that batch posts — match them to know these funds are now withdrawable.

+ */ + _FinalStage settlementTimeAt(Optional settlementTimeAt); + + _FinalStage settlementTimeAt(OffsetDateTime settlementTimeAt); + + _FinalStage settlementTimeAt(Nullable settlementTimeAt); + + /** + *

The shipment attached to this payment.

+ */ + _FinalStage shipment(Optional shipment); + + _FinalStage shipment(PaymentShipment shipment); + + _FinalStage shipment(Nullable shipment); + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ */ + _FinalStage shippingAddress(Optional shippingAddress); + + _FinalStage shippingAddress(PaymentShippingAddress shippingAddress); + + _FinalStage shippingAddress(Nullable shippingAddress); + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ */ + _FinalStage status(Optional status); + + _FinalStage status(ReceiptStatus status); + + _FinalStage status(Nullable status); + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ */ + _FinalStage subtotal(Optional subtotal); + + _FinalStage subtotal(Double subtotal); + + _FinalStage subtotal(Nullable subtotal); + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ */ + _FinalStage taxAmount(Optional taxAmount); + + _FinalStage taxAmount(Double taxAmount); + + _FinalStage taxAmount(Nullable taxAmount); + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ */ + _FinalStage taxBehavior(Optional taxBehavior); + + _FinalStage taxBehavior(ReceiptTaxBehaviors taxBehavior); + + _FinalStage taxBehavior(Nullable taxBehavior); + + /** + *

The amount of tax that has been refunded (if applicable).

+ */ + _FinalStage taxRefundedAmount(Optional taxRefundedAmount); + + _FinalStage taxRefundedAmount(Double taxRefundedAmount); + + _FinalStage taxRefundedAmount(Nullable taxRefundedAmount); + + /** + *

The total to show to the creator (excluding buyer fees).

+ */ + _FinalStage total(Optional total); + + _FinalStage total(Double total); + + _FinalStage total(Nullable total); + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ */ + _FinalStage usdTotal(Optional usdTotal); + + _FinalStage usdTotal(Double usdTotal); + + _FinalStage usdTotal(Nullable usdTotal); + + /** + *

The user that made this payment.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(PaymentUser user); + + _FinalStage user(Nullable user); + + /** + *

The issuer's address and card security code check results for this payment. Null when the processor returned none.

+ */ + _FinalStage verificationChecks(Optional verificationChecks); + + _FinalStage verificationChecks(PaymentVerificationChecks verificationChecks); + + _FinalStage verificationChecks(Nullable verificationChecks); + + /** + *

The credential the buyer's surface presents to poll this payment and set its return URL. Returned when a payment created from a confirmation token is created or retrieved by a caller with the payment:charge permission. Null for payments created from a stored payment method or callers without payment:charge. It unlocks this payment and nothing else; treat it like a password for that one attempt.

+ */ + _FinalStage clientSecret(Optional clientSecret); + + _FinalStage clientSecret(String clientSecret); + + _FinalStage clientSecret(Nullable clientSecret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountAfterFeesStage, + AutoRefundedStage, + CreatedAtStage, + CurrencyStage, + IdStage, + RefundableStage, + RetryableStage, + SettlementAmountStage, + SettlementCurrencyStage, + SubstatusStage, + ThreeDsVerifiedStage, + UpdatedAtStage, + VoidableStage, + _FinalStage { + private double amountAfterFees; + + private boolean autoRefunded; + + private OffsetDateTime createdAt; + + private Currencies currency; + + private String id; + + private boolean refundable; + + private boolean retryable; + + private double settlementAmount; + + private Currencies settlementCurrency; + + private FriendlyReceiptStatus substatus; + + private boolean threeDsVerified; + + private OffsetDateTime updatedAt; + + private boolean voidable; + + private Optional clientSecret = Optional.empty(); + + private Optional verificationChecks = Optional.empty(); + + private Optional user = Optional.empty(); + + private Optional usdTotal = Optional.empty(); + + private Optional total = Optional.empty(); + + private Optional taxRefundedAmount = Optional.empty(); + + private Optional taxBehavior = Optional.empty(); + + private Optional taxAmount = Optional.empty(); + + private Optional subtotal = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional shippingAddress = Optional.empty(); + + private Optional shipment = Optional.empty(); + + private Optional settlementTimeAt = Optional.empty(); + + private Optional settlementExchangeRate = Optional.empty(); + + private Optional> riskSignals = Optional.empty(); + + private Optional riskScore = Optional.empty(); + + private Optional> resolutions = Optional.empty(); + + private List refunds = new ArrayList<>(); + + private Optional refundedAt = Optional.empty(); + + private Optional refundedAmount = Optional.empty(); + + private Optional promoCode = Optional.empty(); + + private Optional product = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional paymentsFailed = Optional.empty(); + + private Optional paymentMethodType = Optional.empty(); + + private Optional paymentMethod = Optional.empty(); + + private Optional paymentInstrument = Optional.empty(); + + private Optional paidAt = Optional.empty(); + + private Optional nextPaymentAttempt = Optional.empty(); + + private Optional needsTracking = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional membership = Optional.empty(); + + private Optional member = Optional.empty(); + + private Optional lastPaymentAttempt = Optional.empty(); + + private List financingTransactions = new ArrayList<>(); + + private Optional financingInstallmentsCount = Optional.empty(); + + private Optional failureMessage = Optional.empty(); + + private Optional> disputes = Optional.empty(); + + private Optional disputeAlertedAt = Optional.empty(); + + private Optional declineCode = Optional.empty(); + + private Optional customerPhone = Optional.empty(); + + private Optional company = Optional.empty(); + + private Optional checkoutConfigurationId = Optional.empty(); + + private Optional cardLast4 = Optional.empty(); + + private Optional cardExpYear = Optional.empty(); + + private Optional cardExpMonth = Optional.empty(); + + private Optional cardBrand = Optional.empty(); + + private Optional billingReason = Optional.empty(); + + private Optional billingAddress = Optional.empty(); + + private Optional applicationFee = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePaymentsResponse other) { + amountAfterFees(other.getAmountAfterFees()); + applicationFee(other.getApplicationFee()); + autoRefunded(other.getAutoRefunded()); + billingAddress(other.getBillingAddress()); + billingReason(other.getBillingReason()); + cardBrand(other.getCardBrand()); + cardExpMonth(other.getCardExpMonth()); + cardExpYear(other.getCardExpYear()); + cardLast4(other.getCardLast4()); + checkoutConfigurationId(other.getCheckoutConfigurationId()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + customerPhone(other.getCustomerPhone()); + declineCode(other.getDeclineCode()); + disputeAlertedAt(other.getDisputeAlertedAt()); + disputes(other.getDisputes()); + failureMessage(other.getFailureMessage()); + financingInstallmentsCount(other.getFinancingInstallmentsCount()); + financingTransactions(other.getFinancingTransactions()); + id(other.getId()); + lastPaymentAttempt(other.getLastPaymentAttempt()); + member(other.getMember()); + membership(other.getMembership()); + metadata(other.getMetadata()); + needsTracking(other.getNeedsTracking()); + nextPaymentAttempt(other.getNextPaymentAttempt()); + paidAt(other.getPaidAt()); + paymentInstrument(other.getPaymentInstrument()); + paymentMethod(other.getPaymentMethod()); + paymentMethodType(other.getPaymentMethodType()); + paymentsFailed(other.getPaymentsFailed()); + plan(other.getPlan()); + product(other.getProduct()); + promoCode(other.getPromoCode()); + refundable(other.getRefundable()); + refundedAmount(other.getRefundedAmount()); + refundedAt(other.getRefundedAt()); + refunds(other.getRefunds()); + resolutions(other.getResolutions()); + retryable(other.getRetryable()); + riskScore(other.getRiskScore()); + riskSignals(other.getRiskSignals()); + settlementAmount(other.getSettlementAmount()); + settlementCurrency(other.getSettlementCurrency()); + settlementExchangeRate(other.getSettlementExchangeRate()); + settlementTimeAt(other.getSettlementTimeAt()); + shipment(other.getShipment()); + shippingAddress(other.getShippingAddress()); + status(other.getStatus()); + substatus(other.getSubstatus()); + subtotal(other.getSubtotal()); + taxAmount(other.getTaxAmount()); + taxBehavior(other.getTaxBehavior()); + taxRefundedAmount(other.getTaxRefundedAmount()); + threeDsVerified(other.getThreeDsVerified()); + total(other.getTotal()); + updatedAt(other.getUpdatedAt()); + usdTotal(other.getUsdTotal()); + user(other.getUser()); + verificationChecks(other.getVerificationChecks()); + voidable(other.getVoidable()); + clientSecret(other.getClientSecret()); + return this; + } + + /** + *

How much the payment is for after fees

+ *

How much the payment is for after fees

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount_after_fees") + public AutoRefundedStage amountAfterFees(double amountAfterFees) { + this.amountAfterFees = amountAfterFees; + return this; + } + + /** + *

Whether this payment was auto refunded or not

+ *

Whether this payment was auto refunded or not

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("auto_refunded") + public CreatedAtStage autoRefunded(boolean autoRefunded) { + this.autoRefunded = autoRefunded; + return this; + } + + /** + *

The datetime the payment was created.

+ *

The datetime the payment was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier for the payment.

+ *

The unique identifier for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RefundableStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds.

+ *

True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("refundable") + public RetryableStage refundable(boolean refundable) { + this.refundable = refundable; + return this; + } + + /** + *

True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again.

+ *

True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("retryable") + public SettlementAmountStage retryable(boolean retryable) { + this.retryable = retryable; + return this; + } + + /** + *

The total amount charged to the customer for this payment, including taxes and after any discounts. In the currency specified by the currency field.

+ *

The total amount charged to the customer for this payment, including taxes and after any discounts. In the currency specified by the currency field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("settlement_amount") + public SettlementCurrencyStage settlementAmount(double settlementAmount) { + this.settlementAmount = settlementAmount; + return this; + } + + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("settlement_currency") + public SubstatusStage settlementCurrency(@NotNull Currencies settlementCurrency) { + this.settlementCurrency = Objects.requireNonNull(settlementCurrency, "settlementCurrency must not be null"); + return this; + } + + /** + *

The friendly status of the payment.

+ *

The friendly status of the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("substatus") + public ThreeDsVerifiedStage substatus(@NotNull FriendlyReceiptStatus substatus) { + this.substatus = Objects.requireNonNull(substatus, "substatus must not be null"); + return this; + } + + /** + *

Whether 3D Secure authentication was completed for this payment.

+ *

Whether 3D Secure authentication was completed for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("three_ds_verified") + public UpdatedAtStage threeDsVerified(boolean threeDsVerified) { + this.threeDsVerified = threeDsVerified; + return this; + } + + /** + *

The datetime the payment was last updated.

+ *

The datetime the payment was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public VoidableStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false.

+ *

True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("voidable") + public _FinalStage voidable(boolean voidable) { + this.voidable = voidable; + return this; + } + + /** + *

The credential the buyer's surface presents to poll this payment and set its return URL. Returned when a payment created from a confirmation token is created or retrieved by a caller with the payment:charge permission. Null for payments created from a stored payment method or callers without payment:charge. It unlocks this payment and nothing else; treat it like a password for that one attempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage clientSecret(Nullable clientSecret) { + if (clientSecret.isNull()) { + this.clientSecret = null; + } else if (clientSecret.isEmpty()) { + this.clientSecret = Optional.empty(); + } else { + this.clientSecret = Optional.of(clientSecret.get()); + } + return this; + } + + /** + *

The credential the buyer's surface presents to poll this payment and set its return URL. Returned when a payment created from a confirmation token is created or retrieved by a caller with the payment:charge permission. Null for payments created from a stored payment method or callers without payment:charge. It unlocks this payment and nothing else; treat it like a password for that one attempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage clientSecret(String clientSecret) { + this.clientSecret = Optional.ofNullable(clientSecret); + return this; + } + + /** + *

The credential the buyer's surface presents to poll this payment and set its return URL. Returned when a payment created from a confirmation token is created or retrieved by a caller with the payment:charge permission. Null for payments created from a stored payment method or callers without payment:charge. It unlocks this payment and nothing else; treat it like a password for that one attempt.

+ */ + @java.lang.Override + @JsonSetter(value = "client_secret", nulls = Nulls.SKIP) + public _FinalStage clientSecret(Optional clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + *

The issuer's address and card security code check results for this payment. Null when the processor returned none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage verificationChecks(Nullable verificationChecks) { + if (verificationChecks.isNull()) { + this.verificationChecks = null; + } else if (verificationChecks.isEmpty()) { + this.verificationChecks = Optional.empty(); + } else { + this.verificationChecks = Optional.of(verificationChecks.get()); + } + return this; + } + + /** + *

The issuer's address and card security code check results for this payment. Null when the processor returned none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage verificationChecks(PaymentVerificationChecks verificationChecks) { + this.verificationChecks = Optional.ofNullable(verificationChecks); + return this; + } + + /** + *

The issuer's address and card security code check results for this payment. Null when the processor returned none.

+ */ + @java.lang.Override + @JsonSetter(value = "verification_checks", nulls = Nulls.SKIP) + public _FinalStage verificationChecks(Optional verificationChecks) { + this.verificationChecks = verificationChecks; + return this; + } + + /** + *

The user that made this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The user that made this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(PaymentUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The user that made this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdTotal(Nullable usdTotal) { + if (usdTotal.isNull()) { + this.usdTotal = null; + } else if (usdTotal.isEmpty()) { + this.usdTotal = Optional.empty(); + } else { + this.usdTotal = Optional.of(usdTotal.get()); + } + return this; + } + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdTotal(Double usdTotal) { + this.usdTotal = Optional.ofNullable(usdTotal); + return this; + } + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "usd_total", nulls = Nulls.SKIP) + public _FinalStage usdTotal(Optional usdTotal) { + this.usdTotal = usdTotal; + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage total(Nullable total) { + if (total.isNull()) { + this.total = null; + } else if (total.isEmpty()) { + this.total = Optional.empty(); + } else { + this.total = Optional.of(total.get()); + } + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage total(Double total) { + this.total = Optional.ofNullable(total); + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "total", nulls = Nulls.SKIP) + public _FinalStage total(Optional total) { + this.total = total; + return this; + } + + /** + *

The amount of tax that has been refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxRefundedAmount(Nullable taxRefundedAmount) { + if (taxRefundedAmount.isNull()) { + this.taxRefundedAmount = null; + } else if (taxRefundedAmount.isEmpty()) { + this.taxRefundedAmount = Optional.empty(); + } else { + this.taxRefundedAmount = Optional.of(taxRefundedAmount.get()); + } + return this; + } + + /** + *

The amount of tax that has been refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxRefundedAmount(Double taxRefundedAmount) { + this.taxRefundedAmount = Optional.ofNullable(taxRefundedAmount); + return this; + } + + /** + *

The amount of tax that has been refunded (if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "tax_refunded_amount", nulls = Nulls.SKIP) + public _FinalStage taxRefundedAmount(Optional taxRefundedAmount) { + this.taxRefundedAmount = taxRefundedAmount; + return this; + } + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxBehavior(Nullable taxBehavior) { + if (taxBehavior.isNull()) { + this.taxBehavior = null; + } else if (taxBehavior.isEmpty()) { + this.taxBehavior = Optional.empty(); + } else { + this.taxBehavior = Optional.of(taxBehavior.get()); + } + return this; + } + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxBehavior(ReceiptTaxBehaviors taxBehavior) { + this.taxBehavior = Optional.ofNullable(taxBehavior); + return this; + } + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ */ + @java.lang.Override + @JsonSetter(value = "tax_behavior", nulls = Nulls.SKIP) + public _FinalStage taxBehavior(Optional taxBehavior) { + this.taxBehavior = taxBehavior; + return this; + } + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxAmount(Nullable taxAmount) { + if (taxAmount.isNull()) { + this.taxAmount = null; + } else if (taxAmount.isEmpty()) { + this.taxAmount = Optional.empty(); + } else { + this.taxAmount = Optional.of(taxAmount.get()); + } + return this; + } + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxAmount(Double taxAmount) { + this.taxAmount = Optional.ofNullable(taxAmount); + return this; + } + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "tax_amount", nulls = Nulls.SKIP) + public _FinalStage taxAmount(Optional taxAmount) { + this.taxAmount = taxAmount; + return this; + } + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subtotal(Nullable subtotal) { + if (subtotal.isNull()) { + this.subtotal = null; + } else if (subtotal.isEmpty()) { + this.subtotal = Optional.empty(); + } else { + this.subtotal = Optional.of(subtotal.get()); + } + return this; + } + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subtotal(Double subtotal) { + this.subtotal = Optional.ofNullable(subtotal); + return this; + } + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "subtotal", nulls = Nulls.SKIP) + public _FinalStage subtotal(Optional subtotal) { + this.subtotal = subtotal; + return this; + } + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(ReceiptStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shippingAddress(Nullable shippingAddress) { + if (shippingAddress.isNull()) { + this.shippingAddress = null; + } else if (shippingAddress.isEmpty()) { + this.shippingAddress = Optional.empty(); + } else { + this.shippingAddress = Optional.of(shippingAddress.get()); + } + return this; + } + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shippingAddress(PaymentShippingAddress shippingAddress) { + this.shippingAddress = Optional.ofNullable(shippingAddress); + return this; + } + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ */ + @java.lang.Override + @JsonSetter(value = "shipping_address", nulls = Nulls.SKIP) + public _FinalStage shippingAddress(Optional shippingAddress) { + this.shippingAddress = shippingAddress; + return this; + } + + /** + *

The shipment attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shipment(Nullable shipment) { + if (shipment.isNull()) { + this.shipment = null; + } else if (shipment.isEmpty()) { + this.shipment = Optional.empty(); + } else { + this.shipment = Optional.of(shipment.get()); + } + return this; + } + + /** + *

The shipment attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shipment(PaymentShipment shipment) { + this.shipment = Optional.ofNullable(shipment); + return this; + } + + /** + *

The shipment attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "shipment", nulls = Nulls.SKIP) + public _FinalStage shipment(Optional shipment) { + this.shipment = shipment; + return this; + } + + /** + *

When this payment's funds post to the company's available balance, at midnight UTC. Known at payment time and never changes. The ledger_account.funds_available webhook carries the same settlement_time_at when that batch posts — match them to know these funds are now withdrawable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage settlementTimeAt(Nullable settlementTimeAt) { + if (settlementTimeAt.isNull()) { + this.settlementTimeAt = null; + } else if (settlementTimeAt.isEmpty()) { + this.settlementTimeAt = Optional.empty(); + } else { + this.settlementTimeAt = Optional.of(settlementTimeAt.get()); + } + return this; + } + + /** + *

When this payment's funds post to the company's available balance, at midnight UTC. Known at payment time and never changes. The ledger_account.funds_available webhook carries the same settlement_time_at when that batch posts — match them to know these funds are now withdrawable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage settlementTimeAt(OffsetDateTime settlementTimeAt) { + this.settlementTimeAt = Optional.ofNullable(settlementTimeAt); + return this; + } + + /** + *

When this payment's funds post to the company's available balance, at midnight UTC. Known at payment time and never changes. The ledger_account.funds_available webhook carries the same settlement_time_at when that batch posts — match them to know these funds are now withdrawable.

+ */ + @java.lang.Override + @JsonSetter(value = "settlement_time_at", nulls = Nulls.SKIP) + public _FinalStage settlementTimeAt(Optional settlementTimeAt) { + this.settlementTimeAt = settlementTimeAt; + return this; + } + + /** + *

Deprecated. Always returns null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage settlementExchangeRate(Nullable settlementExchangeRate) { + if (settlementExchangeRate.isNull()) { + this.settlementExchangeRate = null; + } else if (settlementExchangeRate.isEmpty()) { + this.settlementExchangeRate = Optional.empty(); + } else { + this.settlementExchangeRate = Optional.of(settlementExchangeRate.get()); + } + return this; + } + + /** + *

Deprecated. Always returns null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage settlementExchangeRate(Double settlementExchangeRate) { + this.settlementExchangeRate = Optional.ofNullable(settlementExchangeRate); + return this; + } + + /** + *

Deprecated. Always returns null.

+ */ + @java.lang.Override + @JsonSetter(value = "settlement_exchange_rate", nulls = Nulls.SKIP) + public _FinalStage settlementExchangeRate(Optional settlementExchangeRate) { + this.settlementExchangeRate = settlementExchangeRate; + return this; + } + + /** + *

A curated set of factors behind the risk score, grouped by category (business transaction history, buyer, device). Each entry has a key, human-readable label, category, and value. Null when there is no risk assessment for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage riskSignals(Nullable> riskSignals) { + if (riskSignals.isNull()) { + this.riskSignals = null; + } else if (riskSignals.isEmpty()) { + this.riskSignals = Optional.empty(); + } else { + this.riskSignals = Optional.of(riskSignals.get()); + } + return this; + } + + /** + *

A curated set of factors behind the risk score, grouped by category (business transaction history, buyer, device). Each entry has a key, human-readable label, category, and value. Null when there is no risk assessment for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage riskSignals(Map riskSignals) { + this.riskSignals = Optional.ofNullable(riskSignals); + return this; + } + + /** + *

A curated set of factors behind the risk score, grouped by category (business transaction history, buyer, device). Each entry has a key, human-readable label, category, and value. Null when there is no risk assessment for this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "risk_signals", nulls = Nulls.SKIP) + public _FinalStage riskSignals(Optional> riskSignals) { + this.riskSignals = riskSignals; + return this; + } + + /** + *

Whop's in-house fraud risk score for this payment, from 0 (lowest risk) to 100 (highest risk). Null when the payment has not been scored or scoring has not yet completed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage riskScore(Nullable riskScore) { + if (riskScore.isNull()) { + this.riskScore = null; + } else if (riskScore.isEmpty()) { + this.riskScore = Optional.empty(); + } else { + this.riskScore = Optional.of(riskScore.get()); + } + return this; + } + + /** + *

Whop's in-house fraud risk score for this payment, from 0 (lowest risk) to 100 (highest risk). Null when the payment has not been scored or scoring has not yet completed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage riskScore(Integer riskScore) { + this.riskScore = Optional.ofNullable(riskScore); + return this; + } + + /** + *

Whop's in-house fraud risk score for this payment, from 0 (lowest risk) to 100 (highest risk). Null when the payment has not been scored or scoring has not yet completed.

+ */ + @java.lang.Override + @JsonSetter(value = "risk_score", nulls = Nulls.SKIP) + public _FinalStage riskScore(Optional riskScore) { + this.riskScore = riskScore; + return this; + } + + /** + *

The resolution center cases opened by the customer on this payment. Null if the actor in context does not have the payment:resolution_center_case:read permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolutions(Nullable> resolutions) { + if (resolutions.isNull()) { + this.resolutions = null; + } else if (resolutions.isEmpty()) { + this.resolutions = Optional.empty(); + } else { + this.resolutions = Optional.of(resolutions.get()); + } + return this; + } + + /** + *

The resolution center cases opened by the customer on this payment. Null if the actor in context does not have the payment:resolution_center_case:read permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolutions(List resolutions) { + this.resolutions = Optional.ofNullable(resolutions); + return this; + } + + /** + *

The resolution center cases opened by the customer on this payment. Null if the actor in context does not have the payment:resolution_center_case:read permission.

+ */ + @java.lang.Override + @JsonSetter(value = "resolutions", nulls = Nulls.SKIP) + public _FinalStage resolutions(Optional> resolutions) { + this.resolutions = resolutions; + return this; + } + + /** + *

The refunds issued against this payment, newest first, including failed and canceled refund attempts. Limited to the 100 most recent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllRefunds(List refunds) { + if (refunds != null) { + this.refunds.addAll(refunds); + } + return this; + } + + /** + *

The refunds issued against this payment, newest first, including failed and canceled refund attempts. Limited to the 100 most recent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addRefunds(PaymentRefundsItem refunds) { + this.refunds.add(refunds); + return this; + } + + /** + *

The refunds issued against this payment, newest first, including failed and canceled refund attempts. Limited to the 100 most recent.

+ */ + @java.lang.Override + @JsonSetter(value = "refunds", nulls = Nulls.SKIP) + public _FinalStage refunds(List refunds) { + this.refunds.clear(); + if (refunds != null) { + this.refunds.addAll(refunds); + } + return this; + } + + /** + *

When the payment was refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAt(Nullable refundedAt) { + if (refundedAt.isNull()) { + this.refundedAt = null; + } else if (refundedAt.isEmpty()) { + this.refundedAt = Optional.empty(); + } else { + this.refundedAt = Optional.of(refundedAt.get()); + } + return this; + } + + /** + *

When the payment was refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAt(OffsetDateTime refundedAt) { + this.refundedAt = Optional.ofNullable(refundedAt); + return this; + } + + /** + *

When the payment was refunded (if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "refunded_at", nulls = Nulls.SKIP) + public _FinalStage refundedAt(Optional refundedAt) { + this.refundedAt = refundedAt; + return this; + } + + /** + *

The payment refund amount(if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAmount(Nullable refundedAmount) { + if (refundedAmount.isNull()) { + this.refundedAmount = null; + } else if (refundedAmount.isEmpty()) { + this.refundedAmount = Optional.empty(); + } else { + this.refundedAmount = Optional.of(refundedAmount.get()); + } + return this; + } + + /** + *

The payment refund amount(if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAmount(Double refundedAmount) { + this.refundedAmount = Optional.ofNullable(refundedAmount); + return this; + } + + /** + *

The payment refund amount(if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "refunded_amount", nulls = Nulls.SKIP) + public _FinalStage refundedAmount(Optional refundedAmount) { + this.refundedAmount = refundedAmount; + return this; + } + + /** + *

The promo code used for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCode(Nullable promoCode) { + if (promoCode.isNull()) { + this.promoCode = null; + } else if (promoCode.isEmpty()) { + this.promoCode = Optional.empty(); + } else { + this.promoCode = Optional.of(promoCode.get()); + } + return this; + } + + /** + *

The promo code used for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCode(PaymentPromoCode promoCode) { + this.promoCode = Optional.ofNullable(promoCode); + return this; + } + + /** + *

The promo code used for this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "promo_code", nulls = Nulls.SKIP) + public _FinalStage promoCode(Optional promoCode) { + this.promoCode = promoCode; + return this; + } + + /** + *

The product this payment was made for

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

The product this payment was made for

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(PaymentProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

The product this payment was made for

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

The plan attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + /** + *

The plan attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(PaymentPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + /** + *

The plan attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + + /** + *

The number of failed payment attempts for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentsFailed(Nullable paymentsFailed) { + if (paymentsFailed.isNull()) { + this.paymentsFailed = null; + } else if (paymentsFailed.isEmpty()) { + this.paymentsFailed = Optional.empty(); + } else { + this.paymentsFailed = Optional.of(paymentsFailed.get()); + } + return this; + } + + /** + *

The number of failed payment attempts for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentsFailed(Integer paymentsFailed) { + this.paymentsFailed = Optional.ofNullable(paymentsFailed); + return this; + } + + /** + *

The number of failed payment attempts for the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "payments_failed", nulls = Nulls.SKIP) + public _FinalStage paymentsFailed(Optional paymentsFailed) { + this.paymentsFailed = paymentsFailed; + return this; + } + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(Nullable paymentMethodType) { + if (paymentMethodType.isNull()) { + this.paymentMethodType = null; + } else if (paymentMethodType.isEmpty()) { + this.paymentMethodType = Optional.empty(); + } else { + this.paymentMethodType = Optional.of(paymentMethodType.get()); + } + return this; + } + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Optional.ofNullable(paymentMethodType); + return this; + } + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_type", nulls = Nulls.SKIP) + public _FinalStage paymentMethodType(Optional paymentMethodType) { + this.paymentMethodType = paymentMethodType; + return this; + } + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethod(Nullable paymentMethod) { + if (paymentMethod.isNull()) { + this.paymentMethod = null; + } else if (paymentMethod.isEmpty()) { + this.paymentMethod = Optional.empty(); + } else { + this.paymentMethod = Optional.of(paymentMethod.get()); + } + return this; + } + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethod(PaymentPaymentMethod paymentMethod) { + this.paymentMethod = Optional.ofNullable(paymentMethod); + return this; + } + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method", nulls = Nulls.SKIP) + public _FinalStage paymentMethod(Optional paymentMethod) { + this.paymentMethod = paymentMethod; + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentInstrument(Nullable paymentInstrument) { + if (paymentInstrument.isNull()) { + this.paymentInstrument = null; + } else if (paymentInstrument.isEmpty()) { + this.paymentInstrument = Optional.empty(); + } else { + this.paymentInstrument = Optional.of(paymentInstrument.get()); + } + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentInstrument(PaymentPaymentInstrument paymentInstrument) { + this.paymentInstrument = Optional.ofNullable(paymentInstrument); + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_instrument", nulls = Nulls.SKIP) + public _FinalStage paymentInstrument(Optional paymentInstrument) { + this.paymentInstrument = paymentInstrument; + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidAt(Nullable paidAt) { + if (paidAt.isNull()) { + this.paidAt = null; + } else if (paidAt.isEmpty()) { + this.paidAt = Optional.empty(); + } else { + this.paidAt = Optional.of(paidAt.get()); + } + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidAt(OffsetDateTime paidAt) { + this.paidAt = Optional.ofNullable(paidAt); + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "paid_at", nulls = Nulls.SKIP) + public _FinalStage paidAt(Optional paidAt) { + this.paidAt = paidAt; + return this; + } + + /** + *

The time of the next schedule payment retry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nextPaymentAttempt(Nullable nextPaymentAttempt) { + if (nextPaymentAttempt.isNull()) { + this.nextPaymentAttempt = null; + } else if (nextPaymentAttempt.isEmpty()) { + this.nextPaymentAttempt = Optional.empty(); + } else { + this.nextPaymentAttempt = Optional.of(nextPaymentAttempt.get()); + } + return this; + } + + /** + *

The time of the next schedule payment retry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nextPaymentAttempt(OffsetDateTime nextPaymentAttempt) { + this.nextPaymentAttempt = Optional.ofNullable(nextPaymentAttempt); + return this; + } + + /** + *

The time of the next schedule payment retry.

+ */ + @java.lang.Override + @JsonSetter(value = "next_payment_attempt", nulls = Nulls.SKIP) + public _FinalStage nextPaymentAttempt(Optional nextPaymentAttempt) { + this.nextPaymentAttempt = nextPaymentAttempt; + return this; + } + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage needsTracking(Nullable needsTracking) { + if (needsTracking.isNull()) { + this.needsTracking = null; + } else if (needsTracking.isEmpty()) { + this.needsTracking = Optional.empty(); + } else { + this.needsTracking = Optional.of(needsTracking.get()); + } + return this; + } + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage needsTracking(Boolean needsTracking) { + this.needsTracking = Optional.ofNullable(needsTracking); + return this; + } + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ */ + @java.lang.Override + @JsonSetter(value = "needs_tracking", nulls = Nulls.SKIP) + public _FinalStage needsTracking(Optional needsTracking) { + this.needsTracking = needsTracking; + return this; + } + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The membership attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage membership(Nullable membership) { + if (membership.isNull()) { + this.membership = null; + } else if (membership.isEmpty()) { + this.membership = Optional.empty(); + } else { + this.membership = Optional.of(membership.get()); + } + return this; + } + + /** + *

The membership attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage membership(PaymentMembership membership) { + this.membership = Optional.ofNullable(membership); + return this; + } + + /** + *

The membership attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "membership", nulls = Nulls.SKIP) + public _FinalStage membership(Optional membership) { + this.membership = membership; + return this; + } + + /** + *

The member attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(Nullable member) { + if (member.isNull()) { + this.member = null; + } else if (member.isEmpty()) { + this.member = Optional.empty(); + } else { + this.member = Optional.of(member.get()); + } + return this; + } + + /** + *

The member attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(PaymentMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + /** + *

The member attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public _FinalStage member(Optional member) { + this.member = member; + return this; + } + + /** + *

The time of the last payment attempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaymentAttempt(Nullable lastPaymentAttempt) { + if (lastPaymentAttempt.isNull()) { + this.lastPaymentAttempt = null; + } else if (lastPaymentAttempt.isEmpty()) { + this.lastPaymentAttempt = Optional.empty(); + } else { + this.lastPaymentAttempt = Optional.of(lastPaymentAttempt.get()); + } + return this; + } + + /** + *

The time of the last payment attempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaymentAttempt(OffsetDateTime lastPaymentAttempt) { + this.lastPaymentAttempt = Optional.ofNullable(lastPaymentAttempt); + return this; + } + + /** + *

The time of the last payment attempt.

+ */ + @java.lang.Override + @JsonSetter(value = "last_payment_attempt", nulls = Nulls.SKIP) + public _FinalStage lastPaymentAttempt(Optional lastPaymentAttempt) { + this.lastPaymentAttempt = lastPaymentAttempt; + return this; + } + + /** + *

The financing transactions attached to this payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllFinancingTransactions(List financingTransactions) { + if (financingTransactions != null) { + this.financingTransactions.addAll(financingTransactions); + } + return this; + } + + /** + *

The financing transactions attached to this payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addFinancingTransactions(PaymentFinancingTransactionsItem financingTransactions) { + this.financingTransactions.add(financingTransactions); + return this; + } + + /** + *

The financing transactions attached to this payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ */ + @java.lang.Override + @JsonSetter(value = "financing_transactions", nulls = Nulls.SKIP) + public _FinalStage financingTransactions(List financingTransactions) { + this.financingTransactions.clear(); + if (financingTransactions != null) { + this.financingTransactions.addAll(financingTransactions); + } + return this; + } + + /** + *

The number of financing installments for the payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage financingInstallmentsCount(Nullable financingInstallmentsCount) { + if (financingInstallmentsCount.isNull()) { + this.financingInstallmentsCount = null; + } else if (financingInstallmentsCount.isEmpty()) { + this.financingInstallmentsCount = Optional.empty(); + } else { + this.financingInstallmentsCount = Optional.of(financingInstallmentsCount.get()); + } + return this; + } + + /** + *

The number of financing installments for the payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage financingInstallmentsCount(Integer financingInstallmentsCount) { + this.financingInstallmentsCount = Optional.ofNullable(financingInstallmentsCount); + return this; + } + + /** + *

The number of financing installments for the payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ */ + @java.lang.Override + @JsonSetter(value = "financing_installments_count", nulls = Nulls.SKIP) + public _FinalStage financingInstallmentsCount(Optional financingInstallmentsCount) { + this.financingInstallmentsCount = financingInstallmentsCount; + return this; + } + + /** + *

If the payment failed, the reason for the failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureMessage(Nullable failureMessage) { + if (failureMessage.isNull()) { + this.failureMessage = null; + } else if (failureMessage.isEmpty()) { + this.failureMessage = Optional.empty(); + } else { + this.failureMessage = Optional.of(failureMessage.get()); + } + return this; + } + + /** + *

If the payment failed, the reason for the failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureMessage(String failureMessage) { + this.failureMessage = Optional.ofNullable(failureMessage); + return this; + } + + /** + *

If the payment failed, the reason for the failure.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_message", nulls = Nulls.SKIP) + public _FinalStage failureMessage(Optional failureMessage) { + this.failureMessage = failureMessage; + return this; + } + + /** + *

The disputes attached to this payment. Null if the actor in context does not have the payment:dispute:read permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputes(Nullable> disputes) { + if (disputes.isNull()) { + this.disputes = null; + } else if (disputes.isEmpty()) { + this.disputes = Optional.empty(); + } else { + this.disputes = Optional.of(disputes.get()); + } + return this; + } + + /** + *

The disputes attached to this payment. Null if the actor in context does not have the payment:dispute:read permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputes(List disputes) { + this.disputes = Optional.ofNullable(disputes); + return this; + } + + /** + *

The disputes attached to this payment. Null if the actor in context does not have the payment:dispute:read permission.

+ */ + @java.lang.Override + @JsonSetter(value = "disputes", nulls = Nulls.SKIP) + public _FinalStage disputes(Optional> disputes) { + this.disputes = disputes; + return this; + } + + /** + *

When an alert came in that this transaction will be disputed

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputeAlertedAt(Nullable disputeAlertedAt) { + if (disputeAlertedAt.isNull()) { + this.disputeAlertedAt = null; + } else if (disputeAlertedAt.isEmpty()) { + this.disputeAlertedAt = Optional.empty(); + } else { + this.disputeAlertedAt = Optional.of(disputeAlertedAt.get()); + } + return this; + } + + /** + *

When an alert came in that this transaction will be disputed

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputeAlertedAt(OffsetDateTime disputeAlertedAt) { + this.disputeAlertedAt = Optional.ofNullable(disputeAlertedAt); + return this; + } + + /** + *

When an alert came in that this transaction will be disputed

+ */ + @java.lang.Override + @JsonSetter(value = "dispute_alerted_at", nulls = Nulls.SKIP) + public _FinalStage disputeAlertedAt(Optional disputeAlertedAt) { + this.disputeAlertedAt = disputeAlertedAt; + return this; + } + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage declineCode(Nullable declineCode) { + if (declineCode.isNull()) { + this.declineCode = null; + } else if (declineCode.isEmpty()) { + this.declineCode = Optional.empty(); + } else { + this.declineCode = Optional.of(declineCode.get()); + } + return this; + } + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage declineCode(PaymentDeclineCodes declineCode) { + this.declineCode = Optional.ofNullable(declineCode); + return this; + } + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ */ + @java.lang.Override + @JsonSetter(value = "decline_code", nulls = Nulls.SKIP) + public _FinalStage declineCode(Optional declineCode) { + this.declineCode = declineCode; + return this; + } + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerPhone(Nullable customerPhone) { + if (customerPhone.isNull()) { + this.customerPhone = null; + } else if (customerPhone.isEmpty()) { + this.customerPhone = Optional.empty(); + } else { + this.customerPhone = Optional.of(customerPhone.get()); + } + return this; + } + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerPhone(String customerPhone) { + this.customerPhone = Optional.ofNullable(customerPhone); + return this; + } + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ */ + @java.lang.Override + @JsonSetter(value = "customer_phone", nulls = Nulls.SKIP) + public _FinalStage customerPhone(Optional customerPhone) { + this.customerPhone = customerPhone; + return this; + } + + /** + *

The company for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(Nullable company) { + if (company.isNull()) { + this.company = null; + } else if (company.isEmpty()) { + this.company = Optional.empty(); + } else { + this.company = Optional.of(company.get()); + } + return this; + } + + /** + *

The company for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(PaymentCompany company) { + this.company = Optional.ofNullable(company); + return this; + } + + /** + *

The company for the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfigurationId(Nullable checkoutConfigurationId) { + if (checkoutConfigurationId.isNull()) { + this.checkoutConfigurationId = null; + } else if (checkoutConfigurationId.isEmpty()) { + this.checkoutConfigurationId = Optional.empty(); + } else { + this.checkoutConfigurationId = Optional.of(checkoutConfigurationId.get()); + } + return this; + } + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfigurationId(String checkoutConfigurationId) { + this.checkoutConfigurationId = Optional.ofNullable(checkoutConfigurationId); + return this; + } + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ */ + @java.lang.Override + @JsonSetter(value = "checkout_configuration_id", nulls = Nulls.SKIP) + public _FinalStage checkoutConfigurationId(Optional checkoutConfigurationId) { + this.checkoutConfigurationId = checkoutConfigurationId; + return this; + } + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardLast4(Nullable cardLast4) { + if (cardLast4.isNull()) { + this.cardLast4 = null; + } else if (cardLast4.isEmpty()) { + this.cardLast4 = Optional.empty(); + } else { + this.cardLast4 = Optional.of(cardLast4.get()); + } + return this; + } + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardLast4(String cardLast4) { + this.cardLast4 = Optional.ofNullable(cardLast4); + return this; + } + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ */ + @java.lang.Override + @JsonSetter(value = "card_last4", nulls = Nulls.SKIP) + public _FinalStage cardLast4(Optional cardLast4) { + this.cardLast4 = cardLast4; + return this; + } + + /** + *

The four-digit expiration year of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardExpYear(Nullable cardExpYear) { + if (cardExpYear.isNull()) { + this.cardExpYear = null; + } else if (cardExpYear.isEmpty()) { + this.cardExpYear = Optional.empty(); + } else { + this.cardExpYear = Optional.of(cardExpYear.get()); + } + return this; + } + + /** + *

The four-digit expiration year of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardExpYear(Integer cardExpYear) { + this.cardExpYear = Optional.ofNullable(cardExpYear); + return this; + } + + /** + *

The four-digit expiration year of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ */ + @java.lang.Override + @JsonSetter(value = "card_exp_year", nulls = Nulls.SKIP) + public _FinalStage cardExpYear(Optional cardExpYear) { + this.cardExpYear = cardExpYear; + return this; + } + + /** + *

The expiration month (1-12) of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardExpMonth(Nullable cardExpMonth) { + if (cardExpMonth.isNull()) { + this.cardExpMonth = null; + } else if (cardExpMonth.isEmpty()) { + this.cardExpMonth = Optional.empty(); + } else { + this.cardExpMonth = Optional.of(cardExpMonth.get()); + } + return this; + } + + /** + *

The expiration month (1-12) of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardExpMonth(Integer cardExpMonth) { + this.cardExpMonth = Optional.ofNullable(cardExpMonth); + return this; + } + + /** + *

The expiration month (1-12) of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ */ + @java.lang.Override + @JsonSetter(value = "card_exp_month", nulls = Nulls.SKIP) + public _FinalStage cardExpMonth(Optional cardExpMonth) { + this.cardExpMonth = cardExpMonth; + return this; + } + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(Nullable cardBrand) { + if (cardBrand.isNull()) { + this.cardBrand = null; + } else if (cardBrand.isEmpty()) { + this.cardBrand = Optional.empty(); + } else { + this.cardBrand = Optional.of(cardBrand.get()); + } + return this; + } + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(CardBrands cardBrand) { + this.cardBrand = Optional.ofNullable(cardBrand); + return this; + } + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ */ + @java.lang.Override + @JsonSetter(value = "card_brand", nulls = Nulls.SKIP) + public _FinalStage cardBrand(Optional cardBrand) { + this.cardBrand = cardBrand; + return this; + } + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingReason(Nullable billingReason) { + if (billingReason.isNull()) { + this.billingReason = null; + } else if (billingReason.isEmpty()) { + this.billingReason = Optional.empty(); + } else { + this.billingReason = Optional.of(billingReason.get()); + } + return this; + } + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingReason(BillingReasons billingReason) { + this.billingReason = Optional.ofNullable(billingReason); + return this; + } + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_reason", nulls = Nulls.SKIP) + public _FinalStage billingReason(Optional billingReason) { + this.billingReason = billingReason; + return this; + } + + /** + *

The address of the user who made the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingAddress(Nullable billingAddress) { + if (billingAddress.isNull()) { + this.billingAddress = null; + } else if (billingAddress.isEmpty()) { + this.billingAddress = Optional.empty(); + } else { + this.billingAddress = Optional.of(billingAddress.get()); + } + return this; + } + + /** + *

The address of the user who made the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingAddress(PaymentBillingAddress billingAddress) { + this.billingAddress = Optional.ofNullable(billingAddress); + return this; + } + + /** + *

The address of the user who made the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_address", nulls = Nulls.SKIP) + public _FinalStage billingAddress(Optional billingAddress) { + this.billingAddress = billingAddress; + return this; + } + + /** + *

The application fee charged on this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage applicationFee(Nullable applicationFee) { + if (applicationFee.isNull()) { + this.applicationFee = null; + } else if (applicationFee.isEmpty()) { + this.applicationFee = Optional.empty(); + } else { + this.applicationFee = Optional.of(applicationFee.get()); + } + return this; + } + + /** + *

The application fee charged on this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage applicationFee(PaymentApplicationFee applicationFee) { + this.applicationFee = Optional.ofNullable(applicationFee); + return this; + } + + /** + *

The application fee charged on this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "application_fee", nulls = Nulls.SKIP) + public _FinalStage applicationFee(Optional applicationFee) { + this.applicationFee = applicationFee; + return this; + } + + @java.lang.Override + public CreatePaymentsResponse build() { + return new CreatePaymentsResponse( + amountAfterFees, + applicationFee, + autoRefunded, + billingAddress, + billingReason, + cardBrand, + cardExpMonth, + cardExpYear, + cardLast4, + checkoutConfigurationId, + company, + createdAt, + currency, + customerPhone, + declineCode, + disputeAlertedAt, + disputes, + failureMessage, + financingInstallmentsCount, + financingTransactions, + id, + lastPaymentAttempt, + member, + membership, + metadata, + needsTracking, + nextPaymentAttempt, + paidAt, + paymentInstrument, + paymentMethod, + paymentMethodType, + paymentsFailed, + plan, + product, + promoCode, + refundable, + refundedAmount, + refundedAt, + refunds, + resolutions, + retryable, + riskScore, + riskSignals, + settlementAmount, + settlementCurrency, + settlementExchangeRate, + settlementTimeAt, + shipment, + shippingAddress, + status, + substatus, + subtotal, + taxAmount, + taxBehavior, + taxRefundedAmount, + threeDsVerified, + total, + updatedAt, + usdTotal, + user, + verificationChecks, + voidable, + clientSecret, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/ListFeesPaymentsResponse.java b/src/main/java/com/whop/api/resources/payments/types/ListFeesPaymentsResponse.java new file mode 100644 index 00000000..36a42754 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/ListFeesPaymentsResponse.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PageInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListFeesPaymentsResponse.Builder.class) +public final class ListFeesPaymentsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListFeesPaymentsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListFeesPaymentsResponse && equalTo((ListFeesPaymentsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListFeesPaymentsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListFeesPaymentsResponse other); + } + + public interface _FinalStage { + ListFeesPaymentsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(ListFeesPaymentsResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListFeesPaymentsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(ListFeesPaymentsResponseDataItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListFeesPaymentsResponse build() { + return new ListFeesPaymentsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/ListFeesPaymentsResponseDataItem.java b/src/main/java/com/whop/api/resources/payments/types/ListFeesPaymentsResponseDataItem.java new file mode 100644 index 00000000..b139b27a --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/ListFeesPaymentsResponseDataItem.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Currencies; +import com.whop.api.types.SpecificFeeOrigins; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListFeesPaymentsResponseDataItem.Builder.class) +public final class ListFeesPaymentsResponseDataItem { + private final double amount; + + private final Currencies currency; + + private final String name; + + private final SpecificFeeOrigins type; + + private final Map additionalProperties; + + private ListFeesPaymentsResponseDataItem( + double amount, + Currencies currency, + String name, + SpecificFeeOrigins type, + Map additionalProperties) { + this.amount = amount; + this.currency = currency; + this.name = name; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The value or amount to display for the fee. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The currency of the fee. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The label to display for the fee. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The specific origin of the fee, if applicable. + */ + @JsonProperty("type") + public SpecificFeeOrigins getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListFeesPaymentsResponseDataItem && equalTo((ListFeesPaymentsResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListFeesPaymentsResponseDataItem other) { + return amount == other.amount + && currency.equals(other.currency) + && name.equals(other.name) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.currency, this.name, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The value or amount to display for the fee.

+ */ + CurrencyStage amount(double amount); + + Builder from(ListFeesPaymentsResponseDataItem other); + } + + public interface CurrencyStage { + /** + *

The currency of the fee.

+ */ + NameStage currency(@NotNull Currencies currency); + } + + public interface NameStage { + /** + *

The label to display for the fee.

+ */ + TypeStage name(@NotNull String name); + } + + public interface TypeStage { + /** + *

The specific origin of the fee, if applicable.

+ */ + _FinalStage type(@NotNull SpecificFeeOrigins type); + } + + public interface _FinalStage { + ListFeesPaymentsResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, CurrencyStage, NameStage, TypeStage, _FinalStage { + private double amount; + + private Currencies currency; + + private String name; + + private SpecificFeeOrigins type; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListFeesPaymentsResponseDataItem other) { + amount(other.getAmount()); + currency(other.getCurrency()); + name(other.getName()); + type(other.getType()); + return this; + } + + /** + *

The value or amount to display for the fee.

+ *

The value or amount to display for the fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CurrencyStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The currency of the fee.

+ *

The currency of the fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public NameStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The label to display for the fee.

+ *

The label to display for the fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public TypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The specific origin of the fee, if applicable.

+ *

The specific origin of the fee, if applicable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull SpecificFeeOrigins type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public ListFeesPaymentsResponseDataItem build() { + return new ListFeesPaymentsResponseDataItem(amount, currency, name, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/ListPaymentsResponse.java b/src/main/java/com/whop/api/resources/payments/types/ListPaymentsResponse.java new file mode 100644 index 00000000..d62132d6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/ListPaymentsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PageInfo; +import com.whop.api.types.PaymentListItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPaymentsResponse.Builder.class) +public final class ListPaymentsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListPaymentsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPaymentsResponse && equalTo((ListPaymentsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPaymentsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListPaymentsResponse other); + } + + public interface _FinalStage { + ListPaymentsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(PaymentListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPaymentsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(PaymentListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListPaymentsResponse build() { + return new ListPaymentsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/PostPaymentCreatedPayload.java b/src/main/java/com/whop/api/resources/payments/types/PostPaymentCreatedPayload.java new file mode 100644 index 00000000..78be123f --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/PostPaymentCreatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Payment; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPaymentCreatedPayload.Builder.class) +public final class PostPaymentCreatedPayload { + private final Optional accountId; + + private final PostPaymentCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Payment data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostPaymentCreatedPayloadType type; + + private final Map additionalProperties; + + private PostPaymentCreatedPayload( + Optional accountId, + PostPaymentCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Payment data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostPaymentCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostPaymentCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Payment getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostPaymentCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPaymentCreatedPayload && equalTo((PostPaymentCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPaymentCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostPaymentCreatedPayloadApiVersion apiVersion); + + Builder from(PostPaymentCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Payment data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostPaymentCreatedPayloadType type); + } + + public interface _FinalStage { + PostPaymentCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostPaymentCreatedPayloadApiVersion apiVersion; + + private Payment data; + + private String id; + + private OffsetDateTime timestamp; + + private PostPaymentCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostPaymentCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostPaymentCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Payment data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostPaymentCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostPaymentCreatedPayload build() { + return new PostPaymentCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/PostPaymentCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/payments/types/PostPaymentCreatedPayloadApiVersion.java new file mode 100644 index 00000000..7c444993 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/PostPaymentCreatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPaymentCreatedPayloadApiVersion { + public static final PostPaymentCreatedPayloadApiVersion V1 = + new PostPaymentCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostPaymentCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPaymentCreatedPayloadApiVersion + && this.string.equals(((PostPaymentCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPaymentCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostPaymentCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/PostPaymentCreatedPayloadType.java b/src/main/java/com/whop/api/resources/payments/types/PostPaymentCreatedPayloadType.java new file mode 100644 index 00000000..577964a1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/PostPaymentCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPaymentCreatedPayloadType { + public static final PostPaymentCreatedPayloadType PAYMENT_CREATED = + new PostPaymentCreatedPayloadType(Value.PAYMENT_CREATED, "payment.created"); + + private final Value value; + + private final String string; + + PostPaymentCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPaymentCreatedPayloadType + && this.string.equals(((PostPaymentCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYMENT_CREATED: + return visitor.visitPaymentCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPaymentCreatedPayloadType valueOf(String value) { + switch (value) { + case "payment.created": + return PAYMENT_CREATED; + default: + return new PostPaymentCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYMENT_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitPaymentCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/PostPaymentFailedPayload.java b/src/main/java/com/whop/api/resources/payments/types/PostPaymentFailedPayload.java new file mode 100644 index 00000000..f56c2fcd --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/PostPaymentFailedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Payment; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPaymentFailedPayload.Builder.class) +public final class PostPaymentFailedPayload { + private final Optional accountId; + + private final PostPaymentFailedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Payment data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostPaymentFailedPayloadType type; + + private final Map additionalProperties; + + private PostPaymentFailedPayload( + Optional accountId, + PostPaymentFailedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Payment data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostPaymentFailedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostPaymentFailedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Payment getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostPaymentFailedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPaymentFailedPayload && equalTo((PostPaymentFailedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPaymentFailedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostPaymentFailedPayloadApiVersion apiVersion); + + Builder from(PostPaymentFailedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Payment data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostPaymentFailedPayloadType type); + } + + public interface _FinalStage { + PostPaymentFailedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostPaymentFailedPayloadApiVersion apiVersion; + + private Payment data; + + private String id; + + private OffsetDateTime timestamp; + + private PostPaymentFailedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostPaymentFailedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostPaymentFailedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Payment data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostPaymentFailedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostPaymentFailedPayload build() { + return new PostPaymentFailedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/PostPaymentFailedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/payments/types/PostPaymentFailedPayloadApiVersion.java new file mode 100644 index 00000000..4c68ae58 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/PostPaymentFailedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPaymentFailedPayloadApiVersion { + public static final PostPaymentFailedPayloadApiVersion V1 = new PostPaymentFailedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostPaymentFailedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPaymentFailedPayloadApiVersion + && this.string.equals(((PostPaymentFailedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPaymentFailedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostPaymentFailedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/PostPaymentFailedPayloadType.java b/src/main/java/com/whop/api/resources/payments/types/PostPaymentFailedPayloadType.java new file mode 100644 index 00000000..7605bedb --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/PostPaymentFailedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPaymentFailedPayloadType { + public static final PostPaymentFailedPayloadType PAYMENT_FAILED = + new PostPaymentFailedPayloadType(Value.PAYMENT_FAILED, "payment.failed"); + + private final Value value; + + private final String string; + + PostPaymentFailedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPaymentFailedPayloadType + && this.string.equals(((PostPaymentFailedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYMENT_FAILED: + return visitor.visitPaymentFailed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPaymentFailedPayloadType valueOf(String value) { + switch (value) { + case "payment.failed": + return PAYMENT_FAILED; + default: + return new PostPaymentFailedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYMENT_FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitPaymentFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/PostPaymentPendingPayload.java b/src/main/java/com/whop/api/resources/payments/types/PostPaymentPendingPayload.java new file mode 100644 index 00000000..e245e997 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/PostPaymentPendingPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Payment; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPaymentPendingPayload.Builder.class) +public final class PostPaymentPendingPayload { + private final Optional accountId; + + private final PostPaymentPendingPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Payment data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostPaymentPendingPayloadType type; + + private final Map additionalProperties; + + private PostPaymentPendingPayload( + Optional accountId, + PostPaymentPendingPayloadApiVersion apiVersion, + Optional apiVersionDate, + Payment data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostPaymentPendingPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostPaymentPendingPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Payment getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostPaymentPendingPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPaymentPendingPayload && equalTo((PostPaymentPendingPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPaymentPendingPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostPaymentPendingPayloadApiVersion apiVersion); + + Builder from(PostPaymentPendingPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Payment data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostPaymentPendingPayloadType type); + } + + public interface _FinalStage { + PostPaymentPendingPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostPaymentPendingPayloadApiVersion apiVersion; + + private Payment data; + + private String id; + + private OffsetDateTime timestamp; + + private PostPaymentPendingPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostPaymentPendingPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostPaymentPendingPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Payment data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostPaymentPendingPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostPaymentPendingPayload build() { + return new PostPaymentPendingPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/PostPaymentPendingPayloadApiVersion.java b/src/main/java/com/whop/api/resources/payments/types/PostPaymentPendingPayloadApiVersion.java new file mode 100644 index 00000000..1a0d1f95 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/PostPaymentPendingPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPaymentPendingPayloadApiVersion { + public static final PostPaymentPendingPayloadApiVersion V1 = + new PostPaymentPendingPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostPaymentPendingPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPaymentPendingPayloadApiVersion + && this.string.equals(((PostPaymentPendingPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPaymentPendingPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostPaymentPendingPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/PostPaymentPendingPayloadType.java b/src/main/java/com/whop/api/resources/payments/types/PostPaymentPendingPayloadType.java new file mode 100644 index 00000000..d23ce06f --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/PostPaymentPendingPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPaymentPendingPayloadType { + public static final PostPaymentPendingPayloadType PAYMENT_PENDING = + new PostPaymentPendingPayloadType(Value.PAYMENT_PENDING, "payment.pending"); + + private final Value value; + + private final String string; + + PostPaymentPendingPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPaymentPendingPayloadType + && this.string.equals(((PostPaymentPendingPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYMENT_PENDING: + return visitor.visitPaymentPending(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPaymentPendingPayloadType valueOf(String value) { + switch (value) { + case "payment.pending": + return PAYMENT_PENDING; + default: + return new PostPaymentPendingPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYMENT_PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitPaymentPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/PostPaymentSucceededPayload.java b/src/main/java/com/whop/api/resources/payments/types/PostPaymentSucceededPayload.java new file mode 100644 index 00000000..0e8b0fb9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/PostPaymentSucceededPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Payment; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPaymentSucceededPayload.Builder.class) +public final class PostPaymentSucceededPayload { + private final Optional accountId; + + private final PostPaymentSucceededPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Payment data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostPaymentSucceededPayloadType type; + + private final Map additionalProperties; + + private PostPaymentSucceededPayload( + Optional accountId, + PostPaymentSucceededPayloadApiVersion apiVersion, + Optional apiVersionDate, + Payment data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostPaymentSucceededPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostPaymentSucceededPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Payment getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostPaymentSucceededPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPaymentSucceededPayload && equalTo((PostPaymentSucceededPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPaymentSucceededPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostPaymentSucceededPayloadApiVersion apiVersion); + + Builder from(PostPaymentSucceededPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Payment data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostPaymentSucceededPayloadType type); + } + + public interface _FinalStage { + PostPaymentSucceededPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostPaymentSucceededPayloadApiVersion apiVersion; + + private Payment data; + + private String id; + + private OffsetDateTime timestamp; + + private PostPaymentSucceededPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostPaymentSucceededPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostPaymentSucceededPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Payment data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostPaymentSucceededPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostPaymentSucceededPayload build() { + return new PostPaymentSucceededPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/PostPaymentSucceededPayloadApiVersion.java b/src/main/java/com/whop/api/resources/payments/types/PostPaymentSucceededPayloadApiVersion.java new file mode 100644 index 00000000..c5922b9f --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/PostPaymentSucceededPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPaymentSucceededPayloadApiVersion { + public static final PostPaymentSucceededPayloadApiVersion V1 = + new PostPaymentSucceededPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostPaymentSucceededPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPaymentSucceededPayloadApiVersion + && this.string.equals(((PostPaymentSucceededPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPaymentSucceededPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostPaymentSucceededPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/PostPaymentSucceededPayloadType.java b/src/main/java/com/whop/api/resources/payments/types/PostPaymentSucceededPayloadType.java new file mode 100644 index 00000000..db0ad1e5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/PostPaymentSucceededPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPaymentSucceededPayloadType { + public static final PostPaymentSucceededPayloadType PAYMENT_SUCCEEDED = + new PostPaymentSucceededPayloadType(Value.PAYMENT_SUCCEEDED, "payment.succeeded"); + + private final Value value; + + private final String string; + + PostPaymentSucceededPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPaymentSucceededPayloadType + && this.string.equals(((PostPaymentSucceededPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYMENT_SUCCEEDED: + return visitor.visitPaymentSucceeded(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPaymentSucceededPayloadType valueOf(String value) { + switch (value) { + case "payment.succeeded": + return PAYMENT_SUCCEEDED; + default: + return new PostPaymentSucceededPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYMENT_SUCCEEDED, + + UNKNOWN + } + + public interface Visitor { + T visitPaymentSucceeded(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payments/types/RetrievePaymentsResponse.java b/src/main/java/com/whop/api/resources/payments/types/RetrievePaymentsResponse.java new file mode 100644 index 00000000..7e9eb850 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payments/types/RetrievePaymentsResponse.java @@ -0,0 +1,4251 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.BillingReasons; +import com.whop.api.types.CardBrands; +import com.whop.api.types.Currencies; +import com.whop.api.types.FriendlyReceiptStatus; +import com.whop.api.types.IPayment; +import com.whop.api.types.PaymentApplicationFee; +import com.whop.api.types.PaymentBillingAddress; +import com.whop.api.types.PaymentCompany; +import com.whop.api.types.PaymentDeclineCodes; +import com.whop.api.types.PaymentDisputesItem; +import com.whop.api.types.PaymentFinancingTransactionsItem; +import com.whop.api.types.PaymentMember; +import com.whop.api.types.PaymentMembership; +import com.whop.api.types.PaymentMethodTypes; +import com.whop.api.types.PaymentPaymentInstrument; +import com.whop.api.types.PaymentPaymentMethod; +import com.whop.api.types.PaymentPlan; +import com.whop.api.types.PaymentProduct; +import com.whop.api.types.PaymentPromoCode; +import com.whop.api.types.PaymentRefundsItem; +import com.whop.api.types.PaymentResolutionsItem; +import com.whop.api.types.PaymentShipment; +import com.whop.api.types.PaymentShippingAddress; +import com.whop.api.types.PaymentUser; +import com.whop.api.types.PaymentVerificationChecks; +import com.whop.api.types.ReceiptStatus; +import com.whop.api.types.ReceiptTaxBehaviors; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePaymentsResponse.Builder.class) +public final class RetrievePaymentsResponse implements IPayment { + private final double amountAfterFees; + + private final Optional applicationFee; + + private final boolean autoRefunded; + + private final Optional billingAddress; + + private final Optional billingReason; + + private final Optional cardBrand; + + private final Optional cardExpMonth; + + private final Optional cardExpYear; + + private final Optional cardLast4; + + private final Optional checkoutConfigurationId; + + private final Optional company; + + private final OffsetDateTime createdAt; + + private final Currencies currency; + + private final Optional customerPhone; + + private final Optional declineCode; + + private final Optional disputeAlertedAt; + + private final Optional> disputes; + + private final Optional failureMessage; + + private final Optional financingInstallmentsCount; + + private final List financingTransactions; + + private final String id; + + private final Optional lastPaymentAttempt; + + private final Optional member; + + private final Optional membership; + + private final Optional> metadata; + + private final Optional needsTracking; + + private final Optional nextPaymentAttempt; + + private final Optional paidAt; + + private final Optional paymentInstrument; + + private final Optional paymentMethod; + + private final Optional paymentMethodType; + + private final Optional paymentsFailed; + + private final Optional plan; + + private final Optional product; + + private final Optional promoCode; + + private final boolean refundable; + + private final Optional refundedAmount; + + private final Optional refundedAt; + + private final List refunds; + + private final Optional> resolutions; + + private final boolean retryable; + + private final Optional riskScore; + + private final Optional> riskSignals; + + private final double settlementAmount; + + private final Currencies settlementCurrency; + + private final Optional settlementExchangeRate; + + private final Optional settlementTimeAt; + + private final Optional shipment; + + private final Optional shippingAddress; + + private final Optional status; + + private final FriendlyReceiptStatus substatus; + + private final Optional subtotal; + + private final Optional taxAmount; + + private final Optional taxBehavior; + + private final Optional taxRefundedAmount; + + private final boolean threeDsVerified; + + private final Optional total; + + private final OffsetDateTime updatedAt; + + private final Optional usdTotal; + + private final Optional user; + + private final Optional verificationChecks; + + private final boolean voidable; + + private final Optional clientSecret; + + private final Map additionalProperties; + + private RetrievePaymentsResponse( + double amountAfterFees, + Optional applicationFee, + boolean autoRefunded, + Optional billingAddress, + Optional billingReason, + Optional cardBrand, + Optional cardExpMonth, + Optional cardExpYear, + Optional cardLast4, + Optional checkoutConfigurationId, + Optional company, + OffsetDateTime createdAt, + Currencies currency, + Optional customerPhone, + Optional declineCode, + Optional disputeAlertedAt, + Optional> disputes, + Optional failureMessage, + Optional financingInstallmentsCount, + List financingTransactions, + String id, + Optional lastPaymentAttempt, + Optional member, + Optional membership, + Optional> metadata, + Optional needsTracking, + Optional nextPaymentAttempt, + Optional paidAt, + Optional paymentInstrument, + Optional paymentMethod, + Optional paymentMethodType, + Optional paymentsFailed, + Optional plan, + Optional product, + Optional promoCode, + boolean refundable, + Optional refundedAmount, + Optional refundedAt, + List refunds, + Optional> resolutions, + boolean retryable, + Optional riskScore, + Optional> riskSignals, + double settlementAmount, + Currencies settlementCurrency, + Optional settlementExchangeRate, + Optional settlementTimeAt, + Optional shipment, + Optional shippingAddress, + Optional status, + FriendlyReceiptStatus substatus, + Optional subtotal, + Optional taxAmount, + Optional taxBehavior, + Optional taxRefundedAmount, + boolean threeDsVerified, + Optional total, + OffsetDateTime updatedAt, + Optional usdTotal, + Optional user, + Optional verificationChecks, + boolean voidable, + Optional clientSecret, + Map additionalProperties) { + this.amountAfterFees = amountAfterFees; + this.applicationFee = applicationFee; + this.autoRefunded = autoRefunded; + this.billingAddress = billingAddress; + this.billingReason = billingReason; + this.cardBrand = cardBrand; + this.cardExpMonth = cardExpMonth; + this.cardExpYear = cardExpYear; + this.cardLast4 = cardLast4; + this.checkoutConfigurationId = checkoutConfigurationId; + this.company = company; + this.createdAt = createdAt; + this.currency = currency; + this.customerPhone = customerPhone; + this.declineCode = declineCode; + this.disputeAlertedAt = disputeAlertedAt; + this.disputes = disputes; + this.failureMessage = failureMessage; + this.financingInstallmentsCount = financingInstallmentsCount; + this.financingTransactions = financingTransactions; + this.id = id; + this.lastPaymentAttempt = lastPaymentAttempt; + this.member = member; + this.membership = membership; + this.metadata = metadata; + this.needsTracking = needsTracking; + this.nextPaymentAttempt = nextPaymentAttempt; + this.paidAt = paidAt; + this.paymentInstrument = paymentInstrument; + this.paymentMethod = paymentMethod; + this.paymentMethodType = paymentMethodType; + this.paymentsFailed = paymentsFailed; + this.plan = plan; + this.product = product; + this.promoCode = promoCode; + this.refundable = refundable; + this.refundedAmount = refundedAmount; + this.refundedAt = refundedAt; + this.refunds = refunds; + this.resolutions = resolutions; + this.retryable = retryable; + this.riskScore = riskScore; + this.riskSignals = riskSignals; + this.settlementAmount = settlementAmount; + this.settlementCurrency = settlementCurrency; + this.settlementExchangeRate = settlementExchangeRate; + this.settlementTimeAt = settlementTimeAt; + this.shipment = shipment; + this.shippingAddress = shippingAddress; + this.status = status; + this.substatus = substatus; + this.subtotal = subtotal; + this.taxAmount = taxAmount; + this.taxBehavior = taxBehavior; + this.taxRefundedAmount = taxRefundedAmount; + this.threeDsVerified = threeDsVerified; + this.total = total; + this.updatedAt = updatedAt; + this.usdTotal = usdTotal; + this.user = user; + this.verificationChecks = verificationChecks; + this.voidable = voidable; + this.clientSecret = clientSecret; + this.additionalProperties = additionalProperties; + } + + /** + * @return How much the payment is for after fees + */ + @JsonProperty("amount_after_fees") + @java.lang.Override + public double getAmountAfterFees() { + return amountAfterFees; + } + + /** + * @return The application fee charged on this payment. + */ + @JsonIgnore + public Optional getApplicationFee() { + if (applicationFee == null) { + return Optional.empty(); + } + return applicationFee; + } + + /** + * @return Whether this payment was auto refunded or not + */ + @JsonProperty("auto_refunded") + @java.lang.Override + public boolean getAutoRefunded() { + return autoRefunded; + } + + /** + * @return The address of the user who made the payment. + */ + @JsonIgnore + public Optional getBillingAddress() { + if (billingAddress == null) { + return Optional.empty(); + } + return billingAddress; + } + + /** + * @return The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment. + */ + @JsonIgnore + @java.lang.Override + public Optional getBillingReason() { + if (billingReason == null) { + return Optional.empty(); + } + return billingReason; + } + + /** + * @return Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'. + */ + @JsonIgnore + @java.lang.Override + public Optional getCardBrand() { + if (cardBrand == null) { + return Optional.empty(); + } + return cardBrand; + } + + /** + * @return The expiration month (1-12) of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable. + */ + @JsonIgnore + @java.lang.Override + public Optional getCardExpMonth() { + if (cardExpMonth == null) { + return Optional.empty(); + } + return cardExpMonth; + } + + /** + * @return The four-digit expiration year of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable. + */ + @JsonIgnore + @java.lang.Override + public Optional getCardExpYear() { + if (cardExpYear == null) { + return Optional.empty(); + } + return cardExpYear; + } + + /** + * @return The last four digits of the card used to make this payment. Null if the payment was not made with a card. + */ + @JsonIgnore + @java.lang.Override + public Optional getCardLast4() { + if (cardLast4 == null) { + return Optional.empty(); + } + return cardLast4; + } + + /** + * @return The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them. + */ + @JsonIgnore + @java.lang.Override + public Optional getCheckoutConfigurationId() { + if (checkoutConfigurationId == null) { + return Optional.empty(); + } + return checkoutConfigurationId; + } + + /** + * @return The company for the payment. + */ + @JsonIgnore + public Optional getCompany() { + if (company == null) { + return Optional.empty(); + } + return company; + } + + /** + * @return The datetime the payment was created. + */ + @JsonProperty("created_at") + @java.lang.Override + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code for this payment (e.g., 'usd', 'eur'). + */ + @JsonProperty("currency") + @java.lang.Override + public Currencies getCurrency() { + return currency; + } + + /** + * @return Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected. + */ + @JsonIgnore + @java.lang.Override + public Optional getCustomerPhone() { + if (customerPhone == null) { + return Optional.empty(); + } + return customerPhone; + } + + /** + * @return The reason the payment was declined. Null if the payment did not fail. + */ + @JsonIgnore + @java.lang.Override + public Optional getDeclineCode() { + if (declineCode == null) { + return Optional.empty(); + } + return declineCode; + } + + /** + * @return When an alert came in that this transaction will be disputed + */ + @JsonIgnore + @java.lang.Override + public Optional getDisputeAlertedAt() { + if (disputeAlertedAt == null) { + return Optional.empty(); + } + return disputeAlertedAt; + } + + /** + * @return The disputes attached to this payment. Null if the actor in context does not have the payment:dispute:read permission. + */ + @JsonIgnore + public Optional> getDisputes() { + if (disputes == null) { + return Optional.empty(); + } + return disputes; + } + + /** + * @return If the payment failed, the reason for the failure. + */ + @JsonIgnore + @java.lang.Override + public Optional getFailureMessage() { + if (failureMessage == null) { + return Optional.empty(); + } + return failureMessage; + } + + /** + * @return The number of financing installments for the payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.). + */ + @JsonIgnore + @java.lang.Override + public Optional getFinancingInstallmentsCount() { + if (financingInstallmentsCount == null) { + return Optional.empty(); + } + return financingInstallmentsCount; + } + + /** + * @return The financing transactions attached to this payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.). + */ + @JsonProperty("financing_transactions") + public List getFinancingTransactions() { + return financingTransactions; + } + + /** + * @return The unique identifier for the payment. + */ + @JsonProperty("id") + @java.lang.Override + public String getId() { + return id; + } + + /** + * @return The time of the last payment attempt. + */ + @JsonIgnore + @java.lang.Override + public Optional getLastPaymentAttempt() { + if (lastPaymentAttempt == null) { + return Optional.empty(); + } + return lastPaymentAttempt; + } + + /** + * @return The member attached to this payment. + */ + @JsonIgnore + public Optional getMember() { + if (member == null) { + return Optional.empty(); + } + return member; + } + + /** + * @return The membership attached to this payment. + */ + @JsonIgnore + public Optional getMembership() { + if (membership == null) { + return Optional.empty(); + } + return membership; + } + + /** + * @return The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made + */ + @JsonIgnore + @java.lang.Override + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Whether this payment is holding funds until the order ships and has no tracking number yet. + */ + @JsonIgnore + @java.lang.Override + public Optional getNeedsTracking() { + if (needsTracking == null) { + return Optional.empty(); + } + return needsTracking; + } + + /** + * @return The time of the next schedule payment retry. + */ + @JsonIgnore + @java.lang.Override + public Optional getNextPaymentAttempt() { + if (nextPaymentAttempt == null) { + return Optional.empty(); + } + return nextPaymentAttempt; + } + + /** + * @return The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp. + */ + @JsonIgnore + @java.lang.Override + public Optional getPaidAt() { + if (paidAt == null) { + return Optional.empty(); + } + return paidAt; + } + + /** + * @return The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method. + */ + @JsonIgnore + public Optional getPaymentInstrument() { + if (paymentInstrument == null) { + return Optional.empty(); + } + return paymentInstrument; + } + + /** + * @return The tokenized payment method reference used for this payment. Null if no token was used. + */ + @JsonIgnore + public Optional getPaymentMethod() { + if (paymentMethod == null) { + return Optional.empty(); + } + return paymentMethod; + } + + /** + * @return The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type. + */ + @JsonIgnore + @java.lang.Override + public Optional getPaymentMethodType() { + if (paymentMethodType == null) { + return Optional.empty(); + } + return paymentMethodType; + } + + /** + * @return The number of failed payment attempts for the payment. + */ + @JsonIgnore + @java.lang.Override + public Optional getPaymentsFailed() { + if (paymentsFailed == null) { + return Optional.empty(); + } + return paymentsFailed; + } + + /** + * @return The plan attached to this payment. + */ + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + /** + * @return The product this payment was made for + */ + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return The promo code used for this payment. + */ + @JsonIgnore + public Optional getPromoCode() { + if (promoCode == null) { + return Optional.empty(); + } + return promoCode; + } + + /** + * @return True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds. + */ + @JsonProperty("refundable") + @java.lang.Override + public boolean getRefundable() { + return refundable; + } + + /** + * @return The payment refund amount(if applicable). + */ + @JsonIgnore + @java.lang.Override + public Optional getRefundedAmount() { + if (refundedAmount == null) { + return Optional.empty(); + } + return refundedAmount; + } + + /** + * @return When the payment was refunded (if applicable). + */ + @JsonIgnore + @java.lang.Override + public Optional getRefundedAt() { + if (refundedAt == null) { + return Optional.empty(); + } + return refundedAt; + } + + /** + * @return The refunds issued against this payment, newest first, including failed and canceled refund attempts. Limited to the 100 most recent. + */ + @JsonProperty("refunds") + public List getRefunds() { + return refunds; + } + + /** + * @return The resolution center cases opened by the customer on this payment. Null if the actor in context does not have the payment:resolution_center_case:read permission. + */ + @JsonIgnore + public Optional> getResolutions() { + if (resolutions == null) { + return Optional.empty(); + } + return resolutions; + } + + /** + * @return True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again. + */ + @JsonProperty("retryable") + @java.lang.Override + public boolean getRetryable() { + return retryable; + } + + /** + * @return Whop's in-house fraud risk score for this payment, from 0 (lowest risk) to 100 (highest risk). Null when the payment has not been scored or scoring has not yet completed. + */ + @JsonIgnore + @java.lang.Override + public Optional getRiskScore() { + if (riskScore == null) { + return Optional.empty(); + } + return riskScore; + } + + /** + * @return A curated set of factors behind the risk score, grouped by category (business transaction history, buyer, device). Each entry has a key, human-readable label, category, and value. Null when there is no risk assessment for this payment. + */ + @JsonIgnore + @java.lang.Override + public Optional> getRiskSignals() { + if (riskSignals == null) { + return Optional.empty(); + } + return riskSignals; + } + + /** + * @return The total amount charged to the customer for this payment, including taxes and after any discounts. In the currency specified by the currency field. + */ + @JsonProperty("settlement_amount") + @java.lang.Override + public double getSettlementAmount() { + return settlementAmount; + } + + /** + * @return The three-letter ISO currency code for this payment (e.g., 'usd', 'eur'). + */ + @JsonProperty("settlement_currency") + @java.lang.Override + public Currencies getSettlementCurrency() { + return settlementCurrency; + } + + /** + * @return Deprecated. Always returns null. + */ + @JsonIgnore + @java.lang.Override + public Optional getSettlementExchangeRate() { + if (settlementExchangeRate == null) { + return Optional.empty(); + } + return settlementExchangeRate; + } + + /** + * @return When this payment's funds post to the company's available balance, at midnight UTC. Known at payment time and never changes. The ledger_account.funds_available webhook carries the same settlement_time_at when that batch posts — match them to know these funds are now withdrawable. + */ + @JsonIgnore + @java.lang.Override + public Optional getSettlementTimeAt() { + if (settlementTimeAt == null) { + return Optional.empty(); + } + return settlementTimeAt; + } + + /** + * @return The shipment attached to this payment. + */ + @JsonIgnore + public Optional getShipment() { + if (shipment == null) { + return Optional.empty(); + } + return shipment; + } + + /** + * @return The shipping address provided by the customer for physical goods. Null if no shipping address was collected. + */ + @JsonIgnore + public Optional getShippingAddress() { + if (shippingAddress == null) { + return Optional.empty(); + } + return shippingAddress; + } + + /** + * @return The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void'). + */ + @JsonIgnore + @java.lang.Override + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The friendly status of the payment. + */ + @JsonProperty("substatus") + @java.lang.Override + public FriendlyReceiptStatus getSubstatus() { + return substatus; + } + + /** + * @return The subtotal to show to the creator (excluding buyer fees). + */ + @JsonIgnore + @java.lang.Override + public Optional getSubtotal() { + if (subtotal == null) { + return Optional.empty(); + } + return subtotal; + } + + /** + * @return The calculated amount of the sales/VAT tax (if applicable). + */ + @JsonIgnore + @java.lang.Override + public Optional getTaxAmount() { + if (taxAmount == null) { + return Optional.empty(); + } + return taxAmount; + } + + /** + * @return The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top. + */ + @JsonIgnore + @java.lang.Override + public Optional getTaxBehavior() { + if (taxBehavior == null) { + return Optional.empty(); + } + return taxBehavior; + } + + /** + * @return The amount of tax that has been refunded (if applicable). + */ + @JsonIgnore + @java.lang.Override + public Optional getTaxRefundedAmount() { + if (taxRefundedAmount == null) { + return Optional.empty(); + } + return taxRefundedAmount; + } + + /** + * @return Whether 3D Secure authentication was completed for this payment. + */ + @JsonProperty("three_ds_verified") + @java.lang.Override + public boolean getThreeDsVerified() { + return threeDsVerified; + } + + /** + * @return The total to show to the creator (excluding buyer fees). + */ + @JsonIgnore + @java.lang.Override + public Optional getTotal() { + if (total == null) { + return Optional.empty(); + } + return total; + } + + /** + * @return The datetime the payment was last updated. + */ + @JsonProperty("updated_at") + @java.lang.Override + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The total in USD to show to the creator (excluding buyer fees). + */ + @JsonIgnore + @java.lang.Override + public Optional getUsdTotal() { + if (usdTotal == null) { + return Optional.empty(); + } + return usdTotal; + } + + /** + * @return The user that made this payment. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + /** + * @return The issuer's address and card security code check results for this payment. Null when the processor returned none. + */ + @JsonIgnore + public Optional getVerificationChecks() { + if (verificationChecks == null) { + return Optional.empty(); + } + return verificationChecks; + } + + /** + * @return True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false. + */ + @JsonProperty("voidable") + @java.lang.Override + public boolean getVoidable() { + return voidable; + } + + /** + * @return The credential the buyer's surface presents to poll this payment and set its return URL. Returned when a payment created from a confirmation token is created or retrieved by a caller with the payment:charge permission. Null for payments created from a stored payment method or callers without payment:charge. It unlocks this payment and nothing else; treat it like a password for that one attempt. + */ + @JsonIgnore + public Optional getClientSecret() { + if (clientSecret == null) { + return Optional.empty(); + } + return clientSecret; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("application_fee") + private Optional _getApplicationFee() { + return applicationFee; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_address") + private Optional _getBillingAddress() { + return billingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_reason") + private Optional _getBillingReason() { + return billingReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_brand") + private Optional _getCardBrand() { + return cardBrand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_exp_month") + private Optional _getCardExpMonth() { + return cardExpMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_exp_year") + private Optional _getCardExpYear() { + return cardExpYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_last4") + private Optional _getCardLast4() { + return cardLast4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_configuration_id") + private Optional _getCheckoutConfigurationId() { + return checkoutConfigurationId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company") + private Optional _getCompany() { + return company; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_phone") + private Optional _getCustomerPhone() { + return customerPhone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("decline_code") + private Optional _getDeclineCode() { + return declineCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("dispute_alerted_at") + private Optional _getDisputeAlertedAt() { + return disputeAlertedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("disputes") + private Optional> _getDisputes() { + return disputes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_message") + private Optional _getFailureMessage() { + return failureMessage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("financing_installments_count") + private Optional _getFinancingInstallmentsCount() { + return financingInstallmentsCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_payment_attempt") + private Optional _getLastPaymentAttempt() { + return lastPaymentAttempt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member") + private Optional _getMember() { + return member; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("membership") + private Optional _getMembership() { + return membership; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("needs_tracking") + private Optional _getNeedsTracking() { + return needsTracking; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("next_payment_attempt") + private Optional _getNextPaymentAttempt() { + return nextPaymentAttempt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("paid_at") + private Optional _getPaidAt() { + return paidAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_instrument") + private Optional _getPaymentInstrument() { + return paymentInstrument; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method") + private Optional _getPaymentMethod() { + return paymentMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_type") + private Optional _getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payments_failed") + private Optional _getPaymentsFailed() { + return paymentsFailed; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("promo_code") + private Optional _getPromoCode() { + return promoCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refunded_amount") + private Optional _getRefundedAmount() { + return refundedAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refunded_at") + private Optional _getRefundedAt() { + return refundedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resolutions") + private Optional> _getResolutions() { + return resolutions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("risk_score") + private Optional _getRiskScore() { + return riskScore; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("risk_signals") + private Optional> _getRiskSignals() { + return riskSignals; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("settlement_exchange_rate") + private Optional _getSettlementExchangeRate() { + return settlementExchangeRate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("settlement_time_at") + private Optional _getSettlementTimeAt() { + return settlementTimeAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("shipment") + private Optional _getShipment() { + return shipment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("shipping_address") + private Optional _getShippingAddress() { + return shippingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("subtotal") + private Optional _getSubtotal() { + return subtotal; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_amount") + private Optional _getTaxAmount() { + return taxAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_behavior") + private Optional _getTaxBehavior() { + return taxBehavior; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_refunded_amount") + private Optional _getTaxRefundedAmount() { + return taxRefundedAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("total") + private Optional _getTotal() { + return total; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("usd_total") + private Optional _getUsdTotal() { + return usdTotal; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("verification_checks") + private Optional _getVerificationChecks() { + return verificationChecks; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("client_secret") + private Optional _getClientSecret() { + return clientSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePaymentsResponse && equalTo((RetrievePaymentsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePaymentsResponse other) { + return amountAfterFees == other.amountAfterFees + && applicationFee.equals(other.applicationFee) + && autoRefunded == other.autoRefunded + && billingAddress.equals(other.billingAddress) + && billingReason.equals(other.billingReason) + && cardBrand.equals(other.cardBrand) + && cardExpMonth.equals(other.cardExpMonth) + && cardExpYear.equals(other.cardExpYear) + && cardLast4.equals(other.cardLast4) + && checkoutConfigurationId.equals(other.checkoutConfigurationId) + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && customerPhone.equals(other.customerPhone) + && declineCode.equals(other.declineCode) + && disputeAlertedAt.equals(other.disputeAlertedAt) + && disputes.equals(other.disputes) + && failureMessage.equals(other.failureMessage) + && financingInstallmentsCount.equals(other.financingInstallmentsCount) + && financingTransactions.equals(other.financingTransactions) + && id.equals(other.id) + && lastPaymentAttempt.equals(other.lastPaymentAttempt) + && member.equals(other.member) + && membership.equals(other.membership) + && metadata.equals(other.metadata) + && needsTracking.equals(other.needsTracking) + && nextPaymentAttempt.equals(other.nextPaymentAttempt) + && paidAt.equals(other.paidAt) + && paymentInstrument.equals(other.paymentInstrument) + && paymentMethod.equals(other.paymentMethod) + && paymentMethodType.equals(other.paymentMethodType) + && paymentsFailed.equals(other.paymentsFailed) + && plan.equals(other.plan) + && product.equals(other.product) + && promoCode.equals(other.promoCode) + && refundable == other.refundable + && refundedAmount.equals(other.refundedAmount) + && refundedAt.equals(other.refundedAt) + && refunds.equals(other.refunds) + && resolutions.equals(other.resolutions) + && retryable == other.retryable + && riskScore.equals(other.riskScore) + && riskSignals.equals(other.riskSignals) + && settlementAmount == other.settlementAmount + && settlementCurrency.equals(other.settlementCurrency) + && settlementExchangeRate.equals(other.settlementExchangeRate) + && settlementTimeAt.equals(other.settlementTimeAt) + && shipment.equals(other.shipment) + && shippingAddress.equals(other.shippingAddress) + && status.equals(other.status) + && substatus.equals(other.substatus) + && subtotal.equals(other.subtotal) + && taxAmount.equals(other.taxAmount) + && taxBehavior.equals(other.taxBehavior) + && taxRefundedAmount.equals(other.taxRefundedAmount) + && threeDsVerified == other.threeDsVerified + && total.equals(other.total) + && updatedAt.equals(other.updatedAt) + && usdTotal.equals(other.usdTotal) + && user.equals(other.user) + && verificationChecks.equals(other.verificationChecks) + && voidable == other.voidable + && clientSecret.equals(other.clientSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amountAfterFees, + this.applicationFee, + this.autoRefunded, + this.billingAddress, + this.billingReason, + this.cardBrand, + this.cardExpMonth, + this.cardExpYear, + this.cardLast4, + this.checkoutConfigurationId, + this.company, + this.createdAt, + this.currency, + this.customerPhone, + this.declineCode, + this.disputeAlertedAt, + this.disputes, + this.failureMessage, + this.financingInstallmentsCount, + this.financingTransactions, + this.id, + this.lastPaymentAttempt, + this.member, + this.membership, + this.metadata, + this.needsTracking, + this.nextPaymentAttempt, + this.paidAt, + this.paymentInstrument, + this.paymentMethod, + this.paymentMethodType, + this.paymentsFailed, + this.plan, + this.product, + this.promoCode, + this.refundable, + this.refundedAmount, + this.refundedAt, + this.refunds, + this.resolutions, + this.retryable, + this.riskScore, + this.riskSignals, + this.settlementAmount, + this.settlementCurrency, + this.settlementExchangeRate, + this.settlementTimeAt, + this.shipment, + this.shippingAddress, + this.status, + this.substatus, + this.subtotal, + this.taxAmount, + this.taxBehavior, + this.taxRefundedAmount, + this.threeDsVerified, + this.total, + this.updatedAt, + this.usdTotal, + this.user, + this.verificationChecks, + this.voidable, + this.clientSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountAfterFeesStage builder() { + return new Builder(); + } + + public interface AmountAfterFeesStage { + /** + *

How much the payment is for after fees

+ */ + AutoRefundedStage amountAfterFees(double amountAfterFees); + + Builder from(RetrievePaymentsResponse other); + } + + public interface AutoRefundedStage { + /** + *

Whether this payment was auto refunded or not

+ */ + CreatedAtStage autoRefunded(boolean autoRefunded); + } + + public interface CreatedAtStage { + /** + *

The datetime the payment was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ */ + IdStage currency(@NotNull Currencies currency); + } + + public interface IdStage { + /** + *

The unique identifier for the payment.

+ */ + RefundableStage id(@NotNull String id); + } + + public interface RefundableStage { + /** + *

True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds.

+ */ + RetryableStage refundable(boolean refundable); + } + + public interface RetryableStage { + /** + *

True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again.

+ */ + SettlementAmountStage retryable(boolean retryable); + } + + public interface SettlementAmountStage { + /** + *

The total amount charged to the customer for this payment, including taxes and after any discounts. In the currency specified by the currency field.

+ */ + SettlementCurrencyStage settlementAmount(double settlementAmount); + } + + public interface SettlementCurrencyStage { + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ */ + SubstatusStage settlementCurrency(@NotNull Currencies settlementCurrency); + } + + public interface SubstatusStage { + /** + *

The friendly status of the payment.

+ */ + ThreeDsVerifiedStage substatus(@NotNull FriendlyReceiptStatus substatus); + } + + public interface ThreeDsVerifiedStage { + /** + *

Whether 3D Secure authentication was completed for this payment.

+ */ + UpdatedAtStage threeDsVerified(boolean threeDsVerified); + } + + public interface UpdatedAtStage { + /** + *

The datetime the payment was last updated.

+ */ + VoidableStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface VoidableStage { + /** + *

True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false.

+ */ + _FinalStage voidable(boolean voidable); + } + + public interface _FinalStage { + RetrievePaymentsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The application fee charged on this payment.

+ */ + _FinalStage applicationFee(Optional applicationFee); + + _FinalStage applicationFee(PaymentApplicationFee applicationFee); + + _FinalStage applicationFee(Nullable applicationFee); + + /** + *

The address of the user who made the payment.

+ */ + _FinalStage billingAddress(Optional billingAddress); + + _FinalStage billingAddress(PaymentBillingAddress billingAddress); + + _FinalStage billingAddress(Nullable billingAddress); + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ */ + _FinalStage billingReason(Optional billingReason); + + _FinalStage billingReason(BillingReasons billingReason); + + _FinalStage billingReason(Nullable billingReason); + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ */ + _FinalStage cardBrand(Optional cardBrand); + + _FinalStage cardBrand(CardBrands cardBrand); + + _FinalStage cardBrand(Nullable cardBrand); + + /** + *

The expiration month (1-12) of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ */ + _FinalStage cardExpMonth(Optional cardExpMonth); + + _FinalStage cardExpMonth(Integer cardExpMonth); + + _FinalStage cardExpMonth(Nullable cardExpMonth); + + /** + *

The four-digit expiration year of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ */ + _FinalStage cardExpYear(Optional cardExpYear); + + _FinalStage cardExpYear(Integer cardExpYear); + + _FinalStage cardExpYear(Nullable cardExpYear); + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ */ + _FinalStage cardLast4(Optional cardLast4); + + _FinalStage cardLast4(String cardLast4); + + _FinalStage cardLast4(Nullable cardLast4); + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ */ + _FinalStage checkoutConfigurationId(Optional checkoutConfigurationId); + + _FinalStage checkoutConfigurationId(String checkoutConfigurationId); + + _FinalStage checkoutConfigurationId(Nullable checkoutConfigurationId); + + /** + *

The company for the payment.

+ */ + _FinalStage company(Optional company); + + _FinalStage company(PaymentCompany company); + + _FinalStage company(Nullable company); + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ */ + _FinalStage customerPhone(Optional customerPhone); + + _FinalStage customerPhone(String customerPhone); + + _FinalStage customerPhone(Nullable customerPhone); + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ */ + _FinalStage declineCode(Optional declineCode); + + _FinalStage declineCode(PaymentDeclineCodes declineCode); + + _FinalStage declineCode(Nullable declineCode); + + /** + *

When an alert came in that this transaction will be disputed

+ */ + _FinalStage disputeAlertedAt(Optional disputeAlertedAt); + + _FinalStage disputeAlertedAt(OffsetDateTime disputeAlertedAt); + + _FinalStage disputeAlertedAt(Nullable disputeAlertedAt); + + /** + *

The disputes attached to this payment. Null if the actor in context does not have the payment:dispute:read permission.

+ */ + _FinalStage disputes(Optional> disputes); + + _FinalStage disputes(List disputes); + + _FinalStage disputes(Nullable> disputes); + + /** + *

If the payment failed, the reason for the failure.

+ */ + _FinalStage failureMessage(Optional failureMessage); + + _FinalStage failureMessage(String failureMessage); + + _FinalStage failureMessage(Nullable failureMessage); + + /** + *

The number of financing installments for the payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ */ + _FinalStage financingInstallmentsCount(Optional financingInstallmentsCount); + + _FinalStage financingInstallmentsCount(Integer financingInstallmentsCount); + + _FinalStage financingInstallmentsCount(Nullable financingInstallmentsCount); + + /** + *

The financing transactions attached to this payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ */ + _FinalStage financingTransactions(List financingTransactions); + + _FinalStage addFinancingTransactions(PaymentFinancingTransactionsItem financingTransactions); + + _FinalStage addAllFinancingTransactions(List financingTransactions); + + /** + *

The time of the last payment attempt.

+ */ + _FinalStage lastPaymentAttempt(Optional lastPaymentAttempt); + + _FinalStage lastPaymentAttempt(OffsetDateTime lastPaymentAttempt); + + _FinalStage lastPaymentAttempt(Nullable lastPaymentAttempt); + + /** + *

The member attached to this payment.

+ */ + _FinalStage member(Optional member); + + _FinalStage member(PaymentMember member); + + _FinalStage member(Nullable member); + + /** + *

The membership attached to this payment.

+ */ + _FinalStage membership(Optional membership); + + _FinalStage membership(PaymentMembership membership); + + _FinalStage membership(Nullable membership); + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ */ + _FinalStage needsTracking(Optional needsTracking); + + _FinalStage needsTracking(Boolean needsTracking); + + _FinalStage needsTracking(Nullable needsTracking); + + /** + *

The time of the next schedule payment retry.

+ */ + _FinalStage nextPaymentAttempt(Optional nextPaymentAttempt); + + _FinalStage nextPaymentAttempt(OffsetDateTime nextPaymentAttempt); + + _FinalStage nextPaymentAttempt(Nullable nextPaymentAttempt); + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ */ + _FinalStage paidAt(Optional paidAt); + + _FinalStage paidAt(OffsetDateTime paidAt); + + _FinalStage paidAt(Nullable paidAt); + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ */ + _FinalStage paymentInstrument(Optional paymentInstrument); + + _FinalStage paymentInstrument(PaymentPaymentInstrument paymentInstrument); + + _FinalStage paymentInstrument(Nullable paymentInstrument); + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ */ + _FinalStage paymentMethod(Optional paymentMethod); + + _FinalStage paymentMethod(PaymentPaymentMethod paymentMethod); + + _FinalStage paymentMethod(Nullable paymentMethod); + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ */ + _FinalStage paymentMethodType(Optional paymentMethodType); + + _FinalStage paymentMethodType(PaymentMethodTypes paymentMethodType); + + _FinalStage paymentMethodType(Nullable paymentMethodType); + + /** + *

The number of failed payment attempts for the payment.

+ */ + _FinalStage paymentsFailed(Optional paymentsFailed); + + _FinalStage paymentsFailed(Integer paymentsFailed); + + _FinalStage paymentsFailed(Nullable paymentsFailed); + + /** + *

The plan attached to this payment.

+ */ + _FinalStage plan(Optional plan); + + _FinalStage plan(PaymentPlan plan); + + _FinalStage plan(Nullable plan); + + /** + *

The product this payment was made for

+ */ + _FinalStage product(Optional product); + + _FinalStage product(PaymentProduct product); + + _FinalStage product(Nullable product); + + /** + *

The promo code used for this payment.

+ */ + _FinalStage promoCode(Optional promoCode); + + _FinalStage promoCode(PaymentPromoCode promoCode); + + _FinalStage promoCode(Nullable promoCode); + + /** + *

The payment refund amount(if applicable).

+ */ + _FinalStage refundedAmount(Optional refundedAmount); + + _FinalStage refundedAmount(Double refundedAmount); + + _FinalStage refundedAmount(Nullable refundedAmount); + + /** + *

When the payment was refunded (if applicable).

+ */ + _FinalStage refundedAt(Optional refundedAt); + + _FinalStage refundedAt(OffsetDateTime refundedAt); + + _FinalStage refundedAt(Nullable refundedAt); + + /** + *

The refunds issued against this payment, newest first, including failed and canceled refund attempts. Limited to the 100 most recent.

+ */ + _FinalStage refunds(List refunds); + + _FinalStage addRefunds(PaymentRefundsItem refunds); + + _FinalStage addAllRefunds(List refunds); + + /** + *

The resolution center cases opened by the customer on this payment. Null if the actor in context does not have the payment:resolution_center_case:read permission.

+ */ + _FinalStage resolutions(Optional> resolutions); + + _FinalStage resolutions(List resolutions); + + _FinalStage resolutions(Nullable> resolutions); + + /** + *

Whop's in-house fraud risk score for this payment, from 0 (lowest risk) to 100 (highest risk). Null when the payment has not been scored or scoring has not yet completed.

+ */ + _FinalStage riskScore(Optional riskScore); + + _FinalStage riskScore(Integer riskScore); + + _FinalStage riskScore(Nullable riskScore); + + /** + *

A curated set of factors behind the risk score, grouped by category (business transaction history, buyer, device). Each entry has a key, human-readable label, category, and value. Null when there is no risk assessment for this payment.

+ */ + _FinalStage riskSignals(Optional> riskSignals); + + _FinalStage riskSignals(Map riskSignals); + + _FinalStage riskSignals(Nullable> riskSignals); + + /** + *

Deprecated. Always returns null.

+ */ + _FinalStage settlementExchangeRate(Optional settlementExchangeRate); + + _FinalStage settlementExchangeRate(Double settlementExchangeRate); + + _FinalStage settlementExchangeRate(Nullable settlementExchangeRate); + + /** + *

When this payment's funds post to the company's available balance, at midnight UTC. Known at payment time and never changes. The ledger_account.funds_available webhook carries the same settlement_time_at when that batch posts — match them to know these funds are now withdrawable.

+ */ + _FinalStage settlementTimeAt(Optional settlementTimeAt); + + _FinalStage settlementTimeAt(OffsetDateTime settlementTimeAt); + + _FinalStage settlementTimeAt(Nullable settlementTimeAt); + + /** + *

The shipment attached to this payment.

+ */ + _FinalStage shipment(Optional shipment); + + _FinalStage shipment(PaymentShipment shipment); + + _FinalStage shipment(Nullable shipment); + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ */ + _FinalStage shippingAddress(Optional shippingAddress); + + _FinalStage shippingAddress(PaymentShippingAddress shippingAddress); + + _FinalStage shippingAddress(Nullable shippingAddress); + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ */ + _FinalStage status(Optional status); + + _FinalStage status(ReceiptStatus status); + + _FinalStage status(Nullable status); + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ */ + _FinalStage subtotal(Optional subtotal); + + _FinalStage subtotal(Double subtotal); + + _FinalStage subtotal(Nullable subtotal); + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ */ + _FinalStage taxAmount(Optional taxAmount); + + _FinalStage taxAmount(Double taxAmount); + + _FinalStage taxAmount(Nullable taxAmount); + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ */ + _FinalStage taxBehavior(Optional taxBehavior); + + _FinalStage taxBehavior(ReceiptTaxBehaviors taxBehavior); + + _FinalStage taxBehavior(Nullable taxBehavior); + + /** + *

The amount of tax that has been refunded (if applicable).

+ */ + _FinalStage taxRefundedAmount(Optional taxRefundedAmount); + + _FinalStage taxRefundedAmount(Double taxRefundedAmount); + + _FinalStage taxRefundedAmount(Nullable taxRefundedAmount); + + /** + *

The total to show to the creator (excluding buyer fees).

+ */ + _FinalStage total(Optional total); + + _FinalStage total(Double total); + + _FinalStage total(Nullable total); + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ */ + _FinalStage usdTotal(Optional usdTotal); + + _FinalStage usdTotal(Double usdTotal); + + _FinalStage usdTotal(Nullable usdTotal); + + /** + *

The user that made this payment.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(PaymentUser user); + + _FinalStage user(Nullable user); + + /** + *

The issuer's address and card security code check results for this payment. Null when the processor returned none.

+ */ + _FinalStage verificationChecks(Optional verificationChecks); + + _FinalStage verificationChecks(PaymentVerificationChecks verificationChecks); + + _FinalStage verificationChecks(Nullable verificationChecks); + + /** + *

The credential the buyer's surface presents to poll this payment and set its return URL. Returned when a payment created from a confirmation token is created or retrieved by a caller with the payment:charge permission. Null for payments created from a stored payment method or callers without payment:charge. It unlocks this payment and nothing else; treat it like a password for that one attempt.

+ */ + _FinalStage clientSecret(Optional clientSecret); + + _FinalStage clientSecret(String clientSecret); + + _FinalStage clientSecret(Nullable clientSecret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountAfterFeesStage, + AutoRefundedStage, + CreatedAtStage, + CurrencyStage, + IdStage, + RefundableStage, + RetryableStage, + SettlementAmountStage, + SettlementCurrencyStage, + SubstatusStage, + ThreeDsVerifiedStage, + UpdatedAtStage, + VoidableStage, + _FinalStage { + private double amountAfterFees; + + private boolean autoRefunded; + + private OffsetDateTime createdAt; + + private Currencies currency; + + private String id; + + private boolean refundable; + + private boolean retryable; + + private double settlementAmount; + + private Currencies settlementCurrency; + + private FriendlyReceiptStatus substatus; + + private boolean threeDsVerified; + + private OffsetDateTime updatedAt; + + private boolean voidable; + + private Optional clientSecret = Optional.empty(); + + private Optional verificationChecks = Optional.empty(); + + private Optional user = Optional.empty(); + + private Optional usdTotal = Optional.empty(); + + private Optional total = Optional.empty(); + + private Optional taxRefundedAmount = Optional.empty(); + + private Optional taxBehavior = Optional.empty(); + + private Optional taxAmount = Optional.empty(); + + private Optional subtotal = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional shippingAddress = Optional.empty(); + + private Optional shipment = Optional.empty(); + + private Optional settlementTimeAt = Optional.empty(); + + private Optional settlementExchangeRate = Optional.empty(); + + private Optional> riskSignals = Optional.empty(); + + private Optional riskScore = Optional.empty(); + + private Optional> resolutions = Optional.empty(); + + private List refunds = new ArrayList<>(); + + private Optional refundedAt = Optional.empty(); + + private Optional refundedAmount = Optional.empty(); + + private Optional promoCode = Optional.empty(); + + private Optional product = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional paymentsFailed = Optional.empty(); + + private Optional paymentMethodType = Optional.empty(); + + private Optional paymentMethod = Optional.empty(); + + private Optional paymentInstrument = Optional.empty(); + + private Optional paidAt = Optional.empty(); + + private Optional nextPaymentAttempt = Optional.empty(); + + private Optional needsTracking = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional membership = Optional.empty(); + + private Optional member = Optional.empty(); + + private Optional lastPaymentAttempt = Optional.empty(); + + private List financingTransactions = new ArrayList<>(); + + private Optional financingInstallmentsCount = Optional.empty(); + + private Optional failureMessage = Optional.empty(); + + private Optional> disputes = Optional.empty(); + + private Optional disputeAlertedAt = Optional.empty(); + + private Optional declineCode = Optional.empty(); + + private Optional customerPhone = Optional.empty(); + + private Optional company = Optional.empty(); + + private Optional checkoutConfigurationId = Optional.empty(); + + private Optional cardLast4 = Optional.empty(); + + private Optional cardExpYear = Optional.empty(); + + private Optional cardExpMonth = Optional.empty(); + + private Optional cardBrand = Optional.empty(); + + private Optional billingReason = Optional.empty(); + + private Optional billingAddress = Optional.empty(); + + private Optional applicationFee = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePaymentsResponse other) { + amountAfterFees(other.getAmountAfterFees()); + applicationFee(other.getApplicationFee()); + autoRefunded(other.getAutoRefunded()); + billingAddress(other.getBillingAddress()); + billingReason(other.getBillingReason()); + cardBrand(other.getCardBrand()); + cardExpMonth(other.getCardExpMonth()); + cardExpYear(other.getCardExpYear()); + cardLast4(other.getCardLast4()); + checkoutConfigurationId(other.getCheckoutConfigurationId()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + customerPhone(other.getCustomerPhone()); + declineCode(other.getDeclineCode()); + disputeAlertedAt(other.getDisputeAlertedAt()); + disputes(other.getDisputes()); + failureMessage(other.getFailureMessage()); + financingInstallmentsCount(other.getFinancingInstallmentsCount()); + financingTransactions(other.getFinancingTransactions()); + id(other.getId()); + lastPaymentAttempt(other.getLastPaymentAttempt()); + member(other.getMember()); + membership(other.getMembership()); + metadata(other.getMetadata()); + needsTracking(other.getNeedsTracking()); + nextPaymentAttempt(other.getNextPaymentAttempt()); + paidAt(other.getPaidAt()); + paymentInstrument(other.getPaymentInstrument()); + paymentMethod(other.getPaymentMethod()); + paymentMethodType(other.getPaymentMethodType()); + paymentsFailed(other.getPaymentsFailed()); + plan(other.getPlan()); + product(other.getProduct()); + promoCode(other.getPromoCode()); + refundable(other.getRefundable()); + refundedAmount(other.getRefundedAmount()); + refundedAt(other.getRefundedAt()); + refunds(other.getRefunds()); + resolutions(other.getResolutions()); + retryable(other.getRetryable()); + riskScore(other.getRiskScore()); + riskSignals(other.getRiskSignals()); + settlementAmount(other.getSettlementAmount()); + settlementCurrency(other.getSettlementCurrency()); + settlementExchangeRate(other.getSettlementExchangeRate()); + settlementTimeAt(other.getSettlementTimeAt()); + shipment(other.getShipment()); + shippingAddress(other.getShippingAddress()); + status(other.getStatus()); + substatus(other.getSubstatus()); + subtotal(other.getSubtotal()); + taxAmount(other.getTaxAmount()); + taxBehavior(other.getTaxBehavior()); + taxRefundedAmount(other.getTaxRefundedAmount()); + threeDsVerified(other.getThreeDsVerified()); + total(other.getTotal()); + updatedAt(other.getUpdatedAt()); + usdTotal(other.getUsdTotal()); + user(other.getUser()); + verificationChecks(other.getVerificationChecks()); + voidable(other.getVoidable()); + clientSecret(other.getClientSecret()); + return this; + } + + /** + *

How much the payment is for after fees

+ *

How much the payment is for after fees

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount_after_fees") + public AutoRefundedStage amountAfterFees(double amountAfterFees) { + this.amountAfterFees = amountAfterFees; + return this; + } + + /** + *

Whether this payment was auto refunded or not

+ *

Whether this payment was auto refunded or not

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("auto_refunded") + public CreatedAtStage autoRefunded(boolean autoRefunded) { + this.autoRefunded = autoRefunded; + return this; + } + + /** + *

The datetime the payment was created.

+ *

The datetime the payment was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier for the payment.

+ *

The unique identifier for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RefundableStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds.

+ *

True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("refundable") + public RetryableStage refundable(boolean refundable) { + this.refundable = refundable; + return this; + } + + /** + *

True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again.

+ *

True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("retryable") + public SettlementAmountStage retryable(boolean retryable) { + this.retryable = retryable; + return this; + } + + /** + *

The total amount charged to the customer for this payment, including taxes and after any discounts. In the currency specified by the currency field.

+ *

The total amount charged to the customer for this payment, including taxes and after any discounts. In the currency specified by the currency field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("settlement_amount") + public SettlementCurrencyStage settlementAmount(double settlementAmount) { + this.settlementAmount = settlementAmount; + return this; + } + + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("settlement_currency") + public SubstatusStage settlementCurrency(@NotNull Currencies settlementCurrency) { + this.settlementCurrency = Objects.requireNonNull(settlementCurrency, "settlementCurrency must not be null"); + return this; + } + + /** + *

The friendly status of the payment.

+ *

The friendly status of the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("substatus") + public ThreeDsVerifiedStage substatus(@NotNull FriendlyReceiptStatus substatus) { + this.substatus = Objects.requireNonNull(substatus, "substatus must not be null"); + return this; + } + + /** + *

Whether 3D Secure authentication was completed for this payment.

+ *

Whether 3D Secure authentication was completed for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("three_ds_verified") + public UpdatedAtStage threeDsVerified(boolean threeDsVerified) { + this.threeDsVerified = threeDsVerified; + return this; + } + + /** + *

The datetime the payment was last updated.

+ *

The datetime the payment was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public VoidableStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false.

+ *

True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("voidable") + public _FinalStage voidable(boolean voidable) { + this.voidable = voidable; + return this; + } + + /** + *

The credential the buyer's surface presents to poll this payment and set its return URL. Returned when a payment created from a confirmation token is created or retrieved by a caller with the payment:charge permission. Null for payments created from a stored payment method or callers without payment:charge. It unlocks this payment and nothing else; treat it like a password for that one attempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage clientSecret(Nullable clientSecret) { + if (clientSecret.isNull()) { + this.clientSecret = null; + } else if (clientSecret.isEmpty()) { + this.clientSecret = Optional.empty(); + } else { + this.clientSecret = Optional.of(clientSecret.get()); + } + return this; + } + + /** + *

The credential the buyer's surface presents to poll this payment and set its return URL. Returned when a payment created from a confirmation token is created or retrieved by a caller with the payment:charge permission. Null for payments created from a stored payment method or callers without payment:charge. It unlocks this payment and nothing else; treat it like a password for that one attempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage clientSecret(String clientSecret) { + this.clientSecret = Optional.ofNullable(clientSecret); + return this; + } + + /** + *

The credential the buyer's surface presents to poll this payment and set its return URL. Returned when a payment created from a confirmation token is created or retrieved by a caller with the payment:charge permission. Null for payments created from a stored payment method or callers without payment:charge. It unlocks this payment and nothing else; treat it like a password for that one attempt.

+ */ + @java.lang.Override + @JsonSetter(value = "client_secret", nulls = Nulls.SKIP) + public _FinalStage clientSecret(Optional clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + *

The issuer's address and card security code check results for this payment. Null when the processor returned none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage verificationChecks(Nullable verificationChecks) { + if (verificationChecks.isNull()) { + this.verificationChecks = null; + } else if (verificationChecks.isEmpty()) { + this.verificationChecks = Optional.empty(); + } else { + this.verificationChecks = Optional.of(verificationChecks.get()); + } + return this; + } + + /** + *

The issuer's address and card security code check results for this payment. Null when the processor returned none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage verificationChecks(PaymentVerificationChecks verificationChecks) { + this.verificationChecks = Optional.ofNullable(verificationChecks); + return this; + } + + /** + *

The issuer's address and card security code check results for this payment. Null when the processor returned none.

+ */ + @java.lang.Override + @JsonSetter(value = "verification_checks", nulls = Nulls.SKIP) + public _FinalStage verificationChecks(Optional verificationChecks) { + this.verificationChecks = verificationChecks; + return this; + } + + /** + *

The user that made this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The user that made this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(PaymentUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The user that made this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdTotal(Nullable usdTotal) { + if (usdTotal.isNull()) { + this.usdTotal = null; + } else if (usdTotal.isEmpty()) { + this.usdTotal = Optional.empty(); + } else { + this.usdTotal = Optional.of(usdTotal.get()); + } + return this; + } + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdTotal(Double usdTotal) { + this.usdTotal = Optional.ofNullable(usdTotal); + return this; + } + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "usd_total", nulls = Nulls.SKIP) + public _FinalStage usdTotal(Optional usdTotal) { + this.usdTotal = usdTotal; + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage total(Nullable total) { + if (total.isNull()) { + this.total = null; + } else if (total.isEmpty()) { + this.total = Optional.empty(); + } else { + this.total = Optional.of(total.get()); + } + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage total(Double total) { + this.total = Optional.ofNullable(total); + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "total", nulls = Nulls.SKIP) + public _FinalStage total(Optional total) { + this.total = total; + return this; + } + + /** + *

The amount of tax that has been refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxRefundedAmount(Nullable taxRefundedAmount) { + if (taxRefundedAmount.isNull()) { + this.taxRefundedAmount = null; + } else if (taxRefundedAmount.isEmpty()) { + this.taxRefundedAmount = Optional.empty(); + } else { + this.taxRefundedAmount = Optional.of(taxRefundedAmount.get()); + } + return this; + } + + /** + *

The amount of tax that has been refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxRefundedAmount(Double taxRefundedAmount) { + this.taxRefundedAmount = Optional.ofNullable(taxRefundedAmount); + return this; + } + + /** + *

The amount of tax that has been refunded (if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "tax_refunded_amount", nulls = Nulls.SKIP) + public _FinalStage taxRefundedAmount(Optional taxRefundedAmount) { + this.taxRefundedAmount = taxRefundedAmount; + return this; + } + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxBehavior(Nullable taxBehavior) { + if (taxBehavior.isNull()) { + this.taxBehavior = null; + } else if (taxBehavior.isEmpty()) { + this.taxBehavior = Optional.empty(); + } else { + this.taxBehavior = Optional.of(taxBehavior.get()); + } + return this; + } + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxBehavior(ReceiptTaxBehaviors taxBehavior) { + this.taxBehavior = Optional.ofNullable(taxBehavior); + return this; + } + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ */ + @java.lang.Override + @JsonSetter(value = "tax_behavior", nulls = Nulls.SKIP) + public _FinalStage taxBehavior(Optional taxBehavior) { + this.taxBehavior = taxBehavior; + return this; + } + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxAmount(Nullable taxAmount) { + if (taxAmount.isNull()) { + this.taxAmount = null; + } else if (taxAmount.isEmpty()) { + this.taxAmount = Optional.empty(); + } else { + this.taxAmount = Optional.of(taxAmount.get()); + } + return this; + } + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxAmount(Double taxAmount) { + this.taxAmount = Optional.ofNullable(taxAmount); + return this; + } + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "tax_amount", nulls = Nulls.SKIP) + public _FinalStage taxAmount(Optional taxAmount) { + this.taxAmount = taxAmount; + return this; + } + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subtotal(Nullable subtotal) { + if (subtotal.isNull()) { + this.subtotal = null; + } else if (subtotal.isEmpty()) { + this.subtotal = Optional.empty(); + } else { + this.subtotal = Optional.of(subtotal.get()); + } + return this; + } + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subtotal(Double subtotal) { + this.subtotal = Optional.ofNullable(subtotal); + return this; + } + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "subtotal", nulls = Nulls.SKIP) + public _FinalStage subtotal(Optional subtotal) { + this.subtotal = subtotal; + return this; + } + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(ReceiptStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shippingAddress(Nullable shippingAddress) { + if (shippingAddress.isNull()) { + this.shippingAddress = null; + } else if (shippingAddress.isEmpty()) { + this.shippingAddress = Optional.empty(); + } else { + this.shippingAddress = Optional.of(shippingAddress.get()); + } + return this; + } + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shippingAddress(PaymentShippingAddress shippingAddress) { + this.shippingAddress = Optional.ofNullable(shippingAddress); + return this; + } + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ */ + @java.lang.Override + @JsonSetter(value = "shipping_address", nulls = Nulls.SKIP) + public _FinalStage shippingAddress(Optional shippingAddress) { + this.shippingAddress = shippingAddress; + return this; + } + + /** + *

The shipment attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shipment(Nullable shipment) { + if (shipment.isNull()) { + this.shipment = null; + } else if (shipment.isEmpty()) { + this.shipment = Optional.empty(); + } else { + this.shipment = Optional.of(shipment.get()); + } + return this; + } + + /** + *

The shipment attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shipment(PaymentShipment shipment) { + this.shipment = Optional.ofNullable(shipment); + return this; + } + + /** + *

The shipment attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "shipment", nulls = Nulls.SKIP) + public _FinalStage shipment(Optional shipment) { + this.shipment = shipment; + return this; + } + + /** + *

When this payment's funds post to the company's available balance, at midnight UTC. Known at payment time and never changes. The ledger_account.funds_available webhook carries the same settlement_time_at when that batch posts — match them to know these funds are now withdrawable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage settlementTimeAt(Nullable settlementTimeAt) { + if (settlementTimeAt.isNull()) { + this.settlementTimeAt = null; + } else if (settlementTimeAt.isEmpty()) { + this.settlementTimeAt = Optional.empty(); + } else { + this.settlementTimeAt = Optional.of(settlementTimeAt.get()); + } + return this; + } + + /** + *

When this payment's funds post to the company's available balance, at midnight UTC. Known at payment time and never changes. The ledger_account.funds_available webhook carries the same settlement_time_at when that batch posts — match them to know these funds are now withdrawable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage settlementTimeAt(OffsetDateTime settlementTimeAt) { + this.settlementTimeAt = Optional.ofNullable(settlementTimeAt); + return this; + } + + /** + *

When this payment's funds post to the company's available balance, at midnight UTC. Known at payment time and never changes. The ledger_account.funds_available webhook carries the same settlement_time_at when that batch posts — match them to know these funds are now withdrawable.

+ */ + @java.lang.Override + @JsonSetter(value = "settlement_time_at", nulls = Nulls.SKIP) + public _FinalStage settlementTimeAt(Optional settlementTimeAt) { + this.settlementTimeAt = settlementTimeAt; + return this; + } + + /** + *

Deprecated. Always returns null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage settlementExchangeRate(Nullable settlementExchangeRate) { + if (settlementExchangeRate.isNull()) { + this.settlementExchangeRate = null; + } else if (settlementExchangeRate.isEmpty()) { + this.settlementExchangeRate = Optional.empty(); + } else { + this.settlementExchangeRate = Optional.of(settlementExchangeRate.get()); + } + return this; + } + + /** + *

Deprecated. Always returns null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage settlementExchangeRate(Double settlementExchangeRate) { + this.settlementExchangeRate = Optional.ofNullable(settlementExchangeRate); + return this; + } + + /** + *

Deprecated. Always returns null.

+ */ + @java.lang.Override + @JsonSetter(value = "settlement_exchange_rate", nulls = Nulls.SKIP) + public _FinalStage settlementExchangeRate(Optional settlementExchangeRate) { + this.settlementExchangeRate = settlementExchangeRate; + return this; + } + + /** + *

A curated set of factors behind the risk score, grouped by category (business transaction history, buyer, device). Each entry has a key, human-readable label, category, and value. Null when there is no risk assessment for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage riskSignals(Nullable> riskSignals) { + if (riskSignals.isNull()) { + this.riskSignals = null; + } else if (riskSignals.isEmpty()) { + this.riskSignals = Optional.empty(); + } else { + this.riskSignals = Optional.of(riskSignals.get()); + } + return this; + } + + /** + *

A curated set of factors behind the risk score, grouped by category (business transaction history, buyer, device). Each entry has a key, human-readable label, category, and value. Null when there is no risk assessment for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage riskSignals(Map riskSignals) { + this.riskSignals = Optional.ofNullable(riskSignals); + return this; + } + + /** + *

A curated set of factors behind the risk score, grouped by category (business transaction history, buyer, device). Each entry has a key, human-readable label, category, and value. Null when there is no risk assessment for this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "risk_signals", nulls = Nulls.SKIP) + public _FinalStage riskSignals(Optional> riskSignals) { + this.riskSignals = riskSignals; + return this; + } + + /** + *

Whop's in-house fraud risk score for this payment, from 0 (lowest risk) to 100 (highest risk). Null when the payment has not been scored or scoring has not yet completed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage riskScore(Nullable riskScore) { + if (riskScore.isNull()) { + this.riskScore = null; + } else if (riskScore.isEmpty()) { + this.riskScore = Optional.empty(); + } else { + this.riskScore = Optional.of(riskScore.get()); + } + return this; + } + + /** + *

Whop's in-house fraud risk score for this payment, from 0 (lowest risk) to 100 (highest risk). Null when the payment has not been scored or scoring has not yet completed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage riskScore(Integer riskScore) { + this.riskScore = Optional.ofNullable(riskScore); + return this; + } + + /** + *

Whop's in-house fraud risk score for this payment, from 0 (lowest risk) to 100 (highest risk). Null when the payment has not been scored or scoring has not yet completed.

+ */ + @java.lang.Override + @JsonSetter(value = "risk_score", nulls = Nulls.SKIP) + public _FinalStage riskScore(Optional riskScore) { + this.riskScore = riskScore; + return this; + } + + /** + *

The resolution center cases opened by the customer on this payment. Null if the actor in context does not have the payment:resolution_center_case:read permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolutions(Nullable> resolutions) { + if (resolutions.isNull()) { + this.resolutions = null; + } else if (resolutions.isEmpty()) { + this.resolutions = Optional.empty(); + } else { + this.resolutions = Optional.of(resolutions.get()); + } + return this; + } + + /** + *

The resolution center cases opened by the customer on this payment. Null if the actor in context does not have the payment:resolution_center_case:read permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolutions(List resolutions) { + this.resolutions = Optional.ofNullable(resolutions); + return this; + } + + /** + *

The resolution center cases opened by the customer on this payment. Null if the actor in context does not have the payment:resolution_center_case:read permission.

+ */ + @java.lang.Override + @JsonSetter(value = "resolutions", nulls = Nulls.SKIP) + public _FinalStage resolutions(Optional> resolutions) { + this.resolutions = resolutions; + return this; + } + + /** + *

The refunds issued against this payment, newest first, including failed and canceled refund attempts. Limited to the 100 most recent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllRefunds(List refunds) { + if (refunds != null) { + this.refunds.addAll(refunds); + } + return this; + } + + /** + *

The refunds issued against this payment, newest first, including failed and canceled refund attempts. Limited to the 100 most recent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addRefunds(PaymentRefundsItem refunds) { + this.refunds.add(refunds); + return this; + } + + /** + *

The refunds issued against this payment, newest first, including failed and canceled refund attempts. Limited to the 100 most recent.

+ */ + @java.lang.Override + @JsonSetter(value = "refunds", nulls = Nulls.SKIP) + public _FinalStage refunds(List refunds) { + this.refunds.clear(); + if (refunds != null) { + this.refunds.addAll(refunds); + } + return this; + } + + /** + *

When the payment was refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAt(Nullable refundedAt) { + if (refundedAt.isNull()) { + this.refundedAt = null; + } else if (refundedAt.isEmpty()) { + this.refundedAt = Optional.empty(); + } else { + this.refundedAt = Optional.of(refundedAt.get()); + } + return this; + } + + /** + *

When the payment was refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAt(OffsetDateTime refundedAt) { + this.refundedAt = Optional.ofNullable(refundedAt); + return this; + } + + /** + *

When the payment was refunded (if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "refunded_at", nulls = Nulls.SKIP) + public _FinalStage refundedAt(Optional refundedAt) { + this.refundedAt = refundedAt; + return this; + } + + /** + *

The payment refund amount(if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAmount(Nullable refundedAmount) { + if (refundedAmount.isNull()) { + this.refundedAmount = null; + } else if (refundedAmount.isEmpty()) { + this.refundedAmount = Optional.empty(); + } else { + this.refundedAmount = Optional.of(refundedAmount.get()); + } + return this; + } + + /** + *

The payment refund amount(if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAmount(Double refundedAmount) { + this.refundedAmount = Optional.ofNullable(refundedAmount); + return this; + } + + /** + *

The payment refund amount(if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "refunded_amount", nulls = Nulls.SKIP) + public _FinalStage refundedAmount(Optional refundedAmount) { + this.refundedAmount = refundedAmount; + return this; + } + + /** + *

The promo code used for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCode(Nullable promoCode) { + if (promoCode.isNull()) { + this.promoCode = null; + } else if (promoCode.isEmpty()) { + this.promoCode = Optional.empty(); + } else { + this.promoCode = Optional.of(promoCode.get()); + } + return this; + } + + /** + *

The promo code used for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCode(PaymentPromoCode promoCode) { + this.promoCode = Optional.ofNullable(promoCode); + return this; + } + + /** + *

The promo code used for this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "promo_code", nulls = Nulls.SKIP) + public _FinalStage promoCode(Optional promoCode) { + this.promoCode = promoCode; + return this; + } + + /** + *

The product this payment was made for

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

The product this payment was made for

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(PaymentProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

The product this payment was made for

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

The plan attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + /** + *

The plan attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(PaymentPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + /** + *

The plan attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + + /** + *

The number of failed payment attempts for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentsFailed(Nullable paymentsFailed) { + if (paymentsFailed.isNull()) { + this.paymentsFailed = null; + } else if (paymentsFailed.isEmpty()) { + this.paymentsFailed = Optional.empty(); + } else { + this.paymentsFailed = Optional.of(paymentsFailed.get()); + } + return this; + } + + /** + *

The number of failed payment attempts for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentsFailed(Integer paymentsFailed) { + this.paymentsFailed = Optional.ofNullable(paymentsFailed); + return this; + } + + /** + *

The number of failed payment attempts for the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "payments_failed", nulls = Nulls.SKIP) + public _FinalStage paymentsFailed(Optional paymentsFailed) { + this.paymentsFailed = paymentsFailed; + return this; + } + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(Nullable paymentMethodType) { + if (paymentMethodType.isNull()) { + this.paymentMethodType = null; + } else if (paymentMethodType.isEmpty()) { + this.paymentMethodType = Optional.empty(); + } else { + this.paymentMethodType = Optional.of(paymentMethodType.get()); + } + return this; + } + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Optional.ofNullable(paymentMethodType); + return this; + } + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_type", nulls = Nulls.SKIP) + public _FinalStage paymentMethodType(Optional paymentMethodType) { + this.paymentMethodType = paymentMethodType; + return this; + } + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethod(Nullable paymentMethod) { + if (paymentMethod.isNull()) { + this.paymentMethod = null; + } else if (paymentMethod.isEmpty()) { + this.paymentMethod = Optional.empty(); + } else { + this.paymentMethod = Optional.of(paymentMethod.get()); + } + return this; + } + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethod(PaymentPaymentMethod paymentMethod) { + this.paymentMethod = Optional.ofNullable(paymentMethod); + return this; + } + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method", nulls = Nulls.SKIP) + public _FinalStage paymentMethod(Optional paymentMethod) { + this.paymentMethod = paymentMethod; + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentInstrument(Nullable paymentInstrument) { + if (paymentInstrument.isNull()) { + this.paymentInstrument = null; + } else if (paymentInstrument.isEmpty()) { + this.paymentInstrument = Optional.empty(); + } else { + this.paymentInstrument = Optional.of(paymentInstrument.get()); + } + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentInstrument(PaymentPaymentInstrument paymentInstrument) { + this.paymentInstrument = Optional.ofNullable(paymentInstrument); + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_instrument", nulls = Nulls.SKIP) + public _FinalStage paymentInstrument(Optional paymentInstrument) { + this.paymentInstrument = paymentInstrument; + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidAt(Nullable paidAt) { + if (paidAt.isNull()) { + this.paidAt = null; + } else if (paidAt.isEmpty()) { + this.paidAt = Optional.empty(); + } else { + this.paidAt = Optional.of(paidAt.get()); + } + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidAt(OffsetDateTime paidAt) { + this.paidAt = Optional.ofNullable(paidAt); + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "paid_at", nulls = Nulls.SKIP) + public _FinalStage paidAt(Optional paidAt) { + this.paidAt = paidAt; + return this; + } + + /** + *

The time of the next schedule payment retry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nextPaymentAttempt(Nullable nextPaymentAttempt) { + if (nextPaymentAttempt.isNull()) { + this.nextPaymentAttempt = null; + } else if (nextPaymentAttempt.isEmpty()) { + this.nextPaymentAttempt = Optional.empty(); + } else { + this.nextPaymentAttempt = Optional.of(nextPaymentAttempt.get()); + } + return this; + } + + /** + *

The time of the next schedule payment retry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nextPaymentAttempt(OffsetDateTime nextPaymentAttempt) { + this.nextPaymentAttempt = Optional.ofNullable(nextPaymentAttempt); + return this; + } + + /** + *

The time of the next schedule payment retry.

+ */ + @java.lang.Override + @JsonSetter(value = "next_payment_attempt", nulls = Nulls.SKIP) + public _FinalStage nextPaymentAttempt(Optional nextPaymentAttempt) { + this.nextPaymentAttempt = nextPaymentAttempt; + return this; + } + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage needsTracking(Nullable needsTracking) { + if (needsTracking.isNull()) { + this.needsTracking = null; + } else if (needsTracking.isEmpty()) { + this.needsTracking = Optional.empty(); + } else { + this.needsTracking = Optional.of(needsTracking.get()); + } + return this; + } + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage needsTracking(Boolean needsTracking) { + this.needsTracking = Optional.ofNullable(needsTracking); + return this; + } + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ */ + @java.lang.Override + @JsonSetter(value = "needs_tracking", nulls = Nulls.SKIP) + public _FinalStage needsTracking(Optional needsTracking) { + this.needsTracking = needsTracking; + return this; + } + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The membership attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage membership(Nullable membership) { + if (membership.isNull()) { + this.membership = null; + } else if (membership.isEmpty()) { + this.membership = Optional.empty(); + } else { + this.membership = Optional.of(membership.get()); + } + return this; + } + + /** + *

The membership attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage membership(PaymentMembership membership) { + this.membership = Optional.ofNullable(membership); + return this; + } + + /** + *

The membership attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "membership", nulls = Nulls.SKIP) + public _FinalStage membership(Optional membership) { + this.membership = membership; + return this; + } + + /** + *

The member attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(Nullable member) { + if (member.isNull()) { + this.member = null; + } else if (member.isEmpty()) { + this.member = Optional.empty(); + } else { + this.member = Optional.of(member.get()); + } + return this; + } + + /** + *

The member attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(PaymentMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + /** + *

The member attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public _FinalStage member(Optional member) { + this.member = member; + return this; + } + + /** + *

The time of the last payment attempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaymentAttempt(Nullable lastPaymentAttempt) { + if (lastPaymentAttempt.isNull()) { + this.lastPaymentAttempt = null; + } else if (lastPaymentAttempt.isEmpty()) { + this.lastPaymentAttempt = Optional.empty(); + } else { + this.lastPaymentAttempt = Optional.of(lastPaymentAttempt.get()); + } + return this; + } + + /** + *

The time of the last payment attempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaymentAttempt(OffsetDateTime lastPaymentAttempt) { + this.lastPaymentAttempt = Optional.ofNullable(lastPaymentAttempt); + return this; + } + + /** + *

The time of the last payment attempt.

+ */ + @java.lang.Override + @JsonSetter(value = "last_payment_attempt", nulls = Nulls.SKIP) + public _FinalStage lastPaymentAttempt(Optional lastPaymentAttempt) { + this.lastPaymentAttempt = lastPaymentAttempt; + return this; + } + + /** + *

The financing transactions attached to this payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllFinancingTransactions(List financingTransactions) { + if (financingTransactions != null) { + this.financingTransactions.addAll(financingTransactions); + } + return this; + } + + /** + *

The financing transactions attached to this payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addFinancingTransactions(PaymentFinancingTransactionsItem financingTransactions) { + this.financingTransactions.add(financingTransactions); + return this; + } + + /** + *

The financing transactions attached to this payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ */ + @java.lang.Override + @JsonSetter(value = "financing_transactions", nulls = Nulls.SKIP) + public _FinalStage financingTransactions(List financingTransactions) { + this.financingTransactions.clear(); + if (financingTransactions != null) { + this.financingTransactions.addAll(financingTransactions); + } + return this; + } + + /** + *

The number of financing installments for the payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage financingInstallmentsCount(Nullable financingInstallmentsCount) { + if (financingInstallmentsCount.isNull()) { + this.financingInstallmentsCount = null; + } else if (financingInstallmentsCount.isEmpty()) { + this.financingInstallmentsCount = Optional.empty(); + } else { + this.financingInstallmentsCount = Optional.of(financingInstallmentsCount.get()); + } + return this; + } + + /** + *

The number of financing installments for the payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage financingInstallmentsCount(Integer financingInstallmentsCount) { + this.financingInstallmentsCount = Optional.ofNullable(financingInstallmentsCount); + return this; + } + + /** + *

The number of financing installments for the payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ */ + @java.lang.Override + @JsonSetter(value = "financing_installments_count", nulls = Nulls.SKIP) + public _FinalStage financingInstallmentsCount(Optional financingInstallmentsCount) { + this.financingInstallmentsCount = financingInstallmentsCount; + return this; + } + + /** + *

If the payment failed, the reason for the failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureMessage(Nullable failureMessage) { + if (failureMessage.isNull()) { + this.failureMessage = null; + } else if (failureMessage.isEmpty()) { + this.failureMessage = Optional.empty(); + } else { + this.failureMessage = Optional.of(failureMessage.get()); + } + return this; + } + + /** + *

If the payment failed, the reason for the failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureMessage(String failureMessage) { + this.failureMessage = Optional.ofNullable(failureMessage); + return this; + } + + /** + *

If the payment failed, the reason for the failure.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_message", nulls = Nulls.SKIP) + public _FinalStage failureMessage(Optional failureMessage) { + this.failureMessage = failureMessage; + return this; + } + + /** + *

The disputes attached to this payment. Null if the actor in context does not have the payment:dispute:read permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputes(Nullable> disputes) { + if (disputes.isNull()) { + this.disputes = null; + } else if (disputes.isEmpty()) { + this.disputes = Optional.empty(); + } else { + this.disputes = Optional.of(disputes.get()); + } + return this; + } + + /** + *

The disputes attached to this payment. Null if the actor in context does not have the payment:dispute:read permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputes(List disputes) { + this.disputes = Optional.ofNullable(disputes); + return this; + } + + /** + *

The disputes attached to this payment. Null if the actor in context does not have the payment:dispute:read permission.

+ */ + @java.lang.Override + @JsonSetter(value = "disputes", nulls = Nulls.SKIP) + public _FinalStage disputes(Optional> disputes) { + this.disputes = disputes; + return this; + } + + /** + *

When an alert came in that this transaction will be disputed

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputeAlertedAt(Nullable disputeAlertedAt) { + if (disputeAlertedAt.isNull()) { + this.disputeAlertedAt = null; + } else if (disputeAlertedAt.isEmpty()) { + this.disputeAlertedAt = Optional.empty(); + } else { + this.disputeAlertedAt = Optional.of(disputeAlertedAt.get()); + } + return this; + } + + /** + *

When an alert came in that this transaction will be disputed

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputeAlertedAt(OffsetDateTime disputeAlertedAt) { + this.disputeAlertedAt = Optional.ofNullable(disputeAlertedAt); + return this; + } + + /** + *

When an alert came in that this transaction will be disputed

+ */ + @java.lang.Override + @JsonSetter(value = "dispute_alerted_at", nulls = Nulls.SKIP) + public _FinalStage disputeAlertedAt(Optional disputeAlertedAt) { + this.disputeAlertedAt = disputeAlertedAt; + return this; + } + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage declineCode(Nullable declineCode) { + if (declineCode.isNull()) { + this.declineCode = null; + } else if (declineCode.isEmpty()) { + this.declineCode = Optional.empty(); + } else { + this.declineCode = Optional.of(declineCode.get()); + } + return this; + } + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage declineCode(PaymentDeclineCodes declineCode) { + this.declineCode = Optional.ofNullable(declineCode); + return this; + } + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ */ + @java.lang.Override + @JsonSetter(value = "decline_code", nulls = Nulls.SKIP) + public _FinalStage declineCode(Optional declineCode) { + this.declineCode = declineCode; + return this; + } + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerPhone(Nullable customerPhone) { + if (customerPhone.isNull()) { + this.customerPhone = null; + } else if (customerPhone.isEmpty()) { + this.customerPhone = Optional.empty(); + } else { + this.customerPhone = Optional.of(customerPhone.get()); + } + return this; + } + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerPhone(String customerPhone) { + this.customerPhone = Optional.ofNullable(customerPhone); + return this; + } + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ */ + @java.lang.Override + @JsonSetter(value = "customer_phone", nulls = Nulls.SKIP) + public _FinalStage customerPhone(Optional customerPhone) { + this.customerPhone = customerPhone; + return this; + } + + /** + *

The company for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(Nullable company) { + if (company.isNull()) { + this.company = null; + } else if (company.isEmpty()) { + this.company = Optional.empty(); + } else { + this.company = Optional.of(company.get()); + } + return this; + } + + /** + *

The company for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(PaymentCompany company) { + this.company = Optional.ofNullable(company); + return this; + } + + /** + *

The company for the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfigurationId(Nullable checkoutConfigurationId) { + if (checkoutConfigurationId.isNull()) { + this.checkoutConfigurationId = null; + } else if (checkoutConfigurationId.isEmpty()) { + this.checkoutConfigurationId = Optional.empty(); + } else { + this.checkoutConfigurationId = Optional.of(checkoutConfigurationId.get()); + } + return this; + } + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfigurationId(String checkoutConfigurationId) { + this.checkoutConfigurationId = Optional.ofNullable(checkoutConfigurationId); + return this; + } + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ */ + @java.lang.Override + @JsonSetter(value = "checkout_configuration_id", nulls = Nulls.SKIP) + public _FinalStage checkoutConfigurationId(Optional checkoutConfigurationId) { + this.checkoutConfigurationId = checkoutConfigurationId; + return this; + } + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardLast4(Nullable cardLast4) { + if (cardLast4.isNull()) { + this.cardLast4 = null; + } else if (cardLast4.isEmpty()) { + this.cardLast4 = Optional.empty(); + } else { + this.cardLast4 = Optional.of(cardLast4.get()); + } + return this; + } + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardLast4(String cardLast4) { + this.cardLast4 = Optional.ofNullable(cardLast4); + return this; + } + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ */ + @java.lang.Override + @JsonSetter(value = "card_last4", nulls = Nulls.SKIP) + public _FinalStage cardLast4(Optional cardLast4) { + this.cardLast4 = cardLast4; + return this; + } + + /** + *

The four-digit expiration year of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardExpYear(Nullable cardExpYear) { + if (cardExpYear.isNull()) { + this.cardExpYear = null; + } else if (cardExpYear.isEmpty()) { + this.cardExpYear = Optional.empty(); + } else { + this.cardExpYear = Optional.of(cardExpYear.get()); + } + return this; + } + + /** + *

The four-digit expiration year of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardExpYear(Integer cardExpYear) { + this.cardExpYear = Optional.ofNullable(cardExpYear); + return this; + } + + /** + *

The four-digit expiration year of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ */ + @java.lang.Override + @JsonSetter(value = "card_exp_year", nulls = Nulls.SKIP) + public _FinalStage cardExpYear(Optional cardExpYear) { + this.cardExpYear = cardExpYear; + return this; + } + + /** + *

The expiration month (1-12) of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardExpMonth(Nullable cardExpMonth) { + if (cardExpMonth.isNull()) { + this.cardExpMonth = null; + } else if (cardExpMonth.isEmpty()) { + this.cardExpMonth = Optional.empty(); + } else { + this.cardExpMonth = Optional.of(cardExpMonth.get()); + } + return this; + } + + /** + *

The expiration month (1-12) of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardExpMonth(Integer cardExpMonth) { + this.cardExpMonth = Optional.ofNullable(cardExpMonth); + return this; + } + + /** + *

The expiration month (1-12) of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ */ + @java.lang.Override + @JsonSetter(value = "card_exp_month", nulls = Nulls.SKIP) + public _FinalStage cardExpMonth(Optional cardExpMonth) { + this.cardExpMonth = cardExpMonth; + return this; + } + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(Nullable cardBrand) { + if (cardBrand.isNull()) { + this.cardBrand = null; + } else if (cardBrand.isEmpty()) { + this.cardBrand = Optional.empty(); + } else { + this.cardBrand = Optional.of(cardBrand.get()); + } + return this; + } + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(CardBrands cardBrand) { + this.cardBrand = Optional.ofNullable(cardBrand); + return this; + } + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ */ + @java.lang.Override + @JsonSetter(value = "card_brand", nulls = Nulls.SKIP) + public _FinalStage cardBrand(Optional cardBrand) { + this.cardBrand = cardBrand; + return this; + } + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingReason(Nullable billingReason) { + if (billingReason.isNull()) { + this.billingReason = null; + } else if (billingReason.isEmpty()) { + this.billingReason = Optional.empty(); + } else { + this.billingReason = Optional.of(billingReason.get()); + } + return this; + } + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingReason(BillingReasons billingReason) { + this.billingReason = Optional.ofNullable(billingReason); + return this; + } + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_reason", nulls = Nulls.SKIP) + public _FinalStage billingReason(Optional billingReason) { + this.billingReason = billingReason; + return this; + } + + /** + *

The address of the user who made the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingAddress(Nullable billingAddress) { + if (billingAddress.isNull()) { + this.billingAddress = null; + } else if (billingAddress.isEmpty()) { + this.billingAddress = Optional.empty(); + } else { + this.billingAddress = Optional.of(billingAddress.get()); + } + return this; + } + + /** + *

The address of the user who made the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingAddress(PaymentBillingAddress billingAddress) { + this.billingAddress = Optional.ofNullable(billingAddress); + return this; + } + + /** + *

The address of the user who made the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_address", nulls = Nulls.SKIP) + public _FinalStage billingAddress(Optional billingAddress) { + this.billingAddress = billingAddress; + return this; + } + + /** + *

The application fee charged on this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage applicationFee(Nullable applicationFee) { + if (applicationFee.isNull()) { + this.applicationFee = null; + } else if (applicationFee.isEmpty()) { + this.applicationFee = Optional.empty(); + } else { + this.applicationFee = Optional.of(applicationFee.get()); + } + return this; + } + + /** + *

The application fee charged on this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage applicationFee(PaymentApplicationFee applicationFee) { + this.applicationFee = Optional.ofNullable(applicationFee); + return this; + } + + /** + *

The application fee charged on this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "application_fee", nulls = Nulls.SKIP) + public _FinalStage applicationFee(Optional applicationFee) { + this.applicationFee = applicationFee; + return this; + } + + @java.lang.Override + public RetrievePaymentsResponse build() { + return new RetrievePaymentsResponse( + amountAfterFees, + applicationFee, + autoRefunded, + billingAddress, + billingReason, + cardBrand, + cardExpMonth, + cardExpYear, + cardLast4, + checkoutConfigurationId, + company, + createdAt, + currency, + customerPhone, + declineCode, + disputeAlertedAt, + disputes, + failureMessage, + financingInstallmentsCount, + financingTransactions, + id, + lastPaymentAttempt, + member, + membership, + metadata, + needsTracking, + nextPaymentAttempt, + paidAt, + paymentInstrument, + paymentMethod, + paymentMethodType, + paymentsFailed, + plan, + product, + promoCode, + refundable, + refundedAmount, + refundedAt, + refunds, + resolutions, + retryable, + riskScore, + riskSignals, + settlementAmount, + settlementCurrency, + settlementExchangeRate, + settlementTimeAt, + shipment, + shippingAddress, + status, + substatus, + subtotal, + taxAmount, + taxBehavior, + taxRefundedAmount, + threeDsVerified, + total, + updatedAt, + usdTotal, + user, + verificationChecks, + voidable, + clientSecret, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payoutaccounts/AsyncPayoutAccountsClient.java b/src/main/java/com/whop/api/resources/payoutaccounts/AsyncPayoutAccountsClient.java new file mode 100644 index 00000000..91780c31 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payoutaccounts/AsyncPayoutAccountsClient.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payoutaccounts; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.payoutaccounts.requests.RetrievePayoutAccountsRequest; +import com.whop.api.types.PayoutAccount; +import java.util.concurrent.CompletableFuture; + +public class AsyncPayoutAccountsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPayoutAccountsClient rawClient; + + public AsyncPayoutAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPayoutAccountsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPayoutAccountsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrievePayoutAccountsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrievePayoutAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/payoutaccounts/AsyncRawPayoutAccountsClient.java b/src/main/java/com/whop/api/resources/payoutaccounts/AsyncRawPayoutAccountsClient.java new file mode 100644 index 00000000..e99e1fb9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payoutaccounts/AsyncRawPayoutAccountsClient.java @@ -0,0 +1,172 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payoutaccounts; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.payoutaccounts.requests.RetrievePayoutAccountsRequest; +import com.whop.api.types.PayoutAccount; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPayoutAccountsClient { + protected final ClientOptions clientOptions; + + public AsyncRawPayoutAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrievePayoutAccountsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePayoutAccountsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrievePayoutAccountsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrievePayoutAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payout_accounts") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PayoutAccount.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/payoutaccounts/PayoutAccountsClient.java b/src/main/java/com/whop/api/resources/payoutaccounts/PayoutAccountsClient.java new file mode 100644 index 00000000..5a1ccb83 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payoutaccounts/PayoutAccountsClient.java @@ -0,0 +1,71 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payoutaccounts; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.payoutaccounts.requests.RetrievePayoutAccountsRequest; +import com.whop.api.types.PayoutAccount; + +public class PayoutAccountsClient { + protected final ClientOptions clientOptions; + + private final RawPayoutAccountsClient rawClient; + + public PayoutAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPayoutAccountsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPayoutAccountsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public PayoutAccount retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public PayoutAccount retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public PayoutAccount retrieve(String id, RetrievePayoutAccountsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public PayoutAccount retrieve(String id, RetrievePayoutAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/payoutaccounts/RawPayoutAccountsClient.java b/src/main/java/com/whop/api/resources/payoutaccounts/RawPayoutAccountsClient.java new file mode 100644 index 00000000..908abe7c --- /dev/null +++ b/src/main/java/com/whop/api/resources/payoutaccounts/RawPayoutAccountsClient.java @@ -0,0 +1,139 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payoutaccounts; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.payoutaccounts.requests.RetrievePayoutAccountsRequest; +import com.whop.api.types.PayoutAccount; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPayoutAccountsClient { + protected final ClientOptions clientOptions; + + public RawPayoutAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrievePayoutAccountsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePayoutAccountsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrievePayoutAccountsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing payout account. + *

Required permissions:

+ *
    + *
  • payout:account:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrievePayoutAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payout_accounts") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PayoutAccount.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/payoutaccounts/requests/RetrievePayoutAccountsRequest.java b/src/main/java/com/whop/api/resources/payoutaccounts/requests/RetrievePayoutAccountsRequest.java new file mode 100644 index 00000000..edcf71e9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payoutaccounts/requests/RetrievePayoutAccountsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payoutaccounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePayoutAccountsRequest.Builder.class) +public final class RetrievePayoutAccountsRequest { + private final Map additionalProperties; + + private RetrievePayoutAccountsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePayoutAccountsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePayoutAccountsRequest other) { + return this; + } + + public RetrievePayoutAccountsRequest build() { + return new RetrievePayoutAccountsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payoutaccounts/types/PostPayoutAccountStatusUpdatedPayload.java b/src/main/java/com/whop/api/resources/payoutaccounts/types/PostPayoutAccountStatusUpdatedPayload.java new file mode 100644 index 00000000..87321121 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payoutaccounts/types/PostPayoutAccountStatusUpdatedPayload.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payoutaccounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PayoutAccount; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPayoutAccountStatusUpdatedPayload.Builder.class) +public final class PostPayoutAccountStatusUpdatedPayload { + private final Optional accountId; + + private final PostPayoutAccountStatusUpdatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PayoutAccount data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostPayoutAccountStatusUpdatedPayloadType type; + + private final Map additionalProperties; + + private PostPayoutAccountStatusUpdatedPayload( + Optional accountId, + PostPayoutAccountStatusUpdatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PayoutAccount data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostPayoutAccountStatusUpdatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostPayoutAccountStatusUpdatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PayoutAccount getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostPayoutAccountStatusUpdatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPayoutAccountStatusUpdatedPayload + && equalTo((PostPayoutAccountStatusUpdatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPayoutAccountStatusUpdatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostPayoutAccountStatusUpdatedPayloadApiVersion apiVersion); + + Builder from(PostPayoutAccountStatusUpdatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PayoutAccount data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostPayoutAccountStatusUpdatedPayloadType type); + } + + public interface _FinalStage { + PostPayoutAccountStatusUpdatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostPayoutAccountStatusUpdatedPayloadApiVersion apiVersion; + + private PayoutAccount data; + + private String id; + + private OffsetDateTime timestamp; + + private PostPayoutAccountStatusUpdatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostPayoutAccountStatusUpdatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostPayoutAccountStatusUpdatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PayoutAccount data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostPayoutAccountStatusUpdatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostPayoutAccountStatusUpdatedPayload build() { + return new PostPayoutAccountStatusUpdatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payoutaccounts/types/PostPayoutAccountStatusUpdatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/payoutaccounts/types/PostPayoutAccountStatusUpdatedPayloadApiVersion.java new file mode 100644 index 00000000..c0857e69 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payoutaccounts/types/PostPayoutAccountStatusUpdatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payoutaccounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPayoutAccountStatusUpdatedPayloadApiVersion { + public static final PostPayoutAccountStatusUpdatedPayloadApiVersion V1 = + new PostPayoutAccountStatusUpdatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostPayoutAccountStatusUpdatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPayoutAccountStatusUpdatedPayloadApiVersion + && this.string.equals(((PostPayoutAccountStatusUpdatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPayoutAccountStatusUpdatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostPayoutAccountStatusUpdatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payoutaccounts/types/PostPayoutAccountStatusUpdatedPayloadType.java b/src/main/java/com/whop/api/resources/payoutaccounts/types/PostPayoutAccountStatusUpdatedPayloadType.java new file mode 100644 index 00000000..c3f456ea --- /dev/null +++ b/src/main/java/com/whop/api/resources/payoutaccounts/types/PostPayoutAccountStatusUpdatedPayloadType.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payoutaccounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPayoutAccountStatusUpdatedPayloadType { + public static final PostPayoutAccountStatusUpdatedPayloadType PAYOUT_ACCOUNT_STATUS_UPDATED = + new PostPayoutAccountStatusUpdatedPayloadType( + Value.PAYOUT_ACCOUNT_STATUS_UPDATED, "payout_account.status_updated"); + + private final Value value; + + private final String string; + + PostPayoutAccountStatusUpdatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPayoutAccountStatusUpdatedPayloadType + && this.string.equals(((PostPayoutAccountStatusUpdatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYOUT_ACCOUNT_STATUS_UPDATED: + return visitor.visitPayoutAccountStatusUpdated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPayoutAccountStatusUpdatedPayloadType valueOf(String value) { + switch (value) { + case "payout_account.status_updated": + return PAYOUT_ACCOUNT_STATUS_UPDATED; + default: + return new PostPayoutAccountStatusUpdatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYOUT_ACCOUNT_STATUS_UPDATED, + + UNKNOWN + } + + public interface Visitor { + T visitPayoutAccountStatusUpdated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payoutmethods/AsyncPayoutMethodsClient.java b/src/main/java/com/whop/api/resources/payoutmethods/AsyncPayoutMethodsClient.java new file mode 100644 index 00000000..37a7c0fe --- /dev/null +++ b/src/main/java/com/whop/api/resources/payoutmethods/AsyncPayoutMethodsClient.java @@ -0,0 +1,100 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payoutmethods; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.payoutmethods.requests.ListPayoutMethodRequest; +import com.whop.api.resources.payoutmethods.requests.RetrievePayoutMethodRequest; +import com.whop.api.types.PayoutMethod; +import com.whop.api.types.PayoutMethodListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncPayoutMethodsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPayoutMethodsClient rawClient; + + public AsyncPayoutMethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPayoutMethodsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPayoutMethodsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a list of active payout methods configured for a company, ordered by most recently created. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture> listPayoutMethod( + ListPayoutMethodRequest request) { + return this.rawClient.listPayoutMethod(request).thenApply(response -> response.body()); + } + + /** + * Returns a list of active payout methods configured for a company, ordered by most recently created. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture> listPayoutMethod( + ListPayoutMethodRequest request, RequestOptions requestOptions) { + return this.rawClient.listPayoutMethod(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture retrievePayoutMethod(String id) { + return this.rawClient.retrievePayoutMethod(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture retrievePayoutMethod(String id, RequestOptions requestOptions) { + return this.rawClient.retrievePayoutMethod(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture retrievePayoutMethod(String id, RetrievePayoutMethodRequest request) { + return this.rawClient.retrievePayoutMethod(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture retrievePayoutMethod( + String id, RetrievePayoutMethodRequest request, RequestOptions requestOptions) { + return this.rawClient.retrievePayoutMethod(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/payoutmethods/AsyncRawPayoutMethodsClient.java b/src/main/java/com/whop/api/resources/payoutmethods/AsyncRawPayoutMethodsClient.java new file mode 100644 index 00000000..7db1d5f5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payoutmethods/AsyncRawPayoutMethodsClient.java @@ -0,0 +1,325 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payoutmethods; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.payoutmethods.requests.ListPayoutMethodRequest; +import com.whop.api.resources.payoutmethods.requests.RetrievePayoutMethodRequest; +import com.whop.api.resources.payoutmethods.types.ListPayoutMethodResponse; +import com.whop.api.types.PayoutMethod; +import com.whop.api.types.PayoutMethodListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPayoutMethodsClient { + protected final ClientOptions clientOptions; + + public AsyncRawPayoutMethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a list of active payout methods configured for a company, ordered by most recently created. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture>> listPayoutMethod( + ListPayoutMethodRequest request) { + return listPayoutMethod(request, null); + } + + /** + * Returns a list of active payout methods configured for a company, ordered by most recently created. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture>> listPayoutMethod( + ListPayoutMethodRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payout_methods"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPayoutMethodResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPayoutMethodResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListPayoutMethodRequest nextRequest = ListPayoutMethodRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return listPayoutMethod(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture> retrievePayoutMethod(String id) { + return retrievePayoutMethod(id, RetrievePayoutMethodRequest.builder().build()); + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture> retrievePayoutMethod( + String id, RequestOptions requestOptions) { + return retrievePayoutMethod(id, RetrievePayoutMethodRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture> retrievePayoutMethod( + String id, RetrievePayoutMethodRequest request) { + return retrievePayoutMethod(id, request, null); + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture> retrievePayoutMethod( + String id, RetrievePayoutMethodRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payout_methods") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PayoutMethod.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/payoutmethods/PayoutMethodsClient.java b/src/main/java/com/whop/api/resources/payoutmethods/PayoutMethodsClient.java new file mode 100644 index 00000000..757f8007 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payoutmethods/PayoutMethodsClient.java @@ -0,0 +1,98 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payoutmethods; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.payoutmethods.requests.ListPayoutMethodRequest; +import com.whop.api.resources.payoutmethods.requests.RetrievePayoutMethodRequest; +import com.whop.api.types.PayoutMethod; +import com.whop.api.types.PayoutMethodListItem; + +public class PayoutMethodsClient { + protected final ClientOptions clientOptions; + + private final RawPayoutMethodsClient rawClient; + + public PayoutMethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPayoutMethodsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPayoutMethodsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a list of active payout methods configured for a company, ordered by most recently created. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public SyncPagingIterable listPayoutMethod(ListPayoutMethodRequest request) { + return this.rawClient.listPayoutMethod(request).body(); + } + + /** + * Returns a list of active payout methods configured for a company, ordered by most recently created. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public SyncPagingIterable listPayoutMethod( + ListPayoutMethodRequest request, RequestOptions requestOptions) { + return this.rawClient.listPayoutMethod(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public PayoutMethod retrievePayoutMethod(String id) { + return this.rawClient.retrievePayoutMethod(id).body(); + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public PayoutMethod retrievePayoutMethod(String id, RequestOptions requestOptions) { + return this.rawClient.retrievePayoutMethod(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public PayoutMethod retrievePayoutMethod(String id, RetrievePayoutMethodRequest request) { + return this.rawClient.retrievePayoutMethod(id, request).body(); + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public PayoutMethod retrievePayoutMethod( + String id, RetrievePayoutMethodRequest request, RequestOptions requestOptions) { + return this.rawClient.retrievePayoutMethod(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/payoutmethods/RawPayoutMethodsClient.java b/src/main/java/com/whop/api/resources/payoutmethods/RawPayoutMethodsClient.java new file mode 100644 index 00000000..089cf8e1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payoutmethods/RawPayoutMethodsClient.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payoutmethods; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.payoutmethods.requests.ListPayoutMethodRequest; +import com.whop.api.resources.payoutmethods.requests.RetrievePayoutMethodRequest; +import com.whop.api.resources.payoutmethods.types.ListPayoutMethodResponse; +import com.whop.api.types.PayoutMethod; +import com.whop.api.types.PayoutMethodListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPayoutMethodsClient { + protected final ClientOptions clientOptions; + + public RawPayoutMethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a list of active payout methods configured for a company, ordered by most recently created. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public WhopApiHttpResponse> listPayoutMethod( + ListPayoutMethodRequest request) { + return listPayoutMethod(request, null); + } + + /** + * Returns a list of active payout methods configured for a company, ordered by most recently created. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public WhopApiHttpResponse> listPayoutMethod( + ListPayoutMethodRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payout_methods"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPayoutMethodResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPayoutMethodResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListPayoutMethodRequest nextRequest = ListPayoutMethodRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> listPayoutMethod( + nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public WhopApiHttpResponse retrievePayoutMethod(String id) { + return retrievePayoutMethod(id, RetrievePayoutMethodRequest.builder().build()); + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public WhopApiHttpResponse retrievePayoutMethod(String id, RequestOptions requestOptions) { + return retrievePayoutMethod(id, RetrievePayoutMethodRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public WhopApiHttpResponse retrievePayoutMethod(String id, RetrievePayoutMethodRequest request) { + return retrievePayoutMethod(id, request, null); + } + + /** + * Retrieves the details of an existing payout method. + *

Required permissions:

+ *
    + *
  • payout:destination:read
  • + *
+ */ + public WhopApiHttpResponse retrievePayoutMethod( + String id, RetrievePayoutMethodRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payout_methods") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PayoutMethod.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/payoutmethods/requests/ListPayoutMethodRequest.java b/src/main/java/com/whop/api/resources/payoutmethods/requests/ListPayoutMethodRequest.java new file mode 100644 index 00000000..5f894897 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payoutmethods/requests/ListPayoutMethodRequest.java @@ -0,0 +1,305 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payoutmethods.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPayoutMethodRequest.Builder.class) +public final class ListPayoutMethodRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String companyId; + + private final Map additionalProperties; + + private ListPayoutMethodRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String companyId, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to list payout methods for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPayoutMethodRequest && equalTo((ListPayoutMethodRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPayoutMethodRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last, this.companyId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to list payout methods for.

+ */ + _FinalStage companyId(@NotNull String companyId); + + Builder from(ListPayoutMethodRequest other); + } + + public interface _FinalStage { + ListPayoutMethodRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPayoutMethodRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + return this; + } + + /** + *

The unique identifier of the company to list payout methods for.

+ *

The unique identifier of the company to list payout methods for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListPayoutMethodRequest build() { + return new ListPayoutMethodRequest(after, before, first, last, companyId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payoutmethods/requests/RetrievePayoutMethodRequest.java b/src/main/java/com/whop/api/resources/payoutmethods/requests/RetrievePayoutMethodRequest.java new file mode 100644 index 00000000..e76e594a --- /dev/null +++ b/src/main/java/com/whop/api/resources/payoutmethods/requests/RetrievePayoutMethodRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payoutmethods.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePayoutMethodRequest.Builder.class) +public final class RetrievePayoutMethodRequest { + private final Map additionalProperties; + + private RetrievePayoutMethodRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePayoutMethodRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePayoutMethodRequest other) { + return this; + } + + public RetrievePayoutMethodRequest build() { + return new RetrievePayoutMethodRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payoutmethods/types/ListPayoutMethodResponse.java b/src/main/java/com/whop/api/resources/payoutmethods/types/ListPayoutMethodResponse.java new file mode 100644 index 00000000..49c85d3a --- /dev/null +++ b/src/main/java/com/whop/api/resources/payoutmethods/types/ListPayoutMethodResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payoutmethods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PageInfo; +import com.whop.api.types.PayoutMethodListItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPayoutMethodResponse.Builder.class) +public final class ListPayoutMethodResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListPayoutMethodResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPayoutMethodResponse && equalTo((ListPayoutMethodResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPayoutMethodResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListPayoutMethodResponse other); + } + + public interface _FinalStage { + ListPayoutMethodResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(PayoutMethodListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPayoutMethodResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(PayoutMethodListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListPayoutMethodResponse build() { + return new ListPayoutMethodResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/AsyncPayoutsClient.java b/src/main/java/com/whop/api/resources/payouts/AsyncPayoutsClient.java new file mode 100644 index 00000000..5aeaff23 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/AsyncPayoutsClient.java @@ -0,0 +1,124 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.payouts.methods.AsyncMethodsClient; +import com.whop.api.resources.payouts.requests.ListPayoutsRequest; +import com.whop.api.resources.payouts.requests.RetrievePayoutsRequest; +import com.whop.api.resources.payouts.supportedmethods.AsyncSupportedMethodsClient; +import com.whop.api.resources.payouts.types.CreatePayoutsRequestBody; +import com.whop.api.resources.payouts.types.CreatePayoutsResponse; +import com.whop.api.resources.payouts.types.ListPayoutsResponseDataItem; +import com.whop.api.resources.payouts.types.RetrievePayoutsResponse; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class AsyncPayoutsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPayoutsClient rawClient; + + protected final Supplier methodsClient; + + protected final Supplier supportedMethodsClient; + + public AsyncPayoutsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPayoutsClient(clientOptions); + this.methodsClient = Suppliers.memoize(() -> new AsyncMethodsClient(clientOptions)); + this.supportedMethodsClient = Suppliers.memoize(() -> new AsyncSupportedMethodsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPayoutsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public CompletableFuture> list(ListPayoutsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public CompletableFuture> list( + ListPayoutsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Sends money from an account or user balance to a saved payout method for that owner. + */ + public CompletableFuture create(CreatePayoutsRequestBody request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Sends money from an account or user balance to a saved payout method for that owner. + */ + public CompletableFuture create( + CreatePayoutsRequestBody request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public CompletableFuture retrieve(String id, RetrievePayoutsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public CompletableFuture retrieve( + String id, RetrievePayoutsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + public AsyncMethodsClient methods() { + return this.methodsClient.get(); + } + + public AsyncSupportedMethodsClient supportedMethods() { + return this.supportedMethodsClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/AsyncRawPayoutsClient.java b/src/main/java/com/whop/api/resources/payouts/AsyncRawPayoutsClient.java new file mode 100644 index 00000000..c3ac4d2f --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/AsyncRawPayoutsClient.java @@ -0,0 +1,427 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.payouts.requests.ListPayoutsRequest; +import com.whop.api.resources.payouts.requests.RetrievePayoutsRequest; +import com.whop.api.resources.payouts.types.CreatePayoutsRequestBody; +import com.whop.api.resources.payouts.types.CreatePayoutsResponse; +import com.whop.api.resources.payouts.types.ListPayoutsResponse; +import com.whop.api.resources.payouts.types.ListPayoutsResponseDataItem; +import com.whop.api.resources.payouts.types.RetrievePayoutsResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPayoutsClient { + protected final ClientOptions clientOptions; + + public AsyncRawPayoutsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public CompletableFuture>> list() { + return list(ListPayoutsRequest.builder().build()); + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListPayoutsRequest.builder().build(), requestOptions); + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public CompletableFuture>> list( + ListPayoutsRequest request) { + return list(request, null); + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public CompletableFuture>> list( + ListPayoutsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getSource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "source", request.getSource().get(), false); + } + if (request.getPayoutMethodId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "payout_method_id", request.getPayoutMethodId().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPayoutsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPayoutsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListPayoutsRequest nextRequest = ListPayoutsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Sends money from an account or user balance to a saved payout method for that owner. + */ + public CompletableFuture> create(CreatePayoutsRequestBody request) { + return create(request, null); + } + + /** + * Sends money from an account or user balance to a saved payout method for that owner. + */ + public CompletableFuture> create( + CreatePayoutsRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreatePayoutsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrievePayoutsRequest.builder().build()); + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePayoutsRequest.builder().build(), requestOptions); + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public CompletableFuture> retrieve( + String id, RetrievePayoutsRequest request) { + return retrieve(id, request, null); + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public CompletableFuture> retrieve( + String id, RetrievePayoutsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrievePayoutsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/PayoutsClient.java b/src/main/java/com/whop/api/resources/payouts/PayoutsClient.java new file mode 100644 index 00000000..3341c1ec --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/PayoutsClient.java @@ -0,0 +1,121 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.payouts.methods.MethodsClient; +import com.whop.api.resources.payouts.requests.ListPayoutsRequest; +import com.whop.api.resources.payouts.requests.RetrievePayoutsRequest; +import com.whop.api.resources.payouts.supportedmethods.SupportedMethodsClient; +import com.whop.api.resources.payouts.types.CreatePayoutsRequestBody; +import com.whop.api.resources.payouts.types.CreatePayoutsResponse; +import com.whop.api.resources.payouts.types.ListPayoutsResponseDataItem; +import com.whop.api.resources.payouts.types.RetrievePayoutsResponse; +import java.util.function.Supplier; + +public class PayoutsClient { + protected final ClientOptions clientOptions; + + private final RawPayoutsClient rawClient; + + protected final Supplier methodsClient; + + protected final Supplier supportedMethodsClient; + + public PayoutsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPayoutsClient(clientOptions); + this.methodsClient = Suppliers.memoize(() -> new MethodsClient(clientOptions)); + this.supportedMethodsClient = Suppliers.memoize(() -> new SupportedMethodsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPayoutsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public SyncPagingIterable list(ListPayoutsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public SyncPagingIterable list( + ListPayoutsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Sends money from an account or user balance to a saved payout method for that owner. + */ + public CreatePayoutsResponse create(CreatePayoutsRequestBody request) { + return this.rawClient.create(request).body(); + } + + /** + * Sends money from an account or user balance to a saved payout method for that owner. + */ + public CreatePayoutsResponse create(CreatePayoutsRequestBody request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public RetrievePayoutsResponse retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public RetrievePayoutsResponse retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public RetrievePayoutsResponse retrieve(String id, RetrievePayoutsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public RetrievePayoutsResponse retrieve(String id, RetrievePayoutsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + public MethodsClient methods() { + return this.methodsClient.get(); + } + + public SupportedMethodsClient supportedMethods() { + return this.supportedMethodsClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/RawPayoutsClient.java b/src/main/java/com/whop/api/resources/payouts/RawPayoutsClient.java new file mode 100644 index 00000000..893dd2c2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/RawPayoutsClient.java @@ -0,0 +1,344 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.payouts.requests.ListPayoutsRequest; +import com.whop.api.resources.payouts.requests.RetrievePayoutsRequest; +import com.whop.api.resources.payouts.types.CreatePayoutsRequestBody; +import com.whop.api.resources.payouts.types.CreatePayoutsResponse; +import com.whop.api.resources.payouts.types.ListPayoutsResponse; +import com.whop.api.resources.payouts.types.ListPayoutsResponseDataItem; +import com.whop.api.resources.payouts.types.RetrievePayoutsResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPayoutsClient { + protected final ClientOptions clientOptions; + + public RawPayoutsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public WhopApiHttpResponse> list() { + return list(ListPayoutsRequest.builder().build()); + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListPayoutsRequest.builder().build(), requestOptions); + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public WhopApiHttpResponse> list(ListPayoutsRequest request) { + return list(request, null); + } + + /** + * Lists an account's or user's payouts, newest first. + */ + public WhopApiHttpResponse> list( + ListPayoutsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getSource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "source", request.getSource().get(), false); + } + if (request.getPayoutMethodId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "payout_method_id", request.getPayoutMethodId().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPayoutsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPayoutsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListPayoutsRequest nextRequest = ListPayoutsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Sends money from an account or user balance to a saved payout method for that owner. + */ + public WhopApiHttpResponse create(CreatePayoutsRequestBody request) { + return create(request, null); + } + + /** + * Sends money from an account or user balance to a saved payout method for that owner. + */ + public WhopApiHttpResponse create( + CreatePayoutsRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreatePayoutsResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrievePayoutsRequest.builder().build()); + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePayoutsRequest.builder().build(), requestOptions); + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public WhopApiHttpResponse retrieve(String id, RetrievePayoutsRequest request) { + return retrieve(id, request, null); + } + + /** + * Fetches one payout by its wdrl_ ID, or by the cofr_ conversion request ID a stablecoin payout carries as payout_request_id — both ids answer with the same payout object. + */ + public WhopApiHttpResponse retrieve( + String id, RetrievePayoutsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrievePayoutsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/AsyncMethodsClient.java b/src/main/java/com/whop/api/resources/payouts/methods/AsyncMethodsClient.java new file mode 100644 index 00000000..502df26a --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/AsyncMethodsClient.java @@ -0,0 +1,123 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.payouts.methods.requests.CreateMethodsRequest; +import com.whop.api.resources.payouts.methods.requests.DeleteMethodsRequest; +import com.whop.api.resources.payouts.methods.requests.ListMethodsRequest; +import com.whop.api.resources.payouts.methods.requests.UpdateMethodsRequest; +import com.whop.api.resources.payouts.methods.types.CreateMethodsResponse; +import com.whop.api.resources.payouts.methods.types.DeleteMethodsResponse; +import com.whop.api.resources.payouts.methods.types.ListMethodsResponseDataItem; +import com.whop.api.resources.payouts.methods.types.UpdateMethodsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncMethodsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawMethodsClient rawClient; + + public AsyncMethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawMethodsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawMethodsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public CompletableFuture> list(ListMethodsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public CompletableFuture> list( + ListMethodsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Saves a new place an account or user can withdraw to. Sensitive details are vaulted in transit and never stored raw. + */ + public CompletableFuture create(CreateMethodsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Saves a new place an account or user can withdraw to. Sensitive details are vaulted in transit and never stored raw. + */ + public CompletableFuture create( + CreateMethodsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public CompletableFuture delete(String id, DeleteMethodsRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public CompletableFuture delete( + String id, DeleteMethodsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Changes the label used to identify a saved payout method. + */ + public CompletableFuture update(String id, UpdateMethodsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Changes the label used to identify a saved payout method. + */ + public CompletableFuture update( + String id, UpdateMethodsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/AsyncRawMethodsClient.java b/src/main/java/com/whop/api/resources/payouts/methods/AsyncRawMethodsClient.java new file mode 100644 index 00000000..b8df1a14 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/AsyncRawMethodsClient.java @@ -0,0 +1,503 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.payouts.methods.requests.CreateMethodsRequest; +import com.whop.api.resources.payouts.methods.requests.DeleteMethodsRequest; +import com.whop.api.resources.payouts.methods.requests.ListMethodsRequest; +import com.whop.api.resources.payouts.methods.requests.UpdateMethodsRequest; +import com.whop.api.resources.payouts.methods.types.CreateMethodsResponse; +import com.whop.api.resources.payouts.methods.types.DeleteMethodsResponse; +import com.whop.api.resources.payouts.methods.types.ListMethodsResponse; +import com.whop.api.resources.payouts.methods.types.ListMethodsResponseDataItem; +import com.whop.api.resources.payouts.methods.types.UpdateMethodsResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawMethodsClient { + protected final ClientOptions clientOptions; + + public AsyncRawMethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public CompletableFuture>> list() { + return list(ListMethodsRequest.builder().build()); + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListMethodsRequest.builder().build(), requestOptions); + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public CompletableFuture>> list( + ListMethodsRequest request) { + return list(request, null); + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public CompletableFuture>> list( + ListMethodsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts/methods"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getAmount().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "amount", request.getAmount().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getIncludeLimits().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "include_limits", request.getIncludeLimits().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListMethodsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListMethodsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListMethodsRequest nextRequest = ListMethodsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Saves a new place an account or user can withdraw to. Sensitive details are vaulted in transit and never stored raw. + */ + public CompletableFuture> create(CreateMethodsRequest request) { + return create(request, null); + } + + /** + * Saves a new place an account or user can withdraw to. Sensitive details are vaulted in transit and never stored raw. + */ + public CompletableFuture> create( + CreateMethodsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts/methods"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateMethodsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteMethodsRequest.builder().build()); + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public CompletableFuture> delete( + String id, RequestOptions requestOptions) { + return delete(id, DeleteMethodsRequest.builder().build(), requestOptions); + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public CompletableFuture> delete( + String id, DeleteMethodsRequest request) { + return delete(id, request, null); + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public CompletableFuture> delete( + String id, DeleteMethodsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts/methods") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteMethodsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Changes the label used to identify a saved payout method. + */ + public CompletableFuture> update( + String id, UpdateMethodsRequest request) { + return update(id, request, null); + } + + /** + * Changes the label used to identify a saved payout method. + */ + public CompletableFuture> update( + String id, UpdateMethodsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts/methods") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateMethodsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/MethodsClient.java b/src/main/java/com/whop/api/resources/payouts/methods/MethodsClient.java new file mode 100644 index 00000000..fa315b4d --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/MethodsClient.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.payouts.methods.requests.CreateMethodsRequest; +import com.whop.api.resources.payouts.methods.requests.DeleteMethodsRequest; +import com.whop.api.resources.payouts.methods.requests.ListMethodsRequest; +import com.whop.api.resources.payouts.methods.requests.UpdateMethodsRequest; +import com.whop.api.resources.payouts.methods.types.CreateMethodsResponse; +import com.whop.api.resources.payouts.methods.types.DeleteMethodsResponse; +import com.whop.api.resources.payouts.methods.types.ListMethodsResponseDataItem; +import com.whop.api.resources.payouts.methods.types.UpdateMethodsResponse; + +public class MethodsClient { + protected final ClientOptions clientOptions; + + private final RawMethodsClient rawClient; + + public MethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawMethodsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawMethodsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public SyncPagingIterable list(ListMethodsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public SyncPagingIterable list( + ListMethodsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Saves a new place an account or user can withdraw to. Sensitive details are vaulted in transit and never stored raw. + */ + public CreateMethodsResponse create(CreateMethodsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Saves a new place an account or user can withdraw to. Sensitive details are vaulted in transit and never stored raw. + */ + public CreateMethodsResponse create(CreateMethodsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public DeleteMethodsResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public DeleteMethodsResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public DeleteMethodsResponse delete(String id, DeleteMethodsRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public DeleteMethodsResponse delete(String id, DeleteMethodsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Changes the label used to identify a saved payout method. + */ + public UpdateMethodsResponse update(String id, UpdateMethodsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Changes the label used to identify a saved payout method. + */ + public UpdateMethodsResponse update(String id, UpdateMethodsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/RawMethodsClient.java b/src/main/java/com/whop/api/resources/payouts/methods/RawMethodsClient.java new file mode 100644 index 00000000..e5035271 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/RawMethodsClient.java @@ -0,0 +1,398 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.payouts.methods.requests.CreateMethodsRequest; +import com.whop.api.resources.payouts.methods.requests.DeleteMethodsRequest; +import com.whop.api.resources.payouts.methods.requests.ListMethodsRequest; +import com.whop.api.resources.payouts.methods.requests.UpdateMethodsRequest; +import com.whop.api.resources.payouts.methods.types.CreateMethodsResponse; +import com.whop.api.resources.payouts.methods.types.DeleteMethodsResponse; +import com.whop.api.resources.payouts.methods.types.ListMethodsResponse; +import com.whop.api.resources.payouts.methods.types.ListMethodsResponseDataItem; +import com.whop.api.resources.payouts.methods.types.UpdateMethodsResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawMethodsClient { + protected final ClientOptions clientOptions; + + public RawMethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public WhopApiHttpResponse> list() { + return list(ListMethodsRequest.builder().build()); + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListMethodsRequest.builder().build(), requestOptions); + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public WhopApiHttpResponse> list(ListMethodsRequest request) { + return list(request, null); + } + + /** + * Lists the bank accounts, wallets, and crypto addresses an account or user can withdraw to, newest first. + */ + public WhopApiHttpResponse> list( + ListMethodsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts/methods"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getAmount().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "amount", request.getAmount().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getIncludeLimits().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "include_limits", request.getIncludeLimits().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListMethodsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListMethodsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListMethodsRequest nextRequest = ListMethodsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Saves a new place an account or user can withdraw to. Sensitive details are vaulted in transit and never stored raw. + */ + public WhopApiHttpResponse create(CreateMethodsRequest request) { + return create(request, null); + } + + /** + * Saves a new place an account or user can withdraw to. Sensitive details are vaulted in transit and never stored raw. + */ + public WhopApiHttpResponse create( + CreateMethodsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts/methods"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateMethodsResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteMethodsRequest.builder().build()); + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteMethodsRequest.builder().build(), requestOptions); + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public WhopApiHttpResponse delete(String id, DeleteMethodsRequest request) { + return delete(id, request, null); + } + + /** + * Deletes a saved payout method so it can no longer receive payouts. + */ + public WhopApiHttpResponse delete( + String id, DeleteMethodsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts/methods") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteMethodsResponse.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Changes the label used to identify a saved payout method. + */ + public WhopApiHttpResponse update(String id, UpdateMethodsRequest request) { + return update(id, request, null); + } + + /** + * Changes the label used to identify a saved payout method. + */ + public WhopApiHttpResponse update( + String id, UpdateMethodsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts/methods") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateMethodsResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/requests/CreateMethodsRequest.java b/src/main/java/com/whop/api/resources/payouts/methods/requests/CreateMethodsRequest.java new file mode 100644 index 00000000..4539b6d8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/requests/CreateMethodsRequest.java @@ -0,0 +1,407 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateMethodsRequest.Builder.class) +public final class CreateMethodsRequest { + private final Optional accountId; + + private final Optional destinationCurrency; + + private final Optional> fields; + + private final Optional isDefault; + + private final Optional nickname; + + private final String supportedPayoutMethodId; + + private final Optional userId; + + private final Map additionalProperties; + + private CreateMethodsRequest( + Optional accountId, + Optional destinationCurrency, + Optional> fields, + Optional isDefault, + Optional nickname, + String supportedPayoutMethodId, + Optional userId, + Map additionalProperties) { + this.accountId = accountId; + this.destinationCurrency = destinationCurrency; + this.fields = fields; + this.isDefault = isDefault; + this.nickname = nickname; + this.supportedPayoutMethodId = supportedPayoutMethodId; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account to add the payout method for, prefixed biz_. Provide this or user_id. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Currency the supported payout method delivers payouts in. + */ + @JsonProperty("destination_currency") + public Optional getDestinationCurrency() { + return destinationCurrency; + } + + /** + * @return The supported payout method's required field values, keyed by field id — list them with GET /payouts/supported_methods?supported_payout_method_id=.... Field ids are stable fld_ identifiers you may hardcode; they never change for a given field. A Basis Theory token id may be passed in place of a raw value. For a U.S. bank routing-number field, a raw nine-digit value must also pass the ABA checksum. A validation failure returns the method's full required_fields schema alongside the error. Required whenever the account details are supplied directly. + */ + @JsonProperty("fields") + public Optional> getFields() { + return fields; + } + + /** + * @return Whether to make this the account's default payout method. + */ + @JsonProperty("is_default") + public Optional getIsDefault() { + return isDefault; + } + + /** + * @return A label for the payout method, unique per destination. + */ + @JsonProperty("nickname") + public Optional getNickname() { + return nickname; + } + + /** + * @return The supported payout method to save (a podst_ identifier from a previous listing). + */ + @JsonProperty("supported_payout_method_id") + public String getSupportedPayoutMethodId() { + return supportedPayoutMethodId; + } + + /** + * @return The user to add the payout method for, prefixed user_. Provide this or account_id. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateMethodsRequest && equalTo((CreateMethodsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateMethodsRequest other) { + return accountId.equals(other.accountId) + && destinationCurrency.equals(other.destinationCurrency) + && fields.equals(other.fields) + && isDefault.equals(other.isDefault) + && nickname.equals(other.nickname) + && supportedPayoutMethodId.equals(other.supportedPayoutMethodId) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.destinationCurrency, + this.fields, + this.isDefault, + this.nickname, + this.supportedPayoutMethodId, + this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SupportedPayoutMethodIdStage builder() { + return new Builder(); + } + + public interface SupportedPayoutMethodIdStage { + /** + *

The supported payout method to save (a podst_ identifier from a previous listing).

+ */ + _FinalStage supportedPayoutMethodId(@NotNull String supportedPayoutMethodId); + + Builder from(CreateMethodsRequest other); + } + + public interface _FinalStage { + CreateMethodsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account to add the payout method for, prefixed biz_. Provide this or user_id.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + /** + *

Currency the supported payout method delivers payouts in.

+ */ + _FinalStage destinationCurrency(Optional destinationCurrency); + + _FinalStage destinationCurrency(String destinationCurrency); + + /** + *

The supported payout method's required field values, keyed by field id — list them with GET /payouts/supported_methods?supported_payout_method_id=.... Field ids are stable fld_ identifiers you may hardcode; they never change for a given field. A Basis Theory token id may be passed in place of a raw value. For a U.S. bank routing-number field, a raw nine-digit value must also pass the ABA checksum. A validation failure returns the method's full required_fields schema alongside the error. Required whenever the account details are supplied directly.

+ */ + _FinalStage fields(Optional> fields); + + _FinalStage fields(Map fields); + + /** + *

Whether to make this the account's default payout method.

+ */ + _FinalStage isDefault(Optional isDefault); + + _FinalStage isDefault(Boolean isDefault); + + /** + *

A label for the payout method, unique per destination.

+ */ + _FinalStage nickname(Optional nickname); + + _FinalStage nickname(String nickname); + + /** + *

The user to add the payout method for, prefixed user_. Provide this or account_id.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SupportedPayoutMethodIdStage, _FinalStage { + private String supportedPayoutMethodId; + + private Optional userId = Optional.empty(); + + private Optional nickname = Optional.empty(); + + private Optional isDefault = Optional.empty(); + + private Optional> fields = Optional.empty(); + + private Optional destinationCurrency = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateMethodsRequest other) { + accountId(other.getAccountId()); + destinationCurrency(other.getDestinationCurrency()); + fields(other.getFields()); + isDefault(other.getIsDefault()); + nickname(other.getNickname()); + supportedPayoutMethodId(other.getSupportedPayoutMethodId()); + userId(other.getUserId()); + return this; + } + + /** + *

The supported payout method to save (a podst_ identifier from a previous listing).

+ *

The supported payout method to save (a podst_ identifier from a previous listing).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("supported_payout_method_id") + public _FinalStage supportedPayoutMethodId(@NotNull String supportedPayoutMethodId) { + this.supportedPayoutMethodId = + Objects.requireNonNull(supportedPayoutMethodId, "supportedPayoutMethodId must not be null"); + return this; + } + + /** + *

The user to add the payout method for, prefixed user_. Provide this or account_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

The user to add the payout method for, prefixed user_. Provide this or account_id.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

A label for the payout method, unique per destination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(String nickname) { + this.nickname = Optional.ofNullable(nickname); + return this; + } + + /** + *

A label for the payout method, unique per destination.

+ */ + @java.lang.Override + @JsonSetter(value = "nickname", nulls = Nulls.SKIP) + public _FinalStage nickname(Optional nickname) { + this.nickname = nickname; + return this; + } + + /** + *

Whether to make this the account's default payout method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage isDefault(Boolean isDefault) { + this.isDefault = Optional.ofNullable(isDefault); + return this; + } + + /** + *

Whether to make this the account's default payout method.

+ */ + @java.lang.Override + @JsonSetter(value = "is_default", nulls = Nulls.SKIP) + public _FinalStage isDefault(Optional isDefault) { + this.isDefault = isDefault; + return this; + } + + /** + *

The supported payout method's required field values, keyed by field id — list them with GET /payouts/supported_methods?supported_payout_method_id=.... Field ids are stable fld_ identifiers you may hardcode; they never change for a given field. A Basis Theory token id may be passed in place of a raw value. For a U.S. bank routing-number field, a raw nine-digit value must also pass the ABA checksum. A validation failure returns the method's full required_fields schema alongside the error. Required whenever the account details are supplied directly.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fields(Map fields) { + this.fields = Optional.ofNullable(fields); + return this; + } + + /** + *

The supported payout method's required field values, keyed by field id — list them with GET /payouts/supported_methods?supported_payout_method_id=.... Field ids are stable fld_ identifiers you may hardcode; they never change for a given field. A Basis Theory token id may be passed in place of a raw value. For a U.S. bank routing-number field, a raw nine-digit value must also pass the ABA checksum. A validation failure returns the method's full required_fields schema alongside the error. Required whenever the account details are supplied directly.

+ */ + @java.lang.Override + @JsonSetter(value = "fields", nulls = Nulls.SKIP) + public _FinalStage fields(Optional> fields) { + this.fields = fields; + return this; + } + + /** + *

Currency the supported payout method delivers payouts in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationCurrency(String destinationCurrency) { + this.destinationCurrency = Optional.ofNullable(destinationCurrency); + return this; + } + + /** + *

Currency the supported payout method delivers payouts in.

+ */ + @java.lang.Override + @JsonSetter(value = "destination_currency", nulls = Nulls.SKIP) + public _FinalStage destinationCurrency(Optional destinationCurrency) { + this.destinationCurrency = destinationCurrency; + return this; + } + + /** + *

The account to add the payout method for, prefixed biz_. Provide this or user_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account to add the payout method for, prefixed biz_. Provide this or user_id.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public CreateMethodsRequest build() { + return new CreateMethodsRequest( + accountId, + destinationCurrency, + fields, + isDefault, + nickname, + supportedPayoutMethodId, + userId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/requests/DeleteMethodsRequest.java b/src/main/java/com/whop/api/resources/payouts/methods/requests/DeleteMethodsRequest.java new file mode 100644 index 00000000..a32ef5c4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/requests/DeleteMethodsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteMethodsRequest.Builder.class) +public final class DeleteMethodsRequest { + private final Map additionalProperties; + + private DeleteMethodsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteMethodsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteMethodsRequest other) { + return this; + } + + public DeleteMethodsRequest build() { + return new DeleteMethodsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/requests/ListMethodsRequest.java b/src/main/java/com/whop/api/resources/payouts/methods/requests/ListMethodsRequest.java new file mode 100644 index 00000000..fa5c8555 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/requests/ListMethodsRequest.java @@ -0,0 +1,405 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.payouts.methods.types.ListMethodsRequestStatus; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMethodsRequest.Builder.class) +public final class ListMethodsRequest { + private final Optional accountId; + + private final Optional userId; + + private final Optional status; + + private final Optional amount; + + private final Optional currency; + + private final Optional includeLimits; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListMethodsRequest( + Optional accountId, + Optional userId, + Optional status, + Optional amount, + Optional currency, + Optional includeLimits, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.accountId = accountId; + this.userId = userId; + this.status = status; + this.amount = amount; + this.currency = currency; + this.includeLimits = includeLimits; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return The owning account ID (a biz_ identifier). Provide this or user_id. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The owning user ID (a user_ identifier). Provide this or account_id. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + /** + * @return Optional status filter. created means saved but unused, active means a payout through it succeeded, broken means the last payout failed and the method needs fixing. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Optional withdrawal amount in whole currency units, for example 250.00. When provided, each method includes a quote with the estimated fee, amount received, and delivery date for that amount. + */ + @JsonProperty("amount") + public Optional getAmount() { + return amount; + } + + /** + * @return Currency code of the amount, for example usd. Only meaningful with amount or include_limits. + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + /** + * @return When true, the response also carries limits — the live per-speed payout caps the account's payout requests are validated against, in the requested currency. Requires the payout:withdrawal:read scope. + */ + @JsonProperty("include_limits") + public Optional getIncludeLimits() { + return includeLimits; + } + + /** + * @return Number of payout methods to return from the start of the window. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to fetch the page after (from page_info.end_cursor). + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return Number of payout methods to return from the end of the window. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to fetch the page before (from page_info.start_cursor). + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMethodsRequest && equalTo((ListMethodsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMethodsRequest other) { + return accountId.equals(other.accountId) + && userId.equals(other.userId) + && status.equals(other.status) + && amount.equals(other.amount) + && currency.equals(other.currency) + && includeLimits.equals(other.includeLimits) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.userId, + this.status, + this.amount, + this.currency, + this.includeLimits, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional amount = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional includeLimits = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListMethodsRequest other) { + accountId(other.getAccountId()); + userId(other.getUserId()); + status(other.getStatus()); + amount(other.getAmount()); + currency(other.getCurrency()); + includeLimits(other.getIncludeLimits()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

The owning account ID (a biz_ identifier). Provide this or user_id.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The owning user ID (a user_ identifier). Provide this or account_id.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Optional status filter. created means saved but unused, active means a payout through it succeeded, broken means the last payout failed and the method needs fixing.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListMethodsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Optional withdrawal amount in whole currency units, for example 250.00. When provided, each method includes a quote with the estimated fee, amount received, and delivery date for that amount.

+ */ + @JsonSetter(value = "amount", nulls = Nulls.SKIP) + public Builder amount(Optional amount) { + this.amount = amount; + return this; + } + + public Builder amount(Double amount) { + this.amount = Optional.ofNullable(amount); + return this; + } + + /** + *

Currency code of the amount, for example usd. Only meaningful with amount or include_limits.

+ */ + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional currency) { + this.currency = currency; + return this; + } + + public Builder currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

When true, the response also carries limits — the live per-speed payout caps the account's payout requests are validated against, in the requested currency. Requires the payout:withdrawal:read scope.

+ */ + @JsonSetter(value = "include_limits", nulls = Nulls.SKIP) + public Builder includeLimits(Optional includeLimits) { + this.includeLimits = includeLimits; + return this; + } + + public Builder includeLimits(Boolean includeLimits) { + this.includeLimits = Optional.ofNullable(includeLimits); + return this; + } + + /** + *

Number of payout methods to return from the start of the window.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Number of payout methods to return from the end of the window.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to fetch the page before (from page_info.start_cursor).

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListMethodsRequest build() { + return new ListMethodsRequest( + accountId, + userId, + status, + amount, + currency, + includeLimits, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/requests/UpdateMethodsRequest.java b/src/main/java/com/whop/api/resources/payouts/methods/requests/UpdateMethodsRequest.java new file mode 100644 index 00000000..82cec147 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/requests/UpdateMethodsRequest.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateMethodsRequest.Builder.class) +public final class UpdateMethodsRequest { + private final String nickname; + + private final Map additionalProperties; + + private UpdateMethodsRequest(String nickname, Map additionalProperties) { + this.nickname = nickname; + this.additionalProperties = additionalProperties; + } + + /** + * @return New label for the payout method, with at least one non-whitespace character and a maximum of 100 characters. + */ + @JsonProperty("nickname") + public String getNickname() { + return nickname; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateMethodsRequest && equalTo((UpdateMethodsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateMethodsRequest other) { + return nickname.equals(other.nickname); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.nickname); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NicknameStage builder() { + return new Builder(); + } + + public interface NicknameStage { + /** + *

New label for the payout method, with at least one non-whitespace character and a maximum of 100 characters.

+ */ + _FinalStage nickname(@NotNull String nickname); + + Builder from(UpdateMethodsRequest other); + } + + public interface _FinalStage { + UpdateMethodsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NicknameStage, _FinalStage { + private String nickname; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateMethodsRequest other) { + nickname(other.getNickname()); + return this; + } + + /** + *

New label for the payout method, with at least one non-whitespace character and a maximum of 100 characters.

+ *

New label for the payout method, with at least one non-whitespace character and a maximum of 100 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("nickname") + public _FinalStage nickname(@NotNull String nickname) { + this.nickname = Objects.requireNonNull(nickname, "nickname must not be null"); + return this; + } + + @java.lang.Override + public UpdateMethodsRequest build() { + return new UpdateMethodsRequest(nickname, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponse.java b/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponse.java new file mode 100644 index 00000000..570d0e5d --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponse.java @@ -0,0 +1,1241 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateMethodsResponse.Builder.class) +public final class CreateMethodsResponse { + private final Optional accountReference; + + private final Optional bankVerificationState; + + private final OffsetDateTime createdAt; + + private final String destinationCurrency; + + private final Optional> estimatedArrival; + + private final Optional> feeStructure; + + private final String id; + + private final Optional institutionName; + + private final Optional isClone; + + private final boolean isDefault; + + private final Optional lastPaidOutAt; + + private final Optional linkedViaPlaid; + + private final Optional needsPlaidReconnect; + + private final Optional nickname; + + private final CreateMethodsResponseObject object; + + private final Optional payerName; + + private final Optional> quote; + + private final CreateMethodsResponseStatus status; + + private final Optional statusReason; + + private final Optional supportedPayoutMethod; + + private final Optional unavailableReason; + + private final Map additionalProperties; + + private CreateMethodsResponse( + Optional accountReference, + Optional bankVerificationState, + OffsetDateTime createdAt, + String destinationCurrency, + Optional> estimatedArrival, + Optional> feeStructure, + String id, + Optional institutionName, + Optional isClone, + boolean isDefault, + Optional lastPaidOutAt, + Optional linkedViaPlaid, + Optional needsPlaidReconnect, + Optional nickname, + CreateMethodsResponseObject object, + Optional payerName, + Optional> quote, + CreateMethodsResponseStatus status, + Optional statusReason, + Optional supportedPayoutMethod, + Optional unavailableReason, + Map additionalProperties) { + this.accountReference = accountReference; + this.bankVerificationState = bankVerificationState; + this.createdAt = createdAt; + this.destinationCurrency = destinationCurrency; + this.estimatedArrival = estimatedArrival; + this.feeStructure = feeStructure; + this.id = id; + this.institutionName = institutionName; + this.isClone = isClone; + this.isDefault = isDefault; + this.lastPaidOutAt = lastPaidOutAt; + this.linkedViaPlaid = linkedViaPlaid; + this.needsPlaidReconnect = needsPlaidReconnect; + this.nickname = nickname; + this.object = object; + this.payerName = payerName; + this.quote = quote; + this.status = status; + this.statusReason = statusReason; + this.supportedPayoutMethod = supportedPayoutMethod; + this.unavailableReason = unavailableReason; + this.additionalProperties = additionalProperties; + } + + /** + * @return Masked identifier for the destination. + */ + @JsonIgnore + public Optional getAccountReference() { + if (accountReference == null) { + return Optional.empty(); + } + return accountReference; + } + + /** + * @return Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked). + */ + @JsonIgnore + public Optional getBankVerificationState() { + if (bankVerificationState == null) { + return Optional.empty(); + } + return bankVerificationState; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("destination_currency") + public String getDestinationCurrency() { + return destinationCurrency; + } + + /** + * @return Null on create. List payout methods to retrieve arrival estimates. + */ + @JsonIgnore + public Optional> getEstimatedArrival() { + if (estimatedArrival == null) { + return Optional.empty(); + } + return estimatedArrival; + } + + /** + * @return Null on create. List payout methods to retrieve the configured fee terms. + */ + @JsonIgnore + public Optional> getFeeStructure() { + if (feeStructure == null) { + return Optional.empty(); + } + return feeStructure; + } + + /** + * @return Payout method ID, usable as payout_method_id on POST /payouts. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getInstitutionName() { + if (institutionName == null) { + return Optional.empty(); + } + return institutionName; + } + + /** + * @return Whether this method is a copy of one saved on another of the payer's accounts. + */ + @JsonProperty("is_clone") + public Optional getIsClone() { + return isClone; + } + + @JsonProperty("is_default") + public boolean getIsDefault() { + return isDefault; + } + + /** + * @return When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet. + */ + @JsonIgnore + public Optional getLastPaidOutAt() { + if (lastPaidOutAt == null) { + return Optional.empty(); + } + return lastPaidOutAt; + } + + /** + * @return Whether the payer added this method by signing in to their bank rather than typing account details. + */ + @JsonProperty("linked_via_plaid") + public Optional getLinkedViaPlaid() { + return linkedViaPlaid; + } + + /** + * @return Whether the bank sign-in behind this method has expired and must be redone before it counts as linked. + */ + @JsonProperty("needs_plaid_reconnect") + public Optional getNeedsPlaidReconnect() { + return needsPlaidReconnect; + } + + /** + * @return User-defined label for the payout method. + */ + @JsonIgnore + public Optional getNickname() { + if (nickname == null) { + return Optional.empty(); + } + return nickname; + } + + @JsonProperty("object") + public CreateMethodsResponseObject getObject() { + return object; + } + + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + /** + * @return Always null on create. + */ + @JsonIgnore + public Optional> getQuote() { + if (quote == null) { + return Optional.empty(); + } + return quote; + } + + /** + * @return Always created on create — no payout has used the method yet. + */ + @JsonProperty("status") + public CreateMethodsResponseStatus getStatus() { + return status; + } + + /** + * @return Always null on create. + */ + @JsonIgnore + public Optional getStatusReason() { + if (statusReason == null) { + return Optional.empty(); + } + return statusReason; + } + + @JsonIgnore + public Optional getSupportedPayoutMethod() { + if (supportedPayoutMethod == null) { + return Optional.empty(); + } + return supportedPayoutMethod; + } + + /** + * @return Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known. + */ + @JsonIgnore + public Optional getUnavailableReason() { + if (unavailableReason == null) { + return Optional.empty(); + } + return unavailableReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_reference") + private Optional _getAccountReference() { + return accountReference; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bank_verification_state") + private Optional _getBankVerificationState() { + return bankVerificationState; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("estimated_arrival") + private Optional> _getEstimatedArrival() { + return estimatedArrival; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fee_structure") + private Optional> _getFeeStructure() { + return feeStructure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("institution_name") + private Optional _getInstitutionName() { + return institutionName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_paid_out_at") + private Optional _getLastPaidOutAt() { + return lastPaidOutAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("nickname") + private Optional _getNickname() { + return nickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("quote") + private Optional> _getQuote() { + return quote; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status_reason") + private Optional _getStatusReason() { + return statusReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("supported_payout_method") + private Optional _getSupportedPayoutMethod() { + return supportedPayoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("unavailable_reason") + private Optional _getUnavailableReason() { + return unavailableReason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateMethodsResponse && equalTo((CreateMethodsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateMethodsResponse other) { + return accountReference.equals(other.accountReference) + && bankVerificationState.equals(other.bankVerificationState) + && createdAt.equals(other.createdAt) + && destinationCurrency.equals(other.destinationCurrency) + && estimatedArrival.equals(other.estimatedArrival) + && feeStructure.equals(other.feeStructure) + && id.equals(other.id) + && institutionName.equals(other.institutionName) + && isClone.equals(other.isClone) + && isDefault == other.isDefault + && lastPaidOutAt.equals(other.lastPaidOutAt) + && linkedViaPlaid.equals(other.linkedViaPlaid) + && needsPlaidReconnect.equals(other.needsPlaidReconnect) + && nickname.equals(other.nickname) + && object.equals(other.object) + && payerName.equals(other.payerName) + && quote.equals(other.quote) + && status.equals(other.status) + && statusReason.equals(other.statusReason) + && supportedPayoutMethod.equals(other.supportedPayoutMethod) + && unavailableReason.equals(other.unavailableReason); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountReference, + this.bankVerificationState, + this.createdAt, + this.destinationCurrency, + this.estimatedArrival, + this.feeStructure, + this.id, + this.institutionName, + this.isClone, + this.isDefault, + this.lastPaidOutAt, + this.linkedViaPlaid, + this.needsPlaidReconnect, + this.nickname, + this.object, + this.payerName, + this.quote, + this.status, + this.statusReason, + this.supportedPayoutMethod, + this.unavailableReason); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + DestinationCurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(CreateMethodsResponse other); + } + + public interface DestinationCurrencyStage { + IdStage destinationCurrency(@NotNull String destinationCurrency); + } + + public interface IdStage { + /** + *

Payout method ID, usable as payout_method_id on POST /payouts.

+ */ + IsDefaultStage id(@NotNull String id); + } + + public interface IsDefaultStage { + ObjectStage isDefault(boolean isDefault); + } + + public interface ObjectStage { + StatusStage object(@NotNull CreateMethodsResponseObject object); + } + + public interface StatusStage { + /** + *

Always created on create — no payout has used the method yet.

+ */ + _FinalStage status(@NotNull CreateMethodsResponseStatus status); + } + + public interface _FinalStage { + CreateMethodsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Masked identifier for the destination.

+ */ + _FinalStage accountReference(Optional accountReference); + + _FinalStage accountReference(String accountReference); + + _FinalStage accountReference(Nullable accountReference); + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ */ + _FinalStage bankVerificationState(Optional bankVerificationState); + + _FinalStage bankVerificationState(CreateMethodsResponseBankVerificationState bankVerificationState); + + _FinalStage bankVerificationState(Nullable bankVerificationState); + + /** + *

Null on create. List payout methods to retrieve arrival estimates.

+ */ + _FinalStage estimatedArrival(Optional> estimatedArrival); + + _FinalStage estimatedArrival(Map estimatedArrival); + + _FinalStage estimatedArrival(Nullable> estimatedArrival); + + /** + *

Null on create. List payout methods to retrieve the configured fee terms.

+ */ + _FinalStage feeStructure(Optional> feeStructure); + + _FinalStage feeStructure(Map feeStructure); + + _FinalStage feeStructure(Nullable> feeStructure); + + _FinalStage institutionName(Optional institutionName); + + _FinalStage institutionName(String institutionName); + + _FinalStage institutionName(Nullable institutionName); + + /** + *

Whether this method is a copy of one saved on another of the payer's accounts.

+ */ + _FinalStage isClone(Optional isClone); + + _FinalStage isClone(Boolean isClone); + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ */ + _FinalStage lastPaidOutAt(Optional lastPaidOutAt); + + _FinalStage lastPaidOutAt(OffsetDateTime lastPaidOutAt); + + _FinalStage lastPaidOutAt(Nullable lastPaidOutAt); + + /** + *

Whether the payer added this method by signing in to their bank rather than typing account details.

+ */ + _FinalStage linkedViaPlaid(Optional linkedViaPlaid); + + _FinalStage linkedViaPlaid(Boolean linkedViaPlaid); + + /** + *

Whether the bank sign-in behind this method has expired and must be redone before it counts as linked.

+ */ + _FinalStage needsPlaidReconnect(Optional needsPlaidReconnect); + + _FinalStage needsPlaidReconnect(Boolean needsPlaidReconnect); + + /** + *

User-defined label for the payout method.

+ */ + _FinalStage nickname(Optional nickname); + + _FinalStage nickname(String nickname); + + _FinalStage nickname(Nullable nickname); + + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + + /** + *

Always null on create.

+ */ + _FinalStage quote(Optional> quote); + + _FinalStage quote(Map quote); + + _FinalStage quote(Nullable> quote); + + /** + *

Always null on create.

+ */ + _FinalStage statusReason(Optional statusReason); + + _FinalStage statusReason(String statusReason); + + _FinalStage statusReason(Nullable statusReason); + + _FinalStage supportedPayoutMethod(Optional supportedPayoutMethod); + + _FinalStage supportedPayoutMethod(CreateMethodsResponseSupportedPayoutMethod supportedPayoutMethod); + + _FinalStage supportedPayoutMethod(Nullable supportedPayoutMethod); + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ */ + _FinalStage unavailableReason(Optional unavailableReason); + + _FinalStage unavailableReason(CreateMethodsResponseUnavailableReason unavailableReason); + + _FinalStage unavailableReason(Nullable unavailableReason); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + DestinationCurrencyStage, + IdStage, + IsDefaultStage, + ObjectStage, + StatusStage, + _FinalStage { + private OffsetDateTime createdAt; + + private String destinationCurrency; + + private String id; + + private boolean isDefault; + + private CreateMethodsResponseObject object; + + private CreateMethodsResponseStatus status; + + private Optional unavailableReason = Optional.empty(); + + private Optional supportedPayoutMethod = Optional.empty(); + + private Optional statusReason = Optional.empty(); + + private Optional> quote = Optional.empty(); + + private Optional payerName = Optional.empty(); + + private Optional nickname = Optional.empty(); + + private Optional needsPlaidReconnect = Optional.empty(); + + private Optional linkedViaPlaid = Optional.empty(); + + private Optional lastPaidOutAt = Optional.empty(); + + private Optional isClone = Optional.empty(); + + private Optional institutionName = Optional.empty(); + + private Optional> feeStructure = Optional.empty(); + + private Optional> estimatedArrival = Optional.empty(); + + private Optional bankVerificationState = Optional.empty(); + + private Optional accountReference = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateMethodsResponse other) { + accountReference(other.getAccountReference()); + bankVerificationState(other.getBankVerificationState()); + createdAt(other.getCreatedAt()); + destinationCurrency(other.getDestinationCurrency()); + estimatedArrival(other.getEstimatedArrival()); + feeStructure(other.getFeeStructure()); + id(other.getId()); + institutionName(other.getInstitutionName()); + isClone(other.getIsClone()); + isDefault(other.getIsDefault()); + lastPaidOutAt(other.getLastPaidOutAt()); + linkedViaPlaid(other.getLinkedViaPlaid()); + needsPlaidReconnect(other.getNeedsPlaidReconnect()); + nickname(other.getNickname()); + object(other.getObject()); + payerName(other.getPayerName()); + quote(other.getQuote()); + status(other.getStatus()); + statusReason(other.getStatusReason()); + supportedPayoutMethod(other.getSupportedPayoutMethod()); + unavailableReason(other.getUnavailableReason()); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public DestinationCurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("destination_currency") + public IdStage destinationCurrency(@NotNull String destinationCurrency) { + this.destinationCurrency = + Objects.requireNonNull(destinationCurrency, "destinationCurrency must not be null"); + return this; + } + + /** + *

Payout method ID, usable as payout_method_id on POST /payouts.

+ *

Payout method ID, usable as payout_method_id on POST /payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsDefaultStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("is_default") + public ObjectStage isDefault(boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + @java.lang.Override + @JsonSetter("object") + public StatusStage object(@NotNull CreateMethodsResponseObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Always created on create — no payout has used the method yet.

+ *

Always created on create — no payout has used the method yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull CreateMethodsResponseStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage unavailableReason(Nullable unavailableReason) { + if (unavailableReason.isNull()) { + this.unavailableReason = null; + } else if (unavailableReason.isEmpty()) { + this.unavailableReason = Optional.empty(); + } else { + this.unavailableReason = Optional.of(unavailableReason.get()); + } + return this; + } + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage unavailableReason(CreateMethodsResponseUnavailableReason unavailableReason) { + this.unavailableReason = Optional.ofNullable(unavailableReason); + return this; + } + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ */ + @java.lang.Override + @JsonSetter(value = "unavailable_reason", nulls = Nulls.SKIP) + public _FinalStage unavailableReason(Optional unavailableReason) { + this.unavailableReason = unavailableReason; + return this; + } + + @java.lang.Override + public _FinalStage supportedPayoutMethod( + Nullable supportedPayoutMethod) { + if (supportedPayoutMethod.isNull()) { + this.supportedPayoutMethod = null; + } else if (supportedPayoutMethod.isEmpty()) { + this.supportedPayoutMethod = Optional.empty(); + } else { + this.supportedPayoutMethod = Optional.of(supportedPayoutMethod.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage supportedPayoutMethod(CreateMethodsResponseSupportedPayoutMethod supportedPayoutMethod) { + this.supportedPayoutMethod = Optional.ofNullable(supportedPayoutMethod); + return this; + } + + @java.lang.Override + @JsonSetter(value = "supported_payout_method", nulls = Nulls.SKIP) + public _FinalStage supportedPayoutMethod( + Optional supportedPayoutMethod) { + this.supportedPayoutMethod = supportedPayoutMethod; + return this; + } + + /** + *

Always null on create.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statusReason(Nullable statusReason) { + if (statusReason.isNull()) { + this.statusReason = null; + } else if (statusReason.isEmpty()) { + this.statusReason = Optional.empty(); + } else { + this.statusReason = Optional.of(statusReason.get()); + } + return this; + } + + /** + *

Always null on create.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statusReason(String statusReason) { + this.statusReason = Optional.ofNullable(statusReason); + return this; + } + + /** + *

Always null on create.

+ */ + @java.lang.Override + @JsonSetter(value = "status_reason", nulls = Nulls.SKIP) + public _FinalStage statusReason(Optional statusReason) { + this.statusReason = statusReason; + return this; + } + + /** + *

Always null on create.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quote(Nullable> quote) { + if (quote.isNull()) { + this.quote = null; + } else if (quote.isEmpty()) { + this.quote = Optional.empty(); + } else { + this.quote = Optional.of(quote.get()); + } + return this; + } + + /** + *

Always null on create.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quote(Map quote) { + this.quote = Optional.ofNullable(quote); + return this; + } + + /** + *

Always null on create.

+ */ + @java.lang.Override + @JsonSetter(value = "quote", nulls = Nulls.SKIP) + public _FinalStage quote(Optional> quote) { + this.quote = quote; + return this; + } + + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

User-defined label for the payout method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(Nullable nickname) { + if (nickname.isNull()) { + this.nickname = null; + } else if (nickname.isEmpty()) { + this.nickname = Optional.empty(); + } else { + this.nickname = Optional.of(nickname.get()); + } + return this; + } + + /** + *

User-defined label for the payout method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(String nickname) { + this.nickname = Optional.ofNullable(nickname); + return this; + } + + /** + *

User-defined label for the payout method.

+ */ + @java.lang.Override + @JsonSetter(value = "nickname", nulls = Nulls.SKIP) + public _FinalStage nickname(Optional nickname) { + this.nickname = nickname; + return this; + } + + /** + *

Whether the bank sign-in behind this method has expired and must be redone before it counts as linked.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage needsPlaidReconnect(Boolean needsPlaidReconnect) { + this.needsPlaidReconnect = Optional.ofNullable(needsPlaidReconnect); + return this; + } + + /** + *

Whether the bank sign-in behind this method has expired and must be redone before it counts as linked.

+ */ + @java.lang.Override + @JsonSetter(value = "needs_plaid_reconnect", nulls = Nulls.SKIP) + public _FinalStage needsPlaidReconnect(Optional needsPlaidReconnect) { + this.needsPlaidReconnect = needsPlaidReconnect; + return this; + } + + /** + *

Whether the payer added this method by signing in to their bank rather than typing account details.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage linkedViaPlaid(Boolean linkedViaPlaid) { + this.linkedViaPlaid = Optional.ofNullable(linkedViaPlaid); + return this; + } + + /** + *

Whether the payer added this method by signing in to their bank rather than typing account details.

+ */ + @java.lang.Override + @JsonSetter(value = "linked_via_plaid", nulls = Nulls.SKIP) + public _FinalStage linkedViaPlaid(Optional linkedViaPlaid) { + this.linkedViaPlaid = linkedViaPlaid; + return this; + } + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaidOutAt(Nullable lastPaidOutAt) { + if (lastPaidOutAt.isNull()) { + this.lastPaidOutAt = null; + } else if (lastPaidOutAt.isEmpty()) { + this.lastPaidOutAt = Optional.empty(); + } else { + this.lastPaidOutAt = Optional.of(lastPaidOutAt.get()); + } + return this; + } + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaidOutAt(OffsetDateTime lastPaidOutAt) { + this.lastPaidOutAt = Optional.ofNullable(lastPaidOutAt); + return this; + } + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ */ + @java.lang.Override + @JsonSetter(value = "last_paid_out_at", nulls = Nulls.SKIP) + public _FinalStage lastPaidOutAt(Optional lastPaidOutAt) { + this.lastPaidOutAt = lastPaidOutAt; + return this; + } + + /** + *

Whether this method is a copy of one saved on another of the payer's accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage isClone(Boolean isClone) { + this.isClone = Optional.ofNullable(isClone); + return this; + } + + /** + *

Whether this method is a copy of one saved on another of the payer's accounts.

+ */ + @java.lang.Override + @JsonSetter(value = "is_clone", nulls = Nulls.SKIP) + public _FinalStage isClone(Optional isClone) { + this.isClone = isClone; + return this; + } + + @java.lang.Override + public _FinalStage institutionName(Nullable institutionName) { + if (institutionName.isNull()) { + this.institutionName = null; + } else if (institutionName.isEmpty()) { + this.institutionName = Optional.empty(); + } else { + this.institutionName = Optional.of(institutionName.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage institutionName(String institutionName) { + this.institutionName = Optional.ofNullable(institutionName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "institution_name", nulls = Nulls.SKIP) + public _FinalStage institutionName(Optional institutionName) { + this.institutionName = institutionName; + return this; + } + + /** + *

Null on create. List payout methods to retrieve the configured fee terms.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeStructure(Nullable> feeStructure) { + if (feeStructure.isNull()) { + this.feeStructure = null; + } else if (feeStructure.isEmpty()) { + this.feeStructure = Optional.empty(); + } else { + this.feeStructure = Optional.of(feeStructure.get()); + } + return this; + } + + /** + *

Null on create. List payout methods to retrieve the configured fee terms.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeStructure(Map feeStructure) { + this.feeStructure = Optional.ofNullable(feeStructure); + return this; + } + + /** + *

Null on create. List payout methods to retrieve the configured fee terms.

+ */ + @java.lang.Override + @JsonSetter(value = "fee_structure", nulls = Nulls.SKIP) + public _FinalStage feeStructure(Optional> feeStructure) { + this.feeStructure = feeStructure; + return this; + } + + /** + *

Null on create. List payout methods to retrieve arrival estimates.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(Nullable> estimatedArrival) { + if (estimatedArrival.isNull()) { + this.estimatedArrival = null; + } else if (estimatedArrival.isEmpty()) { + this.estimatedArrival = Optional.empty(); + } else { + this.estimatedArrival = Optional.of(estimatedArrival.get()); + } + return this; + } + + /** + *

Null on create. List payout methods to retrieve arrival estimates.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(Map estimatedArrival) { + this.estimatedArrival = Optional.ofNullable(estimatedArrival); + return this; + } + + /** + *

Null on create. List payout methods to retrieve arrival estimates.

+ */ + @java.lang.Override + @JsonSetter(value = "estimated_arrival", nulls = Nulls.SKIP) + public _FinalStage estimatedArrival(Optional> estimatedArrival) { + this.estimatedArrival = estimatedArrival; + return this; + } + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bankVerificationState( + Nullable bankVerificationState) { + if (bankVerificationState.isNull()) { + this.bankVerificationState = null; + } else if (bankVerificationState.isEmpty()) { + this.bankVerificationState = Optional.empty(); + } else { + this.bankVerificationState = Optional.of(bankVerificationState.get()); + } + return this; + } + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bankVerificationState(CreateMethodsResponseBankVerificationState bankVerificationState) { + this.bankVerificationState = Optional.ofNullable(bankVerificationState); + return this; + } + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ */ + @java.lang.Override + @JsonSetter(value = "bank_verification_state", nulls = Nulls.SKIP) + public _FinalStage bankVerificationState( + Optional bankVerificationState) { + this.bankVerificationState = bankVerificationState; + return this; + } + + /** + *

Masked identifier for the destination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountReference(Nullable accountReference) { + if (accountReference.isNull()) { + this.accountReference = null; + } else if (accountReference.isEmpty()) { + this.accountReference = Optional.empty(); + } else { + this.accountReference = Optional.of(accountReference.get()); + } + return this; + } + + /** + *

Masked identifier for the destination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountReference(String accountReference) { + this.accountReference = Optional.ofNullable(accountReference); + return this; + } + + /** + *

Masked identifier for the destination.

+ */ + @java.lang.Override + @JsonSetter(value = "account_reference", nulls = Nulls.SKIP) + public _FinalStage accountReference(Optional accountReference) { + this.accountReference = accountReference; + return this; + } + + @java.lang.Override + public CreateMethodsResponse build() { + return new CreateMethodsResponse( + accountReference, + bankVerificationState, + createdAt, + destinationCurrency, + estimatedArrival, + feeStructure, + id, + institutionName, + isClone, + isDefault, + lastPaidOutAt, + linkedViaPlaid, + needsPlaidReconnect, + nickname, + object, + payerName, + quote, + status, + statusReason, + supportedPayoutMethod, + unavailableReason, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseBankVerificationState.java b/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseBankVerificationState.java new file mode 100644 index 00000000..9dc256fb --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseBankVerificationState.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateMethodsResponseBankVerificationState { + public static final CreateMethodsResponseBankVerificationState NO_DATA = + new CreateMethodsResponseBankVerificationState(Value.NO_DATA, "no_data"); + + public static final CreateMethodsResponseBankVerificationState CHECKING = + new CreateMethodsResponseBankVerificationState(Value.CHECKING, "checking"); + + public static final CreateMethodsResponseBankVerificationState WARNING = + new CreateMethodsResponseBankVerificationState(Value.WARNING, "warning"); + + public static final CreateMethodsResponseBankVerificationState VERIFIED = + new CreateMethodsResponseBankVerificationState(Value.VERIFIED, "verified"); + + public static final CreateMethodsResponseBankVerificationState BROKEN = + new CreateMethodsResponseBankVerificationState(Value.BROKEN, "broken"); + + private final Value value; + + private final String string; + + CreateMethodsResponseBankVerificationState(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateMethodsResponseBankVerificationState + && this.string.equals(((CreateMethodsResponseBankVerificationState) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NO_DATA: + return visitor.visitNoData(); + case CHECKING: + return visitor.visitChecking(); + case WARNING: + return visitor.visitWarning(); + case VERIFIED: + return visitor.visitVerified(); + case BROKEN: + return visitor.visitBroken(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateMethodsResponseBankVerificationState valueOf(String value) { + switch (value) { + case "no_data": + return NO_DATA; + case "checking": + return CHECKING; + case "warning": + return WARNING; + case "verified": + return VERIFIED; + case "broken": + return BROKEN; + default: + return new CreateMethodsResponseBankVerificationState(Value.UNKNOWN, value); + } + } + + public enum Value { + CHECKING, + + VERIFIED, + + NO_DATA, + + WARNING, + + BROKEN, + + UNKNOWN + } + + public interface Visitor { + T visitChecking(); + + T visitVerified(); + + T visitNoData(); + + T visitWarning(); + + T visitBroken(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseObject.java b/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseObject.java new file mode 100644 index 00000000..554f1ac7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateMethodsResponseObject { + public static final CreateMethodsResponseObject PAYOUT_METHOD = + new CreateMethodsResponseObject(Value.PAYOUT_METHOD, "payout_method"); + + private final Value value; + + private final String string; + + CreateMethodsResponseObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateMethodsResponseObject + && this.string.equals(((CreateMethodsResponseObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYOUT_METHOD: + return visitor.visitPayoutMethod(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateMethodsResponseObject valueOf(String value) { + switch (value) { + case "payout_method": + return PAYOUT_METHOD; + default: + return new CreateMethodsResponseObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYOUT_METHOD, + + UNKNOWN + } + + public interface Visitor { + T visitPayoutMethod(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseStatus.java b/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseStatus.java new file mode 100644 index 00000000..909ad238 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseStatus.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateMethodsResponseStatus { + public static final CreateMethodsResponseStatus CREATED = new CreateMethodsResponseStatus(Value.CREATED, "created"); + + public static final CreateMethodsResponseStatus ACTIVE = new CreateMethodsResponseStatus(Value.ACTIVE, "active"); + + public static final CreateMethodsResponseStatus BROKEN = new CreateMethodsResponseStatus(Value.BROKEN, "broken"); + + private final Value value; + + private final String string; + + CreateMethodsResponseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateMethodsResponseStatus + && this.string.equals(((CreateMethodsResponseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED: + return visitor.visitCreated(); + case ACTIVE: + return visitor.visitActive(); + case BROKEN: + return visitor.visitBroken(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateMethodsResponseStatus valueOf(String value) { + switch (value) { + case "created": + return CREATED; + case "active": + return ACTIVE; + case "broken": + return BROKEN; + default: + return new CreateMethodsResponseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED, + + ACTIVE, + + BROKEN, + + UNKNOWN + } + + public interface Visitor { + T visitCreated(); + + T visitActive(); + + T visitBroken(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseSupportedPayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseSupportedPayoutMethod.java new file mode 100644 index 00000000..e503e31f --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseSupportedPayoutMethod.java @@ -0,0 +1,422 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateMethodsResponseSupportedPayoutMethod.Builder.class) +public final class CreateMethodsResponseSupportedPayoutMethod { + private final Optional countryCode; + + private final CreateMethodsResponseSupportedPayoutMethodDeliveryType deliveryType; + + private final Optional iconUrl; + + private final Optional name; + + private final boolean supportsInstantDelivery; + + private final Optional supportsPlaid; + + private final boolean supportsStandardDelivery; + + private final Map additionalProperties; + + private CreateMethodsResponseSupportedPayoutMethod( + Optional countryCode, + CreateMethodsResponseSupportedPayoutMethodDeliveryType deliveryType, + Optional iconUrl, + Optional name, + boolean supportsInstantDelivery, + Optional supportsPlaid, + boolean supportsStandardDelivery, + Map additionalProperties) { + this.countryCode = countryCode; + this.deliveryType = deliveryType; + this.iconUrl = iconUrl; + this.name = name; + this.supportsInstantDelivery = supportsInstantDelivery; + this.supportsPlaid = supportsPlaid; + this.supportsStandardDelivery = supportsStandardDelivery; + this.additionalProperties = additionalProperties; + } + + /** + * @return ISO 3166-1 alpha-3 country the destination pays out to. + */ + @JsonIgnore + public Optional getCountryCode() { + if (countryCode == null) { + return Optional.empty(); + } + return countryCode; + } + + /** + * @return How funds are delivered. + */ + @JsonProperty("delivery_type") + public CreateMethodsResponseSupportedPayoutMethodDeliveryType getDeliveryType() { + return deliveryType; + } + + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("supports_instant_delivery") + public boolean getSupportsInstantDelivery() { + return supportsInstantDelivery; + } + + /** + * @return Whether the payer can link this method by signing in to their bank instead of typing account details. + */ + @JsonProperty("supports_plaid") + public Optional getSupportsPlaid() { + return supportsPlaid; + } + + @JsonProperty("supports_standard_delivery") + public boolean getSupportsStandardDelivery() { + return supportsStandardDelivery; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country_code") + private Optional _getCountryCode() { + return countryCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateMethodsResponseSupportedPayoutMethod + && equalTo((CreateMethodsResponseSupportedPayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateMethodsResponseSupportedPayoutMethod other) { + return countryCode.equals(other.countryCode) + && deliveryType.equals(other.deliveryType) + && iconUrl.equals(other.iconUrl) + && name.equals(other.name) + && supportsInstantDelivery == other.supportsInstantDelivery + && supportsPlaid.equals(other.supportsPlaid) + && supportsStandardDelivery == other.supportsStandardDelivery; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.countryCode, + this.deliveryType, + this.iconUrl, + this.name, + this.supportsInstantDelivery, + this.supportsPlaid, + this.supportsStandardDelivery); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeliveryTypeStage builder() { + return new Builder(); + } + + public interface DeliveryTypeStage { + /** + *

How funds are delivered.

+ */ + SupportsInstantDeliveryStage deliveryType( + @NotNull CreateMethodsResponseSupportedPayoutMethodDeliveryType deliveryType); + + Builder from(CreateMethodsResponseSupportedPayoutMethod other); + } + + public interface SupportsInstantDeliveryStage { + SupportsStandardDeliveryStage supportsInstantDelivery(boolean supportsInstantDelivery); + } + + public interface SupportsStandardDeliveryStage { + _FinalStage supportsStandardDelivery(boolean supportsStandardDelivery); + } + + public interface _FinalStage { + CreateMethodsResponseSupportedPayoutMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ */ + _FinalStage countryCode(Optional countryCode); + + _FinalStage countryCode(String countryCode); + + _FinalStage countryCode(Nullable countryCode); + + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

Whether the payer can link this method by signing in to their bank instead of typing account details.

+ */ + _FinalStage supportsPlaid(Optional supportsPlaid); + + _FinalStage supportsPlaid(Boolean supportsPlaid); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements DeliveryTypeStage, SupportsInstantDeliveryStage, SupportsStandardDeliveryStage, _FinalStage { + private CreateMethodsResponseSupportedPayoutMethodDeliveryType deliveryType; + + private boolean supportsInstantDelivery; + + private boolean supportsStandardDelivery; + + private Optional supportsPlaid = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + private Optional countryCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateMethodsResponseSupportedPayoutMethod other) { + countryCode(other.getCountryCode()); + deliveryType(other.getDeliveryType()); + iconUrl(other.getIconUrl()); + name(other.getName()); + supportsInstantDelivery(other.getSupportsInstantDelivery()); + supportsPlaid(other.getSupportsPlaid()); + supportsStandardDelivery(other.getSupportsStandardDelivery()); + return this; + } + + /** + *

How funds are delivered.

+ *

How funds are delivered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("delivery_type") + public SupportsInstantDeliveryStage deliveryType( + @NotNull CreateMethodsResponseSupportedPayoutMethodDeliveryType deliveryType) { + this.deliveryType = Objects.requireNonNull(deliveryType, "deliveryType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("supports_instant_delivery") + public SupportsStandardDeliveryStage supportsInstantDelivery(boolean supportsInstantDelivery) { + this.supportsInstantDelivery = supportsInstantDelivery; + return this; + } + + @java.lang.Override + @JsonSetter("supports_standard_delivery") + public _FinalStage supportsStandardDelivery(boolean supportsStandardDelivery) { + this.supportsStandardDelivery = supportsStandardDelivery; + return this; + } + + /** + *

Whether the payer can link this method by signing in to their bank instead of typing account details.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage supportsPlaid(Boolean supportsPlaid) { + this.supportsPlaid = Optional.ofNullable(supportsPlaid); + return this; + } + + /** + *

Whether the payer can link this method by signing in to their bank instead of typing account details.

+ */ + @java.lang.Override + @JsonSetter(value = "supports_plaid", nulls = Nulls.SKIP) + public _FinalStage supportsPlaid(Optional supportsPlaid) { + this.supportsPlaid = supportsPlaid; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage countryCode(Nullable countryCode) { + if (countryCode.isNull()) { + this.countryCode = null; + } else if (countryCode.isEmpty()) { + this.countryCode = Optional.empty(); + } else { + this.countryCode = Optional.of(countryCode.get()); + } + return this; + } + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage countryCode(String countryCode) { + this.countryCode = Optional.ofNullable(countryCode); + return this; + } + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ */ + @java.lang.Override + @JsonSetter(value = "country_code", nulls = Nulls.SKIP) + public _FinalStage countryCode(Optional countryCode) { + this.countryCode = countryCode; + return this; + } + + @java.lang.Override + public CreateMethodsResponseSupportedPayoutMethod build() { + return new CreateMethodsResponseSupportedPayoutMethod( + countryCode, + deliveryType, + iconUrl, + name, + supportsInstantDelivery, + supportsPlaid, + supportsStandardDelivery, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseSupportedPayoutMethodDeliveryType.java b/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseSupportedPayoutMethodDeliveryType.java new file mode 100644 index 00000000..e0ef5ae9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseSupportedPayoutMethodDeliveryType.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateMethodsResponseSupportedPayoutMethodDeliveryType { + public static final CreateMethodsResponseSupportedPayoutMethodDeliveryType PAPER_CHECK = + new CreateMethodsResponseSupportedPayoutMethodDeliveryType(Value.PAPER_CHECK, "paper_check"); + + public static final CreateMethodsResponseSupportedPayoutMethodDeliveryType CRYPTOCURRENCY = + new CreateMethodsResponseSupportedPayoutMethodDeliveryType(Value.CRYPTOCURRENCY, "cryptocurrency"); + + public static final CreateMethodsResponseSupportedPayoutMethodDeliveryType UNKNOWN = + new CreateMethodsResponseSupportedPayoutMethodDeliveryType(Value.UNKNOWN, "unknown"); + + public static final CreateMethodsResponseSupportedPayoutMethodDeliveryType HOME_DELIVERY = + new CreateMethodsResponseSupportedPayoutMethodDeliveryType(Value.HOME_DELIVERY, "home_delivery"); + + public static final CreateMethodsResponseSupportedPayoutMethodDeliveryType BANK_DEPOSIT = + new CreateMethodsResponseSupportedPayoutMethodDeliveryType(Value.BANK_DEPOSIT, "bank_deposit"); + + public static final CreateMethodsResponseSupportedPayoutMethodDeliveryType MASSPAY_CARD = + new CreateMethodsResponseSupportedPayoutMethodDeliveryType(Value.MASSPAY_CARD, "masspay_card"); + + public static final CreateMethodsResponseSupportedPayoutMethodDeliveryType MOBILE_WALLET = + new CreateMethodsResponseSupportedPayoutMethodDeliveryType(Value.MOBILE_WALLET, "mobile_wallet"); + + public static final CreateMethodsResponseSupportedPayoutMethodDeliveryType CASH_PICKUP = + new CreateMethodsResponseSupportedPayoutMethodDeliveryType(Value.CASH_PICKUP, "cash_pickup"); + + public static final CreateMethodsResponseSupportedPayoutMethodDeliveryType BILL = + new CreateMethodsResponseSupportedPayoutMethodDeliveryType(Value.BILL, "bill"); + + private final Value value; + + private final String string; + + CreateMethodsResponseSupportedPayoutMethodDeliveryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateMethodsResponseSupportedPayoutMethodDeliveryType + && this.string.equals(((CreateMethodsResponseSupportedPayoutMethodDeliveryType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAPER_CHECK: + return visitor.visitPaperCheck(); + case CRYPTOCURRENCY: + return visitor.visitCryptocurrency(); + case UNKNOWN: + return visitor.visitUnknown(); + case HOME_DELIVERY: + return visitor.visitHomeDelivery(); + case BANK_DEPOSIT: + return visitor.visitBankDeposit(); + case MASSPAY_CARD: + return visitor.visitMasspayCard(); + case MOBILE_WALLET: + return visitor.visitMobileWallet(); + case CASH_PICKUP: + return visitor.visitCashPickup(); + case BILL: + return visitor.visitBill(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateMethodsResponseSupportedPayoutMethodDeliveryType valueOf(String value) { + switch (value) { + case "paper_check": + return PAPER_CHECK; + case "cryptocurrency": + return CRYPTOCURRENCY; + case "unknown": + return UNKNOWN; + case "home_delivery": + return HOME_DELIVERY; + case "bank_deposit": + return BANK_DEPOSIT; + case "masspay_card": + return MASSPAY_CARD; + case "mobile_wallet": + return MOBILE_WALLET; + case "cash_pickup": + return CASH_PICKUP; + case "bill": + return BILL; + default: + return new CreateMethodsResponseSupportedPayoutMethodDeliveryType(Value._UNKNOWN, value); + } + } + + public enum Value { + CASH_PICKUP, + + BANK_DEPOSIT, + + HOME_DELIVERY, + + MOBILE_WALLET, + + MASSPAY_CARD, + + PAPER_CHECK, + + BILL, + + CRYPTOCURRENCY, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitCashPickup(); + + T visitBankDeposit(); + + T visitHomeDelivery(); + + T visitMobileWallet(); + + T visitMasspayCard(); + + T visitPaperCheck(); + + T visitBill(); + + T visitCryptocurrency(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseUnavailableReason.java b/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseUnavailableReason.java new file mode 100644 index 00000000..f383ff72 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/CreateMethodsResponseUnavailableReason.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateMethodsResponseUnavailableReason { + public static final CreateMethodsResponseUnavailableReason DESTINATION_RETIRED = + new CreateMethodsResponseUnavailableReason(Value.DESTINATION_RETIRED, "destination_retired"); + + private final Value value; + + private final String string; + + CreateMethodsResponseUnavailableReason(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateMethodsResponseUnavailableReason + && this.string.equals(((CreateMethodsResponseUnavailableReason) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DESTINATION_RETIRED: + return visitor.visitDestinationRetired(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateMethodsResponseUnavailableReason valueOf(String value) { + switch (value) { + case "destination_retired": + return DESTINATION_RETIRED; + default: + return new CreateMethodsResponseUnavailableReason(Value.UNKNOWN, value); + } + } + + public enum Value { + DESTINATION_RETIRED, + + UNKNOWN + } + + public interface Visitor { + T visitDestinationRetired(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/DeleteMethodsResponse.java b/src/main/java/com/whop/api/resources/payouts/methods/types/DeleteMethodsResponse.java new file mode 100644 index 00000000..54cbe514 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/DeleteMethodsResponse.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteMethodsResponse.Builder.class) +public final class DeleteMethodsResponse { + private final boolean deleted; + + private final String id; + + private final Map additionalProperties; + + private DeleteMethodsResponse(boolean deleted, String id, Map additionalProperties) { + this.deleted = deleted; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Always true. + */ + @JsonProperty("deleted") + public boolean getDeleted() { + return deleted; + } + + /** + * @return ID of the deleted payout method, prefixed potk_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteMethodsResponse && equalTo((DeleteMethodsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteMethodsResponse other) { + return deleted == other.deleted && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deleted, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeletedStage builder() { + return new Builder(); + } + + public interface DeletedStage { + /** + *

Always true.

+ */ + IdStage deleted(boolean deleted); + + Builder from(DeleteMethodsResponse other); + } + + public interface IdStage { + /** + *

ID of the deleted payout method, prefixed potk_.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DeleteMethodsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeletedStage, IdStage, _FinalStage { + private boolean deleted; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeleteMethodsResponse other) { + deleted(other.getDeleted()); + id(other.getId()); + return this; + } + + /** + *

Always true.

+ *

Always true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("deleted") + public IdStage deleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + *

ID of the deleted payout method, prefixed potk_.

+ *

ID of the deleted payout method, prefixed potk_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DeleteMethodsResponse build() { + return new DeleteMethodsResponse(deleted, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsRequestStatus.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsRequestStatus.java new file mode 100644 index 00000000..708fb5de --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsRequestStatus.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListMethodsRequestStatus { + public static final ListMethodsRequestStatus CREATED = new ListMethodsRequestStatus(Value.CREATED, "created"); + + public static final ListMethodsRequestStatus ACTIVE = new ListMethodsRequestStatus(Value.ACTIVE, "active"); + + public static final ListMethodsRequestStatus BROKEN = new ListMethodsRequestStatus(Value.BROKEN, "broken"); + + private final Value value; + + private final String string; + + ListMethodsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListMethodsRequestStatus + && this.string.equals(((ListMethodsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED: + return visitor.visitCreated(); + case ACTIVE: + return visitor.visitActive(); + case BROKEN: + return visitor.visitBroken(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListMethodsRequestStatus valueOf(String value) { + switch (value) { + case "created": + return CREATED; + case "active": + return ACTIVE; + case "broken": + return BROKEN; + default: + return new ListMethodsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED, + + ACTIVE, + + BROKEN, + + UNKNOWN + } + + public interface Visitor { + T visitCreated(); + + T visitActive(); + + T visitBroken(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponse.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponse.java new file mode 100644 index 00000000..124830ae --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponse.java @@ -0,0 +1,208 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMethodsResponse.Builder.class) +public final class ListMethodsResponse { + private final List data; + + private final Optional limits; + + private final ListMethodsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListMethodsResponse( + List data, + Optional limits, + ListMethodsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.limits = limits; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return The live per-speed payout caps for the account in the requested currency — the numbers a payout request is validated against at submit time, so clients can cap an amount input at a value the request will accept. Only present when include_limits is true. + */ + @JsonProperty("limits") + public Optional getLimits() { + return limits; + } + + @JsonProperty("page_info") + public ListMethodsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMethodsResponse && equalTo((ListMethodsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMethodsResponse other) { + return data.equals(other.data) && limits.equals(other.limits) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.limits, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListMethodsResponsePageInfo pageInfo); + + Builder from(ListMethodsResponse other); + } + + public interface _FinalStage { + ListMethodsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ListMethodsResponseDataItem data); + + _FinalStage addAllData(List data); + + /** + *

The live per-speed payout caps for the account in the requested currency — the numbers a payout request is validated against at submit time, so clients can cap an amount input at a value the request will accept. Only present when include_limits is true.

+ */ + _FinalStage limits(Optional limits); + + _FinalStage limits(ListMethodsResponseLimits limits); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListMethodsResponsePageInfo pageInfo; + + private Optional limits = Optional.empty(); + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMethodsResponse other) { + data(other.getData()); + limits(other.getLimits()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListMethodsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

The live per-speed payout caps for the account in the requested currency — the numbers a payout request is validated against at submit time, so clients can cap an amount input at a value the request will accept. Only present when include_limits is true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limits(ListMethodsResponseLimits limits) { + this.limits = Optional.ofNullable(limits); + return this; + } + + /** + *

The live per-speed payout caps for the account in the requested currency — the numbers a payout request is validated against at submit time, so clients can cap an amount input at a value the request will accept. Only present when include_limits is true.

+ */ + @java.lang.Override + @JsonSetter(value = "limits", nulls = Nulls.SKIP) + public _FinalStage limits(Optional limits) { + this.limits = limits; + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ListMethodsResponseDataItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListMethodsResponse build() { + return new ListMethodsResponse(data, limits, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItem.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItem.java new file mode 100644 index 00000000..b70c1321 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItem.java @@ -0,0 +1,1310 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMethodsResponseDataItem.Builder.class) +public final class ListMethodsResponseDataItem { + private final Optional accountReference; + + private final Optional bankVerificationState; + + private final OffsetDateTime createdAt; + + private final String destinationCurrency; + + private final Optional estimatedArrival; + + private final Optional feeStructure; + + private final String id; + + private final Optional institutionName; + + private final boolean isClone; + + private final boolean isDefault; + + private final Optional lastPaidOutAt; + + private final boolean linkedViaPlaid; + + private final boolean needsPlaidReconnect; + + private final Optional nickname; + + private final ListMethodsResponseDataItemObject object; + + private final Optional payerName; + + private final Optional quote; + + private final ListMethodsResponseDataItemStatus status; + + private final Optional statusReason; + + private final Optional supportedPayoutMethod; + + private final Optional unavailableReason; + + private final Map additionalProperties; + + private ListMethodsResponseDataItem( + Optional accountReference, + Optional bankVerificationState, + OffsetDateTime createdAt, + String destinationCurrency, + Optional estimatedArrival, + Optional feeStructure, + String id, + Optional institutionName, + boolean isClone, + boolean isDefault, + Optional lastPaidOutAt, + boolean linkedViaPlaid, + boolean needsPlaidReconnect, + Optional nickname, + ListMethodsResponseDataItemObject object, + Optional payerName, + Optional quote, + ListMethodsResponseDataItemStatus status, + Optional statusReason, + Optional supportedPayoutMethod, + Optional unavailableReason, + Map additionalProperties) { + this.accountReference = accountReference; + this.bankVerificationState = bankVerificationState; + this.createdAt = createdAt; + this.destinationCurrency = destinationCurrency; + this.estimatedArrival = estimatedArrival; + this.feeStructure = feeStructure; + this.id = id; + this.institutionName = institutionName; + this.isClone = isClone; + this.isDefault = isDefault; + this.lastPaidOutAt = lastPaidOutAt; + this.linkedViaPlaid = linkedViaPlaid; + this.needsPlaidReconnect = needsPlaidReconnect; + this.nickname = nickname; + this.object = object; + this.payerName = payerName; + this.quote = quote; + this.status = status; + this.statusReason = statusReason; + this.supportedPayoutMethod = supportedPayoutMethod; + this.unavailableReason = unavailableReason; + this.additionalProperties = additionalProperties; + } + + /** + * @return Masked identifier for the destination, such as the last four digits of a bank account. + */ + @JsonIgnore + public Optional getAccountReference() { + if (accountReference == null) { + return Optional.empty(); + } + return accountReference; + } + + /** + * @return Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked). + */ + @JsonIgnore + public Optional getBankVerificationState() { + if (bankVerificationState == null) { + return Optional.empty(); + } + return bankVerificationState; + } + + /** + * @return When the payout method was added. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Currency payouts are delivered in for this method. + */ + @JsonProperty("destination_currency") + public String getDestinationCurrency() { + return destinationCurrency; + } + + /** + * @return Estimated arrival times before an amount-specific quote is requested. Null when the method is not currently eligible. + */ + @JsonIgnore + public Optional getEstimatedArrival() { + if (estimatedArrival == null) { + return Optional.empty(); + } + return estimatedArrival; + } + + /** + * @return Configured fee terms for this payout method. Null when the method is not currently eligible. An amount-specific quote remains authoritative. + */ + @JsonIgnore + public Optional getFeeStructure() { + if (feeStructure == null) { + return Optional.empty(); + } + return feeStructure; + } + + /** + * @return Payout method ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Name of the bank or institution receiving payouts. + */ + @JsonIgnore + public Optional getInstitutionName() { + if (institutionName == null) { + return Optional.empty(); + } + return institutionName; + } + + /** + * @return Whether this method is a copy of one saved on another of the payer's accounts. + */ + @JsonProperty("is_clone") + public boolean getIsClone() { + return isClone; + } + + /** + * @return Whether this is the default payout method for the account. + */ + @JsonProperty("is_default") + public boolean getIsDefault() { + return isDefault; + } + + /** + * @return When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet. + */ + @JsonIgnore + public Optional getLastPaidOutAt() { + if (lastPaidOutAt == null) { + return Optional.empty(); + } + return lastPaidOutAt; + } + + /** + * @return Whether the payer added this method by signing in to their bank rather than typing account details. + */ + @JsonProperty("linked_via_plaid") + public boolean getLinkedViaPlaid() { + return linkedViaPlaid; + } + + /** + * @return Whether the bank sign-in behind this method has expired and must be redone before it counts as linked. + */ + @JsonProperty("needs_plaid_reconnect") + public boolean getNeedsPlaidReconnect() { + return needsPlaidReconnect; + } + + /** + * @return User-defined label for the payout method. + */ + @JsonIgnore + public Optional getNickname() { + if (nickname == null) { + return Optional.empty(); + } + return nickname; + } + + @JsonProperty("object") + public ListMethodsResponseDataItemObject getObject() { + return object; + } + + /** + * @return Display name of the payout rail, such as ACH Bank Deposit. + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + /** + * @return Fee and delivery estimate for withdrawing the requested amount through this method. Null unless an amount was provided, or when the estimate is unavailable. + */ + @JsonIgnore + public Optional getQuote() { + if (quote == null) { + return Optional.empty(); + } + return quote; + } + + /** + * @return Lifecycle status: created means saved but unused, active means a payout succeeded through it, broken means a payout failure disabled it; a later successful payout returns it to active. + */ + @JsonProperty("status") + public ListMethodsResponseDataItemStatus getStatus() { + return status; + } + + /** + * @return Machine-readable code for why the method is broken — the newest disabling failure recorded through it, whether a payout error or a pre-payout rejection. null unless the method is broken, or when it was disabled without a recorded failure. + */ + @JsonIgnore + public Optional getStatusReason() { + if (statusReason == null) { + return Optional.empty(); + } + return statusReason; + } + + /** + * @return The supported payout method this saved method was created from. + */ + @JsonIgnore + public Optional getSupportedPayoutMethod() { + if (supportedPayoutMethod == null) { + return Optional.empty(); + } + return supportedPayoutMethod; + } + + /** + * @return Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known. + */ + @JsonIgnore + public Optional getUnavailableReason() { + if (unavailableReason == null) { + return Optional.empty(); + } + return unavailableReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_reference") + private Optional _getAccountReference() { + return accountReference; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bank_verification_state") + private Optional _getBankVerificationState() { + return bankVerificationState; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("estimated_arrival") + private Optional _getEstimatedArrival() { + return estimatedArrival; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fee_structure") + private Optional _getFeeStructure() { + return feeStructure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("institution_name") + private Optional _getInstitutionName() { + return institutionName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_paid_out_at") + private Optional _getLastPaidOutAt() { + return lastPaidOutAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("nickname") + private Optional _getNickname() { + return nickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("quote") + private Optional _getQuote() { + return quote; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status_reason") + private Optional _getStatusReason() { + return statusReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("supported_payout_method") + private Optional _getSupportedPayoutMethod() { + return supportedPayoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("unavailable_reason") + private Optional _getUnavailableReason() { + return unavailableReason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMethodsResponseDataItem && equalTo((ListMethodsResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMethodsResponseDataItem other) { + return accountReference.equals(other.accountReference) + && bankVerificationState.equals(other.bankVerificationState) + && createdAt.equals(other.createdAt) + && destinationCurrency.equals(other.destinationCurrency) + && estimatedArrival.equals(other.estimatedArrival) + && feeStructure.equals(other.feeStructure) + && id.equals(other.id) + && institutionName.equals(other.institutionName) + && isClone == other.isClone + && isDefault == other.isDefault + && lastPaidOutAt.equals(other.lastPaidOutAt) + && linkedViaPlaid == other.linkedViaPlaid + && needsPlaidReconnect == other.needsPlaidReconnect + && nickname.equals(other.nickname) + && object.equals(other.object) + && payerName.equals(other.payerName) + && quote.equals(other.quote) + && status.equals(other.status) + && statusReason.equals(other.statusReason) + && supportedPayoutMethod.equals(other.supportedPayoutMethod) + && unavailableReason.equals(other.unavailableReason); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountReference, + this.bankVerificationState, + this.createdAt, + this.destinationCurrency, + this.estimatedArrival, + this.feeStructure, + this.id, + this.institutionName, + this.isClone, + this.isDefault, + this.lastPaidOutAt, + this.linkedViaPlaid, + this.needsPlaidReconnect, + this.nickname, + this.object, + this.payerName, + this.quote, + this.status, + this.statusReason, + this.supportedPayoutMethod, + this.unavailableReason); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the payout method was added.

+ */ + DestinationCurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(ListMethodsResponseDataItem other); + } + + public interface DestinationCurrencyStage { + /** + *

Currency payouts are delivered in for this method.

+ */ + IdStage destinationCurrency(@NotNull String destinationCurrency); + } + + public interface IdStage { + /** + *

Payout method ID.

+ */ + IsCloneStage id(@NotNull String id); + } + + public interface IsCloneStage { + /** + *

Whether this method is a copy of one saved on another of the payer's accounts.

+ */ + IsDefaultStage isClone(boolean isClone); + } + + public interface IsDefaultStage { + /** + *

Whether this is the default payout method for the account.

+ */ + LinkedViaPlaidStage isDefault(boolean isDefault); + } + + public interface LinkedViaPlaidStage { + /** + *

Whether the payer added this method by signing in to their bank rather than typing account details.

+ */ + NeedsPlaidReconnectStage linkedViaPlaid(boolean linkedViaPlaid); + } + + public interface NeedsPlaidReconnectStage { + /** + *

Whether the bank sign-in behind this method has expired and must be redone before it counts as linked.

+ */ + ObjectStage needsPlaidReconnect(boolean needsPlaidReconnect); + } + + public interface ObjectStage { + StatusStage object(@NotNull ListMethodsResponseDataItemObject object); + } + + public interface StatusStage { + /** + *

Lifecycle status: created means saved but unused, active means a payout succeeded through it, broken means a payout failure disabled it; a later successful payout returns it to active.

+ */ + _FinalStage status(@NotNull ListMethodsResponseDataItemStatus status); + } + + public interface _FinalStage { + ListMethodsResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Masked identifier for the destination, such as the last four digits of a bank account.

+ */ + _FinalStage accountReference(Optional accountReference); + + _FinalStage accountReference(String accountReference); + + _FinalStage accountReference(Nullable accountReference); + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ */ + _FinalStage bankVerificationState( + Optional bankVerificationState); + + _FinalStage bankVerificationState(ListMethodsResponseDataItemBankVerificationState bankVerificationState); + + _FinalStage bankVerificationState( + Nullable bankVerificationState); + + /** + *

Estimated arrival times before an amount-specific quote is requested. Null when the method is not currently eligible.

+ */ + _FinalStage estimatedArrival(Optional estimatedArrival); + + _FinalStage estimatedArrival(ListMethodsResponseDataItemEstimatedArrival estimatedArrival); + + _FinalStage estimatedArrival(Nullable estimatedArrival); + + /** + *

Configured fee terms for this payout method. Null when the method is not currently eligible. An amount-specific quote remains authoritative.

+ */ + _FinalStage feeStructure(Optional feeStructure); + + _FinalStage feeStructure(ListMethodsResponseDataItemFeeStructure feeStructure); + + _FinalStage feeStructure(Nullable feeStructure); + + /** + *

Name of the bank or institution receiving payouts.

+ */ + _FinalStage institutionName(Optional institutionName); + + _FinalStage institutionName(String institutionName); + + _FinalStage institutionName(Nullable institutionName); + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ */ + _FinalStage lastPaidOutAt(Optional lastPaidOutAt); + + _FinalStage lastPaidOutAt(OffsetDateTime lastPaidOutAt); + + _FinalStage lastPaidOutAt(Nullable lastPaidOutAt); + + /** + *

User-defined label for the payout method.

+ */ + _FinalStage nickname(Optional nickname); + + _FinalStage nickname(String nickname); + + _FinalStage nickname(Nullable nickname); + + /** + *

Display name of the payout rail, such as ACH Bank Deposit.

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + + /** + *

Fee and delivery estimate for withdrawing the requested amount through this method. Null unless an amount was provided, or when the estimate is unavailable.

+ */ + _FinalStage quote(Optional quote); + + _FinalStage quote(ListMethodsResponseDataItemQuote quote); + + _FinalStage quote(Nullable quote); + + /** + *

Machine-readable code for why the method is broken — the newest disabling failure recorded through it, whether a payout error or a pre-payout rejection. null unless the method is broken, or when it was disabled without a recorded failure.

+ */ + _FinalStage statusReason(Optional statusReason); + + _FinalStage statusReason(String statusReason); + + _FinalStage statusReason(Nullable statusReason); + + /** + *

The supported payout method this saved method was created from.

+ */ + _FinalStage supportedPayoutMethod( + Optional supportedPayoutMethod); + + _FinalStage supportedPayoutMethod(ListMethodsResponseDataItemSupportedPayoutMethod supportedPayoutMethod); + + _FinalStage supportedPayoutMethod( + Nullable supportedPayoutMethod); + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ */ + _FinalStage unavailableReason(Optional unavailableReason); + + _FinalStage unavailableReason(ListMethodsResponseDataItemUnavailableReason unavailableReason); + + _FinalStage unavailableReason(Nullable unavailableReason); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + DestinationCurrencyStage, + IdStage, + IsCloneStage, + IsDefaultStage, + LinkedViaPlaidStage, + NeedsPlaidReconnectStage, + ObjectStage, + StatusStage, + _FinalStage { + private OffsetDateTime createdAt; + + private String destinationCurrency; + + private String id; + + private boolean isClone; + + private boolean isDefault; + + private boolean linkedViaPlaid; + + private boolean needsPlaidReconnect; + + private ListMethodsResponseDataItemObject object; + + private ListMethodsResponseDataItemStatus status; + + private Optional unavailableReason = Optional.empty(); + + private Optional supportedPayoutMethod = Optional.empty(); + + private Optional statusReason = Optional.empty(); + + private Optional quote = Optional.empty(); + + private Optional payerName = Optional.empty(); + + private Optional nickname = Optional.empty(); + + private Optional lastPaidOutAt = Optional.empty(); + + private Optional institutionName = Optional.empty(); + + private Optional feeStructure = Optional.empty(); + + private Optional estimatedArrival = Optional.empty(); + + private Optional bankVerificationState = Optional.empty(); + + private Optional accountReference = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMethodsResponseDataItem other) { + accountReference(other.getAccountReference()); + bankVerificationState(other.getBankVerificationState()); + createdAt(other.getCreatedAt()); + destinationCurrency(other.getDestinationCurrency()); + estimatedArrival(other.getEstimatedArrival()); + feeStructure(other.getFeeStructure()); + id(other.getId()); + institutionName(other.getInstitutionName()); + isClone(other.getIsClone()); + isDefault(other.getIsDefault()); + lastPaidOutAt(other.getLastPaidOutAt()); + linkedViaPlaid(other.getLinkedViaPlaid()); + needsPlaidReconnect(other.getNeedsPlaidReconnect()); + nickname(other.getNickname()); + object(other.getObject()); + payerName(other.getPayerName()); + quote(other.getQuote()); + status(other.getStatus()); + statusReason(other.getStatusReason()); + supportedPayoutMethod(other.getSupportedPayoutMethod()); + unavailableReason(other.getUnavailableReason()); + return this; + } + + /** + *

When the payout method was added.

+ *

When the payout method was added.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public DestinationCurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Currency payouts are delivered in for this method.

+ *

Currency payouts are delivered in for this method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination_currency") + public IdStage destinationCurrency(@NotNull String destinationCurrency) { + this.destinationCurrency = + Objects.requireNonNull(destinationCurrency, "destinationCurrency must not be null"); + return this; + } + + /** + *

Payout method ID.

+ *

Payout method ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsCloneStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether this method is a copy of one saved on another of the payer's accounts.

+ *

Whether this method is a copy of one saved on another of the payer's accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_clone") + public IsDefaultStage isClone(boolean isClone) { + this.isClone = isClone; + return this; + } + + /** + *

Whether this is the default payout method for the account.

+ *

Whether this is the default payout method for the account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_default") + public LinkedViaPlaidStage isDefault(boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + /** + *

Whether the payer added this method by signing in to their bank rather than typing account details.

+ *

Whether the payer added this method by signing in to their bank rather than typing account details.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("linked_via_plaid") + public NeedsPlaidReconnectStage linkedViaPlaid(boolean linkedViaPlaid) { + this.linkedViaPlaid = linkedViaPlaid; + return this; + } + + /** + *

Whether the bank sign-in behind this method has expired and must be redone before it counts as linked.

+ *

Whether the bank sign-in behind this method has expired and must be redone before it counts as linked.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("needs_plaid_reconnect") + public ObjectStage needsPlaidReconnect(boolean needsPlaidReconnect) { + this.needsPlaidReconnect = needsPlaidReconnect; + return this; + } + + @java.lang.Override + @JsonSetter("object") + public StatusStage object(@NotNull ListMethodsResponseDataItemObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Lifecycle status: created means saved but unused, active means a payout succeeded through it, broken means a payout failure disabled it; a later successful payout returns it to active.

+ *

Lifecycle status: created means saved but unused, active means a payout succeeded through it, broken means a payout failure disabled it; a later successful payout returns it to active.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull ListMethodsResponseDataItemStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage unavailableReason(Nullable unavailableReason) { + if (unavailableReason.isNull()) { + this.unavailableReason = null; + } else if (unavailableReason.isEmpty()) { + this.unavailableReason = Optional.empty(); + } else { + this.unavailableReason = Optional.of(unavailableReason.get()); + } + return this; + } + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage unavailableReason(ListMethodsResponseDataItemUnavailableReason unavailableReason) { + this.unavailableReason = Optional.ofNullable(unavailableReason); + return this; + } + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ */ + @java.lang.Override + @JsonSetter(value = "unavailable_reason", nulls = Nulls.SKIP) + public _FinalStage unavailableReason(Optional unavailableReason) { + this.unavailableReason = unavailableReason; + return this; + } + + /** + *

The supported payout method this saved method was created from.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage supportedPayoutMethod( + Nullable supportedPayoutMethod) { + if (supportedPayoutMethod.isNull()) { + this.supportedPayoutMethod = null; + } else if (supportedPayoutMethod.isEmpty()) { + this.supportedPayoutMethod = Optional.empty(); + } else { + this.supportedPayoutMethod = Optional.of(supportedPayoutMethod.get()); + } + return this; + } + + /** + *

The supported payout method this saved method was created from.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage supportedPayoutMethod( + ListMethodsResponseDataItemSupportedPayoutMethod supportedPayoutMethod) { + this.supportedPayoutMethod = Optional.ofNullable(supportedPayoutMethod); + return this; + } + + /** + *

The supported payout method this saved method was created from.

+ */ + @java.lang.Override + @JsonSetter(value = "supported_payout_method", nulls = Nulls.SKIP) + public _FinalStage supportedPayoutMethod( + Optional supportedPayoutMethod) { + this.supportedPayoutMethod = supportedPayoutMethod; + return this; + } + + /** + *

Machine-readable code for why the method is broken — the newest disabling failure recorded through it, whether a payout error or a pre-payout rejection. null unless the method is broken, or when it was disabled without a recorded failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statusReason(Nullable statusReason) { + if (statusReason.isNull()) { + this.statusReason = null; + } else if (statusReason.isEmpty()) { + this.statusReason = Optional.empty(); + } else { + this.statusReason = Optional.of(statusReason.get()); + } + return this; + } + + /** + *

Machine-readable code for why the method is broken — the newest disabling failure recorded through it, whether a payout error or a pre-payout rejection. null unless the method is broken, or when it was disabled without a recorded failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statusReason(String statusReason) { + this.statusReason = Optional.ofNullable(statusReason); + return this; + } + + /** + *

Machine-readable code for why the method is broken — the newest disabling failure recorded through it, whether a payout error or a pre-payout rejection. null unless the method is broken, or when it was disabled without a recorded failure.

+ */ + @java.lang.Override + @JsonSetter(value = "status_reason", nulls = Nulls.SKIP) + public _FinalStage statusReason(Optional statusReason) { + this.statusReason = statusReason; + return this; + } + + /** + *

Fee and delivery estimate for withdrawing the requested amount through this method. Null unless an amount was provided, or when the estimate is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quote(Nullable quote) { + if (quote.isNull()) { + this.quote = null; + } else if (quote.isEmpty()) { + this.quote = Optional.empty(); + } else { + this.quote = Optional.of(quote.get()); + } + return this; + } + + /** + *

Fee and delivery estimate for withdrawing the requested amount through this method. Null unless an amount was provided, or when the estimate is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quote(ListMethodsResponseDataItemQuote quote) { + this.quote = Optional.ofNullable(quote); + return this; + } + + /** + *

Fee and delivery estimate for withdrawing the requested amount through this method. Null unless an amount was provided, or when the estimate is unavailable.

+ */ + @java.lang.Override + @JsonSetter(value = "quote", nulls = Nulls.SKIP) + public _FinalStage quote(Optional quote) { + this.quote = quote; + return this; + } + + /** + *

Display name of the payout rail, such as ACH Bank Deposit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

Display name of the payout rail, such as ACH Bank Deposit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

Display name of the payout rail, such as ACH Bank Deposit.

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

User-defined label for the payout method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(Nullable nickname) { + if (nickname.isNull()) { + this.nickname = null; + } else if (nickname.isEmpty()) { + this.nickname = Optional.empty(); + } else { + this.nickname = Optional.of(nickname.get()); + } + return this; + } + + /** + *

User-defined label for the payout method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(String nickname) { + this.nickname = Optional.ofNullable(nickname); + return this; + } + + /** + *

User-defined label for the payout method.

+ */ + @java.lang.Override + @JsonSetter(value = "nickname", nulls = Nulls.SKIP) + public _FinalStage nickname(Optional nickname) { + this.nickname = nickname; + return this; + } + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaidOutAt(Nullable lastPaidOutAt) { + if (lastPaidOutAt.isNull()) { + this.lastPaidOutAt = null; + } else if (lastPaidOutAt.isEmpty()) { + this.lastPaidOutAt = Optional.empty(); + } else { + this.lastPaidOutAt = Optional.of(lastPaidOutAt.get()); + } + return this; + } + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaidOutAt(OffsetDateTime lastPaidOutAt) { + this.lastPaidOutAt = Optional.ofNullable(lastPaidOutAt); + return this; + } + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ */ + @java.lang.Override + @JsonSetter(value = "last_paid_out_at", nulls = Nulls.SKIP) + public _FinalStage lastPaidOutAt(Optional lastPaidOutAt) { + this.lastPaidOutAt = lastPaidOutAt; + return this; + } + + /** + *

Name of the bank or institution receiving payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage institutionName(Nullable institutionName) { + if (institutionName.isNull()) { + this.institutionName = null; + } else if (institutionName.isEmpty()) { + this.institutionName = Optional.empty(); + } else { + this.institutionName = Optional.of(institutionName.get()); + } + return this; + } + + /** + *

Name of the bank or institution receiving payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage institutionName(String institutionName) { + this.institutionName = Optional.ofNullable(institutionName); + return this; + } + + /** + *

Name of the bank or institution receiving payouts.

+ */ + @java.lang.Override + @JsonSetter(value = "institution_name", nulls = Nulls.SKIP) + public _FinalStage institutionName(Optional institutionName) { + this.institutionName = institutionName; + return this; + } + + /** + *

Configured fee terms for this payout method. Null when the method is not currently eligible. An amount-specific quote remains authoritative.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeStructure(Nullable feeStructure) { + if (feeStructure.isNull()) { + this.feeStructure = null; + } else if (feeStructure.isEmpty()) { + this.feeStructure = Optional.empty(); + } else { + this.feeStructure = Optional.of(feeStructure.get()); + } + return this; + } + + /** + *

Configured fee terms for this payout method. Null when the method is not currently eligible. An amount-specific quote remains authoritative.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeStructure(ListMethodsResponseDataItemFeeStructure feeStructure) { + this.feeStructure = Optional.ofNullable(feeStructure); + return this; + } + + /** + *

Configured fee terms for this payout method. Null when the method is not currently eligible. An amount-specific quote remains authoritative.

+ */ + @java.lang.Override + @JsonSetter(value = "fee_structure", nulls = Nulls.SKIP) + public _FinalStage feeStructure(Optional feeStructure) { + this.feeStructure = feeStructure; + return this; + } + + /** + *

Estimated arrival times before an amount-specific quote is requested. Null when the method is not currently eligible.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(Nullable estimatedArrival) { + if (estimatedArrival.isNull()) { + this.estimatedArrival = null; + } else if (estimatedArrival.isEmpty()) { + this.estimatedArrival = Optional.empty(); + } else { + this.estimatedArrival = Optional.of(estimatedArrival.get()); + } + return this; + } + + /** + *

Estimated arrival times before an amount-specific quote is requested. Null when the method is not currently eligible.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(ListMethodsResponseDataItemEstimatedArrival estimatedArrival) { + this.estimatedArrival = Optional.ofNullable(estimatedArrival); + return this; + } + + /** + *

Estimated arrival times before an amount-specific quote is requested. Null when the method is not currently eligible.

+ */ + @java.lang.Override + @JsonSetter(value = "estimated_arrival", nulls = Nulls.SKIP) + public _FinalStage estimatedArrival(Optional estimatedArrival) { + this.estimatedArrival = estimatedArrival; + return this; + } + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bankVerificationState( + Nullable bankVerificationState) { + if (bankVerificationState.isNull()) { + this.bankVerificationState = null; + } else if (bankVerificationState.isEmpty()) { + this.bankVerificationState = Optional.empty(); + } else { + this.bankVerificationState = Optional.of(bankVerificationState.get()); + } + return this; + } + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bankVerificationState( + ListMethodsResponseDataItemBankVerificationState bankVerificationState) { + this.bankVerificationState = Optional.ofNullable(bankVerificationState); + return this; + } + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ */ + @java.lang.Override + @JsonSetter(value = "bank_verification_state", nulls = Nulls.SKIP) + public _FinalStage bankVerificationState( + Optional bankVerificationState) { + this.bankVerificationState = bankVerificationState; + return this; + } + + /** + *

Masked identifier for the destination, such as the last four digits of a bank account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountReference(Nullable accountReference) { + if (accountReference.isNull()) { + this.accountReference = null; + } else if (accountReference.isEmpty()) { + this.accountReference = Optional.empty(); + } else { + this.accountReference = Optional.of(accountReference.get()); + } + return this; + } + + /** + *

Masked identifier for the destination, such as the last four digits of a bank account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountReference(String accountReference) { + this.accountReference = Optional.ofNullable(accountReference); + return this; + } + + /** + *

Masked identifier for the destination, such as the last four digits of a bank account.

+ */ + @java.lang.Override + @JsonSetter(value = "account_reference", nulls = Nulls.SKIP) + public _FinalStage accountReference(Optional accountReference) { + this.accountReference = accountReference; + return this; + } + + @java.lang.Override + public ListMethodsResponseDataItem build() { + return new ListMethodsResponseDataItem( + accountReference, + bankVerificationState, + createdAt, + destinationCurrency, + estimatedArrival, + feeStructure, + id, + institutionName, + isClone, + isDefault, + lastPaidOutAt, + linkedViaPlaid, + needsPlaidReconnect, + nickname, + object, + payerName, + quote, + status, + statusReason, + supportedPayoutMethod, + unavailableReason, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemBankVerificationState.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemBankVerificationState.java new file mode 100644 index 00000000..2ea0a48e --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemBankVerificationState.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListMethodsResponseDataItemBankVerificationState { + public static final ListMethodsResponseDataItemBankVerificationState NO_DATA = + new ListMethodsResponseDataItemBankVerificationState(Value.NO_DATA, "no_data"); + + public static final ListMethodsResponseDataItemBankVerificationState CHECKING = + new ListMethodsResponseDataItemBankVerificationState(Value.CHECKING, "checking"); + + public static final ListMethodsResponseDataItemBankVerificationState WARNING = + new ListMethodsResponseDataItemBankVerificationState(Value.WARNING, "warning"); + + public static final ListMethodsResponseDataItemBankVerificationState VERIFIED = + new ListMethodsResponseDataItemBankVerificationState(Value.VERIFIED, "verified"); + + public static final ListMethodsResponseDataItemBankVerificationState BROKEN = + new ListMethodsResponseDataItemBankVerificationState(Value.BROKEN, "broken"); + + private final Value value; + + private final String string; + + ListMethodsResponseDataItemBankVerificationState(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListMethodsResponseDataItemBankVerificationState + && this.string.equals(((ListMethodsResponseDataItemBankVerificationState) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NO_DATA: + return visitor.visitNoData(); + case CHECKING: + return visitor.visitChecking(); + case WARNING: + return visitor.visitWarning(); + case VERIFIED: + return visitor.visitVerified(); + case BROKEN: + return visitor.visitBroken(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListMethodsResponseDataItemBankVerificationState valueOf(String value) { + switch (value) { + case "no_data": + return NO_DATA; + case "checking": + return CHECKING; + case "warning": + return WARNING; + case "verified": + return VERIFIED; + case "broken": + return BROKEN; + default: + return new ListMethodsResponseDataItemBankVerificationState(Value.UNKNOWN, value); + } + } + + public enum Value { + CHECKING, + + VERIFIED, + + NO_DATA, + + WARNING, + + BROKEN, + + UNKNOWN + } + + public interface Visitor { + T visitChecking(); + + T visitVerified(); + + T visitNoData(); + + T visitWarning(); + + T visitBroken(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemEstimatedArrival.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemEstimatedArrival.java new file mode 100644 index 00000000..45ed587b --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemEstimatedArrival.java @@ -0,0 +1,187 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMethodsResponseDataItemEstimatedArrival.Builder.class) +public final class ListMethodsResponseDataItemEstimatedArrival { + private final Optional instant; + + private final Optional standard; + + private final Map additionalProperties; + + private ListMethodsResponseDataItemEstimatedArrival( + Optional instant, + Optional standard, + Map additionalProperties) { + this.instant = instant; + this.standard = standard; + this.additionalProperties = additionalProperties; + } + + /** + * @return Estimated instant-delivery arrival, or null when unavailable. + */ + @JsonIgnore + public Optional getInstant() { + if (instant == null) { + return Optional.empty(); + } + return instant; + } + + /** + * @return Estimated standard-delivery arrival, or null when unavailable. + */ + @JsonIgnore + public Optional getStandard() { + if (standard == null) { + return Optional.empty(); + } + return standard; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("instant") + private Optional _getInstant() { + return instant; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("standard") + private Optional _getStandard() { + return standard; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMethodsResponseDataItemEstimatedArrival + && equalTo((ListMethodsResponseDataItemEstimatedArrival) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMethodsResponseDataItemEstimatedArrival other) { + return instant.equals(other.instant) && standard.equals(other.standard); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.instant, this.standard); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional instant = Optional.empty(); + + private Optional standard = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListMethodsResponseDataItemEstimatedArrival other) { + instant(other.getInstant()); + standard(other.getStandard()); + return this; + } + + /** + *

Estimated instant-delivery arrival, or null when unavailable.

+ */ + @JsonSetter(value = "instant", nulls = Nulls.SKIP) + public Builder instant(Optional instant) { + this.instant = instant; + return this; + } + + public Builder instant(OffsetDateTime instant) { + this.instant = Optional.ofNullable(instant); + return this; + } + + public Builder instant(Nullable instant) { + if (instant.isNull()) { + this.instant = null; + } else if (instant.isEmpty()) { + this.instant = Optional.empty(); + } else { + this.instant = Optional.of(instant.get()); + } + return this; + } + + /** + *

Estimated standard-delivery arrival, or null when unavailable.

+ */ + @JsonSetter(value = "standard", nulls = Nulls.SKIP) + public Builder standard(Optional standard) { + this.standard = standard; + return this; + } + + public Builder standard(OffsetDateTime standard) { + this.standard = Optional.ofNullable(standard); + return this; + } + + public Builder standard(Nullable standard) { + if (standard.isNull()) { + this.standard = null; + } else if (standard.isEmpty()) { + this.standard = Optional.empty(); + } else { + this.standard = Optional.of(standard.get()); + } + return this; + } + + public ListMethodsResponseDataItemEstimatedArrival build() { + return new ListMethodsResponseDataItemEstimatedArrival(instant, standard, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemFeeStructure.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemFeeStructure.java new file mode 100644 index 00000000..493564d3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemFeeStructure.java @@ -0,0 +1,197 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMethodsResponseDataItemFeeStructure.Builder.class) +public final class ListMethodsResponseDataItemFeeStructure { + private final String currency; + + private final float fixedAmount; + + private final float percentage; + + private final Map additionalProperties; + + private ListMethodsResponseDataItemFeeStructure( + String currency, float fixedAmount, float percentage, Map additionalProperties) { + this.currency = currency; + this.fixedAmount = fixedAmount; + this.percentage = percentage; + this.additionalProperties = additionalProperties; + } + + /** + * @return Currency code of fixed_amount. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Fixed fee charged, denominated in currency. + */ + @JsonProperty("fixed_amount") + public float getFixedAmount() { + return fixedAmount; + } + + /** + * @return Percentage of the withdrawal amount charged as a fee. + */ + @JsonProperty("percentage") + public float getPercentage() { + return percentage; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMethodsResponseDataItemFeeStructure + && equalTo((ListMethodsResponseDataItemFeeStructure) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMethodsResponseDataItemFeeStructure other) { + return currency.equals(other.currency) && fixedAmount == other.fixedAmount && percentage == other.percentage; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.fixedAmount, this.percentage); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + /** + *

Currency code of fixed_amount.

+ */ + FixedAmountStage currency(@NotNull String currency); + + Builder from(ListMethodsResponseDataItemFeeStructure other); + } + + public interface FixedAmountStage { + /** + *

Fixed fee charged, denominated in currency.

+ */ + PercentageStage fixedAmount(float fixedAmount); + } + + public interface PercentageStage { + /** + *

Percentage of the withdrawal amount charged as a fee.

+ */ + _FinalStage percentage(float percentage); + } + + public interface _FinalStage { + ListMethodsResponseDataItemFeeStructure build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, FixedAmountStage, PercentageStage, _FinalStage { + private String currency; + + private float fixedAmount; + + private float percentage; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMethodsResponseDataItemFeeStructure other) { + currency(other.getCurrency()); + fixedAmount(other.getFixedAmount()); + percentage(other.getPercentage()); + return this; + } + + /** + *

Currency code of fixed_amount.

+ *

Currency code of fixed_amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public FixedAmountStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Fixed fee charged, denominated in currency.

+ *

Fixed fee charged, denominated in currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fixed_amount") + public PercentageStage fixedAmount(float fixedAmount) { + this.fixedAmount = fixedAmount; + return this; + } + + /** + *

Percentage of the withdrawal amount charged as a fee.

+ *

Percentage of the withdrawal amount charged as a fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("percentage") + public _FinalStage percentage(float percentage) { + this.percentage = percentage; + return this; + } + + @java.lang.Override + public ListMethodsResponseDataItemFeeStructure build() { + return new ListMethodsResponseDataItemFeeStructure(currency, fixedAmount, percentage, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemObject.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemObject.java new file mode 100644 index 00000000..388296b9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListMethodsResponseDataItemObject { + public static final ListMethodsResponseDataItemObject PAYOUT_METHOD = + new ListMethodsResponseDataItemObject(Value.PAYOUT_METHOD, "payout_method"); + + private final Value value; + + private final String string; + + ListMethodsResponseDataItemObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListMethodsResponseDataItemObject + && this.string.equals(((ListMethodsResponseDataItemObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYOUT_METHOD: + return visitor.visitPayoutMethod(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListMethodsResponseDataItemObject valueOf(String value) { + switch (value) { + case "payout_method": + return PAYOUT_METHOD; + default: + return new ListMethodsResponseDataItemObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYOUT_METHOD, + + UNKNOWN + } + + public interface Visitor { + T visitPayoutMethod(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemQuote.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemQuote.java new file mode 100644 index 00000000..370c20ad --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemQuote.java @@ -0,0 +1,460 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMethodsResponseDataItemQuote.Builder.class) +public final class ListMethodsResponseDataItemQuote { + private final float amount; + + private final String currency; + + private final float exchangeRate; + + private final Optional instant; + + private final Optional maxLimit; + + private final float minLimit; + + private final Optional standard; + + private final Map additionalProperties; + + private ListMethodsResponseDataItemQuote( + float amount, + String currency, + float exchangeRate, + Optional instant, + Optional maxLimit, + float minLimit, + Optional standard, + Map additionalProperties) { + this.amount = amount; + this.currency = currency; + this.exchangeRate = exchangeRate; + this.instant = instant; + this.maxLimit = maxLimit; + this.minLimit = minLimit; + this.standard = standard; + this.additionalProperties = additionalProperties; + } + + /** + * @return The withdrawal amount the quote is for. + */ + @JsonProperty("amount") + public float getAmount() { + return amount; + } + + /** + * @return Currency of the quoted amount. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Exchange rate from the withdrawal currency to the destination currency. + */ + @JsonProperty("exchange_rate") + public float getExchangeRate() { + return exchangeRate; + } + + /** + * @return Instant-delivery estimate. Null if the method does not support instant delivery, instant delivery is unavailable for the account, or the amount does not cover the fee. + */ + @JsonIgnore + public Optional getInstant() { + if (instant == null) { + return Optional.empty(); + } + return instant; + } + + /** + * @return Maximum withdrawal amount for this method, in the withdrawal currency. + */ + @JsonIgnore + public Optional getMaxLimit() { + if (maxLimit == null) { + return Optional.empty(); + } + return maxLimit; + } + + /** + * @return Minimum withdrawal amount for this method, in the withdrawal currency. + */ + @JsonProperty("min_limit") + public float getMinLimit() { + return minLimit; + } + + /** + * @return Standard-delivery estimate. Null if the method does not support standard delivery, or the amount does not cover the fee. + */ + @JsonIgnore + public Optional getStandard() { + if (standard == null) { + return Optional.empty(); + } + return standard; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("instant") + private Optional _getInstant() { + return instant; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("max_limit") + private Optional _getMaxLimit() { + return maxLimit; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("standard") + private Optional _getStandard() { + return standard; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMethodsResponseDataItemQuote && equalTo((ListMethodsResponseDataItemQuote) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMethodsResponseDataItemQuote other) { + return amount == other.amount + && currency.equals(other.currency) + && exchangeRate == other.exchangeRate + && instant.equals(other.instant) + && maxLimit.equals(other.maxLimit) + && minLimit == other.minLimit + && standard.equals(other.standard); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.currency, + this.exchangeRate, + this.instant, + this.maxLimit, + this.minLimit, + this.standard); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The withdrawal amount the quote is for.

+ */ + CurrencyStage amount(float amount); + + Builder from(ListMethodsResponseDataItemQuote other); + } + + public interface CurrencyStage { + /** + *

Currency of the quoted amount.

+ */ + ExchangeRateStage currency(@NotNull String currency); + } + + public interface ExchangeRateStage { + /** + *

Exchange rate from the withdrawal currency to the destination currency.

+ */ + MinLimitStage exchangeRate(float exchangeRate); + } + + public interface MinLimitStage { + /** + *

Minimum withdrawal amount for this method, in the withdrawal currency.

+ */ + _FinalStage minLimit(float minLimit); + } + + public interface _FinalStage { + ListMethodsResponseDataItemQuote build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Instant-delivery estimate. Null if the method does not support instant delivery, instant delivery is unavailable for the account, or the amount does not cover the fee.

+ */ + _FinalStage instant(Optional instant); + + _FinalStage instant(ListMethodsResponseDataItemQuoteInstant instant); + + _FinalStage instant(Nullable instant); + + /** + *

Maximum withdrawal amount for this method, in the withdrawal currency.

+ */ + _FinalStage maxLimit(Optional maxLimit); + + _FinalStage maxLimit(Float maxLimit); + + _FinalStage maxLimit(Nullable maxLimit); + + /** + *

Standard-delivery estimate. Null if the method does not support standard delivery, or the amount does not cover the fee.

+ */ + _FinalStage standard(Optional standard); + + _FinalStage standard(ListMethodsResponseDataItemQuoteStandard standard); + + _FinalStage standard(Nullable standard); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, CurrencyStage, ExchangeRateStage, MinLimitStage, _FinalStage { + private float amount; + + private String currency; + + private float exchangeRate; + + private float minLimit; + + private Optional standard = Optional.empty(); + + private Optional maxLimit = Optional.empty(); + + private Optional instant = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMethodsResponseDataItemQuote other) { + amount(other.getAmount()); + currency(other.getCurrency()); + exchangeRate(other.getExchangeRate()); + instant(other.getInstant()); + maxLimit(other.getMaxLimit()); + minLimit(other.getMinLimit()); + standard(other.getStandard()); + return this; + } + + /** + *

The withdrawal amount the quote is for.

+ *

The withdrawal amount the quote is for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CurrencyStage amount(float amount) { + this.amount = amount; + return this; + } + + /** + *

Currency of the quoted amount.

+ *

Currency of the quoted amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public ExchangeRateStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Exchange rate from the withdrawal currency to the destination currency.

+ *

Exchange rate from the withdrawal currency to the destination currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("exchange_rate") + public MinLimitStage exchangeRate(float exchangeRate) { + this.exchangeRate = exchangeRate; + return this; + } + + /** + *

Minimum withdrawal amount for this method, in the withdrawal currency.

+ *

Minimum withdrawal amount for this method, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("min_limit") + public _FinalStage minLimit(float minLimit) { + this.minLimit = minLimit; + return this; + } + + /** + *

Standard-delivery estimate. Null if the method does not support standard delivery, or the amount does not cover the fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage standard(Nullable standard) { + if (standard.isNull()) { + this.standard = null; + } else if (standard.isEmpty()) { + this.standard = Optional.empty(); + } else { + this.standard = Optional.of(standard.get()); + } + return this; + } + + /** + *

Standard-delivery estimate. Null if the method does not support standard delivery, or the amount does not cover the fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage standard(ListMethodsResponseDataItemQuoteStandard standard) { + this.standard = Optional.ofNullable(standard); + return this; + } + + /** + *

Standard-delivery estimate. Null if the method does not support standard delivery, or the amount does not cover the fee.

+ */ + @java.lang.Override + @JsonSetter(value = "standard", nulls = Nulls.SKIP) + public _FinalStage standard(Optional standard) { + this.standard = standard; + return this; + } + + /** + *

Maximum withdrawal amount for this method, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxLimit(Nullable maxLimit) { + if (maxLimit.isNull()) { + this.maxLimit = null; + } else if (maxLimit.isEmpty()) { + this.maxLimit = Optional.empty(); + } else { + this.maxLimit = Optional.of(maxLimit.get()); + } + return this; + } + + /** + *

Maximum withdrawal amount for this method, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxLimit(Float maxLimit) { + this.maxLimit = Optional.ofNullable(maxLimit); + return this; + } + + /** + *

Maximum withdrawal amount for this method, in the withdrawal currency.

+ */ + @java.lang.Override + @JsonSetter(value = "max_limit", nulls = Nulls.SKIP) + public _FinalStage maxLimit(Optional maxLimit) { + this.maxLimit = maxLimit; + return this; + } + + /** + *

Instant-delivery estimate. Null if the method does not support instant delivery, instant delivery is unavailable for the account, or the amount does not cover the fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage instant(Nullable instant) { + if (instant.isNull()) { + this.instant = null; + } else if (instant.isEmpty()) { + this.instant = Optional.empty(); + } else { + this.instant = Optional.of(instant.get()); + } + return this; + } + + /** + *

Instant-delivery estimate. Null if the method does not support instant delivery, instant delivery is unavailable for the account, or the amount does not cover the fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage instant(ListMethodsResponseDataItemQuoteInstant instant) { + this.instant = Optional.ofNullable(instant); + return this; + } + + /** + *

Instant-delivery estimate. Null if the method does not support instant delivery, instant delivery is unavailable for the account, or the amount does not cover the fee.

+ */ + @java.lang.Override + @JsonSetter(value = "instant", nulls = Nulls.SKIP) + public _FinalStage instant(Optional instant) { + this.instant = instant; + return this; + } + + @java.lang.Override + public ListMethodsResponseDataItemQuote build() { + return new ListMethodsResponseDataItemQuote( + amount, currency, exchangeRate, instant, maxLimit, minLimit, standard, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemQuoteInstant.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemQuoteInstant.java new file mode 100644 index 00000000..0d2ea5ad --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemQuoteInstant.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMethodsResponseDataItemQuoteInstant.Builder.class) +public final class ListMethodsResponseDataItemQuoteInstant { + private final float fee; + + private final float totalReceived; + + private final Map additionalProperties; + + private ListMethodsResponseDataItemQuoteInstant( + float fee, float totalReceived, Map additionalProperties) { + this.fee = fee; + this.totalReceived = totalReceived; + this.additionalProperties = additionalProperties; + } + + /** + * @return Total fee charged, in the withdrawal currency. + */ + @JsonProperty("fee") + public float getFee() { + return fee; + } + + /** + * @return Amount delivered after fees, in the withdrawal currency. + */ + @JsonProperty("total_received") + public float getTotalReceived() { + return totalReceived; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMethodsResponseDataItemQuoteInstant + && equalTo((ListMethodsResponseDataItemQuoteInstant) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMethodsResponseDataItemQuoteInstant other) { + return fee == other.fee && totalReceived == other.totalReceived; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fee, this.totalReceived); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FeeStage builder() { + return new Builder(); + } + + public interface FeeStage { + /** + *

Total fee charged, in the withdrawal currency.

+ */ + TotalReceivedStage fee(float fee); + + Builder from(ListMethodsResponseDataItemQuoteInstant other); + } + + public interface TotalReceivedStage { + /** + *

Amount delivered after fees, in the withdrawal currency.

+ */ + _FinalStage totalReceived(float totalReceived); + } + + public interface _FinalStage { + ListMethodsResponseDataItemQuoteInstant build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FeeStage, TotalReceivedStage, _FinalStage { + private float fee; + + private float totalReceived; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMethodsResponseDataItemQuoteInstant other) { + fee(other.getFee()); + totalReceived(other.getTotalReceived()); + return this; + } + + /** + *

Total fee charged, in the withdrawal currency.

+ *

Total fee charged, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee") + public TotalReceivedStage fee(float fee) { + this.fee = fee; + return this; + } + + /** + *

Amount delivered after fees, in the withdrawal currency.

+ *

Amount delivered after fees, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_received") + public _FinalStage totalReceived(float totalReceived) { + this.totalReceived = totalReceived; + return this; + } + + @java.lang.Override + public ListMethodsResponseDataItemQuoteInstant build() { + return new ListMethodsResponseDataItemQuoteInstant(fee, totalReceived, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemQuoteStandard.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemQuoteStandard.java new file mode 100644 index 00000000..3c333f0e --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemQuoteStandard.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMethodsResponseDataItemQuoteStandard.Builder.class) +public final class ListMethodsResponseDataItemQuoteStandard { + private final float fee; + + private final float totalReceived; + + private final Map additionalProperties; + + private ListMethodsResponseDataItemQuoteStandard( + float fee, float totalReceived, Map additionalProperties) { + this.fee = fee; + this.totalReceived = totalReceived; + this.additionalProperties = additionalProperties; + } + + /** + * @return Total fee charged, in the withdrawal currency. + */ + @JsonProperty("fee") + public float getFee() { + return fee; + } + + /** + * @return Amount delivered after fees, in the withdrawal currency. + */ + @JsonProperty("total_received") + public float getTotalReceived() { + return totalReceived; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMethodsResponseDataItemQuoteStandard + && equalTo((ListMethodsResponseDataItemQuoteStandard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMethodsResponseDataItemQuoteStandard other) { + return fee == other.fee && totalReceived == other.totalReceived; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fee, this.totalReceived); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FeeStage builder() { + return new Builder(); + } + + public interface FeeStage { + /** + *

Total fee charged, in the withdrawal currency.

+ */ + TotalReceivedStage fee(float fee); + + Builder from(ListMethodsResponseDataItemQuoteStandard other); + } + + public interface TotalReceivedStage { + /** + *

Amount delivered after fees, in the withdrawal currency.

+ */ + _FinalStage totalReceived(float totalReceived); + } + + public interface _FinalStage { + ListMethodsResponseDataItemQuoteStandard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FeeStage, TotalReceivedStage, _FinalStage { + private float fee; + + private float totalReceived; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMethodsResponseDataItemQuoteStandard other) { + fee(other.getFee()); + totalReceived(other.getTotalReceived()); + return this; + } + + /** + *

Total fee charged, in the withdrawal currency.

+ *

Total fee charged, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee") + public TotalReceivedStage fee(float fee) { + this.fee = fee; + return this; + } + + /** + *

Amount delivered after fees, in the withdrawal currency.

+ *

Amount delivered after fees, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_received") + public _FinalStage totalReceived(float totalReceived) { + this.totalReceived = totalReceived; + return this; + } + + @java.lang.Override + public ListMethodsResponseDataItemQuoteStandard build() { + return new ListMethodsResponseDataItemQuoteStandard(fee, totalReceived, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemStatus.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemStatus.java new file mode 100644 index 00000000..1710e886 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemStatus.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListMethodsResponseDataItemStatus { + public static final ListMethodsResponseDataItemStatus CREATED = + new ListMethodsResponseDataItemStatus(Value.CREATED, "created"); + + public static final ListMethodsResponseDataItemStatus ACTIVE = + new ListMethodsResponseDataItemStatus(Value.ACTIVE, "active"); + + public static final ListMethodsResponseDataItemStatus BROKEN = + new ListMethodsResponseDataItemStatus(Value.BROKEN, "broken"); + + private final Value value; + + private final String string; + + ListMethodsResponseDataItemStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListMethodsResponseDataItemStatus + && this.string.equals(((ListMethodsResponseDataItemStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED: + return visitor.visitCreated(); + case ACTIVE: + return visitor.visitActive(); + case BROKEN: + return visitor.visitBroken(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListMethodsResponseDataItemStatus valueOf(String value) { + switch (value) { + case "created": + return CREATED; + case "active": + return ACTIVE; + case "broken": + return BROKEN; + default: + return new ListMethodsResponseDataItemStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED, + + ACTIVE, + + BROKEN, + + UNKNOWN + } + + public interface Visitor { + T visitCreated(); + + T visitActive(); + + T visitBroken(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemSupportedPayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemSupportedPayoutMethod.java new file mode 100644 index 00000000..8af054c9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemSupportedPayoutMethod.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMethodsResponseDataItemSupportedPayoutMethod.Builder.class) +public final class ListMethodsResponseDataItemSupportedPayoutMethod { + private final Optional countryCode; + + private final ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType deliveryType; + + private final Optional iconUrl; + + private final Optional name; + + private final boolean supportsInstantDelivery; + + private final boolean supportsPlaid; + + private final boolean supportsStandardDelivery; + + private final Map additionalProperties; + + private ListMethodsResponseDataItemSupportedPayoutMethod( + Optional countryCode, + ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType deliveryType, + Optional iconUrl, + Optional name, + boolean supportsInstantDelivery, + boolean supportsPlaid, + boolean supportsStandardDelivery, + Map additionalProperties) { + this.countryCode = countryCode; + this.deliveryType = deliveryType; + this.iconUrl = iconUrl; + this.name = name; + this.supportsInstantDelivery = supportsInstantDelivery; + this.supportsPlaid = supportsPlaid; + this.supportsStandardDelivery = supportsStandardDelivery; + this.additionalProperties = additionalProperties; + } + + /** + * @return ISO 3166-1 alpha-3 country the destination pays out to. + */ + @JsonIgnore + public Optional getCountryCode() { + if (countryCode == null) { + return Optional.empty(); + } + return countryCode; + } + + /** + * @return How funds are delivered. + */ + @JsonProperty("delivery_type") + public ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType getDeliveryType() { + return deliveryType; + } + + /** + * @return Supported payout method icon URL. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return Supported payout method display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("supports_instant_delivery") + public boolean getSupportsInstantDelivery() { + return supportsInstantDelivery; + } + + /** + * @return Whether the payer can link this method by signing in to their bank instead of typing account details. + */ + @JsonProperty("supports_plaid") + public boolean getSupportsPlaid() { + return supportsPlaid; + } + + @JsonProperty("supports_standard_delivery") + public boolean getSupportsStandardDelivery() { + return supportsStandardDelivery; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country_code") + private Optional _getCountryCode() { + return countryCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMethodsResponseDataItemSupportedPayoutMethod + && equalTo((ListMethodsResponseDataItemSupportedPayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMethodsResponseDataItemSupportedPayoutMethod other) { + return countryCode.equals(other.countryCode) + && deliveryType.equals(other.deliveryType) + && iconUrl.equals(other.iconUrl) + && name.equals(other.name) + && supportsInstantDelivery == other.supportsInstantDelivery + && supportsPlaid == other.supportsPlaid + && supportsStandardDelivery == other.supportsStandardDelivery; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.countryCode, + this.deliveryType, + this.iconUrl, + this.name, + this.supportsInstantDelivery, + this.supportsPlaid, + this.supportsStandardDelivery); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeliveryTypeStage builder() { + return new Builder(); + } + + public interface DeliveryTypeStage { + /** + *

How funds are delivered.

+ */ + SupportsInstantDeliveryStage deliveryType( + @NotNull ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType deliveryType); + + Builder from(ListMethodsResponseDataItemSupportedPayoutMethod other); + } + + public interface SupportsInstantDeliveryStage { + SupportsPlaidStage supportsInstantDelivery(boolean supportsInstantDelivery); + } + + public interface SupportsPlaidStage { + /** + *

Whether the payer can link this method by signing in to their bank instead of typing account details.

+ */ + SupportsStandardDeliveryStage supportsPlaid(boolean supportsPlaid); + } + + public interface SupportsStandardDeliveryStage { + _FinalStage supportsStandardDelivery(boolean supportsStandardDelivery); + } + + public interface _FinalStage { + ListMethodsResponseDataItemSupportedPayoutMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ */ + _FinalStage countryCode(Optional countryCode); + + _FinalStage countryCode(String countryCode); + + _FinalStage countryCode(Nullable countryCode); + + /** + *

Supported payout method icon URL.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Supported payout method display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements DeliveryTypeStage, + SupportsInstantDeliveryStage, + SupportsPlaidStage, + SupportsStandardDeliveryStage, + _FinalStage { + private ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType deliveryType; + + private boolean supportsInstantDelivery; + + private boolean supportsPlaid; + + private boolean supportsStandardDelivery; + + private Optional name = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + private Optional countryCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMethodsResponseDataItemSupportedPayoutMethod other) { + countryCode(other.getCountryCode()); + deliveryType(other.getDeliveryType()); + iconUrl(other.getIconUrl()); + name(other.getName()); + supportsInstantDelivery(other.getSupportsInstantDelivery()); + supportsPlaid(other.getSupportsPlaid()); + supportsStandardDelivery(other.getSupportsStandardDelivery()); + return this; + } + + /** + *

How funds are delivered.

+ *

How funds are delivered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("delivery_type") + public SupportsInstantDeliveryStage deliveryType( + @NotNull ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType deliveryType) { + this.deliveryType = Objects.requireNonNull(deliveryType, "deliveryType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("supports_instant_delivery") + public SupportsPlaidStage supportsInstantDelivery(boolean supportsInstantDelivery) { + this.supportsInstantDelivery = supportsInstantDelivery; + return this; + } + + /** + *

Whether the payer can link this method by signing in to their bank instead of typing account details.

+ *

Whether the payer can link this method by signing in to their bank instead of typing account details.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("supports_plaid") + public SupportsStandardDeliveryStage supportsPlaid(boolean supportsPlaid) { + this.supportsPlaid = supportsPlaid; + return this; + } + + @java.lang.Override + @JsonSetter("supports_standard_delivery") + public _FinalStage supportsStandardDelivery(boolean supportsStandardDelivery) { + this.supportsStandardDelivery = supportsStandardDelivery; + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Supported payout method display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Supported payout method icon URL.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage countryCode(Nullable countryCode) { + if (countryCode.isNull()) { + this.countryCode = null; + } else if (countryCode.isEmpty()) { + this.countryCode = Optional.empty(); + } else { + this.countryCode = Optional.of(countryCode.get()); + } + return this; + } + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage countryCode(String countryCode) { + this.countryCode = Optional.ofNullable(countryCode); + return this; + } + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ */ + @java.lang.Override + @JsonSetter(value = "country_code", nulls = Nulls.SKIP) + public _FinalStage countryCode(Optional countryCode) { + this.countryCode = countryCode; + return this; + } + + @java.lang.Override + public ListMethodsResponseDataItemSupportedPayoutMethod build() { + return new ListMethodsResponseDataItemSupportedPayoutMethod( + countryCode, + deliveryType, + iconUrl, + name, + supportsInstantDelivery, + supportsPlaid, + supportsStandardDelivery, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType.java new file mode 100644 index 00000000..c4febf2e --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType { + public static final ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType PAPER_CHECK = + new ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType(Value.PAPER_CHECK, "paper_check"); + + public static final ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType CRYPTOCURRENCY = + new ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType(Value.CRYPTOCURRENCY, "cryptocurrency"); + + public static final ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType UNKNOWN = + new ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType(Value.UNKNOWN, "unknown"); + + public static final ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType HOME_DELIVERY = + new ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType(Value.HOME_DELIVERY, "home_delivery"); + + public static final ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType BANK_DEPOSIT = + new ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType(Value.BANK_DEPOSIT, "bank_deposit"); + + public static final ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType MASSPAY_CARD = + new ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType(Value.MASSPAY_CARD, "masspay_card"); + + public static final ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType MOBILE_WALLET = + new ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType(Value.MOBILE_WALLET, "mobile_wallet"); + + public static final ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType CASH_PICKUP = + new ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType(Value.CASH_PICKUP, "cash_pickup"); + + public static final ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType BILL = + new ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType(Value.BILL, "bill"); + + private final Value value; + + private final String string; + + ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType + && this.string.equals( + ((ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAPER_CHECK: + return visitor.visitPaperCheck(); + case CRYPTOCURRENCY: + return visitor.visitCryptocurrency(); + case UNKNOWN: + return visitor.visitUnknown(); + case HOME_DELIVERY: + return visitor.visitHomeDelivery(); + case BANK_DEPOSIT: + return visitor.visitBankDeposit(); + case MASSPAY_CARD: + return visitor.visitMasspayCard(); + case MOBILE_WALLET: + return visitor.visitMobileWallet(); + case CASH_PICKUP: + return visitor.visitCashPickup(); + case BILL: + return visitor.visitBill(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType valueOf(String value) { + switch (value) { + case "paper_check": + return PAPER_CHECK; + case "cryptocurrency": + return CRYPTOCURRENCY; + case "unknown": + return UNKNOWN; + case "home_delivery": + return HOME_DELIVERY; + case "bank_deposit": + return BANK_DEPOSIT; + case "masspay_card": + return MASSPAY_CARD; + case "mobile_wallet": + return MOBILE_WALLET; + case "cash_pickup": + return CASH_PICKUP; + case "bill": + return BILL; + default: + return new ListMethodsResponseDataItemSupportedPayoutMethodDeliveryType(Value._UNKNOWN, value); + } + } + + public enum Value { + CASH_PICKUP, + + BANK_DEPOSIT, + + HOME_DELIVERY, + + MOBILE_WALLET, + + MASSPAY_CARD, + + PAPER_CHECK, + + BILL, + + CRYPTOCURRENCY, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitCashPickup(); + + T visitBankDeposit(); + + T visitHomeDelivery(); + + T visitMobileWallet(); + + T visitMasspayCard(); + + T visitPaperCheck(); + + T visitBill(); + + T visitCryptocurrency(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemUnavailableReason.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemUnavailableReason.java new file mode 100644 index 00000000..efbdc614 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseDataItemUnavailableReason.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListMethodsResponseDataItemUnavailableReason { + public static final ListMethodsResponseDataItemUnavailableReason DESTINATION_RETIRED = + new ListMethodsResponseDataItemUnavailableReason(Value.DESTINATION_RETIRED, "destination_retired"); + + private final Value value; + + private final String string; + + ListMethodsResponseDataItemUnavailableReason(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListMethodsResponseDataItemUnavailableReason + && this.string.equals(((ListMethodsResponseDataItemUnavailableReason) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DESTINATION_RETIRED: + return visitor.visitDestinationRetired(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListMethodsResponseDataItemUnavailableReason valueOf(String value) { + switch (value) { + case "destination_retired": + return DESTINATION_RETIRED; + default: + return new ListMethodsResponseDataItemUnavailableReason(Value.UNKNOWN, value); + } + } + + public enum Value { + DESTINATION_RETIRED, + + UNKNOWN + } + + public interface Visitor { + T visitDestinationRetired(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseLimits.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseLimits.java new file mode 100644 index 00000000..34295967 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseLimits.java @@ -0,0 +1,225 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMethodsResponseLimits.Builder.class) +public final class ListMethodsResponseLimits { + private final String currency; + + private final ListMethodsResponseLimitsInstant instant; + + private final ListMethodsResponseLimitsObject object; + + private final ListMethodsResponseLimitsStandard standard; + + private final Map additionalProperties; + + private ListMethodsResponseLimits( + String currency, + ListMethodsResponseLimitsInstant instant, + ListMethodsResponseLimitsObject object, + ListMethodsResponseLimitsStandard standard, + Map additionalProperties) { + this.currency = currency; + this.instant = instant; + this.object = object; + this.standard = standard; + this.additionalProperties = additionalProperties; + } + + /** + * @return The currency the caps are denominated in. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Caps for instant-speed payouts, which additionally draw on pending funds. + */ + @JsonProperty("instant") + public ListMethodsResponseLimitsInstant getInstant() { + return instant; + } + + @JsonProperty("object") + public ListMethodsResponseLimitsObject getObject() { + return object; + } + + /** + * @return Caps for standard-speed payouts, which draw on settled funds only. + */ + @JsonProperty("standard") + public ListMethodsResponseLimitsStandard getStandard() { + return standard; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMethodsResponseLimits && equalTo((ListMethodsResponseLimits) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMethodsResponseLimits other) { + return currency.equals(other.currency) + && instant.equals(other.instant) + && object.equals(other.object) + && standard.equals(other.standard); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.instant, this.object, this.standard); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + /** + *

The currency the caps are denominated in.

+ */ + InstantStage currency(@NotNull String currency); + + Builder from(ListMethodsResponseLimits other); + } + + public interface InstantStage { + /** + *

Caps for instant-speed payouts, which additionally draw on pending funds.

+ */ + ObjectStage instant(@NotNull ListMethodsResponseLimitsInstant instant); + } + + public interface ObjectStage { + StandardStage object(@NotNull ListMethodsResponseLimitsObject object); + } + + public interface StandardStage { + /** + *

Caps for standard-speed payouts, which draw on settled funds only.

+ */ + _FinalStage standard(@NotNull ListMethodsResponseLimitsStandard standard); + } + + public interface _FinalStage { + ListMethodsResponseLimits build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, InstantStage, ObjectStage, StandardStage, _FinalStage { + private String currency; + + private ListMethodsResponseLimitsInstant instant; + + private ListMethodsResponseLimitsObject object; + + private ListMethodsResponseLimitsStandard standard; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMethodsResponseLimits other) { + currency(other.getCurrency()); + instant(other.getInstant()); + object(other.getObject()); + standard(other.getStandard()); + return this; + } + + /** + *

The currency the caps are denominated in.

+ *

The currency the caps are denominated in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public InstantStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Caps for instant-speed payouts, which additionally draw on pending funds.

+ *

Caps for instant-speed payouts, which additionally draw on pending funds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("instant") + public ObjectStage instant(@NotNull ListMethodsResponseLimitsInstant instant) { + this.instant = Objects.requireNonNull(instant, "instant must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public StandardStage object(@NotNull ListMethodsResponseLimitsObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Caps for standard-speed payouts, which draw on settled funds only.

+ *

Caps for standard-speed payouts, which draw on settled funds only.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("standard") + public _FinalStage standard(@NotNull ListMethodsResponseLimitsStandard standard) { + this.standard = Objects.requireNonNull(standard, "standard must not be null"); + return this; + } + + @java.lang.Override + public ListMethodsResponseLimits build() { + return new ListMethodsResponseLimits(currency, instant, object, standard, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseLimitsInstant.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseLimitsInstant.java new file mode 100644 index 00000000..f977c455 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseLimitsInstant.java @@ -0,0 +1,418 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMethodsResponseLimitsInstant.Builder.class) +public final class ListMethodsResponseLimitsInstant { + private final Optional dailyAmountRemaining; + + private final Optional errorCode; + + private final Optional errorMessage; + + private final float maxAmount; + + private final Optional resetsAt; + + private final Map additionalProperties; + + private ListMethodsResponseLimitsInstant( + Optional dailyAmountRemaining, + Optional errorCode, + Optional errorMessage, + float maxAmount, + Optional resetsAt, + Map additionalProperties) { + this.dailyAmountRemaining = dailyAmountRemaining; + this.errorCode = errorCode; + this.errorMessage = errorMessage; + this.maxAmount = maxAmount; + this.resetsAt = resetsAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return How much of the account's daily instant allowance is left, in the requested currency. Null when the account is exempt from the daily cap, which is not the same as 0. + */ + @JsonIgnore + public Optional getDailyAmountRemaining() { + if (dailyAmountRemaining == null) { + return Optional.empty(); + } + return dailyAmountRemaining; + } + + /** + * @return Why instant payouts are unavailable for this account, or null when they are available. + */ + @JsonIgnore + public Optional getErrorCode() { + if (errorCode == null) { + return Optional.empty(); + } + return errorCode; + } + + /** + * @return Human-readable form of error_code, or null when instant payouts are available. + */ + @JsonIgnore + public Optional getErrorMessage() { + if (errorMessage == null) { + return Optional.empty(); + } + return errorMessage; + } + + /** + * @return The maximum amount an instant payout can move right now, in whole currency units. Already bounded by the remaining daily instant allowance; 0 while an eligibility error blocks instant payouts. + */ + @JsonProperty("max_amount") + public float getMaxAmount() { + return maxAmount; + } + + /** + * @return When the daily instant allowance resets, or null when the account is exempt from the daily cap. + */ + @JsonIgnore + public Optional getResetsAt() { + if (resetsAt == null) { + return Optional.empty(); + } + return resetsAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("daily_amount_remaining") + private Optional _getDailyAmountRemaining() { + return dailyAmountRemaining; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("error_code") + private Optional _getErrorCode() { + return errorCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("error_message") + private Optional _getErrorMessage() { + return errorMessage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resets_at") + private Optional _getResetsAt() { + return resetsAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMethodsResponseLimitsInstant && equalTo((ListMethodsResponseLimitsInstant) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMethodsResponseLimitsInstant other) { + return dailyAmountRemaining.equals(other.dailyAmountRemaining) + && errorCode.equals(other.errorCode) + && errorMessage.equals(other.errorMessage) + && maxAmount == other.maxAmount + && resetsAt.equals(other.resetsAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.dailyAmountRemaining, this.errorCode, this.errorMessage, this.maxAmount, this.resetsAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MaxAmountStage builder() { + return new Builder(); + } + + public interface MaxAmountStage { + /** + *

The maximum amount an instant payout can move right now, in whole currency units. Already bounded by the remaining daily instant allowance; 0 while an eligibility error blocks instant payouts.

+ */ + _FinalStage maxAmount(float maxAmount); + + Builder from(ListMethodsResponseLimitsInstant other); + } + + public interface _FinalStage { + ListMethodsResponseLimitsInstant build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

How much of the account's daily instant allowance is left, in the requested currency. Null when the account is exempt from the daily cap, which is not the same as 0.

+ */ + _FinalStage dailyAmountRemaining(Optional dailyAmountRemaining); + + _FinalStage dailyAmountRemaining(Float dailyAmountRemaining); + + _FinalStage dailyAmountRemaining(Nullable dailyAmountRemaining); + + /** + *

Why instant payouts are unavailable for this account, or null when they are available.

+ */ + _FinalStage errorCode(Optional errorCode); + + _FinalStage errorCode(ListMethodsResponseLimitsInstantErrorCode errorCode); + + _FinalStage errorCode(Nullable errorCode); + + /** + *

Human-readable form of error_code, or null when instant payouts are available.

+ */ + _FinalStage errorMessage(Optional errorMessage); + + _FinalStage errorMessage(String errorMessage); + + _FinalStage errorMessage(Nullable errorMessage); + + /** + *

When the daily instant allowance resets, or null when the account is exempt from the daily cap.

+ */ + _FinalStage resetsAt(Optional resetsAt); + + _FinalStage resetsAt(OffsetDateTime resetsAt); + + _FinalStage resetsAt(Nullable resetsAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MaxAmountStage, _FinalStage { + private float maxAmount; + + private Optional resetsAt = Optional.empty(); + + private Optional errorMessage = Optional.empty(); + + private Optional errorCode = Optional.empty(); + + private Optional dailyAmountRemaining = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMethodsResponseLimitsInstant other) { + dailyAmountRemaining(other.getDailyAmountRemaining()); + errorCode(other.getErrorCode()); + errorMessage(other.getErrorMessage()); + maxAmount(other.getMaxAmount()); + resetsAt(other.getResetsAt()); + return this; + } + + /** + *

The maximum amount an instant payout can move right now, in whole currency units. Already bounded by the remaining daily instant allowance; 0 while an eligibility error blocks instant payouts.

+ *

The maximum amount an instant payout can move right now, in whole currency units. Already bounded by the remaining daily instant allowance; 0 while an eligibility error blocks instant payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("max_amount") + public _FinalStage maxAmount(float maxAmount) { + this.maxAmount = maxAmount; + return this; + } + + /** + *

When the daily instant allowance resets, or null when the account is exempt from the daily cap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resetsAt(Nullable resetsAt) { + if (resetsAt.isNull()) { + this.resetsAt = null; + } else if (resetsAt.isEmpty()) { + this.resetsAt = Optional.empty(); + } else { + this.resetsAt = Optional.of(resetsAt.get()); + } + return this; + } + + /** + *

When the daily instant allowance resets, or null when the account is exempt from the daily cap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resetsAt(OffsetDateTime resetsAt) { + this.resetsAt = Optional.ofNullable(resetsAt); + return this; + } + + /** + *

When the daily instant allowance resets, or null when the account is exempt from the daily cap.

+ */ + @java.lang.Override + @JsonSetter(value = "resets_at", nulls = Nulls.SKIP) + public _FinalStage resetsAt(Optional resetsAt) { + this.resetsAt = resetsAt; + return this; + } + + /** + *

Human-readable form of error_code, or null when instant payouts are available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorMessage(Nullable errorMessage) { + if (errorMessage.isNull()) { + this.errorMessage = null; + } else if (errorMessage.isEmpty()) { + this.errorMessage = Optional.empty(); + } else { + this.errorMessage = Optional.of(errorMessage.get()); + } + return this; + } + + /** + *

Human-readable form of error_code, or null when instant payouts are available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorMessage(String errorMessage) { + this.errorMessage = Optional.ofNullable(errorMessage); + return this; + } + + /** + *

Human-readable form of error_code, or null when instant payouts are available.

+ */ + @java.lang.Override + @JsonSetter(value = "error_message", nulls = Nulls.SKIP) + public _FinalStage errorMessage(Optional errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + *

Why instant payouts are unavailable for this account, or null when they are available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorCode(Nullable errorCode) { + if (errorCode.isNull()) { + this.errorCode = null; + } else if (errorCode.isEmpty()) { + this.errorCode = Optional.empty(); + } else { + this.errorCode = Optional.of(errorCode.get()); + } + return this; + } + + /** + *

Why instant payouts are unavailable for this account, or null when they are available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorCode(ListMethodsResponseLimitsInstantErrorCode errorCode) { + this.errorCode = Optional.ofNullable(errorCode); + return this; + } + + /** + *

Why instant payouts are unavailable for this account, or null when they are available.

+ */ + @java.lang.Override + @JsonSetter(value = "error_code", nulls = Nulls.SKIP) + public _FinalStage errorCode(Optional errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + *

How much of the account's daily instant allowance is left, in the requested currency. Null when the account is exempt from the daily cap, which is not the same as 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dailyAmountRemaining(Nullable dailyAmountRemaining) { + if (dailyAmountRemaining.isNull()) { + this.dailyAmountRemaining = null; + } else if (dailyAmountRemaining.isEmpty()) { + this.dailyAmountRemaining = Optional.empty(); + } else { + this.dailyAmountRemaining = Optional.of(dailyAmountRemaining.get()); + } + return this; + } + + /** + *

How much of the account's daily instant allowance is left, in the requested currency. Null when the account is exempt from the daily cap, which is not the same as 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dailyAmountRemaining(Float dailyAmountRemaining) { + this.dailyAmountRemaining = Optional.ofNullable(dailyAmountRemaining); + return this; + } + + /** + *

How much of the account's daily instant allowance is left, in the requested currency. Null when the account is exempt from the daily cap, which is not the same as 0.

+ */ + @java.lang.Override + @JsonSetter(value = "daily_amount_remaining", nulls = Nulls.SKIP) + public _FinalStage dailyAmountRemaining(Optional dailyAmountRemaining) { + this.dailyAmountRemaining = dailyAmountRemaining; + return this; + } + + @java.lang.Override + public ListMethodsResponseLimitsInstant build() { + return new ListMethodsResponseLimitsInstant( + dailyAmountRemaining, errorCode, errorMessage, maxAmount, resetsAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseLimitsInstantErrorCode.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseLimitsInstantErrorCode.java new file mode 100644 index 00000000..c939528c --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseLimitsInstantErrorCode.java @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListMethodsResponseLimitsInstantErrorCode { + public static final ListMethodsResponseLimitsInstantErrorCode ACCOUNT_DAILY_LIMIT_REACHED = + new ListMethodsResponseLimitsInstantErrorCode( + Value.ACCOUNT_DAILY_LIMIT_REACHED, "account_daily_limit_reached"); + + public static final ListMethodsResponseLimitsInstantErrorCode AMOUNT_TOO_HIGH = + new ListMethodsResponseLimitsInstantErrorCode(Value.AMOUNT_TOO_HIGH, "amount_too_high"); + + public static final ListMethodsResponseLimitsInstantErrorCode RESTRICTED_ACCOUNT = + new ListMethodsResponseLimitsInstantErrorCode(Value.RESTRICTED_ACCOUNT, "restricted_account"); + + public static final ListMethodsResponseLimitsInstantErrorCode FEATURE_DISABLED = + new ListMethodsResponseLimitsInstantErrorCode(Value.FEATURE_DISABLED, "feature_disabled"); + + private final Value value; + + private final String string; + + ListMethodsResponseLimitsInstantErrorCode(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListMethodsResponseLimitsInstantErrorCode + && this.string.equals(((ListMethodsResponseLimitsInstantErrorCode) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ACCOUNT_DAILY_LIMIT_REACHED: + return visitor.visitAccountDailyLimitReached(); + case AMOUNT_TOO_HIGH: + return visitor.visitAmountTooHigh(); + case RESTRICTED_ACCOUNT: + return visitor.visitRestrictedAccount(); + case FEATURE_DISABLED: + return visitor.visitFeatureDisabled(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListMethodsResponseLimitsInstantErrorCode valueOf(String value) { + switch (value) { + case "account_daily_limit_reached": + return ACCOUNT_DAILY_LIMIT_REACHED; + case "amount_too_high": + return AMOUNT_TOO_HIGH; + case "restricted_account": + return RESTRICTED_ACCOUNT; + case "feature_disabled": + return FEATURE_DISABLED; + default: + return new ListMethodsResponseLimitsInstantErrorCode(Value.UNKNOWN, value); + } + } + + public enum Value { + AMOUNT_TOO_HIGH, + + ACCOUNT_DAILY_LIMIT_REACHED, + + RESTRICTED_ACCOUNT, + + FEATURE_DISABLED, + + UNKNOWN + } + + public interface Visitor { + T visitAmountTooHigh(); + + T visitAccountDailyLimitReached(); + + T visitRestrictedAccount(); + + T visitFeatureDisabled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseLimitsObject.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseLimitsObject.java new file mode 100644 index 00000000..4542818f --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseLimitsObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListMethodsResponseLimitsObject { + public static final ListMethodsResponseLimitsObject PAYOUT_LIMIT = + new ListMethodsResponseLimitsObject(Value.PAYOUT_LIMIT, "payout_limit"); + + private final Value value; + + private final String string; + + ListMethodsResponseLimitsObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListMethodsResponseLimitsObject + && this.string.equals(((ListMethodsResponseLimitsObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYOUT_LIMIT: + return visitor.visitPayoutLimit(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListMethodsResponseLimitsObject valueOf(String value) { + switch (value) { + case "payout_limit": + return PAYOUT_LIMIT; + default: + return new ListMethodsResponseLimitsObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYOUT_LIMIT, + + UNKNOWN + } + + public interface Visitor { + T visitPayoutLimit(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseLimitsStandard.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseLimitsStandard.java new file mode 100644 index 00000000..428f8765 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponseLimitsStandard.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMethodsResponseLimitsStandard.Builder.class) +public final class ListMethodsResponseLimitsStandard { + private final float maxAmount; + + private final Map additionalProperties; + + private ListMethodsResponseLimitsStandard(float maxAmount, Map additionalProperties) { + this.maxAmount = maxAmount; + this.additionalProperties = additionalProperties; + } + + /** + * @return The maximum amount a standard payout can move right now, in whole currency units. + */ + @JsonProperty("max_amount") + public float getMaxAmount() { + return maxAmount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMethodsResponseLimitsStandard && equalTo((ListMethodsResponseLimitsStandard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMethodsResponseLimitsStandard other) { + return maxAmount == other.maxAmount; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.maxAmount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MaxAmountStage builder() { + return new Builder(); + } + + public interface MaxAmountStage { + /** + *

The maximum amount a standard payout can move right now, in whole currency units.

+ */ + _FinalStage maxAmount(float maxAmount); + + Builder from(ListMethodsResponseLimitsStandard other); + } + + public interface _FinalStage { + ListMethodsResponseLimitsStandard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MaxAmountStage, _FinalStage { + private float maxAmount; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMethodsResponseLimitsStandard other) { + maxAmount(other.getMaxAmount()); + return this; + } + + /** + *

The maximum amount a standard payout can move right now, in whole currency units.

+ *

The maximum amount a standard payout can move right now, in whole currency units.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("max_amount") + public _FinalStage maxAmount(float maxAmount) { + this.maxAmount = maxAmount; + return this; + } + + @java.lang.Override + public ListMethodsResponseLimitsStandard build() { + return new ListMethodsResponseLimitsStandard(maxAmount, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponsePageInfo.java b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponsePageInfo.java new file mode 100644 index 00000000..bdda5f83 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/ListMethodsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMethodsResponsePageInfo.Builder.class) +public final class ListMethodsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListMethodsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMethodsResponsePageInfo && equalTo((ListMethodsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMethodsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListMethodsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListMethodsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListMethodsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListMethodsResponsePageInfo build() { + return new ListMethodsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponse.java b/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponse.java new file mode 100644 index 00000000..88dff051 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponse.java @@ -0,0 +1,1220 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateMethodsResponse.Builder.class) +public final class UpdateMethodsResponse { + private final Optional accountReference; + + private final Optional bankVerificationState; + + private final OffsetDateTime createdAt; + + private final String destinationCurrency; + + private final Optional> estimatedArrival; + + private final Optional> feeStructure; + + private final String id; + + private final Optional institutionName; + + private final boolean isClone; + + private final boolean isDefault; + + private final Optional lastPaidOutAt; + + private final boolean linkedViaPlaid; + + private final boolean needsPlaidReconnect; + + private final Optional nickname; + + private final UpdateMethodsResponseObject object; + + private final Optional payerName; + + private final Optional> quote; + + private final UpdateMethodsResponseStatus status; + + private final Optional statusReason; + + private final Optional supportedPayoutMethod; + + private final Optional unavailableReason; + + private final Map additionalProperties; + + private UpdateMethodsResponse( + Optional accountReference, + Optional bankVerificationState, + OffsetDateTime createdAt, + String destinationCurrency, + Optional> estimatedArrival, + Optional> feeStructure, + String id, + Optional institutionName, + boolean isClone, + boolean isDefault, + Optional lastPaidOutAt, + boolean linkedViaPlaid, + boolean needsPlaidReconnect, + Optional nickname, + UpdateMethodsResponseObject object, + Optional payerName, + Optional> quote, + UpdateMethodsResponseStatus status, + Optional statusReason, + Optional supportedPayoutMethod, + Optional unavailableReason, + Map additionalProperties) { + this.accountReference = accountReference; + this.bankVerificationState = bankVerificationState; + this.createdAt = createdAt; + this.destinationCurrency = destinationCurrency; + this.estimatedArrival = estimatedArrival; + this.feeStructure = feeStructure; + this.id = id; + this.institutionName = institutionName; + this.isClone = isClone; + this.isDefault = isDefault; + this.lastPaidOutAt = lastPaidOutAt; + this.linkedViaPlaid = linkedViaPlaid; + this.needsPlaidReconnect = needsPlaidReconnect; + this.nickname = nickname; + this.object = object; + this.payerName = payerName; + this.quote = quote; + this.status = status; + this.statusReason = statusReason; + this.supportedPayoutMethod = supportedPayoutMethod; + this.unavailableReason = unavailableReason; + this.additionalProperties = additionalProperties; + } + + /** + * @return Masked identifier for the destination. + */ + @JsonIgnore + public Optional getAccountReference() { + if (accountReference == null) { + return Optional.empty(); + } + return accountReference; + } + + /** + * @return Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked). + */ + @JsonIgnore + public Optional getBankVerificationState() { + if (bankVerificationState == null) { + return Optional.empty(); + } + return bankVerificationState; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("destination_currency") + public String getDestinationCurrency() { + return destinationCurrency; + } + + /** + * @return null after an update. List payout methods to retrieve arrival estimates. + */ + @JsonIgnore + public Optional> getEstimatedArrival() { + if (estimatedArrival == null) { + return Optional.empty(); + } + return estimatedArrival; + } + + /** + * @return null after an update. List payout methods to retrieve the configured fee terms. + */ + @JsonIgnore + public Optional> getFeeStructure() { + if (feeStructure == null) { + return Optional.empty(); + } + return feeStructure; + } + + /** + * @return Payout method ID, prefixed potk_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getInstitutionName() { + if (institutionName == null) { + return Optional.empty(); + } + return institutionName; + } + + /** + * @return Whether this method is a copy of one saved on another of the payer's accounts. + */ + @JsonProperty("is_clone") + public boolean getIsClone() { + return isClone; + } + + @JsonProperty("is_default") + public boolean getIsDefault() { + return isDefault; + } + + /** + * @return When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet. + */ + @JsonIgnore + public Optional getLastPaidOutAt() { + if (lastPaidOutAt == null) { + return Optional.empty(); + } + return lastPaidOutAt; + } + + /** + * @return Whether the payer added this method by signing in to their bank rather than typing account details. + */ + @JsonProperty("linked_via_plaid") + public boolean getLinkedViaPlaid() { + return linkedViaPlaid; + } + + /** + * @return Whether the bank sign-in behind this method has expired and must be redone before it counts as linked. + */ + @JsonProperty("needs_plaid_reconnect") + public boolean getNeedsPlaidReconnect() { + return needsPlaidReconnect; + } + + /** + * @return User-defined label for the payout method. + */ + @JsonIgnore + public Optional getNickname() { + if (nickname == null) { + return Optional.empty(); + } + return nickname; + } + + @JsonProperty("object") + public UpdateMethodsResponseObject getObject() { + return object; + } + + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + /** + * @return Always null after an update. + */ + @JsonIgnore + public Optional> getQuote() { + if (quote == null) { + return Optional.empty(); + } + return quote; + } + + /** + * @return created — saved, no payout has completed through it yet. active — a payout through it completed. broken — a payout through it failed with an error attributable to the method, and it no longer accepts payouts; a later successful payout returns it to active. + */ + @JsonProperty("status") + public UpdateMethodsResponseStatus getStatus() { + return status; + } + + /** + * @return Machine-readable code for why the method is broken — the newest failure recorded through it, whether a payout error or a pre-payout rejection. null unless the method is broken, or when it was disabled without a recorded failure. + */ + @JsonIgnore + public Optional getStatusReason() { + if (statusReason == null) { + return Optional.empty(); + } + return statusReason; + } + + @JsonIgnore + public Optional getSupportedPayoutMethod() { + if (supportedPayoutMethod == null) { + return Optional.empty(); + } + return supportedPayoutMethod; + } + + /** + * @return Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known. + */ + @JsonIgnore + public Optional getUnavailableReason() { + if (unavailableReason == null) { + return Optional.empty(); + } + return unavailableReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_reference") + private Optional _getAccountReference() { + return accountReference; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bank_verification_state") + private Optional _getBankVerificationState() { + return bankVerificationState; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("estimated_arrival") + private Optional> _getEstimatedArrival() { + return estimatedArrival; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fee_structure") + private Optional> _getFeeStructure() { + return feeStructure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("institution_name") + private Optional _getInstitutionName() { + return institutionName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_paid_out_at") + private Optional _getLastPaidOutAt() { + return lastPaidOutAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("nickname") + private Optional _getNickname() { + return nickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("quote") + private Optional> _getQuote() { + return quote; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status_reason") + private Optional _getStatusReason() { + return statusReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("supported_payout_method") + private Optional _getSupportedPayoutMethod() { + return supportedPayoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("unavailable_reason") + private Optional _getUnavailableReason() { + return unavailableReason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateMethodsResponse && equalTo((UpdateMethodsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateMethodsResponse other) { + return accountReference.equals(other.accountReference) + && bankVerificationState.equals(other.bankVerificationState) + && createdAt.equals(other.createdAt) + && destinationCurrency.equals(other.destinationCurrency) + && estimatedArrival.equals(other.estimatedArrival) + && feeStructure.equals(other.feeStructure) + && id.equals(other.id) + && institutionName.equals(other.institutionName) + && isClone == other.isClone + && isDefault == other.isDefault + && lastPaidOutAt.equals(other.lastPaidOutAt) + && linkedViaPlaid == other.linkedViaPlaid + && needsPlaidReconnect == other.needsPlaidReconnect + && nickname.equals(other.nickname) + && object.equals(other.object) + && payerName.equals(other.payerName) + && quote.equals(other.quote) + && status.equals(other.status) + && statusReason.equals(other.statusReason) + && supportedPayoutMethod.equals(other.supportedPayoutMethod) + && unavailableReason.equals(other.unavailableReason); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountReference, + this.bankVerificationState, + this.createdAt, + this.destinationCurrency, + this.estimatedArrival, + this.feeStructure, + this.id, + this.institutionName, + this.isClone, + this.isDefault, + this.lastPaidOutAt, + this.linkedViaPlaid, + this.needsPlaidReconnect, + this.nickname, + this.object, + this.payerName, + this.quote, + this.status, + this.statusReason, + this.supportedPayoutMethod, + this.unavailableReason); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + DestinationCurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(UpdateMethodsResponse other); + } + + public interface DestinationCurrencyStage { + IdStage destinationCurrency(@NotNull String destinationCurrency); + } + + public interface IdStage { + /** + *

Payout method ID, prefixed potk_.

+ */ + IsCloneStage id(@NotNull String id); + } + + public interface IsCloneStage { + /** + *

Whether this method is a copy of one saved on another of the payer's accounts.

+ */ + IsDefaultStage isClone(boolean isClone); + } + + public interface IsDefaultStage { + LinkedViaPlaidStage isDefault(boolean isDefault); + } + + public interface LinkedViaPlaidStage { + /** + *

Whether the payer added this method by signing in to their bank rather than typing account details.

+ */ + NeedsPlaidReconnectStage linkedViaPlaid(boolean linkedViaPlaid); + } + + public interface NeedsPlaidReconnectStage { + /** + *

Whether the bank sign-in behind this method has expired and must be redone before it counts as linked.

+ */ + ObjectStage needsPlaidReconnect(boolean needsPlaidReconnect); + } + + public interface ObjectStage { + StatusStage object(@NotNull UpdateMethodsResponseObject object); + } + + public interface StatusStage { + /** + *

created — saved, no payout has completed through it yet. active — a payout through it completed. broken — a payout through it failed with an error attributable to the method, and it no longer accepts payouts; a later successful payout returns it to active.

+ */ + _FinalStage status(@NotNull UpdateMethodsResponseStatus status); + } + + public interface _FinalStage { + UpdateMethodsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Masked identifier for the destination.

+ */ + _FinalStage accountReference(Optional accountReference); + + _FinalStage accountReference(String accountReference); + + _FinalStage accountReference(Nullable accountReference); + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ */ + _FinalStage bankVerificationState(Optional bankVerificationState); + + _FinalStage bankVerificationState(UpdateMethodsResponseBankVerificationState bankVerificationState); + + _FinalStage bankVerificationState(Nullable bankVerificationState); + + /** + *

null after an update. List payout methods to retrieve arrival estimates.

+ */ + _FinalStage estimatedArrival(Optional> estimatedArrival); + + _FinalStage estimatedArrival(Map estimatedArrival); + + _FinalStage estimatedArrival(Nullable> estimatedArrival); + + /** + *

null after an update. List payout methods to retrieve the configured fee terms.

+ */ + _FinalStage feeStructure(Optional> feeStructure); + + _FinalStage feeStructure(Map feeStructure); + + _FinalStage feeStructure(Nullable> feeStructure); + + _FinalStage institutionName(Optional institutionName); + + _FinalStage institutionName(String institutionName); + + _FinalStage institutionName(Nullable institutionName); + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ */ + _FinalStage lastPaidOutAt(Optional lastPaidOutAt); + + _FinalStage lastPaidOutAt(OffsetDateTime lastPaidOutAt); + + _FinalStage lastPaidOutAt(Nullable lastPaidOutAt); + + /** + *

User-defined label for the payout method.

+ */ + _FinalStage nickname(Optional nickname); + + _FinalStage nickname(String nickname); + + _FinalStage nickname(Nullable nickname); + + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + + /** + *

Always null after an update.

+ */ + _FinalStage quote(Optional> quote); + + _FinalStage quote(Map quote); + + _FinalStage quote(Nullable> quote); + + /** + *

Machine-readable code for why the method is broken — the newest failure recorded through it, whether a payout error or a pre-payout rejection. null unless the method is broken, or when it was disabled without a recorded failure.

+ */ + _FinalStage statusReason(Optional statusReason); + + _FinalStage statusReason(String statusReason); + + _FinalStage statusReason(Nullable statusReason); + + _FinalStage supportedPayoutMethod(Optional supportedPayoutMethod); + + _FinalStage supportedPayoutMethod(UpdateMethodsResponseSupportedPayoutMethod supportedPayoutMethod); + + _FinalStage supportedPayoutMethod(Nullable supportedPayoutMethod); + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ */ + _FinalStage unavailableReason(Optional unavailableReason); + + _FinalStage unavailableReason(UpdateMethodsResponseUnavailableReason unavailableReason); + + _FinalStage unavailableReason(Nullable unavailableReason); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + DestinationCurrencyStage, + IdStage, + IsCloneStage, + IsDefaultStage, + LinkedViaPlaidStage, + NeedsPlaidReconnectStage, + ObjectStage, + StatusStage, + _FinalStage { + private OffsetDateTime createdAt; + + private String destinationCurrency; + + private String id; + + private boolean isClone; + + private boolean isDefault; + + private boolean linkedViaPlaid; + + private boolean needsPlaidReconnect; + + private UpdateMethodsResponseObject object; + + private UpdateMethodsResponseStatus status; + + private Optional unavailableReason = Optional.empty(); + + private Optional supportedPayoutMethod = Optional.empty(); + + private Optional statusReason = Optional.empty(); + + private Optional> quote = Optional.empty(); + + private Optional payerName = Optional.empty(); + + private Optional nickname = Optional.empty(); + + private Optional lastPaidOutAt = Optional.empty(); + + private Optional institutionName = Optional.empty(); + + private Optional> feeStructure = Optional.empty(); + + private Optional> estimatedArrival = Optional.empty(); + + private Optional bankVerificationState = Optional.empty(); + + private Optional accountReference = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateMethodsResponse other) { + accountReference(other.getAccountReference()); + bankVerificationState(other.getBankVerificationState()); + createdAt(other.getCreatedAt()); + destinationCurrency(other.getDestinationCurrency()); + estimatedArrival(other.getEstimatedArrival()); + feeStructure(other.getFeeStructure()); + id(other.getId()); + institutionName(other.getInstitutionName()); + isClone(other.getIsClone()); + isDefault(other.getIsDefault()); + lastPaidOutAt(other.getLastPaidOutAt()); + linkedViaPlaid(other.getLinkedViaPlaid()); + needsPlaidReconnect(other.getNeedsPlaidReconnect()); + nickname(other.getNickname()); + object(other.getObject()); + payerName(other.getPayerName()); + quote(other.getQuote()); + status(other.getStatus()); + statusReason(other.getStatusReason()); + supportedPayoutMethod(other.getSupportedPayoutMethod()); + unavailableReason(other.getUnavailableReason()); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public DestinationCurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("destination_currency") + public IdStage destinationCurrency(@NotNull String destinationCurrency) { + this.destinationCurrency = + Objects.requireNonNull(destinationCurrency, "destinationCurrency must not be null"); + return this; + } + + /** + *

Payout method ID, prefixed potk_.

+ *

Payout method ID, prefixed potk_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsCloneStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether this method is a copy of one saved on another of the payer's accounts.

+ *

Whether this method is a copy of one saved on another of the payer's accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_clone") + public IsDefaultStage isClone(boolean isClone) { + this.isClone = isClone; + return this; + } + + @java.lang.Override + @JsonSetter("is_default") + public LinkedViaPlaidStage isDefault(boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + /** + *

Whether the payer added this method by signing in to their bank rather than typing account details.

+ *

Whether the payer added this method by signing in to their bank rather than typing account details.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("linked_via_plaid") + public NeedsPlaidReconnectStage linkedViaPlaid(boolean linkedViaPlaid) { + this.linkedViaPlaid = linkedViaPlaid; + return this; + } + + /** + *

Whether the bank sign-in behind this method has expired and must be redone before it counts as linked.

+ *

Whether the bank sign-in behind this method has expired and must be redone before it counts as linked.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("needs_plaid_reconnect") + public ObjectStage needsPlaidReconnect(boolean needsPlaidReconnect) { + this.needsPlaidReconnect = needsPlaidReconnect; + return this; + } + + @java.lang.Override + @JsonSetter("object") + public StatusStage object(@NotNull UpdateMethodsResponseObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

created — saved, no payout has completed through it yet. active — a payout through it completed. broken — a payout through it failed with an error attributable to the method, and it no longer accepts payouts; a later successful payout returns it to active.

+ *

created — saved, no payout has completed through it yet. active — a payout through it completed. broken — a payout through it failed with an error attributable to the method, and it no longer accepts payouts; a later successful payout returns it to active.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull UpdateMethodsResponseStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage unavailableReason(Nullable unavailableReason) { + if (unavailableReason.isNull()) { + this.unavailableReason = null; + } else if (unavailableReason.isEmpty()) { + this.unavailableReason = Optional.empty(); + } else { + this.unavailableReason = Optional.of(unavailableReason.get()); + } + return this; + } + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage unavailableReason(UpdateMethodsResponseUnavailableReason unavailableReason) { + this.unavailableReason = Optional.ofNullable(unavailableReason); + return this; + } + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ */ + @java.lang.Override + @JsonSetter(value = "unavailable_reason", nulls = Nulls.SKIP) + public _FinalStage unavailableReason(Optional unavailableReason) { + this.unavailableReason = unavailableReason; + return this; + } + + @java.lang.Override + public _FinalStage supportedPayoutMethod( + Nullable supportedPayoutMethod) { + if (supportedPayoutMethod.isNull()) { + this.supportedPayoutMethod = null; + } else if (supportedPayoutMethod.isEmpty()) { + this.supportedPayoutMethod = Optional.empty(); + } else { + this.supportedPayoutMethod = Optional.of(supportedPayoutMethod.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage supportedPayoutMethod(UpdateMethodsResponseSupportedPayoutMethod supportedPayoutMethod) { + this.supportedPayoutMethod = Optional.ofNullable(supportedPayoutMethod); + return this; + } + + @java.lang.Override + @JsonSetter(value = "supported_payout_method", nulls = Nulls.SKIP) + public _FinalStage supportedPayoutMethod( + Optional supportedPayoutMethod) { + this.supportedPayoutMethod = supportedPayoutMethod; + return this; + } + + /** + *

Machine-readable code for why the method is broken — the newest failure recorded through it, whether a payout error or a pre-payout rejection. null unless the method is broken, or when it was disabled without a recorded failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statusReason(Nullable statusReason) { + if (statusReason.isNull()) { + this.statusReason = null; + } else if (statusReason.isEmpty()) { + this.statusReason = Optional.empty(); + } else { + this.statusReason = Optional.of(statusReason.get()); + } + return this; + } + + /** + *

Machine-readable code for why the method is broken — the newest failure recorded through it, whether a payout error or a pre-payout rejection. null unless the method is broken, or when it was disabled without a recorded failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statusReason(String statusReason) { + this.statusReason = Optional.ofNullable(statusReason); + return this; + } + + /** + *

Machine-readable code for why the method is broken — the newest failure recorded through it, whether a payout error or a pre-payout rejection. null unless the method is broken, or when it was disabled without a recorded failure.

+ */ + @java.lang.Override + @JsonSetter(value = "status_reason", nulls = Nulls.SKIP) + public _FinalStage statusReason(Optional statusReason) { + this.statusReason = statusReason; + return this; + } + + /** + *

Always null after an update.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quote(Nullable> quote) { + if (quote.isNull()) { + this.quote = null; + } else if (quote.isEmpty()) { + this.quote = Optional.empty(); + } else { + this.quote = Optional.of(quote.get()); + } + return this; + } + + /** + *

Always null after an update.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quote(Map quote) { + this.quote = Optional.ofNullable(quote); + return this; + } + + /** + *

Always null after an update.

+ */ + @java.lang.Override + @JsonSetter(value = "quote", nulls = Nulls.SKIP) + public _FinalStage quote(Optional> quote) { + this.quote = quote; + return this; + } + + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

User-defined label for the payout method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(Nullable nickname) { + if (nickname.isNull()) { + this.nickname = null; + } else if (nickname.isEmpty()) { + this.nickname = Optional.empty(); + } else { + this.nickname = Optional.of(nickname.get()); + } + return this; + } + + /** + *

User-defined label for the payout method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(String nickname) { + this.nickname = Optional.ofNullable(nickname); + return this; + } + + /** + *

User-defined label for the payout method.

+ */ + @java.lang.Override + @JsonSetter(value = "nickname", nulls = Nulls.SKIP) + public _FinalStage nickname(Optional nickname) { + this.nickname = nickname; + return this; + } + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaidOutAt(Nullable lastPaidOutAt) { + if (lastPaidOutAt.isNull()) { + this.lastPaidOutAt = null; + } else if (lastPaidOutAt.isEmpty()) { + this.lastPaidOutAt = Optional.empty(); + } else { + this.lastPaidOutAt = Optional.of(lastPaidOutAt.get()); + } + return this; + } + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaidOutAt(OffsetDateTime lastPaidOutAt) { + this.lastPaidOutAt = Optional.ofNullable(lastPaidOutAt); + return this; + } + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ */ + @java.lang.Override + @JsonSetter(value = "last_paid_out_at", nulls = Nulls.SKIP) + public _FinalStage lastPaidOutAt(Optional lastPaidOutAt) { + this.lastPaidOutAt = lastPaidOutAt; + return this; + } + + @java.lang.Override + public _FinalStage institutionName(Nullable institutionName) { + if (institutionName.isNull()) { + this.institutionName = null; + } else if (institutionName.isEmpty()) { + this.institutionName = Optional.empty(); + } else { + this.institutionName = Optional.of(institutionName.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage institutionName(String institutionName) { + this.institutionName = Optional.ofNullable(institutionName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "institution_name", nulls = Nulls.SKIP) + public _FinalStage institutionName(Optional institutionName) { + this.institutionName = institutionName; + return this; + } + + /** + *

null after an update. List payout methods to retrieve the configured fee terms.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeStructure(Nullable> feeStructure) { + if (feeStructure.isNull()) { + this.feeStructure = null; + } else if (feeStructure.isEmpty()) { + this.feeStructure = Optional.empty(); + } else { + this.feeStructure = Optional.of(feeStructure.get()); + } + return this; + } + + /** + *

null after an update. List payout methods to retrieve the configured fee terms.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeStructure(Map feeStructure) { + this.feeStructure = Optional.ofNullable(feeStructure); + return this; + } + + /** + *

null after an update. List payout methods to retrieve the configured fee terms.

+ */ + @java.lang.Override + @JsonSetter(value = "fee_structure", nulls = Nulls.SKIP) + public _FinalStage feeStructure(Optional> feeStructure) { + this.feeStructure = feeStructure; + return this; + } + + /** + *

null after an update. List payout methods to retrieve arrival estimates.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(Nullable> estimatedArrival) { + if (estimatedArrival.isNull()) { + this.estimatedArrival = null; + } else if (estimatedArrival.isEmpty()) { + this.estimatedArrival = Optional.empty(); + } else { + this.estimatedArrival = Optional.of(estimatedArrival.get()); + } + return this; + } + + /** + *

null after an update. List payout methods to retrieve arrival estimates.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(Map estimatedArrival) { + this.estimatedArrival = Optional.ofNullable(estimatedArrival); + return this; + } + + /** + *

null after an update. List payout methods to retrieve arrival estimates.

+ */ + @java.lang.Override + @JsonSetter(value = "estimated_arrival", nulls = Nulls.SKIP) + public _FinalStage estimatedArrival(Optional> estimatedArrival) { + this.estimatedArrival = estimatedArrival; + return this; + } + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bankVerificationState( + Nullable bankVerificationState) { + if (bankVerificationState.isNull()) { + this.bankVerificationState = null; + } else if (bankVerificationState.isEmpty()) { + this.bankVerificationState = Optional.empty(); + } else { + this.bankVerificationState = Optional.of(bankVerificationState.get()); + } + return this; + } + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bankVerificationState(UpdateMethodsResponseBankVerificationState bankVerificationState) { + this.bankVerificationState = Optional.ofNullable(bankVerificationState); + return this; + } + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ */ + @java.lang.Override + @JsonSetter(value = "bank_verification_state", nulls = Nulls.SKIP) + public _FinalStage bankVerificationState( + Optional bankVerificationState) { + this.bankVerificationState = bankVerificationState; + return this; + } + + /** + *

Masked identifier for the destination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountReference(Nullable accountReference) { + if (accountReference.isNull()) { + this.accountReference = null; + } else if (accountReference.isEmpty()) { + this.accountReference = Optional.empty(); + } else { + this.accountReference = Optional.of(accountReference.get()); + } + return this; + } + + /** + *

Masked identifier for the destination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountReference(String accountReference) { + this.accountReference = Optional.ofNullable(accountReference); + return this; + } + + /** + *

Masked identifier for the destination.

+ */ + @java.lang.Override + @JsonSetter(value = "account_reference", nulls = Nulls.SKIP) + public _FinalStage accountReference(Optional accountReference) { + this.accountReference = accountReference; + return this; + } + + @java.lang.Override + public UpdateMethodsResponse build() { + return new UpdateMethodsResponse( + accountReference, + bankVerificationState, + createdAt, + destinationCurrency, + estimatedArrival, + feeStructure, + id, + institutionName, + isClone, + isDefault, + lastPaidOutAt, + linkedViaPlaid, + needsPlaidReconnect, + nickname, + object, + payerName, + quote, + status, + statusReason, + supportedPayoutMethod, + unavailableReason, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseBankVerificationState.java b/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseBankVerificationState.java new file mode 100644 index 00000000..6b2e78fc --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseBankVerificationState.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateMethodsResponseBankVerificationState { + public static final UpdateMethodsResponseBankVerificationState NO_DATA = + new UpdateMethodsResponseBankVerificationState(Value.NO_DATA, "no_data"); + + public static final UpdateMethodsResponseBankVerificationState CHECKING = + new UpdateMethodsResponseBankVerificationState(Value.CHECKING, "checking"); + + public static final UpdateMethodsResponseBankVerificationState WARNING = + new UpdateMethodsResponseBankVerificationState(Value.WARNING, "warning"); + + public static final UpdateMethodsResponseBankVerificationState VERIFIED = + new UpdateMethodsResponseBankVerificationState(Value.VERIFIED, "verified"); + + public static final UpdateMethodsResponseBankVerificationState BROKEN = + new UpdateMethodsResponseBankVerificationState(Value.BROKEN, "broken"); + + private final Value value; + + private final String string; + + UpdateMethodsResponseBankVerificationState(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateMethodsResponseBankVerificationState + && this.string.equals(((UpdateMethodsResponseBankVerificationState) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NO_DATA: + return visitor.visitNoData(); + case CHECKING: + return visitor.visitChecking(); + case WARNING: + return visitor.visitWarning(); + case VERIFIED: + return visitor.visitVerified(); + case BROKEN: + return visitor.visitBroken(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateMethodsResponseBankVerificationState valueOf(String value) { + switch (value) { + case "no_data": + return NO_DATA; + case "checking": + return CHECKING; + case "warning": + return WARNING; + case "verified": + return VERIFIED; + case "broken": + return BROKEN; + default: + return new UpdateMethodsResponseBankVerificationState(Value.UNKNOWN, value); + } + } + + public enum Value { + CHECKING, + + VERIFIED, + + NO_DATA, + + WARNING, + + BROKEN, + + UNKNOWN + } + + public interface Visitor { + T visitChecking(); + + T visitVerified(); + + T visitNoData(); + + T visitWarning(); + + T visitBroken(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseObject.java b/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseObject.java new file mode 100644 index 00000000..21169187 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateMethodsResponseObject { + public static final UpdateMethodsResponseObject PAYOUT_METHOD = + new UpdateMethodsResponseObject(Value.PAYOUT_METHOD, "payout_method"); + + private final Value value; + + private final String string; + + UpdateMethodsResponseObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateMethodsResponseObject + && this.string.equals(((UpdateMethodsResponseObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYOUT_METHOD: + return visitor.visitPayoutMethod(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateMethodsResponseObject valueOf(String value) { + switch (value) { + case "payout_method": + return PAYOUT_METHOD; + default: + return new UpdateMethodsResponseObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYOUT_METHOD, + + UNKNOWN + } + + public interface Visitor { + T visitPayoutMethod(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseStatus.java b/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseStatus.java new file mode 100644 index 00000000..ad288f3b --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseStatus.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateMethodsResponseStatus { + public static final UpdateMethodsResponseStatus CREATED = new UpdateMethodsResponseStatus(Value.CREATED, "created"); + + public static final UpdateMethodsResponseStatus ACTIVE = new UpdateMethodsResponseStatus(Value.ACTIVE, "active"); + + public static final UpdateMethodsResponseStatus BROKEN = new UpdateMethodsResponseStatus(Value.BROKEN, "broken"); + + private final Value value; + + private final String string; + + UpdateMethodsResponseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateMethodsResponseStatus + && this.string.equals(((UpdateMethodsResponseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED: + return visitor.visitCreated(); + case ACTIVE: + return visitor.visitActive(); + case BROKEN: + return visitor.visitBroken(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateMethodsResponseStatus valueOf(String value) { + switch (value) { + case "created": + return CREATED; + case "active": + return ACTIVE; + case "broken": + return BROKEN; + default: + return new UpdateMethodsResponseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED, + + ACTIVE, + + BROKEN, + + UNKNOWN + } + + public interface Visitor { + T visitCreated(); + + T visitActive(); + + T visitBroken(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseSupportedPayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseSupportedPayoutMethod.java new file mode 100644 index 00000000..a0781650 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseSupportedPayoutMethod.java @@ -0,0 +1,418 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateMethodsResponseSupportedPayoutMethod.Builder.class) +public final class UpdateMethodsResponseSupportedPayoutMethod { + private final Optional countryCode; + + private final UpdateMethodsResponseSupportedPayoutMethodDeliveryType deliveryType; + + private final Optional iconUrl; + + private final Optional name; + + private final boolean supportsInstantDelivery; + + private final boolean supportsPlaid; + + private final boolean supportsStandardDelivery; + + private final Map additionalProperties; + + private UpdateMethodsResponseSupportedPayoutMethod( + Optional countryCode, + UpdateMethodsResponseSupportedPayoutMethodDeliveryType deliveryType, + Optional iconUrl, + Optional name, + boolean supportsInstantDelivery, + boolean supportsPlaid, + boolean supportsStandardDelivery, + Map additionalProperties) { + this.countryCode = countryCode; + this.deliveryType = deliveryType; + this.iconUrl = iconUrl; + this.name = name; + this.supportsInstantDelivery = supportsInstantDelivery; + this.supportsPlaid = supportsPlaid; + this.supportsStandardDelivery = supportsStandardDelivery; + this.additionalProperties = additionalProperties; + } + + /** + * @return ISO 3166-1 alpha-3 country the destination pays out to. + */ + @JsonIgnore + public Optional getCountryCode() { + if (countryCode == null) { + return Optional.empty(); + } + return countryCode; + } + + /** + * @return How funds are delivered. + */ + @JsonProperty("delivery_type") + public UpdateMethodsResponseSupportedPayoutMethodDeliveryType getDeliveryType() { + return deliveryType; + } + + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("supports_instant_delivery") + public boolean getSupportsInstantDelivery() { + return supportsInstantDelivery; + } + + /** + * @return Whether the payer can link this method by signing in to their bank instead of typing account details. + */ + @JsonProperty("supports_plaid") + public boolean getSupportsPlaid() { + return supportsPlaid; + } + + @JsonProperty("supports_standard_delivery") + public boolean getSupportsStandardDelivery() { + return supportsStandardDelivery; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country_code") + private Optional _getCountryCode() { + return countryCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateMethodsResponseSupportedPayoutMethod + && equalTo((UpdateMethodsResponseSupportedPayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateMethodsResponseSupportedPayoutMethod other) { + return countryCode.equals(other.countryCode) + && deliveryType.equals(other.deliveryType) + && iconUrl.equals(other.iconUrl) + && name.equals(other.name) + && supportsInstantDelivery == other.supportsInstantDelivery + && supportsPlaid == other.supportsPlaid + && supportsStandardDelivery == other.supportsStandardDelivery; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.countryCode, + this.deliveryType, + this.iconUrl, + this.name, + this.supportsInstantDelivery, + this.supportsPlaid, + this.supportsStandardDelivery); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeliveryTypeStage builder() { + return new Builder(); + } + + public interface DeliveryTypeStage { + /** + *

How funds are delivered.

+ */ + SupportsInstantDeliveryStage deliveryType( + @NotNull UpdateMethodsResponseSupportedPayoutMethodDeliveryType deliveryType); + + Builder from(UpdateMethodsResponseSupportedPayoutMethod other); + } + + public interface SupportsInstantDeliveryStage { + SupportsPlaidStage supportsInstantDelivery(boolean supportsInstantDelivery); + } + + public interface SupportsPlaidStage { + /** + *

Whether the payer can link this method by signing in to their bank instead of typing account details.

+ */ + SupportsStandardDeliveryStage supportsPlaid(boolean supportsPlaid); + } + + public interface SupportsStandardDeliveryStage { + _FinalStage supportsStandardDelivery(boolean supportsStandardDelivery); + } + + public interface _FinalStage { + UpdateMethodsResponseSupportedPayoutMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ */ + _FinalStage countryCode(Optional countryCode); + + _FinalStage countryCode(String countryCode); + + _FinalStage countryCode(Nullable countryCode); + + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements DeliveryTypeStage, + SupportsInstantDeliveryStage, + SupportsPlaidStage, + SupportsStandardDeliveryStage, + _FinalStage { + private UpdateMethodsResponseSupportedPayoutMethodDeliveryType deliveryType; + + private boolean supportsInstantDelivery; + + private boolean supportsPlaid; + + private boolean supportsStandardDelivery; + + private Optional name = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + private Optional countryCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateMethodsResponseSupportedPayoutMethod other) { + countryCode(other.getCountryCode()); + deliveryType(other.getDeliveryType()); + iconUrl(other.getIconUrl()); + name(other.getName()); + supportsInstantDelivery(other.getSupportsInstantDelivery()); + supportsPlaid(other.getSupportsPlaid()); + supportsStandardDelivery(other.getSupportsStandardDelivery()); + return this; + } + + /** + *

How funds are delivered.

+ *

How funds are delivered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("delivery_type") + public SupportsInstantDeliveryStage deliveryType( + @NotNull UpdateMethodsResponseSupportedPayoutMethodDeliveryType deliveryType) { + this.deliveryType = Objects.requireNonNull(deliveryType, "deliveryType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("supports_instant_delivery") + public SupportsPlaidStage supportsInstantDelivery(boolean supportsInstantDelivery) { + this.supportsInstantDelivery = supportsInstantDelivery; + return this; + } + + /** + *

Whether the payer can link this method by signing in to their bank instead of typing account details.

+ *

Whether the payer can link this method by signing in to their bank instead of typing account details.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("supports_plaid") + public SupportsStandardDeliveryStage supportsPlaid(boolean supportsPlaid) { + this.supportsPlaid = supportsPlaid; + return this; + } + + @java.lang.Override + @JsonSetter("supports_standard_delivery") + public _FinalStage supportsStandardDelivery(boolean supportsStandardDelivery) { + this.supportsStandardDelivery = supportsStandardDelivery; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage countryCode(Nullable countryCode) { + if (countryCode.isNull()) { + this.countryCode = null; + } else if (countryCode.isEmpty()) { + this.countryCode = Optional.empty(); + } else { + this.countryCode = Optional.of(countryCode.get()); + } + return this; + } + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage countryCode(String countryCode) { + this.countryCode = Optional.ofNullable(countryCode); + return this; + } + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ */ + @java.lang.Override + @JsonSetter(value = "country_code", nulls = Nulls.SKIP) + public _FinalStage countryCode(Optional countryCode) { + this.countryCode = countryCode; + return this; + } + + @java.lang.Override + public UpdateMethodsResponseSupportedPayoutMethod build() { + return new UpdateMethodsResponseSupportedPayoutMethod( + countryCode, + deliveryType, + iconUrl, + name, + supportsInstantDelivery, + supportsPlaid, + supportsStandardDelivery, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseSupportedPayoutMethodDeliveryType.java b/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseSupportedPayoutMethodDeliveryType.java new file mode 100644 index 00000000..408c620a --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseSupportedPayoutMethodDeliveryType.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateMethodsResponseSupportedPayoutMethodDeliveryType { + public static final UpdateMethodsResponseSupportedPayoutMethodDeliveryType PAPER_CHECK = + new UpdateMethodsResponseSupportedPayoutMethodDeliveryType(Value.PAPER_CHECK, "paper_check"); + + public static final UpdateMethodsResponseSupportedPayoutMethodDeliveryType CRYPTOCURRENCY = + new UpdateMethodsResponseSupportedPayoutMethodDeliveryType(Value.CRYPTOCURRENCY, "cryptocurrency"); + + public static final UpdateMethodsResponseSupportedPayoutMethodDeliveryType UNKNOWN = + new UpdateMethodsResponseSupportedPayoutMethodDeliveryType(Value.UNKNOWN, "unknown"); + + public static final UpdateMethodsResponseSupportedPayoutMethodDeliveryType HOME_DELIVERY = + new UpdateMethodsResponseSupportedPayoutMethodDeliveryType(Value.HOME_DELIVERY, "home_delivery"); + + public static final UpdateMethodsResponseSupportedPayoutMethodDeliveryType BANK_DEPOSIT = + new UpdateMethodsResponseSupportedPayoutMethodDeliveryType(Value.BANK_DEPOSIT, "bank_deposit"); + + public static final UpdateMethodsResponseSupportedPayoutMethodDeliveryType MASSPAY_CARD = + new UpdateMethodsResponseSupportedPayoutMethodDeliveryType(Value.MASSPAY_CARD, "masspay_card"); + + public static final UpdateMethodsResponseSupportedPayoutMethodDeliveryType MOBILE_WALLET = + new UpdateMethodsResponseSupportedPayoutMethodDeliveryType(Value.MOBILE_WALLET, "mobile_wallet"); + + public static final UpdateMethodsResponseSupportedPayoutMethodDeliveryType CASH_PICKUP = + new UpdateMethodsResponseSupportedPayoutMethodDeliveryType(Value.CASH_PICKUP, "cash_pickup"); + + public static final UpdateMethodsResponseSupportedPayoutMethodDeliveryType BILL = + new UpdateMethodsResponseSupportedPayoutMethodDeliveryType(Value.BILL, "bill"); + + private final Value value; + + private final String string; + + UpdateMethodsResponseSupportedPayoutMethodDeliveryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateMethodsResponseSupportedPayoutMethodDeliveryType + && this.string.equals(((UpdateMethodsResponseSupportedPayoutMethodDeliveryType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAPER_CHECK: + return visitor.visitPaperCheck(); + case CRYPTOCURRENCY: + return visitor.visitCryptocurrency(); + case UNKNOWN: + return visitor.visitUnknown(); + case HOME_DELIVERY: + return visitor.visitHomeDelivery(); + case BANK_DEPOSIT: + return visitor.visitBankDeposit(); + case MASSPAY_CARD: + return visitor.visitMasspayCard(); + case MOBILE_WALLET: + return visitor.visitMobileWallet(); + case CASH_PICKUP: + return visitor.visitCashPickup(); + case BILL: + return visitor.visitBill(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateMethodsResponseSupportedPayoutMethodDeliveryType valueOf(String value) { + switch (value) { + case "paper_check": + return PAPER_CHECK; + case "cryptocurrency": + return CRYPTOCURRENCY; + case "unknown": + return UNKNOWN; + case "home_delivery": + return HOME_DELIVERY; + case "bank_deposit": + return BANK_DEPOSIT; + case "masspay_card": + return MASSPAY_CARD; + case "mobile_wallet": + return MOBILE_WALLET; + case "cash_pickup": + return CASH_PICKUP; + case "bill": + return BILL; + default: + return new UpdateMethodsResponseSupportedPayoutMethodDeliveryType(Value._UNKNOWN, value); + } + } + + public enum Value { + CASH_PICKUP, + + BANK_DEPOSIT, + + HOME_DELIVERY, + + MOBILE_WALLET, + + MASSPAY_CARD, + + PAPER_CHECK, + + BILL, + + CRYPTOCURRENCY, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitCashPickup(); + + T visitBankDeposit(); + + T visitHomeDelivery(); + + T visitMobileWallet(); + + T visitMasspayCard(); + + T visitPaperCheck(); + + T visitBill(); + + T visitCryptocurrency(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseUnavailableReason.java b/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseUnavailableReason.java new file mode 100644 index 00000000..448f31ca --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/methods/types/UpdateMethodsResponseUnavailableReason.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.methods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateMethodsResponseUnavailableReason { + public static final UpdateMethodsResponseUnavailableReason DESTINATION_RETIRED = + new UpdateMethodsResponseUnavailableReason(Value.DESTINATION_RETIRED, "destination_retired"); + + private final Value value; + + private final String string; + + UpdateMethodsResponseUnavailableReason(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateMethodsResponseUnavailableReason + && this.string.equals(((UpdateMethodsResponseUnavailableReason) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DESTINATION_RETIRED: + return visitor.visitDestinationRetired(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateMethodsResponseUnavailableReason valueOf(String value) { + switch (value) { + case "destination_retired": + return DESTINATION_RETIRED; + default: + return new UpdateMethodsResponseUnavailableReason(Value.UNKNOWN, value); + } + } + + public enum Value { + DESTINATION_RETIRED, + + UNKNOWN + } + + public interface Visitor { + T visitDestinationRetired(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/requests/ListPayoutsRequest.java b/src/main/java/com/whop/api/resources/payouts/requests/ListPayoutsRequest.java new file mode 100644 index 00000000..2ff67d78 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/requests/ListPayoutsRequest.java @@ -0,0 +1,471 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.payouts.types.ListPayoutsRequestSource; +import com.whop.api.resources.payouts.types.ListPayoutsRequestStatus; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPayoutsRequest.Builder.class) +public final class ListPayoutsRequest { + private final Optional accountId; + + private final Optional userId; + + private final Optional currency; + + private final Optional status; + + private final Optional source; + + private final Optional payoutMethodId; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListPayoutsRequest( + Optional accountId, + Optional userId, + Optional currency, + Optional status, + Optional source, + Optional payoutMethodId, + Optional createdBefore, + Optional createdAfter, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.accountId = accountId; + this.userId = userId; + this.currency = currency; + this.status = status; + this.source = source; + this.payoutMethodId = payoutMethodId; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return The owning account ID (a biz_ identifier). Provide this or user_id. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The owning user ID (a user_ identifier). Provide this or account_id. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + /** + * @return Optional currency code filter, for example usd. + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + /** + * @return Filter to payouts whose status reads this word, matching exactly what this version displays — reversed finds settled payouts the bank later returned. Requires Api-Version-Date 2026-08-21 or later. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Filter by how the payout was created. Payouts created before source tracking or through internal tooling carry no source and never match. + */ + @JsonProperty("source") + public Optional getSource() { + return source; + } + + /** + * @return Filter to payouts sent to one saved payout method (a pytk_ identifier). An unknown id matches nothing. + */ + @JsonProperty("payout_method_id") + public Optional getPayoutMethodId() { + return payoutMethodId; + } + + /** + * @return Only payouts created before this ISO 8601 time (exclusive). + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only payouts created at or after this ISO 8601 time (inclusive). + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Number of payouts to return from the start of the window. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to fetch the page after (from page_info.end_cursor). + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return Number of payouts to return from the end of the window. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to fetch the page before (from page_info.start_cursor). + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPayoutsRequest && equalTo((ListPayoutsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPayoutsRequest other) { + return accountId.equals(other.accountId) + && userId.equals(other.userId) + && currency.equals(other.currency) + && status.equals(other.status) + && source.equals(other.source) + && payoutMethodId.equals(other.payoutMethodId) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.userId, + this.currency, + this.status, + this.source, + this.payoutMethodId, + this.createdBefore, + this.createdAfter, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional source = Optional.empty(); + + private Optional payoutMethodId = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListPayoutsRequest other) { + accountId(other.getAccountId()); + userId(other.getUserId()); + currency(other.getCurrency()); + status(other.getStatus()); + source(other.getSource()); + payoutMethodId(other.getPayoutMethodId()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

The owning account ID (a biz_ identifier). Provide this or user_id.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The owning user ID (a user_ identifier). Provide this or account_id.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Optional currency code filter, for example usd.

+ */ + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional currency) { + this.currency = currency; + return this; + } + + public Builder currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

Filter to payouts whose status reads this word, matching exactly what this version displays — reversed finds settled payouts the bank later returned. Requires Api-Version-Date 2026-08-21 or later.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListPayoutsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Filter by how the payout was created. Payouts created before source tracking or through internal tooling carry no source and never match.

+ */ + @JsonSetter(value = "source", nulls = Nulls.SKIP) + public Builder source(Optional source) { + this.source = source; + return this; + } + + public Builder source(ListPayoutsRequestSource source) { + this.source = Optional.ofNullable(source); + return this; + } + + /** + *

Filter to payouts sent to one saved payout method (a pytk_ identifier). An unknown id matches nothing.

+ */ + @JsonSetter(value = "payout_method_id", nulls = Nulls.SKIP) + public Builder payoutMethodId(Optional payoutMethodId) { + this.payoutMethodId = payoutMethodId; + return this; + } + + public Builder payoutMethodId(String payoutMethodId) { + this.payoutMethodId = Optional.ofNullable(payoutMethodId); + return this; + } + + /** + *

Only payouts created before this ISO 8601 time (exclusive).

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only payouts created at or after this ISO 8601 time (inclusive).

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Number of payouts to return from the start of the window.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Number of payouts to return from the end of the window.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to fetch the page before (from page_info.start_cursor).

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListPayoutsRequest build() { + return new ListPayoutsRequest( + accountId, + userId, + currency, + status, + source, + payoutMethodId, + createdBefore, + createdAfter, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/requests/RetrievePayoutsRequest.java b/src/main/java/com/whop/api/resources/payouts/requests/RetrievePayoutsRequest.java new file mode 100644 index 00000000..2dae36e2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/requests/RetrievePayoutsRequest.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePayoutsRequest.Builder.class) +public final class RetrievePayoutsRequest { + private final Optional accountId; + + private final Optional userId; + + private final Map additionalProperties; + + private RetrievePayoutsRequest( + Optional accountId, Optional userId, Map additionalProperties) { + this.accountId = accountId; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Owning account ID, prefixed biz_. Provide exactly one of account_id or user_id. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Owning user ID, prefixed user_. Provide exactly one of account_id or user_id. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePayoutsRequest && equalTo((RetrievePayoutsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePayoutsRequest other) { + return accountId.equals(other.accountId) && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional userId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePayoutsRequest other) { + accountId(other.getAccountId()); + userId(other.getUserId()); + return this; + } + + /** + *

Owning account ID, prefixed biz_. Provide exactly one of account_id or user_id.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Owning user ID, prefixed user_. Provide exactly one of account_id or user_id.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + public RetrievePayoutsRequest build() { + return new RetrievePayoutsRequest(accountId, userId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/supportedmethods/AsyncRawSupportedMethodsClient.java b/src/main/java/com/whop/api/resources/payouts/supportedmethods/AsyncRawSupportedMethodsClient.java new file mode 100644 index 00000000..71a87f89 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/supportedmethods/AsyncRawSupportedMethodsClient.java @@ -0,0 +1,213 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.supportedmethods; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.payouts.supportedmethods.requests.ListSupportedMethodsRequest; +import com.whop.api.resources.payouts.supportedmethods.types.ListSupportedMethodsResponse; +import com.whop.api.resources.payouts.supportedmethods.types.ListSupportedMethodsResponseDataItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawSupportedMethodsClient { + protected final ClientOptions clientOptions; + + public AsyncRawSupportedMethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public CompletableFuture>> list() { + return list(ListSupportedMethodsRequest.builder().build()); + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListSupportedMethodsRequest.builder().build(), requestOptions); + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public CompletableFuture>> list( + ListSupportedMethodsRequest request) { + return list(request, null); + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public CompletableFuture>> list( + ListSupportedMethodsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts/supported_methods"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getCountry().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "country", request.getCountry().get(), false); + } + if (request.getAmount().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "amount", request.getAmount().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getSupportedPayoutMethodId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "supported_payout_method_id", + request.getSupportedPayoutMethodId().get(), + false); + } + if (request.getDestinationCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "destination_currency", + request.getDestinationCurrency().get(), + false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListSupportedMethodsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListSupportedMethodsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListSupportedMethodsRequest nextRequest = ListSupportedMethodsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/supportedmethods/AsyncSupportedMethodsClient.java b/src/main/java/com/whop/api/resources/payouts/supportedmethods/AsyncSupportedMethodsClient.java new file mode 100644 index 00000000..17b896fa --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/supportedmethods/AsyncSupportedMethodsClient.java @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.supportedmethods; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.payouts.supportedmethods.requests.ListSupportedMethodsRequest; +import com.whop.api.resources.payouts.supportedmethods.types.ListSupportedMethodsResponseDataItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncSupportedMethodsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawSupportedMethodsClient rawClient; + + public AsyncSupportedMethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawSupportedMethodsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawSupportedMethodsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public CompletableFuture> list( + RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public CompletableFuture> list( + ListSupportedMethodsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public CompletableFuture> list( + ListSupportedMethodsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/supportedmethods/RawSupportedMethodsClient.java b/src/main/java/com/whop/api/resources/payouts/supportedmethods/RawSupportedMethodsClient.java new file mode 100644 index 00000000..942d459c --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/supportedmethods/RawSupportedMethodsClient.java @@ -0,0 +1,178 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.supportedmethods; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.payouts.supportedmethods.requests.ListSupportedMethodsRequest; +import com.whop.api.resources.payouts.supportedmethods.types.ListSupportedMethodsResponse; +import com.whop.api.resources.payouts.supportedmethods.types.ListSupportedMethodsResponseDataItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawSupportedMethodsClient { + protected final ClientOptions clientOptions; + + public RawSupportedMethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public WhopApiHttpResponse> list() { + return list(ListSupportedMethodsRequest.builder().build()); + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public WhopApiHttpResponse> list( + RequestOptions requestOptions) { + return list(ListSupportedMethodsRequest.builder().build(), requestOptions); + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public WhopApiHttpResponse> list( + ListSupportedMethodsRequest request) { + return list(request, null); + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public WhopApiHttpResponse> list( + ListSupportedMethodsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("payouts/supported_methods"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getCountry().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "country", request.getCountry().get(), false); + } + if (request.getAmount().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "amount", request.getAmount().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getSupportedPayoutMethodId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "supported_payout_method_id", + request.getSupportedPayoutMethodId().get(), + false); + } + if (request.getDestinationCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "destination_currency", + request.getDestinationCurrency().get(), + false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListSupportedMethodsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListSupportedMethodsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListSupportedMethodsRequest nextRequest = ListSupportedMethodsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/supportedmethods/SupportedMethodsClient.java b/src/main/java/com/whop/api/resources/payouts/supportedmethods/SupportedMethodsClient.java new file mode 100644 index 00000000..6d3cb263 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/supportedmethods/SupportedMethodsClient.java @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.supportedmethods; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.payouts.supportedmethods.requests.ListSupportedMethodsRequest; +import com.whop.api.resources.payouts.supportedmethods.types.ListSupportedMethodsResponseDataItem; + +public class SupportedMethodsClient { + protected final ClientOptions clientOptions; + + private final RawSupportedMethodsClient rawClient; + + public SupportedMethodsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawSupportedMethodsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawSupportedMethodsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public SyncPagingIterable list(ListSupportedMethodsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the payout methods an account or user is eligible to add. + */ + public SyncPagingIterable list( + ListSupportedMethodsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/supportedmethods/requests/ListSupportedMethodsRequest.java b/src/main/java/com/whop/api/resources/payouts/supportedmethods/requests/ListSupportedMethodsRequest.java new file mode 100644 index 00000000..d69ad4ae --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/supportedmethods/requests/ListSupportedMethodsRequest.java @@ -0,0 +1,436 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.supportedmethods.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSupportedMethodsRequest.Builder.class) +public final class ListSupportedMethodsRequest { + private final Optional accountId; + + private final Optional userId; + + private final Optional country; + + private final Optional amount; + + private final Optional currency; + + private final Optional supportedPayoutMethodId; + + private final Optional destinationCurrency; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListSupportedMethodsRequest( + Optional accountId, + Optional userId, + Optional country, + Optional amount, + Optional currency, + Optional supportedPayoutMethodId, + Optional destinationCurrency, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.accountId = accountId; + this.userId = userId; + this.country = country; + this.amount = amount; + this.currency = currency; + this.supportedPayoutMethodId = supportedPayoutMethodId; + this.destinationCurrency = destinationCurrency; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return The owning account ID (a biz_ identifier). Provide this or user_id. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The owning user ID (a user_ identifier). Provide this or account_id. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + /** + * @return ISO 3166-1 alpha-2 country code for the bank account or wallet, such as US. Defaults to the country of supported_payout_method_id when one is given, otherwise the payout account's country. + */ + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + /** + * @return Optional withdrawal amount in whole currency units, for example 250.00. When provided, each destination includes per-currency fee and delivery quotes. + */ + @JsonProperty("amount") + public Optional getAmount() { + return amount; + } + + /** + * @return Currency code of the amount, for example usd. Only meaningful with amount. + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + /** + * @return Narrows the list to one supported payout method (a podst_ identifier) and includes the required_fields needed to save it as a payout method. + */ + @JsonProperty("supported_payout_method_id") + public Optional getSupportedPayoutMethodId() { + return supportedPayoutMethodId; + } + + /** + * @return Currency the supported payout method would deliver payouts in. Only meaningful with supported_payout_method_id; required fields vary by destination currency. + */ + @JsonProperty("destination_currency") + public Optional getDestinationCurrency() { + return destinationCurrency; + } + + /** + * @return Number of supported payout methods to return from the start of the window. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to fetch the page after (from page_info.end_cursor). + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return Number of supported payout methods to return from the end of the window. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to fetch the page before (from page_info.start_cursor). + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSupportedMethodsRequest && equalTo((ListSupportedMethodsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSupportedMethodsRequest other) { + return accountId.equals(other.accountId) + && userId.equals(other.userId) + && country.equals(other.country) + && amount.equals(other.amount) + && currency.equals(other.currency) + && supportedPayoutMethodId.equals(other.supportedPayoutMethodId) + && destinationCurrency.equals(other.destinationCurrency) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.userId, + this.country, + this.amount, + this.currency, + this.supportedPayoutMethodId, + this.destinationCurrency, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional amount = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional supportedPayoutMethodId = Optional.empty(); + + private Optional destinationCurrency = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListSupportedMethodsRequest other) { + accountId(other.getAccountId()); + userId(other.getUserId()); + country(other.getCountry()); + amount(other.getAmount()); + currency(other.getCurrency()); + supportedPayoutMethodId(other.getSupportedPayoutMethodId()); + destinationCurrency(other.getDestinationCurrency()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

The owning account ID (a biz_ identifier). Provide this or user_id.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The owning user ID (a user_ identifier). Provide this or account_id.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

ISO 3166-1 alpha-2 country code for the bank account or wallet, such as US. Defaults to the country of supported_payout_method_id when one is given, otherwise the payout account's country.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

Optional withdrawal amount in whole currency units, for example 250.00. When provided, each destination includes per-currency fee and delivery quotes.

+ */ + @JsonSetter(value = "amount", nulls = Nulls.SKIP) + public Builder amount(Optional amount) { + this.amount = amount; + return this; + } + + public Builder amount(Double amount) { + this.amount = Optional.ofNullable(amount); + return this; + } + + /** + *

Currency code of the amount, for example usd. Only meaningful with amount.

+ */ + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional currency) { + this.currency = currency; + return this; + } + + public Builder currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

Narrows the list to one supported payout method (a podst_ identifier) and includes the required_fields needed to save it as a payout method.

+ */ + @JsonSetter(value = "supported_payout_method_id", nulls = Nulls.SKIP) + public Builder supportedPayoutMethodId(Optional supportedPayoutMethodId) { + this.supportedPayoutMethodId = supportedPayoutMethodId; + return this; + } + + public Builder supportedPayoutMethodId(String supportedPayoutMethodId) { + this.supportedPayoutMethodId = Optional.ofNullable(supportedPayoutMethodId); + return this; + } + + /** + *

Currency the supported payout method would deliver payouts in. Only meaningful with supported_payout_method_id; required fields vary by destination currency.

+ */ + @JsonSetter(value = "destination_currency", nulls = Nulls.SKIP) + public Builder destinationCurrency(Optional destinationCurrency) { + this.destinationCurrency = destinationCurrency; + return this; + } + + public Builder destinationCurrency(String destinationCurrency) { + this.destinationCurrency = Optional.ofNullable(destinationCurrency); + return this; + } + + /** + *

Number of supported payout methods to return from the start of the window.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Number of supported payout methods to return from the end of the window.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to fetch the page before (from page_info.start_cursor).

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListSupportedMethodsRequest build() { + return new ListSupportedMethodsRequest( + accountId, + userId, + country, + amount, + currency, + supportedPayoutMethodId, + destinationCurrency, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponse.java b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponse.java new file mode 100644 index 00000000..e0b75724 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponse.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.supportedmethods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSupportedMethodsResponse.Builder.class) +public final class ListSupportedMethodsResponse { + private final List data; + + private final ListSupportedMethodsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListSupportedMethodsResponse( + List data, + ListSupportedMethodsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListSupportedMethodsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSupportedMethodsResponse && equalTo((ListSupportedMethodsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSupportedMethodsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListSupportedMethodsResponsePageInfo pageInfo); + + Builder from(ListSupportedMethodsResponse other); + } + + public interface _FinalStage { + ListSupportedMethodsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ListSupportedMethodsResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListSupportedMethodsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSupportedMethodsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListSupportedMethodsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ListSupportedMethodsResponseDataItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListSupportedMethodsResponse build() { + return new ListSupportedMethodsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItem.java b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItem.java new file mode 100644 index 00000000..eadeaafc --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItem.java @@ -0,0 +1,555 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.supportedmethods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSupportedMethodsResponseDataItem.Builder.class) +public final class ListSupportedMethodsResponseDataItem { + private final ListSupportedMethodsResponseDataItemDeliveryType deliveryType; + + private final Optional iconUrl; + + private final String id; + + private final Optional name; + + private final ListSupportedMethodsResponseDataItemObject object; + + private final Optional> quotes; + + private final Optional> requiredFields; + + private final boolean supportsInstantDelivery; + + private final boolean supportsStandardDelivery; + + private final Map additionalProperties; + + private ListSupportedMethodsResponseDataItem( + ListSupportedMethodsResponseDataItemDeliveryType deliveryType, + Optional iconUrl, + String id, + Optional name, + ListSupportedMethodsResponseDataItemObject object, + Optional> quotes, + Optional> requiredFields, + boolean supportsInstantDelivery, + boolean supportsStandardDelivery, + Map additionalProperties) { + this.deliveryType = deliveryType; + this.iconUrl = iconUrl; + this.id = id; + this.name = name; + this.object = object; + this.quotes = quotes; + this.requiredFields = requiredFields; + this.supportsInstantDelivery = supportsInstantDelivery; + this.supportsStandardDelivery = supportsStandardDelivery; + this.additionalProperties = additionalProperties; + } + + /** + * @return How funds are delivered, for example bank_deposit. + */ + @JsonProperty("delivery_type") + public ListSupportedMethodsResponseDataItemDeliveryType getDeliveryType() { + return deliveryType; + } + + /** + * @return Supported payout method icon URL. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return Supported payout method ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Supported payout method display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("object") + public ListSupportedMethodsResponseDataItemObject getObject() { + return object; + } + + /** + * @return Fee and delivery estimates for the requested amount, one per destination currency. Null unless an amount was provided. + */ + @JsonIgnore + public Optional> getQuotes() { + if (quotes == null) { + return Optional.empty(); + } + return quotes; + } + + /** + * @return Fields to collect before saving this supported payout method. Present only when supported_payout_method_id narrows the request to one method. + */ + @JsonIgnore + public Optional> getRequiredFields() { + if (requiredFields == null) { + return Optional.empty(); + } + return requiredFields; + } + + @JsonProperty("supports_instant_delivery") + public boolean getSupportsInstantDelivery() { + return supportsInstantDelivery; + } + + @JsonProperty("supports_standard_delivery") + public boolean getSupportsStandardDelivery() { + return supportsStandardDelivery; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("quotes") + private Optional> _getQuotes() { + return quotes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("required_fields") + private Optional> _getRequiredFields() { + return requiredFields; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSupportedMethodsResponseDataItem + && equalTo((ListSupportedMethodsResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSupportedMethodsResponseDataItem other) { + return deliveryType.equals(other.deliveryType) + && iconUrl.equals(other.iconUrl) + && id.equals(other.id) + && name.equals(other.name) + && object.equals(other.object) + && quotes.equals(other.quotes) + && requiredFields.equals(other.requiredFields) + && supportsInstantDelivery == other.supportsInstantDelivery + && supportsStandardDelivery == other.supportsStandardDelivery; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.deliveryType, + this.iconUrl, + this.id, + this.name, + this.object, + this.quotes, + this.requiredFields, + this.supportsInstantDelivery, + this.supportsStandardDelivery); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeliveryTypeStage builder() { + return new Builder(); + } + + public interface DeliveryTypeStage { + /** + *

How funds are delivered, for example bank_deposit.

+ */ + IdStage deliveryType(@NotNull ListSupportedMethodsResponseDataItemDeliveryType deliveryType); + + Builder from(ListSupportedMethodsResponseDataItem other); + } + + public interface IdStage { + /** + *

Supported payout method ID.

+ */ + ObjectStage id(@NotNull String id); + } + + public interface ObjectStage { + SupportsInstantDeliveryStage object(@NotNull ListSupportedMethodsResponseDataItemObject object); + } + + public interface SupportsInstantDeliveryStage { + SupportsStandardDeliveryStage supportsInstantDelivery(boolean supportsInstantDelivery); + } + + public interface SupportsStandardDeliveryStage { + _FinalStage supportsStandardDelivery(boolean supportsStandardDelivery); + } + + public interface _FinalStage { + ListSupportedMethodsResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Supported payout method icon URL.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Supported payout method display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

Fee and delivery estimates for the requested amount, one per destination currency. Null unless an amount was provided.

+ */ + _FinalStage quotes(Optional> quotes); + + _FinalStage quotes(List quotes); + + _FinalStage quotes(Nullable> quotes); + + /** + *

Fields to collect before saving this supported payout method. Present only when supported_payout_method_id narrows the request to one method.

+ */ + _FinalStage requiredFields( + Optional> requiredFields); + + _FinalStage requiredFields(List requiredFields); + + _FinalStage requiredFields( + Nullable> requiredFields); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements DeliveryTypeStage, + IdStage, + ObjectStage, + SupportsInstantDeliveryStage, + SupportsStandardDeliveryStage, + _FinalStage { + private ListSupportedMethodsResponseDataItemDeliveryType deliveryType; + + private String id; + + private ListSupportedMethodsResponseDataItemObject object; + + private boolean supportsInstantDelivery; + + private boolean supportsStandardDelivery; + + private Optional> requiredFields = + Optional.empty(); + + private Optional> quotes = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSupportedMethodsResponseDataItem other) { + deliveryType(other.getDeliveryType()); + iconUrl(other.getIconUrl()); + id(other.getId()); + name(other.getName()); + object(other.getObject()); + quotes(other.getQuotes()); + requiredFields(other.getRequiredFields()); + supportsInstantDelivery(other.getSupportsInstantDelivery()); + supportsStandardDelivery(other.getSupportsStandardDelivery()); + return this; + } + + /** + *

How funds are delivered, for example bank_deposit.

+ *

How funds are delivered, for example bank_deposit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("delivery_type") + public IdStage deliveryType(@NotNull ListSupportedMethodsResponseDataItemDeliveryType deliveryType) { + this.deliveryType = Objects.requireNonNull(deliveryType, "deliveryType must not be null"); + return this; + } + + /** + *

Supported payout method ID.

+ *

Supported payout method ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public SupportsInstantDeliveryStage object(@NotNull ListSupportedMethodsResponseDataItemObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("supports_instant_delivery") + public SupportsStandardDeliveryStage supportsInstantDelivery(boolean supportsInstantDelivery) { + this.supportsInstantDelivery = supportsInstantDelivery; + return this; + } + + @java.lang.Override + @JsonSetter("supports_standard_delivery") + public _FinalStage supportsStandardDelivery(boolean supportsStandardDelivery) { + this.supportsStandardDelivery = supportsStandardDelivery; + return this; + } + + /** + *

Fields to collect before saving this supported payout method. Present only when supported_payout_method_id narrows the request to one method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requiredFields( + Nullable> requiredFields) { + if (requiredFields.isNull()) { + this.requiredFields = null; + } else if (requiredFields.isEmpty()) { + this.requiredFields = Optional.empty(); + } else { + this.requiredFields = Optional.of(requiredFields.get()); + } + return this; + } + + /** + *

Fields to collect before saving this supported payout method. Present only when supported_payout_method_id narrows the request to one method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requiredFields(List requiredFields) { + this.requiredFields = Optional.ofNullable(requiredFields); + return this; + } + + /** + *

Fields to collect before saving this supported payout method. Present only when supported_payout_method_id narrows the request to one method.

+ */ + @java.lang.Override + @JsonSetter(value = "required_fields", nulls = Nulls.SKIP) + public _FinalStage requiredFields( + Optional> requiredFields) { + this.requiredFields = requiredFields; + return this; + } + + /** + *

Fee and delivery estimates for the requested amount, one per destination currency. Null unless an amount was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quotes(Nullable> quotes) { + if (quotes.isNull()) { + this.quotes = null; + } else if (quotes.isEmpty()) { + this.quotes = Optional.empty(); + } else { + this.quotes = Optional.of(quotes.get()); + } + return this; + } + + /** + *

Fee and delivery estimates for the requested amount, one per destination currency. Null unless an amount was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quotes(List quotes) { + this.quotes = Optional.ofNullable(quotes); + return this; + } + + /** + *

Fee and delivery estimates for the requested amount, one per destination currency. Null unless an amount was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "quotes", nulls = Nulls.SKIP) + public _FinalStage quotes(Optional> quotes) { + this.quotes = quotes; + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Supported payout method display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Supported payout method icon URL.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + @java.lang.Override + public ListSupportedMethodsResponseDataItem build() { + return new ListSupportedMethodsResponseDataItem( + deliveryType, + iconUrl, + id, + name, + object, + quotes, + requiredFields, + supportsInstantDelivery, + supportsStandardDelivery, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemDeliveryType.java b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemDeliveryType.java new file mode 100644 index 00000000..28e6c4c8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemDeliveryType.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.supportedmethods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListSupportedMethodsResponseDataItemDeliveryType { + public static final ListSupportedMethodsResponseDataItemDeliveryType PAPER_CHECK = + new ListSupportedMethodsResponseDataItemDeliveryType(Value.PAPER_CHECK, "paper_check"); + + public static final ListSupportedMethodsResponseDataItemDeliveryType CRYPTOCURRENCY = + new ListSupportedMethodsResponseDataItemDeliveryType(Value.CRYPTOCURRENCY, "cryptocurrency"); + + public static final ListSupportedMethodsResponseDataItemDeliveryType UNKNOWN = + new ListSupportedMethodsResponseDataItemDeliveryType(Value.UNKNOWN, "unknown"); + + public static final ListSupportedMethodsResponseDataItemDeliveryType HOME_DELIVERY = + new ListSupportedMethodsResponseDataItemDeliveryType(Value.HOME_DELIVERY, "home_delivery"); + + public static final ListSupportedMethodsResponseDataItemDeliveryType BANK_DEPOSIT = + new ListSupportedMethodsResponseDataItemDeliveryType(Value.BANK_DEPOSIT, "bank_deposit"); + + public static final ListSupportedMethodsResponseDataItemDeliveryType MASSPAY_CARD = + new ListSupportedMethodsResponseDataItemDeliveryType(Value.MASSPAY_CARD, "masspay_card"); + + public static final ListSupportedMethodsResponseDataItemDeliveryType MOBILE_WALLET = + new ListSupportedMethodsResponseDataItemDeliveryType(Value.MOBILE_WALLET, "mobile_wallet"); + + public static final ListSupportedMethodsResponseDataItemDeliveryType CASH_PICKUP = + new ListSupportedMethodsResponseDataItemDeliveryType(Value.CASH_PICKUP, "cash_pickup"); + + public static final ListSupportedMethodsResponseDataItemDeliveryType BILL = + new ListSupportedMethodsResponseDataItemDeliveryType(Value.BILL, "bill"); + + private final Value value; + + private final String string; + + ListSupportedMethodsResponseDataItemDeliveryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListSupportedMethodsResponseDataItemDeliveryType + && this.string.equals(((ListSupportedMethodsResponseDataItemDeliveryType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAPER_CHECK: + return visitor.visitPaperCheck(); + case CRYPTOCURRENCY: + return visitor.visitCryptocurrency(); + case UNKNOWN: + return visitor.visitUnknown(); + case HOME_DELIVERY: + return visitor.visitHomeDelivery(); + case BANK_DEPOSIT: + return visitor.visitBankDeposit(); + case MASSPAY_CARD: + return visitor.visitMasspayCard(); + case MOBILE_WALLET: + return visitor.visitMobileWallet(); + case CASH_PICKUP: + return visitor.visitCashPickup(); + case BILL: + return visitor.visitBill(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListSupportedMethodsResponseDataItemDeliveryType valueOf(String value) { + switch (value) { + case "paper_check": + return PAPER_CHECK; + case "cryptocurrency": + return CRYPTOCURRENCY; + case "unknown": + return UNKNOWN; + case "home_delivery": + return HOME_DELIVERY; + case "bank_deposit": + return BANK_DEPOSIT; + case "masspay_card": + return MASSPAY_CARD; + case "mobile_wallet": + return MOBILE_WALLET; + case "cash_pickup": + return CASH_PICKUP; + case "bill": + return BILL; + default: + return new ListSupportedMethodsResponseDataItemDeliveryType(Value._UNKNOWN, value); + } + } + + public enum Value { + CASH_PICKUP, + + BANK_DEPOSIT, + + HOME_DELIVERY, + + MOBILE_WALLET, + + MASSPAY_CARD, + + PAPER_CHECK, + + BILL, + + CRYPTOCURRENCY, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitCashPickup(); + + T visitBankDeposit(); + + T visitHomeDelivery(); + + T visitMobileWallet(); + + T visitMasspayCard(); + + T visitPaperCheck(); + + T visitBill(); + + T visitCryptocurrency(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemObject.java b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemObject.java new file mode 100644 index 00000000..f83ba9b0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.supportedmethods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListSupportedMethodsResponseDataItemObject { + public static final ListSupportedMethodsResponseDataItemObject SUPPORTED_PAYOUT_METHOD = + new ListSupportedMethodsResponseDataItemObject(Value.SUPPORTED_PAYOUT_METHOD, "supported_payout_method"); + + private final Value value; + + private final String string; + + ListSupportedMethodsResponseDataItemObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListSupportedMethodsResponseDataItemObject + && this.string.equals(((ListSupportedMethodsResponseDataItemObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SUPPORTED_PAYOUT_METHOD: + return visitor.visitSupportedPayoutMethod(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListSupportedMethodsResponseDataItemObject valueOf(String value) { + switch (value) { + case "supported_payout_method": + return SUPPORTED_PAYOUT_METHOD; + default: + return new ListSupportedMethodsResponseDataItemObject(Value.UNKNOWN, value); + } + } + + public enum Value { + SUPPORTED_PAYOUT_METHOD, + + UNKNOWN + } + + public interface Visitor { + T visitSupportedPayoutMethod(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemQuotesItem.java b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemQuotesItem.java new file mode 100644 index 00000000..0004e19d --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemQuotesItem.java @@ -0,0 +1,511 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.supportedmethods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSupportedMethodsResponseDataItemQuotesItem.Builder.class) +public final class ListSupportedMethodsResponseDataItemQuotesItem { + private final float amount; + + private final String currency; + + private final String destinationCurrency; + + private final float exchangeRate; + + private final Optional instant; + + private final Optional maxLimit; + + private final float minLimit; + + private final Optional standard; + + private final Map additionalProperties; + + private ListSupportedMethodsResponseDataItemQuotesItem( + float amount, + String currency, + String destinationCurrency, + float exchangeRate, + Optional instant, + Optional maxLimit, + float minLimit, + Optional standard, + Map additionalProperties) { + this.amount = amount; + this.currency = currency; + this.destinationCurrency = destinationCurrency; + this.exchangeRate = exchangeRate; + this.instant = instant; + this.maxLimit = maxLimit; + this.minLimit = minLimit; + this.standard = standard; + this.additionalProperties = additionalProperties; + } + + /** + * @return The withdrawal amount the quote is for. + */ + @JsonProperty("amount") + public float getAmount() { + return amount; + } + + /** + * @return Currency of the quoted amount. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Currency the funds are delivered in. + */ + @JsonProperty("destination_currency") + public String getDestinationCurrency() { + return destinationCurrency; + } + + /** + * @return Exchange rate from the withdrawal currency to the destination currency. + */ + @JsonProperty("exchange_rate") + public float getExchangeRate() { + return exchangeRate; + } + + /** + * @return Instant-delivery estimate. Null if unsupported, unavailable for the account, or the amount does not cover the fee. + */ + @JsonIgnore + public Optional getInstant() { + if (instant == null) { + return Optional.empty(); + } + return instant; + } + + /** + * @return Maximum withdrawal amount, in the withdrawal currency. + */ + @JsonIgnore + public Optional getMaxLimit() { + if (maxLimit == null) { + return Optional.empty(); + } + return maxLimit; + } + + /** + * @return Minimum withdrawal amount, in the withdrawal currency. + */ + @JsonProperty("min_limit") + public float getMinLimit() { + return minLimit; + } + + /** + * @return Standard-delivery estimate. Null if unsupported or the amount does not cover the fee. + */ + @JsonIgnore + public Optional getStandard() { + if (standard == null) { + return Optional.empty(); + } + return standard; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("instant") + private Optional _getInstant() { + return instant; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("max_limit") + private Optional _getMaxLimit() { + return maxLimit; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("standard") + private Optional _getStandard() { + return standard; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSupportedMethodsResponseDataItemQuotesItem + && equalTo((ListSupportedMethodsResponseDataItemQuotesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSupportedMethodsResponseDataItemQuotesItem other) { + return amount == other.amount + && currency.equals(other.currency) + && destinationCurrency.equals(other.destinationCurrency) + && exchangeRate == other.exchangeRate + && instant.equals(other.instant) + && maxLimit.equals(other.maxLimit) + && minLimit == other.minLimit + && standard.equals(other.standard); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.currency, + this.destinationCurrency, + this.exchangeRate, + this.instant, + this.maxLimit, + this.minLimit, + this.standard); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The withdrawal amount the quote is for.

+ */ + CurrencyStage amount(float amount); + + Builder from(ListSupportedMethodsResponseDataItemQuotesItem other); + } + + public interface CurrencyStage { + /** + *

Currency of the quoted amount.

+ */ + DestinationCurrencyStage currency(@NotNull String currency); + } + + public interface DestinationCurrencyStage { + /** + *

Currency the funds are delivered in.

+ */ + ExchangeRateStage destinationCurrency(@NotNull String destinationCurrency); + } + + public interface ExchangeRateStage { + /** + *

Exchange rate from the withdrawal currency to the destination currency.

+ */ + MinLimitStage exchangeRate(float exchangeRate); + } + + public interface MinLimitStage { + /** + *

Minimum withdrawal amount, in the withdrawal currency.

+ */ + _FinalStage minLimit(float minLimit); + } + + public interface _FinalStage { + ListSupportedMethodsResponseDataItemQuotesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Instant-delivery estimate. Null if unsupported, unavailable for the account, or the amount does not cover the fee.

+ */ + _FinalStage instant(Optional instant); + + _FinalStage instant(ListSupportedMethodsResponseDataItemQuotesItemInstant instant); + + _FinalStage instant(Nullable instant); + + /** + *

Maximum withdrawal amount, in the withdrawal currency.

+ */ + _FinalStage maxLimit(Optional maxLimit); + + _FinalStage maxLimit(Float maxLimit); + + _FinalStage maxLimit(Nullable maxLimit); + + /** + *

Standard-delivery estimate. Null if unsupported or the amount does not cover the fee.

+ */ + _FinalStage standard(Optional standard); + + _FinalStage standard(ListSupportedMethodsResponseDataItemQuotesItemStandard standard); + + _FinalStage standard(Nullable standard); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CurrencyStage, + DestinationCurrencyStage, + ExchangeRateStage, + MinLimitStage, + _FinalStage { + private float amount; + + private String currency; + + private String destinationCurrency; + + private float exchangeRate; + + private float minLimit; + + private Optional standard = Optional.empty(); + + private Optional maxLimit = Optional.empty(); + + private Optional instant = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSupportedMethodsResponseDataItemQuotesItem other) { + amount(other.getAmount()); + currency(other.getCurrency()); + destinationCurrency(other.getDestinationCurrency()); + exchangeRate(other.getExchangeRate()); + instant(other.getInstant()); + maxLimit(other.getMaxLimit()); + minLimit(other.getMinLimit()); + standard(other.getStandard()); + return this; + } + + /** + *

The withdrawal amount the quote is for.

+ *

The withdrawal amount the quote is for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CurrencyStage amount(float amount) { + this.amount = amount; + return this; + } + + /** + *

Currency of the quoted amount.

+ *

Currency of the quoted amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DestinationCurrencyStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Currency the funds are delivered in.

+ *

Currency the funds are delivered in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination_currency") + public ExchangeRateStage destinationCurrency(@NotNull String destinationCurrency) { + this.destinationCurrency = + Objects.requireNonNull(destinationCurrency, "destinationCurrency must not be null"); + return this; + } + + /** + *

Exchange rate from the withdrawal currency to the destination currency.

+ *

Exchange rate from the withdrawal currency to the destination currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("exchange_rate") + public MinLimitStage exchangeRate(float exchangeRate) { + this.exchangeRate = exchangeRate; + return this; + } + + /** + *

Minimum withdrawal amount, in the withdrawal currency.

+ *

Minimum withdrawal amount, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("min_limit") + public _FinalStage minLimit(float minLimit) { + this.minLimit = minLimit; + return this; + } + + /** + *

Standard-delivery estimate. Null if unsupported or the amount does not cover the fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage standard(Nullable standard) { + if (standard.isNull()) { + this.standard = null; + } else if (standard.isEmpty()) { + this.standard = Optional.empty(); + } else { + this.standard = Optional.of(standard.get()); + } + return this; + } + + /** + *

Standard-delivery estimate. Null if unsupported or the amount does not cover the fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage standard(ListSupportedMethodsResponseDataItemQuotesItemStandard standard) { + this.standard = Optional.ofNullable(standard); + return this; + } + + /** + *

Standard-delivery estimate. Null if unsupported or the amount does not cover the fee.

+ */ + @java.lang.Override + @JsonSetter(value = "standard", nulls = Nulls.SKIP) + public _FinalStage standard(Optional standard) { + this.standard = standard; + return this; + } + + /** + *

Maximum withdrawal amount, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxLimit(Nullable maxLimit) { + if (maxLimit.isNull()) { + this.maxLimit = null; + } else if (maxLimit.isEmpty()) { + this.maxLimit = Optional.empty(); + } else { + this.maxLimit = Optional.of(maxLimit.get()); + } + return this; + } + + /** + *

Maximum withdrawal amount, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxLimit(Float maxLimit) { + this.maxLimit = Optional.ofNullable(maxLimit); + return this; + } + + /** + *

Maximum withdrawal amount, in the withdrawal currency.

+ */ + @java.lang.Override + @JsonSetter(value = "max_limit", nulls = Nulls.SKIP) + public _FinalStage maxLimit(Optional maxLimit) { + this.maxLimit = maxLimit; + return this; + } + + /** + *

Instant-delivery estimate. Null if unsupported, unavailable for the account, or the amount does not cover the fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage instant(Nullable instant) { + if (instant.isNull()) { + this.instant = null; + } else if (instant.isEmpty()) { + this.instant = Optional.empty(); + } else { + this.instant = Optional.of(instant.get()); + } + return this; + } + + /** + *

Instant-delivery estimate. Null if unsupported, unavailable for the account, or the amount does not cover the fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage instant(ListSupportedMethodsResponseDataItemQuotesItemInstant instant) { + this.instant = Optional.ofNullable(instant); + return this; + } + + /** + *

Instant-delivery estimate. Null if unsupported, unavailable for the account, or the amount does not cover the fee.

+ */ + @java.lang.Override + @JsonSetter(value = "instant", nulls = Nulls.SKIP) + public _FinalStage instant(Optional instant) { + this.instant = instant; + return this; + } + + @java.lang.Override + public ListSupportedMethodsResponseDataItemQuotesItem build() { + return new ListSupportedMethodsResponseDataItemQuotesItem( + amount, + currency, + destinationCurrency, + exchangeRate, + instant, + maxLimit, + minLimit, + standard, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemQuotesItemInstant.java b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemQuotesItemInstant.java new file mode 100644 index 00000000..ccec6ad4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemQuotesItemInstant.java @@ -0,0 +1,168 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.supportedmethods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSupportedMethodsResponseDataItemQuotesItemInstant.Builder.class) +public final class ListSupportedMethodsResponseDataItemQuotesItemInstant { + private final OffsetDateTime estimatedArrival; + + private final float fee; + + private final float totalReceived; + + private final Map additionalProperties; + + private ListSupportedMethodsResponseDataItemQuotesItemInstant( + OffsetDateTime estimatedArrival, float fee, float totalReceived, Map additionalProperties) { + this.estimatedArrival = estimatedArrival; + this.fee = fee; + this.totalReceived = totalReceived; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("estimated_arrival") + public OffsetDateTime getEstimatedArrival() { + return estimatedArrival; + } + + @JsonProperty("fee") + public float getFee() { + return fee; + } + + @JsonProperty("total_received") + public float getTotalReceived() { + return totalReceived; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSupportedMethodsResponseDataItemQuotesItemInstant + && equalTo((ListSupportedMethodsResponseDataItemQuotesItemInstant) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSupportedMethodsResponseDataItemQuotesItemInstant other) { + return estimatedArrival.equals(other.estimatedArrival) + && fee == other.fee + && totalReceived == other.totalReceived; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.estimatedArrival, this.fee, this.totalReceived); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EstimatedArrivalStage builder() { + return new Builder(); + } + + public interface EstimatedArrivalStage { + FeeStage estimatedArrival(@NotNull OffsetDateTime estimatedArrival); + + Builder from(ListSupportedMethodsResponseDataItemQuotesItemInstant other); + } + + public interface FeeStage { + TotalReceivedStage fee(float fee); + } + + public interface TotalReceivedStage { + _FinalStage totalReceived(float totalReceived); + } + + public interface _FinalStage { + ListSupportedMethodsResponseDataItemQuotesItemInstant build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EstimatedArrivalStage, FeeStage, TotalReceivedStage, _FinalStage { + private OffsetDateTime estimatedArrival; + + private float fee; + + private float totalReceived; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSupportedMethodsResponseDataItemQuotesItemInstant other) { + estimatedArrival(other.getEstimatedArrival()); + fee(other.getFee()); + totalReceived(other.getTotalReceived()); + return this; + } + + @java.lang.Override + @JsonSetter("estimated_arrival") + public FeeStage estimatedArrival(@NotNull OffsetDateTime estimatedArrival) { + this.estimatedArrival = Objects.requireNonNull(estimatedArrival, "estimatedArrival must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("fee") + public TotalReceivedStage fee(float fee) { + this.fee = fee; + return this; + } + + @java.lang.Override + @JsonSetter("total_received") + public _FinalStage totalReceived(float totalReceived) { + this.totalReceived = totalReceived; + return this; + } + + @java.lang.Override + public ListSupportedMethodsResponseDataItemQuotesItemInstant build() { + return new ListSupportedMethodsResponseDataItemQuotesItemInstant( + estimatedArrival, fee, totalReceived, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemQuotesItemStandard.java b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemQuotesItemStandard.java new file mode 100644 index 00000000..91bb1465 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemQuotesItemStandard.java @@ -0,0 +1,168 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.supportedmethods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSupportedMethodsResponseDataItemQuotesItemStandard.Builder.class) +public final class ListSupportedMethodsResponseDataItemQuotesItemStandard { + private final OffsetDateTime estimatedArrival; + + private final float fee; + + private final float totalReceived; + + private final Map additionalProperties; + + private ListSupportedMethodsResponseDataItemQuotesItemStandard( + OffsetDateTime estimatedArrival, float fee, float totalReceived, Map additionalProperties) { + this.estimatedArrival = estimatedArrival; + this.fee = fee; + this.totalReceived = totalReceived; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("estimated_arrival") + public OffsetDateTime getEstimatedArrival() { + return estimatedArrival; + } + + @JsonProperty("fee") + public float getFee() { + return fee; + } + + @JsonProperty("total_received") + public float getTotalReceived() { + return totalReceived; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSupportedMethodsResponseDataItemQuotesItemStandard + && equalTo((ListSupportedMethodsResponseDataItemQuotesItemStandard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSupportedMethodsResponseDataItemQuotesItemStandard other) { + return estimatedArrival.equals(other.estimatedArrival) + && fee == other.fee + && totalReceived == other.totalReceived; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.estimatedArrival, this.fee, this.totalReceived); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EstimatedArrivalStage builder() { + return new Builder(); + } + + public interface EstimatedArrivalStage { + FeeStage estimatedArrival(@NotNull OffsetDateTime estimatedArrival); + + Builder from(ListSupportedMethodsResponseDataItemQuotesItemStandard other); + } + + public interface FeeStage { + TotalReceivedStage fee(float fee); + } + + public interface TotalReceivedStage { + _FinalStage totalReceived(float totalReceived); + } + + public interface _FinalStage { + ListSupportedMethodsResponseDataItemQuotesItemStandard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EstimatedArrivalStage, FeeStage, TotalReceivedStage, _FinalStage { + private OffsetDateTime estimatedArrival; + + private float fee; + + private float totalReceived; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSupportedMethodsResponseDataItemQuotesItemStandard other) { + estimatedArrival(other.getEstimatedArrival()); + fee(other.getFee()); + totalReceived(other.getTotalReceived()); + return this; + } + + @java.lang.Override + @JsonSetter("estimated_arrival") + public FeeStage estimatedArrival(@NotNull OffsetDateTime estimatedArrival) { + this.estimatedArrival = Objects.requireNonNull(estimatedArrival, "estimatedArrival must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("fee") + public TotalReceivedStage fee(float fee) { + this.fee = fee; + return this; + } + + @java.lang.Override + @JsonSetter("total_received") + public _FinalStage totalReceived(float totalReceived) { + this.totalReceived = totalReceived; + return this; + } + + @java.lang.Override + public ListSupportedMethodsResponseDataItemQuotesItemStandard build() { + return new ListSupportedMethodsResponseDataItemQuotesItemStandard( + estimatedArrival, fee, totalReceived, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemRequiredFieldsItem.java b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemRequiredFieldsItem.java new file mode 100644 index 00000000..ebff85d4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemRequiredFieldsItem.java @@ -0,0 +1,576 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.supportedmethods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSupportedMethodsResponseDataItemRequiredFieldsItem.Builder.class) +public final class ListSupportedMethodsResponseDataItemRequiredFieldsItem { + private final String id; + + private final String inputType; + + private final String label; + + private final ListSupportedMethodsResponseDataItemRequiredFieldsItemObject object; + + private final Optional> options; + + private final Optional placeholder; + + private final boolean required; + + private final boolean sensitive; + + private final String type; + + private final Optional validation; + + private final Map additionalProperties; + + private ListSupportedMethodsResponseDataItemRequiredFieldsItem( + String id, + String inputType, + String label, + ListSupportedMethodsResponseDataItemRequiredFieldsItemObject object, + Optional> options, + Optional placeholder, + boolean required, + boolean sensitive, + String type, + Optional validation, + Map additionalProperties) { + this.id = id; + this.inputType = inputType; + this.label = label; + this.object = object; + this.options = options; + this.placeholder = placeholder; + this.required = required; + this.sensitive = sensitive; + this.type = type; + this.validation = validation; + this.additionalProperties = additionalProperties; + } + + /** + * @return Stable field ID (fld_ + the semantic type), used as the field key when creating the payout method. Safe to hardcode — it never changes for a given field. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return How to collect the value: text, options, or date. + */ + @JsonProperty("input_type") + public String getInputType() { + return inputType; + } + + /** + * @return Human-readable field name. + */ + @JsonProperty("label") + public String getLabel() { + return label; + } + + @JsonProperty("object") + public ListSupportedMethodsResponseDataItemRequiredFieldsItemObject getObject() { + return object; + } + + /** + * @return Allowed values for options fields. + */ + @JsonIgnore + public Optional> getOptions() { + if (options == null) { + return Optional.empty(); + } + return options; + } + + /** + * @return Example value. + */ + @JsonIgnore + public Optional getPlaceholder() { + if (placeholder == null) { + return Optional.empty(); + } + return placeholder; + } + + /** + * @return Whether the field must be provided. + */ + @JsonProperty("required") + public boolean getRequired() { + return required; + } + + /** + * @return Whether the value is vaulted in transit and never stored raw. + */ + @JsonProperty("sensitive") + public boolean getSensitive() { + return sensitive; + } + + /** + * @return Semantic field type, for example bank_account_number or swift. + */ + @JsonProperty("type") + public String getType() { + return type; + } + + /** + * @return Regex the value must match. Null for options fields. + */ + @JsonIgnore + public Optional getValidation() { + if (validation == null) { + return Optional.empty(); + } + return validation; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("options") + private Optional> _getOptions() { + return options; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("placeholder") + private Optional _getPlaceholder() { + return placeholder; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("validation") + private Optional _getValidation() { + return validation; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSupportedMethodsResponseDataItemRequiredFieldsItem + && equalTo((ListSupportedMethodsResponseDataItemRequiredFieldsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSupportedMethodsResponseDataItemRequiredFieldsItem other) { + return id.equals(other.id) + && inputType.equals(other.inputType) + && label.equals(other.label) + && object.equals(other.object) + && options.equals(other.options) + && placeholder.equals(other.placeholder) + && required == other.required + && sensitive == other.sensitive + && type.equals(other.type) + && validation.equals(other.validation); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.inputType, + this.label, + this.object, + this.options, + this.placeholder, + this.required, + this.sensitive, + this.type, + this.validation); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Stable field ID (fld_ + the semantic type), used as the field key when creating the payout method. Safe to hardcode — it never changes for a given field.

+ */ + InputTypeStage id(@NotNull String id); + + Builder from(ListSupportedMethodsResponseDataItemRequiredFieldsItem other); + } + + public interface InputTypeStage { + /** + *

How to collect the value: text, options, or date.

+ */ + LabelStage inputType(@NotNull String inputType); + } + + public interface LabelStage { + /** + *

Human-readable field name.

+ */ + ObjectStage label(@NotNull String label); + } + + public interface ObjectStage { + RequiredStage object(@NotNull ListSupportedMethodsResponseDataItemRequiredFieldsItemObject object); + } + + public interface RequiredStage { + /** + *

Whether the field must be provided.

+ */ + SensitiveStage required(boolean required); + } + + public interface SensitiveStage { + /** + *

Whether the value is vaulted in transit and never stored raw.

+ */ + TypeStage sensitive(boolean sensitive); + } + + public interface TypeStage { + /** + *

Semantic field type, for example bank_account_number or swift.

+ */ + _FinalStage type(@NotNull String type); + } + + public interface _FinalStage { + ListSupportedMethodsResponseDataItemRequiredFieldsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Allowed values for options fields.

+ */ + _FinalStage options(Optional> options); + + _FinalStage options(List options); + + _FinalStage options(Nullable> options); + + /** + *

Example value.

+ */ + _FinalStage placeholder(Optional placeholder); + + _FinalStage placeholder(String placeholder); + + _FinalStage placeholder(Nullable placeholder); + + /** + *

Regex the value must match. Null for options fields.

+ */ + _FinalStage validation(Optional validation); + + _FinalStage validation(String validation); + + _FinalStage validation(Nullable validation); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, + InputTypeStage, + LabelStage, + ObjectStage, + RequiredStage, + SensitiveStage, + TypeStage, + _FinalStage { + private String id; + + private String inputType; + + private String label; + + private ListSupportedMethodsResponseDataItemRequiredFieldsItemObject object; + + private boolean required; + + private boolean sensitive; + + private String type; + + private Optional validation = Optional.empty(); + + private Optional placeholder = Optional.empty(); + + private Optional> options = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSupportedMethodsResponseDataItemRequiredFieldsItem other) { + id(other.getId()); + inputType(other.getInputType()); + label(other.getLabel()); + object(other.getObject()); + options(other.getOptions()); + placeholder(other.getPlaceholder()); + required(other.getRequired()); + sensitive(other.getSensitive()); + type(other.getType()); + validation(other.getValidation()); + return this; + } + + /** + *

Stable field ID (fld_ + the semantic type), used as the field key when creating the payout method. Safe to hardcode — it never changes for a given field.

+ *

Stable field ID (fld_ + the semantic type), used as the field key when creating the payout method. Safe to hardcode — it never changes for a given field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public InputTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

How to collect the value: text, options, or date.

+ *

How to collect the value: text, options, or date.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("input_type") + public LabelStage inputType(@NotNull String inputType) { + this.inputType = Objects.requireNonNull(inputType, "inputType must not be null"); + return this; + } + + /** + *

Human-readable field name.

+ *

Human-readable field name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("label") + public ObjectStage label(@NotNull String label) { + this.label = Objects.requireNonNull(label, "label must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public RequiredStage object(@NotNull ListSupportedMethodsResponseDataItemRequiredFieldsItemObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Whether the field must be provided.

+ *

Whether the field must be provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("required") + public SensitiveStage required(boolean required) { + this.required = required; + return this; + } + + /** + *

Whether the value is vaulted in transit and never stored raw.

+ *

Whether the value is vaulted in transit and never stored raw.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sensitive") + public TypeStage sensitive(boolean sensitive) { + this.sensitive = sensitive; + return this; + } + + /** + *

Semantic field type, for example bank_account_number or swift.

+ *

Semantic field type, for example bank_account_number or swift.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

Regex the value must match. Null for options fields.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage validation(Nullable validation) { + if (validation.isNull()) { + this.validation = null; + } else if (validation.isEmpty()) { + this.validation = Optional.empty(); + } else { + this.validation = Optional.of(validation.get()); + } + return this; + } + + /** + *

Regex the value must match. Null for options fields.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage validation(String validation) { + this.validation = Optional.ofNullable(validation); + return this; + } + + /** + *

Regex the value must match. Null for options fields.

+ */ + @java.lang.Override + @JsonSetter(value = "validation", nulls = Nulls.SKIP) + public _FinalStage validation(Optional validation) { + this.validation = validation; + return this; + } + + /** + *

Example value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage placeholder(Nullable placeholder) { + if (placeholder.isNull()) { + this.placeholder = null; + } else if (placeholder.isEmpty()) { + this.placeholder = Optional.empty(); + } else { + this.placeholder = Optional.of(placeholder.get()); + } + return this; + } + + /** + *

Example value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage placeholder(String placeholder) { + this.placeholder = Optional.ofNullable(placeholder); + return this; + } + + /** + *

Example value.

+ */ + @java.lang.Override + @JsonSetter(value = "placeholder", nulls = Nulls.SKIP) + public _FinalStage placeholder(Optional placeholder) { + this.placeholder = placeholder; + return this; + } + + /** + *

Allowed values for options fields.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage options(Nullable> options) { + if (options.isNull()) { + this.options = null; + } else if (options.isEmpty()) { + this.options = Optional.empty(); + } else { + this.options = Optional.of(options.get()); + } + return this; + } + + /** + *

Allowed values for options fields.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + /** + *

Allowed values for options fields.

+ */ + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional> options) { + this.options = options; + return this; + } + + @java.lang.Override + public ListSupportedMethodsResponseDataItemRequiredFieldsItem build() { + return new ListSupportedMethodsResponseDataItemRequiredFieldsItem( + id, + inputType, + label, + object, + options, + placeholder, + required, + sensitive, + type, + validation, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemRequiredFieldsItemObject.java b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemRequiredFieldsItemObject.java new file mode 100644 index 00000000..5b758e14 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponseDataItemRequiredFieldsItemObject.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.supportedmethods.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListSupportedMethodsResponseDataItemRequiredFieldsItemObject { + public static final ListSupportedMethodsResponseDataItemRequiredFieldsItemObject REQUIRED_FIELD = + new ListSupportedMethodsResponseDataItemRequiredFieldsItemObject(Value.REQUIRED_FIELD, "required_field"); + + private final Value value; + + private final String string; + + ListSupportedMethodsResponseDataItemRequiredFieldsItemObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListSupportedMethodsResponseDataItemRequiredFieldsItemObject + && this.string.equals( + ((ListSupportedMethodsResponseDataItemRequiredFieldsItemObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REQUIRED_FIELD: + return visitor.visitRequiredField(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListSupportedMethodsResponseDataItemRequiredFieldsItemObject valueOf(String value) { + switch (value) { + case "required_field": + return REQUIRED_FIELD; + default: + return new ListSupportedMethodsResponseDataItemRequiredFieldsItemObject(Value.UNKNOWN, value); + } + } + + public enum Value { + REQUIRED_FIELD, + + UNKNOWN + } + + public interface Visitor { + T visitRequiredField(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponsePageInfo.java b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponsePageInfo.java new file mode 100644 index 00000000..5719032d --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/supportedmethods/types/ListSupportedMethodsResponsePageInfo.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.supportedmethods.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSupportedMethodsResponsePageInfo.Builder.class) +public final class ListSupportedMethodsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListSupportedMethodsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSupportedMethodsResponsePageInfo + && equalTo((ListSupportedMethodsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSupportedMethodsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListSupportedMethodsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListSupportedMethodsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSupportedMethodsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListSupportedMethodsResponsePageInfo build() { + return new ListSupportedMethodsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsRequestBody.java b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsRequestBody.java new file mode 100644 index 00000000..28019ab5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsRequestBody.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = CreatePayoutsRequestBody.Deserializer.class) +public final class CreatePayoutsRequestBody { + private final Object value; + + private final int type; + + private CreatePayoutsRequestBody(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((Object) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePayoutsRequestBody && equalTo((CreatePayoutsRequestBody) other); + } + + private boolean equalTo(CreatePayoutsRequestBody other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static CreatePayoutsRequestBody of(Object value) { + return new CreatePayoutsRequestBody(value, 0); + } + + public interface Visitor { + T visit(Object value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(CreatePayoutsRequestBody.class); + } + + @java.lang.Override + public CreatePayoutsRequestBody deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, Object.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsRequestBodySpeed.java b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsRequestBodySpeed.java new file mode 100644 index 00000000..174459f9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsRequestBodySpeed.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreatePayoutsRequestBodySpeed { + public static final CreatePayoutsRequestBodySpeed INSTANT = + new CreatePayoutsRequestBodySpeed(Value.INSTANT, "instant"); + + public static final CreatePayoutsRequestBodySpeed STANDARD = + new CreatePayoutsRequestBodySpeed(Value.STANDARD, "standard"); + + private final Value value; + + private final String string; + + CreatePayoutsRequestBodySpeed(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreatePayoutsRequestBodySpeed + && this.string.equals(((CreatePayoutsRequestBodySpeed) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTANT: + return visitor.visitInstant(); + case STANDARD: + return visitor.visitStandard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreatePayoutsRequestBodySpeed valueOf(String value) { + switch (value) { + case "instant": + return INSTANT; + case "standard": + return STANDARD; + default: + return new CreatePayoutsRequestBodySpeed(Value.UNKNOWN, value); + } + } + + public enum Value { + STANDARD, + + INSTANT, + + UNKNOWN + } + + public interface Visitor { + T visitStandard(); + + T visitInstant(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponse.java b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponse.java new file mode 100644 index 00000000..61348bea --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponse.java @@ -0,0 +1,1404 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePayoutsResponse.Builder.class) +public final class CreatePayoutsResponse { + private final String amount; + + private final OffsetDateTime createdAt; + + private final String currency; + + private final Optional destinationAmount; + + private final Optional destinationCurrency; + + private final Optional estimatedArrival; + + private final Optional exchangeRate; + + private final Optional failure; + + private final String feeAmount; + + private final CreatePayoutsResponseFeePaidBy feePaidBy; + + private final String id; + + private final String markupFee; + + private final Map metadata; + + private final String netAmount; + + private final Optional notes; + + private final CreatePayoutsResponseObject object; + + private final Optional payerName; + + private final Optional payoutMethod; + + private final Optional payoutRequestId; + + private final Optional source; + + private final CreatePayoutsResponseSpeed speed; + + private final CreatePayoutsResponseStatus status; + + private final String statusDetail; + + private final Optional traceCode; + + private final Map additionalProperties; + + private CreatePayoutsResponse( + String amount, + OffsetDateTime createdAt, + String currency, + Optional destinationAmount, + Optional destinationCurrency, + Optional estimatedArrival, + Optional exchangeRate, + Optional failure, + String feeAmount, + CreatePayoutsResponseFeePaidBy feePaidBy, + String id, + String markupFee, + Map metadata, + String netAmount, + Optional notes, + CreatePayoutsResponseObject object, + Optional payerName, + Optional payoutMethod, + Optional payoutRequestId, + Optional source, + CreatePayoutsResponseSpeed speed, + CreatePayoutsResponseStatus status, + String statusDetail, + Optional traceCode, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.currency = currency; + this.destinationAmount = destinationAmount; + this.destinationCurrency = destinationCurrency; + this.estimatedArrival = estimatedArrival; + this.exchangeRate = exchangeRate; + this.failure = failure; + this.feeAmount = feeAmount; + this.feePaidBy = feePaidBy; + this.id = id; + this.markupFee = markupFee; + this.metadata = metadata; + this.netAmount = netAmount; + this.notes = notes; + this.object = object; + this.payerName = payerName; + this.payoutMethod = payoutMethod; + this.payoutRequestId = payoutRequestId; + this.source = source; + this.speed = speed; + this.status = status; + this.statusDetail = statusDetail; + this.traceCode = traceCode; + this.additionalProperties = additionalProperties; + } + + /** + * @return The payout amount in whole currency units, as a decimal string. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + /** + * @return When the payout was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Payout currency. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return The amount delivered in the destination currency, as a decimal string. Null until the payout settles; appears on the payout in GET /payouts once assigned. + */ + @JsonIgnore + public Optional getDestinationAmount() { + if (destinationAmount == null) { + return Optional.empty(); + } + return destinationAmount; + } + + /** + * @return Currency the funds are delivered in, taken from the payout method. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists. + */ + @JsonIgnore + public Optional getDestinationCurrency() { + if (destinationCurrency == null) { + return Optional.empty(); + } + return destinationCurrency; + } + + /** + * @return Estimated time the funds become available in the destination account. Null until the payout settles. + */ + @JsonIgnore + public Optional getEstimatedArrival() { + if (estimatedArrival == null) { + return Optional.empty(); + } + return estimatedArrival; + } + + /** + * @return Exchange rate from the payout currency to the destination currency. Null until the payout settles; appears on the payout in GET /payouts once assigned. + */ + @JsonIgnore + public Optional getExchangeRate() { + if (exchangeRate == null) { + return Optional.empty(); + } + return exchangeRate; + } + + /** + * @return Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise. + */ + @JsonIgnore + public Optional getFailure() { + if (failure == null) { + return Optional.empty(); + } + return failure; + } + + /** + * @return The fee charged for the payout, in the payout currency, as a decimal string. + */ + @JsonProperty("fee_amount") + public String getFeeAmount() { + return feeAmount; + } + + /** + * @return Who bore the payout fee: the account itself, or its parent platform. + */ + @JsonProperty("fee_paid_by") + public CreatePayoutsResponseFeePaidBy getFeePaidBy() { + return feePaidBy; + } + + /** + * @return Payout ID, prefixed wdrl_ — the id POST returns is the id GET /payouts lists. Conversion requests created before this version keep answering under their cofr_ id. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies. + */ + @JsonProperty("markup_fee") + public String getMarkupFee() { + return markupFee; + } + + /** + * @return Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters. + */ + @JsonProperty("metadata") + public Map getMetadata() { + return metadata; + } + + /** + * @return The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered. + */ + @JsonProperty("net_amount") + public String getNetAmount() { + return netAmount; + } + + /** + * @return Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + @JsonProperty("object") + public CreatePayoutsResponseObject getObject() { + return object; + } + + /** + * @return Name of the entity processing the payout. Null until the payout settles. + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + /** + * @return The saved payout method used. Requires payout:destination:read; null without it. + */ + @JsonIgnore + public Optional getPayoutMethod() { + if (payoutMethod == null) { + return Optional.empty(); + } + return payoutMethod; + } + + /** + * @return For a stablecoin payout, the id of the conversion request that funds it, prefixed cofr_; null on fiat payouts. + */ + @JsonIgnore + public Optional getPayoutRequestId() { + if (payoutRequestId == null) { + return Optional.empty(); + } + return payoutRequestId; + } + + /** + * @return How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling. + */ + @JsonIgnore + public Optional getSource() { + if (source == null) { + return Optional.empty(); + } + return source; + } + + /** + * @return Payout delivery speed. + */ + @JsonProperty("speed") + public CreatePayoutsResponseSpeed getSpeed() { + return speed; + } + + /** + * @return Current payout status, in the same vocabulary as GET /payouts. + */ + @JsonProperty("status") + public CreatePayoutsResponseStatus getStatus() { + return status; + } + + /** + * @return The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract. + */ + @JsonProperty("status_detail") + public String getStatusDetail() { + return statusDetail; + } + + /** + * @return ACH trace number the recipient's bank can use to locate this payout. Always null here — it is assigned when the payout is submitted to the bank, and appears on the payout in GET /payouts once it has been sent; payouts not sent over ACH never get one. + */ + @JsonIgnore + public Optional getTraceCode() { + if (traceCode == null) { + return Optional.empty(); + } + return traceCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination_amount") + private Optional _getDestinationAmount() { + return destinationAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination_currency") + private Optional _getDestinationCurrency() { + return destinationCurrency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("estimated_arrival") + private Optional _getEstimatedArrival() { + return estimatedArrival; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exchange_rate") + private Optional _getExchangeRate() { + return exchangeRate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure") + private Optional _getFailure() { + return failure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_method") + private Optional _getPayoutMethod() { + return payoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_request_id") + private Optional _getPayoutRequestId() { + return payoutRequestId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source") + private Optional _getSource() { + return source; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trace_code") + private Optional _getTraceCode() { + return traceCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePayoutsResponse && equalTo((CreatePayoutsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePayoutsResponse other) { + return amount.equals(other.amount) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && destinationAmount.equals(other.destinationAmount) + && destinationCurrency.equals(other.destinationCurrency) + && estimatedArrival.equals(other.estimatedArrival) + && exchangeRate.equals(other.exchangeRate) + && failure.equals(other.failure) + && feeAmount.equals(other.feeAmount) + && feePaidBy.equals(other.feePaidBy) + && id.equals(other.id) + && markupFee.equals(other.markupFee) + && metadata.equals(other.metadata) + && netAmount.equals(other.netAmount) + && notes.equals(other.notes) + && object.equals(other.object) + && payerName.equals(other.payerName) + && payoutMethod.equals(other.payoutMethod) + && payoutRequestId.equals(other.payoutRequestId) + && source.equals(other.source) + && speed.equals(other.speed) + && status.equals(other.status) + && statusDetail.equals(other.statusDetail) + && traceCode.equals(other.traceCode); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.currency, + this.destinationAmount, + this.destinationCurrency, + this.estimatedArrival, + this.exchangeRate, + this.failure, + this.feeAmount, + this.feePaidBy, + this.id, + this.markupFee, + this.metadata, + this.netAmount, + this.notes, + this.object, + this.payerName, + this.payoutMethod, + this.payoutRequestId, + this.source, + this.speed, + this.status, + this.statusDetail, + this.traceCode); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The payout amount in whole currency units, as a decimal string.

+ */ + CreatedAtStage amount(@NotNull String amount); + + Builder from(CreatePayoutsResponse other); + } + + public interface CreatedAtStage { + /** + *

When the payout was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

Payout currency.

+ */ + FeeAmountStage currency(@NotNull String currency); + } + + public interface FeeAmountStage { + /** + *

The fee charged for the payout, in the payout currency, as a decimal string.

+ */ + FeePaidByStage feeAmount(@NotNull String feeAmount); + } + + public interface FeePaidByStage { + /** + *

Who bore the payout fee: the account itself, or its parent platform.

+ */ + IdStage feePaidBy(@NotNull CreatePayoutsResponseFeePaidBy feePaidBy); + } + + public interface IdStage { + /** + *

Payout ID, prefixed wdrl_ — the id POST returns is the id GET /payouts lists. Conversion requests created before this version keep answering under their cofr_ id.

+ */ + MarkupFeeStage id(@NotNull String id); + } + + public interface MarkupFeeStage { + /** + *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ */ + NetAmountStage markupFee(@NotNull String markupFee); + } + + public interface NetAmountStage { + /** + *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ */ + ObjectStage netAmount(@NotNull String netAmount); + } + + public interface ObjectStage { + SpeedStage object(@NotNull CreatePayoutsResponseObject object); + } + + public interface SpeedStage { + /** + *

Payout delivery speed.

+ */ + StatusStage speed(@NotNull CreatePayoutsResponseSpeed speed); + } + + public interface StatusStage { + /** + *

Current payout status, in the same vocabulary as GET /payouts.

+ */ + StatusDetailStage status(@NotNull CreatePayoutsResponseStatus status); + } + + public interface StatusDetailStage { + /** + *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ */ + _FinalStage statusDetail(@NotNull String statusDetail); + } + + public interface _FinalStage { + CreatePayoutsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The amount delivered in the destination currency, as a decimal string. Null until the payout settles; appears on the payout in GET /payouts once assigned.

+ */ + _FinalStage destinationAmount(Optional destinationAmount); + + _FinalStage destinationAmount(String destinationAmount); + + _FinalStage destinationAmount(Nullable destinationAmount); + + /** + *

Currency the funds are delivered in, taken from the payout method. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ */ + _FinalStage destinationCurrency(Optional destinationCurrency); + + _FinalStage destinationCurrency(String destinationCurrency); + + _FinalStage destinationCurrency(Nullable destinationCurrency); + + /** + *

Estimated time the funds become available in the destination account. Null until the payout settles.

+ */ + _FinalStage estimatedArrival(Optional estimatedArrival); + + _FinalStage estimatedArrival(OffsetDateTime estimatedArrival); + + _FinalStage estimatedArrival(Nullable estimatedArrival); + + /** + *

Exchange rate from the payout currency to the destination currency. Null until the payout settles; appears on the payout in GET /payouts once assigned.

+ */ + _FinalStage exchangeRate(Optional exchangeRate); + + _FinalStage exchangeRate(Float exchangeRate); + + _FinalStage exchangeRate(Nullable exchangeRate); + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ */ + _FinalStage failure(Optional failure); + + _FinalStage failure(CreatePayoutsResponseFailure failure); + + _FinalStage failure(Nullable failure); + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ */ + _FinalStage metadata(Map metadata); + + _FinalStage putAllMetadata(Map metadata); + + _FinalStage metadata(String key, String value); + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + + /** + *

Name of the entity processing the payout. Null until the payout settles.

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ */ + _FinalStage payoutMethod(Optional payoutMethod); + + _FinalStage payoutMethod(CreatePayoutsResponsePayoutMethod payoutMethod); + + _FinalStage payoutMethod(Nullable payoutMethod); + + /** + *

For a stablecoin payout, the id of the conversion request that funds it, prefixed cofr_; null on fiat payouts.

+ */ + _FinalStage payoutRequestId(Optional payoutRequestId); + + _FinalStage payoutRequestId(String payoutRequestId); + + _FinalStage payoutRequestId(Nullable payoutRequestId); + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ */ + _FinalStage source(Optional source); + + _FinalStage source(CreatePayoutsResponseSource source); + + _FinalStage source(Nullable source); + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Always null here — it is assigned when the payout is submitted to the bank, and appears on the payout in GET /payouts once it has been sent; payouts not sent over ACH never get one.

+ */ + _FinalStage traceCode(Optional traceCode); + + _FinalStage traceCode(String traceCode); + + _FinalStage traceCode(Nullable traceCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + CurrencyStage, + FeeAmountStage, + FeePaidByStage, + IdStage, + MarkupFeeStage, + NetAmountStage, + ObjectStage, + SpeedStage, + StatusStage, + StatusDetailStage, + _FinalStage { + private String amount; + + private OffsetDateTime createdAt; + + private String currency; + + private String feeAmount; + + private CreatePayoutsResponseFeePaidBy feePaidBy; + + private String id; + + private String markupFee; + + private String netAmount; + + private CreatePayoutsResponseObject object; + + private CreatePayoutsResponseSpeed speed; + + private CreatePayoutsResponseStatus status; + + private String statusDetail; + + private Optional traceCode = Optional.empty(); + + private Optional source = Optional.empty(); + + private Optional payoutRequestId = Optional.empty(); + + private Optional payoutMethod = Optional.empty(); + + private Optional payerName = Optional.empty(); + + private Optional notes = Optional.empty(); + + private Map metadata = new LinkedHashMap<>(); + + private Optional failure = Optional.empty(); + + private Optional exchangeRate = Optional.empty(); + + private Optional estimatedArrival = Optional.empty(); + + private Optional destinationCurrency = Optional.empty(); + + private Optional destinationAmount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePayoutsResponse other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + destinationAmount(other.getDestinationAmount()); + destinationCurrency(other.getDestinationCurrency()); + estimatedArrival(other.getEstimatedArrival()); + exchangeRate(other.getExchangeRate()); + failure(other.getFailure()); + feeAmount(other.getFeeAmount()); + feePaidBy(other.getFeePaidBy()); + id(other.getId()); + markupFee(other.getMarkupFee()); + metadata(other.getMetadata()); + netAmount(other.getNetAmount()); + notes(other.getNotes()); + object(other.getObject()); + payerName(other.getPayerName()); + payoutMethod(other.getPayoutMethod()); + payoutRequestId(other.getPayoutRequestId()); + source(other.getSource()); + speed(other.getSpeed()); + status(other.getStatus()); + statusDetail(other.getStatusDetail()); + traceCode(other.getTraceCode()); + return this; + } + + /** + *

The payout amount in whole currency units, as a decimal string.

+ *

The payout amount in whole currency units, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

When the payout was created.

+ *

When the payout was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Payout currency.

+ *

Payout currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public FeeAmountStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The fee charged for the payout, in the payout currency, as a decimal string.

+ *

The fee charged for the payout, in the payout currency, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_amount") + public FeePaidByStage feeAmount(@NotNull String feeAmount) { + this.feeAmount = Objects.requireNonNull(feeAmount, "feeAmount must not be null"); + return this; + } + + /** + *

Who bore the payout fee: the account itself, or its parent platform.

+ *

Who bore the payout fee: the account itself, or its parent platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_paid_by") + public IdStage feePaidBy(@NotNull CreatePayoutsResponseFeePaidBy feePaidBy) { + this.feePaidBy = Objects.requireNonNull(feePaidBy, "feePaidBy must not be null"); + return this; + } + + /** + *

Payout ID, prefixed wdrl_ — the id POST returns is the id GET /payouts lists. Conversion requests created before this version keep answering under their cofr_ id.

+ *

Payout ID, prefixed wdrl_ — the id POST returns is the id GET /payouts lists. Conversion requests created before this version keep answering under their cofr_ id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MarkupFeeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("markup_fee") + public NetAmountStage markupFee(@NotNull String markupFee) { + this.markupFee = Objects.requireNonNull(markupFee, "markupFee must not be null"); + return this; + } + + /** + *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("net_amount") + public ObjectStage netAmount(@NotNull String netAmount) { + this.netAmount = Objects.requireNonNull(netAmount, "netAmount must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public SpeedStage object(@NotNull CreatePayoutsResponseObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Payout delivery speed.

+ *

Payout delivery speed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("speed") + public StatusStage speed(@NotNull CreatePayoutsResponseSpeed speed) { + this.speed = Objects.requireNonNull(speed, "speed must not be null"); + return this; + } + + /** + *

Current payout status, in the same vocabulary as GET /payouts.

+ *

Current payout status, in the same vocabulary as GET /payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public StatusDetailStage status(@NotNull CreatePayoutsResponseStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status_detail") + public _FinalStage statusDetail(@NotNull String statusDetail) { + this.statusDetail = Objects.requireNonNull(statusDetail, "statusDetail must not be null"); + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Always null here — it is assigned when the payout is submitted to the bank, and appears on the payout in GET /payouts once it has been sent; payouts not sent over ACH never get one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage traceCode(Nullable traceCode) { + if (traceCode.isNull()) { + this.traceCode = null; + } else if (traceCode.isEmpty()) { + this.traceCode = Optional.empty(); + } else { + this.traceCode = Optional.of(traceCode.get()); + } + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Always null here — it is assigned when the payout is submitted to the bank, and appears on the payout in GET /payouts once it has been sent; payouts not sent over ACH never get one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage traceCode(String traceCode) { + this.traceCode = Optional.ofNullable(traceCode); + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Always null here — it is assigned when the payout is submitted to the bank, and appears on the payout in GET /payouts once it has been sent; payouts not sent over ACH never get one.

+ */ + @java.lang.Override + @JsonSetter(value = "trace_code", nulls = Nulls.SKIP) + public _FinalStage traceCode(Optional traceCode) { + this.traceCode = traceCode; + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(Nullable source) { + if (source.isNull()) { + this.source = null; + } else if (source.isEmpty()) { + this.source = Optional.empty(); + } else { + this.source = Optional.of(source.get()); + } + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(CreatePayoutsResponseSource source) { + this.source = Optional.ofNullable(source); + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ */ + @java.lang.Override + @JsonSetter(value = "source", nulls = Nulls.SKIP) + public _FinalStage source(Optional source) { + this.source = source; + return this; + } + + /** + *

For a stablecoin payout, the id of the conversion request that funds it, prefixed cofr_; null on fiat payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(Nullable payoutRequestId) { + if (payoutRequestId.isNull()) { + this.payoutRequestId = null; + } else if (payoutRequestId.isEmpty()) { + this.payoutRequestId = Optional.empty(); + } else { + this.payoutRequestId = Optional.of(payoutRequestId.get()); + } + return this; + } + + /** + *

For a stablecoin payout, the id of the conversion request that funds it, prefixed cofr_; null on fiat payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(String payoutRequestId) { + this.payoutRequestId = Optional.ofNullable(payoutRequestId); + return this; + } + + /** + *

For a stablecoin payout, the id of the conversion request that funds it, prefixed cofr_; null on fiat payouts.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_request_id", nulls = Nulls.SKIP) + public _FinalStage payoutRequestId(Optional payoutRequestId) { + this.payoutRequestId = payoutRequestId; + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutMethod(Nullable payoutMethod) { + if (payoutMethod.isNull()) { + this.payoutMethod = null; + } else if (payoutMethod.isEmpty()) { + this.payoutMethod = Optional.empty(); + } else { + this.payoutMethod = Optional.of(payoutMethod.get()); + } + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutMethod(CreatePayoutsResponsePayoutMethod payoutMethod) { + this.payoutMethod = Optional.ofNullable(payoutMethod); + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_method", nulls = Nulls.SKIP) + public _FinalStage payoutMethod(Optional payoutMethod) { + this.payoutMethod = payoutMethod; + return this; + } + + /** + *

Name of the entity processing the payout. Null until the payout settles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

Name of the entity processing the payout. Null until the payout settles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

Name of the entity processing the payout. Null until the payout settles.

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(String key, String value) { + this.metadata.put(key, value); + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllMetadata(Map metadata) { + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Map metadata) { + this.metadata.clear(); + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failure(Nullable failure) { + if (failure.isNull()) { + this.failure = null; + } else if (failure.isEmpty()) { + this.failure = Optional.empty(); + } else { + this.failure = Optional.of(failure.get()); + } + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failure(CreatePayoutsResponseFailure failure) { + this.failure = Optional.ofNullable(failure); + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "failure", nulls = Nulls.SKIP) + public _FinalStage failure(Optional failure) { + this.failure = failure; + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Null until the payout settles; appears on the payout in GET /payouts once assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage exchangeRate(Nullable exchangeRate) { + if (exchangeRate.isNull()) { + this.exchangeRate = null; + } else if (exchangeRate.isEmpty()) { + this.exchangeRate = Optional.empty(); + } else { + this.exchangeRate = Optional.of(exchangeRate.get()); + } + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Null until the payout settles; appears on the payout in GET /payouts once assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage exchangeRate(Float exchangeRate) { + this.exchangeRate = Optional.ofNullable(exchangeRate); + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Null until the payout settles; appears on the payout in GET /payouts once assigned.

+ */ + @java.lang.Override + @JsonSetter(value = "exchange_rate", nulls = Nulls.SKIP) + public _FinalStage exchangeRate(Optional exchangeRate) { + this.exchangeRate = exchangeRate; + return this; + } + + /** + *

Estimated time the funds become available in the destination account. Null until the payout settles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(Nullable estimatedArrival) { + if (estimatedArrival.isNull()) { + this.estimatedArrival = null; + } else if (estimatedArrival.isEmpty()) { + this.estimatedArrival = Optional.empty(); + } else { + this.estimatedArrival = Optional.of(estimatedArrival.get()); + } + return this; + } + + /** + *

Estimated time the funds become available in the destination account. Null until the payout settles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(OffsetDateTime estimatedArrival) { + this.estimatedArrival = Optional.ofNullable(estimatedArrival); + return this; + } + + /** + *

Estimated time the funds become available in the destination account. Null until the payout settles.

+ */ + @java.lang.Override + @JsonSetter(value = "estimated_arrival", nulls = Nulls.SKIP) + public _FinalStage estimatedArrival(Optional estimatedArrival) { + this.estimatedArrival = estimatedArrival; + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationCurrency(Nullable destinationCurrency) { + if (destinationCurrency.isNull()) { + this.destinationCurrency = null; + } else if (destinationCurrency.isEmpty()) { + this.destinationCurrency = Optional.empty(); + } else { + this.destinationCurrency = Optional.of(destinationCurrency.get()); + } + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationCurrency(String destinationCurrency) { + this.destinationCurrency = Optional.ofNullable(destinationCurrency); + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ */ + @java.lang.Override + @JsonSetter(value = "destination_currency", nulls = Nulls.SKIP) + public _FinalStage destinationCurrency(Optional destinationCurrency) { + this.destinationCurrency = destinationCurrency; + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Null until the payout settles; appears on the payout in GET /payouts once assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationAmount(Nullable destinationAmount) { + if (destinationAmount.isNull()) { + this.destinationAmount = null; + } else if (destinationAmount.isEmpty()) { + this.destinationAmount = Optional.empty(); + } else { + this.destinationAmount = Optional.of(destinationAmount.get()); + } + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Null until the payout settles; appears on the payout in GET /payouts once assigned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationAmount(String destinationAmount) { + this.destinationAmount = Optional.ofNullable(destinationAmount); + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Null until the payout settles; appears on the payout in GET /payouts once assigned.

+ */ + @java.lang.Override + @JsonSetter(value = "destination_amount", nulls = Nulls.SKIP) + public _FinalStage destinationAmount(Optional destinationAmount) { + this.destinationAmount = destinationAmount; + return this; + } + + @java.lang.Override + public CreatePayoutsResponse build() { + return new CreatePayoutsResponse( + amount, + createdAt, + currency, + destinationAmount, + destinationCurrency, + estimatedArrival, + exchangeRate, + failure, + feeAmount, + feePaidBy, + id, + markupFee, + metadata, + netAmount, + notes, + object, + payerName, + payoutMethod, + payoutRequestId, + source, + speed, + status, + statusDetail, + traceCode, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseFailure.java b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseFailure.java new file mode 100644 index 00000000..4ddbf777 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseFailure.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePayoutsResponseFailure.Builder.class) +public final class CreatePayoutsResponseFailure { + private final Optional code; + + private final Optional fundsReturnedAt; + + private final Optional message; + + private final Map additionalProperties; + + private CreatePayoutsResponseFailure( + Optional code, + Optional fundsReturnedAt, + Optional message, + Map additionalProperties) { + this.code = code; + this.fundsReturnedAt = fundsReturnedAt; + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return Classified failure code from the maintained error catalog. + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + /** + * @return The effective time of the reversal that put the funds back in the balance — null if they never left it or have not returned yet. Set only once the return is confirmed in the ledger; the ledger posting itself can land moments after this time. + */ + @JsonIgnore + public Optional getFundsReturnedAt() { + if (fundsReturnedAt == null) { + return Optional.empty(); + } + return fundsReturnedAt; + } + + /** + * @return Human-readable explanation of the failure. Callers holding payout:destination:read may receive text personalized to the destination; other callers get the generic catalog message. + */ + @JsonIgnore + public Optional getMessage() { + if (message == null) { + return Optional.empty(); + } + return message; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("funds_returned_at") + private Optional _getFundsReturnedAt() { + return fundsReturnedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("message") + private Optional _getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePayoutsResponseFailure && equalTo((CreatePayoutsResponseFailure) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePayoutsResponseFailure other) { + return code.equals(other.code) + && fundsReturnedAt.equals(other.fundsReturnedAt) + && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.fundsReturnedAt, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional code = Optional.empty(); + + private Optional fundsReturnedAt = Optional.empty(); + + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreatePayoutsResponseFailure other) { + code(other.getCode()); + fundsReturnedAt(other.getFundsReturnedAt()); + message(other.getMessage()); + return this; + } + + /** + *

Classified failure code from the maintained error catalog.

+ */ + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public Builder code(Optional code) { + this.code = code; + return this; + } + + public Builder code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + public Builder code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

The effective time of the reversal that put the funds back in the balance — null if they never left it or have not returned yet. Set only once the return is confirmed in the ledger; the ledger posting itself can land moments after this time.

+ */ + @JsonSetter(value = "funds_returned_at", nulls = Nulls.SKIP) + public Builder fundsReturnedAt(Optional fundsReturnedAt) { + this.fundsReturnedAt = fundsReturnedAt; + return this; + } + + public Builder fundsReturnedAt(OffsetDateTime fundsReturnedAt) { + this.fundsReturnedAt = Optional.ofNullable(fundsReturnedAt); + return this; + } + + public Builder fundsReturnedAt(Nullable fundsReturnedAt) { + if (fundsReturnedAt.isNull()) { + this.fundsReturnedAt = null; + } else if (fundsReturnedAt.isEmpty()) { + this.fundsReturnedAt = Optional.empty(); + } else { + this.fundsReturnedAt = Optional.of(fundsReturnedAt.get()); + } + return this; + } + + /** + *

Human-readable explanation of the failure. Callers holding payout:destination:read may receive text personalized to the destination; other callers get the generic catalog message.

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public Builder message(Nullable message) { + if (message.isNull()) { + this.message = null; + } else if (message.isEmpty()) { + this.message = Optional.empty(); + } else { + this.message = Optional.of(message.get()); + } + return this; + } + + public CreatePayoutsResponseFailure build() { + return new CreatePayoutsResponseFailure(code, fundsReturnedAt, message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseFeePaidBy.java b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseFeePaidBy.java new file mode 100644 index 00000000..9e9564a9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseFeePaidBy.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreatePayoutsResponseFeePaidBy { + public static final CreatePayoutsResponseFeePaidBy SELF = new CreatePayoutsResponseFeePaidBy(Value.SELF, "self"); + + public static final CreatePayoutsResponseFeePaidBy PLATFORM = + new CreatePayoutsResponseFeePaidBy(Value.PLATFORM, "platform"); + + private final Value value; + + private final String string; + + CreatePayoutsResponseFeePaidBy(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreatePayoutsResponseFeePaidBy + && this.string.equals(((CreatePayoutsResponseFeePaidBy) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF: + return visitor.visitSelf(); + case PLATFORM: + return visitor.visitPlatform(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreatePayoutsResponseFeePaidBy valueOf(String value) { + switch (value) { + case "self": + return SELF; + case "platform": + return PLATFORM; + default: + return new CreatePayoutsResponseFeePaidBy(Value.UNKNOWN, value); + } + } + + public enum Value { + SELF, + + PLATFORM, + + UNKNOWN + } + + public interface Visitor { + T visitSelf(); + + T visitPlatform(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseObject.java b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseObject.java new file mode 100644 index 00000000..1972fcd4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseObject.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreatePayoutsResponseObject { + public static final CreatePayoutsResponseObject PAYOUT = new CreatePayoutsResponseObject(Value.PAYOUT, "payout"); + + private final Value value; + + private final String string; + + CreatePayoutsResponseObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreatePayoutsResponseObject + && this.string.equals(((CreatePayoutsResponseObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYOUT: + return visitor.visitPayout(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreatePayoutsResponseObject valueOf(String value) { + switch (value) { + case "payout": + return PAYOUT; + default: + return new CreatePayoutsResponseObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYOUT, + + UNKNOWN + } + + public interface Visitor { + T visitPayout(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponsePayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponsePayoutMethod.java new file mode 100644 index 00000000..533ca8d9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponsePayoutMethod.java @@ -0,0 +1,189 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePayoutsResponsePayoutMethod.Builder.class) +public final class CreatePayoutsResponsePayoutMethod { + private final Optional nickname; + + private final Optional supportedPayoutMethod; + + private final Map additionalProperties; + + private CreatePayoutsResponsePayoutMethod( + Optional nickname, + Optional supportedPayoutMethod, + Map additionalProperties) { + this.nickname = nickname; + this.supportedPayoutMethod = supportedPayoutMethod; + this.additionalProperties = additionalProperties; + } + + /** + * @return Saved payout method nickname. + */ + @JsonIgnore + public Optional getNickname() { + if (nickname == null) { + return Optional.empty(); + } + return nickname; + } + + /** + * @return Supported payout method display details. + */ + @JsonIgnore + public Optional getSupportedPayoutMethod() { + if (supportedPayoutMethod == null) { + return Optional.empty(); + } + return supportedPayoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("nickname") + private Optional _getNickname() { + return nickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("supported_payout_method") + private Optional _getSupportedPayoutMethod() { + return supportedPayoutMethod; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePayoutsResponsePayoutMethod && equalTo((CreatePayoutsResponsePayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePayoutsResponsePayoutMethod other) { + return nickname.equals(other.nickname) && supportedPayoutMethod.equals(other.supportedPayoutMethod); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.nickname, this.supportedPayoutMethod); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional nickname = Optional.empty(); + + private Optional supportedPayoutMethod = + Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreatePayoutsResponsePayoutMethod other) { + nickname(other.getNickname()); + supportedPayoutMethod(other.getSupportedPayoutMethod()); + return this; + } + + /** + *

Saved payout method nickname.

+ */ + @JsonSetter(value = "nickname", nulls = Nulls.SKIP) + public Builder nickname(Optional nickname) { + this.nickname = nickname; + return this; + } + + public Builder nickname(String nickname) { + this.nickname = Optional.ofNullable(nickname); + return this; + } + + public Builder nickname(Nullable nickname) { + if (nickname.isNull()) { + this.nickname = null; + } else if (nickname.isEmpty()) { + this.nickname = Optional.empty(); + } else { + this.nickname = Optional.of(nickname.get()); + } + return this; + } + + /** + *

Supported payout method display details.

+ */ + @JsonSetter(value = "supported_payout_method", nulls = Nulls.SKIP) + public Builder supportedPayoutMethod( + Optional supportedPayoutMethod) { + this.supportedPayoutMethod = supportedPayoutMethod; + return this; + } + + public Builder supportedPayoutMethod( + CreatePayoutsResponsePayoutMethodSupportedPayoutMethod supportedPayoutMethod) { + this.supportedPayoutMethod = Optional.ofNullable(supportedPayoutMethod); + return this; + } + + public Builder supportedPayoutMethod( + Nullable supportedPayoutMethod) { + if (supportedPayoutMethod.isNull()) { + this.supportedPayoutMethod = null; + } else if (supportedPayoutMethod.isEmpty()) { + this.supportedPayoutMethod = Optional.empty(); + } else { + this.supportedPayoutMethod = Optional.of(supportedPayoutMethod.get()); + } + return this; + } + + public CreatePayoutsResponsePayoutMethod build() { + return new CreatePayoutsResponsePayoutMethod(nickname, supportedPayoutMethod, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponsePayoutMethodSupportedPayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponsePayoutMethodSupportedPayoutMethod.java new file mode 100644 index 00000000..3a7b1a5e --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponsePayoutMethodSupportedPayoutMethod.java @@ -0,0 +1,280 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePayoutsResponsePayoutMethodSupportedPayoutMethod.Builder.class) +public final class CreatePayoutsResponsePayoutMethodSupportedPayoutMethod { + private final CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType deliveryType; + + private final Optional iconUrl; + + private final Optional payerName; + + private final Map additionalProperties; + + private CreatePayoutsResponsePayoutMethodSupportedPayoutMethod( + CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType deliveryType, + Optional iconUrl, + Optional payerName, + Map additionalProperties) { + this.deliveryType = deliveryType; + this.iconUrl = iconUrl; + this.payerName = payerName; + this.additionalProperties = additionalProperties; + } + + /** + * @return How the funds are delivered to the recipient. + */ + @JsonProperty("delivery_type") + public CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType getDeliveryType() { + return deliveryType; + } + + /** + * @return Supported payout method icon URL. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return Supported payout method display name. + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePayoutsResponsePayoutMethodSupportedPayoutMethod + && equalTo((CreatePayoutsResponsePayoutMethodSupportedPayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePayoutsResponsePayoutMethodSupportedPayoutMethod other) { + return deliveryType.equals(other.deliveryType) + && iconUrl.equals(other.iconUrl) + && payerName.equals(other.payerName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deliveryType, this.iconUrl, this.payerName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeliveryTypeStage builder() { + return new Builder(); + } + + public interface DeliveryTypeStage { + /** + *

How the funds are delivered to the recipient.

+ */ + _FinalStage deliveryType( + @NotNull CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType deliveryType); + + Builder from(CreatePayoutsResponsePayoutMethodSupportedPayoutMethod other); + } + + public interface _FinalStage { + CreatePayoutsResponsePayoutMethodSupportedPayoutMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Supported payout method icon URL.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Supported payout method display name.

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeliveryTypeStage, _FinalStage { + private CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType deliveryType; + + private Optional payerName = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePayoutsResponsePayoutMethodSupportedPayoutMethod other) { + deliveryType(other.getDeliveryType()); + iconUrl(other.getIconUrl()); + payerName(other.getPayerName()); + return this; + } + + /** + *

How the funds are delivered to the recipient.

+ *

How the funds are delivered to the recipient.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("delivery_type") + public _FinalStage deliveryType( + @NotNull CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType deliveryType) { + this.deliveryType = Objects.requireNonNull(deliveryType, "deliveryType must not be null"); + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

Supported payout method display name.

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Supported payout method icon URL.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + @java.lang.Override + public CreatePayoutsResponsePayoutMethodSupportedPayoutMethod build() { + return new CreatePayoutsResponsePayoutMethodSupportedPayoutMethod( + deliveryType, iconUrl, payerName, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType.java b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType.java new file mode 100644 index 00000000..4f84b97b --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType.java @@ -0,0 +1,167 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType { + public static final CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType PAPER_CHECK = + new CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType(Value.PAPER_CHECK, "paper_check"); + + public static final CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType CRYPTOCURRENCY = + new CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType( + Value.CRYPTOCURRENCY, "cryptocurrency"); + + public static final CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType UNKNOWN = + new CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType(Value.UNKNOWN, "unknown"); + + public static final CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType HOME_DELIVERY = + new CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType( + Value.HOME_DELIVERY, "home_delivery"); + + public static final CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType BANK_DEPOSIT = + new CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType(Value.BANK_DEPOSIT, "bank_deposit"); + + public static final CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType MASSPAY_CARD = + new CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType(Value.MASSPAY_CARD, "masspay_card"); + + public static final CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType MOBILE_WALLET = + new CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType( + Value.MOBILE_WALLET, "mobile_wallet"); + + public static final CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType CASH_PICKUP = + new CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType(Value.CASH_PICKUP, "cash_pickup"); + + public static final CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType BILL = + new CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType(Value.BILL, "bill"); + + private final Value value; + + private final String string; + + CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType + && this.string.equals( + ((CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAPER_CHECK: + return visitor.visitPaperCheck(); + case CRYPTOCURRENCY: + return visitor.visitCryptocurrency(); + case UNKNOWN: + return visitor.visitUnknown(); + case HOME_DELIVERY: + return visitor.visitHomeDelivery(); + case BANK_DEPOSIT: + return visitor.visitBankDeposit(); + case MASSPAY_CARD: + return visitor.visitMasspayCard(); + case MOBILE_WALLET: + return visitor.visitMobileWallet(); + case CASH_PICKUP: + return visitor.visitCashPickup(); + case BILL: + return visitor.visitBill(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType valueOf(String value) { + switch (value) { + case "paper_check": + return PAPER_CHECK; + case "cryptocurrency": + return CRYPTOCURRENCY; + case "unknown": + return UNKNOWN; + case "home_delivery": + return HOME_DELIVERY; + case "bank_deposit": + return BANK_DEPOSIT; + case "masspay_card": + return MASSPAY_CARD; + case "mobile_wallet": + return MOBILE_WALLET; + case "cash_pickup": + return CASH_PICKUP; + case "bill": + return BILL; + default: + return new CreatePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType(Value._UNKNOWN, value); + } + } + + public enum Value { + CASH_PICKUP, + + BANK_DEPOSIT, + + HOME_DELIVERY, + + MOBILE_WALLET, + + MASSPAY_CARD, + + PAPER_CHECK, + + BILL, + + CRYPTOCURRENCY, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitCashPickup(); + + T visitBankDeposit(); + + T visitHomeDelivery(); + + T visitMobileWallet(); + + T visitMasspayCard(); + + T visitPaperCheck(); + + T visitBill(); + + T visitCryptocurrency(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseSource.java b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseSource.java new file mode 100644 index 00000000..a344eb34 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseSource.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreatePayoutsResponseSource { + public static final CreatePayoutsResponseSource DASHBOARD = + new CreatePayoutsResponseSource(Value.DASHBOARD, "dashboard"); + + public static final CreatePayoutsResponseSource AUTOMATIC = + new CreatePayoutsResponseSource(Value.AUTOMATIC, "automatic"); + + public static final CreatePayoutsResponseSource API = new CreatePayoutsResponseSource(Value.API, "api"); + + private final Value value; + + private final String string; + + CreatePayoutsResponseSource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreatePayoutsResponseSource + && this.string.equals(((CreatePayoutsResponseSource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DASHBOARD: + return visitor.visitDashboard(); + case AUTOMATIC: + return visitor.visitAutomatic(); + case API: + return visitor.visitApi(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreatePayoutsResponseSource valueOf(String value) { + switch (value) { + case "dashboard": + return DASHBOARD; + case "automatic": + return AUTOMATIC; + case "api": + return API; + default: + return new CreatePayoutsResponseSource(Value.UNKNOWN, value); + } + } + + public enum Value { + API, + + DASHBOARD, + + AUTOMATIC, + + UNKNOWN + } + + public interface Visitor { + T visitApi(); + + T visitDashboard(); + + T visitAutomatic(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseSpeed.java b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseSpeed.java new file mode 100644 index 00000000..f3d9916a --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseSpeed.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreatePayoutsResponseSpeed { + public static final CreatePayoutsResponseSpeed INSTANT = new CreatePayoutsResponseSpeed(Value.INSTANT, "instant"); + + public static final CreatePayoutsResponseSpeed STANDARD = + new CreatePayoutsResponseSpeed(Value.STANDARD, "standard"); + + private final Value value; + + private final String string; + + CreatePayoutsResponseSpeed(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreatePayoutsResponseSpeed + && this.string.equals(((CreatePayoutsResponseSpeed) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTANT: + return visitor.visitInstant(); + case STANDARD: + return visitor.visitStandard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreatePayoutsResponseSpeed valueOf(String value) { + switch (value) { + case "instant": + return INSTANT; + case "standard": + return STANDARD; + default: + return new CreatePayoutsResponseSpeed(Value.UNKNOWN, value); + } + } + + public enum Value { + STANDARD, + + INSTANT, + + UNKNOWN + } + + public interface Visitor { + T visitStandard(); + + T visitInstant(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseStatus.java b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseStatus.java new file mode 100644 index 00000000..8ebd16c0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/CreatePayoutsResponseStatus.java @@ -0,0 +1,150 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreatePayoutsResponseStatus { + public static final CreatePayoutsResponseStatus FAILED = new CreatePayoutsResponseStatus(Value.FAILED, "failed"); + + public static final CreatePayoutsResponseStatus PROCESSING = + new CreatePayoutsResponseStatus(Value.PROCESSING, "processing"); + + public static final CreatePayoutsResponseStatus CANCELED = + new CreatePayoutsResponseStatus(Value.CANCELED, "canceled"); + + public static final CreatePayoutsResponseStatus COMPLETED = + new CreatePayoutsResponseStatus(Value.COMPLETED, "completed"); + + public static final CreatePayoutsResponseStatus REQUESTED = + new CreatePayoutsResponseStatus(Value.REQUESTED, "requested"); + + public static final CreatePayoutsResponseStatus DENIED = new CreatePayoutsResponseStatus(Value.DENIED, "denied"); + + public static final CreatePayoutsResponseStatus REVERSED = + new CreatePayoutsResponseStatus(Value.REVERSED, "reversed"); + + public static final CreatePayoutsResponseStatus IN_REVIEW = + new CreatePayoutsResponseStatus(Value.IN_REVIEW, "in_review"); + + private final Value value; + + private final String string; + + CreatePayoutsResponseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreatePayoutsResponseStatus + && this.string.equals(((CreatePayoutsResponseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case PROCESSING: + return visitor.visitProcessing(); + case CANCELED: + return visitor.visitCanceled(); + case COMPLETED: + return visitor.visitCompleted(); + case REQUESTED: + return visitor.visitRequested(); + case DENIED: + return visitor.visitDenied(); + case REVERSED: + return visitor.visitReversed(); + case IN_REVIEW: + return visitor.visitInReview(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreatePayoutsResponseStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "processing": + return PROCESSING; + case "canceled": + return CANCELED; + case "completed": + return COMPLETED; + case "requested": + return REQUESTED; + case "denied": + return DENIED; + case "reversed": + return REVERSED; + case "in_review": + return IN_REVIEW; + default: + return new CreatePayoutsResponseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + REQUESTED, + + IN_REVIEW, + + PROCESSING, + + COMPLETED, + + REVERSED, + + CANCELED, + + FAILED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitRequested(); + + T visitInReview(); + + T visitProcessing(); + + T visitCompleted(); + + T visitReversed(); + + T visitCanceled(); + + T visitFailed(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsRequestSource.java b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsRequestSource.java new file mode 100644 index 00000000..117b390c --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsRequestSource.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPayoutsRequestSource { + public static final ListPayoutsRequestSource DASHBOARD = new ListPayoutsRequestSource(Value.DASHBOARD, "dashboard"); + + public static final ListPayoutsRequestSource AUTOMATIC = new ListPayoutsRequestSource(Value.AUTOMATIC, "automatic"); + + public static final ListPayoutsRequestSource API = new ListPayoutsRequestSource(Value.API, "api"); + + private final Value value; + + private final String string; + + ListPayoutsRequestSource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPayoutsRequestSource + && this.string.equals(((ListPayoutsRequestSource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DASHBOARD: + return visitor.visitDashboard(); + case AUTOMATIC: + return visitor.visitAutomatic(); + case API: + return visitor.visitApi(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPayoutsRequestSource valueOf(String value) { + switch (value) { + case "dashboard": + return DASHBOARD; + case "automatic": + return AUTOMATIC; + case "api": + return API; + default: + return new ListPayoutsRequestSource(Value.UNKNOWN, value); + } + } + + public enum Value { + API, + + DASHBOARD, + + AUTOMATIC, + + UNKNOWN + } + + public interface Visitor { + T visitApi(); + + T visitDashboard(); + + T visitAutomatic(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsRequestStatus.java b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsRequestStatus.java new file mode 100644 index 00000000..ab421ea4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsRequestStatus.java @@ -0,0 +1,145 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPayoutsRequestStatus { + public static final ListPayoutsRequestStatus FAILED = new ListPayoutsRequestStatus(Value.FAILED, "failed"); + + public static final ListPayoutsRequestStatus PROCESSING = + new ListPayoutsRequestStatus(Value.PROCESSING, "processing"); + + public static final ListPayoutsRequestStatus CANCELED = new ListPayoutsRequestStatus(Value.CANCELED, "canceled"); + + public static final ListPayoutsRequestStatus COMPLETED = new ListPayoutsRequestStatus(Value.COMPLETED, "completed"); + + public static final ListPayoutsRequestStatus REQUESTED = new ListPayoutsRequestStatus(Value.REQUESTED, "requested"); + + public static final ListPayoutsRequestStatus DENIED = new ListPayoutsRequestStatus(Value.DENIED, "denied"); + + public static final ListPayoutsRequestStatus REVERSED = new ListPayoutsRequestStatus(Value.REVERSED, "reversed"); + + public static final ListPayoutsRequestStatus IN_REVIEW = new ListPayoutsRequestStatus(Value.IN_REVIEW, "in_review"); + + private final Value value; + + private final String string; + + ListPayoutsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPayoutsRequestStatus + && this.string.equals(((ListPayoutsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case PROCESSING: + return visitor.visitProcessing(); + case CANCELED: + return visitor.visitCanceled(); + case COMPLETED: + return visitor.visitCompleted(); + case REQUESTED: + return visitor.visitRequested(); + case DENIED: + return visitor.visitDenied(); + case REVERSED: + return visitor.visitReversed(); + case IN_REVIEW: + return visitor.visitInReview(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPayoutsRequestStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "processing": + return PROCESSING; + case "canceled": + return CANCELED; + case "completed": + return COMPLETED; + case "requested": + return REQUESTED; + case "denied": + return DENIED; + case "reversed": + return REVERSED; + case "in_review": + return IN_REVIEW; + default: + return new ListPayoutsRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + REQUESTED, + + IN_REVIEW, + + PROCESSING, + + COMPLETED, + + REVERSED, + + CANCELED, + + FAILED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitRequested(); + + T visitInReview(); + + T visitProcessing(); + + T visitCompleted(); + + T visitReversed(); + + T visitCanceled(); + + T visitFailed(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponse.java b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponse.java new file mode 100644 index 00000000..748b528d --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponse.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPayoutsResponse.Builder.class) +public final class ListPayoutsResponse { + private final List data; + + private final ListPayoutsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListPayoutsResponse( + List data, + ListPayoutsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListPayoutsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPayoutsResponse && equalTo((ListPayoutsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPayoutsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListPayoutsResponsePageInfo pageInfo); + + Builder from(ListPayoutsResponse other); + } + + public interface _FinalStage { + ListPayoutsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ListPayoutsResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListPayoutsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPayoutsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListPayoutsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ListPayoutsResponseDataItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListPayoutsResponse build() { + return new ListPayoutsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItem.java b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItem.java new file mode 100644 index 00000000..ff4144f8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItem.java @@ -0,0 +1,1404 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPayoutsResponseDataItem.Builder.class) +public final class ListPayoutsResponseDataItem { + private final String amount; + + private final OffsetDateTime createdAt; + + private final String currency; + + private final Optional destinationAmount; + + private final Optional destinationCurrency; + + private final Optional estimatedArrival; + + private final Optional exchangeRate; + + private final Optional failure; + + private final String feeAmount; + + private final ListPayoutsResponseDataItemFeePaidBy feePaidBy; + + private final String id; + + private final String markupFee; + + private final Map metadata; + + private final String netAmount; + + private final Optional notes; + + private final ListPayoutsResponseDataItemObject object; + + private final Optional payerName; + + private final Optional payoutMethod; + + private final Optional payoutRequestId; + + private final Optional source; + + private final ListPayoutsResponseDataItemSpeed speed; + + private final ListPayoutsResponseDataItemStatus status; + + private final String statusDetail; + + private final Optional traceCode; + + private final Map additionalProperties; + + private ListPayoutsResponseDataItem( + String amount, + OffsetDateTime createdAt, + String currency, + Optional destinationAmount, + Optional destinationCurrency, + Optional estimatedArrival, + Optional exchangeRate, + Optional failure, + String feeAmount, + ListPayoutsResponseDataItemFeePaidBy feePaidBy, + String id, + String markupFee, + Map metadata, + String netAmount, + Optional notes, + ListPayoutsResponseDataItemObject object, + Optional payerName, + Optional payoutMethod, + Optional payoutRequestId, + Optional source, + ListPayoutsResponseDataItemSpeed speed, + ListPayoutsResponseDataItemStatus status, + String statusDetail, + Optional traceCode, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.currency = currency; + this.destinationAmount = destinationAmount; + this.destinationCurrency = destinationCurrency; + this.estimatedArrival = estimatedArrival; + this.exchangeRate = exchangeRate; + this.failure = failure; + this.feeAmount = feeAmount; + this.feePaidBy = feePaidBy; + this.id = id; + this.markupFee = markupFee; + this.metadata = metadata; + this.netAmount = netAmount; + this.notes = notes; + this.object = object; + this.payerName = payerName; + this.payoutMethod = payoutMethod; + this.payoutRequestId = payoutRequestId; + this.source = source; + this.speed = speed; + this.status = status; + this.statusDetail = statusDetail; + this.traceCode = traceCode; + this.additionalProperties = additionalProperties; + } + + /** + * @return The payout amount in whole currency units, as a decimal string. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + /** + * @return When the payout was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Payout currency. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion. + */ + @JsonIgnore + public Optional getDestinationAmount() { + if (destinationAmount == null) { + return Optional.empty(); + } + return destinationAmount; + } + + /** + * @return Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists. + */ + @JsonIgnore + public Optional getDestinationCurrency() { + if (destinationCurrency == null) { + return Optional.empty(); + } + return destinationCurrency; + } + + /** + * @return Estimated time the funds become available in the destination account. + */ + @JsonIgnore + public Optional getEstimatedArrival() { + if (estimatedArrival == null) { + return Optional.empty(); + } + return estimatedArrival; + } + + /** + * @return Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate. + */ + @JsonIgnore + public Optional getExchangeRate() { + if (exchangeRate == null) { + return Optional.empty(); + } + return exchangeRate; + } + + /** + * @return Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise. + */ + @JsonIgnore + public Optional getFailure() { + if (failure == null) { + return Optional.empty(); + } + return failure; + } + + /** + * @return The fee charged for the payout, in the payout currency, as a decimal string. + */ + @JsonProperty("fee_amount") + public String getFeeAmount() { + return feeAmount; + } + + /** + * @return Who bore the payout fee: the account itself, or its parent platform. + */ + @JsonProperty("fee_paid_by") + public ListPayoutsResponseDataItemFeePaidBy getFeePaidBy() { + return feePaidBy; + } + + /** + * @return Payout ID, prefixed wdrl_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies. + */ + @JsonProperty("markup_fee") + public String getMarkupFee() { + return markupFee; + } + + /** + * @return Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters. + */ + @JsonProperty("metadata") + public Map getMetadata() { + return metadata; + } + + /** + * @return The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered. + */ + @JsonProperty("net_amount") + public String getNetAmount() { + return netAmount; + } + + /** + * @return Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + @JsonProperty("object") + public ListPayoutsResponseDataItemObject getObject() { + return object; + } + + /** + * @return Name of the entity processing the payout. + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + /** + * @return The saved payout method used. Requires payout:destination:read; null without it. + */ + @JsonIgnore + public Optional getPayoutMethod() { + if (payoutMethod == null) { + return Optional.empty(); + } + return payoutMethod; + } + + /** + * @return Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts. + */ + @JsonIgnore + public Optional getPayoutRequestId() { + if (payoutRequestId == null) { + return Optional.empty(); + } + return payoutRequestId; + } + + /** + * @return How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling. + */ + @JsonIgnore + public Optional getSource() { + if (source == null) { + return Optional.empty(); + } + return source; + } + + /** + * @return Payout delivery speed. + */ + @JsonProperty("speed") + public ListPayoutsResponseDataItemSpeed getSpeed() { + return speed; + } + + /** + * @return Current payout status. + */ + @JsonProperty("status") + public ListPayoutsResponseDataItemStatus getStatus() { + return status; + } + + /** + * @return The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract. + */ + @JsonProperty("status_detail") + public String getStatusDetail() { + return statusDetail; + } + + /** + * @return ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH. + */ + @JsonIgnore + public Optional getTraceCode() { + if (traceCode == null) { + return Optional.empty(); + } + return traceCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination_amount") + private Optional _getDestinationAmount() { + return destinationAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination_currency") + private Optional _getDestinationCurrency() { + return destinationCurrency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("estimated_arrival") + private Optional _getEstimatedArrival() { + return estimatedArrival; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exchange_rate") + private Optional _getExchangeRate() { + return exchangeRate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure") + private Optional _getFailure() { + return failure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_method") + private Optional _getPayoutMethod() { + return payoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_request_id") + private Optional _getPayoutRequestId() { + return payoutRequestId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source") + private Optional _getSource() { + return source; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trace_code") + private Optional _getTraceCode() { + return traceCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPayoutsResponseDataItem && equalTo((ListPayoutsResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPayoutsResponseDataItem other) { + return amount.equals(other.amount) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && destinationAmount.equals(other.destinationAmount) + && destinationCurrency.equals(other.destinationCurrency) + && estimatedArrival.equals(other.estimatedArrival) + && exchangeRate.equals(other.exchangeRate) + && failure.equals(other.failure) + && feeAmount.equals(other.feeAmount) + && feePaidBy.equals(other.feePaidBy) + && id.equals(other.id) + && markupFee.equals(other.markupFee) + && metadata.equals(other.metadata) + && netAmount.equals(other.netAmount) + && notes.equals(other.notes) + && object.equals(other.object) + && payerName.equals(other.payerName) + && payoutMethod.equals(other.payoutMethod) + && payoutRequestId.equals(other.payoutRequestId) + && source.equals(other.source) + && speed.equals(other.speed) + && status.equals(other.status) + && statusDetail.equals(other.statusDetail) + && traceCode.equals(other.traceCode); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.currency, + this.destinationAmount, + this.destinationCurrency, + this.estimatedArrival, + this.exchangeRate, + this.failure, + this.feeAmount, + this.feePaidBy, + this.id, + this.markupFee, + this.metadata, + this.netAmount, + this.notes, + this.object, + this.payerName, + this.payoutMethod, + this.payoutRequestId, + this.source, + this.speed, + this.status, + this.statusDetail, + this.traceCode); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The payout amount in whole currency units, as a decimal string.

+ */ + CreatedAtStage amount(@NotNull String amount); + + Builder from(ListPayoutsResponseDataItem other); + } + + public interface CreatedAtStage { + /** + *

When the payout was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

Payout currency.

+ */ + FeeAmountStage currency(@NotNull String currency); + } + + public interface FeeAmountStage { + /** + *

The fee charged for the payout, in the payout currency, as a decimal string.

+ */ + FeePaidByStage feeAmount(@NotNull String feeAmount); + } + + public interface FeePaidByStage { + /** + *

Who bore the payout fee: the account itself, or its parent platform.

+ */ + IdStage feePaidBy(@NotNull ListPayoutsResponseDataItemFeePaidBy feePaidBy); + } + + public interface IdStage { + /** + *

Payout ID, prefixed wdrl_.

+ */ + MarkupFeeStage id(@NotNull String id); + } + + public interface MarkupFeeStage { + /** + *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ */ + NetAmountStage markupFee(@NotNull String markupFee); + } + + public interface NetAmountStage { + /** + *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ */ + ObjectStage netAmount(@NotNull String netAmount); + } + + public interface ObjectStage { + SpeedStage object(@NotNull ListPayoutsResponseDataItemObject object); + } + + public interface SpeedStage { + /** + *

Payout delivery speed.

+ */ + StatusStage speed(@NotNull ListPayoutsResponseDataItemSpeed speed); + } + + public interface StatusStage { + /** + *

Current payout status.

+ */ + StatusDetailStage status(@NotNull ListPayoutsResponseDataItemStatus status); + } + + public interface StatusDetailStage { + /** + *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ */ + _FinalStage statusDetail(@NotNull String statusDetail); + } + + public interface _FinalStage { + ListPayoutsResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ */ + _FinalStage destinationAmount(Optional destinationAmount); + + _FinalStage destinationAmount(String destinationAmount); + + _FinalStage destinationAmount(Nullable destinationAmount); + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ */ + _FinalStage destinationCurrency(Optional destinationCurrency); + + _FinalStage destinationCurrency(String destinationCurrency); + + _FinalStage destinationCurrency(Nullable destinationCurrency); + + /** + *

Estimated time the funds become available in the destination account.

+ */ + _FinalStage estimatedArrival(Optional estimatedArrival); + + _FinalStage estimatedArrival(OffsetDateTime estimatedArrival); + + _FinalStage estimatedArrival(Nullable estimatedArrival); + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ */ + _FinalStage exchangeRate(Optional exchangeRate); + + _FinalStage exchangeRate(Float exchangeRate); + + _FinalStage exchangeRate(Nullable exchangeRate); + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ */ + _FinalStage failure(Optional failure); + + _FinalStage failure(ListPayoutsResponseDataItemFailure failure); + + _FinalStage failure(Nullable failure); + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ */ + _FinalStage metadata(Map metadata); + + _FinalStage putAllMetadata(Map metadata); + + _FinalStage metadata(String key, String value); + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + + /** + *

Name of the entity processing the payout.

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ */ + _FinalStage payoutMethod(Optional payoutMethod); + + _FinalStage payoutMethod(ListPayoutsResponseDataItemPayoutMethod payoutMethod); + + _FinalStage payoutMethod(Nullable payoutMethod); + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ */ + _FinalStage payoutRequestId(Optional payoutRequestId); + + _FinalStage payoutRequestId(String payoutRequestId); + + _FinalStage payoutRequestId(Nullable payoutRequestId); + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ */ + _FinalStage source(Optional source); + + _FinalStage source(ListPayoutsResponseDataItemSource source); + + _FinalStage source(Nullable source); + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ */ + _FinalStage traceCode(Optional traceCode); + + _FinalStage traceCode(String traceCode); + + _FinalStage traceCode(Nullable traceCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + CurrencyStage, + FeeAmountStage, + FeePaidByStage, + IdStage, + MarkupFeeStage, + NetAmountStage, + ObjectStage, + SpeedStage, + StatusStage, + StatusDetailStage, + _FinalStage { + private String amount; + + private OffsetDateTime createdAt; + + private String currency; + + private String feeAmount; + + private ListPayoutsResponseDataItemFeePaidBy feePaidBy; + + private String id; + + private String markupFee; + + private String netAmount; + + private ListPayoutsResponseDataItemObject object; + + private ListPayoutsResponseDataItemSpeed speed; + + private ListPayoutsResponseDataItemStatus status; + + private String statusDetail; + + private Optional traceCode = Optional.empty(); + + private Optional source = Optional.empty(); + + private Optional payoutRequestId = Optional.empty(); + + private Optional payoutMethod = Optional.empty(); + + private Optional payerName = Optional.empty(); + + private Optional notes = Optional.empty(); + + private Map metadata = new LinkedHashMap<>(); + + private Optional failure = Optional.empty(); + + private Optional exchangeRate = Optional.empty(); + + private Optional estimatedArrival = Optional.empty(); + + private Optional destinationCurrency = Optional.empty(); + + private Optional destinationAmount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPayoutsResponseDataItem other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + destinationAmount(other.getDestinationAmount()); + destinationCurrency(other.getDestinationCurrency()); + estimatedArrival(other.getEstimatedArrival()); + exchangeRate(other.getExchangeRate()); + failure(other.getFailure()); + feeAmount(other.getFeeAmount()); + feePaidBy(other.getFeePaidBy()); + id(other.getId()); + markupFee(other.getMarkupFee()); + metadata(other.getMetadata()); + netAmount(other.getNetAmount()); + notes(other.getNotes()); + object(other.getObject()); + payerName(other.getPayerName()); + payoutMethod(other.getPayoutMethod()); + payoutRequestId(other.getPayoutRequestId()); + source(other.getSource()); + speed(other.getSpeed()); + status(other.getStatus()); + statusDetail(other.getStatusDetail()); + traceCode(other.getTraceCode()); + return this; + } + + /** + *

The payout amount in whole currency units, as a decimal string.

+ *

The payout amount in whole currency units, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

When the payout was created.

+ *

When the payout was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Payout currency.

+ *

Payout currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public FeeAmountStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The fee charged for the payout, in the payout currency, as a decimal string.

+ *

The fee charged for the payout, in the payout currency, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_amount") + public FeePaidByStage feeAmount(@NotNull String feeAmount) { + this.feeAmount = Objects.requireNonNull(feeAmount, "feeAmount must not be null"); + return this; + } + + /** + *

Who bore the payout fee: the account itself, or its parent platform.

+ *

Who bore the payout fee: the account itself, or its parent platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_paid_by") + public IdStage feePaidBy(@NotNull ListPayoutsResponseDataItemFeePaidBy feePaidBy) { + this.feePaidBy = Objects.requireNonNull(feePaidBy, "feePaidBy must not be null"); + return this; + } + + /** + *

Payout ID, prefixed wdrl_.

+ *

Payout ID, prefixed wdrl_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MarkupFeeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("markup_fee") + public NetAmountStage markupFee(@NotNull String markupFee) { + this.markupFee = Objects.requireNonNull(markupFee, "markupFee must not be null"); + return this; + } + + /** + *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("net_amount") + public ObjectStage netAmount(@NotNull String netAmount) { + this.netAmount = Objects.requireNonNull(netAmount, "netAmount must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public SpeedStage object(@NotNull ListPayoutsResponseDataItemObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Payout delivery speed.

+ *

Payout delivery speed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("speed") + public StatusStage speed(@NotNull ListPayoutsResponseDataItemSpeed speed) { + this.speed = Objects.requireNonNull(speed, "speed must not be null"); + return this; + } + + /** + *

Current payout status.

+ *

Current payout status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public StatusDetailStage status(@NotNull ListPayoutsResponseDataItemStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status_detail") + public _FinalStage statusDetail(@NotNull String statusDetail) { + this.statusDetail = Objects.requireNonNull(statusDetail, "statusDetail must not be null"); + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage traceCode(Nullable traceCode) { + if (traceCode.isNull()) { + this.traceCode = null; + } else if (traceCode.isEmpty()) { + this.traceCode = Optional.empty(); + } else { + this.traceCode = Optional.of(traceCode.get()); + } + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage traceCode(String traceCode) { + this.traceCode = Optional.ofNullable(traceCode); + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ */ + @java.lang.Override + @JsonSetter(value = "trace_code", nulls = Nulls.SKIP) + public _FinalStage traceCode(Optional traceCode) { + this.traceCode = traceCode; + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(Nullable source) { + if (source.isNull()) { + this.source = null; + } else if (source.isEmpty()) { + this.source = Optional.empty(); + } else { + this.source = Optional.of(source.get()); + } + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(ListPayoutsResponseDataItemSource source) { + this.source = Optional.ofNullable(source); + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ */ + @java.lang.Override + @JsonSetter(value = "source", nulls = Nulls.SKIP) + public _FinalStage source(Optional source) { + this.source = source; + return this; + } + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(Nullable payoutRequestId) { + if (payoutRequestId.isNull()) { + this.payoutRequestId = null; + } else if (payoutRequestId.isEmpty()) { + this.payoutRequestId = Optional.empty(); + } else { + this.payoutRequestId = Optional.of(payoutRequestId.get()); + } + return this; + } + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(String payoutRequestId) { + this.payoutRequestId = Optional.ofNullable(payoutRequestId); + return this; + } + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_request_id", nulls = Nulls.SKIP) + public _FinalStage payoutRequestId(Optional payoutRequestId) { + this.payoutRequestId = payoutRequestId; + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutMethod(Nullable payoutMethod) { + if (payoutMethod.isNull()) { + this.payoutMethod = null; + } else if (payoutMethod.isEmpty()) { + this.payoutMethod = Optional.empty(); + } else { + this.payoutMethod = Optional.of(payoutMethod.get()); + } + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutMethod(ListPayoutsResponseDataItemPayoutMethod payoutMethod) { + this.payoutMethod = Optional.ofNullable(payoutMethod); + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_method", nulls = Nulls.SKIP) + public _FinalStage payoutMethod(Optional payoutMethod) { + this.payoutMethod = payoutMethod; + return this; + } + + /** + *

Name of the entity processing the payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

Name of the entity processing the payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

Name of the entity processing the payout.

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(String key, String value) { + this.metadata.put(key, value); + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllMetadata(Map metadata) { + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Map metadata) { + this.metadata.clear(); + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failure(Nullable failure) { + if (failure.isNull()) { + this.failure = null; + } else if (failure.isEmpty()) { + this.failure = Optional.empty(); + } else { + this.failure = Optional.of(failure.get()); + } + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failure(ListPayoutsResponseDataItemFailure failure) { + this.failure = Optional.ofNullable(failure); + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "failure", nulls = Nulls.SKIP) + public _FinalStage failure(Optional failure) { + this.failure = failure; + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage exchangeRate(Nullable exchangeRate) { + if (exchangeRate.isNull()) { + this.exchangeRate = null; + } else if (exchangeRate.isEmpty()) { + this.exchangeRate = Optional.empty(); + } else { + this.exchangeRate = Optional.of(exchangeRate.get()); + } + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage exchangeRate(Float exchangeRate) { + this.exchangeRate = Optional.ofNullable(exchangeRate); + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ */ + @java.lang.Override + @JsonSetter(value = "exchange_rate", nulls = Nulls.SKIP) + public _FinalStage exchangeRate(Optional exchangeRate) { + this.exchangeRate = exchangeRate; + return this; + } + + /** + *

Estimated time the funds become available in the destination account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(Nullable estimatedArrival) { + if (estimatedArrival.isNull()) { + this.estimatedArrival = null; + } else if (estimatedArrival.isEmpty()) { + this.estimatedArrival = Optional.empty(); + } else { + this.estimatedArrival = Optional.of(estimatedArrival.get()); + } + return this; + } + + /** + *

Estimated time the funds become available in the destination account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(OffsetDateTime estimatedArrival) { + this.estimatedArrival = Optional.ofNullable(estimatedArrival); + return this; + } + + /** + *

Estimated time the funds become available in the destination account.

+ */ + @java.lang.Override + @JsonSetter(value = "estimated_arrival", nulls = Nulls.SKIP) + public _FinalStage estimatedArrival(Optional estimatedArrival) { + this.estimatedArrival = estimatedArrival; + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationCurrency(Nullable destinationCurrency) { + if (destinationCurrency.isNull()) { + this.destinationCurrency = null; + } else if (destinationCurrency.isEmpty()) { + this.destinationCurrency = Optional.empty(); + } else { + this.destinationCurrency = Optional.of(destinationCurrency.get()); + } + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationCurrency(String destinationCurrency) { + this.destinationCurrency = Optional.ofNullable(destinationCurrency); + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ */ + @java.lang.Override + @JsonSetter(value = "destination_currency", nulls = Nulls.SKIP) + public _FinalStage destinationCurrency(Optional destinationCurrency) { + this.destinationCurrency = destinationCurrency; + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationAmount(Nullable destinationAmount) { + if (destinationAmount.isNull()) { + this.destinationAmount = null; + } else if (destinationAmount.isEmpty()) { + this.destinationAmount = Optional.empty(); + } else { + this.destinationAmount = Optional.of(destinationAmount.get()); + } + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationAmount(String destinationAmount) { + this.destinationAmount = Optional.ofNullable(destinationAmount); + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ */ + @java.lang.Override + @JsonSetter(value = "destination_amount", nulls = Nulls.SKIP) + public _FinalStage destinationAmount(Optional destinationAmount) { + this.destinationAmount = destinationAmount; + return this; + } + + @java.lang.Override + public ListPayoutsResponseDataItem build() { + return new ListPayoutsResponseDataItem( + amount, + createdAt, + currency, + destinationAmount, + destinationCurrency, + estimatedArrival, + exchangeRate, + failure, + feeAmount, + feePaidBy, + id, + markupFee, + metadata, + netAmount, + notes, + object, + payerName, + payoutMethod, + payoutRequestId, + source, + speed, + status, + statusDetail, + traceCode, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemFailure.java b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemFailure.java new file mode 100644 index 00000000..687deb9b --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemFailure.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPayoutsResponseDataItemFailure.Builder.class) +public final class ListPayoutsResponseDataItemFailure { + private final Optional code; + + private final Optional fundsReturnedAt; + + private final Optional message; + + private final Map additionalProperties; + + private ListPayoutsResponseDataItemFailure( + Optional code, + Optional fundsReturnedAt, + Optional message, + Map additionalProperties) { + this.code = code; + this.fundsReturnedAt = fundsReturnedAt; + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return Classified failure code from the maintained error catalog. + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + /** + * @return The effective time of the reversal that put the funds back in the balance — null if they never left it or have not returned yet. Set only once the return is confirmed in the ledger; the ledger posting itself can land moments after this time. + */ + @JsonIgnore + public Optional getFundsReturnedAt() { + if (fundsReturnedAt == null) { + return Optional.empty(); + } + return fundsReturnedAt; + } + + /** + * @return Human-readable explanation of the failure. Callers holding payout:destination:read may receive text personalized to the destination; other callers get the generic catalog message. + */ + @JsonIgnore + public Optional getMessage() { + if (message == null) { + return Optional.empty(); + } + return message; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("funds_returned_at") + private Optional _getFundsReturnedAt() { + return fundsReturnedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("message") + private Optional _getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPayoutsResponseDataItemFailure + && equalTo((ListPayoutsResponseDataItemFailure) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPayoutsResponseDataItemFailure other) { + return code.equals(other.code) + && fundsReturnedAt.equals(other.fundsReturnedAt) + && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.fundsReturnedAt, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional code = Optional.empty(); + + private Optional fundsReturnedAt = Optional.empty(); + + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListPayoutsResponseDataItemFailure other) { + code(other.getCode()); + fundsReturnedAt(other.getFundsReturnedAt()); + message(other.getMessage()); + return this; + } + + /** + *

Classified failure code from the maintained error catalog.

+ */ + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public Builder code(Optional code) { + this.code = code; + return this; + } + + public Builder code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + public Builder code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

The effective time of the reversal that put the funds back in the balance — null if they never left it or have not returned yet. Set only once the return is confirmed in the ledger; the ledger posting itself can land moments after this time.

+ */ + @JsonSetter(value = "funds_returned_at", nulls = Nulls.SKIP) + public Builder fundsReturnedAt(Optional fundsReturnedAt) { + this.fundsReturnedAt = fundsReturnedAt; + return this; + } + + public Builder fundsReturnedAt(OffsetDateTime fundsReturnedAt) { + this.fundsReturnedAt = Optional.ofNullable(fundsReturnedAt); + return this; + } + + public Builder fundsReturnedAt(Nullable fundsReturnedAt) { + if (fundsReturnedAt.isNull()) { + this.fundsReturnedAt = null; + } else if (fundsReturnedAt.isEmpty()) { + this.fundsReturnedAt = Optional.empty(); + } else { + this.fundsReturnedAt = Optional.of(fundsReturnedAt.get()); + } + return this; + } + + /** + *

Human-readable explanation of the failure. Callers holding payout:destination:read may receive text personalized to the destination; other callers get the generic catalog message.

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public Builder message(Nullable message) { + if (message.isNull()) { + this.message = null; + } else if (message.isEmpty()) { + this.message = Optional.empty(); + } else { + this.message = Optional.of(message.get()); + } + return this; + } + + public ListPayoutsResponseDataItemFailure build() { + return new ListPayoutsResponseDataItemFailure(code, fundsReturnedAt, message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemFeePaidBy.java b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemFeePaidBy.java new file mode 100644 index 00000000..720b24d6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemFeePaidBy.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPayoutsResponseDataItemFeePaidBy { + public static final ListPayoutsResponseDataItemFeePaidBy SELF = + new ListPayoutsResponseDataItemFeePaidBy(Value.SELF, "self"); + + public static final ListPayoutsResponseDataItemFeePaidBy PLATFORM = + new ListPayoutsResponseDataItemFeePaidBy(Value.PLATFORM, "platform"); + + private final Value value; + + private final String string; + + ListPayoutsResponseDataItemFeePaidBy(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPayoutsResponseDataItemFeePaidBy + && this.string.equals(((ListPayoutsResponseDataItemFeePaidBy) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF: + return visitor.visitSelf(); + case PLATFORM: + return visitor.visitPlatform(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPayoutsResponseDataItemFeePaidBy valueOf(String value) { + switch (value) { + case "self": + return SELF; + case "platform": + return PLATFORM; + default: + return new ListPayoutsResponseDataItemFeePaidBy(Value.UNKNOWN, value); + } + } + + public enum Value { + SELF, + + PLATFORM, + + UNKNOWN + } + + public interface Visitor { + T visitSelf(); + + T visitPlatform(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemObject.java b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemObject.java new file mode 100644 index 00000000..87d087c1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPayoutsResponseDataItemObject { + public static final ListPayoutsResponseDataItemObject PAYOUT = + new ListPayoutsResponseDataItemObject(Value.PAYOUT, "payout"); + + private final Value value; + + private final String string; + + ListPayoutsResponseDataItemObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPayoutsResponseDataItemObject + && this.string.equals(((ListPayoutsResponseDataItemObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYOUT: + return visitor.visitPayout(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPayoutsResponseDataItemObject valueOf(String value) { + switch (value) { + case "payout": + return PAYOUT; + default: + return new ListPayoutsResponseDataItemObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYOUT, + + UNKNOWN + } + + public interface Visitor { + T visitPayout(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemPayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemPayoutMethod.java new file mode 100644 index 00000000..848f92c2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemPayoutMethod.java @@ -0,0 +1,190 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPayoutsResponseDataItemPayoutMethod.Builder.class) +public final class ListPayoutsResponseDataItemPayoutMethod { + private final Optional nickname; + + private final Optional supportedPayoutMethod; + + private final Map additionalProperties; + + private ListPayoutsResponseDataItemPayoutMethod( + Optional nickname, + Optional supportedPayoutMethod, + Map additionalProperties) { + this.nickname = nickname; + this.supportedPayoutMethod = supportedPayoutMethod; + this.additionalProperties = additionalProperties; + } + + /** + * @return Saved payout method nickname. + */ + @JsonIgnore + public Optional getNickname() { + if (nickname == null) { + return Optional.empty(); + } + return nickname; + } + + /** + * @return Supported payout method display details. + */ + @JsonIgnore + public Optional getSupportedPayoutMethod() { + if (supportedPayoutMethod == null) { + return Optional.empty(); + } + return supportedPayoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("nickname") + private Optional _getNickname() { + return nickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("supported_payout_method") + private Optional _getSupportedPayoutMethod() { + return supportedPayoutMethod; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPayoutsResponseDataItemPayoutMethod + && equalTo((ListPayoutsResponseDataItemPayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPayoutsResponseDataItemPayoutMethod other) { + return nickname.equals(other.nickname) && supportedPayoutMethod.equals(other.supportedPayoutMethod); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.nickname, this.supportedPayoutMethod); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional nickname = Optional.empty(); + + private Optional supportedPayoutMethod = + Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListPayoutsResponseDataItemPayoutMethod other) { + nickname(other.getNickname()); + supportedPayoutMethod(other.getSupportedPayoutMethod()); + return this; + } + + /** + *

Saved payout method nickname.

+ */ + @JsonSetter(value = "nickname", nulls = Nulls.SKIP) + public Builder nickname(Optional nickname) { + this.nickname = nickname; + return this; + } + + public Builder nickname(String nickname) { + this.nickname = Optional.ofNullable(nickname); + return this; + } + + public Builder nickname(Nullable nickname) { + if (nickname.isNull()) { + this.nickname = null; + } else if (nickname.isEmpty()) { + this.nickname = Optional.empty(); + } else { + this.nickname = Optional.of(nickname.get()); + } + return this; + } + + /** + *

Supported payout method display details.

+ */ + @JsonSetter(value = "supported_payout_method", nulls = Nulls.SKIP) + public Builder supportedPayoutMethod( + Optional supportedPayoutMethod) { + this.supportedPayoutMethod = supportedPayoutMethod; + return this; + } + + public Builder supportedPayoutMethod( + ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethod supportedPayoutMethod) { + this.supportedPayoutMethod = Optional.ofNullable(supportedPayoutMethod); + return this; + } + + public Builder supportedPayoutMethod( + Nullable supportedPayoutMethod) { + if (supportedPayoutMethod.isNull()) { + this.supportedPayoutMethod = null; + } else if (supportedPayoutMethod.isEmpty()) { + this.supportedPayoutMethod = Optional.empty(); + } else { + this.supportedPayoutMethod = Optional.of(supportedPayoutMethod.get()); + } + return this; + } + + public ListPayoutsResponseDataItemPayoutMethod build() { + return new ListPayoutsResponseDataItemPayoutMethod(nickname, supportedPayoutMethod, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethod.java new file mode 100644 index 00000000..dbecbdcd --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethod.java @@ -0,0 +1,280 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethod.Builder.class) +public final class ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethod { + private final ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType deliveryType; + + private final Optional iconUrl; + + private final Optional payerName; + + private final Map additionalProperties; + + private ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethod( + ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType deliveryType, + Optional iconUrl, + Optional payerName, + Map additionalProperties) { + this.deliveryType = deliveryType; + this.iconUrl = iconUrl; + this.payerName = payerName; + this.additionalProperties = additionalProperties; + } + + /** + * @return How the funds are delivered to the recipient. + */ + @JsonProperty("delivery_type") + public ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType getDeliveryType() { + return deliveryType; + } + + /** + * @return Supported payout method icon URL. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return Supported payout method display name. + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethod + && equalTo((ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethod other) { + return deliveryType.equals(other.deliveryType) + && iconUrl.equals(other.iconUrl) + && payerName.equals(other.payerName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deliveryType, this.iconUrl, this.payerName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeliveryTypeStage builder() { + return new Builder(); + } + + public interface DeliveryTypeStage { + /** + *

How the funds are delivered to the recipient.

+ */ + _FinalStage deliveryType( + @NotNull ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType deliveryType); + + Builder from(ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethod other); + } + + public interface _FinalStage { + ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Supported payout method icon URL.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Supported payout method display name.

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeliveryTypeStage, _FinalStage { + private ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType deliveryType; + + private Optional payerName = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethod other) { + deliveryType(other.getDeliveryType()); + iconUrl(other.getIconUrl()); + payerName(other.getPayerName()); + return this; + } + + /** + *

How the funds are delivered to the recipient.

+ *

How the funds are delivered to the recipient.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("delivery_type") + public _FinalStage deliveryType( + @NotNull ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType deliveryType) { + this.deliveryType = Objects.requireNonNull(deliveryType, "deliveryType must not be null"); + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

Supported payout method display name.

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Supported payout method icon URL.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + @java.lang.Override + public ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethod build() { + return new ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethod( + deliveryType, iconUrl, payerName, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType.java b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType.java new file mode 100644 index 00000000..317fbbe8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType.java @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType { + public static final ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType PAPER_CHECK = + new ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType( + Value.PAPER_CHECK, "paper_check"); + + public static final ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType CRYPTOCURRENCY = + new ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType( + Value.CRYPTOCURRENCY, "cryptocurrency"); + + public static final ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType UNKNOWN = + new ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType(Value.UNKNOWN, "unknown"); + + public static final ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType HOME_DELIVERY = + new ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType( + Value.HOME_DELIVERY, "home_delivery"); + + public static final ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType BANK_DEPOSIT = + new ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType( + Value.BANK_DEPOSIT, "bank_deposit"); + + public static final ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType MASSPAY_CARD = + new ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType( + Value.MASSPAY_CARD, "masspay_card"); + + public static final ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType MOBILE_WALLET = + new ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType( + Value.MOBILE_WALLET, "mobile_wallet"); + + public static final ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType CASH_PICKUP = + new ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType( + Value.CASH_PICKUP, "cash_pickup"); + + public static final ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType BILL = + new ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType(Value.BILL, "bill"); + + private final Value value; + + private final String string; + + ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType + && this.string.equals( + ((ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType) other) + .string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAPER_CHECK: + return visitor.visitPaperCheck(); + case CRYPTOCURRENCY: + return visitor.visitCryptocurrency(); + case UNKNOWN: + return visitor.visitUnknown(); + case HOME_DELIVERY: + return visitor.visitHomeDelivery(); + case BANK_DEPOSIT: + return visitor.visitBankDeposit(); + case MASSPAY_CARD: + return visitor.visitMasspayCard(); + case MOBILE_WALLET: + return visitor.visitMobileWallet(); + case CASH_PICKUP: + return visitor.visitCashPickup(); + case BILL: + return visitor.visitBill(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType valueOf(String value) { + switch (value) { + case "paper_check": + return PAPER_CHECK; + case "cryptocurrency": + return CRYPTOCURRENCY; + case "unknown": + return UNKNOWN; + case "home_delivery": + return HOME_DELIVERY; + case "bank_deposit": + return BANK_DEPOSIT; + case "masspay_card": + return MASSPAY_CARD; + case "mobile_wallet": + return MOBILE_WALLET; + case "cash_pickup": + return CASH_PICKUP; + case "bill": + return BILL; + default: + return new ListPayoutsResponseDataItemPayoutMethodSupportedPayoutMethodDeliveryType( + Value._UNKNOWN, value); + } + } + + public enum Value { + CASH_PICKUP, + + BANK_DEPOSIT, + + HOME_DELIVERY, + + MOBILE_WALLET, + + MASSPAY_CARD, + + PAPER_CHECK, + + BILL, + + CRYPTOCURRENCY, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitCashPickup(); + + T visitBankDeposit(); + + T visitHomeDelivery(); + + T visitMobileWallet(); + + T visitMasspayCard(); + + T visitPaperCheck(); + + T visitBill(); + + T visitCryptocurrency(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemSource.java b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemSource.java new file mode 100644 index 00000000..92ef2f0f --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemSource.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPayoutsResponseDataItemSource { + public static final ListPayoutsResponseDataItemSource DASHBOARD = + new ListPayoutsResponseDataItemSource(Value.DASHBOARD, "dashboard"); + + public static final ListPayoutsResponseDataItemSource AUTOMATIC = + new ListPayoutsResponseDataItemSource(Value.AUTOMATIC, "automatic"); + + public static final ListPayoutsResponseDataItemSource API = new ListPayoutsResponseDataItemSource(Value.API, "api"); + + private final Value value; + + private final String string; + + ListPayoutsResponseDataItemSource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPayoutsResponseDataItemSource + && this.string.equals(((ListPayoutsResponseDataItemSource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DASHBOARD: + return visitor.visitDashboard(); + case AUTOMATIC: + return visitor.visitAutomatic(); + case API: + return visitor.visitApi(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPayoutsResponseDataItemSource valueOf(String value) { + switch (value) { + case "dashboard": + return DASHBOARD; + case "automatic": + return AUTOMATIC; + case "api": + return API; + default: + return new ListPayoutsResponseDataItemSource(Value.UNKNOWN, value); + } + } + + public enum Value { + API, + + DASHBOARD, + + AUTOMATIC, + + UNKNOWN + } + + public interface Visitor { + T visitApi(); + + T visitDashboard(); + + T visitAutomatic(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemSpeed.java b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemSpeed.java new file mode 100644 index 00000000..2bef4e39 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemSpeed.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPayoutsResponseDataItemSpeed { + public static final ListPayoutsResponseDataItemSpeed INSTANT = + new ListPayoutsResponseDataItemSpeed(Value.INSTANT, "instant"); + + public static final ListPayoutsResponseDataItemSpeed STANDARD = + new ListPayoutsResponseDataItemSpeed(Value.STANDARD, "standard"); + + private final Value value; + + private final String string; + + ListPayoutsResponseDataItemSpeed(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPayoutsResponseDataItemSpeed + && this.string.equals(((ListPayoutsResponseDataItemSpeed) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTANT: + return visitor.visitInstant(); + case STANDARD: + return visitor.visitStandard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPayoutsResponseDataItemSpeed valueOf(String value) { + switch (value) { + case "instant": + return INSTANT; + case "standard": + return STANDARD; + default: + return new ListPayoutsResponseDataItemSpeed(Value.UNKNOWN, value); + } + } + + public enum Value { + STANDARD, + + INSTANT, + + UNKNOWN + } + + public interface Visitor { + T visitStandard(); + + T visitInstant(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemStatus.java b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemStatus.java new file mode 100644 index 00000000..2c8007a8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponseDataItemStatus.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPayoutsResponseDataItemStatus { + public static final ListPayoutsResponseDataItemStatus FAILED = + new ListPayoutsResponseDataItemStatus(Value.FAILED, "failed"); + + public static final ListPayoutsResponseDataItemStatus PROCESSING = + new ListPayoutsResponseDataItemStatus(Value.PROCESSING, "processing"); + + public static final ListPayoutsResponseDataItemStatus CANCELED = + new ListPayoutsResponseDataItemStatus(Value.CANCELED, "canceled"); + + public static final ListPayoutsResponseDataItemStatus COMPLETED = + new ListPayoutsResponseDataItemStatus(Value.COMPLETED, "completed"); + + public static final ListPayoutsResponseDataItemStatus REQUESTED = + new ListPayoutsResponseDataItemStatus(Value.REQUESTED, "requested"); + + public static final ListPayoutsResponseDataItemStatus DENIED = + new ListPayoutsResponseDataItemStatus(Value.DENIED, "denied"); + + public static final ListPayoutsResponseDataItemStatus REVERSED = + new ListPayoutsResponseDataItemStatus(Value.REVERSED, "reversed"); + + public static final ListPayoutsResponseDataItemStatus IN_REVIEW = + new ListPayoutsResponseDataItemStatus(Value.IN_REVIEW, "in_review"); + + private final Value value; + + private final String string; + + ListPayoutsResponseDataItemStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPayoutsResponseDataItemStatus + && this.string.equals(((ListPayoutsResponseDataItemStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case PROCESSING: + return visitor.visitProcessing(); + case CANCELED: + return visitor.visitCanceled(); + case COMPLETED: + return visitor.visitCompleted(); + case REQUESTED: + return visitor.visitRequested(); + case DENIED: + return visitor.visitDenied(); + case REVERSED: + return visitor.visitReversed(); + case IN_REVIEW: + return visitor.visitInReview(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPayoutsResponseDataItemStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "processing": + return PROCESSING; + case "canceled": + return CANCELED; + case "completed": + return COMPLETED; + case "requested": + return REQUESTED; + case "denied": + return DENIED; + case "reversed": + return REVERSED; + case "in_review": + return IN_REVIEW; + default: + return new ListPayoutsResponseDataItemStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + REQUESTED, + + IN_REVIEW, + + PROCESSING, + + COMPLETED, + + REVERSED, + + CANCELED, + + FAILED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitRequested(); + + T visitInReview(); + + T visitProcessing(); + + T visitCompleted(); + + T visitReversed(); + + T visitCanceled(); + + T visitFailed(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponsePageInfo.java b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponsePageInfo.java new file mode 100644 index 00000000..34f99135 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/ListPayoutsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPayoutsResponsePageInfo.Builder.class) +public final class ListPayoutsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListPayoutsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPayoutsResponsePageInfo && equalTo((ListPayoutsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPayoutsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListPayoutsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListPayoutsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPayoutsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListPayoutsResponsePageInfo build() { + return new ListPayoutsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayload.java b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayload.java new file mode 100644 index 00000000..beab87b9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayload.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPayoutMethodCreatedPayload.Builder.class) +public final class PostPayoutMethodCreatedPayload { + private final Optional accountId; + + private final PostPayoutMethodCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostPayoutMethodCreatedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostPayoutMethodCreatedPayloadType type; + + private final Map additionalProperties; + + private PostPayoutMethodCreatedPayload( + Optional accountId, + PostPayoutMethodCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostPayoutMethodCreatedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostPayoutMethodCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostPayoutMethodCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PostPayoutMethodCreatedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostPayoutMethodCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPayoutMethodCreatedPayload && equalTo((PostPayoutMethodCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPayoutMethodCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostPayoutMethodCreatedPayloadApiVersion apiVersion); + + Builder from(PostPayoutMethodCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PostPayoutMethodCreatedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostPayoutMethodCreatedPayloadType type); + } + + public interface _FinalStage { + PostPayoutMethodCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostPayoutMethodCreatedPayloadApiVersion apiVersion; + + private PostPayoutMethodCreatedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostPayoutMethodCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostPayoutMethodCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostPayoutMethodCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostPayoutMethodCreatedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostPayoutMethodCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostPayoutMethodCreatedPayload build() { + return new PostPayoutMethodCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadApiVersion.java new file mode 100644 index 00000000..24256855 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPayoutMethodCreatedPayloadApiVersion { + public static final PostPayoutMethodCreatedPayloadApiVersion V1 = + new PostPayoutMethodCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostPayoutMethodCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPayoutMethodCreatedPayloadApiVersion + && this.string.equals(((PostPayoutMethodCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPayoutMethodCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostPayoutMethodCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadData.java b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadData.java new file mode 100644 index 00000000..505138d5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadData.java @@ -0,0 +1,1319 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPayoutMethodCreatedPayloadData.Builder.class) +public final class PostPayoutMethodCreatedPayloadData { + private final Optional accountReference; + + private final Optional bankVerificationState; + + private final OffsetDateTime createdAt; + + private final String destinationCurrency; + + private final Optional estimatedArrival; + + private final Optional feeStructure; + + private final String id; + + private final Optional institutionName; + + private final boolean isClone; + + private final boolean isDefault; + + private final Optional lastPaidOutAt; + + private final boolean linkedViaPlaid; + + private final boolean needsPlaidReconnect; + + private final Optional nickname; + + private final PostPayoutMethodCreatedPayloadDataObject object; + + private final Optional payerName; + + private final Optional quote; + + private final PostPayoutMethodCreatedPayloadDataStatus status; + + private final Optional statusReason; + + private final Optional supportedPayoutMethod; + + private final Optional unavailableReason; + + private final Map additionalProperties; + + private PostPayoutMethodCreatedPayloadData( + Optional accountReference, + Optional bankVerificationState, + OffsetDateTime createdAt, + String destinationCurrency, + Optional estimatedArrival, + Optional feeStructure, + String id, + Optional institutionName, + boolean isClone, + boolean isDefault, + Optional lastPaidOutAt, + boolean linkedViaPlaid, + boolean needsPlaidReconnect, + Optional nickname, + PostPayoutMethodCreatedPayloadDataObject object, + Optional payerName, + Optional quote, + PostPayoutMethodCreatedPayloadDataStatus status, + Optional statusReason, + Optional supportedPayoutMethod, + Optional unavailableReason, + Map additionalProperties) { + this.accountReference = accountReference; + this.bankVerificationState = bankVerificationState; + this.createdAt = createdAt; + this.destinationCurrency = destinationCurrency; + this.estimatedArrival = estimatedArrival; + this.feeStructure = feeStructure; + this.id = id; + this.institutionName = institutionName; + this.isClone = isClone; + this.isDefault = isDefault; + this.lastPaidOutAt = lastPaidOutAt; + this.linkedViaPlaid = linkedViaPlaid; + this.needsPlaidReconnect = needsPlaidReconnect; + this.nickname = nickname; + this.object = object; + this.payerName = payerName; + this.quote = quote; + this.status = status; + this.statusReason = statusReason; + this.supportedPayoutMethod = supportedPayoutMethod; + this.unavailableReason = unavailableReason; + this.additionalProperties = additionalProperties; + } + + /** + * @return Masked identifier for the destination, such as the last four digits of a bank account. + */ + @JsonIgnore + public Optional getAccountReference() { + if (accountReference == null) { + return Optional.empty(); + } + return accountReference; + } + + /** + * @return Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked). + */ + @JsonIgnore + public Optional getBankVerificationState() { + if (bankVerificationState == null) { + return Optional.empty(); + } + return bankVerificationState; + } + + /** + * @return When the payout method was added. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Currency payouts are delivered in for this method. + */ + @JsonProperty("destination_currency") + public String getDestinationCurrency() { + return destinationCurrency; + } + + /** + * @return Estimated arrival times before an amount-specific quote is requested. Null when the method is not currently eligible. + */ + @JsonIgnore + public Optional getEstimatedArrival() { + if (estimatedArrival == null) { + return Optional.empty(); + } + return estimatedArrival; + } + + /** + * @return Configured fee terms for this payout method. Null when the method is not currently eligible. An amount-specific quote remains authoritative. + */ + @JsonIgnore + public Optional getFeeStructure() { + if (feeStructure == null) { + return Optional.empty(); + } + return feeStructure; + } + + /** + * @return Payout method ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Name of the bank or institution receiving payouts. + */ + @JsonIgnore + public Optional getInstitutionName() { + if (institutionName == null) { + return Optional.empty(); + } + return institutionName; + } + + /** + * @return Whether this method is a copy of one saved on another of the payer's accounts. + */ + @JsonProperty("is_clone") + public boolean getIsClone() { + return isClone; + } + + /** + * @return Whether this is the default payout method for the account. + */ + @JsonProperty("is_default") + public boolean getIsDefault() { + return isDefault; + } + + /** + * @return When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet. + */ + @JsonIgnore + public Optional getLastPaidOutAt() { + if (lastPaidOutAt == null) { + return Optional.empty(); + } + return lastPaidOutAt; + } + + /** + * @return Whether the payer added this method by signing in to their bank rather than typing account details. + */ + @JsonProperty("linked_via_plaid") + public boolean getLinkedViaPlaid() { + return linkedViaPlaid; + } + + /** + * @return Whether the bank sign-in behind this method has expired and must be redone before it counts as linked. + */ + @JsonProperty("needs_plaid_reconnect") + public boolean getNeedsPlaidReconnect() { + return needsPlaidReconnect; + } + + /** + * @return User-defined label for the payout method. + */ + @JsonIgnore + public Optional getNickname() { + if (nickname == null) { + return Optional.empty(); + } + return nickname; + } + + @JsonProperty("object") + public PostPayoutMethodCreatedPayloadDataObject getObject() { + return object; + } + + /** + * @return Display name of the payout rail, such as ACH Bank Deposit. + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + /** + * @return Fee and delivery estimate for withdrawing the requested amount through this method. Null unless an amount was provided, or when the estimate is unavailable. + */ + @JsonIgnore + public Optional getQuote() { + if (quote == null) { + return Optional.empty(); + } + return quote; + } + + /** + * @return Lifecycle status: created means saved but unused, active means a payout succeeded through it, broken means a payout failure disabled it; a later successful payout returns it to active. + */ + @JsonProperty("status") + public PostPayoutMethodCreatedPayloadDataStatus getStatus() { + return status; + } + + /** + * @return Machine-readable code for why the method is broken — the newest disabling failure recorded through it, whether a payout error or a pre-payout rejection. null unless the method is broken, or when it was disabled without a recorded failure. + */ + @JsonIgnore + public Optional getStatusReason() { + if (statusReason == null) { + return Optional.empty(); + } + return statusReason; + } + + /** + * @return The supported payout method this saved method was created from. + */ + @JsonIgnore + public Optional getSupportedPayoutMethod() { + if (supportedPayoutMethod == null) { + return Optional.empty(); + } + return supportedPayoutMethod; + } + + /** + * @return Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known. + */ + @JsonIgnore + public Optional getUnavailableReason() { + if (unavailableReason == null) { + return Optional.empty(); + } + return unavailableReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_reference") + private Optional _getAccountReference() { + return accountReference; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bank_verification_state") + private Optional _getBankVerificationState() { + return bankVerificationState; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("estimated_arrival") + private Optional _getEstimatedArrival() { + return estimatedArrival; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fee_structure") + private Optional _getFeeStructure() { + return feeStructure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("institution_name") + private Optional _getInstitutionName() { + return institutionName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_paid_out_at") + private Optional _getLastPaidOutAt() { + return lastPaidOutAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("nickname") + private Optional _getNickname() { + return nickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("quote") + private Optional _getQuote() { + return quote; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status_reason") + private Optional _getStatusReason() { + return statusReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("supported_payout_method") + private Optional _getSupportedPayoutMethod() { + return supportedPayoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("unavailable_reason") + private Optional _getUnavailableReason() { + return unavailableReason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPayoutMethodCreatedPayloadData + && equalTo((PostPayoutMethodCreatedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPayoutMethodCreatedPayloadData other) { + return accountReference.equals(other.accountReference) + && bankVerificationState.equals(other.bankVerificationState) + && createdAt.equals(other.createdAt) + && destinationCurrency.equals(other.destinationCurrency) + && estimatedArrival.equals(other.estimatedArrival) + && feeStructure.equals(other.feeStructure) + && id.equals(other.id) + && institutionName.equals(other.institutionName) + && isClone == other.isClone + && isDefault == other.isDefault + && lastPaidOutAt.equals(other.lastPaidOutAt) + && linkedViaPlaid == other.linkedViaPlaid + && needsPlaidReconnect == other.needsPlaidReconnect + && nickname.equals(other.nickname) + && object.equals(other.object) + && payerName.equals(other.payerName) + && quote.equals(other.quote) + && status.equals(other.status) + && statusReason.equals(other.statusReason) + && supportedPayoutMethod.equals(other.supportedPayoutMethod) + && unavailableReason.equals(other.unavailableReason); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountReference, + this.bankVerificationState, + this.createdAt, + this.destinationCurrency, + this.estimatedArrival, + this.feeStructure, + this.id, + this.institutionName, + this.isClone, + this.isDefault, + this.lastPaidOutAt, + this.linkedViaPlaid, + this.needsPlaidReconnect, + this.nickname, + this.object, + this.payerName, + this.quote, + this.status, + this.statusReason, + this.supportedPayoutMethod, + this.unavailableReason); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the payout method was added.

+ */ + DestinationCurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PostPayoutMethodCreatedPayloadData other); + } + + public interface DestinationCurrencyStage { + /** + *

Currency payouts are delivered in for this method.

+ */ + IdStage destinationCurrency(@NotNull String destinationCurrency); + } + + public interface IdStage { + /** + *

Payout method ID.

+ */ + IsCloneStage id(@NotNull String id); + } + + public interface IsCloneStage { + /** + *

Whether this method is a copy of one saved on another of the payer's accounts.

+ */ + IsDefaultStage isClone(boolean isClone); + } + + public interface IsDefaultStage { + /** + *

Whether this is the default payout method for the account.

+ */ + LinkedViaPlaidStage isDefault(boolean isDefault); + } + + public interface LinkedViaPlaidStage { + /** + *

Whether the payer added this method by signing in to their bank rather than typing account details.

+ */ + NeedsPlaidReconnectStage linkedViaPlaid(boolean linkedViaPlaid); + } + + public interface NeedsPlaidReconnectStage { + /** + *

Whether the bank sign-in behind this method has expired and must be redone before it counts as linked.

+ */ + ObjectStage needsPlaidReconnect(boolean needsPlaidReconnect); + } + + public interface ObjectStage { + StatusStage object(@NotNull PostPayoutMethodCreatedPayloadDataObject object); + } + + public interface StatusStage { + /** + *

Lifecycle status: created means saved but unused, active means a payout succeeded through it, broken means a payout failure disabled it; a later successful payout returns it to active.

+ */ + _FinalStage status(@NotNull PostPayoutMethodCreatedPayloadDataStatus status); + } + + public interface _FinalStage { + PostPayoutMethodCreatedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Masked identifier for the destination, such as the last four digits of a bank account.

+ */ + _FinalStage accountReference(Optional accountReference); + + _FinalStage accountReference(String accountReference); + + _FinalStage accountReference(Nullable accountReference); + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ */ + _FinalStage bankVerificationState( + Optional bankVerificationState); + + _FinalStage bankVerificationState( + PostPayoutMethodCreatedPayloadDataBankVerificationState bankVerificationState); + + _FinalStage bankVerificationState( + Nullable bankVerificationState); + + /** + *

Estimated arrival times before an amount-specific quote is requested. Null when the method is not currently eligible.

+ */ + _FinalStage estimatedArrival(Optional estimatedArrival); + + _FinalStage estimatedArrival(PostPayoutMethodCreatedPayloadDataEstimatedArrival estimatedArrival); + + _FinalStage estimatedArrival(Nullable estimatedArrival); + + /** + *

Configured fee terms for this payout method. Null when the method is not currently eligible. An amount-specific quote remains authoritative.

+ */ + _FinalStage feeStructure(Optional feeStructure); + + _FinalStage feeStructure(PostPayoutMethodCreatedPayloadDataFeeStructure feeStructure); + + _FinalStage feeStructure(Nullable feeStructure); + + /** + *

Name of the bank or institution receiving payouts.

+ */ + _FinalStage institutionName(Optional institutionName); + + _FinalStage institutionName(String institutionName); + + _FinalStage institutionName(Nullable institutionName); + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ */ + _FinalStage lastPaidOutAt(Optional lastPaidOutAt); + + _FinalStage lastPaidOutAt(OffsetDateTime lastPaidOutAt); + + _FinalStage lastPaidOutAt(Nullable lastPaidOutAt); + + /** + *

User-defined label for the payout method.

+ */ + _FinalStage nickname(Optional nickname); + + _FinalStage nickname(String nickname); + + _FinalStage nickname(Nullable nickname); + + /** + *

Display name of the payout rail, such as ACH Bank Deposit.

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + + /** + *

Fee and delivery estimate for withdrawing the requested amount through this method. Null unless an amount was provided, or when the estimate is unavailable.

+ */ + _FinalStage quote(Optional quote); + + _FinalStage quote(PostPayoutMethodCreatedPayloadDataQuote quote); + + _FinalStage quote(Nullable quote); + + /** + *

Machine-readable code for why the method is broken — the newest disabling failure recorded through it, whether a payout error or a pre-payout rejection. null unless the method is broken, or when it was disabled without a recorded failure.

+ */ + _FinalStage statusReason(Optional statusReason); + + _FinalStage statusReason(String statusReason); + + _FinalStage statusReason(Nullable statusReason); + + /** + *

The supported payout method this saved method was created from.

+ */ + _FinalStage supportedPayoutMethod( + Optional supportedPayoutMethod); + + _FinalStage supportedPayoutMethod( + PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod supportedPayoutMethod); + + _FinalStage supportedPayoutMethod( + Nullable supportedPayoutMethod); + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ */ + _FinalStage unavailableReason(Optional unavailableReason); + + _FinalStage unavailableReason(PostPayoutMethodCreatedPayloadDataUnavailableReason unavailableReason); + + _FinalStage unavailableReason(Nullable unavailableReason); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + DestinationCurrencyStage, + IdStage, + IsCloneStage, + IsDefaultStage, + LinkedViaPlaidStage, + NeedsPlaidReconnectStage, + ObjectStage, + StatusStage, + _FinalStage { + private OffsetDateTime createdAt; + + private String destinationCurrency; + + private String id; + + private boolean isClone; + + private boolean isDefault; + + private boolean linkedViaPlaid; + + private boolean needsPlaidReconnect; + + private PostPayoutMethodCreatedPayloadDataObject object; + + private PostPayoutMethodCreatedPayloadDataStatus status; + + private Optional unavailableReason = Optional.empty(); + + private Optional supportedPayoutMethod = + Optional.empty(); + + private Optional statusReason = Optional.empty(); + + private Optional quote = Optional.empty(); + + private Optional payerName = Optional.empty(); + + private Optional nickname = Optional.empty(); + + private Optional lastPaidOutAt = Optional.empty(); + + private Optional institutionName = Optional.empty(); + + private Optional feeStructure = Optional.empty(); + + private Optional estimatedArrival = Optional.empty(); + + private Optional bankVerificationState = + Optional.empty(); + + private Optional accountReference = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostPayoutMethodCreatedPayloadData other) { + accountReference(other.getAccountReference()); + bankVerificationState(other.getBankVerificationState()); + createdAt(other.getCreatedAt()); + destinationCurrency(other.getDestinationCurrency()); + estimatedArrival(other.getEstimatedArrival()); + feeStructure(other.getFeeStructure()); + id(other.getId()); + institutionName(other.getInstitutionName()); + isClone(other.getIsClone()); + isDefault(other.getIsDefault()); + lastPaidOutAt(other.getLastPaidOutAt()); + linkedViaPlaid(other.getLinkedViaPlaid()); + needsPlaidReconnect(other.getNeedsPlaidReconnect()); + nickname(other.getNickname()); + object(other.getObject()); + payerName(other.getPayerName()); + quote(other.getQuote()); + status(other.getStatus()); + statusReason(other.getStatusReason()); + supportedPayoutMethod(other.getSupportedPayoutMethod()); + unavailableReason(other.getUnavailableReason()); + return this; + } + + /** + *

When the payout method was added.

+ *

When the payout method was added.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public DestinationCurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Currency payouts are delivered in for this method.

+ *

Currency payouts are delivered in for this method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination_currency") + public IdStage destinationCurrency(@NotNull String destinationCurrency) { + this.destinationCurrency = + Objects.requireNonNull(destinationCurrency, "destinationCurrency must not be null"); + return this; + } + + /** + *

Payout method ID.

+ *

Payout method ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsCloneStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether this method is a copy of one saved on another of the payer's accounts.

+ *

Whether this method is a copy of one saved on another of the payer's accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_clone") + public IsDefaultStage isClone(boolean isClone) { + this.isClone = isClone; + return this; + } + + /** + *

Whether this is the default payout method for the account.

+ *

Whether this is the default payout method for the account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_default") + public LinkedViaPlaidStage isDefault(boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + /** + *

Whether the payer added this method by signing in to their bank rather than typing account details.

+ *

Whether the payer added this method by signing in to their bank rather than typing account details.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("linked_via_plaid") + public NeedsPlaidReconnectStage linkedViaPlaid(boolean linkedViaPlaid) { + this.linkedViaPlaid = linkedViaPlaid; + return this; + } + + /** + *

Whether the bank sign-in behind this method has expired and must be redone before it counts as linked.

+ *

Whether the bank sign-in behind this method has expired and must be redone before it counts as linked.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("needs_plaid_reconnect") + public ObjectStage needsPlaidReconnect(boolean needsPlaidReconnect) { + this.needsPlaidReconnect = needsPlaidReconnect; + return this; + } + + @java.lang.Override + @JsonSetter("object") + public StatusStage object(@NotNull PostPayoutMethodCreatedPayloadDataObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Lifecycle status: created means saved but unused, active means a payout succeeded through it, broken means a payout failure disabled it; a later successful payout returns it to active.

+ *

Lifecycle status: created means saved but unused, active means a payout succeeded through it, broken means a payout failure disabled it; a later successful payout returns it to active.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull PostPayoutMethodCreatedPayloadDataStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage unavailableReason( + Nullable unavailableReason) { + if (unavailableReason.isNull()) { + this.unavailableReason = null; + } else if (unavailableReason.isEmpty()) { + this.unavailableReason = Optional.empty(); + } else { + this.unavailableReason = Optional.of(unavailableReason.get()); + } + return this; + } + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage unavailableReason(PostPayoutMethodCreatedPayloadDataUnavailableReason unavailableReason) { + this.unavailableReason = Optional.ofNullable(unavailableReason); + return this; + } + + /** + *

Why this method is unavailable: destination_retired means the payout provider stopped offering the destination. Whop may automatically remap an eligible method that was not linked through Plaid to a compatible replacement; otherwise, the account owner must re-add it. null means no unavailability reason is known.

+ */ + @java.lang.Override + @JsonSetter(value = "unavailable_reason", nulls = Nulls.SKIP) + public _FinalStage unavailableReason( + Optional unavailableReason) { + this.unavailableReason = unavailableReason; + return this; + } + + /** + *

The supported payout method this saved method was created from.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage supportedPayoutMethod( + Nullable supportedPayoutMethod) { + if (supportedPayoutMethod.isNull()) { + this.supportedPayoutMethod = null; + } else if (supportedPayoutMethod.isEmpty()) { + this.supportedPayoutMethod = Optional.empty(); + } else { + this.supportedPayoutMethod = Optional.of(supportedPayoutMethod.get()); + } + return this; + } + + /** + *

The supported payout method this saved method was created from.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage supportedPayoutMethod( + PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod supportedPayoutMethod) { + this.supportedPayoutMethod = Optional.ofNullable(supportedPayoutMethod); + return this; + } + + /** + *

The supported payout method this saved method was created from.

+ */ + @java.lang.Override + @JsonSetter(value = "supported_payout_method", nulls = Nulls.SKIP) + public _FinalStage supportedPayoutMethod( + Optional supportedPayoutMethod) { + this.supportedPayoutMethod = supportedPayoutMethod; + return this; + } + + /** + *

Machine-readable code for why the method is broken — the newest disabling failure recorded through it, whether a payout error or a pre-payout rejection. null unless the method is broken, or when it was disabled without a recorded failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statusReason(Nullable statusReason) { + if (statusReason.isNull()) { + this.statusReason = null; + } else if (statusReason.isEmpty()) { + this.statusReason = Optional.empty(); + } else { + this.statusReason = Optional.of(statusReason.get()); + } + return this; + } + + /** + *

Machine-readable code for why the method is broken — the newest disabling failure recorded through it, whether a payout error or a pre-payout rejection. null unless the method is broken, or when it was disabled without a recorded failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statusReason(String statusReason) { + this.statusReason = Optional.ofNullable(statusReason); + return this; + } + + /** + *

Machine-readable code for why the method is broken — the newest disabling failure recorded through it, whether a payout error or a pre-payout rejection. null unless the method is broken, or when it was disabled without a recorded failure.

+ */ + @java.lang.Override + @JsonSetter(value = "status_reason", nulls = Nulls.SKIP) + public _FinalStage statusReason(Optional statusReason) { + this.statusReason = statusReason; + return this; + } + + /** + *

Fee and delivery estimate for withdrawing the requested amount through this method. Null unless an amount was provided, or when the estimate is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quote(Nullable quote) { + if (quote.isNull()) { + this.quote = null; + } else if (quote.isEmpty()) { + this.quote = Optional.empty(); + } else { + this.quote = Optional.of(quote.get()); + } + return this; + } + + /** + *

Fee and delivery estimate for withdrawing the requested amount through this method. Null unless an amount was provided, or when the estimate is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage quote(PostPayoutMethodCreatedPayloadDataQuote quote) { + this.quote = Optional.ofNullable(quote); + return this; + } + + /** + *

Fee and delivery estimate for withdrawing the requested amount through this method. Null unless an amount was provided, or when the estimate is unavailable.

+ */ + @java.lang.Override + @JsonSetter(value = "quote", nulls = Nulls.SKIP) + public _FinalStage quote(Optional quote) { + this.quote = quote; + return this; + } + + /** + *

Display name of the payout rail, such as ACH Bank Deposit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

Display name of the payout rail, such as ACH Bank Deposit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

Display name of the payout rail, such as ACH Bank Deposit.

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

User-defined label for the payout method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(Nullable nickname) { + if (nickname.isNull()) { + this.nickname = null; + } else if (nickname.isEmpty()) { + this.nickname = Optional.empty(); + } else { + this.nickname = Optional.of(nickname.get()); + } + return this; + } + + /** + *

User-defined label for the payout method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(String nickname) { + this.nickname = Optional.ofNullable(nickname); + return this; + } + + /** + *

User-defined label for the payout method.

+ */ + @java.lang.Override + @JsonSetter(value = "nickname", nulls = Nulls.SKIP) + public _FinalStage nickname(Optional nickname) { + this.nickname = nickname; + return this; + } + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaidOutAt(Nullable lastPaidOutAt) { + if (lastPaidOutAt.isNull()) { + this.lastPaidOutAt = null; + } else if (lastPaidOutAt.isEmpty()) { + this.lastPaidOutAt = Optional.empty(); + } else { + this.lastPaidOutAt = Optional.of(lastPaidOutAt.get()); + } + return this; + } + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaidOutAt(OffsetDateTime lastPaidOutAt) { + this.lastPaidOutAt = Optional.ofNullable(lastPaidOutAt); + return this; + } + + /** + *

When the most recent completed payout was delivered to this method, as an ISO 8601 timestamp. null when nothing has been paid out to it yet.

+ */ + @java.lang.Override + @JsonSetter(value = "last_paid_out_at", nulls = Nulls.SKIP) + public _FinalStage lastPaidOutAt(Optional lastPaidOutAt) { + this.lastPaidOutAt = lastPaidOutAt; + return this; + } + + /** + *

Name of the bank or institution receiving payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage institutionName(Nullable institutionName) { + if (institutionName.isNull()) { + this.institutionName = null; + } else if (institutionName.isEmpty()) { + this.institutionName = Optional.empty(); + } else { + this.institutionName = Optional.of(institutionName.get()); + } + return this; + } + + /** + *

Name of the bank or institution receiving payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage institutionName(String institutionName) { + this.institutionName = Optional.ofNullable(institutionName); + return this; + } + + /** + *

Name of the bank or institution receiving payouts.

+ */ + @java.lang.Override + @JsonSetter(value = "institution_name", nulls = Nulls.SKIP) + public _FinalStage institutionName(Optional institutionName) { + this.institutionName = institutionName; + return this; + } + + /** + *

Configured fee terms for this payout method. Null when the method is not currently eligible. An amount-specific quote remains authoritative.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeStructure(Nullable feeStructure) { + if (feeStructure.isNull()) { + this.feeStructure = null; + } else if (feeStructure.isEmpty()) { + this.feeStructure = Optional.empty(); + } else { + this.feeStructure = Optional.of(feeStructure.get()); + } + return this; + } + + /** + *

Configured fee terms for this payout method. Null when the method is not currently eligible. An amount-specific quote remains authoritative.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeStructure(PostPayoutMethodCreatedPayloadDataFeeStructure feeStructure) { + this.feeStructure = Optional.ofNullable(feeStructure); + return this; + } + + /** + *

Configured fee terms for this payout method. Null when the method is not currently eligible. An amount-specific quote remains authoritative.

+ */ + @java.lang.Override + @JsonSetter(value = "fee_structure", nulls = Nulls.SKIP) + public _FinalStage feeStructure(Optional feeStructure) { + this.feeStructure = feeStructure; + return this; + } + + /** + *

Estimated arrival times before an amount-specific quote is requested. Null when the method is not currently eligible.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival( + Nullable estimatedArrival) { + if (estimatedArrival.isNull()) { + this.estimatedArrival = null; + } else if (estimatedArrival.isEmpty()) { + this.estimatedArrival = Optional.empty(); + } else { + this.estimatedArrival = Optional.of(estimatedArrival.get()); + } + return this; + } + + /** + *

Estimated arrival times before an amount-specific quote is requested. Null when the method is not currently eligible.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(PostPayoutMethodCreatedPayloadDataEstimatedArrival estimatedArrival) { + this.estimatedArrival = Optional.ofNullable(estimatedArrival); + return this; + } + + /** + *

Estimated arrival times before an amount-specific quote is requested. Null when the method is not currently eligible.

+ */ + @java.lang.Override + @JsonSetter(value = "estimated_arrival", nulls = Nulls.SKIP) + public _FinalStage estimatedArrival( + Optional estimatedArrival) { + this.estimatedArrival = estimatedArrival; + return this; + } + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bankVerificationState( + Nullable bankVerificationState) { + if (bankVerificationState.isNull()) { + this.bankVerificationState = null; + } else if (bankVerificationState.isEmpty()) { + this.bankVerificationState = Optional.empty(); + } else { + this.bankVerificationState = Optional.of(bankVerificationState.get()); + } + return this; + } + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bankVerificationState( + PostPayoutMethodCreatedPayloadDataBankVerificationState bankVerificationState) { + this.bankVerificationState = Optional.ofNullable(bankVerificationState); + return this; + } + + /** + *

Lifecycle trust state: checking (verification still running), verified (bank confirmed ownership or a payout already completed to it), no_data (verification unavailable or bank returned no ownership data), warning (bank could not confirm the destination's owner), broken (payouts failed with a permanent account error), null (never checked).

+ */ + @java.lang.Override + @JsonSetter(value = "bank_verification_state", nulls = Nulls.SKIP) + public _FinalStage bankVerificationState( + Optional bankVerificationState) { + this.bankVerificationState = bankVerificationState; + return this; + } + + /** + *

Masked identifier for the destination, such as the last four digits of a bank account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountReference(Nullable accountReference) { + if (accountReference.isNull()) { + this.accountReference = null; + } else if (accountReference.isEmpty()) { + this.accountReference = Optional.empty(); + } else { + this.accountReference = Optional.of(accountReference.get()); + } + return this; + } + + /** + *

Masked identifier for the destination, such as the last four digits of a bank account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountReference(String accountReference) { + this.accountReference = Optional.ofNullable(accountReference); + return this; + } + + /** + *

Masked identifier for the destination, such as the last four digits of a bank account.

+ */ + @java.lang.Override + @JsonSetter(value = "account_reference", nulls = Nulls.SKIP) + public _FinalStage accountReference(Optional accountReference) { + this.accountReference = accountReference; + return this; + } + + @java.lang.Override + public PostPayoutMethodCreatedPayloadData build() { + return new PostPayoutMethodCreatedPayloadData( + accountReference, + bankVerificationState, + createdAt, + destinationCurrency, + estimatedArrival, + feeStructure, + id, + institutionName, + isClone, + isDefault, + lastPaidOutAt, + linkedViaPlaid, + needsPlaidReconnect, + nickname, + object, + payerName, + quote, + status, + statusReason, + supportedPayoutMethod, + unavailableReason, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataBankVerificationState.java b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataBankVerificationState.java new file mode 100644 index 00000000..dd7bef85 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataBankVerificationState.java @@ -0,0 +1,120 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPayoutMethodCreatedPayloadDataBankVerificationState { + public static final PostPayoutMethodCreatedPayloadDataBankVerificationState NO_DATA = + new PostPayoutMethodCreatedPayloadDataBankVerificationState(Value.NO_DATA, "no_data"); + + public static final PostPayoutMethodCreatedPayloadDataBankVerificationState CHECKING = + new PostPayoutMethodCreatedPayloadDataBankVerificationState(Value.CHECKING, "checking"); + + public static final PostPayoutMethodCreatedPayloadDataBankVerificationState WARNING = + new PostPayoutMethodCreatedPayloadDataBankVerificationState(Value.WARNING, "warning"); + + public static final PostPayoutMethodCreatedPayloadDataBankVerificationState VERIFIED = + new PostPayoutMethodCreatedPayloadDataBankVerificationState(Value.VERIFIED, "verified"); + + public static final PostPayoutMethodCreatedPayloadDataBankVerificationState BROKEN = + new PostPayoutMethodCreatedPayloadDataBankVerificationState(Value.BROKEN, "broken"); + + private final Value value; + + private final String string; + + PostPayoutMethodCreatedPayloadDataBankVerificationState(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPayoutMethodCreatedPayloadDataBankVerificationState + && this.string.equals( + ((PostPayoutMethodCreatedPayloadDataBankVerificationState) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NO_DATA: + return visitor.visitNoData(); + case CHECKING: + return visitor.visitChecking(); + case WARNING: + return visitor.visitWarning(); + case VERIFIED: + return visitor.visitVerified(); + case BROKEN: + return visitor.visitBroken(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPayoutMethodCreatedPayloadDataBankVerificationState valueOf(String value) { + switch (value) { + case "no_data": + return NO_DATA; + case "checking": + return CHECKING; + case "warning": + return WARNING; + case "verified": + return VERIFIED; + case "broken": + return BROKEN; + default: + return new PostPayoutMethodCreatedPayloadDataBankVerificationState(Value.UNKNOWN, value); + } + } + + public enum Value { + CHECKING, + + VERIFIED, + + NO_DATA, + + WARNING, + + BROKEN, + + UNKNOWN + } + + public interface Visitor { + T visitChecking(); + + T visitVerified(); + + T visitNoData(); + + T visitWarning(); + + T visitBroken(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataEstimatedArrival.java b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataEstimatedArrival.java new file mode 100644 index 00000000..47de28d0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataEstimatedArrival.java @@ -0,0 +1,187 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPayoutMethodCreatedPayloadDataEstimatedArrival.Builder.class) +public final class PostPayoutMethodCreatedPayloadDataEstimatedArrival { + private final Optional instant; + + private final Optional standard; + + private final Map additionalProperties; + + private PostPayoutMethodCreatedPayloadDataEstimatedArrival( + Optional instant, + Optional standard, + Map additionalProperties) { + this.instant = instant; + this.standard = standard; + this.additionalProperties = additionalProperties; + } + + /** + * @return Estimated instant-delivery arrival, or null when unavailable. + */ + @JsonIgnore + public Optional getInstant() { + if (instant == null) { + return Optional.empty(); + } + return instant; + } + + /** + * @return Estimated standard-delivery arrival, or null when unavailable. + */ + @JsonIgnore + public Optional getStandard() { + if (standard == null) { + return Optional.empty(); + } + return standard; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("instant") + private Optional _getInstant() { + return instant; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("standard") + private Optional _getStandard() { + return standard; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPayoutMethodCreatedPayloadDataEstimatedArrival + && equalTo((PostPayoutMethodCreatedPayloadDataEstimatedArrival) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPayoutMethodCreatedPayloadDataEstimatedArrival other) { + return instant.equals(other.instant) && standard.equals(other.standard); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.instant, this.standard); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional instant = Optional.empty(); + + private Optional standard = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PostPayoutMethodCreatedPayloadDataEstimatedArrival other) { + instant(other.getInstant()); + standard(other.getStandard()); + return this; + } + + /** + *

Estimated instant-delivery arrival, or null when unavailable.

+ */ + @JsonSetter(value = "instant", nulls = Nulls.SKIP) + public Builder instant(Optional instant) { + this.instant = instant; + return this; + } + + public Builder instant(OffsetDateTime instant) { + this.instant = Optional.ofNullable(instant); + return this; + } + + public Builder instant(Nullable instant) { + if (instant.isNull()) { + this.instant = null; + } else if (instant.isEmpty()) { + this.instant = Optional.empty(); + } else { + this.instant = Optional.of(instant.get()); + } + return this; + } + + /** + *

Estimated standard-delivery arrival, or null when unavailable.

+ */ + @JsonSetter(value = "standard", nulls = Nulls.SKIP) + public Builder standard(Optional standard) { + this.standard = standard; + return this; + } + + public Builder standard(OffsetDateTime standard) { + this.standard = Optional.ofNullable(standard); + return this; + } + + public Builder standard(Nullable standard) { + if (standard.isNull()) { + this.standard = null; + } else if (standard.isEmpty()) { + this.standard = Optional.empty(); + } else { + this.standard = Optional.of(standard.get()); + } + return this; + } + + public PostPayoutMethodCreatedPayloadDataEstimatedArrival build() { + return new PostPayoutMethodCreatedPayloadDataEstimatedArrival(instant, standard, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataFeeStructure.java b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataFeeStructure.java new file mode 100644 index 00000000..bce8b144 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataFeeStructure.java @@ -0,0 +1,198 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPayoutMethodCreatedPayloadDataFeeStructure.Builder.class) +public final class PostPayoutMethodCreatedPayloadDataFeeStructure { + private final String currency; + + private final float fixedAmount; + + private final float percentage; + + private final Map additionalProperties; + + private PostPayoutMethodCreatedPayloadDataFeeStructure( + String currency, float fixedAmount, float percentage, Map additionalProperties) { + this.currency = currency; + this.fixedAmount = fixedAmount; + this.percentage = percentage; + this.additionalProperties = additionalProperties; + } + + /** + * @return Currency code of fixed_amount. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Fixed fee charged, denominated in currency. + */ + @JsonProperty("fixed_amount") + public float getFixedAmount() { + return fixedAmount; + } + + /** + * @return Percentage of the withdrawal amount charged as a fee. + */ + @JsonProperty("percentage") + public float getPercentage() { + return percentage; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPayoutMethodCreatedPayloadDataFeeStructure + && equalTo((PostPayoutMethodCreatedPayloadDataFeeStructure) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPayoutMethodCreatedPayloadDataFeeStructure other) { + return currency.equals(other.currency) && fixedAmount == other.fixedAmount && percentage == other.percentage; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.fixedAmount, this.percentage); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + /** + *

Currency code of fixed_amount.

+ */ + FixedAmountStage currency(@NotNull String currency); + + Builder from(PostPayoutMethodCreatedPayloadDataFeeStructure other); + } + + public interface FixedAmountStage { + /** + *

Fixed fee charged, denominated in currency.

+ */ + PercentageStage fixedAmount(float fixedAmount); + } + + public interface PercentageStage { + /** + *

Percentage of the withdrawal amount charged as a fee.

+ */ + _FinalStage percentage(float percentage); + } + + public interface _FinalStage { + PostPayoutMethodCreatedPayloadDataFeeStructure build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, FixedAmountStage, PercentageStage, _FinalStage { + private String currency; + + private float fixedAmount; + + private float percentage; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostPayoutMethodCreatedPayloadDataFeeStructure other) { + currency(other.getCurrency()); + fixedAmount(other.getFixedAmount()); + percentage(other.getPercentage()); + return this; + } + + /** + *

Currency code of fixed_amount.

+ *

Currency code of fixed_amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public FixedAmountStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Fixed fee charged, denominated in currency.

+ *

Fixed fee charged, denominated in currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fixed_amount") + public PercentageStage fixedAmount(float fixedAmount) { + this.fixedAmount = fixedAmount; + return this; + } + + /** + *

Percentage of the withdrawal amount charged as a fee.

+ *

Percentage of the withdrawal amount charged as a fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("percentage") + public _FinalStage percentage(float percentage) { + this.percentage = percentage; + return this; + } + + @java.lang.Override + public PostPayoutMethodCreatedPayloadDataFeeStructure build() { + return new PostPayoutMethodCreatedPayloadDataFeeStructure( + currency, fixedAmount, percentage, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataObject.java b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataObject.java new file mode 100644 index 00000000..27630d09 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPayoutMethodCreatedPayloadDataObject { + public static final PostPayoutMethodCreatedPayloadDataObject PAYOUT_METHOD = + new PostPayoutMethodCreatedPayloadDataObject(Value.PAYOUT_METHOD, "payout_method"); + + private final Value value; + + private final String string; + + PostPayoutMethodCreatedPayloadDataObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPayoutMethodCreatedPayloadDataObject + && this.string.equals(((PostPayoutMethodCreatedPayloadDataObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYOUT_METHOD: + return visitor.visitPayoutMethod(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPayoutMethodCreatedPayloadDataObject valueOf(String value) { + switch (value) { + case "payout_method": + return PAYOUT_METHOD; + default: + return new PostPayoutMethodCreatedPayloadDataObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYOUT_METHOD, + + UNKNOWN + } + + public interface Visitor { + T visitPayoutMethod(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataQuote.java b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataQuote.java new file mode 100644 index 00000000..2acb916d --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataQuote.java @@ -0,0 +1,461 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPayoutMethodCreatedPayloadDataQuote.Builder.class) +public final class PostPayoutMethodCreatedPayloadDataQuote { + private final float amount; + + private final String currency; + + private final float exchangeRate; + + private final Optional instant; + + private final Optional maxLimit; + + private final float minLimit; + + private final Optional standard; + + private final Map additionalProperties; + + private PostPayoutMethodCreatedPayloadDataQuote( + float amount, + String currency, + float exchangeRate, + Optional instant, + Optional maxLimit, + float minLimit, + Optional standard, + Map additionalProperties) { + this.amount = amount; + this.currency = currency; + this.exchangeRate = exchangeRate; + this.instant = instant; + this.maxLimit = maxLimit; + this.minLimit = minLimit; + this.standard = standard; + this.additionalProperties = additionalProperties; + } + + /** + * @return The withdrawal amount the quote is for. + */ + @JsonProperty("amount") + public float getAmount() { + return amount; + } + + /** + * @return Currency of the quoted amount. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Exchange rate from the withdrawal currency to the destination currency. + */ + @JsonProperty("exchange_rate") + public float getExchangeRate() { + return exchangeRate; + } + + /** + * @return Instant-delivery estimate. Null if the method does not support instant delivery, instant delivery is unavailable for the account, or the amount does not cover the fee. + */ + @JsonIgnore + public Optional getInstant() { + if (instant == null) { + return Optional.empty(); + } + return instant; + } + + /** + * @return Maximum withdrawal amount for this method, in the withdrawal currency. + */ + @JsonIgnore + public Optional getMaxLimit() { + if (maxLimit == null) { + return Optional.empty(); + } + return maxLimit; + } + + /** + * @return Minimum withdrawal amount for this method, in the withdrawal currency. + */ + @JsonProperty("min_limit") + public float getMinLimit() { + return minLimit; + } + + /** + * @return Standard-delivery estimate. Null if the method does not support standard delivery, or the amount does not cover the fee. + */ + @JsonIgnore + public Optional getStandard() { + if (standard == null) { + return Optional.empty(); + } + return standard; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("instant") + private Optional _getInstant() { + return instant; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("max_limit") + private Optional _getMaxLimit() { + return maxLimit; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("standard") + private Optional _getStandard() { + return standard; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPayoutMethodCreatedPayloadDataQuote + && equalTo((PostPayoutMethodCreatedPayloadDataQuote) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPayoutMethodCreatedPayloadDataQuote other) { + return amount == other.amount + && currency.equals(other.currency) + && exchangeRate == other.exchangeRate + && instant.equals(other.instant) + && maxLimit.equals(other.maxLimit) + && minLimit == other.minLimit + && standard.equals(other.standard); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.currency, + this.exchangeRate, + this.instant, + this.maxLimit, + this.minLimit, + this.standard); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The withdrawal amount the quote is for.

+ */ + CurrencyStage amount(float amount); + + Builder from(PostPayoutMethodCreatedPayloadDataQuote other); + } + + public interface CurrencyStage { + /** + *

Currency of the quoted amount.

+ */ + ExchangeRateStage currency(@NotNull String currency); + } + + public interface ExchangeRateStage { + /** + *

Exchange rate from the withdrawal currency to the destination currency.

+ */ + MinLimitStage exchangeRate(float exchangeRate); + } + + public interface MinLimitStage { + /** + *

Minimum withdrawal amount for this method, in the withdrawal currency.

+ */ + _FinalStage minLimit(float minLimit); + } + + public interface _FinalStage { + PostPayoutMethodCreatedPayloadDataQuote build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Instant-delivery estimate. Null if the method does not support instant delivery, instant delivery is unavailable for the account, or the amount does not cover the fee.

+ */ + _FinalStage instant(Optional instant); + + _FinalStage instant(PostPayoutMethodCreatedPayloadDataQuoteInstant instant); + + _FinalStage instant(Nullable instant); + + /** + *

Maximum withdrawal amount for this method, in the withdrawal currency.

+ */ + _FinalStage maxLimit(Optional maxLimit); + + _FinalStage maxLimit(Float maxLimit); + + _FinalStage maxLimit(Nullable maxLimit); + + /** + *

Standard-delivery estimate. Null if the method does not support standard delivery, or the amount does not cover the fee.

+ */ + _FinalStage standard(Optional standard); + + _FinalStage standard(PostPayoutMethodCreatedPayloadDataQuoteStandard standard); + + _FinalStage standard(Nullable standard); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, CurrencyStage, ExchangeRateStage, MinLimitStage, _FinalStage { + private float amount; + + private String currency; + + private float exchangeRate; + + private float minLimit; + + private Optional standard = Optional.empty(); + + private Optional maxLimit = Optional.empty(); + + private Optional instant = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostPayoutMethodCreatedPayloadDataQuote other) { + amount(other.getAmount()); + currency(other.getCurrency()); + exchangeRate(other.getExchangeRate()); + instant(other.getInstant()); + maxLimit(other.getMaxLimit()); + minLimit(other.getMinLimit()); + standard(other.getStandard()); + return this; + } + + /** + *

The withdrawal amount the quote is for.

+ *

The withdrawal amount the quote is for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CurrencyStage amount(float amount) { + this.amount = amount; + return this; + } + + /** + *

Currency of the quoted amount.

+ *

Currency of the quoted amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public ExchangeRateStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Exchange rate from the withdrawal currency to the destination currency.

+ *

Exchange rate from the withdrawal currency to the destination currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("exchange_rate") + public MinLimitStage exchangeRate(float exchangeRate) { + this.exchangeRate = exchangeRate; + return this; + } + + /** + *

Minimum withdrawal amount for this method, in the withdrawal currency.

+ *

Minimum withdrawal amount for this method, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("min_limit") + public _FinalStage minLimit(float minLimit) { + this.minLimit = minLimit; + return this; + } + + /** + *

Standard-delivery estimate. Null if the method does not support standard delivery, or the amount does not cover the fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage standard(Nullable standard) { + if (standard.isNull()) { + this.standard = null; + } else if (standard.isEmpty()) { + this.standard = Optional.empty(); + } else { + this.standard = Optional.of(standard.get()); + } + return this; + } + + /** + *

Standard-delivery estimate. Null if the method does not support standard delivery, or the amount does not cover the fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage standard(PostPayoutMethodCreatedPayloadDataQuoteStandard standard) { + this.standard = Optional.ofNullable(standard); + return this; + } + + /** + *

Standard-delivery estimate. Null if the method does not support standard delivery, or the amount does not cover the fee.

+ */ + @java.lang.Override + @JsonSetter(value = "standard", nulls = Nulls.SKIP) + public _FinalStage standard(Optional standard) { + this.standard = standard; + return this; + } + + /** + *

Maximum withdrawal amount for this method, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxLimit(Nullable maxLimit) { + if (maxLimit.isNull()) { + this.maxLimit = null; + } else if (maxLimit.isEmpty()) { + this.maxLimit = Optional.empty(); + } else { + this.maxLimit = Optional.of(maxLimit.get()); + } + return this; + } + + /** + *

Maximum withdrawal amount for this method, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxLimit(Float maxLimit) { + this.maxLimit = Optional.ofNullable(maxLimit); + return this; + } + + /** + *

Maximum withdrawal amount for this method, in the withdrawal currency.

+ */ + @java.lang.Override + @JsonSetter(value = "max_limit", nulls = Nulls.SKIP) + public _FinalStage maxLimit(Optional maxLimit) { + this.maxLimit = maxLimit; + return this; + } + + /** + *

Instant-delivery estimate. Null if the method does not support instant delivery, instant delivery is unavailable for the account, or the amount does not cover the fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage instant(Nullable instant) { + if (instant.isNull()) { + this.instant = null; + } else if (instant.isEmpty()) { + this.instant = Optional.empty(); + } else { + this.instant = Optional.of(instant.get()); + } + return this; + } + + /** + *

Instant-delivery estimate. Null if the method does not support instant delivery, instant delivery is unavailable for the account, or the amount does not cover the fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage instant(PostPayoutMethodCreatedPayloadDataQuoteInstant instant) { + this.instant = Optional.ofNullable(instant); + return this; + } + + /** + *

Instant-delivery estimate. Null if the method does not support instant delivery, instant delivery is unavailable for the account, or the amount does not cover the fee.

+ */ + @java.lang.Override + @JsonSetter(value = "instant", nulls = Nulls.SKIP) + public _FinalStage instant(Optional instant) { + this.instant = instant; + return this; + } + + @java.lang.Override + public PostPayoutMethodCreatedPayloadDataQuote build() { + return new PostPayoutMethodCreatedPayloadDataQuote( + amount, currency, exchangeRate, instant, maxLimit, minLimit, standard, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataQuoteInstant.java b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataQuoteInstant.java new file mode 100644 index 00000000..0300b780 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataQuoteInstant.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPayoutMethodCreatedPayloadDataQuoteInstant.Builder.class) +public final class PostPayoutMethodCreatedPayloadDataQuoteInstant { + private final float fee; + + private final float totalReceived; + + private final Map additionalProperties; + + private PostPayoutMethodCreatedPayloadDataQuoteInstant( + float fee, float totalReceived, Map additionalProperties) { + this.fee = fee; + this.totalReceived = totalReceived; + this.additionalProperties = additionalProperties; + } + + /** + * @return Total fee charged, in the withdrawal currency. + */ + @JsonProperty("fee") + public float getFee() { + return fee; + } + + /** + * @return Amount delivered after fees, in the withdrawal currency. + */ + @JsonProperty("total_received") + public float getTotalReceived() { + return totalReceived; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPayoutMethodCreatedPayloadDataQuoteInstant + && equalTo((PostPayoutMethodCreatedPayloadDataQuoteInstant) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPayoutMethodCreatedPayloadDataQuoteInstant other) { + return fee == other.fee && totalReceived == other.totalReceived; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fee, this.totalReceived); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FeeStage builder() { + return new Builder(); + } + + public interface FeeStage { + /** + *

Total fee charged, in the withdrawal currency.

+ */ + TotalReceivedStage fee(float fee); + + Builder from(PostPayoutMethodCreatedPayloadDataQuoteInstant other); + } + + public interface TotalReceivedStage { + /** + *

Amount delivered after fees, in the withdrawal currency.

+ */ + _FinalStage totalReceived(float totalReceived); + } + + public interface _FinalStage { + PostPayoutMethodCreatedPayloadDataQuoteInstant build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FeeStage, TotalReceivedStage, _FinalStage { + private float fee; + + private float totalReceived; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostPayoutMethodCreatedPayloadDataQuoteInstant other) { + fee(other.getFee()); + totalReceived(other.getTotalReceived()); + return this; + } + + /** + *

Total fee charged, in the withdrawal currency.

+ *

Total fee charged, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee") + public TotalReceivedStage fee(float fee) { + this.fee = fee; + return this; + } + + /** + *

Amount delivered after fees, in the withdrawal currency.

+ *

Amount delivered after fees, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_received") + public _FinalStage totalReceived(float totalReceived) { + this.totalReceived = totalReceived; + return this; + } + + @java.lang.Override + public PostPayoutMethodCreatedPayloadDataQuoteInstant build() { + return new PostPayoutMethodCreatedPayloadDataQuoteInstant(fee, totalReceived, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataQuoteStandard.java b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataQuoteStandard.java new file mode 100644 index 00000000..b6ea6511 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataQuoteStandard.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPayoutMethodCreatedPayloadDataQuoteStandard.Builder.class) +public final class PostPayoutMethodCreatedPayloadDataQuoteStandard { + private final float fee; + + private final float totalReceived; + + private final Map additionalProperties; + + private PostPayoutMethodCreatedPayloadDataQuoteStandard( + float fee, float totalReceived, Map additionalProperties) { + this.fee = fee; + this.totalReceived = totalReceived; + this.additionalProperties = additionalProperties; + } + + /** + * @return Total fee charged, in the withdrawal currency. + */ + @JsonProperty("fee") + public float getFee() { + return fee; + } + + /** + * @return Amount delivered after fees, in the withdrawal currency. + */ + @JsonProperty("total_received") + public float getTotalReceived() { + return totalReceived; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPayoutMethodCreatedPayloadDataQuoteStandard + && equalTo((PostPayoutMethodCreatedPayloadDataQuoteStandard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPayoutMethodCreatedPayloadDataQuoteStandard other) { + return fee == other.fee && totalReceived == other.totalReceived; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fee, this.totalReceived); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FeeStage builder() { + return new Builder(); + } + + public interface FeeStage { + /** + *

Total fee charged, in the withdrawal currency.

+ */ + TotalReceivedStage fee(float fee); + + Builder from(PostPayoutMethodCreatedPayloadDataQuoteStandard other); + } + + public interface TotalReceivedStage { + /** + *

Amount delivered after fees, in the withdrawal currency.

+ */ + _FinalStage totalReceived(float totalReceived); + } + + public interface _FinalStage { + PostPayoutMethodCreatedPayloadDataQuoteStandard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FeeStage, TotalReceivedStage, _FinalStage { + private float fee; + + private float totalReceived; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostPayoutMethodCreatedPayloadDataQuoteStandard other) { + fee(other.getFee()); + totalReceived(other.getTotalReceived()); + return this; + } + + /** + *

Total fee charged, in the withdrawal currency.

+ *

Total fee charged, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee") + public TotalReceivedStage fee(float fee) { + this.fee = fee; + return this; + } + + /** + *

Amount delivered after fees, in the withdrawal currency.

+ *

Amount delivered after fees, in the withdrawal currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_received") + public _FinalStage totalReceived(float totalReceived) { + this.totalReceived = totalReceived; + return this; + } + + @java.lang.Override + public PostPayoutMethodCreatedPayloadDataQuoteStandard build() { + return new PostPayoutMethodCreatedPayloadDataQuoteStandard(fee, totalReceived, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataStatus.java b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataStatus.java new file mode 100644 index 00000000..0d7abe4b --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataStatus.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPayoutMethodCreatedPayloadDataStatus { + public static final PostPayoutMethodCreatedPayloadDataStatus CREATED = + new PostPayoutMethodCreatedPayloadDataStatus(Value.CREATED, "created"); + + public static final PostPayoutMethodCreatedPayloadDataStatus ACTIVE = + new PostPayoutMethodCreatedPayloadDataStatus(Value.ACTIVE, "active"); + + public static final PostPayoutMethodCreatedPayloadDataStatus BROKEN = + new PostPayoutMethodCreatedPayloadDataStatus(Value.BROKEN, "broken"); + + private final Value value; + + private final String string; + + PostPayoutMethodCreatedPayloadDataStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPayoutMethodCreatedPayloadDataStatus + && this.string.equals(((PostPayoutMethodCreatedPayloadDataStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED: + return visitor.visitCreated(); + case ACTIVE: + return visitor.visitActive(); + case BROKEN: + return visitor.visitBroken(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPayoutMethodCreatedPayloadDataStatus valueOf(String value) { + switch (value) { + case "created": + return CREATED; + case "active": + return ACTIVE; + case "broken": + return BROKEN; + default: + return new PostPayoutMethodCreatedPayloadDataStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED, + + ACTIVE, + + BROKEN, + + UNKNOWN + } + + public interface Visitor { + T visitCreated(); + + T visitActive(); + + T visitBroken(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod.java new file mode 100644 index 00000000..8b7d3c3c --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod.Builder.class) +public final class PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod { + private final Optional countryCode; + + private final PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType deliveryType; + + private final Optional iconUrl; + + private final Optional name; + + private final boolean supportsInstantDelivery; + + private final boolean supportsPlaid; + + private final boolean supportsStandardDelivery; + + private final Map additionalProperties; + + private PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod( + Optional countryCode, + PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType deliveryType, + Optional iconUrl, + Optional name, + boolean supportsInstantDelivery, + boolean supportsPlaid, + boolean supportsStandardDelivery, + Map additionalProperties) { + this.countryCode = countryCode; + this.deliveryType = deliveryType; + this.iconUrl = iconUrl; + this.name = name; + this.supportsInstantDelivery = supportsInstantDelivery; + this.supportsPlaid = supportsPlaid; + this.supportsStandardDelivery = supportsStandardDelivery; + this.additionalProperties = additionalProperties; + } + + /** + * @return ISO 3166-1 alpha-3 country the destination pays out to. + */ + @JsonIgnore + public Optional getCountryCode() { + if (countryCode == null) { + return Optional.empty(); + } + return countryCode; + } + + /** + * @return How funds are delivered. + */ + @JsonProperty("delivery_type") + public PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType getDeliveryType() { + return deliveryType; + } + + /** + * @return Supported payout method icon URL. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return Supported payout method display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("supports_instant_delivery") + public boolean getSupportsInstantDelivery() { + return supportsInstantDelivery; + } + + /** + * @return Whether the payer can link this method by signing in to their bank instead of typing account details. + */ + @JsonProperty("supports_plaid") + public boolean getSupportsPlaid() { + return supportsPlaid; + } + + @JsonProperty("supports_standard_delivery") + public boolean getSupportsStandardDelivery() { + return supportsStandardDelivery; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country_code") + private Optional _getCountryCode() { + return countryCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod + && equalTo((PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod other) { + return countryCode.equals(other.countryCode) + && deliveryType.equals(other.deliveryType) + && iconUrl.equals(other.iconUrl) + && name.equals(other.name) + && supportsInstantDelivery == other.supportsInstantDelivery + && supportsPlaid == other.supportsPlaid + && supportsStandardDelivery == other.supportsStandardDelivery; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.countryCode, + this.deliveryType, + this.iconUrl, + this.name, + this.supportsInstantDelivery, + this.supportsPlaid, + this.supportsStandardDelivery); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeliveryTypeStage builder() { + return new Builder(); + } + + public interface DeliveryTypeStage { + /** + *

How funds are delivered.

+ */ + SupportsInstantDeliveryStage deliveryType( + @NotNull PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType deliveryType); + + Builder from(PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod other); + } + + public interface SupportsInstantDeliveryStage { + SupportsPlaidStage supportsInstantDelivery(boolean supportsInstantDelivery); + } + + public interface SupportsPlaidStage { + /** + *

Whether the payer can link this method by signing in to their bank instead of typing account details.

+ */ + SupportsStandardDeliveryStage supportsPlaid(boolean supportsPlaid); + } + + public interface SupportsStandardDeliveryStage { + _FinalStage supportsStandardDelivery(boolean supportsStandardDelivery); + } + + public interface _FinalStage { + PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ */ + _FinalStage countryCode(Optional countryCode); + + _FinalStage countryCode(String countryCode); + + _FinalStage countryCode(Nullable countryCode); + + /** + *

Supported payout method icon URL.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Supported payout method display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements DeliveryTypeStage, + SupportsInstantDeliveryStage, + SupportsPlaidStage, + SupportsStandardDeliveryStage, + _FinalStage { + private PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType deliveryType; + + private boolean supportsInstantDelivery; + + private boolean supportsPlaid; + + private boolean supportsStandardDelivery; + + private Optional name = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + private Optional countryCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod other) { + countryCode(other.getCountryCode()); + deliveryType(other.getDeliveryType()); + iconUrl(other.getIconUrl()); + name(other.getName()); + supportsInstantDelivery(other.getSupportsInstantDelivery()); + supportsPlaid(other.getSupportsPlaid()); + supportsStandardDelivery(other.getSupportsStandardDelivery()); + return this; + } + + /** + *

How funds are delivered.

+ *

How funds are delivered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("delivery_type") + public SupportsInstantDeliveryStage deliveryType( + @NotNull PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType deliveryType) { + this.deliveryType = Objects.requireNonNull(deliveryType, "deliveryType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("supports_instant_delivery") + public SupportsPlaidStage supportsInstantDelivery(boolean supportsInstantDelivery) { + this.supportsInstantDelivery = supportsInstantDelivery; + return this; + } + + /** + *

Whether the payer can link this method by signing in to their bank instead of typing account details.

+ *

Whether the payer can link this method by signing in to their bank instead of typing account details.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("supports_plaid") + public SupportsStandardDeliveryStage supportsPlaid(boolean supportsPlaid) { + this.supportsPlaid = supportsPlaid; + return this; + } + + @java.lang.Override + @JsonSetter("supports_standard_delivery") + public _FinalStage supportsStandardDelivery(boolean supportsStandardDelivery) { + this.supportsStandardDelivery = supportsStandardDelivery; + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Supported payout method display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Supported payout method icon URL.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage countryCode(Nullable countryCode) { + if (countryCode.isNull()) { + this.countryCode = null; + } else if (countryCode.isEmpty()) { + this.countryCode = Optional.empty(); + } else { + this.countryCode = Optional.of(countryCode.get()); + } + return this; + } + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage countryCode(String countryCode) { + this.countryCode = Optional.ofNullable(countryCode); + return this; + } + + /** + *

ISO 3166-1 alpha-3 country the destination pays out to.

+ */ + @java.lang.Override + @JsonSetter(value = "country_code", nulls = Nulls.SKIP) + public _FinalStage countryCode(Optional countryCode) { + this.countryCode = countryCode; + return this; + } + + @java.lang.Override + public PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod build() { + return new PostPayoutMethodCreatedPayloadDataSupportedPayoutMethod( + countryCode, + deliveryType, + iconUrl, + name, + supportsInstantDelivery, + supportsPlaid, + supportsStandardDelivery, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType.java b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType.java new file mode 100644 index 00000000..1f7dddce --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType.java @@ -0,0 +1,167 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType { + public static final PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType PAPER_CHECK = + new PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType(Value.PAPER_CHECK, "paper_check"); + + public static final PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType CRYPTOCURRENCY = + new PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType( + Value.CRYPTOCURRENCY, "cryptocurrency"); + + public static final PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType UNKNOWN = + new PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType(Value.UNKNOWN, "unknown"); + + public static final PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType HOME_DELIVERY = + new PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType( + Value.HOME_DELIVERY, "home_delivery"); + + public static final PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType BANK_DEPOSIT = + new PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType(Value.BANK_DEPOSIT, "bank_deposit"); + + public static final PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType MASSPAY_CARD = + new PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType(Value.MASSPAY_CARD, "masspay_card"); + + public static final PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType MOBILE_WALLET = + new PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType( + Value.MOBILE_WALLET, "mobile_wallet"); + + public static final PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType CASH_PICKUP = + new PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType(Value.CASH_PICKUP, "cash_pickup"); + + public static final PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType BILL = + new PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType(Value.BILL, "bill"); + + private final Value value; + + private final String string; + + PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType + && this.string.equals( + ((PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAPER_CHECK: + return visitor.visitPaperCheck(); + case CRYPTOCURRENCY: + return visitor.visitCryptocurrency(); + case UNKNOWN: + return visitor.visitUnknown(); + case HOME_DELIVERY: + return visitor.visitHomeDelivery(); + case BANK_DEPOSIT: + return visitor.visitBankDeposit(); + case MASSPAY_CARD: + return visitor.visitMasspayCard(); + case MOBILE_WALLET: + return visitor.visitMobileWallet(); + case CASH_PICKUP: + return visitor.visitCashPickup(); + case BILL: + return visitor.visitBill(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType valueOf(String value) { + switch (value) { + case "paper_check": + return PAPER_CHECK; + case "cryptocurrency": + return CRYPTOCURRENCY; + case "unknown": + return UNKNOWN; + case "home_delivery": + return HOME_DELIVERY; + case "bank_deposit": + return BANK_DEPOSIT; + case "masspay_card": + return MASSPAY_CARD; + case "mobile_wallet": + return MOBILE_WALLET; + case "cash_pickup": + return CASH_PICKUP; + case "bill": + return BILL; + default: + return new PostPayoutMethodCreatedPayloadDataSupportedPayoutMethodDeliveryType(Value._UNKNOWN, value); + } + } + + public enum Value { + CASH_PICKUP, + + BANK_DEPOSIT, + + HOME_DELIVERY, + + MOBILE_WALLET, + + MASSPAY_CARD, + + PAPER_CHECK, + + BILL, + + CRYPTOCURRENCY, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitCashPickup(); + + T visitBankDeposit(); + + T visitHomeDelivery(); + + T visitMobileWallet(); + + T visitMasspayCard(); + + T visitPaperCheck(); + + T visitBill(); + + T visitCryptocurrency(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataUnavailableReason.java b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataUnavailableReason.java new file mode 100644 index 00000000..b9aa1418 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadDataUnavailableReason.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPayoutMethodCreatedPayloadDataUnavailableReason { + public static final PostPayoutMethodCreatedPayloadDataUnavailableReason DESTINATION_RETIRED = + new PostPayoutMethodCreatedPayloadDataUnavailableReason(Value.DESTINATION_RETIRED, "destination_retired"); + + private final Value value; + + private final String string; + + PostPayoutMethodCreatedPayloadDataUnavailableReason(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPayoutMethodCreatedPayloadDataUnavailableReason + && this.string.equals(((PostPayoutMethodCreatedPayloadDataUnavailableReason) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DESTINATION_RETIRED: + return visitor.visitDestinationRetired(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPayoutMethodCreatedPayloadDataUnavailableReason valueOf(String value) { + switch (value) { + case "destination_retired": + return DESTINATION_RETIRED; + default: + return new PostPayoutMethodCreatedPayloadDataUnavailableReason(Value.UNKNOWN, value); + } + } + + public enum Value { + DESTINATION_RETIRED, + + UNKNOWN + } + + public interface Visitor { + T visitDestinationRetired(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadType.java b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadType.java new file mode 100644 index 00000000..e05349a6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostPayoutMethodCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPayoutMethodCreatedPayloadType { + public static final PostPayoutMethodCreatedPayloadType PAYOUT_METHOD_CREATED = + new PostPayoutMethodCreatedPayloadType(Value.PAYOUT_METHOD_CREATED, "payout_method.created"); + + private final Value value; + + private final String string; + + PostPayoutMethodCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPayoutMethodCreatedPayloadType + && this.string.equals(((PostPayoutMethodCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYOUT_METHOD_CREATED: + return visitor.visitPayoutMethodCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPayoutMethodCreatedPayloadType valueOf(String value) { + switch (value) { + case "payout_method.created": + return PAYOUT_METHOD_CREATED; + default: + return new PostPayoutMethodCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYOUT_METHOD_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitPayoutMethodCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayload.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayload.java new file mode 100644 index 00000000..18d37a61 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayload.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostWithdrawalCreatedPayload.Builder.class) +public final class PostWithdrawalCreatedPayload { + private final Optional accountId; + + private final PostWithdrawalCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostWithdrawalCreatedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostWithdrawalCreatedPayloadType type; + + private final Map additionalProperties; + + private PostWithdrawalCreatedPayload( + Optional accountId, + PostWithdrawalCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostWithdrawalCreatedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostWithdrawalCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostWithdrawalCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PostWithdrawalCreatedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostWithdrawalCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostWithdrawalCreatedPayload && equalTo((PostWithdrawalCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostWithdrawalCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostWithdrawalCreatedPayloadApiVersion apiVersion); + + Builder from(PostWithdrawalCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PostWithdrawalCreatedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostWithdrawalCreatedPayloadType type); + } + + public interface _FinalStage { + PostWithdrawalCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostWithdrawalCreatedPayloadApiVersion apiVersion; + + private PostWithdrawalCreatedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostWithdrawalCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostWithdrawalCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostWithdrawalCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostWithdrawalCreatedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostWithdrawalCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostWithdrawalCreatedPayload build() { + return new PostWithdrawalCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadApiVersion.java new file mode 100644 index 00000000..92b17452 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalCreatedPayloadApiVersion { + public static final PostWithdrawalCreatedPayloadApiVersion V1 = + new PostWithdrawalCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostWithdrawalCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalCreatedPayloadApiVersion + && this.string.equals(((PostWithdrawalCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostWithdrawalCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadData.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadData.java new file mode 100644 index 00000000..d983ac35 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadData.java @@ -0,0 +1,1404 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostWithdrawalCreatedPayloadData.Builder.class) +public final class PostWithdrawalCreatedPayloadData { + private final String amount; + + private final OffsetDateTime createdAt; + + private final String currency; + + private final Optional destinationAmount; + + private final Optional destinationCurrency; + + private final Optional estimatedArrival; + + private final Optional exchangeRate; + + private final Optional failure; + + private final String feeAmount; + + private final PostWithdrawalCreatedPayloadDataFeePaidBy feePaidBy; + + private final String id; + + private final String markupFee; + + private final Map metadata; + + private final String netAmount; + + private final Optional notes; + + private final PostWithdrawalCreatedPayloadDataObject object; + + private final Optional payerName; + + private final Optional payoutMethod; + + private final Optional payoutRequestId; + + private final Optional source; + + private final PostWithdrawalCreatedPayloadDataSpeed speed; + + private final PostWithdrawalCreatedPayloadDataStatus status; + + private final String statusDetail; + + private final Optional traceCode; + + private final Map additionalProperties; + + private PostWithdrawalCreatedPayloadData( + String amount, + OffsetDateTime createdAt, + String currency, + Optional destinationAmount, + Optional destinationCurrency, + Optional estimatedArrival, + Optional exchangeRate, + Optional failure, + String feeAmount, + PostWithdrawalCreatedPayloadDataFeePaidBy feePaidBy, + String id, + String markupFee, + Map metadata, + String netAmount, + Optional notes, + PostWithdrawalCreatedPayloadDataObject object, + Optional payerName, + Optional payoutMethod, + Optional payoutRequestId, + Optional source, + PostWithdrawalCreatedPayloadDataSpeed speed, + PostWithdrawalCreatedPayloadDataStatus status, + String statusDetail, + Optional traceCode, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.currency = currency; + this.destinationAmount = destinationAmount; + this.destinationCurrency = destinationCurrency; + this.estimatedArrival = estimatedArrival; + this.exchangeRate = exchangeRate; + this.failure = failure; + this.feeAmount = feeAmount; + this.feePaidBy = feePaidBy; + this.id = id; + this.markupFee = markupFee; + this.metadata = metadata; + this.netAmount = netAmount; + this.notes = notes; + this.object = object; + this.payerName = payerName; + this.payoutMethod = payoutMethod; + this.payoutRequestId = payoutRequestId; + this.source = source; + this.speed = speed; + this.status = status; + this.statusDetail = statusDetail; + this.traceCode = traceCode; + this.additionalProperties = additionalProperties; + } + + /** + * @return The payout amount in whole currency units, as a decimal string. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + /** + * @return When the payout was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Payout currency. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion. + */ + @JsonIgnore + public Optional getDestinationAmount() { + if (destinationAmount == null) { + return Optional.empty(); + } + return destinationAmount; + } + + /** + * @return Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists. + */ + @JsonIgnore + public Optional getDestinationCurrency() { + if (destinationCurrency == null) { + return Optional.empty(); + } + return destinationCurrency; + } + + /** + * @return Estimated time the funds become available in the destination account. + */ + @JsonIgnore + public Optional getEstimatedArrival() { + if (estimatedArrival == null) { + return Optional.empty(); + } + return estimatedArrival; + } + + /** + * @return Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate. + */ + @JsonIgnore + public Optional getExchangeRate() { + if (exchangeRate == null) { + return Optional.empty(); + } + return exchangeRate; + } + + /** + * @return Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise. + */ + @JsonIgnore + public Optional getFailure() { + if (failure == null) { + return Optional.empty(); + } + return failure; + } + + /** + * @return The fee charged for the payout, in the payout currency, as a decimal string. + */ + @JsonProperty("fee_amount") + public String getFeeAmount() { + return feeAmount; + } + + /** + * @return Who bore the payout fee: the account itself, or its parent platform. + */ + @JsonProperty("fee_paid_by") + public PostWithdrawalCreatedPayloadDataFeePaidBy getFeePaidBy() { + return feePaidBy; + } + + /** + * @return Payout ID, prefixed wdrl_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies. + */ + @JsonProperty("markup_fee") + public String getMarkupFee() { + return markupFee; + } + + /** + * @return Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters. + */ + @JsonProperty("metadata") + public Map getMetadata() { + return metadata; + } + + /** + * @return The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered. + */ + @JsonProperty("net_amount") + public String getNetAmount() { + return netAmount; + } + + /** + * @return Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + @JsonProperty("object") + public PostWithdrawalCreatedPayloadDataObject getObject() { + return object; + } + + /** + * @return Name of the entity processing the payout. + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + /** + * @return The saved payout method used. Requires payout:destination:read; null without it. + */ + @JsonIgnore + public Optional getPayoutMethod() { + if (payoutMethod == null) { + return Optional.empty(); + } + return payoutMethod; + } + + /** + * @return Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts. + */ + @JsonIgnore + public Optional getPayoutRequestId() { + if (payoutRequestId == null) { + return Optional.empty(); + } + return payoutRequestId; + } + + /** + * @return How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling. + */ + @JsonIgnore + public Optional getSource() { + if (source == null) { + return Optional.empty(); + } + return source; + } + + /** + * @return Payout delivery speed. + */ + @JsonProperty("speed") + public PostWithdrawalCreatedPayloadDataSpeed getSpeed() { + return speed; + } + + /** + * @return Current payout status. + */ + @JsonProperty("status") + public PostWithdrawalCreatedPayloadDataStatus getStatus() { + return status; + } + + /** + * @return The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract. + */ + @JsonProperty("status_detail") + public String getStatusDetail() { + return statusDetail; + } + + /** + * @return ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH. + */ + @JsonIgnore + public Optional getTraceCode() { + if (traceCode == null) { + return Optional.empty(); + } + return traceCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination_amount") + private Optional _getDestinationAmount() { + return destinationAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination_currency") + private Optional _getDestinationCurrency() { + return destinationCurrency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("estimated_arrival") + private Optional _getEstimatedArrival() { + return estimatedArrival; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exchange_rate") + private Optional _getExchangeRate() { + return exchangeRate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure") + private Optional _getFailure() { + return failure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_method") + private Optional _getPayoutMethod() { + return payoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_request_id") + private Optional _getPayoutRequestId() { + return payoutRequestId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source") + private Optional _getSource() { + return source; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trace_code") + private Optional _getTraceCode() { + return traceCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostWithdrawalCreatedPayloadData && equalTo((PostWithdrawalCreatedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostWithdrawalCreatedPayloadData other) { + return amount.equals(other.amount) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && destinationAmount.equals(other.destinationAmount) + && destinationCurrency.equals(other.destinationCurrency) + && estimatedArrival.equals(other.estimatedArrival) + && exchangeRate.equals(other.exchangeRate) + && failure.equals(other.failure) + && feeAmount.equals(other.feeAmount) + && feePaidBy.equals(other.feePaidBy) + && id.equals(other.id) + && markupFee.equals(other.markupFee) + && metadata.equals(other.metadata) + && netAmount.equals(other.netAmount) + && notes.equals(other.notes) + && object.equals(other.object) + && payerName.equals(other.payerName) + && payoutMethod.equals(other.payoutMethod) + && payoutRequestId.equals(other.payoutRequestId) + && source.equals(other.source) + && speed.equals(other.speed) + && status.equals(other.status) + && statusDetail.equals(other.statusDetail) + && traceCode.equals(other.traceCode); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.currency, + this.destinationAmount, + this.destinationCurrency, + this.estimatedArrival, + this.exchangeRate, + this.failure, + this.feeAmount, + this.feePaidBy, + this.id, + this.markupFee, + this.metadata, + this.netAmount, + this.notes, + this.object, + this.payerName, + this.payoutMethod, + this.payoutRequestId, + this.source, + this.speed, + this.status, + this.statusDetail, + this.traceCode); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The payout amount in whole currency units, as a decimal string.

+ */ + CreatedAtStage amount(@NotNull String amount); + + Builder from(PostWithdrawalCreatedPayloadData other); + } + + public interface CreatedAtStage { + /** + *

When the payout was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

Payout currency.

+ */ + FeeAmountStage currency(@NotNull String currency); + } + + public interface FeeAmountStage { + /** + *

The fee charged for the payout, in the payout currency, as a decimal string.

+ */ + FeePaidByStage feeAmount(@NotNull String feeAmount); + } + + public interface FeePaidByStage { + /** + *

Who bore the payout fee: the account itself, or its parent platform.

+ */ + IdStage feePaidBy(@NotNull PostWithdrawalCreatedPayloadDataFeePaidBy feePaidBy); + } + + public interface IdStage { + /** + *

Payout ID, prefixed wdrl_.

+ */ + MarkupFeeStage id(@NotNull String id); + } + + public interface MarkupFeeStage { + /** + *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ */ + NetAmountStage markupFee(@NotNull String markupFee); + } + + public interface NetAmountStage { + /** + *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ */ + ObjectStage netAmount(@NotNull String netAmount); + } + + public interface ObjectStage { + SpeedStage object(@NotNull PostWithdrawalCreatedPayloadDataObject object); + } + + public interface SpeedStage { + /** + *

Payout delivery speed.

+ */ + StatusStage speed(@NotNull PostWithdrawalCreatedPayloadDataSpeed speed); + } + + public interface StatusStage { + /** + *

Current payout status.

+ */ + StatusDetailStage status(@NotNull PostWithdrawalCreatedPayloadDataStatus status); + } + + public interface StatusDetailStage { + /** + *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ */ + _FinalStage statusDetail(@NotNull String statusDetail); + } + + public interface _FinalStage { + PostWithdrawalCreatedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ */ + _FinalStage destinationAmount(Optional destinationAmount); + + _FinalStage destinationAmount(String destinationAmount); + + _FinalStage destinationAmount(Nullable destinationAmount); + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ */ + _FinalStage destinationCurrency(Optional destinationCurrency); + + _FinalStage destinationCurrency(String destinationCurrency); + + _FinalStage destinationCurrency(Nullable destinationCurrency); + + /** + *

Estimated time the funds become available in the destination account.

+ */ + _FinalStage estimatedArrival(Optional estimatedArrival); + + _FinalStage estimatedArrival(OffsetDateTime estimatedArrival); + + _FinalStage estimatedArrival(Nullable estimatedArrival); + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ */ + _FinalStage exchangeRate(Optional exchangeRate); + + _FinalStage exchangeRate(Float exchangeRate); + + _FinalStage exchangeRate(Nullable exchangeRate); + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ */ + _FinalStage failure(Optional failure); + + _FinalStage failure(PostWithdrawalCreatedPayloadDataFailure failure); + + _FinalStage failure(Nullable failure); + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ */ + _FinalStage metadata(Map metadata); + + _FinalStage putAllMetadata(Map metadata); + + _FinalStage metadata(String key, String value); + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + + /** + *

Name of the entity processing the payout.

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ */ + _FinalStage payoutMethod(Optional payoutMethod); + + _FinalStage payoutMethod(PostWithdrawalCreatedPayloadDataPayoutMethod payoutMethod); + + _FinalStage payoutMethod(Nullable payoutMethod); + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ */ + _FinalStage payoutRequestId(Optional payoutRequestId); + + _FinalStage payoutRequestId(String payoutRequestId); + + _FinalStage payoutRequestId(Nullable payoutRequestId); + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ */ + _FinalStage source(Optional source); + + _FinalStage source(PostWithdrawalCreatedPayloadDataSource source); + + _FinalStage source(Nullable source); + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ */ + _FinalStage traceCode(Optional traceCode); + + _FinalStage traceCode(String traceCode); + + _FinalStage traceCode(Nullable traceCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + CurrencyStage, + FeeAmountStage, + FeePaidByStage, + IdStage, + MarkupFeeStage, + NetAmountStage, + ObjectStage, + SpeedStage, + StatusStage, + StatusDetailStage, + _FinalStage { + private String amount; + + private OffsetDateTime createdAt; + + private String currency; + + private String feeAmount; + + private PostWithdrawalCreatedPayloadDataFeePaidBy feePaidBy; + + private String id; + + private String markupFee; + + private String netAmount; + + private PostWithdrawalCreatedPayloadDataObject object; + + private PostWithdrawalCreatedPayloadDataSpeed speed; + + private PostWithdrawalCreatedPayloadDataStatus status; + + private String statusDetail; + + private Optional traceCode = Optional.empty(); + + private Optional source = Optional.empty(); + + private Optional payoutRequestId = Optional.empty(); + + private Optional payoutMethod = Optional.empty(); + + private Optional payerName = Optional.empty(); + + private Optional notes = Optional.empty(); + + private Map metadata = new LinkedHashMap<>(); + + private Optional failure = Optional.empty(); + + private Optional exchangeRate = Optional.empty(); + + private Optional estimatedArrival = Optional.empty(); + + private Optional destinationCurrency = Optional.empty(); + + private Optional destinationAmount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostWithdrawalCreatedPayloadData other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + destinationAmount(other.getDestinationAmount()); + destinationCurrency(other.getDestinationCurrency()); + estimatedArrival(other.getEstimatedArrival()); + exchangeRate(other.getExchangeRate()); + failure(other.getFailure()); + feeAmount(other.getFeeAmount()); + feePaidBy(other.getFeePaidBy()); + id(other.getId()); + markupFee(other.getMarkupFee()); + metadata(other.getMetadata()); + netAmount(other.getNetAmount()); + notes(other.getNotes()); + object(other.getObject()); + payerName(other.getPayerName()); + payoutMethod(other.getPayoutMethod()); + payoutRequestId(other.getPayoutRequestId()); + source(other.getSource()); + speed(other.getSpeed()); + status(other.getStatus()); + statusDetail(other.getStatusDetail()); + traceCode(other.getTraceCode()); + return this; + } + + /** + *

The payout amount in whole currency units, as a decimal string.

+ *

The payout amount in whole currency units, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

When the payout was created.

+ *

When the payout was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Payout currency.

+ *

Payout currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public FeeAmountStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The fee charged for the payout, in the payout currency, as a decimal string.

+ *

The fee charged for the payout, in the payout currency, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_amount") + public FeePaidByStage feeAmount(@NotNull String feeAmount) { + this.feeAmount = Objects.requireNonNull(feeAmount, "feeAmount must not be null"); + return this; + } + + /** + *

Who bore the payout fee: the account itself, or its parent platform.

+ *

Who bore the payout fee: the account itself, or its parent platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_paid_by") + public IdStage feePaidBy(@NotNull PostWithdrawalCreatedPayloadDataFeePaidBy feePaidBy) { + this.feePaidBy = Objects.requireNonNull(feePaidBy, "feePaidBy must not be null"); + return this; + } + + /** + *

Payout ID, prefixed wdrl_.

+ *

Payout ID, prefixed wdrl_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MarkupFeeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("markup_fee") + public NetAmountStage markupFee(@NotNull String markupFee) { + this.markupFee = Objects.requireNonNull(markupFee, "markupFee must not be null"); + return this; + } + + /** + *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("net_amount") + public ObjectStage netAmount(@NotNull String netAmount) { + this.netAmount = Objects.requireNonNull(netAmount, "netAmount must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public SpeedStage object(@NotNull PostWithdrawalCreatedPayloadDataObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Payout delivery speed.

+ *

Payout delivery speed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("speed") + public StatusStage speed(@NotNull PostWithdrawalCreatedPayloadDataSpeed speed) { + this.speed = Objects.requireNonNull(speed, "speed must not be null"); + return this; + } + + /** + *

Current payout status.

+ *

Current payout status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public StatusDetailStage status(@NotNull PostWithdrawalCreatedPayloadDataStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status_detail") + public _FinalStage statusDetail(@NotNull String statusDetail) { + this.statusDetail = Objects.requireNonNull(statusDetail, "statusDetail must not be null"); + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage traceCode(Nullable traceCode) { + if (traceCode.isNull()) { + this.traceCode = null; + } else if (traceCode.isEmpty()) { + this.traceCode = Optional.empty(); + } else { + this.traceCode = Optional.of(traceCode.get()); + } + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage traceCode(String traceCode) { + this.traceCode = Optional.ofNullable(traceCode); + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ */ + @java.lang.Override + @JsonSetter(value = "trace_code", nulls = Nulls.SKIP) + public _FinalStage traceCode(Optional traceCode) { + this.traceCode = traceCode; + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(Nullable source) { + if (source.isNull()) { + this.source = null; + } else if (source.isEmpty()) { + this.source = Optional.empty(); + } else { + this.source = Optional.of(source.get()); + } + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(PostWithdrawalCreatedPayloadDataSource source) { + this.source = Optional.ofNullable(source); + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ */ + @java.lang.Override + @JsonSetter(value = "source", nulls = Nulls.SKIP) + public _FinalStage source(Optional source) { + this.source = source; + return this; + } + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(Nullable payoutRequestId) { + if (payoutRequestId.isNull()) { + this.payoutRequestId = null; + } else if (payoutRequestId.isEmpty()) { + this.payoutRequestId = Optional.empty(); + } else { + this.payoutRequestId = Optional.of(payoutRequestId.get()); + } + return this; + } + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(String payoutRequestId) { + this.payoutRequestId = Optional.ofNullable(payoutRequestId); + return this; + } + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_request_id", nulls = Nulls.SKIP) + public _FinalStage payoutRequestId(Optional payoutRequestId) { + this.payoutRequestId = payoutRequestId; + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutMethod(Nullable payoutMethod) { + if (payoutMethod.isNull()) { + this.payoutMethod = null; + } else if (payoutMethod.isEmpty()) { + this.payoutMethod = Optional.empty(); + } else { + this.payoutMethod = Optional.of(payoutMethod.get()); + } + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutMethod(PostWithdrawalCreatedPayloadDataPayoutMethod payoutMethod) { + this.payoutMethod = Optional.ofNullable(payoutMethod); + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_method", nulls = Nulls.SKIP) + public _FinalStage payoutMethod(Optional payoutMethod) { + this.payoutMethod = payoutMethod; + return this; + } + + /** + *

Name of the entity processing the payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

Name of the entity processing the payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

Name of the entity processing the payout.

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(String key, String value) { + this.metadata.put(key, value); + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllMetadata(Map metadata) { + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Map metadata) { + this.metadata.clear(); + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failure(Nullable failure) { + if (failure.isNull()) { + this.failure = null; + } else if (failure.isEmpty()) { + this.failure = Optional.empty(); + } else { + this.failure = Optional.of(failure.get()); + } + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failure(PostWithdrawalCreatedPayloadDataFailure failure) { + this.failure = Optional.ofNullable(failure); + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "failure", nulls = Nulls.SKIP) + public _FinalStage failure(Optional failure) { + this.failure = failure; + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage exchangeRate(Nullable exchangeRate) { + if (exchangeRate.isNull()) { + this.exchangeRate = null; + } else if (exchangeRate.isEmpty()) { + this.exchangeRate = Optional.empty(); + } else { + this.exchangeRate = Optional.of(exchangeRate.get()); + } + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage exchangeRate(Float exchangeRate) { + this.exchangeRate = Optional.ofNullable(exchangeRate); + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ */ + @java.lang.Override + @JsonSetter(value = "exchange_rate", nulls = Nulls.SKIP) + public _FinalStage exchangeRate(Optional exchangeRate) { + this.exchangeRate = exchangeRate; + return this; + } + + /** + *

Estimated time the funds become available in the destination account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(Nullable estimatedArrival) { + if (estimatedArrival.isNull()) { + this.estimatedArrival = null; + } else if (estimatedArrival.isEmpty()) { + this.estimatedArrival = Optional.empty(); + } else { + this.estimatedArrival = Optional.of(estimatedArrival.get()); + } + return this; + } + + /** + *

Estimated time the funds become available in the destination account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(OffsetDateTime estimatedArrival) { + this.estimatedArrival = Optional.ofNullable(estimatedArrival); + return this; + } + + /** + *

Estimated time the funds become available in the destination account.

+ */ + @java.lang.Override + @JsonSetter(value = "estimated_arrival", nulls = Nulls.SKIP) + public _FinalStage estimatedArrival(Optional estimatedArrival) { + this.estimatedArrival = estimatedArrival; + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationCurrency(Nullable destinationCurrency) { + if (destinationCurrency.isNull()) { + this.destinationCurrency = null; + } else if (destinationCurrency.isEmpty()) { + this.destinationCurrency = Optional.empty(); + } else { + this.destinationCurrency = Optional.of(destinationCurrency.get()); + } + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationCurrency(String destinationCurrency) { + this.destinationCurrency = Optional.ofNullable(destinationCurrency); + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ */ + @java.lang.Override + @JsonSetter(value = "destination_currency", nulls = Nulls.SKIP) + public _FinalStage destinationCurrency(Optional destinationCurrency) { + this.destinationCurrency = destinationCurrency; + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationAmount(Nullable destinationAmount) { + if (destinationAmount.isNull()) { + this.destinationAmount = null; + } else if (destinationAmount.isEmpty()) { + this.destinationAmount = Optional.empty(); + } else { + this.destinationAmount = Optional.of(destinationAmount.get()); + } + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationAmount(String destinationAmount) { + this.destinationAmount = Optional.ofNullable(destinationAmount); + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ */ + @java.lang.Override + @JsonSetter(value = "destination_amount", nulls = Nulls.SKIP) + public _FinalStage destinationAmount(Optional destinationAmount) { + this.destinationAmount = destinationAmount; + return this; + } + + @java.lang.Override + public PostWithdrawalCreatedPayloadData build() { + return new PostWithdrawalCreatedPayloadData( + amount, + createdAt, + currency, + destinationAmount, + destinationCurrency, + estimatedArrival, + exchangeRate, + failure, + feeAmount, + feePaidBy, + id, + markupFee, + metadata, + netAmount, + notes, + object, + payerName, + payoutMethod, + payoutRequestId, + source, + speed, + status, + statusDetail, + traceCode, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataFailure.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataFailure.java new file mode 100644 index 00000000..dca2b8d8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataFailure.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostWithdrawalCreatedPayloadDataFailure.Builder.class) +public final class PostWithdrawalCreatedPayloadDataFailure { + private final Optional code; + + private final Optional fundsReturnedAt; + + private final Optional message; + + private final Map additionalProperties; + + private PostWithdrawalCreatedPayloadDataFailure( + Optional code, + Optional fundsReturnedAt, + Optional message, + Map additionalProperties) { + this.code = code; + this.fundsReturnedAt = fundsReturnedAt; + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return Classified failure code from the maintained error catalog. + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + /** + * @return The effective time of the reversal that put the funds back in the balance — null if they never left it or have not returned yet. Set only once the return is confirmed in the ledger; the ledger posting itself can land moments after this time. + */ + @JsonIgnore + public Optional getFundsReturnedAt() { + if (fundsReturnedAt == null) { + return Optional.empty(); + } + return fundsReturnedAt; + } + + /** + * @return Human-readable explanation of the failure. Callers holding payout:destination:read may receive text personalized to the destination; other callers get the generic catalog message. + */ + @JsonIgnore + public Optional getMessage() { + if (message == null) { + return Optional.empty(); + } + return message; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("funds_returned_at") + private Optional _getFundsReturnedAt() { + return fundsReturnedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("message") + private Optional _getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostWithdrawalCreatedPayloadDataFailure + && equalTo((PostWithdrawalCreatedPayloadDataFailure) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostWithdrawalCreatedPayloadDataFailure other) { + return code.equals(other.code) + && fundsReturnedAt.equals(other.fundsReturnedAt) + && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.fundsReturnedAt, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional code = Optional.empty(); + + private Optional fundsReturnedAt = Optional.empty(); + + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PostWithdrawalCreatedPayloadDataFailure other) { + code(other.getCode()); + fundsReturnedAt(other.getFundsReturnedAt()); + message(other.getMessage()); + return this; + } + + /** + *

Classified failure code from the maintained error catalog.

+ */ + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public Builder code(Optional code) { + this.code = code; + return this; + } + + public Builder code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + public Builder code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

The effective time of the reversal that put the funds back in the balance — null if they never left it or have not returned yet. Set only once the return is confirmed in the ledger; the ledger posting itself can land moments after this time.

+ */ + @JsonSetter(value = "funds_returned_at", nulls = Nulls.SKIP) + public Builder fundsReturnedAt(Optional fundsReturnedAt) { + this.fundsReturnedAt = fundsReturnedAt; + return this; + } + + public Builder fundsReturnedAt(OffsetDateTime fundsReturnedAt) { + this.fundsReturnedAt = Optional.ofNullable(fundsReturnedAt); + return this; + } + + public Builder fundsReturnedAt(Nullable fundsReturnedAt) { + if (fundsReturnedAt.isNull()) { + this.fundsReturnedAt = null; + } else if (fundsReturnedAt.isEmpty()) { + this.fundsReturnedAt = Optional.empty(); + } else { + this.fundsReturnedAt = Optional.of(fundsReturnedAt.get()); + } + return this; + } + + /** + *

Human-readable explanation of the failure. Callers holding payout:destination:read may receive text personalized to the destination; other callers get the generic catalog message.

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public Builder message(Nullable message) { + if (message.isNull()) { + this.message = null; + } else if (message.isEmpty()) { + this.message = Optional.empty(); + } else { + this.message = Optional.of(message.get()); + } + return this; + } + + public PostWithdrawalCreatedPayloadDataFailure build() { + return new PostWithdrawalCreatedPayloadDataFailure(code, fundsReturnedAt, message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataFeePaidBy.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataFeePaidBy.java new file mode 100644 index 00000000..f6662db4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataFeePaidBy.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalCreatedPayloadDataFeePaidBy { + public static final PostWithdrawalCreatedPayloadDataFeePaidBy SELF = + new PostWithdrawalCreatedPayloadDataFeePaidBy(Value.SELF, "self"); + + public static final PostWithdrawalCreatedPayloadDataFeePaidBy PLATFORM = + new PostWithdrawalCreatedPayloadDataFeePaidBy(Value.PLATFORM, "platform"); + + private final Value value; + + private final String string; + + PostWithdrawalCreatedPayloadDataFeePaidBy(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalCreatedPayloadDataFeePaidBy + && this.string.equals(((PostWithdrawalCreatedPayloadDataFeePaidBy) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF: + return visitor.visitSelf(); + case PLATFORM: + return visitor.visitPlatform(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalCreatedPayloadDataFeePaidBy valueOf(String value) { + switch (value) { + case "self": + return SELF; + case "platform": + return PLATFORM; + default: + return new PostWithdrawalCreatedPayloadDataFeePaidBy(Value.UNKNOWN, value); + } + } + + public enum Value { + SELF, + + PLATFORM, + + UNKNOWN + } + + public interface Visitor { + T visitSelf(); + + T visitPlatform(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataObject.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataObject.java new file mode 100644 index 00000000..81fc650f --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalCreatedPayloadDataObject { + public static final PostWithdrawalCreatedPayloadDataObject PAYOUT = + new PostWithdrawalCreatedPayloadDataObject(Value.PAYOUT, "payout"); + + private final Value value; + + private final String string; + + PostWithdrawalCreatedPayloadDataObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalCreatedPayloadDataObject + && this.string.equals(((PostWithdrawalCreatedPayloadDataObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYOUT: + return visitor.visitPayout(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalCreatedPayloadDataObject valueOf(String value) { + switch (value) { + case "payout": + return PAYOUT; + default: + return new PostWithdrawalCreatedPayloadDataObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYOUT, + + UNKNOWN + } + + public interface Visitor { + T visitPayout(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataPayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataPayoutMethod.java new file mode 100644 index 00000000..779aa5db --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataPayoutMethod.java @@ -0,0 +1,191 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostWithdrawalCreatedPayloadDataPayoutMethod.Builder.class) +public final class PostWithdrawalCreatedPayloadDataPayoutMethod { + private final Optional nickname; + + private final Optional supportedPayoutMethod; + + private final Map additionalProperties; + + private PostWithdrawalCreatedPayloadDataPayoutMethod( + Optional nickname, + Optional supportedPayoutMethod, + Map additionalProperties) { + this.nickname = nickname; + this.supportedPayoutMethod = supportedPayoutMethod; + this.additionalProperties = additionalProperties; + } + + /** + * @return Saved payout method nickname. + */ + @JsonIgnore + public Optional getNickname() { + if (nickname == null) { + return Optional.empty(); + } + return nickname; + } + + /** + * @return Supported payout method display details. + */ + @JsonIgnore + public Optional getSupportedPayoutMethod() { + if (supportedPayoutMethod == null) { + return Optional.empty(); + } + return supportedPayoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("nickname") + private Optional _getNickname() { + return nickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("supported_payout_method") + private Optional _getSupportedPayoutMethod() { + return supportedPayoutMethod; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostWithdrawalCreatedPayloadDataPayoutMethod + && equalTo((PostWithdrawalCreatedPayloadDataPayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostWithdrawalCreatedPayloadDataPayoutMethod other) { + return nickname.equals(other.nickname) && supportedPayoutMethod.equals(other.supportedPayoutMethod); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.nickname, this.supportedPayoutMethod); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional nickname = Optional.empty(); + + private Optional supportedPayoutMethod = + Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PostWithdrawalCreatedPayloadDataPayoutMethod other) { + nickname(other.getNickname()); + supportedPayoutMethod(other.getSupportedPayoutMethod()); + return this; + } + + /** + *

Saved payout method nickname.

+ */ + @JsonSetter(value = "nickname", nulls = Nulls.SKIP) + public Builder nickname(Optional nickname) { + this.nickname = nickname; + return this; + } + + public Builder nickname(String nickname) { + this.nickname = Optional.ofNullable(nickname); + return this; + } + + public Builder nickname(Nullable nickname) { + if (nickname.isNull()) { + this.nickname = null; + } else if (nickname.isEmpty()) { + this.nickname = Optional.empty(); + } else { + this.nickname = Optional.of(nickname.get()); + } + return this; + } + + /** + *

Supported payout method display details.

+ */ + @JsonSetter(value = "supported_payout_method", nulls = Nulls.SKIP) + public Builder supportedPayoutMethod( + Optional supportedPayoutMethod) { + this.supportedPayoutMethod = supportedPayoutMethod; + return this; + } + + public Builder supportedPayoutMethod( + PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethod supportedPayoutMethod) { + this.supportedPayoutMethod = Optional.ofNullable(supportedPayoutMethod); + return this; + } + + public Builder supportedPayoutMethod( + Nullable supportedPayoutMethod) { + if (supportedPayoutMethod.isNull()) { + this.supportedPayoutMethod = null; + } else if (supportedPayoutMethod.isEmpty()) { + this.supportedPayoutMethod = Optional.empty(); + } else { + this.supportedPayoutMethod = Optional.of(supportedPayoutMethod.get()); + } + return this; + } + + public PostWithdrawalCreatedPayloadDataPayoutMethod build() { + return new PostWithdrawalCreatedPayloadDataPayoutMethod( + nickname, supportedPayoutMethod, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethod.java new file mode 100644 index 00000000..61fbde8b --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethod.java @@ -0,0 +1,280 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethod.Builder.class) +public final class PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethod { + private final PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType deliveryType; + + private final Optional iconUrl; + + private final Optional payerName; + + private final Map additionalProperties; + + private PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethod( + PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType deliveryType, + Optional iconUrl, + Optional payerName, + Map additionalProperties) { + this.deliveryType = deliveryType; + this.iconUrl = iconUrl; + this.payerName = payerName; + this.additionalProperties = additionalProperties; + } + + /** + * @return How the funds are delivered to the recipient. + */ + @JsonProperty("delivery_type") + public PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType getDeliveryType() { + return deliveryType; + } + + /** + * @return Supported payout method icon URL. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return Supported payout method display name. + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethod + && equalTo((PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethod other) { + return deliveryType.equals(other.deliveryType) + && iconUrl.equals(other.iconUrl) + && payerName.equals(other.payerName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deliveryType, this.iconUrl, this.payerName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeliveryTypeStage builder() { + return new Builder(); + } + + public interface DeliveryTypeStage { + /** + *

How the funds are delivered to the recipient.

+ */ + _FinalStage deliveryType( + @NotNull PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType deliveryType); + + Builder from(PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethod other); + } + + public interface _FinalStage { + PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Supported payout method icon URL.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Supported payout method display name.

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeliveryTypeStage, _FinalStage { + private PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType deliveryType; + + private Optional payerName = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethod other) { + deliveryType(other.getDeliveryType()); + iconUrl(other.getIconUrl()); + payerName(other.getPayerName()); + return this; + } + + /** + *

How the funds are delivered to the recipient.

+ *

How the funds are delivered to the recipient.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("delivery_type") + public _FinalStage deliveryType( + @NotNull PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType deliveryType) { + this.deliveryType = Objects.requireNonNull(deliveryType, "deliveryType must not be null"); + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

Supported payout method display name.

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Supported payout method icon URL.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + @java.lang.Override + public PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethod build() { + return new PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethod( + deliveryType, iconUrl, payerName, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType.java new file mode 100644 index 00000000..040de307 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType.java @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType { + public static final PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType PAPER_CHECK = + new PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.PAPER_CHECK, "paper_check"); + + public static final PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType CRYPTOCURRENCY = + new PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.CRYPTOCURRENCY, "cryptocurrency"); + + public static final PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType UNKNOWN = + new PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType(Value.UNKNOWN, "unknown"); + + public static final PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType HOME_DELIVERY = + new PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.HOME_DELIVERY, "home_delivery"); + + public static final PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType BANK_DEPOSIT = + new PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.BANK_DEPOSIT, "bank_deposit"); + + public static final PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType MASSPAY_CARD = + new PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.MASSPAY_CARD, "masspay_card"); + + public static final PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType MOBILE_WALLET = + new PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.MOBILE_WALLET, "mobile_wallet"); + + public static final PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType CASH_PICKUP = + new PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.CASH_PICKUP, "cash_pickup"); + + public static final PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType BILL = + new PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType(Value.BILL, "bill"); + + private final Value value; + + private final String string; + + PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType + && this.string.equals( + ((PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType) other) + .string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAPER_CHECK: + return visitor.visitPaperCheck(); + case CRYPTOCURRENCY: + return visitor.visitCryptocurrency(); + case UNKNOWN: + return visitor.visitUnknown(); + case HOME_DELIVERY: + return visitor.visitHomeDelivery(); + case BANK_DEPOSIT: + return visitor.visitBankDeposit(); + case MASSPAY_CARD: + return visitor.visitMasspayCard(); + case MOBILE_WALLET: + return visitor.visitMobileWallet(); + case CASH_PICKUP: + return visitor.visitCashPickup(); + case BILL: + return visitor.visitBill(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType valueOf(String value) { + switch (value) { + case "paper_check": + return PAPER_CHECK; + case "cryptocurrency": + return CRYPTOCURRENCY; + case "unknown": + return UNKNOWN; + case "home_delivery": + return HOME_DELIVERY; + case "bank_deposit": + return BANK_DEPOSIT; + case "masspay_card": + return MASSPAY_CARD; + case "mobile_wallet": + return MOBILE_WALLET; + case "cash_pickup": + return CASH_PICKUP; + case "bill": + return BILL; + default: + return new PostWithdrawalCreatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value._UNKNOWN, value); + } + } + + public enum Value { + CASH_PICKUP, + + BANK_DEPOSIT, + + HOME_DELIVERY, + + MOBILE_WALLET, + + MASSPAY_CARD, + + PAPER_CHECK, + + BILL, + + CRYPTOCURRENCY, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitCashPickup(); + + T visitBankDeposit(); + + T visitHomeDelivery(); + + T visitMobileWallet(); + + T visitMasspayCard(); + + T visitPaperCheck(); + + T visitBill(); + + T visitCryptocurrency(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataSource.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataSource.java new file mode 100644 index 00000000..38b421d5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataSource.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalCreatedPayloadDataSource { + public static final PostWithdrawalCreatedPayloadDataSource DASHBOARD = + new PostWithdrawalCreatedPayloadDataSource(Value.DASHBOARD, "dashboard"); + + public static final PostWithdrawalCreatedPayloadDataSource AUTOMATIC = + new PostWithdrawalCreatedPayloadDataSource(Value.AUTOMATIC, "automatic"); + + public static final PostWithdrawalCreatedPayloadDataSource API = + new PostWithdrawalCreatedPayloadDataSource(Value.API, "api"); + + private final Value value; + + private final String string; + + PostWithdrawalCreatedPayloadDataSource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalCreatedPayloadDataSource + && this.string.equals(((PostWithdrawalCreatedPayloadDataSource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DASHBOARD: + return visitor.visitDashboard(); + case AUTOMATIC: + return visitor.visitAutomatic(); + case API: + return visitor.visitApi(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalCreatedPayloadDataSource valueOf(String value) { + switch (value) { + case "dashboard": + return DASHBOARD; + case "automatic": + return AUTOMATIC; + case "api": + return API; + default: + return new PostWithdrawalCreatedPayloadDataSource(Value.UNKNOWN, value); + } + } + + public enum Value { + API, + + DASHBOARD, + + AUTOMATIC, + + UNKNOWN + } + + public interface Visitor { + T visitApi(); + + T visitDashboard(); + + T visitAutomatic(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataSpeed.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataSpeed.java new file mode 100644 index 00000000..7c97fcec --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataSpeed.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalCreatedPayloadDataSpeed { + public static final PostWithdrawalCreatedPayloadDataSpeed INSTANT = + new PostWithdrawalCreatedPayloadDataSpeed(Value.INSTANT, "instant"); + + public static final PostWithdrawalCreatedPayloadDataSpeed STANDARD = + new PostWithdrawalCreatedPayloadDataSpeed(Value.STANDARD, "standard"); + + private final Value value; + + private final String string; + + PostWithdrawalCreatedPayloadDataSpeed(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalCreatedPayloadDataSpeed + && this.string.equals(((PostWithdrawalCreatedPayloadDataSpeed) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTANT: + return visitor.visitInstant(); + case STANDARD: + return visitor.visitStandard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalCreatedPayloadDataSpeed valueOf(String value) { + switch (value) { + case "instant": + return INSTANT; + case "standard": + return STANDARD; + default: + return new PostWithdrawalCreatedPayloadDataSpeed(Value.UNKNOWN, value); + } + } + + public enum Value { + STANDARD, + + INSTANT, + + UNKNOWN + } + + public interface Visitor { + T visitStandard(); + + T visitInstant(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataStatus.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataStatus.java new file mode 100644 index 00000000..b81f092a --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadDataStatus.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalCreatedPayloadDataStatus { + public static final PostWithdrawalCreatedPayloadDataStatus FAILED = + new PostWithdrawalCreatedPayloadDataStatus(Value.FAILED, "failed"); + + public static final PostWithdrawalCreatedPayloadDataStatus PROCESSING = + new PostWithdrawalCreatedPayloadDataStatus(Value.PROCESSING, "processing"); + + public static final PostWithdrawalCreatedPayloadDataStatus CANCELED = + new PostWithdrawalCreatedPayloadDataStatus(Value.CANCELED, "canceled"); + + public static final PostWithdrawalCreatedPayloadDataStatus COMPLETED = + new PostWithdrawalCreatedPayloadDataStatus(Value.COMPLETED, "completed"); + + public static final PostWithdrawalCreatedPayloadDataStatus REQUESTED = + new PostWithdrawalCreatedPayloadDataStatus(Value.REQUESTED, "requested"); + + public static final PostWithdrawalCreatedPayloadDataStatus DENIED = + new PostWithdrawalCreatedPayloadDataStatus(Value.DENIED, "denied"); + + public static final PostWithdrawalCreatedPayloadDataStatus REVERSED = + new PostWithdrawalCreatedPayloadDataStatus(Value.REVERSED, "reversed"); + + public static final PostWithdrawalCreatedPayloadDataStatus IN_REVIEW = + new PostWithdrawalCreatedPayloadDataStatus(Value.IN_REVIEW, "in_review"); + + private final Value value; + + private final String string; + + PostWithdrawalCreatedPayloadDataStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalCreatedPayloadDataStatus + && this.string.equals(((PostWithdrawalCreatedPayloadDataStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case PROCESSING: + return visitor.visitProcessing(); + case CANCELED: + return visitor.visitCanceled(); + case COMPLETED: + return visitor.visitCompleted(); + case REQUESTED: + return visitor.visitRequested(); + case DENIED: + return visitor.visitDenied(); + case REVERSED: + return visitor.visitReversed(); + case IN_REVIEW: + return visitor.visitInReview(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalCreatedPayloadDataStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "processing": + return PROCESSING; + case "canceled": + return CANCELED; + case "completed": + return COMPLETED; + case "requested": + return REQUESTED; + case "denied": + return DENIED; + case "reversed": + return REVERSED; + case "in_review": + return IN_REVIEW; + default: + return new PostWithdrawalCreatedPayloadDataStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + REQUESTED, + + IN_REVIEW, + + PROCESSING, + + COMPLETED, + + REVERSED, + + CANCELED, + + FAILED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitRequested(); + + T visitInReview(); + + T visitProcessing(); + + T visitCompleted(); + + T visitReversed(); + + T visitCanceled(); + + T visitFailed(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadType.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadType.java new file mode 100644 index 00000000..9ec098df --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalCreatedPayloadType { + public static final PostWithdrawalCreatedPayloadType WITHDRAWAL_CREATED = + new PostWithdrawalCreatedPayloadType(Value.WITHDRAWAL_CREATED, "withdrawal.created"); + + private final Value value; + + private final String string; + + PostWithdrawalCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalCreatedPayloadType + && this.string.equals(((PostWithdrawalCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WITHDRAWAL_CREATED: + return visitor.visitWithdrawalCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalCreatedPayloadType valueOf(String value) { + switch (value) { + case "withdrawal.created": + return WITHDRAWAL_CREATED; + default: + return new PostWithdrawalCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + WITHDRAWAL_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitWithdrawalCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayload.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayload.java new file mode 100644 index 00000000..11303ab4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayload.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostWithdrawalReversedPayload.Builder.class) +public final class PostWithdrawalReversedPayload { + private final Optional accountId; + + private final PostWithdrawalReversedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostWithdrawalReversedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostWithdrawalReversedPayloadType type; + + private final Map additionalProperties; + + private PostWithdrawalReversedPayload( + Optional accountId, + PostWithdrawalReversedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostWithdrawalReversedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostWithdrawalReversedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostWithdrawalReversedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PostWithdrawalReversedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostWithdrawalReversedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostWithdrawalReversedPayload && equalTo((PostWithdrawalReversedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostWithdrawalReversedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostWithdrawalReversedPayloadApiVersion apiVersion); + + Builder from(PostWithdrawalReversedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PostWithdrawalReversedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostWithdrawalReversedPayloadType type); + } + + public interface _FinalStage { + PostWithdrawalReversedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostWithdrawalReversedPayloadApiVersion apiVersion; + + private PostWithdrawalReversedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostWithdrawalReversedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostWithdrawalReversedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostWithdrawalReversedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostWithdrawalReversedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostWithdrawalReversedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostWithdrawalReversedPayload build() { + return new PostWithdrawalReversedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadApiVersion.java new file mode 100644 index 00000000..522a1cb2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalReversedPayloadApiVersion { + public static final PostWithdrawalReversedPayloadApiVersion V1 = + new PostWithdrawalReversedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostWithdrawalReversedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalReversedPayloadApiVersion + && this.string.equals(((PostWithdrawalReversedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalReversedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostWithdrawalReversedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadData.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadData.java new file mode 100644 index 00000000..49f54d35 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadData.java @@ -0,0 +1,1404 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostWithdrawalReversedPayloadData.Builder.class) +public final class PostWithdrawalReversedPayloadData { + private final String amount; + + private final OffsetDateTime createdAt; + + private final String currency; + + private final Optional destinationAmount; + + private final Optional destinationCurrency; + + private final Optional estimatedArrival; + + private final Optional exchangeRate; + + private final Optional failure; + + private final String feeAmount; + + private final PostWithdrawalReversedPayloadDataFeePaidBy feePaidBy; + + private final String id; + + private final String markupFee; + + private final Map metadata; + + private final String netAmount; + + private final Optional notes; + + private final PostWithdrawalReversedPayloadDataObject object; + + private final Optional payerName; + + private final Optional payoutMethod; + + private final Optional payoutRequestId; + + private final Optional source; + + private final PostWithdrawalReversedPayloadDataSpeed speed; + + private final PostWithdrawalReversedPayloadDataStatus status; + + private final String statusDetail; + + private final Optional traceCode; + + private final Map additionalProperties; + + private PostWithdrawalReversedPayloadData( + String amount, + OffsetDateTime createdAt, + String currency, + Optional destinationAmount, + Optional destinationCurrency, + Optional estimatedArrival, + Optional exchangeRate, + Optional failure, + String feeAmount, + PostWithdrawalReversedPayloadDataFeePaidBy feePaidBy, + String id, + String markupFee, + Map metadata, + String netAmount, + Optional notes, + PostWithdrawalReversedPayloadDataObject object, + Optional payerName, + Optional payoutMethod, + Optional payoutRequestId, + Optional source, + PostWithdrawalReversedPayloadDataSpeed speed, + PostWithdrawalReversedPayloadDataStatus status, + String statusDetail, + Optional traceCode, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.currency = currency; + this.destinationAmount = destinationAmount; + this.destinationCurrency = destinationCurrency; + this.estimatedArrival = estimatedArrival; + this.exchangeRate = exchangeRate; + this.failure = failure; + this.feeAmount = feeAmount; + this.feePaidBy = feePaidBy; + this.id = id; + this.markupFee = markupFee; + this.metadata = metadata; + this.netAmount = netAmount; + this.notes = notes; + this.object = object; + this.payerName = payerName; + this.payoutMethod = payoutMethod; + this.payoutRequestId = payoutRequestId; + this.source = source; + this.speed = speed; + this.status = status; + this.statusDetail = statusDetail; + this.traceCode = traceCode; + this.additionalProperties = additionalProperties; + } + + /** + * @return The payout amount in whole currency units, as a decimal string. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + /** + * @return When the payout was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Payout currency. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion. + */ + @JsonIgnore + public Optional getDestinationAmount() { + if (destinationAmount == null) { + return Optional.empty(); + } + return destinationAmount; + } + + /** + * @return Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists. + */ + @JsonIgnore + public Optional getDestinationCurrency() { + if (destinationCurrency == null) { + return Optional.empty(); + } + return destinationCurrency; + } + + /** + * @return Estimated time the funds become available in the destination account. + */ + @JsonIgnore + public Optional getEstimatedArrival() { + if (estimatedArrival == null) { + return Optional.empty(); + } + return estimatedArrival; + } + + /** + * @return Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate. + */ + @JsonIgnore + public Optional getExchangeRate() { + if (exchangeRate == null) { + return Optional.empty(); + } + return exchangeRate; + } + + /** + * @return Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise. + */ + @JsonIgnore + public Optional getFailure() { + if (failure == null) { + return Optional.empty(); + } + return failure; + } + + /** + * @return The fee charged for the payout, in the payout currency, as a decimal string. + */ + @JsonProperty("fee_amount") + public String getFeeAmount() { + return feeAmount; + } + + /** + * @return Who bore the payout fee: the account itself, or its parent platform. + */ + @JsonProperty("fee_paid_by") + public PostWithdrawalReversedPayloadDataFeePaidBy getFeePaidBy() { + return feePaidBy; + } + + /** + * @return Payout ID, prefixed wdrl_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies. + */ + @JsonProperty("markup_fee") + public String getMarkupFee() { + return markupFee; + } + + /** + * @return Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters. + */ + @JsonProperty("metadata") + public Map getMetadata() { + return metadata; + } + + /** + * @return The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered. + */ + @JsonProperty("net_amount") + public String getNetAmount() { + return netAmount; + } + + /** + * @return Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + @JsonProperty("object") + public PostWithdrawalReversedPayloadDataObject getObject() { + return object; + } + + /** + * @return Name of the entity processing the payout. + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + /** + * @return The saved payout method used. Requires payout:destination:read; null without it. + */ + @JsonIgnore + public Optional getPayoutMethod() { + if (payoutMethod == null) { + return Optional.empty(); + } + return payoutMethod; + } + + /** + * @return Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts. + */ + @JsonIgnore + public Optional getPayoutRequestId() { + if (payoutRequestId == null) { + return Optional.empty(); + } + return payoutRequestId; + } + + /** + * @return How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling. + */ + @JsonIgnore + public Optional getSource() { + if (source == null) { + return Optional.empty(); + } + return source; + } + + /** + * @return Payout delivery speed. + */ + @JsonProperty("speed") + public PostWithdrawalReversedPayloadDataSpeed getSpeed() { + return speed; + } + + /** + * @return Current payout status. + */ + @JsonProperty("status") + public PostWithdrawalReversedPayloadDataStatus getStatus() { + return status; + } + + /** + * @return The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract. + */ + @JsonProperty("status_detail") + public String getStatusDetail() { + return statusDetail; + } + + /** + * @return ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH. + */ + @JsonIgnore + public Optional getTraceCode() { + if (traceCode == null) { + return Optional.empty(); + } + return traceCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination_amount") + private Optional _getDestinationAmount() { + return destinationAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination_currency") + private Optional _getDestinationCurrency() { + return destinationCurrency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("estimated_arrival") + private Optional _getEstimatedArrival() { + return estimatedArrival; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exchange_rate") + private Optional _getExchangeRate() { + return exchangeRate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure") + private Optional _getFailure() { + return failure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_method") + private Optional _getPayoutMethod() { + return payoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_request_id") + private Optional _getPayoutRequestId() { + return payoutRequestId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source") + private Optional _getSource() { + return source; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trace_code") + private Optional _getTraceCode() { + return traceCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostWithdrawalReversedPayloadData && equalTo((PostWithdrawalReversedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostWithdrawalReversedPayloadData other) { + return amount.equals(other.amount) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && destinationAmount.equals(other.destinationAmount) + && destinationCurrency.equals(other.destinationCurrency) + && estimatedArrival.equals(other.estimatedArrival) + && exchangeRate.equals(other.exchangeRate) + && failure.equals(other.failure) + && feeAmount.equals(other.feeAmount) + && feePaidBy.equals(other.feePaidBy) + && id.equals(other.id) + && markupFee.equals(other.markupFee) + && metadata.equals(other.metadata) + && netAmount.equals(other.netAmount) + && notes.equals(other.notes) + && object.equals(other.object) + && payerName.equals(other.payerName) + && payoutMethod.equals(other.payoutMethod) + && payoutRequestId.equals(other.payoutRequestId) + && source.equals(other.source) + && speed.equals(other.speed) + && status.equals(other.status) + && statusDetail.equals(other.statusDetail) + && traceCode.equals(other.traceCode); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.currency, + this.destinationAmount, + this.destinationCurrency, + this.estimatedArrival, + this.exchangeRate, + this.failure, + this.feeAmount, + this.feePaidBy, + this.id, + this.markupFee, + this.metadata, + this.netAmount, + this.notes, + this.object, + this.payerName, + this.payoutMethod, + this.payoutRequestId, + this.source, + this.speed, + this.status, + this.statusDetail, + this.traceCode); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The payout amount in whole currency units, as a decimal string.

+ */ + CreatedAtStage amount(@NotNull String amount); + + Builder from(PostWithdrawalReversedPayloadData other); + } + + public interface CreatedAtStage { + /** + *

When the payout was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

Payout currency.

+ */ + FeeAmountStage currency(@NotNull String currency); + } + + public interface FeeAmountStage { + /** + *

The fee charged for the payout, in the payout currency, as a decimal string.

+ */ + FeePaidByStage feeAmount(@NotNull String feeAmount); + } + + public interface FeePaidByStage { + /** + *

Who bore the payout fee: the account itself, or its parent platform.

+ */ + IdStage feePaidBy(@NotNull PostWithdrawalReversedPayloadDataFeePaidBy feePaidBy); + } + + public interface IdStage { + /** + *

Payout ID, prefixed wdrl_.

+ */ + MarkupFeeStage id(@NotNull String id); + } + + public interface MarkupFeeStage { + /** + *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ */ + NetAmountStage markupFee(@NotNull String markupFee); + } + + public interface NetAmountStage { + /** + *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ */ + ObjectStage netAmount(@NotNull String netAmount); + } + + public interface ObjectStage { + SpeedStage object(@NotNull PostWithdrawalReversedPayloadDataObject object); + } + + public interface SpeedStage { + /** + *

Payout delivery speed.

+ */ + StatusStage speed(@NotNull PostWithdrawalReversedPayloadDataSpeed speed); + } + + public interface StatusStage { + /** + *

Current payout status.

+ */ + StatusDetailStage status(@NotNull PostWithdrawalReversedPayloadDataStatus status); + } + + public interface StatusDetailStage { + /** + *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ */ + _FinalStage statusDetail(@NotNull String statusDetail); + } + + public interface _FinalStage { + PostWithdrawalReversedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ */ + _FinalStage destinationAmount(Optional destinationAmount); + + _FinalStage destinationAmount(String destinationAmount); + + _FinalStage destinationAmount(Nullable destinationAmount); + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ */ + _FinalStage destinationCurrency(Optional destinationCurrency); + + _FinalStage destinationCurrency(String destinationCurrency); + + _FinalStage destinationCurrency(Nullable destinationCurrency); + + /** + *

Estimated time the funds become available in the destination account.

+ */ + _FinalStage estimatedArrival(Optional estimatedArrival); + + _FinalStage estimatedArrival(OffsetDateTime estimatedArrival); + + _FinalStage estimatedArrival(Nullable estimatedArrival); + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ */ + _FinalStage exchangeRate(Optional exchangeRate); + + _FinalStage exchangeRate(Float exchangeRate); + + _FinalStage exchangeRate(Nullable exchangeRate); + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ */ + _FinalStage failure(Optional failure); + + _FinalStage failure(PostWithdrawalReversedPayloadDataFailure failure); + + _FinalStage failure(Nullable failure); + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ */ + _FinalStage metadata(Map metadata); + + _FinalStage putAllMetadata(Map metadata); + + _FinalStage metadata(String key, String value); + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + + /** + *

Name of the entity processing the payout.

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ */ + _FinalStage payoutMethod(Optional payoutMethod); + + _FinalStage payoutMethod(PostWithdrawalReversedPayloadDataPayoutMethod payoutMethod); + + _FinalStage payoutMethod(Nullable payoutMethod); + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ */ + _FinalStage payoutRequestId(Optional payoutRequestId); + + _FinalStage payoutRequestId(String payoutRequestId); + + _FinalStage payoutRequestId(Nullable payoutRequestId); + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ */ + _FinalStage source(Optional source); + + _FinalStage source(PostWithdrawalReversedPayloadDataSource source); + + _FinalStage source(Nullable source); + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ */ + _FinalStage traceCode(Optional traceCode); + + _FinalStage traceCode(String traceCode); + + _FinalStage traceCode(Nullable traceCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + CurrencyStage, + FeeAmountStage, + FeePaidByStage, + IdStage, + MarkupFeeStage, + NetAmountStage, + ObjectStage, + SpeedStage, + StatusStage, + StatusDetailStage, + _FinalStage { + private String amount; + + private OffsetDateTime createdAt; + + private String currency; + + private String feeAmount; + + private PostWithdrawalReversedPayloadDataFeePaidBy feePaidBy; + + private String id; + + private String markupFee; + + private String netAmount; + + private PostWithdrawalReversedPayloadDataObject object; + + private PostWithdrawalReversedPayloadDataSpeed speed; + + private PostWithdrawalReversedPayloadDataStatus status; + + private String statusDetail; + + private Optional traceCode = Optional.empty(); + + private Optional source = Optional.empty(); + + private Optional payoutRequestId = Optional.empty(); + + private Optional payoutMethod = Optional.empty(); + + private Optional payerName = Optional.empty(); + + private Optional notes = Optional.empty(); + + private Map metadata = new LinkedHashMap<>(); + + private Optional failure = Optional.empty(); + + private Optional exchangeRate = Optional.empty(); + + private Optional estimatedArrival = Optional.empty(); + + private Optional destinationCurrency = Optional.empty(); + + private Optional destinationAmount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostWithdrawalReversedPayloadData other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + destinationAmount(other.getDestinationAmount()); + destinationCurrency(other.getDestinationCurrency()); + estimatedArrival(other.getEstimatedArrival()); + exchangeRate(other.getExchangeRate()); + failure(other.getFailure()); + feeAmount(other.getFeeAmount()); + feePaidBy(other.getFeePaidBy()); + id(other.getId()); + markupFee(other.getMarkupFee()); + metadata(other.getMetadata()); + netAmount(other.getNetAmount()); + notes(other.getNotes()); + object(other.getObject()); + payerName(other.getPayerName()); + payoutMethod(other.getPayoutMethod()); + payoutRequestId(other.getPayoutRequestId()); + source(other.getSource()); + speed(other.getSpeed()); + status(other.getStatus()); + statusDetail(other.getStatusDetail()); + traceCode(other.getTraceCode()); + return this; + } + + /** + *

The payout amount in whole currency units, as a decimal string.

+ *

The payout amount in whole currency units, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

When the payout was created.

+ *

When the payout was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Payout currency.

+ *

Payout currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public FeeAmountStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The fee charged for the payout, in the payout currency, as a decimal string.

+ *

The fee charged for the payout, in the payout currency, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_amount") + public FeePaidByStage feeAmount(@NotNull String feeAmount) { + this.feeAmount = Objects.requireNonNull(feeAmount, "feeAmount must not be null"); + return this; + } + + /** + *

Who bore the payout fee: the account itself, or its parent platform.

+ *

Who bore the payout fee: the account itself, or its parent platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_paid_by") + public IdStage feePaidBy(@NotNull PostWithdrawalReversedPayloadDataFeePaidBy feePaidBy) { + this.feePaidBy = Objects.requireNonNull(feePaidBy, "feePaidBy must not be null"); + return this; + } + + /** + *

Payout ID, prefixed wdrl_.

+ *

Payout ID, prefixed wdrl_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MarkupFeeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("markup_fee") + public NetAmountStage markupFee(@NotNull String markupFee) { + this.markupFee = Objects.requireNonNull(markupFee, "markupFee must not be null"); + return this; + } + + /** + *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("net_amount") + public ObjectStage netAmount(@NotNull String netAmount) { + this.netAmount = Objects.requireNonNull(netAmount, "netAmount must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public SpeedStage object(@NotNull PostWithdrawalReversedPayloadDataObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Payout delivery speed.

+ *

Payout delivery speed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("speed") + public StatusStage speed(@NotNull PostWithdrawalReversedPayloadDataSpeed speed) { + this.speed = Objects.requireNonNull(speed, "speed must not be null"); + return this; + } + + /** + *

Current payout status.

+ *

Current payout status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public StatusDetailStage status(@NotNull PostWithdrawalReversedPayloadDataStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status_detail") + public _FinalStage statusDetail(@NotNull String statusDetail) { + this.statusDetail = Objects.requireNonNull(statusDetail, "statusDetail must not be null"); + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage traceCode(Nullable traceCode) { + if (traceCode.isNull()) { + this.traceCode = null; + } else if (traceCode.isEmpty()) { + this.traceCode = Optional.empty(); + } else { + this.traceCode = Optional.of(traceCode.get()); + } + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage traceCode(String traceCode) { + this.traceCode = Optional.ofNullable(traceCode); + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ */ + @java.lang.Override + @JsonSetter(value = "trace_code", nulls = Nulls.SKIP) + public _FinalStage traceCode(Optional traceCode) { + this.traceCode = traceCode; + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(Nullable source) { + if (source.isNull()) { + this.source = null; + } else if (source.isEmpty()) { + this.source = Optional.empty(); + } else { + this.source = Optional.of(source.get()); + } + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(PostWithdrawalReversedPayloadDataSource source) { + this.source = Optional.ofNullable(source); + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ */ + @java.lang.Override + @JsonSetter(value = "source", nulls = Nulls.SKIP) + public _FinalStage source(Optional source) { + this.source = source; + return this; + } + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(Nullable payoutRequestId) { + if (payoutRequestId.isNull()) { + this.payoutRequestId = null; + } else if (payoutRequestId.isEmpty()) { + this.payoutRequestId = Optional.empty(); + } else { + this.payoutRequestId = Optional.of(payoutRequestId.get()); + } + return this; + } + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(String payoutRequestId) { + this.payoutRequestId = Optional.ofNullable(payoutRequestId); + return this; + } + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_request_id", nulls = Nulls.SKIP) + public _FinalStage payoutRequestId(Optional payoutRequestId) { + this.payoutRequestId = payoutRequestId; + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutMethod(Nullable payoutMethod) { + if (payoutMethod.isNull()) { + this.payoutMethod = null; + } else if (payoutMethod.isEmpty()) { + this.payoutMethod = Optional.empty(); + } else { + this.payoutMethod = Optional.of(payoutMethod.get()); + } + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutMethod(PostWithdrawalReversedPayloadDataPayoutMethod payoutMethod) { + this.payoutMethod = Optional.ofNullable(payoutMethod); + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_method", nulls = Nulls.SKIP) + public _FinalStage payoutMethod(Optional payoutMethod) { + this.payoutMethod = payoutMethod; + return this; + } + + /** + *

Name of the entity processing the payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

Name of the entity processing the payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

Name of the entity processing the payout.

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(String key, String value) { + this.metadata.put(key, value); + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllMetadata(Map metadata) { + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Map metadata) { + this.metadata.clear(); + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failure(Nullable failure) { + if (failure.isNull()) { + this.failure = null; + } else if (failure.isEmpty()) { + this.failure = Optional.empty(); + } else { + this.failure = Optional.of(failure.get()); + } + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failure(PostWithdrawalReversedPayloadDataFailure failure) { + this.failure = Optional.ofNullable(failure); + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "failure", nulls = Nulls.SKIP) + public _FinalStage failure(Optional failure) { + this.failure = failure; + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage exchangeRate(Nullable exchangeRate) { + if (exchangeRate.isNull()) { + this.exchangeRate = null; + } else if (exchangeRate.isEmpty()) { + this.exchangeRate = Optional.empty(); + } else { + this.exchangeRate = Optional.of(exchangeRate.get()); + } + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage exchangeRate(Float exchangeRate) { + this.exchangeRate = Optional.ofNullable(exchangeRate); + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ */ + @java.lang.Override + @JsonSetter(value = "exchange_rate", nulls = Nulls.SKIP) + public _FinalStage exchangeRate(Optional exchangeRate) { + this.exchangeRate = exchangeRate; + return this; + } + + /** + *

Estimated time the funds become available in the destination account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(Nullable estimatedArrival) { + if (estimatedArrival.isNull()) { + this.estimatedArrival = null; + } else if (estimatedArrival.isEmpty()) { + this.estimatedArrival = Optional.empty(); + } else { + this.estimatedArrival = Optional.of(estimatedArrival.get()); + } + return this; + } + + /** + *

Estimated time the funds become available in the destination account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(OffsetDateTime estimatedArrival) { + this.estimatedArrival = Optional.ofNullable(estimatedArrival); + return this; + } + + /** + *

Estimated time the funds become available in the destination account.

+ */ + @java.lang.Override + @JsonSetter(value = "estimated_arrival", nulls = Nulls.SKIP) + public _FinalStage estimatedArrival(Optional estimatedArrival) { + this.estimatedArrival = estimatedArrival; + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationCurrency(Nullable destinationCurrency) { + if (destinationCurrency.isNull()) { + this.destinationCurrency = null; + } else if (destinationCurrency.isEmpty()) { + this.destinationCurrency = Optional.empty(); + } else { + this.destinationCurrency = Optional.of(destinationCurrency.get()); + } + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationCurrency(String destinationCurrency) { + this.destinationCurrency = Optional.ofNullable(destinationCurrency); + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ */ + @java.lang.Override + @JsonSetter(value = "destination_currency", nulls = Nulls.SKIP) + public _FinalStage destinationCurrency(Optional destinationCurrency) { + this.destinationCurrency = destinationCurrency; + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationAmount(Nullable destinationAmount) { + if (destinationAmount.isNull()) { + this.destinationAmount = null; + } else if (destinationAmount.isEmpty()) { + this.destinationAmount = Optional.empty(); + } else { + this.destinationAmount = Optional.of(destinationAmount.get()); + } + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationAmount(String destinationAmount) { + this.destinationAmount = Optional.ofNullable(destinationAmount); + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ */ + @java.lang.Override + @JsonSetter(value = "destination_amount", nulls = Nulls.SKIP) + public _FinalStage destinationAmount(Optional destinationAmount) { + this.destinationAmount = destinationAmount; + return this; + } + + @java.lang.Override + public PostWithdrawalReversedPayloadData build() { + return new PostWithdrawalReversedPayloadData( + amount, + createdAt, + currency, + destinationAmount, + destinationCurrency, + estimatedArrival, + exchangeRate, + failure, + feeAmount, + feePaidBy, + id, + markupFee, + metadata, + netAmount, + notes, + object, + payerName, + payoutMethod, + payoutRequestId, + source, + speed, + status, + statusDetail, + traceCode, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataFailure.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataFailure.java new file mode 100644 index 00000000..750b62e4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataFailure.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostWithdrawalReversedPayloadDataFailure.Builder.class) +public final class PostWithdrawalReversedPayloadDataFailure { + private final Optional code; + + private final Optional fundsReturnedAt; + + private final Optional message; + + private final Map additionalProperties; + + private PostWithdrawalReversedPayloadDataFailure( + Optional code, + Optional fundsReturnedAt, + Optional message, + Map additionalProperties) { + this.code = code; + this.fundsReturnedAt = fundsReturnedAt; + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return Classified failure code from the maintained error catalog. + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + /** + * @return The effective time of the reversal that put the funds back in the balance — null if they never left it or have not returned yet. Set only once the return is confirmed in the ledger; the ledger posting itself can land moments after this time. + */ + @JsonIgnore + public Optional getFundsReturnedAt() { + if (fundsReturnedAt == null) { + return Optional.empty(); + } + return fundsReturnedAt; + } + + /** + * @return Human-readable explanation of the failure. Callers holding payout:destination:read may receive text personalized to the destination; other callers get the generic catalog message. + */ + @JsonIgnore + public Optional getMessage() { + if (message == null) { + return Optional.empty(); + } + return message; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("funds_returned_at") + private Optional _getFundsReturnedAt() { + return fundsReturnedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("message") + private Optional _getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostWithdrawalReversedPayloadDataFailure + && equalTo((PostWithdrawalReversedPayloadDataFailure) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostWithdrawalReversedPayloadDataFailure other) { + return code.equals(other.code) + && fundsReturnedAt.equals(other.fundsReturnedAt) + && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.fundsReturnedAt, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional code = Optional.empty(); + + private Optional fundsReturnedAt = Optional.empty(); + + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PostWithdrawalReversedPayloadDataFailure other) { + code(other.getCode()); + fundsReturnedAt(other.getFundsReturnedAt()); + message(other.getMessage()); + return this; + } + + /** + *

Classified failure code from the maintained error catalog.

+ */ + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public Builder code(Optional code) { + this.code = code; + return this; + } + + public Builder code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + public Builder code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

The effective time of the reversal that put the funds back in the balance — null if they never left it or have not returned yet. Set only once the return is confirmed in the ledger; the ledger posting itself can land moments after this time.

+ */ + @JsonSetter(value = "funds_returned_at", nulls = Nulls.SKIP) + public Builder fundsReturnedAt(Optional fundsReturnedAt) { + this.fundsReturnedAt = fundsReturnedAt; + return this; + } + + public Builder fundsReturnedAt(OffsetDateTime fundsReturnedAt) { + this.fundsReturnedAt = Optional.ofNullable(fundsReturnedAt); + return this; + } + + public Builder fundsReturnedAt(Nullable fundsReturnedAt) { + if (fundsReturnedAt.isNull()) { + this.fundsReturnedAt = null; + } else if (fundsReturnedAt.isEmpty()) { + this.fundsReturnedAt = Optional.empty(); + } else { + this.fundsReturnedAt = Optional.of(fundsReturnedAt.get()); + } + return this; + } + + /** + *

Human-readable explanation of the failure. Callers holding payout:destination:read may receive text personalized to the destination; other callers get the generic catalog message.

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public Builder message(Nullable message) { + if (message.isNull()) { + this.message = null; + } else if (message.isEmpty()) { + this.message = Optional.empty(); + } else { + this.message = Optional.of(message.get()); + } + return this; + } + + public PostWithdrawalReversedPayloadDataFailure build() { + return new PostWithdrawalReversedPayloadDataFailure(code, fundsReturnedAt, message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataFeePaidBy.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataFeePaidBy.java new file mode 100644 index 00000000..ce16dc37 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataFeePaidBy.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalReversedPayloadDataFeePaidBy { + public static final PostWithdrawalReversedPayloadDataFeePaidBy SELF = + new PostWithdrawalReversedPayloadDataFeePaidBy(Value.SELF, "self"); + + public static final PostWithdrawalReversedPayloadDataFeePaidBy PLATFORM = + new PostWithdrawalReversedPayloadDataFeePaidBy(Value.PLATFORM, "platform"); + + private final Value value; + + private final String string; + + PostWithdrawalReversedPayloadDataFeePaidBy(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalReversedPayloadDataFeePaidBy + && this.string.equals(((PostWithdrawalReversedPayloadDataFeePaidBy) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF: + return visitor.visitSelf(); + case PLATFORM: + return visitor.visitPlatform(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalReversedPayloadDataFeePaidBy valueOf(String value) { + switch (value) { + case "self": + return SELF; + case "platform": + return PLATFORM; + default: + return new PostWithdrawalReversedPayloadDataFeePaidBy(Value.UNKNOWN, value); + } + } + + public enum Value { + SELF, + + PLATFORM, + + UNKNOWN + } + + public interface Visitor { + T visitSelf(); + + T visitPlatform(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataObject.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataObject.java new file mode 100644 index 00000000..deffc7c9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalReversedPayloadDataObject { + public static final PostWithdrawalReversedPayloadDataObject PAYOUT = + new PostWithdrawalReversedPayloadDataObject(Value.PAYOUT, "payout"); + + private final Value value; + + private final String string; + + PostWithdrawalReversedPayloadDataObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalReversedPayloadDataObject + && this.string.equals(((PostWithdrawalReversedPayloadDataObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYOUT: + return visitor.visitPayout(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalReversedPayloadDataObject valueOf(String value) { + switch (value) { + case "payout": + return PAYOUT; + default: + return new PostWithdrawalReversedPayloadDataObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYOUT, + + UNKNOWN + } + + public interface Visitor { + T visitPayout(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataPayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataPayoutMethod.java new file mode 100644 index 00000000..5aa2f204 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataPayoutMethod.java @@ -0,0 +1,191 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostWithdrawalReversedPayloadDataPayoutMethod.Builder.class) +public final class PostWithdrawalReversedPayloadDataPayoutMethod { + private final Optional nickname; + + private final Optional supportedPayoutMethod; + + private final Map additionalProperties; + + private PostWithdrawalReversedPayloadDataPayoutMethod( + Optional nickname, + Optional supportedPayoutMethod, + Map additionalProperties) { + this.nickname = nickname; + this.supportedPayoutMethod = supportedPayoutMethod; + this.additionalProperties = additionalProperties; + } + + /** + * @return Saved payout method nickname. + */ + @JsonIgnore + public Optional getNickname() { + if (nickname == null) { + return Optional.empty(); + } + return nickname; + } + + /** + * @return Supported payout method display details. + */ + @JsonIgnore + public Optional getSupportedPayoutMethod() { + if (supportedPayoutMethod == null) { + return Optional.empty(); + } + return supportedPayoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("nickname") + private Optional _getNickname() { + return nickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("supported_payout_method") + private Optional _getSupportedPayoutMethod() { + return supportedPayoutMethod; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostWithdrawalReversedPayloadDataPayoutMethod + && equalTo((PostWithdrawalReversedPayloadDataPayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostWithdrawalReversedPayloadDataPayoutMethod other) { + return nickname.equals(other.nickname) && supportedPayoutMethod.equals(other.supportedPayoutMethod); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.nickname, this.supportedPayoutMethod); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional nickname = Optional.empty(); + + private Optional supportedPayoutMethod = + Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PostWithdrawalReversedPayloadDataPayoutMethod other) { + nickname(other.getNickname()); + supportedPayoutMethod(other.getSupportedPayoutMethod()); + return this; + } + + /** + *

Saved payout method nickname.

+ */ + @JsonSetter(value = "nickname", nulls = Nulls.SKIP) + public Builder nickname(Optional nickname) { + this.nickname = nickname; + return this; + } + + public Builder nickname(String nickname) { + this.nickname = Optional.ofNullable(nickname); + return this; + } + + public Builder nickname(Nullable nickname) { + if (nickname.isNull()) { + this.nickname = null; + } else if (nickname.isEmpty()) { + this.nickname = Optional.empty(); + } else { + this.nickname = Optional.of(nickname.get()); + } + return this; + } + + /** + *

Supported payout method display details.

+ */ + @JsonSetter(value = "supported_payout_method", nulls = Nulls.SKIP) + public Builder supportedPayoutMethod( + Optional supportedPayoutMethod) { + this.supportedPayoutMethod = supportedPayoutMethod; + return this; + } + + public Builder supportedPayoutMethod( + PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethod supportedPayoutMethod) { + this.supportedPayoutMethod = Optional.ofNullable(supportedPayoutMethod); + return this; + } + + public Builder supportedPayoutMethod( + Nullable supportedPayoutMethod) { + if (supportedPayoutMethod.isNull()) { + this.supportedPayoutMethod = null; + } else if (supportedPayoutMethod.isEmpty()) { + this.supportedPayoutMethod = Optional.empty(); + } else { + this.supportedPayoutMethod = Optional.of(supportedPayoutMethod.get()); + } + return this; + } + + public PostWithdrawalReversedPayloadDataPayoutMethod build() { + return new PostWithdrawalReversedPayloadDataPayoutMethod( + nickname, supportedPayoutMethod, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethod.java new file mode 100644 index 00000000..88f555a8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethod.java @@ -0,0 +1,280 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethod.Builder.class) +public final class PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethod { + private final PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType deliveryType; + + private final Optional iconUrl; + + private final Optional payerName; + + private final Map additionalProperties; + + private PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethod( + PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType deliveryType, + Optional iconUrl, + Optional payerName, + Map additionalProperties) { + this.deliveryType = deliveryType; + this.iconUrl = iconUrl; + this.payerName = payerName; + this.additionalProperties = additionalProperties; + } + + /** + * @return How the funds are delivered to the recipient. + */ + @JsonProperty("delivery_type") + public PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType getDeliveryType() { + return deliveryType; + } + + /** + * @return Supported payout method icon URL. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return Supported payout method display name. + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethod + && equalTo((PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethod other) { + return deliveryType.equals(other.deliveryType) + && iconUrl.equals(other.iconUrl) + && payerName.equals(other.payerName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deliveryType, this.iconUrl, this.payerName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeliveryTypeStage builder() { + return new Builder(); + } + + public interface DeliveryTypeStage { + /** + *

How the funds are delivered to the recipient.

+ */ + _FinalStage deliveryType( + @NotNull PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType deliveryType); + + Builder from(PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethod other); + } + + public interface _FinalStage { + PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Supported payout method icon URL.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Supported payout method display name.

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeliveryTypeStage, _FinalStage { + private PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType deliveryType; + + private Optional payerName = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethod other) { + deliveryType(other.getDeliveryType()); + iconUrl(other.getIconUrl()); + payerName(other.getPayerName()); + return this; + } + + /** + *

How the funds are delivered to the recipient.

+ *

How the funds are delivered to the recipient.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("delivery_type") + public _FinalStage deliveryType( + @NotNull PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType deliveryType) { + this.deliveryType = Objects.requireNonNull(deliveryType, "deliveryType must not be null"); + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

Supported payout method display name.

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Supported payout method icon URL.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + @java.lang.Override + public PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethod build() { + return new PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethod( + deliveryType, iconUrl, payerName, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType.java new file mode 100644 index 00000000..db073b7a --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType.java @@ -0,0 +1,174 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType { + public static final PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType PAPER_CHECK = + new PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.PAPER_CHECK, "paper_check"); + + public static final PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType CRYPTOCURRENCY = + new PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.CRYPTOCURRENCY, "cryptocurrency"); + + public static final PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType UNKNOWN = + new PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.UNKNOWN, "unknown"); + + public static final PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType HOME_DELIVERY = + new PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.HOME_DELIVERY, "home_delivery"); + + public static final PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType BANK_DEPOSIT = + new PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.BANK_DEPOSIT, "bank_deposit"); + + public static final PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType MASSPAY_CARD = + new PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.MASSPAY_CARD, "masspay_card"); + + public static final PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType MOBILE_WALLET = + new PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.MOBILE_WALLET, "mobile_wallet"); + + public static final PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType CASH_PICKUP = + new PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.CASH_PICKUP, "cash_pickup"); + + public static final PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType BILL = + new PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType(Value.BILL, "bill"); + + private final Value value; + + private final String string; + + PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType + && this.string.equals( + ((PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType) other) + .string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAPER_CHECK: + return visitor.visitPaperCheck(); + case CRYPTOCURRENCY: + return visitor.visitCryptocurrency(); + case UNKNOWN: + return visitor.visitUnknown(); + case HOME_DELIVERY: + return visitor.visitHomeDelivery(); + case BANK_DEPOSIT: + return visitor.visitBankDeposit(); + case MASSPAY_CARD: + return visitor.visitMasspayCard(); + case MOBILE_WALLET: + return visitor.visitMobileWallet(); + case CASH_PICKUP: + return visitor.visitCashPickup(); + case BILL: + return visitor.visitBill(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType valueOf(String value) { + switch (value) { + case "paper_check": + return PAPER_CHECK; + case "cryptocurrency": + return CRYPTOCURRENCY; + case "unknown": + return UNKNOWN; + case "home_delivery": + return HOME_DELIVERY; + case "bank_deposit": + return BANK_DEPOSIT; + case "masspay_card": + return MASSPAY_CARD; + case "mobile_wallet": + return MOBILE_WALLET; + case "cash_pickup": + return CASH_PICKUP; + case "bill": + return BILL; + default: + return new PostWithdrawalReversedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value._UNKNOWN, value); + } + } + + public enum Value { + CASH_PICKUP, + + BANK_DEPOSIT, + + HOME_DELIVERY, + + MOBILE_WALLET, + + MASSPAY_CARD, + + PAPER_CHECK, + + BILL, + + CRYPTOCURRENCY, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitCashPickup(); + + T visitBankDeposit(); + + T visitHomeDelivery(); + + T visitMobileWallet(); + + T visitMasspayCard(); + + T visitPaperCheck(); + + T visitBill(); + + T visitCryptocurrency(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataSource.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataSource.java new file mode 100644 index 00000000..326b4df5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataSource.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalReversedPayloadDataSource { + public static final PostWithdrawalReversedPayloadDataSource DASHBOARD = + new PostWithdrawalReversedPayloadDataSource(Value.DASHBOARD, "dashboard"); + + public static final PostWithdrawalReversedPayloadDataSource AUTOMATIC = + new PostWithdrawalReversedPayloadDataSource(Value.AUTOMATIC, "automatic"); + + public static final PostWithdrawalReversedPayloadDataSource API = + new PostWithdrawalReversedPayloadDataSource(Value.API, "api"); + + private final Value value; + + private final String string; + + PostWithdrawalReversedPayloadDataSource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalReversedPayloadDataSource + && this.string.equals(((PostWithdrawalReversedPayloadDataSource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DASHBOARD: + return visitor.visitDashboard(); + case AUTOMATIC: + return visitor.visitAutomatic(); + case API: + return visitor.visitApi(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalReversedPayloadDataSource valueOf(String value) { + switch (value) { + case "dashboard": + return DASHBOARD; + case "automatic": + return AUTOMATIC; + case "api": + return API; + default: + return new PostWithdrawalReversedPayloadDataSource(Value.UNKNOWN, value); + } + } + + public enum Value { + API, + + DASHBOARD, + + AUTOMATIC, + + UNKNOWN + } + + public interface Visitor { + T visitApi(); + + T visitDashboard(); + + T visitAutomatic(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataSpeed.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataSpeed.java new file mode 100644 index 00000000..ad930763 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataSpeed.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalReversedPayloadDataSpeed { + public static final PostWithdrawalReversedPayloadDataSpeed INSTANT = + new PostWithdrawalReversedPayloadDataSpeed(Value.INSTANT, "instant"); + + public static final PostWithdrawalReversedPayloadDataSpeed STANDARD = + new PostWithdrawalReversedPayloadDataSpeed(Value.STANDARD, "standard"); + + private final Value value; + + private final String string; + + PostWithdrawalReversedPayloadDataSpeed(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalReversedPayloadDataSpeed + && this.string.equals(((PostWithdrawalReversedPayloadDataSpeed) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTANT: + return visitor.visitInstant(); + case STANDARD: + return visitor.visitStandard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalReversedPayloadDataSpeed valueOf(String value) { + switch (value) { + case "instant": + return INSTANT; + case "standard": + return STANDARD; + default: + return new PostWithdrawalReversedPayloadDataSpeed(Value.UNKNOWN, value); + } + } + + public enum Value { + STANDARD, + + INSTANT, + + UNKNOWN + } + + public interface Visitor { + T visitStandard(); + + T visitInstant(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataStatus.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataStatus.java new file mode 100644 index 00000000..01ebc86d --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadDataStatus.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalReversedPayloadDataStatus { + public static final PostWithdrawalReversedPayloadDataStatus FAILED = + new PostWithdrawalReversedPayloadDataStatus(Value.FAILED, "failed"); + + public static final PostWithdrawalReversedPayloadDataStatus PROCESSING = + new PostWithdrawalReversedPayloadDataStatus(Value.PROCESSING, "processing"); + + public static final PostWithdrawalReversedPayloadDataStatus CANCELED = + new PostWithdrawalReversedPayloadDataStatus(Value.CANCELED, "canceled"); + + public static final PostWithdrawalReversedPayloadDataStatus COMPLETED = + new PostWithdrawalReversedPayloadDataStatus(Value.COMPLETED, "completed"); + + public static final PostWithdrawalReversedPayloadDataStatus REQUESTED = + new PostWithdrawalReversedPayloadDataStatus(Value.REQUESTED, "requested"); + + public static final PostWithdrawalReversedPayloadDataStatus DENIED = + new PostWithdrawalReversedPayloadDataStatus(Value.DENIED, "denied"); + + public static final PostWithdrawalReversedPayloadDataStatus REVERSED = + new PostWithdrawalReversedPayloadDataStatus(Value.REVERSED, "reversed"); + + public static final PostWithdrawalReversedPayloadDataStatus IN_REVIEW = + new PostWithdrawalReversedPayloadDataStatus(Value.IN_REVIEW, "in_review"); + + private final Value value; + + private final String string; + + PostWithdrawalReversedPayloadDataStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalReversedPayloadDataStatus + && this.string.equals(((PostWithdrawalReversedPayloadDataStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case PROCESSING: + return visitor.visitProcessing(); + case CANCELED: + return visitor.visitCanceled(); + case COMPLETED: + return visitor.visitCompleted(); + case REQUESTED: + return visitor.visitRequested(); + case DENIED: + return visitor.visitDenied(); + case REVERSED: + return visitor.visitReversed(); + case IN_REVIEW: + return visitor.visitInReview(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalReversedPayloadDataStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "processing": + return PROCESSING; + case "canceled": + return CANCELED; + case "completed": + return COMPLETED; + case "requested": + return REQUESTED; + case "denied": + return DENIED; + case "reversed": + return REVERSED; + case "in_review": + return IN_REVIEW; + default: + return new PostWithdrawalReversedPayloadDataStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + REQUESTED, + + IN_REVIEW, + + PROCESSING, + + COMPLETED, + + REVERSED, + + CANCELED, + + FAILED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitRequested(); + + T visitInReview(); + + T visitProcessing(); + + T visitCompleted(); + + T visitReversed(); + + T visitCanceled(); + + T visitFailed(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadType.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadType.java new file mode 100644 index 00000000..7d526c4b --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalReversedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalReversedPayloadType { + public static final PostWithdrawalReversedPayloadType WITHDRAWAL_REVERSED = + new PostWithdrawalReversedPayloadType(Value.WITHDRAWAL_REVERSED, "withdrawal.reversed"); + + private final Value value; + + private final String string; + + PostWithdrawalReversedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalReversedPayloadType + && this.string.equals(((PostWithdrawalReversedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WITHDRAWAL_REVERSED: + return visitor.visitWithdrawalReversed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalReversedPayloadType valueOf(String value) { + switch (value) { + case "withdrawal.reversed": + return WITHDRAWAL_REVERSED; + default: + return new PostWithdrawalReversedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + WITHDRAWAL_REVERSED, + + UNKNOWN + } + + public interface Visitor { + T visitWithdrawalReversed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayload.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayload.java new file mode 100644 index 00000000..9e332938 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayload.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostWithdrawalUpdatedPayload.Builder.class) +public final class PostWithdrawalUpdatedPayload { + private final Optional accountId; + + private final PostWithdrawalUpdatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostWithdrawalUpdatedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostWithdrawalUpdatedPayloadType type; + + private final Map additionalProperties; + + private PostWithdrawalUpdatedPayload( + Optional accountId, + PostWithdrawalUpdatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostWithdrawalUpdatedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostWithdrawalUpdatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostWithdrawalUpdatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PostWithdrawalUpdatedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostWithdrawalUpdatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostWithdrawalUpdatedPayload && equalTo((PostWithdrawalUpdatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostWithdrawalUpdatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostWithdrawalUpdatedPayloadApiVersion apiVersion); + + Builder from(PostWithdrawalUpdatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PostWithdrawalUpdatedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostWithdrawalUpdatedPayloadType type); + } + + public interface _FinalStage { + PostWithdrawalUpdatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostWithdrawalUpdatedPayloadApiVersion apiVersion; + + private PostWithdrawalUpdatedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostWithdrawalUpdatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostWithdrawalUpdatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostWithdrawalUpdatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostWithdrawalUpdatedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostWithdrawalUpdatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostWithdrawalUpdatedPayload build() { + return new PostWithdrawalUpdatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadApiVersion.java new file mode 100644 index 00000000..639a4dd5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalUpdatedPayloadApiVersion { + public static final PostWithdrawalUpdatedPayloadApiVersion V1 = + new PostWithdrawalUpdatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostWithdrawalUpdatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalUpdatedPayloadApiVersion + && this.string.equals(((PostWithdrawalUpdatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalUpdatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostWithdrawalUpdatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadData.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadData.java new file mode 100644 index 00000000..268dcfe8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadData.java @@ -0,0 +1,1404 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostWithdrawalUpdatedPayloadData.Builder.class) +public final class PostWithdrawalUpdatedPayloadData { + private final String amount; + + private final OffsetDateTime createdAt; + + private final String currency; + + private final Optional destinationAmount; + + private final Optional destinationCurrency; + + private final Optional estimatedArrival; + + private final Optional exchangeRate; + + private final Optional failure; + + private final String feeAmount; + + private final PostWithdrawalUpdatedPayloadDataFeePaidBy feePaidBy; + + private final String id; + + private final String markupFee; + + private final Map metadata; + + private final String netAmount; + + private final Optional notes; + + private final PostWithdrawalUpdatedPayloadDataObject object; + + private final Optional payerName; + + private final Optional payoutMethod; + + private final Optional payoutRequestId; + + private final Optional source; + + private final PostWithdrawalUpdatedPayloadDataSpeed speed; + + private final PostWithdrawalUpdatedPayloadDataStatus status; + + private final String statusDetail; + + private final Optional traceCode; + + private final Map additionalProperties; + + private PostWithdrawalUpdatedPayloadData( + String amount, + OffsetDateTime createdAt, + String currency, + Optional destinationAmount, + Optional destinationCurrency, + Optional estimatedArrival, + Optional exchangeRate, + Optional failure, + String feeAmount, + PostWithdrawalUpdatedPayloadDataFeePaidBy feePaidBy, + String id, + String markupFee, + Map metadata, + String netAmount, + Optional notes, + PostWithdrawalUpdatedPayloadDataObject object, + Optional payerName, + Optional payoutMethod, + Optional payoutRequestId, + Optional source, + PostWithdrawalUpdatedPayloadDataSpeed speed, + PostWithdrawalUpdatedPayloadDataStatus status, + String statusDetail, + Optional traceCode, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.currency = currency; + this.destinationAmount = destinationAmount; + this.destinationCurrency = destinationCurrency; + this.estimatedArrival = estimatedArrival; + this.exchangeRate = exchangeRate; + this.failure = failure; + this.feeAmount = feeAmount; + this.feePaidBy = feePaidBy; + this.id = id; + this.markupFee = markupFee; + this.metadata = metadata; + this.netAmount = netAmount; + this.notes = notes; + this.object = object; + this.payerName = payerName; + this.payoutMethod = payoutMethod; + this.payoutRequestId = payoutRequestId; + this.source = source; + this.speed = speed; + this.status = status; + this.statusDetail = statusDetail; + this.traceCode = traceCode; + this.additionalProperties = additionalProperties; + } + + /** + * @return The payout amount in whole currency units, as a decimal string. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + /** + * @return When the payout was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Payout currency. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion. + */ + @JsonIgnore + public Optional getDestinationAmount() { + if (destinationAmount == null) { + return Optional.empty(); + } + return destinationAmount; + } + + /** + * @return Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists. + */ + @JsonIgnore + public Optional getDestinationCurrency() { + if (destinationCurrency == null) { + return Optional.empty(); + } + return destinationCurrency; + } + + /** + * @return Estimated time the funds become available in the destination account. + */ + @JsonIgnore + public Optional getEstimatedArrival() { + if (estimatedArrival == null) { + return Optional.empty(); + } + return estimatedArrival; + } + + /** + * @return Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate. + */ + @JsonIgnore + public Optional getExchangeRate() { + if (exchangeRate == null) { + return Optional.empty(); + } + return exchangeRate; + } + + /** + * @return Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise. + */ + @JsonIgnore + public Optional getFailure() { + if (failure == null) { + return Optional.empty(); + } + return failure; + } + + /** + * @return The fee charged for the payout, in the payout currency, as a decimal string. + */ + @JsonProperty("fee_amount") + public String getFeeAmount() { + return feeAmount; + } + + /** + * @return Who bore the payout fee: the account itself, or its parent platform. + */ + @JsonProperty("fee_paid_by") + public PostWithdrawalUpdatedPayloadDataFeePaidBy getFeePaidBy() { + return feePaidBy; + } + + /** + * @return Payout ID, prefixed wdrl_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies. + */ + @JsonProperty("markup_fee") + public String getMarkupFee() { + return markupFee; + } + + /** + * @return Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters. + */ + @JsonProperty("metadata") + public Map getMetadata() { + return metadata; + } + + /** + * @return The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered. + */ + @JsonProperty("net_amount") + public String getNetAmount() { + return netAmount; + } + + /** + * @return Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + @JsonProperty("object") + public PostWithdrawalUpdatedPayloadDataObject getObject() { + return object; + } + + /** + * @return Name of the entity processing the payout. + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + /** + * @return The saved payout method used. Requires payout:destination:read; null without it. + */ + @JsonIgnore + public Optional getPayoutMethod() { + if (payoutMethod == null) { + return Optional.empty(); + } + return payoutMethod; + } + + /** + * @return Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts. + */ + @JsonIgnore + public Optional getPayoutRequestId() { + if (payoutRequestId == null) { + return Optional.empty(); + } + return payoutRequestId; + } + + /** + * @return How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling. + */ + @JsonIgnore + public Optional getSource() { + if (source == null) { + return Optional.empty(); + } + return source; + } + + /** + * @return Payout delivery speed. + */ + @JsonProperty("speed") + public PostWithdrawalUpdatedPayloadDataSpeed getSpeed() { + return speed; + } + + /** + * @return Current payout status. + */ + @JsonProperty("status") + public PostWithdrawalUpdatedPayloadDataStatus getStatus() { + return status; + } + + /** + * @return The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract. + */ + @JsonProperty("status_detail") + public String getStatusDetail() { + return statusDetail; + } + + /** + * @return ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH. + */ + @JsonIgnore + public Optional getTraceCode() { + if (traceCode == null) { + return Optional.empty(); + } + return traceCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination_amount") + private Optional _getDestinationAmount() { + return destinationAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination_currency") + private Optional _getDestinationCurrency() { + return destinationCurrency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("estimated_arrival") + private Optional _getEstimatedArrival() { + return estimatedArrival; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exchange_rate") + private Optional _getExchangeRate() { + return exchangeRate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure") + private Optional _getFailure() { + return failure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_method") + private Optional _getPayoutMethod() { + return payoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_request_id") + private Optional _getPayoutRequestId() { + return payoutRequestId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source") + private Optional _getSource() { + return source; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trace_code") + private Optional _getTraceCode() { + return traceCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostWithdrawalUpdatedPayloadData && equalTo((PostWithdrawalUpdatedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostWithdrawalUpdatedPayloadData other) { + return amount.equals(other.amount) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && destinationAmount.equals(other.destinationAmount) + && destinationCurrency.equals(other.destinationCurrency) + && estimatedArrival.equals(other.estimatedArrival) + && exchangeRate.equals(other.exchangeRate) + && failure.equals(other.failure) + && feeAmount.equals(other.feeAmount) + && feePaidBy.equals(other.feePaidBy) + && id.equals(other.id) + && markupFee.equals(other.markupFee) + && metadata.equals(other.metadata) + && netAmount.equals(other.netAmount) + && notes.equals(other.notes) + && object.equals(other.object) + && payerName.equals(other.payerName) + && payoutMethod.equals(other.payoutMethod) + && payoutRequestId.equals(other.payoutRequestId) + && source.equals(other.source) + && speed.equals(other.speed) + && status.equals(other.status) + && statusDetail.equals(other.statusDetail) + && traceCode.equals(other.traceCode); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.currency, + this.destinationAmount, + this.destinationCurrency, + this.estimatedArrival, + this.exchangeRate, + this.failure, + this.feeAmount, + this.feePaidBy, + this.id, + this.markupFee, + this.metadata, + this.netAmount, + this.notes, + this.object, + this.payerName, + this.payoutMethod, + this.payoutRequestId, + this.source, + this.speed, + this.status, + this.statusDetail, + this.traceCode); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The payout amount in whole currency units, as a decimal string.

+ */ + CreatedAtStage amount(@NotNull String amount); + + Builder from(PostWithdrawalUpdatedPayloadData other); + } + + public interface CreatedAtStage { + /** + *

When the payout was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

Payout currency.

+ */ + FeeAmountStage currency(@NotNull String currency); + } + + public interface FeeAmountStage { + /** + *

The fee charged for the payout, in the payout currency, as a decimal string.

+ */ + FeePaidByStage feeAmount(@NotNull String feeAmount); + } + + public interface FeePaidByStage { + /** + *

Who bore the payout fee: the account itself, or its parent platform.

+ */ + IdStage feePaidBy(@NotNull PostWithdrawalUpdatedPayloadDataFeePaidBy feePaidBy); + } + + public interface IdStage { + /** + *

Payout ID, prefixed wdrl_.

+ */ + MarkupFeeStage id(@NotNull String id); + } + + public interface MarkupFeeStage { + /** + *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ */ + NetAmountStage markupFee(@NotNull String markupFee); + } + + public interface NetAmountStage { + /** + *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ */ + ObjectStage netAmount(@NotNull String netAmount); + } + + public interface ObjectStage { + SpeedStage object(@NotNull PostWithdrawalUpdatedPayloadDataObject object); + } + + public interface SpeedStage { + /** + *

Payout delivery speed.

+ */ + StatusStage speed(@NotNull PostWithdrawalUpdatedPayloadDataSpeed speed); + } + + public interface StatusStage { + /** + *

Current payout status.

+ */ + StatusDetailStage status(@NotNull PostWithdrawalUpdatedPayloadDataStatus status); + } + + public interface StatusDetailStage { + /** + *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ */ + _FinalStage statusDetail(@NotNull String statusDetail); + } + + public interface _FinalStage { + PostWithdrawalUpdatedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ */ + _FinalStage destinationAmount(Optional destinationAmount); + + _FinalStage destinationAmount(String destinationAmount); + + _FinalStage destinationAmount(Nullable destinationAmount); + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ */ + _FinalStage destinationCurrency(Optional destinationCurrency); + + _FinalStage destinationCurrency(String destinationCurrency); + + _FinalStage destinationCurrency(Nullable destinationCurrency); + + /** + *

Estimated time the funds become available in the destination account.

+ */ + _FinalStage estimatedArrival(Optional estimatedArrival); + + _FinalStage estimatedArrival(OffsetDateTime estimatedArrival); + + _FinalStage estimatedArrival(Nullable estimatedArrival); + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ */ + _FinalStage exchangeRate(Optional exchangeRate); + + _FinalStage exchangeRate(Float exchangeRate); + + _FinalStage exchangeRate(Nullable exchangeRate); + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ */ + _FinalStage failure(Optional failure); + + _FinalStage failure(PostWithdrawalUpdatedPayloadDataFailure failure); + + _FinalStage failure(Nullable failure); + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ */ + _FinalStage metadata(Map metadata); + + _FinalStage putAllMetadata(Map metadata); + + _FinalStage metadata(String key, String value); + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + + /** + *

Name of the entity processing the payout.

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ */ + _FinalStage payoutMethod(Optional payoutMethod); + + _FinalStage payoutMethod(PostWithdrawalUpdatedPayloadDataPayoutMethod payoutMethod); + + _FinalStage payoutMethod(Nullable payoutMethod); + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ */ + _FinalStage payoutRequestId(Optional payoutRequestId); + + _FinalStage payoutRequestId(String payoutRequestId); + + _FinalStage payoutRequestId(Nullable payoutRequestId); + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ */ + _FinalStage source(Optional source); + + _FinalStage source(PostWithdrawalUpdatedPayloadDataSource source); + + _FinalStage source(Nullable source); + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ */ + _FinalStage traceCode(Optional traceCode); + + _FinalStage traceCode(String traceCode); + + _FinalStage traceCode(Nullable traceCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + CurrencyStage, + FeeAmountStage, + FeePaidByStage, + IdStage, + MarkupFeeStage, + NetAmountStage, + ObjectStage, + SpeedStage, + StatusStage, + StatusDetailStage, + _FinalStage { + private String amount; + + private OffsetDateTime createdAt; + + private String currency; + + private String feeAmount; + + private PostWithdrawalUpdatedPayloadDataFeePaidBy feePaidBy; + + private String id; + + private String markupFee; + + private String netAmount; + + private PostWithdrawalUpdatedPayloadDataObject object; + + private PostWithdrawalUpdatedPayloadDataSpeed speed; + + private PostWithdrawalUpdatedPayloadDataStatus status; + + private String statusDetail; + + private Optional traceCode = Optional.empty(); + + private Optional source = Optional.empty(); + + private Optional payoutRequestId = Optional.empty(); + + private Optional payoutMethod = Optional.empty(); + + private Optional payerName = Optional.empty(); + + private Optional notes = Optional.empty(); + + private Map metadata = new LinkedHashMap<>(); + + private Optional failure = Optional.empty(); + + private Optional exchangeRate = Optional.empty(); + + private Optional estimatedArrival = Optional.empty(); + + private Optional destinationCurrency = Optional.empty(); + + private Optional destinationAmount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostWithdrawalUpdatedPayloadData other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + destinationAmount(other.getDestinationAmount()); + destinationCurrency(other.getDestinationCurrency()); + estimatedArrival(other.getEstimatedArrival()); + exchangeRate(other.getExchangeRate()); + failure(other.getFailure()); + feeAmount(other.getFeeAmount()); + feePaidBy(other.getFeePaidBy()); + id(other.getId()); + markupFee(other.getMarkupFee()); + metadata(other.getMetadata()); + netAmount(other.getNetAmount()); + notes(other.getNotes()); + object(other.getObject()); + payerName(other.getPayerName()); + payoutMethod(other.getPayoutMethod()); + payoutRequestId(other.getPayoutRequestId()); + source(other.getSource()); + speed(other.getSpeed()); + status(other.getStatus()); + statusDetail(other.getStatusDetail()); + traceCode(other.getTraceCode()); + return this; + } + + /** + *

The payout amount in whole currency units, as a decimal string.

+ *

The payout amount in whole currency units, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

When the payout was created.

+ *

When the payout was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Payout currency.

+ *

Payout currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public FeeAmountStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The fee charged for the payout, in the payout currency, as a decimal string.

+ *

The fee charged for the payout, in the payout currency, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_amount") + public FeePaidByStage feeAmount(@NotNull String feeAmount) { + this.feeAmount = Objects.requireNonNull(feeAmount, "feeAmount must not be null"); + return this; + } + + /** + *

Who bore the payout fee: the account itself, or its parent platform.

+ *

Who bore the payout fee: the account itself, or its parent platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_paid_by") + public IdStage feePaidBy(@NotNull PostWithdrawalUpdatedPayloadDataFeePaidBy feePaidBy) { + this.feePaidBy = Objects.requireNonNull(feePaidBy, "feePaidBy must not be null"); + return this; + } + + /** + *

Payout ID, prefixed wdrl_.

+ *

Payout ID, prefixed wdrl_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MarkupFeeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("markup_fee") + public NetAmountStage markupFee(@NotNull String markupFee) { + this.markupFee = Objects.requireNonNull(markupFee, "markupFee must not be null"); + return this; + } + + /** + *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("net_amount") + public ObjectStage netAmount(@NotNull String netAmount) { + this.netAmount = Objects.requireNonNull(netAmount, "netAmount must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public SpeedStage object(@NotNull PostWithdrawalUpdatedPayloadDataObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Payout delivery speed.

+ *

Payout delivery speed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("speed") + public StatusStage speed(@NotNull PostWithdrawalUpdatedPayloadDataSpeed speed) { + this.speed = Objects.requireNonNull(speed, "speed must not be null"); + return this; + } + + /** + *

Current payout status.

+ *

Current payout status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public StatusDetailStage status(@NotNull PostWithdrawalUpdatedPayloadDataStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status_detail") + public _FinalStage statusDetail(@NotNull String statusDetail) { + this.statusDetail = Objects.requireNonNull(statusDetail, "statusDetail must not be null"); + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage traceCode(Nullable traceCode) { + if (traceCode.isNull()) { + this.traceCode = null; + } else if (traceCode.isEmpty()) { + this.traceCode = Optional.empty(); + } else { + this.traceCode = Optional.of(traceCode.get()); + } + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage traceCode(String traceCode) { + this.traceCode = Optional.ofNullable(traceCode); + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ */ + @java.lang.Override + @JsonSetter(value = "trace_code", nulls = Nulls.SKIP) + public _FinalStage traceCode(Optional traceCode) { + this.traceCode = traceCode; + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(Nullable source) { + if (source.isNull()) { + this.source = null; + } else if (source.isEmpty()) { + this.source = Optional.empty(); + } else { + this.source = Optional.of(source.get()); + } + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(PostWithdrawalUpdatedPayloadDataSource source) { + this.source = Optional.ofNullable(source); + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ */ + @java.lang.Override + @JsonSetter(value = "source", nulls = Nulls.SKIP) + public _FinalStage source(Optional source) { + this.source = source; + return this; + } + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(Nullable payoutRequestId) { + if (payoutRequestId.isNull()) { + this.payoutRequestId = null; + } else if (payoutRequestId.isEmpty()) { + this.payoutRequestId = Optional.empty(); + } else { + this.payoutRequestId = Optional.of(payoutRequestId.get()); + } + return this; + } + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(String payoutRequestId) { + this.payoutRequestId = Optional.ofNullable(payoutRequestId); + return this; + } + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. Match it to the settled payout in GET /payouts. Returns null for payouts not created by POST /payouts.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_request_id", nulls = Nulls.SKIP) + public _FinalStage payoutRequestId(Optional payoutRequestId) { + this.payoutRequestId = payoutRequestId; + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutMethod(Nullable payoutMethod) { + if (payoutMethod.isNull()) { + this.payoutMethod = null; + } else if (payoutMethod.isEmpty()) { + this.payoutMethod = Optional.empty(); + } else { + this.payoutMethod = Optional.of(payoutMethod.get()); + } + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutMethod(PostWithdrawalUpdatedPayloadDataPayoutMethod payoutMethod) { + this.payoutMethod = Optional.ofNullable(payoutMethod); + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_method", nulls = Nulls.SKIP) + public _FinalStage payoutMethod(Optional payoutMethod) { + this.payoutMethod = payoutMethod; + return this; + } + + /** + *

Name of the entity processing the payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

Name of the entity processing the payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

Name of the entity processing the payout.

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(String key, String value) { + this.metadata.put(key, value); + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllMetadata(Map metadata) { + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Map metadata) { + this.metadata.clear(); + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failure(Nullable failure) { + if (failure.isNull()) { + this.failure = null; + } else if (failure.isEmpty()) { + this.failure = Optional.empty(); + } else { + this.failure = Optional.of(failure.get()); + } + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failure(PostWithdrawalUpdatedPayloadDataFailure failure) { + this.failure = Optional.ofNullable(failure); + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "failure", nulls = Nulls.SKIP) + public _FinalStage failure(Optional failure) { + this.failure = failure; + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage exchangeRate(Nullable exchangeRate) { + if (exchangeRate.isNull()) { + this.exchangeRate = null; + } else if (exchangeRate.isEmpty()) { + this.exchangeRate = Optional.empty(); + } else { + this.exchangeRate = Optional.of(exchangeRate.get()); + } + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage exchangeRate(Float exchangeRate) { + this.exchangeRate = Optional.ofNullable(exchangeRate); + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ */ + @java.lang.Override + @JsonSetter(value = "exchange_rate", nulls = Nulls.SKIP) + public _FinalStage exchangeRate(Optional exchangeRate) { + this.exchangeRate = exchangeRate; + return this; + } + + /** + *

Estimated time the funds become available in the destination account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(Nullable estimatedArrival) { + if (estimatedArrival.isNull()) { + this.estimatedArrival = null; + } else if (estimatedArrival.isEmpty()) { + this.estimatedArrival = Optional.empty(); + } else { + this.estimatedArrival = Optional.of(estimatedArrival.get()); + } + return this; + } + + /** + *

Estimated time the funds become available in the destination account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(OffsetDateTime estimatedArrival) { + this.estimatedArrival = Optional.ofNullable(estimatedArrival); + return this; + } + + /** + *

Estimated time the funds become available in the destination account.

+ */ + @java.lang.Override + @JsonSetter(value = "estimated_arrival", nulls = Nulls.SKIP) + public _FinalStage estimatedArrival(Optional estimatedArrival) { + this.estimatedArrival = estimatedArrival; + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationCurrency(Nullable destinationCurrency) { + if (destinationCurrency.isNull()) { + this.destinationCurrency = null; + } else if (destinationCurrency.isEmpty()) { + this.destinationCurrency = Optional.empty(); + } else { + this.destinationCurrency = Optional.of(destinationCurrency.get()); + } + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationCurrency(String destinationCurrency) { + this.destinationCurrency = Optional.ofNullable(destinationCurrency); + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ */ + @java.lang.Override + @JsonSetter(value = "destination_currency", nulls = Nulls.SKIP) + public _FinalStage destinationCurrency(Optional destinationCurrency) { + this.destinationCurrency = destinationCurrency; + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationAmount(Nullable destinationAmount) { + if (destinationAmount.isNull()) { + this.destinationAmount = null; + } else if (destinationAmount.isEmpty()) { + this.destinationAmount = Optional.empty(); + } else { + this.destinationAmount = Optional.of(destinationAmount.get()); + } + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationAmount(String destinationAmount) { + this.destinationAmount = Optional.ofNullable(destinationAmount); + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ */ + @java.lang.Override + @JsonSetter(value = "destination_amount", nulls = Nulls.SKIP) + public _FinalStage destinationAmount(Optional destinationAmount) { + this.destinationAmount = destinationAmount; + return this; + } + + @java.lang.Override + public PostWithdrawalUpdatedPayloadData build() { + return new PostWithdrawalUpdatedPayloadData( + amount, + createdAt, + currency, + destinationAmount, + destinationCurrency, + estimatedArrival, + exchangeRate, + failure, + feeAmount, + feePaidBy, + id, + markupFee, + metadata, + netAmount, + notes, + object, + payerName, + payoutMethod, + payoutRequestId, + source, + speed, + status, + statusDetail, + traceCode, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataFailure.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataFailure.java new file mode 100644 index 00000000..e059ddb5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataFailure.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostWithdrawalUpdatedPayloadDataFailure.Builder.class) +public final class PostWithdrawalUpdatedPayloadDataFailure { + private final Optional code; + + private final Optional fundsReturnedAt; + + private final Optional message; + + private final Map additionalProperties; + + private PostWithdrawalUpdatedPayloadDataFailure( + Optional code, + Optional fundsReturnedAt, + Optional message, + Map additionalProperties) { + this.code = code; + this.fundsReturnedAt = fundsReturnedAt; + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return Classified failure code from the maintained error catalog. + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + /** + * @return The effective time of the reversal that put the funds back in the balance — null if they never left it or have not returned yet. Set only once the return is confirmed in the ledger; the ledger posting itself can land moments after this time. + */ + @JsonIgnore + public Optional getFundsReturnedAt() { + if (fundsReturnedAt == null) { + return Optional.empty(); + } + return fundsReturnedAt; + } + + /** + * @return Human-readable explanation of the failure. Callers holding payout:destination:read may receive text personalized to the destination; other callers get the generic catalog message. + */ + @JsonIgnore + public Optional getMessage() { + if (message == null) { + return Optional.empty(); + } + return message; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("funds_returned_at") + private Optional _getFundsReturnedAt() { + return fundsReturnedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("message") + private Optional _getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostWithdrawalUpdatedPayloadDataFailure + && equalTo((PostWithdrawalUpdatedPayloadDataFailure) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostWithdrawalUpdatedPayloadDataFailure other) { + return code.equals(other.code) + && fundsReturnedAt.equals(other.fundsReturnedAt) + && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.fundsReturnedAt, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional code = Optional.empty(); + + private Optional fundsReturnedAt = Optional.empty(); + + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PostWithdrawalUpdatedPayloadDataFailure other) { + code(other.getCode()); + fundsReturnedAt(other.getFundsReturnedAt()); + message(other.getMessage()); + return this; + } + + /** + *

Classified failure code from the maintained error catalog.

+ */ + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public Builder code(Optional code) { + this.code = code; + return this; + } + + public Builder code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + public Builder code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

The effective time of the reversal that put the funds back in the balance — null if they never left it or have not returned yet. Set only once the return is confirmed in the ledger; the ledger posting itself can land moments after this time.

+ */ + @JsonSetter(value = "funds_returned_at", nulls = Nulls.SKIP) + public Builder fundsReturnedAt(Optional fundsReturnedAt) { + this.fundsReturnedAt = fundsReturnedAt; + return this; + } + + public Builder fundsReturnedAt(OffsetDateTime fundsReturnedAt) { + this.fundsReturnedAt = Optional.ofNullable(fundsReturnedAt); + return this; + } + + public Builder fundsReturnedAt(Nullable fundsReturnedAt) { + if (fundsReturnedAt.isNull()) { + this.fundsReturnedAt = null; + } else if (fundsReturnedAt.isEmpty()) { + this.fundsReturnedAt = Optional.empty(); + } else { + this.fundsReturnedAt = Optional.of(fundsReturnedAt.get()); + } + return this; + } + + /** + *

Human-readable explanation of the failure. Callers holding payout:destination:read may receive text personalized to the destination; other callers get the generic catalog message.

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public Builder message(Nullable message) { + if (message.isNull()) { + this.message = null; + } else if (message.isEmpty()) { + this.message = Optional.empty(); + } else { + this.message = Optional.of(message.get()); + } + return this; + } + + public PostWithdrawalUpdatedPayloadDataFailure build() { + return new PostWithdrawalUpdatedPayloadDataFailure(code, fundsReturnedAt, message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataFeePaidBy.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataFeePaidBy.java new file mode 100644 index 00000000..33d5cb55 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataFeePaidBy.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalUpdatedPayloadDataFeePaidBy { + public static final PostWithdrawalUpdatedPayloadDataFeePaidBy SELF = + new PostWithdrawalUpdatedPayloadDataFeePaidBy(Value.SELF, "self"); + + public static final PostWithdrawalUpdatedPayloadDataFeePaidBy PLATFORM = + new PostWithdrawalUpdatedPayloadDataFeePaidBy(Value.PLATFORM, "platform"); + + private final Value value; + + private final String string; + + PostWithdrawalUpdatedPayloadDataFeePaidBy(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalUpdatedPayloadDataFeePaidBy + && this.string.equals(((PostWithdrawalUpdatedPayloadDataFeePaidBy) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF: + return visitor.visitSelf(); + case PLATFORM: + return visitor.visitPlatform(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalUpdatedPayloadDataFeePaidBy valueOf(String value) { + switch (value) { + case "self": + return SELF; + case "platform": + return PLATFORM; + default: + return new PostWithdrawalUpdatedPayloadDataFeePaidBy(Value.UNKNOWN, value); + } + } + + public enum Value { + SELF, + + PLATFORM, + + UNKNOWN + } + + public interface Visitor { + T visitSelf(); + + T visitPlatform(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataObject.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataObject.java new file mode 100644 index 00000000..58b8a3e9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalUpdatedPayloadDataObject { + public static final PostWithdrawalUpdatedPayloadDataObject PAYOUT = + new PostWithdrawalUpdatedPayloadDataObject(Value.PAYOUT, "payout"); + + private final Value value; + + private final String string; + + PostWithdrawalUpdatedPayloadDataObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalUpdatedPayloadDataObject + && this.string.equals(((PostWithdrawalUpdatedPayloadDataObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYOUT: + return visitor.visitPayout(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalUpdatedPayloadDataObject valueOf(String value) { + switch (value) { + case "payout": + return PAYOUT; + default: + return new PostWithdrawalUpdatedPayloadDataObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYOUT, + + UNKNOWN + } + + public interface Visitor { + T visitPayout(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataPayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataPayoutMethod.java new file mode 100644 index 00000000..fb84986b --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataPayoutMethod.java @@ -0,0 +1,191 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostWithdrawalUpdatedPayloadDataPayoutMethod.Builder.class) +public final class PostWithdrawalUpdatedPayloadDataPayoutMethod { + private final Optional nickname; + + private final Optional supportedPayoutMethod; + + private final Map additionalProperties; + + private PostWithdrawalUpdatedPayloadDataPayoutMethod( + Optional nickname, + Optional supportedPayoutMethod, + Map additionalProperties) { + this.nickname = nickname; + this.supportedPayoutMethod = supportedPayoutMethod; + this.additionalProperties = additionalProperties; + } + + /** + * @return Saved payout method nickname. + */ + @JsonIgnore + public Optional getNickname() { + if (nickname == null) { + return Optional.empty(); + } + return nickname; + } + + /** + * @return Supported payout method display details. + */ + @JsonIgnore + public Optional getSupportedPayoutMethod() { + if (supportedPayoutMethod == null) { + return Optional.empty(); + } + return supportedPayoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("nickname") + private Optional _getNickname() { + return nickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("supported_payout_method") + private Optional _getSupportedPayoutMethod() { + return supportedPayoutMethod; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostWithdrawalUpdatedPayloadDataPayoutMethod + && equalTo((PostWithdrawalUpdatedPayloadDataPayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostWithdrawalUpdatedPayloadDataPayoutMethod other) { + return nickname.equals(other.nickname) && supportedPayoutMethod.equals(other.supportedPayoutMethod); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.nickname, this.supportedPayoutMethod); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional nickname = Optional.empty(); + + private Optional supportedPayoutMethod = + Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PostWithdrawalUpdatedPayloadDataPayoutMethod other) { + nickname(other.getNickname()); + supportedPayoutMethod(other.getSupportedPayoutMethod()); + return this; + } + + /** + *

Saved payout method nickname.

+ */ + @JsonSetter(value = "nickname", nulls = Nulls.SKIP) + public Builder nickname(Optional nickname) { + this.nickname = nickname; + return this; + } + + public Builder nickname(String nickname) { + this.nickname = Optional.ofNullable(nickname); + return this; + } + + public Builder nickname(Nullable nickname) { + if (nickname.isNull()) { + this.nickname = null; + } else if (nickname.isEmpty()) { + this.nickname = Optional.empty(); + } else { + this.nickname = Optional.of(nickname.get()); + } + return this; + } + + /** + *

Supported payout method display details.

+ */ + @JsonSetter(value = "supported_payout_method", nulls = Nulls.SKIP) + public Builder supportedPayoutMethod( + Optional supportedPayoutMethod) { + this.supportedPayoutMethod = supportedPayoutMethod; + return this; + } + + public Builder supportedPayoutMethod( + PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethod supportedPayoutMethod) { + this.supportedPayoutMethod = Optional.ofNullable(supportedPayoutMethod); + return this; + } + + public Builder supportedPayoutMethod( + Nullable supportedPayoutMethod) { + if (supportedPayoutMethod.isNull()) { + this.supportedPayoutMethod = null; + } else if (supportedPayoutMethod.isEmpty()) { + this.supportedPayoutMethod = Optional.empty(); + } else { + this.supportedPayoutMethod = Optional.of(supportedPayoutMethod.get()); + } + return this; + } + + public PostWithdrawalUpdatedPayloadDataPayoutMethod build() { + return new PostWithdrawalUpdatedPayloadDataPayoutMethod( + nickname, supportedPayoutMethod, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethod.java new file mode 100644 index 00000000..5416e63b --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethod.java @@ -0,0 +1,280 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethod.Builder.class) +public final class PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethod { + private final PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType deliveryType; + + private final Optional iconUrl; + + private final Optional payerName; + + private final Map additionalProperties; + + private PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethod( + PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType deliveryType, + Optional iconUrl, + Optional payerName, + Map additionalProperties) { + this.deliveryType = deliveryType; + this.iconUrl = iconUrl; + this.payerName = payerName; + this.additionalProperties = additionalProperties; + } + + /** + * @return How the funds are delivered to the recipient. + */ + @JsonProperty("delivery_type") + public PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType getDeliveryType() { + return deliveryType; + } + + /** + * @return Supported payout method icon URL. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return Supported payout method display name. + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethod + && equalTo((PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethod other) { + return deliveryType.equals(other.deliveryType) + && iconUrl.equals(other.iconUrl) + && payerName.equals(other.payerName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deliveryType, this.iconUrl, this.payerName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeliveryTypeStage builder() { + return new Builder(); + } + + public interface DeliveryTypeStage { + /** + *

How the funds are delivered to the recipient.

+ */ + _FinalStage deliveryType( + @NotNull PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType deliveryType); + + Builder from(PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethod other); + } + + public interface _FinalStage { + PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Supported payout method icon URL.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Supported payout method display name.

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeliveryTypeStage, _FinalStage { + private PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType deliveryType; + + private Optional payerName = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethod other) { + deliveryType(other.getDeliveryType()); + iconUrl(other.getIconUrl()); + payerName(other.getPayerName()); + return this; + } + + /** + *

How the funds are delivered to the recipient.

+ *

How the funds are delivered to the recipient.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("delivery_type") + public _FinalStage deliveryType( + @NotNull PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType deliveryType) { + this.deliveryType = Objects.requireNonNull(deliveryType, "deliveryType must not be null"); + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

Supported payout method display name.

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Supported payout method icon URL.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + @java.lang.Override + public PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethod build() { + return new PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethod( + deliveryType, iconUrl, payerName, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType.java new file mode 100644 index 00000000..1d682355 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType.java @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType { + public static final PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType PAPER_CHECK = + new PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.PAPER_CHECK, "paper_check"); + + public static final PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType CRYPTOCURRENCY = + new PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.CRYPTOCURRENCY, "cryptocurrency"); + + public static final PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType UNKNOWN = + new PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType(Value.UNKNOWN, "unknown"); + + public static final PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType HOME_DELIVERY = + new PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.HOME_DELIVERY, "home_delivery"); + + public static final PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType BANK_DEPOSIT = + new PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.BANK_DEPOSIT, "bank_deposit"); + + public static final PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType MASSPAY_CARD = + new PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.MASSPAY_CARD, "masspay_card"); + + public static final PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType MOBILE_WALLET = + new PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.MOBILE_WALLET, "mobile_wallet"); + + public static final PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType CASH_PICKUP = + new PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value.CASH_PICKUP, "cash_pickup"); + + public static final PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType BILL = + new PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType(Value.BILL, "bill"); + + private final Value value; + + private final String string; + + PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType + && this.string.equals( + ((PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType) other) + .string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAPER_CHECK: + return visitor.visitPaperCheck(); + case CRYPTOCURRENCY: + return visitor.visitCryptocurrency(); + case UNKNOWN: + return visitor.visitUnknown(); + case HOME_DELIVERY: + return visitor.visitHomeDelivery(); + case BANK_DEPOSIT: + return visitor.visitBankDeposit(); + case MASSPAY_CARD: + return visitor.visitMasspayCard(); + case MOBILE_WALLET: + return visitor.visitMobileWallet(); + case CASH_PICKUP: + return visitor.visitCashPickup(); + case BILL: + return visitor.visitBill(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType valueOf(String value) { + switch (value) { + case "paper_check": + return PAPER_CHECK; + case "cryptocurrency": + return CRYPTOCURRENCY; + case "unknown": + return UNKNOWN; + case "home_delivery": + return HOME_DELIVERY; + case "bank_deposit": + return BANK_DEPOSIT; + case "masspay_card": + return MASSPAY_CARD; + case "mobile_wallet": + return MOBILE_WALLET; + case "cash_pickup": + return CASH_PICKUP; + case "bill": + return BILL; + default: + return new PostWithdrawalUpdatedPayloadDataPayoutMethodSupportedPayoutMethodDeliveryType( + Value._UNKNOWN, value); + } + } + + public enum Value { + CASH_PICKUP, + + BANK_DEPOSIT, + + HOME_DELIVERY, + + MOBILE_WALLET, + + MASSPAY_CARD, + + PAPER_CHECK, + + BILL, + + CRYPTOCURRENCY, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitCashPickup(); + + T visitBankDeposit(); + + T visitHomeDelivery(); + + T visitMobileWallet(); + + T visitMasspayCard(); + + T visitPaperCheck(); + + T visitBill(); + + T visitCryptocurrency(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataSource.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataSource.java new file mode 100644 index 00000000..c166094e --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataSource.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalUpdatedPayloadDataSource { + public static final PostWithdrawalUpdatedPayloadDataSource DASHBOARD = + new PostWithdrawalUpdatedPayloadDataSource(Value.DASHBOARD, "dashboard"); + + public static final PostWithdrawalUpdatedPayloadDataSource AUTOMATIC = + new PostWithdrawalUpdatedPayloadDataSource(Value.AUTOMATIC, "automatic"); + + public static final PostWithdrawalUpdatedPayloadDataSource API = + new PostWithdrawalUpdatedPayloadDataSource(Value.API, "api"); + + private final Value value; + + private final String string; + + PostWithdrawalUpdatedPayloadDataSource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalUpdatedPayloadDataSource + && this.string.equals(((PostWithdrawalUpdatedPayloadDataSource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DASHBOARD: + return visitor.visitDashboard(); + case AUTOMATIC: + return visitor.visitAutomatic(); + case API: + return visitor.visitApi(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalUpdatedPayloadDataSource valueOf(String value) { + switch (value) { + case "dashboard": + return DASHBOARD; + case "automatic": + return AUTOMATIC; + case "api": + return API; + default: + return new PostWithdrawalUpdatedPayloadDataSource(Value.UNKNOWN, value); + } + } + + public enum Value { + API, + + DASHBOARD, + + AUTOMATIC, + + UNKNOWN + } + + public interface Visitor { + T visitApi(); + + T visitDashboard(); + + T visitAutomatic(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataSpeed.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataSpeed.java new file mode 100644 index 00000000..6145f09c --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataSpeed.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalUpdatedPayloadDataSpeed { + public static final PostWithdrawalUpdatedPayloadDataSpeed INSTANT = + new PostWithdrawalUpdatedPayloadDataSpeed(Value.INSTANT, "instant"); + + public static final PostWithdrawalUpdatedPayloadDataSpeed STANDARD = + new PostWithdrawalUpdatedPayloadDataSpeed(Value.STANDARD, "standard"); + + private final Value value; + + private final String string; + + PostWithdrawalUpdatedPayloadDataSpeed(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalUpdatedPayloadDataSpeed + && this.string.equals(((PostWithdrawalUpdatedPayloadDataSpeed) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTANT: + return visitor.visitInstant(); + case STANDARD: + return visitor.visitStandard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalUpdatedPayloadDataSpeed valueOf(String value) { + switch (value) { + case "instant": + return INSTANT; + case "standard": + return STANDARD; + default: + return new PostWithdrawalUpdatedPayloadDataSpeed(Value.UNKNOWN, value); + } + } + + public enum Value { + STANDARD, + + INSTANT, + + UNKNOWN + } + + public interface Visitor { + T visitStandard(); + + T visitInstant(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataStatus.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataStatus.java new file mode 100644 index 00000000..3818c67c --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadDataStatus.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalUpdatedPayloadDataStatus { + public static final PostWithdrawalUpdatedPayloadDataStatus FAILED = + new PostWithdrawalUpdatedPayloadDataStatus(Value.FAILED, "failed"); + + public static final PostWithdrawalUpdatedPayloadDataStatus PROCESSING = + new PostWithdrawalUpdatedPayloadDataStatus(Value.PROCESSING, "processing"); + + public static final PostWithdrawalUpdatedPayloadDataStatus CANCELED = + new PostWithdrawalUpdatedPayloadDataStatus(Value.CANCELED, "canceled"); + + public static final PostWithdrawalUpdatedPayloadDataStatus COMPLETED = + new PostWithdrawalUpdatedPayloadDataStatus(Value.COMPLETED, "completed"); + + public static final PostWithdrawalUpdatedPayloadDataStatus REQUESTED = + new PostWithdrawalUpdatedPayloadDataStatus(Value.REQUESTED, "requested"); + + public static final PostWithdrawalUpdatedPayloadDataStatus DENIED = + new PostWithdrawalUpdatedPayloadDataStatus(Value.DENIED, "denied"); + + public static final PostWithdrawalUpdatedPayloadDataStatus REVERSED = + new PostWithdrawalUpdatedPayloadDataStatus(Value.REVERSED, "reversed"); + + public static final PostWithdrawalUpdatedPayloadDataStatus IN_REVIEW = + new PostWithdrawalUpdatedPayloadDataStatus(Value.IN_REVIEW, "in_review"); + + private final Value value; + + private final String string; + + PostWithdrawalUpdatedPayloadDataStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalUpdatedPayloadDataStatus + && this.string.equals(((PostWithdrawalUpdatedPayloadDataStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case PROCESSING: + return visitor.visitProcessing(); + case CANCELED: + return visitor.visitCanceled(); + case COMPLETED: + return visitor.visitCompleted(); + case REQUESTED: + return visitor.visitRequested(); + case DENIED: + return visitor.visitDenied(); + case REVERSED: + return visitor.visitReversed(); + case IN_REVIEW: + return visitor.visitInReview(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalUpdatedPayloadDataStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "processing": + return PROCESSING; + case "canceled": + return CANCELED; + case "completed": + return COMPLETED; + case "requested": + return REQUESTED; + case "denied": + return DENIED; + case "reversed": + return REVERSED; + case "in_review": + return IN_REVIEW; + default: + return new PostWithdrawalUpdatedPayloadDataStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + REQUESTED, + + IN_REVIEW, + + PROCESSING, + + COMPLETED, + + REVERSED, + + CANCELED, + + FAILED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitRequested(); + + T visitInReview(); + + T visitProcessing(); + + T visitCompleted(); + + T visitReversed(); + + T visitCanceled(); + + T visitFailed(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadType.java b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadType.java new file mode 100644 index 00000000..16c8ead3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/PostWithdrawalUpdatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostWithdrawalUpdatedPayloadType { + public static final PostWithdrawalUpdatedPayloadType WITHDRAWAL_UPDATED = + new PostWithdrawalUpdatedPayloadType(Value.WITHDRAWAL_UPDATED, "withdrawal.updated"); + + private final Value value; + + private final String string; + + PostWithdrawalUpdatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostWithdrawalUpdatedPayloadType + && this.string.equals(((PostWithdrawalUpdatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WITHDRAWAL_UPDATED: + return visitor.visitWithdrawalUpdated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostWithdrawalUpdatedPayloadType valueOf(String value) { + switch (value) { + case "withdrawal.updated": + return WITHDRAWAL_UPDATED; + default: + return new PostWithdrawalUpdatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + WITHDRAWAL_UPDATED, + + UNKNOWN + } + + public interface Visitor { + T visitWithdrawalUpdated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponse.java b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponse.java new file mode 100644 index 00000000..7e4c2a2d --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponse.java @@ -0,0 +1,1404 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePayoutsResponse.Builder.class) +public final class RetrievePayoutsResponse { + private final String amount; + + private final OffsetDateTime createdAt; + + private final String currency; + + private final Optional destinationAmount; + + private final Optional destinationCurrency; + + private final Optional estimatedArrival; + + private final Optional exchangeRate; + + private final Optional failure; + + private final String feeAmount; + + private final RetrievePayoutsResponseFeePaidBy feePaidBy; + + private final String id; + + private final String markupFee; + + private final Map metadata; + + private final String netAmount; + + private final Optional notes; + + private final RetrievePayoutsResponseObject object; + + private final Optional payerName; + + private final Optional payoutMethod; + + private final Optional payoutRequestId; + + private final Optional source; + + private final RetrievePayoutsResponseSpeed speed; + + private final RetrievePayoutsResponseStatus status; + + private final String statusDetail; + + private final Optional traceCode; + + private final Map additionalProperties; + + private RetrievePayoutsResponse( + String amount, + OffsetDateTime createdAt, + String currency, + Optional destinationAmount, + Optional destinationCurrency, + Optional estimatedArrival, + Optional exchangeRate, + Optional failure, + String feeAmount, + RetrievePayoutsResponseFeePaidBy feePaidBy, + String id, + String markupFee, + Map metadata, + String netAmount, + Optional notes, + RetrievePayoutsResponseObject object, + Optional payerName, + Optional payoutMethod, + Optional payoutRequestId, + Optional source, + RetrievePayoutsResponseSpeed speed, + RetrievePayoutsResponseStatus status, + String statusDetail, + Optional traceCode, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.currency = currency; + this.destinationAmount = destinationAmount; + this.destinationCurrency = destinationCurrency; + this.estimatedArrival = estimatedArrival; + this.exchangeRate = exchangeRate; + this.failure = failure; + this.feeAmount = feeAmount; + this.feePaidBy = feePaidBy; + this.id = id; + this.markupFee = markupFee; + this.metadata = metadata; + this.netAmount = netAmount; + this.notes = notes; + this.object = object; + this.payerName = payerName; + this.payoutMethod = payoutMethod; + this.payoutRequestId = payoutRequestId; + this.source = source; + this.speed = speed; + this.status = status; + this.statusDetail = statusDetail; + this.traceCode = traceCode; + this.additionalProperties = additionalProperties; + } + + /** + * @return The payout amount in whole currency units, as a decimal string. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + /** + * @return When the payout was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Payout currency. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion. + */ + @JsonIgnore + public Optional getDestinationAmount() { + if (destinationAmount == null) { + return Optional.empty(); + } + return destinationAmount; + } + + /** + * @return Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists. + */ + @JsonIgnore + public Optional getDestinationCurrency() { + if (destinationCurrency == null) { + return Optional.empty(); + } + return destinationCurrency; + } + + /** + * @return Estimated time the funds become available in the destination account. + */ + @JsonIgnore + public Optional getEstimatedArrival() { + if (estimatedArrival == null) { + return Optional.empty(); + } + return estimatedArrival; + } + + /** + * @return Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate. + */ + @JsonIgnore + public Optional getExchangeRate() { + if (exchangeRate == null) { + return Optional.empty(); + } + return exchangeRate; + } + + /** + * @return Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise. + */ + @JsonIgnore + public Optional getFailure() { + if (failure == null) { + return Optional.empty(); + } + return failure; + } + + /** + * @return The fee charged for the payout, in the payout currency, as a decimal string. + */ + @JsonProperty("fee_amount") + public String getFeeAmount() { + return feeAmount; + } + + /** + * @return Who bore the payout fee: the account itself, or its parent platform. + */ + @JsonProperty("fee_paid_by") + public RetrievePayoutsResponseFeePaidBy getFeePaidBy() { + return feePaidBy; + } + + /** + * @return Payout ID, prefixed wdrl_ for a payout returned by GET /payouts or cofr_ for a payout request returned by POST /payouts. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies. + */ + @JsonProperty("markup_fee") + public String getMarkupFee() { + return markupFee; + } + + /** + * @return Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters. + */ + @JsonProperty("metadata") + public Map getMetadata() { + return metadata; + } + + /** + * @return The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered. + */ + @JsonProperty("net_amount") + public String getNetAmount() { + return netAmount; + } + + /** + * @return Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + @JsonProperty("object") + public RetrievePayoutsResponseObject getObject() { + return object; + } + + /** + * @return Name of the entity processing the payout. + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + /** + * @return The saved payout method used. Requires payout:destination:read; null without it. + */ + @JsonIgnore + public Optional getPayoutMethod() { + if (payoutMethod == null) { + return Optional.empty(); + } + return payoutMethod; + } + + /** + * @return Payout request ID, prefixed cofr_, returned by POST /payouts. For a request retrieved by its own cofr_ ID, this equals id. Returns null for payouts not created by POST /payouts. + */ + @JsonIgnore + public Optional getPayoutRequestId() { + if (payoutRequestId == null) { + return Optional.empty(); + } + return payoutRequestId; + } + + /** + * @return How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling. + */ + @JsonIgnore + public Optional getSource() { + if (source == null) { + return Optional.empty(); + } + return source; + } + + /** + * @return Payout delivery speed. + */ + @JsonProperty("speed") + public RetrievePayoutsResponseSpeed getSpeed() { + return speed; + } + + /** + * @return Current payout status. + */ + @JsonProperty("status") + public RetrievePayoutsResponseStatus getStatus() { + return status; + } + + /** + * @return The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract. + */ + @JsonProperty("status_detail") + public String getStatusDetail() { + return statusDetail; + } + + /** + * @return ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH. + */ + @JsonIgnore + public Optional getTraceCode() { + if (traceCode == null) { + return Optional.empty(); + } + return traceCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination_amount") + private Optional _getDestinationAmount() { + return destinationAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination_currency") + private Optional _getDestinationCurrency() { + return destinationCurrency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("estimated_arrival") + private Optional _getEstimatedArrival() { + return estimatedArrival; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exchange_rate") + private Optional _getExchangeRate() { + return exchangeRate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure") + private Optional _getFailure() { + return failure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_method") + private Optional _getPayoutMethod() { + return payoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_request_id") + private Optional _getPayoutRequestId() { + return payoutRequestId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source") + private Optional _getSource() { + return source; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trace_code") + private Optional _getTraceCode() { + return traceCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePayoutsResponse && equalTo((RetrievePayoutsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePayoutsResponse other) { + return amount.equals(other.amount) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && destinationAmount.equals(other.destinationAmount) + && destinationCurrency.equals(other.destinationCurrency) + && estimatedArrival.equals(other.estimatedArrival) + && exchangeRate.equals(other.exchangeRate) + && failure.equals(other.failure) + && feeAmount.equals(other.feeAmount) + && feePaidBy.equals(other.feePaidBy) + && id.equals(other.id) + && markupFee.equals(other.markupFee) + && metadata.equals(other.metadata) + && netAmount.equals(other.netAmount) + && notes.equals(other.notes) + && object.equals(other.object) + && payerName.equals(other.payerName) + && payoutMethod.equals(other.payoutMethod) + && payoutRequestId.equals(other.payoutRequestId) + && source.equals(other.source) + && speed.equals(other.speed) + && status.equals(other.status) + && statusDetail.equals(other.statusDetail) + && traceCode.equals(other.traceCode); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.currency, + this.destinationAmount, + this.destinationCurrency, + this.estimatedArrival, + this.exchangeRate, + this.failure, + this.feeAmount, + this.feePaidBy, + this.id, + this.markupFee, + this.metadata, + this.netAmount, + this.notes, + this.object, + this.payerName, + this.payoutMethod, + this.payoutRequestId, + this.source, + this.speed, + this.status, + this.statusDetail, + this.traceCode); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The payout amount in whole currency units, as a decimal string.

+ */ + CreatedAtStage amount(@NotNull String amount); + + Builder from(RetrievePayoutsResponse other); + } + + public interface CreatedAtStage { + /** + *

When the payout was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

Payout currency.

+ */ + FeeAmountStage currency(@NotNull String currency); + } + + public interface FeeAmountStage { + /** + *

The fee charged for the payout, in the payout currency, as a decimal string.

+ */ + FeePaidByStage feeAmount(@NotNull String feeAmount); + } + + public interface FeePaidByStage { + /** + *

Who bore the payout fee: the account itself, or its parent platform.

+ */ + IdStage feePaidBy(@NotNull RetrievePayoutsResponseFeePaidBy feePaidBy); + } + + public interface IdStage { + /** + *

Payout ID, prefixed wdrl_ for a payout returned by GET /payouts or cofr_ for a payout request returned by POST /payouts.

+ */ + MarkupFeeStage id(@NotNull String id); + } + + public interface MarkupFeeStage { + /** + *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ */ + NetAmountStage markupFee(@NotNull String markupFee); + } + + public interface NetAmountStage { + /** + *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ */ + ObjectStage netAmount(@NotNull String netAmount); + } + + public interface ObjectStage { + SpeedStage object(@NotNull RetrievePayoutsResponseObject object); + } + + public interface SpeedStage { + /** + *

Payout delivery speed.

+ */ + StatusStage speed(@NotNull RetrievePayoutsResponseSpeed speed); + } + + public interface StatusStage { + /** + *

Current payout status.

+ */ + StatusDetailStage status(@NotNull RetrievePayoutsResponseStatus status); + } + + public interface StatusDetailStage { + /** + *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ */ + _FinalStage statusDetail(@NotNull String statusDetail); + } + + public interface _FinalStage { + RetrievePayoutsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ */ + _FinalStage destinationAmount(Optional destinationAmount); + + _FinalStage destinationAmount(String destinationAmount); + + _FinalStage destinationAmount(Nullable destinationAmount); + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ */ + _FinalStage destinationCurrency(Optional destinationCurrency); + + _FinalStage destinationCurrency(String destinationCurrency); + + _FinalStage destinationCurrency(Nullable destinationCurrency); + + /** + *

Estimated time the funds become available in the destination account.

+ */ + _FinalStage estimatedArrival(Optional estimatedArrival); + + _FinalStage estimatedArrival(OffsetDateTime estimatedArrival); + + _FinalStage estimatedArrival(Nullable estimatedArrival); + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ */ + _FinalStage exchangeRate(Optional exchangeRate); + + _FinalStage exchangeRate(Float exchangeRate); + + _FinalStage exchangeRate(Nullable exchangeRate); + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ */ + _FinalStage failure(Optional failure); + + _FinalStage failure(RetrievePayoutsResponseFailure failure); + + _FinalStage failure(Nullable failure); + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ */ + _FinalStage metadata(Map metadata); + + _FinalStage putAllMetadata(Map metadata); + + _FinalStage metadata(String key, String value); + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + + /** + *

Name of the entity processing the payout.

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ */ + _FinalStage payoutMethod(Optional payoutMethod); + + _FinalStage payoutMethod(RetrievePayoutsResponsePayoutMethod payoutMethod); + + _FinalStage payoutMethod(Nullable payoutMethod); + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. For a request retrieved by its own cofr_ ID, this equals id. Returns null for payouts not created by POST /payouts.

+ */ + _FinalStage payoutRequestId(Optional payoutRequestId); + + _FinalStage payoutRequestId(String payoutRequestId); + + _FinalStage payoutRequestId(Nullable payoutRequestId); + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ */ + _FinalStage source(Optional source); + + _FinalStage source(RetrievePayoutsResponseSource source); + + _FinalStage source(Nullable source); + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ */ + _FinalStage traceCode(Optional traceCode); + + _FinalStage traceCode(String traceCode); + + _FinalStage traceCode(Nullable traceCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + CurrencyStage, + FeeAmountStage, + FeePaidByStage, + IdStage, + MarkupFeeStage, + NetAmountStage, + ObjectStage, + SpeedStage, + StatusStage, + StatusDetailStage, + _FinalStage { + private String amount; + + private OffsetDateTime createdAt; + + private String currency; + + private String feeAmount; + + private RetrievePayoutsResponseFeePaidBy feePaidBy; + + private String id; + + private String markupFee; + + private String netAmount; + + private RetrievePayoutsResponseObject object; + + private RetrievePayoutsResponseSpeed speed; + + private RetrievePayoutsResponseStatus status; + + private String statusDetail; + + private Optional traceCode = Optional.empty(); + + private Optional source = Optional.empty(); + + private Optional payoutRequestId = Optional.empty(); + + private Optional payoutMethod = Optional.empty(); + + private Optional payerName = Optional.empty(); + + private Optional notes = Optional.empty(); + + private Map metadata = new LinkedHashMap<>(); + + private Optional failure = Optional.empty(); + + private Optional exchangeRate = Optional.empty(); + + private Optional estimatedArrival = Optional.empty(); + + private Optional destinationCurrency = Optional.empty(); + + private Optional destinationAmount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePayoutsResponse other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + destinationAmount(other.getDestinationAmount()); + destinationCurrency(other.getDestinationCurrency()); + estimatedArrival(other.getEstimatedArrival()); + exchangeRate(other.getExchangeRate()); + failure(other.getFailure()); + feeAmount(other.getFeeAmount()); + feePaidBy(other.getFeePaidBy()); + id(other.getId()); + markupFee(other.getMarkupFee()); + metadata(other.getMetadata()); + netAmount(other.getNetAmount()); + notes(other.getNotes()); + object(other.getObject()); + payerName(other.getPayerName()); + payoutMethod(other.getPayoutMethod()); + payoutRequestId(other.getPayoutRequestId()); + source(other.getSource()); + speed(other.getSpeed()); + status(other.getStatus()); + statusDetail(other.getStatusDetail()); + traceCode(other.getTraceCode()); + return this; + } + + /** + *

The payout amount in whole currency units, as a decimal string.

+ *

The payout amount in whole currency units, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

When the payout was created.

+ *

When the payout was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Payout currency.

+ *

Payout currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public FeeAmountStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The fee charged for the payout, in the payout currency, as a decimal string.

+ *

The fee charged for the payout, in the payout currency, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_amount") + public FeePaidByStage feeAmount(@NotNull String feeAmount) { + this.feeAmount = Objects.requireNonNull(feeAmount, "feeAmount must not be null"); + return this; + } + + /** + *

Who bore the payout fee: the account itself, or its parent platform.

+ *

Who bore the payout fee: the account itself, or its parent platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_paid_by") + public IdStage feePaidBy(@NotNull RetrievePayoutsResponseFeePaidBy feePaidBy) { + this.feePaidBy = Objects.requireNonNull(feePaidBy, "feePaidBy must not be null"); + return this; + } + + /** + *

Payout ID, prefixed wdrl_ for a payout returned by GET /payouts or cofr_ for a payout request returned by POST /payouts.

+ *

Payout ID, prefixed wdrl_ for a payout returned by GET /payouts or cofr_ for a payout request returned by POST /payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MarkupFeeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ *

Whop's markup on the provider fee, in the payout currency, as a decimal string. "0.0" when none applies.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("markup_fee") + public NetAmountStage markupFee(@NotNull String markupFee) { + this.markupFee = Objects.requireNonNull(markupFee, "markupFee must not be null"); + return this; + } + + /** + *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ *

The planned net for the destination, in the payout currency: amount minus fee_amount minus markup_fee when fee_paid_by is self; equal to amount when the platform covers the fees. A payout that ends denied, canceled, or failed delivered nothing — most keep the planned figure and failure says where the funds are, but a canceled stablecoin payout can report the settled outcome instead: amount carries what stayed in the balance, fees are zero because none were charged, and net_amount is 0 because nothing was delivered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("net_amount") + public ObjectStage netAmount(@NotNull String netAmount) { + this.netAmount = Objects.requireNonNull(netAmount, "netAmount must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public SpeedStage object(@NotNull RetrievePayoutsResponseObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Payout delivery speed.

+ *

Payout delivery speed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("speed") + public StatusStage speed(@NotNull RetrievePayoutsResponseSpeed speed) { + this.speed = Objects.requireNonNull(speed, "speed must not be null"); + return this; + } + + /** + *

Current payout status.

+ *

Current payout status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public StatusDetailStage status(@NotNull RetrievePayoutsResponseStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ *

The finest machine phase under status — for example awaiting_provider_acceptance vs in_transit under processing, or the stablecoin conversion phase under requested. Informational vocabulary: values can be added without a version bump; status is the versioned contract.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status_detail") + public _FinalStage statusDetail(@NotNull String statusDetail) { + this.statusDetail = Objects.requireNonNull(statusDetail, "statusDetail must not be null"); + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage traceCode(Nullable traceCode) { + if (traceCode.isNull()) { + this.traceCode = null; + } else if (traceCode.isEmpty()) { + this.traceCode = Optional.empty(); + } else { + this.traceCode = Optional.of(traceCode.get()); + } + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage traceCode(String traceCode) { + this.traceCode = Optional.ofNullable(traceCode); + return this; + } + + /** + *

ACH trace number the recipient's bank can use to locate this payout. Assigned when the payout is submitted to the bank, so it is null before then and on payouts not sent over ACH.

+ */ + @java.lang.Override + @JsonSetter(value = "trace_code", nulls = Nulls.SKIP) + public _FinalStage traceCode(Optional traceCode) { + this.traceCode = traceCode; + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(Nullable source) { + if (source.isNull()) { + this.source = null; + } else if (source.isEmpty()) { + this.source = Optional.empty(); + } else { + this.source = Optional.of(source.get()); + } + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(RetrievePayoutsResponseSource source) { + this.source = Optional.ofNullable(source); + return this; + } + + /** + *

How the payout was created. automatic means a scheduled auto-payout; null on payouts created before source tracking or through internal tooling.

+ */ + @java.lang.Override + @JsonSetter(value = "source", nulls = Nulls.SKIP) + public _FinalStage source(Optional source) { + this.source = source; + return this; + } + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. For a request retrieved by its own cofr_ ID, this equals id. Returns null for payouts not created by POST /payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(Nullable payoutRequestId) { + if (payoutRequestId.isNull()) { + this.payoutRequestId = null; + } else if (payoutRequestId.isEmpty()) { + this.payoutRequestId = Optional.empty(); + } else { + this.payoutRequestId = Optional.of(payoutRequestId.get()); + } + return this; + } + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. For a request retrieved by its own cofr_ ID, this equals id. Returns null for payouts not created by POST /payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(String payoutRequestId) { + this.payoutRequestId = Optional.ofNullable(payoutRequestId); + return this; + } + + /** + *

Payout request ID, prefixed cofr_, returned by POST /payouts. For a request retrieved by its own cofr_ ID, this equals id. Returns null for payouts not created by POST /payouts.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_request_id", nulls = Nulls.SKIP) + public _FinalStage payoutRequestId(Optional payoutRequestId) { + this.payoutRequestId = payoutRequestId; + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutMethod(Nullable payoutMethod) { + if (payoutMethod.isNull()) { + this.payoutMethod = null; + } else if (payoutMethod.isEmpty()) { + this.payoutMethod = Optional.empty(); + } else { + this.payoutMethod = Optional.of(payoutMethod.get()); + } + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutMethod(RetrievePayoutsResponsePayoutMethod payoutMethod) { + this.payoutMethod = Optional.ofNullable(payoutMethod); + return this; + } + + /** + *

The saved payout method used. Requires payout:destination:read; null without it.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_method", nulls = Nulls.SKIP) + public _FinalStage payoutMethod(Optional payoutMethod) { + this.payoutMethod = payoutMethod; + return this; + } + + /** + *

Name of the entity processing the payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

Name of the entity processing the payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

Name of the entity processing the payout.

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Free-form notes attached by the payout creator, or null when none were provided. Maximum 255 characters.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(String key, String value) { + this.metadata.put(key, value); + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllMetadata(Map metadata) { + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Key-value data attached at creation and echoed on every read. At most 50 keys, key names up to 40 characters, string values up to 500 characters.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Map metadata) { + this.metadata.clear(); + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failure(Nullable failure) { + if (failure.isNull()) { + this.failure = null; + } else if (failure.isEmpty()) { + this.failure = Optional.empty(); + } else { + this.failure = Optional.of(failure.get()); + } + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failure(RetrievePayoutsResponseFailure failure) { + this.failure = Optional.ofNullable(failure); + return this; + } + + /** + *

Why the payout ended without paying, or why it reversed after settlement. Present on failed, canceled, denied, and reversed payouts; null otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "failure", nulls = Nulls.SKIP) + public _FinalStage failure(Optional failure) { + this.failure = failure; + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage exchangeRate(Nullable exchangeRate) { + if (exchangeRate.isNull()) { + this.exchangeRate = null; + } else if (exchangeRate.isEmpty()) { + this.exchangeRate = Optional.empty(); + } else { + this.exchangeRate = Optional.of(exchangeRate.get()); + } + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage exchangeRate(Float exchangeRate) { + this.exchangeRate = Optional.ofNullable(exchangeRate); + return this; + } + + /** + *

Exchange rate from the payout currency to the destination currency. Assigned when the payout is processed, so it is null before then and on payouts without a recorded rate.

+ */ + @java.lang.Override + @JsonSetter(value = "exchange_rate", nulls = Nulls.SKIP) + public _FinalStage exchangeRate(Optional exchangeRate) { + this.exchangeRate = exchangeRate; + return this; + } + + /** + *

Estimated time the funds become available in the destination account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(Nullable estimatedArrival) { + if (estimatedArrival.isNull()) { + this.estimatedArrival = null; + } else if (estimatedArrival.isEmpty()) { + this.estimatedArrival = Optional.empty(); + } else { + this.estimatedArrival = Optional.of(estimatedArrival.get()); + } + return this; + } + + /** + *

Estimated time the funds become available in the destination account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(OffsetDateTime estimatedArrival) { + this.estimatedArrival = Optional.ofNullable(estimatedArrival); + return this; + } + + /** + *

Estimated time the funds become available in the destination account.

+ */ + @java.lang.Override + @JsonSetter(value = "estimated_arrival", nulls = Nulls.SKIP) + public _FinalStage estimatedArrival(Optional estimatedArrival) { + this.estimatedArrival = estimatedArrival; + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationCurrency(Nullable destinationCurrency) { + if (destinationCurrency.isNull()) { + this.destinationCurrency = null; + } else if (destinationCurrency.isEmpty()) { + this.destinationCurrency = Optional.empty(); + } else { + this.destinationCurrency = Optional.of(destinationCurrency.get()); + } + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationCurrency(String destinationCurrency) { + this.destinationCurrency = Optional.ofNullable(destinationCurrency); + return this; + } + + /** + *

Currency the funds are delivered in, taken from the payout method when the payout is created. On a stablecoin payout it follows the settlement payout minted alongside it — the GET /payouts row carrying this payout's id as payout_request_id — and is null only when no settlement payout exists.

+ */ + @java.lang.Override + @JsonSetter(value = "destination_currency", nulls = Nulls.SKIP) + public _FinalStage destinationCurrency(Optional destinationCurrency) { + this.destinationCurrency = destinationCurrency; + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationAmount(Nullable destinationAmount) { + if (destinationAmount.isNull()) { + this.destinationAmount = null; + } else if (destinationAmount.isEmpty()) { + this.destinationAmount = Optional.empty(); + } else { + this.destinationAmount = Optional.of(destinationAmount.get()); + } + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationAmount(String destinationAmount) { + this.destinationAmount = Optional.ofNullable(destinationAmount); + return this; + } + + /** + *

The amount delivered in the destination currency, as a decimal string. Assigned when the payout is processed, so it is null before then and on payouts without a recorded conversion.

+ */ + @java.lang.Override + @JsonSetter(value = "destination_amount", nulls = Nulls.SKIP) + public _FinalStage destinationAmount(Optional destinationAmount) { + this.destinationAmount = destinationAmount; + return this; + } + + @java.lang.Override + public RetrievePayoutsResponse build() { + return new RetrievePayoutsResponse( + amount, + createdAt, + currency, + destinationAmount, + destinationCurrency, + estimatedArrival, + exchangeRate, + failure, + feeAmount, + feePaidBy, + id, + markupFee, + metadata, + netAmount, + notes, + object, + payerName, + payoutMethod, + payoutRequestId, + source, + speed, + status, + statusDetail, + traceCode, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseFailure.java b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseFailure.java new file mode 100644 index 00000000..11ab31bd --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseFailure.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePayoutsResponseFailure.Builder.class) +public final class RetrievePayoutsResponseFailure { + private final Optional code; + + private final Optional fundsReturnedAt; + + private final Optional message; + + private final Map additionalProperties; + + private RetrievePayoutsResponseFailure( + Optional code, + Optional fundsReturnedAt, + Optional message, + Map additionalProperties) { + this.code = code; + this.fundsReturnedAt = fundsReturnedAt; + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return Classified failure code from the maintained error catalog. + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + /** + * @return The effective time of the reversal that put the funds back in the balance — null if they never left it or have not returned yet. Set only once the return is confirmed in the ledger; the ledger posting itself can land moments after this time. + */ + @JsonIgnore + public Optional getFundsReturnedAt() { + if (fundsReturnedAt == null) { + return Optional.empty(); + } + return fundsReturnedAt; + } + + /** + * @return Human-readable explanation of the failure. Callers holding payout:destination:read may receive text personalized to the destination; other callers get the generic catalog message. + */ + @JsonIgnore + public Optional getMessage() { + if (message == null) { + return Optional.empty(); + } + return message; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("funds_returned_at") + private Optional _getFundsReturnedAt() { + return fundsReturnedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("message") + private Optional _getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePayoutsResponseFailure && equalTo((RetrievePayoutsResponseFailure) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePayoutsResponseFailure other) { + return code.equals(other.code) + && fundsReturnedAt.equals(other.fundsReturnedAt) + && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.fundsReturnedAt, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional code = Optional.empty(); + + private Optional fundsReturnedAt = Optional.empty(); + + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePayoutsResponseFailure other) { + code(other.getCode()); + fundsReturnedAt(other.getFundsReturnedAt()); + message(other.getMessage()); + return this; + } + + /** + *

Classified failure code from the maintained error catalog.

+ */ + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public Builder code(Optional code) { + this.code = code; + return this; + } + + public Builder code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + public Builder code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

The effective time of the reversal that put the funds back in the balance — null if they never left it or have not returned yet. Set only once the return is confirmed in the ledger; the ledger posting itself can land moments after this time.

+ */ + @JsonSetter(value = "funds_returned_at", nulls = Nulls.SKIP) + public Builder fundsReturnedAt(Optional fundsReturnedAt) { + this.fundsReturnedAt = fundsReturnedAt; + return this; + } + + public Builder fundsReturnedAt(OffsetDateTime fundsReturnedAt) { + this.fundsReturnedAt = Optional.ofNullable(fundsReturnedAt); + return this; + } + + public Builder fundsReturnedAt(Nullable fundsReturnedAt) { + if (fundsReturnedAt.isNull()) { + this.fundsReturnedAt = null; + } else if (fundsReturnedAt.isEmpty()) { + this.fundsReturnedAt = Optional.empty(); + } else { + this.fundsReturnedAt = Optional.of(fundsReturnedAt.get()); + } + return this; + } + + /** + *

Human-readable explanation of the failure. Callers holding payout:destination:read may receive text personalized to the destination; other callers get the generic catalog message.

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public Builder message(Nullable message) { + if (message.isNull()) { + this.message = null; + } else if (message.isEmpty()) { + this.message = Optional.empty(); + } else { + this.message = Optional.of(message.get()); + } + return this; + } + + public RetrievePayoutsResponseFailure build() { + return new RetrievePayoutsResponseFailure(code, fundsReturnedAt, message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseFeePaidBy.java b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseFeePaidBy.java new file mode 100644 index 00000000..2449474b --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseFeePaidBy.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrievePayoutsResponseFeePaidBy { + public static final RetrievePayoutsResponseFeePaidBy SELF = + new RetrievePayoutsResponseFeePaidBy(Value.SELF, "self"); + + public static final RetrievePayoutsResponseFeePaidBy PLATFORM = + new RetrievePayoutsResponseFeePaidBy(Value.PLATFORM, "platform"); + + private final Value value; + + private final String string; + + RetrievePayoutsResponseFeePaidBy(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrievePayoutsResponseFeePaidBy + && this.string.equals(((RetrievePayoutsResponseFeePaidBy) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF: + return visitor.visitSelf(); + case PLATFORM: + return visitor.visitPlatform(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrievePayoutsResponseFeePaidBy valueOf(String value) { + switch (value) { + case "self": + return SELF; + case "platform": + return PLATFORM; + default: + return new RetrievePayoutsResponseFeePaidBy(Value.UNKNOWN, value); + } + } + + public enum Value { + SELF, + + PLATFORM, + + UNKNOWN + } + + public interface Visitor { + T visitSelf(); + + T visitPlatform(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseObject.java b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseObject.java new file mode 100644 index 00000000..edba422d --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrievePayoutsResponseObject { + public static final RetrievePayoutsResponseObject PAYOUT = + new RetrievePayoutsResponseObject(Value.PAYOUT, "payout"); + + private final Value value; + + private final String string; + + RetrievePayoutsResponseObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrievePayoutsResponseObject + && this.string.equals(((RetrievePayoutsResponseObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYOUT: + return visitor.visitPayout(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrievePayoutsResponseObject valueOf(String value) { + switch (value) { + case "payout": + return PAYOUT; + default: + return new RetrievePayoutsResponseObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYOUT, + + UNKNOWN + } + + public interface Visitor { + T visitPayout(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponsePayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponsePayoutMethod.java new file mode 100644 index 00000000..c1253cd5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponsePayoutMethod.java @@ -0,0 +1,190 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePayoutsResponsePayoutMethod.Builder.class) +public final class RetrievePayoutsResponsePayoutMethod { + private final Optional nickname; + + private final Optional supportedPayoutMethod; + + private final Map additionalProperties; + + private RetrievePayoutsResponsePayoutMethod( + Optional nickname, + Optional supportedPayoutMethod, + Map additionalProperties) { + this.nickname = nickname; + this.supportedPayoutMethod = supportedPayoutMethod; + this.additionalProperties = additionalProperties; + } + + /** + * @return Saved payout method nickname. + */ + @JsonIgnore + public Optional getNickname() { + if (nickname == null) { + return Optional.empty(); + } + return nickname; + } + + /** + * @return Supported payout method display details. + */ + @JsonIgnore + public Optional getSupportedPayoutMethod() { + if (supportedPayoutMethod == null) { + return Optional.empty(); + } + return supportedPayoutMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("nickname") + private Optional _getNickname() { + return nickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("supported_payout_method") + private Optional _getSupportedPayoutMethod() { + return supportedPayoutMethod; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePayoutsResponsePayoutMethod + && equalTo((RetrievePayoutsResponsePayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePayoutsResponsePayoutMethod other) { + return nickname.equals(other.nickname) && supportedPayoutMethod.equals(other.supportedPayoutMethod); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.nickname, this.supportedPayoutMethod); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional nickname = Optional.empty(); + + private Optional supportedPayoutMethod = + Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePayoutsResponsePayoutMethod other) { + nickname(other.getNickname()); + supportedPayoutMethod(other.getSupportedPayoutMethod()); + return this; + } + + /** + *

Saved payout method nickname.

+ */ + @JsonSetter(value = "nickname", nulls = Nulls.SKIP) + public Builder nickname(Optional nickname) { + this.nickname = nickname; + return this; + } + + public Builder nickname(String nickname) { + this.nickname = Optional.ofNullable(nickname); + return this; + } + + public Builder nickname(Nullable nickname) { + if (nickname.isNull()) { + this.nickname = null; + } else if (nickname.isEmpty()) { + this.nickname = Optional.empty(); + } else { + this.nickname = Optional.of(nickname.get()); + } + return this; + } + + /** + *

Supported payout method display details.

+ */ + @JsonSetter(value = "supported_payout_method", nulls = Nulls.SKIP) + public Builder supportedPayoutMethod( + Optional supportedPayoutMethod) { + this.supportedPayoutMethod = supportedPayoutMethod; + return this; + } + + public Builder supportedPayoutMethod( + RetrievePayoutsResponsePayoutMethodSupportedPayoutMethod supportedPayoutMethod) { + this.supportedPayoutMethod = Optional.ofNullable(supportedPayoutMethod); + return this; + } + + public Builder supportedPayoutMethod( + Nullable supportedPayoutMethod) { + if (supportedPayoutMethod.isNull()) { + this.supportedPayoutMethod = null; + } else if (supportedPayoutMethod.isEmpty()) { + this.supportedPayoutMethod = Optional.empty(); + } else { + this.supportedPayoutMethod = Optional.of(supportedPayoutMethod.get()); + } + return this; + } + + public RetrievePayoutsResponsePayoutMethod build() { + return new RetrievePayoutsResponsePayoutMethod(nickname, supportedPayoutMethod, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponsePayoutMethodSupportedPayoutMethod.java b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponsePayoutMethodSupportedPayoutMethod.java new file mode 100644 index 00000000..66f7a40e --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponsePayoutMethodSupportedPayoutMethod.java @@ -0,0 +1,280 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePayoutsResponsePayoutMethodSupportedPayoutMethod.Builder.class) +public final class RetrievePayoutsResponsePayoutMethodSupportedPayoutMethod { + private final RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType deliveryType; + + private final Optional iconUrl; + + private final Optional payerName; + + private final Map additionalProperties; + + private RetrievePayoutsResponsePayoutMethodSupportedPayoutMethod( + RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType deliveryType, + Optional iconUrl, + Optional payerName, + Map additionalProperties) { + this.deliveryType = deliveryType; + this.iconUrl = iconUrl; + this.payerName = payerName; + this.additionalProperties = additionalProperties; + } + + /** + * @return How the funds are delivered to the recipient. + */ + @JsonProperty("delivery_type") + public RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType getDeliveryType() { + return deliveryType; + } + + /** + * @return Supported payout method icon URL. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return Supported payout method display name. + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePayoutsResponsePayoutMethodSupportedPayoutMethod + && equalTo((RetrievePayoutsResponsePayoutMethodSupportedPayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePayoutsResponsePayoutMethodSupportedPayoutMethod other) { + return deliveryType.equals(other.deliveryType) + && iconUrl.equals(other.iconUrl) + && payerName.equals(other.payerName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deliveryType, this.iconUrl, this.payerName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeliveryTypeStage builder() { + return new Builder(); + } + + public interface DeliveryTypeStage { + /** + *

How the funds are delivered to the recipient.

+ */ + _FinalStage deliveryType( + @NotNull RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType deliveryType); + + Builder from(RetrievePayoutsResponsePayoutMethodSupportedPayoutMethod other); + } + + public interface _FinalStage { + RetrievePayoutsResponsePayoutMethodSupportedPayoutMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Supported payout method icon URL.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Supported payout method display name.

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeliveryTypeStage, _FinalStage { + private RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType deliveryType; + + private Optional payerName = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePayoutsResponsePayoutMethodSupportedPayoutMethod other) { + deliveryType(other.getDeliveryType()); + iconUrl(other.getIconUrl()); + payerName(other.getPayerName()); + return this; + } + + /** + *

How the funds are delivered to the recipient.

+ *

How the funds are delivered to the recipient.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("delivery_type") + public _FinalStage deliveryType( + @NotNull RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType deliveryType) { + this.deliveryType = Objects.requireNonNull(deliveryType, "deliveryType must not be null"); + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

Supported payout method display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

Supported payout method display name.

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Supported payout method icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Supported payout method icon URL.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + @java.lang.Override + public RetrievePayoutsResponsePayoutMethodSupportedPayoutMethod build() { + return new RetrievePayoutsResponsePayoutMethodSupportedPayoutMethod( + deliveryType, iconUrl, payerName, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType.java b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType.java new file mode 100644 index 00000000..e689ebd2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType.java @@ -0,0 +1,169 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType { + public static final RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType PAPER_CHECK = + new RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType(Value.PAPER_CHECK, "paper_check"); + + public static final RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType CRYPTOCURRENCY = + new RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType( + Value.CRYPTOCURRENCY, "cryptocurrency"); + + public static final RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType UNKNOWN = + new RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType(Value.UNKNOWN, "unknown"); + + public static final RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType HOME_DELIVERY = + new RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType( + Value.HOME_DELIVERY, "home_delivery"); + + public static final RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType BANK_DEPOSIT = + new RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType( + Value.BANK_DEPOSIT, "bank_deposit"); + + public static final RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType MASSPAY_CARD = + new RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType( + Value.MASSPAY_CARD, "masspay_card"); + + public static final RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType MOBILE_WALLET = + new RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType( + Value.MOBILE_WALLET, "mobile_wallet"); + + public static final RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType CASH_PICKUP = + new RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType(Value.CASH_PICKUP, "cash_pickup"); + + public static final RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType BILL = + new RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType(Value.BILL, "bill"); + + private final Value value; + + private final String string; + + RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType + && this.string.equals( + ((RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAPER_CHECK: + return visitor.visitPaperCheck(); + case CRYPTOCURRENCY: + return visitor.visitCryptocurrency(); + case UNKNOWN: + return visitor.visitUnknown(); + case HOME_DELIVERY: + return visitor.visitHomeDelivery(); + case BANK_DEPOSIT: + return visitor.visitBankDeposit(); + case MASSPAY_CARD: + return visitor.visitMasspayCard(); + case MOBILE_WALLET: + return visitor.visitMobileWallet(); + case CASH_PICKUP: + return visitor.visitCashPickup(); + case BILL: + return visitor.visitBill(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType valueOf(String value) { + switch (value) { + case "paper_check": + return PAPER_CHECK; + case "cryptocurrency": + return CRYPTOCURRENCY; + case "unknown": + return UNKNOWN; + case "home_delivery": + return HOME_DELIVERY; + case "bank_deposit": + return BANK_DEPOSIT; + case "masspay_card": + return MASSPAY_CARD; + case "mobile_wallet": + return MOBILE_WALLET; + case "cash_pickup": + return CASH_PICKUP; + case "bill": + return BILL; + default: + return new RetrievePayoutsResponsePayoutMethodSupportedPayoutMethodDeliveryType(Value._UNKNOWN, value); + } + } + + public enum Value { + CASH_PICKUP, + + BANK_DEPOSIT, + + HOME_DELIVERY, + + MOBILE_WALLET, + + MASSPAY_CARD, + + PAPER_CHECK, + + BILL, + + CRYPTOCURRENCY, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitCashPickup(); + + T visitBankDeposit(); + + T visitHomeDelivery(); + + T visitMobileWallet(); + + T visitMasspayCard(); + + T visitPaperCheck(); + + T visitBill(); + + T visitCryptocurrency(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseSource.java b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseSource.java new file mode 100644 index 00000000..2087ae87 --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseSource.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrievePayoutsResponseSource { + public static final RetrievePayoutsResponseSource DASHBOARD = + new RetrievePayoutsResponseSource(Value.DASHBOARD, "dashboard"); + + public static final RetrievePayoutsResponseSource AUTOMATIC = + new RetrievePayoutsResponseSource(Value.AUTOMATIC, "automatic"); + + public static final RetrievePayoutsResponseSource API = new RetrievePayoutsResponseSource(Value.API, "api"); + + private final Value value; + + private final String string; + + RetrievePayoutsResponseSource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrievePayoutsResponseSource + && this.string.equals(((RetrievePayoutsResponseSource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DASHBOARD: + return visitor.visitDashboard(); + case AUTOMATIC: + return visitor.visitAutomatic(); + case API: + return visitor.visitApi(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrievePayoutsResponseSource valueOf(String value) { + switch (value) { + case "dashboard": + return DASHBOARD; + case "automatic": + return AUTOMATIC; + case "api": + return API; + default: + return new RetrievePayoutsResponseSource(Value.UNKNOWN, value); + } + } + + public enum Value { + API, + + DASHBOARD, + + AUTOMATIC, + + UNKNOWN + } + + public interface Visitor { + T visitApi(); + + T visitDashboard(); + + T visitAutomatic(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseSpeed.java b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseSpeed.java new file mode 100644 index 00000000..964917cd --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseSpeed.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrievePayoutsResponseSpeed { + public static final RetrievePayoutsResponseSpeed INSTANT = + new RetrievePayoutsResponseSpeed(Value.INSTANT, "instant"); + + public static final RetrievePayoutsResponseSpeed STANDARD = + new RetrievePayoutsResponseSpeed(Value.STANDARD, "standard"); + + private final Value value; + + private final String string; + + RetrievePayoutsResponseSpeed(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrievePayoutsResponseSpeed + && this.string.equals(((RetrievePayoutsResponseSpeed) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTANT: + return visitor.visitInstant(); + case STANDARD: + return visitor.visitStandard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrievePayoutsResponseSpeed valueOf(String value) { + switch (value) { + case "instant": + return INSTANT; + case "standard": + return STANDARD; + default: + return new RetrievePayoutsResponseSpeed(Value.UNKNOWN, value); + } + } + + public enum Value { + STANDARD, + + INSTANT, + + UNKNOWN + } + + public interface Visitor { + T visitStandard(); + + T visitInstant(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseStatus.java b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseStatus.java new file mode 100644 index 00000000..e7afe52b --- /dev/null +++ b/src/main/java/com/whop/api/resources/payouts/types/RetrievePayoutsResponseStatus.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.payouts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrievePayoutsResponseStatus { + public static final RetrievePayoutsResponseStatus FAILED = + new RetrievePayoutsResponseStatus(Value.FAILED, "failed"); + + public static final RetrievePayoutsResponseStatus PROCESSING = + new RetrievePayoutsResponseStatus(Value.PROCESSING, "processing"); + + public static final RetrievePayoutsResponseStatus CANCELED = + new RetrievePayoutsResponseStatus(Value.CANCELED, "canceled"); + + public static final RetrievePayoutsResponseStatus COMPLETED = + new RetrievePayoutsResponseStatus(Value.COMPLETED, "completed"); + + public static final RetrievePayoutsResponseStatus REQUESTED = + new RetrievePayoutsResponseStatus(Value.REQUESTED, "requested"); + + public static final RetrievePayoutsResponseStatus DENIED = + new RetrievePayoutsResponseStatus(Value.DENIED, "denied"); + + public static final RetrievePayoutsResponseStatus REVERSED = + new RetrievePayoutsResponseStatus(Value.REVERSED, "reversed"); + + public static final RetrievePayoutsResponseStatus IN_REVIEW = + new RetrievePayoutsResponseStatus(Value.IN_REVIEW, "in_review"); + + private final Value value; + + private final String string; + + RetrievePayoutsResponseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrievePayoutsResponseStatus + && this.string.equals(((RetrievePayoutsResponseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case PROCESSING: + return visitor.visitProcessing(); + case CANCELED: + return visitor.visitCanceled(); + case COMPLETED: + return visitor.visitCompleted(); + case REQUESTED: + return visitor.visitRequested(); + case DENIED: + return visitor.visitDenied(); + case REVERSED: + return visitor.visitReversed(); + case IN_REVIEW: + return visitor.visitInReview(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrievePayoutsResponseStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "processing": + return PROCESSING; + case "canceled": + return CANCELED; + case "completed": + return COMPLETED; + case "requested": + return REQUESTED; + case "denied": + return DENIED; + case "reversed": + return REVERSED; + case "in_review": + return IN_REVIEW; + default: + return new RetrievePayoutsResponseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + REQUESTED, + + IN_REVIEW, + + PROCESSING, + + COMPLETED, + + REVERSED, + + CANCELED, + + FAILED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitRequested(); + + T visitInReview(); + + T visitProcessing(); + + T visitCompleted(); + + T visitReversed(); + + T visitCanceled(); + + T visitFailed(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/people/AsyncPeopleClient.java b/src/main/java/com/whop/api/resources/people/AsyncPeopleClient.java new file mode 100644 index 00000000..9eb0dd11 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/AsyncPeopleClient.java @@ -0,0 +1,89 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.people.requests.ListPeopleRequest; +import com.whop.api.resources.people.requests.RetrievePeopleRequest; +import com.whop.api.resources.people.types.ListPeopleResponseDataItem; +import com.whop.api.resources.people.types.RetrievePeopleResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncPeopleClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPeopleClient rawClient; + + public AsyncPeopleClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPeopleClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPeopleClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public CompletableFuture> list(ListPeopleRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public CompletableFuture> list( + ListPeopleRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public CompletableFuture retrieve(String id, RetrievePeopleRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public CompletableFuture retrieve( + String id, RetrievePeopleRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/people/AsyncRawPeopleClient.java b/src/main/java/com/whop/api/resources/people/AsyncRawPeopleClient.java new file mode 100644 index 00000000..9d959428 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/AsyncRawPeopleClient.java @@ -0,0 +1,359 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.people.requests.ListPeopleRequest; +import com.whop.api.resources.people.requests.RetrievePeopleRequest; +import com.whop.api.resources.people.types.ListPeopleResponse; +import com.whop.api.resources.people.types.ListPeopleResponseDataItem; +import com.whop.api.resources.people.types.RetrievePeopleResponse; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPeopleClient { + protected final ClientOptions clientOptions; + + public AsyncRawPeopleClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public CompletableFuture>> list() { + return list(ListPeopleRequest.builder().build()); + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListPeopleRequest.builder().build(), requestOptions); + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public CompletableFuture>> list( + ListPeopleRequest request) { + return list(request, null); + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public CompletableFuture>> list( + ListPeopleRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("people"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (request.getCustomEvent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_event", request.getCustomEvent().get(), false); + } + if (request.getEventFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event_from", request.getEventFrom().get(), false); + } + if (request.getEventTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event_to", request.getEventTo().get(), false); + } + if (request.getAudienceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "audience_id", request.getAudienceId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getEmail().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "email", request.getEmail().get(), false); + } + if (request.getPhone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "phone", request.getPhone().get(), false); + } + if (request.getCountry().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "country", request.getCountry().get(), false); + } + if (request.getHasPurchased().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "has_purchased", request.getHasPurchased().get(), false); + } + if (request.getContactable().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "contactable", request.getContactable().get(), false); + } + if (request.getFirstSeenWithinDays().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "first_seen_within_days", + request.getFirstSeenWithinDays().get(), + false); + } + if (request.getLastSeenWithinDays().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "last_seen_within_days", + request.getLastSeenWithinDays().get(), + false); + } + if (request.getFirstSeenAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first_seen_after", request.getFirstSeenAfter().get(), false); + } + if (request.getFirstSeenBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first_seen_before", request.getFirstSeenBefore().get(), false); + } + if (request.getLastSeenAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last_seen_after", request.getLastSeenAfter().get(), false); + } + if (request.getLastSeenBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last_seen_before", request.getLastSeenBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getSource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "source", request.getSource().get(), true); + } + if (request.getEventName().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event_name", request.getEventName().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPeopleResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPeopleResponse.class); + String startingAfter = + parsedResponse.getPageInfo().getEndCursor().orElse(null); + ListPeopleRequest nextRequest = ListPeopleRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + !startingAfter.isEmpty(), result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrievePeopleRequest.builder().build()); + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePeopleRequest.builder().build(), requestOptions); + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public CompletableFuture> retrieve( + String id, RetrievePeopleRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public CompletableFuture> retrieve( + String id, RetrievePeopleRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("people") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrievePeopleResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/people/PeopleClient.java b/src/main/java/com/whop/api/resources/people/PeopleClient.java new file mode 100644 index 00000000..3b042ecc --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/PeopleClient.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.people.requests.ListPeopleRequest; +import com.whop.api.resources.people.requests.RetrievePeopleRequest; +import com.whop.api.resources.people.types.ListPeopleResponseDataItem; +import com.whop.api.resources.people.types.RetrievePeopleResponse; + +public class PeopleClient { + protected final ClientOptions clientOptions; + + private final RawPeopleClient rawClient; + + public PeopleClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPeopleClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPeopleClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public SyncPagingIterable list(ListPeopleRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public SyncPagingIterable list( + ListPeopleRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public RetrievePeopleResponse retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public RetrievePeopleResponse retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public RetrievePeopleResponse retrieve(String id, RetrievePeopleRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public RetrievePeopleResponse retrieve(String id, RetrievePeopleRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/people/RawPeopleClient.java b/src/main/java/com/whop/api/resources/people/RawPeopleClient.java new file mode 100644 index 00000000..c1044454 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/RawPeopleClient.java @@ -0,0 +1,309 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.people.requests.ListPeopleRequest; +import com.whop.api.resources.people.requests.RetrievePeopleRequest; +import com.whop.api.resources.people.types.ListPeopleResponse; +import com.whop.api.resources.people.types.ListPeopleResponseDataItem; +import com.whop.api.resources.people.types.RetrievePeopleResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPeopleClient { + protected final ClientOptions clientOptions; + + public RawPeopleClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public WhopApiHttpResponse> list() { + return list(ListPeopleRequest.builder().build()); + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListPeopleRequest.builder().build(), requestOptions); + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public WhopApiHttpResponse> list(ListPeopleRequest request) { + return list(request, null); + } + + /** + * Lists the people (visitors and customers) of an account: the identity-linked person profiles aggregated from every pixel, payment, and platform event — identities, purchases and LTV, geo/device profile, traffic sources, and first/last marketing touches. + */ + public WhopApiHttpResponse> list( + ListPeopleRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("people"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getAttributionModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "attribution_model", request.getAttributionModel().get(), false); + } + if (request.getCustomEvent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_event", request.getCustomEvent().get(), false); + } + if (request.getEventFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event_from", request.getEventFrom().get(), false); + } + if (request.getEventTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event_to", request.getEventTo().get(), false); + } + if (request.getAudienceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "audience_id", request.getAudienceId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getEmail().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "email", request.getEmail().get(), false); + } + if (request.getPhone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "phone", request.getPhone().get(), false); + } + if (request.getCountry().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "country", request.getCountry().get(), false); + } + if (request.getHasPurchased().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "has_purchased", request.getHasPurchased().get(), false); + } + if (request.getContactable().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "contactable", request.getContactable().get(), false); + } + if (request.getFirstSeenWithinDays().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "first_seen_within_days", + request.getFirstSeenWithinDays().get(), + false); + } + if (request.getLastSeenWithinDays().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "last_seen_within_days", + request.getLastSeenWithinDays().get(), + false); + } + if (request.getFirstSeenAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first_seen_after", request.getFirstSeenAfter().get(), false); + } + if (request.getFirstSeenBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first_seen_before", request.getFirstSeenBefore().get(), false); + } + if (request.getLastSeenAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last_seen_after", request.getLastSeenAfter().get(), false); + } + if (request.getLastSeenBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last_seen_before", request.getLastSeenBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getSource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "source", request.getSource().get(), true); + } + if (request.getEventName().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event_name", request.getEventName().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPeopleResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPeopleResponse.class); + String startingAfter = + parsedResponse.getPageInfo().getEndCursor().orElse(null); + ListPeopleRequest nextRequest = ListPeopleRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + !startingAfter.isEmpty(), result, parsedResponse, () -> list( + nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrievePeopleRequest.builder().build()); + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePeopleRequest.builder().build(), requestOptions); + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public WhopApiHttpResponse retrieve(String id, RetrievePeopleRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves one person for an account. The identifier can be a person ID (prefixed prsn_), a user ID (prefixed user_), an email address, or a phone number — merged people resolve to the surviving profile. + */ + public WhopApiHttpResponse retrieve( + String id, RetrievePeopleRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("people") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrievePeopleResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/requests/ListPeopleRequest.java b/src/main/java/com/whop/api/resources/people/requests/ListPeopleRequest.java new file mode 100644 index 00000000..2e482ed6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/requests/ListPeopleRequest.java @@ -0,0 +1,932 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.people.types.ListPeopleRequestAttributionModel; +import com.whop.api.resources.people.types.ListPeopleRequestDirection; +import com.whop.api.resources.people.types.ListPeopleRequestOrder; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleRequest.Builder.class) +public final class ListPeopleRequest { + private final Optional> source; + + private final Optional> eventName; + + private final Optional accountId; + + private final Optional query; + + private final Optional attributionModel; + + private final Optional customEvent; + + private final Optional eventFrom; + + private final Optional eventTo; + + private final Optional audienceId; + + private final Optional userId; + + private final Optional email; + + private final Optional phone; + + private final Optional country; + + private final Optional hasPurchased; + + private final Optional contactable; + + private final Optional firstSeenWithinDays; + + private final Optional lastSeenWithinDays; + + private final Optional firstSeenAfter; + + private final Optional firstSeenBefore; + + private final Optional lastSeenAfter; + + private final Optional lastSeenBefore; + + private final Optional first; + + private final Optional after; + + private final Optional before; + + private final Optional order; + + private final Optional direction; + + private final Map additionalProperties; + + private ListPeopleRequest( + Optional> source, + Optional> eventName, + Optional accountId, + Optional query, + Optional attributionModel, + Optional customEvent, + Optional eventFrom, + Optional eventTo, + Optional audienceId, + Optional userId, + Optional email, + Optional phone, + Optional country, + Optional hasPurchased, + Optional contactable, + Optional firstSeenWithinDays, + Optional lastSeenWithinDays, + Optional firstSeenAfter, + Optional firstSeenBefore, + Optional lastSeenAfter, + Optional lastSeenBefore, + Optional first, + Optional after, + Optional before, + Optional order, + Optional direction, + Map additionalProperties) { + this.source = source; + this.eventName = eventName; + this.accountId = accountId; + this.query = query; + this.attributionModel = attributionModel; + this.customEvent = customEvent; + this.eventFrom = eventFrom; + this.eventTo = eventTo; + this.audienceId = audienceId; + this.userId = userId; + this.email = email; + this.phone = phone; + this.country = country; + this.hasPurchased = hasPurchased; + this.contactable = contactable; + this.firstSeenWithinDays = firstSeenWithinDays; + this.lastSeenWithinDays = lastSeenWithinDays; + this.firstSeenAfter = firstSeenAfter; + this.firstSeenBefore = firstSeenBefore; + this.lastSeenAfter = lastSeenAfter; + this.lastSeenBefore = lastSeenBefore; + this.first = first; + this.after = after; + this.before = before; + this.order = order; + this.direction = direction; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only include people acquired from any of these sources — canonical paths (whop:<campaign>:<group>:<ad>, ext:<platform>:..., referrer:<domain>, direct, other), exact or with a trailing :* prefix. The same vocabulary the events / people metrics use. + */ + @JsonProperty("source") + public Optional> getSource() { + return source; + } + + /** + * @return Only include people who fired any of these events, e.g. payment.completed or page.checkout.view. + */ + @JsonProperty("event_name") + public Optional> getEventName() { + return eventName; + } + + /** + * @return Account ID, prefixed biz_. Optional for account API keys; required for credentials that can access multiple accounts. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Search people by name, email, phone, or whop user ID (case-insensitive substring match). + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + /** + * @return Attribution model the source filter matches against (defaults to last_touch). + */ + @JsonProperty("attribution_model") + public Optional getAttributionModel() { + return attributionModel; + } + + /** + * @return Only include people who fired this custom pixel event. + */ + @JsonProperty("custom_event") + public Optional getCustomEvent() { + return customEvent; + } + + /** + * @return With event_to plus an event or source filter, switches to exact-population mode: person ids are resolved and paginated on the events side within this window (the same query the people metric counts), then hydrated per page. + */ + @JsonProperty("event_from") + public Optional getEventFrom() { + return eventFrom; + } + + /** + * @return The inclusive end of the event window for exact-population mode. + */ + @JsonProperty("event_to") + public Optional getEventTo() { + return eventTo; + } + + /** + * @return Only include people in this audience. An audience that keeps itself up to date resolves to the People filters that define it, so this always reflects who matches now; uploaded lists and point-in-time snapshots match their recorded members. + */ + @JsonProperty("audience_id") + public Optional getAudienceId() { + return audienceId; + } + + /** + * @return Only include the person linked to this whop user ID. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + /** + * @return Only include the person linked to this email address. + */ + @JsonProperty("email") + public Optional getEmail() { + return email; + } + + /** + * @return Only include the person linked to this phone number. + */ + @JsonProperty("phone") + public Optional getPhone() { + return phone; + } + + /** + * @return Only include people whose most recent visit came from this ISO 3166-1 alpha-2 country code. + */ + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + /** + * @return true for customers only, false for people who have never purchased. + */ + @JsonProperty("has_purchased") + public Optional getHasPurchased() { + return hasPurchased; + } + + /** + * @return true for people who have an email address or phone number — the ones an ad platform can match. + */ + @JsonProperty("contactable") + public Optional getContactable() { + return contactable; + } + + /** + * @return Only include people first seen within this many days, as a rolling window. + */ + @JsonProperty("first_seen_within_days") + public Optional getFirstSeenWithinDays() { + return firstSeenWithinDays; + } + + /** + * @return Only include people last seen within this many days, as a rolling window. + */ + @JsonProperty("last_seen_within_days") + public Optional getLastSeenWithinDays() { + return lastSeenWithinDays; + } + + /** + * @return Only include people first seen at or after this ISO 8601 timestamp. + */ + @JsonProperty("first_seen_after") + public Optional getFirstSeenAfter() { + return firstSeenAfter; + } + + /** + * @return Only include people first seen before this ISO 8601 timestamp. + */ + @JsonProperty("first_seen_before") + public Optional getFirstSeenBefore() { + return firstSeenBefore; + } + + /** + * @return Only include people last seen at or after this ISO 8601 timestamp. + */ + @JsonProperty("last_seen_after") + public Optional getLastSeenAfter() { + return lastSeenAfter; + } + + /** + * @return Only include people last seen before this ISO 8601 timestamp. + */ + @JsonProperty("last_seen_before") + public Optional getLastSeenBefore() { + return lastSeenBefore; + } + + /** + * @return The number of people to return (default 100, max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor for fetching people after a previous page. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return A cursor for fetching people before a later page. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return Column to sort by. Defaults to last_seen_at. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. Defaults to desc. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleRequest && equalTo((ListPeopleRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleRequest other) { + return source.equals(other.source) + && eventName.equals(other.eventName) + && accountId.equals(other.accountId) + && query.equals(other.query) + && attributionModel.equals(other.attributionModel) + && customEvent.equals(other.customEvent) + && eventFrom.equals(other.eventFrom) + && eventTo.equals(other.eventTo) + && audienceId.equals(other.audienceId) + && userId.equals(other.userId) + && email.equals(other.email) + && phone.equals(other.phone) + && country.equals(other.country) + && hasPurchased.equals(other.hasPurchased) + && contactable.equals(other.contactable) + && firstSeenWithinDays.equals(other.firstSeenWithinDays) + && lastSeenWithinDays.equals(other.lastSeenWithinDays) + && firstSeenAfter.equals(other.firstSeenAfter) + && firstSeenBefore.equals(other.firstSeenBefore) + && lastSeenAfter.equals(other.lastSeenAfter) + && lastSeenBefore.equals(other.lastSeenBefore) + && first.equals(other.first) + && after.equals(other.after) + && before.equals(other.before) + && order.equals(other.order) + && direction.equals(other.direction); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.source, + this.eventName, + this.accountId, + this.query, + this.attributionModel, + this.customEvent, + this.eventFrom, + this.eventTo, + this.audienceId, + this.userId, + this.email, + this.phone, + this.country, + this.hasPurchased, + this.contactable, + this.firstSeenWithinDays, + this.lastSeenWithinDays, + this.firstSeenAfter, + this.firstSeenBefore, + this.lastSeenAfter, + this.lastSeenBefore, + this.first, + this.after, + this.before, + this.order, + this.direction); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> source = Optional.empty(); + + private Optional> eventName = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional query = Optional.empty(); + + private Optional attributionModel = Optional.empty(); + + private Optional customEvent = Optional.empty(); + + private Optional eventFrom = Optional.empty(); + + private Optional eventTo = Optional.empty(); + + private Optional audienceId = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional hasPurchased = Optional.empty(); + + private Optional contactable = Optional.empty(); + + private Optional firstSeenWithinDays = Optional.empty(); + + private Optional lastSeenWithinDays = Optional.empty(); + + private Optional firstSeenAfter = Optional.empty(); + + private Optional firstSeenBefore = Optional.empty(); + + private Optional lastSeenAfter = Optional.empty(); + + private Optional lastSeenBefore = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListPeopleRequest other) { + source(other.getSource()); + eventName(other.getEventName()); + accountId(other.getAccountId()); + query(other.getQuery()); + attributionModel(other.getAttributionModel()); + customEvent(other.getCustomEvent()); + eventFrom(other.getEventFrom()); + eventTo(other.getEventTo()); + audienceId(other.getAudienceId()); + userId(other.getUserId()); + email(other.getEmail()); + phone(other.getPhone()); + country(other.getCountry()); + hasPurchased(other.getHasPurchased()); + contactable(other.getContactable()); + firstSeenWithinDays(other.getFirstSeenWithinDays()); + lastSeenWithinDays(other.getLastSeenWithinDays()); + firstSeenAfter(other.getFirstSeenAfter()); + firstSeenBefore(other.getFirstSeenBefore()); + lastSeenAfter(other.getLastSeenAfter()); + lastSeenBefore(other.getLastSeenBefore()); + first(other.getFirst()); + after(other.getAfter()); + before(other.getBefore()); + order(other.getOrder()); + direction(other.getDirection()); + return this; + } + + /** + *

Only include people acquired from any of these sources — canonical paths (whop:<campaign>:<group>:<ad>, ext:<platform>:..., referrer:<domain>, direct, other), exact or with a trailing :* prefix. The same vocabulary the events / people metrics use.

+ */ + @JsonSetter(value = "source", nulls = Nulls.SKIP) + public Builder source(Optional> source) { + this.source = source; + return this; + } + + public Builder source(List source) { + this.source = Optional.ofNullable(source); + return this; + } + + public Builder source(String source) { + this.source = Optional.of(Collections.singletonList(source)); + return this; + } + + /** + *

Only include people who fired any of these events, e.g. payment.completed or page.checkout.view.

+ */ + @JsonSetter(value = "event_name", nulls = Nulls.SKIP) + public Builder eventName(Optional> eventName) { + this.eventName = eventName; + return this; + } + + public Builder eventName(List eventName) { + this.eventName = Optional.ofNullable(eventName); + return this; + } + + public Builder eventName(String eventName) { + this.eventName = Optional.of(Collections.singletonList(eventName)); + return this; + } + + /** + *

Account ID, prefixed biz_. Optional for account API keys; required for credentials that can access multiple accounts.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Search people by name, email, phone, or whop user ID (case-insensitive substring match).

+ */ + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public Builder query(Optional query) { + this.query = query; + return this; + } + + public Builder query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + /** + *

Attribution model the source filter matches against (defaults to last_touch).

+ */ + @JsonSetter(value = "attribution_model", nulls = Nulls.SKIP) + public Builder attributionModel(Optional attributionModel) { + this.attributionModel = attributionModel; + return this; + } + + public Builder attributionModel(ListPeopleRequestAttributionModel attributionModel) { + this.attributionModel = Optional.ofNullable(attributionModel); + return this; + } + + /** + *

Only include people who fired this custom pixel event.

+ */ + @JsonSetter(value = "custom_event", nulls = Nulls.SKIP) + public Builder customEvent(Optional customEvent) { + this.customEvent = customEvent; + return this; + } + + public Builder customEvent(String customEvent) { + this.customEvent = Optional.ofNullable(customEvent); + return this; + } + + /** + *

With event_to plus an event or source filter, switches to exact-population mode: person ids are resolved and paginated on the events side within this window (the same query the people metric counts), then hydrated per page.

+ */ + @JsonSetter(value = "event_from", nulls = Nulls.SKIP) + public Builder eventFrom(Optional eventFrom) { + this.eventFrom = eventFrom; + return this; + } + + public Builder eventFrom(OffsetDateTime eventFrom) { + this.eventFrom = Optional.ofNullable(eventFrom); + return this; + } + + /** + *

The inclusive end of the event window for exact-population mode.

+ */ + @JsonSetter(value = "event_to", nulls = Nulls.SKIP) + public Builder eventTo(Optional eventTo) { + this.eventTo = eventTo; + return this; + } + + public Builder eventTo(OffsetDateTime eventTo) { + this.eventTo = Optional.ofNullable(eventTo); + return this; + } + + /** + *

Only include people in this audience. An audience that keeps itself up to date resolves to the People filters that define it, so this always reflects who matches now; uploaded lists and point-in-time snapshots match their recorded members.

+ */ + @JsonSetter(value = "audience_id", nulls = Nulls.SKIP) + public Builder audienceId(Optional audienceId) { + this.audienceId = audienceId; + return this; + } + + public Builder audienceId(String audienceId) { + this.audienceId = Optional.ofNullable(audienceId); + return this; + } + + /** + *

Only include the person linked to this whop user ID.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Only include the person linked to this email address.

+ */ + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

Only include the person linked to this phone number.

+ */ + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + /** + *

Only include people whose most recent visit came from this ISO 3166-1 alpha-2 country code.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

true for customers only, false for people who have never purchased.

+ */ + @JsonSetter(value = "has_purchased", nulls = Nulls.SKIP) + public Builder hasPurchased(Optional hasPurchased) { + this.hasPurchased = hasPurchased; + return this; + } + + public Builder hasPurchased(Boolean hasPurchased) { + this.hasPurchased = Optional.ofNullable(hasPurchased); + return this; + } + + /** + *

true for people who have an email address or phone number — the ones an ad platform can match.

+ */ + @JsonSetter(value = "contactable", nulls = Nulls.SKIP) + public Builder contactable(Optional contactable) { + this.contactable = contactable; + return this; + } + + public Builder contactable(Boolean contactable) { + this.contactable = Optional.ofNullable(contactable); + return this; + } + + /** + *

Only include people first seen within this many days, as a rolling window.

+ */ + @JsonSetter(value = "first_seen_within_days", nulls = Nulls.SKIP) + public Builder firstSeenWithinDays(Optional firstSeenWithinDays) { + this.firstSeenWithinDays = firstSeenWithinDays; + return this; + } + + public Builder firstSeenWithinDays(Integer firstSeenWithinDays) { + this.firstSeenWithinDays = Optional.ofNullable(firstSeenWithinDays); + return this; + } + + /** + *

Only include people last seen within this many days, as a rolling window.

+ */ + @JsonSetter(value = "last_seen_within_days", nulls = Nulls.SKIP) + public Builder lastSeenWithinDays(Optional lastSeenWithinDays) { + this.lastSeenWithinDays = lastSeenWithinDays; + return this; + } + + public Builder lastSeenWithinDays(Integer lastSeenWithinDays) { + this.lastSeenWithinDays = Optional.ofNullable(lastSeenWithinDays); + return this; + } + + /** + *

Only include people first seen at or after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "first_seen_after", nulls = Nulls.SKIP) + public Builder firstSeenAfter(Optional firstSeenAfter) { + this.firstSeenAfter = firstSeenAfter; + return this; + } + + public Builder firstSeenAfter(OffsetDateTime firstSeenAfter) { + this.firstSeenAfter = Optional.ofNullable(firstSeenAfter); + return this; + } + + /** + *

Only include people first seen before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "first_seen_before", nulls = Nulls.SKIP) + public Builder firstSeenBefore(Optional firstSeenBefore) { + this.firstSeenBefore = firstSeenBefore; + return this; + } + + public Builder firstSeenBefore(OffsetDateTime firstSeenBefore) { + this.firstSeenBefore = Optional.ofNullable(firstSeenBefore); + return this; + } + + /** + *

Only include people last seen at or after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "last_seen_after", nulls = Nulls.SKIP) + public Builder lastSeenAfter(Optional lastSeenAfter) { + this.lastSeenAfter = lastSeenAfter; + return this; + } + + public Builder lastSeenAfter(OffsetDateTime lastSeenAfter) { + this.lastSeenAfter = Optional.ofNullable(lastSeenAfter); + return this; + } + + /** + *

Only include people last seen before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "last_seen_before", nulls = Nulls.SKIP) + public Builder lastSeenBefore(Optional lastSeenBefore) { + this.lastSeenBefore = lastSeenBefore; + return this; + } + + public Builder lastSeenBefore(OffsetDateTime lastSeenBefore) { + this.lastSeenBefore = Optional.ofNullable(lastSeenBefore); + return this; + } + + /** + *

The number of people to return (default 100, max 100).

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor for fetching people after a previous page.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

A cursor for fetching people before a later page.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Column to sort by. Defaults to last_seen_at.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListPeopleRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction. Defaults to desc.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListPeopleRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + public ListPeopleRequest build() { + return new ListPeopleRequest( + source, + eventName, + accountId, + query, + attributionModel, + customEvent, + eventFrom, + eventTo, + audienceId, + userId, + email, + phone, + country, + hasPurchased, + contactable, + firstSeenWithinDays, + lastSeenWithinDays, + firstSeenAfter, + firstSeenBefore, + lastSeenAfter, + lastSeenBefore, + first, + after, + before, + order, + direction, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/requests/RetrievePeopleRequest.java b/src/main/java/com/whop/api/resources/people/requests/RetrievePeopleRequest.java new file mode 100644 index 00000000..2d6839b7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/requests/RetrievePeopleRequest.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleRequest.Builder.class) +public final class RetrievePeopleRequest { + private final Optional accountId; + + private final Map additionalProperties; + + private RetrievePeopleRequest(Optional accountId, Map additionalProperties) { + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. Optional for account API keys; required for credentials that can access multiple accounts. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleRequest && equalTo((RetrievePeopleRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleRequest other) { + return accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePeopleRequest other) { + accountId(other.getAccountId()); + return this; + } + + /** + *

Account ID, prefixed biz_. Optional for account API keys; required for credentials that can access multiple accounts.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + public RetrievePeopleRequest build() { + return new RetrievePeopleRequest(accountId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleRequestAttributionModel.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleRequestAttributionModel.java new file mode 100644 index 00000000..d4b6a3aa --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleRequestAttributionModel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPeopleRequestAttributionModel { + public static final ListPeopleRequestAttributionModel FIRST_TOUCH = + new ListPeopleRequestAttributionModel(Value.FIRST_TOUCH, "first_touch"); + + public static final ListPeopleRequestAttributionModel LAST_TOUCH = + new ListPeopleRequestAttributionModel(Value.LAST_TOUCH, "last_touch"); + + private final Value value; + + private final String string; + + ListPeopleRequestAttributionModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPeopleRequestAttributionModel + && this.string.equals(((ListPeopleRequestAttributionModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FIRST_TOUCH: + return visitor.visitFirstTouch(); + case LAST_TOUCH: + return visitor.visitLastTouch(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPeopleRequestAttributionModel valueOf(String value) { + switch (value) { + case "first_touch": + return FIRST_TOUCH; + case "last_touch": + return LAST_TOUCH; + default: + return new ListPeopleRequestAttributionModel(Value.UNKNOWN, value); + } + } + + public enum Value { + LAST_TOUCH, + + FIRST_TOUCH, + + UNKNOWN + } + + public interface Visitor { + T visitLastTouch(); + + T visitFirstTouch(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleRequestDirection.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleRequestDirection.java new file mode 100644 index 00000000..b79b3d14 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPeopleRequestDirection { + public static final ListPeopleRequestDirection ASC = new ListPeopleRequestDirection(Value.ASC, "asc"); + + public static final ListPeopleRequestDirection DESC = new ListPeopleRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListPeopleRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPeopleRequestDirection + && this.string.equals(((ListPeopleRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPeopleRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListPeopleRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleRequestOrder.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleRequestOrder.java new file mode 100644 index 00000000..b87c2917 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleRequestOrder.java @@ -0,0 +1,170 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPeopleRequestOrder { + public static final ListPeopleRequestOrder EMAIL = new ListPeopleRequestOrder(Value.EMAIL, "email"); + + public static final ListPeopleRequestOrder FIRST_SEEN_AT = + new ListPeopleRequestOrder(Value.FIRST_SEEN_AT, "first_seen_at"); + + public static final ListPeopleRequestOrder FIRST_PURCHASE_AT = + new ListPeopleRequestOrder(Value.FIRST_PURCHASE_AT, "first_purchase_at"); + + public static final ListPeopleRequestOrder LAST_PURCHASE_AT = + new ListPeopleRequestOrder(Value.LAST_PURCHASE_AT, "last_purchase_at"); + + public static final ListPeopleRequestOrder EVENT_COUNT = + new ListPeopleRequestOrder(Value.EVENT_COUNT, "event_count"); + + public static final ListPeopleRequestOrder NAME = new ListPeopleRequestOrder(Value.NAME, "name"); + + public static final ListPeopleRequestOrder PURCHASE_COUNT = + new ListPeopleRequestOrder(Value.PURCHASE_COUNT, "purchase_count"); + + public static final ListPeopleRequestOrder AOV = new ListPeopleRequestOrder(Value.AOV, "aov"); + + public static final ListPeopleRequestOrder LTV = new ListPeopleRequestOrder(Value.LTV, "ltv"); + + public static final ListPeopleRequestOrder LAST_SEEN_AT = + new ListPeopleRequestOrder(Value.LAST_SEEN_AT, "last_seen_at"); + + private final Value value; + + private final String string; + + ListPeopleRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPeopleRequestOrder + && this.string.equals(((ListPeopleRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EMAIL: + return visitor.visitEmail(); + case FIRST_SEEN_AT: + return visitor.visitFirstSeenAt(); + case FIRST_PURCHASE_AT: + return visitor.visitFirstPurchaseAt(); + case LAST_PURCHASE_AT: + return visitor.visitLastPurchaseAt(); + case EVENT_COUNT: + return visitor.visitEventCount(); + case NAME: + return visitor.visitName(); + case PURCHASE_COUNT: + return visitor.visitPurchaseCount(); + case AOV: + return visitor.visitAov(); + case LTV: + return visitor.visitLtv(); + case LAST_SEEN_AT: + return visitor.visitLastSeenAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPeopleRequestOrder valueOf(String value) { + switch (value) { + case "email": + return EMAIL; + case "first_seen_at": + return FIRST_SEEN_AT; + case "first_purchase_at": + return FIRST_PURCHASE_AT; + case "last_purchase_at": + return LAST_PURCHASE_AT; + case "event_count": + return EVENT_COUNT; + case "name": + return NAME; + case "purchase_count": + return PURCHASE_COUNT; + case "aov": + return AOV; + case "ltv": + return LTV; + case "last_seen_at": + return LAST_SEEN_AT; + default: + return new ListPeopleRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + FIRST_SEEN_AT, + + LAST_SEEN_AT, + + FIRST_PURCHASE_AT, + + LAST_PURCHASE_AT, + + PURCHASE_COUNT, + + EVENT_COUNT, + + LTV, + + AOV, + + NAME, + + EMAIL, + + UNKNOWN + } + + public interface Visitor { + T visitFirstSeenAt(); + + T visitLastSeenAt(); + + T visitFirstPurchaseAt(); + + T visitLastPurchaseAt(); + + T visitPurchaseCount(); + + T visitEventCount(); + + T visitLtv(); + + T visitAov(); + + T visitName(); + + T visitEmail(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponse.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponse.java new file mode 100644 index 00000000..57c5eb66 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponse.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleResponse.Builder.class) +public final class ListPeopleResponse { + private final List data; + + private final ListPeopleResponsePageInfo pageInfo; + + private final Optional totalCount; + + private final Map additionalProperties; + + private ListPeopleResponse( + List data, + ListPeopleResponsePageInfo pageInfo, + Optional totalCount, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.totalCount = totalCount; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListPeopleResponsePageInfo getPageInfo() { + return pageInfo; + } + + @JsonProperty("total_count") + public Optional getTotalCount() { + return totalCount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleResponse && equalTo((ListPeopleResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo) && totalCount.equals(other.totalCount); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo, this.totalCount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListPeopleResponsePageInfo pageInfo); + + Builder from(ListPeopleResponse other); + } + + public interface _FinalStage { + ListPeopleResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ListPeopleResponseDataItem data); + + _FinalStage addAllData(List data); + + _FinalStage totalCount(Optional totalCount); + + _FinalStage totalCount(Integer totalCount); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListPeopleResponsePageInfo pageInfo; + + private Optional totalCount = Optional.empty(); + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPeopleResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + totalCount(other.getTotalCount()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListPeopleResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage totalCount(Integer totalCount) { + this.totalCount = Optional.ofNullable(totalCount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "total_count", nulls = Nulls.SKIP) + public _FinalStage totalCount(Optional totalCount) { + this.totalCount = totalCount; + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ListPeopleResponseDataItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListPeopleResponse build() { + return new ListPeopleResponse(data, pageInfo, totalCount, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItem.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItem.java new file mode 100644 index 00000000..6ba1754b --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItem.java @@ -0,0 +1,1118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleResponseDataItem.Builder.class) +public final class ListPeopleResponseDataItem { + private final String accountId; + + private final Optional aov; + + private final Optional device; + + private final Optional email; + + private final int eventCount; + + private final Optional firstPurchaseAt; + + private final OffsetDateTime firstSeenAt; + + private final Optional firstSource; + + private final String id; + + private final Optional lastIp; + + private final Optional lastPurchaseAt; + + private final OffsetDateTime lastSeenAt; + + private final Optional lastSource; + + private final Optional location; + + private final Optional ltv; + + private final Optional member; + + private final Optional name; + + private final Optional phone; + + private final int purchaseCount; + + private final Optional timezone; + + private final Optional user; + + private final Map additionalProperties; + + private ListPeopleResponseDataItem( + String accountId, + Optional aov, + Optional device, + Optional email, + int eventCount, + Optional firstPurchaseAt, + OffsetDateTime firstSeenAt, + Optional firstSource, + String id, + Optional lastIp, + Optional lastPurchaseAt, + OffsetDateTime lastSeenAt, + Optional lastSource, + Optional location, + Optional ltv, + Optional member, + Optional name, + Optional phone, + int purchaseCount, + Optional timezone, + Optional user, + Map additionalProperties) { + this.accountId = accountId; + this.aov = aov; + this.device = device; + this.email = email; + this.eventCount = eventCount; + this.firstPurchaseAt = firstPurchaseAt; + this.firstSeenAt = firstSeenAt; + this.firstSource = firstSource; + this.id = id; + this.lastIp = lastIp; + this.lastPurchaseAt = lastPurchaseAt; + this.lastSeenAt = lastSeenAt; + this.lastSource = lastSource; + this.location = location; + this.ltv = ltv; + this.member = member; + this.name = name; + this.phone = phone; + this.purchaseCount = purchaseCount; + this.timezone = timezone; + this.user = user; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("aov") + public Optional getAov() { + return aov; + } + + @JsonProperty("device") + public Optional getDevice() { + return device; + } + + /** + * @return The email from the person's most recent event that carried one. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + @JsonProperty("event_count") + public int getEventCount() { + return eventCount; + } + + @JsonIgnore + public Optional getFirstPurchaseAt() { + if (firstPurchaseAt == null) { + return Optional.empty(); + } + return firstPurchaseAt; + } + + @JsonProperty("first_seen_at") + public OffsetDateTime getFirstSeenAt() { + return firstSeenAt; + } + + /** + * @return Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site. + */ + @JsonIgnore + public Optional getFirstSource() { + if (firstSource == null) { + return Optional.empty(); + } + return firstSource; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getLastIp() { + if (lastIp == null) { + return Optional.empty(); + } + return lastIp; + } + + @JsonIgnore + public Optional getLastPurchaseAt() { + if (lastPurchaseAt == null) { + return Optional.empty(); + } + return lastPurchaseAt; + } + + @JsonProperty("last_seen_at") + public OffsetDateTime getLastSeenAt() { + return lastSeenAt; + } + + /** + * @return Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site. + */ + @JsonIgnore + public Optional getLastSource() { + if (lastSource == null) { + return Optional.empty(); + } + return lastSource; + } + + @JsonProperty("location") + public Optional getLocation() { + return location; + } + + @JsonProperty("ltv") + public Optional getLtv() { + return ltv; + } + + /** + * @return The user's member record at this account, when they are a member of it. + */ + @JsonIgnore + public Optional getMember() { + if (member == null) { + return Optional.empty(); + } + return member; + } + + /** + * @return The name from the person's most recent event that carried one. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The phone from the person's most recent event that carried one. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + @JsonProperty("purchase_count") + public int getPurchaseCount() { + return purchaseCount; + } + + @JsonIgnore + public Optional getTimezone() { + if (timezone == null) { + return Optional.empty(); + } + return timezone; + } + + /** + * @return The person's primary whop user, when one of their identities is a whop account. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_purchase_at") + private Optional _getFirstPurchaseAt() { + return firstPurchaseAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_source") + private Optional _getFirstSource() { + return firstSource; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_ip") + private Optional _getLastIp() { + return lastIp; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_purchase_at") + private Optional _getLastPurchaseAt() { + return lastPurchaseAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_source") + private Optional _getLastSource() { + return lastSource; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member") + private Optional _getMember() { + return member; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("timezone") + private Optional _getTimezone() { + return timezone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleResponseDataItem && equalTo((ListPeopleResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleResponseDataItem other) { + return accountId.equals(other.accountId) + && aov.equals(other.aov) + && device.equals(other.device) + && email.equals(other.email) + && eventCount == other.eventCount + && firstPurchaseAt.equals(other.firstPurchaseAt) + && firstSeenAt.equals(other.firstSeenAt) + && firstSource.equals(other.firstSource) + && id.equals(other.id) + && lastIp.equals(other.lastIp) + && lastPurchaseAt.equals(other.lastPurchaseAt) + && lastSeenAt.equals(other.lastSeenAt) + && lastSource.equals(other.lastSource) + && location.equals(other.location) + && ltv.equals(other.ltv) + && member.equals(other.member) + && name.equals(other.name) + && phone.equals(other.phone) + && purchaseCount == other.purchaseCount + && timezone.equals(other.timezone) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.aov, + this.device, + this.email, + this.eventCount, + this.firstPurchaseAt, + this.firstSeenAt, + this.firstSource, + this.id, + this.lastIp, + this.lastPurchaseAt, + this.lastSeenAt, + this.lastSource, + this.location, + this.ltv, + this.member, + this.name, + this.phone, + this.purchaseCount, + this.timezone, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + EventCountStage accountId(@NotNull String accountId); + + Builder from(ListPeopleResponseDataItem other); + } + + public interface EventCountStage { + FirstSeenAtStage eventCount(int eventCount); + } + + public interface FirstSeenAtStage { + IdStage firstSeenAt(@NotNull OffsetDateTime firstSeenAt); + } + + public interface IdStage { + LastSeenAtStage id(@NotNull String id); + } + + public interface LastSeenAtStage { + PurchaseCountStage lastSeenAt(@NotNull OffsetDateTime lastSeenAt); + } + + public interface PurchaseCountStage { + _FinalStage purchaseCount(int purchaseCount); + } + + public interface _FinalStage { + ListPeopleResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage aov(Optional aov); + + _FinalStage aov(Double aov); + + _FinalStage device(Optional device); + + _FinalStage device(ListPeopleResponseDataItemDevice device); + + /** + *

The email from the person's most recent event that carried one.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + _FinalStage firstPurchaseAt(Optional firstPurchaseAt); + + _FinalStage firstPurchaseAt(OffsetDateTime firstPurchaseAt); + + _FinalStage firstPurchaseAt(Nullable firstPurchaseAt); + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ */ + _FinalStage firstSource(Optional firstSource); + + _FinalStage firstSource(ListPeopleResponseDataItemFirstSource firstSource); + + _FinalStage firstSource(Nullable firstSource); + + _FinalStage lastIp(Optional lastIp); + + _FinalStage lastIp(String lastIp); + + _FinalStage lastIp(Nullable lastIp); + + _FinalStage lastPurchaseAt(Optional lastPurchaseAt); + + _FinalStage lastPurchaseAt(OffsetDateTime lastPurchaseAt); + + _FinalStage lastPurchaseAt(Nullable lastPurchaseAt); + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ */ + _FinalStage lastSource(Optional lastSource); + + _FinalStage lastSource(ListPeopleResponseDataItemLastSource lastSource); + + _FinalStage lastSource(Nullable lastSource); + + _FinalStage location(Optional location); + + _FinalStage location(ListPeopleResponseDataItemLocation location); + + _FinalStage ltv(Optional ltv); + + _FinalStage ltv(Double ltv); + + /** + *

The user's member record at this account, when they are a member of it.

+ */ + _FinalStage member(Optional member); + + _FinalStage member(ListPeopleResponseDataItemMember member); + + _FinalStage member(Nullable member); + + /** + *

The name from the person's most recent event that carried one.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

The phone from the person's most recent event that carried one.

+ */ + _FinalStage phone(Optional phone); + + _FinalStage phone(String phone); + + _FinalStage phone(Nullable phone); + + _FinalStage timezone(Optional timezone); + + _FinalStage timezone(String timezone); + + _FinalStage timezone(Nullable timezone); + + /** + *

The person's primary whop user, when one of their identities is a whop account.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(ListPeopleResponseDataItemUser user); + + _FinalStage user(Nullable user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, + EventCountStage, + FirstSeenAtStage, + IdStage, + LastSeenAtStage, + PurchaseCountStage, + _FinalStage { + private String accountId; + + private int eventCount; + + private OffsetDateTime firstSeenAt; + + private String id; + + private OffsetDateTime lastSeenAt; + + private int purchaseCount; + + private Optional user = Optional.empty(); + + private Optional timezone = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional member = Optional.empty(); + + private Optional ltv = Optional.empty(); + + private Optional location = Optional.empty(); + + private Optional lastSource = Optional.empty(); + + private Optional lastPurchaseAt = Optional.empty(); + + private Optional lastIp = Optional.empty(); + + private Optional firstSource = Optional.empty(); + + private Optional firstPurchaseAt = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional device = Optional.empty(); + + private Optional aov = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPeopleResponseDataItem other) { + accountId(other.getAccountId()); + aov(other.getAov()); + device(other.getDevice()); + email(other.getEmail()); + eventCount(other.getEventCount()); + firstPurchaseAt(other.getFirstPurchaseAt()); + firstSeenAt(other.getFirstSeenAt()); + firstSource(other.getFirstSource()); + id(other.getId()); + lastIp(other.getLastIp()); + lastPurchaseAt(other.getLastPurchaseAt()); + lastSeenAt(other.getLastSeenAt()); + lastSource(other.getLastSource()); + location(other.getLocation()); + ltv(other.getLtv()); + member(other.getMember()); + name(other.getName()); + phone(other.getPhone()); + purchaseCount(other.getPurchaseCount()); + timezone(other.getTimezone()); + user(other.getUser()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public EventCountStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("event_count") + public FirstSeenAtStage eventCount(int eventCount) { + this.eventCount = eventCount; + return this; + } + + @java.lang.Override + @JsonSetter("first_seen_at") + public IdStage firstSeenAt(@NotNull OffsetDateTime firstSeenAt) { + this.firstSeenAt = Objects.requireNonNull(firstSeenAt, "firstSeenAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public LastSeenAtStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("last_seen_at") + public PurchaseCountStage lastSeenAt(@NotNull OffsetDateTime lastSeenAt) { + this.lastSeenAt = Objects.requireNonNull(lastSeenAt, "lastSeenAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("purchase_count") + public _FinalStage purchaseCount(int purchaseCount) { + this.purchaseCount = purchaseCount; + return this; + } + + /** + *

The person's primary whop user, when one of their identities is a whop account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The person's primary whop user, when one of their identities is a whop account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(ListPeopleResponseDataItemUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The person's primary whop user, when one of their identities is a whop account.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + @java.lang.Override + public _FinalStage timezone(Nullable timezone) { + if (timezone.isNull()) { + this.timezone = null; + } else if (timezone.isEmpty()) { + this.timezone = Optional.empty(); + } else { + this.timezone = Optional.of(timezone.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage timezone(String timezone) { + this.timezone = Optional.ofNullable(timezone); + return this; + } + + @java.lang.Override + @JsonSetter(value = "timezone", nulls = Nulls.SKIP) + public _FinalStage timezone(Optional timezone) { + this.timezone = timezone; + return this; + } + + /** + *

The phone from the person's most recent event that carried one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

The phone from the person's most recent event that carried one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + /** + *

The phone from the person's most recent event that carried one.

+ */ + @java.lang.Override + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public _FinalStage phone(Optional phone) { + this.phone = phone; + return this; + } + + /** + *

The name from the person's most recent event that carried one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The name from the person's most recent event that carried one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The name from the person's most recent event that carried one.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The user's member record at this account, when they are a member of it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(Nullable member) { + if (member.isNull()) { + this.member = null; + } else if (member.isEmpty()) { + this.member = Optional.empty(); + } else { + this.member = Optional.of(member.get()); + } + return this; + } + + /** + *

The user's member record at this account, when they are a member of it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(ListPeopleResponseDataItemMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + /** + *

The user's member record at this account, when they are a member of it.

+ */ + @java.lang.Override + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public _FinalStage member(Optional member) { + this.member = member; + return this; + } + + @java.lang.Override + public _FinalStage ltv(Double ltv) { + this.ltv = Optional.ofNullable(ltv); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ltv", nulls = Nulls.SKIP) + public _FinalStage ltv(Optional ltv) { + this.ltv = ltv; + return this; + } + + @java.lang.Override + public _FinalStage location(ListPeopleResponseDataItemLocation location) { + this.location = Optional.ofNullable(location); + return this; + } + + @java.lang.Override + @JsonSetter(value = "location", nulls = Nulls.SKIP) + public _FinalStage location(Optional location) { + this.location = location; + return this; + } + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastSource(Nullable lastSource) { + if (lastSource.isNull()) { + this.lastSource = null; + } else if (lastSource.isEmpty()) { + this.lastSource = Optional.empty(); + } else { + this.lastSource = Optional.of(lastSource.get()); + } + return this; + } + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastSource(ListPeopleResponseDataItemLastSource lastSource) { + this.lastSource = Optional.ofNullable(lastSource); + return this; + } + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ */ + @java.lang.Override + @JsonSetter(value = "last_source", nulls = Nulls.SKIP) + public _FinalStage lastSource(Optional lastSource) { + this.lastSource = lastSource; + return this; + } + + @java.lang.Override + public _FinalStage lastPurchaseAt(Nullable lastPurchaseAt) { + if (lastPurchaseAt.isNull()) { + this.lastPurchaseAt = null; + } else if (lastPurchaseAt.isEmpty()) { + this.lastPurchaseAt = Optional.empty(); + } else { + this.lastPurchaseAt = Optional.of(lastPurchaseAt.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage lastPurchaseAt(OffsetDateTime lastPurchaseAt) { + this.lastPurchaseAt = Optional.ofNullable(lastPurchaseAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "last_purchase_at", nulls = Nulls.SKIP) + public _FinalStage lastPurchaseAt(Optional lastPurchaseAt) { + this.lastPurchaseAt = lastPurchaseAt; + return this; + } + + @java.lang.Override + public _FinalStage lastIp(Nullable lastIp) { + if (lastIp.isNull()) { + this.lastIp = null; + } else if (lastIp.isEmpty()) { + this.lastIp = Optional.empty(); + } else { + this.lastIp = Optional.of(lastIp.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage lastIp(String lastIp) { + this.lastIp = Optional.ofNullable(lastIp); + return this; + } + + @java.lang.Override + @JsonSetter(value = "last_ip", nulls = Nulls.SKIP) + public _FinalStage lastIp(Optional lastIp) { + this.lastIp = lastIp; + return this; + } + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstSource(Nullable firstSource) { + if (firstSource.isNull()) { + this.firstSource = null; + } else if (firstSource.isEmpty()) { + this.firstSource = Optional.empty(); + } else { + this.firstSource = Optional.of(firstSource.get()); + } + return this; + } + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstSource(ListPeopleResponseDataItemFirstSource firstSource) { + this.firstSource = Optional.ofNullable(firstSource); + return this; + } + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ */ + @java.lang.Override + @JsonSetter(value = "first_source", nulls = Nulls.SKIP) + public _FinalStage firstSource(Optional firstSource) { + this.firstSource = firstSource; + return this; + } + + @java.lang.Override + public _FinalStage firstPurchaseAt(Nullable firstPurchaseAt) { + if (firstPurchaseAt.isNull()) { + this.firstPurchaseAt = null; + } else if (firstPurchaseAt.isEmpty()) { + this.firstPurchaseAt = Optional.empty(); + } else { + this.firstPurchaseAt = Optional.of(firstPurchaseAt.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage firstPurchaseAt(OffsetDateTime firstPurchaseAt) { + this.firstPurchaseAt = Optional.ofNullable(firstPurchaseAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "first_purchase_at", nulls = Nulls.SKIP) + public _FinalStage firstPurchaseAt(Optional firstPurchaseAt) { + this.firstPurchaseAt = firstPurchaseAt; + return this; + } + + /** + *

The email from the person's most recent event that carried one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The email from the person's most recent event that carried one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The email from the person's most recent event that carried one.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public _FinalStage device(ListPeopleResponseDataItemDevice device) { + this.device = Optional.ofNullable(device); + return this; + } + + @java.lang.Override + @JsonSetter(value = "device", nulls = Nulls.SKIP) + public _FinalStage device(Optional device) { + this.device = device; + return this; + } + + @java.lang.Override + public _FinalStage aov(Double aov) { + this.aov = Optional.ofNullable(aov); + return this; + } + + @java.lang.Override + @JsonSetter(value = "aov", nulls = Nulls.SKIP) + public _FinalStage aov(Optional aov) { + this.aov = aov; + return this; + } + + @java.lang.Override + public ListPeopleResponseDataItem build() { + return new ListPeopleResponseDataItem( + accountId, + aov, + device, + email, + eventCount, + firstPurchaseAt, + firstSeenAt, + firstSource, + id, + lastIp, + lastPurchaseAt, + lastSeenAt, + lastSource, + location, + ltv, + member, + name, + phone, + purchaseCount, + timezone, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemDevice.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemDevice.java new file mode 100644 index 00000000..44a74e7b --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemDevice.java @@ -0,0 +1,216 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleResponseDataItemDevice.Builder.class) +public final class ListPeopleResponseDataItemDevice { + private final Optional browser; + + private final Optional device; + + private final Optional os; + + private final Map additionalProperties; + + private ListPeopleResponseDataItemDevice( + Optional browser, + Optional device, + Optional os, + Map additionalProperties) { + this.browser = browser; + this.device = device; + this.os = os; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getBrowser() { + if (browser == null) { + return Optional.empty(); + } + return browser; + } + + @JsonIgnore + public Optional getDevice() { + if (device == null) { + return Optional.empty(); + } + return device; + } + + @JsonIgnore + public Optional getOs() { + if (os == null) { + return Optional.empty(); + } + return os; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("browser") + private Optional _getBrowser() { + return browser; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("device") + private Optional _getDevice() { + return device; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("os") + private Optional _getOs() { + return os; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleResponseDataItemDevice && equalTo((ListPeopleResponseDataItemDevice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleResponseDataItemDevice other) { + return browser.equals(other.browser) && device.equals(other.device) && os.equals(other.os); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.browser, this.device, this.os); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional browser = Optional.empty(); + + private Optional device = Optional.empty(); + + private Optional os = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListPeopleResponseDataItemDevice other) { + browser(other.getBrowser()); + device(other.getDevice()); + os(other.getOs()); + return this; + } + + @JsonSetter(value = "browser", nulls = Nulls.SKIP) + public Builder browser(Optional browser) { + this.browser = browser; + return this; + } + + public Builder browser(String browser) { + this.browser = Optional.ofNullable(browser); + return this; + } + + public Builder browser(Nullable browser) { + if (browser.isNull()) { + this.browser = null; + } else if (browser.isEmpty()) { + this.browser = Optional.empty(); + } else { + this.browser = Optional.of(browser.get()); + } + return this; + } + + @JsonSetter(value = "device", nulls = Nulls.SKIP) + public Builder device(Optional device) { + this.device = device; + return this; + } + + public Builder device(String device) { + this.device = Optional.ofNullable(device); + return this; + } + + public Builder device(Nullable device) { + if (device.isNull()) { + this.device = null; + } else if (device.isEmpty()) { + this.device = Optional.empty(); + } else { + this.device = Optional.of(device.get()); + } + return this; + } + + @JsonSetter(value = "os", nulls = Nulls.SKIP) + public Builder os(Optional os) { + this.os = os; + return this; + } + + public Builder os(String os) { + this.os = Optional.ofNullable(os); + return this; + } + + public Builder os(Nullable os) { + if (os.isNull()) { + this.os = null; + } else if (os.isEmpty()) { + this.os = Optional.empty(); + } else { + this.os = Optional.of(os.get()); + } + return this; + } + + public ListPeopleResponseDataItemDevice build() { + return new ListPeopleResponseDataItemDevice(browser, device, os, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemFirstSource.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemFirstSource.java new file mode 100644 index 00000000..cb84ee43 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemFirstSource.java @@ -0,0 +1,507 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleResponseDataItemFirstSource.Builder.class) +public final class ListPeopleResponseDataItemFirstSource { + private final Optional ad; + + private final Optional adGroup; + + private final Optional campaign; + + private final Optional domain; + + private final Optional occurredAt; + + private final Optional platform; + + private final ListPeopleResponseDataItemFirstSourceType type; + + private final Optional utmSource; + + private final Map additionalProperties; + + private ListPeopleResponseDataItemFirstSource( + Optional ad, + Optional adGroup, + Optional campaign, + Optional domain, + Optional occurredAt, + Optional platform, + ListPeopleResponseDataItemFirstSourceType type, + Optional utmSource, + Map additionalProperties) { + this.ad = ad; + this.adGroup = adGroup; + this.campaign = campaign; + this.domain = domain; + this.occurredAt = occurredAt; + this.platform = platform; + this.type = type; + this.utmSource = utmSource; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getAd() { + if (ad == null) { + return Optional.empty(); + } + return ad; + } + + @JsonIgnore + public Optional getAdGroup() { + if (adGroup == null) { + return Optional.empty(); + } + return adGroup; + } + + @JsonIgnore + public Optional getCampaign() { + if (campaign == null) { + return Optional.empty(); + } + return campaign; + } + + @JsonIgnore + public Optional getDomain() { + if (domain == null) { + return Optional.empty(); + } + return domain; + } + + @JsonIgnore + public Optional getOccurredAt() { + if (occurredAt == null) { + return Optional.empty(); + } + return occurredAt; + } + + @JsonIgnore + public Optional getPlatform() { + if (platform == null) { + return Optional.empty(); + } + return platform; + } + + @JsonProperty("type") + public ListPeopleResponseDataItemFirstSourceType getType() { + return type; + } + + @JsonIgnore + public Optional getUtmSource() { + if (utmSource == null) { + return Optional.empty(); + } + return utmSource; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad") + private Optional _getAd() { + return ad; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_group") + private Optional _getAdGroup() { + return adGroup; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("campaign") + private Optional _getCampaign() { + return campaign; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("domain") + private Optional _getDomain() { + return domain; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("occurred_at") + private Optional _getOccurredAt() { + return occurredAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("platform") + private Optional _getPlatform() { + return platform; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_source") + private Optional _getUtmSource() { + return utmSource; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleResponseDataItemFirstSource + && equalTo((ListPeopleResponseDataItemFirstSource) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleResponseDataItemFirstSource other) { + return ad.equals(other.ad) + && adGroup.equals(other.adGroup) + && campaign.equals(other.campaign) + && domain.equals(other.domain) + && occurredAt.equals(other.occurredAt) + && platform.equals(other.platform) + && type.equals(other.type) + && utmSource.equals(other.utmSource); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.ad, + this.adGroup, + this.campaign, + this.domain, + this.occurredAt, + this.platform, + this.type, + this.utmSource); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + _FinalStage type(@NotNull ListPeopleResponseDataItemFirstSourceType type); + + Builder from(ListPeopleResponseDataItemFirstSource other); + } + + public interface _FinalStage { + ListPeopleResponseDataItemFirstSource build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage ad(Optional ad); + + _FinalStage ad(ListPeopleResponseDataItemFirstSourceAd ad); + + _FinalStage ad(Nullable ad); + + _FinalStage adGroup(Optional adGroup); + + _FinalStage adGroup(ListPeopleResponseDataItemFirstSourceAdGroup adGroup); + + _FinalStage adGroup(Nullable adGroup); + + _FinalStage campaign(Optional campaign); + + _FinalStage campaign(ListPeopleResponseDataItemFirstSourceCampaign campaign); + + _FinalStage campaign(Nullable campaign); + + _FinalStage domain(Optional domain); + + _FinalStage domain(String domain); + + _FinalStage domain(Nullable domain); + + _FinalStage occurredAt(Optional occurredAt); + + _FinalStage occurredAt(OffsetDateTime occurredAt); + + _FinalStage occurredAt(Nullable occurredAt); + + _FinalStage platform(Optional platform); + + _FinalStage platform(String platform); + + _FinalStage platform(Nullable platform); + + _FinalStage utmSource(Optional utmSource); + + _FinalStage utmSource(String utmSource); + + _FinalStage utmSource(Nullable utmSource); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private ListPeopleResponseDataItemFirstSourceType type; + + private Optional utmSource = Optional.empty(); + + private Optional platform = Optional.empty(); + + private Optional occurredAt = Optional.empty(); + + private Optional domain = Optional.empty(); + + private Optional campaign = Optional.empty(); + + private Optional adGroup = Optional.empty(); + + private Optional ad = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPeopleResponseDataItemFirstSource other) { + ad(other.getAd()); + adGroup(other.getAdGroup()); + campaign(other.getCampaign()); + domain(other.getDomain()); + occurredAt(other.getOccurredAt()); + platform(other.getPlatform()); + type(other.getType()); + utmSource(other.getUtmSource()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull ListPeopleResponseDataItemFirstSourceType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage utmSource(Nullable utmSource) { + if (utmSource.isNull()) { + this.utmSource = null; + } else if (utmSource.isEmpty()) { + this.utmSource = Optional.empty(); + } else { + this.utmSource = Optional.of(utmSource.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage utmSource(String utmSource) { + this.utmSource = Optional.ofNullable(utmSource); + return this; + } + + @java.lang.Override + @JsonSetter(value = "utm_source", nulls = Nulls.SKIP) + public _FinalStage utmSource(Optional utmSource) { + this.utmSource = utmSource; + return this; + } + + @java.lang.Override + public _FinalStage platform(Nullable platform) { + if (platform.isNull()) { + this.platform = null; + } else if (platform.isEmpty()) { + this.platform = Optional.empty(); + } else { + this.platform = Optional.of(platform.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage platform(String platform) { + this.platform = Optional.ofNullable(platform); + return this; + } + + @java.lang.Override + @JsonSetter(value = "platform", nulls = Nulls.SKIP) + public _FinalStage platform(Optional platform) { + this.platform = platform; + return this; + } + + @java.lang.Override + public _FinalStage occurredAt(Nullable occurredAt) { + if (occurredAt.isNull()) { + this.occurredAt = null; + } else if (occurredAt.isEmpty()) { + this.occurredAt = Optional.empty(); + } else { + this.occurredAt = Optional.of(occurredAt.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage occurredAt(OffsetDateTime occurredAt) { + this.occurredAt = Optional.ofNullable(occurredAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "occurred_at", nulls = Nulls.SKIP) + public _FinalStage occurredAt(Optional occurredAt) { + this.occurredAt = occurredAt; + return this; + } + + @java.lang.Override + public _FinalStage domain(Nullable domain) { + if (domain.isNull()) { + this.domain = null; + } else if (domain.isEmpty()) { + this.domain = Optional.empty(); + } else { + this.domain = Optional.of(domain.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage domain(String domain) { + this.domain = Optional.ofNullable(domain); + return this; + } + + @java.lang.Override + @JsonSetter(value = "domain", nulls = Nulls.SKIP) + public _FinalStage domain(Optional domain) { + this.domain = domain; + return this; + } + + @java.lang.Override + public _FinalStage campaign(Nullable campaign) { + if (campaign.isNull()) { + this.campaign = null; + } else if (campaign.isEmpty()) { + this.campaign = Optional.empty(); + } else { + this.campaign = Optional.of(campaign.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage campaign(ListPeopleResponseDataItemFirstSourceCampaign campaign) { + this.campaign = Optional.ofNullable(campaign); + return this; + } + + @java.lang.Override + @JsonSetter(value = "campaign", nulls = Nulls.SKIP) + public _FinalStage campaign(Optional campaign) { + this.campaign = campaign; + return this; + } + + @java.lang.Override + public _FinalStage adGroup(Nullable adGroup) { + if (adGroup.isNull()) { + this.adGroup = null; + } else if (adGroup.isEmpty()) { + this.adGroup = Optional.empty(); + } else { + this.adGroup = Optional.of(adGroup.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage adGroup(ListPeopleResponseDataItemFirstSourceAdGroup adGroup) { + this.adGroup = Optional.ofNullable(adGroup); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ad_group", nulls = Nulls.SKIP) + public _FinalStage adGroup(Optional adGroup) { + this.adGroup = adGroup; + return this; + } + + @java.lang.Override + public _FinalStage ad(Nullable ad) { + if (ad.isNull()) { + this.ad = null; + } else if (ad.isEmpty()) { + this.ad = Optional.empty(); + } else { + this.ad = Optional.of(ad.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage ad(ListPeopleResponseDataItemFirstSourceAd ad) { + this.ad = Optional.ofNullable(ad); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ad", nulls = Nulls.SKIP) + public _FinalStage ad(Optional ad) { + this.ad = ad; + return this; + } + + @java.lang.Override + public ListPeopleResponseDataItemFirstSource build() { + return new ListPeopleResponseDataItemFirstSource( + ad, adGroup, campaign, domain, occurredAt, platform, type, utmSource, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemFirstSourceAd.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemFirstSourceAd.java new file mode 100644 index 00000000..a0ec11ed --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemFirstSourceAd.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleResponseDataItemFirstSourceAd.Builder.class) +public final class ListPeopleResponseDataItemFirstSourceAd { + private final String id; + + private final Optional name; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private ListPeopleResponseDataItemFirstSourceAd( + String id, Optional name, Optional thumbnailUrl, Map additionalProperties) { + this.id = id; + this.name = name; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleResponseDataItemFirstSourceAd + && equalTo((ListPeopleResponseDataItemFirstSourceAd) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleResponseDataItemFirstSourceAd other) { + return id.equals(other.id) && name.equals(other.name) && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(ListPeopleResponseDataItemFirstSourceAd other); + } + + public interface _FinalStage { + ListPeopleResponseDataItemFirstSourceAd build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPeopleResponseDataItemFirstSourceAd other) { + id(other.getId()); + name(other.getName()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ListPeopleResponseDataItemFirstSourceAd build() { + return new ListPeopleResponseDataItemFirstSourceAd(id, name, thumbnailUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemFirstSourceAdGroup.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemFirstSourceAdGroup.java new file mode 100644 index 00000000..569b6e61 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemFirstSourceAdGroup.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleResponseDataItemFirstSourceAdGroup.Builder.class) +public final class ListPeopleResponseDataItemFirstSourceAdGroup { + private final String id; + + private final Optional name; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private ListPeopleResponseDataItemFirstSourceAdGroup( + String id, Optional name, Optional thumbnailUrl, Map additionalProperties) { + this.id = id; + this.name = name; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleResponseDataItemFirstSourceAdGroup + && equalTo((ListPeopleResponseDataItemFirstSourceAdGroup) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleResponseDataItemFirstSourceAdGroup other) { + return id.equals(other.id) && name.equals(other.name) && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(ListPeopleResponseDataItemFirstSourceAdGroup other); + } + + public interface _FinalStage { + ListPeopleResponseDataItemFirstSourceAdGroup build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPeopleResponseDataItemFirstSourceAdGroup other) { + id(other.getId()); + name(other.getName()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ListPeopleResponseDataItemFirstSourceAdGroup build() { + return new ListPeopleResponseDataItemFirstSourceAdGroup(id, name, thumbnailUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemFirstSourceCampaign.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemFirstSourceCampaign.java new file mode 100644 index 00000000..d7c94ad9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemFirstSourceCampaign.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleResponseDataItemFirstSourceCampaign.Builder.class) +public final class ListPeopleResponseDataItemFirstSourceCampaign { + private final String id; + + private final Optional name; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private ListPeopleResponseDataItemFirstSourceCampaign( + String id, Optional name, Optional thumbnailUrl, Map additionalProperties) { + this.id = id; + this.name = name; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleResponseDataItemFirstSourceCampaign + && equalTo((ListPeopleResponseDataItemFirstSourceCampaign) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleResponseDataItemFirstSourceCampaign other) { + return id.equals(other.id) && name.equals(other.name) && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(ListPeopleResponseDataItemFirstSourceCampaign other); + } + + public interface _FinalStage { + ListPeopleResponseDataItemFirstSourceCampaign build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPeopleResponseDataItemFirstSourceCampaign other) { + id(other.getId()); + name(other.getName()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ListPeopleResponseDataItemFirstSourceCampaign build() { + return new ListPeopleResponseDataItemFirstSourceCampaign(id, name, thumbnailUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemFirstSourceType.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemFirstSourceType.java new file mode 100644 index 00000000..95d893e1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemFirstSourceType.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPeopleResponseDataItemFirstSourceType { + public static final ListPeopleResponseDataItemFirstSourceType UTM = + new ListPeopleResponseDataItemFirstSourceType(Value.UTM, "utm"); + + public static final ListPeopleResponseDataItemFirstSourceType REFERRER = + new ListPeopleResponseDataItemFirstSourceType(Value.REFERRER, "referrer"); + + public static final ListPeopleResponseDataItemFirstSourceType LEAD_FORM = + new ListPeopleResponseDataItemFirstSourceType(Value.LEAD_FORM, "lead_form"); + + public static final ListPeopleResponseDataItemFirstSourceType EXTERNAL_AD_CLICK = + new ListPeopleResponseDataItemFirstSourceType(Value.EXTERNAL_AD_CLICK, "external_ad_click"); + + public static final ListPeopleResponseDataItemFirstSourceType AD_CLICK = + new ListPeopleResponseDataItemFirstSourceType(Value.AD_CLICK, "ad_click"); + + private final Value value; + + private final String string; + + ListPeopleResponseDataItemFirstSourceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPeopleResponseDataItemFirstSourceType + && this.string.equals(((ListPeopleResponseDataItemFirstSourceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case UTM: + return visitor.visitUtm(); + case REFERRER: + return visitor.visitReferrer(); + case LEAD_FORM: + return visitor.visitLeadForm(); + case EXTERNAL_AD_CLICK: + return visitor.visitExternalAdClick(); + case AD_CLICK: + return visitor.visitAdClick(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPeopleResponseDataItemFirstSourceType valueOf(String value) { + switch (value) { + case "utm": + return UTM; + case "referrer": + return REFERRER; + case "lead_form": + return LEAD_FORM; + case "external_ad_click": + return EXTERNAL_AD_CLICK; + case "ad_click": + return AD_CLICK; + default: + return new ListPeopleResponseDataItemFirstSourceType(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_CLICK, + + LEAD_FORM, + + EXTERNAL_AD_CLICK, + + REFERRER, + + UTM, + + UNKNOWN + } + + public interface Visitor { + T visitAdClick(); + + T visitLeadForm(); + + T visitExternalAdClick(); + + T visitReferrer(); + + T visitUtm(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLastSource.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLastSource.java new file mode 100644 index 00000000..8b4d7565 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLastSource.java @@ -0,0 +1,507 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleResponseDataItemLastSource.Builder.class) +public final class ListPeopleResponseDataItemLastSource { + private final Optional ad; + + private final Optional adGroup; + + private final Optional campaign; + + private final Optional domain; + + private final Optional occurredAt; + + private final Optional platform; + + private final ListPeopleResponseDataItemLastSourceType type; + + private final Optional utmSource; + + private final Map additionalProperties; + + private ListPeopleResponseDataItemLastSource( + Optional ad, + Optional adGroup, + Optional campaign, + Optional domain, + Optional occurredAt, + Optional platform, + ListPeopleResponseDataItemLastSourceType type, + Optional utmSource, + Map additionalProperties) { + this.ad = ad; + this.adGroup = adGroup; + this.campaign = campaign; + this.domain = domain; + this.occurredAt = occurredAt; + this.platform = platform; + this.type = type; + this.utmSource = utmSource; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getAd() { + if (ad == null) { + return Optional.empty(); + } + return ad; + } + + @JsonIgnore + public Optional getAdGroup() { + if (adGroup == null) { + return Optional.empty(); + } + return adGroup; + } + + @JsonIgnore + public Optional getCampaign() { + if (campaign == null) { + return Optional.empty(); + } + return campaign; + } + + @JsonIgnore + public Optional getDomain() { + if (domain == null) { + return Optional.empty(); + } + return domain; + } + + @JsonIgnore + public Optional getOccurredAt() { + if (occurredAt == null) { + return Optional.empty(); + } + return occurredAt; + } + + @JsonIgnore + public Optional getPlatform() { + if (platform == null) { + return Optional.empty(); + } + return platform; + } + + @JsonProperty("type") + public ListPeopleResponseDataItemLastSourceType getType() { + return type; + } + + @JsonIgnore + public Optional getUtmSource() { + if (utmSource == null) { + return Optional.empty(); + } + return utmSource; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad") + private Optional _getAd() { + return ad; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_group") + private Optional _getAdGroup() { + return adGroup; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("campaign") + private Optional _getCampaign() { + return campaign; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("domain") + private Optional _getDomain() { + return domain; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("occurred_at") + private Optional _getOccurredAt() { + return occurredAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("platform") + private Optional _getPlatform() { + return platform; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_source") + private Optional _getUtmSource() { + return utmSource; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleResponseDataItemLastSource + && equalTo((ListPeopleResponseDataItemLastSource) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleResponseDataItemLastSource other) { + return ad.equals(other.ad) + && adGroup.equals(other.adGroup) + && campaign.equals(other.campaign) + && domain.equals(other.domain) + && occurredAt.equals(other.occurredAt) + && platform.equals(other.platform) + && type.equals(other.type) + && utmSource.equals(other.utmSource); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.ad, + this.adGroup, + this.campaign, + this.domain, + this.occurredAt, + this.platform, + this.type, + this.utmSource); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + _FinalStage type(@NotNull ListPeopleResponseDataItemLastSourceType type); + + Builder from(ListPeopleResponseDataItemLastSource other); + } + + public interface _FinalStage { + ListPeopleResponseDataItemLastSource build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage ad(Optional ad); + + _FinalStage ad(ListPeopleResponseDataItemLastSourceAd ad); + + _FinalStage ad(Nullable ad); + + _FinalStage adGroup(Optional adGroup); + + _FinalStage adGroup(ListPeopleResponseDataItemLastSourceAdGroup adGroup); + + _FinalStage adGroup(Nullable adGroup); + + _FinalStage campaign(Optional campaign); + + _FinalStage campaign(ListPeopleResponseDataItemLastSourceCampaign campaign); + + _FinalStage campaign(Nullable campaign); + + _FinalStage domain(Optional domain); + + _FinalStage domain(String domain); + + _FinalStage domain(Nullable domain); + + _FinalStage occurredAt(Optional occurredAt); + + _FinalStage occurredAt(OffsetDateTime occurredAt); + + _FinalStage occurredAt(Nullable occurredAt); + + _FinalStage platform(Optional platform); + + _FinalStage platform(String platform); + + _FinalStage platform(Nullable platform); + + _FinalStage utmSource(Optional utmSource); + + _FinalStage utmSource(String utmSource); + + _FinalStage utmSource(Nullable utmSource); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private ListPeopleResponseDataItemLastSourceType type; + + private Optional utmSource = Optional.empty(); + + private Optional platform = Optional.empty(); + + private Optional occurredAt = Optional.empty(); + + private Optional domain = Optional.empty(); + + private Optional campaign = Optional.empty(); + + private Optional adGroup = Optional.empty(); + + private Optional ad = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPeopleResponseDataItemLastSource other) { + ad(other.getAd()); + adGroup(other.getAdGroup()); + campaign(other.getCampaign()); + domain(other.getDomain()); + occurredAt(other.getOccurredAt()); + platform(other.getPlatform()); + type(other.getType()); + utmSource(other.getUtmSource()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull ListPeopleResponseDataItemLastSourceType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage utmSource(Nullable utmSource) { + if (utmSource.isNull()) { + this.utmSource = null; + } else if (utmSource.isEmpty()) { + this.utmSource = Optional.empty(); + } else { + this.utmSource = Optional.of(utmSource.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage utmSource(String utmSource) { + this.utmSource = Optional.ofNullable(utmSource); + return this; + } + + @java.lang.Override + @JsonSetter(value = "utm_source", nulls = Nulls.SKIP) + public _FinalStage utmSource(Optional utmSource) { + this.utmSource = utmSource; + return this; + } + + @java.lang.Override + public _FinalStage platform(Nullable platform) { + if (platform.isNull()) { + this.platform = null; + } else if (platform.isEmpty()) { + this.platform = Optional.empty(); + } else { + this.platform = Optional.of(platform.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage platform(String platform) { + this.platform = Optional.ofNullable(platform); + return this; + } + + @java.lang.Override + @JsonSetter(value = "platform", nulls = Nulls.SKIP) + public _FinalStage platform(Optional platform) { + this.platform = platform; + return this; + } + + @java.lang.Override + public _FinalStage occurredAt(Nullable occurredAt) { + if (occurredAt.isNull()) { + this.occurredAt = null; + } else if (occurredAt.isEmpty()) { + this.occurredAt = Optional.empty(); + } else { + this.occurredAt = Optional.of(occurredAt.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage occurredAt(OffsetDateTime occurredAt) { + this.occurredAt = Optional.ofNullable(occurredAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "occurred_at", nulls = Nulls.SKIP) + public _FinalStage occurredAt(Optional occurredAt) { + this.occurredAt = occurredAt; + return this; + } + + @java.lang.Override + public _FinalStage domain(Nullable domain) { + if (domain.isNull()) { + this.domain = null; + } else if (domain.isEmpty()) { + this.domain = Optional.empty(); + } else { + this.domain = Optional.of(domain.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage domain(String domain) { + this.domain = Optional.ofNullable(domain); + return this; + } + + @java.lang.Override + @JsonSetter(value = "domain", nulls = Nulls.SKIP) + public _FinalStage domain(Optional domain) { + this.domain = domain; + return this; + } + + @java.lang.Override + public _FinalStage campaign(Nullable campaign) { + if (campaign.isNull()) { + this.campaign = null; + } else if (campaign.isEmpty()) { + this.campaign = Optional.empty(); + } else { + this.campaign = Optional.of(campaign.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage campaign(ListPeopleResponseDataItemLastSourceCampaign campaign) { + this.campaign = Optional.ofNullable(campaign); + return this; + } + + @java.lang.Override + @JsonSetter(value = "campaign", nulls = Nulls.SKIP) + public _FinalStage campaign(Optional campaign) { + this.campaign = campaign; + return this; + } + + @java.lang.Override + public _FinalStage adGroup(Nullable adGroup) { + if (adGroup.isNull()) { + this.adGroup = null; + } else if (adGroup.isEmpty()) { + this.adGroup = Optional.empty(); + } else { + this.adGroup = Optional.of(adGroup.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage adGroup(ListPeopleResponseDataItemLastSourceAdGroup adGroup) { + this.adGroup = Optional.ofNullable(adGroup); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ad_group", nulls = Nulls.SKIP) + public _FinalStage adGroup(Optional adGroup) { + this.adGroup = adGroup; + return this; + } + + @java.lang.Override + public _FinalStage ad(Nullable ad) { + if (ad.isNull()) { + this.ad = null; + } else if (ad.isEmpty()) { + this.ad = Optional.empty(); + } else { + this.ad = Optional.of(ad.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage ad(ListPeopleResponseDataItemLastSourceAd ad) { + this.ad = Optional.ofNullable(ad); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ad", nulls = Nulls.SKIP) + public _FinalStage ad(Optional ad) { + this.ad = ad; + return this; + } + + @java.lang.Override + public ListPeopleResponseDataItemLastSource build() { + return new ListPeopleResponseDataItemLastSource( + ad, adGroup, campaign, domain, occurredAt, platform, type, utmSource, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLastSourceAd.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLastSourceAd.java new file mode 100644 index 00000000..0acf9101 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLastSourceAd.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleResponseDataItemLastSourceAd.Builder.class) +public final class ListPeopleResponseDataItemLastSourceAd { + private final String id; + + private final Optional name; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private ListPeopleResponseDataItemLastSourceAd( + String id, Optional name, Optional thumbnailUrl, Map additionalProperties) { + this.id = id; + this.name = name; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleResponseDataItemLastSourceAd + && equalTo((ListPeopleResponseDataItemLastSourceAd) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleResponseDataItemLastSourceAd other) { + return id.equals(other.id) && name.equals(other.name) && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(ListPeopleResponseDataItemLastSourceAd other); + } + + public interface _FinalStage { + ListPeopleResponseDataItemLastSourceAd build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPeopleResponseDataItemLastSourceAd other) { + id(other.getId()); + name(other.getName()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ListPeopleResponseDataItemLastSourceAd build() { + return new ListPeopleResponseDataItemLastSourceAd(id, name, thumbnailUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLastSourceAdGroup.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLastSourceAdGroup.java new file mode 100644 index 00000000..6ed62bc6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLastSourceAdGroup.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleResponseDataItemLastSourceAdGroup.Builder.class) +public final class ListPeopleResponseDataItemLastSourceAdGroup { + private final String id; + + private final Optional name; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private ListPeopleResponseDataItemLastSourceAdGroup( + String id, Optional name, Optional thumbnailUrl, Map additionalProperties) { + this.id = id; + this.name = name; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleResponseDataItemLastSourceAdGroup + && equalTo((ListPeopleResponseDataItemLastSourceAdGroup) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleResponseDataItemLastSourceAdGroup other) { + return id.equals(other.id) && name.equals(other.name) && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(ListPeopleResponseDataItemLastSourceAdGroup other); + } + + public interface _FinalStage { + ListPeopleResponseDataItemLastSourceAdGroup build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPeopleResponseDataItemLastSourceAdGroup other) { + id(other.getId()); + name(other.getName()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ListPeopleResponseDataItemLastSourceAdGroup build() { + return new ListPeopleResponseDataItemLastSourceAdGroup(id, name, thumbnailUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLastSourceCampaign.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLastSourceCampaign.java new file mode 100644 index 00000000..be790acc --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLastSourceCampaign.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleResponseDataItemLastSourceCampaign.Builder.class) +public final class ListPeopleResponseDataItemLastSourceCampaign { + private final String id; + + private final Optional name; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private ListPeopleResponseDataItemLastSourceCampaign( + String id, Optional name, Optional thumbnailUrl, Map additionalProperties) { + this.id = id; + this.name = name; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleResponseDataItemLastSourceCampaign + && equalTo((ListPeopleResponseDataItemLastSourceCampaign) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleResponseDataItemLastSourceCampaign other) { + return id.equals(other.id) && name.equals(other.name) && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(ListPeopleResponseDataItemLastSourceCampaign other); + } + + public interface _FinalStage { + ListPeopleResponseDataItemLastSourceCampaign build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPeopleResponseDataItemLastSourceCampaign other) { + id(other.getId()); + name(other.getName()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ListPeopleResponseDataItemLastSourceCampaign build() { + return new ListPeopleResponseDataItemLastSourceCampaign(id, name, thumbnailUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLastSourceType.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLastSourceType.java new file mode 100644 index 00000000..85734399 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLastSourceType.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPeopleResponseDataItemLastSourceType { + public static final ListPeopleResponseDataItemLastSourceType UTM = + new ListPeopleResponseDataItemLastSourceType(Value.UTM, "utm"); + + public static final ListPeopleResponseDataItemLastSourceType REFERRER = + new ListPeopleResponseDataItemLastSourceType(Value.REFERRER, "referrer"); + + public static final ListPeopleResponseDataItemLastSourceType LEAD_FORM = + new ListPeopleResponseDataItemLastSourceType(Value.LEAD_FORM, "lead_form"); + + public static final ListPeopleResponseDataItemLastSourceType EXTERNAL_AD_CLICK = + new ListPeopleResponseDataItemLastSourceType(Value.EXTERNAL_AD_CLICK, "external_ad_click"); + + public static final ListPeopleResponseDataItemLastSourceType AD_CLICK = + new ListPeopleResponseDataItemLastSourceType(Value.AD_CLICK, "ad_click"); + + private final Value value; + + private final String string; + + ListPeopleResponseDataItemLastSourceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPeopleResponseDataItemLastSourceType + && this.string.equals(((ListPeopleResponseDataItemLastSourceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case UTM: + return visitor.visitUtm(); + case REFERRER: + return visitor.visitReferrer(); + case LEAD_FORM: + return visitor.visitLeadForm(); + case EXTERNAL_AD_CLICK: + return visitor.visitExternalAdClick(); + case AD_CLICK: + return visitor.visitAdClick(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPeopleResponseDataItemLastSourceType valueOf(String value) { + switch (value) { + case "utm": + return UTM; + case "referrer": + return REFERRER; + case "lead_form": + return LEAD_FORM; + case "external_ad_click": + return EXTERNAL_AD_CLICK; + case "ad_click": + return AD_CLICK; + default: + return new ListPeopleResponseDataItemLastSourceType(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_CLICK, + + LEAD_FORM, + + EXTERNAL_AD_CLICK, + + REFERRER, + + UTM, + + UNKNOWN + } + + public interface Visitor { + T visitAdClick(); + + T visitLeadForm(); + + T visitExternalAdClick(); + + T visitReferrer(); + + T visitUtm(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLocation.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLocation.java new file mode 100644 index 00000000..d99a5870 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemLocation.java @@ -0,0 +1,217 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleResponseDataItemLocation.Builder.class) +public final class ListPeopleResponseDataItemLocation { + private final Optional city; + + private final Optional continent; + + private final Optional country; + + private final Map additionalProperties; + + private ListPeopleResponseDataItemLocation( + Optional city, + Optional continent, + Optional country, + Map additionalProperties) { + this.city = city; + this.continent = continent; + this.country = country; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + @JsonIgnore + public Optional getContinent() { + if (continent == null) { + return Optional.empty(); + } + return continent; + } + + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("continent") + private Optional _getContinent() { + return continent; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleResponseDataItemLocation + && equalTo((ListPeopleResponseDataItemLocation) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleResponseDataItemLocation other) { + return city.equals(other.city) && continent.equals(other.continent) && country.equals(other.country); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.continent, this.country); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional continent = Optional.empty(); + + private Optional country = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListPeopleResponseDataItemLocation other) { + city(other.getCity()); + continent(other.getContinent()); + country(other.getCountry()); + return this; + } + + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + @JsonSetter(value = "continent", nulls = Nulls.SKIP) + public Builder continent(Optional continent) { + this.continent = continent; + return this; + } + + public Builder continent(String continent) { + this.continent = Optional.ofNullable(continent); + return this; + } + + public Builder continent(Nullable continent) { + if (continent.isNull()) { + this.continent = null; + } else if (continent.isEmpty()) { + this.continent = Optional.empty(); + } else { + this.continent = Optional.of(continent.get()); + } + return this; + } + + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + public ListPeopleResponseDataItemLocation build() { + return new ListPeopleResponseDataItemLocation(city, continent, country, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemMember.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemMember.java new file mode 100644 index 00000000..1ae86f10 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemMember.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleResponseDataItemMember.Builder.class) +public final class ListPeopleResponseDataItemMember { + private final String id; + + private final Optional joinedAt; + + private final Optional status; + + private final Optional usdTotalSpend; + + private final Map additionalProperties; + + private ListPeopleResponseDataItemMember( + String id, + Optional joinedAt, + Optional status, + Optional usdTotalSpend, + Map additionalProperties) { + this.id = id; + this.joinedAt = joinedAt; + this.status = status; + this.usdTotalSpend = usdTotalSpend; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getJoinedAt() { + if (joinedAt == null) { + return Optional.empty(); + } + return joinedAt; + } + + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + @JsonProperty("usd_total_spend") + public Optional getUsdTotalSpend() { + return usdTotalSpend; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("joined_at") + private Optional _getJoinedAt() { + return joinedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleResponseDataItemMember && equalTo((ListPeopleResponseDataItemMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleResponseDataItemMember other) { + return id.equals(other.id) + && joinedAt.equals(other.joinedAt) + && status.equals(other.status) + && usdTotalSpend.equals(other.usdTotalSpend); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.joinedAt, this.status, this.usdTotalSpend); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(ListPeopleResponseDataItemMember other); + } + + public interface _FinalStage { + ListPeopleResponseDataItemMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage joinedAt(Optional joinedAt); + + _FinalStage joinedAt(OffsetDateTime joinedAt); + + _FinalStage joinedAt(Nullable joinedAt); + + _FinalStage status(Optional status); + + _FinalStage status(String status); + + _FinalStage status(Nullable status); + + _FinalStage usdTotalSpend(Optional usdTotalSpend); + + _FinalStage usdTotalSpend(Double usdTotalSpend); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional usdTotalSpend = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional joinedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPeopleResponseDataItemMember other) { + id(other.getId()); + joinedAt(other.getJoinedAt()); + status(other.getStatus()); + usdTotalSpend(other.getUsdTotalSpend()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage usdTotalSpend(Double usdTotalSpend) { + this.usdTotalSpend = Optional.ofNullable(usdTotalSpend); + return this; + } + + @java.lang.Override + @JsonSetter(value = "usd_total_spend", nulls = Nulls.SKIP) + public _FinalStage usdTotalSpend(Optional usdTotalSpend) { + this.usdTotalSpend = usdTotalSpend; + return this; + } + + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage status(String status) { + this.status = Optional.ofNullable(status); + return this; + } + + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + @java.lang.Override + public _FinalStage joinedAt(Nullable joinedAt) { + if (joinedAt.isNull()) { + this.joinedAt = null; + } else if (joinedAt.isEmpty()) { + this.joinedAt = Optional.empty(); + } else { + this.joinedAt = Optional.of(joinedAt.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage joinedAt(OffsetDateTime joinedAt) { + this.joinedAt = Optional.ofNullable(joinedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "joined_at", nulls = Nulls.SKIP) + public _FinalStage joinedAt(Optional joinedAt) { + this.joinedAt = joinedAt; + return this; + } + + @java.lang.Override + public ListPeopleResponseDataItemMember build() { + return new ListPeopleResponseDataItemMember(id, joinedAt, status, usdTotalSpend, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemUser.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemUser.java new file mode 100644 index 00000000..ba22d128 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponseDataItemUser.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleResponseDataItemUser.Builder.class) +public final class ListPeopleResponseDataItemUser { + private final String id; + + private final Optional name; + + private final Optional profilePicUrl; + + private final String username; + + private final Map additionalProperties; + + private ListPeopleResponseDataItemUser( + String id, + Optional name, + Optional profilePicUrl, + String username, + Map additionalProperties) { + this.id = id; + this.name = name; + this.profilePicUrl = profilePicUrl; + this.username = username; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getProfilePicUrl() { + if (profilePicUrl == null) { + return Optional.empty(); + } + return profilePicUrl; + } + + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("profile_pic_url") + private Optional _getProfilePicUrl() { + return profilePicUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleResponseDataItemUser && equalTo((ListPeopleResponseDataItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleResponseDataItemUser other) { + return id.equals(other.id) + && name.equals(other.name) + && profilePicUrl.equals(other.profilePicUrl) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.profilePicUrl, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + UsernameStage id(@NotNull String id); + + Builder from(ListPeopleResponseDataItemUser other); + } + + public interface UsernameStage { + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + ListPeopleResponseDataItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage profilePicUrl(Optional profilePicUrl); + + _FinalStage profilePicUrl(String profilePicUrl); + + _FinalStage profilePicUrl(Nullable profilePicUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional profilePicUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPeopleResponseDataItemUser other) { + id(other.getId()); + name(other.getName()); + profilePicUrl(other.getProfilePicUrl()); + username(other.getUsername()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage profilePicUrl(Nullable profilePicUrl) { + if (profilePicUrl.isNull()) { + this.profilePicUrl = null; + } else if (profilePicUrl.isEmpty()) { + this.profilePicUrl = Optional.empty(); + } else { + this.profilePicUrl = Optional.of(profilePicUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage profilePicUrl(String profilePicUrl) { + this.profilePicUrl = Optional.ofNullable(profilePicUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "profile_pic_url", nulls = Nulls.SKIP) + public _FinalStage profilePicUrl(Optional profilePicUrl) { + this.profilePicUrl = profilePicUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ListPeopleResponseDataItemUser build() { + return new ListPeopleResponseDataItemUser(id, name, profilePicUrl, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/ListPeopleResponsePageInfo.java b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponsePageInfo.java new file mode 100644 index 00000000..97806137 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/ListPeopleResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPeopleResponsePageInfo.Builder.class) +public final class ListPeopleResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListPeopleResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPeopleResponsePageInfo && equalTo((ListPeopleResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPeopleResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListPeopleResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListPeopleResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPeopleResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListPeopleResponsePageInfo build() { + return new ListPeopleResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponse.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponse.java new file mode 100644 index 00000000..3d77c7cd --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponse.java @@ -0,0 +1,1549 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponse.Builder.class) +public final class RetrievePeopleResponse { + private final String accountId; + + private final Optional aov; + + private final Optional> audienceIds; + + private final Optional> customEventNames; + + private final Optional device; + + private final Optional email; + + private final Optional> emails; + + private final int eventCount; + + private final Optional> eventNames; + + private final Optional firstPurchaseAt; + + private final OffsetDateTime firstSeenAt; + + private final Optional firstSource; + + private final String id; + + private final Optional lastIp; + + private final Optional lastPurchaseAt; + + private final OffsetDateTime lastSeenAt; + + private final Optional lastSource; + + private final Optional location; + + private final Optional ltv; + + private final Optional member; + + private final Optional name; + + private final Optional> names; + + private final Optional phone; + + private final Optional> phones; + + private final int purchaseCount; + + private final Optional> purchases; + + private final Optional> roles; + + private final Optional> sources; + + private final Optional timezone; + + private final Optional usage; + + private final Optional user; + + private final Optional> userIds; + + private final Map additionalProperties; + + private RetrievePeopleResponse( + String accountId, + Optional aov, + Optional> audienceIds, + Optional> customEventNames, + Optional device, + Optional email, + Optional> emails, + int eventCount, + Optional> eventNames, + Optional firstPurchaseAt, + OffsetDateTime firstSeenAt, + Optional firstSource, + String id, + Optional lastIp, + Optional lastPurchaseAt, + OffsetDateTime lastSeenAt, + Optional lastSource, + Optional location, + Optional ltv, + Optional member, + Optional name, + Optional> names, + Optional phone, + Optional> phones, + int purchaseCount, + Optional> purchases, + Optional> roles, + Optional> sources, + Optional timezone, + Optional usage, + Optional user, + Optional> userIds, + Map additionalProperties) { + this.accountId = accountId; + this.aov = aov; + this.audienceIds = audienceIds; + this.customEventNames = customEventNames; + this.device = device; + this.email = email; + this.emails = emails; + this.eventCount = eventCount; + this.eventNames = eventNames; + this.firstPurchaseAt = firstPurchaseAt; + this.firstSeenAt = firstSeenAt; + this.firstSource = firstSource; + this.id = id; + this.lastIp = lastIp; + this.lastPurchaseAt = lastPurchaseAt; + this.lastSeenAt = lastSeenAt; + this.lastSource = lastSource; + this.location = location; + this.ltv = ltv; + this.member = member; + this.name = name; + this.names = names; + this.phone = phone; + this.phones = phones; + this.purchaseCount = purchaseCount; + this.purchases = purchases; + this.roles = roles; + this.sources = sources; + this.timezone = timezone; + this.usage = usage; + this.user = user; + this.userIds = userIds; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("aov") + public Optional getAov() { + return aov; + } + + @JsonProperty("audience_ids") + public Optional> getAudienceIds() { + return audienceIds; + } + + @JsonProperty("custom_event_names") + public Optional> getCustomEventNames() { + return customEventNames; + } + + @JsonProperty("device") + public Optional getDevice() { + return device; + } + + /** + * @return The email from the person's most recent event that carried one. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return Every linked email, primary first. + */ + @JsonProperty("emails") + public Optional> getEmails() { + return emails; + } + + @JsonProperty("event_count") + public int getEventCount() { + return eventCount; + } + + @JsonProperty("event_names") + public Optional> getEventNames() { + return eventNames; + } + + @JsonIgnore + public Optional getFirstPurchaseAt() { + if (firstPurchaseAt == null) { + return Optional.empty(); + } + return firstPurchaseAt; + } + + @JsonProperty("first_seen_at") + public OffsetDateTime getFirstSeenAt() { + return firstSeenAt; + } + + /** + * @return Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site. + */ + @JsonIgnore + public Optional getFirstSource() { + if (firstSource == null) { + return Optional.empty(); + } + return firstSource; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getLastIp() { + if (lastIp == null) { + return Optional.empty(); + } + return lastIp; + } + + @JsonIgnore + public Optional getLastPurchaseAt() { + if (lastPurchaseAt == null) { + return Optional.empty(); + } + return lastPurchaseAt; + } + + @JsonProperty("last_seen_at") + public OffsetDateTime getLastSeenAt() { + return lastSeenAt; + } + + /** + * @return Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site. + */ + @JsonIgnore + public Optional getLastSource() { + if (lastSource == null) { + return Optional.empty(); + } + return lastSource; + } + + @JsonProperty("location") + public Optional getLocation() { + return location; + } + + @JsonProperty("ltv") + public Optional getLtv() { + return ltv; + } + + /** + * @return The user's member record at this account, when they are a member of it. + */ + @JsonIgnore + public Optional getMember() { + if (member == null) { + return Optional.empty(); + } + return member; + } + + /** + * @return The name from the person's most recent event that carried one. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return Every name the person's linked identities carried, primary first. + */ + @JsonProperty("names") + public Optional> getNames() { + return names; + } + + /** + * @return The phone from the person's most recent event that carried one. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + /** + * @return Every linked phone, primary first. + */ + @JsonProperty("phones") + public Optional> getPhones() { + return phones; + } + + @JsonProperty("purchase_count") + public int getPurchaseCount() { + return purchaseCount; + } + + @JsonProperty("purchases") + public Optional> getPurchases() { + return purchases; + } + + @JsonProperty("roles") + public Optional> getRoles() { + return roles; + } + + /** + * @return Every distinct acquisition signal the person ever carried, ad entities hydrated. + */ + @JsonProperty("sources") + public Optional> getSources() { + return sources; + } + + @JsonIgnore + public Optional getTimezone() { + if (timezone == null) { + return Optional.empty(); + } + return timezone; + } + + /** + * @return Exact usage breakdowns for the person's browser traffic (distinct events per value). + */ + @JsonProperty("usage") + public Optional getUsage() { + return usage; + } + + /** + * @return The person's primary whop user, when one of their identities is a whop account. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + /** + * @return Every linked whop account, the most used one first. + */ + @JsonProperty("user_ids") + public Optional> getUserIds() { + return userIds; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_purchase_at") + private Optional _getFirstPurchaseAt() { + return firstPurchaseAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_source") + private Optional _getFirstSource() { + return firstSource; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_ip") + private Optional _getLastIp() { + return lastIp; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_purchase_at") + private Optional _getLastPurchaseAt() { + return lastPurchaseAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_source") + private Optional _getLastSource() { + return lastSource; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member") + private Optional _getMember() { + return member; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("timezone") + private Optional _getTimezone() { + return timezone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponse && equalTo((RetrievePeopleResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponse other) { + return accountId.equals(other.accountId) + && aov.equals(other.aov) + && audienceIds.equals(other.audienceIds) + && customEventNames.equals(other.customEventNames) + && device.equals(other.device) + && email.equals(other.email) + && emails.equals(other.emails) + && eventCount == other.eventCount + && eventNames.equals(other.eventNames) + && firstPurchaseAt.equals(other.firstPurchaseAt) + && firstSeenAt.equals(other.firstSeenAt) + && firstSource.equals(other.firstSource) + && id.equals(other.id) + && lastIp.equals(other.lastIp) + && lastPurchaseAt.equals(other.lastPurchaseAt) + && lastSeenAt.equals(other.lastSeenAt) + && lastSource.equals(other.lastSource) + && location.equals(other.location) + && ltv.equals(other.ltv) + && member.equals(other.member) + && name.equals(other.name) + && names.equals(other.names) + && phone.equals(other.phone) + && phones.equals(other.phones) + && purchaseCount == other.purchaseCount + && purchases.equals(other.purchases) + && roles.equals(other.roles) + && sources.equals(other.sources) + && timezone.equals(other.timezone) + && usage.equals(other.usage) + && user.equals(other.user) + && userIds.equals(other.userIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.aov, + this.audienceIds, + this.customEventNames, + this.device, + this.email, + this.emails, + this.eventCount, + this.eventNames, + this.firstPurchaseAt, + this.firstSeenAt, + this.firstSource, + this.id, + this.lastIp, + this.lastPurchaseAt, + this.lastSeenAt, + this.lastSource, + this.location, + this.ltv, + this.member, + this.name, + this.names, + this.phone, + this.phones, + this.purchaseCount, + this.purchases, + this.roles, + this.sources, + this.timezone, + this.usage, + this.user, + this.userIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + EventCountStage accountId(@NotNull String accountId); + + Builder from(RetrievePeopleResponse other); + } + + public interface EventCountStage { + FirstSeenAtStage eventCount(int eventCount); + } + + public interface FirstSeenAtStage { + IdStage firstSeenAt(@NotNull OffsetDateTime firstSeenAt); + } + + public interface IdStage { + LastSeenAtStage id(@NotNull String id); + } + + public interface LastSeenAtStage { + PurchaseCountStage lastSeenAt(@NotNull OffsetDateTime lastSeenAt); + } + + public interface PurchaseCountStage { + _FinalStage purchaseCount(int purchaseCount); + } + + public interface _FinalStage { + RetrievePeopleResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage aov(Optional aov); + + _FinalStage aov(Double aov); + + _FinalStage audienceIds(Optional> audienceIds); + + _FinalStage audienceIds(List audienceIds); + + _FinalStage customEventNames(Optional> customEventNames); + + _FinalStage customEventNames(List customEventNames); + + _FinalStage device(Optional device); + + _FinalStage device(RetrievePeopleResponseDevice device); + + /** + *

The email from the person's most recent event that carried one.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

Every linked email, primary first.

+ */ + _FinalStage emails(Optional> emails); + + _FinalStage emails(List emails); + + _FinalStage eventNames(Optional> eventNames); + + _FinalStage eventNames(List eventNames); + + _FinalStage firstPurchaseAt(Optional firstPurchaseAt); + + _FinalStage firstPurchaseAt(OffsetDateTime firstPurchaseAt); + + _FinalStage firstPurchaseAt(Nullable firstPurchaseAt); + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ */ + _FinalStage firstSource(Optional firstSource); + + _FinalStage firstSource(RetrievePeopleResponseFirstSource firstSource); + + _FinalStage firstSource(Nullable firstSource); + + _FinalStage lastIp(Optional lastIp); + + _FinalStage lastIp(String lastIp); + + _FinalStage lastIp(Nullable lastIp); + + _FinalStage lastPurchaseAt(Optional lastPurchaseAt); + + _FinalStage lastPurchaseAt(OffsetDateTime lastPurchaseAt); + + _FinalStage lastPurchaseAt(Nullable lastPurchaseAt); + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ */ + _FinalStage lastSource(Optional lastSource); + + _FinalStage lastSource(RetrievePeopleResponseLastSource lastSource); + + _FinalStage lastSource(Nullable lastSource); + + _FinalStage location(Optional location); + + _FinalStage location(RetrievePeopleResponseLocation location); + + _FinalStage ltv(Optional ltv); + + _FinalStage ltv(Double ltv); + + /** + *

The user's member record at this account, when they are a member of it.

+ */ + _FinalStage member(Optional member); + + _FinalStage member(RetrievePeopleResponseMember member); + + _FinalStage member(Nullable member); + + /** + *

The name from the person's most recent event that carried one.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

Every name the person's linked identities carried, primary first.

+ */ + _FinalStage names(Optional> names); + + _FinalStage names(List names); + + /** + *

The phone from the person's most recent event that carried one.

+ */ + _FinalStage phone(Optional phone); + + _FinalStage phone(String phone); + + _FinalStage phone(Nullable phone); + + /** + *

Every linked phone, primary first.

+ */ + _FinalStage phones(Optional> phones); + + _FinalStage phones(List phones); + + _FinalStage purchases(Optional> purchases); + + _FinalStage purchases(List purchases); + + _FinalStage roles(Optional> roles); + + _FinalStage roles(List roles); + + /** + *

Every distinct acquisition signal the person ever carried, ad entities hydrated.

+ */ + _FinalStage sources(Optional> sources); + + _FinalStage sources(List sources); + + _FinalStage timezone(Optional timezone); + + _FinalStage timezone(String timezone); + + _FinalStage timezone(Nullable timezone); + + /** + *

Exact usage breakdowns for the person's browser traffic (distinct events per value).

+ */ + _FinalStage usage(Optional usage); + + _FinalStage usage(RetrievePeopleResponseUsage usage); + + /** + *

The person's primary whop user, when one of their identities is a whop account.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(RetrievePeopleResponseUser user); + + _FinalStage user(Nullable user); + + /** + *

Every linked whop account, the most used one first.

+ */ + _FinalStage userIds(Optional> userIds); + + _FinalStage userIds(List userIds); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, + EventCountStage, + FirstSeenAtStage, + IdStage, + LastSeenAtStage, + PurchaseCountStage, + _FinalStage { + private String accountId; + + private int eventCount; + + private OffsetDateTime firstSeenAt; + + private String id; + + private OffsetDateTime lastSeenAt; + + private int purchaseCount; + + private Optional> userIds = Optional.empty(); + + private Optional user = Optional.empty(); + + private Optional usage = Optional.empty(); + + private Optional timezone = Optional.empty(); + + private Optional> sources = Optional.empty(); + + private Optional> roles = Optional.empty(); + + private Optional> purchases = Optional.empty(); + + private Optional> phones = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional> names = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional member = Optional.empty(); + + private Optional ltv = Optional.empty(); + + private Optional location = Optional.empty(); + + private Optional lastSource = Optional.empty(); + + private Optional lastPurchaseAt = Optional.empty(); + + private Optional lastIp = Optional.empty(); + + private Optional firstSource = Optional.empty(); + + private Optional firstPurchaseAt = Optional.empty(); + + private Optional> eventNames = Optional.empty(); + + private Optional> emails = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional device = Optional.empty(); + + private Optional> customEventNames = Optional.empty(); + + private Optional> audienceIds = Optional.empty(); + + private Optional aov = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponse other) { + accountId(other.getAccountId()); + aov(other.getAov()); + audienceIds(other.getAudienceIds()); + customEventNames(other.getCustomEventNames()); + device(other.getDevice()); + email(other.getEmail()); + emails(other.getEmails()); + eventCount(other.getEventCount()); + eventNames(other.getEventNames()); + firstPurchaseAt(other.getFirstPurchaseAt()); + firstSeenAt(other.getFirstSeenAt()); + firstSource(other.getFirstSource()); + id(other.getId()); + lastIp(other.getLastIp()); + lastPurchaseAt(other.getLastPurchaseAt()); + lastSeenAt(other.getLastSeenAt()); + lastSource(other.getLastSource()); + location(other.getLocation()); + ltv(other.getLtv()); + member(other.getMember()); + name(other.getName()); + names(other.getNames()); + phone(other.getPhone()); + phones(other.getPhones()); + purchaseCount(other.getPurchaseCount()); + purchases(other.getPurchases()); + roles(other.getRoles()); + sources(other.getSources()); + timezone(other.getTimezone()); + usage(other.getUsage()); + user(other.getUser()); + userIds(other.getUserIds()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public EventCountStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("event_count") + public FirstSeenAtStage eventCount(int eventCount) { + this.eventCount = eventCount; + return this; + } + + @java.lang.Override + @JsonSetter("first_seen_at") + public IdStage firstSeenAt(@NotNull OffsetDateTime firstSeenAt) { + this.firstSeenAt = Objects.requireNonNull(firstSeenAt, "firstSeenAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public LastSeenAtStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("last_seen_at") + public PurchaseCountStage lastSeenAt(@NotNull OffsetDateTime lastSeenAt) { + this.lastSeenAt = Objects.requireNonNull(lastSeenAt, "lastSeenAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("purchase_count") + public _FinalStage purchaseCount(int purchaseCount) { + this.purchaseCount = purchaseCount; + return this; + } + + /** + *

Every linked whop account, the most used one first.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userIds(List userIds) { + this.userIds = Optional.ofNullable(userIds); + return this; + } + + /** + *

Every linked whop account, the most used one first.

+ */ + @java.lang.Override + @JsonSetter(value = "user_ids", nulls = Nulls.SKIP) + public _FinalStage userIds(Optional> userIds) { + this.userIds = userIds; + return this; + } + + /** + *

The person's primary whop user, when one of their identities is a whop account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The person's primary whop user, when one of their identities is a whop account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(RetrievePeopleResponseUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The person's primary whop user, when one of their identities is a whop account.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + /** + *

Exact usage breakdowns for the person's browser traffic (distinct events per value).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usage(RetrievePeopleResponseUsage usage) { + this.usage = Optional.ofNullable(usage); + return this; + } + + /** + *

Exact usage breakdowns for the person's browser traffic (distinct events per value).

+ */ + @java.lang.Override + @JsonSetter(value = "usage", nulls = Nulls.SKIP) + public _FinalStage usage(Optional usage) { + this.usage = usage; + return this; + } + + @java.lang.Override + public _FinalStage timezone(Nullable timezone) { + if (timezone.isNull()) { + this.timezone = null; + } else if (timezone.isEmpty()) { + this.timezone = Optional.empty(); + } else { + this.timezone = Optional.of(timezone.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage timezone(String timezone) { + this.timezone = Optional.ofNullable(timezone); + return this; + } + + @java.lang.Override + @JsonSetter(value = "timezone", nulls = Nulls.SKIP) + public _FinalStage timezone(Optional timezone) { + this.timezone = timezone; + return this; + } + + /** + *

Every distinct acquisition signal the person ever carried, ad entities hydrated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sources(List sources) { + this.sources = Optional.ofNullable(sources); + return this; + } + + /** + *

Every distinct acquisition signal the person ever carried, ad entities hydrated.

+ */ + @java.lang.Override + @JsonSetter(value = "sources", nulls = Nulls.SKIP) + public _FinalStage sources(Optional> sources) { + this.sources = sources; + return this; + } + + @java.lang.Override + public _FinalStage roles(List roles) { + this.roles = Optional.ofNullable(roles); + return this; + } + + @java.lang.Override + @JsonSetter(value = "roles", nulls = Nulls.SKIP) + public _FinalStage roles(Optional> roles) { + this.roles = roles; + return this; + } + + @java.lang.Override + public _FinalStage purchases(List purchases) { + this.purchases = Optional.ofNullable(purchases); + return this; + } + + @java.lang.Override + @JsonSetter(value = "purchases", nulls = Nulls.SKIP) + public _FinalStage purchases(Optional> purchases) { + this.purchases = purchases; + return this; + } + + /** + *

Every linked phone, primary first.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phones(List phones) { + this.phones = Optional.ofNullable(phones); + return this; + } + + /** + *

Every linked phone, primary first.

+ */ + @java.lang.Override + @JsonSetter(value = "phones", nulls = Nulls.SKIP) + public _FinalStage phones(Optional> phones) { + this.phones = phones; + return this; + } + + /** + *

The phone from the person's most recent event that carried one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

The phone from the person's most recent event that carried one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + /** + *

The phone from the person's most recent event that carried one.

+ */ + @java.lang.Override + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public _FinalStage phone(Optional phone) { + this.phone = phone; + return this; + } + + /** + *

Every name the person's linked identities carried, primary first.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage names(List names) { + this.names = Optional.ofNullable(names); + return this; + } + + /** + *

Every name the person's linked identities carried, primary first.

+ */ + @java.lang.Override + @JsonSetter(value = "names", nulls = Nulls.SKIP) + public _FinalStage names(Optional> names) { + this.names = names; + return this; + } + + /** + *

The name from the person's most recent event that carried one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The name from the person's most recent event that carried one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The name from the person's most recent event that carried one.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The user's member record at this account, when they are a member of it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(Nullable member) { + if (member.isNull()) { + this.member = null; + } else if (member.isEmpty()) { + this.member = Optional.empty(); + } else { + this.member = Optional.of(member.get()); + } + return this; + } + + /** + *

The user's member record at this account, when they are a member of it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(RetrievePeopleResponseMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + /** + *

The user's member record at this account, when they are a member of it.

+ */ + @java.lang.Override + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public _FinalStage member(Optional member) { + this.member = member; + return this; + } + + @java.lang.Override + public _FinalStage ltv(Double ltv) { + this.ltv = Optional.ofNullable(ltv); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ltv", nulls = Nulls.SKIP) + public _FinalStage ltv(Optional ltv) { + this.ltv = ltv; + return this; + } + + @java.lang.Override + public _FinalStage location(RetrievePeopleResponseLocation location) { + this.location = Optional.ofNullable(location); + return this; + } + + @java.lang.Override + @JsonSetter(value = "location", nulls = Nulls.SKIP) + public _FinalStage location(Optional location) { + this.location = location; + return this; + } + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastSource(Nullable lastSource) { + if (lastSource.isNull()) { + this.lastSource = null; + } else if (lastSource.isEmpty()) { + this.lastSource = Optional.empty(); + } else { + this.lastSource = Optional.of(lastSource.get()); + } + return this; + } + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastSource(RetrievePeopleResponseLastSource lastSource) { + this.lastSource = Optional.ofNullable(lastSource); + return this; + } + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ */ + @java.lang.Override + @JsonSetter(value = "last_source", nulls = Nulls.SKIP) + public _FinalStage lastSource(Optional lastSource) { + this.lastSource = lastSource; + return this; + } + + @java.lang.Override + public _FinalStage lastPurchaseAt(Nullable lastPurchaseAt) { + if (lastPurchaseAt.isNull()) { + this.lastPurchaseAt = null; + } else if (lastPurchaseAt.isEmpty()) { + this.lastPurchaseAt = Optional.empty(); + } else { + this.lastPurchaseAt = Optional.of(lastPurchaseAt.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage lastPurchaseAt(OffsetDateTime lastPurchaseAt) { + this.lastPurchaseAt = Optional.ofNullable(lastPurchaseAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "last_purchase_at", nulls = Nulls.SKIP) + public _FinalStage lastPurchaseAt(Optional lastPurchaseAt) { + this.lastPurchaseAt = lastPurchaseAt; + return this; + } + + @java.lang.Override + public _FinalStage lastIp(Nullable lastIp) { + if (lastIp.isNull()) { + this.lastIp = null; + } else if (lastIp.isEmpty()) { + this.lastIp = Optional.empty(); + } else { + this.lastIp = Optional.of(lastIp.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage lastIp(String lastIp) { + this.lastIp = Optional.ofNullable(lastIp); + return this; + } + + @java.lang.Override + @JsonSetter(value = "last_ip", nulls = Nulls.SKIP) + public _FinalStage lastIp(Optional lastIp) { + this.lastIp = lastIp; + return this; + } + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstSource(Nullable firstSource) { + if (firstSource.isNull()) { + this.firstSource = null; + } else if (firstSource.isEmpty()) { + this.firstSource = Optional.empty(); + } else { + this.firstSource = Optional.of(firstSource.get()); + } + return this; + } + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstSource(RetrievePeopleResponseFirstSource firstSource) { + this.firstSource = Optional.ofNullable(firstSource); + return this; + } + + /** + *

Where a visit came from: a whop ad click, a lead form, an external ad, or a referring site.

+ */ + @java.lang.Override + @JsonSetter(value = "first_source", nulls = Nulls.SKIP) + public _FinalStage firstSource(Optional firstSource) { + this.firstSource = firstSource; + return this; + } + + @java.lang.Override + public _FinalStage firstPurchaseAt(Nullable firstPurchaseAt) { + if (firstPurchaseAt.isNull()) { + this.firstPurchaseAt = null; + } else if (firstPurchaseAt.isEmpty()) { + this.firstPurchaseAt = Optional.empty(); + } else { + this.firstPurchaseAt = Optional.of(firstPurchaseAt.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage firstPurchaseAt(OffsetDateTime firstPurchaseAt) { + this.firstPurchaseAt = Optional.ofNullable(firstPurchaseAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "first_purchase_at", nulls = Nulls.SKIP) + public _FinalStage firstPurchaseAt(Optional firstPurchaseAt) { + this.firstPurchaseAt = firstPurchaseAt; + return this; + } + + @java.lang.Override + public _FinalStage eventNames(List eventNames) { + this.eventNames = Optional.ofNullable(eventNames); + return this; + } + + @java.lang.Override + @JsonSetter(value = "event_names", nulls = Nulls.SKIP) + public _FinalStage eventNames(Optional> eventNames) { + this.eventNames = eventNames; + return this; + } + + /** + *

Every linked email, primary first.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emails(List emails) { + this.emails = Optional.ofNullable(emails); + return this; + } + + /** + *

Every linked email, primary first.

+ */ + @java.lang.Override + @JsonSetter(value = "emails", nulls = Nulls.SKIP) + public _FinalStage emails(Optional> emails) { + this.emails = emails; + return this; + } + + /** + *

The email from the person's most recent event that carried one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The email from the person's most recent event that carried one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The email from the person's most recent event that carried one.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public _FinalStage device(RetrievePeopleResponseDevice device) { + this.device = Optional.ofNullable(device); + return this; + } + + @java.lang.Override + @JsonSetter(value = "device", nulls = Nulls.SKIP) + public _FinalStage device(Optional device) { + this.device = device; + return this; + } + + @java.lang.Override + public _FinalStage customEventNames(List customEventNames) { + this.customEventNames = Optional.ofNullable(customEventNames); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_event_names", nulls = Nulls.SKIP) + public _FinalStage customEventNames(Optional> customEventNames) { + this.customEventNames = customEventNames; + return this; + } + + @java.lang.Override + public _FinalStage audienceIds(List audienceIds) { + this.audienceIds = Optional.ofNullable(audienceIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "audience_ids", nulls = Nulls.SKIP) + public _FinalStage audienceIds(Optional> audienceIds) { + this.audienceIds = audienceIds; + return this; + } + + @java.lang.Override + public _FinalStage aov(Double aov) { + this.aov = Optional.ofNullable(aov); + return this; + } + + @java.lang.Override + @JsonSetter(value = "aov", nulls = Nulls.SKIP) + public _FinalStage aov(Optional aov) { + this.aov = aov; + return this; + } + + @java.lang.Override + public RetrievePeopleResponse build() { + return new RetrievePeopleResponse( + accountId, + aov, + audienceIds, + customEventNames, + device, + email, + emails, + eventCount, + eventNames, + firstPurchaseAt, + firstSeenAt, + firstSource, + id, + lastIp, + lastPurchaseAt, + lastSeenAt, + lastSource, + location, + ltv, + member, + name, + names, + phone, + phones, + purchaseCount, + purchases, + roles, + sources, + timezone, + usage, + user, + userIds, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseDevice.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseDevice.java new file mode 100644 index 00000000..49702ccd --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseDevice.java @@ -0,0 +1,216 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseDevice.Builder.class) +public final class RetrievePeopleResponseDevice { + private final Optional browser; + + private final Optional device; + + private final Optional os; + + private final Map additionalProperties; + + private RetrievePeopleResponseDevice( + Optional browser, + Optional device, + Optional os, + Map additionalProperties) { + this.browser = browser; + this.device = device; + this.os = os; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getBrowser() { + if (browser == null) { + return Optional.empty(); + } + return browser; + } + + @JsonIgnore + public Optional getDevice() { + if (device == null) { + return Optional.empty(); + } + return device; + } + + @JsonIgnore + public Optional getOs() { + if (os == null) { + return Optional.empty(); + } + return os; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("browser") + private Optional _getBrowser() { + return browser; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("device") + private Optional _getDevice() { + return device; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("os") + private Optional _getOs() { + return os; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseDevice && equalTo((RetrievePeopleResponseDevice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseDevice other) { + return browser.equals(other.browser) && device.equals(other.device) && os.equals(other.os); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.browser, this.device, this.os); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional browser = Optional.empty(); + + private Optional device = Optional.empty(); + + private Optional os = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePeopleResponseDevice other) { + browser(other.getBrowser()); + device(other.getDevice()); + os(other.getOs()); + return this; + } + + @JsonSetter(value = "browser", nulls = Nulls.SKIP) + public Builder browser(Optional browser) { + this.browser = browser; + return this; + } + + public Builder browser(String browser) { + this.browser = Optional.ofNullable(browser); + return this; + } + + public Builder browser(Nullable browser) { + if (browser.isNull()) { + this.browser = null; + } else if (browser.isEmpty()) { + this.browser = Optional.empty(); + } else { + this.browser = Optional.of(browser.get()); + } + return this; + } + + @JsonSetter(value = "device", nulls = Nulls.SKIP) + public Builder device(Optional device) { + this.device = device; + return this; + } + + public Builder device(String device) { + this.device = Optional.ofNullable(device); + return this; + } + + public Builder device(Nullable device) { + if (device.isNull()) { + this.device = null; + } else if (device.isEmpty()) { + this.device = Optional.empty(); + } else { + this.device = Optional.of(device.get()); + } + return this; + } + + @JsonSetter(value = "os", nulls = Nulls.SKIP) + public Builder os(Optional os) { + this.os = os; + return this; + } + + public Builder os(String os) { + this.os = Optional.ofNullable(os); + return this; + } + + public Builder os(Nullable os) { + if (os.isNull()) { + this.os = null; + } else if (os.isEmpty()) { + this.os = Optional.empty(); + } else { + this.os = Optional.of(os.get()); + } + return this; + } + + public RetrievePeopleResponseDevice build() { + return new RetrievePeopleResponseDevice(browser, device, os, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseFirstSource.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseFirstSource.java new file mode 100644 index 00000000..7f3392ed --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseFirstSource.java @@ -0,0 +1,506 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseFirstSource.Builder.class) +public final class RetrievePeopleResponseFirstSource { + private final Optional ad; + + private final Optional adGroup; + + private final Optional campaign; + + private final Optional domain; + + private final Optional occurredAt; + + private final Optional platform; + + private final RetrievePeopleResponseFirstSourceType type; + + private final Optional utmSource; + + private final Map additionalProperties; + + private RetrievePeopleResponseFirstSource( + Optional ad, + Optional adGroup, + Optional campaign, + Optional domain, + Optional occurredAt, + Optional platform, + RetrievePeopleResponseFirstSourceType type, + Optional utmSource, + Map additionalProperties) { + this.ad = ad; + this.adGroup = adGroup; + this.campaign = campaign; + this.domain = domain; + this.occurredAt = occurredAt; + this.platform = platform; + this.type = type; + this.utmSource = utmSource; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getAd() { + if (ad == null) { + return Optional.empty(); + } + return ad; + } + + @JsonIgnore + public Optional getAdGroup() { + if (adGroup == null) { + return Optional.empty(); + } + return adGroup; + } + + @JsonIgnore + public Optional getCampaign() { + if (campaign == null) { + return Optional.empty(); + } + return campaign; + } + + @JsonIgnore + public Optional getDomain() { + if (domain == null) { + return Optional.empty(); + } + return domain; + } + + @JsonIgnore + public Optional getOccurredAt() { + if (occurredAt == null) { + return Optional.empty(); + } + return occurredAt; + } + + @JsonIgnore + public Optional getPlatform() { + if (platform == null) { + return Optional.empty(); + } + return platform; + } + + @JsonProperty("type") + public RetrievePeopleResponseFirstSourceType getType() { + return type; + } + + @JsonIgnore + public Optional getUtmSource() { + if (utmSource == null) { + return Optional.empty(); + } + return utmSource; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad") + private Optional _getAd() { + return ad; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_group") + private Optional _getAdGroup() { + return adGroup; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("campaign") + private Optional _getCampaign() { + return campaign; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("domain") + private Optional _getDomain() { + return domain; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("occurred_at") + private Optional _getOccurredAt() { + return occurredAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("platform") + private Optional _getPlatform() { + return platform; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_source") + private Optional _getUtmSource() { + return utmSource; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseFirstSource && equalTo((RetrievePeopleResponseFirstSource) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseFirstSource other) { + return ad.equals(other.ad) + && adGroup.equals(other.adGroup) + && campaign.equals(other.campaign) + && domain.equals(other.domain) + && occurredAt.equals(other.occurredAt) + && platform.equals(other.platform) + && type.equals(other.type) + && utmSource.equals(other.utmSource); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.ad, + this.adGroup, + this.campaign, + this.domain, + this.occurredAt, + this.platform, + this.type, + this.utmSource); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + _FinalStage type(@NotNull RetrievePeopleResponseFirstSourceType type); + + Builder from(RetrievePeopleResponseFirstSource other); + } + + public interface _FinalStage { + RetrievePeopleResponseFirstSource build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage ad(Optional ad); + + _FinalStage ad(RetrievePeopleResponseFirstSourceAd ad); + + _FinalStage ad(Nullable ad); + + _FinalStage adGroup(Optional adGroup); + + _FinalStage adGroup(RetrievePeopleResponseFirstSourceAdGroup adGroup); + + _FinalStage adGroup(Nullable adGroup); + + _FinalStage campaign(Optional campaign); + + _FinalStage campaign(RetrievePeopleResponseFirstSourceCampaign campaign); + + _FinalStage campaign(Nullable campaign); + + _FinalStage domain(Optional domain); + + _FinalStage domain(String domain); + + _FinalStage domain(Nullable domain); + + _FinalStage occurredAt(Optional occurredAt); + + _FinalStage occurredAt(OffsetDateTime occurredAt); + + _FinalStage occurredAt(Nullable occurredAt); + + _FinalStage platform(Optional platform); + + _FinalStage platform(String platform); + + _FinalStage platform(Nullable platform); + + _FinalStage utmSource(Optional utmSource); + + _FinalStage utmSource(String utmSource); + + _FinalStage utmSource(Nullable utmSource); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private RetrievePeopleResponseFirstSourceType type; + + private Optional utmSource = Optional.empty(); + + private Optional platform = Optional.empty(); + + private Optional occurredAt = Optional.empty(); + + private Optional domain = Optional.empty(); + + private Optional campaign = Optional.empty(); + + private Optional adGroup = Optional.empty(); + + private Optional ad = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseFirstSource other) { + ad(other.getAd()); + adGroup(other.getAdGroup()); + campaign(other.getCampaign()); + domain(other.getDomain()); + occurredAt(other.getOccurredAt()); + platform(other.getPlatform()); + type(other.getType()); + utmSource(other.getUtmSource()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull RetrievePeopleResponseFirstSourceType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage utmSource(Nullable utmSource) { + if (utmSource.isNull()) { + this.utmSource = null; + } else if (utmSource.isEmpty()) { + this.utmSource = Optional.empty(); + } else { + this.utmSource = Optional.of(utmSource.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage utmSource(String utmSource) { + this.utmSource = Optional.ofNullable(utmSource); + return this; + } + + @java.lang.Override + @JsonSetter(value = "utm_source", nulls = Nulls.SKIP) + public _FinalStage utmSource(Optional utmSource) { + this.utmSource = utmSource; + return this; + } + + @java.lang.Override + public _FinalStage platform(Nullable platform) { + if (platform.isNull()) { + this.platform = null; + } else if (platform.isEmpty()) { + this.platform = Optional.empty(); + } else { + this.platform = Optional.of(platform.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage platform(String platform) { + this.platform = Optional.ofNullable(platform); + return this; + } + + @java.lang.Override + @JsonSetter(value = "platform", nulls = Nulls.SKIP) + public _FinalStage platform(Optional platform) { + this.platform = platform; + return this; + } + + @java.lang.Override + public _FinalStage occurredAt(Nullable occurredAt) { + if (occurredAt.isNull()) { + this.occurredAt = null; + } else if (occurredAt.isEmpty()) { + this.occurredAt = Optional.empty(); + } else { + this.occurredAt = Optional.of(occurredAt.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage occurredAt(OffsetDateTime occurredAt) { + this.occurredAt = Optional.ofNullable(occurredAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "occurred_at", nulls = Nulls.SKIP) + public _FinalStage occurredAt(Optional occurredAt) { + this.occurredAt = occurredAt; + return this; + } + + @java.lang.Override + public _FinalStage domain(Nullable domain) { + if (domain.isNull()) { + this.domain = null; + } else if (domain.isEmpty()) { + this.domain = Optional.empty(); + } else { + this.domain = Optional.of(domain.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage domain(String domain) { + this.domain = Optional.ofNullable(domain); + return this; + } + + @java.lang.Override + @JsonSetter(value = "domain", nulls = Nulls.SKIP) + public _FinalStage domain(Optional domain) { + this.domain = domain; + return this; + } + + @java.lang.Override + public _FinalStage campaign(Nullable campaign) { + if (campaign.isNull()) { + this.campaign = null; + } else if (campaign.isEmpty()) { + this.campaign = Optional.empty(); + } else { + this.campaign = Optional.of(campaign.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage campaign(RetrievePeopleResponseFirstSourceCampaign campaign) { + this.campaign = Optional.ofNullable(campaign); + return this; + } + + @java.lang.Override + @JsonSetter(value = "campaign", nulls = Nulls.SKIP) + public _FinalStage campaign(Optional campaign) { + this.campaign = campaign; + return this; + } + + @java.lang.Override + public _FinalStage adGroup(Nullable adGroup) { + if (adGroup.isNull()) { + this.adGroup = null; + } else if (adGroup.isEmpty()) { + this.adGroup = Optional.empty(); + } else { + this.adGroup = Optional.of(adGroup.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage adGroup(RetrievePeopleResponseFirstSourceAdGroup adGroup) { + this.adGroup = Optional.ofNullable(adGroup); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ad_group", nulls = Nulls.SKIP) + public _FinalStage adGroup(Optional adGroup) { + this.adGroup = adGroup; + return this; + } + + @java.lang.Override + public _FinalStage ad(Nullable ad) { + if (ad.isNull()) { + this.ad = null; + } else if (ad.isEmpty()) { + this.ad = Optional.empty(); + } else { + this.ad = Optional.of(ad.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage ad(RetrievePeopleResponseFirstSourceAd ad) { + this.ad = Optional.ofNullable(ad); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ad", nulls = Nulls.SKIP) + public _FinalStage ad(Optional ad) { + this.ad = ad; + return this; + } + + @java.lang.Override + public RetrievePeopleResponseFirstSource build() { + return new RetrievePeopleResponseFirstSource( + ad, adGroup, campaign, domain, occurredAt, platform, type, utmSource, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseFirstSourceAd.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseFirstSourceAd.java new file mode 100644 index 00000000..9f7e7d22 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseFirstSourceAd.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseFirstSourceAd.Builder.class) +public final class RetrievePeopleResponseFirstSourceAd { + private final String id; + + private final Optional name; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private RetrievePeopleResponseFirstSourceAd( + String id, Optional name, Optional thumbnailUrl, Map additionalProperties) { + this.id = id; + this.name = name; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseFirstSourceAd + && equalTo((RetrievePeopleResponseFirstSourceAd) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseFirstSourceAd other) { + return id.equals(other.id) && name.equals(other.name) && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(RetrievePeopleResponseFirstSourceAd other); + } + + public interface _FinalStage { + RetrievePeopleResponseFirstSourceAd build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseFirstSourceAd other) { + id(other.getId()); + name(other.getName()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrievePeopleResponseFirstSourceAd build() { + return new RetrievePeopleResponseFirstSourceAd(id, name, thumbnailUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseFirstSourceAdGroup.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseFirstSourceAdGroup.java new file mode 100644 index 00000000..14c50ee5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseFirstSourceAdGroup.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseFirstSourceAdGroup.Builder.class) +public final class RetrievePeopleResponseFirstSourceAdGroup { + private final String id; + + private final Optional name; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private RetrievePeopleResponseFirstSourceAdGroup( + String id, Optional name, Optional thumbnailUrl, Map additionalProperties) { + this.id = id; + this.name = name; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseFirstSourceAdGroup + && equalTo((RetrievePeopleResponseFirstSourceAdGroup) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseFirstSourceAdGroup other) { + return id.equals(other.id) && name.equals(other.name) && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(RetrievePeopleResponseFirstSourceAdGroup other); + } + + public interface _FinalStage { + RetrievePeopleResponseFirstSourceAdGroup build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseFirstSourceAdGroup other) { + id(other.getId()); + name(other.getName()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrievePeopleResponseFirstSourceAdGroup build() { + return new RetrievePeopleResponseFirstSourceAdGroup(id, name, thumbnailUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseFirstSourceCampaign.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseFirstSourceCampaign.java new file mode 100644 index 00000000..01f61c34 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseFirstSourceCampaign.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseFirstSourceCampaign.Builder.class) +public final class RetrievePeopleResponseFirstSourceCampaign { + private final String id; + + private final Optional name; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private RetrievePeopleResponseFirstSourceCampaign( + String id, Optional name, Optional thumbnailUrl, Map additionalProperties) { + this.id = id; + this.name = name; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseFirstSourceCampaign + && equalTo((RetrievePeopleResponseFirstSourceCampaign) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseFirstSourceCampaign other) { + return id.equals(other.id) && name.equals(other.name) && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(RetrievePeopleResponseFirstSourceCampaign other); + } + + public interface _FinalStage { + RetrievePeopleResponseFirstSourceCampaign build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseFirstSourceCampaign other) { + id(other.getId()); + name(other.getName()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrievePeopleResponseFirstSourceCampaign build() { + return new RetrievePeopleResponseFirstSourceCampaign(id, name, thumbnailUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseFirstSourceType.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseFirstSourceType.java new file mode 100644 index 00000000..52b93c3e --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseFirstSourceType.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrievePeopleResponseFirstSourceType { + public static final RetrievePeopleResponseFirstSourceType UTM = + new RetrievePeopleResponseFirstSourceType(Value.UTM, "utm"); + + public static final RetrievePeopleResponseFirstSourceType REFERRER = + new RetrievePeopleResponseFirstSourceType(Value.REFERRER, "referrer"); + + public static final RetrievePeopleResponseFirstSourceType LEAD_FORM = + new RetrievePeopleResponseFirstSourceType(Value.LEAD_FORM, "lead_form"); + + public static final RetrievePeopleResponseFirstSourceType EXTERNAL_AD_CLICK = + new RetrievePeopleResponseFirstSourceType(Value.EXTERNAL_AD_CLICK, "external_ad_click"); + + public static final RetrievePeopleResponseFirstSourceType AD_CLICK = + new RetrievePeopleResponseFirstSourceType(Value.AD_CLICK, "ad_click"); + + private final Value value; + + private final String string; + + RetrievePeopleResponseFirstSourceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrievePeopleResponseFirstSourceType + && this.string.equals(((RetrievePeopleResponseFirstSourceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case UTM: + return visitor.visitUtm(); + case REFERRER: + return visitor.visitReferrer(); + case LEAD_FORM: + return visitor.visitLeadForm(); + case EXTERNAL_AD_CLICK: + return visitor.visitExternalAdClick(); + case AD_CLICK: + return visitor.visitAdClick(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrievePeopleResponseFirstSourceType valueOf(String value) { + switch (value) { + case "utm": + return UTM; + case "referrer": + return REFERRER; + case "lead_form": + return LEAD_FORM; + case "external_ad_click": + return EXTERNAL_AD_CLICK; + case "ad_click": + return AD_CLICK; + default: + return new RetrievePeopleResponseFirstSourceType(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_CLICK, + + LEAD_FORM, + + EXTERNAL_AD_CLICK, + + REFERRER, + + UTM, + + UNKNOWN + } + + public interface Visitor { + T visitAdClick(); + + T visitLeadForm(); + + T visitExternalAdClick(); + + T visitReferrer(); + + T visitUtm(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLastSource.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLastSource.java new file mode 100644 index 00000000..abe8f5bb --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLastSource.java @@ -0,0 +1,506 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseLastSource.Builder.class) +public final class RetrievePeopleResponseLastSource { + private final Optional ad; + + private final Optional adGroup; + + private final Optional campaign; + + private final Optional domain; + + private final Optional occurredAt; + + private final Optional platform; + + private final RetrievePeopleResponseLastSourceType type; + + private final Optional utmSource; + + private final Map additionalProperties; + + private RetrievePeopleResponseLastSource( + Optional ad, + Optional adGroup, + Optional campaign, + Optional domain, + Optional occurredAt, + Optional platform, + RetrievePeopleResponseLastSourceType type, + Optional utmSource, + Map additionalProperties) { + this.ad = ad; + this.adGroup = adGroup; + this.campaign = campaign; + this.domain = domain; + this.occurredAt = occurredAt; + this.platform = platform; + this.type = type; + this.utmSource = utmSource; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getAd() { + if (ad == null) { + return Optional.empty(); + } + return ad; + } + + @JsonIgnore + public Optional getAdGroup() { + if (adGroup == null) { + return Optional.empty(); + } + return adGroup; + } + + @JsonIgnore + public Optional getCampaign() { + if (campaign == null) { + return Optional.empty(); + } + return campaign; + } + + @JsonIgnore + public Optional getDomain() { + if (domain == null) { + return Optional.empty(); + } + return domain; + } + + @JsonIgnore + public Optional getOccurredAt() { + if (occurredAt == null) { + return Optional.empty(); + } + return occurredAt; + } + + @JsonIgnore + public Optional getPlatform() { + if (platform == null) { + return Optional.empty(); + } + return platform; + } + + @JsonProperty("type") + public RetrievePeopleResponseLastSourceType getType() { + return type; + } + + @JsonIgnore + public Optional getUtmSource() { + if (utmSource == null) { + return Optional.empty(); + } + return utmSource; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad") + private Optional _getAd() { + return ad; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_group") + private Optional _getAdGroup() { + return adGroup; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("campaign") + private Optional _getCampaign() { + return campaign; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("domain") + private Optional _getDomain() { + return domain; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("occurred_at") + private Optional _getOccurredAt() { + return occurredAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("platform") + private Optional _getPlatform() { + return platform; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_source") + private Optional _getUtmSource() { + return utmSource; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseLastSource && equalTo((RetrievePeopleResponseLastSource) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseLastSource other) { + return ad.equals(other.ad) + && adGroup.equals(other.adGroup) + && campaign.equals(other.campaign) + && domain.equals(other.domain) + && occurredAt.equals(other.occurredAt) + && platform.equals(other.platform) + && type.equals(other.type) + && utmSource.equals(other.utmSource); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.ad, + this.adGroup, + this.campaign, + this.domain, + this.occurredAt, + this.platform, + this.type, + this.utmSource); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + _FinalStage type(@NotNull RetrievePeopleResponseLastSourceType type); + + Builder from(RetrievePeopleResponseLastSource other); + } + + public interface _FinalStage { + RetrievePeopleResponseLastSource build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage ad(Optional ad); + + _FinalStage ad(RetrievePeopleResponseLastSourceAd ad); + + _FinalStage ad(Nullable ad); + + _FinalStage adGroup(Optional adGroup); + + _FinalStage adGroup(RetrievePeopleResponseLastSourceAdGroup adGroup); + + _FinalStage adGroup(Nullable adGroup); + + _FinalStage campaign(Optional campaign); + + _FinalStage campaign(RetrievePeopleResponseLastSourceCampaign campaign); + + _FinalStage campaign(Nullable campaign); + + _FinalStage domain(Optional domain); + + _FinalStage domain(String domain); + + _FinalStage domain(Nullable domain); + + _FinalStage occurredAt(Optional occurredAt); + + _FinalStage occurredAt(OffsetDateTime occurredAt); + + _FinalStage occurredAt(Nullable occurredAt); + + _FinalStage platform(Optional platform); + + _FinalStage platform(String platform); + + _FinalStage platform(Nullable platform); + + _FinalStage utmSource(Optional utmSource); + + _FinalStage utmSource(String utmSource); + + _FinalStage utmSource(Nullable utmSource); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private RetrievePeopleResponseLastSourceType type; + + private Optional utmSource = Optional.empty(); + + private Optional platform = Optional.empty(); + + private Optional occurredAt = Optional.empty(); + + private Optional domain = Optional.empty(); + + private Optional campaign = Optional.empty(); + + private Optional adGroup = Optional.empty(); + + private Optional ad = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseLastSource other) { + ad(other.getAd()); + adGroup(other.getAdGroup()); + campaign(other.getCampaign()); + domain(other.getDomain()); + occurredAt(other.getOccurredAt()); + platform(other.getPlatform()); + type(other.getType()); + utmSource(other.getUtmSource()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull RetrievePeopleResponseLastSourceType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage utmSource(Nullable utmSource) { + if (utmSource.isNull()) { + this.utmSource = null; + } else if (utmSource.isEmpty()) { + this.utmSource = Optional.empty(); + } else { + this.utmSource = Optional.of(utmSource.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage utmSource(String utmSource) { + this.utmSource = Optional.ofNullable(utmSource); + return this; + } + + @java.lang.Override + @JsonSetter(value = "utm_source", nulls = Nulls.SKIP) + public _FinalStage utmSource(Optional utmSource) { + this.utmSource = utmSource; + return this; + } + + @java.lang.Override + public _FinalStage platform(Nullable platform) { + if (platform.isNull()) { + this.platform = null; + } else if (platform.isEmpty()) { + this.platform = Optional.empty(); + } else { + this.platform = Optional.of(platform.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage platform(String platform) { + this.platform = Optional.ofNullable(platform); + return this; + } + + @java.lang.Override + @JsonSetter(value = "platform", nulls = Nulls.SKIP) + public _FinalStage platform(Optional platform) { + this.platform = platform; + return this; + } + + @java.lang.Override + public _FinalStage occurredAt(Nullable occurredAt) { + if (occurredAt.isNull()) { + this.occurredAt = null; + } else if (occurredAt.isEmpty()) { + this.occurredAt = Optional.empty(); + } else { + this.occurredAt = Optional.of(occurredAt.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage occurredAt(OffsetDateTime occurredAt) { + this.occurredAt = Optional.ofNullable(occurredAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "occurred_at", nulls = Nulls.SKIP) + public _FinalStage occurredAt(Optional occurredAt) { + this.occurredAt = occurredAt; + return this; + } + + @java.lang.Override + public _FinalStage domain(Nullable domain) { + if (domain.isNull()) { + this.domain = null; + } else if (domain.isEmpty()) { + this.domain = Optional.empty(); + } else { + this.domain = Optional.of(domain.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage domain(String domain) { + this.domain = Optional.ofNullable(domain); + return this; + } + + @java.lang.Override + @JsonSetter(value = "domain", nulls = Nulls.SKIP) + public _FinalStage domain(Optional domain) { + this.domain = domain; + return this; + } + + @java.lang.Override + public _FinalStage campaign(Nullable campaign) { + if (campaign.isNull()) { + this.campaign = null; + } else if (campaign.isEmpty()) { + this.campaign = Optional.empty(); + } else { + this.campaign = Optional.of(campaign.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage campaign(RetrievePeopleResponseLastSourceCampaign campaign) { + this.campaign = Optional.ofNullable(campaign); + return this; + } + + @java.lang.Override + @JsonSetter(value = "campaign", nulls = Nulls.SKIP) + public _FinalStage campaign(Optional campaign) { + this.campaign = campaign; + return this; + } + + @java.lang.Override + public _FinalStage adGroup(Nullable adGroup) { + if (adGroup.isNull()) { + this.adGroup = null; + } else if (adGroup.isEmpty()) { + this.adGroup = Optional.empty(); + } else { + this.adGroup = Optional.of(adGroup.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage adGroup(RetrievePeopleResponseLastSourceAdGroup adGroup) { + this.adGroup = Optional.ofNullable(adGroup); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ad_group", nulls = Nulls.SKIP) + public _FinalStage adGroup(Optional adGroup) { + this.adGroup = adGroup; + return this; + } + + @java.lang.Override + public _FinalStage ad(Nullable ad) { + if (ad.isNull()) { + this.ad = null; + } else if (ad.isEmpty()) { + this.ad = Optional.empty(); + } else { + this.ad = Optional.of(ad.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage ad(RetrievePeopleResponseLastSourceAd ad) { + this.ad = Optional.ofNullable(ad); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ad", nulls = Nulls.SKIP) + public _FinalStage ad(Optional ad) { + this.ad = ad; + return this; + } + + @java.lang.Override + public RetrievePeopleResponseLastSource build() { + return new RetrievePeopleResponseLastSource( + ad, adGroup, campaign, domain, occurredAt, platform, type, utmSource, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLastSourceAd.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLastSourceAd.java new file mode 100644 index 00000000..d66b73a2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLastSourceAd.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseLastSourceAd.Builder.class) +public final class RetrievePeopleResponseLastSourceAd { + private final String id; + + private final Optional name; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private RetrievePeopleResponseLastSourceAd( + String id, Optional name, Optional thumbnailUrl, Map additionalProperties) { + this.id = id; + this.name = name; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseLastSourceAd + && equalTo((RetrievePeopleResponseLastSourceAd) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseLastSourceAd other) { + return id.equals(other.id) && name.equals(other.name) && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(RetrievePeopleResponseLastSourceAd other); + } + + public interface _FinalStage { + RetrievePeopleResponseLastSourceAd build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseLastSourceAd other) { + id(other.getId()); + name(other.getName()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrievePeopleResponseLastSourceAd build() { + return new RetrievePeopleResponseLastSourceAd(id, name, thumbnailUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLastSourceAdGroup.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLastSourceAdGroup.java new file mode 100644 index 00000000..f97ac288 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLastSourceAdGroup.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseLastSourceAdGroup.Builder.class) +public final class RetrievePeopleResponseLastSourceAdGroup { + private final String id; + + private final Optional name; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private RetrievePeopleResponseLastSourceAdGroup( + String id, Optional name, Optional thumbnailUrl, Map additionalProperties) { + this.id = id; + this.name = name; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseLastSourceAdGroup + && equalTo((RetrievePeopleResponseLastSourceAdGroup) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseLastSourceAdGroup other) { + return id.equals(other.id) && name.equals(other.name) && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(RetrievePeopleResponseLastSourceAdGroup other); + } + + public interface _FinalStage { + RetrievePeopleResponseLastSourceAdGroup build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseLastSourceAdGroup other) { + id(other.getId()); + name(other.getName()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrievePeopleResponseLastSourceAdGroup build() { + return new RetrievePeopleResponseLastSourceAdGroup(id, name, thumbnailUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLastSourceCampaign.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLastSourceCampaign.java new file mode 100644 index 00000000..4a670819 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLastSourceCampaign.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseLastSourceCampaign.Builder.class) +public final class RetrievePeopleResponseLastSourceCampaign { + private final String id; + + private final Optional name; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private RetrievePeopleResponseLastSourceCampaign( + String id, Optional name, Optional thumbnailUrl, Map additionalProperties) { + this.id = id; + this.name = name; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseLastSourceCampaign + && equalTo((RetrievePeopleResponseLastSourceCampaign) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseLastSourceCampaign other) { + return id.equals(other.id) && name.equals(other.name) && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(RetrievePeopleResponseLastSourceCampaign other); + } + + public interface _FinalStage { + RetrievePeopleResponseLastSourceCampaign build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseLastSourceCampaign other) { + id(other.getId()); + name(other.getName()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrievePeopleResponseLastSourceCampaign build() { + return new RetrievePeopleResponseLastSourceCampaign(id, name, thumbnailUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLastSourceType.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLastSourceType.java new file mode 100644 index 00000000..b73a0e34 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLastSourceType.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrievePeopleResponseLastSourceType { + public static final RetrievePeopleResponseLastSourceType UTM = + new RetrievePeopleResponseLastSourceType(Value.UTM, "utm"); + + public static final RetrievePeopleResponseLastSourceType REFERRER = + new RetrievePeopleResponseLastSourceType(Value.REFERRER, "referrer"); + + public static final RetrievePeopleResponseLastSourceType LEAD_FORM = + new RetrievePeopleResponseLastSourceType(Value.LEAD_FORM, "lead_form"); + + public static final RetrievePeopleResponseLastSourceType EXTERNAL_AD_CLICK = + new RetrievePeopleResponseLastSourceType(Value.EXTERNAL_AD_CLICK, "external_ad_click"); + + public static final RetrievePeopleResponseLastSourceType AD_CLICK = + new RetrievePeopleResponseLastSourceType(Value.AD_CLICK, "ad_click"); + + private final Value value; + + private final String string; + + RetrievePeopleResponseLastSourceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrievePeopleResponseLastSourceType + && this.string.equals(((RetrievePeopleResponseLastSourceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case UTM: + return visitor.visitUtm(); + case REFERRER: + return visitor.visitReferrer(); + case LEAD_FORM: + return visitor.visitLeadForm(); + case EXTERNAL_AD_CLICK: + return visitor.visitExternalAdClick(); + case AD_CLICK: + return visitor.visitAdClick(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrievePeopleResponseLastSourceType valueOf(String value) { + switch (value) { + case "utm": + return UTM; + case "referrer": + return REFERRER; + case "lead_form": + return LEAD_FORM; + case "external_ad_click": + return EXTERNAL_AD_CLICK; + case "ad_click": + return AD_CLICK; + default: + return new RetrievePeopleResponseLastSourceType(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_CLICK, + + LEAD_FORM, + + EXTERNAL_AD_CLICK, + + REFERRER, + + UTM, + + UNKNOWN + } + + public interface Visitor { + T visitAdClick(); + + T visitLeadForm(); + + T visitExternalAdClick(); + + T visitReferrer(); + + T visitUtm(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLocation.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLocation.java new file mode 100644 index 00000000..55ece87b --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseLocation.java @@ -0,0 +1,216 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseLocation.Builder.class) +public final class RetrievePeopleResponseLocation { + private final Optional city; + + private final Optional continent; + + private final Optional country; + + private final Map additionalProperties; + + private RetrievePeopleResponseLocation( + Optional city, + Optional continent, + Optional country, + Map additionalProperties) { + this.city = city; + this.continent = continent; + this.country = country; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + @JsonIgnore + public Optional getContinent() { + if (continent == null) { + return Optional.empty(); + } + return continent; + } + + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("continent") + private Optional _getContinent() { + return continent; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseLocation && equalTo((RetrievePeopleResponseLocation) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseLocation other) { + return city.equals(other.city) && continent.equals(other.continent) && country.equals(other.country); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.continent, this.country); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional continent = Optional.empty(); + + private Optional country = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePeopleResponseLocation other) { + city(other.getCity()); + continent(other.getContinent()); + country(other.getCountry()); + return this; + } + + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + @JsonSetter(value = "continent", nulls = Nulls.SKIP) + public Builder continent(Optional continent) { + this.continent = continent; + return this; + } + + public Builder continent(String continent) { + this.continent = Optional.ofNullable(continent); + return this; + } + + public Builder continent(Nullable continent) { + if (continent.isNull()) { + this.continent = null; + } else if (continent.isEmpty()) { + this.continent = Optional.empty(); + } else { + this.continent = Optional.of(continent.get()); + } + return this; + } + + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + public RetrievePeopleResponseLocation build() { + return new RetrievePeopleResponseLocation(city, continent, country, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseMember.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseMember.java new file mode 100644 index 00000000..6afa145e --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseMember.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseMember.Builder.class) +public final class RetrievePeopleResponseMember { + private final String id; + + private final Optional joinedAt; + + private final Optional status; + + private final Optional usdTotalSpend; + + private final Map additionalProperties; + + private RetrievePeopleResponseMember( + String id, + Optional joinedAt, + Optional status, + Optional usdTotalSpend, + Map additionalProperties) { + this.id = id; + this.joinedAt = joinedAt; + this.status = status; + this.usdTotalSpend = usdTotalSpend; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getJoinedAt() { + if (joinedAt == null) { + return Optional.empty(); + } + return joinedAt; + } + + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + @JsonProperty("usd_total_spend") + public Optional getUsdTotalSpend() { + return usdTotalSpend; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("joined_at") + private Optional _getJoinedAt() { + return joinedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseMember && equalTo((RetrievePeopleResponseMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseMember other) { + return id.equals(other.id) + && joinedAt.equals(other.joinedAt) + && status.equals(other.status) + && usdTotalSpend.equals(other.usdTotalSpend); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.joinedAt, this.status, this.usdTotalSpend); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(RetrievePeopleResponseMember other); + } + + public interface _FinalStage { + RetrievePeopleResponseMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage joinedAt(Optional joinedAt); + + _FinalStage joinedAt(OffsetDateTime joinedAt); + + _FinalStage joinedAt(Nullable joinedAt); + + _FinalStage status(Optional status); + + _FinalStage status(String status); + + _FinalStage status(Nullable status); + + _FinalStage usdTotalSpend(Optional usdTotalSpend); + + _FinalStage usdTotalSpend(Double usdTotalSpend); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional usdTotalSpend = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional joinedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseMember other) { + id(other.getId()); + joinedAt(other.getJoinedAt()); + status(other.getStatus()); + usdTotalSpend(other.getUsdTotalSpend()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage usdTotalSpend(Double usdTotalSpend) { + this.usdTotalSpend = Optional.ofNullable(usdTotalSpend); + return this; + } + + @java.lang.Override + @JsonSetter(value = "usd_total_spend", nulls = Nulls.SKIP) + public _FinalStage usdTotalSpend(Optional usdTotalSpend) { + this.usdTotalSpend = usdTotalSpend; + return this; + } + + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage status(String status) { + this.status = Optional.ofNullable(status); + return this; + } + + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + @java.lang.Override + public _FinalStage joinedAt(Nullable joinedAt) { + if (joinedAt.isNull()) { + this.joinedAt = null; + } else if (joinedAt.isEmpty()) { + this.joinedAt = Optional.empty(); + } else { + this.joinedAt = Optional.of(joinedAt.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage joinedAt(OffsetDateTime joinedAt) { + this.joinedAt = Optional.ofNullable(joinedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "joined_at", nulls = Nulls.SKIP) + public _FinalStage joinedAt(Optional joinedAt) { + this.joinedAt = joinedAt; + return this; + } + + @java.lang.Override + public RetrievePeopleResponseMember build() { + return new RetrievePeopleResponseMember(id, joinedAt, status, usdTotalSpend, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponsePurchasesItem.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponsePurchasesItem.java new file mode 100644 index 00000000..1ab73915 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponsePurchasesItem.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponsePurchasesItem.Builder.class) +public final class RetrievePeopleResponsePurchasesItem { + private final String eventId; + + private final OffsetDateTime occurredAt; + + private final double usdValue; + + private final Map additionalProperties; + + private RetrievePeopleResponsePurchasesItem( + String eventId, OffsetDateTime occurredAt, double usdValue, Map additionalProperties) { + this.eventId = eventId; + this.occurredAt = occurredAt; + this.usdValue = usdValue; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("event_id") + public String getEventId() { + return eventId; + } + + @JsonProperty("occurred_at") + public OffsetDateTime getOccurredAt() { + return occurredAt; + } + + @JsonProperty("usd_value") + public double getUsdValue() { + return usdValue; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponsePurchasesItem + && equalTo((RetrievePeopleResponsePurchasesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponsePurchasesItem other) { + return eventId.equals(other.eventId) && occurredAt.equals(other.occurredAt) && usdValue == other.usdValue; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.eventId, this.occurredAt, this.usdValue); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EventIdStage builder() { + return new Builder(); + } + + public interface EventIdStage { + OccurredAtStage eventId(@NotNull String eventId); + + Builder from(RetrievePeopleResponsePurchasesItem other); + } + + public interface OccurredAtStage { + UsdValueStage occurredAt(@NotNull OffsetDateTime occurredAt); + } + + public interface UsdValueStage { + _FinalStage usdValue(double usdValue); + } + + public interface _FinalStage { + RetrievePeopleResponsePurchasesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EventIdStage, OccurredAtStage, UsdValueStage, _FinalStage { + private String eventId; + + private OffsetDateTime occurredAt; + + private double usdValue; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponsePurchasesItem other) { + eventId(other.getEventId()); + occurredAt(other.getOccurredAt()); + usdValue(other.getUsdValue()); + return this; + } + + @java.lang.Override + @JsonSetter("event_id") + public OccurredAtStage eventId(@NotNull String eventId) { + this.eventId = Objects.requireNonNull(eventId, "eventId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("occurred_at") + public UsdValueStage occurredAt(@NotNull OffsetDateTime occurredAt) { + this.occurredAt = Objects.requireNonNull(occurredAt, "occurredAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("usd_value") + public _FinalStage usdValue(double usdValue) { + this.usdValue = usdValue; + return this; + } + + @java.lang.Override + public RetrievePeopleResponsePurchasesItem build() { + return new RetrievePeopleResponsePurchasesItem(eventId, occurredAt, usdValue, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseSourcesItem.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseSourcesItem.java new file mode 100644 index 00000000..42f0f6a4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseSourcesItem.java @@ -0,0 +1,506 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseSourcesItem.Builder.class) +public final class RetrievePeopleResponseSourcesItem { + private final Optional ad; + + private final Optional adGroup; + + private final Optional campaign; + + private final Optional domain; + + private final Optional occurredAt; + + private final Optional platform; + + private final RetrievePeopleResponseSourcesItemType type; + + private final Optional utmSource; + + private final Map additionalProperties; + + private RetrievePeopleResponseSourcesItem( + Optional ad, + Optional adGroup, + Optional campaign, + Optional domain, + Optional occurredAt, + Optional platform, + RetrievePeopleResponseSourcesItemType type, + Optional utmSource, + Map additionalProperties) { + this.ad = ad; + this.adGroup = adGroup; + this.campaign = campaign; + this.domain = domain; + this.occurredAt = occurredAt; + this.platform = platform; + this.type = type; + this.utmSource = utmSource; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getAd() { + if (ad == null) { + return Optional.empty(); + } + return ad; + } + + @JsonIgnore + public Optional getAdGroup() { + if (adGroup == null) { + return Optional.empty(); + } + return adGroup; + } + + @JsonIgnore + public Optional getCampaign() { + if (campaign == null) { + return Optional.empty(); + } + return campaign; + } + + @JsonIgnore + public Optional getDomain() { + if (domain == null) { + return Optional.empty(); + } + return domain; + } + + @JsonIgnore + public Optional getOccurredAt() { + if (occurredAt == null) { + return Optional.empty(); + } + return occurredAt; + } + + @JsonIgnore + public Optional getPlatform() { + if (platform == null) { + return Optional.empty(); + } + return platform; + } + + @JsonProperty("type") + public RetrievePeopleResponseSourcesItemType getType() { + return type; + } + + @JsonIgnore + public Optional getUtmSource() { + if (utmSource == null) { + return Optional.empty(); + } + return utmSource; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad") + private Optional _getAd() { + return ad; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ad_group") + private Optional _getAdGroup() { + return adGroup; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("campaign") + private Optional _getCampaign() { + return campaign; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("domain") + private Optional _getDomain() { + return domain; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("occurred_at") + private Optional _getOccurredAt() { + return occurredAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("platform") + private Optional _getPlatform() { + return platform; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("utm_source") + private Optional _getUtmSource() { + return utmSource; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseSourcesItem && equalTo((RetrievePeopleResponseSourcesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseSourcesItem other) { + return ad.equals(other.ad) + && adGroup.equals(other.adGroup) + && campaign.equals(other.campaign) + && domain.equals(other.domain) + && occurredAt.equals(other.occurredAt) + && platform.equals(other.platform) + && type.equals(other.type) + && utmSource.equals(other.utmSource); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.ad, + this.adGroup, + this.campaign, + this.domain, + this.occurredAt, + this.platform, + this.type, + this.utmSource); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + _FinalStage type(@NotNull RetrievePeopleResponseSourcesItemType type); + + Builder from(RetrievePeopleResponseSourcesItem other); + } + + public interface _FinalStage { + RetrievePeopleResponseSourcesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage ad(Optional ad); + + _FinalStage ad(RetrievePeopleResponseSourcesItemAd ad); + + _FinalStage ad(Nullable ad); + + _FinalStage adGroup(Optional adGroup); + + _FinalStage adGroup(RetrievePeopleResponseSourcesItemAdGroup adGroup); + + _FinalStage adGroup(Nullable adGroup); + + _FinalStage campaign(Optional campaign); + + _FinalStage campaign(RetrievePeopleResponseSourcesItemCampaign campaign); + + _FinalStage campaign(Nullable campaign); + + _FinalStage domain(Optional domain); + + _FinalStage domain(String domain); + + _FinalStage domain(Nullable domain); + + _FinalStage occurredAt(Optional occurredAt); + + _FinalStage occurredAt(OffsetDateTime occurredAt); + + _FinalStage occurredAt(Nullable occurredAt); + + _FinalStage platform(Optional platform); + + _FinalStage platform(String platform); + + _FinalStage platform(Nullable platform); + + _FinalStage utmSource(Optional utmSource); + + _FinalStage utmSource(String utmSource); + + _FinalStage utmSource(Nullable utmSource); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private RetrievePeopleResponseSourcesItemType type; + + private Optional utmSource = Optional.empty(); + + private Optional platform = Optional.empty(); + + private Optional occurredAt = Optional.empty(); + + private Optional domain = Optional.empty(); + + private Optional campaign = Optional.empty(); + + private Optional adGroup = Optional.empty(); + + private Optional ad = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseSourcesItem other) { + ad(other.getAd()); + adGroup(other.getAdGroup()); + campaign(other.getCampaign()); + domain(other.getDomain()); + occurredAt(other.getOccurredAt()); + platform(other.getPlatform()); + type(other.getType()); + utmSource(other.getUtmSource()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull RetrievePeopleResponseSourcesItemType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage utmSource(Nullable utmSource) { + if (utmSource.isNull()) { + this.utmSource = null; + } else if (utmSource.isEmpty()) { + this.utmSource = Optional.empty(); + } else { + this.utmSource = Optional.of(utmSource.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage utmSource(String utmSource) { + this.utmSource = Optional.ofNullable(utmSource); + return this; + } + + @java.lang.Override + @JsonSetter(value = "utm_source", nulls = Nulls.SKIP) + public _FinalStage utmSource(Optional utmSource) { + this.utmSource = utmSource; + return this; + } + + @java.lang.Override + public _FinalStage platform(Nullable platform) { + if (platform.isNull()) { + this.platform = null; + } else if (platform.isEmpty()) { + this.platform = Optional.empty(); + } else { + this.platform = Optional.of(platform.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage platform(String platform) { + this.platform = Optional.ofNullable(platform); + return this; + } + + @java.lang.Override + @JsonSetter(value = "platform", nulls = Nulls.SKIP) + public _FinalStage platform(Optional platform) { + this.platform = platform; + return this; + } + + @java.lang.Override + public _FinalStage occurredAt(Nullable occurredAt) { + if (occurredAt.isNull()) { + this.occurredAt = null; + } else if (occurredAt.isEmpty()) { + this.occurredAt = Optional.empty(); + } else { + this.occurredAt = Optional.of(occurredAt.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage occurredAt(OffsetDateTime occurredAt) { + this.occurredAt = Optional.ofNullable(occurredAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "occurred_at", nulls = Nulls.SKIP) + public _FinalStage occurredAt(Optional occurredAt) { + this.occurredAt = occurredAt; + return this; + } + + @java.lang.Override + public _FinalStage domain(Nullable domain) { + if (domain.isNull()) { + this.domain = null; + } else if (domain.isEmpty()) { + this.domain = Optional.empty(); + } else { + this.domain = Optional.of(domain.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage domain(String domain) { + this.domain = Optional.ofNullable(domain); + return this; + } + + @java.lang.Override + @JsonSetter(value = "domain", nulls = Nulls.SKIP) + public _FinalStage domain(Optional domain) { + this.domain = domain; + return this; + } + + @java.lang.Override + public _FinalStage campaign(Nullable campaign) { + if (campaign.isNull()) { + this.campaign = null; + } else if (campaign.isEmpty()) { + this.campaign = Optional.empty(); + } else { + this.campaign = Optional.of(campaign.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage campaign(RetrievePeopleResponseSourcesItemCampaign campaign) { + this.campaign = Optional.ofNullable(campaign); + return this; + } + + @java.lang.Override + @JsonSetter(value = "campaign", nulls = Nulls.SKIP) + public _FinalStage campaign(Optional campaign) { + this.campaign = campaign; + return this; + } + + @java.lang.Override + public _FinalStage adGroup(Nullable adGroup) { + if (adGroup.isNull()) { + this.adGroup = null; + } else if (adGroup.isEmpty()) { + this.adGroup = Optional.empty(); + } else { + this.adGroup = Optional.of(adGroup.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage adGroup(RetrievePeopleResponseSourcesItemAdGroup adGroup) { + this.adGroup = Optional.ofNullable(adGroup); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ad_group", nulls = Nulls.SKIP) + public _FinalStage adGroup(Optional adGroup) { + this.adGroup = adGroup; + return this; + } + + @java.lang.Override + public _FinalStage ad(Nullable ad) { + if (ad.isNull()) { + this.ad = null; + } else if (ad.isEmpty()) { + this.ad = Optional.empty(); + } else { + this.ad = Optional.of(ad.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage ad(RetrievePeopleResponseSourcesItemAd ad) { + this.ad = Optional.ofNullable(ad); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ad", nulls = Nulls.SKIP) + public _FinalStage ad(Optional ad) { + this.ad = ad; + return this; + } + + @java.lang.Override + public RetrievePeopleResponseSourcesItem build() { + return new RetrievePeopleResponseSourcesItem( + ad, adGroup, campaign, domain, occurredAt, platform, type, utmSource, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseSourcesItemAd.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseSourcesItemAd.java new file mode 100644 index 00000000..b9bac23b --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseSourcesItemAd.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseSourcesItemAd.Builder.class) +public final class RetrievePeopleResponseSourcesItemAd { + private final String id; + + private final Optional name; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private RetrievePeopleResponseSourcesItemAd( + String id, Optional name, Optional thumbnailUrl, Map additionalProperties) { + this.id = id; + this.name = name; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseSourcesItemAd + && equalTo((RetrievePeopleResponseSourcesItemAd) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseSourcesItemAd other) { + return id.equals(other.id) && name.equals(other.name) && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(RetrievePeopleResponseSourcesItemAd other); + } + + public interface _FinalStage { + RetrievePeopleResponseSourcesItemAd build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseSourcesItemAd other) { + id(other.getId()); + name(other.getName()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrievePeopleResponseSourcesItemAd build() { + return new RetrievePeopleResponseSourcesItemAd(id, name, thumbnailUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseSourcesItemAdGroup.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseSourcesItemAdGroup.java new file mode 100644 index 00000000..29be7d02 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseSourcesItemAdGroup.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseSourcesItemAdGroup.Builder.class) +public final class RetrievePeopleResponseSourcesItemAdGroup { + private final String id; + + private final Optional name; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private RetrievePeopleResponseSourcesItemAdGroup( + String id, Optional name, Optional thumbnailUrl, Map additionalProperties) { + this.id = id; + this.name = name; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseSourcesItemAdGroup + && equalTo((RetrievePeopleResponseSourcesItemAdGroup) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseSourcesItemAdGroup other) { + return id.equals(other.id) && name.equals(other.name) && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(RetrievePeopleResponseSourcesItemAdGroup other); + } + + public interface _FinalStage { + RetrievePeopleResponseSourcesItemAdGroup build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseSourcesItemAdGroup other) { + id(other.getId()); + name(other.getName()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrievePeopleResponseSourcesItemAdGroup build() { + return new RetrievePeopleResponseSourcesItemAdGroup(id, name, thumbnailUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseSourcesItemCampaign.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseSourcesItemCampaign.java new file mode 100644 index 00000000..91406d54 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseSourcesItemCampaign.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseSourcesItemCampaign.Builder.class) +public final class RetrievePeopleResponseSourcesItemCampaign { + private final String id; + + private final Optional name; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private RetrievePeopleResponseSourcesItemCampaign( + String id, Optional name, Optional thumbnailUrl, Map additionalProperties) { + this.id = id; + this.name = name; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseSourcesItemCampaign + && equalTo((RetrievePeopleResponseSourcesItemCampaign) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseSourcesItemCampaign other) { + return id.equals(other.id) && name.equals(other.name) && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + + Builder from(RetrievePeopleResponseSourcesItemCampaign other); + } + + public interface _FinalStage { + RetrievePeopleResponseSourcesItemCampaign build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseSourcesItemCampaign other) { + id(other.getId()); + name(other.getName()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrievePeopleResponseSourcesItemCampaign build() { + return new RetrievePeopleResponseSourcesItemCampaign(id, name, thumbnailUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseSourcesItemType.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseSourcesItemType.java new file mode 100644 index 00000000..155dfa94 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseSourcesItemType.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrievePeopleResponseSourcesItemType { + public static final RetrievePeopleResponseSourcesItemType UTM = + new RetrievePeopleResponseSourcesItemType(Value.UTM, "utm"); + + public static final RetrievePeopleResponseSourcesItemType REFERRER = + new RetrievePeopleResponseSourcesItemType(Value.REFERRER, "referrer"); + + public static final RetrievePeopleResponseSourcesItemType LEAD_FORM = + new RetrievePeopleResponseSourcesItemType(Value.LEAD_FORM, "lead_form"); + + public static final RetrievePeopleResponseSourcesItemType EXTERNAL_AD_CLICK = + new RetrievePeopleResponseSourcesItemType(Value.EXTERNAL_AD_CLICK, "external_ad_click"); + + public static final RetrievePeopleResponseSourcesItemType AD_CLICK = + new RetrievePeopleResponseSourcesItemType(Value.AD_CLICK, "ad_click"); + + private final Value value; + + private final String string; + + RetrievePeopleResponseSourcesItemType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrievePeopleResponseSourcesItemType + && this.string.equals(((RetrievePeopleResponseSourcesItemType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case UTM: + return visitor.visitUtm(); + case REFERRER: + return visitor.visitReferrer(); + case LEAD_FORM: + return visitor.visitLeadForm(); + case EXTERNAL_AD_CLICK: + return visitor.visitExternalAdClick(); + case AD_CLICK: + return visitor.visitAdClick(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrievePeopleResponseSourcesItemType valueOf(String value) { + switch (value) { + case "utm": + return UTM; + case "referrer": + return REFERRER; + case "lead_form": + return LEAD_FORM; + case "external_ad_click": + return EXTERNAL_AD_CLICK; + case "ad_click": + return AD_CLICK; + default: + return new RetrievePeopleResponseSourcesItemType(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_CLICK, + + LEAD_FORM, + + EXTERNAL_AD_CLICK, + + REFERRER, + + UTM, + + UNKNOWN + } + + public interface Visitor { + T visitAdClick(); + + T visitLeadForm(); + + T visitExternalAdClick(); + + T visitReferrer(); + + T visitUtm(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsage.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsage.java new file mode 100644 index 00000000..602bee3b --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsage.java @@ -0,0 +1,278 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseUsage.Builder.class) +public final class RetrievePeopleResponseUsage { + private final Optional> browser; + + private final Optional> city; + + private final Optional> country; + + private final Optional> device; + + private final Optional> ip; + + private final Optional> os; + + private final Optional> referrer; + + private final Optional> timezone; + + private final Map additionalProperties; + + private RetrievePeopleResponseUsage( + Optional> browser, + Optional> city, + Optional> country, + Optional> device, + Optional> ip, + Optional> os, + Optional> referrer, + Optional> timezone, + Map additionalProperties) { + this.browser = browser; + this.city = city; + this.country = country; + this.device = device; + this.ip = ip; + this.os = os; + this.referrer = referrer; + this.timezone = timezone; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("browser") + public Optional> getBrowser() { + return browser; + } + + @JsonProperty("city") + public Optional> getCity() { + return city; + } + + @JsonProperty("country") + public Optional> getCountry() { + return country; + } + + @JsonProperty("device") + public Optional> getDevice() { + return device; + } + + @JsonProperty("ip") + public Optional> getIp() { + return ip; + } + + @JsonProperty("os") + public Optional> getOs() { + return os; + } + + @JsonProperty("referrer") + public Optional> getReferrer() { + return referrer; + } + + @JsonProperty("timezone") + public Optional> getTimezone() { + return timezone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseUsage && equalTo((RetrievePeopleResponseUsage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseUsage other) { + return browser.equals(other.browser) + && city.equals(other.city) + && country.equals(other.country) + && device.equals(other.device) + && ip.equals(other.ip) + && os.equals(other.os) + && referrer.equals(other.referrer) + && timezone.equals(other.timezone); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.browser, this.city, this.country, this.device, this.ip, this.os, this.referrer, this.timezone); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> browser = Optional.empty(); + + private Optional> city = Optional.empty(); + + private Optional> country = Optional.empty(); + + private Optional> device = Optional.empty(); + + private Optional> ip = Optional.empty(); + + private Optional> os = Optional.empty(); + + private Optional> referrer = Optional.empty(); + + private Optional> timezone = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePeopleResponseUsage other) { + browser(other.getBrowser()); + city(other.getCity()); + country(other.getCountry()); + device(other.getDevice()); + ip(other.getIp()); + os(other.getOs()); + referrer(other.getReferrer()); + timezone(other.getTimezone()); + return this; + } + + @JsonSetter(value = "browser", nulls = Nulls.SKIP) + public Builder browser(Optional> browser) { + this.browser = browser; + return this; + } + + public Builder browser(List browser) { + this.browser = Optional.ofNullable(browser); + return this; + } + + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional> city) { + this.city = city; + return this; + } + + public Builder city(List city) { + this.city = Optional.ofNullable(city); + return this; + } + + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional> country) { + this.country = country; + return this; + } + + public Builder country(List country) { + this.country = Optional.ofNullable(country); + return this; + } + + @JsonSetter(value = "device", nulls = Nulls.SKIP) + public Builder device(Optional> device) { + this.device = device; + return this; + } + + public Builder device(List device) { + this.device = Optional.ofNullable(device); + return this; + } + + @JsonSetter(value = "ip", nulls = Nulls.SKIP) + public Builder ip(Optional> ip) { + this.ip = ip; + return this; + } + + public Builder ip(List ip) { + this.ip = Optional.ofNullable(ip); + return this; + } + + @JsonSetter(value = "os", nulls = Nulls.SKIP) + public Builder os(Optional> os) { + this.os = os; + return this; + } + + public Builder os(List os) { + this.os = Optional.ofNullable(os); + return this; + } + + @JsonSetter(value = "referrer", nulls = Nulls.SKIP) + public Builder referrer(Optional> referrer) { + this.referrer = referrer; + return this; + } + + public Builder referrer(List referrer) { + this.referrer = Optional.ofNullable(referrer); + return this; + } + + @JsonSetter(value = "timezone", nulls = Nulls.SKIP) + public Builder timezone(Optional> timezone) { + this.timezone = timezone; + return this; + } + + public Builder timezone(List timezone) { + this.timezone = Optional.ofNullable(timezone); + return this; + } + + public RetrievePeopleResponseUsage build() { + return new RetrievePeopleResponseUsage( + browser, city, country, device, ip, os, referrer, timezone, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageBrowserItem.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageBrowserItem.java new file mode 100644 index 00000000..2b26c761 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageBrowserItem.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseUsageBrowserItem.Builder.class) +public final class RetrievePeopleResponseUsageBrowserItem { + private final int events; + + private final String value; + + private final Map additionalProperties; + + private RetrievePeopleResponseUsageBrowserItem(int events, String value, Map additionalProperties) { + this.events = events; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("events") + public int getEvents() { + return events; + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseUsageBrowserItem + && equalTo((RetrievePeopleResponseUsageBrowserItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseUsageBrowserItem other) { + return events == other.events && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.events, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EventsStage builder() { + return new Builder(); + } + + public interface EventsStage { + ValueStage events(int events); + + Builder from(RetrievePeopleResponseUsageBrowserItem other); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + } + + public interface _FinalStage { + RetrievePeopleResponseUsageBrowserItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EventsStage, ValueStage, _FinalStage { + private int events; + + private String value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseUsageBrowserItem other) { + events(other.getEvents()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("events") + public ValueStage events(int events) { + this.events = events; + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + @java.lang.Override + public RetrievePeopleResponseUsageBrowserItem build() { + return new RetrievePeopleResponseUsageBrowserItem(events, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageCityItem.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageCityItem.java new file mode 100644 index 00000000..d78c6094 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageCityItem.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseUsageCityItem.Builder.class) +public final class RetrievePeopleResponseUsageCityItem { + private final int events; + + private final String value; + + private final Map additionalProperties; + + private RetrievePeopleResponseUsageCityItem(int events, String value, Map additionalProperties) { + this.events = events; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("events") + public int getEvents() { + return events; + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseUsageCityItem + && equalTo((RetrievePeopleResponseUsageCityItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseUsageCityItem other) { + return events == other.events && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.events, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EventsStage builder() { + return new Builder(); + } + + public interface EventsStage { + ValueStage events(int events); + + Builder from(RetrievePeopleResponseUsageCityItem other); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + } + + public interface _FinalStage { + RetrievePeopleResponseUsageCityItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EventsStage, ValueStage, _FinalStage { + private int events; + + private String value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseUsageCityItem other) { + events(other.getEvents()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("events") + public ValueStage events(int events) { + this.events = events; + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + @java.lang.Override + public RetrievePeopleResponseUsageCityItem build() { + return new RetrievePeopleResponseUsageCityItem(events, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageCountryItem.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageCountryItem.java new file mode 100644 index 00000000..6b7ed062 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageCountryItem.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseUsageCountryItem.Builder.class) +public final class RetrievePeopleResponseUsageCountryItem { + private final int events; + + private final String value; + + private final Map additionalProperties; + + private RetrievePeopleResponseUsageCountryItem(int events, String value, Map additionalProperties) { + this.events = events; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("events") + public int getEvents() { + return events; + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseUsageCountryItem + && equalTo((RetrievePeopleResponseUsageCountryItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseUsageCountryItem other) { + return events == other.events && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.events, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EventsStage builder() { + return new Builder(); + } + + public interface EventsStage { + ValueStage events(int events); + + Builder from(RetrievePeopleResponseUsageCountryItem other); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + } + + public interface _FinalStage { + RetrievePeopleResponseUsageCountryItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EventsStage, ValueStage, _FinalStage { + private int events; + + private String value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseUsageCountryItem other) { + events(other.getEvents()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("events") + public ValueStage events(int events) { + this.events = events; + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + @java.lang.Override + public RetrievePeopleResponseUsageCountryItem build() { + return new RetrievePeopleResponseUsageCountryItem(events, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageDeviceItem.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageDeviceItem.java new file mode 100644 index 00000000..9e731d58 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageDeviceItem.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseUsageDeviceItem.Builder.class) +public final class RetrievePeopleResponseUsageDeviceItem { + private final int events; + + private final String value; + + private final Map additionalProperties; + + private RetrievePeopleResponseUsageDeviceItem(int events, String value, Map additionalProperties) { + this.events = events; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("events") + public int getEvents() { + return events; + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseUsageDeviceItem + && equalTo((RetrievePeopleResponseUsageDeviceItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseUsageDeviceItem other) { + return events == other.events && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.events, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EventsStage builder() { + return new Builder(); + } + + public interface EventsStage { + ValueStage events(int events); + + Builder from(RetrievePeopleResponseUsageDeviceItem other); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + } + + public interface _FinalStage { + RetrievePeopleResponseUsageDeviceItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EventsStage, ValueStage, _FinalStage { + private int events; + + private String value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseUsageDeviceItem other) { + events(other.getEvents()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("events") + public ValueStage events(int events) { + this.events = events; + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + @java.lang.Override + public RetrievePeopleResponseUsageDeviceItem build() { + return new RetrievePeopleResponseUsageDeviceItem(events, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageIpItem.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageIpItem.java new file mode 100644 index 00000000..28a121bd --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageIpItem.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseUsageIpItem.Builder.class) +public final class RetrievePeopleResponseUsageIpItem { + private final int events; + + private final String value; + + private final Map additionalProperties; + + private RetrievePeopleResponseUsageIpItem(int events, String value, Map additionalProperties) { + this.events = events; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("events") + public int getEvents() { + return events; + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseUsageIpItem && equalTo((RetrievePeopleResponseUsageIpItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseUsageIpItem other) { + return events == other.events && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.events, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EventsStage builder() { + return new Builder(); + } + + public interface EventsStage { + ValueStage events(int events); + + Builder from(RetrievePeopleResponseUsageIpItem other); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + } + + public interface _FinalStage { + RetrievePeopleResponseUsageIpItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EventsStage, ValueStage, _FinalStage { + private int events; + + private String value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseUsageIpItem other) { + events(other.getEvents()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("events") + public ValueStage events(int events) { + this.events = events; + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + @java.lang.Override + public RetrievePeopleResponseUsageIpItem build() { + return new RetrievePeopleResponseUsageIpItem(events, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageOsItem.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageOsItem.java new file mode 100644 index 00000000..16ca03c1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageOsItem.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseUsageOsItem.Builder.class) +public final class RetrievePeopleResponseUsageOsItem { + private final int events; + + private final String value; + + private final Map additionalProperties; + + private RetrievePeopleResponseUsageOsItem(int events, String value, Map additionalProperties) { + this.events = events; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("events") + public int getEvents() { + return events; + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseUsageOsItem && equalTo((RetrievePeopleResponseUsageOsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseUsageOsItem other) { + return events == other.events && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.events, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EventsStage builder() { + return new Builder(); + } + + public interface EventsStage { + ValueStage events(int events); + + Builder from(RetrievePeopleResponseUsageOsItem other); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + } + + public interface _FinalStage { + RetrievePeopleResponseUsageOsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EventsStage, ValueStage, _FinalStage { + private int events; + + private String value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseUsageOsItem other) { + events(other.getEvents()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("events") + public ValueStage events(int events) { + this.events = events; + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + @java.lang.Override + public RetrievePeopleResponseUsageOsItem build() { + return new RetrievePeopleResponseUsageOsItem(events, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageReferrerItem.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageReferrerItem.java new file mode 100644 index 00000000..7a90c4ec --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageReferrerItem.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseUsageReferrerItem.Builder.class) +public final class RetrievePeopleResponseUsageReferrerItem { + private final int events; + + private final String value; + + private final Map additionalProperties; + + private RetrievePeopleResponseUsageReferrerItem( + int events, String value, Map additionalProperties) { + this.events = events; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("events") + public int getEvents() { + return events; + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseUsageReferrerItem + && equalTo((RetrievePeopleResponseUsageReferrerItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseUsageReferrerItem other) { + return events == other.events && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.events, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EventsStage builder() { + return new Builder(); + } + + public interface EventsStage { + ValueStage events(int events); + + Builder from(RetrievePeopleResponseUsageReferrerItem other); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + } + + public interface _FinalStage { + RetrievePeopleResponseUsageReferrerItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EventsStage, ValueStage, _FinalStage { + private int events; + + private String value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseUsageReferrerItem other) { + events(other.getEvents()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("events") + public ValueStage events(int events) { + this.events = events; + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + @java.lang.Override + public RetrievePeopleResponseUsageReferrerItem build() { + return new RetrievePeopleResponseUsageReferrerItem(events, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageTimezoneItem.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageTimezoneItem.java new file mode 100644 index 00000000..88e9210e --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUsageTimezoneItem.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseUsageTimezoneItem.Builder.class) +public final class RetrievePeopleResponseUsageTimezoneItem { + private final int events; + + private final String value; + + private final Map additionalProperties; + + private RetrievePeopleResponseUsageTimezoneItem( + int events, String value, Map additionalProperties) { + this.events = events; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("events") + public int getEvents() { + return events; + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseUsageTimezoneItem + && equalTo((RetrievePeopleResponseUsageTimezoneItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseUsageTimezoneItem other) { + return events == other.events && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.events, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EventsStage builder() { + return new Builder(); + } + + public interface EventsStage { + ValueStage events(int events); + + Builder from(RetrievePeopleResponseUsageTimezoneItem other); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + } + + public interface _FinalStage { + RetrievePeopleResponseUsageTimezoneItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EventsStage, ValueStage, _FinalStage { + private int events; + + private String value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseUsageTimezoneItem other) { + events(other.getEvents()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("events") + public ValueStage events(int events) { + this.events = events; + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + @java.lang.Override + public RetrievePeopleResponseUsageTimezoneItem build() { + return new RetrievePeopleResponseUsageTimezoneItem(events, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUser.java b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUser.java new file mode 100644 index 00000000..9599c86c --- /dev/null +++ b/src/main/java/com/whop/api/resources/people/types/RetrievePeopleResponseUser.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.people.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePeopleResponseUser.Builder.class) +public final class RetrievePeopleResponseUser { + private final String id; + + private final Optional name; + + private final Optional profilePicUrl; + + private final String username; + + private final Map additionalProperties; + + private RetrievePeopleResponseUser( + String id, + Optional name, + Optional profilePicUrl, + String username, + Map additionalProperties) { + this.id = id; + this.name = name; + this.profilePicUrl = profilePicUrl; + this.username = username; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonIgnore + public Optional getProfilePicUrl() { + if (profilePicUrl == null) { + return Optional.empty(); + } + return profilePicUrl; + } + + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("profile_pic_url") + private Optional _getProfilePicUrl() { + return profilePicUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePeopleResponseUser && equalTo((RetrievePeopleResponseUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrievePeopleResponseUser other) { + return id.equals(other.id) + && name.equals(other.name) + && profilePicUrl.equals(other.profilePicUrl) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.profilePicUrl, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + UsernameStage id(@NotNull String id); + + Builder from(RetrievePeopleResponseUser other); + } + + public interface UsernameStage { + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + RetrievePeopleResponseUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage profilePicUrl(Optional profilePicUrl); + + _FinalStage profilePicUrl(String profilePicUrl); + + _FinalStage profilePicUrl(Nullable profilePicUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional profilePicUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrievePeopleResponseUser other) { + id(other.getId()); + name(other.getName()); + profilePicUrl(other.getProfilePicUrl()); + username(other.getUsername()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage profilePicUrl(Nullable profilePicUrl) { + if (profilePicUrl.isNull()) { + this.profilePicUrl = null; + } else if (profilePicUrl.isEmpty()) { + this.profilePicUrl = Optional.empty(); + } else { + this.profilePicUrl = Optional.of(profilePicUrl.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage profilePicUrl(String profilePicUrl) { + this.profilePicUrl = Optional.ofNullable(profilePicUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "profile_pic_url", nulls = Nulls.SKIP) + public _FinalStage profilePicUrl(Optional profilePicUrl) { + this.profilePicUrl = profilePicUrl; + return this; + } + + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrievePeopleResponseUser build() { + return new RetrievePeopleResponseUser(id, name, profilePicUrl, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/permissions/AsyncPermissionsClient.java b/src/main/java/com/whop/api/resources/permissions/AsyncPermissionsClient.java new file mode 100644 index 00000000..5cee7c72 --- /dev/null +++ b/src/main/java/com/whop/api/resources/permissions/AsyncPermissionsClient.java @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.permissions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.permissions.requests.ListPermissionsRequest; +import com.whop.api.resources.permissions.types.ListPermissionsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncPermissionsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPermissionsClient rawClient; + + public AsyncPermissionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPermissionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPermissionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists permission actions and whether the calling credential is granted each one for a resource. Answers for whichever identity authenticated the request — a user session, an OAuth token, or an account or app API key — so it never describes who else can reach the resource. + */ + public CompletableFuture list(ListPermissionsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists permission actions and whether the calling credential is granted each one for a resource. Answers for whichever identity authenticated the request — a user session, an OAuth token, or an account or app API key — so it never describes who else can reach the resource. + */ + public CompletableFuture list( + ListPermissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/permissions/AsyncRawPermissionsClient.java b/src/main/java/com/whop/api/resources/permissions/AsyncRawPermissionsClient.java new file mode 100644 index 00000000..0fdeccfb --- /dev/null +++ b/src/main/java/com/whop/api/resources/permissions/AsyncRawPermissionsClient.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.permissions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.permissions.requests.ListPermissionsRequest; +import com.whop.api.resources.permissions.types.ListPermissionsResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPermissionsClient { + protected final ClientOptions clientOptions; + + public AsyncRawPermissionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists permission actions and whether the calling credential is granted each one for a resource. Answers for whichever identity authenticated the request — a user session, an OAuth token, or an account or app API key — so it never describes who else can reach the resource. + */ + public CompletableFuture> list(ListPermissionsRequest request) { + return list(request, null); + } + + /** + * Lists permission actions and whether the calling credential is granted each one for a resource. Answers for whichever identity authenticated the request — a user session, an OAuth token, or an account or app API key — so it never describes who else can reach the resource. + */ + public CompletableFuture> list( + ListPermissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("permissions"); + QueryStringMapper.addQueryParameter(httpUrl, "resource_id", request.getResourceId(), false); + if (request.getActions().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "actions", request.getActions().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPermissionsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/permissions/PermissionsClient.java b/src/main/java/com/whop/api/resources/permissions/PermissionsClient.java new file mode 100644 index 00000000..86dcd0b1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/permissions/PermissionsClient.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.permissions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.permissions.requests.ListPermissionsRequest; +import com.whop.api.resources.permissions.types.ListPermissionsResponse; + +public class PermissionsClient { + protected final ClientOptions clientOptions; + + private final RawPermissionsClient rawClient; + + public PermissionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPermissionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPermissionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists permission actions and whether the calling credential is granted each one for a resource. Answers for whichever identity authenticated the request — a user session, an OAuth token, or an account or app API key — so it never describes who else can reach the resource. + */ + public ListPermissionsResponse list(ListPermissionsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists permission actions and whether the calling credential is granted each one for a resource. Answers for whichever identity authenticated the request — a user session, an OAuth token, or an account or app API key — so it never describes who else can reach the resource. + */ + public ListPermissionsResponse list(ListPermissionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/permissions/RawPermissionsClient.java b/src/main/java/com/whop/api/resources/permissions/RawPermissionsClient.java new file mode 100644 index 00000000..bfbf694e --- /dev/null +++ b/src/main/java/com/whop/api/resources/permissions/RawPermissionsClient.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.permissions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.permissions.requests.ListPermissionsRequest; +import com.whop.api.resources.permissions.types.ListPermissionsResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPermissionsClient { + protected final ClientOptions clientOptions; + + public RawPermissionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists permission actions and whether the calling credential is granted each one for a resource. Answers for whichever identity authenticated the request — a user session, an OAuth token, or an account or app API key — so it never describes who else can reach the resource. + */ + public WhopApiHttpResponse list(ListPermissionsRequest request) { + return list(request, null); + } + + /** + * Lists permission actions and whether the calling credential is granted each one for a resource. Answers for whichever identity authenticated the request — a user session, an OAuth token, or an account or app API key — so it never describes who else can reach the resource. + */ + public WhopApiHttpResponse list( + ListPermissionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("permissions"); + QueryStringMapper.addQueryParameter(httpUrl, "resource_id", request.getResourceId(), false); + if (request.getActions().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "actions", request.getActions().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPermissionsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/permissions/requests/ListPermissionsRequest.java b/src/main/java/com/whop/api/resources/permissions/requests/ListPermissionsRequest.java new file mode 100644 index 00000000..e46a83e6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/permissions/requests/ListPermissionsRequest.java @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.permissions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPermissionsRequest.Builder.class) +public final class ListPermissionsRequest { + private final String resourceId; + + private final Optional actions; + + private final Map additionalProperties; + + private ListPermissionsRequest( + String resourceId, Optional actions, Map additionalProperties) { + this.resourceId = resourceId; + this.actions = actions; + this.additionalProperties = additionalProperties; + } + + /** + * @return Tag of the resource to check against: an account (biz_), product (prod_), experience (exp_), or app (app_). A resource the credential cannot see is reported as granted nothing rather than as an error. + */ + @JsonProperty("resource_id") + public String getResourceId() { + return resourceId; + } + + /** + * @return Comma-separated permission actions to check, for example stats:read,payment:basic:read. Every action is returned when omitted. + */ + @JsonProperty("actions") + public Optional getActions() { + return actions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPermissionsRequest && equalTo((ListPermissionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPermissionsRequest other) { + return resourceId.equals(other.resourceId) && actions.equals(other.actions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.resourceId, this.actions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ResourceIdStage builder() { + return new Builder(); + } + + public interface ResourceIdStage { + /** + *

Tag of the resource to check against: an account (biz_), product (prod_), experience (exp_), or app (app_). A resource the credential cannot see is reported as granted nothing rather than as an error.

+ */ + _FinalStage resourceId(@NotNull String resourceId); + + Builder from(ListPermissionsRequest other); + } + + public interface _FinalStage { + ListPermissionsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Comma-separated permission actions to check, for example stats:read,payment:basic:read. Every action is returned when omitted.

+ */ + _FinalStage actions(Optional actions); + + _FinalStage actions(String actions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ResourceIdStage, _FinalStage { + private String resourceId; + + private Optional actions = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPermissionsRequest other) { + resourceId(other.getResourceId()); + actions(other.getActions()); + return this; + } + + /** + *

Tag of the resource to check against: an account (biz_), product (prod_), experience (exp_), or app (app_). A resource the credential cannot see is reported as granted nothing rather than as an error.

+ *

Tag of the resource to check against: an account (biz_), product (prod_), experience (exp_), or app (app_). A resource the credential cannot see is reported as granted nothing rather than as an error.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_id") + public _FinalStage resourceId(@NotNull String resourceId) { + this.resourceId = Objects.requireNonNull(resourceId, "resourceId must not be null"); + return this; + } + + /** + *

Comma-separated permission actions to check, for example stats:read,payment:basic:read. Every action is returned when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage actions(String actions) { + this.actions = Optional.ofNullable(actions); + return this; + } + + /** + *

Comma-separated permission actions to check, for example stats:read,payment:basic:read. Every action is returned when omitted.

+ */ + @java.lang.Override + @JsonSetter(value = "actions", nulls = Nulls.SKIP) + public _FinalStage actions(Optional actions) { + this.actions = actions; + return this; + } + + @java.lang.Override + public ListPermissionsRequest build() { + return new ListPermissionsRequest(resourceId, actions, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/permissions/types/ListPermissionsResponse.java b/src/main/java/com/whop/api/resources/permissions/types/ListPermissionsResponse.java new file mode 100644 index 00000000..28cec001 --- /dev/null +++ b/src/main/java/com/whop/api/resources/permissions/types/ListPermissionsResponse.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.permissions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPermissionsResponse.Builder.class) +public final class ListPermissionsResponse { + private final List data; + + private final Map additionalProperties; + + private ListPermissionsResponse( + List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPermissionsResponse && equalTo((ListPermissionsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPermissionsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListPermissionsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(ListPermissionsResponseDataItem data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public ListPermissionsResponse build() { + return new ListPermissionsResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/permissions/types/ListPermissionsResponseDataItem.java b/src/main/java/com/whop/api/resources/permissions/types/ListPermissionsResponseDataItem.java new file mode 100644 index 00000000..692b317a --- /dev/null +++ b/src/main/java/com/whop/api/resources/permissions/types/ListPermissionsResponseDataItem.java @@ -0,0 +1,153 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.permissions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PermissionAction; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPermissionsResponseDataItem.Builder.class) +public final class ListPermissionsResponseDataItem { + private final PermissionAction action; + + private final boolean granted; + + private final Map additionalProperties; + + private ListPermissionsResponseDataItem( + PermissionAction action, boolean granted, Map additionalProperties) { + this.action = action; + this.granted = granted; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("action") + public PermissionAction getAction() { + return action; + } + + /** + * @return Whether the credential is granted the action for the resource. + */ + @JsonProperty("granted") + public boolean getGranted() { + return granted; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPermissionsResponseDataItem && equalTo((ListPermissionsResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPermissionsResponseDataItem other) { + return action.equals(other.action) && granted == other.granted; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.action, this.granted); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + GrantedStage action(@NotNull PermissionAction action); + + Builder from(ListPermissionsResponseDataItem other); + } + + public interface GrantedStage { + /** + *

Whether the credential is granted the action for the resource.

+ */ + _FinalStage granted(boolean granted); + } + + public interface _FinalStage { + ListPermissionsResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ActionStage, GrantedStage, _FinalStage { + private PermissionAction action; + + private boolean granted; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPermissionsResponseDataItem other) { + action(other.getAction()); + granted(other.getGranted()); + return this; + } + + @java.lang.Override + @JsonSetter("action") + public GrantedStage action(@NotNull PermissionAction action) { + this.action = Objects.requireNonNull(action, "action must not be null"); + return this; + } + + /** + *

Whether the credential is granted the action for the resource.

+ *

Whether the credential is granted the action for the resource.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("granted") + public _FinalStage granted(boolean granted) { + this.granted = granted; + return this; + } + + @java.lang.Override + public ListPermissionsResponseDataItem build() { + return new ListPermissionsResponseDataItem(action, granted, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/AsyncPlansClient.java b/src/main/java/com/whop/api/resources/plans/AsyncPlansClient.java new file mode 100644 index 00000000..cbba0192 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/AsyncPlansClient.java @@ -0,0 +1,194 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.plans.requests.CalculateTaxPlansRequest; +import com.whop.api.resources.plans.requests.CreatePlansRequest; +import com.whop.api.resources.plans.requests.DeletePlansRequest; +import com.whop.api.resources.plans.requests.ListPlansRequest; +import com.whop.api.resources.plans.requests.RetrievePlansRequest; +import com.whop.api.resources.plans.requests.UpdatePlansRequest; +import com.whop.api.resources.plans.types.CalculateTaxPlansResponse; +import com.whop.api.resources.plans.types.DeletePlansResponse; +import com.whop.api.types.Plan; +import com.whop.api.types.PlanListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncPlansClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPlansClient rawClient; + + public AsyncPlansClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPlansClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPlansClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of plans belonging to an account, with optional filtering by visibility, type, release method, and product. + */ + public CompletableFuture> list(ListPlansRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of plans belonging to an account, with optional filtering by visibility, type, release method, and product. + */ + public CompletableFuture> list( + ListPlansRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public CompletableFuture create() { + return this.rawClient.create().thenApply(response -> response.body()); + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public CompletableFuture create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).thenApply(response -> response.body()); + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public CompletableFuture create(CreatePlansRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public CompletableFuture create(CreatePlansRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing plan. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing plan. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing plan. + */ + public CompletableFuture retrieve(String id, RetrievePlansRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing plan. + */ + public CompletableFuture retrieve(String id, RetrievePlansRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public CompletableFuture delete(String id, DeletePlansRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public CompletableFuture delete( + String id, DeletePlansRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public CompletableFuture update(String id, UpdatePlansRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public CompletableFuture update(String id, UpdatePlansRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public CompletableFuture calculateTax(String id) { + return this.rawClient.calculateTax(id).thenApply(response -> response.body()); + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public CompletableFuture calculateTax(String id, RequestOptions requestOptions) { + return this.rawClient.calculateTax(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public CompletableFuture calculateTax(String id, CalculateTaxPlansRequest request) { + return this.rawClient.calculateTax(id, request).thenApply(response -> response.body()); + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public CompletableFuture calculateTax( + String id, CalculateTaxPlansRequest request, RequestOptions requestOptions) { + return this.rawClient.calculateTax(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/AsyncRawPlansClient.java b/src/main/java/com/whop/api/resources/plans/AsyncRawPlansClient.java new file mode 100644 index 00000000..15533eaa --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/AsyncRawPlansClient.java @@ -0,0 +1,671 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.plans.requests.CalculateTaxPlansRequest; +import com.whop.api.resources.plans.requests.CreatePlansRequest; +import com.whop.api.resources.plans.requests.DeletePlansRequest; +import com.whop.api.resources.plans.requests.ListPlansRequest; +import com.whop.api.resources.plans.requests.RetrievePlansRequest; +import com.whop.api.resources.plans.requests.UpdatePlansRequest; +import com.whop.api.resources.plans.types.CalculateTaxPlansResponse; +import com.whop.api.resources.plans.types.DeletePlansResponse; +import com.whop.api.resources.plans.types.ListPlansResponse; +import com.whop.api.types.Plan; +import com.whop.api.types.PlanListItem; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPlansClient { + protected final ClientOptions clientOptions; + + public AsyncRawPlansClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of plans belonging to an account, with optional filtering by visibility, type, release method, and product. + */ + public CompletableFuture>> list(ListPlansRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of plans belonging to an account, with optional filtering by visibility, type, release method, and product. + */ + public CompletableFuture>> list( + ListPlansRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getReleaseMethods().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "release_methods", request.getReleaseMethods().get(), true); + } + if (request.getVisibilities().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "visibilities", request.getVisibilities().get(), true); + } + if (request.getPlanTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_types", request.getPlanTypes().get(), true); + } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPlansResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPlansResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListPlansRequest nextRequest = ListPlansRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public CompletableFuture> create() { + return create(CreatePlansRequest.builder().build()); + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public CompletableFuture> create(RequestOptions requestOptions) { + return create(CreatePlansRequest.builder().build(), requestOptions); + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public CompletableFuture> create(CreatePlansRequest request) { + return create(request, null); + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public CompletableFuture> create( + CreatePlansRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Plan.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing plan. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrievePlansRequest.builder().build()); + } + + /** + * Retrieves the details of an existing plan. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePlansRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing plan. + */ + public CompletableFuture> retrieve(String id, RetrievePlansRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing plan. + */ + public CompletableFuture> retrieve( + String id, RetrievePlansRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Plan.class), response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public CompletableFuture> delete(String id) { + return delete(id, DeletePlansRequest.builder().build()); + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public CompletableFuture> delete( + String id, RequestOptions requestOptions) { + return delete(id, DeletePlansRequest.builder().build(), requestOptions); + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public CompletableFuture> delete(String id, DeletePlansRequest request) { + return delete(id, request, null); + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public CompletableFuture> delete( + String id, DeletePlansRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeletePlansResponse.class), + response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public CompletableFuture> update(String id) { + return update(id, UpdatePlansRequest.builder().build()); + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdatePlansRequest.builder().build(), requestOptions); + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public CompletableFuture> update(String id, UpdatePlansRequest request) { + return update(id, request, null); + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public CompletableFuture> update( + String id, UpdatePlansRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Plan.class), response)); + return; + } + try { + if (response.code() == 401) { + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public CompletableFuture> calculateTax(String id) { + return calculateTax(id, CalculateTaxPlansRequest.builder().build()); + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public CompletableFuture> calculateTax( + String id, RequestOptions requestOptions) { + return calculateTax(id, CalculateTaxPlansRequest.builder().build(), requestOptions); + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public CompletableFuture> calculateTax( + String id, CalculateTaxPlansRequest request) { + return calculateTax(id, request, null); + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public CompletableFuture> calculateTax( + String id, CalculateTaxPlansRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans") + .addPathSegment(id) + .addPathSegments("calculate_tax"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CalculateTaxPlansResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/plans/PlansClient.java b/src/main/java/com/whop/api/resources/plans/PlansClient.java new file mode 100644 index 00000000..14bc96d0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/PlansClient.java @@ -0,0 +1,191 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.plans.requests.CalculateTaxPlansRequest; +import com.whop.api.resources.plans.requests.CreatePlansRequest; +import com.whop.api.resources.plans.requests.DeletePlansRequest; +import com.whop.api.resources.plans.requests.ListPlansRequest; +import com.whop.api.resources.plans.requests.RetrievePlansRequest; +import com.whop.api.resources.plans.requests.UpdatePlansRequest; +import com.whop.api.resources.plans.types.CalculateTaxPlansResponse; +import com.whop.api.resources.plans.types.DeletePlansResponse; +import com.whop.api.types.Plan; +import com.whop.api.types.PlanListItem; + +public class PlansClient { + protected final ClientOptions clientOptions; + + private final RawPlansClient rawClient; + + public PlansClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPlansClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPlansClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of plans belonging to an account, with optional filtering by visibility, type, release method, and product. + */ + public SyncPagingIterable list(ListPlansRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of plans belonging to an account, with optional filtering by visibility, type, release method, and product. + */ + public SyncPagingIterable list(ListPlansRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public Plan create() { + return this.rawClient.create().body(); + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public Plan create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).body(); + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public Plan create(CreatePlansRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public Plan create(CreatePlansRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing plan. + */ + public Plan retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing plan. + */ + public Plan retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing plan. + */ + public Plan retrieve(String id, RetrievePlansRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing plan. + */ + public Plan retrieve(String id, RetrievePlansRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public DeletePlansResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public DeletePlansResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public DeletePlansResponse delete(String id, DeletePlansRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public DeletePlansResponse delete(String id, DeletePlansRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public Plan update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public Plan update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public Plan update(String id, UpdatePlansRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public Plan update(String id, UpdatePlansRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public CalculateTaxPlansResponse calculateTax(String id) { + return this.rawClient.calculateTax(id).body(); + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public CalculateTaxPlansResponse calculateTax(String id, RequestOptions requestOptions) { + return this.rawClient.calculateTax(id, requestOptions).body(); + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public CalculateTaxPlansResponse calculateTax(String id, CalculateTaxPlansRequest request) { + return this.rawClient.calculateTax(id, request).body(); + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public CalculateTaxPlansResponse calculateTax( + String id, CalculateTaxPlansRequest request, RequestOptions requestOptions) { + return this.rawClient.calculateTax(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/RawPlansClient.java b/src/main/java/com/whop/api/resources/plans/RawPlansClient.java new file mode 100644 index 00000000..ca03de75 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/RawPlansClient.java @@ -0,0 +1,551 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.plans.requests.CalculateTaxPlansRequest; +import com.whop.api.resources.plans.requests.CreatePlansRequest; +import com.whop.api.resources.plans.requests.DeletePlansRequest; +import com.whop.api.resources.plans.requests.ListPlansRequest; +import com.whop.api.resources.plans.requests.RetrievePlansRequest; +import com.whop.api.resources.plans.requests.UpdatePlansRequest; +import com.whop.api.resources.plans.types.CalculateTaxPlansResponse; +import com.whop.api.resources.plans.types.DeletePlansResponse; +import com.whop.api.resources.plans.types.ListPlansResponse; +import com.whop.api.types.Plan; +import com.whop.api.types.PlanListItem; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPlansClient { + protected final ClientOptions clientOptions; + + public RawPlansClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of plans belonging to an account, with optional filtering by visibility, type, release method, and product. + */ + public WhopApiHttpResponse> list(ListPlansRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of plans belonging to an account, with optional filtering by visibility, type, release method, and product. + */ + public WhopApiHttpResponse> list( + ListPlansRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getReleaseMethods().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "release_methods", request.getReleaseMethods().get(), true); + } + if (request.getVisibilities().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "visibilities", request.getVisibilities().get(), true); + } + if (request.getPlanTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_types", request.getPlanTypes().get(), true); + } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPlansResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPlansResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListPlansRequest nextRequest = ListPlansRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public WhopApiHttpResponse create() { + return create(CreatePlansRequest.builder().build()); + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public WhopApiHttpResponse create(RequestOptions requestOptions) { + return create(CreatePlansRequest.builder().build(), requestOptions); + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public WhopApiHttpResponse create(CreatePlansRequest request) { + return create(request, null); + } + + /** + * Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers. + */ + public WhopApiHttpResponse create(CreatePlansRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Plan.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing plan. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrievePlansRequest.builder().build()); + } + + /** + * Retrieves the details of an existing plan. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePlansRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing plan. + */ + public WhopApiHttpResponse retrieve(String id, RetrievePlansRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing plan. + */ + public WhopApiHttpResponse retrieve(String id, RetrievePlansRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Plan.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeletePlansRequest.builder().build()); + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeletePlansRequest.builder().build(), requestOptions); + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public WhopApiHttpResponse delete(String id, DeletePlansRequest request) { + return delete(id, request, null); + } + + /** + * Permanently delete a plan from a product. Existing memberships on this plan will not be affected. + */ + public WhopApiHttpResponse delete( + String id, DeletePlansRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeletePlansResponse.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdatePlansRequest.builder().build()); + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdatePlansRequest.builder().build(), requestOptions); + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public WhopApiHttpResponse update(String id, UpdatePlansRequest request) { + return update(id, request, null); + } + + /** + * Update a plan's pricing, billing interval, visibility, stock, and other settings. + */ + public WhopApiHttpResponse update(String id, UpdatePlansRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Plan.class), response); + } + try { + if (response.code() == 401) { + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public WhopApiHttpResponse calculateTax(String id) { + return calculateTax(id, CalculateTaxPlansRequest.builder().build()); + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public WhopApiHttpResponse calculateTax(String id, RequestOptions requestOptions) { + return calculateTax(id, CalculateTaxPlansRequest.builder().build(), requestOptions); + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public WhopApiHttpResponse calculateTax(String id, CalculateTaxPlansRequest request) { + return calculateTax(id, request, null); + } + + /** + * Previews tax for a plan before checkout, based on the buyer's location. + */ + public WhopApiHttpResponse calculateTax( + String id, CalculateTaxPlansRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans") + .addPathSegment(id) + .addPathSegments("calculate_tax"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CalculateTaxPlansResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/requests/CalculateTaxPlansRequest.java b/src/main/java/com/whop/api/resources/plans/requests/CalculateTaxPlansRequest.java new file mode 100644 index 00000000..ecab2b85 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/requests/CalculateTaxPlansRequest.java @@ -0,0 +1,217 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.plans.types.CalculateTaxPlansRequestAddress; +import com.whop.api.resources.plans.types.CalculateTaxPlansRequestTaxIdsItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CalculateTaxPlansRequest.Builder.class) +public final class CalculateTaxPlansRequest { + private final Optional address; + + private final Optional ipAddress; + + private final Optional> taxIds; + + private final Map additionalProperties; + + private CalculateTaxPlansRequest( + Optional address, + Optional ipAddress, + Optional> taxIds, + Map additionalProperties) { + this.address = address; + this.ipAddress = ipAddress; + this.taxIds = taxIds; + this.additionalProperties = additionalProperties; + } + + /** + * @return Buyer billing address used for tax calculation. Provide either address.country or ip_address; include state and postal code when available for more accurate results. + */ + @JsonIgnore + public Optional getAddress() { + if (address == null) { + return Optional.empty(); + } + return address; + } + + /** + * @return Buyer IP address used to infer location when no billing address is provided. + */ + @JsonProperty("ip_address") + public Optional getIpAddress() { + return ipAddress; + } + + /** + * @return Optional buyer tax ID for B2B exemptions. At most one entry is supported. + */ + @JsonIgnore + public Optional> getTaxIds() { + if (taxIds == null) { + return Optional.empty(); + } + return taxIds; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("address") + private Optional _getAddress() { + return address; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_ids") + private Optional> _getTaxIds() { + return taxIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CalculateTaxPlansRequest && equalTo((CalculateTaxPlansRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CalculateTaxPlansRequest other) { + return address.equals(other.address) && ipAddress.equals(other.ipAddress) && taxIds.equals(other.taxIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.address, this.ipAddress, this.taxIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional address = Optional.empty(); + + private Optional ipAddress = Optional.empty(); + + private Optional> taxIds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CalculateTaxPlansRequest other) { + address(other.getAddress()); + ipAddress(other.getIpAddress()); + taxIds(other.getTaxIds()); + return this; + } + + /** + *

Buyer billing address used for tax calculation. Provide either address.country or ip_address; include state and postal code when available for more accurate results.

+ */ + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public Builder address(Optional address) { + this.address = address; + return this; + } + + public Builder address(CalculateTaxPlansRequestAddress address) { + this.address = Optional.ofNullable(address); + return this; + } + + public Builder address(Nullable address) { + if (address.isNull()) { + this.address = null; + } else if (address.isEmpty()) { + this.address = Optional.empty(); + } else { + this.address = Optional.of(address.get()); + } + return this; + } + + /** + *

Buyer IP address used to infer location when no billing address is provided.

+ */ + @JsonSetter(value = "ip_address", nulls = Nulls.SKIP) + public Builder ipAddress(Optional ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + public Builder ipAddress(String ipAddress) { + this.ipAddress = Optional.ofNullable(ipAddress); + return this; + } + + /** + *

Optional buyer tax ID for B2B exemptions. At most one entry is supported.

+ */ + @JsonSetter(value = "tax_ids", nulls = Nulls.SKIP) + public Builder taxIds(Optional> taxIds) { + this.taxIds = taxIds; + return this; + } + + public Builder taxIds(List taxIds) { + this.taxIds = Optional.ofNullable(taxIds); + return this; + } + + public Builder taxIds(Nullable> taxIds) { + if (taxIds.isNull()) { + this.taxIds = null; + } else if (taxIds.isEmpty()) { + this.taxIds = Optional.empty(); + } else { + this.taxIds = Optional.of(taxIds.get()); + } + return this; + } + + public CalculateTaxPlansRequest build() { + return new CalculateTaxPlansRequest(address, ipAddress, taxIds, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/requests/CreatePlansRequest.java b/src/main/java/com/whop/api/resources/plans/requests/CreatePlansRequest.java new file mode 100644 index 00000000..b266dbd9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/requests/CreatePlansRequest.java @@ -0,0 +1,1255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.plans.types.CreatePlansRequestCustomFieldsItem; +import com.whop.api.resources.plans.types.CreatePlansRequestImage; +import com.whop.api.resources.plans.types.CreatePlansRequestPaymentMethodConfiguration; +import com.whop.api.resources.plans.types.CreatePlansRequestThreeDsLevel; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePlansRequest.Builder.class) +public final class CreatePlansRequest { + private final Optional accountId; + + private final Optional adaptivePricingEnabled; + + private final Optional billingPeriod; + + private final Optional> checkoutStyling; + + private final Optional currency; + + private final Optional> customFields; + + private final Optional description; + + private final Optional expirationDays; + + private final Optional image; + + private final Optional initialPrice; + + private final Optional internalNotes; + + private final Optional> metadata; + + private final Optional overrideTaxType; + + private final Optional paymentMethodConfiguration; + + private final Optional planType; + + private final Optional productId; + + private final Optional releaseMethod; + + private final Optional renewalPrice; + + private final Optional splitPayRequiredPayments; + + private final Optional stock; + + private final Optional threeDsLevel; + + private final Optional title; + + private final Optional trialPeriodDays; + + private final Optional unlimitedStock; + + private final Optional visibility; + + private final Map additionalProperties; + + private CreatePlansRequest( + Optional accountId, + Optional adaptivePricingEnabled, + Optional billingPeriod, + Optional> checkoutStyling, + Optional currency, + Optional> customFields, + Optional description, + Optional expirationDays, + Optional image, + Optional initialPrice, + Optional internalNotes, + Optional> metadata, + Optional overrideTaxType, + Optional paymentMethodConfiguration, + Optional planType, + Optional productId, + Optional releaseMethod, + Optional renewalPrice, + Optional splitPayRequiredPayments, + Optional stock, + Optional threeDsLevel, + Optional title, + Optional trialPeriodDays, + Optional unlimitedStock, + Optional visibility, + Map additionalProperties) { + this.accountId = accountId; + this.adaptivePricingEnabled = adaptivePricingEnabled; + this.billingPeriod = billingPeriod; + this.checkoutStyling = checkoutStyling; + this.currency = currency; + this.customFields = customFields; + this.description = description; + this.expirationDays = expirationDays; + this.image = image; + this.initialPrice = initialPrice; + this.internalNotes = internalNotes; + this.metadata = metadata; + this.overrideTaxType = overrideTaxType; + this.paymentMethodConfiguration = paymentMethodConfiguration; + this.planType = planType; + this.productId = productId; + this.releaseMethod = releaseMethod; + this.renewalPrice = renewalPrice; + this.splitPayRequiredPayments = splitPayRequiredPayments; + this.stock = stock; + this.threeDsLevel = threeDsLevel; + this.title = title; + this.trialPeriodDays = trialPeriodDays; + this.unlimitedStock = unlimitedStock; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the account to create this plan for. Defaults to the caller's account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Whether this plan accepts local currency payments via adaptive pricing. + */ + @JsonIgnore + public Optional getAdaptivePricingEnabled() { + if (adaptivePricingEnabled == null) { + return Optional.empty(); + } + return adaptivePricingEnabled; + } + + /** + * @return Recurring billing interval in days, such as 30 for monthly or 365 for annual. + */ + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + /** + * @return Checkout styling overrides for this plan. + */ + @JsonIgnore + public Optional> getCheckoutStyling() { + if (checkoutStyling == null) { + return Optional.empty(); + } + return checkoutStyling; + } + + /** + * @return The three-letter ISO currency code for the plan's pricing. Defaults to USD. + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + /** + * @return An array of custom field definitions to collect from customers at checkout. Omitting this field clears existing custom fields. + */ + @JsonIgnore + public Optional> getCustomFields() { + if (customFields == null) { + return Optional.empty(); + } + return customFields; + } + + /** + * @return A text description of the plan displayed to customers on the product page. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return Access duration in days before the membership expires. + */ + @JsonIgnore + public Optional getExpirationDays() { + if (expirationDays == null) { + return Optional.empty(); + } + return expirationDays; + } + + /** + * @return An image displayed on the product page to represent this plan. + */ + @JsonIgnore + public Optional getImage() { + if (image == null) { + return Optional.empty(); + } + return image; + } + + /** + * @return Initial amount charged in the plan's currency, e.g. 10.43 for $10.43. + */ + @JsonIgnore + public Optional getInitialPrice() { + if (initialPrice == null) { + return Optional.empty(); + } + return initialPrice; + } + + /** + * @return Private notes visible only to the account owner. Not shown to customers. + */ + @JsonIgnore + public Optional getInternalNotes() { + if (internalNotes == null) { + return Optional.empty(); + } + return internalNotes; + } + + /** + * @return Custom key-value pairs to store on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta (a checkout call-to-action button label — one of the product custom CTA values, e.g. subscribe, get_offer) and custom_cta_url (a URL the button links to; web or tel:) override the product's call to action for this plan and are validated on save. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Override the default tax classification for this specific plan. + */ + @JsonProperty("override_tax_type") + public Optional getOverrideTaxType() { + return overrideTaxType; + } + + /** + * @return Explicit payment method configuration for the plan. When not provided, the account's defaults apply. + */ + @JsonIgnore + public Optional getPaymentMethodConfiguration() { + if (paymentMethodConfiguration == null) { + return Optional.empty(); + } + return paymentMethodConfiguration; + } + + /** + * @return Plan billing type, such as one_time or renewal. + */ + @JsonProperty("plan_type") + public Optional getPlanType() { + return planType; + } + + /** + * @return The unique identifier of the product to attach this plan to. + */ + @JsonProperty("product_id") + public Optional getProductId() { + return productId; + } + + /** + * @return Sales method for this plan. + */ + @JsonProperty("release_method") + public Optional getReleaseMethod() { + return releaseMethod; + } + + /** + * @return The amount charged each billing period for recurring plans, in the plan's currency. + */ + @JsonIgnore + public Optional getRenewalPrice() { + if (renewalPrice == null) { + return Optional.empty(); + } + return renewalPrice; + } + + /** + * @return Installment payments required before the subscription pauses. + */ + @JsonIgnore + public Optional getSplitPayRequiredPayments() { + if (splitPayRequiredPayments == null) { + return Optional.empty(); + } + return splitPayRequiredPayments; + } + + /** + * @return The maximum number of units available for purchase. Ignored when unlimited_stock is true. + */ + @JsonIgnore + public Optional getStock() { + if (stock == null) { + return Optional.empty(); + } + return stock; + } + + /** + * @return 3D Secure behavior for this plan. Send null to inherit the account default. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return The display name of the plan shown to customers on the product page. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return Free trial duration before the first recurring charge. + */ + @JsonIgnore + public Optional getTrialPeriodDays() { + if (trialPeriodDays == null) { + return Optional.empty(); + } + return trialPeriodDays; + } + + /** + * @return Whether the plan has unlimited stock. When true, the stock field is ignored. + */ + @JsonIgnore + public Optional getUnlimitedStock() { + if (unlimitedStock == null) { + return Optional.empty(); + } + return unlimitedStock; + } + + /** + * @return Whether the plan is visible to customers or hidden from public view. + */ + @JsonProperty("visibility") + public Optional getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("adaptive_pricing_enabled") + private Optional _getAdaptivePricingEnabled() { + return adaptivePricingEnabled; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_styling") + private Optional> _getCheckoutStyling() { + return checkoutStyling; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_fields") + private Optional> _getCustomFields() { + return customFields; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_days") + private Optional _getExpirationDays() { + return expirationDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("image") + private Optional _getImage() { + return image; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("initial_price") + private Optional _getInitialPrice() { + return initialPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("internal_notes") + private Optional _getInternalNotes() { + return internalNotes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_configuration") + private Optional _getPaymentMethodConfiguration() { + return paymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("renewal_price") + private Optional _getRenewalPrice() { + return renewalPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("split_pay_required_payments") + private Optional _getSplitPayRequiredPayments() { + return splitPayRequiredPayments; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("stock") + private Optional _getStock() { + return stock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trial_period_days") + private Optional _getTrialPeriodDays() { + return trialPeriodDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("unlimited_stock") + private Optional _getUnlimitedStock() { + return unlimitedStock; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePlansRequest && equalTo((CreatePlansRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePlansRequest other) { + return accountId.equals(other.accountId) + && adaptivePricingEnabled.equals(other.adaptivePricingEnabled) + && billingPeriod.equals(other.billingPeriod) + && checkoutStyling.equals(other.checkoutStyling) + && currency.equals(other.currency) + && customFields.equals(other.customFields) + && description.equals(other.description) + && expirationDays.equals(other.expirationDays) + && image.equals(other.image) + && initialPrice.equals(other.initialPrice) + && internalNotes.equals(other.internalNotes) + && metadata.equals(other.metadata) + && overrideTaxType.equals(other.overrideTaxType) + && paymentMethodConfiguration.equals(other.paymentMethodConfiguration) + && planType.equals(other.planType) + && productId.equals(other.productId) + && releaseMethod.equals(other.releaseMethod) + && renewalPrice.equals(other.renewalPrice) + && splitPayRequiredPayments.equals(other.splitPayRequiredPayments) + && stock.equals(other.stock) + && threeDsLevel.equals(other.threeDsLevel) + && title.equals(other.title) + && trialPeriodDays.equals(other.trialPeriodDays) + && unlimitedStock.equals(other.unlimitedStock) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.adaptivePricingEnabled, + this.billingPeriod, + this.checkoutStyling, + this.currency, + this.customFields, + this.description, + this.expirationDays, + this.image, + this.initialPrice, + this.internalNotes, + this.metadata, + this.overrideTaxType, + this.paymentMethodConfiguration, + this.planType, + this.productId, + this.releaseMethod, + this.renewalPrice, + this.splitPayRequiredPayments, + this.stock, + this.threeDsLevel, + this.title, + this.trialPeriodDays, + this.unlimitedStock, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional adaptivePricingEnabled = Optional.empty(); + + private Optional billingPeriod = Optional.empty(); + + private Optional> checkoutStyling = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional> customFields = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional expirationDays = Optional.empty(); + + private Optional image = Optional.empty(); + + private Optional initialPrice = Optional.empty(); + + private Optional internalNotes = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional overrideTaxType = Optional.empty(); + + private Optional paymentMethodConfiguration = Optional.empty(); + + private Optional planType = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional releaseMethod = Optional.empty(); + + private Optional renewalPrice = Optional.empty(); + + private Optional splitPayRequiredPayments = Optional.empty(); + + private Optional stock = Optional.empty(); + + private Optional threeDsLevel = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional trialPeriodDays = Optional.empty(); + + private Optional unlimitedStock = Optional.empty(); + + private Optional visibility = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreatePlansRequest other) { + accountId(other.getAccountId()); + adaptivePricingEnabled(other.getAdaptivePricingEnabled()); + billingPeriod(other.getBillingPeriod()); + checkoutStyling(other.getCheckoutStyling()); + currency(other.getCurrency()); + customFields(other.getCustomFields()); + description(other.getDescription()); + expirationDays(other.getExpirationDays()); + image(other.getImage()); + initialPrice(other.getInitialPrice()); + internalNotes(other.getInternalNotes()); + metadata(other.getMetadata()); + overrideTaxType(other.getOverrideTaxType()); + paymentMethodConfiguration(other.getPaymentMethodConfiguration()); + planType(other.getPlanType()); + productId(other.getProductId()); + releaseMethod(other.getReleaseMethod()); + renewalPrice(other.getRenewalPrice()); + splitPayRequiredPayments(other.getSplitPayRequiredPayments()); + stock(other.getStock()); + threeDsLevel(other.getThreeDsLevel()); + title(other.getTitle()); + trialPeriodDays(other.getTrialPeriodDays()); + unlimitedStock(other.getUnlimitedStock()); + visibility(other.getVisibility()); + return this; + } + + /** + *

The unique identifier of the account to create this plan for. Defaults to the caller's account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Whether this plan accepts local currency payments via adaptive pricing.

+ */ + @JsonSetter(value = "adaptive_pricing_enabled", nulls = Nulls.SKIP) + public Builder adaptivePricingEnabled(Optional adaptivePricingEnabled) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + return this; + } + + public Builder adaptivePricingEnabled(Boolean adaptivePricingEnabled) { + this.adaptivePricingEnabled = Optional.ofNullable(adaptivePricingEnabled); + return this; + } + + public Builder adaptivePricingEnabled(Nullable adaptivePricingEnabled) { + if (adaptivePricingEnabled.isNull()) { + this.adaptivePricingEnabled = null; + } else if (adaptivePricingEnabled.isEmpty()) { + this.adaptivePricingEnabled = Optional.empty(); + } else { + this.adaptivePricingEnabled = Optional.of(adaptivePricingEnabled.get()); + } + return this; + } + + /** + *

Recurring billing interval in days, such as 30 for monthly or 365 for annual.

+ */ + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public Builder billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + public Builder billingPeriod(Integer billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + public Builder billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + /** + *

Checkout styling overrides for this plan.

+ */ + @JsonSetter(value = "checkout_styling", nulls = Nulls.SKIP) + public Builder checkoutStyling(Optional> checkoutStyling) { + this.checkoutStyling = checkoutStyling; + return this; + } + + public Builder checkoutStyling(Map checkoutStyling) { + this.checkoutStyling = Optional.ofNullable(checkoutStyling); + return this; + } + + public Builder checkoutStyling(Nullable> checkoutStyling) { + if (checkoutStyling.isNull()) { + this.checkoutStyling = null; + } else if (checkoutStyling.isEmpty()) { + this.checkoutStyling = Optional.empty(); + } else { + this.checkoutStyling = Optional.of(checkoutStyling.get()); + } + return this; + } + + /** + *

The three-letter ISO currency code for the plan's pricing. Defaults to USD.

+ */ + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional currency) { + this.currency = currency; + return this; + } + + public Builder currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

An array of custom field definitions to collect from customers at checkout. Omitting this field clears existing custom fields.

+ */ + @JsonSetter(value = "custom_fields", nulls = Nulls.SKIP) + public Builder customFields(Optional> customFields) { + this.customFields = customFields; + return this; + } + + public Builder customFields(List customFields) { + this.customFields = Optional.ofNullable(customFields); + return this; + } + + public Builder customFields(Nullable> customFields) { + if (customFields.isNull()) { + this.customFields = null; + } else if (customFields.isEmpty()) { + this.customFields = Optional.empty(); + } else { + this.customFields = Optional.of(customFields.get()); + } + return this; + } + + /** + *

A text description of the plan displayed to customers on the product page.

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public Builder description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

Access duration in days before the membership expires.

+ */ + @JsonSetter(value = "expiration_days", nulls = Nulls.SKIP) + public Builder expirationDays(Optional expirationDays) { + this.expirationDays = expirationDays; + return this; + } + + public Builder expirationDays(Integer expirationDays) { + this.expirationDays = Optional.ofNullable(expirationDays); + return this; + } + + public Builder expirationDays(Nullable expirationDays) { + if (expirationDays.isNull()) { + this.expirationDays = null; + } else if (expirationDays.isEmpty()) { + this.expirationDays = Optional.empty(); + } else { + this.expirationDays = Optional.of(expirationDays.get()); + } + return this; + } + + /** + *

An image displayed on the product page to represent this plan.

+ */ + @JsonSetter(value = "image", nulls = Nulls.SKIP) + public Builder image(Optional image) { + this.image = image; + return this; + } + + public Builder image(CreatePlansRequestImage image) { + this.image = Optional.ofNullable(image); + return this; + } + + public Builder image(Nullable image) { + if (image.isNull()) { + this.image = null; + } else if (image.isEmpty()) { + this.image = Optional.empty(); + } else { + this.image = Optional.of(image.get()); + } + return this; + } + + /** + *

Initial amount charged in the plan's currency, e.g. 10.43 for $10.43.

+ */ + @JsonSetter(value = "initial_price", nulls = Nulls.SKIP) + public Builder initialPrice(Optional initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + public Builder initialPrice(Double initialPrice) { + this.initialPrice = Optional.ofNullable(initialPrice); + return this; + } + + public Builder initialPrice(Nullable initialPrice) { + if (initialPrice.isNull()) { + this.initialPrice = null; + } else if (initialPrice.isEmpty()) { + this.initialPrice = Optional.empty(); + } else { + this.initialPrice = Optional.of(initialPrice.get()); + } + return this; + } + + /** + *

Private notes visible only to the account owner. Not shown to customers.

+ */ + @JsonSetter(value = "internal_notes", nulls = Nulls.SKIP) + public Builder internalNotes(Optional internalNotes) { + this.internalNotes = internalNotes; + return this; + } + + public Builder internalNotes(String internalNotes) { + this.internalNotes = Optional.ofNullable(internalNotes); + return this; + } + + public Builder internalNotes(Nullable internalNotes) { + if (internalNotes.isNull()) { + this.internalNotes = null; + } else if (internalNotes.isEmpty()) { + this.internalNotes = Optional.empty(); + } else { + this.internalNotes = Optional.of(internalNotes.get()); + } + return this; + } + + /** + *

Custom key-value pairs to store on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta (a checkout call-to-action button label — one of the product custom CTA values, e.g. subscribe, get_offer) and custom_cta_url (a URL the button links to; web or tel:) override the product's call to action for this plan and are validated on save.

+ */ + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + public Builder metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Override the default tax classification for this specific plan.

+ */ + @JsonSetter(value = "override_tax_type", nulls = Nulls.SKIP) + public Builder overrideTaxType(Optional overrideTaxType) { + this.overrideTaxType = overrideTaxType; + return this; + } + + public Builder overrideTaxType(String overrideTaxType) { + this.overrideTaxType = Optional.ofNullable(overrideTaxType); + return this; + } + + /** + *

Explicit payment method configuration for the plan. When not provided, the account's defaults apply.

+ */ + @JsonSetter(value = "payment_method_configuration", nulls = Nulls.SKIP) + public Builder paymentMethodConfiguration( + Optional paymentMethodConfiguration) { + this.paymentMethodConfiguration = paymentMethodConfiguration; + return this; + } + + public Builder paymentMethodConfiguration( + CreatePlansRequestPaymentMethodConfiguration paymentMethodConfiguration) { + this.paymentMethodConfiguration = Optional.ofNullable(paymentMethodConfiguration); + return this; + } + + public Builder paymentMethodConfiguration( + Nullable paymentMethodConfiguration) { + if (paymentMethodConfiguration.isNull()) { + this.paymentMethodConfiguration = null; + } else if (paymentMethodConfiguration.isEmpty()) { + this.paymentMethodConfiguration = Optional.empty(); + } else { + this.paymentMethodConfiguration = Optional.of(paymentMethodConfiguration.get()); + } + return this; + } + + /** + *

Plan billing type, such as one_time or renewal.

+ */ + @JsonSetter(value = "plan_type", nulls = Nulls.SKIP) + public Builder planType(Optional planType) { + this.planType = planType; + return this; + } + + public Builder planType(String planType) { + this.planType = Optional.ofNullable(planType); + return this; + } + + /** + *

The unique identifier of the product to attach this plan to.

+ */ + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public Builder productId(Optional productId) { + this.productId = productId; + return this; + } + + public Builder productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

Sales method for this plan.

+ */ + @JsonSetter(value = "release_method", nulls = Nulls.SKIP) + public Builder releaseMethod(Optional releaseMethod) { + this.releaseMethod = releaseMethod; + return this; + } + + public Builder releaseMethod(String releaseMethod) { + this.releaseMethod = Optional.ofNullable(releaseMethod); + return this; + } + + /** + *

The amount charged each billing period for recurring plans, in the plan's currency.

+ */ + @JsonSetter(value = "renewal_price", nulls = Nulls.SKIP) + public Builder renewalPrice(Optional renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + public Builder renewalPrice(Double renewalPrice) { + this.renewalPrice = Optional.ofNullable(renewalPrice); + return this; + } + + public Builder renewalPrice(Nullable renewalPrice) { + if (renewalPrice.isNull()) { + this.renewalPrice = null; + } else if (renewalPrice.isEmpty()) { + this.renewalPrice = Optional.empty(); + } else { + this.renewalPrice = Optional.of(renewalPrice.get()); + } + return this; + } + + /** + *

Installment payments required before the subscription pauses.

+ */ + @JsonSetter(value = "split_pay_required_payments", nulls = Nulls.SKIP) + public Builder splitPayRequiredPayments(Optional splitPayRequiredPayments) { + this.splitPayRequiredPayments = splitPayRequiredPayments; + return this; + } + + public Builder splitPayRequiredPayments(Integer splitPayRequiredPayments) { + this.splitPayRequiredPayments = Optional.ofNullable(splitPayRequiredPayments); + return this; + } + + public Builder splitPayRequiredPayments(Nullable splitPayRequiredPayments) { + if (splitPayRequiredPayments.isNull()) { + this.splitPayRequiredPayments = null; + } else if (splitPayRequiredPayments.isEmpty()) { + this.splitPayRequiredPayments = Optional.empty(); + } else { + this.splitPayRequiredPayments = Optional.of(splitPayRequiredPayments.get()); + } + return this; + } + + /** + *

The maximum number of units available for purchase. Ignored when unlimited_stock is true.

+ */ + @JsonSetter(value = "stock", nulls = Nulls.SKIP) + public Builder stock(Optional stock) { + this.stock = stock; + return this; + } + + public Builder stock(Integer stock) { + this.stock = Optional.ofNullable(stock); + return this; + } + + public Builder stock(Nullable stock) { + if (stock.isNull()) { + this.stock = null; + } else if (stock.isEmpty()) { + this.stock = Optional.empty(); + } else { + this.stock = Optional.of(stock.get()); + } + return this; + } + + /** + *

3D Secure behavior for this plan. Send null to inherit the account default.

+ */ + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public Builder threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + public Builder threeDsLevel(CreatePlansRequestThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + public Builder threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

The display name of the plan shown to customers on the product page.

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Free trial duration before the first recurring charge.

+ */ + @JsonSetter(value = "trial_period_days", nulls = Nulls.SKIP) + public Builder trialPeriodDays(Optional trialPeriodDays) { + this.trialPeriodDays = trialPeriodDays; + return this; + } + + public Builder trialPeriodDays(Integer trialPeriodDays) { + this.trialPeriodDays = Optional.ofNullable(trialPeriodDays); + return this; + } + + public Builder trialPeriodDays(Nullable trialPeriodDays) { + if (trialPeriodDays.isNull()) { + this.trialPeriodDays = null; + } else if (trialPeriodDays.isEmpty()) { + this.trialPeriodDays = Optional.empty(); + } else { + this.trialPeriodDays = Optional.of(trialPeriodDays.get()); + } + return this; + } + + /** + *

Whether the plan has unlimited stock. When true, the stock field is ignored.

+ */ + @JsonSetter(value = "unlimited_stock", nulls = Nulls.SKIP) + public Builder unlimitedStock(Optional unlimitedStock) { + this.unlimitedStock = unlimitedStock; + return this; + } + + public Builder unlimitedStock(Boolean unlimitedStock) { + this.unlimitedStock = Optional.ofNullable(unlimitedStock); + return this; + } + + public Builder unlimitedStock(Nullable unlimitedStock) { + if (unlimitedStock.isNull()) { + this.unlimitedStock = null; + } else if (unlimitedStock.isEmpty()) { + this.unlimitedStock = Optional.empty(); + } else { + this.unlimitedStock = Optional.of(unlimitedStock.get()); + } + return this; + } + + /** + *

Whether the plan is visible to customers or hidden from public view.

+ */ + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public Builder visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + public Builder visibility(String visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + public CreatePlansRequest build() { + return new CreatePlansRequest( + accountId, + adaptivePricingEnabled, + billingPeriod, + checkoutStyling, + currency, + customFields, + description, + expirationDays, + image, + initialPrice, + internalNotes, + metadata, + overrideTaxType, + paymentMethodConfiguration, + planType, + productId, + releaseMethod, + renewalPrice, + splitPayRequiredPayments, + stock, + threeDsLevel, + title, + trialPeriodDays, + unlimitedStock, + visibility, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/requests/DeletePlansRequest.java b/src/main/java/com/whop/api/resources/plans/requests/DeletePlansRequest.java new file mode 100644 index 00000000..e55b3ce4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/requests/DeletePlansRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeletePlansRequest.Builder.class) +public final class DeletePlansRequest { + private final Map additionalProperties; + + private DeletePlansRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeletePlansRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeletePlansRequest other) { + return this; + } + + public DeletePlansRequest build() { + return new DeletePlansRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/requests/ListPlansRequest.java b/src/main/java/com/whop/api/resources/plans/requests/ListPlansRequest.java new file mode 100644 index 00000000..219cbadc --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/requests/ListPlansRequest.java @@ -0,0 +1,712 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.plans.types.ListPlansRequestDirection; +import com.whop.api.resources.plans.types.ListPlansRequestOrder; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPlansRequest.Builder.class) +public final class ListPlansRequest { + private final Optional> releaseMethods; + + private final Optional> visibilities; + + private final Optional> planTypes; + + private final Optional> productIds; + + private final String accountId; + + private final Optional direction; + + private final Optional order; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListPlansRequest( + Optional> releaseMethods, + Optional> visibilities, + Optional> planTypes, + Optional> productIds, + String accountId, + Optional direction, + Optional order, + Optional createdBefore, + Optional createdAfter, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.releaseMethods = releaseMethods; + this.visibilities = visibilities; + this.planTypes = planTypes; + this.productIds = productIds; + this.accountId = accountId; + this.direction = direction; + this.order = order; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Filter to only plans matching these release methods. + */ + @JsonProperty("release_methods") + public Optional> getReleaseMethods() { + return releaseMethods; + } + + /** + * @return Filter to only plans matching these visibility states. + */ + @JsonProperty("visibilities") + public Optional> getVisibilities() { + return visibilities; + } + + /** + * @return Filter to only plans matching these billing types. + */ + @JsonProperty("plan_types") + public Optional> getPlanTypes() { + return planTypes; + } + + /** + * @return Filter to only plans belonging to these product identifiers. + */ + @JsonProperty("product_ids") + public Optional> getProductIds() { + return productIds; + } + + /** + * @return The unique identifier of the account to list plans for. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return The sort direction for results. Defaults to descending. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return The field to sort results by. Defaults to created_at. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Only return plans created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return plans created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return The number of plans to return (default and max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns plans after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of plans to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns plans before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPlansRequest && equalTo((ListPlansRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPlansRequest other) { + return releaseMethods.equals(other.releaseMethods) + && visibilities.equals(other.visibilities) + && planTypes.equals(other.planTypes) + && productIds.equals(other.productIds) + && accountId.equals(other.accountId) + && direction.equals(other.direction) + && order.equals(other.order) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.releaseMethods, + this.visibilities, + this.planTypes, + this.productIds, + this.accountId, + this.direction, + this.order, + this.createdBefore, + this.createdAfter, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

The unique identifier of the account to list plans for.

+ */ + _FinalStage accountId(@NotNull String accountId); + + Builder from(ListPlansRequest other); + } + + public interface _FinalStage { + ListPlansRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Filter to only plans matching these release methods.

+ */ + _FinalStage releaseMethods(Optional> releaseMethods); + + _FinalStage releaseMethods(List releaseMethods); + + _FinalStage releaseMethods(String releaseMethods); + + /** + *

Filter to only plans matching these visibility states.

+ */ + _FinalStage visibilities(Optional> visibilities); + + _FinalStage visibilities(List visibilities); + + _FinalStage visibilities(String visibilities); + + /** + *

Filter to only plans matching these billing types.

+ */ + _FinalStage planTypes(Optional> planTypes); + + _FinalStage planTypes(List planTypes); + + _FinalStage planTypes(String planTypes); + + /** + *

Filter to only plans belonging to these product identifiers.

+ */ + _FinalStage productIds(Optional> productIds); + + _FinalStage productIds(List productIds); + + _FinalStage productIds(String productIds); + + /** + *

The sort direction for results. Defaults to descending.

+ */ + _FinalStage direction(Optional direction); + + _FinalStage direction(ListPlansRequestDirection direction); + + /** + *

The field to sort results by. Defaults to created_at.

+ */ + _FinalStage order(Optional order); + + _FinalStage order(ListPlansRequestOrder order); + + /** + *

Only return plans created before this timestamp.

+ */ + _FinalStage createdBefore(Optional createdBefore); + + _FinalStage createdBefore(String createdBefore); + + /** + *

Only return plans created after this timestamp.

+ */ + _FinalStage createdAfter(Optional createdAfter); + + _FinalStage createdAfter(String createdAfter); + + /** + *

The number of plans to return (default and max 100).

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

A cursor; returns plans after this position.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

The number of plans to return from the end of the range.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + /** + *

A cursor; returns plans before this position.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, _FinalStage { + private String accountId; + + private Optional before = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional> productIds = Optional.empty(); + + private Optional> planTypes = Optional.empty(); + + private Optional> visibilities = Optional.empty(); + + private Optional> releaseMethods = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPlansRequest other) { + releaseMethods(other.getReleaseMethods()); + visibilities(other.getVisibilities()); + planTypes(other.getPlanTypes()); + productIds(other.getProductIds()); + accountId(other.getAccountId()); + direction(other.getDirection()); + order(other.getOrder()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

The unique identifier of the account to list plans for.

+ *

The unique identifier of the account to list plans for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

A cursor; returns plans before this position.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

A cursor; returns plans before this position.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

The number of plans to return from the end of the range.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The number of plans to return from the end of the range.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

A cursor; returns plans after this position.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

A cursor; returns plans after this position.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + /** + *

The number of plans to return (default and max 100).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

The number of plans to return (default and max 100).

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Only return plans created after this timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only return plans created after this timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public _FinalStage createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + /** + *

Only return plans created before this timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return plans created before this timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public _FinalStage createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + /** + *

The field to sort results by. Defaults to created_at.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(ListPlansRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The field to sort results by. Defaults to created_at.

+ */ + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + /** + *

The sort direction for results. Defaults to descending.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage direction(ListPlansRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

The sort direction for results. Defaults to descending.

+ */ + @java.lang.Override + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public _FinalStage direction(Optional direction) { + this.direction = direction; + return this; + } + + @java.lang.Override + public _FinalStage productIds(String productIds) { + this.productIds = Optional.of(Collections.singletonList(productIds)); + return this; + } + + /** + *

Filter to only plans belonging to these product identifiers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productIds(List productIds) { + this.productIds = Optional.ofNullable(productIds); + return this; + } + + /** + *

Filter to only plans belonging to these product identifiers.

+ */ + @java.lang.Override + @JsonSetter(value = "product_ids", nulls = Nulls.SKIP) + public _FinalStage productIds(Optional> productIds) { + this.productIds = productIds; + return this; + } + + @java.lang.Override + public _FinalStage planTypes(String planTypes) { + this.planTypes = Optional.of(Collections.singletonList(planTypes)); + return this; + } + + /** + *

Filter to only plans matching these billing types.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planTypes(List planTypes) { + this.planTypes = Optional.ofNullable(planTypes); + return this; + } + + /** + *

Filter to only plans matching these billing types.

+ */ + @java.lang.Override + @JsonSetter(value = "plan_types", nulls = Nulls.SKIP) + public _FinalStage planTypes(Optional> planTypes) { + this.planTypes = planTypes; + return this; + } + + @java.lang.Override + public _FinalStage visibilities(String visibilities) { + this.visibilities = Optional.of(Collections.singletonList(visibilities)); + return this; + } + + /** + *

Filter to only plans matching these visibility states.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibilities(List visibilities) { + this.visibilities = Optional.ofNullable(visibilities); + return this; + } + + /** + *

Filter to only plans matching these visibility states.

+ */ + @java.lang.Override + @JsonSetter(value = "visibilities", nulls = Nulls.SKIP) + public _FinalStage visibilities(Optional> visibilities) { + this.visibilities = visibilities; + return this; + } + + @java.lang.Override + public _FinalStage releaseMethods(String releaseMethods) { + this.releaseMethods = Optional.of(Collections.singletonList(releaseMethods)); + return this; + } + + /** + *

Filter to only plans matching these release methods.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage releaseMethods(List releaseMethods) { + this.releaseMethods = Optional.ofNullable(releaseMethods); + return this; + } + + /** + *

Filter to only plans matching these release methods.

+ */ + @java.lang.Override + @JsonSetter(value = "release_methods", nulls = Nulls.SKIP) + public _FinalStage releaseMethods(Optional> releaseMethods) { + this.releaseMethods = releaseMethods; + return this; + } + + @java.lang.Override + public ListPlansRequest build() { + return new ListPlansRequest( + releaseMethods, + visibilities, + planTypes, + productIds, + accountId, + direction, + order, + createdBefore, + createdAfter, + first, + after, + last, + before, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/requests/RetrievePlansRequest.java b/src/main/java/com/whop/api/resources/plans/requests/RetrievePlansRequest.java new file mode 100644 index 00000000..c52476c8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/requests/RetrievePlansRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePlansRequest.Builder.class) +public final class RetrievePlansRequest { + private final Map additionalProperties; + + private RetrievePlansRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePlansRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePlansRequest other) { + return this; + } + + public RetrievePlansRequest build() { + return new RetrievePlansRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/requests/UpdatePlansRequest.java b/src/main/java/com/whop/api/resources/plans/requests/UpdatePlansRequest.java new file mode 100644 index 00000000..5cd9c06a --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/requests/UpdatePlansRequest.java @@ -0,0 +1,1367 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.plans.types.UpdatePlansRequestCustomFieldsItem; +import com.whop.api.resources.plans.types.UpdatePlansRequestImage; +import com.whop.api.resources.plans.types.UpdatePlansRequestPaymentMethodConfiguration; +import com.whop.api.resources.plans.types.UpdatePlansRequestThreeDsLevel; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePlansRequest.Builder.class) +public final class UpdatePlansRequest { + private final Optional adaptivePricingEnabled; + + private final Optional billingPeriod; + + private final Optional cancelDiscountIntervals; + + private final Optional cancelDiscountPercentage; + + private final Optional> checkoutStyling; + + private final Optional currency; + + private final Optional> customFields; + + private final Optional description; + + private final Optional expirationDays; + + private final Optional image; + + private final Optional initialPrice; + + private final Optional internalNotes; + + private final Optional> metadata; + + private final Optional offerCancelDiscount; + + private final Optional overrideTaxType; + + private final Optional paymentMethodConfiguration; + + private final Optional releaseMethod; + + private final Optional renewalPrice; + + private final Optional stock; + + private final Optional strikeThroughInitialPrice; + + private final Optional strikeThroughRenewalPrice; + + private final Optional threeDsLevel; + + private final Optional title; + + private final Optional trialPeriodDays; + + private final Optional unlimitedStock; + + private final Optional visibility; + + private final Map additionalProperties; + + private UpdatePlansRequest( + Optional adaptivePricingEnabled, + Optional billingPeriod, + Optional cancelDiscountIntervals, + Optional cancelDiscountPercentage, + Optional> checkoutStyling, + Optional currency, + Optional> customFields, + Optional description, + Optional expirationDays, + Optional image, + Optional initialPrice, + Optional internalNotes, + Optional> metadata, + Optional offerCancelDiscount, + Optional overrideTaxType, + Optional paymentMethodConfiguration, + Optional releaseMethod, + Optional renewalPrice, + Optional stock, + Optional strikeThroughInitialPrice, + Optional strikeThroughRenewalPrice, + Optional threeDsLevel, + Optional title, + Optional trialPeriodDays, + Optional unlimitedStock, + Optional visibility, + Map additionalProperties) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + this.billingPeriod = billingPeriod; + this.cancelDiscountIntervals = cancelDiscountIntervals; + this.cancelDiscountPercentage = cancelDiscountPercentage; + this.checkoutStyling = checkoutStyling; + this.currency = currency; + this.customFields = customFields; + this.description = description; + this.expirationDays = expirationDays; + this.image = image; + this.initialPrice = initialPrice; + this.internalNotes = internalNotes; + this.metadata = metadata; + this.offerCancelDiscount = offerCancelDiscount; + this.overrideTaxType = overrideTaxType; + this.paymentMethodConfiguration = paymentMethodConfiguration; + this.releaseMethod = releaseMethod; + this.renewalPrice = renewalPrice; + this.stock = stock; + this.strikeThroughInitialPrice = strikeThroughInitialPrice; + this.strikeThroughRenewalPrice = strikeThroughRenewalPrice; + this.threeDsLevel = threeDsLevel; + this.title = title; + this.trialPeriodDays = trialPeriodDays; + this.unlimitedStock = unlimitedStock; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether this plan accepts local currency payments via adaptive pricing. + */ + @JsonIgnore + public Optional getAdaptivePricingEnabled() { + if (adaptivePricingEnabled == null) { + return Optional.empty(); + } + return adaptivePricingEnabled; + } + + /** + * @return Recurring billing interval in days, such as 30 for monthly or 365 for annual. + */ + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + /** + * @return How many renewals the retention discount applies to. Required when offer_cancel_discount is true. + */ + @JsonIgnore + public Optional getCancelDiscountIntervals() { + if (cancelDiscountIntervals == null) { + return Optional.empty(); + } + return cancelDiscountIntervals; + } + + /** + * @return Percentage taken off each discounted renewal. Required when offer_cancel_discount is true. + */ + @JsonIgnore + public Optional getCancelDiscountPercentage() { + if (cancelDiscountPercentage == null) { + return Optional.empty(); + } + return cancelDiscountPercentage; + } + + /** + * @return Checkout styling overrides for this plan. + */ + @JsonIgnore + public Optional> getCheckoutStyling() { + if (checkoutStyling == null) { + return Optional.empty(); + } + return checkoutStyling; + } + + /** + * @return The three-letter ISO currency code for the plan's pricing. Defaults to USD. + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + /** + * @return An array of custom field definitions to collect from customers at checkout. Omitting this field clears existing custom fields. + */ + @JsonIgnore + public Optional> getCustomFields() { + if (customFields == null) { + return Optional.empty(); + } + return customFields; + } + + /** + * @return A text description of the plan displayed to customers on the product page. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return Access duration in days before the membership expires. + */ + @JsonIgnore + public Optional getExpirationDays() { + if (expirationDays == null) { + return Optional.empty(); + } + return expirationDays; + } + + /** + * @return An image displayed on the product page to represent this plan. + */ + @JsonIgnore + public Optional getImage() { + if (image == null) { + return Optional.empty(); + } + return image; + } + + /** + * @return Initial amount charged in the plan's currency, e.g. 10.43 for $10.43. + */ + @JsonIgnore + public Optional getInitialPrice() { + if (initialPrice == null) { + return Optional.empty(); + } + return initialPrice; + } + + /** + * @return Private notes visible only to the account owner. Not shown to customers. + */ + @JsonIgnore + public Optional getInternalNotes() { + if (internalNotes == null) { + return Optional.empty(); + } + return internalNotes; + } + + /** + * @return Custom key-value pairs to store on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta (a checkout call-to-action button label — one of the product custom CTA values, e.g. subscribe, get_offer) and custom_cta_url (a URL the button links to; web or tel:) override the product's call to action for this plan and are validated on save. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Whether to offer a retention discount when a customer attempts to cancel. + */ + @JsonIgnore + public Optional getOfferCancelDiscount() { + if (offerCancelDiscount == null) { + return Optional.empty(); + } + return offerCancelDiscount; + } + + /** + * @return Override the default tax classification for this specific plan. + */ + @JsonProperty("override_tax_type") + public Optional getOverrideTaxType() { + return overrideTaxType; + } + + /** + * @return Explicit payment method configuration for the plan. When not provided, the account's defaults apply. + */ + @JsonIgnore + public Optional getPaymentMethodConfiguration() { + if (paymentMethodConfiguration == null) { + return Optional.empty(); + } + return paymentMethodConfiguration; + } + + /** + * @return Sales method for this plan. + */ + @JsonProperty("release_method") + public Optional getReleaseMethod() { + return releaseMethod; + } + + /** + * @return The amount charged each billing period for recurring plans, in the plan's currency. + */ + @JsonIgnore + public Optional getRenewalPrice() { + if (renewalPrice == null) { + return Optional.empty(); + } + return renewalPrice; + } + + /** + * @return The maximum number of units available for purchase. Ignored when unlimited_stock is true. + */ + @JsonIgnore + public Optional getStock() { + if (stock == null) { + return Optional.empty(); + } + return stock; + } + + /** + * @return A comparison price displayed with a strikethrough for the initial price. + */ + @JsonIgnore + public Optional getStrikeThroughInitialPrice() { + if (strikeThroughInitialPrice == null) { + return Optional.empty(); + } + return strikeThroughInitialPrice; + } + + /** + * @return A comparison price displayed with a strikethrough for the renewal price. + */ + @JsonIgnore + public Optional getStrikeThroughRenewalPrice() { + if (strikeThroughRenewalPrice == null) { + return Optional.empty(); + } + return strikeThroughRenewalPrice; + } + + /** + * @return 3D Secure behavior for this plan. Send null to inherit the account default. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return The display name of the plan shown to customers on the product page. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return Free trial duration before the first recurring charge. + */ + @JsonIgnore + public Optional getTrialPeriodDays() { + if (trialPeriodDays == null) { + return Optional.empty(); + } + return trialPeriodDays; + } + + /** + * @return Whether the plan has unlimited stock. When true, the stock field is ignored. + */ + @JsonIgnore + public Optional getUnlimitedStock() { + if (unlimitedStock == null) { + return Optional.empty(); + } + return unlimitedStock; + } + + /** + * @return Whether the plan is visible to customers or hidden from public view. + */ + @JsonProperty("visibility") + public Optional getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("adaptive_pricing_enabled") + private Optional _getAdaptivePricingEnabled() { + return adaptivePricingEnabled; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancel_discount_intervals") + private Optional _getCancelDiscountIntervals() { + return cancelDiscountIntervals; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancel_discount_percentage") + private Optional _getCancelDiscountPercentage() { + return cancelDiscountPercentage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_styling") + private Optional> _getCheckoutStyling() { + return checkoutStyling; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_fields") + private Optional> _getCustomFields() { + return customFields; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_days") + private Optional _getExpirationDays() { + return expirationDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("image") + private Optional _getImage() { + return image; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("initial_price") + private Optional _getInitialPrice() { + return initialPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("internal_notes") + private Optional _getInternalNotes() { + return internalNotes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("offer_cancel_discount") + private Optional _getOfferCancelDiscount() { + return offerCancelDiscount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_configuration") + private Optional _getPaymentMethodConfiguration() { + return paymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("renewal_price") + private Optional _getRenewalPrice() { + return renewalPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("stock") + private Optional _getStock() { + return stock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("strike_through_initial_price") + private Optional _getStrikeThroughInitialPrice() { + return strikeThroughInitialPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("strike_through_renewal_price") + private Optional _getStrikeThroughRenewalPrice() { + return strikeThroughRenewalPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trial_period_days") + private Optional _getTrialPeriodDays() { + return trialPeriodDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("unlimited_stock") + private Optional _getUnlimitedStock() { + return unlimitedStock; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePlansRequest && equalTo((UpdatePlansRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePlansRequest other) { + return adaptivePricingEnabled.equals(other.adaptivePricingEnabled) + && billingPeriod.equals(other.billingPeriod) + && cancelDiscountIntervals.equals(other.cancelDiscountIntervals) + && cancelDiscountPercentage.equals(other.cancelDiscountPercentage) + && checkoutStyling.equals(other.checkoutStyling) + && currency.equals(other.currency) + && customFields.equals(other.customFields) + && description.equals(other.description) + && expirationDays.equals(other.expirationDays) + && image.equals(other.image) + && initialPrice.equals(other.initialPrice) + && internalNotes.equals(other.internalNotes) + && metadata.equals(other.metadata) + && offerCancelDiscount.equals(other.offerCancelDiscount) + && overrideTaxType.equals(other.overrideTaxType) + && paymentMethodConfiguration.equals(other.paymentMethodConfiguration) + && releaseMethod.equals(other.releaseMethod) + && renewalPrice.equals(other.renewalPrice) + && stock.equals(other.stock) + && strikeThroughInitialPrice.equals(other.strikeThroughInitialPrice) + && strikeThroughRenewalPrice.equals(other.strikeThroughRenewalPrice) + && threeDsLevel.equals(other.threeDsLevel) + && title.equals(other.title) + && trialPeriodDays.equals(other.trialPeriodDays) + && unlimitedStock.equals(other.unlimitedStock) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adaptivePricingEnabled, + this.billingPeriod, + this.cancelDiscountIntervals, + this.cancelDiscountPercentage, + this.checkoutStyling, + this.currency, + this.customFields, + this.description, + this.expirationDays, + this.image, + this.initialPrice, + this.internalNotes, + this.metadata, + this.offerCancelDiscount, + this.overrideTaxType, + this.paymentMethodConfiguration, + this.releaseMethod, + this.renewalPrice, + this.stock, + this.strikeThroughInitialPrice, + this.strikeThroughRenewalPrice, + this.threeDsLevel, + this.title, + this.trialPeriodDays, + this.unlimitedStock, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional adaptivePricingEnabled = Optional.empty(); + + private Optional billingPeriod = Optional.empty(); + + private Optional cancelDiscountIntervals = Optional.empty(); + + private Optional cancelDiscountPercentage = Optional.empty(); + + private Optional> checkoutStyling = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional> customFields = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional expirationDays = Optional.empty(); + + private Optional image = Optional.empty(); + + private Optional initialPrice = Optional.empty(); + + private Optional internalNotes = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional offerCancelDiscount = Optional.empty(); + + private Optional overrideTaxType = Optional.empty(); + + private Optional paymentMethodConfiguration = Optional.empty(); + + private Optional releaseMethod = Optional.empty(); + + private Optional renewalPrice = Optional.empty(); + + private Optional stock = Optional.empty(); + + private Optional strikeThroughInitialPrice = Optional.empty(); + + private Optional strikeThroughRenewalPrice = Optional.empty(); + + private Optional threeDsLevel = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional trialPeriodDays = Optional.empty(); + + private Optional unlimitedStock = Optional.empty(); + + private Optional visibility = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdatePlansRequest other) { + adaptivePricingEnabled(other.getAdaptivePricingEnabled()); + billingPeriod(other.getBillingPeriod()); + cancelDiscountIntervals(other.getCancelDiscountIntervals()); + cancelDiscountPercentage(other.getCancelDiscountPercentage()); + checkoutStyling(other.getCheckoutStyling()); + currency(other.getCurrency()); + customFields(other.getCustomFields()); + description(other.getDescription()); + expirationDays(other.getExpirationDays()); + image(other.getImage()); + initialPrice(other.getInitialPrice()); + internalNotes(other.getInternalNotes()); + metadata(other.getMetadata()); + offerCancelDiscount(other.getOfferCancelDiscount()); + overrideTaxType(other.getOverrideTaxType()); + paymentMethodConfiguration(other.getPaymentMethodConfiguration()); + releaseMethod(other.getReleaseMethod()); + renewalPrice(other.getRenewalPrice()); + stock(other.getStock()); + strikeThroughInitialPrice(other.getStrikeThroughInitialPrice()); + strikeThroughRenewalPrice(other.getStrikeThroughRenewalPrice()); + threeDsLevel(other.getThreeDsLevel()); + title(other.getTitle()); + trialPeriodDays(other.getTrialPeriodDays()); + unlimitedStock(other.getUnlimitedStock()); + visibility(other.getVisibility()); + return this; + } + + /** + *

Whether this plan accepts local currency payments via adaptive pricing.

+ */ + @JsonSetter(value = "adaptive_pricing_enabled", nulls = Nulls.SKIP) + public Builder adaptivePricingEnabled(Optional adaptivePricingEnabled) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + return this; + } + + public Builder adaptivePricingEnabled(Boolean adaptivePricingEnabled) { + this.adaptivePricingEnabled = Optional.ofNullable(adaptivePricingEnabled); + return this; + } + + public Builder adaptivePricingEnabled(Nullable adaptivePricingEnabled) { + if (adaptivePricingEnabled.isNull()) { + this.adaptivePricingEnabled = null; + } else if (adaptivePricingEnabled.isEmpty()) { + this.adaptivePricingEnabled = Optional.empty(); + } else { + this.adaptivePricingEnabled = Optional.of(adaptivePricingEnabled.get()); + } + return this; + } + + /** + *

Recurring billing interval in days, such as 30 for monthly or 365 for annual.

+ */ + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public Builder billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + public Builder billingPeriod(Integer billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + public Builder billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + /** + *

How many renewals the retention discount applies to. Required when offer_cancel_discount is true.

+ */ + @JsonSetter(value = "cancel_discount_intervals", nulls = Nulls.SKIP) + public Builder cancelDiscountIntervals(Optional cancelDiscountIntervals) { + this.cancelDiscountIntervals = cancelDiscountIntervals; + return this; + } + + public Builder cancelDiscountIntervals(Integer cancelDiscountIntervals) { + this.cancelDiscountIntervals = Optional.ofNullable(cancelDiscountIntervals); + return this; + } + + public Builder cancelDiscountIntervals(Nullable cancelDiscountIntervals) { + if (cancelDiscountIntervals.isNull()) { + this.cancelDiscountIntervals = null; + } else if (cancelDiscountIntervals.isEmpty()) { + this.cancelDiscountIntervals = Optional.empty(); + } else { + this.cancelDiscountIntervals = Optional.of(cancelDiscountIntervals.get()); + } + return this; + } + + /** + *

Percentage taken off each discounted renewal. Required when offer_cancel_discount is true.

+ */ + @JsonSetter(value = "cancel_discount_percentage", nulls = Nulls.SKIP) + public Builder cancelDiscountPercentage(Optional cancelDiscountPercentage) { + this.cancelDiscountPercentage = cancelDiscountPercentage; + return this; + } + + public Builder cancelDiscountPercentage(Integer cancelDiscountPercentage) { + this.cancelDiscountPercentage = Optional.ofNullable(cancelDiscountPercentage); + return this; + } + + public Builder cancelDiscountPercentage(Nullable cancelDiscountPercentage) { + if (cancelDiscountPercentage.isNull()) { + this.cancelDiscountPercentage = null; + } else if (cancelDiscountPercentage.isEmpty()) { + this.cancelDiscountPercentage = Optional.empty(); + } else { + this.cancelDiscountPercentage = Optional.of(cancelDiscountPercentage.get()); + } + return this; + } + + /** + *

Checkout styling overrides for this plan.

+ */ + @JsonSetter(value = "checkout_styling", nulls = Nulls.SKIP) + public Builder checkoutStyling(Optional> checkoutStyling) { + this.checkoutStyling = checkoutStyling; + return this; + } + + public Builder checkoutStyling(Map checkoutStyling) { + this.checkoutStyling = Optional.ofNullable(checkoutStyling); + return this; + } + + public Builder checkoutStyling(Nullable> checkoutStyling) { + if (checkoutStyling.isNull()) { + this.checkoutStyling = null; + } else if (checkoutStyling.isEmpty()) { + this.checkoutStyling = Optional.empty(); + } else { + this.checkoutStyling = Optional.of(checkoutStyling.get()); + } + return this; + } + + /** + *

The three-letter ISO currency code for the plan's pricing. Defaults to USD.

+ */ + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional currency) { + this.currency = currency; + return this; + } + + public Builder currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

An array of custom field definitions to collect from customers at checkout. Omitting this field clears existing custom fields.

+ */ + @JsonSetter(value = "custom_fields", nulls = Nulls.SKIP) + public Builder customFields(Optional> customFields) { + this.customFields = customFields; + return this; + } + + public Builder customFields(List customFields) { + this.customFields = Optional.ofNullable(customFields); + return this; + } + + public Builder customFields(Nullable> customFields) { + if (customFields.isNull()) { + this.customFields = null; + } else if (customFields.isEmpty()) { + this.customFields = Optional.empty(); + } else { + this.customFields = Optional.of(customFields.get()); + } + return this; + } + + /** + *

A text description of the plan displayed to customers on the product page.

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public Builder description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

Access duration in days before the membership expires.

+ */ + @JsonSetter(value = "expiration_days", nulls = Nulls.SKIP) + public Builder expirationDays(Optional expirationDays) { + this.expirationDays = expirationDays; + return this; + } + + public Builder expirationDays(Integer expirationDays) { + this.expirationDays = Optional.ofNullable(expirationDays); + return this; + } + + public Builder expirationDays(Nullable expirationDays) { + if (expirationDays.isNull()) { + this.expirationDays = null; + } else if (expirationDays.isEmpty()) { + this.expirationDays = Optional.empty(); + } else { + this.expirationDays = Optional.of(expirationDays.get()); + } + return this; + } + + /** + *

An image displayed on the product page to represent this plan.

+ */ + @JsonSetter(value = "image", nulls = Nulls.SKIP) + public Builder image(Optional image) { + this.image = image; + return this; + } + + public Builder image(UpdatePlansRequestImage image) { + this.image = Optional.ofNullable(image); + return this; + } + + public Builder image(Nullable image) { + if (image.isNull()) { + this.image = null; + } else if (image.isEmpty()) { + this.image = Optional.empty(); + } else { + this.image = Optional.of(image.get()); + } + return this; + } + + /** + *

Initial amount charged in the plan's currency, e.g. 10.43 for $10.43.

+ */ + @JsonSetter(value = "initial_price", nulls = Nulls.SKIP) + public Builder initialPrice(Optional initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + public Builder initialPrice(Double initialPrice) { + this.initialPrice = Optional.ofNullable(initialPrice); + return this; + } + + public Builder initialPrice(Nullable initialPrice) { + if (initialPrice.isNull()) { + this.initialPrice = null; + } else if (initialPrice.isEmpty()) { + this.initialPrice = Optional.empty(); + } else { + this.initialPrice = Optional.of(initialPrice.get()); + } + return this; + } + + /** + *

Private notes visible only to the account owner. Not shown to customers.

+ */ + @JsonSetter(value = "internal_notes", nulls = Nulls.SKIP) + public Builder internalNotes(Optional internalNotes) { + this.internalNotes = internalNotes; + return this; + } + + public Builder internalNotes(String internalNotes) { + this.internalNotes = Optional.ofNullable(internalNotes); + return this; + } + + public Builder internalNotes(Nullable internalNotes) { + if (internalNotes.isNull()) { + this.internalNotes = null; + } else if (internalNotes.isEmpty()) { + this.internalNotes = Optional.empty(); + } else { + this.internalNotes = Optional.of(internalNotes.get()); + } + return this; + } + + /** + *

Custom key-value pairs to store on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta (a checkout call-to-action button label — one of the product custom CTA values, e.g. subscribe, get_offer) and custom_cta_url (a URL the button links to; web or tel:) override the product's call to action for this plan and are validated on save.

+ */ + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + public Builder metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Whether to offer a retention discount when a customer attempts to cancel.

+ */ + @JsonSetter(value = "offer_cancel_discount", nulls = Nulls.SKIP) + public Builder offerCancelDiscount(Optional offerCancelDiscount) { + this.offerCancelDiscount = offerCancelDiscount; + return this; + } + + public Builder offerCancelDiscount(Boolean offerCancelDiscount) { + this.offerCancelDiscount = Optional.ofNullable(offerCancelDiscount); + return this; + } + + public Builder offerCancelDiscount(Nullable offerCancelDiscount) { + if (offerCancelDiscount.isNull()) { + this.offerCancelDiscount = null; + } else if (offerCancelDiscount.isEmpty()) { + this.offerCancelDiscount = Optional.empty(); + } else { + this.offerCancelDiscount = Optional.of(offerCancelDiscount.get()); + } + return this; + } + + /** + *

Override the default tax classification for this specific plan.

+ */ + @JsonSetter(value = "override_tax_type", nulls = Nulls.SKIP) + public Builder overrideTaxType(Optional overrideTaxType) { + this.overrideTaxType = overrideTaxType; + return this; + } + + public Builder overrideTaxType(String overrideTaxType) { + this.overrideTaxType = Optional.ofNullable(overrideTaxType); + return this; + } + + /** + *

Explicit payment method configuration for the plan. When not provided, the account's defaults apply.

+ */ + @JsonSetter(value = "payment_method_configuration", nulls = Nulls.SKIP) + public Builder paymentMethodConfiguration( + Optional paymentMethodConfiguration) { + this.paymentMethodConfiguration = paymentMethodConfiguration; + return this; + } + + public Builder paymentMethodConfiguration( + UpdatePlansRequestPaymentMethodConfiguration paymentMethodConfiguration) { + this.paymentMethodConfiguration = Optional.ofNullable(paymentMethodConfiguration); + return this; + } + + public Builder paymentMethodConfiguration( + Nullable paymentMethodConfiguration) { + if (paymentMethodConfiguration.isNull()) { + this.paymentMethodConfiguration = null; + } else if (paymentMethodConfiguration.isEmpty()) { + this.paymentMethodConfiguration = Optional.empty(); + } else { + this.paymentMethodConfiguration = Optional.of(paymentMethodConfiguration.get()); + } + return this; + } + + /** + *

Sales method for this plan.

+ */ + @JsonSetter(value = "release_method", nulls = Nulls.SKIP) + public Builder releaseMethod(Optional releaseMethod) { + this.releaseMethod = releaseMethod; + return this; + } + + public Builder releaseMethod(String releaseMethod) { + this.releaseMethod = Optional.ofNullable(releaseMethod); + return this; + } + + /** + *

The amount charged each billing period for recurring plans, in the plan's currency.

+ */ + @JsonSetter(value = "renewal_price", nulls = Nulls.SKIP) + public Builder renewalPrice(Optional renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + public Builder renewalPrice(Double renewalPrice) { + this.renewalPrice = Optional.ofNullable(renewalPrice); + return this; + } + + public Builder renewalPrice(Nullable renewalPrice) { + if (renewalPrice.isNull()) { + this.renewalPrice = null; + } else if (renewalPrice.isEmpty()) { + this.renewalPrice = Optional.empty(); + } else { + this.renewalPrice = Optional.of(renewalPrice.get()); + } + return this; + } + + /** + *

The maximum number of units available for purchase. Ignored when unlimited_stock is true.

+ */ + @JsonSetter(value = "stock", nulls = Nulls.SKIP) + public Builder stock(Optional stock) { + this.stock = stock; + return this; + } + + public Builder stock(Integer stock) { + this.stock = Optional.ofNullable(stock); + return this; + } + + public Builder stock(Nullable stock) { + if (stock.isNull()) { + this.stock = null; + } else if (stock.isEmpty()) { + this.stock = Optional.empty(); + } else { + this.stock = Optional.of(stock.get()); + } + return this; + } + + /** + *

A comparison price displayed with a strikethrough for the initial price.

+ */ + @JsonSetter(value = "strike_through_initial_price", nulls = Nulls.SKIP) + public Builder strikeThroughInitialPrice(Optional strikeThroughInitialPrice) { + this.strikeThroughInitialPrice = strikeThroughInitialPrice; + return this; + } + + public Builder strikeThroughInitialPrice(Double strikeThroughInitialPrice) { + this.strikeThroughInitialPrice = Optional.ofNullable(strikeThroughInitialPrice); + return this; + } + + public Builder strikeThroughInitialPrice(Nullable strikeThroughInitialPrice) { + if (strikeThroughInitialPrice.isNull()) { + this.strikeThroughInitialPrice = null; + } else if (strikeThroughInitialPrice.isEmpty()) { + this.strikeThroughInitialPrice = Optional.empty(); + } else { + this.strikeThroughInitialPrice = Optional.of(strikeThroughInitialPrice.get()); + } + return this; + } + + /** + *

A comparison price displayed with a strikethrough for the renewal price.

+ */ + @JsonSetter(value = "strike_through_renewal_price", nulls = Nulls.SKIP) + public Builder strikeThroughRenewalPrice(Optional strikeThroughRenewalPrice) { + this.strikeThroughRenewalPrice = strikeThroughRenewalPrice; + return this; + } + + public Builder strikeThroughRenewalPrice(Double strikeThroughRenewalPrice) { + this.strikeThroughRenewalPrice = Optional.ofNullable(strikeThroughRenewalPrice); + return this; + } + + public Builder strikeThroughRenewalPrice(Nullable strikeThroughRenewalPrice) { + if (strikeThroughRenewalPrice.isNull()) { + this.strikeThroughRenewalPrice = null; + } else if (strikeThroughRenewalPrice.isEmpty()) { + this.strikeThroughRenewalPrice = Optional.empty(); + } else { + this.strikeThroughRenewalPrice = Optional.of(strikeThroughRenewalPrice.get()); + } + return this; + } + + /** + *

3D Secure behavior for this plan. Send null to inherit the account default.

+ */ + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public Builder threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + public Builder threeDsLevel(UpdatePlansRequestThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + public Builder threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

The display name of the plan shown to customers on the product page.

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Free trial duration before the first recurring charge.

+ */ + @JsonSetter(value = "trial_period_days", nulls = Nulls.SKIP) + public Builder trialPeriodDays(Optional trialPeriodDays) { + this.trialPeriodDays = trialPeriodDays; + return this; + } + + public Builder trialPeriodDays(Integer trialPeriodDays) { + this.trialPeriodDays = Optional.ofNullable(trialPeriodDays); + return this; + } + + public Builder trialPeriodDays(Nullable trialPeriodDays) { + if (trialPeriodDays.isNull()) { + this.trialPeriodDays = null; + } else if (trialPeriodDays.isEmpty()) { + this.trialPeriodDays = Optional.empty(); + } else { + this.trialPeriodDays = Optional.of(trialPeriodDays.get()); + } + return this; + } + + /** + *

Whether the plan has unlimited stock. When true, the stock field is ignored.

+ */ + @JsonSetter(value = "unlimited_stock", nulls = Nulls.SKIP) + public Builder unlimitedStock(Optional unlimitedStock) { + this.unlimitedStock = unlimitedStock; + return this; + } + + public Builder unlimitedStock(Boolean unlimitedStock) { + this.unlimitedStock = Optional.ofNullable(unlimitedStock); + return this; + } + + public Builder unlimitedStock(Nullable unlimitedStock) { + if (unlimitedStock.isNull()) { + this.unlimitedStock = null; + } else if (unlimitedStock.isEmpty()) { + this.unlimitedStock = Optional.empty(); + } else { + this.unlimitedStock = Optional.of(unlimitedStock.get()); + } + return this; + } + + /** + *

Whether the plan is visible to customers or hidden from public view.

+ */ + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public Builder visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + public Builder visibility(String visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + public UpdatePlansRequest build() { + return new UpdatePlansRequest( + adaptivePricingEnabled, + billingPeriod, + cancelDiscountIntervals, + cancelDiscountPercentage, + checkoutStyling, + currency, + customFields, + description, + expirationDays, + image, + initialPrice, + internalNotes, + metadata, + offerCancelDiscount, + overrideTaxType, + paymentMethodConfiguration, + releaseMethod, + renewalPrice, + stock, + strikeThroughInitialPrice, + strikeThroughRenewalPrice, + threeDsLevel, + title, + trialPeriodDays, + unlimitedStock, + visibility, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansRequestAddress.java b/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansRequestAddress.java new file mode 100644 index 00000000..52a0f7a4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansRequestAddress.java @@ -0,0 +1,487 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CalculateTaxPlansRequestAddress.Builder.class) +public final class CalculateTaxPlansRequestAddress { + private final Optional city; + + private final String country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private CalculateTaxPlansRequestAddress( + Optional city, + String country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return City name. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return ISO 3166-1 alpha-2 country code, such as US, DE, or GB. + */ + @JsonProperty("country") + public String getCountry() { + return country; + } + + /** + * @return First line of the street address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return Second line of the street address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Postal or ZIP code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return State, province, or region code, such as CA. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CalculateTaxPlansRequestAddress && equalTo((CalculateTaxPlansRequestAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CalculateTaxPlansRequestAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CountryStage builder() { + return new Builder(); + } + + public interface CountryStage { + /** + *

ISO 3166-1 alpha-2 country code, such as US, DE, or GB.

+ */ + _FinalStage country(@NotNull String country); + + Builder from(CalculateTaxPlansRequestAddress other); + } + + public interface _FinalStage { + CalculateTaxPlansRequestAddress build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

City name.

+ */ + _FinalStage city(Optional city); + + _FinalStage city(String city); + + _FinalStage city(Nullable city); + + /** + *

First line of the street address.

+ */ + _FinalStage line1(Optional line1); + + _FinalStage line1(String line1); + + _FinalStage line1(Nullable line1); + + /** + *

Second line of the street address.

+ */ + _FinalStage line2(Optional line2); + + _FinalStage line2(String line2); + + _FinalStage line2(Nullable line2); + + /** + *

Postal or ZIP code.

+ */ + _FinalStage postalCode(Optional postalCode); + + _FinalStage postalCode(String postalCode); + + _FinalStage postalCode(Nullable postalCode); + + /** + *

State, province, or region code, such as CA.

+ */ + _FinalStage state(Optional state); + + _FinalStage state(String state); + + _FinalStage state(Nullable state); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CountryStage, _FinalStage { + private String country; + + private Optional state = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional city = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CalculateTaxPlansRequestAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

ISO 3166-1 alpha-2 country code, such as US, DE, or GB.

+ *

ISO 3166-1 alpha-2 country code, such as US, DE, or GB.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("country") + public _FinalStage country(@NotNull String country) { + this.country = Objects.requireNonNull(country, "country must not be null"); + return this; + } + + /** + *

State, province, or region code, such as CA.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + /** + *

State, province, or region code, such as CA.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + /** + *

State, province, or region code, such as CA.

+ */ + @java.lang.Override + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public _FinalStage state(Optional state) { + this.state = state; + return this; + } + + /** + *

Postal or ZIP code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

Postal or ZIP code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + /** + *

Postal or ZIP code.

+ */ + @java.lang.Override + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public _FinalStage postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + *

Second line of the street address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Second line of the street address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + /** + *

Second line of the street address.

+ */ + @java.lang.Override + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public _FinalStage line2(Optional line2) { + this.line2 = line2; + return this; + } + + /** + *

First line of the street address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

First line of the street address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + /** + *

First line of the street address.

+ */ + @java.lang.Override + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public _FinalStage line1(Optional line1) { + this.line1 = line1; + return this; + } + + /** + *

City name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

City name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + /** + *

City name.

+ */ + @java.lang.Override + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public _FinalStage city(Optional city) { + this.city = city; + return this; + } + + @java.lang.Override + public CalculateTaxPlansRequestAddress build() { + return new CalculateTaxPlansRequestAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansRequestTaxIdsItem.java b/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansRequestTaxIdsItem.java new file mode 100644 index 00000000..72f39774 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansRequestTaxIdsItem.java @@ -0,0 +1,143 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CalculateTaxPlansRequestTaxIdsItem.Builder.class) +public final class CalculateTaxPlansRequestTaxIdsItem { + private final Optional type; + + private final Optional value; + + private final Map additionalProperties; + + private CalculateTaxPlansRequestTaxIdsItem( + Optional type, + Optional value, + Map additionalProperties) { + this.type = type; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return Tax ID type, such as eu_vat for an EU VAT number. + */ + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return Tax ID value, for example DE123456789. + */ + @JsonProperty("value") + public Optional getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CalculateTaxPlansRequestTaxIdsItem + && equalTo((CalculateTaxPlansRequestTaxIdsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CalculateTaxPlansRequestTaxIdsItem other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional value = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CalculateTaxPlansRequestTaxIdsItem other) { + type(other.getType()); + value(other.getValue()); + return this; + } + + /** + *

Tax ID type, such as eu_vat for an EU VAT number.

+ */ + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(CalculateTaxPlansRequestTaxIdsItemType type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

Tax ID value, for example DE123456789.

+ */ + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public Builder value(Optional value) { + this.value = value; + return this; + } + + public Builder value(String value) { + this.value = Optional.ofNullable(value); + return this; + } + + public CalculateTaxPlansRequestTaxIdsItem build() { + return new CalculateTaxPlansRequestTaxIdsItem(type, value, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansRequestTaxIdsItemType.java b/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansRequestTaxIdsItemType.java new file mode 100644 index 00000000..f5b466fa --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansRequestTaxIdsItemType.java @@ -0,0 +1,1285 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CalculateTaxPlansRequestTaxIdsItemType { + public static final CalculateTaxPlansRequestTaxIdsItemType TW_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.TW_VAT, "tw_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType VE_RIF = + new CalculateTaxPlansRequestTaxIdsItemType(Value.VE_RIF, "ve_rif"); + + public static final CalculateTaxPlansRequestTaxIdsItemType KR_BRN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.KR_BRN, "kr_brn"); + + public static final CalculateTaxPlansRequestTaxIdsItemType SN_NINEA = + new CalculateTaxPlansRequestTaxIdsItemType(Value.SN_NINEA, "sn_ninea"); + + public static final CalculateTaxPlansRequestTaxIdsItemType AU_ABN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.AU_ABN, "au_abn"); + + public static final CalculateTaxPlansRequestTaxIdsItemType MY_SST = + new CalculateTaxPlansRequestTaxIdsItemType(Value.MY_SST, "my_sst"); + + public static final CalculateTaxPlansRequestTaxIdsItemType EU_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.EU_VAT, "eu_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType IN_GST = + new CalculateTaxPlansRequestTaxIdsItemType(Value.IN_GST, "in_gst"); + + public static final CalculateTaxPlansRequestTaxIdsItemType CA_QST = + new CalculateTaxPlansRequestTaxIdsItemType(Value.CA_QST, "ca_qst"); + + public static final CalculateTaxPlansRequestTaxIdsItemType MA_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.MA_VAT, "ma_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType MK_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.MK_VAT, "mk_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType UA_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.UA_VAT, "ua_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType CN_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.CN_TIN, "cn_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType MX_RFC = + new CalculateTaxPlansRequestTaxIdsItemType(Value.MX_RFC, "mx_rfc"); + + public static final CalculateTaxPlansRequestTaxIdsItemType BY_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.BY_TIN, "by_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType CA_PST_BC = + new CalculateTaxPlansRequestTaxIdsItemType(Value.CA_PST_BC, "ca_pst_bc"); + + public static final CalculateTaxPlansRequestTaxIdsItemType ID_NPWP = + new CalculateTaxPlansRequestTaxIdsItemType(Value.ID_NPWP, "id_npwp"); + + public static final CalculateTaxPlansRequestTaxIdsItemType PH_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.PH_TIN, "ph_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType AE_TRN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.AE_TRN, "ae_trn"); + + public static final CalculateTaxPlansRequestTaxIdsItemType EC_RUC = + new CalculateTaxPlansRequestTaxIdsItemType(Value.EC_RUC, "ec_ruc"); + + public static final CalculateTaxPlansRequestTaxIdsItemType DE_STN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.DE_STN, "de_stn"); + + public static final CalculateTaxPlansRequestTaxIdsItemType US_EIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.US_EIN, "us_ein"); + + public static final CalculateTaxPlansRequestTaxIdsItemType CM_NIU = + new CalculateTaxPlansRequestTaxIdsItemType(Value.CM_NIU, "cm_niu"); + + public static final CalculateTaxPlansRequestTaxIdsItemType ET_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.ET_TIN, "et_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType IS_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.IS_VAT, "is_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType MY_FRP = + new CalculateTaxPlansRequestTaxIdsItemType(Value.MY_FRP, "my_frp"); + + public static final CalculateTaxPlansRequestTaxIdsItemType SG_UEN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.SG_UEN, "sg_uen"); + + public static final CalculateTaxPlansRequestTaxIdsItemType HU_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.HU_TIN, "hu_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType CO_NIT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.CO_NIT, "co_nit"); + + public static final CalculateTaxPlansRequestTaxIdsItemType JP_CN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.JP_CN, "jp_cn"); + + public static final CalculateTaxPlansRequestTaxIdsItemType MY_ITN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.MY_ITN, "my_itn"); + + public static final CalculateTaxPlansRequestTaxIdsItemType RU_KPP = + new CalculateTaxPlansRequestTaxIdsItemType(Value.RU_KPP, "ru_kpp"); + + public static final CalculateTaxPlansRequestTaxIdsItemType KE_PIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.KE_PIN, "ke_pin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType AR_CUIT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.AR_CUIT, "ar_cuit"); + + public static final CalculateTaxPlansRequestTaxIdsItemType PE_RUC = + new CalculateTaxPlansRequestTaxIdsItemType(Value.PE_RUC, "pe_ruc"); + + public static final CalculateTaxPlansRequestTaxIdsItemType CA_PST_MB = + new CalculateTaxPlansRequestTaxIdsItemType(Value.CA_PST_MB, "ca_pst_mb"); + + public static final CalculateTaxPlansRequestTaxIdsItemType AM_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.AM_TIN, "am_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType DO_RCN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.DO_RCN, "do_rcn"); + + public static final CalculateTaxPlansRequestTaxIdsItemType BB_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.BB_TIN, "bb_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType JP_TRN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.JP_TRN, "jp_trn"); + + public static final CalculateTaxPlansRequestTaxIdsItemType HK_BR = + new CalculateTaxPlansRequestTaxIdsItemType(Value.HK_BR, "hk_br"); + + public static final CalculateTaxPlansRequestTaxIdsItemType UZ_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.UZ_TIN, "uz_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType ME_PIB = + new CalculateTaxPlansRequestTaxIdsItemType(Value.ME_PIB, "me_pib"); + + public static final CalculateTaxPlansRequestTaxIdsItemType BS_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.BS_TIN, "bs_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType GN_NIF = + new CalculateTaxPlansRequestTaxIdsItemType(Value.GN_NIF, "gn_nif"); + + public static final CalculateTaxPlansRequestTaxIdsItemType KH_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.KH_TIN, "kh_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType CD_NIF = + new CalculateTaxPlansRequestTaxIdsItemType(Value.CD_NIF, "cd_nif"); + + public static final CalculateTaxPlansRequestTaxIdsItemType NZ_GST = + new CalculateTaxPlansRequestTaxIdsItemType(Value.NZ_GST, "nz_gst"); + + public static final CalculateTaxPlansRequestTaxIdsItemType TH_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.TH_VAT, "th_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType JP_RN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.JP_RN, "jp_rn"); + + public static final CalculateTaxPlansRequestTaxIdsItemType RU_INN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.RU_INN, "ru_inn"); + + public static final CalculateTaxPlansRequestTaxIdsItemType SG_GST = + new CalculateTaxPlansRequestTaxIdsItemType(Value.SG_GST, "sg_gst"); + + public static final CalculateTaxPlansRequestTaxIdsItemType NO_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.NO_VAT, "no_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType BA_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.BA_TIN, "ba_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType KZ_BIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.KZ_BIN, "kz_bin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType AL_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.AL_TIN, "al_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType EG_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.EG_TIN, "eg_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType NP_PAN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.NP_PAN, "np_pan"); + + public static final CalculateTaxPlansRequestTaxIdsItemType CH_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.CH_VAT, "ch_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType NO_VOEC = + new CalculateTaxPlansRequestTaxIdsItemType(Value.NO_VOEC, "no_voec"); + + public static final CalculateTaxPlansRequestTaxIdsItemType UZ_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.UZ_VAT, "uz_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType SR_FIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.SR_FIN, "sr_fin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType BG_UIC = + new CalculateTaxPlansRequestTaxIdsItemType(Value.BG_UIC, "bg_uic"); + + public static final CalculateTaxPlansRequestTaxIdsItemType AU_ARN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.AU_ARN, "au_arn"); + + public static final CalculateTaxPlansRequestTaxIdsItemType BR_CNPJ = + new CalculateTaxPlansRequestTaxIdsItemType(Value.BR_CNPJ, "br_cnpj"); + + public static final CalculateTaxPlansRequestTaxIdsItemType UG_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.UG_TIN, "ug_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType CA_PST_SK = + new CalculateTaxPlansRequestTaxIdsItemType(Value.CA_PST_SK, "ca_pst_sk"); + + public static final CalculateTaxPlansRequestTaxIdsItemType OM_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.OM_VAT, "om_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType BR_CPF = + new CalculateTaxPlansRequestTaxIdsItemType(Value.BR_CPF, "br_cpf"); + + public static final CalculateTaxPlansRequestTaxIdsItemType MR_NIF = + new CalculateTaxPlansRequestTaxIdsItemType(Value.MR_NIF, "mr_nif"); + + public static final CalculateTaxPlansRequestTaxIdsItemType TR_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.TR_TIN, "tr_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType BJ_IFU = + new CalculateTaxPlansRequestTaxIdsItemType(Value.BJ_IFU, "bj_ifu"); + + public static final CalculateTaxPlansRequestTaxIdsItemType ZW_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.ZW_TIN, "zw_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType LI_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.LI_VAT, "li_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType ZM_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.ZM_TIN, "zm_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType SI_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.SI_TIN, "si_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType CV_NIF = + new CalculateTaxPlansRequestTaxIdsItemType(Value.CV_NIF, "cv_nif"); + + public static final CalculateTaxPlansRequestTaxIdsItemType LI_UID = + new CalculateTaxPlansRequestTaxIdsItemType(Value.LI_UID, "li_uid"); + + public static final CalculateTaxPlansRequestTaxIdsItemType RS_PIB = + new CalculateTaxPlansRequestTaxIdsItemType(Value.RS_PIB, "rs_pib"); + + public static final CalculateTaxPlansRequestTaxIdsItemType IL_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.IL_VAT, "il_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType TZ_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.TZ_VAT, "tz_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType BH_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.BH_VAT, "bh_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType HR_OIB = + new CalculateTaxPlansRequestTaxIdsItemType(Value.HR_OIB, "hr_oib"); + + public static final CalculateTaxPlansRequestTaxIdsItemType NG_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.NG_TIN, "ng_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType ZA_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.ZA_VAT, "za_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType AO_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.AO_TIN, "ao_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType MD_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.MD_VAT, "md_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType UY_RUC = + new CalculateTaxPlansRequestTaxIdsItemType(Value.UY_RUC, "uy_ruc"); + + public static final CalculateTaxPlansRequestTaxIdsItemType AD_NRT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.AD_NRT, "ad_nrt"); + + public static final CalculateTaxPlansRequestTaxIdsItemType BF_IFU = + new CalculateTaxPlansRequestTaxIdsItemType(Value.BF_IFU, "bf_ifu"); + + public static final CalculateTaxPlansRequestTaxIdsItemType VN_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.VN_TIN, "vn_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType CL_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.CL_TIN, "cl_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType LA_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.LA_TIN, "la_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType KG_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.KG_TIN, "kg_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType CA_BN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.CA_BN, "ca_bn"); + + public static final CalculateTaxPlansRequestTaxIdsItemType SA_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.SA_VAT, "sa_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType EU_OSS_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.EU_OSS_VAT, "eu_oss_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType BD_BIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.BD_BIN, "bd_bin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType SV_NIT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.SV_NIT, "sv_nit"); + + public static final CalculateTaxPlansRequestTaxIdsItemType BO_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.BO_TIN, "bo_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType GE_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.GE_VAT, "ge_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType AZ_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.AZ_TIN, "az_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType CH_UID = + new CalculateTaxPlansRequestTaxIdsItemType(Value.CH_UID, "ch_uid"); + + public static final CalculateTaxPlansRequestTaxIdsItemType RO_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.RO_TIN, "ro_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType TJ_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.TJ_TIN, "tj_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType AW_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.AW_TIN, "aw_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType CR_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.CR_TIN, "cr_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType GB_VAT = + new CalculateTaxPlansRequestTaxIdsItemType(Value.GB_VAT, "gb_vat"); + + public static final CalculateTaxPlansRequestTaxIdsItemType ES_CIF = + new CalculateTaxPlansRequestTaxIdsItemType(Value.ES_CIF, "es_cif"); + + public static final CalculateTaxPlansRequestTaxIdsItemType GH_TIN = + new CalculateTaxPlansRequestTaxIdsItemType(Value.GH_TIN, "gh_tin"); + + public static final CalculateTaxPlansRequestTaxIdsItemType CA_GST_HST = + new CalculateTaxPlansRequestTaxIdsItemType(Value.CA_GST_HST, "ca_gst_hst"); + + private final Value value; + + private final String string; + + CalculateTaxPlansRequestTaxIdsItemType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CalculateTaxPlansRequestTaxIdsItemType + && this.string.equals(((CalculateTaxPlansRequestTaxIdsItemType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TW_VAT: + return visitor.visitTwVat(); + case VE_RIF: + return visitor.visitVeRif(); + case KR_BRN: + return visitor.visitKrBrn(); + case SN_NINEA: + return visitor.visitSnNinea(); + case AU_ABN: + return visitor.visitAuAbn(); + case MY_SST: + return visitor.visitMySst(); + case EU_VAT: + return visitor.visitEuVat(); + case IN_GST: + return visitor.visitInGst(); + case CA_QST: + return visitor.visitCaQst(); + case MA_VAT: + return visitor.visitMaVat(); + case MK_VAT: + return visitor.visitMkVat(); + case UA_VAT: + return visitor.visitUaVat(); + case CN_TIN: + return visitor.visitCnTin(); + case MX_RFC: + return visitor.visitMxRfc(); + case BY_TIN: + return visitor.visitByTin(); + case CA_PST_BC: + return visitor.visitCaPstBc(); + case ID_NPWP: + return visitor.visitIdNpwp(); + case PH_TIN: + return visitor.visitPhTin(); + case AE_TRN: + return visitor.visitAeTrn(); + case EC_RUC: + return visitor.visitEcRuc(); + case DE_STN: + return visitor.visitDeStn(); + case US_EIN: + return visitor.visitUsEin(); + case CM_NIU: + return visitor.visitCmNiu(); + case ET_TIN: + return visitor.visitEtTin(); + case IS_VAT: + return visitor.visitIsVat(); + case MY_FRP: + return visitor.visitMyFrp(); + case SG_UEN: + return visitor.visitSgUen(); + case HU_TIN: + return visitor.visitHuTin(); + case CO_NIT: + return visitor.visitCoNit(); + case JP_CN: + return visitor.visitJpCn(); + case MY_ITN: + return visitor.visitMyItn(); + case RU_KPP: + return visitor.visitRuKpp(); + case KE_PIN: + return visitor.visitKePin(); + case AR_CUIT: + return visitor.visitArCuit(); + case PE_RUC: + return visitor.visitPeRuc(); + case CA_PST_MB: + return visitor.visitCaPstMb(); + case AM_TIN: + return visitor.visitAmTin(); + case DO_RCN: + return visitor.visitDoRcn(); + case BB_TIN: + return visitor.visitBbTin(); + case JP_TRN: + return visitor.visitJpTrn(); + case HK_BR: + return visitor.visitHkBr(); + case UZ_TIN: + return visitor.visitUzTin(); + case ME_PIB: + return visitor.visitMePib(); + case BS_TIN: + return visitor.visitBsTin(); + case GN_NIF: + return visitor.visitGnNif(); + case KH_TIN: + return visitor.visitKhTin(); + case CD_NIF: + return visitor.visitCdNif(); + case NZ_GST: + return visitor.visitNzGst(); + case TH_VAT: + return visitor.visitThVat(); + case JP_RN: + return visitor.visitJpRn(); + case RU_INN: + return visitor.visitRuInn(); + case SG_GST: + return visitor.visitSgGst(); + case NO_VAT: + return visitor.visitNoVat(); + case BA_TIN: + return visitor.visitBaTin(); + case KZ_BIN: + return visitor.visitKzBin(); + case AL_TIN: + return visitor.visitAlTin(); + case EG_TIN: + return visitor.visitEgTin(); + case NP_PAN: + return visitor.visitNpPan(); + case CH_VAT: + return visitor.visitChVat(); + case NO_VOEC: + return visitor.visitNoVoec(); + case UZ_VAT: + return visitor.visitUzVat(); + case SR_FIN: + return visitor.visitSrFin(); + case BG_UIC: + return visitor.visitBgUic(); + case AU_ARN: + return visitor.visitAuArn(); + case BR_CNPJ: + return visitor.visitBrCnpj(); + case UG_TIN: + return visitor.visitUgTin(); + case CA_PST_SK: + return visitor.visitCaPstSk(); + case OM_VAT: + return visitor.visitOmVat(); + case BR_CPF: + return visitor.visitBrCpf(); + case MR_NIF: + return visitor.visitMrNif(); + case TR_TIN: + return visitor.visitTrTin(); + case BJ_IFU: + return visitor.visitBjIfu(); + case ZW_TIN: + return visitor.visitZwTin(); + case LI_VAT: + return visitor.visitLiVat(); + case ZM_TIN: + return visitor.visitZmTin(); + case SI_TIN: + return visitor.visitSiTin(); + case CV_NIF: + return visitor.visitCvNif(); + case LI_UID: + return visitor.visitLiUid(); + case RS_PIB: + return visitor.visitRsPib(); + case IL_VAT: + return visitor.visitIlVat(); + case TZ_VAT: + return visitor.visitTzVat(); + case BH_VAT: + return visitor.visitBhVat(); + case HR_OIB: + return visitor.visitHrOib(); + case NG_TIN: + return visitor.visitNgTin(); + case ZA_VAT: + return visitor.visitZaVat(); + case AO_TIN: + return visitor.visitAoTin(); + case MD_VAT: + return visitor.visitMdVat(); + case UY_RUC: + return visitor.visitUyRuc(); + case AD_NRT: + return visitor.visitAdNrt(); + case BF_IFU: + return visitor.visitBfIfu(); + case VN_TIN: + return visitor.visitVnTin(); + case CL_TIN: + return visitor.visitClTin(); + case LA_TIN: + return visitor.visitLaTin(); + case KG_TIN: + return visitor.visitKgTin(); + case CA_BN: + return visitor.visitCaBn(); + case SA_VAT: + return visitor.visitSaVat(); + case EU_OSS_VAT: + return visitor.visitEuOssVat(); + case BD_BIN: + return visitor.visitBdBin(); + case SV_NIT: + return visitor.visitSvNit(); + case BO_TIN: + return visitor.visitBoTin(); + case GE_VAT: + return visitor.visitGeVat(); + case AZ_TIN: + return visitor.visitAzTin(); + case CH_UID: + return visitor.visitChUid(); + case RO_TIN: + return visitor.visitRoTin(); + case TJ_TIN: + return visitor.visitTjTin(); + case AW_TIN: + return visitor.visitAwTin(); + case CR_TIN: + return visitor.visitCrTin(); + case GB_VAT: + return visitor.visitGbVat(); + case ES_CIF: + return visitor.visitEsCif(); + case GH_TIN: + return visitor.visitGhTin(); + case CA_GST_HST: + return visitor.visitCaGstHst(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CalculateTaxPlansRequestTaxIdsItemType valueOf(String value) { + switch (value) { + case "tw_vat": + return TW_VAT; + case "ve_rif": + return VE_RIF; + case "kr_brn": + return KR_BRN; + case "sn_ninea": + return SN_NINEA; + case "au_abn": + return AU_ABN; + case "my_sst": + return MY_SST; + case "eu_vat": + return EU_VAT; + case "in_gst": + return IN_GST; + case "ca_qst": + return CA_QST; + case "ma_vat": + return MA_VAT; + case "mk_vat": + return MK_VAT; + case "ua_vat": + return UA_VAT; + case "cn_tin": + return CN_TIN; + case "mx_rfc": + return MX_RFC; + case "by_tin": + return BY_TIN; + case "ca_pst_bc": + return CA_PST_BC; + case "id_npwp": + return ID_NPWP; + case "ph_tin": + return PH_TIN; + case "ae_trn": + return AE_TRN; + case "ec_ruc": + return EC_RUC; + case "de_stn": + return DE_STN; + case "us_ein": + return US_EIN; + case "cm_niu": + return CM_NIU; + case "et_tin": + return ET_TIN; + case "is_vat": + return IS_VAT; + case "my_frp": + return MY_FRP; + case "sg_uen": + return SG_UEN; + case "hu_tin": + return HU_TIN; + case "co_nit": + return CO_NIT; + case "jp_cn": + return JP_CN; + case "my_itn": + return MY_ITN; + case "ru_kpp": + return RU_KPP; + case "ke_pin": + return KE_PIN; + case "ar_cuit": + return AR_CUIT; + case "pe_ruc": + return PE_RUC; + case "ca_pst_mb": + return CA_PST_MB; + case "am_tin": + return AM_TIN; + case "do_rcn": + return DO_RCN; + case "bb_tin": + return BB_TIN; + case "jp_trn": + return JP_TRN; + case "hk_br": + return HK_BR; + case "uz_tin": + return UZ_TIN; + case "me_pib": + return ME_PIB; + case "bs_tin": + return BS_TIN; + case "gn_nif": + return GN_NIF; + case "kh_tin": + return KH_TIN; + case "cd_nif": + return CD_NIF; + case "nz_gst": + return NZ_GST; + case "th_vat": + return TH_VAT; + case "jp_rn": + return JP_RN; + case "ru_inn": + return RU_INN; + case "sg_gst": + return SG_GST; + case "no_vat": + return NO_VAT; + case "ba_tin": + return BA_TIN; + case "kz_bin": + return KZ_BIN; + case "al_tin": + return AL_TIN; + case "eg_tin": + return EG_TIN; + case "np_pan": + return NP_PAN; + case "ch_vat": + return CH_VAT; + case "no_voec": + return NO_VOEC; + case "uz_vat": + return UZ_VAT; + case "sr_fin": + return SR_FIN; + case "bg_uic": + return BG_UIC; + case "au_arn": + return AU_ARN; + case "br_cnpj": + return BR_CNPJ; + case "ug_tin": + return UG_TIN; + case "ca_pst_sk": + return CA_PST_SK; + case "om_vat": + return OM_VAT; + case "br_cpf": + return BR_CPF; + case "mr_nif": + return MR_NIF; + case "tr_tin": + return TR_TIN; + case "bj_ifu": + return BJ_IFU; + case "zw_tin": + return ZW_TIN; + case "li_vat": + return LI_VAT; + case "zm_tin": + return ZM_TIN; + case "si_tin": + return SI_TIN; + case "cv_nif": + return CV_NIF; + case "li_uid": + return LI_UID; + case "rs_pib": + return RS_PIB; + case "il_vat": + return IL_VAT; + case "tz_vat": + return TZ_VAT; + case "bh_vat": + return BH_VAT; + case "hr_oib": + return HR_OIB; + case "ng_tin": + return NG_TIN; + case "za_vat": + return ZA_VAT; + case "ao_tin": + return AO_TIN; + case "md_vat": + return MD_VAT; + case "uy_ruc": + return UY_RUC; + case "ad_nrt": + return AD_NRT; + case "bf_ifu": + return BF_IFU; + case "vn_tin": + return VN_TIN; + case "cl_tin": + return CL_TIN; + case "la_tin": + return LA_TIN; + case "kg_tin": + return KG_TIN; + case "ca_bn": + return CA_BN; + case "sa_vat": + return SA_VAT; + case "eu_oss_vat": + return EU_OSS_VAT; + case "bd_bin": + return BD_BIN; + case "sv_nit": + return SV_NIT; + case "bo_tin": + return BO_TIN; + case "ge_vat": + return GE_VAT; + case "az_tin": + return AZ_TIN; + case "ch_uid": + return CH_UID; + case "ro_tin": + return RO_TIN; + case "tj_tin": + return TJ_TIN; + case "aw_tin": + return AW_TIN; + case "cr_tin": + return CR_TIN; + case "gb_vat": + return GB_VAT; + case "es_cif": + return ES_CIF; + case "gh_tin": + return GH_TIN; + case "ca_gst_hst": + return CA_GST_HST; + default: + return new CalculateTaxPlansRequestTaxIdsItemType(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_NRT, + + AO_TIN, + + AR_CUIT, + + AL_TIN, + + AM_TIN, + + AW_TIN, + + AU_ABN, + + AU_ARN, + + EU_VAT, + + AZ_TIN, + + BS_TIN, + + BH_VAT, + + BD_BIN, + + BB_TIN, + + BY_TIN, + + BJ_IFU, + + BO_TIN, + + BA_TIN, + + BR_CNPJ, + + BR_CPF, + + BG_UIC, + + BF_IFU, + + KH_TIN, + + CM_NIU, + + CA_BN, + + CA_GST_HST, + + CA_PST_BC, + + CA_PST_MB, + + CA_PST_SK, + + CA_QST, + + CV_NIF, + + CL_TIN, + + CN_TIN, + + CO_NIT, + + CD_NIF, + + CR_TIN, + + HR_OIB, + + DO_RCN, + + EC_RUC, + + EG_TIN, + + SV_NIT, + + ET_TIN, + + EU_OSS_VAT, + + GE_VAT, + + GH_TIN, + + DE_STN, + + GB_VAT, + + GN_NIF, + + HK_BR, + + HU_TIN, + + IS_VAT, + + IN_GST, + + ID_NPWP, + + IL_VAT, + + JP_CN, + + JP_RN, + + JP_TRN, + + KZ_BIN, + + KE_PIN, + + KG_TIN, + + LA_TIN, + + LI_UID, + + LI_VAT, + + MY_FRP, + + MY_ITN, + + MY_SST, + + MR_NIF, + + MX_RFC, + + MD_VAT, + + ME_PIB, + + MA_VAT, + + NP_PAN, + + NZ_GST, + + NG_TIN, + + MK_VAT, + + NO_VAT, + + NO_VOEC, + + OM_VAT, + + PE_RUC, + + PH_TIN, + + RO_TIN, + + RU_INN, + + RU_KPP, + + SA_VAT, + + SN_NINEA, + + RS_PIB, + + SG_GST, + + SG_UEN, + + SI_TIN, + + ZA_VAT, + + KR_BRN, + + ES_CIF, + + CH_UID, + + CH_VAT, + + TW_VAT, + + TJ_TIN, + + TZ_VAT, + + TH_VAT, + + TR_TIN, + + UG_TIN, + + UA_VAT, + + AE_TRN, + + US_EIN, + + UY_RUC, + + UZ_TIN, + + UZ_VAT, + + VE_RIF, + + VN_TIN, + + ZM_TIN, + + ZW_TIN, + + SR_FIN, + + UNKNOWN + } + + public interface Visitor { + T visitAdNrt(); + + T visitAoTin(); + + T visitArCuit(); + + T visitAlTin(); + + T visitAmTin(); + + T visitAwTin(); + + T visitAuAbn(); + + T visitAuArn(); + + T visitEuVat(); + + T visitAzTin(); + + T visitBsTin(); + + T visitBhVat(); + + T visitBdBin(); + + T visitBbTin(); + + T visitByTin(); + + T visitBjIfu(); + + T visitBoTin(); + + T visitBaTin(); + + T visitBrCnpj(); + + T visitBrCpf(); + + T visitBgUic(); + + T visitBfIfu(); + + T visitKhTin(); + + T visitCmNiu(); + + T visitCaBn(); + + T visitCaGstHst(); + + T visitCaPstBc(); + + T visitCaPstMb(); + + T visitCaPstSk(); + + T visitCaQst(); + + T visitCvNif(); + + T visitClTin(); + + T visitCnTin(); + + T visitCoNit(); + + T visitCdNif(); + + T visitCrTin(); + + T visitHrOib(); + + T visitDoRcn(); + + T visitEcRuc(); + + T visitEgTin(); + + T visitSvNit(); + + T visitEtTin(); + + T visitEuOssVat(); + + T visitGeVat(); + + T visitGhTin(); + + T visitDeStn(); + + T visitGbVat(); + + T visitGnNif(); + + T visitHkBr(); + + T visitHuTin(); + + T visitIsVat(); + + T visitInGst(); + + T visitIdNpwp(); + + T visitIlVat(); + + T visitJpCn(); + + T visitJpRn(); + + T visitJpTrn(); + + T visitKzBin(); + + T visitKePin(); + + T visitKgTin(); + + T visitLaTin(); + + T visitLiUid(); + + T visitLiVat(); + + T visitMyFrp(); + + T visitMyItn(); + + T visitMySst(); + + T visitMrNif(); + + T visitMxRfc(); + + T visitMdVat(); + + T visitMePib(); + + T visitMaVat(); + + T visitNpPan(); + + T visitNzGst(); + + T visitNgTin(); + + T visitMkVat(); + + T visitNoVat(); + + T visitNoVoec(); + + T visitOmVat(); + + T visitPeRuc(); + + T visitPhTin(); + + T visitRoTin(); + + T visitRuInn(); + + T visitRuKpp(); + + T visitSaVat(); + + T visitSnNinea(); + + T visitRsPib(); + + T visitSgGst(); + + T visitSgUen(); + + T visitSiTin(); + + T visitZaVat(); + + T visitKrBrn(); + + T visitEsCif(); + + T visitChUid(); + + T visitChVat(); + + T visitTwVat(); + + T visitTjTin(); + + T visitTzVat(); + + T visitThVat(); + + T visitTrTin(); + + T visitUgTin(); + + T visitUaVat(); + + T visitAeTrn(); + + T visitUsEin(); + + T visitUyRuc(); + + T visitUzTin(); + + T visitUzVat(); + + T visitVeRif(); + + T visitVnTin(); + + T visitZmTin(); + + T visitZwTin(); + + T visitSrFin(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansResponse.java b/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansResponse.java new file mode 100644 index 00000000..6a62edbb --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansResponse.java @@ -0,0 +1,314 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CalculateTaxPlansResponse.Builder.class) +public final class CalculateTaxPlansResponse { + private final String currency; + + private final CalculateTaxPlansResponseStatus status; + + private final int subtotal; + + private final int taxAmount; + + private final CalculateTaxPlansResponseTaxBehavior taxBehavior; + + private final int total; + + private final Map additionalProperties; + + private CalculateTaxPlansResponse( + String currency, + CalculateTaxPlansResponseStatus status, + int subtotal, + int taxAmount, + CalculateTaxPlansResponseTaxBehavior taxBehavior, + int total, + Map additionalProperties) { + this.currency = currency; + this.status = status; + this.subtotal = subtotal; + this.taxAmount = taxAmount; + this.taxBehavior = taxBehavior; + this.total = total; + this.additionalProperties = additionalProperties; + } + + /** + * @return Three-letter ISO 4217 currency code for the returned amounts. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Whether Whop calculated tax for this preview. not_calculated means no tax could be determined, so tax_amount is 0 and total equals subtotal. + */ + @JsonProperty("status") + public CalculateTaxPlansResponseStatus getStatus() { + return status; + } + + /** + * @return Plan price in the currency's smallest unit, for example cents. For exclusive tax, this is the pre-tax amount; for inclusive tax, it already includes tax and equals the total. + */ + @JsonProperty("subtotal") + public int getSubtotal() { + return subtotal; + } + + /** + * @return Calculated tax amount in the currency's smallest unit. For exclusive tax, this is added on top of the subtotal; for inclusive tax, it is the portion of the subtotal that is tax. + */ + @JsonProperty("tax_amount") + public int getTaxAmount() { + return taxAmount; + } + + /** + * @return Whether tax is added on top of the plan price or already included in it for this buyer's location. + */ + @JsonProperty("tax_behavior") + public CalculateTaxPlansResponseTaxBehavior getTaxBehavior() { + return taxBehavior; + } + + /** + * @return Amount the buyer would pay in the currency's smallest unit. + */ + @JsonProperty("total") + public int getTotal() { + return total; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CalculateTaxPlansResponse && equalTo((CalculateTaxPlansResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CalculateTaxPlansResponse other) { + return currency.equals(other.currency) + && status.equals(other.status) + && subtotal == other.subtotal + && taxAmount == other.taxAmount + && taxBehavior.equals(other.taxBehavior) + && total == other.total; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.status, this.subtotal, this.taxAmount, this.taxBehavior, this.total); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + /** + *

Three-letter ISO 4217 currency code for the returned amounts.

+ */ + StatusStage currency(@NotNull String currency); + + Builder from(CalculateTaxPlansResponse other); + } + + public interface StatusStage { + /** + *

Whether Whop calculated tax for this preview. not_calculated means no tax could be determined, so tax_amount is 0 and total equals subtotal.

+ */ + SubtotalStage status(@NotNull CalculateTaxPlansResponseStatus status); + } + + public interface SubtotalStage { + /** + *

Plan price in the currency's smallest unit, for example cents. For exclusive tax, this is the pre-tax amount; for inclusive tax, it already includes tax and equals the total.

+ */ + TaxAmountStage subtotal(int subtotal); + } + + public interface TaxAmountStage { + /** + *

Calculated tax amount in the currency's smallest unit. For exclusive tax, this is added on top of the subtotal; for inclusive tax, it is the portion of the subtotal that is tax.

+ */ + TaxBehaviorStage taxAmount(int taxAmount); + } + + public interface TaxBehaviorStage { + /** + *

Whether tax is added on top of the plan price or already included in it for this buyer's location.

+ */ + TotalStage taxBehavior(@NotNull CalculateTaxPlansResponseTaxBehavior taxBehavior); + } + + public interface TotalStage { + /** + *

Amount the buyer would pay in the currency's smallest unit.

+ */ + _FinalStage total(int total); + } + + public interface _FinalStage { + CalculateTaxPlansResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CurrencyStage, + StatusStage, + SubtotalStage, + TaxAmountStage, + TaxBehaviorStage, + TotalStage, + _FinalStage { + private String currency; + + private CalculateTaxPlansResponseStatus status; + + private int subtotal; + + private int taxAmount; + + private CalculateTaxPlansResponseTaxBehavior taxBehavior; + + private int total; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CalculateTaxPlansResponse other) { + currency(other.getCurrency()); + status(other.getStatus()); + subtotal(other.getSubtotal()); + taxAmount(other.getTaxAmount()); + taxBehavior(other.getTaxBehavior()); + total(other.getTotal()); + return this; + } + + /** + *

Three-letter ISO 4217 currency code for the returned amounts.

+ *

Three-letter ISO 4217 currency code for the returned amounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public StatusStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Whether Whop calculated tax for this preview. not_calculated means no tax could be determined, so tax_amount is 0 and total equals subtotal.

+ *

Whether Whop calculated tax for this preview. not_calculated means no tax could be determined, so tax_amount is 0 and total equals subtotal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public SubtotalStage status(@NotNull CalculateTaxPlansResponseStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Plan price in the currency's smallest unit, for example cents. For exclusive tax, this is the pre-tax amount; for inclusive tax, it already includes tax and equals the total.

+ *

Plan price in the currency's smallest unit, for example cents. For exclusive tax, this is the pre-tax amount; for inclusive tax, it already includes tax and equals the total.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("subtotal") + public TaxAmountStage subtotal(int subtotal) { + this.subtotal = subtotal; + return this; + } + + /** + *

Calculated tax amount in the currency's smallest unit. For exclusive tax, this is added on top of the subtotal; for inclusive tax, it is the portion of the subtotal that is tax.

+ *

Calculated tax amount in the currency's smallest unit. For exclusive tax, this is added on top of the subtotal; for inclusive tax, it is the portion of the subtotal that is tax.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tax_amount") + public TaxBehaviorStage taxAmount(int taxAmount) { + this.taxAmount = taxAmount; + return this; + } + + /** + *

Whether tax is added on top of the plan price or already included in it for this buyer's location.

+ *

Whether tax is added on top of the plan price or already included in it for this buyer's location.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tax_behavior") + public TotalStage taxBehavior(@NotNull CalculateTaxPlansResponseTaxBehavior taxBehavior) { + this.taxBehavior = Objects.requireNonNull(taxBehavior, "taxBehavior must not be null"); + return this; + } + + /** + *

Amount the buyer would pay in the currency's smallest unit.

+ *

Amount the buyer would pay in the currency's smallest unit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total") + public _FinalStage total(int total) { + this.total = total; + return this; + } + + @java.lang.Override + public CalculateTaxPlansResponse build() { + return new CalculateTaxPlansResponse( + currency, status, subtotal, taxAmount, taxBehavior, total, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansResponseStatus.java b/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansResponseStatus.java new file mode 100644 index 00000000..f9d19bd7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansResponseStatus.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CalculateTaxPlansResponseStatus { + public static final CalculateTaxPlansResponseStatus CALCULATED = + new CalculateTaxPlansResponseStatus(Value.CALCULATED, "calculated"); + + public static final CalculateTaxPlansResponseStatus NOT_CALCULATED = + new CalculateTaxPlansResponseStatus(Value.NOT_CALCULATED, "not_calculated"); + + private final Value value; + + private final String string; + + CalculateTaxPlansResponseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CalculateTaxPlansResponseStatus + && this.string.equals(((CalculateTaxPlansResponseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CALCULATED: + return visitor.visitCalculated(); + case NOT_CALCULATED: + return visitor.visitNotCalculated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CalculateTaxPlansResponseStatus valueOf(String value) { + switch (value) { + case "calculated": + return CALCULATED; + case "not_calculated": + return NOT_CALCULATED; + default: + return new CalculateTaxPlansResponseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + CALCULATED, + + NOT_CALCULATED, + + UNKNOWN + } + + public interface Visitor { + T visitCalculated(); + + T visitNotCalculated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansResponseTaxBehavior.java b/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansResponseTaxBehavior.java new file mode 100644 index 00000000..35d31716 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/CalculateTaxPlansResponseTaxBehavior.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CalculateTaxPlansResponseTaxBehavior { + public static final CalculateTaxPlansResponseTaxBehavior EXCLUSIVE = + new CalculateTaxPlansResponseTaxBehavior(Value.EXCLUSIVE, "exclusive"); + + public static final CalculateTaxPlansResponseTaxBehavior INCLUSIVE = + new CalculateTaxPlansResponseTaxBehavior(Value.INCLUSIVE, "inclusive"); + + private final Value value; + + private final String string; + + CalculateTaxPlansResponseTaxBehavior(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CalculateTaxPlansResponseTaxBehavior + && this.string.equals(((CalculateTaxPlansResponseTaxBehavior) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EXCLUSIVE: + return visitor.visitExclusive(); + case INCLUSIVE: + return visitor.visitInclusive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CalculateTaxPlansResponseTaxBehavior valueOf(String value) { + switch (value) { + case "exclusive": + return EXCLUSIVE; + case "inclusive": + return INCLUSIVE; + default: + return new CalculateTaxPlansResponseTaxBehavior(Value.UNKNOWN, value); + } + } + + public enum Value { + EXCLUSIVE, + + INCLUSIVE, + + UNKNOWN + } + + public interface Visitor { + T visitExclusive(); + + T visitInclusive(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/CreatePlansRequestCustomFieldsItem.java b/src/main/java/com/whop/api/resources/plans/types/CreatePlansRequestCustomFieldsItem.java new file mode 100644 index 00000000..459b7e19 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/CreatePlansRequestCustomFieldsItem.java @@ -0,0 +1,288 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePlansRequestCustomFieldsItem.Builder.class) +public final class CreatePlansRequestCustomFieldsItem { + private final Optional fieldType; + + private final Optional id; + + private final Optional name; + + private final Optional order; + + private final Optional placeholder; + + private final Optional required; + + private final Map additionalProperties; + + private CreatePlansRequestCustomFieldsItem( + Optional fieldType, + Optional id, + Optional name, + Optional order, + Optional placeholder, + Optional required, + Map additionalProperties) { + this.fieldType = fieldType; + this.id = id; + this.name = name; + this.order = order; + this.placeholder = placeholder; + this.required = required; + this.additionalProperties = additionalProperties; + } + + /** + * @return The type of the custom field. + */ + @JsonProperty("field_type") + public Optional getFieldType() { + return fieldType; + } + + /** + * @return The ID of the custom field (if being updated). + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The name of the custom field. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return The order of the field. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return An example response displayed in the input field. + */ + @JsonIgnore + public Optional getPlaceholder() { + if (placeholder == null) { + return Optional.empty(); + } + return placeholder; + } + + /** + * @return Whether or not the field is required. + */ + @JsonProperty("required") + public Optional getRequired() { + return required; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("placeholder") + private Optional _getPlaceholder() { + return placeholder; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePlansRequestCustomFieldsItem + && equalTo((CreatePlansRequestCustomFieldsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePlansRequestCustomFieldsItem other) { + return fieldType.equals(other.fieldType) + && id.equals(other.id) + && name.equals(other.name) + && order.equals(other.order) + && placeholder.equals(other.placeholder) + && required.equals(other.required); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fieldType, this.id, this.name, this.order, this.placeholder, this.required); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional fieldType = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional placeholder = Optional.empty(); + + private Optional required = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreatePlansRequestCustomFieldsItem other) { + fieldType(other.getFieldType()); + id(other.getId()); + name(other.getName()); + order(other.getOrder()); + placeholder(other.getPlaceholder()); + required(other.getRequired()); + return this; + } + + /** + *

The type of the custom field.

+ */ + @JsonSetter(value = "field_type", nulls = Nulls.SKIP) + public Builder fieldType(Optional fieldType) { + this.fieldType = fieldType; + return this; + } + + public Builder fieldType(CreatePlansRequestCustomFieldsItemFieldType fieldType) { + this.fieldType = Optional.ofNullable(fieldType); + return this; + } + + /** + *

The ID of the custom field (if being updated).

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The name of the custom field.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The order of the field.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(Integer order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

An example response displayed in the input field.

+ */ + @JsonSetter(value = "placeholder", nulls = Nulls.SKIP) + public Builder placeholder(Optional placeholder) { + this.placeholder = placeholder; + return this; + } + + public Builder placeholder(String placeholder) { + this.placeholder = Optional.ofNullable(placeholder); + return this; + } + + public Builder placeholder(Nullable placeholder) { + if (placeholder.isNull()) { + this.placeholder = null; + } else if (placeholder.isEmpty()) { + this.placeholder = Optional.empty(); + } else { + this.placeholder = Optional.of(placeholder.get()); + } + return this; + } + + /** + *

Whether or not the field is required.

+ */ + @JsonSetter(value = "required", nulls = Nulls.SKIP) + public Builder required(Optional required) { + this.required = required; + return this; + } + + public Builder required(Boolean required) { + this.required = Optional.ofNullable(required); + return this; + } + + public CreatePlansRequestCustomFieldsItem build() { + return new CreatePlansRequestCustomFieldsItem( + fieldType, id, name, order, placeholder, required, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/CreatePlansRequestCustomFieldsItemFieldType.java b/src/main/java/com/whop/api/resources/plans/types/CreatePlansRequestCustomFieldsItemFieldType.java new file mode 100644 index 00000000..5c6c02fd --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/CreatePlansRequestCustomFieldsItemFieldType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreatePlansRequestCustomFieldsItemFieldType { + public static final CreatePlansRequestCustomFieldsItemFieldType TEXT = + new CreatePlansRequestCustomFieldsItemFieldType(Value.TEXT, "text"); + + private final Value value; + + private final String string; + + CreatePlansRequestCustomFieldsItemFieldType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreatePlansRequestCustomFieldsItemFieldType + && this.string.equals(((CreatePlansRequestCustomFieldsItemFieldType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TEXT: + return visitor.visitText(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreatePlansRequestCustomFieldsItemFieldType valueOf(String value) { + switch (value) { + case "text": + return TEXT; + default: + return new CreatePlansRequestCustomFieldsItemFieldType(Value.UNKNOWN, value); + } + } + + public enum Value { + TEXT, + + UNKNOWN + } + + public interface Visitor { + T visitText(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/CreatePlansRequestImage.java b/src/main/java/com/whop/api/resources/plans/types/CreatePlansRequestImage.java new file mode 100644 index 00000000..1a82a3f2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/CreatePlansRequestImage.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePlansRequestImage.Builder.class) +public final class CreatePlansRequestImage { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private CreatePlansRequestImage( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePlansRequestImage && equalTo((CreatePlansRequestImage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePlansRequestImage other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreatePlansRequestImage other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public CreatePlansRequestImage build() { + return new CreatePlansRequestImage(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/CreatePlansRequestPaymentMethodConfiguration.java b/src/main/java/com/whop/api/resources/plans/types/CreatePlansRequestPaymentMethodConfiguration.java new file mode 100644 index 00000000..7ebd0ae7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/CreatePlansRequestPaymentMethodConfiguration.java @@ -0,0 +1,158 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePlansRequestPaymentMethodConfiguration.Builder.class) +public final class CreatePlansRequestPaymentMethodConfiguration { + private final Optional> disabled; + + private final Optional> enabled; + + private final Optional includePlatformDefaults; + + private final Map additionalProperties; + + private CreatePlansRequestPaymentMethodConfiguration( + Optional> disabled, + Optional> enabled, + Optional includePlatformDefaults, + Map additionalProperties) { + this.disabled = disabled; + this.enabled = enabled; + this.includePlatformDefaults = includePlatformDefaults; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("disabled") + public Optional> getDisabled() { + return disabled; + } + + @JsonProperty("enabled") + public Optional> getEnabled() { + return enabled; + } + + @JsonProperty("include_platform_defaults") + public Optional getIncludePlatformDefaults() { + return includePlatformDefaults; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePlansRequestPaymentMethodConfiguration + && equalTo((CreatePlansRequestPaymentMethodConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePlansRequestPaymentMethodConfiguration other) { + return disabled.equals(other.disabled) + && enabled.equals(other.enabled) + && includePlatformDefaults.equals(other.includePlatformDefaults); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.disabled, this.enabled, this.includePlatformDefaults); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> disabled = Optional.empty(); + + private Optional> enabled = Optional.empty(); + + private Optional includePlatformDefaults = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreatePlansRequestPaymentMethodConfiguration other) { + disabled(other.getDisabled()); + enabled(other.getEnabled()); + includePlatformDefaults(other.getIncludePlatformDefaults()); + return this; + } + + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional> disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(List disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional> enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(List enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + @JsonSetter(value = "include_platform_defaults", nulls = Nulls.SKIP) + public Builder includePlatformDefaults(Optional includePlatformDefaults) { + this.includePlatformDefaults = includePlatformDefaults; + return this; + } + + public Builder includePlatformDefaults(Boolean includePlatformDefaults) { + this.includePlatformDefaults = Optional.ofNullable(includePlatformDefaults); + return this; + } + + public CreatePlansRequestPaymentMethodConfiguration build() { + return new CreatePlansRequestPaymentMethodConfiguration( + disabled, enabled, includePlatformDefaults, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/CreatePlansRequestThreeDsLevel.java b/src/main/java/com/whop/api/resources/plans/types/CreatePlansRequestThreeDsLevel.java new file mode 100644 index 00000000..b5a81364 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/CreatePlansRequestThreeDsLevel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreatePlansRequestThreeDsLevel { + public static final CreatePlansRequestThreeDsLevel MANDATE_CHALLENGE = + new CreatePlansRequestThreeDsLevel(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + public static final CreatePlansRequestThreeDsLevel FRICTIONLESS = + new CreatePlansRequestThreeDsLevel(Value.FRICTIONLESS, "frictionless"); + + private final Value value; + + private final String string; + + CreatePlansRequestThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreatePlansRequestThreeDsLevel + && this.string.equals(((CreatePlansRequestThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case FRICTIONLESS: + return visitor.visitFrictionless(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreatePlansRequestThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + case "frictionless": + return FRICTIONLESS; + default: + return new CreatePlansRequestThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + FRICTIONLESS, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitFrictionless(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/DeletePlansResponse.java b/src/main/java/com/whop/api/resources/plans/types/DeletePlansResponse.java new file mode 100644 index 00000000..f50c1c47 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/DeletePlansResponse.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeletePlansResponse.Builder.class) +public final class DeletePlansResponse { + private final boolean deleted; + + private final String id; + + private final Map additionalProperties; + + private DeletePlansResponse(boolean deleted, String id, Map additionalProperties) { + this.deleted = deleted; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Always true. + */ + @JsonProperty("deleted") + public boolean getDeleted() { + return deleted; + } + + /** + * @return ID of the deleted plan. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeletePlansResponse && equalTo((DeletePlansResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeletePlansResponse other) { + return deleted == other.deleted && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deleted, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeletedStage builder() { + return new Builder(); + } + + public interface DeletedStage { + /** + *

Always true.

+ */ + IdStage deleted(boolean deleted); + + Builder from(DeletePlansResponse other); + } + + public interface IdStage { + /** + *

ID of the deleted plan.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DeletePlansResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeletedStage, IdStage, _FinalStage { + private boolean deleted; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeletePlansResponse other) { + deleted(other.getDeleted()); + id(other.getId()); + return this; + } + + /** + *

Always true.

+ *

Always true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("deleted") + public IdStage deleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + *

ID of the deleted plan.

+ *

ID of the deleted plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DeletePlansResponse build() { + return new DeletePlansResponse(deleted, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/ListPlansRequestDirection.java b/src/main/java/com/whop/api/resources/plans/types/ListPlansRequestDirection.java new file mode 100644 index 00000000..b7059d4f --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/ListPlansRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPlansRequestDirection { + public static final ListPlansRequestDirection ASC = new ListPlansRequestDirection(Value.ASC, "asc"); + + public static final ListPlansRequestDirection DESC = new ListPlansRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListPlansRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPlansRequestDirection + && this.string.equals(((ListPlansRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPlansRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListPlansRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/ListPlansRequestOrder.java b/src/main/java/com/whop/api/resources/plans/types/ListPlansRequestOrder.java new file mode 100644 index 00000000..295d22d0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/ListPlansRequestOrder.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPlansRequestOrder { + public static final ListPlansRequestOrder INTERNAL_NOTES = + new ListPlansRequestOrder(Value.INTERNAL_NOTES, "internal_notes"); + + public static final ListPlansRequestOrder CREATED_AT = new ListPlansRequestOrder(Value.CREATED_AT, "created_at"); + + public static final ListPlansRequestOrder ID = new ListPlansRequestOrder(Value.ID, "id"); + + public static final ListPlansRequestOrder EXPIRATION_DAYS = + new ListPlansRequestOrder(Value.EXPIRATION_DAYS, "expiration_days"); + + public static final ListPlansRequestOrder ACTIVE_MEMBERS_COUNT = + new ListPlansRequestOrder(Value.ACTIVE_MEMBERS_COUNT, "active_members_count"); + + private final Value value; + + private final String string; + + ListPlansRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPlansRequestOrder + && this.string.equals(((ListPlansRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INTERNAL_NOTES: + return visitor.visitInternalNotes(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case ID: + return visitor.visitId(); + case EXPIRATION_DAYS: + return visitor.visitExpirationDays(); + case ACTIVE_MEMBERS_COUNT: + return visitor.visitActiveMembersCount(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPlansRequestOrder valueOf(String value) { + switch (value) { + case "internal_notes": + return INTERNAL_NOTES; + case "created_at": + return CREATED_AT; + case "id": + return ID; + case "expiration_days": + return EXPIRATION_DAYS; + case "active_members_count": + return ACTIVE_MEMBERS_COUNT; + default: + return new ListPlansRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + ID, + + ACTIVE_MEMBERS_COUNT, + + CREATED_AT, + + INTERNAL_NOTES, + + EXPIRATION_DAYS, + + UNKNOWN + } + + public interface Visitor { + T visitId(); + + T visitActiveMembersCount(); + + T visitCreatedAt(); + + T visitInternalNotes(); + + T visitExpirationDays(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/ListPlansResponse.java b/src/main/java/com/whop/api/resources/plans/types/ListPlansResponse.java new file mode 100644 index 00000000..ee949883 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/ListPlansResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PlanListItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPlansResponse.Builder.class) +public final class ListPlansResponse { + private final List data; + + private final ListPlansResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListPlansResponse( + List data, ListPlansResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListPlansResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPlansResponse && equalTo((ListPlansResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPlansResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListPlansResponsePageInfo pageInfo); + + Builder from(ListPlansResponse other); + } + + public interface _FinalStage { + ListPlansResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(PlanListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListPlansResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPlansResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListPlansResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(PlanListItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListPlansResponse build() { + return new ListPlansResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/ListPlansResponsePageInfo.java b/src/main/java/com/whop/api/resources/plans/types/ListPlansResponsePageInfo.java new file mode 100644 index 00000000..4dfc549a --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/ListPlansResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPlansResponsePageInfo.Builder.class) +public final class ListPlansResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListPlansResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPlansResponsePageInfo && equalTo((ListPlansResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPlansResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListPlansResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListPlansResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPlansResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListPlansResponsePageInfo build() { + return new ListPlansResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/PostPlanCreatedPayload.java b/src/main/java/com/whop/api/resources/plans/types/PostPlanCreatedPayload.java new file mode 100644 index 00000000..6fb90a7c --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/PostPlanCreatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Plan; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPlanCreatedPayload.Builder.class) +public final class PostPlanCreatedPayload { + private final Optional accountId; + + private final PostPlanCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Plan data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostPlanCreatedPayloadType type; + + private final Map additionalProperties; + + private PostPlanCreatedPayload( + Optional accountId, + PostPlanCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Plan data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostPlanCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostPlanCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Plan getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostPlanCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPlanCreatedPayload && equalTo((PostPlanCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPlanCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostPlanCreatedPayloadApiVersion apiVersion); + + Builder from(PostPlanCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Plan data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostPlanCreatedPayloadType type); + } + + public interface _FinalStage { + PostPlanCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostPlanCreatedPayloadApiVersion apiVersion; + + private Plan data; + + private String id; + + private OffsetDateTime timestamp; + + private PostPlanCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostPlanCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostPlanCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Plan data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostPlanCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostPlanCreatedPayload build() { + return new PostPlanCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/PostPlanCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/plans/types/PostPlanCreatedPayloadApiVersion.java new file mode 100644 index 00000000..9af9db70 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/PostPlanCreatedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPlanCreatedPayloadApiVersion { + public static final PostPlanCreatedPayloadApiVersion V1 = new PostPlanCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostPlanCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPlanCreatedPayloadApiVersion + && this.string.equals(((PostPlanCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPlanCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostPlanCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/PostPlanCreatedPayloadType.java b/src/main/java/com/whop/api/resources/plans/types/PostPlanCreatedPayloadType.java new file mode 100644 index 00000000..fa0849ab --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/PostPlanCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPlanCreatedPayloadType { + public static final PostPlanCreatedPayloadType PLAN_CREATED = + new PostPlanCreatedPayloadType(Value.PLAN_CREATED, "plan.created"); + + private final Value value; + + private final String string; + + PostPlanCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPlanCreatedPayloadType + && this.string.equals(((PostPlanCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PLAN_CREATED: + return visitor.visitPlanCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPlanCreatedPayloadType valueOf(String value) { + switch (value) { + case "plan.created": + return PLAN_CREATED; + default: + return new PostPlanCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + PLAN_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitPlanCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/PostPlanDeletedPayload.java b/src/main/java/com/whop/api/resources/plans/types/PostPlanDeletedPayload.java new file mode 100644 index 00000000..932cd82e --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/PostPlanDeletedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Plan; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPlanDeletedPayload.Builder.class) +public final class PostPlanDeletedPayload { + private final Optional accountId; + + private final PostPlanDeletedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Plan data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostPlanDeletedPayloadType type; + + private final Map additionalProperties; + + private PostPlanDeletedPayload( + Optional accountId, + PostPlanDeletedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Plan data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostPlanDeletedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostPlanDeletedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Plan getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostPlanDeletedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPlanDeletedPayload && equalTo((PostPlanDeletedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPlanDeletedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostPlanDeletedPayloadApiVersion apiVersion); + + Builder from(PostPlanDeletedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Plan data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostPlanDeletedPayloadType type); + } + + public interface _FinalStage { + PostPlanDeletedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostPlanDeletedPayloadApiVersion apiVersion; + + private Plan data; + + private String id; + + private OffsetDateTime timestamp; + + private PostPlanDeletedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostPlanDeletedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostPlanDeletedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Plan data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostPlanDeletedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostPlanDeletedPayload build() { + return new PostPlanDeletedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/PostPlanDeletedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/plans/types/PostPlanDeletedPayloadApiVersion.java new file mode 100644 index 00000000..8d0dc474 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/PostPlanDeletedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPlanDeletedPayloadApiVersion { + public static final PostPlanDeletedPayloadApiVersion V1 = new PostPlanDeletedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostPlanDeletedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPlanDeletedPayloadApiVersion + && this.string.equals(((PostPlanDeletedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPlanDeletedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostPlanDeletedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/PostPlanDeletedPayloadType.java b/src/main/java/com/whop/api/resources/plans/types/PostPlanDeletedPayloadType.java new file mode 100644 index 00000000..a3b4a405 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/PostPlanDeletedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPlanDeletedPayloadType { + public static final PostPlanDeletedPayloadType PLAN_DELETED = + new PostPlanDeletedPayloadType(Value.PLAN_DELETED, "plan.deleted"); + + private final Value value; + + private final String string; + + PostPlanDeletedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPlanDeletedPayloadType + && this.string.equals(((PostPlanDeletedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PLAN_DELETED: + return visitor.visitPlanDeleted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPlanDeletedPayloadType valueOf(String value) { + switch (value) { + case "plan.deleted": + return PLAN_DELETED; + default: + return new PostPlanDeletedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + PLAN_DELETED, + + UNKNOWN + } + + public interface Visitor { + T visitPlanDeleted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/PostPlanUpdatedPayload.java b/src/main/java/com/whop/api/resources/plans/types/PostPlanUpdatedPayload.java new file mode 100644 index 00000000..c1e679df --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/PostPlanUpdatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Plan; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostPlanUpdatedPayload.Builder.class) +public final class PostPlanUpdatedPayload { + private final Optional accountId; + + private final PostPlanUpdatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Plan data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostPlanUpdatedPayloadType type; + + private final Map additionalProperties; + + private PostPlanUpdatedPayload( + Optional accountId, + PostPlanUpdatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Plan data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostPlanUpdatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostPlanUpdatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Plan getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostPlanUpdatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostPlanUpdatedPayload && equalTo((PostPlanUpdatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostPlanUpdatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostPlanUpdatedPayloadApiVersion apiVersion); + + Builder from(PostPlanUpdatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Plan data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostPlanUpdatedPayloadType type); + } + + public interface _FinalStage { + PostPlanUpdatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostPlanUpdatedPayloadApiVersion apiVersion; + + private Plan data; + + private String id; + + private OffsetDateTime timestamp; + + private PostPlanUpdatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostPlanUpdatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostPlanUpdatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Plan data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostPlanUpdatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostPlanUpdatedPayload build() { + return new PostPlanUpdatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/PostPlanUpdatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/plans/types/PostPlanUpdatedPayloadApiVersion.java new file mode 100644 index 00000000..ef62f714 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/PostPlanUpdatedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPlanUpdatedPayloadApiVersion { + public static final PostPlanUpdatedPayloadApiVersion V1 = new PostPlanUpdatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostPlanUpdatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPlanUpdatedPayloadApiVersion + && this.string.equals(((PostPlanUpdatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPlanUpdatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostPlanUpdatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/PostPlanUpdatedPayloadType.java b/src/main/java/com/whop/api/resources/plans/types/PostPlanUpdatedPayloadType.java new file mode 100644 index 00000000..61859148 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/PostPlanUpdatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostPlanUpdatedPayloadType { + public static final PostPlanUpdatedPayloadType PLAN_UPDATED = + new PostPlanUpdatedPayloadType(Value.PLAN_UPDATED, "plan.updated"); + + private final Value value; + + private final String string; + + PostPlanUpdatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostPlanUpdatedPayloadType + && this.string.equals(((PostPlanUpdatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PLAN_UPDATED: + return visitor.visitPlanUpdated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostPlanUpdatedPayloadType valueOf(String value) { + switch (value) { + case "plan.updated": + return PLAN_UPDATED; + default: + return new PostPlanUpdatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + PLAN_UPDATED, + + UNKNOWN + } + + public interface Visitor { + T visitPlanUpdated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/UpdatePlansRequestCustomFieldsItem.java b/src/main/java/com/whop/api/resources/plans/types/UpdatePlansRequestCustomFieldsItem.java new file mode 100644 index 00000000..2154cefd --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/UpdatePlansRequestCustomFieldsItem.java @@ -0,0 +1,288 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePlansRequestCustomFieldsItem.Builder.class) +public final class UpdatePlansRequestCustomFieldsItem { + private final Optional fieldType; + + private final Optional id; + + private final Optional name; + + private final Optional order; + + private final Optional placeholder; + + private final Optional required; + + private final Map additionalProperties; + + private UpdatePlansRequestCustomFieldsItem( + Optional fieldType, + Optional id, + Optional name, + Optional order, + Optional placeholder, + Optional required, + Map additionalProperties) { + this.fieldType = fieldType; + this.id = id; + this.name = name; + this.order = order; + this.placeholder = placeholder; + this.required = required; + this.additionalProperties = additionalProperties; + } + + /** + * @return The type of the custom field. + */ + @JsonProperty("field_type") + public Optional getFieldType() { + return fieldType; + } + + /** + * @return The ID of the custom field (if being updated). + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The name of the custom field. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return The order of the field. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return An example response displayed in the input field. + */ + @JsonIgnore + public Optional getPlaceholder() { + if (placeholder == null) { + return Optional.empty(); + } + return placeholder; + } + + /** + * @return Whether or not the field is required. + */ + @JsonProperty("required") + public Optional getRequired() { + return required; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("placeholder") + private Optional _getPlaceholder() { + return placeholder; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePlansRequestCustomFieldsItem + && equalTo((UpdatePlansRequestCustomFieldsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePlansRequestCustomFieldsItem other) { + return fieldType.equals(other.fieldType) + && id.equals(other.id) + && name.equals(other.name) + && order.equals(other.order) + && placeholder.equals(other.placeholder) + && required.equals(other.required); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fieldType, this.id, this.name, this.order, this.placeholder, this.required); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional fieldType = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional placeholder = Optional.empty(); + + private Optional required = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdatePlansRequestCustomFieldsItem other) { + fieldType(other.getFieldType()); + id(other.getId()); + name(other.getName()); + order(other.getOrder()); + placeholder(other.getPlaceholder()); + required(other.getRequired()); + return this; + } + + /** + *

The type of the custom field.

+ */ + @JsonSetter(value = "field_type", nulls = Nulls.SKIP) + public Builder fieldType(Optional fieldType) { + this.fieldType = fieldType; + return this; + } + + public Builder fieldType(UpdatePlansRequestCustomFieldsItemFieldType fieldType) { + this.fieldType = Optional.ofNullable(fieldType); + return this; + } + + /** + *

The ID of the custom field (if being updated).

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The name of the custom field.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The order of the field.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(Integer order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

An example response displayed in the input field.

+ */ + @JsonSetter(value = "placeholder", nulls = Nulls.SKIP) + public Builder placeholder(Optional placeholder) { + this.placeholder = placeholder; + return this; + } + + public Builder placeholder(String placeholder) { + this.placeholder = Optional.ofNullable(placeholder); + return this; + } + + public Builder placeholder(Nullable placeholder) { + if (placeholder.isNull()) { + this.placeholder = null; + } else if (placeholder.isEmpty()) { + this.placeholder = Optional.empty(); + } else { + this.placeholder = Optional.of(placeholder.get()); + } + return this; + } + + /** + *

Whether or not the field is required.

+ */ + @JsonSetter(value = "required", nulls = Nulls.SKIP) + public Builder required(Optional required) { + this.required = required; + return this; + } + + public Builder required(Boolean required) { + this.required = Optional.ofNullable(required); + return this; + } + + public UpdatePlansRequestCustomFieldsItem build() { + return new UpdatePlansRequestCustomFieldsItem( + fieldType, id, name, order, placeholder, required, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/UpdatePlansRequestCustomFieldsItemFieldType.java b/src/main/java/com/whop/api/resources/plans/types/UpdatePlansRequestCustomFieldsItemFieldType.java new file mode 100644 index 00000000..01d30528 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/UpdatePlansRequestCustomFieldsItemFieldType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdatePlansRequestCustomFieldsItemFieldType { + public static final UpdatePlansRequestCustomFieldsItemFieldType TEXT = + new UpdatePlansRequestCustomFieldsItemFieldType(Value.TEXT, "text"); + + private final Value value; + + private final String string; + + UpdatePlansRequestCustomFieldsItemFieldType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdatePlansRequestCustomFieldsItemFieldType + && this.string.equals(((UpdatePlansRequestCustomFieldsItemFieldType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TEXT: + return visitor.visitText(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdatePlansRequestCustomFieldsItemFieldType valueOf(String value) { + switch (value) { + case "text": + return TEXT; + default: + return new UpdatePlansRequestCustomFieldsItemFieldType(Value.UNKNOWN, value); + } + } + + public enum Value { + TEXT, + + UNKNOWN + } + + public interface Visitor { + T visitText(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/UpdatePlansRequestImage.java b/src/main/java/com/whop/api/resources/plans/types/UpdatePlansRequestImage.java new file mode 100644 index 00000000..9eb78ca2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/UpdatePlansRequestImage.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePlansRequestImage.Builder.class) +public final class UpdatePlansRequestImage { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private UpdatePlansRequestImage( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePlansRequestImage && equalTo((UpdatePlansRequestImage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePlansRequestImage other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdatePlansRequestImage other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdatePlansRequestImage build() { + return new UpdatePlansRequestImage(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/UpdatePlansRequestPaymentMethodConfiguration.java b/src/main/java/com/whop/api/resources/plans/types/UpdatePlansRequestPaymentMethodConfiguration.java new file mode 100644 index 00000000..f1ed2e77 --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/UpdatePlansRequestPaymentMethodConfiguration.java @@ -0,0 +1,158 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePlansRequestPaymentMethodConfiguration.Builder.class) +public final class UpdatePlansRequestPaymentMethodConfiguration { + private final Optional> disabled; + + private final Optional> enabled; + + private final Optional includePlatformDefaults; + + private final Map additionalProperties; + + private UpdatePlansRequestPaymentMethodConfiguration( + Optional> disabled, + Optional> enabled, + Optional includePlatformDefaults, + Map additionalProperties) { + this.disabled = disabled; + this.enabled = enabled; + this.includePlatformDefaults = includePlatformDefaults; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("disabled") + public Optional> getDisabled() { + return disabled; + } + + @JsonProperty("enabled") + public Optional> getEnabled() { + return enabled; + } + + @JsonProperty("include_platform_defaults") + public Optional getIncludePlatformDefaults() { + return includePlatformDefaults; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePlansRequestPaymentMethodConfiguration + && equalTo((UpdatePlansRequestPaymentMethodConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePlansRequestPaymentMethodConfiguration other) { + return disabled.equals(other.disabled) + && enabled.equals(other.enabled) + && includePlatformDefaults.equals(other.includePlatformDefaults); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.disabled, this.enabled, this.includePlatformDefaults); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> disabled = Optional.empty(); + + private Optional> enabled = Optional.empty(); + + private Optional includePlatformDefaults = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdatePlansRequestPaymentMethodConfiguration other) { + disabled(other.getDisabled()); + enabled(other.getEnabled()); + includePlatformDefaults(other.getIncludePlatformDefaults()); + return this; + } + + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional> disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(List disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional> enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(List enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + @JsonSetter(value = "include_platform_defaults", nulls = Nulls.SKIP) + public Builder includePlatformDefaults(Optional includePlatformDefaults) { + this.includePlatformDefaults = includePlatformDefaults; + return this; + } + + public Builder includePlatformDefaults(Boolean includePlatformDefaults) { + this.includePlatformDefaults = Optional.ofNullable(includePlatformDefaults); + return this; + } + + public UpdatePlansRequestPaymentMethodConfiguration build() { + return new UpdatePlansRequestPaymentMethodConfiguration( + disabled, enabled, includePlatformDefaults, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/plans/types/UpdatePlansRequestThreeDsLevel.java b/src/main/java/com/whop/api/resources/plans/types/UpdatePlansRequestThreeDsLevel.java new file mode 100644 index 00000000..1f4e8a0f --- /dev/null +++ b/src/main/java/com/whop/api/resources/plans/types/UpdatePlansRequestThreeDsLevel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdatePlansRequestThreeDsLevel { + public static final UpdatePlansRequestThreeDsLevel MANDATE_CHALLENGE = + new UpdatePlansRequestThreeDsLevel(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + public static final UpdatePlansRequestThreeDsLevel FRICTIONLESS = + new UpdatePlansRequestThreeDsLevel(Value.FRICTIONLESS, "frictionless"); + + private final Value value; + + private final String string; + + UpdatePlansRequestThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdatePlansRequestThreeDsLevel + && this.string.equals(((UpdatePlansRequestThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case FRICTIONLESS: + return visitor.visitFrictionless(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdatePlansRequestThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + case "frictionless": + return FRICTIONLESS; + default: + return new UpdatePlansRequestThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + FRICTIONLESS, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitFrictionless(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/products/AsyncProductsClient.java b/src/main/java/com/whop/api/resources/products/AsyncProductsClient.java new file mode 100644 index 00000000..c0194cc9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/AsyncProductsClient.java @@ -0,0 +1,210 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.products.requests.CreateProductsRequest; +import com.whop.api.resources.products.requests.DeleteProductsRequest; +import com.whop.api.resources.products.requests.ListProductsRequest; +import com.whop.api.resources.products.requests.PublishProductsRequest; +import com.whop.api.resources.products.requests.RetrieveProductsRequest; +import com.whop.api.resources.products.requests.UnpublishProductsRequest; +import com.whop.api.resources.products.requests.UpdateProductsRequest; +import com.whop.api.resources.products.types.DeleteProductsResponse; +import com.whop.api.types.Product; +import com.whop.api.types.ProductListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncProductsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawProductsClient rawClient; + + public AsyncProductsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawProductsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawProductsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of products belonging to an account. + */ + public CompletableFuture> list(ListProductsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of products belonging to an account. + */ + public CompletableFuture> list( + ListProductsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates a new product for an account. + */ + public CompletableFuture create(CreateProductsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Creates a new product for an account. + */ + public CompletableFuture create(CreateProductsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public CompletableFuture retrieve(String id, RetrieveProductsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public CompletableFuture retrieve( + String id, RetrieveProductsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public CompletableFuture delete(String id, DeleteProductsRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public CompletableFuture delete( + String id, DeleteProductsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates an existing product. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Updates an existing product. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates an existing product. + */ + public CompletableFuture update(String id, UpdateProductsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Updates an existing product. + */ + public CompletableFuture update(String id, UpdateProductsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public CompletableFuture publish(String id) { + return this.rawClient.publish(id).thenApply(response -> response.body()); + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public CompletableFuture publish(String id, RequestOptions requestOptions) { + return this.rawClient.publish(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public CompletableFuture publish(String id, PublishProductsRequest request) { + return this.rawClient.publish(id, request).thenApply(response -> response.body()); + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public CompletableFuture publish( + String id, PublishProductsRequest request, RequestOptions requestOptions) { + return this.rawClient.publish(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public CompletableFuture unpublish(String id) { + return this.rawClient.unpublish(id).thenApply(response -> response.body()); + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public CompletableFuture unpublish(String id, RequestOptions requestOptions) { + return this.rawClient.unpublish(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public CompletableFuture unpublish(String id, UnpublishProductsRequest request) { + return this.rawClient.unpublish(id, request).thenApply(response -> response.body()); + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public CompletableFuture unpublish( + String id, UnpublishProductsRequest request, RequestOptions requestOptions) { + return this.rawClient.unpublish(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/products/AsyncRawProductsClient.java b/src/main/java/com/whop/api/resources/products/AsyncRawProductsClient.java new file mode 100644 index 00000000..95bcb2a8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/AsyncRawProductsClient.java @@ -0,0 +1,728 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.products.requests.CreateProductsRequest; +import com.whop.api.resources.products.requests.DeleteProductsRequest; +import com.whop.api.resources.products.requests.ListProductsRequest; +import com.whop.api.resources.products.requests.PublishProductsRequest; +import com.whop.api.resources.products.requests.RetrieveProductsRequest; +import com.whop.api.resources.products.requests.UnpublishProductsRequest; +import com.whop.api.resources.products.requests.UpdateProductsRequest; +import com.whop.api.resources.products.types.DeleteProductsResponse; +import com.whop.api.resources.products.types.ListProductsResponse; +import com.whop.api.types.Product; +import com.whop.api.types.ProductListItem; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawProductsClient { + protected final ClientOptions clientOptions; + + public AsyncRawProductsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of products belonging to an account. + */ + public CompletableFuture>> list( + ListProductsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of products belonging to an account. + */ + public CompletableFuture>> list( + ListProductsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("products"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getVisibilities().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "visibilities", request.getVisibilities().get(), true); + } + if (request.getAccessPassTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "access_pass_types", request.getAccessPassTypes().get(), true); + } + if (request.getLabels().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "labels", request.getLabels().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListProductsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListProductsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListProductsRequest nextRequest = ListProductsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates a new product for an account. + */ + public CompletableFuture> create(CreateProductsRequest request) { + return create(request, null); + } + + /** + * Creates a new product for an account. + */ + public CompletableFuture> create( + CreateProductsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("products"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Product.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveProductsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveProductsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public CompletableFuture> retrieve(String id, RetrieveProductsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public CompletableFuture> retrieve( + String id, RetrieveProductsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("products") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Product.class), response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteProductsRequest.builder().build()); + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public CompletableFuture> delete( + String id, RequestOptions requestOptions) { + return delete(id, DeleteProductsRequest.builder().build(), requestOptions); + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public CompletableFuture> delete( + String id, DeleteProductsRequest request) { + return delete(id, request, null); + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public CompletableFuture> delete( + String id, DeleteProductsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("products") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteProductsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates an existing product. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateProductsRequest.builder().build()); + } + + /** + * Updates an existing product. + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateProductsRequest.builder().build(), requestOptions); + } + + /** + * Updates an existing product. + */ + public CompletableFuture> update(String id, UpdateProductsRequest request) { + return update(id, request, null); + } + + /** + * Updates an existing product. + */ + public CompletableFuture> update( + String id, UpdateProductsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("products") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Product.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public CompletableFuture> publish(String id) { + return publish(id, PublishProductsRequest.builder().build()); + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public CompletableFuture> publish(String id, RequestOptions requestOptions) { + return publish(id, PublishProductsRequest.builder().build(), requestOptions); + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public CompletableFuture> publish(String id, PublishProductsRequest request) { + return publish(id, request, null); + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public CompletableFuture> publish( + String id, PublishProductsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("products") + .addPathSegment(id) + .addPathSegments("publish"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Product.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public CompletableFuture> unpublish(String id) { + return unpublish(id, UnpublishProductsRequest.builder().build()); + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public CompletableFuture> unpublish(String id, RequestOptions requestOptions) { + return unpublish(id, UnpublishProductsRequest.builder().build(), requestOptions); + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public CompletableFuture> unpublish(String id, UnpublishProductsRequest request) { + return unpublish(id, request, null); + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public CompletableFuture> unpublish( + String id, UnpublishProductsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("products") + .addPathSegment(id) + .addPathSegments("unpublish"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Product.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/products/ProductsClient.java b/src/main/java/com/whop/api/resources/products/ProductsClient.java new file mode 100644 index 00000000..c16f2d25 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/ProductsClient.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.products.requests.CreateProductsRequest; +import com.whop.api.resources.products.requests.DeleteProductsRequest; +import com.whop.api.resources.products.requests.ListProductsRequest; +import com.whop.api.resources.products.requests.PublishProductsRequest; +import com.whop.api.resources.products.requests.RetrieveProductsRequest; +import com.whop.api.resources.products.requests.UnpublishProductsRequest; +import com.whop.api.resources.products.requests.UpdateProductsRequest; +import com.whop.api.resources.products.types.DeleteProductsResponse; +import com.whop.api.types.Product; +import com.whop.api.types.ProductListItem; + +public class ProductsClient { + protected final ClientOptions clientOptions; + + private final RawProductsClient rawClient; + + public ProductsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawProductsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawProductsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of products belonging to an account. + */ + public SyncPagingIterable list(ListProductsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of products belonging to an account. + */ + public SyncPagingIterable list(ListProductsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Creates a new product for an account. + */ + public Product create(CreateProductsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Creates a new product for an account. + */ + public Product create(CreateProductsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public Product retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public Product retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public Product retrieve(String id, RetrieveProductsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public Product retrieve(String id, RetrieveProductsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public DeleteProductsResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public DeleteProductsResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public DeleteProductsResponse delete(String id, DeleteProductsRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public DeleteProductsResponse delete(String id, DeleteProductsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Updates an existing product. + */ + public Product update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Updates an existing product. + */ + public Product update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Updates an existing product. + */ + public Product update(String id, UpdateProductsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Updates an existing product. + */ + public Product update(String id, UpdateProductsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public Product publish(String id) { + return this.rawClient.publish(id).body(); + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public Product publish(String id, RequestOptions requestOptions) { + return this.rawClient.publish(id, requestOptions).body(); + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public Product publish(String id, PublishProductsRequest request) { + return this.rawClient.publish(id, request).body(); + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public Product publish(String id, PublishProductsRequest request, RequestOptions requestOptions) { + return this.rawClient.publish(id, request, requestOptions).body(); + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public Product unpublish(String id) { + return this.rawClient.unpublish(id).body(); + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public Product unpublish(String id, RequestOptions requestOptions) { + return this.rawClient.unpublish(id, requestOptions).body(); + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public Product unpublish(String id, UnpublishProductsRequest request) { + return this.rawClient.unpublish(id, request).body(); + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public Product unpublish(String id, UnpublishProductsRequest request, RequestOptions requestOptions) { + return this.rawClient.unpublish(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/products/RawProductsClient.java b/src/main/java/com/whop/api/resources/products/RawProductsClient.java new file mode 100644 index 00000000..d87222fa --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/RawProductsClient.java @@ -0,0 +1,594 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.products.requests.CreateProductsRequest; +import com.whop.api.resources.products.requests.DeleteProductsRequest; +import com.whop.api.resources.products.requests.ListProductsRequest; +import com.whop.api.resources.products.requests.PublishProductsRequest; +import com.whop.api.resources.products.requests.RetrieveProductsRequest; +import com.whop.api.resources.products.requests.UnpublishProductsRequest; +import com.whop.api.resources.products.requests.UpdateProductsRequest; +import com.whop.api.resources.products.types.DeleteProductsResponse; +import com.whop.api.resources.products.types.ListProductsResponse; +import com.whop.api.types.Product; +import com.whop.api.types.ProductListItem; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawProductsClient { + protected final ClientOptions clientOptions; + + public RawProductsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of products belonging to an account. + */ + public WhopApiHttpResponse> list(ListProductsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of products belonging to an account. + */ + public WhopApiHttpResponse> list( + ListProductsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("products"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getVisibilities().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "visibilities", request.getVisibilities().get(), true); + } + if (request.getAccessPassTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "access_pass_types", request.getAccessPassTypes().get(), true); + } + if (request.getLabels().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "labels", request.getLabels().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListProductsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListProductsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListProductsRequest nextRequest = ListProductsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates a new product for an account. + */ + public WhopApiHttpResponse create(CreateProductsRequest request) { + return create(request, null); + } + + /** + * Creates a new product for an account. + */ + public WhopApiHttpResponse create(CreateProductsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("products"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Product.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveProductsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveProductsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveProductsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing product. This endpoint is publicly accessible. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveProductsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("products") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Product.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteProductsRequest.builder().build()); + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteProductsRequest.builder().build(), requestOptions); + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public WhopApiHttpResponse delete(String id, DeleteProductsRequest request) { + return delete(id, request, null); + } + + /** + * Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted. + */ + public WhopApiHttpResponse delete( + String id, DeleteProductsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("products") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteProductsResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates an existing product. + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateProductsRequest.builder().build()); + } + + /** + * Updates an existing product. + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateProductsRequest.builder().build(), requestOptions); + } + + /** + * Updates an existing product. + */ + public WhopApiHttpResponse update(String id, UpdateProductsRequest request) { + return update(id, request, null); + } + + /** + * Updates an existing product. + */ + public WhopApiHttpResponse update( + String id, UpdateProductsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("products") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Product.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public WhopApiHttpResponse publish(String id) { + return publish(id, PublishProductsRequest.builder().build()); + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public WhopApiHttpResponse publish(String id, RequestOptions requestOptions) { + return publish(id, PublishProductsRequest.builder().build(), requestOptions); + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public WhopApiHttpResponse publish(String id, PublishProductsRequest request) { + return publish(id, request, null); + } + + /** + * Submits a product to the whop.com marketplace for review. The product moves to pending_review; a Whop reviewer approves it before it goes live. + */ + public WhopApiHttpResponse publish( + String id, PublishProductsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("products") + .addPathSegment(id) + .addPathSegments("publish"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Product.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public WhopApiHttpResponse unpublish(String id) { + return unpublish(id, UnpublishProductsRequest.builder().build()); + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public WhopApiHttpResponse unpublish(String id, RequestOptions requestOptions) { + return unpublish(id, UnpublishProductsRequest.builder().build(), requestOptions); + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public WhopApiHttpResponse unpublish(String id, UnpublishProductsRequest request) { + return unpublish(id, request, null); + } + + /** + * Removes a product from the whop.com marketplace. The product moves to not_available. + */ + public WhopApiHttpResponse unpublish( + String id, UnpublishProductsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("products") + .addPathSegment(id) + .addPathSegments("unpublish"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Product.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/requests/CreateProductsRequest.java b/src/main/java/com/whop/api/resources/products/requests/CreateProductsRequest.java new file mode 100644 index 00000000..974476df --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/requests/CreateProductsRequest.java @@ -0,0 +1,1333 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.products.types.CreateProductsRequestCustomCta; +import com.whop.api.resources.products.types.CreateProductsRequestGlobalAffiliateStatus; +import com.whop.api.resources.products.types.CreateProductsRequestMemberAffiliateStatus; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateProductsRequest.Builder.class) +public final class CreateProductsRequest { + private final Optional accountId; + + private final Optional collectShippingAddress; + + private final Optional customCta; + + private final Optional customCtaUrl; + + private final Optional customStatementDescriptor; + + private final Optional description; + + private final Optional globalAffiliatePercentage; + + private final Optional globalAffiliateStatus; + + private final Optional headline; + + private final Optional> labels; + + private final Optional memberAffiliatePercentage; + + private final Optional memberAffiliateStatus; + + private final Optional> metadata; + + private final Optional productTaxCodeId; + + private final Optional redirectPurchaseUrl; + + private final Optional route; + + private final Optional sendWelcomeMessage; + + private final String title; + + private final Optional visibility; + + private final Map additionalProperties; + + private CreateProductsRequest( + Optional accountId, + Optional collectShippingAddress, + Optional customCta, + Optional customCtaUrl, + Optional customStatementDescriptor, + Optional description, + Optional globalAffiliatePercentage, + Optional globalAffiliateStatus, + Optional headline, + Optional> labels, + Optional memberAffiliatePercentage, + Optional memberAffiliateStatus, + Optional> metadata, + Optional productTaxCodeId, + Optional redirectPurchaseUrl, + Optional route, + Optional sendWelcomeMessage, + String title, + Optional visibility, + Map additionalProperties) { + this.accountId = accountId; + this.collectShippingAddress = collectShippingAddress; + this.customCta = customCta; + this.customCtaUrl = customCtaUrl; + this.customStatementDescriptor = customStatementDescriptor; + this.description = description; + this.globalAffiliatePercentage = globalAffiliatePercentage; + this.globalAffiliateStatus = globalAffiliateStatus; + this.headline = headline; + this.labels = labels; + this.memberAffiliatePercentage = memberAffiliatePercentage; + this.memberAffiliateStatus = memberAffiliateStatus; + this.metadata = metadata; + this.productTaxCodeId = productTaxCodeId; + this.redirectPurchaseUrl = redirectPurchaseUrl; + this.route = route; + this.sendWelcomeMessage = sendWelcomeMessage; + this.title = title; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the account to create this product for. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Whether to collect a shipping address at checkout. + */ + @JsonIgnore + public Optional getCollectShippingAddress() { + if (collectShippingAddress == null) { + return Optional.empty(); + } + return collectShippingAddress; + } + + /** + * @return The call-to-action button label. + */ + @JsonIgnore + public Optional getCustomCta() { + if (customCta == null) { + return Optional.empty(); + } + return customCta; + } + + /** + * @return A URL the call-to-action button links to. + */ + @JsonIgnore + public Optional getCustomCtaUrl() { + if (customCtaUrl == null) { + return Optional.empty(); + } + return customCtaUrl; + } + + /** + * @return Custom bank statement descriptor. Must start with WHOP*. + */ + @JsonIgnore + public Optional getCustomStatementDescriptor() { + if (customStatementDescriptor == null) { + return Optional.empty(); + } + return customStatementDescriptor; + } + + /** + * @return A written description displayed on the product page. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The commission rate affiliates earn. + */ + @JsonIgnore + public Optional getGlobalAffiliatePercentage() { + if (globalAffiliatePercentage == null) { + return Optional.empty(); + } + return globalAffiliatePercentage; + } + + /** + * @return The enrollment status in the global affiliate program. + */ + @JsonProperty("global_affiliate_status") + public Optional getGlobalAffiliateStatus() { + return globalAffiliateStatus; + } + + /** + * @return A short marketing headline for the product page. + */ + @JsonIgnore + public Optional getHeadline() { + if (headline == null) { + return Optional.empty(); + } + return headline; + } + + /** + * @return Labels used to group products into collections. Stored lowercased and de-duplicated. Maximum 20 labels, 50 characters each. + */ + @JsonIgnore + public Optional> getLabels() { + if (labels == null) { + return Optional.empty(); + } + return labels; + } + + /** + * @return The commission rate members earn. + */ + @JsonIgnore + public Optional getMemberAffiliatePercentage() { + if (memberAffiliatePercentage == null) { + return Optional.empty(); + } + return memberAffiliatePercentage; + } + + /** + * @return The enrollment status in the member affiliate program. + */ + @JsonProperty("member_affiliate_status") + public Optional getMemberAffiliateStatus() { + return memberAffiliateStatus; + } + + /** + * @return Custom key-value pairs to store on the product. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The unique identifier of the tax classification code. See the available product categories. + */ + @JsonIgnore + public Optional getProductTaxCodeId() { + if (productTaxCodeId == null) { + return Optional.empty(); + } + return productTaxCodeId; + } + + /** + * @return A URL to redirect the customer to after purchase. + */ + @JsonIgnore + public Optional getRedirectPurchaseUrl() { + if (redirectPurchaseUrl == null) { + return Optional.empty(); + } + return redirectPurchaseUrl; + } + + /** + * @return The URL slug for the product's public link. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Whether to send an automated welcome message via support chat when a user joins this product. Defaults to true. + */ + @JsonIgnore + public Optional getSendWelcomeMessage() { + if (sendWelcomeMessage == null) { + return Optional.empty(); + } + return sendWelcomeMessage; + } + + /** + * @return The display name of the product. Maximum 80 characters. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return Whether the product is visible to customers. + */ + @JsonProperty("visibility") + public Optional getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("collect_shipping_address") + private Optional _getCollectShippingAddress() { + return collectShippingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_cta") + private Optional _getCustomCta() { + return customCta; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_cta_url") + private Optional _getCustomCtaUrl() { + return customCtaUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_statement_descriptor") + private Optional _getCustomStatementDescriptor() { + return customStatementDescriptor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("global_affiliate_percentage") + private Optional _getGlobalAffiliatePercentage() { + return globalAffiliatePercentage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("headline") + private Optional _getHeadline() { + return headline; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("labels") + private Optional> _getLabels() { + return labels; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member_affiliate_percentage") + private Optional _getMemberAffiliatePercentage() { + return memberAffiliatePercentage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_tax_code_id") + private Optional _getProductTaxCodeId() { + return productTaxCodeId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("redirect_purchase_url") + private Optional _getRedirectPurchaseUrl() { + return redirectPurchaseUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("send_welcome_message") + private Optional _getSendWelcomeMessage() { + return sendWelcomeMessage; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateProductsRequest && equalTo((CreateProductsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateProductsRequest other) { + return accountId.equals(other.accountId) + && collectShippingAddress.equals(other.collectShippingAddress) + && customCta.equals(other.customCta) + && customCtaUrl.equals(other.customCtaUrl) + && customStatementDescriptor.equals(other.customStatementDescriptor) + && description.equals(other.description) + && globalAffiliatePercentage.equals(other.globalAffiliatePercentage) + && globalAffiliateStatus.equals(other.globalAffiliateStatus) + && headline.equals(other.headline) + && labels.equals(other.labels) + && memberAffiliatePercentage.equals(other.memberAffiliatePercentage) + && memberAffiliateStatus.equals(other.memberAffiliateStatus) + && metadata.equals(other.metadata) + && productTaxCodeId.equals(other.productTaxCodeId) + && redirectPurchaseUrl.equals(other.redirectPurchaseUrl) + && route.equals(other.route) + && sendWelcomeMessage.equals(other.sendWelcomeMessage) + && title.equals(other.title) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.collectShippingAddress, + this.customCta, + this.customCtaUrl, + this.customStatementDescriptor, + this.description, + this.globalAffiliatePercentage, + this.globalAffiliateStatus, + this.headline, + this.labels, + this.memberAffiliatePercentage, + this.memberAffiliateStatus, + this.metadata, + this.productTaxCodeId, + this.redirectPurchaseUrl, + this.route, + this.sendWelcomeMessage, + this.title, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TitleStage builder() { + return new Builder(); + } + + public interface TitleStage { + /** + *

The display name of the product. Maximum 80 characters.

+ */ + _FinalStage title(@NotNull String title); + + Builder from(CreateProductsRequest other); + } + + public interface _FinalStage { + CreateProductsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The unique identifier of the account to create this product for.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + /** + *

Whether to collect a shipping address at checkout.

+ */ + _FinalStage collectShippingAddress(Optional collectShippingAddress); + + _FinalStage collectShippingAddress(Boolean collectShippingAddress); + + _FinalStage collectShippingAddress(Nullable collectShippingAddress); + + /** + *

The call-to-action button label.

+ */ + _FinalStage customCta(Optional customCta); + + _FinalStage customCta(CreateProductsRequestCustomCta customCta); + + _FinalStage customCta(Nullable customCta); + + /** + *

A URL the call-to-action button links to.

+ */ + _FinalStage customCtaUrl(Optional customCtaUrl); + + _FinalStage customCtaUrl(String customCtaUrl); + + _FinalStage customCtaUrl(Nullable customCtaUrl); + + /** + *

Custom bank statement descriptor. Must start with WHOP*.

+ */ + _FinalStage customStatementDescriptor(Optional customStatementDescriptor); + + _FinalStage customStatementDescriptor(String customStatementDescriptor); + + _FinalStage customStatementDescriptor(Nullable customStatementDescriptor); + + /** + *

A written description displayed on the product page.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

The commission rate affiliates earn.

+ */ + _FinalStage globalAffiliatePercentage(Optional globalAffiliatePercentage); + + _FinalStage globalAffiliatePercentage(Double globalAffiliatePercentage); + + _FinalStage globalAffiliatePercentage(Nullable globalAffiliatePercentage); + + /** + *

The enrollment status in the global affiliate program.

+ */ + _FinalStage globalAffiliateStatus(Optional globalAffiliateStatus); + + _FinalStage globalAffiliateStatus(CreateProductsRequestGlobalAffiliateStatus globalAffiliateStatus); + + /** + *

A short marketing headline for the product page.

+ */ + _FinalStage headline(Optional headline); + + _FinalStage headline(String headline); + + _FinalStage headline(Nullable headline); + + /** + *

Labels used to group products into collections. Stored lowercased and de-duplicated. Maximum 20 labels, 50 characters each.

+ */ + _FinalStage labels(Optional> labels); + + _FinalStage labels(List labels); + + _FinalStage labels(Nullable> labels); + + /** + *

The commission rate members earn.

+ */ + _FinalStage memberAffiliatePercentage(Optional memberAffiliatePercentage); + + _FinalStage memberAffiliatePercentage(Double memberAffiliatePercentage); + + _FinalStage memberAffiliatePercentage(Nullable memberAffiliatePercentage); + + /** + *

The enrollment status in the member affiliate program.

+ */ + _FinalStage memberAffiliateStatus(Optional memberAffiliateStatus); + + _FinalStage memberAffiliateStatus(CreateProductsRequestMemberAffiliateStatus memberAffiliateStatus); + + /** + *

Custom key-value pairs to store on the product.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The unique identifier of the tax classification code. See the available product categories.

+ */ + _FinalStage productTaxCodeId(Optional productTaxCodeId); + + _FinalStage productTaxCodeId(String productTaxCodeId); + + _FinalStage productTaxCodeId(Nullable productTaxCodeId); + + /** + *

A URL to redirect the customer to after purchase.

+ */ + _FinalStage redirectPurchaseUrl(Optional redirectPurchaseUrl); + + _FinalStage redirectPurchaseUrl(String redirectPurchaseUrl); + + _FinalStage redirectPurchaseUrl(Nullable redirectPurchaseUrl); + + /** + *

The URL slug for the product's public link.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

Whether to send an automated welcome message via support chat when a user joins this product. Defaults to true.

+ */ + _FinalStage sendWelcomeMessage(Optional sendWelcomeMessage); + + _FinalStage sendWelcomeMessage(Boolean sendWelcomeMessage); + + _FinalStage sendWelcomeMessage(Nullable sendWelcomeMessage); + + /** + *

Whether the product is visible to customers.

+ */ + _FinalStage visibility(Optional visibility); + + _FinalStage visibility(String visibility); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TitleStage, _FinalStage { + private String title; + + private Optional visibility = Optional.empty(); + + private Optional sendWelcomeMessage = Optional.empty(); + + private Optional route = Optional.empty(); + + private Optional redirectPurchaseUrl = Optional.empty(); + + private Optional productTaxCodeId = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional memberAffiliateStatus = Optional.empty(); + + private Optional memberAffiliatePercentage = Optional.empty(); + + private Optional> labels = Optional.empty(); + + private Optional headline = Optional.empty(); + + private Optional globalAffiliateStatus = Optional.empty(); + + private Optional globalAffiliatePercentage = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional customStatementDescriptor = Optional.empty(); + + private Optional customCtaUrl = Optional.empty(); + + private Optional customCta = Optional.empty(); + + private Optional collectShippingAddress = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateProductsRequest other) { + accountId(other.getAccountId()); + collectShippingAddress(other.getCollectShippingAddress()); + customCta(other.getCustomCta()); + customCtaUrl(other.getCustomCtaUrl()); + customStatementDescriptor(other.getCustomStatementDescriptor()); + description(other.getDescription()); + globalAffiliatePercentage(other.getGlobalAffiliatePercentage()); + globalAffiliateStatus(other.getGlobalAffiliateStatus()); + headline(other.getHeadline()); + labels(other.getLabels()); + memberAffiliatePercentage(other.getMemberAffiliatePercentage()); + memberAffiliateStatus(other.getMemberAffiliateStatus()); + metadata(other.getMetadata()); + productTaxCodeId(other.getProductTaxCodeId()); + redirectPurchaseUrl(other.getRedirectPurchaseUrl()); + route(other.getRoute()); + sendWelcomeMessage(other.getSendWelcomeMessage()); + title(other.getTitle()); + visibility(other.getVisibility()); + return this; + } + + /** + *

The display name of the product. Maximum 80 characters.

+ *

The display name of the product. Maximum 80 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Whether the product is visible to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(String visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + /** + *

Whether the product is visible to customers.

+ */ + @java.lang.Override + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public _FinalStage visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + /** + *

Whether to send an automated welcome message via support chat when a user joins this product. Defaults to true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sendWelcomeMessage(Nullable sendWelcomeMessage) { + if (sendWelcomeMessage.isNull()) { + this.sendWelcomeMessage = null; + } else if (sendWelcomeMessage.isEmpty()) { + this.sendWelcomeMessage = Optional.empty(); + } else { + this.sendWelcomeMessage = Optional.of(sendWelcomeMessage.get()); + } + return this; + } + + /** + *

Whether to send an automated welcome message via support chat when a user joins this product. Defaults to true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sendWelcomeMessage(Boolean sendWelcomeMessage) { + this.sendWelcomeMessage = Optional.ofNullable(sendWelcomeMessage); + return this; + } + + /** + *

Whether to send an automated welcome message via support chat when a user joins this product. Defaults to true.

+ */ + @java.lang.Override + @JsonSetter(value = "send_welcome_message", nulls = Nulls.SKIP) + public _FinalStage sendWelcomeMessage(Optional sendWelcomeMessage) { + this.sendWelcomeMessage = sendWelcomeMessage; + return this; + } + + /** + *

The URL slug for the product's public link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

The URL slug for the product's public link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

The URL slug for the product's public link.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + /** + *

A URL to redirect the customer to after purchase.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectPurchaseUrl(Nullable redirectPurchaseUrl) { + if (redirectPurchaseUrl.isNull()) { + this.redirectPurchaseUrl = null; + } else if (redirectPurchaseUrl.isEmpty()) { + this.redirectPurchaseUrl = Optional.empty(); + } else { + this.redirectPurchaseUrl = Optional.of(redirectPurchaseUrl.get()); + } + return this; + } + + /** + *

A URL to redirect the customer to after purchase.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectPurchaseUrl(String redirectPurchaseUrl) { + this.redirectPurchaseUrl = Optional.ofNullable(redirectPurchaseUrl); + return this; + } + + /** + *

A URL to redirect the customer to after purchase.

+ */ + @java.lang.Override + @JsonSetter(value = "redirect_purchase_url", nulls = Nulls.SKIP) + public _FinalStage redirectPurchaseUrl(Optional redirectPurchaseUrl) { + this.redirectPurchaseUrl = redirectPurchaseUrl; + return this; + } + + /** + *

The unique identifier of the tax classification code. See the available product categories.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productTaxCodeId(Nullable productTaxCodeId) { + if (productTaxCodeId.isNull()) { + this.productTaxCodeId = null; + } else if (productTaxCodeId.isEmpty()) { + this.productTaxCodeId = Optional.empty(); + } else { + this.productTaxCodeId = Optional.of(productTaxCodeId.get()); + } + return this; + } + + /** + *

The unique identifier of the tax classification code. See the available product categories.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productTaxCodeId(String productTaxCodeId) { + this.productTaxCodeId = Optional.ofNullable(productTaxCodeId); + return this; + } + + /** + *

The unique identifier of the tax classification code. See the available product categories.

+ */ + @java.lang.Override + @JsonSetter(value = "product_tax_code_id", nulls = Nulls.SKIP) + public _FinalStage productTaxCodeId(Optional productTaxCodeId) { + this.productTaxCodeId = productTaxCodeId; + return this; + } + + /** + *

Custom key-value pairs to store on the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs to store on the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs to store on the product.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The enrollment status in the member affiliate program.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memberAffiliateStatus(CreateProductsRequestMemberAffiliateStatus memberAffiliateStatus) { + this.memberAffiliateStatus = Optional.ofNullable(memberAffiliateStatus); + return this; + } + + /** + *

The enrollment status in the member affiliate program.

+ */ + @java.lang.Override + @JsonSetter(value = "member_affiliate_status", nulls = Nulls.SKIP) + public _FinalStage memberAffiliateStatus( + Optional memberAffiliateStatus) { + this.memberAffiliateStatus = memberAffiliateStatus; + return this; + } + + /** + *

The commission rate members earn.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memberAffiliatePercentage(Nullable memberAffiliatePercentage) { + if (memberAffiliatePercentage.isNull()) { + this.memberAffiliatePercentage = null; + } else if (memberAffiliatePercentage.isEmpty()) { + this.memberAffiliatePercentage = Optional.empty(); + } else { + this.memberAffiliatePercentage = Optional.of(memberAffiliatePercentage.get()); + } + return this; + } + + /** + *

The commission rate members earn.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memberAffiliatePercentage(Double memberAffiliatePercentage) { + this.memberAffiliatePercentage = Optional.ofNullable(memberAffiliatePercentage); + return this; + } + + /** + *

The commission rate members earn.

+ */ + @java.lang.Override + @JsonSetter(value = "member_affiliate_percentage", nulls = Nulls.SKIP) + public _FinalStage memberAffiliatePercentage(Optional memberAffiliatePercentage) { + this.memberAffiliatePercentage = memberAffiliatePercentage; + return this; + } + + /** + *

Labels used to group products into collections. Stored lowercased and de-duplicated. Maximum 20 labels, 50 characters each.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage labels(Nullable> labels) { + if (labels.isNull()) { + this.labels = null; + } else if (labels.isEmpty()) { + this.labels = Optional.empty(); + } else { + this.labels = Optional.of(labels.get()); + } + return this; + } + + /** + *

Labels used to group products into collections. Stored lowercased and de-duplicated. Maximum 20 labels, 50 characters each.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage labels(List labels) { + this.labels = Optional.ofNullable(labels); + return this; + } + + /** + *

Labels used to group products into collections. Stored lowercased and de-duplicated. Maximum 20 labels, 50 characters each.

+ */ + @java.lang.Override + @JsonSetter(value = "labels", nulls = Nulls.SKIP) + public _FinalStage labels(Optional> labels) { + this.labels = labels; + return this; + } + + /** + *

A short marketing headline for the product page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage headline(Nullable headline) { + if (headline.isNull()) { + this.headline = null; + } else if (headline.isEmpty()) { + this.headline = Optional.empty(); + } else { + this.headline = Optional.of(headline.get()); + } + return this; + } + + /** + *

A short marketing headline for the product page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage headline(String headline) { + this.headline = Optional.ofNullable(headline); + return this; + } + + /** + *

A short marketing headline for the product page.

+ */ + @java.lang.Override + @JsonSetter(value = "headline", nulls = Nulls.SKIP) + public _FinalStage headline(Optional headline) { + this.headline = headline; + return this; + } + + /** + *

The enrollment status in the global affiliate program.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage globalAffiliateStatus(CreateProductsRequestGlobalAffiliateStatus globalAffiliateStatus) { + this.globalAffiliateStatus = Optional.ofNullable(globalAffiliateStatus); + return this; + } + + /** + *

The enrollment status in the global affiliate program.

+ */ + @java.lang.Override + @JsonSetter(value = "global_affiliate_status", nulls = Nulls.SKIP) + public _FinalStage globalAffiliateStatus( + Optional globalAffiliateStatus) { + this.globalAffiliateStatus = globalAffiliateStatus; + return this; + } + + /** + *

The commission rate affiliates earn.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage globalAffiliatePercentage(Nullable globalAffiliatePercentage) { + if (globalAffiliatePercentage.isNull()) { + this.globalAffiliatePercentage = null; + } else if (globalAffiliatePercentage.isEmpty()) { + this.globalAffiliatePercentage = Optional.empty(); + } else { + this.globalAffiliatePercentage = Optional.of(globalAffiliatePercentage.get()); + } + return this; + } + + /** + *

The commission rate affiliates earn.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage globalAffiliatePercentage(Double globalAffiliatePercentage) { + this.globalAffiliatePercentage = Optional.ofNullable(globalAffiliatePercentage); + return this; + } + + /** + *

The commission rate affiliates earn.

+ */ + @java.lang.Override + @JsonSetter(value = "global_affiliate_percentage", nulls = Nulls.SKIP) + public _FinalStage globalAffiliatePercentage(Optional globalAffiliatePercentage) { + this.globalAffiliatePercentage = globalAffiliatePercentage; + return this; + } + + /** + *

A written description displayed on the product page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

A written description displayed on the product page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

A written description displayed on the product page.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

Custom bank statement descriptor. Must start with WHOP*.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customStatementDescriptor(Nullable customStatementDescriptor) { + if (customStatementDescriptor.isNull()) { + this.customStatementDescriptor = null; + } else if (customStatementDescriptor.isEmpty()) { + this.customStatementDescriptor = Optional.empty(); + } else { + this.customStatementDescriptor = Optional.of(customStatementDescriptor.get()); + } + return this; + } + + /** + *

Custom bank statement descriptor. Must start with WHOP*.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customStatementDescriptor(String customStatementDescriptor) { + this.customStatementDescriptor = Optional.ofNullable(customStatementDescriptor); + return this; + } + + /** + *

Custom bank statement descriptor. Must start with WHOP*.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_statement_descriptor", nulls = Nulls.SKIP) + public _FinalStage customStatementDescriptor(Optional customStatementDescriptor) { + this.customStatementDescriptor = customStatementDescriptor; + return this; + } + + /** + *

A URL the call-to-action button links to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customCtaUrl(Nullable customCtaUrl) { + if (customCtaUrl.isNull()) { + this.customCtaUrl = null; + } else if (customCtaUrl.isEmpty()) { + this.customCtaUrl = Optional.empty(); + } else { + this.customCtaUrl = Optional.of(customCtaUrl.get()); + } + return this; + } + + /** + *

A URL the call-to-action button links to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customCtaUrl(String customCtaUrl) { + this.customCtaUrl = Optional.ofNullable(customCtaUrl); + return this; + } + + /** + *

A URL the call-to-action button links to.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_cta_url", nulls = Nulls.SKIP) + public _FinalStage customCtaUrl(Optional customCtaUrl) { + this.customCtaUrl = customCtaUrl; + return this; + } + + /** + *

The call-to-action button label.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customCta(Nullable customCta) { + if (customCta.isNull()) { + this.customCta = null; + } else if (customCta.isEmpty()) { + this.customCta = Optional.empty(); + } else { + this.customCta = Optional.of(customCta.get()); + } + return this; + } + + /** + *

The call-to-action button label.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customCta(CreateProductsRequestCustomCta customCta) { + this.customCta = Optional.ofNullable(customCta); + return this; + } + + /** + *

The call-to-action button label.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_cta", nulls = Nulls.SKIP) + public _FinalStage customCta(Optional customCta) { + this.customCta = customCta; + return this; + } + + /** + *

Whether to collect a shipping address at checkout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage collectShippingAddress(Nullable collectShippingAddress) { + if (collectShippingAddress.isNull()) { + this.collectShippingAddress = null; + } else if (collectShippingAddress.isEmpty()) { + this.collectShippingAddress = Optional.empty(); + } else { + this.collectShippingAddress = Optional.of(collectShippingAddress.get()); + } + return this; + } + + /** + *

Whether to collect a shipping address at checkout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage collectShippingAddress(Boolean collectShippingAddress) { + this.collectShippingAddress = Optional.ofNullable(collectShippingAddress); + return this; + } + + /** + *

Whether to collect a shipping address at checkout.

+ */ + @java.lang.Override + @JsonSetter(value = "collect_shipping_address", nulls = Nulls.SKIP) + public _FinalStage collectShippingAddress(Optional collectShippingAddress) { + this.collectShippingAddress = collectShippingAddress; + return this; + } + + /** + *

The unique identifier of the account to create this product for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The unique identifier of the account to create this product for.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public CreateProductsRequest build() { + return new CreateProductsRequest( + accountId, + collectShippingAddress, + customCta, + customCtaUrl, + customStatementDescriptor, + description, + globalAffiliatePercentage, + globalAffiliateStatus, + headline, + labels, + memberAffiliatePercentage, + memberAffiliateStatus, + metadata, + productTaxCodeId, + redirectPurchaseUrl, + route, + sendWelcomeMessage, + title, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/requests/DeleteProductsRequest.java b/src/main/java/com/whop/api/resources/products/requests/DeleteProductsRequest.java new file mode 100644 index 00000000..b5d393b7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/requests/DeleteProductsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteProductsRequest.Builder.class) +public final class DeleteProductsRequest { + private final Map additionalProperties; + + private DeleteProductsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteProductsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteProductsRequest other) { + return this; + } + + public DeleteProductsRequest build() { + return new DeleteProductsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/requests/ListProductsRequest.java b/src/main/java/com/whop/api/resources/products/requests/ListProductsRequest.java new file mode 100644 index 00000000..40d62319 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/requests/ListProductsRequest.java @@ -0,0 +1,568 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.products.types.ListProductsRequestDirection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListProductsRequest.Builder.class) +public final class ListProductsRequest { + private final Optional> visibilities; + + private final Optional> accessPassTypes; + + private final Optional> labels; + + private final String accountId; + + private final Optional direction; + + private final Optional order; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListProductsRequest( + Optional> visibilities, + Optional> accessPassTypes, + Optional> labels, + String accountId, + Optional direction, + Optional order, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.visibilities = visibilities; + this.accessPassTypes = accessPassTypes; + this.labels = labels; + this.accountId = accountId; + this.direction = direction; + this.order = order; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Filter to only products matching these visibility states. + */ + @JsonProperty("visibilities") + public Optional> getVisibilities() { + return visibilities; + } + + /** + * @return Filter to only products matching these types. + */ + @JsonProperty("access_pass_types") + public Optional> getAccessPassTypes() { + return accessPassTypes; + } + + /** + * @return Filter to only products carrying all of these labels. Labels are matched lowercased. + */ + @JsonProperty("labels") + public Optional> getLabels() { + return labels; + } + + /** + * @return The unique identifier of the account to list products for. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return The sort direction for results. Defaults to descending. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return The field to sort results by. Defaults to created_at. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return The number of products to return (default and max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns products after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of products to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns products before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProductsRequest && equalTo((ListProductsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProductsRequest other) { + return visibilities.equals(other.visibilities) + && accessPassTypes.equals(other.accessPassTypes) + && labels.equals(other.labels) + && accountId.equals(other.accountId) + && direction.equals(other.direction) + && order.equals(other.order) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.visibilities, + this.accessPassTypes, + this.labels, + this.accountId, + this.direction, + this.order, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

The unique identifier of the account to list products for.

+ */ + _FinalStage accountId(@NotNull String accountId); + + Builder from(ListProductsRequest other); + } + + public interface _FinalStage { + ListProductsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Filter to only products matching these visibility states.

+ */ + _FinalStage visibilities(Optional> visibilities); + + _FinalStage visibilities(List visibilities); + + _FinalStage visibilities(String visibilities); + + /** + *

Filter to only products matching these types.

+ */ + _FinalStage accessPassTypes(Optional> accessPassTypes); + + _FinalStage accessPassTypes(List accessPassTypes); + + _FinalStage accessPassTypes(String accessPassTypes); + + /** + *

Filter to only products carrying all of these labels. Labels are matched lowercased.

+ */ + _FinalStage labels(Optional> labels); + + _FinalStage labels(List labels); + + _FinalStage labels(String labels); + + /** + *

The sort direction for results. Defaults to descending.

+ */ + _FinalStage direction(Optional direction); + + _FinalStage direction(ListProductsRequestDirection direction); + + /** + *

The field to sort results by. Defaults to created_at.

+ */ + _FinalStage order(Optional order); + + _FinalStage order(String order); + + /** + *

The number of products to return (default and max 100).

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

A cursor; returns products after this position.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

The number of products to return from the end of the range.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + /** + *

A cursor; returns products before this position.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, _FinalStage { + private String accountId; + + private Optional before = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional> labels = Optional.empty(); + + private Optional> accessPassTypes = Optional.empty(); + + private Optional> visibilities = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListProductsRequest other) { + visibilities(other.getVisibilities()); + accessPassTypes(other.getAccessPassTypes()); + labels(other.getLabels()); + accountId(other.getAccountId()); + direction(other.getDirection()); + order(other.getOrder()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

The unique identifier of the account to list products for.

+ *

The unique identifier of the account to list products for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

A cursor; returns products before this position.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

A cursor; returns products before this position.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

The number of products to return from the end of the range.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The number of products to return from the end of the range.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

A cursor; returns products after this position.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

A cursor; returns products after this position.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + /** + *

The number of products to return (default and max 100).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

The number of products to return (default and max 100).

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

The field to sort results by. Defaults to created_at.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(String order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The field to sort results by. Defaults to created_at.

+ */ + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + /** + *

The sort direction for results. Defaults to descending.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage direction(ListProductsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

The sort direction for results. Defaults to descending.

+ */ + @java.lang.Override + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public _FinalStage direction(Optional direction) { + this.direction = direction; + return this; + } + + @java.lang.Override + public _FinalStage labels(String labels) { + this.labels = Optional.of(Collections.singletonList(labels)); + return this; + } + + /** + *

Filter to only products carrying all of these labels. Labels are matched lowercased.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage labels(List labels) { + this.labels = Optional.ofNullable(labels); + return this; + } + + /** + *

Filter to only products carrying all of these labels. Labels are matched lowercased.

+ */ + @java.lang.Override + @JsonSetter(value = "labels", nulls = Nulls.SKIP) + public _FinalStage labels(Optional> labels) { + this.labels = labels; + return this; + } + + @java.lang.Override + public _FinalStage accessPassTypes(String accessPassTypes) { + this.accessPassTypes = Optional.of(Collections.singletonList(accessPassTypes)); + return this; + } + + /** + *

Filter to only products matching these types.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accessPassTypes(List accessPassTypes) { + this.accessPassTypes = Optional.ofNullable(accessPassTypes); + return this; + } + + /** + *

Filter to only products matching these types.

+ */ + @java.lang.Override + @JsonSetter(value = "access_pass_types", nulls = Nulls.SKIP) + public _FinalStage accessPassTypes(Optional> accessPassTypes) { + this.accessPassTypes = accessPassTypes; + return this; + } + + @java.lang.Override + public _FinalStage visibilities(String visibilities) { + this.visibilities = Optional.of(Collections.singletonList(visibilities)); + return this; + } + + /** + *

Filter to only products matching these visibility states.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibilities(List visibilities) { + this.visibilities = Optional.ofNullable(visibilities); + return this; + } + + /** + *

Filter to only products matching these visibility states.

+ */ + @java.lang.Override + @JsonSetter(value = "visibilities", nulls = Nulls.SKIP) + public _FinalStage visibilities(Optional> visibilities) { + this.visibilities = visibilities; + return this; + } + + @java.lang.Override + public ListProductsRequest build() { + return new ListProductsRequest( + visibilities, + accessPassTypes, + labels, + accountId, + direction, + order, + first, + after, + last, + before, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/requests/PublishProductsRequest.java b/src/main/java/com/whop/api/resources/products/requests/PublishProductsRequest.java new file mode 100644 index 00000000..72e02baa --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/requests/PublishProductsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PublishProductsRequest.Builder.class) +public final class PublishProductsRequest { + private final Map additionalProperties; + + private PublishProductsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PublishProductsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PublishProductsRequest other) { + return this; + } + + public PublishProductsRequest build() { + return new PublishProductsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/requests/RetrieveProductsRequest.java b/src/main/java/com/whop/api/resources/products/requests/RetrieveProductsRequest.java new file mode 100644 index 00000000..243d9fda --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/requests/RetrieveProductsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveProductsRequest.Builder.class) +public final class RetrieveProductsRequest { + private final Map additionalProperties; + + private RetrieveProductsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveProductsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveProductsRequest other) { + return this; + } + + public RetrieveProductsRequest build() { + return new RetrieveProductsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/requests/UnpublishProductsRequest.java b/src/main/java/com/whop/api/resources/products/requests/UnpublishProductsRequest.java new file mode 100644 index 00000000..574b3462 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/requests/UnpublishProductsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UnpublishProductsRequest.Builder.class) +public final class UnpublishProductsRequest { + private final Map additionalProperties; + + private UnpublishProductsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UnpublishProductsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UnpublishProductsRequest other) { + return this; + } + + public UnpublishProductsRequest build() { + return new UnpublishProductsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/requests/UpdateProductsRequest.java b/src/main/java/com/whop/api/resources/products/requests/UpdateProductsRequest.java new file mode 100644 index 00000000..07e82f93 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/requests/UpdateProductsRequest.java @@ -0,0 +1,517 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.products.types.UpdateProductsRequestBannerImage; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateProductsRequest.Builder.class) +public final class UpdateProductsRequest { + private final Optional bannerImage; + + private final Optional description; + + private final Optional headline; + + private final Optional> labels; + + private final Optional> metadata; + + private final Optional productTaxCodeId; + + private final Optional sendWelcomeMessage; + + private final Optional title; + + private final Optional visibility; + + private final Map additionalProperties; + + private UpdateProductsRequest( + Optional bannerImage, + Optional description, + Optional headline, + Optional> labels, + Optional> metadata, + Optional productTaxCodeId, + Optional sendWelcomeMessage, + Optional title, + Optional visibility, + Map additionalProperties) { + this.bannerImage = bannerImage; + this.description = description; + this.headline = headline; + this.labels = labels; + this.metadata = metadata; + this.productTaxCodeId = productTaxCodeId; + this.sendWelcomeMessage = sendWelcomeMessage; + this.title = title; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return A wide image for the product, shown on the product page and on listing cards. Pass { id } for an existing attachment or { direct_upload_id } for a completed direct upload; null removes it. + */ + @JsonIgnore + public Optional getBannerImage() { + if (bannerImage == null) { + return Optional.empty(); + } + return bannerImage; + } + + /** + * @return A written description displayed on the product page. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return A short marketing headline for the product page. + */ + @JsonIgnore + public Optional getHeadline() { + if (headline == null) { + return Optional.empty(); + } + return headline; + } + + /** + * @return Labels used to group products into collections. Replaces the existing labels. Send an empty array to clear them. + */ + @JsonIgnore + public Optional> getLabels() { + if (labels == null) { + return Optional.empty(); + } + return labels; + } + + /** + * @return Custom key-value pairs to store on the product. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The unique identifier of the tax classification code. See the available product categories. + */ + @JsonIgnore + public Optional getProductTaxCodeId() { + if (productTaxCodeId == null) { + return Optional.empty(); + } + return productTaxCodeId; + } + + /** + * @return Whether to send an automated welcome message via support chat when a user joins this product. + */ + @JsonIgnore + public Optional getSendWelcomeMessage() { + if (sendWelcomeMessage == null) { + return Optional.empty(); + } + return sendWelcomeMessage; + } + + /** + * @return The display name of the product. + */ + @JsonProperty("title") + public Optional getTitle() { + return title; + } + + /** + * @return Whether the product is visible to customers. + */ + @JsonProperty("visibility") + public Optional getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("banner_image") + private Optional _getBannerImage() { + return bannerImage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("headline") + private Optional _getHeadline() { + return headline; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("labels") + private Optional> _getLabels() { + return labels; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_tax_code_id") + private Optional _getProductTaxCodeId() { + return productTaxCodeId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("send_welcome_message") + private Optional _getSendWelcomeMessage() { + return sendWelcomeMessage; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateProductsRequest && equalTo((UpdateProductsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateProductsRequest other) { + return bannerImage.equals(other.bannerImage) + && description.equals(other.description) + && headline.equals(other.headline) + && labels.equals(other.labels) + && metadata.equals(other.metadata) + && productTaxCodeId.equals(other.productTaxCodeId) + && sendWelcomeMessage.equals(other.sendWelcomeMessage) + && title.equals(other.title) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bannerImage, + this.description, + this.headline, + this.labels, + this.metadata, + this.productTaxCodeId, + this.sendWelcomeMessage, + this.title, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional bannerImage = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional headline = Optional.empty(); + + private Optional> labels = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional productTaxCodeId = Optional.empty(); + + private Optional sendWelcomeMessage = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional visibility = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateProductsRequest other) { + bannerImage(other.getBannerImage()); + description(other.getDescription()); + headline(other.getHeadline()); + labels(other.getLabels()); + metadata(other.getMetadata()); + productTaxCodeId(other.getProductTaxCodeId()); + sendWelcomeMessage(other.getSendWelcomeMessage()); + title(other.getTitle()); + visibility(other.getVisibility()); + return this; + } + + /** + *

A wide image for the product, shown on the product page and on listing cards. Pass { id } for an existing attachment or { direct_upload_id } for a completed direct upload; null removes it.

+ */ + @JsonSetter(value = "banner_image", nulls = Nulls.SKIP) + public Builder bannerImage(Optional bannerImage) { + this.bannerImage = bannerImage; + return this; + } + + public Builder bannerImage(UpdateProductsRequestBannerImage bannerImage) { + this.bannerImage = Optional.ofNullable(bannerImage); + return this; + } + + public Builder bannerImage(Nullable bannerImage) { + if (bannerImage.isNull()) { + this.bannerImage = null; + } else if (bannerImage.isEmpty()) { + this.bannerImage = Optional.empty(); + } else { + this.bannerImage = Optional.of(bannerImage.get()); + } + return this; + } + + /** + *

A written description displayed on the product page.

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public Builder description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

A short marketing headline for the product page.

+ */ + @JsonSetter(value = "headline", nulls = Nulls.SKIP) + public Builder headline(Optional headline) { + this.headline = headline; + return this; + } + + public Builder headline(String headline) { + this.headline = Optional.ofNullable(headline); + return this; + } + + public Builder headline(Nullable headline) { + if (headline.isNull()) { + this.headline = null; + } else if (headline.isEmpty()) { + this.headline = Optional.empty(); + } else { + this.headline = Optional.of(headline.get()); + } + return this; + } + + /** + *

Labels used to group products into collections. Replaces the existing labels. Send an empty array to clear them.

+ */ + @JsonSetter(value = "labels", nulls = Nulls.SKIP) + public Builder labels(Optional> labels) { + this.labels = labels; + return this; + } + + public Builder labels(List labels) { + this.labels = Optional.ofNullable(labels); + return this; + } + + public Builder labels(Nullable> labels) { + if (labels.isNull()) { + this.labels = null; + } else if (labels.isEmpty()) { + this.labels = Optional.empty(); + } else { + this.labels = Optional.of(labels.get()); + } + return this; + } + + /** + *

Custom key-value pairs to store on the product.

+ */ + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + public Builder metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

The unique identifier of the tax classification code. See the available product categories.

+ */ + @JsonSetter(value = "product_tax_code_id", nulls = Nulls.SKIP) + public Builder productTaxCodeId(Optional productTaxCodeId) { + this.productTaxCodeId = productTaxCodeId; + return this; + } + + public Builder productTaxCodeId(String productTaxCodeId) { + this.productTaxCodeId = Optional.ofNullable(productTaxCodeId); + return this; + } + + public Builder productTaxCodeId(Nullable productTaxCodeId) { + if (productTaxCodeId.isNull()) { + this.productTaxCodeId = null; + } else if (productTaxCodeId.isEmpty()) { + this.productTaxCodeId = Optional.empty(); + } else { + this.productTaxCodeId = Optional.of(productTaxCodeId.get()); + } + return this; + } + + /** + *

Whether to send an automated welcome message via support chat when a user joins this product.

+ */ + @JsonSetter(value = "send_welcome_message", nulls = Nulls.SKIP) + public Builder sendWelcomeMessage(Optional sendWelcomeMessage) { + this.sendWelcomeMessage = sendWelcomeMessage; + return this; + } + + public Builder sendWelcomeMessage(Boolean sendWelcomeMessage) { + this.sendWelcomeMessage = Optional.ofNullable(sendWelcomeMessage); + return this; + } + + public Builder sendWelcomeMessage(Nullable sendWelcomeMessage) { + if (sendWelcomeMessage.isNull()) { + this.sendWelcomeMessage = null; + } else if (sendWelcomeMessage.isEmpty()) { + this.sendWelcomeMessage = Optional.empty(); + } else { + this.sendWelcomeMessage = Optional.of(sendWelcomeMessage.get()); + } + return this; + } + + /** + *

The display name of the product.

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Whether the product is visible to customers.

+ */ + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public Builder visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + public Builder visibility(String visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + public UpdateProductsRequest build() { + return new UpdateProductsRequest( + bannerImage, + description, + headline, + labels, + metadata, + productTaxCodeId, + sendWelcomeMessage, + title, + visibility, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/CreateProductsRequestCustomCta.java b/src/main/java/com/whop/api/resources/products/types/CreateProductsRequestCustomCta.java new file mode 100644 index 00000000..5e85f286 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/CreateProductsRequestCustomCta.java @@ -0,0 +1,206 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateProductsRequestCustomCta { + public static final CreateProductsRequestCustomCta DONATE_NOW = + new CreateProductsRequestCustomCta(Value.DONATE_NOW, "donate_now"); + + public static final CreateProductsRequestCustomCta SIGN_UP = + new CreateProductsRequestCustomCta(Value.SIGN_UP, "sign_up"); + + public static final CreateProductsRequestCustomCta GET_OFFER = + new CreateProductsRequestCustomCta(Value.GET_OFFER, "get_offer"); + + public static final CreateProductsRequestCustomCta COMPLETE_ORDER = + new CreateProductsRequestCustomCta(Value.COMPLETE_ORDER, "complete_order"); + + public static final CreateProductsRequestCustomCta PURCHASE = + new CreateProductsRequestCustomCta(Value.PURCHASE, "purchase"); + + public static final CreateProductsRequestCustomCta SHOP_NOW = + new CreateProductsRequestCustomCta(Value.SHOP_NOW, "shop_now"); + + public static final CreateProductsRequestCustomCta GET_ACCESS = + new CreateProductsRequestCustomCta(Value.GET_ACCESS, "get_access"); + + public static final CreateProductsRequestCustomCta JOIN = new CreateProductsRequestCustomCta(Value.JOIN, "join"); + + public static final CreateProductsRequestCustomCta CALL_NOW = + new CreateProductsRequestCustomCta(Value.CALL_NOW, "call_now"); + + public static final CreateProductsRequestCustomCta ORDER_NOW = + new CreateProductsRequestCustomCta(Value.ORDER_NOW, "order_now"); + + public static final CreateProductsRequestCustomCta SUBSCRIBE = + new CreateProductsRequestCustomCta(Value.SUBSCRIBE, "subscribe"); + + public static final CreateProductsRequestCustomCta APPLY_NOW = + new CreateProductsRequestCustomCta(Value.APPLY_NOW, "apply_now"); + + public static final CreateProductsRequestCustomCta CONTACT_US = + new CreateProductsRequestCustomCta(Value.CONTACT_US, "contact_us"); + + private final Value value; + + private final String string; + + CreateProductsRequestCustomCta(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateProductsRequestCustomCta + && this.string.equals(((CreateProductsRequestCustomCta) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DONATE_NOW: + return visitor.visitDonateNow(); + case SIGN_UP: + return visitor.visitSignUp(); + case GET_OFFER: + return visitor.visitGetOffer(); + case COMPLETE_ORDER: + return visitor.visitCompleteOrder(); + case PURCHASE: + return visitor.visitPurchase(); + case SHOP_NOW: + return visitor.visitShopNow(); + case GET_ACCESS: + return visitor.visitGetAccess(); + case JOIN: + return visitor.visitJoin(); + case CALL_NOW: + return visitor.visitCallNow(); + case ORDER_NOW: + return visitor.visitOrderNow(); + case SUBSCRIBE: + return visitor.visitSubscribe(); + case APPLY_NOW: + return visitor.visitApplyNow(); + case CONTACT_US: + return visitor.visitContactUs(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateProductsRequestCustomCta valueOf(String value) { + switch (value) { + case "donate_now": + return DONATE_NOW; + case "sign_up": + return SIGN_UP; + case "get_offer": + return GET_OFFER; + case "complete_order": + return COMPLETE_ORDER; + case "purchase": + return PURCHASE; + case "shop_now": + return SHOP_NOW; + case "get_access": + return GET_ACCESS; + case "join": + return JOIN; + case "call_now": + return CALL_NOW; + case "order_now": + return ORDER_NOW; + case "subscribe": + return SUBSCRIBE; + case "apply_now": + return APPLY_NOW; + case "contact_us": + return CONTACT_US; + default: + return new CreateProductsRequestCustomCta(Value.UNKNOWN, value); + } + } + + public enum Value { + GET_ACCESS, + + JOIN, + + ORDER_NOW, + + SHOP_NOW, + + CALL_NOW, + + DONATE_NOW, + + CONTACT_US, + + SIGN_UP, + + SUBSCRIBE, + + PURCHASE, + + GET_OFFER, + + APPLY_NOW, + + COMPLETE_ORDER, + + UNKNOWN + } + + public interface Visitor { + T visitGetAccess(); + + T visitJoin(); + + T visitOrderNow(); + + T visitShopNow(); + + T visitCallNow(); + + T visitDonateNow(); + + T visitContactUs(); + + T visitSignUp(); + + T visitSubscribe(); + + T visitPurchase(); + + T visitGetOffer(); + + T visitApplyNow(); + + T visitCompleteOrder(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/CreateProductsRequestGlobalAffiliateStatus.java b/src/main/java/com/whop/api/resources/products/types/CreateProductsRequestGlobalAffiliateStatus.java new file mode 100644 index 00000000..240b6d9c --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/CreateProductsRequestGlobalAffiliateStatus.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateProductsRequestGlobalAffiliateStatus { + public static final CreateProductsRequestGlobalAffiliateStatus ENABLED = + new CreateProductsRequestGlobalAffiliateStatus(Value.ENABLED, "enabled"); + + public static final CreateProductsRequestGlobalAffiliateStatus DISABLED = + new CreateProductsRequestGlobalAffiliateStatus(Value.DISABLED, "disabled"); + + private final Value value; + + private final String string; + + CreateProductsRequestGlobalAffiliateStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateProductsRequestGlobalAffiliateStatus + && this.string.equals(((CreateProductsRequestGlobalAffiliateStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ENABLED: + return visitor.visitEnabled(); + case DISABLED: + return visitor.visitDisabled(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateProductsRequestGlobalAffiliateStatus valueOf(String value) { + switch (value) { + case "enabled": + return ENABLED; + case "disabled": + return DISABLED; + default: + return new CreateProductsRequestGlobalAffiliateStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ENABLED, + + DISABLED, + + UNKNOWN + } + + public interface Visitor { + T visitEnabled(); + + T visitDisabled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/CreateProductsRequestMemberAffiliateStatus.java b/src/main/java/com/whop/api/resources/products/types/CreateProductsRequestMemberAffiliateStatus.java new file mode 100644 index 00000000..001e5504 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/CreateProductsRequestMemberAffiliateStatus.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateProductsRequestMemberAffiliateStatus { + public static final CreateProductsRequestMemberAffiliateStatus ENABLED = + new CreateProductsRequestMemberAffiliateStatus(Value.ENABLED, "enabled"); + + public static final CreateProductsRequestMemberAffiliateStatus DISABLED = + new CreateProductsRequestMemberAffiliateStatus(Value.DISABLED, "disabled"); + + private final Value value; + + private final String string; + + CreateProductsRequestMemberAffiliateStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateProductsRequestMemberAffiliateStatus + && this.string.equals(((CreateProductsRequestMemberAffiliateStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ENABLED: + return visitor.visitEnabled(); + case DISABLED: + return visitor.visitDisabled(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateProductsRequestMemberAffiliateStatus valueOf(String value) { + switch (value) { + case "enabled": + return ENABLED; + case "disabled": + return DISABLED; + default: + return new CreateProductsRequestMemberAffiliateStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ENABLED, + + DISABLED, + + UNKNOWN + } + + public interface Visitor { + T visitEnabled(); + + T visitDisabled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/DeleteProductsResponse.java b/src/main/java/com/whop/api/resources/products/types/DeleteProductsResponse.java new file mode 100644 index 00000000..9e65f391 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/DeleteProductsResponse.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteProductsResponse.Builder.class) +public final class DeleteProductsResponse { + private final boolean deleted; + + private final String id; + + private final Map additionalProperties; + + private DeleteProductsResponse(boolean deleted, String id, Map additionalProperties) { + this.deleted = deleted; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Always true. + */ + @JsonProperty("deleted") + public boolean getDeleted() { + return deleted; + } + + /** + * @return ID of the deleted product. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteProductsResponse && equalTo((DeleteProductsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteProductsResponse other) { + return deleted == other.deleted && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deleted, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeletedStage builder() { + return new Builder(); + } + + public interface DeletedStage { + /** + *

Always true.

+ */ + IdStage deleted(boolean deleted); + + Builder from(DeleteProductsResponse other); + } + + public interface IdStage { + /** + *

ID of the deleted product.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DeleteProductsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeletedStage, IdStage, _FinalStage { + private boolean deleted; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeleteProductsResponse other) { + deleted(other.getDeleted()); + id(other.getId()); + return this; + } + + /** + *

Always true.

+ *

Always true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("deleted") + public IdStage deleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + *

ID of the deleted product.

+ *

ID of the deleted product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DeleteProductsResponse build() { + return new DeleteProductsResponse(deleted, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/ListProductsRequestDirection.java b/src/main/java/com/whop/api/resources/products/types/ListProductsRequestDirection.java new file mode 100644 index 00000000..c11c036a --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/ListProductsRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListProductsRequestDirection { + public static final ListProductsRequestDirection ASC = new ListProductsRequestDirection(Value.ASC, "asc"); + + public static final ListProductsRequestDirection DESC = new ListProductsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListProductsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListProductsRequestDirection + && this.string.equals(((ListProductsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListProductsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListProductsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/ListProductsResponse.java b/src/main/java/com/whop/api/resources/products/types/ListProductsResponse.java new file mode 100644 index 00000000..3f96191e --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/ListProductsResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.ProductListItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListProductsResponse.Builder.class) +public final class ListProductsResponse { + private final List data; + + private final ListProductsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListProductsResponse( + List data, + ListProductsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListProductsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProductsResponse && equalTo((ListProductsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProductsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListProductsResponsePageInfo pageInfo); + + Builder from(ListProductsResponse other); + } + + public interface _FinalStage { + ListProductsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ProductListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListProductsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListProductsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListProductsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ProductListItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListProductsResponse build() { + return new ListProductsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/ListProductsResponsePageInfo.java b/src/main/java/com/whop/api/resources/products/types/ListProductsResponsePageInfo.java new file mode 100644 index 00000000..6bb4b591 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/ListProductsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListProductsResponsePageInfo.Builder.class) +public final class ListProductsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListProductsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProductsResponsePageInfo && equalTo((ListProductsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProductsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListProductsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListProductsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListProductsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListProductsResponsePageInfo build() { + return new ListProductsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/PostProductCreatedPayload.java b/src/main/java/com/whop/api/resources/products/types/PostProductCreatedPayload.java new file mode 100644 index 00000000..5ccb5dcd --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/PostProductCreatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Product; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostProductCreatedPayload.Builder.class) +public final class PostProductCreatedPayload { + private final Optional accountId; + + private final PostProductCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Product data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostProductCreatedPayloadType type; + + private final Map additionalProperties; + + private PostProductCreatedPayload( + Optional accountId, + PostProductCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Product data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostProductCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostProductCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Product getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostProductCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostProductCreatedPayload && equalTo((PostProductCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostProductCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostProductCreatedPayloadApiVersion apiVersion); + + Builder from(PostProductCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Product data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostProductCreatedPayloadType type); + } + + public interface _FinalStage { + PostProductCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostProductCreatedPayloadApiVersion apiVersion; + + private Product data; + + private String id; + + private OffsetDateTime timestamp; + + private PostProductCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostProductCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostProductCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Product data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostProductCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostProductCreatedPayload build() { + return new PostProductCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/PostProductCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/products/types/PostProductCreatedPayloadApiVersion.java new file mode 100644 index 00000000..2d3f9b2f --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/PostProductCreatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostProductCreatedPayloadApiVersion { + public static final PostProductCreatedPayloadApiVersion V1 = + new PostProductCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostProductCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostProductCreatedPayloadApiVersion + && this.string.equals(((PostProductCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostProductCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostProductCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/PostProductCreatedPayloadType.java b/src/main/java/com/whop/api/resources/products/types/PostProductCreatedPayloadType.java new file mode 100644 index 00000000..a1cd48eb --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/PostProductCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostProductCreatedPayloadType { + public static final PostProductCreatedPayloadType PRODUCT_CREATED = + new PostProductCreatedPayloadType(Value.PRODUCT_CREATED, "product.created"); + + private final Value value; + + private final String string; + + PostProductCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostProductCreatedPayloadType + && this.string.equals(((PostProductCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PRODUCT_CREATED: + return visitor.visitProductCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostProductCreatedPayloadType valueOf(String value) { + switch (value) { + case "product.created": + return PRODUCT_CREATED; + default: + return new PostProductCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + PRODUCT_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitProductCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/PostProductDeletedPayload.java b/src/main/java/com/whop/api/resources/products/types/PostProductDeletedPayload.java new file mode 100644 index 00000000..7f5b2c84 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/PostProductDeletedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Product; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostProductDeletedPayload.Builder.class) +public final class PostProductDeletedPayload { + private final Optional accountId; + + private final PostProductDeletedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Product data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostProductDeletedPayloadType type; + + private final Map additionalProperties; + + private PostProductDeletedPayload( + Optional accountId, + PostProductDeletedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Product data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostProductDeletedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostProductDeletedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Product getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostProductDeletedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostProductDeletedPayload && equalTo((PostProductDeletedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostProductDeletedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostProductDeletedPayloadApiVersion apiVersion); + + Builder from(PostProductDeletedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Product data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostProductDeletedPayloadType type); + } + + public interface _FinalStage { + PostProductDeletedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostProductDeletedPayloadApiVersion apiVersion; + + private Product data; + + private String id; + + private OffsetDateTime timestamp; + + private PostProductDeletedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostProductDeletedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostProductDeletedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Product data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostProductDeletedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostProductDeletedPayload build() { + return new PostProductDeletedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/PostProductDeletedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/products/types/PostProductDeletedPayloadApiVersion.java new file mode 100644 index 00000000..c5d6aec3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/PostProductDeletedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostProductDeletedPayloadApiVersion { + public static final PostProductDeletedPayloadApiVersion V1 = + new PostProductDeletedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostProductDeletedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostProductDeletedPayloadApiVersion + && this.string.equals(((PostProductDeletedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostProductDeletedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostProductDeletedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/PostProductDeletedPayloadType.java b/src/main/java/com/whop/api/resources/products/types/PostProductDeletedPayloadType.java new file mode 100644 index 00000000..ff0513a5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/PostProductDeletedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostProductDeletedPayloadType { + public static final PostProductDeletedPayloadType PRODUCT_DELETED = + new PostProductDeletedPayloadType(Value.PRODUCT_DELETED, "product.deleted"); + + private final Value value; + + private final String string; + + PostProductDeletedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostProductDeletedPayloadType + && this.string.equals(((PostProductDeletedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PRODUCT_DELETED: + return visitor.visitProductDeleted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostProductDeletedPayloadType valueOf(String value) { + switch (value) { + case "product.deleted": + return PRODUCT_DELETED; + default: + return new PostProductDeletedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + PRODUCT_DELETED, + + UNKNOWN + } + + public interface Visitor { + T visitProductDeleted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/PostProductPublishedPayload.java b/src/main/java/com/whop/api/resources/products/types/PostProductPublishedPayload.java new file mode 100644 index 00000000..9f5c2166 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/PostProductPublishedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Product; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostProductPublishedPayload.Builder.class) +public final class PostProductPublishedPayload { + private final Optional accountId; + + private final PostProductPublishedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Product data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostProductPublishedPayloadType type; + + private final Map additionalProperties; + + private PostProductPublishedPayload( + Optional accountId, + PostProductPublishedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Product data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostProductPublishedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostProductPublishedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Product getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostProductPublishedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostProductPublishedPayload && equalTo((PostProductPublishedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostProductPublishedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostProductPublishedPayloadApiVersion apiVersion); + + Builder from(PostProductPublishedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Product data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostProductPublishedPayloadType type); + } + + public interface _FinalStage { + PostProductPublishedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostProductPublishedPayloadApiVersion apiVersion; + + private Product data; + + private String id; + + private OffsetDateTime timestamp; + + private PostProductPublishedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostProductPublishedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostProductPublishedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Product data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostProductPublishedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostProductPublishedPayload build() { + return new PostProductPublishedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/PostProductPublishedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/products/types/PostProductPublishedPayloadApiVersion.java new file mode 100644 index 00000000..ab18e657 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/PostProductPublishedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostProductPublishedPayloadApiVersion { + public static final PostProductPublishedPayloadApiVersion V1 = + new PostProductPublishedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostProductPublishedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostProductPublishedPayloadApiVersion + && this.string.equals(((PostProductPublishedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostProductPublishedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostProductPublishedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/PostProductPublishedPayloadType.java b/src/main/java/com/whop/api/resources/products/types/PostProductPublishedPayloadType.java new file mode 100644 index 00000000..7e593cc4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/PostProductPublishedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostProductPublishedPayloadType { + public static final PostProductPublishedPayloadType PRODUCT_PUBLISHED = + new PostProductPublishedPayloadType(Value.PRODUCT_PUBLISHED, "product.published"); + + private final Value value; + + private final String string; + + PostProductPublishedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostProductPublishedPayloadType + && this.string.equals(((PostProductPublishedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PRODUCT_PUBLISHED: + return visitor.visitProductPublished(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostProductPublishedPayloadType valueOf(String value) { + switch (value) { + case "product.published": + return PRODUCT_PUBLISHED; + default: + return new PostProductPublishedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + PRODUCT_PUBLISHED, + + UNKNOWN + } + + public interface Visitor { + T visitProductPublished(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/PostProductUnpublishedPayload.java b/src/main/java/com/whop/api/resources/products/types/PostProductUnpublishedPayload.java new file mode 100644 index 00000000..2faa7099 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/PostProductUnpublishedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Product; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostProductUnpublishedPayload.Builder.class) +public final class PostProductUnpublishedPayload { + private final Optional accountId; + + private final PostProductUnpublishedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Product data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostProductUnpublishedPayloadType type; + + private final Map additionalProperties; + + private PostProductUnpublishedPayload( + Optional accountId, + PostProductUnpublishedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Product data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostProductUnpublishedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostProductUnpublishedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Product getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostProductUnpublishedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostProductUnpublishedPayload && equalTo((PostProductUnpublishedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostProductUnpublishedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostProductUnpublishedPayloadApiVersion apiVersion); + + Builder from(PostProductUnpublishedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Product data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostProductUnpublishedPayloadType type); + } + + public interface _FinalStage { + PostProductUnpublishedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostProductUnpublishedPayloadApiVersion apiVersion; + + private Product data; + + private String id; + + private OffsetDateTime timestamp; + + private PostProductUnpublishedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostProductUnpublishedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostProductUnpublishedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Product data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostProductUnpublishedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostProductUnpublishedPayload build() { + return new PostProductUnpublishedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/PostProductUnpublishedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/products/types/PostProductUnpublishedPayloadApiVersion.java new file mode 100644 index 00000000..06c5a1e1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/PostProductUnpublishedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostProductUnpublishedPayloadApiVersion { + public static final PostProductUnpublishedPayloadApiVersion V1 = + new PostProductUnpublishedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostProductUnpublishedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostProductUnpublishedPayloadApiVersion + && this.string.equals(((PostProductUnpublishedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostProductUnpublishedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostProductUnpublishedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/PostProductUnpublishedPayloadType.java b/src/main/java/com/whop/api/resources/products/types/PostProductUnpublishedPayloadType.java new file mode 100644 index 00000000..55096893 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/PostProductUnpublishedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostProductUnpublishedPayloadType { + public static final PostProductUnpublishedPayloadType PRODUCT_UNPUBLISHED = + new PostProductUnpublishedPayloadType(Value.PRODUCT_UNPUBLISHED, "product.unpublished"); + + private final Value value; + + private final String string; + + PostProductUnpublishedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostProductUnpublishedPayloadType + && this.string.equals(((PostProductUnpublishedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PRODUCT_UNPUBLISHED: + return visitor.visitProductUnpublished(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostProductUnpublishedPayloadType valueOf(String value) { + switch (value) { + case "product.unpublished": + return PRODUCT_UNPUBLISHED; + default: + return new PostProductUnpublishedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + PRODUCT_UNPUBLISHED, + + UNKNOWN + } + + public interface Visitor { + T visitProductUnpublished(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/PostProductUpdatedPayload.java b/src/main/java/com/whop/api/resources/products/types/PostProductUpdatedPayload.java new file mode 100644 index 00000000..eaa954ab --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/PostProductUpdatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Product; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostProductUpdatedPayload.Builder.class) +public final class PostProductUpdatedPayload { + private final Optional accountId; + + private final PostProductUpdatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Product data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostProductUpdatedPayloadType type; + + private final Map additionalProperties; + + private PostProductUpdatedPayload( + Optional accountId, + PostProductUpdatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Product data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostProductUpdatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostProductUpdatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Product getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostProductUpdatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostProductUpdatedPayload && equalTo((PostProductUpdatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostProductUpdatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostProductUpdatedPayloadApiVersion apiVersion); + + Builder from(PostProductUpdatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Product data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostProductUpdatedPayloadType type); + } + + public interface _FinalStage { + PostProductUpdatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostProductUpdatedPayloadApiVersion apiVersion; + + private Product data; + + private String id; + + private OffsetDateTime timestamp; + + private PostProductUpdatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostProductUpdatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostProductUpdatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Product data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostProductUpdatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostProductUpdatedPayload build() { + return new PostProductUpdatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/PostProductUpdatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/products/types/PostProductUpdatedPayloadApiVersion.java new file mode 100644 index 00000000..e95aa692 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/PostProductUpdatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostProductUpdatedPayloadApiVersion { + public static final PostProductUpdatedPayloadApiVersion V1 = + new PostProductUpdatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostProductUpdatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostProductUpdatedPayloadApiVersion + && this.string.equals(((PostProductUpdatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostProductUpdatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostProductUpdatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/PostProductUpdatedPayloadType.java b/src/main/java/com/whop/api/resources/products/types/PostProductUpdatedPayloadType.java new file mode 100644 index 00000000..36ef8342 --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/PostProductUpdatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostProductUpdatedPayloadType { + public static final PostProductUpdatedPayloadType PRODUCT_UPDATED = + new PostProductUpdatedPayloadType(Value.PRODUCT_UPDATED, "product.updated"); + + private final Value value; + + private final String string; + + PostProductUpdatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostProductUpdatedPayloadType + && this.string.equals(((PostProductUpdatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PRODUCT_UPDATED: + return visitor.visitProductUpdated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostProductUpdatedPayloadType valueOf(String value) { + switch (value) { + case "product.updated": + return PRODUCT_UPDATED; + default: + return new PostProductUpdatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + PRODUCT_UPDATED, + + UNKNOWN + } + + public interface Visitor { + T visitProductUpdated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/products/types/UpdateProductsRequestBannerImage.java b/src/main/java/com/whop/api/resources/products/types/UpdateProductsRequestBannerImage.java new file mode 100644 index 00000000..a93b1b7f --- /dev/null +++ b/src/main/java/com/whop/api/resources/products/types/UpdateProductsRequestBannerImage.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.products.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateProductsRequestBannerImage.Builder.class) +public final class UpdateProductsRequestBannerImage { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private UpdateProductsRequestBannerImage( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The signed id of a completed direct upload. + */ + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + /** + * @return The tag of an already-uploaded attachment. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateProductsRequestBannerImage && equalTo((UpdateProductsRequestBannerImage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateProductsRequestBannerImage other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateProductsRequestBannerImage other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + /** + *

The signed id of a completed direct upload.

+ */ + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + /** + *

The tag of an already-uploaded attachment.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdateProductsRequestBannerImage build() { + return new UpdateProductsRequestBannerImage(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/AsyncPromoCodesClient.java b/src/main/java/com/whop/api/resources/promocodes/AsyncPromoCodesClient.java new file mode 100644 index 00000000..3928a500 --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/AsyncPromoCodesClient.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.promocodes.requests.ActivatePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.CreatePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.DeactivatePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.DeletePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.ListPromoCodesRequest; +import com.whop.api.resources.promocodes.requests.RetrievePromoCodesRequest; +import com.whop.api.resources.promocodes.types.DeletePromoCodesResponse; +import com.whop.api.types.PromoCode; +import com.whop.api.types.PromoCodeListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncPromoCodesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPromoCodesClient rawClient; + + public AsyncPromoCodesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPromoCodesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPromoCodesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists promo codes for an account with cursor pagination, filters, and sorting. + */ + public CompletableFuture> list(ListPromoCodesRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists promo codes for an account with cursor pagination, filters, and sorting. + */ + public CompletableFuture> list( + ListPromoCodesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates a promo code for an account. First-party sessions may attach an affiliate. + */ + public CompletableFuture create(CreatePromoCodesRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Creates a promo code for an account. First-party sessions may attach an affiliate. + */ + public CompletableFuture create(CreatePromoCodesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a promo code by ID. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a promo code by ID. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a promo code by ID. + */ + public CompletableFuture retrieve(String id, RetrievePromoCodesRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a promo code by ID. + */ + public CompletableFuture retrieve( + String id, RetrievePromoCodesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public CompletableFuture delete(String id, DeletePromoCodesRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public CompletableFuture delete( + String id, DeletePromoCodesRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public CompletableFuture activate(String id) { + return this.rawClient.activate(id).thenApply(response -> response.body()); + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public CompletableFuture activate(String id, RequestOptions requestOptions) { + return this.rawClient.activate(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public CompletableFuture activate(String id, ActivatePromoCodesRequest request) { + return this.rawClient.activate(id, request).thenApply(response -> response.body()); + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public CompletableFuture activate( + String id, ActivatePromoCodesRequest request, RequestOptions requestOptions) { + return this.rawClient.activate(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public CompletableFuture deactivate(String id) { + return this.rawClient.deactivate(id).thenApply(response -> response.body()); + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public CompletableFuture deactivate(String id, RequestOptions requestOptions) { + return this.rawClient.deactivate(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public CompletableFuture deactivate(String id, DeactivatePromoCodesRequest request) { + return this.rawClient.deactivate(id, request).thenApply(response -> response.body()); + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public CompletableFuture deactivate( + String id, DeactivatePromoCodesRequest request, RequestOptions requestOptions) { + return this.rawClient.deactivate(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/AsyncRawPromoCodesClient.java b/src/main/java/com/whop/api/resources/promocodes/AsyncRawPromoCodesClient.java new file mode 100644 index 00000000..a3dd2a1c --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/AsyncRawPromoCodesClient.java @@ -0,0 +1,613 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.promocodes.requests.ActivatePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.CreatePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.DeactivatePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.DeletePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.ListPromoCodesRequest; +import com.whop.api.resources.promocodes.requests.RetrievePromoCodesRequest; +import com.whop.api.resources.promocodes.types.DeletePromoCodesResponse; +import com.whop.api.resources.promocodes.types.ListPromoCodesResponse; +import com.whop.api.types.PromoCode; +import com.whop.api.types.PromoCodeListItem; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPromoCodesClient { + protected final ClientOptions clientOptions; + + public AsyncRawPromoCodesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists promo codes for an account with cursor pagination, filters, and sorting. + */ + public CompletableFuture>> list( + ListPromoCodesRequest request) { + return list(request, null); + } + + /** + * Lists promo codes for an account with cursor pagination, filters, and sorting. + */ + public CompletableFuture>> list( + ListPromoCodesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("promo_codes"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } + if (request.getPlanIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_ids", request.getPlanIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPromoCodesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPromoCodesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListPromoCodesRequest nextRequest = ListPromoCodesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates a promo code for an account. First-party sessions may attach an affiliate. + */ + public CompletableFuture> create(CreatePromoCodesRequest request) { + return create(request, null); + } + + /** + * Creates a promo code for an account. First-party sessions may attach an affiliate. + */ + public CompletableFuture> create( + CreatePromoCodesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("promo_codes"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PromoCode.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a promo code by ID. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrievePromoCodesRequest.builder().build()); + } + + /** + * Retrieves a promo code by ID. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePromoCodesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a promo code by ID. + */ + public CompletableFuture> retrieve(String id, RetrievePromoCodesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a promo code by ID. + */ + public CompletableFuture> retrieve( + String id, RetrievePromoCodesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("promo_codes") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PromoCode.class), response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public CompletableFuture> delete(String id) { + return delete(id, DeletePromoCodesRequest.builder().build()); + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public CompletableFuture> delete( + String id, RequestOptions requestOptions) { + return delete(id, DeletePromoCodesRequest.builder().build(), requestOptions); + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public CompletableFuture> delete( + String id, DeletePromoCodesRequest request) { + return delete(id, request, null); + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public CompletableFuture> delete( + String id, DeletePromoCodesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("promo_codes") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeletePromoCodesResponse.class), + response)); + return; + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public CompletableFuture> activate(String id) { + return activate(id, ActivatePromoCodesRequest.builder().build()); + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public CompletableFuture> activate(String id, RequestOptions requestOptions) { + return activate(id, ActivatePromoCodesRequest.builder().build(), requestOptions); + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public CompletableFuture> activate(String id, ActivatePromoCodesRequest request) { + return activate(id, request, null); + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public CompletableFuture> activate( + String id, ActivatePromoCodesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("promo_codes") + .addPathSegment(id) + .addPathSegments("activate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PromoCode.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public CompletableFuture> deactivate(String id) { + return deactivate(id, DeactivatePromoCodesRequest.builder().build()); + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public CompletableFuture> deactivate(String id, RequestOptions requestOptions) { + return deactivate(id, DeactivatePromoCodesRequest.builder().build(), requestOptions); + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public CompletableFuture> deactivate( + String id, DeactivatePromoCodesRequest request) { + return deactivate(id, request, null); + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public CompletableFuture> deactivate( + String id, DeactivatePromoCodesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("promo_codes") + .addPathSegment(id) + .addPathSegments("deactivate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PromoCode.class), response)); + return; + } + try { + if (response.code() == 409) { + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/PromoCodesClient.java b/src/main/java/com/whop/api/resources/promocodes/PromoCodesClient.java new file mode 100644 index 00000000..f53b04d3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/PromoCodesClient.java @@ -0,0 +1,175 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.promocodes.requests.ActivatePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.CreatePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.DeactivatePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.DeletePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.ListPromoCodesRequest; +import com.whop.api.resources.promocodes.requests.RetrievePromoCodesRequest; +import com.whop.api.resources.promocodes.types.DeletePromoCodesResponse; +import com.whop.api.types.PromoCode; +import com.whop.api.types.PromoCodeListItem; + +public class PromoCodesClient { + protected final ClientOptions clientOptions; + + private final RawPromoCodesClient rawClient; + + public PromoCodesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPromoCodesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPromoCodesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists promo codes for an account with cursor pagination, filters, and sorting. + */ + public SyncPagingIterable list(ListPromoCodesRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists promo codes for an account with cursor pagination, filters, and sorting. + */ + public SyncPagingIterable list(ListPromoCodesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Creates a promo code for an account. First-party sessions may attach an affiliate. + */ + public PromoCode create(CreatePromoCodesRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Creates a promo code for an account. First-party sessions may attach an affiliate. + */ + public PromoCode create(CreatePromoCodesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves a promo code by ID. + */ + public PromoCode retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a promo code by ID. + */ + public PromoCode retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a promo code by ID. + */ + public PromoCode retrieve(String id, RetrievePromoCodesRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a promo code by ID. + */ + public PromoCode retrieve(String id, RetrievePromoCodesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public DeletePromoCodesResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public DeletePromoCodesResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public DeletePromoCodesResponse delete(String id, DeletePromoCodesRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public DeletePromoCodesResponse delete(String id, DeletePromoCodesRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public PromoCode activate(String id) { + return this.rawClient.activate(id).body(); + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public PromoCode activate(String id, RequestOptions requestOptions) { + return this.rawClient.activate(id, requestOptions).body(); + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public PromoCode activate(String id, ActivatePromoCodesRequest request) { + return this.rawClient.activate(id, request).body(); + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public PromoCode activate(String id, ActivatePromoCodesRequest request, RequestOptions requestOptions) { + return this.rawClient.activate(id, request, requestOptions).body(); + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public PromoCode deactivate(String id) { + return this.rawClient.deactivate(id).body(); + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public PromoCode deactivate(String id, RequestOptions requestOptions) { + return this.rawClient.deactivate(id, requestOptions).body(); + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public PromoCode deactivate(String id, DeactivatePromoCodesRequest request) { + return this.rawClient.deactivate(id, request).body(); + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public PromoCode deactivate(String id, DeactivatePromoCodesRequest request, RequestOptions requestOptions) { + return this.rawClient.deactivate(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/RawPromoCodesClient.java b/src/main/java/com/whop/api/resources/promocodes/RawPromoCodesClient.java new file mode 100644 index 00000000..645a2020 --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/RawPromoCodesClient.java @@ -0,0 +1,501 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.promocodes.requests.ActivatePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.CreatePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.DeactivatePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.DeletePromoCodesRequest; +import com.whop.api.resources.promocodes.requests.ListPromoCodesRequest; +import com.whop.api.resources.promocodes.requests.RetrievePromoCodesRequest; +import com.whop.api.resources.promocodes.types.DeletePromoCodesResponse; +import com.whop.api.resources.promocodes.types.ListPromoCodesResponse; +import com.whop.api.types.PromoCode; +import com.whop.api.types.PromoCodeListItem; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPromoCodesClient { + protected final ClientOptions clientOptions; + + public RawPromoCodesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists promo codes for an account with cursor pagination, filters, and sorting. + */ + public WhopApiHttpResponse> list(ListPromoCodesRequest request) { + return list(request, null); + } + + /** + * Lists promo codes for an account with cursor pagination, filters, and sorting. + */ + public WhopApiHttpResponse> list( + ListPromoCodesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("promo_codes"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } + if (request.getPlanIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_ids", request.getPlanIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPromoCodesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPromoCodesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListPromoCodesRequest nextRequest = ListPromoCodesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates a promo code for an account. First-party sessions may attach an affiliate. + */ + public WhopApiHttpResponse create(CreatePromoCodesRequest request) { + return create(request, null); + } + + /** + * Creates a promo code for an account. First-party sessions may attach an affiliate. + */ + public WhopApiHttpResponse create(CreatePromoCodesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("promo_codes"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PromoCode.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a promo code by ID. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrievePromoCodesRequest.builder().build()); + } + + /** + * Retrieves a promo code by ID. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrievePromoCodesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a promo code by ID. + */ + public WhopApiHttpResponse retrieve(String id, RetrievePromoCodesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a promo code by ID. + */ + public WhopApiHttpResponse retrieve( + String id, RetrievePromoCodesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("promo_codes") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PromoCode.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeletePromoCodesRequest.builder().build()); + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeletePromoCodesRequest.builder().build(), requestOptions); + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public WhopApiHttpResponse delete(String id, DeletePromoCodesRequest request) { + return delete(id, request, null); + } + + /** + * Archives a promo code so it cannot be used in future checkouts. + */ + public WhopApiHttpResponse delete( + String id, DeletePromoCodesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("promo_codes") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeletePromoCodesResponse.class), + response); + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public WhopApiHttpResponse activate(String id) { + return activate(id, ActivatePromoCodesRequest.builder().build()); + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public WhopApiHttpResponse activate(String id, RequestOptions requestOptions) { + return activate(id, ActivatePromoCodesRequest.builder().build(), requestOptions); + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public WhopApiHttpResponse activate(String id, ActivatePromoCodesRequest request) { + return activate(id, request, null); + } + + /** + * Turns an inactive promo code back on so it can be redeemed at checkout. + */ + public WhopApiHttpResponse activate( + String id, ActivatePromoCodesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("promo_codes") + .addPathSegment(id) + .addPathSegments("activate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PromoCode.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public WhopApiHttpResponse deactivate(String id) { + return deactivate(id, DeactivatePromoCodesRequest.builder().build()); + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public WhopApiHttpResponse deactivate(String id, RequestOptions requestOptions) { + return deactivate(id, DeactivatePromoCodesRequest.builder().build(), requestOptions); + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public WhopApiHttpResponse deactivate(String id, DeactivatePromoCodesRequest request) { + return deactivate(id, request, null); + } + + /** + * Turns off an active promo code so it can no longer be redeemed at checkout. + */ + public WhopApiHttpResponse deactivate( + String id, DeactivatePromoCodesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("promo_codes") + .addPathSegment(id) + .addPathSegments("deactivate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PromoCode.class), response); + } + try { + if (response.code() == 409) { + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/requests/ActivatePromoCodesRequest.java b/src/main/java/com/whop/api/resources/promocodes/requests/ActivatePromoCodesRequest.java new file mode 100644 index 00000000..1550d38c --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/requests/ActivatePromoCodesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ActivatePromoCodesRequest.Builder.class) +public final class ActivatePromoCodesRequest { + private final Map additionalProperties; + + private ActivatePromoCodesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ActivatePromoCodesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ActivatePromoCodesRequest other) { + return this; + } + + public ActivatePromoCodesRequest build() { + return new ActivatePromoCodesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/requests/CreatePromoCodesRequest.java b/src/main/java/com/whop/api/resources/promocodes/requests/CreatePromoCodesRequest.java new file mode 100644 index 00000000..d1862474 --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/requests/CreatePromoCodesRequest.java @@ -0,0 +1,620 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.promocodes.types.CreatePromoCodesRequestBaseCurrency; +import com.whop.api.resources.promocodes.types.CreatePromoCodesRequestPromoType; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePromoCodesRequest.Builder.class) +public final class CreatePromoCodesRequest { + private final String accountId; + + private final double amountOff; + + private final CreatePromoCodesRequestBaseCurrency baseCurrency; + + private final Optional churnedUsersOnly; + + private final String code; + + private final Optional existingMembershipsOnly; + + private final Optional expiresAt; + + private final boolean newUsersOnly; + + private final Optional onePerCustomer; + + private final Optional> planIds; + + private final Optional productId; + + private final int promoDurationMonths; + + private final CreatePromoCodesRequestPromoType promoType; + + private final Optional stock; + + private final Optional unlimitedStock; + + private final Map additionalProperties; + + private CreatePromoCodesRequest( + String accountId, + double amountOff, + CreatePromoCodesRequestBaseCurrency baseCurrency, + Optional churnedUsersOnly, + String code, + Optional existingMembershipsOnly, + Optional expiresAt, + boolean newUsersOnly, + Optional onePerCustomer, + Optional> planIds, + Optional productId, + int promoDurationMonths, + CreatePromoCodesRequestPromoType promoType, + Optional stock, + Optional unlimitedStock, + Map additionalProperties) { + this.accountId = accountId; + this.amountOff = amountOff; + this.baseCurrency = baseCurrency; + this.churnedUsersOnly = churnedUsersOnly; + this.code = code; + this.existingMembershipsOnly = existingMembershipsOnly; + this.expiresAt = expiresAt; + this.newUsersOnly = newUsersOnly; + this.onePerCustomer = onePerCustomer; + this.planIds = planIds; + this.productId = productId; + this.promoDurationMonths = promoDurationMonths; + this.promoType = promoType; + this.stock = stock; + this.unlimitedStock = unlimitedStock; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("amount_off") + public double getAmountOff() { + return amountOff; + } + + @JsonProperty("base_currency") + public CreatePromoCodesRequestBaseCurrency getBaseCurrency() { + return baseCurrency; + } + + @JsonProperty("churned_users_only") + public Optional getChurnedUsersOnly() { + return churnedUsersOnly; + } + + @JsonProperty("code") + public String getCode() { + return code; + } + + @JsonProperty("existing_memberships_only") + public Optional getExistingMembershipsOnly() { + return existingMembershipsOnly; + } + + @JsonIgnore + public Optional getExpiresAt() { + if (expiresAt == null) { + return Optional.empty(); + } + return expiresAt; + } + + @JsonProperty("new_users_only") + public boolean getNewUsersOnly() { + return newUsersOnly; + } + + @JsonProperty("one_per_customer") + public Optional getOnePerCustomer() { + return onePerCustomer; + } + + @JsonProperty("plan_ids") + public Optional> getPlanIds() { + return planIds; + } + + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + @JsonProperty("promo_duration_months") + public int getPromoDurationMonths() { + return promoDurationMonths; + } + + @JsonProperty("promo_type") + public CreatePromoCodesRequestPromoType getPromoType() { + return promoType; + } + + @JsonIgnore + public Optional getStock() { + if (stock == null) { + return Optional.empty(); + } + return stock; + } + + @JsonProperty("unlimited_stock") + public Optional getUnlimitedStock() { + return unlimitedStock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expires_at") + private Optional _getExpiresAt() { + return expiresAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("stock") + private Optional _getStock() { + return stock; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePromoCodesRequest && equalTo((CreatePromoCodesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePromoCodesRequest other) { + return accountId.equals(other.accountId) + && amountOff == other.amountOff + && baseCurrency.equals(other.baseCurrency) + && churnedUsersOnly.equals(other.churnedUsersOnly) + && code.equals(other.code) + && existingMembershipsOnly.equals(other.existingMembershipsOnly) + && expiresAt.equals(other.expiresAt) + && newUsersOnly == other.newUsersOnly + && onePerCustomer.equals(other.onePerCustomer) + && planIds.equals(other.planIds) + && productId.equals(other.productId) + && promoDurationMonths == other.promoDurationMonths + && promoType.equals(other.promoType) + && stock.equals(other.stock) + && unlimitedStock.equals(other.unlimitedStock); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.amountOff, + this.baseCurrency, + this.churnedUsersOnly, + this.code, + this.existingMembershipsOnly, + this.expiresAt, + this.newUsersOnly, + this.onePerCustomer, + this.planIds, + this.productId, + this.promoDurationMonths, + this.promoType, + this.stock, + this.unlimitedStock); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + AmountOffStage accountId(@NotNull String accountId); + + Builder from(CreatePromoCodesRequest other); + } + + public interface AmountOffStage { + BaseCurrencyStage amountOff(double amountOff); + } + + public interface BaseCurrencyStage { + CodeStage baseCurrency(@NotNull CreatePromoCodesRequestBaseCurrency baseCurrency); + } + + public interface CodeStage { + NewUsersOnlyStage code(@NotNull String code); + } + + public interface NewUsersOnlyStage { + PromoDurationMonthsStage newUsersOnly(boolean newUsersOnly); + } + + public interface PromoDurationMonthsStage { + PromoTypeStage promoDurationMonths(int promoDurationMonths); + } + + public interface PromoTypeStage { + _FinalStage promoType(@NotNull CreatePromoCodesRequestPromoType promoType); + } + + public interface _FinalStage { + CreatePromoCodesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage churnedUsersOnly(Optional churnedUsersOnly); + + _FinalStage churnedUsersOnly(Boolean churnedUsersOnly); + + _FinalStage existingMembershipsOnly(Optional existingMembershipsOnly); + + _FinalStage existingMembershipsOnly(Boolean existingMembershipsOnly); + + _FinalStage expiresAt(Optional expiresAt); + + _FinalStage expiresAt(String expiresAt); + + _FinalStage expiresAt(Nullable expiresAt); + + _FinalStage onePerCustomer(Optional onePerCustomer); + + _FinalStage onePerCustomer(Boolean onePerCustomer); + + _FinalStage planIds(Optional> planIds); + + _FinalStage planIds(List planIds); + + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + + _FinalStage productId(Nullable productId); + + _FinalStage stock(Optional stock); + + _FinalStage stock(Integer stock); + + _FinalStage stock(Nullable stock); + + _FinalStage unlimitedStock(Optional unlimitedStock); + + _FinalStage unlimitedStock(Boolean unlimitedStock); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, + AmountOffStage, + BaseCurrencyStage, + CodeStage, + NewUsersOnlyStage, + PromoDurationMonthsStage, + PromoTypeStage, + _FinalStage { + private String accountId; + + private double amountOff; + + private CreatePromoCodesRequestBaseCurrency baseCurrency; + + private String code; + + private boolean newUsersOnly; + + private int promoDurationMonths; + + private CreatePromoCodesRequestPromoType promoType; + + private Optional unlimitedStock = Optional.empty(); + + private Optional stock = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional> planIds = Optional.empty(); + + private Optional onePerCustomer = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + private Optional existingMembershipsOnly = Optional.empty(); + + private Optional churnedUsersOnly = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePromoCodesRequest other) { + accountId(other.getAccountId()); + amountOff(other.getAmountOff()); + baseCurrency(other.getBaseCurrency()); + churnedUsersOnly(other.getChurnedUsersOnly()); + code(other.getCode()); + existingMembershipsOnly(other.getExistingMembershipsOnly()); + expiresAt(other.getExpiresAt()); + newUsersOnly(other.getNewUsersOnly()); + onePerCustomer(other.getOnePerCustomer()); + planIds(other.getPlanIds()); + productId(other.getProductId()); + promoDurationMonths(other.getPromoDurationMonths()); + promoType(other.getPromoType()); + stock(other.getStock()); + unlimitedStock(other.getUnlimitedStock()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public AmountOffStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("amount_off") + public BaseCurrencyStage amountOff(double amountOff) { + this.amountOff = amountOff; + return this; + } + + @java.lang.Override + @JsonSetter("base_currency") + public CodeStage baseCurrency(@NotNull CreatePromoCodesRequestBaseCurrency baseCurrency) { + this.baseCurrency = Objects.requireNonNull(baseCurrency, "baseCurrency must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("code") + public NewUsersOnlyStage code(@NotNull String code) { + this.code = Objects.requireNonNull(code, "code must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("new_users_only") + public PromoDurationMonthsStage newUsersOnly(boolean newUsersOnly) { + this.newUsersOnly = newUsersOnly; + return this; + } + + @java.lang.Override + @JsonSetter("promo_duration_months") + public PromoTypeStage promoDurationMonths(int promoDurationMonths) { + this.promoDurationMonths = promoDurationMonths; + return this; + } + + @java.lang.Override + @JsonSetter("promo_type") + public _FinalStage promoType(@NotNull CreatePromoCodesRequestPromoType promoType) { + this.promoType = Objects.requireNonNull(promoType, "promoType must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage unlimitedStock(Boolean unlimitedStock) { + this.unlimitedStock = Optional.ofNullable(unlimitedStock); + return this; + } + + @java.lang.Override + @JsonSetter(value = "unlimited_stock", nulls = Nulls.SKIP) + public _FinalStage unlimitedStock(Optional unlimitedStock) { + this.unlimitedStock = unlimitedStock; + return this; + } + + @java.lang.Override + public _FinalStage stock(Nullable stock) { + if (stock.isNull()) { + this.stock = null; + } else if (stock.isEmpty()) { + this.stock = Optional.empty(); + } else { + this.stock = Optional.of(stock.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage stock(Integer stock) { + this.stock = Optional.ofNullable(stock); + return this; + } + + @java.lang.Override + @JsonSetter(value = "stock", nulls = Nulls.SKIP) + public _FinalStage stock(Optional stock) { + this.stock = stock; + return this; + } + + @java.lang.Override + public _FinalStage productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + @java.lang.Override + public _FinalStage planIds(List planIds) { + this.planIds = Optional.ofNullable(planIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plan_ids", nulls = Nulls.SKIP) + public _FinalStage planIds(Optional> planIds) { + this.planIds = planIds; + return this; + } + + @java.lang.Override + public _FinalStage onePerCustomer(Boolean onePerCustomer) { + this.onePerCustomer = Optional.ofNullable(onePerCustomer); + return this; + } + + @java.lang.Override + @JsonSetter(value = "one_per_customer", nulls = Nulls.SKIP) + public _FinalStage onePerCustomer(Optional onePerCustomer) { + this.onePerCustomer = onePerCustomer; + return this; + } + + @java.lang.Override + public _FinalStage expiresAt(Nullable expiresAt) { + if (expiresAt.isNull()) { + this.expiresAt = null; + } else if (expiresAt.isEmpty()) { + this.expiresAt = Optional.empty(); + } else { + this.expiresAt = Optional.of(expiresAt.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage expiresAt(String expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public _FinalStage expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + @java.lang.Override + public _FinalStage existingMembershipsOnly(Boolean existingMembershipsOnly) { + this.existingMembershipsOnly = Optional.ofNullable(existingMembershipsOnly); + return this; + } + + @java.lang.Override + @JsonSetter(value = "existing_memberships_only", nulls = Nulls.SKIP) + public _FinalStage existingMembershipsOnly(Optional existingMembershipsOnly) { + this.existingMembershipsOnly = existingMembershipsOnly; + return this; + } + + @java.lang.Override + public _FinalStage churnedUsersOnly(Boolean churnedUsersOnly) { + this.churnedUsersOnly = Optional.ofNullable(churnedUsersOnly); + return this; + } + + @java.lang.Override + @JsonSetter(value = "churned_users_only", nulls = Nulls.SKIP) + public _FinalStage churnedUsersOnly(Optional churnedUsersOnly) { + this.churnedUsersOnly = churnedUsersOnly; + return this; + } + + @java.lang.Override + public CreatePromoCodesRequest build() { + return new CreatePromoCodesRequest( + accountId, + amountOff, + baseCurrency, + churnedUsersOnly, + code, + existingMembershipsOnly, + expiresAt, + newUsersOnly, + onePerCustomer, + planIds, + productId, + promoDurationMonths, + promoType, + stock, + unlimitedStock, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/requests/DeactivatePromoCodesRequest.java b/src/main/java/com/whop/api/resources/promocodes/requests/DeactivatePromoCodesRequest.java new file mode 100644 index 00000000..26784862 --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/requests/DeactivatePromoCodesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeactivatePromoCodesRequest.Builder.class) +public final class DeactivatePromoCodesRequest { + private final Map additionalProperties; + + private DeactivatePromoCodesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeactivatePromoCodesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeactivatePromoCodesRequest other) { + return this; + } + + public DeactivatePromoCodesRequest build() { + return new DeactivatePromoCodesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/requests/DeletePromoCodesRequest.java b/src/main/java/com/whop/api/resources/promocodes/requests/DeletePromoCodesRequest.java new file mode 100644 index 00000000..3e750765 --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/requests/DeletePromoCodesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeletePromoCodesRequest.Builder.class) +public final class DeletePromoCodesRequest { + private final Map additionalProperties; + + private DeletePromoCodesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeletePromoCodesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeletePromoCodesRequest other) { + return this; + } + + public DeletePromoCodesRequest build() { + return new DeletePromoCodesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/requests/ListPromoCodesRequest.java b/src/main/java/com/whop/api/resources/promocodes/requests/ListPromoCodesRequest.java new file mode 100644 index 00000000..31b4e151 --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/requests/ListPromoCodesRequest.java @@ -0,0 +1,653 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.promocodes.types.ListPromoCodesRequestDirection; +import com.whop.api.resources.promocodes.types.ListPromoCodesRequestOrder; +import com.whop.api.resources.promocodes.types.ListPromoCodesRequestStatus; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPromoCodesRequest.Builder.class) +public final class ListPromoCodesRequest { + private final Optional> productIds; + + private final Optional> planIds; + + private final String accountId; + + private final Optional status; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional order; + + private final Optional direction; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListPromoCodesRequest( + Optional> productIds, + Optional> planIds, + String accountId, + Optional status, + Optional createdBefore, + Optional createdAfter, + Optional order, + Optional direction, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.productIds = productIds; + this.planIds = planIds; + this.accountId = accountId; + this.status = status; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.order = order; + this.direction = direction; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only promo codes scoped to these product IDs. + */ + @JsonProperty("product_ids") + public Optional> getProductIds() { + return productIds; + } + + /** + * @return Only promo codes scoped to these plan IDs. + */ + @JsonProperty("plan_ids") + public Optional> getPlanIds() { + return planIds; + } + + /** + * @return Account whose promo codes are listed (biz_ tag). + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Promo-code status. expired groups inactive and archived codes. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Only promo codes created before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only promo codes created after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Sort field. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Number of promo codes to return from the start of the window. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to paginate forwards from. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return Number of promo codes to return from the end of the window. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to paginate backwards from. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPromoCodesRequest && equalTo((ListPromoCodesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPromoCodesRequest other) { + return productIds.equals(other.productIds) + && planIds.equals(other.planIds) + && accountId.equals(other.accountId) + && status.equals(other.status) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && order.equals(other.order) + && direction.equals(other.direction) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.productIds, + this.planIds, + this.accountId, + this.status, + this.createdBefore, + this.createdAfter, + this.order, + this.direction, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Account whose promo codes are listed (biz_ tag).

+ */ + _FinalStage accountId(@NotNull String accountId); + + Builder from(ListPromoCodesRequest other); + } + + public interface _FinalStage { + ListPromoCodesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Only promo codes scoped to these product IDs.

+ */ + _FinalStage productIds(Optional> productIds); + + _FinalStage productIds(List productIds); + + _FinalStage productIds(String productIds); + + /** + *

Only promo codes scoped to these plan IDs.

+ */ + _FinalStage planIds(Optional> planIds); + + _FinalStage planIds(List planIds); + + _FinalStage planIds(String planIds); + + /** + *

Promo-code status. expired groups inactive and archived codes.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(ListPromoCodesRequestStatus status); + + /** + *

Only promo codes created before this ISO 8601 timestamp.

+ */ + _FinalStage createdBefore(Optional createdBefore); + + _FinalStage createdBefore(OffsetDateTime createdBefore); + + /** + *

Only promo codes created after this ISO 8601 timestamp.

+ */ + _FinalStage createdAfter(Optional createdAfter); + + _FinalStage createdAfter(OffsetDateTime createdAfter); + + /** + *

Sort field.

+ */ + _FinalStage order(Optional order); + + _FinalStage order(ListPromoCodesRequestOrder order); + + /** + *

Sort direction.

+ */ + _FinalStage direction(Optional direction); + + _FinalStage direction(ListPromoCodesRequestDirection direction); + + /** + *

Number of promo codes to return from the start of the window.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Cursor to paginate forwards from.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Number of promo codes to return from the end of the window.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + /** + *

Cursor to paginate backwards from.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, _FinalStage { + private String accountId; + + private Optional before = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional> planIds = Optional.empty(); + + private Optional> productIds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPromoCodesRequest other) { + productIds(other.getProductIds()); + planIds(other.getPlanIds()); + accountId(other.getAccountId()); + status(other.getStatus()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + order(other.getOrder()); + direction(other.getDirection()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

Account whose promo codes are listed (biz_ tag).

+ *

Account whose promo codes are listed (biz_ tag).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

Cursor to paginate backwards from.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Cursor to paginate backwards from.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Number of promo codes to return from the end of the window.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Number of promo codes to return from the end of the window.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Cursor to paginate forwards from.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Cursor to paginate forwards from.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + /** + *

Number of promo codes to return from the start of the window.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Number of promo codes to return from the start of the window.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Sort direction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage direction(ListPromoCodesRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Sort direction.

+ */ + @java.lang.Override + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public _FinalStage direction(Optional direction) { + this.direction = direction; + return this; + } + + /** + *

Sort field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(ListPromoCodesRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort field.

+ */ + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + /** + *

Only promo codes created after this ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only promo codes created after this ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public _FinalStage createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + /** + *

Only promo codes created before this ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only promo codes created before this ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public _FinalStage createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + /** + *

Promo-code status. expired groups inactive and archived codes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(ListPromoCodesRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Promo-code status. expired groups inactive and archived codes.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + @java.lang.Override + public _FinalStage planIds(String planIds) { + this.planIds = Optional.of(Collections.singletonList(planIds)); + return this; + } + + /** + *

Only promo codes scoped to these plan IDs.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planIds(List planIds) { + this.planIds = Optional.ofNullable(planIds); + return this; + } + + /** + *

Only promo codes scoped to these plan IDs.

+ */ + @java.lang.Override + @JsonSetter(value = "plan_ids", nulls = Nulls.SKIP) + public _FinalStage planIds(Optional> planIds) { + this.planIds = planIds; + return this; + } + + @java.lang.Override + public _FinalStage productIds(String productIds) { + this.productIds = Optional.of(Collections.singletonList(productIds)); + return this; + } + + /** + *

Only promo codes scoped to these product IDs.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productIds(List productIds) { + this.productIds = Optional.ofNullable(productIds); + return this; + } + + /** + *

Only promo codes scoped to these product IDs.

+ */ + @java.lang.Override + @JsonSetter(value = "product_ids", nulls = Nulls.SKIP) + public _FinalStage productIds(Optional> productIds) { + this.productIds = productIds; + return this; + } + + @java.lang.Override + public ListPromoCodesRequest build() { + return new ListPromoCodesRequest( + productIds, + planIds, + accountId, + status, + createdBefore, + createdAfter, + order, + direction, + first, + after, + last, + before, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/requests/RetrievePromoCodesRequest.java b/src/main/java/com/whop/api/resources/promocodes/requests/RetrievePromoCodesRequest.java new file mode 100644 index 00000000..a3c42615 --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/requests/RetrievePromoCodesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrievePromoCodesRequest.Builder.class) +public final class RetrievePromoCodesRequest { + private final Map additionalProperties; + + private RetrievePromoCodesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrievePromoCodesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrievePromoCodesRequest other) { + return this; + } + + public RetrievePromoCodesRequest build() { + return new RetrievePromoCodesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/types/CreatePromoCodesRequestBaseCurrency.java b/src/main/java/com/whop/api/resources/promocodes/types/CreatePromoCodesRequestBaseCurrency.java new file mode 100644 index 00000000..4b0f2e3e --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/types/CreatePromoCodesRequestBaseCurrency.java @@ -0,0 +1,1054 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreatePromoCodesRequestBaseCurrency { + public static final CreatePromoCodesRequestBaseCurrency CRC = + new CreatePromoCodesRequestBaseCurrency(Value.CRC, "crc"); + + public static final CreatePromoCodesRequestBaseCurrency OMR = + new CreatePromoCodesRequestBaseCurrency(Value.OMR, "omr"); + + public static final CreatePromoCodesRequestBaseCurrency RUB = + new CreatePromoCodesRequestBaseCurrency(Value.RUB, "rub"); + + public static final CreatePromoCodesRequestBaseCurrency BGN = + new CreatePromoCodesRequestBaseCurrency(Value.BGN, "bgn"); + + public static final CreatePromoCodesRequestBaseCurrency SAR = + new CreatePromoCodesRequestBaseCurrency(Value.SAR, "sar"); + + public static final CreatePromoCodesRequestBaseCurrency UYU = + new CreatePromoCodesRequestBaseCurrency(Value.UYU, "uyu"); + + public static final CreatePromoCodesRequestBaseCurrency TZS = + new CreatePromoCodesRequestBaseCurrency(Value.TZS, "tzs"); + + public static final CreatePromoCodesRequestBaseCurrency XCD = + new CreatePromoCodesRequestBaseCurrency(Value.XCD, "xcd"); + + public static final CreatePromoCodesRequestBaseCurrency GTQ = + new CreatePromoCodesRequestBaseCurrency(Value.GTQ, "gtq"); + + public static final CreatePromoCodesRequestBaseCurrency CHF = + new CreatePromoCodesRequestBaseCurrency(Value.CHF, "chf"); + + public static final CreatePromoCodesRequestBaseCurrency RON = + new CreatePromoCodesRequestBaseCurrency(Value.RON, "ron"); + + public static final CreatePromoCodesRequestBaseCurrency PHP = + new CreatePromoCodesRequestBaseCurrency(Value.PHP, "php"); + + public static final CreatePromoCodesRequestBaseCurrency KES = + new CreatePromoCodesRequestBaseCurrency(Value.KES, "kes"); + + public static final CreatePromoCodesRequestBaseCurrency XAU = + new CreatePromoCodesRequestBaseCurrency(Value.XAU, "xau"); + + public static final CreatePromoCodesRequestBaseCurrency BSD = + new CreatePromoCodesRequestBaseCurrency(Value.BSD, "bsd"); + + public static final CreatePromoCodesRequestBaseCurrency INR = + new CreatePromoCodesRequestBaseCurrency(Value.INR, "inr"); + + public static final CreatePromoCodesRequestBaseCurrency HKD = + new CreatePromoCodesRequestBaseCurrency(Value.HKD, "hkd"); + + public static final CreatePromoCodesRequestBaseCurrency JOD = + new CreatePromoCodesRequestBaseCurrency(Value.JOD, "jod"); + + public static final CreatePromoCodesRequestBaseCurrency MKD = + new CreatePromoCodesRequestBaseCurrency(Value.MKD, "mkd"); + + public static final CreatePromoCodesRequestBaseCurrency CLP = + new CreatePromoCodesRequestBaseCurrency(Value.CLP, "clp"); + + public static final CreatePromoCodesRequestBaseCurrency NZD = + new CreatePromoCodesRequestBaseCurrency(Value.NZD, "nzd"); + + public static final CreatePromoCodesRequestBaseCurrency IDR = + new CreatePromoCodesRequestBaseCurrency(Value.IDR, "idr"); + + public static final CreatePromoCodesRequestBaseCurrency MOP = + new CreatePromoCodesRequestBaseCurrency(Value.MOP, "mop"); + + public static final CreatePromoCodesRequestBaseCurrency HUF = + new CreatePromoCodesRequestBaseCurrency(Value.HUF, "huf"); + + public static final CreatePromoCodesRequestBaseCurrency MAD = + new CreatePromoCodesRequestBaseCurrency(Value.MAD, "mad"); + + public static final CreatePromoCodesRequestBaseCurrency KHR = + new CreatePromoCodesRequestBaseCurrency(Value.KHR, "khr"); + + public static final CreatePromoCodesRequestBaseCurrency NGN = + new CreatePromoCodesRequestBaseCurrency(Value.NGN, "ngn"); + + public static final CreatePromoCodesRequestBaseCurrency THB = + new CreatePromoCodesRequestBaseCurrency(Value.THB, "thb"); + + public static final CreatePromoCodesRequestBaseCurrency DZD = + new CreatePromoCodesRequestBaseCurrency(Value.DZD, "dzd"); + + public static final CreatePromoCodesRequestBaseCurrency ARS = + new CreatePromoCodesRequestBaseCurrency(Value.ARS, "ars"); + + public static final CreatePromoCodesRequestBaseCurrency CAD = + new CreatePromoCodesRequestBaseCurrency(Value.CAD, "cad"); + + public static final CreatePromoCodesRequestBaseCurrency MYR = + new CreatePromoCodesRequestBaseCurrency(Value.MYR, "myr"); + + public static final CreatePromoCodesRequestBaseCurrency KRW = + new CreatePromoCodesRequestBaseCurrency(Value.KRW, "krw"); + + public static final CreatePromoCodesRequestBaseCurrency KZT = + new CreatePromoCodesRequestBaseCurrency(Value.KZT, "kzt"); + + public static final CreatePromoCodesRequestBaseCurrency ETH = + new CreatePromoCodesRequestBaseCurrency(Value.ETH, "eth"); + + public static final CreatePromoCodesRequestBaseCurrency COP = + new CreatePromoCodesRequestBaseCurrency(Value.COP, "cop"); + + public static final CreatePromoCodesRequestBaseCurrency JMD = + new CreatePromoCodesRequestBaseCurrency(Value.JMD, "jmd"); + + public static final CreatePromoCodesRequestBaseCurrency NAD = + new CreatePromoCodesRequestBaseCurrency(Value.NAD, "nad"); + + public static final CreatePromoCodesRequestBaseCurrency GYD = + new CreatePromoCodesRequestBaseCurrency(Value.GYD, "gyd"); + + public static final CreatePromoCodesRequestBaseCurrency KWD = + new CreatePromoCodesRequestBaseCurrency(Value.KWD, "kwd"); + + public static final CreatePromoCodesRequestBaseCurrency DOP = + new CreatePromoCodesRequestBaseCurrency(Value.DOP, "dop"); + + public static final CreatePromoCodesRequestBaseCurrency BTC = + new CreatePromoCodesRequestBaseCurrency(Value.BTC, "btc"); + + public static final CreatePromoCodesRequestBaseCurrency AMD = + new CreatePromoCodesRequestBaseCurrency(Value.AMD, "amd"); + + public static final CreatePromoCodesRequestBaseCurrency LKR = + new CreatePromoCodesRequestBaseCurrency(Value.LKR, "lkr"); + + public static final CreatePromoCodesRequestBaseCurrency ALL = + new CreatePromoCodesRequestBaseCurrency(Value.ALL, "all"); + + public static final CreatePromoCodesRequestBaseCurrency USDT = + new CreatePromoCodesRequestBaseCurrency(Value.USDT, "usdt"); + + public static final CreatePromoCodesRequestBaseCurrency TND = + new CreatePromoCodesRequestBaseCurrency(Value.TND, "tnd"); + + public static final CreatePromoCodesRequestBaseCurrency MUR = + new CreatePromoCodesRequestBaseCurrency(Value.MUR, "mur"); + + public static final CreatePromoCodesRequestBaseCurrency PEN = + new CreatePromoCodesRequestBaseCurrency(Value.PEN, "pen"); + + public static final CreatePromoCodesRequestBaseCurrency USD = + new CreatePromoCodesRequestBaseCurrency(Value.USD, "usd"); + + public static final CreatePromoCodesRequestBaseCurrency APE = + new CreatePromoCodesRequestBaseCurrency(Value.APE, "ape"); + + public static final CreatePromoCodesRequestBaseCurrency BHD = + new CreatePromoCodesRequestBaseCurrency(Value.BHD, "bhd"); + + public static final CreatePromoCodesRequestBaseCurrency XOF = + new CreatePromoCodesRequestBaseCurrency(Value.XOF, "xof"); + + public static final CreatePromoCodesRequestBaseCurrency RWF = + new CreatePromoCodesRequestBaseCurrency(Value.RWF, "rwf"); + + public static final CreatePromoCodesRequestBaseCurrency GBP = + new CreatePromoCodesRequestBaseCurrency(Value.GBP, "gbp"); + + public static final CreatePromoCodesRequestBaseCurrency VND = + new CreatePromoCodesRequestBaseCurrency(Value.VND, "vnd"); + + public static final CreatePromoCodesRequestBaseCurrency MNT = + new CreatePromoCodesRequestBaseCurrency(Value.MNT, "mnt"); + + public static final CreatePromoCodesRequestBaseCurrency ETB = + new CreatePromoCodesRequestBaseCurrency(Value.ETB, "etb"); + + public static final CreatePromoCodesRequestBaseCurrency TTD = + new CreatePromoCodesRequestBaseCurrency(Value.TTD, "ttd"); + + public static final CreatePromoCodesRequestBaseCurrency EUR = + new CreatePromoCodesRequestBaseCurrency(Value.EUR, "eur"); + + public static final CreatePromoCodesRequestBaseCurrency BRL = + new CreatePromoCodesRequestBaseCurrency(Value.BRL, "brl"); + + public static final CreatePromoCodesRequestBaseCurrency SEK = + new CreatePromoCodesRequestBaseCurrency(Value.SEK, "sek"); + + public static final CreatePromoCodesRequestBaseCurrency RSD = + new CreatePromoCodesRequestBaseCurrency(Value.RSD, "rsd"); + + public static final CreatePromoCodesRequestBaseCurrency UZS = + new CreatePromoCodesRequestBaseCurrency(Value.UZS, "uzs"); + + public static final CreatePromoCodesRequestBaseCurrency TWD = + new CreatePromoCodesRequestBaseCurrency(Value.TWD, "twd"); + + public static final CreatePromoCodesRequestBaseCurrency NOK = + new CreatePromoCodesRequestBaseCurrency(Value.NOK, "nok"); + + public static final CreatePromoCodesRequestBaseCurrency WHOP_USD = + new CreatePromoCodesRequestBaseCurrency(Value.WHOP_USD, "whop_usd"); + + public static final CreatePromoCodesRequestBaseCurrency PYG = + new CreatePromoCodesRequestBaseCurrency(Value.PYG, "pyg"); + + public static final CreatePromoCodesRequestBaseCurrency TRY = + new CreatePromoCodesRequestBaseCurrency(Value.TRY, "try"); + + public static final CreatePromoCodesRequestBaseCurrency ZAR = + new CreatePromoCodesRequestBaseCurrency(Value.ZAR, "zar"); + + public static final CreatePromoCodesRequestBaseCurrency PKR = + new CreatePromoCodesRequestBaseCurrency(Value.PKR, "pkr"); + + public static final CreatePromoCodesRequestBaseCurrency CNY = + new CreatePromoCodesRequestBaseCurrency(Value.CNY, "cny"); + + public static final CreatePromoCodesRequestBaseCurrency CZK = + new CreatePromoCodesRequestBaseCurrency(Value.CZK, "czk"); + + public static final CreatePromoCodesRequestBaseCurrency ILS = + new CreatePromoCodesRequestBaseCurrency(Value.ILS, "ils"); + + public static final CreatePromoCodesRequestBaseCurrency MGA = + new CreatePromoCodesRequestBaseCurrency(Value.MGA, "mga"); + + public static final CreatePromoCodesRequestBaseCurrency AED = + new CreatePromoCodesRequestBaseCurrency(Value.AED, "aed"); + + public static final CreatePromoCodesRequestBaseCurrency GHS = + new CreatePromoCodesRequestBaseCurrency(Value.GHS, "ghs"); + + public static final CreatePromoCodesRequestBaseCurrency BAM = + new CreatePromoCodesRequestBaseCurrency(Value.BAM, "bam"); + + public static final CreatePromoCodesRequestBaseCurrency JPY = + new CreatePromoCodesRequestBaseCurrency(Value.JPY, "jpy"); + + public static final CreatePromoCodesRequestBaseCurrency PLN = + new CreatePromoCodesRequestBaseCurrency(Value.PLN, "pln"); + + public static final CreatePromoCodesRequestBaseCurrency BOB = + new CreatePromoCodesRequestBaseCurrency(Value.BOB, "bob"); + + public static final CreatePromoCodesRequestBaseCurrency QAR = + new CreatePromoCodesRequestBaseCurrency(Value.QAR, "qar"); + + public static final CreatePromoCodesRequestBaseCurrency EGP = + new CreatePromoCodesRequestBaseCurrency(Value.EGP, "egp"); + + public static final CreatePromoCodesRequestBaseCurrency AWG = + new CreatePromoCodesRequestBaseCurrency(Value.AWG, "awg"); + + public static final CreatePromoCodesRequestBaseCurrency DKK = + new CreatePromoCodesRequestBaseCurrency(Value.DKK, "dkk"); + + public static final CreatePromoCodesRequestBaseCurrency MDL = + new CreatePromoCodesRequestBaseCurrency(Value.MDL, "mdl"); + + public static final CreatePromoCodesRequestBaseCurrency MXN = + new CreatePromoCodesRequestBaseCurrency(Value.MXN, "mxn"); + + public static final CreatePromoCodesRequestBaseCurrency SGD = + new CreatePromoCodesRequestBaseCurrency(Value.SGD, "sgd"); + + public static final CreatePromoCodesRequestBaseCurrency AUD = + new CreatePromoCodesRequestBaseCurrency(Value.AUD, "aud"); + + public static final CreatePromoCodesRequestBaseCurrency GMD = + new CreatePromoCodesRequestBaseCurrency(Value.GMD, "gmd"); + + private final Value value; + + private final String string; + + CreatePromoCodesRequestBaseCurrency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreatePromoCodesRequestBaseCurrency + && this.string.equals(((CreatePromoCodesRequestBaseCurrency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CRC: + return visitor.visitCrc(); + case OMR: + return visitor.visitOmr(); + case RUB: + return visitor.visitRub(); + case BGN: + return visitor.visitBgn(); + case SAR: + return visitor.visitSar(); + case UYU: + return visitor.visitUyu(); + case TZS: + return visitor.visitTzs(); + case XCD: + return visitor.visitXcd(); + case GTQ: + return visitor.visitGtq(); + case CHF: + return visitor.visitChf(); + case RON: + return visitor.visitRon(); + case PHP: + return visitor.visitPhp(); + case KES: + return visitor.visitKes(); + case XAU: + return visitor.visitXau(); + case BSD: + return visitor.visitBsd(); + case INR: + return visitor.visitInr(); + case HKD: + return visitor.visitHkd(); + case JOD: + return visitor.visitJod(); + case MKD: + return visitor.visitMkd(); + case CLP: + return visitor.visitClp(); + case NZD: + return visitor.visitNzd(); + case IDR: + return visitor.visitIdr(); + case MOP: + return visitor.visitMop(); + case HUF: + return visitor.visitHuf(); + case MAD: + return visitor.visitMad(); + case KHR: + return visitor.visitKhr(); + case NGN: + return visitor.visitNgn(); + case THB: + return visitor.visitThb(); + case DZD: + return visitor.visitDzd(); + case ARS: + return visitor.visitArs(); + case CAD: + return visitor.visitCad(); + case MYR: + return visitor.visitMyr(); + case KRW: + return visitor.visitKrw(); + case KZT: + return visitor.visitKzt(); + case ETH: + return visitor.visitEth(); + case COP: + return visitor.visitCop(); + case JMD: + return visitor.visitJmd(); + case NAD: + return visitor.visitNad(); + case GYD: + return visitor.visitGyd(); + case KWD: + return visitor.visitKwd(); + case DOP: + return visitor.visitDop(); + case BTC: + return visitor.visitBtc(); + case AMD: + return visitor.visitAmd(); + case LKR: + return visitor.visitLkr(); + case ALL: + return visitor.visitAll(); + case USDT: + return visitor.visitUsdt(); + case TND: + return visitor.visitTnd(); + case MUR: + return visitor.visitMur(); + case PEN: + return visitor.visitPen(); + case USD: + return visitor.visitUsd(); + case APE: + return visitor.visitApe(); + case BHD: + return visitor.visitBhd(); + case XOF: + return visitor.visitXof(); + case RWF: + return visitor.visitRwf(); + case GBP: + return visitor.visitGbp(); + case VND: + return visitor.visitVnd(); + case MNT: + return visitor.visitMnt(); + case ETB: + return visitor.visitEtb(); + case TTD: + return visitor.visitTtd(); + case EUR: + return visitor.visitEur(); + case BRL: + return visitor.visitBrl(); + case SEK: + return visitor.visitSek(); + case RSD: + return visitor.visitRsd(); + case UZS: + return visitor.visitUzs(); + case TWD: + return visitor.visitTwd(); + case NOK: + return visitor.visitNok(); + case WHOP_USD: + return visitor.visitWhopUsd(); + case PYG: + return visitor.visitPyg(); + case TRY: + return visitor.visitTry(); + case ZAR: + return visitor.visitZar(); + case PKR: + return visitor.visitPkr(); + case CNY: + return visitor.visitCny(); + case CZK: + return visitor.visitCzk(); + case ILS: + return visitor.visitIls(); + case MGA: + return visitor.visitMga(); + case AED: + return visitor.visitAed(); + case GHS: + return visitor.visitGhs(); + case BAM: + return visitor.visitBam(); + case JPY: + return visitor.visitJpy(); + case PLN: + return visitor.visitPln(); + case BOB: + return visitor.visitBob(); + case QAR: + return visitor.visitQar(); + case EGP: + return visitor.visitEgp(); + case AWG: + return visitor.visitAwg(); + case DKK: + return visitor.visitDkk(); + case MDL: + return visitor.visitMdl(); + case MXN: + return visitor.visitMxn(); + case SGD: + return visitor.visitSgd(); + case AUD: + return visitor.visitAud(); + case GMD: + return visitor.visitGmd(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreatePromoCodesRequestBaseCurrency valueOf(String value) { + switch (value) { + case "crc": + return CRC; + case "omr": + return OMR; + case "rub": + return RUB; + case "bgn": + return BGN; + case "sar": + return SAR; + case "uyu": + return UYU; + case "tzs": + return TZS; + case "xcd": + return XCD; + case "gtq": + return GTQ; + case "chf": + return CHF; + case "ron": + return RON; + case "php": + return PHP; + case "kes": + return KES; + case "xau": + return XAU; + case "bsd": + return BSD; + case "inr": + return INR; + case "hkd": + return HKD; + case "jod": + return JOD; + case "mkd": + return MKD; + case "clp": + return CLP; + case "nzd": + return NZD; + case "idr": + return IDR; + case "mop": + return MOP; + case "huf": + return HUF; + case "mad": + return MAD; + case "khr": + return KHR; + case "ngn": + return NGN; + case "thb": + return THB; + case "dzd": + return DZD; + case "ars": + return ARS; + case "cad": + return CAD; + case "myr": + return MYR; + case "krw": + return KRW; + case "kzt": + return KZT; + case "eth": + return ETH; + case "cop": + return COP; + case "jmd": + return JMD; + case "nad": + return NAD; + case "gyd": + return GYD; + case "kwd": + return KWD; + case "dop": + return DOP; + case "btc": + return BTC; + case "amd": + return AMD; + case "lkr": + return LKR; + case "all": + return ALL; + case "usdt": + return USDT; + case "tnd": + return TND; + case "mur": + return MUR; + case "pen": + return PEN; + case "usd": + return USD; + case "ape": + return APE; + case "bhd": + return BHD; + case "xof": + return XOF; + case "rwf": + return RWF; + case "gbp": + return GBP; + case "vnd": + return VND; + case "mnt": + return MNT; + case "etb": + return ETB; + case "ttd": + return TTD; + case "eur": + return EUR; + case "brl": + return BRL; + case "sek": + return SEK; + case "rsd": + return RSD; + case "uzs": + return UZS; + case "twd": + return TWD; + case "nok": + return NOK; + case "whop_usd": + return WHOP_USD; + case "pyg": + return PYG; + case "try": + return TRY; + case "zar": + return ZAR; + case "pkr": + return PKR; + case "cny": + return CNY; + case "czk": + return CZK; + case "ils": + return ILS; + case "mga": + return MGA; + case "aed": + return AED; + case "ghs": + return GHS; + case "bam": + return BAM; + case "jpy": + return JPY; + case "pln": + return PLN; + case "bob": + return BOB; + case "qar": + return QAR; + case "egp": + return EGP; + case "awg": + return AWG; + case "dkk": + return DKK; + case "mdl": + return MDL; + case "mxn": + return MXN; + case "sgd": + return SGD; + case "aud": + return AUD; + case "gmd": + return GMD; + default: + return new CreatePromoCodesRequestBaseCurrency(Value.UNKNOWN, value); + } + } + + public enum Value { + USD, + + SGD, + + INR, + + AUD, + + BRL, + + CAD, + + DKK, + + EUR, + + NOK, + + GBP, + + SEK, + + CHF, + + HKD, + + HUF, + + JPY, + + MXN, + + MYR, + + PLN, + + CZK, + + NZD, + + AED, + + ETH, + + APE, + + COP, + + RON, + + THB, + + BGN, + + IDR, + + DOP, + + PHP, + + TRY, + + KRW, + + TWD, + + VND, + + PKR, + + CLP, + + UYU, + + ARS, + + ZAR, + + DZD, + + TND, + + MAD, + + KES, + + KWD, + + JOD, + + ALL, + + XCD, + + AMD, + + BSD, + + BHD, + + BOB, + + BAM, + + KHR, + + CRC, + + XOF, + + EGP, + + ETB, + + GMD, + + GHS, + + GTQ, + + GYD, + + ILS, + + JMD, + + MOP, + + MGA, + + MUR, + + MDL, + + MNT, + + NAD, + + NGN, + + MKD, + + OMR, + + PYG, + + PEN, + + QAR, + + RWF, + + SAR, + + RSD, + + LKR, + + TZS, + + TTD, + + UZS, + + RUB, + + BTC, + + CNY, + + USDT, + + KZT, + + AWG, + + WHOP_USD, + + XAU, + + UNKNOWN + } + + public interface Visitor { + T visitUsd(); + + T visitSgd(); + + T visitInr(); + + T visitAud(); + + T visitBrl(); + + T visitCad(); + + T visitDkk(); + + T visitEur(); + + T visitNok(); + + T visitGbp(); + + T visitSek(); + + T visitChf(); + + T visitHkd(); + + T visitHuf(); + + T visitJpy(); + + T visitMxn(); + + T visitMyr(); + + T visitPln(); + + T visitCzk(); + + T visitNzd(); + + T visitAed(); + + T visitEth(); + + T visitApe(); + + T visitCop(); + + T visitRon(); + + T visitThb(); + + T visitBgn(); + + T visitIdr(); + + T visitDop(); + + T visitPhp(); + + T visitTry(); + + T visitKrw(); + + T visitTwd(); + + T visitVnd(); + + T visitPkr(); + + T visitClp(); + + T visitUyu(); + + T visitArs(); + + T visitZar(); + + T visitDzd(); + + T visitTnd(); + + T visitMad(); + + T visitKes(); + + T visitKwd(); + + T visitJod(); + + T visitAll(); + + T visitXcd(); + + T visitAmd(); + + T visitBsd(); + + T visitBhd(); + + T visitBob(); + + T visitBam(); + + T visitKhr(); + + T visitCrc(); + + T visitXof(); + + T visitEgp(); + + T visitEtb(); + + T visitGmd(); + + T visitGhs(); + + T visitGtq(); + + T visitGyd(); + + T visitIls(); + + T visitJmd(); + + T visitMop(); + + T visitMga(); + + T visitMur(); + + T visitMdl(); + + T visitMnt(); + + T visitNad(); + + T visitNgn(); + + T visitMkd(); + + T visitOmr(); + + T visitPyg(); + + T visitPen(); + + T visitQar(); + + T visitRwf(); + + T visitSar(); + + T visitRsd(); + + T visitLkr(); + + T visitTzs(); + + T visitTtd(); + + T visitUzs(); + + T visitRub(); + + T visitBtc(); + + T visitCny(); + + T visitUsdt(); + + T visitKzt(); + + T visitAwg(); + + T visitWhopUsd(); + + T visitXau(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/types/CreatePromoCodesRequestPromoType.java b/src/main/java/com/whop/api/resources/promocodes/types/CreatePromoCodesRequestPromoType.java new file mode 100644 index 00000000..1f7a5488 --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/types/CreatePromoCodesRequestPromoType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreatePromoCodesRequestPromoType { + public static final CreatePromoCodesRequestPromoType FLAT_AMOUNT = + new CreatePromoCodesRequestPromoType(Value.FLAT_AMOUNT, "flat_amount"); + + public static final CreatePromoCodesRequestPromoType PERCENTAGE = + new CreatePromoCodesRequestPromoType(Value.PERCENTAGE, "percentage"); + + private final Value value; + + private final String string; + + CreatePromoCodesRequestPromoType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreatePromoCodesRequestPromoType + && this.string.equals(((CreatePromoCodesRequestPromoType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FLAT_AMOUNT: + return visitor.visitFlatAmount(); + case PERCENTAGE: + return visitor.visitPercentage(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreatePromoCodesRequestPromoType valueOf(String value) { + switch (value) { + case "flat_amount": + return FLAT_AMOUNT; + case "percentage": + return PERCENTAGE; + default: + return new CreatePromoCodesRequestPromoType(Value.UNKNOWN, value); + } + } + + public enum Value { + PERCENTAGE, + + FLAT_AMOUNT, + + UNKNOWN + } + + public interface Visitor { + T visitPercentage(); + + T visitFlatAmount(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/types/DeletePromoCodesResponse.java b/src/main/java/com/whop/api/resources/promocodes/types/DeletePromoCodesResponse.java new file mode 100644 index 00000000..c00f41ff --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/types/DeletePromoCodesResponse.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeletePromoCodesResponse.Builder.class) +public final class DeletePromoCodesResponse { + private final boolean deleted; + + private final String id; + + private final Map additionalProperties; + + private DeletePromoCodesResponse(boolean deleted, String id, Map additionalProperties) { + this.deleted = deleted; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("deleted") + public boolean getDeleted() { + return deleted; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeletePromoCodesResponse && equalTo((DeletePromoCodesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeletePromoCodesResponse other) { + return deleted == other.deleted && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deleted, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeletedStage builder() { + return new Builder(); + } + + public interface DeletedStage { + IdStage deleted(boolean deleted); + + Builder from(DeletePromoCodesResponse other); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DeletePromoCodesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeletedStage, IdStage, _FinalStage { + private boolean deleted; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeletePromoCodesResponse other) { + deleted(other.getDeleted()); + id(other.getId()); + return this; + } + + @java.lang.Override + @JsonSetter("deleted") + public IdStage deleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DeletePromoCodesResponse build() { + return new DeletePromoCodesResponse(deleted, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/types/ListPromoCodesRequestDirection.java b/src/main/java/com/whop/api/resources/promocodes/types/ListPromoCodesRequestDirection.java new file mode 100644 index 00000000..5ef692e6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/types/ListPromoCodesRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPromoCodesRequestDirection { + public static final ListPromoCodesRequestDirection ASC = new ListPromoCodesRequestDirection(Value.ASC, "asc"); + + public static final ListPromoCodesRequestDirection DESC = new ListPromoCodesRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListPromoCodesRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPromoCodesRequestDirection + && this.string.equals(((ListPromoCodesRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPromoCodesRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListPromoCodesRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/types/ListPromoCodesRequestOrder.java b/src/main/java/com/whop/api/resources/promocodes/types/ListPromoCodesRequestOrder.java new file mode 100644 index 00000000..b9a6bed0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/types/ListPromoCodesRequestOrder.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPromoCodesRequestOrder { + public static final ListPromoCodesRequestOrder CREATED_AT = + new ListPromoCodesRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListPromoCodesRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPromoCodesRequestOrder + && this.string.equals(((ListPromoCodesRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPromoCodesRequestOrder valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + default: + return new ListPromoCodesRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/types/ListPromoCodesRequestStatus.java b/src/main/java/com/whop/api/resources/promocodes/types/ListPromoCodesRequestStatus.java new file mode 100644 index 00000000..b05c8587 --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/types/ListPromoCodesRequestStatus.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPromoCodesRequestStatus { + public static final ListPromoCodesRequestStatus INACTIVE = + new ListPromoCodesRequestStatus(Value.INACTIVE, "inactive"); + + public static final ListPromoCodesRequestStatus EXPIRED = new ListPromoCodesRequestStatus(Value.EXPIRED, "expired"); + + public static final ListPromoCodesRequestStatus ARCHIVED = + new ListPromoCodesRequestStatus(Value.ARCHIVED, "archived"); + + public static final ListPromoCodesRequestStatus ACTIVE = new ListPromoCodesRequestStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + ListPromoCodesRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPromoCodesRequestStatus + && this.string.equals(((ListPromoCodesRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INACTIVE: + return visitor.visitInactive(); + case EXPIRED: + return visitor.visitExpired(); + case ARCHIVED: + return visitor.visitArchived(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPromoCodesRequestStatus valueOf(String value) { + switch (value) { + case "inactive": + return INACTIVE; + case "expired": + return EXPIRED; + case "archived": + return ARCHIVED; + case "active": + return ACTIVE; + default: + return new ListPromoCodesRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + ARCHIVED, + + EXPIRED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitArchived(); + + T visitExpired(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/types/ListPromoCodesResponse.java b/src/main/java/com/whop/api/resources/promocodes/types/ListPromoCodesResponse.java new file mode 100644 index 00000000..b54993e5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/types/ListPromoCodesResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PromoCodeListItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPromoCodesResponse.Builder.class) +public final class ListPromoCodesResponse { + private final List data; + + private final ListPromoCodesResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListPromoCodesResponse( + List data, + ListPromoCodesResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListPromoCodesResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPromoCodesResponse && equalTo((ListPromoCodesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPromoCodesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListPromoCodesResponsePageInfo pageInfo); + + Builder from(ListPromoCodesResponse other); + } + + public interface _FinalStage { + ListPromoCodesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(PromoCodeListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListPromoCodesResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPromoCodesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListPromoCodesResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(PromoCodeListItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListPromoCodesResponse build() { + return new ListPromoCodesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/promocodes/types/ListPromoCodesResponsePageInfo.java b/src/main/java/com/whop/api/resources/promocodes/types/ListPromoCodesResponsePageInfo.java new file mode 100644 index 00000000..6a5f1de8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/promocodes/types/ListPromoCodesResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.promocodes.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPromoCodesResponsePageInfo.Builder.class) +public final class ListPromoCodesResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListPromoCodesResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPromoCodesResponsePageInfo && equalTo((ListPromoCodesResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPromoCodesResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListPromoCodesResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListPromoCodesResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPromoCodesResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListPromoCodesResponsePageInfo build() { + return new ListPromoCodesResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/AsyncRawReactionsClient.java b/src/main/java/com/whop/api/resources/reactions/AsyncRawReactionsClient.java new file mode 100644 index 00000000..4fcde4af --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/AsyncRawReactionsClient.java @@ -0,0 +1,623 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.reactions.requests.CreateReactionsRequest; +import com.whop.api.resources.reactions.requests.DeleteReactionsRequest; +import com.whop.api.resources.reactions.requests.ListReactionsRequest; +import com.whop.api.resources.reactions.requests.RetrieveReactionsRequest; +import com.whop.api.resources.reactions.types.ListReactionsResponse; +import com.whop.api.types.Reaction; +import com.whop.api.types.ReactionListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawReactionsClient { + protected final ClientOptions clientOptions; + + public AsyncRawReactionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of emoji reactions on a specific message or forum post, sorted by most recent. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture>> list( + ListReactionsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of emoji reactions on a specific message or forum post, sorted by most recent. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture>> list( + ListReactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("reactions"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "resource_id", request.getResourceId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListReactionsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListReactionsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListReactionsRequest nextRequest = ListReactionsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Add an emoji reaction or poll vote to a message or forum post. In forums, the reaction is always a like. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> create(CreateReactionsRequest request) { + return create(request, null); + } + + /** + * Add an emoji reaction or poll vote to a message or forum post. In forums, the reaction is always a like. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> create( + CreateReactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("reactions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Reaction.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveReactionsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveReactionsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RetrieveReactionsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveReactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("reactions") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Reaction.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteReactionsRequest.builder().build()); + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteReactionsRequest.builder().build(), requestOptions); + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> delete(String id, DeleteReactionsRequest request) { + return delete(id, request, null); + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> delete( + String id, DeleteReactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("reactions") + .addPathSegment(id); + if (request.getEmoji().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "emoji", request.getEmoji().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/AsyncReactionsClient.java b/src/main/java/com/whop/api/resources/reactions/AsyncReactionsClient.java new file mode 100644 index 00000000..62d523fe --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/AsyncReactionsClient.java @@ -0,0 +1,215 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.reactions.requests.CreateReactionsRequest; +import com.whop.api.resources.reactions.requests.DeleteReactionsRequest; +import com.whop.api.resources.reactions.requests.ListReactionsRequest; +import com.whop.api.resources.reactions.requests.RetrieveReactionsRequest; +import com.whop.api.types.Reaction; +import com.whop.api.types.ReactionListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncReactionsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawReactionsClient rawClient; + + public AsyncReactionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawReactionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawReactionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of emoji reactions on a specific message or forum post, sorted by most recent. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> list(ListReactionsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of emoji reactions on a specific message or forum post, sorted by most recent. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> list( + ListReactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Add an emoji reaction or poll vote to a message or forum post. In forums, the reaction is always a like. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture create(CreateReactionsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Add an emoji reaction or poll vote to a message or forum post. In forums, the reaction is always a like. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture create(CreateReactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveReactionsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveReactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture delete(String id, DeleteReactionsRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture delete(String id, DeleteReactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/RawReactionsClient.java b/src/main/java/com/whop/api/resources/reactions/RawReactionsClient.java new file mode 100644 index 00000000..69eefbac --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/RawReactionsClient.java @@ -0,0 +1,500 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.reactions.requests.CreateReactionsRequest; +import com.whop.api.resources.reactions.requests.DeleteReactionsRequest; +import com.whop.api.resources.reactions.requests.ListReactionsRequest; +import com.whop.api.resources.reactions.requests.RetrieveReactionsRequest; +import com.whop.api.resources.reactions.types.ListReactionsResponse; +import com.whop.api.types.Reaction; +import com.whop.api.types.ReactionListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawReactionsClient { + protected final ClientOptions clientOptions; + + public RawReactionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of emoji reactions on a specific message or forum post, sorted by most recent. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListReactionsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of emoji reactions on a specific message or forum post, sorted by most recent. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListReactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("reactions"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "resource_id", request.getResourceId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListReactionsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListReactionsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListReactionsRequest nextRequest = ListReactionsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Add an emoji reaction or poll vote to a message or forum post. In forums, the reaction is always a like. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse create(CreateReactionsRequest request) { + return create(request, null); + } + + /** + * Add an emoji reaction or poll vote to a message or forum post. In forums, the reaction is always a like. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse create(CreateReactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("reactions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Reaction.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveReactionsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveReactionsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveReactionsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveReactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("reactions") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Reaction.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteReactionsRequest.builder().build()); + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteReactionsRequest.builder().build(), requestOptions); + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse delete(String id, DeleteReactionsRequest request) { + return delete(id, request, null); + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse delete( + String id, DeleteReactionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("reactions") + .addPathSegment(id); + if (request.getEmoji().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "emoji", request.getEmoji().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, boolean.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/ReactionsClient.java b/src/main/java/com/whop/api/resources/reactions/ReactionsClient.java new file mode 100644 index 00000000..e86d1660 --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/ReactionsClient.java @@ -0,0 +1,212 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.reactions.requests.CreateReactionsRequest; +import com.whop.api.resources.reactions.requests.DeleteReactionsRequest; +import com.whop.api.resources.reactions.requests.ListReactionsRequest; +import com.whop.api.resources.reactions.requests.RetrieveReactionsRequest; +import com.whop.api.types.Reaction; +import com.whop.api.types.ReactionListItem; + +public class ReactionsClient { + protected final ClientOptions clientOptions; + + private final RawReactionsClient rawClient; + + public ReactionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawReactionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawReactionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of emoji reactions on a specific message or forum post, sorted by most recent. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public SyncPagingIterable list(ListReactionsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of emoji reactions on a specific message or forum post, sorted by most recent. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public SyncPagingIterable list(ListReactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Add an emoji reaction or poll vote to a message or forum post. In forums, the reaction is always a like. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public Reaction create(CreateReactionsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Add an emoji reaction or poll vote to a message or forum post. In forums, the reaction is always a like. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public Reaction create(CreateReactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public Reaction retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public Reaction retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public Reaction retrieve(String id, RetrieveReactionsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public Reaction retrieve(String id, RetrieveReactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public boolean delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public boolean delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public boolean delete(String id, DeleteReactionsRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Remove an emoji reaction from a message or forum post. Only the reaction author or a channel admin can remove a reaction. + *

Required permissions (one of):

+ *
    + *
  • chat:read
  • + *
  • dms:read
  • + *
  • forum:read
  • + *
  • livestream:chat:read
  • + *
  • support_chat:read
  • + *
+ */ + public boolean delete(String id, DeleteReactionsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/requests/CreateReactionsRequest.java b/src/main/java/com/whop/api/resources/reactions/requests/CreateReactionsRequest.java new file mode 100644 index 00000000..07e13958 --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/requests/CreateReactionsRequest.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateReactionsRequest.Builder.class) +public final class CreateReactionsRequest { + private final Optional emoji; + + private final Optional pollOptionId; + + private final String resourceId; + + private final Map additionalProperties; + + private CreateReactionsRequest( + Optional emoji, + Optional pollOptionId, + String resourceId, + Map additionalProperties) { + this.emoji = emoji; + this.pollOptionId = pollOptionId; + this.resourceId = resourceId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The emoji to react with, in shortcode or unicode format. For example, ':heart:' or a unicode emoji. Ignored in forums where reactions are always likes. + */ + @JsonIgnore + public Optional getEmoji() { + if (emoji == null) { + return Optional.empty(); + } + return emoji; + } + + /** + * @return The unique identifier of a poll option to vote for. Only valid when the target message or post contains a poll. + */ + @JsonIgnore + public Optional getPollOptionId() { + if (pollOptionId == null) { + return Optional.empty(); + } + return pollOptionId; + } + + /** + * @return The unique identifier of the message or forum post to react to. + */ + @JsonProperty("resource_id") + public String getResourceId() { + return resourceId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("emoji") + private Optional _getEmoji() { + return emoji; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("poll_option_id") + private Optional _getPollOptionId() { + return pollOptionId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateReactionsRequest && equalTo((CreateReactionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateReactionsRequest other) { + return emoji.equals(other.emoji) + && pollOptionId.equals(other.pollOptionId) + && resourceId.equals(other.resourceId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.emoji, this.pollOptionId, this.resourceId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ResourceIdStage builder() { + return new Builder(); + } + + public interface ResourceIdStage { + /** + *

The unique identifier of the message or forum post to react to.

+ */ + _FinalStage resourceId(@NotNull String resourceId); + + Builder from(CreateReactionsRequest other); + } + + public interface _FinalStage { + CreateReactionsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The emoji to react with, in shortcode or unicode format. For example, ':heart:' or a unicode emoji. Ignored in forums where reactions are always likes.

+ */ + _FinalStage emoji(Optional emoji); + + _FinalStage emoji(String emoji); + + _FinalStage emoji(Nullable emoji); + + /** + *

The unique identifier of a poll option to vote for. Only valid when the target message or post contains a poll.

+ */ + _FinalStage pollOptionId(Optional pollOptionId); + + _FinalStage pollOptionId(String pollOptionId); + + _FinalStage pollOptionId(Nullable pollOptionId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ResourceIdStage, _FinalStage { + private String resourceId; + + private Optional pollOptionId = Optional.empty(); + + private Optional emoji = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateReactionsRequest other) { + emoji(other.getEmoji()); + pollOptionId(other.getPollOptionId()); + resourceId(other.getResourceId()); + return this; + } + + /** + *

The unique identifier of the message or forum post to react to.

+ *

The unique identifier of the message or forum post to react to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_id") + public _FinalStage resourceId(@NotNull String resourceId) { + this.resourceId = Objects.requireNonNull(resourceId, "resourceId must not be null"); + return this; + } + + /** + *

The unique identifier of a poll option to vote for. Only valid when the target message or post contains a poll.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pollOptionId(Nullable pollOptionId) { + if (pollOptionId.isNull()) { + this.pollOptionId = null; + } else if (pollOptionId.isEmpty()) { + this.pollOptionId = Optional.empty(); + } else { + this.pollOptionId = Optional.of(pollOptionId.get()); + } + return this; + } + + /** + *

The unique identifier of a poll option to vote for. Only valid when the target message or post contains a poll.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pollOptionId(String pollOptionId) { + this.pollOptionId = Optional.ofNullable(pollOptionId); + return this; + } + + /** + *

The unique identifier of a poll option to vote for. Only valid when the target message or post contains a poll.

+ */ + @java.lang.Override + @JsonSetter(value = "poll_option_id", nulls = Nulls.SKIP) + public _FinalStage pollOptionId(Optional pollOptionId) { + this.pollOptionId = pollOptionId; + return this; + } + + /** + *

The emoji to react with, in shortcode or unicode format. For example, ':heart:' or a unicode emoji. Ignored in forums where reactions are always likes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emoji(Nullable emoji) { + if (emoji.isNull()) { + this.emoji = null; + } else if (emoji.isEmpty()) { + this.emoji = Optional.empty(); + } else { + this.emoji = Optional.of(emoji.get()); + } + return this; + } + + /** + *

The emoji to react with, in shortcode or unicode format. For example, ':heart:' or a unicode emoji. Ignored in forums where reactions are always likes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emoji(String emoji) { + this.emoji = Optional.ofNullable(emoji); + return this; + } + + /** + *

The emoji to react with, in shortcode or unicode format. For example, ':heart:' or a unicode emoji. Ignored in forums where reactions are always likes.

+ */ + @java.lang.Override + @JsonSetter(value = "emoji", nulls = Nulls.SKIP) + public _FinalStage emoji(Optional emoji) { + this.emoji = emoji; + return this; + } + + @java.lang.Override + public CreateReactionsRequest build() { + return new CreateReactionsRequest(emoji, pollOptionId, resourceId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/requests/DeleteReactionsRequest.java b/src/main/java/com/whop/api/resources/reactions/requests/DeleteReactionsRequest.java new file mode 100644 index 00000000..42aad797 --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/requests/DeleteReactionsRequest.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteReactionsRequest.Builder.class) +public final class DeleteReactionsRequest { + private final Optional emoji; + + private final Map additionalProperties; + + private DeleteReactionsRequest(Optional emoji, Map additionalProperties) { + this.emoji = emoji; + this.additionalProperties = additionalProperties; + } + + /** + * @return The emoji to remove, in shortcode or unicode format. For example, ':heart:' or a unicode emoji. Required when the id refers to a message or post instead of a reaction. + */ + @JsonProperty("emoji") + public Optional getEmoji() { + return emoji; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteReactionsRequest && equalTo((DeleteReactionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteReactionsRequest other) { + return emoji.equals(other.emoji); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.emoji); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional emoji = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteReactionsRequest other) { + emoji(other.getEmoji()); + return this; + } + + /** + *

The emoji to remove, in shortcode or unicode format. For example, ':heart:' or a unicode emoji. Required when the id refers to a message or post instead of a reaction.

+ */ + @JsonSetter(value = "emoji", nulls = Nulls.SKIP) + public Builder emoji(Optional emoji) { + this.emoji = emoji; + return this; + } + + public Builder emoji(String emoji) { + this.emoji = Optional.ofNullable(emoji); + return this; + } + + public DeleteReactionsRequest build() { + return new DeleteReactionsRequest(emoji, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/requests/ListReactionsRequest.java b/src/main/java/com/whop/api/resources/reactions/requests/ListReactionsRequest.java new file mode 100644 index 00000000..cd75b5eb --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/requests/ListReactionsRequest.java @@ -0,0 +1,305 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListReactionsRequest.Builder.class) +public final class ListReactionsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String resourceId; + + private final Map additionalProperties; + + private ListReactionsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String resourceId, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.resourceId = resourceId; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the message or forum post to list reactions for. + */ + @JsonProperty("resource_id") + public String getResourceId() { + return resourceId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListReactionsRequest && equalTo((ListReactionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListReactionsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && resourceId.equals(other.resourceId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last, this.resourceId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ResourceIdStage builder() { + return new Builder(); + } + + public interface ResourceIdStage { + /** + *

The unique identifier of the message or forum post to list reactions for.

+ */ + _FinalStage resourceId(@NotNull String resourceId); + + Builder from(ListReactionsRequest other); + } + + public interface _FinalStage { + ListReactionsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ResourceIdStage, _FinalStage { + private String resourceId; + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListReactionsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + resourceId(other.getResourceId()); + return this; + } + + /** + *

The unique identifier of the message or forum post to list reactions for.

+ *

The unique identifier of the message or forum post to list reactions for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_id") + public _FinalStage resourceId(@NotNull String resourceId) { + this.resourceId = Objects.requireNonNull(resourceId, "resourceId must not be null"); + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListReactionsRequest build() { + return new ListReactionsRequest(after, before, first, last, resourceId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/requests/RetrieveReactionsRequest.java b/src/main/java/com/whop/api/resources/reactions/requests/RetrieveReactionsRequest.java new file mode 100644 index 00000000..4efd9de8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/requests/RetrieveReactionsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveReactionsRequest.Builder.class) +public final class RetrieveReactionsRequest { + private final Map additionalProperties; + + private RetrieveReactionsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveReactionsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveReactionsRequest other) { + return this; + } + + public RetrieveReactionsRequest build() { + return new RetrieveReactionsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/types/ListReactionsResponse.java b/src/main/java/com/whop/api/resources/reactions/types/ListReactionsResponse.java new file mode 100644 index 00000000..c9536c30 --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/types/ListReactionsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PageInfo; +import com.whop.api.types.ReactionListItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListReactionsResponse.Builder.class) +public final class ListReactionsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListReactionsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListReactionsResponse && equalTo((ListReactionsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListReactionsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListReactionsResponse other); + } + + public interface _FinalStage { + ListReactionsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(ReactionListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListReactionsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(ReactionListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListReactionsResponse build() { + return new ListReactionsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayload.java b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayload.java new file mode 100644 index 00000000..941bb239 --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayload.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostChatReactionCreatedPayload.Builder.class) +public final class PostChatReactionCreatedPayload { + private final Optional accountId; + + private final PostChatReactionCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostChatReactionCreatedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostChatReactionCreatedPayloadType type; + + private final Map additionalProperties; + + private PostChatReactionCreatedPayload( + Optional accountId, + PostChatReactionCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostChatReactionCreatedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostChatReactionCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostChatReactionCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PostChatReactionCreatedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostChatReactionCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostChatReactionCreatedPayload && equalTo((PostChatReactionCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostChatReactionCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostChatReactionCreatedPayloadApiVersion apiVersion); + + Builder from(PostChatReactionCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PostChatReactionCreatedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostChatReactionCreatedPayloadType type); + } + + public interface _FinalStage { + PostChatReactionCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostChatReactionCreatedPayloadApiVersion apiVersion; + + private PostChatReactionCreatedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostChatReactionCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostChatReactionCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostChatReactionCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostChatReactionCreatedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostChatReactionCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostChatReactionCreatedPayload build() { + return new PostChatReactionCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadApiVersion.java new file mode 100644 index 00000000..2fb63514 --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostChatReactionCreatedPayloadApiVersion { + public static final PostChatReactionCreatedPayloadApiVersion V1 = + new PostChatReactionCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostChatReactionCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostChatReactionCreatedPayloadApiVersion + && this.string.equals(((PostChatReactionCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostChatReactionCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostChatReactionCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadData.java b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadData.java new file mode 100644 index 00000000..12faf675 --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadData.java @@ -0,0 +1,221 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Message; +import com.whop.api.types.Reaction; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostChatReactionCreatedPayloadData.Builder.class) +public final class PostChatReactionCreatedPayloadData { + private final PostChatReactionCreatedPayloadDataAudience audience; + + private final PostChatReactionCreatedPayloadDataChannel channel; + + private final Message message; + + private final Reaction reaction; + + private final String reason; + + private final Map additionalProperties; + + private PostChatReactionCreatedPayloadData( + PostChatReactionCreatedPayloadDataAudience audience, + PostChatReactionCreatedPayloadDataChannel channel, + Message message, + Reaction reaction, + String reason, + Map additionalProperties) { + this.audience = audience; + this.channel = channel; + this.message = message; + this.reaction = reaction; + this.reason = reason; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("audience") + public PostChatReactionCreatedPayloadDataAudience getAudience() { + return audience; + } + + @JsonProperty("channel") + public PostChatReactionCreatedPayloadDataChannel getChannel() { + return channel; + } + + @JsonProperty("message") + public Message getMessage() { + return message; + } + + @JsonProperty("reaction") + public Reaction getReaction() { + return reaction; + } + + @JsonProperty("reason") + public String getReason() { + return reason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostChatReactionCreatedPayloadData + && equalTo((PostChatReactionCreatedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostChatReactionCreatedPayloadData other) { + return audience.equals(other.audience) + && channel.equals(other.channel) + && message.equals(other.message) + && reaction.equals(other.reaction) + && reason.equals(other.reason); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.audience, this.channel, this.message, this.reaction, this.reason); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AudienceStage builder() { + return new Builder(); + } + + public interface AudienceStage { + ChannelStage audience(@NotNull PostChatReactionCreatedPayloadDataAudience audience); + + Builder from(PostChatReactionCreatedPayloadData other); + } + + public interface ChannelStage { + MessageStage channel(@NotNull PostChatReactionCreatedPayloadDataChannel channel); + } + + public interface MessageStage { + ReactionStage message(@NotNull Message message); + } + + public interface ReactionStage { + ReasonStage reaction(@NotNull Reaction reaction); + } + + public interface ReasonStage { + _FinalStage reason(@NotNull String reason); + } + + public interface _FinalStage { + PostChatReactionCreatedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AudienceStage, ChannelStage, MessageStage, ReactionStage, ReasonStage, _FinalStage { + private PostChatReactionCreatedPayloadDataAudience audience; + + private PostChatReactionCreatedPayloadDataChannel channel; + + private Message message; + + private Reaction reaction; + + private String reason; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostChatReactionCreatedPayloadData other) { + audience(other.getAudience()); + channel(other.getChannel()); + message(other.getMessage()); + reaction(other.getReaction()); + reason(other.getReason()); + return this; + } + + @java.lang.Override + @JsonSetter("audience") + public ChannelStage audience(@NotNull PostChatReactionCreatedPayloadDataAudience audience) { + this.audience = Objects.requireNonNull(audience, "audience must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("channel") + public MessageStage channel(@NotNull PostChatReactionCreatedPayloadDataChannel channel) { + this.channel = Objects.requireNonNull(channel, "channel must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("message") + public ReactionStage message(@NotNull Message message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("reaction") + public ReasonStage reaction(@NotNull Reaction reaction) { + this.reaction = Objects.requireNonNull(reaction, "reaction must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("reason") + public _FinalStage reason(@NotNull String reason) { + this.reason = Objects.requireNonNull(reason, "reason must not be null"); + return this; + } + + @java.lang.Override + public PostChatReactionCreatedPayloadData build() { + return new PostChatReactionCreatedPayloadData( + audience, channel, message, reaction, reason, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadDataAudience.java b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadDataAudience.java new file mode 100644 index 00000000..3bf72734 --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadDataAudience.java @@ -0,0 +1,179 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostChatReactionCreatedPayloadDataAudience.Builder.class) +public final class PostChatReactionCreatedPayloadDataAudience { + private final PostChatReactionCreatedPayloadDataAudienceType type; + + private final Optional> userIds; + + private final Map additionalProperties; + + private PostChatReactionCreatedPayloadDataAudience( + PostChatReactionCreatedPayloadDataAudienceType type, + Optional> userIds, + Map additionalProperties) { + this.type = type; + this.userIds = userIds; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public PostChatReactionCreatedPayloadDataAudienceType getType() { + return type; + } + + @JsonIgnore + public Optional> getUserIds() { + if (userIds == null) { + return Optional.empty(); + } + return userIds; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_ids") + private Optional> _getUserIds() { + return userIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostChatReactionCreatedPayloadDataAudience + && equalTo((PostChatReactionCreatedPayloadDataAudience) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostChatReactionCreatedPayloadDataAudience other) { + return type.equals(other.type) && userIds.equals(other.userIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.userIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + _FinalStage type(@NotNull PostChatReactionCreatedPayloadDataAudienceType type); + + Builder from(PostChatReactionCreatedPayloadDataAudience other); + } + + public interface _FinalStage { + PostChatReactionCreatedPayloadDataAudience build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage userIds(Optional> userIds); + + _FinalStage userIds(List userIds); + + _FinalStage userIds(Nullable> userIds); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private PostChatReactionCreatedPayloadDataAudienceType type; + + private Optional> userIds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostChatReactionCreatedPayloadDataAudience other) { + type(other.getType()); + userIds(other.getUserIds()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostChatReactionCreatedPayloadDataAudienceType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage userIds(Nullable> userIds) { + if (userIds.isNull()) { + this.userIds = null; + } else if (userIds.isEmpty()) { + this.userIds = Optional.empty(); + } else { + this.userIds = Optional.of(userIds.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage userIds(List userIds) { + this.userIds = Optional.ofNullable(userIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "user_ids", nulls = Nulls.SKIP) + public _FinalStage userIds(Optional> userIds) { + this.userIds = userIds; + return this; + } + + @java.lang.Override + public PostChatReactionCreatedPayloadDataAudience build() { + return new PostChatReactionCreatedPayloadDataAudience(type, userIds, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadDataAudienceType.java b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadDataAudienceType.java new file mode 100644 index 00000000..a26a3e13 --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadDataAudienceType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostChatReactionCreatedPayloadDataAudienceType { + public static final PostChatReactionCreatedPayloadDataAudienceType CHANNEL = + new PostChatReactionCreatedPayloadDataAudienceType(Value.CHANNEL, "channel"); + + public static final PostChatReactionCreatedPayloadDataAudienceType USERS = + new PostChatReactionCreatedPayloadDataAudienceType(Value.USERS, "users"); + + private final Value value; + + private final String string; + + PostChatReactionCreatedPayloadDataAudienceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostChatReactionCreatedPayloadDataAudienceType + && this.string.equals(((PostChatReactionCreatedPayloadDataAudienceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CHANNEL: + return visitor.visitChannel(); + case USERS: + return visitor.visitUsers(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostChatReactionCreatedPayloadDataAudienceType valueOf(String value) { + switch (value) { + case "channel": + return CHANNEL; + case "users": + return USERS; + default: + return new PostChatReactionCreatedPayloadDataAudienceType(Value.UNKNOWN, value); + } + } + + public enum Value { + CHANNEL, + + USERS, + + UNKNOWN + } + + public interface Visitor { + T visitChannel(); + + T visitUsers(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadDataChannel.java b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadDataChannel.java new file mode 100644 index 00000000..90ec1f9c --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadDataChannel.java @@ -0,0 +1,201 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostChatReactionCreatedPayloadDataChannel.Builder.class) +public final class PostChatReactionCreatedPayloadDataChannel { + private final Optional experienceId; + + private final String id; + + private final PostChatReactionCreatedPayloadDataChannelType type; + + private final Map additionalProperties; + + private PostChatReactionCreatedPayloadDataChannel( + Optional experienceId, + String id, + PostChatReactionCreatedPayloadDataChannelType type, + Map additionalProperties) { + this.experienceId = experienceId; + this.id = id; + this.type = type; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getExperienceId() { + if (experienceId == null) { + return Optional.empty(); + } + return experienceId; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("type") + public PostChatReactionCreatedPayloadDataChannelType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("experience_id") + private Optional _getExperienceId() { + return experienceId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostChatReactionCreatedPayloadDataChannel + && equalTo((PostChatReactionCreatedPayloadDataChannel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostChatReactionCreatedPayloadDataChannel other) { + return experienceId.equals(other.experienceId) && id.equals(other.id) && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.experienceId, this.id, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + TypeStage id(@NotNull String id); + + Builder from(PostChatReactionCreatedPayloadDataChannel other); + } + + public interface TypeStage { + _FinalStage type(@NotNull PostChatReactionCreatedPayloadDataChannelType type); + } + + public interface _FinalStage { + PostChatReactionCreatedPayloadDataChannel build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage experienceId(Optional experienceId); + + _FinalStage experienceId(String experienceId); + + _FinalStage experienceId(Nullable experienceId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TypeStage, _FinalStage { + private String id; + + private PostChatReactionCreatedPayloadDataChannelType type; + + private Optional experienceId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostChatReactionCreatedPayloadDataChannel other) { + experienceId(other.getExperienceId()); + id(other.getId()); + type(other.getType()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public TypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostChatReactionCreatedPayloadDataChannelType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage experienceId(Nullable experienceId) { + if (experienceId.isNull()) { + this.experienceId = null; + } else if (experienceId.isEmpty()) { + this.experienceId = Optional.empty(); + } else { + this.experienceId = Optional.of(experienceId.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage experienceId(String experienceId) { + this.experienceId = Optional.ofNullable(experienceId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "experience_id", nulls = Nulls.SKIP) + public _FinalStage experienceId(Optional experienceId) { + this.experienceId = experienceId; + return this; + } + + @java.lang.Override + public PostChatReactionCreatedPayloadDataChannel build() { + return new PostChatReactionCreatedPayloadDataChannel(experienceId, id, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadDataChannelType.java b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadDataChannelType.java new file mode 100644 index 00000000..00c7bf6c --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadDataChannelType.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostChatReactionCreatedPayloadDataChannelType { + public static final PostChatReactionCreatedPayloadDataChannelType SUPPORT = + new PostChatReactionCreatedPayloadDataChannelType(Value.SUPPORT, "support"); + + public static final PostChatReactionCreatedPayloadDataChannelType CHAT = + new PostChatReactionCreatedPayloadDataChannelType(Value.CHAT, "chat"); + + public static final PostChatReactionCreatedPayloadDataChannelType DIRECT_MESSAGE = + new PostChatReactionCreatedPayloadDataChannelType(Value.DIRECT_MESSAGE, "direct_message"); + + private final Value value; + + private final String string; + + PostChatReactionCreatedPayloadDataChannelType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostChatReactionCreatedPayloadDataChannelType + && this.string.equals(((PostChatReactionCreatedPayloadDataChannelType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SUPPORT: + return visitor.visitSupport(); + case CHAT: + return visitor.visitChat(); + case DIRECT_MESSAGE: + return visitor.visitDirectMessage(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostChatReactionCreatedPayloadDataChannelType valueOf(String value) { + switch (value) { + case "support": + return SUPPORT; + case "chat": + return CHAT; + case "direct_message": + return DIRECT_MESSAGE; + default: + return new PostChatReactionCreatedPayloadDataChannelType(Value.UNKNOWN, value); + } + } + + public enum Value { + CHAT, + + DIRECT_MESSAGE, + + SUPPORT, + + UNKNOWN + } + + public interface Visitor { + T visitChat(); + + T visitDirectMessage(); + + T visitSupport(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadType.java b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadType.java new file mode 100644 index 00000000..3281be9b --- /dev/null +++ b/src/main/java/com/whop/api/resources/reactions/types/PostChatReactionCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reactions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostChatReactionCreatedPayloadType { + public static final PostChatReactionCreatedPayloadType CHAT_REACTION_CREATED = + new PostChatReactionCreatedPayloadType(Value.CHAT_REACTION_CREATED, "chat.reaction.created"); + + private final Value value; + + private final String string; + + PostChatReactionCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostChatReactionCreatedPayloadType + && this.string.equals(((PostChatReactionCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CHAT_REACTION_CREATED: + return visitor.visitChatReactionCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostChatReactionCreatedPayloadType valueOf(String value) { + switch (value) { + case "chat.reaction.created": + return CHAT_REACTION_CREATED; + default: + return new PostChatReactionCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + CHAT_REACTION_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitChatReactionCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/recommendedactions/AsyncRawRecommendedActionsClient.java b/src/main/java/com/whop/api/resources/recommendedactions/AsyncRawRecommendedActionsClient.java new file mode 100644 index 00000000..be66d6f3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/recommendedactions/AsyncRawRecommendedActionsClient.java @@ -0,0 +1,440 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.recommendedactions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.recommendedactions.requests.ListExecutionsRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.requests.ListRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.requests.RetrieveRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.requests.RunRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.types.ListExecutionsRecommendedActionsResponse; +import com.whop.api.resources.recommendedactions.types.ListRecommendedActionsResponse; +import com.whop.api.resources.recommendedactions.types.RunRecommendedActionsResponse; +import com.whop.api.types.AccountRecommendedActionChain; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawRecommendedActionsClient { + protected final ClientOptions clientOptions; + + public AsyncRawRecommendedActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public CompletableFuture> list() { + return list(ListRecommendedActionsRequest.builder().build()); + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return list(ListRecommendedActionsRequest.builder().build(), requestOptions); + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public CompletableFuture> list( + ListRecommendedActionsRequest request) { + return list(request, null); + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public CompletableFuture> list( + ListRecommendedActionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("recommended_actions"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListRecommendedActionsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveRecommendedActionsRequest.builder().build()); + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveRecommendedActionsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public CompletableFuture> retrieve( + String id, RetrieveRecommendedActionsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public CompletableFuture> retrieve( + String id, RetrieveRecommendedActionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("recommended_actions") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, AccountRecommendedActionChain.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public CompletableFuture> run(String id) { + return run(id, RunRecommendedActionsRequest.builder().build()); + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public CompletableFuture> run( + String id, RequestOptions requestOptions) { + return run(id, RunRecommendedActionsRequest.builder().build(), requestOptions); + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public CompletableFuture> run( + String id, RunRecommendedActionsRequest request) { + return run(id, request, null); + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public CompletableFuture> run( + String id, RunRecommendedActionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("recommended_actions") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, RunRecommendedActionsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public CompletableFuture> listExecutions(String id) { + return listExecutions( + id, ListExecutionsRecommendedActionsRequest.builder().build()); + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public CompletableFuture> listExecutions( + String id, RequestOptions requestOptions) { + return listExecutions( + id, ListExecutionsRecommendedActionsRequest.builder().build(), requestOptions); + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public CompletableFuture> listExecutions( + String id, ListExecutionsRecommendedActionsRequest request) { + return listExecutions(id, request, null); + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public CompletableFuture> listExecutions( + String id, ListExecutionsRecommendedActionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("recommended_actions") + .addPathSegment(id) + .addPathSegments("executions"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListExecutionsRecommendedActionsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/recommendedactions/AsyncRecommendedActionsClient.java b/src/main/java/com/whop/api/resources/recommendedactions/AsyncRecommendedActionsClient.java new file mode 100644 index 00000000..aff0fe4a --- /dev/null +++ b/src/main/java/com/whop/api/resources/recommendedactions/AsyncRecommendedActionsClient.java @@ -0,0 +1,153 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.recommendedactions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.recommendedactions.requests.ListExecutionsRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.requests.ListRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.requests.RetrieveRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.requests.RunRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.types.ListExecutionsRecommendedActionsResponse; +import com.whop.api.resources.recommendedactions.types.ListRecommendedActionsResponse; +import com.whop.api.resources.recommendedactions.types.RunRecommendedActionsResponse; +import com.whop.api.types.AccountRecommendedActionChain; +import java.util.concurrent.CompletableFuture; + +public class AsyncRecommendedActionsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawRecommendedActionsClient rawClient; + + public AsyncRecommendedActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawRecommendedActionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawRecommendedActionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public CompletableFuture list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public CompletableFuture list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public CompletableFuture list(ListRecommendedActionsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public CompletableFuture list( + ListRecommendedActionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public CompletableFuture retrieve( + String id, RetrieveRecommendedActionsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public CompletableFuture retrieve( + String id, RetrieveRecommendedActionsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public CompletableFuture run(String id) { + return this.rawClient.run(id).thenApply(response -> response.body()); + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public CompletableFuture run(String id, RequestOptions requestOptions) { + return this.rawClient.run(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public CompletableFuture run(String id, RunRecommendedActionsRequest request) { + return this.rawClient.run(id, request).thenApply(response -> response.body()); + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public CompletableFuture run( + String id, RunRecommendedActionsRequest request, RequestOptions requestOptions) { + return this.rawClient.run(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public CompletableFuture listExecutions(String id) { + return this.rawClient.listExecutions(id).thenApply(response -> response.body()); + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public CompletableFuture listExecutions( + String id, RequestOptions requestOptions) { + return this.rawClient.listExecutions(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public CompletableFuture listExecutions( + String id, ListExecutionsRecommendedActionsRequest request) { + return this.rawClient.listExecutions(id, request).thenApply(response -> response.body()); + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public CompletableFuture listExecutions( + String id, ListExecutionsRecommendedActionsRequest request, RequestOptions requestOptions) { + return this.rawClient.listExecutions(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/recommendedactions/RawRecommendedActionsClient.java b/src/main/java/com/whop/api/resources/recommendedactions/RawRecommendedActionsClient.java new file mode 100644 index 00000000..e9133c61 --- /dev/null +++ b/src/main/java/com/whop/api/resources/recommendedactions/RawRecommendedActionsClient.java @@ -0,0 +1,359 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.recommendedactions; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.recommendedactions.requests.ListExecutionsRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.requests.ListRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.requests.RetrieveRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.requests.RunRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.types.ListExecutionsRecommendedActionsResponse; +import com.whop.api.resources.recommendedactions.types.ListRecommendedActionsResponse; +import com.whop.api.resources.recommendedactions.types.RunRecommendedActionsResponse; +import com.whop.api.types.AccountRecommendedActionChain; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawRecommendedActionsClient { + protected final ClientOptions clientOptions; + + public RawRecommendedActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public WhopApiHttpResponse list() { + return list(ListRecommendedActionsRequest.builder().build()); + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public WhopApiHttpResponse list(RequestOptions requestOptions) { + return list(ListRecommendedActionsRequest.builder().build(), requestOptions); + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public WhopApiHttpResponse list(ListRecommendedActionsRequest request) { + return list(request, null); + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public WhopApiHttpResponse list( + ListRecommendedActionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("recommended_actions"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListRecommendedActionsResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveRecommendedActionsRequest.builder().build()); + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveRecommendedActionsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveRecommendedActionsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveRecommendedActionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("recommended_actions") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AccountRecommendedActionChain.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public WhopApiHttpResponse run(String id) { + return run(id, RunRecommendedActionsRequest.builder().build()); + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public WhopApiHttpResponse run(String id, RequestOptions requestOptions) { + return run(id, RunRecommendedActionsRequest.builder().build(), requestOptions); + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public WhopApiHttpResponse run(String id, RunRecommendedActionsRequest request) { + return run(id, request, null); + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public WhopApiHttpResponse run( + String id, RunRecommendedActionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("recommended_actions") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RunRecommendedActionsResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public WhopApiHttpResponse listExecutions(String id) { + return listExecutions( + id, ListExecutionsRecommendedActionsRequest.builder().build()); + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public WhopApiHttpResponse listExecutions( + String id, RequestOptions requestOptions) { + return listExecutions( + id, ListExecutionsRecommendedActionsRequest.builder().build(), requestOptions); + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public WhopApiHttpResponse listExecutions( + String id, ListExecutionsRecommendedActionsRequest request) { + return listExecutions(id, request, null); + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public WhopApiHttpResponse listExecutions( + String id, ListExecutionsRecommendedActionsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("recommended_actions") + .addPathSegment(id) + .addPathSegments("executions"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListExecutionsRecommendedActionsResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/recommendedactions/RecommendedActionsClient.java b/src/main/java/com/whop/api/resources/recommendedactions/RecommendedActionsClient.java new file mode 100644 index 00000000..129767a8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/recommendedactions/RecommendedActionsClient.java @@ -0,0 +1,149 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.recommendedactions; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.recommendedactions.requests.ListExecutionsRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.requests.ListRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.requests.RetrieveRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.requests.RunRecommendedActionsRequest; +import com.whop.api.resources.recommendedactions.types.ListExecutionsRecommendedActionsResponse; +import com.whop.api.resources.recommendedactions.types.ListRecommendedActionsResponse; +import com.whop.api.resources.recommendedactions.types.RunRecommendedActionsResponse; +import com.whop.api.types.AccountRecommendedActionChain; + +public class RecommendedActionsClient { + protected final ClientOptions clientOptions; + + private final RawRecommendedActionsClient rawClient; + + public RecommendedActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawRecommendedActionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawRecommendedActionsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public ListRecommendedActionsResponse list() { + return this.rawClient.list().body(); + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public ListRecommendedActionsResponse list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public ListRecommendedActionsResponse list(ListRecommendedActionsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the recommended action chains for an account — short sequences of actions (create a product, price it, publish it) the account should run next, gated on what it already has. + */ + public ListRecommendedActionsResponse list(ListRecommendedActionsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public AccountRecommendedActionChain retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public AccountRecommendedActionChain retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public AccountRecommendedActionChain retrieve(String id, RetrieveRecommendedActionsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a recommended action chain by id, including chains that have already been run. Seeded chains are reconstructed from their hard-coded chain; generated chains are read from the account's stored chain, with each step's filled-in input. + */ + public AccountRecommendedActionChain retrieve( + String id, RetrieveRecommendedActionsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public RunRecommendedActionsResponse run(String id) { + return this.rawClient.run(id).body(); + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public RunRecommendedActionsResponse run(String id, RequestOptions requestOptions) { + return this.rawClient.run(id, requestOptions).body(); + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public RunRecommendedActionsResponse run(String id, RunRecommendedActionsRequest request) { + return this.rawClient.run(id, request).body(); + } + + /** + * Records that the caller ran a recommended action chain. Nothing is executed server-side yet — the client follows the chain's step CTAs itself; this writes the recommended_action_chain.executed analytics event. + */ + public RunRecommendedActionsResponse run( + String id, RunRecommendedActionsRequest request, RequestOptions requestOptions) { + return this.rawClient.run(id, request, requestOptions).body(); + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public ListExecutionsRecommendedActionsResponse listExecutions(String id) { + return this.rawClient.listExecutions(id).body(); + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public ListExecutionsRecommendedActionsResponse listExecutions(String id, RequestOptions requestOptions) { + return this.rawClient.listExecutions(id, requestOptions).body(); + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public ListExecutionsRecommendedActionsResponse listExecutions( + String id, ListExecutionsRecommendedActionsRequest request) { + return this.rawClient.listExecutions(id, request).body(); + } + + /** + * Lists the per-step record of a recommended action chain the server ran — one entry per step in position order, each carrying its current status and, once the step completed, the API response it produced. A chain that was never run server-side returns an empty list. + */ + public ListExecutionsRecommendedActionsResponse listExecutions( + String id, ListExecutionsRecommendedActionsRequest request, RequestOptions requestOptions) { + return this.rawClient.listExecutions(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/recommendedactions/requests/ListExecutionsRecommendedActionsRequest.java b/src/main/java/com/whop/api/resources/recommendedactions/requests/ListExecutionsRecommendedActionsRequest.java new file mode 100644 index 00000000..f3ed9a10 --- /dev/null +++ b/src/main/java/com/whop/api/resources/recommendedactions/requests/ListExecutionsRecommendedActionsRequest.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.recommendedactions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListExecutionsRecommendedActionsRequest.Builder.class) +public final class ListExecutionsRecommendedActionsRequest { + private final Optional accountId; + + private final Map additionalProperties; + + private ListExecutionsRecommendedActionsRequest( + Optional accountId, Map additionalProperties) { + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. Defaults to the API key's own account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListExecutionsRecommendedActionsRequest + && equalTo((ListExecutionsRecommendedActionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListExecutionsRecommendedActionsRequest other) { + return accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListExecutionsRecommendedActionsRequest other) { + accountId(other.getAccountId()); + return this; + } + + /** + *

Account ID, prefixed biz_. Defaults to the API key's own account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + public ListExecutionsRecommendedActionsRequest build() { + return new ListExecutionsRecommendedActionsRequest(accountId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/recommendedactions/requests/ListRecommendedActionsRequest.java b/src/main/java/com/whop/api/resources/recommendedactions/requests/ListRecommendedActionsRequest.java new file mode 100644 index 00000000..65e3f591 --- /dev/null +++ b/src/main/java/com/whop/api/resources/recommendedactions/requests/ListRecommendedActionsRequest.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.recommendedactions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListRecommendedActionsRequest.Builder.class) +public final class ListRecommendedActionsRequest { + private final Optional accountId; + + private final Map additionalProperties; + + private ListRecommendedActionsRequest(Optional accountId, Map additionalProperties) { + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. Defaults to the API key's own account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListRecommendedActionsRequest && equalTo((ListRecommendedActionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListRecommendedActionsRequest other) { + return accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListRecommendedActionsRequest other) { + accountId(other.getAccountId()); + return this; + } + + /** + *

Account ID, prefixed biz_. Defaults to the API key's own account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + public ListRecommendedActionsRequest build() { + return new ListRecommendedActionsRequest(accountId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/recommendedactions/requests/RetrieveRecommendedActionsRequest.java b/src/main/java/com/whop/api/resources/recommendedactions/requests/RetrieveRecommendedActionsRequest.java new file mode 100644 index 00000000..c1d5284d --- /dev/null +++ b/src/main/java/com/whop/api/resources/recommendedactions/requests/RetrieveRecommendedActionsRequest.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.recommendedactions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveRecommendedActionsRequest.Builder.class) +public final class RetrieveRecommendedActionsRequest { + private final Optional accountId; + + private final Map additionalProperties; + + private RetrieveRecommendedActionsRequest(Optional accountId, Map additionalProperties) { + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. Defaults to the API key's own account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveRecommendedActionsRequest && equalTo((RetrieveRecommendedActionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveRecommendedActionsRequest other) { + return accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveRecommendedActionsRequest other) { + accountId(other.getAccountId()); + return this; + } + + /** + *

Account ID, prefixed biz_. Defaults to the API key's own account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + public RetrieveRecommendedActionsRequest build() { + return new RetrieveRecommendedActionsRequest(accountId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/recommendedactions/requests/RunRecommendedActionsRequest.java b/src/main/java/com/whop/api/resources/recommendedactions/requests/RunRecommendedActionsRequest.java new file mode 100644 index 00000000..5b0d7c94 --- /dev/null +++ b/src/main/java/com/whop/api/resources/recommendedactions/requests/RunRecommendedActionsRequest.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.recommendedactions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RunRecommendedActionsRequest.Builder.class) +public final class RunRecommendedActionsRequest { + private final Optional accountId; + + private final Map additionalProperties; + + private RunRecommendedActionsRequest(Optional accountId, Map additionalProperties) { + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. Defaults to the API key's own account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RunRecommendedActionsRequest && equalTo((RunRecommendedActionsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RunRecommendedActionsRequest other) { + return accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RunRecommendedActionsRequest other) { + accountId(other.getAccountId()); + return this; + } + + /** + *

Account ID, prefixed biz_. Defaults to the API key's own account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + public RunRecommendedActionsRequest build() { + return new RunRecommendedActionsRequest(accountId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/recommendedactions/types/ListExecutionsRecommendedActionsResponse.java b/src/main/java/com/whop/api/resources/recommendedactions/types/ListExecutionsRecommendedActionsResponse.java new file mode 100644 index 00000000..bc1f17c7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/recommendedactions/types/ListExecutionsRecommendedActionsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.recommendedactions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.RecommendedActionExecution; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListExecutionsRecommendedActionsResponse.Builder.class) +public final class ListExecutionsRecommendedActionsResponse { + private final String chainId; + + private final List executions; + + private final Map additionalProperties; + + private ListExecutionsRecommendedActionsResponse( + String chainId, List executions, Map additionalProperties) { + this.chainId = chainId; + this.executions = executions; + this.additionalProperties = additionalProperties; + } + + /** + * @return The chain these executions belong to. + */ + @JsonProperty("chain_id") + public String getChainId() { + return chainId; + } + + /** + * @return One entry per run step, in position order. + */ + @JsonProperty("executions") + public List getExecutions() { + return executions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListExecutionsRecommendedActionsResponse + && equalTo((ListExecutionsRecommendedActionsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListExecutionsRecommendedActionsResponse other) { + return chainId.equals(other.chainId) && executions.equals(other.executions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.chainId, this.executions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChainIdStage builder() { + return new Builder(); + } + + public interface ChainIdStage { + /** + *

The chain these executions belong to.

+ */ + _FinalStage chainId(@NotNull String chainId); + + Builder from(ListExecutionsRecommendedActionsResponse other); + } + + public interface _FinalStage { + ListExecutionsRecommendedActionsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

One entry per run step, in position order.

+ */ + _FinalStage executions(List executions); + + _FinalStage addExecutions(RecommendedActionExecution executions); + + _FinalStage addAllExecutions(List executions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ChainIdStage, _FinalStage { + private String chainId; + + private List executions = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListExecutionsRecommendedActionsResponse other) { + chainId(other.getChainId()); + executions(other.getExecutions()); + return this; + } + + /** + *

The chain these executions belong to.

+ *

The chain these executions belong to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("chain_id") + public _FinalStage chainId(@NotNull String chainId) { + this.chainId = Objects.requireNonNull(chainId, "chainId must not be null"); + return this; + } + + /** + *

One entry per run step, in position order.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllExecutions(List executions) { + if (executions != null) { + this.executions.addAll(executions); + } + return this; + } + + /** + *

One entry per run step, in position order.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addExecutions(RecommendedActionExecution executions) { + this.executions.add(executions); + return this; + } + + /** + *

One entry per run step, in position order.

+ */ + @java.lang.Override + @JsonSetter(value = "executions", nulls = Nulls.SKIP) + public _FinalStage executions(List executions) { + this.executions.clear(); + if (executions != null) { + this.executions.addAll(executions); + } + return this; + } + + @java.lang.Override + public ListExecutionsRecommendedActionsResponse build() { + return new ListExecutionsRecommendedActionsResponse(chainId, executions, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/recommendedactions/types/ListRecommendedActionsResponse.java b/src/main/java/com/whop/api/resources/recommendedactions/types/ListRecommendedActionsResponse.java new file mode 100644 index 00000000..6a97467b --- /dev/null +++ b/src/main/java/com/whop/api/resources/recommendedactions/types/ListRecommendedActionsResponse.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.recommendedactions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.AccountRecommendedActionChain; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListRecommendedActionsResponse.Builder.class) +public final class ListRecommendedActionsResponse { + private final List data; + + private final Map additionalProperties; + + private ListRecommendedActionsResponse( + List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListRecommendedActionsResponse && equalTo((ListRecommendedActionsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListRecommendedActionsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListRecommendedActionsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(AccountRecommendedActionChain data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public ListRecommendedActionsResponse build() { + return new ListRecommendedActionsResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/recommendedactions/types/RunRecommendedActionsResponse.java b/src/main/java/com/whop/api/resources/recommendedactions/types/RunRecommendedActionsResponse.java new file mode 100644 index 00000000..36c4d5d7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/recommendedactions/types/RunRecommendedActionsResponse.java @@ -0,0 +1,143 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.recommendedactions.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RunRecommendedActionsResponse.Builder.class) +public final class RunRecommendedActionsResponse { + private final String chainId; + + private final RunRecommendedActionsResponseExecution execution; + + private final Map additionalProperties; + + private RunRecommendedActionsResponse( + String chainId, + RunRecommendedActionsResponseExecution execution, + Map additionalProperties) { + this.chainId = chainId; + this.execution = execution; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("chain_id") + public String getChainId() { + return chainId; + } + + @JsonProperty("execution") + public RunRecommendedActionsResponseExecution getExecution() { + return execution; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RunRecommendedActionsResponse && equalTo((RunRecommendedActionsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RunRecommendedActionsResponse other) { + return chainId.equals(other.chainId) && execution.equals(other.execution); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.chainId, this.execution); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChainIdStage builder() { + return new Builder(); + } + + public interface ChainIdStage { + ExecutionStage chainId(@NotNull String chainId); + + Builder from(RunRecommendedActionsResponse other); + } + + public interface ExecutionStage { + _FinalStage execution(@NotNull RunRecommendedActionsResponseExecution execution); + } + + public interface _FinalStage { + RunRecommendedActionsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ChainIdStage, ExecutionStage, _FinalStage { + private String chainId; + + private RunRecommendedActionsResponseExecution execution; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RunRecommendedActionsResponse other) { + chainId(other.getChainId()); + execution(other.getExecution()); + return this; + } + + @java.lang.Override + @JsonSetter("chain_id") + public ExecutionStage chainId(@NotNull String chainId) { + this.chainId = Objects.requireNonNull(chainId, "chainId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("execution") + public _FinalStage execution(@NotNull RunRecommendedActionsResponseExecution execution) { + this.execution = Objects.requireNonNull(execution, "execution must not be null"); + return this; + } + + @java.lang.Override + public RunRecommendedActionsResponse build() { + return new RunRecommendedActionsResponse(chainId, execution, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/recommendedactions/types/RunRecommendedActionsResponseExecution.java b/src/main/java/com/whop/api/resources/recommendedactions/types/RunRecommendedActionsResponseExecution.java new file mode 100644 index 00000000..839152d2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/recommendedactions/types/RunRecommendedActionsResponseExecution.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.recommendedactions.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RunRecommendedActionsResponseExecution { + public static final RunRecommendedActionsResponseExecution REDIRECT = + new RunRecommendedActionsResponseExecution(Value.REDIRECT, "redirect"); + + public static final RunRecommendedActionsResponseExecution EXECUTED = + new RunRecommendedActionsResponseExecution(Value.EXECUTED, "executed"); + + private final Value value; + + private final String string; + + RunRecommendedActionsResponseExecution(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RunRecommendedActionsResponseExecution + && this.string.equals(((RunRecommendedActionsResponseExecution) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REDIRECT: + return visitor.visitRedirect(); + case EXECUTED: + return visitor.visitExecuted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RunRecommendedActionsResponseExecution valueOf(String value) { + switch (value) { + case "redirect": + return REDIRECT; + case "executed": + return EXECUTED; + default: + return new RunRecommendedActionsResponseExecution(Value.UNKNOWN, value); + } + } + + public enum Value { + REDIRECT, + + EXECUTED, + + UNKNOWN + } + + public interface Visitor { + T visitRedirect(); + + T visitExecuted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/refunds/AsyncRawRefundsClient.java b/src/main/java/com/whop/api/resources/refunds/AsyncRawRefundsClient.java new file mode 100644 index 00000000..e0992ca7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/refunds/AsyncRawRefundsClient.java @@ -0,0 +1,387 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.refunds; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.refunds.requests.ListRefundsRequest; +import com.whop.api.resources.refunds.requests.RetrieveRefundsRequest; +import com.whop.api.resources.refunds.types.ListRefundsResponse; +import com.whop.api.types.Refund; +import com.whop.api.types.RefundListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawRefundsClient { + protected final ClientOptions clientOptions; + + public AsyncRawRefundsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture>> list() { + return list(ListRefundsRequest.builder().build()); + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListRefundsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture>> list(ListRefundsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture>> list( + ListRefundsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("refunds"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getPaymentId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "payment_id", request.getPaymentId().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListRefundsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListRefundsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListRefundsRequest nextRequest = ListRefundsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveRefundsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveRefundsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RetrieveRefundsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveRefundsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("refunds") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Refund.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/refunds/AsyncRefundsClient.java b/src/main/java/com/whop/api/resources/refunds/AsyncRefundsClient.java new file mode 100644 index 00000000..2c7fbbed --- /dev/null +++ b/src/main/java/com/whop/api/resources/refunds/AsyncRefundsClient.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.refunds; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.refunds.requests.ListRefundsRequest; +import com.whop.api.resources.refunds.requests.RetrieveRefundsRequest; +import com.whop.api.types.Refund; +import com.whop.api.types.RefundListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncRefundsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawRefundsClient rawClient; + + public AsyncRefundsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawRefundsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawRefundsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> list(ListRefundsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public CompletableFuture> list( + ListRefundsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveRefundsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveRefundsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/refunds/RawRefundsClient.java b/src/main/java/com/whop/api/resources/refunds/RawRefundsClient.java new file mode 100644 index 00000000..9dbc0052 --- /dev/null +++ b/src/main/java/com/whop/api/resources/refunds/RawRefundsClient.java @@ -0,0 +1,319 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.refunds; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.refunds.requests.ListRefundsRequest; +import com.whop.api.resources.refunds.requests.RetrieveRefundsRequest; +import com.whop.api.resources.refunds.types.ListRefundsResponse; +import com.whop.api.types.Refund; +import com.whop.api.types.RefundListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawRefundsClient { + protected final ClientOptions clientOptions; + + public RawRefundsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list() { + return list(ListRefundsRequest.builder().build()); + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListRefundsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListRefundsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListRefundsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("refunds"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getPaymentId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "payment_id", request.getPaymentId().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListRefundsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListRefundsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListRefundsRequest nextRequest = ListRefundsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveRefundsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveRefundsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveRefundsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveRefundsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("refunds") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Refund.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/refunds/RefundsClient.java b/src/main/java/com/whop/api/resources/refunds/RefundsClient.java new file mode 100644 index 00000000..6376c239 --- /dev/null +++ b/src/main/java/com/whop/api/resources/refunds/RefundsClient.java @@ -0,0 +1,138 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.refunds; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.refunds.requests.ListRefundsRequest; +import com.whop.api.resources.refunds.requests.RetrieveRefundsRequest; +import com.whop.api.types.Refund; +import com.whop.api.types.RefundListItem; + +public class RefundsClient { + protected final ClientOptions clientOptions; + + private final RawRefundsClient rawClient; + + public RefundsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawRefundsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawRefundsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public SyncPagingIterable list(ListRefundsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of refunds, with optional filtering by payment, company, user, and creation date. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
+ */ + public SyncPagingIterable list(ListRefundsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public Refund retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public Refund retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public Refund retrieve(String id, RetrieveRefundsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing refund. + *

Required permissions:

+ *
    + *
  • payment:basic:read
  • + *
  • plan:basic:read
  • + *
  • access_pass:basic:read
  • + *
  • member:email:read
  • + *
  • member:basic:read
  • + *
  • member:phone:read
  • + *
+ */ + public Refund retrieve(String id, RetrieveRefundsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/refunds/requests/ListRefundsRequest.java b/src/main/java/com/whop/api/resources/refunds/requests/ListRefundsRequest.java new file mode 100644 index 00000000..05dd28e3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/refunds/requests/ListRefundsRequest.java @@ -0,0 +1,400 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.refunds.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Direction; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListRefundsRequest.Builder.class) +public final class ListRefundsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Optional paymentId; + + private final Optional companyId; + + private final Optional userId; + + private final Optional direction; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Map additionalProperties; + + private ListRefundsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + Optional paymentId, + Optional companyId, + Optional userId, + Optional direction, + Optional createdBefore, + Optional createdAfter, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.paymentId = paymentId; + this.companyId = companyId; + this.userId = userId; + this.direction = direction; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Filter refunds to only those associated with this specific payment. + */ + @JsonProperty("payment_id") + public Optional getPaymentId() { + return paymentId; + } + + /** + * @return Filter refunds to only those belonging to this company. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + /** + * @return Filter refunds to only those associated with this specific user. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Only return refunds created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return refunds created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListRefundsRequest && equalTo((ListRefundsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListRefundsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && paymentId.equals(other.paymentId) + && companyId.equals(other.companyId) + && userId.equals(other.userId) + && direction.equals(other.direction) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.after, + this.before, + this.first, + this.last, + this.paymentId, + this.companyId, + this.userId, + this.direction, + this.createdBefore, + this.createdAfter); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional paymentId = Optional.empty(); + + private Optional companyId = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListRefundsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + paymentId(other.getPaymentId()); + companyId(other.getCompanyId()); + userId(other.getUserId()); + direction(other.getDirection()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Filter refunds to only those associated with this specific payment.

+ */ + @JsonSetter(value = "payment_id", nulls = Nulls.SKIP) + public Builder paymentId(Optional paymentId) { + this.paymentId = paymentId; + return this; + } + + public Builder paymentId(String paymentId) { + this.paymentId = Optional.ofNullable(paymentId); + return this; + } + + /** + *

Filter refunds to only those belonging to this company.

+ */ + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + /** + *

Filter refunds to only those associated with this specific user.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(Direction direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Only return refunds created before this timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return refunds created after this timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + public ListRefundsRequest build() { + return new ListRefundsRequest( + after, + before, + first, + last, + paymentId, + companyId, + userId, + direction, + createdBefore, + createdAfter, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/refunds/requests/RetrieveRefundsRequest.java b/src/main/java/com/whop/api/resources/refunds/requests/RetrieveRefundsRequest.java new file mode 100644 index 00000000..00c96c41 --- /dev/null +++ b/src/main/java/com/whop/api/resources/refunds/requests/RetrieveRefundsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.refunds.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveRefundsRequest.Builder.class) +public final class RetrieveRefundsRequest { + private final Map additionalProperties; + + private RetrieveRefundsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveRefundsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveRefundsRequest other) { + return this; + } + + public RetrieveRefundsRequest build() { + return new RetrieveRefundsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/refunds/types/ListRefundsResponse.java b/src/main/java/com/whop/api/resources/refunds/types/ListRefundsResponse.java new file mode 100644 index 00000000..8c116e1d --- /dev/null +++ b/src/main/java/com/whop/api/resources/refunds/types/ListRefundsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.refunds.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PageInfo; +import com.whop.api.types.RefundListItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListRefundsResponse.Builder.class) +public final class ListRefundsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListRefundsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListRefundsResponse && equalTo((ListRefundsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListRefundsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListRefundsResponse other); + } + + public interface _FinalStage { + ListRefundsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(RefundListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListRefundsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(RefundListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListRefundsResponse build() { + return new ListRefundsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/refunds/types/PostRefundCreatedPayload.java b/src/main/java/com/whop/api/resources/refunds/types/PostRefundCreatedPayload.java new file mode 100644 index 00000000..c58d2acf --- /dev/null +++ b/src/main/java/com/whop/api/resources/refunds/types/PostRefundCreatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.refunds.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Refund; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostRefundCreatedPayload.Builder.class) +public final class PostRefundCreatedPayload { + private final Optional accountId; + + private final PostRefundCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Refund data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostRefundCreatedPayloadType type; + + private final Map additionalProperties; + + private PostRefundCreatedPayload( + Optional accountId, + PostRefundCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Refund data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostRefundCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostRefundCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Refund getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostRefundCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostRefundCreatedPayload && equalTo((PostRefundCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostRefundCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostRefundCreatedPayloadApiVersion apiVersion); + + Builder from(PostRefundCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Refund data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostRefundCreatedPayloadType type); + } + + public interface _FinalStage { + PostRefundCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostRefundCreatedPayloadApiVersion apiVersion; + + private Refund data; + + private String id; + + private OffsetDateTime timestamp; + + private PostRefundCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostRefundCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostRefundCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Refund data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostRefundCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostRefundCreatedPayload build() { + return new PostRefundCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/refunds/types/PostRefundCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/refunds/types/PostRefundCreatedPayloadApiVersion.java new file mode 100644 index 00000000..2ab7d851 --- /dev/null +++ b/src/main/java/com/whop/api/resources/refunds/types/PostRefundCreatedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.refunds.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostRefundCreatedPayloadApiVersion { + public static final PostRefundCreatedPayloadApiVersion V1 = new PostRefundCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostRefundCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostRefundCreatedPayloadApiVersion + && this.string.equals(((PostRefundCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostRefundCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostRefundCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/refunds/types/PostRefundCreatedPayloadType.java b/src/main/java/com/whop/api/resources/refunds/types/PostRefundCreatedPayloadType.java new file mode 100644 index 00000000..cddfbab6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/refunds/types/PostRefundCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.refunds.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostRefundCreatedPayloadType { + public static final PostRefundCreatedPayloadType REFUND_CREATED = + new PostRefundCreatedPayloadType(Value.REFUND_CREATED, "refund.created"); + + private final Value value; + + private final String string; + + PostRefundCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostRefundCreatedPayloadType + && this.string.equals(((PostRefundCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REFUND_CREATED: + return visitor.visitRefundCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostRefundCreatedPayloadType valueOf(String value) { + switch (value) { + case "refund.created": + return REFUND_CREATED; + default: + return new PostRefundCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + REFUND_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitRefundCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/refunds/types/PostRefundUpdatedPayload.java b/src/main/java/com/whop/api/resources/refunds/types/PostRefundUpdatedPayload.java new file mode 100644 index 00000000..b1f523fe --- /dev/null +++ b/src/main/java/com/whop/api/resources/refunds/types/PostRefundUpdatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.refunds.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Refund; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostRefundUpdatedPayload.Builder.class) +public final class PostRefundUpdatedPayload { + private final Optional accountId; + + private final PostRefundUpdatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Refund data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostRefundUpdatedPayloadType type; + + private final Map additionalProperties; + + private PostRefundUpdatedPayload( + Optional accountId, + PostRefundUpdatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Refund data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostRefundUpdatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostRefundUpdatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Refund getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostRefundUpdatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostRefundUpdatedPayload && equalTo((PostRefundUpdatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostRefundUpdatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostRefundUpdatedPayloadApiVersion apiVersion); + + Builder from(PostRefundUpdatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Refund data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostRefundUpdatedPayloadType type); + } + + public interface _FinalStage { + PostRefundUpdatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostRefundUpdatedPayloadApiVersion apiVersion; + + private Refund data; + + private String id; + + private OffsetDateTime timestamp; + + private PostRefundUpdatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostRefundUpdatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostRefundUpdatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Refund data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostRefundUpdatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostRefundUpdatedPayload build() { + return new PostRefundUpdatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/refunds/types/PostRefundUpdatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/refunds/types/PostRefundUpdatedPayloadApiVersion.java new file mode 100644 index 00000000..862d0adb --- /dev/null +++ b/src/main/java/com/whop/api/resources/refunds/types/PostRefundUpdatedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.refunds.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostRefundUpdatedPayloadApiVersion { + public static final PostRefundUpdatedPayloadApiVersion V1 = new PostRefundUpdatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostRefundUpdatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostRefundUpdatedPayloadApiVersion + && this.string.equals(((PostRefundUpdatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostRefundUpdatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostRefundUpdatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/refunds/types/PostRefundUpdatedPayloadType.java b/src/main/java/com/whop/api/resources/refunds/types/PostRefundUpdatedPayloadType.java new file mode 100644 index 00000000..3845732b --- /dev/null +++ b/src/main/java/com/whop/api/resources/refunds/types/PostRefundUpdatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.refunds.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostRefundUpdatedPayloadType { + public static final PostRefundUpdatedPayloadType REFUND_UPDATED = + new PostRefundUpdatedPayloadType(Value.REFUND_UPDATED, "refund.updated"); + + private final Value value; + + private final String string; + + PostRefundUpdatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostRefundUpdatedPayloadType + && this.string.equals(((PostRefundUpdatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REFUND_UPDATED: + return visitor.visitRefundUpdated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostRefundUpdatedPayloadType valueOf(String value) { + switch (value) { + case "refund.updated": + return REFUND_UPDATED; + default: + return new PostRefundUpdatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + REFUND_UPDATED, + + UNKNOWN + } + + public interface Visitor { + T visitRefundUpdated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/AsyncRawResolutionCenterCasesClient.java b/src/main/java/com/whop/api/resources/resolutioncentercases/AsyncRawResolutionCenterCasesClient.java new file mode 100644 index 00000000..5257b2ed --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/AsyncRawResolutionCenterCasesClient.java @@ -0,0 +1,1212 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.resolutioncentercases.requests.AcceptResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.AppealResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.CreateResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.DenyResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.EventsResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.ListResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.ReplyResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.RequestInfoResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.RetrieveResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.SummaryResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.WithdrawResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.types.EventsResolutionCenterCasesResponse; +import com.whop.api.resources.resolutioncentercases.types.ListResolutionCenterCasesResponse; +import com.whop.api.resources.resolutioncentercases.types.SummaryResolutionCenterCasesResponse; +import com.whop.api.types.ResolutionCenterCase; +import com.whop.api.types.ResolutionEvent; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawResolutionCenterCasesClient { + protected final ClientOptions clientOptions; + + public AsyncRawResolutionCenterCasesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public CompletableFuture>> list() { + return list(ListResolutionCenterCasesRequest.builder().build()); + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListResolutionCenterCasesRequest.builder().build(), requestOptions); + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public CompletableFuture>> list( + ListResolutionCenterCasesRequest request) { + return list(request, null); + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public CompletableFuture>> list( + ListResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), true); + } + if (request.getReason().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "reason", request.getReason().get(), true); + } + if (request.getOutcome().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "outcome", request.getOutcome().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListResolutionCenterCasesResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListResolutionCenterCasesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListResolutionCenterCasesRequest nextRequest = ListResolutionCenterCasesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Opens a case, as the customer, against one of your own payments. Provide the payment (receipt_id), the reason, and a message. + */ + public CompletableFuture> create( + CreateResolutionCenterCasesRequest request) { + return create(request, null); + } + + /** + * Opens a case, as the customer, against one of your own payments. Provide the payment (receipt_id), the reason, and a message. + */ + public CompletableFuture> create( + CreateResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public CompletableFuture> summary() { + return summary(SummaryResolutionCenterCasesRequest.builder().build()); + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public CompletableFuture> summary( + RequestOptions requestOptions) { + return summary(SummaryResolutionCenterCasesRequest.builder().build(), requestOptions); + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public CompletableFuture> summary( + SummaryResolutionCenterCasesRequest request) { + return summary(request, null); + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public CompletableFuture> summary( + SummaryResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases/summary"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getGroups().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "groups", request.getGroups().get(), true); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), true); + } + if (request.getReason().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "reason", request.getReason().get(), true); + } + if (request.getOutcome().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "outcome", request.getOutcome().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, SummaryResolutionCenterCasesResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveResolutionCenterCasesRequest.builder().build()); + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveResolutionCenterCasesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public CompletableFuture> retrieve( + String id, RetrieveResolutionCenterCasesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public CompletableFuture> retrieve( + String id, RetrieveResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public CompletableFuture> accept(String id) { + return accept(id, AcceptResolutionCenterCasesRequest.builder().build()); + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public CompletableFuture> accept( + String id, RequestOptions requestOptions) { + return accept(id, AcceptResolutionCenterCasesRequest.builder().build(), requestOptions); + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public CompletableFuture> accept( + String id, AcceptResolutionCenterCasesRequest request) { + return accept(id, request, null); + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public CompletableFuture> accept( + String id, AcceptResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id) + .addPathSegments("accept"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Appeals a decision, as the customer, on a case that closed in the merchant's favor. Escalates the case to Whop for platform review. A case can be appealed once. + */ + public CompletableFuture> appeal( + String id, AppealResolutionCenterCasesRequest request) { + return appeal(id, request, null); + } + + /** + * Appeals a decision, as the customer, on a case that closed in the merchant's favor. Escalates the case to Whop for platform review. A case can be appealed once. + */ + public CompletableFuture> appeal( + String id, AppealResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id) + .addPathSegments("appeal"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Denies the case, as the merchant: rejects the claim and closes the case with no refund. + */ + public CompletableFuture> deny( + String id, DenyResolutionCenterCasesRequest request) { + return deny(id, request, null); + } + + /** + * Denies the case, as the merchant: rejects the claim and closes the case with no refund. + */ + public CompletableFuture> deny( + String id, DenyResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id) + .addPathSegments("deny"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public CompletableFuture>> events(String id) { + return events(id, EventsResolutionCenterCasesRequest.builder().build()); + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public CompletableFuture>> events( + String id, RequestOptions requestOptions) { + return events(id, EventsResolutionCenterCasesRequest.builder().build(), requestOptions); + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public CompletableFuture>> events( + String id, EventsResolutionCenterCasesRequest request) { + return events(id, request, null); + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public CompletableFuture>> events( + String id, EventsResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id) + .addPathSegments("events"); + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + EventsResolutionCenterCasesResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, EventsResolutionCenterCasesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + EventsResolutionCenterCasesRequest nextRequest = EventsResolutionCenterCasesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return events(id, nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Replies to an open request for information on the case. As the merchant this answers Whop's request (valid while the case awaits your information); as the customer it provides the information requested from you. The actor is resolved from the credential. + */ + public CompletableFuture> reply( + String id, ReplyResolutionCenterCasesRequest request) { + return reply(id, request, null); + } + + /** + * Replies to an open request for information on the case. As the merchant this answers Whop's request (valid while the case awaits your information); as the customer it provides the information requested from you. The actor is resolved from the credential. + */ + public CompletableFuture> reply( + String id, ReplyResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id) + .addPathSegments("reply"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public CompletableFuture> requestInfo(String id) { + return requestInfo(id, RequestInfoResolutionCenterCasesRequest.builder().build()); + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public CompletableFuture> requestInfo( + String id, RequestOptions requestOptions) { + return requestInfo(id, RequestInfoResolutionCenterCasesRequest.builder().build(), requestOptions); + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public CompletableFuture> requestInfo( + String id, RequestInfoResolutionCenterCasesRequest request) { + return requestInfo(id, request, null); + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public CompletableFuture> requestInfo( + String id, RequestInfoResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id) + .addPathSegments("request_info"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public CompletableFuture> withdraw(String id) { + return withdraw(id, WithdrawResolutionCenterCasesRequest.builder().build()); + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public CompletableFuture> withdraw( + String id, RequestOptions requestOptions) { + return withdraw(id, WithdrawResolutionCenterCasesRequest.builder().build(), requestOptions); + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public CompletableFuture> withdraw( + String id, WithdrawResolutionCenterCasesRequest request) { + return withdraw(id, request, null); + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public CompletableFuture> withdraw( + String id, WithdrawResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id) + .addPathSegments("withdraw"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/AsyncResolutionCenterCasesClient.java b/src/main/java/com/whop/api/resources/resolutioncentercases/AsyncResolutionCenterCasesClient.java new file mode 100644 index 00000000..86e0b8ca --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/AsyncResolutionCenterCasesClient.java @@ -0,0 +1,307 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.resolutioncentercases.requests.AcceptResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.AppealResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.CreateResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.DenyResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.EventsResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.ListResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.ReplyResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.RequestInfoResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.RetrieveResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.SummaryResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.WithdrawResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.types.SummaryResolutionCenterCasesResponse; +import com.whop.api.types.ResolutionCenterCase; +import com.whop.api.types.ResolutionEvent; +import java.util.concurrent.CompletableFuture; + +public class AsyncResolutionCenterCasesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawResolutionCenterCasesClient rawClient; + + public AsyncResolutionCenterCasesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawResolutionCenterCasesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawResolutionCenterCasesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public CompletableFuture> list(ListResolutionCenterCasesRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public CompletableFuture> list( + ListResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Opens a case, as the customer, against one of your own payments. Provide the payment (receipt_id), the reason, and a message. + */ + public CompletableFuture create(CreateResolutionCenterCasesRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Opens a case, as the customer, against one of your own payments. Provide the payment (receipt_id), the reason, and a message. + */ + public CompletableFuture create( + CreateResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public CompletableFuture summary() { + return this.rawClient.summary().thenApply(response -> response.body()); + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public CompletableFuture summary(RequestOptions requestOptions) { + return this.rawClient.summary(requestOptions).thenApply(response -> response.body()); + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public CompletableFuture summary( + SummaryResolutionCenterCasesRequest request) { + return this.rawClient.summary(request).thenApply(response -> response.body()); + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public CompletableFuture summary( + SummaryResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.summary(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public CompletableFuture retrieve(String id, RetrieveResolutionCenterCasesRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public CompletableFuture retrieve( + String id, RetrieveResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public CompletableFuture accept(String id) { + return this.rawClient.accept(id).thenApply(response -> response.body()); + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public CompletableFuture accept(String id, RequestOptions requestOptions) { + return this.rawClient.accept(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public CompletableFuture accept(String id, AcceptResolutionCenterCasesRequest request) { + return this.rawClient.accept(id, request).thenApply(response -> response.body()); + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public CompletableFuture accept( + String id, AcceptResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.accept(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Appeals a decision, as the customer, on a case that closed in the merchant's favor. Escalates the case to Whop for platform review. A case can be appealed once. + */ + public CompletableFuture appeal(String id, AppealResolutionCenterCasesRequest request) { + return this.rawClient.appeal(id, request).thenApply(response -> response.body()); + } + + /** + * Appeals a decision, as the customer, on a case that closed in the merchant's favor. Escalates the case to Whop for platform review. A case can be appealed once. + */ + public CompletableFuture appeal( + String id, AppealResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.appeal(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Denies the case, as the merchant: rejects the claim and closes the case with no refund. + */ + public CompletableFuture deny(String id, DenyResolutionCenterCasesRequest request) { + return this.rawClient.deny(id, request).thenApply(response -> response.body()); + } + + /** + * Denies the case, as the merchant: rejects the claim and closes the case with no refund. + */ + public CompletableFuture deny( + String id, DenyResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.deny(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public CompletableFuture> events(String id) { + return this.rawClient.events(id).thenApply(response -> response.body()); + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public CompletableFuture> events(String id, RequestOptions requestOptions) { + return this.rawClient.events(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public CompletableFuture> events( + String id, EventsResolutionCenterCasesRequest request) { + return this.rawClient.events(id, request).thenApply(response -> response.body()); + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public CompletableFuture> events( + String id, EventsResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.events(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Replies to an open request for information on the case. As the merchant this answers Whop's request (valid while the case awaits your information); as the customer it provides the information requested from you. The actor is resolved from the credential. + */ + public CompletableFuture reply(String id, ReplyResolutionCenterCasesRequest request) { + return this.rawClient.reply(id, request).thenApply(response -> response.body()); + } + + /** + * Replies to an open request for information on the case. As the merchant this answers Whop's request (valid while the case awaits your information); as the customer it provides the information requested from you. The actor is resolved from the credential. + */ + public CompletableFuture reply( + String id, ReplyResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.reply(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public CompletableFuture requestInfo(String id) { + return this.rawClient.requestInfo(id).thenApply(response -> response.body()); + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public CompletableFuture requestInfo(String id, RequestOptions requestOptions) { + return this.rawClient.requestInfo(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public CompletableFuture requestInfo( + String id, RequestInfoResolutionCenterCasesRequest request) { + return this.rawClient.requestInfo(id, request).thenApply(response -> response.body()); + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public CompletableFuture requestInfo( + String id, RequestInfoResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.requestInfo(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public CompletableFuture withdraw(String id) { + return this.rawClient.withdraw(id).thenApply(response -> response.body()); + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public CompletableFuture withdraw(String id, RequestOptions requestOptions) { + return this.rawClient.withdraw(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public CompletableFuture withdraw(String id, WithdrawResolutionCenterCasesRequest request) { + return this.rawClient.withdraw(id, request).thenApply(response -> response.body()); + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public CompletableFuture withdraw( + String id, WithdrawResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.withdraw(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/RawResolutionCenterCasesClient.java b/src/main/java/com/whop/api/resources/resolutioncentercases/RawResolutionCenterCasesClient.java new file mode 100644 index 00000000..11d31edc --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/RawResolutionCenterCasesClient.java @@ -0,0 +1,985 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.resolutioncentercases.requests.AcceptResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.AppealResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.CreateResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.DenyResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.EventsResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.ListResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.ReplyResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.RequestInfoResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.RetrieveResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.SummaryResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.WithdrawResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.types.EventsResolutionCenterCasesResponse; +import com.whop.api.resources.resolutioncentercases.types.ListResolutionCenterCasesResponse; +import com.whop.api.resources.resolutioncentercases.types.SummaryResolutionCenterCasesResponse; +import com.whop.api.types.ResolutionCenterCase; +import com.whop.api.types.ResolutionEvent; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawResolutionCenterCasesClient { + protected final ClientOptions clientOptions; + + public RawResolutionCenterCasesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public WhopApiHttpResponse> list() { + return list(ListResolutionCenterCasesRequest.builder().build()); + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListResolutionCenterCasesRequest.builder().build(), requestOptions); + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public WhopApiHttpResponse> list( + ListResolutionCenterCasesRequest request) { + return list(request, null); + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public WhopApiHttpResponse> list( + ListResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), true); + } + if (request.getReason().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "reason", request.getReason().get(), true); + } + if (request.getOutcome().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "outcome", request.getOutcome().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListResolutionCenterCasesResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListResolutionCenterCasesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListResolutionCenterCasesRequest nextRequest = ListResolutionCenterCasesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Opens a case, as the customer, against one of your own payments. Provide the payment (receipt_id), the reason, and a message. + */ + public WhopApiHttpResponse create(CreateResolutionCenterCasesRequest request) { + return create(request, null); + } + + /** + * Opens a case, as the customer, against one of your own payments. Provide the payment (receipt_id), the reason, and a message. + */ + public WhopApiHttpResponse create( + CreateResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public WhopApiHttpResponse summary() { + return summary(SummaryResolutionCenterCasesRequest.builder().build()); + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public WhopApiHttpResponse summary(RequestOptions requestOptions) { + return summary(SummaryResolutionCenterCasesRequest.builder().build(), requestOptions); + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public WhopApiHttpResponse summary( + SummaryResolutionCenterCasesRequest request) { + return summary(request, null); + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public WhopApiHttpResponse summary( + SummaryResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases/summary"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getGroups().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "groups", request.getGroups().get(), true); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), true); + } + if (request.getReason().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "reason", request.getReason().get(), true); + } + if (request.getOutcome().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "outcome", request.getOutcome().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, SummaryResolutionCenterCasesResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveResolutionCenterCasesRequest.builder().build()); + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveResolutionCenterCasesRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveResolutionCenterCasesRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public WhopApiHttpResponse accept(String id) { + return accept(id, AcceptResolutionCenterCasesRequest.builder().build()); + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public WhopApiHttpResponse accept(String id, RequestOptions requestOptions) { + return accept(id, AcceptResolutionCenterCasesRequest.builder().build(), requestOptions); + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public WhopApiHttpResponse accept(String id, AcceptResolutionCenterCasesRequest request) { + return accept(id, request, null); + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public WhopApiHttpResponse accept( + String id, AcceptResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id) + .addPathSegments("accept"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Appeals a decision, as the customer, on a case that closed in the merchant's favor. Escalates the case to Whop for platform review. A case can be appealed once. + */ + public WhopApiHttpResponse appeal(String id, AppealResolutionCenterCasesRequest request) { + return appeal(id, request, null); + } + + /** + * Appeals a decision, as the customer, on a case that closed in the merchant's favor. Escalates the case to Whop for platform review. A case can be appealed once. + */ + public WhopApiHttpResponse appeal( + String id, AppealResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id) + .addPathSegments("appeal"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Denies the case, as the merchant: rejects the claim and closes the case with no refund. + */ + public WhopApiHttpResponse deny(String id, DenyResolutionCenterCasesRequest request) { + return deny(id, request, null); + } + + /** + * Denies the case, as the merchant: rejects the claim and closes the case with no refund. + */ + public WhopApiHttpResponse deny( + String id, DenyResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id) + .addPathSegments("deny"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public WhopApiHttpResponse> events(String id) { + return events(id, EventsResolutionCenterCasesRequest.builder().build()); + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public WhopApiHttpResponse> events(String id, RequestOptions requestOptions) { + return events(id, EventsResolutionCenterCasesRequest.builder().build(), requestOptions); + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public WhopApiHttpResponse> events( + String id, EventsResolutionCenterCasesRequest request) { + return events(id, request, null); + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public WhopApiHttpResponse> events( + String id, EventsResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id) + .addPathSegments("events"); + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + EventsResolutionCenterCasesResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, EventsResolutionCenterCasesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + EventsResolutionCenterCasesRequest nextRequest = EventsResolutionCenterCasesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> events( + id, nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Replies to an open request for information on the case. As the merchant this answers Whop's request (valid while the case awaits your information); as the customer it provides the information requested from you. The actor is resolved from the credential. + */ + public WhopApiHttpResponse reply(String id, ReplyResolutionCenterCasesRequest request) { + return reply(id, request, null); + } + + /** + * Replies to an open request for information on the case. As the merchant this answers Whop's request (valid while the case awaits your information); as the customer it provides the information requested from you. The actor is resolved from the credential. + */ + public WhopApiHttpResponse reply( + String id, ReplyResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id) + .addPathSegments("reply"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public WhopApiHttpResponse requestInfo(String id) { + return requestInfo(id, RequestInfoResolutionCenterCasesRequest.builder().build()); + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public WhopApiHttpResponse requestInfo(String id, RequestOptions requestOptions) { + return requestInfo(id, RequestInfoResolutionCenterCasesRequest.builder().build(), requestOptions); + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public WhopApiHttpResponse requestInfo( + String id, RequestInfoResolutionCenterCasesRequest request) { + return requestInfo(id, request, null); + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public WhopApiHttpResponse requestInfo( + String id, RequestInfoResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id) + .addPathSegments("request_info"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public WhopApiHttpResponse withdraw(String id) { + return withdraw(id, WithdrawResolutionCenterCasesRequest.builder().build()); + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public WhopApiHttpResponse withdraw(String id, RequestOptions requestOptions) { + return withdraw(id, WithdrawResolutionCenterCasesRequest.builder().build(), requestOptions); + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public WhopApiHttpResponse withdraw(String id, WithdrawResolutionCenterCasesRequest request) { + return withdraw(id, request, null); + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public WhopApiHttpResponse withdraw( + String id, WithdrawResolutionCenterCasesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("resolution_center_cases") + .addPathSegment(id) + .addPathSegments("withdraw"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ResolutionCenterCase.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/ResolutionCenterCasesClient.java b/src/main/java/com/whop/api/resources/resolutioncentercases/ResolutionCenterCasesClient.java new file mode 100644 index 00000000..611947f3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/ResolutionCenterCasesClient.java @@ -0,0 +1,302 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.resolutioncentercases.requests.AcceptResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.AppealResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.CreateResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.DenyResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.EventsResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.ListResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.ReplyResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.RequestInfoResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.RetrieveResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.SummaryResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.requests.WithdrawResolutionCenterCasesRequest; +import com.whop.api.resources.resolutioncentercases.types.SummaryResolutionCenterCasesResponse; +import com.whop.api.types.ResolutionCenterCase; +import com.whop.api.types.ResolutionEvent; + +public class ResolutionCenterCasesClient { + protected final ClientOptions clientOptions; + + private final RawResolutionCenterCasesClient rawClient; + + public ResolutionCenterCasesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawResolutionCenterCasesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawResolutionCenterCasesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public SyncPagingIterable list(ListResolutionCenterCasesRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists resolution center cases. Without account_id you get every case you can read — the ones you opened as a buyer and every account you are a team member of; the filters narrow that list. + */ + public SyncPagingIterable list( + ListResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Opens a case, as the customer, against one of your own payments. Provide the payment (receipt_id), the reason, and a message. + */ + public ResolutionCenterCase create(CreateResolutionCenterCasesRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Opens a case, as the customer, against one of your own payments. Provide the payment (receipt_id), the reason, and a message. + */ + public ResolutionCenterCase create(CreateResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public SummaryResolutionCenterCasesResponse summary() { + return this.rawClient.summary().body(); + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public SummaryResolutionCenterCasesResponse summary(RequestOptions requestOptions) { + return this.rawClient.summary(requestOptions).body(); + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public SummaryResolutionCenterCasesResponse summary(SummaryResolutionCenterCasesRequest request) { + return this.rawClient.summary(request).body(); + } + + /** + * Aggregates the same cases GET /resolution_center_cases lists, using the same filters. Use it to build status tabs and issue filters without paging the whole list. + */ + public SummaryResolutionCenterCasesResponse summary( + SummaryResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.summary(request, requestOptions).body(); + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public ResolutionCenterCase retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public ResolutionCenterCase retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public ResolutionCenterCase retrieve(String id, RetrieveResolutionCenterCasesRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a single resolution center case with its full event timeline. + */ + public ResolutionCenterCase retrieve( + String id, RetrieveResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public ResolutionCenterCase accept(String id) { + return this.rawClient.accept(id).body(); + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public ResolutionCenterCase accept(String id, RequestOptions requestOptions) { + return this.rawClient.accept(id, requestOptions).body(); + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public ResolutionCenterCase accept(String id, AcceptResolutionCenterCasesRequest request) { + return this.rawClient.accept(id, request).body(); + } + + /** + * Accepts the case in the customer's favor, as the merchant: refunds the payment in full and closes the case. + */ + public ResolutionCenterCase accept( + String id, AcceptResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.accept(id, request, requestOptions).body(); + } + + /** + * Appeals a decision, as the customer, on a case that closed in the merchant's favor. Escalates the case to Whop for platform review. A case can be appealed once. + */ + public ResolutionCenterCase appeal(String id, AppealResolutionCenterCasesRequest request) { + return this.rawClient.appeal(id, request).body(); + } + + /** + * Appeals a decision, as the customer, on a case that closed in the merchant's favor. Escalates the case to Whop for platform review. A case can be appealed once. + */ + public ResolutionCenterCase appeal( + String id, AppealResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.appeal(id, request, requestOptions).body(); + } + + /** + * Denies the case, as the merchant: rejects the claim and closes the case with no refund. + */ + public ResolutionCenterCase deny(String id, DenyResolutionCenterCasesRequest request) { + return this.rawClient.deny(id, request).body(); + } + + /** + * Denies the case, as the merchant: rejects the claim and closes the case with no refund. + */ + public ResolutionCenterCase deny( + String id, DenyResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.deny(id, request, requestOptions).body(); + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public SyncPagingIterable events(String id) { + return this.rawClient.events(id).body(); + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public SyncPagingIterable events(String id, RequestOptions requestOptions) { + return this.rawClient.events(id, requestOptions).body(); + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public SyncPagingIterable events(String id, EventsResolutionCenterCasesRequest request) { + return this.rawClient.events(id, request).body(); + } + + /** + * Lists the case timeline, newest first. Events the viewer is not allowed to see are omitted — a customer reads the customer-visible timeline, the merchant reads the full one. + */ + public SyncPagingIterable events( + String id, EventsResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.events(id, request, requestOptions).body(); + } + + /** + * Replies to an open request for information on the case. As the merchant this answers Whop's request (valid while the case awaits your information); as the customer it provides the information requested from you. The actor is resolved from the credential. + */ + public ResolutionCenterCase reply(String id, ReplyResolutionCenterCasesRequest request) { + return this.rawClient.reply(id, request).body(); + } + + /** + * Replies to an open request for information on the case. As the merchant this answers Whop's request (valid while the case awaits your information); as the customer it provides the information requested from you. The actor is resolved from the credential. + */ + public ResolutionCenterCase reply( + String id, ReplyResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.reply(id, request, requestOptions).body(); + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public ResolutionCenterCase requestInfo(String id) { + return this.rawClient.requestInfo(id).body(); + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public ResolutionCenterCase requestInfo(String id, RequestOptions requestOptions) { + return this.rawClient.requestInfo(id, requestOptions).body(); + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public ResolutionCenterCase requestInfo(String id, RequestInfoResolutionCenterCasesRequest request) { + return this.rawClient.requestInfo(id, request).body(); + } + + /** + * Asks the customer for more information, as the merchant. Allowed up to 3 times per case before you must accept or deny it. + */ + public ResolutionCenterCase requestInfo( + String id, RequestInfoResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.requestInfo(id, request, requestOptions).body(); + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public ResolutionCenterCase withdraw(String id) { + return this.rawClient.withdraw(id).body(); + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public ResolutionCenterCase withdraw(String id, RequestOptions requestOptions) { + return this.rawClient.withdraw(id, requestOptions).body(); + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public ResolutionCenterCase withdraw(String id, WithdrawResolutionCenterCasesRequest request) { + return this.rawClient.withdraw(id, request).body(); + } + + /** + * Withdraws (cancels) a case you opened, as the customer. Only possible while the case is still open. + */ + public ResolutionCenterCase withdraw( + String id, WithdrawResolutionCenterCasesRequest request, RequestOptions requestOptions) { + return this.rawClient.withdraw(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/requests/AcceptResolutionCenterCasesRequest.java b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/AcceptResolutionCenterCasesRequest.java new file mode 100644 index 00000000..c74bc034 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/AcceptResolutionCenterCasesRequest.java @@ -0,0 +1,177 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.resolutioncentercases.types.AcceptResolutionCenterCasesRequestAttachmentsItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AcceptResolutionCenterCasesRequest.Builder.class) +public final class AcceptResolutionCenterCasesRequest { + private final Optional> attachments; + + private final Optional message; + + private final Optional terminateMembership; + + private final Map additionalProperties; + + private AcceptResolutionCenterCasesRequest( + Optional> attachments, + Optional message, + Optional terminateMembership, + Map additionalProperties) { + this.attachments = attachments; + this.message = message; + this.terminateMembership = terminateMembership; + this.additionalProperties = additionalProperties; + } + + /** + * @return Up to 3 evidence files, by existing file id or direct_upload_id. + */ + @JsonProperty("attachments") + public Optional> getAttachments() { + return attachments; + } + + /** + * @return An optional note to the customer, recorded on the case timeline. + */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + /** + * @return Whether to also terminate the customer's membership. + */ + @JsonProperty("terminate_membership") + public Optional getTerminateMembership() { + return terminateMembership; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AcceptResolutionCenterCasesRequest + && equalTo((AcceptResolutionCenterCasesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AcceptResolutionCenterCasesRequest other) { + return attachments.equals(other.attachments) + && message.equals(other.message) + && terminateMembership.equals(other.terminateMembership); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.attachments, this.message, this.terminateMembership); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> attachments = Optional.empty(); + + private Optional message = Optional.empty(); + + private Optional terminateMembership = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AcceptResolutionCenterCasesRequest other) { + attachments(other.getAttachments()); + message(other.getMessage()); + terminateMembership(other.getTerminateMembership()); + return this; + } + + /** + *

Up to 3 evidence files, by existing file id or direct_upload_id.

+ */ + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public Builder attachments(Optional> attachments) { + this.attachments = attachments; + return this; + } + + public Builder attachments(List attachments) { + this.attachments = Optional.ofNullable(attachments); + return this; + } + + /** + *

An optional note to the customer, recorded on the case timeline.

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + /** + *

Whether to also terminate the customer's membership.

+ */ + @JsonSetter(value = "terminate_membership", nulls = Nulls.SKIP) + public Builder terminateMembership(Optional terminateMembership) { + this.terminateMembership = terminateMembership; + return this; + } + + public Builder terminateMembership(Boolean terminateMembership) { + this.terminateMembership = Optional.ofNullable(terminateMembership); + return this; + } + + public AcceptResolutionCenterCasesRequest build() { + return new AcceptResolutionCenterCasesRequest( + attachments, message, terminateMembership, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/requests/AppealResolutionCenterCasesRequest.java b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/AppealResolutionCenterCasesRequest.java new file mode 100644 index 00000000..9920e90b --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/AppealResolutionCenterCasesRequest.java @@ -0,0 +1,178 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.resolutioncentercases.types.AppealResolutionCenterCasesRequestAttachmentsItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppealResolutionCenterCasesRequest.Builder.class) +public final class AppealResolutionCenterCasesRequest { + private final Optional> attachments; + + private final String message; + + private final Map additionalProperties; + + private AppealResolutionCenterCasesRequest( + Optional> attachments, + String message, + Map additionalProperties) { + this.attachments = attachments; + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return Up to 3 evidence files, by existing file id or direct_upload_id. + */ + @JsonProperty("attachments") + public Optional> getAttachments() { + return attachments; + } + + /** + * @return Why you are appealing the decision. + */ + @JsonProperty("message") + public String getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppealResolutionCenterCasesRequest + && equalTo((AppealResolutionCenterCasesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppealResolutionCenterCasesRequest other) { + return attachments.equals(other.attachments) && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.attachments, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + /** + *

Why you are appealing the decision.

+ */ + _FinalStage message(@NotNull String message); + + Builder from(AppealResolutionCenterCasesRequest other); + } + + public interface _FinalStage { + AppealResolutionCenterCasesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Up to 3 evidence files, by existing file id or direct_upload_id.

+ */ + _FinalStage attachments(Optional> attachments); + + _FinalStage attachments(List attachments); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, _FinalStage { + private String message; + + private Optional> attachments = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AppealResolutionCenterCasesRequest other) { + attachments(other.getAttachments()); + message(other.getMessage()); + return this; + } + + /** + *

Why you are appealing the decision.

+ *

Why you are appealing the decision.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message") + public _FinalStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + /** + *

Up to 3 evidence files, by existing file id or direct_upload_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage attachments(List attachments) { + this.attachments = Optional.ofNullable(attachments); + return this; + } + + /** + *

Up to 3 evidence files, by existing file id or direct_upload_id.

+ */ + @java.lang.Override + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public _FinalStage attachments(Optional> attachments) { + this.attachments = attachments; + return this; + } + + @java.lang.Override + public AppealResolutionCenterCasesRequest build() { + return new AppealResolutionCenterCasesRequest(attachments, message, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/requests/CreateResolutionCenterCasesRequest.java b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/CreateResolutionCenterCasesRequest.java new file mode 100644 index 00000000..32cd64c0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/CreateResolutionCenterCasesRequest.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.resolutioncentercases.types.CreateResolutionCenterCasesRequestAttachmentsItem; +import com.whop.api.resources.resolutioncentercases.types.CreateResolutionCenterCasesRequestReason; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateResolutionCenterCasesRequest.Builder.class) +public final class CreateResolutionCenterCasesRequest { + private final Optional> attachments; + + private final String message; + + private final CreateResolutionCenterCasesRequestReason reason; + + private final String receiptId; + + private final Map additionalProperties; + + private CreateResolutionCenterCasesRequest( + Optional> attachments, + String message, + CreateResolutionCenterCasesRequestReason reason, + String receiptId, + Map additionalProperties) { + this.attachments = attachments; + this.message = message; + this.reason = reason; + this.receiptId = receiptId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("attachments") + public Optional> getAttachments() { + return attachments; + } + + /** + * @return The customer's explanation. + */ + @JsonProperty("message") + public String getMessage() { + return message; + } + + /** + * @return What went wrong. Uses the same vocabulary as /disputes. + */ + @JsonProperty("reason") + public CreateResolutionCenterCasesRequestReason getReason() { + return reason; + } + + /** + * @return The payment to open the case against (pay_ tag). + */ + @JsonProperty("receipt_id") + public String getReceiptId() { + return receiptId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateResolutionCenterCasesRequest + && equalTo((CreateResolutionCenterCasesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateResolutionCenterCasesRequest other) { + return attachments.equals(other.attachments) + && message.equals(other.message) + && reason.equals(other.reason) + && receiptId.equals(other.receiptId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.attachments, this.message, this.reason, this.receiptId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + /** + *

The customer's explanation.

+ */ + ReasonStage message(@NotNull String message); + + Builder from(CreateResolutionCenterCasesRequest other); + } + + public interface ReasonStage { + /** + *

What went wrong. Uses the same vocabulary as /disputes.

+ */ + ReceiptIdStage reason(@NotNull CreateResolutionCenterCasesRequestReason reason); + } + + public interface ReceiptIdStage { + /** + *

The payment to open the case against (pay_ tag).

+ */ + _FinalStage receiptId(@NotNull String receiptId); + } + + public interface _FinalStage { + CreateResolutionCenterCasesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage attachments(Optional> attachments); + + _FinalStage attachments(List attachments); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, ReasonStage, ReceiptIdStage, _FinalStage { + private String message; + + private CreateResolutionCenterCasesRequestReason reason; + + private String receiptId; + + private Optional> attachments = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateResolutionCenterCasesRequest other) { + attachments(other.getAttachments()); + message(other.getMessage()); + reason(other.getReason()); + receiptId(other.getReceiptId()); + return this; + } + + /** + *

The customer's explanation.

+ *

The customer's explanation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message") + public ReasonStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + /** + *

What went wrong. Uses the same vocabulary as /disputes.

+ *

What went wrong. Uses the same vocabulary as /disputes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reason") + public ReceiptIdStage reason(@NotNull CreateResolutionCenterCasesRequestReason reason) { + this.reason = Objects.requireNonNull(reason, "reason must not be null"); + return this; + } + + /** + *

The payment to open the case against (pay_ tag).

+ *

The payment to open the case against (pay_ tag).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("receipt_id") + public _FinalStage receiptId(@NotNull String receiptId) { + this.receiptId = Objects.requireNonNull(receiptId, "receiptId must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage attachments(List attachments) { + this.attachments = Optional.ofNullable(attachments); + return this; + } + + @java.lang.Override + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public _FinalStage attachments(Optional> attachments) { + this.attachments = attachments; + return this; + } + + @java.lang.Override + public CreateResolutionCenterCasesRequest build() { + return new CreateResolutionCenterCasesRequest( + attachments, message, reason, receiptId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/requests/DenyResolutionCenterCasesRequest.java b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/DenyResolutionCenterCasesRequest.java new file mode 100644 index 00000000..ce852105 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/DenyResolutionCenterCasesRequest.java @@ -0,0 +1,177 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.resolutioncentercases.types.DenyResolutionCenterCasesRequestAttachmentsItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DenyResolutionCenterCasesRequest.Builder.class) +public final class DenyResolutionCenterCasesRequest { + private final Optional> attachments; + + private final String message; + + private final Map additionalProperties; + + private DenyResolutionCenterCasesRequest( + Optional> attachments, + String message, + Map additionalProperties) { + this.attachments = attachments; + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return Up to 3 evidence files, by existing file id or direct_upload_id. + */ + @JsonProperty("attachments") + public Optional> getAttachments() { + return attachments; + } + + /** + * @return Why the claim is being denied. Shown to the customer. + */ + @JsonProperty("message") + public String getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DenyResolutionCenterCasesRequest && equalTo((DenyResolutionCenterCasesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DenyResolutionCenterCasesRequest other) { + return attachments.equals(other.attachments) && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.attachments, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + /** + *

Why the claim is being denied. Shown to the customer.

+ */ + _FinalStage message(@NotNull String message); + + Builder from(DenyResolutionCenterCasesRequest other); + } + + public interface _FinalStage { + DenyResolutionCenterCasesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Up to 3 evidence files, by existing file id or direct_upload_id.

+ */ + _FinalStage attachments(Optional> attachments); + + _FinalStage attachments(List attachments); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, _FinalStage { + private String message; + + private Optional> attachments = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DenyResolutionCenterCasesRequest other) { + attachments(other.getAttachments()); + message(other.getMessage()); + return this; + } + + /** + *

Why the claim is being denied. Shown to the customer.

+ *

Why the claim is being denied. Shown to the customer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message") + public _FinalStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + /** + *

Up to 3 evidence files, by existing file id or direct_upload_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage attachments(List attachments) { + this.attachments = Optional.ofNullable(attachments); + return this; + } + + /** + *

Up to 3 evidence files, by existing file id or direct_upload_id.

+ */ + @java.lang.Override + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public _FinalStage attachments(Optional> attachments) { + this.attachments = attachments; + return this; + } + + @java.lang.Override + public DenyResolutionCenterCasesRequest build() { + return new DenyResolutionCenterCasesRequest(attachments, message, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/requests/EventsResolutionCenterCasesRequest.java b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/EventsResolutionCenterCasesRequest.java new file mode 100644 index 00000000..6f807548 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/EventsResolutionCenterCasesRequest.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EventsResolutionCenterCasesRequest.Builder.class) +public final class EventsResolutionCenterCasesRequest { + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private EventsResolutionCenterCasesRequest( + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return The number of events to return (default 20, max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns events after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of events to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns events before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EventsResolutionCenterCasesRequest + && equalTo((EventsResolutionCenterCasesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EventsResolutionCenterCasesRequest other) { + return first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.first, this.after, this.last, this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(EventsResolutionCenterCasesRequest other) { + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

The number of events to return (default 20, max 100).

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor; returns events after this position.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The number of events to return from the end of the range.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

A cursor; returns events before this position.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public EventsResolutionCenterCasesRequest build() { + return new EventsResolutionCenterCasesRequest(first, after, last, before, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/requests/ListResolutionCenterCasesRequest.java b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/ListResolutionCenterCasesRequest.java new file mode 100644 index 00000000..09fefceb --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/ListResolutionCenterCasesRequest.java @@ -0,0 +1,522 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.resolutioncentercases.types.ListResolutionCenterCasesRequestDirection; +import com.whop.api.resources.resolutioncentercases.types.ListResolutionCenterCasesRequestOrder; +import com.whop.api.resources.resolutioncentercases.types.ListResolutionCenterCasesRequestOutcomeItem; +import com.whop.api.resources.resolutioncentercases.types.ListResolutionCenterCasesRequestReasonItem; +import com.whop.api.resources.resolutioncentercases.types.ListResolutionCenterCasesRequestStatusItem; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListResolutionCenterCasesRequest.Builder.class) +public final class ListResolutionCenterCasesRequest { + private final Optional> status; + + private final Optional> reason; + + private final Optional> outcome; + + private final Optional accountId; + + private final Optional userId; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Optional order; + + private final Optional direction; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Map additionalProperties; + + private ListResolutionCenterCasesRequest( + Optional> status, + Optional> reason, + Optional> outcome, + Optional accountId, + Optional userId, + Optional first, + Optional after, + Optional last, + Optional before, + Optional order, + Optional direction, + Optional createdBefore, + Optional createdAfter, + Map additionalProperties) { + this.status = status; + this.reason = reason; + this.outcome = outcome; + this.accountId = accountId; + this.userId = userId; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.order = order; + this.direction = direction; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only cases in these statuses. Repeat the parameter to pass several — one paginated list covers all of them. + */ + @JsonProperty("status") + public Optional> getStatus() { + return status; + } + + /** + * @return Only cases opened for these reasons. Repeat the parameter to pass several. + */ + @JsonProperty("reason") + public Optional> getReason() { + return reason; + } + + /** + * @return Only closed cases that ended these ways. Repeat the parameter to pass several. + */ + @JsonProperty("outcome") + public Optional> getOutcome() { + return outcome; + } + + /** + * @return Only cases filed against this account (biz_ tag). With read access to the account this lists its whole queue; without, only the cases you opened against it. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Only cases opened by this customer — a user_ tag, or me for the calling user. It narrows what you can already read, so me lists the cases you opened without the ones on accounts you are a team member of. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + /** + * @return The number of cases to return (default 20, max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns cases after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of cases to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns cases before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The field to sort cases by. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Only cases created before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only cases created after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListResolutionCenterCasesRequest && equalTo((ListResolutionCenterCasesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListResolutionCenterCasesRequest other) { + return status.equals(other.status) + && reason.equals(other.reason) + && outcome.equals(other.outcome) + && accountId.equals(other.accountId) + && userId.equals(other.userId) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before) + && order.equals(other.order) + && direction.equals(other.direction) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.status, + this.reason, + this.outcome, + this.accountId, + this.userId, + this.first, + this.after, + this.last, + this.before, + this.order, + this.direction, + this.createdBefore, + this.createdAfter); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> status = Optional.empty(); + + private Optional> reason = Optional.empty(); + + private Optional> outcome = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListResolutionCenterCasesRequest other) { + status(other.getStatus()); + reason(other.getReason()); + outcome(other.getOutcome()); + accountId(other.getAccountId()); + userId(other.getUserId()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + order(other.getOrder()); + direction(other.getDirection()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + return this; + } + + /** + *

Only cases in these statuses. Repeat the parameter to pass several — one paginated list covers all of them.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional> status) { + this.status = status; + return this; + } + + public Builder status(List status) { + this.status = Optional.ofNullable(status); + return this; + } + + public Builder status(ListResolutionCenterCasesRequestStatusItem status) { + this.status = Optional.of(Collections.singletonList(status)); + return this; + } + + /** + *

Only cases opened for these reasons. Repeat the parameter to pass several.

+ */ + @JsonSetter(value = "reason", nulls = Nulls.SKIP) + public Builder reason(Optional> reason) { + this.reason = reason; + return this; + } + + public Builder reason(List reason) { + this.reason = Optional.ofNullable(reason); + return this; + } + + public Builder reason(ListResolutionCenterCasesRequestReasonItem reason) { + this.reason = Optional.of(Collections.singletonList(reason)); + return this; + } + + /** + *

Only closed cases that ended these ways. Repeat the parameter to pass several.

+ */ + @JsonSetter(value = "outcome", nulls = Nulls.SKIP) + public Builder outcome(Optional> outcome) { + this.outcome = outcome; + return this; + } + + public Builder outcome(List outcome) { + this.outcome = Optional.ofNullable(outcome); + return this; + } + + public Builder outcome(ListResolutionCenterCasesRequestOutcomeItem outcome) { + this.outcome = Optional.of(Collections.singletonList(outcome)); + return this; + } + + /** + *

Only cases filed against this account (biz_ tag). With read access to the account this lists its whole queue; without, only the cases you opened against it.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Only cases opened by this customer — a user_ tag, or me for the calling user. It narrows what you can already read, so me lists the cases you opened without the ones on accounts you are a team member of.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

The number of cases to return (default 20, max 100).

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor; returns cases after this position.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The number of cases to return from the end of the range.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

A cursor; returns cases before this position.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The field to sort cases by.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListResolutionCenterCasesRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListResolutionCenterCasesRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Only cases created before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only cases created after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + public ListResolutionCenterCasesRequest build() { + return new ListResolutionCenterCasesRequest( + status, + reason, + outcome, + accountId, + userId, + first, + after, + last, + before, + order, + direction, + createdBefore, + createdAfter, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/requests/ReplyResolutionCenterCasesRequest.java b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/ReplyResolutionCenterCasesRequest.java new file mode 100644 index 00000000..1ed65b1f --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/ReplyResolutionCenterCasesRequest.java @@ -0,0 +1,177 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.resolutioncentercases.types.ReplyResolutionCenterCasesRequestAttachmentsItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReplyResolutionCenterCasesRequest.Builder.class) +public final class ReplyResolutionCenterCasesRequest { + private final Optional> attachments; + + private final String message; + + private final Map additionalProperties; + + private ReplyResolutionCenterCasesRequest( + Optional> attachments, + String message, + Map additionalProperties) { + this.attachments = attachments; + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return Up to 3 evidence files, by existing file id or direct_upload_id. + */ + @JsonProperty("attachments") + public Optional> getAttachments() { + return attachments; + } + + /** + * @return The reply to add to the case. + */ + @JsonProperty("message") + public String getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReplyResolutionCenterCasesRequest && equalTo((ReplyResolutionCenterCasesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReplyResolutionCenterCasesRequest other) { + return attachments.equals(other.attachments) && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.attachments, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + /** + *

The reply to add to the case.

+ */ + _FinalStage message(@NotNull String message); + + Builder from(ReplyResolutionCenterCasesRequest other); + } + + public interface _FinalStage { + ReplyResolutionCenterCasesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Up to 3 evidence files, by existing file id or direct_upload_id.

+ */ + _FinalStage attachments(Optional> attachments); + + _FinalStage attachments(List attachments); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, _FinalStage { + private String message; + + private Optional> attachments = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReplyResolutionCenterCasesRequest other) { + attachments(other.getAttachments()); + message(other.getMessage()); + return this; + } + + /** + *

The reply to add to the case.

+ *

The reply to add to the case.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message") + public _FinalStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + /** + *

Up to 3 evidence files, by existing file id or direct_upload_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage attachments(List attachments) { + this.attachments = Optional.ofNullable(attachments); + return this; + } + + /** + *

Up to 3 evidence files, by existing file id or direct_upload_id.

+ */ + @java.lang.Override + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public _FinalStage attachments(Optional> attachments) { + this.attachments = attachments; + return this; + } + + @java.lang.Override + public ReplyResolutionCenterCasesRequest build() { + return new ReplyResolutionCenterCasesRequest(attachments, message, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/requests/RequestInfoResolutionCenterCasesRequest.java b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/RequestInfoResolutionCenterCasesRequest.java new file mode 100644 index 00000000..ff5db451 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/RequestInfoResolutionCenterCasesRequest.java @@ -0,0 +1,145 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.resolutioncentercases.types.RequestInfoResolutionCenterCasesRequestAttachmentsItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RequestInfoResolutionCenterCasesRequest.Builder.class) +public final class RequestInfoResolutionCenterCasesRequest { + private final Optional> attachments; + + private final Optional message; + + private final Map additionalProperties; + + private RequestInfoResolutionCenterCasesRequest( + Optional> attachments, + Optional message, + Map additionalProperties) { + this.attachments = attachments; + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return Up to 3 evidence files, by existing file id or direct_upload_id. + */ + @JsonProperty("attachments") + public Optional> getAttachments() { + return attachments; + } + + /** + * @return What you need from the customer. + */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestInfoResolutionCenterCasesRequest + && equalTo((RequestInfoResolutionCenterCasesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RequestInfoResolutionCenterCasesRequest other) { + return attachments.equals(other.attachments) && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.attachments, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> attachments = Optional.empty(); + + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RequestInfoResolutionCenterCasesRequest other) { + attachments(other.getAttachments()); + message(other.getMessage()); + return this; + } + + /** + *

Up to 3 evidence files, by existing file id or direct_upload_id.

+ */ + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public Builder attachments(Optional> attachments) { + this.attachments = attachments; + return this; + } + + public Builder attachments(List attachments) { + this.attachments = Optional.ofNullable(attachments); + return this; + } + + /** + *

What you need from the customer.

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public RequestInfoResolutionCenterCasesRequest build() { + return new RequestInfoResolutionCenterCasesRequest(attachments, message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/requests/RetrieveResolutionCenterCasesRequest.java b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/RetrieveResolutionCenterCasesRequest.java new file mode 100644 index 00000000..b47a4ea5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/RetrieveResolutionCenterCasesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveResolutionCenterCasesRequest.Builder.class) +public final class RetrieveResolutionCenterCasesRequest { + private final Map additionalProperties; + + private RetrieveResolutionCenterCasesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveResolutionCenterCasesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveResolutionCenterCasesRequest other) { + return this; + } + + public RetrieveResolutionCenterCasesRequest build() { + return new RetrieveResolutionCenterCasesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/requests/SummaryResolutionCenterCasesRequest.java b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/SummaryResolutionCenterCasesRequest.java new file mode 100644 index 00000000..e5443ad8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/SummaryResolutionCenterCasesRequest.java @@ -0,0 +1,367 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.resolutioncentercases.types.SummaryResolutionCenterCasesRequestGroupsItem; +import com.whop.api.resources.resolutioncentercases.types.SummaryResolutionCenterCasesRequestOutcomeItem; +import com.whop.api.resources.resolutioncentercases.types.SummaryResolutionCenterCasesRequestReasonItem; +import com.whop.api.resources.resolutioncentercases.types.SummaryResolutionCenterCasesRequestStatusItem; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SummaryResolutionCenterCasesRequest.Builder.class) +public final class SummaryResolutionCenterCasesRequest { + private final Optional> groups; + + private final Optional> status; + + private final Optional> reason; + + private final Optional> outcome; + + private final Optional accountId; + + private final Optional userId; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Map additionalProperties; + + private SummaryResolutionCenterCasesRequest( + Optional> groups, + Optional> status, + Optional> reason, + Optional> outcome, + Optional accountId, + Optional userId, + Optional createdBefore, + Optional createdAfter, + Map additionalProperties) { + this.groups = groups; + this.status = status; + this.reason = reason; + this.outcome = outcome; + this.accountId = accountId; + this.userId = userId; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.additionalProperties = additionalProperties; + } + + /** + * @return Which breakdowns to return, keyed by these names under groups. Repeat the parameter to ask for several; omit it for all of them. + */ + @JsonProperty("groups") + public Optional> getGroups() { + return groups; + } + + /** + * @return Only cases in these statuses. + */ + @JsonProperty("status") + public Optional> getStatus() { + return status; + } + + /** + * @return Only cases opened for these reasons. + */ + @JsonProperty("reason") + public Optional> getReason() { + return reason; + } + + /** + * @return Only closed cases that ended these ways. + */ + @JsonProperty("outcome") + public Optional> getOutcome() { + return outcome; + } + + /** + * @return The account to summarize cases for (biz_ tag). + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Only cases opened by this customer — a user_ tag, or me for the calling user. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + /** + * @return Only count cases created before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only count cases created after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SummaryResolutionCenterCasesRequest + && equalTo((SummaryResolutionCenterCasesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SummaryResolutionCenterCasesRequest other) { + return groups.equals(other.groups) + && status.equals(other.status) + && reason.equals(other.reason) + && outcome.equals(other.outcome) + && accountId.equals(other.accountId) + && userId.equals(other.userId) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.groups, + this.status, + this.reason, + this.outcome, + this.accountId, + this.userId, + this.createdBefore, + this.createdAfter); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> groups = Optional.empty(); + + private Optional> status = Optional.empty(); + + private Optional> reason = Optional.empty(); + + private Optional> outcome = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SummaryResolutionCenterCasesRequest other) { + groups(other.getGroups()); + status(other.getStatus()); + reason(other.getReason()); + outcome(other.getOutcome()); + accountId(other.getAccountId()); + userId(other.getUserId()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + return this; + } + + /** + *

Which breakdowns to return, keyed by these names under groups. Repeat the parameter to ask for several; omit it for all of them.

+ */ + @JsonSetter(value = "groups", nulls = Nulls.SKIP) + public Builder groups(Optional> groups) { + this.groups = groups; + return this; + } + + public Builder groups(List groups) { + this.groups = Optional.ofNullable(groups); + return this; + } + + public Builder groups(SummaryResolutionCenterCasesRequestGroupsItem groups) { + this.groups = Optional.of(Collections.singletonList(groups)); + return this; + } + + /** + *

Only cases in these statuses.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional> status) { + this.status = status; + return this; + } + + public Builder status(List status) { + this.status = Optional.ofNullable(status); + return this; + } + + public Builder status(SummaryResolutionCenterCasesRequestStatusItem status) { + this.status = Optional.of(Collections.singletonList(status)); + return this; + } + + /** + *

Only cases opened for these reasons.

+ */ + @JsonSetter(value = "reason", nulls = Nulls.SKIP) + public Builder reason(Optional> reason) { + this.reason = reason; + return this; + } + + public Builder reason(List reason) { + this.reason = Optional.ofNullable(reason); + return this; + } + + public Builder reason(SummaryResolutionCenterCasesRequestReasonItem reason) { + this.reason = Optional.of(Collections.singletonList(reason)); + return this; + } + + /** + *

Only closed cases that ended these ways.

+ */ + @JsonSetter(value = "outcome", nulls = Nulls.SKIP) + public Builder outcome(Optional> outcome) { + this.outcome = outcome; + return this; + } + + public Builder outcome(List outcome) { + this.outcome = Optional.ofNullable(outcome); + return this; + } + + public Builder outcome(SummaryResolutionCenterCasesRequestOutcomeItem outcome) { + this.outcome = Optional.of(Collections.singletonList(outcome)); + return this; + } + + /** + *

The account to summarize cases for (biz_ tag).

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Only cases opened by this customer — a user_ tag, or me for the calling user.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Only count cases created before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only count cases created after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + public SummaryResolutionCenterCasesRequest build() { + return new SummaryResolutionCenterCasesRequest( + groups, + status, + reason, + outcome, + accountId, + userId, + createdBefore, + createdAfter, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/requests/WithdrawResolutionCenterCasesRequest.java b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/WithdrawResolutionCenterCasesRequest.java new file mode 100644 index 00000000..654b4714 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/requests/WithdrawResolutionCenterCasesRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = WithdrawResolutionCenterCasesRequest.Builder.class) +public final class WithdrawResolutionCenterCasesRequest { + private final Map additionalProperties; + + private WithdrawResolutionCenterCasesRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WithdrawResolutionCenterCasesRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(WithdrawResolutionCenterCasesRequest other) { + return this; + } + + public WithdrawResolutionCenterCasesRequest build() { + return new WithdrawResolutionCenterCasesRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/AcceptResolutionCenterCasesRequestAttachmentsItem.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/AcceptResolutionCenterCasesRequestAttachmentsItem.java new file mode 100644 index 00000000..eab4e9cc --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/AcceptResolutionCenterCasesRequestAttachmentsItem.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AcceptResolutionCenterCasesRequestAttachmentsItem.Builder.class) +public final class AcceptResolutionCenterCasesRequestAttachmentsItem { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private AcceptResolutionCenterCasesRequestAttachmentsItem( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AcceptResolutionCenterCasesRequestAttachmentsItem + && equalTo((AcceptResolutionCenterCasesRequestAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AcceptResolutionCenterCasesRequestAttachmentsItem other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AcceptResolutionCenterCasesRequestAttachmentsItem other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public AcceptResolutionCenterCasesRequestAttachmentsItem build() { + return new AcceptResolutionCenterCasesRequestAttachmentsItem(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/AppealResolutionCenterCasesRequestAttachmentsItem.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/AppealResolutionCenterCasesRequestAttachmentsItem.java new file mode 100644 index 00000000..cfad7850 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/AppealResolutionCenterCasesRequestAttachmentsItem.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppealResolutionCenterCasesRequestAttachmentsItem.Builder.class) +public final class AppealResolutionCenterCasesRequestAttachmentsItem { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private AppealResolutionCenterCasesRequestAttachmentsItem( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppealResolutionCenterCasesRequestAttachmentsItem + && equalTo((AppealResolutionCenterCasesRequestAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppealResolutionCenterCasesRequestAttachmentsItem other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AppealResolutionCenterCasesRequestAttachmentsItem other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public AppealResolutionCenterCasesRequestAttachmentsItem build() { + return new AppealResolutionCenterCasesRequestAttachmentsItem(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/CreateResolutionCenterCasesRequestAttachmentsItem.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/CreateResolutionCenterCasesRequestAttachmentsItem.java new file mode 100644 index 00000000..28917502 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/CreateResolutionCenterCasesRequestAttachmentsItem.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateResolutionCenterCasesRequestAttachmentsItem.Builder.class) +public final class CreateResolutionCenterCasesRequestAttachmentsItem { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private CreateResolutionCenterCasesRequestAttachmentsItem( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateResolutionCenterCasesRequestAttachmentsItem + && equalTo((CreateResolutionCenterCasesRequestAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateResolutionCenterCasesRequestAttachmentsItem other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateResolutionCenterCasesRequestAttachmentsItem other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public CreateResolutionCenterCasesRequestAttachmentsItem build() { + return new CreateResolutionCenterCasesRequestAttachmentsItem(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/CreateResolutionCenterCasesRequestReason.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/CreateResolutionCenterCasesRequestReason.java new file mode 100644 index 00000000..42d6aef2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/CreateResolutionCenterCasesRequestReason.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateResolutionCenterCasesRequestReason { + public static final CreateResolutionCenterCasesRequestReason FRAUDULENT = + new CreateResolutionCenterCasesRequestReason(Value.FRAUDULENT, "fraudulent"); + + public static final CreateResolutionCenterCasesRequestReason PRODUCT_UNACCEPTABLE = + new CreateResolutionCenterCasesRequestReason(Value.PRODUCT_UNACCEPTABLE, "product_unacceptable"); + + public static final CreateResolutionCenterCasesRequestReason NOT_AS_DESCRIBED = + new CreateResolutionCenterCasesRequestReason(Value.NOT_AS_DESCRIBED, "not_as_described"); + + public static final CreateResolutionCenterCasesRequestReason PRODUCT_NOT_RECEIVED = + new CreateResolutionCenterCasesRequestReason(Value.PRODUCT_NOT_RECEIVED, "product_not_received"); + + public static final CreateResolutionCenterCasesRequestReason SUBSCRIPTION_CANCELED = + new CreateResolutionCenterCasesRequestReason(Value.SUBSCRIPTION_CANCELED, "subscription_canceled"); + + private final Value value; + + private final String string; + + CreateResolutionCenterCasesRequestReason(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateResolutionCenterCasesRequestReason + && this.string.equals(((CreateResolutionCenterCasesRequestReason) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FRAUDULENT: + return visitor.visitFraudulent(); + case PRODUCT_UNACCEPTABLE: + return visitor.visitProductUnacceptable(); + case NOT_AS_DESCRIBED: + return visitor.visitNotAsDescribed(); + case PRODUCT_NOT_RECEIVED: + return visitor.visitProductNotReceived(); + case SUBSCRIPTION_CANCELED: + return visitor.visitSubscriptionCanceled(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateResolutionCenterCasesRequestReason valueOf(String value) { + switch (value) { + case "fraudulent": + return FRAUDULENT; + case "product_unacceptable": + return PRODUCT_UNACCEPTABLE; + case "not_as_described": + return NOT_AS_DESCRIBED; + case "product_not_received": + return PRODUCT_NOT_RECEIVED; + case "subscription_canceled": + return SUBSCRIPTION_CANCELED; + default: + return new CreateResolutionCenterCasesRequestReason(Value.UNKNOWN, value); + } + } + + public enum Value { + FRAUDULENT, + + PRODUCT_NOT_RECEIVED, + + NOT_AS_DESCRIBED, + + PRODUCT_UNACCEPTABLE, + + SUBSCRIPTION_CANCELED, + + UNKNOWN + } + + public interface Visitor { + T visitFraudulent(); + + T visitProductNotReceived(); + + T visitNotAsDescribed(); + + T visitProductUnacceptable(); + + T visitSubscriptionCanceled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/DenyResolutionCenterCasesRequestAttachmentsItem.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/DenyResolutionCenterCasesRequestAttachmentsItem.java new file mode 100644 index 00000000..1ba2a799 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/DenyResolutionCenterCasesRequestAttachmentsItem.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DenyResolutionCenterCasesRequestAttachmentsItem.Builder.class) +public final class DenyResolutionCenterCasesRequestAttachmentsItem { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private DenyResolutionCenterCasesRequestAttachmentsItem( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DenyResolutionCenterCasesRequestAttachmentsItem + && equalTo((DenyResolutionCenterCasesRequestAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DenyResolutionCenterCasesRequestAttachmentsItem other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DenyResolutionCenterCasesRequestAttachmentsItem other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public DenyResolutionCenterCasesRequestAttachmentsItem build() { + return new DenyResolutionCenterCasesRequestAttachmentsItem(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/EventsResolutionCenterCasesResponse.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/EventsResolutionCenterCasesResponse.java new file mode 100644 index 00000000..e0688fe5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/EventsResolutionCenterCasesResponse.java @@ -0,0 +1,167 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.ResolutionEvent; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EventsResolutionCenterCasesResponse.Builder.class) +public final class EventsResolutionCenterCasesResponse { + private final List data; + + private final EventsResolutionCenterCasesResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private EventsResolutionCenterCasesResponse( + List data, + EventsResolutionCenterCasesResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public EventsResolutionCenterCasesResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EventsResolutionCenterCasesResponse + && equalTo((EventsResolutionCenterCasesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EventsResolutionCenterCasesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull EventsResolutionCenterCasesResponsePageInfo pageInfo); + + Builder from(EventsResolutionCenterCasesResponse other); + } + + public interface _FinalStage { + EventsResolutionCenterCasesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ResolutionEvent data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private EventsResolutionCenterCasesResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EventsResolutionCenterCasesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull EventsResolutionCenterCasesResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ResolutionEvent data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public EventsResolutionCenterCasesResponse build() { + return new EventsResolutionCenterCasesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/EventsResolutionCenterCasesResponsePageInfo.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/EventsResolutionCenterCasesResponsePageInfo.java new file mode 100644 index 00000000..3d669c96 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/EventsResolutionCenterCasesResponsePageInfo.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EventsResolutionCenterCasesResponsePageInfo.Builder.class) +public final class EventsResolutionCenterCasesResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private EventsResolutionCenterCasesResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EventsResolutionCenterCasesResponsePageInfo + && equalTo((EventsResolutionCenterCasesResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EventsResolutionCenterCasesResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(EventsResolutionCenterCasesResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + EventsResolutionCenterCasesResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EventsResolutionCenterCasesResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public EventsResolutionCenterCasesResponsePageInfo build() { + return new EventsResolutionCenterCasesResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesRequestDirection.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesRequestDirection.java new file mode 100644 index 00000000..6d9941b0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesRequestDirection.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListResolutionCenterCasesRequestDirection { + public static final ListResolutionCenterCasesRequestDirection ASC = + new ListResolutionCenterCasesRequestDirection(Value.ASC, "asc"); + + public static final ListResolutionCenterCasesRequestDirection DESC = + new ListResolutionCenterCasesRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListResolutionCenterCasesRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListResolutionCenterCasesRequestDirection + && this.string.equals(((ListResolutionCenterCasesRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListResolutionCenterCasesRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListResolutionCenterCasesRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesRequestOrder.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesRequestOrder.java new file mode 100644 index 00000000..1049cab7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesRequestOrder.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListResolutionCenterCasesRequestOrder { + public static final ListResolutionCenterCasesRequestOrder RESPONSE_DUE_AT = + new ListResolutionCenterCasesRequestOrder(Value.RESPONSE_DUE_AT, "response_due_at"); + + public static final ListResolutionCenterCasesRequestOrder CREATED_AT = + new ListResolutionCenterCasesRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListResolutionCenterCasesRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListResolutionCenterCasesRequestOrder + && this.string.equals(((ListResolutionCenterCasesRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RESPONSE_DUE_AT: + return visitor.visitResponseDueAt(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListResolutionCenterCasesRequestOrder valueOf(String value) { + switch (value) { + case "response_due_at": + return RESPONSE_DUE_AT; + case "created_at": + return CREATED_AT; + default: + return new ListResolutionCenterCasesRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + RESPONSE_DUE_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitResponseDueAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesRequestOutcomeItem.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesRequestOutcomeItem.java new file mode 100644 index 00000000..7249f706 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesRequestOutcomeItem.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListResolutionCenterCasesRequestOutcomeItem { + public static final ListResolutionCenterCasesRequestOutcomeItem MERCHANT_WON = + new ListResolutionCenterCasesRequestOutcomeItem(Value.MERCHANT_WON, "merchant_won"); + + public static final ListResolutionCenterCasesRequestOutcomeItem CUSTOMER_WON = + new ListResolutionCenterCasesRequestOutcomeItem(Value.CUSTOMER_WON, "customer_won"); + + public static final ListResolutionCenterCasesRequestOutcomeItem WITHDRAWN = + new ListResolutionCenterCasesRequestOutcomeItem(Value.WITHDRAWN, "withdrawn"); + + private final Value value; + + private final String string; + + ListResolutionCenterCasesRequestOutcomeItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListResolutionCenterCasesRequestOutcomeItem + && this.string.equals(((ListResolutionCenterCasesRequestOutcomeItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MERCHANT_WON: + return visitor.visitMerchantWon(); + case CUSTOMER_WON: + return visitor.visitCustomerWon(); + case WITHDRAWN: + return visitor.visitWithdrawn(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListResolutionCenterCasesRequestOutcomeItem valueOf(String value) { + switch (value) { + case "merchant_won": + return MERCHANT_WON; + case "customer_won": + return CUSTOMER_WON; + case "withdrawn": + return WITHDRAWN; + default: + return new ListResolutionCenterCasesRequestOutcomeItem(Value.UNKNOWN, value); + } + } + + public enum Value { + CUSTOMER_WON, + + MERCHANT_WON, + + WITHDRAWN, + + UNKNOWN + } + + public interface Visitor { + T visitCustomerWon(); + + T visitMerchantWon(); + + T visitWithdrawn(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesRequestReasonItem.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesRequestReasonItem.java new file mode 100644 index 00000000..3f4efaa8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesRequestReasonItem.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListResolutionCenterCasesRequestReasonItem { + public static final ListResolutionCenterCasesRequestReasonItem FRAUDULENT = + new ListResolutionCenterCasesRequestReasonItem(Value.FRAUDULENT, "fraudulent"); + + public static final ListResolutionCenterCasesRequestReasonItem PRODUCT_UNACCEPTABLE = + new ListResolutionCenterCasesRequestReasonItem(Value.PRODUCT_UNACCEPTABLE, "product_unacceptable"); + + public static final ListResolutionCenterCasesRequestReasonItem NOT_AS_DESCRIBED = + new ListResolutionCenterCasesRequestReasonItem(Value.NOT_AS_DESCRIBED, "not_as_described"); + + public static final ListResolutionCenterCasesRequestReasonItem PRODUCT_NOT_RECEIVED = + new ListResolutionCenterCasesRequestReasonItem(Value.PRODUCT_NOT_RECEIVED, "product_not_received"); + + public static final ListResolutionCenterCasesRequestReasonItem SUBSCRIPTION_CANCELED = + new ListResolutionCenterCasesRequestReasonItem(Value.SUBSCRIPTION_CANCELED, "subscription_canceled"); + + private final Value value; + + private final String string; + + ListResolutionCenterCasesRequestReasonItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListResolutionCenterCasesRequestReasonItem + && this.string.equals(((ListResolutionCenterCasesRequestReasonItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FRAUDULENT: + return visitor.visitFraudulent(); + case PRODUCT_UNACCEPTABLE: + return visitor.visitProductUnacceptable(); + case NOT_AS_DESCRIBED: + return visitor.visitNotAsDescribed(); + case PRODUCT_NOT_RECEIVED: + return visitor.visitProductNotReceived(); + case SUBSCRIPTION_CANCELED: + return visitor.visitSubscriptionCanceled(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListResolutionCenterCasesRequestReasonItem valueOf(String value) { + switch (value) { + case "fraudulent": + return FRAUDULENT; + case "product_unacceptable": + return PRODUCT_UNACCEPTABLE; + case "not_as_described": + return NOT_AS_DESCRIBED; + case "product_not_received": + return PRODUCT_NOT_RECEIVED; + case "subscription_canceled": + return SUBSCRIPTION_CANCELED; + default: + return new ListResolutionCenterCasesRequestReasonItem(Value.UNKNOWN, value); + } + } + + public enum Value { + FRAUDULENT, + + PRODUCT_NOT_RECEIVED, + + NOT_AS_DESCRIBED, + + PRODUCT_UNACCEPTABLE, + + SUBSCRIPTION_CANCELED, + + UNKNOWN + } + + public interface Visitor { + T visitFraudulent(); + + T visitProductNotReceived(); + + T visitNotAsDescribed(); + + T visitProductUnacceptable(); + + T visitSubscriptionCanceled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesRequestStatusItem.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesRequestStatusItem.java new file mode 100644 index 00000000..a51076d7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesRequestStatusItem.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListResolutionCenterCasesRequestStatusItem { + public static final ListResolutionCenterCasesRequestStatusItem AWAITING_CUSTOMER = + new ListResolutionCenterCasesRequestStatusItem(Value.AWAITING_CUSTOMER, "awaiting_customer"); + + public static final ListResolutionCenterCasesRequestStatusItem CLOSED = + new ListResolutionCenterCasesRequestStatusItem(Value.CLOSED, "closed"); + + public static final ListResolutionCenterCasesRequestStatusItem UNDER_REVIEW = + new ListResolutionCenterCasesRequestStatusItem(Value.UNDER_REVIEW, "under_review"); + + public static final ListResolutionCenterCasesRequestStatusItem AWAITING_MERCHANT = + new ListResolutionCenterCasesRequestStatusItem(Value.AWAITING_MERCHANT, "awaiting_merchant"); + + private final Value value; + + private final String string; + + ListResolutionCenterCasesRequestStatusItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListResolutionCenterCasesRequestStatusItem + && this.string.equals(((ListResolutionCenterCasesRequestStatusItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AWAITING_CUSTOMER: + return visitor.visitAwaitingCustomer(); + case CLOSED: + return visitor.visitClosed(); + case UNDER_REVIEW: + return visitor.visitUnderReview(); + case AWAITING_MERCHANT: + return visitor.visitAwaitingMerchant(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListResolutionCenterCasesRequestStatusItem valueOf(String value) { + switch (value) { + case "awaiting_customer": + return AWAITING_CUSTOMER; + case "closed": + return CLOSED; + case "under_review": + return UNDER_REVIEW; + case "awaiting_merchant": + return AWAITING_MERCHANT; + default: + return new ListResolutionCenterCasesRequestStatusItem(Value.UNKNOWN, value); + } + } + + public enum Value { + AWAITING_MERCHANT, + + AWAITING_CUSTOMER, + + UNDER_REVIEW, + + CLOSED, + + UNKNOWN + } + + public interface Visitor { + T visitAwaitingMerchant(); + + T visitAwaitingCustomer(); + + T visitUnderReview(); + + T visitClosed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesResponse.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesResponse.java new file mode 100644 index 00000000..06d2760b --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.ResolutionCenterCase; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListResolutionCenterCasesResponse.Builder.class) +public final class ListResolutionCenterCasesResponse { + private final List data; + + private final ListResolutionCenterCasesResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListResolutionCenterCasesResponse( + List data, + ListResolutionCenterCasesResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListResolutionCenterCasesResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListResolutionCenterCasesResponse && equalTo((ListResolutionCenterCasesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListResolutionCenterCasesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListResolutionCenterCasesResponsePageInfo pageInfo); + + Builder from(ListResolutionCenterCasesResponse other); + } + + public interface _FinalStage { + ListResolutionCenterCasesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ResolutionCenterCase data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListResolutionCenterCasesResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListResolutionCenterCasesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListResolutionCenterCasesResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ResolutionCenterCase data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListResolutionCenterCasesResponse build() { + return new ListResolutionCenterCasesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesResponsePageInfo.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesResponsePageInfo.java new file mode 100644 index 00000000..43fb1401 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ListResolutionCenterCasesResponsePageInfo.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListResolutionCenterCasesResponsePageInfo.Builder.class) +public final class ListResolutionCenterCasesResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListResolutionCenterCasesResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListResolutionCenterCasesResponsePageInfo + && equalTo((ListResolutionCenterCasesResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListResolutionCenterCasesResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListResolutionCenterCasesResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListResolutionCenterCasesResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListResolutionCenterCasesResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListResolutionCenterCasesResponsePageInfo build() { + return new ListResolutionCenterCasesResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseCreatedPayload.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseCreatedPayload.java new file mode 100644 index 00000000..557e81e3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseCreatedPayload.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.ResolutionCenterCase; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostResolutionCenterCaseCreatedPayload.Builder.class) +public final class PostResolutionCenterCaseCreatedPayload { + private final Optional accountId; + + private final PostResolutionCenterCaseCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final ResolutionCenterCase data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostResolutionCenterCaseCreatedPayloadType type; + + private final Map additionalProperties; + + private PostResolutionCenterCaseCreatedPayload( + Optional accountId, + PostResolutionCenterCaseCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + ResolutionCenterCase data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostResolutionCenterCaseCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostResolutionCenterCaseCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public ResolutionCenterCase getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostResolutionCenterCaseCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostResolutionCenterCaseCreatedPayload + && equalTo((PostResolutionCenterCaseCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostResolutionCenterCaseCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostResolutionCenterCaseCreatedPayloadApiVersion apiVersion); + + Builder from(PostResolutionCenterCaseCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull ResolutionCenterCase data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostResolutionCenterCaseCreatedPayloadType type); + } + + public interface _FinalStage { + PostResolutionCenterCaseCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostResolutionCenterCaseCreatedPayloadApiVersion apiVersion; + + private ResolutionCenterCase data; + + private String id; + + private OffsetDateTime timestamp; + + private PostResolutionCenterCaseCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostResolutionCenterCaseCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostResolutionCenterCaseCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull ResolutionCenterCase data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostResolutionCenterCaseCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostResolutionCenterCaseCreatedPayload build() { + return new PostResolutionCenterCaseCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseCreatedPayloadApiVersion.java new file mode 100644 index 00000000..a42e0d85 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseCreatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostResolutionCenterCaseCreatedPayloadApiVersion { + public static final PostResolutionCenterCaseCreatedPayloadApiVersion V1 = + new PostResolutionCenterCaseCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostResolutionCenterCaseCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostResolutionCenterCaseCreatedPayloadApiVersion + && this.string.equals(((PostResolutionCenterCaseCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostResolutionCenterCaseCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostResolutionCenterCaseCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseCreatedPayloadType.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseCreatedPayloadType.java new file mode 100644 index 00000000..8563d0f2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseCreatedPayloadType.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostResolutionCenterCaseCreatedPayloadType { + public static final PostResolutionCenterCaseCreatedPayloadType RESOLUTION_CENTER_CASE_CREATED = + new PostResolutionCenterCaseCreatedPayloadType( + Value.RESOLUTION_CENTER_CASE_CREATED, "resolution_center_case.created"); + + private final Value value; + + private final String string; + + PostResolutionCenterCaseCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostResolutionCenterCaseCreatedPayloadType + && this.string.equals(((PostResolutionCenterCaseCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RESOLUTION_CENTER_CASE_CREATED: + return visitor.visitResolutionCenterCaseCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostResolutionCenterCaseCreatedPayloadType valueOf(String value) { + switch (value) { + case "resolution_center_case.created": + return RESOLUTION_CENTER_CASE_CREATED; + default: + return new PostResolutionCenterCaseCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + RESOLUTION_CENTER_CASE_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitResolutionCenterCaseCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseDecidedPayload.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseDecidedPayload.java new file mode 100644 index 00000000..b064eec6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseDecidedPayload.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.ResolutionCenterCase; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostResolutionCenterCaseDecidedPayload.Builder.class) +public final class PostResolutionCenterCaseDecidedPayload { + private final Optional accountId; + + private final PostResolutionCenterCaseDecidedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final ResolutionCenterCase data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostResolutionCenterCaseDecidedPayloadType type; + + private final Map additionalProperties; + + private PostResolutionCenterCaseDecidedPayload( + Optional accountId, + PostResolutionCenterCaseDecidedPayloadApiVersion apiVersion, + Optional apiVersionDate, + ResolutionCenterCase data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostResolutionCenterCaseDecidedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostResolutionCenterCaseDecidedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public ResolutionCenterCase getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostResolutionCenterCaseDecidedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostResolutionCenterCaseDecidedPayload + && equalTo((PostResolutionCenterCaseDecidedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostResolutionCenterCaseDecidedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostResolutionCenterCaseDecidedPayloadApiVersion apiVersion); + + Builder from(PostResolutionCenterCaseDecidedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull ResolutionCenterCase data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostResolutionCenterCaseDecidedPayloadType type); + } + + public interface _FinalStage { + PostResolutionCenterCaseDecidedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostResolutionCenterCaseDecidedPayloadApiVersion apiVersion; + + private ResolutionCenterCase data; + + private String id; + + private OffsetDateTime timestamp; + + private PostResolutionCenterCaseDecidedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostResolutionCenterCaseDecidedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostResolutionCenterCaseDecidedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull ResolutionCenterCase data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostResolutionCenterCaseDecidedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostResolutionCenterCaseDecidedPayload build() { + return new PostResolutionCenterCaseDecidedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseDecidedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseDecidedPayloadApiVersion.java new file mode 100644 index 00000000..45b622cf --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseDecidedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostResolutionCenterCaseDecidedPayloadApiVersion { + public static final PostResolutionCenterCaseDecidedPayloadApiVersion V1 = + new PostResolutionCenterCaseDecidedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostResolutionCenterCaseDecidedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostResolutionCenterCaseDecidedPayloadApiVersion + && this.string.equals(((PostResolutionCenterCaseDecidedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostResolutionCenterCaseDecidedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostResolutionCenterCaseDecidedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseDecidedPayloadType.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseDecidedPayloadType.java new file mode 100644 index 00000000..c2830c68 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseDecidedPayloadType.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostResolutionCenterCaseDecidedPayloadType { + public static final PostResolutionCenterCaseDecidedPayloadType RESOLUTION_CENTER_CASE_DECIDED = + new PostResolutionCenterCaseDecidedPayloadType( + Value.RESOLUTION_CENTER_CASE_DECIDED, "resolution_center_case.decided"); + + private final Value value; + + private final String string; + + PostResolutionCenterCaseDecidedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostResolutionCenterCaseDecidedPayloadType + && this.string.equals(((PostResolutionCenterCaseDecidedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RESOLUTION_CENTER_CASE_DECIDED: + return visitor.visitResolutionCenterCaseDecided(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostResolutionCenterCaseDecidedPayloadType valueOf(String value) { + switch (value) { + case "resolution_center_case.decided": + return RESOLUTION_CENTER_CASE_DECIDED; + default: + return new PostResolutionCenterCaseDecidedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + RESOLUTION_CENTER_CASE_DECIDED, + + UNKNOWN + } + + public interface Visitor { + T visitResolutionCenterCaseDecided(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseUpdatedPayload.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseUpdatedPayload.java new file mode 100644 index 00000000..9e58ac44 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseUpdatedPayload.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.ResolutionCenterCase; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostResolutionCenterCaseUpdatedPayload.Builder.class) +public final class PostResolutionCenterCaseUpdatedPayload { + private final Optional accountId; + + private final PostResolutionCenterCaseUpdatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final ResolutionCenterCase data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostResolutionCenterCaseUpdatedPayloadType type; + + private final Map additionalProperties; + + private PostResolutionCenterCaseUpdatedPayload( + Optional accountId, + PostResolutionCenterCaseUpdatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + ResolutionCenterCase data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostResolutionCenterCaseUpdatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostResolutionCenterCaseUpdatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public ResolutionCenterCase getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostResolutionCenterCaseUpdatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostResolutionCenterCaseUpdatedPayload + && equalTo((PostResolutionCenterCaseUpdatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostResolutionCenterCaseUpdatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostResolutionCenterCaseUpdatedPayloadApiVersion apiVersion); + + Builder from(PostResolutionCenterCaseUpdatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull ResolutionCenterCase data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostResolutionCenterCaseUpdatedPayloadType type); + } + + public interface _FinalStage { + PostResolutionCenterCaseUpdatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostResolutionCenterCaseUpdatedPayloadApiVersion apiVersion; + + private ResolutionCenterCase data; + + private String id; + + private OffsetDateTime timestamp; + + private PostResolutionCenterCaseUpdatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostResolutionCenterCaseUpdatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostResolutionCenterCaseUpdatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull ResolutionCenterCase data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostResolutionCenterCaseUpdatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostResolutionCenterCaseUpdatedPayload build() { + return new PostResolutionCenterCaseUpdatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseUpdatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseUpdatedPayloadApiVersion.java new file mode 100644 index 00000000..2da67cc1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseUpdatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostResolutionCenterCaseUpdatedPayloadApiVersion { + public static final PostResolutionCenterCaseUpdatedPayloadApiVersion V1 = + new PostResolutionCenterCaseUpdatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostResolutionCenterCaseUpdatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostResolutionCenterCaseUpdatedPayloadApiVersion + && this.string.equals(((PostResolutionCenterCaseUpdatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostResolutionCenterCaseUpdatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostResolutionCenterCaseUpdatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseUpdatedPayloadType.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseUpdatedPayloadType.java new file mode 100644 index 00000000..37ccd27d --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/PostResolutionCenterCaseUpdatedPayloadType.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostResolutionCenterCaseUpdatedPayloadType { + public static final PostResolutionCenterCaseUpdatedPayloadType RESOLUTION_CENTER_CASE_UPDATED = + new PostResolutionCenterCaseUpdatedPayloadType( + Value.RESOLUTION_CENTER_CASE_UPDATED, "resolution_center_case.updated"); + + private final Value value; + + private final String string; + + PostResolutionCenterCaseUpdatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostResolutionCenterCaseUpdatedPayloadType + && this.string.equals(((PostResolutionCenterCaseUpdatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RESOLUTION_CENTER_CASE_UPDATED: + return visitor.visitResolutionCenterCaseUpdated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostResolutionCenterCaseUpdatedPayloadType valueOf(String value) { + switch (value) { + case "resolution_center_case.updated": + return RESOLUTION_CENTER_CASE_UPDATED; + default: + return new PostResolutionCenterCaseUpdatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + RESOLUTION_CENTER_CASE_UPDATED, + + UNKNOWN + } + + public interface Visitor { + T visitResolutionCenterCaseUpdated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/ReplyResolutionCenterCasesRequestAttachmentsItem.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ReplyResolutionCenterCasesRequestAttachmentsItem.java new file mode 100644 index 00000000..7364989a --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/ReplyResolutionCenterCasesRequestAttachmentsItem.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReplyResolutionCenterCasesRequestAttachmentsItem.Builder.class) +public final class ReplyResolutionCenterCasesRequestAttachmentsItem { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private ReplyResolutionCenterCasesRequestAttachmentsItem( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReplyResolutionCenterCasesRequestAttachmentsItem + && equalTo((ReplyResolutionCenterCasesRequestAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReplyResolutionCenterCasesRequestAttachmentsItem other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReplyResolutionCenterCasesRequestAttachmentsItem other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public ReplyResolutionCenterCasesRequestAttachmentsItem build() { + return new ReplyResolutionCenterCasesRequestAttachmentsItem(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/RequestInfoResolutionCenterCasesRequestAttachmentsItem.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/RequestInfoResolutionCenterCasesRequestAttachmentsItem.java new file mode 100644 index 00000000..6277dd3e --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/RequestInfoResolutionCenterCasesRequestAttachmentsItem.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RequestInfoResolutionCenterCasesRequestAttachmentsItem.Builder.class) +public final class RequestInfoResolutionCenterCasesRequestAttachmentsItem { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private RequestInfoResolutionCenterCasesRequestAttachmentsItem( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestInfoResolutionCenterCasesRequestAttachmentsItem + && equalTo((RequestInfoResolutionCenterCasesRequestAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RequestInfoResolutionCenterCasesRequestAttachmentsItem other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RequestInfoResolutionCenterCasesRequestAttachmentsItem other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public RequestInfoResolutionCenterCasesRequestAttachmentsItem build() { + return new RequestInfoResolutionCenterCasesRequestAttachmentsItem(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesRequestGroupsItem.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesRequestGroupsItem.java new file mode 100644 index 00000000..6b2ce62c --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesRequestGroupsItem.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SummaryResolutionCenterCasesRequestGroupsItem { + public static final SummaryResolutionCenterCasesRequestGroupsItem OUTCOME = + new SummaryResolutionCenterCasesRequestGroupsItem(Value.OUTCOME, "outcome"); + + public static final SummaryResolutionCenterCasesRequestGroupsItem STATUS = + new SummaryResolutionCenterCasesRequestGroupsItem(Value.STATUS, "status"); + + public static final SummaryResolutionCenterCasesRequestGroupsItem REASON = + new SummaryResolutionCenterCasesRequestGroupsItem(Value.REASON, "reason"); + + private final Value value; + + private final String string; + + SummaryResolutionCenterCasesRequestGroupsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SummaryResolutionCenterCasesRequestGroupsItem + && this.string.equals(((SummaryResolutionCenterCasesRequestGroupsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case OUTCOME: + return visitor.visitOutcome(); + case STATUS: + return visitor.visitStatus(); + case REASON: + return visitor.visitReason(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SummaryResolutionCenterCasesRequestGroupsItem valueOf(String value) { + switch (value) { + case "outcome": + return OUTCOME; + case "status": + return STATUS; + case "reason": + return REASON; + default: + return new SummaryResolutionCenterCasesRequestGroupsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + STATUS, + + REASON, + + OUTCOME, + + UNKNOWN + } + + public interface Visitor { + T visitStatus(); + + T visitReason(); + + T visitOutcome(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesRequestOutcomeItem.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesRequestOutcomeItem.java new file mode 100644 index 00000000..4ee22620 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesRequestOutcomeItem.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SummaryResolutionCenterCasesRequestOutcomeItem { + public static final SummaryResolutionCenterCasesRequestOutcomeItem MERCHANT_WON = + new SummaryResolutionCenterCasesRequestOutcomeItem(Value.MERCHANT_WON, "merchant_won"); + + public static final SummaryResolutionCenterCasesRequestOutcomeItem CUSTOMER_WON = + new SummaryResolutionCenterCasesRequestOutcomeItem(Value.CUSTOMER_WON, "customer_won"); + + public static final SummaryResolutionCenterCasesRequestOutcomeItem WITHDRAWN = + new SummaryResolutionCenterCasesRequestOutcomeItem(Value.WITHDRAWN, "withdrawn"); + + private final Value value; + + private final String string; + + SummaryResolutionCenterCasesRequestOutcomeItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SummaryResolutionCenterCasesRequestOutcomeItem + && this.string.equals(((SummaryResolutionCenterCasesRequestOutcomeItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MERCHANT_WON: + return visitor.visitMerchantWon(); + case CUSTOMER_WON: + return visitor.visitCustomerWon(); + case WITHDRAWN: + return visitor.visitWithdrawn(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SummaryResolutionCenterCasesRequestOutcomeItem valueOf(String value) { + switch (value) { + case "merchant_won": + return MERCHANT_WON; + case "customer_won": + return CUSTOMER_WON; + case "withdrawn": + return WITHDRAWN; + default: + return new SummaryResolutionCenterCasesRequestOutcomeItem(Value.UNKNOWN, value); + } + } + + public enum Value { + CUSTOMER_WON, + + MERCHANT_WON, + + WITHDRAWN, + + UNKNOWN + } + + public interface Visitor { + T visitCustomerWon(); + + T visitMerchantWon(); + + T visitWithdrawn(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesRequestReasonItem.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesRequestReasonItem.java new file mode 100644 index 00000000..7f618597 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesRequestReasonItem.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SummaryResolutionCenterCasesRequestReasonItem { + public static final SummaryResolutionCenterCasesRequestReasonItem FRAUDULENT = + new SummaryResolutionCenterCasesRequestReasonItem(Value.FRAUDULENT, "fraudulent"); + + public static final SummaryResolutionCenterCasesRequestReasonItem PRODUCT_UNACCEPTABLE = + new SummaryResolutionCenterCasesRequestReasonItem(Value.PRODUCT_UNACCEPTABLE, "product_unacceptable"); + + public static final SummaryResolutionCenterCasesRequestReasonItem NOT_AS_DESCRIBED = + new SummaryResolutionCenterCasesRequestReasonItem(Value.NOT_AS_DESCRIBED, "not_as_described"); + + public static final SummaryResolutionCenterCasesRequestReasonItem PRODUCT_NOT_RECEIVED = + new SummaryResolutionCenterCasesRequestReasonItem(Value.PRODUCT_NOT_RECEIVED, "product_not_received"); + + public static final SummaryResolutionCenterCasesRequestReasonItem SUBSCRIPTION_CANCELED = + new SummaryResolutionCenterCasesRequestReasonItem(Value.SUBSCRIPTION_CANCELED, "subscription_canceled"); + + private final Value value; + + private final String string; + + SummaryResolutionCenterCasesRequestReasonItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SummaryResolutionCenterCasesRequestReasonItem + && this.string.equals(((SummaryResolutionCenterCasesRequestReasonItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FRAUDULENT: + return visitor.visitFraudulent(); + case PRODUCT_UNACCEPTABLE: + return visitor.visitProductUnacceptable(); + case NOT_AS_DESCRIBED: + return visitor.visitNotAsDescribed(); + case PRODUCT_NOT_RECEIVED: + return visitor.visitProductNotReceived(); + case SUBSCRIPTION_CANCELED: + return visitor.visitSubscriptionCanceled(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SummaryResolutionCenterCasesRequestReasonItem valueOf(String value) { + switch (value) { + case "fraudulent": + return FRAUDULENT; + case "product_unacceptable": + return PRODUCT_UNACCEPTABLE; + case "not_as_described": + return NOT_AS_DESCRIBED; + case "product_not_received": + return PRODUCT_NOT_RECEIVED; + case "subscription_canceled": + return SUBSCRIPTION_CANCELED; + default: + return new SummaryResolutionCenterCasesRequestReasonItem(Value.UNKNOWN, value); + } + } + + public enum Value { + FRAUDULENT, + + PRODUCT_NOT_RECEIVED, + + NOT_AS_DESCRIBED, + + PRODUCT_UNACCEPTABLE, + + SUBSCRIPTION_CANCELED, + + UNKNOWN + } + + public interface Visitor { + T visitFraudulent(); + + T visitProductNotReceived(); + + T visitNotAsDescribed(); + + T visitProductUnacceptable(); + + T visitSubscriptionCanceled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesRequestStatusItem.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesRequestStatusItem.java new file mode 100644 index 00000000..4b3de9ea --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesRequestStatusItem.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SummaryResolutionCenterCasesRequestStatusItem { + public static final SummaryResolutionCenterCasesRequestStatusItem AWAITING_CUSTOMER = + new SummaryResolutionCenterCasesRequestStatusItem(Value.AWAITING_CUSTOMER, "awaiting_customer"); + + public static final SummaryResolutionCenterCasesRequestStatusItem CLOSED = + new SummaryResolutionCenterCasesRequestStatusItem(Value.CLOSED, "closed"); + + public static final SummaryResolutionCenterCasesRequestStatusItem UNDER_REVIEW = + new SummaryResolutionCenterCasesRequestStatusItem(Value.UNDER_REVIEW, "under_review"); + + public static final SummaryResolutionCenterCasesRequestStatusItem AWAITING_MERCHANT = + new SummaryResolutionCenterCasesRequestStatusItem(Value.AWAITING_MERCHANT, "awaiting_merchant"); + + private final Value value; + + private final String string; + + SummaryResolutionCenterCasesRequestStatusItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SummaryResolutionCenterCasesRequestStatusItem + && this.string.equals(((SummaryResolutionCenterCasesRequestStatusItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AWAITING_CUSTOMER: + return visitor.visitAwaitingCustomer(); + case CLOSED: + return visitor.visitClosed(); + case UNDER_REVIEW: + return visitor.visitUnderReview(); + case AWAITING_MERCHANT: + return visitor.visitAwaitingMerchant(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SummaryResolutionCenterCasesRequestStatusItem valueOf(String value) { + switch (value) { + case "awaiting_customer": + return AWAITING_CUSTOMER; + case "closed": + return CLOSED; + case "under_review": + return UNDER_REVIEW; + case "awaiting_merchant": + return AWAITING_MERCHANT; + default: + return new SummaryResolutionCenterCasesRequestStatusItem(Value.UNKNOWN, value); + } + } + + public enum Value { + AWAITING_MERCHANT, + + AWAITING_CUSTOMER, + + UNDER_REVIEW, + + CLOSED, + + UNKNOWN + } + + public interface Visitor { + T visitAwaitingMerchant(); + + T visitAwaitingCustomer(); + + T visitUnderReview(); + + T visitClosed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesResponse.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesResponse.java new file mode 100644 index 00000000..e5ce0bbf --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SummaryResolutionCenterCasesResponse.Builder.class) +public final class SummaryResolutionCenterCasesResponse { + private final SummaryResolutionCenterCasesResponseGroups groups; + + private final int total; + + private final Map additionalProperties; + + private SummaryResolutionCenterCasesResponse( + SummaryResolutionCenterCasesResponseGroups groups, int total, Map additionalProperties) { + this.groups = groups; + this.total = total; + this.additionalProperties = additionalProperties; + } + + /** + * @return One entry per requested breakdown, keyed by the field it groups on. A field you did not ask for is absent. + */ + @JsonProperty("groups") + public SummaryResolutionCenterCasesResponseGroups getGroups() { + return groups; + } + + /** + * @return How many cases match the filters. + */ + @JsonProperty("total") + public int getTotal() { + return total; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SummaryResolutionCenterCasesResponse + && equalTo((SummaryResolutionCenterCasesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SummaryResolutionCenterCasesResponse other) { + return groups.equals(other.groups) && total == other.total; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.groups, this.total); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static GroupsStage builder() { + return new Builder(); + } + + public interface GroupsStage { + /** + *

One entry per requested breakdown, keyed by the field it groups on. A field you did not ask for is absent.

+ */ + TotalStage groups(@NotNull SummaryResolutionCenterCasesResponseGroups groups); + + Builder from(SummaryResolutionCenterCasesResponse other); + } + + public interface TotalStage { + /** + *

How many cases match the filters.

+ */ + _FinalStage total(int total); + } + + public interface _FinalStage { + SummaryResolutionCenterCasesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements GroupsStage, TotalStage, _FinalStage { + private SummaryResolutionCenterCasesResponseGroups groups; + + private int total; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SummaryResolutionCenterCasesResponse other) { + groups(other.getGroups()); + total(other.getTotal()); + return this; + } + + /** + *

One entry per requested breakdown, keyed by the field it groups on. A field you did not ask for is absent.

+ *

One entry per requested breakdown, keyed by the field it groups on. A field you did not ask for is absent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("groups") + public TotalStage groups(@NotNull SummaryResolutionCenterCasesResponseGroups groups) { + this.groups = Objects.requireNonNull(groups, "groups must not be null"); + return this; + } + + /** + *

How many cases match the filters.

+ *

How many cases match the filters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total") + public _FinalStage total(int total) { + this.total = total; + return this; + } + + @java.lang.Override + public SummaryResolutionCenterCasesResponse build() { + return new SummaryResolutionCenterCasesResponse(groups, total, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesResponseGroups.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesResponseGroups.java new file mode 100644 index 00000000..93a86a61 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesResponseGroups.java @@ -0,0 +1,172 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SummaryResolutionCenterCasesResponseGroups.Builder.class) +public final class SummaryResolutionCenterCasesResponseGroups { + private final Optional outcome; + + private final Optional reason; + + private final Optional status; + + private final Map additionalProperties; + + private SummaryResolutionCenterCasesResponseGroups( + Optional outcome, + Optional reason, + Optional status, + Map additionalProperties) { + this.outcome = outcome; + this.reason = reason; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return How many of the matching cases ended each way. Every outcome is present, including those with a count of zero; open cases are counted in none of them. + */ + @JsonProperty("outcome") + public Optional getOutcome() { + return outcome; + } + + /** + * @return How many of the matching cases were opened for each reason. Every reason is present, including those with a count of zero. + */ + @JsonProperty("reason") + public Optional getReason() { + return reason; + } + + /** + * @return How many of the matching cases are in each status. Every status is present, including those with a count of zero. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SummaryResolutionCenterCasesResponseGroups + && equalTo((SummaryResolutionCenterCasesResponseGroups) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SummaryResolutionCenterCasesResponseGroups other) { + return outcome.equals(other.outcome) && reason.equals(other.reason) && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.outcome, this.reason, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional outcome = Optional.empty(); + + private Optional reason = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SummaryResolutionCenterCasesResponseGroups other) { + outcome(other.getOutcome()); + reason(other.getReason()); + status(other.getStatus()); + return this; + } + + /** + *

How many of the matching cases ended each way. Every outcome is present, including those with a count of zero; open cases are counted in none of them.

+ */ + @JsonSetter(value = "outcome", nulls = Nulls.SKIP) + public Builder outcome(Optional outcome) { + this.outcome = outcome; + return this; + } + + public Builder outcome(SummaryResolutionCenterCasesResponseGroupsOutcome outcome) { + this.outcome = Optional.ofNullable(outcome); + return this; + } + + /** + *

How many of the matching cases were opened for each reason. Every reason is present, including those with a count of zero.

+ */ + @JsonSetter(value = "reason", nulls = Nulls.SKIP) + public Builder reason(Optional reason) { + this.reason = reason; + return this; + } + + public Builder reason(SummaryResolutionCenterCasesResponseGroupsReason reason) { + this.reason = Optional.ofNullable(reason); + return this; + } + + /** + *

How many of the matching cases are in each status. Every status is present, including those with a count of zero.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(SummaryResolutionCenterCasesResponseGroupsStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public SummaryResolutionCenterCasesResponseGroups build() { + return new SummaryResolutionCenterCasesResponseGroups(outcome, reason, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesResponseGroupsOutcome.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesResponseGroupsOutcome.java new file mode 100644 index 00000000..bee79c33 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesResponseGroupsOutcome.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SummaryResolutionCenterCasesResponseGroupsOutcome.Builder.class) +public final class SummaryResolutionCenterCasesResponseGroupsOutcome { + private final int customerWon; + + private final int merchantWon; + + private final int withdrawn; + + private final Map additionalProperties; + + private SummaryResolutionCenterCasesResponseGroupsOutcome( + int customerWon, int merchantWon, int withdrawn, Map additionalProperties) { + this.customerWon = customerWon; + this.merchantWon = merchantWon; + this.withdrawn = withdrawn; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("customer_won") + public int getCustomerWon() { + return customerWon; + } + + @JsonProperty("merchant_won") + public int getMerchantWon() { + return merchantWon; + } + + @JsonProperty("withdrawn") + public int getWithdrawn() { + return withdrawn; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SummaryResolutionCenterCasesResponseGroupsOutcome + && equalTo((SummaryResolutionCenterCasesResponseGroupsOutcome) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SummaryResolutionCenterCasesResponseGroupsOutcome other) { + return customerWon == other.customerWon && merchantWon == other.merchantWon && withdrawn == other.withdrawn; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.customerWon, this.merchantWon, this.withdrawn); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CustomerWonStage builder() { + return new Builder(); + } + + public interface CustomerWonStage { + MerchantWonStage customerWon(int customerWon); + + Builder from(SummaryResolutionCenterCasesResponseGroupsOutcome other); + } + + public interface MerchantWonStage { + WithdrawnStage merchantWon(int merchantWon); + } + + public interface WithdrawnStage { + _FinalStage withdrawn(int withdrawn); + } + + public interface _FinalStage { + SummaryResolutionCenterCasesResponseGroupsOutcome build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CustomerWonStage, MerchantWonStage, WithdrawnStage, _FinalStage { + private int customerWon; + + private int merchantWon; + + private int withdrawn; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SummaryResolutionCenterCasesResponseGroupsOutcome other) { + customerWon(other.getCustomerWon()); + merchantWon(other.getMerchantWon()); + withdrawn(other.getWithdrawn()); + return this; + } + + @java.lang.Override + @JsonSetter("customer_won") + public MerchantWonStage customerWon(int customerWon) { + this.customerWon = customerWon; + return this; + } + + @java.lang.Override + @JsonSetter("merchant_won") + public WithdrawnStage merchantWon(int merchantWon) { + this.merchantWon = merchantWon; + return this; + } + + @java.lang.Override + @JsonSetter("withdrawn") + public _FinalStage withdrawn(int withdrawn) { + this.withdrawn = withdrawn; + return this; + } + + @java.lang.Override + public SummaryResolutionCenterCasesResponseGroupsOutcome build() { + return new SummaryResolutionCenterCasesResponseGroupsOutcome( + customerWon, merchantWon, withdrawn, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesResponseGroupsReason.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesResponseGroupsReason.java new file mode 100644 index 00000000..812c2eb8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesResponseGroupsReason.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SummaryResolutionCenterCasesResponseGroupsReason.Builder.class) +public final class SummaryResolutionCenterCasesResponseGroupsReason { + private final int fraudulent; + + private final int notAsDescribed; + + private final int productNotReceived; + + private final int productUnacceptable; + + private final int subscriptionCanceled; + + private final Map additionalProperties; + + private SummaryResolutionCenterCasesResponseGroupsReason( + int fraudulent, + int notAsDescribed, + int productNotReceived, + int productUnacceptable, + int subscriptionCanceled, + Map additionalProperties) { + this.fraudulent = fraudulent; + this.notAsDescribed = notAsDescribed; + this.productNotReceived = productNotReceived; + this.productUnacceptable = productUnacceptable; + this.subscriptionCanceled = subscriptionCanceled; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("fraudulent") + public int getFraudulent() { + return fraudulent; + } + + @JsonProperty("not_as_described") + public int getNotAsDescribed() { + return notAsDescribed; + } + + @JsonProperty("product_not_received") + public int getProductNotReceived() { + return productNotReceived; + } + + @JsonProperty("product_unacceptable") + public int getProductUnacceptable() { + return productUnacceptable; + } + + @JsonProperty("subscription_canceled") + public int getSubscriptionCanceled() { + return subscriptionCanceled; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SummaryResolutionCenterCasesResponseGroupsReason + && equalTo((SummaryResolutionCenterCasesResponseGroupsReason) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SummaryResolutionCenterCasesResponseGroupsReason other) { + return fraudulent == other.fraudulent + && notAsDescribed == other.notAsDescribed + && productNotReceived == other.productNotReceived + && productUnacceptable == other.productUnacceptable + && subscriptionCanceled == other.subscriptionCanceled; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fraudulent, + this.notAsDescribed, + this.productNotReceived, + this.productUnacceptable, + this.subscriptionCanceled); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FraudulentStage builder() { + return new Builder(); + } + + public interface FraudulentStage { + NotAsDescribedStage fraudulent(int fraudulent); + + Builder from(SummaryResolutionCenterCasesResponseGroupsReason other); + } + + public interface NotAsDescribedStage { + ProductNotReceivedStage notAsDescribed(int notAsDescribed); + } + + public interface ProductNotReceivedStage { + ProductUnacceptableStage productNotReceived(int productNotReceived); + } + + public interface ProductUnacceptableStage { + SubscriptionCanceledStage productUnacceptable(int productUnacceptable); + } + + public interface SubscriptionCanceledStage { + _FinalStage subscriptionCanceled(int subscriptionCanceled); + } + + public interface _FinalStage { + SummaryResolutionCenterCasesResponseGroupsReason build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements FraudulentStage, + NotAsDescribedStage, + ProductNotReceivedStage, + ProductUnacceptableStage, + SubscriptionCanceledStage, + _FinalStage { + private int fraudulent; + + private int notAsDescribed; + + private int productNotReceived; + + private int productUnacceptable; + + private int subscriptionCanceled; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SummaryResolutionCenterCasesResponseGroupsReason other) { + fraudulent(other.getFraudulent()); + notAsDescribed(other.getNotAsDescribed()); + productNotReceived(other.getProductNotReceived()); + productUnacceptable(other.getProductUnacceptable()); + subscriptionCanceled(other.getSubscriptionCanceled()); + return this; + } + + @java.lang.Override + @JsonSetter("fraudulent") + public NotAsDescribedStage fraudulent(int fraudulent) { + this.fraudulent = fraudulent; + return this; + } + + @java.lang.Override + @JsonSetter("not_as_described") + public ProductNotReceivedStage notAsDescribed(int notAsDescribed) { + this.notAsDescribed = notAsDescribed; + return this; + } + + @java.lang.Override + @JsonSetter("product_not_received") + public ProductUnacceptableStage productNotReceived(int productNotReceived) { + this.productNotReceived = productNotReceived; + return this; + } + + @java.lang.Override + @JsonSetter("product_unacceptable") + public SubscriptionCanceledStage productUnacceptable(int productUnacceptable) { + this.productUnacceptable = productUnacceptable; + return this; + } + + @java.lang.Override + @JsonSetter("subscription_canceled") + public _FinalStage subscriptionCanceled(int subscriptionCanceled) { + this.subscriptionCanceled = subscriptionCanceled; + return this; + } + + @java.lang.Override + public SummaryResolutionCenterCasesResponseGroupsReason build() { + return new SummaryResolutionCenterCasesResponseGroupsReason( + fraudulent, + notAsDescribed, + productNotReceived, + productUnacceptable, + subscriptionCanceled, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesResponseGroupsStatus.java b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesResponseGroupsStatus.java new file mode 100644 index 00000000..64154624 --- /dev/null +++ b/src/main/java/com/whop/api/resources/resolutioncentercases/types/SummaryResolutionCenterCasesResponseGroupsStatus.java @@ -0,0 +1,194 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.resolutioncentercases.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SummaryResolutionCenterCasesResponseGroupsStatus.Builder.class) +public final class SummaryResolutionCenterCasesResponseGroupsStatus { + private final int awaitingCustomer; + + private final int awaitingMerchant; + + private final int closed; + + private final int underReview; + + private final Map additionalProperties; + + private SummaryResolutionCenterCasesResponseGroupsStatus( + int awaitingCustomer, + int awaitingMerchant, + int closed, + int underReview, + Map additionalProperties) { + this.awaitingCustomer = awaitingCustomer; + this.awaitingMerchant = awaitingMerchant; + this.closed = closed; + this.underReview = underReview; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("awaiting_customer") + public int getAwaitingCustomer() { + return awaitingCustomer; + } + + @JsonProperty("awaiting_merchant") + public int getAwaitingMerchant() { + return awaitingMerchant; + } + + @JsonProperty("closed") + public int getClosed() { + return closed; + } + + @JsonProperty("under_review") + public int getUnderReview() { + return underReview; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SummaryResolutionCenterCasesResponseGroupsStatus + && equalTo((SummaryResolutionCenterCasesResponseGroupsStatus) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SummaryResolutionCenterCasesResponseGroupsStatus other) { + return awaitingCustomer == other.awaitingCustomer + && awaitingMerchant == other.awaitingMerchant + && closed == other.closed + && underReview == other.underReview; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.awaitingCustomer, this.awaitingMerchant, this.closed, this.underReview); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AwaitingCustomerStage builder() { + return new Builder(); + } + + public interface AwaitingCustomerStage { + AwaitingMerchantStage awaitingCustomer(int awaitingCustomer); + + Builder from(SummaryResolutionCenterCasesResponseGroupsStatus other); + } + + public interface AwaitingMerchantStage { + ClosedStage awaitingMerchant(int awaitingMerchant); + } + + public interface ClosedStage { + UnderReviewStage closed(int closed); + } + + public interface UnderReviewStage { + _FinalStage underReview(int underReview); + } + + public interface _FinalStage { + SummaryResolutionCenterCasesResponseGroupsStatus build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AwaitingCustomerStage, AwaitingMerchantStage, ClosedStage, UnderReviewStage, _FinalStage { + private int awaitingCustomer; + + private int awaitingMerchant; + + private int closed; + + private int underReview; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SummaryResolutionCenterCasesResponseGroupsStatus other) { + awaitingCustomer(other.getAwaitingCustomer()); + awaitingMerchant(other.getAwaitingMerchant()); + closed(other.getClosed()); + underReview(other.getUnderReview()); + return this; + } + + @java.lang.Override + @JsonSetter("awaiting_customer") + public AwaitingMerchantStage awaitingCustomer(int awaitingCustomer) { + this.awaitingCustomer = awaitingCustomer; + return this; + } + + @java.lang.Override + @JsonSetter("awaiting_merchant") + public ClosedStage awaitingMerchant(int awaitingMerchant) { + this.awaitingMerchant = awaitingMerchant; + return this; + } + + @java.lang.Override + @JsonSetter("closed") + public UnderReviewStage closed(int closed) { + this.closed = closed; + return this; + } + + @java.lang.Override + @JsonSetter("under_review") + public _FinalStage underReview(int underReview) { + this.underReview = underReview; + return this; + } + + @java.lang.Override + public SummaryResolutionCenterCasesResponseGroupsStatus build() { + return new SummaryResolutionCenterCasesResponseGroupsStatus( + awaitingCustomer, awaitingMerchant, closed, underReview, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/reviews/AsyncRawReviewsClient.java b/src/main/java/com/whop/api/resources/reviews/AsyncRawReviewsClient.java new file mode 100644 index 00000000..6b8fd33d --- /dev/null +++ b/src/main/java/com/whop/api/resources/reviews/AsyncRawReviewsClient.java @@ -0,0 +1,313 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reviews; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.reviews.requests.ListReviewsRequest; +import com.whop.api.resources.reviews.requests.RetrieveReviewsRequest; +import com.whop.api.resources.reviews.types.ListReviewsResponse; +import com.whop.api.types.Review; +import com.whop.api.types.ReviewListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawReviewsClient { + protected final ClientOptions clientOptions; + + public AsyncRawReviewsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of customer reviews for a specific product, with optional filtering by star rating and creation date. + */ + public CompletableFuture>> list(ListReviewsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of customer reviews for a specific product, with optional filtering by star rating and creation date. + */ + public CompletableFuture>> list( + ListReviewsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("reviews"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "product_id", request.getProductId(), false); + if (request.getMinStars().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "min_stars", request.getMinStars().get(), false); + } + if (request.getMaxStars().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "max_stars", request.getMaxStars().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListReviewsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListReviewsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListReviewsRequest nextRequest = ListReviewsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing review. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveReviewsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing review. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveReviewsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing review. + */ + public CompletableFuture> retrieve(String id, RetrieveReviewsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing review. + */ + public CompletableFuture> retrieve( + String id, RetrieveReviewsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("reviews") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Review.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/reviews/AsyncReviewsClient.java b/src/main/java/com/whop/api/resources/reviews/AsyncReviewsClient.java new file mode 100644 index 00000000..1529ab5b --- /dev/null +++ b/src/main/java/com/whop/api/resources/reviews/AsyncReviewsClient.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reviews; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.reviews.requests.ListReviewsRequest; +import com.whop.api.resources.reviews.requests.RetrieveReviewsRequest; +import com.whop.api.types.Review; +import com.whop.api.types.ReviewListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncReviewsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawReviewsClient rawClient; + + public AsyncReviewsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawReviewsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawReviewsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of customer reviews for a specific product, with optional filtering by star rating and creation date. + */ + public CompletableFuture> list(ListReviewsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of customer reviews for a specific product, with optional filtering by star rating and creation date. + */ + public CompletableFuture> list( + ListReviewsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing review. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing review. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing review. + */ + public CompletableFuture retrieve(String id, RetrieveReviewsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing review. + */ + public CompletableFuture retrieve( + String id, RetrieveReviewsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/reviews/RawReviewsClient.java b/src/main/java/com/whop/api/resources/reviews/RawReviewsClient.java new file mode 100644 index 00000000..d79876ab --- /dev/null +++ b/src/main/java/com/whop/api/resources/reviews/RawReviewsClient.java @@ -0,0 +1,246 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reviews; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.reviews.requests.ListReviewsRequest; +import com.whop.api.resources.reviews.requests.RetrieveReviewsRequest; +import com.whop.api.resources.reviews.types.ListReviewsResponse; +import com.whop.api.types.Review; +import com.whop.api.types.ReviewListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawReviewsClient { + protected final ClientOptions clientOptions; + + public RawReviewsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of customer reviews for a specific product, with optional filtering by star rating and creation date. + */ + public WhopApiHttpResponse> list(ListReviewsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of customer reviews for a specific product, with optional filtering by star rating and creation date. + */ + public WhopApiHttpResponse> list( + ListReviewsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("reviews"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "product_id", request.getProductId(), false); + if (request.getMinStars().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "min_stars", request.getMinStars().get(), false); + } + if (request.getMaxStars().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "max_stars", request.getMaxStars().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListReviewsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListReviewsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListReviewsRequest nextRequest = ListReviewsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing review. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveReviewsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing review. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveReviewsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing review. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveReviewsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing review. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveReviewsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("reviews") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Review.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/reviews/ReviewsClient.java b/src/main/java/com/whop/api/resources/reviews/ReviewsClient.java new file mode 100644 index 00000000..3abd012c --- /dev/null +++ b/src/main/java/com/whop/api/resources/reviews/ReviewsClient.java @@ -0,0 +1,72 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reviews; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.reviews.requests.ListReviewsRequest; +import com.whop.api.resources.reviews.requests.RetrieveReviewsRequest; +import com.whop.api.types.Review; +import com.whop.api.types.ReviewListItem; + +public class ReviewsClient { + protected final ClientOptions clientOptions; + + private final RawReviewsClient rawClient; + + public ReviewsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawReviewsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawReviewsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of customer reviews for a specific product, with optional filtering by star rating and creation date. + */ + public SyncPagingIterable list(ListReviewsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of customer reviews for a specific product, with optional filtering by star rating and creation date. + */ + public SyncPagingIterable list(ListReviewsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing review. + */ + public Review retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing review. + */ + public Review retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing review. + */ + public Review retrieve(String id, RetrieveReviewsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing review. + */ + public Review retrieve(String id, RetrieveReviewsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/reviews/requests/ListReviewsRequest.java b/src/main/java/com/whop/api/resources/reviews/requests/ListReviewsRequest.java new file mode 100644 index 00000000..1a166e4d --- /dev/null +++ b/src/main/java/com/whop/api/resources/reviews/requests/ListReviewsRequest.java @@ -0,0 +1,497 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reviews.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListReviewsRequest.Builder.class) +public final class ListReviewsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String productId; + + private final Optional minStars; + + private final Optional maxStars; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Map additionalProperties; + + private ListReviewsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String productId, + Optional minStars, + Optional maxStars, + Optional createdBefore, + Optional createdAfter, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.productId = productId; + this.minStars = minStars; + this.maxStars = maxStars; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the product to list reviews for. + */ + @JsonProperty("product_id") + public String getProductId() { + return productId; + } + + /** + * @return The minimum star rating to include in results, from 1 to 5 inclusive. + */ + @JsonProperty("min_stars") + public Optional getMinStars() { + return minStars; + } + + /** + * @return The maximum star rating to include in results, from 1 to 5 inclusive. + */ + @JsonProperty("max_stars") + public Optional getMaxStars() { + return maxStars; + } + + /** + * @return Only return reviews created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return reviews created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListReviewsRequest && equalTo((ListReviewsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListReviewsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && productId.equals(other.productId) + && minStars.equals(other.minStars) + && maxStars.equals(other.maxStars) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.after, + this.before, + this.first, + this.last, + this.productId, + this.minStars, + this.maxStars, + this.createdBefore, + this.createdAfter); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ProductIdStage builder() { + return new Builder(); + } + + public interface ProductIdStage { + /** + *

The unique identifier of the product to list reviews for.

+ */ + _FinalStage productId(@NotNull String productId); + + Builder from(ListReviewsRequest other); + } + + public interface _FinalStage { + ListReviewsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + /** + *

The minimum star rating to include in results, from 1 to 5 inclusive.

+ */ + _FinalStage minStars(Optional minStars); + + _FinalStage minStars(Integer minStars); + + /** + *

The maximum star rating to include in results, from 1 to 5 inclusive.

+ */ + _FinalStage maxStars(Optional maxStars); + + _FinalStage maxStars(Integer maxStars); + + /** + *

Only return reviews created before this timestamp.

+ */ + _FinalStage createdBefore(Optional createdBefore); + + _FinalStage createdBefore(OffsetDateTime createdBefore); + + /** + *

Only return reviews created after this timestamp.

+ */ + _FinalStage createdAfter(Optional createdAfter); + + _FinalStage createdAfter(OffsetDateTime createdAfter); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ProductIdStage, _FinalStage { + private String productId; + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional maxStars = Optional.empty(); + + private Optional minStars = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListReviewsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + productId(other.getProductId()); + minStars(other.getMinStars()); + maxStars(other.getMaxStars()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + return this; + } + + /** + *

The unique identifier of the product to list reviews for.

+ *

The unique identifier of the product to list reviews for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("product_id") + public _FinalStage productId(@NotNull String productId) { + this.productId = Objects.requireNonNull(productId, "productId must not be null"); + return this; + } + + /** + *

Only return reviews created after this timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only return reviews created after this timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public _FinalStage createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + /** + *

Only return reviews created before this timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return reviews created before this timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public _FinalStage createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + /** + *

The maximum star rating to include in results, from 1 to 5 inclusive.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxStars(Integer maxStars) { + this.maxStars = Optional.ofNullable(maxStars); + return this; + } + + /** + *

The maximum star rating to include in results, from 1 to 5 inclusive.

+ */ + @java.lang.Override + @JsonSetter(value = "max_stars", nulls = Nulls.SKIP) + public _FinalStage maxStars(Optional maxStars) { + this.maxStars = maxStars; + return this; + } + + /** + *

The minimum star rating to include in results, from 1 to 5 inclusive.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage minStars(Integer minStars) { + this.minStars = Optional.ofNullable(minStars); + return this; + } + + /** + *

The minimum star rating to include in results, from 1 to 5 inclusive.

+ */ + @java.lang.Override + @JsonSetter(value = "min_stars", nulls = Nulls.SKIP) + public _FinalStage minStars(Optional minStars) { + this.minStars = minStars; + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListReviewsRequest build() { + return new ListReviewsRequest( + after, + before, + first, + last, + productId, + minStars, + maxStars, + createdBefore, + createdAfter, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/reviews/requests/RetrieveReviewsRequest.java b/src/main/java/com/whop/api/resources/reviews/requests/RetrieveReviewsRequest.java new file mode 100644 index 00000000..c35b8ac0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/reviews/requests/RetrieveReviewsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reviews.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveReviewsRequest.Builder.class) +public final class RetrieveReviewsRequest { + private final Map additionalProperties; + + private RetrieveReviewsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveReviewsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveReviewsRequest other) { + return this; + } + + public RetrieveReviewsRequest build() { + return new RetrieveReviewsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/reviews/types/ListReviewsResponse.java b/src/main/java/com/whop/api/resources/reviews/types/ListReviewsResponse.java new file mode 100644 index 00000000..cd264b68 --- /dev/null +++ b/src/main/java/com/whop/api/resources/reviews/types/ListReviewsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.reviews.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PageInfo; +import com.whop.api.types.ReviewListItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListReviewsResponse.Builder.class) +public final class ListReviewsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListReviewsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListReviewsResponse && equalTo((ListReviewsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListReviewsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListReviewsResponse other); + } + + public interface _FinalStage { + ListReviewsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(ReviewListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListReviewsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(ReviewListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListReviewsResponse build() { + return new ListReviewsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/AsyncRawSetupIntentsClient.java b/src/main/java/com/whop/api/resources/setupintents/AsyncRawSetupIntentsClient.java new file mode 100644 index 00000000..e93eb784 --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/AsyncRawSetupIntentsClient.java @@ -0,0 +1,666 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.setupintents.requests.ListSetupIntentsRequest; +import com.whop.api.resources.setupintents.requests.RetrieveSetupIntentsRequest; +import com.whop.api.resources.setupintents.requests.RetrieveStatusSetupIntentsRequest; +import com.whop.api.resources.setupintents.requests.UpdateReturnUrlSetupIntentsRequest; +import com.whop.api.resources.setupintents.types.CreateSetupIntentsRequest; +import com.whop.api.resources.setupintents.types.CreateSetupIntentsResponse; +import com.whop.api.resources.setupintents.types.ListSetupIntentsResponse; +import com.whop.api.types.SetupIntent; +import com.whop.api.types.SetupIntentListItem; +import com.whop.api.types.SetupStatus; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawSetupIntentsClient { + protected final ClientOptions clientOptions; + + public AsyncRawSetupIntentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of setup intents for a company, with optional filtering by creation date. A setup intent securely collects and stores a member's payment method for future use without charging them immediately. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture>> list( + ListSetupIntentsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of setup intents for a company, with optional filtering by creation date. A setup intent securely collects and stores a member's payment method for future use without charging them immediately. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture>> list( + ListSetupIntentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("setup_intents"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListSetupIntentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListSetupIntentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListSetupIntentsRequest nextRequest = ListSetupIntentsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Save a buyer's payment method for later without charging it. Provide a confirmation token for a method the buyer just supplied, or an existing payment method to re-verify. The buyer may still have a step to complete — 3D Secure, a hosted enrollment, linking a bank account — so poll the setup intent's status endpoint for what to do next. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> create( + CreateSetupIntentsRequest request) { + return create(request, null); + } + + /** + * Save a buyer's payment method for later without charging it. Provide a confirmation token for a method the buyer just supplied, or an existing payment method to re-verify. The buyer may still have a step to complete — 3D Secure, a hosted enrollment, linking a bank account — so poll the setup intent's status endpoint for what to do next. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> create( + CreateSetupIntentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("setup_intents"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CreateSetupIntentsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveSetupIntentsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveSetupIntentsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveSetupIntentsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveSetupIntentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("setup_intents") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SetupIntent.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the setup's own client_secret, so the surface that knows the final destination can set it. + */ + public CompletableFuture> updateReturnUrl( + String setupIntentId, UpdateReturnUrlSetupIntentsRequest request) { + return updateReturnUrl(setupIntentId, request, null); + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the setup's own client_secret, so the surface that knows the final destination can set it. + */ + public CompletableFuture> updateReturnUrl( + String setupIntentId, UpdateReturnUrlSetupIntentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("setup_intents") + .addPathSegment(setupIntentId) + .addPathSegments("return_url"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SetupStatus.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public CompletableFuture> retrieveStatus(String setupIntentId) { + return retrieveStatus( + setupIntentId, RetrieveStatusSetupIntentsRequest.builder().build()); + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public CompletableFuture> retrieveStatus( + String setupIntentId, RequestOptions requestOptions) { + return retrieveStatus( + setupIntentId, RetrieveStatusSetupIntentsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public CompletableFuture> retrieveStatus( + String setupIntentId, RetrieveStatusSetupIntentsRequest request) { + return retrieveStatus(setupIntentId, request, null); + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public CompletableFuture> retrieveStatus( + String setupIntentId, RetrieveStatusSetupIntentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("setup_intents") + .addPathSegment(setupIntentId) + .addPathSegments("status"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SetupStatus.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/AsyncSetupIntentsClient.java b/src/main/java/com/whop/api/resources/setupintents/AsyncSetupIntentsClient.java new file mode 100644 index 00000000..347654cf --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/AsyncSetupIntentsClient.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.setupintents.requests.ListSetupIntentsRequest; +import com.whop.api.resources.setupintents.requests.RetrieveSetupIntentsRequest; +import com.whop.api.resources.setupintents.requests.RetrieveStatusSetupIntentsRequest; +import com.whop.api.resources.setupintents.requests.UpdateReturnUrlSetupIntentsRequest; +import com.whop.api.resources.setupintents.types.CreateSetupIntentsRequest; +import com.whop.api.resources.setupintents.types.CreateSetupIntentsResponse; +import com.whop.api.types.SetupIntent; +import com.whop.api.types.SetupIntentListItem; +import com.whop.api.types.SetupStatus; +import java.util.concurrent.CompletableFuture; + +public class AsyncSetupIntentsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawSetupIntentsClient rawClient; + + public AsyncSetupIntentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawSetupIntentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawSetupIntentsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of setup intents for a company, with optional filtering by creation date. A setup intent securely collects and stores a member's payment method for future use without charging them immediately. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> list(ListSetupIntentsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of setup intents for a company, with optional filtering by creation date. A setup intent securely collects and stores a member's payment method for future use without charging them immediately. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture> list( + ListSetupIntentsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Save a buyer's payment method for later without charging it. Provide a confirmation token for a method the buyer just supplied, or an existing payment method to re-verify. The buyer may still have a step to complete — 3D Secure, a hosted enrollment, linking a bank account — so poll the setup intent's status endpoint for what to do next. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture create(CreateSetupIntentsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Save a buyer's payment method for later without charging it. Provide a confirmation token for a method the buyer just supplied, or an existing payment method to re-verify. The buyer may still have a step to complete — 3D Secure, a hosted enrollment, linking a bank account — so poll the setup intent's status endpoint for what to do next. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture create( + CreateSetupIntentsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveSetupIntentsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveSetupIntentsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the setup's own client_secret, so the surface that knows the final destination can set it. + */ + public CompletableFuture updateReturnUrl( + String setupIntentId, UpdateReturnUrlSetupIntentsRequest request) { + return this.rawClient.updateReturnUrl(setupIntentId, request).thenApply(response -> response.body()); + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the setup's own client_secret, so the surface that knows the final destination can set it. + */ + public CompletableFuture updateReturnUrl( + String setupIntentId, UpdateReturnUrlSetupIntentsRequest request, RequestOptions requestOptions) { + return this.rawClient + .updateReturnUrl(setupIntentId, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public CompletableFuture retrieveStatus(String setupIntentId) { + return this.rawClient.retrieveStatus(setupIntentId).thenApply(response -> response.body()); + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public CompletableFuture retrieveStatus(String setupIntentId, RequestOptions requestOptions) { + return this.rawClient.retrieveStatus(setupIntentId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public CompletableFuture retrieveStatus( + String setupIntentId, RetrieveStatusSetupIntentsRequest request) { + return this.rawClient.retrieveStatus(setupIntentId, request).thenApply(response -> response.body()); + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public CompletableFuture retrieveStatus( + String setupIntentId, RetrieveStatusSetupIntentsRequest request, RequestOptions requestOptions) { + return this.rawClient + .retrieveStatus(setupIntentId, request, requestOptions) + .thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/RawSetupIntentsClient.java b/src/main/java/com/whop/api/resources/setupintents/RawSetupIntentsClient.java new file mode 100644 index 00000000..e9a828fc --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/RawSetupIntentsClient.java @@ -0,0 +1,528 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.setupintents.requests.ListSetupIntentsRequest; +import com.whop.api.resources.setupintents.requests.RetrieveSetupIntentsRequest; +import com.whop.api.resources.setupintents.requests.RetrieveStatusSetupIntentsRequest; +import com.whop.api.resources.setupintents.requests.UpdateReturnUrlSetupIntentsRequest; +import com.whop.api.resources.setupintents.types.CreateSetupIntentsRequest; +import com.whop.api.resources.setupintents.types.CreateSetupIntentsResponse; +import com.whop.api.resources.setupintents.types.ListSetupIntentsResponse; +import com.whop.api.types.SetupIntent; +import com.whop.api.types.SetupIntentListItem; +import com.whop.api.types.SetupStatus; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawSetupIntentsClient { + protected final ClientOptions clientOptions; + + public RawSetupIntentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of setup intents for a company, with optional filtering by creation date. A setup intent securely collects and stores a member's payment method for future use without charging them immediately. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListSetupIntentsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of setup intents for a company, with optional filtering by creation date. A setup intent securely collects and stores a member's payment method for future use without charging them immediately. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListSetupIntentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("setup_intents"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListSetupIntentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListSetupIntentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListSetupIntentsRequest nextRequest = ListSetupIntentsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Save a buyer's payment method for later without charging it. Provide a confirmation token for a method the buyer just supplied, or an existing payment method to re-verify. The buyer may still have a step to complete — 3D Secure, a hosted enrollment, linking a bank account — so poll the setup intent's status endpoint for what to do next. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse create(CreateSetupIntentsRequest request) { + return create(request, null); + } + + /** + * Save a buyer's payment method for later without charging it. Provide a confirmation token for a method the buyer just supplied, or an existing payment method to re-verify. The buyer may still have a step to complete — 3D Secure, a hosted enrollment, linking a bank account — so poll the setup intent's status endpoint for what to do next. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse create( + CreateSetupIntentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("setup_intents"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateSetupIntentsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveSetupIntentsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveSetupIntentsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveSetupIntentsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveSetupIntentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("setup_intents") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SetupIntent.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the setup's own client_secret, so the surface that knows the final destination can set it. + */ + public WhopApiHttpResponse updateReturnUrl( + String setupIntentId, UpdateReturnUrlSetupIntentsRequest request) { + return updateReturnUrl(setupIntentId, request, null); + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the setup's own client_secret, so the surface that knows the final destination can set it. + */ + public WhopApiHttpResponse updateReturnUrl( + String setupIntentId, UpdateReturnUrlSetupIntentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("setup_intents") + .addPathSegment(setupIntentId) + .addPathSegments("return_url"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SetupStatus.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public WhopApiHttpResponse retrieveStatus(String setupIntentId) { + return retrieveStatus( + setupIntentId, RetrieveStatusSetupIntentsRequest.builder().build()); + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public WhopApiHttpResponse retrieveStatus(String setupIntentId, RequestOptions requestOptions) { + return retrieveStatus( + setupIntentId, RetrieveStatusSetupIntentsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public WhopApiHttpResponse retrieveStatus( + String setupIntentId, RetrieveStatusSetupIntentsRequest request) { + return retrieveStatus(setupIntentId, request, null); + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public WhopApiHttpResponse retrieveStatus( + String setupIntentId, RetrieveStatusSetupIntentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("setup_intents") + .addPathSegment(setupIntentId) + .addPathSegments("status"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SetupStatus.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/SetupIntentsClient.java b/src/main/java/com/whop/api/resources/setupintents/SetupIntentsClient.java new file mode 100644 index 00000000..0cbf2d5a --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/SetupIntentsClient.java @@ -0,0 +1,188 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.setupintents.requests.ListSetupIntentsRequest; +import com.whop.api.resources.setupintents.requests.RetrieveSetupIntentsRequest; +import com.whop.api.resources.setupintents.requests.RetrieveStatusSetupIntentsRequest; +import com.whop.api.resources.setupintents.requests.UpdateReturnUrlSetupIntentsRequest; +import com.whop.api.resources.setupintents.types.CreateSetupIntentsRequest; +import com.whop.api.resources.setupintents.types.CreateSetupIntentsResponse; +import com.whop.api.types.SetupIntent; +import com.whop.api.types.SetupIntentListItem; +import com.whop.api.types.SetupStatus; + +public class SetupIntentsClient { + protected final ClientOptions clientOptions; + + private final RawSetupIntentsClient rawClient; + + public SetupIntentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawSetupIntentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawSetupIntentsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of setup intents for a company, with optional filtering by creation date. A setup intent securely collects and stores a member's payment method for future use without charging them immediately. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public SyncPagingIterable list(ListSetupIntentsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of setup intents for a company, with optional filtering by creation date. A setup intent securely collects and stores a member's payment method for future use without charging them immediately. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public SyncPagingIterable list( + ListSetupIntentsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Save a buyer's payment method for later without charging it. Provide a confirmation token for a method the buyer just supplied, or an existing payment method to re-verify. The buyer may still have a step to complete — 3D Secure, a hosted enrollment, linking a bank account — so poll the setup intent's status endpoint for what to do next. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CreateSetupIntentsResponse create(CreateSetupIntentsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Save a buyer's payment method for later without charging it. Provide a confirmation token for a method the buyer just supplied, or an existing payment method to re-verify. The buyer may still have a step to complete — 3D Secure, a hosted enrollment, linking a bank account — so poll the setup intent's status endpoint for what to do next. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public CreateSetupIntentsResponse create(CreateSetupIntentsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public SetupIntent retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public SetupIntent retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public SetupIntent retrieve(String id, RetrieveSetupIntentsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing setup intent. + *

Required permissions:

+ *
    + *
  • payment:setup_intent:read
  • + *
  • member:basic:read
  • + *
  • member:email:read
  • + *
+ */ + public SetupIntent retrieve(String id, RetrieveSetupIntentsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the setup's own client_secret, so the surface that knows the final destination can set it. + */ + public SetupStatus updateReturnUrl(String setupIntentId, UpdateReturnUrlSetupIntentsRequest request) { + return this.rawClient.updateReturnUrl(setupIntentId, request).body(); + } + + /** + * Changes where the buyer lands after completing an off-site step, up until they return. Accepts either a secret key or the setup's own client_secret, so the surface that knows the final destination can set it. + */ + public SetupStatus updateReturnUrl( + String setupIntentId, UpdateReturnUrlSetupIntentsRequest request, RequestOptions requestOptions) { + return this.rawClient + .updateReturnUrl(setupIntentId, request, requestOptions) + .body(); + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public SetupStatus retrieveStatus(String setupIntentId) { + return this.rawClient.retrieveStatus(setupIntentId).body(); + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public SetupStatus retrieveStatus(String setupIntentId, RequestOptions requestOptions) { + return this.rawClient.retrieveStatus(setupIntentId, requestOptions).body(); + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public SetupStatus retrieveStatus(String setupIntentId, RetrieveStatusSetupIntentsRequest request) { + return this.rawClient.retrieveStatus(setupIntentId, request).body(); + } + + /** + * Retrieves how far a setup has got and what the buyer must do next, if anything. Collection runs in the background, so poll this rather than reading the create response. Accepts either a secret key or the setup's own client_secret, so the surface collecting the payment method can poll it directly. + */ + public SetupStatus retrieveStatus( + String setupIntentId, RetrieveStatusSetupIntentsRequest request, RequestOptions requestOptions) { + return this.rawClient + .retrieveStatus(setupIntentId, request, requestOptions) + .body(); + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/requests/ListSetupIntentsRequest.java b/src/main/java/com/whop/api/resources/setupintents/requests/ListSetupIntentsRequest.java new file mode 100644 index 00000000..dac9e42e --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/requests/ListSetupIntentsRequest.java @@ -0,0 +1,440 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Direction; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSetupIntentsRequest.Builder.class) +public final class ListSetupIntentsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String companyId; + + private final Optional direction; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Map additionalProperties; + + private ListSetupIntentsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String companyId, + Optional direction, + Optional createdBefore, + Optional createdAfter, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.direction = direction; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to list setup intents for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Only return setup intents created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return setup intents created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSetupIntentsRequest && equalTo((ListSetupIntentsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSetupIntentsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId) + && direction.equals(other.direction) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.after, + this.before, + this.first, + this.last, + this.companyId, + this.direction, + this.createdBefore, + this.createdAfter); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to list setup intents for.

+ */ + _FinalStage companyId(@NotNull String companyId); + + Builder from(ListSetupIntentsRequest other); + } + + public interface _FinalStage { + ListSetupIntentsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + _FinalStage direction(Optional direction); + + _FinalStage direction(Direction direction); + + /** + *

Only return setup intents created before this timestamp.

+ */ + _FinalStage createdBefore(Optional createdBefore); + + _FinalStage createdBefore(OffsetDateTime createdBefore); + + /** + *

Only return setup intents created after this timestamp.

+ */ + _FinalStage createdAfter(Optional createdAfter); + + _FinalStage createdAfter(OffsetDateTime createdAfter); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSetupIntentsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + direction(other.getDirection()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + return this; + } + + /** + *

The unique identifier of the company to list setup intents for.

+ *

The unique identifier of the company to list setup intents for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

Only return setup intents created after this timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only return setup intents created after this timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public _FinalStage createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + /** + *

Only return setup intents created before this timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return setup intents created before this timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public _FinalStage createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + @java.lang.Override + public _FinalStage direction(Direction direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + @java.lang.Override + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public _FinalStage direction(Optional direction) { + this.direction = direction; + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListSetupIntentsRequest build() { + return new ListSetupIntentsRequest( + after, + before, + first, + last, + companyId, + direction, + createdBefore, + createdAfter, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/requests/RetrieveSetupIntentsRequest.java b/src/main/java/com/whop/api/resources/setupintents/requests/RetrieveSetupIntentsRequest.java new file mode 100644 index 00000000..4c750702 --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/requests/RetrieveSetupIntentsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveSetupIntentsRequest.Builder.class) +public final class RetrieveSetupIntentsRequest { + private final Map additionalProperties; + + private RetrieveSetupIntentsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveSetupIntentsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveSetupIntentsRequest other) { + return this; + } + + public RetrieveSetupIntentsRequest build() { + return new RetrieveSetupIntentsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/requests/RetrieveStatusSetupIntentsRequest.java b/src/main/java/com/whop/api/resources/setupintents/requests/RetrieveStatusSetupIntentsRequest.java new file mode 100644 index 00000000..039f824e --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/requests/RetrieveStatusSetupIntentsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveStatusSetupIntentsRequest.Builder.class) +public final class RetrieveStatusSetupIntentsRequest { + private final Map additionalProperties; + + private RetrieveStatusSetupIntentsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveStatusSetupIntentsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveStatusSetupIntentsRequest other) { + return this; + } + + public RetrieveStatusSetupIntentsRequest build() { + return new RetrieveStatusSetupIntentsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/requests/UpdateReturnUrlSetupIntentsRequest.java b/src/main/java/com/whop/api/resources/setupintents/requests/UpdateReturnUrlSetupIntentsRequest.java new file mode 100644 index 00000000..183bacfb --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/requests/UpdateReturnUrlSetupIntentsRequest.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateReturnUrlSetupIntentsRequest.Builder.class) +public final class UpdateReturnUrlSetupIntentsRequest { + private final String returnUrl; + + private final Map additionalProperties; + + private UpdateReturnUrlSetupIntentsRequest(String returnUrl, Map additionalProperties) { + this.returnUrl = returnUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. + */ + @JsonProperty("return_url") + public String getReturnUrl() { + return returnUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateReturnUrlSetupIntentsRequest + && equalTo((UpdateReturnUrlSetupIntentsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateReturnUrlSetupIntentsRequest other) { + return returnUrl.equals(other.returnUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.returnUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ReturnUrlStage builder() { + return new Builder(); + } + + public interface ReturnUrlStage { + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters.

+ */ + _FinalStage returnUrl(@NotNull String returnUrl); + + Builder from(UpdateReturnUrlSetupIntentsRequest other); + } + + public interface _FinalStage { + UpdateReturnUrlSetupIntentsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ReturnUrlStage, _FinalStage { + private String returnUrl; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateReturnUrlSetupIntentsRequest other) { + returnUrl(other.getReturnUrl()); + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters.

+ *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("return_url") + public _FinalStage returnUrl(@NotNull String returnUrl) { + this.returnUrl = Objects.requireNonNull(returnUrl, "returnUrl must not be null"); + return this; + } + + @java.lang.Override + public UpdateReturnUrlSetupIntentsRequest build() { + return new UpdateReturnUrlSetupIntentsRequest(returnUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsRequest.java b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsRequest.java new file mode 100644 index 00000000..83779069 --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsRequest.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Map; +import java.util.Objects; + +@JsonDeserialize(using = CreateSetupIntentsRequest.Deserializer.class) +public final class CreateSetupIntentsRequest { + private final Object value; + + private final int type; + + private CreateSetupIntentsRequest(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((CreateSetupIntentsRequestConfirmationToken) this.value); + } else if (this.type == 1) { + return visitor.visit((CreateSetupIntentsRequestPaymentMethodId) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSetupIntentsRequest && equalTo((CreateSetupIntentsRequest) other); + } + + private boolean equalTo(CreateSetupIntentsRequest other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static CreateSetupIntentsRequest of(CreateSetupIntentsRequestConfirmationToken value) { + return new CreateSetupIntentsRequest(value, 0); + } + + public static CreateSetupIntentsRequest of(CreateSetupIntentsRequestPaymentMethodId value) { + return new CreateSetupIntentsRequest(value, 1); + } + + public interface Visitor { + T visit(CreateSetupIntentsRequestConfirmationToken value); + + T visit(CreateSetupIntentsRequestPaymentMethodId value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(CreateSetupIntentsRequest.class); + } + + @java.lang.Override + public CreateSetupIntentsRequest deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Map + && ((Map) value).containsKey("company_id") + && ((Map) value).containsKey("confirmation_token")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, CreateSetupIntentsRequestConfirmationToken.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map + && ((Map) value).containsKey("company_id") + && ((Map) value).containsKey("payment_method_id")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, CreateSetupIntentsRequestPaymentMethodId.class)); + } catch (RuntimeException e) { + } + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsRequestConfirmationToken.java b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsRequestConfirmationToken.java new file mode 100644 index 00000000..497baac7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsRequestConfirmationToken.java @@ -0,0 +1,455 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Currencies; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSetupIntentsRequestConfirmationToken.Builder.class) +public final class CreateSetupIntentsRequestConfirmationToken { + private final String companyId; + + private final String confirmationToken; + + private final Optional currency; + + private final Optional email; + + private final Optional> metadata; + + private final Optional returnUrl; + + private final Map additionalProperties; + + private CreateSetupIntentsRequestConfirmationToken( + String companyId, + String confirmationToken, + Optional currency, + Optional email, + Optional> metadata, + Optional returnUrl, + Map additionalProperties) { + this.companyId = companyId; + this.confirmationToken = confirmationToken; + this.currency = currency; + this.email = email; + this.metadata = metadata; + this.returnUrl = returnUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the company to save the payment method for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return A confirmation token ID (ctok_) describing a payment method the buyer just supplied. Provide this or payment_method_id, not both. + */ + @JsonProperty("confirmation_token") + public String getConfirmationToken() { + return confirmationToken; + } + + /** + * @return The currency the saved payment method will be used with. Controls which currency-specific payment methods are available. Defaults to usd. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the method belongs to. Ignored when the caller IS the buyer or the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return Custom metadata to attach to the setup intent. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. + */ + @JsonIgnore + public Optional getReturnUrl() { + if (returnUrl == null) { + return Optional.empty(); + } + return returnUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("return_url") + private Optional _getReturnUrl() { + return returnUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSetupIntentsRequestConfirmationToken + && equalTo((CreateSetupIntentsRequestConfirmationToken) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSetupIntentsRequestConfirmationToken other) { + return companyId.equals(other.companyId) + && confirmationToken.equals(other.confirmationToken) + && currency.equals(other.currency) + && email.equals(other.email) + && metadata.equals(other.metadata) + && returnUrl.equals(other.returnUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyId, this.confirmationToken, this.currency, this.email, this.metadata, this.returnUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The ID of the company to save the payment method for.

+ */ + ConfirmationTokenStage companyId(@NotNull String companyId); + + Builder from(CreateSetupIntentsRequestConfirmationToken other); + } + + public interface ConfirmationTokenStage { + /** + *

A confirmation token ID (ctok_) describing a payment method the buyer just supplied. Provide this or payment_method_id, not both.

+ */ + _FinalStage confirmationToken(@NotNull String confirmationToken); + } + + public interface _FinalStage { + CreateSetupIntentsRequestConfirmationToken build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The currency the saved payment method will be used with. Controls which currency-specific payment methods are available. Defaults to usd.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(Currencies currency); + + _FinalStage currency(Nullable currency); + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the method belongs to. Ignored when the caller IS the buyer or the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

Custom metadata to attach to the setup intent.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters.

+ */ + _FinalStage returnUrl(Optional returnUrl); + + _FinalStage returnUrl(String returnUrl); + + _FinalStage returnUrl(Nullable returnUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, ConfirmationTokenStage, _FinalStage { + private String companyId; + + private String confirmationToken; + + private Optional returnUrl = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional currency = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateSetupIntentsRequestConfirmationToken other) { + companyId(other.getCompanyId()); + confirmationToken(other.getConfirmationToken()); + currency(other.getCurrency()); + email(other.getEmail()); + metadata(other.getMetadata()); + returnUrl(other.getReturnUrl()); + return this; + } + + /** + *

The ID of the company to save the payment method for.

+ *

The ID of the company to save the payment method for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public ConfirmationTokenStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

A confirmation token ID (ctok_) describing a payment method the buyer just supplied. Provide this or payment_method_id, not both.

+ *

A confirmation token ID (ctok_) describing a payment method the buyer just supplied. Provide this or payment_method_id, not both.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("confirmation_token") + public _FinalStage confirmationToken(@NotNull String confirmationToken) { + this.confirmationToken = Objects.requireNonNull(confirmationToken, "confirmationToken must not be null"); + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(Nullable returnUrl) { + if (returnUrl.isNull()) { + this.returnUrl = null; + } else if (returnUrl.isEmpty()) { + this.returnUrl = Optional.empty(); + } else { + this.returnUrl = Optional.of(returnUrl.get()); + } + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(String returnUrl) { + this.returnUrl = Optional.ofNullable(returnUrl); + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters.

+ */ + @java.lang.Override + @JsonSetter(value = "return_url", nulls = Nulls.SKIP) + public _FinalStage returnUrl(Optional returnUrl) { + this.returnUrl = returnUrl; + return this; + } + + /** + *

Custom metadata to attach to the setup intent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom metadata to attach to the setup intent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom metadata to attach to the setup intent.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the method belongs to. Ignored when the caller IS the buyer or the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the method belongs to. Ignored when the caller IS the buyer or the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the method belongs to. Ignored when the caller IS the buyer or the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + /** + *

The currency the saved payment method will be used with. Controls which currency-specific payment methods are available. Defaults to usd.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

The currency the saved payment method will be used with. Controls which currency-specific payment methods are available. Defaults to usd.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Currencies currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

The currency the saved payment method will be used with. Controls which currency-specific payment methods are available. Defaults to usd.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + @java.lang.Override + public CreateSetupIntentsRequestConfirmationToken build() { + return new CreateSetupIntentsRequestConfirmationToken( + companyId, confirmationToken, currency, email, metadata, returnUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsRequestPaymentMethodId.java b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsRequestPaymentMethodId.java new file mode 100644 index 00000000..09c36454 --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsRequestPaymentMethodId.java @@ -0,0 +1,455 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Currencies; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSetupIntentsRequestPaymentMethodId.Builder.class) +public final class CreateSetupIntentsRequestPaymentMethodId { + private final String companyId; + + private final Optional currency; + + private final Optional email; + + private final Optional> metadata; + + private final String paymentMethodId; + + private final Optional returnUrl; + + private final Map additionalProperties; + + private CreateSetupIntentsRequestPaymentMethodId( + String companyId, + Optional currency, + Optional email, + Optional> metadata, + String paymentMethodId, + Optional returnUrl, + Map additionalProperties) { + this.companyId = companyId; + this.currency = currency; + this.email = email; + this.metadata = metadata; + this.paymentMethodId = paymentMethodId; + this.returnUrl = returnUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the company to save the payment method for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return The currency the saved payment method will be used with. Controls which currency-specific payment methods are available. Defaults to usd. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the method belongs to. Ignored when the caller IS the buyer or the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return Custom metadata to attach to the setup intent. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return An existing payment method (payt_) to re-verify and save. Provide this or confirmation_token, not both. + */ + @JsonProperty("payment_method_id") + public String getPaymentMethodId() { + return paymentMethodId; + } + + /** + * @return Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters. + */ + @JsonIgnore + public Optional getReturnUrl() { + if (returnUrl == null) { + return Optional.empty(); + } + return returnUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("return_url") + private Optional _getReturnUrl() { + return returnUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSetupIntentsRequestPaymentMethodId + && equalTo((CreateSetupIntentsRequestPaymentMethodId) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSetupIntentsRequestPaymentMethodId other) { + return companyId.equals(other.companyId) + && currency.equals(other.currency) + && email.equals(other.email) + && metadata.equals(other.metadata) + && paymentMethodId.equals(other.paymentMethodId) + && returnUrl.equals(other.returnUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyId, this.currency, this.email, this.metadata, this.paymentMethodId, this.returnUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The ID of the company to save the payment method for.

+ */ + PaymentMethodIdStage companyId(@NotNull String companyId); + + Builder from(CreateSetupIntentsRequestPaymentMethodId other); + } + + public interface PaymentMethodIdStage { + /** + *

An existing payment method (payt_) to re-verify and save. Provide this or confirmation_token, not both.

+ */ + _FinalStage paymentMethodId(@NotNull String paymentMethodId); + } + + public interface _FinalStage { + CreateSetupIntentsRequestPaymentMethodId build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The currency the saved payment method will be used with. Controls which currency-specific payment methods are available. Defaults to usd.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(Currencies currency); + + _FinalStage currency(Nullable currency); + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the method belongs to. Ignored when the caller IS the buyer or the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

Custom metadata to attach to the setup intent.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters.

+ */ + _FinalStage returnUrl(Optional returnUrl); + + _FinalStage returnUrl(String returnUrl); + + _FinalStage returnUrl(Nullable returnUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, PaymentMethodIdStage, _FinalStage { + private String companyId; + + private String paymentMethodId; + + private Optional returnUrl = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional currency = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateSetupIntentsRequestPaymentMethodId other) { + companyId(other.getCompanyId()); + currency(other.getCurrency()); + email(other.getEmail()); + metadata(other.getMetadata()); + paymentMethodId(other.getPaymentMethodId()); + returnUrl(other.getReturnUrl()); + return this; + } + + /** + *

The ID of the company to save the payment method for.

+ *

The ID of the company to save the payment method for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public PaymentMethodIdStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

An existing payment method (payt_) to re-verify and save. Provide this or confirmation_token, not both.

+ *

An existing payment method (payt_) to re-verify and save. Provide this or confirmation_token, not both.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_id") + public _FinalStage paymentMethodId(@NotNull String paymentMethodId) { + this.paymentMethodId = Objects.requireNonNull(paymentMethodId, "paymentMethodId must not be null"); + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(Nullable returnUrl) { + if (returnUrl.isNull()) { + this.returnUrl = null; + } else if (returnUrl.isEmpty()) { + this.returnUrl = Optional.empty(); + } else { + this.returnUrl = Optional.of(returnUrl.get()); + } + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(String returnUrl) { + this.returnUrl = Optional.ofNullable(returnUrl); + return this; + } + + /** + *

Where the buyer continues after completing an off-site step. Must be an absolute https URL without credentials (http is allowed for localhost), at most 2,048 characters.

+ */ + @java.lang.Override + @JsonSetter(value = "return_url", nulls = Nulls.SKIP) + public _FinalStage returnUrl(Optional returnUrl) { + this.returnUrl = returnUrl; + return this; + } + + /** + *

Custom metadata to attach to the setup intent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom metadata to attach to the setup intent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom metadata to attach to the setup intent.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the method belongs to. Ignored when the caller IS the buyer or the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the method belongs to. Ignored when the caller IS the buyer or the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

Overrides the buyer email carried on the confirmation token, resolving or creating the Whop user the method belongs to. Ignored when the caller IS the buyer or the confirmation token was created by a signed-in buyer, and unless confirmation_token is provided.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + /** + *

The currency the saved payment method will be used with. Controls which currency-specific payment methods are available. Defaults to usd.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

The currency the saved payment method will be used with. Controls which currency-specific payment methods are available. Defaults to usd.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Currencies currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

The currency the saved payment method will be used with. Controls which currency-specific payment methods are available. Defaults to usd.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + @java.lang.Override + public CreateSetupIntentsRequestPaymentMethodId build() { + return new CreateSetupIntentsRequestPaymentMethodId( + companyId, currency, email, metadata, paymentMethodId, returnUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponse.java b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponse.java new file mode 100644 index 00000000..5c5957a0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponse.java @@ -0,0 +1,762 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.SetupIntentStatuses; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSetupIntentsResponse.Builder.class) +public final class CreateSetupIntentsResponse { + private final Optional checkoutConfiguration; + + private final Optional clientSecret; + + private final Optional company; + + private final OffsetDateTime createdAt; + + private final Optional errorMessage; + + private final String id; + + private final Optional member; + + private final Optional> metadata; + + private final Optional paymentMethod; + + private final SetupIntentStatuses status; + + private final boolean threeDsVerified; + + private final Map additionalProperties; + + private CreateSetupIntentsResponse( + Optional checkoutConfiguration, + Optional clientSecret, + Optional company, + OffsetDateTime createdAt, + Optional errorMessage, + String id, + Optional member, + Optional> metadata, + Optional paymentMethod, + SetupIntentStatuses status, + boolean threeDsVerified, + Map additionalProperties) { + this.checkoutConfiguration = checkoutConfiguration; + this.clientSecret = clientSecret; + this.company = company; + this.createdAt = createdAt; + this.errorMessage = errorMessage; + this.id = id; + this.member = member; + this.metadata = metadata; + this.paymentMethod = paymentMethod; + this.status = status; + this.threeDsVerified = threeDsVerified; + this.additionalProperties = additionalProperties; + } + + /** + * @return The checkout session configuration associated with this setup intent. Null if no checkout session was used. + */ + @JsonIgnore + public Optional getCheckoutConfiguration() { + if (checkoutConfiguration == null) { + return Optional.empty(); + } + return checkoutConfiguration; + } + + /** + * @return The credential the buyer's surface presents to poll this setup intent and set its return URL. Returned when the setup is created and still has something to finish — hold on to it, because a later read will not repeat it. Null when the setup settled on the spot and there is nothing left to authorize. It unlocks this setup intent and nothing else; treat it like a password for that one attempt. + */ + @JsonIgnore + public Optional getClientSecret() { + if (clientSecret == null) { + return Optional.empty(); + } + return clientSecret; + } + + /** + * @return The company that initiated this setup intent. Null if the company has been deleted. + */ + @JsonIgnore + public Optional getCompany() { + if (company == null) { + return Optional.empty(); + } + return company; + } + + /** + * @return The datetime the setup intent was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return A human-readable error message explaining why the setup intent failed. Null if no error occurred. + */ + @JsonIgnore + public Optional getErrorMessage() { + if (errorMessage == null) { + return Optional.empty(); + } + return errorMessage; + } + + /** + * @return The unique identifier for the setup intent. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The company member associated with this setup intent. Null if the user is not a member. + */ + @JsonIgnore + public Optional getMember() { + if (member == null) { + return Optional.empty(); + } + return member; + } + + /** + * @return Custom key-value pairs attached to this setup intent. Null if no metadata was provided. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The saved payment method created by this setup intent. Null if the setup has not completed successfully. + */ + @JsonIgnore + public Optional getPaymentMethod() { + if (paymentMethod == null) { + return Optional.empty(); + } + return paymentMethod; + } + + /** + * @return The current status of the setup intent. + */ + @JsonProperty("status") + public SetupIntentStatuses getStatus() { + return status; + } + + /** + * @return Whether 3D Secure authentication was completed when this payment method was set up. + */ + @JsonProperty("three_ds_verified") + public boolean getThreeDsVerified() { + return threeDsVerified; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_configuration") + private Optional _getCheckoutConfiguration() { + return checkoutConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("client_secret") + private Optional _getClientSecret() { + return clientSecret; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company") + private Optional _getCompany() { + return company; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("error_message") + private Optional _getErrorMessage() { + return errorMessage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member") + private Optional _getMember() { + return member; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method") + private Optional _getPaymentMethod() { + return paymentMethod; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSetupIntentsResponse && equalTo((CreateSetupIntentsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSetupIntentsResponse other) { + return checkoutConfiguration.equals(other.checkoutConfiguration) + && clientSecret.equals(other.clientSecret) + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && errorMessage.equals(other.errorMessage) + && id.equals(other.id) + && member.equals(other.member) + && metadata.equals(other.metadata) + && paymentMethod.equals(other.paymentMethod) + && status.equals(other.status) + && threeDsVerified == other.threeDsVerified; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.checkoutConfiguration, + this.clientSecret, + this.company, + this.createdAt, + this.errorMessage, + this.id, + this.member, + this.metadata, + this.paymentMethod, + this.status, + this.threeDsVerified); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the setup intent was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(CreateSetupIntentsResponse other); + } + + public interface IdStage { + /** + *

The unique identifier for the setup intent.

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

The current status of the setup intent.

+ */ + ThreeDsVerifiedStage status(@NotNull SetupIntentStatuses status); + } + + public interface ThreeDsVerifiedStage { + /** + *

Whether 3D Secure authentication was completed when this payment method was set up.

+ */ + _FinalStage threeDsVerified(boolean threeDsVerified); + } + + public interface _FinalStage { + CreateSetupIntentsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The checkout session configuration associated with this setup intent. Null if no checkout session was used.

+ */ + _FinalStage checkoutConfiguration( + Optional checkoutConfiguration); + + _FinalStage checkoutConfiguration(CreateSetupIntentsResponseCheckoutConfiguration checkoutConfiguration); + + _FinalStage checkoutConfiguration( + Nullable checkoutConfiguration); + + /** + *

The credential the buyer's surface presents to poll this setup intent and set its return URL. Returned when the setup is created and still has something to finish — hold on to it, because a later read will not repeat it. Null when the setup settled on the spot and there is nothing left to authorize. It unlocks this setup intent and nothing else; treat it like a password for that one attempt.

+ */ + _FinalStage clientSecret(Optional clientSecret); + + _FinalStage clientSecret(String clientSecret); + + _FinalStage clientSecret(Nullable clientSecret); + + /** + *

The company that initiated this setup intent. Null if the company has been deleted.

+ */ + _FinalStage company(Optional company); + + _FinalStage company(CreateSetupIntentsResponseCompany company); + + _FinalStage company(Nullable company); + + /** + *

A human-readable error message explaining why the setup intent failed. Null if no error occurred.

+ */ + _FinalStage errorMessage(Optional errorMessage); + + _FinalStage errorMessage(String errorMessage); + + _FinalStage errorMessage(Nullable errorMessage); + + /** + *

The company member associated with this setup intent. Null if the user is not a member.

+ */ + _FinalStage member(Optional member); + + _FinalStage member(CreateSetupIntentsResponseMember member); + + _FinalStage member(Nullable member); + + /** + *

Custom key-value pairs attached to this setup intent. Null if no metadata was provided.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The saved payment method created by this setup intent. Null if the setup has not completed successfully.

+ */ + _FinalStage paymentMethod(Optional paymentMethod); + + _FinalStage paymentMethod(CreateSetupIntentsResponsePaymentMethod paymentMethod); + + _FinalStage paymentMethod(Nullable paymentMethod); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IdStage, StatusStage, ThreeDsVerifiedStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private SetupIntentStatuses status; + + private boolean threeDsVerified; + + private Optional paymentMethod = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional member = Optional.empty(); + + private Optional errorMessage = Optional.empty(); + + private Optional company = Optional.empty(); + + private Optional clientSecret = Optional.empty(); + + private Optional checkoutConfiguration = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateSetupIntentsResponse other) { + checkoutConfiguration(other.getCheckoutConfiguration()); + clientSecret(other.getClientSecret()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + errorMessage(other.getErrorMessage()); + id(other.getId()); + member(other.getMember()); + metadata(other.getMetadata()); + paymentMethod(other.getPaymentMethod()); + status(other.getStatus()); + threeDsVerified(other.getThreeDsVerified()); + return this; + } + + /** + *

The datetime the setup intent was created.

+ *

The datetime the setup intent was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the setup intent.

+ *

The unique identifier for the setup intent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current status of the setup intent.

+ *

The current status of the setup intent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public ThreeDsVerifiedStage status(@NotNull SetupIntentStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Whether 3D Secure authentication was completed when this payment method was set up.

+ *

Whether 3D Secure authentication was completed when this payment method was set up.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("three_ds_verified") + public _FinalStage threeDsVerified(boolean threeDsVerified) { + this.threeDsVerified = threeDsVerified; + return this; + } + + /** + *

The saved payment method created by this setup intent. Null if the setup has not completed successfully.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethod(Nullable paymentMethod) { + if (paymentMethod.isNull()) { + this.paymentMethod = null; + } else if (paymentMethod.isEmpty()) { + this.paymentMethod = Optional.empty(); + } else { + this.paymentMethod = Optional.of(paymentMethod.get()); + } + return this; + } + + /** + *

The saved payment method created by this setup intent. Null if the setup has not completed successfully.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethod(CreateSetupIntentsResponsePaymentMethod paymentMethod) { + this.paymentMethod = Optional.ofNullable(paymentMethod); + return this; + } + + /** + *

The saved payment method created by this setup intent. Null if the setup has not completed successfully.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method", nulls = Nulls.SKIP) + public _FinalStage paymentMethod(Optional paymentMethod) { + this.paymentMethod = paymentMethod; + return this; + } + + /** + *

Custom key-value pairs attached to this setup intent. Null if no metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs attached to this setup intent. Null if no metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs attached to this setup intent. Null if no metadata was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The company member associated with this setup intent. Null if the user is not a member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(Nullable member) { + if (member.isNull()) { + this.member = null; + } else if (member.isEmpty()) { + this.member = Optional.empty(); + } else { + this.member = Optional.of(member.get()); + } + return this; + } + + /** + *

The company member associated with this setup intent. Null if the user is not a member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(CreateSetupIntentsResponseMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + /** + *

The company member associated with this setup intent. Null if the user is not a member.

+ */ + @java.lang.Override + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public _FinalStage member(Optional member) { + this.member = member; + return this; + } + + /** + *

A human-readable error message explaining why the setup intent failed. Null if no error occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorMessage(Nullable errorMessage) { + if (errorMessage.isNull()) { + this.errorMessage = null; + } else if (errorMessage.isEmpty()) { + this.errorMessage = Optional.empty(); + } else { + this.errorMessage = Optional.of(errorMessage.get()); + } + return this; + } + + /** + *

A human-readable error message explaining why the setup intent failed. Null if no error occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorMessage(String errorMessage) { + this.errorMessage = Optional.ofNullable(errorMessage); + return this; + } + + /** + *

A human-readable error message explaining why the setup intent failed. Null if no error occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "error_message", nulls = Nulls.SKIP) + public _FinalStage errorMessage(Optional errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + *

The company that initiated this setup intent. Null if the company has been deleted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(Nullable company) { + if (company.isNull()) { + this.company = null; + } else if (company.isEmpty()) { + this.company = Optional.empty(); + } else { + this.company = Optional.of(company.get()); + } + return this; + } + + /** + *

The company that initiated this setup intent. Null if the company has been deleted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(CreateSetupIntentsResponseCompany company) { + this.company = Optional.ofNullable(company); + return this; + } + + /** + *

The company that initiated this setup intent. Null if the company has been deleted.

+ */ + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + + /** + *

The credential the buyer's surface presents to poll this setup intent and set its return URL. Returned when the setup is created and still has something to finish — hold on to it, because a later read will not repeat it. Null when the setup settled on the spot and there is nothing left to authorize. It unlocks this setup intent and nothing else; treat it like a password for that one attempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage clientSecret(Nullable clientSecret) { + if (clientSecret.isNull()) { + this.clientSecret = null; + } else if (clientSecret.isEmpty()) { + this.clientSecret = Optional.empty(); + } else { + this.clientSecret = Optional.of(clientSecret.get()); + } + return this; + } + + /** + *

The credential the buyer's surface presents to poll this setup intent and set its return URL. Returned when the setup is created and still has something to finish — hold on to it, because a later read will not repeat it. Null when the setup settled on the spot and there is nothing left to authorize. It unlocks this setup intent and nothing else; treat it like a password for that one attempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage clientSecret(String clientSecret) { + this.clientSecret = Optional.ofNullable(clientSecret); + return this; + } + + /** + *

The credential the buyer's surface presents to poll this setup intent and set its return URL. Returned when the setup is created and still has something to finish — hold on to it, because a later read will not repeat it. Null when the setup settled on the spot and there is nothing left to authorize. It unlocks this setup intent and nothing else; treat it like a password for that one attempt.

+ */ + @java.lang.Override + @JsonSetter(value = "client_secret", nulls = Nulls.SKIP) + public _FinalStage clientSecret(Optional clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + *

The checkout session configuration associated with this setup intent. Null if no checkout session was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfiguration( + Nullable checkoutConfiguration) { + if (checkoutConfiguration.isNull()) { + this.checkoutConfiguration = null; + } else if (checkoutConfiguration.isEmpty()) { + this.checkoutConfiguration = Optional.empty(); + } else { + this.checkoutConfiguration = Optional.of(checkoutConfiguration.get()); + } + return this; + } + + /** + *

The checkout session configuration associated with this setup intent. Null if no checkout session was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfiguration( + CreateSetupIntentsResponseCheckoutConfiguration checkoutConfiguration) { + this.checkoutConfiguration = Optional.ofNullable(checkoutConfiguration); + return this; + } + + /** + *

The checkout session configuration associated with this setup intent. Null if no checkout session was used.

+ */ + @java.lang.Override + @JsonSetter(value = "checkout_configuration", nulls = Nulls.SKIP) + public _FinalStage checkoutConfiguration( + Optional checkoutConfiguration) { + this.checkoutConfiguration = checkoutConfiguration; + return this; + } + + @java.lang.Override + public CreateSetupIntentsResponse build() { + return new CreateSetupIntentsResponse( + checkoutConfiguration, + clientSecret, + company, + createdAt, + errorMessage, + id, + member, + metadata, + paymentMethod, + status, + threeDsVerified, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponseCheckoutConfiguration.java b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponseCheckoutConfiguration.java new file mode 100644 index 00000000..ad5a07cd --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponseCheckoutConfiguration.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSetupIntentsResponseCheckoutConfiguration.Builder.class) +public final class CreateSetupIntentsResponseCheckoutConfiguration { + private final String id; + + private final Map additionalProperties; + + private CreateSetupIntentsResponseCheckoutConfiguration(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the checkout session. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSetupIntentsResponseCheckoutConfiguration + && equalTo((CreateSetupIntentsResponseCheckoutConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSetupIntentsResponseCheckoutConfiguration other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the checkout session.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CreateSetupIntentsResponseCheckoutConfiguration other); + } + + public interface _FinalStage { + CreateSetupIntentsResponseCheckoutConfiguration build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateSetupIntentsResponseCheckoutConfiguration other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the checkout session.

+ *

The unique identifier for the checkout session.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CreateSetupIntentsResponseCheckoutConfiguration build() { + return new CreateSetupIntentsResponseCheckoutConfiguration(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponseCompany.java b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponseCompany.java new file mode 100644 index 00000000..628dd65c --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponseCompany.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSetupIntentsResponseCompany.Builder.class) +public final class CreateSetupIntentsResponseCompany { + private final String id; + + private final Map additionalProperties; + + private CreateSetupIntentsResponseCompany(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSetupIntentsResponseCompany && equalTo((CreateSetupIntentsResponseCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSetupIntentsResponseCompany other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CreateSetupIntentsResponseCompany other); + } + + public interface _FinalStage { + CreateSetupIntentsResponseCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateSetupIntentsResponseCompany other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CreateSetupIntentsResponseCompany build() { + return new CreateSetupIntentsResponseCompany(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponseMember.java b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponseMember.java new file mode 100644 index 00000000..d9ffd329 --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponseMember.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSetupIntentsResponseMember.Builder.class) +public final class CreateSetupIntentsResponseMember { + private final String id; + + private final Optional user; + + private final Map additionalProperties; + + private CreateSetupIntentsResponseMember( + String id, Optional user, Map additionalProperties) { + this.id = id; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company member. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user for this member, if any. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSetupIntentsResponseMember && equalTo((CreateSetupIntentsResponseMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSetupIntentsResponseMember other) { + return id.equals(other.id) && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company member.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CreateSetupIntentsResponseMember other); + } + + public interface _FinalStage { + CreateSetupIntentsResponseMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user for this member, if any.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(CreateSetupIntentsResponseMemberUser user); + + _FinalStage user(Nullable user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional user = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateSetupIntentsResponseMember other) { + id(other.getId()); + user(other.getUser()); + return this; + } + + /** + *

The unique identifier for the company member.

+ *

The unique identifier for the company member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user for this member, if any.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The user for this member, if any.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(CreateSetupIntentsResponseMemberUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The user for this member, if any.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + @java.lang.Override + public CreateSetupIntentsResponseMember build() { + return new CreateSetupIntentsResponseMember(id, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponseMemberUser.java b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponseMemberUser.java new file mode 100644 index 00000000..12eb17c7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponseMemberUser.java @@ -0,0 +1,312 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSetupIntentsResponseMemberUser.Builder.class) +public final class CreateSetupIntentsResponseMemberUser { + private final Optional email; + + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private CreateSetupIntentsResponseMemberUser( + Optional email, + String id, + Optional name, + String username, + Map additionalProperties) { + this.email = email; + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The digital mailing address of the user. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the company member user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's full name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The whop username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSetupIntentsResponseMemberUser + && equalTo((CreateSetupIntentsResponseMemberUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSetupIntentsResponseMemberUser other) { + return email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company member user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(CreateSetupIntentsResponseMemberUser other); + } + + public interface UsernameStage { + /** + *

The whop username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + CreateSetupIntentsResponseMemberUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The digital mailing address of the user.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's full name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateSetupIntentsResponseMemberUser other) { + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the company member user.

+ *

The unique identifier for the company member user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The whop username.

+ *

The whop username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's full name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's full name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's full name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The digital mailing address of the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The digital mailing address of the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The digital mailing address of the user.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public CreateSetupIntentsResponseMemberUser build() { + return new CreateSetupIntentsResponseMemberUser(email, id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponsePaymentMethod.java b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponsePaymentMethod.java new file mode 100644 index 00000000..02172a7d --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponsePaymentMethod.java @@ -0,0 +1,352 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PaymentMethodTypes; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSetupIntentsResponsePaymentMethod.Builder.class) +public final class CreateSetupIntentsResponsePaymentMethod { + private final Optional card; + + private final OffsetDateTime createdAt; + + private final String id; + + private final Optional mailingAddress; + + private final PaymentMethodTypes paymentMethodType; + + private final Map additionalProperties; + + private CreateSetupIntentsResponsePaymentMethod( + Optional card, + OffsetDateTime createdAt, + String id, + Optional mailingAddress, + PaymentMethodTypes paymentMethodType, + Map additionalProperties) { + this.card = card; + this.createdAt = createdAt; + this.id = id; + this.mailingAddress = mailingAddress; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The card data associated with the payment method, if its a debit or credit card. + */ + @JsonIgnore + public Optional getCard() { + if (card == null) { + return Optional.empty(); + } + return card; + } + + /** + * @return The datetime the payment token was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the payment token. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The mailing address associated with the payment method's user + */ + @JsonIgnore + public Optional getMailingAddress() { + if (mailingAddress == null) { + return Optional.empty(); + } + return mailingAddress; + } + + /** + * @return The payment method type of the payment method + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card") + private Optional _getCard() { + return card; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("mailing_address") + private Optional _getMailingAddress() { + return mailingAddress; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSetupIntentsResponsePaymentMethod + && equalTo((CreateSetupIntentsResponsePaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSetupIntentsResponsePaymentMethod other) { + return card.equals(other.card) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && mailingAddress.equals(other.mailingAddress) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.createdAt, this.id, this.mailingAddress, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the payment token was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(CreateSetupIntentsResponsePaymentMethod other); + } + + public interface IdStage { + /** + *

The unique identifier for the payment token.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The payment method type of the payment method

+ */ + _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface _FinalStage { + CreateSetupIntentsResponsePaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ */ + _FinalStage card(Optional card); + + _FinalStage card(CreateSetupIntentsResponsePaymentMethodCard card); + + _FinalStage card(Nullable card); + + /** + *

The mailing address associated with the payment method's user

+ */ + _FinalStage mailingAddress(Optional mailingAddress); + + _FinalStage mailingAddress(CreateSetupIntentsResponsePaymentMethodMailingAddress mailingAddress); + + _FinalStage mailingAddress(Nullable mailingAddress); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, PaymentMethodTypeStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + private Optional mailingAddress = Optional.empty(); + + private Optional card = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateSetupIntentsResponsePaymentMethod other) { + card(other.getCard()); + createdAt(other.getCreatedAt()); + id(other.getId()); + mailingAddress(other.getMailingAddress()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

The datetime the payment token was created.

+ *

The datetime the payment token was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the payment token.

+ *

The unique identifier for the payment token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The payment method type of the payment method

+ *

The payment method type of the payment method

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + /** + *

The mailing address associated with the payment method's user

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mailingAddress( + Nullable mailingAddress) { + if (mailingAddress.isNull()) { + this.mailingAddress = null; + } else if (mailingAddress.isEmpty()) { + this.mailingAddress = Optional.empty(); + } else { + this.mailingAddress = Optional.of(mailingAddress.get()); + } + return this; + } + + /** + *

The mailing address associated with the payment method's user

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mailingAddress(CreateSetupIntentsResponsePaymentMethodMailingAddress mailingAddress) { + this.mailingAddress = Optional.ofNullable(mailingAddress); + return this; + } + + /** + *

The mailing address associated with the payment method's user

+ */ + @java.lang.Override + @JsonSetter(value = "mailing_address", nulls = Nulls.SKIP) + public _FinalStage mailingAddress( + Optional mailingAddress) { + this.mailingAddress = mailingAddress; + return this; + } + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(Nullable card) { + if (card.isNull()) { + this.card = null; + } else if (card.isEmpty()) { + this.card = Optional.empty(); + } else { + this.card = Optional.of(card.get()); + } + return this; + } + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(CreateSetupIntentsResponsePaymentMethodCard card) { + this.card = Optional.ofNullable(card); + return this; + } + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ */ + @java.lang.Override + @JsonSetter(value = "card", nulls = Nulls.SKIP) + public _FinalStage card(Optional card) { + this.card = card; + return this; + } + + @java.lang.Override + public CreateSetupIntentsResponsePaymentMethod build() { + return new CreateSetupIntentsResponsePaymentMethod( + card, createdAt, id, mailingAddress, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponsePaymentMethodCard.java b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponsePaymentMethodCard.java new file mode 100644 index 00000000..b9f657cc --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponsePaymentMethodCard.java @@ -0,0 +1,289 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.CardBrands; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSetupIntentsResponsePaymentMethodCard.Builder.class) +public final class CreateSetupIntentsResponsePaymentMethodCard { + private final Optional brand; + + private final Optional expMonth; + + private final Optional expYear; + + private final Optional last4; + + private final Map additionalProperties; + + private CreateSetupIntentsResponsePaymentMethodCard( + Optional brand, + Optional expMonth, + Optional expYear, + Optional last4, + Map additionalProperties) { + this.brand = brand; + this.expMonth = expMonth; + this.expYear = expYear; + this.last4 = last4; + this.additionalProperties = additionalProperties; + } + + /** + * @return The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined. + */ + @JsonIgnore + public Optional getBrand() { + if (brand == null) { + return Optional.empty(); + } + return brand; + } + + /** + * @return The two-digit expiration month of the card (1-12). Null if not available. + */ + @JsonIgnore + public Optional getExpMonth() { + if (expMonth == null) { + return Optional.empty(); + } + return expMonth; + } + + /** + * @return The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available. + */ + @JsonIgnore + public Optional getExpYear() { + if (expYear == null) { + return Optional.empty(); + } + return expYear; + } + + /** + * @return The last four digits of the card number. Null if not available. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("brand") + private Optional _getBrand() { + return brand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_month") + private Optional _getExpMonth() { + return expMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_year") + private Optional _getExpYear() { + return expYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSetupIntentsResponsePaymentMethodCard + && equalTo((CreateSetupIntentsResponsePaymentMethodCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSetupIntentsResponsePaymentMethodCard other) { + return brand.equals(other.brand) + && expMonth.equals(other.expMonth) + && expYear.equals(other.expYear) + && last4.equals(other.last4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.brand, this.expMonth, this.expYear, this.last4); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional brand = Optional.empty(); + + private Optional expMonth = Optional.empty(); + + private Optional expYear = Optional.empty(); + + private Optional last4 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateSetupIntentsResponsePaymentMethodCard other) { + brand(other.getBrand()); + expMonth(other.getExpMonth()); + expYear(other.getExpYear()); + last4(other.getLast4()); + return this; + } + + /** + *

The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined.

+ */ + @JsonSetter(value = "brand", nulls = Nulls.SKIP) + public Builder brand(Optional brand) { + this.brand = brand; + return this; + } + + public Builder brand(CardBrands brand) { + this.brand = Optional.ofNullable(brand); + return this; + } + + public Builder brand(Nullable brand) { + if (brand.isNull()) { + this.brand = null; + } else if (brand.isEmpty()) { + this.brand = Optional.empty(); + } else { + this.brand = Optional.of(brand.get()); + } + return this; + } + + /** + *

The two-digit expiration month of the card (1-12). Null if not available.

+ */ + @JsonSetter(value = "exp_month", nulls = Nulls.SKIP) + public Builder expMonth(Optional expMonth) { + this.expMonth = expMonth; + return this; + } + + public Builder expMonth(Integer expMonth) { + this.expMonth = Optional.ofNullable(expMonth); + return this; + } + + public Builder expMonth(Nullable expMonth) { + if (expMonth.isNull()) { + this.expMonth = null; + } else if (expMonth.isEmpty()) { + this.expMonth = Optional.empty(); + } else { + this.expMonth = Optional.of(expMonth.get()); + } + return this; + } + + /** + *

The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available.

+ */ + @JsonSetter(value = "exp_year", nulls = Nulls.SKIP) + public Builder expYear(Optional expYear) { + this.expYear = expYear; + return this; + } + + public Builder expYear(Integer expYear) { + this.expYear = Optional.ofNullable(expYear); + return this; + } + + public Builder expYear(Nullable expYear) { + if (expYear.isNull()) { + this.expYear = null; + } else if (expYear.isEmpty()) { + this.expYear = Optional.empty(); + } else { + this.expYear = Optional.of(expYear.get()); + } + return this; + } + + /** + *

The last four digits of the card number. Null if not available.

+ */ + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public Builder last4(Optional last4) { + this.last4 = last4; + return this; + } + + public Builder last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + public Builder last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + public CreateSetupIntentsResponsePaymentMethodCard build() { + return new CreateSetupIntentsResponsePaymentMethodCard( + brand, expMonth, expYear, last4, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponsePaymentMethodMailingAddress.java b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponsePaymentMethodMailingAddress.java new file mode 100644 index 00000000..91a27217 --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/CreateSetupIntentsResponsePaymentMethodMailingAddress.java @@ -0,0 +1,438 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSetupIntentsResponsePaymentMethodMailingAddress.Builder.class) +public final class CreateSetupIntentsResponsePaymentMethodMailingAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional name; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private CreateSetupIntentsResponsePaymentMethodMailingAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional name, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.name = name; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The name of the customer. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSetupIntentsResponsePaymentMethodMailingAddress + && equalTo((CreateSetupIntentsResponsePaymentMethodMailingAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSetupIntentsResponsePaymentMethodMailingAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && name.equals(other.name) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.name, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateSetupIntentsResponsePaymentMethodMailingAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + name(other.getName()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The name of the customer.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public CreateSetupIntentsResponsePaymentMethodMailingAddress build() { + return new CreateSetupIntentsResponsePaymentMethodMailingAddress( + city, country, line1, line2, name, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/ListSetupIntentsResponse.java b/src/main/java/com/whop/api/resources/setupintents/types/ListSetupIntentsResponse.java new file mode 100644 index 00000000..1969cf29 --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/ListSetupIntentsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PageInfo; +import com.whop.api.types.SetupIntentListItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSetupIntentsResponse.Builder.class) +public final class ListSetupIntentsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListSetupIntentsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSetupIntentsResponse && equalTo((ListSetupIntentsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSetupIntentsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListSetupIntentsResponse other); + } + + public interface _FinalStage { + ListSetupIntentsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(SetupIntentListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSetupIntentsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(SetupIntentListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListSetupIntentsResponse build() { + return new ListSetupIntentsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentCanceledPayload.java b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentCanceledPayload.java new file mode 100644 index 00000000..6e001a9d --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentCanceledPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.SetupIntent; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostSetupIntentCanceledPayload.Builder.class) +public final class PostSetupIntentCanceledPayload { + private final Optional accountId; + + private final PostSetupIntentCanceledPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final SetupIntent data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostSetupIntentCanceledPayloadType type; + + private final Map additionalProperties; + + private PostSetupIntentCanceledPayload( + Optional accountId, + PostSetupIntentCanceledPayloadApiVersion apiVersion, + Optional apiVersionDate, + SetupIntent data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostSetupIntentCanceledPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostSetupIntentCanceledPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public SetupIntent getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostSetupIntentCanceledPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostSetupIntentCanceledPayload && equalTo((PostSetupIntentCanceledPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostSetupIntentCanceledPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostSetupIntentCanceledPayloadApiVersion apiVersion); + + Builder from(PostSetupIntentCanceledPayload other); + } + + public interface DataStage { + IdStage data(@NotNull SetupIntent data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostSetupIntentCanceledPayloadType type); + } + + public interface _FinalStage { + PostSetupIntentCanceledPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostSetupIntentCanceledPayloadApiVersion apiVersion; + + private SetupIntent data; + + private String id; + + private OffsetDateTime timestamp; + + private PostSetupIntentCanceledPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostSetupIntentCanceledPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostSetupIntentCanceledPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull SetupIntent data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostSetupIntentCanceledPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostSetupIntentCanceledPayload build() { + return new PostSetupIntentCanceledPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentCanceledPayloadApiVersion.java b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentCanceledPayloadApiVersion.java new file mode 100644 index 00000000..28427f90 --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentCanceledPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostSetupIntentCanceledPayloadApiVersion { + public static final PostSetupIntentCanceledPayloadApiVersion V1 = + new PostSetupIntentCanceledPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostSetupIntentCanceledPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostSetupIntentCanceledPayloadApiVersion + && this.string.equals(((PostSetupIntentCanceledPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostSetupIntentCanceledPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostSetupIntentCanceledPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentCanceledPayloadType.java b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentCanceledPayloadType.java new file mode 100644 index 00000000..fc17483e --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentCanceledPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostSetupIntentCanceledPayloadType { + public static final PostSetupIntentCanceledPayloadType SETUP_INTENT_CANCELED = + new PostSetupIntentCanceledPayloadType(Value.SETUP_INTENT_CANCELED, "setup_intent.canceled"); + + private final Value value; + + private final String string; + + PostSetupIntentCanceledPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostSetupIntentCanceledPayloadType + && this.string.equals(((PostSetupIntentCanceledPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SETUP_INTENT_CANCELED: + return visitor.visitSetupIntentCanceled(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostSetupIntentCanceledPayloadType valueOf(String value) { + switch (value) { + case "setup_intent.canceled": + return SETUP_INTENT_CANCELED; + default: + return new PostSetupIntentCanceledPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + SETUP_INTENT_CANCELED, + + UNKNOWN + } + + public interface Visitor { + T visitSetupIntentCanceled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentRequiresActionPayload.java b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentRequiresActionPayload.java new file mode 100644 index 00000000..2f9d01e7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentRequiresActionPayload.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.SetupIntent; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostSetupIntentRequiresActionPayload.Builder.class) +public final class PostSetupIntentRequiresActionPayload { + private final Optional accountId; + + private final PostSetupIntentRequiresActionPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final SetupIntent data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostSetupIntentRequiresActionPayloadType type; + + private final Map additionalProperties; + + private PostSetupIntentRequiresActionPayload( + Optional accountId, + PostSetupIntentRequiresActionPayloadApiVersion apiVersion, + Optional apiVersionDate, + SetupIntent data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostSetupIntentRequiresActionPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostSetupIntentRequiresActionPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public SetupIntent getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostSetupIntentRequiresActionPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostSetupIntentRequiresActionPayload + && equalTo((PostSetupIntentRequiresActionPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostSetupIntentRequiresActionPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostSetupIntentRequiresActionPayloadApiVersion apiVersion); + + Builder from(PostSetupIntentRequiresActionPayload other); + } + + public interface DataStage { + IdStage data(@NotNull SetupIntent data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostSetupIntentRequiresActionPayloadType type); + } + + public interface _FinalStage { + PostSetupIntentRequiresActionPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostSetupIntentRequiresActionPayloadApiVersion apiVersion; + + private SetupIntent data; + + private String id; + + private OffsetDateTime timestamp; + + private PostSetupIntentRequiresActionPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostSetupIntentRequiresActionPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostSetupIntentRequiresActionPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull SetupIntent data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostSetupIntentRequiresActionPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostSetupIntentRequiresActionPayload build() { + return new PostSetupIntentRequiresActionPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentRequiresActionPayloadApiVersion.java b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentRequiresActionPayloadApiVersion.java new file mode 100644 index 00000000..ab3e07db --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentRequiresActionPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostSetupIntentRequiresActionPayloadApiVersion { + public static final PostSetupIntentRequiresActionPayloadApiVersion V1 = + new PostSetupIntentRequiresActionPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostSetupIntentRequiresActionPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostSetupIntentRequiresActionPayloadApiVersion + && this.string.equals(((PostSetupIntentRequiresActionPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostSetupIntentRequiresActionPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostSetupIntentRequiresActionPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentRequiresActionPayloadType.java b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentRequiresActionPayloadType.java new file mode 100644 index 00000000..9e634bc9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentRequiresActionPayloadType.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostSetupIntentRequiresActionPayloadType { + public static final PostSetupIntentRequiresActionPayloadType SETUP_INTENT_REQUIRES_ACTION = + new PostSetupIntentRequiresActionPayloadType( + Value.SETUP_INTENT_REQUIRES_ACTION, "setup_intent.requires_action"); + + private final Value value; + + private final String string; + + PostSetupIntentRequiresActionPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostSetupIntentRequiresActionPayloadType + && this.string.equals(((PostSetupIntentRequiresActionPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SETUP_INTENT_REQUIRES_ACTION: + return visitor.visitSetupIntentRequiresAction(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostSetupIntentRequiresActionPayloadType valueOf(String value) { + switch (value) { + case "setup_intent.requires_action": + return SETUP_INTENT_REQUIRES_ACTION; + default: + return new PostSetupIntentRequiresActionPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + SETUP_INTENT_REQUIRES_ACTION, + + UNKNOWN + } + + public interface Visitor { + T visitSetupIntentRequiresAction(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentSucceededPayload.java b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentSucceededPayload.java new file mode 100644 index 00000000..65afb70f --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentSucceededPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.SetupIntent; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostSetupIntentSucceededPayload.Builder.class) +public final class PostSetupIntentSucceededPayload { + private final Optional accountId; + + private final PostSetupIntentSucceededPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final SetupIntent data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostSetupIntentSucceededPayloadType type; + + private final Map additionalProperties; + + private PostSetupIntentSucceededPayload( + Optional accountId, + PostSetupIntentSucceededPayloadApiVersion apiVersion, + Optional apiVersionDate, + SetupIntent data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostSetupIntentSucceededPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostSetupIntentSucceededPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public SetupIntent getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostSetupIntentSucceededPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostSetupIntentSucceededPayload && equalTo((PostSetupIntentSucceededPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostSetupIntentSucceededPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostSetupIntentSucceededPayloadApiVersion apiVersion); + + Builder from(PostSetupIntentSucceededPayload other); + } + + public interface DataStage { + IdStage data(@NotNull SetupIntent data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostSetupIntentSucceededPayloadType type); + } + + public interface _FinalStage { + PostSetupIntentSucceededPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostSetupIntentSucceededPayloadApiVersion apiVersion; + + private SetupIntent data; + + private String id; + + private OffsetDateTime timestamp; + + private PostSetupIntentSucceededPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostSetupIntentSucceededPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostSetupIntentSucceededPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull SetupIntent data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostSetupIntentSucceededPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostSetupIntentSucceededPayload build() { + return new PostSetupIntentSucceededPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentSucceededPayloadApiVersion.java b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentSucceededPayloadApiVersion.java new file mode 100644 index 00000000..d9cd9c03 --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentSucceededPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostSetupIntentSucceededPayloadApiVersion { + public static final PostSetupIntentSucceededPayloadApiVersion V1 = + new PostSetupIntentSucceededPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostSetupIntentSucceededPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostSetupIntentSucceededPayloadApiVersion + && this.string.equals(((PostSetupIntentSucceededPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostSetupIntentSucceededPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostSetupIntentSucceededPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentSucceededPayloadType.java b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentSucceededPayloadType.java new file mode 100644 index 00000000..a18d6991 --- /dev/null +++ b/src/main/java/com/whop/api/resources/setupintents/types/PostSetupIntentSucceededPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.setupintents.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostSetupIntentSucceededPayloadType { + public static final PostSetupIntentSucceededPayloadType SETUP_INTENT_SUCCEEDED = + new PostSetupIntentSucceededPayloadType(Value.SETUP_INTENT_SUCCEEDED, "setup_intent.succeeded"); + + private final Value value; + + private final String string; + + PostSetupIntentSucceededPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostSetupIntentSucceededPayloadType + && this.string.equals(((PostSetupIntentSucceededPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SETUP_INTENT_SUCCEEDED: + return visitor.visitSetupIntentSucceeded(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostSetupIntentSucceededPayloadType valueOf(String value) { + switch (value) { + case "setup_intent.succeeded": + return SETUP_INTENT_SUCCEEDED; + default: + return new PostSetupIntentSucceededPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + SETUP_INTENT_SUCCEEDED, + + UNKNOWN + } + + public interface Visitor { + T visitSetupIntentSucceeded(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/AsyncRawShipmentsClient.java b/src/main/java/com/whop/api/resources/shipments/AsyncRawShipmentsClient.java new file mode 100644 index 00000000..e09cdede --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/AsyncRawShipmentsClient.java @@ -0,0 +1,489 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.shipments.requests.CreateShipmentsRequest; +import com.whop.api.resources.shipments.requests.ListShipmentsRequest; +import com.whop.api.resources.shipments.requests.RetrieveShipmentsRequest; +import com.whop.api.resources.shipments.requests.UpdateShipmentsRequest; +import com.whop.api.resources.shipments.types.ListShipmentsResponse; +import com.whop.api.types.Shipment; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawShipmentsClient { + protected final ClientOptions clientOptions; + + public AsyncRawShipmentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of shipments for an account. + */ + public CompletableFuture>> list() { + return list(ListShipmentsRequest.builder().build()); + } + + /** + * Returns a paginated list of shipments for an account. + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(ListShipmentsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of shipments for an account. + */ + public CompletableFuture>> list(ListShipmentsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of shipments for an account. + */ + public CompletableFuture>> list( + ListShipmentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("shipments"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getPaymentId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "payment_id", request.getPaymentId().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListShipmentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListShipmentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListShipmentsRequest nextRequest = ListShipmentsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable(startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Attaches a carrier tracking number to a payment and begins tracking it. + */ + public CompletableFuture> create(CreateShipmentsRequest request) { + return create(request, null); + } + + /** + * Attaches a carrier tracking number to a payment and begins tracking it. + */ + public CompletableFuture> create( + CreateShipmentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("shipments"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Shipment.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveShipmentsRequest.builder().build()); + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveShipmentsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public CompletableFuture> retrieve(String id, RetrieveShipmentsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public CompletableFuture> retrieve( + String id, RetrieveShipmentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("shipments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Shipment.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates a shipment's tracking number and re-tracks it with the carrier. + */ + public CompletableFuture> update(String id, UpdateShipmentsRequest request) { + return update(id, request, null); + } + + /** + * Updates a shipment's tracking number and re-tracks it with the carrier. + */ + public CompletableFuture> update( + String id, UpdateShipmentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("shipments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Shipment.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/AsyncShipmentsClient.java b/src/main/java/com/whop/api/resources/shipments/AsyncShipmentsClient.java new file mode 100644 index 00000000..31e66e30 --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/AsyncShipmentsClient.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.shipments.requests.CreateShipmentsRequest; +import com.whop.api.resources.shipments.requests.ListShipmentsRequest; +import com.whop.api.resources.shipments.requests.RetrieveShipmentsRequest; +import com.whop.api.resources.shipments.requests.UpdateShipmentsRequest; +import com.whop.api.types.Shipment; +import java.util.concurrent.CompletableFuture; + +public class AsyncShipmentsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawShipmentsClient rawClient; + + public AsyncShipmentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawShipmentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawShipmentsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of shipments for an account. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of shipments for an account. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of shipments for an account. + */ + public CompletableFuture> list(ListShipmentsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of shipments for an account. + */ + public CompletableFuture> list( + ListShipmentsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Attaches a carrier tracking number to a payment and begins tracking it. + */ + public CompletableFuture create(CreateShipmentsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Attaches a carrier tracking number to a payment and begins tracking it. + */ + public CompletableFuture create(CreateShipmentsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public CompletableFuture retrieve(String id, RetrieveShipmentsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public CompletableFuture retrieve( + String id, RetrieveShipmentsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates a shipment's tracking number and re-tracks it with the carrier. + */ + public CompletableFuture update(String id, UpdateShipmentsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Updates a shipment's tracking number and re-tracks it with the carrier. + */ + public CompletableFuture update( + String id, UpdateShipmentsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/RawShipmentsClient.java b/src/main/java/com/whop/api/resources/shipments/RawShipmentsClient.java new file mode 100644 index 00000000..626e108c --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/RawShipmentsClient.java @@ -0,0 +1,395 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.shipments.requests.CreateShipmentsRequest; +import com.whop.api.resources.shipments.requests.ListShipmentsRequest; +import com.whop.api.resources.shipments.requests.RetrieveShipmentsRequest; +import com.whop.api.resources.shipments.requests.UpdateShipmentsRequest; +import com.whop.api.resources.shipments.types.ListShipmentsResponse; +import com.whop.api.types.Shipment; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawShipmentsClient { + protected final ClientOptions clientOptions; + + public RawShipmentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of shipments for an account. + */ + public WhopApiHttpResponse> list() { + return list(ListShipmentsRequest.builder().build()); + } + + /** + * Returns a paginated list of shipments for an account. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListShipmentsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of shipments for an account. + */ + public WhopApiHttpResponse> list(ListShipmentsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of shipments for an account. + */ + public WhopApiHttpResponse> list( + ListShipmentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("shipments"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getPaymentId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "payment_id", request.getPaymentId().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListShipmentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListShipmentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListShipmentsRequest nextRequest = ListShipmentsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Attaches a carrier tracking number to a payment and begins tracking it. + */ + public WhopApiHttpResponse create(CreateShipmentsRequest request) { + return create(request, null); + } + + /** + * Attaches a carrier tracking number to a payment and begins tracking it. + */ + public WhopApiHttpResponse create(CreateShipmentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("shipments"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Shipment.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveShipmentsRequest.builder().build()); + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveShipmentsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveShipmentsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveShipmentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("shipments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Shipment.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates a shipment's tracking number and re-tracks it with the carrier. + */ + public WhopApiHttpResponse update(String id, UpdateShipmentsRequest request) { + return update(id, request, null); + } + + /** + * Updates a shipment's tracking number and re-tracks it with the carrier. + */ + public WhopApiHttpResponse update( + String id, UpdateShipmentsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("shipments") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Shipment.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/ShipmentsClient.java b/src/main/java/com/whop/api/resources/shipments/ShipmentsClient.java new file mode 100644 index 00000000..8a9f0be6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/ShipmentsClient.java @@ -0,0 +1,115 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.shipments.requests.CreateShipmentsRequest; +import com.whop.api.resources.shipments.requests.ListShipmentsRequest; +import com.whop.api.resources.shipments.requests.RetrieveShipmentsRequest; +import com.whop.api.resources.shipments.requests.UpdateShipmentsRequest; +import com.whop.api.types.Shipment; + +public class ShipmentsClient { + protected final ClientOptions clientOptions; + + private final RawShipmentsClient rawClient; + + public ShipmentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawShipmentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawShipmentsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of shipments for an account. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Returns a paginated list of shipments for an account. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Returns a paginated list of shipments for an account. + */ + public SyncPagingIterable list(ListShipmentsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of shipments for an account. + */ + public SyncPagingIterable list(ListShipmentsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Attaches a carrier tracking number to a payment and begins tracking it. + */ + public Shipment create(CreateShipmentsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Attaches a carrier tracking number to a payment and begins tracking it. + */ + public Shipment create(CreateShipmentsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public Shipment retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public Shipment retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public Shipment retrieve(String id, RetrieveShipmentsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a shipment by its id, or by the payment id it fulfills. + */ + public Shipment retrieve(String id, RetrieveShipmentsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Updates a shipment's tracking number and re-tracks it with the carrier. + */ + public Shipment update(String id, UpdateShipmentsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Updates a shipment's tracking number and re-tracks it with the carrier. + */ + public Shipment update(String id, UpdateShipmentsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/requests/CreateShipmentsRequest.java b/src/main/java/com/whop/api/resources/shipments/requests/CreateShipmentsRequest.java new file mode 100644 index 00000000..5a2f0c3f --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/requests/CreateShipmentsRequest.java @@ -0,0 +1,211 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateShipmentsRequest.Builder.class) +public final class CreateShipmentsRequest { + private final Optional accountId; + + private final String paymentId; + + private final String trackingNumber; + + private final Map additionalProperties; + + private CreateShipmentsRequest( + Optional accountId, + String paymentId, + String trackingNumber, + Map additionalProperties) { + this.accountId = accountId; + this.paymentId = paymentId; + this.trackingNumber = trackingNumber; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the account, prefixed biz_. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The payment to attach the shipment to, prefixed pay_. + */ + @JsonProperty("payment_id") + public String getPaymentId() { + return paymentId; + } + + /** + * @return The carrier-assigned tracking number. + */ + @JsonProperty("tracking_number") + public String getTrackingNumber() { + return trackingNumber; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateShipmentsRequest && equalTo((CreateShipmentsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateShipmentsRequest other) { + return accountId.equals(other.accountId) + && paymentId.equals(other.paymentId) + && trackingNumber.equals(other.trackingNumber); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.paymentId, this.trackingNumber); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PaymentIdStage builder() { + return new Builder(); + } + + public interface PaymentIdStage { + /** + *

The payment to attach the shipment to, prefixed pay_.

+ */ + TrackingNumberStage paymentId(@NotNull String paymentId); + + Builder from(CreateShipmentsRequest other); + } + + public interface TrackingNumberStage { + /** + *

The carrier-assigned tracking number.

+ */ + _FinalStage trackingNumber(@NotNull String trackingNumber); + } + + public interface _FinalStage { + CreateShipmentsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The unique identifier of the account, prefixed biz_.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PaymentIdStage, TrackingNumberStage, _FinalStage { + private String paymentId; + + private String trackingNumber; + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateShipmentsRequest other) { + accountId(other.getAccountId()); + paymentId(other.getPaymentId()); + trackingNumber(other.getTrackingNumber()); + return this; + } + + /** + *

The payment to attach the shipment to, prefixed pay_.

+ *

The payment to attach the shipment to, prefixed pay_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_id") + public TrackingNumberStage paymentId(@NotNull String paymentId) { + this.paymentId = Objects.requireNonNull(paymentId, "paymentId must not be null"); + return this; + } + + /** + *

The carrier-assigned tracking number.

+ *

The carrier-assigned tracking number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tracking_number") + public _FinalStage trackingNumber(@NotNull String trackingNumber) { + this.trackingNumber = Objects.requireNonNull(trackingNumber, "trackingNumber must not be null"); + return this; + } + + /** + *

The unique identifier of the account, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The unique identifier of the account, prefixed biz_.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public CreateShipmentsRequest build() { + return new CreateShipmentsRequest(accountId, paymentId, trackingNumber, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/requests/ListShipmentsRequest.java b/src/main/java/com/whop/api/resources/shipments/requests/ListShipmentsRequest.java new file mode 100644 index 00000000..975a74bb --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/requests/ListShipmentsRequest.java @@ -0,0 +1,446 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.shipments.types.ListShipmentsRequestDirection; +import com.whop.api.resources.shipments.types.ListShipmentsRequestOrder; +import com.whop.api.resources.shipments.types.ListShipmentsRequestStatus; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListShipmentsRequest.Builder.class) +public final class ListShipmentsRequest { + private final Optional> paymentId; + + private final Optional accountId; + + private final Optional status; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional order; + + private final Optional direction; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListShipmentsRequest( + Optional> paymentId, + Optional accountId, + Optional status, + Optional createdBefore, + Optional createdAfter, + Optional order, + Optional direction, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.paymentId = paymentId; + this.accountId = accountId; + this.status = status; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.order = order; + this.direction = direction; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only shipments fulfilling these payments, each prefixed pay_. Repeat the parameter to pass several, up to 100 per request — one paginated list covers all of them. + */ + @JsonProperty("payment_id") + public Optional> getPaymentId() { + return paymentId; + } + + /** + * @return The account to list shipments for. Defaults to the acting account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Filter to shipments with this delivery status. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Return shipments created before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Return shipments created after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return The field to sort by. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return The sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return The number of shipments to return. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns shipments after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of shipments to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns shipments before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListShipmentsRequest && equalTo((ListShipmentsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListShipmentsRequest other) { + return paymentId.equals(other.paymentId) + && accountId.equals(other.accountId) + && status.equals(other.status) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && order.equals(other.order) + && direction.equals(other.direction) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.paymentId, + this.accountId, + this.status, + this.createdBefore, + this.createdAfter, + this.order, + this.direction, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> paymentId = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListShipmentsRequest other) { + paymentId(other.getPaymentId()); + accountId(other.getAccountId()); + status(other.getStatus()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + order(other.getOrder()); + direction(other.getDirection()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

Only shipments fulfilling these payments, each prefixed pay_. Repeat the parameter to pass several, up to 100 per request — one paginated list covers all of them.

+ */ + @JsonSetter(value = "payment_id", nulls = Nulls.SKIP) + public Builder paymentId(Optional> paymentId) { + this.paymentId = paymentId; + return this; + } + + public Builder paymentId(List paymentId) { + this.paymentId = Optional.ofNullable(paymentId); + return this; + } + + public Builder paymentId(String paymentId) { + this.paymentId = Optional.of(Collections.singletonList(paymentId)); + return this; + } + + /** + *

The account to list shipments for. Defaults to the acting account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Filter to shipments with this delivery status.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListShipmentsRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Return shipments created before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Return shipments created after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

The field to sort by.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListShipmentsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListShipmentsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

The number of shipments to return.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor; returns shipments after this position.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The number of shipments to return from the end of the range.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

A cursor; returns shipments before this position.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListShipmentsRequest build() { + return new ListShipmentsRequest( + paymentId, + accountId, + status, + createdBefore, + createdAfter, + order, + direction, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/requests/RetrieveShipmentsRequest.java b/src/main/java/com/whop/api/resources/shipments/requests/RetrieveShipmentsRequest.java new file mode 100644 index 00000000..449c753b --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/requests/RetrieveShipmentsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveShipmentsRequest.Builder.class) +public final class RetrieveShipmentsRequest { + private final Map additionalProperties; + + private RetrieveShipmentsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveShipmentsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveShipmentsRequest other) { + return this; + } + + public RetrieveShipmentsRequest build() { + return new RetrieveShipmentsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/requests/UpdateShipmentsRequest.java b/src/main/java/com/whop/api/resources/shipments/requests/UpdateShipmentsRequest.java new file mode 100644 index 00000000..d59a24a5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/requests/UpdateShipmentsRequest.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateShipmentsRequest.Builder.class) +public final class UpdateShipmentsRequest { + private final String trackingNumber; + + private final Map additionalProperties; + + private UpdateShipmentsRequest(String trackingNumber, Map additionalProperties) { + this.trackingNumber = trackingNumber; + this.additionalProperties = additionalProperties; + } + + /** + * @return The new carrier-assigned tracking number. + */ + @JsonProperty("tracking_number") + public String getTrackingNumber() { + return trackingNumber; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateShipmentsRequest && equalTo((UpdateShipmentsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateShipmentsRequest other) { + return trackingNumber.equals(other.trackingNumber); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.trackingNumber); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TrackingNumberStage builder() { + return new Builder(); + } + + public interface TrackingNumberStage { + /** + *

The new carrier-assigned tracking number.

+ */ + _FinalStage trackingNumber(@NotNull String trackingNumber); + + Builder from(UpdateShipmentsRequest other); + } + + public interface _FinalStage { + UpdateShipmentsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TrackingNumberStage, _FinalStage { + private String trackingNumber; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateShipmentsRequest other) { + trackingNumber(other.getTrackingNumber()); + return this; + } + + /** + *

The new carrier-assigned tracking number.

+ *

The new carrier-assigned tracking number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tracking_number") + public _FinalStage trackingNumber(@NotNull String trackingNumber) { + this.trackingNumber = Objects.requireNonNull(trackingNumber, "trackingNumber must not be null"); + return this; + } + + @java.lang.Override + public UpdateShipmentsRequest build() { + return new UpdateShipmentsRequest(trackingNumber, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/types/ListShipmentsRequestDirection.java b/src/main/java/com/whop/api/resources/shipments/types/ListShipmentsRequestDirection.java new file mode 100644 index 00000000..844c8c0e --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/types/ListShipmentsRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListShipmentsRequestDirection { + public static final ListShipmentsRequestDirection ASC = new ListShipmentsRequestDirection(Value.ASC, "asc"); + + public static final ListShipmentsRequestDirection DESC = new ListShipmentsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListShipmentsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListShipmentsRequestDirection + && this.string.equals(((ListShipmentsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListShipmentsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListShipmentsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/types/ListShipmentsRequestOrder.java b/src/main/java/com/whop/api/resources/shipments/types/ListShipmentsRequestOrder.java new file mode 100644 index 00000000..0575d430 --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/types/ListShipmentsRequestOrder.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListShipmentsRequestOrder { + public static final ListShipmentsRequestOrder CREATED_AT = + new ListShipmentsRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListShipmentsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListShipmentsRequestOrder + && this.string.equals(((ListShipmentsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListShipmentsRequestOrder valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + default: + return new ListShipmentsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/types/ListShipmentsRequestStatus.java b/src/main/java/com/whop/api/resources/shipments/types/ListShipmentsRequestStatus.java new file mode 100644 index 00000000..88e7ab01 --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/types/ListShipmentsRequestStatus.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListShipmentsRequestStatus { + public static final ListShipmentsRequestStatus DELIVERED = + new ListShipmentsRequestStatus(Value.DELIVERED, "delivered"); + + public static final ListShipmentsRequestStatus FAILURE = new ListShipmentsRequestStatus(Value.FAILURE, "failure"); + + public static final ListShipmentsRequestStatus PRE_TRANSIT = + new ListShipmentsRequestStatus(Value.PRE_TRANSIT, "pre_transit"); + + public static final ListShipmentsRequestStatus UNKNOWN = new ListShipmentsRequestStatus(Value.UNKNOWN, "unknown"); + + public static final ListShipmentsRequestStatus RETURN_TO_SENDER = + new ListShipmentsRequestStatus(Value.RETURN_TO_SENDER, "return_to_sender"); + + public static final ListShipmentsRequestStatus CANCELLED = + new ListShipmentsRequestStatus(Value.CANCELLED, "cancelled"); + + public static final ListShipmentsRequestStatus ERROR = new ListShipmentsRequestStatus(Value.ERROR, "error"); + + public static final ListShipmentsRequestStatus OUT_FOR_DELIVERY = + new ListShipmentsRequestStatus(Value.OUT_FOR_DELIVERY, "out_for_delivery"); + + public static final ListShipmentsRequestStatus AVAILABLE_FOR_PICKUP = + new ListShipmentsRequestStatus(Value.AVAILABLE_FOR_PICKUP, "available_for_pickup"); + + public static final ListShipmentsRequestStatus IN_TRANSIT = + new ListShipmentsRequestStatus(Value.IN_TRANSIT, "in_transit"); + + private final Value value; + + private final String string; + + ListShipmentsRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListShipmentsRequestStatus + && this.string.equals(((ListShipmentsRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DELIVERED: + return visitor.visitDelivered(); + case FAILURE: + return visitor.visitFailure(); + case PRE_TRANSIT: + return visitor.visitPreTransit(); + case UNKNOWN: + return visitor.visitUnknown(); + case RETURN_TO_SENDER: + return visitor.visitReturnToSender(); + case CANCELLED: + return visitor.visitCancelled(); + case ERROR: + return visitor.visitError(); + case OUT_FOR_DELIVERY: + return visitor.visitOutForDelivery(); + case AVAILABLE_FOR_PICKUP: + return visitor.visitAvailableForPickup(); + case IN_TRANSIT: + return visitor.visitInTransit(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListShipmentsRequestStatus valueOf(String value) { + switch (value) { + case "delivered": + return DELIVERED; + case "failure": + return FAILURE; + case "pre_transit": + return PRE_TRANSIT; + case "unknown": + return UNKNOWN; + case "return_to_sender": + return RETURN_TO_SENDER; + case "cancelled": + return CANCELLED; + case "error": + return ERROR; + case "out_for_delivery": + return OUT_FOR_DELIVERY; + case "available_for_pickup": + return AVAILABLE_FOR_PICKUP; + case "in_transit": + return IN_TRANSIT; + default: + return new ListShipmentsRequestStatus(Value._UNKNOWN, value); + } + } + + public enum Value { + UNKNOWN, + + PRE_TRANSIT, + + IN_TRANSIT, + + OUT_FOR_DELIVERY, + + DELIVERED, + + AVAILABLE_FOR_PICKUP, + + RETURN_TO_SENDER, + + FAILURE, + + CANCELLED, + + ERROR, + + _UNKNOWN + } + + public interface Visitor { + T visitUnknown(); + + T visitPreTransit(); + + T visitInTransit(); + + T visitOutForDelivery(); + + T visitDelivered(); + + T visitAvailableForPickup(); + + T visitReturnToSender(); + + T visitFailure(); + + T visitCancelled(); + + T visitError(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/types/ListShipmentsResponse.java b/src/main/java/com/whop/api/resources/shipments/types/ListShipmentsResponse.java new file mode 100644 index 00000000..e7d2e5c4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/types/ListShipmentsResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Shipment; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListShipmentsResponse.Builder.class) +public final class ListShipmentsResponse { + private final List data; + + private final ListShipmentsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListShipmentsResponse( + List data, ListShipmentsResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListShipmentsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListShipmentsResponse && equalTo((ListShipmentsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListShipmentsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListShipmentsResponsePageInfo pageInfo); + + Builder from(ListShipmentsResponse other); + } + + public interface _FinalStage { + ListShipmentsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(Shipment data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListShipmentsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListShipmentsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListShipmentsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(Shipment data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListShipmentsResponse build() { + return new ListShipmentsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/types/ListShipmentsResponsePageInfo.java b/src/main/java/com/whop/api/resources/shipments/types/ListShipmentsResponsePageInfo.java new file mode 100644 index 00000000..c11a84aa --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/types/ListShipmentsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListShipmentsResponsePageInfo.Builder.class) +public final class ListShipmentsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListShipmentsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListShipmentsResponsePageInfo && equalTo((ListShipmentsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListShipmentsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListShipmentsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListShipmentsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListShipmentsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListShipmentsResponsePageInfo build() { + return new ListShipmentsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/types/PostShipmentCreatedPayload.java b/src/main/java/com/whop/api/resources/shipments/types/PostShipmentCreatedPayload.java new file mode 100644 index 00000000..d9379457 --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/types/PostShipmentCreatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Shipment; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostShipmentCreatedPayload.Builder.class) +public final class PostShipmentCreatedPayload { + private final Optional accountId; + + private final PostShipmentCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Shipment data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostShipmentCreatedPayloadType type; + + private final Map additionalProperties; + + private PostShipmentCreatedPayload( + Optional accountId, + PostShipmentCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Shipment data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostShipmentCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostShipmentCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Shipment getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostShipmentCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostShipmentCreatedPayload && equalTo((PostShipmentCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostShipmentCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostShipmentCreatedPayloadApiVersion apiVersion); + + Builder from(PostShipmentCreatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Shipment data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostShipmentCreatedPayloadType type); + } + + public interface _FinalStage { + PostShipmentCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostShipmentCreatedPayloadApiVersion apiVersion; + + private Shipment data; + + private String id; + + private OffsetDateTime timestamp; + + private PostShipmentCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostShipmentCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostShipmentCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Shipment data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostShipmentCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostShipmentCreatedPayload build() { + return new PostShipmentCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/types/PostShipmentCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/shipments/types/PostShipmentCreatedPayloadApiVersion.java new file mode 100644 index 00000000..522f5b85 --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/types/PostShipmentCreatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostShipmentCreatedPayloadApiVersion { + public static final PostShipmentCreatedPayloadApiVersion V1 = + new PostShipmentCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostShipmentCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostShipmentCreatedPayloadApiVersion + && this.string.equals(((PostShipmentCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostShipmentCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostShipmentCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/types/PostShipmentCreatedPayloadType.java b/src/main/java/com/whop/api/resources/shipments/types/PostShipmentCreatedPayloadType.java new file mode 100644 index 00000000..e9042801 --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/types/PostShipmentCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostShipmentCreatedPayloadType { + public static final PostShipmentCreatedPayloadType SHIPMENT_CREATED = + new PostShipmentCreatedPayloadType(Value.SHIPMENT_CREATED, "shipment.created"); + + private final Value value; + + private final String string; + + PostShipmentCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostShipmentCreatedPayloadType + && this.string.equals(((PostShipmentCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SHIPMENT_CREATED: + return visitor.visitShipmentCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostShipmentCreatedPayloadType valueOf(String value) { + switch (value) { + case "shipment.created": + return SHIPMENT_CREATED; + default: + return new PostShipmentCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + SHIPMENT_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitShipmentCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/types/PostShipmentUpdatedPayload.java b/src/main/java/com/whop/api/resources/shipments/types/PostShipmentUpdatedPayload.java new file mode 100644 index 00000000..2c28d573 --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/types/PostShipmentUpdatedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Shipment; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostShipmentUpdatedPayload.Builder.class) +public final class PostShipmentUpdatedPayload { + private final Optional accountId; + + private final PostShipmentUpdatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Shipment data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostShipmentUpdatedPayloadType type; + + private final Map additionalProperties; + + private PostShipmentUpdatedPayload( + Optional accountId, + PostShipmentUpdatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + Shipment data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostShipmentUpdatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostShipmentUpdatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Shipment getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostShipmentUpdatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostShipmentUpdatedPayload && equalTo((PostShipmentUpdatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostShipmentUpdatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostShipmentUpdatedPayloadApiVersion apiVersion); + + Builder from(PostShipmentUpdatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Shipment data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostShipmentUpdatedPayloadType type); + } + + public interface _FinalStage { + PostShipmentUpdatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostShipmentUpdatedPayloadApiVersion apiVersion; + + private Shipment data; + + private String id; + + private OffsetDateTime timestamp; + + private PostShipmentUpdatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostShipmentUpdatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostShipmentUpdatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Shipment data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostShipmentUpdatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostShipmentUpdatedPayload build() { + return new PostShipmentUpdatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/types/PostShipmentUpdatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/shipments/types/PostShipmentUpdatedPayloadApiVersion.java new file mode 100644 index 00000000..6c889b6a --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/types/PostShipmentUpdatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostShipmentUpdatedPayloadApiVersion { + public static final PostShipmentUpdatedPayloadApiVersion V1 = + new PostShipmentUpdatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostShipmentUpdatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostShipmentUpdatedPayloadApiVersion + && this.string.equals(((PostShipmentUpdatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostShipmentUpdatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostShipmentUpdatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/shipments/types/PostShipmentUpdatedPayloadType.java b/src/main/java/com/whop/api/resources/shipments/types/PostShipmentUpdatedPayloadType.java new file mode 100644 index 00000000..433dcf46 --- /dev/null +++ b/src/main/java/com/whop/api/resources/shipments/types/PostShipmentUpdatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.shipments.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostShipmentUpdatedPayloadType { + public static final PostShipmentUpdatedPayloadType SHIPMENT_UPDATED = + new PostShipmentUpdatedPayloadType(Value.SHIPMENT_UPDATED, "shipment.updated"); + + private final Value value; + + private final String string; + + PostShipmentUpdatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostShipmentUpdatedPayloadType + && this.string.equals(((PostShipmentUpdatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SHIPMENT_UPDATED: + return visitor.visitShipmentUpdated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostShipmentUpdatedPayloadType valueOf(String value) { + switch (value) { + case "shipment.updated": + return SHIPMENT_UPDATED; + default: + return new PostShipmentUpdatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + SHIPMENT_UPDATED, + + UNKNOWN + } + + public interface Visitor { + T visitShipmentUpdated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/AsyncRawSocialAccountsClient.java b/src/main/java/com/whop/api/resources/socialaccounts/AsyncRawSocialAccountsClient.java new file mode 100644 index 00000000..09063d82 --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/AsyncRawSocialAccountsClient.java @@ -0,0 +1,704 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.socialaccounts.requests.ConnectSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.CreateSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.DeleteSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.LeadFormsSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.ListSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.PostsSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.types.ConnectSocialAccountsResponse; +import com.whop.api.resources.socialaccounts.types.DeleteSocialAccountsResponse; +import com.whop.api.resources.socialaccounts.types.LeadFormsSocialAccountsResponse; +import com.whop.api.resources.socialaccounts.types.ListSocialAccountsResponse; +import com.whop.api.resources.socialaccounts.types.PostsSocialAccountsResponse; +import com.whop.api.types.SocialAccount; +import com.whop.api.types.SocialAccountPost; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawSocialAccountsClient { + protected final ClientOptions clientOptions; + + public AsyncRawSocialAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the social accounts linked to an account or user. + */ + public CompletableFuture>> list() { + return list(ListSocialAccountsRequest.builder().build()); + } + + /** + * Lists the social accounts linked to an account or user. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListSocialAccountsRequest.builder().build(), requestOptions); + } + + /** + * Lists the social accounts linked to an account or user. + */ + public CompletableFuture>> list( + ListSocialAccountsRequest request) { + return list(request, null); + } + + /** + * Lists the social accounts linked to an account or user. + */ + public CompletableFuture>> list( + ListSocialAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("social_accounts"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getPlatform().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "platform", request.getPlatform().get(), false); + } + if (request.getVerified().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "verified", request.getVerified().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getScopes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "scopes", request.getScopes().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListSocialAccountsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListSocialAccountsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListSocialAccountsRequest nextRequest = ListSocialAccountsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates or returns a Whop-managed Facebook page for an account. + */ + public CompletableFuture> create(CreateSocialAccountsRequest request) { + return create(request, null); + } + + /** + * Creates or returns a Whop-managed Facebook page for an account. + */ + public CompletableFuture> create( + CreateSocialAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("social_accounts"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SocialAccount.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Starts an OAuth connection flow and returns an authorize_url where the user can connect a social account. + */ + public CompletableFuture> connect( + ConnectSocialAccountsRequest request) { + return connect(request, null); + } + + /** + * Starts an OAuth connection flow and returns an authorize_url where the user can connect a social account. + */ + public CompletableFuture> connect( + ConnectSocialAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("social_accounts/connect"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ConnectSocialAccountsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteSocialAccountsRequest.builder().build()); + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public CompletableFuture> delete( + String id, RequestOptions requestOptions) { + return delete(id, DeleteSocialAccountsRequest.builder().build(), requestOptions); + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public CompletableFuture> delete( + String id, DeleteSocialAccountsRequest request) { + return delete(id, request, null); + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public CompletableFuture> delete( + String id, DeleteSocialAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("social_accounts") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DeleteSocialAccountsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Lists the active lead (instant) forms that already exist on a connected Facebook page, so an ad can reuse one as its lead_gen_form_id instead of authoring a new form. Every active form comes back in a single response — the list is not paginated. + */ + public CompletableFuture> leadForms( + String id, LeadFormsSocialAccountsRequest request) { + return leadForms(id, request, null); + } + + /** + * Lists the active lead (instant) forms that already exist on a connected Facebook page, so an ad can reuse one as its lead_gen_form_id instead of authoring a new form. Every active form comes back in a single response — the list is not paginated. + */ + public CompletableFuture> leadForms( + String id, LeadFormsSocialAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("social_accounts") + .addPathSegment(id) + .addPathSegments("lead_forms"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, LeadFormsSocialAccountsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Lists the existing posts of a connected Facebook page, Instagram account, or TikTok account. + */ + public CompletableFuture>> posts( + String id, PostsSocialAccountsRequest request) { + return posts(id, request, null); + } + + /** + * Lists the existing posts of a connected Facebook page, Instagram account, or TikTok account. + */ + public CompletableFuture>> posts( + String id, PostsSocialAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("social_accounts") + .addPathSegment(id) + .addPathSegments("posts"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getPostId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "post_id", request.getPostId().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + PostsSocialAccountsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, PostsSocialAccountsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + PostsSocialAccountsRequest nextRequest = PostsSocialAccountsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return posts(id, nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/AsyncSocialAccountsClient.java b/src/main/java/com/whop/api/resources/socialaccounts/AsyncSocialAccountsClient.java new file mode 100644 index 00000000..570fbd0a --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/AsyncSocialAccountsClient.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.socialaccounts.requests.ConnectSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.CreateSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.DeleteSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.LeadFormsSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.ListSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.PostsSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.types.ConnectSocialAccountsResponse; +import com.whop.api.resources.socialaccounts.types.DeleteSocialAccountsResponse; +import com.whop.api.resources.socialaccounts.types.LeadFormsSocialAccountsResponse; +import com.whop.api.types.SocialAccount; +import com.whop.api.types.SocialAccountPost; +import java.util.concurrent.CompletableFuture; + +public class AsyncSocialAccountsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawSocialAccountsClient rawClient; + + public AsyncSocialAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawSocialAccountsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawSocialAccountsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the social accounts linked to an account or user. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the social accounts linked to an account or user. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the social accounts linked to an account or user. + */ + public CompletableFuture> list(ListSocialAccountsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the social accounts linked to an account or user. + */ + public CompletableFuture> list( + ListSocialAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates or returns a Whop-managed Facebook page for an account. + */ + public CompletableFuture create(CreateSocialAccountsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Creates or returns a Whop-managed Facebook page for an account. + */ + public CompletableFuture create(CreateSocialAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Starts an OAuth connection flow and returns an authorize_url where the user can connect a social account. + */ + public CompletableFuture connect(ConnectSocialAccountsRequest request) { + return this.rawClient.connect(request).thenApply(response -> response.body()); + } + + /** + * Starts an OAuth connection flow and returns an authorize_url where the user can connect a social account. + */ + public CompletableFuture connect( + ConnectSocialAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.connect(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public CompletableFuture delete(String id, DeleteSocialAccountsRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public CompletableFuture delete( + String id, DeleteSocialAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the active lead (instant) forms that already exist on a connected Facebook page, so an ad can reuse one as its lead_gen_form_id instead of authoring a new form. Every active form comes back in a single response — the list is not paginated. + */ + public CompletableFuture leadForms( + String id, LeadFormsSocialAccountsRequest request) { + return this.rawClient.leadForms(id, request).thenApply(response -> response.body()); + } + + /** + * Lists the active lead (instant) forms that already exist on a connected Facebook page, so an ad can reuse one as its lead_gen_form_id instead of authoring a new form. Every active form comes back in a single response — the list is not paginated. + */ + public CompletableFuture leadForms( + String id, LeadFormsSocialAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.leadForms(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the existing posts of a connected Facebook page, Instagram account, or TikTok account. + */ + public CompletableFuture> posts( + String id, PostsSocialAccountsRequest request) { + return this.rawClient.posts(id, request).thenApply(response -> response.body()); + } + + /** + * Lists the existing posts of a connected Facebook page, Instagram account, or TikTok account. + */ + public CompletableFuture> posts( + String id, PostsSocialAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.posts(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/RawSocialAccountsClient.java b/src/main/java/com/whop/api/resources/socialaccounts/RawSocialAccountsClient.java new file mode 100644 index 00000000..13ac5d5b --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/RawSocialAccountsClient.java @@ -0,0 +1,561 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.socialaccounts.requests.ConnectSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.CreateSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.DeleteSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.LeadFormsSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.ListSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.PostsSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.types.ConnectSocialAccountsResponse; +import com.whop.api.resources.socialaccounts.types.DeleteSocialAccountsResponse; +import com.whop.api.resources.socialaccounts.types.LeadFormsSocialAccountsResponse; +import com.whop.api.resources.socialaccounts.types.ListSocialAccountsResponse; +import com.whop.api.resources.socialaccounts.types.PostsSocialAccountsResponse; +import com.whop.api.types.SocialAccount; +import com.whop.api.types.SocialAccountPost; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawSocialAccountsClient { + protected final ClientOptions clientOptions; + + public RawSocialAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the social accounts linked to an account or user. + */ + public WhopApiHttpResponse> list() { + return list(ListSocialAccountsRequest.builder().build()); + } + + /** + * Lists the social accounts linked to an account or user. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListSocialAccountsRequest.builder().build(), requestOptions); + } + + /** + * Lists the social accounts linked to an account or user. + */ + public WhopApiHttpResponse> list(ListSocialAccountsRequest request) { + return list(request, null); + } + + /** + * Lists the social accounts linked to an account or user. + */ + public WhopApiHttpResponse> list( + ListSocialAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("social_accounts"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getPlatform().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "platform", request.getPlatform().get(), false); + } + if (request.getVerified().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "verified", request.getVerified().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getScopes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "scopes", request.getScopes().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListSocialAccountsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListSocialAccountsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListSocialAccountsRequest nextRequest = ListSocialAccountsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates or returns a Whop-managed Facebook page for an account. + */ + public WhopApiHttpResponse create(CreateSocialAccountsRequest request) { + return create(request, null); + } + + /** + * Creates or returns a Whop-managed Facebook page for an account. + */ + public WhopApiHttpResponse create( + CreateSocialAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("social_accounts"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SocialAccount.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Starts an OAuth connection flow and returns an authorize_url where the user can connect a social account. + */ + public WhopApiHttpResponse connect(ConnectSocialAccountsRequest request) { + return connect(request, null); + } + + /** + * Starts an OAuth connection flow and returns an authorize_url where the user can connect a social account. + */ + public WhopApiHttpResponse connect( + ConnectSocialAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("social_accounts/connect"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ConnectSocialAccountsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteSocialAccountsRequest.builder().build()); + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteSocialAccountsRequest.builder().build(), requestOptions); + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public WhopApiHttpResponse delete(String id, DeleteSocialAccountsRequest request) { + return delete(id, request, null); + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public WhopApiHttpResponse delete( + String id, DeleteSocialAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("social_accounts") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteSocialAccountsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Lists the active lead (instant) forms that already exist on a connected Facebook page, so an ad can reuse one as its lead_gen_form_id instead of authoring a new form. Every active form comes back in a single response — the list is not paginated. + */ + public WhopApiHttpResponse leadForms( + String id, LeadFormsSocialAccountsRequest request) { + return leadForms(id, request, null); + } + + /** + * Lists the active lead (instant) forms that already exist on a connected Facebook page, so an ad can reuse one as its lead_gen_form_id instead of authoring a new form. Every active form comes back in a single response — the list is not paginated. + */ + public WhopApiHttpResponse leadForms( + String id, LeadFormsSocialAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("social_accounts") + .addPathSegment(id) + .addPathSegments("lead_forms"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LeadFormsSocialAccountsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Lists the existing posts of a connected Facebook page, Instagram account, or TikTok account. + */ + public WhopApiHttpResponse> posts( + String id, PostsSocialAccountsRequest request) { + return posts(id, request, null); + } + + /** + * Lists the existing posts of a connected Facebook page, Instagram account, or TikTok account. + */ + public WhopApiHttpResponse> posts( + String id, PostsSocialAccountsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("social_accounts") + .addPathSegment(id) + .addPathSegments("posts"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getPostId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "post_id", request.getPostId().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + PostsSocialAccountsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PostsSocialAccountsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + PostsSocialAccountsRequest nextRequest = PostsSocialAccountsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> posts( + id, nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/SocialAccountsClient.java b/src/main/java/com/whop/api/resources/socialaccounts/SocialAccountsClient.java new file mode 100644 index 00000000..c5eaddc6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/SocialAccountsClient.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.socialaccounts.requests.ConnectSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.CreateSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.DeleteSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.LeadFormsSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.ListSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.requests.PostsSocialAccountsRequest; +import com.whop.api.resources.socialaccounts.types.ConnectSocialAccountsResponse; +import com.whop.api.resources.socialaccounts.types.DeleteSocialAccountsResponse; +import com.whop.api.resources.socialaccounts.types.LeadFormsSocialAccountsResponse; +import com.whop.api.types.SocialAccount; +import com.whop.api.types.SocialAccountPost; + +public class SocialAccountsClient { + protected final ClientOptions clientOptions; + + private final RawSocialAccountsClient rawClient; + + public SocialAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawSocialAccountsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawSocialAccountsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the social accounts linked to an account or user. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the social accounts linked to an account or user. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the social accounts linked to an account or user. + */ + public SyncPagingIterable list(ListSocialAccountsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the social accounts linked to an account or user. + */ + public SyncPagingIterable list(ListSocialAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Creates or returns a Whop-managed Facebook page for an account. + */ + public SocialAccount create(CreateSocialAccountsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Creates or returns a Whop-managed Facebook page for an account. + */ + public SocialAccount create(CreateSocialAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Starts an OAuth connection flow and returns an authorize_url where the user can connect a social account. + */ + public ConnectSocialAccountsResponse connect(ConnectSocialAccountsRequest request) { + return this.rawClient.connect(request).body(); + } + + /** + * Starts an OAuth connection flow and returns an authorize_url where the user can connect a social account. + */ + public ConnectSocialAccountsResponse connect(ConnectSocialAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.connect(request, requestOptions).body(); + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public DeleteSocialAccountsResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public DeleteSocialAccountsResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public DeleteSocialAccountsResponse delete(String id, DeleteSocialAccountsRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Disconnects a social account from an account or user without deleting the underlying platform account. + */ + public DeleteSocialAccountsResponse delete( + String id, DeleteSocialAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Lists the active lead (instant) forms that already exist on a connected Facebook page, so an ad can reuse one as its lead_gen_form_id instead of authoring a new form. Every active form comes back in a single response — the list is not paginated. + */ + public LeadFormsSocialAccountsResponse leadForms(String id, LeadFormsSocialAccountsRequest request) { + return this.rawClient.leadForms(id, request).body(); + } + + /** + * Lists the active lead (instant) forms that already exist on a connected Facebook page, so an ad can reuse one as its lead_gen_form_id instead of authoring a new form. Every active form comes back in a single response — the list is not paginated. + */ + public LeadFormsSocialAccountsResponse leadForms( + String id, LeadFormsSocialAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.leadForms(id, request, requestOptions).body(); + } + + /** + * Lists the existing posts of a connected Facebook page, Instagram account, or TikTok account. + */ + public SyncPagingIterable posts(String id, PostsSocialAccountsRequest request) { + return this.rawClient.posts(id, request).body(); + } + + /** + * Lists the existing posts of a connected Facebook page, Instagram account, or TikTok account. + */ + public SyncPagingIterable posts( + String id, PostsSocialAccountsRequest request, RequestOptions requestOptions) { + return this.rawClient.posts(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/requests/ConnectSocialAccountsRequest.java b/src/main/java/com/whop/api/resources/socialaccounts/requests/ConnectSocialAccountsRequest.java new file mode 100644 index 00000000..5f25a6c3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/requests/ConnectSocialAccountsRequest.java @@ -0,0 +1,265 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.socialaccounts.types.ConnectSocialAccountsRequestPlatform; +import com.whop.api.resources.socialaccounts.types.ConnectSocialAccountsRequestScopesItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConnectSocialAccountsRequest.Builder.class) +public final class ConnectSocialAccountsRequest { + private final Optional accountId; + + private final ConnectSocialAccountsRequestPlatform platform; + + private final Optional redirectUrl; + + private final Optional> scopes; + + private final Map additionalProperties; + + private ConnectSocialAccountsRequest( + Optional accountId, + ConnectSocialAccountsRequestPlatform platform, + Optional redirectUrl, + Optional> scopes, + Map additionalProperties) { + this.accountId = accountId; + this.platform = platform; + this.redirectUrl = redirectUrl; + this.scopes = scopes; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Account (biz_ identifier) to connect the social account for. An account-scoped API key may omit this to default to its own account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The platform to connect the social account on. Supported options are meta_business and tiktok. + */ + @JsonProperty("platform") + public ConnectSocialAccountsRequestPlatform getPlatform() { + return platform; + } + + /** + * @return The Whop URL to redirect the user to after they finish connecting. + */ + @JsonProperty("redirect_url") + public Optional getRedirectUrl() { + return redirectUrl; + } + + /** + * @return Capabilities to grant for the connected social account. Use advertise when connecting a Meta Business or TikTok account for ads. + */ + @JsonProperty("scopes") + public Optional> getScopes() { + return scopes; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConnectSocialAccountsRequest && equalTo((ConnectSocialAccountsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConnectSocialAccountsRequest other) { + return accountId.equals(other.accountId) + && platform.equals(other.platform) + && redirectUrl.equals(other.redirectUrl) + && scopes.equals(other.scopes); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.platform, this.redirectUrl, this.scopes); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlatformStage builder() { + return new Builder(); + } + + public interface PlatformStage { + /** + *

The platform to connect the social account on. Supported options are meta_business and tiktok.

+ */ + _FinalStage platform(@NotNull ConnectSocialAccountsRequestPlatform platform); + + Builder from(ConnectSocialAccountsRequest other); + } + + public interface _FinalStage { + ConnectSocialAccountsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The Account (biz_ identifier) to connect the social account for. An account-scoped API key may omit this to default to its own account.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + /** + *

The Whop URL to redirect the user to after they finish connecting.

+ */ + _FinalStage redirectUrl(Optional redirectUrl); + + _FinalStage redirectUrl(String redirectUrl); + + /** + *

Capabilities to grant for the connected social account. Use advertise when connecting a Meta Business or TikTok account for ads.

+ */ + _FinalStage scopes(Optional> scopes); + + _FinalStage scopes(List scopes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlatformStage, _FinalStage { + private ConnectSocialAccountsRequestPlatform platform; + + private Optional> scopes = Optional.empty(); + + private Optional redirectUrl = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConnectSocialAccountsRequest other) { + accountId(other.getAccountId()); + platform(other.getPlatform()); + redirectUrl(other.getRedirectUrl()); + scopes(other.getScopes()); + return this; + } + + /** + *

The platform to connect the social account on. Supported options are meta_business and tiktok.

+ *

The platform to connect the social account on. Supported options are meta_business and tiktok.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public _FinalStage platform(@NotNull ConnectSocialAccountsRequestPlatform platform) { + this.platform = Objects.requireNonNull(platform, "platform must not be null"); + return this; + } + + /** + *

Capabilities to grant for the connected social account. Use advertise when connecting a Meta Business or TikTok account for ads.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage scopes(List scopes) { + this.scopes = Optional.ofNullable(scopes); + return this; + } + + /** + *

Capabilities to grant for the connected social account. Use advertise when connecting a Meta Business or TikTok account for ads.

+ */ + @java.lang.Override + @JsonSetter(value = "scopes", nulls = Nulls.SKIP) + public _FinalStage scopes(Optional> scopes) { + this.scopes = scopes; + return this; + } + + /** + *

The Whop URL to redirect the user to after they finish connecting.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectUrl(String redirectUrl) { + this.redirectUrl = Optional.ofNullable(redirectUrl); + return this; + } + + /** + *

The Whop URL to redirect the user to after they finish connecting.

+ */ + @java.lang.Override + @JsonSetter(value = "redirect_url", nulls = Nulls.SKIP) + public _FinalStage redirectUrl(Optional redirectUrl) { + this.redirectUrl = redirectUrl; + return this; + } + + /** + *

The Account (biz_ identifier) to connect the social account for. An account-scoped API key may omit this to default to its own account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The Account (biz_ identifier) to connect the social account for. An account-scoped API key may omit this to default to its own account.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public ConnectSocialAccountsRequest build() { + return new ConnectSocialAccountsRequest(accountId, platform, redirectUrl, scopes, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/requests/CreateSocialAccountsRequest.java b/src/main/java/com/whop/api/resources/socialaccounts/requests/CreateSocialAccountsRequest.java new file mode 100644 index 00000000..4dd44d1d --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/requests/CreateSocialAccountsRequest.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.socialaccounts.types.CreateSocialAccountsRequestPlatform; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSocialAccountsRequest.Builder.class) +public final class CreateSocialAccountsRequest { + private final Optional accountId; + + private final CreateSocialAccountsRequestPlatform platform; + + private final Map additionalProperties; + + private CreateSocialAccountsRequest( + Optional accountId, + CreateSocialAccountsRequestPlatform platform, + Map additionalProperties) { + this.accountId = accountId; + this.platform = platform; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Account (biz_ identifier) to create the social account for. An account-scoped API key may omit this to default to its own account. Account API keys cannot update their own account's branding through Update Account; use a user-authenticated path. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The platform to create the social account on. facebook requires the account's banner_image, logo, and description; configure them with Update Account. + */ + @JsonProperty("platform") + public CreateSocialAccountsRequestPlatform getPlatform() { + return platform; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSocialAccountsRequest && equalTo((CreateSocialAccountsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSocialAccountsRequest other) { + return accountId.equals(other.accountId) && platform.equals(other.platform); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.platform); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlatformStage builder() { + return new Builder(); + } + + public interface PlatformStage { + /** + *

The platform to create the social account on. facebook requires the account's banner_image, logo, and description; configure them with Update Account.

+ */ + _FinalStage platform(@NotNull CreateSocialAccountsRequestPlatform platform); + + Builder from(CreateSocialAccountsRequest other); + } + + public interface _FinalStage { + CreateSocialAccountsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The Account (biz_ identifier) to create the social account for. An account-scoped API key may omit this to default to its own account. Account API keys cannot update their own account's branding through Update Account; use a user-authenticated path.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlatformStage, _FinalStage { + private CreateSocialAccountsRequestPlatform platform; + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateSocialAccountsRequest other) { + accountId(other.getAccountId()); + platform(other.getPlatform()); + return this; + } + + /** + *

The platform to create the social account on. facebook requires the account's banner_image, logo, and description; configure them with Update Account.

+ *

The platform to create the social account on. facebook requires the account's banner_image, logo, and description; configure them with Update Account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public _FinalStage platform(@NotNull CreateSocialAccountsRequestPlatform platform) { + this.platform = Objects.requireNonNull(platform, "platform must not be null"); + return this; + } + + /** + *

The Account (biz_ identifier) to create the social account for. An account-scoped API key may omit this to default to its own account. Account API keys cannot update their own account's branding through Update Account; use a user-authenticated path.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The Account (biz_ identifier) to create the social account for. An account-scoped API key may omit this to default to its own account. Account API keys cannot update their own account's branding through Update Account; use a user-authenticated path.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public CreateSocialAccountsRequest build() { + return new CreateSocialAccountsRequest(accountId, platform, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/requests/DeleteSocialAccountsRequest.java b/src/main/java/com/whop/api/resources/socialaccounts/requests/DeleteSocialAccountsRequest.java new file mode 100644 index 00000000..715c40a7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/requests/DeleteSocialAccountsRequest.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteSocialAccountsRequest.Builder.class) +public final class DeleteSocialAccountsRequest { + private final Optional accountId; + + private final Optional userId; + + private final Map additionalProperties; + + private DeleteSocialAccountsRequest( + Optional accountId, Optional userId, Map additionalProperties) { + this.accountId = accountId; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Account that the social account is connected to. Provide either this or user_id. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The User that the social account is connected to. Provide either this or account_id. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteSocialAccountsRequest && equalTo((DeleteSocialAccountsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteSocialAccountsRequest other) { + return accountId.equals(other.accountId) && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional userId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteSocialAccountsRequest other) { + accountId(other.getAccountId()); + userId(other.getUserId()); + return this; + } + + /** + *

The Account that the social account is connected to. Provide either this or user_id.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The User that the social account is connected to. Provide either this or account_id.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + public DeleteSocialAccountsRequest build() { + return new DeleteSocialAccountsRequest(accountId, userId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/requests/LeadFormsSocialAccountsRequest.java b/src/main/java/com/whop/api/resources/socialaccounts/requests/LeadFormsSocialAccountsRequest.java new file mode 100644 index 00000000..63e063e0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/requests/LeadFormsSocialAccountsRequest.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeadFormsSocialAccountsRequest.Builder.class) +public final class LeadFormsSocialAccountsRequest { + private final String accountId; + + private final Map additionalProperties; + + private LeadFormsSocialAccountsRequest(String accountId, Map additionalProperties) { + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Account (a biz_ identifier) the social account is connected to. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeadFormsSocialAccountsRequest && equalTo((LeadFormsSocialAccountsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeadFormsSocialAccountsRequest other) { + return accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

The Account (a biz_ identifier) the social account is connected to.

+ */ + _FinalStage accountId(@NotNull String accountId); + + Builder from(LeadFormsSocialAccountsRequest other); + } + + public interface _FinalStage { + LeadFormsSocialAccountsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, _FinalStage { + private String accountId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LeadFormsSocialAccountsRequest other) { + accountId(other.getAccountId()); + return this; + } + + /** + *

The Account (a biz_ identifier) the social account is connected to.

+ *

The Account (a biz_ identifier) the social account is connected to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + public LeadFormsSocialAccountsRequest build() { + return new LeadFormsSocialAccountsRequest(accountId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/requests/ListSocialAccountsRequest.java b/src/main/java/com/whop/api/resources/socialaccounts/requests/ListSocialAccountsRequest.java new file mode 100644 index 00000000..29259d4f --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/requests/ListSocialAccountsRequest.java @@ -0,0 +1,447 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.socialaccounts.types.ListSocialAccountsRequestDirection; +import com.whop.api.resources.socialaccounts.types.ListSocialAccountsRequestOrder; +import com.whop.api.resources.socialaccounts.types.ListSocialAccountsRequestPlatform; +import com.whop.api.resources.socialaccounts.types.ListSocialAccountsRequestScopesItem; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSocialAccountsRequest.Builder.class) +public final class ListSocialAccountsRequest { + private final Optional> scopes; + + private final Optional accountId; + + private final Optional userId; + + private final Optional platform; + + private final Optional verified; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Optional order; + + private final Optional direction; + + private final Map additionalProperties; + + private ListSocialAccountsRequest( + Optional> scopes, + Optional accountId, + Optional userId, + Optional platform, + Optional verified, + Optional first, + Optional after, + Optional last, + Optional before, + Optional order, + Optional direction, + Map additionalProperties) { + this.scopes = scopes; + this.accountId = accountId; + this.userId = userId; + this.platform = platform; + this.verified = verified; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.order = order; + this.direction = direction; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only return social accounts that have these scopes. + */ + @JsonProperty("scopes") + public Optional> getScopes() { + return scopes; + } + + /** + * @return The Account that the social accounts are connected to. Provide either this or user_id. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The User that the social accounts are connected to. Provide either this or account_id. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + /** + * @return Only return social accounts for the platform that is specified. + */ + @JsonProperty("platform") + public Optional getPlatform() { + return platform; + } + + /** + * @return Only return social accounts that are verified on the platform. + */ + @JsonProperty("verified") + public Optional getVerified() { + return verified; + } + + /** + * @return The number of social accounts to return. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to fetch the page after (from page_info.end_cursor). + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of social accounts to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to fetch the page before (from page_info.start_cursor). + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The field to sort social accounts by. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSocialAccountsRequest && equalTo((ListSocialAccountsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSocialAccountsRequest other) { + return scopes.equals(other.scopes) + && accountId.equals(other.accountId) + && userId.equals(other.userId) + && platform.equals(other.platform) + && verified.equals(other.verified) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before) + && order.equals(other.order) + && direction.equals(other.direction); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.scopes, + this.accountId, + this.userId, + this.platform, + this.verified, + this.first, + this.after, + this.last, + this.before, + this.order, + this.direction); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> scopes = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional platform = Optional.empty(); + + private Optional verified = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListSocialAccountsRequest other) { + scopes(other.getScopes()); + accountId(other.getAccountId()); + userId(other.getUserId()); + platform(other.getPlatform()); + verified(other.getVerified()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + order(other.getOrder()); + direction(other.getDirection()); + return this; + } + + /** + *

Only return social accounts that have these scopes.

+ */ + @JsonSetter(value = "scopes", nulls = Nulls.SKIP) + public Builder scopes(Optional> scopes) { + this.scopes = scopes; + return this; + } + + public Builder scopes(List scopes) { + this.scopes = Optional.ofNullable(scopes); + return this; + } + + public Builder scopes(ListSocialAccountsRequestScopesItem scopes) { + this.scopes = Optional.of(Collections.singletonList(scopes)); + return this; + } + + /** + *

The Account that the social accounts are connected to. Provide either this or user_id.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The User that the social accounts are connected to. Provide either this or account_id.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Only return social accounts for the platform that is specified.

+ */ + @JsonSetter(value = "platform", nulls = Nulls.SKIP) + public Builder platform(Optional platform) { + this.platform = platform; + return this; + } + + public Builder platform(ListSocialAccountsRequestPlatform platform) { + this.platform = Optional.ofNullable(platform); + return this; + } + + /** + *

Only return social accounts that are verified on the platform.

+ */ + @JsonSetter(value = "verified", nulls = Nulls.SKIP) + public Builder verified(Optional verified) { + this.verified = verified; + return this; + } + + public Builder verified(Boolean verified) { + this.verified = Optional.ofNullable(verified); + return this; + } + + /** + *

The number of social accounts to return.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The number of social accounts to return from the end of the range.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to fetch the page before (from page_info.start_cursor).

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The field to sort social accounts by.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListSocialAccountsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListSocialAccountsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + public ListSocialAccountsRequest build() { + return new ListSocialAccountsRequest( + scopes, + accountId, + userId, + platform, + verified, + first, + after, + last, + before, + order, + direction, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/requests/PostsSocialAccountsRequest.java b/src/main/java/com/whop/api/resources/socialaccounts/requests/PostsSocialAccountsRequest.java new file mode 100644 index 00000000..ffe126e3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/requests/PostsSocialAccountsRequest.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostsSocialAccountsRequest.Builder.class) +public final class PostsSocialAccountsRequest { + private final String accountId; + + private final Optional postId; + + private final Optional first; + + private final Optional after; + + private final Map additionalProperties; + + private PostsSocialAccountsRequest( + String accountId, + Optional postId, + Optional first, + Optional after, + Map additionalProperties) { + this.accountId = accountId; + this.postId = postId; + this.first = first; + this.after = after; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Account (a biz_ identifier) the social account is connected to. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Return only the single post with this platform id, instead of the full list. + */ + @JsonProperty("post_id") + public Optional getPostId() { + return postId; + } + + /** + * @return The number of posts to return. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to fetch the page after (from page_info.end_cursor). + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostsSocialAccountsRequest && equalTo((PostsSocialAccountsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostsSocialAccountsRequest other) { + return accountId.equals(other.accountId) + && postId.equals(other.postId) + && first.equals(other.first) + && after.equals(other.after); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.postId, this.first, this.after); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

The Account (a biz_ identifier) the social account is connected to.

+ */ + _FinalStage accountId(@NotNull String accountId); + + Builder from(PostsSocialAccountsRequest other); + } + + public interface _FinalStage { + PostsSocialAccountsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Return only the single post with this platform id, instead of the full list.

+ */ + _FinalStage postId(Optional postId); + + _FinalStage postId(String postId); + + /** + *

The number of posts to return.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, _FinalStage { + private String accountId; + + private Optional after = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional postId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostsSocialAccountsRequest other) { + accountId(other.getAccountId()); + postId(other.getPostId()); + first(other.getFirst()); + after(other.getAfter()); + return this; + } + + /** + *

The Account (a biz_ identifier) the social account is connected to.

+ *

The Account (a biz_ identifier) the social account is connected to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + /** + *

The number of posts to return.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

The number of posts to return.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Return only the single post with this platform id, instead of the full list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage postId(String postId) { + this.postId = Optional.ofNullable(postId); + return this; + } + + /** + *

Return only the single post with this platform id, instead of the full list.

+ */ + @java.lang.Override + @JsonSetter(value = "post_id", nulls = Nulls.SKIP) + public _FinalStage postId(Optional postId) { + this.postId = postId; + return this; + } + + @java.lang.Override + public PostsSocialAccountsRequest build() { + return new PostsSocialAccountsRequest(accountId, postId, first, after, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/types/ConnectSocialAccountsRequestPlatform.java b/src/main/java/com/whop/api/resources/socialaccounts/types/ConnectSocialAccountsRequestPlatform.java new file mode 100644 index 00000000..de52a4c4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/types/ConnectSocialAccountsRequestPlatform.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ConnectSocialAccountsRequestPlatform { + public static final ConnectSocialAccountsRequestPlatform META_BUSINESS = + new ConnectSocialAccountsRequestPlatform(Value.META_BUSINESS, "meta_business"); + + public static final ConnectSocialAccountsRequestPlatform TIKTOK = + new ConnectSocialAccountsRequestPlatform(Value.TIKTOK, "tiktok"); + + private final Value value; + + private final String string; + + ConnectSocialAccountsRequestPlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ConnectSocialAccountsRequestPlatform + && this.string.equals(((ConnectSocialAccountsRequestPlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case META_BUSINESS: + return visitor.visitMetaBusiness(); + case TIKTOK: + return visitor.visitTiktok(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ConnectSocialAccountsRequestPlatform valueOf(String value) { + switch (value) { + case "meta_business": + return META_BUSINESS; + case "tiktok": + return TIKTOK; + default: + return new ConnectSocialAccountsRequestPlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + META_BUSINESS, + + TIKTOK, + + UNKNOWN + } + + public interface Visitor { + T visitMetaBusiness(); + + T visitTiktok(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/types/ConnectSocialAccountsRequestScopesItem.java b/src/main/java/com/whop/api/resources/socialaccounts/types/ConnectSocialAccountsRequestScopesItem.java new file mode 100644 index 00000000..e3630ea5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/types/ConnectSocialAccountsRequestScopesItem.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ConnectSocialAccountsRequestScopesItem { + public static final ConnectSocialAccountsRequestScopesItem ADVERTISE = + new ConnectSocialAccountsRequestScopesItem(Value.ADVERTISE, "advertise"); + + private final Value value; + + private final String string; + + ConnectSocialAccountsRequestScopesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ConnectSocialAccountsRequestScopesItem + && this.string.equals(((ConnectSocialAccountsRequestScopesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ADVERTISE: + return visitor.visitAdvertise(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ConnectSocialAccountsRequestScopesItem valueOf(String value) { + switch (value) { + case "advertise": + return ADVERTISE; + default: + return new ConnectSocialAccountsRequestScopesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + ADVERTISE, + + UNKNOWN + } + + public interface Visitor { + T visitAdvertise(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/types/ConnectSocialAccountsResponse.java b/src/main/java/com/whop/api/resources/socialaccounts/types/ConnectSocialAccountsResponse.java new file mode 100644 index 00000000..1c7339cb --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/types/ConnectSocialAccountsResponse.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConnectSocialAccountsResponse.Builder.class) +public final class ConnectSocialAccountsResponse { + private final String authorizeUrl; + + private final Map additionalProperties; + + private ConnectSocialAccountsResponse(String authorizeUrl, Map additionalProperties) { + this.authorizeUrl = authorizeUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The OAuth authorization URL to redirect the user to. + */ + @JsonProperty("authorize_url") + public String getAuthorizeUrl() { + return authorizeUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConnectSocialAccountsResponse && equalTo((ConnectSocialAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConnectSocialAccountsResponse other) { + return authorizeUrl.equals(other.authorizeUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.authorizeUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AuthorizeUrlStage builder() { + return new Builder(); + } + + public interface AuthorizeUrlStage { + /** + *

The OAuth authorization URL to redirect the user to.

+ */ + _FinalStage authorizeUrl(@NotNull String authorizeUrl); + + Builder from(ConnectSocialAccountsResponse other); + } + + public interface _FinalStage { + ConnectSocialAccountsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AuthorizeUrlStage, _FinalStage { + private String authorizeUrl; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConnectSocialAccountsResponse other) { + authorizeUrl(other.getAuthorizeUrl()); + return this; + } + + /** + *

The OAuth authorization URL to redirect the user to.

+ *

The OAuth authorization URL to redirect the user to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("authorize_url") + public _FinalStage authorizeUrl(@NotNull String authorizeUrl) { + this.authorizeUrl = Objects.requireNonNull(authorizeUrl, "authorizeUrl must not be null"); + return this; + } + + @java.lang.Override + public ConnectSocialAccountsResponse build() { + return new ConnectSocialAccountsResponse(authorizeUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/types/CreateSocialAccountsRequestPlatform.java b/src/main/java/com/whop/api/resources/socialaccounts/types/CreateSocialAccountsRequestPlatform.java new file mode 100644 index 00000000..3be1520d --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/types/CreateSocialAccountsRequestPlatform.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateSocialAccountsRequestPlatform { + public static final CreateSocialAccountsRequestPlatform FACEBOOK = + new CreateSocialAccountsRequestPlatform(Value.FACEBOOK, "facebook"); + + private final Value value; + + private final String string; + + CreateSocialAccountsRequestPlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateSocialAccountsRequestPlatform + && this.string.equals(((CreateSocialAccountsRequestPlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FACEBOOK: + return visitor.visitFacebook(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateSocialAccountsRequestPlatform valueOf(String value) { + switch (value) { + case "facebook": + return FACEBOOK; + default: + return new CreateSocialAccountsRequestPlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + FACEBOOK, + + UNKNOWN + } + + public interface Visitor { + T visitFacebook(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/types/DeleteSocialAccountsResponse.java b/src/main/java/com/whop/api/resources/socialaccounts/types/DeleteSocialAccountsResponse.java new file mode 100644 index 00000000..2091e0f0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/types/DeleteSocialAccountsResponse.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteSocialAccountsResponse.Builder.class) +public final class DeleteSocialAccountsResponse { + private final boolean deleted; + + private final String id; + + private final Map additionalProperties; + + private DeleteSocialAccountsResponse(boolean deleted, String id, Map additionalProperties) { + this.deleted = deleted; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Always true. + */ + @JsonProperty("deleted") + public boolean getDeleted() { + return deleted; + } + + /** + * @return ID of the disconnected social account. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteSocialAccountsResponse && equalTo((DeleteSocialAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteSocialAccountsResponse other) { + return deleted == other.deleted && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deleted, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeletedStage builder() { + return new Builder(); + } + + public interface DeletedStage { + /** + *

Always true.

+ */ + IdStage deleted(boolean deleted); + + Builder from(DeleteSocialAccountsResponse other); + } + + public interface IdStage { + /** + *

ID of the disconnected social account.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DeleteSocialAccountsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeletedStage, IdStage, _FinalStage { + private boolean deleted; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeleteSocialAccountsResponse other) { + deleted(other.getDeleted()); + id(other.getId()); + return this; + } + + /** + *

Always true.

+ *

Always true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("deleted") + public IdStage deleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + *

ID of the disconnected social account.

+ *

ID of the disconnected social account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DeleteSocialAccountsResponse build() { + return new DeleteSocialAccountsResponse(deleted, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/types/LeadFormsSocialAccountsResponse.java b/src/main/java/com/whop/api/resources/socialaccounts/types/LeadFormsSocialAccountsResponse.java new file mode 100644 index 00000000..e0926fff --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/types/LeadFormsSocialAccountsResponse.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.SocialAccountLeadForm; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeadFormsSocialAccountsResponse.Builder.class) +public final class LeadFormsSocialAccountsResponse { + private final List data; + + private final Map additionalProperties; + + private LeadFormsSocialAccountsResponse( + List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeadFormsSocialAccountsResponse && equalTo((LeadFormsSocialAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeadFormsSocialAccountsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(LeadFormsSocialAccountsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(SocialAccountLeadForm data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public LeadFormsSocialAccountsResponse build() { + return new LeadFormsSocialAccountsResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsRequestDirection.java b/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsRequestDirection.java new file mode 100644 index 00000000..f91e5a68 --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsRequestDirection.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListSocialAccountsRequestDirection { + public static final ListSocialAccountsRequestDirection ASC = + new ListSocialAccountsRequestDirection(Value.ASC, "asc"); + + public static final ListSocialAccountsRequestDirection DESC = + new ListSocialAccountsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListSocialAccountsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListSocialAccountsRequestDirection + && this.string.equals(((ListSocialAccountsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListSocialAccountsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListSocialAccountsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsRequestOrder.java b/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsRequestOrder.java new file mode 100644 index 00000000..9e5a573e --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsRequestOrder.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListSocialAccountsRequestOrder { + public static final ListSocialAccountsRequestOrder DISPLAY_ORDER = + new ListSocialAccountsRequestOrder(Value.DISPLAY_ORDER, "display_order"); + + public static final ListSocialAccountsRequestOrder CREATED_AT = + new ListSocialAccountsRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListSocialAccountsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListSocialAccountsRequestOrder + && this.string.equals(((ListSocialAccountsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DISPLAY_ORDER: + return visitor.visitDisplayOrder(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListSocialAccountsRequestOrder valueOf(String value) { + switch (value) { + case "display_order": + return DISPLAY_ORDER; + case "created_at": + return CREATED_AT; + default: + return new ListSocialAccountsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + DISPLAY_ORDER, + + CREATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitDisplayOrder(); + + T visitCreatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsRequestPlatform.java b/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsRequestPlatform.java new file mode 100644 index 00000000..15c9a743 --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsRequestPlatform.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListSocialAccountsRequestPlatform { + public static final ListSocialAccountsRequestPlatform INSTAGRAM = + new ListSocialAccountsRequestPlatform(Value.INSTAGRAM, "instagram"); + + public static final ListSocialAccountsRequestPlatform FACEBOOK = + new ListSocialAccountsRequestPlatform(Value.FACEBOOK, "facebook"); + + public static final ListSocialAccountsRequestPlatform YOUTUBE = + new ListSocialAccountsRequestPlatform(Value.YOUTUBE, "youtube"); + + public static final ListSocialAccountsRequestPlatform DISCORD = + new ListSocialAccountsRequestPlatform(Value.DISCORD, "discord"); + + public static final ListSocialAccountsRequestPlatform TELEGRAM = + new ListSocialAccountsRequestPlatform(Value.TELEGRAM, "telegram"); + + public static final ListSocialAccountsRequestPlatform X = new ListSocialAccountsRequestPlatform(Value.X, "x"); + + public static final ListSocialAccountsRequestPlatform TIKTOK = + new ListSocialAccountsRequestPlatform(Value.TIKTOK, "tiktok"); + + private final Value value; + + private final String string; + + ListSocialAccountsRequestPlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListSocialAccountsRequestPlatform + && this.string.equals(((ListSocialAccountsRequestPlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTAGRAM: + return visitor.visitInstagram(); + case FACEBOOK: + return visitor.visitFacebook(); + case YOUTUBE: + return visitor.visitYoutube(); + case DISCORD: + return visitor.visitDiscord(); + case TELEGRAM: + return visitor.visitTelegram(); + case X: + return visitor.visitX(); + case TIKTOK: + return visitor.visitTiktok(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListSocialAccountsRequestPlatform valueOf(String value) { + switch (value) { + case "instagram": + return INSTAGRAM; + case "facebook": + return FACEBOOK; + case "youtube": + return YOUTUBE; + case "discord": + return DISCORD; + case "telegram": + return TELEGRAM; + case "x": + return X; + case "tiktok": + return TIKTOK; + default: + return new ListSocialAccountsRequestPlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + X, + + INSTAGRAM, + + YOUTUBE, + + TIKTOK, + + FACEBOOK, + + DISCORD, + + TELEGRAM, + + UNKNOWN + } + + public interface Visitor { + T visitX(); + + T visitInstagram(); + + T visitYoutube(); + + T visitTiktok(); + + T visitFacebook(); + + T visitDiscord(); + + T visitTelegram(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsRequestScopesItem.java b/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsRequestScopesItem.java new file mode 100644 index 00000000..c38e3a3e --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsRequestScopesItem.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListSocialAccountsRequestScopesItem { + public static final ListSocialAccountsRequestScopesItem ADVERTISE = + new ListSocialAccountsRequestScopesItem(Value.ADVERTISE, "advertise"); + + private final Value value; + + private final String string; + + ListSocialAccountsRequestScopesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListSocialAccountsRequestScopesItem + && this.string.equals(((ListSocialAccountsRequestScopesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ADVERTISE: + return visitor.visitAdvertise(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListSocialAccountsRequestScopesItem valueOf(String value) { + switch (value) { + case "advertise": + return ADVERTISE; + default: + return new ListSocialAccountsRequestScopesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + ADVERTISE, + + UNKNOWN + } + + public interface Visitor { + T visitAdvertise(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsResponse.java b/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsResponse.java new file mode 100644 index 00000000..82b32537 --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.SocialAccount; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSocialAccountsResponse.Builder.class) +public final class ListSocialAccountsResponse { + private final List data; + + private final ListSocialAccountsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListSocialAccountsResponse( + List data, + ListSocialAccountsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListSocialAccountsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSocialAccountsResponse && equalTo((ListSocialAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSocialAccountsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListSocialAccountsResponsePageInfo pageInfo); + + Builder from(ListSocialAccountsResponse other); + } + + public interface _FinalStage { + ListSocialAccountsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(SocialAccount data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListSocialAccountsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSocialAccountsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListSocialAccountsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(SocialAccount data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListSocialAccountsResponse build() { + return new ListSocialAccountsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsResponsePageInfo.java b/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsResponsePageInfo.java new file mode 100644 index 00000000..01fb295c --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/types/ListSocialAccountsResponsePageInfo.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSocialAccountsResponsePageInfo.Builder.class) +public final class ListSocialAccountsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListSocialAccountsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSocialAccountsResponsePageInfo + && equalTo((ListSocialAccountsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSocialAccountsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListSocialAccountsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListSocialAccountsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSocialAccountsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListSocialAccountsResponsePageInfo build() { + return new ListSocialAccountsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/types/PostsSocialAccountsResponse.java b/src/main/java/com/whop/api/resources/socialaccounts/types/PostsSocialAccountsResponse.java new file mode 100644 index 00000000..a0de5bcc --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/types/PostsSocialAccountsResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.SocialAccountPost; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostsSocialAccountsResponse.Builder.class) +public final class PostsSocialAccountsResponse { + private final List data; + + private final PostsSocialAccountsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private PostsSocialAccountsResponse( + List data, + PostsSocialAccountsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PostsSocialAccountsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostsSocialAccountsResponse && equalTo((PostsSocialAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostsSocialAccountsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PostsSocialAccountsResponsePageInfo pageInfo); + + Builder from(PostsSocialAccountsResponse other); + } + + public interface _FinalStage { + PostsSocialAccountsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(SocialAccountPost data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PostsSocialAccountsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostsSocialAccountsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PostsSocialAccountsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(SocialAccountPost data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public PostsSocialAccountsResponse build() { + return new PostsSocialAccountsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/socialaccounts/types/PostsSocialAccountsResponsePageInfo.java b/src/main/java/com/whop/api/resources/socialaccounts/types/PostsSocialAccountsResponsePageInfo.java new file mode 100644 index 00000000..47857d31 --- /dev/null +++ b/src/main/java/com/whop/api/resources/socialaccounts/types/PostsSocialAccountsResponsePageInfo.java @@ -0,0 +1,175 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.socialaccounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostsSocialAccountsResponsePageInfo.Builder.class) +public final class PostsSocialAccountsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final Map additionalProperties; + + private PostsSocialAccountsResponsePageInfo( + Optional endCursor, boolean hasNextPage, Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostsSocialAccountsResponsePageInfo + && equalTo((PostsSocialAccountsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostsSocialAccountsResponsePageInfo other) { + return endCursor.equals(other.endCursor) && hasNextPage == other.hasNextPage; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + _FinalStage hasNextPage(boolean hasNextPage); + + Builder from(PostsSocialAccountsResponsePageInfo other); + } + + public interface _FinalStage { + PostsSocialAccountsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, _FinalStage { + private boolean hasNextPage; + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostsSocialAccountsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public _FinalStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public PostsSocialAccountsResponsePageInfo build() { + return new PostsSocialAccountsResponsePageInfo(endCursor, hasNextPage, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/AsyncRawStatsClient.java b/src/main/java/com/whop/api/resources/stats/AsyncRawStatsClient.java new file mode 100644 index 00000000..8fc2fbde --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/AsyncRawStatsClient.java @@ -0,0 +1,754 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.stats.requests.DescribeStatsRequest; +import com.whop.api.resources.stats.requests.MetricStatsRequest; +import com.whop.api.resources.stats.requests.RawStatsRequest; +import com.whop.api.resources.stats.requests.RetrieveStatsRequest; +import com.whop.api.resources.stats.types.DescribeStatsResponse; +import com.whop.api.resources.stats.types.ListStatsResponse; +import com.whop.api.resources.stats.types.MetricStatsResponse; +import com.whop.api.resources.stats.types.RawStatsResponse; +import com.whop.api.resources.stats.types.RetrieveStatsResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawStatsClient { + protected final ClientOptions clientOptions; + + public AsyncRawStatsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists every metric you can query, with its unit and the properties you can filter or break it down by. + */ + public CompletableFuture> list() { + return list(null); + } + + /** + * Lists every metric you can query, with its unit and the properties you can filter or break it down by. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("stats"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListStatsResponse.class), + response)); + return; + } + try { + if (response.code() == 401) { + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture> describeStats() { + return describeStats(DescribeStatsRequest.builder().build()); + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture> describeStats(RequestOptions requestOptions) { + return describeStats(DescribeStatsRequest.builder().build(), requestOptions); + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture> describeStats(DescribeStatsRequest request) { + return describeStats(request, null); + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture> describeStats( + DescribeStatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("stats/describe"); + if (request.getResource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "resource", request.getResource().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DescribeStatsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Query an aggregated metric. Returns data grouped by period with optional breakdowns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture> metricStats(MetricStatsRequest request) { + return metricStats(request, null); + } + + /** + * Query an aggregated metric. Returns data grouped by period with optional breakdowns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture> metricStats( + MetricStatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("stats/metric"); + QueryStringMapper.addQueryParameter(httpUrl, "resource", request.getResource(), false); + if (request.getGranularity().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "granularity", request.getGranularity().get(), false); + } + if (request.getFilters().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filters", request.getFilters().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().get(), false); + } + if (request.getTo().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "to", request.getTo().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getBreakdowns().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "breakdowns", request.getBreakdowns().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MetricStatsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Query raw data from a resource. Returns paginated rows with all columns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture> rawStats(RawStatsRequest request) { + return rawStats(request, null); + } + + /** + * Query raw data from a resource. Returns paginated rows with all columns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture> rawStats( + RawStatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("stats/raw"); + QueryStringMapper.addQueryParameter(httpUrl, "resource", request.getResource(), false); + if (request.getFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().get(), false); + } + if (request.getTo().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "to", request.getTo().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getCursor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "cursor", request.getCursor().get(), false); + } + if (request.getSort().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort", request.getSort().get(), false); + } + if (request.getSortDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_direction", request.getSortDirection().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RawStatsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a metric as a time series of points for an account or user over a time range. The market_prices metric is public and requires no authentication. + */ + public CompletableFuture> retrieve( + String metric, RetrieveStatsRequest request) { + return retrieve(metric, request, null); + } + + /** + * Retrieves a metric as a time series of points for an account or user over a time range. The market_prices metric is public and requires no authentication. + */ + public CompletableFuture> retrieve( + String metric, RetrieveStatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("stats") + .addPathSegment(metric); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "from", request.getFrom(), false); + QueryStringMapper.addQueryParameter(httpUrl, "to", request.getTo(), false); + if (request.getInterval().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "interval", request.getInterval().get(), false); + } + if (request.getBreakdownBy().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "breakdown_by", request.getBreakdownBy().get(), false); + } + if (request.getConvertTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "convert_to", request.getConvertTo().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getPaymentMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "payment_method", request.getPaymentMethod().get(), false); + } + if (request.getCardNetwork().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "card_network", request.getCardNetwork().get(), false); + } + if (request.getDisputeReason().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "dispute_reason", request.getDisputeReason().get(), false); + } + if (request.getSource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "source", request.getSource().get(), false); + } + if (request.getHostname().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "hostname", request.getHostname().get(), false); + } + if (request.getPage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "page", request.getPage().get(), false); + } + if (request.getDeviceType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "device_type", request.getDeviceType().get(), false); + } + if (request.getCountryCode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "country_code", request.getCountryCode().get(), false); + } + if (request.getEventName().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event_name", request.getEventName().get(), false); + } + if (request.getEventType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event_type", request.getEventType().get(), false); + } + if (request.getCustomName().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_name", request.getCustomName().get(), false); + } + if (request.getSegment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "segment", request.getSegment().get(), false); + } + if (request.getCategory().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "category", request.getCategory().get(), false); + } + if (request.getMerchant().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "merchant", request.getMerchant().get(), false); + } + if (request.getFeeType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "fee_type", request.getFeeType().get(), false); + } + if (request.getProduct().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product", request.getProduct().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getAccessLevel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "access_level", request.getAccessLevel().get(), false); + } + if (request.getMostRecentAction().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "most_recent_action", request.getMostRecentAction().get(), false); + } + if (request.getReferredUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "referred_user_id", request.getReferredUserId().get(), false); + } + if (request.getSnapshotWindow().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "snapshot_window", request.getSnapshotWindow().get(), false); + } + if (request.getEvent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event", request.getEvent().get(), false); + } + if (request.getAdCampaignIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_campaign_ids", request.getAdCampaignIds().get(), true); + } + if (request.getAdGroupIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_group_ids", request.getAdGroupIds().get(), true); + } + if (request.getAdIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_ids", request.getAdIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrieveStatsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/stats/AsyncStatsClient.java b/src/main/java/com/whop/api/resources/stats/AsyncStatsClient.java new file mode 100644 index 00000000..21838954 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/AsyncStatsClient.java @@ -0,0 +1,154 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.stats.requests.DescribeStatsRequest; +import com.whop.api.resources.stats.requests.MetricStatsRequest; +import com.whop.api.resources.stats.requests.RawStatsRequest; +import com.whop.api.resources.stats.requests.RetrieveStatsRequest; +import com.whop.api.resources.stats.types.DescribeStatsResponse; +import com.whop.api.resources.stats.types.ListStatsResponse; +import com.whop.api.resources.stats.types.MetricStatsResponse; +import com.whop.api.resources.stats.types.RawStatsResponse; +import com.whop.api.resources.stats.types.RetrieveStatsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncStatsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawStatsClient rawClient; + + public AsyncStatsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawStatsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawStatsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists every metric you can query, with its unit and the properties you can filter or break it down by. + */ + public CompletableFuture list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists every metric you can query, with its unit and the properties you can filter or break it down by. + */ + public CompletableFuture list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture describeStats() { + return this.rawClient.describeStats().thenApply(response -> response.body()); + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture describeStats(RequestOptions requestOptions) { + return this.rawClient.describeStats(requestOptions).thenApply(response -> response.body()); + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture describeStats(DescribeStatsRequest request) { + return this.rawClient.describeStats(request).thenApply(response -> response.body()); + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture describeStats( + DescribeStatsRequest request, RequestOptions requestOptions) { + return this.rawClient.describeStats(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Query an aggregated metric. Returns data grouped by period with optional breakdowns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture metricStats(MetricStatsRequest request) { + return this.rawClient.metricStats(request).thenApply(response -> response.body()); + } + + /** + * Query an aggregated metric. Returns data grouped by period with optional breakdowns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture metricStats( + MetricStatsRequest request, RequestOptions requestOptions) { + return this.rawClient.metricStats(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Query raw data from a resource. Returns paginated rows with all columns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture rawStats(RawStatsRequest request) { + return this.rawClient.rawStats(request).thenApply(response -> response.body()); + } + + /** + * Query raw data from a resource. Returns paginated rows with all columns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public CompletableFuture rawStats(RawStatsRequest request, RequestOptions requestOptions) { + return this.rawClient.rawStats(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a metric as a time series of points for an account or user over a time range. The market_prices metric is public and requires no authentication. + */ + public CompletableFuture retrieve(String metric, RetrieveStatsRequest request) { + return this.rawClient.retrieve(metric, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a metric as a time series of points for an account or user over a time range. The market_prices metric is public and requires no authentication. + */ + public CompletableFuture retrieve( + String metric, RetrieveStatsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(metric, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/stats/RawStatsClient.java b/src/main/java/com/whop/api/resources/stats/RawStatsClient.java new file mode 100644 index 00000000..2a4e5128 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/RawStatsClient.java @@ -0,0 +1,627 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.stats.requests.DescribeStatsRequest; +import com.whop.api.resources.stats.requests.MetricStatsRequest; +import com.whop.api.resources.stats.requests.RawStatsRequest; +import com.whop.api.resources.stats.requests.RetrieveStatsRequest; +import com.whop.api.resources.stats.types.DescribeStatsResponse; +import com.whop.api.resources.stats.types.ListStatsResponse; +import com.whop.api.resources.stats.types.MetricStatsResponse; +import com.whop.api.resources.stats.types.RawStatsResponse; +import com.whop.api.resources.stats.types.RetrieveStatsResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawStatsClient { + protected final ClientOptions clientOptions; + + public RawStatsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists every metric you can query, with its unit and the properties you can filter or break it down by. + */ + public WhopApiHttpResponse list() { + return list(null); + } + + /** + * Lists every metric you can query, with its unit and the properties you can filter or break it down by. + */ + public WhopApiHttpResponse list(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("stats"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListStatsResponse.class), response); + } + try { + if (response.code() == 401) { + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public WhopApiHttpResponse describeStats() { + return describeStats(DescribeStatsRequest.builder().build()); + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public WhopApiHttpResponse describeStats(RequestOptions requestOptions) { + return describeStats(DescribeStatsRequest.builder().build(), requestOptions); + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public WhopApiHttpResponse describeStats(DescribeStatsRequest request) { + return describeStats(request, null); + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public WhopApiHttpResponse describeStats( + DescribeStatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("stats/describe"); + if (request.getResource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "resource", request.getResource().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DescribeStatsResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Query an aggregated metric. Returns data grouped by period with optional breakdowns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public WhopApiHttpResponse metricStats(MetricStatsRequest request) { + return metricStats(request, null); + } + + /** + * Query an aggregated metric. Returns data grouped by period with optional breakdowns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public WhopApiHttpResponse metricStats( + MetricStatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("stats/metric"); + QueryStringMapper.addQueryParameter(httpUrl, "resource", request.getResource(), false); + if (request.getGranularity().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "granularity", request.getGranularity().get(), false); + } + if (request.getFilters().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filters", request.getFilters().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().get(), false); + } + if (request.getTo().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "to", request.getTo().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getBreakdowns().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "breakdowns", request.getBreakdowns().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MetricStatsResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Query raw data from a resource. Returns paginated rows with all columns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public WhopApiHttpResponse rawStats(RawStatsRequest request) { + return rawStats(request, null); + } + + /** + * Query raw data from a resource. Returns paginated rows with all columns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public WhopApiHttpResponse rawStats(RawStatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("stats/raw"); + QueryStringMapper.addQueryParameter(httpUrl, "resource", request.getResource(), false); + if (request.getFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().get(), false); + } + if (request.getTo().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "to", request.getTo().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getCursor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "cursor", request.getCursor().get(), false); + } + if (request.getSort().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort", request.getSort().get(), false); + } + if (request.getSortDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_direction", request.getSortDirection().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RawStatsResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a metric as a time series of points for an account or user over a time range. The market_prices metric is public and requires no authentication. + */ + public WhopApiHttpResponse retrieve(String metric, RetrieveStatsRequest request) { + return retrieve(metric, request, null); + } + + /** + * Retrieves a metric as a time series of points for an account or user over a time range. The market_prices metric is public and requires no authentication. + */ + public WhopApiHttpResponse retrieve( + String metric, RetrieveStatsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("stats") + .addPathSegment(metric); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "from", request.getFrom(), false); + QueryStringMapper.addQueryParameter(httpUrl, "to", request.getTo(), false); + if (request.getInterval().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "interval", request.getInterval().get(), false); + } + if (request.getBreakdownBy().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "breakdown_by", request.getBreakdownBy().get(), false); + } + if (request.getConvertTo().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "convert_to", request.getConvertTo().get(), false); + } + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (request.getPaymentMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "payment_method", request.getPaymentMethod().get(), false); + } + if (request.getCardNetwork().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "card_network", request.getCardNetwork().get(), false); + } + if (request.getDisputeReason().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "dispute_reason", request.getDisputeReason().get(), false); + } + if (request.getSource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "source", request.getSource().get(), false); + } + if (request.getHostname().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "hostname", request.getHostname().get(), false); + } + if (request.getPage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "page", request.getPage().get(), false); + } + if (request.getDeviceType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "device_type", request.getDeviceType().get(), false); + } + if (request.getCountryCode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "country_code", request.getCountryCode().get(), false); + } + if (request.getEventName().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event_name", request.getEventName().get(), false); + } + if (request.getEventType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event_type", request.getEventType().get(), false); + } + if (request.getCustomName().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_name", request.getCustomName().get(), false); + } + if (request.getSegment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "segment", request.getSegment().get(), false); + } + if (request.getCategory().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "category", request.getCategory().get(), false); + } + if (request.getMerchant().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "merchant", request.getMerchant().get(), false); + } + if (request.getFeeType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "fee_type", request.getFeeType().get(), false); + } + if (request.getProduct().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product", request.getProduct().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getAccessLevel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "access_level", request.getAccessLevel().get(), false); + } + if (request.getMostRecentAction().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "most_recent_action", request.getMostRecentAction().get(), false); + } + if (request.getReferredUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "referred_user_id", request.getReferredUserId().get(), false); + } + if (request.getSnapshotWindow().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "snapshot_window", request.getSnapshotWindow().get(), false); + } + if (request.getEvent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event", request.getEvent().get(), false); + } + if (request.getAdCampaignIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_campaign_ids", request.getAdCampaignIds().get(), true); + } + if (request.getAdGroupIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_group_ids", request.getAdGroupIds().get(), true); + } + if (request.getAdIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ad_ids", request.getAdIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrieveStatsResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/StatsClient.java b/src/main/java/com/whop/api/resources/stats/StatsClient.java new file mode 100644 index 00000000..c1706c38 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/StatsClient.java @@ -0,0 +1,150 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.stats.requests.DescribeStatsRequest; +import com.whop.api.resources.stats.requests.MetricStatsRequest; +import com.whop.api.resources.stats.requests.RawStatsRequest; +import com.whop.api.resources.stats.requests.RetrieveStatsRequest; +import com.whop.api.resources.stats.types.DescribeStatsResponse; +import com.whop.api.resources.stats.types.ListStatsResponse; +import com.whop.api.resources.stats.types.MetricStatsResponse; +import com.whop.api.resources.stats.types.RawStatsResponse; +import com.whop.api.resources.stats.types.RetrieveStatsResponse; + +public class StatsClient { + protected final ClientOptions clientOptions; + + private final RawStatsClient rawClient; + + public StatsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawStatsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawStatsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists every metric you can query, with its unit and the properties you can filter or break it down by. + */ + public ListStatsResponse list() { + return this.rawClient.list().body(); + } + + /** + * Lists every metric you can query, with its unit and the properties you can filter or break it down by. + */ + public ListStatsResponse list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public DescribeStatsResponse describeStats() { + return this.rawClient.describeStats().body(); + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public DescribeStatsResponse describeStats(RequestOptions requestOptions) { + return this.rawClient.describeStats(requestOptions).body(); + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public DescribeStatsResponse describeStats(DescribeStatsRequest request) { + return this.rawClient.describeStats(request).body(); + } + + /** + * Describe available stats schema. Without resource returns root nodes and metrics. With resource returns node columns, associations, and available metrics. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public DescribeStatsResponse describeStats(DescribeStatsRequest request, RequestOptions requestOptions) { + return this.rawClient.describeStats(request, requestOptions).body(); + } + + /** + * Query an aggregated metric. Returns data grouped by period with optional breakdowns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public MetricStatsResponse metricStats(MetricStatsRequest request) { + return this.rawClient.metricStats(request).body(); + } + + /** + * Query an aggregated metric. Returns data grouped by period with optional breakdowns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public MetricStatsResponse metricStats(MetricStatsRequest request, RequestOptions requestOptions) { + return this.rawClient.metricStats(request, requestOptions).body(); + } + + /** + * Query raw data from a resource. Returns paginated rows with all columns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public RawStatsResponse rawStats(RawStatsRequest request) { + return this.rawClient.rawStats(request).body(); + } + + /** + * Query raw data from a resource. Returns paginated rows with all columns. + *

Required permissions:

+ *
    + *
  • stats:read
  • + *
+ */ + public RawStatsResponse rawStats(RawStatsRequest request, RequestOptions requestOptions) { + return this.rawClient.rawStats(request, requestOptions).body(); + } + + /** + * Retrieves a metric as a time series of points for an account or user over a time range. The market_prices metric is public and requires no authentication. + */ + public RetrieveStatsResponse retrieve(String metric, RetrieveStatsRequest request) { + return this.rawClient.retrieve(metric, request).body(); + } + + /** + * Retrieves a metric as a time series of points for an account or user over a time range. The market_prices metric is public and requires no authentication. + */ + public RetrieveStatsResponse retrieve(String metric, RetrieveStatsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(metric, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/stats/requests/DescribeStatsRequest.java b/src/main/java/com/whop/api/resources/stats/requests/DescribeStatsRequest.java new file mode 100644 index 00000000..3cd6130b --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/requests/DescribeStatsRequest.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DescribeStatsRequest.Builder.class) +public final class DescribeStatsRequest { + private final Optional resource; + + private final Optional companyId; + + private final Optional userId; + + private final Map additionalProperties; + + private DescribeStatsRequest( + Optional resource, + Optional companyId, + Optional userId, + Map additionalProperties) { + this.resource = resource; + this.companyId = companyId; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Resource path using : as separator (e.g., 'receipts', 'payments:membership', 'receipts:gross_revenue'). + */ + @JsonProperty("resource") + public Optional getResource() { + return resource; + } + + /** + * @return Scope query to a specific company. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + /** + * @return Scope query to a specific user. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeStatsRequest && equalTo((DescribeStatsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DescribeStatsRequest other) { + return resource.equals(other.resource) && companyId.equals(other.companyId) && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.resource, this.companyId, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional resource = Optional.empty(); + + private Optional companyId = Optional.empty(); + + private Optional userId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DescribeStatsRequest other) { + resource(other.getResource()); + companyId(other.getCompanyId()); + userId(other.getUserId()); + return this; + } + + /** + *

Resource path using : as separator (e.g., 'receipts', 'payments:membership', 'receipts:gross_revenue').

+ */ + @JsonSetter(value = "resource", nulls = Nulls.SKIP) + public Builder resource(Optional resource) { + this.resource = resource; + return this; + } + + public Builder resource(String resource) { + this.resource = Optional.ofNullable(resource); + return this; + } + + /** + *

Scope query to a specific company.

+ */ + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + /** + *

Scope query to a specific user.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + public DescribeStatsRequest build() { + return new DescribeStatsRequest(resource, companyId, userId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/requests/MetricStatsRequest.java b/src/main/java/com/whop/api/resources/stats/requests/MetricStatsRequest.java new file mode 100644 index 00000000..ea1a7c88 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/requests/MetricStatsRequest.java @@ -0,0 +1,507 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MetricStatsRequest.Builder.class) +public final class MetricStatsRequest { + private final Optional> breakdowns; + + private final String resource; + + private final Optional granularity; + + private final Optional> filters; + + private final Optional timeZone; + + private final Optional from; + + private final Optional to; + + private final Optional companyId; + + private final Optional userId; + + private final Map additionalProperties; + + private MetricStatsRequest( + Optional> breakdowns, + String resource, + Optional granularity, + Optional> filters, + Optional timeZone, + Optional from, + Optional to, + Optional companyId, + Optional userId, + Map additionalProperties) { + this.breakdowns = breakdowns; + this.resource = resource; + this.granularity = granularity; + this.filters = filters; + this.timeZone = timeZone; + this.from = from; + this.to = to; + this.companyId = companyId; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Columns to break down the metric by. + */ + @JsonProperty("breakdowns") + public Optional> getBreakdowns() { + return breakdowns; + } + + /** + * @return Metric resource using : as separator (e.g., 'receipts:gross_revenue', 'members:new_users'). + */ + @JsonProperty("resource") + public String getResource() { + return resource; + } + + /** + * @return Time granularity (daily, weekly, monthly). + */ + @JsonProperty("granularity") + public Optional getGranularity() { + return granularity; + } + + /** + * @return Key-value pairs to filter the data. + */ + @JsonProperty("filters") + public Optional> getFilters() { + return filters; + } + + /** + * @return IANA timezone for period bucketing (e.g. 'America/New_York'). Defaults to UTC. Only applies to ClickHouse metrics. + */ + @JsonProperty("time_zone") + public Optional getTimeZone() { + return timeZone; + } + + /** + * @return Start of time range (unix timestamp). + */ + @JsonProperty("from") + public Optional getFrom() { + return from; + } + + /** + * @return End of time range (unix timestamp). + */ + @JsonProperty("to") + public Optional getTo() { + return to; + } + + /** + * @return Scope query to a specific company. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + /** + * @return Scope query to a specific user. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MetricStatsRequest && equalTo((MetricStatsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MetricStatsRequest other) { + return breakdowns.equals(other.breakdowns) + && resource.equals(other.resource) + && granularity.equals(other.granularity) + && filters.equals(other.filters) + && timeZone.equals(other.timeZone) + && from.equals(other.from) + && to.equals(other.to) + && companyId.equals(other.companyId) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.breakdowns, + this.resource, + this.granularity, + this.filters, + this.timeZone, + this.from, + this.to, + this.companyId, + this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ResourceStage builder() { + return new Builder(); + } + + public interface ResourceStage { + /** + *

Metric resource using : as separator (e.g., 'receipts:gross_revenue', 'members:new_users').

+ */ + _FinalStage resource(@NotNull String resource); + + Builder from(MetricStatsRequest other); + } + + public interface _FinalStage { + MetricStatsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Columns to break down the metric by.

+ */ + _FinalStage breakdowns(Optional> breakdowns); + + _FinalStage breakdowns(List breakdowns); + + _FinalStage breakdowns(String breakdowns); + + /** + *

Time granularity (daily, weekly, monthly).

+ */ + _FinalStage granularity(Optional granularity); + + _FinalStage granularity(String granularity); + + /** + *

Key-value pairs to filter the data.

+ */ + _FinalStage filters(Optional> filters); + + _FinalStage filters(Map filters); + + /** + *

IANA timezone for period bucketing (e.g. 'America/New_York'). Defaults to UTC. Only applies to ClickHouse metrics.

+ */ + _FinalStage timeZone(Optional timeZone); + + _FinalStage timeZone(String timeZone); + + /** + *

Start of time range (unix timestamp).

+ */ + _FinalStage from(Optional from); + + _FinalStage from(OffsetDateTime from); + + /** + *

End of time range (unix timestamp).

+ */ + _FinalStage to(Optional to); + + _FinalStage to(OffsetDateTime to); + + /** + *

Scope query to a specific company.

+ */ + _FinalStage companyId(Optional companyId); + + _FinalStage companyId(String companyId); + + /** + *

Scope query to a specific user.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ResourceStage, _FinalStage { + private String resource; + + private Optional userId = Optional.empty(); + + private Optional companyId = Optional.empty(); + + private Optional to = Optional.empty(); + + private Optional from = Optional.empty(); + + private Optional timeZone = Optional.empty(); + + private Optional> filters = Optional.empty(); + + private Optional granularity = Optional.empty(); + + private Optional> breakdowns = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MetricStatsRequest other) { + breakdowns(other.getBreakdowns()); + resource(other.getResource()); + granularity(other.getGranularity()); + filters(other.getFilters()); + timeZone(other.getTimeZone()); + from(other.getFrom()); + to(other.getTo()); + companyId(other.getCompanyId()); + userId(other.getUserId()); + return this; + } + + /** + *

Metric resource using : as separator (e.g., 'receipts:gross_revenue', 'members:new_users').

+ *

Metric resource using : as separator (e.g., 'receipts:gross_revenue', 'members:new_users').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource") + public _FinalStage resource(@NotNull String resource) { + this.resource = Objects.requireNonNull(resource, "resource must not be null"); + return this; + } + + /** + *

Scope query to a specific user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Scope query to a specific user.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

Scope query to a specific company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + /** + *

Scope query to a specific company.

+ */ + @java.lang.Override + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public _FinalStage companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + /** + *

End of time range (unix timestamp).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage to(OffsetDateTime to) { + this.to = Optional.ofNullable(to); + return this; + } + + /** + *

End of time range (unix timestamp).

+ */ + @java.lang.Override + @JsonSetter(value = "to", nulls = Nulls.SKIP) + public _FinalStage to(Optional to) { + this.to = to; + return this; + } + + /** + *

Start of time range (unix timestamp).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage from(OffsetDateTime from) { + this.from = Optional.ofNullable(from); + return this; + } + + /** + *

Start of time range (unix timestamp).

+ */ + @java.lang.Override + @JsonSetter(value = "from", nulls = Nulls.SKIP) + public _FinalStage from(Optional from) { + this.from = from; + return this; + } + + /** + *

IANA timezone for period bucketing (e.g. 'America/New_York'). Defaults to UTC. Only applies to ClickHouse metrics.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timeZone(String timeZone) { + this.timeZone = Optional.ofNullable(timeZone); + return this; + } + + /** + *

IANA timezone for period bucketing (e.g. 'America/New_York'). Defaults to UTC. Only applies to ClickHouse metrics.

+ */ + @java.lang.Override + @JsonSetter(value = "time_zone", nulls = Nulls.SKIP) + public _FinalStage timeZone(Optional timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + *

Key-value pairs to filter the data.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filters(Map filters) { + this.filters = Optional.ofNullable(filters); + return this; + } + + /** + *

Key-value pairs to filter the data.

+ */ + @java.lang.Override + @JsonSetter(value = "filters", nulls = Nulls.SKIP) + public _FinalStage filters(Optional> filters) { + this.filters = filters; + return this; + } + + /** + *

Time granularity (daily, weekly, monthly).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage granularity(String granularity) { + this.granularity = Optional.ofNullable(granularity); + return this; + } + + /** + *

Time granularity (daily, weekly, monthly).

+ */ + @java.lang.Override + @JsonSetter(value = "granularity", nulls = Nulls.SKIP) + public _FinalStage granularity(Optional granularity) { + this.granularity = granularity; + return this; + } + + @java.lang.Override + public _FinalStage breakdowns(String breakdowns) { + this.breakdowns = Optional.of(Collections.singletonList(breakdowns)); + return this; + } + + /** + *

Columns to break down the metric by.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage breakdowns(List breakdowns) { + this.breakdowns = Optional.ofNullable(breakdowns); + return this; + } + + /** + *

Columns to break down the metric by.

+ */ + @java.lang.Override + @JsonSetter(value = "breakdowns", nulls = Nulls.SKIP) + public _FinalStage breakdowns(Optional> breakdowns) { + this.breakdowns = breakdowns; + return this; + } + + @java.lang.Override + public MetricStatsRequest build() { + return new MetricStatsRequest( + breakdowns, + resource, + granularity, + filters, + timeZone, + from, + to, + companyId, + userId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/requests/RawStatsRequest.java b/src/main/java/com/whop/api/resources/stats/requests/RawStatsRequest.java new file mode 100644 index 00000000..ad16c2c0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/requests/RawStatsRequest.java @@ -0,0 +1,476 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Direction; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RawStatsRequest.Builder.class) +public final class RawStatsRequest { + private final String resource; + + private final Optional from; + + private final Optional to; + + private final Optional limit; + + private final Optional cursor; + + private final Optional sort; + + private final Optional sortDirection; + + private final Optional companyId; + + private final Optional userId; + + private final Map additionalProperties; + + private RawStatsRequest( + String resource, + Optional from, + Optional to, + Optional limit, + Optional cursor, + Optional sort, + Optional sortDirection, + Optional companyId, + Optional userId, + Map additionalProperties) { + this.resource = resource; + this.from = from; + this.to = to; + this.limit = limit; + this.cursor = cursor; + this.sort = sort; + this.sortDirection = sortDirection; + this.companyId = companyId; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Resource path using : as separator (e.g., 'members', 'payments:membership'). + */ + @JsonProperty("resource") + public String getResource() { + return resource; + } + + /** + * @return Start of time range (unix timestamp). + */ + @JsonProperty("from") + public Optional getFrom() { + return from; + } + + /** + * @return End of time range (unix timestamp). + */ + @JsonProperty("to") + public Optional getTo() { + return to; + } + + /** + * @return Number of records to return (max 10000). + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Pagination cursor for next page. + */ + @JsonProperty("cursor") + public Optional getCursor() { + return cursor; + } + + /** + * @return Column to sort by. + */ + @JsonProperty("sort") + public Optional getSort() { + return sort; + } + + @JsonProperty("sort_direction") + public Optional getSortDirection() { + return sortDirection; + } + + /** + * @return Scope query to a specific company. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + /** + * @return Scope query to a specific user. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RawStatsRequest && equalTo((RawStatsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RawStatsRequest other) { + return resource.equals(other.resource) + && from.equals(other.from) + && to.equals(other.to) + && limit.equals(other.limit) + && cursor.equals(other.cursor) + && sort.equals(other.sort) + && sortDirection.equals(other.sortDirection) + && companyId.equals(other.companyId) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.resource, + this.from, + this.to, + this.limit, + this.cursor, + this.sort, + this.sortDirection, + this.companyId, + this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ResourceStage builder() { + return new Builder(); + } + + public interface ResourceStage { + /** + *

Resource path using : as separator (e.g., 'members', 'payments:membership').

+ */ + _FinalStage resource(@NotNull String resource); + + Builder from(RawStatsRequest other); + } + + public interface _FinalStage { + RawStatsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Start of time range (unix timestamp).

+ */ + _FinalStage from(Optional from); + + _FinalStage from(OffsetDateTime from); + + /** + *

End of time range (unix timestamp).

+ */ + _FinalStage to(Optional to); + + _FinalStage to(OffsetDateTime to); + + /** + *

Number of records to return (max 10000).

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Integer limit); + + /** + *

Pagination cursor for next page.

+ */ + _FinalStage cursor(Optional cursor); + + _FinalStage cursor(String cursor); + + /** + *

Column to sort by.

+ */ + _FinalStage sort(Optional sort); + + _FinalStage sort(String sort); + + _FinalStage sortDirection(Optional sortDirection); + + _FinalStage sortDirection(Direction sortDirection); + + /** + *

Scope query to a specific company.

+ */ + _FinalStage companyId(Optional companyId); + + _FinalStage companyId(String companyId); + + /** + *

Scope query to a specific user.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ResourceStage, _FinalStage { + private String resource; + + private Optional userId = Optional.empty(); + + private Optional companyId = Optional.empty(); + + private Optional sortDirection = Optional.empty(); + + private Optional sort = Optional.empty(); + + private Optional cursor = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional to = Optional.empty(); + + private Optional from = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RawStatsRequest other) { + resource(other.getResource()); + from(other.getFrom()); + to(other.getTo()); + limit(other.getLimit()); + cursor(other.getCursor()); + sort(other.getSort()); + sortDirection(other.getSortDirection()); + companyId(other.getCompanyId()); + userId(other.getUserId()); + return this; + } + + /** + *

Resource path using : as separator (e.g., 'members', 'payments:membership').

+ *

Resource path using : as separator (e.g., 'members', 'payments:membership').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource") + public _FinalStage resource(@NotNull String resource) { + this.resource = Objects.requireNonNull(resource, "resource must not be null"); + return this; + } + + /** + *

Scope query to a specific user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Scope query to a specific user.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

Scope query to a specific company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + /** + *

Scope query to a specific company.

+ */ + @java.lang.Override + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public _FinalStage companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + @java.lang.Override + public _FinalStage sortDirection(Direction sortDirection) { + this.sortDirection = Optional.ofNullable(sortDirection); + return this; + } + + @java.lang.Override + @JsonSetter(value = "sort_direction", nulls = Nulls.SKIP) + public _FinalStage sortDirection(Optional sortDirection) { + this.sortDirection = sortDirection; + return this; + } + + /** + *

Column to sort by.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sort(String sort) { + this.sort = Optional.ofNullable(sort); + return this; + } + + /** + *

Column to sort by.

+ */ + @java.lang.Override + @JsonSetter(value = "sort", nulls = Nulls.SKIP) + public _FinalStage sort(Optional sort) { + this.sort = sort; + return this; + } + + /** + *

Pagination cursor for next page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cursor(String cursor) { + this.cursor = Optional.ofNullable(cursor); + return this; + } + + /** + *

Pagination cursor for next page.

+ */ + @java.lang.Override + @JsonSetter(value = "cursor", nulls = Nulls.SKIP) + public _FinalStage cursor(Optional cursor) { + this.cursor = cursor; + return this; + } + + /** + *

Number of records to return (max 10000).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

Number of records to return (max 10000).

+ */ + @java.lang.Override + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public _FinalStage limit(Optional limit) { + this.limit = limit; + return this; + } + + /** + *

End of time range (unix timestamp).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage to(OffsetDateTime to) { + this.to = Optional.ofNullable(to); + return this; + } + + /** + *

End of time range (unix timestamp).

+ */ + @java.lang.Override + @JsonSetter(value = "to", nulls = Nulls.SKIP) + public _FinalStage to(Optional to) { + this.to = to; + return this; + } + + /** + *

Start of time range (unix timestamp).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage from(OffsetDateTime from) { + this.from = Optional.ofNullable(from); + return this; + } + + /** + *

Start of time range (unix timestamp).

+ */ + @java.lang.Override + @JsonSetter(value = "from", nulls = Nulls.SKIP) + public _FinalStage from(Optional from) { + this.from = from; + return this; + } + + @java.lang.Override + public RawStatsRequest build() { + return new RawStatsRequest( + resource, from, to, limit, cursor, sort, sortDirection, companyId, userId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/requests/RetrieveStatsRequest.java b/src/main/java/com/whop/api/resources/stats/requests/RetrieveStatsRequest.java new file mode 100644 index 00000000..63674030 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/requests/RetrieveStatsRequest.java @@ -0,0 +1,1642 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.stats.types.RetrieveStatsRequestEventType; +import com.whop.api.resources.stats.types.RetrieveStatsRequestInterval; +import com.whop.api.resources.stats.types.RetrieveStatsRequestSnapshotWindow; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveStatsRequest.Builder.class) +public final class RetrieveStatsRequest { + private final Optional> adCampaignIds; + + private final Optional> adGroupIds; + + private final Optional> adIds; + + private final Optional accountId; + + private final Optional userId; + + private final String from; + + private final String to; + + private final Optional interval; + + private final Optional breakdownBy; + + private final Optional convertTo; + + private final Optional currency; + + private final Optional timeZone; + + private final Optional paymentMethod; + + private final Optional cardNetwork; + + private final Optional disputeReason; + + private final Optional source; + + private final Optional hostname; + + private final Optional page; + + private final Optional deviceType; + + private final Optional countryCode; + + private final Optional eventName; + + private final Optional eventType; + + private final Optional customName; + + private final Optional segment; + + private final Optional category; + + private final Optional merchant; + + private final Optional feeType; + + private final Optional product; + + private final Optional status; + + private final Optional accessLevel; + + private final Optional mostRecentAction; + + private final Optional referredUserId; + + private final Optional snapshotWindow; + + private final Optional event; + + private final Map additionalProperties; + + private RetrieveStatsRequest( + Optional> adCampaignIds, + Optional> adGroupIds, + Optional> adIds, + Optional accountId, + Optional userId, + String from, + String to, + Optional interval, + Optional breakdownBy, + Optional convertTo, + Optional currency, + Optional timeZone, + Optional paymentMethod, + Optional cardNetwork, + Optional disputeReason, + Optional source, + Optional hostname, + Optional page, + Optional deviceType, + Optional countryCode, + Optional eventName, + Optional eventType, + Optional customName, + Optional segment, + Optional category, + Optional merchant, + Optional feeType, + Optional product, + Optional status, + Optional accessLevel, + Optional mostRecentAction, + Optional referredUserId, + Optional snapshotWindow, + Optional event, + Map additionalProperties) { + this.adCampaignIds = adCampaignIds; + this.adGroupIds = adGroupIds; + this.adIds = adIds; + this.accountId = accountId; + this.userId = userId; + this.from = from; + this.to = to; + this.interval = interval; + this.breakdownBy = breakdownBy; + this.convertTo = convertTo; + this.currency = currency; + this.timeZone = timeZone; + this.paymentMethod = paymentMethod; + this.cardNetwork = cardNetwork; + this.disputeReason = disputeReason; + this.source = source; + this.hostname = hostname; + this.page = page; + this.deviceType = deviceType; + this.countryCode = countryCode; + this.eventName = eventName; + this.eventType = eventType; + this.customName = customName; + this.segment = segment; + this.category = category; + this.merchant = merchant; + this.feeType = feeType; + this.product = product; + this.status = status; + this.accessLevel = accessLevel; + this.mostRecentAction = mostRecentAction; + this.referredUserId = referredUserId; + this.snapshotWindow = snapshotWindow; + this.event = event; + this.additionalProperties = additionalProperties; + } + + /** + * @return Ad campaign ids (adcamp_...) to scope the report to; stats are summed across them. Available on metrics that list ad_campaign_ids. + */ + @JsonProperty("ad_campaign_ids") + public Optional> getAdCampaignIds() { + return adCampaignIds; + } + + /** + * @return Ad group ids (adgrp_...) to scope the report to; stats are summed across them. Available on metrics that list ad_group_ids. + */ + @JsonProperty("ad_group_ids") + public Optional> getAdGroupIds() { + return adGroupIds; + } + + /** + * @return Ad ids (ad_...) to scope the report to; stats are summed across them. Available on metrics that list ad_ids. + */ + @JsonProperty("ad_ids") + public Optional> getAdIds() { + return adIds; + } + + /** + * @return The account this query concerns, for example biz_AbC123. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The user this query concerns, for example user_AbC123. Available on metrics that support user subjects, such as account_balance. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + /** + * @return Start of the range — a date (YYYY-MM-DD), expanded to the start of that day, or an ISO 8601 timestamp (for example 2026-07-16T16:37:00Z), used exactly. + */ + @JsonProperty("from") + public String getFrom() { + return from; + } + + /** + * @return End of the range — a date (YYYY-MM-DD), expanded to the end of that day, or an ISO 8601 timestamp (for example 2026-07-17T16:37:00Z), used exactly. + */ + @JsonProperty("to") + public String getTo() { + return to; + } + + /** + * @return How wide each point is. Defaults to day. Snapshot metrics are day-only. + */ + @JsonProperty("interval") + public Optional getInterval() { + return interval; + } + + /** + * @return Split the metric out by one of its properties — each point gets a breakdown array. For example breakdown_by=currency returns an entry for usd, an entry for eur, and so on. + */ + @JsonProperty("breakdown_by") + public Optional getBreakdownBy() { + return breakdownBy; + } + + /** + * @return Display currency for money metrics — every amount is converted into this ISO currency using the exchange rate on each period's date. Defaults to usd. For the ads metrics (ad_spend, ad_delivery), pass the account's ads reporting currency to match the ad entity endpoints. On transaction metrics, it is ignored when you filter or break down by currency (those report the original transaction currency, unconverted). + */ + @JsonProperty("convert_to") + public Optional getConvertTo() { + return convertTo; + } + + /** + * @return Select the source currency or asset on metrics that list currency. For transaction metrics, for example currency=eur, values are reported without conversion. For market_prices, use btc or xaut and convert_to=usd. Pair with breakdown_by=currency to split a metric by currency. + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + /** + * @return IANA time zone to bucket the series in, for example America/New_York. Defaults to UTC. Not accepted by snapshot metrics, which are UTC only. + */ + @JsonProperty("time_zone") + public Optional getTimeZone() { + return timeZone; + } + + /** + * @return Filter to a single payment method, for example card or crypto. Available on metrics that list payment_method. + */ + @JsonProperty("payment_method") + public Optional getPaymentMethod() { + return paymentMethod; + } + + /** + * @return Filter to a single card brand, for example visa. A refinement of payment_method=card. Available on metrics that list card_network. + */ + @JsonProperty("card_network") + public Optional getCardNetwork() { + return cardNetwork; + } + + /** + * @return Filter disputes to a normalized reason, for example product_not_received. Pair with breakdown_by=dispute_reason to split dispute counts by reason. + */ + @JsonProperty("dispute_reason") + public Optional getDisputeReason() { + return disputeReason; + } + + /** + * @return Filter to a single GMV source, for example payments — or, on the traffic metrics, a visit source (whop_ads, direct, or a utm_source value). Pair with breakdown_by=source to split by source. Available on metrics that list source. + */ + @JsonProperty("source") + public Optional getSource() { + return source; + } + + /** + * @return Filter traffic metrics to one website hostname, for example shop.example.com. Pair with breakdown_by=hostname to split by website. + */ + @JsonProperty("hostname") + public Optional getHostname() { + return hostname; + } + + /** + * @return Filter traffic metrics to one page — a hostname plus normalized path, for example shop.example.com/pricing. Pair with breakdown_by=page to split by page. + */ + @JsonProperty("page") + public Optional getPage() { + return page; + } + + /** + * @return Filter traffic metrics to one device type: desktop, mobile, tablet, or unknown. Pair with breakdown_by=device_type to split by device. + */ + @JsonProperty("device_type") + public Optional getDeviceType() { + return deviceType; + } + + /** + * @return Filter traffic metrics to one visitor country (uppercase ISO 3166-1 alpha-2, for example US). Pair with breakdown_by=country_code to split by country. + */ + @JsonProperty("country_code") + public Optional getCountryCode() { + return countryCode; + } + + /** + * @return Filter the events metric to one tracked event name, for example pixel.page or pixel.custom. Pair with breakdown_by=event_name to split by event. + */ + @JsonProperty("event_name") + public Optional getEventName() { + return eventName; + } + + /** + * @return Filter the events metric to a canonical group of events: page_view (pixel page views plus whop.com store views), checkout_start (hosted and embedded checkout views), or other. Pair with breakdown_by=event_type to split by group. + */ + @JsonProperty("event_type") + public Optional getEventType() { + return eventType; + } + + /** + * @return Filter the events metric to one merchant-defined custom event name. Only valid alongside event_name=pixel.custom. Pair with breakdown_by=custom_name to split custom events by name. + */ + @JsonProperty("custom_name") + public Optional getCustomName() { + return customName; + } + + /** + * @return Filter to a single wallet-balance segment, for example available. Pair with breakdown_by=segment to split the balance. Available on metrics that list segment. + */ + @JsonProperty("segment") + public Optional getSegment() { + return segment; + } + + /** + * @return Filter to a single balance-activity category, for example payments. Pair with breakdown_by=category to split the activity. Available on metrics that list category. + */ + @JsonProperty("category") + public Optional getCategory() { + return category; + } + + /** + * @return Filter to a single cashback merchant bucket, for example whop-ads. Pair with breakdown_by=merchant to split cashback by merchant. Available on metrics that list merchant. + */ + @JsonProperty("merchant") + public Optional getMerchant() { + return merchant; + } + + /** + * @return Filter to a single fee type. Pair with breakdown_by=fee_type to split fees by type. Available on metrics that list fee_type. + */ + @JsonProperty("fee_type") + public Optional getFeeType() { + return feeType; + } + + /** + * @return Filter to a single product (access pass id), for example prod_AbC123. Pair with breakdown_by=product. Available on metrics that list product. + */ + @JsonProperty("product") + public Optional getProduct() { + return product; + } + + /** + * @return Filter to a single membership status. Pair with breakdown_by=status. Available on metrics that list status. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Filter to a single access level. Pair with breakdown_by=access_level. Available on metrics that list access_level. + */ + @JsonProperty("access_level") + public Optional getAccessLevel() { + return accessLevel; + } + + /** + * @return Filter to a single most-recent member action. Pair with breakdown_by=most_recent_action. Available on metrics that list most_recent_action. + */ + @JsonProperty("most_recent_action") + public Optional getMostRecentAction() { + return mostRecentAction; + } + + /** + * @return Filter a referral metric to the businesses attributed to one person you referred, for example user_AbC123. Available on metrics that list referred_user_id. + */ + @JsonProperty("referred_user_id") + public Optional getReferredUserId() { + return referredUserId; + } + + /** + * @return Window used by a snapshot metric. Ordinary snapshots accept 30d as their trailing activity window. Cohorted dispute metrics accept 7d or 28d as the sales-transaction pool; their attribution window is fixed in the metric name. Each metric lists its accepted values in the catalog. + */ + @JsonProperty("snapshot_window") + public Optional getSnapshotWindow() { + return snapshotWindow; + } + + /** + * @return Filter the events metric to one or more full event names, for example payment.completed or pixel.lead. Comma-separate several to break the metric down by each event. Available on metrics that list event. + */ + @JsonProperty("event") + public Optional getEvent() { + return event; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveStatsRequest && equalTo((RetrieveStatsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveStatsRequest other) { + return adCampaignIds.equals(other.adCampaignIds) + && adGroupIds.equals(other.adGroupIds) + && adIds.equals(other.adIds) + && accountId.equals(other.accountId) + && userId.equals(other.userId) + && from.equals(other.from) + && to.equals(other.to) + && interval.equals(other.interval) + && breakdownBy.equals(other.breakdownBy) + && convertTo.equals(other.convertTo) + && currency.equals(other.currency) + && timeZone.equals(other.timeZone) + && paymentMethod.equals(other.paymentMethod) + && cardNetwork.equals(other.cardNetwork) + && disputeReason.equals(other.disputeReason) + && source.equals(other.source) + && hostname.equals(other.hostname) + && page.equals(other.page) + && deviceType.equals(other.deviceType) + && countryCode.equals(other.countryCode) + && eventName.equals(other.eventName) + && eventType.equals(other.eventType) + && customName.equals(other.customName) + && segment.equals(other.segment) + && category.equals(other.category) + && merchant.equals(other.merchant) + && feeType.equals(other.feeType) + && product.equals(other.product) + && status.equals(other.status) + && accessLevel.equals(other.accessLevel) + && mostRecentAction.equals(other.mostRecentAction) + && referredUserId.equals(other.referredUserId) + && snapshotWindow.equals(other.snapshotWindow) + && event.equals(other.event); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adCampaignIds, + this.adGroupIds, + this.adIds, + this.accountId, + this.userId, + this.from, + this.to, + this.interval, + this.breakdownBy, + this.convertTo, + this.currency, + this.timeZone, + this.paymentMethod, + this.cardNetwork, + this.disputeReason, + this.source, + this.hostname, + this.page, + this.deviceType, + this.countryCode, + this.eventName, + this.eventType, + this.customName, + this.segment, + this.category, + this.merchant, + this.feeType, + this.product, + this.status, + this.accessLevel, + this.mostRecentAction, + this.referredUserId, + this.snapshotWindow, + this.event); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FromStage builder() { + return new Builder(); + } + + public interface FromStage { + /** + *

Start of the range — a date (YYYY-MM-DD), expanded to the start of that day, or an ISO 8601 timestamp (for example 2026-07-16T16:37:00Z), used exactly.

+ */ + ToStage from(@NotNull String from); + + Builder from(RetrieveStatsRequest other); + } + + public interface ToStage { + /** + *

End of the range — a date (YYYY-MM-DD), expanded to the end of that day, or an ISO 8601 timestamp (for example 2026-07-17T16:37:00Z), used exactly.

+ */ + _FinalStage to(@NotNull String to); + } + + public interface _FinalStage { + RetrieveStatsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Ad campaign ids (adcamp_...) to scope the report to; stats are summed across them. Available on metrics that list ad_campaign_ids.

+ */ + _FinalStage adCampaignIds(Optional> adCampaignIds); + + _FinalStage adCampaignIds(List adCampaignIds); + + _FinalStage adCampaignIds(String adCampaignIds); + + /** + *

Ad group ids (adgrp_...) to scope the report to; stats are summed across them. Available on metrics that list ad_group_ids.

+ */ + _FinalStage adGroupIds(Optional> adGroupIds); + + _FinalStage adGroupIds(List adGroupIds); + + _FinalStage adGroupIds(String adGroupIds); + + /** + *

Ad ids (ad_...) to scope the report to; stats are summed across them. Available on metrics that list ad_ids.

+ */ + _FinalStage adIds(Optional> adIds); + + _FinalStage adIds(List adIds); + + _FinalStage adIds(String adIds); + + /** + *

The account this query concerns, for example biz_AbC123.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + /** + *

The user this query concerns, for example user_AbC123. Available on metrics that support user subjects, such as account_balance.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + + /** + *

How wide each point is. Defaults to day. Snapshot metrics are day-only.

+ */ + _FinalStage interval(Optional interval); + + _FinalStage interval(RetrieveStatsRequestInterval interval); + + /** + *

Split the metric out by one of its properties — each point gets a breakdown array. For example breakdown_by=currency returns an entry for usd, an entry for eur, and so on.

+ */ + _FinalStage breakdownBy(Optional breakdownBy); + + _FinalStage breakdownBy(String breakdownBy); + + /** + *

Display currency for money metrics — every amount is converted into this ISO currency using the exchange rate on each period's date. Defaults to usd. For the ads metrics (ad_spend, ad_delivery), pass the account's ads reporting currency to match the ad entity endpoints. On transaction metrics, it is ignored when you filter or break down by currency (those report the original transaction currency, unconverted).

+ */ + _FinalStage convertTo(Optional convertTo); + + _FinalStage convertTo(String convertTo); + + /** + *

Select the source currency or asset on metrics that list currency. For transaction metrics, for example currency=eur, values are reported without conversion. For market_prices, use btc or xaut and convert_to=usd. Pair with breakdown_by=currency to split a metric by currency.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + /** + *

IANA time zone to bucket the series in, for example America/New_York. Defaults to UTC. Not accepted by snapshot metrics, which are UTC only.

+ */ + _FinalStage timeZone(Optional timeZone); + + _FinalStage timeZone(String timeZone); + + /** + *

Filter to a single payment method, for example card or crypto. Available on metrics that list payment_method.

+ */ + _FinalStage paymentMethod(Optional paymentMethod); + + _FinalStage paymentMethod(String paymentMethod); + + /** + *

Filter to a single card brand, for example visa. A refinement of payment_method=card. Available on metrics that list card_network.

+ */ + _FinalStage cardNetwork(Optional cardNetwork); + + _FinalStage cardNetwork(String cardNetwork); + + /** + *

Filter disputes to a normalized reason, for example product_not_received. Pair with breakdown_by=dispute_reason to split dispute counts by reason.

+ */ + _FinalStage disputeReason(Optional disputeReason); + + _FinalStage disputeReason(String disputeReason); + + /** + *

Filter to a single GMV source, for example payments — or, on the traffic metrics, a visit source (whop_ads, direct, or a utm_source value). Pair with breakdown_by=source to split by source. Available on metrics that list source.

+ */ + _FinalStage source(Optional source); + + _FinalStage source(String source); + + /** + *

Filter traffic metrics to one website hostname, for example shop.example.com. Pair with breakdown_by=hostname to split by website.

+ */ + _FinalStage hostname(Optional hostname); + + _FinalStage hostname(String hostname); + + /** + *

Filter traffic metrics to one page — a hostname plus normalized path, for example shop.example.com/pricing. Pair with breakdown_by=page to split by page.

+ */ + _FinalStage page(Optional page); + + _FinalStage page(String page); + + /** + *

Filter traffic metrics to one device type: desktop, mobile, tablet, or unknown. Pair with breakdown_by=device_type to split by device.

+ */ + _FinalStage deviceType(Optional deviceType); + + _FinalStage deviceType(String deviceType); + + /** + *

Filter traffic metrics to one visitor country (uppercase ISO 3166-1 alpha-2, for example US). Pair with breakdown_by=country_code to split by country.

+ */ + _FinalStage countryCode(Optional countryCode); + + _FinalStage countryCode(String countryCode); + + /** + *

Filter the events metric to one tracked event name, for example pixel.page or pixel.custom. Pair with breakdown_by=event_name to split by event.

+ */ + _FinalStage eventName(Optional eventName); + + _FinalStage eventName(String eventName); + + /** + *

Filter the events metric to a canonical group of events: page_view (pixel page views plus whop.com store views), checkout_start (hosted and embedded checkout views), or other. Pair with breakdown_by=event_type to split by group.

+ */ + _FinalStage eventType(Optional eventType); + + _FinalStage eventType(RetrieveStatsRequestEventType eventType); + + /** + *

Filter the events metric to one merchant-defined custom event name. Only valid alongside event_name=pixel.custom. Pair with breakdown_by=custom_name to split custom events by name.

+ */ + _FinalStage customName(Optional customName); + + _FinalStage customName(String customName); + + /** + *

Filter to a single wallet-balance segment, for example available. Pair with breakdown_by=segment to split the balance. Available on metrics that list segment.

+ */ + _FinalStage segment(Optional segment); + + _FinalStage segment(String segment); + + /** + *

Filter to a single balance-activity category, for example payments. Pair with breakdown_by=category to split the activity. Available on metrics that list category.

+ */ + _FinalStage category(Optional category); + + _FinalStage category(String category); + + /** + *

Filter to a single cashback merchant bucket, for example whop-ads. Pair with breakdown_by=merchant to split cashback by merchant. Available on metrics that list merchant.

+ */ + _FinalStage merchant(Optional merchant); + + _FinalStage merchant(String merchant); + + /** + *

Filter to a single fee type. Pair with breakdown_by=fee_type to split fees by type. Available on metrics that list fee_type.

+ */ + _FinalStage feeType(Optional feeType); + + _FinalStage feeType(String feeType); + + /** + *

Filter to a single product (access pass id), for example prod_AbC123. Pair with breakdown_by=product. Available on metrics that list product.

+ */ + _FinalStage product(Optional product); + + _FinalStage product(String product); + + /** + *

Filter to a single membership status. Pair with breakdown_by=status. Available on metrics that list status.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(String status); + + /** + *

Filter to a single access level. Pair with breakdown_by=access_level. Available on metrics that list access_level.

+ */ + _FinalStage accessLevel(Optional accessLevel); + + _FinalStage accessLevel(String accessLevel); + + /** + *

Filter to a single most-recent member action. Pair with breakdown_by=most_recent_action. Available on metrics that list most_recent_action.

+ */ + _FinalStage mostRecentAction(Optional mostRecentAction); + + _FinalStage mostRecentAction(String mostRecentAction); + + /** + *

Filter a referral metric to the businesses attributed to one person you referred, for example user_AbC123. Available on metrics that list referred_user_id.

+ */ + _FinalStage referredUserId(Optional referredUserId); + + _FinalStage referredUserId(String referredUserId); + + /** + *

Window used by a snapshot metric. Ordinary snapshots accept 30d as their trailing activity window. Cohorted dispute metrics accept 7d or 28d as the sales-transaction pool; their attribution window is fixed in the metric name. Each metric lists its accepted values in the catalog.

+ */ + _FinalStage snapshotWindow(Optional snapshotWindow); + + _FinalStage snapshotWindow(RetrieveStatsRequestSnapshotWindow snapshotWindow); + + /** + *

Filter the events metric to one or more full event names, for example payment.completed or pixel.lead. Comma-separate several to break the metric down by each event. Available on metrics that list event.

+ */ + _FinalStage event(Optional event); + + _FinalStage event(String event); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FromStage, ToStage, _FinalStage { + private String from; + + private String to; + + private Optional event = Optional.empty(); + + private Optional snapshotWindow = Optional.empty(); + + private Optional referredUserId = Optional.empty(); + + private Optional mostRecentAction = Optional.empty(); + + private Optional accessLevel = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional product = Optional.empty(); + + private Optional feeType = Optional.empty(); + + private Optional merchant = Optional.empty(); + + private Optional category = Optional.empty(); + + private Optional segment = Optional.empty(); + + private Optional customName = Optional.empty(); + + private Optional eventType = Optional.empty(); + + private Optional eventName = Optional.empty(); + + private Optional countryCode = Optional.empty(); + + private Optional deviceType = Optional.empty(); + + private Optional page = Optional.empty(); + + private Optional hostname = Optional.empty(); + + private Optional source = Optional.empty(); + + private Optional disputeReason = Optional.empty(); + + private Optional cardNetwork = Optional.empty(); + + private Optional paymentMethod = Optional.empty(); + + private Optional timeZone = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional convertTo = Optional.empty(); + + private Optional breakdownBy = Optional.empty(); + + private Optional interval = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional> adIds = Optional.empty(); + + private Optional> adGroupIds = Optional.empty(); + + private Optional> adCampaignIds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveStatsRequest other) { + adCampaignIds(other.getAdCampaignIds()); + adGroupIds(other.getAdGroupIds()); + adIds(other.getAdIds()); + accountId(other.getAccountId()); + userId(other.getUserId()); + from(other.getFrom()); + to(other.getTo()); + interval(other.getInterval()); + breakdownBy(other.getBreakdownBy()); + convertTo(other.getConvertTo()); + currency(other.getCurrency()); + timeZone(other.getTimeZone()); + paymentMethod(other.getPaymentMethod()); + cardNetwork(other.getCardNetwork()); + disputeReason(other.getDisputeReason()); + source(other.getSource()); + hostname(other.getHostname()); + page(other.getPage()); + deviceType(other.getDeviceType()); + countryCode(other.getCountryCode()); + eventName(other.getEventName()); + eventType(other.getEventType()); + customName(other.getCustomName()); + segment(other.getSegment()); + category(other.getCategory()); + merchant(other.getMerchant()); + feeType(other.getFeeType()); + product(other.getProduct()); + status(other.getStatus()); + accessLevel(other.getAccessLevel()); + mostRecentAction(other.getMostRecentAction()); + referredUserId(other.getReferredUserId()); + snapshotWindow(other.getSnapshotWindow()); + event(other.getEvent()); + return this; + } + + /** + *

Start of the range — a date (YYYY-MM-DD), expanded to the start of that day, or an ISO 8601 timestamp (for example 2026-07-16T16:37:00Z), used exactly.

+ *

Start of the range — a date (YYYY-MM-DD), expanded to the start of that day, or an ISO 8601 timestamp (for example 2026-07-16T16:37:00Z), used exactly.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("from") + public ToStage from(@NotNull String from) { + this.from = Objects.requireNonNull(from, "from must not be null"); + return this; + } + + /** + *

End of the range — a date (YYYY-MM-DD), expanded to the end of that day, or an ISO 8601 timestamp (for example 2026-07-17T16:37:00Z), used exactly.

+ *

End of the range — a date (YYYY-MM-DD), expanded to the end of that day, or an ISO 8601 timestamp (for example 2026-07-17T16:37:00Z), used exactly.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("to") + public _FinalStage to(@NotNull String to) { + this.to = Objects.requireNonNull(to, "to must not be null"); + return this; + } + + /** + *

Filter the events metric to one or more full event names, for example payment.completed or pixel.lead. Comma-separate several to break the metric down by each event. Available on metrics that list event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage event(String event) { + this.event = Optional.ofNullable(event); + return this; + } + + /** + *

Filter the events metric to one or more full event names, for example payment.completed or pixel.lead. Comma-separate several to break the metric down by each event. Available on metrics that list event.

+ */ + @java.lang.Override + @JsonSetter(value = "event", nulls = Nulls.SKIP) + public _FinalStage event(Optional event) { + this.event = event; + return this; + } + + /** + *

Window used by a snapshot metric. Ordinary snapshots accept 30d as their trailing activity window. Cohorted dispute metrics accept 7d or 28d as the sales-transaction pool; their attribution window is fixed in the metric name. Each metric lists its accepted values in the catalog.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage snapshotWindow(RetrieveStatsRequestSnapshotWindow snapshotWindow) { + this.snapshotWindow = Optional.ofNullable(snapshotWindow); + return this; + } + + /** + *

Window used by a snapshot metric. Ordinary snapshots accept 30d as their trailing activity window. Cohorted dispute metrics accept 7d or 28d as the sales-transaction pool; their attribution window is fixed in the metric name. Each metric lists its accepted values in the catalog.

+ */ + @java.lang.Override + @JsonSetter(value = "snapshot_window", nulls = Nulls.SKIP) + public _FinalStage snapshotWindow(Optional snapshotWindow) { + this.snapshotWindow = snapshotWindow; + return this; + } + + /** + *

Filter a referral metric to the businesses attributed to one person you referred, for example user_AbC123. Available on metrics that list referred_user_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referredUserId(String referredUserId) { + this.referredUserId = Optional.ofNullable(referredUserId); + return this; + } + + /** + *

Filter a referral metric to the businesses attributed to one person you referred, for example user_AbC123. Available on metrics that list referred_user_id.

+ */ + @java.lang.Override + @JsonSetter(value = "referred_user_id", nulls = Nulls.SKIP) + public _FinalStage referredUserId(Optional referredUserId) { + this.referredUserId = referredUserId; + return this; + } + + /** + *

Filter to a single most-recent member action. Pair with breakdown_by=most_recent_action. Available on metrics that list most_recent_action.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mostRecentAction(String mostRecentAction) { + this.mostRecentAction = Optional.ofNullable(mostRecentAction); + return this; + } + + /** + *

Filter to a single most-recent member action. Pair with breakdown_by=most_recent_action. Available on metrics that list most_recent_action.

+ */ + @java.lang.Override + @JsonSetter(value = "most_recent_action", nulls = Nulls.SKIP) + public _FinalStage mostRecentAction(Optional mostRecentAction) { + this.mostRecentAction = mostRecentAction; + return this; + } + + /** + *

Filter to a single access level. Pair with breakdown_by=access_level. Available on metrics that list access_level.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accessLevel(String accessLevel) { + this.accessLevel = Optional.ofNullable(accessLevel); + return this; + } + + /** + *

Filter to a single access level. Pair with breakdown_by=access_level. Available on metrics that list access_level.

+ */ + @java.lang.Override + @JsonSetter(value = "access_level", nulls = Nulls.SKIP) + public _FinalStage accessLevel(Optional accessLevel) { + this.accessLevel = accessLevel; + return this; + } + + /** + *

Filter to a single membership status. Pair with breakdown_by=status. Available on metrics that list status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(String status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Filter to a single membership status. Pair with breakdown_by=status. Available on metrics that list status.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

Filter to a single product (access pass id), for example prod_AbC123. Pair with breakdown_by=product. Available on metrics that list product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(String product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

Filter to a single product (access pass id), for example prod_AbC123. Pair with breakdown_by=product. Available on metrics that list product.

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

Filter to a single fee type. Pair with breakdown_by=fee_type to split fees by type. Available on metrics that list fee_type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeType(String feeType) { + this.feeType = Optional.ofNullable(feeType); + return this; + } + + /** + *

Filter to a single fee type. Pair with breakdown_by=fee_type to split fees by type. Available on metrics that list fee_type.

+ */ + @java.lang.Override + @JsonSetter(value = "fee_type", nulls = Nulls.SKIP) + public _FinalStage feeType(Optional feeType) { + this.feeType = feeType; + return this; + } + + /** + *

Filter to a single cashback merchant bucket, for example whop-ads. Pair with breakdown_by=merchant to split cashback by merchant. Available on metrics that list merchant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchant(String merchant) { + this.merchant = Optional.ofNullable(merchant); + return this; + } + + /** + *

Filter to a single cashback merchant bucket, for example whop-ads. Pair with breakdown_by=merchant to split cashback by merchant. Available on metrics that list merchant.

+ */ + @java.lang.Override + @JsonSetter(value = "merchant", nulls = Nulls.SKIP) + public _FinalStage merchant(Optional merchant) { + this.merchant = merchant; + return this; + } + + /** + *

Filter to a single balance-activity category, for example payments. Pair with breakdown_by=category to split the activity. Available on metrics that list category.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage category(String category) { + this.category = Optional.ofNullable(category); + return this; + } + + /** + *

Filter to a single balance-activity category, for example payments. Pair with breakdown_by=category to split the activity. Available on metrics that list category.

+ */ + @java.lang.Override + @JsonSetter(value = "category", nulls = Nulls.SKIP) + public _FinalStage category(Optional category) { + this.category = category; + return this; + } + + /** + *

Filter to a single wallet-balance segment, for example available. Pair with breakdown_by=segment to split the balance. Available on metrics that list segment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage segment(String segment) { + this.segment = Optional.ofNullable(segment); + return this; + } + + /** + *

Filter to a single wallet-balance segment, for example available. Pair with breakdown_by=segment to split the balance. Available on metrics that list segment.

+ */ + @java.lang.Override + @JsonSetter(value = "segment", nulls = Nulls.SKIP) + public _FinalStage segment(Optional segment) { + this.segment = segment; + return this; + } + + /** + *

Filter the events metric to one merchant-defined custom event name. Only valid alongside event_name=pixel.custom. Pair with breakdown_by=custom_name to split custom events by name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customName(String customName) { + this.customName = Optional.ofNullable(customName); + return this; + } + + /** + *

Filter the events metric to one merchant-defined custom event name. Only valid alongside event_name=pixel.custom. Pair with breakdown_by=custom_name to split custom events by name.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_name", nulls = Nulls.SKIP) + public _FinalStage customName(Optional customName) { + this.customName = customName; + return this; + } + + /** + *

Filter the events metric to a canonical group of events: page_view (pixel page views plus whop.com store views), checkout_start (hosted and embedded checkout views), or other. Pair with breakdown_by=event_type to split by group.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage eventType(RetrieveStatsRequestEventType eventType) { + this.eventType = Optional.ofNullable(eventType); + return this; + } + + /** + *

Filter the events metric to a canonical group of events: page_view (pixel page views plus whop.com store views), checkout_start (hosted and embedded checkout views), or other. Pair with breakdown_by=event_type to split by group.

+ */ + @java.lang.Override + @JsonSetter(value = "event_type", nulls = Nulls.SKIP) + public _FinalStage eventType(Optional eventType) { + this.eventType = eventType; + return this; + } + + /** + *

Filter the events metric to one tracked event name, for example pixel.page or pixel.custom. Pair with breakdown_by=event_name to split by event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage eventName(String eventName) { + this.eventName = Optional.ofNullable(eventName); + return this; + } + + /** + *

Filter the events metric to one tracked event name, for example pixel.page or pixel.custom. Pair with breakdown_by=event_name to split by event.

+ */ + @java.lang.Override + @JsonSetter(value = "event_name", nulls = Nulls.SKIP) + public _FinalStage eventName(Optional eventName) { + this.eventName = eventName; + return this; + } + + /** + *

Filter traffic metrics to one visitor country (uppercase ISO 3166-1 alpha-2, for example US). Pair with breakdown_by=country_code to split by country.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage countryCode(String countryCode) { + this.countryCode = Optional.ofNullable(countryCode); + return this; + } + + /** + *

Filter traffic metrics to one visitor country (uppercase ISO 3166-1 alpha-2, for example US). Pair with breakdown_by=country_code to split by country.

+ */ + @java.lang.Override + @JsonSetter(value = "country_code", nulls = Nulls.SKIP) + public _FinalStage countryCode(Optional countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + *

Filter traffic metrics to one device type: desktop, mobile, tablet, or unknown. Pair with breakdown_by=device_type to split by device.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage deviceType(String deviceType) { + this.deviceType = Optional.ofNullable(deviceType); + return this; + } + + /** + *

Filter traffic metrics to one device type: desktop, mobile, tablet, or unknown. Pair with breakdown_by=device_type to split by device.

+ */ + @java.lang.Override + @JsonSetter(value = "device_type", nulls = Nulls.SKIP) + public _FinalStage deviceType(Optional deviceType) { + this.deviceType = deviceType; + return this; + } + + /** + *

Filter traffic metrics to one page — a hostname plus normalized path, for example shop.example.com/pricing. Pair with breakdown_by=page to split by page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage page(String page) { + this.page = Optional.ofNullable(page); + return this; + } + + /** + *

Filter traffic metrics to one page — a hostname plus normalized path, for example shop.example.com/pricing. Pair with breakdown_by=page to split by page.

+ */ + @java.lang.Override + @JsonSetter(value = "page", nulls = Nulls.SKIP) + public _FinalStage page(Optional page) { + this.page = page; + return this; + } + + /** + *

Filter traffic metrics to one website hostname, for example shop.example.com. Pair with breakdown_by=hostname to split by website.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostname(String hostname) { + this.hostname = Optional.ofNullable(hostname); + return this; + } + + /** + *

Filter traffic metrics to one website hostname, for example shop.example.com. Pair with breakdown_by=hostname to split by website.

+ */ + @java.lang.Override + @JsonSetter(value = "hostname", nulls = Nulls.SKIP) + public _FinalStage hostname(Optional hostname) { + this.hostname = hostname; + return this; + } + + /** + *

Filter to a single GMV source, for example payments — or, on the traffic metrics, a visit source (whop_ads, direct, or a utm_source value). Pair with breakdown_by=source to split by source. Available on metrics that list source.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(String source) { + this.source = Optional.ofNullable(source); + return this; + } + + /** + *

Filter to a single GMV source, for example payments — or, on the traffic metrics, a visit source (whop_ads, direct, or a utm_source value). Pair with breakdown_by=source to split by source. Available on metrics that list source.

+ */ + @java.lang.Override + @JsonSetter(value = "source", nulls = Nulls.SKIP) + public _FinalStage source(Optional source) { + this.source = source; + return this; + } + + /** + *

Filter disputes to a normalized reason, for example product_not_received. Pair with breakdown_by=dispute_reason to split dispute counts by reason.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputeReason(String disputeReason) { + this.disputeReason = Optional.ofNullable(disputeReason); + return this; + } + + /** + *

Filter disputes to a normalized reason, for example product_not_received. Pair with breakdown_by=dispute_reason to split dispute counts by reason.

+ */ + @java.lang.Override + @JsonSetter(value = "dispute_reason", nulls = Nulls.SKIP) + public _FinalStage disputeReason(Optional disputeReason) { + this.disputeReason = disputeReason; + return this; + } + + /** + *

Filter to a single card brand, for example visa. A refinement of payment_method=card. Available on metrics that list card_network.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardNetwork(String cardNetwork) { + this.cardNetwork = Optional.ofNullable(cardNetwork); + return this; + } + + /** + *

Filter to a single card brand, for example visa. A refinement of payment_method=card. Available on metrics that list card_network.

+ */ + @java.lang.Override + @JsonSetter(value = "card_network", nulls = Nulls.SKIP) + public _FinalStage cardNetwork(Optional cardNetwork) { + this.cardNetwork = cardNetwork; + return this; + } + + /** + *

Filter to a single payment method, for example card or crypto. Available on metrics that list payment_method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethod(String paymentMethod) { + this.paymentMethod = Optional.ofNullable(paymentMethod); + return this; + } + + /** + *

Filter to a single payment method, for example card or crypto. Available on metrics that list payment_method.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method", nulls = Nulls.SKIP) + public _FinalStage paymentMethod(Optional paymentMethod) { + this.paymentMethod = paymentMethod; + return this; + } + + /** + *

IANA time zone to bucket the series in, for example America/New_York. Defaults to UTC. Not accepted by snapshot metrics, which are UTC only.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timeZone(String timeZone) { + this.timeZone = Optional.ofNullable(timeZone); + return this; + } + + /** + *

IANA time zone to bucket the series in, for example America/New_York. Defaults to UTC. Not accepted by snapshot metrics, which are UTC only.

+ */ + @java.lang.Override + @JsonSetter(value = "time_zone", nulls = Nulls.SKIP) + public _FinalStage timeZone(Optional timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + *

Select the source currency or asset on metrics that list currency. For transaction metrics, for example currency=eur, values are reported without conversion. For market_prices, use btc or xaut and convert_to=usd. Pair with breakdown_by=currency to split a metric by currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

Select the source currency or asset on metrics that list currency. For transaction metrics, for example currency=eur, values are reported without conversion. For market_prices, use btc or xaut and convert_to=usd. Pair with breakdown_by=currency to split a metric by currency.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + /** + *

Display currency for money metrics — every amount is converted into this ISO currency using the exchange rate on each period's date. Defaults to usd. For the ads metrics (ad_spend, ad_delivery), pass the account's ads reporting currency to match the ad entity endpoints. On transaction metrics, it is ignored when you filter or break down by currency (those report the original transaction currency, unconverted).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage convertTo(String convertTo) { + this.convertTo = Optional.ofNullable(convertTo); + return this; + } + + /** + *

Display currency for money metrics — every amount is converted into this ISO currency using the exchange rate on each period's date. Defaults to usd. For the ads metrics (ad_spend, ad_delivery), pass the account's ads reporting currency to match the ad entity endpoints. On transaction metrics, it is ignored when you filter or break down by currency (those report the original transaction currency, unconverted).

+ */ + @java.lang.Override + @JsonSetter(value = "convert_to", nulls = Nulls.SKIP) + public _FinalStage convertTo(Optional convertTo) { + this.convertTo = convertTo; + return this; + } + + /** + *

Split the metric out by one of its properties — each point gets a breakdown array. For example breakdown_by=currency returns an entry for usd, an entry for eur, and so on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage breakdownBy(String breakdownBy) { + this.breakdownBy = Optional.ofNullable(breakdownBy); + return this; + } + + /** + *

Split the metric out by one of its properties — each point gets a breakdown array. For example breakdown_by=currency returns an entry for usd, an entry for eur, and so on.

+ */ + @java.lang.Override + @JsonSetter(value = "breakdown_by", nulls = Nulls.SKIP) + public _FinalStage breakdownBy(Optional breakdownBy) { + this.breakdownBy = breakdownBy; + return this; + } + + /** + *

How wide each point is. Defaults to day. Snapshot metrics are day-only.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage interval(RetrieveStatsRequestInterval interval) { + this.interval = Optional.ofNullable(interval); + return this; + } + + /** + *

How wide each point is. Defaults to day. Snapshot metrics are day-only.

+ */ + @java.lang.Override + @JsonSetter(value = "interval", nulls = Nulls.SKIP) + public _FinalStage interval(Optional interval) { + this.interval = interval; + return this; + } + + /** + *

The user this query concerns, for example user_AbC123. Available on metrics that support user subjects, such as account_balance.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

The user this query concerns, for example user_AbC123. Available on metrics that support user subjects, such as account_balance.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

The account this query concerns, for example biz_AbC123.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account this query concerns, for example biz_AbC123.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public _FinalStage adIds(String adIds) { + this.adIds = Optional.of(Collections.singletonList(adIds)); + return this; + } + + /** + *

Ad ids (ad_...) to scope the report to; stats are summed across them. Available on metrics that list ad_ids.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adIds(List adIds) { + this.adIds = Optional.ofNullable(adIds); + return this; + } + + /** + *

Ad ids (ad_...) to scope the report to; stats are summed across them. Available on metrics that list ad_ids.

+ */ + @java.lang.Override + @JsonSetter(value = "ad_ids", nulls = Nulls.SKIP) + public _FinalStage adIds(Optional> adIds) { + this.adIds = adIds; + return this; + } + + @java.lang.Override + public _FinalStage adGroupIds(String adGroupIds) { + this.adGroupIds = Optional.of(Collections.singletonList(adGroupIds)); + return this; + } + + /** + *

Ad group ids (adgrp_...) to scope the report to; stats are summed across them. Available on metrics that list ad_group_ids.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adGroupIds(List adGroupIds) { + this.adGroupIds = Optional.ofNullable(adGroupIds); + return this; + } + + /** + *

Ad group ids (adgrp_...) to scope the report to; stats are summed across them. Available on metrics that list ad_group_ids.

+ */ + @java.lang.Override + @JsonSetter(value = "ad_group_ids", nulls = Nulls.SKIP) + public _FinalStage adGroupIds(Optional> adGroupIds) { + this.adGroupIds = adGroupIds; + return this; + } + + @java.lang.Override + public _FinalStage adCampaignIds(String adCampaignIds) { + this.adCampaignIds = Optional.of(Collections.singletonList(adCampaignIds)); + return this; + } + + /** + *

Ad campaign ids (adcamp_...) to scope the report to; stats are summed across them. Available on metrics that list ad_campaign_ids.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adCampaignIds(List adCampaignIds) { + this.adCampaignIds = Optional.ofNullable(adCampaignIds); + return this; + } + + /** + *

Ad campaign ids (adcamp_...) to scope the report to; stats are summed across them. Available on metrics that list ad_campaign_ids.

+ */ + @java.lang.Override + @JsonSetter(value = "ad_campaign_ids", nulls = Nulls.SKIP) + public _FinalStage adCampaignIds(Optional> adCampaignIds) { + this.adCampaignIds = adCampaignIds; + return this; + } + + @java.lang.Override + public RetrieveStatsRequest build() { + return new RetrieveStatsRequest( + adCampaignIds, + adGroupIds, + adIds, + accountId, + userId, + from, + to, + interval, + breakdownBy, + convertTo, + currency, + timeZone, + paymentMethod, + cardNetwork, + disputeReason, + source, + hostname, + page, + deviceType, + countryCode, + eventName, + eventType, + customName, + segment, + category, + merchant, + feeType, + product, + status, + accessLevel, + mostRecentAction, + referredUserId, + snapshotWindow, + event, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/DescribeStatsResponse.java b/src/main/java/com/whop/api/resources/stats/types/DescribeStatsResponse.java new file mode 100644 index 00000000..cc9020aa --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/DescribeStatsResponse.java @@ -0,0 +1,344 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.whop.api.types.DescribeStatsResponseDescribeMetric; +import com.whop.api.types.DescribeStatsResponseDescribeNode; +import com.whop.api.types.DescribeStatsResponseDescribeRoot; +import com.whop.api.types.DescribeStatsResponseDescribeView; +import java.util.Objects; +import java.util.Optional; + +public final class DescribeStatsResponse { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private DescribeStatsResponse(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static DescribeStatsResponse describeRoot(DescribeStatsResponseDescribeRoot value) { + return new DescribeStatsResponse(new DescribeRootValue(value)); + } + + public static DescribeStatsResponse describeNode(DescribeStatsResponseDescribeNode value) { + return new DescribeStatsResponse(new DescribeNodeValue(value)); + } + + public static DescribeStatsResponse describeMetric(DescribeStatsResponseDescribeMetric value) { + return new DescribeStatsResponse(new DescribeMetricValue(value)); + } + + public static DescribeStatsResponse describeView(DescribeStatsResponseDescribeView value) { + return new DescribeStatsResponse(new DescribeViewValue(value)); + } + + public boolean isDescribeRoot() { + return value instanceof DescribeRootValue; + } + + public boolean isDescribeNode() { + return value instanceof DescribeNodeValue; + } + + public boolean isDescribeMetric() { + return value instanceof DescribeMetricValue; + } + + public boolean isDescribeView() { + return value instanceof DescribeViewValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDescribeRoot() { + if (isDescribeRoot()) { + return Optional.of(((DescribeRootValue) value).value); + } + return Optional.empty(); + } + + public Optional getDescribeNode() { + if (isDescribeNode()) { + return Optional.of(((DescribeNodeValue) value).value); + } + return Optional.empty(); + } + + public Optional getDescribeMetric() { + if (isDescribeMetric()) { + return Optional.of(((DescribeMetricValue) value).value); + } + return Optional.empty(); + } + + public Optional getDescribeView() { + if (isDescribeView()) { + return Optional.of(((DescribeViewValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeStatsResponse && value.equals(((DescribeStatsResponse) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDescribeRoot(DescribeStatsResponseDescribeRoot describeRoot); + + T visitDescribeNode(DescribeStatsResponseDescribeNode describeNode); + + T visitDescribeMetric(DescribeStatsResponseDescribeMetric describeMetric); + + T visitDescribeView(DescribeStatsResponseDescribeView describeView); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DescribeRootValue.class), + @JsonSubTypes.Type(DescribeNodeValue.class), + @JsonSubTypes.Type(DescribeMetricValue.class), + @JsonSubTypes.Type(DescribeViewValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("DescribeRoot") + @JsonIgnoreProperties("typename") + private static final class DescribeRootValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private DescribeStatsResponseDescribeRoot value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DescribeRootValue() {} + + private DescribeRootValue(DescribeStatsResponseDescribeRoot value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDescribeRoot(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeRootValue && equalTo((DescribeRootValue) other); + } + + private boolean equalTo(DescribeRootValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DescribeStatsResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("DescribeNode") + @JsonIgnoreProperties("typename") + private static final class DescribeNodeValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private DescribeStatsResponseDescribeNode value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DescribeNodeValue() {} + + private DescribeNodeValue(DescribeStatsResponseDescribeNode value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDescribeNode(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeNodeValue && equalTo((DescribeNodeValue) other); + } + + private boolean equalTo(DescribeNodeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DescribeStatsResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("DescribeMetric") + @JsonIgnoreProperties("typename") + private static final class DescribeMetricValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private DescribeStatsResponseDescribeMetric value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DescribeMetricValue() {} + + private DescribeMetricValue(DescribeStatsResponseDescribeMetric value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDescribeMetric(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeMetricValue && equalTo((DescribeMetricValue) other); + } + + private boolean equalTo(DescribeMetricValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DescribeStatsResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("DescribeView") + @JsonIgnoreProperties("typename") + private static final class DescribeViewValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private DescribeStatsResponseDescribeView value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DescribeViewValue() {} + + private DescribeViewValue(DescribeStatsResponseDescribeView value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDescribeView(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeViewValue && equalTo((DescribeViewValue) other); + } + + private boolean equalTo(DescribeViewValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DescribeStatsResponse{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "DescribeStatsResponse{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/ListStatsResponse.java b/src/main/java/com/whop/api/resources/stats/types/ListStatsResponse.java new file mode 100644 index 00000000..b5136829 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/ListStatsResponse.java @@ -0,0 +1,122 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListStatsResponse.Builder.class) +public final class ListStatsResponse { + private final List data; + + private final Map additionalProperties; + + private ListStatsResponse(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + /** + * @return The available metrics. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListStatsResponse && equalTo((ListStatsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListStatsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListStatsResponse other) { + data(other.getData()); + return this; + } + + /** + *

The available metrics.

+ */ + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(ListStatsResponseDataItem data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public ListStatsResponse build() { + return new ListStatsResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/ListStatsResponseDataItem.java b/src/main/java/com/whop/api/resources/stats/types/ListStatsResponseDataItem.java new file mode 100644 index 00000000..4924814f --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/ListStatsResponseDataItem.java @@ -0,0 +1,344 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListStatsResponseDataItem.Builder.class) +public final class ListStatsResponseDataItem { + private final String description; + + private final String key; + + private final String name; + + private final List properties; + + private final ListStatsResponseDataItemUnit unit; + + private final Optional> windows; + + private final Map additionalProperties; + + private ListStatsResponseDataItem( + String description, + String key, + String name, + List properties, + ListStatsResponseDataItemUnit unit, + Optional> windows, + Map additionalProperties) { + this.description = description; + this.key = key; + this.name = name; + this.properties = properties; + this.unit = unit; + this.windows = windows; + this.additionalProperties = additionalProperties; + } + + /** + * @return A short description of what the metric measures. + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * @return The metric's key. Pass it to GET /stats/{metric} to query its values. + */ + @JsonProperty("key") + public String getKey() { + return key; + } + + /** + * @return Human-readable display name for the metric. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The properties you can use with this metric — pass one as a filter (property=value) to narrow the series, or as breakdown_by=property to split it. + */ + @JsonProperty("properties") + public List getProperties() { + return properties; + } + + /** + * @return How to read the metric's values: count is an integer, currency is a decimal amount, and percent is a number where 1.6 means 1.6%. + */ + @JsonProperty("unit") + public ListStatsResponseDataItemUnit getUnit() { + return unit; + } + + /** + * @return Snapshot metrics only: the trailing windows you can pass as snapshot_window, for example 30d. Absent on live metrics, which use from/to instead. + */ + @JsonProperty("windows") + public Optional> getWindows() { + return windows; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListStatsResponseDataItem && equalTo((ListStatsResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListStatsResponseDataItem other) { + return description.equals(other.description) + && key.equals(other.key) + && name.equals(other.name) + && properties.equals(other.properties) + && unit.equals(other.unit) + && windows.equals(other.windows); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.description, this.key, this.name, this.properties, this.unit, this.windows); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DescriptionStage builder() { + return new Builder(); + } + + public interface DescriptionStage { + /** + *

A short description of what the metric measures.

+ */ + KeyStage description(@NotNull String description); + + Builder from(ListStatsResponseDataItem other); + } + + public interface KeyStage { + /** + *

The metric's key. Pass it to GET /stats/{metric} to query its values.

+ */ + NameStage key(@NotNull String key); + } + + public interface NameStage { + /** + *

Human-readable display name for the metric.

+ */ + UnitStage name(@NotNull String name); + } + + public interface UnitStage { + /** + *

How to read the metric's values: count is an integer, currency is a decimal amount, and percent is a number where 1.6 means 1.6%.

+ */ + _FinalStage unit(@NotNull ListStatsResponseDataItemUnit unit); + } + + public interface _FinalStage { + ListStatsResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The properties you can use with this metric — pass one as a filter (property=value) to narrow the series, or as breakdown_by=property to split it.

+ */ + _FinalStage properties(List properties); + + _FinalStage addProperties(String properties); + + _FinalStage addAllProperties(List properties); + + /** + *

Snapshot metrics only: the trailing windows you can pass as snapshot_window, for example 30d. Absent on live metrics, which use from/to instead.

+ */ + _FinalStage windows(Optional> windows); + + _FinalStage windows(List windows); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DescriptionStage, KeyStage, NameStage, UnitStage, _FinalStage { + private String description; + + private String key; + + private String name; + + private ListStatsResponseDataItemUnit unit; + + private Optional> windows = Optional.empty(); + + private List properties = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListStatsResponseDataItem other) { + description(other.getDescription()); + key(other.getKey()); + name(other.getName()); + properties(other.getProperties()); + unit(other.getUnit()); + windows(other.getWindows()); + return this; + } + + /** + *

A short description of what the metric measures.

+ *

A short description of what the metric measures.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("description") + public KeyStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + /** + *

The metric's key. Pass it to GET /stats/{metric} to query its values.

+ *

The metric's key. Pass it to GET /stats/{metric} to query its values.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("key") + public NameStage key(@NotNull String key) { + this.key = Objects.requireNonNull(key, "key must not be null"); + return this; + } + + /** + *

Human-readable display name for the metric.

+ *

Human-readable display name for the metric.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public UnitStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

How to read the metric's values: count is an integer, currency is a decimal amount, and percent is a number where 1.6 means 1.6%.

+ *

How to read the metric's values: count is an integer, currency is a decimal amount, and percent is a number where 1.6 means 1.6%.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("unit") + public _FinalStage unit(@NotNull ListStatsResponseDataItemUnit unit) { + this.unit = Objects.requireNonNull(unit, "unit must not be null"); + return this; + } + + /** + *

Snapshot metrics only: the trailing windows you can pass as snapshot_window, for example 30d. Absent on live metrics, which use from/to instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage windows(List windows) { + this.windows = Optional.ofNullable(windows); + return this; + } + + /** + *

Snapshot metrics only: the trailing windows you can pass as snapshot_window, for example 30d. Absent on live metrics, which use from/to instead.

+ */ + @java.lang.Override + @JsonSetter(value = "windows", nulls = Nulls.SKIP) + public _FinalStage windows(Optional> windows) { + this.windows = windows; + return this; + } + + /** + *

The properties you can use with this metric — pass one as a filter (property=value) to narrow the series, or as breakdown_by=property to split it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllProperties(List properties) { + if (properties != null) { + this.properties.addAll(properties); + } + return this; + } + + /** + *

The properties you can use with this metric — pass one as a filter (property=value) to narrow the series, or as breakdown_by=property to split it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addProperties(String properties) { + this.properties.add(properties); + return this; + } + + /** + *

The properties you can use with this metric — pass one as a filter (property=value) to narrow the series, or as breakdown_by=property to split it.

+ */ + @java.lang.Override + @JsonSetter(value = "properties", nulls = Nulls.SKIP) + public _FinalStage properties(List properties) { + this.properties.clear(); + if (properties != null) { + this.properties.addAll(properties); + } + return this; + } + + @java.lang.Override + public ListStatsResponseDataItem build() { + return new ListStatsResponseDataItem( + description, key, name, properties, unit, windows, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/ListStatsResponseDataItemUnit.java b/src/main/java/com/whop/api/resources/stats/types/ListStatsResponseDataItemUnit.java new file mode 100644 index 00000000..87203245 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/ListStatsResponseDataItemUnit.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListStatsResponseDataItemUnit { + public static final ListStatsResponseDataItemUnit CURRENCY = + new ListStatsResponseDataItemUnit(Value.CURRENCY, "currency"); + + public static final ListStatsResponseDataItemUnit COUNT = new ListStatsResponseDataItemUnit(Value.COUNT, "count"); + + public static final ListStatsResponseDataItemUnit PERCENT = + new ListStatsResponseDataItemUnit(Value.PERCENT, "percent"); + + private final Value value; + + private final String string; + + ListStatsResponseDataItemUnit(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListStatsResponseDataItemUnit + && this.string.equals(((ListStatsResponseDataItemUnit) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CURRENCY: + return visitor.visitCurrency(); + case COUNT: + return visitor.visitCount(); + case PERCENT: + return visitor.visitPercent(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListStatsResponseDataItemUnit valueOf(String value) { + switch (value) { + case "currency": + return CURRENCY; + case "count": + return COUNT; + case "percent": + return PERCENT; + default: + return new ListStatsResponseDataItemUnit(Value.UNKNOWN, value); + } + } + + public enum Value { + COUNT, + + CURRENCY, + + PERCENT, + + UNKNOWN + } + + public interface Visitor { + T visitCount(); + + T visitCurrency(); + + T visitPercent(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/MetricStatsResponse.java b/src/main/java/com/whop/api/resources/stats/types/MetricStatsResponse.java new file mode 100644 index 00000000..4f8d702d --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/MetricStatsResponse.java @@ -0,0 +1,487 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MetricStatsResponse.Builder.class) +public final class MetricStatsResponse { + private final Optional> columns; + + private final Optional>> data; + + private final Optional debug; + + private final Optional node; + + private final Optional pagination; + + private final MetricStatsResponseTypename typename; + + private final Map additionalProperties; + + private MetricStatsResponse( + Optional> columns, + Optional>> data, + Optional debug, + Optional node, + Optional pagination, + MetricStatsResponseTypename typename, + Map additionalProperties) { + this.columns = columns; + this.data = data; + this.debug = debug; + this.node = node; + this.pagination = pagination; + this.typename = typename; + this.additionalProperties = additionalProperties; + } + + /** + * @return Column names in the order they appear in each data row. + */ + @JsonIgnore + public Optional> getColumns() { + if (columns == null) { + return Optional.empty(); + } + return columns; + } + + /** + * @return Array of data rows, where each row is an array of values matching the columns order. + */ + @JsonIgnore + public Optional>> getData() { + if (data == null) { + return Optional.empty(); + } + return data; + } + + /** + * @return Debug information including engine and SQL. + */ + @JsonIgnore + public Optional getDebug() { + if (debug == null) { + return Optional.empty(); + } + return debug; + } + + /** + * @return The node path that was queried. + */ + @JsonIgnore + public Optional getNode() { + if (node == null) { + return Optional.empty(); + } + return node; + } + + /** + * @return Pagination information. + */ + @JsonIgnore + public Optional getPagination() { + if (pagination == null) { + return Optional.empty(); + } + return pagination; + } + + /** + * @return The typename of this object + */ + @JsonProperty("typename") + public MetricStatsResponseTypename getTypename() { + return typename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("columns") + private Optional> _getColumns() { + return columns; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("data") + private Optional>> _getData() { + return data; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("debug") + private Optional _getDebug() { + return debug; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("node") + private Optional _getNode() { + return node; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("pagination") + private Optional _getPagination() { + return pagination; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MetricStatsResponse && equalTo((MetricStatsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MetricStatsResponse other) { + return columns.equals(other.columns) + && data.equals(other.data) + && debug.equals(other.debug) + && node.equals(other.node) + && pagination.equals(other.pagination) + && typename.equals(other.typename); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.columns, this.data, this.debug, this.node, this.pagination, this.typename); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypenameStage builder() { + return new Builder(); + } + + public interface TypenameStage { + /** + *

The typename of this object

+ */ + _FinalStage typename(@NotNull MetricStatsResponseTypename typename); + + Builder from(MetricStatsResponse other); + } + + public interface _FinalStage { + MetricStatsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Column names in the order they appear in each data row.

+ */ + _FinalStage columns(Optional> columns); + + _FinalStage columns(List columns); + + _FinalStage columns(Nullable> columns); + + /** + *

Array of data rows, where each row is an array of values matching the columns order.

+ */ + _FinalStage data(Optional>> data); + + _FinalStage data(List> data); + + _FinalStage data(Nullable>> data); + + /** + *

Debug information including engine and SQL.

+ */ + _FinalStage debug(Optional debug); + + _FinalStage debug(MetricStatsResponseDebug debug); + + _FinalStage debug(Nullable debug); + + /** + *

The node path that was queried.

+ */ + _FinalStage node(Optional node); + + _FinalStage node(String node); + + _FinalStage node(Nullable node); + + /** + *

Pagination information.

+ */ + _FinalStage pagination(Optional pagination); + + _FinalStage pagination(MetricStatsResponsePagination pagination); + + _FinalStage pagination(Nullable pagination); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypenameStage, _FinalStage { + private MetricStatsResponseTypename typename; + + private Optional pagination = Optional.empty(); + + private Optional node = Optional.empty(); + + private Optional debug = Optional.empty(); + + private Optional>> data = Optional.empty(); + + private Optional> columns = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MetricStatsResponse other) { + columns(other.getColumns()); + data(other.getData()); + debug(other.getDebug()); + node(other.getNode()); + pagination(other.getPagination()); + typename(other.getTypename()); + return this; + } + + /** + *

The typename of this object

+ *

The typename of this object

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("typename") + public _FinalStage typename(@NotNull MetricStatsResponseTypename typename) { + this.typename = Objects.requireNonNull(typename, "typename must not be null"); + return this; + } + + /** + *

Pagination information.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pagination(Nullable pagination) { + if (pagination.isNull()) { + this.pagination = null; + } else if (pagination.isEmpty()) { + this.pagination = Optional.empty(); + } else { + this.pagination = Optional.of(pagination.get()); + } + return this; + } + + /** + *

Pagination information.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage pagination(MetricStatsResponsePagination pagination) { + this.pagination = Optional.ofNullable(pagination); + return this; + } + + /** + *

Pagination information.

+ */ + @java.lang.Override + @JsonSetter(value = "pagination", nulls = Nulls.SKIP) + public _FinalStage pagination(Optional pagination) { + this.pagination = pagination; + return this; + } + + /** + *

The node path that was queried.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage node(Nullable node) { + if (node.isNull()) { + this.node = null; + } else if (node.isEmpty()) { + this.node = Optional.empty(); + } else { + this.node = Optional.of(node.get()); + } + return this; + } + + /** + *

The node path that was queried.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage node(String node) { + this.node = Optional.ofNullable(node); + return this; + } + + /** + *

The node path that was queried.

+ */ + @java.lang.Override + @JsonSetter(value = "node", nulls = Nulls.SKIP) + public _FinalStage node(Optional node) { + this.node = node; + return this; + } + + /** + *

Debug information including engine and SQL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage debug(Nullable debug) { + if (debug.isNull()) { + this.debug = null; + } else if (debug.isEmpty()) { + this.debug = Optional.empty(); + } else { + this.debug = Optional.of(debug.get()); + } + return this; + } + + /** + *

Debug information including engine and SQL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage debug(MetricStatsResponseDebug debug) { + this.debug = Optional.ofNullable(debug); + return this; + } + + /** + *

Debug information including engine and SQL.

+ */ + @java.lang.Override + @JsonSetter(value = "debug", nulls = Nulls.SKIP) + public _FinalStage debug(Optional debug) { + this.debug = debug; + return this; + } + + /** + *

Array of data rows, where each row is an array of values matching the columns order.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage data(Nullable>> data) { + if (data.isNull()) { + this.data = null; + } else if (data.isEmpty()) { + this.data = Optional.empty(); + } else { + this.data = Optional.of(data.get()); + } + return this; + } + + /** + *

Array of data rows, where each row is an array of values matching the columns order.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage data(List> data) { + this.data = Optional.ofNullable(data); + return this; + } + + /** + *

Array of data rows, where each row is an array of values matching the columns order.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(Optional>> data) { + this.data = data; + return this; + } + + /** + *

Column names in the order they appear in each data row.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage columns(Nullable> columns) { + if (columns.isNull()) { + this.columns = null; + } else if (columns.isEmpty()) { + this.columns = Optional.empty(); + } else { + this.columns = Optional.of(columns.get()); + } + return this; + } + + /** + *

Column names in the order they appear in each data row.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage columns(List columns) { + this.columns = Optional.ofNullable(columns); + return this; + } + + /** + *

Column names in the order they appear in each data row.

+ */ + @java.lang.Override + @JsonSetter(value = "columns", nulls = Nulls.SKIP) + public _FinalStage columns(Optional> columns) { + this.columns = columns; + return this; + } + + @java.lang.Override + public MetricStatsResponse build() { + return new MetricStatsResponse(columns, data, debug, node, pagination, typename, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/MetricStatsResponseDebug.java b/src/main/java/com/whop/api/resources/stats/types/MetricStatsResponseDebug.java new file mode 100644 index 00000000..eb9dd784 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/MetricStatsResponseDebug.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MetricStatsResponseDebug.Builder.class) +public final class MetricStatsResponseDebug { + private final Optional engine; + + private final Optional requestId; + + private final Optional sql; + + private final Map additionalProperties; + + private MetricStatsResponseDebug( + Optional engine, + Optional requestId, + Optional sql, + Map additionalProperties) { + this.engine = engine; + this.requestId = requestId; + this.sql = sql; + this.additionalProperties = additionalProperties; + } + + /** + * @return The query engine used. + */ + @JsonIgnore + public Optional getEngine() { + if (engine == null) { + return Optional.empty(); + } + return engine; + } + + /** + * @return Unique request identifier for debugging. + */ + @JsonIgnore + public Optional getRequestId() { + if (requestId == null) { + return Optional.empty(); + } + return requestId; + } + + /** + * @return The generated SQL query (with IDs sanitized). + */ + @JsonIgnore + public Optional getSql() { + if (sql == null) { + return Optional.empty(); + } + return sql; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("engine") + private Optional _getEngine() { + return engine; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("request_id") + private Optional _getRequestId() { + return requestId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("sql") + private Optional _getSql() { + return sql; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MetricStatsResponseDebug && equalTo((MetricStatsResponseDebug) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MetricStatsResponseDebug other) { + return engine.equals(other.engine) && requestId.equals(other.requestId) && sql.equals(other.sql); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.engine, this.requestId, this.sql); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional engine = Optional.empty(); + + private Optional requestId = Optional.empty(); + + private Optional sql = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MetricStatsResponseDebug other) { + engine(other.getEngine()); + requestId(other.getRequestId()); + sql(other.getSql()); + return this; + } + + /** + *

The query engine used.

+ */ + @JsonSetter(value = "engine", nulls = Nulls.SKIP) + public Builder engine(Optional engine) { + this.engine = engine; + return this; + } + + public Builder engine(String engine) { + this.engine = Optional.ofNullable(engine); + return this; + } + + public Builder engine(Nullable engine) { + if (engine.isNull()) { + this.engine = null; + } else if (engine.isEmpty()) { + this.engine = Optional.empty(); + } else { + this.engine = Optional.of(engine.get()); + } + return this; + } + + /** + *

Unique request identifier for debugging.

+ */ + @JsonSetter(value = "request_id", nulls = Nulls.SKIP) + public Builder requestId(Optional requestId) { + this.requestId = requestId; + return this; + } + + public Builder requestId(String requestId) { + this.requestId = Optional.ofNullable(requestId); + return this; + } + + public Builder requestId(Nullable requestId) { + if (requestId.isNull()) { + this.requestId = null; + } else if (requestId.isEmpty()) { + this.requestId = Optional.empty(); + } else { + this.requestId = Optional.of(requestId.get()); + } + return this; + } + + /** + *

The generated SQL query (with IDs sanitized).

+ */ + @JsonSetter(value = "sql", nulls = Nulls.SKIP) + public Builder sql(Optional sql) { + this.sql = sql; + return this; + } + + public Builder sql(String sql) { + this.sql = Optional.ofNullable(sql); + return this; + } + + public Builder sql(Nullable sql) { + if (sql.isNull()) { + this.sql = null; + } else if (sql.isEmpty()) { + this.sql = Optional.empty(); + } else { + this.sql = Optional.of(sql.get()); + } + return this; + } + + public MetricStatsResponseDebug build() { + return new MetricStatsResponseDebug(engine, requestId, sql, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/MetricStatsResponsePagination.java b/src/main/java/com/whop/api/resources/stats/types/MetricStatsResponsePagination.java new file mode 100644 index 00000000..5d6eb3dd --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/MetricStatsResponsePagination.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MetricStatsResponsePagination.Builder.class) +public final class MetricStatsResponsePagination { + private final Optional nextCursor; + + private final Map additionalProperties; + + private MetricStatsResponsePagination(Optional nextCursor, Map additionalProperties) { + this.nextCursor = nextCursor; + this.additionalProperties = additionalProperties; + } + + /** + * @return Cursor for the next page of results. + */ + @JsonIgnore + public Optional getNextCursor() { + if (nextCursor == null) { + return Optional.empty(); + } + return nextCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("next_cursor") + private Optional _getNextCursor() { + return nextCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MetricStatsResponsePagination && equalTo((MetricStatsResponsePagination) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MetricStatsResponsePagination other) { + return nextCursor.equals(other.nextCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.nextCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional nextCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MetricStatsResponsePagination other) { + nextCursor(other.getNextCursor()); + return this; + } + + /** + *

Cursor for the next page of results.

+ */ + @JsonSetter(value = "next_cursor", nulls = Nulls.SKIP) + public Builder nextCursor(Optional nextCursor) { + this.nextCursor = nextCursor; + return this; + } + + public Builder nextCursor(String nextCursor) { + this.nextCursor = Optional.ofNullable(nextCursor); + return this; + } + + public Builder nextCursor(Nullable nextCursor) { + if (nextCursor.isNull()) { + this.nextCursor = null; + } else if (nextCursor.isEmpty()) { + this.nextCursor = Optional.empty(); + } else { + this.nextCursor = Optional.of(nextCursor.get()); + } + return this; + } + + public MetricStatsResponsePagination build() { + return new MetricStatsResponsePagination(nextCursor, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/MetricStatsResponseTypename.java b/src/main/java/com/whop/api/resources/stats/types/MetricStatsResponseTypename.java new file mode 100644 index 00000000..59a6a361 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/MetricStatsResponseTypename.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MetricStatsResponseTypename { + public static final MetricStatsResponseTypename RESULT = new MetricStatsResponseTypename(Value.RESULT, "Result"); + + private final Value value; + + private final String string; + + MetricStatsResponseTypename(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MetricStatsResponseTypename + && this.string.equals(((MetricStatsResponseTypename) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RESULT: + return visitor.visitResult(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MetricStatsResponseTypename valueOf(String value) { + switch (value) { + case "Result": + return RESULT; + default: + return new MetricStatsResponseTypename(Value.UNKNOWN, value); + } + } + + public enum Value { + RESULT, + + UNKNOWN + } + + public interface Visitor { + T visitResult(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/RawStatsResponse.java b/src/main/java/com/whop/api/resources/stats/types/RawStatsResponse.java new file mode 100644 index 00000000..cdc8e544 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/RawStatsResponse.java @@ -0,0 +1,337 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RawStatsResponse.Builder.class) +public final class RawStatsResponse { + private final Optional> columns; + + private final Optional>> data; + + private final Optional debug; + + private final Optional node; + + private final Optional pagination; + + private final Map additionalProperties; + + private RawStatsResponse( + Optional> columns, + Optional>> data, + Optional debug, + Optional node, + Optional pagination, + Map additionalProperties) { + this.columns = columns; + this.data = data; + this.debug = debug; + this.node = node; + this.pagination = pagination; + this.additionalProperties = additionalProperties; + } + + /** + * @return Column names in the order they appear in each data row. + */ + @JsonIgnore + public Optional> getColumns() { + if (columns == null) { + return Optional.empty(); + } + return columns; + } + + /** + * @return Array of data rows, where each row is an array of values matching the columns order. + */ + @JsonIgnore + public Optional>> getData() { + if (data == null) { + return Optional.empty(); + } + return data; + } + + /** + * @return Debug information including engine and SQL. + */ + @JsonIgnore + public Optional getDebug() { + if (debug == null) { + return Optional.empty(); + } + return debug; + } + + /** + * @return The node path that was queried. + */ + @JsonIgnore + public Optional getNode() { + if (node == null) { + return Optional.empty(); + } + return node; + } + + /** + * @return Pagination information. + */ + @JsonIgnore + public Optional getPagination() { + if (pagination == null) { + return Optional.empty(); + } + return pagination; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("columns") + private Optional> _getColumns() { + return columns; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("data") + private Optional>> _getData() { + return data; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("debug") + private Optional _getDebug() { + return debug; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("node") + private Optional _getNode() { + return node; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("pagination") + private Optional _getPagination() { + return pagination; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RawStatsResponse && equalTo((RawStatsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RawStatsResponse other) { + return columns.equals(other.columns) + && data.equals(other.data) + && debug.equals(other.debug) + && node.equals(other.node) + && pagination.equals(other.pagination); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.columns, this.data, this.debug, this.node, this.pagination); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> columns = Optional.empty(); + + private Optional>> data = Optional.empty(); + + private Optional debug = Optional.empty(); + + private Optional node = Optional.empty(); + + private Optional pagination = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RawStatsResponse other) { + columns(other.getColumns()); + data(other.getData()); + debug(other.getDebug()); + node(other.getNode()); + pagination(other.getPagination()); + return this; + } + + /** + *

Column names in the order they appear in each data row.

+ */ + @JsonSetter(value = "columns", nulls = Nulls.SKIP) + public Builder columns(Optional> columns) { + this.columns = columns; + return this; + } + + public Builder columns(List columns) { + this.columns = Optional.ofNullable(columns); + return this; + } + + public Builder columns(Nullable> columns) { + if (columns.isNull()) { + this.columns = null; + } else if (columns.isEmpty()) { + this.columns = Optional.empty(); + } else { + this.columns = Optional.of(columns.get()); + } + return this; + } + + /** + *

Array of data rows, where each row is an array of values matching the columns order.

+ */ + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(Optional>> data) { + this.data = data; + return this; + } + + public Builder data(List> data) { + this.data = Optional.ofNullable(data); + return this; + } + + public Builder data(Nullable>> data) { + if (data.isNull()) { + this.data = null; + } else if (data.isEmpty()) { + this.data = Optional.empty(); + } else { + this.data = Optional.of(data.get()); + } + return this; + } + + /** + *

Debug information including engine and SQL.

+ */ + @JsonSetter(value = "debug", nulls = Nulls.SKIP) + public Builder debug(Optional debug) { + this.debug = debug; + return this; + } + + public Builder debug(RawStatsResponseDebug debug) { + this.debug = Optional.ofNullable(debug); + return this; + } + + public Builder debug(Nullable debug) { + if (debug.isNull()) { + this.debug = null; + } else if (debug.isEmpty()) { + this.debug = Optional.empty(); + } else { + this.debug = Optional.of(debug.get()); + } + return this; + } + + /** + *

The node path that was queried.

+ */ + @JsonSetter(value = "node", nulls = Nulls.SKIP) + public Builder node(Optional node) { + this.node = node; + return this; + } + + public Builder node(String node) { + this.node = Optional.ofNullable(node); + return this; + } + + public Builder node(Nullable node) { + if (node.isNull()) { + this.node = null; + } else if (node.isEmpty()) { + this.node = Optional.empty(); + } else { + this.node = Optional.of(node.get()); + } + return this; + } + + /** + *

Pagination information.

+ */ + @JsonSetter(value = "pagination", nulls = Nulls.SKIP) + public Builder pagination(Optional pagination) { + this.pagination = pagination; + return this; + } + + public Builder pagination(RawStatsResponsePagination pagination) { + this.pagination = Optional.ofNullable(pagination); + return this; + } + + public Builder pagination(Nullable pagination) { + if (pagination.isNull()) { + this.pagination = null; + } else if (pagination.isEmpty()) { + this.pagination = Optional.empty(); + } else { + this.pagination = Optional.of(pagination.get()); + } + return this; + } + + public RawStatsResponse build() { + return new RawStatsResponse(columns, data, debug, node, pagination, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/RawStatsResponseDebug.java b/src/main/java/com/whop/api/resources/stats/types/RawStatsResponseDebug.java new file mode 100644 index 00000000..83c50e08 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/RawStatsResponseDebug.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RawStatsResponseDebug.Builder.class) +public final class RawStatsResponseDebug { + private final Optional engine; + + private final Optional requestId; + + private final Optional sql; + + private final Map additionalProperties; + + private RawStatsResponseDebug( + Optional engine, + Optional requestId, + Optional sql, + Map additionalProperties) { + this.engine = engine; + this.requestId = requestId; + this.sql = sql; + this.additionalProperties = additionalProperties; + } + + /** + * @return The query engine used. + */ + @JsonIgnore + public Optional getEngine() { + if (engine == null) { + return Optional.empty(); + } + return engine; + } + + /** + * @return Unique request identifier for debugging. + */ + @JsonIgnore + public Optional getRequestId() { + if (requestId == null) { + return Optional.empty(); + } + return requestId; + } + + /** + * @return The generated SQL query (with IDs sanitized). + */ + @JsonIgnore + public Optional getSql() { + if (sql == null) { + return Optional.empty(); + } + return sql; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("engine") + private Optional _getEngine() { + return engine; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("request_id") + private Optional _getRequestId() { + return requestId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("sql") + private Optional _getSql() { + return sql; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RawStatsResponseDebug && equalTo((RawStatsResponseDebug) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RawStatsResponseDebug other) { + return engine.equals(other.engine) && requestId.equals(other.requestId) && sql.equals(other.sql); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.engine, this.requestId, this.sql); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional engine = Optional.empty(); + + private Optional requestId = Optional.empty(); + + private Optional sql = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RawStatsResponseDebug other) { + engine(other.getEngine()); + requestId(other.getRequestId()); + sql(other.getSql()); + return this; + } + + /** + *

The query engine used.

+ */ + @JsonSetter(value = "engine", nulls = Nulls.SKIP) + public Builder engine(Optional engine) { + this.engine = engine; + return this; + } + + public Builder engine(String engine) { + this.engine = Optional.ofNullable(engine); + return this; + } + + public Builder engine(Nullable engine) { + if (engine.isNull()) { + this.engine = null; + } else if (engine.isEmpty()) { + this.engine = Optional.empty(); + } else { + this.engine = Optional.of(engine.get()); + } + return this; + } + + /** + *

Unique request identifier for debugging.

+ */ + @JsonSetter(value = "request_id", nulls = Nulls.SKIP) + public Builder requestId(Optional requestId) { + this.requestId = requestId; + return this; + } + + public Builder requestId(String requestId) { + this.requestId = Optional.ofNullable(requestId); + return this; + } + + public Builder requestId(Nullable requestId) { + if (requestId.isNull()) { + this.requestId = null; + } else if (requestId.isEmpty()) { + this.requestId = Optional.empty(); + } else { + this.requestId = Optional.of(requestId.get()); + } + return this; + } + + /** + *

The generated SQL query (with IDs sanitized).

+ */ + @JsonSetter(value = "sql", nulls = Nulls.SKIP) + public Builder sql(Optional sql) { + this.sql = sql; + return this; + } + + public Builder sql(String sql) { + this.sql = Optional.ofNullable(sql); + return this; + } + + public Builder sql(Nullable sql) { + if (sql.isNull()) { + this.sql = null; + } else if (sql.isEmpty()) { + this.sql = Optional.empty(); + } else { + this.sql = Optional.of(sql.get()); + } + return this; + } + + public RawStatsResponseDebug build() { + return new RawStatsResponseDebug(engine, requestId, sql, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/RawStatsResponsePagination.java b/src/main/java/com/whop/api/resources/stats/types/RawStatsResponsePagination.java new file mode 100644 index 00000000..65ab4de8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/RawStatsResponsePagination.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RawStatsResponsePagination.Builder.class) +public final class RawStatsResponsePagination { + private final Optional nextCursor; + + private final Map additionalProperties; + + private RawStatsResponsePagination(Optional nextCursor, Map additionalProperties) { + this.nextCursor = nextCursor; + this.additionalProperties = additionalProperties; + } + + /** + * @return Cursor for the next page of results. + */ + @JsonIgnore + public Optional getNextCursor() { + if (nextCursor == null) { + return Optional.empty(); + } + return nextCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("next_cursor") + private Optional _getNextCursor() { + return nextCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RawStatsResponsePagination && equalTo((RawStatsResponsePagination) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RawStatsResponsePagination other) { + return nextCursor.equals(other.nextCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.nextCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional nextCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RawStatsResponsePagination other) { + nextCursor(other.getNextCursor()); + return this; + } + + /** + *

Cursor for the next page of results.

+ */ + @JsonSetter(value = "next_cursor", nulls = Nulls.SKIP) + public Builder nextCursor(Optional nextCursor) { + this.nextCursor = nextCursor; + return this; + } + + public Builder nextCursor(String nextCursor) { + this.nextCursor = Optional.ofNullable(nextCursor); + return this; + } + + public Builder nextCursor(Nullable nextCursor) { + if (nextCursor.isNull()) { + this.nextCursor = null; + } else if (nextCursor.isEmpty()) { + this.nextCursor = Optional.empty(); + } else { + this.nextCursor = Optional.of(nextCursor.get()); + } + return this; + } + + public RawStatsResponsePagination build() { + return new RawStatsResponsePagination(nextCursor, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsRequestEventType.java b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsRequestEventType.java new file mode 100644 index 00000000..18703697 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsRequestEventType.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveStatsRequestEventType { + public static final RetrieveStatsRequestEventType PAGE_VIEW = + new RetrieveStatsRequestEventType(Value.PAGE_VIEW, "page_view"); + + public static final RetrieveStatsRequestEventType OTHER = new RetrieveStatsRequestEventType(Value.OTHER, "other"); + + public static final RetrieveStatsRequestEventType CHECKOUT_START = + new RetrieveStatsRequestEventType(Value.CHECKOUT_START, "checkout_start"); + + private final Value value; + + private final String string; + + RetrieveStatsRequestEventType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveStatsRequestEventType + && this.string.equals(((RetrieveStatsRequestEventType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAGE_VIEW: + return visitor.visitPageView(); + case OTHER: + return visitor.visitOther(); + case CHECKOUT_START: + return visitor.visitCheckoutStart(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveStatsRequestEventType valueOf(String value) { + switch (value) { + case "page_view": + return PAGE_VIEW; + case "other": + return OTHER; + case "checkout_start": + return CHECKOUT_START; + default: + return new RetrieveStatsRequestEventType(Value.UNKNOWN, value); + } + } + + public enum Value { + PAGE_VIEW, + + CHECKOUT_START, + + OTHER, + + UNKNOWN + } + + public interface Visitor { + T visitPageView(); + + T visitCheckoutStart(); + + T visitOther(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsRequestInterval.java b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsRequestInterval.java new file mode 100644 index 00000000..c32427e3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsRequestInterval.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveStatsRequestInterval { + public static final RetrieveStatsRequestInterval MONTH = new RetrieveStatsRequestInterval(Value.MONTH, "month"); + + public static final RetrieveStatsRequestInterval HOUR = new RetrieveStatsRequestInterval(Value.HOUR, "hour"); + + public static final RetrieveStatsRequestInterval DAY = new RetrieveStatsRequestInterval(Value.DAY, "day"); + + public static final RetrieveStatsRequestInterval MINUTE = new RetrieveStatsRequestInterval(Value.MINUTE, "minute"); + + public static final RetrieveStatsRequestInterval THIRTY_MINUTES = + new RetrieveStatsRequestInterval(Value.THIRTY_MINUTES, "thirty_minutes"); + + public static final RetrieveStatsRequestInterval WEEK = new RetrieveStatsRequestInterval(Value.WEEK, "week"); + + public static final RetrieveStatsRequestInterval FIVE_MINUTES = + new RetrieveStatsRequestInterval(Value.FIVE_MINUTES, "five_minutes"); + + public static final RetrieveStatsRequestInterval YEAR = new RetrieveStatsRequestInterval(Value.YEAR, "year"); + + private final Value value; + + private final String string; + + RetrieveStatsRequestInterval(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveStatsRequestInterval + && this.string.equals(((RetrieveStatsRequestInterval) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MONTH: + return visitor.visitMonth(); + case HOUR: + return visitor.visitHour(); + case DAY: + return visitor.visitDay(); + case MINUTE: + return visitor.visitMinute(); + case THIRTY_MINUTES: + return visitor.visitThirtyMinutes(); + case WEEK: + return visitor.visitWeek(); + case FIVE_MINUTES: + return visitor.visitFiveMinutes(); + case YEAR: + return visitor.visitYear(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveStatsRequestInterval valueOf(String value) { + switch (value) { + case "month": + return MONTH; + case "hour": + return HOUR; + case "day": + return DAY; + case "minute": + return MINUTE; + case "thirty_minutes": + return THIRTY_MINUTES; + case "week": + return WEEK; + case "five_minutes": + return FIVE_MINUTES; + case "year": + return YEAR; + default: + return new RetrieveStatsRequestInterval(Value.UNKNOWN, value); + } + } + + public enum Value { + MINUTE, + + FIVE_MINUTES, + + THIRTY_MINUTES, + + HOUR, + + DAY, + + WEEK, + + MONTH, + + YEAR, + + UNKNOWN + } + + public interface Visitor { + T visitMinute(); + + T visitFiveMinutes(); + + T visitThirtyMinutes(); + + T visitHour(); + + T visitDay(); + + T visitWeek(); + + T visitMonth(); + + T visitYear(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsRequestSnapshotWindow.java b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsRequestSnapshotWindow.java new file mode 100644 index 00000000..7539236f --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsRequestSnapshotWindow.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveStatsRequestSnapshotWindow { + public static final RetrieveStatsRequestSnapshotWindow SEVEN_D = + new RetrieveStatsRequestSnapshotWindow(Value.SEVEN_D, "7d"); + + public static final RetrieveStatsRequestSnapshotWindow TWENTY_EIGHT_D = + new RetrieveStatsRequestSnapshotWindow(Value.TWENTY_EIGHT_D, "28d"); + + public static final RetrieveStatsRequestSnapshotWindow THIRTY_D = + new RetrieveStatsRequestSnapshotWindow(Value.THIRTY_D, "30d"); + + private final Value value; + + private final String string; + + RetrieveStatsRequestSnapshotWindow(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveStatsRequestSnapshotWindow + && this.string.equals(((RetrieveStatsRequestSnapshotWindow) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SEVEN_D: + return visitor.visitSevenD(); + case TWENTY_EIGHT_D: + return visitor.visitTwentyEightD(); + case THIRTY_D: + return visitor.visitThirtyD(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveStatsRequestSnapshotWindow valueOf(String value) { + switch (value) { + case "7d": + return SEVEN_D; + case "28d": + return TWENTY_EIGHT_D; + case "30d": + return THIRTY_D; + default: + return new RetrieveStatsRequestSnapshotWindow(Value.UNKNOWN, value); + } + } + + public enum Value { + SEVEN_D, + + TWENTY_EIGHT_D, + + THIRTY_D, + + UNKNOWN + } + + public interface Visitor { + T visitSevenD(); + + T visitTwentyEightD(); + + T visitThirtyD(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsResponse.java b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsResponse.java new file mode 100644 index 00000000..dd91dcdf --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsResponse.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveStatsResponse.Builder.class) +public final class RetrieveStatsResponse { + private final RetrieveStatsResponseData data; + + private final Map additionalProperties; + + private RetrieveStatsResponse(RetrieveStatsResponseData data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public RetrieveStatsResponseData getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveStatsResponse && equalTo((RetrieveStatsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveStatsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull RetrieveStatsResponseData data); + + Builder from(RetrieveStatsResponse other); + } + + public interface _FinalStage { + RetrieveStatsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private RetrieveStatsResponseData data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveStatsResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull RetrieveStatsResponseData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public RetrieveStatsResponse build() { + return new RetrieveStatsResponse(data, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsResponseData.java b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsResponseData.java new file mode 100644 index 00000000..3f36f418 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsResponseData.java @@ -0,0 +1,226 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveStatsResponseData.Builder.class) +public final class RetrieveStatsResponseData { + private final Optional currency; + + private final List points; + + private final Optional> totals; + + private final Map additionalProperties; + + private RetrieveStatsResponseData( + Optional currency, + List points, + Optional> totals, + Map additionalProperties) { + this.currency = currency; + this.points = points; + this.totals = totals; + this.additionalProperties = additionalProperties; + } + + /** + * @return ISO currency the values are denominated in. Present for currency-unit metrics: the convert_to currency, or usd. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return One entry per period, oldest first. + */ + @JsonProperty("points") + public List getPoints() { + return points; + } + + /** + * @return Whole-window aggregates, present when the metric computes them. Don't derive these from points: a rate is measured across the whole window, not averaged across its points, and unique-people counts exist only at window level. + */ + @JsonIgnore + public Optional> getTotals() { + if (totals == null) { + return Optional.empty(); + } + return totals; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("totals") + private Optional> _getTotals() { + return totals; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveStatsResponseData && equalTo((RetrieveStatsResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveStatsResponseData other) { + return currency.equals(other.currency) && points.equals(other.points) && totals.equals(other.totals); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.points, this.totals); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional currency = Optional.empty(); + + private List points = new ArrayList<>(); + + private Optional> totals = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveStatsResponseData other) { + currency(other.getCurrency()); + points(other.getPoints()); + totals(other.getTotals()); + return this; + } + + /** + *

ISO currency the values are denominated in. Present for currency-unit metrics: the convert_to currency, or usd.

+ */ + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public Builder currency(Optional currency) { + this.currency = currency; + return this; + } + + public Builder currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + public Builder currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

One entry per period, oldest first.

+ */ + @JsonSetter(value = "points", nulls = Nulls.SKIP) + public Builder points(List points) { + this.points.clear(); + if (points != null) { + this.points.addAll(points); + } + return this; + } + + public Builder addPoints(RetrieveStatsResponseDataPointsItem points) { + this.points.add(points); + return this; + } + + public Builder addAllPoints(List points) { + if (points != null) { + this.points.addAll(points); + } + return this; + } + + /** + *

Whole-window aggregates, present when the metric computes them. Don't derive these from points: a rate is measured across the whole window, not averaged across its points, and unique-people counts exist only at window level.

+ */ + @JsonSetter(value = "totals", nulls = Nulls.SKIP) + public Builder totals(Optional> totals) { + this.totals = totals; + return this; + } + + public Builder totals(List totals) { + this.totals = Optional.ofNullable(totals); + return this; + } + + public Builder totals(Nullable> totals) { + if (totals.isNull()) { + this.totals = null; + } else if (totals.isEmpty()) { + this.totals = Optional.empty(); + } else { + this.totals = Optional.of(totals.get()); + } + return this; + } + + public RetrieveStatsResponseData build() { + return new RetrieveStatsResponseData(currency, points, totals, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsResponseDataPointsItem.java b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsResponseDataPointsItem.java new file mode 100644 index 00000000..96c7a491 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsResponseDataPointsItem.java @@ -0,0 +1,248 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveStatsResponseDataPointsItem.Builder.class) +public final class RetrieveStatsResponseDataPointsItem { + private final Optional> breakdown; + + private final int timestamp; + + private final Optional value; + + private final Map additionalProperties; + + private RetrieveStatsResponseDataPointsItem( + Optional> breakdown, + int timestamp, + Optional value, + Map additionalProperties) { + this.breakdown = breakdown; + this.timestamp = timestamp; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return Present only when broken down: one entry per property value in this period. + */ + @JsonProperty("breakdown") + public Optional> getBreakdown() { + return breakdown; + } + + /** + * @return Unix timestamp (seconds) of the period start. + */ + @JsonProperty("timestamp") + public int getTimestamp() { + return timestamp; + } + + /** + * @return The metric's value for this period, in the metric's unit. + */ + @JsonIgnore + public Optional getValue() { + if (value == null) { + return Optional.empty(); + } + return value; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("value") + private Optional _getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveStatsResponseDataPointsItem + && equalTo((RetrieveStatsResponseDataPointsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveStatsResponseDataPointsItem other) { + return breakdown.equals(other.breakdown) && timestamp == other.timestamp && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.breakdown, this.timestamp, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TimestampStage builder() { + return new Builder(); + } + + public interface TimestampStage { + /** + *

Unix timestamp (seconds) of the period start.

+ */ + _FinalStage timestamp(int timestamp); + + Builder from(RetrieveStatsResponseDataPointsItem other); + } + + public interface _FinalStage { + RetrieveStatsResponseDataPointsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Present only when broken down: one entry per property value in this period.

+ */ + _FinalStage breakdown(Optional> breakdown); + + _FinalStage breakdown(List breakdown); + + /** + *

The metric's value for this period, in the metric's unit.

+ */ + _FinalStage value(Optional value); + + _FinalStage value(Double value); + + _FinalStage value(Nullable value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TimestampStage, _FinalStage { + private int timestamp; + + private Optional value = Optional.empty(); + + private Optional> breakdown = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveStatsResponseDataPointsItem other) { + breakdown(other.getBreakdown()); + timestamp(other.getTimestamp()); + value(other.getValue()); + return this; + } + + /** + *

Unix timestamp (seconds) of the period start.

+ *

Unix timestamp (seconds) of the period start.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public _FinalStage timestamp(int timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + *

The metric's value for this period, in the metric's unit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage value(Nullable value) { + if (value.isNull()) { + this.value = null; + } else if (value.isEmpty()) { + this.value = Optional.empty(); + } else { + this.value = Optional.of(value.get()); + } + return this; + } + + /** + *

The metric's value for this period, in the metric's unit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage value(Double value) { + this.value = Optional.ofNullable(value); + return this; + } + + /** + *

The metric's value for this period, in the metric's unit.

+ */ + @java.lang.Override + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public _FinalStage value(Optional value) { + this.value = value; + return this; + } + + /** + *

Present only when broken down: one entry per property value in this period.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage breakdown(List breakdown) { + this.breakdown = Optional.ofNullable(breakdown); + return this; + } + + /** + *

Present only when broken down: one entry per property value in this period.

+ */ + @java.lang.Override + @JsonSetter(value = "breakdown", nulls = Nulls.SKIP) + public _FinalStage breakdown(Optional> breakdown) { + this.breakdown = breakdown; + return this; + } + + @java.lang.Override + public RetrieveStatsResponseDataPointsItem build() { + return new RetrieveStatsResponseDataPointsItem(breakdown, timestamp, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsResponseDataPointsItemBreakdownItem.java b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsResponseDataPointsItemBreakdownItem.java new file mode 100644 index 00000000..d8d1578e --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsResponseDataPointsItemBreakdownItem.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveStatsResponseDataPointsItemBreakdownItem.Builder.class) +public final class RetrieveStatsResponseDataPointsItemBreakdownItem { + private final String name; + + private final Optional value; + + private final Map additionalProperties; + + private RetrieveStatsResponseDataPointsItemBreakdownItem( + String name, Optional value, Map additionalProperties) { + this.name = name; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return The property value, for example usd or visa. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The metric's value for this entry. + */ + @JsonIgnore + public Optional getValue() { + if (value == null) { + return Optional.empty(); + } + return value; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("value") + private Optional _getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveStatsResponseDataPointsItemBreakdownItem + && equalTo((RetrieveStatsResponseDataPointsItemBreakdownItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveStatsResponseDataPointsItemBreakdownItem other) { + return name.equals(other.name) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

The property value, for example usd or visa.

+ */ + _FinalStage name(@NotNull String name); + + Builder from(RetrieveStatsResponseDataPointsItemBreakdownItem other); + } + + public interface _FinalStage { + RetrieveStatsResponseDataPointsItemBreakdownItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The metric's value for this entry.

+ */ + _FinalStage value(Optional value); + + _FinalStage value(Double value); + + _FinalStage value(Nullable value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + private Optional value = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveStatsResponseDataPointsItemBreakdownItem other) { + name(other.getName()); + value(other.getValue()); + return this; + } + + /** + *

The property value, for example usd or visa.

+ *

The property value, for example usd or visa.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The metric's value for this entry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage value(Nullable value) { + if (value.isNull()) { + this.value = null; + } else if (value.isEmpty()) { + this.value = Optional.empty(); + } else { + this.value = Optional.of(value.get()); + } + return this; + } + + /** + *

The metric's value for this entry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage value(Double value) { + this.value = Optional.ofNullable(value); + return this; + } + + /** + *

The metric's value for this entry.

+ */ + @java.lang.Override + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public _FinalStage value(Optional value) { + this.value = value; + return this; + } + + @java.lang.Override + public RetrieveStatsResponseDataPointsItemBreakdownItem build() { + return new RetrieveStatsResponseDataPointsItemBreakdownItem(name, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsResponseDataTotalsItem.java b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsResponseDataTotalsItem.java new file mode 100644 index 00000000..015a7143 --- /dev/null +++ b/src/main/java/com/whop/api/resources/stats/types/RetrieveStatsResponseDataTotalsItem.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.stats.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveStatsResponseDataTotalsItem.Builder.class) +public final class RetrieveStatsResponseDataTotalsItem { + private final String name; + + private final Optional value; + + private final Map additionalProperties; + + private RetrieveStatsResponseDataTotalsItem( + String name, Optional value, Map additionalProperties) { + this.name = name; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return The property value this total is for, or the metric's name when it isn't split by a property. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The metric's whole-window value for this entry. + */ + @JsonIgnore + public Optional getValue() { + if (value == null) { + return Optional.empty(); + } + return value; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("value") + private Optional _getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveStatsResponseDataTotalsItem + && equalTo((RetrieveStatsResponseDataTotalsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveStatsResponseDataTotalsItem other) { + return name.equals(other.name) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

The property value this total is for, or the metric's name when it isn't split by a property.

+ */ + _FinalStage name(@NotNull String name); + + Builder from(RetrieveStatsResponseDataTotalsItem other); + } + + public interface _FinalStage { + RetrieveStatsResponseDataTotalsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The metric's whole-window value for this entry.

+ */ + _FinalStage value(Optional value); + + _FinalStage value(Double value); + + _FinalStage value(Nullable value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + private Optional value = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveStatsResponseDataTotalsItem other) { + name(other.getName()); + value(other.getValue()); + return this; + } + + /** + *

The property value this total is for, or the metric's name when it isn't split by a property.

+ *

The property value this total is for, or the metric's name when it isn't split by a property.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The metric's whole-window value for this entry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage value(Nullable value) { + if (value.isNull()) { + this.value = null; + } else if (value.isEmpty()) { + this.value = Optional.empty(); + } else { + this.value = Optional.of(value.get()); + } + return this; + } + + /** + *

The metric's whole-window value for this entry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage value(Double value) { + this.value = Optional.ofNullable(value); + return this; + } + + /** + *

The metric's whole-window value for this entry.

+ */ + @java.lang.Override + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public _FinalStage value(Optional value) { + this.value = value; + return this; + } + + @java.lang.Override + public RetrieveStatsResponseDataTotalsItem build() { + return new RetrieveStatsResponseDataTotalsItem(name, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/supportchannels/AsyncRawSupportChannelsClient.java b/src/main/java/com/whop/api/resources/supportchannels/AsyncRawSupportChannelsClient.java new file mode 100644 index 00000000..0ba784af --- /dev/null +++ b/src/main/java/com/whop/api/resources/supportchannels/AsyncRawSupportChannelsClient.java @@ -0,0 +1,486 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.supportchannels; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.supportchannels.requests.CreateSupportChannelsRequest; +import com.whop.api.resources.supportchannels.requests.ListSupportChannelsRequest; +import com.whop.api.resources.supportchannels.requests.RetrieveSupportChannelsRequest; +import com.whop.api.resources.supportchannels.types.ListSupportChannelsResponse; +import com.whop.api.types.SupportChannel; +import com.whop.api.types.SupportChannelListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawSupportChannelsClient { + protected final ClientOptions clientOptions; + + public AsyncRawSupportChannelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture>> list() { + return list(ListSupportChannelsRequest.builder().build()); + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListSupportChannelsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture>> list( + ListSupportChannelsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture>> list( + ListSupportChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("support_channels"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getView().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "view", request.getView().get(), false); + } + if (request.getOpen().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "open", request.getOpen().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListSupportChannelsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListSupportChannelsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListSupportChannelsRequest nextRequest = ListSupportChannelsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Open a new support channel between a company team member and a customer. Returns the existing channel if one already exists for that user. + *

Required permissions:

+ *
    + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture> create(CreateSupportChannelsRequest request) { + return create(request, null); + } + + /** + * Open a new support channel between a company team member and a customer. Returns the existing channel if one already exists for that user. + *

Required permissions:

+ *
    + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture> create( + CreateSupportChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("support_channels"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SupportChannel.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveSupportChannelsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveSupportChannelsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveSupportChannelsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveSupportChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("support_channels") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SupportChannel.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/supportchannels/AsyncSupportChannelsClient.java b/src/main/java/com/whop/api/resources/supportchannels/AsyncSupportChannelsClient.java new file mode 100644 index 00000000..61255c88 --- /dev/null +++ b/src/main/java/com/whop/api/resources/supportchannels/AsyncSupportChannelsClient.java @@ -0,0 +1,145 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.supportchannels; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.supportchannels.requests.CreateSupportChannelsRequest; +import com.whop.api.resources.supportchannels.requests.ListSupportChannelsRequest; +import com.whop.api.resources.supportchannels.requests.RetrieveSupportChannelsRequest; +import com.whop.api.types.SupportChannel; +import com.whop.api.types.SupportChannelListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncSupportChannelsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawSupportChannelsClient rawClient; + + public AsyncSupportChannelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawSupportChannelsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawSupportChannelsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> list(ListSupportChannelsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture> list( + ListSupportChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Open a new support channel between a company team member and a customer. Returns the existing channel if one already exists for that user. + *

Required permissions:

+ *
    + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture create(CreateSupportChannelsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Open a new support channel between a company team member and a customer. Returns the existing channel if one already exists for that user. + *

Required permissions:

+ *
    + *
  • support_chat:create
  • + *
+ */ + public CompletableFuture create( + CreateSupportChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveSupportChannelsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveSupportChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/supportchannels/RawSupportChannelsClient.java b/src/main/java/com/whop/api/resources/supportchannels/RawSupportChannelsClient.java new file mode 100644 index 00000000..2ddd6951 --- /dev/null +++ b/src/main/java/com/whop/api/resources/supportchannels/RawSupportChannelsClient.java @@ -0,0 +1,386 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.supportchannels; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.supportchannels.requests.CreateSupportChannelsRequest; +import com.whop.api.resources.supportchannels.requests.ListSupportChannelsRequest; +import com.whop.api.resources.supportchannels.requests.RetrieveSupportChannelsRequest; +import com.whop.api.resources.supportchannels.types.ListSupportChannelsResponse; +import com.whop.api.types.SupportChannel; +import com.whop.api.types.SupportChannelListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawSupportChannelsClient { + protected final ClientOptions clientOptions; + + public RawSupportChannelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse> list() { + return list(ListSupportChannelsRequest.builder().build()); + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListSupportChannelsRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListSupportChannelsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListSupportChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("support_channels"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getView().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "view", request.getView().get(), false); + } + if (request.getOpen().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "open", request.getOpen().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListSupportChannelsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListSupportChannelsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListSupportChannelsRequest nextRequest = ListSupportChannelsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Open a new support channel between a company team member and a customer. Returns the existing channel if one already exists for that user. + *

Required permissions:

+ *
    + *
  • support_chat:create
  • + *
+ */ + public WhopApiHttpResponse create(CreateSupportChannelsRequest request) { + return create(request, null); + } + + /** + * Open a new support channel between a company team member and a customer. Returns the existing channel if one already exists for that user. + *

Required permissions:

+ *
    + *
  • support_chat:create
  • + *
+ */ + public WhopApiHttpResponse create( + CreateSupportChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("support_channels"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SupportChannel.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveSupportChannelsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveSupportChannelsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveSupportChannelsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveSupportChannelsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("support_channels") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SupportChannel.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/supportchannels/SupportChannelsClient.java b/src/main/java/com/whop/api/resources/supportchannels/SupportChannelsClient.java new file mode 100644 index 00000000..72e91a74 --- /dev/null +++ b/src/main/java/com/whop/api/resources/supportchannels/SupportChannelsClient.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.supportchannels; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.supportchannels.requests.CreateSupportChannelsRequest; +import com.whop.api.resources.supportchannels.requests.ListSupportChannelsRequest; +import com.whop.api.resources.supportchannels.requests.RetrieveSupportChannelsRequest; +import com.whop.api.types.SupportChannel; +import com.whop.api.types.SupportChannelListItem; + +public class SupportChannelsClient { + protected final ClientOptions clientOptions; + + private final RawSupportChannelsClient rawClient; + + public SupportChannelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawSupportChannelsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawSupportChannelsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public SyncPagingIterable list(ListSupportChannelsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public SyncPagingIterable list( + ListSupportChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Open a new support channel between a company team member and a customer. Returns the existing channel if one already exists for that user. + *

Required permissions:

+ *
    + *
  • support_chat:create
  • + *
+ */ + public SupportChannel create(CreateSupportChannelsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Open a new support channel between a company team member and a customer. Returns the existing channel if one already exists for that user. + *

Required permissions:

+ *
    + *
  • support_chat:create
  • + *
+ */ + public SupportChannel create(CreateSupportChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public SupportChannel retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public SupportChannel retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public SupportChannel retrieve(String id, RetrieveSupportChannelsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing support channel. + *

Required permissions:

+ *
    + *
  • support_chat:read
  • + *
+ */ + public SupportChannel retrieve(String id, RetrieveSupportChannelsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/supportchannels/requests/CreateSupportChannelsRequest.java b/src/main/java/com/whop/api/resources/supportchannels/requests/CreateSupportChannelsRequest.java new file mode 100644 index 00000000..40f1d2eb --- /dev/null +++ b/src/main/java/com/whop/api/resources/supportchannels/requests/CreateSupportChannelsRequest.java @@ -0,0 +1,312 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.supportchannels.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSupportChannelsRequest.Builder.class) +public final class CreateSupportChannelsRequest { + private final String companyId; + + private final Optional customName; + + private final Optional notificationsEnabled; + + private final String userId; + + private final Map additionalProperties; + + private CreateSupportChannelsRequest( + String companyId, + Optional customName, + Optional notificationsEnabled, + String userId, + Map additionalProperties) { + this.companyId = companyId; + this.customName = customName; + this.notificationsEnabled = notificationsEnabled; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the company to create the support channel in. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return Optional custom display name for the support channel. + */ + @JsonIgnore + public Optional getCustomName() { + if (customName == null) { + return Optional.empty(); + } + return customName; + } + + /** + * @return Whether Whop app notifications are enabled for this support channel. Webhooks still fire. + */ + @JsonIgnore + public Optional getNotificationsEnabled() { + if (notificationsEnabled == null) { + return Optional.empty(); + } + return notificationsEnabled; + } + + /** + * @return The user ID (e.g. 'user_xxxxx') or username of the customer to open a support channel for. + */ + @JsonProperty("user_id") + public String getUserId() { + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_name") + private Optional _getCustomName() { + return customName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notifications_enabled") + private Optional _getNotificationsEnabled() { + return notificationsEnabled; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSupportChannelsRequest && equalTo((CreateSupportChannelsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSupportChannelsRequest other) { + return companyId.equals(other.companyId) + && customName.equals(other.customName) + && notificationsEnabled.equals(other.notificationsEnabled) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.customName, this.notificationsEnabled, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to create the support channel in.

+ */ + UserIdStage companyId(@NotNull String companyId); + + Builder from(CreateSupportChannelsRequest other); + } + + public interface UserIdStage { + /** + *

The user ID (e.g. 'user_xxxxx') or username of the customer to open a support channel for.

+ */ + _FinalStage userId(@NotNull String userId); + } + + public interface _FinalStage { + CreateSupportChannelsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Optional custom display name for the support channel.

+ */ + _FinalStage customName(Optional customName); + + _FinalStage customName(String customName); + + _FinalStage customName(Nullable customName); + + /** + *

Whether Whop app notifications are enabled for this support channel. Webhooks still fire.

+ */ + _FinalStage notificationsEnabled(Optional notificationsEnabled); + + _FinalStage notificationsEnabled(Boolean notificationsEnabled); + + _FinalStage notificationsEnabled(Nullable notificationsEnabled); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, UserIdStage, _FinalStage { + private String companyId; + + private String userId; + + private Optional notificationsEnabled = Optional.empty(); + + private Optional customName = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateSupportChannelsRequest other) { + companyId(other.getCompanyId()); + customName(other.getCustomName()); + notificationsEnabled(other.getNotificationsEnabled()); + userId(other.getUserId()); + return this; + } + + /** + *

The unique identifier of the company to create the support channel in.

+ *

The unique identifier of the company to create the support channel in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public UserIdStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The user ID (e.g. 'user_xxxxx') or username of the customer to open a support channel for.

+ *

The user ID (e.g. 'user_xxxxx') or username of the customer to open a support channel for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user_id") + public _FinalStage userId(@NotNull String userId) { + this.userId = Objects.requireNonNull(userId, "userId must not be null"); + return this; + } + + /** + *

Whether Whop app notifications are enabled for this support channel. Webhooks still fire.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notificationsEnabled(Nullable notificationsEnabled) { + if (notificationsEnabled.isNull()) { + this.notificationsEnabled = null; + } else if (notificationsEnabled.isEmpty()) { + this.notificationsEnabled = Optional.empty(); + } else { + this.notificationsEnabled = Optional.of(notificationsEnabled.get()); + } + return this; + } + + /** + *

Whether Whop app notifications are enabled for this support channel. Webhooks still fire.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notificationsEnabled(Boolean notificationsEnabled) { + this.notificationsEnabled = Optional.ofNullable(notificationsEnabled); + return this; + } + + /** + *

Whether Whop app notifications are enabled for this support channel. Webhooks still fire.

+ */ + @java.lang.Override + @JsonSetter(value = "notifications_enabled", nulls = Nulls.SKIP) + public _FinalStage notificationsEnabled(Optional notificationsEnabled) { + this.notificationsEnabled = notificationsEnabled; + return this; + } + + /** + *

Optional custom display name for the support channel.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customName(Nullable customName) { + if (customName.isNull()) { + this.customName = null; + } else if (customName.isEmpty()) { + this.customName = Optional.empty(); + } else { + this.customName = Optional.of(customName.get()); + } + return this; + } + + /** + *

Optional custom display name for the support channel.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customName(String customName) { + this.customName = Optional.ofNullable(customName); + return this; + } + + /** + *

Optional custom display name for the support channel.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_name", nulls = Nulls.SKIP) + public _FinalStage customName(Optional customName) { + this.customName = customName; + return this; + } + + @java.lang.Override + public CreateSupportChannelsRequest build() { + return new CreateSupportChannelsRequest( + companyId, customName, notificationsEnabled, userId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/supportchannels/requests/ListSupportChannelsRequest.java b/src/main/java/com/whop/api/resources/supportchannels/requests/ListSupportChannelsRequest.java new file mode 100644 index 00000000..bfda3f16 --- /dev/null +++ b/src/main/java/com/whop/api/resources/supportchannels/requests/ListSupportChannelsRequest.java @@ -0,0 +1,348 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.supportchannels.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Direction; +import com.whop.api.types.MessageChannelOrder; +import com.whop.api.types.SupportChannelView; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSupportChannelsRequest.Builder.class) +public final class ListSupportChannelsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Optional companyId; + + private final Optional view; + + private final Optional open; + + private final Optional direction; + + private final Optional order; + + private final Map additionalProperties; + + private ListSupportChannelsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + Optional companyId, + Optional view, + Optional open, + Optional direction, + Optional order, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.view = view; + this.open = open; + this.direction = direction; + this.order = order; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to list support channels for. Includes channels of child companies. When omitted, returns support channels across all companies the user has access to. + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("view") + public Optional getView() { + return view; + } + + /** + * @return Whether to filter by open or resolved support channels. Set to true to only return channels awaiting a response, or false for resolved channels. + */ + @JsonProperty("open") + public Optional getOpen() { + return open; + } + + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSupportChannelsRequest && equalTo((ListSupportChannelsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSupportChannelsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId) + && view.equals(other.view) + && open.equals(other.open) + && direction.equals(other.direction) + && order.equals(other.order); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.after, + this.before, + this.first, + this.last, + this.companyId, + this.view, + this.open, + this.direction, + this.order); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional companyId = Optional.empty(); + + private Optional view = Optional.empty(); + + private Optional open = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional order = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListSupportChannelsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + view(other.getView()); + open(other.getOpen()); + direction(other.getDirection()); + order(other.getOrder()); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The unique identifier of the company to list support channels for. Includes channels of child companies. When omitted, returns support channels across all companies the user has access to.

+ */ + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + @JsonSetter(value = "view", nulls = Nulls.SKIP) + public Builder view(Optional view) { + this.view = view; + return this; + } + + public Builder view(SupportChannelView view) { + this.view = Optional.ofNullable(view); + return this; + } + + /** + *

Whether to filter by open or resolved support channels. Set to true to only return channels awaiting a response, or false for resolved channels.

+ */ + @JsonSetter(value = "open", nulls = Nulls.SKIP) + public Builder open(Optional open) { + this.open = open; + return this; + } + + public Builder open(Boolean open) { + this.open = Optional.ofNullable(open); + return this; + } + + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(Direction direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(MessageChannelOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + public ListSupportChannelsRequest build() { + return new ListSupportChannelsRequest( + after, before, first, last, companyId, view, open, direction, order, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/supportchannels/requests/RetrieveSupportChannelsRequest.java b/src/main/java/com/whop/api/resources/supportchannels/requests/RetrieveSupportChannelsRequest.java new file mode 100644 index 00000000..cb275b35 --- /dev/null +++ b/src/main/java/com/whop/api/resources/supportchannels/requests/RetrieveSupportChannelsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.supportchannels.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveSupportChannelsRequest.Builder.class) +public final class RetrieveSupportChannelsRequest { + private final Map additionalProperties; + + private RetrieveSupportChannelsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveSupportChannelsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveSupportChannelsRequest other) { + return this; + } + + public RetrieveSupportChannelsRequest build() { + return new RetrieveSupportChannelsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/supportchannels/types/ListSupportChannelsResponse.java b/src/main/java/com/whop/api/resources/supportchannels/types/ListSupportChannelsResponse.java new file mode 100644 index 00000000..32251ca2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/supportchannels/types/ListSupportChannelsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.supportchannels.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PageInfo; +import com.whop.api.types.SupportChannelListItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSupportChannelsResponse.Builder.class) +public final class ListSupportChannelsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListSupportChannelsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSupportChannelsResponse && equalTo((ListSupportChannelsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSupportChannelsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListSupportChannelsResponse other); + } + + public interface _FinalStage { + ListSupportChannelsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(SupportChannelListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSupportChannelsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(SupportChannelListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListSupportChannelsResponse build() { + return new ListSupportChannelsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/AsyncRawSwapsClient.java b/src/main/java/com/whop/api/resources/swaps/AsyncRawSwapsClient.java new file mode 100644 index 00000000..9c6dc018 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/AsyncRawSwapsClient.java @@ -0,0 +1,385 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.resources.swaps.requests.CreateQuoteSwapsRequest; +import com.whop.api.resources.swaps.requests.CreateSwapsRequest; +import com.whop.api.resources.swaps.requests.ListSwapsRequest; +import com.whop.api.resources.swaps.requests.RetrieveSwapsRequest; +import com.whop.api.resources.swaps.types.CreateQuoteSwapsResponse; +import com.whop.api.resources.swaps.types.CreateSwapsResponse; +import com.whop.api.resources.swaps.types.ListSwapsResponse; +import com.whop.api.resources.swaps.types.RetrieveSwapsResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawSwapsClient { + protected final ClientOptions clientOptions; + + public AsyncRawSwapsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieve the account's completed or pending swaps — currently just the latest one. + */ + public CompletableFuture> list(ListSwapsRequest request) { + return list(request, null); + } + + /** + * Retrieve the account's completed or pending swaps — currently just the latest one. + */ + public CompletableFuture> list( + ListSwapsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("swaps"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListSwapsResponse.class), + response)); + return; + } + try { + if (response.code() == 403) { + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Swaps one token for another from the account's wallet, or converts between fiat currencies in the account's ledger at the mid-market rate. Crypto swaps finish in the background — check the swap for its status. + */ + public CompletableFuture> create(CreateSwapsRequest request) { + return create(request, null); + } + + /** + * Swaps one token for another from the account's wallet, or converts between fiat currencies in the account's ledger at the mid-market rate. Crypto swaps finish in the background — check the swap for its status. + */ + public CompletableFuture> create( + CreateSwapsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("swaps"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateSwapsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Previews the price of a swap. Fiat pairs quote the in-ledger mid-market conversion — the same rate creating the swap fills at. No funds move and nothing is saved. + */ + public CompletableFuture> createQuote( + CreateQuoteSwapsRequest request) { + return createQuote(request, null); + } + + /** + * Previews the price of a swap. Fiat pairs quote the in-ledger mid-market conversion — the same rate creating the swap fills at. No funds move and nothing is saved. + */ + public CompletableFuture> createQuote( + CreateQuoteSwapsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("swaps/quote"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateQuoteSwapsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a single swap and its status. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveSwapsRequest.builder().build()); + } + + /** + * Retrieves a single swap and its status. + */ + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveSwapsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single swap and its status. + */ + public CompletableFuture> retrieve( + String id, RetrieveSwapsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single swap and its status. + */ + public CompletableFuture> retrieve( + String id, RetrieveSwapsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("swaps") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrieveSwapsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/AsyncSwapsClient.java b/src/main/java/com/whop/api/resources/swaps/AsyncSwapsClient.java new file mode 100644 index 00000000..4df2dcf5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/AsyncSwapsClient.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.swaps.requests.CreateQuoteSwapsRequest; +import com.whop.api.resources.swaps.requests.CreateSwapsRequest; +import com.whop.api.resources.swaps.requests.ListSwapsRequest; +import com.whop.api.resources.swaps.requests.RetrieveSwapsRequest; +import com.whop.api.resources.swaps.types.CreateQuoteSwapsResponse; +import com.whop.api.resources.swaps.types.CreateSwapsResponse; +import com.whop.api.resources.swaps.types.ListSwapsResponse; +import com.whop.api.resources.swaps.types.RetrieveSwapsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncSwapsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawSwapsClient rawClient; + + public AsyncSwapsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawSwapsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawSwapsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieve the account's completed or pending swaps — currently just the latest one. + */ + public CompletableFuture list(ListSwapsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Retrieve the account's completed or pending swaps — currently just the latest one. + */ + public CompletableFuture list(ListSwapsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Swaps one token for another from the account's wallet, or converts between fiat currencies in the account's ledger at the mid-market rate. Crypto swaps finish in the background — check the swap for its status. + */ + public CompletableFuture create(CreateSwapsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Swaps one token for another from the account's wallet, or converts between fiat currencies in the account's ledger at the mid-market rate. Crypto swaps finish in the background — check the swap for its status. + */ + public CompletableFuture create(CreateSwapsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Previews the price of a swap. Fiat pairs quote the in-ledger mid-market conversion — the same rate creating the swap fills at. No funds move and nothing is saved. + */ + public CompletableFuture createQuote(CreateQuoteSwapsRequest request) { + return this.rawClient.createQuote(request).thenApply(response -> response.body()); + } + + /** + * Previews the price of a swap. Fiat pairs quote the in-ledger mid-market conversion — the same rate creating the swap fills at. No funds move and nothing is saved. + */ + public CompletableFuture createQuote( + CreateQuoteSwapsRequest request, RequestOptions requestOptions) { + return this.rawClient.createQuote(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single swap and its status. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a single swap and its status. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single swap and its status. + */ + public CompletableFuture retrieve(String id, RetrieveSwapsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a single swap and its status. + */ + public CompletableFuture retrieve( + String id, RetrieveSwapsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/RawSwapsClient.java b/src/main/java/com/whop/api/resources/swaps/RawSwapsClient.java new file mode 100644 index 00000000..af7dca25 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/RawSwapsClient.java @@ -0,0 +1,306 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.resources.swaps.requests.CreateQuoteSwapsRequest; +import com.whop.api.resources.swaps.requests.CreateSwapsRequest; +import com.whop.api.resources.swaps.requests.ListSwapsRequest; +import com.whop.api.resources.swaps.requests.RetrieveSwapsRequest; +import com.whop.api.resources.swaps.types.CreateQuoteSwapsResponse; +import com.whop.api.resources.swaps.types.CreateSwapsResponse; +import com.whop.api.resources.swaps.types.ListSwapsResponse; +import com.whop.api.resources.swaps.types.RetrieveSwapsResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawSwapsClient { + protected final ClientOptions clientOptions; + + public RawSwapsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieve the account's completed or pending swaps — currently just the latest one. + */ + public WhopApiHttpResponse list(ListSwapsRequest request) { + return list(request, null); + } + + /** + * Retrieve the account's completed or pending swaps — currently just the latest one. + */ + public WhopApiHttpResponse list(ListSwapsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("swaps"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListSwapsResponse.class), response); + } + try { + if (response.code() == 403) { + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Swaps one token for another from the account's wallet, or converts between fiat currencies in the account's ledger at the mid-market rate. Crypto swaps finish in the background — check the swap for its status. + */ + public WhopApiHttpResponse create(CreateSwapsRequest request) { + return create(request, null); + } + + /** + * Swaps one token for another from the account's wallet, or converts between fiat currencies in the account's ledger at the mid-market rate. Crypto swaps finish in the background — check the swap for its status. + */ + public WhopApiHttpResponse create(CreateSwapsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("swaps"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateSwapsResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Previews the price of a swap. Fiat pairs quote the in-ledger mid-market conversion — the same rate creating the swap fills at. No funds move and nothing is saved. + */ + public WhopApiHttpResponse createQuote(CreateQuoteSwapsRequest request) { + return createQuote(request, null); + } + + /** + * Previews the price of a swap. Fiat pairs quote the in-ledger mid-market conversion — the same rate creating the swap fills at. No funds move and nothing is saved. + */ + public WhopApiHttpResponse createQuote( + CreateQuoteSwapsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("swaps/quote"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateQuoteSwapsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a single swap and its status. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveSwapsRequest.builder().build()); + } + + /** + * Retrieves a single swap and its status. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveSwapsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single swap and its status. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveSwapsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single swap and its status. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveSwapsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("swaps") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrieveSwapsResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/SwapsClient.java b/src/main/java/com/whop/api/resources/swaps/SwapsClient.java new file mode 100644 index 00000000..ab98d0dd --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/SwapsClient.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.swaps.requests.CreateQuoteSwapsRequest; +import com.whop.api.resources.swaps.requests.CreateSwapsRequest; +import com.whop.api.resources.swaps.requests.ListSwapsRequest; +import com.whop.api.resources.swaps.requests.RetrieveSwapsRequest; +import com.whop.api.resources.swaps.types.CreateQuoteSwapsResponse; +import com.whop.api.resources.swaps.types.CreateSwapsResponse; +import com.whop.api.resources.swaps.types.ListSwapsResponse; +import com.whop.api.resources.swaps.types.RetrieveSwapsResponse; + +public class SwapsClient { + protected final ClientOptions clientOptions; + + private final RawSwapsClient rawClient; + + public SwapsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawSwapsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawSwapsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieve the account's completed or pending swaps — currently just the latest one. + */ + public ListSwapsResponse list(ListSwapsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Retrieve the account's completed or pending swaps — currently just the latest one. + */ + public ListSwapsResponse list(ListSwapsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Swaps one token for another from the account's wallet, or converts between fiat currencies in the account's ledger at the mid-market rate. Crypto swaps finish in the background — check the swap for its status. + */ + public CreateSwapsResponse create(CreateSwapsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Swaps one token for another from the account's wallet, or converts between fiat currencies in the account's ledger at the mid-market rate. Crypto swaps finish in the background — check the swap for its status. + */ + public CreateSwapsResponse create(CreateSwapsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Previews the price of a swap. Fiat pairs quote the in-ledger mid-market conversion — the same rate creating the swap fills at. No funds move and nothing is saved. + */ + public CreateQuoteSwapsResponse createQuote(CreateQuoteSwapsRequest request) { + return this.rawClient.createQuote(request).body(); + } + + /** + * Previews the price of a swap. Fiat pairs quote the in-ledger mid-market conversion — the same rate creating the swap fills at. No funds move and nothing is saved. + */ + public CreateQuoteSwapsResponse createQuote(CreateQuoteSwapsRequest request, RequestOptions requestOptions) { + return this.rawClient.createQuote(request, requestOptions).body(); + } + + /** + * Retrieves a single swap and its status. + */ + public RetrieveSwapsResponse retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a single swap and its status. + */ + public RetrieveSwapsResponse retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a single swap and its status. + */ + public RetrieveSwapsResponse retrieve(String id, RetrieveSwapsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a single swap and its status. + */ + public RetrieveSwapsResponse retrieve(String id, RetrieveSwapsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/requests/CreateQuoteSwapsRequest.java b/src/main/java/com/whop/api/resources/swaps/requests/CreateQuoteSwapsRequest.java new file mode 100644 index 00000000..1fa0d8e8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/requests/CreateQuoteSwapsRequest.java @@ -0,0 +1,620 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.swaps.types.CreateQuoteSwapsRequestFromChain; +import com.whop.api.resources.swaps.types.CreateQuoteSwapsRequestToChain; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateQuoteSwapsRequest.Builder.class) +public final class CreateQuoteSwapsRequest { + private final String amount; + + private final Optional fromAddress; + + private final Optional fromChain; + + private final String fromToken; + + private final Optional> metadata; + + private final Optional slippageBps; + + private final Optional toAddress; + + private final Optional toChain; + + private final String toToken; + + private final Map additionalProperties; + + private CreateQuoteSwapsRequest( + String amount, + Optional fromAddress, + Optional fromChain, + String fromToken, + Optional> metadata, + Optional slippageBps, + Optional toAddress, + Optional toChain, + String toToken, + Map additionalProperties) { + this.amount = amount; + this.fromAddress = fromAddress; + this.fromChain = fromChain; + this.fromToken = fromToken; + this.metadata = metadata; + this.slippageBps = slippageBps; + this.toAddress = toAddress; + this.toChain = toChain; + this.toToken = toToken; + this.additionalProperties = additionalProperties; + } + + /** + * @return Source token amount. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + /** + * @return Source wallet address used for the quote. + */ + @JsonIgnore + public Optional getFromAddress() { + if (fromAddress == null) { + return Optional.empty(); + } + return fromAddress; + } + + /** + * @return Source chain name or chain ID. Defaults to the source token's chain when omitted. + */ + @JsonIgnore + public Optional getFromChain() { + if (fromChain == null) { + return Optional.empty(); + } + return fromChain; + } + + /** + * @return Source token contract address or ticker symbol, such as "USDT". + */ + @JsonProperty("from_token") + public String getFromToken() { + return fromToken; + } + + /** + * @return Metadata to include with the quote response. + */ + @JsonProperty("metadata") + public Optional> getMetadata() { + return metadata; + } + + /** + * @return Maximum slippage tolerance in basis points. + */ + @JsonIgnore + public Optional getSlippageBps() { + if (slippageBps == null) { + return Optional.empty(); + } + return slippageBps; + } + + /** + * @return Destination wallet address used for the quote. + */ + @JsonIgnore + public Optional getToAddress() { + if (toAddress == null) { + return Optional.empty(); + } + return toAddress; + } + + /** + * @return Destination chain name or chain ID. Defaults to the destination token's chain when omitted. + */ + @JsonIgnore + public Optional getToChain() { + if (toChain == null) { + return Optional.empty(); + } + return toChain; + } + + /** + * @return Destination token contract address or ticker symbol, such as "XAUT". + */ + @JsonProperty("to_token") + public String getToToken() { + return toToken; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("from_address") + private Optional _getFromAddress() { + return fromAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("from_chain") + private Optional _getFromChain() { + return fromChain; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("slippage_bps") + private Optional _getSlippageBps() { + return slippageBps; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("to_address") + private Optional _getToAddress() { + return toAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("to_chain") + private Optional _getToChain() { + return toChain; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateQuoteSwapsRequest && equalTo((CreateQuoteSwapsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateQuoteSwapsRequest other) { + return amount.equals(other.amount) + && fromAddress.equals(other.fromAddress) + && fromChain.equals(other.fromChain) + && fromToken.equals(other.fromToken) + && metadata.equals(other.metadata) + && slippageBps.equals(other.slippageBps) + && toAddress.equals(other.toAddress) + && toChain.equals(other.toChain) + && toToken.equals(other.toToken); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.fromAddress, + this.fromChain, + this.fromToken, + this.metadata, + this.slippageBps, + this.toAddress, + this.toChain, + this.toToken); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

Source token amount.

+ */ + FromTokenStage amount(@NotNull String amount); + + Builder from(CreateQuoteSwapsRequest other); + } + + public interface FromTokenStage { + /** + *

Source token contract address or ticker symbol, such as "USDT".

+ */ + ToTokenStage fromToken(@NotNull String fromToken); + } + + public interface ToTokenStage { + /** + *

Destination token contract address or ticker symbol, such as "XAUT".

+ */ + _FinalStage toToken(@NotNull String toToken); + } + + public interface _FinalStage { + CreateQuoteSwapsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Source wallet address used for the quote.

+ */ + _FinalStage fromAddress(Optional fromAddress); + + _FinalStage fromAddress(String fromAddress); + + _FinalStage fromAddress(Nullable fromAddress); + + /** + *

Source chain name or chain ID. Defaults to the source token's chain when omitted.

+ */ + _FinalStage fromChain(Optional fromChain); + + _FinalStage fromChain(CreateQuoteSwapsRequestFromChain fromChain); + + _FinalStage fromChain(Nullable fromChain); + + /** + *

Metadata to include with the quote response.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + /** + *

Maximum slippage tolerance in basis points.

+ */ + _FinalStage slippageBps(Optional slippageBps); + + _FinalStage slippageBps(Integer slippageBps); + + _FinalStage slippageBps(Nullable slippageBps); + + /** + *

Destination wallet address used for the quote.

+ */ + _FinalStage toAddress(Optional toAddress); + + _FinalStage toAddress(String toAddress); + + _FinalStage toAddress(Nullable toAddress); + + /** + *

Destination chain name or chain ID. Defaults to the destination token's chain when omitted.

+ */ + _FinalStage toChain(Optional toChain); + + _FinalStage toChain(CreateQuoteSwapsRequestToChain toChain); + + _FinalStage toChain(Nullable toChain); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, FromTokenStage, ToTokenStage, _FinalStage { + private String amount; + + private String fromToken; + + private String toToken; + + private Optional toChain = Optional.empty(); + + private Optional toAddress = Optional.empty(); + + private Optional slippageBps = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional fromChain = Optional.empty(); + + private Optional fromAddress = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateQuoteSwapsRequest other) { + amount(other.getAmount()); + fromAddress(other.getFromAddress()); + fromChain(other.getFromChain()); + fromToken(other.getFromToken()); + metadata(other.getMetadata()); + slippageBps(other.getSlippageBps()); + toAddress(other.getToAddress()); + toChain(other.getToChain()); + toToken(other.getToToken()); + return this; + } + + /** + *

Source token amount.

+ *

Source token amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public FromTokenStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

Source token contract address or ticker symbol, such as "USDT".

+ *

Source token contract address or ticker symbol, such as "USDT".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("from_token") + public ToTokenStage fromToken(@NotNull String fromToken) { + this.fromToken = Objects.requireNonNull(fromToken, "fromToken must not be null"); + return this; + } + + /** + *

Destination token contract address or ticker symbol, such as "XAUT".

+ *

Destination token contract address or ticker symbol, such as "XAUT".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("to_token") + public _FinalStage toToken(@NotNull String toToken) { + this.toToken = Objects.requireNonNull(toToken, "toToken must not be null"); + return this; + } + + /** + *

Destination chain name or chain ID. Defaults to the destination token's chain when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toChain(Nullable toChain) { + if (toChain.isNull()) { + this.toChain = null; + } else if (toChain.isEmpty()) { + this.toChain = Optional.empty(); + } else { + this.toChain = Optional.of(toChain.get()); + } + return this; + } + + /** + *

Destination chain name or chain ID. Defaults to the destination token's chain when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toChain(CreateQuoteSwapsRequestToChain toChain) { + this.toChain = Optional.ofNullable(toChain); + return this; + } + + /** + *

Destination chain name or chain ID. Defaults to the destination token's chain when omitted.

+ */ + @java.lang.Override + @JsonSetter(value = "to_chain", nulls = Nulls.SKIP) + public _FinalStage toChain(Optional toChain) { + this.toChain = toChain; + return this; + } + + /** + *

Destination wallet address used for the quote.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toAddress(Nullable toAddress) { + if (toAddress.isNull()) { + this.toAddress = null; + } else if (toAddress.isEmpty()) { + this.toAddress = Optional.empty(); + } else { + this.toAddress = Optional.of(toAddress.get()); + } + return this; + } + + /** + *

Destination wallet address used for the quote.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toAddress(String toAddress) { + this.toAddress = Optional.ofNullable(toAddress); + return this; + } + + /** + *

Destination wallet address used for the quote.

+ */ + @java.lang.Override + @JsonSetter(value = "to_address", nulls = Nulls.SKIP) + public _FinalStage toAddress(Optional toAddress) { + this.toAddress = toAddress; + return this; + } + + /** + *

Maximum slippage tolerance in basis points.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage slippageBps(Nullable slippageBps) { + if (slippageBps.isNull()) { + this.slippageBps = null; + } else if (slippageBps.isEmpty()) { + this.slippageBps = Optional.empty(); + } else { + this.slippageBps = Optional.of(slippageBps.get()); + } + return this; + } + + /** + *

Maximum slippage tolerance in basis points.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage slippageBps(Integer slippageBps) { + this.slippageBps = Optional.ofNullable(slippageBps); + return this; + } + + /** + *

Maximum slippage tolerance in basis points.

+ */ + @java.lang.Override + @JsonSetter(value = "slippage_bps", nulls = Nulls.SKIP) + public _FinalStage slippageBps(Optional slippageBps) { + this.slippageBps = slippageBps; + return this; + } + + /** + *

Metadata to include with the quote response.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Metadata to include with the quote response.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Source chain name or chain ID. Defaults to the source token's chain when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromChain(Nullable fromChain) { + if (fromChain.isNull()) { + this.fromChain = null; + } else if (fromChain.isEmpty()) { + this.fromChain = Optional.empty(); + } else { + this.fromChain = Optional.of(fromChain.get()); + } + return this; + } + + /** + *

Source chain name or chain ID. Defaults to the source token's chain when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromChain(CreateQuoteSwapsRequestFromChain fromChain) { + this.fromChain = Optional.ofNullable(fromChain); + return this; + } + + /** + *

Source chain name or chain ID. Defaults to the source token's chain when omitted.

+ */ + @java.lang.Override + @JsonSetter(value = "from_chain", nulls = Nulls.SKIP) + public _FinalStage fromChain(Optional fromChain) { + this.fromChain = fromChain; + return this; + } + + /** + *

Source wallet address used for the quote.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromAddress(Nullable fromAddress) { + if (fromAddress.isNull()) { + this.fromAddress = null; + } else if (fromAddress.isEmpty()) { + this.fromAddress = Optional.empty(); + } else { + this.fromAddress = Optional.of(fromAddress.get()); + } + return this; + } + + /** + *

Source wallet address used for the quote.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromAddress(String fromAddress) { + this.fromAddress = Optional.ofNullable(fromAddress); + return this; + } + + /** + *

Source wallet address used for the quote.

+ */ + @java.lang.Override + @JsonSetter(value = "from_address", nulls = Nulls.SKIP) + public _FinalStage fromAddress(Optional fromAddress) { + this.fromAddress = fromAddress; + return this; + } + + @java.lang.Override + public CreateQuoteSwapsRequest build() { + return new CreateQuoteSwapsRequest( + amount, + fromAddress, + fromChain, + fromToken, + metadata, + slippageBps, + toAddress, + toChain, + toToken, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/requests/CreateSwapsRequest.java b/src/main/java/com/whop/api/resources/swaps/requests/CreateSwapsRequest.java new file mode 100644 index 00000000..ba373bab --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/requests/CreateSwapsRequest.java @@ -0,0 +1,575 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.swaps.types.CreateSwapsRequestFromChain; +import com.whop.api.resources.swaps.types.CreateSwapsRequestToChain; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSwapsRequest.Builder.class) +public final class CreateSwapsRequest { + private final String accountId; + + private final Optional amount; + + private final Optional fromChain; + + private final String fromToken; + + private final Optional slippageBps; + + private final Optional toAmount; + + private final Optional toChain; + + private final String toToken; + + private final Map additionalProperties; + + private CreateSwapsRequest( + String accountId, + Optional amount, + Optional fromChain, + String fromToken, + Optional slippageBps, + Optional toAmount, + Optional toChain, + String toToken, + Map additionalProperties) { + this.accountId = accountId; + this.amount = amount; + this.fromChain = fromChain; + this.fromToken = fromToken; + this.slippageBps = slippageBps; + this.toAmount = toAmount; + this.toChain = toChain; + this.toToken = toToken; + this.additionalProperties = additionalProperties; + } + + /** + * @return Business or user account ID (biz_* / user_*). + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Source token amount. Required for crypto swaps. For fiat pairs: the amount of from_token to convert at the mid-market rate; omit (along with to_amount) to repay the full negative to_token balance instead. + */ + @JsonIgnore + public Optional getAmount() { + if (amount == null) { + return Optional.empty(); + } + return amount; + } + + /** + * @return Source chain name or chain ID. Defaults to the source token's chain when omitted. + */ + @JsonIgnore + public Optional getFromChain() { + if (fromChain == null) { + return Optional.empty(); + } + return fromChain; + } + + /** + * @return Source token contract address or ticker symbol, such as "USDT". + */ + @JsonProperty("from_token") + public String getFromToken() { + return fromToken; + } + + /** + * @return Maximum slippage tolerance in basis points. + */ + @JsonIgnore + public Optional getSlippageBps() { + if (slippageBps == null) { + return Optional.empty(); + } + return slippageBps; + } + + /** + * @return Fiat pairs only: sizes a partial repayment of the negative to_token balance, denominated in to_token. Must not exceed the debt. Mutually exclusive with amount. + */ + @JsonIgnore + public Optional getToAmount() { + if (toAmount == null) { + return Optional.empty(); + } + return toAmount; + } + + /** + * @return Destination chain name or chain ID. Defaults to the destination token's chain when omitted. + */ + @JsonIgnore + public Optional getToChain() { + if (toChain == null) { + return Optional.empty(); + } + return toChain; + } + + /** + * @return Destination token contract address or ticker symbol, such as "XAUT". + */ + @JsonProperty("to_token") + public String getToToken() { + return toToken; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("amount") + private Optional _getAmount() { + return amount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("from_chain") + private Optional _getFromChain() { + return fromChain; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("slippage_bps") + private Optional _getSlippageBps() { + return slippageBps; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("to_amount") + private Optional _getToAmount() { + return toAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("to_chain") + private Optional _getToChain() { + return toChain; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSwapsRequest && equalTo((CreateSwapsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSwapsRequest other) { + return accountId.equals(other.accountId) + && amount.equals(other.amount) + && fromChain.equals(other.fromChain) + && fromToken.equals(other.fromToken) + && slippageBps.equals(other.slippageBps) + && toAmount.equals(other.toAmount) + && toChain.equals(other.toChain) + && toToken.equals(other.toToken); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.amount, + this.fromChain, + this.fromToken, + this.slippageBps, + this.toAmount, + this.toChain, + this.toToken); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Business or user account ID (biz_* / user_*).

+ */ + FromTokenStage accountId(@NotNull String accountId); + + Builder from(CreateSwapsRequest other); + } + + public interface FromTokenStage { + /** + *

Source token contract address or ticker symbol, such as "USDT".

+ */ + ToTokenStage fromToken(@NotNull String fromToken); + } + + public interface ToTokenStage { + /** + *

Destination token contract address or ticker symbol, such as "XAUT".

+ */ + _FinalStage toToken(@NotNull String toToken); + } + + public interface _FinalStage { + CreateSwapsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Source token amount. Required for crypto swaps. For fiat pairs: the amount of from_token to convert at the mid-market rate; omit (along with to_amount) to repay the full negative to_token balance instead.

+ */ + _FinalStage amount(Optional amount); + + _FinalStage amount(String amount); + + _FinalStage amount(Nullable amount); + + /** + *

Source chain name or chain ID. Defaults to the source token's chain when omitted.

+ */ + _FinalStage fromChain(Optional fromChain); + + _FinalStage fromChain(CreateSwapsRequestFromChain fromChain); + + _FinalStage fromChain(Nullable fromChain); + + /** + *

Maximum slippage tolerance in basis points.

+ */ + _FinalStage slippageBps(Optional slippageBps); + + _FinalStage slippageBps(Integer slippageBps); + + _FinalStage slippageBps(Nullable slippageBps); + + /** + *

Fiat pairs only: sizes a partial repayment of the negative to_token balance, denominated in to_token. Must not exceed the debt. Mutually exclusive with amount.

+ */ + _FinalStage toAmount(Optional toAmount); + + _FinalStage toAmount(String toAmount); + + _FinalStage toAmount(Nullable toAmount); + + /** + *

Destination chain name or chain ID. Defaults to the destination token's chain when omitted.

+ */ + _FinalStage toChain(Optional toChain); + + _FinalStage toChain(CreateSwapsRequestToChain toChain); + + _FinalStage toChain(Nullable toChain); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, FromTokenStage, ToTokenStage, _FinalStage { + private String accountId; + + private String fromToken; + + private String toToken; + + private Optional toChain = Optional.empty(); + + private Optional toAmount = Optional.empty(); + + private Optional slippageBps = Optional.empty(); + + private Optional fromChain = Optional.empty(); + + private Optional amount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateSwapsRequest other) { + accountId(other.getAccountId()); + amount(other.getAmount()); + fromChain(other.getFromChain()); + fromToken(other.getFromToken()); + slippageBps(other.getSlippageBps()); + toAmount(other.getToAmount()); + toChain(other.getToChain()); + toToken(other.getToToken()); + return this; + } + + /** + *

Business or user account ID (biz_* / user_*).

+ *

Business or user account ID (biz_* / user_*).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public FromTokenStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

Source token contract address or ticker symbol, such as "USDT".

+ *

Source token contract address or ticker symbol, such as "USDT".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("from_token") + public ToTokenStage fromToken(@NotNull String fromToken) { + this.fromToken = Objects.requireNonNull(fromToken, "fromToken must not be null"); + return this; + } + + /** + *

Destination token contract address or ticker symbol, such as "XAUT".

+ *

Destination token contract address or ticker symbol, such as "XAUT".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("to_token") + public _FinalStage toToken(@NotNull String toToken) { + this.toToken = Objects.requireNonNull(toToken, "toToken must not be null"); + return this; + } + + /** + *

Destination chain name or chain ID. Defaults to the destination token's chain when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toChain(Nullable toChain) { + if (toChain.isNull()) { + this.toChain = null; + } else if (toChain.isEmpty()) { + this.toChain = Optional.empty(); + } else { + this.toChain = Optional.of(toChain.get()); + } + return this; + } + + /** + *

Destination chain name or chain ID. Defaults to the destination token's chain when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toChain(CreateSwapsRequestToChain toChain) { + this.toChain = Optional.ofNullable(toChain); + return this; + } + + /** + *

Destination chain name or chain ID. Defaults to the destination token's chain when omitted.

+ */ + @java.lang.Override + @JsonSetter(value = "to_chain", nulls = Nulls.SKIP) + public _FinalStage toChain(Optional toChain) { + this.toChain = toChain; + return this; + } + + /** + *

Fiat pairs only: sizes a partial repayment of the negative to_token balance, denominated in to_token. Must not exceed the debt. Mutually exclusive with amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toAmount(Nullable toAmount) { + if (toAmount.isNull()) { + this.toAmount = null; + } else if (toAmount.isEmpty()) { + this.toAmount = Optional.empty(); + } else { + this.toAmount = Optional.of(toAmount.get()); + } + return this; + } + + /** + *

Fiat pairs only: sizes a partial repayment of the negative to_token balance, denominated in to_token. Must not exceed the debt. Mutually exclusive with amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toAmount(String toAmount) { + this.toAmount = Optional.ofNullable(toAmount); + return this; + } + + /** + *

Fiat pairs only: sizes a partial repayment of the negative to_token balance, denominated in to_token. Must not exceed the debt. Mutually exclusive with amount.

+ */ + @java.lang.Override + @JsonSetter(value = "to_amount", nulls = Nulls.SKIP) + public _FinalStage toAmount(Optional toAmount) { + this.toAmount = toAmount; + return this; + } + + /** + *

Maximum slippage tolerance in basis points.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage slippageBps(Nullable slippageBps) { + if (slippageBps.isNull()) { + this.slippageBps = null; + } else if (slippageBps.isEmpty()) { + this.slippageBps = Optional.empty(); + } else { + this.slippageBps = Optional.of(slippageBps.get()); + } + return this; + } + + /** + *

Maximum slippage tolerance in basis points.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage slippageBps(Integer slippageBps) { + this.slippageBps = Optional.ofNullable(slippageBps); + return this; + } + + /** + *

Maximum slippage tolerance in basis points.

+ */ + @java.lang.Override + @JsonSetter(value = "slippage_bps", nulls = Nulls.SKIP) + public _FinalStage slippageBps(Optional slippageBps) { + this.slippageBps = slippageBps; + return this; + } + + /** + *

Source chain name or chain ID. Defaults to the source token's chain when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromChain(Nullable fromChain) { + if (fromChain.isNull()) { + this.fromChain = null; + } else if (fromChain.isEmpty()) { + this.fromChain = Optional.empty(); + } else { + this.fromChain = Optional.of(fromChain.get()); + } + return this; + } + + /** + *

Source chain name or chain ID. Defaults to the source token's chain when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromChain(CreateSwapsRequestFromChain fromChain) { + this.fromChain = Optional.ofNullable(fromChain); + return this; + } + + /** + *

Source chain name or chain ID. Defaults to the source token's chain when omitted.

+ */ + @java.lang.Override + @JsonSetter(value = "from_chain", nulls = Nulls.SKIP) + public _FinalStage fromChain(Optional fromChain) { + this.fromChain = fromChain; + return this; + } + + /** + *

Source token amount. Required for crypto swaps. For fiat pairs: the amount of from_token to convert at the mid-market rate; omit (along with to_amount) to repay the full negative to_token balance instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amount(Nullable amount) { + if (amount.isNull()) { + this.amount = null; + } else if (amount.isEmpty()) { + this.amount = Optional.empty(); + } else { + this.amount = Optional.of(amount.get()); + } + return this; + } + + /** + *

Source token amount. Required for crypto swaps. For fiat pairs: the amount of from_token to convert at the mid-market rate; omit (along with to_amount) to repay the full negative to_token balance instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amount(String amount) { + this.amount = Optional.ofNullable(amount); + return this; + } + + /** + *

Source token amount. Required for crypto swaps. For fiat pairs: the amount of from_token to convert at the mid-market rate; omit (along with to_amount) to repay the full negative to_token balance instead.

+ */ + @java.lang.Override + @JsonSetter(value = "amount", nulls = Nulls.SKIP) + public _FinalStage amount(Optional amount) { + this.amount = amount; + return this; + } + + @java.lang.Override + public CreateSwapsRequest build() { + return new CreateSwapsRequest( + accountId, + amount, + fromChain, + fromToken, + slippageBps, + toAmount, + toChain, + toToken, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/requests/ListSwapsRequest.java b/src/main/java/com/whop/api/resources/swaps/requests/ListSwapsRequest.java new file mode 100644 index 00000000..c136b535 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/requests/ListSwapsRequest.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSwapsRequest.Builder.class) +public final class ListSwapsRequest { + private final String accountId; + + private final Map additionalProperties; + + private ListSwapsRequest(String accountId, Map additionalProperties) { + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Business or user account ID (biz_* / user_*). + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSwapsRequest && equalTo((ListSwapsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSwapsRequest other) { + return accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Business or user account ID (biz_* / user_*).

+ */ + _FinalStage accountId(@NotNull String accountId); + + Builder from(ListSwapsRequest other); + } + + public interface _FinalStage { + ListSwapsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, _FinalStage { + private String accountId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSwapsRequest other) { + accountId(other.getAccountId()); + return this; + } + + /** + *

Business or user account ID (biz_* / user_*).

+ *

Business or user account ID (biz_* / user_*).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + public ListSwapsRequest build() { + return new ListSwapsRequest(accountId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/requests/RetrieveSwapsRequest.java b/src/main/java/com/whop/api/resources/swaps/requests/RetrieveSwapsRequest.java new file mode 100644 index 00000000..8793bdda --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/requests/RetrieveSwapsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveSwapsRequest.Builder.class) +public final class RetrieveSwapsRequest { + private final Map additionalProperties; + + private RetrieveSwapsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveSwapsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveSwapsRequest other) { + return this; + } + + public RetrieveSwapsRequest build() { + return new RetrieveSwapsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/CreateQuoteSwapsRequestFromChain.java b/src/main/java/com/whop/api/resources/swaps/types/CreateQuoteSwapsRequestFromChain.java new file mode 100644 index 00000000..d9e026fd --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/CreateQuoteSwapsRequestFromChain.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = CreateQuoteSwapsRequestFromChain.Deserializer.class) +public final class CreateQuoteSwapsRequestFromChain { + private final Object value; + + private final int type; + + private CreateQuoteSwapsRequestFromChain(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((String) this.value); + } else if (this.type == 1) { + return visitor.visit((int) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateQuoteSwapsRequestFromChain && equalTo((CreateQuoteSwapsRequestFromChain) other); + } + + private boolean equalTo(CreateQuoteSwapsRequestFromChain other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static CreateQuoteSwapsRequestFromChain of(String value) { + return new CreateQuoteSwapsRequestFromChain(value, 0); + } + + public static CreateQuoteSwapsRequestFromChain of(int value) { + return new CreateQuoteSwapsRequestFromChain(value, 1); + } + + public interface Visitor { + T visit(String value); + + T visit(int value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(CreateQuoteSwapsRequestFromChain.class); + } + + @java.lang.Override + public CreateQuoteSwapsRequestFromChain deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Integer) { + return of((Integer) value); + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/CreateQuoteSwapsRequestToChain.java b/src/main/java/com/whop/api/resources/swaps/types/CreateQuoteSwapsRequestToChain.java new file mode 100644 index 00000000..b917c5f8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/CreateQuoteSwapsRequestToChain.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = CreateQuoteSwapsRequestToChain.Deserializer.class) +public final class CreateQuoteSwapsRequestToChain { + private final Object value; + + private final int type; + + private CreateQuoteSwapsRequestToChain(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((String) this.value); + } else if (this.type == 1) { + return visitor.visit((int) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateQuoteSwapsRequestToChain && equalTo((CreateQuoteSwapsRequestToChain) other); + } + + private boolean equalTo(CreateQuoteSwapsRequestToChain other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static CreateQuoteSwapsRequestToChain of(String value) { + return new CreateQuoteSwapsRequestToChain(value, 0); + } + + public static CreateQuoteSwapsRequestToChain of(int value) { + return new CreateQuoteSwapsRequestToChain(value, 1); + } + + public interface Visitor { + T visit(String value); + + T visit(int value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(CreateQuoteSwapsRequestToChain.class); + } + + @java.lang.Override + public CreateQuoteSwapsRequestToChain deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Integer) { + return of((Integer) value); + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/CreateQuoteSwapsResponse.java b/src/main/java/com/whop/api/resources/swaps/types/CreateQuoteSwapsResponse.java new file mode 100644 index 00000000..77e3e742 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/CreateQuoteSwapsResponse.java @@ -0,0 +1,869 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateQuoteSwapsResponse.Builder.class) +public final class CreateQuoteSwapsResponse { + private final String amountIn; + + private final String amountOut; + + private final Optional amountOutMin; + + private final Optional bridgeFee; + + private final Optional estimatedDurationSeconds; + + private final int feeBps; + + private final Optional fromAddress; + + private final Map fromToken; + + private final Map metadata; + + private final CreateQuoteSwapsResponseObject object; + + private final String rate; + + private final Optional requiresTokenApproval; + + private final Optional toAddress; + + private final Map toToken; + + private final Map additionalProperties; + + private CreateQuoteSwapsResponse( + String amountIn, + String amountOut, + Optional amountOutMin, + Optional bridgeFee, + Optional estimatedDurationSeconds, + int feeBps, + Optional fromAddress, + Map fromToken, + Map metadata, + CreateQuoteSwapsResponseObject object, + String rate, + Optional requiresTokenApproval, + Optional toAddress, + Map toToken, + Map additionalProperties) { + this.amountIn = amountIn; + this.amountOut = amountOut; + this.amountOutMin = amountOutMin; + this.bridgeFee = bridgeFee; + this.estimatedDurationSeconds = estimatedDurationSeconds; + this.feeBps = feeBps; + this.fromAddress = fromAddress; + this.fromToken = fromToken; + this.metadata = metadata; + this.object = object; + this.rate = rate; + this.requiresTokenApproval = requiresTokenApproval; + this.toAddress = toAddress; + this.toToken = toToken; + this.additionalProperties = additionalProperties; + } + + /** + * @return Source token amount used for the quote. + */ + @JsonProperty("amount_in") + public String getAmountIn() { + return amountIn; + } + + /** + * @return Estimated destination token amount. + */ + @JsonProperty("amount_out") + public String getAmountOut() { + return amountOut; + } + + /** + * @return Minimum destination amount after slippage. + */ + @JsonProperty("amount_out_min") + public Optional getAmountOutMin() { + return amountOutMin; + } + + /** + * @return Estimated bridge fee for cross-chain swaps. + */ + @JsonIgnore + public Optional getBridgeFee() { + if (bridgeFee == null) { + return Optional.empty(); + } + return bridgeFee; + } + + /** + * @return Estimated time for the swap to complete. + */ + @JsonIgnore + public Optional getEstimatedDurationSeconds() { + if (estimatedDurationSeconds == null) { + return Optional.empty(); + } + return estimatedDurationSeconds; + } + + /** + * @return Whop fee in basis points. + */ + @JsonProperty("fee_bps") + public int getFeeBps() { + return feeBps; + } + + /** + * @return Source wallet address used for the quote. + */ + @JsonIgnore + public Optional getFromAddress() { + if (fromAddress == null) { + return Optional.empty(); + } + return fromAddress; + } + + /** + * @return Resolved source token details. + */ + @JsonProperty("from_token") + public Map getFromToken() { + return fromToken; + } + + /** + * @return Metadata from the request. + */ + @JsonProperty("metadata") + public Map getMetadata() { + return metadata; + } + + @JsonProperty("object") + public CreateQuoteSwapsResponseObject getObject() { + return object; + } + + /** + * @return Quoted exchange rate. + */ + @JsonProperty("rate") + public String getRate() { + return rate; + } + + /** + * @return Whether the source token needs approval before swapping. + */ + @JsonIgnore + public Optional getRequiresTokenApproval() { + if (requiresTokenApproval == null) { + return Optional.empty(); + } + return requiresTokenApproval; + } + + /** + * @return Destination wallet address used for the quote. + */ + @JsonIgnore + public Optional getToAddress() { + if (toAddress == null) { + return Optional.empty(); + } + return toAddress; + } + + /** + * @return Resolved destination token details. + */ + @JsonProperty("to_token") + public Map getToToken() { + return toToken; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bridge_fee") + private Optional _getBridgeFee() { + return bridgeFee; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("estimated_duration_seconds") + private Optional _getEstimatedDurationSeconds() { + return estimatedDurationSeconds; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("from_address") + private Optional _getFromAddress() { + return fromAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("requires_token_approval") + private Optional _getRequiresTokenApproval() { + return requiresTokenApproval; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("to_address") + private Optional _getToAddress() { + return toAddress; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateQuoteSwapsResponse && equalTo((CreateQuoteSwapsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateQuoteSwapsResponse other) { + return amountIn.equals(other.amountIn) + && amountOut.equals(other.amountOut) + && amountOutMin.equals(other.amountOutMin) + && bridgeFee.equals(other.bridgeFee) + && estimatedDurationSeconds.equals(other.estimatedDurationSeconds) + && feeBps == other.feeBps + && fromAddress.equals(other.fromAddress) + && fromToken.equals(other.fromToken) + && metadata.equals(other.metadata) + && object.equals(other.object) + && rate.equals(other.rate) + && requiresTokenApproval.equals(other.requiresTokenApproval) + && toAddress.equals(other.toAddress) + && toToken.equals(other.toToken); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amountIn, + this.amountOut, + this.amountOutMin, + this.bridgeFee, + this.estimatedDurationSeconds, + this.feeBps, + this.fromAddress, + this.fromToken, + this.metadata, + this.object, + this.rate, + this.requiresTokenApproval, + this.toAddress, + this.toToken); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountInStage builder() { + return new Builder(); + } + + public interface AmountInStage { + /** + *

Source token amount used for the quote.

+ */ + AmountOutStage amountIn(@NotNull String amountIn); + + Builder from(CreateQuoteSwapsResponse other); + } + + public interface AmountOutStage { + /** + *

Estimated destination token amount.

+ */ + FeeBpsStage amountOut(@NotNull String amountOut); + } + + public interface FeeBpsStage { + /** + *

Whop fee in basis points.

+ */ + ObjectStage feeBps(int feeBps); + } + + public interface ObjectStage { + RateStage object(@NotNull CreateQuoteSwapsResponseObject object); + } + + public interface RateStage { + /** + *

Quoted exchange rate.

+ */ + _FinalStage rate(@NotNull String rate); + } + + public interface _FinalStage { + CreateQuoteSwapsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Minimum destination amount after slippage.

+ */ + _FinalStage amountOutMin(Optional amountOutMin); + + _FinalStage amountOutMin(String amountOutMin); + + /** + *

Estimated bridge fee for cross-chain swaps.

+ */ + _FinalStage bridgeFee(Optional bridgeFee); + + _FinalStage bridgeFee(String bridgeFee); + + _FinalStage bridgeFee(Nullable bridgeFee); + + /** + *

Estimated time for the swap to complete.

+ */ + _FinalStage estimatedDurationSeconds(Optional estimatedDurationSeconds); + + _FinalStage estimatedDurationSeconds(Integer estimatedDurationSeconds); + + _FinalStage estimatedDurationSeconds(Nullable estimatedDurationSeconds); + + /** + *

Source wallet address used for the quote.

+ */ + _FinalStage fromAddress(Optional fromAddress); + + _FinalStage fromAddress(String fromAddress); + + _FinalStage fromAddress(Nullable fromAddress); + + /** + *

Resolved source token details.

+ */ + _FinalStage fromToken(Map fromToken); + + _FinalStage putAllFromToken(Map fromToken); + + _FinalStage fromToken(String key, Object value); + + /** + *

Metadata from the request.

+ */ + _FinalStage metadata(Map metadata); + + _FinalStage putAllMetadata(Map metadata); + + _FinalStage metadata(String key, Object value); + + /** + *

Whether the source token needs approval before swapping.

+ */ + _FinalStage requiresTokenApproval(Optional requiresTokenApproval); + + _FinalStage requiresTokenApproval(Boolean requiresTokenApproval); + + _FinalStage requiresTokenApproval(Nullable requiresTokenApproval); + + /** + *

Destination wallet address used for the quote.

+ */ + _FinalStage toAddress(Optional toAddress); + + _FinalStage toAddress(String toAddress); + + _FinalStage toAddress(Nullable toAddress); + + /** + *

Resolved destination token details.

+ */ + _FinalStage toToken(Map toToken); + + _FinalStage putAllToToken(Map toToken); + + _FinalStage toToken(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountInStage, AmountOutStage, FeeBpsStage, ObjectStage, RateStage, _FinalStage { + private String amountIn; + + private String amountOut; + + private int feeBps; + + private CreateQuoteSwapsResponseObject object; + + private String rate; + + private Map toToken = new LinkedHashMap<>(); + + private Optional toAddress = Optional.empty(); + + private Optional requiresTokenApproval = Optional.empty(); + + private Map metadata = new LinkedHashMap<>(); + + private Map fromToken = new LinkedHashMap<>(); + + private Optional fromAddress = Optional.empty(); + + private Optional estimatedDurationSeconds = Optional.empty(); + + private Optional bridgeFee = Optional.empty(); + + private Optional amountOutMin = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateQuoteSwapsResponse other) { + amountIn(other.getAmountIn()); + amountOut(other.getAmountOut()); + amountOutMin(other.getAmountOutMin()); + bridgeFee(other.getBridgeFee()); + estimatedDurationSeconds(other.getEstimatedDurationSeconds()); + feeBps(other.getFeeBps()); + fromAddress(other.getFromAddress()); + fromToken(other.getFromToken()); + metadata(other.getMetadata()); + object(other.getObject()); + rate(other.getRate()); + requiresTokenApproval(other.getRequiresTokenApproval()); + toAddress(other.getToAddress()); + toToken(other.getToToken()); + return this; + } + + /** + *

Source token amount used for the quote.

+ *

Source token amount used for the quote.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount_in") + public AmountOutStage amountIn(@NotNull String amountIn) { + this.amountIn = Objects.requireNonNull(amountIn, "amountIn must not be null"); + return this; + } + + /** + *

Estimated destination token amount.

+ *

Estimated destination token amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount_out") + public FeeBpsStage amountOut(@NotNull String amountOut) { + this.amountOut = Objects.requireNonNull(amountOut, "amountOut must not be null"); + return this; + } + + /** + *

Whop fee in basis points.

+ *

Whop fee in basis points.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_bps") + public ObjectStage feeBps(int feeBps) { + this.feeBps = feeBps; + return this; + } + + @java.lang.Override + @JsonSetter("object") + public RateStage object(@NotNull CreateQuoteSwapsResponseObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Quoted exchange rate.

+ *

Quoted exchange rate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("rate") + public _FinalStage rate(@NotNull String rate) { + this.rate = Objects.requireNonNull(rate, "rate must not be null"); + return this; + } + + /** + *

Resolved destination token details.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toToken(String key, Object value) { + this.toToken.put(key, value); + return this; + } + + /** + *

Resolved destination token details.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllToToken(Map toToken) { + if (toToken != null) { + this.toToken.putAll(toToken); + } + return this; + } + + /** + *

Resolved destination token details.

+ */ + @java.lang.Override + @JsonSetter(value = "to_token", nulls = Nulls.SKIP) + public _FinalStage toToken(Map toToken) { + this.toToken.clear(); + if (toToken != null) { + this.toToken.putAll(toToken); + } + return this; + } + + /** + *

Destination wallet address used for the quote.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toAddress(Nullable toAddress) { + if (toAddress.isNull()) { + this.toAddress = null; + } else if (toAddress.isEmpty()) { + this.toAddress = Optional.empty(); + } else { + this.toAddress = Optional.of(toAddress.get()); + } + return this; + } + + /** + *

Destination wallet address used for the quote.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toAddress(String toAddress) { + this.toAddress = Optional.ofNullable(toAddress); + return this; + } + + /** + *

Destination wallet address used for the quote.

+ */ + @java.lang.Override + @JsonSetter(value = "to_address", nulls = Nulls.SKIP) + public _FinalStage toAddress(Optional toAddress) { + this.toAddress = toAddress; + return this; + } + + /** + *

Whether the source token needs approval before swapping.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requiresTokenApproval(Nullable requiresTokenApproval) { + if (requiresTokenApproval.isNull()) { + this.requiresTokenApproval = null; + } else if (requiresTokenApproval.isEmpty()) { + this.requiresTokenApproval = Optional.empty(); + } else { + this.requiresTokenApproval = Optional.of(requiresTokenApproval.get()); + } + return this; + } + + /** + *

Whether the source token needs approval before swapping.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requiresTokenApproval(Boolean requiresTokenApproval) { + this.requiresTokenApproval = Optional.ofNullable(requiresTokenApproval); + return this; + } + + /** + *

Whether the source token needs approval before swapping.

+ */ + @java.lang.Override + @JsonSetter(value = "requires_token_approval", nulls = Nulls.SKIP) + public _FinalStage requiresTokenApproval(Optional requiresTokenApproval) { + this.requiresTokenApproval = requiresTokenApproval; + return this; + } + + /** + *

Metadata from the request.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(String key, Object value) { + this.metadata.put(key, value); + return this; + } + + /** + *

Metadata from the request.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllMetadata(Map metadata) { + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Metadata from the request.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Map metadata) { + this.metadata.clear(); + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Resolved source token details.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromToken(String key, Object value) { + this.fromToken.put(key, value); + return this; + } + + /** + *

Resolved source token details.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllFromToken(Map fromToken) { + if (fromToken != null) { + this.fromToken.putAll(fromToken); + } + return this; + } + + /** + *

Resolved source token details.

+ */ + @java.lang.Override + @JsonSetter(value = "from_token", nulls = Nulls.SKIP) + public _FinalStage fromToken(Map fromToken) { + this.fromToken.clear(); + if (fromToken != null) { + this.fromToken.putAll(fromToken); + } + return this; + } + + /** + *

Source wallet address used for the quote.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromAddress(Nullable fromAddress) { + if (fromAddress.isNull()) { + this.fromAddress = null; + } else if (fromAddress.isEmpty()) { + this.fromAddress = Optional.empty(); + } else { + this.fromAddress = Optional.of(fromAddress.get()); + } + return this; + } + + /** + *

Source wallet address used for the quote.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromAddress(String fromAddress) { + this.fromAddress = Optional.ofNullable(fromAddress); + return this; + } + + /** + *

Source wallet address used for the quote.

+ */ + @java.lang.Override + @JsonSetter(value = "from_address", nulls = Nulls.SKIP) + public _FinalStage fromAddress(Optional fromAddress) { + this.fromAddress = fromAddress; + return this; + } + + /** + *

Estimated time for the swap to complete.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedDurationSeconds(Nullable estimatedDurationSeconds) { + if (estimatedDurationSeconds.isNull()) { + this.estimatedDurationSeconds = null; + } else if (estimatedDurationSeconds.isEmpty()) { + this.estimatedDurationSeconds = Optional.empty(); + } else { + this.estimatedDurationSeconds = Optional.of(estimatedDurationSeconds.get()); + } + return this; + } + + /** + *

Estimated time for the swap to complete.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedDurationSeconds(Integer estimatedDurationSeconds) { + this.estimatedDurationSeconds = Optional.ofNullable(estimatedDurationSeconds); + return this; + } + + /** + *

Estimated time for the swap to complete.

+ */ + @java.lang.Override + @JsonSetter(value = "estimated_duration_seconds", nulls = Nulls.SKIP) + public _FinalStage estimatedDurationSeconds(Optional estimatedDurationSeconds) { + this.estimatedDurationSeconds = estimatedDurationSeconds; + return this; + } + + /** + *

Estimated bridge fee for cross-chain swaps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bridgeFee(Nullable bridgeFee) { + if (bridgeFee.isNull()) { + this.bridgeFee = null; + } else if (bridgeFee.isEmpty()) { + this.bridgeFee = Optional.empty(); + } else { + this.bridgeFee = Optional.of(bridgeFee.get()); + } + return this; + } + + /** + *

Estimated bridge fee for cross-chain swaps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bridgeFee(String bridgeFee) { + this.bridgeFee = Optional.ofNullable(bridgeFee); + return this; + } + + /** + *

Estimated bridge fee for cross-chain swaps.

+ */ + @java.lang.Override + @JsonSetter(value = "bridge_fee", nulls = Nulls.SKIP) + public _FinalStage bridgeFee(Optional bridgeFee) { + this.bridgeFee = bridgeFee; + return this; + } + + /** + *

Minimum destination amount after slippage.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amountOutMin(String amountOutMin) { + this.amountOutMin = Optional.ofNullable(amountOutMin); + return this; + } + + /** + *

Minimum destination amount after slippage.

+ */ + @java.lang.Override + @JsonSetter(value = "amount_out_min", nulls = Nulls.SKIP) + public _FinalStage amountOutMin(Optional amountOutMin) { + this.amountOutMin = amountOutMin; + return this; + } + + @java.lang.Override + public CreateQuoteSwapsResponse build() { + return new CreateQuoteSwapsResponse( + amountIn, + amountOut, + amountOutMin, + bridgeFee, + estimatedDurationSeconds, + feeBps, + fromAddress, + fromToken, + metadata, + object, + rate, + requiresTokenApproval, + toAddress, + toToken, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/CreateQuoteSwapsResponseObject.java b/src/main/java/com/whop/api/resources/swaps/types/CreateQuoteSwapsResponseObject.java new file mode 100644 index 00000000..a52787d7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/CreateQuoteSwapsResponseObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateQuoteSwapsResponseObject { + public static final CreateQuoteSwapsResponseObject SWAP_QUOTE = + new CreateQuoteSwapsResponseObject(Value.SWAP_QUOTE, "swap_quote"); + + private final Value value; + + private final String string; + + CreateQuoteSwapsResponseObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateQuoteSwapsResponseObject + && this.string.equals(((CreateQuoteSwapsResponseObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SWAP_QUOTE: + return visitor.visitSwapQuote(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateQuoteSwapsResponseObject valueOf(String value) { + switch (value) { + case "swap_quote": + return SWAP_QUOTE; + default: + return new CreateQuoteSwapsResponseObject(Value.UNKNOWN, value); + } + } + + public enum Value { + SWAP_QUOTE, + + UNKNOWN + } + + public interface Visitor { + T visitSwapQuote(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsRequestFromChain.java b/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsRequestFromChain.java new file mode 100644 index 00000000..dd9799d4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsRequestFromChain.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = CreateSwapsRequestFromChain.Deserializer.class) +public final class CreateSwapsRequestFromChain { + private final Object value; + + private final int type; + + private CreateSwapsRequestFromChain(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((String) this.value); + } else if (this.type == 1) { + return visitor.visit((int) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSwapsRequestFromChain && equalTo((CreateSwapsRequestFromChain) other); + } + + private boolean equalTo(CreateSwapsRequestFromChain other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static CreateSwapsRequestFromChain of(String value) { + return new CreateSwapsRequestFromChain(value, 0); + } + + public static CreateSwapsRequestFromChain of(int value) { + return new CreateSwapsRequestFromChain(value, 1); + } + + public interface Visitor { + T visit(String value); + + T visit(int value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(CreateSwapsRequestFromChain.class); + } + + @java.lang.Override + public CreateSwapsRequestFromChain deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Integer) { + return of((Integer) value); + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsRequestToChain.java b/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsRequestToChain.java new file mode 100644 index 00000000..db12c842 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsRequestToChain.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = CreateSwapsRequestToChain.Deserializer.class) +public final class CreateSwapsRequestToChain { + private final Object value; + + private final int type; + + private CreateSwapsRequestToChain(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((String) this.value); + } else if (this.type == 1) { + return visitor.visit((int) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSwapsRequestToChain && equalTo((CreateSwapsRequestToChain) other); + } + + private boolean equalTo(CreateSwapsRequestToChain other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static CreateSwapsRequestToChain of(String value) { + return new CreateSwapsRequestToChain(value, 0); + } + + public static CreateSwapsRequestToChain of(int value) { + return new CreateSwapsRequestToChain(value, 1); + } + + public interface Visitor { + T visit(String value); + + T visit(int value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(CreateSwapsRequestToChain.class); + } + + @java.lang.Override + public CreateSwapsRequestToChain deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Integer) { + return of((Integer) value); + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsResponse.java b/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsResponse.java new file mode 100644 index 00000000..ff230de3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsResponse.java @@ -0,0 +1,715 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSwapsResponse.Builder.class) +public final class CreateSwapsResponse { + private final String accountId; + + private final Optional amountIn; + + private final Optional amountOut; + + private final Optional amountOutExpected; + + private final Optional amountOutMin; + + private final Optional fromToken; + + private final Optional id; + + private final CreateSwapsResponseObject object; + + private final Optional rate; + + private final CreateSwapsResponseStatus status; + + private final Optional toChain; + + private final Optional toToken; + + private final Map additionalProperties; + + private CreateSwapsResponse( + String accountId, + Optional amountIn, + Optional amountOut, + Optional amountOutExpected, + Optional amountOutMin, + Optional fromToken, + Optional id, + CreateSwapsResponseObject object, + Optional rate, + CreateSwapsResponseStatus status, + Optional toChain, + Optional toToken, + Map additionalProperties) { + this.accountId = accountId; + this.amountIn = amountIn; + this.amountOut = amountOut; + this.amountOutExpected = amountOutExpected; + this.amountOutMin = amountOutMin; + this.fromToken = fromToken; + this.id = id; + this.object = object; + this.rate = rate; + this.status = status; + this.toChain = toChain; + this.toToken = toToken; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID that owns the wallet used for the swap. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Fiat pairs only: amount of the source currency converted. Null while a stablecoin repayment is processing. + */ + @JsonIgnore + public Optional getAmountIn() { + if (amountIn == null) { + return Optional.empty(); + } + return amountIn; + } + + /** + * @return Fiat pairs only: amount credited in the destination currency. Null while a stablecoin repayment is processing. + */ + @JsonIgnore + public Optional getAmountOut() { + if (amountOut == null) { + return Optional.empty(); + } + return amountOut; + } + + /** + * @return Expected destination token amount. + */ + @JsonProperty("amount_out_expected") + public Optional getAmountOutExpected() { + return amountOutExpected; + } + + /** + * @return Minimum destination amount after slippage. + */ + @JsonProperty("amount_out_min") + public Optional getAmountOutMin() { + return amountOutMin; + } + + /** + * @return Fiat pairs only: the source currency. + */ + @JsonIgnore + public Optional getFromToken() { + if (fromToken == null) { + return Optional.empty(); + } + return fromToken; + } + + /** + * @return Swap ID. Poll GET /swaps/:id for status. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonProperty("object") + public CreateSwapsResponseObject getObject() { + return object; + } + + /** + * @return Quoted exchange rate used to create the swap. + */ + @JsonProperty("rate") + public Optional getRate() { + return rate; + } + + /** + * @return Swap status. Crypto swaps start queued; fiat conversions return complete, or working while a stablecoin repayment settles. + */ + @JsonProperty("status") + public CreateSwapsResponseStatus getStatus() { + return status; + } + + /** + * @return Destination chain for the swap. + */ + @JsonProperty("to_chain") + public Optional getToChain() { + return toChain; + } + + /** + * @return Fiat pairs only: the destination currency. + */ + @JsonIgnore + public Optional getToToken() { + if (toToken == null) { + return Optional.empty(); + } + return toToken; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("amount_in") + private Optional _getAmountIn() { + return amountIn; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("amount_out") + private Optional _getAmountOut() { + return amountOut; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("from_token") + private Optional _getFromToken() { + return fromToken; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("to_token") + private Optional _getToToken() { + return toToken; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSwapsResponse && equalTo((CreateSwapsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSwapsResponse other) { + return accountId.equals(other.accountId) + && amountIn.equals(other.amountIn) + && amountOut.equals(other.amountOut) + && amountOutExpected.equals(other.amountOutExpected) + && amountOutMin.equals(other.amountOutMin) + && fromToken.equals(other.fromToken) + && id.equals(other.id) + && object.equals(other.object) + && rate.equals(other.rate) + && status.equals(other.status) + && toChain.equals(other.toChain) + && toToken.equals(other.toToken); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.amountIn, + this.amountOut, + this.amountOutExpected, + this.amountOutMin, + this.fromToken, + this.id, + this.object, + this.rate, + this.status, + this.toChain, + this.toToken); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Account ID that owns the wallet used for the swap.

+ */ + ObjectStage accountId(@NotNull String accountId); + + Builder from(CreateSwapsResponse other); + } + + public interface ObjectStage { + StatusStage object(@NotNull CreateSwapsResponseObject object); + } + + public interface StatusStage { + /** + *

Swap status. Crypto swaps start queued; fiat conversions return complete, or working while a stablecoin repayment settles.

+ */ + _FinalStage status(@NotNull CreateSwapsResponseStatus status); + } + + public interface _FinalStage { + CreateSwapsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Fiat pairs only: amount of the source currency converted. Null while a stablecoin repayment is processing.

+ */ + _FinalStage amountIn(Optional amountIn); + + _FinalStage amountIn(Double amountIn); + + _FinalStage amountIn(Nullable amountIn); + + /** + *

Fiat pairs only: amount credited in the destination currency. Null while a stablecoin repayment is processing.

+ */ + _FinalStage amountOut(Optional amountOut); + + _FinalStage amountOut(Double amountOut); + + _FinalStage amountOut(Nullable amountOut); + + /** + *

Expected destination token amount.

+ */ + _FinalStage amountOutExpected(Optional amountOutExpected); + + _FinalStage amountOutExpected(String amountOutExpected); + + /** + *

Minimum destination amount after slippage.

+ */ + _FinalStage amountOutMin(Optional amountOutMin); + + _FinalStage amountOutMin(String amountOutMin); + + /** + *

Fiat pairs only: the source currency.

+ */ + _FinalStage fromToken(Optional fromToken); + + _FinalStage fromToken(CreateSwapsResponseFromToken fromToken); + + _FinalStage fromToken(Nullable fromToken); + + /** + *

Swap ID. Poll GET /swaps/:id for status.

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + + /** + *

Quoted exchange rate used to create the swap.

+ */ + _FinalStage rate(Optional rate); + + _FinalStage rate(String rate); + + /** + *

Destination chain for the swap.

+ */ + _FinalStage toChain(Optional toChain); + + _FinalStage toChain(String toChain); + + /** + *

Fiat pairs only: the destination currency.

+ */ + _FinalStage toToken(Optional toToken); + + _FinalStage toToken(CreateSwapsResponseToToken toToken); + + _FinalStage toToken(Nullable toToken); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, ObjectStage, StatusStage, _FinalStage { + private String accountId; + + private CreateSwapsResponseObject object; + + private CreateSwapsResponseStatus status; + + private Optional toToken = Optional.empty(); + + private Optional toChain = Optional.empty(); + + private Optional rate = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional fromToken = Optional.empty(); + + private Optional amountOutMin = Optional.empty(); + + private Optional amountOutExpected = Optional.empty(); + + private Optional amountOut = Optional.empty(); + + private Optional amountIn = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateSwapsResponse other) { + accountId(other.getAccountId()); + amountIn(other.getAmountIn()); + amountOut(other.getAmountOut()); + amountOutExpected(other.getAmountOutExpected()); + amountOutMin(other.getAmountOutMin()); + fromToken(other.getFromToken()); + id(other.getId()); + object(other.getObject()); + rate(other.getRate()); + status(other.getStatus()); + toChain(other.getToChain()); + toToken(other.getToToken()); + return this; + } + + /** + *

Account ID that owns the wallet used for the swap.

+ *

Account ID that owns the wallet used for the swap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public ObjectStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public StatusStage object(@NotNull CreateSwapsResponseObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Swap status. Crypto swaps start queued; fiat conversions return complete, or working while a stablecoin repayment settles.

+ *

Swap status. Crypto swaps start queued; fiat conversions return complete, or working while a stablecoin repayment settles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull CreateSwapsResponseStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Fiat pairs only: the destination currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toToken(Nullable toToken) { + if (toToken.isNull()) { + this.toToken = null; + } else if (toToken.isEmpty()) { + this.toToken = Optional.empty(); + } else { + this.toToken = Optional.of(toToken.get()); + } + return this; + } + + /** + *

Fiat pairs only: the destination currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toToken(CreateSwapsResponseToToken toToken) { + this.toToken = Optional.ofNullable(toToken); + return this; + } + + /** + *

Fiat pairs only: the destination currency.

+ */ + @java.lang.Override + @JsonSetter(value = "to_token", nulls = Nulls.SKIP) + public _FinalStage toToken(Optional toToken) { + this.toToken = toToken; + return this; + } + + /** + *

Destination chain for the swap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toChain(String toChain) { + this.toChain = Optional.ofNullable(toChain); + return this; + } + + /** + *

Destination chain for the swap.

+ */ + @java.lang.Override + @JsonSetter(value = "to_chain", nulls = Nulls.SKIP) + public _FinalStage toChain(Optional toChain) { + this.toChain = toChain; + return this; + } + + /** + *

Quoted exchange rate used to create the swap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage rate(String rate) { + this.rate = Optional.ofNullable(rate); + return this; + } + + /** + *

Quoted exchange rate used to create the swap.

+ */ + @java.lang.Override + @JsonSetter(value = "rate", nulls = Nulls.SKIP) + public _FinalStage rate(Optional rate) { + this.rate = rate; + return this; + } + + /** + *

Swap ID. Poll GET /swaps/:id for status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

Swap ID. Poll GET /swaps/:id for status.

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + /** + *

Fiat pairs only: the source currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromToken(Nullable fromToken) { + if (fromToken.isNull()) { + this.fromToken = null; + } else if (fromToken.isEmpty()) { + this.fromToken = Optional.empty(); + } else { + this.fromToken = Optional.of(fromToken.get()); + } + return this; + } + + /** + *

Fiat pairs only: the source currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromToken(CreateSwapsResponseFromToken fromToken) { + this.fromToken = Optional.ofNullable(fromToken); + return this; + } + + /** + *

Fiat pairs only: the source currency.

+ */ + @java.lang.Override + @JsonSetter(value = "from_token", nulls = Nulls.SKIP) + public _FinalStage fromToken(Optional fromToken) { + this.fromToken = fromToken; + return this; + } + + /** + *

Minimum destination amount after slippage.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amountOutMin(String amountOutMin) { + this.amountOutMin = Optional.ofNullable(amountOutMin); + return this; + } + + /** + *

Minimum destination amount after slippage.

+ */ + @java.lang.Override + @JsonSetter(value = "amount_out_min", nulls = Nulls.SKIP) + public _FinalStage amountOutMin(Optional amountOutMin) { + this.amountOutMin = amountOutMin; + return this; + } + + /** + *

Expected destination token amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amountOutExpected(String amountOutExpected) { + this.amountOutExpected = Optional.ofNullable(amountOutExpected); + return this; + } + + /** + *

Expected destination token amount.

+ */ + @java.lang.Override + @JsonSetter(value = "amount_out_expected", nulls = Nulls.SKIP) + public _FinalStage amountOutExpected(Optional amountOutExpected) { + this.amountOutExpected = amountOutExpected; + return this; + } + + /** + *

Fiat pairs only: amount credited in the destination currency. Null while a stablecoin repayment is processing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amountOut(Nullable amountOut) { + if (amountOut.isNull()) { + this.amountOut = null; + } else if (amountOut.isEmpty()) { + this.amountOut = Optional.empty(); + } else { + this.amountOut = Optional.of(amountOut.get()); + } + return this; + } + + /** + *

Fiat pairs only: amount credited in the destination currency. Null while a stablecoin repayment is processing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amountOut(Double amountOut) { + this.amountOut = Optional.ofNullable(amountOut); + return this; + } + + /** + *

Fiat pairs only: amount credited in the destination currency. Null while a stablecoin repayment is processing.

+ */ + @java.lang.Override + @JsonSetter(value = "amount_out", nulls = Nulls.SKIP) + public _FinalStage amountOut(Optional amountOut) { + this.amountOut = amountOut; + return this; + } + + /** + *

Fiat pairs only: amount of the source currency converted. Null while a stablecoin repayment is processing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amountIn(Nullable amountIn) { + if (amountIn.isNull()) { + this.amountIn = null; + } else if (amountIn.isEmpty()) { + this.amountIn = Optional.empty(); + } else { + this.amountIn = Optional.of(amountIn.get()); + } + return this; + } + + /** + *

Fiat pairs only: amount of the source currency converted. Null while a stablecoin repayment is processing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amountIn(Double amountIn) { + this.amountIn = Optional.ofNullable(amountIn); + return this; + } + + /** + *

Fiat pairs only: amount of the source currency converted. Null while a stablecoin repayment is processing.

+ */ + @java.lang.Override + @JsonSetter(value = "amount_in", nulls = Nulls.SKIP) + public _FinalStage amountIn(Optional amountIn) { + this.amountIn = amountIn; + return this; + } + + @java.lang.Override + public CreateSwapsResponse build() { + return new CreateSwapsResponse( + accountId, + amountIn, + amountOut, + amountOutExpected, + amountOutMin, + fromToken, + id, + object, + rate, + status, + toChain, + toToken, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsResponseFromToken.java b/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsResponseFromToken.java new file mode 100644 index 00000000..7a3cc269 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsResponseFromToken.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSwapsResponseFromToken.Builder.class) +public final class CreateSwapsResponseFromToken { + private final Optional symbol; + + private final Map additionalProperties; + + private CreateSwapsResponseFromToken(Optional symbol, Map additionalProperties) { + this.symbol = symbol; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("symbol") + public Optional getSymbol() { + return symbol; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSwapsResponseFromToken && equalTo((CreateSwapsResponseFromToken) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSwapsResponseFromToken other) { + return symbol.equals(other.symbol); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.symbol); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional symbol = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateSwapsResponseFromToken other) { + symbol(other.getSymbol()); + return this; + } + + @JsonSetter(value = "symbol", nulls = Nulls.SKIP) + public Builder symbol(Optional symbol) { + this.symbol = symbol; + return this; + } + + public Builder symbol(String symbol) { + this.symbol = Optional.ofNullable(symbol); + return this; + } + + public CreateSwapsResponseFromToken build() { + return new CreateSwapsResponseFromToken(symbol, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsResponseObject.java b/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsResponseObject.java new file mode 100644 index 00000000..d939f08e --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsResponseObject.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateSwapsResponseObject { + public static final CreateSwapsResponseObject SWAP = new CreateSwapsResponseObject(Value.SWAP, "swap"); + + private final Value value; + + private final String string; + + CreateSwapsResponseObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateSwapsResponseObject + && this.string.equals(((CreateSwapsResponseObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SWAP: + return visitor.visitSwap(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateSwapsResponseObject valueOf(String value) { + switch (value) { + case "swap": + return SWAP; + default: + return new CreateSwapsResponseObject(Value.UNKNOWN, value); + } + } + + public enum Value { + SWAP, + + UNKNOWN + } + + public interface Visitor { + T visitSwap(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsResponseStatus.java b/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsResponseStatus.java new file mode 100644 index 00000000..30d45cee --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsResponseStatus.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateSwapsResponseStatus { + public static final CreateSwapsResponseStatus FAILED = new CreateSwapsResponseStatus(Value.FAILED, "failed"); + + public static final CreateSwapsResponseStatus COMPLETE = new CreateSwapsResponseStatus(Value.COMPLETE, "complete"); + + public static final CreateSwapsResponseStatus QUEUED = new CreateSwapsResponseStatus(Value.QUEUED, "queued"); + + public static final CreateSwapsResponseStatus WORKING = new CreateSwapsResponseStatus(Value.WORKING, "working"); + + private final Value value; + + private final String string; + + CreateSwapsResponseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateSwapsResponseStatus + && this.string.equals(((CreateSwapsResponseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case COMPLETE: + return visitor.visitComplete(); + case QUEUED: + return visitor.visitQueued(); + case WORKING: + return visitor.visitWorking(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateSwapsResponseStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "complete": + return COMPLETE; + case "queued": + return QUEUED; + case "working": + return WORKING; + default: + return new CreateSwapsResponseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + QUEUED, + + WORKING, + + COMPLETE, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitQueued(); + + T visitWorking(); + + T visitComplete(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsResponseToToken.java b/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsResponseToToken.java new file mode 100644 index 00000000..de765fb1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/CreateSwapsResponseToToken.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSwapsResponseToToken.Builder.class) +public final class CreateSwapsResponseToToken { + private final Optional symbol; + + private final Map additionalProperties; + + private CreateSwapsResponseToToken(Optional symbol, Map additionalProperties) { + this.symbol = symbol; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("symbol") + public Optional getSymbol() { + return symbol; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSwapsResponseToToken && equalTo((CreateSwapsResponseToToken) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSwapsResponseToToken other) { + return symbol.equals(other.symbol); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.symbol); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional symbol = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateSwapsResponseToToken other) { + symbol(other.getSymbol()); + return this; + } + + @JsonSetter(value = "symbol", nulls = Nulls.SKIP) + public Builder symbol(Optional symbol) { + this.symbol = symbol; + return this; + } + + public Builder symbol(String symbol) { + this.symbol = Optional.ofNullable(symbol); + return this; + } + + public CreateSwapsResponseToToken build() { + return new CreateSwapsResponseToToken(symbol, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/ListSwapsResponse.java b/src/main/java/com/whop/api/resources/swaps/types/ListSwapsResponse.java new file mode 100644 index 00000000..2d17b463 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/ListSwapsResponse.java @@ -0,0 +1,122 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSwapsResponse.Builder.class) +public final class ListSwapsResponse { + private final List data; + + private final Map additionalProperties; + + private ListSwapsResponse(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + /** + * @return Swaps returned for this account. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSwapsResponse && equalTo((ListSwapsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSwapsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListSwapsResponse other) { + data(other.getData()); + return this; + } + + /** + *

Swaps returned for this account.

+ */ + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(ListSwapsResponseDataItem data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public ListSwapsResponse build() { + return new ListSwapsResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/ListSwapsResponseDataItem.java b/src/main/java/com/whop/api/resources/swaps/types/ListSwapsResponseDataItem.java new file mode 100644 index 00000000..6adf8837 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/ListSwapsResponseDataItem.java @@ -0,0 +1,362 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListSwapsResponseDataItem.Builder.class) +public final class ListSwapsResponseDataItem { + private final String accountId; + + private final Optional error; + + private final String id; + + private final ListSwapsResponseDataItemObject object; + + private final ListSwapsResponseDataItemStatus status; + + private final List txHashes; + + private final Map additionalProperties; + + private ListSwapsResponseDataItem( + String accountId, + Optional error, + String id, + ListSwapsResponseDataItemObject object, + ListSwapsResponseDataItemStatus status, + List txHashes, + Map additionalProperties) { + this.accountId = accountId; + this.error = error; + this.id = id; + this.object = object; + this.status = status; + this.txHashes = txHashes; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID that owns the wallet used for the swap. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Latest error returned for a failed swap. + */ + @JsonIgnore + public Optional getError() { + if (error == null) { + return Optional.empty(); + } + return error; + } + + /** + * @return Swap ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("object") + public ListSwapsResponseDataItemObject getObject() { + return object; + } + + /** + * @return Current swap status. complete and failed are terminal. + */ + @JsonProperty("status") + public ListSwapsResponseDataItemStatus getStatus() { + return status; + } + + /** + * @return On-chain transaction hashes produced by the swap. + */ + @JsonProperty("tx_hashes") + public List getTxHashes() { + return txHashes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("error") + private Optional _getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListSwapsResponseDataItem && equalTo((ListSwapsResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListSwapsResponseDataItem other) { + return accountId.equals(other.accountId) + && error.equals(other.error) + && id.equals(other.id) + && object.equals(other.object) + && status.equals(other.status) + && txHashes.equals(other.txHashes); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.error, this.id, this.object, this.status, this.txHashes); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Account ID that owns the wallet used for the swap.

+ */ + IdStage accountId(@NotNull String accountId); + + Builder from(ListSwapsResponseDataItem other); + } + + public interface IdStage { + /** + *

Swap ID.

+ */ + ObjectStage id(@NotNull String id); + } + + public interface ObjectStage { + StatusStage object(@NotNull ListSwapsResponseDataItemObject object); + } + + public interface StatusStage { + /** + *

Current swap status. complete and failed are terminal.

+ */ + _FinalStage status(@NotNull ListSwapsResponseDataItemStatus status); + } + + public interface _FinalStage { + ListSwapsResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Latest error returned for a failed swap.

+ */ + _FinalStage error(Optional error); + + _FinalStage error(String error); + + _FinalStage error(Nullable error); + + /** + *

On-chain transaction hashes produced by the swap.

+ */ + _FinalStage txHashes(List txHashes); + + _FinalStage addTxHashes(String txHashes); + + _FinalStage addAllTxHashes(List txHashes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, IdStage, ObjectStage, StatusStage, _FinalStage { + private String accountId; + + private String id; + + private ListSwapsResponseDataItemObject object; + + private ListSwapsResponseDataItemStatus status; + + private List txHashes = new ArrayList<>(); + + private Optional error = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListSwapsResponseDataItem other) { + accountId(other.getAccountId()); + error(other.getError()); + id(other.getId()); + object(other.getObject()); + status(other.getStatus()); + txHashes(other.getTxHashes()); + return this; + } + + /** + *

Account ID that owns the wallet used for the swap.

+ *

Account ID that owns the wallet used for the swap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public IdStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

Swap ID.

+ *

Swap ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public StatusStage object(@NotNull ListSwapsResponseDataItemObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Current swap status. complete and failed are terminal.

+ *

Current swap status. complete and failed are terminal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull ListSwapsResponseDataItemStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

On-chain transaction hashes produced by the swap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllTxHashes(List txHashes) { + if (txHashes != null) { + this.txHashes.addAll(txHashes); + } + return this; + } + + /** + *

On-chain transaction hashes produced by the swap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addTxHashes(String txHashes) { + this.txHashes.add(txHashes); + return this; + } + + /** + *

On-chain transaction hashes produced by the swap.

+ */ + @java.lang.Override + @JsonSetter(value = "tx_hashes", nulls = Nulls.SKIP) + public _FinalStage txHashes(List txHashes) { + this.txHashes.clear(); + if (txHashes != null) { + this.txHashes.addAll(txHashes); + } + return this; + } + + /** + *

Latest error returned for a failed swap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(Nullable error) { + if (error.isNull()) { + this.error = null; + } else if (error.isEmpty()) { + this.error = Optional.empty(); + } else { + this.error = Optional.of(error.get()); + } + return this; + } + + /** + *

Latest error returned for a failed swap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

Latest error returned for a failed swap.

+ */ + @java.lang.Override + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public _FinalStage error(Optional error) { + this.error = error; + return this; + } + + @java.lang.Override + public ListSwapsResponseDataItem build() { + return new ListSwapsResponseDataItem(accountId, error, id, object, status, txHashes, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/ListSwapsResponseDataItemObject.java b/src/main/java/com/whop/api/resources/swaps/types/ListSwapsResponseDataItemObject.java new file mode 100644 index 00000000..df927e1d --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/ListSwapsResponseDataItemObject.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListSwapsResponseDataItemObject { + public static final ListSwapsResponseDataItemObject SWAP = new ListSwapsResponseDataItemObject(Value.SWAP, "swap"); + + private final Value value; + + private final String string; + + ListSwapsResponseDataItemObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListSwapsResponseDataItemObject + && this.string.equals(((ListSwapsResponseDataItemObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SWAP: + return visitor.visitSwap(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListSwapsResponseDataItemObject valueOf(String value) { + switch (value) { + case "swap": + return SWAP; + default: + return new ListSwapsResponseDataItemObject(Value.UNKNOWN, value); + } + } + + public enum Value { + SWAP, + + UNKNOWN + } + + public interface Visitor { + T visitSwap(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/ListSwapsResponseDataItemStatus.java b/src/main/java/com/whop/api/resources/swaps/types/ListSwapsResponseDataItemStatus.java new file mode 100644 index 00000000..ad57b5a5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/ListSwapsResponseDataItemStatus.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListSwapsResponseDataItemStatus { + public static final ListSwapsResponseDataItemStatus FAILED = + new ListSwapsResponseDataItemStatus(Value.FAILED, "failed"); + + public static final ListSwapsResponseDataItemStatus COMPLETE = + new ListSwapsResponseDataItemStatus(Value.COMPLETE, "complete"); + + public static final ListSwapsResponseDataItemStatus QUEUED = + new ListSwapsResponseDataItemStatus(Value.QUEUED, "queued"); + + public static final ListSwapsResponseDataItemStatus WORKING = + new ListSwapsResponseDataItemStatus(Value.WORKING, "working"); + + private final Value value; + + private final String string; + + ListSwapsResponseDataItemStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListSwapsResponseDataItemStatus + && this.string.equals(((ListSwapsResponseDataItemStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case COMPLETE: + return visitor.visitComplete(); + case QUEUED: + return visitor.visitQueued(); + case WORKING: + return visitor.visitWorking(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListSwapsResponseDataItemStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "complete": + return COMPLETE; + case "queued": + return QUEUED; + case "working": + return WORKING; + default: + return new ListSwapsResponseDataItemStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + QUEUED, + + WORKING, + + COMPLETE, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitQueued(); + + T visitWorking(); + + T visitComplete(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/PostSwapCompletedPayload.java b/src/main/java/com/whop/api/resources/swaps/types/PostSwapCompletedPayload.java new file mode 100644 index 00000000..37877b6a --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/PostSwapCompletedPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.LedgerActivity; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostSwapCompletedPayload.Builder.class) +public final class PostSwapCompletedPayload { + private final Optional accountId; + + private final PostSwapCompletedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final LedgerActivity data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostSwapCompletedPayloadType type; + + private final Map additionalProperties; + + private PostSwapCompletedPayload( + Optional accountId, + PostSwapCompletedPayloadApiVersion apiVersion, + Optional apiVersionDate, + LedgerActivity data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostSwapCompletedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostSwapCompletedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public LedgerActivity getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostSwapCompletedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostSwapCompletedPayload && equalTo((PostSwapCompletedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostSwapCompletedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostSwapCompletedPayloadApiVersion apiVersion); + + Builder from(PostSwapCompletedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull LedgerActivity data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostSwapCompletedPayloadType type); + } + + public interface _FinalStage { + PostSwapCompletedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostSwapCompletedPayloadApiVersion apiVersion; + + private LedgerActivity data; + + private String id; + + private OffsetDateTime timestamp; + + private PostSwapCompletedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostSwapCompletedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostSwapCompletedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull LedgerActivity data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostSwapCompletedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostSwapCompletedPayload build() { + return new PostSwapCompletedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/PostSwapCompletedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/swaps/types/PostSwapCompletedPayloadApiVersion.java new file mode 100644 index 00000000..5128e935 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/PostSwapCompletedPayloadApiVersion.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostSwapCompletedPayloadApiVersion { + public static final PostSwapCompletedPayloadApiVersion V1 = new PostSwapCompletedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostSwapCompletedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostSwapCompletedPayloadApiVersion + && this.string.equals(((PostSwapCompletedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostSwapCompletedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostSwapCompletedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/PostSwapCompletedPayloadType.java b/src/main/java/com/whop/api/resources/swaps/types/PostSwapCompletedPayloadType.java new file mode 100644 index 00000000..1a9157ab --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/PostSwapCompletedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostSwapCompletedPayloadType { + public static final PostSwapCompletedPayloadType SWAP_COMPLETED = + new PostSwapCompletedPayloadType(Value.SWAP_COMPLETED, "swap.completed"); + + private final Value value; + + private final String string; + + PostSwapCompletedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostSwapCompletedPayloadType + && this.string.equals(((PostSwapCompletedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SWAP_COMPLETED: + return visitor.visitSwapCompleted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostSwapCompletedPayloadType valueOf(String value) { + switch (value) { + case "swap.completed": + return SWAP_COMPLETED; + default: + return new PostSwapCompletedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + SWAP_COMPLETED, + + UNKNOWN + } + + public interface Visitor { + T visitSwapCompleted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/RetrieveSwapsResponse.java b/src/main/java/com/whop/api/resources/swaps/types/RetrieveSwapsResponse.java new file mode 100644 index 00000000..9497fbd8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/RetrieveSwapsResponse.java @@ -0,0 +1,362 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveSwapsResponse.Builder.class) +public final class RetrieveSwapsResponse { + private final String accountId; + + private final Optional error; + + private final String id; + + private final RetrieveSwapsResponseObject object; + + private final RetrieveSwapsResponseStatus status; + + private final List txHashes; + + private final Map additionalProperties; + + private RetrieveSwapsResponse( + String accountId, + Optional error, + String id, + RetrieveSwapsResponseObject object, + RetrieveSwapsResponseStatus status, + List txHashes, + Map additionalProperties) { + this.accountId = accountId; + this.error = error; + this.id = id; + this.object = object; + this.status = status; + this.txHashes = txHashes; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID that owns the wallet used for the swap. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Latest error returned for a failed swap. + */ + @JsonIgnore + public Optional getError() { + if (error == null) { + return Optional.empty(); + } + return error; + } + + /** + * @return Swap ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("object") + public RetrieveSwapsResponseObject getObject() { + return object; + } + + /** + * @return Current swap status. complete and failed are terminal. + */ + @JsonProperty("status") + public RetrieveSwapsResponseStatus getStatus() { + return status; + } + + /** + * @return On-chain transaction hashes produced by the swap. + */ + @JsonProperty("tx_hashes") + public List getTxHashes() { + return txHashes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("error") + private Optional _getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveSwapsResponse && equalTo((RetrieveSwapsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveSwapsResponse other) { + return accountId.equals(other.accountId) + && error.equals(other.error) + && id.equals(other.id) + && object.equals(other.object) + && status.equals(other.status) + && txHashes.equals(other.txHashes); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.error, this.id, this.object, this.status, this.txHashes); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Account ID that owns the wallet used for the swap.

+ */ + IdStage accountId(@NotNull String accountId); + + Builder from(RetrieveSwapsResponse other); + } + + public interface IdStage { + /** + *

Swap ID.

+ */ + ObjectStage id(@NotNull String id); + } + + public interface ObjectStage { + StatusStage object(@NotNull RetrieveSwapsResponseObject object); + } + + public interface StatusStage { + /** + *

Current swap status. complete and failed are terminal.

+ */ + _FinalStage status(@NotNull RetrieveSwapsResponseStatus status); + } + + public interface _FinalStage { + RetrieveSwapsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Latest error returned for a failed swap.

+ */ + _FinalStage error(Optional error); + + _FinalStage error(String error); + + _FinalStage error(Nullable error); + + /** + *

On-chain transaction hashes produced by the swap.

+ */ + _FinalStage txHashes(List txHashes); + + _FinalStage addTxHashes(String txHashes); + + _FinalStage addAllTxHashes(List txHashes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, IdStage, ObjectStage, StatusStage, _FinalStage { + private String accountId; + + private String id; + + private RetrieveSwapsResponseObject object; + + private RetrieveSwapsResponseStatus status; + + private List txHashes = new ArrayList<>(); + + private Optional error = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveSwapsResponse other) { + accountId(other.getAccountId()); + error(other.getError()); + id(other.getId()); + object(other.getObject()); + status(other.getStatus()); + txHashes(other.getTxHashes()); + return this; + } + + /** + *

Account ID that owns the wallet used for the swap.

+ *

Account ID that owns the wallet used for the swap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public IdStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

Swap ID.

+ *

Swap ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public StatusStage object(@NotNull RetrieveSwapsResponseObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Current swap status. complete and failed are terminal.

+ *

Current swap status. complete and failed are terminal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull RetrieveSwapsResponseStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

On-chain transaction hashes produced by the swap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllTxHashes(List txHashes) { + if (txHashes != null) { + this.txHashes.addAll(txHashes); + } + return this; + } + + /** + *

On-chain transaction hashes produced by the swap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addTxHashes(String txHashes) { + this.txHashes.add(txHashes); + return this; + } + + /** + *

On-chain transaction hashes produced by the swap.

+ */ + @java.lang.Override + @JsonSetter(value = "tx_hashes", nulls = Nulls.SKIP) + public _FinalStage txHashes(List txHashes) { + this.txHashes.clear(); + if (txHashes != null) { + this.txHashes.addAll(txHashes); + } + return this; + } + + /** + *

Latest error returned for a failed swap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(Nullable error) { + if (error.isNull()) { + this.error = null; + } else if (error.isEmpty()) { + this.error = Optional.empty(); + } else { + this.error = Optional.of(error.get()); + } + return this; + } + + /** + *

Latest error returned for a failed swap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

Latest error returned for a failed swap.

+ */ + @java.lang.Override + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public _FinalStage error(Optional error) { + this.error = error; + return this; + } + + @java.lang.Override + public RetrieveSwapsResponse build() { + return new RetrieveSwapsResponse(accountId, error, id, object, status, txHashes, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/RetrieveSwapsResponseObject.java b/src/main/java/com/whop/api/resources/swaps/types/RetrieveSwapsResponseObject.java new file mode 100644 index 00000000..4d7d6d74 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/RetrieveSwapsResponseObject.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveSwapsResponseObject { + public static final RetrieveSwapsResponseObject SWAP = new RetrieveSwapsResponseObject(Value.SWAP, "swap"); + + private final Value value; + + private final String string; + + RetrieveSwapsResponseObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveSwapsResponseObject + && this.string.equals(((RetrieveSwapsResponseObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SWAP: + return visitor.visitSwap(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveSwapsResponseObject valueOf(String value) { + switch (value) { + case "swap": + return SWAP; + default: + return new RetrieveSwapsResponseObject(Value.UNKNOWN, value); + } + } + + public enum Value { + SWAP, + + UNKNOWN + } + + public interface Visitor { + T visitSwap(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/swaps/types/RetrieveSwapsResponseStatus.java b/src/main/java/com/whop/api/resources/swaps/types/RetrieveSwapsResponseStatus.java new file mode 100644 index 00000000..cbfec9e8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/swaps/types/RetrieveSwapsResponseStatus.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.swaps.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveSwapsResponseStatus { + public static final RetrieveSwapsResponseStatus FAILED = new RetrieveSwapsResponseStatus(Value.FAILED, "failed"); + + public static final RetrieveSwapsResponseStatus COMPLETE = + new RetrieveSwapsResponseStatus(Value.COMPLETE, "complete"); + + public static final RetrieveSwapsResponseStatus QUEUED = new RetrieveSwapsResponseStatus(Value.QUEUED, "queued"); + + public static final RetrieveSwapsResponseStatus WORKING = new RetrieveSwapsResponseStatus(Value.WORKING, "working"); + + private final Value value; + + private final String string; + + RetrieveSwapsResponseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveSwapsResponseStatus + && this.string.equals(((RetrieveSwapsResponseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case COMPLETE: + return visitor.visitComplete(); + case QUEUED: + return visitor.visitQueued(); + case WORKING: + return visitor.visitWorking(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveSwapsResponseStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "complete": + return COMPLETE; + case "queued": + return QUEUED; + case "working": + return WORKING; + default: + return new RetrieveSwapsResponseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + QUEUED, + + WORKING, + + COMPLETE, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitQueued(); + + T visitWorking(); + + T visitComplete(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/AsyncRawTeamMembersClient.java b/src/main/java/com/whop/api/resources/teammembers/AsyncRawTeamMembersClient.java new file mode 100644 index 00000000..4ea5a446 --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/AsyncRawTeamMembersClient.java @@ -0,0 +1,550 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.teammembers.requests.CreateTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.DeleteTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.ListTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.RetrieveTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.UpdateTeamMembersRequest; +import com.whop.api.resources.teammembers.types.DeleteTeamMembersResponse; +import com.whop.api.resources.teammembers.types.ListTeamMembersResponse; +import com.whop.api.types.TeamMember; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTeamMembersClient { + protected final ClientOptions clientOptions; + + public AsyncRawTeamMembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists an account's team members, including pending invites (status: "pending", ausri_ ids; user is null for invites sent to an email with no Whop account yet). For accepted members, email requires the company:authorized_user:email:read scope and is null otherwise. Listing role=workforce is also allowed with the bounty:create scope. + */ + public CompletableFuture>> list(ListTeamMembersRequest request) { + return list(request, null); + } + + /** + * Lists an account's team members, including pending invites (status: "pending", ausri_ ids; user is null for invites sent to an email with no Whop account yet). For accepted members, email requires the company:authorized_user:email:read scope and is null otherwise. Listing role=workforce is also allowed with the bounty:create scope. + */ + public CompletableFuture>> list( + ListTeamMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("team_members"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getRole().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "role", request.getRole().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListTeamMembersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListTeamMembersResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListTeamMembersRequest nextRequest = ListTeamMembersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Adds a member to an account's team with a system role. Identify them by exactly one of user_id or email. If the person has not yet accepted — or the email does not belong to a Whop account yet — an invitation is sent instead and the response is 202 with { "object": "team_member_invite", "invitation_sent": true }. If they already have a pending invite, the request fails with a 400. Custom roles cannot be granted via the API. Granting the workforce role is also allowed with the bounty:create scope. + */ + public CompletableFuture> create(CreateTeamMembersRequest request) { + return create(request, null); + } + + /** + * Adds a member to an account's team with a system role. Identify them by exactly one of user_id or email. If the person has not yet accepted — or the email does not belong to a Whop account yet — an invitation is sent instead and the response is 202 with { "object": "team_member_invite", "invitation_sent": true }. If they already have a pending invite, the request fails with a 400. Custom roles cannot be granted via the API. Granting the workforce role is also allowed with the bounty:create scope. + */ + public CompletableFuture> create( + CreateTeamMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("team_members"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, TeamMember.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveTeamMembersRequest.builder().build()); + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveTeamMembersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public CompletableFuture> retrieve(String id, RetrieveTeamMembersRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public CompletableFuture> retrieve( + String id, RetrieveTeamMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("team_members") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, TeamMember.class), response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteTeamMembersRequest.builder().build()); + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public CompletableFuture> delete( + String id, RequestOptions requestOptions) { + return delete(id, DeleteTeamMembersRequest.builder().build(), requestOptions); + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public CompletableFuture> delete( + String id, DeleteTeamMembersRequest request) { + return delete(id, request, null); + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public CompletableFuture> delete( + String id, DeleteTeamMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("team_members") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DeleteTeamMembersResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Changes a team member's system role. Requires a user session — account API keys cannot change member roles. The account owner's role cannot be changed, and you cannot change your own role. + */ + public CompletableFuture> update(String id, UpdateTeamMembersRequest request) { + return update(id, request, null); + } + + /** + * Changes a team member's system role. Requires a user session — account API keys cannot change member roles. The account owner's role cannot be changed, and you cannot change your own role. + */ + public CompletableFuture> update( + String id, UpdateTeamMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("team_members") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, TeamMember.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/AsyncTeamMembersClient.java b/src/main/java/com/whop/api/resources/teammembers/AsyncTeamMembersClient.java new file mode 100644 index 00000000..0729b1ff --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/AsyncTeamMembersClient.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.teammembers.requests.CreateTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.DeleteTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.ListTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.RetrieveTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.UpdateTeamMembersRequest; +import com.whop.api.resources.teammembers.types.DeleteTeamMembersResponse; +import com.whop.api.types.TeamMember; +import java.util.concurrent.CompletableFuture; + +public class AsyncTeamMembersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTeamMembersClient rawClient; + + public AsyncTeamMembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTeamMembersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTeamMembersClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists an account's team members, including pending invites (status: "pending", ausri_ ids; user is null for invites sent to an email with no Whop account yet). For accepted members, email requires the company:authorized_user:email:read scope and is null otherwise. Listing role=workforce is also allowed with the bounty:create scope. + */ + public CompletableFuture> list(ListTeamMembersRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists an account's team members, including pending invites (status: "pending", ausri_ ids; user is null for invites sent to an email with no Whop account yet). For accepted members, email requires the company:authorized_user:email:read scope and is null otherwise. Listing role=workforce is also allowed with the bounty:create scope. + */ + public CompletableFuture> list( + ListTeamMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Adds a member to an account's team with a system role. Identify them by exactly one of user_id or email. If the person has not yet accepted — or the email does not belong to a Whop account yet — an invitation is sent instead and the response is 202 with { "object": "team_member_invite", "invitation_sent": true }. If they already have a pending invite, the request fails with a 400. Custom roles cannot be granted via the API. Granting the workforce role is also allowed with the bounty:create scope. + */ + public CompletableFuture create(CreateTeamMembersRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Adds a member to an account's team with a system role. Identify them by exactly one of user_id or email. If the person has not yet accepted — or the email does not belong to a Whop account yet — an invitation is sent instead and the response is 202 with { "object": "team_member_invite", "invitation_sent": true }. If they already have a pending invite, the request fails with a 400. Custom roles cannot be granted via the API. Granting the workforce role is also allowed with the bounty:create scope. + */ + public CompletableFuture create(CreateTeamMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public CompletableFuture retrieve(String id, RetrieveTeamMembersRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public CompletableFuture retrieve( + String id, RetrieveTeamMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public CompletableFuture delete(String id, DeleteTeamMembersRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public CompletableFuture delete( + String id, DeleteTeamMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Changes a team member's system role. Requires a user session — account API keys cannot change member roles. The account owner's role cannot be changed, and you cannot change your own role. + */ + public CompletableFuture update(String id, UpdateTeamMembersRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Changes a team member's system role. Requires a user session — account API keys cannot change member roles. The account owner's role cannot be changed, and you cannot change your own role. + */ + public CompletableFuture update( + String id, UpdateTeamMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/RawTeamMembersClient.java b/src/main/java/com/whop/api/resources/teammembers/RawTeamMembersClient.java new file mode 100644 index 00000000..711791eb --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/RawTeamMembersClient.java @@ -0,0 +1,444 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.teammembers.requests.CreateTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.DeleteTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.ListTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.RetrieveTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.UpdateTeamMembersRequest; +import com.whop.api.resources.teammembers.types.DeleteTeamMembersResponse; +import com.whop.api.resources.teammembers.types.ListTeamMembersResponse; +import com.whop.api.types.TeamMember; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTeamMembersClient { + protected final ClientOptions clientOptions; + + public RawTeamMembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists an account's team members, including pending invites (status: "pending", ausri_ ids; user is null for invites sent to an email with no Whop account yet). For accepted members, email requires the company:authorized_user:email:read scope and is null otherwise. Listing role=workforce is also allowed with the bounty:create scope. + */ + public WhopApiHttpResponse> list(ListTeamMembersRequest request) { + return list(request, null); + } + + /** + * Lists an account's team members, including pending invites (status: "pending", ausri_ ids; user is null for invites sent to an email with no Whop account yet). For accepted members, email requires the company:authorized_user:email:read scope and is null otherwise. Listing role=workforce is also allowed with the bounty:create scope. + */ + public WhopApiHttpResponse> list( + ListTeamMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("team_members"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "user_id", request.getUserId().get(), false); + } + if (request.getRole().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "role", request.getRole().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListTeamMembersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListTeamMembersResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListTeamMembersRequest nextRequest = ListTeamMembersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Adds a member to an account's team with a system role. Identify them by exactly one of user_id or email. If the person has not yet accepted — or the email does not belong to a Whop account yet — an invitation is sent instead and the response is 202 with { "object": "team_member_invite", "invitation_sent": true }. If they already have a pending invite, the request fails with a 400. Custom roles cannot be granted via the API. Granting the workforce role is also allowed with the bounty:create scope. + */ + public WhopApiHttpResponse create(CreateTeamMembersRequest request) { + return create(request, null); + } + + /** + * Adds a member to an account's team with a system role. Identify them by exactly one of user_id or email. If the person has not yet accepted — or the email does not belong to a Whop account yet — an invitation is sent instead and the response is 202 with { "object": "team_member_invite", "invitation_sent": true }. If they already have a pending invite, the request fails with a 400. Custom roles cannot be granted via the API. Granting the workforce role is also allowed with the bounty:create scope. + */ + public WhopApiHttpResponse create(CreateTeamMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("team_members"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, TeamMember.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveTeamMembersRequest.builder().build()); + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveTeamMembersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveTeamMembersRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveTeamMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("team_members") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, TeamMember.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteTeamMembersRequest.builder().build()); + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteTeamMembersRequest.builder().build(), requestOptions); + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public WhopApiHttpResponse delete(String id, DeleteTeamMembersRequest request) { + return delete(id, request, null); + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public WhopApiHttpResponse delete( + String id, DeleteTeamMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("team_members") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteTeamMembersResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Changes a team member's system role. Requires a user session — account API keys cannot change member roles. The account owner's role cannot be changed, and you cannot change your own role. + */ + public WhopApiHttpResponse update(String id, UpdateTeamMembersRequest request) { + return update(id, request, null); + } + + /** + * Changes a team member's system role. Requires a user session — account API keys cannot change member roles. The account owner's role cannot be changed, and you cannot change your own role. + */ + public WhopApiHttpResponse update( + String id, UpdateTeamMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("team_members") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, TeamMember.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/TeamMembersClient.java b/src/main/java/com/whop/api/resources/teammembers/TeamMembersClient.java new file mode 100644 index 00000000..4f813e31 --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/TeamMembersClient.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.teammembers.requests.CreateTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.DeleteTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.ListTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.RetrieveTeamMembersRequest; +import com.whop.api.resources.teammembers.requests.UpdateTeamMembersRequest; +import com.whop.api.resources.teammembers.types.DeleteTeamMembersResponse; +import com.whop.api.types.TeamMember; + +public class TeamMembersClient { + protected final ClientOptions clientOptions; + + private final RawTeamMembersClient rawClient; + + public TeamMembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTeamMembersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTeamMembersClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists an account's team members, including pending invites (status: "pending", ausri_ ids; user is null for invites sent to an email with no Whop account yet). For accepted members, email requires the company:authorized_user:email:read scope and is null otherwise. Listing role=workforce is also allowed with the bounty:create scope. + */ + public SyncPagingIterable list(ListTeamMembersRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists an account's team members, including pending invites (status: "pending", ausri_ ids; user is null for invites sent to an email with no Whop account yet). For accepted members, email requires the company:authorized_user:email:read scope and is null otherwise. Listing role=workforce is also allowed with the bounty:create scope. + */ + public SyncPagingIterable list(ListTeamMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Adds a member to an account's team with a system role. Identify them by exactly one of user_id or email. If the person has not yet accepted — or the email does not belong to a Whop account yet — an invitation is sent instead and the response is 202 with { "object": "team_member_invite", "invitation_sent": true }. If they already have a pending invite, the request fails with a 400. Custom roles cannot be granted via the API. Granting the workforce role is also allowed with the bounty:create scope. + */ + public TeamMember create(CreateTeamMembersRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Adds a member to an account's team with a system role. Identify them by exactly one of user_id or email. If the person has not yet accepted — or the email does not belong to a Whop account yet — an invitation is sent instead and the response is 202 with { "object": "team_member_invite", "invitation_sent": true }. If they already have a pending invite, the request fails with a 400. Custom roles cannot be granted via the API. Granting the workforce role is also allowed with the bounty:create scope. + */ + public TeamMember create(CreateTeamMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public TeamMember retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public TeamMember retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public TeamMember retrieve(String id, RetrieveTeamMembersRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a team member by ID. email requires the company:authorized_user:email:read scope and is null otherwise. + */ + public TeamMember retrieve(String id, RetrieveTeamMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public DeleteTeamMembersResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public DeleteTeamMembersResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public DeleteTeamMembersResponse delete(String id, DeleteTeamMembersRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Removes a team member from the account, or revokes a pending invite when given an ausri_ ID. A user session may delete its own membership to leave the team without the delete scope. Removing a member on the workforce role is also allowed with the bounty:create scope. The account owner cannot be removed. + */ + public DeleteTeamMembersResponse delete( + String id, DeleteTeamMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Changes a team member's system role. Requires a user session — account API keys cannot change member roles. The account owner's role cannot be changed, and you cannot change your own role. + */ + public TeamMember update(String id, UpdateTeamMembersRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Changes a team member's system role. Requires a user session — account API keys cannot change member roles. The account owner's role cannot be changed, and you cannot change your own role. + */ + public TeamMember update(String id, UpdateTeamMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/requests/CreateTeamMembersRequest.java b/src/main/java/com/whop/api/resources/teammembers/requests/CreateTeamMembersRequest.java new file mode 100644 index 00000000..6932c6a0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/requests/CreateTeamMembersRequest.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.teammembers.types.CreateTeamMembersRequestRole; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTeamMembersRequest.Builder.class) +public final class CreateTeamMembersRequest { + private final String accountId; + + private final Optional email; + + private final CreateTeamMembersRequestRole role; + + private final Optional userId; + + private final Map additionalProperties; + + private CreateTeamMembersRequest( + String accountId, + Optional email, + CreateTeamMembersRequestRole role, + Optional userId, + Map additionalProperties) { + this.accountId = accountId; + this.email = email; + this.role = role; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Email address to invite. Mutually exclusive with user_id. If the email already belongs to a Whop account it is treated the same as passing that account's user_id; otherwise a pending invite is created for the email. + */ + @JsonProperty("email") + public Optional getEmail() { + return email; + } + + /** + * @return The system role to grant. + */ + @JsonProperty("role") + public CreateTeamMembersRequestRole getRole() { + return role; + } + + /** + * @return The user to add to the team, prefixed user_. Mutually exclusive with email. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTeamMembersRequest && equalTo((CreateTeamMembersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTeamMembersRequest other) { + return accountId.equals(other.accountId) + && email.equals(other.email) + && role.equals(other.role) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.email, this.role, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Account ID, prefixed biz_.

+ */ + RoleStage accountId(@NotNull String accountId); + + Builder from(CreateTeamMembersRequest other); + } + + public interface RoleStage { + /** + *

The system role to grant.

+ */ + _FinalStage role(@NotNull CreateTeamMembersRequestRole role); + } + + public interface _FinalStage { + CreateTeamMembersRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Email address to invite. Mutually exclusive with user_id. If the email already belongs to a Whop account it is treated the same as passing that account's user_id; otherwise a pending invite is created for the email.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + /** + *

The user to add to the team, prefixed user_. Mutually exclusive with email.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, RoleStage, _FinalStage { + private String accountId; + + private CreateTeamMembersRequestRole role; + + private Optional userId = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTeamMembersRequest other) { + accountId(other.getAccountId()); + email(other.getEmail()); + role(other.getRole()); + userId(other.getUserId()); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ *

Account ID, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public RoleStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

The system role to grant.

+ *

The system role to grant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("role") + public _FinalStage role(@NotNull CreateTeamMembersRequestRole role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + /** + *

The user to add to the team, prefixed user_. Mutually exclusive with email.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

The user to add to the team, prefixed user_. Mutually exclusive with email.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

Email address to invite. Mutually exclusive with user_id. If the email already belongs to a Whop account it is treated the same as passing that account's user_id; otherwise a pending invite is created for the email.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

Email address to invite. Mutually exclusive with user_id. If the email already belongs to a Whop account it is treated the same as passing that account's user_id; otherwise a pending invite is created for the email.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public CreateTeamMembersRequest build() { + return new CreateTeamMembersRequest(accountId, email, role, userId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/requests/DeleteTeamMembersRequest.java b/src/main/java/com/whop/api/resources/teammembers/requests/DeleteTeamMembersRequest.java new file mode 100644 index 00000000..9a56ade7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/requests/DeleteTeamMembersRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteTeamMembersRequest.Builder.class) +public final class DeleteTeamMembersRequest { + private final Map additionalProperties; + + private DeleteTeamMembersRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteTeamMembersRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteTeamMembersRequest other) { + return this; + } + + public DeleteTeamMembersRequest build() { + return new DeleteTeamMembersRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/requests/ListTeamMembersRequest.java b/src/main/java/com/whop/api/resources/teammembers/requests/ListTeamMembersRequest.java new file mode 100644 index 00000000..f1ff2a1f --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/requests/ListTeamMembersRequest.java @@ -0,0 +1,635 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.teammembers.types.ListTeamMembersRequestDirection; +import com.whop.api.resources.teammembers.types.ListTeamMembersRequestOrder; +import com.whop.api.resources.teammembers.types.ListTeamMembersRequestRole; +import com.whop.api.resources.teammembers.types.ListTeamMembersRequestStatus; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListTeamMembersRequest.Builder.class) +public final class ListTeamMembersRequest { + private final String accountId; + + private final Optional status; + + private final Optional userId; + + private final Optional role; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional order; + + private final Optional direction; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListTeamMembersRequest( + String accountId, + Optional status, + Optional userId, + Optional role, + Optional createdBefore, + Optional createdAfter, + Optional order, + Optional direction, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.accountId = accountId; + this.status = status; + this.userId = userId; + this.role = role; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.order = order; + this.direction = direction; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Only return members with this status: joined (accepted members) or pending (pending invites). Both are returned by default. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Only return the membership for this user ID, prefixed user_. + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + /** + * @return Only return members with this role. custom matches members on a dashboard-managed custom role. + */ + @JsonProperty("role") + public Optional getRole() { + return role; + } + + /** + * @return Only return members added before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return members added after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Field used to sort members. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. Defaults to desc. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Number of members to return. Defaults to 20; maximum 100. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor for the next page of members. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return Number of members to return from the end of the window. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to paginate backwards from. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListTeamMembersRequest && equalTo((ListTeamMembersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListTeamMembersRequest other) { + return accountId.equals(other.accountId) + && status.equals(other.status) + && userId.equals(other.userId) + && role.equals(other.role) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && order.equals(other.order) + && direction.equals(other.direction) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.status, + this.userId, + this.role, + this.createdBefore, + this.createdAfter, + this.order, + this.direction, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Account ID, prefixed biz_.

+ */ + _FinalStage accountId(@NotNull String accountId); + + Builder from(ListTeamMembersRequest other); + } + + public interface _FinalStage { + ListTeamMembersRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Only return members with this status: joined (accepted members) or pending (pending invites). Both are returned by default.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(ListTeamMembersRequestStatus status); + + /** + *

Only return the membership for this user ID, prefixed user_.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + + /** + *

Only return members with this role. custom matches members on a dashboard-managed custom role.

+ */ + _FinalStage role(Optional role); + + _FinalStage role(ListTeamMembersRequestRole role); + + /** + *

Only return members added before this ISO 8601 timestamp.

+ */ + _FinalStage createdBefore(Optional createdBefore); + + _FinalStage createdBefore(String createdBefore); + + /** + *

Only return members added after this ISO 8601 timestamp.

+ */ + _FinalStage createdAfter(Optional createdAfter); + + _FinalStage createdAfter(String createdAfter); + + /** + *

Field used to sort members.

+ */ + _FinalStage order(Optional order); + + _FinalStage order(ListTeamMembersRequestOrder order); + + /** + *

Sort direction. Defaults to desc.

+ */ + _FinalStage direction(Optional direction); + + _FinalStage direction(ListTeamMembersRequestDirection direction); + + /** + *

Number of members to return. Defaults to 20; maximum 100.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Cursor for the next page of members.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Number of members to return from the end of the window.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + /** + *

Cursor to paginate backwards from.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, _FinalStage { + private String accountId; + + private Optional before = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional role = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListTeamMembersRequest other) { + accountId(other.getAccountId()); + status(other.getStatus()); + userId(other.getUserId()); + role(other.getRole()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + order(other.getOrder()); + direction(other.getDirection()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ *

Account ID, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

Cursor to paginate backwards from.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Cursor to paginate backwards from.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Number of members to return from the end of the window.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Number of members to return from the end of the window.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Cursor for the next page of members.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Cursor for the next page of members.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + /** + *

Number of members to return. Defaults to 20; maximum 100.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Number of members to return. Defaults to 20; maximum 100.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Sort direction. Defaults to desc.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage direction(ListTeamMembersRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Sort direction. Defaults to desc.

+ */ + @java.lang.Override + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public _FinalStage direction(Optional direction) { + this.direction = direction; + return this; + } + + /** + *

Field used to sort members.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(ListTeamMembersRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Field used to sort members.

+ */ + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + /** + *

Only return members added after this ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only return members added after this ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public _FinalStage createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + /** + *

Only return members added before this ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return members added before this ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public _FinalStage createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + /** + *

Only return members with this role. custom matches members on a dashboard-managed custom role.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage role(ListTeamMembersRequestRole role) { + this.role = Optional.ofNullable(role); + return this; + } + + /** + *

Only return members with this role. custom matches members on a dashboard-managed custom role.

+ */ + @java.lang.Override + @JsonSetter(value = "role", nulls = Nulls.SKIP) + public _FinalStage role(Optional role) { + this.role = role; + return this; + } + + /** + *

Only return the membership for this user ID, prefixed user_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

Only return the membership for this user ID, prefixed user_.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

Only return members with this status: joined (accepted members) or pending (pending invites). Both are returned by default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(ListTeamMembersRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Only return members with this status: joined (accepted members) or pending (pending invites). Both are returned by default.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + @java.lang.Override + public ListTeamMembersRequest build() { + return new ListTeamMembersRequest( + accountId, + status, + userId, + role, + createdBefore, + createdAfter, + order, + direction, + first, + after, + last, + before, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/requests/RetrieveTeamMembersRequest.java b/src/main/java/com/whop/api/resources/teammembers/requests/RetrieveTeamMembersRequest.java new file mode 100644 index 00000000..94612cb4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/requests/RetrieveTeamMembersRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveTeamMembersRequest.Builder.class) +public final class RetrieveTeamMembersRequest { + private final Map additionalProperties; + + private RetrieveTeamMembersRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveTeamMembersRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveTeamMembersRequest other) { + return this; + } + + public RetrieveTeamMembersRequest build() { + return new RetrieveTeamMembersRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/requests/UpdateTeamMembersRequest.java b/src/main/java/com/whop/api/resources/teammembers/requests/UpdateTeamMembersRequest.java new file mode 100644 index 00000000..dd1f67fc --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/requests/UpdateTeamMembersRequest.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.teammembers.types.UpdateTeamMembersRequestRole; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateTeamMembersRequest.Builder.class) +public final class UpdateTeamMembersRequest { + private final UpdateTeamMembersRequestRole role; + + private final Map additionalProperties; + + private UpdateTeamMembersRequest(UpdateTeamMembersRequestRole role, Map additionalProperties) { + this.role = role; + this.additionalProperties = additionalProperties; + } + + /** + * @return The system role to grant. + */ + @JsonProperty("role") + public UpdateTeamMembersRequestRole getRole() { + return role; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateTeamMembersRequest && equalTo((UpdateTeamMembersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateTeamMembersRequest other) { + return role.equals(other.role); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.role); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RoleStage builder() { + return new Builder(); + } + + public interface RoleStage { + /** + *

The system role to grant.

+ */ + _FinalStage role(@NotNull UpdateTeamMembersRequestRole role); + + Builder from(UpdateTeamMembersRequest other); + } + + public interface _FinalStage { + UpdateTeamMembersRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RoleStage, _FinalStage { + private UpdateTeamMembersRequestRole role; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateTeamMembersRequest other) { + role(other.getRole()); + return this; + } + + /** + *

The system role to grant.

+ *

The system role to grant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("role") + public _FinalStage role(@NotNull UpdateTeamMembersRequestRole role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + @java.lang.Override + public UpdateTeamMembersRequest build() { + return new UpdateTeamMembersRequest(role, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/types/CreateTeamMembersRequestRole.java b/src/main/java/com/whop/api/resources/teammembers/types/CreateTeamMembersRequestRole.java new file mode 100644 index 00000000..34a49994 --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/types/CreateTeamMembersRequestRole.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateTeamMembersRequestRole { + public static final CreateTeamMembersRequestRole OWNER = new CreateTeamMembersRequestRole(Value.OWNER, "owner"); + + public static final CreateTeamMembersRequestRole WORKFORCE = + new CreateTeamMembersRequestRole(Value.WORKFORCE, "workforce"); + + public static final CreateTeamMembersRequestRole ADMIN = new CreateTeamMembersRequestRole(Value.ADMIN, "admin"); + + public static final CreateTeamMembersRequestRole SALES_MANAGER = + new CreateTeamMembersRequestRole(Value.SALES_MANAGER, "sales_manager"); + + public static final CreateTeamMembersRequestRole MODERATOR = + new CreateTeamMembersRequestRole(Value.MODERATOR, "moderator"); + + public static final CreateTeamMembersRequestRole ADVERTISER = + new CreateTeamMembersRequestRole(Value.ADVERTISER, "advertiser"); + + private final Value value; + + private final String string; + + CreateTeamMembersRequestRole(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateTeamMembersRequestRole + && this.string.equals(((CreateTeamMembersRequestRole) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case OWNER: + return visitor.visitOwner(); + case WORKFORCE: + return visitor.visitWorkforce(); + case ADMIN: + return visitor.visitAdmin(); + case SALES_MANAGER: + return visitor.visitSalesManager(); + case MODERATOR: + return visitor.visitModerator(); + case ADVERTISER: + return visitor.visitAdvertiser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateTeamMembersRequestRole valueOf(String value) { + switch (value) { + case "owner": + return OWNER; + case "workforce": + return WORKFORCE; + case "admin": + return ADMIN; + case "sales_manager": + return SALES_MANAGER; + case "moderator": + return MODERATOR; + case "advertiser": + return ADVERTISER; + default: + return new CreateTeamMembersRequestRole(Value.UNKNOWN, value); + } + } + + public enum Value { + OWNER, + + ADMIN, + + SALES_MANAGER, + + MODERATOR, + + ADVERTISER, + + WORKFORCE, + + UNKNOWN + } + + public interface Visitor { + T visitOwner(); + + T visitAdmin(); + + T visitSalesManager(); + + T visitModerator(); + + T visitAdvertiser(); + + T visitWorkforce(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/types/DeleteTeamMembersResponse.java b/src/main/java/com/whop/api/resources/teammembers/types/DeleteTeamMembersResponse.java new file mode 100644 index 00000000..6442039a --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/types/DeleteTeamMembersResponse.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteTeamMembersResponse.Builder.class) +public final class DeleteTeamMembersResponse { + private final boolean success; + + private final Map additionalProperties; + + private DeleteTeamMembersResponse(boolean success, Map additionalProperties) { + this.success = success; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("success") + public boolean getSuccess() { + return success; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteTeamMembersResponse && equalTo((DeleteTeamMembersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteTeamMembersResponse other) { + return success == other.success; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.success); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SuccessStage builder() { + return new Builder(); + } + + public interface SuccessStage { + _FinalStage success(boolean success); + + Builder from(DeleteTeamMembersResponse other); + } + + public interface _FinalStage { + DeleteTeamMembersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SuccessStage, _FinalStage { + private boolean success; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeleteTeamMembersResponse other) { + success(other.getSuccess()); + return this; + } + + @java.lang.Override + @JsonSetter("success") + public _FinalStage success(boolean success) { + this.success = success; + return this; + } + + @java.lang.Override + public DeleteTeamMembersResponse build() { + return new DeleteTeamMembersResponse(success, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersRequestDirection.java b/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersRequestDirection.java new file mode 100644 index 00000000..bb8eca89 --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListTeamMembersRequestDirection { + public static final ListTeamMembersRequestDirection ASC = new ListTeamMembersRequestDirection(Value.ASC, "asc"); + + public static final ListTeamMembersRequestDirection DESC = new ListTeamMembersRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListTeamMembersRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListTeamMembersRequestDirection + && this.string.equals(((ListTeamMembersRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListTeamMembersRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListTeamMembersRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersRequestOrder.java b/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersRequestOrder.java new file mode 100644 index 00000000..bc1889cf --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersRequestOrder.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListTeamMembersRequestOrder { + public static final ListTeamMembersRequestOrder CREATED_AT = + new ListTeamMembersRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListTeamMembersRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListTeamMembersRequestOrder + && this.string.equals(((ListTeamMembersRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListTeamMembersRequestOrder valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + default: + return new ListTeamMembersRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersRequestRole.java b/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersRequestRole.java new file mode 100644 index 00000000..d41b50ac --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersRequestRole.java @@ -0,0 +1,169 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListTeamMembersRequestRole { + public static final ListTeamMembersRequestRole APP_MANAGER = + new ListTeamMembersRequestRole(Value.APP_MANAGER, "app_manager"); + + public static final ListTeamMembersRequestRole OWNER = new ListTeamMembersRequestRole(Value.OWNER, "owner"); + + public static final ListTeamMembersRequestRole WORKFORCE = + new ListTeamMembersRequestRole(Value.WORKFORCE, "workforce"); + + public static final ListTeamMembersRequestRole ADMIN = new ListTeamMembersRequestRole(Value.ADMIN, "admin"); + + public static final ListTeamMembersRequestRole SUPPORT = new ListTeamMembersRequestRole(Value.SUPPORT, "support"); + + public static final ListTeamMembersRequestRole CUSTOM = new ListTeamMembersRequestRole(Value.CUSTOM, "custom"); + + public static final ListTeamMembersRequestRole SALES_MANAGER = + new ListTeamMembersRequestRole(Value.SALES_MANAGER, "sales_manager"); + + public static final ListTeamMembersRequestRole MANAGER = new ListTeamMembersRequestRole(Value.MANAGER, "manager"); + + public static final ListTeamMembersRequestRole MODERATOR = + new ListTeamMembersRequestRole(Value.MODERATOR, "moderator"); + + public static final ListTeamMembersRequestRole ADVERTISER = + new ListTeamMembersRequestRole(Value.ADVERTISER, "advertiser"); + + private final Value value; + + private final String string; + + ListTeamMembersRequestRole(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListTeamMembersRequestRole + && this.string.equals(((ListTeamMembersRequestRole) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APP_MANAGER: + return visitor.visitAppManager(); + case OWNER: + return visitor.visitOwner(); + case WORKFORCE: + return visitor.visitWorkforce(); + case ADMIN: + return visitor.visitAdmin(); + case SUPPORT: + return visitor.visitSupport(); + case CUSTOM: + return visitor.visitCustom(); + case SALES_MANAGER: + return visitor.visitSalesManager(); + case MANAGER: + return visitor.visitManager(); + case MODERATOR: + return visitor.visitModerator(); + case ADVERTISER: + return visitor.visitAdvertiser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListTeamMembersRequestRole valueOf(String value) { + switch (value) { + case "app_manager": + return APP_MANAGER; + case "owner": + return OWNER; + case "workforce": + return WORKFORCE; + case "admin": + return ADMIN; + case "support": + return SUPPORT; + case "custom": + return CUSTOM; + case "sales_manager": + return SALES_MANAGER; + case "manager": + return MANAGER; + case "moderator": + return MODERATOR; + case "advertiser": + return ADVERTISER; + default: + return new ListTeamMembersRequestRole(Value.UNKNOWN, value); + } + } + + public enum Value { + OWNER, + + ADMIN, + + SALES_MANAGER, + + MODERATOR, + + ADVERTISER, + + APP_MANAGER, + + SUPPORT, + + MANAGER, + + WORKFORCE, + + CUSTOM, + + UNKNOWN + } + + public interface Visitor { + T visitOwner(); + + T visitAdmin(); + + T visitSalesManager(); + + T visitModerator(); + + T visitAdvertiser(); + + T visitAppManager(); + + T visitSupport(); + + T visitManager(); + + T visitWorkforce(); + + T visitCustom(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersRequestStatus.java b/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersRequestStatus.java new file mode 100644 index 00000000..dbd6b2a0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersRequestStatus.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListTeamMembersRequestStatus { + public static final ListTeamMembersRequestStatus PENDING = + new ListTeamMembersRequestStatus(Value.PENDING, "pending"); + + public static final ListTeamMembersRequestStatus JOINED = new ListTeamMembersRequestStatus(Value.JOINED, "joined"); + + private final Value value; + + private final String string; + + ListTeamMembersRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListTeamMembersRequestStatus + && this.string.equals(((ListTeamMembersRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case JOINED: + return visitor.visitJoined(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListTeamMembersRequestStatus valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "joined": + return JOINED; + default: + return new ListTeamMembersRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + JOINED, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitJoined(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersResponse.java b/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersResponse.java new file mode 100644 index 00000000..73c43936 --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.TeamMember; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListTeamMembersResponse.Builder.class) +public final class ListTeamMembersResponse { + private final List data; + + private final ListTeamMembersResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListTeamMembersResponse( + List data, ListTeamMembersResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListTeamMembersResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListTeamMembersResponse && equalTo((ListTeamMembersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListTeamMembersResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListTeamMembersResponsePageInfo pageInfo); + + Builder from(ListTeamMembersResponse other); + } + + public interface _FinalStage { + ListTeamMembersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(TeamMember data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListTeamMembersResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListTeamMembersResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListTeamMembersResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(TeamMember data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListTeamMembersResponse build() { + return new ListTeamMembersResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersResponsePageInfo.java b/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersResponsePageInfo.java new file mode 100644 index 00000000..4fd4f47a --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/types/ListTeamMembersResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListTeamMembersResponsePageInfo.Builder.class) +public final class ListTeamMembersResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListTeamMembersResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListTeamMembersResponsePageInfo && equalTo((ListTeamMembersResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListTeamMembersResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListTeamMembersResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListTeamMembersResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListTeamMembersResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListTeamMembersResponsePageInfo build() { + return new ListTeamMembersResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/teammembers/types/UpdateTeamMembersRequestRole.java b/src/main/java/com/whop/api/resources/teammembers/types/UpdateTeamMembersRequestRole.java new file mode 100644 index 00000000..31743b0c --- /dev/null +++ b/src/main/java/com/whop/api/resources/teammembers/types/UpdateTeamMembersRequestRole.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.teammembers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateTeamMembersRequestRole { + public static final UpdateTeamMembersRequestRole OWNER = new UpdateTeamMembersRequestRole(Value.OWNER, "owner"); + + public static final UpdateTeamMembersRequestRole WORKFORCE = + new UpdateTeamMembersRequestRole(Value.WORKFORCE, "workforce"); + + public static final UpdateTeamMembersRequestRole ADMIN = new UpdateTeamMembersRequestRole(Value.ADMIN, "admin"); + + public static final UpdateTeamMembersRequestRole SALES_MANAGER = + new UpdateTeamMembersRequestRole(Value.SALES_MANAGER, "sales_manager"); + + public static final UpdateTeamMembersRequestRole MODERATOR = + new UpdateTeamMembersRequestRole(Value.MODERATOR, "moderator"); + + public static final UpdateTeamMembersRequestRole ADVERTISER = + new UpdateTeamMembersRequestRole(Value.ADVERTISER, "advertiser"); + + private final Value value; + + private final String string; + + UpdateTeamMembersRequestRole(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateTeamMembersRequestRole + && this.string.equals(((UpdateTeamMembersRequestRole) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case OWNER: + return visitor.visitOwner(); + case WORKFORCE: + return visitor.visitWorkforce(); + case ADMIN: + return visitor.visitAdmin(); + case SALES_MANAGER: + return visitor.visitSalesManager(); + case MODERATOR: + return visitor.visitModerator(); + case ADVERTISER: + return visitor.visitAdvertiser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateTeamMembersRequestRole valueOf(String value) { + switch (value) { + case "owner": + return OWNER; + case "workforce": + return WORKFORCE; + case "admin": + return ADMIN; + case "sales_manager": + return SALES_MANAGER; + case "moderator": + return MODERATOR; + case "advertiser": + return ADVERTISER; + default: + return new UpdateTeamMembersRequestRole(Value.UNKNOWN, value); + } + } + + public enum Value { + OWNER, + + ADMIN, + + SALES_MANAGER, + + MODERATOR, + + ADVERTISER, + + WORKFORCE, + + UNKNOWN + } + + public interface Visitor { + T visitOwner(); + + T visitAdmin(); + + T visitSalesManager(); + + T visitModerator(); + + T visitAdvertiser(); + + T visitWorkforce(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/topups/AsyncRawTopupsClient.java b/src/main/java/com/whop/api/resources/topups/AsyncRawTopupsClient.java new file mode 100644 index 00000000..ffb806b6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/topups/AsyncRawTopupsClient.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.topups; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.topups.requests.CreateTopupsRequest; +import com.whop.api.types.Topup; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTopupsClient { + protected final ClientOptions clientOptions; + + public AsyncRawTopupsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Add funds to a company's platform balance by charging a stored payment method. Top-ups have no fees or taxes and do not count as revenue. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
+ */ + public CompletableFuture> create(CreateTopupsRequest request) { + return create(request, null); + } + + /** + * Add funds to a company's platform balance by charging a stored payment method. Top-ups have no fees or taxes and do not count as revenue. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
+ */ + public CompletableFuture> create( + CreateTopupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("topups"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Topup.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/topups/AsyncTopupsClient.java b/src/main/java/com/whop/api/resources/topups/AsyncTopupsClient.java new file mode 100644 index 00000000..4788d24a --- /dev/null +++ b/src/main/java/com/whop/api/resources/topups/AsyncTopupsClient.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.topups; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.topups.requests.CreateTopupsRequest; +import com.whop.api.types.Topup; +import java.util.concurrent.CompletableFuture; + +public class AsyncTopupsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTopupsClient rawClient; + + public AsyncTopupsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTopupsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTopupsClient withRawResponse() { + return this.rawClient; + } + + /** + * Add funds to a company's platform balance by charging a stored payment method. Top-ups have no fees or taxes and do not count as revenue. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
+ */ + public CompletableFuture create(CreateTopupsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Add funds to a company's platform balance by charging a stored payment method. Top-ups have no fees or taxes and do not count as revenue. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
+ */ + public CompletableFuture create(CreateTopupsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/topups/RawTopupsClient.java b/src/main/java/com/whop/api/resources/topups/RawTopupsClient.java new file mode 100644 index 00000000..7fc8163b --- /dev/null +++ b/src/main/java/com/whop/api/resources/topups/RawTopupsClient.java @@ -0,0 +1,125 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.topups; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.topups.requests.CreateTopupsRequest; +import com.whop.api.types.Topup; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTopupsClient { + protected final ClientOptions clientOptions; + + public RawTopupsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Add funds to a company's platform balance by charging a stored payment method. Top-ups have no fees or taxes and do not count as revenue. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
+ */ + public WhopApiHttpResponse create(CreateTopupsRequest request) { + return create(request, null); + } + + /** + * Add funds to a company's platform balance by charging a stored payment method. Top-ups have no fees or taxes and do not count as revenue. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
+ */ + public WhopApiHttpResponse create(CreateTopupsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("topups"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Topup.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/topups/TopupsClient.java b/src/main/java/com/whop/api/resources/topups/TopupsClient.java new file mode 100644 index 00000000..a01b2cd2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/topups/TopupsClient.java @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.topups; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.topups.requests.CreateTopupsRequest; +import com.whop.api.types.Topup; + +public class TopupsClient { + protected final ClientOptions clientOptions; + + private final RawTopupsClient rawClient; + + public TopupsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTopupsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTopupsClient withRawResponse() { + return this.rawClient; + } + + /** + * Add funds to a company's platform balance by charging a stored payment method. Top-ups have no fees or taxes and do not count as revenue. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
+ */ + public Topup create(CreateTopupsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Add funds to a company's platform balance by charging a stored payment method. Top-ups have no fees or taxes and do not count as revenue. + *

Required permissions:

+ *
    + *
  • payment:charge
  • + *
+ */ + public Topup create(CreateTopupsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/topups/requests/CreateTopupsRequest.java b/src/main/java/com/whop/api/resources/topups/requests/CreateTopupsRequest.java new file mode 100644 index 00000000..a207b468 --- /dev/null +++ b/src/main/java/com/whop/api/resources/topups/requests/CreateTopupsRequest.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.topups.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Currencies; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTopupsRequest.Builder.class) +public final class CreateTopupsRequest { + private final double amount; + + private final String companyId; + + private final Currencies currency; + + private final String paymentMethodId; + + private final Map additionalProperties; + + private CreateTopupsRequest( + double amount, + String companyId, + Currencies currency, + String paymentMethodId, + Map additionalProperties) { + this.amount = amount; + this.companyId = companyId; + this.currency = currency; + this.paymentMethodId = paymentMethodId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The amount to add to the balance in the specified currency. For example, 50.00 for $50.00 USD. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The unique identifier of the company to add funds to, starting with 'biz_'. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return The currency for the top-up amount, such as 'usd'. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The unique identifier of the stored payment method to charge for the top-up. + */ + @JsonProperty("payment_method_id") + public String getPaymentMethodId() { + return paymentMethodId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTopupsRequest && equalTo((CreateTopupsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTopupsRequest other) { + return amount == other.amount + && companyId.equals(other.companyId) + && currency.equals(other.currency) + && paymentMethodId.equals(other.paymentMethodId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.companyId, this.currency, this.paymentMethodId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The amount to add to the balance in the specified currency. For example, 50.00 for $50.00 USD.

+ */ + CompanyIdStage amount(double amount); + + Builder from(CreateTopupsRequest other); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to add funds to, starting with 'biz_'.

+ */ + CurrencyStage companyId(@NotNull String companyId); + } + + public interface CurrencyStage { + /** + *

The currency for the top-up amount, such as 'usd'.

+ */ + PaymentMethodIdStage currency(@NotNull Currencies currency); + } + + public interface PaymentMethodIdStage { + /** + *

The unique identifier of the stored payment method to charge for the top-up.

+ */ + _FinalStage paymentMethodId(@NotNull String paymentMethodId); + } + + public interface _FinalStage { + CreateTopupsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, CompanyIdStage, CurrencyStage, PaymentMethodIdStage, _FinalStage { + private double amount; + + private String companyId; + + private Currencies currency; + + private String paymentMethodId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTopupsRequest other) { + amount(other.getAmount()); + companyId(other.getCompanyId()); + currency(other.getCurrency()); + paymentMethodId(other.getPaymentMethodId()); + return this; + } + + /** + *

The amount to add to the balance in the specified currency. For example, 50.00 for $50.00 USD.

+ *

The amount to add to the balance in the specified currency. For example, 50.00 for $50.00 USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CompanyIdStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The unique identifier of the company to add funds to, starting with 'biz_'.

+ *

The unique identifier of the company to add funds to, starting with 'biz_'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public CurrencyStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The currency for the top-up amount, such as 'usd'.

+ *

The currency for the top-up amount, such as 'usd'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public PaymentMethodIdStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier of the stored payment method to charge for the top-up.

+ *

The unique identifier of the stored payment method to charge for the top-up.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_id") + public _FinalStage paymentMethodId(@NotNull String paymentMethodId) { + this.paymentMethodId = Objects.requireNonNull(paymentMethodId, "paymentMethodId must not be null"); + return this; + } + + @java.lang.Override + public CreateTopupsRequest build() { + return new CreateTopupsRequest(amount, companyId, currency, paymentMethodId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/AsyncRawTransfersClient.java b/src/main/java/com/whop/api/resources/transfers/AsyncRawTransfersClient.java new file mode 100644 index 00000000..865d2e0d --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/AsyncRawTransfersClient.java @@ -0,0 +1,494 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.transfers.requests.CreateTransfersRequest; +import com.whop.api.resources.transfers.requests.ListRecipientsTransfersRequest; +import com.whop.api.resources.transfers.requests.ListTransfersRequest; +import com.whop.api.resources.transfers.requests.RetrieveTransfersRequest; +import com.whop.api.resources.transfers.types.CreateTransfersResponse; +import com.whop.api.resources.transfers.types.ListRecipientsTransfersResponse; +import com.whop.api.resources.transfers.types.ListRecipientsTransfersResponseDataItem; +import com.whop.api.resources.transfers.types.ListTransfersResponse; +import com.whop.api.resources.transfers.types.ListTransfersResponseDataItem; +import com.whop.api.resources.transfers.types.RetrieveTransfersResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTransfersClient { + protected final ClientOptions clientOptions; + + public AsyncRawTransfersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists an account's transfers. + */ + public CompletableFuture>> list() { + return list(ListTransfersRequest.builder().build()); + } + + /** + * Lists an account's transfers. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListTransfersRequest.builder().build(), requestOptions); + } + + /** + * Lists an account's transfers. + */ + public CompletableFuture>> list( + ListTransfersRequest request) { + return list(request, null); + } + + /** + * Lists an account's transfers. + */ + public CompletableFuture>> list( + ListTransfersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("transfers"); + if (request.getOriginId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "origin_id", request.getOriginId().get(), false); + } + if (request.getDestinationId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "destination_id", request.getDestinationId().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListTransfersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListTransfersResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListTransfersRequest nextRequest = ListTransfersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Moves money between accounts, or into a claim link anyone with the URL can redeem. + */ + public CompletableFuture> create(CreateTransfersRequest request) { + return create(request, null); + } + + /** + * Moves money between accounts, or into a claim link anyone with the URL can redeem. + */ + public CompletableFuture> create( + CreateTransfersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("transfers"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateTransfersResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Lists the people and accounts you can send money to. + */ + public CompletableFuture>> + listRecipients(ListRecipientsTransfersRequest request) { + return listRecipients(request, null); + } + + /** + * Lists the people and accounts you can send money to. + */ + public CompletableFuture>> + listRecipients(ListRecipientsTransfersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("transfers/recipients"); + QueryStringMapper.addQueryParameter(httpUrl, "origin_id", request.getOriginId(), false); + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListRecipientsTransfersResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListRecipientsTransfersResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListRecipientsTransfersRequest nextRequest = ListRecipientsTransfersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return listRecipients(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a single transfer. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveTransfersRequest.builder().build()); + } + + /** + * Retrieves a single transfer. + */ + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveTransfersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single transfer. + */ + public CompletableFuture> retrieve( + String id, RetrieveTransfersRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single transfer. + */ + public CompletableFuture> retrieve( + String id, RetrieveTransfersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("transfers") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, RetrieveTransfersResponse.class), + response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/AsyncTransfersClient.java b/src/main/java/com/whop/api/resources/transfers/AsyncTransfersClient.java new file mode 100644 index 00000000..dc974e04 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/AsyncTransfersClient.java @@ -0,0 +1,124 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.transfers.requests.CreateTransfersRequest; +import com.whop.api.resources.transfers.requests.ListRecipientsTransfersRequest; +import com.whop.api.resources.transfers.requests.ListTransfersRequest; +import com.whop.api.resources.transfers.requests.RetrieveTransfersRequest; +import com.whop.api.resources.transfers.types.CreateTransfersResponse; +import com.whop.api.resources.transfers.types.ListRecipientsTransfersResponseDataItem; +import com.whop.api.resources.transfers.types.ListTransfersResponseDataItem; +import com.whop.api.resources.transfers.types.RetrieveTransfersResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncTransfersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTransfersClient rawClient; + + public AsyncTransfersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTransfersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTransfersClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists an account's transfers. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists an account's transfers. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists an account's transfers. + */ + public CompletableFuture> list(ListTransfersRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists an account's transfers. + */ + public CompletableFuture> list( + ListTransfersRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Moves money between accounts, or into a claim link anyone with the URL can redeem. + */ + public CompletableFuture create(CreateTransfersRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Moves money between accounts, or into a claim link anyone with the URL can redeem. + */ + public CompletableFuture create( + CreateTransfersRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the people and accounts you can send money to. + */ + public CompletableFuture> listRecipients( + ListRecipientsTransfersRequest request) { + return this.rawClient.listRecipients(request).thenApply(response -> response.body()); + } + + /** + * Lists the people and accounts you can send money to. + */ + public CompletableFuture> listRecipients( + ListRecipientsTransfersRequest request, RequestOptions requestOptions) { + return this.rawClient.listRecipients(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single transfer. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a single transfer. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a single transfer. + */ + public CompletableFuture retrieve(String id, RetrieveTransfersRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a single transfer. + */ + public CompletableFuture retrieve( + String id, RetrieveTransfersRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/RawTransfersClient.java b/src/main/java/com/whop/api/resources/transfers/RawTransfersClient.java new file mode 100644 index 00000000..e484d6e4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/RawTransfersClient.java @@ -0,0 +1,398 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.transfers.requests.CreateTransfersRequest; +import com.whop.api.resources.transfers.requests.ListRecipientsTransfersRequest; +import com.whop.api.resources.transfers.requests.ListTransfersRequest; +import com.whop.api.resources.transfers.requests.RetrieveTransfersRequest; +import com.whop.api.resources.transfers.types.CreateTransfersResponse; +import com.whop.api.resources.transfers.types.ListRecipientsTransfersResponse; +import com.whop.api.resources.transfers.types.ListRecipientsTransfersResponseDataItem; +import com.whop.api.resources.transfers.types.ListTransfersResponse; +import com.whop.api.resources.transfers.types.ListTransfersResponseDataItem; +import com.whop.api.resources.transfers.types.RetrieveTransfersResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTransfersClient { + protected final ClientOptions clientOptions; + + public RawTransfersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists an account's transfers. + */ + public WhopApiHttpResponse> list() { + return list(ListTransfersRequest.builder().build()); + } + + /** + * Lists an account's transfers. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListTransfersRequest.builder().build(), requestOptions); + } + + /** + * Lists an account's transfers. + */ + public WhopApiHttpResponse> list(ListTransfersRequest request) { + return list(request, null); + } + + /** + * Lists an account's transfers. + */ + public WhopApiHttpResponse> list( + ListTransfersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("transfers"); + if (request.getOriginId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "origin_id", request.getOriginId().get(), false); + } + if (request.getDestinationId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "destination_id", request.getDestinationId().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListTransfersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListTransfersResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListTransfersRequest nextRequest = ListTransfersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Moves money between accounts, or into a claim link anyone with the URL can redeem. + */ + public WhopApiHttpResponse create(CreateTransfersRequest request) { + return create(request, null); + } + + /** + * Moves money between accounts, or into a claim link anyone with the URL can redeem. + */ + public WhopApiHttpResponse create( + CreateTransfersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("transfers"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateTransfersResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Lists the people and accounts you can send money to. + */ + public WhopApiHttpResponse> listRecipients( + ListRecipientsTransfersRequest request) { + return listRecipients(request, null); + } + + /** + * Lists the people and accounts you can send money to. + */ + public WhopApiHttpResponse> listRecipients( + ListRecipientsTransfersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("transfers/recipients"); + QueryStringMapper.addQueryParameter(httpUrl, "origin_id", request.getOriginId(), false); + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListRecipientsTransfersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListRecipientsTransfersResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListRecipientsTransfersRequest nextRequest = ListRecipientsTransfersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> listRecipients( + nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a single transfer. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveTransfersRequest.builder().build()); + } + + /** + * Retrieves a single transfer. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveTransfersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a single transfer. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveTransfersRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a single transfer. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveTransfersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("transfers") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrieveTransfersResponse.class), + response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/TransfersClient.java b/src/main/java/com/whop/api/resources/transfers/TransfersClient.java new file mode 100644 index 00000000..60bbe366 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/TransfersClient.java @@ -0,0 +1,122 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.transfers.requests.CreateTransfersRequest; +import com.whop.api.resources.transfers.requests.ListRecipientsTransfersRequest; +import com.whop.api.resources.transfers.requests.ListTransfersRequest; +import com.whop.api.resources.transfers.requests.RetrieveTransfersRequest; +import com.whop.api.resources.transfers.types.CreateTransfersResponse; +import com.whop.api.resources.transfers.types.ListRecipientsTransfersResponseDataItem; +import com.whop.api.resources.transfers.types.ListTransfersResponseDataItem; +import com.whop.api.resources.transfers.types.RetrieveTransfersResponse; + +public class TransfersClient { + protected final ClientOptions clientOptions; + + private final RawTransfersClient rawClient; + + public TransfersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTransfersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTransfersClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists an account's transfers. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists an account's transfers. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists an account's transfers. + */ + public SyncPagingIterable list(ListTransfersRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists an account's transfers. + */ + public SyncPagingIterable list( + ListTransfersRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Moves money between accounts, or into a claim link anyone with the URL can redeem. + */ + public CreateTransfersResponse create(CreateTransfersRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Moves money between accounts, or into a claim link anyone with the URL can redeem. + */ + public CreateTransfersResponse create(CreateTransfersRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Lists the people and accounts you can send money to. + */ + public SyncPagingIterable listRecipients( + ListRecipientsTransfersRequest request) { + return this.rawClient.listRecipients(request).body(); + } + + /** + * Lists the people and accounts you can send money to. + */ + public SyncPagingIterable listRecipients( + ListRecipientsTransfersRequest request, RequestOptions requestOptions) { + return this.rawClient.listRecipients(request, requestOptions).body(); + } + + /** + * Retrieves a single transfer. + */ + public RetrieveTransfersResponse retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a single transfer. + */ + public RetrieveTransfersResponse retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a single transfer. + */ + public RetrieveTransfersResponse retrieve(String id, RetrieveTransfersRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a single transfer. + */ + public RetrieveTransfersResponse retrieve( + String id, RetrieveTransfersRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/requests/CreateTransfersRequest.java b/src/main/java/com/whop/api/resources/transfers/requests/CreateTransfersRequest.java new file mode 100644 index 00000000..f5bdc62b --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/requests/CreateTransfersRequest.java @@ -0,0 +1,646 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.transfers.types.CreateTransfersRequestType; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTransfersRequest.Builder.class) +public final class CreateTransfersRequest { + private final double amount; + + private final Optional currency; + + private final Optional destinationId; + + private final Optional expiresAt; + + private final Optional idempotenceKey; + + private final Optional> metadata; + + private final Optional notes; + + private final String originId; + + private final Optional redeemableCount; + + private final Optional type; + + private final Map additionalProperties; + + private CreateTransfersRequest( + double amount, + Optional currency, + Optional destinationId, + Optional expiresAt, + Optional idempotenceKey, + Optional> metadata, + Optional notes, + String originId, + Optional redeemableCount, + Optional type, + Map additionalProperties) { + this.amount = amount; + this.currency = currency; + this.destinationId = destinationId; + this.expiresAt = expiresAt; + this.idempotenceKey = idempotenceKey; + this.metadata = metadata; + this.notes = notes; + this.originId = originId; + this.redeemableCount = redeemableCount; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The amount to move, in the transfer currency. For example 25.00. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return Currency, such as usd. Required for ledger transfers. + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + /** + * @return The recipient. Required for ledger and wallet_send (a user_/biz_/ldgr_ ID, or — for sends — an email). Omit for claim_link. + */ + @JsonProperty("destination_id") + public Optional getDestinationId() { + return destinationId; + } + + /** + * @return claim_link only. Link expiry as an ISO 8601 timestamp. Defaults to 24 hours from creation. + */ + @JsonIgnore + public Optional getExpiresAt() { + if (expiresAt == null) { + return Optional.empty(); + } + return expiresAt; + } + + /** + * @return Ledger transfers and wallet sends. A unique key that makes retries safe. Retrying with the same key returns the original transfer, or attaches to the original wallet send, instead of moving money twice. + */ + @JsonIgnore + public Optional getIdempotenceKey() { + if (idempotenceKey == null) { + return Optional.empty(); + } + return idempotenceKey; + } + + /** + * @return Ledger transfers only. Custom key-value pairs attached to the transfer. Max 50 keys, 100 chars per key, 500 chars per string value. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Ledger transfers only. A short note describing the transfer. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + /** + * @return The account sending the funds. A user ID (user_xxx), account ID (biz_xxx), or ledger account ID (ldgr_xxx). + */ + @JsonProperty("origin_id") + public String getOriginId() { + return originId; + } + + /** + * @return claim_link only. How many different users can claim the link. Defaults to 1. + */ + @JsonProperty("redeemable_count") + public Optional getRedeemableCount() { + return redeemableCount; + } + + /** + * @return The kind of money movement, which decides what comes back. Defaults to ledger. ledger moves credit between two Whop balances and returns a transfer; wallet_send sends USDT from the origin account's Ethereum wallet and returns a send; claim_link funds a shareable link anyone with the URL can redeem and returns a claim_link. A ledger transfer from a stablecoin-rails account settles on-chain when covered, and still returns a transfer. + */ + @JsonProperty("type") + public Optional getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expires_at") + private Optional _getExpiresAt() { + return expiresAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("idempotence_key") + private Optional _getIdempotenceKey() { + return idempotenceKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransfersRequest && equalTo((CreateTransfersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTransfersRequest other) { + return amount == other.amount + && currency.equals(other.currency) + && destinationId.equals(other.destinationId) + && expiresAt.equals(other.expiresAt) + && idempotenceKey.equals(other.idempotenceKey) + && metadata.equals(other.metadata) + && notes.equals(other.notes) + && originId.equals(other.originId) + && redeemableCount.equals(other.redeemableCount) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.currency, + this.destinationId, + this.expiresAt, + this.idempotenceKey, + this.metadata, + this.notes, + this.originId, + this.redeemableCount, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The amount to move, in the transfer currency. For example 25.00.

+ */ + OriginIdStage amount(double amount); + + Builder from(CreateTransfersRequest other); + } + + public interface OriginIdStage { + /** + *

The account sending the funds. A user ID (user_xxx), account ID (biz_xxx), or ledger account ID (ldgr_xxx).

+ */ + _FinalStage originId(@NotNull String originId); + } + + public interface _FinalStage { + CreateTransfersRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Currency, such as usd. Required for ledger transfers.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + /** + *

The recipient. Required for ledger and wallet_send (a user_/biz_/ldgr_ ID, or — for sends — an email). Omit for claim_link.

+ */ + _FinalStage destinationId(Optional destinationId); + + _FinalStage destinationId(String destinationId); + + /** + *

claim_link only. Link expiry as an ISO 8601 timestamp. Defaults to 24 hours from creation.

+ */ + _FinalStage expiresAt(Optional expiresAt); + + _FinalStage expiresAt(OffsetDateTime expiresAt); + + _FinalStage expiresAt(Nullable expiresAt); + + /** + *

Ledger transfers and wallet sends. A unique key that makes retries safe. Retrying with the same key returns the original transfer, or attaches to the original wallet send, instead of moving money twice.

+ */ + _FinalStage idempotenceKey(Optional idempotenceKey); + + _FinalStage idempotenceKey(String idempotenceKey); + + _FinalStage idempotenceKey(Nullable idempotenceKey); + + /** + *

Ledger transfers only. Custom key-value pairs attached to the transfer. Max 50 keys, 100 chars per key, 500 chars per string value.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Ledger transfers only. A short note describing the transfer.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + + /** + *

claim_link only. How many different users can claim the link. Defaults to 1.

+ */ + _FinalStage redeemableCount(Optional redeemableCount); + + _FinalStage redeemableCount(Integer redeemableCount); + + /** + *

The kind of money movement, which decides what comes back. Defaults to ledger. ledger moves credit between two Whop balances and returns a transfer; wallet_send sends USDT from the origin account's Ethereum wallet and returns a send; claim_link funds a shareable link anyone with the URL can redeem and returns a claim_link. A ledger transfer from a stablecoin-rails account settles on-chain when covered, and still returns a transfer.

+ */ + _FinalStage type(Optional type); + + _FinalStage type(CreateTransfersRequestType type); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, OriginIdStage, _FinalStage { + private double amount; + + private String originId; + + private Optional type = Optional.empty(); + + private Optional redeemableCount = Optional.empty(); + + private Optional notes = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional idempotenceKey = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + private Optional destinationId = Optional.empty(); + + private Optional currency = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTransfersRequest other) { + amount(other.getAmount()); + currency(other.getCurrency()); + destinationId(other.getDestinationId()); + expiresAt(other.getExpiresAt()); + idempotenceKey(other.getIdempotenceKey()); + metadata(other.getMetadata()); + notes(other.getNotes()); + originId(other.getOriginId()); + redeemableCount(other.getRedeemableCount()); + type(other.getType()); + return this; + } + + /** + *

The amount to move, in the transfer currency. For example 25.00.

+ *

The amount to move, in the transfer currency. For example 25.00.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public OriginIdStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The account sending the funds. A user ID (user_xxx), account ID (biz_xxx), or ledger account ID (ldgr_xxx).

+ *

The account sending the funds. A user ID (user_xxx), account ID (biz_xxx), or ledger account ID (ldgr_xxx).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("origin_id") + public _FinalStage originId(@NotNull String originId) { + this.originId = Objects.requireNonNull(originId, "originId must not be null"); + return this; + } + + /** + *

The kind of money movement, which decides what comes back. Defaults to ledger. ledger moves credit between two Whop balances and returns a transfer; wallet_send sends USDT from the origin account's Ethereum wallet and returns a send; claim_link funds a shareable link anyone with the URL can redeem and returns a claim_link. A ledger transfer from a stablecoin-rails account settles on-chain when covered, and still returns a transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(CreateTransfersRequestType type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

The kind of money movement, which decides what comes back. Defaults to ledger. ledger moves credit between two Whop balances and returns a transfer; wallet_send sends USDT from the origin account's Ethereum wallet and returns a send; claim_link funds a shareable link anyone with the URL can redeem and returns a claim_link. A ledger transfer from a stablecoin-rails account settles on-chain when covered, and still returns a transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public _FinalStage type(Optional type) { + this.type = type; + return this; + } + + /** + *

claim_link only. How many different users can claim the link. Defaults to 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redeemableCount(Integer redeemableCount) { + this.redeemableCount = Optional.ofNullable(redeemableCount); + return this; + } + + /** + *

claim_link only. How many different users can claim the link. Defaults to 1.

+ */ + @java.lang.Override + @JsonSetter(value = "redeemable_count", nulls = Nulls.SKIP) + public _FinalStage redeemableCount(Optional redeemableCount) { + this.redeemableCount = redeemableCount; + return this; + } + + /** + *

Ledger transfers only. A short note describing the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Ledger transfers only. A short note describing the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Ledger transfers only. A short note describing the transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

Ledger transfers only. Custom key-value pairs attached to the transfer. Max 50 keys, 100 chars per key, 500 chars per string value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Ledger transfers only. Custom key-value pairs attached to the transfer. Max 50 keys, 100 chars per key, 500 chars per string value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Ledger transfers only. Custom key-value pairs attached to the transfer. Max 50 keys, 100 chars per key, 500 chars per string value.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Ledger transfers and wallet sends. A unique key that makes retries safe. Retrying with the same key returns the original transfer, or attaches to the original wallet send, instead of moving money twice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage idempotenceKey(Nullable idempotenceKey) { + if (idempotenceKey.isNull()) { + this.idempotenceKey = null; + } else if (idempotenceKey.isEmpty()) { + this.idempotenceKey = Optional.empty(); + } else { + this.idempotenceKey = Optional.of(idempotenceKey.get()); + } + return this; + } + + /** + *

Ledger transfers and wallet sends. A unique key that makes retries safe. Retrying with the same key returns the original transfer, or attaches to the original wallet send, instead of moving money twice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage idempotenceKey(String idempotenceKey) { + this.idempotenceKey = Optional.ofNullable(idempotenceKey); + return this; + } + + /** + *

Ledger transfers and wallet sends. A unique key that makes retries safe. Retrying with the same key returns the original transfer, or attaches to the original wallet send, instead of moving money twice.

+ */ + @java.lang.Override + @JsonSetter(value = "idempotence_key", nulls = Nulls.SKIP) + public _FinalStage idempotenceKey(Optional idempotenceKey) { + this.idempotenceKey = idempotenceKey; + return this; + } + + /** + *

claim_link only. Link expiry as an ISO 8601 timestamp. Defaults to 24 hours from creation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expiresAt(Nullable expiresAt) { + if (expiresAt.isNull()) { + this.expiresAt = null; + } else if (expiresAt.isEmpty()) { + this.expiresAt = Optional.empty(); + } else { + this.expiresAt = Optional.of(expiresAt.get()); + } + return this; + } + + /** + *

claim_link only. Link expiry as an ISO 8601 timestamp. Defaults to 24 hours from creation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + /** + *

claim_link only. Link expiry as an ISO 8601 timestamp. Defaults to 24 hours from creation.

+ */ + @java.lang.Override + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public _FinalStage expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + *

The recipient. Required for ledger and wallet_send (a user_/biz_/ldgr_ ID, or — for sends — an email). Omit for claim_link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationId(String destinationId) { + this.destinationId = Optional.ofNullable(destinationId); + return this; + } + + /** + *

The recipient. Required for ledger and wallet_send (a user_/biz_/ldgr_ ID, or — for sends — an email). Omit for claim_link.

+ */ + @java.lang.Override + @JsonSetter(value = "destination_id", nulls = Nulls.SKIP) + public _FinalStage destinationId(Optional destinationId) { + this.destinationId = destinationId; + return this; + } + + /** + *

Currency, such as usd. Required for ledger transfers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

Currency, such as usd. Required for ledger transfers.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + @java.lang.Override + public CreateTransfersRequest build() { + return new CreateTransfersRequest( + amount, + currency, + destinationId, + expiresAt, + idempotenceKey, + metadata, + notes, + originId, + redeemableCount, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/requests/ListRecipientsTransfersRequest.java b/src/main/java/com/whop/api/resources/transfers/requests/ListRecipientsTransfersRequest.java new file mode 100644 index 00000000..6bbbb791 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/requests/ListRecipientsTransfersRequest.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListRecipientsTransfersRequest.Builder.class) +public final class ListRecipientsTransfersRequest { + private final String originId; + + private final Optional query; + + private final Optional first; + + private final Optional after; + + private final Map additionalProperties; + + private ListRecipientsTransfersRequest( + String originId, + Optional query, + Optional first, + Optional after, + Map additionalProperties) { + this.originId = originId; + this.query = query; + this.first = first; + this.after = after; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account sending the money: a company account ID (biz_), or a user ID (user_) for that user's own personal balance. + */ + @JsonProperty("origin_id") + public String getOriginId() { + return originId; + } + + /** + * @return Search anyone on Whop by name or username, plus your own accounts by name or ID. Omit it to get the team around the balance, the people you follow, and your own accounts. The list is the same whether the balance belongs to a company or to you. Searching from a biz_ origin additionally requires the member:basic:read scope. A credential scoped to a single company is the exception to the search itself: it only ever sees that company's own people. Complete email addresses return no matches. + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + /** + * @return Number of recipients per page. Search queries preserve the dashboard's 20-result maximum. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to fetch the page after (from page_info.end_cursor). + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListRecipientsTransfersRequest && equalTo((ListRecipientsTransfersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListRecipientsTransfersRequest other) { + return originId.equals(other.originId) + && query.equals(other.query) + && first.equals(other.first) + && after.equals(other.after); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.originId, this.query, this.first, this.after); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static OriginIdStage builder() { + return new Builder(); + } + + public interface OriginIdStage { + /** + *

The account sending the money: a company account ID (biz_), or a user ID (user_) for that user's own personal balance.

+ */ + _FinalStage originId(@NotNull String originId); + + Builder from(ListRecipientsTransfersRequest other); + } + + public interface _FinalStage { + ListRecipientsTransfersRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Search anyone on Whop by name or username, plus your own accounts by name or ID. Omit it to get the team around the balance, the people you follow, and your own accounts. The list is the same whether the balance belongs to a company or to you. Searching from a biz_ origin additionally requires the member:basic:read scope. A credential scoped to a single company is the exception to the search itself: it only ever sees that company's own people. Complete email addresses return no matches.

+ */ + _FinalStage query(Optional query); + + _FinalStage query(String query); + + /** + *

Number of recipients per page. Search queries preserve the dashboard's 20-result maximum.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements OriginIdStage, _FinalStage { + private String originId; + + private Optional after = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional query = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListRecipientsTransfersRequest other) { + originId(other.getOriginId()); + query(other.getQuery()); + first(other.getFirst()); + after(other.getAfter()); + return this; + } + + /** + *

The account sending the money: a company account ID (biz_), or a user ID (user_) for that user's own personal balance.

+ *

The account sending the money: a company account ID (biz_), or a user ID (user_) for that user's own personal balance.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("origin_id") + public _FinalStage originId(@NotNull String originId) { + this.originId = Objects.requireNonNull(originId, "originId must not be null"); + return this; + } + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + /** + *

Number of recipients per page. Search queries preserve the dashboard's 20-result maximum.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Number of recipients per page. Search queries preserve the dashboard's 20-result maximum.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Search anyone on Whop by name or username, plus your own accounts by name or ID. Omit it to get the team around the balance, the people you follow, and your own accounts. The list is the same whether the balance belongs to a company or to you. Searching from a biz_ origin additionally requires the member:basic:read scope. A credential scoped to a single company is the exception to the search itself: it only ever sees that company's own people. Complete email addresses return no matches.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + /** + *

Search anyone on Whop by name or username, plus your own accounts by name or ID. Omit it to get the team around the balance, the people you follow, and your own accounts. The list is the same whether the balance belongs to a company or to you. Searching from a biz_ origin additionally requires the member:basic:read scope. A credential scoped to a single company is the exception to the search itself: it only ever sees that company's own people. Complete email addresses return no matches.

+ */ + @java.lang.Override + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public _FinalStage query(Optional query) { + this.query = query; + return this; + } + + @java.lang.Override + public ListRecipientsTransfersRequest build() { + return new ListRecipientsTransfersRequest(originId, query, first, after, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/requests/ListTransfersRequest.java b/src/main/java/com/whop/api/resources/transfers/requests/ListTransfersRequest.java new file mode 100644 index 00000000..10b2ca1e --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/requests/ListTransfersRequest.java @@ -0,0 +1,406 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.transfers.types.ListTransfersRequestDirection; +import com.whop.api.resources.transfers.types.ListTransfersRequestOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListTransfersRequest.Builder.class) +public final class ListTransfersRequest { + private final Optional originId; + + private final Optional destinationId; + + private final Optional order; + + private final Optional direction; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListTransfersRequest( + Optional originId, + Optional destinationId, + Optional order, + Optional direction, + Optional createdBefore, + Optional createdAfter, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.originId = originId; + this.destinationId = destinationId; + this.order = order; + this.direction = direction; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return Filter to transfers sent from this account. Provide this or destination_id. + */ + @JsonProperty("origin_id") + public Optional getOriginId() { + return originId; + } + + /** + * @return Filter to transfers received by this account. Provide this or origin_id. + */ + @JsonProperty("destination_id") + public Optional getDestinationId() { + return destinationId; + } + + /** + * @return Sort column. Defaults to created_at. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. Defaults to desc. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Only transfers created strictly before this ISO 8601 timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only transfers created strictly after this ISO 8601 timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + /** + * @return Number of transfers to return from the start of the window. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return Cursor to fetch the page after (from page_info.end_cursor). + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return Number of transfers to return from the end of the window. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return Cursor to fetch the page before (from page_info.start_cursor). + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListTransfersRequest && equalTo((ListTransfersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListTransfersRequest other) { + return originId.equals(other.originId) + && destinationId.equals(other.destinationId) + && order.equals(other.order) + && direction.equals(other.direction) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.originId, + this.destinationId, + this.order, + this.direction, + this.createdBefore, + this.createdAfter, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional originId = Optional.empty(); + + private Optional destinationId = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional createdAfter = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListTransfersRequest other) { + originId(other.getOriginId()); + destinationId(other.getDestinationId()); + order(other.getOrder()); + direction(other.getDirection()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

Filter to transfers sent from this account. Provide this or destination_id.

+ */ + @JsonSetter(value = "origin_id", nulls = Nulls.SKIP) + public Builder originId(Optional originId) { + this.originId = originId; + return this; + } + + public Builder originId(String originId) { + this.originId = Optional.ofNullable(originId); + return this; + } + + /** + *

Filter to transfers received by this account. Provide this or origin_id.

+ */ + @JsonSetter(value = "destination_id", nulls = Nulls.SKIP) + public Builder destinationId(Optional destinationId) { + this.destinationId = destinationId; + return this; + } + + public Builder destinationId(String destinationId) { + this.destinationId = Optional.ofNullable(destinationId); + return this; + } + + /** + *

Sort column. Defaults to created_at.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListTransfersRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction. Defaults to desc.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListTransfersRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Only transfers created strictly before this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public Builder createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public Builder createdBefore(String createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only transfers created strictly after this ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public Builder createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public Builder createdAfter(String createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Number of transfers to return from the start of the window.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Cursor to fetch the page after (from page_info.end_cursor).

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Number of transfers to return from the end of the window.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Cursor to fetch the page before (from page_info.start_cursor).

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListTransfersRequest build() { + return new ListTransfersRequest( + originId, + destinationId, + order, + direction, + createdBefore, + createdAfter, + first, + after, + last, + before, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/requests/RetrieveTransfersRequest.java b/src/main/java/com/whop/api/resources/transfers/requests/RetrieveTransfersRequest.java new file mode 100644 index 00000000..720c1728 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/requests/RetrieveTransfersRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveTransfersRequest.Builder.class) +public final class RetrieveTransfersRequest { + private final Map additionalProperties; + + private RetrieveTransfersRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveTransfersRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveTransfersRequest other) { + return this; + } + + public RetrieveTransfersRequest build() { + return new RetrieveTransfersRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersRequestType.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersRequestType.java new file mode 100644 index 00000000..f5bab596 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersRequestType.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateTransfersRequestType { + public static final CreateTransfersRequestType WALLET_SEND = + new CreateTransfersRequestType(Value.WALLET_SEND, "wallet_send"); + + public static final CreateTransfersRequestType CLAIM_LINK = + new CreateTransfersRequestType(Value.CLAIM_LINK, "claim_link"); + + public static final CreateTransfersRequestType LEDGER = new CreateTransfersRequestType(Value.LEDGER, "ledger"); + + private final Value value; + + private final String string; + + CreateTransfersRequestType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateTransfersRequestType + && this.string.equals(((CreateTransfersRequestType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WALLET_SEND: + return visitor.visitWalletSend(); + case CLAIM_LINK: + return visitor.visitClaimLink(); + case LEDGER: + return visitor.visitLedger(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateTransfersRequestType valueOf(String value) { + switch (value) { + case "wallet_send": + return WALLET_SEND; + case "claim_link": + return CLAIM_LINK; + case "ledger": + return LEDGER; + default: + return new CreateTransfersRequestType(Value.UNKNOWN, value); + } + } + + public enum Value { + LEDGER, + + WALLET_SEND, + + CLAIM_LINK, + + UNKNOWN + } + + public interface Visitor { + T visitLedger(); + + T visitWalletSend(); + + T visitClaimLink(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponse.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponse.java new file mode 100644 index 00000000..2db22866 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponse.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateTransfersResponse { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateTransfersResponse(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateTransfersResponse transfer(CreateTransfersResponseTransfer value) { + return new CreateTransfersResponse(new TransferValue(value)); + } + + public static CreateTransfersResponse send(CreateTransfersResponseSend value) { + return new CreateTransfersResponse(new SendValue(value)); + } + + public static CreateTransfersResponse claimLink(CreateTransfersResponseClaimLink value) { + return new CreateTransfersResponse(new ClaimLinkValue(value)); + } + + public boolean isTransfer() { + return value instanceof TransferValue; + } + + public boolean isSend() { + return value instanceof SendValue; + } + + public boolean isClaimLink() { + return value instanceof ClaimLinkValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getTransfer() { + if (isTransfer()) { + return Optional.of(((TransferValue) value).value); + } + return Optional.empty(); + } + + public Optional getSend() { + if (isSend()) { + return Optional.of(((SendValue) value).value); + } + return Optional.empty(); + } + + public Optional getClaimLink() { + if (isClaimLink()) { + return Optional.of(((ClaimLinkValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransfersResponse && value.equals(((CreateTransfersResponse) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitTransfer(CreateTransfersResponseTransfer transfer); + + T visitSend(CreateTransfersResponseSend send); + + T visitClaimLink(CreateTransfersResponseClaimLink claimLink); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "object", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(TransferValue.class), + @JsonSubTypes.Type(SendValue.class), + @JsonSubTypes.Type(ClaimLinkValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("transfer") + @JsonIgnoreProperties("object") + private static final class TransferValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "object", allowSetters = true) + private CreateTransfersResponseTransfer value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferValue() {} + + private TransferValue(CreateTransfersResponseTransfer value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransfer(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferValue && equalTo((TransferValue) other); + } + + private boolean equalTo(TransferValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransfersResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("send") + @JsonIgnoreProperties("object") + private static final class SendValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "object", allowSetters = true) + private CreateTransfersResponseSend value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SendValue() {} + + private SendValue(CreateTransfersResponseSend value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSend(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SendValue && equalTo((SendValue) other); + } + + private boolean equalTo(SendValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransfersResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("claim_link") + @JsonIgnoreProperties("object") + private static final class ClaimLinkValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "object", allowSetters = true) + private CreateTransfersResponseClaimLink value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ClaimLinkValue() {} + + private ClaimLinkValue(CreateTransfersResponseClaimLink value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitClaimLink(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClaimLinkValue && equalTo((ClaimLinkValue) other); + } + + private boolean equalTo(ClaimLinkValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransfersResponse{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("object") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransfersResponse{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseClaimLink.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseClaimLink.java new file mode 100644 index 00000000..41f88fee --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseClaimLink.java @@ -0,0 +1,351 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTransfersResponseClaimLink.Builder.class) +public final class CreateTransfersResponseClaimLink { + private final String amount; + + private final String claimUrl; + + private final String currency; + + private final Optional expiresAt; + + private final String id; + + private final int redeemableCount; + + private final CreateTransfersResponseClaimLinkSource source; + + private final CreateTransfersResponseClaimLinkStatus status; + + private final Map additionalProperties; + + private CreateTransfersResponseClaimLink( + String amount, + String claimUrl, + String currency, + Optional expiresAt, + String id, + int redeemableCount, + CreateTransfersResponseClaimLinkSource source, + CreateTransfersResponseClaimLinkStatus status, + Map additionalProperties) { + this.amount = amount; + this.claimUrl = claimUrl; + this.currency = currency; + this.expiresAt = expiresAt; + this.id = id; + this.redeemableCount = redeemableCount; + this.source = source; + this.status = status; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + @JsonProperty("claim_url") + public String getClaimUrl() { + return claimUrl; + } + + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonIgnore + public Optional getExpiresAt() { + if (expiresAt == null) { + return Optional.empty(); + } + return expiresAt; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("redeemable_count") + public int getRedeemableCount() { + return redeemableCount; + } + + @JsonProperty("source") + public CreateTransfersResponseClaimLinkSource getSource() { + return source; + } + + /** + * @return A newly funded claim link is always pending — it stays claimable until it is fully claimed, canceled, or expires. + */ + @JsonProperty("status") + public CreateTransfersResponseClaimLinkStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expires_at") + private Optional _getExpiresAt() { + return expiresAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransfersResponseClaimLink && equalTo((CreateTransfersResponseClaimLink) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTransfersResponseClaimLink other) { + return amount.equals(other.amount) + && claimUrl.equals(other.claimUrl) + && currency.equals(other.currency) + && expiresAt.equals(other.expiresAt) + && id.equals(other.id) + && redeemableCount == other.redeemableCount + && source.equals(other.source) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.claimUrl, + this.currency, + this.expiresAt, + this.id, + this.redeemableCount, + this.source, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + ClaimUrlStage amount(@NotNull String amount); + + Builder from(CreateTransfersResponseClaimLink other); + } + + public interface ClaimUrlStage { + CurrencyStage claimUrl(@NotNull String claimUrl); + } + + public interface CurrencyStage { + IdStage currency(@NotNull String currency); + } + + public interface IdStage { + RedeemableCountStage id(@NotNull String id); + } + + public interface RedeemableCountStage { + SourceStage redeemableCount(int redeemableCount); + } + + public interface SourceStage { + StatusStage source(@NotNull CreateTransfersResponseClaimLinkSource source); + } + + public interface StatusStage { + /** + *

A newly funded claim link is always pending — it stays claimable until it is fully claimed, canceled, or expires.

+ */ + _FinalStage status(@NotNull CreateTransfersResponseClaimLinkStatus status); + } + + public interface _FinalStage { + CreateTransfersResponseClaimLink build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage expiresAt(Optional expiresAt); + + _FinalStage expiresAt(OffsetDateTime expiresAt); + + _FinalStage expiresAt(Nullable expiresAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + ClaimUrlStage, + CurrencyStage, + IdStage, + RedeemableCountStage, + SourceStage, + StatusStage, + _FinalStage { + private String amount; + + private String claimUrl; + + private String currency; + + private String id; + + private int redeemableCount; + + private CreateTransfersResponseClaimLinkSource source; + + private CreateTransfersResponseClaimLinkStatus status; + + private Optional expiresAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTransfersResponseClaimLink other) { + amount(other.getAmount()); + claimUrl(other.getClaimUrl()); + currency(other.getCurrency()); + expiresAt(other.getExpiresAt()); + id(other.getId()); + redeemableCount(other.getRedeemableCount()); + source(other.getSource()); + status(other.getStatus()); + return this; + } + + @java.lang.Override + @JsonSetter("amount") + public ClaimUrlStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("claim_url") + public CurrencyStage claimUrl(@NotNull String claimUrl) { + this.claimUrl = Objects.requireNonNull(claimUrl, "claimUrl must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public RedeemableCountStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("redeemable_count") + public SourceStage redeemableCount(int redeemableCount) { + this.redeemableCount = redeemableCount; + return this; + } + + @java.lang.Override + @JsonSetter("source") + public StatusStage source(@NotNull CreateTransfersResponseClaimLinkSource source) { + this.source = Objects.requireNonNull(source, "source must not be null"); + return this; + } + + /** + *

A newly funded claim link is always pending — it stays claimable until it is fully claimed, canceled, or expires.

+ *

A newly funded claim link is always pending — it stays claimable until it is fully claimed, canceled, or expires.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull CreateTransfersResponseClaimLinkStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage expiresAt(Nullable expiresAt) { + if (expiresAt.isNull()) { + this.expiresAt = null; + } else if (expiresAt.isEmpty()) { + this.expiresAt = Optional.empty(); + } else { + this.expiresAt = Optional.of(expiresAt.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public _FinalStage expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + @java.lang.Override + public CreateTransfersResponseClaimLink build() { + return new CreateTransfersResponseClaimLink( + amount, claimUrl, currency, expiresAt, id, redeemableCount, source, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseClaimLinkSource.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseClaimLinkSource.java new file mode 100644 index 00000000..6c57f124 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseClaimLinkSource.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTransfersResponseClaimLinkSource.Builder.class) +public final class CreateTransfersResponseClaimLinkSource { + private final String accountId; + + private final Map additionalProperties; + + private CreateTransfersResponseClaimLinkSource(String accountId, Map additionalProperties) { + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransfersResponseClaimLinkSource + && equalTo((CreateTransfersResponseClaimLinkSource) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTransfersResponseClaimLinkSource other) { + return accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + _FinalStage accountId(@NotNull String accountId); + + Builder from(CreateTransfersResponseClaimLinkSource other); + } + + public interface _FinalStage { + CreateTransfersResponseClaimLinkSource build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, _FinalStage { + private String accountId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTransfersResponseClaimLinkSource other) { + accountId(other.getAccountId()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + public CreateTransfersResponseClaimLinkSource build() { + return new CreateTransfersResponseClaimLinkSource(accountId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseClaimLinkStatus.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseClaimLinkStatus.java new file mode 100644 index 00000000..a2b48211 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseClaimLinkStatus.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateTransfersResponseClaimLinkStatus { + public static final CreateTransfersResponseClaimLinkStatus PENDING = + new CreateTransfersResponseClaimLinkStatus(Value.PENDING, "pending"); + + private final Value value; + + private final String string; + + CreateTransfersResponseClaimLinkStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateTransfersResponseClaimLinkStatus + && this.string.equals(((CreateTransfersResponseClaimLinkStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateTransfersResponseClaimLinkStatus valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + default: + return new CreateTransfersResponseClaimLinkStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseSend.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseSend.java new file mode 100644 index 00000000..0b5e6b11 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseSend.java @@ -0,0 +1,217 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTransfersResponseSend.Builder.class) +public final class CreateTransfersResponseSend { + private final String amount; + + private final String currency; + + private final CreateTransfersResponseSendDestination destination; + + private final CreateTransfersResponseSendSource source; + + private final String txHash; + + private final Map additionalProperties; + + private CreateTransfersResponseSend( + String amount, + String currency, + CreateTransfersResponseSendDestination destination, + CreateTransfersResponseSendSource source, + String txHash, + Map additionalProperties) { + this.amount = amount; + this.currency = currency; + this.destination = destination; + this.source = source; + this.txHash = txHash; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("destination") + public CreateTransfersResponseSendDestination getDestination() { + return destination; + } + + @JsonProperty("source") + public CreateTransfersResponseSendSource getSource() { + return source; + } + + @JsonProperty("tx_hash") + public String getTxHash() { + return txHash; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransfersResponseSend && equalTo((CreateTransfersResponseSend) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTransfersResponseSend other) { + return amount.equals(other.amount) + && currency.equals(other.currency) + && destination.equals(other.destination) + && source.equals(other.source) + && txHash.equals(other.txHash); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.currency, this.destination, this.source, this.txHash); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + CurrencyStage amount(@NotNull String amount); + + Builder from(CreateTransfersResponseSend other); + } + + public interface CurrencyStage { + DestinationStage currency(@NotNull String currency); + } + + public interface DestinationStage { + SourceStage destination(@NotNull CreateTransfersResponseSendDestination destination); + } + + public interface SourceStage { + TxHashStage source(@NotNull CreateTransfersResponseSendSource source); + } + + public interface TxHashStage { + _FinalStage txHash(@NotNull String txHash); + } + + public interface _FinalStage { + CreateTransfersResponseSend build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, CurrencyStage, DestinationStage, SourceStage, TxHashStage, _FinalStage { + private String amount; + + private String currency; + + private CreateTransfersResponseSendDestination destination; + + private CreateTransfersResponseSendSource source; + + private String txHash; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTransfersResponseSend other) { + amount(other.getAmount()); + currency(other.getCurrency()); + destination(other.getDestination()); + source(other.getSource()); + txHash(other.getTxHash()); + return this; + } + + @java.lang.Override + @JsonSetter("amount") + public CurrencyStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public DestinationStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("destination") + public SourceStage destination(@NotNull CreateTransfersResponseSendDestination destination) { + this.destination = Objects.requireNonNull(destination, "destination must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("source") + public TxHashStage source(@NotNull CreateTransfersResponseSendSource source) { + this.source = Objects.requireNonNull(source, "source must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("tx_hash") + public _FinalStage txHash(@NotNull String txHash) { + this.txHash = Objects.requireNonNull(txHash, "txHash must not be null"); + return this; + } + + @java.lang.Override + public CreateTransfersResponseSend build() { + return new CreateTransfersResponseSend(amount, currency, destination, source, txHash, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseSendDestination.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseSendDestination.java new file mode 100644 index 00000000..ff5f736e --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseSendDestination.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTransfersResponseSendDestination.Builder.class) +public final class CreateTransfersResponseSendDestination { + private final String accountId; + + private final String address; + + private final Map additionalProperties; + + private CreateTransfersResponseSendDestination( + String accountId, String address, Map additionalProperties) { + this.accountId = accountId; + this.address = address; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("address") + public String getAddress() { + return address; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransfersResponseSendDestination + && equalTo((CreateTransfersResponseSendDestination) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTransfersResponseSendDestination other) { + return accountId.equals(other.accountId) && address.equals(other.address); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.address); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + AddressStage accountId(@NotNull String accountId); + + Builder from(CreateTransfersResponseSendDestination other); + } + + public interface AddressStage { + _FinalStage address(@NotNull String address); + } + + public interface _FinalStage { + CreateTransfersResponseSendDestination build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, AddressStage, _FinalStage { + private String accountId; + + private String address; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTransfersResponseSendDestination other) { + accountId(other.getAccountId()); + address(other.getAddress()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public AddressStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("address") + public _FinalStage address(@NotNull String address) { + this.address = Objects.requireNonNull(address, "address must not be null"); + return this; + } + + @java.lang.Override + public CreateTransfersResponseSendDestination build() { + return new CreateTransfersResponseSendDestination(accountId, address, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseSendSource.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseSendSource.java new file mode 100644 index 00000000..82a43313 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseSendSource.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTransfersResponseSendSource.Builder.class) +public final class CreateTransfersResponseSendSource { + private final String accountId; + + private final String address; + + private final Map additionalProperties; + + private CreateTransfersResponseSendSource( + String accountId, String address, Map additionalProperties) { + this.accountId = accountId; + this.address = address; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("address") + public String getAddress() { + return address; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransfersResponseSendSource && equalTo((CreateTransfersResponseSendSource) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTransfersResponseSendSource other) { + return accountId.equals(other.accountId) && address.equals(other.address); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.address); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + AddressStage accountId(@NotNull String accountId); + + Builder from(CreateTransfersResponseSendSource other); + } + + public interface AddressStage { + _FinalStage address(@NotNull String address); + } + + public interface _FinalStage { + CreateTransfersResponseSendSource build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, AddressStage, _FinalStage { + private String accountId; + + private String address; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTransfersResponseSendSource other) { + accountId(other.getAccountId()); + address(other.getAddress()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public AddressStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("address") + public _FinalStage address(@NotNull String address) { + this.address = Objects.requireNonNull(address, "address must not be null"); + return this; + } + + @java.lang.Override + public CreateTransfersResponseSendSource build() { + return new CreateTransfersResponseSendSource(accountId, address, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransfer.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransfer.java new file mode 100644 index 00000000..79e28461 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransfer.java @@ -0,0 +1,953 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTransfersResponseTransfer.Builder.class) +public final class CreateTransfersResponseTransfer { + private final double amount; + + private final OffsetDateTime createdAt; + + private final Optional createdByUser; + + private final String currency; + + private final CreateTransfersResponseTransferDestination destination; + + private final String destinationLedgerAccountId; + + private final Optional failedAt; + + private final Optional failureCode; + + private final Optional failureReason; + + private final Optional feeAmount; + + private final String id; + + private final Optional> metadata; + + private final Optional notes; + + private final CreateTransfersResponseTransferOrigin origin; + + private final String originLedgerAccountId; + + private final CreateTransfersResponseTransferStatus status; + + private final Map additionalProperties; + + private CreateTransfersResponseTransfer( + double amount, + OffsetDateTime createdAt, + Optional createdByUser, + String currency, + CreateTransfersResponseTransferDestination destination, + String destinationLedgerAccountId, + Optional failedAt, + Optional failureCode, + Optional failureReason, + Optional feeAmount, + String id, + Optional> metadata, + Optional notes, + CreateTransfersResponseTransferOrigin origin, + String originLedgerAccountId, + CreateTransfersResponseTransferStatus status, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.createdByUser = createdByUser; + this.currency = currency; + this.destination = destination; + this.destinationLedgerAccountId = destinationLedgerAccountId; + this.failedAt = failedAt; + this.failureCode = failureCode; + this.failureReason = failureReason; + this.feeAmount = feeAmount; + this.id = id; + this.metadata = metadata; + this.notes = notes; + this.origin = origin; + this.originLedgerAccountId = originLedgerAccountId; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Transfer amount. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return When the transfer was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable. + */ + @JsonIgnore + public Optional getCreatedByUser() { + if (createdByUser == null) { + return Optional.empty(); + } + return createdByUser; + } + + /** + * @return Transfer currency. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Account or user receiving funds. + */ + @JsonProperty("destination") + public CreateTransfersResponseTransferDestination getDestination() { + return destination; + } + + /** + * @return Destination ledger account ID. + */ + @JsonProperty("destination_ledger_account_id") + public String getDestinationLedgerAccountId() { + return destinationLedgerAccountId; + } + + /** + * @return When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailedAt() { + if (failedAt == null) { + return Optional.empty(); + } + return failedAt; + } + + /** + * @return Machine-readable code for why the transfer failed. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailureCode() { + if (failureCode == null) { + return Optional.empty(); + } + return failureCode; + } + + /** + * @return Human-readable explanation of why the transfer failed. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailureReason() { + if (failureReason == null) { + return Optional.empty(); + } + return failureReason; + } + + /** + * @return Fee charged for the transfer. + */ + @JsonIgnore + public Optional getFeeAmount() { + if (feeAmount == null) { + return Optional.empty(); + } + return feeAmount; + } + + /** + * @return Transfer ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom metadata attached to the transfer. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Transfer note. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + /** + * @return Account or user sending funds. + */ + @JsonProperty("origin") + public CreateTransfersResponseTransferOrigin getOrigin() { + return origin; + } + + /** + * @return Source ledger account ID. + */ + @JsonProperty("origin_ledger_account_id") + public String getOriginLedgerAccountId() { + return originLedgerAccountId; + } + + /** + * @return Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded. + */ + @JsonProperty("status") + public CreateTransfersResponseTransferStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_by_user") + private Optional _getCreatedByUser() { + return createdByUser; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failed_at") + private Optional _getFailedAt() { + return failedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_code") + private Optional _getFailureCode() { + return failureCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_reason") + private Optional _getFailureReason() { + return failureReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fee_amount") + private Optional _getFeeAmount() { + return feeAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransfersResponseTransfer && equalTo((CreateTransfersResponseTransfer) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTransfersResponseTransfer other) { + return amount == other.amount + && createdAt.equals(other.createdAt) + && createdByUser.equals(other.createdByUser) + && currency.equals(other.currency) + && destination.equals(other.destination) + && destinationLedgerAccountId.equals(other.destinationLedgerAccountId) + && failedAt.equals(other.failedAt) + && failureCode.equals(other.failureCode) + && failureReason.equals(other.failureReason) + && feeAmount.equals(other.feeAmount) + && id.equals(other.id) + && metadata.equals(other.metadata) + && notes.equals(other.notes) + && origin.equals(other.origin) + && originLedgerAccountId.equals(other.originLedgerAccountId) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.createdByUser, + this.currency, + this.destination, + this.destinationLedgerAccountId, + this.failedAt, + this.failureCode, + this.failureReason, + this.feeAmount, + this.id, + this.metadata, + this.notes, + this.origin, + this.originLedgerAccountId, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

Transfer amount.

+ */ + CreatedAtStage amount(double amount); + + Builder from(CreateTransfersResponseTransfer other); + } + + public interface CreatedAtStage { + /** + *

When the transfer was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

Transfer currency.

+ */ + DestinationStage currency(@NotNull String currency); + } + + public interface DestinationStage { + /** + *

Account or user receiving funds.

+ */ + DestinationLedgerAccountIdStage destination(@NotNull CreateTransfersResponseTransferDestination destination); + } + + public interface DestinationLedgerAccountIdStage { + /** + *

Destination ledger account ID.

+ */ + IdStage destinationLedgerAccountId(@NotNull String destinationLedgerAccountId); + } + + public interface IdStage { + /** + *

Transfer ID.

+ */ + OriginStage id(@NotNull String id); + } + + public interface OriginStage { + /** + *

Account or user sending funds.

+ */ + OriginLedgerAccountIdStage origin(@NotNull CreateTransfersResponseTransferOrigin origin); + } + + public interface OriginLedgerAccountIdStage { + /** + *

Source ledger account ID.

+ */ + StatusStage originLedgerAccountId(@NotNull String originLedgerAccountId); + } + + public interface StatusStage { + /** + *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ */ + _FinalStage status(@NotNull CreateTransfersResponseTransferStatus status); + } + + public interface _FinalStage { + CreateTransfersResponseTransfer build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ */ + _FinalStage createdByUser(Optional createdByUser); + + _FinalStage createdByUser(CreateTransfersResponseTransferCreatedByUser createdByUser); + + _FinalStage createdByUser(Nullable createdByUser); + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ */ + _FinalStage failedAt(Optional failedAt); + + _FinalStage failedAt(OffsetDateTime failedAt); + + _FinalStage failedAt(Nullable failedAt); + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ */ + _FinalStage failureCode(Optional failureCode); + + _FinalStage failureCode(String failureCode); + + _FinalStage failureCode(Nullable failureCode); + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ */ + _FinalStage failureReason(Optional failureReason); + + _FinalStage failureReason(String failureReason); + + _FinalStage failureReason(Nullable failureReason); + + /** + *

Fee charged for the transfer.

+ */ + _FinalStage feeAmount(Optional feeAmount); + + _FinalStage feeAmount(Double feeAmount); + + _FinalStage feeAmount(Nullable feeAmount); + + /** + *

Custom metadata attached to the transfer.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Transfer note.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + CurrencyStage, + DestinationStage, + DestinationLedgerAccountIdStage, + IdStage, + OriginStage, + OriginLedgerAccountIdStage, + StatusStage, + _FinalStage { + private double amount; + + private OffsetDateTime createdAt; + + private String currency; + + private CreateTransfersResponseTransferDestination destination; + + private String destinationLedgerAccountId; + + private String id; + + private CreateTransfersResponseTransferOrigin origin; + + private String originLedgerAccountId; + + private CreateTransfersResponseTransferStatus status; + + private Optional notes = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional feeAmount = Optional.empty(); + + private Optional failureReason = Optional.empty(); + + private Optional failureCode = Optional.empty(); + + private Optional failedAt = Optional.empty(); + + private Optional createdByUser = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTransfersResponseTransfer other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + createdByUser(other.getCreatedByUser()); + currency(other.getCurrency()); + destination(other.getDestination()); + destinationLedgerAccountId(other.getDestinationLedgerAccountId()); + failedAt(other.getFailedAt()); + failureCode(other.getFailureCode()); + failureReason(other.getFailureReason()); + feeAmount(other.getFeeAmount()); + id(other.getId()); + metadata(other.getMetadata()); + notes(other.getNotes()); + origin(other.getOrigin()); + originLedgerAccountId(other.getOriginLedgerAccountId()); + status(other.getStatus()); + return this; + } + + /** + *

Transfer amount.

+ *

Transfer amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

When the transfer was created.

+ *

When the transfer was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Transfer currency.

+ *

Transfer currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DestinationStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Account or user receiving funds.

+ *

Account or user receiving funds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination") + public DestinationLedgerAccountIdStage destination( + @NotNull CreateTransfersResponseTransferDestination destination) { + this.destination = Objects.requireNonNull(destination, "destination must not be null"); + return this; + } + + /** + *

Destination ledger account ID.

+ *

Destination ledger account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination_ledger_account_id") + public IdStage destinationLedgerAccountId(@NotNull String destinationLedgerAccountId) { + this.destinationLedgerAccountId = + Objects.requireNonNull(destinationLedgerAccountId, "destinationLedgerAccountId must not be null"); + return this; + } + + /** + *

Transfer ID.

+ *

Transfer ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OriginStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account or user sending funds.

+ *

Account or user sending funds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("origin") + public OriginLedgerAccountIdStage origin(@NotNull CreateTransfersResponseTransferOrigin origin) { + this.origin = Objects.requireNonNull(origin, "origin must not be null"); + return this; + } + + /** + *

Source ledger account ID.

+ *

Source ledger account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("origin_ledger_account_id") + public StatusStage originLedgerAccountId(@NotNull String originLedgerAccountId) { + this.originLedgerAccountId = + Objects.requireNonNull(originLedgerAccountId, "originLedgerAccountId must not be null"); + return this; + } + + /** + *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull CreateTransfersResponseTransferStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Transfer note.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Transfer note.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Transfer note.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Fee charged for the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeAmount(Nullable feeAmount) { + if (feeAmount.isNull()) { + this.feeAmount = null; + } else if (feeAmount.isEmpty()) { + this.feeAmount = Optional.empty(); + } else { + this.feeAmount = Optional.of(feeAmount.get()); + } + return this; + } + + /** + *

Fee charged for the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeAmount(Double feeAmount) { + this.feeAmount = Optional.ofNullable(feeAmount); + return this; + } + + /** + *

Fee charged for the transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "fee_amount", nulls = Nulls.SKIP) + public _FinalStage feeAmount(Optional feeAmount) { + this.feeAmount = feeAmount; + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureReason(Nullable failureReason) { + if (failureReason.isNull()) { + this.failureReason = null; + } else if (failureReason.isEmpty()) { + this.failureReason = Optional.empty(); + } else { + this.failureReason = Optional.of(failureReason.get()); + } + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureReason(String failureReason) { + this.failureReason = Optional.ofNullable(failureReason); + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_reason", nulls = Nulls.SKIP) + public _FinalStage failureReason(Optional failureReason) { + this.failureReason = failureReason; + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureCode(Nullable failureCode) { + if (failureCode.isNull()) { + this.failureCode = null; + } else if (failureCode.isEmpty()) { + this.failureCode = Optional.empty(); + } else { + this.failureCode = Optional.of(failureCode.get()); + } + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureCode(String failureCode) { + this.failureCode = Optional.ofNullable(failureCode); + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_code", nulls = Nulls.SKIP) + public _FinalStage failureCode(Optional failureCode) { + this.failureCode = failureCode; + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failedAt(Nullable failedAt) { + if (failedAt.isNull()) { + this.failedAt = null; + } else if (failedAt.isEmpty()) { + this.failedAt = Optional.empty(); + } else { + this.failedAt = Optional.of(failedAt.get()); + } + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failedAt(OffsetDateTime failedAt) { + this.failedAt = Optional.ofNullable(failedAt); + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failed_at", nulls = Nulls.SKIP) + public _FinalStage failedAt(Optional failedAt) { + this.failedAt = failedAt; + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdByUser(Nullable createdByUser) { + if (createdByUser.isNull()) { + this.createdByUser = null; + } else if (createdByUser.isEmpty()) { + this.createdByUser = Optional.empty(); + } else { + this.createdByUser = Optional.of(createdByUser.get()); + } + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdByUser(CreateTransfersResponseTransferCreatedByUser createdByUser) { + this.createdByUser = Optional.ofNullable(createdByUser); + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ */ + @java.lang.Override + @JsonSetter(value = "created_by_user", nulls = Nulls.SKIP) + public _FinalStage createdByUser(Optional createdByUser) { + this.createdByUser = createdByUser; + return this; + } + + @java.lang.Override + public CreateTransfersResponseTransfer build() { + return new CreateTransfersResponseTransfer( + amount, + createdAt, + createdByUser, + currency, + destination, + destinationLedgerAccountId, + failedAt, + failureCode, + failureReason, + feeAmount, + id, + metadata, + notes, + origin, + originLedgerAccountId, + status, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferCreatedByUser.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferCreatedByUser.java new file mode 100644 index 00000000..ac24af58 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferCreatedByUser.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTransfersResponseTransferCreatedByUser.Builder.class) +public final class CreateTransfersResponseTransferCreatedByUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private CreateTransfersResponseTransferCreatedByUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransfersResponseTransferCreatedByUser + && equalTo((CreateTransfersResponseTransferCreatedByUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTransfersResponseTransferCreatedByUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(CreateTransfersResponseTransferCreatedByUser other); + } + + public interface UsernameStage { + /** + *

User's username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + CreateTransfersResponseTransferCreatedByUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTransfersResponseTransferCreatedByUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public CreateTransfersResponseTransferCreatedByUser build() { + return new CreateTransfersResponseTransferCreatedByUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferDestination.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferDestination.java new file mode 100644 index 00000000..4a8c4366 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferDestination.java @@ -0,0 +1,224 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateTransfersResponseTransferDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateTransfersResponseTransferDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateTransfersResponseTransferDestination company( + CreateTransfersResponseTransferDestinationCompany value) { + return new CreateTransfersResponseTransferDestination(new CompanyValue(value)); + } + + public static CreateTransfersResponseTransferDestination user( + CreateTransfersResponseTransferDestinationUser value) { + return new CreateTransfersResponseTransferDestination(new UserValue(value)); + } + + public boolean isCompany() { + return value instanceof CompanyValue; + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getCompany() { + if (isCompany()) { + return Optional.of(((CompanyValue) value).value); + } + return Optional.empty(); + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransfersResponseTransferDestination + && value.equals(((CreateTransfersResponseTransferDestination) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitCompany(CreateTransfersResponseTransferDestinationCompany company); + + T visitUser(CreateTransfersResponseTransferDestinationUser user); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(CompanyValue.class), @JsonSubTypes.Type(UserValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("Company") + @JsonIgnoreProperties("typename") + private static final class CompanyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private CreateTransfersResponseTransferDestinationCompany value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CompanyValue() {} + + private CompanyValue(CreateTransfersResponseTransferDestinationCompany value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCompany(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyValue && equalTo((CompanyValue) other); + } + + private boolean equalTo(CompanyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransfersResponseTransferDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("User") + @JsonIgnoreProperties("typename") + private static final class UserValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private CreateTransfersResponseTransferDestinationUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(CreateTransfersResponseTransferDestinationUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransfersResponseTransferDestination{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransfersResponseTransferDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferDestinationCompany.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferDestinationCompany.java new file mode 100644 index 00000000..9da7adee --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferDestinationCompany.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTransfersResponseTransferDestinationCompany.Builder.class) +public final class CreateTransfersResponseTransferDestinationCompany { + private final String id; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private CreateTransfersResponseTransferDestinationCompany( + String id, Optional route, Optional title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account route. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Account display name. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransfersResponseTransferDestinationCompany + && equalTo((CreateTransfersResponseTransferDestinationCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTransfersResponseTransferDestinationCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CreateTransfersResponseTransferDestinationCompany other); + } + + public interface _FinalStage { + CreateTransfersResponseTransferDestinationCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account route.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

Account display name.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional title = Optional.empty(); + + private Optional route = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTransfersResponseTransferDestinationCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID.

+ *

Account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Account display name.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Account route.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + @java.lang.Override + public CreateTransfersResponseTransferDestinationCompany build() { + return new CreateTransfersResponseTransferDestinationCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferDestinationUser.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferDestinationUser.java new file mode 100644 index 00000000..d54a3fe6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferDestinationUser.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTransfersResponseTransferDestinationUser.Builder.class) +public final class CreateTransfersResponseTransferDestinationUser { + private final String id; + + private final Optional name; + + private final Optional username; + + private final Map additionalProperties; + + private CreateTransfersResponseTransferDestinationUser( + String id, Optional name, Optional username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public Optional getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransfersResponseTransferDestinationUser + && equalTo((CreateTransfersResponseTransferDestinationUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTransfersResponseTransferDestinationUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CreateTransfersResponseTransferDestinationUser other); + } + + public interface _FinalStage { + CreateTransfersResponseTransferDestinationUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

User's username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional username = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTransfersResponseTransferDestinationUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

User's username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public CreateTransfersResponseTransferDestinationUser build() { + return new CreateTransfersResponseTransferDestinationUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferOrigin.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferOrigin.java new file mode 100644 index 00000000..24e7c59c --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferOrigin.java @@ -0,0 +1,222 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateTransfersResponseTransferOrigin { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateTransfersResponseTransferOrigin(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateTransfersResponseTransferOrigin company(CreateTransfersResponseTransferOriginCompany value) { + return new CreateTransfersResponseTransferOrigin(new CompanyValue(value)); + } + + public static CreateTransfersResponseTransferOrigin user(CreateTransfersResponseTransferOriginUser value) { + return new CreateTransfersResponseTransferOrigin(new UserValue(value)); + } + + public boolean isCompany() { + return value instanceof CompanyValue; + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getCompany() { + if (isCompany()) { + return Optional.of(((CompanyValue) value).value); + } + return Optional.empty(); + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransfersResponseTransferOrigin + && value.equals(((CreateTransfersResponseTransferOrigin) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitCompany(CreateTransfersResponseTransferOriginCompany company); + + T visitUser(CreateTransfersResponseTransferOriginUser user); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(CompanyValue.class), @JsonSubTypes.Type(UserValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("Company") + @JsonIgnoreProperties("typename") + private static final class CompanyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private CreateTransfersResponseTransferOriginCompany value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CompanyValue() {} + + private CompanyValue(CreateTransfersResponseTransferOriginCompany value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCompany(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyValue && equalTo((CompanyValue) other); + } + + private boolean equalTo(CompanyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransfersResponseTransferOrigin{" + "value: " + value + "}"; + } + } + + @JsonTypeName("User") + @JsonIgnoreProperties("typename") + private static final class UserValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private CreateTransfersResponseTransferOriginUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(CreateTransfersResponseTransferOriginUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransfersResponseTransferOrigin{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransfersResponseTransferOrigin{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferOriginCompany.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferOriginCompany.java new file mode 100644 index 00000000..500550cf --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferOriginCompany.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTransfersResponseTransferOriginCompany.Builder.class) +public final class CreateTransfersResponseTransferOriginCompany { + private final String id; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private CreateTransfersResponseTransferOriginCompany( + String id, Optional route, Optional title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account route. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Account display name. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransfersResponseTransferOriginCompany + && equalTo((CreateTransfersResponseTransferOriginCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTransfersResponseTransferOriginCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CreateTransfersResponseTransferOriginCompany other); + } + + public interface _FinalStage { + CreateTransfersResponseTransferOriginCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account route.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

Account display name.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional title = Optional.empty(); + + private Optional route = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTransfersResponseTransferOriginCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID.

+ *

Account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Account display name.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Account route.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + @java.lang.Override + public CreateTransfersResponseTransferOriginCompany build() { + return new CreateTransfersResponseTransferOriginCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferOriginUser.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferOriginUser.java new file mode 100644 index 00000000..3c4c176b --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferOriginUser.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTransfersResponseTransferOriginUser.Builder.class) +public final class CreateTransfersResponseTransferOriginUser { + private final String id; + + private final Optional name; + + private final Optional username; + + private final Map additionalProperties; + + private CreateTransfersResponseTransferOriginUser( + String id, Optional name, Optional username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public Optional getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransfersResponseTransferOriginUser + && equalTo((CreateTransfersResponseTransferOriginUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTransfersResponseTransferOriginUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CreateTransfersResponseTransferOriginUser other); + } + + public interface _FinalStage { + CreateTransfersResponseTransferOriginUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

User's username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional username = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTransfersResponseTransferOriginUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

User's username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public CreateTransfersResponseTransferOriginUser build() { + return new CreateTransfersResponseTransferOriginUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferStatus.java b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferStatus.java new file mode 100644 index 00000000..612da480 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/CreateTransfersResponseTransferStatus.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateTransfersResponseTransferStatus { + public static final CreateTransfersResponseTransferStatus FAILED = + new CreateTransfersResponseTransferStatus(Value.FAILED, "failed"); + + public static final CreateTransfersResponseTransferStatus SUCCEEDED = + new CreateTransfersResponseTransferStatus(Value.SUCCEEDED, "succeeded"); + + public static final CreateTransfersResponseTransferStatus PROCESSING = + new CreateTransfersResponseTransferStatus(Value.PROCESSING, "processing"); + + private final Value value; + + private final String string; + + CreateTransfersResponseTransferStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateTransfersResponseTransferStatus + && this.string.equals(((CreateTransfersResponseTransferStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case SUCCEEDED: + return visitor.visitSucceeded(); + case PROCESSING: + return visitor.visitProcessing(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateTransfersResponseTransferStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "succeeded": + return SUCCEEDED; + case "processing": + return PROCESSING; + default: + return new CreateTransfersResponseTransferStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PROCESSING, + + SUCCEEDED, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitProcessing(); + + T visitSucceeded(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/ListRecipientsTransfersResponse.java b/src/main/java/com/whop/api/resources/transfers/types/ListRecipientsTransfersResponse.java new file mode 100644 index 00000000..e600d0d5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/ListRecipientsTransfersResponse.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListRecipientsTransfersResponse.Builder.class) +public final class ListRecipientsTransfersResponse { + private final List data; + + private final ListRecipientsTransfersResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListRecipientsTransfersResponse( + List data, + ListRecipientsTransfersResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListRecipientsTransfersResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListRecipientsTransfersResponse && equalTo((ListRecipientsTransfersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListRecipientsTransfersResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListRecipientsTransfersResponsePageInfo pageInfo); + + Builder from(ListRecipientsTransfersResponse other); + } + + public interface _FinalStage { + ListRecipientsTransfersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ListRecipientsTransfersResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListRecipientsTransfersResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListRecipientsTransfersResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListRecipientsTransfersResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ListRecipientsTransfersResponseDataItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListRecipientsTransfersResponse build() { + return new ListRecipientsTransfersResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/ListRecipientsTransfersResponseDataItem.java b/src/main/java/com/whop/api/resources/transfers/types/ListRecipientsTransfersResponseDataItem.java new file mode 100644 index 00000000..cbf0deb5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/ListRecipientsTransfersResponseDataItem.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ListRecipientsTransfersResponseDataItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ListRecipientsTransfersResponseDataItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ListRecipientsTransfersResponseDataItem user(ListRecipientsTransfersResponseDataItemUser value) { + return new ListRecipientsTransfersResponseDataItem(new UserValue(value)); + } + + public static ListRecipientsTransfersResponseDataItem account( + ListRecipientsTransfersResponseDataItemAccount value) { + return new ListRecipientsTransfersResponseDataItem(new AccountValue(value)); + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean isAccount() { + return value instanceof AccountValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional getAccount() { + if (isAccount()) { + return Optional.of(((AccountValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListRecipientsTransfersResponseDataItem + && value.equals(((ListRecipientsTransfersResponseDataItem) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitUser(ListRecipientsTransfersResponseDataItemUser user); + + T visitAccount(ListRecipientsTransfersResponseDataItemAccount account); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "object", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(UserValue.class), @JsonSubTypes.Type(AccountValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("user") + @JsonIgnoreProperties("object") + private static final class UserValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "object", allowSetters = true) + private ListRecipientsTransfersResponseDataItemUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(ListRecipientsTransfersResponseDataItemUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ListRecipientsTransfersResponseDataItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("account") + @JsonIgnoreProperties("object") + private static final class AccountValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "object", allowSetters = true) + private ListRecipientsTransfersResponseDataItemAccount value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AccountValue() {} + + private AccountValue(ListRecipientsTransfersResponseDataItemAccount value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAccount(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountValue && equalTo((AccountValue) other); + } + + private boolean equalTo(AccountValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ListRecipientsTransfersResponseDataItem{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("object") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ListRecipientsTransfersResponseDataItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/ListRecipientsTransfersResponseDataItemAccount.java b/src/main/java/com/whop/api/resources/transfers/types/ListRecipientsTransfersResponseDataItemAccount.java new file mode 100644 index 00000000..6032e13e --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/ListRecipientsTransfersResponseDataItemAccount.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListRecipientsTransfersResponseDataItemAccount.Builder.class) +public final class ListRecipientsTransfersResponseDataItemAccount { + private final String id; + + private final Optional logoUrl; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private ListRecipientsTransfersResponseDataItemAccount( + String id, + Optional logoUrl, + Optional route, + Optional title, + Map additionalProperties) { + this.id = id; + this.logoUrl = logoUrl; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account logo URL. + */ + @JsonIgnore + public Optional getLogoUrl() { + if (logoUrl == null) { + return Optional.empty(); + } + return logoUrl; + } + + /** + * @return Account route. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Account display name. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo_url") + private Optional _getLogoUrl() { + return logoUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListRecipientsTransfersResponseDataItemAccount + && equalTo((ListRecipientsTransfersResponseDataItemAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListRecipientsTransfersResponseDataItemAccount other) { + return id.equals(other.id) + && logoUrl.equals(other.logoUrl) + && route.equals(other.route) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.logoUrl, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(ListRecipientsTransfersResponseDataItemAccount other); + } + + public interface _FinalStage { + ListRecipientsTransfersResponseDataItemAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account logo URL.

+ */ + _FinalStage logoUrl(Optional logoUrl); + + _FinalStage logoUrl(String logoUrl); + + _FinalStage logoUrl(Nullable logoUrl); + + /** + *

Account route.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

Account display name.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional title = Optional.empty(); + + private Optional route = Optional.empty(); + + private Optional logoUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListRecipientsTransfersResponseDataItemAccount other) { + id(other.getId()); + logoUrl(other.getLogoUrl()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID.

+ *

Account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Account display name.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Account route.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + /** + *

Account logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(Nullable logoUrl) { + if (logoUrl.isNull()) { + this.logoUrl = null; + } else if (logoUrl.isEmpty()) { + this.logoUrl = Optional.empty(); + } else { + this.logoUrl = Optional.of(logoUrl.get()); + } + return this; + } + + /** + *

Account logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(String logoUrl) { + this.logoUrl = Optional.ofNullable(logoUrl); + return this; + } + + /** + *

Account logo URL.

+ */ + @java.lang.Override + @JsonSetter(value = "logo_url", nulls = Nulls.SKIP) + public _FinalStage logoUrl(Optional logoUrl) { + this.logoUrl = logoUrl; + return this; + } + + @java.lang.Override + public ListRecipientsTransfersResponseDataItemAccount build() { + return new ListRecipientsTransfersResponseDataItemAccount(id, logoUrl, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/ListRecipientsTransfersResponseDataItemUser.java b/src/main/java/com/whop/api/resources/transfers/types/ListRecipientsTransfersResponseDataItemUser.java new file mode 100644 index 00000000..e76d1f95 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/ListRecipientsTransfersResponseDataItemUser.java @@ -0,0 +1,348 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListRecipientsTransfersResponseDataItemUser.Builder.class) +public final class ListRecipientsTransfersResponseDataItemUser { + private final String id; + + private final Optional name; + + private final Optional profilePictureUrl; + + private final Optional username; + + private final Map additionalProperties; + + private ListRecipientsTransfersResponseDataItemUser( + String id, + Optional name, + Optional profilePictureUrl, + Optional username, + Map additionalProperties) { + this.id = id; + this.name = name; + this.profilePictureUrl = profilePictureUrl; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User profile image URL. + */ + @JsonIgnore + public Optional getProfilePictureUrl() { + if (profilePictureUrl == null) { + return Optional.empty(); + } + return profilePictureUrl; + } + + /** + * @return User's username. + */ + @JsonIgnore + public Optional getUsername() { + if (username == null) { + return Optional.empty(); + } + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("profile_picture_url") + private Optional _getProfilePictureUrl() { + return profilePictureUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("username") + private Optional _getUsername() { + return username; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListRecipientsTransfersResponseDataItemUser + && equalTo((ListRecipientsTransfersResponseDataItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListRecipientsTransfersResponseDataItemUser other) { + return id.equals(other.id) + && name.equals(other.name) + && profilePictureUrl.equals(other.profilePictureUrl) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.profilePictureUrl, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(ListRecipientsTransfersResponseDataItemUser other); + } + + public interface _FinalStage { + ListRecipientsTransfersResponseDataItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

User profile image URL.

+ */ + _FinalStage profilePictureUrl(Optional profilePictureUrl); + + _FinalStage profilePictureUrl(String profilePictureUrl); + + _FinalStage profilePictureUrl(Nullable profilePictureUrl); + + /** + *

User's username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + + _FinalStage username(Nullable username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional username = Optional.empty(); + + private Optional profilePictureUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListRecipientsTransfersResponseDataItemUser other) { + id(other.getId()); + name(other.getName()); + profilePictureUrl(other.getProfilePictureUrl()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(Nullable username) { + if (username.isNull()) { + this.username = null; + } else if (username.isEmpty()) { + this.username = Optional.empty(); + } else { + this.username = Optional.of(username.get()); + } + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

User's username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

User profile image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profilePictureUrl(Nullable profilePictureUrl) { + if (profilePictureUrl.isNull()) { + this.profilePictureUrl = null; + } else if (profilePictureUrl.isEmpty()) { + this.profilePictureUrl = Optional.empty(); + } else { + this.profilePictureUrl = Optional.of(profilePictureUrl.get()); + } + return this; + } + + /** + *

User profile image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profilePictureUrl(String profilePictureUrl) { + this.profilePictureUrl = Optional.ofNullable(profilePictureUrl); + return this; + } + + /** + *

User profile image URL.

+ */ + @java.lang.Override + @JsonSetter(value = "profile_picture_url", nulls = Nulls.SKIP) + public _FinalStage profilePictureUrl(Optional profilePictureUrl) { + this.profilePictureUrl = profilePictureUrl; + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ListRecipientsTransfersResponseDataItemUser build() { + return new ListRecipientsTransfersResponseDataItemUser( + id, name, profilePictureUrl, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/ListRecipientsTransfersResponsePageInfo.java b/src/main/java/com/whop/api/resources/transfers/types/ListRecipientsTransfersResponsePageInfo.java new file mode 100644 index 00000000..01b90e7e --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/ListRecipientsTransfersResponsePageInfo.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListRecipientsTransfersResponsePageInfo.Builder.class) +public final class ListRecipientsTransfersResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListRecipientsTransfersResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListRecipientsTransfersResponsePageInfo + && equalTo((ListRecipientsTransfersResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListRecipientsTransfersResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListRecipientsTransfersResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListRecipientsTransfersResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListRecipientsTransfersResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListRecipientsTransfersResponsePageInfo build() { + return new ListRecipientsTransfersResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/ListTransfersRequestDirection.java b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersRequestDirection.java new file mode 100644 index 00000000..b7a68ddd --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListTransfersRequestDirection { + public static final ListTransfersRequestDirection ASC = new ListTransfersRequestDirection(Value.ASC, "asc"); + + public static final ListTransfersRequestDirection DESC = new ListTransfersRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListTransfersRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListTransfersRequestDirection + && this.string.equals(((ListTransfersRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListTransfersRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListTransfersRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/ListTransfersRequestOrder.java b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersRequestOrder.java new file mode 100644 index 00000000..61e8415a --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersRequestOrder.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListTransfersRequestOrder { + public static final ListTransfersRequestOrder AMOUNT = new ListTransfersRequestOrder(Value.AMOUNT, "amount"); + + public static final ListTransfersRequestOrder CREATED_AT = + new ListTransfersRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListTransfersRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListTransfersRequestOrder + && this.string.equals(((ListTransfersRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AMOUNT: + return visitor.visitAmount(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListTransfersRequestOrder valueOf(String value) { + switch (value) { + case "amount": + return AMOUNT; + case "created_at": + return CREATED_AT; + default: + return new ListTransfersRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + AMOUNT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitAmount(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponse.java b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponse.java new file mode 100644 index 00000000..97fd416d --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponse.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListTransfersResponse.Builder.class) +public final class ListTransfersResponse { + private final List data; + + private final ListTransfersResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListTransfersResponse( + List data, + ListTransfersResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListTransfersResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListTransfersResponse && equalTo((ListTransfersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListTransfersResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListTransfersResponsePageInfo pageInfo); + + Builder from(ListTransfersResponse other); + } + + public interface _FinalStage { + ListTransfersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ListTransfersResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListTransfersResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListTransfersResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListTransfersResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ListTransfersResponseDataItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListTransfersResponse build() { + return new ListTransfersResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponseDataItem.java b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponseDataItem.java new file mode 100644 index 00000000..10eb9504 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponseDataItem.java @@ -0,0 +1,914 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListTransfersResponseDataItem.Builder.class) +public final class ListTransfersResponseDataItem { + private final double amount; + + private final OffsetDateTime createdAt; + + private final Optional createdByUser; + + private final String currency; + + private final String destinationLedgerAccountId; + + private final Optional failedAt; + + private final Optional failureCode; + + private final Optional failureReason; + + private final Optional feeAmount; + + private final String id; + + private final Optional> metadata; + + private final Optional notes; + + private final ListTransfersResponseDataItemObject object; + + private final String originLedgerAccountId; + + private final ListTransfersResponseDataItemStatus status; + + private final Map additionalProperties; + + private ListTransfersResponseDataItem( + double amount, + OffsetDateTime createdAt, + Optional createdByUser, + String currency, + String destinationLedgerAccountId, + Optional failedAt, + Optional failureCode, + Optional failureReason, + Optional feeAmount, + String id, + Optional> metadata, + Optional notes, + ListTransfersResponseDataItemObject object, + String originLedgerAccountId, + ListTransfersResponseDataItemStatus status, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.createdByUser = createdByUser; + this.currency = currency; + this.destinationLedgerAccountId = destinationLedgerAccountId; + this.failedAt = failedAt; + this.failureCode = failureCode; + this.failureReason = failureReason; + this.feeAmount = feeAmount; + this.id = id; + this.metadata = metadata; + this.notes = notes; + this.object = object; + this.originLedgerAccountId = originLedgerAccountId; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Transfer amount. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return When the transfer was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable. + */ + @JsonIgnore + public Optional getCreatedByUser() { + if (createdByUser == null) { + return Optional.empty(); + } + return createdByUser; + } + + /** + * @return Transfer currency. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Destination ledger account ID. + */ + @JsonProperty("destination_ledger_account_id") + public String getDestinationLedgerAccountId() { + return destinationLedgerAccountId; + } + + /** + * @return When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailedAt() { + if (failedAt == null) { + return Optional.empty(); + } + return failedAt; + } + + /** + * @return Machine-readable code for why the transfer failed. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailureCode() { + if (failureCode == null) { + return Optional.empty(); + } + return failureCode; + } + + /** + * @return Human-readable explanation of why the transfer failed. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailureReason() { + if (failureReason == null) { + return Optional.empty(); + } + return failureReason; + } + + /** + * @return Fee charged for the transfer. + */ + @JsonIgnore + public Optional getFeeAmount() { + if (feeAmount == null) { + return Optional.empty(); + } + return feeAmount; + } + + /** + * @return Transfer ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom metadata attached to the transfer. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Transfer note. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + /** + * @return The object type. + */ + @JsonProperty("object") + public ListTransfersResponseDataItemObject getObject() { + return object; + } + + /** + * @return Source ledger account ID. + */ + @JsonProperty("origin_ledger_account_id") + public String getOriginLedgerAccountId() { + return originLedgerAccountId; + } + + /** + * @return Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded. + */ + @JsonProperty("status") + public ListTransfersResponseDataItemStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_by_user") + private Optional _getCreatedByUser() { + return createdByUser; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failed_at") + private Optional _getFailedAt() { + return failedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_code") + private Optional _getFailureCode() { + return failureCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_reason") + private Optional _getFailureReason() { + return failureReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fee_amount") + private Optional _getFeeAmount() { + return feeAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListTransfersResponseDataItem && equalTo((ListTransfersResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListTransfersResponseDataItem other) { + return amount == other.amount + && createdAt.equals(other.createdAt) + && createdByUser.equals(other.createdByUser) + && currency.equals(other.currency) + && destinationLedgerAccountId.equals(other.destinationLedgerAccountId) + && failedAt.equals(other.failedAt) + && failureCode.equals(other.failureCode) + && failureReason.equals(other.failureReason) + && feeAmount.equals(other.feeAmount) + && id.equals(other.id) + && metadata.equals(other.metadata) + && notes.equals(other.notes) + && object.equals(other.object) + && originLedgerAccountId.equals(other.originLedgerAccountId) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.createdByUser, + this.currency, + this.destinationLedgerAccountId, + this.failedAt, + this.failureCode, + this.failureReason, + this.feeAmount, + this.id, + this.metadata, + this.notes, + this.object, + this.originLedgerAccountId, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

Transfer amount.

+ */ + CreatedAtStage amount(double amount); + + Builder from(ListTransfersResponseDataItem other); + } + + public interface CreatedAtStage { + /** + *

When the transfer was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

Transfer currency.

+ */ + DestinationLedgerAccountIdStage currency(@NotNull String currency); + } + + public interface DestinationLedgerAccountIdStage { + /** + *

Destination ledger account ID.

+ */ + IdStage destinationLedgerAccountId(@NotNull String destinationLedgerAccountId); + } + + public interface IdStage { + /** + *

Transfer ID.

+ */ + ObjectStage id(@NotNull String id); + } + + public interface ObjectStage { + /** + *

The object type.

+ */ + OriginLedgerAccountIdStage object(@NotNull ListTransfersResponseDataItemObject object); + } + + public interface OriginLedgerAccountIdStage { + /** + *

Source ledger account ID.

+ */ + StatusStage originLedgerAccountId(@NotNull String originLedgerAccountId); + } + + public interface StatusStage { + /** + *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ */ + _FinalStage status(@NotNull ListTransfersResponseDataItemStatus status); + } + + public interface _FinalStage { + ListTransfersResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ */ + _FinalStage createdByUser(Optional createdByUser); + + _FinalStage createdByUser(ListTransfersResponseDataItemCreatedByUser createdByUser); + + _FinalStage createdByUser(Nullable createdByUser); + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ */ + _FinalStage failedAt(Optional failedAt); + + _FinalStage failedAt(OffsetDateTime failedAt); + + _FinalStage failedAt(Nullable failedAt); + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ */ + _FinalStage failureCode(Optional failureCode); + + _FinalStage failureCode(String failureCode); + + _FinalStage failureCode(Nullable failureCode); + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ */ + _FinalStage failureReason(Optional failureReason); + + _FinalStage failureReason(String failureReason); + + _FinalStage failureReason(Nullable failureReason); + + /** + *

Fee charged for the transfer.

+ */ + _FinalStage feeAmount(Optional feeAmount); + + _FinalStage feeAmount(Double feeAmount); + + _FinalStage feeAmount(Nullable feeAmount); + + /** + *

Custom metadata attached to the transfer.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Transfer note.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + CurrencyStage, + DestinationLedgerAccountIdStage, + IdStage, + ObjectStage, + OriginLedgerAccountIdStage, + StatusStage, + _FinalStage { + private double amount; + + private OffsetDateTime createdAt; + + private String currency; + + private String destinationLedgerAccountId; + + private String id; + + private ListTransfersResponseDataItemObject object; + + private String originLedgerAccountId; + + private ListTransfersResponseDataItemStatus status; + + private Optional notes = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional feeAmount = Optional.empty(); + + private Optional failureReason = Optional.empty(); + + private Optional failureCode = Optional.empty(); + + private Optional failedAt = Optional.empty(); + + private Optional createdByUser = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListTransfersResponseDataItem other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + createdByUser(other.getCreatedByUser()); + currency(other.getCurrency()); + destinationLedgerAccountId(other.getDestinationLedgerAccountId()); + failedAt(other.getFailedAt()); + failureCode(other.getFailureCode()); + failureReason(other.getFailureReason()); + feeAmount(other.getFeeAmount()); + id(other.getId()); + metadata(other.getMetadata()); + notes(other.getNotes()); + object(other.getObject()); + originLedgerAccountId(other.getOriginLedgerAccountId()); + status(other.getStatus()); + return this; + } + + /** + *

Transfer amount.

+ *

Transfer amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

When the transfer was created.

+ *

When the transfer was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Transfer currency.

+ *

Transfer currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DestinationLedgerAccountIdStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Destination ledger account ID.

+ *

Destination ledger account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination_ledger_account_id") + public IdStage destinationLedgerAccountId(@NotNull String destinationLedgerAccountId) { + this.destinationLedgerAccountId = + Objects.requireNonNull(destinationLedgerAccountId, "destinationLedgerAccountId must not be null"); + return this; + } + + /** + *

Transfer ID.

+ *

Transfer ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The object type.

+ *

The object type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("object") + public OriginLedgerAccountIdStage object(@NotNull ListTransfersResponseDataItemObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Source ledger account ID.

+ *

Source ledger account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("origin_ledger_account_id") + public StatusStage originLedgerAccountId(@NotNull String originLedgerAccountId) { + this.originLedgerAccountId = + Objects.requireNonNull(originLedgerAccountId, "originLedgerAccountId must not be null"); + return this; + } + + /** + *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull ListTransfersResponseDataItemStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Transfer note.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Transfer note.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Transfer note.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Fee charged for the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeAmount(Nullable feeAmount) { + if (feeAmount.isNull()) { + this.feeAmount = null; + } else if (feeAmount.isEmpty()) { + this.feeAmount = Optional.empty(); + } else { + this.feeAmount = Optional.of(feeAmount.get()); + } + return this; + } + + /** + *

Fee charged for the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeAmount(Double feeAmount) { + this.feeAmount = Optional.ofNullable(feeAmount); + return this; + } + + /** + *

Fee charged for the transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "fee_amount", nulls = Nulls.SKIP) + public _FinalStage feeAmount(Optional feeAmount) { + this.feeAmount = feeAmount; + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureReason(Nullable failureReason) { + if (failureReason.isNull()) { + this.failureReason = null; + } else if (failureReason.isEmpty()) { + this.failureReason = Optional.empty(); + } else { + this.failureReason = Optional.of(failureReason.get()); + } + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureReason(String failureReason) { + this.failureReason = Optional.ofNullable(failureReason); + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_reason", nulls = Nulls.SKIP) + public _FinalStage failureReason(Optional failureReason) { + this.failureReason = failureReason; + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureCode(Nullable failureCode) { + if (failureCode.isNull()) { + this.failureCode = null; + } else if (failureCode.isEmpty()) { + this.failureCode = Optional.empty(); + } else { + this.failureCode = Optional.of(failureCode.get()); + } + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureCode(String failureCode) { + this.failureCode = Optional.ofNullable(failureCode); + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_code", nulls = Nulls.SKIP) + public _FinalStage failureCode(Optional failureCode) { + this.failureCode = failureCode; + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failedAt(Nullable failedAt) { + if (failedAt.isNull()) { + this.failedAt = null; + } else if (failedAt.isEmpty()) { + this.failedAt = Optional.empty(); + } else { + this.failedAt = Optional.of(failedAt.get()); + } + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failedAt(OffsetDateTime failedAt) { + this.failedAt = Optional.ofNullable(failedAt); + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failed_at", nulls = Nulls.SKIP) + public _FinalStage failedAt(Optional failedAt) { + this.failedAt = failedAt; + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdByUser(Nullable createdByUser) { + if (createdByUser.isNull()) { + this.createdByUser = null; + } else if (createdByUser.isEmpty()) { + this.createdByUser = Optional.empty(); + } else { + this.createdByUser = Optional.of(createdByUser.get()); + } + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdByUser(ListTransfersResponseDataItemCreatedByUser createdByUser) { + this.createdByUser = Optional.ofNullable(createdByUser); + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ */ + @java.lang.Override + @JsonSetter(value = "created_by_user", nulls = Nulls.SKIP) + public _FinalStage createdByUser(Optional createdByUser) { + this.createdByUser = createdByUser; + return this; + } + + @java.lang.Override + public ListTransfersResponseDataItem build() { + return new ListTransfersResponseDataItem( + amount, + createdAt, + createdByUser, + currency, + destinationLedgerAccountId, + failedAt, + failureCode, + failureReason, + feeAmount, + id, + metadata, + notes, + object, + originLedgerAccountId, + status, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponseDataItemCreatedByUser.java b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponseDataItemCreatedByUser.java new file mode 100644 index 00000000..7e90c58f --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponseDataItemCreatedByUser.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListTransfersResponseDataItemCreatedByUser.Builder.class) +public final class ListTransfersResponseDataItemCreatedByUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private ListTransfersResponseDataItemCreatedByUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListTransfersResponseDataItemCreatedByUser + && equalTo((ListTransfersResponseDataItemCreatedByUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListTransfersResponseDataItemCreatedByUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(ListTransfersResponseDataItemCreatedByUser other); + } + + public interface UsernameStage { + /** + *

User's username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + ListTransfersResponseDataItemCreatedByUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListTransfersResponseDataItemCreatedByUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ListTransfersResponseDataItemCreatedByUser build() { + return new ListTransfersResponseDataItemCreatedByUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponseDataItemObject.java b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponseDataItemObject.java new file mode 100644 index 00000000..e9758431 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponseDataItemObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListTransfersResponseDataItemObject { + public static final ListTransfersResponseDataItemObject TRANSFER = + new ListTransfersResponseDataItemObject(Value.TRANSFER, "transfer"); + + private final Value value; + + private final String string; + + ListTransfersResponseDataItemObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListTransfersResponseDataItemObject + && this.string.equals(((ListTransfersResponseDataItemObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TRANSFER: + return visitor.visitTransfer(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListTransfersResponseDataItemObject valueOf(String value) { + switch (value) { + case "transfer": + return TRANSFER; + default: + return new ListTransfersResponseDataItemObject(Value.UNKNOWN, value); + } + } + + public enum Value { + TRANSFER, + + UNKNOWN + } + + public interface Visitor { + T visitTransfer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponseDataItemStatus.java b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponseDataItemStatus.java new file mode 100644 index 00000000..d351f651 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponseDataItemStatus.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListTransfersResponseDataItemStatus { + public static final ListTransfersResponseDataItemStatus FAILED = + new ListTransfersResponseDataItemStatus(Value.FAILED, "failed"); + + public static final ListTransfersResponseDataItemStatus SUCCEEDED = + new ListTransfersResponseDataItemStatus(Value.SUCCEEDED, "succeeded"); + + public static final ListTransfersResponseDataItemStatus PROCESSING = + new ListTransfersResponseDataItemStatus(Value.PROCESSING, "processing"); + + private final Value value; + + private final String string; + + ListTransfersResponseDataItemStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListTransfersResponseDataItemStatus + && this.string.equals(((ListTransfersResponseDataItemStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case SUCCEEDED: + return visitor.visitSucceeded(); + case PROCESSING: + return visitor.visitProcessing(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListTransfersResponseDataItemStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "succeeded": + return SUCCEEDED; + case "processing": + return PROCESSING; + default: + return new ListTransfersResponseDataItemStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PROCESSING, + + SUCCEEDED, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitProcessing(); + + T visitSucceeded(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponsePageInfo.java b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponsePageInfo.java new file mode 100644 index 00000000..80c9789c --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/ListTransfersResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListTransfersResponsePageInfo.Builder.class) +public final class ListTransfersResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListTransfersResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListTransfersResponsePageInfo && equalTo((ListTransfersResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListTransfersResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListTransfersResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListTransfersResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListTransfersResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListTransfersResponsePageInfo build() { + return new ListTransfersResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayload.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayload.java new file mode 100644 index 00000000..eedc8b2a --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayload.java @@ -0,0 +1,478 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferCompletedPayload.Builder.class) +public final class PostTransferCompletedPayload { + private final Optional accountId; + + private final PostTransferCompletedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostTransferCompletedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostTransferCompletedPayloadType type; + + private final Map additionalProperties; + + private PostTransferCompletedPayload( + Optional accountId, + PostTransferCompletedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostTransferCompletedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostTransferCompletedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostTransferCompletedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + /** + * @return A transfer of credit between two ledger accounts. + */ + @JsonProperty("data") + public PostTransferCompletedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostTransferCompletedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCompletedPayload && equalTo((PostTransferCompletedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferCompletedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostTransferCompletedPayloadApiVersion apiVersion); + + Builder from(PostTransferCompletedPayload other); + } + + public interface DataStage { + /** + *

A transfer of credit between two ledger accounts.

+ */ + IdStage data(@NotNull PostTransferCompletedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostTransferCompletedPayloadType type); + } + + public interface _FinalStage { + PostTransferCompletedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostTransferCompletedPayloadApiVersion apiVersion; + + private PostTransferCompletedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostTransferCompletedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferCompletedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostTransferCompletedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + /** + *

A transfer of credit between two ledger accounts.

+ *

A transfer of credit between two ledger accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostTransferCompletedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostTransferCompletedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostTransferCompletedPayload build() { + return new PostTransferCompletedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadApiVersion.java new file mode 100644 index 00000000..0a1ba19e --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostTransferCompletedPayloadApiVersion { + public static final PostTransferCompletedPayloadApiVersion V1 = + new PostTransferCompletedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostTransferCompletedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostTransferCompletedPayloadApiVersion + && this.string.equals(((PostTransferCompletedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostTransferCompletedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostTransferCompletedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadData.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadData.java new file mode 100644 index 00000000..d2750c5a --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadData.java @@ -0,0 +1,991 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferCompletedPayloadData.Builder.class) +public final class PostTransferCompletedPayloadData { + private final double amount; + + private final OffsetDateTime createdAt; + + private final Optional createdByUser; + + private final String currency; + + private final PostTransferCompletedPayloadDataDestination destination; + + private final String destinationLedgerAccountId; + + private final Optional failedAt; + + private final Optional failureCode; + + private final Optional failureReason; + + private final Optional feeAmount; + + private final String id; + + private final Optional> metadata; + + private final Optional notes; + + private final PostTransferCompletedPayloadDataObject object; + + private final PostTransferCompletedPayloadDataOrigin origin; + + private final String originLedgerAccountId; + + private final PostTransferCompletedPayloadDataStatus status; + + private final Map additionalProperties; + + private PostTransferCompletedPayloadData( + double amount, + OffsetDateTime createdAt, + Optional createdByUser, + String currency, + PostTransferCompletedPayloadDataDestination destination, + String destinationLedgerAccountId, + Optional failedAt, + Optional failureCode, + Optional failureReason, + Optional feeAmount, + String id, + Optional> metadata, + Optional notes, + PostTransferCompletedPayloadDataObject object, + PostTransferCompletedPayloadDataOrigin origin, + String originLedgerAccountId, + PostTransferCompletedPayloadDataStatus status, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.createdByUser = createdByUser; + this.currency = currency; + this.destination = destination; + this.destinationLedgerAccountId = destinationLedgerAccountId; + this.failedAt = failedAt; + this.failureCode = failureCode; + this.failureReason = failureReason; + this.feeAmount = feeAmount; + this.id = id; + this.metadata = metadata; + this.notes = notes; + this.object = object; + this.origin = origin; + this.originLedgerAccountId = originLedgerAccountId; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Transfer amount. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return When the transfer was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable. + */ + @JsonIgnore + public Optional getCreatedByUser() { + if (createdByUser == null) { + return Optional.empty(); + } + return createdByUser; + } + + /** + * @return Transfer currency. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Account or user receiving funds. + */ + @JsonProperty("destination") + public PostTransferCompletedPayloadDataDestination getDestination() { + return destination; + } + + /** + * @return Destination ledger account ID. + */ + @JsonProperty("destination_ledger_account_id") + public String getDestinationLedgerAccountId() { + return destinationLedgerAccountId; + } + + /** + * @return When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailedAt() { + if (failedAt == null) { + return Optional.empty(); + } + return failedAt; + } + + /** + * @return Machine-readable code for why the transfer failed. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailureCode() { + if (failureCode == null) { + return Optional.empty(); + } + return failureCode; + } + + /** + * @return Human-readable explanation of why the transfer failed. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailureReason() { + if (failureReason == null) { + return Optional.empty(); + } + return failureReason; + } + + /** + * @return Fee charged for the transfer. + */ + @JsonIgnore + public Optional getFeeAmount() { + if (feeAmount == null) { + return Optional.empty(); + } + return feeAmount; + } + + /** + * @return Transfer ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom metadata attached to the transfer. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Transfer note. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + /** + * @return The object type. Discriminates the create response from a send or a claim link. + */ + @JsonProperty("object") + public PostTransferCompletedPayloadDataObject getObject() { + return object; + } + + /** + * @return Account or user sending funds. + */ + @JsonProperty("origin") + public PostTransferCompletedPayloadDataOrigin getOrigin() { + return origin; + } + + /** + * @return Source ledger account ID. + */ + @JsonProperty("origin_ledger_account_id") + public String getOriginLedgerAccountId() { + return originLedgerAccountId; + } + + /** + * @return Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded. + */ + @JsonProperty("status") + public PostTransferCompletedPayloadDataStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_by_user") + private Optional _getCreatedByUser() { + return createdByUser; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failed_at") + private Optional _getFailedAt() { + return failedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_code") + private Optional _getFailureCode() { + return failureCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_reason") + private Optional _getFailureReason() { + return failureReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fee_amount") + private Optional _getFeeAmount() { + return feeAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCompletedPayloadData && equalTo((PostTransferCompletedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferCompletedPayloadData other) { + return amount == other.amount + && createdAt.equals(other.createdAt) + && createdByUser.equals(other.createdByUser) + && currency.equals(other.currency) + && destination.equals(other.destination) + && destinationLedgerAccountId.equals(other.destinationLedgerAccountId) + && failedAt.equals(other.failedAt) + && failureCode.equals(other.failureCode) + && failureReason.equals(other.failureReason) + && feeAmount.equals(other.feeAmount) + && id.equals(other.id) + && metadata.equals(other.metadata) + && notes.equals(other.notes) + && object.equals(other.object) + && origin.equals(other.origin) + && originLedgerAccountId.equals(other.originLedgerAccountId) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.createdByUser, + this.currency, + this.destination, + this.destinationLedgerAccountId, + this.failedAt, + this.failureCode, + this.failureReason, + this.feeAmount, + this.id, + this.metadata, + this.notes, + this.object, + this.origin, + this.originLedgerAccountId, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

Transfer amount.

+ */ + CreatedAtStage amount(double amount); + + Builder from(PostTransferCompletedPayloadData other); + } + + public interface CreatedAtStage { + /** + *

When the transfer was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

Transfer currency.

+ */ + DestinationStage currency(@NotNull String currency); + } + + public interface DestinationStage { + /** + *

Account or user receiving funds.

+ */ + DestinationLedgerAccountIdStage destination(@NotNull PostTransferCompletedPayloadDataDestination destination); + } + + public interface DestinationLedgerAccountIdStage { + /** + *

Destination ledger account ID.

+ */ + IdStage destinationLedgerAccountId(@NotNull String destinationLedgerAccountId); + } + + public interface IdStage { + /** + *

Transfer ID.

+ */ + ObjectStage id(@NotNull String id); + } + + public interface ObjectStage { + /** + *

The object type. Discriminates the create response from a send or a claim link.

+ */ + OriginStage object(@NotNull PostTransferCompletedPayloadDataObject object); + } + + public interface OriginStage { + /** + *

Account or user sending funds.

+ */ + OriginLedgerAccountIdStage origin(@NotNull PostTransferCompletedPayloadDataOrigin origin); + } + + public interface OriginLedgerAccountIdStage { + /** + *

Source ledger account ID.

+ */ + StatusStage originLedgerAccountId(@NotNull String originLedgerAccountId); + } + + public interface StatusStage { + /** + *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ */ + _FinalStage status(@NotNull PostTransferCompletedPayloadDataStatus status); + } + + public interface _FinalStage { + PostTransferCompletedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ */ + _FinalStage createdByUser(Optional createdByUser); + + _FinalStage createdByUser(PostTransferCompletedPayloadDataCreatedByUser createdByUser); + + _FinalStage createdByUser(Nullable createdByUser); + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ */ + _FinalStage failedAt(Optional failedAt); + + _FinalStage failedAt(OffsetDateTime failedAt); + + _FinalStage failedAt(Nullable failedAt); + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ */ + _FinalStage failureCode(Optional failureCode); + + _FinalStage failureCode(String failureCode); + + _FinalStage failureCode(Nullable failureCode); + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ */ + _FinalStage failureReason(Optional failureReason); + + _FinalStage failureReason(String failureReason); + + _FinalStage failureReason(Nullable failureReason); + + /** + *

Fee charged for the transfer.

+ */ + _FinalStage feeAmount(Optional feeAmount); + + _FinalStage feeAmount(Double feeAmount); + + _FinalStage feeAmount(Nullable feeAmount); + + /** + *

Custom metadata attached to the transfer.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Transfer note.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + CurrencyStage, + DestinationStage, + DestinationLedgerAccountIdStage, + IdStage, + ObjectStage, + OriginStage, + OriginLedgerAccountIdStage, + StatusStage, + _FinalStage { + private double amount; + + private OffsetDateTime createdAt; + + private String currency; + + private PostTransferCompletedPayloadDataDestination destination; + + private String destinationLedgerAccountId; + + private String id; + + private PostTransferCompletedPayloadDataObject object; + + private PostTransferCompletedPayloadDataOrigin origin; + + private String originLedgerAccountId; + + private PostTransferCompletedPayloadDataStatus status; + + private Optional notes = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional feeAmount = Optional.empty(); + + private Optional failureReason = Optional.empty(); + + private Optional failureCode = Optional.empty(); + + private Optional failedAt = Optional.empty(); + + private Optional createdByUser = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferCompletedPayloadData other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + createdByUser(other.getCreatedByUser()); + currency(other.getCurrency()); + destination(other.getDestination()); + destinationLedgerAccountId(other.getDestinationLedgerAccountId()); + failedAt(other.getFailedAt()); + failureCode(other.getFailureCode()); + failureReason(other.getFailureReason()); + feeAmount(other.getFeeAmount()); + id(other.getId()); + metadata(other.getMetadata()); + notes(other.getNotes()); + object(other.getObject()); + origin(other.getOrigin()); + originLedgerAccountId(other.getOriginLedgerAccountId()); + status(other.getStatus()); + return this; + } + + /** + *

Transfer amount.

+ *

Transfer amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

When the transfer was created.

+ *

When the transfer was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Transfer currency.

+ *

Transfer currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DestinationStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Account or user receiving funds.

+ *

Account or user receiving funds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination") + public DestinationLedgerAccountIdStage destination( + @NotNull PostTransferCompletedPayloadDataDestination destination) { + this.destination = Objects.requireNonNull(destination, "destination must not be null"); + return this; + } + + /** + *

Destination ledger account ID.

+ *

Destination ledger account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination_ledger_account_id") + public IdStage destinationLedgerAccountId(@NotNull String destinationLedgerAccountId) { + this.destinationLedgerAccountId = + Objects.requireNonNull(destinationLedgerAccountId, "destinationLedgerAccountId must not be null"); + return this; + } + + /** + *

Transfer ID.

+ *

Transfer ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The object type. Discriminates the create response from a send or a claim link.

+ *

The object type. Discriminates the create response from a send or a claim link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("object") + public OriginStage object(@NotNull PostTransferCompletedPayloadDataObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Account or user sending funds.

+ *

Account or user sending funds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("origin") + public OriginLedgerAccountIdStage origin(@NotNull PostTransferCompletedPayloadDataOrigin origin) { + this.origin = Objects.requireNonNull(origin, "origin must not be null"); + return this; + } + + /** + *

Source ledger account ID.

+ *

Source ledger account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("origin_ledger_account_id") + public StatusStage originLedgerAccountId(@NotNull String originLedgerAccountId) { + this.originLedgerAccountId = + Objects.requireNonNull(originLedgerAccountId, "originLedgerAccountId must not be null"); + return this; + } + + /** + *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull PostTransferCompletedPayloadDataStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Transfer note.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Transfer note.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Transfer note.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Fee charged for the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeAmount(Nullable feeAmount) { + if (feeAmount.isNull()) { + this.feeAmount = null; + } else if (feeAmount.isEmpty()) { + this.feeAmount = Optional.empty(); + } else { + this.feeAmount = Optional.of(feeAmount.get()); + } + return this; + } + + /** + *

Fee charged for the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeAmount(Double feeAmount) { + this.feeAmount = Optional.ofNullable(feeAmount); + return this; + } + + /** + *

Fee charged for the transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "fee_amount", nulls = Nulls.SKIP) + public _FinalStage feeAmount(Optional feeAmount) { + this.feeAmount = feeAmount; + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureReason(Nullable failureReason) { + if (failureReason.isNull()) { + this.failureReason = null; + } else if (failureReason.isEmpty()) { + this.failureReason = Optional.empty(); + } else { + this.failureReason = Optional.of(failureReason.get()); + } + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureReason(String failureReason) { + this.failureReason = Optional.ofNullable(failureReason); + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_reason", nulls = Nulls.SKIP) + public _FinalStage failureReason(Optional failureReason) { + this.failureReason = failureReason; + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureCode(Nullable failureCode) { + if (failureCode.isNull()) { + this.failureCode = null; + } else if (failureCode.isEmpty()) { + this.failureCode = Optional.empty(); + } else { + this.failureCode = Optional.of(failureCode.get()); + } + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureCode(String failureCode) { + this.failureCode = Optional.ofNullable(failureCode); + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_code", nulls = Nulls.SKIP) + public _FinalStage failureCode(Optional failureCode) { + this.failureCode = failureCode; + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failedAt(Nullable failedAt) { + if (failedAt.isNull()) { + this.failedAt = null; + } else if (failedAt.isEmpty()) { + this.failedAt = Optional.empty(); + } else { + this.failedAt = Optional.of(failedAt.get()); + } + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failedAt(OffsetDateTime failedAt) { + this.failedAt = Optional.ofNullable(failedAt); + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failed_at", nulls = Nulls.SKIP) + public _FinalStage failedAt(Optional failedAt) { + this.failedAt = failedAt; + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdByUser(Nullable createdByUser) { + if (createdByUser.isNull()) { + this.createdByUser = null; + } else if (createdByUser.isEmpty()) { + this.createdByUser = Optional.empty(); + } else { + this.createdByUser = Optional.of(createdByUser.get()); + } + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdByUser(PostTransferCompletedPayloadDataCreatedByUser createdByUser) { + this.createdByUser = Optional.ofNullable(createdByUser); + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ */ + @java.lang.Override + @JsonSetter(value = "created_by_user", nulls = Nulls.SKIP) + public _FinalStage createdByUser(Optional createdByUser) { + this.createdByUser = createdByUser; + return this; + } + + @java.lang.Override + public PostTransferCompletedPayloadData build() { + return new PostTransferCompletedPayloadData( + amount, + createdAt, + createdByUser, + currency, + destination, + destinationLedgerAccountId, + failedAt, + failureCode, + failureReason, + feeAmount, + id, + metadata, + notes, + object, + origin, + originLedgerAccountId, + status, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataCreatedByUser.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataCreatedByUser.java new file mode 100644 index 00000000..1095867d --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataCreatedByUser.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferCompletedPayloadDataCreatedByUser.Builder.class) +public final class PostTransferCompletedPayloadDataCreatedByUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private PostTransferCompletedPayloadDataCreatedByUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCompletedPayloadDataCreatedByUser + && equalTo((PostTransferCompletedPayloadDataCreatedByUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferCompletedPayloadDataCreatedByUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(PostTransferCompletedPayloadDataCreatedByUser other); + } + + public interface UsernameStage { + /** + *

User's username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + PostTransferCompletedPayloadDataCreatedByUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferCompletedPayloadDataCreatedByUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public PostTransferCompletedPayloadDataCreatedByUser build() { + return new PostTransferCompletedPayloadDataCreatedByUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataDestination.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataDestination.java new file mode 100644 index 00000000..e3ef911c --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataDestination.java @@ -0,0 +1,224 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class PostTransferCompletedPayloadDataDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PostTransferCompletedPayloadDataDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PostTransferCompletedPayloadDataDestination company( + PostTransferCompletedPayloadDataDestinationCompany value) { + return new PostTransferCompletedPayloadDataDestination(new CompanyValue(value)); + } + + public static PostTransferCompletedPayloadDataDestination user( + PostTransferCompletedPayloadDataDestinationUser value) { + return new PostTransferCompletedPayloadDataDestination(new UserValue(value)); + } + + public boolean isCompany() { + return value instanceof CompanyValue; + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getCompany() { + if (isCompany()) { + return Optional.of(((CompanyValue) value).value); + } + return Optional.empty(); + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCompletedPayloadDataDestination + && value.equals(((PostTransferCompletedPayloadDataDestination) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitCompany(PostTransferCompletedPayloadDataDestinationCompany company); + + T visitUser(PostTransferCompletedPayloadDataDestinationUser user); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(CompanyValue.class), @JsonSubTypes.Type(UserValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("Company") + @JsonIgnoreProperties("typename") + private static final class CompanyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PostTransferCompletedPayloadDataDestinationCompany value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CompanyValue() {} + + private CompanyValue(PostTransferCompletedPayloadDataDestinationCompany value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCompany(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyValue && equalTo((CompanyValue) other); + } + + private boolean equalTo(CompanyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferCompletedPayloadDataDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("User") + @JsonIgnoreProperties("typename") + private static final class UserValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PostTransferCompletedPayloadDataDestinationUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(PostTransferCompletedPayloadDataDestinationUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferCompletedPayloadDataDestination{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferCompletedPayloadDataDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataDestinationCompany.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataDestinationCompany.java new file mode 100644 index 00000000..fe26ded3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataDestinationCompany.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferCompletedPayloadDataDestinationCompany.Builder.class) +public final class PostTransferCompletedPayloadDataDestinationCompany { + private final String id; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private PostTransferCompletedPayloadDataDestinationCompany( + String id, Optional route, Optional title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account route. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Account display name. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCompletedPayloadDataDestinationCompany + && equalTo((PostTransferCompletedPayloadDataDestinationCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferCompletedPayloadDataDestinationCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PostTransferCompletedPayloadDataDestinationCompany other); + } + + public interface _FinalStage { + PostTransferCompletedPayloadDataDestinationCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account route.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

Account display name.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional title = Optional.empty(); + + private Optional route = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferCompletedPayloadDataDestinationCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID.

+ *

Account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Account display name.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Account route.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + @java.lang.Override + public PostTransferCompletedPayloadDataDestinationCompany build() { + return new PostTransferCompletedPayloadDataDestinationCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataDestinationUser.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataDestinationUser.java new file mode 100644 index 00000000..eec70a31 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataDestinationUser.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferCompletedPayloadDataDestinationUser.Builder.class) +public final class PostTransferCompletedPayloadDataDestinationUser { + private final String id; + + private final Optional name; + + private final Optional username; + + private final Map additionalProperties; + + private PostTransferCompletedPayloadDataDestinationUser( + String id, Optional name, Optional username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public Optional getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCompletedPayloadDataDestinationUser + && equalTo((PostTransferCompletedPayloadDataDestinationUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferCompletedPayloadDataDestinationUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PostTransferCompletedPayloadDataDestinationUser other); + } + + public interface _FinalStage { + PostTransferCompletedPayloadDataDestinationUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

User's username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional username = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferCompletedPayloadDataDestinationUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

User's username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public PostTransferCompletedPayloadDataDestinationUser build() { + return new PostTransferCompletedPayloadDataDestinationUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataObject.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataObject.java new file mode 100644 index 00000000..48c037d2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostTransferCompletedPayloadDataObject { + public static final PostTransferCompletedPayloadDataObject TRANSFER = + new PostTransferCompletedPayloadDataObject(Value.TRANSFER, "transfer"); + + private final Value value; + + private final String string; + + PostTransferCompletedPayloadDataObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostTransferCompletedPayloadDataObject + && this.string.equals(((PostTransferCompletedPayloadDataObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TRANSFER: + return visitor.visitTransfer(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostTransferCompletedPayloadDataObject valueOf(String value) { + switch (value) { + case "transfer": + return TRANSFER; + default: + return new PostTransferCompletedPayloadDataObject(Value.UNKNOWN, value); + } + } + + public enum Value { + TRANSFER, + + UNKNOWN + } + + public interface Visitor { + T visitTransfer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataOrigin.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataOrigin.java new file mode 100644 index 00000000..8c054448 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataOrigin.java @@ -0,0 +1,222 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class PostTransferCompletedPayloadDataOrigin { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PostTransferCompletedPayloadDataOrigin(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PostTransferCompletedPayloadDataOrigin company(PostTransferCompletedPayloadDataOriginCompany value) { + return new PostTransferCompletedPayloadDataOrigin(new CompanyValue(value)); + } + + public static PostTransferCompletedPayloadDataOrigin user(PostTransferCompletedPayloadDataOriginUser value) { + return new PostTransferCompletedPayloadDataOrigin(new UserValue(value)); + } + + public boolean isCompany() { + return value instanceof CompanyValue; + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getCompany() { + if (isCompany()) { + return Optional.of(((CompanyValue) value).value); + } + return Optional.empty(); + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCompletedPayloadDataOrigin + && value.equals(((PostTransferCompletedPayloadDataOrigin) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitCompany(PostTransferCompletedPayloadDataOriginCompany company); + + T visitUser(PostTransferCompletedPayloadDataOriginUser user); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(CompanyValue.class), @JsonSubTypes.Type(UserValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("Company") + @JsonIgnoreProperties("typename") + private static final class CompanyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PostTransferCompletedPayloadDataOriginCompany value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CompanyValue() {} + + private CompanyValue(PostTransferCompletedPayloadDataOriginCompany value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCompany(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyValue && equalTo((CompanyValue) other); + } + + private boolean equalTo(CompanyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferCompletedPayloadDataOrigin{" + "value: " + value + "}"; + } + } + + @JsonTypeName("User") + @JsonIgnoreProperties("typename") + private static final class UserValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PostTransferCompletedPayloadDataOriginUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(PostTransferCompletedPayloadDataOriginUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferCompletedPayloadDataOrigin{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferCompletedPayloadDataOrigin{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataOriginCompany.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataOriginCompany.java new file mode 100644 index 00000000..97df9173 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataOriginCompany.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferCompletedPayloadDataOriginCompany.Builder.class) +public final class PostTransferCompletedPayloadDataOriginCompany { + private final String id; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private PostTransferCompletedPayloadDataOriginCompany( + String id, Optional route, Optional title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account route. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Account display name. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCompletedPayloadDataOriginCompany + && equalTo((PostTransferCompletedPayloadDataOriginCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferCompletedPayloadDataOriginCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PostTransferCompletedPayloadDataOriginCompany other); + } + + public interface _FinalStage { + PostTransferCompletedPayloadDataOriginCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account route.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

Account display name.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional title = Optional.empty(); + + private Optional route = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferCompletedPayloadDataOriginCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID.

+ *

Account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Account display name.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Account route.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + @java.lang.Override + public PostTransferCompletedPayloadDataOriginCompany build() { + return new PostTransferCompletedPayloadDataOriginCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataOriginUser.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataOriginUser.java new file mode 100644 index 00000000..fa420836 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataOriginUser.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferCompletedPayloadDataOriginUser.Builder.class) +public final class PostTransferCompletedPayloadDataOriginUser { + private final String id; + + private final Optional name; + + private final Optional username; + + private final Map additionalProperties; + + private PostTransferCompletedPayloadDataOriginUser( + String id, Optional name, Optional username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public Optional getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCompletedPayloadDataOriginUser + && equalTo((PostTransferCompletedPayloadDataOriginUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferCompletedPayloadDataOriginUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PostTransferCompletedPayloadDataOriginUser other); + } + + public interface _FinalStage { + PostTransferCompletedPayloadDataOriginUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

User's username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional username = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferCompletedPayloadDataOriginUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

User's username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public PostTransferCompletedPayloadDataOriginUser build() { + return new PostTransferCompletedPayloadDataOriginUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataStatus.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataStatus.java new file mode 100644 index 00000000..a4455d81 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadDataStatus.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostTransferCompletedPayloadDataStatus { + public static final PostTransferCompletedPayloadDataStatus FAILED = + new PostTransferCompletedPayloadDataStatus(Value.FAILED, "failed"); + + public static final PostTransferCompletedPayloadDataStatus SUCCEEDED = + new PostTransferCompletedPayloadDataStatus(Value.SUCCEEDED, "succeeded"); + + public static final PostTransferCompletedPayloadDataStatus PROCESSING = + new PostTransferCompletedPayloadDataStatus(Value.PROCESSING, "processing"); + + private final Value value; + + private final String string; + + PostTransferCompletedPayloadDataStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostTransferCompletedPayloadDataStatus + && this.string.equals(((PostTransferCompletedPayloadDataStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case SUCCEEDED: + return visitor.visitSucceeded(); + case PROCESSING: + return visitor.visitProcessing(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostTransferCompletedPayloadDataStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "succeeded": + return SUCCEEDED; + case "processing": + return PROCESSING; + default: + return new PostTransferCompletedPayloadDataStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PROCESSING, + + SUCCEEDED, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitProcessing(); + + T visitSucceeded(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadType.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadType.java new file mode 100644 index 00000000..d88d7494 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCompletedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostTransferCompletedPayloadType { + public static final PostTransferCompletedPayloadType TRANSFER_COMPLETED = + new PostTransferCompletedPayloadType(Value.TRANSFER_COMPLETED, "transfer.completed"); + + private final Value value; + + private final String string; + + PostTransferCompletedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostTransferCompletedPayloadType + && this.string.equals(((PostTransferCompletedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TRANSFER_COMPLETED: + return visitor.visitTransferCompleted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostTransferCompletedPayloadType valueOf(String value) { + switch (value) { + case "transfer.completed": + return TRANSFER_COMPLETED; + default: + return new PostTransferCompletedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + TRANSFER_COMPLETED, + + UNKNOWN + } + + public interface Visitor { + T visitTransferCompleted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayload.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayload.java new file mode 100644 index 00000000..ac4a4aac --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayload.java @@ -0,0 +1,478 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferCreatedPayload.Builder.class) +public final class PostTransferCreatedPayload { + private final Optional accountId; + + private final PostTransferCreatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostTransferCreatedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostTransferCreatedPayloadType type; + + private final Map additionalProperties; + + private PostTransferCreatedPayload( + Optional accountId, + PostTransferCreatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostTransferCreatedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostTransferCreatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostTransferCreatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + /** + * @return A transfer of credit between two ledger accounts. + */ + @JsonProperty("data") + public PostTransferCreatedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostTransferCreatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCreatedPayload && equalTo((PostTransferCreatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferCreatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostTransferCreatedPayloadApiVersion apiVersion); + + Builder from(PostTransferCreatedPayload other); + } + + public interface DataStage { + /** + *

A transfer of credit between two ledger accounts.

+ */ + IdStage data(@NotNull PostTransferCreatedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostTransferCreatedPayloadType type); + } + + public interface _FinalStage { + PostTransferCreatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostTransferCreatedPayloadApiVersion apiVersion; + + private PostTransferCreatedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostTransferCreatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferCreatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostTransferCreatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + /** + *

A transfer of credit between two ledger accounts.

+ *

A transfer of credit between two ledger accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostTransferCreatedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostTransferCreatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostTransferCreatedPayload build() { + return new PostTransferCreatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadApiVersion.java new file mode 100644 index 00000000..31b5b799 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostTransferCreatedPayloadApiVersion { + public static final PostTransferCreatedPayloadApiVersion V1 = + new PostTransferCreatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostTransferCreatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostTransferCreatedPayloadApiVersion + && this.string.equals(((PostTransferCreatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostTransferCreatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostTransferCreatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadData.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadData.java new file mode 100644 index 00000000..d45c79eb --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadData.java @@ -0,0 +1,991 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferCreatedPayloadData.Builder.class) +public final class PostTransferCreatedPayloadData { + private final double amount; + + private final OffsetDateTime createdAt; + + private final Optional createdByUser; + + private final String currency; + + private final PostTransferCreatedPayloadDataDestination destination; + + private final String destinationLedgerAccountId; + + private final Optional failedAt; + + private final Optional failureCode; + + private final Optional failureReason; + + private final Optional feeAmount; + + private final String id; + + private final Optional> metadata; + + private final Optional notes; + + private final PostTransferCreatedPayloadDataObject object; + + private final PostTransferCreatedPayloadDataOrigin origin; + + private final String originLedgerAccountId; + + private final PostTransferCreatedPayloadDataStatus status; + + private final Map additionalProperties; + + private PostTransferCreatedPayloadData( + double amount, + OffsetDateTime createdAt, + Optional createdByUser, + String currency, + PostTransferCreatedPayloadDataDestination destination, + String destinationLedgerAccountId, + Optional failedAt, + Optional failureCode, + Optional failureReason, + Optional feeAmount, + String id, + Optional> metadata, + Optional notes, + PostTransferCreatedPayloadDataObject object, + PostTransferCreatedPayloadDataOrigin origin, + String originLedgerAccountId, + PostTransferCreatedPayloadDataStatus status, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.createdByUser = createdByUser; + this.currency = currency; + this.destination = destination; + this.destinationLedgerAccountId = destinationLedgerAccountId; + this.failedAt = failedAt; + this.failureCode = failureCode; + this.failureReason = failureReason; + this.feeAmount = feeAmount; + this.id = id; + this.metadata = metadata; + this.notes = notes; + this.object = object; + this.origin = origin; + this.originLedgerAccountId = originLedgerAccountId; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Transfer amount. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return When the transfer was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable. + */ + @JsonIgnore + public Optional getCreatedByUser() { + if (createdByUser == null) { + return Optional.empty(); + } + return createdByUser; + } + + /** + * @return Transfer currency. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Account or user receiving funds. + */ + @JsonProperty("destination") + public PostTransferCreatedPayloadDataDestination getDestination() { + return destination; + } + + /** + * @return Destination ledger account ID. + */ + @JsonProperty("destination_ledger_account_id") + public String getDestinationLedgerAccountId() { + return destinationLedgerAccountId; + } + + /** + * @return When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailedAt() { + if (failedAt == null) { + return Optional.empty(); + } + return failedAt; + } + + /** + * @return Machine-readable code for why the transfer failed. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailureCode() { + if (failureCode == null) { + return Optional.empty(); + } + return failureCode; + } + + /** + * @return Human-readable explanation of why the transfer failed. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailureReason() { + if (failureReason == null) { + return Optional.empty(); + } + return failureReason; + } + + /** + * @return Fee charged for the transfer. + */ + @JsonIgnore + public Optional getFeeAmount() { + if (feeAmount == null) { + return Optional.empty(); + } + return feeAmount; + } + + /** + * @return Transfer ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom metadata attached to the transfer. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Transfer note. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + /** + * @return The object type. Discriminates the create response from a send or a claim link. + */ + @JsonProperty("object") + public PostTransferCreatedPayloadDataObject getObject() { + return object; + } + + /** + * @return Account or user sending funds. + */ + @JsonProperty("origin") + public PostTransferCreatedPayloadDataOrigin getOrigin() { + return origin; + } + + /** + * @return Source ledger account ID. + */ + @JsonProperty("origin_ledger_account_id") + public String getOriginLedgerAccountId() { + return originLedgerAccountId; + } + + /** + * @return Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded. + */ + @JsonProperty("status") + public PostTransferCreatedPayloadDataStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_by_user") + private Optional _getCreatedByUser() { + return createdByUser; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failed_at") + private Optional _getFailedAt() { + return failedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_code") + private Optional _getFailureCode() { + return failureCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_reason") + private Optional _getFailureReason() { + return failureReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fee_amount") + private Optional _getFeeAmount() { + return feeAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCreatedPayloadData && equalTo((PostTransferCreatedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferCreatedPayloadData other) { + return amount == other.amount + && createdAt.equals(other.createdAt) + && createdByUser.equals(other.createdByUser) + && currency.equals(other.currency) + && destination.equals(other.destination) + && destinationLedgerAccountId.equals(other.destinationLedgerAccountId) + && failedAt.equals(other.failedAt) + && failureCode.equals(other.failureCode) + && failureReason.equals(other.failureReason) + && feeAmount.equals(other.feeAmount) + && id.equals(other.id) + && metadata.equals(other.metadata) + && notes.equals(other.notes) + && object.equals(other.object) + && origin.equals(other.origin) + && originLedgerAccountId.equals(other.originLedgerAccountId) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.createdByUser, + this.currency, + this.destination, + this.destinationLedgerAccountId, + this.failedAt, + this.failureCode, + this.failureReason, + this.feeAmount, + this.id, + this.metadata, + this.notes, + this.object, + this.origin, + this.originLedgerAccountId, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

Transfer amount.

+ */ + CreatedAtStage amount(double amount); + + Builder from(PostTransferCreatedPayloadData other); + } + + public interface CreatedAtStage { + /** + *

When the transfer was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

Transfer currency.

+ */ + DestinationStage currency(@NotNull String currency); + } + + public interface DestinationStage { + /** + *

Account or user receiving funds.

+ */ + DestinationLedgerAccountIdStage destination(@NotNull PostTransferCreatedPayloadDataDestination destination); + } + + public interface DestinationLedgerAccountIdStage { + /** + *

Destination ledger account ID.

+ */ + IdStage destinationLedgerAccountId(@NotNull String destinationLedgerAccountId); + } + + public interface IdStage { + /** + *

Transfer ID.

+ */ + ObjectStage id(@NotNull String id); + } + + public interface ObjectStage { + /** + *

The object type. Discriminates the create response from a send or a claim link.

+ */ + OriginStage object(@NotNull PostTransferCreatedPayloadDataObject object); + } + + public interface OriginStage { + /** + *

Account or user sending funds.

+ */ + OriginLedgerAccountIdStage origin(@NotNull PostTransferCreatedPayloadDataOrigin origin); + } + + public interface OriginLedgerAccountIdStage { + /** + *

Source ledger account ID.

+ */ + StatusStage originLedgerAccountId(@NotNull String originLedgerAccountId); + } + + public interface StatusStage { + /** + *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ */ + _FinalStage status(@NotNull PostTransferCreatedPayloadDataStatus status); + } + + public interface _FinalStage { + PostTransferCreatedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ */ + _FinalStage createdByUser(Optional createdByUser); + + _FinalStage createdByUser(PostTransferCreatedPayloadDataCreatedByUser createdByUser); + + _FinalStage createdByUser(Nullable createdByUser); + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ */ + _FinalStage failedAt(Optional failedAt); + + _FinalStage failedAt(OffsetDateTime failedAt); + + _FinalStage failedAt(Nullable failedAt); + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ */ + _FinalStage failureCode(Optional failureCode); + + _FinalStage failureCode(String failureCode); + + _FinalStage failureCode(Nullable failureCode); + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ */ + _FinalStage failureReason(Optional failureReason); + + _FinalStage failureReason(String failureReason); + + _FinalStage failureReason(Nullable failureReason); + + /** + *

Fee charged for the transfer.

+ */ + _FinalStage feeAmount(Optional feeAmount); + + _FinalStage feeAmount(Double feeAmount); + + _FinalStage feeAmount(Nullable feeAmount); + + /** + *

Custom metadata attached to the transfer.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Transfer note.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + CurrencyStage, + DestinationStage, + DestinationLedgerAccountIdStage, + IdStage, + ObjectStage, + OriginStage, + OriginLedgerAccountIdStage, + StatusStage, + _FinalStage { + private double amount; + + private OffsetDateTime createdAt; + + private String currency; + + private PostTransferCreatedPayloadDataDestination destination; + + private String destinationLedgerAccountId; + + private String id; + + private PostTransferCreatedPayloadDataObject object; + + private PostTransferCreatedPayloadDataOrigin origin; + + private String originLedgerAccountId; + + private PostTransferCreatedPayloadDataStatus status; + + private Optional notes = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional feeAmount = Optional.empty(); + + private Optional failureReason = Optional.empty(); + + private Optional failureCode = Optional.empty(); + + private Optional failedAt = Optional.empty(); + + private Optional createdByUser = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferCreatedPayloadData other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + createdByUser(other.getCreatedByUser()); + currency(other.getCurrency()); + destination(other.getDestination()); + destinationLedgerAccountId(other.getDestinationLedgerAccountId()); + failedAt(other.getFailedAt()); + failureCode(other.getFailureCode()); + failureReason(other.getFailureReason()); + feeAmount(other.getFeeAmount()); + id(other.getId()); + metadata(other.getMetadata()); + notes(other.getNotes()); + object(other.getObject()); + origin(other.getOrigin()); + originLedgerAccountId(other.getOriginLedgerAccountId()); + status(other.getStatus()); + return this; + } + + /** + *

Transfer amount.

+ *

Transfer amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

When the transfer was created.

+ *

When the transfer was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Transfer currency.

+ *

Transfer currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DestinationStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Account or user receiving funds.

+ *

Account or user receiving funds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination") + public DestinationLedgerAccountIdStage destination( + @NotNull PostTransferCreatedPayloadDataDestination destination) { + this.destination = Objects.requireNonNull(destination, "destination must not be null"); + return this; + } + + /** + *

Destination ledger account ID.

+ *

Destination ledger account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination_ledger_account_id") + public IdStage destinationLedgerAccountId(@NotNull String destinationLedgerAccountId) { + this.destinationLedgerAccountId = + Objects.requireNonNull(destinationLedgerAccountId, "destinationLedgerAccountId must not be null"); + return this; + } + + /** + *

Transfer ID.

+ *

Transfer ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The object type. Discriminates the create response from a send or a claim link.

+ *

The object type. Discriminates the create response from a send or a claim link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("object") + public OriginStage object(@NotNull PostTransferCreatedPayloadDataObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Account or user sending funds.

+ *

Account or user sending funds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("origin") + public OriginLedgerAccountIdStage origin(@NotNull PostTransferCreatedPayloadDataOrigin origin) { + this.origin = Objects.requireNonNull(origin, "origin must not be null"); + return this; + } + + /** + *

Source ledger account ID.

+ *

Source ledger account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("origin_ledger_account_id") + public StatusStage originLedgerAccountId(@NotNull String originLedgerAccountId) { + this.originLedgerAccountId = + Objects.requireNonNull(originLedgerAccountId, "originLedgerAccountId must not be null"); + return this; + } + + /** + *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull PostTransferCreatedPayloadDataStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Transfer note.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Transfer note.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Transfer note.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Fee charged for the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeAmount(Nullable feeAmount) { + if (feeAmount.isNull()) { + this.feeAmount = null; + } else if (feeAmount.isEmpty()) { + this.feeAmount = Optional.empty(); + } else { + this.feeAmount = Optional.of(feeAmount.get()); + } + return this; + } + + /** + *

Fee charged for the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeAmount(Double feeAmount) { + this.feeAmount = Optional.ofNullable(feeAmount); + return this; + } + + /** + *

Fee charged for the transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "fee_amount", nulls = Nulls.SKIP) + public _FinalStage feeAmount(Optional feeAmount) { + this.feeAmount = feeAmount; + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureReason(Nullable failureReason) { + if (failureReason.isNull()) { + this.failureReason = null; + } else if (failureReason.isEmpty()) { + this.failureReason = Optional.empty(); + } else { + this.failureReason = Optional.of(failureReason.get()); + } + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureReason(String failureReason) { + this.failureReason = Optional.ofNullable(failureReason); + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_reason", nulls = Nulls.SKIP) + public _FinalStage failureReason(Optional failureReason) { + this.failureReason = failureReason; + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureCode(Nullable failureCode) { + if (failureCode.isNull()) { + this.failureCode = null; + } else if (failureCode.isEmpty()) { + this.failureCode = Optional.empty(); + } else { + this.failureCode = Optional.of(failureCode.get()); + } + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureCode(String failureCode) { + this.failureCode = Optional.ofNullable(failureCode); + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_code", nulls = Nulls.SKIP) + public _FinalStage failureCode(Optional failureCode) { + this.failureCode = failureCode; + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failedAt(Nullable failedAt) { + if (failedAt.isNull()) { + this.failedAt = null; + } else if (failedAt.isEmpty()) { + this.failedAt = Optional.empty(); + } else { + this.failedAt = Optional.of(failedAt.get()); + } + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failedAt(OffsetDateTime failedAt) { + this.failedAt = Optional.ofNullable(failedAt); + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failed_at", nulls = Nulls.SKIP) + public _FinalStage failedAt(Optional failedAt) { + this.failedAt = failedAt; + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdByUser(Nullable createdByUser) { + if (createdByUser.isNull()) { + this.createdByUser = null; + } else if (createdByUser.isEmpty()) { + this.createdByUser = Optional.empty(); + } else { + this.createdByUser = Optional.of(createdByUser.get()); + } + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdByUser(PostTransferCreatedPayloadDataCreatedByUser createdByUser) { + this.createdByUser = Optional.ofNullable(createdByUser); + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ */ + @java.lang.Override + @JsonSetter(value = "created_by_user", nulls = Nulls.SKIP) + public _FinalStage createdByUser(Optional createdByUser) { + this.createdByUser = createdByUser; + return this; + } + + @java.lang.Override + public PostTransferCreatedPayloadData build() { + return new PostTransferCreatedPayloadData( + amount, + createdAt, + createdByUser, + currency, + destination, + destinationLedgerAccountId, + failedAt, + failureCode, + failureReason, + feeAmount, + id, + metadata, + notes, + object, + origin, + originLedgerAccountId, + status, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataCreatedByUser.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataCreatedByUser.java new file mode 100644 index 00000000..acd12cfd --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataCreatedByUser.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferCreatedPayloadDataCreatedByUser.Builder.class) +public final class PostTransferCreatedPayloadDataCreatedByUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private PostTransferCreatedPayloadDataCreatedByUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCreatedPayloadDataCreatedByUser + && equalTo((PostTransferCreatedPayloadDataCreatedByUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferCreatedPayloadDataCreatedByUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(PostTransferCreatedPayloadDataCreatedByUser other); + } + + public interface UsernameStage { + /** + *

User's username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + PostTransferCreatedPayloadDataCreatedByUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferCreatedPayloadDataCreatedByUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public PostTransferCreatedPayloadDataCreatedByUser build() { + return new PostTransferCreatedPayloadDataCreatedByUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataDestination.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataDestination.java new file mode 100644 index 00000000..279157cc --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataDestination.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class PostTransferCreatedPayloadDataDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PostTransferCreatedPayloadDataDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PostTransferCreatedPayloadDataDestination company( + PostTransferCreatedPayloadDataDestinationCompany value) { + return new PostTransferCreatedPayloadDataDestination(new CompanyValue(value)); + } + + public static PostTransferCreatedPayloadDataDestination user(PostTransferCreatedPayloadDataDestinationUser value) { + return new PostTransferCreatedPayloadDataDestination(new UserValue(value)); + } + + public boolean isCompany() { + return value instanceof CompanyValue; + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getCompany() { + if (isCompany()) { + return Optional.of(((CompanyValue) value).value); + } + return Optional.empty(); + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCreatedPayloadDataDestination + && value.equals(((PostTransferCreatedPayloadDataDestination) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitCompany(PostTransferCreatedPayloadDataDestinationCompany company); + + T visitUser(PostTransferCreatedPayloadDataDestinationUser user); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(CompanyValue.class), @JsonSubTypes.Type(UserValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("Company") + @JsonIgnoreProperties("typename") + private static final class CompanyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PostTransferCreatedPayloadDataDestinationCompany value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CompanyValue() {} + + private CompanyValue(PostTransferCreatedPayloadDataDestinationCompany value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCompany(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyValue && equalTo((CompanyValue) other); + } + + private boolean equalTo(CompanyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferCreatedPayloadDataDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("User") + @JsonIgnoreProperties("typename") + private static final class UserValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PostTransferCreatedPayloadDataDestinationUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(PostTransferCreatedPayloadDataDestinationUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferCreatedPayloadDataDestination{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferCreatedPayloadDataDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataDestinationCompany.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataDestinationCompany.java new file mode 100644 index 00000000..d01ac3b8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataDestinationCompany.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferCreatedPayloadDataDestinationCompany.Builder.class) +public final class PostTransferCreatedPayloadDataDestinationCompany { + private final String id; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private PostTransferCreatedPayloadDataDestinationCompany( + String id, Optional route, Optional title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account route. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Account display name. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCreatedPayloadDataDestinationCompany + && equalTo((PostTransferCreatedPayloadDataDestinationCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferCreatedPayloadDataDestinationCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PostTransferCreatedPayloadDataDestinationCompany other); + } + + public interface _FinalStage { + PostTransferCreatedPayloadDataDestinationCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account route.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

Account display name.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional title = Optional.empty(); + + private Optional route = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferCreatedPayloadDataDestinationCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID.

+ *

Account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Account display name.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Account route.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + @java.lang.Override + public PostTransferCreatedPayloadDataDestinationCompany build() { + return new PostTransferCreatedPayloadDataDestinationCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataDestinationUser.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataDestinationUser.java new file mode 100644 index 00000000..1036da7b --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataDestinationUser.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferCreatedPayloadDataDestinationUser.Builder.class) +public final class PostTransferCreatedPayloadDataDestinationUser { + private final String id; + + private final Optional name; + + private final Optional username; + + private final Map additionalProperties; + + private PostTransferCreatedPayloadDataDestinationUser( + String id, Optional name, Optional username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public Optional getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCreatedPayloadDataDestinationUser + && equalTo((PostTransferCreatedPayloadDataDestinationUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferCreatedPayloadDataDestinationUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PostTransferCreatedPayloadDataDestinationUser other); + } + + public interface _FinalStage { + PostTransferCreatedPayloadDataDestinationUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

User's username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional username = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferCreatedPayloadDataDestinationUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

User's username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public PostTransferCreatedPayloadDataDestinationUser build() { + return new PostTransferCreatedPayloadDataDestinationUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataObject.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataObject.java new file mode 100644 index 00000000..47fa9055 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostTransferCreatedPayloadDataObject { + public static final PostTransferCreatedPayloadDataObject TRANSFER = + new PostTransferCreatedPayloadDataObject(Value.TRANSFER, "transfer"); + + private final Value value; + + private final String string; + + PostTransferCreatedPayloadDataObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostTransferCreatedPayloadDataObject + && this.string.equals(((PostTransferCreatedPayloadDataObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TRANSFER: + return visitor.visitTransfer(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostTransferCreatedPayloadDataObject valueOf(String value) { + switch (value) { + case "transfer": + return TRANSFER; + default: + return new PostTransferCreatedPayloadDataObject(Value.UNKNOWN, value); + } + } + + public enum Value { + TRANSFER, + + UNKNOWN + } + + public interface Visitor { + T visitTransfer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataOrigin.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataOrigin.java new file mode 100644 index 00000000..b087cb7e --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataOrigin.java @@ -0,0 +1,222 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class PostTransferCreatedPayloadDataOrigin { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PostTransferCreatedPayloadDataOrigin(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PostTransferCreatedPayloadDataOrigin company(PostTransferCreatedPayloadDataOriginCompany value) { + return new PostTransferCreatedPayloadDataOrigin(new CompanyValue(value)); + } + + public static PostTransferCreatedPayloadDataOrigin user(PostTransferCreatedPayloadDataOriginUser value) { + return new PostTransferCreatedPayloadDataOrigin(new UserValue(value)); + } + + public boolean isCompany() { + return value instanceof CompanyValue; + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getCompany() { + if (isCompany()) { + return Optional.of(((CompanyValue) value).value); + } + return Optional.empty(); + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCreatedPayloadDataOrigin + && value.equals(((PostTransferCreatedPayloadDataOrigin) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitCompany(PostTransferCreatedPayloadDataOriginCompany company); + + T visitUser(PostTransferCreatedPayloadDataOriginUser user); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(CompanyValue.class), @JsonSubTypes.Type(UserValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("Company") + @JsonIgnoreProperties("typename") + private static final class CompanyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PostTransferCreatedPayloadDataOriginCompany value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CompanyValue() {} + + private CompanyValue(PostTransferCreatedPayloadDataOriginCompany value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCompany(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyValue && equalTo((CompanyValue) other); + } + + private boolean equalTo(CompanyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferCreatedPayloadDataOrigin{" + "value: " + value + "}"; + } + } + + @JsonTypeName("User") + @JsonIgnoreProperties("typename") + private static final class UserValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PostTransferCreatedPayloadDataOriginUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(PostTransferCreatedPayloadDataOriginUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferCreatedPayloadDataOrigin{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferCreatedPayloadDataOrigin{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataOriginCompany.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataOriginCompany.java new file mode 100644 index 00000000..d2e856d2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataOriginCompany.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferCreatedPayloadDataOriginCompany.Builder.class) +public final class PostTransferCreatedPayloadDataOriginCompany { + private final String id; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private PostTransferCreatedPayloadDataOriginCompany( + String id, Optional route, Optional title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account route. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Account display name. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCreatedPayloadDataOriginCompany + && equalTo((PostTransferCreatedPayloadDataOriginCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferCreatedPayloadDataOriginCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PostTransferCreatedPayloadDataOriginCompany other); + } + + public interface _FinalStage { + PostTransferCreatedPayloadDataOriginCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account route.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

Account display name.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional title = Optional.empty(); + + private Optional route = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferCreatedPayloadDataOriginCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID.

+ *

Account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Account display name.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Account route.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + @java.lang.Override + public PostTransferCreatedPayloadDataOriginCompany build() { + return new PostTransferCreatedPayloadDataOriginCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataOriginUser.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataOriginUser.java new file mode 100644 index 00000000..ee0cd385 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataOriginUser.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferCreatedPayloadDataOriginUser.Builder.class) +public final class PostTransferCreatedPayloadDataOriginUser { + private final String id; + + private final Optional name; + + private final Optional username; + + private final Map additionalProperties; + + private PostTransferCreatedPayloadDataOriginUser( + String id, Optional name, Optional username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public Optional getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferCreatedPayloadDataOriginUser + && equalTo((PostTransferCreatedPayloadDataOriginUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferCreatedPayloadDataOriginUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PostTransferCreatedPayloadDataOriginUser other); + } + + public interface _FinalStage { + PostTransferCreatedPayloadDataOriginUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

User's username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional username = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferCreatedPayloadDataOriginUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

User's username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public PostTransferCreatedPayloadDataOriginUser build() { + return new PostTransferCreatedPayloadDataOriginUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataStatus.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataStatus.java new file mode 100644 index 00000000..f5b2ab39 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadDataStatus.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostTransferCreatedPayloadDataStatus { + public static final PostTransferCreatedPayloadDataStatus FAILED = + new PostTransferCreatedPayloadDataStatus(Value.FAILED, "failed"); + + public static final PostTransferCreatedPayloadDataStatus SUCCEEDED = + new PostTransferCreatedPayloadDataStatus(Value.SUCCEEDED, "succeeded"); + + public static final PostTransferCreatedPayloadDataStatus PROCESSING = + new PostTransferCreatedPayloadDataStatus(Value.PROCESSING, "processing"); + + private final Value value; + + private final String string; + + PostTransferCreatedPayloadDataStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostTransferCreatedPayloadDataStatus + && this.string.equals(((PostTransferCreatedPayloadDataStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case SUCCEEDED: + return visitor.visitSucceeded(); + case PROCESSING: + return visitor.visitProcessing(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostTransferCreatedPayloadDataStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "succeeded": + return SUCCEEDED; + case "processing": + return PROCESSING; + default: + return new PostTransferCreatedPayloadDataStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PROCESSING, + + SUCCEEDED, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitProcessing(); + + T visitSucceeded(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadType.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadType.java new file mode 100644 index 00000000..7c173cce --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferCreatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostTransferCreatedPayloadType { + public static final PostTransferCreatedPayloadType TRANSFER_CREATED = + new PostTransferCreatedPayloadType(Value.TRANSFER_CREATED, "transfer.created"); + + private final Value value; + + private final String string; + + PostTransferCreatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostTransferCreatedPayloadType + && this.string.equals(((PostTransferCreatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TRANSFER_CREATED: + return visitor.visitTransferCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostTransferCreatedPayloadType valueOf(String value) { + switch (value) { + case "transfer.created": + return TRANSFER_CREATED; + default: + return new PostTransferCreatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + TRANSFER_CREATED, + + UNKNOWN + } + + public interface Visitor { + T visitTransferCreated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayload.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayload.java new file mode 100644 index 00000000..f848359f --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayload.java @@ -0,0 +1,478 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferFailedPayload.Builder.class) +public final class PostTransferFailedPayload { + private final Optional accountId; + + private final PostTransferFailedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostTransferFailedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostTransferFailedPayloadType type; + + private final Map additionalProperties; + + private PostTransferFailedPayload( + Optional accountId, + PostTransferFailedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostTransferFailedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostTransferFailedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostTransferFailedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + /** + * @return A transfer of credit between two ledger accounts. + */ + @JsonProperty("data") + public PostTransferFailedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostTransferFailedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferFailedPayload && equalTo((PostTransferFailedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferFailedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostTransferFailedPayloadApiVersion apiVersion); + + Builder from(PostTransferFailedPayload other); + } + + public interface DataStage { + /** + *

A transfer of credit between two ledger accounts.

+ */ + IdStage data(@NotNull PostTransferFailedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostTransferFailedPayloadType type); + } + + public interface _FinalStage { + PostTransferFailedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostTransferFailedPayloadApiVersion apiVersion; + + private PostTransferFailedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostTransferFailedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferFailedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostTransferFailedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + /** + *

A transfer of credit between two ledger accounts.

+ *

A transfer of credit between two ledger accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostTransferFailedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostTransferFailedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostTransferFailedPayload build() { + return new PostTransferFailedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadApiVersion.java new file mode 100644 index 00000000..daff2911 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostTransferFailedPayloadApiVersion { + public static final PostTransferFailedPayloadApiVersion V1 = + new PostTransferFailedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostTransferFailedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostTransferFailedPayloadApiVersion + && this.string.equals(((PostTransferFailedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostTransferFailedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostTransferFailedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadData.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadData.java new file mode 100644 index 00000000..78dd2a62 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadData.java @@ -0,0 +1,991 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferFailedPayloadData.Builder.class) +public final class PostTransferFailedPayloadData { + private final double amount; + + private final OffsetDateTime createdAt; + + private final Optional createdByUser; + + private final String currency; + + private final PostTransferFailedPayloadDataDestination destination; + + private final String destinationLedgerAccountId; + + private final Optional failedAt; + + private final Optional failureCode; + + private final Optional failureReason; + + private final Optional feeAmount; + + private final String id; + + private final Optional> metadata; + + private final Optional notes; + + private final PostTransferFailedPayloadDataObject object; + + private final PostTransferFailedPayloadDataOrigin origin; + + private final String originLedgerAccountId; + + private final PostTransferFailedPayloadDataStatus status; + + private final Map additionalProperties; + + private PostTransferFailedPayloadData( + double amount, + OffsetDateTime createdAt, + Optional createdByUser, + String currency, + PostTransferFailedPayloadDataDestination destination, + String destinationLedgerAccountId, + Optional failedAt, + Optional failureCode, + Optional failureReason, + Optional feeAmount, + String id, + Optional> metadata, + Optional notes, + PostTransferFailedPayloadDataObject object, + PostTransferFailedPayloadDataOrigin origin, + String originLedgerAccountId, + PostTransferFailedPayloadDataStatus status, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.createdByUser = createdByUser; + this.currency = currency; + this.destination = destination; + this.destinationLedgerAccountId = destinationLedgerAccountId; + this.failedAt = failedAt; + this.failureCode = failureCode; + this.failureReason = failureReason; + this.feeAmount = feeAmount; + this.id = id; + this.metadata = metadata; + this.notes = notes; + this.object = object; + this.origin = origin; + this.originLedgerAccountId = originLedgerAccountId; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Transfer amount. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return When the transfer was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable. + */ + @JsonIgnore + public Optional getCreatedByUser() { + if (createdByUser == null) { + return Optional.empty(); + } + return createdByUser; + } + + /** + * @return Transfer currency. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Account or user receiving funds. + */ + @JsonProperty("destination") + public PostTransferFailedPayloadDataDestination getDestination() { + return destination; + } + + /** + * @return Destination ledger account ID. + */ + @JsonProperty("destination_ledger_account_id") + public String getDestinationLedgerAccountId() { + return destinationLedgerAccountId; + } + + /** + * @return When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailedAt() { + if (failedAt == null) { + return Optional.empty(); + } + return failedAt; + } + + /** + * @return Machine-readable code for why the transfer failed. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailureCode() { + if (failureCode == null) { + return Optional.empty(); + } + return failureCode; + } + + /** + * @return Human-readable explanation of why the transfer failed. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailureReason() { + if (failureReason == null) { + return Optional.empty(); + } + return failureReason; + } + + /** + * @return Fee charged for the transfer. + */ + @JsonIgnore + public Optional getFeeAmount() { + if (feeAmount == null) { + return Optional.empty(); + } + return feeAmount; + } + + /** + * @return Transfer ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom metadata attached to the transfer. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Transfer note. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + /** + * @return The object type. Discriminates the create response from a send or a claim link. + */ + @JsonProperty("object") + public PostTransferFailedPayloadDataObject getObject() { + return object; + } + + /** + * @return Account or user sending funds. + */ + @JsonProperty("origin") + public PostTransferFailedPayloadDataOrigin getOrigin() { + return origin; + } + + /** + * @return Source ledger account ID. + */ + @JsonProperty("origin_ledger_account_id") + public String getOriginLedgerAccountId() { + return originLedgerAccountId; + } + + /** + * @return Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded. + */ + @JsonProperty("status") + public PostTransferFailedPayloadDataStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_by_user") + private Optional _getCreatedByUser() { + return createdByUser; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failed_at") + private Optional _getFailedAt() { + return failedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_code") + private Optional _getFailureCode() { + return failureCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_reason") + private Optional _getFailureReason() { + return failureReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fee_amount") + private Optional _getFeeAmount() { + return feeAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferFailedPayloadData && equalTo((PostTransferFailedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferFailedPayloadData other) { + return amount == other.amount + && createdAt.equals(other.createdAt) + && createdByUser.equals(other.createdByUser) + && currency.equals(other.currency) + && destination.equals(other.destination) + && destinationLedgerAccountId.equals(other.destinationLedgerAccountId) + && failedAt.equals(other.failedAt) + && failureCode.equals(other.failureCode) + && failureReason.equals(other.failureReason) + && feeAmount.equals(other.feeAmount) + && id.equals(other.id) + && metadata.equals(other.metadata) + && notes.equals(other.notes) + && object.equals(other.object) + && origin.equals(other.origin) + && originLedgerAccountId.equals(other.originLedgerAccountId) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.createdByUser, + this.currency, + this.destination, + this.destinationLedgerAccountId, + this.failedAt, + this.failureCode, + this.failureReason, + this.feeAmount, + this.id, + this.metadata, + this.notes, + this.object, + this.origin, + this.originLedgerAccountId, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

Transfer amount.

+ */ + CreatedAtStage amount(double amount); + + Builder from(PostTransferFailedPayloadData other); + } + + public interface CreatedAtStage { + /** + *

When the transfer was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

Transfer currency.

+ */ + DestinationStage currency(@NotNull String currency); + } + + public interface DestinationStage { + /** + *

Account or user receiving funds.

+ */ + DestinationLedgerAccountIdStage destination(@NotNull PostTransferFailedPayloadDataDestination destination); + } + + public interface DestinationLedgerAccountIdStage { + /** + *

Destination ledger account ID.

+ */ + IdStage destinationLedgerAccountId(@NotNull String destinationLedgerAccountId); + } + + public interface IdStage { + /** + *

Transfer ID.

+ */ + ObjectStage id(@NotNull String id); + } + + public interface ObjectStage { + /** + *

The object type. Discriminates the create response from a send or a claim link.

+ */ + OriginStage object(@NotNull PostTransferFailedPayloadDataObject object); + } + + public interface OriginStage { + /** + *

Account or user sending funds.

+ */ + OriginLedgerAccountIdStage origin(@NotNull PostTransferFailedPayloadDataOrigin origin); + } + + public interface OriginLedgerAccountIdStage { + /** + *

Source ledger account ID.

+ */ + StatusStage originLedgerAccountId(@NotNull String originLedgerAccountId); + } + + public interface StatusStage { + /** + *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ */ + _FinalStage status(@NotNull PostTransferFailedPayloadDataStatus status); + } + + public interface _FinalStage { + PostTransferFailedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ */ + _FinalStage createdByUser(Optional createdByUser); + + _FinalStage createdByUser(PostTransferFailedPayloadDataCreatedByUser createdByUser); + + _FinalStage createdByUser(Nullable createdByUser); + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ */ + _FinalStage failedAt(Optional failedAt); + + _FinalStage failedAt(OffsetDateTime failedAt); + + _FinalStage failedAt(Nullable failedAt); + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ */ + _FinalStage failureCode(Optional failureCode); + + _FinalStage failureCode(String failureCode); + + _FinalStage failureCode(Nullable failureCode); + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ */ + _FinalStage failureReason(Optional failureReason); + + _FinalStage failureReason(String failureReason); + + _FinalStage failureReason(Nullable failureReason); + + /** + *

Fee charged for the transfer.

+ */ + _FinalStage feeAmount(Optional feeAmount); + + _FinalStage feeAmount(Double feeAmount); + + _FinalStage feeAmount(Nullable feeAmount); + + /** + *

Custom metadata attached to the transfer.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Transfer note.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + CurrencyStage, + DestinationStage, + DestinationLedgerAccountIdStage, + IdStage, + ObjectStage, + OriginStage, + OriginLedgerAccountIdStage, + StatusStage, + _FinalStage { + private double amount; + + private OffsetDateTime createdAt; + + private String currency; + + private PostTransferFailedPayloadDataDestination destination; + + private String destinationLedgerAccountId; + + private String id; + + private PostTransferFailedPayloadDataObject object; + + private PostTransferFailedPayloadDataOrigin origin; + + private String originLedgerAccountId; + + private PostTransferFailedPayloadDataStatus status; + + private Optional notes = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional feeAmount = Optional.empty(); + + private Optional failureReason = Optional.empty(); + + private Optional failureCode = Optional.empty(); + + private Optional failedAt = Optional.empty(); + + private Optional createdByUser = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferFailedPayloadData other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + createdByUser(other.getCreatedByUser()); + currency(other.getCurrency()); + destination(other.getDestination()); + destinationLedgerAccountId(other.getDestinationLedgerAccountId()); + failedAt(other.getFailedAt()); + failureCode(other.getFailureCode()); + failureReason(other.getFailureReason()); + feeAmount(other.getFeeAmount()); + id(other.getId()); + metadata(other.getMetadata()); + notes(other.getNotes()); + object(other.getObject()); + origin(other.getOrigin()); + originLedgerAccountId(other.getOriginLedgerAccountId()); + status(other.getStatus()); + return this; + } + + /** + *

Transfer amount.

+ *

Transfer amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

When the transfer was created.

+ *

When the transfer was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Transfer currency.

+ *

Transfer currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DestinationStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Account or user receiving funds.

+ *

Account or user receiving funds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination") + public DestinationLedgerAccountIdStage destination( + @NotNull PostTransferFailedPayloadDataDestination destination) { + this.destination = Objects.requireNonNull(destination, "destination must not be null"); + return this; + } + + /** + *

Destination ledger account ID.

+ *

Destination ledger account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination_ledger_account_id") + public IdStage destinationLedgerAccountId(@NotNull String destinationLedgerAccountId) { + this.destinationLedgerAccountId = + Objects.requireNonNull(destinationLedgerAccountId, "destinationLedgerAccountId must not be null"); + return this; + } + + /** + *

Transfer ID.

+ *

Transfer ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The object type. Discriminates the create response from a send or a claim link.

+ *

The object type. Discriminates the create response from a send or a claim link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("object") + public OriginStage object(@NotNull PostTransferFailedPayloadDataObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Account or user sending funds.

+ *

Account or user sending funds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("origin") + public OriginLedgerAccountIdStage origin(@NotNull PostTransferFailedPayloadDataOrigin origin) { + this.origin = Objects.requireNonNull(origin, "origin must not be null"); + return this; + } + + /** + *

Source ledger account ID.

+ *

Source ledger account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("origin_ledger_account_id") + public StatusStage originLedgerAccountId(@NotNull String originLedgerAccountId) { + this.originLedgerAccountId = + Objects.requireNonNull(originLedgerAccountId, "originLedgerAccountId must not be null"); + return this; + } + + /** + *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull PostTransferFailedPayloadDataStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Transfer note.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Transfer note.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Transfer note.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Fee charged for the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeAmount(Nullable feeAmount) { + if (feeAmount.isNull()) { + this.feeAmount = null; + } else if (feeAmount.isEmpty()) { + this.feeAmount = Optional.empty(); + } else { + this.feeAmount = Optional.of(feeAmount.get()); + } + return this; + } + + /** + *

Fee charged for the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeAmount(Double feeAmount) { + this.feeAmount = Optional.ofNullable(feeAmount); + return this; + } + + /** + *

Fee charged for the transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "fee_amount", nulls = Nulls.SKIP) + public _FinalStage feeAmount(Optional feeAmount) { + this.feeAmount = feeAmount; + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureReason(Nullable failureReason) { + if (failureReason.isNull()) { + this.failureReason = null; + } else if (failureReason.isEmpty()) { + this.failureReason = Optional.empty(); + } else { + this.failureReason = Optional.of(failureReason.get()); + } + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureReason(String failureReason) { + this.failureReason = Optional.ofNullable(failureReason); + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_reason", nulls = Nulls.SKIP) + public _FinalStage failureReason(Optional failureReason) { + this.failureReason = failureReason; + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureCode(Nullable failureCode) { + if (failureCode.isNull()) { + this.failureCode = null; + } else if (failureCode.isEmpty()) { + this.failureCode = Optional.empty(); + } else { + this.failureCode = Optional.of(failureCode.get()); + } + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureCode(String failureCode) { + this.failureCode = Optional.ofNullable(failureCode); + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_code", nulls = Nulls.SKIP) + public _FinalStage failureCode(Optional failureCode) { + this.failureCode = failureCode; + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failedAt(Nullable failedAt) { + if (failedAt.isNull()) { + this.failedAt = null; + } else if (failedAt.isEmpty()) { + this.failedAt = Optional.empty(); + } else { + this.failedAt = Optional.of(failedAt.get()); + } + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failedAt(OffsetDateTime failedAt) { + this.failedAt = Optional.ofNullable(failedAt); + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failed_at", nulls = Nulls.SKIP) + public _FinalStage failedAt(Optional failedAt) { + this.failedAt = failedAt; + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdByUser(Nullable createdByUser) { + if (createdByUser.isNull()) { + this.createdByUser = null; + } else if (createdByUser.isEmpty()) { + this.createdByUser = Optional.empty(); + } else { + this.createdByUser = Optional.of(createdByUser.get()); + } + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdByUser(PostTransferFailedPayloadDataCreatedByUser createdByUser) { + this.createdByUser = Optional.ofNullable(createdByUser); + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ */ + @java.lang.Override + @JsonSetter(value = "created_by_user", nulls = Nulls.SKIP) + public _FinalStage createdByUser(Optional createdByUser) { + this.createdByUser = createdByUser; + return this; + } + + @java.lang.Override + public PostTransferFailedPayloadData build() { + return new PostTransferFailedPayloadData( + amount, + createdAt, + createdByUser, + currency, + destination, + destinationLedgerAccountId, + failedAt, + failureCode, + failureReason, + feeAmount, + id, + metadata, + notes, + object, + origin, + originLedgerAccountId, + status, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataCreatedByUser.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataCreatedByUser.java new file mode 100644 index 00000000..3f499378 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataCreatedByUser.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferFailedPayloadDataCreatedByUser.Builder.class) +public final class PostTransferFailedPayloadDataCreatedByUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private PostTransferFailedPayloadDataCreatedByUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferFailedPayloadDataCreatedByUser + && equalTo((PostTransferFailedPayloadDataCreatedByUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferFailedPayloadDataCreatedByUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(PostTransferFailedPayloadDataCreatedByUser other); + } + + public interface UsernameStage { + /** + *

User's username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + PostTransferFailedPayloadDataCreatedByUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferFailedPayloadDataCreatedByUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public PostTransferFailedPayloadDataCreatedByUser build() { + return new PostTransferFailedPayloadDataCreatedByUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataDestination.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataDestination.java new file mode 100644 index 00000000..533d5418 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataDestination.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class PostTransferFailedPayloadDataDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PostTransferFailedPayloadDataDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PostTransferFailedPayloadDataDestination company( + PostTransferFailedPayloadDataDestinationCompany value) { + return new PostTransferFailedPayloadDataDestination(new CompanyValue(value)); + } + + public static PostTransferFailedPayloadDataDestination user(PostTransferFailedPayloadDataDestinationUser value) { + return new PostTransferFailedPayloadDataDestination(new UserValue(value)); + } + + public boolean isCompany() { + return value instanceof CompanyValue; + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getCompany() { + if (isCompany()) { + return Optional.of(((CompanyValue) value).value); + } + return Optional.empty(); + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferFailedPayloadDataDestination + && value.equals(((PostTransferFailedPayloadDataDestination) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitCompany(PostTransferFailedPayloadDataDestinationCompany company); + + T visitUser(PostTransferFailedPayloadDataDestinationUser user); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(CompanyValue.class), @JsonSubTypes.Type(UserValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("Company") + @JsonIgnoreProperties("typename") + private static final class CompanyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PostTransferFailedPayloadDataDestinationCompany value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CompanyValue() {} + + private CompanyValue(PostTransferFailedPayloadDataDestinationCompany value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCompany(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyValue && equalTo((CompanyValue) other); + } + + private boolean equalTo(CompanyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferFailedPayloadDataDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("User") + @JsonIgnoreProperties("typename") + private static final class UserValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PostTransferFailedPayloadDataDestinationUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(PostTransferFailedPayloadDataDestinationUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferFailedPayloadDataDestination{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferFailedPayloadDataDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataDestinationCompany.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataDestinationCompany.java new file mode 100644 index 00000000..2637fe5e --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataDestinationCompany.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferFailedPayloadDataDestinationCompany.Builder.class) +public final class PostTransferFailedPayloadDataDestinationCompany { + private final String id; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private PostTransferFailedPayloadDataDestinationCompany( + String id, Optional route, Optional title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account route. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Account display name. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferFailedPayloadDataDestinationCompany + && equalTo((PostTransferFailedPayloadDataDestinationCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferFailedPayloadDataDestinationCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PostTransferFailedPayloadDataDestinationCompany other); + } + + public interface _FinalStage { + PostTransferFailedPayloadDataDestinationCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account route.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

Account display name.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional title = Optional.empty(); + + private Optional route = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferFailedPayloadDataDestinationCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID.

+ *

Account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Account display name.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Account route.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + @java.lang.Override + public PostTransferFailedPayloadDataDestinationCompany build() { + return new PostTransferFailedPayloadDataDestinationCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataDestinationUser.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataDestinationUser.java new file mode 100644 index 00000000..b8e6b5fb --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataDestinationUser.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferFailedPayloadDataDestinationUser.Builder.class) +public final class PostTransferFailedPayloadDataDestinationUser { + private final String id; + + private final Optional name; + + private final Optional username; + + private final Map additionalProperties; + + private PostTransferFailedPayloadDataDestinationUser( + String id, Optional name, Optional username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public Optional getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferFailedPayloadDataDestinationUser + && equalTo((PostTransferFailedPayloadDataDestinationUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferFailedPayloadDataDestinationUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PostTransferFailedPayloadDataDestinationUser other); + } + + public interface _FinalStage { + PostTransferFailedPayloadDataDestinationUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

User's username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional username = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferFailedPayloadDataDestinationUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

User's username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public PostTransferFailedPayloadDataDestinationUser build() { + return new PostTransferFailedPayloadDataDestinationUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataObject.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataObject.java new file mode 100644 index 00000000..64c834f4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostTransferFailedPayloadDataObject { + public static final PostTransferFailedPayloadDataObject TRANSFER = + new PostTransferFailedPayloadDataObject(Value.TRANSFER, "transfer"); + + private final Value value; + + private final String string; + + PostTransferFailedPayloadDataObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostTransferFailedPayloadDataObject + && this.string.equals(((PostTransferFailedPayloadDataObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TRANSFER: + return visitor.visitTransfer(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostTransferFailedPayloadDataObject valueOf(String value) { + switch (value) { + case "transfer": + return TRANSFER; + default: + return new PostTransferFailedPayloadDataObject(Value.UNKNOWN, value); + } + } + + public enum Value { + TRANSFER, + + UNKNOWN + } + + public interface Visitor { + T visitTransfer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataOrigin.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataOrigin.java new file mode 100644 index 00000000..99f4a15b --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataOrigin.java @@ -0,0 +1,222 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class PostTransferFailedPayloadDataOrigin { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PostTransferFailedPayloadDataOrigin(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PostTransferFailedPayloadDataOrigin company(PostTransferFailedPayloadDataOriginCompany value) { + return new PostTransferFailedPayloadDataOrigin(new CompanyValue(value)); + } + + public static PostTransferFailedPayloadDataOrigin user(PostTransferFailedPayloadDataOriginUser value) { + return new PostTransferFailedPayloadDataOrigin(new UserValue(value)); + } + + public boolean isCompany() { + return value instanceof CompanyValue; + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getCompany() { + if (isCompany()) { + return Optional.of(((CompanyValue) value).value); + } + return Optional.empty(); + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferFailedPayloadDataOrigin + && value.equals(((PostTransferFailedPayloadDataOrigin) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitCompany(PostTransferFailedPayloadDataOriginCompany company); + + T visitUser(PostTransferFailedPayloadDataOriginUser user); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(CompanyValue.class), @JsonSubTypes.Type(UserValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("Company") + @JsonIgnoreProperties("typename") + private static final class CompanyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PostTransferFailedPayloadDataOriginCompany value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CompanyValue() {} + + private CompanyValue(PostTransferFailedPayloadDataOriginCompany value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCompany(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyValue && equalTo((CompanyValue) other); + } + + private boolean equalTo(CompanyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferFailedPayloadDataOrigin{" + "value: " + value + "}"; + } + } + + @JsonTypeName("User") + @JsonIgnoreProperties("typename") + private static final class UserValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PostTransferFailedPayloadDataOriginUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(PostTransferFailedPayloadDataOriginUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferFailedPayloadDataOrigin{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PostTransferFailedPayloadDataOrigin{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataOriginCompany.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataOriginCompany.java new file mode 100644 index 00000000..292a1e79 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataOriginCompany.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferFailedPayloadDataOriginCompany.Builder.class) +public final class PostTransferFailedPayloadDataOriginCompany { + private final String id; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private PostTransferFailedPayloadDataOriginCompany( + String id, Optional route, Optional title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account route. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Account display name. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferFailedPayloadDataOriginCompany + && equalTo((PostTransferFailedPayloadDataOriginCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferFailedPayloadDataOriginCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PostTransferFailedPayloadDataOriginCompany other); + } + + public interface _FinalStage { + PostTransferFailedPayloadDataOriginCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account route.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

Account display name.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional title = Optional.empty(); + + private Optional route = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferFailedPayloadDataOriginCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID.

+ *

Account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Account display name.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Account route.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + @java.lang.Override + public PostTransferFailedPayloadDataOriginCompany build() { + return new PostTransferFailedPayloadDataOriginCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataOriginUser.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataOriginUser.java new file mode 100644 index 00000000..ead2880e --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataOriginUser.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostTransferFailedPayloadDataOriginUser.Builder.class) +public final class PostTransferFailedPayloadDataOriginUser { + private final String id; + + private final Optional name; + + private final Optional username; + + private final Map additionalProperties; + + private PostTransferFailedPayloadDataOriginUser( + String id, Optional name, Optional username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public Optional getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostTransferFailedPayloadDataOriginUser + && equalTo((PostTransferFailedPayloadDataOriginUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostTransferFailedPayloadDataOriginUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PostTransferFailedPayloadDataOriginUser other); + } + + public interface _FinalStage { + PostTransferFailedPayloadDataOriginUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

User's username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional username = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostTransferFailedPayloadDataOriginUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

User's username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public PostTransferFailedPayloadDataOriginUser build() { + return new PostTransferFailedPayloadDataOriginUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataStatus.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataStatus.java new file mode 100644 index 00000000..2c7330b3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadDataStatus.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostTransferFailedPayloadDataStatus { + public static final PostTransferFailedPayloadDataStatus FAILED = + new PostTransferFailedPayloadDataStatus(Value.FAILED, "failed"); + + public static final PostTransferFailedPayloadDataStatus SUCCEEDED = + new PostTransferFailedPayloadDataStatus(Value.SUCCEEDED, "succeeded"); + + public static final PostTransferFailedPayloadDataStatus PROCESSING = + new PostTransferFailedPayloadDataStatus(Value.PROCESSING, "processing"); + + private final Value value; + + private final String string; + + PostTransferFailedPayloadDataStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostTransferFailedPayloadDataStatus + && this.string.equals(((PostTransferFailedPayloadDataStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case SUCCEEDED: + return visitor.visitSucceeded(); + case PROCESSING: + return visitor.visitProcessing(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostTransferFailedPayloadDataStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "succeeded": + return SUCCEEDED; + case "processing": + return PROCESSING; + default: + return new PostTransferFailedPayloadDataStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PROCESSING, + + SUCCEEDED, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitProcessing(); + + T visitSucceeded(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadType.java b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadType.java new file mode 100644 index 00000000..08cbed5d --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/PostTransferFailedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostTransferFailedPayloadType { + public static final PostTransferFailedPayloadType TRANSFER_FAILED = + new PostTransferFailedPayloadType(Value.TRANSFER_FAILED, "transfer.failed"); + + private final Value value; + + private final String string; + + PostTransferFailedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostTransferFailedPayloadType + && this.string.equals(((PostTransferFailedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TRANSFER_FAILED: + return visitor.visitTransferFailed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostTransferFailedPayloadType valueOf(String value) { + switch (value) { + case "transfer.failed": + return TRANSFER_FAILED; + default: + return new PostTransferFailedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + TRANSFER_FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitTransferFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponse.java b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponse.java new file mode 100644 index 00000000..fb14c43d --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponse.java @@ -0,0 +1,990 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveTransfersResponse.Builder.class) +public final class RetrieveTransfersResponse { + private final double amount; + + private final OffsetDateTime createdAt; + + private final Optional createdByUser; + + private final String currency; + + private final RetrieveTransfersResponseDestination destination; + + private final String destinationLedgerAccountId; + + private final Optional failedAt; + + private final Optional failureCode; + + private final Optional failureReason; + + private final Optional feeAmount; + + private final String id; + + private final Optional> metadata; + + private final Optional notes; + + private final RetrieveTransfersResponseObject object; + + private final RetrieveTransfersResponseOrigin origin; + + private final String originLedgerAccountId; + + private final RetrieveTransfersResponseStatus status; + + private final Map additionalProperties; + + private RetrieveTransfersResponse( + double amount, + OffsetDateTime createdAt, + Optional createdByUser, + String currency, + RetrieveTransfersResponseDestination destination, + String destinationLedgerAccountId, + Optional failedAt, + Optional failureCode, + Optional failureReason, + Optional feeAmount, + String id, + Optional> metadata, + Optional notes, + RetrieveTransfersResponseObject object, + RetrieveTransfersResponseOrigin origin, + String originLedgerAccountId, + RetrieveTransfersResponseStatus status, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.createdByUser = createdByUser; + this.currency = currency; + this.destination = destination; + this.destinationLedgerAccountId = destinationLedgerAccountId; + this.failedAt = failedAt; + this.failureCode = failureCode; + this.failureReason = failureReason; + this.feeAmount = feeAmount; + this.id = id; + this.metadata = metadata; + this.notes = notes; + this.object = object; + this.origin = origin; + this.originLedgerAccountId = originLedgerAccountId; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Transfer amount. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return When the transfer was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable. + */ + @JsonIgnore + public Optional getCreatedByUser() { + if (createdByUser == null) { + return Optional.empty(); + } + return createdByUser; + } + + /** + * @return Transfer currency. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Account or user receiving funds. + */ + @JsonProperty("destination") + public RetrieveTransfersResponseDestination getDestination() { + return destination; + } + + /** + * @return Destination ledger account ID. + */ + @JsonProperty("destination_ledger_account_id") + public String getDestinationLedgerAccountId() { + return destinationLedgerAccountId; + } + + /** + * @return When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailedAt() { + if (failedAt == null) { + return Optional.empty(); + } + return failedAt; + } + + /** + * @return Machine-readable code for why the transfer failed. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailureCode() { + if (failureCode == null) { + return Optional.empty(); + } + return failureCode; + } + + /** + * @return Human-readable explanation of why the transfer failed. Null unless the transfer has failed. + */ + @JsonIgnore + public Optional getFailureReason() { + if (failureReason == null) { + return Optional.empty(); + } + return failureReason; + } + + /** + * @return Fee charged for the transfer. + */ + @JsonIgnore + public Optional getFeeAmount() { + if (feeAmount == null) { + return Optional.empty(); + } + return feeAmount; + } + + /** + * @return Transfer ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom metadata attached to the transfer. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Transfer note. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + /** + * @return The object type. Discriminates the create response from a send or a claim link. + */ + @JsonProperty("object") + public RetrieveTransfersResponseObject getObject() { + return object; + } + + /** + * @return Account or user sending funds. + */ + @JsonProperty("origin") + public RetrieveTransfersResponseOrigin getOrigin() { + return origin; + } + + /** + * @return Source ledger account ID. + */ + @JsonProperty("origin_ledger_account_id") + public String getOriginLedgerAccountId() { + return originLedgerAccountId; + } + + /** + * @return Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded. + */ + @JsonProperty("status") + public RetrieveTransfersResponseStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_by_user") + private Optional _getCreatedByUser() { + return createdByUser; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failed_at") + private Optional _getFailedAt() { + return failedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_code") + private Optional _getFailureCode() { + return failureCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_reason") + private Optional _getFailureReason() { + return failureReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fee_amount") + private Optional _getFeeAmount() { + return feeAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveTransfersResponse && equalTo((RetrieveTransfersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveTransfersResponse other) { + return amount == other.amount + && createdAt.equals(other.createdAt) + && createdByUser.equals(other.createdByUser) + && currency.equals(other.currency) + && destination.equals(other.destination) + && destinationLedgerAccountId.equals(other.destinationLedgerAccountId) + && failedAt.equals(other.failedAt) + && failureCode.equals(other.failureCode) + && failureReason.equals(other.failureReason) + && feeAmount.equals(other.feeAmount) + && id.equals(other.id) + && metadata.equals(other.metadata) + && notes.equals(other.notes) + && object.equals(other.object) + && origin.equals(other.origin) + && originLedgerAccountId.equals(other.originLedgerAccountId) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.createdByUser, + this.currency, + this.destination, + this.destinationLedgerAccountId, + this.failedAt, + this.failureCode, + this.failureReason, + this.feeAmount, + this.id, + this.metadata, + this.notes, + this.object, + this.origin, + this.originLedgerAccountId, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

Transfer amount.

+ */ + CreatedAtStage amount(double amount); + + Builder from(RetrieveTransfersResponse other); + } + + public interface CreatedAtStage { + /** + *

When the transfer was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

Transfer currency.

+ */ + DestinationStage currency(@NotNull String currency); + } + + public interface DestinationStage { + /** + *

Account or user receiving funds.

+ */ + DestinationLedgerAccountIdStage destination(@NotNull RetrieveTransfersResponseDestination destination); + } + + public interface DestinationLedgerAccountIdStage { + /** + *

Destination ledger account ID.

+ */ + IdStage destinationLedgerAccountId(@NotNull String destinationLedgerAccountId); + } + + public interface IdStage { + /** + *

Transfer ID.

+ */ + ObjectStage id(@NotNull String id); + } + + public interface ObjectStage { + /** + *

The object type. Discriminates the create response from a send or a claim link.

+ */ + OriginStage object(@NotNull RetrieveTransfersResponseObject object); + } + + public interface OriginStage { + /** + *

Account or user sending funds.

+ */ + OriginLedgerAccountIdStage origin(@NotNull RetrieveTransfersResponseOrigin origin); + } + + public interface OriginLedgerAccountIdStage { + /** + *

Source ledger account ID.

+ */ + StatusStage originLedgerAccountId(@NotNull String originLedgerAccountId); + } + + public interface StatusStage { + /** + *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ */ + _FinalStage status(@NotNull RetrieveTransfersResponseStatus status); + } + + public interface _FinalStage { + RetrieveTransfersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ */ + _FinalStage createdByUser(Optional createdByUser); + + _FinalStage createdByUser(RetrieveTransfersResponseCreatedByUser createdByUser); + + _FinalStage createdByUser(Nullable createdByUser); + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ */ + _FinalStage failedAt(Optional failedAt); + + _FinalStage failedAt(OffsetDateTime failedAt); + + _FinalStage failedAt(Nullable failedAt); + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ */ + _FinalStage failureCode(Optional failureCode); + + _FinalStage failureCode(String failureCode); + + _FinalStage failureCode(Nullable failureCode); + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ */ + _FinalStage failureReason(Optional failureReason); + + _FinalStage failureReason(String failureReason); + + _FinalStage failureReason(Nullable failureReason); + + /** + *

Fee charged for the transfer.

+ */ + _FinalStage feeAmount(Optional feeAmount); + + _FinalStage feeAmount(Double feeAmount); + + _FinalStage feeAmount(Nullable feeAmount); + + /** + *

Custom metadata attached to the transfer.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Transfer note.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + CurrencyStage, + DestinationStage, + DestinationLedgerAccountIdStage, + IdStage, + ObjectStage, + OriginStage, + OriginLedgerAccountIdStage, + StatusStage, + _FinalStage { + private double amount; + + private OffsetDateTime createdAt; + + private String currency; + + private RetrieveTransfersResponseDestination destination; + + private String destinationLedgerAccountId; + + private String id; + + private RetrieveTransfersResponseObject object; + + private RetrieveTransfersResponseOrigin origin; + + private String originLedgerAccountId; + + private RetrieveTransfersResponseStatus status; + + private Optional notes = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional feeAmount = Optional.empty(); + + private Optional failureReason = Optional.empty(); + + private Optional failureCode = Optional.empty(); + + private Optional failedAt = Optional.empty(); + + private Optional createdByUser = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveTransfersResponse other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + createdByUser(other.getCreatedByUser()); + currency(other.getCurrency()); + destination(other.getDestination()); + destinationLedgerAccountId(other.getDestinationLedgerAccountId()); + failedAt(other.getFailedAt()); + failureCode(other.getFailureCode()); + failureReason(other.getFailureReason()); + feeAmount(other.getFeeAmount()); + id(other.getId()); + metadata(other.getMetadata()); + notes(other.getNotes()); + object(other.getObject()); + origin(other.getOrigin()); + originLedgerAccountId(other.getOriginLedgerAccountId()); + status(other.getStatus()); + return this; + } + + /** + *

Transfer amount.

+ *

Transfer amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

When the transfer was created.

+ *

When the transfer was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Transfer currency.

+ *

Transfer currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DestinationStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Account or user receiving funds.

+ *

Account or user receiving funds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination") + public DestinationLedgerAccountIdStage destination(@NotNull RetrieveTransfersResponseDestination destination) { + this.destination = Objects.requireNonNull(destination, "destination must not be null"); + return this; + } + + /** + *

Destination ledger account ID.

+ *

Destination ledger account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination_ledger_account_id") + public IdStage destinationLedgerAccountId(@NotNull String destinationLedgerAccountId) { + this.destinationLedgerAccountId = + Objects.requireNonNull(destinationLedgerAccountId, "destinationLedgerAccountId must not be null"); + return this; + } + + /** + *

Transfer ID.

+ *

Transfer ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The object type. Discriminates the create response from a send or a claim link.

+ *

The object type. Discriminates the create response from a send or a claim link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("object") + public OriginStage object(@NotNull RetrieveTransfersResponseObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Account or user sending funds.

+ *

Account or user sending funds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("origin") + public OriginLedgerAccountIdStage origin(@NotNull RetrieveTransfersResponseOrigin origin) { + this.origin = Objects.requireNonNull(origin, "origin must not be null"); + return this; + } + + /** + *

Source ledger account ID.

+ *

Source ledger account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("origin_ledger_account_id") + public StatusStage originLedgerAccountId(@NotNull String originLedgerAccountId) { + this.originLedgerAccountId = + Objects.requireNonNull(originLedgerAccountId, "originLedgerAccountId must not be null"); + return this; + } + + /** + *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ *

Transfer status. processing means the on-chain leg is still executing — poll the transfer until it resolves to succeeded or failed. A failed transfer may be retried under the same ID and later resolve to succeeded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull RetrieveTransfersResponseStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Transfer note.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Transfer note.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Transfer note.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom metadata attached to the transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Fee charged for the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeAmount(Nullable feeAmount) { + if (feeAmount.isNull()) { + this.feeAmount = null; + } else if (feeAmount.isEmpty()) { + this.feeAmount = Optional.empty(); + } else { + this.feeAmount = Optional.of(feeAmount.get()); + } + return this; + } + + /** + *

Fee charged for the transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeAmount(Double feeAmount) { + this.feeAmount = Optional.ofNullable(feeAmount); + return this; + } + + /** + *

Fee charged for the transfer.

+ */ + @java.lang.Override + @JsonSetter(value = "fee_amount", nulls = Nulls.SKIP) + public _FinalStage feeAmount(Optional feeAmount) { + this.feeAmount = feeAmount; + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureReason(Nullable failureReason) { + if (failureReason.isNull()) { + this.failureReason = null; + } else if (failureReason.isEmpty()) { + this.failureReason = Optional.empty(); + } else { + this.failureReason = Optional.of(failureReason.get()); + } + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureReason(String failureReason) { + this.failureReason = Optional.ofNullable(failureReason); + return this; + } + + /** + *

Human-readable explanation of why the transfer failed. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_reason", nulls = Nulls.SKIP) + public _FinalStage failureReason(Optional failureReason) { + this.failureReason = failureReason; + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureCode(Nullable failureCode) { + if (failureCode.isNull()) { + this.failureCode = null; + } else if (failureCode.isEmpty()) { + this.failureCode = Optional.empty(); + } else { + this.failureCode = Optional.of(failureCode.get()); + } + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureCode(String failureCode) { + this.failureCode = Optional.ofNullable(failureCode); + return this; + } + + /** + *

Machine-readable code for why the transfer failed. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_code", nulls = Nulls.SKIP) + public _FinalStage failureCode(Optional failureCode) { + this.failureCode = failureCode; + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failedAt(Nullable failedAt) { + if (failedAt.isNull()) { + this.failedAt = null; + } else if (failedAt.isEmpty()) { + this.failedAt = Optional.empty(); + } else { + this.failedAt = Optional.of(failedAt.get()); + } + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failedAt(OffsetDateTime failedAt) { + this.failedAt = Optional.ofNullable(failedAt); + return this; + } + + /** + *

When the transfer failed, as an ISO 8601 timestamp. Null unless the transfer has failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failed_at", nulls = Nulls.SKIP) + public _FinalStage failedAt(Optional failedAt) { + this.failedAt = failedAt; + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdByUser(Nullable createdByUser) { + if (createdByUser.isNull()) { + this.createdByUser = null; + } else if (createdByUser.isEmpty()) { + this.createdByUser = Optional.empty(); + } else { + this.createdByUser = Optional.of(createdByUser.get()); + } + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdByUser(RetrieveTransfersResponseCreatedByUser createdByUser) { + this.createdByUser = Optional.ofNullable(createdByUser); + return this; + } + + /** + *

The user who initiated the transfer, such as the team member who sent a manual payout. Null if the creator is unavailable.

+ */ + @java.lang.Override + @JsonSetter(value = "created_by_user", nulls = Nulls.SKIP) + public _FinalStage createdByUser(Optional createdByUser) { + this.createdByUser = createdByUser; + return this; + } + + @java.lang.Override + public RetrieveTransfersResponse build() { + return new RetrieveTransfersResponse( + amount, + createdAt, + createdByUser, + currency, + destination, + destinationLedgerAccountId, + failedAt, + failureCode, + failureReason, + feeAmount, + id, + metadata, + notes, + object, + origin, + originLedgerAccountId, + status, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseCreatedByUser.java b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseCreatedByUser.java new file mode 100644 index 00000000..92fde231 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseCreatedByUser.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveTransfersResponseCreatedByUser.Builder.class) +public final class RetrieveTransfersResponseCreatedByUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private RetrieveTransfersResponseCreatedByUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveTransfersResponseCreatedByUser + && equalTo((RetrieveTransfersResponseCreatedByUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveTransfersResponseCreatedByUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(RetrieveTransfersResponseCreatedByUser other); + } + + public interface UsernameStage { + /** + *

User's username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + RetrieveTransfersResponseCreatedByUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveTransfersResponseCreatedByUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrieveTransfersResponseCreatedByUser build() { + return new RetrieveTransfersResponseCreatedByUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseDestination.java b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseDestination.java new file mode 100644 index 00000000..e90999d9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseDestination.java @@ -0,0 +1,222 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class RetrieveTransfersResponseDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private RetrieveTransfersResponseDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static RetrieveTransfersResponseDestination company(RetrieveTransfersResponseDestinationCompany value) { + return new RetrieveTransfersResponseDestination(new CompanyValue(value)); + } + + public static RetrieveTransfersResponseDestination user(RetrieveTransfersResponseDestinationUser value) { + return new RetrieveTransfersResponseDestination(new UserValue(value)); + } + + public boolean isCompany() { + return value instanceof CompanyValue; + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getCompany() { + if (isCompany()) { + return Optional.of(((CompanyValue) value).value); + } + return Optional.empty(); + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveTransfersResponseDestination + && value.equals(((RetrieveTransfersResponseDestination) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitCompany(RetrieveTransfersResponseDestinationCompany company); + + T visitUser(RetrieveTransfersResponseDestinationUser user); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(CompanyValue.class), @JsonSubTypes.Type(UserValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("Company") + @JsonIgnoreProperties("typename") + private static final class CompanyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private RetrieveTransfersResponseDestinationCompany value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CompanyValue() {} + + private CompanyValue(RetrieveTransfersResponseDestinationCompany value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCompany(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyValue && equalTo((CompanyValue) other); + } + + private boolean equalTo(CompanyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "RetrieveTransfersResponseDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("User") + @JsonIgnoreProperties("typename") + private static final class UserValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private RetrieveTransfersResponseDestinationUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(RetrieveTransfersResponseDestinationUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "RetrieveTransfersResponseDestination{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "RetrieveTransfersResponseDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseDestinationCompany.java b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseDestinationCompany.java new file mode 100644 index 00000000..b42364cd --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseDestinationCompany.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveTransfersResponseDestinationCompany.Builder.class) +public final class RetrieveTransfersResponseDestinationCompany { + private final String id; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private RetrieveTransfersResponseDestinationCompany( + String id, Optional route, Optional title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account route. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Account display name. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveTransfersResponseDestinationCompany + && equalTo((RetrieveTransfersResponseDestinationCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveTransfersResponseDestinationCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(RetrieveTransfersResponseDestinationCompany other); + } + + public interface _FinalStage { + RetrieveTransfersResponseDestinationCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account route.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

Account display name.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional title = Optional.empty(); + + private Optional route = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveTransfersResponseDestinationCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID.

+ *

Account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Account display name.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Account route.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + @java.lang.Override + public RetrieveTransfersResponseDestinationCompany build() { + return new RetrieveTransfersResponseDestinationCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseDestinationUser.java b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseDestinationUser.java new file mode 100644 index 00000000..5984f039 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseDestinationUser.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveTransfersResponseDestinationUser.Builder.class) +public final class RetrieveTransfersResponseDestinationUser { + private final String id; + + private final Optional name; + + private final Optional username; + + private final Map additionalProperties; + + private RetrieveTransfersResponseDestinationUser( + String id, Optional name, Optional username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public Optional getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveTransfersResponseDestinationUser + && equalTo((RetrieveTransfersResponseDestinationUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveTransfersResponseDestinationUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(RetrieveTransfersResponseDestinationUser other); + } + + public interface _FinalStage { + RetrieveTransfersResponseDestinationUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

User's username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional username = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveTransfersResponseDestinationUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

User's username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrieveTransfersResponseDestinationUser build() { + return new RetrieveTransfersResponseDestinationUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseObject.java b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseObject.java new file mode 100644 index 00000000..d2839fb6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveTransfersResponseObject { + public static final RetrieveTransfersResponseObject TRANSFER = + new RetrieveTransfersResponseObject(Value.TRANSFER, "transfer"); + + private final Value value; + + private final String string; + + RetrieveTransfersResponseObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveTransfersResponseObject + && this.string.equals(((RetrieveTransfersResponseObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TRANSFER: + return visitor.visitTransfer(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveTransfersResponseObject valueOf(String value) { + switch (value) { + case "transfer": + return TRANSFER; + default: + return new RetrieveTransfersResponseObject(Value.UNKNOWN, value); + } + } + + public enum Value { + TRANSFER, + + UNKNOWN + } + + public interface Visitor { + T visitTransfer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseOrigin.java b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseOrigin.java new file mode 100644 index 00000000..8f60d85a --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseOrigin.java @@ -0,0 +1,222 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class RetrieveTransfersResponseOrigin { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private RetrieveTransfersResponseOrigin(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static RetrieveTransfersResponseOrigin company(RetrieveTransfersResponseOriginCompany value) { + return new RetrieveTransfersResponseOrigin(new CompanyValue(value)); + } + + public static RetrieveTransfersResponseOrigin user(RetrieveTransfersResponseOriginUser value) { + return new RetrieveTransfersResponseOrigin(new UserValue(value)); + } + + public boolean isCompany() { + return value instanceof CompanyValue; + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getCompany() { + if (isCompany()) { + return Optional.of(((CompanyValue) value).value); + } + return Optional.empty(); + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveTransfersResponseOrigin + && value.equals(((RetrieveTransfersResponseOrigin) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitCompany(RetrieveTransfersResponseOriginCompany company); + + T visitUser(RetrieveTransfersResponseOriginUser user); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(CompanyValue.class), @JsonSubTypes.Type(UserValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("Company") + @JsonIgnoreProperties("typename") + private static final class CompanyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private RetrieveTransfersResponseOriginCompany value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CompanyValue() {} + + private CompanyValue(RetrieveTransfersResponseOriginCompany value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCompany(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyValue && equalTo((CompanyValue) other); + } + + private boolean equalTo(CompanyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "RetrieveTransfersResponseOrigin{" + "value: " + value + "}"; + } + } + + @JsonTypeName("User") + @JsonIgnoreProperties("typename") + private static final class UserValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private RetrieveTransfersResponseOriginUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(RetrieveTransfersResponseOriginUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "RetrieveTransfersResponseOrigin{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "RetrieveTransfersResponseOrigin{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseOriginCompany.java b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseOriginCompany.java new file mode 100644 index 00000000..08e3bb3e --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseOriginCompany.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveTransfersResponseOriginCompany.Builder.class) +public final class RetrieveTransfersResponseOriginCompany { + private final String id; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private RetrieveTransfersResponseOriginCompany( + String id, Optional route, Optional title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account route. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Account display name. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveTransfersResponseOriginCompany + && equalTo((RetrieveTransfersResponseOriginCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveTransfersResponseOriginCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(RetrieveTransfersResponseOriginCompany other); + } + + public interface _FinalStage { + RetrieveTransfersResponseOriginCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account route.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

Account display name.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional title = Optional.empty(); + + private Optional route = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveTransfersResponseOriginCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID.

+ *

Account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Account display name.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Account route.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + @java.lang.Override + public RetrieveTransfersResponseOriginCompany build() { + return new RetrieveTransfersResponseOriginCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseOriginUser.java b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseOriginUser.java new file mode 100644 index 00000000..58dd1622 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseOriginUser.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveTransfersResponseOriginUser.Builder.class) +public final class RetrieveTransfersResponseOriginUser { + private final String id; + + private final Optional name; + + private final Optional username; + + private final Map additionalProperties; + + private RetrieveTransfersResponseOriginUser( + String id, Optional name, Optional username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User's username. + */ + @JsonProperty("username") + public Optional getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveTransfersResponseOriginUser + && equalTo((RetrieveTransfersResponseOriginUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveTransfersResponseOriginUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(RetrieveTransfersResponseOriginUser other); + } + + public interface _FinalStage { + RetrieveTransfersResponseOriginUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

User's username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional username = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveTransfersResponseOriginUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

User's username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public RetrieveTransfersResponseOriginUser build() { + return new RetrieveTransfersResponseOriginUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseStatus.java b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseStatus.java new file mode 100644 index 00000000..d87e1d82 --- /dev/null +++ b/src/main/java/com/whop/api/resources/transfers/types/RetrieveTransfersResponseStatus.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.transfers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveTransfersResponseStatus { + public static final RetrieveTransfersResponseStatus FAILED = + new RetrieveTransfersResponseStatus(Value.FAILED, "failed"); + + public static final RetrieveTransfersResponseStatus SUCCEEDED = + new RetrieveTransfersResponseStatus(Value.SUCCEEDED, "succeeded"); + + public static final RetrieveTransfersResponseStatus PROCESSING = + new RetrieveTransfersResponseStatus(Value.PROCESSING, "processing"); + + private final Value value; + + private final String string; + + RetrieveTransfersResponseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveTransfersResponseStatus + && this.string.equals(((RetrieveTransfersResponseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case SUCCEEDED: + return visitor.visitSucceeded(); + case PROCESSING: + return visitor.visitProcessing(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveTransfersResponseStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "succeeded": + return SUCCEEDED; + case "processing": + return PROCESSING; + default: + return new RetrieveTransfersResponseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PROCESSING, + + SUCCEEDED, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitProcessing(); + + T visitSucceeded(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/users/AsyncRawUsersClient.java b/src/main/java/com/whop/api/resources/users/AsyncRawUsersClient.java new file mode 100644 index 00000000..95ebceae --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/AsyncRawUsersClient.java @@ -0,0 +1,736 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.users.requests.CheckAccessUsersRequest; +import com.whop.api.resources.users.requests.ListUsersRequest; +import com.whop.api.resources.users.requests.MeUsersRequest; +import com.whop.api.resources.users.requests.RecommendActionsUsersRequest; +import com.whop.api.resources.users.requests.RetrieveUsersRequest; +import com.whop.api.resources.users.requests.UpdateMeUsersRequest; +import com.whop.api.resources.users.requests.UpdateUsersRequest; +import com.whop.api.resources.users.types.CheckAccessUsersResponse; +import com.whop.api.resources.users.types.ListUsersResponse; +import com.whop.api.resources.users.types.RecommendActionsUsersResponse; +import com.whop.api.types.User; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawUsersClient { + protected final ClientOptions clientOptions; + + public AsyncRawUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public CompletableFuture>> list() { + return list(ListUsersRequest.builder().build()); + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(ListUsersRequest.builder().build(), requestOptions); + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public CompletableFuture>> list(ListUsersRequest request) { + return list(request, null); + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public CompletableFuture>> list( + ListUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users"); + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListUsersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListUsersResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListUsersRequest nextRequest = ListUsersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable(startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + if (response.code() == 401) { + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public CompletableFuture> me() { + return me(MeUsersRequest.builder().build()); + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public CompletableFuture> me(RequestOptions requestOptions) { + return me(MeUsersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public CompletableFuture> me(MeUsersRequest request) { + return me(request, null); + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public CompletableFuture> me(MeUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getIncludeBalanceHistory().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_balance_history", + request.getIncludeBalanceHistory().get(), + false); + } + if (request.getFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().get(), false); + } + if (request.getTo().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "to", request.getTo().get(), false); + } + if (request.getInterval().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "interval", request.getInterval().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, User.class), response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public CompletableFuture> updateMe() { + return updateMe(UpdateMeUsersRequest.builder().build()); + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public CompletableFuture> updateMe(RequestOptions requestOptions) { + return updateMe(UpdateMeUsersRequest.builder().build(), requestOptions); + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public CompletableFuture> updateMe(UpdateMeUsersRequest request) { + return updateMe(request, null); + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public CompletableFuture> updateMe( + UpdateMeUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, User.class), response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveUsersRequest.builder().build()); + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveUsersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public CompletableFuture> retrieve(String id, RetrieveUsersRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public CompletableFuture> retrieve( + String id, RetrieveUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getIncludeBalanceHistory().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_balance_history", + request.getIncludeBalanceHistory().get(), + false); + } + if (request.getFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().get(), false); + } + if (request.getTo().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "to", request.getTo().get(), false); + } + if (request.getInterval().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "interval", request.getInterval().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, User.class), response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public CompletableFuture> update(String id) { + return update(id, UpdateUsersRequest.builder().build()); + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateUsersRequest.builder().build(), requestOptions); + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public CompletableFuture> update(String id, UpdateUsersRequest request) { + return update(id, request, null); + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public CompletableFuture> update( + String id, UpdateUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, User.class), response)); + return; + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public CompletableFuture> checkAccess(String id, String resourceId) { + return checkAccess(id, resourceId, CheckAccessUsersRequest.builder().build()); + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public CompletableFuture> checkAccess( + String id, String resourceId, RequestOptions requestOptions) { + return checkAccess(id, resourceId, CheckAccessUsersRequest.builder().build(), requestOptions); + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public CompletableFuture> checkAccess( + String id, String resourceId, CheckAccessUsersRequest request) { + return checkAccess(id, resourceId, request, null); + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public CompletableFuture> checkAccess( + String id, String resourceId, CheckAccessUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users") + .addPathSegment(id) + .addPathSegments("access") + .addPathSegment(resourceId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CheckAccessUsersResponse.class), + response)); + return; + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public CompletableFuture> recommendActions(String id) { + return recommendActions(id, RecommendActionsUsersRequest.builder().build()); + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public CompletableFuture> recommendActions( + String id, RequestOptions requestOptions) { + return recommendActions(id, RecommendActionsUsersRequest.builder().build(), requestOptions); + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public CompletableFuture> recommendActions( + String id, RecommendActionsUsersRequest request) { + return recommendActions(id, request, null); + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public CompletableFuture> recommendActions( + String id, RecommendActionsUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users") + .addPathSegment(id) + .addPathSegments("recommend_actions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, RecommendActionsUsersResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/users/AsyncUsersClient.java b/src/main/java/com/whop/api/resources/users/AsyncUsersClient.java new file mode 100644 index 00000000..c4e2083e --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/AsyncUsersClient.java @@ -0,0 +1,266 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.users.oauthgrants.AsyncOauthGrantsClient; +import com.whop.api.resources.users.passkeys.AsyncPasskeysClient; +import com.whop.api.resources.users.preferences.AsyncPreferencesClient; +import com.whop.api.resources.users.requests.CheckAccessUsersRequest; +import com.whop.api.resources.users.requests.ListUsersRequest; +import com.whop.api.resources.users.requests.MeUsersRequest; +import com.whop.api.resources.users.requests.RecommendActionsUsersRequest; +import com.whop.api.resources.users.requests.RetrieveUsersRequest; +import com.whop.api.resources.users.requests.UpdateMeUsersRequest; +import com.whop.api.resources.users.requests.UpdateUsersRequest; +import com.whop.api.resources.users.types.CheckAccessUsersResponse; +import com.whop.api.resources.users.types.RecommendActionsUsersResponse; +import com.whop.api.types.User; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class AsyncUsersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawUsersClient rawClient; + + protected final Supplier oauthGrantsClient; + + protected final Supplier passkeysClient; + + protected final Supplier preferencesClient; + + public AsyncUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawUsersClient(clientOptions); + this.oauthGrantsClient = Suppliers.memoize(() -> new AsyncOauthGrantsClient(clientOptions)); + this.passkeysClient = Suppliers.memoize(() -> new AsyncPasskeysClient(clientOptions)); + this.preferencesClient = Suppliers.memoize(() -> new AsyncPreferencesClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawUsersClient withRawResponse() { + return this.rawClient; + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public CompletableFuture> list(ListUsersRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public CompletableFuture> list(ListUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public CompletableFuture me() { + return this.rawClient.me().thenApply(response -> response.body()); + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public CompletableFuture me(RequestOptions requestOptions) { + return this.rawClient.me(requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public CompletableFuture me(MeUsersRequest request) { + return this.rawClient.me(request).thenApply(response -> response.body()); + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public CompletableFuture me(MeUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.me(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public CompletableFuture updateMe() { + return this.rawClient.updateMe().thenApply(response -> response.body()); + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public CompletableFuture updateMe(RequestOptions requestOptions) { + return this.rawClient.updateMe(requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public CompletableFuture updateMe(UpdateMeUsersRequest request) { + return this.rawClient.updateMe(request).thenApply(response -> response.body()); + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public CompletableFuture updateMe(UpdateMeUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.updateMe(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public CompletableFuture retrieve(String id, RetrieveUsersRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public CompletableFuture retrieve(String id, RetrieveUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public CompletableFuture update(String id, UpdateUsersRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public CompletableFuture update(String id, UpdateUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public CompletableFuture checkAccess(String id, String resourceId) { + return this.rawClient.checkAccess(id, resourceId).thenApply(response -> response.body()); + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public CompletableFuture checkAccess( + String id, String resourceId, RequestOptions requestOptions) { + return this.rawClient.checkAccess(id, resourceId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public CompletableFuture checkAccess( + String id, String resourceId, CheckAccessUsersRequest request) { + return this.rawClient.checkAccess(id, resourceId, request).thenApply(response -> response.body()); + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public CompletableFuture checkAccess( + String id, String resourceId, CheckAccessUsersRequest request, RequestOptions requestOptions) { + return this.rawClient + .checkAccess(id, resourceId, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public CompletableFuture recommendActions(String id) { + return this.rawClient.recommendActions(id).thenApply(response -> response.body()); + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public CompletableFuture recommendActions(String id, RequestOptions requestOptions) { + return this.rawClient.recommendActions(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public CompletableFuture recommendActions( + String id, RecommendActionsUsersRequest request) { + return this.rawClient.recommendActions(id, request).thenApply(response -> response.body()); + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public CompletableFuture recommendActions( + String id, RecommendActionsUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.recommendActions(id, request, requestOptions).thenApply(response -> response.body()); + } + + public AsyncOauthGrantsClient oauthGrants() { + return this.oauthGrantsClient.get(); + } + + public AsyncPasskeysClient passkeys() { + return this.passkeysClient.get(); + } + + public AsyncPreferencesClient preferences() { + return this.preferencesClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/users/RawUsersClient.java b/src/main/java/com/whop/api/resources/users/RawUsersClient.java new file mode 100644 index 00000000..b7b1df46 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/RawUsersClient.java @@ -0,0 +1,620 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.users.requests.CheckAccessUsersRequest; +import com.whop.api.resources.users.requests.ListUsersRequest; +import com.whop.api.resources.users.requests.MeUsersRequest; +import com.whop.api.resources.users.requests.RecommendActionsUsersRequest; +import com.whop.api.resources.users.requests.RetrieveUsersRequest; +import com.whop.api.resources.users.requests.UpdateMeUsersRequest; +import com.whop.api.resources.users.requests.UpdateUsersRequest; +import com.whop.api.resources.users.types.CheckAccessUsersResponse; +import com.whop.api.resources.users.types.ListUsersResponse; +import com.whop.api.resources.users.types.RecommendActionsUsersResponse; +import com.whop.api.types.User; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawUsersClient { + protected final ClientOptions clientOptions; + + public RawUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public WhopApiHttpResponse> list() { + return list(ListUsersRequest.builder().build()); + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListUsersRequest.builder().build(), requestOptions); + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public WhopApiHttpResponse> list(ListUsersRequest request) { + return list(request, null); + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public WhopApiHttpResponse> list(ListUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users"); + if (request.getQuery().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "query", request.getQuery().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListUsersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListUsersResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListUsersRequest nextRequest = ListUsersRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + if (response.code() == 401) { + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public WhopApiHttpResponse me() { + return me(MeUsersRequest.builder().build()); + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public WhopApiHttpResponse me(RequestOptions requestOptions) { + return me(MeUsersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public WhopApiHttpResponse me(MeUsersRequest request) { + return me(request, null); + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public WhopApiHttpResponse me(MeUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getIncludeBalanceHistory().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_balance_history", + request.getIncludeBalanceHistory().get(), + false); + } + if (request.getFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().get(), false); + } + if (request.getTo().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "to", request.getTo().get(), false); + } + if (request.getInterval().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "interval", request.getInterval().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, User.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public WhopApiHttpResponse updateMe() { + return updateMe(UpdateMeUsersRequest.builder().build()); + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public WhopApiHttpResponse updateMe(RequestOptions requestOptions) { + return updateMe(UpdateMeUsersRequest.builder().build(), requestOptions); + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public WhopApiHttpResponse updateMe(UpdateMeUsersRequest request) { + return updateMe(request, null); + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public WhopApiHttpResponse updateMe(UpdateMeUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me"); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, User.class), response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveUsersRequest.builder().build()); + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveUsersRequest.builder().build(), requestOptions); + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveUsersRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getIncludeBalanceHistory().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_balance_history", + request.getIncludeBalanceHistory().get(), + false); + } + if (request.getFrom().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "from", request.getFrom().get(), false); + } + if (request.getTo().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "to", request.getTo().get(), false); + } + if (request.getInterval().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "interval", request.getInterval().get(), false); + } + if (request.getTimeZone().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "time_zone", request.getTimeZone().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, User.class), response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateUsersRequest.builder().build()); + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateUsersRequest.builder().build(), requestOptions); + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public WhopApiHttpResponse update(String id, UpdateUsersRequest request) { + return update(id, request, null); + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public WhopApiHttpResponse update(String id, UpdateUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users") + .addPathSegment(id); + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, User.class), response); + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public WhopApiHttpResponse checkAccess(String id, String resourceId) { + return checkAccess(id, resourceId, CheckAccessUsersRequest.builder().build()); + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public WhopApiHttpResponse checkAccess( + String id, String resourceId, RequestOptions requestOptions) { + return checkAccess(id, resourceId, CheckAccessUsersRequest.builder().build(), requestOptions); + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public WhopApiHttpResponse checkAccess( + String id, String resourceId, CheckAccessUsersRequest request) { + return checkAccess(id, resourceId, request, null); + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public WhopApiHttpResponse checkAccess( + String id, String resourceId, CheckAccessUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users") + .addPathSegment(id) + .addPathSegments("access") + .addPathSegment(resourceId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CheckAccessUsersResponse.class), + response); + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public WhopApiHttpResponse recommendActions(String id) { + return recommendActions(id, RecommendActionsUsersRequest.builder().build()); + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public WhopApiHttpResponse recommendActions( + String id, RequestOptions requestOptions) { + return recommendActions(id, RecommendActionsUsersRequest.builder().build(), requestOptions); + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public WhopApiHttpResponse recommendActions( + String id, RecommendActionsUsersRequest request) { + return recommendActions(id, request, null); + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public WhopApiHttpResponse recommendActions( + String id, RecommendActionsUsersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users") + .addPathSegment(id) + .addPathSegments("recommend_actions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RecommendActionsUsersResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/UsersClient.java b/src/main/java/com/whop/api/resources/users/UsersClient.java new file mode 100644 index 00000000..0968c2fe --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/UsersClient.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.users.oauthgrants.OauthGrantsClient; +import com.whop.api.resources.users.passkeys.PasskeysClient; +import com.whop.api.resources.users.preferences.PreferencesClient; +import com.whop.api.resources.users.requests.CheckAccessUsersRequest; +import com.whop.api.resources.users.requests.ListUsersRequest; +import com.whop.api.resources.users.requests.MeUsersRequest; +import com.whop.api.resources.users.requests.RecommendActionsUsersRequest; +import com.whop.api.resources.users.requests.RetrieveUsersRequest; +import com.whop.api.resources.users.requests.UpdateMeUsersRequest; +import com.whop.api.resources.users.requests.UpdateUsersRequest; +import com.whop.api.resources.users.types.CheckAccessUsersResponse; +import com.whop.api.resources.users.types.RecommendActionsUsersResponse; +import com.whop.api.types.User; +import java.util.function.Supplier; + +public class UsersClient { + protected final ClientOptions clientOptions; + + private final RawUsersClient rawClient; + + protected final Supplier oauthGrantsClient; + + protected final Supplier passkeysClient; + + protected final Supplier preferencesClient; + + public UsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawUsersClient(clientOptions); + this.oauthGrantsClient = Suppliers.memoize(() -> new OauthGrantsClient(clientOptions)); + this.passkeysClient = Suppliers.memoize(() -> new PasskeysClient(clientOptions)); + this.preferencesClient = Suppliers.memoize(() -> new PreferencesClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawUsersClient withRawResponse() { + return this.rawClient; + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public SyncPagingIterable list(ListUsersRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given. + */ + public SyncPagingIterable list(ListUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public User me() { + return this.rawClient.me().body(); + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public User me(RequestOptions requestOptions) { + return this.rawClient.me(requestOptions).body(); + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public User me(MeUsersRequest request) { + return this.rawClient.me(request).body(); + } + + /** + * Retrieves the authenticated user — the self view of the user object. Same shape as GET /users/{id}, with the self-only fields populated: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), the opt-in balance_history, and every linked social account. + */ + public User me(MeUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.me(request, requestOptions).body(); + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public User updateMe() { + return this.rawClient.updateMe().body(); + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public User updateMe(RequestOptions requestOptions) { + return this.rawClient.updateMe(requestOptions).body(); + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public User updateMe(UpdateMeUsersRequest request) { + return this.rawClient.updateMe(request).body(); + } + + /** + * Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys. + */ + public User updateMe(UpdateMeUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.updateMe(request, requestOptions).body(); + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public User retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public User retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public User retrieve(String id, RetrieveUsersRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves a user by user_ tag or username, or the authenticated user with the reserved id me. Profiles include linked social accounts — reading your own profile returns every linked account, other profiles only what is public on Whop (the primary Discord and the X account). The self-only fields are populated only when the id is me: email (email-read scope), staff (Whop staff only, staff-read scope), balance and earnings_usd (balance-read scope), and the opt-in balance_history. They are always null when addressing a user by tag or username. + */ + public User retrieve(String id, RetrieveUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public User update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public User update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public User update(String id, UpdateUsersRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Updates a user, addressed by user_ tag, username, or the reserved id me for the authenticated user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required). + */ + public User update(String id, UpdateUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public CheckAccessUsersResponse checkAccess(String id, String resourceId) { + return this.rawClient.checkAccess(id, resourceId).body(); + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public CheckAccessUsersResponse checkAccess(String id, String resourceId, RequestOptions requestOptions) { + return this.rawClient.checkAccess(id, resourceId, requestOptions).body(); + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public CheckAccessUsersResponse checkAccess(String id, String resourceId, CheckAccessUsersRequest request) { + return this.rawClient.checkAccess(id, resourceId, request).body(); + } + + /** + * Checks whether a user has access to an account, product, or experience the caller can reach. + */ + public CheckAccessUsersResponse checkAccess( + String id, String resourceId, CheckAccessUsersRequest request, RequestOptions requestOptions) { + return this.rawClient + .checkAccess(id, resourceId, request, requestOptions) + .body(); + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public RecommendActionsUsersResponse recommendActions(String id) { + return this.rawClient.recommendActions(id).body(); + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public RecommendActionsUsersResponse recommendActions(String id, RequestOptions requestOptions) { + return this.rawClient.recommendActions(id, requestOptions).body(); + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public RecommendActionsUsersResponse recommendActions(String id, RecommendActionsUsersRequest request) { + return this.rawClient.recommendActions(id, request).body(); + } + + /** + * Lists the recommended actions computed for the user: personal suggestions (e.g. start a business or become an affiliate) pooled with the highest-impact actions across the accounts the user owns. Business actions are tagged with their account_id/account_name; personal actions leave those null. Self-only: id must be me or the authenticated user's own tag/username. + */ + public RecommendActionsUsersResponse recommendActions( + String id, RecommendActionsUsersRequest request, RequestOptions requestOptions) { + return this.rawClient.recommendActions(id, request, requestOptions).body(); + } + + public OauthGrantsClient oauthGrants() { + return this.oauthGrantsClient.get(); + } + + public PasskeysClient passkeys() { + return this.passkeysClient.get(); + } + + public PreferencesClient preferences() { + return this.preferencesClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/users/oauthgrants/AsyncOauthGrantsClient.java b/src/main/java/com/whop/api/resources/users/oauthgrants/AsyncOauthGrantsClient.java new file mode 100644 index 00000000..9b16c464 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/oauthgrants/AsyncOauthGrantsClient.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.oauthgrants; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.users.oauthgrants.requests.CreateOauthGrantsRequest; +import com.whop.api.resources.users.oauthgrants.requests.ListOauthGrantsRequest; +import com.whop.api.types.OauthGrant; +import java.util.concurrent.CompletableFuture; + +public class AsyncOauthGrantsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawOauthGrantsClient rawClient; + + public AsyncOauthGrantsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawOauthGrantsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawOauthGrantsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public CompletableFuture> list(ListOauthGrantsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public CompletableFuture> list( + ListOauthGrantsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Completes the OAuth authorization step for the authenticated user: records their consent for the scopes an app asked for and mints the authorization code to hand back to it. Returns the grant, plus a redirect_url carrying that code — the one and only time it is returned. Exchange the code at POST /oauth/token with the verifier for code_challenge. Requires a user session, because consent has to come from the account holder: an API key or an OAuth token is refused, so an app can never authorize itself. Send an Idempotency-Key to make a retry safe — a replay returns the original redirect_url and its code rather than issuing a second one. + */ + public CompletableFuture create(CreateOauthGrantsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Completes the OAuth authorization step for the authenticated user: records their consent for the scopes an app asked for and mints the authorization code to hand back to it. Returns the grant, plus a redirect_url carrying that code — the one and only time it is returned. Exchange the code at POST /oauth/token with the verifier for code_challenge. Requires a user session, because consent has to come from the account holder: an API key or an OAuth token is refused, so an app can never authorize itself. Send an Idempotency-Key to make a retry safe — a replay returns the original redirect_url and its code rather than issuing a second one. + */ + public CompletableFuture create(CreateOauthGrantsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/users/oauthgrants/AsyncRawOauthGrantsClient.java b/src/main/java/com/whop/api/resources/users/oauthgrants/AsyncRawOauthGrantsClient.java new file mode 100644 index 00000000..e4c3e8ba --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/oauthgrants/AsyncRawOauthGrantsClient.java @@ -0,0 +1,285 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.oauthgrants; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.users.oauthgrants.requests.CreateOauthGrantsRequest; +import com.whop.api.resources.users.oauthgrants.requests.ListOauthGrantsRequest; +import com.whop.api.resources.users.oauthgrants.types.ListOauthGrantsResponse; +import com.whop.api.types.OauthGrant; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawOauthGrantsClient { + protected final ClientOptions clientOptions; + + public AsyncRawOauthGrantsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public CompletableFuture>> list() { + return list(ListOauthGrantsRequest.builder().build()); + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(ListOauthGrantsRequest.builder().build(), requestOptions); + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public CompletableFuture>> list(ListOauthGrantsRequest request) { + return list(request, null); + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public CompletableFuture>> list( + ListOauthGrantsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/oauth_grants"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListOauthGrantsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListOauthGrantsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListOauthGrantsRequest nextRequest = ListOauthGrantsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Completes the OAuth authorization step for the authenticated user: records their consent for the scopes an app asked for and mints the authorization code to hand back to it. Returns the grant, plus a redirect_url carrying that code — the one and only time it is returned. Exchange the code at POST /oauth/token with the verifier for code_challenge. Requires a user session, because consent has to come from the account holder: an API key or an OAuth token is refused, so an app can never authorize itself. Send an Idempotency-Key to make a retry safe — a replay returns the original redirect_url and its code rather than issuing a second one. + */ + public CompletableFuture> create(CreateOauthGrantsRequest request) { + return create(request, null); + } + + /** + * Completes the OAuth authorization step for the authenticated user: records their consent for the scopes an app asked for and mints the authorization code to hand back to it. Returns the grant, plus a redirect_url carrying that code — the one and only time it is returned. Exchange the code at POST /oauth/token with the verifier for code_challenge. Requires a user session, because consent has to come from the account holder: an API key or an OAuth token is refused, so an app can never authorize itself. Send an Idempotency-Key to make a retry safe — a replay returns the original redirect_url and its code rather than issuing a second one. + */ + public CompletableFuture> create( + CreateOauthGrantsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/oauth_grants"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, OauthGrant.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/users/oauthgrants/OauthGrantsClient.java b/src/main/java/com/whop/api/resources/users/oauthgrants/OauthGrantsClient.java new file mode 100644 index 00000000..1b881d8d --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/oauthgrants/OauthGrantsClient.java @@ -0,0 +1,71 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.oauthgrants; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.users.oauthgrants.requests.CreateOauthGrantsRequest; +import com.whop.api.resources.users.oauthgrants.requests.ListOauthGrantsRequest; +import com.whop.api.types.OauthGrant; + +public class OauthGrantsClient { + protected final ClientOptions clientOptions; + + private final RawOauthGrantsClient rawClient; + + public OauthGrantsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawOauthGrantsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawOauthGrantsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public SyncPagingIterable list(ListOauthGrantsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public SyncPagingIterable list(ListOauthGrantsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Completes the OAuth authorization step for the authenticated user: records their consent for the scopes an app asked for and mints the authorization code to hand back to it. Returns the grant, plus a redirect_url carrying that code — the one and only time it is returned. Exchange the code at POST /oauth/token with the verifier for code_challenge. Requires a user session, because consent has to come from the account holder: an API key or an OAuth token is refused, so an app can never authorize itself. Send an Idempotency-Key to make a retry safe — a replay returns the original redirect_url and its code rather than issuing a second one. + */ + public OauthGrant create(CreateOauthGrantsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Completes the OAuth authorization step for the authenticated user: records their consent for the scopes an app asked for and mints the authorization code to hand back to it. Returns the grant, plus a redirect_url carrying that code — the one and only time it is returned. Exchange the code at POST /oauth/token with the verifier for code_challenge. Requires a user session, because consent has to come from the account holder: an API key or an OAuth token is refused, so an app can never authorize itself. Send an Idempotency-Key to make a retry safe — a replay returns the original redirect_url and its code rather than issuing a second one. + */ + public OauthGrant create(CreateOauthGrantsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/users/oauthgrants/RawOauthGrantsClient.java b/src/main/java/com/whop/api/resources/users/oauthgrants/RawOauthGrantsClient.java new file mode 100644 index 00000000..cbfb860f --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/oauthgrants/RawOauthGrantsClient.java @@ -0,0 +1,230 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.oauthgrants; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.users.oauthgrants.requests.CreateOauthGrantsRequest; +import com.whop.api.resources.users.oauthgrants.requests.ListOauthGrantsRequest; +import com.whop.api.resources.users.oauthgrants.types.ListOauthGrantsResponse; +import com.whop.api.types.OauthGrant; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawOauthGrantsClient { + protected final ClientOptions clientOptions; + + public RawOauthGrantsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public WhopApiHttpResponse> list() { + return list(ListOauthGrantsRequest.builder().build()); + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListOauthGrantsRequest.builder().build(), requestOptions); + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public WhopApiHttpResponse> list(ListOauthGrantsRequest request) { + return list(request, null); + } + + /** + * Lists the authenticated user's own OAuth grants — one per app they have authorized, per account they authorized it for. The list is always the caller's own; there is no parameter for reading another user's grants. Requires a user session: an API key or an OAuth token is refused, so an app can never enumerate the other apps a user has authorized. + */ + public WhopApiHttpResponse> list( + ListOauthGrantsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/oauth_grants"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListOauthGrantsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListOauthGrantsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListOauthGrantsRequest nextRequest = ListOauthGrantsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Completes the OAuth authorization step for the authenticated user: records their consent for the scopes an app asked for and mints the authorization code to hand back to it. Returns the grant, plus a redirect_url carrying that code — the one and only time it is returned. Exchange the code at POST /oauth/token with the verifier for code_challenge. Requires a user session, because consent has to come from the account holder: an API key or an OAuth token is refused, so an app can never authorize itself. Send an Idempotency-Key to make a retry safe — a replay returns the original redirect_url and its code rather than issuing a second one. + */ + public WhopApiHttpResponse create(CreateOauthGrantsRequest request) { + return create(request, null); + } + + /** + * Completes the OAuth authorization step for the authenticated user: records their consent for the scopes an app asked for and mints the authorization code to hand back to it. Returns the grant, plus a redirect_url carrying that code — the one and only time it is returned. Exchange the code at POST /oauth/token with the verifier for code_challenge. Requires a user session, because consent has to come from the account holder: an API key or an OAuth token is refused, so an app can never authorize itself. Send an Idempotency-Key to make a retry safe — a replay returns the original redirect_url and its code rather than issuing a second one. + */ + public WhopApiHttpResponse create(CreateOauthGrantsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/oauth_grants"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, OauthGrant.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/oauthgrants/requests/CreateOauthGrantsRequest.java b/src/main/java/com/whop/api/resources/users/oauthgrants/requests/CreateOauthGrantsRequest.java new file mode 100644 index 00000000..600c54cb --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/oauthgrants/requests/CreateOauthGrantsRequest.java @@ -0,0 +1,541 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.oauthgrants.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.users.oauthgrants.types.CreateOauthGrantsRequestCodeChallengeMethod; +import com.whop.api.resources.users.oauthgrants.types.CreateOauthGrantsRequestResponseType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOauthGrantsRequest.Builder.class) +public final class CreateOauthGrantsRequest { + private final Optional accountId; + + private final String clientId; + + private final String codeChallenge; + + private final CreateOauthGrantsRequestCodeChallengeMethod codeChallengeMethod; + + private final Optional consentShown; + + private final Optional nonce; + + private final String redirectUri; + + private final List requestedScopes; + + private final Optional responseType; + + private final Optional state; + + private final Map additionalProperties; + + private CreateOauthGrantsRequest( + Optional accountId, + String clientId, + String codeChallenge, + CreateOauthGrantsRequestCodeChallengeMethod codeChallengeMethod, + Optional consentShown, + Optional nonce, + String redirectUri, + List requestedScopes, + Optional responseType, + Optional state, + Map additionalProperties) { + this.accountId = accountId; + this.clientId = clientId; + this.codeChallenge = codeChallenge; + this.codeChallengeMethod = codeChallengeMethod; + this.consentShown = consentShown; + this.nonce = nonce; + this.redirectUri = redirectUri; + this.requestedScopes = requestedScopes; + this.responseType = responseType; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return Authorize the app for one of the user's accounts rather than for the user alone, prefixed biz_. The user must have access to it. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return The app being authorized, prefixed app_. + */ + @JsonProperty("client_id") + public String getClientId() { + return clientId; + } + + /** + * @return The PKCE code challenge: the base64url-encoded SHA-256 of your code verifier, without padding. + */ + @JsonProperty("code_challenge") + public String getCodeChallenge() { + return codeChallenge; + } + + /** + * @return How code_challenge was derived. Only S256 is accepted. + */ + @JsonProperty("code_challenge_method") + public CreateOauthGrantsRequestCodeChallengeMethod getCodeChallengeMethod() { + return codeChallengeMethod; + } + + /** + * @return Whether the consent UI listed these scopes for the user. Sending false succeeds only when the user has already granted every scope requested. + */ + @JsonProperty("consent_shown") + public Optional getConsentShown() { + return consentShown; + } + + /** + * @return OIDC nonce, echoed into the resulting ID token. Required when requested_scopes includes openid. + */ + @JsonProperty("nonce") + public Optional getNonce() { + return nonce; + } + + /** + * @return Where to send the user once they have consented. Must match one of the app's registered redirect URIs exactly — it is compared as a string, not normalized. + */ + @JsonProperty("redirect_uri") + public String getRedirectUri() { + return redirectUri; + } + + /** + * @return The permissions the app is asking for, for example member:basic:read. GET /api_keys/permissions names and describes each one. Granting adds to whatever the user already granted this app rather than replacing it. + */ + @JsonProperty("requested_scopes") + public List getRequestedScopes() { + return requestedScopes; + } + + /** + * @return The OAuth response type. Only code is accepted; defaults to code. + */ + @JsonProperty("response_type") + public Optional getResponseType() { + return responseType; + } + + /** + * @return Opaque value appended to redirect_url unchanged, for the client to correlate the response with its request. + */ + @JsonProperty("state") + public Optional getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOauthGrantsRequest && equalTo((CreateOauthGrantsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOauthGrantsRequest other) { + return accountId.equals(other.accountId) + && clientId.equals(other.clientId) + && codeChallenge.equals(other.codeChallenge) + && codeChallengeMethod.equals(other.codeChallengeMethod) + && consentShown.equals(other.consentShown) + && nonce.equals(other.nonce) + && redirectUri.equals(other.redirectUri) + && requestedScopes.equals(other.requestedScopes) + && responseType.equals(other.responseType) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.clientId, + this.codeChallenge, + this.codeChallengeMethod, + this.consentShown, + this.nonce, + this.redirectUri, + this.requestedScopes, + this.responseType, + this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ClientIdStage builder() { + return new Builder(); + } + + public interface ClientIdStage { + /** + *

The app being authorized, prefixed app_.

+ */ + CodeChallengeStage clientId(@NotNull String clientId); + + Builder from(CreateOauthGrantsRequest other); + } + + public interface CodeChallengeStage { + /** + *

The PKCE code challenge: the base64url-encoded SHA-256 of your code verifier, without padding.

+ */ + CodeChallengeMethodStage codeChallenge(@NotNull String codeChallenge); + } + + public interface CodeChallengeMethodStage { + /** + *

How code_challenge was derived. Only S256 is accepted.

+ */ + RedirectUriStage codeChallengeMethod(@NotNull CreateOauthGrantsRequestCodeChallengeMethod codeChallengeMethod); + } + + public interface RedirectUriStage { + /** + *

Where to send the user once they have consented. Must match one of the app's registered redirect URIs exactly — it is compared as a string, not normalized.

+ */ + _FinalStage redirectUri(@NotNull String redirectUri); + } + + public interface _FinalStage { + CreateOauthGrantsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Authorize the app for one of the user's accounts rather than for the user alone, prefixed biz_. The user must have access to it.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + /** + *

Whether the consent UI listed these scopes for the user. Sending false succeeds only when the user has already granted every scope requested.

+ */ + _FinalStage consentShown(Optional consentShown); + + _FinalStage consentShown(Boolean consentShown); + + /** + *

OIDC nonce, echoed into the resulting ID token. Required when requested_scopes includes openid.

+ */ + _FinalStage nonce(Optional nonce); + + _FinalStage nonce(String nonce); + + /** + *

The permissions the app is asking for, for example member:basic:read. GET /api_keys/permissions names and describes each one. Granting adds to whatever the user already granted this app rather than replacing it.

+ */ + _FinalStage requestedScopes(List requestedScopes); + + _FinalStage addRequestedScopes(String requestedScopes); + + _FinalStage addAllRequestedScopes(List requestedScopes); + + /** + *

The OAuth response type. Only code is accepted; defaults to code.

+ */ + _FinalStage responseType(Optional responseType); + + _FinalStage responseType(CreateOauthGrantsRequestResponseType responseType); + + /** + *

Opaque value appended to redirect_url unchanged, for the client to correlate the response with its request.

+ */ + _FinalStage state(Optional state); + + _FinalStage state(String state); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ClientIdStage, CodeChallengeStage, CodeChallengeMethodStage, RedirectUriStage, _FinalStage { + private String clientId; + + private String codeChallenge; + + private CreateOauthGrantsRequestCodeChallengeMethod codeChallengeMethod; + + private String redirectUri; + + private Optional state = Optional.empty(); + + private Optional responseType = Optional.empty(); + + private List requestedScopes = new ArrayList<>(); + + private Optional nonce = Optional.empty(); + + private Optional consentShown = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOauthGrantsRequest other) { + accountId(other.getAccountId()); + clientId(other.getClientId()); + codeChallenge(other.getCodeChallenge()); + codeChallengeMethod(other.getCodeChallengeMethod()); + consentShown(other.getConsentShown()); + nonce(other.getNonce()); + redirectUri(other.getRedirectUri()); + requestedScopes(other.getRequestedScopes()); + responseType(other.getResponseType()); + state(other.getState()); + return this; + } + + /** + *

The app being authorized, prefixed app_.

+ *

The app being authorized, prefixed app_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("client_id") + public CodeChallengeStage clientId(@NotNull String clientId) { + this.clientId = Objects.requireNonNull(clientId, "clientId must not be null"); + return this; + } + + /** + *

The PKCE code challenge: the base64url-encoded SHA-256 of your code verifier, without padding.

+ *

The PKCE code challenge: the base64url-encoded SHA-256 of your code verifier, without padding.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("code_challenge") + public CodeChallengeMethodStage codeChallenge(@NotNull String codeChallenge) { + this.codeChallenge = Objects.requireNonNull(codeChallenge, "codeChallenge must not be null"); + return this; + } + + /** + *

How code_challenge was derived. Only S256 is accepted.

+ *

How code_challenge was derived. Only S256 is accepted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("code_challenge_method") + public RedirectUriStage codeChallengeMethod( + @NotNull CreateOauthGrantsRequestCodeChallengeMethod codeChallengeMethod) { + this.codeChallengeMethod = + Objects.requireNonNull(codeChallengeMethod, "codeChallengeMethod must not be null"); + return this; + } + + /** + *

Where to send the user once they have consented. Must match one of the app's registered redirect URIs exactly — it is compared as a string, not normalized.

+ *

Where to send the user once they have consented. Must match one of the app's registered redirect URIs exactly — it is compared as a string, not normalized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("redirect_uri") + public _FinalStage redirectUri(@NotNull String redirectUri) { + this.redirectUri = Objects.requireNonNull(redirectUri, "redirectUri must not be null"); + return this; + } + + /** + *

Opaque value appended to redirect_url unchanged, for the client to correlate the response with its request.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + /** + *

Opaque value appended to redirect_url unchanged, for the client to correlate the response with its request.

+ */ + @java.lang.Override + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public _FinalStage state(Optional state) { + this.state = state; + return this; + } + + /** + *

The OAuth response type. Only code is accepted; defaults to code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage responseType(CreateOauthGrantsRequestResponseType responseType) { + this.responseType = Optional.ofNullable(responseType); + return this; + } + + /** + *

The OAuth response type. Only code is accepted; defaults to code.

+ */ + @java.lang.Override + @JsonSetter(value = "response_type", nulls = Nulls.SKIP) + public _FinalStage responseType(Optional responseType) { + this.responseType = responseType; + return this; + } + + /** + *

The permissions the app is asking for, for example member:basic:read. GET /api_keys/permissions names and describes each one. Granting adds to whatever the user already granted this app rather than replacing it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllRequestedScopes(List requestedScopes) { + if (requestedScopes != null) { + this.requestedScopes.addAll(requestedScopes); + } + return this; + } + + /** + *

The permissions the app is asking for, for example member:basic:read. GET /api_keys/permissions names and describes each one. Granting adds to whatever the user already granted this app rather than replacing it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addRequestedScopes(String requestedScopes) { + this.requestedScopes.add(requestedScopes); + return this; + } + + /** + *

The permissions the app is asking for, for example member:basic:read. GET /api_keys/permissions names and describes each one. Granting adds to whatever the user already granted this app rather than replacing it.

+ */ + @java.lang.Override + @JsonSetter(value = "requested_scopes", nulls = Nulls.SKIP) + public _FinalStage requestedScopes(List requestedScopes) { + this.requestedScopes.clear(); + if (requestedScopes != null) { + this.requestedScopes.addAll(requestedScopes); + } + return this; + } + + /** + *

OIDC nonce, echoed into the resulting ID token. Required when requested_scopes includes openid.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nonce(String nonce) { + this.nonce = Optional.ofNullable(nonce); + return this; + } + + /** + *

OIDC nonce, echoed into the resulting ID token. Required when requested_scopes includes openid.

+ */ + @java.lang.Override + @JsonSetter(value = "nonce", nulls = Nulls.SKIP) + public _FinalStage nonce(Optional nonce) { + this.nonce = nonce; + return this; + } + + /** + *

Whether the consent UI listed these scopes for the user. Sending false succeeds only when the user has already granted every scope requested.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage consentShown(Boolean consentShown) { + this.consentShown = Optional.ofNullable(consentShown); + return this; + } + + /** + *

Whether the consent UI listed these scopes for the user. Sending false succeeds only when the user has already granted every scope requested.

+ */ + @java.lang.Override + @JsonSetter(value = "consent_shown", nulls = Nulls.SKIP) + public _FinalStage consentShown(Optional consentShown) { + this.consentShown = consentShown; + return this; + } + + /** + *

Authorize the app for one of the user's accounts rather than for the user alone, prefixed biz_. The user must have access to it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Authorize the app for one of the user's accounts rather than for the user alone, prefixed biz_. The user must have access to it.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public CreateOauthGrantsRequest build() { + return new CreateOauthGrantsRequest( + accountId, + clientId, + codeChallenge, + codeChallengeMethod, + consentShown, + nonce, + redirectUri, + requestedScopes, + responseType, + state, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/oauthgrants/requests/ListOauthGrantsRequest.java b/src/main/java/com/whop/api/resources/users/oauthgrants/requests/ListOauthGrantsRequest.java new file mode 100644 index 00000000..c2ee9b25 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/oauthgrants/requests/ListOauthGrantsRequest.java @@ -0,0 +1,296 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.oauthgrants.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.users.oauthgrants.types.ListOauthGrantsRequestDirection; +import com.whop.api.resources.users.oauthgrants.types.ListOauthGrantsRequestOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListOauthGrantsRequest.Builder.class) +public final class ListOauthGrantsRequest { + private final Optional appId; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Optional order; + + private final Optional direction; + + private final Map additionalProperties; + + private ListOauthGrantsRequest( + Optional appId, + Optional first, + Optional after, + Optional last, + Optional before, + Optional order, + Optional direction, + Map additionalProperties) { + this.appId = appId; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.order = order; + this.direction = direction; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only return grants for this app, prefixed app_. An app the user has never authorized returns an empty list. + */ + @JsonProperty("app_id") + public Optional getAppId() { + return appId; + } + + /** + * @return The number of grants to return (default 20, max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns grants after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of grants to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns grants before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The field to sort grants by. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListOauthGrantsRequest && equalTo((ListOauthGrantsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListOauthGrantsRequest other) { + return appId.equals(other.appId) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before) + && order.equals(other.order) + && direction.equals(other.direction); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.appId, this.first, this.after, this.last, this.before, this.order, this.direction); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional appId = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListOauthGrantsRequest other) { + appId(other.getAppId()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + order(other.getOrder()); + direction(other.getDirection()); + return this; + } + + /** + *

Only return grants for this app, prefixed app_. An app the user has never authorized returns an empty list.

+ */ + @JsonSetter(value = "app_id", nulls = Nulls.SKIP) + public Builder appId(Optional appId) { + this.appId = appId; + return this; + } + + public Builder appId(String appId) { + this.appId = Optional.ofNullable(appId); + return this; + } + + /** + *

The number of grants to return (default 20, max 100).

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor; returns grants after this position.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The number of grants to return from the end of the range.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

A cursor; returns grants before this position.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The field to sort grants by.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListOauthGrantsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListOauthGrantsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + public ListOauthGrantsRequest build() { + return new ListOauthGrantsRequest( + appId, first, after, last, before, order, direction, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/oauthgrants/types/CreateOauthGrantsRequestCodeChallengeMethod.java b/src/main/java/com/whop/api/resources/users/oauthgrants/types/CreateOauthGrantsRequestCodeChallengeMethod.java new file mode 100644 index 00000000..d0bc4741 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/oauthgrants/types/CreateOauthGrantsRequestCodeChallengeMethod.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.oauthgrants.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateOauthGrantsRequestCodeChallengeMethod { + public static final CreateOauthGrantsRequestCodeChallengeMethod S256 = + new CreateOauthGrantsRequestCodeChallengeMethod(Value.S256, "S256"); + + private final Value value; + + private final String string; + + CreateOauthGrantsRequestCodeChallengeMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateOauthGrantsRequestCodeChallengeMethod + && this.string.equals(((CreateOauthGrantsRequestCodeChallengeMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case S256: + return visitor.visitS256(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateOauthGrantsRequestCodeChallengeMethod valueOf(String value) { + switch (value) { + case "S256": + return S256; + default: + return new CreateOauthGrantsRequestCodeChallengeMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + S256, + + UNKNOWN + } + + public interface Visitor { + T visitS256(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/users/oauthgrants/types/CreateOauthGrantsRequestResponseType.java b/src/main/java/com/whop/api/resources/users/oauthgrants/types/CreateOauthGrantsRequestResponseType.java new file mode 100644 index 00000000..917b4e3f --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/oauthgrants/types/CreateOauthGrantsRequestResponseType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.oauthgrants.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateOauthGrantsRequestResponseType { + public static final CreateOauthGrantsRequestResponseType CODE = + new CreateOauthGrantsRequestResponseType(Value.CODE, "code"); + + private final Value value; + + private final String string; + + CreateOauthGrantsRequestResponseType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateOauthGrantsRequestResponseType + && this.string.equals(((CreateOauthGrantsRequestResponseType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CODE: + return visitor.visitCode(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateOauthGrantsRequestResponseType valueOf(String value) { + switch (value) { + case "code": + return CODE; + default: + return new CreateOauthGrantsRequestResponseType(Value.UNKNOWN, value); + } + } + + public enum Value { + CODE, + + UNKNOWN + } + + public interface Visitor { + T visitCode(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/users/oauthgrants/types/ListOauthGrantsRequestDirection.java b/src/main/java/com/whop/api/resources/users/oauthgrants/types/ListOauthGrantsRequestDirection.java new file mode 100644 index 00000000..ece0f102 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/oauthgrants/types/ListOauthGrantsRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.oauthgrants.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListOauthGrantsRequestDirection { + public static final ListOauthGrantsRequestDirection ASC = new ListOauthGrantsRequestDirection(Value.ASC, "asc"); + + public static final ListOauthGrantsRequestDirection DESC = new ListOauthGrantsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListOauthGrantsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListOauthGrantsRequestDirection + && this.string.equals(((ListOauthGrantsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListOauthGrantsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListOauthGrantsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/users/oauthgrants/types/ListOauthGrantsRequestOrder.java b/src/main/java/com/whop/api/resources/users/oauthgrants/types/ListOauthGrantsRequestOrder.java new file mode 100644 index 00000000..a39e556c --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/oauthgrants/types/ListOauthGrantsRequestOrder.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.oauthgrants.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListOauthGrantsRequestOrder { + public static final ListOauthGrantsRequestOrder CREATED_AT = + new ListOauthGrantsRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListOauthGrantsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListOauthGrantsRequestOrder + && this.string.equals(((ListOauthGrantsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListOauthGrantsRequestOrder valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + default: + return new ListOauthGrantsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/users/oauthgrants/types/ListOauthGrantsResponse.java b/src/main/java/com/whop/api/resources/users/oauthgrants/types/ListOauthGrantsResponse.java new file mode 100644 index 00000000..793d4128 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/oauthgrants/types/ListOauthGrantsResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.oauthgrants.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.OauthGrant; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListOauthGrantsResponse.Builder.class) +public final class ListOauthGrantsResponse { + private final List data; + + private final ListOauthGrantsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListOauthGrantsResponse( + List data, ListOauthGrantsResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListOauthGrantsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListOauthGrantsResponse && equalTo((ListOauthGrantsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListOauthGrantsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListOauthGrantsResponsePageInfo pageInfo); + + Builder from(ListOauthGrantsResponse other); + } + + public interface _FinalStage { + ListOauthGrantsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(OauthGrant data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListOauthGrantsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListOauthGrantsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListOauthGrantsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(OauthGrant data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListOauthGrantsResponse build() { + return new ListOauthGrantsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/oauthgrants/types/ListOauthGrantsResponsePageInfo.java b/src/main/java/com/whop/api/resources/users/oauthgrants/types/ListOauthGrantsResponsePageInfo.java new file mode 100644 index 00000000..95022837 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/oauthgrants/types/ListOauthGrantsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.oauthgrants.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListOauthGrantsResponsePageInfo.Builder.class) +public final class ListOauthGrantsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListOauthGrantsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListOauthGrantsResponsePageInfo && equalTo((ListOauthGrantsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListOauthGrantsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListOauthGrantsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListOauthGrantsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListOauthGrantsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListOauthGrantsResponsePageInfo build() { + return new ListOauthGrantsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/passkeys/AsyncPasskeysClient.java b/src/main/java/com/whop/api/resources/users/passkeys/AsyncPasskeysClient.java new file mode 100644 index 00000000..65b44b80 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/passkeys/AsyncPasskeysClient.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.passkeys; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.users.passkeys.requests.ChallengePasskeysRequest; +import com.whop.api.resources.users.passkeys.requests.CreatePasskeysRequest; +import com.whop.api.resources.users.passkeys.requests.DeletePasskeysRequest; +import com.whop.api.resources.users.passkeys.requests.ListPasskeysRequest; +import com.whop.api.resources.users.passkeys.types.ChallengePasskeysResponse; +import com.whop.api.resources.users.passkeys.types.DeletePasskeysResponse; +import com.whop.api.types.Passkey; +import java.util.concurrent.CompletableFuture; + +public class AsyncPasskeysClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPasskeysClient rawClient; + + public AsyncPasskeysClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPasskeysClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPasskeysClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public CompletableFuture> list(ListPasskeysRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public CompletableFuture> list( + ListPasskeysRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Registers a passkey for the authenticated user from the attestation a browser produced for a registration challenge. Mint that challenge first with POST /users/me/passkeys/challenge; it is single-use and expires 5 minutes after it is issued. Requires a user session. + */ + public CompletableFuture create(CreatePasskeysRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Registers a passkey for the authenticated user from the attestation a browser produced for a registration challenge. Mint that challenge first with POST /users/me/passkeys/challenge; it is single-use and expires 5 minutes after it is issued. Requires a user session. + */ + public CompletableFuture create(CreatePasskeysRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Mints the challenge a browser needs to run a WebAuthn ceremony against the authenticated user's own passkeys. A registration challenge enrolls a new passkey; a deletion challenge is bound to the one passkey named by passkey_id and proves the user still holds it. Challenges are single-use and expire 5 minutes after they are issued, so send a fresh Idempotency-Key per ceremony — a replayed key returns the original challenge, which may already have expired. Requires a user session. + */ + public CompletableFuture challenge(ChallengePasskeysRequest request) { + return this.rawClient.challenge(request).thenApply(response -> response.body()); + } + + /** + * Mints the challenge a browser needs to run a WebAuthn ceremony against the authenticated user's own passkeys. A registration challenge enrolls a new passkey; a deletion challenge is bound to the one passkey named by passkey_id and proves the user still holds it. Challenges are single-use and expire 5 minutes after they are issued, so send a fresh Idempotency-Key per ceremony — a replayed key returns the original challenge, which may already have expired. Requires a user session. + */ + public CompletableFuture challenge( + ChallengePasskeysRequest request, RequestOptions requestOptions) { + return this.rawClient.challenge(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes one of the authenticated user's own passkeys. The request body carries a WebAuthn assertion from the passkey being deleted, so possession of the credential is proven before it is removed: mint a deletion challenge for it first, run the ceremony with that passkey, and send the result here. Deleting the user's last passkey is allowed — their other step-up factors remain. Requires a user session. + */ + public CompletableFuture delete(String id, DeletePasskeysRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Deletes one of the authenticated user's own passkeys. The request body carries a WebAuthn assertion from the passkey being deleted, so possession of the credential is proven before it is removed: mint a deletion challenge for it first, run the ceremony with that passkey, and send the result here. Deleting the user's last passkey is allowed — their other step-up factors remain. Requires a user session. + */ + public CompletableFuture delete( + String id, DeletePasskeysRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/users/passkeys/AsyncRawPasskeysClient.java b/src/main/java/com/whop/api/resources/users/passkeys/AsyncRawPasskeysClient.java new file mode 100644 index 00000000..af84ce58 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/passkeys/AsyncRawPasskeysClient.java @@ -0,0 +1,474 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.passkeys; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.users.passkeys.requests.ChallengePasskeysRequest; +import com.whop.api.resources.users.passkeys.requests.CreatePasskeysRequest; +import com.whop.api.resources.users.passkeys.requests.DeletePasskeysRequest; +import com.whop.api.resources.users.passkeys.requests.ListPasskeysRequest; +import com.whop.api.resources.users.passkeys.types.ChallengePasskeysResponse; +import com.whop.api.resources.users.passkeys.types.DeletePasskeysResponse; +import com.whop.api.resources.users.passkeys.types.ListPasskeysResponse; +import com.whop.api.types.Passkey; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPasskeysClient { + protected final ClientOptions clientOptions; + + public AsyncRawPasskeysClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public CompletableFuture>> list() { + return list(ListPasskeysRequest.builder().build()); + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(ListPasskeysRequest.builder().build(), requestOptions); + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public CompletableFuture>> list(ListPasskeysRequest request) { + return list(request, null); + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public CompletableFuture>> list( + ListPasskeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/passkeys"); + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPasskeysResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPasskeysResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListPasskeysRequest nextRequest = ListPasskeysRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable(startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Registers a passkey for the authenticated user from the attestation a browser produced for a registration challenge. Mint that challenge first with POST /users/me/passkeys/challenge; it is single-use and expires 5 minutes after it is issued. Requires a user session. + */ + public CompletableFuture> create(CreatePasskeysRequest request) { + return create(request, null); + } + + /** + * Registers a passkey for the authenticated user from the attestation a browser produced for a registration challenge. Mint that challenge first with POST /users/me/passkeys/challenge; it is single-use and expires 5 minutes after it is issued. Requires a user session. + */ + public CompletableFuture> create( + CreatePasskeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/passkeys"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Passkey.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Mints the challenge a browser needs to run a WebAuthn ceremony against the authenticated user's own passkeys. A registration challenge enrolls a new passkey; a deletion challenge is bound to the one passkey named by passkey_id and proves the user still holds it. Challenges are single-use and expire 5 minutes after they are issued, so send a fresh Idempotency-Key per ceremony — a replayed key returns the original challenge, which may already have expired. Requires a user session. + */ + public CompletableFuture> challenge( + ChallengePasskeysRequest request) { + return challenge(request, null); + } + + /** + * Mints the challenge a browser needs to run a WebAuthn ceremony against the authenticated user's own passkeys. A registration challenge enrolls a new passkey; a deletion challenge is bound to the one passkey named by passkey_id and proves the user still holds it. Challenges are single-use and expire 5 minutes after they are issued, so send a fresh Idempotency-Key per ceremony — a replayed key returns the original challenge, which may already have expired. Requires a user session. + */ + public CompletableFuture> challenge( + ChallengePasskeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/passkeys/challenge"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ChallengePasskeysResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes one of the authenticated user's own passkeys. The request body carries a WebAuthn assertion from the passkey being deleted, so possession of the credential is proven before it is removed: mint a deletion challenge for it first, run the ceremony with that passkey, and send the result here. Deleting the user's last passkey is allowed — their other step-up factors remain. Requires a user session. + */ + public CompletableFuture> delete( + String id, DeletePasskeysRequest request) { + return delete(id, request, null); + } + + /** + * Deletes one of the authenticated user's own passkeys. The request body carries a WebAuthn assertion from the passkey being deleted, so possession of the credential is proven before it is removed: mint a deletion challenge for it first, run the ceremony with that passkey, and send the result here. Deleting the user's last passkey is allowed — their other step-up factors remain. Requires a user session. + */ + public CompletableFuture> delete( + String id, DeletePasskeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/passkeys") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeletePasskeysResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/users/passkeys/PasskeysClient.java b/src/main/java/com/whop/api/resources/users/passkeys/PasskeysClient.java new file mode 100644 index 00000000..6fe3e1f3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/passkeys/PasskeysClient.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.passkeys; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.users.passkeys.requests.ChallengePasskeysRequest; +import com.whop.api.resources.users.passkeys.requests.CreatePasskeysRequest; +import com.whop.api.resources.users.passkeys.requests.DeletePasskeysRequest; +import com.whop.api.resources.users.passkeys.requests.ListPasskeysRequest; +import com.whop.api.resources.users.passkeys.types.ChallengePasskeysResponse; +import com.whop.api.resources.users.passkeys.types.DeletePasskeysResponse; +import com.whop.api.types.Passkey; + +public class PasskeysClient { + protected final ClientOptions clientOptions; + + private final RawPasskeysClient rawClient; + + public PasskeysClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPasskeysClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPasskeysClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public SyncPagingIterable list(ListPasskeysRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public SyncPagingIterable list(ListPasskeysRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Registers a passkey for the authenticated user from the attestation a browser produced for a registration challenge. Mint that challenge first with POST /users/me/passkeys/challenge; it is single-use and expires 5 minutes after it is issued. Requires a user session. + */ + public Passkey create(CreatePasskeysRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Registers a passkey for the authenticated user from the attestation a browser produced for a registration challenge. Mint that challenge first with POST /users/me/passkeys/challenge; it is single-use and expires 5 minutes after it is issued. Requires a user session. + */ + public Passkey create(CreatePasskeysRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Mints the challenge a browser needs to run a WebAuthn ceremony against the authenticated user's own passkeys. A registration challenge enrolls a new passkey; a deletion challenge is bound to the one passkey named by passkey_id and proves the user still holds it. Challenges are single-use and expire 5 minutes after they are issued, so send a fresh Idempotency-Key per ceremony — a replayed key returns the original challenge, which may already have expired. Requires a user session. + */ + public ChallengePasskeysResponse challenge(ChallengePasskeysRequest request) { + return this.rawClient.challenge(request).body(); + } + + /** + * Mints the challenge a browser needs to run a WebAuthn ceremony against the authenticated user's own passkeys. A registration challenge enrolls a new passkey; a deletion challenge is bound to the one passkey named by passkey_id and proves the user still holds it. Challenges are single-use and expire 5 minutes after they are issued, so send a fresh Idempotency-Key per ceremony — a replayed key returns the original challenge, which may already have expired. Requires a user session. + */ + public ChallengePasskeysResponse challenge(ChallengePasskeysRequest request, RequestOptions requestOptions) { + return this.rawClient.challenge(request, requestOptions).body(); + } + + /** + * Deletes one of the authenticated user's own passkeys. The request body carries a WebAuthn assertion from the passkey being deleted, so possession of the credential is proven before it is removed: mint a deletion challenge for it first, run the ceremony with that passkey, and send the result here. Deleting the user's last passkey is allowed — their other step-up factors remain. Requires a user session. + */ + public DeletePasskeysResponse delete(String id, DeletePasskeysRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Deletes one of the authenticated user's own passkeys. The request body carries a WebAuthn assertion from the passkey being deleted, so possession of the credential is proven before it is removed: mint a deletion challenge for it first, run the ceremony with that passkey, and send the result here. Deleting the user's last passkey is allowed — their other step-up factors remain. Requires a user session. + */ + public DeletePasskeysResponse delete(String id, DeletePasskeysRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/users/passkeys/RawPasskeysClient.java b/src/main/java/com/whop/api/resources/users/passkeys/RawPasskeysClient.java new file mode 100644 index 00000000..f73143d0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/passkeys/RawPasskeysClient.java @@ -0,0 +1,376 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.passkeys; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.users.passkeys.requests.ChallengePasskeysRequest; +import com.whop.api.resources.users.passkeys.requests.CreatePasskeysRequest; +import com.whop.api.resources.users.passkeys.requests.DeletePasskeysRequest; +import com.whop.api.resources.users.passkeys.requests.ListPasskeysRequest; +import com.whop.api.resources.users.passkeys.types.ChallengePasskeysResponse; +import com.whop.api.resources.users.passkeys.types.DeletePasskeysResponse; +import com.whop.api.resources.users.passkeys.types.ListPasskeysResponse; +import com.whop.api.types.Passkey; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPasskeysClient { + protected final ClientOptions clientOptions; + + public RawPasskeysClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public WhopApiHttpResponse> list() { + return list(ListPasskeysRequest.builder().build()); + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListPasskeysRequest.builder().build(), requestOptions); + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public WhopApiHttpResponse> list(ListPasskeysRequest request) { + return list(request, null); + } + + /** + * Lists the authenticated user's own passkeys, newest first. The list is always the caller's own; there is no parameter for reading another user's passkeys. Requires a user session: an API key or an OAuth token is refused, because a passkey confirms the account holder before a sensitive action and no app may enumerate one. + */ + public WhopApiHttpResponse> list( + ListPasskeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/passkeys"); + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListPasskeysResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPasskeysResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListPasskeysRequest nextRequest = ListPasskeysRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Registers a passkey for the authenticated user from the attestation a browser produced for a registration challenge. Mint that challenge first with POST /users/me/passkeys/challenge; it is single-use and expires 5 minutes after it is issued. Requires a user session. + */ + public WhopApiHttpResponse create(CreatePasskeysRequest request) { + return create(request, null); + } + + /** + * Registers a passkey for the authenticated user from the attestation a browser produced for a registration challenge. Mint that challenge first with POST /users/me/passkeys/challenge; it is single-use and expires 5 minutes after it is issued. Requires a user session. + */ + public WhopApiHttpResponse create(CreatePasskeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/passkeys"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Passkey.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Mints the challenge a browser needs to run a WebAuthn ceremony against the authenticated user's own passkeys. A registration challenge enrolls a new passkey; a deletion challenge is bound to the one passkey named by passkey_id and proves the user still holds it. Challenges are single-use and expire 5 minutes after they are issued, so send a fresh Idempotency-Key per ceremony — a replayed key returns the original challenge, which may already have expired. Requires a user session. + */ + public WhopApiHttpResponse challenge(ChallengePasskeysRequest request) { + return challenge(request, null); + } + + /** + * Mints the challenge a browser needs to run a WebAuthn ceremony against the authenticated user's own passkeys. A registration challenge enrolls a new passkey; a deletion challenge is bound to the one passkey named by passkey_id and proves the user still holds it. Challenges are single-use and expire 5 minutes after they are issued, so send a fresh Idempotency-Key per ceremony — a replayed key returns the original challenge, which may already have expired. Requires a user session. + */ + public WhopApiHttpResponse challenge( + ChallengePasskeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/passkeys/challenge"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ChallengePasskeysResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Deletes one of the authenticated user's own passkeys. The request body carries a WebAuthn assertion from the passkey being deleted, so possession of the credential is proven before it is removed: mint a deletion challenge for it first, run the ceremony with that passkey, and send the result here. Deleting the user's last passkey is allowed — their other step-up factors remain. Requires a user session. + */ + public WhopApiHttpResponse delete(String id, DeletePasskeysRequest request) { + return delete(id, request, null); + } + + /** + * Deletes one of the authenticated user's own passkeys. The request body carries a WebAuthn assertion from the passkey being deleted, so possession of the credential is proven before it is removed: mint a deletion challenge for it first, run the ceremony with that passkey, and send the result here. Deleting the user's last passkey is allowed — their other step-up factors remain. Requires a user session. + */ + public WhopApiHttpResponse delete( + String id, DeletePasskeysRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/passkeys") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeletePasskeysResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/passkeys/requests/ChallengePasskeysRequest.java b/src/main/java/com/whop/api/resources/users/passkeys/requests/ChallengePasskeysRequest.java new file mode 100644 index 00000000..40bc14e1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/passkeys/requests/ChallengePasskeysRequest.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.passkeys.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.users.passkeys.types.ChallengePasskeysRequestChallengeType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ChallengePasskeysRequest.Builder.class) +public final class ChallengePasskeysRequest { + private final ChallengePasskeysRequestChallengeType challengeType; + + private final Optional passkeyId; + + private final Map additionalProperties; + + private ChallengePasskeysRequest( + ChallengePasskeysRequestChallengeType challengeType, + Optional passkeyId, + Map additionalProperties) { + this.challengeType = challengeType; + this.passkeyId = passkeyId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ceremony this challenge is for. + */ + @JsonProperty("challenge_type") + public ChallengePasskeysRequestChallengeType getChallengeType() { + return challengeType; + } + + /** + * @return The passkey the ceremony targets, prefixed wcred_. Required when challenge_type is deletion, ignored otherwise. + */ + @JsonProperty("passkey_id") + public Optional getPasskeyId() { + return passkeyId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ChallengePasskeysRequest && equalTo((ChallengePasskeysRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ChallengePasskeysRequest other) { + return challengeType.equals(other.challengeType) && passkeyId.equals(other.passkeyId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.challengeType, this.passkeyId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChallengeTypeStage builder() { + return new Builder(); + } + + public interface ChallengeTypeStage { + /** + *

The ceremony this challenge is for.

+ */ + _FinalStage challengeType(@NotNull ChallengePasskeysRequestChallengeType challengeType); + + Builder from(ChallengePasskeysRequest other); + } + + public interface _FinalStage { + ChallengePasskeysRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The passkey the ceremony targets, prefixed wcred_. Required when challenge_type is deletion, ignored otherwise.

+ */ + _FinalStage passkeyId(Optional passkeyId); + + _FinalStage passkeyId(String passkeyId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ChallengeTypeStage, _FinalStage { + private ChallengePasskeysRequestChallengeType challengeType; + + private Optional passkeyId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ChallengePasskeysRequest other) { + challengeType(other.getChallengeType()); + passkeyId(other.getPasskeyId()); + return this; + } + + /** + *

The ceremony this challenge is for.

+ *

The ceremony this challenge is for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("challenge_type") + public _FinalStage challengeType(@NotNull ChallengePasskeysRequestChallengeType challengeType) { + this.challengeType = Objects.requireNonNull(challengeType, "challengeType must not be null"); + return this; + } + + /** + *

The passkey the ceremony targets, prefixed wcred_. Required when challenge_type is deletion, ignored otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage passkeyId(String passkeyId) { + this.passkeyId = Optional.ofNullable(passkeyId); + return this; + } + + /** + *

The passkey the ceremony targets, prefixed wcred_. Required when challenge_type is deletion, ignored otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "passkey_id", nulls = Nulls.SKIP) + public _FinalStage passkeyId(Optional passkeyId) { + this.passkeyId = passkeyId; + return this; + } + + @java.lang.Override + public ChallengePasskeysRequest build() { + return new ChallengePasskeysRequest(challengeType, passkeyId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/passkeys/requests/CreatePasskeysRequest.java b/src/main/java/com/whop/api/resources/users/passkeys/requests/CreatePasskeysRequest.java new file mode 100644 index 00000000..06915b8b --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/passkeys/requests/CreatePasskeysRequest.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.passkeys.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePasskeysRequest.Builder.class) +public final class CreatePasskeysRequest { + private final String attestationObject; + + private final String clientDataJson; + + private final String credentialId; + + private final String nickname; + + private final Map additionalProperties; + + private CreatePasskeysRequest( + String attestationObject, + String clientDataJson, + String credentialId, + String nickname, + Map additionalProperties) { + this.attestationObject = attestationObject; + this.clientDataJson = clientDataJson; + this.credentialId = credentialId; + this.nickname = nickname; + this.additionalProperties = additionalProperties; + } + + /** + * @return The attestationObject from the WebAuthn attestation response, base64url-encoded. + */ + @JsonProperty("attestation_object") + public String getAttestationObject() { + return attestationObject; + } + + /** + * @return The clientDataJSON from the WebAuthn attestation response, base64url-encoded. + */ + @JsonProperty("client_data_json") + public String getClientDataJson() { + return clientDataJson; + } + + /** + * @return The WebAuthn credential ID the authenticator returned, base64url-encoded. + */ + @JsonProperty("credential_id") + public String getCredentialId() { + return credentialId; + } + + /** + * @return A name for this passkey, usually the device it lives on. 255 characters or fewer. + */ + @JsonProperty("nickname") + public String getNickname() { + return nickname; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePasskeysRequest && equalTo((CreatePasskeysRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePasskeysRequest other) { + return attestationObject.equals(other.attestationObject) + && clientDataJson.equals(other.clientDataJson) + && credentialId.equals(other.credentialId) + && nickname.equals(other.nickname); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.attestationObject, this.clientDataJson, this.credentialId, this.nickname); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AttestationObjectStage builder() { + return new Builder(); + } + + public interface AttestationObjectStage { + /** + *

The attestationObject from the WebAuthn attestation response, base64url-encoded.

+ */ + ClientDataJsonStage attestationObject(@NotNull String attestationObject); + + Builder from(CreatePasskeysRequest other); + } + + public interface ClientDataJsonStage { + /** + *

The clientDataJSON from the WebAuthn attestation response, base64url-encoded.

+ */ + CredentialIdStage clientDataJson(@NotNull String clientDataJson); + } + + public interface CredentialIdStage { + /** + *

The WebAuthn credential ID the authenticator returned, base64url-encoded.

+ */ + NicknameStage credentialId(@NotNull String credentialId); + } + + public interface NicknameStage { + /** + *

A name for this passkey, usually the device it lives on. 255 characters or fewer.

+ */ + _FinalStage nickname(@NotNull String nickname); + } + + public interface _FinalStage { + CreatePasskeysRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AttestationObjectStage, ClientDataJsonStage, CredentialIdStage, NicknameStage, _FinalStage { + private String attestationObject; + + private String clientDataJson; + + private String credentialId; + + private String nickname; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePasskeysRequest other) { + attestationObject(other.getAttestationObject()); + clientDataJson(other.getClientDataJson()); + credentialId(other.getCredentialId()); + nickname(other.getNickname()); + return this; + } + + /** + *

The attestationObject from the WebAuthn attestation response, base64url-encoded.

+ *

The attestationObject from the WebAuthn attestation response, base64url-encoded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("attestation_object") + public ClientDataJsonStage attestationObject(@NotNull String attestationObject) { + this.attestationObject = Objects.requireNonNull(attestationObject, "attestationObject must not be null"); + return this; + } + + /** + *

The clientDataJSON from the WebAuthn attestation response, base64url-encoded.

+ *

The clientDataJSON from the WebAuthn attestation response, base64url-encoded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("client_data_json") + public CredentialIdStage clientDataJson(@NotNull String clientDataJson) { + this.clientDataJson = Objects.requireNonNull(clientDataJson, "clientDataJson must not be null"); + return this; + } + + /** + *

The WebAuthn credential ID the authenticator returned, base64url-encoded.

+ *

The WebAuthn credential ID the authenticator returned, base64url-encoded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("credential_id") + public NicknameStage credentialId(@NotNull String credentialId) { + this.credentialId = Objects.requireNonNull(credentialId, "credentialId must not be null"); + return this; + } + + /** + *

A name for this passkey, usually the device it lives on. 255 characters or fewer.

+ *

A name for this passkey, usually the device it lives on. 255 characters or fewer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("nickname") + public _FinalStage nickname(@NotNull String nickname) { + this.nickname = Objects.requireNonNull(nickname, "nickname must not be null"); + return this; + } + + @java.lang.Override + public CreatePasskeysRequest build() { + return new CreatePasskeysRequest( + attestationObject, clientDataJson, credentialId, nickname, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/passkeys/requests/DeletePasskeysRequest.java b/src/main/java/com/whop/api/resources/users/passkeys/requests/DeletePasskeysRequest.java new file mode 100644 index 00000000..1c3c920e --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/passkeys/requests/DeletePasskeysRequest.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.passkeys.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeletePasskeysRequest.Builder.class) +public final class DeletePasskeysRequest { + private final String authenticatorData; + + private final String clientDataJson; + + private final String signature; + + private final Map additionalProperties; + + private DeletePasskeysRequest( + String authenticatorData, + String clientDataJson, + String signature, + Map additionalProperties) { + this.authenticatorData = authenticatorData; + this.clientDataJson = clientDataJson; + this.signature = signature; + this.additionalProperties = additionalProperties; + } + + /** + * @return The authenticatorData from the WebAuthn assertion, base64url-encoded. + */ + @JsonProperty("authenticator_data") + public String getAuthenticatorData() { + return authenticatorData; + } + + /** + * @return The clientDataJSON from the WebAuthn assertion, base64url-encoded. + */ + @JsonProperty("client_data_json") + public String getClientDataJson() { + return clientDataJson; + } + + /** + * @return The signature from the WebAuthn assertion, base64url-encoded. + */ + @JsonProperty("signature") + public String getSignature() { + return signature; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeletePasskeysRequest && equalTo((DeletePasskeysRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeletePasskeysRequest other) { + return authenticatorData.equals(other.authenticatorData) + && clientDataJson.equals(other.clientDataJson) + && signature.equals(other.signature); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.authenticatorData, this.clientDataJson, this.signature); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AuthenticatorDataStage builder() { + return new Builder(); + } + + public interface AuthenticatorDataStage { + /** + *

The authenticatorData from the WebAuthn assertion, base64url-encoded.

+ */ + ClientDataJsonStage authenticatorData(@NotNull String authenticatorData); + + Builder from(DeletePasskeysRequest other); + } + + public interface ClientDataJsonStage { + /** + *

The clientDataJSON from the WebAuthn assertion, base64url-encoded.

+ */ + SignatureStage clientDataJson(@NotNull String clientDataJson); + } + + public interface SignatureStage { + /** + *

The signature from the WebAuthn assertion, base64url-encoded.

+ */ + _FinalStage signature(@NotNull String signature); + } + + public interface _FinalStage { + DeletePasskeysRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AuthenticatorDataStage, ClientDataJsonStage, SignatureStage, _FinalStage { + private String authenticatorData; + + private String clientDataJson; + + private String signature; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeletePasskeysRequest other) { + authenticatorData(other.getAuthenticatorData()); + clientDataJson(other.getClientDataJson()); + signature(other.getSignature()); + return this; + } + + /** + *

The authenticatorData from the WebAuthn assertion, base64url-encoded.

+ *

The authenticatorData from the WebAuthn assertion, base64url-encoded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("authenticator_data") + public ClientDataJsonStage authenticatorData(@NotNull String authenticatorData) { + this.authenticatorData = Objects.requireNonNull(authenticatorData, "authenticatorData must not be null"); + return this; + } + + /** + *

The clientDataJSON from the WebAuthn assertion, base64url-encoded.

+ *

The clientDataJSON from the WebAuthn assertion, base64url-encoded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("client_data_json") + public SignatureStage clientDataJson(@NotNull String clientDataJson) { + this.clientDataJson = Objects.requireNonNull(clientDataJson, "clientDataJson must not be null"); + return this; + } + + /** + *

The signature from the WebAuthn assertion, base64url-encoded.

+ *

The signature from the WebAuthn assertion, base64url-encoded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("signature") + public _FinalStage signature(@NotNull String signature) { + this.signature = Objects.requireNonNull(signature, "signature must not be null"); + return this; + } + + @java.lang.Override + public DeletePasskeysRequest build() { + return new DeletePasskeysRequest(authenticatorData, clientDataJson, signature, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/passkeys/requests/ListPasskeysRequest.java b/src/main/java/com/whop/api/resources/users/passkeys/requests/ListPasskeysRequest.java new file mode 100644 index 00000000..3ea321e2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/passkeys/requests/ListPasskeysRequest.java @@ -0,0 +1,265 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.passkeys.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.users.passkeys.types.ListPasskeysRequestDirection; +import com.whop.api.resources.users.passkeys.types.ListPasskeysRequestOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPasskeysRequest.Builder.class) +public final class ListPasskeysRequest { + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Optional order; + + private final Optional direction; + + private final Map additionalProperties; + + private ListPasskeysRequest( + Optional first, + Optional after, + Optional last, + Optional before, + Optional order, + Optional direction, + Map additionalProperties) { + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.order = order; + this.direction = direction; + this.additionalProperties = additionalProperties; + } + + /** + * @return The number of passkeys to return (default 20, max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns passkeys after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of passkeys to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns passkeys before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The field to sort passkeys by. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPasskeysRequest && equalTo((ListPasskeysRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPasskeysRequest other) { + return first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before) + && order.equals(other.order) + && direction.equals(other.direction); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.first, this.after, this.last, this.before, this.order, this.direction); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional order = Optional.empty(); + + private Optional direction = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListPasskeysRequest other) { + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + order(other.getOrder()); + direction(other.getDirection()); + return this; + } + + /** + *

The number of passkeys to return (default 20, max 100).

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor; returns passkeys after this position.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The number of passkeys to return from the end of the range.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

A cursor; returns passkeys before this position.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

The field to sort passkeys by.

+ */ + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(ListPasskeysRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Sort direction.

+ */ + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public Builder direction(Optional direction) { + this.direction = direction; + return this; + } + + public Builder direction(ListPasskeysRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + public ListPasskeysRequest build() { + return new ListPasskeysRequest(first, after, last, before, order, direction, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/passkeys/types/ChallengePasskeysRequestChallengeType.java b/src/main/java/com/whop/api/resources/users/passkeys/types/ChallengePasskeysRequestChallengeType.java new file mode 100644 index 00000000..1d5273be --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/passkeys/types/ChallengePasskeysRequestChallengeType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.passkeys.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ChallengePasskeysRequestChallengeType { + public static final ChallengePasskeysRequestChallengeType DELETION = + new ChallengePasskeysRequestChallengeType(Value.DELETION, "deletion"); + + public static final ChallengePasskeysRequestChallengeType REGISTRATION = + new ChallengePasskeysRequestChallengeType(Value.REGISTRATION, "registration"); + + private final Value value; + + private final String string; + + ChallengePasskeysRequestChallengeType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ChallengePasskeysRequestChallengeType + && this.string.equals(((ChallengePasskeysRequestChallengeType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DELETION: + return visitor.visitDeletion(); + case REGISTRATION: + return visitor.visitRegistration(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ChallengePasskeysRequestChallengeType valueOf(String value) { + switch (value) { + case "deletion": + return DELETION; + case "registration": + return REGISTRATION; + default: + return new ChallengePasskeysRequestChallengeType(Value.UNKNOWN, value); + } + } + + public enum Value { + REGISTRATION, + + DELETION, + + UNKNOWN + } + + public interface Visitor { + T visitRegistration(); + + T visitDeletion(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/users/passkeys/types/ChallengePasskeysResponse.java b/src/main/java/com/whop/api/resources/users/passkeys/types/ChallengePasskeysResponse.java new file mode 100644 index 00000000..d0bb416d --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/passkeys/types/ChallengePasskeysResponse.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.passkeys.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ChallengePasskeysResponse.Builder.class) +public final class ChallengePasskeysResponse { + private final String challenge; + + private final Map additionalProperties; + + private ChallengePasskeysResponse(String challenge, Map additionalProperties) { + this.challenge = challenge; + this.additionalProperties = additionalProperties; + } + + /** + * @return The challenge to pass to the WebAuthn ceremony, base64url-encoded without padding. + */ + @JsonProperty("challenge") + public String getChallenge() { + return challenge; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ChallengePasskeysResponse && equalTo((ChallengePasskeysResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ChallengePasskeysResponse other) { + return challenge.equals(other.challenge); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.challenge); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChallengeStage builder() { + return new Builder(); + } + + public interface ChallengeStage { + /** + *

The challenge to pass to the WebAuthn ceremony, base64url-encoded without padding.

+ */ + _FinalStage challenge(@NotNull String challenge); + + Builder from(ChallengePasskeysResponse other); + } + + public interface _FinalStage { + ChallengePasskeysResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ChallengeStage, _FinalStage { + private String challenge; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ChallengePasskeysResponse other) { + challenge(other.getChallenge()); + return this; + } + + /** + *

The challenge to pass to the WebAuthn ceremony, base64url-encoded without padding.

+ *

The challenge to pass to the WebAuthn ceremony, base64url-encoded without padding.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("challenge") + public _FinalStage challenge(@NotNull String challenge) { + this.challenge = Objects.requireNonNull(challenge, "challenge must not be null"); + return this; + } + + @java.lang.Override + public ChallengePasskeysResponse build() { + return new ChallengePasskeysResponse(challenge, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/passkeys/types/DeletePasskeysResponse.java b/src/main/java/com/whop/api/resources/users/passkeys/types/DeletePasskeysResponse.java new file mode 100644 index 00000000..8d8ef6aa --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/passkeys/types/DeletePasskeysResponse.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.passkeys.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeletePasskeysResponse.Builder.class) +public final class DeletePasskeysResponse { + private final boolean deleted; + + private final String id; + + private final Map additionalProperties; + + private DeletePasskeysResponse(boolean deleted, String id, Map additionalProperties) { + this.deleted = deleted; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Always true: the passkey was removed. + */ + @JsonProperty("deleted") + public boolean getDeleted() { + return deleted; + } + + /** + * @return The ID of the deleted passkey. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeletePasskeysResponse && equalTo((DeletePasskeysResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeletePasskeysResponse other) { + return deleted == other.deleted && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deleted, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeletedStage builder() { + return new Builder(); + } + + public interface DeletedStage { + /** + *

Always true: the passkey was removed.

+ */ + IdStage deleted(boolean deleted); + + Builder from(DeletePasskeysResponse other); + } + + public interface IdStage { + /** + *

The ID of the deleted passkey.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DeletePasskeysResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeletedStage, IdStage, _FinalStage { + private boolean deleted; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeletePasskeysResponse other) { + deleted(other.getDeleted()); + id(other.getId()); + return this; + } + + /** + *

Always true: the passkey was removed.

+ *

Always true: the passkey was removed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("deleted") + public IdStage deleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + *

The ID of the deleted passkey.

+ *

The ID of the deleted passkey.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DeletePasskeysResponse build() { + return new DeletePasskeysResponse(deleted, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/passkeys/types/ListPasskeysRequestDirection.java b/src/main/java/com/whop/api/resources/users/passkeys/types/ListPasskeysRequestDirection.java new file mode 100644 index 00000000..9712d462 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/passkeys/types/ListPasskeysRequestDirection.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.passkeys.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPasskeysRequestDirection { + public static final ListPasskeysRequestDirection ASC = new ListPasskeysRequestDirection(Value.ASC, "asc"); + + public static final ListPasskeysRequestDirection DESC = new ListPasskeysRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListPasskeysRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPasskeysRequestDirection + && this.string.equals(((ListPasskeysRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPasskeysRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListPasskeysRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/users/passkeys/types/ListPasskeysRequestOrder.java b/src/main/java/com/whop/api/resources/users/passkeys/types/ListPasskeysRequestOrder.java new file mode 100644 index 00000000..d79dda43 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/passkeys/types/ListPasskeysRequestOrder.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.passkeys.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListPasskeysRequestOrder { + public static final ListPasskeysRequestOrder CREATED_AT = + new ListPasskeysRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListPasskeysRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListPasskeysRequestOrder + && this.string.equals(((ListPasskeysRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListPasskeysRequestOrder valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + default: + return new ListPasskeysRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/users/passkeys/types/ListPasskeysResponse.java b/src/main/java/com/whop/api/resources/users/passkeys/types/ListPasskeysResponse.java new file mode 100644 index 00000000..36ff51fd --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/passkeys/types/ListPasskeysResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.passkeys.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Passkey; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPasskeysResponse.Builder.class) +public final class ListPasskeysResponse { + private final List data; + + private final ListPasskeysResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListPasskeysResponse( + List data, ListPasskeysResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListPasskeysResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPasskeysResponse && equalTo((ListPasskeysResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPasskeysResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListPasskeysResponsePageInfo pageInfo); + + Builder from(ListPasskeysResponse other); + } + + public interface _FinalStage { + ListPasskeysResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(Passkey data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListPasskeysResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPasskeysResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListPasskeysResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(Passkey data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListPasskeysResponse build() { + return new ListPasskeysResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/passkeys/types/ListPasskeysResponsePageInfo.java b/src/main/java/com/whop/api/resources/users/passkeys/types/ListPasskeysResponsePageInfo.java new file mode 100644 index 00000000..c0e6fdee --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/passkeys/types/ListPasskeysResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.passkeys.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListPasskeysResponsePageInfo.Builder.class) +public final class ListPasskeysResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListPasskeysResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListPasskeysResponsePageInfo && equalTo((ListPasskeysResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListPasskeysResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListPasskeysResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListPasskeysResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListPasskeysResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListPasskeysResponsePageInfo build() { + return new ListPasskeysResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/AsyncPreferencesClient.java b/src/main/java/com/whop/api/resources/users/preferences/AsyncPreferencesClient.java new file mode 100644 index 00000000..52d93ae4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/AsyncPreferencesClient.java @@ -0,0 +1,80 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.resources.users.preferences.notifications.AsyncNotificationsClient; +import com.whop.api.resources.users.preferences.requests.UpdatePreferencesRequest; +import com.whop.api.types.UserPreferences; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class AsyncPreferencesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPreferencesClient rawClient; + + protected final Supplier notificationsClient; + + public AsyncPreferencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPreferencesClient(clientOptions); + this.notificationsClient = Suppliers.memoize(() -> new AsyncNotificationsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPreferencesClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the authenticated user's settings document. Addressed only as me — the document always belongs to the session user. + */ + public CompletableFuture retrieve() { + return this.rawClient.retrieve().thenApply(response -> response.body()); + } + + /** + * Retrieves the authenticated user's settings document. Addressed only as me — the document always belongs to the session user. + */ + public CompletableFuture retrieve(RequestOptions requestOptions) { + return this.rawClient.retrieve(requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public CompletableFuture update() { + return this.rawClient.update().thenApply(response -> response.body()); + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public CompletableFuture update(RequestOptions requestOptions) { + return this.rawClient.update(requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public CompletableFuture update(UpdatePreferencesRequest request) { + return this.rawClient.update(request).thenApply(response -> response.body()); + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public CompletableFuture update(UpdatePreferencesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(request, requestOptions).thenApply(response -> response.body()); + } + + public AsyncNotificationsClient notifications() { + return this.notificationsClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/AsyncRawPreferencesClient.java b/src/main/java/com/whop/api/resources/users/preferences/AsyncRawPreferencesClient.java new file mode 100644 index 00000000..88d243e1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/AsyncRawPreferencesClient.java @@ -0,0 +1,201 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.users.preferences.requests.UpdatePreferencesRequest; +import com.whop.api.types.UserPreferences; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPreferencesClient { + protected final ClientOptions clientOptions; + + public AsyncRawPreferencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the authenticated user's settings document. Addressed only as me — the document always belongs to the session user. + */ + public CompletableFuture> retrieve() { + return retrieve(null); + } + + /** + * Retrieves the authenticated user's settings document. Addressed only as me — the document always belongs to the session user. + */ + public CompletableFuture> retrieve(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/preferences"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UserPreferences.class), + response)); + return; + } + try { + if (response.code() == 401) { + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public CompletableFuture> update() { + return update(UpdatePreferencesRequest.builder().build()); + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public CompletableFuture> update(RequestOptions requestOptions) { + return update(UpdatePreferencesRequest.builder().build(), requestOptions); + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public CompletableFuture> update(UpdatePreferencesRequest request) { + return update(request, null); + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public CompletableFuture> update( + UpdatePreferencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/preferences"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UserPreferences.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/PreferencesClient.java b/src/main/java/com/whop/api/resources/users/preferences/PreferencesClient.java new file mode 100644 index 00000000..bab70910 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/PreferencesClient.java @@ -0,0 +1,79 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.resources.users.preferences.notifications.NotificationsClient; +import com.whop.api.resources.users.preferences.requests.UpdatePreferencesRequest; +import com.whop.api.types.UserPreferences; +import java.util.function.Supplier; + +public class PreferencesClient { + protected final ClientOptions clientOptions; + + private final RawPreferencesClient rawClient; + + protected final Supplier notificationsClient; + + public PreferencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPreferencesClient(clientOptions); + this.notificationsClient = Suppliers.memoize(() -> new NotificationsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPreferencesClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the authenticated user's settings document. Addressed only as me — the document always belongs to the session user. + */ + public UserPreferences retrieve() { + return this.rawClient.retrieve().body(); + } + + /** + * Retrieves the authenticated user's settings document. Addressed only as me — the document always belongs to the session user. + */ + public UserPreferences retrieve(RequestOptions requestOptions) { + return this.rawClient.retrieve(requestOptions).body(); + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public UserPreferences update() { + return this.rawClient.update().body(); + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public UserPreferences update(RequestOptions requestOptions) { + return this.rawClient.update(requestOptions).body(); + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public UserPreferences update(UpdatePreferencesRequest request) { + return this.rawClient.update(request).body(); + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public UserPreferences update(UpdatePreferencesRequest request, RequestOptions requestOptions) { + return this.rawClient.update(request, requestOptions).body(); + } + + public NotificationsClient notifications() { + return this.notificationsClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/RawPreferencesClient.java b/src/main/java/com/whop/api/resources/users/preferences/RawPreferencesClient.java new file mode 100644 index 00000000..7e135b34 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/RawPreferencesClient.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.users.preferences.requests.UpdatePreferencesRequest; +import com.whop.api.types.UserPreferences; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPreferencesClient { + protected final ClientOptions clientOptions; + + public RawPreferencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the authenticated user's settings document. Addressed only as me — the document always belongs to the session user. + */ + public WhopApiHttpResponse retrieve() { + return retrieve(null); + } + + /** + * Retrieves the authenticated user's settings document. Addressed only as me — the document always belongs to the session user. + */ + public WhopApiHttpResponse retrieve(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/preferences"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UserPreferences.class), response); + } + try { + if (response.code() == 401) { + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public WhopApiHttpResponse update() { + return update(UpdatePreferencesRequest.builder().build()); + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public WhopApiHttpResponse update(RequestOptions requestOptions) { + return update(UpdatePreferencesRequest.builder().build(), requestOptions); + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public WhopApiHttpResponse update(UpdatePreferencesRequest request) { + return update(request, null); + } + + /** + * Updates the authenticated user's settings document. Replaces the top-level keys it is given and leaves the rest untouched. + */ + public WhopApiHttpResponse update( + UpdatePreferencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/preferences"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UserPreferences.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/AsyncNotificationsClient.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/AsyncNotificationsClient.java new file mode 100644 index 00000000..710384a6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/AsyncNotificationsClient.java @@ -0,0 +1,67 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.resources.users.preferences.notifications.experiences.AsyncExperiencesClient; +import com.whop.api.resources.users.preferences.notifications.requests.SetNotificationsRequest; +import com.whop.api.resources.users.preferences.notifications.topics.AsyncTopicsClient; +import com.whop.api.resources.users.preferences.notifications.types.SetNotificationsResponse; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class AsyncNotificationsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawNotificationsClient rawClient; + + protected final Supplier experiencesClient; + + protected final Supplier topicsClient; + + public AsyncNotificationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawNotificationsClient(clientOptions); + this.experiencesClient = Suppliers.memoize(() -> new AsyncExperiencesClient(clientOptions)); + this.topicsClient = Suppliers.memoize(() -> new AsyncTopicsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawNotificationsClient withRawResponse() { + return this.rawClient; + } + + /** + * Sets the authenticated user's notification preferences. Each preference is addressed by scope, not by id, so a scope read back from either list endpoint can be sent straight here. + *

A scope naming an experience with no topic sets that experience's level, and accepts all three levels. Any other scope sets a topic override, which is binary — all or nothing — and requires a channel.

+ *

level: null clears the preference. Preferences are stored as overrides, so clearing one means the scope inherits its default again rather than being switched off.

+ *

The batch is applied in one transaction: if any entry is rejected, none are written. Experience levels are applied before topic overrides, because setting a level replaces every topic preference for that experience — so an override sent alongside a level wins. The response reports what each scope now resolves to, in the order the entries were sent.

+ */ + public CompletableFuture set(SetNotificationsRequest request) { + return this.rawClient.set(request).thenApply(response -> response.body()); + } + + /** + * Sets the authenticated user's notification preferences. Each preference is addressed by scope, not by id, so a scope read back from either list endpoint can be sent straight here. + *

A scope naming an experience with no topic sets that experience's level, and accepts all three levels. Any other scope sets a topic override, which is binary — all or nothing — and requires a channel.

+ *

level: null clears the preference. Preferences are stored as overrides, so clearing one means the scope inherits its default again rather than being switched off.

+ *

The batch is applied in one transaction: if any entry is rejected, none are written. Experience levels are applied before topic overrides, because setting a level replaces every topic preference for that experience — so an override sent alongside a level wins. The response reports what each scope now resolves to, in the order the entries were sent.

+ */ + public CompletableFuture set( + SetNotificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.set(request, requestOptions).thenApply(response -> response.body()); + } + + public AsyncExperiencesClient experiences() { + return this.experiencesClient.get(); + } + + public AsyncTopicsClient topics() { + return this.topicsClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/AsyncRawNotificationsClient.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/AsyncRawNotificationsClient.java new file mode 100644 index 00000000..773405b0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/AsyncRawNotificationsClient.java @@ -0,0 +1,126 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.resources.users.preferences.notifications.requests.SetNotificationsRequest; +import com.whop.api.resources.users.preferences.notifications.types.SetNotificationsResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawNotificationsClient { + protected final ClientOptions clientOptions; + + public AsyncRawNotificationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Sets the authenticated user's notification preferences. Each preference is addressed by scope, not by id, so a scope read back from either list endpoint can be sent straight here. + *

A scope naming an experience with no topic sets that experience's level, and accepts all three levels. Any other scope sets a topic override, which is binary — all or nothing — and requires a channel.

+ *

level: null clears the preference. Preferences are stored as overrides, so clearing one means the scope inherits its default again rather than being switched off.

+ *

The batch is applied in one transaction: if any entry is rejected, none are written. Experience levels are applied before topic overrides, because setting a level replaces every topic preference for that experience — so an override sent alongside a level wins. The response reports what each scope now resolves to, in the order the entries were sent.

+ */ + public CompletableFuture> set(SetNotificationsRequest request) { + return set(request, null); + } + + /** + * Sets the authenticated user's notification preferences. Each preference is addressed by scope, not by id, so a scope read back from either list endpoint can be sent straight here. + *

A scope naming an experience with no topic sets that experience's level, and accepts all three levels. Any other scope sets a topic override, which is binary — all or nothing — and requires a channel.

+ *

level: null clears the preference. Preferences are stored as overrides, so clearing one means the scope inherits its default again rather than being switched off.

+ *

The batch is applied in one transaction: if any entry is rejected, none are written. Experience levels are applied before topic overrides, because setting a level replaces every topic preference for that experience — so an override sent alongside a level wins. The response reports what each scope now resolves to, in the order the entries were sent.

+ */ + public CompletableFuture> set( + SetNotificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/preferences/notifications"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SetNotificationsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/NotificationsClient.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/NotificationsClient.java new file mode 100644 index 00000000..76ac94b6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/NotificationsClient.java @@ -0,0 +1,65 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.Suppliers; +import com.whop.api.resources.users.preferences.notifications.experiences.ExperiencesClient; +import com.whop.api.resources.users.preferences.notifications.requests.SetNotificationsRequest; +import com.whop.api.resources.users.preferences.notifications.topics.TopicsClient; +import com.whop.api.resources.users.preferences.notifications.types.SetNotificationsResponse; +import java.util.function.Supplier; + +public class NotificationsClient { + protected final ClientOptions clientOptions; + + private final RawNotificationsClient rawClient; + + protected final Supplier experiencesClient; + + protected final Supplier topicsClient; + + public NotificationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawNotificationsClient(clientOptions); + this.experiencesClient = Suppliers.memoize(() -> new ExperiencesClient(clientOptions)); + this.topicsClient = Suppliers.memoize(() -> new TopicsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawNotificationsClient withRawResponse() { + return this.rawClient; + } + + /** + * Sets the authenticated user's notification preferences. Each preference is addressed by scope, not by id, so a scope read back from either list endpoint can be sent straight here. + *

A scope naming an experience with no topic sets that experience's level, and accepts all three levels. Any other scope sets a topic override, which is binary — all or nothing — and requires a channel.

+ *

level: null clears the preference. Preferences are stored as overrides, so clearing one means the scope inherits its default again rather than being switched off.

+ *

The batch is applied in one transaction: if any entry is rejected, none are written. Experience levels are applied before topic overrides, because setting a level replaces every topic preference for that experience — so an override sent alongside a level wins. The response reports what each scope now resolves to, in the order the entries were sent.

+ */ + public SetNotificationsResponse set(SetNotificationsRequest request) { + return this.rawClient.set(request).body(); + } + + /** + * Sets the authenticated user's notification preferences. Each preference is addressed by scope, not by id, so a scope read back from either list endpoint can be sent straight here. + *

A scope naming an experience with no topic sets that experience's level, and accepts all three levels. Any other scope sets a topic override, which is binary — all or nothing — and requires a channel.

+ *

level: null clears the preference. Preferences are stored as overrides, so clearing one means the scope inherits its default again rather than being switched off.

+ *

The batch is applied in one transaction: if any entry is rejected, none are written. Experience levels are applied before topic overrides, because setting a level replaces every topic preference for that experience — so an override sent alongside a level wins. The response reports what each scope now resolves to, in the order the entries were sent.

+ */ + public SetNotificationsResponse set(SetNotificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.set(request, requestOptions).body(); + } + + public ExperiencesClient experiences() { + return this.experiencesClient.get(); + } + + public TopicsClient topics() { + return this.topicsClient.get(); + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/RawNotificationsClient.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/RawNotificationsClient.java new file mode 100644 index 00000000..90b530e7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/RawNotificationsClient.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.resources.users.preferences.notifications.requests.SetNotificationsRequest; +import com.whop.api.resources.users.preferences.notifications.types.SetNotificationsResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawNotificationsClient { + protected final ClientOptions clientOptions; + + public RawNotificationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Sets the authenticated user's notification preferences. Each preference is addressed by scope, not by id, so a scope read back from either list endpoint can be sent straight here. + *

A scope naming an experience with no topic sets that experience's level, and accepts all three levels. Any other scope sets a topic override, which is binary — all or nothing — and requires a channel.

+ *

level: null clears the preference. Preferences are stored as overrides, so clearing one means the scope inherits its default again rather than being switched off.

+ *

The batch is applied in one transaction: if any entry is rejected, none are written. Experience levels are applied before topic overrides, because setting a level replaces every topic preference for that experience — so an override sent alongside a level wins. The response reports what each scope now resolves to, in the order the entries were sent.

+ */ + public WhopApiHttpResponse set(SetNotificationsRequest request) { + return set(request, null); + } + + /** + * Sets the authenticated user's notification preferences. Each preference is addressed by scope, not by id, so a scope read back from either list endpoint can be sent straight here. + *

A scope naming an experience with no topic sets that experience's level, and accepts all three levels. Any other scope sets a topic override, which is binary — all or nothing — and requires a channel.

+ *

level: null clears the preference. Preferences are stored as overrides, so clearing one means the scope inherits its default again rather than being switched off.

+ *

The batch is applied in one transaction: if any entry is rejected, none are written. Experience levels are applied before topic overrides, because setting a level replaces every topic preference for that experience — so an override sent alongside a level wins. The response reports what each scope now resolves to, in the order the entries were sent.

+ */ + public WhopApiHttpResponse set( + SetNotificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/preferences/notifications"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SetNotificationsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/AsyncExperiencesClient.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/AsyncExperiencesClient.java new file mode 100644 index 00000000..53c3f03d --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/AsyncExperiencesClient.java @@ -0,0 +1,59 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.experiences; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.users.preferences.notifications.experiences.requests.ListExperiencesRequest; +import com.whop.api.types.ExperienceNotificationPreference; +import java.util.concurrent.CompletableFuture; + +public class AsyncExperiencesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawExperiencesClient rawClient; + + public AsyncExperiencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawExperiencesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawExperiencesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public CompletableFuture> list( + ListExperiencesRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public CompletableFuture> list( + ListExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/AsyncRawExperiencesClient.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/AsyncRawExperiencesClient.java new file mode 100644 index 00000000..65353e28 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/AsyncRawExperiencesClient.java @@ -0,0 +1,151 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.experiences; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.users.preferences.notifications.experiences.requests.ListExperiencesRequest; +import com.whop.api.resources.users.preferences.notifications.experiences.types.ListExperiencesResponse; +import com.whop.api.types.ExperienceNotificationPreference; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawExperiencesClient { + protected final ClientOptions clientOptions; + + public AsyncRawExperiencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public CompletableFuture>> list() { + return list(ListExperiencesRequest.builder().build()); + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListExperiencesRequest.builder().build(), requestOptions); + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public CompletableFuture>> list( + ListExperiencesRequest request) { + return list(request, null); + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public CompletableFuture>> list( + ListExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/preferences/notifications/experiences"); + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListExperiencesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListExperiencesResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListExperiencesRequest nextRequest = ListExperiencesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + if (response.code() == 401) { + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/ExperiencesClient.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/ExperiencesClient.java new file mode 100644 index 00000000..3e2c1996 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/ExperiencesClient.java @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.experiences; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.users.preferences.notifications.experiences.requests.ListExperiencesRequest; +import com.whop.api.types.ExperienceNotificationPreference; + +public class ExperiencesClient { + protected final ClientOptions clientOptions; + + private final RawExperiencesClient rawClient; + + public ExperiencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawExperiencesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawExperiencesClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public SyncPagingIterable list(ListExperiencesRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public SyncPagingIterable list( + ListExperiencesRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/RawExperiencesClient.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/RawExperiencesClient.java new file mode 100644 index 00000000..37e11b7a --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/RawExperiencesClient.java @@ -0,0 +1,123 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.experiences; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.users.preferences.notifications.experiences.requests.ListExperiencesRequest; +import com.whop.api.resources.users.preferences.notifications.experiences.types.ListExperiencesResponse; +import com.whop.api.types.ExperienceNotificationPreference; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawExperiencesClient { + protected final ClientOptions clientOptions; + + public RawExperiencesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public WhopApiHttpResponse> list() { + return list(ListExperiencesRequest.builder().build()); + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public WhopApiHttpResponse> list( + RequestOptions requestOptions) { + return list(ListExperiencesRequest.builder().build(), requestOptions); + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public WhopApiHttpResponse> list( + ListExperiencesRequest request) { + return list(request, null); + } + + /** + * Lists the authenticated user's per-experience notification levels. Experiences the user never set a level for are omitted — their effective level is all. + */ + public WhopApiHttpResponse> list( + ListExperiencesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/preferences/notifications/experiences"); + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListExperiencesResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListExperiencesResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListExperiencesRequest nextRequest = ListExperiencesRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + if (response.code() == 401) { + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/requests/ListExperiencesRequest.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/requests/ListExperiencesRequest.java new file mode 100644 index 00000000..268b6495 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/requests/ListExperiencesRequest.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.experiences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListExperiencesRequest.Builder.class) +public final class ListExperiencesRequest { + private final Optional first; + + private final Optional after; + + private final Map additionalProperties; + + private ListExperiencesRequest( + Optional first, Optional after, Map additionalProperties) { + this.first = first; + this.after = after; + this.additionalProperties = additionalProperties; + } + + /** + * @return The number of preferences to return. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns preferences after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListExperiencesRequest && equalTo((ListExperiencesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListExperiencesRequest other) { + return first.equals(other.first) && after.equals(other.after); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.first, this.after); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListExperiencesRequest other) { + first(other.getFirst()); + after(other.getAfter()); + return this; + } + + /** + *

The number of preferences to return.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor; returns preferences after this position.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + public ListExperiencesRequest build() { + return new ListExperiencesRequest(first, after, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/types/ListExperiencesResponse.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/types/ListExperiencesResponse.java new file mode 100644 index 00000000..906cbc34 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/types/ListExperiencesResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.experiences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.ExperienceNotificationPreference; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListExperiencesResponse.Builder.class) +public final class ListExperiencesResponse { + private final List data; + + private final ListExperiencesResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListExperiencesResponse( + List data, + ListExperiencesResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListExperiencesResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListExperiencesResponse && equalTo((ListExperiencesResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListExperiencesResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListExperiencesResponsePageInfo pageInfo); + + Builder from(ListExperiencesResponse other); + } + + public interface _FinalStage { + ListExperiencesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(ExperienceNotificationPreference data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListExperiencesResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListExperiencesResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListExperiencesResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(ExperienceNotificationPreference data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListExperiencesResponse build() { + return new ListExperiencesResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/types/ListExperiencesResponsePageInfo.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/types/ListExperiencesResponsePageInfo.java new file mode 100644 index 00000000..e70ef0a2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/experiences/types/ListExperiencesResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.experiences.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListExperiencesResponsePageInfo.Builder.class) +public final class ListExperiencesResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListExperiencesResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListExperiencesResponsePageInfo && equalTo((ListExperiencesResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListExperiencesResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListExperiencesResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListExperiencesResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListExperiencesResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListExperiencesResponsePageInfo build() { + return new ListExperiencesResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/requests/SetNotificationsRequest.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/requests/SetNotificationsRequest.java new file mode 100644 index 00000000..29f16c84 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/requests/SetNotificationsRequest.java @@ -0,0 +1,124 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.users.preferences.notifications.types.SetNotificationsRequestPreferencesItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetNotificationsRequest.Builder.class) +public final class SetNotificationsRequest { + private final List preferences; + + private final Map additionalProperties; + + private SetNotificationsRequest( + List preferences, Map additionalProperties) { + this.preferences = preferences; + this.additionalProperties = additionalProperties; + } + + /** + * @return The preferences to set, at most 100 per request. + */ + @JsonProperty("preferences") + public List getPreferences() { + return preferences; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetNotificationsRequest && equalTo((SetNotificationsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetNotificationsRequest other) { + return preferences.equals(other.preferences); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.preferences); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List preferences = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SetNotificationsRequest other) { + preferences(other.getPreferences()); + return this; + } + + /** + *

The preferences to set, at most 100 per request.

+ */ + @JsonSetter(value = "preferences", nulls = Nulls.SKIP) + public Builder preferences(List preferences) { + this.preferences.clear(); + if (preferences != null) { + this.preferences.addAll(preferences); + } + return this; + } + + public Builder addPreferences(SetNotificationsRequestPreferencesItem preferences) { + this.preferences.add(preferences); + return this; + } + + public Builder addAllPreferences(List preferences) { + if (preferences != null) { + this.preferences.addAll(preferences); + } + return this; + } + + public SetNotificationsRequest build() { + return new SetNotificationsRequest(preferences, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/AsyncRawTopicsClient.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/AsyncRawTopicsClient.java new file mode 100644 index 00000000..bbf32b29 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/AsyncRawTopicsClient.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.topics; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.users.preferences.notifications.topics.requests.ListTopicsRequest; +import com.whop.api.resources.users.preferences.notifications.topics.types.ListTopicsResponse; +import com.whop.api.types.UserNotificationPreference; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTopicsClient { + protected final ClientOptions clientOptions; + + public AsyncRawTopicsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public CompletableFuture>> list() { + return list(ListTopicsRequest.builder().build()); + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListTopicsRequest.builder().build(), requestOptions); + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public CompletableFuture>> list( + ListTopicsRequest request) { + return list(request, null); + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public CompletableFuture>> list( + ListTopicsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/preferences/notifications/topics"); + if (request.getChannel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "channel", request.getChannel().get(), false); + } + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getTeamAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "team_account_id", request.getTeamAccountId().get(), false); + } + if (request.getExperienceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "experience_id", request.getExperienceId().get(), false); + } + if (request.getTopicId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "topic_id", request.getTopicId().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListTopicsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListTopicsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListTopicsRequest nextRequest = ListTopicsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + if (response.code() == 401) { + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/AsyncTopicsClient.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/AsyncTopicsClient.java new file mode 100644 index 00000000..5aece3ae --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/AsyncTopicsClient.java @@ -0,0 +1,58 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.topics; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.users.preferences.notifications.topics.requests.ListTopicsRequest; +import com.whop.api.types.UserNotificationPreference; +import java.util.concurrent.CompletableFuture; + +public class AsyncTopicsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTopicsClient rawClient; + + public AsyncTopicsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTopicsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTopicsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public CompletableFuture> list(ListTopicsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public CompletableFuture> list( + ListTopicsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/RawTopicsClient.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/RawTopicsClient.java new file mode 100644 index 00000000..e9139c42 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/RawTopicsClient.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.topics; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.users.preferences.notifications.topics.requests.ListTopicsRequest; +import com.whop.api.resources.users.preferences.notifications.topics.types.ListTopicsResponse; +import com.whop.api.types.UserNotificationPreference; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTopicsClient { + protected final ClientOptions clientOptions; + + public RawTopicsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public WhopApiHttpResponse> list() { + return list(ListTopicsRequest.builder().build()); + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public WhopApiHttpResponse> list(RequestOptions requestOptions) { + return list(ListTopicsRequest.builder().build(), requestOptions); + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public WhopApiHttpResponse> list(ListTopicsRequest request) { + return list(request, null); + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public WhopApiHttpResponse> list( + ListTopicsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("users/me/preferences/notifications/topics"); + if (request.getChannel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "channel", request.getChannel().get(), false); + } + if (request.getAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "account_id", request.getAccountId().get(), false); + } + if (request.getTeamAccountId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "team_account_id", request.getTeamAccountId().get(), false); + } + if (request.getExperienceId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "experience_id", request.getExperienceId().get(), false); + } + if (request.getTopicId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "topic_id", request.getTopicId().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListTopicsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListTopicsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListTopicsRequest nextRequest = ListTopicsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + if (response.code() == 401) { + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/TopicsClient.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/TopicsClient.java new file mode 100644 index 00000000..5d71f3da --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/TopicsClient.java @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.topics; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.users.preferences.notifications.topics.requests.ListTopicsRequest; +import com.whop.api.types.UserNotificationPreference; + +public class TopicsClient { + protected final ClientOptions clientOptions; + + private final RawTopicsClient rawClient; + + public TopicsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTopicsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTopicsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public SyncPagingIterable list(ListTopicsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension. Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences. + */ + public SyncPagingIterable list( + ListTopicsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/requests/ListTopicsRequest.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/requests/ListTopicsRequest.java new file mode 100644 index 00000000..fd74ca9c --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/requests/ListTopicsRequest.java @@ -0,0 +1,302 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.topics.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.users.preferences.notifications.topics.types.ListTopicsRequestChannel; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListTopicsRequest.Builder.class) +public final class ListTopicsRequest { + private final Optional channel; + + private final Optional accountId; + + private final Optional teamAccountId; + + private final Optional experienceId; + + private final Optional topicId; + + private final Optional first; + + private final Optional after; + + private final Map additionalProperties; + + private ListTopicsRequest( + Optional channel, + Optional accountId, + Optional teamAccountId, + Optional experienceId, + Optional topicId, + Optional first, + Optional after, + Map additionalProperties) { + this.channel = channel; + this.accountId = accountId; + this.teamAccountId = teamAccountId; + this.experienceId = experienceId; + this.topicId = topicId; + this.first = first; + this.after = after; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only return preferences for this delivery channel (or not narrowed to a channel). + */ + @JsonProperty("channel") + public Optional getChannel() { + return channel; + } + + /** + * @return Only return preferences scoped to this account's member notifications (biz_ tag). + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Only return preferences scoped to this account's team notifications (biz_ tag). + */ + @JsonProperty("team_account_id") + public Optional getTeamAccountId() { + return teamAccountId; + } + + /** + * @return Only return preferences scoped to this experience (exp_ tag). + */ + @JsonProperty("experience_id") + public Optional getExperienceId() { + return experienceId; + } + + /** + * @return Only return preferences scoped to this notification topic (topic_ tag). + */ + @JsonProperty("topic_id") + public Optional getTopicId() { + return topicId; + } + + /** + * @return The number of preferences to return. + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns preferences after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListTopicsRequest && equalTo((ListTopicsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListTopicsRequest other) { + return channel.equals(other.channel) + && accountId.equals(other.accountId) + && teamAccountId.equals(other.teamAccountId) + && experienceId.equals(other.experienceId) + && topicId.equals(other.topicId) + && first.equals(other.first) + && after.equals(other.after); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.channel, + this.accountId, + this.teamAccountId, + this.experienceId, + this.topicId, + this.first, + this.after); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional channel = Optional.empty(); + + private Optional accountId = Optional.empty(); + + private Optional teamAccountId = Optional.empty(); + + private Optional experienceId = Optional.empty(); + + private Optional topicId = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListTopicsRequest other) { + channel(other.getChannel()); + accountId(other.getAccountId()); + teamAccountId(other.getTeamAccountId()); + experienceId(other.getExperienceId()); + topicId(other.getTopicId()); + first(other.getFirst()); + after(other.getAfter()); + return this; + } + + /** + *

Only return preferences for this delivery channel (or not narrowed to a channel).

+ */ + @JsonSetter(value = "channel", nulls = Nulls.SKIP) + public Builder channel(Optional channel) { + this.channel = channel; + return this; + } + + public Builder channel(ListTopicsRequestChannel channel) { + this.channel = Optional.ofNullable(channel); + return this; + } + + /** + *

Only return preferences scoped to this account's member notifications (biz_ tag).

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Only return preferences scoped to this account's team notifications (biz_ tag).

+ */ + @JsonSetter(value = "team_account_id", nulls = Nulls.SKIP) + public Builder teamAccountId(Optional teamAccountId) { + this.teamAccountId = teamAccountId; + return this; + } + + public Builder teamAccountId(String teamAccountId) { + this.teamAccountId = Optional.ofNullable(teamAccountId); + return this; + } + + /** + *

Only return preferences scoped to this experience (exp_ tag).

+ */ + @JsonSetter(value = "experience_id", nulls = Nulls.SKIP) + public Builder experienceId(Optional experienceId) { + this.experienceId = experienceId; + return this; + } + + public Builder experienceId(String experienceId) { + this.experienceId = Optional.ofNullable(experienceId); + return this; + } + + /** + *

Only return preferences scoped to this notification topic (topic_ tag).

+ */ + @JsonSetter(value = "topic_id", nulls = Nulls.SKIP) + public Builder topicId(Optional topicId) { + this.topicId = topicId; + return this; + } + + public Builder topicId(String topicId) { + this.topicId = Optional.ofNullable(topicId); + return this; + } + + /** + *

The number of preferences to return.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor; returns preferences after this position.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + public ListTopicsRequest build() { + return new ListTopicsRequest( + channel, accountId, teamAccountId, experienceId, topicId, first, after, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/types/ListTopicsRequestChannel.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/types/ListTopicsRequestChannel.java new file mode 100644 index 00000000..571e73ba --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/types/ListTopicsRequestChannel.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.topics.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListTopicsRequestChannel { + public static final ListTopicsRequestChannel MOBILE = new ListTopicsRequestChannel(Value.MOBILE, "mobile"); + + public static final ListTopicsRequestChannel IN_APP = new ListTopicsRequestChannel(Value.IN_APP, "in_app"); + + private final Value value; + + private final String string; + + ListTopicsRequestChannel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListTopicsRequestChannel + && this.string.equals(((ListTopicsRequestChannel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MOBILE: + return visitor.visitMobile(); + case IN_APP: + return visitor.visitInApp(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListTopicsRequestChannel valueOf(String value) { + switch (value) { + case "mobile": + return MOBILE; + case "in_app": + return IN_APP; + default: + return new ListTopicsRequestChannel(Value.UNKNOWN, value); + } + } + + public enum Value { + IN_APP, + + MOBILE, + + UNKNOWN + } + + public interface Visitor { + T visitInApp(); + + T visitMobile(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/types/ListTopicsResponse.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/types/ListTopicsResponse.java new file mode 100644 index 00000000..2b08e112 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/types/ListTopicsResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.topics.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.UserNotificationPreference; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListTopicsResponse.Builder.class) +public final class ListTopicsResponse { + private final List data; + + private final ListTopicsResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListTopicsResponse( + List data, + ListTopicsResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListTopicsResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListTopicsResponse && equalTo((ListTopicsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListTopicsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListTopicsResponsePageInfo pageInfo); + + Builder from(ListTopicsResponse other); + } + + public interface _FinalStage { + ListTopicsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(UserNotificationPreference data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListTopicsResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListTopicsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListTopicsResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(UserNotificationPreference data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListTopicsResponse build() { + return new ListTopicsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/types/ListTopicsResponsePageInfo.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/types/ListTopicsResponsePageInfo.java new file mode 100644 index 00000000..56e1f86d --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/topics/types/ListTopicsResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.topics.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListTopicsResponsePageInfo.Builder.class) +public final class ListTopicsResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListTopicsResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListTopicsResponsePageInfo && equalTo((ListTopicsResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListTopicsResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListTopicsResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListTopicsResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListTopicsResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListTopicsResponsePageInfo build() { + return new ListTopicsResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/types/SetNotificationsRequestPreferencesItem.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/types/SetNotificationsRequestPreferencesItem.java new file mode 100644 index 00000000..0a6a3d9c --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/types/SetNotificationsRequestPreferencesItem.java @@ -0,0 +1,206 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetNotificationsRequestPreferencesItem.Builder.class) +public final class SetNotificationsRequestPreferencesItem { + private final Optional level; + + private final SetNotificationsRequestPreferencesItemScope scope; + + private final Map additionalProperties; + + private SetNotificationsRequestPreferencesItem( + Optional level, + SetNotificationsRequestPreferencesItemScope scope, + Map additionalProperties) { + this.level = level; + this.scope = scope; + this.additionalProperties = additionalProperties; + } + + /** + * @return What the user is notified about in this scope. mentions is only valid for an experience level. null clears the preference. + */ + @JsonIgnore + public Optional getLevel() { + if (level == null) { + return Optional.empty(); + } + return level; + } + + /** + * @return What the preference applies to. null on a dimension means the preference is not narrowed there. + */ + @JsonProperty("scope") + public SetNotificationsRequestPreferencesItemScope getScope() { + return scope; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("level") + private Optional _getLevel() { + return level; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetNotificationsRequestPreferencesItem + && equalTo((SetNotificationsRequestPreferencesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetNotificationsRequestPreferencesItem other) { + return level.equals(other.level) && scope.equals(other.scope); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.level, this.scope); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ScopeStage builder() { + return new Builder(); + } + + public interface ScopeStage { + /** + *

What the preference applies to. null on a dimension means the preference is not narrowed there.

+ */ + _FinalStage scope(@NotNull SetNotificationsRequestPreferencesItemScope scope); + + Builder from(SetNotificationsRequestPreferencesItem other); + } + + public interface _FinalStage { + SetNotificationsRequestPreferencesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

What the user is notified about in this scope. mentions is only valid for an experience level. null clears the preference.

+ */ + _FinalStage level(Optional level); + + _FinalStage level(SetNotificationsRequestPreferencesItemLevel level); + + _FinalStage level(Nullable level); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ScopeStage, _FinalStage { + private SetNotificationsRequestPreferencesItemScope scope; + + private Optional level = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SetNotificationsRequestPreferencesItem other) { + level(other.getLevel()); + scope(other.getScope()); + return this; + } + + /** + *

What the preference applies to. null on a dimension means the preference is not narrowed there.

+ *

What the preference applies to. null on a dimension means the preference is not narrowed there.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("scope") + public _FinalStage scope(@NotNull SetNotificationsRequestPreferencesItemScope scope) { + this.scope = Objects.requireNonNull(scope, "scope must not be null"); + return this; + } + + /** + *

What the user is notified about in this scope. mentions is only valid for an experience level. null clears the preference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage level(Nullable level) { + if (level.isNull()) { + this.level = null; + } else if (level.isEmpty()) { + this.level = Optional.empty(); + } else { + this.level = Optional.of(level.get()); + } + return this; + } + + /** + *

What the user is notified about in this scope. mentions is only valid for an experience level. null clears the preference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage level(SetNotificationsRequestPreferencesItemLevel level) { + this.level = Optional.ofNullable(level); + return this; + } + + /** + *

What the user is notified about in this scope. mentions is only valid for an experience level. null clears the preference.

+ */ + @java.lang.Override + @JsonSetter(value = "level", nulls = Nulls.SKIP) + public _FinalStage level(Optional level) { + this.level = level; + return this; + } + + @java.lang.Override + public SetNotificationsRequestPreferencesItem build() { + return new SetNotificationsRequestPreferencesItem(level, scope, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/types/SetNotificationsRequestPreferencesItemLevel.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/types/SetNotificationsRequestPreferencesItemLevel.java new file mode 100644 index 00000000..f09a63ca --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/types/SetNotificationsRequestPreferencesItemLevel.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SetNotificationsRequestPreferencesItemLevel { + public static final SetNotificationsRequestPreferencesItemLevel ALL = + new SetNotificationsRequestPreferencesItemLevel(Value.ALL, "all"); + + public static final SetNotificationsRequestPreferencesItemLevel NOTHING = + new SetNotificationsRequestPreferencesItemLevel(Value.NOTHING, "nothing"); + + public static final SetNotificationsRequestPreferencesItemLevel MENTIONS = + new SetNotificationsRequestPreferencesItemLevel(Value.MENTIONS, "mentions"); + + private final Value value; + + private final String string; + + SetNotificationsRequestPreferencesItemLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SetNotificationsRequestPreferencesItemLevel + && this.string.equals(((SetNotificationsRequestPreferencesItemLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ALL: + return visitor.visitAll(); + case NOTHING: + return visitor.visitNothing(); + case MENTIONS: + return visitor.visitMentions(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SetNotificationsRequestPreferencesItemLevel valueOf(String value) { + switch (value) { + case "all": + return ALL; + case "nothing": + return NOTHING; + case "mentions": + return MENTIONS; + default: + return new SetNotificationsRequestPreferencesItemLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL, + + MENTIONS, + + NOTHING, + + UNKNOWN + } + + public interface Visitor { + T visitAll(); + + T visitMentions(); + + T visitNothing(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/types/SetNotificationsRequestPreferencesItemScope.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/types/SetNotificationsRequestPreferencesItemScope.java new file mode 100644 index 00000000..8fc4efc0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/types/SetNotificationsRequestPreferencesItemScope.java @@ -0,0 +1,338 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetNotificationsRequestPreferencesItemScope.Builder.class) +public final class SetNotificationsRequestPreferencesItemScope { + private final Optional accountId; + + private final Optional channel; + + private final Optional experienceId; + + private final Optional teamAccountId; + + private final Optional topicId; + + private final Map additionalProperties; + + private SetNotificationsRequestPreferencesItemScope( + Optional accountId, + Optional channel, + Optional experienceId, + Optional teamAccountId, + Optional topicId, + Map additionalProperties) { + this.accountId = accountId; + this.channel = channel; + this.experienceId = experienceId; + this.teamAccountId = teamAccountId; + this.topicId = topicId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account to scope the preference to (member notifications), biz_ tag. + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return Delivery channel the preference applies to. Required when setting a topic override. + */ + @JsonIgnore + public Optional getChannel() { + if (channel == null) { + return Optional.empty(); + } + return channel; + } + + /** + * @return Experience to scope the preference to (exp_ tag). Requires account_id when a topic_id is also given. + */ + @JsonIgnore + public Optional getExperienceId() { + if (experienceId == null) { + return Optional.empty(); + } + return experienceId; + } + + /** + * @return Account whose team notifications the preference is scoped to, biz_ tag. + */ + @JsonIgnore + public Optional getTeamAccountId() { + if (teamAccountId == null) { + return Optional.empty(); + } + return teamAccountId; + } + + /** + * @return Notification topic to scope the preference to, topic_ tag. + */ + @JsonIgnore + public Optional getTopicId() { + if (topicId == null) { + return Optional.empty(); + } + return topicId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("channel") + private Optional _getChannel() { + return channel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("experience_id") + private Optional _getExperienceId() { + return experienceId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("team_account_id") + private Optional _getTeamAccountId() { + return teamAccountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("topic_id") + private Optional _getTopicId() { + return topicId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetNotificationsRequestPreferencesItemScope + && equalTo((SetNotificationsRequestPreferencesItemScope) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetNotificationsRequestPreferencesItemScope other) { + return accountId.equals(other.accountId) + && channel.equals(other.channel) + && experienceId.equals(other.experienceId) + && teamAccountId.equals(other.teamAccountId) + && topicId.equals(other.topicId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.channel, this.experienceId, this.teamAccountId, this.topicId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional channel = Optional.empty(); + + private Optional experienceId = Optional.empty(); + + private Optional teamAccountId = Optional.empty(); + + private Optional topicId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SetNotificationsRequestPreferencesItemScope other) { + accountId(other.getAccountId()); + channel(other.getChannel()); + experienceId(other.getExperienceId()); + teamAccountId(other.getTeamAccountId()); + topicId(other.getTopicId()); + return this; + } + + /** + *

Account to scope the preference to (member notifications), biz_ tag.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + public Builder accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

Delivery channel the preference applies to. Required when setting a topic override.

+ */ + @JsonSetter(value = "channel", nulls = Nulls.SKIP) + public Builder channel(Optional channel) { + this.channel = channel; + return this; + } + + public Builder channel(SetNotificationsRequestPreferencesItemScopeChannel channel) { + this.channel = Optional.ofNullable(channel); + return this; + } + + public Builder channel(Nullable channel) { + if (channel.isNull()) { + this.channel = null; + } else if (channel.isEmpty()) { + this.channel = Optional.empty(); + } else { + this.channel = Optional.of(channel.get()); + } + return this; + } + + /** + *

Experience to scope the preference to (exp_ tag). Requires account_id when a topic_id is also given.

+ */ + @JsonSetter(value = "experience_id", nulls = Nulls.SKIP) + public Builder experienceId(Optional experienceId) { + this.experienceId = experienceId; + return this; + } + + public Builder experienceId(String experienceId) { + this.experienceId = Optional.ofNullable(experienceId); + return this; + } + + public Builder experienceId(Nullable experienceId) { + if (experienceId.isNull()) { + this.experienceId = null; + } else if (experienceId.isEmpty()) { + this.experienceId = Optional.empty(); + } else { + this.experienceId = Optional.of(experienceId.get()); + } + return this; + } + + /** + *

Account whose team notifications the preference is scoped to, biz_ tag.

+ */ + @JsonSetter(value = "team_account_id", nulls = Nulls.SKIP) + public Builder teamAccountId(Optional teamAccountId) { + this.teamAccountId = teamAccountId; + return this; + } + + public Builder teamAccountId(String teamAccountId) { + this.teamAccountId = Optional.ofNullable(teamAccountId); + return this; + } + + public Builder teamAccountId(Nullable teamAccountId) { + if (teamAccountId.isNull()) { + this.teamAccountId = null; + } else if (teamAccountId.isEmpty()) { + this.teamAccountId = Optional.empty(); + } else { + this.teamAccountId = Optional.of(teamAccountId.get()); + } + return this; + } + + /** + *

Notification topic to scope the preference to, topic_ tag.

+ */ + @JsonSetter(value = "topic_id", nulls = Nulls.SKIP) + public Builder topicId(Optional topicId) { + this.topicId = topicId; + return this; + } + + public Builder topicId(String topicId) { + this.topicId = Optional.ofNullable(topicId); + return this; + } + + public Builder topicId(Nullable topicId) { + if (topicId.isNull()) { + this.topicId = null; + } else if (topicId.isEmpty()) { + this.topicId = Optional.empty(); + } else { + this.topicId = Optional.of(topicId.get()); + } + return this; + } + + public SetNotificationsRequestPreferencesItemScope build() { + return new SetNotificationsRequestPreferencesItemScope( + accountId, channel, experienceId, teamAccountId, topicId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/types/SetNotificationsRequestPreferencesItemScopeChannel.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/types/SetNotificationsRequestPreferencesItemScopeChannel.java new file mode 100644 index 00000000..68d03b7b --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/types/SetNotificationsRequestPreferencesItemScopeChannel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SetNotificationsRequestPreferencesItemScopeChannel { + public static final SetNotificationsRequestPreferencesItemScopeChannel MOBILE = + new SetNotificationsRequestPreferencesItemScopeChannel(Value.MOBILE, "mobile"); + + public static final SetNotificationsRequestPreferencesItemScopeChannel IN_APP = + new SetNotificationsRequestPreferencesItemScopeChannel(Value.IN_APP, "in_app"); + + private final Value value; + + private final String string; + + SetNotificationsRequestPreferencesItemScopeChannel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SetNotificationsRequestPreferencesItemScopeChannel + && this.string.equals(((SetNotificationsRequestPreferencesItemScopeChannel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MOBILE: + return visitor.visitMobile(); + case IN_APP: + return visitor.visitInApp(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SetNotificationsRequestPreferencesItemScopeChannel valueOf(String value) { + switch (value) { + case "mobile": + return MOBILE; + case "in_app": + return IN_APP; + default: + return new SetNotificationsRequestPreferencesItemScopeChannel(Value.UNKNOWN, value); + } + } + + public enum Value { + IN_APP, + + MOBILE, + + UNKNOWN + } + + public interface Visitor { + T visitInApp(); + + T visitMobile(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/notifications/types/SetNotificationsResponse.java b/src/main/java/com/whop/api/resources/users/preferences/notifications/types/SetNotificationsResponse.java new file mode 100644 index 00000000..94439c81 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/notifications/types/SetNotificationsResponse.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.notifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.NotificationPreferenceState; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetNotificationsResponse.Builder.class) +public final class SetNotificationsResponse { + private final List data; + + private final Map additionalProperties; + + private SetNotificationsResponse(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetNotificationsResponse && equalTo((SetNotificationsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetNotificationsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SetNotificationsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(NotificationPreferenceState data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public SetNotificationsResponse build() { + return new SetNotificationsResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/preferences/requests/UpdatePreferencesRequest.java b/src/main/java/com/whop/api/resources/users/preferences/requests/UpdatePreferencesRequest.java new file mode 100644 index 00000000..05799c97 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/preferences/requests/UpdatePreferencesRequest.java @@ -0,0 +1,174 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.preferences.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePreferencesRequest.Builder.class) +public final class UpdatePreferencesRequest { + private final Optional bountyWorkerOnboardingDismissed; + + private final Optional investigationEnabled; + + private final Optional termsAccepted; + + private final Map additionalProperties; + + private UpdatePreferencesRequest( + Optional bountyWorkerOnboardingDismissed, + Optional investigationEnabled, + Optional termsAccepted, + Map additionalProperties) { + this.bountyWorkerOnboardingDismissed = bountyWorkerOnboardingDismissed; + this.investigationEnabled = investigationEnabled; + this.termsAccepted = termsAccepted; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the user has dismissed the first-time bounty worker onboarding. Set to false to show it again. + */ + @JsonProperty("bounty_worker_onboarding_dismissed") + public Optional getBountyWorkerOnboardingDismissed() { + return bountyWorkerOnboardingDismissed; + } + + /** + * @return Whether investigation mode is enabled for the user. Only meaningful for staff users with investigation access. + */ + @JsonProperty("investigation_enabled") + public Optional getInvestigationEnabled() { + return investigationEnabled; + } + + /** + * @return Records the user's acceptance of Whop's terms and policies. Only true is accepted — the server stamps terms_accepted_at and acceptance cannot be withdrawn here. + */ + @JsonProperty("terms_accepted") + public Optional getTermsAccepted() { + return termsAccepted; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePreferencesRequest && equalTo((UpdatePreferencesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePreferencesRequest other) { + return bountyWorkerOnboardingDismissed.equals(other.bountyWorkerOnboardingDismissed) + && investigationEnabled.equals(other.investigationEnabled) + && termsAccepted.equals(other.termsAccepted); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.bountyWorkerOnboardingDismissed, this.investigationEnabled, this.termsAccepted); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional bountyWorkerOnboardingDismissed = Optional.empty(); + + private Optional investigationEnabled = Optional.empty(); + + private Optional termsAccepted = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdatePreferencesRequest other) { + bountyWorkerOnboardingDismissed(other.getBountyWorkerOnboardingDismissed()); + investigationEnabled(other.getInvestigationEnabled()); + termsAccepted(other.getTermsAccepted()); + return this; + } + + /** + *

Whether the user has dismissed the first-time bounty worker onboarding. Set to false to show it again.

+ */ + @JsonSetter(value = "bounty_worker_onboarding_dismissed", nulls = Nulls.SKIP) + public Builder bountyWorkerOnboardingDismissed(Optional bountyWorkerOnboardingDismissed) { + this.bountyWorkerOnboardingDismissed = bountyWorkerOnboardingDismissed; + return this; + } + + public Builder bountyWorkerOnboardingDismissed(Boolean bountyWorkerOnboardingDismissed) { + this.bountyWorkerOnboardingDismissed = Optional.ofNullable(bountyWorkerOnboardingDismissed); + return this; + } + + /** + *

Whether investigation mode is enabled for the user. Only meaningful for staff users with investigation access.

+ */ + @JsonSetter(value = "investigation_enabled", nulls = Nulls.SKIP) + public Builder investigationEnabled(Optional investigationEnabled) { + this.investigationEnabled = investigationEnabled; + return this; + } + + public Builder investigationEnabled(Boolean investigationEnabled) { + this.investigationEnabled = Optional.ofNullable(investigationEnabled); + return this; + } + + /** + *

Records the user's acceptance of Whop's terms and policies. Only true is accepted — the server stamps terms_accepted_at and acceptance cannot be withdrawn here.

+ */ + @JsonSetter(value = "terms_accepted", nulls = Nulls.SKIP) + public Builder termsAccepted(Optional termsAccepted) { + this.termsAccepted = termsAccepted; + return this; + } + + public Builder termsAccepted(Boolean termsAccepted) { + this.termsAccepted = Optional.ofNullable(termsAccepted); + return this; + } + + public UpdatePreferencesRequest build() { + return new UpdatePreferencesRequest( + bountyWorkerOnboardingDismissed, investigationEnabled, termsAccepted, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/requests/CheckAccessUsersRequest.java b/src/main/java/com/whop/api/resources/users/requests/CheckAccessUsersRequest.java new file mode 100644 index 00000000..6c6b978b --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/requests/CheckAccessUsersRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CheckAccessUsersRequest.Builder.class) +public final class CheckAccessUsersRequest { + private final Map additionalProperties; + + private CheckAccessUsersRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckAccessUsersRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CheckAccessUsersRequest other) { + return this; + } + + public CheckAccessUsersRequest build() { + return new CheckAccessUsersRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/requests/ListUsersRequest.java b/src/main/java/com/whop/api/resources/users/requests/ListUsersRequest.java new file mode 100644 index 00000000..abcd937e --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/requests/ListUsersRequest.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListUsersRequest.Builder.class) +public final class ListUsersRequest { + private final Optional query; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListUsersRequest( + Optional query, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.query = query; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return A search term to filter users by name or username. + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + /** + * @return The number of users to return (max 50). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns users after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of users to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns users before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListUsersRequest && equalTo((ListUsersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListUsersRequest other) { + return query.equals(other.query) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.query, this.first, this.after, this.last, this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional query = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional before = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListUsersRequest other) { + query(other.getQuery()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

A search term to filter users by name or username.

+ */ + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public Builder query(Optional query) { + this.query = query; + return this; + } + + public Builder query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + /** + *

The number of users to return (max 50).

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor; returns users after this position.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

The number of users to return from the end of the range.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

A cursor; returns users before this position.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + public ListUsersRequest build() { + return new ListUsersRequest(query, first, after, last, before, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/requests/MeUsersRequest.java b/src/main/java/com/whop/api/resources/users/requests/MeUsersRequest.java new file mode 100644 index 00000000..b8793dc3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/requests/MeUsersRequest.java @@ -0,0 +1,266 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.users.types.MeUsersRequestInterval; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MeUsersRequest.Builder.class) +public final class MeUsersRequest { + private final Optional accountId; + + private final Optional includeBalanceHistory; + + private final Optional from; + + private final Optional to; + + private final Optional interval; + + private final Optional timeZone; + + private final Map additionalProperties; + + private MeUsersRequest( + Optional accountId, + Optional includeBalanceHistory, + Optional from, + Optional to, + Optional interval, + Optional timeZone, + Map additionalProperties) { + this.accountId = accountId; + this.includeBalanceHistory = includeBalanceHistory; + this.from = from; + this.to = to; + this.interval = interval; + this.timeZone = timeZone; + this.additionalProperties = additionalProperties; + } + + /** + * @return When set, returns your account-specific profile overrides for this account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Also compute your balance history (opt-in; runs a heavier query). Ignored for callers without balance-read scope. + */ + @JsonProperty("include_balance_history") + public Optional getIncludeBalanceHistory() { + return includeBalanceHistory; + } + + /** + * @return Balance-history window start, ISO 8601 date or datetime. Defaults to 30 days ago. Only used with include_balance_history. + */ + @JsonProperty("from") + public Optional getFrom() { + return from; + } + + /** + * @return Balance-history window end, ISO 8601 date or datetime. Defaults to now. Only used with include_balance_history. + */ + @JsonProperty("to") + public Optional getTo() { + return to; + } + + /** + * @return Balance-history point granularity. Defaults to day. Only used with include_balance_history. + */ + @JsonProperty("interval") + public Optional getInterval() { + return interval; + } + + /** + * @return IANA time zone the balance-history points are bucketed in. Defaults to UTC. Only used with include_balance_history. + */ + @JsonProperty("time_zone") + public Optional getTimeZone() { + return timeZone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MeUsersRequest && equalTo((MeUsersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MeUsersRequest other) { + return accountId.equals(other.accountId) + && includeBalanceHistory.equals(other.includeBalanceHistory) + && from.equals(other.from) + && to.equals(other.to) + && interval.equals(other.interval) + && timeZone.equals(other.timeZone); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, this.includeBalanceHistory, this.from, this.to, this.interval, this.timeZone); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional includeBalanceHistory = Optional.empty(); + + private Optional from = Optional.empty(); + + private Optional to = Optional.empty(); + + private Optional interval = Optional.empty(); + + private Optional timeZone = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MeUsersRequest other) { + accountId(other.getAccountId()); + includeBalanceHistory(other.getIncludeBalanceHistory()); + from(other.getFrom()); + to(other.getTo()); + interval(other.getInterval()); + timeZone(other.getTimeZone()); + return this; + } + + /** + *

When set, returns your account-specific profile overrides for this account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Also compute your balance history (opt-in; runs a heavier query). Ignored for callers without balance-read scope.

+ */ + @JsonSetter(value = "include_balance_history", nulls = Nulls.SKIP) + public Builder includeBalanceHistory(Optional includeBalanceHistory) { + this.includeBalanceHistory = includeBalanceHistory; + return this; + } + + public Builder includeBalanceHistory(Boolean includeBalanceHistory) { + this.includeBalanceHistory = Optional.ofNullable(includeBalanceHistory); + return this; + } + + /** + *

Balance-history window start, ISO 8601 date or datetime. Defaults to 30 days ago. Only used with include_balance_history.

+ */ + @JsonSetter(value = "from", nulls = Nulls.SKIP) + public Builder from(Optional from) { + this.from = from; + return this; + } + + public Builder from(String from) { + this.from = Optional.ofNullable(from); + return this; + } + + /** + *

Balance-history window end, ISO 8601 date or datetime. Defaults to now. Only used with include_balance_history.

+ */ + @JsonSetter(value = "to", nulls = Nulls.SKIP) + public Builder to(Optional to) { + this.to = to; + return this; + } + + public Builder to(String to) { + this.to = Optional.ofNullable(to); + return this; + } + + /** + *

Balance-history point granularity. Defaults to day. Only used with include_balance_history.

+ */ + @JsonSetter(value = "interval", nulls = Nulls.SKIP) + public Builder interval(Optional interval) { + this.interval = interval; + return this; + } + + public Builder interval(MeUsersRequestInterval interval) { + this.interval = Optional.ofNullable(interval); + return this; + } + + /** + *

IANA time zone the balance-history points are bucketed in. Defaults to UTC. Only used with include_balance_history.

+ */ + @JsonSetter(value = "time_zone", nulls = Nulls.SKIP) + public Builder timeZone(Optional timeZone) { + this.timeZone = timeZone; + return this; + } + + public Builder timeZone(String timeZone) { + this.timeZone = Optional.ofNullable(timeZone); + return this; + } + + public MeUsersRequest build() { + return new MeUsersRequest( + accountId, includeBalanceHistory, from, to, interval, timeZone, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/requests/RecommendActionsUsersRequest.java b/src/main/java/com/whop/api/resources/users/requests/RecommendActionsUsersRequest.java new file mode 100644 index 00000000..82b801f8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/requests/RecommendActionsUsersRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RecommendActionsUsersRequest.Builder.class) +public final class RecommendActionsUsersRequest { + private final Map additionalProperties; + + private RecommendActionsUsersRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RecommendActionsUsersRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RecommendActionsUsersRequest other) { + return this; + } + + public RecommendActionsUsersRequest build() { + return new RecommendActionsUsersRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/requests/RetrieveUsersRequest.java b/src/main/java/com/whop/api/resources/users/requests/RetrieveUsersRequest.java new file mode 100644 index 00000000..75372d0c --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/requests/RetrieveUsersRequest.java @@ -0,0 +1,266 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.users.types.RetrieveUsersRequestInterval; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveUsersRequest.Builder.class) +public final class RetrieveUsersRequest { + private final Optional accountId; + + private final Optional includeBalanceHistory; + + private final Optional from; + + private final Optional to; + + private final Optional interval; + + private final Optional timeZone; + + private final Map additionalProperties; + + private RetrieveUsersRequest( + Optional accountId, + Optional includeBalanceHistory, + Optional from, + Optional to, + Optional interval, + Optional timeZone, + Map additionalProperties) { + this.accountId = accountId; + this.includeBalanceHistory = includeBalanceHistory; + this.from = from; + this.to = to; + this.interval = interval; + this.timeZone = timeZone; + this.additionalProperties = additionalProperties; + } + + /** + * @return When set, returns the user's account-specific profile overrides for this account. + */ + @JsonProperty("account_id") + public Optional getAccountId() { + return accountId; + } + + /** + * @return Also compute your balance history (opt-in; runs a heavier query). Only applies when the id is me; ignored for callers without balance-read scope. + */ + @JsonProperty("include_balance_history") + public Optional getIncludeBalanceHistory() { + return includeBalanceHistory; + } + + /** + * @return Balance-history window start, ISO 8601 date or datetime. Defaults to 30 days ago. Only used with include_balance_history. + */ + @JsonProperty("from") + public Optional getFrom() { + return from; + } + + /** + * @return Balance-history window end, ISO 8601 date or datetime. Defaults to now. Only used with include_balance_history. + */ + @JsonProperty("to") + public Optional getTo() { + return to; + } + + /** + * @return Balance-history point granularity. Defaults to day. Only used with include_balance_history. + */ + @JsonProperty("interval") + public Optional getInterval() { + return interval; + } + + /** + * @return IANA time zone the balance-history points are bucketed in. Defaults to UTC. Only used with include_balance_history. + */ + @JsonProperty("time_zone") + public Optional getTimeZone() { + return timeZone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveUsersRequest && equalTo((RetrieveUsersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveUsersRequest other) { + return accountId.equals(other.accountId) + && includeBalanceHistory.equals(other.includeBalanceHistory) + && from.equals(other.from) + && to.equals(other.to) + && interval.equals(other.interval) + && timeZone.equals(other.timeZone); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, this.includeBalanceHistory, this.from, this.to, this.interval, this.timeZone); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional includeBalanceHistory = Optional.empty(); + + private Optional from = Optional.empty(); + + private Optional to = Optional.empty(); + + private Optional interval = Optional.empty(); + + private Optional timeZone = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveUsersRequest other) { + accountId(other.getAccountId()); + includeBalanceHistory(other.getIncludeBalanceHistory()); + from(other.getFrom()); + to(other.getTo()); + interval(other.getInterval()); + timeZone(other.getTimeZone()); + return this; + } + + /** + *

When set, returns the user's account-specific profile overrides for this account.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Also compute your balance history (opt-in; runs a heavier query). Only applies when the id is me; ignored for callers without balance-read scope.

+ */ + @JsonSetter(value = "include_balance_history", nulls = Nulls.SKIP) + public Builder includeBalanceHistory(Optional includeBalanceHistory) { + this.includeBalanceHistory = includeBalanceHistory; + return this; + } + + public Builder includeBalanceHistory(Boolean includeBalanceHistory) { + this.includeBalanceHistory = Optional.ofNullable(includeBalanceHistory); + return this; + } + + /** + *

Balance-history window start, ISO 8601 date or datetime. Defaults to 30 days ago. Only used with include_balance_history.

+ */ + @JsonSetter(value = "from", nulls = Nulls.SKIP) + public Builder from(Optional from) { + this.from = from; + return this; + } + + public Builder from(String from) { + this.from = Optional.ofNullable(from); + return this; + } + + /** + *

Balance-history window end, ISO 8601 date or datetime. Defaults to now. Only used with include_balance_history.

+ */ + @JsonSetter(value = "to", nulls = Nulls.SKIP) + public Builder to(Optional to) { + this.to = to; + return this; + } + + public Builder to(String to) { + this.to = Optional.ofNullable(to); + return this; + } + + /** + *

Balance-history point granularity. Defaults to day. Only used with include_balance_history.

+ */ + @JsonSetter(value = "interval", nulls = Nulls.SKIP) + public Builder interval(Optional interval) { + this.interval = interval; + return this; + } + + public Builder interval(RetrieveUsersRequestInterval interval) { + this.interval = Optional.ofNullable(interval); + return this; + } + + /** + *

IANA time zone the balance-history points are bucketed in. Defaults to UTC. Only used with include_balance_history.

+ */ + @JsonSetter(value = "time_zone", nulls = Nulls.SKIP) + public Builder timeZone(Optional timeZone) { + this.timeZone = timeZone; + return this; + } + + public Builder timeZone(String timeZone) { + this.timeZone = Optional.ofNullable(timeZone); + return this; + } + + public RetrieveUsersRequest build() { + return new RetrieveUsersRequest( + accountId, includeBalanceHistory, from, to, interval, timeZone, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/requests/UpdateMeUsersRequest.java b/src/main/java/com/whop/api/resources/users/requests/UpdateMeUsersRequest.java new file mode 100644 index 00000000..61a81c42 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/requests/UpdateMeUsersRequest.java @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.users.types.UpdateMeUsersRequestBanner; +import com.whop.api.resources.users.types.UpdateMeUsersRequestProfilePicture; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateMeUsersRequest.Builder.class) +public final class UpdateMeUsersRequest { + private final Optional accountId; + + private final Optional banner; + + private final Optional bio; + + private final Optional name; + + private final Optional profilePicture; + + private final Optional username; + + private final Map additionalProperties; + + private UpdateMeUsersRequest( + Optional accountId, + Optional banner, + Optional bio, + Optional name, + Optional profilePicture, + Optional username, + Map additionalProperties) { + this.accountId = accountId; + this.banner = banner; + this.bio = bio; + this.name = name; + this.profilePicture = profilePicture; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return When set, updates the authenticated user's profile override for this account instead of their global profile. + */ + @JsonIgnore + public Optional getAccountId() { + return accountId; + } + + @JsonIgnore + public Optional getBanner() { + if (banner == null) { + return Optional.empty(); + } + return banner; + } + + @JsonProperty("bio") + public Optional getBio() { + return bio; + } + + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("profile_picture") + public Optional getProfilePicture() { + return profilePicture; + } + + @JsonProperty("username") + public Optional getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("banner") + private Optional _getBanner() { + return banner; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateMeUsersRequest && equalTo((UpdateMeUsersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateMeUsersRequest other) { + return accountId.equals(other.accountId) + && banner.equals(other.banner) + && bio.equals(other.bio) + && name.equals(other.name) + && profilePicture.equals(other.profilePicture) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.banner, this.bio, this.name, this.profilePicture, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional banner = Optional.empty(); + + private Optional bio = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional profilePicture = Optional.empty(); + + private Optional username = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateMeUsersRequest other) { + accountId(other.getAccountId()); + banner(other.getBanner()); + bio(other.getBio()); + name(other.getName()); + profilePicture(other.getProfilePicture()); + username(other.getUsername()); + return this; + } + + /** + *

When set, updates the authenticated user's profile override for this account instead of their global profile.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + @JsonSetter(value = "banner", nulls = Nulls.SKIP) + public Builder banner(Optional banner) { + this.banner = banner; + return this; + } + + public Builder banner(UpdateMeUsersRequestBanner banner) { + this.banner = Optional.ofNullable(banner); + return this; + } + + public Builder banner(Nullable banner) { + if (banner.isNull()) { + this.banner = null; + } else if (banner.isEmpty()) { + this.banner = Optional.empty(); + } else { + this.banner = Optional.of(banner.get()); + } + return this; + } + + @JsonSetter(value = "bio", nulls = Nulls.SKIP) + public Builder bio(Optional bio) { + this.bio = bio; + return this; + } + + public Builder bio(String bio) { + this.bio = Optional.ofNullable(bio); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "profile_picture", nulls = Nulls.SKIP) + public Builder profilePicture(Optional profilePicture) { + this.profilePicture = profilePicture; + return this; + } + + public Builder profilePicture(UpdateMeUsersRequestProfilePicture profilePicture) { + this.profilePicture = Optional.ofNullable(profilePicture); + return this; + } + + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public Builder username(Optional username) { + this.username = username; + return this; + } + + public Builder username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + public UpdateMeUsersRequest build() { + return new UpdateMeUsersRequest( + accountId, banner, bio, name, profilePicture, username, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/requests/UpdateUsersRequest.java b/src/main/java/com/whop/api/resources/users/requests/UpdateUsersRequest.java new file mode 100644 index 00000000..dacf1837 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/requests/UpdateUsersRequest.java @@ -0,0 +1,258 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.users.types.UpdateUsersRequestBanner; +import com.whop.api.resources.users.types.UpdateUsersRequestProfilePicture; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateUsersRequest.Builder.class) +public final class UpdateUsersRequest { + private final Optional accountId; + + private final Optional banner; + + private final Optional bio; + + private final Optional name; + + private final Optional profilePicture; + + private final Optional username; + + private final Map additionalProperties; + + private UpdateUsersRequest( + Optional accountId, + Optional banner, + Optional bio, + Optional name, + Optional profilePicture, + Optional username, + Map additionalProperties) { + this.accountId = accountId; + this.banner = banner; + this.bio = bio; + this.name = name; + this.profilePicture = profilePicture; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account whose profile override to update. Required for API key callers. + */ + @JsonIgnore + public Optional getAccountId() { + return accountId; + } + + @JsonIgnore + public Optional getBanner() { + if (banner == null) { + return Optional.empty(); + } + return banner; + } + + @JsonProperty("bio") + public Optional getBio() { + return bio; + } + + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("profile_picture") + public Optional getProfilePicture() { + return profilePicture; + } + + @JsonProperty("username") + public Optional getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("banner") + private Optional _getBanner() { + return banner; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateUsersRequest && equalTo((UpdateUsersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateUsersRequest other) { + return accountId.equals(other.accountId) + && banner.equals(other.banner) + && bio.equals(other.bio) + && name.equals(other.name) + && profilePicture.equals(other.profilePicture) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.banner, this.bio, this.name, this.profilePicture, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional banner = Optional.empty(); + + private Optional bio = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional profilePicture = Optional.empty(); + + private Optional username = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateUsersRequest other) { + accountId(other.getAccountId()); + banner(other.getBanner()); + bio(other.getBio()); + name(other.getName()); + profilePicture(other.getProfilePicture()); + username(other.getUsername()); + return this; + } + + /** + *

The account whose profile override to update. Required for API key callers.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + @JsonSetter(value = "banner", nulls = Nulls.SKIP) + public Builder banner(Optional banner) { + this.banner = banner; + return this; + } + + public Builder banner(UpdateUsersRequestBanner banner) { + this.banner = Optional.ofNullable(banner); + return this; + } + + public Builder banner(Nullable banner) { + if (banner.isNull()) { + this.banner = null; + } else if (banner.isEmpty()) { + this.banner = Optional.empty(); + } else { + this.banner = Optional.of(banner.get()); + } + return this; + } + + @JsonSetter(value = "bio", nulls = Nulls.SKIP) + public Builder bio(Optional bio) { + this.bio = bio; + return this; + } + + public Builder bio(String bio) { + this.bio = Optional.ofNullable(bio); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "profile_picture", nulls = Nulls.SKIP) + public Builder profilePicture(Optional profilePicture) { + this.profilePicture = profilePicture; + return this; + } + + public Builder profilePicture(UpdateUsersRequestProfilePicture profilePicture) { + this.profilePicture = Optional.ofNullable(profilePicture); + return this; + } + + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public Builder username(Optional username) { + this.username = username; + return this; + } + + public Builder username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + public UpdateUsersRequest build() { + return new UpdateUsersRequest(accountId, banner, bio, name, profilePicture, username, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/types/CheckAccessUsersResponse.java b/src/main/java/com/whop/api/resources/users/types/CheckAccessUsersResponse.java new file mode 100644 index 00000000..38d80080 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/types/CheckAccessUsersResponse.java @@ -0,0 +1,143 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CheckAccessUsersResponse.Builder.class) +public final class CheckAccessUsersResponse { + private final CheckAccessUsersResponseAccessLevel accessLevel; + + private final boolean hasAccess; + + private final Map additionalProperties; + + private CheckAccessUsersResponse( + CheckAccessUsersResponseAccessLevel accessLevel, + boolean hasAccess, + Map additionalProperties) { + this.accessLevel = accessLevel; + this.hasAccess = hasAccess; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("access_level") + public CheckAccessUsersResponseAccessLevel getAccessLevel() { + return accessLevel; + } + + @JsonProperty("has_access") + public boolean getHasAccess() { + return hasAccess; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckAccessUsersResponse && equalTo((CheckAccessUsersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CheckAccessUsersResponse other) { + return accessLevel.equals(other.accessLevel) && hasAccess == other.hasAccess; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accessLevel, this.hasAccess); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccessLevelStage builder() { + return new Builder(); + } + + public interface AccessLevelStage { + HasAccessStage accessLevel(@NotNull CheckAccessUsersResponseAccessLevel accessLevel); + + Builder from(CheckAccessUsersResponse other); + } + + public interface HasAccessStage { + _FinalStage hasAccess(boolean hasAccess); + } + + public interface _FinalStage { + CheckAccessUsersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccessLevelStage, HasAccessStage, _FinalStage { + private CheckAccessUsersResponseAccessLevel accessLevel; + + private boolean hasAccess; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CheckAccessUsersResponse other) { + accessLevel(other.getAccessLevel()); + hasAccess(other.getHasAccess()); + return this; + } + + @java.lang.Override + @JsonSetter("access_level") + public HasAccessStage accessLevel(@NotNull CheckAccessUsersResponseAccessLevel accessLevel) { + this.accessLevel = Objects.requireNonNull(accessLevel, "accessLevel must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("has_access") + public _FinalStage hasAccess(boolean hasAccess) { + this.hasAccess = hasAccess; + return this; + } + + @java.lang.Override + public CheckAccessUsersResponse build() { + return new CheckAccessUsersResponse(accessLevel, hasAccess, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/types/CheckAccessUsersResponseAccessLevel.java b/src/main/java/com/whop/api/resources/users/types/CheckAccessUsersResponseAccessLevel.java new file mode 100644 index 00000000..c34be35f --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/types/CheckAccessUsersResponseAccessLevel.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CheckAccessUsersResponseAccessLevel { + public static final CheckAccessUsersResponseAccessLevel ADMIN = + new CheckAccessUsersResponseAccessLevel(Value.ADMIN, "admin"); + + public static final CheckAccessUsersResponseAccessLevel CUSTOMER = + new CheckAccessUsersResponseAccessLevel(Value.CUSTOMER, "customer"); + + public static final CheckAccessUsersResponseAccessLevel NO_ACCESS = + new CheckAccessUsersResponseAccessLevel(Value.NO_ACCESS, "no_access"); + + private final Value value; + + private final String string; + + CheckAccessUsersResponseAccessLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CheckAccessUsersResponseAccessLevel + && this.string.equals(((CheckAccessUsersResponseAccessLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ADMIN: + return visitor.visitAdmin(); + case CUSTOMER: + return visitor.visitCustomer(); + case NO_ACCESS: + return visitor.visitNoAccess(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CheckAccessUsersResponseAccessLevel valueOf(String value) { + switch (value) { + case "admin": + return ADMIN; + case "customer": + return CUSTOMER; + case "no_access": + return NO_ACCESS; + default: + return new CheckAccessUsersResponseAccessLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + NO_ACCESS, + + ADMIN, + + CUSTOMER, + + UNKNOWN + } + + public interface Visitor { + T visitNoAccess(); + + T visitAdmin(); + + T visitCustomer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/users/types/ListUsersResponse.java b/src/main/java/com/whop/api/resources/users/types/ListUsersResponse.java new file mode 100644 index 00000000..0ddb17d5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/types/ListUsersResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.User; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListUsersResponse.Builder.class) +public final class ListUsersResponse { + private final List data; + + private final ListUsersResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListUsersResponse( + List data, ListUsersResponsePageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListUsersResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListUsersResponse && equalTo((ListUsersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListUsersResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListUsersResponsePageInfo pageInfo); + + Builder from(ListUsersResponse other); + } + + public interface _FinalStage { + ListUsersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(User data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListUsersResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListUsersResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListUsersResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(User data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListUsersResponse build() { + return new ListUsersResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/types/ListUsersResponsePageInfo.java b/src/main/java/com/whop/api/resources/users/types/ListUsersResponsePageInfo.java new file mode 100644 index 00000000..29376412 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/types/ListUsersResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListUsersResponsePageInfo.Builder.class) +public final class ListUsersResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListUsersResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListUsersResponsePageInfo && equalTo((ListUsersResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListUsersResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListUsersResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListUsersResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListUsersResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListUsersResponsePageInfo build() { + return new ListUsersResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/types/MeUsersRequestInterval.java b/src/main/java/com/whop/api/resources/users/types/MeUsersRequestInterval.java new file mode 100644 index 00000000..e1911b7e --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/types/MeUsersRequestInterval.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MeUsersRequestInterval { + public static final MeUsersRequestInterval MONTH = new MeUsersRequestInterval(Value.MONTH, "month"); + + public static final MeUsersRequestInterval HOUR = new MeUsersRequestInterval(Value.HOUR, "hour"); + + public static final MeUsersRequestInterval DAY = new MeUsersRequestInterval(Value.DAY, "day"); + + public static final MeUsersRequestInterval WEEK = new MeUsersRequestInterval(Value.WEEK, "week"); + + private final Value value; + + private final String string; + + MeUsersRequestInterval(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MeUsersRequestInterval + && this.string.equals(((MeUsersRequestInterval) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MONTH: + return visitor.visitMonth(); + case HOUR: + return visitor.visitHour(); + case DAY: + return visitor.visitDay(); + case WEEK: + return visitor.visitWeek(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MeUsersRequestInterval valueOf(String value) { + switch (value) { + case "month": + return MONTH; + case "hour": + return HOUR; + case "day": + return DAY; + case "week": + return WEEK; + default: + return new MeUsersRequestInterval(Value.UNKNOWN, value); + } + } + + public enum Value { + HOUR, + + DAY, + + WEEK, + + MONTH, + + UNKNOWN + } + + public interface Visitor { + T visitHour(); + + T visitDay(); + + T visitWeek(); + + T visitMonth(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/users/types/RecommendActionsUsersResponse.java b/src/main/java/com/whop/api/resources/users/types/RecommendActionsUsersResponse.java new file mode 100644 index 00000000..33f59fc3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/types/RecommendActionsUsersResponse.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.UserRecommendedAction; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RecommendActionsUsersResponse.Builder.class) +public final class RecommendActionsUsersResponse { + private final List data; + + private final Map additionalProperties; + + private RecommendActionsUsersResponse(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RecommendActionsUsersResponse && equalTo((RecommendActionsUsersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RecommendActionsUsersResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RecommendActionsUsersResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(UserRecommendedAction data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public RecommendActionsUsersResponse build() { + return new RecommendActionsUsersResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/types/RetrieveUsersRequestInterval.java b/src/main/java/com/whop/api/resources/users/types/RetrieveUsersRequestInterval.java new file mode 100644 index 00000000..0af43cb9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/types/RetrieveUsersRequestInterval.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveUsersRequestInterval { + public static final RetrieveUsersRequestInterval MONTH = new RetrieveUsersRequestInterval(Value.MONTH, "month"); + + public static final RetrieveUsersRequestInterval HOUR = new RetrieveUsersRequestInterval(Value.HOUR, "hour"); + + public static final RetrieveUsersRequestInterval DAY = new RetrieveUsersRequestInterval(Value.DAY, "day"); + + public static final RetrieveUsersRequestInterval WEEK = new RetrieveUsersRequestInterval(Value.WEEK, "week"); + + private final Value value; + + private final String string; + + RetrieveUsersRequestInterval(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveUsersRequestInterval + && this.string.equals(((RetrieveUsersRequestInterval) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MONTH: + return visitor.visitMonth(); + case HOUR: + return visitor.visitHour(); + case DAY: + return visitor.visitDay(); + case WEEK: + return visitor.visitWeek(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveUsersRequestInterval valueOf(String value) { + switch (value) { + case "month": + return MONTH; + case "hour": + return HOUR; + case "day": + return DAY; + case "week": + return WEEK; + default: + return new RetrieveUsersRequestInterval(Value.UNKNOWN, value); + } + } + + public enum Value { + HOUR, + + DAY, + + WEEK, + + MONTH, + + UNKNOWN + } + + public interface Visitor { + T visitHour(); + + T visitDay(); + + T visitWeek(); + + T visitMonth(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/users/types/UpdateMeUsersRequestBanner.java b/src/main/java/com/whop/api/resources/users/types/UpdateMeUsersRequestBanner.java new file mode 100644 index 00000000..666bd800 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/types/UpdateMeUsersRequestBanner.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateMeUsersRequestBanner.Builder.class) +public final class UpdateMeUsersRequestBanner { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private UpdateMeUsersRequestBanner( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateMeUsersRequestBanner && equalTo((UpdateMeUsersRequestBanner) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateMeUsersRequestBanner other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateMeUsersRequestBanner other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdateMeUsersRequestBanner build() { + return new UpdateMeUsersRequestBanner(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/types/UpdateMeUsersRequestProfilePicture.java b/src/main/java/com/whop/api/resources/users/types/UpdateMeUsersRequestProfilePicture.java new file mode 100644 index 00000000..3d4db2ce --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/types/UpdateMeUsersRequestProfilePicture.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateMeUsersRequestProfilePicture.Builder.class) +public final class UpdateMeUsersRequestProfilePicture { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private UpdateMeUsersRequestProfilePicture( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateMeUsersRequestProfilePicture + && equalTo((UpdateMeUsersRequestProfilePicture) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateMeUsersRequestProfilePicture other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateMeUsersRequestProfilePicture other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdateMeUsersRequestProfilePicture build() { + return new UpdateMeUsersRequestProfilePicture(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/types/UpdateUsersRequestBanner.java b/src/main/java/com/whop/api/resources/users/types/UpdateUsersRequestBanner.java new file mode 100644 index 00000000..a2d46b59 --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/types/UpdateUsersRequestBanner.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateUsersRequestBanner.Builder.class) +public final class UpdateUsersRequestBanner { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private UpdateUsersRequestBanner( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateUsersRequestBanner && equalTo((UpdateUsersRequestBanner) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateUsersRequestBanner other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateUsersRequestBanner other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdateUsersRequestBanner build() { + return new UpdateUsersRequestBanner(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/users/types/UpdateUsersRequestProfilePicture.java b/src/main/java/com/whop/api/resources/users/types/UpdateUsersRequestProfilePicture.java new file mode 100644 index 00000000..02432e9c --- /dev/null +++ b/src/main/java/com/whop/api/resources/users/types/UpdateUsersRequestProfilePicture.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.users.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateUsersRequestProfilePicture.Builder.class) +public final class UpdateUsersRequestProfilePicture { + private final Optional directUploadId; + + private final Optional id; + + private final Map additionalProperties; + + private UpdateUsersRequestProfilePicture( + Optional directUploadId, Optional id, Map additionalProperties) { + this.directUploadId = directUploadId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("direct_upload_id") + public Optional getDirectUploadId() { + return directUploadId; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateUsersRequestProfilePicture && equalTo((UpdateUsersRequestProfilePicture) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateUsersRequestProfilePicture other) { + return directUploadId.equals(other.directUploadId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.directUploadId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional directUploadId = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateUsersRequestProfilePicture other) { + directUploadId(other.getDirectUploadId()); + id(other.getId()); + return this; + } + + @JsonSetter(value = "direct_upload_id", nulls = Nulls.SKIP) + public Builder directUploadId(Optional directUploadId) { + this.directUploadId = directUploadId; + return this; + } + + public Builder directUploadId(String directUploadId) { + this.directUploadId = Optional.ofNullable(directUploadId); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public UpdateUsersRequestProfilePicture build() { + return new UpdateUsersRequestProfilePicture(directUploadId, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/AsyncRawVerificationsClient.java b/src/main/java/com/whop/api/resources/verifications/AsyncRawVerificationsClient.java new file mode 100644 index 00000000..4a2de443 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/AsyncRawVerificationsClient.java @@ -0,0 +1,428 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.verifications.requests.CreateVerificationsRequest; +import com.whop.api.resources.verifications.requests.ListVerificationsRequest; +import com.whop.api.resources.verifications.requests.RetrieveVerificationsRequest; +import com.whop.api.resources.verifications.requests.UpdateVerificationsRequest; +import com.whop.api.resources.verifications.types.CreateVerificationsResponse; +import com.whop.api.resources.verifications.types.ListVerificationsResponse; +import com.whop.api.resources.verifications.types.RetrieveVerificationsResponse; +import com.whop.api.resources.verifications.types.UpdateVerificationsResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawVerificationsClient { + protected final ClientOptions clientOptions; + + public AsyncRawVerificationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public CompletableFuture> list(ListVerificationsRequest request) { + return list(request, null); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public CompletableFuture> list( + ListVerificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("verifications"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListVerificationsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Starts a hosted verification session for an account or user, or returns the active session when one already exists. Any fields you include in the request body are used to prefill the session. Send documents (with document_type) to instead verify the person from identity documents included in this request — no hosted session involved. Send share_token to reuse a verification another Sumsub account has already completed for this person, instead of verifying them again. If the account already has an approved verification the request is rejected; unlink it first to start a new one. + */ + public CompletableFuture> create( + CreateVerificationsRequest request) { + return create(request, null); + } + + /** + * Starts a hosted verification session for an account or user, or returns the active session when one already exists. Any fields you include in the request body are used to prefill the session. Send documents (with document_type) to instead verify the person from identity documents included in this request — no hosted session involved. Send share_token to reuse a verification another Sumsub account has already completed for this person, instead of verifying them again. If the account already has an approved verification the request is rejected; unlink it first to start a new one. + */ + public CompletableFuture> create( + CreateVerificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("verifications"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CreateVerificationsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveVerificationsRequest.builder().build()); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveVerificationsRequest.builder().build(), requestOptions); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public CompletableFuture> retrieve( + String id, RetrieveVerificationsRequest request) { + return retrieve(id, request, null); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public CompletableFuture> retrieve( + String id, RetrieveVerificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("verifications") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, RetrieveVerificationsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates editable profile details or submits answers for items returned in requested_information. Once a verification is approved its profile details are locked and can no longer be edited. + */ + public CompletableFuture> update( + String id, UpdateVerificationsRequest request) { + return update(id, request, null); + } + + /** + * Updates editable profile details or submits answers for items returned in requested_information. Once a verification is approved its profile details are locked and can no longer be edited. + */ + public CompletableFuture> update( + String id, UpdateVerificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("verifications") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpdateVerificationsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/AsyncVerificationsClient.java b/src/main/java/com/whop/api/resources/verifications/AsyncVerificationsClient.java new file mode 100644 index 00000000..3758848a --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/AsyncVerificationsClient.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.verifications.requests.CreateVerificationsRequest; +import com.whop.api.resources.verifications.requests.ListVerificationsRequest; +import com.whop.api.resources.verifications.requests.RetrieveVerificationsRequest; +import com.whop.api.resources.verifications.requests.UpdateVerificationsRequest; +import com.whop.api.resources.verifications.types.CreateVerificationsResponse; +import com.whop.api.resources.verifications.types.ListVerificationsResponse; +import com.whop.api.resources.verifications.types.RetrieveVerificationsResponse; +import com.whop.api.resources.verifications.types.UpdateVerificationsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncVerificationsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawVerificationsClient rawClient; + + public AsyncVerificationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawVerificationsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawVerificationsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public CompletableFuture list(ListVerificationsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public CompletableFuture list( + ListVerificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Starts a hosted verification session for an account or user, or returns the active session when one already exists. Any fields you include in the request body are used to prefill the session. Send documents (with document_type) to instead verify the person from identity documents included in this request — no hosted session involved. Send share_token to reuse a verification another Sumsub account has already completed for this person, instead of verifying them again. If the account already has an approved verification the request is rejected; unlink it first to start a new one. + */ + public CompletableFuture create(CreateVerificationsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Starts a hosted verification session for an account or user, or returns the active session when one already exists. Any fields you include in the request body are used to prefill the session. Send documents (with document_type) to instead verify the person from identity documents included in this request — no hosted session involved. Send share_token to reuse a verification another Sumsub account has already completed for this person, instead of verifying them again. If the account already has an approved verification the request is rejected; unlink it first to start a new one. + */ + public CompletableFuture create( + CreateVerificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public CompletableFuture retrieve(String id, RetrieveVerificationsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public CompletableFuture retrieve( + String id, RetrieveVerificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates editable profile details or submits answers for items returned in requested_information. Once a verification is approved its profile details are locked and can no longer be edited. + */ + public CompletableFuture update(String id, UpdateVerificationsRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Updates editable profile details or submits answers for items returned in requested_information. Once a verification is approved its profile details are locked and can no longer be edited. + */ + public CompletableFuture update( + String id, UpdateVerificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/RawVerificationsClient.java b/src/main/java/com/whop/api/resources/verifications/RawVerificationsClient.java new file mode 100644 index 00000000..c7f4ce11 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/RawVerificationsClient.java @@ -0,0 +1,338 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.resources.verifications.requests.CreateVerificationsRequest; +import com.whop.api.resources.verifications.requests.ListVerificationsRequest; +import com.whop.api.resources.verifications.requests.RetrieveVerificationsRequest; +import com.whop.api.resources.verifications.requests.UpdateVerificationsRequest; +import com.whop.api.resources.verifications.types.CreateVerificationsResponse; +import com.whop.api.resources.verifications.types.ListVerificationsResponse; +import com.whop.api.resources.verifications.types.RetrieveVerificationsResponse; +import com.whop.api.resources.verifications.types.UpdateVerificationsResponse; +import com.whop.api.types.V1ErrorResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawVerificationsClient { + protected final ClientOptions clientOptions; + + public RawVerificationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public WhopApiHttpResponse list(ListVerificationsRequest request) { + return list(request, null); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public WhopApiHttpResponse list( + ListVerificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("verifications"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListVerificationsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Starts a hosted verification session for an account or user, or returns the active session when one already exists. Any fields you include in the request body are used to prefill the session. Send documents (with document_type) to instead verify the person from identity documents included in this request — no hosted session involved. Send share_token to reuse a verification another Sumsub account has already completed for this person, instead of verifying them again. If the account already has an approved verification the request is rejected; unlink it first to start a new one. + */ + public WhopApiHttpResponse create(CreateVerificationsRequest request) { + return create(request, null); + } + + /** + * Starts a hosted verification session for an account or user, or returns the active session when one already exists. Any fields you include in the request body are used to prefill the session. Send documents (with document_type) to instead verify the person from identity documents included in this request — no hosted session involved. Send share_token to reuse a verification another Sumsub account has already completed for this person, instead of verifying them again. If the account already has an approved verification the request is rejected; unlink it first to start a new one. + */ + public WhopApiHttpResponse create( + CreateVerificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("verifications"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateVerificationsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveVerificationsRequest.builder().build()); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveVerificationsRequest.builder().build(), requestOptions); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveVerificationsRequest request) { + return retrieve(id, request, null); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveVerificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("verifications") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, RetrieveVerificationsResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates editable profile details or submits answers for items returned in requested_information. Once a verification is approved its profile details are locked and can no longer be edited. + */ + public WhopApiHttpResponse update(String id, UpdateVerificationsRequest request) { + return update(id, request, null); + } + + /** + * Updates editable profile details or submits answers for items returned in requested_information. Once a verification is approved its profile details are locked and can no longer be edited. + */ + public WhopApiHttpResponse update( + String id, UpdateVerificationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("verifications") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateVerificationsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/VerificationsClient.java b/src/main/java/com/whop/api/resources/verifications/VerificationsClient.java new file mode 100644 index 00000000..75507ad4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/VerificationsClient.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.resources.verifications.requests.CreateVerificationsRequest; +import com.whop.api.resources.verifications.requests.ListVerificationsRequest; +import com.whop.api.resources.verifications.requests.RetrieveVerificationsRequest; +import com.whop.api.resources.verifications.requests.UpdateVerificationsRequest; +import com.whop.api.resources.verifications.types.CreateVerificationsResponse; +import com.whop.api.resources.verifications.types.ListVerificationsResponse; +import com.whop.api.resources.verifications.types.RetrieveVerificationsResponse; +import com.whop.api.resources.verifications.types.UpdateVerificationsResponse; + +public class VerificationsClient { + protected final ClientOptions clientOptions; + + private final RawVerificationsClient rawClient; + + public VerificationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawVerificationsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawVerificationsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public ListVerificationsResponse list(ListVerificationsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public ListVerificationsResponse list(ListVerificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Starts a hosted verification session for an account or user, or returns the active session when one already exists. Any fields you include in the request body are used to prefill the session. Send documents (with document_type) to instead verify the person from identity documents included in this request — no hosted session involved. Send share_token to reuse a verification another Sumsub account has already completed for this person, instead of verifying them again. If the account already has an approved verification the request is rejected; unlink it first to start a new one. + */ + public CreateVerificationsResponse create(CreateVerificationsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Starts a hosted verification session for an account or user, or returns the active session when one already exists. Any fields you include in the request body are used to prefill the session. Send documents (with document_type) to instead verify the person from identity documents included in this request — no hosted session involved. Send share_token to reuse a verification another Sumsub account has already completed for this person, instead of verifying them again. If the account already has an approved verification the request is rejected; unlink it first to start a new one. + */ + public CreateVerificationsResponse create(CreateVerificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public RetrieveVerificationsResponse retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public RetrieveVerificationsResponse retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public RetrieveVerificationsResponse retrieve(String id, RetrieveVerificationsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Returns verifications for an account, including their status and any required actions. + */ + public RetrieveVerificationsResponse retrieve( + String id, RetrieveVerificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Updates editable profile details or submits answers for items returned in requested_information. Once a verification is approved its profile details are locked and can no longer be edited. + */ + public UpdateVerificationsResponse update(String id, UpdateVerificationsRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Updates editable profile details or submits answers for items returned in requested_information. Once a verification is approved its profile details are locked and can no longer be edited. + */ + public UpdateVerificationsResponse update( + String id, UpdateVerificationsRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/requests/CreateVerificationsRequest.java b/src/main/java/com/whop/api/resources/verifications/requests/CreateVerificationsRequest.java new file mode 100644 index 00000000..1e178837 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/requests/CreateVerificationsRequest.java @@ -0,0 +1,153 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.verifications.types.CreateVerificationsRequestBody; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVerificationsRequest.Builder.class) +public final class CreateVerificationsRequest { + private final String accountId; + + private final CreateVerificationsRequestBody body; + + private final Map additionalProperties; + + private CreateVerificationsRequest( + String accountId, CreateVerificationsRequestBody body, Map additionalProperties) { + this.accountId = accountId; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account or user ID whose identity you want to verify. Use a biz_ account ID for account verifications, or the caller's user_ ID for personal verification. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("body") + public CreateVerificationsRequestBody getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVerificationsRequest && equalTo((CreateVerificationsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVerificationsRequest other) { + return accountId.equals(other.accountId) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Account or user ID whose identity you want to verify. Use a biz_ account ID for account verifications, or the caller's user_ ID for personal verification.

+ */ + BodyStage accountId(@NotNull String accountId); + + Builder from(CreateVerificationsRequest other); + } + + public interface BodyStage { + _FinalStage body(@NotNull CreateVerificationsRequestBody body); + } + + public interface _FinalStage { + CreateVerificationsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, BodyStage, _FinalStage { + private String accountId; + + private CreateVerificationsRequestBody body; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateVerificationsRequest other) { + accountId(other.getAccountId()); + body(other.getBody()); + return this; + } + + /** + *

Account or user ID whose identity you want to verify. Use a biz_ account ID for account verifications, or the caller's user_ ID for personal verification.

+ *

Account or user ID whose identity you want to verify. Use a biz_ account ID for account verifications, or the caller's user_ ID for personal verification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public BodyStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull CreateVerificationsRequestBody body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public CreateVerificationsRequest build() { + return new CreateVerificationsRequest(accountId, body, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/requests/ListVerificationsRequest.java b/src/main/java/com/whop/api/resources/verifications/requests/ListVerificationsRequest.java new file mode 100644 index 00000000..8c12daf7 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/requests/ListVerificationsRequest.java @@ -0,0 +1,219 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.verifications.types.ListVerificationsRequestDirection; +import com.whop.api.resources.verifications.types.ListVerificationsRequestOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListVerificationsRequest.Builder.class) +public final class ListVerificationsRequest { + private final String accountId; + + private final Optional order; + + private final Optional direction; + + private final Map additionalProperties; + + private ListVerificationsRequest( + String accountId, + Optional order, + Optional direction, + Map additionalProperties) { + this.accountId = accountId; + this.order = order; + this.direction = direction; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account or user ID whose verifications you want to list. Use a biz_ account ID, or the caller's user_ ID for personal verifications. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Field used to sort returned verifications. + */ + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + /** + * @return Sort direction for returned verifications. + */ + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListVerificationsRequest && equalTo((ListVerificationsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListVerificationsRequest other) { + return accountId.equals(other.accountId) && order.equals(other.order) && direction.equals(other.direction); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.order, this.direction); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Account or user ID whose verifications you want to list. Use a biz_ account ID, or the caller's user_ ID for personal verifications.

+ */ + _FinalStage accountId(@NotNull String accountId); + + Builder from(ListVerificationsRequest other); + } + + public interface _FinalStage { + ListVerificationsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Field used to sort returned verifications.

+ */ + _FinalStage order(Optional order); + + _FinalStage order(ListVerificationsRequestOrder order); + + /** + *

Sort direction for returned verifications.

+ */ + _FinalStage direction(Optional direction); + + _FinalStage direction(ListVerificationsRequestDirection direction); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, _FinalStage { + private String accountId; + + private Optional direction = Optional.empty(); + + private Optional order = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListVerificationsRequest other) { + accountId(other.getAccountId()); + order(other.getOrder()); + direction(other.getDirection()); + return this; + } + + /** + *

Account or user ID whose verifications you want to list. Use a biz_ account ID, or the caller's user_ ID for personal verifications.

+ *

Account or user ID whose verifications you want to list. Use a biz_ account ID, or the caller's user_ ID for personal verifications.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

Sort direction for returned verifications.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage direction(ListVerificationsRequestDirection direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + /** + *

Sort direction for returned verifications.

+ */ + @java.lang.Override + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public _FinalStage direction(Optional direction) { + this.direction = direction; + return this; + } + + /** + *

Field used to sort returned verifications.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(ListVerificationsRequestOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

Field used to sort returned verifications.

+ */ + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + @java.lang.Override + public ListVerificationsRequest build() { + return new ListVerificationsRequest(accountId, order, direction, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/requests/RetrieveVerificationsRequest.java b/src/main/java/com/whop/api/resources/verifications/requests/RetrieveVerificationsRequest.java new file mode 100644 index 00000000..e989b99e --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/requests/RetrieveVerificationsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveVerificationsRequest.Builder.class) +public final class RetrieveVerificationsRequest { + private final Map additionalProperties; + + private RetrieveVerificationsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveVerificationsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveVerificationsRequest other) { + return this; + } + + public RetrieveVerificationsRequest build() { + return new RetrieveVerificationsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/requests/UpdateVerificationsRequest.java b/src/main/java/com/whop/api/resources/verifications/requests/UpdateVerificationsRequest.java new file mode 100644 index 00000000..d2e01ad5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/requests/UpdateVerificationsRequest.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.verifications.types.UpdateVerificationsRequestBody; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsRequest.Builder.class) +public final class UpdateVerificationsRequest { + private final UpdateVerificationsRequestBody body; + + private final Map additionalProperties; + + private UpdateVerificationsRequest(UpdateVerificationsRequestBody body, Map additionalProperties) { + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("body") + public UpdateVerificationsRequestBody getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsRequest && equalTo((UpdateVerificationsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsRequest other) { + return body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull UpdateVerificationsRequestBody body); + + Builder from(UpdateVerificationsRequest other); + } + + public interface _FinalStage { + UpdateVerificationsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private UpdateVerificationsRequestBody body; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateVerificationsRequest other) { + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull UpdateVerificationsRequestBody body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public UpdateVerificationsRequest build() { + return new UpdateVerificationsRequest(body, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBody.java b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBody.java new file mode 100644 index 00000000..3e6088c6 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBody.java @@ -0,0 +1,222 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateVerificationsRequestBody { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateVerificationsRequestBody(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateVerificationsRequestBody individual(CreateVerificationsRequestBodyIndividual value) { + return new CreateVerificationsRequestBody(new IndividualValue(value)); + } + + public static CreateVerificationsRequestBody business(CreateVerificationsRequestBodyBusiness value) { + return new CreateVerificationsRequestBody(new BusinessValue(value)); + } + + public boolean isIndividual() { + return value instanceof IndividualValue; + } + + public boolean isBusiness() { + return value instanceof BusinessValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getIndividual() { + if (isIndividual()) { + return Optional.of(((IndividualValue) value).value); + } + return Optional.empty(); + } + + public Optional getBusiness() { + if (isBusiness()) { + return Optional.of(((BusinessValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVerificationsRequestBody + && value.equals(((CreateVerificationsRequestBody) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitIndividual(CreateVerificationsRequestBodyIndividual individual); + + T visitBusiness(CreateVerificationsRequestBodyBusiness business); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "kind", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(IndividualValue.class), @JsonSubTypes.Type(BusinessValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("individual") + @JsonIgnoreProperties("kind") + private static final class IndividualValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "kind", allowSetters = true) + private CreateVerificationsRequestBodyIndividual value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private IndividualValue() {} + + private IndividualValue(CreateVerificationsRequestBodyIndividual value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitIndividual(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IndividualValue && equalTo((IndividualValue) other); + } + + private boolean equalTo(IndividualValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateVerificationsRequestBody{" + "value: " + value + "}"; + } + } + + @JsonTypeName("business") + @JsonIgnoreProperties("kind") + private static final class BusinessValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "kind", allowSetters = true) + private CreateVerificationsRequestBodyBusiness value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BusinessValue() {} + + private BusinessValue(CreateVerificationsRequestBodyBusiness value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBusiness(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BusinessValue && equalTo((BusinessValue) other); + } + + private boolean equalTo(BusinessValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateVerificationsRequestBody{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("kind") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateVerificationsRequestBody{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyBusiness.java b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyBusiness.java new file mode 100644 index 00000000..67277258 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyBusiness.java @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVerificationsRequestBodyBusiness.Builder.class) +public final class CreateVerificationsRequestBodyBusiness { + private final Optional address; + + private final Optional businessName; + + private final Optional businessStructure; + + private final Optional businessTaxIdentificationNumber; + + private final Optional businessWebsite; + + private final Optional country; + + private final Optional dateOfBirth; + + private final Optional firstName; + + private final Optional lastName; + + private final Optional placeOfIncorporation; + + private final Optional shareToken; + + private final Optional taxIdentificationNumber; + + private final Map additionalProperties; + + private CreateVerificationsRequestBodyBusiness( + Optional address, + Optional businessName, + Optional businessStructure, + Optional businessTaxIdentificationNumber, + Optional businessWebsite, + Optional country, + Optional dateOfBirth, + Optional firstName, + Optional lastName, + Optional placeOfIncorporation, + Optional shareToken, + Optional taxIdentificationNumber, + Map additionalProperties) { + this.address = address; + this.businessName = businessName; + this.businessStructure = businessStructure; + this.businessTaxIdentificationNumber = businessTaxIdentificationNumber; + this.businessWebsite = businessWebsite; + this.country = country; + this.dateOfBirth = dateOfBirth; + this.firstName = firstName; + this.lastName = lastName; + this.placeOfIncorporation = placeOfIncorporation; + this.shareToken = shareToken; + this.taxIdentificationNumber = taxIdentificationNumber; + this.additionalProperties = additionalProperties; + } + + /** + * @return Every value accepts null, so a form seeded from a previous response can round-trip unset fields unchanged. + */ + @JsonProperty("address") + public Optional getAddress() { + return address; + } + + /** + * @return Legal business name. + */ + @JsonProperty("business_name") + public Optional getBusinessName() { + return businessName; + } + + /** + * @return Legal entity structure of the business, such as private_corporation or sole_proprietorship. Supported values vary by country of incorporation — see Business structures. + */ + @JsonProperty("business_structure") + public Optional getBusinessStructure() { + return businessStructure; + } + + /** + * @return The business ID number of the company, as appropriate for the company's country. Examples are an Employer Identification Number (EIN) in the US, a Business Number in Canada, or a Company Number in the UK. + */ + @JsonProperty("business_tax_identification_number") + public Optional getBusinessTaxIdentificationNumber() { + return businessTaxIdentificationNumber; + } + + /** + * @return Business website URL. Whop store pages are not accepted. + */ + @JsonProperty("business_website") + public Optional getBusinessWebsite() { + return businessWebsite; + } + + /** + * @return Country of incorporation as a two-letter ISO 3166-1 country code. + */ + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + /** + * @return Business representative's date of birth, formatted as YYYY-MM-DD. + */ + @JsonProperty("date_of_birth") + public Optional getDateOfBirth() { + return dateOfBirth; + } + + /** + * @return First name of the business representative, used to prefill the verification session. + */ + @JsonProperty("first_name") + public Optional getFirstName() { + return firstName; + } + + /** + * @return Last name of the business representative, used to prefill the verification session. + */ + @JsonProperty("last_name") + public Optional getLastName() { + return lastName; + } + + /** + * @return State or region where the business is incorporated. + */ + @JsonProperty("place_of_incorporation") + public Optional getPlaceOfIncorporation() { + return placeOfIncorporation; + } + + /** + * @return Sumsub share token for a person a partner has already verified, generated by their Sumsub account for Whop's client ID. Reuses that verification instead of collecting anything: Whop imports the shared identity, rechecks it against its own requirements, and returns approved when it satisfies them, or pending with a session_url covering only what is still missing. Requires a Reusable KYC agreement between the partner's Sumsub account and Whop's. Each token works once, and cannot be combined with documents or document_type. + */ + @JsonProperty("share_token") + public Optional getShareToken() { + return shareToken; + } + + /** + * @return The government-issued ID number of the person being verified — the individual for a KYC verification, or the business representative for a KYB verification — as appropriate for their country. Examples are a Social Security Number (SSN) in the US, or a Social Insurance Number in Canada. + */ + @JsonProperty("tax_identification_number") + public Optional getTaxIdentificationNumber() { + return taxIdentificationNumber; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVerificationsRequestBodyBusiness + && equalTo((CreateVerificationsRequestBodyBusiness) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVerificationsRequestBodyBusiness other) { + return address.equals(other.address) + && businessName.equals(other.businessName) + && businessStructure.equals(other.businessStructure) + && businessTaxIdentificationNumber.equals(other.businessTaxIdentificationNumber) + && businessWebsite.equals(other.businessWebsite) + && country.equals(other.country) + && dateOfBirth.equals(other.dateOfBirth) + && firstName.equals(other.firstName) + && lastName.equals(other.lastName) + && placeOfIncorporation.equals(other.placeOfIncorporation) + && shareToken.equals(other.shareToken) + && taxIdentificationNumber.equals(other.taxIdentificationNumber); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.address, + this.businessName, + this.businessStructure, + this.businessTaxIdentificationNumber, + this.businessWebsite, + this.country, + this.dateOfBirth, + this.firstName, + this.lastName, + this.placeOfIncorporation, + this.shareToken, + this.taxIdentificationNumber); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional address = Optional.empty(); + + private Optional businessName = Optional.empty(); + + private Optional businessStructure = Optional.empty(); + + private Optional businessTaxIdentificationNumber = Optional.empty(); + + private Optional businessWebsite = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional dateOfBirth = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional lastName = Optional.empty(); + + private Optional placeOfIncorporation = Optional.empty(); + + private Optional shareToken = Optional.empty(); + + private Optional taxIdentificationNumber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateVerificationsRequestBodyBusiness other) { + address(other.getAddress()); + businessName(other.getBusinessName()); + businessStructure(other.getBusinessStructure()); + businessTaxIdentificationNumber(other.getBusinessTaxIdentificationNumber()); + businessWebsite(other.getBusinessWebsite()); + country(other.getCountry()); + dateOfBirth(other.getDateOfBirth()); + firstName(other.getFirstName()); + lastName(other.getLastName()); + placeOfIncorporation(other.getPlaceOfIncorporation()); + shareToken(other.getShareToken()); + taxIdentificationNumber(other.getTaxIdentificationNumber()); + return this; + } + + /** + *

Every value accepts null, so a form seeded from a previous response can round-trip unset fields unchanged.

+ */ + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public Builder address(Optional address) { + this.address = address; + return this; + } + + public Builder address(CreateVerificationsRequestBodyBusinessAddress address) { + this.address = Optional.ofNullable(address); + return this; + } + + /** + *

Legal business name.

+ */ + @JsonSetter(value = "business_name", nulls = Nulls.SKIP) + public Builder businessName(Optional businessName) { + this.businessName = businessName; + return this; + } + + public Builder businessName(String businessName) { + this.businessName = Optional.ofNullable(businessName); + return this; + } + + /** + *

Legal entity structure of the business, such as private_corporation or sole_proprietorship. Supported values vary by country of incorporation — see Business structures.

+ */ + @JsonSetter(value = "business_structure", nulls = Nulls.SKIP) + public Builder businessStructure(Optional businessStructure) { + this.businessStructure = businessStructure; + return this; + } + + public Builder businessStructure(String businessStructure) { + this.businessStructure = Optional.ofNullable(businessStructure); + return this; + } + + /** + *

The business ID number of the company, as appropriate for the company's country. Examples are an Employer Identification Number (EIN) in the US, a Business Number in Canada, or a Company Number in the UK.

+ */ + @JsonSetter(value = "business_tax_identification_number", nulls = Nulls.SKIP) + public Builder businessTaxIdentificationNumber(Optional businessTaxIdentificationNumber) { + this.businessTaxIdentificationNumber = businessTaxIdentificationNumber; + return this; + } + + public Builder businessTaxIdentificationNumber(String businessTaxIdentificationNumber) { + this.businessTaxIdentificationNumber = Optional.ofNullable(businessTaxIdentificationNumber); + return this; + } + + /** + *

Business website URL. Whop store pages are not accepted.

+ */ + @JsonSetter(value = "business_website", nulls = Nulls.SKIP) + public Builder businessWebsite(Optional businessWebsite) { + this.businessWebsite = businessWebsite; + return this; + } + + public Builder businessWebsite(String businessWebsite) { + this.businessWebsite = Optional.ofNullable(businessWebsite); + return this; + } + + /** + *

Country of incorporation as a two-letter ISO 3166-1 country code.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

Business representative's date of birth, formatted as YYYY-MM-DD.

+ */ + @JsonSetter(value = "date_of_birth", nulls = Nulls.SKIP) + public Builder dateOfBirth(Optional dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + public Builder dateOfBirth(String dateOfBirth) { + this.dateOfBirth = Optional.ofNullable(dateOfBirth); + return this; + } + + /** + *

First name of the business representative, used to prefill the verification session.

+ */ + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public Builder firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + /** + *

Last name of the business representative, used to prefill the verification session.

+ */ + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public Builder lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + /** + *

State or region where the business is incorporated.

+ */ + @JsonSetter(value = "place_of_incorporation", nulls = Nulls.SKIP) + public Builder placeOfIncorporation(Optional placeOfIncorporation) { + this.placeOfIncorporation = placeOfIncorporation; + return this; + } + + public Builder placeOfIncorporation(String placeOfIncorporation) { + this.placeOfIncorporation = Optional.ofNullable(placeOfIncorporation); + return this; + } + + /** + *

Sumsub share token for a person a partner has already verified, generated by their Sumsub account for Whop's client ID. Reuses that verification instead of collecting anything: Whop imports the shared identity, rechecks it against its own requirements, and returns approved when it satisfies them, or pending with a session_url covering only what is still missing. Requires a Reusable KYC agreement between the partner's Sumsub account and Whop's. Each token works once, and cannot be combined with documents or document_type.

+ */ + @JsonSetter(value = "share_token", nulls = Nulls.SKIP) + public Builder shareToken(Optional shareToken) { + this.shareToken = shareToken; + return this; + } + + public Builder shareToken(String shareToken) { + this.shareToken = Optional.ofNullable(shareToken); + return this; + } + + /** + *

The government-issued ID number of the person being verified — the individual for a KYC verification, or the business representative for a KYB verification — as appropriate for their country. Examples are a Social Security Number (SSN) in the US, or a Social Insurance Number in Canada.

+ */ + @JsonSetter(value = "tax_identification_number", nulls = Nulls.SKIP) + public Builder taxIdentificationNumber(Optional taxIdentificationNumber) { + this.taxIdentificationNumber = taxIdentificationNumber; + return this; + } + + public Builder taxIdentificationNumber(String taxIdentificationNumber) { + this.taxIdentificationNumber = Optional.ofNullable(taxIdentificationNumber); + return this; + } + + public CreateVerificationsRequestBodyBusiness build() { + return new CreateVerificationsRequestBodyBusiness( + address, + businessName, + businessStructure, + businessTaxIdentificationNumber, + businessWebsite, + country, + dateOfBirth, + firstName, + lastName, + placeOfIncorporation, + shareToken, + taxIdentificationNumber, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyBusinessAddress.java b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyBusinessAddress.java new file mode 100644 index 00000000..868a06b5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyBusinessAddress.java @@ -0,0 +1,382 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVerificationsRequestBodyBusinessAddress.Builder.class) +public final class CreateVerificationsRequestBodyBusinessAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private CreateVerificationsRequestBodyBusinessAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return First line of the street address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return Second line of the street address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Postal or ZIP code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return State, province, or region code, for example CA. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVerificationsRequestBodyBusinessAddress + && equalTo((CreateVerificationsRequestBodyBusinessAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVerificationsRequestBodyBusinessAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateVerificationsRequestBodyBusinessAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

First line of the street address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

Second line of the street address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Postal or ZIP code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

State, province, or region code, for example CA.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public CreateVerificationsRequestBodyBusinessAddress build() { + return new CreateVerificationsRequestBodyBusinessAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyIndividual.java b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyIndividual.java new file mode 100644 index 00000000..98855f68 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyIndividual.java @@ -0,0 +1,515 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVerificationsRequestBodyIndividual.Builder.class) +public final class CreateVerificationsRequestBodyIndividual { + private final Optional address; + + private final Optional businessName; + + private final Optional businessStructure; + + private final Optional businessTaxIdentificationNumber; + + private final Optional businessWebsite; + + private final Optional country; + + private final Optional dateOfBirth; + + private final Optional documentType; + + private final Optional documents; + + private final Optional firstName; + + private final Optional lastName; + + private final Optional phone; + + private final Optional shareToken; + + private final Optional taxIdentificationNumber; + + private final Map additionalProperties; + + private CreateVerificationsRequestBodyIndividual( + Optional address, + Optional businessName, + Optional businessStructure, + Optional businessTaxIdentificationNumber, + Optional businessWebsite, + Optional country, + Optional dateOfBirth, + Optional documentType, + Optional documents, + Optional firstName, + Optional lastName, + Optional phone, + Optional shareToken, + Optional taxIdentificationNumber, + Map additionalProperties) { + this.address = address; + this.businessName = businessName; + this.businessStructure = businessStructure; + this.businessTaxIdentificationNumber = businessTaxIdentificationNumber; + this.businessWebsite = businessWebsite; + this.country = country; + this.dateOfBirth = dateOfBirth; + this.documentType = documentType; + this.documents = documents; + this.firstName = firstName; + this.lastName = lastName; + this.phone = phone; + this.shareToken = shareToken; + this.taxIdentificationNumber = taxIdentificationNumber; + this.additionalProperties = additionalProperties; + } + + /** + * @return Every value accepts null, so a form seeded from a previous response can round-trip unset fields unchanged. + */ + @JsonProperty("address") + public Optional getAddress() { + return address; + } + + /** + * @return Legal business name for a sole proprietor or single-member LLC. + */ + @JsonProperty("business_name") + public Optional getBusinessName() { + return businessName; + } + + /** + * @return Entity type for sole proprietors, such as single_member_llc. Supported values vary by country of incorporation — see Business structures. + */ + @JsonProperty("business_structure") + public Optional getBusinessStructure() { + return businessStructure; + } + + /** + * @return The business ID number of the company, as appropriate for the company's country. Examples are an Employer Identification Number (EIN) in the US, a Business Number in Canada, or a Company Number in the UK. + */ + @JsonProperty("business_tax_identification_number") + public Optional getBusinessTaxIdentificationNumber() { + return businessTaxIdentificationNumber; + } + + /** + * @return Business website URL. Whop store pages are not accepted. + */ + @JsonProperty("business_website") + public Optional getBusinessWebsite() { + return businessWebsite; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + /** + * @return Formatted as YYYY-MM-DD. + */ + @JsonProperty("date_of_birth") + public Optional getDateOfBirth() { + return dateOfBirth; + } + + /** + * @return Identity document being sent, when verifying with documents. Decides exactly which file slots to send: ID_CARDid_card_front + id_card_back + selfie; DRIVERSdrivers_front + drivers_back + selfie; RESIDENCE_PERMITresidence_permit_front + residence_permit_back + selfie; PASSPORTpassport_front + selfie. See Identity documents. + */ + @JsonProperty("document_type") + public Optional getDocumentType() { + return documentType; + } + + /** + * @return Identity document files, each value the file's raw bytes base64-encoded (JPEG, PNG, or PDF, up to 5MB per file before encoding). Sending this object verifies the person from the files in this request instead of a hosted session — individual verifications only, and the request must also carry document_type, first_name, last_name, date_of_birth, country, phone, tax_identification_number, and an address with line1, city, state, and postal_code. Send every slot for your document_type — a missing or rejected file fails the whole request and nothing is submitted; review starts automatically once every document is accepted. See Identity documents for a full walkthrough. + */ + @JsonProperty("documents") + public Optional getDocuments() { + return documents; + } + + @JsonProperty("first_name") + public Optional getFirstName() { + return firstName; + } + + @JsonProperty("last_name") + public Optional getLastName() { + return lastName; + } + + @JsonProperty("phone") + public Optional getPhone() { + return phone; + } + + /** + * @return Sumsub share token for a person a partner has already verified, generated by their Sumsub account for Whop's client ID. Reuses that verification instead of collecting anything: Whop imports the shared identity, rechecks it against its own requirements, and returns approved when it satisfies them, or pending with a session_url covering only what is still missing. Requires a Reusable KYC agreement between the partner's Sumsub account and Whop's. Each token works once, and cannot be combined with documents or document_type. + */ + @JsonProperty("share_token") + public Optional getShareToken() { + return shareToken; + } + + /** + * @return The government-issued ID number of the person being verified — the individual for a KYC verification, or the business representative for a KYB verification — as appropriate for their country. Examples are a Social Security Number (SSN) in the US, or a Social Insurance Number in Canada. + */ + @JsonProperty("tax_identification_number") + public Optional getTaxIdentificationNumber() { + return taxIdentificationNumber; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVerificationsRequestBodyIndividual + && equalTo((CreateVerificationsRequestBodyIndividual) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVerificationsRequestBodyIndividual other) { + return address.equals(other.address) + && businessName.equals(other.businessName) + && businessStructure.equals(other.businessStructure) + && businessTaxIdentificationNumber.equals(other.businessTaxIdentificationNumber) + && businessWebsite.equals(other.businessWebsite) + && country.equals(other.country) + && dateOfBirth.equals(other.dateOfBirth) + && documentType.equals(other.documentType) + && documents.equals(other.documents) + && firstName.equals(other.firstName) + && lastName.equals(other.lastName) + && phone.equals(other.phone) + && shareToken.equals(other.shareToken) + && taxIdentificationNumber.equals(other.taxIdentificationNumber); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.address, + this.businessName, + this.businessStructure, + this.businessTaxIdentificationNumber, + this.businessWebsite, + this.country, + this.dateOfBirth, + this.documentType, + this.documents, + this.firstName, + this.lastName, + this.phone, + this.shareToken, + this.taxIdentificationNumber); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional address = Optional.empty(); + + private Optional businessName = Optional.empty(); + + private Optional businessStructure = Optional.empty(); + + private Optional businessTaxIdentificationNumber = Optional.empty(); + + private Optional businessWebsite = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional dateOfBirth = Optional.empty(); + + private Optional documentType = Optional.empty(); + + private Optional documents = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional lastName = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional shareToken = Optional.empty(); + + private Optional taxIdentificationNumber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateVerificationsRequestBodyIndividual other) { + address(other.getAddress()); + businessName(other.getBusinessName()); + businessStructure(other.getBusinessStructure()); + businessTaxIdentificationNumber(other.getBusinessTaxIdentificationNumber()); + businessWebsite(other.getBusinessWebsite()); + country(other.getCountry()); + dateOfBirth(other.getDateOfBirth()); + documentType(other.getDocumentType()); + documents(other.getDocuments()); + firstName(other.getFirstName()); + lastName(other.getLastName()); + phone(other.getPhone()); + shareToken(other.getShareToken()); + taxIdentificationNumber(other.getTaxIdentificationNumber()); + return this; + } + + /** + *

Every value accepts null, so a form seeded from a previous response can round-trip unset fields unchanged.

+ */ + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public Builder address(Optional address) { + this.address = address; + return this; + } + + public Builder address(CreateVerificationsRequestBodyIndividualAddress address) { + this.address = Optional.ofNullable(address); + return this; + } + + /** + *

Legal business name for a sole proprietor or single-member LLC.

+ */ + @JsonSetter(value = "business_name", nulls = Nulls.SKIP) + public Builder businessName(Optional businessName) { + this.businessName = businessName; + return this; + } + + public Builder businessName(String businessName) { + this.businessName = Optional.ofNullable(businessName); + return this; + } + + /** + *

Entity type for sole proprietors, such as single_member_llc. Supported values vary by country of incorporation — see Business structures.

+ */ + @JsonSetter(value = "business_structure", nulls = Nulls.SKIP) + public Builder businessStructure(Optional businessStructure) { + this.businessStructure = businessStructure; + return this; + } + + public Builder businessStructure(String businessStructure) { + this.businessStructure = Optional.ofNullable(businessStructure); + return this; + } + + /** + *

The business ID number of the company, as appropriate for the company's country. Examples are an Employer Identification Number (EIN) in the US, a Business Number in Canada, or a Company Number in the UK.

+ */ + @JsonSetter(value = "business_tax_identification_number", nulls = Nulls.SKIP) + public Builder businessTaxIdentificationNumber(Optional businessTaxIdentificationNumber) { + this.businessTaxIdentificationNumber = businessTaxIdentificationNumber; + return this; + } + + public Builder businessTaxIdentificationNumber(String businessTaxIdentificationNumber) { + this.businessTaxIdentificationNumber = Optional.ofNullable(businessTaxIdentificationNumber); + return this; + } + + /** + *

Business website URL. Whop store pages are not accepted.

+ */ + @JsonSetter(value = "business_website", nulls = Nulls.SKIP) + public Builder businessWebsite(Optional businessWebsite) { + this.businessWebsite = businessWebsite; + return this; + } + + public Builder businessWebsite(String businessWebsite) { + this.businessWebsite = Optional.ofNullable(businessWebsite); + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

Formatted as YYYY-MM-DD.

+ */ + @JsonSetter(value = "date_of_birth", nulls = Nulls.SKIP) + public Builder dateOfBirth(Optional dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + public Builder dateOfBirth(String dateOfBirth) { + this.dateOfBirth = Optional.ofNullable(dateOfBirth); + return this; + } + + /** + *

Identity document being sent, when verifying with documents. Decides exactly which file slots to send: ID_CARDid_card_front + id_card_back + selfie; DRIVERSdrivers_front + drivers_back + selfie; RESIDENCE_PERMITresidence_permit_front + residence_permit_back + selfie; PASSPORTpassport_front + selfie. See Identity documents.

+ */ + @JsonSetter(value = "document_type", nulls = Nulls.SKIP) + public Builder documentType(Optional documentType) { + this.documentType = documentType; + return this; + } + + public Builder documentType(CreateVerificationsRequestBodyIndividualDocumentType documentType) { + this.documentType = Optional.ofNullable(documentType); + return this; + } + + /** + *

Identity document files, each value the file's raw bytes base64-encoded (JPEG, PNG, or PDF, up to 5MB per file before encoding). Sending this object verifies the person from the files in this request instead of a hosted session — individual verifications only, and the request must also carry document_type, first_name, last_name, date_of_birth, country, phone, tax_identification_number, and an address with line1, city, state, and postal_code. Send every slot for your document_type — a missing or rejected file fails the whole request and nothing is submitted; review starts automatically once every document is accepted. See Identity documents for a full walkthrough.

+ */ + @JsonSetter(value = "documents", nulls = Nulls.SKIP) + public Builder documents(Optional documents) { + this.documents = documents; + return this; + } + + public Builder documents(CreateVerificationsRequestBodyIndividualDocuments documents) { + this.documents = Optional.ofNullable(documents); + return this; + } + + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public Builder firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public Builder lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + /** + *

Sumsub share token for a person a partner has already verified, generated by their Sumsub account for Whop's client ID. Reuses that verification instead of collecting anything: Whop imports the shared identity, rechecks it against its own requirements, and returns approved when it satisfies them, or pending with a session_url covering only what is still missing. Requires a Reusable KYC agreement between the partner's Sumsub account and Whop's. Each token works once, and cannot be combined with documents or document_type.

+ */ + @JsonSetter(value = "share_token", nulls = Nulls.SKIP) + public Builder shareToken(Optional shareToken) { + this.shareToken = shareToken; + return this; + } + + public Builder shareToken(String shareToken) { + this.shareToken = Optional.ofNullable(shareToken); + return this; + } + + /** + *

The government-issued ID number of the person being verified — the individual for a KYC verification, or the business representative for a KYB verification — as appropriate for their country. Examples are a Social Security Number (SSN) in the US, or a Social Insurance Number in Canada.

+ */ + @JsonSetter(value = "tax_identification_number", nulls = Nulls.SKIP) + public Builder taxIdentificationNumber(Optional taxIdentificationNumber) { + this.taxIdentificationNumber = taxIdentificationNumber; + return this; + } + + public Builder taxIdentificationNumber(String taxIdentificationNumber) { + this.taxIdentificationNumber = Optional.ofNullable(taxIdentificationNumber); + return this; + } + + public CreateVerificationsRequestBodyIndividual build() { + return new CreateVerificationsRequestBodyIndividual( + address, + businessName, + businessStructure, + businessTaxIdentificationNumber, + businessWebsite, + country, + dateOfBirth, + documentType, + documents, + firstName, + lastName, + phone, + shareToken, + taxIdentificationNumber, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyIndividualAddress.java b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyIndividualAddress.java new file mode 100644 index 00000000..14c036ad --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyIndividualAddress.java @@ -0,0 +1,382 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVerificationsRequestBodyIndividualAddress.Builder.class) +public final class CreateVerificationsRequestBodyIndividualAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private CreateVerificationsRequestBodyIndividualAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return First line of the street address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return Second line of the street address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Postal or ZIP code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return State, province, or region code, for example CA. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVerificationsRequestBodyIndividualAddress + && equalTo((CreateVerificationsRequestBodyIndividualAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVerificationsRequestBodyIndividualAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateVerificationsRequestBodyIndividualAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

First line of the street address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

Second line of the street address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Postal or ZIP code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

State, province, or region code, for example CA.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public CreateVerificationsRequestBodyIndividualAddress build() { + return new CreateVerificationsRequestBodyIndividualAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyIndividualDocumentType.java b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyIndividualDocumentType.java new file mode 100644 index 00000000..0a956ddd --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyIndividualDocumentType.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateVerificationsRequestBodyIndividualDocumentType { + public static final CreateVerificationsRequestBodyIndividualDocumentType PASSPORT = + new CreateVerificationsRequestBodyIndividualDocumentType(Value.PASSPORT, "PASSPORT"); + + public static final CreateVerificationsRequestBodyIndividualDocumentType ID_CARD = + new CreateVerificationsRequestBodyIndividualDocumentType(Value.ID_CARD, "ID_CARD"); + + public static final CreateVerificationsRequestBodyIndividualDocumentType RESIDENCE_PERMIT = + new CreateVerificationsRequestBodyIndividualDocumentType(Value.RESIDENCE_PERMIT, "RESIDENCE_PERMIT"); + + public static final CreateVerificationsRequestBodyIndividualDocumentType DRIVERS = + new CreateVerificationsRequestBodyIndividualDocumentType(Value.DRIVERS, "DRIVERS"); + + private final Value value; + + private final String string; + + CreateVerificationsRequestBodyIndividualDocumentType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateVerificationsRequestBodyIndividualDocumentType + && this.string.equals(((CreateVerificationsRequestBodyIndividualDocumentType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PASSPORT: + return visitor.visitPassport(); + case ID_CARD: + return visitor.visitIdCard(); + case RESIDENCE_PERMIT: + return visitor.visitResidencePermit(); + case DRIVERS: + return visitor.visitDrivers(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateVerificationsRequestBodyIndividualDocumentType valueOf(String value) { + switch (value) { + case "PASSPORT": + return PASSPORT; + case "ID_CARD": + return ID_CARD; + case "RESIDENCE_PERMIT": + return RESIDENCE_PERMIT; + case "DRIVERS": + return DRIVERS; + default: + return new CreateVerificationsRequestBodyIndividualDocumentType(Value.UNKNOWN, value); + } + } + + public enum Value { + ID_CARD, + + DRIVERS, + + RESIDENCE_PERMIT, + + PASSPORT, + + UNKNOWN + } + + public interface Visitor { + T visitIdCard(); + + T visitDrivers(); + + T visitResidencePermit(); + + T visitPassport(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyIndividualDocuments.java b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyIndividualDocuments.java new file mode 100644 index 00000000..3d05c850 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsRequestBodyIndividualDocuments.java @@ -0,0 +1,341 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVerificationsRequestBodyIndividualDocuments.Builder.class) +public final class CreateVerificationsRequestBodyIndividualDocuments { + private final Optional driversBack; + + private final Optional driversFront; + + private final Optional idCardBack; + + private final Optional idCardFront; + + private final Optional passportFront; + + private final Optional residencePermitBack; + + private final Optional residencePermitFront; + + private final Optional selfie; + + private final Map additionalProperties; + + private CreateVerificationsRequestBodyIndividualDocuments( + Optional driversBack, + Optional driversFront, + Optional idCardBack, + Optional idCardFront, + Optional passportFront, + Optional residencePermitBack, + Optional residencePermitFront, + Optional selfie, + Map additionalProperties) { + this.driversBack = driversBack; + this.driversFront = driversFront; + this.idCardBack = idCardBack; + this.idCardFront = idCardFront; + this.passportFront = passportFront; + this.residencePermitBack = residencePermitBack; + this.residencePermitFront = residencePermitFront; + this.selfie = selfie; + this.additionalProperties = additionalProperties; + } + + /** + * @return Back of the driver's license, base64-encoded. Required when document_type is DRIVERS. + */ + @JsonProperty("drivers_back") + public Optional getDriversBack() { + return driversBack; + } + + /** + * @return Front of the driver's license, base64-encoded. Required when document_type is DRIVERS. + */ + @JsonProperty("drivers_front") + public Optional getDriversFront() { + return driversFront; + } + + /** + * @return Back of the ID card, base64-encoded. Required when document_type is ID_CARD. + */ + @JsonProperty("id_card_back") + public Optional getIdCardBack() { + return idCardBack; + } + + /** + * @return Front of the ID card, base64-encoded. Required when document_type is ID_CARD. + */ + @JsonProperty("id_card_front") + public Optional getIdCardFront() { + return idCardFront; + } + + /** + * @return Photo page of the passport, base64-encoded. Required when document_type is PASSPORT. + */ + @JsonProperty("passport_front") + public Optional getPassportFront() { + return passportFront; + } + + /** + * @return Back of the residence permit, base64-encoded. Required when document_type is RESIDENCE_PERMIT. + */ + @JsonProperty("residence_permit_back") + public Optional getResidencePermitBack() { + return residencePermitBack; + } + + /** + * @return Front of the residence permit, base64-encoded. Required when document_type is RESIDENCE_PERMIT. + */ + @JsonProperty("residence_permit_front") + public Optional getResidencePermitFront() { + return residencePermitFront; + } + + /** + * @return Photo of the person's face, base64-encoded. Always required, with every document type. Must be JPEG or PNG. + */ + @JsonProperty("selfie") + public Optional getSelfie() { + return selfie; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVerificationsRequestBodyIndividualDocuments + && equalTo((CreateVerificationsRequestBodyIndividualDocuments) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVerificationsRequestBodyIndividualDocuments other) { + return driversBack.equals(other.driversBack) + && driversFront.equals(other.driversFront) + && idCardBack.equals(other.idCardBack) + && idCardFront.equals(other.idCardFront) + && passportFront.equals(other.passportFront) + && residencePermitBack.equals(other.residencePermitBack) + && residencePermitFront.equals(other.residencePermitFront) + && selfie.equals(other.selfie); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.driversBack, + this.driversFront, + this.idCardBack, + this.idCardFront, + this.passportFront, + this.residencePermitBack, + this.residencePermitFront, + this.selfie); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional driversBack = Optional.empty(); + + private Optional driversFront = Optional.empty(); + + private Optional idCardBack = Optional.empty(); + + private Optional idCardFront = Optional.empty(); + + private Optional passportFront = Optional.empty(); + + private Optional residencePermitBack = Optional.empty(); + + private Optional residencePermitFront = Optional.empty(); + + private Optional selfie = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateVerificationsRequestBodyIndividualDocuments other) { + driversBack(other.getDriversBack()); + driversFront(other.getDriversFront()); + idCardBack(other.getIdCardBack()); + idCardFront(other.getIdCardFront()); + passportFront(other.getPassportFront()); + residencePermitBack(other.getResidencePermitBack()); + residencePermitFront(other.getResidencePermitFront()); + selfie(other.getSelfie()); + return this; + } + + /** + *

Back of the driver's license, base64-encoded. Required when document_type is DRIVERS.

+ */ + @JsonSetter(value = "drivers_back", nulls = Nulls.SKIP) + public Builder driversBack(Optional driversBack) { + this.driversBack = driversBack; + return this; + } + + public Builder driversBack(String driversBack) { + this.driversBack = Optional.ofNullable(driversBack); + return this; + } + + /** + *

Front of the driver's license, base64-encoded. Required when document_type is DRIVERS.

+ */ + @JsonSetter(value = "drivers_front", nulls = Nulls.SKIP) + public Builder driversFront(Optional driversFront) { + this.driversFront = driversFront; + return this; + } + + public Builder driversFront(String driversFront) { + this.driversFront = Optional.ofNullable(driversFront); + return this; + } + + /** + *

Back of the ID card, base64-encoded. Required when document_type is ID_CARD.

+ */ + @JsonSetter(value = "id_card_back", nulls = Nulls.SKIP) + public Builder idCardBack(Optional idCardBack) { + this.idCardBack = idCardBack; + return this; + } + + public Builder idCardBack(String idCardBack) { + this.idCardBack = Optional.ofNullable(idCardBack); + return this; + } + + /** + *

Front of the ID card, base64-encoded. Required when document_type is ID_CARD.

+ */ + @JsonSetter(value = "id_card_front", nulls = Nulls.SKIP) + public Builder idCardFront(Optional idCardFront) { + this.idCardFront = idCardFront; + return this; + } + + public Builder idCardFront(String idCardFront) { + this.idCardFront = Optional.ofNullable(idCardFront); + return this; + } + + /** + *

Photo page of the passport, base64-encoded. Required when document_type is PASSPORT.

+ */ + @JsonSetter(value = "passport_front", nulls = Nulls.SKIP) + public Builder passportFront(Optional passportFront) { + this.passportFront = passportFront; + return this; + } + + public Builder passportFront(String passportFront) { + this.passportFront = Optional.ofNullable(passportFront); + return this; + } + + /** + *

Back of the residence permit, base64-encoded. Required when document_type is RESIDENCE_PERMIT.

+ */ + @JsonSetter(value = "residence_permit_back", nulls = Nulls.SKIP) + public Builder residencePermitBack(Optional residencePermitBack) { + this.residencePermitBack = residencePermitBack; + return this; + } + + public Builder residencePermitBack(String residencePermitBack) { + this.residencePermitBack = Optional.ofNullable(residencePermitBack); + return this; + } + + /** + *

Front of the residence permit, base64-encoded. Required when document_type is RESIDENCE_PERMIT.

+ */ + @JsonSetter(value = "residence_permit_front", nulls = Nulls.SKIP) + public Builder residencePermitFront(Optional residencePermitFront) { + this.residencePermitFront = residencePermitFront; + return this; + } + + public Builder residencePermitFront(String residencePermitFront) { + this.residencePermitFront = Optional.ofNullable(residencePermitFront); + return this; + } + + /** + *

Photo of the person's face, base64-encoded. Always required, with every document type. Must be JPEG or PNG.

+ */ + @JsonSetter(value = "selfie", nulls = Nulls.SKIP) + public Builder selfie(Optional selfie) { + this.selfie = selfie; + return this; + } + + public Builder selfie(String selfie) { + this.selfie = Optional.ofNullable(selfie); + return this; + } + + public CreateVerificationsRequestBodyIndividualDocuments build() { + return new CreateVerificationsRequestBodyIndividualDocuments( + driversBack, + driversFront, + idCardBack, + idCardFront, + passportFront, + residencePermitBack, + residencePermitFront, + selfie, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponse.java b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponse.java new file mode 100644 index 00000000..c0223615 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponse.java @@ -0,0 +1,818 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVerificationsResponse.Builder.class) +public final class CreateVerificationsResponse { + private final Optional address; + + private final Optional businessName; + + private final Optional businessStructure; + + private final Optional country; + + private final Optional createdAt; + + private final Optional dateOfBirth; + + private final Optional email; + + private final Optional firstName; + + private final Optional id; + + private final Optional kind; + + private final Optional lastName; + + private final Optional phone; + + private final Optional> requestedInformation; + + private final Optional> requiredDocuments; + + private final Optional sessionUrl; + + private final Optional status; + + private final Optional updatedAt; + + private final Map additionalProperties; + + private CreateVerificationsResponse( + Optional address, + Optional businessName, + Optional businessStructure, + Optional country, + Optional createdAt, + Optional dateOfBirth, + Optional email, + Optional firstName, + Optional id, + Optional kind, + Optional lastName, + Optional phone, + Optional> requestedInformation, + Optional> requiredDocuments, + Optional sessionUrl, + Optional status, + Optional updatedAt, + Map additionalProperties) { + this.address = address; + this.businessName = businessName; + this.businessStructure = businessStructure; + this.country = country; + this.createdAt = createdAt; + this.dateOfBirth = dateOfBirth; + this.email = email; + this.firstName = firstName; + this.id = id; + this.kind = kind; + this.lastName = lastName; + this.phone = phone; + this.requestedInformation = requestedInformation; + this.requiredDocuments = requiredDocuments; + this.sessionUrl = sessionUrl; + this.status = status; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return Address on the verification profile. null when no address is set. + */ + @JsonIgnore + public Optional getAddress() { + if (address == null) { + return Optional.empty(); + } + return address; + } + + /** + * @return Legal business name. + */ + @JsonIgnore + public Optional getBusinessName() { + if (businessName == null) { + return Optional.empty(); + } + return businessName; + } + + /** + * @return Legal entity structure of the business, such as private_corporation or sole_proprietorship. Supported values vary by country of incorporation — see Business structures. + */ + @JsonIgnore + public Optional getBusinessStructure() { + if (businessStructure == null) { + return Optional.empty(); + } + return businessStructure; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return When the verification profile was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public Optional getCreatedAt() { + return createdAt; + } + + /** + * @return Formatted as YYYY-MM-DD. + */ + @JsonIgnore + public Optional getDateOfBirth() { + if (dateOfBirth == null) { + return Optional.empty(); + } + return dateOfBirth; + } + + /** + * @return Email address on the verification profile. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + @JsonIgnore + public Optional getFirstName() { + if (firstName == null) { + return Optional.empty(); + } + return firstName; + } + + /** + * @return Verification profile ID, prefixed idpf_. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonProperty("kind") + public Optional getKind() { + return kind; + } + + @JsonIgnore + public Optional getLastName() { + if (lastName == null) { + return Optional.empty(); + } + return lastName; + } + + /** + * @return Phone number on the verification profile. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + /** + * @return What Whop still needs before review can continue — one requirement per entry. Answer with Update Verification; nothing from the response is echoed back. Keys that don't apply are omitted. + */ + @JsonProperty("requested_information") + public Optional> getRequestedInformation() { + return requestedInformation; + } + + /** + * @return Documents for a document-upload verification and their progress. Present only on verifications created by sending documents. pending_upload documents were not accepted yet — send the full set again with another Create Verification call. + */ + @JsonProperty("required_documents") + public Optional> getRequiredDocuments() { + return requiredDocuments; + } + + /** + * @return Hosted verification session URL for the user to complete identity checks. Expires 7 days after creation. + */ + @JsonIgnore + public Optional getSessionUrl() { + if (sessionUrl == null) { + return Optional.empty(); + } + return sessionUrl; + } + + /** + * @return Current verification state. not_started before any session exists; pending while a session needs the user's input; processing while the provider's automated checks run on a fresh submission; action_required when requested_information needs answers; manual_review while information already sent is under review — an audit answer, or a document the payout provider holds — nothing to submit, usually done within 3 business days; approved on success; rejected on failure. Call Create Verification again to start a new session. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return When the verification profile was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public Optional getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("address") + private Optional _getAddress() { + return address; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_name") + private Optional _getBusinessName() { + return businessName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_structure") + private Optional _getBusinessStructure() { + return businessStructure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("date_of_birth") + private Optional _getDateOfBirth() { + return dateOfBirth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_name") + private Optional _getFirstName() { + return firstName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_name") + private Optional _getLastName() { + return lastName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("session_url") + private Optional _getSessionUrl() { + return sessionUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVerificationsResponse && equalTo((CreateVerificationsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVerificationsResponse other) { + return address.equals(other.address) + && businessName.equals(other.businessName) + && businessStructure.equals(other.businessStructure) + && country.equals(other.country) + && createdAt.equals(other.createdAt) + && dateOfBirth.equals(other.dateOfBirth) + && email.equals(other.email) + && firstName.equals(other.firstName) + && id.equals(other.id) + && kind.equals(other.kind) + && lastName.equals(other.lastName) + && phone.equals(other.phone) + && requestedInformation.equals(other.requestedInformation) + && requiredDocuments.equals(other.requiredDocuments) + && sessionUrl.equals(other.sessionUrl) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.address, + this.businessName, + this.businessStructure, + this.country, + this.createdAt, + this.dateOfBirth, + this.email, + this.firstName, + this.id, + this.kind, + this.lastName, + this.phone, + this.requestedInformation, + this.requiredDocuments, + this.sessionUrl, + this.status, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional address = Optional.empty(); + + private Optional businessName = Optional.empty(); + + private Optional businessStructure = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional dateOfBirth = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional kind = Optional.empty(); + + private Optional lastName = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional> requestedInformation = + Optional.empty(); + + private Optional> requiredDocuments = Optional.empty(); + + private Optional sessionUrl = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional updatedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateVerificationsResponse other) { + address(other.getAddress()); + businessName(other.getBusinessName()); + businessStructure(other.getBusinessStructure()); + country(other.getCountry()); + createdAt(other.getCreatedAt()); + dateOfBirth(other.getDateOfBirth()); + email(other.getEmail()); + firstName(other.getFirstName()); + id(other.getId()); + kind(other.getKind()); + lastName(other.getLastName()); + phone(other.getPhone()); + requestedInformation(other.getRequestedInformation()); + requiredDocuments(other.getRequiredDocuments()); + sessionUrl(other.getSessionUrl()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

Address on the verification profile. null when no address is set.

+ */ + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public Builder address(Optional address) { + this.address = address; + return this; + } + + public Builder address(CreateVerificationsResponseAddress address) { + this.address = Optional.ofNullable(address); + return this; + } + + public Builder address(Nullable address) { + if (address.isNull()) { + this.address = null; + } else if (address.isEmpty()) { + this.address = Optional.empty(); + } else { + this.address = Optional.of(address.get()); + } + return this; + } + + /** + *

Legal business name.

+ */ + @JsonSetter(value = "business_name", nulls = Nulls.SKIP) + public Builder businessName(Optional businessName) { + this.businessName = businessName; + return this; + } + + public Builder businessName(String businessName) { + this.businessName = Optional.ofNullable(businessName); + return this; + } + + public Builder businessName(Nullable businessName) { + if (businessName.isNull()) { + this.businessName = null; + } else if (businessName.isEmpty()) { + this.businessName = Optional.empty(); + } else { + this.businessName = Optional.of(businessName.get()); + } + return this; + } + + /** + *

Legal entity structure of the business, such as private_corporation or sole_proprietorship. Supported values vary by country of incorporation — see Business structures.

+ */ + @JsonSetter(value = "business_structure", nulls = Nulls.SKIP) + public Builder businessStructure(Optional businessStructure) { + this.businessStructure = businessStructure; + return this; + } + + public Builder businessStructure(String businessStructure) { + this.businessStructure = Optional.ofNullable(businessStructure); + return this; + } + + public Builder businessStructure(Nullable businessStructure) { + if (businessStructure.isNull()) { + this.businessStructure = null; + } else if (businessStructure.isEmpty()) { + this.businessStructure = Optional.empty(); + } else { + this.businessStructure = Optional.of(businessStructure.get()); + } + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

When the verification profile was created, as an ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public Builder createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder createdAt(String createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

Formatted as YYYY-MM-DD.

+ */ + @JsonSetter(value = "date_of_birth", nulls = Nulls.SKIP) + public Builder dateOfBirth(Optional dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + public Builder dateOfBirth(String dateOfBirth) { + this.dateOfBirth = Optional.ofNullable(dateOfBirth); + return this; + } + + public Builder dateOfBirth(Nullable dateOfBirth) { + if (dateOfBirth.isNull()) { + this.dateOfBirth = null; + } else if (dateOfBirth.isEmpty()) { + this.dateOfBirth = Optional.empty(); + } else { + this.dateOfBirth = Optional.of(dateOfBirth.get()); + } + return this; + } + + /** + *

Email address on the verification profile.

+ */ + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + public Builder email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public Builder firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + public Builder firstName(Nullable firstName) { + if (firstName.isNull()) { + this.firstName = null; + } else if (firstName.isEmpty()) { + this.firstName = Optional.empty(); + } else { + this.firstName = Optional.of(firstName.get()); + } + return this; + } + + /** + *

Verification profile ID, prefixed idpf_.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "kind", nulls = Nulls.SKIP) + public Builder kind(Optional kind) { + this.kind = kind; + return this; + } + + public Builder kind(CreateVerificationsResponseKind kind) { + this.kind = Optional.ofNullable(kind); + return this; + } + + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public Builder lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + public Builder lastName(Nullable lastName) { + if (lastName.isNull()) { + this.lastName = null; + } else if (lastName.isEmpty()) { + this.lastName = Optional.empty(); + } else { + this.lastName = Optional.of(lastName.get()); + } + return this; + } + + /** + *

Phone number on the verification profile.

+ */ + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + public Builder phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

What Whop still needs before review can continue — one requirement per entry. Answer with Update Verification; nothing from the response is echoed back. Keys that don't apply are omitted.

+ */ + @JsonSetter(value = "requested_information", nulls = Nulls.SKIP) + public Builder requestedInformation( + Optional> requestedInformation) { + this.requestedInformation = requestedInformation; + return this; + } + + public Builder requestedInformation( + List requestedInformation) { + this.requestedInformation = Optional.ofNullable(requestedInformation); + return this; + } + + /** + *

Documents for a document-upload verification and their progress. Present only on verifications created by sending documents. pending_upload documents were not accepted yet — send the full set again with another Create Verification call.

+ */ + @JsonSetter(value = "required_documents", nulls = Nulls.SKIP) + public Builder requiredDocuments( + Optional> requiredDocuments) { + this.requiredDocuments = requiredDocuments; + return this; + } + + public Builder requiredDocuments(List requiredDocuments) { + this.requiredDocuments = Optional.ofNullable(requiredDocuments); + return this; + } + + /** + *

Hosted verification session URL for the user to complete identity checks. Expires 7 days after creation.

+ */ + @JsonSetter(value = "session_url", nulls = Nulls.SKIP) + public Builder sessionUrl(Optional sessionUrl) { + this.sessionUrl = sessionUrl; + return this; + } + + public Builder sessionUrl(String sessionUrl) { + this.sessionUrl = Optional.ofNullable(sessionUrl); + return this; + } + + public Builder sessionUrl(Nullable sessionUrl) { + if (sessionUrl.isNull()) { + this.sessionUrl = null; + } else if (sessionUrl.isEmpty()) { + this.sessionUrl = Optional.empty(); + } else { + this.sessionUrl = Optional.of(sessionUrl.get()); + } + return this; + } + + /** + *

Current verification state. not_started before any session exists; pending while a session needs the user's input; processing while the provider's automated checks run on a fresh submission; action_required when requested_information needs answers; manual_review while information already sent is under review — an audit answer, or a document the payout provider holds — nothing to submit, usually done within 3 business days; approved on success; rejected on failure. Call Create Verification again to start a new session.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(CreateVerificationsResponseStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

When the verification profile was last updated, as an ISO 8601 timestamp.

+ */ + @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) + public Builder updatedAt(Optional updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder updatedAt(String updatedAt) { + this.updatedAt = Optional.ofNullable(updatedAt); + return this; + } + + public CreateVerificationsResponse build() { + return new CreateVerificationsResponse( + address, + businessName, + businessStructure, + country, + createdAt, + dateOfBirth, + email, + firstName, + id, + kind, + lastName, + phone, + requestedInformation, + requiredDocuments, + sessionUrl, + status, + updatedAt, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseAddress.java b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseAddress.java new file mode 100644 index 00000000..f2fcf493 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseAddress.java @@ -0,0 +1,362 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVerificationsResponseAddress.Builder.class) +public final class CreateVerificationsResponseAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private CreateVerificationsResponseAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return First line of the street address. + */ + @JsonProperty("line1") + public Optional getLine1() { + return line1; + } + + /** + * @return Second line of the street address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Postal or ZIP code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return State, province, or region code, for example CA. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVerificationsResponseAddress + && equalTo((CreateVerificationsResponseAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVerificationsResponseAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateVerificationsResponseAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

First line of the street address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + /** + *

Second line of the street address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Postal or ZIP code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

State, province, or region code, for example CA.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public CreateVerificationsResponseAddress build() { + return new CreateVerificationsResponseAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseKind.java b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseKind.java new file mode 100644 index 00000000..f1af875d --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseKind.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateVerificationsResponseKind { + public static final CreateVerificationsResponseKind INDIVIDUAL = + new CreateVerificationsResponseKind(Value.INDIVIDUAL, "individual"); + + public static final CreateVerificationsResponseKind BUSINESS = + new CreateVerificationsResponseKind(Value.BUSINESS, "business"); + + private final Value value; + + private final String string; + + CreateVerificationsResponseKind(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateVerificationsResponseKind + && this.string.equals(((CreateVerificationsResponseKind) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INDIVIDUAL: + return visitor.visitIndividual(); + case BUSINESS: + return visitor.visitBusiness(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateVerificationsResponseKind valueOf(String value) { + switch (value) { + case "individual": + return INDIVIDUAL; + case "business": + return BUSINESS; + default: + return new CreateVerificationsResponseKind(Value.UNKNOWN, value); + } + } + + public enum Value { + INDIVIDUAL, + + BUSINESS, + + UNKNOWN + } + + public interface Visitor { + T visitIndividual(); + + T visitBusiness(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseRequestedInformationItem.java b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseRequestedInformationItem.java new file mode 100644 index 00000000..07a65993 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseRequestedInformationItem.java @@ -0,0 +1,371 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVerificationsResponseRequestedInformationItem.Builder.class) +public final class CreateVerificationsResponseRequestedInformationItem { + private final Optional> errors; + + private final String id; + + private final String label; + + private final Optional optional; + + private final Optional> options; + + private final String requirement; + + private final String type; + + private final Map additionalProperties; + + private CreateVerificationsResponseRequestedInformationItem( + Optional> errors, + String id, + String label, + Optional optional, + Optional> options, + String requirement, + String type, + Map additionalProperties) { + this.errors = errors; + this.id = id; + this.label = label; + this.optional = optional; + this.options = options; + this.requirement = requirement; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Present after a rejected submission. + */ + @JsonProperty("errors") + public Optional> getErrors() { + return errors; + } + + /** + * @return Requested information item ID, prefixed inrqi_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Instruction to show the user. Carries the reviewer's note verbatim when there is one. + */ + @JsonProperty("label") + public String getLabel() { + return label; + } + + /** + * @return true when the item can be skipped. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make. + */ + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + + /** + * @return What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type. + */ + @JsonProperty("requirement") + public String getRequirement() { + return requirement; + } + + /** + * @return What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address). + */ + @JsonProperty("type") + public String getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVerificationsResponseRequestedInformationItem + && equalTo((CreateVerificationsResponseRequestedInformationItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVerificationsResponseRequestedInformationItem other) { + return errors.equals(other.errors) + && id.equals(other.id) + && label.equals(other.label) + && optional.equals(other.optional) + && options.equals(other.options) + && requirement.equals(other.requirement) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.errors, this.id, this.label, this.optional, this.options, this.requirement, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Requested information item ID, prefixed inrqi_.

+ */ + LabelStage id(@NotNull String id); + + Builder from(CreateVerificationsResponseRequestedInformationItem other); + } + + public interface LabelStage { + /** + *

Instruction to show the user. Carries the reviewer's note verbatim when there is one.

+ */ + RequirementStage label(@NotNull String label); + } + + public interface RequirementStage { + /** + *

What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type.

+ */ + TypeStage requirement(@NotNull String requirement); + } + + public interface TypeStage { + /** + *

What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address).

+ */ + _FinalStage type(@NotNull String type); + } + + public interface _FinalStage { + CreateVerificationsResponseRequestedInformationItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Present after a rejected submission.

+ */ + _FinalStage errors(Optional> errors); + + _FinalStage errors(List errors); + + /** + *

true when the item can be skipped.

+ */ + _FinalStage optional(Optional optional); + + _FinalStage optional(Boolean optional); + + /** + *

The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make.

+ */ + _FinalStage options(Optional> options); + + _FinalStage options(List options); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, LabelStage, RequirementStage, TypeStage, _FinalStage { + private String id; + + private String label; + + private String requirement; + + private String type; + + private Optional> options = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional> errors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateVerificationsResponseRequestedInformationItem other) { + errors(other.getErrors()); + id(other.getId()); + label(other.getLabel()); + optional(other.getOptional()); + options(other.getOptions()); + requirement(other.getRequirement()); + type(other.getType()); + return this; + } + + /** + *

Requested information item ID, prefixed inrqi_.

+ *

Requested information item ID, prefixed inrqi_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LabelStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Instruction to show the user. Carries the reviewer's note verbatim when there is one.

+ *

Instruction to show the user. Carries the reviewer's note verbatim when there is one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("label") + public RequirementStage label(@NotNull String label) { + this.label = Objects.requireNonNull(label, "label must not be null"); + return this; + } + + /** + *

What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type.

+ *

What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("requirement") + public TypeStage requirement(@NotNull String requirement) { + this.requirement = Objects.requireNonNull(requirement, "requirement must not be null"); + return this; + } + + /** + *

What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address).

+ *

What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + /** + *

The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make.

+ */ + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional> options) { + this.options = options; + return this; + } + + /** + *

true when the item can be skipped.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

true when the item can be skipped.

+ */ + @java.lang.Override + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public _FinalStage optional(Optional optional) { + this.optional = optional; + return this; + } + + /** + *

Present after a rejected submission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errors(List errors) { + this.errors = Optional.ofNullable(errors); + return this; + } + + /** + *

Present after a rejected submission.

+ */ + @java.lang.Override + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public _FinalStage errors( + Optional> errors) { + this.errors = errors; + return this; + } + + @java.lang.Override + public CreateVerificationsResponseRequestedInformationItem build() { + return new CreateVerificationsResponseRequestedInformationItem( + errors, id, label, optional, options, requirement, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseRequestedInformationItemErrorsItem.java b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseRequestedInformationItemErrorsItem.java new file mode 100644 index 00000000..015fba79 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseRequestedInformationItemErrorsItem.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVerificationsResponseRequestedInformationItemErrorsItem.Builder.class) +public final class CreateVerificationsResponseRequestedInformationItemErrorsItem { + private final Optional code; + + private final Optional reason; + + private final Map additionalProperties; + + private CreateVerificationsResponseRequestedInformationItemErrorsItem( + Optional code, Optional reason, Map additionalProperties) { + this.code = code; + this.reason = reason; + this.additionalProperties = additionalProperties; + } + + /** + * @return Stable error code. + */ + @JsonProperty("code") + public Optional getCode() { + return code; + } + + /** + * @return Why it was rejected. + */ + @JsonProperty("reason") + public Optional getReason() { + return reason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVerificationsResponseRequestedInformationItemErrorsItem + && equalTo((CreateVerificationsResponseRequestedInformationItemErrorsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVerificationsResponseRequestedInformationItemErrorsItem other) { + return code.equals(other.code) && reason.equals(other.reason); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.reason); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional code = Optional.empty(); + + private Optional reason = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateVerificationsResponseRequestedInformationItemErrorsItem other) { + code(other.getCode()); + reason(other.getReason()); + return this; + } + + /** + *

Stable error code.

+ */ + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public Builder code(Optional code) { + this.code = code; + return this; + } + + public Builder code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

Why it was rejected.

+ */ + @JsonSetter(value = "reason", nulls = Nulls.SKIP) + public Builder reason(Optional reason) { + this.reason = reason; + return this; + } + + public Builder reason(String reason) { + this.reason = Optional.ofNullable(reason); + return this; + } + + public CreateVerificationsResponseRequestedInformationItemErrorsItem build() { + return new CreateVerificationsResponseRequestedInformationItemErrorsItem( + code, reason, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseRequiredDocumentsItem.java b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseRequiredDocumentsItem.java new file mode 100644 index 00000000..c851ca66 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseRequiredDocumentsItem.java @@ -0,0 +1,198 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVerificationsResponseRequiredDocumentsItem.Builder.class) +public final class CreateVerificationsResponseRequiredDocumentsItem { + private final Optional document; + + private final Optional rejectionReason; + + private final Optional status; + + private final Map additionalProperties; + + private CreateVerificationsResponseRequiredDocumentsItem( + Optional document, + Optional rejectionReason, + Optional status, + Map additionalProperties) { + this.document = document; + this.rejectionReason = rejectionReason; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Document slot key, such as id_card_front, id_card_back, or selfie. + */ + @JsonProperty("document") + public Optional getDocument() { + return document; + } + + /** + * @return Why the previous submission was rejected, when the provider requested new documents or declined the verification. + */ + @JsonIgnore + public Optional getRejectionReason() { + if (rejectionReason == null) { + return Optional.empty(); + } + return rejectionReason; + } + + /** + * @return pending_upload until the document has been relayed for review; submitted afterwards. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("rejection_reason") + private Optional _getRejectionReason() { + return rejectionReason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVerificationsResponseRequiredDocumentsItem + && equalTo((CreateVerificationsResponseRequiredDocumentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVerificationsResponseRequiredDocumentsItem other) { + return document.equals(other.document) + && rejectionReason.equals(other.rejectionReason) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.document, this.rejectionReason, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional document = Optional.empty(); + + private Optional rejectionReason = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateVerificationsResponseRequiredDocumentsItem other) { + document(other.getDocument()); + rejectionReason(other.getRejectionReason()); + status(other.getStatus()); + return this; + } + + /** + *

Document slot key, such as id_card_front, id_card_back, or selfie.

+ */ + @JsonSetter(value = "document", nulls = Nulls.SKIP) + public Builder document(Optional document) { + this.document = document; + return this; + } + + public Builder document(String document) { + this.document = Optional.ofNullable(document); + return this; + } + + /** + *

Why the previous submission was rejected, when the provider requested new documents or declined the verification.

+ */ + @JsonSetter(value = "rejection_reason", nulls = Nulls.SKIP) + public Builder rejectionReason(Optional rejectionReason) { + this.rejectionReason = rejectionReason; + return this; + } + + public Builder rejectionReason(String rejectionReason) { + this.rejectionReason = Optional.ofNullable(rejectionReason); + return this; + } + + public Builder rejectionReason(Nullable rejectionReason) { + if (rejectionReason.isNull()) { + this.rejectionReason = null; + } else if (rejectionReason.isEmpty()) { + this.rejectionReason = Optional.empty(); + } else { + this.rejectionReason = Optional.of(rejectionReason.get()); + } + return this; + } + + /** + *

pending_upload until the document has been relayed for review; submitted afterwards.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(CreateVerificationsResponseRequiredDocumentsItemStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public CreateVerificationsResponseRequiredDocumentsItem build() { + return new CreateVerificationsResponseRequiredDocumentsItem( + document, rejectionReason, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseRequiredDocumentsItemStatus.java b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseRequiredDocumentsItemStatus.java new file mode 100644 index 00000000..3337e1b1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseRequiredDocumentsItemStatus.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateVerificationsResponseRequiredDocumentsItemStatus { + public static final CreateVerificationsResponseRequiredDocumentsItemStatus PENDING_UPLOAD = + new CreateVerificationsResponseRequiredDocumentsItemStatus(Value.PENDING_UPLOAD, "pending_upload"); + + public static final CreateVerificationsResponseRequiredDocumentsItemStatus SUBMITTED = + new CreateVerificationsResponseRequiredDocumentsItemStatus(Value.SUBMITTED, "submitted"); + + private final Value value; + + private final String string; + + CreateVerificationsResponseRequiredDocumentsItemStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateVerificationsResponseRequiredDocumentsItemStatus + && this.string.equals(((CreateVerificationsResponseRequiredDocumentsItemStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING_UPLOAD: + return visitor.visitPendingUpload(); + case SUBMITTED: + return visitor.visitSubmitted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateVerificationsResponseRequiredDocumentsItemStatus valueOf(String value) { + switch (value) { + case "pending_upload": + return PENDING_UPLOAD; + case "submitted": + return SUBMITTED; + default: + return new CreateVerificationsResponseRequiredDocumentsItemStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING_UPLOAD, + + SUBMITTED, + + UNKNOWN + } + + public interface Visitor { + T visitPendingUpload(); + + T visitSubmitted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseStatus.java b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseStatus.java new file mode 100644 index 00000000..ed82f53d --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/CreateVerificationsResponseStatus.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateVerificationsResponseStatus { + public static final CreateVerificationsResponseStatus APPROVED = + new CreateVerificationsResponseStatus(Value.APPROVED, "approved"); + + public static final CreateVerificationsResponseStatus MANUAL_REVIEW = + new CreateVerificationsResponseStatus(Value.MANUAL_REVIEW, "manual_review"); + + public static final CreateVerificationsResponseStatus PENDING = + new CreateVerificationsResponseStatus(Value.PENDING, "pending"); + + public static final CreateVerificationsResponseStatus PROCESSING = + new CreateVerificationsResponseStatus(Value.PROCESSING, "processing"); + + public static final CreateVerificationsResponseStatus NOT_STARTED = + new CreateVerificationsResponseStatus(Value.NOT_STARTED, "not_started"); + + public static final CreateVerificationsResponseStatus REJECTED = + new CreateVerificationsResponseStatus(Value.REJECTED, "rejected"); + + public static final CreateVerificationsResponseStatus ACTION_REQUIRED = + new CreateVerificationsResponseStatus(Value.ACTION_REQUIRED, "action_required"); + + private final Value value; + + private final String string; + + CreateVerificationsResponseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateVerificationsResponseStatus + && this.string.equals(((CreateVerificationsResponseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case MANUAL_REVIEW: + return visitor.visitManualReview(); + case PENDING: + return visitor.visitPending(); + case PROCESSING: + return visitor.visitProcessing(); + case NOT_STARTED: + return visitor.visitNotStarted(); + case REJECTED: + return visitor.visitRejected(); + case ACTION_REQUIRED: + return visitor.visitActionRequired(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateVerificationsResponseStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "manual_review": + return MANUAL_REVIEW; + case "pending": + return PENDING; + case "processing": + return PROCESSING; + case "not_started": + return NOT_STARTED; + case "rejected": + return REJECTED; + case "action_required": + return ACTION_REQUIRED; + default: + return new CreateVerificationsResponseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + NOT_STARTED, + + PENDING, + + PROCESSING, + + MANUAL_REVIEW, + + APPROVED, + + REJECTED, + + ACTION_REQUIRED, + + UNKNOWN + } + + public interface Visitor { + T visitNotStarted(); + + T visitPending(); + + T visitProcessing(); + + T visitManualReview(); + + T visitApproved(); + + T visitRejected(); + + T visitActionRequired(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsRequestDirection.java b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsRequestDirection.java new file mode 100644 index 00000000..0ce43c04 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsRequestDirection.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListVerificationsRequestDirection { + public static final ListVerificationsRequestDirection ASC = new ListVerificationsRequestDirection(Value.ASC, "asc"); + + public static final ListVerificationsRequestDirection DESC = + new ListVerificationsRequestDirection(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + ListVerificationsRequestDirection(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListVerificationsRequestDirection + && this.string.equals(((ListVerificationsRequestDirection) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListVerificationsRequestDirection valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new ListVerificationsRequestDirection(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsRequestOrder.java b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsRequestOrder.java new file mode 100644 index 00000000..37803ae5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsRequestOrder.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListVerificationsRequestOrder { + public static final ListVerificationsRequestOrder UPDATED_AT = + new ListVerificationsRequestOrder(Value.UPDATED_AT, "updated_at"); + + public static final ListVerificationsRequestOrder CREATED_AT = + new ListVerificationsRequestOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ListVerificationsRequestOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListVerificationsRequestOrder + && this.string.equals(((ListVerificationsRequestOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case UPDATED_AT: + return visitor.visitUpdatedAt(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListVerificationsRequestOrder valueOf(String value) { + switch (value) { + case "updated_at": + return UPDATED_AT; + case "created_at": + return CREATED_AT; + default: + return new ListVerificationsRequestOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + UPDATED_AT, + + CREATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitUpdatedAt(); + + T visitCreatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponse.java b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponse.java new file mode 100644 index 00000000..580485ab --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponse.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListVerificationsResponse.Builder.class) +public final class ListVerificationsResponse { + private final Optional> data; + + private final Map additionalProperties; + + private ListVerificationsResponse( + Optional> data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public Optional> getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListVerificationsResponse && equalTo((ListVerificationsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListVerificationsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> data = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListVerificationsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(Optional> data) { + this.data = data; + return this; + } + + public Builder data(List data) { + this.data = Optional.ofNullable(data); + return this; + } + + public ListVerificationsResponse build() { + return new ListVerificationsResponse(data, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItem.java b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItem.java new file mode 100644 index 00000000..0e3a6316 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItem.java @@ -0,0 +1,820 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListVerificationsResponseDataItem.Builder.class) +public final class ListVerificationsResponseDataItem { + private final Optional address; + + private final Optional businessName; + + private final Optional businessStructure; + + private final Optional country; + + private final Optional createdAt; + + private final Optional dateOfBirth; + + private final Optional email; + + private final Optional firstName; + + private final Optional id; + + private final Optional kind; + + private final Optional lastName; + + private final Optional phone; + + private final Optional> requestedInformation; + + private final Optional> requiredDocuments; + + private final Optional sessionUrl; + + private final Optional status; + + private final Optional updatedAt; + + private final Map additionalProperties; + + private ListVerificationsResponseDataItem( + Optional address, + Optional businessName, + Optional businessStructure, + Optional country, + Optional createdAt, + Optional dateOfBirth, + Optional email, + Optional firstName, + Optional id, + Optional kind, + Optional lastName, + Optional phone, + Optional> requestedInformation, + Optional> requiredDocuments, + Optional sessionUrl, + Optional status, + Optional updatedAt, + Map additionalProperties) { + this.address = address; + this.businessName = businessName; + this.businessStructure = businessStructure; + this.country = country; + this.createdAt = createdAt; + this.dateOfBirth = dateOfBirth; + this.email = email; + this.firstName = firstName; + this.id = id; + this.kind = kind; + this.lastName = lastName; + this.phone = phone; + this.requestedInformation = requestedInformation; + this.requiredDocuments = requiredDocuments; + this.sessionUrl = sessionUrl; + this.status = status; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return Address on the verification profile. null when no address is set. + */ + @JsonIgnore + public Optional getAddress() { + if (address == null) { + return Optional.empty(); + } + return address; + } + + /** + * @return Legal business name. + */ + @JsonIgnore + public Optional getBusinessName() { + if (businessName == null) { + return Optional.empty(); + } + return businessName; + } + + /** + * @return Legal entity structure of the business, such as private_corporation or sole_proprietorship. Supported values vary by country of incorporation — see Business structures. + */ + @JsonIgnore + public Optional getBusinessStructure() { + if (businessStructure == null) { + return Optional.empty(); + } + return businessStructure; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return When the verification profile was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public Optional getCreatedAt() { + return createdAt; + } + + /** + * @return Formatted as YYYY-MM-DD. + */ + @JsonIgnore + public Optional getDateOfBirth() { + if (dateOfBirth == null) { + return Optional.empty(); + } + return dateOfBirth; + } + + /** + * @return Email address on the verification profile. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + @JsonIgnore + public Optional getFirstName() { + if (firstName == null) { + return Optional.empty(); + } + return firstName; + } + + /** + * @return Verification profile ID, prefixed idpf_. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonProperty("kind") + public Optional getKind() { + return kind; + } + + @JsonIgnore + public Optional getLastName() { + if (lastName == null) { + return Optional.empty(); + } + return lastName; + } + + /** + * @return Phone number on the verification profile. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + /** + * @return What Whop still needs before review can continue — one requirement per entry. Answer with Update Verification; nothing from the response is echoed back. Keys that don't apply are omitted. + */ + @JsonProperty("requested_information") + public Optional> getRequestedInformation() { + return requestedInformation; + } + + /** + * @return Documents for a document-upload verification and their progress. Present only on verifications created by sending documents. pending_upload documents were not accepted yet — send the full set again with another Create Verification call. + */ + @JsonProperty("required_documents") + public Optional> getRequiredDocuments() { + return requiredDocuments; + } + + /** + * @return Hosted verification session URL for the user to complete identity checks. Expires 7 days after creation. + */ + @JsonIgnore + public Optional getSessionUrl() { + if (sessionUrl == null) { + return Optional.empty(); + } + return sessionUrl; + } + + /** + * @return Current verification state. not_started before any session exists; pending while a session needs the user's input; processing while the provider's automated checks run on a fresh submission; action_required when requested_information needs answers; manual_review while information already sent is under review — an audit answer, or a document the payout provider holds — nothing to submit, usually done within 3 business days; approved on success; rejected on failure. Call Create Verification again to start a new session. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return When the verification profile was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public Optional getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("address") + private Optional _getAddress() { + return address; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_name") + private Optional _getBusinessName() { + return businessName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_structure") + private Optional _getBusinessStructure() { + return businessStructure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("date_of_birth") + private Optional _getDateOfBirth() { + return dateOfBirth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_name") + private Optional _getFirstName() { + return firstName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_name") + private Optional _getLastName() { + return lastName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("session_url") + private Optional _getSessionUrl() { + return sessionUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListVerificationsResponseDataItem && equalTo((ListVerificationsResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListVerificationsResponseDataItem other) { + return address.equals(other.address) + && businessName.equals(other.businessName) + && businessStructure.equals(other.businessStructure) + && country.equals(other.country) + && createdAt.equals(other.createdAt) + && dateOfBirth.equals(other.dateOfBirth) + && email.equals(other.email) + && firstName.equals(other.firstName) + && id.equals(other.id) + && kind.equals(other.kind) + && lastName.equals(other.lastName) + && phone.equals(other.phone) + && requestedInformation.equals(other.requestedInformation) + && requiredDocuments.equals(other.requiredDocuments) + && sessionUrl.equals(other.sessionUrl) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.address, + this.businessName, + this.businessStructure, + this.country, + this.createdAt, + this.dateOfBirth, + this.email, + this.firstName, + this.id, + this.kind, + this.lastName, + this.phone, + this.requestedInformation, + this.requiredDocuments, + this.sessionUrl, + this.status, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional address = Optional.empty(); + + private Optional businessName = Optional.empty(); + + private Optional businessStructure = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional dateOfBirth = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional kind = Optional.empty(); + + private Optional lastName = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional> requestedInformation = + Optional.empty(); + + private Optional> requiredDocuments = + Optional.empty(); + + private Optional sessionUrl = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional updatedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListVerificationsResponseDataItem other) { + address(other.getAddress()); + businessName(other.getBusinessName()); + businessStructure(other.getBusinessStructure()); + country(other.getCountry()); + createdAt(other.getCreatedAt()); + dateOfBirth(other.getDateOfBirth()); + email(other.getEmail()); + firstName(other.getFirstName()); + id(other.getId()); + kind(other.getKind()); + lastName(other.getLastName()); + phone(other.getPhone()); + requestedInformation(other.getRequestedInformation()); + requiredDocuments(other.getRequiredDocuments()); + sessionUrl(other.getSessionUrl()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

Address on the verification profile. null when no address is set.

+ */ + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public Builder address(Optional address) { + this.address = address; + return this; + } + + public Builder address(ListVerificationsResponseDataItemAddress address) { + this.address = Optional.ofNullable(address); + return this; + } + + public Builder address(Nullable address) { + if (address.isNull()) { + this.address = null; + } else if (address.isEmpty()) { + this.address = Optional.empty(); + } else { + this.address = Optional.of(address.get()); + } + return this; + } + + /** + *

Legal business name.

+ */ + @JsonSetter(value = "business_name", nulls = Nulls.SKIP) + public Builder businessName(Optional businessName) { + this.businessName = businessName; + return this; + } + + public Builder businessName(String businessName) { + this.businessName = Optional.ofNullable(businessName); + return this; + } + + public Builder businessName(Nullable businessName) { + if (businessName.isNull()) { + this.businessName = null; + } else if (businessName.isEmpty()) { + this.businessName = Optional.empty(); + } else { + this.businessName = Optional.of(businessName.get()); + } + return this; + } + + /** + *

Legal entity structure of the business, such as private_corporation or sole_proprietorship. Supported values vary by country of incorporation — see Business structures.

+ */ + @JsonSetter(value = "business_structure", nulls = Nulls.SKIP) + public Builder businessStructure(Optional businessStructure) { + this.businessStructure = businessStructure; + return this; + } + + public Builder businessStructure(String businessStructure) { + this.businessStructure = Optional.ofNullable(businessStructure); + return this; + } + + public Builder businessStructure(Nullable businessStructure) { + if (businessStructure.isNull()) { + this.businessStructure = null; + } else if (businessStructure.isEmpty()) { + this.businessStructure = Optional.empty(); + } else { + this.businessStructure = Optional.of(businessStructure.get()); + } + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

When the verification profile was created, as an ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public Builder createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder createdAt(String createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

Formatted as YYYY-MM-DD.

+ */ + @JsonSetter(value = "date_of_birth", nulls = Nulls.SKIP) + public Builder dateOfBirth(Optional dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + public Builder dateOfBirth(String dateOfBirth) { + this.dateOfBirth = Optional.ofNullable(dateOfBirth); + return this; + } + + public Builder dateOfBirth(Nullable dateOfBirth) { + if (dateOfBirth.isNull()) { + this.dateOfBirth = null; + } else if (dateOfBirth.isEmpty()) { + this.dateOfBirth = Optional.empty(); + } else { + this.dateOfBirth = Optional.of(dateOfBirth.get()); + } + return this; + } + + /** + *

Email address on the verification profile.

+ */ + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + public Builder email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public Builder firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + public Builder firstName(Nullable firstName) { + if (firstName.isNull()) { + this.firstName = null; + } else if (firstName.isEmpty()) { + this.firstName = Optional.empty(); + } else { + this.firstName = Optional.of(firstName.get()); + } + return this; + } + + /** + *

Verification profile ID, prefixed idpf_.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "kind", nulls = Nulls.SKIP) + public Builder kind(Optional kind) { + this.kind = kind; + return this; + } + + public Builder kind(ListVerificationsResponseDataItemKind kind) { + this.kind = Optional.ofNullable(kind); + return this; + } + + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public Builder lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + public Builder lastName(Nullable lastName) { + if (lastName.isNull()) { + this.lastName = null; + } else if (lastName.isEmpty()) { + this.lastName = Optional.empty(); + } else { + this.lastName = Optional.of(lastName.get()); + } + return this; + } + + /** + *

Phone number on the verification profile.

+ */ + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + public Builder phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

What Whop still needs before review can continue — one requirement per entry. Answer with Update Verification; nothing from the response is echoed back. Keys that don't apply are omitted.

+ */ + @JsonSetter(value = "requested_information", nulls = Nulls.SKIP) + public Builder requestedInformation( + Optional> requestedInformation) { + this.requestedInformation = requestedInformation; + return this; + } + + public Builder requestedInformation( + List requestedInformation) { + this.requestedInformation = Optional.ofNullable(requestedInformation); + return this; + } + + /** + *

Documents for a document-upload verification and their progress. Present only on verifications created by sending documents. pending_upload documents were not accepted yet — send the full set again with another Create Verification call.

+ */ + @JsonSetter(value = "required_documents", nulls = Nulls.SKIP) + public Builder requiredDocuments( + Optional> requiredDocuments) { + this.requiredDocuments = requiredDocuments; + return this; + } + + public Builder requiredDocuments( + List requiredDocuments) { + this.requiredDocuments = Optional.ofNullable(requiredDocuments); + return this; + } + + /** + *

Hosted verification session URL for the user to complete identity checks. Expires 7 days after creation.

+ */ + @JsonSetter(value = "session_url", nulls = Nulls.SKIP) + public Builder sessionUrl(Optional sessionUrl) { + this.sessionUrl = sessionUrl; + return this; + } + + public Builder sessionUrl(String sessionUrl) { + this.sessionUrl = Optional.ofNullable(sessionUrl); + return this; + } + + public Builder sessionUrl(Nullable sessionUrl) { + if (sessionUrl.isNull()) { + this.sessionUrl = null; + } else if (sessionUrl.isEmpty()) { + this.sessionUrl = Optional.empty(); + } else { + this.sessionUrl = Optional.of(sessionUrl.get()); + } + return this; + } + + /** + *

Current verification state. not_started before any session exists; pending while a session needs the user's input; processing while the provider's automated checks run on a fresh submission; action_required when requested_information needs answers; manual_review while information already sent is under review — an audit answer, or a document the payout provider holds — nothing to submit, usually done within 3 business days; approved on success; rejected on failure. Call Create Verification again to start a new session.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListVerificationsResponseDataItemStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

When the verification profile was last updated, as an ISO 8601 timestamp.

+ */ + @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) + public Builder updatedAt(Optional updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder updatedAt(String updatedAt) { + this.updatedAt = Optional.ofNullable(updatedAt); + return this; + } + + public ListVerificationsResponseDataItem build() { + return new ListVerificationsResponseDataItem( + address, + businessName, + businessStructure, + country, + createdAt, + dateOfBirth, + email, + firstName, + id, + kind, + lastName, + phone, + requestedInformation, + requiredDocuments, + sessionUrl, + status, + updatedAt, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemAddress.java b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemAddress.java new file mode 100644 index 00000000..2c50d18d --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemAddress.java @@ -0,0 +1,362 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListVerificationsResponseDataItemAddress.Builder.class) +public final class ListVerificationsResponseDataItemAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private ListVerificationsResponseDataItemAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return First line of the street address. + */ + @JsonProperty("line1") + public Optional getLine1() { + return line1; + } + + /** + * @return Second line of the street address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Postal or ZIP code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return State, province, or region code, for example CA. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListVerificationsResponseDataItemAddress + && equalTo((ListVerificationsResponseDataItemAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListVerificationsResponseDataItemAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListVerificationsResponseDataItemAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

First line of the street address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + /** + *

Second line of the street address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Postal or ZIP code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

State, province, or region code, for example CA.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public ListVerificationsResponseDataItemAddress build() { + return new ListVerificationsResponseDataItemAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemKind.java b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemKind.java new file mode 100644 index 00000000..3b9ae740 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemKind.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListVerificationsResponseDataItemKind { + public static final ListVerificationsResponseDataItemKind INDIVIDUAL = + new ListVerificationsResponseDataItemKind(Value.INDIVIDUAL, "individual"); + + public static final ListVerificationsResponseDataItemKind BUSINESS = + new ListVerificationsResponseDataItemKind(Value.BUSINESS, "business"); + + private final Value value; + + private final String string; + + ListVerificationsResponseDataItemKind(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListVerificationsResponseDataItemKind + && this.string.equals(((ListVerificationsResponseDataItemKind) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INDIVIDUAL: + return visitor.visitIndividual(); + case BUSINESS: + return visitor.visitBusiness(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListVerificationsResponseDataItemKind valueOf(String value) { + switch (value) { + case "individual": + return INDIVIDUAL; + case "business": + return BUSINESS; + default: + return new ListVerificationsResponseDataItemKind(Value.UNKNOWN, value); + } + } + + public enum Value { + INDIVIDUAL, + + BUSINESS, + + UNKNOWN + } + + public interface Visitor { + T visitIndividual(); + + T visitBusiness(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemRequestedInformationItem.java b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemRequestedInformationItem.java new file mode 100644 index 00000000..5069ad73 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemRequestedInformationItem.java @@ -0,0 +1,372 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListVerificationsResponseDataItemRequestedInformationItem.Builder.class) +public final class ListVerificationsResponseDataItemRequestedInformationItem { + private final Optional> errors; + + private final String id; + + private final String label; + + private final Optional optional; + + private final Optional> options; + + private final String requirement; + + private final String type; + + private final Map additionalProperties; + + private ListVerificationsResponseDataItemRequestedInformationItem( + Optional> errors, + String id, + String label, + Optional optional, + Optional> options, + String requirement, + String type, + Map additionalProperties) { + this.errors = errors; + this.id = id; + this.label = label; + this.optional = optional; + this.options = options; + this.requirement = requirement; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Present after a rejected submission. + */ + @JsonProperty("errors") + public Optional> getErrors() { + return errors; + } + + /** + * @return Requested information item ID, prefixed inrqi_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Instruction to show the user. Carries the reviewer's note verbatim when there is one. + */ + @JsonProperty("label") + public String getLabel() { + return label; + } + + /** + * @return true when the item can be skipped. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make. + */ + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + + /** + * @return What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type. + */ + @JsonProperty("requirement") + public String getRequirement() { + return requirement; + } + + /** + * @return What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address). + */ + @JsonProperty("type") + public String getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListVerificationsResponseDataItemRequestedInformationItem + && equalTo((ListVerificationsResponseDataItemRequestedInformationItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListVerificationsResponseDataItemRequestedInformationItem other) { + return errors.equals(other.errors) + && id.equals(other.id) + && label.equals(other.label) + && optional.equals(other.optional) + && options.equals(other.options) + && requirement.equals(other.requirement) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.errors, this.id, this.label, this.optional, this.options, this.requirement, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Requested information item ID, prefixed inrqi_.

+ */ + LabelStage id(@NotNull String id); + + Builder from(ListVerificationsResponseDataItemRequestedInformationItem other); + } + + public interface LabelStage { + /** + *

Instruction to show the user. Carries the reviewer's note verbatim when there is one.

+ */ + RequirementStage label(@NotNull String label); + } + + public interface RequirementStage { + /** + *

What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type.

+ */ + TypeStage requirement(@NotNull String requirement); + } + + public interface TypeStage { + /** + *

What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address).

+ */ + _FinalStage type(@NotNull String type); + } + + public interface _FinalStage { + ListVerificationsResponseDataItemRequestedInformationItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Present after a rejected submission.

+ */ + _FinalStage errors(Optional> errors); + + _FinalStage errors(List errors); + + /** + *

true when the item can be skipped.

+ */ + _FinalStage optional(Optional optional); + + _FinalStage optional(Boolean optional); + + /** + *

The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make.

+ */ + _FinalStage options(Optional> options); + + _FinalStage options(List options); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, LabelStage, RequirementStage, TypeStage, _FinalStage { + private String id; + + private String label; + + private String requirement; + + private String type; + + private Optional> options = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional> errors = + Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListVerificationsResponseDataItemRequestedInformationItem other) { + errors(other.getErrors()); + id(other.getId()); + label(other.getLabel()); + optional(other.getOptional()); + options(other.getOptions()); + requirement(other.getRequirement()); + type(other.getType()); + return this; + } + + /** + *

Requested information item ID, prefixed inrqi_.

+ *

Requested information item ID, prefixed inrqi_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LabelStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Instruction to show the user. Carries the reviewer's note verbatim when there is one.

+ *

Instruction to show the user. Carries the reviewer's note verbatim when there is one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("label") + public RequirementStage label(@NotNull String label) { + this.label = Objects.requireNonNull(label, "label must not be null"); + return this; + } + + /** + *

What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type.

+ *

What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("requirement") + public TypeStage requirement(@NotNull String requirement) { + this.requirement = Objects.requireNonNull(requirement, "requirement must not be null"); + return this; + } + + /** + *

What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address).

+ *

What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + /** + *

The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make.

+ */ + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional> options) { + this.options = options; + return this; + } + + /** + *

true when the item can be skipped.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

true when the item can be skipped.

+ */ + @java.lang.Override + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public _FinalStage optional(Optional optional) { + this.optional = optional; + return this; + } + + /** + *

Present after a rejected submission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errors(List errors) { + this.errors = Optional.ofNullable(errors); + return this; + } + + /** + *

Present after a rejected submission.

+ */ + @java.lang.Override + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public _FinalStage errors( + Optional> errors) { + this.errors = errors; + return this; + } + + @java.lang.Override + public ListVerificationsResponseDataItemRequestedInformationItem build() { + return new ListVerificationsResponseDataItemRequestedInformationItem( + errors, id, label, optional, options, requirement, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemRequestedInformationItemErrorsItem.java b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemRequestedInformationItemErrorsItem.java new file mode 100644 index 00000000..6ad399a3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemRequestedInformationItemErrorsItem.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListVerificationsResponseDataItemRequestedInformationItemErrorsItem.Builder.class) +public final class ListVerificationsResponseDataItemRequestedInformationItemErrorsItem { + private final Optional code; + + private final Optional reason; + + private final Map additionalProperties; + + private ListVerificationsResponseDataItemRequestedInformationItemErrorsItem( + Optional code, Optional reason, Map additionalProperties) { + this.code = code; + this.reason = reason; + this.additionalProperties = additionalProperties; + } + + /** + * @return Stable error code. + */ + @JsonProperty("code") + public Optional getCode() { + return code; + } + + /** + * @return Why it was rejected. + */ + @JsonProperty("reason") + public Optional getReason() { + return reason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListVerificationsResponseDataItemRequestedInformationItemErrorsItem + && equalTo((ListVerificationsResponseDataItemRequestedInformationItemErrorsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListVerificationsResponseDataItemRequestedInformationItemErrorsItem other) { + return code.equals(other.code) && reason.equals(other.reason); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.reason); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional code = Optional.empty(); + + private Optional reason = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListVerificationsResponseDataItemRequestedInformationItemErrorsItem other) { + code(other.getCode()); + reason(other.getReason()); + return this; + } + + /** + *

Stable error code.

+ */ + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public Builder code(Optional code) { + this.code = code; + return this; + } + + public Builder code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

Why it was rejected.

+ */ + @JsonSetter(value = "reason", nulls = Nulls.SKIP) + public Builder reason(Optional reason) { + this.reason = reason; + return this; + } + + public Builder reason(String reason) { + this.reason = Optional.ofNullable(reason); + return this; + } + + public ListVerificationsResponseDataItemRequestedInformationItemErrorsItem build() { + return new ListVerificationsResponseDataItemRequestedInformationItemErrorsItem( + code, reason, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemRequiredDocumentsItem.java b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemRequiredDocumentsItem.java new file mode 100644 index 00000000..f6f1655c --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemRequiredDocumentsItem.java @@ -0,0 +1,198 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListVerificationsResponseDataItemRequiredDocumentsItem.Builder.class) +public final class ListVerificationsResponseDataItemRequiredDocumentsItem { + private final Optional document; + + private final Optional rejectionReason; + + private final Optional status; + + private final Map additionalProperties; + + private ListVerificationsResponseDataItemRequiredDocumentsItem( + Optional document, + Optional rejectionReason, + Optional status, + Map additionalProperties) { + this.document = document; + this.rejectionReason = rejectionReason; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Document slot key, such as id_card_front, id_card_back, or selfie. + */ + @JsonProperty("document") + public Optional getDocument() { + return document; + } + + /** + * @return Why the previous submission was rejected, when the provider requested new documents or declined the verification. + */ + @JsonIgnore + public Optional getRejectionReason() { + if (rejectionReason == null) { + return Optional.empty(); + } + return rejectionReason; + } + + /** + * @return pending_upload until the document has been relayed for review; submitted afterwards. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("rejection_reason") + private Optional _getRejectionReason() { + return rejectionReason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListVerificationsResponseDataItemRequiredDocumentsItem + && equalTo((ListVerificationsResponseDataItemRequiredDocumentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListVerificationsResponseDataItemRequiredDocumentsItem other) { + return document.equals(other.document) + && rejectionReason.equals(other.rejectionReason) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.document, this.rejectionReason, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional document = Optional.empty(); + + private Optional rejectionReason = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListVerificationsResponseDataItemRequiredDocumentsItem other) { + document(other.getDocument()); + rejectionReason(other.getRejectionReason()); + status(other.getStatus()); + return this; + } + + /** + *

Document slot key, such as id_card_front, id_card_back, or selfie.

+ */ + @JsonSetter(value = "document", nulls = Nulls.SKIP) + public Builder document(Optional document) { + this.document = document; + return this; + } + + public Builder document(String document) { + this.document = Optional.ofNullable(document); + return this; + } + + /** + *

Why the previous submission was rejected, when the provider requested new documents or declined the verification.

+ */ + @JsonSetter(value = "rejection_reason", nulls = Nulls.SKIP) + public Builder rejectionReason(Optional rejectionReason) { + this.rejectionReason = rejectionReason; + return this; + } + + public Builder rejectionReason(String rejectionReason) { + this.rejectionReason = Optional.ofNullable(rejectionReason); + return this; + } + + public Builder rejectionReason(Nullable rejectionReason) { + if (rejectionReason.isNull()) { + this.rejectionReason = null; + } else if (rejectionReason.isEmpty()) { + this.rejectionReason = Optional.empty(); + } else { + this.rejectionReason = Optional.of(rejectionReason.get()); + } + return this; + } + + /** + *

pending_upload until the document has been relayed for review; submitted afterwards.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ListVerificationsResponseDataItemRequiredDocumentsItemStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public ListVerificationsResponseDataItemRequiredDocumentsItem build() { + return new ListVerificationsResponseDataItemRequiredDocumentsItem( + document, rejectionReason, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemRequiredDocumentsItemStatus.java b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemRequiredDocumentsItemStatus.java new file mode 100644 index 00000000..dcc578fd --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemRequiredDocumentsItemStatus.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListVerificationsResponseDataItemRequiredDocumentsItemStatus { + public static final ListVerificationsResponseDataItemRequiredDocumentsItemStatus PENDING_UPLOAD = + new ListVerificationsResponseDataItemRequiredDocumentsItemStatus(Value.PENDING_UPLOAD, "pending_upload"); + + public static final ListVerificationsResponseDataItemRequiredDocumentsItemStatus SUBMITTED = + new ListVerificationsResponseDataItemRequiredDocumentsItemStatus(Value.SUBMITTED, "submitted"); + + private final Value value; + + private final String string; + + ListVerificationsResponseDataItemRequiredDocumentsItemStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListVerificationsResponseDataItemRequiredDocumentsItemStatus + && this.string.equals( + ((ListVerificationsResponseDataItemRequiredDocumentsItemStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING_UPLOAD: + return visitor.visitPendingUpload(); + case SUBMITTED: + return visitor.visitSubmitted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListVerificationsResponseDataItemRequiredDocumentsItemStatus valueOf(String value) { + switch (value) { + case "pending_upload": + return PENDING_UPLOAD; + case "submitted": + return SUBMITTED; + default: + return new ListVerificationsResponseDataItemRequiredDocumentsItemStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING_UPLOAD, + + SUBMITTED, + + UNKNOWN + } + + public interface Visitor { + T visitPendingUpload(); + + T visitSubmitted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemStatus.java b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemStatus.java new file mode 100644 index 00000000..d2987ced --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/ListVerificationsResponseDataItemStatus.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListVerificationsResponseDataItemStatus { + public static final ListVerificationsResponseDataItemStatus APPROVED = + new ListVerificationsResponseDataItemStatus(Value.APPROVED, "approved"); + + public static final ListVerificationsResponseDataItemStatus MANUAL_REVIEW = + new ListVerificationsResponseDataItemStatus(Value.MANUAL_REVIEW, "manual_review"); + + public static final ListVerificationsResponseDataItemStatus PENDING = + new ListVerificationsResponseDataItemStatus(Value.PENDING, "pending"); + + public static final ListVerificationsResponseDataItemStatus PROCESSING = + new ListVerificationsResponseDataItemStatus(Value.PROCESSING, "processing"); + + public static final ListVerificationsResponseDataItemStatus NOT_STARTED = + new ListVerificationsResponseDataItemStatus(Value.NOT_STARTED, "not_started"); + + public static final ListVerificationsResponseDataItemStatus REJECTED = + new ListVerificationsResponseDataItemStatus(Value.REJECTED, "rejected"); + + public static final ListVerificationsResponseDataItemStatus ACTION_REQUIRED = + new ListVerificationsResponseDataItemStatus(Value.ACTION_REQUIRED, "action_required"); + + private final Value value; + + private final String string; + + ListVerificationsResponseDataItemStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListVerificationsResponseDataItemStatus + && this.string.equals(((ListVerificationsResponseDataItemStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case MANUAL_REVIEW: + return visitor.visitManualReview(); + case PENDING: + return visitor.visitPending(); + case PROCESSING: + return visitor.visitProcessing(); + case NOT_STARTED: + return visitor.visitNotStarted(); + case REJECTED: + return visitor.visitRejected(); + case ACTION_REQUIRED: + return visitor.visitActionRequired(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListVerificationsResponseDataItemStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "manual_review": + return MANUAL_REVIEW; + case "pending": + return PENDING; + case "processing": + return PROCESSING; + case "not_started": + return NOT_STARTED; + case "rejected": + return REJECTED; + case "action_required": + return ACTION_REQUIRED; + default: + return new ListVerificationsResponseDataItemStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + NOT_STARTED, + + PENDING, + + PROCESSING, + + MANUAL_REVIEW, + + APPROVED, + + REJECTED, + + ACTION_REQUIRED, + + UNKNOWN + } + + public interface Visitor { + T visitNotStarted(); + + T visitPending(); + + T visitProcessing(); + + T visitManualReview(); + + T visitApproved(); + + T visitRejected(); + + T visitActionRequired(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/PostIdentityProfileUpdatedPayload.java b/src/main/java/com/whop/api/resources/verifications/types/PostIdentityProfileUpdatedPayload.java new file mode 100644 index 00000000..8d5f0d08 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/PostIdentityProfileUpdatedPayload.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostIdentityProfileUpdatedPayload.Builder.class) +public final class PostIdentityProfileUpdatedPayload { + private final Optional accountId; + + private final PostIdentityProfileUpdatedPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final PostIdentityProfileUpdatedPayloadData data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostIdentityProfileUpdatedPayloadType type; + + private final Map additionalProperties; + + private PostIdentityProfileUpdatedPayload( + Optional accountId, + PostIdentityProfileUpdatedPayloadApiVersion apiVersion, + Optional apiVersionDate, + PostIdentityProfileUpdatedPayloadData data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostIdentityProfileUpdatedPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostIdentityProfileUpdatedPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public PostIdentityProfileUpdatedPayloadData getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostIdentityProfileUpdatedPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostIdentityProfileUpdatedPayload && equalTo((PostIdentityProfileUpdatedPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostIdentityProfileUpdatedPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostIdentityProfileUpdatedPayloadApiVersion apiVersion); + + Builder from(PostIdentityProfileUpdatedPayload other); + } + + public interface DataStage { + IdStage data(@NotNull PostIdentityProfileUpdatedPayloadData data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostIdentityProfileUpdatedPayloadType type); + } + + public interface _FinalStage { + PostIdentityProfileUpdatedPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostIdentityProfileUpdatedPayloadApiVersion apiVersion; + + private PostIdentityProfileUpdatedPayloadData data; + + private String id; + + private OffsetDateTime timestamp; + + private PostIdentityProfileUpdatedPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostIdentityProfileUpdatedPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostIdentityProfileUpdatedPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull PostIdentityProfileUpdatedPayloadData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostIdentityProfileUpdatedPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostIdentityProfileUpdatedPayload build() { + return new PostIdentityProfileUpdatedPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/PostIdentityProfileUpdatedPayloadApiVersion.java b/src/main/java/com/whop/api/resources/verifications/types/PostIdentityProfileUpdatedPayloadApiVersion.java new file mode 100644 index 00000000..a6df5d59 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/PostIdentityProfileUpdatedPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostIdentityProfileUpdatedPayloadApiVersion { + public static final PostIdentityProfileUpdatedPayloadApiVersion V1 = + new PostIdentityProfileUpdatedPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostIdentityProfileUpdatedPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostIdentityProfileUpdatedPayloadApiVersion + && this.string.equals(((PostIdentityProfileUpdatedPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostIdentityProfileUpdatedPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostIdentityProfileUpdatedPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/PostIdentityProfileUpdatedPayloadData.java b/src/main/java/com/whop/api/resources/verifications/types/PostIdentityProfileUpdatedPayloadData.java new file mode 100644 index 00000000..86515590 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/PostIdentityProfileUpdatedPayloadData.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostIdentityProfileUpdatedPayloadData.Builder.class) +public final class PostIdentityProfileUpdatedPayloadData { + private final String id; + + private final Map additionalProperties; + + private PostIdentityProfileUpdatedPayloadData(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The identity profile id (idpf_). Re-fetch GET /verifications for its current state. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostIdentityProfileUpdatedPayloadData + && equalTo((PostIdentityProfileUpdatedPayloadData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostIdentityProfileUpdatedPayloadData other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The identity profile id (idpf_). Re-fetch GET /verifications for its current state.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PostIdentityProfileUpdatedPayloadData other); + } + + public interface _FinalStage { + PostIdentityProfileUpdatedPayloadData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostIdentityProfileUpdatedPayloadData other) { + id(other.getId()); + return this; + } + + /** + *

The identity profile id (idpf_). Re-fetch GET /verifications for its current state.

+ *

The identity profile id (idpf_). Re-fetch GET /verifications for its current state.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public PostIdentityProfileUpdatedPayloadData build() { + return new PostIdentityProfileUpdatedPayloadData(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/PostIdentityProfileUpdatedPayloadType.java b/src/main/java/com/whop/api/resources/verifications/types/PostIdentityProfileUpdatedPayloadType.java new file mode 100644 index 00000000..17492baf --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/PostIdentityProfileUpdatedPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostIdentityProfileUpdatedPayloadType { + public static final PostIdentityProfileUpdatedPayloadType IDENTITY_PROFILE_UPDATED = + new PostIdentityProfileUpdatedPayloadType(Value.IDENTITY_PROFILE_UPDATED, "identity_profile.updated"); + + private final Value value; + + private final String string; + + PostIdentityProfileUpdatedPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostIdentityProfileUpdatedPayloadType + && this.string.equals(((PostIdentityProfileUpdatedPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case IDENTITY_PROFILE_UPDATED: + return visitor.visitIdentityProfileUpdated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostIdentityProfileUpdatedPayloadType valueOf(String value) { + switch (value) { + case "identity_profile.updated": + return IDENTITY_PROFILE_UPDATED; + default: + return new PostIdentityProfileUpdatedPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + IDENTITY_PROFILE_UPDATED, + + UNKNOWN + } + + public interface Visitor { + T visitIdentityProfileUpdated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/PostVerificationSucceededPayload.java b/src/main/java/com/whop/api/resources/verifications/types/PostVerificationSucceededPayload.java new file mode 100644 index 00000000..983cb55b --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/PostVerificationSucceededPayload.java @@ -0,0 +1,468 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Verification; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PostVerificationSucceededPayload.Builder.class) +public final class PostVerificationSucceededPayload { + private final Optional accountId; + + private final PostVerificationSucceededPayloadApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final Verification data; + + private final String id; + + private final Optional> previousAttributes; + + private final OffsetDateTime timestamp; + + private final PostVerificationSucceededPayloadType type; + + private final Map additionalProperties; + + private PostVerificationSucceededPayload( + Optional accountId, + PostVerificationSucceededPayloadApiVersion apiVersion, + Optional apiVersionDate, + Verification data, + String id, + Optional> previousAttributes, + OffsetDateTime timestamp, + PostVerificationSucceededPayloadType type, + Map additionalProperties) { + this.accountId = accountId; + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.data = data; + this.id = id; + this.previousAttributes = previousAttributes; + this.timestamp = timestamp; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account ID that this webhook event is associated with + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The API version for this webhook + */ + @JsonProperty("api_version") + public PostVerificationSucceededPayloadApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) the payload is serialized to + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + @JsonProperty("data") + public Verification getData() { + return data; + } + + /** + * @return A unique ID for every single webhook request + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event + */ + @JsonProperty("previous_attributes") + public Optional> getPreviousAttributes() { + return previousAttributes; + } + + /** + * @return The timestamp in ISO 8601 format that the webhook was sent at on the server + */ + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + /** + * @return The webhook event type + */ + @JsonProperty("type") + public PostVerificationSucceededPayloadType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PostVerificationSucceededPayload && equalTo((PostVerificationSucceededPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PostVerificationSucceededPayload other) { + return accountId.equals(other.accountId) + && apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && data.equals(other.data) + && id.equals(other.id) + && previousAttributes.equals(other.previousAttributes) + && timestamp.equals(other.timestamp) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.apiVersion, + this.apiVersionDate, + this.data, + this.id, + this.previousAttributes, + this.timestamp, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version for this webhook

+ */ + DataStage apiVersion(@NotNull PostVerificationSucceededPayloadApiVersion apiVersion); + + Builder from(PostVerificationSucceededPayload other); + } + + public interface DataStage { + IdStage data(@NotNull Verification data); + } + + public interface IdStage { + /** + *

A unique ID for every single webhook request

+ */ + TimestampStage id(@NotNull String id); + } + + public interface TimestampStage { + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ */ + TypeStage timestamp(@NotNull OffsetDateTime timestamp); + } + + public interface TypeStage { + /** + *

The webhook event type

+ */ + _FinalStage type(@NotNull PostVerificationSucceededPayloadType type); + } + + public interface _FinalStage { + PostVerificationSucceededPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account ID that this webhook event is associated with

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + _FinalStage previousAttributes(Optional> previousAttributes); + + _FinalStage previousAttributes(Map previousAttributes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, DataStage, IdStage, TimestampStage, TypeStage, _FinalStage { + private PostVerificationSucceededPayloadApiVersion apiVersion; + + private Verification data; + + private String id; + + private OffsetDateTime timestamp; + + private PostVerificationSucceededPayloadType type; + + private Optional> previousAttributes = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PostVerificationSucceededPayload other) { + accountId(other.getAccountId()); + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + data(other.getData()); + id(other.getId()); + previousAttributes(other.getPreviousAttributes()); + timestamp(other.getTimestamp()); + type(other.getType()); + return this; + } + + /** + *

The API version for this webhook

+ *

The API version for this webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public DataStage apiVersion(@NotNull PostVerificationSucceededPayloadApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public IdStage data(@NotNull Verification data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

A unique ID for every single webhook request

+ *

A unique ID for every single webhook request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TimestampStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ *

The timestamp in ISO 8601 format that the webhook was sent at on the server

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp") + public TypeStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + /** + *

The webhook event type

+ *

The webhook event type

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PostVerificationSucceededPayloadType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previousAttributes(Map previousAttributes) { + this.previousAttributes = Optional.ofNullable(previousAttributes); + return this; + } + + /** + *

For some .updated events, the old values of the payload fields that changed, keyed by field name. Omitted when no capture is available for the event

+ */ + @java.lang.Override + @JsonSetter(value = "previous_attributes", nulls = Nulls.SKIP) + public _FinalStage previousAttributes(Optional> previousAttributes) { + this.previousAttributes = previousAttributes; + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) the payload is serialized to

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account ID that this webhook event is associated with

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PostVerificationSucceededPayload build() { + return new PostVerificationSucceededPayload( + accountId, + apiVersion, + apiVersionDate, + data, + id, + previousAttributes, + timestamp, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/PostVerificationSucceededPayloadApiVersion.java b/src/main/java/com/whop/api/resources/verifications/types/PostVerificationSucceededPayloadApiVersion.java new file mode 100644 index 00000000..8b4d21e4 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/PostVerificationSucceededPayloadApiVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostVerificationSucceededPayloadApiVersion { + public static final PostVerificationSucceededPayloadApiVersion V1 = + new PostVerificationSucceededPayloadApiVersion(Value.V1, "v1"); + + private final Value value; + + private final String string; + + PostVerificationSucceededPayloadApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostVerificationSucceededPayloadApiVersion + && this.string.equals(((PostVerificationSucceededPayloadApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V1: + return visitor.visitV1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostVerificationSucceededPayloadApiVersion valueOf(String value) { + switch (value) { + case "v1": + return V1; + default: + return new PostVerificationSucceededPayloadApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/PostVerificationSucceededPayloadType.java b/src/main/java/com/whop/api/resources/verifications/types/PostVerificationSucceededPayloadType.java new file mode 100644 index 00000000..455a7b8e --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/PostVerificationSucceededPayloadType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PostVerificationSucceededPayloadType { + public static final PostVerificationSucceededPayloadType VERIFICATION_SUCCEEDED = + new PostVerificationSucceededPayloadType(Value.VERIFICATION_SUCCEEDED, "verification.succeeded"); + + private final Value value; + + private final String string; + + PostVerificationSucceededPayloadType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PostVerificationSucceededPayloadType + && this.string.equals(((PostVerificationSucceededPayloadType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VERIFICATION_SUCCEEDED: + return visitor.visitVerificationSucceeded(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PostVerificationSucceededPayloadType valueOf(String value) { + switch (value) { + case "verification.succeeded": + return VERIFICATION_SUCCEEDED; + default: + return new PostVerificationSucceededPayloadType(Value.UNKNOWN, value); + } + } + + public enum Value { + VERIFICATION_SUCCEEDED, + + UNKNOWN + } + + public interface Visitor { + T visitVerificationSucceeded(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponse.java b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponse.java new file mode 100644 index 00000000..89bb4646 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponse.java @@ -0,0 +1,818 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveVerificationsResponse.Builder.class) +public final class RetrieveVerificationsResponse { + private final Optional address; + + private final Optional businessName; + + private final Optional businessStructure; + + private final Optional country; + + private final Optional createdAt; + + private final Optional dateOfBirth; + + private final Optional email; + + private final Optional firstName; + + private final Optional id; + + private final Optional kind; + + private final Optional lastName; + + private final Optional phone; + + private final Optional> requestedInformation; + + private final Optional> requiredDocuments; + + private final Optional sessionUrl; + + private final Optional status; + + private final Optional updatedAt; + + private final Map additionalProperties; + + private RetrieveVerificationsResponse( + Optional address, + Optional businessName, + Optional businessStructure, + Optional country, + Optional createdAt, + Optional dateOfBirth, + Optional email, + Optional firstName, + Optional id, + Optional kind, + Optional lastName, + Optional phone, + Optional> requestedInformation, + Optional> requiredDocuments, + Optional sessionUrl, + Optional status, + Optional updatedAt, + Map additionalProperties) { + this.address = address; + this.businessName = businessName; + this.businessStructure = businessStructure; + this.country = country; + this.createdAt = createdAt; + this.dateOfBirth = dateOfBirth; + this.email = email; + this.firstName = firstName; + this.id = id; + this.kind = kind; + this.lastName = lastName; + this.phone = phone; + this.requestedInformation = requestedInformation; + this.requiredDocuments = requiredDocuments; + this.sessionUrl = sessionUrl; + this.status = status; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return Address on the verification profile. null when no address is set. + */ + @JsonIgnore + public Optional getAddress() { + if (address == null) { + return Optional.empty(); + } + return address; + } + + /** + * @return Legal business name. + */ + @JsonIgnore + public Optional getBusinessName() { + if (businessName == null) { + return Optional.empty(); + } + return businessName; + } + + /** + * @return Legal entity structure of the business, such as private_corporation or sole_proprietorship. Supported values vary by country of incorporation — see Business structures. + */ + @JsonIgnore + public Optional getBusinessStructure() { + if (businessStructure == null) { + return Optional.empty(); + } + return businessStructure; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return When the verification profile was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public Optional getCreatedAt() { + return createdAt; + } + + /** + * @return Formatted as YYYY-MM-DD. + */ + @JsonIgnore + public Optional getDateOfBirth() { + if (dateOfBirth == null) { + return Optional.empty(); + } + return dateOfBirth; + } + + /** + * @return Email address on the verification profile. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + @JsonIgnore + public Optional getFirstName() { + if (firstName == null) { + return Optional.empty(); + } + return firstName; + } + + /** + * @return Verification profile ID, prefixed idpf_. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonProperty("kind") + public Optional getKind() { + return kind; + } + + @JsonIgnore + public Optional getLastName() { + if (lastName == null) { + return Optional.empty(); + } + return lastName; + } + + /** + * @return Phone number on the verification profile. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + /** + * @return What Whop still needs before review can continue — one requirement per entry. Answer with Update Verification; nothing from the response is echoed back. Keys that don't apply are omitted. + */ + @JsonProperty("requested_information") + public Optional> getRequestedInformation() { + return requestedInformation; + } + + /** + * @return Documents for a document-upload verification and their progress. Present only on verifications created by sending documents. pending_upload documents were not accepted yet — send the full set again with another Create Verification call. + */ + @JsonProperty("required_documents") + public Optional> getRequiredDocuments() { + return requiredDocuments; + } + + /** + * @return Hosted verification session URL for the user to complete identity checks. Expires 7 days after creation. + */ + @JsonIgnore + public Optional getSessionUrl() { + if (sessionUrl == null) { + return Optional.empty(); + } + return sessionUrl; + } + + /** + * @return Current verification state. not_started before any session exists; pending while a session needs the user's input; processing while the provider's automated checks run on a fresh submission; action_required when requested_information needs answers; manual_review while information already sent is under review — an audit answer, or a document the payout provider holds — nothing to submit, usually done within 3 business days; approved on success; rejected on failure. Call Create Verification again to start a new session. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return When the verification profile was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public Optional getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("address") + private Optional _getAddress() { + return address; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_name") + private Optional _getBusinessName() { + return businessName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_structure") + private Optional _getBusinessStructure() { + return businessStructure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("date_of_birth") + private Optional _getDateOfBirth() { + return dateOfBirth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_name") + private Optional _getFirstName() { + return firstName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_name") + private Optional _getLastName() { + return lastName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("session_url") + private Optional _getSessionUrl() { + return sessionUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveVerificationsResponse && equalTo((RetrieveVerificationsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveVerificationsResponse other) { + return address.equals(other.address) + && businessName.equals(other.businessName) + && businessStructure.equals(other.businessStructure) + && country.equals(other.country) + && createdAt.equals(other.createdAt) + && dateOfBirth.equals(other.dateOfBirth) + && email.equals(other.email) + && firstName.equals(other.firstName) + && id.equals(other.id) + && kind.equals(other.kind) + && lastName.equals(other.lastName) + && phone.equals(other.phone) + && requestedInformation.equals(other.requestedInformation) + && requiredDocuments.equals(other.requiredDocuments) + && sessionUrl.equals(other.sessionUrl) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.address, + this.businessName, + this.businessStructure, + this.country, + this.createdAt, + this.dateOfBirth, + this.email, + this.firstName, + this.id, + this.kind, + this.lastName, + this.phone, + this.requestedInformation, + this.requiredDocuments, + this.sessionUrl, + this.status, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional address = Optional.empty(); + + private Optional businessName = Optional.empty(); + + private Optional businessStructure = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional dateOfBirth = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional kind = Optional.empty(); + + private Optional lastName = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional> requestedInformation = + Optional.empty(); + + private Optional> requiredDocuments = Optional.empty(); + + private Optional sessionUrl = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional updatedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveVerificationsResponse other) { + address(other.getAddress()); + businessName(other.getBusinessName()); + businessStructure(other.getBusinessStructure()); + country(other.getCountry()); + createdAt(other.getCreatedAt()); + dateOfBirth(other.getDateOfBirth()); + email(other.getEmail()); + firstName(other.getFirstName()); + id(other.getId()); + kind(other.getKind()); + lastName(other.getLastName()); + phone(other.getPhone()); + requestedInformation(other.getRequestedInformation()); + requiredDocuments(other.getRequiredDocuments()); + sessionUrl(other.getSessionUrl()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

Address on the verification profile. null when no address is set.

+ */ + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public Builder address(Optional address) { + this.address = address; + return this; + } + + public Builder address(RetrieveVerificationsResponseAddress address) { + this.address = Optional.ofNullable(address); + return this; + } + + public Builder address(Nullable address) { + if (address.isNull()) { + this.address = null; + } else if (address.isEmpty()) { + this.address = Optional.empty(); + } else { + this.address = Optional.of(address.get()); + } + return this; + } + + /** + *

Legal business name.

+ */ + @JsonSetter(value = "business_name", nulls = Nulls.SKIP) + public Builder businessName(Optional businessName) { + this.businessName = businessName; + return this; + } + + public Builder businessName(String businessName) { + this.businessName = Optional.ofNullable(businessName); + return this; + } + + public Builder businessName(Nullable businessName) { + if (businessName.isNull()) { + this.businessName = null; + } else if (businessName.isEmpty()) { + this.businessName = Optional.empty(); + } else { + this.businessName = Optional.of(businessName.get()); + } + return this; + } + + /** + *

Legal entity structure of the business, such as private_corporation or sole_proprietorship. Supported values vary by country of incorporation — see Business structures.

+ */ + @JsonSetter(value = "business_structure", nulls = Nulls.SKIP) + public Builder businessStructure(Optional businessStructure) { + this.businessStructure = businessStructure; + return this; + } + + public Builder businessStructure(String businessStructure) { + this.businessStructure = Optional.ofNullable(businessStructure); + return this; + } + + public Builder businessStructure(Nullable businessStructure) { + if (businessStructure.isNull()) { + this.businessStructure = null; + } else if (businessStructure.isEmpty()) { + this.businessStructure = Optional.empty(); + } else { + this.businessStructure = Optional.of(businessStructure.get()); + } + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

When the verification profile was created, as an ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public Builder createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder createdAt(String createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

Formatted as YYYY-MM-DD.

+ */ + @JsonSetter(value = "date_of_birth", nulls = Nulls.SKIP) + public Builder dateOfBirth(Optional dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + public Builder dateOfBirth(String dateOfBirth) { + this.dateOfBirth = Optional.ofNullable(dateOfBirth); + return this; + } + + public Builder dateOfBirth(Nullable dateOfBirth) { + if (dateOfBirth.isNull()) { + this.dateOfBirth = null; + } else if (dateOfBirth.isEmpty()) { + this.dateOfBirth = Optional.empty(); + } else { + this.dateOfBirth = Optional.of(dateOfBirth.get()); + } + return this; + } + + /** + *

Email address on the verification profile.

+ */ + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + public Builder email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public Builder firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + public Builder firstName(Nullable firstName) { + if (firstName.isNull()) { + this.firstName = null; + } else if (firstName.isEmpty()) { + this.firstName = Optional.empty(); + } else { + this.firstName = Optional.of(firstName.get()); + } + return this; + } + + /** + *

Verification profile ID, prefixed idpf_.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "kind", nulls = Nulls.SKIP) + public Builder kind(Optional kind) { + this.kind = kind; + return this; + } + + public Builder kind(RetrieveVerificationsResponseKind kind) { + this.kind = Optional.ofNullable(kind); + return this; + } + + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public Builder lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + public Builder lastName(Nullable lastName) { + if (lastName.isNull()) { + this.lastName = null; + } else if (lastName.isEmpty()) { + this.lastName = Optional.empty(); + } else { + this.lastName = Optional.of(lastName.get()); + } + return this; + } + + /** + *

Phone number on the verification profile.

+ */ + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + public Builder phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

What Whop still needs before review can continue — one requirement per entry. Answer with Update Verification; nothing from the response is echoed back. Keys that don't apply are omitted.

+ */ + @JsonSetter(value = "requested_information", nulls = Nulls.SKIP) + public Builder requestedInformation( + Optional> requestedInformation) { + this.requestedInformation = requestedInformation; + return this; + } + + public Builder requestedInformation( + List requestedInformation) { + this.requestedInformation = Optional.ofNullable(requestedInformation); + return this; + } + + /** + *

Documents for a document-upload verification and their progress. Present only on verifications created by sending documents. pending_upload documents were not accepted yet — send the full set again with another Create Verification call.

+ */ + @JsonSetter(value = "required_documents", nulls = Nulls.SKIP) + public Builder requiredDocuments( + Optional> requiredDocuments) { + this.requiredDocuments = requiredDocuments; + return this; + } + + public Builder requiredDocuments(List requiredDocuments) { + this.requiredDocuments = Optional.ofNullable(requiredDocuments); + return this; + } + + /** + *

Hosted verification session URL for the user to complete identity checks. Expires 7 days after creation.

+ */ + @JsonSetter(value = "session_url", nulls = Nulls.SKIP) + public Builder sessionUrl(Optional sessionUrl) { + this.sessionUrl = sessionUrl; + return this; + } + + public Builder sessionUrl(String sessionUrl) { + this.sessionUrl = Optional.ofNullable(sessionUrl); + return this; + } + + public Builder sessionUrl(Nullable sessionUrl) { + if (sessionUrl.isNull()) { + this.sessionUrl = null; + } else if (sessionUrl.isEmpty()) { + this.sessionUrl = Optional.empty(); + } else { + this.sessionUrl = Optional.of(sessionUrl.get()); + } + return this; + } + + /** + *

Current verification state. not_started before any session exists; pending while a session needs the user's input; processing while the provider's automated checks run on a fresh submission; action_required when requested_information needs answers; manual_review while information already sent is under review — an audit answer, or a document the payout provider holds — nothing to submit, usually done within 3 business days; approved on success; rejected on failure. Call Create Verification again to start a new session.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(RetrieveVerificationsResponseStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

When the verification profile was last updated, as an ISO 8601 timestamp.

+ */ + @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) + public Builder updatedAt(Optional updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder updatedAt(String updatedAt) { + this.updatedAt = Optional.ofNullable(updatedAt); + return this; + } + + public RetrieveVerificationsResponse build() { + return new RetrieveVerificationsResponse( + address, + businessName, + businessStructure, + country, + createdAt, + dateOfBirth, + email, + firstName, + id, + kind, + lastName, + phone, + requestedInformation, + requiredDocuments, + sessionUrl, + status, + updatedAt, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseAddress.java b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseAddress.java new file mode 100644 index 00000000..74ff5524 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseAddress.java @@ -0,0 +1,362 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveVerificationsResponseAddress.Builder.class) +public final class RetrieveVerificationsResponseAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private RetrieveVerificationsResponseAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return First line of the street address. + */ + @JsonProperty("line1") + public Optional getLine1() { + return line1; + } + + /** + * @return Second line of the street address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Postal or ZIP code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return State, province, or region code, for example CA. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveVerificationsResponseAddress + && equalTo((RetrieveVerificationsResponseAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveVerificationsResponseAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveVerificationsResponseAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

First line of the street address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + /** + *

Second line of the street address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Postal or ZIP code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

State, province, or region code, for example CA.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public RetrieveVerificationsResponseAddress build() { + return new RetrieveVerificationsResponseAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseKind.java b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseKind.java new file mode 100644 index 00000000..fc1287d5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseKind.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveVerificationsResponseKind { + public static final RetrieveVerificationsResponseKind INDIVIDUAL = + new RetrieveVerificationsResponseKind(Value.INDIVIDUAL, "individual"); + + public static final RetrieveVerificationsResponseKind BUSINESS = + new RetrieveVerificationsResponseKind(Value.BUSINESS, "business"); + + private final Value value; + + private final String string; + + RetrieveVerificationsResponseKind(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveVerificationsResponseKind + && this.string.equals(((RetrieveVerificationsResponseKind) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INDIVIDUAL: + return visitor.visitIndividual(); + case BUSINESS: + return visitor.visitBusiness(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveVerificationsResponseKind valueOf(String value) { + switch (value) { + case "individual": + return INDIVIDUAL; + case "business": + return BUSINESS; + default: + return new RetrieveVerificationsResponseKind(Value.UNKNOWN, value); + } + } + + public enum Value { + INDIVIDUAL, + + BUSINESS, + + UNKNOWN + } + + public interface Visitor { + T visitIndividual(); + + T visitBusiness(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseRequestedInformationItem.java b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseRequestedInformationItem.java new file mode 100644 index 00000000..16133e6d --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseRequestedInformationItem.java @@ -0,0 +1,372 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveVerificationsResponseRequestedInformationItem.Builder.class) +public final class RetrieveVerificationsResponseRequestedInformationItem { + private final Optional> errors; + + private final String id; + + private final String label; + + private final Optional optional; + + private final Optional> options; + + private final String requirement; + + private final String type; + + private final Map additionalProperties; + + private RetrieveVerificationsResponseRequestedInformationItem( + Optional> errors, + String id, + String label, + Optional optional, + Optional> options, + String requirement, + String type, + Map additionalProperties) { + this.errors = errors; + this.id = id; + this.label = label; + this.optional = optional; + this.options = options; + this.requirement = requirement; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Present after a rejected submission. + */ + @JsonProperty("errors") + public Optional> getErrors() { + return errors; + } + + /** + * @return Requested information item ID, prefixed inrqi_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Instruction to show the user. Carries the reviewer's note verbatim when there is one. + */ + @JsonProperty("label") + public String getLabel() { + return label; + } + + /** + * @return true when the item can be skipped. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make. + */ + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + + /** + * @return What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type. + */ + @JsonProperty("requirement") + public String getRequirement() { + return requirement; + } + + /** + * @return What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address). + */ + @JsonProperty("type") + public String getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveVerificationsResponseRequestedInformationItem + && equalTo((RetrieveVerificationsResponseRequestedInformationItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveVerificationsResponseRequestedInformationItem other) { + return errors.equals(other.errors) + && id.equals(other.id) + && label.equals(other.label) + && optional.equals(other.optional) + && options.equals(other.options) + && requirement.equals(other.requirement) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.errors, this.id, this.label, this.optional, this.options, this.requirement, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Requested information item ID, prefixed inrqi_.

+ */ + LabelStage id(@NotNull String id); + + Builder from(RetrieveVerificationsResponseRequestedInformationItem other); + } + + public interface LabelStage { + /** + *

Instruction to show the user. Carries the reviewer's note verbatim when there is one.

+ */ + RequirementStage label(@NotNull String label); + } + + public interface RequirementStage { + /** + *

What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type.

+ */ + TypeStage requirement(@NotNull String requirement); + } + + public interface TypeStage { + /** + *

What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address).

+ */ + _FinalStage type(@NotNull String type); + } + + public interface _FinalStage { + RetrieveVerificationsResponseRequestedInformationItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Present after a rejected submission.

+ */ + _FinalStage errors(Optional> errors); + + _FinalStage errors(List errors); + + /** + *

true when the item can be skipped.

+ */ + _FinalStage optional(Optional optional); + + _FinalStage optional(Boolean optional); + + /** + *

The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make.

+ */ + _FinalStage options(Optional> options); + + _FinalStage options(List options); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, LabelStage, RequirementStage, TypeStage, _FinalStage { + private String id; + + private String label; + + private String requirement; + + private String type; + + private Optional> options = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional> errors = + Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetrieveVerificationsResponseRequestedInformationItem other) { + errors(other.getErrors()); + id(other.getId()); + label(other.getLabel()); + optional(other.getOptional()); + options(other.getOptions()); + requirement(other.getRequirement()); + type(other.getType()); + return this; + } + + /** + *

Requested information item ID, prefixed inrqi_.

+ *

Requested information item ID, prefixed inrqi_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LabelStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Instruction to show the user. Carries the reviewer's note verbatim when there is one.

+ *

Instruction to show the user. Carries the reviewer's note verbatim when there is one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("label") + public RequirementStage label(@NotNull String label) { + this.label = Objects.requireNonNull(label, "label must not be null"); + return this; + } + + /** + *

What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type.

+ *

What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("requirement") + public TypeStage requirement(@NotNull String requirement) { + this.requirement = Objects.requireNonNull(requirement, "requirement must not be null"); + return this; + } + + /** + *

What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address).

+ *

What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + /** + *

The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make.

+ */ + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional> options) { + this.options = options; + return this; + } + + /** + *

true when the item can be skipped.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

true when the item can be skipped.

+ */ + @java.lang.Override + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public _FinalStage optional(Optional optional) { + this.optional = optional; + return this; + } + + /** + *

Present after a rejected submission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errors(List errors) { + this.errors = Optional.ofNullable(errors); + return this; + } + + /** + *

Present after a rejected submission.

+ */ + @java.lang.Override + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public _FinalStage errors( + Optional> errors) { + this.errors = errors; + return this; + } + + @java.lang.Override + public RetrieveVerificationsResponseRequestedInformationItem build() { + return new RetrieveVerificationsResponseRequestedInformationItem( + errors, id, label, optional, options, requirement, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseRequestedInformationItemErrorsItem.java b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseRequestedInformationItemErrorsItem.java new file mode 100644 index 00000000..6ad33647 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseRequestedInformationItemErrorsItem.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveVerificationsResponseRequestedInformationItemErrorsItem.Builder.class) +public final class RetrieveVerificationsResponseRequestedInformationItemErrorsItem { + private final Optional code; + + private final Optional reason; + + private final Map additionalProperties; + + private RetrieveVerificationsResponseRequestedInformationItemErrorsItem( + Optional code, Optional reason, Map additionalProperties) { + this.code = code; + this.reason = reason; + this.additionalProperties = additionalProperties; + } + + /** + * @return Stable error code. + */ + @JsonProperty("code") + public Optional getCode() { + return code; + } + + /** + * @return Why it was rejected. + */ + @JsonProperty("reason") + public Optional getReason() { + return reason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveVerificationsResponseRequestedInformationItemErrorsItem + && equalTo((RetrieveVerificationsResponseRequestedInformationItemErrorsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveVerificationsResponseRequestedInformationItemErrorsItem other) { + return code.equals(other.code) && reason.equals(other.reason); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.reason); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional code = Optional.empty(); + + private Optional reason = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveVerificationsResponseRequestedInformationItemErrorsItem other) { + code(other.getCode()); + reason(other.getReason()); + return this; + } + + /** + *

Stable error code.

+ */ + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public Builder code(Optional code) { + this.code = code; + return this; + } + + public Builder code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

Why it was rejected.

+ */ + @JsonSetter(value = "reason", nulls = Nulls.SKIP) + public Builder reason(Optional reason) { + this.reason = reason; + return this; + } + + public Builder reason(String reason) { + this.reason = Optional.ofNullable(reason); + return this; + } + + public RetrieveVerificationsResponseRequestedInformationItemErrorsItem build() { + return new RetrieveVerificationsResponseRequestedInformationItemErrorsItem( + code, reason, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseRequiredDocumentsItem.java b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseRequiredDocumentsItem.java new file mode 100644 index 00000000..2f6e8ead --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseRequiredDocumentsItem.java @@ -0,0 +1,198 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveVerificationsResponseRequiredDocumentsItem.Builder.class) +public final class RetrieveVerificationsResponseRequiredDocumentsItem { + private final Optional document; + + private final Optional rejectionReason; + + private final Optional status; + + private final Map additionalProperties; + + private RetrieveVerificationsResponseRequiredDocumentsItem( + Optional document, + Optional rejectionReason, + Optional status, + Map additionalProperties) { + this.document = document; + this.rejectionReason = rejectionReason; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Document slot key, such as id_card_front, id_card_back, or selfie. + */ + @JsonProperty("document") + public Optional getDocument() { + return document; + } + + /** + * @return Why the previous submission was rejected, when the provider requested new documents or declined the verification. + */ + @JsonIgnore + public Optional getRejectionReason() { + if (rejectionReason == null) { + return Optional.empty(); + } + return rejectionReason; + } + + /** + * @return pending_upload until the document has been relayed for review; submitted afterwards. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("rejection_reason") + private Optional _getRejectionReason() { + return rejectionReason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveVerificationsResponseRequiredDocumentsItem + && equalTo((RetrieveVerificationsResponseRequiredDocumentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetrieveVerificationsResponseRequiredDocumentsItem other) { + return document.equals(other.document) + && rejectionReason.equals(other.rejectionReason) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.document, this.rejectionReason, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional document = Optional.empty(); + + private Optional rejectionReason = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveVerificationsResponseRequiredDocumentsItem other) { + document(other.getDocument()); + rejectionReason(other.getRejectionReason()); + status(other.getStatus()); + return this; + } + + /** + *

Document slot key, such as id_card_front, id_card_back, or selfie.

+ */ + @JsonSetter(value = "document", nulls = Nulls.SKIP) + public Builder document(Optional document) { + this.document = document; + return this; + } + + public Builder document(String document) { + this.document = Optional.ofNullable(document); + return this; + } + + /** + *

Why the previous submission was rejected, when the provider requested new documents or declined the verification.

+ */ + @JsonSetter(value = "rejection_reason", nulls = Nulls.SKIP) + public Builder rejectionReason(Optional rejectionReason) { + this.rejectionReason = rejectionReason; + return this; + } + + public Builder rejectionReason(String rejectionReason) { + this.rejectionReason = Optional.ofNullable(rejectionReason); + return this; + } + + public Builder rejectionReason(Nullable rejectionReason) { + if (rejectionReason.isNull()) { + this.rejectionReason = null; + } else if (rejectionReason.isEmpty()) { + this.rejectionReason = Optional.empty(); + } else { + this.rejectionReason = Optional.of(rejectionReason.get()); + } + return this; + } + + /** + *

pending_upload until the document has been relayed for review; submitted afterwards.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(RetrieveVerificationsResponseRequiredDocumentsItemStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public RetrieveVerificationsResponseRequiredDocumentsItem build() { + return new RetrieveVerificationsResponseRequiredDocumentsItem( + document, rejectionReason, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseRequiredDocumentsItemStatus.java b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseRequiredDocumentsItemStatus.java new file mode 100644 index 00000000..ec582a06 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseRequiredDocumentsItemStatus.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveVerificationsResponseRequiredDocumentsItemStatus { + public static final RetrieveVerificationsResponseRequiredDocumentsItemStatus PENDING_UPLOAD = + new RetrieveVerificationsResponseRequiredDocumentsItemStatus(Value.PENDING_UPLOAD, "pending_upload"); + + public static final RetrieveVerificationsResponseRequiredDocumentsItemStatus SUBMITTED = + new RetrieveVerificationsResponseRequiredDocumentsItemStatus(Value.SUBMITTED, "submitted"); + + private final Value value; + + private final String string; + + RetrieveVerificationsResponseRequiredDocumentsItemStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveVerificationsResponseRequiredDocumentsItemStatus + && this.string.equals( + ((RetrieveVerificationsResponseRequiredDocumentsItemStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING_UPLOAD: + return visitor.visitPendingUpload(); + case SUBMITTED: + return visitor.visitSubmitted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveVerificationsResponseRequiredDocumentsItemStatus valueOf(String value) { + switch (value) { + case "pending_upload": + return PENDING_UPLOAD; + case "submitted": + return SUBMITTED; + default: + return new RetrieveVerificationsResponseRequiredDocumentsItemStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING_UPLOAD, + + SUBMITTED, + + UNKNOWN + } + + public interface Visitor { + T visitPendingUpload(); + + T visitSubmitted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseStatus.java b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseStatus.java new file mode 100644 index 00000000..4dddaf04 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/RetrieveVerificationsResponseStatus.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RetrieveVerificationsResponseStatus { + public static final RetrieveVerificationsResponseStatus APPROVED = + new RetrieveVerificationsResponseStatus(Value.APPROVED, "approved"); + + public static final RetrieveVerificationsResponseStatus MANUAL_REVIEW = + new RetrieveVerificationsResponseStatus(Value.MANUAL_REVIEW, "manual_review"); + + public static final RetrieveVerificationsResponseStatus PENDING = + new RetrieveVerificationsResponseStatus(Value.PENDING, "pending"); + + public static final RetrieveVerificationsResponseStatus PROCESSING = + new RetrieveVerificationsResponseStatus(Value.PROCESSING, "processing"); + + public static final RetrieveVerificationsResponseStatus NOT_STARTED = + new RetrieveVerificationsResponseStatus(Value.NOT_STARTED, "not_started"); + + public static final RetrieveVerificationsResponseStatus REJECTED = + new RetrieveVerificationsResponseStatus(Value.REJECTED, "rejected"); + + public static final RetrieveVerificationsResponseStatus ACTION_REQUIRED = + new RetrieveVerificationsResponseStatus(Value.ACTION_REQUIRED, "action_required"); + + private final Value value; + + private final String string; + + RetrieveVerificationsResponseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RetrieveVerificationsResponseStatus + && this.string.equals(((RetrieveVerificationsResponseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case MANUAL_REVIEW: + return visitor.visitManualReview(); + case PENDING: + return visitor.visitPending(); + case PROCESSING: + return visitor.visitProcessing(); + case NOT_STARTED: + return visitor.visitNotStarted(); + case REJECTED: + return visitor.visitRejected(); + case ACTION_REQUIRED: + return visitor.visitActionRequired(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RetrieveVerificationsResponseStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "manual_review": + return MANUAL_REVIEW; + case "pending": + return PENDING; + case "processing": + return PROCESSING; + case "not_started": + return NOT_STARTED; + case "rejected": + return REJECTED; + case "action_required": + return ACTION_REQUIRED; + default: + return new RetrieveVerificationsResponseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + NOT_STARTED, + + PENDING, + + PROCESSING, + + MANUAL_REVIEW, + + APPROVED, + + REJECTED, + + ACTION_REQUIRED, + + UNKNOWN + } + + public interface Visitor { + T visitNotStarted(); + + T visitPending(); + + T visitProcessing(); + + T visitManualReview(); + + T visitApproved(); + + T visitRejected(); + + T visitActionRequired(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBody.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBody.java new file mode 100644 index 00000000..345d0a16 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBody.java @@ -0,0 +1,98 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = UpdateVerificationsRequestBody.Deserializer.class) +public final class UpdateVerificationsRequestBody { + private final Object value; + + private final int type; + + private UpdateVerificationsRequestBody(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((UpdateVerificationsRequestBodyPersonalAddress) this.value); + } else if (this.type == 1) { + return visitor.visit((UpdateVerificationsRequestBodyBusinessAddress) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsRequestBody && equalTo((UpdateVerificationsRequestBody) other); + } + + private boolean equalTo(UpdateVerificationsRequestBody other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static UpdateVerificationsRequestBody of(UpdateVerificationsRequestBodyPersonalAddress value) { + return new UpdateVerificationsRequestBody(value, 0); + } + + public static UpdateVerificationsRequestBody of(UpdateVerificationsRequestBodyBusinessAddress value) { + return new UpdateVerificationsRequestBody(value, 1); + } + + public interface Visitor { + T visit(UpdateVerificationsRequestBodyPersonalAddress value); + + T visit(UpdateVerificationsRequestBodyBusinessAddress value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(UpdateVerificationsRequestBody.class); + } + + @java.lang.Override + public UpdateVerificationsRequestBody deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, UpdateVerificationsRequestBodyPersonalAddress.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, UpdateVerificationsRequestBodyBusinessAddress.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddress.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddress.java new file mode 100644 index 00000000..722f6d34 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddress.java @@ -0,0 +1,414 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsRequestBodyBusinessAddress.Builder.class) +public final class UpdateVerificationsRequestBodyBusinessAddress { + private final Optional businessAddress; + + private final Optional businessName; + + private final Optional businessStructure; + + private final Optional businessTaxIdentificationNumber; + + private final Optional country; + + private final Optional dateOfBirth; + + private final Optional firstName; + + private final Optional lastName; + + private final Optional> + requestedInformation; + + private final Optional taxIdentificationNumber; + + private final Map additionalProperties; + + private UpdateVerificationsRequestBodyBusinessAddress( + Optional businessAddress, + Optional businessName, + Optional businessStructure, + Optional businessTaxIdentificationNumber, + Optional country, + Optional dateOfBirth, + Optional firstName, + Optional lastName, + Optional> requestedInformation, + Optional taxIdentificationNumber, + Map additionalProperties) { + this.businessAddress = businessAddress; + this.businessName = businessName; + this.businessStructure = businessStructure; + this.businessTaxIdentificationNumber = businessTaxIdentificationNumber; + this.country = country; + this.dateOfBirth = dateOfBirth; + this.firstName = firstName; + this.lastName = lastName; + this.requestedInformation = requestedInformation; + this.taxIdentificationNumber = taxIdentificationNumber; + this.additionalProperties = additionalProperties; + } + + /** + * @return Business address. + */ + @JsonProperty("business_address") + public Optional getBusinessAddress() { + return businessAddress; + } + + /** + * @return Legal business name. + */ + @JsonProperty("business_name") + public Optional getBusinessName() { + return businessName; + } + + /** + * @return Legal entity structure of the business, such as private_corporation or sole_proprietorship. Supported values vary by country of incorporation — see Business structures. + */ + @JsonProperty("business_structure") + public Optional getBusinessStructure() { + return businessStructure; + } + + /** + * @return The business ID number of the company, as appropriate for the company's country. Examples are an Employer Identification Number (EIN) in the US, a Business Number in Canada, or a Company Number in the UK. + */ + @JsonProperty("business_tax_identification_number") + public Optional getBusinessTaxIdentificationNumber() { + return businessTaxIdentificationNumber; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + /** + * @return Business representative's date of birth, formatted as YYYY-MM-DD. + */ + @JsonProperty("date_of_birth") + public Optional getDateOfBirth() { + return dateOfBirth; + } + + /** + * @return First name of the business representative. + */ + @JsonProperty("first_name") + public Optional getFirstName() { + return firstName; + } + + /** + * @return Last name of the business representative. + */ + @JsonProperty("last_name") + public Optional getLastName() { + return lastName; + } + + /** + * @return Answers to items in requested_information. Each entry pairs the item id with one answer payload matching its type. + */ + @JsonProperty("requested_information") + public Optional> + getRequestedInformation() { + return requestedInformation; + } + + /** + * @return The government-issued ID number of the person being verified — the individual for a KYC verification, or the business representative for a KYB verification — as appropriate for their country. Examples are a Social Security Number (SSN) in the US, or a Social Insurance Number in Canada. + */ + @JsonProperty("tax_identification_number") + public Optional getTaxIdentificationNumber() { + return taxIdentificationNumber; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsRequestBodyBusinessAddress + && equalTo((UpdateVerificationsRequestBodyBusinessAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsRequestBodyBusinessAddress other) { + return businessAddress.equals(other.businessAddress) + && businessName.equals(other.businessName) + && businessStructure.equals(other.businessStructure) + && businessTaxIdentificationNumber.equals(other.businessTaxIdentificationNumber) + && country.equals(other.country) + && dateOfBirth.equals(other.dateOfBirth) + && firstName.equals(other.firstName) + && lastName.equals(other.lastName) + && requestedInformation.equals(other.requestedInformation) + && taxIdentificationNumber.equals(other.taxIdentificationNumber); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.businessAddress, + this.businessName, + this.businessStructure, + this.businessTaxIdentificationNumber, + this.country, + this.dateOfBirth, + this.firstName, + this.lastName, + this.requestedInformation, + this.taxIdentificationNumber); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional businessAddress = + Optional.empty(); + + private Optional businessName = Optional.empty(); + + private Optional businessStructure = Optional.empty(); + + private Optional businessTaxIdentificationNumber = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional dateOfBirth = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional lastName = Optional.empty(); + + private Optional> + requestedInformation = Optional.empty(); + + private Optional taxIdentificationNumber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateVerificationsRequestBodyBusinessAddress other) { + businessAddress(other.getBusinessAddress()); + businessName(other.getBusinessName()); + businessStructure(other.getBusinessStructure()); + businessTaxIdentificationNumber(other.getBusinessTaxIdentificationNumber()); + country(other.getCountry()); + dateOfBirth(other.getDateOfBirth()); + firstName(other.getFirstName()); + lastName(other.getLastName()); + requestedInformation(other.getRequestedInformation()); + taxIdentificationNumber(other.getTaxIdentificationNumber()); + return this; + } + + /** + *

Business address.

+ */ + @JsonSetter(value = "business_address", nulls = Nulls.SKIP) + public Builder businessAddress( + Optional businessAddress) { + this.businessAddress = businessAddress; + return this; + } + + public Builder businessAddress(UpdateVerificationsRequestBodyBusinessAddressBusinessAddress businessAddress) { + this.businessAddress = Optional.ofNullable(businessAddress); + return this; + } + + /** + *

Legal business name.

+ */ + @JsonSetter(value = "business_name", nulls = Nulls.SKIP) + public Builder businessName(Optional businessName) { + this.businessName = businessName; + return this; + } + + public Builder businessName(String businessName) { + this.businessName = Optional.ofNullable(businessName); + return this; + } + + /** + *

Legal entity structure of the business, such as private_corporation or sole_proprietorship. Supported values vary by country of incorporation — see Business structures.

+ */ + @JsonSetter(value = "business_structure", nulls = Nulls.SKIP) + public Builder businessStructure(Optional businessStructure) { + this.businessStructure = businessStructure; + return this; + } + + public Builder businessStructure(String businessStructure) { + this.businessStructure = Optional.ofNullable(businessStructure); + return this; + } + + /** + *

The business ID number of the company, as appropriate for the company's country. Examples are an Employer Identification Number (EIN) in the US, a Business Number in Canada, or a Company Number in the UK.

+ */ + @JsonSetter(value = "business_tax_identification_number", nulls = Nulls.SKIP) + public Builder businessTaxIdentificationNumber(Optional businessTaxIdentificationNumber) { + this.businessTaxIdentificationNumber = businessTaxIdentificationNumber; + return this; + } + + public Builder businessTaxIdentificationNumber(String businessTaxIdentificationNumber) { + this.businessTaxIdentificationNumber = Optional.ofNullable(businessTaxIdentificationNumber); + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

Business representative's date of birth, formatted as YYYY-MM-DD.

+ */ + @JsonSetter(value = "date_of_birth", nulls = Nulls.SKIP) + public Builder dateOfBirth(Optional dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + public Builder dateOfBirth(String dateOfBirth) { + this.dateOfBirth = Optional.ofNullable(dateOfBirth); + return this; + } + + /** + *

First name of the business representative.

+ */ + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public Builder firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + /** + *

Last name of the business representative.

+ */ + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public Builder lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + /** + *

Answers to items in requested_information. Each entry pairs the item id with one answer payload matching its type.

+ */ + @JsonSetter(value = "requested_information", nulls = Nulls.SKIP) + public Builder requestedInformation( + Optional> + requestedInformation) { + this.requestedInformation = requestedInformation; + return this; + } + + public Builder requestedInformation( + List requestedInformation) { + this.requestedInformation = Optional.ofNullable(requestedInformation); + return this; + } + + /** + *

The government-issued ID number of the person being verified — the individual for a KYC verification, or the business representative for a KYB verification — as appropriate for their country. Examples are a Social Security Number (SSN) in the US, or a Social Insurance Number in Canada.

+ */ + @JsonSetter(value = "tax_identification_number", nulls = Nulls.SKIP) + public Builder taxIdentificationNumber(Optional taxIdentificationNumber) { + this.taxIdentificationNumber = taxIdentificationNumber; + return this; + } + + public Builder taxIdentificationNumber(String taxIdentificationNumber) { + this.taxIdentificationNumber = Optional.ofNullable(taxIdentificationNumber); + return this; + } + + public UpdateVerificationsRequestBodyBusinessAddress build() { + return new UpdateVerificationsRequestBodyBusinessAddress( + businessAddress, + businessName, + businessStructure, + businessTaxIdentificationNumber, + country, + dateOfBirth, + firstName, + lastName, + requestedInformation, + taxIdentificationNumber, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddressBusinessAddress.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddressBusinessAddress.java new file mode 100644 index 00000000..3027a6aa --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddressBusinessAddress.java @@ -0,0 +1,382 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsRequestBodyBusinessAddressBusinessAddress.Builder.class) +public final class UpdateVerificationsRequestBodyBusinessAddressBusinessAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private UpdateVerificationsRequestBodyBusinessAddressBusinessAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return First line of the street address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return Second line of the street address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Postal or ZIP code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return State, province, or region code, for example CA. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsRequestBodyBusinessAddressBusinessAddress + && equalTo((UpdateVerificationsRequestBodyBusinessAddressBusinessAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsRequestBodyBusinessAddressBusinessAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateVerificationsRequestBodyBusinessAddressBusinessAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

First line of the street address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

Second line of the street address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Postal or ZIP code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

State, province, or region code, for example CA.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public UpdateVerificationsRequestBodyBusinessAddressBusinessAddress build() { + return new UpdateVerificationsRequestBodyBusinessAddressBusinessAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItem.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItem.java new file mode 100644 index 00000000..746c4496 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItem.java @@ -0,0 +1,363 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItem.Builder.class) +public final class UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItem { + private final Optional address; + + private final Optional documents; + + private final Optional> files; + + private final String id; + + private final Optional value; + + private final Optional valueType; + + private final Map additionalProperties; + + private UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItem( + Optional address, + Optional documents, + Optional> files, + String id, + Optional value, + Optional valueType, + Map additionalProperties) { + this.address = address; + this.documents = documents; + this.files = files; + this.id = id; + this.value = value; + this.valueType = valueType; + this.additionalProperties = additionalProperties; + } + + /** + * @return Answer for address items. + */ + @JsonProperty("address") + public Optional getAddress() { + return address; + } + + /** + * @return Answer for an id_document item: the same slot keys Create Verification takes, so the key names both the document and the side. Send every slot for the ID you are uploading — PASSPORT is passport_front; ID_CARD, DRIVERS and RESIDENCE_PERMIT take a front and a back. Each value is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document. + */ + @JsonProperty("documents") + public Optional getDocuments() { + return documents; + } + + /** + * @return Answer for a files item — one document, as a list of its pages, first page first. Each entry is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document. + */ + @JsonProperty("files") + public Optional> getFiles() { + return files; + } + + /** + * @return Item ID from requested_information. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Answer for text, date, phone, and select items, and the chosen document type for a file item that lists options. + */ + @JsonProperty("value") + public Optional getValue() { + return value; + } + + /** + * @return Whether value is raw input or a vault token. + */ + @JsonProperty("value_type") + public Optional getValueType() { + return valueType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItem + && equalTo((UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItem other) { + return address.equals(other.address) + && documents.equals(other.documents) + && files.equals(other.files) + && id.equals(other.id) + && value.equals(other.value) + && valueType.equals(other.valueType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.address, this.documents, this.files, this.id, this.value, this.valueType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Item ID from requested_information.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItem other); + } + + public interface _FinalStage { + UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Answer for address items.

+ */ + _FinalStage address( + Optional address); + + _FinalStage address(UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemAddress address); + + /** + *

Answer for an id_document item: the same slot keys Create Verification takes, so the key names both the document and the side. Send every slot for the ID you are uploading — PASSPORT is passport_front; ID_CARD, DRIVERS and RESIDENCE_PERMIT take a front and a back. Each value is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document.

+ */ + _FinalStage documents( + Optional documents); + + _FinalStage documents(UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemDocuments documents); + + /** + *

Answer for a files item — one document, as a list of its pages, first page first. Each entry is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document.

+ */ + _FinalStage files(Optional> files); + + _FinalStage files(List files); + + /** + *

Answer for text, date, phone, and select items, and the chosen document type for a file item that lists options.

+ */ + _FinalStage value(Optional value); + + _FinalStage value(String value); + + /** + *

Whether value is raw input or a vault token.

+ */ + _FinalStage valueType( + Optional valueType); + + _FinalStage valueType(UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemValueType valueType); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional valueType = + Optional.empty(); + + private Optional value = Optional.empty(); + + private Optional> files = Optional.empty(); + + private Optional documents = + Optional.empty(); + + private Optional address = + Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItem other) { + address(other.getAddress()); + documents(other.getDocuments()); + files(other.getFiles()); + id(other.getId()); + value(other.getValue()); + valueType(other.getValueType()); + return this; + } + + /** + *

Item ID from requested_information.

+ *

Item ID from requested_information.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether value is raw input or a vault token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage valueType( + UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemValueType valueType) { + this.valueType = Optional.ofNullable(valueType); + return this; + } + + /** + *

Whether value is raw input or a vault token.

+ */ + @java.lang.Override + @JsonSetter(value = "value_type", nulls = Nulls.SKIP) + public _FinalStage valueType( + Optional valueType) { + this.valueType = valueType; + return this; + } + + /** + *

Answer for text, date, phone, and select items, and the chosen document type for a file item that lists options.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage value(String value) { + this.value = Optional.ofNullable(value); + return this; + } + + /** + *

Answer for text, date, phone, and select items, and the chosen document type for a file item that lists options.

+ */ + @java.lang.Override + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public _FinalStage value(Optional value) { + this.value = value; + return this; + } + + /** + *

Answer for a files item — one document, as a list of its pages, first page first. Each entry is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage files(List files) { + this.files = Optional.ofNullable(files); + return this; + } + + /** + *

Answer for a files item — one document, as a list of its pages, first page first. Each entry is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document.

+ */ + @java.lang.Override + @JsonSetter(value = "files", nulls = Nulls.SKIP) + public _FinalStage files(Optional> files) { + this.files = files; + return this; + } + + /** + *

Answer for an id_document item: the same slot keys Create Verification takes, so the key names both the document and the side. Send every slot for the ID you are uploading — PASSPORT is passport_front; ID_CARD, DRIVERS and RESIDENCE_PERMIT take a front and a back. Each value is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage documents( + UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemDocuments documents) { + this.documents = Optional.ofNullable(documents); + return this; + } + + /** + *

Answer for an id_document item: the same slot keys Create Verification takes, so the key names both the document and the side. Send every slot for the ID you are uploading — PASSPORT is passport_front; ID_CARD, DRIVERS and RESIDENCE_PERMIT take a front and a back. Each value is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document.

+ */ + @java.lang.Override + @JsonSetter(value = "documents", nulls = Nulls.SKIP) + public _FinalStage documents( + Optional documents) { + this.documents = documents; + return this; + } + + /** + *

Answer for address items.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage address( + UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemAddress address) { + this.address = Optional.ofNullable(address); + return this; + } + + /** + *

Answer for address items.

+ */ + @java.lang.Override + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public _FinalStage address( + Optional address) { + this.address = address; + return this; + } + + @java.lang.Override + public UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItem build() { + return new UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItem( + address, documents, files, id, value, valueType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemAddress.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemAddress.java new file mode 100644 index 00000000..3e86d263 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemAddress.java @@ -0,0 +1,382 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemAddress.Builder.class) +public final class UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return First line of the street address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return Second line of the street address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Postal or ZIP code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return State, province, or region code, for example CA. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemAddress + && equalTo((UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

First line of the street address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

Second line of the street address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Postal or ZIP code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

State, province, or region code, for example CA.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemAddress build() { + return new UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemDocuments.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemDocuments.java new file mode 100644 index 00000000..f3b21cad --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemDocuments.java @@ -0,0 +1,309 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemDocuments.Builder.class) +public final class UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemDocuments { + private final Optional driversBack; + + private final Optional driversFront; + + private final Optional idCardBack; + + private final Optional idCardFront; + + private final Optional passportFront; + + private final Optional residencePermitBack; + + private final Optional residencePermitFront; + + private final Map additionalProperties; + + private UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemDocuments( + Optional driversBack, + Optional driversFront, + Optional idCardBack, + Optional idCardFront, + Optional passportFront, + Optional residencePermitBack, + Optional residencePermitFront, + Map additionalProperties) { + this.driversBack = driversBack; + this.driversFront = driversFront; + this.idCardBack = idCardBack; + this.idCardFront = idCardFront; + this.passportFront = passportFront; + this.residencePermitBack = residencePermitBack; + this.residencePermitFront = residencePermitFront; + this.additionalProperties = additionalProperties; + } + + /** + * @return Back of the driver's license. + */ + @JsonProperty("drivers_back") + public Optional getDriversBack() { + return driversBack; + } + + /** + * @return Front of the driver's license. + */ + @JsonProperty("drivers_front") + public Optional getDriversFront() { + return driversFront; + } + + /** + * @return Back of the ID card. + */ + @JsonProperty("id_card_back") + public Optional getIdCardBack() { + return idCardBack; + } + + /** + * @return Front of the ID card. + */ + @JsonProperty("id_card_front") + public Optional getIdCardFront() { + return idCardFront; + } + + /** + * @return Photo page of the passport. + */ + @JsonProperty("passport_front") + public Optional getPassportFront() { + return passportFront; + } + + /** + * @return Back of the residence permit. + */ + @JsonProperty("residence_permit_back") + public Optional getResidencePermitBack() { + return residencePermitBack; + } + + /** + * @return Front of the residence permit. + */ + @JsonProperty("residence_permit_front") + public Optional getResidencePermitFront() { + return residencePermitFront; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemDocuments + && equalTo((UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemDocuments) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemDocuments other) { + return driversBack.equals(other.driversBack) + && driversFront.equals(other.driversFront) + && idCardBack.equals(other.idCardBack) + && idCardFront.equals(other.idCardFront) + && passportFront.equals(other.passportFront) + && residencePermitBack.equals(other.residencePermitBack) + && residencePermitFront.equals(other.residencePermitFront); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.driversBack, + this.driversFront, + this.idCardBack, + this.idCardFront, + this.passportFront, + this.residencePermitBack, + this.residencePermitFront); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional driversBack = Optional.empty(); + + private Optional driversFront = Optional.empty(); + + private Optional idCardBack = Optional.empty(); + + private Optional idCardFront = Optional.empty(); + + private Optional passportFront = Optional.empty(); + + private Optional residencePermitBack = Optional.empty(); + + private Optional residencePermitFront = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemDocuments other) { + driversBack(other.getDriversBack()); + driversFront(other.getDriversFront()); + idCardBack(other.getIdCardBack()); + idCardFront(other.getIdCardFront()); + passportFront(other.getPassportFront()); + residencePermitBack(other.getResidencePermitBack()); + residencePermitFront(other.getResidencePermitFront()); + return this; + } + + /** + *

Back of the driver's license.

+ */ + @JsonSetter(value = "drivers_back", nulls = Nulls.SKIP) + public Builder driversBack(Optional driversBack) { + this.driversBack = driversBack; + return this; + } + + public Builder driversBack(String driversBack) { + this.driversBack = Optional.ofNullable(driversBack); + return this; + } + + /** + *

Front of the driver's license.

+ */ + @JsonSetter(value = "drivers_front", nulls = Nulls.SKIP) + public Builder driversFront(Optional driversFront) { + this.driversFront = driversFront; + return this; + } + + public Builder driversFront(String driversFront) { + this.driversFront = Optional.ofNullable(driversFront); + return this; + } + + /** + *

Back of the ID card.

+ */ + @JsonSetter(value = "id_card_back", nulls = Nulls.SKIP) + public Builder idCardBack(Optional idCardBack) { + this.idCardBack = idCardBack; + return this; + } + + public Builder idCardBack(String idCardBack) { + this.idCardBack = Optional.ofNullable(idCardBack); + return this; + } + + /** + *

Front of the ID card.

+ */ + @JsonSetter(value = "id_card_front", nulls = Nulls.SKIP) + public Builder idCardFront(Optional idCardFront) { + this.idCardFront = idCardFront; + return this; + } + + public Builder idCardFront(String idCardFront) { + this.idCardFront = Optional.ofNullable(idCardFront); + return this; + } + + /** + *

Photo page of the passport.

+ */ + @JsonSetter(value = "passport_front", nulls = Nulls.SKIP) + public Builder passportFront(Optional passportFront) { + this.passportFront = passportFront; + return this; + } + + public Builder passportFront(String passportFront) { + this.passportFront = Optional.ofNullable(passportFront); + return this; + } + + /** + *

Back of the residence permit.

+ */ + @JsonSetter(value = "residence_permit_back", nulls = Nulls.SKIP) + public Builder residencePermitBack(Optional residencePermitBack) { + this.residencePermitBack = residencePermitBack; + return this; + } + + public Builder residencePermitBack(String residencePermitBack) { + this.residencePermitBack = Optional.ofNullable(residencePermitBack); + return this; + } + + /** + *

Front of the residence permit.

+ */ + @JsonSetter(value = "residence_permit_front", nulls = Nulls.SKIP) + public Builder residencePermitFront(Optional residencePermitFront) { + this.residencePermitFront = residencePermitFront; + return this; + } + + public Builder residencePermitFront(String residencePermitFront) { + this.residencePermitFront = Optional.ofNullable(residencePermitFront); + return this; + } + + public UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemDocuments build() { + return new UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemDocuments( + driversBack, + driversFront, + idCardBack, + idCardFront, + passportFront, + residencePermitBack, + residencePermitFront, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemValueType.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemValueType.java new file mode 100644 index 00000000..b91faa9d --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemValueType.java @@ -0,0 +1,90 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemValueType { + public static final UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemValueType VAULT_TOKEN = + new UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemValueType( + Value.VAULT_TOKEN, "vault_token"); + + public static final UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemValueType RAW = + new UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemValueType(Value.RAW, "raw"); + + private final Value value; + + private final String string; + + UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemValueType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemValueType + && this.string.equals( + ((UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemValueType) other) + .string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VAULT_TOKEN: + return visitor.visitVaultToken(); + case RAW: + return visitor.visitRaw(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemValueType valueOf(String value) { + switch (value) { + case "vault_token": + return VAULT_TOKEN; + case "raw": + return RAW; + default: + return new UpdateVerificationsRequestBodyBusinessAddressRequestedInformationItemValueType( + Value.UNKNOWN, value); + } + } + + public enum Value { + RAW, + + VAULT_TOKEN, + + UNKNOWN + } + + public interface Visitor { + T visitRaw(); + + T visitVaultToken(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddress.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddress.java new file mode 100644 index 00000000..9adc12fd --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddress.java @@ -0,0 +1,402 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsRequestBodyPersonalAddress.Builder.class) +public final class UpdateVerificationsRequestBodyPersonalAddress { + private final Optional businessName; + + private final Optional businessStructure; + + private final Optional businessTaxIdentificationNumber; + + private final Optional country; + + private final Optional dateOfBirth; + + private final Optional firstName; + + private final Optional lastName; + + private final Optional personalAddress; + + private final Optional> + requestedInformation; + + private final Optional taxIdentificationNumber; + + private final Map additionalProperties; + + private UpdateVerificationsRequestBodyPersonalAddress( + Optional businessName, + Optional businessStructure, + Optional businessTaxIdentificationNumber, + Optional country, + Optional dateOfBirth, + Optional firstName, + Optional lastName, + Optional personalAddress, + Optional> requestedInformation, + Optional taxIdentificationNumber, + Map additionalProperties) { + this.businessName = businessName; + this.businessStructure = businessStructure; + this.businessTaxIdentificationNumber = businessTaxIdentificationNumber; + this.country = country; + this.dateOfBirth = dateOfBirth; + this.firstName = firstName; + this.lastName = lastName; + this.personalAddress = personalAddress; + this.requestedInformation = requestedInformation; + this.taxIdentificationNumber = taxIdentificationNumber; + this.additionalProperties = additionalProperties; + } + + /** + * @return Legal business name for a sole proprietor or single-member LLC. + */ + @JsonProperty("business_name") + public Optional getBusinessName() { + return businessName; + } + + /** + * @return Entity type for sole proprietors, such as single_member_llc. Supported values vary by country of incorporation — see Business structures. + */ + @JsonProperty("business_structure") + public Optional getBusinessStructure() { + return businessStructure; + } + + /** + * @return The business ID number of the company, as appropriate for the company's country. Examples are an Employer Identification Number (EIN) in the US, a Business Number in Canada, or a Company Number in the UK. + */ + @JsonProperty("business_tax_identification_number") + public Optional getBusinessTaxIdentificationNumber() { + return businessTaxIdentificationNumber; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonProperty("country") + public Optional getCountry() { + return country; + } + + /** + * @return Formatted as YYYY-MM-DD. + */ + @JsonProperty("date_of_birth") + public Optional getDateOfBirth() { + return dateOfBirth; + } + + @JsonProperty("first_name") + public Optional getFirstName() { + return firstName; + } + + @JsonProperty("last_name") + public Optional getLastName() { + return lastName; + } + + /** + * @return Personal address for the individual. + */ + @JsonProperty("personal_address") + public Optional getPersonalAddress() { + return personalAddress; + } + + /** + * @return Answers to items in requested_information. Each entry pairs the item id with one answer payload matching its type. + */ + @JsonProperty("requested_information") + public Optional> + getRequestedInformation() { + return requestedInformation; + } + + /** + * @return The government-issued ID number of the person being verified — the individual for a KYC verification, or the business representative for a KYB verification — as appropriate for their country. Examples are a Social Security Number (SSN) in the US, or a Social Insurance Number in Canada. + */ + @JsonProperty("tax_identification_number") + public Optional getTaxIdentificationNumber() { + return taxIdentificationNumber; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsRequestBodyPersonalAddress + && equalTo((UpdateVerificationsRequestBodyPersonalAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsRequestBodyPersonalAddress other) { + return businessName.equals(other.businessName) + && businessStructure.equals(other.businessStructure) + && businessTaxIdentificationNumber.equals(other.businessTaxIdentificationNumber) + && country.equals(other.country) + && dateOfBirth.equals(other.dateOfBirth) + && firstName.equals(other.firstName) + && lastName.equals(other.lastName) + && personalAddress.equals(other.personalAddress) + && requestedInformation.equals(other.requestedInformation) + && taxIdentificationNumber.equals(other.taxIdentificationNumber); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.businessName, + this.businessStructure, + this.businessTaxIdentificationNumber, + this.country, + this.dateOfBirth, + this.firstName, + this.lastName, + this.personalAddress, + this.requestedInformation, + this.taxIdentificationNumber); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional businessName = Optional.empty(); + + private Optional businessStructure = Optional.empty(); + + private Optional businessTaxIdentificationNumber = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional dateOfBirth = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional lastName = Optional.empty(); + + private Optional personalAddress = + Optional.empty(); + + private Optional> + requestedInformation = Optional.empty(); + + private Optional taxIdentificationNumber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateVerificationsRequestBodyPersonalAddress other) { + businessName(other.getBusinessName()); + businessStructure(other.getBusinessStructure()); + businessTaxIdentificationNumber(other.getBusinessTaxIdentificationNumber()); + country(other.getCountry()); + dateOfBirth(other.getDateOfBirth()); + firstName(other.getFirstName()); + lastName(other.getLastName()); + personalAddress(other.getPersonalAddress()); + requestedInformation(other.getRequestedInformation()); + taxIdentificationNumber(other.getTaxIdentificationNumber()); + return this; + } + + /** + *

Legal business name for a sole proprietor or single-member LLC.

+ */ + @JsonSetter(value = "business_name", nulls = Nulls.SKIP) + public Builder businessName(Optional businessName) { + this.businessName = businessName; + return this; + } + + public Builder businessName(String businessName) { + this.businessName = Optional.ofNullable(businessName); + return this; + } + + /** + *

Entity type for sole proprietors, such as single_member_llc. Supported values vary by country of incorporation — see Business structures.

+ */ + @JsonSetter(value = "business_structure", nulls = Nulls.SKIP) + public Builder businessStructure(Optional businessStructure) { + this.businessStructure = businessStructure; + return this; + } + + public Builder businessStructure(String businessStructure) { + this.businessStructure = Optional.ofNullable(businessStructure); + return this; + } + + /** + *

The business ID number of the company, as appropriate for the company's country. Examples are an Employer Identification Number (EIN) in the US, a Business Number in Canada, or a Company Number in the UK.

+ */ + @JsonSetter(value = "business_tax_identification_number", nulls = Nulls.SKIP) + public Builder businessTaxIdentificationNumber(Optional businessTaxIdentificationNumber) { + this.businessTaxIdentificationNumber = businessTaxIdentificationNumber; + return this; + } + + public Builder businessTaxIdentificationNumber(String businessTaxIdentificationNumber) { + this.businessTaxIdentificationNumber = Optional.ofNullable(businessTaxIdentificationNumber); + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

Formatted as YYYY-MM-DD.

+ */ + @JsonSetter(value = "date_of_birth", nulls = Nulls.SKIP) + public Builder dateOfBirth(Optional dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + public Builder dateOfBirth(String dateOfBirth) { + this.dateOfBirth = Optional.ofNullable(dateOfBirth); + return this; + } + + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public Builder firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public Builder lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + /** + *

Personal address for the individual.

+ */ + @JsonSetter(value = "personal_address", nulls = Nulls.SKIP) + public Builder personalAddress( + Optional personalAddress) { + this.personalAddress = personalAddress; + return this; + } + + public Builder personalAddress(UpdateVerificationsRequestBodyPersonalAddressPersonalAddress personalAddress) { + this.personalAddress = Optional.ofNullable(personalAddress); + return this; + } + + /** + *

Answers to items in requested_information. Each entry pairs the item id with one answer payload matching its type.

+ */ + @JsonSetter(value = "requested_information", nulls = Nulls.SKIP) + public Builder requestedInformation( + Optional> + requestedInformation) { + this.requestedInformation = requestedInformation; + return this; + } + + public Builder requestedInformation( + List requestedInformation) { + this.requestedInformation = Optional.ofNullable(requestedInformation); + return this; + } + + /** + *

The government-issued ID number of the person being verified — the individual for a KYC verification, or the business representative for a KYB verification — as appropriate for their country. Examples are a Social Security Number (SSN) in the US, or a Social Insurance Number in Canada.

+ */ + @JsonSetter(value = "tax_identification_number", nulls = Nulls.SKIP) + public Builder taxIdentificationNumber(Optional taxIdentificationNumber) { + this.taxIdentificationNumber = taxIdentificationNumber; + return this; + } + + public Builder taxIdentificationNumber(String taxIdentificationNumber) { + this.taxIdentificationNumber = Optional.ofNullable(taxIdentificationNumber); + return this; + } + + public UpdateVerificationsRequestBodyPersonalAddress build() { + return new UpdateVerificationsRequestBodyPersonalAddress( + businessName, + businessStructure, + businessTaxIdentificationNumber, + country, + dateOfBirth, + firstName, + lastName, + personalAddress, + requestedInformation, + taxIdentificationNumber, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddressPersonalAddress.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddressPersonalAddress.java new file mode 100644 index 00000000..8cb48d77 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddressPersonalAddress.java @@ -0,0 +1,382 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsRequestBodyPersonalAddressPersonalAddress.Builder.class) +public final class UpdateVerificationsRequestBodyPersonalAddressPersonalAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private UpdateVerificationsRequestBodyPersonalAddressPersonalAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return First line of the street address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return Second line of the street address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Postal or ZIP code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return State, province, or region code, for example CA. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsRequestBodyPersonalAddressPersonalAddress + && equalTo((UpdateVerificationsRequestBodyPersonalAddressPersonalAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsRequestBodyPersonalAddressPersonalAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateVerificationsRequestBodyPersonalAddressPersonalAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

First line of the street address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

Second line of the street address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Postal or ZIP code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

State, province, or region code, for example CA.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public UpdateVerificationsRequestBodyPersonalAddressPersonalAddress build() { + return new UpdateVerificationsRequestBodyPersonalAddressPersonalAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItem.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItem.java new file mode 100644 index 00000000..fe8b9ca0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItem.java @@ -0,0 +1,363 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItem.Builder.class) +public final class UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItem { + private final Optional address; + + private final Optional documents; + + private final Optional> files; + + private final String id; + + private final Optional value; + + private final Optional valueType; + + private final Map additionalProperties; + + private UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItem( + Optional address, + Optional documents, + Optional> files, + String id, + Optional value, + Optional valueType, + Map additionalProperties) { + this.address = address; + this.documents = documents; + this.files = files; + this.id = id; + this.value = value; + this.valueType = valueType; + this.additionalProperties = additionalProperties; + } + + /** + * @return Answer for address items. + */ + @JsonProperty("address") + public Optional getAddress() { + return address; + } + + /** + * @return Answer for an id_document item: the same slot keys Create Verification takes, so the key names both the document and the side. Send every slot for the ID you are uploading — PASSPORT is passport_front; ID_CARD, DRIVERS and RESIDENCE_PERMIT take a front and a back. Each value is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document. + */ + @JsonProperty("documents") + public Optional getDocuments() { + return documents; + } + + /** + * @return Answer for a files item — one document, as a list of its pages, first page first. Each entry is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document. + */ + @JsonProperty("files") + public Optional> getFiles() { + return files; + } + + /** + * @return Item ID from requested_information. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Answer for text, date, phone, and select items, and the chosen document type for a file item that lists options. + */ + @JsonProperty("value") + public Optional getValue() { + return value; + } + + /** + * @return Whether value is raw input or a vault token. + */ + @JsonProperty("value_type") + public Optional getValueType() { + return valueType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItem + && equalTo((UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItem other) { + return address.equals(other.address) + && documents.equals(other.documents) + && files.equals(other.files) + && id.equals(other.id) + && value.equals(other.value) + && valueType.equals(other.valueType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.address, this.documents, this.files, this.id, this.value, this.valueType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Item ID from requested_information.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItem other); + } + + public interface _FinalStage { + UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Answer for address items.

+ */ + _FinalStage address( + Optional address); + + _FinalStage address(UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemAddress address); + + /** + *

Answer for an id_document item: the same slot keys Create Verification takes, so the key names both the document and the side. Send every slot for the ID you are uploading — PASSPORT is passport_front; ID_CARD, DRIVERS and RESIDENCE_PERMIT take a front and a back. Each value is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document.

+ */ + _FinalStage documents( + Optional documents); + + _FinalStage documents(UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemDocuments documents); + + /** + *

Answer for a files item — one document, as a list of its pages, first page first. Each entry is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document.

+ */ + _FinalStage files(Optional> files); + + _FinalStage files(List files); + + /** + *

Answer for text, date, phone, and select items, and the chosen document type for a file item that lists options.

+ */ + _FinalStage value(Optional value); + + _FinalStage value(String value); + + /** + *

Whether value is raw input or a vault token.

+ */ + _FinalStage valueType( + Optional valueType); + + _FinalStage valueType(UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemValueType valueType); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional valueType = + Optional.empty(); + + private Optional value = Optional.empty(); + + private Optional> files = Optional.empty(); + + private Optional documents = + Optional.empty(); + + private Optional address = + Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItem other) { + address(other.getAddress()); + documents(other.getDocuments()); + files(other.getFiles()); + id(other.getId()); + value(other.getValue()); + valueType(other.getValueType()); + return this; + } + + /** + *

Item ID from requested_information.

+ *

Item ID from requested_information.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether value is raw input or a vault token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage valueType( + UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemValueType valueType) { + this.valueType = Optional.ofNullable(valueType); + return this; + } + + /** + *

Whether value is raw input or a vault token.

+ */ + @java.lang.Override + @JsonSetter(value = "value_type", nulls = Nulls.SKIP) + public _FinalStage valueType( + Optional valueType) { + this.valueType = valueType; + return this; + } + + /** + *

Answer for text, date, phone, and select items, and the chosen document type for a file item that lists options.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage value(String value) { + this.value = Optional.ofNullable(value); + return this; + } + + /** + *

Answer for text, date, phone, and select items, and the chosen document type for a file item that lists options.

+ */ + @java.lang.Override + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public _FinalStage value(Optional value) { + this.value = value; + return this; + } + + /** + *

Answer for a files item — one document, as a list of its pages, first page first. Each entry is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage files(List files) { + this.files = Optional.ofNullable(files); + return this; + } + + /** + *

Answer for a files item — one document, as a list of its pages, first page first. Each entry is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document.

+ */ + @java.lang.Override + @JsonSetter(value = "files", nulls = Nulls.SKIP) + public _FinalStage files(Optional> files) { + this.files = files; + return this; + } + + /** + *

Answer for an id_document item: the same slot keys Create Verification takes, so the key names both the document and the side. Send every slot for the ID you are uploading — PASSPORT is passport_front; ID_CARD, DRIVERS and RESIDENCE_PERMIT take a front and a back. Each value is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage documents( + UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemDocuments documents) { + this.documents = Optional.ofNullable(documents); + return this; + } + + /** + *

Answer for an id_document item: the same slot keys Create Verification takes, so the key names both the document and the side. Send every slot for the ID you are uploading — PASSPORT is passport_front; ID_CARD, DRIVERS and RESIDENCE_PERMIT take a front and a back. Each value is a direct upload ID, or a file_-prefixed attachment ID to reuse an uploaded document.

+ */ + @java.lang.Override + @JsonSetter(value = "documents", nulls = Nulls.SKIP) + public _FinalStage documents( + Optional documents) { + this.documents = documents; + return this; + } + + /** + *

Answer for address items.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage address( + UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemAddress address) { + this.address = Optional.ofNullable(address); + return this; + } + + /** + *

Answer for address items.

+ */ + @java.lang.Override + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public _FinalStage address( + Optional address) { + this.address = address; + return this; + } + + @java.lang.Override + public UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItem build() { + return new UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItem( + address, documents, files, id, value, valueType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemAddress.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemAddress.java new file mode 100644 index 00000000..7b417035 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemAddress.java @@ -0,0 +1,382 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemAddress.Builder.class) +public final class UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return First line of the street address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return Second line of the street address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Postal or ZIP code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return State, province, or region code, for example CA. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemAddress + && equalTo((UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

First line of the street address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

Second line of the street address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Postal or ZIP code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

State, province, or region code, for example CA.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemAddress build() { + return new UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemDocuments.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemDocuments.java new file mode 100644 index 00000000..66f7c5f0 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemDocuments.java @@ -0,0 +1,309 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemDocuments.Builder.class) +public final class UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemDocuments { + private final Optional driversBack; + + private final Optional driversFront; + + private final Optional idCardBack; + + private final Optional idCardFront; + + private final Optional passportFront; + + private final Optional residencePermitBack; + + private final Optional residencePermitFront; + + private final Map additionalProperties; + + private UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemDocuments( + Optional driversBack, + Optional driversFront, + Optional idCardBack, + Optional idCardFront, + Optional passportFront, + Optional residencePermitBack, + Optional residencePermitFront, + Map additionalProperties) { + this.driversBack = driversBack; + this.driversFront = driversFront; + this.idCardBack = idCardBack; + this.idCardFront = idCardFront; + this.passportFront = passportFront; + this.residencePermitBack = residencePermitBack; + this.residencePermitFront = residencePermitFront; + this.additionalProperties = additionalProperties; + } + + /** + * @return Back of the driver's license. + */ + @JsonProperty("drivers_back") + public Optional getDriversBack() { + return driversBack; + } + + /** + * @return Front of the driver's license. + */ + @JsonProperty("drivers_front") + public Optional getDriversFront() { + return driversFront; + } + + /** + * @return Back of the ID card. + */ + @JsonProperty("id_card_back") + public Optional getIdCardBack() { + return idCardBack; + } + + /** + * @return Front of the ID card. + */ + @JsonProperty("id_card_front") + public Optional getIdCardFront() { + return idCardFront; + } + + /** + * @return Photo page of the passport. + */ + @JsonProperty("passport_front") + public Optional getPassportFront() { + return passportFront; + } + + /** + * @return Back of the residence permit. + */ + @JsonProperty("residence_permit_back") + public Optional getResidencePermitBack() { + return residencePermitBack; + } + + /** + * @return Front of the residence permit. + */ + @JsonProperty("residence_permit_front") + public Optional getResidencePermitFront() { + return residencePermitFront; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemDocuments + && equalTo((UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemDocuments) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemDocuments other) { + return driversBack.equals(other.driversBack) + && driversFront.equals(other.driversFront) + && idCardBack.equals(other.idCardBack) + && idCardFront.equals(other.idCardFront) + && passportFront.equals(other.passportFront) + && residencePermitBack.equals(other.residencePermitBack) + && residencePermitFront.equals(other.residencePermitFront); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.driversBack, + this.driversFront, + this.idCardBack, + this.idCardFront, + this.passportFront, + this.residencePermitBack, + this.residencePermitFront); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional driversBack = Optional.empty(); + + private Optional driversFront = Optional.empty(); + + private Optional idCardBack = Optional.empty(); + + private Optional idCardFront = Optional.empty(); + + private Optional passportFront = Optional.empty(); + + private Optional residencePermitBack = Optional.empty(); + + private Optional residencePermitFront = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemDocuments other) { + driversBack(other.getDriversBack()); + driversFront(other.getDriversFront()); + idCardBack(other.getIdCardBack()); + idCardFront(other.getIdCardFront()); + passportFront(other.getPassportFront()); + residencePermitBack(other.getResidencePermitBack()); + residencePermitFront(other.getResidencePermitFront()); + return this; + } + + /** + *

Back of the driver's license.

+ */ + @JsonSetter(value = "drivers_back", nulls = Nulls.SKIP) + public Builder driversBack(Optional driversBack) { + this.driversBack = driversBack; + return this; + } + + public Builder driversBack(String driversBack) { + this.driversBack = Optional.ofNullable(driversBack); + return this; + } + + /** + *

Front of the driver's license.

+ */ + @JsonSetter(value = "drivers_front", nulls = Nulls.SKIP) + public Builder driversFront(Optional driversFront) { + this.driversFront = driversFront; + return this; + } + + public Builder driversFront(String driversFront) { + this.driversFront = Optional.ofNullable(driversFront); + return this; + } + + /** + *

Back of the ID card.

+ */ + @JsonSetter(value = "id_card_back", nulls = Nulls.SKIP) + public Builder idCardBack(Optional idCardBack) { + this.idCardBack = idCardBack; + return this; + } + + public Builder idCardBack(String idCardBack) { + this.idCardBack = Optional.ofNullable(idCardBack); + return this; + } + + /** + *

Front of the ID card.

+ */ + @JsonSetter(value = "id_card_front", nulls = Nulls.SKIP) + public Builder idCardFront(Optional idCardFront) { + this.idCardFront = idCardFront; + return this; + } + + public Builder idCardFront(String idCardFront) { + this.idCardFront = Optional.ofNullable(idCardFront); + return this; + } + + /** + *

Photo page of the passport.

+ */ + @JsonSetter(value = "passport_front", nulls = Nulls.SKIP) + public Builder passportFront(Optional passportFront) { + this.passportFront = passportFront; + return this; + } + + public Builder passportFront(String passportFront) { + this.passportFront = Optional.ofNullable(passportFront); + return this; + } + + /** + *

Back of the residence permit.

+ */ + @JsonSetter(value = "residence_permit_back", nulls = Nulls.SKIP) + public Builder residencePermitBack(Optional residencePermitBack) { + this.residencePermitBack = residencePermitBack; + return this; + } + + public Builder residencePermitBack(String residencePermitBack) { + this.residencePermitBack = Optional.ofNullable(residencePermitBack); + return this; + } + + /** + *

Front of the residence permit.

+ */ + @JsonSetter(value = "residence_permit_front", nulls = Nulls.SKIP) + public Builder residencePermitFront(Optional residencePermitFront) { + this.residencePermitFront = residencePermitFront; + return this; + } + + public Builder residencePermitFront(String residencePermitFront) { + this.residencePermitFront = Optional.ofNullable(residencePermitFront); + return this; + } + + public UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemDocuments build() { + return new UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemDocuments( + driversBack, + driversFront, + idCardBack, + idCardFront, + passportFront, + residencePermitBack, + residencePermitFront, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemValueType.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemValueType.java new file mode 100644 index 00000000..ac24556e --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemValueType.java @@ -0,0 +1,90 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemValueType { + public static final UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemValueType VAULT_TOKEN = + new UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemValueType( + Value.VAULT_TOKEN, "vault_token"); + + public static final UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemValueType RAW = + new UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemValueType(Value.RAW, "raw"); + + private final Value value; + + private final String string; + + UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemValueType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemValueType + && this.string.equals( + ((UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemValueType) other) + .string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VAULT_TOKEN: + return visitor.visitVaultToken(); + case RAW: + return visitor.visitRaw(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemValueType valueOf(String value) { + switch (value) { + case "vault_token": + return VAULT_TOKEN; + case "raw": + return RAW; + default: + return new UpdateVerificationsRequestBodyPersonalAddressRequestedInformationItemValueType( + Value.UNKNOWN, value); + } + } + + public enum Value { + RAW, + + VAULT_TOKEN, + + UNKNOWN + } + + public interface Visitor { + T visitRaw(); + + T visitVaultToken(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponse.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponse.java new file mode 100644 index 00000000..6ece3a59 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponse.java @@ -0,0 +1,818 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsResponse.Builder.class) +public final class UpdateVerificationsResponse { + private final Optional address; + + private final Optional businessName; + + private final Optional businessStructure; + + private final Optional country; + + private final Optional createdAt; + + private final Optional dateOfBirth; + + private final Optional email; + + private final Optional firstName; + + private final Optional id; + + private final Optional kind; + + private final Optional lastName; + + private final Optional phone; + + private final Optional> requestedInformation; + + private final Optional> requiredDocuments; + + private final Optional sessionUrl; + + private final Optional status; + + private final Optional updatedAt; + + private final Map additionalProperties; + + private UpdateVerificationsResponse( + Optional address, + Optional businessName, + Optional businessStructure, + Optional country, + Optional createdAt, + Optional dateOfBirth, + Optional email, + Optional firstName, + Optional id, + Optional kind, + Optional lastName, + Optional phone, + Optional> requestedInformation, + Optional> requiredDocuments, + Optional sessionUrl, + Optional status, + Optional updatedAt, + Map additionalProperties) { + this.address = address; + this.businessName = businessName; + this.businessStructure = businessStructure; + this.country = country; + this.createdAt = createdAt; + this.dateOfBirth = dateOfBirth; + this.email = email; + this.firstName = firstName; + this.id = id; + this.kind = kind; + this.lastName = lastName; + this.phone = phone; + this.requestedInformation = requestedInformation; + this.requiredDocuments = requiredDocuments; + this.sessionUrl = sessionUrl; + this.status = status; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return Address on the verification profile. null when no address is set. + */ + @JsonIgnore + public Optional getAddress() { + if (address == null) { + return Optional.empty(); + } + return address; + } + + /** + * @return Legal business name. + */ + @JsonIgnore + public Optional getBusinessName() { + if (businessName == null) { + return Optional.empty(); + } + return businessName; + } + + /** + * @return Legal entity structure of the business, such as private_corporation or sole_proprietorship. Supported values vary by country of incorporation — see Business structures. + */ + @JsonIgnore + public Optional getBusinessStructure() { + if (businessStructure == null) { + return Optional.empty(); + } + return businessStructure; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return When the verification profile was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public Optional getCreatedAt() { + return createdAt; + } + + /** + * @return Formatted as YYYY-MM-DD. + */ + @JsonIgnore + public Optional getDateOfBirth() { + if (dateOfBirth == null) { + return Optional.empty(); + } + return dateOfBirth; + } + + /** + * @return Email address on the verification profile. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + @JsonIgnore + public Optional getFirstName() { + if (firstName == null) { + return Optional.empty(); + } + return firstName; + } + + /** + * @return Verification profile ID, prefixed idpf_. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonProperty("kind") + public Optional getKind() { + return kind; + } + + @JsonIgnore + public Optional getLastName() { + if (lastName == null) { + return Optional.empty(); + } + return lastName; + } + + /** + * @return Phone number on the verification profile. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + /** + * @return What Whop still needs before review can continue — one requirement per entry. Answer with Update Verification; nothing from the response is echoed back. Keys that don't apply are omitted. + */ + @JsonProperty("requested_information") + public Optional> getRequestedInformation() { + return requestedInformation; + } + + /** + * @return Documents for a document-upload verification and their progress. Present only on verifications created by sending documents. pending_upload documents were not accepted yet — send the full set again with another Create Verification call. + */ + @JsonProperty("required_documents") + public Optional> getRequiredDocuments() { + return requiredDocuments; + } + + /** + * @return Hosted verification session URL for the user to complete identity checks. Expires 7 days after creation. + */ + @JsonIgnore + public Optional getSessionUrl() { + if (sessionUrl == null) { + return Optional.empty(); + } + return sessionUrl; + } + + /** + * @return Current verification state. not_started before any session exists; pending while a session needs the user's input; processing while the provider's automated checks run on a fresh submission; action_required when requested_information needs answers; manual_review while information already sent is under review — an audit answer, or a document the payout provider holds — nothing to submit, usually done within 3 business days; approved on success; rejected on failure. Call Create Verification again to start a new session. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return When the verification profile was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public Optional getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("address") + private Optional _getAddress() { + return address; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_name") + private Optional _getBusinessName() { + return businessName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_structure") + private Optional _getBusinessStructure() { + return businessStructure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("date_of_birth") + private Optional _getDateOfBirth() { + return dateOfBirth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_name") + private Optional _getFirstName() { + return firstName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_name") + private Optional _getLastName() { + return lastName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("session_url") + private Optional _getSessionUrl() { + return sessionUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsResponse && equalTo((UpdateVerificationsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsResponse other) { + return address.equals(other.address) + && businessName.equals(other.businessName) + && businessStructure.equals(other.businessStructure) + && country.equals(other.country) + && createdAt.equals(other.createdAt) + && dateOfBirth.equals(other.dateOfBirth) + && email.equals(other.email) + && firstName.equals(other.firstName) + && id.equals(other.id) + && kind.equals(other.kind) + && lastName.equals(other.lastName) + && phone.equals(other.phone) + && requestedInformation.equals(other.requestedInformation) + && requiredDocuments.equals(other.requiredDocuments) + && sessionUrl.equals(other.sessionUrl) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.address, + this.businessName, + this.businessStructure, + this.country, + this.createdAt, + this.dateOfBirth, + this.email, + this.firstName, + this.id, + this.kind, + this.lastName, + this.phone, + this.requestedInformation, + this.requiredDocuments, + this.sessionUrl, + this.status, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional address = Optional.empty(); + + private Optional businessName = Optional.empty(); + + private Optional businessStructure = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional dateOfBirth = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional kind = Optional.empty(); + + private Optional lastName = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional> requestedInformation = + Optional.empty(); + + private Optional> requiredDocuments = Optional.empty(); + + private Optional sessionUrl = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional updatedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateVerificationsResponse other) { + address(other.getAddress()); + businessName(other.getBusinessName()); + businessStructure(other.getBusinessStructure()); + country(other.getCountry()); + createdAt(other.getCreatedAt()); + dateOfBirth(other.getDateOfBirth()); + email(other.getEmail()); + firstName(other.getFirstName()); + id(other.getId()); + kind(other.getKind()); + lastName(other.getLastName()); + phone(other.getPhone()); + requestedInformation(other.getRequestedInformation()); + requiredDocuments(other.getRequiredDocuments()); + sessionUrl(other.getSessionUrl()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

Address on the verification profile. null when no address is set.

+ */ + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public Builder address(Optional address) { + this.address = address; + return this; + } + + public Builder address(UpdateVerificationsResponseAddress address) { + this.address = Optional.ofNullable(address); + return this; + } + + public Builder address(Nullable address) { + if (address.isNull()) { + this.address = null; + } else if (address.isEmpty()) { + this.address = Optional.empty(); + } else { + this.address = Optional.of(address.get()); + } + return this; + } + + /** + *

Legal business name.

+ */ + @JsonSetter(value = "business_name", nulls = Nulls.SKIP) + public Builder businessName(Optional businessName) { + this.businessName = businessName; + return this; + } + + public Builder businessName(String businessName) { + this.businessName = Optional.ofNullable(businessName); + return this; + } + + public Builder businessName(Nullable businessName) { + if (businessName.isNull()) { + this.businessName = null; + } else if (businessName.isEmpty()) { + this.businessName = Optional.empty(); + } else { + this.businessName = Optional.of(businessName.get()); + } + return this; + } + + /** + *

Legal entity structure of the business, such as private_corporation or sole_proprietorship. Supported values vary by country of incorporation — see Business structures.

+ */ + @JsonSetter(value = "business_structure", nulls = Nulls.SKIP) + public Builder businessStructure(Optional businessStructure) { + this.businessStructure = businessStructure; + return this; + } + + public Builder businessStructure(String businessStructure) { + this.businessStructure = Optional.ofNullable(businessStructure); + return this; + } + + public Builder businessStructure(Nullable businessStructure) { + if (businessStructure.isNull()) { + this.businessStructure = null; + } else if (businessStructure.isEmpty()) { + this.businessStructure = Optional.empty(); + } else { + this.businessStructure = Optional.of(businessStructure.get()); + } + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

When the verification profile was created, as an ISO 8601 timestamp.

+ */ + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public Builder createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder createdAt(String createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

Formatted as YYYY-MM-DD.

+ */ + @JsonSetter(value = "date_of_birth", nulls = Nulls.SKIP) + public Builder dateOfBirth(Optional dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + public Builder dateOfBirth(String dateOfBirth) { + this.dateOfBirth = Optional.ofNullable(dateOfBirth); + return this; + } + + public Builder dateOfBirth(Nullable dateOfBirth) { + if (dateOfBirth.isNull()) { + this.dateOfBirth = null; + } else if (dateOfBirth.isEmpty()) { + this.dateOfBirth = Optional.empty(); + } else { + this.dateOfBirth = Optional.of(dateOfBirth.get()); + } + return this; + } + + /** + *

Email address on the verification profile.

+ */ + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + public Builder email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public Builder firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + public Builder firstName(Nullable firstName) { + if (firstName.isNull()) { + this.firstName = null; + } else if (firstName.isEmpty()) { + this.firstName = Optional.empty(); + } else { + this.firstName = Optional.of(firstName.get()); + } + return this; + } + + /** + *

Verification profile ID, prefixed idpf_.

+ */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @JsonSetter(value = "kind", nulls = Nulls.SKIP) + public Builder kind(Optional kind) { + this.kind = kind; + return this; + } + + public Builder kind(UpdateVerificationsResponseKind kind) { + this.kind = Optional.ofNullable(kind); + return this; + } + + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public Builder lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + public Builder lastName(Nullable lastName) { + if (lastName.isNull()) { + this.lastName = null; + } else if (lastName.isEmpty()) { + this.lastName = Optional.empty(); + } else { + this.lastName = Optional.of(lastName.get()); + } + return this; + } + + /** + *

Phone number on the verification profile.

+ */ + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + public Builder phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

What Whop still needs before review can continue — one requirement per entry. Answer with Update Verification; nothing from the response is echoed back. Keys that don't apply are omitted.

+ */ + @JsonSetter(value = "requested_information", nulls = Nulls.SKIP) + public Builder requestedInformation( + Optional> requestedInformation) { + this.requestedInformation = requestedInformation; + return this; + } + + public Builder requestedInformation( + List requestedInformation) { + this.requestedInformation = Optional.ofNullable(requestedInformation); + return this; + } + + /** + *

Documents for a document-upload verification and their progress. Present only on verifications created by sending documents. pending_upload documents were not accepted yet — send the full set again with another Create Verification call.

+ */ + @JsonSetter(value = "required_documents", nulls = Nulls.SKIP) + public Builder requiredDocuments( + Optional> requiredDocuments) { + this.requiredDocuments = requiredDocuments; + return this; + } + + public Builder requiredDocuments(List requiredDocuments) { + this.requiredDocuments = Optional.ofNullable(requiredDocuments); + return this; + } + + /** + *

Hosted verification session URL for the user to complete identity checks. Expires 7 days after creation.

+ */ + @JsonSetter(value = "session_url", nulls = Nulls.SKIP) + public Builder sessionUrl(Optional sessionUrl) { + this.sessionUrl = sessionUrl; + return this; + } + + public Builder sessionUrl(String sessionUrl) { + this.sessionUrl = Optional.ofNullable(sessionUrl); + return this; + } + + public Builder sessionUrl(Nullable sessionUrl) { + if (sessionUrl.isNull()) { + this.sessionUrl = null; + } else if (sessionUrl.isEmpty()) { + this.sessionUrl = Optional.empty(); + } else { + this.sessionUrl = Optional.of(sessionUrl.get()); + } + return this; + } + + /** + *

Current verification state. not_started before any session exists; pending while a session needs the user's input; processing while the provider's automated checks run on a fresh submission; action_required when requested_information needs answers; manual_review while information already sent is under review — an audit answer, or a document the payout provider holds — nothing to submit, usually done within 3 business days; approved on success; rejected on failure. Call Create Verification again to start a new session.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(UpdateVerificationsResponseStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

When the verification profile was last updated, as an ISO 8601 timestamp.

+ */ + @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) + public Builder updatedAt(Optional updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder updatedAt(String updatedAt) { + this.updatedAt = Optional.ofNullable(updatedAt); + return this; + } + + public UpdateVerificationsResponse build() { + return new UpdateVerificationsResponse( + address, + businessName, + businessStructure, + country, + createdAt, + dateOfBirth, + email, + firstName, + id, + kind, + lastName, + phone, + requestedInformation, + requiredDocuments, + sessionUrl, + status, + updatedAt, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseAddress.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseAddress.java new file mode 100644 index 00000000..3213e012 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseAddress.java @@ -0,0 +1,362 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsResponseAddress.Builder.class) +public final class UpdateVerificationsResponseAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private UpdateVerificationsResponseAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return Two-letter ISO 3166-1 country code, for example US, DE, or GB. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return First line of the street address. + */ + @JsonProperty("line1") + public Optional getLine1() { + return line1; + } + + /** + * @return Second line of the street address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return Postal or ZIP code. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return State, province, or region code, for example CA. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsResponseAddress + && equalTo((UpdateVerificationsResponseAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsResponseAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateVerificationsResponseAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Two-letter ISO 3166-1 country code, for example US, DE, or GB.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

First line of the street address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + /** + *

Second line of the street address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

Postal or ZIP code.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

State, province, or region code, for example CA.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public UpdateVerificationsResponseAddress build() { + return new UpdateVerificationsResponseAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseKind.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseKind.java new file mode 100644 index 00000000..80a460af --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseKind.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateVerificationsResponseKind { + public static final UpdateVerificationsResponseKind INDIVIDUAL = + new UpdateVerificationsResponseKind(Value.INDIVIDUAL, "individual"); + + public static final UpdateVerificationsResponseKind BUSINESS = + new UpdateVerificationsResponseKind(Value.BUSINESS, "business"); + + private final Value value; + + private final String string; + + UpdateVerificationsResponseKind(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateVerificationsResponseKind + && this.string.equals(((UpdateVerificationsResponseKind) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INDIVIDUAL: + return visitor.visitIndividual(); + case BUSINESS: + return visitor.visitBusiness(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateVerificationsResponseKind valueOf(String value) { + switch (value) { + case "individual": + return INDIVIDUAL; + case "business": + return BUSINESS; + default: + return new UpdateVerificationsResponseKind(Value.UNKNOWN, value); + } + } + + public enum Value { + INDIVIDUAL, + + BUSINESS, + + UNKNOWN + } + + public interface Visitor { + T visitIndividual(); + + T visitBusiness(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseRequestedInformationItem.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseRequestedInformationItem.java new file mode 100644 index 00000000..bc9c220a --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseRequestedInformationItem.java @@ -0,0 +1,371 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsResponseRequestedInformationItem.Builder.class) +public final class UpdateVerificationsResponseRequestedInformationItem { + private final Optional> errors; + + private final String id; + + private final String label; + + private final Optional optional; + + private final Optional> options; + + private final String requirement; + + private final String type; + + private final Map additionalProperties; + + private UpdateVerificationsResponseRequestedInformationItem( + Optional> errors, + String id, + String label, + Optional optional, + Optional> options, + String requirement, + String type, + Map additionalProperties) { + this.errors = errors; + this.id = id; + this.label = label; + this.optional = optional; + this.options = options; + this.requirement = requirement; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Present after a rejected submission. + */ + @JsonProperty("errors") + public Optional> getErrors() { + return errors; + } + + /** + * @return Requested information item ID, prefixed inrqi_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Instruction to show the user. Carries the reviewer's note verbatim when there is one. + */ + @JsonProperty("label") + public String getLabel() { + return label; + } + + /** + * @return true when the item can be skipped. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make. + */ + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + + /** + * @return What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type. + */ + @JsonProperty("requirement") + public String getRequirement() { + return requirement; + } + + /** + * @return What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address). + */ + @JsonProperty("type") + public String getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsResponseRequestedInformationItem + && equalTo((UpdateVerificationsResponseRequestedInformationItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsResponseRequestedInformationItem other) { + return errors.equals(other.errors) + && id.equals(other.id) + && label.equals(other.label) + && optional.equals(other.optional) + && options.equals(other.options) + && requirement.equals(other.requirement) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.errors, this.id, this.label, this.optional, this.options, this.requirement, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Requested information item ID, prefixed inrqi_.

+ */ + LabelStage id(@NotNull String id); + + Builder from(UpdateVerificationsResponseRequestedInformationItem other); + } + + public interface LabelStage { + /** + *

Instruction to show the user. Carries the reviewer's note verbatim when there is one.

+ */ + RequirementStage label(@NotNull String label); + } + + public interface RequirementStage { + /** + *

What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type.

+ */ + TypeStage requirement(@NotNull String requirement); + } + + public interface TypeStage { + /** + *

What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address).

+ */ + _FinalStage type(@NotNull String type); + } + + public interface _FinalStage { + UpdateVerificationsResponseRequestedInformationItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Present after a rejected submission.

+ */ + _FinalStage errors(Optional> errors); + + _FinalStage errors(List errors); + + /** + *

true when the item can be skipped.

+ */ + _FinalStage optional(Optional optional); + + _FinalStage optional(Boolean optional); + + /** + *

The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make.

+ */ + _FinalStage options(Optional> options); + + _FinalStage options(List options); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, LabelStage, RequirementStage, TypeStage, _FinalStage { + private String id; + + private String label; + + private String requirement; + + private String type; + + private Optional> options = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional> errors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateVerificationsResponseRequestedInformationItem other) { + errors(other.getErrors()); + id(other.getId()); + label(other.getLabel()); + optional(other.getOptional()); + options(other.getOptions()); + requirement(other.getRequirement()); + type(other.getType()); + return this; + } + + /** + *

Requested information item ID, prefixed inrqi_.

+ *

Requested information item ID, prefixed inrqi_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LabelStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Instruction to show the user. Carries the reviewer's note verbatim when there is one.

+ *

Instruction to show the user. Carries the reviewer's note verbatim when there is one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("label") + public RequirementStage label(@NotNull String label) { + this.label = Objects.requireNonNull(label, "label must not be null"); + return this; + } + + /** + *

What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type.

+ *

What is needed: a document name such as bank_statement, or a field key such as ssn or identity_document. Handle unrecognized values by type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("requirement") + public TypeStage requirement(@NotNull String requirement) { + this.requirement = Objects.requireNonNull(requirement, "requirement must not be null"); + return this; + } + + /** + *

What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address).

+ *

What to send as the answer, so you never have to infer it: files (a document, as a list of its pages), id_document (send documents with the slot keys for the ID you are uploading), text, date, phone or select (send value), or address (send address).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + /** + *

The values value may take on a select item. On an id_document item these are the ID types accepted, and the chosen one decides which documents slots to send. Absent when the item has no choice to make.

+ */ + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional> options) { + this.options = options; + return this; + } + + /** + *

true when the item can be skipped.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

true when the item can be skipped.

+ */ + @java.lang.Override + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public _FinalStage optional(Optional optional) { + this.optional = optional; + return this; + } + + /** + *

Present after a rejected submission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errors(List errors) { + this.errors = Optional.ofNullable(errors); + return this; + } + + /** + *

Present after a rejected submission.

+ */ + @java.lang.Override + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public _FinalStage errors( + Optional> errors) { + this.errors = errors; + return this; + } + + @java.lang.Override + public UpdateVerificationsResponseRequestedInformationItem build() { + return new UpdateVerificationsResponseRequestedInformationItem( + errors, id, label, optional, options, requirement, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseRequestedInformationItemErrorsItem.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseRequestedInformationItemErrorsItem.java new file mode 100644 index 00000000..69483d98 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseRequestedInformationItemErrorsItem.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsResponseRequestedInformationItemErrorsItem.Builder.class) +public final class UpdateVerificationsResponseRequestedInformationItemErrorsItem { + private final Optional code; + + private final Optional reason; + + private final Map additionalProperties; + + private UpdateVerificationsResponseRequestedInformationItemErrorsItem( + Optional code, Optional reason, Map additionalProperties) { + this.code = code; + this.reason = reason; + this.additionalProperties = additionalProperties; + } + + /** + * @return Stable error code. + */ + @JsonProperty("code") + public Optional getCode() { + return code; + } + + /** + * @return Why it was rejected. + */ + @JsonProperty("reason") + public Optional getReason() { + return reason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsResponseRequestedInformationItemErrorsItem + && equalTo((UpdateVerificationsResponseRequestedInformationItemErrorsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsResponseRequestedInformationItemErrorsItem other) { + return code.equals(other.code) && reason.equals(other.reason); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.reason); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional code = Optional.empty(); + + private Optional reason = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateVerificationsResponseRequestedInformationItemErrorsItem other) { + code(other.getCode()); + reason(other.getReason()); + return this; + } + + /** + *

Stable error code.

+ */ + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public Builder code(Optional code) { + this.code = code; + return this; + } + + public Builder code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

Why it was rejected.

+ */ + @JsonSetter(value = "reason", nulls = Nulls.SKIP) + public Builder reason(Optional reason) { + this.reason = reason; + return this; + } + + public Builder reason(String reason) { + this.reason = Optional.ofNullable(reason); + return this; + } + + public UpdateVerificationsResponseRequestedInformationItemErrorsItem build() { + return new UpdateVerificationsResponseRequestedInformationItemErrorsItem( + code, reason, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseRequiredDocumentsItem.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseRequiredDocumentsItem.java new file mode 100644 index 00000000..298d9ae3 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseRequiredDocumentsItem.java @@ -0,0 +1,198 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVerificationsResponseRequiredDocumentsItem.Builder.class) +public final class UpdateVerificationsResponseRequiredDocumentsItem { + private final Optional document; + + private final Optional rejectionReason; + + private final Optional status; + + private final Map additionalProperties; + + private UpdateVerificationsResponseRequiredDocumentsItem( + Optional document, + Optional rejectionReason, + Optional status, + Map additionalProperties) { + this.document = document; + this.rejectionReason = rejectionReason; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Document slot key, such as id_card_front, id_card_back, or selfie. + */ + @JsonProperty("document") + public Optional getDocument() { + return document; + } + + /** + * @return Why the previous submission was rejected, when the provider requested new documents or declined the verification. + */ + @JsonIgnore + public Optional getRejectionReason() { + if (rejectionReason == null) { + return Optional.empty(); + } + return rejectionReason; + } + + /** + * @return pending_upload until the document has been relayed for review; submitted afterwards. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("rejection_reason") + private Optional _getRejectionReason() { + return rejectionReason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVerificationsResponseRequiredDocumentsItem + && equalTo((UpdateVerificationsResponseRequiredDocumentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVerificationsResponseRequiredDocumentsItem other) { + return document.equals(other.document) + && rejectionReason.equals(other.rejectionReason) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.document, this.rejectionReason, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional document = Optional.empty(); + + private Optional rejectionReason = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateVerificationsResponseRequiredDocumentsItem other) { + document(other.getDocument()); + rejectionReason(other.getRejectionReason()); + status(other.getStatus()); + return this; + } + + /** + *

Document slot key, such as id_card_front, id_card_back, or selfie.

+ */ + @JsonSetter(value = "document", nulls = Nulls.SKIP) + public Builder document(Optional document) { + this.document = document; + return this; + } + + public Builder document(String document) { + this.document = Optional.ofNullable(document); + return this; + } + + /** + *

Why the previous submission was rejected, when the provider requested new documents or declined the verification.

+ */ + @JsonSetter(value = "rejection_reason", nulls = Nulls.SKIP) + public Builder rejectionReason(Optional rejectionReason) { + this.rejectionReason = rejectionReason; + return this; + } + + public Builder rejectionReason(String rejectionReason) { + this.rejectionReason = Optional.ofNullable(rejectionReason); + return this; + } + + public Builder rejectionReason(Nullable rejectionReason) { + if (rejectionReason.isNull()) { + this.rejectionReason = null; + } else if (rejectionReason.isEmpty()) { + this.rejectionReason = Optional.empty(); + } else { + this.rejectionReason = Optional.of(rejectionReason.get()); + } + return this; + } + + /** + *

pending_upload until the document has been relayed for review; submitted afterwards.

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(UpdateVerificationsResponseRequiredDocumentsItemStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public UpdateVerificationsResponseRequiredDocumentsItem build() { + return new UpdateVerificationsResponseRequiredDocumentsItem( + document, rejectionReason, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseRequiredDocumentsItemStatus.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseRequiredDocumentsItemStatus.java new file mode 100644 index 00000000..0f9e624a --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseRequiredDocumentsItemStatus.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateVerificationsResponseRequiredDocumentsItemStatus { + public static final UpdateVerificationsResponseRequiredDocumentsItemStatus PENDING_UPLOAD = + new UpdateVerificationsResponseRequiredDocumentsItemStatus(Value.PENDING_UPLOAD, "pending_upload"); + + public static final UpdateVerificationsResponseRequiredDocumentsItemStatus SUBMITTED = + new UpdateVerificationsResponseRequiredDocumentsItemStatus(Value.SUBMITTED, "submitted"); + + private final Value value; + + private final String string; + + UpdateVerificationsResponseRequiredDocumentsItemStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateVerificationsResponseRequiredDocumentsItemStatus + && this.string.equals(((UpdateVerificationsResponseRequiredDocumentsItemStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING_UPLOAD: + return visitor.visitPendingUpload(); + case SUBMITTED: + return visitor.visitSubmitted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateVerificationsResponseRequiredDocumentsItemStatus valueOf(String value) { + switch (value) { + case "pending_upload": + return PENDING_UPLOAD; + case "submitted": + return SUBMITTED; + default: + return new UpdateVerificationsResponseRequiredDocumentsItemStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING_UPLOAD, + + SUBMITTED, + + UNKNOWN + } + + public interface Visitor { + T visitPendingUpload(); + + T visitSubmitted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseStatus.java b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseStatus.java new file mode 100644 index 00000000..c0769af9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/verifications/types/UpdateVerificationsResponseStatus.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.verifications.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateVerificationsResponseStatus { + public static final UpdateVerificationsResponseStatus APPROVED = + new UpdateVerificationsResponseStatus(Value.APPROVED, "approved"); + + public static final UpdateVerificationsResponseStatus MANUAL_REVIEW = + new UpdateVerificationsResponseStatus(Value.MANUAL_REVIEW, "manual_review"); + + public static final UpdateVerificationsResponseStatus PENDING = + new UpdateVerificationsResponseStatus(Value.PENDING, "pending"); + + public static final UpdateVerificationsResponseStatus PROCESSING = + new UpdateVerificationsResponseStatus(Value.PROCESSING, "processing"); + + public static final UpdateVerificationsResponseStatus NOT_STARTED = + new UpdateVerificationsResponseStatus(Value.NOT_STARTED, "not_started"); + + public static final UpdateVerificationsResponseStatus REJECTED = + new UpdateVerificationsResponseStatus(Value.REJECTED, "rejected"); + + public static final UpdateVerificationsResponseStatus ACTION_REQUIRED = + new UpdateVerificationsResponseStatus(Value.ACTION_REQUIRED, "action_required"); + + private final Value value; + + private final String string; + + UpdateVerificationsResponseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateVerificationsResponseStatus + && this.string.equals(((UpdateVerificationsResponseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case MANUAL_REVIEW: + return visitor.visitManualReview(); + case PENDING: + return visitor.visitPending(); + case PROCESSING: + return visitor.visitProcessing(); + case NOT_STARTED: + return visitor.visitNotStarted(); + case REJECTED: + return visitor.visitRejected(); + case ACTION_REQUIRED: + return visitor.visitActionRequired(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateVerificationsResponseStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "manual_review": + return MANUAL_REVIEW; + case "pending": + return PENDING; + case "processing": + return PROCESSING; + case "not_started": + return NOT_STARTED; + case "rejected": + return REJECTED; + case "action_required": + return ACTION_REQUIRED; + default: + return new UpdateVerificationsResponseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + NOT_STARTED, + + PENDING, + + PROCESSING, + + MANUAL_REVIEW, + + APPROVED, + + REJECTED, + + ACTION_REQUIRED, + + UNKNOWN + } + + public interface Visitor { + T visitNotStarted(); + + T visitPending(); + + T visitProcessing(); + + T visitManualReview(); + + T visitApproved(); + + T visitRejected(); + + T visitActionRequired(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/AsyncRawWebhooksClient.java b/src/main/java/com/whop/api/resources/webhooks/AsyncRawWebhooksClient.java new file mode 100644 index 00000000..23b483fa --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/AsyncRawWebhooksClient.java @@ -0,0 +1,1216 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.webhooks.requests.CreateWebhooksRequest; +import com.whop.api.resources.webhooks.requests.DeleteWebhooksRequest; +import com.whop.api.resources.webhooks.requests.DeliveriesWebhookRequest; +import com.whop.api.resources.webhooks.requests.ListDeliveriesWebhooksRequest; +import com.whop.api.resources.webhooks.requests.ListWebhooksRequest; +import com.whop.api.resources.webhooks.requests.ReplayDeliveryWebhooksRequest; +import com.whop.api.resources.webhooks.requests.ReplayWebhooksRequest; +import com.whop.api.resources.webhooks.requests.RetrieveWebhooksRequest; +import com.whop.api.resources.webhooks.requests.TestWebhooksRequest; +import com.whop.api.resources.webhooks.requests.UpdateWebhooksRequest; +import com.whop.api.resources.webhooks.types.DeleteWebhooksResponse; +import com.whop.api.resources.webhooks.types.DeliveriesWebhookResponse; +import com.whop.api.resources.webhooks.types.DeliveriesWebhookResponseDataItem; +import com.whop.api.resources.webhooks.types.ListDeliveriesWebhooksResponse; +import com.whop.api.resources.webhooks.types.ListWebhooksResponse; +import com.whop.api.resources.webhooks.types.ReplayDeliveryWebhooksResponse; +import com.whop.api.resources.webhooks.types.ReplayWebhooksResponse; +import com.whop.api.resources.webhooks.types.TestWebhooksResponse; +import com.whop.api.types.V1ErrorResponse; +import com.whop.api.types.Webhook; +import com.whop.api.types.WebhookDelivery; +import com.whop.api.types.WebhookListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawWebhooksClient { + protected final ClientOptions clientOptions; + + public AsyncRawWebhooksClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of webhook endpoints configured for an account, ordered by most recently created. + */ + public CompletableFuture>> list( + ListWebhooksRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of webhook endpoints configured for an account, ordered by most recently created. + */ + public CompletableFuture>> list( + ListWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getIncludeAppWebhooks().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_app_webhooks", + request.getIncludeAppWebhooks().get(), + false); + } + if (request.getHasFailures().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "has_failures", request.getHasFailures().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListWebhooksResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListWebhooksResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListWebhooksRequest nextRequest = ListWebhooksRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates a webhook endpoint that receives event notifications via HTTP POST. + */ + public CompletableFuture> create(CreateWebhooksRequest request) { + return create(request, null); + } + + /** + * Creates a webhook endpoint that receives event notifications via HTTP POST. + */ + public CompletableFuture> create( + CreateWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Webhook.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing webhook. + */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveWebhooksRequest.builder().build()); + } + + /** + * Retrieves the details of an existing webhook. + */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveWebhooksRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing webhook. + */ + public CompletableFuture> retrieve(String id, RetrieveWebhooksRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing webhook. + */ + public CompletableFuture> retrieve( + String id, RetrieveWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Webhook.class), response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public CompletableFuture> delete(String id) { + return delete(id, DeleteWebhooksRequest.builder().build()); + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public CompletableFuture> delete( + String id, RequestOptions requestOptions) { + return delete(id, DeleteWebhooksRequest.builder().build(), requestOptions); + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public CompletableFuture> delete( + String id, DeleteWebhooksRequest request) { + return delete(id, request, null); + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public CompletableFuture> delete( + String id, DeleteWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteWebhooksResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public CompletableFuture> update(String id) { + return update(id, UpdateWebhooksRequest.builder().build()); + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public CompletableFuture> update(String id, RequestOptions requestOptions) { + return update(id, UpdateWebhooksRequest.builder().build(), requestOptions); + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public CompletableFuture> update(String id, UpdateWebhooksRequest request) { + return update(id, request, null); + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public CompletableFuture> update( + String id, UpdateWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Webhook.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public CompletableFuture>> listDeliveries(String id) { + return listDeliveries(id, ListDeliveriesWebhooksRequest.builder().build()); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public CompletableFuture>> listDeliveries( + String id, RequestOptions requestOptions) { + return listDeliveries(id, ListDeliveriesWebhooksRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public CompletableFuture>> listDeliveries( + String id, ListDeliveriesWebhooksRequest request) { + return listDeliveries(id, request, null); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public CompletableFuture>> listDeliveries( + String id, ListDeliveriesWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(id) + .addPathSegments("deliveries"); + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListDeliveriesWebhooksResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListDeliveriesWebhooksResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListDeliveriesWebhooksRequest nextRequest = ListDeliveriesWebhooksRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return listDeliveries(id, nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public CompletableFuture> replayDelivery( + String id, String deliveryId) { + return replayDelivery( + id, deliveryId, ReplayDeliveryWebhooksRequest.builder().build()); + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public CompletableFuture> replayDelivery( + String id, String deliveryId, RequestOptions requestOptions) { + return replayDelivery( + id, deliveryId, ReplayDeliveryWebhooksRequest.builder().build(), requestOptions); + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public CompletableFuture> replayDelivery( + String id, String deliveryId, ReplayDeliveryWebhooksRequest request) { + return replayDelivery(id, deliveryId, request, null); + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public CompletableFuture> replayDelivery( + String id, String deliveryId, ReplayDeliveryWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(id) + .addPathSegments("deliveries") + .addPathSegment(deliveryId) + .addPathSegments("replay"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ReplayDeliveryWebhooksResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Re-sends the webhook's past deliveries within a time window, optionally limited to specific events or to messages whose most recent delivery attempt failed. Fire and forget: nothing about the replay is stored, and each re-send appears as a new entry in the webhook's delivery log. Each matching message is re-sent once, by default with its original webhook-id, so consumers that deduplicate are unaffected; pass regenerate_ids to re-send under freshly generated ids instead. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public CompletableFuture> replay( + String id, ReplayWebhooksRequest request) { + return replay(id, request, null); + } + + /** + * Re-sends the webhook's past deliveries within a time window, optionally limited to specific events or to messages whose most recent delivery attempt failed. Fire and forget: nothing about the replay is stored, and each re-send appears as a new entry in the webhook's delivery log. Each matching message is re-sent once, by default with its original webhook-id, so consumers that deduplicate are unaffected; pass regenerate_ids to re-send under freshly generated ids instead. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public CompletableFuture> replay( + String id, ReplayWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(id) + .addPathSegments("replay"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReplayWebhooksResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Sends a sample payload for the given event to the webhook's URL and returns the delivery result. + */ + public CompletableFuture> test(String id, TestWebhooksRequest request) { + return test(id, request, null); + } + + /** + * Sends a sample payload for the given event to the webhook's URL and returns the delivery result. + */ + public CompletableFuture> test( + String id, TestWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(id) + .addPathSegments("test"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, TestWebhooksResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public CompletableFuture>> + deliveriesWebhook(String webhookId) { + return deliveriesWebhook(webhookId, DeliveriesWebhookRequest.builder().build()); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public CompletableFuture>> + deliveriesWebhook(String webhookId, RequestOptions requestOptions) { + return deliveriesWebhook(webhookId, DeliveriesWebhookRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public CompletableFuture>> + deliveriesWebhook(String webhookId, DeliveriesWebhookRequest request) { + return deliveriesWebhook(webhookId, request, null); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public CompletableFuture>> + deliveriesWebhook(String webhookId, DeliveriesWebhookRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(webhookId) + .addPathSegments("deliveries"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + DeliveriesWebhookResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DeliveriesWebhookResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + DeliveriesWebhookRequest nextRequest = DeliveriesWebhookRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return deliveriesWebhook(webhookId, nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/AsyncWebhooksClient.java b/src/main/java/com/whop/api/resources/webhooks/AsyncWebhooksClient.java new file mode 100644 index 00000000..9a8c6692 --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/AsyncWebhooksClient.java @@ -0,0 +1,304 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.webhooks.requests.CreateWebhooksRequest; +import com.whop.api.resources.webhooks.requests.DeleteWebhooksRequest; +import com.whop.api.resources.webhooks.requests.DeliveriesWebhookRequest; +import com.whop.api.resources.webhooks.requests.ListDeliveriesWebhooksRequest; +import com.whop.api.resources.webhooks.requests.ListWebhooksRequest; +import com.whop.api.resources.webhooks.requests.ReplayDeliveryWebhooksRequest; +import com.whop.api.resources.webhooks.requests.ReplayWebhooksRequest; +import com.whop.api.resources.webhooks.requests.RetrieveWebhooksRequest; +import com.whop.api.resources.webhooks.requests.TestWebhooksRequest; +import com.whop.api.resources.webhooks.requests.UpdateWebhooksRequest; +import com.whop.api.resources.webhooks.types.DeleteWebhooksResponse; +import com.whop.api.resources.webhooks.types.DeliveriesWebhookResponseDataItem; +import com.whop.api.resources.webhooks.types.ReplayDeliveryWebhooksResponse; +import com.whop.api.resources.webhooks.types.ReplayWebhooksResponse; +import com.whop.api.resources.webhooks.types.TestWebhooksResponse; +import com.whop.api.types.Webhook; +import com.whop.api.types.WebhookDelivery; +import com.whop.api.types.WebhookListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncWebhooksClient { + protected final ClientOptions clientOptions; + + private final AsyncRawWebhooksClient rawClient; + + public AsyncWebhooksClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawWebhooksClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawWebhooksClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of webhook endpoints configured for an account, ordered by most recently created. + */ + public CompletableFuture> list(ListWebhooksRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of webhook endpoints configured for an account, ordered by most recently created. + */ + public CompletableFuture> list( + ListWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates a webhook endpoint that receives event notifications via HTTP POST. + */ + public CompletableFuture create(CreateWebhooksRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Creates a webhook endpoint that receives event notifications via HTTP POST. + */ + public CompletableFuture create(CreateWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing webhook. + */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing webhook. + */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing webhook. + */ + public CompletableFuture retrieve(String id, RetrieveWebhooksRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing webhook. + */ + public CompletableFuture retrieve( + String id, RetrieveWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public CompletableFuture delete(String id) { + return this.rawClient.delete(id).thenApply(response -> response.body()); + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public CompletableFuture delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public CompletableFuture delete(String id, DeleteWebhooksRequest request) { + return this.rawClient.delete(id, request).thenApply(response -> response.body()); + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public CompletableFuture delete( + String id, DeleteWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public CompletableFuture update(String id) { + return this.rawClient.update(id).thenApply(response -> response.body()); + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public CompletableFuture update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public CompletableFuture update(String id, UpdateWebhooksRequest request) { + return this.rawClient.update(id, request).thenApply(response -> response.body()); + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public CompletableFuture update(String id, UpdateWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public CompletableFuture> listDeliveries(String id) { + return this.rawClient.listDeliveries(id).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public CompletableFuture> listDeliveries( + String id, RequestOptions requestOptions) { + return this.rawClient.listDeliveries(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public CompletableFuture> listDeliveries( + String id, ListDeliveriesWebhooksRequest request) { + return this.rawClient.listDeliveries(id, request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public CompletableFuture> listDeliveries( + String id, ListDeliveriesWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.listDeliveries(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public CompletableFuture replayDelivery(String id, String deliveryId) { + return this.rawClient.replayDelivery(id, deliveryId).thenApply(response -> response.body()); + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public CompletableFuture replayDelivery( + String id, String deliveryId, RequestOptions requestOptions) { + return this.rawClient.replayDelivery(id, deliveryId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public CompletableFuture replayDelivery( + String id, String deliveryId, ReplayDeliveryWebhooksRequest request) { + return this.rawClient.replayDelivery(id, deliveryId, request).thenApply(response -> response.body()); + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public CompletableFuture replayDelivery( + String id, String deliveryId, ReplayDeliveryWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient + .replayDelivery(id, deliveryId, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Re-sends the webhook's past deliveries within a time window, optionally limited to specific events or to messages whose most recent delivery attempt failed. Fire and forget: nothing about the replay is stored, and each re-send appears as a new entry in the webhook's delivery log. Each matching message is re-sent once, by default with its original webhook-id, so consumers that deduplicate are unaffected; pass regenerate_ids to re-send under freshly generated ids instead. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public CompletableFuture replay(String id, ReplayWebhooksRequest request) { + return this.rawClient.replay(id, request).thenApply(response -> response.body()); + } + + /** + * Re-sends the webhook's past deliveries within a time window, optionally limited to specific events or to messages whose most recent delivery attempt failed. Fire and forget: nothing about the replay is stored, and each re-send appears as a new entry in the webhook's delivery log. Each matching message is re-sent once, by default with its original webhook-id, so consumers that deduplicate are unaffected; pass regenerate_ids to re-send under freshly generated ids instead. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public CompletableFuture replay( + String id, ReplayWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.replay(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Sends a sample payload for the given event to the webhook's URL and returns the delivery result. + */ + public CompletableFuture test(String id, TestWebhooksRequest request) { + return this.rawClient.test(id, request).thenApply(response -> response.body()); + } + + /** + * Sends a sample payload for the given event to the webhook's URL and returns the delivery result. + */ + public CompletableFuture test( + String id, TestWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.test(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public CompletableFuture> deliveriesWebhook( + String webhookId) { + return this.rawClient.deliveriesWebhook(webhookId).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public CompletableFuture> deliveriesWebhook( + String webhookId, RequestOptions requestOptions) { + return this.rawClient.deliveriesWebhook(webhookId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public CompletableFuture> deliveriesWebhook( + String webhookId, DeliveriesWebhookRequest request) { + return this.rawClient.deliveriesWebhook(webhookId, request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public CompletableFuture> deliveriesWebhook( + String webhookId, DeliveriesWebhookRequest request, RequestOptions requestOptions) { + return this.rawClient + .deliveriesWebhook(webhookId, request, requestOptions) + .thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/RawWebhooksClient.java b/src/main/java/com/whop/api/resources/webhooks/RawWebhooksClient.java new file mode 100644 index 00000000..2dc187ca --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/RawWebhooksClient.java @@ -0,0 +1,966 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ConflictError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.webhooks.requests.CreateWebhooksRequest; +import com.whop.api.resources.webhooks.requests.DeleteWebhooksRequest; +import com.whop.api.resources.webhooks.requests.DeliveriesWebhookRequest; +import com.whop.api.resources.webhooks.requests.ListDeliveriesWebhooksRequest; +import com.whop.api.resources.webhooks.requests.ListWebhooksRequest; +import com.whop.api.resources.webhooks.requests.ReplayDeliveryWebhooksRequest; +import com.whop.api.resources.webhooks.requests.ReplayWebhooksRequest; +import com.whop.api.resources.webhooks.requests.RetrieveWebhooksRequest; +import com.whop.api.resources.webhooks.requests.TestWebhooksRequest; +import com.whop.api.resources.webhooks.requests.UpdateWebhooksRequest; +import com.whop.api.resources.webhooks.types.DeleteWebhooksResponse; +import com.whop.api.resources.webhooks.types.DeliveriesWebhookResponse; +import com.whop.api.resources.webhooks.types.DeliveriesWebhookResponseDataItem; +import com.whop.api.resources.webhooks.types.ListDeliveriesWebhooksResponse; +import com.whop.api.resources.webhooks.types.ListWebhooksResponse; +import com.whop.api.resources.webhooks.types.ReplayDeliveryWebhooksResponse; +import com.whop.api.resources.webhooks.types.ReplayWebhooksResponse; +import com.whop.api.resources.webhooks.types.TestWebhooksResponse; +import com.whop.api.types.V1ErrorResponse; +import com.whop.api.types.Webhook; +import com.whop.api.types.WebhookDelivery; +import com.whop.api.types.WebhookListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawWebhooksClient { + protected final ClientOptions clientOptions; + + public RawWebhooksClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of webhook endpoints configured for an account, ordered by most recently created. + */ + public WhopApiHttpResponse> list(ListWebhooksRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of webhook endpoints configured for an account, ordered by most recently created. + */ + public WhopApiHttpResponse> list( + ListWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getIncludeAppWebhooks().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_app_webhooks", + request.getIncludeAppWebhooks().get(), + false); + } + if (request.getHasFailures().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "has_failures", request.getHasFailures().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListWebhooksResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListWebhooksResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListWebhooksRequest nextRequest = ListWebhooksRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates a webhook endpoint that receives event notifications via HTTP POST. + */ + public WhopApiHttpResponse create(CreateWebhooksRequest request) { + return create(request, null); + } + + /** + * Creates a webhook endpoint that receives event notifications via HTTP POST. + */ + public WhopApiHttpResponse create(CreateWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Webhook.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing webhook. + */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveWebhooksRequest.builder().build()); + } + + /** + * Retrieves the details of an existing webhook. + */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveWebhooksRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing webhook. + */ + public WhopApiHttpResponse retrieve(String id, RetrieveWebhooksRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing webhook. + */ + public WhopApiHttpResponse retrieve( + String id, RetrieveWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Webhook.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public WhopApiHttpResponse delete(String id) { + return delete(id, DeleteWebhooksRequest.builder().build()); + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public WhopApiHttpResponse delete(String id, RequestOptions requestOptions) { + return delete(id, DeleteWebhooksRequest.builder().build(), requestOptions); + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public WhopApiHttpResponse delete(String id, DeleteWebhooksRequest request) { + return delete(id, request, null); + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public WhopApiHttpResponse delete( + String id, DeleteWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteWebhooksResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public WhopApiHttpResponse update(String id) { + return update(id, UpdateWebhooksRequest.builder().build()); + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public WhopApiHttpResponse update(String id, RequestOptions requestOptions) { + return update(id, UpdateWebhooksRequest.builder().build(), requestOptions); + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public WhopApiHttpResponse update(String id, UpdateWebhooksRequest request) { + return update(id, request, null); + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public WhopApiHttpResponse update( + String id, UpdateWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Webhook.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public WhopApiHttpResponse> listDeliveries(String id) { + return listDeliveries(id, ListDeliveriesWebhooksRequest.builder().build()); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public WhopApiHttpResponse> listDeliveries( + String id, RequestOptions requestOptions) { + return listDeliveries(id, ListDeliveriesWebhooksRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public WhopApiHttpResponse> listDeliveries( + String id, ListDeliveriesWebhooksRequest request) { + return listDeliveries(id, request, null); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public WhopApiHttpResponse> listDeliveries( + String id, ListDeliveriesWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(id) + .addPathSegments("deliveries"); + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListDeliveriesWebhooksResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListDeliveriesWebhooksResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListDeliveriesWebhooksRequest nextRequest = ListDeliveriesWebhooksRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> listDeliveries( + id, nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public WhopApiHttpResponse replayDelivery(String id, String deliveryId) { + return replayDelivery( + id, deliveryId, ReplayDeliveryWebhooksRequest.builder().build()); + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public WhopApiHttpResponse replayDelivery( + String id, String deliveryId, RequestOptions requestOptions) { + return replayDelivery( + id, deliveryId, ReplayDeliveryWebhooksRequest.builder().build(), requestOptions); + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public WhopApiHttpResponse replayDelivery( + String id, String deliveryId, ReplayDeliveryWebhooksRequest request) { + return replayDelivery(id, deliveryId, request, null); + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public WhopApiHttpResponse replayDelivery( + String id, String deliveryId, ReplayDeliveryWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(id) + .addPathSegments("deliveries") + .addPathSegment(deliveryId) + .addPathSegments("replay"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReplayDeliveryWebhooksResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Re-sends the webhook's past deliveries within a time window, optionally limited to specific events or to messages whose most recent delivery attempt failed. Fire and forget: nothing about the replay is stored, and each re-send appears as a new entry in the webhook's delivery log. Each matching message is re-sent once, by default with its original webhook-id, so consumers that deduplicate are unaffected; pass regenerate_ids to re-send under freshly generated ids instead. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public WhopApiHttpResponse replay(String id, ReplayWebhooksRequest request) { + return replay(id, request, null); + } + + /** + * Re-sends the webhook's past deliveries within a time window, optionally limited to specific events or to messages whose most recent delivery attempt failed. Fire and forget: nothing about the replay is stored, and each re-send appears as a new entry in the webhook's delivery log. Each matching message is re-sent once, by default with its original webhook-id, so consumers that deduplicate are unaffected; pass regenerate_ids to re-send under freshly generated ids instead. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public WhopApiHttpResponse replay( + String id, ReplayWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(id) + .addPathSegments("replay"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReplayWebhooksResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Sends a sample payload for the given event to the webhook's URL and returns the delivery result. + */ + public WhopApiHttpResponse test(String id, TestWebhooksRequest request) { + return test(id, request, null); + } + + /** + * Sends a sample payload for the given event to the webhook's URL and returns the delivery result. + */ + public WhopApiHttpResponse test( + String id, TestWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(id) + .addPathSegments("test"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, TestWebhooksResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, V1ErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public WhopApiHttpResponse> deliveriesWebhook( + String webhookId) { + return deliveriesWebhook(webhookId, DeliveriesWebhookRequest.builder().build()); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public WhopApiHttpResponse> deliveriesWebhook( + String webhookId, RequestOptions requestOptions) { + return deliveriesWebhook(webhookId, DeliveriesWebhookRequest.builder().build(), requestOptions); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public WhopApiHttpResponse> deliveriesWebhook( + String webhookId, DeliveriesWebhookRequest request) { + return deliveriesWebhook(webhookId, request, null); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public WhopApiHttpResponse> deliveriesWebhook( + String webhookId, DeliveriesWebhookRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("webhooks") + .addPathSegment(webhookId) + .addPathSegments("deliveries"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + DeliveriesWebhookResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeliveriesWebhookResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + DeliveriesWebhookRequest nextRequest = DeliveriesWebhookRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> deliveriesWebhook( + webhookId, nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/WebhooksClient.java b/src/main/java/com/whop/api/resources/webhooks/WebhooksClient.java new file mode 100644 index 00000000..1aa40505 --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/WebhooksClient.java @@ -0,0 +1,294 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.webhooks.requests.CreateWebhooksRequest; +import com.whop.api.resources.webhooks.requests.DeleteWebhooksRequest; +import com.whop.api.resources.webhooks.requests.DeliveriesWebhookRequest; +import com.whop.api.resources.webhooks.requests.ListDeliveriesWebhooksRequest; +import com.whop.api.resources.webhooks.requests.ListWebhooksRequest; +import com.whop.api.resources.webhooks.requests.ReplayDeliveryWebhooksRequest; +import com.whop.api.resources.webhooks.requests.ReplayWebhooksRequest; +import com.whop.api.resources.webhooks.requests.RetrieveWebhooksRequest; +import com.whop.api.resources.webhooks.requests.TestWebhooksRequest; +import com.whop.api.resources.webhooks.requests.UpdateWebhooksRequest; +import com.whop.api.resources.webhooks.types.DeleteWebhooksResponse; +import com.whop.api.resources.webhooks.types.DeliveriesWebhookResponseDataItem; +import com.whop.api.resources.webhooks.types.ReplayDeliveryWebhooksResponse; +import com.whop.api.resources.webhooks.types.ReplayWebhooksResponse; +import com.whop.api.resources.webhooks.types.TestWebhooksResponse; +import com.whop.api.types.Webhook; +import com.whop.api.types.WebhookDelivery; +import com.whop.api.types.WebhookListItem; + +public class WebhooksClient { + protected final ClientOptions clientOptions; + + private final RawWebhooksClient rawClient; + + public WebhooksClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawWebhooksClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawWebhooksClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of webhook endpoints configured for an account, ordered by most recently created. + */ + public SyncPagingIterable list(ListWebhooksRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of webhook endpoints configured for an account, ordered by most recently created. + */ + public SyncPagingIterable list(ListWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Creates a webhook endpoint that receives event notifications via HTTP POST. + */ + public Webhook create(CreateWebhooksRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Creates a webhook endpoint that receives event notifications via HTTP POST. + */ + public Webhook create(CreateWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing webhook. + */ + public Webhook retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing webhook. + */ + public Webhook retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing webhook. + */ + public Webhook retrieve(String id, RetrieveWebhooksRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing webhook. + */ + public Webhook retrieve(String id, RetrieveWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public DeleteWebhooksResponse delete(String id) { + return this.rawClient.delete(id).body(); + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public DeleteWebhooksResponse delete(String id, RequestOptions requestOptions) { + return this.rawClient.delete(id, requestOptions).body(); + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public DeleteWebhooksResponse delete(String id, DeleteWebhooksRequest request) { + return this.rawClient.delete(id, request).body(); + } + + /** + * Permanently deletes a webhook endpoint. Returns true on success, matching the legacy proxy response. + */ + public DeleteWebhooksResponse delete(String id, DeleteWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(id, request, requestOptions).body(); + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public Webhook update(String id) { + return this.rawClient.update(id).body(); + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public Webhook update(String id, RequestOptions requestOptions) { + return this.rawClient.update(id, requestOptions).body(); + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public Webhook update(String id, UpdateWebhooksRequest request) { + return this.rawClient.update(id, request).body(); + } + + /** + * Updates a webhook endpoint's URL, subscribed events, pinned payload version, or enabled state. + */ + public Webhook update(String id, UpdateWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.update(id, request, requestOptions).body(); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public SyncPagingIterable listDeliveries(String id) { + return this.rawClient.listDeliveries(id).body(); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public SyncPagingIterable listDeliveries(String id, RequestOptions requestOptions) { + return this.rawClient.listDeliveries(id, requestOptions).body(); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public SyncPagingIterable listDeliveries(String id, ListDeliveriesWebhooksRequest request) { + return this.rawClient.listDeliveries(id, request).body(); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + */ + public SyncPagingIterable listDeliveries( + String id, ListDeliveriesWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.listDeliveries(id, request, requestOptions).body(); + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public ReplayDeliveryWebhooksResponse replayDelivery(String id, String deliveryId) { + return this.rawClient.replayDelivery(id, deliveryId).body(); + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public ReplayDeliveryWebhooksResponse replayDelivery(String id, String deliveryId, RequestOptions requestOptions) { + return this.rawClient.replayDelivery(id, deliveryId, requestOptions).body(); + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public ReplayDeliveryWebhooksResponse replayDelivery( + String id, String deliveryId, ReplayDeliveryWebhooksRequest request) { + return this.rawClient.replayDelivery(id, deliveryId, request).body(); + } + + /** + * Re-sends the exact payload of a past delivery to the webhook's current URL and returns the delivery result. By default the replay keeps the original webhook-id, so consumers that deduplicate on it can drop events they already processed. Pass regenerate_id to re-send under a freshly generated webhook-id instead, so a deduplicating consumer processes the replay as a new message. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public ReplayDeliveryWebhooksResponse replayDelivery( + String id, String deliveryId, ReplayDeliveryWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient + .replayDelivery(id, deliveryId, request, requestOptions) + .body(); + } + + /** + * Re-sends the webhook's past deliveries within a time window, optionally limited to specific events or to messages whose most recent delivery attempt failed. Fire and forget: nothing about the replay is stored, and each re-send appears as a new entry in the webhook's delivery log. Each matching message is re-sent once, by default with its original webhook-id, so consumers that deduplicate are unaffected; pass regenerate_ids to re-send under freshly generated ids instead. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public ReplayWebhooksResponse replay(String id, ReplayWebhooksRequest request) { + return this.rawClient.replay(id, request).body(); + } + + /** + * Re-sends the webhook's past deliveries within a time window, optionally limited to specific events or to messages whose most recent delivery attempt failed. Fire and forget: nothing about the replay is stored, and each re-send appears as a new entry in the webhook's delivery log. Each matching message is re-sent once, by default with its original webhook-id, so consumers that deduplicate are unaffected; pass regenerate_ids to re-send under freshly generated ids instead. Only available for enabled webhooks on API version v1; deliveries are retained for 30 days. + */ + public ReplayWebhooksResponse replay(String id, ReplayWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.replay(id, request, requestOptions).body(); + } + + /** + * Sends a sample payload for the given event to the webhook's URL and returns the delivery result. + */ + public TestWebhooksResponse test(String id, TestWebhooksRequest request) { + return this.rawClient.test(id, request).body(); + } + + /** + * Sends a sample payload for the given event to the webhook's URL and returns the delivery result. + */ + public TestWebhooksResponse test(String id, TestWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.test(id, request, requestOptions).body(); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public SyncPagingIterable deliveriesWebhook(String webhookId) { + return this.rawClient.deliveriesWebhook(webhookId).body(); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public SyncPagingIterable deliveriesWebhook( + String webhookId, RequestOptions requestOptions) { + return this.rawClient.deliveriesWebhook(webhookId, requestOptions).body(); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public SyncPagingIterable deliveriesWebhook( + String webhookId, DeliveriesWebhookRequest request) { + return this.rawClient.deliveriesWebhook(webhookId, request).body(); + } + + /** + * Returns a paginated list of delivery attempts for a webhook, ordered by most recent first. Includes the request payload, response body, response code, and timing for each attempt. + *

Required permissions:

+ *
    + *
  • developer:manage_webhook
  • + *
+ */ + public SyncPagingIterable deliveriesWebhook( + String webhookId, DeliveriesWebhookRequest request, RequestOptions requestOptions) { + return this.rawClient + .deliveriesWebhook(webhookId, request, requestOptions) + .body(); + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/requests/CreateWebhooksRequest.java b/src/main/java/com/whop/api/resources/webhooks/requests/CreateWebhooksRequest.java new file mode 100644 index 00000000..750eca4c --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/requests/CreateWebhooksRequest.java @@ -0,0 +1,409 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.webhooks.types.CreateWebhooksRequestEventsItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateWebhooksRequest.Builder.class) +public final class CreateWebhooksRequest { + private final Optional apiVersionDate; + + private final Optional childResourceEvents; + + private final Optional enabled; + + private final Optional> events; + + private final Optional resourceId; + + private final String url; + + private final Map additionalProperties; + + private CreateWebhooksRequest( + Optional apiVersionDate, + Optional childResourceEvents, + Optional enabled, + Optional> events, + Optional resourceId, + String url, + Map additionalProperties) { + this.apiVersionDate = apiVersionDate; + this.childResourceEvents = childResourceEvents; + this.enabled = enabled; + this.events = events; + this.resourceId = resourceId; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The dated API version (Api-Version-Date) to pin this webhook's payloads to. Omit to leave the webhook unpinned, tracking the current payload shape. + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + /** + * @return Whether to send events for child resources. For example, if the webhook is created for an account, enabling this sends events only from its connected accounts. + */ + @JsonProperty("child_resource_events") + public Optional getChildResourceEvents() { + return childResourceEvents; + } + + /** + * @return Whether or not the webhook is enabled. Defaults to true. + */ + @JsonProperty("enabled") + public Optional getEnabled() { + return enabled; + } + + /** + * @return The events to send the webhook for, in dot form (for example payment.succeeded). + */ + @JsonProperty("events") + public Optional> getEvents() { + return events; + } + + /** + * @return The account or app to create the webhook for. Defaults to the current account. + */ + @JsonIgnore + public Optional getResourceId() { + if (resourceId == null) { + return Optional.empty(); + } + return resourceId; + } + + /** + * @return The URL to send the webhook to. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resource_id") + private Optional _getResourceId() { + return resourceId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateWebhooksRequest && equalTo((CreateWebhooksRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateWebhooksRequest other) { + return apiVersionDate.equals(other.apiVersionDate) + && childResourceEvents.equals(other.childResourceEvents) + && enabled.equals(other.enabled) + && events.equals(other.events) + && resourceId.equals(other.resourceId) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.apiVersionDate, this.childResourceEvents, this.enabled, this.events, this.resourceId, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

The URL to send the webhook to.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(CreateWebhooksRequest other); + } + + public interface _FinalStage { + CreateWebhooksRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The dated API version (Api-Version-Date) to pin this webhook's payloads to. Omit to leave the webhook unpinned, tracking the current payload shape.

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

Whether to send events for child resources. For example, if the webhook is created for an account, enabling this sends events only from its connected accounts.

+ */ + _FinalStage childResourceEvents(Optional childResourceEvents); + + _FinalStage childResourceEvents(Boolean childResourceEvents); + + /** + *

Whether or not the webhook is enabled. Defaults to true.

+ */ + _FinalStage enabled(Optional enabled); + + _FinalStage enabled(Boolean enabled); + + /** + *

The events to send the webhook for, in dot form (for example payment.succeeded).

+ */ + _FinalStage events(Optional> events); + + _FinalStage events(List events); + + /** + *

The account or app to create the webhook for. Defaults to the current account.

+ */ + _FinalStage resourceId(Optional resourceId); + + _FinalStage resourceId(String resourceId); + + _FinalStage resourceId(Nullable resourceId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + private Optional resourceId = Optional.empty(); + + private Optional> events = Optional.empty(); + + private Optional enabled = Optional.empty(); + + private Optional childResourceEvents = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateWebhooksRequest other) { + apiVersionDate(other.getApiVersionDate()); + childResourceEvents(other.getChildResourceEvents()); + enabled(other.getEnabled()); + events(other.getEvents()); + resourceId(other.getResourceId()); + url(other.getUrl()); + return this; + } + + /** + *

The URL to send the webhook to.

+ *

The URL to send the webhook to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + /** + *

The account or app to create the webhook for. Defaults to the current account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resourceId(Nullable resourceId) { + if (resourceId.isNull()) { + this.resourceId = null; + } else if (resourceId.isEmpty()) { + this.resourceId = Optional.empty(); + } else { + this.resourceId = Optional.of(resourceId.get()); + } + return this; + } + + /** + *

The account or app to create the webhook for. Defaults to the current account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resourceId(String resourceId) { + this.resourceId = Optional.ofNullable(resourceId); + return this; + } + + /** + *

The account or app to create the webhook for. Defaults to the current account.

+ */ + @java.lang.Override + @JsonSetter(value = "resource_id", nulls = Nulls.SKIP) + public _FinalStage resourceId(Optional resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + *

The events to send the webhook for, in dot form (for example payment.succeeded).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage events(List events) { + this.events = Optional.ofNullable(events); + return this; + } + + /** + *

The events to send the webhook for, in dot form (for example payment.succeeded).

+ */ + @java.lang.Override + @JsonSetter(value = "events", nulls = Nulls.SKIP) + public _FinalStage events(Optional> events) { + this.events = events; + return this; + } + + /** + *

Whether or not the webhook is enabled. Defaults to true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage enabled(Boolean enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + /** + *

Whether or not the webhook is enabled. Defaults to true.

+ */ + @java.lang.Override + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public _FinalStage enabled(Optional enabled) { + this.enabled = enabled; + return this; + } + + /** + *

Whether to send events for child resources. For example, if the webhook is created for an account, enabling this sends events only from its connected accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage childResourceEvents(Boolean childResourceEvents) { + this.childResourceEvents = Optional.ofNullable(childResourceEvents); + return this; + } + + /** + *

Whether to send events for child resources. For example, if the webhook is created for an account, enabling this sends events only from its connected accounts.

+ */ + @java.lang.Override + @JsonSetter(value = "child_resource_events", nulls = Nulls.SKIP) + public _FinalStage childResourceEvents(Optional childResourceEvents) { + this.childResourceEvents = childResourceEvents; + return this; + } + + /** + *

The dated API version (Api-Version-Date) to pin this webhook's payloads to. Omit to leave the webhook unpinned, tracking the current payload shape.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) to pin this webhook's payloads to. Omit to leave the webhook unpinned, tracking the current payload shape.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) to pin this webhook's payloads to. Omit to leave the webhook unpinned, tracking the current payload shape.

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + @java.lang.Override + public CreateWebhooksRequest build() { + return new CreateWebhooksRequest( + apiVersionDate, childResourceEvents, enabled, events, resourceId, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/requests/DeleteWebhooksRequest.java b/src/main/java/com/whop/api/resources/webhooks/requests/DeleteWebhooksRequest.java new file mode 100644 index 00000000..559f0f7b --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/requests/DeleteWebhooksRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteWebhooksRequest.Builder.class) +public final class DeleteWebhooksRequest { + private final Map additionalProperties; + + private DeleteWebhooksRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteWebhooksRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteWebhooksRequest other) { + return this; + } + + public DeleteWebhooksRequest build() { + return new DeleteWebhooksRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/requests/DeliveriesWebhookRequest.java b/src/main/java/com/whop/api/resources/webhooks/requests/DeliveriesWebhookRequest.java new file mode 100644 index 00000000..89f8463d --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/requests/DeliveriesWebhookRequest.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeliveriesWebhookRequest.Builder.class) +public final class DeliveriesWebhookRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final Map additionalProperties; + + private DeliveriesWebhookRequest( + Optional after, + Optional before, + Optional first, + Optional last, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeliveriesWebhookRequest && equalTo((DeliveriesWebhookRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeliveriesWebhookRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.first, this.last); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional last = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeliveriesWebhookRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public Builder last(Optional last) { + this.last = last; + return this; + } + + public Builder last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + public DeliveriesWebhookRequest build() { + return new DeliveriesWebhookRequest(after, before, first, last, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/requests/ListDeliveriesWebhooksRequest.java b/src/main/java/com/whop/api/resources/webhooks/requests/ListDeliveriesWebhooksRequest.java new file mode 100644 index 00000000..9d182187 --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/requests/ListDeliveriesWebhooksRequest.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDeliveriesWebhooksRequest.Builder.class) +public final class ListDeliveriesWebhooksRequest { + private final Optional first; + + private final Optional after; + + private final Map additionalProperties; + + private ListDeliveriesWebhooksRequest( + Optional first, Optional after, Map additionalProperties) { + this.first = first; + this.after = after; + this.additionalProperties = additionalProperties; + } + + /** + * @return The number of deliveries to return (default 50, max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns deliveries after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListDeliveriesWebhooksRequest && equalTo((ListDeliveriesWebhooksRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDeliveriesWebhooksRequest other) { + return first.equals(other.first) && after.equals(other.after); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.first, this.after); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional first = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListDeliveriesWebhooksRequest other) { + first(other.getFirst()); + after(other.getAfter()); + return this; + } + + /** + *

The number of deliveries to return (default 50, max 100).

+ */ + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public Builder first(Optional first) { + this.first = first; + return this; + } + + public Builder first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

A cursor; returns deliveries after this position.

+ */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + public ListDeliveriesWebhooksRequest build() { + return new ListDeliveriesWebhooksRequest(first, after, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/requests/ListWebhooksRequest.java b/src/main/java/com/whop/api/resources/webhooks/requests/ListWebhooksRequest.java new file mode 100644 index 00000000..7882a6c5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/requests/ListWebhooksRequest.java @@ -0,0 +1,451 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListWebhooksRequest.Builder.class) +public final class ListWebhooksRequest { + private final String accountId; + + private final Optional appId; + + private final Optional includeAppWebhooks; + + private final Optional hasFailures; + + private final Optional first; + + private final Optional after; + + private final Optional last; + + private final Optional before; + + private final Map additionalProperties; + + private ListWebhooksRequest( + String accountId, + Optional appId, + Optional includeAppWebhooks, + Optional hasFailures, + Optional first, + Optional after, + Optional last, + Optional before, + Map additionalProperties) { + this.accountId = accountId; + this.appId = appId; + this.includeAppWebhooks = includeAppWebhooks; + this.hasFailures = hasFailures; + this.first = first; + this.after = after; + this.last = last; + this.before = before; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the account to list webhooks for. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Only return webhooks attached to this app. Omit to list the account's own webhooks. + */ + @JsonProperty("app_id") + public Optional getAppId() { + return appId; + } + + /** + * @return Also return webhooks attached to the account's apps, not just the account's own. Cannot be combined with app_id. + */ + @JsonProperty("include_app_webhooks") + public Optional getIncludeAppWebhooks() { + return includeAppWebhooks; + } + + /** + * @return Only return webhooks whose endpoint is currently failing — every delivery since the current failure streak began has been rejected. Clears as soon as a delivery succeeds. + */ + @JsonProperty("has_failures") + public Optional getHasFailures() { + return hasFailures; + } + + /** + * @return The number of webhooks to return (default 20, max 100). + */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return A cursor; returns webhooks after this position. + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The number of webhooks to return from the end of the range. + */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return A cursor; returns webhooks before this position. + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListWebhooksRequest && equalTo((ListWebhooksRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListWebhooksRequest other) { + return accountId.equals(other.accountId) + && appId.equals(other.appId) + && includeAppWebhooks.equals(other.includeAppWebhooks) + && hasFailures.equals(other.hasFailures) + && first.equals(other.first) + && after.equals(other.after) + && last.equals(other.last) + && before.equals(other.before); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.appId, + this.includeAppWebhooks, + this.hasFailures, + this.first, + this.after, + this.last, + this.before); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

The unique identifier of the account to list webhooks for.

+ */ + _FinalStage accountId(@NotNull String accountId); + + Builder from(ListWebhooksRequest other); + } + + public interface _FinalStage { + ListWebhooksRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Only return webhooks attached to this app. Omit to list the account's own webhooks.

+ */ + _FinalStage appId(Optional appId); + + _FinalStage appId(String appId); + + /** + *

Also return webhooks attached to the account's apps, not just the account's own. Cannot be combined with app_id.

+ */ + _FinalStage includeAppWebhooks(Optional includeAppWebhooks); + + _FinalStage includeAppWebhooks(Boolean includeAppWebhooks); + + /** + *

Only return webhooks whose endpoint is currently failing — every delivery since the current failure streak began has been rejected. Clears as soon as a delivery succeeds.

+ */ + _FinalStage hasFailures(Optional hasFailures); + + _FinalStage hasFailures(Boolean hasFailures); + + /** + *

The number of webhooks to return (default 20, max 100).

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

A cursor; returns webhooks after this position.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

The number of webhooks to return from the end of the range.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + /** + *

A cursor; returns webhooks before this position.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, _FinalStage { + private String accountId; + + private Optional before = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional hasFailures = Optional.empty(); + + private Optional includeAppWebhooks = Optional.empty(); + + private Optional appId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListWebhooksRequest other) { + accountId(other.getAccountId()); + appId(other.getAppId()); + includeAppWebhooks(other.getIncludeAppWebhooks()); + hasFailures(other.getHasFailures()); + first(other.getFirst()); + after(other.getAfter()); + last(other.getLast()); + before(other.getBefore()); + return this; + } + + /** + *

The unique identifier of the account to list webhooks for.

+ *

The unique identifier of the account to list webhooks for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

A cursor; returns webhooks before this position.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

A cursor; returns webhooks before this position.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

The number of webhooks to return from the end of the range.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

The number of webhooks to return from the end of the range.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

A cursor; returns webhooks after this position.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

A cursor; returns webhooks after this position.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + /** + *

The number of webhooks to return (default 20, max 100).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

The number of webhooks to return (default 20, max 100).

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Only return webhooks whose endpoint is currently failing — every delivery since the current failure streak began has been rejected. Clears as soon as a delivery succeeds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hasFailures(Boolean hasFailures) { + this.hasFailures = Optional.ofNullable(hasFailures); + return this; + } + + /** + *

Only return webhooks whose endpoint is currently failing — every delivery since the current failure streak began has been rejected. Clears as soon as a delivery succeeds.

+ */ + @java.lang.Override + @JsonSetter(value = "has_failures", nulls = Nulls.SKIP) + public _FinalStage hasFailures(Optional hasFailures) { + this.hasFailures = hasFailures; + return this; + } + + /** + *

Also return webhooks attached to the account's apps, not just the account's own. Cannot be combined with app_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage includeAppWebhooks(Boolean includeAppWebhooks) { + this.includeAppWebhooks = Optional.ofNullable(includeAppWebhooks); + return this; + } + + /** + *

Also return webhooks attached to the account's apps, not just the account's own. Cannot be combined with app_id.

+ */ + @java.lang.Override + @JsonSetter(value = "include_app_webhooks", nulls = Nulls.SKIP) + public _FinalStage includeAppWebhooks(Optional includeAppWebhooks) { + this.includeAppWebhooks = includeAppWebhooks; + return this; + } + + /** + *

Only return webhooks attached to this app. Omit to list the account's own webhooks.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appId(String appId) { + this.appId = Optional.ofNullable(appId); + return this; + } + + /** + *

Only return webhooks attached to this app. Omit to list the account's own webhooks.

+ */ + @java.lang.Override + @JsonSetter(value = "app_id", nulls = Nulls.SKIP) + public _FinalStage appId(Optional appId) { + this.appId = appId; + return this; + } + + @java.lang.Override + public ListWebhooksRequest build() { + return new ListWebhooksRequest( + accountId, + appId, + includeAppWebhooks, + hasFailures, + first, + after, + last, + before, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/requests/ReplayDeliveryWebhooksRequest.java b/src/main/java/com/whop/api/resources/webhooks/requests/ReplayDeliveryWebhooksRequest.java new file mode 100644 index 00000000..a630cc0c --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/requests/ReplayDeliveryWebhooksRequest.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReplayDeliveryWebhooksRequest.Builder.class) +public final class ReplayDeliveryWebhooksRequest { + private final Optional regenerateId; + + private final Map additionalProperties; + + private ReplayDeliveryWebhooksRequest(Optional regenerateId, Map additionalProperties) { + this.regenerateId = regenerateId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Re-send the delivery under a freshly generated webhook-id (in both the envelope and the signed headers) instead of the original one. Defaults to false. Use this when your endpoint deduplicates on webhook-id and you want it to process the replay as a new message. + */ + @JsonProperty("regenerate_id") + public Optional getRegenerateId() { + return regenerateId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReplayDeliveryWebhooksRequest && equalTo((ReplayDeliveryWebhooksRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReplayDeliveryWebhooksRequest other) { + return regenerateId.equals(other.regenerateId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.regenerateId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional regenerateId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReplayDeliveryWebhooksRequest other) { + regenerateId(other.getRegenerateId()); + return this; + } + + /** + *

Re-send the delivery under a freshly generated webhook-id (in both the envelope and the signed headers) instead of the original one. Defaults to false. Use this when your endpoint deduplicates on webhook-id and you want it to process the replay as a new message.

+ */ + @JsonSetter(value = "regenerate_id", nulls = Nulls.SKIP) + public Builder regenerateId(Optional regenerateId) { + this.regenerateId = regenerateId; + return this; + } + + public Builder regenerateId(Boolean regenerateId) { + this.regenerateId = Optional.ofNullable(regenerateId); + return this; + } + + public ReplayDeliveryWebhooksRequest build() { + return new ReplayDeliveryWebhooksRequest(regenerateId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/requests/ReplayWebhooksRequest.java b/src/main/java/com/whop/api/resources/webhooks/requests/ReplayWebhooksRequest.java new file mode 100644 index 00000000..ae63a41a --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/requests/ReplayWebhooksRequest.java @@ -0,0 +1,307 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReplayWebhooksRequest.Builder.class) +public final class ReplayWebhooksRequest { + private final Optional> events; + + private final Optional failedOnly; + + private final Optional regenerateIds; + + private final String sentAfter; + + private final Optional sentBefore; + + private final Map additionalProperties; + + private ReplayWebhooksRequest( + Optional> events, + Optional failedOnly, + Optional regenerateIds, + String sentAfter, + Optional sentBefore, + Map additionalProperties) { + this.events = events; + this.failedOnly = failedOnly; + this.regenerateIds = regenerateIds; + this.sentAfter = sentAfter; + this.sentBefore = sentBefore; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only replay these event types, in dot form (for example payment.succeeded). Omit to include every event. + */ + @JsonProperty("events") + public Optional> getEvents() { + return events; + } + + /** + * @return Only replay messages whose most recent delivery attempt in the window failed. Defaults to false. Best-effort: a message whose attempts span processing batches can still be re-sent — replays keep the original webhook-id by default, so consumers that deduplicate are unaffected. + */ + @JsonProperty("failed_only") + public Optional getFailedOnly() { + return failedOnly; + } + + /** + * @return Re-send each replayed message under a freshly generated webhook-id (in both the envelope and the signed headers) instead of its original one. Defaults to false. Use this when your endpoint deduplicates on webhook-id and you want it to process the replays as new messages. + */ + @JsonProperty("regenerate_ids") + public Optional getRegenerateIds() { + return regenerateIds; + } + + /** + * @return Start of the delivery window to replay, as an ISO 8601 timestamp. Clamped to the 30-day delivery retention. + */ + @JsonProperty("sent_after") + public String getSentAfter() { + return sentAfter; + } + + /** + * @return End of the delivery window to replay, as an ISO 8601 timestamp. Defaults to now. + */ + @JsonProperty("sent_before") + public Optional getSentBefore() { + return sentBefore; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReplayWebhooksRequest && equalTo((ReplayWebhooksRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReplayWebhooksRequest other) { + return events.equals(other.events) + && failedOnly.equals(other.failedOnly) + && regenerateIds.equals(other.regenerateIds) + && sentAfter.equals(other.sentAfter) + && sentBefore.equals(other.sentBefore); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.events, this.failedOnly, this.regenerateIds, this.sentAfter, this.sentBefore); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SentAfterStage builder() { + return new Builder(); + } + + public interface SentAfterStage { + /** + *

Start of the delivery window to replay, as an ISO 8601 timestamp. Clamped to the 30-day delivery retention.

+ */ + _FinalStage sentAfter(@NotNull String sentAfter); + + Builder from(ReplayWebhooksRequest other); + } + + public interface _FinalStage { + ReplayWebhooksRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Only replay these event types, in dot form (for example payment.succeeded). Omit to include every event.

+ */ + _FinalStage events(Optional> events); + + _FinalStage events(List events); + + /** + *

Only replay messages whose most recent delivery attempt in the window failed. Defaults to false. Best-effort: a message whose attempts span processing batches can still be re-sent — replays keep the original webhook-id by default, so consumers that deduplicate are unaffected.

+ */ + _FinalStage failedOnly(Optional failedOnly); + + _FinalStage failedOnly(Boolean failedOnly); + + /** + *

Re-send each replayed message under a freshly generated webhook-id (in both the envelope and the signed headers) instead of its original one. Defaults to false. Use this when your endpoint deduplicates on webhook-id and you want it to process the replays as new messages.

+ */ + _FinalStage regenerateIds(Optional regenerateIds); + + _FinalStage regenerateIds(Boolean regenerateIds); + + /** + *

End of the delivery window to replay, as an ISO 8601 timestamp. Defaults to now.

+ */ + _FinalStage sentBefore(Optional sentBefore); + + _FinalStage sentBefore(String sentBefore); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SentAfterStage, _FinalStage { + private String sentAfter; + + private Optional sentBefore = Optional.empty(); + + private Optional regenerateIds = Optional.empty(); + + private Optional failedOnly = Optional.empty(); + + private Optional> events = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReplayWebhooksRequest other) { + events(other.getEvents()); + failedOnly(other.getFailedOnly()); + regenerateIds(other.getRegenerateIds()); + sentAfter(other.getSentAfter()); + sentBefore(other.getSentBefore()); + return this; + } + + /** + *

Start of the delivery window to replay, as an ISO 8601 timestamp. Clamped to the 30-day delivery retention.

+ *

Start of the delivery window to replay, as an ISO 8601 timestamp. Clamped to the 30-day delivery retention.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sent_after") + public _FinalStage sentAfter(@NotNull String sentAfter) { + this.sentAfter = Objects.requireNonNull(sentAfter, "sentAfter must not be null"); + return this; + } + + /** + *

End of the delivery window to replay, as an ISO 8601 timestamp. Defaults to now.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sentBefore(String sentBefore) { + this.sentBefore = Optional.ofNullable(sentBefore); + return this; + } + + /** + *

End of the delivery window to replay, as an ISO 8601 timestamp. Defaults to now.

+ */ + @java.lang.Override + @JsonSetter(value = "sent_before", nulls = Nulls.SKIP) + public _FinalStage sentBefore(Optional sentBefore) { + this.sentBefore = sentBefore; + return this; + } + + /** + *

Re-send each replayed message under a freshly generated webhook-id (in both the envelope and the signed headers) instead of its original one. Defaults to false. Use this when your endpoint deduplicates on webhook-id and you want it to process the replays as new messages.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage regenerateIds(Boolean regenerateIds) { + this.regenerateIds = Optional.ofNullable(regenerateIds); + return this; + } + + /** + *

Re-send each replayed message under a freshly generated webhook-id (in both the envelope and the signed headers) instead of its original one. Defaults to false. Use this when your endpoint deduplicates on webhook-id and you want it to process the replays as new messages.

+ */ + @java.lang.Override + @JsonSetter(value = "regenerate_ids", nulls = Nulls.SKIP) + public _FinalStage regenerateIds(Optional regenerateIds) { + this.regenerateIds = regenerateIds; + return this; + } + + /** + *

Only replay messages whose most recent delivery attempt in the window failed. Defaults to false. Best-effort: a message whose attempts span processing batches can still be re-sent — replays keep the original webhook-id by default, so consumers that deduplicate are unaffected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failedOnly(Boolean failedOnly) { + this.failedOnly = Optional.ofNullable(failedOnly); + return this; + } + + /** + *

Only replay messages whose most recent delivery attempt in the window failed. Defaults to false. Best-effort: a message whose attempts span processing batches can still be re-sent — replays keep the original webhook-id by default, so consumers that deduplicate are unaffected.

+ */ + @java.lang.Override + @JsonSetter(value = "failed_only", nulls = Nulls.SKIP) + public _FinalStage failedOnly(Optional failedOnly) { + this.failedOnly = failedOnly; + return this; + } + + /** + *

Only replay these event types, in dot form (for example payment.succeeded). Omit to include every event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage events(List events) { + this.events = Optional.ofNullable(events); + return this; + } + + /** + *

Only replay these event types, in dot form (for example payment.succeeded). Omit to include every event.

+ */ + @java.lang.Override + @JsonSetter(value = "events", nulls = Nulls.SKIP) + public _FinalStage events(Optional> events) { + this.events = events; + return this; + } + + @java.lang.Override + public ReplayWebhooksRequest build() { + return new ReplayWebhooksRequest( + events, failedOnly, regenerateIds, sentAfter, sentBefore, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/requests/RetrieveWebhooksRequest.java b/src/main/java/com/whop/api/resources/webhooks/requests/RetrieveWebhooksRequest.java new file mode 100644 index 00000000..5bbd42ea --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/requests/RetrieveWebhooksRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveWebhooksRequest.Builder.class) +public final class RetrieveWebhooksRequest { + private final Map additionalProperties; + + private RetrieveWebhooksRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveWebhooksRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveWebhooksRequest other) { + return this; + } + + public RetrieveWebhooksRequest build() { + return new RetrieveWebhooksRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/requests/TestWebhooksRequest.java b/src/main/java/com/whop/api/resources/webhooks/requests/TestWebhooksRequest.java new file mode 100644 index 00000000..869b78c8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/requests/TestWebhooksRequest.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TestWebhooksRequest.Builder.class) +public final class TestWebhooksRequest { + private final String event; + + private final Map additionalProperties; + + private TestWebhooksRequest(String event, Map additionalProperties) { + this.event = event; + this.additionalProperties = additionalProperties; + } + + /** + * @return The event to test the webhook for, in dot form (for example payment.succeeded). + */ + @JsonProperty("event") + public String getEvent() { + return event; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TestWebhooksRequest && equalTo((TestWebhooksRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TestWebhooksRequest other) { + return event.equals(other.event); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.event); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EventStage builder() { + return new Builder(); + } + + public interface EventStage { + /** + *

The event to test the webhook for, in dot form (for example payment.succeeded).

+ */ + _FinalStage event(@NotNull String event); + + Builder from(TestWebhooksRequest other); + } + + public interface _FinalStage { + TestWebhooksRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EventStage, _FinalStage { + private String event; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TestWebhooksRequest other) { + event(other.getEvent()); + return this; + } + + /** + *

The event to test the webhook for, in dot form (for example payment.succeeded).

+ *

The event to test the webhook for, in dot form (for example payment.succeeded).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("event") + public _FinalStage event(@NotNull String event) { + this.event = Objects.requireNonNull(event, "event must not be null"); + return this; + } + + @java.lang.Override + public TestWebhooksRequest build() { + return new TestWebhooksRequest(event, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/requests/UpdateWebhooksRequest.java b/src/main/java/com/whop/api/resources/webhooks/requests/UpdateWebhooksRequest.java new file mode 100644 index 00000000..6b3bb52a --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/requests/UpdateWebhooksRequest.java @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.webhooks.types.UpdateWebhooksRequestEventsItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateWebhooksRequest.Builder.class) +public final class UpdateWebhooksRequest { + private final Optional apiVersionDate; + + private final Optional childResourceEvents; + + private final Optional enabled; + + private final Optional> events; + + private final Optional url; + + private final Map additionalProperties; + + private UpdateWebhooksRequest( + Optional apiVersionDate, + Optional childResourceEvents, + Optional enabled, + Optional> events, + Optional url, + Map additionalProperties) { + this.apiVersionDate = apiVersionDate; + this.childResourceEvents = childResourceEvents; + this.enabled = enabled; + this.events = events; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The dated API version (Api-Version-Date) to pin this webhook's payloads to. Only valid for v1 webhooks. Omit to leave the current pin unchanged, or pass null to unpin and track the current payload shape. + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + /** + * @return Whether or not to send events for child resources. + */ + @JsonProperty("child_resource_events") + public Optional getChildResourceEvents() { + return childResourceEvents; + } + + /** + * @return Whether or not the webhook is enabled. + */ + @JsonProperty("enabled") + public Optional getEnabled() { + return enabled; + } + + /** + * @return The events to send the webhook for, in dot form (for example payment.succeeded). + */ + @JsonProperty("events") + public Optional> getEvents() { + return events; + } + + /** + * @return The URL to send the webhook to. + */ + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateWebhooksRequest && equalTo((UpdateWebhooksRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateWebhooksRequest other) { + return apiVersionDate.equals(other.apiVersionDate) + && childResourceEvents.equals(other.childResourceEvents) + && enabled.equals(other.enabled) + && events.equals(other.events) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiVersionDate, this.childResourceEvents, this.enabled, this.events, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional apiVersionDate = Optional.empty(); + + private Optional childResourceEvents = Optional.empty(); + + private Optional enabled = Optional.empty(); + + private Optional> events = Optional.empty(); + + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateWebhooksRequest other) { + apiVersionDate(other.getApiVersionDate()); + childResourceEvents(other.getChildResourceEvents()); + enabled(other.getEnabled()); + events(other.getEvents()); + url(other.getUrl()); + return this; + } + + /** + *

The dated API version (Api-Version-Date) to pin this webhook's payloads to. Only valid for v1 webhooks. Omit to leave the current pin unchanged, or pass null to unpin and track the current payload shape.

+ */ + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public Builder apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + public Builder apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + public Builder apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

Whether or not to send events for child resources.

+ */ + @JsonSetter(value = "child_resource_events", nulls = Nulls.SKIP) + public Builder childResourceEvents(Optional childResourceEvents) { + this.childResourceEvents = childResourceEvents; + return this; + } + + public Builder childResourceEvents(Boolean childResourceEvents) { + this.childResourceEvents = Optional.ofNullable(childResourceEvents); + return this; + } + + /** + *

Whether or not the webhook is enabled.

+ */ + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(Boolean enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + /** + *

The events to send the webhook for, in dot form (for example payment.succeeded).

+ */ + @JsonSetter(value = "events", nulls = Nulls.SKIP) + public Builder events(Optional> events) { + this.events = events; + return this; + } + + public Builder events(List events) { + this.events = Optional.ofNullable(events); + return this; + } + + /** + *

The URL to send the webhook to.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public UpdateWebhooksRequest build() { + return new UpdateWebhooksRequest( + apiVersionDate, childResourceEvents, enabled, events, url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/types/CreateWebhooksRequestEventsItem.java b/src/main/java/com/whop/api/resources/webhooks/types/CreateWebhooksRequestEventsItem.java new file mode 100644 index 00000000..f3592e84 --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/types/CreateWebhooksRequestEventsItem.java @@ -0,0 +1,1342 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateWebhooksRequestEventsItem { + public static final CreateWebhooksRequestEventsItem MEMBERSHIP_METADATA_UPDATED_UNDERSCORE = + new CreateWebhooksRequestEventsItem( + Value.MEMBERSHIP_METADATA_UPDATED_UNDERSCORE, "membership_metadata_updated"); + + public static final CreateWebhooksRequestEventsItem RESOLUTION_CENTER_CASE_CREATED = + new CreateWebhooksRequestEventsItem(Value.RESOLUTION_CENTER_CASE_CREATED, "resolution_center_case.created"); + + public static final CreateWebhooksRequestEventsItem APP_PAYMENT_CREATED = + new CreateWebhooksRequestEventsItem(Value.APP_PAYMENT_CREATED, "app_payment.created"); + + public static final CreateWebhooksRequestEventsItem IDENTITY_PROFILE_REJECTED = + new CreateWebhooksRequestEventsItem(Value.IDENTITY_PROFILE_REJECTED, "identity_profile.rejected"); + + public static final CreateWebhooksRequestEventsItem MEMBERSHIP_WENT_INVALID = + new CreateWebhooksRequestEventsItem(Value.MEMBERSHIP_WENT_INVALID, "membership.went_invalid"); + + public static final CreateWebhooksRequestEventsItem TRANSFER_COMPLETED = + new CreateWebhooksRequestEventsItem(Value.TRANSFER_COMPLETED, "transfer.completed"); + + public static final CreateWebhooksRequestEventsItem CARD_APPLICATION_DENIED = + new CreateWebhooksRequestEventsItem(Value.CARD_APPLICATION_DENIED, "card_application.denied"); + + public static final CreateWebhooksRequestEventsItem MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE = + new CreateWebhooksRequestEventsItem( + Value.MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE, + "membership_cancel_at_period_end_changed"); + + public static final CreateWebhooksRequestEventsItem TRANSFER_CREATED = + new CreateWebhooksRequestEventsItem(Value.TRANSFER_CREATED, "transfer.created"); + + public static final CreateWebhooksRequestEventsItem PAYMENT_FAILED_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.PAYMENT_FAILED_UNDERSCORE, "payment_failed"); + + public static final CreateWebhooksRequestEventsItem CARD_APPLICATION_CREATED = + new CreateWebhooksRequestEventsItem(Value.CARD_APPLICATION_CREATED, "card_application.created"); + + public static final CreateWebhooksRequestEventsItem MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED = + new CreateWebhooksRequestEventsItem( + Value.MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, "membership.cancel_at_period_end_changed"); + + public static final CreateWebhooksRequestEventsItem ENTRY_DENIED = + new CreateWebhooksRequestEventsItem(Value.ENTRY_DENIED, "entry.denied"); + + public static final CreateWebhooksRequestEventsItem TRANSFER_FAILED = + new CreateWebhooksRequestEventsItem(Value.TRANSFER_FAILED, "transfer.failed"); + + public static final CreateWebhooksRequestEventsItem PLAN_UPDATED = + new CreateWebhooksRequestEventsItem(Value.PLAN_UPDATED, "plan.updated"); + + public static final CreateWebhooksRequestEventsItem REFUND_UPDATED_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.REFUND_UPDATED_UNDERSCORE, "refund_updated"); + + public static final CreateWebhooksRequestEventsItem SETUP_INTENT_SUCCEEDED = + new CreateWebhooksRequestEventsItem(Value.SETUP_INTENT_SUCCEEDED, "setup_intent.succeeded"); + + public static final CreateWebhooksRequestEventsItem MEMBERSHIP_DEACTIVATED = + new CreateWebhooksRequestEventsItem(Value.MEMBERSHIP_DEACTIVATED, "membership.deactivated"); + + public static final CreateWebhooksRequestEventsItem CARD_TRANSACTION_REVERSED = + new CreateWebhooksRequestEventsItem(Value.CARD_TRANSACTION_REVERSED, "card_transaction.reversed"); + + public static final CreateWebhooksRequestEventsItem CARD_FROZEN = + new CreateWebhooksRequestEventsItem(Value.CARD_FROZEN, "card.frozen"); + + public static final CreateWebhooksRequestEventsItem WITHDRAWAL_UPDATED = + new CreateWebhooksRequestEventsItem(Value.WITHDRAWAL_UPDATED, "withdrawal.updated"); + + public static final CreateWebhooksRequestEventsItem SETUP_INTENT_CANCELED = + new CreateWebhooksRequestEventsItem(Value.SETUP_INTENT_CANCELED, "setup_intent.canceled"); + + public static final CreateWebhooksRequestEventsItem APP_PAYMENT_CREATED_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.APP_PAYMENT_CREATED_UNDERSCORE, "app_payment_created"); + + public static final CreateWebhooksRequestEventsItem APP_PAYMENT_FAILED = + new CreateWebhooksRequestEventsItem(Value.APP_PAYMENT_FAILED, "app_payment.failed"); + + public static final CreateWebhooksRequestEventsItem RESOLUTION_CENTER_CASE_UPDATED = + new CreateWebhooksRequestEventsItem(Value.RESOLUTION_CENTER_CASE_UPDATED, "resolution_center_case.updated"); + + public static final CreateWebhooksRequestEventsItem PRODUCT_UNPUBLISHED = + new CreateWebhooksRequestEventsItem(Value.PRODUCT_UNPUBLISHED, "product.unpublished"); + + public static final CreateWebhooksRequestEventsItem APP_PAYMENT_PENDING = + new CreateWebhooksRequestEventsItem(Value.APP_PAYMENT_PENDING, "app_payment.pending"); + + public static final CreateWebhooksRequestEventsItem ENTRY_DELETED = + new CreateWebhooksRequestEventsItem(Value.ENTRY_DELETED, "entry.deleted"); + + public static final CreateWebhooksRequestEventsItem SWAP_COMPLETED = + new CreateWebhooksRequestEventsItem(Value.SWAP_COMPLETED, "swap.completed"); + + public static final CreateWebhooksRequestEventsItem ENTRY_APPROVED = + new CreateWebhooksRequestEventsItem(Value.ENTRY_APPROVED, "entry.approved"); + + public static final CreateWebhooksRequestEventsItem DISPUTE_ALERT_CREATED = + new CreateWebhooksRequestEventsItem(Value.DISPUTE_ALERT_CREATED, "dispute_alert.created"); + + public static final CreateWebhooksRequestEventsItem CARD_TRANSACTION_CREATED = + new CreateWebhooksRequestEventsItem(Value.CARD_TRANSACTION_CREATED, "card_transaction.created"); + + public static final CreateWebhooksRequestEventsItem REFUND_UPDATED = + new CreateWebhooksRequestEventsItem(Value.REFUND_UPDATED, "refund.updated"); + + public static final CreateWebhooksRequestEventsItem WITHDRAWAL_REVERSED = + new CreateWebhooksRequestEventsItem(Value.WITHDRAWAL_REVERSED, "withdrawal.reversed"); + + public static final CreateWebhooksRequestEventsItem PAYOUT_ACCOUNT_STATUS_UPDATED = + new CreateWebhooksRequestEventsItem(Value.PAYOUT_ACCOUNT_STATUS_UPDATED, "payout_account.status_updated"); + + public static final CreateWebhooksRequestEventsItem ENTRY_CREATED = + new CreateWebhooksRequestEventsItem(Value.ENTRY_CREATED, "entry.created"); + + public static final CreateWebhooksRequestEventsItem APP_MEMBERSHIP_WENT_VALID = + new CreateWebhooksRequestEventsItem(Value.APP_MEMBERSHIP_WENT_VALID, "app_membership.went_valid"); + + public static final CreateWebhooksRequestEventsItem PRODUCT_UPDATED = + new CreateWebhooksRequestEventsItem(Value.PRODUCT_UPDATED, "product.updated"); + + public static final CreateWebhooksRequestEventsItem WITHDRAWAL_CREATED = + new CreateWebhooksRequestEventsItem(Value.WITHDRAWAL_CREATED, "withdrawal.created"); + + public static final CreateWebhooksRequestEventsItem CHAT_MESSAGE_CREATED = + new CreateWebhooksRequestEventsItem(Value.CHAT_MESSAGE_CREATED, "chat.message.created"); + + public static final CreateWebhooksRequestEventsItem MEMBERSHIP_ACTIVATED = + new CreateWebhooksRequestEventsItem(Value.MEMBERSHIP_ACTIVATED, "membership.activated"); + + public static final CreateWebhooksRequestEventsItem APP_MEMBERSHIP_WENT_VALID_UNDERSCORE = + new CreateWebhooksRequestEventsItem( + Value.APP_MEMBERSHIP_WENT_VALID_UNDERSCORE, "app_membership_went_valid"); + + public static final CreateWebhooksRequestEventsItem DISPUTE_ALERT_CREATED_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.DISPUTE_ALERT_CREATED_UNDERSCORE, "dispute_alert_created"); + + public static final CreateWebhooksRequestEventsItem REFUND_CREATED = + new CreateWebhooksRequestEventsItem(Value.REFUND_CREATED, "refund.created"); + + public static final CreateWebhooksRequestEventsItem CARD_UPDATED = + new CreateWebhooksRequestEventsItem(Value.CARD_UPDATED, "card.updated"); + + public static final CreateWebhooksRequestEventsItem CARD_APPLICATION_APPROVED = + new CreateWebhooksRequestEventsItem(Value.CARD_APPLICATION_APPROVED, "card_application.approved"); + + public static final CreateWebhooksRequestEventsItem PRODUCT_DELETED = + new CreateWebhooksRequestEventsItem(Value.PRODUCT_DELETED, "product.deleted"); + + public static final CreateWebhooksRequestEventsItem PAYMENT_CREATED = + new CreateWebhooksRequestEventsItem(Value.PAYMENT_CREATED, "payment.created"); + + public static final CreateWebhooksRequestEventsItem INVOICE_MARKED_UNCOLLECTIBLE = + new CreateWebhooksRequestEventsItem(Value.INVOICE_MARKED_UNCOLLECTIBLE, "invoice.marked_uncollectible"); + + public static final CreateWebhooksRequestEventsItem PAYMENT_SUCCEEDED_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.PAYMENT_SUCCEEDED_UNDERSCORE, "payment_succeeded"); + + public static final CreateWebhooksRequestEventsItem PAYMENT_CREATED_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.PAYMENT_CREATED_UNDERSCORE, "payment_created"); + + public static final CreateWebhooksRequestEventsItem EXPORT_COMPLETED = + new CreateWebhooksRequestEventsItem(Value.EXPORT_COMPLETED, "export.completed"); + + public static final CreateWebhooksRequestEventsItem CARD_APPLICATION_UPDATED = + new CreateWebhooksRequestEventsItem(Value.CARD_APPLICATION_UPDATED, "card_application.updated"); + + public static final CreateWebhooksRequestEventsItem MEMBERSHIP_METADATA_UPDATED = + new CreateWebhooksRequestEventsItem(Value.MEMBERSHIP_METADATA_UPDATED, "membership.metadata_updated"); + + public static final CreateWebhooksRequestEventsItem CARD_TRANSACTION_UPDATED = + new CreateWebhooksRequestEventsItem(Value.CARD_TRANSACTION_UPDATED, "card_transaction.updated"); + + public static final CreateWebhooksRequestEventsItem APP_PAYMENT_FAILED_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.APP_PAYMENT_FAILED_UNDERSCORE, "app_payment_failed"); + + public static final CreateWebhooksRequestEventsItem INVOICE_PAST_DUE = + new CreateWebhooksRequestEventsItem(Value.INVOICE_PAST_DUE, "invoice.past_due"); + + public static final CreateWebhooksRequestEventsItem RESOLUTION_UPDATED_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.RESOLUTION_UPDATED_UNDERSCORE, "resolution_updated"); + + public static final CreateWebhooksRequestEventsItem INVOICE_PAID = + new CreateWebhooksRequestEventsItem(Value.INVOICE_PAID, "invoice.paid"); + + public static final CreateWebhooksRequestEventsItem PLAN_CREATED = + new CreateWebhooksRequestEventsItem(Value.PLAN_CREATED, "plan.created"); + + public static final CreateWebhooksRequestEventsItem CARD_TRANSACTION_DECLINED = + new CreateWebhooksRequestEventsItem(Value.CARD_TRANSACTION_DECLINED, "card_transaction.declined"); + + public static final CreateWebhooksRequestEventsItem IDENTITY_PROFILE_UPDATED = + new CreateWebhooksRequestEventsItem(Value.IDENTITY_PROFILE_UPDATED, "identity_profile.updated"); + + public static final CreateWebhooksRequestEventsItem APP_MEMBERSHIP_WENT_INVALID = + new CreateWebhooksRequestEventsItem(Value.APP_MEMBERSHIP_WENT_INVALID, "app_membership.went_invalid"); + + public static final CreateWebhooksRequestEventsItem PAYMENT_AFFILIATE_REWARD_CREATED = + new CreateWebhooksRequestEventsItem( + Value.PAYMENT_AFFILIATE_REWARD_CREATED, "payment.affiliate_reward_created"); + + public static final CreateWebhooksRequestEventsItem AD_CAMPAIGN_PAYMENT_FAILED = + new CreateWebhooksRequestEventsItem(Value.AD_CAMPAIGN_PAYMENT_FAILED, "ad_campaign.payment_failed"); + + public static final CreateWebhooksRequestEventsItem APP_PAYMENT_SUCCEEDED_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.APP_PAYMENT_SUCCEEDED_UNDERSCORE, "app_payment_succeeded"); + + public static final CreateWebhooksRequestEventsItem PLAN_DELETED = + new CreateWebhooksRequestEventsItem(Value.PLAN_DELETED, "plan.deleted"); + + public static final CreateWebhooksRequestEventsItem RESOLUTION_CREATED = + new CreateWebhooksRequestEventsItem(Value.RESOLUTION_CREATED, "resolution.created"); + + public static final CreateWebhooksRequestEventsItem PAYOUT_METHOD_CREATED = + new CreateWebhooksRequestEventsItem(Value.PAYOUT_METHOD_CREATED, "payout_method.created"); + + public static final CreateWebhooksRequestEventsItem DISPUTE_UPDATED_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.DISPUTE_UPDATED_UNDERSCORE, "dispute_updated"); + + public static final CreateWebhooksRequestEventsItem COURSE_LESSON_INTERACTION_COMPLETED = + new CreateWebhooksRequestEventsItem( + Value.COURSE_LESSON_INTERACTION_COMPLETED, "course_lesson_interaction.completed"); + + public static final CreateWebhooksRequestEventsItem CARD_CANCELED = + new CreateWebhooksRequestEventsItem(Value.CARD_CANCELED, "card.canceled"); + + public static final CreateWebhooksRequestEventsItem DEPOSIT_SUCCEEDED = + new CreateWebhooksRequestEventsItem(Value.DEPOSIT_SUCCEEDED, "deposit.succeeded"); + + public static final CreateWebhooksRequestEventsItem VERIFICATION_SUCCEEDED = + new CreateWebhooksRequestEventsItem(Value.VERIFICATION_SUCCEEDED, "verification.succeeded"); + + public static final CreateWebhooksRequestEventsItem PRODUCT_CREATED = + new CreateWebhooksRequestEventsItem(Value.PRODUCT_CREATED, "product.created"); + + public static final CreateWebhooksRequestEventsItem MEMBER_CREATED = + new CreateWebhooksRequestEventsItem(Value.MEMBER_CREATED, "member.created"); + + public static final CreateWebhooksRequestEventsItem CARD_TRANSACTION_COMPLETED = + new CreateWebhooksRequestEventsItem(Value.CARD_TRANSACTION_COMPLETED, "card_transaction.completed"); + + public static final CreateWebhooksRequestEventsItem APP_PAYMENT_PENDING_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.APP_PAYMENT_PENDING_UNDERSCORE, "app_payment_pending"); + + public static final CreateWebhooksRequestEventsItem APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE = + new CreateWebhooksRequestEventsItem( + Value.APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE, + "app_membership_cancel_at_period_end_changed"); + + public static final CreateWebhooksRequestEventsItem REFUND_CREATED_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.REFUND_CREATED_UNDERSCORE, "refund_created"); + + public static final CreateWebhooksRequestEventsItem APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED = + new CreateWebhooksRequestEventsItem( + Value.APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, "app_membership.cancel_at_period_end_changed"); + + public static final CreateWebhooksRequestEventsItem APP_PAYMENT_SUCCEEDED = + new CreateWebhooksRequestEventsItem(Value.APP_PAYMENT_SUCCEEDED, "app_payment.succeeded"); + + public static final CreateWebhooksRequestEventsItem CARD_CREATED = + new CreateWebhooksRequestEventsItem(Value.CARD_CREATED, "card.created"); + + public static final CreateWebhooksRequestEventsItem MEMBERSHIP_EXPERIENCE_CLAIMED_UNDERSCORE = + new CreateWebhooksRequestEventsItem( + Value.MEMBERSHIP_EXPERIENCE_CLAIMED_UNDERSCORE, "membership_experience_claimed"); + + public static final CreateWebhooksRequestEventsItem PAYMENT_FAILED = + new CreateWebhooksRequestEventsItem(Value.PAYMENT_FAILED, "payment.failed"); + + public static final CreateWebhooksRequestEventsItem RESOLUTION_DECIDED_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.RESOLUTION_DECIDED_UNDERSCORE, "resolution_decided"); + + public static final CreateWebhooksRequestEventsItem APP_MEMBERSHIP_WENT_INVALID_UNDERSCORE = + new CreateWebhooksRequestEventsItem( + Value.APP_MEMBERSHIP_WENT_INVALID_UNDERSCORE, "app_membership_went_invalid"); + + public static final CreateWebhooksRequestEventsItem RESOLUTION_DECIDED = + new CreateWebhooksRequestEventsItem(Value.RESOLUTION_DECIDED, "resolution.decided"); + + public static final CreateWebhooksRequestEventsItem IDENTITY_PROFILE_APPROVED = + new CreateWebhooksRequestEventsItem(Value.IDENTITY_PROFILE_APPROVED, "identity_profile.approved"); + + public static final CreateWebhooksRequestEventsItem SHIPMENT_CREATED = + new CreateWebhooksRequestEventsItem(Value.SHIPMENT_CREATED, "shipment.created"); + + public static final CreateWebhooksRequestEventsItem DISPUTE_UPDATED = + new CreateWebhooksRequestEventsItem(Value.DISPUTE_UPDATED, "dispute.updated"); + + public static final CreateWebhooksRequestEventsItem ACCOUNT_UPDATED = + new CreateWebhooksRequestEventsItem(Value.ACCOUNT_UPDATED, "account.updated"); + + public static final CreateWebhooksRequestEventsItem MEMBERSHIP_WENT_INVALID_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.MEMBERSHIP_WENT_INVALID_UNDERSCORE, "membership_went_invalid"); + + public static final CreateWebhooksRequestEventsItem LEDGER_ACCOUNT_FUNDS_AVAILABLE = + new CreateWebhooksRequestEventsItem(Value.LEDGER_ACCOUNT_FUNDS_AVAILABLE, "ledger_account.funds_available"); + + public static final CreateWebhooksRequestEventsItem PAYMENT_PENDING = + new CreateWebhooksRequestEventsItem(Value.PAYMENT_PENDING, "payment.pending"); + + public static final CreateWebhooksRequestEventsItem MEMBERSHIP_TRIAL_ENDING_SOON = + new CreateWebhooksRequestEventsItem(Value.MEMBERSHIP_TRIAL_ENDING_SOON, "membership.trial_ending_soon"); + + public static final CreateWebhooksRequestEventsItem DISPUTE_CREATED_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.DISPUTE_CREATED_UNDERSCORE, "dispute_created"); + + public static final CreateWebhooksRequestEventsItem RESOLUTION_CENTER_CASE_DECIDED = + new CreateWebhooksRequestEventsItem(Value.RESOLUTION_CENTER_CASE_DECIDED, "resolution_center_case.decided"); + + public static final CreateWebhooksRequestEventsItem MEMBERSHIP_EXPERIENCE_CLAIMED = + new CreateWebhooksRequestEventsItem(Value.MEMBERSHIP_EXPERIENCE_CLAIMED, "membership.experience_claimed"); + + public static final CreateWebhooksRequestEventsItem PRODUCT_PUBLISHED = + new CreateWebhooksRequestEventsItem(Value.PRODUCT_PUBLISHED, "product.published"); + + public static final CreateWebhooksRequestEventsItem PAYMENT_PENDING_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.PAYMENT_PENDING_UNDERSCORE, "payment_pending"); + + public static final CreateWebhooksRequestEventsItem RESOLUTION_CREATED_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.RESOLUTION_CREATED_UNDERSCORE, "resolution_created"); + + public static final CreateWebhooksRequestEventsItem RESOLUTION_UPDATED = + new CreateWebhooksRequestEventsItem(Value.RESOLUTION_UPDATED, "resolution.updated"); + + public static final CreateWebhooksRequestEventsItem EXPORT_FAILED = + new CreateWebhooksRequestEventsItem(Value.EXPORT_FAILED, "export.failed"); + + public static final CreateWebhooksRequestEventsItem CHAT_REACTION_CREATED = + new CreateWebhooksRequestEventsItem(Value.CHAT_REACTION_CREATED, "chat.reaction.created"); + + public static final CreateWebhooksRequestEventsItem PAYMENT_SUCCEEDED = + new CreateWebhooksRequestEventsItem(Value.PAYMENT_SUCCEEDED, "payment.succeeded"); + + public static final CreateWebhooksRequestEventsItem SHIPMENT_UPDATED = + new CreateWebhooksRequestEventsItem(Value.SHIPMENT_UPDATED, "shipment.updated"); + + public static final CreateWebhooksRequestEventsItem DISPUTE_CREATED = + new CreateWebhooksRequestEventsItem(Value.DISPUTE_CREATED, "dispute.created"); + + public static final CreateWebhooksRequestEventsItem INVOICE_CREATED = + new CreateWebhooksRequestEventsItem(Value.INVOICE_CREATED, "invoice.created"); + + public static final CreateWebhooksRequestEventsItem PAYMENT_AFFILIATE_REWARD_CREATED_UNDERSCORE = + new CreateWebhooksRequestEventsItem( + Value.PAYMENT_AFFILIATE_REWARD_CREATED_UNDERSCORE, "payment_affiliate_reward_created"); + + public static final CreateWebhooksRequestEventsItem MEMBERSHIP_WENT_VALID = + new CreateWebhooksRequestEventsItem(Value.MEMBERSHIP_WENT_VALID, "membership.went_valid"); + + public static final CreateWebhooksRequestEventsItem IDENTITY_PROFILE_NEEDS_ACTION = + new CreateWebhooksRequestEventsItem(Value.IDENTITY_PROFILE_NEEDS_ACTION, "identity_profile.needs_action"); + + public static final CreateWebhooksRequestEventsItem SETUP_INTENT_REQUIRES_ACTION = + new CreateWebhooksRequestEventsItem(Value.SETUP_INTENT_REQUIRES_ACTION, "setup_intent.requires_action"); + + public static final CreateWebhooksRequestEventsItem INVOICE_VOIDED = + new CreateWebhooksRequestEventsItem(Value.INVOICE_VOIDED, "invoice.voided"); + + public static final CreateWebhooksRequestEventsItem MEMBERSHIP_WENT_VALID_UNDERSCORE = + new CreateWebhooksRequestEventsItem(Value.MEMBERSHIP_WENT_VALID_UNDERSCORE, "membership_went_valid"); + + private final Value value; + + private final String string; + + CreateWebhooksRequestEventsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreateWebhooksRequestEventsItem + && this.string.equals(((CreateWebhooksRequestEventsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MEMBERSHIP_METADATA_UPDATED_UNDERSCORE: + return visitor.visitMembershipMetadataUpdatedUnderscore(); + case RESOLUTION_CENTER_CASE_CREATED: + return visitor.visitResolutionCenterCaseCreated(); + case APP_PAYMENT_CREATED: + return visitor.visitAppPaymentCreated(); + case IDENTITY_PROFILE_REJECTED: + return visitor.visitIdentityProfileRejected(); + case MEMBERSHIP_WENT_INVALID: + return visitor.visitMembershipWentInvalid(); + case TRANSFER_COMPLETED: + return visitor.visitTransferCompleted(); + case CARD_APPLICATION_DENIED: + return visitor.visitCardApplicationDenied(); + case MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE: + return visitor.visitMembershipCancelAtPeriodEndChangedUnderscore(); + case TRANSFER_CREATED: + return visitor.visitTransferCreated(); + case PAYMENT_FAILED_UNDERSCORE: + return visitor.visitPaymentFailedUnderscore(); + case CARD_APPLICATION_CREATED: + return visitor.visitCardApplicationCreated(); + case MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED: + return visitor.visitMembershipCancelAtPeriodEndChanged(); + case ENTRY_DENIED: + return visitor.visitEntryDenied(); + case TRANSFER_FAILED: + return visitor.visitTransferFailed(); + case PLAN_UPDATED: + return visitor.visitPlanUpdated(); + case REFUND_UPDATED_UNDERSCORE: + return visitor.visitRefundUpdatedUnderscore(); + case SETUP_INTENT_SUCCEEDED: + return visitor.visitSetupIntentSucceeded(); + case MEMBERSHIP_DEACTIVATED: + return visitor.visitMembershipDeactivated(); + case CARD_TRANSACTION_REVERSED: + return visitor.visitCardTransactionReversed(); + case CARD_FROZEN: + return visitor.visitCardFrozen(); + case WITHDRAWAL_UPDATED: + return visitor.visitWithdrawalUpdated(); + case SETUP_INTENT_CANCELED: + return visitor.visitSetupIntentCanceled(); + case APP_PAYMENT_CREATED_UNDERSCORE: + return visitor.visitAppPaymentCreatedUnderscore(); + case APP_PAYMENT_FAILED: + return visitor.visitAppPaymentFailed(); + case RESOLUTION_CENTER_CASE_UPDATED: + return visitor.visitResolutionCenterCaseUpdated(); + case PRODUCT_UNPUBLISHED: + return visitor.visitProductUnpublished(); + case APP_PAYMENT_PENDING: + return visitor.visitAppPaymentPending(); + case ENTRY_DELETED: + return visitor.visitEntryDeleted(); + case SWAP_COMPLETED: + return visitor.visitSwapCompleted(); + case ENTRY_APPROVED: + return visitor.visitEntryApproved(); + case DISPUTE_ALERT_CREATED: + return visitor.visitDisputeAlertCreated(); + case CARD_TRANSACTION_CREATED: + return visitor.visitCardTransactionCreated(); + case REFUND_UPDATED: + return visitor.visitRefundUpdated(); + case WITHDRAWAL_REVERSED: + return visitor.visitWithdrawalReversed(); + case PAYOUT_ACCOUNT_STATUS_UPDATED: + return visitor.visitPayoutAccountStatusUpdated(); + case ENTRY_CREATED: + return visitor.visitEntryCreated(); + case APP_MEMBERSHIP_WENT_VALID: + return visitor.visitAppMembershipWentValid(); + case PRODUCT_UPDATED: + return visitor.visitProductUpdated(); + case WITHDRAWAL_CREATED: + return visitor.visitWithdrawalCreated(); + case CHAT_MESSAGE_CREATED: + return visitor.visitChatMessageCreated(); + case MEMBERSHIP_ACTIVATED: + return visitor.visitMembershipActivated(); + case APP_MEMBERSHIP_WENT_VALID_UNDERSCORE: + return visitor.visitAppMembershipWentValidUnderscore(); + case DISPUTE_ALERT_CREATED_UNDERSCORE: + return visitor.visitDisputeAlertCreatedUnderscore(); + case REFUND_CREATED: + return visitor.visitRefundCreated(); + case CARD_UPDATED: + return visitor.visitCardUpdated(); + case CARD_APPLICATION_APPROVED: + return visitor.visitCardApplicationApproved(); + case PRODUCT_DELETED: + return visitor.visitProductDeleted(); + case PAYMENT_CREATED: + return visitor.visitPaymentCreated(); + case INVOICE_MARKED_UNCOLLECTIBLE: + return visitor.visitInvoiceMarkedUncollectible(); + case PAYMENT_SUCCEEDED_UNDERSCORE: + return visitor.visitPaymentSucceededUnderscore(); + case PAYMENT_CREATED_UNDERSCORE: + return visitor.visitPaymentCreatedUnderscore(); + case EXPORT_COMPLETED: + return visitor.visitExportCompleted(); + case CARD_APPLICATION_UPDATED: + return visitor.visitCardApplicationUpdated(); + case MEMBERSHIP_METADATA_UPDATED: + return visitor.visitMembershipMetadataUpdated(); + case CARD_TRANSACTION_UPDATED: + return visitor.visitCardTransactionUpdated(); + case APP_PAYMENT_FAILED_UNDERSCORE: + return visitor.visitAppPaymentFailedUnderscore(); + case INVOICE_PAST_DUE: + return visitor.visitInvoicePastDue(); + case RESOLUTION_UPDATED_UNDERSCORE: + return visitor.visitResolutionUpdatedUnderscore(); + case INVOICE_PAID: + return visitor.visitInvoicePaid(); + case PLAN_CREATED: + return visitor.visitPlanCreated(); + case CARD_TRANSACTION_DECLINED: + return visitor.visitCardTransactionDeclined(); + case IDENTITY_PROFILE_UPDATED: + return visitor.visitIdentityProfileUpdated(); + case APP_MEMBERSHIP_WENT_INVALID: + return visitor.visitAppMembershipWentInvalid(); + case PAYMENT_AFFILIATE_REWARD_CREATED: + return visitor.visitPaymentAffiliateRewardCreated(); + case AD_CAMPAIGN_PAYMENT_FAILED: + return visitor.visitAdCampaignPaymentFailed(); + case APP_PAYMENT_SUCCEEDED_UNDERSCORE: + return visitor.visitAppPaymentSucceededUnderscore(); + case PLAN_DELETED: + return visitor.visitPlanDeleted(); + case RESOLUTION_CREATED: + return visitor.visitResolutionCreated(); + case PAYOUT_METHOD_CREATED: + return visitor.visitPayoutMethodCreated(); + case DISPUTE_UPDATED_UNDERSCORE: + return visitor.visitDisputeUpdatedUnderscore(); + case COURSE_LESSON_INTERACTION_COMPLETED: + return visitor.visitCourseLessonInteractionCompleted(); + case CARD_CANCELED: + return visitor.visitCardCanceled(); + case DEPOSIT_SUCCEEDED: + return visitor.visitDepositSucceeded(); + case VERIFICATION_SUCCEEDED: + return visitor.visitVerificationSucceeded(); + case PRODUCT_CREATED: + return visitor.visitProductCreated(); + case MEMBER_CREATED: + return visitor.visitMemberCreated(); + case CARD_TRANSACTION_COMPLETED: + return visitor.visitCardTransactionCompleted(); + case APP_PAYMENT_PENDING_UNDERSCORE: + return visitor.visitAppPaymentPendingUnderscore(); + case APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE: + return visitor.visitAppMembershipCancelAtPeriodEndChangedUnderscore(); + case REFUND_CREATED_UNDERSCORE: + return visitor.visitRefundCreatedUnderscore(); + case APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED: + return visitor.visitAppMembershipCancelAtPeriodEndChanged(); + case APP_PAYMENT_SUCCEEDED: + return visitor.visitAppPaymentSucceeded(); + case CARD_CREATED: + return visitor.visitCardCreated(); + case MEMBERSHIP_EXPERIENCE_CLAIMED_UNDERSCORE: + return visitor.visitMembershipExperienceClaimedUnderscore(); + case PAYMENT_FAILED: + return visitor.visitPaymentFailed(); + case RESOLUTION_DECIDED_UNDERSCORE: + return visitor.visitResolutionDecidedUnderscore(); + case APP_MEMBERSHIP_WENT_INVALID_UNDERSCORE: + return visitor.visitAppMembershipWentInvalidUnderscore(); + case RESOLUTION_DECIDED: + return visitor.visitResolutionDecided(); + case IDENTITY_PROFILE_APPROVED: + return visitor.visitIdentityProfileApproved(); + case SHIPMENT_CREATED: + return visitor.visitShipmentCreated(); + case DISPUTE_UPDATED: + return visitor.visitDisputeUpdated(); + case ACCOUNT_UPDATED: + return visitor.visitAccountUpdated(); + case MEMBERSHIP_WENT_INVALID_UNDERSCORE: + return visitor.visitMembershipWentInvalidUnderscore(); + case LEDGER_ACCOUNT_FUNDS_AVAILABLE: + return visitor.visitLedgerAccountFundsAvailable(); + case PAYMENT_PENDING: + return visitor.visitPaymentPending(); + case MEMBERSHIP_TRIAL_ENDING_SOON: + return visitor.visitMembershipTrialEndingSoon(); + case DISPUTE_CREATED_UNDERSCORE: + return visitor.visitDisputeCreatedUnderscore(); + case RESOLUTION_CENTER_CASE_DECIDED: + return visitor.visitResolutionCenterCaseDecided(); + case MEMBERSHIP_EXPERIENCE_CLAIMED: + return visitor.visitMembershipExperienceClaimed(); + case PRODUCT_PUBLISHED: + return visitor.visitProductPublished(); + case PAYMENT_PENDING_UNDERSCORE: + return visitor.visitPaymentPendingUnderscore(); + case RESOLUTION_CREATED_UNDERSCORE: + return visitor.visitResolutionCreatedUnderscore(); + case RESOLUTION_UPDATED: + return visitor.visitResolutionUpdated(); + case EXPORT_FAILED: + return visitor.visitExportFailed(); + case CHAT_REACTION_CREATED: + return visitor.visitChatReactionCreated(); + case PAYMENT_SUCCEEDED: + return visitor.visitPaymentSucceeded(); + case SHIPMENT_UPDATED: + return visitor.visitShipmentUpdated(); + case DISPUTE_CREATED: + return visitor.visitDisputeCreated(); + case INVOICE_CREATED: + return visitor.visitInvoiceCreated(); + case PAYMENT_AFFILIATE_REWARD_CREATED_UNDERSCORE: + return visitor.visitPaymentAffiliateRewardCreatedUnderscore(); + case MEMBERSHIP_WENT_VALID: + return visitor.visitMembershipWentValid(); + case IDENTITY_PROFILE_NEEDS_ACTION: + return visitor.visitIdentityProfileNeedsAction(); + case SETUP_INTENT_REQUIRES_ACTION: + return visitor.visitSetupIntentRequiresAction(); + case INVOICE_VOIDED: + return visitor.visitInvoiceVoided(); + case MEMBERSHIP_WENT_VALID_UNDERSCORE: + return visitor.visitMembershipWentValidUnderscore(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateWebhooksRequestEventsItem valueOf(String value) { + switch (value) { + case "membership_metadata_updated": + return MEMBERSHIP_METADATA_UPDATED_UNDERSCORE; + case "resolution_center_case.created": + return RESOLUTION_CENTER_CASE_CREATED; + case "app_payment.created": + return APP_PAYMENT_CREATED; + case "identity_profile.rejected": + return IDENTITY_PROFILE_REJECTED; + case "membership.went_invalid": + return MEMBERSHIP_WENT_INVALID; + case "transfer.completed": + return TRANSFER_COMPLETED; + case "card_application.denied": + return CARD_APPLICATION_DENIED; + case "membership_cancel_at_period_end_changed": + return MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE; + case "transfer.created": + return TRANSFER_CREATED; + case "payment_failed": + return PAYMENT_FAILED_UNDERSCORE; + case "card_application.created": + return CARD_APPLICATION_CREATED; + case "membership.cancel_at_period_end_changed": + return MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED; + case "entry.denied": + return ENTRY_DENIED; + case "transfer.failed": + return TRANSFER_FAILED; + case "plan.updated": + return PLAN_UPDATED; + case "refund_updated": + return REFUND_UPDATED_UNDERSCORE; + case "setup_intent.succeeded": + return SETUP_INTENT_SUCCEEDED; + case "membership.deactivated": + return MEMBERSHIP_DEACTIVATED; + case "card_transaction.reversed": + return CARD_TRANSACTION_REVERSED; + case "card.frozen": + return CARD_FROZEN; + case "withdrawal.updated": + return WITHDRAWAL_UPDATED; + case "setup_intent.canceled": + return SETUP_INTENT_CANCELED; + case "app_payment_created": + return APP_PAYMENT_CREATED_UNDERSCORE; + case "app_payment.failed": + return APP_PAYMENT_FAILED; + case "resolution_center_case.updated": + return RESOLUTION_CENTER_CASE_UPDATED; + case "product.unpublished": + return PRODUCT_UNPUBLISHED; + case "app_payment.pending": + return APP_PAYMENT_PENDING; + case "entry.deleted": + return ENTRY_DELETED; + case "swap.completed": + return SWAP_COMPLETED; + case "entry.approved": + return ENTRY_APPROVED; + case "dispute_alert.created": + return DISPUTE_ALERT_CREATED; + case "card_transaction.created": + return CARD_TRANSACTION_CREATED; + case "refund.updated": + return REFUND_UPDATED; + case "withdrawal.reversed": + return WITHDRAWAL_REVERSED; + case "payout_account.status_updated": + return PAYOUT_ACCOUNT_STATUS_UPDATED; + case "entry.created": + return ENTRY_CREATED; + case "app_membership.went_valid": + return APP_MEMBERSHIP_WENT_VALID; + case "product.updated": + return PRODUCT_UPDATED; + case "withdrawal.created": + return WITHDRAWAL_CREATED; + case "chat.message.created": + return CHAT_MESSAGE_CREATED; + case "membership.activated": + return MEMBERSHIP_ACTIVATED; + case "app_membership_went_valid": + return APP_MEMBERSHIP_WENT_VALID_UNDERSCORE; + case "dispute_alert_created": + return DISPUTE_ALERT_CREATED_UNDERSCORE; + case "refund.created": + return REFUND_CREATED; + case "card.updated": + return CARD_UPDATED; + case "card_application.approved": + return CARD_APPLICATION_APPROVED; + case "product.deleted": + return PRODUCT_DELETED; + case "payment.created": + return PAYMENT_CREATED; + case "invoice.marked_uncollectible": + return INVOICE_MARKED_UNCOLLECTIBLE; + case "payment_succeeded": + return PAYMENT_SUCCEEDED_UNDERSCORE; + case "payment_created": + return PAYMENT_CREATED_UNDERSCORE; + case "export.completed": + return EXPORT_COMPLETED; + case "card_application.updated": + return CARD_APPLICATION_UPDATED; + case "membership.metadata_updated": + return MEMBERSHIP_METADATA_UPDATED; + case "card_transaction.updated": + return CARD_TRANSACTION_UPDATED; + case "app_payment_failed": + return APP_PAYMENT_FAILED_UNDERSCORE; + case "invoice.past_due": + return INVOICE_PAST_DUE; + case "resolution_updated": + return RESOLUTION_UPDATED_UNDERSCORE; + case "invoice.paid": + return INVOICE_PAID; + case "plan.created": + return PLAN_CREATED; + case "card_transaction.declined": + return CARD_TRANSACTION_DECLINED; + case "identity_profile.updated": + return IDENTITY_PROFILE_UPDATED; + case "app_membership.went_invalid": + return APP_MEMBERSHIP_WENT_INVALID; + case "payment.affiliate_reward_created": + return PAYMENT_AFFILIATE_REWARD_CREATED; + case "ad_campaign.payment_failed": + return AD_CAMPAIGN_PAYMENT_FAILED; + case "app_payment_succeeded": + return APP_PAYMENT_SUCCEEDED_UNDERSCORE; + case "plan.deleted": + return PLAN_DELETED; + case "resolution.created": + return RESOLUTION_CREATED; + case "payout_method.created": + return PAYOUT_METHOD_CREATED; + case "dispute_updated": + return DISPUTE_UPDATED_UNDERSCORE; + case "course_lesson_interaction.completed": + return COURSE_LESSON_INTERACTION_COMPLETED; + case "card.canceled": + return CARD_CANCELED; + case "deposit.succeeded": + return DEPOSIT_SUCCEEDED; + case "verification.succeeded": + return VERIFICATION_SUCCEEDED; + case "product.created": + return PRODUCT_CREATED; + case "member.created": + return MEMBER_CREATED; + case "card_transaction.completed": + return CARD_TRANSACTION_COMPLETED; + case "app_payment_pending": + return APP_PAYMENT_PENDING_UNDERSCORE; + case "app_membership_cancel_at_period_end_changed": + return APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE; + case "refund_created": + return REFUND_CREATED_UNDERSCORE; + case "app_membership.cancel_at_period_end_changed": + return APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED; + case "app_payment.succeeded": + return APP_PAYMENT_SUCCEEDED; + case "card.created": + return CARD_CREATED; + case "membership_experience_claimed": + return MEMBERSHIP_EXPERIENCE_CLAIMED_UNDERSCORE; + case "payment.failed": + return PAYMENT_FAILED; + case "resolution_decided": + return RESOLUTION_DECIDED_UNDERSCORE; + case "app_membership_went_invalid": + return APP_MEMBERSHIP_WENT_INVALID_UNDERSCORE; + case "resolution.decided": + return RESOLUTION_DECIDED; + case "identity_profile.approved": + return IDENTITY_PROFILE_APPROVED; + case "shipment.created": + return SHIPMENT_CREATED; + case "dispute.updated": + return DISPUTE_UPDATED; + case "account.updated": + return ACCOUNT_UPDATED; + case "membership_went_invalid": + return MEMBERSHIP_WENT_INVALID_UNDERSCORE; + case "ledger_account.funds_available": + return LEDGER_ACCOUNT_FUNDS_AVAILABLE; + case "payment.pending": + return PAYMENT_PENDING; + case "membership.trial_ending_soon": + return MEMBERSHIP_TRIAL_ENDING_SOON; + case "dispute_created": + return DISPUTE_CREATED_UNDERSCORE; + case "resolution_center_case.decided": + return RESOLUTION_CENTER_CASE_DECIDED; + case "membership.experience_claimed": + return MEMBERSHIP_EXPERIENCE_CLAIMED; + case "product.published": + return PRODUCT_PUBLISHED; + case "payment_pending": + return PAYMENT_PENDING_UNDERSCORE; + case "resolution_created": + return RESOLUTION_CREATED_UNDERSCORE; + case "resolution.updated": + return RESOLUTION_UPDATED; + case "export.failed": + return EXPORT_FAILED; + case "chat.reaction.created": + return CHAT_REACTION_CREATED; + case "payment.succeeded": + return PAYMENT_SUCCEEDED; + case "shipment.updated": + return SHIPMENT_UPDATED; + case "dispute.created": + return DISPUTE_CREATED; + case "invoice.created": + return INVOICE_CREATED; + case "payment_affiliate_reward_created": + return PAYMENT_AFFILIATE_REWARD_CREATED_UNDERSCORE; + case "membership.went_valid": + return MEMBERSHIP_WENT_VALID; + case "identity_profile.needs_action": + return IDENTITY_PROFILE_NEEDS_ACTION; + case "setup_intent.requires_action": + return SETUP_INTENT_REQUIRES_ACTION; + case "invoice.voided": + return INVOICE_VOIDED; + case "membership_went_valid": + return MEMBERSHIP_WENT_VALID_UNDERSCORE; + default: + return new CreateWebhooksRequestEventsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT_UPDATED, + + INVOICE_CREATED, + + INVOICE_MARKED_UNCOLLECTIBLE, + + INVOICE_PAID, + + INVOICE_PAST_DUE, + + INVOICE_VOIDED, + + MEMBERSHIP_ACTIVATED, + + MEMBERSHIP_DEACTIVATED, + + MEMBERSHIP_TRIAL_ENDING_SOON, + + ENTRY_CREATED, + + ENTRY_APPROVED, + + ENTRY_DENIED, + + ENTRY_DELETED, + + EXPORT_COMPLETED, + + EXPORT_FAILED, + + SETUP_INTENT_REQUIRES_ACTION, + + SETUP_INTENT_SUCCEEDED, + + SETUP_INTENT_CANCELED, + + LEDGER_ACCOUNT_FUNDS_AVAILABLE, + + SWAP_COMPLETED, + + DEPOSIT_SUCCEEDED, + + TRANSFER_CREATED, + + TRANSFER_COMPLETED, + + TRANSFER_FAILED, + + WITHDRAWAL_CREATED, + + WITHDRAWAL_UPDATED, + + WITHDRAWAL_REVERSED, + + CARD_TRANSACTION_CREATED, + + CARD_TRANSACTION_UPDATED, + + CARD_TRANSACTION_COMPLETED, + + CARD_TRANSACTION_DECLINED, + + CARD_TRANSACTION_REVERSED, + + CARD_CREATED, + + CARD_UPDATED, + + CARD_FROZEN, + + CARD_CANCELED, + + CARD_APPLICATION_CREATED, + + CARD_APPLICATION_UPDATED, + + CARD_APPLICATION_APPROVED, + + CARD_APPLICATION_DENIED, + + COURSE_LESSON_INTERACTION_COMPLETED, + + PAYOUT_METHOD_CREATED, + + VERIFICATION_SUCCEEDED, + + IDENTITY_PROFILE_APPROVED, + + IDENTITY_PROFILE_REJECTED, + + IDENTITY_PROFILE_NEEDS_ACTION, + + IDENTITY_PROFILE_UPDATED, + + PAYOUT_ACCOUNT_STATUS_UPDATED, + + RESOLUTION_CENTER_CASE_CREATED, + + RESOLUTION_CENTER_CASE_UPDATED, + + RESOLUTION_CENTER_CASE_DECIDED, + + PRODUCT_CREATED, + + PRODUCT_UPDATED, + + PRODUCT_DELETED, + + PRODUCT_PUBLISHED, + + PRODUCT_UNPUBLISHED, + + PLAN_CREATED, + + PLAN_UPDATED, + + PLAN_DELETED, + + SHIPMENT_CREATED, + + SHIPMENT_UPDATED, + + MEMBER_CREATED, + + AD_CAMPAIGN_PAYMENT_FAILED, + + CHAT_MESSAGE_CREATED, + + CHAT_REACTION_CREATED, + + PAYMENT_CREATED, + + PAYMENT_SUCCEEDED, + + PAYMENT_FAILED, + + PAYMENT_PENDING, + + DISPUTE_CREATED, + + DISPUTE_UPDATED, + + REFUND_CREATED, + + REFUND_UPDATED, + + DISPUTE_ALERT_CREATED, + + MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, + + MEMBERSHIP_WENT_VALID_UNDERSCORE, + + MEMBERSHIP_WENT_INVALID_UNDERSCORE, + + MEMBERSHIP_METADATA_UPDATED_UNDERSCORE, + + RESOLUTION_CREATED_UNDERSCORE, + + RESOLUTION_UPDATED_UNDERSCORE, + + RESOLUTION_DECIDED_UNDERSCORE, + + PAYMENT_AFFILIATE_REWARD_CREATED_UNDERSCORE, + + MEMBERSHIP_EXPERIENCE_CLAIMED_UNDERSCORE, + + APP_MEMBERSHIP_WENT_VALID_UNDERSCORE, + + APP_MEMBERSHIP_WENT_INVALID_UNDERSCORE, + + APP_PAYMENT_CREATED_UNDERSCORE, + + APP_PAYMENT_SUCCEEDED_UNDERSCORE, + + APP_PAYMENT_FAILED_UNDERSCORE, + + APP_PAYMENT_PENDING_UNDERSCORE, + + APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE, + + PAYMENT_CREATED_UNDERSCORE, + + PAYMENT_SUCCEEDED_UNDERSCORE, + + PAYMENT_FAILED_UNDERSCORE, + + PAYMENT_PENDING_UNDERSCORE, + + DISPUTE_CREATED_UNDERSCORE, + + DISPUTE_UPDATED_UNDERSCORE, + + REFUND_CREATED_UNDERSCORE, + + REFUND_UPDATED_UNDERSCORE, + + DISPUTE_ALERT_CREATED_UNDERSCORE, + + MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE, + + MEMBERSHIP_WENT_VALID, + + MEMBERSHIP_WENT_INVALID, + + MEMBERSHIP_METADATA_UPDATED, + + RESOLUTION_CREATED, + + RESOLUTION_UPDATED, + + RESOLUTION_DECIDED, + + PAYMENT_AFFILIATE_REWARD_CREATED, + + MEMBERSHIP_EXPERIENCE_CLAIMED, + + APP_MEMBERSHIP_WENT_VALID, + + APP_MEMBERSHIP_WENT_INVALID, + + APP_PAYMENT_CREATED, + + APP_PAYMENT_SUCCEEDED, + + APP_PAYMENT_FAILED, + + APP_PAYMENT_PENDING, + + APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, + + UNKNOWN + } + + public interface Visitor { + T visitAccountUpdated(); + + T visitInvoiceCreated(); + + T visitInvoiceMarkedUncollectible(); + + T visitInvoicePaid(); + + T visitInvoicePastDue(); + + T visitInvoiceVoided(); + + T visitMembershipActivated(); + + T visitMembershipDeactivated(); + + T visitMembershipTrialEndingSoon(); + + T visitEntryCreated(); + + T visitEntryApproved(); + + T visitEntryDenied(); + + T visitEntryDeleted(); + + T visitExportCompleted(); + + T visitExportFailed(); + + T visitSetupIntentRequiresAction(); + + T visitSetupIntentSucceeded(); + + T visitSetupIntentCanceled(); + + T visitLedgerAccountFundsAvailable(); + + T visitSwapCompleted(); + + T visitDepositSucceeded(); + + T visitTransferCreated(); + + T visitTransferCompleted(); + + T visitTransferFailed(); + + T visitWithdrawalCreated(); + + T visitWithdrawalUpdated(); + + T visitWithdrawalReversed(); + + T visitCardTransactionCreated(); + + T visitCardTransactionUpdated(); + + T visitCardTransactionCompleted(); + + T visitCardTransactionDeclined(); + + T visitCardTransactionReversed(); + + T visitCardCreated(); + + T visitCardUpdated(); + + T visitCardFrozen(); + + T visitCardCanceled(); + + T visitCardApplicationCreated(); + + T visitCardApplicationUpdated(); + + T visitCardApplicationApproved(); + + T visitCardApplicationDenied(); + + T visitCourseLessonInteractionCompleted(); + + T visitPayoutMethodCreated(); + + T visitVerificationSucceeded(); + + T visitIdentityProfileApproved(); + + T visitIdentityProfileRejected(); + + T visitIdentityProfileNeedsAction(); + + T visitIdentityProfileUpdated(); + + T visitPayoutAccountStatusUpdated(); + + T visitResolutionCenterCaseCreated(); + + T visitResolutionCenterCaseUpdated(); + + T visitResolutionCenterCaseDecided(); + + T visitProductCreated(); + + T visitProductUpdated(); + + T visitProductDeleted(); + + T visitProductPublished(); + + T visitProductUnpublished(); + + T visitPlanCreated(); + + T visitPlanUpdated(); + + T visitPlanDeleted(); + + T visitShipmentCreated(); + + T visitShipmentUpdated(); + + T visitMemberCreated(); + + T visitAdCampaignPaymentFailed(); + + T visitChatMessageCreated(); + + T visitChatReactionCreated(); + + T visitPaymentCreated(); + + T visitPaymentSucceeded(); + + T visitPaymentFailed(); + + T visitPaymentPending(); + + T visitDisputeCreated(); + + T visitDisputeUpdated(); + + T visitRefundCreated(); + + T visitRefundUpdated(); + + T visitDisputeAlertCreated(); + + T visitMembershipCancelAtPeriodEndChanged(); + + T visitMembershipWentValidUnderscore(); + + T visitMembershipWentInvalidUnderscore(); + + T visitMembershipMetadataUpdatedUnderscore(); + + T visitResolutionCreatedUnderscore(); + + T visitResolutionUpdatedUnderscore(); + + T visitResolutionDecidedUnderscore(); + + T visitPaymentAffiliateRewardCreatedUnderscore(); + + T visitMembershipExperienceClaimedUnderscore(); + + T visitAppMembershipWentValidUnderscore(); + + T visitAppMembershipWentInvalidUnderscore(); + + T visitAppPaymentCreatedUnderscore(); + + T visitAppPaymentSucceededUnderscore(); + + T visitAppPaymentFailedUnderscore(); + + T visitAppPaymentPendingUnderscore(); + + T visitAppMembershipCancelAtPeriodEndChangedUnderscore(); + + T visitPaymentCreatedUnderscore(); + + T visitPaymentSucceededUnderscore(); + + T visitPaymentFailedUnderscore(); + + T visitPaymentPendingUnderscore(); + + T visitDisputeCreatedUnderscore(); + + T visitDisputeUpdatedUnderscore(); + + T visitRefundCreatedUnderscore(); + + T visitRefundUpdatedUnderscore(); + + T visitDisputeAlertCreatedUnderscore(); + + T visitMembershipCancelAtPeriodEndChangedUnderscore(); + + T visitMembershipWentValid(); + + T visitMembershipWentInvalid(); + + T visitMembershipMetadataUpdated(); + + T visitResolutionCreated(); + + T visitResolutionUpdated(); + + T visitResolutionDecided(); + + T visitPaymentAffiliateRewardCreated(); + + T visitMembershipExperienceClaimed(); + + T visitAppMembershipWentValid(); + + T visitAppMembershipWentInvalid(); + + T visitAppPaymentCreated(); + + T visitAppPaymentSucceeded(); + + T visitAppPaymentFailed(); + + T visitAppPaymentPending(); + + T visitAppMembershipCancelAtPeriodEndChanged(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/types/DeleteWebhooksResponse.java b/src/main/java/com/whop/api/resources/webhooks/types/DeleteWebhooksResponse.java new file mode 100644 index 00000000..0af13040 --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/types/DeleteWebhooksResponse.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteWebhooksResponse.Builder.class) +public final class DeleteWebhooksResponse { + private final boolean deleted; + + private final String id; + + private final Map additionalProperties; + + private DeleteWebhooksResponse(boolean deleted, String id, Map additionalProperties) { + this.deleted = deleted; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Always true: the resource was deleted. + */ + @JsonProperty("deleted") + public boolean getDeleted() { + return deleted; + } + + /** + * @return The ID of the deleted resource. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteWebhooksResponse && equalTo((DeleteWebhooksResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteWebhooksResponse other) { + return deleted == other.deleted && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.deleted, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeletedStage builder() { + return new Builder(); + } + + public interface DeletedStage { + /** + *

Always true: the resource was deleted.

+ */ + IdStage deleted(boolean deleted); + + Builder from(DeleteWebhooksResponse other); + } + + public interface IdStage { + /** + *

The ID of the deleted resource.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DeleteWebhooksResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DeletedStage, IdStage, _FinalStage { + private boolean deleted; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeleteWebhooksResponse other) { + deleted(other.getDeleted()); + id(other.getId()); + return this; + } + + /** + *

Always true: the resource was deleted.

+ *

Always true: the resource was deleted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("deleted") + public IdStage deleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + *

The ID of the deleted resource.

+ *

The ID of the deleted resource.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DeleteWebhooksResponse build() { + return new DeleteWebhooksResponse(deleted, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/types/DeliveriesWebhookResponse.java b/src/main/java/com/whop/api/resources/webhooks/types/DeliveriesWebhookResponse.java new file mode 100644 index 00000000..284b7cbc --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/types/DeliveriesWebhookResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeliveriesWebhookResponse.Builder.class) +public final class DeliveriesWebhookResponse { + private final List data; + + private final DeliveriesWebhookResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private DeliveriesWebhookResponse( + List data, + DeliveriesWebhookResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public DeliveriesWebhookResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeliveriesWebhookResponse && equalTo((DeliveriesWebhookResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeliveriesWebhookResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull DeliveriesWebhookResponsePageInfo pageInfo); + + Builder from(DeliveriesWebhookResponse other); + } + + public interface _FinalStage { + DeliveriesWebhookResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(DeliveriesWebhookResponseDataItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private DeliveriesWebhookResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeliveriesWebhookResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull DeliveriesWebhookResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(DeliveriesWebhookResponseDataItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public DeliveriesWebhookResponse build() { + return new DeliveriesWebhookResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/types/DeliveriesWebhookResponseDataItem.java b/src/main/java/com/whop/api/resources/webhooks/types/DeliveriesWebhookResponseDataItem.java new file mode 100644 index 00000000..82ecd909 --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/types/DeliveriesWebhookResponseDataItem.java @@ -0,0 +1,362 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeliveriesWebhookResponseDataItem.Builder.class) +public final class DeliveriesWebhookResponseDataItem { + private final Map requestBody; + + private final String resourceId; + + private final Map responseBody; + + private final int responseCode; + + private final OffsetDateTime sentAt; + + private final double totalTime; + + private final Map additionalProperties; + + private DeliveriesWebhookResponseDataItem( + Map requestBody, + String resourceId, + Map responseBody, + int responseCode, + OffsetDateTime sentAt, + double totalTime, + Map additionalProperties) { + this.requestBody = requestBody; + this.resourceId = resourceId; + this.responseBody = responseBody; + this.responseCode = responseCode; + this.sentAt = sentAt; + this.totalTime = totalTime; + this.additionalProperties = additionalProperties; + } + + /** + * @return The request body sent to the webhook endpoint + */ + @JsonProperty("request_body") + public Map getRequestBody() { + return requestBody; + } + + /** + * @return The ID of the resource that triggered the webhook + */ + @JsonProperty("resource_id") + public String getResourceId() { + return resourceId; + } + + /** + * @return The response body received from the webhook endpoint + */ + @JsonProperty("response_body") + public Map getResponseBody() { + return responseBody; + } + + /** + * @return The HTTP response code received from the webhook endpoint + */ + @JsonProperty("response_code") + public int getResponseCode() { + return responseCode; + } + + /** + * @return The timestamp when the webhook was sent + */ + @JsonProperty("sent_at") + public OffsetDateTime getSentAt() { + return sentAt; + } + + /** + * @return The total time taken to send the webhook request in seconds + */ + @JsonProperty("total_time") + public double getTotalTime() { + return totalTime; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeliveriesWebhookResponseDataItem && equalTo((DeliveriesWebhookResponseDataItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeliveriesWebhookResponseDataItem other) { + return requestBody.equals(other.requestBody) + && resourceId.equals(other.resourceId) + && responseBody.equals(other.responseBody) + && responseCode == other.responseCode + && sentAt.equals(other.sentAt) + && totalTime == other.totalTime; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.requestBody, this.resourceId, this.responseBody, this.responseCode, this.sentAt, this.totalTime); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ResourceIdStage builder() { + return new Builder(); + } + + public interface ResourceIdStage { + /** + *

The ID of the resource that triggered the webhook

+ */ + ResponseCodeStage resourceId(@NotNull String resourceId); + + Builder from(DeliveriesWebhookResponseDataItem other); + } + + public interface ResponseCodeStage { + /** + *

The HTTP response code received from the webhook endpoint

+ */ + SentAtStage responseCode(int responseCode); + } + + public interface SentAtStage { + /** + *

The timestamp when the webhook was sent

+ */ + TotalTimeStage sentAt(@NotNull OffsetDateTime sentAt); + } + + public interface TotalTimeStage { + /** + *

The total time taken to send the webhook request in seconds

+ */ + _FinalStage totalTime(double totalTime); + } + + public interface _FinalStage { + DeliveriesWebhookResponseDataItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The request body sent to the webhook endpoint

+ */ + _FinalStage requestBody(Map requestBody); + + _FinalStage putAllRequestBody(Map requestBody); + + _FinalStage requestBody(String key, Object value); + + /** + *

The response body received from the webhook endpoint

+ */ + _FinalStage responseBody(Map responseBody); + + _FinalStage putAllResponseBody(Map responseBody); + + _FinalStage responseBody(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ResourceIdStage, ResponseCodeStage, SentAtStage, TotalTimeStage, _FinalStage { + private String resourceId; + + private int responseCode; + + private OffsetDateTime sentAt; + + private double totalTime; + + private Map responseBody = new LinkedHashMap<>(); + + private Map requestBody = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeliveriesWebhookResponseDataItem other) { + requestBody(other.getRequestBody()); + resourceId(other.getResourceId()); + responseBody(other.getResponseBody()); + responseCode(other.getResponseCode()); + sentAt(other.getSentAt()); + totalTime(other.getTotalTime()); + return this; + } + + /** + *

The ID of the resource that triggered the webhook

+ *

The ID of the resource that triggered the webhook

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_id") + public ResponseCodeStage resourceId(@NotNull String resourceId) { + this.resourceId = Objects.requireNonNull(resourceId, "resourceId must not be null"); + return this; + } + + /** + *

The HTTP response code received from the webhook endpoint

+ *

The HTTP response code received from the webhook endpoint

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("response_code") + public SentAtStage responseCode(int responseCode) { + this.responseCode = responseCode; + return this; + } + + /** + *

The timestamp when the webhook was sent

+ *

The timestamp when the webhook was sent

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sent_at") + public TotalTimeStage sentAt(@NotNull OffsetDateTime sentAt) { + this.sentAt = Objects.requireNonNull(sentAt, "sentAt must not be null"); + return this; + } + + /** + *

The total time taken to send the webhook request in seconds

+ *

The total time taken to send the webhook request in seconds

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_time") + public _FinalStage totalTime(double totalTime) { + this.totalTime = totalTime; + return this; + } + + /** + *

The response body received from the webhook endpoint

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage responseBody(String key, Object value) { + this.responseBody.put(key, value); + return this; + } + + /** + *

The response body received from the webhook endpoint

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllResponseBody(Map responseBody) { + if (responseBody != null) { + this.responseBody.putAll(responseBody); + } + return this; + } + + /** + *

The response body received from the webhook endpoint

+ */ + @java.lang.Override + @JsonSetter(value = "response_body", nulls = Nulls.SKIP) + public _FinalStage responseBody(Map responseBody) { + this.responseBody.clear(); + if (responseBody != null) { + this.responseBody.putAll(responseBody); + } + return this; + } + + /** + *

The request body sent to the webhook endpoint

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requestBody(String key, Object value) { + this.requestBody.put(key, value); + return this; + } + + /** + *

The request body sent to the webhook endpoint

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllRequestBody(Map requestBody) { + if (requestBody != null) { + this.requestBody.putAll(requestBody); + } + return this; + } + + /** + *

The request body sent to the webhook endpoint

+ */ + @java.lang.Override + @JsonSetter(value = "request_body", nulls = Nulls.SKIP) + public _FinalStage requestBody(Map requestBody) { + this.requestBody.clear(); + if (requestBody != null) { + this.requestBody.putAll(requestBody); + } + return this; + } + + @java.lang.Override + public DeliveriesWebhookResponseDataItem build() { + return new DeliveriesWebhookResponseDataItem( + requestBody, resourceId, responseBody, responseCode, sentAt, totalTime, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/types/DeliveriesWebhookResponsePageInfo.java b/src/main/java/com/whop/api/resources/webhooks/types/DeliveriesWebhookResponsePageInfo.java new file mode 100644 index 00000000..257a26f9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/types/DeliveriesWebhookResponsePageInfo.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeliveriesWebhookResponsePageInfo.Builder.class) +public final class DeliveriesWebhookResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final Map additionalProperties; + + private DeliveriesWebhookResponsePageInfo( + Optional endCursor, boolean hasNextPage, Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.additionalProperties = additionalProperties; + } + + /** + * @return When paginating forwards, the cursor to continue. + */ + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + /** + * @return When paginating forwards, are there more items? + */ + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeliveriesWebhookResponsePageInfo && equalTo((DeliveriesWebhookResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeliveriesWebhookResponsePageInfo other) { + return endCursor.equals(other.endCursor) && hasNextPage == other.hasNextPage; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + /** + *

When paginating forwards, are there more items?

+ */ + _FinalStage hasNextPage(boolean hasNextPage); + + Builder from(DeliveriesWebhookResponsePageInfo other); + } + + public interface _FinalStage { + DeliveriesWebhookResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When paginating forwards, the cursor to continue.

+ */ + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, _FinalStage { + private boolean hasNextPage; + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeliveriesWebhookResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + return this; + } + + /** + *

When paginating forwards, are there more items?

+ *

When paginating forwards, are there more items?

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("has_next_page") + public _FinalStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + /** + *

When paginating forwards, the cursor to continue.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + /** + *

When paginating forwards, the cursor to continue.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + /** + *

When paginating forwards, the cursor to continue.

+ */ + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public DeliveriesWebhookResponsePageInfo build() { + return new DeliveriesWebhookResponsePageInfo(endCursor, hasNextPage, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/types/ListDeliveriesWebhooksResponse.java b/src/main/java/com/whop/api/resources/webhooks/types/ListDeliveriesWebhooksResponse.java new file mode 100644 index 00000000..fdc9cd0d --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/types/ListDeliveriesWebhooksResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.WebhookDelivery; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDeliveriesWebhooksResponse.Builder.class) +public final class ListDeliveriesWebhooksResponse { + private final List data; + + private final ListDeliveriesWebhooksResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListDeliveriesWebhooksResponse( + List data, + ListDeliveriesWebhooksResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListDeliveriesWebhooksResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListDeliveriesWebhooksResponse && equalTo((ListDeliveriesWebhooksResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDeliveriesWebhooksResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListDeliveriesWebhooksResponsePageInfo pageInfo); + + Builder from(ListDeliveriesWebhooksResponse other); + } + + public interface _FinalStage { + ListDeliveriesWebhooksResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(WebhookDelivery data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListDeliveriesWebhooksResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListDeliveriesWebhooksResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListDeliveriesWebhooksResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(WebhookDelivery data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListDeliveriesWebhooksResponse build() { + return new ListDeliveriesWebhooksResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/types/ListDeliveriesWebhooksResponsePageInfo.java b/src/main/java/com/whop/api/resources/webhooks/types/ListDeliveriesWebhooksResponsePageInfo.java new file mode 100644 index 00000000..4addd047 --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/types/ListDeliveriesWebhooksResponsePageInfo.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListDeliveriesWebhooksResponsePageInfo.Builder.class) +public final class ListDeliveriesWebhooksResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListDeliveriesWebhooksResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListDeliveriesWebhooksResponsePageInfo + && equalTo((ListDeliveriesWebhooksResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListDeliveriesWebhooksResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListDeliveriesWebhooksResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListDeliveriesWebhooksResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListDeliveriesWebhooksResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListDeliveriesWebhooksResponsePageInfo build() { + return new ListDeliveriesWebhooksResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/types/ListWebhooksResponse.java b/src/main/java/com/whop/api/resources/webhooks/types/ListWebhooksResponse.java new file mode 100644 index 00000000..1c31ab60 --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/types/ListWebhooksResponse.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.WebhookListItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListWebhooksResponse.Builder.class) +public final class ListWebhooksResponse { + private final List data; + + private final ListWebhooksResponsePageInfo pageInfo; + + private final Map additionalProperties; + + private ListWebhooksResponse( + List data, + ListWebhooksResponsePageInfo pageInfo, + Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public ListWebhooksResponsePageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListWebhooksResponse && equalTo((ListWebhooksResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListWebhooksResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull ListWebhooksResponsePageInfo pageInfo); + + Builder from(ListWebhooksResponse other); + } + + public interface _FinalStage { + ListWebhooksResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(WebhookListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private ListWebhooksResponsePageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListWebhooksResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull ListWebhooksResponsePageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(WebhookListItem data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListWebhooksResponse build() { + return new ListWebhooksResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/types/ListWebhooksResponsePageInfo.java b/src/main/java/com/whop/api/resources/webhooks/types/ListWebhooksResponsePageInfo.java new file mode 100644 index 00000000..d3b59524 --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/types/ListWebhooksResponsePageInfo.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListWebhooksResponsePageInfo.Builder.class) +public final class ListWebhooksResponsePageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private ListWebhooksResponsePageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListWebhooksResponsePageInfo && equalTo((ListWebhooksResponsePageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListWebhooksResponsePageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(ListWebhooksResponsePageInfo other); + } + + public interface HasPreviousPageStage { + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + ListWebhooksResponsePageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListWebhooksResponsePageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public ListWebhooksResponsePageInfo build() { + return new ListWebhooksResponsePageInfo( + endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/types/ReplayDeliveryWebhooksResponse.java b/src/main/java/com/whop/api/resources/webhooks/types/ReplayDeliveryWebhooksResponse.java new file mode 100644 index 00000000..d5a487cb --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/types/ReplayDeliveryWebhooksResponse.java @@ -0,0 +1,196 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReplayDeliveryWebhooksResponse.Builder.class) +public final class ReplayDeliveryWebhooksResponse { + private final String body; + + private final int status; + + private final boolean success; + + private final Map additionalProperties; + + private ReplayDeliveryWebhooksResponse( + String body, int status, boolean success, Map additionalProperties) { + this.body = body; + this.status = status; + this.success = success; + this.additionalProperties = additionalProperties; + } + + /** + * @return The body your endpoint returned for the replayed request, as raw text. Empty when the endpoint could not be reached. + */ + @JsonProperty("body") + public String getBody() { + return body; + } + + /** + * @return The HTTP response code your endpoint returned for the replayed request, or 0 when it could not be reached (timeout, DNS, or connection failure). + */ + @JsonProperty("status") + public int getStatus() { + return status; + } + + /** + * @return Whether your endpoint acknowledged the replay with a 2xx response. + */ + @JsonProperty("success") + public boolean getSuccess() { + return success; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReplayDeliveryWebhooksResponse && equalTo((ReplayDeliveryWebhooksResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReplayDeliveryWebhooksResponse other) { + return body.equals(other.body) && status == other.status && success == other.success; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.body, this.status, this.success); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + /** + *

The body your endpoint returned for the replayed request, as raw text. Empty when the endpoint could not be reached.

+ */ + StatusStage body(@NotNull String body); + + Builder from(ReplayDeliveryWebhooksResponse other); + } + + public interface StatusStage { + /** + *

The HTTP response code your endpoint returned for the replayed request, or 0 when it could not be reached (timeout, DNS, or connection failure).

+ */ + SuccessStage status(int status); + } + + public interface SuccessStage { + /** + *

Whether your endpoint acknowledged the replay with a 2xx response.

+ */ + _FinalStage success(boolean success); + } + + public interface _FinalStage { + ReplayDeliveryWebhooksResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, StatusStage, SuccessStage, _FinalStage { + private String body; + + private int status; + + private boolean success; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReplayDeliveryWebhooksResponse other) { + body(other.getBody()); + status(other.getStatus()); + success(other.getSuccess()); + return this; + } + + /** + *

The body your endpoint returned for the replayed request, as raw text. Empty when the endpoint could not be reached.

+ *

The body your endpoint returned for the replayed request, as raw text. Empty when the endpoint could not be reached.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("body") + public StatusStage body(@NotNull String body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + /** + *

The HTTP response code your endpoint returned for the replayed request, or 0 when it could not be reached (timeout, DNS, or connection failure).

+ *

The HTTP response code your endpoint returned for the replayed request, or 0 when it could not be reached (timeout, DNS, or connection failure).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public SuccessStage status(int status) { + this.status = status; + return this; + } + + /** + *

Whether your endpoint acknowledged the replay with a 2xx response.

+ *

Whether your endpoint acknowledged the replay with a 2xx response.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("success") + public _FinalStage success(boolean success) { + this.success = success; + return this; + } + + @java.lang.Override + public ReplayDeliveryWebhooksResponse build() { + return new ReplayDeliveryWebhooksResponse(body, status, success, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/types/ReplayWebhooksResponse.java b/src/main/java/com/whop/api/resources/webhooks/types/ReplayWebhooksResponse.java new file mode 100644 index 00000000..0a1d97d8 --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/types/ReplayWebhooksResponse.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReplayWebhooksResponse.Builder.class) +public final class ReplayWebhooksResponse { + private final boolean queued; + + private final Map additionalProperties; + + private ReplayWebhooksResponse(boolean queued, Map additionalProperties) { + this.queued = queued; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the replay was accepted. Watch the webhook's delivery log for the re-sends. + */ + @JsonProperty("queued") + public boolean getQueued() { + return queued; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReplayWebhooksResponse && equalTo((ReplayWebhooksResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReplayWebhooksResponse other) { + return queued == other.queued; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.queued); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static QueuedStage builder() { + return new Builder(); + } + + public interface QueuedStage { + /** + *

Whether the replay was accepted. Watch the webhook's delivery log for the re-sends.

+ */ + _FinalStage queued(boolean queued); + + Builder from(ReplayWebhooksResponse other); + } + + public interface _FinalStage { + ReplayWebhooksResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements QueuedStage, _FinalStage { + private boolean queued; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReplayWebhooksResponse other) { + queued(other.getQueued()); + return this; + } + + /** + *

Whether the replay was accepted. Watch the webhook's delivery log for the re-sends.

+ *

Whether the replay was accepted. Watch the webhook's delivery log for the re-sends.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("queued") + public _FinalStage queued(boolean queued) { + this.queued = queued; + return this; + } + + @java.lang.Override + public ReplayWebhooksResponse build() { + return new ReplayWebhooksResponse(queued, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/types/TestWebhooksResponse.java b/src/main/java/com/whop/api/resources/webhooks/types/TestWebhooksResponse.java new file mode 100644 index 00000000..542fa483 --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/types/TestWebhooksResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TestWebhooksResponse.Builder.class) +public final class TestWebhooksResponse { + private final Object body; + + private final int status; + + private final boolean success; + + private final Map additionalProperties; + + private TestWebhooksResponse(Object body, int status, boolean success, Map additionalProperties) { + this.body = body; + this.status = status; + this.success = success; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("body") + public Object getBody() { + return body; + } + + /** + * @return The HTTP response code of this request. + */ + @JsonProperty("status") + public int getStatus() { + return status; + } + + /** + * @return Whether or not the webhook test was successful. + */ + @JsonProperty("success") + public boolean getSuccess() { + return success; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TestWebhooksResponse && equalTo((TestWebhooksResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TestWebhooksResponse other) { + return body.equals(other.body) && status == other.status && success == other.success; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.body, this.status, this.success); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + StatusStage body(Object body); + + Builder from(TestWebhooksResponse other); + } + + public interface StatusStage { + /** + *

The HTTP response code of this request.

+ */ + SuccessStage status(int status); + } + + public interface SuccessStage { + /** + *

Whether or not the webhook test was successful.

+ */ + _FinalStage success(boolean success); + } + + public interface _FinalStage { + TestWebhooksResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, StatusStage, SuccessStage, _FinalStage { + private Object body; + + private int status; + + private boolean success; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TestWebhooksResponse other) { + body(other.getBody()); + status(other.getStatus()); + success(other.getSuccess()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public StatusStage body(Object body) { + this.body = body; + return this; + } + + /** + *

The HTTP response code of this request.

+ *

The HTTP response code of this request.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public SuccessStage status(int status) { + this.status = status; + return this; + } + + /** + *

Whether or not the webhook test was successful.

+ *

Whether or not the webhook test was successful.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("success") + public _FinalStage success(boolean success) { + this.success = success; + return this; + } + + @java.lang.Override + public TestWebhooksResponse build() { + return new TestWebhooksResponse(body, status, success, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/webhooks/types/UpdateWebhooksRequestEventsItem.java b/src/main/java/com/whop/api/resources/webhooks/types/UpdateWebhooksRequestEventsItem.java new file mode 100644 index 00000000..8645ba35 --- /dev/null +++ b/src/main/java/com/whop/api/resources/webhooks/types/UpdateWebhooksRequestEventsItem.java @@ -0,0 +1,1342 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.webhooks.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateWebhooksRequestEventsItem { + public static final UpdateWebhooksRequestEventsItem MEMBERSHIP_METADATA_UPDATED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem( + Value.MEMBERSHIP_METADATA_UPDATED_UNDERSCORE, "membership_metadata_updated"); + + public static final UpdateWebhooksRequestEventsItem RESOLUTION_CENTER_CASE_CREATED = + new UpdateWebhooksRequestEventsItem(Value.RESOLUTION_CENTER_CASE_CREATED, "resolution_center_case.created"); + + public static final UpdateWebhooksRequestEventsItem APP_PAYMENT_CREATED = + new UpdateWebhooksRequestEventsItem(Value.APP_PAYMENT_CREATED, "app_payment.created"); + + public static final UpdateWebhooksRequestEventsItem IDENTITY_PROFILE_REJECTED = + new UpdateWebhooksRequestEventsItem(Value.IDENTITY_PROFILE_REJECTED, "identity_profile.rejected"); + + public static final UpdateWebhooksRequestEventsItem MEMBERSHIP_WENT_INVALID = + new UpdateWebhooksRequestEventsItem(Value.MEMBERSHIP_WENT_INVALID, "membership.went_invalid"); + + public static final UpdateWebhooksRequestEventsItem TRANSFER_COMPLETED = + new UpdateWebhooksRequestEventsItem(Value.TRANSFER_COMPLETED, "transfer.completed"); + + public static final UpdateWebhooksRequestEventsItem CARD_APPLICATION_DENIED = + new UpdateWebhooksRequestEventsItem(Value.CARD_APPLICATION_DENIED, "card_application.denied"); + + public static final UpdateWebhooksRequestEventsItem MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem( + Value.MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE, + "membership_cancel_at_period_end_changed"); + + public static final UpdateWebhooksRequestEventsItem TRANSFER_CREATED = + new UpdateWebhooksRequestEventsItem(Value.TRANSFER_CREATED, "transfer.created"); + + public static final UpdateWebhooksRequestEventsItem PAYMENT_FAILED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.PAYMENT_FAILED_UNDERSCORE, "payment_failed"); + + public static final UpdateWebhooksRequestEventsItem CARD_APPLICATION_CREATED = + new UpdateWebhooksRequestEventsItem(Value.CARD_APPLICATION_CREATED, "card_application.created"); + + public static final UpdateWebhooksRequestEventsItem MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED = + new UpdateWebhooksRequestEventsItem( + Value.MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, "membership.cancel_at_period_end_changed"); + + public static final UpdateWebhooksRequestEventsItem ENTRY_DENIED = + new UpdateWebhooksRequestEventsItem(Value.ENTRY_DENIED, "entry.denied"); + + public static final UpdateWebhooksRequestEventsItem TRANSFER_FAILED = + new UpdateWebhooksRequestEventsItem(Value.TRANSFER_FAILED, "transfer.failed"); + + public static final UpdateWebhooksRequestEventsItem PLAN_UPDATED = + new UpdateWebhooksRequestEventsItem(Value.PLAN_UPDATED, "plan.updated"); + + public static final UpdateWebhooksRequestEventsItem REFUND_UPDATED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.REFUND_UPDATED_UNDERSCORE, "refund_updated"); + + public static final UpdateWebhooksRequestEventsItem SETUP_INTENT_SUCCEEDED = + new UpdateWebhooksRequestEventsItem(Value.SETUP_INTENT_SUCCEEDED, "setup_intent.succeeded"); + + public static final UpdateWebhooksRequestEventsItem MEMBERSHIP_DEACTIVATED = + new UpdateWebhooksRequestEventsItem(Value.MEMBERSHIP_DEACTIVATED, "membership.deactivated"); + + public static final UpdateWebhooksRequestEventsItem CARD_TRANSACTION_REVERSED = + new UpdateWebhooksRequestEventsItem(Value.CARD_TRANSACTION_REVERSED, "card_transaction.reversed"); + + public static final UpdateWebhooksRequestEventsItem CARD_FROZEN = + new UpdateWebhooksRequestEventsItem(Value.CARD_FROZEN, "card.frozen"); + + public static final UpdateWebhooksRequestEventsItem WITHDRAWAL_UPDATED = + new UpdateWebhooksRequestEventsItem(Value.WITHDRAWAL_UPDATED, "withdrawal.updated"); + + public static final UpdateWebhooksRequestEventsItem SETUP_INTENT_CANCELED = + new UpdateWebhooksRequestEventsItem(Value.SETUP_INTENT_CANCELED, "setup_intent.canceled"); + + public static final UpdateWebhooksRequestEventsItem APP_PAYMENT_CREATED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.APP_PAYMENT_CREATED_UNDERSCORE, "app_payment_created"); + + public static final UpdateWebhooksRequestEventsItem APP_PAYMENT_FAILED = + new UpdateWebhooksRequestEventsItem(Value.APP_PAYMENT_FAILED, "app_payment.failed"); + + public static final UpdateWebhooksRequestEventsItem RESOLUTION_CENTER_CASE_UPDATED = + new UpdateWebhooksRequestEventsItem(Value.RESOLUTION_CENTER_CASE_UPDATED, "resolution_center_case.updated"); + + public static final UpdateWebhooksRequestEventsItem PRODUCT_UNPUBLISHED = + new UpdateWebhooksRequestEventsItem(Value.PRODUCT_UNPUBLISHED, "product.unpublished"); + + public static final UpdateWebhooksRequestEventsItem APP_PAYMENT_PENDING = + new UpdateWebhooksRequestEventsItem(Value.APP_PAYMENT_PENDING, "app_payment.pending"); + + public static final UpdateWebhooksRequestEventsItem ENTRY_DELETED = + new UpdateWebhooksRequestEventsItem(Value.ENTRY_DELETED, "entry.deleted"); + + public static final UpdateWebhooksRequestEventsItem SWAP_COMPLETED = + new UpdateWebhooksRequestEventsItem(Value.SWAP_COMPLETED, "swap.completed"); + + public static final UpdateWebhooksRequestEventsItem ENTRY_APPROVED = + new UpdateWebhooksRequestEventsItem(Value.ENTRY_APPROVED, "entry.approved"); + + public static final UpdateWebhooksRequestEventsItem DISPUTE_ALERT_CREATED = + new UpdateWebhooksRequestEventsItem(Value.DISPUTE_ALERT_CREATED, "dispute_alert.created"); + + public static final UpdateWebhooksRequestEventsItem CARD_TRANSACTION_CREATED = + new UpdateWebhooksRequestEventsItem(Value.CARD_TRANSACTION_CREATED, "card_transaction.created"); + + public static final UpdateWebhooksRequestEventsItem REFUND_UPDATED = + new UpdateWebhooksRequestEventsItem(Value.REFUND_UPDATED, "refund.updated"); + + public static final UpdateWebhooksRequestEventsItem WITHDRAWAL_REVERSED = + new UpdateWebhooksRequestEventsItem(Value.WITHDRAWAL_REVERSED, "withdrawal.reversed"); + + public static final UpdateWebhooksRequestEventsItem PAYOUT_ACCOUNT_STATUS_UPDATED = + new UpdateWebhooksRequestEventsItem(Value.PAYOUT_ACCOUNT_STATUS_UPDATED, "payout_account.status_updated"); + + public static final UpdateWebhooksRequestEventsItem ENTRY_CREATED = + new UpdateWebhooksRequestEventsItem(Value.ENTRY_CREATED, "entry.created"); + + public static final UpdateWebhooksRequestEventsItem APP_MEMBERSHIP_WENT_VALID = + new UpdateWebhooksRequestEventsItem(Value.APP_MEMBERSHIP_WENT_VALID, "app_membership.went_valid"); + + public static final UpdateWebhooksRequestEventsItem PRODUCT_UPDATED = + new UpdateWebhooksRequestEventsItem(Value.PRODUCT_UPDATED, "product.updated"); + + public static final UpdateWebhooksRequestEventsItem WITHDRAWAL_CREATED = + new UpdateWebhooksRequestEventsItem(Value.WITHDRAWAL_CREATED, "withdrawal.created"); + + public static final UpdateWebhooksRequestEventsItem CHAT_MESSAGE_CREATED = + new UpdateWebhooksRequestEventsItem(Value.CHAT_MESSAGE_CREATED, "chat.message.created"); + + public static final UpdateWebhooksRequestEventsItem MEMBERSHIP_ACTIVATED = + new UpdateWebhooksRequestEventsItem(Value.MEMBERSHIP_ACTIVATED, "membership.activated"); + + public static final UpdateWebhooksRequestEventsItem APP_MEMBERSHIP_WENT_VALID_UNDERSCORE = + new UpdateWebhooksRequestEventsItem( + Value.APP_MEMBERSHIP_WENT_VALID_UNDERSCORE, "app_membership_went_valid"); + + public static final UpdateWebhooksRequestEventsItem DISPUTE_ALERT_CREATED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.DISPUTE_ALERT_CREATED_UNDERSCORE, "dispute_alert_created"); + + public static final UpdateWebhooksRequestEventsItem REFUND_CREATED = + new UpdateWebhooksRequestEventsItem(Value.REFUND_CREATED, "refund.created"); + + public static final UpdateWebhooksRequestEventsItem CARD_UPDATED = + new UpdateWebhooksRequestEventsItem(Value.CARD_UPDATED, "card.updated"); + + public static final UpdateWebhooksRequestEventsItem CARD_APPLICATION_APPROVED = + new UpdateWebhooksRequestEventsItem(Value.CARD_APPLICATION_APPROVED, "card_application.approved"); + + public static final UpdateWebhooksRequestEventsItem PRODUCT_DELETED = + new UpdateWebhooksRequestEventsItem(Value.PRODUCT_DELETED, "product.deleted"); + + public static final UpdateWebhooksRequestEventsItem PAYMENT_CREATED = + new UpdateWebhooksRequestEventsItem(Value.PAYMENT_CREATED, "payment.created"); + + public static final UpdateWebhooksRequestEventsItem INVOICE_MARKED_UNCOLLECTIBLE = + new UpdateWebhooksRequestEventsItem(Value.INVOICE_MARKED_UNCOLLECTIBLE, "invoice.marked_uncollectible"); + + public static final UpdateWebhooksRequestEventsItem PAYMENT_SUCCEEDED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.PAYMENT_SUCCEEDED_UNDERSCORE, "payment_succeeded"); + + public static final UpdateWebhooksRequestEventsItem PAYMENT_CREATED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.PAYMENT_CREATED_UNDERSCORE, "payment_created"); + + public static final UpdateWebhooksRequestEventsItem EXPORT_COMPLETED = + new UpdateWebhooksRequestEventsItem(Value.EXPORT_COMPLETED, "export.completed"); + + public static final UpdateWebhooksRequestEventsItem CARD_APPLICATION_UPDATED = + new UpdateWebhooksRequestEventsItem(Value.CARD_APPLICATION_UPDATED, "card_application.updated"); + + public static final UpdateWebhooksRequestEventsItem MEMBERSHIP_METADATA_UPDATED = + new UpdateWebhooksRequestEventsItem(Value.MEMBERSHIP_METADATA_UPDATED, "membership.metadata_updated"); + + public static final UpdateWebhooksRequestEventsItem CARD_TRANSACTION_UPDATED = + new UpdateWebhooksRequestEventsItem(Value.CARD_TRANSACTION_UPDATED, "card_transaction.updated"); + + public static final UpdateWebhooksRequestEventsItem APP_PAYMENT_FAILED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.APP_PAYMENT_FAILED_UNDERSCORE, "app_payment_failed"); + + public static final UpdateWebhooksRequestEventsItem INVOICE_PAST_DUE = + new UpdateWebhooksRequestEventsItem(Value.INVOICE_PAST_DUE, "invoice.past_due"); + + public static final UpdateWebhooksRequestEventsItem RESOLUTION_UPDATED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.RESOLUTION_UPDATED_UNDERSCORE, "resolution_updated"); + + public static final UpdateWebhooksRequestEventsItem INVOICE_PAID = + new UpdateWebhooksRequestEventsItem(Value.INVOICE_PAID, "invoice.paid"); + + public static final UpdateWebhooksRequestEventsItem PLAN_CREATED = + new UpdateWebhooksRequestEventsItem(Value.PLAN_CREATED, "plan.created"); + + public static final UpdateWebhooksRequestEventsItem CARD_TRANSACTION_DECLINED = + new UpdateWebhooksRequestEventsItem(Value.CARD_TRANSACTION_DECLINED, "card_transaction.declined"); + + public static final UpdateWebhooksRequestEventsItem IDENTITY_PROFILE_UPDATED = + new UpdateWebhooksRequestEventsItem(Value.IDENTITY_PROFILE_UPDATED, "identity_profile.updated"); + + public static final UpdateWebhooksRequestEventsItem APP_MEMBERSHIP_WENT_INVALID = + new UpdateWebhooksRequestEventsItem(Value.APP_MEMBERSHIP_WENT_INVALID, "app_membership.went_invalid"); + + public static final UpdateWebhooksRequestEventsItem PAYMENT_AFFILIATE_REWARD_CREATED = + new UpdateWebhooksRequestEventsItem( + Value.PAYMENT_AFFILIATE_REWARD_CREATED, "payment.affiliate_reward_created"); + + public static final UpdateWebhooksRequestEventsItem AD_CAMPAIGN_PAYMENT_FAILED = + new UpdateWebhooksRequestEventsItem(Value.AD_CAMPAIGN_PAYMENT_FAILED, "ad_campaign.payment_failed"); + + public static final UpdateWebhooksRequestEventsItem APP_PAYMENT_SUCCEEDED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.APP_PAYMENT_SUCCEEDED_UNDERSCORE, "app_payment_succeeded"); + + public static final UpdateWebhooksRequestEventsItem PLAN_DELETED = + new UpdateWebhooksRequestEventsItem(Value.PLAN_DELETED, "plan.deleted"); + + public static final UpdateWebhooksRequestEventsItem RESOLUTION_CREATED = + new UpdateWebhooksRequestEventsItem(Value.RESOLUTION_CREATED, "resolution.created"); + + public static final UpdateWebhooksRequestEventsItem PAYOUT_METHOD_CREATED = + new UpdateWebhooksRequestEventsItem(Value.PAYOUT_METHOD_CREATED, "payout_method.created"); + + public static final UpdateWebhooksRequestEventsItem DISPUTE_UPDATED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.DISPUTE_UPDATED_UNDERSCORE, "dispute_updated"); + + public static final UpdateWebhooksRequestEventsItem COURSE_LESSON_INTERACTION_COMPLETED = + new UpdateWebhooksRequestEventsItem( + Value.COURSE_LESSON_INTERACTION_COMPLETED, "course_lesson_interaction.completed"); + + public static final UpdateWebhooksRequestEventsItem CARD_CANCELED = + new UpdateWebhooksRequestEventsItem(Value.CARD_CANCELED, "card.canceled"); + + public static final UpdateWebhooksRequestEventsItem DEPOSIT_SUCCEEDED = + new UpdateWebhooksRequestEventsItem(Value.DEPOSIT_SUCCEEDED, "deposit.succeeded"); + + public static final UpdateWebhooksRequestEventsItem VERIFICATION_SUCCEEDED = + new UpdateWebhooksRequestEventsItem(Value.VERIFICATION_SUCCEEDED, "verification.succeeded"); + + public static final UpdateWebhooksRequestEventsItem PRODUCT_CREATED = + new UpdateWebhooksRequestEventsItem(Value.PRODUCT_CREATED, "product.created"); + + public static final UpdateWebhooksRequestEventsItem MEMBER_CREATED = + new UpdateWebhooksRequestEventsItem(Value.MEMBER_CREATED, "member.created"); + + public static final UpdateWebhooksRequestEventsItem CARD_TRANSACTION_COMPLETED = + new UpdateWebhooksRequestEventsItem(Value.CARD_TRANSACTION_COMPLETED, "card_transaction.completed"); + + public static final UpdateWebhooksRequestEventsItem APP_PAYMENT_PENDING_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.APP_PAYMENT_PENDING_UNDERSCORE, "app_payment_pending"); + + public static final UpdateWebhooksRequestEventsItem APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem( + Value.APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE, + "app_membership_cancel_at_period_end_changed"); + + public static final UpdateWebhooksRequestEventsItem REFUND_CREATED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.REFUND_CREATED_UNDERSCORE, "refund_created"); + + public static final UpdateWebhooksRequestEventsItem APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED = + new UpdateWebhooksRequestEventsItem( + Value.APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, "app_membership.cancel_at_period_end_changed"); + + public static final UpdateWebhooksRequestEventsItem APP_PAYMENT_SUCCEEDED = + new UpdateWebhooksRequestEventsItem(Value.APP_PAYMENT_SUCCEEDED, "app_payment.succeeded"); + + public static final UpdateWebhooksRequestEventsItem CARD_CREATED = + new UpdateWebhooksRequestEventsItem(Value.CARD_CREATED, "card.created"); + + public static final UpdateWebhooksRequestEventsItem MEMBERSHIP_EXPERIENCE_CLAIMED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem( + Value.MEMBERSHIP_EXPERIENCE_CLAIMED_UNDERSCORE, "membership_experience_claimed"); + + public static final UpdateWebhooksRequestEventsItem PAYMENT_FAILED = + new UpdateWebhooksRequestEventsItem(Value.PAYMENT_FAILED, "payment.failed"); + + public static final UpdateWebhooksRequestEventsItem RESOLUTION_DECIDED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.RESOLUTION_DECIDED_UNDERSCORE, "resolution_decided"); + + public static final UpdateWebhooksRequestEventsItem APP_MEMBERSHIP_WENT_INVALID_UNDERSCORE = + new UpdateWebhooksRequestEventsItem( + Value.APP_MEMBERSHIP_WENT_INVALID_UNDERSCORE, "app_membership_went_invalid"); + + public static final UpdateWebhooksRequestEventsItem RESOLUTION_DECIDED = + new UpdateWebhooksRequestEventsItem(Value.RESOLUTION_DECIDED, "resolution.decided"); + + public static final UpdateWebhooksRequestEventsItem IDENTITY_PROFILE_APPROVED = + new UpdateWebhooksRequestEventsItem(Value.IDENTITY_PROFILE_APPROVED, "identity_profile.approved"); + + public static final UpdateWebhooksRequestEventsItem SHIPMENT_CREATED = + new UpdateWebhooksRequestEventsItem(Value.SHIPMENT_CREATED, "shipment.created"); + + public static final UpdateWebhooksRequestEventsItem DISPUTE_UPDATED = + new UpdateWebhooksRequestEventsItem(Value.DISPUTE_UPDATED, "dispute.updated"); + + public static final UpdateWebhooksRequestEventsItem ACCOUNT_UPDATED = + new UpdateWebhooksRequestEventsItem(Value.ACCOUNT_UPDATED, "account.updated"); + + public static final UpdateWebhooksRequestEventsItem MEMBERSHIP_WENT_INVALID_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.MEMBERSHIP_WENT_INVALID_UNDERSCORE, "membership_went_invalid"); + + public static final UpdateWebhooksRequestEventsItem LEDGER_ACCOUNT_FUNDS_AVAILABLE = + new UpdateWebhooksRequestEventsItem(Value.LEDGER_ACCOUNT_FUNDS_AVAILABLE, "ledger_account.funds_available"); + + public static final UpdateWebhooksRequestEventsItem PAYMENT_PENDING = + new UpdateWebhooksRequestEventsItem(Value.PAYMENT_PENDING, "payment.pending"); + + public static final UpdateWebhooksRequestEventsItem MEMBERSHIP_TRIAL_ENDING_SOON = + new UpdateWebhooksRequestEventsItem(Value.MEMBERSHIP_TRIAL_ENDING_SOON, "membership.trial_ending_soon"); + + public static final UpdateWebhooksRequestEventsItem DISPUTE_CREATED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.DISPUTE_CREATED_UNDERSCORE, "dispute_created"); + + public static final UpdateWebhooksRequestEventsItem RESOLUTION_CENTER_CASE_DECIDED = + new UpdateWebhooksRequestEventsItem(Value.RESOLUTION_CENTER_CASE_DECIDED, "resolution_center_case.decided"); + + public static final UpdateWebhooksRequestEventsItem MEMBERSHIP_EXPERIENCE_CLAIMED = + new UpdateWebhooksRequestEventsItem(Value.MEMBERSHIP_EXPERIENCE_CLAIMED, "membership.experience_claimed"); + + public static final UpdateWebhooksRequestEventsItem PRODUCT_PUBLISHED = + new UpdateWebhooksRequestEventsItem(Value.PRODUCT_PUBLISHED, "product.published"); + + public static final UpdateWebhooksRequestEventsItem PAYMENT_PENDING_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.PAYMENT_PENDING_UNDERSCORE, "payment_pending"); + + public static final UpdateWebhooksRequestEventsItem RESOLUTION_CREATED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.RESOLUTION_CREATED_UNDERSCORE, "resolution_created"); + + public static final UpdateWebhooksRequestEventsItem RESOLUTION_UPDATED = + new UpdateWebhooksRequestEventsItem(Value.RESOLUTION_UPDATED, "resolution.updated"); + + public static final UpdateWebhooksRequestEventsItem EXPORT_FAILED = + new UpdateWebhooksRequestEventsItem(Value.EXPORT_FAILED, "export.failed"); + + public static final UpdateWebhooksRequestEventsItem CHAT_REACTION_CREATED = + new UpdateWebhooksRequestEventsItem(Value.CHAT_REACTION_CREATED, "chat.reaction.created"); + + public static final UpdateWebhooksRequestEventsItem PAYMENT_SUCCEEDED = + new UpdateWebhooksRequestEventsItem(Value.PAYMENT_SUCCEEDED, "payment.succeeded"); + + public static final UpdateWebhooksRequestEventsItem SHIPMENT_UPDATED = + new UpdateWebhooksRequestEventsItem(Value.SHIPMENT_UPDATED, "shipment.updated"); + + public static final UpdateWebhooksRequestEventsItem DISPUTE_CREATED = + new UpdateWebhooksRequestEventsItem(Value.DISPUTE_CREATED, "dispute.created"); + + public static final UpdateWebhooksRequestEventsItem INVOICE_CREATED = + new UpdateWebhooksRequestEventsItem(Value.INVOICE_CREATED, "invoice.created"); + + public static final UpdateWebhooksRequestEventsItem PAYMENT_AFFILIATE_REWARD_CREATED_UNDERSCORE = + new UpdateWebhooksRequestEventsItem( + Value.PAYMENT_AFFILIATE_REWARD_CREATED_UNDERSCORE, "payment_affiliate_reward_created"); + + public static final UpdateWebhooksRequestEventsItem MEMBERSHIP_WENT_VALID = + new UpdateWebhooksRequestEventsItem(Value.MEMBERSHIP_WENT_VALID, "membership.went_valid"); + + public static final UpdateWebhooksRequestEventsItem IDENTITY_PROFILE_NEEDS_ACTION = + new UpdateWebhooksRequestEventsItem(Value.IDENTITY_PROFILE_NEEDS_ACTION, "identity_profile.needs_action"); + + public static final UpdateWebhooksRequestEventsItem SETUP_INTENT_REQUIRES_ACTION = + new UpdateWebhooksRequestEventsItem(Value.SETUP_INTENT_REQUIRES_ACTION, "setup_intent.requires_action"); + + public static final UpdateWebhooksRequestEventsItem INVOICE_VOIDED = + new UpdateWebhooksRequestEventsItem(Value.INVOICE_VOIDED, "invoice.voided"); + + public static final UpdateWebhooksRequestEventsItem MEMBERSHIP_WENT_VALID_UNDERSCORE = + new UpdateWebhooksRequestEventsItem(Value.MEMBERSHIP_WENT_VALID_UNDERSCORE, "membership_went_valid"); + + private final Value value; + + private final String string; + + UpdateWebhooksRequestEventsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateWebhooksRequestEventsItem + && this.string.equals(((UpdateWebhooksRequestEventsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MEMBERSHIP_METADATA_UPDATED_UNDERSCORE: + return visitor.visitMembershipMetadataUpdatedUnderscore(); + case RESOLUTION_CENTER_CASE_CREATED: + return visitor.visitResolutionCenterCaseCreated(); + case APP_PAYMENT_CREATED: + return visitor.visitAppPaymentCreated(); + case IDENTITY_PROFILE_REJECTED: + return visitor.visitIdentityProfileRejected(); + case MEMBERSHIP_WENT_INVALID: + return visitor.visitMembershipWentInvalid(); + case TRANSFER_COMPLETED: + return visitor.visitTransferCompleted(); + case CARD_APPLICATION_DENIED: + return visitor.visitCardApplicationDenied(); + case MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE: + return visitor.visitMembershipCancelAtPeriodEndChangedUnderscore(); + case TRANSFER_CREATED: + return visitor.visitTransferCreated(); + case PAYMENT_FAILED_UNDERSCORE: + return visitor.visitPaymentFailedUnderscore(); + case CARD_APPLICATION_CREATED: + return visitor.visitCardApplicationCreated(); + case MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED: + return visitor.visitMembershipCancelAtPeriodEndChanged(); + case ENTRY_DENIED: + return visitor.visitEntryDenied(); + case TRANSFER_FAILED: + return visitor.visitTransferFailed(); + case PLAN_UPDATED: + return visitor.visitPlanUpdated(); + case REFUND_UPDATED_UNDERSCORE: + return visitor.visitRefundUpdatedUnderscore(); + case SETUP_INTENT_SUCCEEDED: + return visitor.visitSetupIntentSucceeded(); + case MEMBERSHIP_DEACTIVATED: + return visitor.visitMembershipDeactivated(); + case CARD_TRANSACTION_REVERSED: + return visitor.visitCardTransactionReversed(); + case CARD_FROZEN: + return visitor.visitCardFrozen(); + case WITHDRAWAL_UPDATED: + return visitor.visitWithdrawalUpdated(); + case SETUP_INTENT_CANCELED: + return visitor.visitSetupIntentCanceled(); + case APP_PAYMENT_CREATED_UNDERSCORE: + return visitor.visitAppPaymentCreatedUnderscore(); + case APP_PAYMENT_FAILED: + return visitor.visitAppPaymentFailed(); + case RESOLUTION_CENTER_CASE_UPDATED: + return visitor.visitResolutionCenterCaseUpdated(); + case PRODUCT_UNPUBLISHED: + return visitor.visitProductUnpublished(); + case APP_PAYMENT_PENDING: + return visitor.visitAppPaymentPending(); + case ENTRY_DELETED: + return visitor.visitEntryDeleted(); + case SWAP_COMPLETED: + return visitor.visitSwapCompleted(); + case ENTRY_APPROVED: + return visitor.visitEntryApproved(); + case DISPUTE_ALERT_CREATED: + return visitor.visitDisputeAlertCreated(); + case CARD_TRANSACTION_CREATED: + return visitor.visitCardTransactionCreated(); + case REFUND_UPDATED: + return visitor.visitRefundUpdated(); + case WITHDRAWAL_REVERSED: + return visitor.visitWithdrawalReversed(); + case PAYOUT_ACCOUNT_STATUS_UPDATED: + return visitor.visitPayoutAccountStatusUpdated(); + case ENTRY_CREATED: + return visitor.visitEntryCreated(); + case APP_MEMBERSHIP_WENT_VALID: + return visitor.visitAppMembershipWentValid(); + case PRODUCT_UPDATED: + return visitor.visitProductUpdated(); + case WITHDRAWAL_CREATED: + return visitor.visitWithdrawalCreated(); + case CHAT_MESSAGE_CREATED: + return visitor.visitChatMessageCreated(); + case MEMBERSHIP_ACTIVATED: + return visitor.visitMembershipActivated(); + case APP_MEMBERSHIP_WENT_VALID_UNDERSCORE: + return visitor.visitAppMembershipWentValidUnderscore(); + case DISPUTE_ALERT_CREATED_UNDERSCORE: + return visitor.visitDisputeAlertCreatedUnderscore(); + case REFUND_CREATED: + return visitor.visitRefundCreated(); + case CARD_UPDATED: + return visitor.visitCardUpdated(); + case CARD_APPLICATION_APPROVED: + return visitor.visitCardApplicationApproved(); + case PRODUCT_DELETED: + return visitor.visitProductDeleted(); + case PAYMENT_CREATED: + return visitor.visitPaymentCreated(); + case INVOICE_MARKED_UNCOLLECTIBLE: + return visitor.visitInvoiceMarkedUncollectible(); + case PAYMENT_SUCCEEDED_UNDERSCORE: + return visitor.visitPaymentSucceededUnderscore(); + case PAYMENT_CREATED_UNDERSCORE: + return visitor.visitPaymentCreatedUnderscore(); + case EXPORT_COMPLETED: + return visitor.visitExportCompleted(); + case CARD_APPLICATION_UPDATED: + return visitor.visitCardApplicationUpdated(); + case MEMBERSHIP_METADATA_UPDATED: + return visitor.visitMembershipMetadataUpdated(); + case CARD_TRANSACTION_UPDATED: + return visitor.visitCardTransactionUpdated(); + case APP_PAYMENT_FAILED_UNDERSCORE: + return visitor.visitAppPaymentFailedUnderscore(); + case INVOICE_PAST_DUE: + return visitor.visitInvoicePastDue(); + case RESOLUTION_UPDATED_UNDERSCORE: + return visitor.visitResolutionUpdatedUnderscore(); + case INVOICE_PAID: + return visitor.visitInvoicePaid(); + case PLAN_CREATED: + return visitor.visitPlanCreated(); + case CARD_TRANSACTION_DECLINED: + return visitor.visitCardTransactionDeclined(); + case IDENTITY_PROFILE_UPDATED: + return visitor.visitIdentityProfileUpdated(); + case APP_MEMBERSHIP_WENT_INVALID: + return visitor.visitAppMembershipWentInvalid(); + case PAYMENT_AFFILIATE_REWARD_CREATED: + return visitor.visitPaymentAffiliateRewardCreated(); + case AD_CAMPAIGN_PAYMENT_FAILED: + return visitor.visitAdCampaignPaymentFailed(); + case APP_PAYMENT_SUCCEEDED_UNDERSCORE: + return visitor.visitAppPaymentSucceededUnderscore(); + case PLAN_DELETED: + return visitor.visitPlanDeleted(); + case RESOLUTION_CREATED: + return visitor.visitResolutionCreated(); + case PAYOUT_METHOD_CREATED: + return visitor.visitPayoutMethodCreated(); + case DISPUTE_UPDATED_UNDERSCORE: + return visitor.visitDisputeUpdatedUnderscore(); + case COURSE_LESSON_INTERACTION_COMPLETED: + return visitor.visitCourseLessonInteractionCompleted(); + case CARD_CANCELED: + return visitor.visitCardCanceled(); + case DEPOSIT_SUCCEEDED: + return visitor.visitDepositSucceeded(); + case VERIFICATION_SUCCEEDED: + return visitor.visitVerificationSucceeded(); + case PRODUCT_CREATED: + return visitor.visitProductCreated(); + case MEMBER_CREATED: + return visitor.visitMemberCreated(); + case CARD_TRANSACTION_COMPLETED: + return visitor.visitCardTransactionCompleted(); + case APP_PAYMENT_PENDING_UNDERSCORE: + return visitor.visitAppPaymentPendingUnderscore(); + case APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE: + return visitor.visitAppMembershipCancelAtPeriodEndChangedUnderscore(); + case REFUND_CREATED_UNDERSCORE: + return visitor.visitRefundCreatedUnderscore(); + case APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED: + return visitor.visitAppMembershipCancelAtPeriodEndChanged(); + case APP_PAYMENT_SUCCEEDED: + return visitor.visitAppPaymentSucceeded(); + case CARD_CREATED: + return visitor.visitCardCreated(); + case MEMBERSHIP_EXPERIENCE_CLAIMED_UNDERSCORE: + return visitor.visitMembershipExperienceClaimedUnderscore(); + case PAYMENT_FAILED: + return visitor.visitPaymentFailed(); + case RESOLUTION_DECIDED_UNDERSCORE: + return visitor.visitResolutionDecidedUnderscore(); + case APP_MEMBERSHIP_WENT_INVALID_UNDERSCORE: + return visitor.visitAppMembershipWentInvalidUnderscore(); + case RESOLUTION_DECIDED: + return visitor.visitResolutionDecided(); + case IDENTITY_PROFILE_APPROVED: + return visitor.visitIdentityProfileApproved(); + case SHIPMENT_CREATED: + return visitor.visitShipmentCreated(); + case DISPUTE_UPDATED: + return visitor.visitDisputeUpdated(); + case ACCOUNT_UPDATED: + return visitor.visitAccountUpdated(); + case MEMBERSHIP_WENT_INVALID_UNDERSCORE: + return visitor.visitMembershipWentInvalidUnderscore(); + case LEDGER_ACCOUNT_FUNDS_AVAILABLE: + return visitor.visitLedgerAccountFundsAvailable(); + case PAYMENT_PENDING: + return visitor.visitPaymentPending(); + case MEMBERSHIP_TRIAL_ENDING_SOON: + return visitor.visitMembershipTrialEndingSoon(); + case DISPUTE_CREATED_UNDERSCORE: + return visitor.visitDisputeCreatedUnderscore(); + case RESOLUTION_CENTER_CASE_DECIDED: + return visitor.visitResolutionCenterCaseDecided(); + case MEMBERSHIP_EXPERIENCE_CLAIMED: + return visitor.visitMembershipExperienceClaimed(); + case PRODUCT_PUBLISHED: + return visitor.visitProductPublished(); + case PAYMENT_PENDING_UNDERSCORE: + return visitor.visitPaymentPendingUnderscore(); + case RESOLUTION_CREATED_UNDERSCORE: + return visitor.visitResolutionCreatedUnderscore(); + case RESOLUTION_UPDATED: + return visitor.visitResolutionUpdated(); + case EXPORT_FAILED: + return visitor.visitExportFailed(); + case CHAT_REACTION_CREATED: + return visitor.visitChatReactionCreated(); + case PAYMENT_SUCCEEDED: + return visitor.visitPaymentSucceeded(); + case SHIPMENT_UPDATED: + return visitor.visitShipmentUpdated(); + case DISPUTE_CREATED: + return visitor.visitDisputeCreated(); + case INVOICE_CREATED: + return visitor.visitInvoiceCreated(); + case PAYMENT_AFFILIATE_REWARD_CREATED_UNDERSCORE: + return visitor.visitPaymentAffiliateRewardCreatedUnderscore(); + case MEMBERSHIP_WENT_VALID: + return visitor.visitMembershipWentValid(); + case IDENTITY_PROFILE_NEEDS_ACTION: + return visitor.visitIdentityProfileNeedsAction(); + case SETUP_INTENT_REQUIRES_ACTION: + return visitor.visitSetupIntentRequiresAction(); + case INVOICE_VOIDED: + return visitor.visitInvoiceVoided(); + case MEMBERSHIP_WENT_VALID_UNDERSCORE: + return visitor.visitMembershipWentValidUnderscore(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateWebhooksRequestEventsItem valueOf(String value) { + switch (value) { + case "membership_metadata_updated": + return MEMBERSHIP_METADATA_UPDATED_UNDERSCORE; + case "resolution_center_case.created": + return RESOLUTION_CENTER_CASE_CREATED; + case "app_payment.created": + return APP_PAYMENT_CREATED; + case "identity_profile.rejected": + return IDENTITY_PROFILE_REJECTED; + case "membership.went_invalid": + return MEMBERSHIP_WENT_INVALID; + case "transfer.completed": + return TRANSFER_COMPLETED; + case "card_application.denied": + return CARD_APPLICATION_DENIED; + case "membership_cancel_at_period_end_changed": + return MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE; + case "transfer.created": + return TRANSFER_CREATED; + case "payment_failed": + return PAYMENT_FAILED_UNDERSCORE; + case "card_application.created": + return CARD_APPLICATION_CREATED; + case "membership.cancel_at_period_end_changed": + return MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED; + case "entry.denied": + return ENTRY_DENIED; + case "transfer.failed": + return TRANSFER_FAILED; + case "plan.updated": + return PLAN_UPDATED; + case "refund_updated": + return REFUND_UPDATED_UNDERSCORE; + case "setup_intent.succeeded": + return SETUP_INTENT_SUCCEEDED; + case "membership.deactivated": + return MEMBERSHIP_DEACTIVATED; + case "card_transaction.reversed": + return CARD_TRANSACTION_REVERSED; + case "card.frozen": + return CARD_FROZEN; + case "withdrawal.updated": + return WITHDRAWAL_UPDATED; + case "setup_intent.canceled": + return SETUP_INTENT_CANCELED; + case "app_payment_created": + return APP_PAYMENT_CREATED_UNDERSCORE; + case "app_payment.failed": + return APP_PAYMENT_FAILED; + case "resolution_center_case.updated": + return RESOLUTION_CENTER_CASE_UPDATED; + case "product.unpublished": + return PRODUCT_UNPUBLISHED; + case "app_payment.pending": + return APP_PAYMENT_PENDING; + case "entry.deleted": + return ENTRY_DELETED; + case "swap.completed": + return SWAP_COMPLETED; + case "entry.approved": + return ENTRY_APPROVED; + case "dispute_alert.created": + return DISPUTE_ALERT_CREATED; + case "card_transaction.created": + return CARD_TRANSACTION_CREATED; + case "refund.updated": + return REFUND_UPDATED; + case "withdrawal.reversed": + return WITHDRAWAL_REVERSED; + case "payout_account.status_updated": + return PAYOUT_ACCOUNT_STATUS_UPDATED; + case "entry.created": + return ENTRY_CREATED; + case "app_membership.went_valid": + return APP_MEMBERSHIP_WENT_VALID; + case "product.updated": + return PRODUCT_UPDATED; + case "withdrawal.created": + return WITHDRAWAL_CREATED; + case "chat.message.created": + return CHAT_MESSAGE_CREATED; + case "membership.activated": + return MEMBERSHIP_ACTIVATED; + case "app_membership_went_valid": + return APP_MEMBERSHIP_WENT_VALID_UNDERSCORE; + case "dispute_alert_created": + return DISPUTE_ALERT_CREATED_UNDERSCORE; + case "refund.created": + return REFUND_CREATED; + case "card.updated": + return CARD_UPDATED; + case "card_application.approved": + return CARD_APPLICATION_APPROVED; + case "product.deleted": + return PRODUCT_DELETED; + case "payment.created": + return PAYMENT_CREATED; + case "invoice.marked_uncollectible": + return INVOICE_MARKED_UNCOLLECTIBLE; + case "payment_succeeded": + return PAYMENT_SUCCEEDED_UNDERSCORE; + case "payment_created": + return PAYMENT_CREATED_UNDERSCORE; + case "export.completed": + return EXPORT_COMPLETED; + case "card_application.updated": + return CARD_APPLICATION_UPDATED; + case "membership.metadata_updated": + return MEMBERSHIP_METADATA_UPDATED; + case "card_transaction.updated": + return CARD_TRANSACTION_UPDATED; + case "app_payment_failed": + return APP_PAYMENT_FAILED_UNDERSCORE; + case "invoice.past_due": + return INVOICE_PAST_DUE; + case "resolution_updated": + return RESOLUTION_UPDATED_UNDERSCORE; + case "invoice.paid": + return INVOICE_PAID; + case "plan.created": + return PLAN_CREATED; + case "card_transaction.declined": + return CARD_TRANSACTION_DECLINED; + case "identity_profile.updated": + return IDENTITY_PROFILE_UPDATED; + case "app_membership.went_invalid": + return APP_MEMBERSHIP_WENT_INVALID; + case "payment.affiliate_reward_created": + return PAYMENT_AFFILIATE_REWARD_CREATED; + case "ad_campaign.payment_failed": + return AD_CAMPAIGN_PAYMENT_FAILED; + case "app_payment_succeeded": + return APP_PAYMENT_SUCCEEDED_UNDERSCORE; + case "plan.deleted": + return PLAN_DELETED; + case "resolution.created": + return RESOLUTION_CREATED; + case "payout_method.created": + return PAYOUT_METHOD_CREATED; + case "dispute_updated": + return DISPUTE_UPDATED_UNDERSCORE; + case "course_lesson_interaction.completed": + return COURSE_LESSON_INTERACTION_COMPLETED; + case "card.canceled": + return CARD_CANCELED; + case "deposit.succeeded": + return DEPOSIT_SUCCEEDED; + case "verification.succeeded": + return VERIFICATION_SUCCEEDED; + case "product.created": + return PRODUCT_CREATED; + case "member.created": + return MEMBER_CREATED; + case "card_transaction.completed": + return CARD_TRANSACTION_COMPLETED; + case "app_payment_pending": + return APP_PAYMENT_PENDING_UNDERSCORE; + case "app_membership_cancel_at_period_end_changed": + return APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE; + case "refund_created": + return REFUND_CREATED_UNDERSCORE; + case "app_membership.cancel_at_period_end_changed": + return APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED; + case "app_payment.succeeded": + return APP_PAYMENT_SUCCEEDED; + case "card.created": + return CARD_CREATED; + case "membership_experience_claimed": + return MEMBERSHIP_EXPERIENCE_CLAIMED_UNDERSCORE; + case "payment.failed": + return PAYMENT_FAILED; + case "resolution_decided": + return RESOLUTION_DECIDED_UNDERSCORE; + case "app_membership_went_invalid": + return APP_MEMBERSHIP_WENT_INVALID_UNDERSCORE; + case "resolution.decided": + return RESOLUTION_DECIDED; + case "identity_profile.approved": + return IDENTITY_PROFILE_APPROVED; + case "shipment.created": + return SHIPMENT_CREATED; + case "dispute.updated": + return DISPUTE_UPDATED; + case "account.updated": + return ACCOUNT_UPDATED; + case "membership_went_invalid": + return MEMBERSHIP_WENT_INVALID_UNDERSCORE; + case "ledger_account.funds_available": + return LEDGER_ACCOUNT_FUNDS_AVAILABLE; + case "payment.pending": + return PAYMENT_PENDING; + case "membership.trial_ending_soon": + return MEMBERSHIP_TRIAL_ENDING_SOON; + case "dispute_created": + return DISPUTE_CREATED_UNDERSCORE; + case "resolution_center_case.decided": + return RESOLUTION_CENTER_CASE_DECIDED; + case "membership.experience_claimed": + return MEMBERSHIP_EXPERIENCE_CLAIMED; + case "product.published": + return PRODUCT_PUBLISHED; + case "payment_pending": + return PAYMENT_PENDING_UNDERSCORE; + case "resolution_created": + return RESOLUTION_CREATED_UNDERSCORE; + case "resolution.updated": + return RESOLUTION_UPDATED; + case "export.failed": + return EXPORT_FAILED; + case "chat.reaction.created": + return CHAT_REACTION_CREATED; + case "payment.succeeded": + return PAYMENT_SUCCEEDED; + case "shipment.updated": + return SHIPMENT_UPDATED; + case "dispute.created": + return DISPUTE_CREATED; + case "invoice.created": + return INVOICE_CREATED; + case "payment_affiliate_reward_created": + return PAYMENT_AFFILIATE_REWARD_CREATED_UNDERSCORE; + case "membership.went_valid": + return MEMBERSHIP_WENT_VALID; + case "identity_profile.needs_action": + return IDENTITY_PROFILE_NEEDS_ACTION; + case "setup_intent.requires_action": + return SETUP_INTENT_REQUIRES_ACTION; + case "invoice.voided": + return INVOICE_VOIDED; + case "membership_went_valid": + return MEMBERSHIP_WENT_VALID_UNDERSCORE; + default: + return new UpdateWebhooksRequestEventsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT_UPDATED, + + INVOICE_CREATED, + + INVOICE_MARKED_UNCOLLECTIBLE, + + INVOICE_PAID, + + INVOICE_PAST_DUE, + + INVOICE_VOIDED, + + MEMBERSHIP_ACTIVATED, + + MEMBERSHIP_DEACTIVATED, + + MEMBERSHIP_TRIAL_ENDING_SOON, + + ENTRY_CREATED, + + ENTRY_APPROVED, + + ENTRY_DENIED, + + ENTRY_DELETED, + + EXPORT_COMPLETED, + + EXPORT_FAILED, + + SETUP_INTENT_REQUIRES_ACTION, + + SETUP_INTENT_SUCCEEDED, + + SETUP_INTENT_CANCELED, + + LEDGER_ACCOUNT_FUNDS_AVAILABLE, + + SWAP_COMPLETED, + + DEPOSIT_SUCCEEDED, + + TRANSFER_CREATED, + + TRANSFER_COMPLETED, + + TRANSFER_FAILED, + + WITHDRAWAL_CREATED, + + WITHDRAWAL_UPDATED, + + WITHDRAWAL_REVERSED, + + CARD_TRANSACTION_CREATED, + + CARD_TRANSACTION_UPDATED, + + CARD_TRANSACTION_COMPLETED, + + CARD_TRANSACTION_DECLINED, + + CARD_TRANSACTION_REVERSED, + + CARD_CREATED, + + CARD_UPDATED, + + CARD_FROZEN, + + CARD_CANCELED, + + CARD_APPLICATION_CREATED, + + CARD_APPLICATION_UPDATED, + + CARD_APPLICATION_APPROVED, + + CARD_APPLICATION_DENIED, + + COURSE_LESSON_INTERACTION_COMPLETED, + + PAYOUT_METHOD_CREATED, + + VERIFICATION_SUCCEEDED, + + IDENTITY_PROFILE_APPROVED, + + IDENTITY_PROFILE_REJECTED, + + IDENTITY_PROFILE_NEEDS_ACTION, + + IDENTITY_PROFILE_UPDATED, + + PAYOUT_ACCOUNT_STATUS_UPDATED, + + RESOLUTION_CENTER_CASE_CREATED, + + RESOLUTION_CENTER_CASE_UPDATED, + + RESOLUTION_CENTER_CASE_DECIDED, + + PRODUCT_CREATED, + + PRODUCT_UPDATED, + + PRODUCT_DELETED, + + PRODUCT_PUBLISHED, + + PRODUCT_UNPUBLISHED, + + PLAN_CREATED, + + PLAN_UPDATED, + + PLAN_DELETED, + + SHIPMENT_CREATED, + + SHIPMENT_UPDATED, + + MEMBER_CREATED, + + AD_CAMPAIGN_PAYMENT_FAILED, + + CHAT_MESSAGE_CREATED, + + CHAT_REACTION_CREATED, + + PAYMENT_CREATED, + + PAYMENT_SUCCEEDED, + + PAYMENT_FAILED, + + PAYMENT_PENDING, + + DISPUTE_CREATED, + + DISPUTE_UPDATED, + + REFUND_CREATED, + + REFUND_UPDATED, + + DISPUTE_ALERT_CREATED, + + MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, + + MEMBERSHIP_WENT_VALID_UNDERSCORE, + + MEMBERSHIP_WENT_INVALID_UNDERSCORE, + + MEMBERSHIP_METADATA_UPDATED_UNDERSCORE, + + RESOLUTION_CREATED_UNDERSCORE, + + RESOLUTION_UPDATED_UNDERSCORE, + + RESOLUTION_DECIDED_UNDERSCORE, + + PAYMENT_AFFILIATE_REWARD_CREATED_UNDERSCORE, + + MEMBERSHIP_EXPERIENCE_CLAIMED_UNDERSCORE, + + APP_MEMBERSHIP_WENT_VALID_UNDERSCORE, + + APP_MEMBERSHIP_WENT_INVALID_UNDERSCORE, + + APP_PAYMENT_CREATED_UNDERSCORE, + + APP_PAYMENT_SUCCEEDED_UNDERSCORE, + + APP_PAYMENT_FAILED_UNDERSCORE, + + APP_PAYMENT_PENDING_UNDERSCORE, + + APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE, + + PAYMENT_CREATED_UNDERSCORE, + + PAYMENT_SUCCEEDED_UNDERSCORE, + + PAYMENT_FAILED_UNDERSCORE, + + PAYMENT_PENDING_UNDERSCORE, + + DISPUTE_CREATED_UNDERSCORE, + + DISPUTE_UPDATED_UNDERSCORE, + + REFUND_CREATED_UNDERSCORE, + + REFUND_UPDATED_UNDERSCORE, + + DISPUTE_ALERT_CREATED_UNDERSCORE, + + MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED_UNDERSCORE, + + MEMBERSHIP_WENT_VALID, + + MEMBERSHIP_WENT_INVALID, + + MEMBERSHIP_METADATA_UPDATED, + + RESOLUTION_CREATED, + + RESOLUTION_UPDATED, + + RESOLUTION_DECIDED, + + PAYMENT_AFFILIATE_REWARD_CREATED, + + MEMBERSHIP_EXPERIENCE_CLAIMED, + + APP_MEMBERSHIP_WENT_VALID, + + APP_MEMBERSHIP_WENT_INVALID, + + APP_PAYMENT_CREATED, + + APP_PAYMENT_SUCCEEDED, + + APP_PAYMENT_FAILED, + + APP_PAYMENT_PENDING, + + APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, + + UNKNOWN + } + + public interface Visitor { + T visitAccountUpdated(); + + T visitInvoiceCreated(); + + T visitInvoiceMarkedUncollectible(); + + T visitInvoicePaid(); + + T visitInvoicePastDue(); + + T visitInvoiceVoided(); + + T visitMembershipActivated(); + + T visitMembershipDeactivated(); + + T visitMembershipTrialEndingSoon(); + + T visitEntryCreated(); + + T visitEntryApproved(); + + T visitEntryDenied(); + + T visitEntryDeleted(); + + T visitExportCompleted(); + + T visitExportFailed(); + + T visitSetupIntentRequiresAction(); + + T visitSetupIntentSucceeded(); + + T visitSetupIntentCanceled(); + + T visitLedgerAccountFundsAvailable(); + + T visitSwapCompleted(); + + T visitDepositSucceeded(); + + T visitTransferCreated(); + + T visitTransferCompleted(); + + T visitTransferFailed(); + + T visitWithdrawalCreated(); + + T visitWithdrawalUpdated(); + + T visitWithdrawalReversed(); + + T visitCardTransactionCreated(); + + T visitCardTransactionUpdated(); + + T visitCardTransactionCompleted(); + + T visitCardTransactionDeclined(); + + T visitCardTransactionReversed(); + + T visitCardCreated(); + + T visitCardUpdated(); + + T visitCardFrozen(); + + T visitCardCanceled(); + + T visitCardApplicationCreated(); + + T visitCardApplicationUpdated(); + + T visitCardApplicationApproved(); + + T visitCardApplicationDenied(); + + T visitCourseLessonInteractionCompleted(); + + T visitPayoutMethodCreated(); + + T visitVerificationSucceeded(); + + T visitIdentityProfileApproved(); + + T visitIdentityProfileRejected(); + + T visitIdentityProfileNeedsAction(); + + T visitIdentityProfileUpdated(); + + T visitPayoutAccountStatusUpdated(); + + T visitResolutionCenterCaseCreated(); + + T visitResolutionCenterCaseUpdated(); + + T visitResolutionCenterCaseDecided(); + + T visitProductCreated(); + + T visitProductUpdated(); + + T visitProductDeleted(); + + T visitProductPublished(); + + T visitProductUnpublished(); + + T visitPlanCreated(); + + T visitPlanUpdated(); + + T visitPlanDeleted(); + + T visitShipmentCreated(); + + T visitShipmentUpdated(); + + T visitMemberCreated(); + + T visitAdCampaignPaymentFailed(); + + T visitChatMessageCreated(); + + T visitChatReactionCreated(); + + T visitPaymentCreated(); + + T visitPaymentSucceeded(); + + T visitPaymentFailed(); + + T visitPaymentPending(); + + T visitDisputeCreated(); + + T visitDisputeUpdated(); + + T visitRefundCreated(); + + T visitRefundUpdated(); + + T visitDisputeAlertCreated(); + + T visitMembershipCancelAtPeriodEndChanged(); + + T visitMembershipWentValidUnderscore(); + + T visitMembershipWentInvalidUnderscore(); + + T visitMembershipMetadataUpdatedUnderscore(); + + T visitResolutionCreatedUnderscore(); + + T visitResolutionUpdatedUnderscore(); + + T visitResolutionDecidedUnderscore(); + + T visitPaymentAffiliateRewardCreatedUnderscore(); + + T visitMembershipExperienceClaimedUnderscore(); + + T visitAppMembershipWentValidUnderscore(); + + T visitAppMembershipWentInvalidUnderscore(); + + T visitAppPaymentCreatedUnderscore(); + + T visitAppPaymentSucceededUnderscore(); + + T visitAppPaymentFailedUnderscore(); + + T visitAppPaymentPendingUnderscore(); + + T visitAppMembershipCancelAtPeriodEndChangedUnderscore(); + + T visitPaymentCreatedUnderscore(); + + T visitPaymentSucceededUnderscore(); + + T visitPaymentFailedUnderscore(); + + T visitPaymentPendingUnderscore(); + + T visitDisputeCreatedUnderscore(); + + T visitDisputeUpdatedUnderscore(); + + T visitRefundCreatedUnderscore(); + + T visitRefundUpdatedUnderscore(); + + T visitDisputeAlertCreatedUnderscore(); + + T visitMembershipCancelAtPeriodEndChangedUnderscore(); + + T visitMembershipWentValid(); + + T visitMembershipWentInvalid(); + + T visitMembershipMetadataUpdated(); + + T visitResolutionCreated(); + + T visitResolutionUpdated(); + + T visitResolutionDecided(); + + T visitPaymentAffiliateRewardCreated(); + + T visitMembershipExperienceClaimed(); + + T visitAppMembershipWentValid(); + + T visitAppMembershipWentInvalid(); + + T visitAppPaymentCreated(); + + T visitAppPaymentSucceeded(); + + T visitAppPaymentFailed(); + + T visitAppPaymentPending(); + + T visitAppMembershipCancelAtPeriodEndChanged(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/resources/withdrawals/AsyncRawWithdrawalsClient.java b/src/main/java/com/whop/api/resources/withdrawals/AsyncRawWithdrawalsClient.java new file mode 100644 index 00000000..cebff6e5 --- /dev/null +++ b/src/main/java/com/whop/api/resources/withdrawals/AsyncRawWithdrawalsClient.java @@ -0,0 +1,596 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.withdrawals; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.withdrawals.requests.CreateWithdrawalsRequest; +import com.whop.api.resources.withdrawals.requests.GeneratePdfWithdrawalsRequest; +import com.whop.api.resources.withdrawals.requests.ListWithdrawalsRequest; +import com.whop.api.resources.withdrawals.requests.RetrieveWithdrawalsRequest; +import com.whop.api.resources.withdrawals.types.GeneratePdfWithdrawalsResponse; +import com.whop.api.resources.withdrawals.types.ListWithdrawalsResponse; +import com.whop.api.types.Withdrawal; +import com.whop.api.types.WithdrawalListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawWithdrawalsClient { + protected final ClientOptions clientOptions; + + public AsyncRawWithdrawalsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of withdrawals for a company, with optional sorting and date filtering. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public CompletableFuture>> list( + ListWithdrawalsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of withdrawals for a company, with optional sorting and date filtering. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public CompletableFuture>> list( + ListWithdrawalsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("withdrawals"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListWithdrawalsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListWithdrawalsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ListWithdrawalsRequest nextRequest = ListWithdrawalsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates a withdrawal request for a ledger account + *

Required permissions:

+ *
    + *
  • payout:withdraw_funds
  • + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture> create(CreateWithdrawalsRequest request) { + return create(request, null); + } + + /** + * Creates a withdrawal request for a ledger account + *

Required permissions:

+ *
    + *
  • payout:withdraw_funds
  • + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture> create( + CreateWithdrawalsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("withdrawals"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Withdrawal.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture> retrieve(String id) { + return retrieve(id, RetrieveWithdrawalsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveWithdrawalsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture> retrieve(String id, RetrieveWithdrawalsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture> retrieve( + String id, RetrieveWithdrawalsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("withdrawals") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Withdrawal.class), response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public CompletableFuture> generatePdf(String id) { + return generatePdf(id, GeneratePdfWithdrawalsRequest.builder().build()); + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public CompletableFuture> generatePdf( + String id, RequestOptions requestOptions) { + return generatePdf(id, GeneratePdfWithdrawalsRequest.builder().build(), requestOptions); + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public CompletableFuture> generatePdf( + String id, GeneratePdfWithdrawalsRequest request) { + return generatePdf(id, request, null); + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public CompletableFuture> generatePdf( + String id, GeneratePdfWithdrawalsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("withdrawals") + .addPathSegment(id) + .addPathSegments("generate_pdf"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GeneratePdfWithdrawalsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new WhopApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/whop/api/resources/withdrawals/AsyncWithdrawalsClient.java b/src/main/java/com/whop/api/resources/withdrawals/AsyncWithdrawalsClient.java new file mode 100644 index 00000000..69f6fef9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/withdrawals/AsyncWithdrawalsClient.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.withdrawals; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.withdrawals.requests.CreateWithdrawalsRequest; +import com.whop.api.resources.withdrawals.requests.GeneratePdfWithdrawalsRequest; +import com.whop.api.resources.withdrawals.requests.ListWithdrawalsRequest; +import com.whop.api.resources.withdrawals.requests.RetrieveWithdrawalsRequest; +import com.whop.api.resources.withdrawals.types.GeneratePdfWithdrawalsResponse; +import com.whop.api.types.Withdrawal; +import com.whop.api.types.WithdrawalListItem; +import java.util.concurrent.CompletableFuture; + +public class AsyncWithdrawalsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawWithdrawalsClient rawClient; + + public AsyncWithdrawalsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawWithdrawalsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawWithdrawalsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of withdrawals for a company, with optional sorting and date filtering. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public CompletableFuture> list(ListWithdrawalsRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns a paginated list of withdrawals for a company, with optional sorting and date filtering. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public CompletableFuture> list( + ListWithdrawalsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates a withdrawal request for a ledger account + *

Required permissions:

+ *
    + *
  • payout:withdraw_funds
  • + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture create(CreateWithdrawalsRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + /** + * Creates a withdrawal request for a ledger account + *

Required permissions:

+ *
    + *
  • payout:withdraw_funds
  • + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture create(CreateWithdrawalsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture retrieve(String id, RetrieveWithdrawalsRequest request) { + return this.rawClient.retrieve(id, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public CompletableFuture retrieve( + String id, RetrieveWithdrawalsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public CompletableFuture generatePdf(String id) { + return this.rawClient.generatePdf(id).thenApply(response -> response.body()); + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public CompletableFuture generatePdf(String id, RequestOptions requestOptions) { + return this.rawClient.generatePdf(id, requestOptions).thenApply(response -> response.body()); + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public CompletableFuture generatePdf( + String id, GeneratePdfWithdrawalsRequest request) { + return this.rawClient.generatePdf(id, request).thenApply(response -> response.body()); + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public CompletableFuture generatePdf( + String id, GeneratePdfWithdrawalsRequest request, RequestOptions requestOptions) { + return this.rawClient.generatePdf(id, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/whop/api/resources/withdrawals/RawWithdrawalsClient.java b/src/main/java/com/whop/api/resources/withdrawals/RawWithdrawalsClient.java new file mode 100644 index 00000000..244cd9f1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/withdrawals/RawWithdrawalsClient.java @@ -0,0 +1,470 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.withdrawals; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.whop.api.core.ClientOptions; +import com.whop.api.core.MediaTypes; +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.QueryStringMapper; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.WhopApiApiException; +import com.whop.api.core.WhopApiException; +import com.whop.api.core.WhopApiHttpResponse; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.errors.BadRequestError; +import com.whop.api.errors.ForbiddenError; +import com.whop.api.errors.InternalServerError; +import com.whop.api.errors.NotFoundError; +import com.whop.api.errors.TooManyRequestsError; +import com.whop.api.errors.UnauthorizedError; +import com.whop.api.errors.UnprocessableEntityError; +import com.whop.api.resources.withdrawals.requests.CreateWithdrawalsRequest; +import com.whop.api.resources.withdrawals.requests.GeneratePdfWithdrawalsRequest; +import com.whop.api.resources.withdrawals.requests.ListWithdrawalsRequest; +import com.whop.api.resources.withdrawals.requests.RetrieveWithdrawalsRequest; +import com.whop.api.resources.withdrawals.types.GeneratePdfWithdrawalsResponse; +import com.whop.api.resources.withdrawals.types.ListWithdrawalsResponse; +import com.whop.api.types.Withdrawal; +import com.whop.api.types.WithdrawalListItem; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawWithdrawalsClient { + protected final ClientOptions clientOptions; + + public RawWithdrawalsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns a paginated list of withdrawals for a company, with optional sorting and date filtering. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public WhopApiHttpResponse> list(ListWithdrawalsRequest request) { + return list(request, null); + } + + /** + * Returns a paginated list of withdrawals for a company, with optional sorting and date filtering. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public WhopApiHttpResponse> list( + ListWithdrawalsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("withdrawals"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getFirst().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "first", request.getFirst().get(), false); + } + if (request.getLast().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "last", request.getLast().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "direction", request.getDirection().get(), false); + } + if (request.getCreatedBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_before", request.getCreatedBefore().get(), false); + } + if (request.getCreatedAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "created_after", request.getCreatedAfter().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + ListWithdrawalsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListWithdrawalsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ListWithdrawalsRequest nextRequest = ListWithdrawalsRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new WhopApiHttpResponse<>( + new SyncPagingIterable( + startingAfter != null, result, parsedResponse, () -> list(nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates a withdrawal request for a ledger account + *

Required permissions:

+ *
    + *
  • payout:withdraw_funds
  • + *
  • payout:destination:read
  • + *
+ */ + public WhopApiHttpResponse create(CreateWithdrawalsRequest request) { + return create(request, null); + } + + /** + * Creates a withdrawal request for a ledger account + *

Required permissions:

+ *
    + *
  • payout:withdraw_funds
  • + *
  • payout:destination:read
  • + *
+ */ + public WhopApiHttpResponse create(CreateWithdrawalsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("withdrawals"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new WhopApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Withdrawal.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id) { + return retrieve(id, RetrieveWithdrawalsRequest.builder().build()); + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + return retrieve(id, RetrieveWithdrawalsRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public WhopApiHttpResponse retrieve(String id, RetrieveWithdrawalsRequest request) { + return retrieve(id, request, null); + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public WhopApiHttpResponse retrieve( + String id, RetrieveWithdrawalsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("withdrawals") + .addPathSegment(id); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Withdrawal.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public WhopApiHttpResponse generatePdf(String id) { + return generatePdf(id, GeneratePdfWithdrawalsRequest.builder().build()); + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public WhopApiHttpResponse generatePdf(String id, RequestOptions requestOptions) { + return generatePdf(id, GeneratePdfWithdrawalsRequest.builder().build(), requestOptions); + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public WhopApiHttpResponse generatePdf( + String id, GeneratePdfWithdrawalsRequest request) { + return generatePdf(id, request, null); + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public WhopApiHttpResponse generatePdf( + String id, GeneratePdfWithdrawalsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("withdrawals") + .addPathSegment(id) + .addPathSegments("generate_pdf"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new WhopApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GeneratePdfWithdrawalsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new WhopApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new WhopApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/whop/api/resources/withdrawals/WithdrawalsClient.java b/src/main/java/com/whop/api/resources/withdrawals/WithdrawalsClient.java new file mode 100644 index 00000000..d1cab648 --- /dev/null +++ b/src/main/java/com/whop/api/resources/withdrawals/WithdrawalsClient.java @@ -0,0 +1,172 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.withdrawals; + +import com.whop.api.core.ClientOptions; +import com.whop.api.core.RequestOptions; +import com.whop.api.core.pagination.SyncPagingIterable; +import com.whop.api.resources.withdrawals.requests.CreateWithdrawalsRequest; +import com.whop.api.resources.withdrawals.requests.GeneratePdfWithdrawalsRequest; +import com.whop.api.resources.withdrawals.requests.ListWithdrawalsRequest; +import com.whop.api.resources.withdrawals.requests.RetrieveWithdrawalsRequest; +import com.whop.api.resources.withdrawals.types.GeneratePdfWithdrawalsResponse; +import com.whop.api.types.Withdrawal; +import com.whop.api.types.WithdrawalListItem; + +public class WithdrawalsClient { + protected final ClientOptions clientOptions; + + private final RawWithdrawalsClient rawClient; + + public WithdrawalsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawWithdrawalsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawWithdrawalsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns a paginated list of withdrawals for a company, with optional sorting and date filtering. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public SyncPagingIterable list(ListWithdrawalsRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns a paginated list of withdrawals for a company, with optional sorting and date filtering. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public SyncPagingIterable list(ListWithdrawalsRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Creates a withdrawal request for a ledger account + *

Required permissions:

+ *
    + *
  • payout:withdraw_funds
  • + *
  • payout:destination:read
  • + *
+ */ + public Withdrawal create(CreateWithdrawalsRequest request) { + return this.rawClient.create(request).body(); + } + + /** + * Creates a withdrawal request for a ledger account + *

Required permissions:

+ *
    + *
  • payout:withdraw_funds
  • + *
  • payout:destination:read
  • + *
+ */ + public Withdrawal create(CreateWithdrawalsRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public Withdrawal retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public Withdrawal retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public Withdrawal retrieve(String id, RetrieveWithdrawalsRequest request) { + return this.rawClient.retrieve(id, request).body(); + } + + /** + * Retrieves the details of an existing withdrawal. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
  • payout:destination:read
  • + *
+ */ + public Withdrawal retrieve(String id, RetrieveWithdrawalsRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, request, requestOptions).body(); + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public GeneratePdfWithdrawalsResponse generatePdf(String id) { + return this.rawClient.generatePdf(id).body(); + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public GeneratePdfWithdrawalsResponse generatePdf(String id, RequestOptions requestOptions) { + return this.rawClient.generatePdf(id, requestOptions).body(); + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public GeneratePdfWithdrawalsResponse generatePdf(String id, GeneratePdfWithdrawalsRequest request) { + return this.rawClient.generatePdf(id, request).body(); + } + + /** + * Generates a withdrawal PDF invoice and returns a temporary download URL. + *

Required permissions:

+ *
    + *
  • payout:withdrawal:read
  • + *
+ */ + public GeneratePdfWithdrawalsResponse generatePdf( + String id, GeneratePdfWithdrawalsRequest request, RequestOptions requestOptions) { + return this.rawClient.generatePdf(id, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/whop/api/resources/withdrawals/requests/CreateWithdrawalsRequest.java b/src/main/java/com/whop/api/resources/withdrawals/requests/CreateWithdrawalsRequest.java new file mode 100644 index 00000000..98af7275 --- /dev/null +++ b/src/main/java/com/whop/api/resources/withdrawals/requests/CreateWithdrawalsRequest.java @@ -0,0 +1,647 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.withdrawals.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Currencies; +import com.whop.api.types.WithdrawalSpeeds; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateWithdrawalsRequest.Builder.class) +public final class CreateWithdrawalsRequest { + private final Optional acknowledgeBankWarning; + + private final double amount; + + private final String companyId; + + private final Currencies currency; + + private final Optional idempotencyKey; + + private final Optional payoutMethodId; + + private final Optional platformCoversFees; + + private final Optional speed; + + private final Optional statementDescriptor; + + private final Map additionalProperties; + + private CreateWithdrawalsRequest( + Optional acknowledgeBankWarning, + double amount, + String companyId, + Currencies currency, + Optional idempotencyKey, + Optional payoutMethodId, + Optional platformCoversFees, + Optional speed, + Optional statementDescriptor, + Map additionalProperties) { + this.acknowledgeBankWarning = acknowledgeBankWarning; + this.amount = amount; + this.companyId = companyId; + this.currency = currency; + this.idempotencyKey = idempotencyKey; + this.payoutMethodId = payoutMethodId; + this.platformCoversFees = platformCoversFees; + this.speed = speed; + this.statementDescriptor = statementDescriptor; + this.additionalProperties = additionalProperties; + } + + /** + * @return Set to true to continue when the bank could not confirm the account holder's name, or false to be refused in that case so the creator can fix the account or link their bank first. Omitting the argument skips the warning gate — a client that cannot show the warning keeps its pre-gate behavior. + */ + @JsonIgnore + public Optional getAcknowledgeBankWarning() { + if (acknowledgeBankWarning == null) { + return Optional.empty(); + } + return acknowledgeBankWarning; + } + + /** + * @return The amount to withdraw in the specified currency + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The ID of the company to withdraw from. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return The currency that is being withdrawn. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return A client-generated key that makes retries safe. Retrying with the same key returns the original withdrawal instead of creating a second one. + */ + @JsonIgnore + public Optional getIdempotencyKey() { + if (idempotencyKey == null) { + return Optional.empty(); + } + return idempotencyKey; + } + + /** + * @return The ID of the payout method to use for the withdrawal. + */ + @JsonIgnore + public Optional getPayoutMethodId() { + if (payoutMethodId == null) { + return Optional.empty(); + } + return payoutMethodId; + } + + /** + * @return Whether the platform covers the payout fees. + */ + @JsonIgnore + public Optional getPlatformCoversFees() { + if (platformCoversFees == null) { + return Optional.empty(); + } + return platformCoversFees; + } + + /** + * @return The processing speed for the withdrawal. Either standard or instant. + */ + @JsonIgnore + public Optional getSpeed() { + if (speed == null) { + return Optional.empty(); + } + return speed; + } + + /** + * @return Custom statement descriptor for the withdrawal. Must be between 5 and 22 characters and contain only alphanumeric characters. + */ + @JsonIgnore + public Optional getStatementDescriptor() { + if (statementDescriptor == null) { + return Optional.empty(); + } + return statementDescriptor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("acknowledge_bank_warning") + private Optional _getAcknowledgeBankWarning() { + return acknowledgeBankWarning; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("idempotency_key") + private Optional _getIdempotencyKey() { + return idempotencyKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_method_id") + private Optional _getPayoutMethodId() { + return payoutMethodId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("platform_covers_fees") + private Optional _getPlatformCoversFees() { + return platformCoversFees; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("speed") + private Optional _getSpeed() { + return speed; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("statement_descriptor") + private Optional _getStatementDescriptor() { + return statementDescriptor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateWithdrawalsRequest && equalTo((CreateWithdrawalsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateWithdrawalsRequest other) { + return acknowledgeBankWarning.equals(other.acknowledgeBankWarning) + && amount == other.amount + && companyId.equals(other.companyId) + && currency.equals(other.currency) + && idempotencyKey.equals(other.idempotencyKey) + && payoutMethodId.equals(other.payoutMethodId) + && platformCoversFees.equals(other.platformCoversFees) + && speed.equals(other.speed) + && statementDescriptor.equals(other.statementDescriptor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.acknowledgeBankWarning, + this.amount, + this.companyId, + this.currency, + this.idempotencyKey, + this.payoutMethodId, + this.platformCoversFees, + this.speed, + this.statementDescriptor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The amount to withdraw in the specified currency

+ */ + CompanyIdStage amount(double amount); + + Builder from(CreateWithdrawalsRequest other); + } + + public interface CompanyIdStage { + /** + *

The ID of the company to withdraw from.

+ */ + CurrencyStage companyId(@NotNull String companyId); + } + + public interface CurrencyStage { + /** + *

The currency that is being withdrawn.

+ */ + _FinalStage currency(@NotNull Currencies currency); + } + + public interface _FinalStage { + CreateWithdrawalsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Set to true to continue when the bank could not confirm the account holder's name, or false to be refused in that case so the creator can fix the account or link their bank first. Omitting the argument skips the warning gate — a client that cannot show the warning keeps its pre-gate behavior.

+ */ + _FinalStage acknowledgeBankWarning(Optional acknowledgeBankWarning); + + _FinalStage acknowledgeBankWarning(Boolean acknowledgeBankWarning); + + _FinalStage acknowledgeBankWarning(Nullable acknowledgeBankWarning); + + /** + *

A client-generated key that makes retries safe. Retrying with the same key returns the original withdrawal instead of creating a second one.

+ */ + _FinalStage idempotencyKey(Optional idempotencyKey); + + _FinalStage idempotencyKey(String idempotencyKey); + + _FinalStage idempotencyKey(Nullable idempotencyKey); + + /** + *

The ID of the payout method to use for the withdrawal.

+ */ + _FinalStage payoutMethodId(Optional payoutMethodId); + + _FinalStage payoutMethodId(String payoutMethodId); + + _FinalStage payoutMethodId(Nullable payoutMethodId); + + /** + *

Whether the platform covers the payout fees.

+ */ + _FinalStage platformCoversFees(Optional platformCoversFees); + + _FinalStage platformCoversFees(Boolean platformCoversFees); + + _FinalStage platformCoversFees(Nullable platformCoversFees); + + /** + *

The processing speed for the withdrawal. Either standard or instant.

+ */ + _FinalStage speed(Optional speed); + + _FinalStage speed(WithdrawalSpeeds speed); + + _FinalStage speed(Nullable speed); + + /** + *

Custom statement descriptor for the withdrawal. Must be between 5 and 22 characters and contain only alphanumeric characters.

+ */ + _FinalStage statementDescriptor(Optional statementDescriptor); + + _FinalStage statementDescriptor(String statementDescriptor); + + _FinalStage statementDescriptor(Nullable statementDescriptor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, CompanyIdStage, CurrencyStage, _FinalStage { + private double amount; + + private String companyId; + + private Currencies currency; + + private Optional statementDescriptor = Optional.empty(); + + private Optional speed = Optional.empty(); + + private Optional platformCoversFees = Optional.empty(); + + private Optional payoutMethodId = Optional.empty(); + + private Optional idempotencyKey = Optional.empty(); + + private Optional acknowledgeBankWarning = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateWithdrawalsRequest other) { + acknowledgeBankWarning(other.getAcknowledgeBankWarning()); + amount(other.getAmount()); + companyId(other.getCompanyId()); + currency(other.getCurrency()); + idempotencyKey(other.getIdempotencyKey()); + payoutMethodId(other.getPayoutMethodId()); + platformCoversFees(other.getPlatformCoversFees()); + speed(other.getSpeed()); + statementDescriptor(other.getStatementDescriptor()); + return this; + } + + /** + *

The amount to withdraw in the specified currency

+ *

The amount to withdraw in the specified currency

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CompanyIdStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The ID of the company to withdraw from.

+ *

The ID of the company to withdraw from.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public CurrencyStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The currency that is being withdrawn.

+ *

The currency that is being withdrawn.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Custom statement descriptor for the withdrawal. Must be between 5 and 22 characters and contain only alphanumeric characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statementDescriptor(Nullable statementDescriptor) { + if (statementDescriptor.isNull()) { + this.statementDescriptor = null; + } else if (statementDescriptor.isEmpty()) { + this.statementDescriptor = Optional.empty(); + } else { + this.statementDescriptor = Optional.of(statementDescriptor.get()); + } + return this; + } + + /** + *

Custom statement descriptor for the withdrawal. Must be between 5 and 22 characters and contain only alphanumeric characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statementDescriptor(String statementDescriptor) { + this.statementDescriptor = Optional.ofNullable(statementDescriptor); + return this; + } + + /** + *

Custom statement descriptor for the withdrawal. Must be between 5 and 22 characters and contain only alphanumeric characters.

+ */ + @java.lang.Override + @JsonSetter(value = "statement_descriptor", nulls = Nulls.SKIP) + public _FinalStage statementDescriptor(Optional statementDescriptor) { + this.statementDescriptor = statementDescriptor; + return this; + } + + /** + *

The processing speed for the withdrawal. Either standard or instant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage speed(Nullable speed) { + if (speed.isNull()) { + this.speed = null; + } else if (speed.isEmpty()) { + this.speed = Optional.empty(); + } else { + this.speed = Optional.of(speed.get()); + } + return this; + } + + /** + *

The processing speed for the withdrawal. Either standard or instant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage speed(WithdrawalSpeeds speed) { + this.speed = Optional.ofNullable(speed); + return this; + } + + /** + *

The processing speed for the withdrawal. Either standard or instant.

+ */ + @java.lang.Override + @JsonSetter(value = "speed", nulls = Nulls.SKIP) + public _FinalStage speed(Optional speed) { + this.speed = speed; + return this; + } + + /** + *

Whether the platform covers the payout fees.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage platformCoversFees(Nullable platformCoversFees) { + if (platformCoversFees.isNull()) { + this.platformCoversFees = null; + } else if (platformCoversFees.isEmpty()) { + this.platformCoversFees = Optional.empty(); + } else { + this.platformCoversFees = Optional.of(platformCoversFees.get()); + } + return this; + } + + /** + *

Whether the platform covers the payout fees.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage platformCoversFees(Boolean platformCoversFees) { + this.platformCoversFees = Optional.ofNullable(platformCoversFees); + return this; + } + + /** + *

Whether the platform covers the payout fees.

+ */ + @java.lang.Override + @JsonSetter(value = "platform_covers_fees", nulls = Nulls.SKIP) + public _FinalStage platformCoversFees(Optional platformCoversFees) { + this.platformCoversFees = platformCoversFees; + return this; + } + + /** + *

The ID of the payout method to use for the withdrawal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutMethodId(Nullable payoutMethodId) { + if (payoutMethodId.isNull()) { + this.payoutMethodId = null; + } else if (payoutMethodId.isEmpty()) { + this.payoutMethodId = Optional.empty(); + } else { + this.payoutMethodId = Optional.of(payoutMethodId.get()); + } + return this; + } + + /** + *

The ID of the payout method to use for the withdrawal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutMethodId(String payoutMethodId) { + this.payoutMethodId = Optional.ofNullable(payoutMethodId); + return this; + } + + /** + *

The ID of the payout method to use for the withdrawal.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_method_id", nulls = Nulls.SKIP) + public _FinalStage payoutMethodId(Optional payoutMethodId) { + this.payoutMethodId = payoutMethodId; + return this; + } + + /** + *

A client-generated key that makes retries safe. Retrying with the same key returns the original withdrawal instead of creating a second one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage idempotencyKey(Nullable idempotencyKey) { + if (idempotencyKey.isNull()) { + this.idempotencyKey = null; + } else if (idempotencyKey.isEmpty()) { + this.idempotencyKey = Optional.empty(); + } else { + this.idempotencyKey = Optional.of(idempotencyKey.get()); + } + return this; + } + + /** + *

A client-generated key that makes retries safe. Retrying with the same key returns the original withdrawal instead of creating a second one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage idempotencyKey(String idempotencyKey) { + this.idempotencyKey = Optional.ofNullable(idempotencyKey); + return this; + } + + /** + *

A client-generated key that makes retries safe. Retrying with the same key returns the original withdrawal instead of creating a second one.

+ */ + @java.lang.Override + @JsonSetter(value = "idempotency_key", nulls = Nulls.SKIP) + public _FinalStage idempotencyKey(Optional idempotencyKey) { + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + *

Set to true to continue when the bank could not confirm the account holder's name, or false to be refused in that case so the creator can fix the account or link their bank first. Omitting the argument skips the warning gate — a client that cannot show the warning keeps its pre-gate behavior.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage acknowledgeBankWarning(Nullable acknowledgeBankWarning) { + if (acknowledgeBankWarning.isNull()) { + this.acknowledgeBankWarning = null; + } else if (acknowledgeBankWarning.isEmpty()) { + this.acknowledgeBankWarning = Optional.empty(); + } else { + this.acknowledgeBankWarning = Optional.of(acknowledgeBankWarning.get()); + } + return this; + } + + /** + *

Set to true to continue when the bank could not confirm the account holder's name, or false to be refused in that case so the creator can fix the account or link their bank first. Omitting the argument skips the warning gate — a client that cannot show the warning keeps its pre-gate behavior.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage acknowledgeBankWarning(Boolean acknowledgeBankWarning) { + this.acknowledgeBankWarning = Optional.ofNullable(acknowledgeBankWarning); + return this; + } + + /** + *

Set to true to continue when the bank could not confirm the account holder's name, or false to be refused in that case so the creator can fix the account or link their bank first. Omitting the argument skips the warning gate — a client that cannot show the warning keeps its pre-gate behavior.

+ */ + @java.lang.Override + @JsonSetter(value = "acknowledge_bank_warning", nulls = Nulls.SKIP) + public _FinalStage acknowledgeBankWarning(Optional acknowledgeBankWarning) { + this.acknowledgeBankWarning = acknowledgeBankWarning; + return this; + } + + @java.lang.Override + public CreateWithdrawalsRequest build() { + return new CreateWithdrawalsRequest( + acknowledgeBankWarning, + amount, + companyId, + currency, + idempotencyKey, + payoutMethodId, + platformCoversFees, + speed, + statementDescriptor, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/withdrawals/requests/GeneratePdfWithdrawalsRequest.java b/src/main/java/com/whop/api/resources/withdrawals/requests/GeneratePdfWithdrawalsRequest.java new file mode 100644 index 00000000..d11cf7e2 --- /dev/null +++ b/src/main/java/com/whop/api/resources/withdrawals/requests/GeneratePdfWithdrawalsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.withdrawals.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GeneratePdfWithdrawalsRequest.Builder.class) +public final class GeneratePdfWithdrawalsRequest { + private final Map additionalProperties; + + private GeneratePdfWithdrawalsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GeneratePdfWithdrawalsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GeneratePdfWithdrawalsRequest other) { + return this; + } + + public GeneratePdfWithdrawalsRequest build() { + return new GeneratePdfWithdrawalsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/withdrawals/requests/ListWithdrawalsRequest.java b/src/main/java/com/whop/api/resources/withdrawals/requests/ListWithdrawalsRequest.java new file mode 100644 index 00000000..24dc2242 --- /dev/null +++ b/src/main/java/com/whop/api/resources/withdrawals/requests/ListWithdrawalsRequest.java @@ -0,0 +1,440 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.withdrawals.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.Direction; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListWithdrawalsRequest.Builder.class) +public final class ListWithdrawalsRequest { + private final Optional after; + + private final Optional before; + + private final Optional first; + + private final Optional last; + + private final String companyId; + + private final Optional direction; + + private final Optional createdBefore; + + private final Optional createdAfter; + + private final Map additionalProperties; + + private ListWithdrawalsRequest( + Optional after, + Optional before, + Optional first, + Optional last, + String companyId, + Optional direction, + Optional createdBefore, + Optional createdAfter, + Map additionalProperties) { + this.after = after; + this.before = before; + this.first = first; + this.last = last; + this.companyId = companyId; + this.direction = direction; + this.createdBefore = createdBefore; + this.createdAfter = createdAfter; + this.additionalProperties = additionalProperties; + } + + /** + * @return

the elements in the list that come after the specified cursor.

+ */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return

the elements in the list that come before the specified cursor.

+ */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return

the first n elements from the list.

+ */ + @JsonProperty("first") + public Optional getFirst() { + return first; + } + + /** + * @return

the last n elements from the list.

+ */ + @JsonProperty("last") + public Optional getLast() { + return last; + } + + /** + * @return The unique identifier of the company to list withdrawals for. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @JsonProperty("direction") + public Optional getDirection() { + return direction; + } + + /** + * @return Only return withdrawals created before this timestamp. + */ + @JsonProperty("created_before") + public Optional getCreatedBefore() { + return createdBefore; + } + + /** + * @return Only return withdrawals created after this timestamp. + */ + @JsonProperty("created_after") + public Optional getCreatedAfter() { + return createdAfter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListWithdrawalsRequest && equalTo((ListWithdrawalsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListWithdrawalsRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && first.equals(other.first) + && last.equals(other.last) + && companyId.equals(other.companyId) + && direction.equals(other.direction) + && createdBefore.equals(other.createdBefore) + && createdAfter.equals(other.createdAfter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.after, + this.before, + this.first, + this.last, + this.companyId, + this.direction, + this.createdBefore, + this.createdAfter); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The unique identifier of the company to list withdrawals for.

+ */ + _FinalStage companyId(@NotNull String companyId); + + Builder from(ListWithdrawalsRequest other); + } + + public interface _FinalStage { + ListWithdrawalsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

Returns the first n elements from the list.

+ */ + _FinalStage first(Optional first); + + _FinalStage first(Integer first); + + /** + *

Returns the last n elements from the list.

+ */ + _FinalStage last(Optional last); + + _FinalStage last(Integer last); + + _FinalStage direction(Optional direction); + + _FinalStage direction(Direction direction); + + /** + *

Only return withdrawals created before this timestamp.

+ */ + _FinalStage createdBefore(Optional createdBefore); + + _FinalStage createdBefore(OffsetDateTime createdBefore); + + /** + *

Only return withdrawals created after this timestamp.

+ */ + _FinalStage createdAfter(Optional createdAfter); + + _FinalStage createdAfter(OffsetDateTime createdAfter); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional createdAfter = Optional.empty(); + + private Optional createdBefore = Optional.empty(); + + private Optional direction = Optional.empty(); + + private Optional last = Optional.empty(); + + private Optional first = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListWithdrawalsRequest other) { + after(other.getAfter()); + before(other.getBefore()); + first(other.getFirst()); + last(other.getLast()); + companyId(other.getCompanyId()); + direction(other.getDirection()); + createdBefore(other.getCreatedBefore()); + createdAfter(other.getCreatedAfter()); + return this; + } + + /** + *

The unique identifier of the company to list withdrawals for.

+ *

The unique identifier of the company to list withdrawals for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

Only return withdrawals created after this timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAfter(OffsetDateTime createdAfter) { + this.createdAfter = Optional.ofNullable(createdAfter); + return this; + } + + /** + *

Only return withdrawals created after this timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_after", nulls = Nulls.SKIP) + public _FinalStage createdAfter(Optional createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + /** + *

Only return withdrawals created before this timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdBefore(OffsetDateTime createdBefore) { + this.createdBefore = Optional.ofNullable(createdBefore); + return this; + } + + /** + *

Only return withdrawals created before this timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_before", nulls = Nulls.SKIP) + public _FinalStage createdBefore(Optional createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + @java.lang.Override + public _FinalStage direction(Direction direction) { + this.direction = Optional.ofNullable(direction); + return this; + } + + @java.lang.Override + @JsonSetter(value = "direction", nulls = Nulls.SKIP) + public _FinalStage direction(Optional direction) { + this.direction = direction; + return this; + } + + /** + *

Returns the last n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last(Integer last) { + this.last = Optional.ofNullable(last); + return this; + } + + /** + *

Returns the last n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "last", nulls = Nulls.SKIP) + public _FinalStage last(Optional last) { + this.last = last; + return this; + } + + /** + *

Returns the first n elements from the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage first(Integer first) { + this.first = Optional.ofNullable(first); + return this; + } + + /** + *

Returns the first n elements from the list.

+ */ + @java.lang.Override + @JsonSetter(value = "first", nulls = Nulls.SKIP) + public _FinalStage first(Optional first) { + this.first = first; + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

Returns the elements in the list that come before the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

Returns the elements in the list that come after the specified cursor.

+ */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public ListWithdrawalsRequest build() { + return new ListWithdrawalsRequest( + after, + before, + first, + last, + companyId, + direction, + createdBefore, + createdAfter, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/withdrawals/requests/RetrieveWithdrawalsRequest.java b/src/main/java/com/whop/api/resources/withdrawals/requests/RetrieveWithdrawalsRequest.java new file mode 100644 index 00000000..af188ae9 --- /dev/null +++ b/src/main/java/com/whop/api/resources/withdrawals/requests/RetrieveWithdrawalsRequest.java @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.withdrawals.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetrieveWithdrawalsRequest.Builder.class) +public final class RetrieveWithdrawalsRequest { + private final Map additionalProperties; + + private RetrieveWithdrawalsRequest(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetrieveWithdrawalsRequest; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetrieveWithdrawalsRequest other) { + return this; + } + + public RetrieveWithdrawalsRequest build() { + return new RetrieveWithdrawalsRequest(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/withdrawals/types/GeneratePdfWithdrawalsResponse.java b/src/main/java/com/whop/api/resources/withdrawals/types/GeneratePdfWithdrawalsResponse.java new file mode 100644 index 00000000..33243677 --- /dev/null +++ b/src/main/java/com/whop/api/resources/withdrawals/types/GeneratePdfWithdrawalsResponse.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.withdrawals.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GeneratePdfWithdrawalsResponse.Builder.class) +public final class GeneratePdfWithdrawalsResponse { + private final OffsetDateTime expiresAt; + + private final String url; + + private final Map additionalProperties; + + private GeneratePdfWithdrawalsResponse( + OffsetDateTime expiresAt, String url, Map additionalProperties) { + this.expiresAt = expiresAt; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The timestamp after which the withdrawal PDF URL is no longer valid. + */ + @JsonProperty("expires_at") + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + /** + * @return The temporary URL for downloading the withdrawal PDF invoice. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GeneratePdfWithdrawalsResponse && equalTo((GeneratePdfWithdrawalsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GeneratePdfWithdrawalsResponse other) { + return expiresAt.equals(other.expiresAt) && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.expiresAt, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExpiresAtStage builder() { + return new Builder(); + } + + public interface ExpiresAtStage { + /** + *

The timestamp after which the withdrawal PDF URL is no longer valid.

+ */ + UrlStage expiresAt(@NotNull OffsetDateTime expiresAt); + + Builder from(GeneratePdfWithdrawalsResponse other); + } + + public interface UrlStage { + /** + *

The temporary URL for downloading the withdrawal PDF invoice.

+ */ + _FinalStage url(@NotNull String url); + } + + public interface _FinalStage { + GeneratePdfWithdrawalsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExpiresAtStage, UrlStage, _FinalStage { + private OffsetDateTime expiresAt; + + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GeneratePdfWithdrawalsResponse other) { + expiresAt(other.getExpiresAt()); + url(other.getUrl()); + return this; + } + + /** + *

The timestamp after which the withdrawal PDF URL is no longer valid.

+ *

The timestamp after which the withdrawal PDF URL is no longer valid.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("expires_at") + public UrlStage expiresAt(@NotNull OffsetDateTime expiresAt) { + this.expiresAt = Objects.requireNonNull(expiresAt, "expiresAt must not be null"); + return this; + } + + /** + *

The temporary URL for downloading the withdrawal PDF invoice.

+ *

The temporary URL for downloading the withdrawal PDF invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public GeneratePdfWithdrawalsResponse build() { + return new GeneratePdfWithdrawalsResponse(expiresAt, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/resources/withdrawals/types/ListWithdrawalsResponse.java b/src/main/java/com/whop/api/resources/withdrawals/types/ListWithdrawalsResponse.java new file mode 100644 index 00000000..cfac1ab1 --- /dev/null +++ b/src/main/java/com/whop/api/resources/withdrawals/types/ListWithdrawalsResponse.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.resources.withdrawals.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import com.whop.api.types.PageInfo; +import com.whop.api.types.WithdrawalListItem; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListWithdrawalsResponse.Builder.class) +public final class ListWithdrawalsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListWithdrawalsResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of nodes. + */ + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Information to aid in pagination. + */ + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListWithdrawalsResponse && equalTo((ListWithdrawalsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListWithdrawalsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + /** + *

Information to aid in pagination.

+ */ + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListWithdrawalsResponse other); + } + + public interface _FinalStage { + ListWithdrawalsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of nodes.

+ */ + _FinalStage data(List data); + + _FinalStage addData(WithdrawalListItem data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListWithdrawalsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + /** + *

Information to aid in pagination.

+ *

Information to aid in pagination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + /** + *

A list of nodes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addData(WithdrawalListItem data) { + this.data.add(data); + return this; + } + + /** + *

A list of nodes.

+ */ + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListWithdrawalsResponse build() { + return new ListWithdrawalsResponse(data, pageInfo, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccessLevel.java b/src/main/java/com/whop/api/types/AccessLevel.java new file mode 100644 index 00000000..b9b27cb0 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccessLevel.java @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccessLevel { + public static final AccessLevel ADMIN = new AccessLevel(Value.ADMIN, "admin"); + + public static final AccessLevel CUSTOMER = new AccessLevel(Value.CUSTOMER, "customer"); + + public static final AccessLevel NO_ACCESS = new AccessLevel(Value.NO_ACCESS, "no_access"); + + private final Value value; + + private final String string; + + AccessLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof AccessLevel && this.string.equals(((AccessLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ADMIN: + return visitor.visitAdmin(); + case CUSTOMER: + return visitor.visitCustomer(); + case NO_ACCESS: + return visitor.visitNoAccess(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccessLevel valueOf(String value) { + switch (value) { + case "admin": + return ADMIN; + case "customer": + return CUSTOMER; + case "no_access": + return NO_ACCESS; + default: + return new AccessLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + NO_ACCESS, + + ADMIN, + + CUSTOMER, + + UNKNOWN + } + + public interface Visitor { + T visitNoAccess(); + + T visitAdmin(); + + T visitCustomer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccessPassOrder.java b/src/main/java/com/whop/api/types/AccessPassOrder.java new file mode 100644 index 00000000..370266a5 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccessPassOrder.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccessPassOrder { + public static final AccessPassOrder ACTIVE_MEMBERSHIPS_COUNT = + new AccessPassOrder(Value.ACTIVE_MEMBERSHIPS_COUNT, "active_memberships_count"); + + public static final AccessPassOrder USD_GMV = new AccessPassOrder(Value.USD_GMV, "usd_gmv"); + + public static final AccessPassOrder CREATED_AT = new AccessPassOrder(Value.CREATED_AT, "created_at"); + + public static final AccessPassOrder USD_GMV30DAYS = new AccessPassOrder(Value.USD_GMV30DAYS, "usd_gmv_30_days"); + + private final Value value; + + private final String string; + + AccessPassOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccessPassOrder && this.string.equals(((AccessPassOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ACTIVE_MEMBERSHIPS_COUNT: + return visitor.visitActiveMembershipsCount(); + case USD_GMV: + return visitor.visitUsdGmv(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case USD_GMV30DAYS: + return visitor.visitUsdGmv30Days(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccessPassOrder valueOf(String value) { + switch (value) { + case "active_memberships_count": + return ACTIVE_MEMBERSHIPS_COUNT; + case "usd_gmv": + return USD_GMV; + case "created_at": + return CREATED_AT; + case "usd_gmv_30_days": + return USD_GMV30DAYS; + default: + return new AccessPassOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE_MEMBERSHIPS_COUNT, + + CREATED_AT, + + USD_GMV, + + USD_GMV30DAYS, + + UNKNOWN + } + + public interface Visitor { + T visitActiveMembershipsCount(); + + T visitCreatedAt(); + + T visitUsdGmv(); + + T visitUsdGmv30Days(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccessPassTypes.java b/src/main/java/com/whop/api/types/AccessPassTypes.java new file mode 100644 index 00000000..14c9d23e --- /dev/null +++ b/src/main/java/com/whop/api/types/AccessPassTypes.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccessPassTypes { + public static final AccessPassTypes APP = new AccessPassTypes(Value.APP, "app"); + + public static final AccessPassTypes API_ONLY = new AccessPassTypes(Value.API_ONLY, "api_only"); + + public static final AccessPassTypes EXPERIENCE_UPSELL = + new AccessPassTypes(Value.EXPERIENCE_UPSELL, "experience_upsell"); + + public static final AccessPassTypes REGULAR = new AccessPassTypes(Value.REGULAR, "regular"); + + private final Value value; + + private final String string; + + AccessPassTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccessPassTypes && this.string.equals(((AccessPassTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APP: + return visitor.visitApp(); + case API_ONLY: + return visitor.visitApiOnly(); + case EXPERIENCE_UPSELL: + return visitor.visitExperienceUpsell(); + case REGULAR: + return visitor.visitRegular(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccessPassTypes valueOf(String value) { + switch (value) { + case "app": + return APP; + case "api_only": + return API_ONLY; + case "experience_upsell": + return EXPERIENCE_UPSELL; + case "regular": + return REGULAR; + default: + return new AccessPassTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + REGULAR, + + APP, + + EXPERIENCE_UPSELL, + + API_ONLY, + + UNKNOWN + } + + public interface Visitor { + T visitRegular(); + + T visitApp(); + + T visitExperienceUpsell(); + + T visitApiOnly(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccessToken.java b/src/main/java/com/whop/api/types/AccessToken.java new file mode 100644 index 00000000..008336d8 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccessToken.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccessToken.Builder.class) +public final class AccessToken { + private final OffsetDateTime expiresAt; + + private final String token; + + private final Map additionalProperties; + + private AccessToken(OffsetDateTime expiresAt, String token, Map additionalProperties) { + this.expiresAt = expiresAt; + this.token = token; + this.additionalProperties = additionalProperties; + } + + /** + * @return The timestamp after which this access token is no longer valid and must be refreshed. + */ + @JsonProperty("expires_at") + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + /** + * @return The signed JWT access token string to include in API request Authorization headers. + */ + @JsonProperty("token") + public String getToken() { + return token; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccessToken && equalTo((AccessToken) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccessToken other) { + return expiresAt.equals(other.expiresAt) && token.equals(other.token); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.expiresAt, this.token); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExpiresAtStage builder() { + return new Builder(); + } + + public interface ExpiresAtStage { + /** + *

The timestamp after which this access token is no longer valid and must be refreshed.

+ */ + TokenStage expiresAt(@NotNull OffsetDateTime expiresAt); + + Builder from(AccessToken other); + } + + public interface TokenStage { + /** + *

The signed JWT access token string to include in API request Authorization headers.

+ */ + _FinalStage token(@NotNull String token); + } + + public interface _FinalStage { + AccessToken build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExpiresAtStage, TokenStage, _FinalStage { + private OffsetDateTime expiresAt; + + private String token; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccessToken other) { + expiresAt(other.getExpiresAt()); + token(other.getToken()); + return this; + } + + /** + *

The timestamp after which this access token is no longer valid and must be refreshed.

+ *

The timestamp after which this access token is no longer valid and must be refreshed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("expires_at") + public TokenStage expiresAt(@NotNull OffsetDateTime expiresAt) { + this.expiresAt = Objects.requireNonNull(expiresAt, "expiresAt must not be null"); + return this; + } + + /** + *

The signed JWT access token string to include in API request Authorization headers.

+ *

The signed JWT access token string to include in API request Authorization headers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("token") + public _FinalStage token(@NotNull String token) { + this.token = Objects.requireNonNull(token, "token must not be null"); + return this; + } + + @java.lang.Override + public AccessToken build() { + return new AccessToken(expiresAt, token, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Account.java b/src/main/java/com/whop/api/types/Account.java new file mode 100644 index 00000000..12da4ed2 --- /dev/null +++ b/src/main/java/com/whop/api/types/Account.java @@ -0,0 +1,3422 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Account.Builder.class) +public final class Account { + private final List balances; + + private final Optional bannerImageUrl; + + private final Optional> businessAddress; + + private final Optional businessName; + + private final Optional businessType; + + private final boolean canTransferPendingBalanceToChildren; + + private final Optional capabilities; + + private final Optional cards; + + private final boolean collectVatId; + + private final AccountCompanyFormation companyFormation; + + private final Optional country; + + private final String createdAt; + + private final Optional description; + + private final Optional email; + + private final List homePreferences; + + private final String id; + + private final Optional industryGroup; + + private final Optional industryType; + + private final Optional invoicePrefix; + + private final Optional logoUrl; + + private final Map metadata; + + private final Optional onboardingType; + + private final Optional opengraphImageUrl; + + private final Optional opengraphImageVariant; + + private final Optional otherBusinessDescription; + + private final Optional otherIndustryDescription; + + private final UserSummary owner; + + private final Optional parentAccount; + + private final Optional paymentControls; + + private final Optional> productTaxCode; + + private final Optional> recommendedActions; + + private final boolean require2Fa; + + private final Optional> requiredActions; + + private final String route; + + private final boolean sendCustomerEmails; + + private final boolean showJoinedWhops; + + private final boolean showReviewsDtc; + + private final boolean showUserDirectory; + + private final List socialLinks; + + private final boolean stablecoinRails; + + private final Optional status; + + private final Optional statusReason; + + private final AccountStorePageConfig storePageConfig; + + private final Optional targetAudience; + + private final List taxCollectionEnabledStates; + + private final List taxIdentifiers; + + private final Optional taxRemittedBy; + + private final Optional taxType; + + private final Optional threeDsLevel; + + private final String title; + + private final Optional totalEarnedUsd; + + private final Optional totalUsd; + + private final boolean useLogoAsOpengraphImageFallback; + + private final Map verification; + + private final Optional volumeUsd; + + private final Optional wallet; + + private final Map additionalProperties; + + private Account( + List balances, + Optional bannerImageUrl, + Optional> businessAddress, + Optional businessName, + Optional businessType, + boolean canTransferPendingBalanceToChildren, + Optional capabilities, + Optional cards, + boolean collectVatId, + AccountCompanyFormation companyFormation, + Optional country, + String createdAt, + Optional description, + Optional email, + List homePreferences, + String id, + Optional industryGroup, + Optional industryType, + Optional invoicePrefix, + Optional logoUrl, + Map metadata, + Optional onboardingType, + Optional opengraphImageUrl, + Optional opengraphImageVariant, + Optional otherBusinessDescription, + Optional otherIndustryDescription, + UserSummary owner, + Optional parentAccount, + Optional paymentControls, + Optional> productTaxCode, + Optional> recommendedActions, + boolean require2Fa, + Optional> requiredActions, + String route, + boolean sendCustomerEmails, + boolean showJoinedWhops, + boolean showReviewsDtc, + boolean showUserDirectory, + List socialLinks, + boolean stablecoinRails, + Optional status, + Optional statusReason, + AccountStorePageConfig storePageConfig, + Optional targetAudience, + List taxCollectionEnabledStates, + List taxIdentifiers, + Optional taxRemittedBy, + Optional taxType, + Optional threeDsLevel, + String title, + Optional totalEarnedUsd, + Optional totalUsd, + boolean useLogoAsOpengraphImageFallback, + Map verification, + Optional volumeUsd, + Optional wallet, + Map additionalProperties) { + this.balances = balances; + this.bannerImageUrl = bannerImageUrl; + this.businessAddress = businessAddress; + this.businessName = businessName; + this.businessType = businessType; + this.canTransferPendingBalanceToChildren = canTransferPendingBalanceToChildren; + this.capabilities = capabilities; + this.cards = cards; + this.collectVatId = collectVatId; + this.companyFormation = companyFormation; + this.country = country; + this.createdAt = createdAt; + this.description = description; + this.email = email; + this.homePreferences = homePreferences; + this.id = id; + this.industryGroup = industryGroup; + this.industryType = industryType; + this.invoicePrefix = invoicePrefix; + this.logoUrl = logoUrl; + this.metadata = metadata; + this.onboardingType = onboardingType; + this.opengraphImageUrl = opengraphImageUrl; + this.opengraphImageVariant = opengraphImageVariant; + this.otherBusinessDescription = otherBusinessDescription; + this.otherIndustryDescription = otherIndustryDescription; + this.owner = owner; + this.parentAccount = parentAccount; + this.paymentControls = paymentControls; + this.productTaxCode = productTaxCode; + this.recommendedActions = recommendedActions; + this.require2Fa = require2Fa; + this.requiredActions = requiredActions; + this.route = route; + this.sendCustomerEmails = sendCustomerEmails; + this.showJoinedWhops = showJoinedWhops; + this.showReviewsDtc = showReviewsDtc; + this.showUserDirectory = showUserDirectory; + this.socialLinks = socialLinks; + this.stablecoinRails = stablecoinRails; + this.status = status; + this.statusReason = statusReason; + this.storePageConfig = storePageConfig; + this.targetAudience = targetAudience; + this.taxCollectionEnabledStates = taxCollectionEnabledStates; + this.taxIdentifiers = taxIdentifiers; + this.taxRemittedBy = taxRemittedBy; + this.taxType = taxType; + this.threeDsLevel = threeDsLevel; + this.title = title; + this.totalEarnedUsd = totalEarnedUsd; + this.totalUsd = totalUsd; + this.useLogoAsOpengraphImageFallback = useLogoAsOpengraphImageFallback; + this.verification = verification; + this.volumeUsd = volumeUsd; + this.wallet = wallet; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("balances") + public List getBalances() { + return balances; + } + + /** + * @return Account banner image URL. + */ + @JsonIgnore + public Optional getBannerImageUrl() { + if (bannerImageUrl == null) { + return Optional.empty(); + } + return bannerImageUrl; + } + + /** + * @return Account business address used to calculate tax, with line1, line2, city, state, postal_code, and country. null when no address is set. + */ + @JsonIgnore + public Optional> getBusinessAddress() { + if (businessAddress == null) { + return Optional.empty(); + } + return businessAddress; + } + + /** + * @return The account's legal business name used with its tax address. + */ + @JsonIgnore + public Optional getBusinessName() { + if (businessName == null) { + return Optional.empty(); + } + return businessName; + } + + /** + * @return High-level business category for the account. See the business types and industries glossary for valid values. + */ + @JsonIgnore + public Optional getBusinessType() { + if (businessType == null) { + return Optional.empty(); + } + return businessType; + } + + /** + * @return Whether pending funds may be transferred from this platform account to its connected accounts. + */ + @JsonProperty("can_transfer_pending_balance_to_children") + public boolean getCanTransferPendingBalanceToChildren() { + return canTransferPendingBalanceToChildren; + } + + /** + * @return Payment rails enabled for this account, each active, inactive, or pending (onboarding or review in progress). Computed only on retrieve and me for callers with company:balance:read scope; null otherwise. + */ + @JsonIgnore + public Optional getCapabilities() { + if (capabilities == null) { + return Optional.empty(); + } + return capabilities; + } + + /** + * @return Whop Cards application details for the account. Computed only on retrieve and me for callers with company:balance:read scope; null otherwise, or when the account has no card application. + */ + @JsonIgnore + public Optional getCards() { + if (cards == null) { + return Optional.empty(); + } + return cards; + } + + /** + * @return Whether checkout shows a VAT/tax ID field for buyers to optionally enter. Does not require a VAT ID to purchase. + */ + @JsonProperty("collect_vat_id") + public boolean getCollectVatId() { + return collectVatId; + } + + /** + * @return Company formation state for the account, managed through Form Company. A draft status until the formation checkout is paid, then filing progress with downloadable documents and signatures awaiting action. Empty when the formation state is temporarily unavailable. + */ + @JsonProperty("company_formation") + public AccountCompanyFormation getCompanyFormation() { + return companyFormation; + } + + /** + * @return Country where the account is located. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return When the account was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Account promotional description. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return Account owner email address. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + @JsonProperty("home_preferences") + public List getHomePreferences() { + return homePreferences; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account industry group. See the business types and industries glossary for valid values. + */ + @JsonIgnore + public Optional getIndustryGroup() { + if (industryGroup == null) { + return Optional.empty(); + } + return industryGroup; + } + + /** + * @return Specific industry vertical for the account. See the business types and industries glossary for valid values. + */ + @JsonIgnore + public Optional getIndustryType() { + if (industryType == null) { + return Optional.empty(); + } + return industryType; + } + + /** + * @return Prefix used for account invoices. + */ + @JsonIgnore + public Optional getInvoicePrefix() { + if (invoicePrefix == null) { + return Optional.empty(); + } + return invoicePrefix; + } + + /** + * @return Account logo image URL. + */ + @JsonIgnore + public Optional getLogoUrl() { + if (logoUrl == null) { + return Optional.empty(); + } + return logoUrl; + } + + /** + * @return Arbitrary key/value metadata supplied at account creation. + */ + @JsonProperty("metadata") + public Map getMetadata() { + return metadata; + } + + /** + * @return Type of onboarding the account has completed. + */ + @JsonIgnore + public Optional getOnboardingType() { + if (onboardingType == null) { + return Optional.empty(); + } + return onboardingType; + } + + /** + * @return Account Open Graph image URL. + */ + @JsonIgnore + public Optional getOpengraphImageUrl() { + if (opengraphImageUrl == null) { + return Optional.empty(); + } + return opengraphImageUrl; + } + + /** + * @return Account Open Graph image variant. + */ + @JsonIgnore + public Optional getOpengraphImageVariant() { + if (opengraphImageVariant == null) { + return Optional.empty(); + } + return opengraphImageVariant; + } + + /** + * @return Business type details when business_type is other. + */ + @JsonIgnore + public Optional getOtherBusinessDescription() { + if (otherBusinessDescription == null) { + return Optional.empty(); + } + return otherBusinessDescription; + } + + /** + * @return Industry details when industry_type is other. + */ + @JsonIgnore + public Optional getOtherIndustryDescription() { + if (otherIndustryDescription == null) { + return Optional.empty(); + } + return otherIndustryDescription; + } + + /** + * @return The single user who owns the account, whose email is the email above. Distinct from the owner role on team members, which any number of them can hold. + */ + @JsonProperty("owner") + public UserSummary getOwner() { + return owner; + } + + /** + * @return Parent account for connected accounts, or null for standalone accounts. + */ + @JsonIgnore + public Optional getParentAccount() { + if (parentAccount == null) { + return Optional.empty(); + } + return parentAccount; + } + + /** + * @return Payment health controls currently applied to the account. Computed only on retrieve and me for callers with company:balance:read scope; null otherwise. + */ + @JsonIgnore + public Optional getPaymentControls() { + if (paymentControls == null) { + return Optional.empty(); + } + return paymentControls; + } + + /** + * @return Tax classification code applied by default to the account's products, with id, name, and product_type. null when no default is set. + */ + @JsonIgnore + public Optional> getProductTaxCode() { + if (productTaxCode == null) { + return Optional.empty(); + } + return productTaxCode; + } + + /** + * @return DEPRECATED: Use the GET /recommended_actions?account_id={account_id} endpoint instead. + */ + @JsonIgnore + public Optional> getRecommendedActions() { + if (recommendedActions == null) { + return Optional.empty(); + } + return recommendedActions; + } + + /** + * @return Whether authorized users must enable two-factor authentication. + */ + @JsonProperty("require_2fa") + public boolean getRequire2Fa() { + return require2Fa; + } + + @JsonIgnore + public Optional> getRequiredActions() { + if (requiredActions == null) { + return Optional.empty(); + } + return requiredActions; + } + + /** + * @return Account public route identifier. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return Whether Whop sends transactional emails to customers on behalf of this account. + */ + @JsonProperty("send_customer_emails") + public boolean getSendCustomerEmails() { + return sendCustomerEmails; + } + + /** + * @return Whether the account appears in joined whops on other accounts. + */ + @JsonProperty("show_joined_whops") + public boolean getShowJoinedWhops() { + return showJoinedWhops; + } + + /** + * @return Whether reviews are displayed on direct-to-consumer product pages. + */ + @JsonProperty("show_reviews_dtc") + public boolean getShowReviewsDtc() { + return showReviewsDtc; + } + + /** + * @return Whether the account shows users in the user directory. + */ + @JsonProperty("show_user_directory") + public boolean getShowUserDirectory() { + return showUserDirectory; + } + + @JsonProperty("social_links") + public List getSocialLinks() { + return socialLinks; + } + + /** + * @return Whether the account settles on stablecoin rails — its balance is held on-chain as USDT and paid out over crypto, rather than as fiat cash. + */ + @JsonProperty("stablecoin_rails") + public boolean getStablecoinRails() { + return stablecoinRails; + } + + /** + * @return Whether the account can operate on Whop: active or suspended. Computed on list, retrieve, and me; null otherwise. + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return Why the account was suspended, in language safe to show the account owner. Computed only on retrieve and me; null otherwise, when status is not suspended, and when the suspension was recorded without a reason. + */ + @JsonIgnore + public Optional getStatusReason() { + if (statusReason == null) { + return Optional.empty(); + } + return statusReason; + } + + /** + * @return Account store page display configuration. + */ + @JsonProperty("store_page_config") + public AccountStorePageConfig getStorePageConfig() { + return storePageConfig; + } + + /** + * @return Target audience for this account. + */ + @JsonIgnore + public Optional getTargetAudience() { + if (targetAudience == null) { + return Optional.empty(); + } + return targetAudience; + } + + @JsonProperty("tax_collection_enabled_states") + public List getTaxCollectionEnabledStates() { + return taxCollectionEnabledStates; + } + + @JsonProperty("tax_identifiers") + public List getTaxIdentifiers() { + return taxIdentifiers; + } + + /** + * @return Who calculates and remits tax for the account: whop (Whop calculates and remits), self (Whop calculates; the account collects and remits), or none (neither; the account is responsible). null until the account enrolls in the Whop tax service. + */ + @JsonIgnore + public Optional getTaxRemittedBy() { + if (taxRemittedBy == null) { + return Optional.empty(); + } + return taxRemittedBy; + } + + /** + * @return How tax is applied to the account's prices: inclusive (tax included in the listed price) or exclusive (tax added on top). Defaults to exclusive when unset; null only when the account has no payment connection. + */ + @JsonIgnore + public Optional getTaxType() { + if (taxType == null) { + return Optional.empty(); + } + return taxType; + } + + /** + * @return Account-level 3D Secure behavior. mandate_challenge requires cardholder verification on supported card payments; null uses the standard checkout flow. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return Account display name. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return Account lifetime sales, normalized to USD. Computed only on retrieve and me for callers with stats:read scope; null otherwise. + */ + @JsonIgnore + public Optional getTotalEarnedUsd() { + if (totalEarnedUsd == null) { + return Optional.empty(); + } + return totalEarnedUsd; + } + + /** + * @return Total USD value across balances with known exchange rates. Computed only on single-account reads (retrieve and me); null on list responses, writes, missing balance-read permission, or unavailable balance source. + */ + @JsonIgnore + public Optional getTotalUsd() { + if (totalUsd == null) { + return Optional.empty(); + } + return totalUsd; + } + + /** + * @return Whether the account uses its logo as the fallback Open Graph image. + */ + @JsonProperty("use_logo_as_opengraph_image_fallback") + public boolean getUseLogoAsOpengraphImageFallback() { + return useLogoAsOpengraphImageFallback; + } + + /** + * @return Account identity verification status for the individual (KYC) and business (KYB) profiles. Each is null until created, otherwise a status of not_started, pending, manual_review, approved, or rejected. + */ + @JsonProperty("verification") + public Map getVerification() { + return verification; + } + + /** + * @return Lifetime volume through the account — sales plus transfers received — normalized to USD. Computed only on list for callers with stats:read on the account; null otherwise. + */ + @JsonIgnore + public Optional getVolumeUsd() { + if (volumeUsd == null) { + return Optional.empty(); + } + return volumeUsd; + } + + /** + * @return Account primary crypto wallet, or null if none has been provisioned. + */ + @JsonIgnore + public Optional getWallet() { + if (wallet == null) { + return Optional.empty(); + } + return wallet; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("banner_image_url") + private Optional _getBannerImageUrl() { + return bannerImageUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_address") + private Optional> _getBusinessAddress() { + return businessAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_name") + private Optional _getBusinessName() { + return businessName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_type") + private Optional _getBusinessType() { + return businessType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("capabilities") + private Optional _getCapabilities() { + return capabilities; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cards") + private Optional _getCards() { + return cards; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("industry_group") + private Optional _getIndustryGroup() { + return industryGroup; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("industry_type") + private Optional _getIndustryType() { + return industryType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("invoice_prefix") + private Optional _getInvoicePrefix() { + return invoicePrefix; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo_url") + private Optional _getLogoUrl() { + return logoUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("onboarding_type") + private Optional _getOnboardingType() { + return onboardingType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("opengraph_image_url") + private Optional _getOpengraphImageUrl() { + return opengraphImageUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("opengraph_image_variant") + private Optional _getOpengraphImageVariant() { + return opengraphImageVariant; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("other_business_description") + private Optional _getOtherBusinessDescription() { + return otherBusinessDescription; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("other_industry_description") + private Optional _getOtherIndustryDescription() { + return otherIndustryDescription; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("parent_account") + private Optional _getParentAccount() { + return parentAccount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_controls") + private Optional _getPaymentControls() { + return paymentControls; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_tax_code") + private Optional> _getProductTaxCode() { + return productTaxCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("recommended_actions") + private Optional> _getRecommendedActions() { + return recommendedActions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("required_actions") + private Optional> _getRequiredActions() { + return requiredActions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status_reason") + private Optional _getStatusReason() { + return statusReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("target_audience") + private Optional _getTargetAudience() { + return targetAudience; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_remitted_by") + private Optional _getTaxRemittedBy() { + return taxRemittedBy; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_type") + private Optional _getTaxType() { + return taxType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("total_earned_usd") + private Optional _getTotalEarnedUsd() { + return totalEarnedUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("total_usd") + private Optional _getTotalUsd() { + return totalUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("volume_usd") + private Optional _getVolumeUsd() { + return volumeUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("wallet") + private Optional _getWallet() { + return wallet; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Account && equalTo((Account) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Account other) { + return balances.equals(other.balances) + && bannerImageUrl.equals(other.bannerImageUrl) + && businessAddress.equals(other.businessAddress) + && businessName.equals(other.businessName) + && businessType.equals(other.businessType) + && canTransferPendingBalanceToChildren == other.canTransferPendingBalanceToChildren + && capabilities.equals(other.capabilities) + && cards.equals(other.cards) + && collectVatId == other.collectVatId + && companyFormation.equals(other.companyFormation) + && country.equals(other.country) + && createdAt.equals(other.createdAt) + && description.equals(other.description) + && email.equals(other.email) + && homePreferences.equals(other.homePreferences) + && id.equals(other.id) + && industryGroup.equals(other.industryGroup) + && industryType.equals(other.industryType) + && invoicePrefix.equals(other.invoicePrefix) + && logoUrl.equals(other.logoUrl) + && metadata.equals(other.metadata) + && onboardingType.equals(other.onboardingType) + && opengraphImageUrl.equals(other.opengraphImageUrl) + && opengraphImageVariant.equals(other.opengraphImageVariant) + && otherBusinessDescription.equals(other.otherBusinessDescription) + && otherIndustryDescription.equals(other.otherIndustryDescription) + && owner.equals(other.owner) + && parentAccount.equals(other.parentAccount) + && paymentControls.equals(other.paymentControls) + && productTaxCode.equals(other.productTaxCode) + && recommendedActions.equals(other.recommendedActions) + && require2Fa == other.require2Fa + && requiredActions.equals(other.requiredActions) + && route.equals(other.route) + && sendCustomerEmails == other.sendCustomerEmails + && showJoinedWhops == other.showJoinedWhops + && showReviewsDtc == other.showReviewsDtc + && showUserDirectory == other.showUserDirectory + && socialLinks.equals(other.socialLinks) + && stablecoinRails == other.stablecoinRails + && status.equals(other.status) + && statusReason.equals(other.statusReason) + && storePageConfig.equals(other.storePageConfig) + && targetAudience.equals(other.targetAudience) + && taxCollectionEnabledStates.equals(other.taxCollectionEnabledStates) + && taxIdentifiers.equals(other.taxIdentifiers) + && taxRemittedBy.equals(other.taxRemittedBy) + && taxType.equals(other.taxType) + && threeDsLevel.equals(other.threeDsLevel) + && title.equals(other.title) + && totalEarnedUsd.equals(other.totalEarnedUsd) + && totalUsd.equals(other.totalUsd) + && useLogoAsOpengraphImageFallback == other.useLogoAsOpengraphImageFallback + && verification.equals(other.verification) + && volumeUsd.equals(other.volumeUsd) + && wallet.equals(other.wallet); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.balances, + this.bannerImageUrl, + this.businessAddress, + this.businessName, + this.businessType, + this.canTransferPendingBalanceToChildren, + this.capabilities, + this.cards, + this.collectVatId, + this.companyFormation, + this.country, + this.createdAt, + this.description, + this.email, + this.homePreferences, + this.id, + this.industryGroup, + this.industryType, + this.invoicePrefix, + this.logoUrl, + this.metadata, + this.onboardingType, + this.opengraphImageUrl, + this.opengraphImageVariant, + this.otherBusinessDescription, + this.otherIndustryDescription, + this.owner, + this.parentAccount, + this.paymentControls, + this.productTaxCode, + this.recommendedActions, + this.require2Fa, + this.requiredActions, + this.route, + this.sendCustomerEmails, + this.showJoinedWhops, + this.showReviewsDtc, + this.showUserDirectory, + this.socialLinks, + this.stablecoinRails, + this.status, + this.statusReason, + this.storePageConfig, + this.targetAudience, + this.taxCollectionEnabledStates, + this.taxIdentifiers, + this.taxRemittedBy, + this.taxType, + this.threeDsLevel, + this.title, + this.totalEarnedUsd, + this.totalUsd, + this.useLogoAsOpengraphImageFallback, + this.verification, + this.volumeUsd, + this.wallet); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CanTransferPendingBalanceToChildrenStage builder() { + return new Builder(); + } + + public interface CanTransferPendingBalanceToChildrenStage { + /** + *

Whether pending funds may be transferred from this platform account to its connected accounts.

+ */ + CollectVatIdStage canTransferPendingBalanceToChildren(boolean canTransferPendingBalanceToChildren); + + Builder from(Account other); + } + + public interface CollectVatIdStage { + /** + *

Whether checkout shows a VAT/tax ID field for buyers to optionally enter. Does not require a VAT ID to purchase.

+ */ + CompanyFormationStage collectVatId(boolean collectVatId); + } + + public interface CompanyFormationStage { + /** + *

Company formation state for the account, managed through Form Company. A draft status until the formation checkout is paid, then filing progress with downloadable documents and signatures awaiting action. Empty when the formation state is temporarily unavailable.

+ */ + CreatedAtStage companyFormation(@NotNull AccountCompanyFormation companyFormation); + } + + public interface CreatedAtStage { + /** + *

When the account was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Account ID, prefixed biz_.

+ */ + OwnerStage id(@NotNull String id); + } + + public interface OwnerStage { + /** + *

The single user who owns the account, whose email is the email above. Distinct from the owner role on team members, which any number of them can hold.

+ */ + Require2FaStage owner(@NotNull UserSummary owner); + } + + public interface Require2FaStage { + /** + *

Whether authorized users must enable two-factor authentication.

+ */ + RouteStage require2Fa(boolean require2Fa); + } + + public interface RouteStage { + /** + *

Account public route identifier.

+ */ + SendCustomerEmailsStage route(@NotNull String route); + } + + public interface SendCustomerEmailsStage { + /** + *

Whether Whop sends transactional emails to customers on behalf of this account.

+ */ + ShowJoinedWhopsStage sendCustomerEmails(boolean sendCustomerEmails); + } + + public interface ShowJoinedWhopsStage { + /** + *

Whether the account appears in joined whops on other accounts.

+ */ + ShowReviewsDtcStage showJoinedWhops(boolean showJoinedWhops); + } + + public interface ShowReviewsDtcStage { + /** + *

Whether reviews are displayed on direct-to-consumer product pages.

+ */ + ShowUserDirectoryStage showReviewsDtc(boolean showReviewsDtc); + } + + public interface ShowUserDirectoryStage { + /** + *

Whether the account shows users in the user directory.

+ */ + StablecoinRailsStage showUserDirectory(boolean showUserDirectory); + } + + public interface StablecoinRailsStage { + /** + *

Whether the account settles on stablecoin rails — its balance is held on-chain as USDT and paid out over crypto, rather than as fiat cash.

+ */ + StorePageConfigStage stablecoinRails(boolean stablecoinRails); + } + + public interface StorePageConfigStage { + /** + *

Account store page display configuration.

+ */ + TitleStage storePageConfig(@NotNull AccountStorePageConfig storePageConfig); + } + + public interface TitleStage { + /** + *

Account display name.

+ */ + UseLogoAsOpengraphImageFallbackStage title(@NotNull String title); + } + + public interface UseLogoAsOpengraphImageFallbackStage { + /** + *

Whether the account uses its logo as the fallback Open Graph image.

+ */ + _FinalStage useLogoAsOpengraphImageFallback(boolean useLogoAsOpengraphImageFallback); + } + + public interface _FinalStage { + Account build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage balances(List balances); + + _FinalStage addBalances(AccountBalanceToken balances); + + _FinalStage addAllBalances(List balances); + + /** + *

Account banner image URL.

+ */ + _FinalStage bannerImageUrl(Optional bannerImageUrl); + + _FinalStage bannerImageUrl(String bannerImageUrl); + + _FinalStage bannerImageUrl(Nullable bannerImageUrl); + + /** + *

Account business address used to calculate tax, with line1, line2, city, state, postal_code, and country. null when no address is set.

+ */ + _FinalStage businessAddress(Optional> businessAddress); + + _FinalStage businessAddress(Map businessAddress); + + _FinalStage businessAddress(Nullable> businessAddress); + + /** + *

The account's legal business name used with its tax address.

+ */ + _FinalStage businessName(Optional businessName); + + _FinalStage businessName(String businessName); + + _FinalStage businessName(Nullable businessName); + + /** + *

High-level business category for the account. See the business types and industries glossary for valid values.

+ */ + _FinalStage businessType(Optional businessType); + + _FinalStage businessType(AccountBusinessType businessType); + + _FinalStage businessType(Nullable businessType); + + /** + *

Payment rails enabled for this account, each active, inactive, or pending (onboarding or review in progress). Computed only on retrieve and me for callers with company:balance:read scope; null otherwise.

+ */ + _FinalStage capabilities(Optional capabilities); + + _FinalStage capabilities(AccountCapabilities capabilities); + + _FinalStage capabilities(Nullable capabilities); + + /** + *

Whop Cards application details for the account. Computed only on retrieve and me for callers with company:balance:read scope; null otherwise, or when the account has no card application.

+ */ + _FinalStage cards(Optional cards); + + _FinalStage cards(AccountCards cards); + + _FinalStage cards(Nullable cards); + + /** + *

Country where the account is located.

+ */ + _FinalStage country(Optional country); + + _FinalStage country(String country); + + _FinalStage country(Nullable country); + + /** + *

Account promotional description.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

Account owner email address.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + _FinalStage homePreferences(List homePreferences); + + _FinalStage addHomePreferences(AccountHomePreferencesItem homePreferences); + + _FinalStage addAllHomePreferences(List homePreferences); + + /** + *

Account industry group. See the business types and industries glossary for valid values.

+ */ + _FinalStage industryGroup(Optional industryGroup); + + _FinalStage industryGroup(AccountIndustryGroup industryGroup); + + _FinalStage industryGroup(Nullable industryGroup); + + /** + *

Specific industry vertical for the account. See the business types and industries glossary for valid values.

+ */ + _FinalStage industryType(Optional industryType); + + _FinalStage industryType(String industryType); + + _FinalStage industryType(Nullable industryType); + + /** + *

Prefix used for account invoices.

+ */ + _FinalStage invoicePrefix(Optional invoicePrefix); + + _FinalStage invoicePrefix(String invoicePrefix); + + _FinalStage invoicePrefix(Nullable invoicePrefix); + + /** + *

Account logo image URL.

+ */ + _FinalStage logoUrl(Optional logoUrl); + + _FinalStage logoUrl(String logoUrl); + + _FinalStage logoUrl(Nullable logoUrl); + + /** + *

Arbitrary key/value metadata supplied at account creation.

+ */ + _FinalStage metadata(Map metadata); + + _FinalStage putAllMetadata(Map metadata); + + _FinalStage metadata(String key, Object value); + + /** + *

Type of onboarding the account has completed.

+ */ + _FinalStage onboardingType(Optional onboardingType); + + _FinalStage onboardingType(AccountOnboardingType onboardingType); + + _FinalStage onboardingType(Nullable onboardingType); + + /** + *

Account Open Graph image URL.

+ */ + _FinalStage opengraphImageUrl(Optional opengraphImageUrl); + + _FinalStage opengraphImageUrl(String opengraphImageUrl); + + _FinalStage opengraphImageUrl(Nullable opengraphImageUrl); + + /** + *

Account Open Graph image variant.

+ */ + _FinalStage opengraphImageVariant(Optional opengraphImageVariant); + + _FinalStage opengraphImageVariant(AccountOpengraphImageVariant opengraphImageVariant); + + _FinalStage opengraphImageVariant(Nullable opengraphImageVariant); + + /** + *

Business type details when business_type is other.

+ */ + _FinalStage otherBusinessDescription(Optional otherBusinessDescription); + + _FinalStage otherBusinessDescription(String otherBusinessDescription); + + _FinalStage otherBusinessDescription(Nullable otherBusinessDescription); + + /** + *

Industry details when industry_type is other.

+ */ + _FinalStage otherIndustryDescription(Optional otherIndustryDescription); + + _FinalStage otherIndustryDescription(String otherIndustryDescription); + + _FinalStage otherIndustryDescription(Nullable otherIndustryDescription); + + /** + *

Parent account for connected accounts, or null for standalone accounts.

+ */ + _FinalStage parentAccount(Optional parentAccount); + + _FinalStage parentAccount(AccountParent parentAccount); + + _FinalStage parentAccount(Nullable parentAccount); + + /** + *

Payment health controls currently applied to the account. Computed only on retrieve and me for callers with company:balance:read scope; null otherwise.

+ */ + _FinalStage paymentControls(Optional paymentControls); + + _FinalStage paymentControls(AccountPaymentControls paymentControls); + + _FinalStage paymentControls(Nullable paymentControls); + + /** + *

Tax classification code applied by default to the account's products, with id, name, and product_type. null when no default is set.

+ */ + _FinalStage productTaxCode(Optional> productTaxCode); + + _FinalStage productTaxCode(Map productTaxCode); + + _FinalStage productTaxCode(Nullable> productTaxCode); + + /** + *

DEPRECATED: Use the GET /recommended_actions?account_id={account_id} endpoint instead.

+ */ + _FinalStage recommendedActions(Optional> recommendedActions); + + _FinalStage recommendedActions(List recommendedActions); + + _FinalStage recommendedActions(Nullable> recommendedActions); + + _FinalStage requiredActions(Optional> requiredActions); + + _FinalStage requiredActions(List requiredActions); + + _FinalStage requiredActions(Nullable> requiredActions); + + _FinalStage socialLinks(List socialLinks); + + _FinalStage addSocialLinks(AccountSocialLink socialLinks); + + _FinalStage addAllSocialLinks(List socialLinks); + + /** + *

Whether the account can operate on Whop: active or suspended. Computed on list, retrieve, and me; null otherwise.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(String status); + + _FinalStage status(Nullable status); + + /** + *

Why the account was suspended, in language safe to show the account owner. Computed only on retrieve and me; null otherwise, when status is not suspended, and when the suspension was recorded without a reason.

+ */ + _FinalStage statusReason(Optional statusReason); + + _FinalStage statusReason(String statusReason); + + _FinalStage statusReason(Nullable statusReason); + + /** + *

Target audience for this account.

+ */ + _FinalStage targetAudience(Optional targetAudience); + + _FinalStage targetAudience(String targetAudience); + + _FinalStage targetAudience(Nullable targetAudience); + + _FinalStage taxCollectionEnabledStates(List taxCollectionEnabledStates); + + _FinalStage addTaxCollectionEnabledStates(String taxCollectionEnabledStates); + + _FinalStage addAllTaxCollectionEnabledStates(List taxCollectionEnabledStates); + + _FinalStage taxIdentifiers(List taxIdentifiers); + + _FinalStage addTaxIdentifiers(AccountTaxIdentifier taxIdentifiers); + + _FinalStage addAllTaxIdentifiers(List taxIdentifiers); + + /** + *

Who calculates and remits tax for the account: whop (Whop calculates and remits), self (Whop calculates; the account collects and remits), or none (neither; the account is responsible). null until the account enrolls in the Whop tax service.

+ */ + _FinalStage taxRemittedBy(Optional taxRemittedBy); + + _FinalStage taxRemittedBy(AccountTaxRemittedBy taxRemittedBy); + + _FinalStage taxRemittedBy(Nullable taxRemittedBy); + + /** + *

How tax is applied to the account's prices: inclusive (tax included in the listed price) or exclusive (tax added on top). Defaults to exclusive when unset; null only when the account has no payment connection.

+ */ + _FinalStage taxType(Optional taxType); + + _FinalStage taxType(AccountTaxType taxType); + + _FinalStage taxType(Nullable taxType); + + /** + *

Account-level 3D Secure behavior. mandate_challenge requires cardholder verification on supported card payments; null uses the standard checkout flow.

+ */ + _FinalStage threeDsLevel(Optional threeDsLevel); + + _FinalStage threeDsLevel(AccountThreeDsLevel threeDsLevel); + + _FinalStage threeDsLevel(Nullable threeDsLevel); + + /** + *

Account lifetime sales, normalized to USD. Computed only on retrieve and me for callers with stats:read scope; null otherwise.

+ */ + _FinalStage totalEarnedUsd(Optional totalEarnedUsd); + + _FinalStage totalEarnedUsd(Double totalEarnedUsd); + + _FinalStage totalEarnedUsd(Nullable totalEarnedUsd); + + /** + *

Total USD value across balances with known exchange rates. Computed only on single-account reads (retrieve and me); null on list responses, writes, missing balance-read permission, or unavailable balance source.

+ */ + _FinalStage totalUsd(Optional totalUsd); + + _FinalStage totalUsd(String totalUsd); + + _FinalStage totalUsd(Nullable totalUsd); + + /** + *

Account identity verification status for the individual (KYC) and business (KYB) profiles. Each is null until created, otherwise a status of not_started, pending, manual_review, approved, or rejected.

+ */ + _FinalStage verification(Map verification); + + _FinalStage putAllVerification(Map verification); + + _FinalStage verification(String key, Object value); + + /** + *

Lifetime volume through the account — sales plus transfers received — normalized to USD. Computed only on list for callers with stats:read on the account; null otherwise.

+ */ + _FinalStage volumeUsd(Optional volumeUsd); + + _FinalStage volumeUsd(Double volumeUsd); + + _FinalStage volumeUsd(Nullable volumeUsd); + + /** + *

Account primary crypto wallet, or null if none has been provisioned.

+ */ + _FinalStage wallet(Optional wallet); + + _FinalStage wallet(AccountWallet wallet); + + _FinalStage wallet(Nullable wallet); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CanTransferPendingBalanceToChildrenStage, + CollectVatIdStage, + CompanyFormationStage, + CreatedAtStage, + IdStage, + OwnerStage, + Require2FaStage, + RouteStage, + SendCustomerEmailsStage, + ShowJoinedWhopsStage, + ShowReviewsDtcStage, + ShowUserDirectoryStage, + StablecoinRailsStage, + StorePageConfigStage, + TitleStage, + UseLogoAsOpengraphImageFallbackStage, + _FinalStage { + private boolean canTransferPendingBalanceToChildren; + + private boolean collectVatId; + + private AccountCompanyFormation companyFormation; + + private String createdAt; + + private String id; + + private UserSummary owner; + + private boolean require2Fa; + + private String route; + + private boolean sendCustomerEmails; + + private boolean showJoinedWhops; + + private boolean showReviewsDtc; + + private boolean showUserDirectory; + + private boolean stablecoinRails; + + private AccountStorePageConfig storePageConfig; + + private String title; + + private boolean useLogoAsOpengraphImageFallback; + + private Optional wallet = Optional.empty(); + + private Optional volumeUsd = Optional.empty(); + + private Map verification = new LinkedHashMap<>(); + + private Optional totalUsd = Optional.empty(); + + private Optional totalEarnedUsd = Optional.empty(); + + private Optional threeDsLevel = Optional.empty(); + + private Optional taxType = Optional.empty(); + + private Optional taxRemittedBy = Optional.empty(); + + private List taxIdentifiers = new ArrayList<>(); + + private List taxCollectionEnabledStates = new ArrayList<>(); + + private Optional targetAudience = Optional.empty(); + + private Optional statusReason = Optional.empty(); + + private Optional status = Optional.empty(); + + private List socialLinks = new ArrayList<>(); + + private Optional> requiredActions = Optional.empty(); + + private Optional> recommendedActions = Optional.empty(); + + private Optional> productTaxCode = Optional.empty(); + + private Optional paymentControls = Optional.empty(); + + private Optional parentAccount = Optional.empty(); + + private Optional otherIndustryDescription = Optional.empty(); + + private Optional otherBusinessDescription = Optional.empty(); + + private Optional opengraphImageVariant = Optional.empty(); + + private Optional opengraphImageUrl = Optional.empty(); + + private Optional onboardingType = Optional.empty(); + + private Map metadata = new LinkedHashMap<>(); + + private Optional logoUrl = Optional.empty(); + + private Optional invoicePrefix = Optional.empty(); + + private Optional industryType = Optional.empty(); + + private Optional industryGroup = Optional.empty(); + + private List homePreferences = new ArrayList<>(); + + private Optional email = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional cards = Optional.empty(); + + private Optional capabilities = Optional.empty(); + + private Optional businessType = Optional.empty(); + + private Optional businessName = Optional.empty(); + + private Optional> businessAddress = Optional.empty(); + + private Optional bannerImageUrl = Optional.empty(); + + private List balances = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Account other) { + balances(other.getBalances()); + bannerImageUrl(other.getBannerImageUrl()); + businessAddress(other.getBusinessAddress()); + businessName(other.getBusinessName()); + businessType(other.getBusinessType()); + canTransferPendingBalanceToChildren(other.getCanTransferPendingBalanceToChildren()); + capabilities(other.getCapabilities()); + cards(other.getCards()); + collectVatId(other.getCollectVatId()); + companyFormation(other.getCompanyFormation()); + country(other.getCountry()); + createdAt(other.getCreatedAt()); + description(other.getDescription()); + email(other.getEmail()); + homePreferences(other.getHomePreferences()); + id(other.getId()); + industryGroup(other.getIndustryGroup()); + industryType(other.getIndustryType()); + invoicePrefix(other.getInvoicePrefix()); + logoUrl(other.getLogoUrl()); + metadata(other.getMetadata()); + onboardingType(other.getOnboardingType()); + opengraphImageUrl(other.getOpengraphImageUrl()); + opengraphImageVariant(other.getOpengraphImageVariant()); + otherBusinessDescription(other.getOtherBusinessDescription()); + otherIndustryDescription(other.getOtherIndustryDescription()); + owner(other.getOwner()); + parentAccount(other.getParentAccount()); + paymentControls(other.getPaymentControls()); + productTaxCode(other.getProductTaxCode()); + recommendedActions(other.getRecommendedActions()); + require2Fa(other.getRequire2Fa()); + requiredActions(other.getRequiredActions()); + route(other.getRoute()); + sendCustomerEmails(other.getSendCustomerEmails()); + showJoinedWhops(other.getShowJoinedWhops()); + showReviewsDtc(other.getShowReviewsDtc()); + showUserDirectory(other.getShowUserDirectory()); + socialLinks(other.getSocialLinks()); + stablecoinRails(other.getStablecoinRails()); + status(other.getStatus()); + statusReason(other.getStatusReason()); + storePageConfig(other.getStorePageConfig()); + targetAudience(other.getTargetAudience()); + taxCollectionEnabledStates(other.getTaxCollectionEnabledStates()); + taxIdentifiers(other.getTaxIdentifiers()); + taxRemittedBy(other.getTaxRemittedBy()); + taxType(other.getTaxType()); + threeDsLevel(other.getThreeDsLevel()); + title(other.getTitle()); + totalEarnedUsd(other.getTotalEarnedUsd()); + totalUsd(other.getTotalUsd()); + useLogoAsOpengraphImageFallback(other.getUseLogoAsOpengraphImageFallback()); + verification(other.getVerification()); + volumeUsd(other.getVolumeUsd()); + wallet(other.getWallet()); + return this; + } + + /** + *

Whether pending funds may be transferred from this platform account to its connected accounts.

+ *

Whether pending funds may be transferred from this platform account to its connected accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("can_transfer_pending_balance_to_children") + public CollectVatIdStage canTransferPendingBalanceToChildren(boolean canTransferPendingBalanceToChildren) { + this.canTransferPendingBalanceToChildren = canTransferPendingBalanceToChildren; + return this; + } + + /** + *

Whether checkout shows a VAT/tax ID field for buyers to optionally enter. Does not require a VAT ID to purchase.

+ *

Whether checkout shows a VAT/tax ID field for buyers to optionally enter. Does not require a VAT ID to purchase.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("collect_vat_id") + public CompanyFormationStage collectVatId(boolean collectVatId) { + this.collectVatId = collectVatId; + return this; + } + + /** + *

Company formation state for the account, managed through Form Company. A draft status until the formation checkout is paid, then filing progress with downloadable documents and signatures awaiting action. Empty when the formation state is temporarily unavailable.

+ *

Company formation state for the account, managed through Form Company. A draft status until the formation checkout is paid, then filing progress with downloadable documents and signatures awaiting action. Empty when the formation state is temporarily unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_formation") + public CreatedAtStage companyFormation(@NotNull AccountCompanyFormation companyFormation) { + this.companyFormation = Objects.requireNonNull(companyFormation, "companyFormation must not be null"); + return this; + } + + /** + *

When the account was created, as an ISO 8601 timestamp.

+ *

When the account was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ *

Account ID, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OwnerStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The single user who owns the account, whose email is the email above. Distinct from the owner role on team members, which any number of them can hold.

+ *

The single user who owns the account, whose email is the email above. Distinct from the owner role on team members, which any number of them can hold.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("owner") + public Require2FaStage owner(@NotNull UserSummary owner) { + this.owner = Objects.requireNonNull(owner, "owner must not be null"); + return this; + } + + /** + *

Whether authorized users must enable two-factor authentication.

+ *

Whether authorized users must enable two-factor authentication.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("require_2fa") + public RouteStage require2Fa(boolean require2Fa) { + this.require2Fa = require2Fa; + return this; + } + + /** + *

Account public route identifier.

+ *

Account public route identifier.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public SendCustomerEmailsStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

Whether Whop sends transactional emails to customers on behalf of this account.

+ *

Whether Whop sends transactional emails to customers on behalf of this account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("send_customer_emails") + public ShowJoinedWhopsStage sendCustomerEmails(boolean sendCustomerEmails) { + this.sendCustomerEmails = sendCustomerEmails; + return this; + } + + /** + *

Whether the account appears in joined whops on other accounts.

+ *

Whether the account appears in joined whops on other accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("show_joined_whops") + public ShowReviewsDtcStage showJoinedWhops(boolean showJoinedWhops) { + this.showJoinedWhops = showJoinedWhops; + return this; + } + + /** + *

Whether reviews are displayed on direct-to-consumer product pages.

+ *

Whether reviews are displayed on direct-to-consumer product pages.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("show_reviews_dtc") + public ShowUserDirectoryStage showReviewsDtc(boolean showReviewsDtc) { + this.showReviewsDtc = showReviewsDtc; + return this; + } + + /** + *

Whether the account shows users in the user directory.

+ *

Whether the account shows users in the user directory.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("show_user_directory") + public StablecoinRailsStage showUserDirectory(boolean showUserDirectory) { + this.showUserDirectory = showUserDirectory; + return this; + } + + /** + *

Whether the account settles on stablecoin rails — its balance is held on-chain as USDT and paid out over crypto, rather than as fiat cash.

+ *

Whether the account settles on stablecoin rails — its balance is held on-chain as USDT and paid out over crypto, rather than as fiat cash.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("stablecoin_rails") + public StorePageConfigStage stablecoinRails(boolean stablecoinRails) { + this.stablecoinRails = stablecoinRails; + return this; + } + + /** + *

Account store page display configuration.

+ *

Account store page display configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("store_page_config") + public TitleStage storePageConfig(@NotNull AccountStorePageConfig storePageConfig) { + this.storePageConfig = Objects.requireNonNull(storePageConfig, "storePageConfig must not be null"); + return this; + } + + /** + *

Account display name.

+ *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public UseLogoAsOpengraphImageFallbackStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Whether the account uses its logo as the fallback Open Graph image.

+ *

Whether the account uses its logo as the fallback Open Graph image.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("use_logo_as_opengraph_image_fallback") + public _FinalStage useLogoAsOpengraphImageFallback(boolean useLogoAsOpengraphImageFallback) { + this.useLogoAsOpengraphImageFallback = useLogoAsOpengraphImageFallback; + return this; + } + + /** + *

Account primary crypto wallet, or null if none has been provisioned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage wallet(Nullable wallet) { + if (wallet.isNull()) { + this.wallet = null; + } else if (wallet.isEmpty()) { + this.wallet = Optional.empty(); + } else { + this.wallet = Optional.of(wallet.get()); + } + return this; + } + + /** + *

Account primary crypto wallet, or null if none has been provisioned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage wallet(AccountWallet wallet) { + this.wallet = Optional.ofNullable(wallet); + return this; + } + + /** + *

Account primary crypto wallet, or null if none has been provisioned.

+ */ + @java.lang.Override + @JsonSetter(value = "wallet", nulls = Nulls.SKIP) + public _FinalStage wallet(Optional wallet) { + this.wallet = wallet; + return this; + } + + /** + *

Lifetime volume through the account — sales plus transfers received — normalized to USD. Computed only on list for callers with stats:read on the account; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage volumeUsd(Nullable volumeUsd) { + if (volumeUsd.isNull()) { + this.volumeUsd = null; + } else if (volumeUsd.isEmpty()) { + this.volumeUsd = Optional.empty(); + } else { + this.volumeUsd = Optional.of(volumeUsd.get()); + } + return this; + } + + /** + *

Lifetime volume through the account — sales plus transfers received — normalized to USD. Computed only on list for callers with stats:read on the account; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage volumeUsd(Double volumeUsd) { + this.volumeUsd = Optional.ofNullable(volumeUsd); + return this; + } + + /** + *

Lifetime volume through the account — sales plus transfers received — normalized to USD. Computed only on list for callers with stats:read on the account; null otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "volume_usd", nulls = Nulls.SKIP) + public _FinalStage volumeUsd(Optional volumeUsd) { + this.volumeUsd = volumeUsd; + return this; + } + + /** + *

Account identity verification status for the individual (KYC) and business (KYB) profiles. Each is null until created, otherwise a status of not_started, pending, manual_review, approved, or rejected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage verification(String key, Object value) { + this.verification.put(key, value); + return this; + } + + /** + *

Account identity verification status for the individual (KYC) and business (KYB) profiles. Each is null until created, otherwise a status of not_started, pending, manual_review, approved, or rejected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllVerification(Map verification) { + if (verification != null) { + this.verification.putAll(verification); + } + return this; + } + + /** + *

Account identity verification status for the individual (KYC) and business (KYB) profiles. Each is null until created, otherwise a status of not_started, pending, manual_review, approved, or rejected.

+ */ + @java.lang.Override + @JsonSetter(value = "verification", nulls = Nulls.SKIP) + public _FinalStage verification(Map verification) { + this.verification.clear(); + if (verification != null) { + this.verification.putAll(verification); + } + return this; + } + + /** + *

Total USD value across balances with known exchange rates. Computed only on single-account reads (retrieve and me); null on list responses, writes, missing balance-read permission, or unavailable balance source.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage totalUsd(Nullable totalUsd) { + if (totalUsd.isNull()) { + this.totalUsd = null; + } else if (totalUsd.isEmpty()) { + this.totalUsd = Optional.empty(); + } else { + this.totalUsd = Optional.of(totalUsd.get()); + } + return this; + } + + /** + *

Total USD value across balances with known exchange rates. Computed only on single-account reads (retrieve and me); null on list responses, writes, missing balance-read permission, or unavailable balance source.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage totalUsd(String totalUsd) { + this.totalUsd = Optional.ofNullable(totalUsd); + return this; + } + + /** + *

Total USD value across balances with known exchange rates. Computed only on single-account reads (retrieve and me); null on list responses, writes, missing balance-read permission, or unavailable balance source.

+ */ + @java.lang.Override + @JsonSetter(value = "total_usd", nulls = Nulls.SKIP) + public _FinalStage totalUsd(Optional totalUsd) { + this.totalUsd = totalUsd; + return this; + } + + /** + *

Account lifetime sales, normalized to USD. Computed only on retrieve and me for callers with stats:read scope; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage totalEarnedUsd(Nullable totalEarnedUsd) { + if (totalEarnedUsd.isNull()) { + this.totalEarnedUsd = null; + } else if (totalEarnedUsd.isEmpty()) { + this.totalEarnedUsd = Optional.empty(); + } else { + this.totalEarnedUsd = Optional.of(totalEarnedUsd.get()); + } + return this; + } + + /** + *

Account lifetime sales, normalized to USD. Computed only on retrieve and me for callers with stats:read scope; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage totalEarnedUsd(Double totalEarnedUsd) { + this.totalEarnedUsd = Optional.ofNullable(totalEarnedUsd); + return this; + } + + /** + *

Account lifetime sales, normalized to USD. Computed only on retrieve and me for callers with stats:read scope; null otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "total_earned_usd", nulls = Nulls.SKIP) + public _FinalStage totalEarnedUsd(Optional totalEarnedUsd) { + this.totalEarnedUsd = totalEarnedUsd; + return this; + } + + /** + *

Account-level 3D Secure behavior. mandate_challenge requires cardholder verification on supported card payments; null uses the standard checkout flow.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

Account-level 3D Secure behavior. mandate_challenge requires cardholder verification on supported card payments; null uses the standard checkout flow.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(AccountThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + /** + *

Account-level 3D Secure behavior. mandate_challenge requires cardholder verification on supported card payments; null uses the standard checkout flow.

+ */ + @java.lang.Override + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public _FinalStage threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + /** + *

How tax is applied to the account's prices: inclusive (tax included in the listed price) or exclusive (tax added on top). Defaults to exclusive when unset; null only when the account has no payment connection.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxType(Nullable taxType) { + if (taxType.isNull()) { + this.taxType = null; + } else if (taxType.isEmpty()) { + this.taxType = Optional.empty(); + } else { + this.taxType = Optional.of(taxType.get()); + } + return this; + } + + /** + *

How tax is applied to the account's prices: inclusive (tax included in the listed price) or exclusive (tax added on top). Defaults to exclusive when unset; null only when the account has no payment connection.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxType(AccountTaxType taxType) { + this.taxType = Optional.ofNullable(taxType); + return this; + } + + /** + *

How tax is applied to the account's prices: inclusive (tax included in the listed price) or exclusive (tax added on top). Defaults to exclusive when unset; null only when the account has no payment connection.

+ */ + @java.lang.Override + @JsonSetter(value = "tax_type", nulls = Nulls.SKIP) + public _FinalStage taxType(Optional taxType) { + this.taxType = taxType; + return this; + } + + /** + *

Who calculates and remits tax for the account: whop (Whop calculates and remits), self (Whop calculates; the account collects and remits), or none (neither; the account is responsible). null until the account enrolls in the Whop tax service.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxRemittedBy(Nullable taxRemittedBy) { + if (taxRemittedBy.isNull()) { + this.taxRemittedBy = null; + } else if (taxRemittedBy.isEmpty()) { + this.taxRemittedBy = Optional.empty(); + } else { + this.taxRemittedBy = Optional.of(taxRemittedBy.get()); + } + return this; + } + + /** + *

Who calculates and remits tax for the account: whop (Whop calculates and remits), self (Whop calculates; the account collects and remits), or none (neither; the account is responsible). null until the account enrolls in the Whop tax service.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxRemittedBy(AccountTaxRemittedBy taxRemittedBy) { + this.taxRemittedBy = Optional.ofNullable(taxRemittedBy); + return this; + } + + /** + *

Who calculates and remits tax for the account: whop (Whop calculates and remits), self (Whop calculates; the account collects and remits), or none (neither; the account is responsible). null until the account enrolls in the Whop tax service.

+ */ + @java.lang.Override + @JsonSetter(value = "tax_remitted_by", nulls = Nulls.SKIP) + public _FinalStage taxRemittedBy(Optional taxRemittedBy) { + this.taxRemittedBy = taxRemittedBy; + return this; + } + + @java.lang.Override + public _FinalStage addAllTaxIdentifiers(List taxIdentifiers) { + if (taxIdentifiers != null) { + this.taxIdentifiers.addAll(taxIdentifiers); + } + return this; + } + + @java.lang.Override + public _FinalStage addTaxIdentifiers(AccountTaxIdentifier taxIdentifiers) { + this.taxIdentifiers.add(taxIdentifiers); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tax_identifiers", nulls = Nulls.SKIP) + public _FinalStage taxIdentifiers(List taxIdentifiers) { + this.taxIdentifiers.clear(); + if (taxIdentifiers != null) { + this.taxIdentifiers.addAll(taxIdentifiers); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllTaxCollectionEnabledStates(List taxCollectionEnabledStates) { + if (taxCollectionEnabledStates != null) { + this.taxCollectionEnabledStates.addAll(taxCollectionEnabledStates); + } + return this; + } + + @java.lang.Override + public _FinalStage addTaxCollectionEnabledStates(String taxCollectionEnabledStates) { + this.taxCollectionEnabledStates.add(taxCollectionEnabledStates); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tax_collection_enabled_states", nulls = Nulls.SKIP) + public _FinalStage taxCollectionEnabledStates(List taxCollectionEnabledStates) { + this.taxCollectionEnabledStates.clear(); + if (taxCollectionEnabledStates != null) { + this.taxCollectionEnabledStates.addAll(taxCollectionEnabledStates); + } + return this; + } + + /** + *

Target audience for this account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage targetAudience(Nullable targetAudience) { + if (targetAudience.isNull()) { + this.targetAudience = null; + } else if (targetAudience.isEmpty()) { + this.targetAudience = Optional.empty(); + } else { + this.targetAudience = Optional.of(targetAudience.get()); + } + return this; + } + + /** + *

Target audience for this account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage targetAudience(String targetAudience) { + this.targetAudience = Optional.ofNullable(targetAudience); + return this; + } + + /** + *

Target audience for this account.

+ */ + @java.lang.Override + @JsonSetter(value = "target_audience", nulls = Nulls.SKIP) + public _FinalStage targetAudience(Optional targetAudience) { + this.targetAudience = targetAudience; + return this; + } + + /** + *

Why the account was suspended, in language safe to show the account owner. Computed only on retrieve and me; null otherwise, when status is not suspended, and when the suspension was recorded without a reason.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statusReason(Nullable statusReason) { + if (statusReason.isNull()) { + this.statusReason = null; + } else if (statusReason.isEmpty()) { + this.statusReason = Optional.empty(); + } else { + this.statusReason = Optional.of(statusReason.get()); + } + return this; + } + + /** + *

Why the account was suspended, in language safe to show the account owner. Computed only on retrieve and me; null otherwise, when status is not suspended, and when the suspension was recorded without a reason.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statusReason(String statusReason) { + this.statusReason = Optional.ofNullable(statusReason); + return this; + } + + /** + *

Why the account was suspended, in language safe to show the account owner. Computed only on retrieve and me; null otherwise, when status is not suspended, and when the suspension was recorded without a reason.

+ */ + @java.lang.Override + @JsonSetter(value = "status_reason", nulls = Nulls.SKIP) + public _FinalStage statusReason(Optional statusReason) { + this.statusReason = statusReason; + return this; + } + + /** + *

Whether the account can operate on Whop: active or suspended. Computed on list, retrieve, and me; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

Whether the account can operate on Whop: active or suspended. Computed on list, retrieve, and me; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(String status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Whether the account can operate on Whop: active or suspended. Computed on list, retrieve, and me; null otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + @java.lang.Override + public _FinalStage addAllSocialLinks(List socialLinks) { + if (socialLinks != null) { + this.socialLinks.addAll(socialLinks); + } + return this; + } + + @java.lang.Override + public _FinalStage addSocialLinks(AccountSocialLink socialLinks) { + this.socialLinks.add(socialLinks); + return this; + } + + @java.lang.Override + @JsonSetter(value = "social_links", nulls = Nulls.SKIP) + public _FinalStage socialLinks(List socialLinks) { + this.socialLinks.clear(); + if (socialLinks != null) { + this.socialLinks.addAll(socialLinks); + } + return this; + } + + @java.lang.Override + public _FinalStage requiredActions(Nullable> requiredActions) { + if (requiredActions.isNull()) { + this.requiredActions = null; + } else if (requiredActions.isEmpty()) { + this.requiredActions = Optional.empty(); + } else { + this.requiredActions = Optional.of(requiredActions.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage requiredActions(List requiredActions) { + this.requiredActions = Optional.ofNullable(requiredActions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "required_actions", nulls = Nulls.SKIP) + public _FinalStage requiredActions(Optional> requiredActions) { + this.requiredActions = requiredActions; + return this; + } + + /** + *

DEPRECATED: Use the GET /recommended_actions?account_id={account_id} endpoint instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage recommendedActions(Nullable> recommendedActions) { + if (recommendedActions.isNull()) { + this.recommendedActions = null; + } else if (recommendedActions.isEmpty()) { + this.recommendedActions = Optional.empty(); + } else { + this.recommendedActions = Optional.of(recommendedActions.get()); + } + return this; + } + + /** + *

DEPRECATED: Use the GET /recommended_actions?account_id={account_id} endpoint instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage recommendedActions(List recommendedActions) { + this.recommendedActions = Optional.ofNullable(recommendedActions); + return this; + } + + /** + *

DEPRECATED: Use the GET /recommended_actions?account_id={account_id} endpoint instead.

+ */ + @java.lang.Override + @JsonSetter(value = "recommended_actions", nulls = Nulls.SKIP) + public _FinalStage recommendedActions(Optional> recommendedActions) { + this.recommendedActions = recommendedActions; + return this; + } + + /** + *

Tax classification code applied by default to the account's products, with id, name, and product_type. null when no default is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productTaxCode(Nullable> productTaxCode) { + if (productTaxCode.isNull()) { + this.productTaxCode = null; + } else if (productTaxCode.isEmpty()) { + this.productTaxCode = Optional.empty(); + } else { + this.productTaxCode = Optional.of(productTaxCode.get()); + } + return this; + } + + /** + *

Tax classification code applied by default to the account's products, with id, name, and product_type. null when no default is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productTaxCode(Map productTaxCode) { + this.productTaxCode = Optional.ofNullable(productTaxCode); + return this; + } + + /** + *

Tax classification code applied by default to the account's products, with id, name, and product_type. null when no default is set.

+ */ + @java.lang.Override + @JsonSetter(value = "product_tax_code", nulls = Nulls.SKIP) + public _FinalStage productTaxCode(Optional> productTaxCode) { + this.productTaxCode = productTaxCode; + return this; + } + + /** + *

Payment health controls currently applied to the account. Computed only on retrieve and me for callers with company:balance:read scope; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentControls(Nullable paymentControls) { + if (paymentControls.isNull()) { + this.paymentControls = null; + } else if (paymentControls.isEmpty()) { + this.paymentControls = Optional.empty(); + } else { + this.paymentControls = Optional.of(paymentControls.get()); + } + return this; + } + + /** + *

Payment health controls currently applied to the account. Computed only on retrieve and me for callers with company:balance:read scope; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentControls(AccountPaymentControls paymentControls) { + this.paymentControls = Optional.ofNullable(paymentControls); + return this; + } + + /** + *

Payment health controls currently applied to the account. Computed only on retrieve and me for callers with company:balance:read scope; null otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_controls", nulls = Nulls.SKIP) + public _FinalStage paymentControls(Optional paymentControls) { + this.paymentControls = paymentControls; + return this; + } + + /** + *

Parent account for connected accounts, or null for standalone accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage parentAccount(Nullable parentAccount) { + if (parentAccount.isNull()) { + this.parentAccount = null; + } else if (parentAccount.isEmpty()) { + this.parentAccount = Optional.empty(); + } else { + this.parentAccount = Optional.of(parentAccount.get()); + } + return this; + } + + /** + *

Parent account for connected accounts, or null for standalone accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage parentAccount(AccountParent parentAccount) { + this.parentAccount = Optional.ofNullable(parentAccount); + return this; + } + + /** + *

Parent account for connected accounts, or null for standalone accounts.

+ */ + @java.lang.Override + @JsonSetter(value = "parent_account", nulls = Nulls.SKIP) + public _FinalStage parentAccount(Optional parentAccount) { + this.parentAccount = parentAccount; + return this; + } + + /** + *

Industry details when industry_type is other.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage otherIndustryDescription(Nullable otherIndustryDescription) { + if (otherIndustryDescription.isNull()) { + this.otherIndustryDescription = null; + } else if (otherIndustryDescription.isEmpty()) { + this.otherIndustryDescription = Optional.empty(); + } else { + this.otherIndustryDescription = Optional.of(otherIndustryDescription.get()); + } + return this; + } + + /** + *

Industry details when industry_type is other.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage otherIndustryDescription(String otherIndustryDescription) { + this.otherIndustryDescription = Optional.ofNullable(otherIndustryDescription); + return this; + } + + /** + *

Industry details when industry_type is other.

+ */ + @java.lang.Override + @JsonSetter(value = "other_industry_description", nulls = Nulls.SKIP) + public _FinalStage otherIndustryDescription(Optional otherIndustryDescription) { + this.otherIndustryDescription = otherIndustryDescription; + return this; + } + + /** + *

Business type details when business_type is other.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage otherBusinessDescription(Nullable otherBusinessDescription) { + if (otherBusinessDescription.isNull()) { + this.otherBusinessDescription = null; + } else if (otherBusinessDescription.isEmpty()) { + this.otherBusinessDescription = Optional.empty(); + } else { + this.otherBusinessDescription = Optional.of(otherBusinessDescription.get()); + } + return this; + } + + /** + *

Business type details when business_type is other.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage otherBusinessDescription(String otherBusinessDescription) { + this.otherBusinessDescription = Optional.ofNullable(otherBusinessDescription); + return this; + } + + /** + *

Business type details when business_type is other.

+ */ + @java.lang.Override + @JsonSetter(value = "other_business_description", nulls = Nulls.SKIP) + public _FinalStage otherBusinessDescription(Optional otherBusinessDescription) { + this.otherBusinessDescription = otherBusinessDescription; + return this; + } + + /** + *

Account Open Graph image variant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage opengraphImageVariant(Nullable opengraphImageVariant) { + if (opengraphImageVariant.isNull()) { + this.opengraphImageVariant = null; + } else if (opengraphImageVariant.isEmpty()) { + this.opengraphImageVariant = Optional.empty(); + } else { + this.opengraphImageVariant = Optional.of(opengraphImageVariant.get()); + } + return this; + } + + /** + *

Account Open Graph image variant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage opengraphImageVariant(AccountOpengraphImageVariant opengraphImageVariant) { + this.opengraphImageVariant = Optional.ofNullable(opengraphImageVariant); + return this; + } + + /** + *

Account Open Graph image variant.

+ */ + @java.lang.Override + @JsonSetter(value = "opengraph_image_variant", nulls = Nulls.SKIP) + public _FinalStage opengraphImageVariant(Optional opengraphImageVariant) { + this.opengraphImageVariant = opengraphImageVariant; + return this; + } + + /** + *

Account Open Graph image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage opengraphImageUrl(Nullable opengraphImageUrl) { + if (opengraphImageUrl.isNull()) { + this.opengraphImageUrl = null; + } else if (opengraphImageUrl.isEmpty()) { + this.opengraphImageUrl = Optional.empty(); + } else { + this.opengraphImageUrl = Optional.of(opengraphImageUrl.get()); + } + return this; + } + + /** + *

Account Open Graph image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage opengraphImageUrl(String opengraphImageUrl) { + this.opengraphImageUrl = Optional.ofNullable(opengraphImageUrl); + return this; + } + + /** + *

Account Open Graph image URL.

+ */ + @java.lang.Override + @JsonSetter(value = "opengraph_image_url", nulls = Nulls.SKIP) + public _FinalStage opengraphImageUrl(Optional opengraphImageUrl) { + this.opengraphImageUrl = opengraphImageUrl; + return this; + } + + /** + *

Type of onboarding the account has completed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage onboardingType(Nullable onboardingType) { + if (onboardingType.isNull()) { + this.onboardingType = null; + } else if (onboardingType.isEmpty()) { + this.onboardingType = Optional.empty(); + } else { + this.onboardingType = Optional.of(onboardingType.get()); + } + return this; + } + + /** + *

Type of onboarding the account has completed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage onboardingType(AccountOnboardingType onboardingType) { + this.onboardingType = Optional.ofNullable(onboardingType); + return this; + } + + /** + *

Type of onboarding the account has completed.

+ */ + @java.lang.Override + @JsonSetter(value = "onboarding_type", nulls = Nulls.SKIP) + public _FinalStage onboardingType(Optional onboardingType) { + this.onboardingType = onboardingType; + return this; + } + + /** + *

Arbitrary key/value metadata supplied at account creation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(String key, Object value) { + this.metadata.put(key, value); + return this; + } + + /** + *

Arbitrary key/value metadata supplied at account creation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllMetadata(Map metadata) { + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Arbitrary key/value metadata supplied at account creation.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Map metadata) { + this.metadata.clear(); + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Account logo image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(Nullable logoUrl) { + if (logoUrl.isNull()) { + this.logoUrl = null; + } else if (logoUrl.isEmpty()) { + this.logoUrl = Optional.empty(); + } else { + this.logoUrl = Optional.of(logoUrl.get()); + } + return this; + } + + /** + *

Account logo image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(String logoUrl) { + this.logoUrl = Optional.ofNullable(logoUrl); + return this; + } + + /** + *

Account logo image URL.

+ */ + @java.lang.Override + @JsonSetter(value = "logo_url", nulls = Nulls.SKIP) + public _FinalStage logoUrl(Optional logoUrl) { + this.logoUrl = logoUrl; + return this; + } + + /** + *

Prefix used for account invoices.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage invoicePrefix(Nullable invoicePrefix) { + if (invoicePrefix.isNull()) { + this.invoicePrefix = null; + } else if (invoicePrefix.isEmpty()) { + this.invoicePrefix = Optional.empty(); + } else { + this.invoicePrefix = Optional.of(invoicePrefix.get()); + } + return this; + } + + /** + *

Prefix used for account invoices.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage invoicePrefix(String invoicePrefix) { + this.invoicePrefix = Optional.ofNullable(invoicePrefix); + return this; + } + + /** + *

Prefix used for account invoices.

+ */ + @java.lang.Override + @JsonSetter(value = "invoice_prefix", nulls = Nulls.SKIP) + public _FinalStage invoicePrefix(Optional invoicePrefix) { + this.invoicePrefix = invoicePrefix; + return this; + } + + /** + *

Specific industry vertical for the account. See the business types and industries glossary for valid values.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage industryType(Nullable industryType) { + if (industryType.isNull()) { + this.industryType = null; + } else if (industryType.isEmpty()) { + this.industryType = Optional.empty(); + } else { + this.industryType = Optional.of(industryType.get()); + } + return this; + } + + /** + *

Specific industry vertical for the account. See the business types and industries glossary for valid values.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage industryType(String industryType) { + this.industryType = Optional.ofNullable(industryType); + return this; + } + + /** + *

Specific industry vertical for the account. See the business types and industries glossary for valid values.

+ */ + @java.lang.Override + @JsonSetter(value = "industry_type", nulls = Nulls.SKIP) + public _FinalStage industryType(Optional industryType) { + this.industryType = industryType; + return this; + } + + /** + *

Account industry group. See the business types and industries glossary for valid values.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage industryGroup(Nullable industryGroup) { + if (industryGroup.isNull()) { + this.industryGroup = null; + } else if (industryGroup.isEmpty()) { + this.industryGroup = Optional.empty(); + } else { + this.industryGroup = Optional.of(industryGroup.get()); + } + return this; + } + + /** + *

Account industry group. See the business types and industries glossary for valid values.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage industryGroup(AccountIndustryGroup industryGroup) { + this.industryGroup = Optional.ofNullable(industryGroup); + return this; + } + + /** + *

Account industry group. See the business types and industries glossary for valid values.

+ */ + @java.lang.Override + @JsonSetter(value = "industry_group", nulls = Nulls.SKIP) + public _FinalStage industryGroup(Optional industryGroup) { + this.industryGroup = industryGroup; + return this; + } + + @java.lang.Override + public _FinalStage addAllHomePreferences(List homePreferences) { + if (homePreferences != null) { + this.homePreferences.addAll(homePreferences); + } + return this; + } + + @java.lang.Override + public _FinalStage addHomePreferences(AccountHomePreferencesItem homePreferences) { + this.homePreferences.add(homePreferences); + return this; + } + + @java.lang.Override + @JsonSetter(value = "home_preferences", nulls = Nulls.SKIP) + public _FinalStage homePreferences(List homePreferences) { + this.homePreferences.clear(); + if (homePreferences != null) { + this.homePreferences.addAll(homePreferences); + } + return this; + } + + /** + *

Account owner email address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

Account owner email address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

Account owner email address.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + /** + *

Account promotional description.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

Account promotional description.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

Account promotional description.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

Country where the account is located.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

Country where the account is located.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

Country where the account is located.

+ */ + @java.lang.Override + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public _FinalStage country(Optional country) { + this.country = country; + return this; + } + + /** + *

Whop Cards application details for the account. Computed only on retrieve and me for callers with company:balance:read scope; null otherwise, or when the account has no card application.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cards(Nullable cards) { + if (cards.isNull()) { + this.cards = null; + } else if (cards.isEmpty()) { + this.cards = Optional.empty(); + } else { + this.cards = Optional.of(cards.get()); + } + return this; + } + + /** + *

Whop Cards application details for the account. Computed only on retrieve and me for callers with company:balance:read scope; null otherwise, or when the account has no card application.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cards(AccountCards cards) { + this.cards = Optional.ofNullable(cards); + return this; + } + + /** + *

Whop Cards application details for the account. Computed only on retrieve and me for callers with company:balance:read scope; null otherwise, or when the account has no card application.

+ */ + @java.lang.Override + @JsonSetter(value = "cards", nulls = Nulls.SKIP) + public _FinalStage cards(Optional cards) { + this.cards = cards; + return this; + } + + /** + *

Payment rails enabled for this account, each active, inactive, or pending (onboarding or review in progress). Computed only on retrieve and me for callers with company:balance:read scope; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage capabilities(Nullable capabilities) { + if (capabilities.isNull()) { + this.capabilities = null; + } else if (capabilities.isEmpty()) { + this.capabilities = Optional.empty(); + } else { + this.capabilities = Optional.of(capabilities.get()); + } + return this; + } + + /** + *

Payment rails enabled for this account, each active, inactive, or pending (onboarding or review in progress). Computed only on retrieve and me for callers with company:balance:read scope; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage capabilities(AccountCapabilities capabilities) { + this.capabilities = Optional.ofNullable(capabilities); + return this; + } + + /** + *

Payment rails enabled for this account, each active, inactive, or pending (onboarding or review in progress). Computed only on retrieve and me for callers with company:balance:read scope; null otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "capabilities", nulls = Nulls.SKIP) + public _FinalStage capabilities(Optional capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + *

High-level business category for the account. See the business types and industries glossary for valid values.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessType(Nullable businessType) { + if (businessType.isNull()) { + this.businessType = null; + } else if (businessType.isEmpty()) { + this.businessType = Optional.empty(); + } else { + this.businessType = Optional.of(businessType.get()); + } + return this; + } + + /** + *

High-level business category for the account. See the business types and industries glossary for valid values.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessType(AccountBusinessType businessType) { + this.businessType = Optional.ofNullable(businessType); + return this; + } + + /** + *

High-level business category for the account. See the business types and industries glossary for valid values.

+ */ + @java.lang.Override + @JsonSetter(value = "business_type", nulls = Nulls.SKIP) + public _FinalStage businessType(Optional businessType) { + this.businessType = businessType; + return this; + } + + /** + *

The account's legal business name used with its tax address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessName(Nullable businessName) { + if (businessName.isNull()) { + this.businessName = null; + } else if (businessName.isEmpty()) { + this.businessName = Optional.empty(); + } else { + this.businessName = Optional.of(businessName.get()); + } + return this; + } + + /** + *

The account's legal business name used with its tax address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessName(String businessName) { + this.businessName = Optional.ofNullable(businessName); + return this; + } + + /** + *

The account's legal business name used with its tax address.

+ */ + @java.lang.Override + @JsonSetter(value = "business_name", nulls = Nulls.SKIP) + public _FinalStage businessName(Optional businessName) { + this.businessName = businessName; + return this; + } + + /** + *

Account business address used to calculate tax, with line1, line2, city, state, postal_code, and country. null when no address is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessAddress(Nullable> businessAddress) { + if (businessAddress.isNull()) { + this.businessAddress = null; + } else if (businessAddress.isEmpty()) { + this.businessAddress = Optional.empty(); + } else { + this.businessAddress = Optional.of(businessAddress.get()); + } + return this; + } + + /** + *

Account business address used to calculate tax, with line1, line2, city, state, postal_code, and country. null when no address is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessAddress(Map businessAddress) { + this.businessAddress = Optional.ofNullable(businessAddress); + return this; + } + + /** + *

Account business address used to calculate tax, with line1, line2, city, state, postal_code, and country. null when no address is set.

+ */ + @java.lang.Override + @JsonSetter(value = "business_address", nulls = Nulls.SKIP) + public _FinalStage businessAddress(Optional> businessAddress) { + this.businessAddress = businessAddress; + return this; + } + + /** + *

Account banner image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bannerImageUrl(Nullable bannerImageUrl) { + if (bannerImageUrl.isNull()) { + this.bannerImageUrl = null; + } else if (bannerImageUrl.isEmpty()) { + this.bannerImageUrl = Optional.empty(); + } else { + this.bannerImageUrl = Optional.of(bannerImageUrl.get()); + } + return this; + } + + /** + *

Account banner image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bannerImageUrl(String bannerImageUrl) { + this.bannerImageUrl = Optional.ofNullable(bannerImageUrl); + return this; + } + + /** + *

Account banner image URL.

+ */ + @java.lang.Override + @JsonSetter(value = "banner_image_url", nulls = Nulls.SKIP) + public _FinalStage bannerImageUrl(Optional bannerImageUrl) { + this.bannerImageUrl = bannerImageUrl; + return this; + } + + @java.lang.Override + public _FinalStage addAllBalances(List balances) { + if (balances != null) { + this.balances.addAll(balances); + } + return this; + } + + @java.lang.Override + public _FinalStage addBalances(AccountBalanceToken balances) { + this.balances.add(balances); + return this; + } + + @java.lang.Override + @JsonSetter(value = "balances", nulls = Nulls.SKIP) + public _FinalStage balances(List balances) { + this.balances.clear(); + if (balances != null) { + this.balances.addAll(balances); + } + return this; + } + + @java.lang.Override + public Account build() { + return new Account( + balances, + bannerImageUrl, + businessAddress, + businessName, + businessType, + canTransferPendingBalanceToChildren, + capabilities, + cards, + collectVatId, + companyFormation, + country, + createdAt, + description, + email, + homePreferences, + id, + industryGroup, + industryType, + invoicePrefix, + logoUrl, + metadata, + onboardingType, + opengraphImageUrl, + opengraphImageVariant, + otherBusinessDescription, + otherIndustryDescription, + owner, + parentAccount, + paymentControls, + productTaxCode, + recommendedActions, + require2Fa, + requiredActions, + route, + sendCustomerEmails, + showJoinedWhops, + showReviewsDtc, + showUserDirectory, + socialLinks, + stablecoinRails, + status, + statusReason, + storePageConfig, + targetAudience, + taxCollectionEnabledStates, + taxIdentifiers, + taxRemittedBy, + taxType, + threeDsLevel, + title, + totalEarnedUsd, + totalUsd, + useLogoAsOpengraphImageFallback, + verification, + volumeUsd, + wallet, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountBalanceBreakdown.java b/src/main/java/com/whop/api/types/AccountBalanceBreakdown.java new file mode 100644 index 00000000..5465f88b --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountBalanceBreakdown.java @@ -0,0 +1,284 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountBalanceBreakdown.Builder.class) +public final class AccountBalanceBreakdown { + private final String available; + + private final String inTransit; + + private final String pending; + + private final List pendingSettlements; + + private final String reserve; + + private final Map additionalProperties; + + private AccountBalanceBreakdown( + String available, + String inTransit, + String pending, + List pendingSettlements, + String reserve, + Map additionalProperties) { + this.available = available; + this.inTransit = inTransit; + this.pending = pending; + this.pendingSettlements = pendingSettlements; + this.reserve = reserve; + this.additionalProperties = additionalProperties; + } + + /** + * @return Amount you can spend, send, or withdraw now, in native units, as a decimal string. + */ + @JsonProperty("available") + public String getAvailable() { + return available; + } + + /** + * @return Amount moving between the account's own destinations, such as a treasury sweep to its crypto wallet or a card top-up. In native units, as a decimal string. + */ + @JsonProperty("in_transit") + public String getInTransit() { + return inTransit; + } + + /** + * @return Amount from recent payments still settling, in native units, as a decimal string. + */ + @JsonProperty("pending") + public String getPending() { + return pending; + } + + @JsonProperty("pending_settlements") + public List getPendingSettlements() { + return pendingSettlements; + } + + /** + * @return Amount held back, in native units, as a decimal string. Retrieve the account's reserves for why it is held and when it unlocks. + */ + @JsonProperty("reserve") + public String getReserve() { + return reserve; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountBalanceBreakdown && equalTo((AccountBalanceBreakdown) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountBalanceBreakdown other) { + return available.equals(other.available) + && inTransit.equals(other.inTransit) + && pending.equals(other.pending) + && pendingSettlements.equals(other.pendingSettlements) + && reserve.equals(other.reserve); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.available, this.inTransit, this.pending, this.pendingSettlements, this.reserve); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AvailableStage builder() { + return new Builder(); + } + + public interface AvailableStage { + /** + *

Amount you can spend, send, or withdraw now, in native units, as a decimal string.

+ */ + InTransitStage available(@NotNull String available); + + Builder from(AccountBalanceBreakdown other); + } + + public interface InTransitStage { + /** + *

Amount moving between the account's own destinations, such as a treasury sweep to its crypto wallet or a card top-up. In native units, as a decimal string.

+ */ + PendingStage inTransit(@NotNull String inTransit); + } + + public interface PendingStage { + /** + *

Amount from recent payments still settling, in native units, as a decimal string.

+ */ + ReserveStage pending(@NotNull String pending); + } + + public interface ReserveStage { + /** + *

Amount held back, in native units, as a decimal string. Retrieve the account's reserves for why it is held and when it unlocks.

+ */ + _FinalStage reserve(@NotNull String reserve); + } + + public interface _FinalStage { + AccountBalanceBreakdown build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage pendingSettlements(List pendingSettlements); + + _FinalStage addPendingSettlements(AccountBalanceSettlement pendingSettlements); + + _FinalStage addAllPendingSettlements(List pendingSettlements); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AvailableStage, InTransitStage, PendingStage, ReserveStage, _FinalStage { + private String available; + + private String inTransit; + + private String pending; + + private String reserve; + + private List pendingSettlements = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountBalanceBreakdown other) { + available(other.getAvailable()); + inTransit(other.getInTransit()); + pending(other.getPending()); + pendingSettlements(other.getPendingSettlements()); + reserve(other.getReserve()); + return this; + } + + /** + *

Amount you can spend, send, or withdraw now, in native units, as a decimal string.

+ *

Amount you can spend, send, or withdraw now, in native units, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("available") + public InTransitStage available(@NotNull String available) { + this.available = Objects.requireNonNull(available, "available must not be null"); + return this; + } + + /** + *

Amount moving between the account's own destinations, such as a treasury sweep to its crypto wallet or a card top-up. In native units, as a decimal string.

+ *

Amount moving between the account's own destinations, such as a treasury sweep to its crypto wallet or a card top-up. In native units, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("in_transit") + public PendingStage inTransit(@NotNull String inTransit) { + this.inTransit = Objects.requireNonNull(inTransit, "inTransit must not be null"); + return this; + } + + /** + *

Amount from recent payments still settling, in native units, as a decimal string.

+ *

Amount from recent payments still settling, in native units, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("pending") + public ReserveStage pending(@NotNull String pending) { + this.pending = Objects.requireNonNull(pending, "pending must not be null"); + return this; + } + + /** + *

Amount held back, in native units, as a decimal string. Retrieve the account's reserves for why it is held and when it unlocks.

+ *

Amount held back, in native units, as a decimal string. Retrieve the account's reserves for why it is held and when it unlocks.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reserve") + public _FinalStage reserve(@NotNull String reserve) { + this.reserve = Objects.requireNonNull(reserve, "reserve must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllPendingSettlements(List pendingSettlements) { + if (pendingSettlements != null) { + this.pendingSettlements.addAll(pendingSettlements); + } + return this; + } + + @java.lang.Override + public _FinalStage addPendingSettlements(AccountBalanceSettlement pendingSettlements) { + this.pendingSettlements.add(pendingSettlements); + return this; + } + + @java.lang.Override + @JsonSetter(value = "pending_settlements", nulls = Nulls.SKIP) + public _FinalStage pendingSettlements(List pendingSettlements) { + this.pendingSettlements.clear(); + if (pendingSettlements != null) { + this.pendingSettlements.addAll(pendingSettlements); + } + return this; + } + + @java.lang.Override + public AccountBalanceBreakdown build() { + return new AccountBalanceBreakdown( + available, inTransit, pending, pendingSettlements, reserve, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountBalanceSettlement.java b/src/main/java/com/whop/api/types/AccountBalanceSettlement.java new file mode 100644 index 00000000..7a15a6cc --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountBalanceSettlement.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountBalanceSettlement.Builder.class) +public final class AccountBalanceSettlement { + private final String amount; + + private final String date; + + private final Map additionalProperties; + + private AccountBalanceSettlement(String amount, String date, Map additionalProperties) { + this.amount = amount; + this.date = date; + this.additionalProperties = additionalProperties; + } + + /** + * @return Amount expected that day, in native units, as a decimal string. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + /** + * @return The day this money is expected to finish settling, as an ISO 8601 date. + */ + @JsonProperty("date") + public String getDate() { + return date; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountBalanceSettlement && equalTo((AccountBalanceSettlement) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountBalanceSettlement other) { + return amount.equals(other.amount) && date.equals(other.date); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.date); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

Amount expected that day, in native units, as a decimal string.

+ */ + DateStage amount(@NotNull String amount); + + Builder from(AccountBalanceSettlement other); + } + + public interface DateStage { + /** + *

The day this money is expected to finish settling, as an ISO 8601 date.

+ */ + _FinalStage date(@NotNull String date); + } + + public interface _FinalStage { + AccountBalanceSettlement build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, DateStage, _FinalStage { + private String amount; + + private String date; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountBalanceSettlement other) { + amount(other.getAmount()); + date(other.getDate()); + return this; + } + + /** + *

Amount expected that day, in native units, as a decimal string.

+ *

Amount expected that day, in native units, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public DateStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

The day this money is expected to finish settling, as an ISO 8601 date.

+ *

The day this money is expected to finish settling, as an ISO 8601 date.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("date") + public _FinalStage date(@NotNull String date) { + this.date = Objects.requireNonNull(date, "date must not be null"); + return this; + } + + @java.lang.Override + public AccountBalanceSettlement build() { + return new AccountBalanceSettlement(amount, date, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountBalanceToken.java b/src/main/java/com/whop/api/types/AccountBalanceToken.java new file mode 100644 index 00000000..d03feafa --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountBalanceToken.java @@ -0,0 +1,453 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountBalanceToken.Builder.class) +public final class AccountBalanceToken { + private final String balance; + + private final AccountBalanceBreakdown breakdown; + + private final Optional iconUrl; + + private final String name; + + private final Optional priceUsd; + + private final String symbol; + + private final Optional valueUsd; + + private final Map additionalProperties; + + private AccountBalanceToken( + String balance, + AccountBalanceBreakdown breakdown, + Optional iconUrl, + String name, + Optional priceUsd, + String symbol, + Optional valueUsd, + Map additionalProperties) { + this.balance = balance; + this.breakdown = breakdown; + this.iconUrl = iconUrl; + this.name = name; + this.priceUsd = priceUsd; + this.symbol = symbol; + this.valueUsd = valueUsd; + this.additionalProperties = additionalProperties; + } + + /** + * @return Total amount held in native units, as a decimal string. + */ + @JsonProperty("balance") + public String getBalance() { + return balance; + } + + /** + * @return Balance split into available, pending, and reserve amounts, as native-unit decimal strings, with the days the pending amount is expected to settle. On-chain crypto is entirely available; good_funds and fiat cash can have pending or reserve portions. + */ + @JsonProperty("breakdown") + public AccountBalanceBreakdown getBreakdown() { + return breakdown; + } + + /** + * @return Holding icon URL. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return The holding's display name + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return USD price per unit, or null when no exchange rate is available. + */ + @JsonIgnore + public Optional getPriceUsd() { + if (priceUsd == null) { + return Optional.empty(); + } + return priceUsd; + } + + /** + * @return Holding display symbol, such as USDT, cbBTC, or EUR. + */ + @JsonProperty("symbol") + public String getSymbol() { + return symbol; + } + + /** + * @return Holding USD value, or null when no exchange rate is available. + */ + @JsonIgnore + public Optional getValueUsd() { + if (valueUsd == null) { + return Optional.empty(); + } + return valueUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("price_usd") + private Optional _getPriceUsd() { + return priceUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("value_usd") + private Optional _getValueUsd() { + return valueUsd; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountBalanceToken && equalTo((AccountBalanceToken) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountBalanceToken other) { + return balance.equals(other.balance) + && breakdown.equals(other.breakdown) + && iconUrl.equals(other.iconUrl) + && name.equals(other.name) + && priceUsd.equals(other.priceUsd) + && symbol.equals(other.symbol) + && valueUsd.equals(other.valueUsd); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.balance, this.breakdown, this.iconUrl, this.name, this.priceUsd, this.symbol, this.valueUsd); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BalanceStage builder() { + return new Builder(); + } + + public interface BalanceStage { + /** + *

Total amount held in native units, as a decimal string.

+ */ + BreakdownStage balance(@NotNull String balance); + + Builder from(AccountBalanceToken other); + } + + public interface BreakdownStage { + /** + *

Balance split into available, pending, and reserve amounts, as native-unit decimal strings, with the days the pending amount is expected to settle. On-chain crypto is entirely available; good_funds and fiat cash can have pending or reserve portions.

+ */ + NameStage breakdown(@NotNull AccountBalanceBreakdown breakdown); + } + + public interface NameStage { + /** + *

The holding's display name

+ */ + SymbolStage name(@NotNull String name); + } + + public interface SymbolStage { + /** + *

Holding display symbol, such as USDT, cbBTC, or EUR.

+ */ + _FinalStage symbol(@NotNull String symbol); + } + + public interface _FinalStage { + AccountBalanceToken build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Holding icon URL.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

USD price per unit, or null when no exchange rate is available.

+ */ + _FinalStage priceUsd(Optional priceUsd); + + _FinalStage priceUsd(Double priceUsd); + + _FinalStage priceUsd(Nullable priceUsd); + + /** + *

Holding USD value, or null when no exchange rate is available.

+ */ + _FinalStage valueUsd(Optional valueUsd); + + _FinalStage valueUsd(String valueUsd); + + _FinalStage valueUsd(Nullable valueUsd); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BalanceStage, BreakdownStage, NameStage, SymbolStage, _FinalStage { + private String balance; + + private AccountBalanceBreakdown breakdown; + + private String name; + + private String symbol; + + private Optional valueUsd = Optional.empty(); + + private Optional priceUsd = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountBalanceToken other) { + balance(other.getBalance()); + breakdown(other.getBreakdown()); + iconUrl(other.getIconUrl()); + name(other.getName()); + priceUsd(other.getPriceUsd()); + symbol(other.getSymbol()); + valueUsd(other.getValueUsd()); + return this; + } + + /** + *

Total amount held in native units, as a decimal string.

+ *

Total amount held in native units, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("balance") + public BreakdownStage balance(@NotNull String balance) { + this.balance = Objects.requireNonNull(balance, "balance must not be null"); + return this; + } + + /** + *

Balance split into available, pending, and reserve amounts, as native-unit decimal strings, with the days the pending amount is expected to settle. On-chain crypto is entirely available; good_funds and fiat cash can have pending or reserve portions.

+ *

Balance split into available, pending, and reserve amounts, as native-unit decimal strings, with the days the pending amount is expected to settle. On-chain crypto is entirely available; good_funds and fiat cash can have pending or reserve portions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("breakdown") + public NameStage breakdown(@NotNull AccountBalanceBreakdown breakdown) { + this.breakdown = Objects.requireNonNull(breakdown, "breakdown must not be null"); + return this; + } + + /** + *

The holding's display name

+ *

The holding's display name

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public SymbolStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

Holding display symbol, such as USDT, cbBTC, or EUR.

+ *

Holding display symbol, such as USDT, cbBTC, or EUR.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("symbol") + public _FinalStage symbol(@NotNull String symbol) { + this.symbol = Objects.requireNonNull(symbol, "symbol must not be null"); + return this; + } + + /** + *

Holding USD value, or null when no exchange rate is available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage valueUsd(Nullable valueUsd) { + if (valueUsd.isNull()) { + this.valueUsd = null; + } else if (valueUsd.isEmpty()) { + this.valueUsd = Optional.empty(); + } else { + this.valueUsd = Optional.of(valueUsd.get()); + } + return this; + } + + /** + *

Holding USD value, or null when no exchange rate is available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage valueUsd(String valueUsd) { + this.valueUsd = Optional.ofNullable(valueUsd); + return this; + } + + /** + *

Holding USD value, or null when no exchange rate is available.

+ */ + @java.lang.Override + @JsonSetter(value = "value_usd", nulls = Nulls.SKIP) + public _FinalStage valueUsd(Optional valueUsd) { + this.valueUsd = valueUsd; + return this; + } + + /** + *

USD price per unit, or null when no exchange rate is available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage priceUsd(Nullable priceUsd) { + if (priceUsd.isNull()) { + this.priceUsd = null; + } else if (priceUsd.isEmpty()) { + this.priceUsd = Optional.empty(); + } else { + this.priceUsd = Optional.of(priceUsd.get()); + } + return this; + } + + /** + *

USD price per unit, or null when no exchange rate is available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage priceUsd(Double priceUsd) { + this.priceUsd = Optional.ofNullable(priceUsd); + return this; + } + + /** + *

USD price per unit, or null when no exchange rate is available.

+ */ + @java.lang.Override + @JsonSetter(value = "price_usd", nulls = Nulls.SKIP) + public _FinalStage priceUsd(Optional priceUsd) { + this.priceUsd = priceUsd; + return this; + } + + /** + *

Holding icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Holding icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Holding icon URL.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + @java.lang.Override + public AccountBalanceToken build() { + return new AccountBalanceToken( + balance, breakdown, iconUrl, name, priceUsd, symbol, valueUsd, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountBusinessType.java b/src/main/java/com/whop/api/types/AccountBusinessType.java new file mode 100644 index 00000000..f5000e0a --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountBusinessType.java @@ -0,0 +1,269 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountBusinessType { + public static final AccountBusinessType SERVICES = new AccountBusinessType(Value.SERVICES, "services"); + + public static final AccountBusinessType TELEHEALTH = new AccountBusinessType(Value.TELEHEALTH, "telehealth"); + + public static final AccountBusinessType COMMUNITY = new AccountBusinessType(Value.COMMUNITY, "community"); + + public static final AccountBusinessType BRICK_AND_MORTAR = + new AccountBusinessType(Value.BRICK_AND_MORTAR, "brick_and_mortar"); + + public static final AccountBusinessType EDUCATION_PROGRAM = + new AccountBusinessType(Value.EDUCATION_PROGRAM, "education_program"); + + public static final AccountBusinessType PAID_GROUP = new AccountBusinessType(Value.PAID_GROUP, "paid_group"); + + public static final AccountBusinessType PHYSICAL_PRODUCT = + new AccountBusinessType(Value.PHYSICAL_PRODUCT, "physical_product"); + + public static final AccountBusinessType COACHING = new AccountBusinessType(Value.COACHING, "coaching"); + + public static final AccountBusinessType SOFTWARE = new AccountBusinessType(Value.SOFTWARE, "software"); + + public static final AccountBusinessType GIG_ECONOMY = new AccountBusinessType(Value.GIG_ECONOMY, "gig_economy"); + + public static final AccountBusinessType SAAS = new AccountBusinessType(Value.SAAS, "saas"); + + public static final AccountBusinessType COACHING_AND_COURSES = + new AccountBusinessType(Value.COACHING_AND_COURSES, "coaching_and_courses"); + + public static final AccountBusinessType OTHER = new AccountBusinessType(Value.OTHER, "other"); + + public static final AccountBusinessType NEWSLETTER = new AccountBusinessType(Value.NEWSLETTER, "newsletter"); + + public static final AccountBusinessType AGENCY = new AccountBusinessType(Value.AGENCY, "agency"); + + public static final AccountBusinessType MARKETPLACE = new AccountBusinessType(Value.MARKETPLACE, "marketplace"); + + public static final AccountBusinessType PHYSICAL_PRODUCTS = + new AccountBusinessType(Value.PHYSICAL_PRODUCTS, "physical_products"); + + public static final AccountBusinessType EVENTS = new AccountBusinessType(Value.EVENTS, "events"); + + public static final AccountBusinessType CLASS_ACTION_SETTLEMENT = + new AccountBusinessType(Value.CLASS_ACTION_SETTLEMENT, "class_action_settlement"); + + public static final AccountBusinessType COURSE = new AccountBusinessType(Value.COURSE, "course"); + + private final Value value; + + private final String string; + + AccountBusinessType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountBusinessType && this.string.equals(((AccountBusinessType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SERVICES: + return visitor.visitServices(); + case TELEHEALTH: + return visitor.visitTelehealth(); + case COMMUNITY: + return visitor.visitCommunity(); + case BRICK_AND_MORTAR: + return visitor.visitBrickAndMortar(); + case EDUCATION_PROGRAM: + return visitor.visitEducationProgram(); + case PAID_GROUP: + return visitor.visitPaidGroup(); + case PHYSICAL_PRODUCT: + return visitor.visitPhysicalProduct(); + case COACHING: + return visitor.visitCoaching(); + case SOFTWARE: + return visitor.visitSoftware(); + case GIG_ECONOMY: + return visitor.visitGigEconomy(); + case SAAS: + return visitor.visitSaas(); + case COACHING_AND_COURSES: + return visitor.visitCoachingAndCourses(); + case OTHER: + return visitor.visitOther(); + case NEWSLETTER: + return visitor.visitNewsletter(); + case AGENCY: + return visitor.visitAgency(); + case MARKETPLACE: + return visitor.visitMarketplace(); + case PHYSICAL_PRODUCTS: + return visitor.visitPhysicalProducts(); + case EVENTS: + return visitor.visitEvents(); + case CLASS_ACTION_SETTLEMENT: + return visitor.visitClassActionSettlement(); + case COURSE: + return visitor.visitCourse(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountBusinessType valueOf(String value) { + switch (value) { + case "services": + return SERVICES; + case "telehealth": + return TELEHEALTH; + case "community": + return COMMUNITY; + case "brick_and_mortar": + return BRICK_AND_MORTAR; + case "education_program": + return EDUCATION_PROGRAM; + case "paid_group": + return PAID_GROUP; + case "physical_product": + return PHYSICAL_PRODUCT; + case "coaching": + return COACHING; + case "software": + return SOFTWARE; + case "gig_economy": + return GIG_ECONOMY; + case "saas": + return SAAS; + case "coaching_and_courses": + return COACHING_AND_COURSES; + case "other": + return OTHER; + case "newsletter": + return NEWSLETTER; + case "agency": + return AGENCY; + case "marketplace": + return MARKETPLACE; + case "physical_products": + return PHYSICAL_PRODUCTS; + case "events": + return EVENTS; + case "class_action_settlement": + return CLASS_ACTION_SETTLEMENT; + case "course": + return COURSE; + default: + return new AccountBusinessType(Value.UNKNOWN, value); + } + } + + public enum Value { + EDUCATION_PROGRAM, + + COACHING, + + SOFTWARE, + + PAID_GROUP, + + NEWSLETTER, + + AGENCY, + + PHYSICAL_PRODUCTS, + + BRICK_AND_MORTAR, + + EVENTS, + + COACHING_AND_COURSES, + + OTHER, + + SERVICES, + + GIG_ECONOMY, + + MARKETPLACE, + + TELEHEALTH, + + CLASS_ACTION_SETTLEMENT, + + PHYSICAL_PRODUCT, + + SAAS, + + COURSE, + + COMMUNITY, + + UNKNOWN + } + + public interface Visitor { + T visitEducationProgram(); + + T visitCoaching(); + + T visitSoftware(); + + T visitPaidGroup(); + + T visitNewsletter(); + + T visitAgency(); + + T visitPhysicalProducts(); + + T visitBrickAndMortar(); + + T visitEvents(); + + T visitCoachingAndCourses(); + + T visitOther(); + + T visitServices(); + + T visitGigEconomy(); + + T visitMarketplace(); + + T visitTelehealth(); + + T visitClassActionSettlement(); + + T visitPhysicalProduct(); + + T visitSaas(); + + T visitCourse(); + + T visitCommunity(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCapabilities.java b/src/main/java/com/whop/api/types/AccountCapabilities.java new file mode 100644 index 00000000..dfe722de --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCapabilities.java @@ -0,0 +1,556 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountCapabilities.Builder.class) +public final class AccountCapabilities { + private final AccountCapabilitiesAcceptBankPayments acceptBankPayments; + + private final AccountCapabilitiesAcceptBnplPayments acceptBnplPayments; + + private final AccountCapabilitiesAcceptCardPayments acceptCardPayments; + + private final AccountCapabilitiesBankDeposit bankDeposit; + + private final AccountCapabilitiesCardDeposit cardDeposit; + + private final AccountCapabilitiesCardIssuing cardIssuing; + + private final AccountCapabilitiesCryptoDeposit cryptoDeposit; + + private final AccountCapabilitiesCryptoPayout cryptoPayout; + + private final AccountCapabilitiesInstantPayout instantPayout; + + private final AccountCapabilitiesRunAds runAds; + + private final AccountCapabilitiesStandardPayout standardPayout; + + private final AccountCapabilitiesTransfer transfer; + + private final Map additionalProperties; + + private AccountCapabilities( + AccountCapabilitiesAcceptBankPayments acceptBankPayments, + AccountCapabilitiesAcceptBnplPayments acceptBnplPayments, + AccountCapabilitiesAcceptCardPayments acceptCardPayments, + AccountCapabilitiesBankDeposit bankDeposit, + AccountCapabilitiesCardDeposit cardDeposit, + AccountCapabilitiesCardIssuing cardIssuing, + AccountCapabilitiesCryptoDeposit cryptoDeposit, + AccountCapabilitiesCryptoPayout cryptoPayout, + AccountCapabilitiesInstantPayout instantPayout, + AccountCapabilitiesRunAds runAds, + AccountCapabilitiesStandardPayout standardPayout, + AccountCapabilitiesTransfer transfer, + Map additionalProperties) { + this.acceptBankPayments = acceptBankPayments; + this.acceptBnplPayments = acceptBnplPayments; + this.acceptCardPayments = acceptCardPayments; + this.bankDeposit = bankDeposit; + this.cardDeposit = cardDeposit; + this.cardIssuing = cardIssuing; + this.cryptoDeposit = cryptoDeposit; + this.cryptoPayout = cryptoPayout; + this.instantPayout = instantPayout; + this.runAds = runAds; + this.standardPayout = standardPayout; + this.transfer = transfer; + this.additionalProperties = additionalProperties; + } + + /** + * @return Bank payins: debits, transfers, and local bank rails + */ + @JsonProperty("accept_bank_payments") + public AccountCapabilitiesAcceptBankPayments getAcceptBankPayments() { + return acceptBankPayments; + } + + /** + * @return Buy-now-pay-later payins; requires approval + */ + @JsonProperty("accept_bnpl_payments") + public AccountCapabilitiesAcceptBnplPayments getAcceptBnplPayments() { + return acceptBnplPayments; + } + + /** + * @return Card payins, including Apple Pay and Google Pay + */ + @JsonProperty("accept_card_payments") + public AccountCapabilitiesAcceptCardPayments getAcceptCardPayments() { + return acceptCardPayments; + } + + /** + * @return Deposits by bank wire or ACH to the account's virtual bank account + */ + @JsonProperty("bank_deposit") + public AccountCapabilitiesBankDeposit getBankDeposit() { + return bankDeposit; + } + + /** + * @return Balance top-ups by charging a stored payment method + */ + @JsonProperty("card_deposit") + public AccountCapabilitiesCardDeposit getCardDeposit() { + return cardDeposit; + } + + /** + * @return Issuing Whop cards; requires card application approval + */ + @JsonProperty("card_issuing") + public AccountCapabilitiesCardIssuing getCardIssuing() { + return cardIssuing; + } + + /** + * @return On-chain deposits to the account's crypto wallet + */ + @JsonProperty("crypto_deposit") + public AccountCapabilitiesCryptoDeposit getCryptoDeposit() { + return cryptoDeposit; + } + + /** + * @return On-chain payouts to a crypto wallet + */ + @JsonProperty("crypto_payout") + public AccountCapabilitiesCryptoPayout getCryptoPayout() { + return cryptoPayout; + } + + /** + * @return Instant payouts to an eligible payout destination + */ + @JsonProperty("instant_payout") + public AccountCapabilitiesInstantPayout getInstantPayout() { + return instantPayout; + } + + /** + * @return Launching ad campaigns through Whop Ads. inactive while a requested ads services agreement is awaiting the account's signature. + */ + @JsonProperty("run_ads") + public AccountCapabilitiesRunAds getRunAds() { + return runAds; + } + + /** + * @return Standard payouts to an external payout destination + */ + @JsonProperty("standard_payout") + public AccountCapabilitiesStandardPayout getStandardPayout() { + return standardPayout; + } + + /** + * @return Transfers to other accounts + */ + @JsonProperty("transfer") + public AccountCapabilitiesTransfer getTransfer() { + return transfer; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountCapabilities && equalTo((AccountCapabilities) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountCapabilities other) { + return acceptBankPayments.equals(other.acceptBankPayments) + && acceptBnplPayments.equals(other.acceptBnplPayments) + && acceptCardPayments.equals(other.acceptCardPayments) + && bankDeposit.equals(other.bankDeposit) + && cardDeposit.equals(other.cardDeposit) + && cardIssuing.equals(other.cardIssuing) + && cryptoDeposit.equals(other.cryptoDeposit) + && cryptoPayout.equals(other.cryptoPayout) + && instantPayout.equals(other.instantPayout) + && runAds.equals(other.runAds) + && standardPayout.equals(other.standardPayout) + && transfer.equals(other.transfer); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.acceptBankPayments, + this.acceptBnplPayments, + this.acceptCardPayments, + this.bankDeposit, + this.cardDeposit, + this.cardIssuing, + this.cryptoDeposit, + this.cryptoPayout, + this.instantPayout, + this.runAds, + this.standardPayout, + this.transfer); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AcceptBankPaymentsStage builder() { + return new Builder(); + } + + public interface AcceptBankPaymentsStage { + /** + *

Bank payins: debits, transfers, and local bank rails

+ */ + AcceptBnplPaymentsStage acceptBankPayments(@NotNull AccountCapabilitiesAcceptBankPayments acceptBankPayments); + + Builder from(AccountCapabilities other); + } + + public interface AcceptBnplPaymentsStage { + /** + *

Buy-now-pay-later payins; requires approval

+ */ + AcceptCardPaymentsStage acceptBnplPayments(@NotNull AccountCapabilitiesAcceptBnplPayments acceptBnplPayments); + } + + public interface AcceptCardPaymentsStage { + /** + *

Card payins, including Apple Pay and Google Pay

+ */ + BankDepositStage acceptCardPayments(@NotNull AccountCapabilitiesAcceptCardPayments acceptCardPayments); + } + + public interface BankDepositStage { + /** + *

Deposits by bank wire or ACH to the account's virtual bank account

+ */ + CardDepositStage bankDeposit(@NotNull AccountCapabilitiesBankDeposit bankDeposit); + } + + public interface CardDepositStage { + /** + *

Balance top-ups by charging a stored payment method

+ */ + CardIssuingStage cardDeposit(@NotNull AccountCapabilitiesCardDeposit cardDeposit); + } + + public interface CardIssuingStage { + /** + *

Issuing Whop cards; requires card application approval

+ */ + CryptoDepositStage cardIssuing(@NotNull AccountCapabilitiesCardIssuing cardIssuing); + } + + public interface CryptoDepositStage { + /** + *

On-chain deposits to the account's crypto wallet

+ */ + CryptoPayoutStage cryptoDeposit(@NotNull AccountCapabilitiesCryptoDeposit cryptoDeposit); + } + + public interface CryptoPayoutStage { + /** + *

On-chain payouts to a crypto wallet

+ */ + InstantPayoutStage cryptoPayout(@NotNull AccountCapabilitiesCryptoPayout cryptoPayout); + } + + public interface InstantPayoutStage { + /** + *

Instant payouts to an eligible payout destination

+ */ + RunAdsStage instantPayout(@NotNull AccountCapabilitiesInstantPayout instantPayout); + } + + public interface RunAdsStage { + /** + *

Launching ad campaigns through Whop Ads. inactive while a requested ads services agreement is awaiting the account's signature.

+ */ + StandardPayoutStage runAds(@NotNull AccountCapabilitiesRunAds runAds); + } + + public interface StandardPayoutStage { + /** + *

Standard payouts to an external payout destination

+ */ + TransferStage standardPayout(@NotNull AccountCapabilitiesStandardPayout standardPayout); + } + + public interface TransferStage { + /** + *

Transfers to other accounts

+ */ + _FinalStage transfer(@NotNull AccountCapabilitiesTransfer transfer); + } + + public interface _FinalStage { + AccountCapabilities build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AcceptBankPaymentsStage, + AcceptBnplPaymentsStage, + AcceptCardPaymentsStage, + BankDepositStage, + CardDepositStage, + CardIssuingStage, + CryptoDepositStage, + CryptoPayoutStage, + InstantPayoutStage, + RunAdsStage, + StandardPayoutStage, + TransferStage, + _FinalStage { + private AccountCapabilitiesAcceptBankPayments acceptBankPayments; + + private AccountCapabilitiesAcceptBnplPayments acceptBnplPayments; + + private AccountCapabilitiesAcceptCardPayments acceptCardPayments; + + private AccountCapabilitiesBankDeposit bankDeposit; + + private AccountCapabilitiesCardDeposit cardDeposit; + + private AccountCapabilitiesCardIssuing cardIssuing; + + private AccountCapabilitiesCryptoDeposit cryptoDeposit; + + private AccountCapabilitiesCryptoPayout cryptoPayout; + + private AccountCapabilitiesInstantPayout instantPayout; + + private AccountCapabilitiesRunAds runAds; + + private AccountCapabilitiesStandardPayout standardPayout; + + private AccountCapabilitiesTransfer transfer; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountCapabilities other) { + acceptBankPayments(other.getAcceptBankPayments()); + acceptBnplPayments(other.getAcceptBnplPayments()); + acceptCardPayments(other.getAcceptCardPayments()); + bankDeposit(other.getBankDeposit()); + cardDeposit(other.getCardDeposit()); + cardIssuing(other.getCardIssuing()); + cryptoDeposit(other.getCryptoDeposit()); + cryptoPayout(other.getCryptoPayout()); + instantPayout(other.getInstantPayout()); + runAds(other.getRunAds()); + standardPayout(other.getStandardPayout()); + transfer(other.getTransfer()); + return this; + } + + /** + *

Bank payins: debits, transfers, and local bank rails

+ *

Bank payins: debits, transfers, and local bank rails

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("accept_bank_payments") + public AcceptBnplPaymentsStage acceptBankPayments( + @NotNull AccountCapabilitiesAcceptBankPayments acceptBankPayments) { + this.acceptBankPayments = Objects.requireNonNull(acceptBankPayments, "acceptBankPayments must not be null"); + return this; + } + + /** + *

Buy-now-pay-later payins; requires approval

+ *

Buy-now-pay-later payins; requires approval

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("accept_bnpl_payments") + public AcceptCardPaymentsStage acceptBnplPayments( + @NotNull AccountCapabilitiesAcceptBnplPayments acceptBnplPayments) { + this.acceptBnplPayments = Objects.requireNonNull(acceptBnplPayments, "acceptBnplPayments must not be null"); + return this; + } + + /** + *

Card payins, including Apple Pay and Google Pay

+ *

Card payins, including Apple Pay and Google Pay

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("accept_card_payments") + public BankDepositStage acceptCardPayments(@NotNull AccountCapabilitiesAcceptCardPayments acceptCardPayments) { + this.acceptCardPayments = Objects.requireNonNull(acceptCardPayments, "acceptCardPayments must not be null"); + return this; + } + + /** + *

Deposits by bank wire or ACH to the account's virtual bank account

+ *

Deposits by bank wire or ACH to the account's virtual bank account

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bank_deposit") + public CardDepositStage bankDeposit(@NotNull AccountCapabilitiesBankDeposit bankDeposit) { + this.bankDeposit = Objects.requireNonNull(bankDeposit, "bankDeposit must not be null"); + return this; + } + + /** + *

Balance top-ups by charging a stored payment method

+ *

Balance top-ups by charging a stored payment method

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card_deposit") + public CardIssuingStage cardDeposit(@NotNull AccountCapabilitiesCardDeposit cardDeposit) { + this.cardDeposit = Objects.requireNonNull(cardDeposit, "cardDeposit must not be null"); + return this; + } + + /** + *

Issuing Whop cards; requires card application approval

+ *

Issuing Whop cards; requires card application approval

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card_issuing") + public CryptoDepositStage cardIssuing(@NotNull AccountCapabilitiesCardIssuing cardIssuing) { + this.cardIssuing = Objects.requireNonNull(cardIssuing, "cardIssuing must not be null"); + return this; + } + + /** + *

On-chain deposits to the account's crypto wallet

+ *

On-chain deposits to the account's crypto wallet

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("crypto_deposit") + public CryptoPayoutStage cryptoDeposit(@NotNull AccountCapabilitiesCryptoDeposit cryptoDeposit) { + this.cryptoDeposit = Objects.requireNonNull(cryptoDeposit, "cryptoDeposit must not be null"); + return this; + } + + /** + *

On-chain payouts to a crypto wallet

+ *

On-chain payouts to a crypto wallet

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("crypto_payout") + public InstantPayoutStage cryptoPayout(@NotNull AccountCapabilitiesCryptoPayout cryptoPayout) { + this.cryptoPayout = Objects.requireNonNull(cryptoPayout, "cryptoPayout must not be null"); + return this; + } + + /** + *

Instant payouts to an eligible payout destination

+ *

Instant payouts to an eligible payout destination

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("instant_payout") + public RunAdsStage instantPayout(@NotNull AccountCapabilitiesInstantPayout instantPayout) { + this.instantPayout = Objects.requireNonNull(instantPayout, "instantPayout must not be null"); + return this; + } + + /** + *

Launching ad campaigns through Whop Ads. inactive while a requested ads services agreement is awaiting the account's signature.

+ *

Launching ad campaigns through Whop Ads. inactive while a requested ads services agreement is awaiting the account's signature.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("run_ads") + public StandardPayoutStage runAds(@NotNull AccountCapabilitiesRunAds runAds) { + this.runAds = Objects.requireNonNull(runAds, "runAds must not be null"); + return this; + } + + /** + *

Standard payouts to an external payout destination

+ *

Standard payouts to an external payout destination

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("standard_payout") + public TransferStage standardPayout(@NotNull AccountCapabilitiesStandardPayout standardPayout) { + this.standardPayout = Objects.requireNonNull(standardPayout, "standardPayout must not be null"); + return this; + } + + /** + *

Transfers to other accounts

+ *

Transfers to other accounts

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("transfer") + public _FinalStage transfer(@NotNull AccountCapabilitiesTransfer transfer) { + this.transfer = Objects.requireNonNull(transfer, "transfer must not be null"); + return this; + } + + @java.lang.Override + public AccountCapabilities build() { + return new AccountCapabilities( + acceptBankPayments, + acceptBnplPayments, + acceptCardPayments, + bankDeposit, + cardDeposit, + cardIssuing, + cryptoDeposit, + cryptoPayout, + instantPayout, + runAds, + standardPayout, + transfer, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountCapabilitiesAcceptBankPayments.java b/src/main/java/com/whop/api/types/AccountCapabilitiesAcceptBankPayments.java new file mode 100644 index 00000000..2699053b --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCapabilitiesAcceptBankPayments.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCapabilitiesAcceptBankPayments { + public static final AccountCapabilitiesAcceptBankPayments PENDING = + new AccountCapabilitiesAcceptBankPayments(Value.PENDING, "pending"); + + public static final AccountCapabilitiesAcceptBankPayments INACTIVE = + new AccountCapabilitiesAcceptBankPayments(Value.INACTIVE, "inactive"); + + public static final AccountCapabilitiesAcceptBankPayments ACTIVE = + new AccountCapabilitiesAcceptBankPayments(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AccountCapabilitiesAcceptBankPayments(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCapabilitiesAcceptBankPayments + && this.string.equals(((AccountCapabilitiesAcceptBankPayments) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case INACTIVE: + return visitor.visitInactive(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCapabilitiesAcceptBankPayments valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "inactive": + return INACTIVE; + case "active": + return ACTIVE; + default: + return new AccountCapabilitiesAcceptBankPayments(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCapabilitiesAcceptBnplPayments.java b/src/main/java/com/whop/api/types/AccountCapabilitiesAcceptBnplPayments.java new file mode 100644 index 00000000..027aa657 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCapabilitiesAcceptBnplPayments.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCapabilitiesAcceptBnplPayments { + public static final AccountCapabilitiesAcceptBnplPayments PENDING = + new AccountCapabilitiesAcceptBnplPayments(Value.PENDING, "pending"); + + public static final AccountCapabilitiesAcceptBnplPayments INACTIVE = + new AccountCapabilitiesAcceptBnplPayments(Value.INACTIVE, "inactive"); + + public static final AccountCapabilitiesAcceptBnplPayments ACTIVE = + new AccountCapabilitiesAcceptBnplPayments(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AccountCapabilitiesAcceptBnplPayments(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCapabilitiesAcceptBnplPayments + && this.string.equals(((AccountCapabilitiesAcceptBnplPayments) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case INACTIVE: + return visitor.visitInactive(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCapabilitiesAcceptBnplPayments valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "inactive": + return INACTIVE; + case "active": + return ACTIVE; + default: + return new AccountCapabilitiesAcceptBnplPayments(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCapabilitiesAcceptCardPayments.java b/src/main/java/com/whop/api/types/AccountCapabilitiesAcceptCardPayments.java new file mode 100644 index 00000000..2317b1c3 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCapabilitiesAcceptCardPayments.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCapabilitiesAcceptCardPayments { + public static final AccountCapabilitiesAcceptCardPayments PENDING = + new AccountCapabilitiesAcceptCardPayments(Value.PENDING, "pending"); + + public static final AccountCapabilitiesAcceptCardPayments INACTIVE = + new AccountCapabilitiesAcceptCardPayments(Value.INACTIVE, "inactive"); + + public static final AccountCapabilitiesAcceptCardPayments ACTIVE = + new AccountCapabilitiesAcceptCardPayments(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AccountCapabilitiesAcceptCardPayments(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCapabilitiesAcceptCardPayments + && this.string.equals(((AccountCapabilitiesAcceptCardPayments) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case INACTIVE: + return visitor.visitInactive(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCapabilitiesAcceptCardPayments valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "inactive": + return INACTIVE; + case "active": + return ACTIVE; + default: + return new AccountCapabilitiesAcceptCardPayments(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCapabilitiesBankDeposit.java b/src/main/java/com/whop/api/types/AccountCapabilitiesBankDeposit.java new file mode 100644 index 00000000..bfc37455 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCapabilitiesBankDeposit.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCapabilitiesBankDeposit { + public static final AccountCapabilitiesBankDeposit PENDING = + new AccountCapabilitiesBankDeposit(Value.PENDING, "pending"); + + public static final AccountCapabilitiesBankDeposit INACTIVE = + new AccountCapabilitiesBankDeposit(Value.INACTIVE, "inactive"); + + public static final AccountCapabilitiesBankDeposit ACTIVE = + new AccountCapabilitiesBankDeposit(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AccountCapabilitiesBankDeposit(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCapabilitiesBankDeposit + && this.string.equals(((AccountCapabilitiesBankDeposit) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case INACTIVE: + return visitor.visitInactive(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCapabilitiesBankDeposit valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "inactive": + return INACTIVE; + case "active": + return ACTIVE; + default: + return new AccountCapabilitiesBankDeposit(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCapabilitiesCardDeposit.java b/src/main/java/com/whop/api/types/AccountCapabilitiesCardDeposit.java new file mode 100644 index 00000000..4fb79ba2 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCapabilitiesCardDeposit.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCapabilitiesCardDeposit { + public static final AccountCapabilitiesCardDeposit PENDING = + new AccountCapabilitiesCardDeposit(Value.PENDING, "pending"); + + public static final AccountCapabilitiesCardDeposit INACTIVE = + new AccountCapabilitiesCardDeposit(Value.INACTIVE, "inactive"); + + public static final AccountCapabilitiesCardDeposit ACTIVE = + new AccountCapabilitiesCardDeposit(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AccountCapabilitiesCardDeposit(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCapabilitiesCardDeposit + && this.string.equals(((AccountCapabilitiesCardDeposit) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case INACTIVE: + return visitor.visitInactive(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCapabilitiesCardDeposit valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "inactive": + return INACTIVE; + case "active": + return ACTIVE; + default: + return new AccountCapabilitiesCardDeposit(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCapabilitiesCardIssuing.java b/src/main/java/com/whop/api/types/AccountCapabilitiesCardIssuing.java new file mode 100644 index 00000000..6c930a9f --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCapabilitiesCardIssuing.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCapabilitiesCardIssuing { + public static final AccountCapabilitiesCardIssuing PENDING = + new AccountCapabilitiesCardIssuing(Value.PENDING, "pending"); + + public static final AccountCapabilitiesCardIssuing INACTIVE = + new AccountCapabilitiesCardIssuing(Value.INACTIVE, "inactive"); + + public static final AccountCapabilitiesCardIssuing ACTIVE = + new AccountCapabilitiesCardIssuing(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AccountCapabilitiesCardIssuing(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCapabilitiesCardIssuing + && this.string.equals(((AccountCapabilitiesCardIssuing) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case INACTIVE: + return visitor.visitInactive(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCapabilitiesCardIssuing valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "inactive": + return INACTIVE; + case "active": + return ACTIVE; + default: + return new AccountCapabilitiesCardIssuing(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCapabilitiesCryptoDeposit.java b/src/main/java/com/whop/api/types/AccountCapabilitiesCryptoDeposit.java new file mode 100644 index 00000000..9b3f61be --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCapabilitiesCryptoDeposit.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCapabilitiesCryptoDeposit { + public static final AccountCapabilitiesCryptoDeposit PENDING = + new AccountCapabilitiesCryptoDeposit(Value.PENDING, "pending"); + + public static final AccountCapabilitiesCryptoDeposit INACTIVE = + new AccountCapabilitiesCryptoDeposit(Value.INACTIVE, "inactive"); + + public static final AccountCapabilitiesCryptoDeposit ACTIVE = + new AccountCapabilitiesCryptoDeposit(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AccountCapabilitiesCryptoDeposit(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCapabilitiesCryptoDeposit + && this.string.equals(((AccountCapabilitiesCryptoDeposit) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case INACTIVE: + return visitor.visitInactive(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCapabilitiesCryptoDeposit valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "inactive": + return INACTIVE; + case "active": + return ACTIVE; + default: + return new AccountCapabilitiesCryptoDeposit(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCapabilitiesCryptoPayout.java b/src/main/java/com/whop/api/types/AccountCapabilitiesCryptoPayout.java new file mode 100644 index 00000000..adff84fa --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCapabilitiesCryptoPayout.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCapabilitiesCryptoPayout { + public static final AccountCapabilitiesCryptoPayout PENDING = + new AccountCapabilitiesCryptoPayout(Value.PENDING, "pending"); + + public static final AccountCapabilitiesCryptoPayout INACTIVE = + new AccountCapabilitiesCryptoPayout(Value.INACTIVE, "inactive"); + + public static final AccountCapabilitiesCryptoPayout ACTIVE = + new AccountCapabilitiesCryptoPayout(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AccountCapabilitiesCryptoPayout(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCapabilitiesCryptoPayout + && this.string.equals(((AccountCapabilitiesCryptoPayout) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case INACTIVE: + return visitor.visitInactive(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCapabilitiesCryptoPayout valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "inactive": + return INACTIVE; + case "active": + return ACTIVE; + default: + return new AccountCapabilitiesCryptoPayout(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCapabilitiesInstantPayout.java b/src/main/java/com/whop/api/types/AccountCapabilitiesInstantPayout.java new file mode 100644 index 00000000..ba8ad819 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCapabilitiesInstantPayout.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCapabilitiesInstantPayout { + public static final AccountCapabilitiesInstantPayout PENDING = + new AccountCapabilitiesInstantPayout(Value.PENDING, "pending"); + + public static final AccountCapabilitiesInstantPayout INACTIVE = + new AccountCapabilitiesInstantPayout(Value.INACTIVE, "inactive"); + + public static final AccountCapabilitiesInstantPayout ACTIVE = + new AccountCapabilitiesInstantPayout(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AccountCapabilitiesInstantPayout(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCapabilitiesInstantPayout + && this.string.equals(((AccountCapabilitiesInstantPayout) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case INACTIVE: + return visitor.visitInactive(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCapabilitiesInstantPayout valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "inactive": + return INACTIVE; + case "active": + return ACTIVE; + default: + return new AccountCapabilitiesInstantPayout(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCapabilitiesRunAds.java b/src/main/java/com/whop/api/types/AccountCapabilitiesRunAds.java new file mode 100644 index 00000000..a94198d6 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCapabilitiesRunAds.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCapabilitiesRunAds { + public static final AccountCapabilitiesRunAds PENDING = new AccountCapabilitiesRunAds(Value.PENDING, "pending"); + + public static final AccountCapabilitiesRunAds INACTIVE = new AccountCapabilitiesRunAds(Value.INACTIVE, "inactive"); + + public static final AccountCapabilitiesRunAds ACTIVE = new AccountCapabilitiesRunAds(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AccountCapabilitiesRunAds(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCapabilitiesRunAds + && this.string.equals(((AccountCapabilitiesRunAds) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case INACTIVE: + return visitor.visitInactive(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCapabilitiesRunAds valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "inactive": + return INACTIVE; + case "active": + return ACTIVE; + default: + return new AccountCapabilitiesRunAds(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCapabilitiesStandardPayout.java b/src/main/java/com/whop/api/types/AccountCapabilitiesStandardPayout.java new file mode 100644 index 00000000..37b8bd18 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCapabilitiesStandardPayout.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCapabilitiesStandardPayout { + public static final AccountCapabilitiesStandardPayout PENDING = + new AccountCapabilitiesStandardPayout(Value.PENDING, "pending"); + + public static final AccountCapabilitiesStandardPayout INACTIVE = + new AccountCapabilitiesStandardPayout(Value.INACTIVE, "inactive"); + + public static final AccountCapabilitiesStandardPayout ACTIVE = + new AccountCapabilitiesStandardPayout(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AccountCapabilitiesStandardPayout(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCapabilitiesStandardPayout + && this.string.equals(((AccountCapabilitiesStandardPayout) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case INACTIVE: + return visitor.visitInactive(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCapabilitiesStandardPayout valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "inactive": + return INACTIVE; + case "active": + return ACTIVE; + default: + return new AccountCapabilitiesStandardPayout(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCapabilitiesTransfer.java b/src/main/java/com/whop/api/types/AccountCapabilitiesTransfer.java new file mode 100644 index 00000000..35801364 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCapabilitiesTransfer.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCapabilitiesTransfer { + public static final AccountCapabilitiesTransfer PENDING = new AccountCapabilitiesTransfer(Value.PENDING, "pending"); + + public static final AccountCapabilitiesTransfer INACTIVE = + new AccountCapabilitiesTransfer(Value.INACTIVE, "inactive"); + + public static final AccountCapabilitiesTransfer ACTIVE = new AccountCapabilitiesTransfer(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AccountCapabilitiesTransfer(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCapabilitiesTransfer + && this.string.equals(((AccountCapabilitiesTransfer) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case INACTIVE: + return visitor.visitInactive(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCapabilitiesTransfer valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "inactive": + return INACTIVE; + case "active": + return ACTIVE; + default: + return new AccountCapabilitiesTransfer(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCards.java b/src/main/java/com/whop/api/types/AccountCards.java new file mode 100644 index 00000000..70c90f0b --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCards.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountCards.Builder.class) +public final class AccountCards { + private final Optional kind; + + private final AccountCardsStatus status; + + private final Map additionalProperties; + + private AccountCards( + Optional kind, AccountCardsStatus status, Map additionalProperties) { + this.kind = kind; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the card application verifies a business (business, KYB) or a person (individual, consumer identity). null when the application is not yet linked to a verification. + */ + @JsonIgnore + public Optional getKind() { + if (kind == null) { + return Optional.empty(); + } + return kind; + } + + /** + * @return Where the card application stands. approved means cards can be issued. needs_verification means the applicant has not completed identity verification yet; needs_information means they did, but the documents were rejected for a fixable reason and must be resubmitted. pending and manual_review are in flight. denied, locked, and canceled are terminal. + */ + @JsonProperty("status") + public AccountCardsStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("kind") + private Optional _getKind() { + return kind; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountCards && equalTo((AccountCards) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountCards other) { + return kind.equals(other.kind) && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.kind, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StatusStage builder() { + return new Builder(); + } + + public interface StatusStage { + /** + *

Where the card application stands. approved means cards can be issued. needs_verification means the applicant has not completed identity verification yet; needs_information means they did, but the documents were rejected for a fixable reason and must be resubmitted. pending and manual_review are in flight. denied, locked, and canceled are terminal.

+ */ + _FinalStage status(@NotNull AccountCardsStatus status); + + Builder from(AccountCards other); + } + + public interface _FinalStage { + AccountCards build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Whether the card application verifies a business (business, KYB) or a person (individual, consumer identity). null when the application is not yet linked to a verification.

+ */ + _FinalStage kind(Optional kind); + + _FinalStage kind(AccountCardsKind kind); + + _FinalStage kind(Nullable kind); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StatusStage, _FinalStage { + private AccountCardsStatus status; + + private Optional kind = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountCards other) { + kind(other.getKind()); + status(other.getStatus()); + return this; + } + + /** + *

Where the card application stands. approved means cards can be issued. needs_verification means the applicant has not completed identity verification yet; needs_information means they did, but the documents were rejected for a fixable reason and must be resubmitted. pending and manual_review are in flight. denied, locked, and canceled are terminal.

+ *

Where the card application stands. approved means cards can be issued. needs_verification means the applicant has not completed identity verification yet; needs_information means they did, but the documents were rejected for a fixable reason and must be resubmitted. pending and manual_review are in flight. denied, locked, and canceled are terminal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull AccountCardsStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Whether the card application verifies a business (business, KYB) or a person (individual, consumer identity). null when the application is not yet linked to a verification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage kind(Nullable kind) { + if (kind.isNull()) { + this.kind = null; + } else if (kind.isEmpty()) { + this.kind = Optional.empty(); + } else { + this.kind = Optional.of(kind.get()); + } + return this; + } + + /** + *

Whether the card application verifies a business (business, KYB) or a person (individual, consumer identity). null when the application is not yet linked to a verification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage kind(AccountCardsKind kind) { + this.kind = Optional.ofNullable(kind); + return this; + } + + /** + *

Whether the card application verifies a business (business, KYB) or a person (individual, consumer identity). null when the application is not yet linked to a verification.

+ */ + @java.lang.Override + @JsonSetter(value = "kind", nulls = Nulls.SKIP) + public _FinalStage kind(Optional kind) { + this.kind = kind; + return this; + } + + @java.lang.Override + public AccountCards build() { + return new AccountCards(kind, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountCardsKind.java b/src/main/java/com/whop/api/types/AccountCardsKind.java new file mode 100644 index 00000000..3d79abfb --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCardsKind.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCardsKind { + public static final AccountCardsKind INDIVIDUAL = new AccountCardsKind(Value.INDIVIDUAL, "individual"); + + public static final AccountCardsKind BUSINESS = new AccountCardsKind(Value.BUSINESS, "business"); + + private final Value value; + + private final String string; + + AccountCardsKind(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCardsKind && this.string.equals(((AccountCardsKind) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INDIVIDUAL: + return visitor.visitIndividual(); + case BUSINESS: + return visitor.visitBusiness(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCardsKind valueOf(String value) { + switch (value) { + case "individual": + return INDIVIDUAL; + case "business": + return BUSINESS; + default: + return new AccountCardsKind(Value.UNKNOWN, value); + } + } + + public enum Value { + INDIVIDUAL, + + BUSINESS, + + UNKNOWN + } + + public interface Visitor { + T visitIndividual(); + + T visitBusiness(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCardsStatus.java b/src/main/java/com/whop/api/types/AccountCardsStatus.java new file mode 100644 index 00000000..10e2ecc2 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCardsStatus.java @@ -0,0 +1,145 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCardsStatus { + public static final AccountCardsStatus APPROVED = new AccountCardsStatus(Value.APPROVED, "approved"); + + public static final AccountCardsStatus NEEDS_VERIFICATION = + new AccountCardsStatus(Value.NEEDS_VERIFICATION, "needs_verification"); + + public static final AccountCardsStatus MANUAL_REVIEW = new AccountCardsStatus(Value.MANUAL_REVIEW, "manual_review"); + + public static final AccountCardsStatus PENDING = new AccountCardsStatus(Value.PENDING, "pending"); + + public static final AccountCardsStatus CANCELED = new AccountCardsStatus(Value.CANCELED, "canceled"); + + public static final AccountCardsStatus NEEDS_INFORMATION = + new AccountCardsStatus(Value.NEEDS_INFORMATION, "needs_information"); + + public static final AccountCardsStatus DENIED = new AccountCardsStatus(Value.DENIED, "denied"); + + public static final AccountCardsStatus LOCKED = new AccountCardsStatus(Value.LOCKED, "locked"); + + private final Value value; + + private final String string; + + AccountCardsStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCardsStatus && this.string.equals(((AccountCardsStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case NEEDS_VERIFICATION: + return visitor.visitNeedsVerification(); + case MANUAL_REVIEW: + return visitor.visitManualReview(); + case PENDING: + return visitor.visitPending(); + case CANCELED: + return visitor.visitCanceled(); + case NEEDS_INFORMATION: + return visitor.visitNeedsInformation(); + case DENIED: + return visitor.visitDenied(); + case LOCKED: + return visitor.visitLocked(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCardsStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "needs_verification": + return NEEDS_VERIFICATION; + case "manual_review": + return MANUAL_REVIEW; + case "pending": + return PENDING; + case "canceled": + return CANCELED; + case "needs_information": + return NEEDS_INFORMATION; + case "denied": + return DENIED; + case "locked": + return LOCKED; + default: + return new AccountCardsStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + APPROVED, + + PENDING, + + MANUAL_REVIEW, + + DENIED, + + LOCKED, + + CANCELED, + + NEEDS_VERIFICATION, + + NEEDS_INFORMATION, + + UNKNOWN + } + + public interface Visitor { + T visitApproved(); + + T visitPending(); + + T visitManualReview(); + + T visitDenied(); + + T visitLocked(); + + T visitCanceled(); + + T visitNeedsVerification(); + + T visitNeedsInformation(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCompanyFormation.java b/src/main/java/com/whop/api/types/AccountCompanyFormation.java new file mode 100644 index 00000000..1db89812 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCompanyFormation.java @@ -0,0 +1,277 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountCompanyFormation.Builder.class) +public final class AccountCompanyFormation { + private final Optional> documents; + + private final Optional einRegistered; + + private final Optional legalName; + + private final Optional signatures; + + private final Optional stateRegistered; + + private final Optional status; + + private final Map additionalProperties; + + private AccountCompanyFormation( + Optional> documents, + Optional einRegistered, + Optional legalName, + Optional signatures, + Optional stateRegistered, + Optional status, + Map additionalProperties) { + this.documents = documents; + this.einRegistered = einRegistered; + this.legalName = legalName; + this.signatures = signatures; + this.stateRegistered = stateRegistered; + this.status = status; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("documents") + public Optional> getDocuments() { + return documents; + } + + /** + * @return Whether the company's EIN has been issued by the IRS. Present once status leaves draft. + */ + @JsonProperty("ein_registered") + public Optional getEinRegistered() { + return einRegistered; + } + + /** + * @return Registered company name including the entity ending, for example Acme, LLC. Present once status leaves draft. + */ + @JsonIgnore + public Optional getLegalName() { + if (legalName == null) { + return Optional.empty(); + } + return legalName; + } + + /** + * @return IRS forms still awaiting a founder's signature, each with a hosted signing URL. Present once status leaves draft; empty when nothing needs signing. + */ + @JsonProperty("signatures") + public Optional getSignatures() { + return signatures; + } + + /** + * @return Whether the state formation filing is complete. Present once status leaves draft. + */ + @JsonProperty("state_registered") + public Optional getStateRegistered() { + return stateRegistered; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("legal_name") + private Optional _getLegalName() { + return legalName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountCompanyFormation && equalTo((AccountCompanyFormation) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountCompanyFormation other) { + return documents.equals(other.documents) + && einRegistered.equals(other.einRegistered) + && legalName.equals(other.legalName) + && signatures.equals(other.signatures) + && stateRegistered.equals(other.stateRegistered) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.documents, this.einRegistered, this.legalName, this.signatures, this.stateRegistered, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> documents = Optional.empty(); + + private Optional einRegistered = Optional.empty(); + + private Optional legalName = Optional.empty(); + + private Optional signatures = Optional.empty(); + + private Optional stateRegistered = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AccountCompanyFormation other) { + documents(other.getDocuments()); + einRegistered(other.getEinRegistered()); + legalName(other.getLegalName()); + signatures(other.getSignatures()); + stateRegistered(other.getStateRegistered()); + status(other.getStatus()); + return this; + } + + @JsonSetter(value = "documents", nulls = Nulls.SKIP) + public Builder documents(Optional> documents) { + this.documents = documents; + return this; + } + + public Builder documents(List documents) { + this.documents = Optional.ofNullable(documents); + return this; + } + + /** + *

Whether the company's EIN has been issued by the IRS. Present once status leaves draft.

+ */ + @JsonSetter(value = "ein_registered", nulls = Nulls.SKIP) + public Builder einRegistered(Optional einRegistered) { + this.einRegistered = einRegistered; + return this; + } + + public Builder einRegistered(Boolean einRegistered) { + this.einRegistered = Optional.ofNullable(einRegistered); + return this; + } + + /** + *

Registered company name including the entity ending, for example Acme, LLC. Present once status leaves draft.

+ */ + @JsonSetter(value = "legal_name", nulls = Nulls.SKIP) + public Builder legalName(Optional legalName) { + this.legalName = legalName; + return this; + } + + public Builder legalName(String legalName) { + this.legalName = Optional.ofNullable(legalName); + return this; + } + + public Builder legalName(Nullable legalName) { + if (legalName.isNull()) { + this.legalName = null; + } else if (legalName.isEmpty()) { + this.legalName = Optional.empty(); + } else { + this.legalName = Optional.of(legalName.get()); + } + return this; + } + + /** + *

IRS forms still awaiting a founder's signature, each with a hosted signing URL. Present once status leaves draft; empty when nothing needs signing.

+ */ + @JsonSetter(value = "signatures", nulls = Nulls.SKIP) + public Builder signatures(Optional signatures) { + this.signatures = signatures; + return this; + } + + public Builder signatures(AccountCompanyFormationSignatures signatures) { + this.signatures = Optional.ofNullable(signatures); + return this; + } + + /** + *

Whether the state formation filing is complete. Present once status leaves draft.

+ */ + @JsonSetter(value = "state_registered", nulls = Nulls.SKIP) + public Builder stateRegistered(Optional stateRegistered) { + this.stateRegistered = stateRegistered; + return this; + } + + public Builder stateRegistered(Boolean stateRegistered) { + this.stateRegistered = Optional.ofNullable(stateRegistered); + return this; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(AccountCompanyFormationStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public AccountCompanyFormation build() { + return new AccountCompanyFormation( + documents, einRegistered, legalName, signatures, stateRegistered, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountCompanyFormationDocument.java b/src/main/java/com/whop/api/types/AccountCompanyFormationDocument.java new file mode 100644 index 00000000..337e1cff --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCompanyFormationDocument.java @@ -0,0 +1,229 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountCompanyFormationDocument.Builder.class) +public final class AccountCompanyFormationDocument { + private final String id; + + private final String name; + + private final String type; + + private final String url; + + private final Map additionalProperties; + + private AccountCompanyFormationDocument( + String id, String name, String type, String url, Map additionalProperties) { + this.id = id; + this.name = name; + this.type = type; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Document ID, prefixed file_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Human-readable document name, such as Articles of Organization. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return Document category: articles_of_organization, operating_agreement, ein_letter, signed_ss4, signed_form8821, or mail for postal correspondence received on the company's behalf. + */ + @JsonProperty("type") + public String getType() { + return type; + } + + /** + * @return CDN URL for downloading the document. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountCompanyFormationDocument && equalTo((AccountCompanyFormationDocument) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountCompanyFormationDocument other) { + return id.equals(other.id) && name.equals(other.name) && type.equals(other.type) && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.type, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Document ID, prefixed file_.

+ */ + NameStage id(@NotNull String id); + + Builder from(AccountCompanyFormationDocument other); + } + + public interface NameStage { + /** + *

Human-readable document name, such as Articles of Organization.

+ */ + TypeStage name(@NotNull String name); + } + + public interface TypeStage { + /** + *

Document category: articles_of_organization, operating_agreement, ein_letter, signed_ss4, signed_form8821, or mail for postal correspondence received on the company's behalf.

+ */ + UrlStage type(@NotNull String type); + } + + public interface UrlStage { + /** + *

CDN URL for downloading the document.

+ */ + _FinalStage url(@NotNull String url); + } + + public interface _FinalStage { + AccountCompanyFormationDocument build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, TypeStage, UrlStage, _FinalStage { + private String id; + + private String name; + + private String type; + + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountCompanyFormationDocument other) { + id(other.getId()); + name(other.getName()); + type(other.getType()); + url(other.getUrl()); + return this; + } + + /** + *

Document ID, prefixed file_.

+ *

Document ID, prefixed file_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Human-readable document name, such as Articles of Organization.

+ *

Human-readable document name, such as Articles of Organization.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public TypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

Document category: articles_of_organization, operating_agreement, ein_letter, signed_ss4, signed_form8821, or mail for postal correspondence received on the company's behalf.

+ *

Document category: articles_of_organization, operating_agreement, ein_letter, signed_ss4, signed_form8821, or mail for postal correspondence received on the company's behalf.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public UrlStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

CDN URL for downloading the document.

+ *

CDN URL for downloading the document.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public AccountCompanyFormationDocument build() { + return new AccountCompanyFormationDocument(id, name, type, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountCompanyFormationSignatureRequest.java b/src/main/java/com/whop/api/types/AccountCompanyFormationSignatureRequest.java new file mode 100644 index 00000000..aaa632f5 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCompanyFormationSignatureRequest.java @@ -0,0 +1,218 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountCompanyFormationSignatureRequest.Builder.class) +public final class AccountCompanyFormationSignatureRequest { + private final Optional expiresAt; + + private final AccountCompanyFormationSignatureRequestStatus status; + + private final Optional url; + + private final Map additionalProperties; + + private AccountCompanyFormationSignatureRequest( + Optional expiresAt, + AccountCompanyFormationSignatureRequestStatus status, + Optional url, + Map additionalProperties) { + this.expiresAt = expiresAt; + this.status = status; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the signing URL expires, as an ISO 8601 timestamp. Present while status is pending. + */ + @JsonProperty("expires_at") + public Optional getExpiresAt() { + return expiresAt; + } + + /** + * @return pending when a signing session is ready for the founder; unknown when the signature state could not be determined. + */ + @JsonProperty("status") + public AccountCompanyFormationSignatureRequestStatus getStatus() { + return status; + } + + /** + * @return Hosted signing URL where the founder completes the form. Present while status is pending. + */ + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountCompanyFormationSignatureRequest + && equalTo((AccountCompanyFormationSignatureRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountCompanyFormationSignatureRequest other) { + return expiresAt.equals(other.expiresAt) && status.equals(other.status) && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.expiresAt, this.status, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StatusStage builder() { + return new Builder(); + } + + public interface StatusStage { + /** + *

pending when a signing session is ready for the founder; unknown when the signature state could not be determined.

+ */ + _FinalStage status(@NotNull AccountCompanyFormationSignatureRequestStatus status); + + Builder from(AccountCompanyFormationSignatureRequest other); + } + + public interface _FinalStage { + AccountCompanyFormationSignatureRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When the signing URL expires, as an ISO 8601 timestamp. Present while status is pending.

+ */ + _FinalStage expiresAt(Optional expiresAt); + + _FinalStage expiresAt(String expiresAt); + + /** + *

Hosted signing URL where the founder completes the form. Present while status is pending.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StatusStage, _FinalStage { + private AccountCompanyFormationSignatureRequestStatus status; + + private Optional url = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountCompanyFormationSignatureRequest other) { + expiresAt(other.getExpiresAt()); + status(other.getStatus()); + url(other.getUrl()); + return this; + } + + /** + *

pending when a signing session is ready for the founder; unknown when the signature state could not be determined.

+ *

pending when a signing session is ready for the founder; unknown when the signature state could not be determined.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull AccountCompanyFormationSignatureRequestStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Hosted signing URL where the founder completes the form. Present while status is pending.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

Hosted signing URL where the founder completes the form. Present while status is pending.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

When the signing URL expires, as an ISO 8601 timestamp. Present while status is pending.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expiresAt(String expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + /** + *

When the signing URL expires, as an ISO 8601 timestamp. Present while status is pending.

+ */ + @java.lang.Override + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public _FinalStage expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + @java.lang.Override + public AccountCompanyFormationSignatureRequest build() { + return new AccountCompanyFormationSignatureRequest(expiresAt, status, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountCompanyFormationSignatureRequestStatus.java b/src/main/java/com/whop/api/types/AccountCompanyFormationSignatureRequestStatus.java new file mode 100644 index 00000000..a7bf4648 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCompanyFormationSignatureRequestStatus.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCompanyFormationSignatureRequestStatus { + public static final AccountCompanyFormationSignatureRequestStatus PENDING = + new AccountCompanyFormationSignatureRequestStatus(Value.PENDING, "pending"); + + public static final AccountCompanyFormationSignatureRequestStatus UNKNOWN = + new AccountCompanyFormationSignatureRequestStatus(Value.UNKNOWN, "unknown"); + + private final Value value; + + private final String string; + + AccountCompanyFormationSignatureRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCompanyFormationSignatureRequestStatus + && this.string.equals(((AccountCompanyFormationSignatureRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case UNKNOWN: + return visitor.visitUnknown(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCompanyFormationSignatureRequestStatus valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "unknown": + return UNKNOWN; + default: + return new AccountCompanyFormationSignatureRequestStatus(Value._UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountCompanyFormationSignatures.java b/src/main/java/com/whop/api/types/AccountCompanyFormationSignatures.java new file mode 100644 index 00000000..13ee8319 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCompanyFormationSignatures.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountCompanyFormationSignatures.Builder.class) +public final class AccountCompanyFormationSignatures { + private final Optional form8821; + + private final Optional ss4; + + private final Map additionalProperties; + + private AccountCompanyFormationSignatures( + Optional form8821, + Optional ss4, + Map additionalProperties) { + this.form8821 = form8821; + this.ss4 = ss4; + this.additionalProperties = additionalProperties; + } + + /** + * @return Signature state for IRS Form 8821, the tax information authorization. Present only while the form still needs the founder's action. + */ + @JsonProperty("form8821") + public Optional getForm8821() { + return form8821; + } + + /** + * @return Signature state for IRS Form SS-4, the EIN application. Present only while the form still needs the founder's action. + */ + @JsonProperty("ss4") + public Optional getSs4() { + return ss4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountCompanyFormationSignatures && equalTo((AccountCompanyFormationSignatures) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountCompanyFormationSignatures other) { + return form8821.equals(other.form8821) && ss4.equals(other.ss4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.form8821, this.ss4); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional form8821 = Optional.empty(); + + private Optional ss4 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AccountCompanyFormationSignatures other) { + form8821(other.getForm8821()); + ss4(other.getSs4()); + return this; + } + + /** + *

Signature state for IRS Form 8821, the tax information authorization. Present only while the form still needs the founder's action.

+ */ + @JsonSetter(value = "form8821", nulls = Nulls.SKIP) + public Builder form8821(Optional form8821) { + this.form8821 = form8821; + return this; + } + + public Builder form8821(AccountCompanyFormationSignatureRequest form8821) { + this.form8821 = Optional.ofNullable(form8821); + return this; + } + + /** + *

Signature state for IRS Form SS-4, the EIN application. Present only while the form still needs the founder's action.

+ */ + @JsonSetter(value = "ss4", nulls = Nulls.SKIP) + public Builder ss4(Optional ss4) { + this.ss4 = ss4; + return this; + } + + public Builder ss4(AccountCompanyFormationSignatureRequest ss4) { + this.ss4 = Optional.ofNullable(ss4); + return this; + } + + public AccountCompanyFormationSignatures build() { + return new AccountCompanyFormationSignatures(form8821, ss4, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountCompanyFormationStatus.java b/src/main/java/com/whop/api/types/AccountCompanyFormationStatus.java new file mode 100644 index 00000000..96477f7a --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountCompanyFormationStatus.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountCompanyFormationStatus { + public static final AccountCompanyFormationStatus PROCESSING = + new AccountCompanyFormationStatus(Value.PROCESSING, "processing"); + + public static final AccountCompanyFormationStatus FILED = new AccountCompanyFormationStatus(Value.FILED, "filed"); + + public static final AccountCompanyFormationStatus COMPLETED = + new AccountCompanyFormationStatus(Value.COMPLETED, "completed"); + + public static final AccountCompanyFormationStatus DRAFT = new AccountCompanyFormationStatus(Value.DRAFT, "draft"); + + public static final AccountCompanyFormationStatus REJECTED = + new AccountCompanyFormationStatus(Value.REJECTED, "rejected"); + + private final Value value; + + private final String string; + + AccountCompanyFormationStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountCompanyFormationStatus + && this.string.equals(((AccountCompanyFormationStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PROCESSING: + return visitor.visitProcessing(); + case FILED: + return visitor.visitFiled(); + case COMPLETED: + return visitor.visitCompleted(); + case DRAFT: + return visitor.visitDraft(); + case REJECTED: + return visitor.visitRejected(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountCompanyFormationStatus valueOf(String value) { + switch (value) { + case "processing": + return PROCESSING; + case "filed": + return FILED; + case "completed": + return COMPLETED; + case "draft": + return DRAFT; + case "rejected": + return REJECTED; + default: + return new AccountCompanyFormationStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + DRAFT, + + PROCESSING, + + FILED, + + REJECTED, + + COMPLETED, + + UNKNOWN + } + + public interface Visitor { + T visitDraft(); + + T visitProcessing(); + + T visitFiled(); + + T visitRejected(); + + T visitCompleted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountDisputeAlertAutoRefundControl.java b/src/main/java/com/whop/api/types/AccountDisputeAlertAutoRefundControl.java new file mode 100644 index 00000000..39e2cb0c --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountDisputeAlertAutoRefundControl.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountDisputeAlertAutoRefundControl.Builder.class) +public final class AccountDisputeAlertAutoRefundControl { + private final boolean locked; + + private final Optional thresholdUsd; + + private final Map additionalProperties; + + private AccountDisputeAlertAutoRefundControl( + boolean locked, Optional thresholdUsd, Map additionalProperties) { + this.locked = locked; + this.thresholdUsd = thresholdUsd; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the account owner is prevented from changing this threshold. + */ + @JsonProperty("locked") + public boolean getLocked() { + return locked; + } + + /** + * @return Maximum dispute alert amount automatically refunded in USD. null when automatic refunds are disabled. + */ + @JsonIgnore + public Optional getThresholdUsd() { + if (thresholdUsd == null) { + return Optional.empty(); + } + return thresholdUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("threshold_usd") + private Optional _getThresholdUsd() { + return thresholdUsd; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountDisputeAlertAutoRefundControl + && equalTo((AccountDisputeAlertAutoRefundControl) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountDisputeAlertAutoRefundControl other) { + return locked == other.locked && thresholdUsd.equals(other.thresholdUsd); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.locked, this.thresholdUsd); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LockedStage builder() { + return new Builder(); + } + + public interface LockedStage { + /** + *

Whether the account owner is prevented from changing this threshold.

+ */ + _FinalStage locked(boolean locked); + + Builder from(AccountDisputeAlertAutoRefundControl other); + } + + public interface _FinalStage { + AccountDisputeAlertAutoRefundControl build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Maximum dispute alert amount automatically refunded in USD. null when automatic refunds are disabled.

+ */ + _FinalStage thresholdUsd(Optional thresholdUsd); + + _FinalStage thresholdUsd(Double thresholdUsd); + + _FinalStage thresholdUsd(Nullable thresholdUsd); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LockedStage, _FinalStage { + private boolean locked; + + private Optional thresholdUsd = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountDisputeAlertAutoRefundControl other) { + locked(other.getLocked()); + thresholdUsd(other.getThresholdUsd()); + return this; + } + + /** + *

Whether the account owner is prevented from changing this threshold.

+ *

Whether the account owner is prevented from changing this threshold.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("locked") + public _FinalStage locked(boolean locked) { + this.locked = locked; + return this; + } + + /** + *

Maximum dispute alert amount automatically refunded in USD. null when automatic refunds are disabled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thresholdUsd(Nullable thresholdUsd) { + if (thresholdUsd.isNull()) { + this.thresholdUsd = null; + } else if (thresholdUsd.isEmpty()) { + this.thresholdUsd = Optional.empty(); + } else { + this.thresholdUsd = Optional.of(thresholdUsd.get()); + } + return this; + } + + /** + *

Maximum dispute alert amount automatically refunded in USD. null when automatic refunds are disabled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thresholdUsd(Double thresholdUsd) { + this.thresholdUsd = Optional.ofNullable(thresholdUsd); + return this; + } + + /** + *

Maximum dispute alert amount automatically refunded in USD. null when automatic refunds are disabled.

+ */ + @java.lang.Override + @JsonSetter(value = "threshold_usd", nulls = Nulls.SKIP) + public _FinalStage thresholdUsd(Optional thresholdUsd) { + this.thresholdUsd = thresholdUsd; + return this; + } + + @java.lang.Override + public AccountDisputeAlertAutoRefundControl build() { + return new AccountDisputeAlertAutoRefundControl(locked, thresholdUsd, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountHomePreferencesItem.java b/src/main/java/com/whop/api/types/AccountHomePreferencesItem.java new file mode 100644 index 00000000..120ee2d3 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountHomePreferencesItem.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountHomePreferencesItem { + public static final AccountHomePreferencesItem HIDE_MEMBER_COUNT = + new AccountHomePreferencesItem(Value.HIDE_MEMBER_COUNT, "hide_member_count"); + + public static final AccountHomePreferencesItem HIDE_MEMBERS_CARD = + new AccountHomePreferencesItem(Value.HIDE_MEMBERS_CARD, "hide_members_card"); + + private final Value value; + + private final String string; + + AccountHomePreferencesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountHomePreferencesItem + && this.string.equals(((AccountHomePreferencesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HIDE_MEMBER_COUNT: + return visitor.visitHideMemberCount(); + case HIDE_MEMBERS_CARD: + return visitor.visitHideMembersCard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountHomePreferencesItem valueOf(String value) { + switch (value) { + case "hide_member_count": + return HIDE_MEMBER_COUNT; + case "hide_members_card": + return HIDE_MEMBERS_CARD; + default: + return new AccountHomePreferencesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + HIDE_MEMBER_COUNT, + + HIDE_MEMBERS_CARD, + + UNKNOWN + } + + public interface Visitor { + T visitHideMemberCount(); + + T visitHideMembersCard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountIndustryGroup.java b/src/main/java/com/whop/api/types/AccountIndustryGroup.java new file mode 100644 index 00000000..dca8dc3d --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountIndustryGroup.java @@ -0,0 +1,1594 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountIndustryGroup { + public static final AccountIndustryGroup DERMATOLOGY_AND_SKIN = + new AccountIndustryGroup(Value.DERMATOLOGY_AND_SKIN, "dermatology_and_skin"); + + public static final AccountIndustryGroup MARKETING_AND_ADVERTISING = + new AccountIndustryGroup(Value.MARKETING_AND_ADVERTISING, "marketing_and_advertising"); + + public static final AccountIndustryGroup RESTAURANTS = new AccountIndustryGroup(Value.RESTAURANTS, "restaurants"); + + public static final AccountIndustryGroup CREATIVE_AND_CONTENT_GROUPS = + new AccountIndustryGroup(Value.CREATIVE_AND_CONTENT_GROUPS, "creative_and_content_groups"); + + public static final AccountIndustryGroup HOME_AND_TRADE_STOREFRONTS = + new AccountIndustryGroup(Value.HOME_AND_TRADE_STOREFRONTS, "home_and_trade_storefronts"); + + public static final AccountIndustryGroup HOME_AND_LIVING = + new AccountIndustryGroup(Value.HOME_AND_LIVING, "home_and_living"); + + public static final AccountIndustryGroup RELIGION_AND_FAITH = + new AccountIndustryGroup(Value.RELIGION_AND_FAITH, "religion_and_faith"); + + public static final AccountIndustryGroup REAL_ESTATE_SOFTWARE = + new AccountIndustryGroup(Value.REAL_ESTATE_SOFTWARE, "real_estate_software"); + + public static final AccountIndustryGroup SUPPLEMENTS_AND_NUTRITION = + new AccountIndustryGroup(Value.SUPPLEMENTS_AND_NUTRITION, "supplements_and_nutrition"); + + public static final AccountIndustryGroup VIDEO_GAMES_AND_ESPORTS = + new AccountIndustryGroup(Value.VIDEO_GAMES_AND_ESPORTS, "video_games_and_esports"); + + public static final AccountIndustryGroup PERSONAL_DEVELOPMENT = + new AccountIndustryGroup(Value.PERSONAL_DEVELOPMENT, "personal_development"); + + public static final AccountIndustryGroup HEALTHCARE = new AccountIndustryGroup(Value.HEALTHCARE, "healthcare"); + + public static final AccountIndustryGroup TRADING_AND_FINANCE_SOFTWARE = + new AccountIndustryGroup(Value.TRADING_AND_FINANCE_SOFTWARE, "trading_and_finance_software"); + + public static final AccountIndustryGroup SOCIAL_AND_NETWORKING_EVENTS = + new AccountIndustryGroup(Value.SOCIAL_AND_NETWORKING_EVENTS, "social_and_networking_events"); + + public static final AccountIndustryGroup DENTAL_AND_VISION = + new AccountIndustryGroup(Value.DENTAL_AND_VISION, "dental_and_vision"); + + public static final AccountIndustryGroup CREATIVE_GIGS = + new AccountIndustryGroup(Value.CREATIVE_GIGS, "creative_gigs"); + + public static final AccountIndustryGroup GAMING_GROUPS = + new AccountIndustryGroup(Value.GAMING_GROUPS, "gaming_groups"); + + public static final AccountIndustryGroup SLEEP_AND_CHRONIC_CONDITIONS = + new AccountIndustryGroup(Value.SLEEP_AND_CHRONIC_CONDITIONS, "sleep_and_chronic_conditions"); + + public static final AccountIndustryGroup PERSONAL_SERVICES = + new AccountIndustryGroup(Value.PERSONAL_SERVICES, "personal_services"); + + public static final AccountIndustryGroup SERVICE_MARKETPLACES = + new AccountIndustryGroup(Value.SERVICE_MARKETPLACES, "service_marketplaces"); + + public static final AccountIndustryGroup ARTS_AND_CRAFTS = + new AccountIndustryGroup(Value.ARTS_AND_CRAFTS, "arts_and_crafts"); + + public static final AccountIndustryGroup CAFES_AND_QUICK_SERVICE = + new AccountIndustryGroup(Value.CAFES_AND_QUICK_SERVICE, "cafes_and_quick_service"); + + public static final AccountIndustryGroup GOVERNMENT_AND_PUBLIC = + new AccountIndustryGroup(Value.GOVERNMENT_AND_PUBLIC, "government_and_public"); + + public static final AccountIndustryGroup OUTDOOR_AND_SPORTS = + new AccountIndustryGroup(Value.OUTDOOR_AND_SPORTS, "outdoor_and_sports"); + + public static final AccountIndustryGroup SPORTS_BETTING_GROUPS = + new AccountIndustryGroup(Value.SPORTS_BETTING_GROUPS, "sports_betting_groups"); + + public static final AccountIndustryGroup LIFESTYLE_AND_PERSONAL_GROWTH = + new AccountIndustryGroup(Value.LIFESTYLE_AND_PERSONAL_GROWTH, "lifestyle_and_personal_growth"); + + public static final AccountIndustryGroup HOME_AND_TRADE_SERVICES = + new AccountIndustryGroup(Value.HOME_AND_TRADE_SERVICES, "home_and_trade_services"); + + public static final AccountIndustryGroup SPIRITUALITY_AND_PERSONAL_GROWTH = + new AccountIndustryGroup(Value.SPIRITUALITY_AND_PERSONAL_GROWTH, "spirituality_and_personal_growth"); + + public static final AccountIndustryGroup E_COMMERCE_SOFTWARE = + new AccountIndustryGroup(Value.E_COMMERCE_SOFTWARE, "e_commerce_software"); + + public static final AccountIndustryGroup HOSPITALITY_AND_LODGING = + new AccountIndustryGroup(Value.HOSPITALITY_AND_LODGING, "hospitality_and_lodging"); + + public static final AccountIndustryGroup PERFORMANCE_AND_SHOW_EVENTS = + new AccountIndustryGroup(Value.PERFORMANCE_AND_SHOW_EVENTS, "performance_and_show_events"); + + public static final AccountIndustryGroup CUSTOMER_SUPPORT_AGENCIES = + new AccountIndustryGroup(Value.CUSTOMER_SUPPORT_AGENCIES, "customer_support_agencies"); + + public static final AccountIndustryGroup FUNERAL_AND_DEATH_CARE = + new AccountIndustryGroup(Value.FUNERAL_AND_DEATH_CARE, "funeral_and_death_care"); + + public static final AccountIndustryGroup SUSTAINABILITY_AND_ECO_PRODUCTS = + new AccountIndustryGroup(Value.SUSTAINABILITY_AND_ECO_PRODUCTS, "sustainability_and_eco_products"); + + public static final AccountIndustryGroup MARKETING_AGENCIES = + new AccountIndustryGroup(Value.MARKETING_AGENCIES, "marketing_agencies"); + + public static final AccountIndustryGroup LIFESTYLE_AND_WELLNESS_EVENTS = + new AccountIndustryGroup(Value.LIFESTYLE_AND_WELLNESS_EVENTS, "lifestyle_and_wellness_events"); + + public static final AccountIndustryGroup SPECIALIZED_GIGS = + new AccountIndustryGroup(Value.SPECIALIZED_GIGS, "specialized_gigs"); + + public static final AccountIndustryGroup SECURITY_AND_PRIVACY_SOFTWARE = + new AccountIndustryGroup(Value.SECURITY_AND_PRIVACY_SOFTWARE, "security_and_privacy_software"); + + public static final AccountIndustryGroup GENETIC_AND_SPECIALIZED = + new AccountIndustryGroup(Value.GENETIC_AND_SPECIALIZED, "genetic_and_specialized"); + + public static final AccountIndustryGroup PRIMARY_AND_GENERAL_CARE = + new AccountIndustryGroup(Value.PRIMARY_AND_GENERAL_CARE, "primary_and_general_care"); + + public static final AccountIndustryGroup FAMILY_AND_COMMUNITY_EVENTS = + new AccountIndustryGroup(Value.FAMILY_AND_COMMUNITY_EVENTS, "family_and_community_events"); + + public static final AccountIndustryGroup TECH_AND_AI = new AccountIndustryGroup(Value.TECH_AND_AI, "tech_and_ai"); + + public static final AccountIndustryGroup SPORTS_BETTING_AND_GAMBLING = + new AccountIndustryGroup(Value.SPORTS_BETTING_AND_GAMBLING, "sports_betting_and_gambling"); + + public static final AccountIndustryGroup BARS_AND_BREWERIES = + new AccountIndustryGroup(Value.BARS_AND_BREWERIES, "bars_and_breweries"); + + public static final AccountIndustryGroup DIGITAL_GOODS_AND_ACCOUNTS = + new AccountIndustryGroup(Value.DIGITAL_GOODS_AND_ACCOUNTS, "digital_goods_and_accounts"); + + public static final AccountIndustryGroup ENTERTAINMENT_AND_LEISURE = + new AccountIndustryGroup(Value.ENTERTAINMENT_AND_LEISURE, "entertainment_and_leisure"); + + public static final AccountIndustryGroup HEALTHCARE_AND_WELLNESS_SOFTWARE = + new AccountIndustryGroup(Value.HEALTHCARE_AND_WELLNESS_SOFTWARE, "healthcare_and_wellness_software"); + + public static final AccountIndustryGroup EDUCATION_AND_CHILDCARE = + new AccountIndustryGroup(Value.EDUCATION_AND_CHILDCARE, "education_and_childcare"); + + public static final AccountIndustryGroup LEGAL_AND_COMPLIANCE = + new AccountIndustryGroup(Value.LEGAL_AND_COMPLIANCE, "legal_and_compliance"); + + public static final AccountIndustryGroup COMMUNICATION_AND_MESSAGING_SOFTWARE = new AccountIndustryGroup( + Value.COMMUNICATION_AND_MESSAGING_SOFTWARE, "communication_and_messaging_software"); + + public static final AccountIndustryGroup SPORTS_AND_FITNESS_EVENTS = + new AccountIndustryGroup(Value.SPORTS_AND_FITNESS_EVENTS, "sports_and_fitness_events"); + + public static final AccountIndustryGroup PET_SERVICES = + new AccountIndustryGroup(Value.PET_SERVICES, "pet_services"); + + public static final AccountIndustryGroup DESIGN_AND_CREATIVE_AGENCIES = + new AccountIndustryGroup(Value.DESIGN_AND_CREATIVE_AGENCIES, "design_and_creative_agencies"); + + public static final AccountIndustryGroup VETERINARY = new AccountIndustryGroup(Value.VETERINARY, "veterinary"); + + public static final AccountIndustryGroup AUTOMOTIVE = new AccountIndustryGroup(Value.AUTOMOTIVE, "automotive"); + + public static final AccountIndustryGroup HEALTH_AND_WELLNESS = + new AccountIndustryGroup(Value.HEALTH_AND_WELLNESS, "health_and_wellness"); + + public static final AccountIndustryGroup LIFESTYLE_AND_PERSONAL_GROWTH_GROUPS = new AccountIndustryGroup( + Value.LIFESTYLE_AND_PERSONAL_GROWTH_GROUPS, "lifestyle_and_personal_growth_groups"); + + public static final AccountIndustryGroup SPIRITUALITY_AND_MINDFULNESS = + new AccountIndustryGroup(Value.SPIRITUALITY_AND_MINDFULNESS, "spirituality_and_mindfulness"); + + public static final AccountIndustryGroup CONTENT_AND_CLIPPING_AGENCIES = + new AccountIndustryGroup(Value.CONTENT_AND_CLIPPING_AGENCIES, "content_and_clipping_agencies"); + + public static final AccountIndustryGroup BABY_AND_KIDS = + new AccountIndustryGroup(Value.BABY_AND_KIDS, "baby_and_kids"); + + public static final AccountIndustryGroup DIGITAL_AND_EDUCATION_MARKETPLACES = + new AccountIndustryGroup(Value.DIGITAL_AND_EDUCATION_MARKETPLACES, "digital_and_education_marketplaces"); + + public static final AccountIndustryGroup TASK_AND_ERRANDS = + new AccountIndustryGroup(Value.TASK_AND_ERRANDS, "task_and_errands"); + + public static final AccountIndustryGroup FOOD_AND_BEVERAGES = + new AccountIndustryGroup(Value.FOOD_AND_BEVERAGES, "food_and_beverages"); + + public static final AccountIndustryGroup FITNESS_EQUIPMENT_AND_GEAR = + new AccountIndustryGroup(Value.FITNESS_EQUIPMENT_AND_GEAR, "fitness_equipment_and_gear"); + + public static final AccountIndustryGroup DATING_AND_RELATIONSHIPS = + new AccountIndustryGroup(Value.DATING_AND_RELATIONSHIPS, "dating_and_relationships"); + + public static final AccountIndustryGroup HOBBY_AND_INTEREST_GROUPS = + new AccountIndustryGroup(Value.HOBBY_AND_INTEREST_GROUPS, "hobby_and_interest_groups"); + + public static final AccountIndustryGroup REHABILITATION_AND_THERAPY = + new AccountIndustryGroup(Value.REHABILITATION_AND_THERAPY, "rehabilitation_and_therapy"); + + public static final AccountIndustryGroup LOGISTICS_AND_TRANSPORTATION_SERVICES = new AccountIndustryGroup( + Value.LOGISTICS_AND_TRANSPORTATION_SERVICES, "logistics_and_transportation_services"); + + public static final AccountIndustryGroup RETAIL = new AccountIndustryGroup(Value.RETAIL, "retail"); + + public static final AccountIndustryGroup BUSINESS_AND_MONEY_GROUPS = + new AccountIndustryGroup(Value.BUSINESS_AND_MONEY_GROUPS, "business_and_money_groups"); + + public static final AccountIndustryGroup CLOTHING_AND_APPAREL = + new AccountIndustryGroup(Value.CLOTHING_AND_APPAREL, "clothing_and_apparel"); + + public static final AccountIndustryGroup CREATIVE_AND_EDUCATION = + new AccountIndustryGroup(Value.CREATIVE_AND_EDUCATION, "creative_and_education"); + + public static final AccountIndustryGroup NEWS_AND_POLITICS = + new AccountIndustryGroup(Value.NEWS_AND_POLITICS, "news_and_politics"); + + public static final AccountIndustryGroup BEAUTY_AND_PERSONAL_CARE = + new AccountIndustryGroup(Value.BEAUTY_AND_PERSONAL_CARE, "beauty_and_personal_care"); + + public static final AccountIndustryGroup DELIVERY_AND_LOGISTICS = + new AccountIndustryGroup(Value.DELIVERY_AND_LOGISTICS, "delivery_and_logistics"); + + public static final AccountIndustryGroup HEALTH_AND_WELLNESS_SERVICES = + new AccountIndustryGroup(Value.HEALTH_AND_WELLNESS_SERVICES, "health_and_wellness_services"); + + public static final AccountIndustryGroup HOBBIES_AND_LIFESTYLE = + new AccountIndustryGroup(Value.HOBBIES_AND_LIFESTYLE, "hobbies_and_lifestyle"); + + public static final AccountIndustryGroup PRODUCT_MARKETPLACES = + new AccountIndustryGroup(Value.PRODUCT_MARKETPLACES, "product_marketplaces"); + + public static final AccountIndustryGroup PETS_AND_ANIMALS = + new AccountIndustryGroup(Value.PETS_AND_ANIMALS, "pets_and_animals"); + + public static final AccountIndustryGroup PROFESSIONAL_SERVICES_STOREFRONT = + new AccountIndustryGroup(Value.PROFESSIONAL_SERVICES_STOREFRONT, "professional_services_storefront"); + + public static final AccountIndustryGroup CREATIVE_AND_CONTENT_CREATION = + new AccountIndustryGroup(Value.CREATIVE_AND_CONTENT_CREATION, "creative_and_content_creation"); + + public static final AccountIndustryGroup SOCIAL_ENTERTAINMENT_EVENTS = + new AccountIndustryGroup(Value.SOCIAL_ENTERTAINMENT_EVENTS, "social_entertainment_events"); + + public static final AccountIndustryGroup CREATIVE_SERVICES = + new AccountIndustryGroup(Value.CREATIVE_SERVICES, "creative_services"); + + public static final AccountIndustryGroup REAL_ESTATE = new AccountIndustryGroup(Value.REAL_ESTATE, "real_estate"); + + public static final AccountIndustryGroup FITNESS_AND_RECREATION = + new AccountIndustryGroup(Value.FITNESS_AND_RECREATION, "fitness_and_recreation"); + + public static final AccountIndustryGroup FOOD_AND_HOSPITALITY_MARKETPLACES = + new AccountIndustryGroup(Value.FOOD_AND_HOSPITALITY_MARKETPLACES, "food_and_hospitality_marketplaces"); + + public static final AccountIndustryGroup RENTAL_MARKETPLACES = + new AccountIndustryGroup(Value.RENTAL_MARKETPLACES, "rental_marketplaces"); + + public static final AccountIndustryGroup SPECIALTY_MEDICAL_CARE = + new AccountIndustryGroup(Value.SPECIALTY_MEDICAL_CARE, "specialty_medical_care"); + + public static final AccountIndustryGroup FINANCE_AND_INVESTING = + new AccountIndustryGroup(Value.FINANCE_AND_INVESTING, "finance_and_investing"); + + public static final AccountIndustryGroup AGRICULTURE_AND_FARMING = + new AccountIndustryGroup(Value.AGRICULTURE_AND_FARMING, "agriculture_and_farming"); + + public static final AccountIndustryGroup ACADEMIC_AND_TEST_PREP = + new AccountIndustryGroup(Value.ACADEMIC_AND_TEST_PREP, "academic_and_test_prep"); + + public static final AccountIndustryGroup OFFICE_AND_BUSINESS_SUPPLIES = + new AccountIndustryGroup(Value.OFFICE_AND_BUSINESS_SUPPLIES, "office_and_business_supplies"); + + public static final AccountIndustryGroup B2B_AND_PROFESSIONAL_MARKETPLACES = + new AccountIndustryGroup(Value.B2B_AND_PROFESSIONAL_MARKETPLACES, "b2b_and_professional_marketplaces"); + + public static final AccountIndustryGroup WELLNESS_AND_ALTERNATIVE = + new AccountIndustryGroup(Value.WELLNESS_AND_ALTERNATIVE, "wellness_and_alternative"); + + public static final AccountIndustryGroup TRADING_AND_INVESTING_GROUPS = + new AccountIndustryGroup(Value.TRADING_AND_INVESTING_GROUPS, "trading_and_investing_groups"); + + public static final AccountIndustryGroup GAMING_AND_ENTERTAINMENT_SOFTWARE = + new AccountIndustryGroup(Value.GAMING_AND_ENTERTAINMENT_SOFTWARE, "gaming_and_entertainment_software"); + + public static final AccountIndustryGroup MEDIA_AND_PUBLISHING_COMPANIES = + new AccountIndustryGroup(Value.MEDIA_AND_PUBLISHING_COMPANIES, "media_and_publishing_companies"); + + public static final AccountIndustryGroup TRADING_AND_INVESTING = + new AccountIndustryGroup(Value.TRADING_AND_INVESTING, "trading_and_investing"); + + public static final AccountIndustryGroup BEAUTY_AND_WELLNESS = + new AccountIndustryGroup(Value.BEAUTY_AND_WELLNESS, "beauty_and_wellness"); + + public static final AccountIndustryGroup BUSINESS_AND_ENTREPRENEURSHIP = + new AccountIndustryGroup(Value.BUSINESS_AND_ENTREPRENEURSHIP, "business_and_entrepreneurship"); + + public static final AccountIndustryGroup RECRUITING_AND_STAFFING = + new AccountIndustryGroup(Value.RECRUITING_AND_STAFFING, "recruiting_and_staffing"); + + public static final AccountIndustryGroup AI_AND_AUTOMATION_AGENCIES = + new AccountIndustryGroup(Value.AI_AND_AUTOMATION_AGENCIES, "ai_and_automation_agencies"); + + public static final AccountIndustryGroup PRODUCTIVITY_AND_BUSINESS_OPS = + new AccountIndustryGroup(Value.PRODUCTIVITY_AND_BUSINESS_OPS, "productivity_and_business_ops"); + + public static final AccountIndustryGroup AI_AND_AUTOMATION_SOFTWARE = + new AccountIndustryGroup(Value.AI_AND_AUTOMATION_SOFTWARE, "ai_and_automation_software"); + + public static final AccountIndustryGroup LIFESTYLE_AND_CULTURE = + new AccountIndustryGroup(Value.LIFESTYLE_AND_CULTURE, "lifestyle_and_culture"); + + public static final AccountIndustryGroup CHARITY_AND_CAUSE_EVENTS = + new AccountIndustryGroup(Value.CHARITY_AND_CAUSE_EVENTS, "charity_and_cause_events"); + + public static final AccountIndustryGroup SECURITY_AND_INVESTIGATIONS = + new AccountIndustryGroup(Value.SECURITY_AND_INVESTIGATIONS, "security_and_investigations"); + + public static final AccountIndustryGroup MUSIC_AND_PERFORMING_ARTS = + new AccountIndustryGroup(Value.MUSIC_AND_PERFORMING_ARTS, "music_and_performing_arts"); + + public static final AccountIndustryGroup PROFESSIONAL_SERVICES = + new AccountIndustryGroup(Value.PROFESSIONAL_SERVICES, "professional_services"); + + public static final AccountIndustryGroup SALES_AGENCIES = + new AccountIndustryGroup(Value.SALES_AGENCIES, "sales_agencies"); + + public static final AccountIndustryGroup SALES_AND_REVENUE = + new AccountIndustryGroup(Value.SALES_AND_REVENUE, "sales_and_revenue"); + + public static final AccountIndustryGroup CONFERENCE_AND_EXPO_EVENTS = + new AccountIndustryGroup(Value.CONFERENCE_AND_EXPO_EVENTS, "conference_and_expo_events"); + + public static final AccountIndustryGroup ELECTRONICS_AND_GADGETS = + new AccountIndustryGroup(Value.ELECTRONICS_AND_GADGETS, "electronics_and_gadgets"); + + public static final AccountIndustryGroup EDUCATIONAL_TRAINING_EVENTS = + new AccountIndustryGroup(Value.EDUCATIONAL_TRAINING_EVENTS, "educational_training_events"); + + public static final AccountIndustryGroup PUBLISHING_AND_INFO_PRODUCTS = + new AccountIndustryGroup(Value.PUBLISHING_AND_INFO_PRODUCTS, "publishing_and_info_products"); + + public static final AccountIndustryGroup FITNESS_AND_ATHLETICS = + new AccountIndustryGroup(Value.FITNESS_AND_ATHLETICS, "fitness_and_athletics"); + + public static final AccountIndustryGroup DEVELOPMENT_AGENCIES = + new AccountIndustryGroup(Value.DEVELOPMENT_AGENCIES, "development_agencies"); + + public static final AccountIndustryGroup MISCELLANEOUS = + new AccountIndustryGroup(Value.MISCELLANEOUS, "miscellaneous"); + + public static final AccountIndustryGroup MENTAL_HEALTH_AND_BEHAVIORAL = + new AccountIndustryGroup(Value.MENTAL_HEALTH_AND_BEHAVIORAL, "mental_health_and_behavioral"); + + public static final AccountIndustryGroup TECH_AND_DEVELOPMENT = + new AccountIndustryGroup(Value.TECH_AND_DEVELOPMENT, "tech_and_development"); + + public static final AccountIndustryGroup DEVELOPER_AND_TECHNICAL_TOOLS = + new AccountIndustryGroup(Value.DEVELOPER_AND_TECHNICAL_TOOLS, "developer_and_technical_tools"); + + public static final AccountIndustryGroup LANGUAGE_AND_COMMUNICATION = + new AccountIndustryGroup(Value.LANGUAGE_AND_COMMUNICATION, "language_and_communication"); + + public static final AccountIndustryGroup HOME_SERVICES_GIGS = + new AccountIndustryGroup(Value.HOME_SERVICES_GIGS, "home_services_gigs"); + + public static final AccountIndustryGroup CAREER_AND_PROFESSIONAL = + new AccountIndustryGroup(Value.CAREER_AND_PROFESSIONAL, "career_and_professional"); + + public static final AccountIndustryGroup COMMUNITY_AND_EDUCATION_SOFTWARE = + new AccountIndustryGroup(Value.COMMUNITY_AND_EDUCATION_SOFTWARE, "community_and_education_software"); + + public static final AccountIndustryGroup ACCESSORIES = new AccountIndustryGroup(Value.ACCESSORIES, "accessories"); + + public static final AccountIndustryGroup NONPROFIT_AND_CHARITY = + new AccountIndustryGroup(Value.NONPROFIT_AND_CHARITY, "nonprofit_and_charity"); + + public static final AccountIndustryGroup INDUSTRY_SPECIFIC_SOFTWARE = + new AccountIndustryGroup(Value.INDUSTRY_SPECIFIC_SOFTWARE, "industry_specific_software"); + + public static final AccountIndustryGroup CONSULTING = new AccountIndustryGroup(Value.CONSULTING, "consulting"); + + public static final AccountIndustryGroup PERSONAL_FINANCE = + new AccountIndustryGroup(Value.PERSONAL_FINANCE, "personal_finance"); + + public static final AccountIndustryGroup HOME_IMPROVEMENT_AND_TOOLS = + new AccountIndustryGroup(Value.HOME_IMPROVEMENT_AND_TOOLS, "home_improvement_and_tools"); + + public static final AccountIndustryGroup FITNESS_AND_HEALTH_GROUPS = + new AccountIndustryGroup(Value.FITNESS_AND_HEALTH_GROUPS, "fitness_and_health_groups"); + + public static final AccountIndustryGroup INDUSTRIAL_AND_MANUFACTURING = + new AccountIndustryGroup(Value.INDUSTRIAL_AND_MANUFACTURING, "industrial_and_manufacturing"); + + public static final AccountIndustryGroup WEIGHT_AND_METABOLIC_HEALTH = + new AccountIndustryGroup(Value.WEIGHT_AND_METABOLIC_HEALTH, "weight_and_metabolic_health"); + + public static final AccountIndustryGroup MARKETING_AND_SALES_SOFTWARE = + new AccountIndustryGroup(Value.MARKETING_AND_SALES_SOFTWARE, "marketing_and_sales_software"); + + public static final AccountIndustryGroup TRANSPORTATION = + new AccountIndustryGroup(Value.TRANSPORTATION, "transportation"); + + public static final AccountIndustryGroup WOMENS_AND_MENS_HEALTH = + new AccountIndustryGroup(Value.WOMENS_AND_MENS_HEALTH, "womens_and_mens_health"); + + public static final AccountIndustryGroup CLASS_ACTION_SETTLEMENT = + new AccountIndustryGroup(Value.CLASS_ACTION_SETTLEMENT, "class_action_settlement"); + + public static final AccountIndustryGroup PROFESSIONAL_GIGS = + new AccountIndustryGroup(Value.PROFESSIONAL_GIGS, "professional_gigs"); + + public static final AccountIndustryGroup TECH_AND_DEV_GROUPS = + new AccountIndustryGroup(Value.TECH_AND_DEV_GROUPS, "tech_and_dev_groups"); + + private final Value value; + + private final String string; + + AccountIndustryGroup(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountIndustryGroup && this.string.equals(((AccountIndustryGroup) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DERMATOLOGY_AND_SKIN: + return visitor.visitDermatologyAndSkin(); + case MARKETING_AND_ADVERTISING: + return visitor.visitMarketingAndAdvertising(); + case RESTAURANTS: + return visitor.visitRestaurants(); + case CREATIVE_AND_CONTENT_GROUPS: + return visitor.visitCreativeAndContentGroups(); + case HOME_AND_TRADE_STOREFRONTS: + return visitor.visitHomeAndTradeStorefronts(); + case HOME_AND_LIVING: + return visitor.visitHomeAndLiving(); + case RELIGION_AND_FAITH: + return visitor.visitReligionAndFaith(); + case REAL_ESTATE_SOFTWARE: + return visitor.visitRealEstateSoftware(); + case SUPPLEMENTS_AND_NUTRITION: + return visitor.visitSupplementsAndNutrition(); + case VIDEO_GAMES_AND_ESPORTS: + return visitor.visitVideoGamesAndEsports(); + case PERSONAL_DEVELOPMENT: + return visitor.visitPersonalDevelopment(); + case HEALTHCARE: + return visitor.visitHealthcare(); + case TRADING_AND_FINANCE_SOFTWARE: + return visitor.visitTradingAndFinanceSoftware(); + case SOCIAL_AND_NETWORKING_EVENTS: + return visitor.visitSocialAndNetworkingEvents(); + case DENTAL_AND_VISION: + return visitor.visitDentalAndVision(); + case CREATIVE_GIGS: + return visitor.visitCreativeGigs(); + case GAMING_GROUPS: + return visitor.visitGamingGroups(); + case SLEEP_AND_CHRONIC_CONDITIONS: + return visitor.visitSleepAndChronicConditions(); + case PERSONAL_SERVICES: + return visitor.visitPersonalServices(); + case SERVICE_MARKETPLACES: + return visitor.visitServiceMarketplaces(); + case ARTS_AND_CRAFTS: + return visitor.visitArtsAndCrafts(); + case CAFES_AND_QUICK_SERVICE: + return visitor.visitCafesAndQuickService(); + case GOVERNMENT_AND_PUBLIC: + return visitor.visitGovernmentAndPublic(); + case OUTDOOR_AND_SPORTS: + return visitor.visitOutdoorAndSports(); + case SPORTS_BETTING_GROUPS: + return visitor.visitSportsBettingGroups(); + case LIFESTYLE_AND_PERSONAL_GROWTH: + return visitor.visitLifestyleAndPersonalGrowth(); + case HOME_AND_TRADE_SERVICES: + return visitor.visitHomeAndTradeServices(); + case SPIRITUALITY_AND_PERSONAL_GROWTH: + return visitor.visitSpiritualityAndPersonalGrowth(); + case E_COMMERCE_SOFTWARE: + return visitor.visitECommerceSoftware(); + case HOSPITALITY_AND_LODGING: + return visitor.visitHospitalityAndLodging(); + case PERFORMANCE_AND_SHOW_EVENTS: + return visitor.visitPerformanceAndShowEvents(); + case CUSTOMER_SUPPORT_AGENCIES: + return visitor.visitCustomerSupportAgencies(); + case FUNERAL_AND_DEATH_CARE: + return visitor.visitFuneralAndDeathCare(); + case SUSTAINABILITY_AND_ECO_PRODUCTS: + return visitor.visitSustainabilityAndEcoProducts(); + case MARKETING_AGENCIES: + return visitor.visitMarketingAgencies(); + case LIFESTYLE_AND_WELLNESS_EVENTS: + return visitor.visitLifestyleAndWellnessEvents(); + case SPECIALIZED_GIGS: + return visitor.visitSpecializedGigs(); + case SECURITY_AND_PRIVACY_SOFTWARE: + return visitor.visitSecurityAndPrivacySoftware(); + case GENETIC_AND_SPECIALIZED: + return visitor.visitGeneticAndSpecialized(); + case PRIMARY_AND_GENERAL_CARE: + return visitor.visitPrimaryAndGeneralCare(); + case FAMILY_AND_COMMUNITY_EVENTS: + return visitor.visitFamilyAndCommunityEvents(); + case TECH_AND_AI: + return visitor.visitTechAndAi(); + case SPORTS_BETTING_AND_GAMBLING: + return visitor.visitSportsBettingAndGambling(); + case BARS_AND_BREWERIES: + return visitor.visitBarsAndBreweries(); + case DIGITAL_GOODS_AND_ACCOUNTS: + return visitor.visitDigitalGoodsAndAccounts(); + case ENTERTAINMENT_AND_LEISURE: + return visitor.visitEntertainmentAndLeisure(); + case HEALTHCARE_AND_WELLNESS_SOFTWARE: + return visitor.visitHealthcareAndWellnessSoftware(); + case EDUCATION_AND_CHILDCARE: + return visitor.visitEducationAndChildcare(); + case LEGAL_AND_COMPLIANCE: + return visitor.visitLegalAndCompliance(); + case COMMUNICATION_AND_MESSAGING_SOFTWARE: + return visitor.visitCommunicationAndMessagingSoftware(); + case SPORTS_AND_FITNESS_EVENTS: + return visitor.visitSportsAndFitnessEvents(); + case PET_SERVICES: + return visitor.visitPetServices(); + case DESIGN_AND_CREATIVE_AGENCIES: + return visitor.visitDesignAndCreativeAgencies(); + case VETERINARY: + return visitor.visitVeterinary(); + case AUTOMOTIVE: + return visitor.visitAutomotive(); + case HEALTH_AND_WELLNESS: + return visitor.visitHealthAndWellness(); + case LIFESTYLE_AND_PERSONAL_GROWTH_GROUPS: + return visitor.visitLifestyleAndPersonalGrowthGroups(); + case SPIRITUALITY_AND_MINDFULNESS: + return visitor.visitSpiritualityAndMindfulness(); + case CONTENT_AND_CLIPPING_AGENCIES: + return visitor.visitContentAndClippingAgencies(); + case BABY_AND_KIDS: + return visitor.visitBabyAndKids(); + case DIGITAL_AND_EDUCATION_MARKETPLACES: + return visitor.visitDigitalAndEducationMarketplaces(); + case TASK_AND_ERRANDS: + return visitor.visitTaskAndErrands(); + case FOOD_AND_BEVERAGES: + return visitor.visitFoodAndBeverages(); + case FITNESS_EQUIPMENT_AND_GEAR: + return visitor.visitFitnessEquipmentAndGear(); + case DATING_AND_RELATIONSHIPS: + return visitor.visitDatingAndRelationships(); + case HOBBY_AND_INTEREST_GROUPS: + return visitor.visitHobbyAndInterestGroups(); + case REHABILITATION_AND_THERAPY: + return visitor.visitRehabilitationAndTherapy(); + case LOGISTICS_AND_TRANSPORTATION_SERVICES: + return visitor.visitLogisticsAndTransportationServices(); + case RETAIL: + return visitor.visitRetail(); + case BUSINESS_AND_MONEY_GROUPS: + return visitor.visitBusinessAndMoneyGroups(); + case CLOTHING_AND_APPAREL: + return visitor.visitClothingAndApparel(); + case CREATIVE_AND_EDUCATION: + return visitor.visitCreativeAndEducation(); + case NEWS_AND_POLITICS: + return visitor.visitNewsAndPolitics(); + case BEAUTY_AND_PERSONAL_CARE: + return visitor.visitBeautyAndPersonalCare(); + case DELIVERY_AND_LOGISTICS: + return visitor.visitDeliveryAndLogistics(); + case HEALTH_AND_WELLNESS_SERVICES: + return visitor.visitHealthAndWellnessServices(); + case HOBBIES_AND_LIFESTYLE: + return visitor.visitHobbiesAndLifestyle(); + case PRODUCT_MARKETPLACES: + return visitor.visitProductMarketplaces(); + case PETS_AND_ANIMALS: + return visitor.visitPetsAndAnimals(); + case PROFESSIONAL_SERVICES_STOREFRONT: + return visitor.visitProfessionalServicesStorefront(); + case CREATIVE_AND_CONTENT_CREATION: + return visitor.visitCreativeAndContentCreation(); + case SOCIAL_ENTERTAINMENT_EVENTS: + return visitor.visitSocialEntertainmentEvents(); + case CREATIVE_SERVICES: + return visitor.visitCreativeServices(); + case REAL_ESTATE: + return visitor.visitRealEstate(); + case FITNESS_AND_RECREATION: + return visitor.visitFitnessAndRecreation(); + case FOOD_AND_HOSPITALITY_MARKETPLACES: + return visitor.visitFoodAndHospitalityMarketplaces(); + case RENTAL_MARKETPLACES: + return visitor.visitRentalMarketplaces(); + case SPECIALTY_MEDICAL_CARE: + return visitor.visitSpecialtyMedicalCare(); + case FINANCE_AND_INVESTING: + return visitor.visitFinanceAndInvesting(); + case AGRICULTURE_AND_FARMING: + return visitor.visitAgricultureAndFarming(); + case ACADEMIC_AND_TEST_PREP: + return visitor.visitAcademicAndTestPrep(); + case OFFICE_AND_BUSINESS_SUPPLIES: + return visitor.visitOfficeAndBusinessSupplies(); + case B2B_AND_PROFESSIONAL_MARKETPLACES: + return visitor.visitB2BAndProfessionalMarketplaces(); + case WELLNESS_AND_ALTERNATIVE: + return visitor.visitWellnessAndAlternative(); + case TRADING_AND_INVESTING_GROUPS: + return visitor.visitTradingAndInvestingGroups(); + case GAMING_AND_ENTERTAINMENT_SOFTWARE: + return visitor.visitGamingAndEntertainmentSoftware(); + case MEDIA_AND_PUBLISHING_COMPANIES: + return visitor.visitMediaAndPublishingCompanies(); + case TRADING_AND_INVESTING: + return visitor.visitTradingAndInvesting(); + case BEAUTY_AND_WELLNESS: + return visitor.visitBeautyAndWellness(); + case BUSINESS_AND_ENTREPRENEURSHIP: + return visitor.visitBusinessAndEntrepreneurship(); + case RECRUITING_AND_STAFFING: + return visitor.visitRecruitingAndStaffing(); + case AI_AND_AUTOMATION_AGENCIES: + return visitor.visitAiAndAutomationAgencies(); + case PRODUCTIVITY_AND_BUSINESS_OPS: + return visitor.visitProductivityAndBusinessOps(); + case AI_AND_AUTOMATION_SOFTWARE: + return visitor.visitAiAndAutomationSoftware(); + case LIFESTYLE_AND_CULTURE: + return visitor.visitLifestyleAndCulture(); + case CHARITY_AND_CAUSE_EVENTS: + return visitor.visitCharityAndCauseEvents(); + case SECURITY_AND_INVESTIGATIONS: + return visitor.visitSecurityAndInvestigations(); + case MUSIC_AND_PERFORMING_ARTS: + return visitor.visitMusicAndPerformingArts(); + case PROFESSIONAL_SERVICES: + return visitor.visitProfessionalServices(); + case SALES_AGENCIES: + return visitor.visitSalesAgencies(); + case SALES_AND_REVENUE: + return visitor.visitSalesAndRevenue(); + case CONFERENCE_AND_EXPO_EVENTS: + return visitor.visitConferenceAndExpoEvents(); + case ELECTRONICS_AND_GADGETS: + return visitor.visitElectronicsAndGadgets(); + case EDUCATIONAL_TRAINING_EVENTS: + return visitor.visitEducationalTrainingEvents(); + case PUBLISHING_AND_INFO_PRODUCTS: + return visitor.visitPublishingAndInfoProducts(); + case FITNESS_AND_ATHLETICS: + return visitor.visitFitnessAndAthletics(); + case DEVELOPMENT_AGENCIES: + return visitor.visitDevelopmentAgencies(); + case MISCELLANEOUS: + return visitor.visitMiscellaneous(); + case MENTAL_HEALTH_AND_BEHAVIORAL: + return visitor.visitMentalHealthAndBehavioral(); + case TECH_AND_DEVELOPMENT: + return visitor.visitTechAndDevelopment(); + case DEVELOPER_AND_TECHNICAL_TOOLS: + return visitor.visitDeveloperAndTechnicalTools(); + case LANGUAGE_AND_COMMUNICATION: + return visitor.visitLanguageAndCommunication(); + case HOME_SERVICES_GIGS: + return visitor.visitHomeServicesGigs(); + case CAREER_AND_PROFESSIONAL: + return visitor.visitCareerAndProfessional(); + case COMMUNITY_AND_EDUCATION_SOFTWARE: + return visitor.visitCommunityAndEducationSoftware(); + case ACCESSORIES: + return visitor.visitAccessories(); + case NONPROFIT_AND_CHARITY: + return visitor.visitNonprofitAndCharity(); + case INDUSTRY_SPECIFIC_SOFTWARE: + return visitor.visitIndustrySpecificSoftware(); + case CONSULTING: + return visitor.visitConsulting(); + case PERSONAL_FINANCE: + return visitor.visitPersonalFinance(); + case HOME_IMPROVEMENT_AND_TOOLS: + return visitor.visitHomeImprovementAndTools(); + case FITNESS_AND_HEALTH_GROUPS: + return visitor.visitFitnessAndHealthGroups(); + case INDUSTRIAL_AND_MANUFACTURING: + return visitor.visitIndustrialAndManufacturing(); + case WEIGHT_AND_METABOLIC_HEALTH: + return visitor.visitWeightAndMetabolicHealth(); + case MARKETING_AND_SALES_SOFTWARE: + return visitor.visitMarketingAndSalesSoftware(); + case TRANSPORTATION: + return visitor.visitTransportation(); + case WOMENS_AND_MENS_HEALTH: + return visitor.visitWomensAndMensHealth(); + case CLASS_ACTION_SETTLEMENT: + return visitor.visitClassActionSettlement(); + case PROFESSIONAL_GIGS: + return visitor.visitProfessionalGigs(); + case TECH_AND_DEV_GROUPS: + return visitor.visitTechAndDevGroups(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountIndustryGroup valueOf(String value) { + switch (value) { + case "dermatology_and_skin": + return DERMATOLOGY_AND_SKIN; + case "marketing_and_advertising": + return MARKETING_AND_ADVERTISING; + case "restaurants": + return RESTAURANTS; + case "creative_and_content_groups": + return CREATIVE_AND_CONTENT_GROUPS; + case "home_and_trade_storefronts": + return HOME_AND_TRADE_STOREFRONTS; + case "home_and_living": + return HOME_AND_LIVING; + case "religion_and_faith": + return RELIGION_AND_FAITH; + case "real_estate_software": + return REAL_ESTATE_SOFTWARE; + case "supplements_and_nutrition": + return SUPPLEMENTS_AND_NUTRITION; + case "video_games_and_esports": + return VIDEO_GAMES_AND_ESPORTS; + case "personal_development": + return PERSONAL_DEVELOPMENT; + case "healthcare": + return HEALTHCARE; + case "trading_and_finance_software": + return TRADING_AND_FINANCE_SOFTWARE; + case "social_and_networking_events": + return SOCIAL_AND_NETWORKING_EVENTS; + case "dental_and_vision": + return DENTAL_AND_VISION; + case "creative_gigs": + return CREATIVE_GIGS; + case "gaming_groups": + return GAMING_GROUPS; + case "sleep_and_chronic_conditions": + return SLEEP_AND_CHRONIC_CONDITIONS; + case "personal_services": + return PERSONAL_SERVICES; + case "service_marketplaces": + return SERVICE_MARKETPLACES; + case "arts_and_crafts": + return ARTS_AND_CRAFTS; + case "cafes_and_quick_service": + return CAFES_AND_QUICK_SERVICE; + case "government_and_public": + return GOVERNMENT_AND_PUBLIC; + case "outdoor_and_sports": + return OUTDOOR_AND_SPORTS; + case "sports_betting_groups": + return SPORTS_BETTING_GROUPS; + case "lifestyle_and_personal_growth": + return LIFESTYLE_AND_PERSONAL_GROWTH; + case "home_and_trade_services": + return HOME_AND_TRADE_SERVICES; + case "spirituality_and_personal_growth": + return SPIRITUALITY_AND_PERSONAL_GROWTH; + case "e_commerce_software": + return E_COMMERCE_SOFTWARE; + case "hospitality_and_lodging": + return HOSPITALITY_AND_LODGING; + case "performance_and_show_events": + return PERFORMANCE_AND_SHOW_EVENTS; + case "customer_support_agencies": + return CUSTOMER_SUPPORT_AGENCIES; + case "funeral_and_death_care": + return FUNERAL_AND_DEATH_CARE; + case "sustainability_and_eco_products": + return SUSTAINABILITY_AND_ECO_PRODUCTS; + case "marketing_agencies": + return MARKETING_AGENCIES; + case "lifestyle_and_wellness_events": + return LIFESTYLE_AND_WELLNESS_EVENTS; + case "specialized_gigs": + return SPECIALIZED_GIGS; + case "security_and_privacy_software": + return SECURITY_AND_PRIVACY_SOFTWARE; + case "genetic_and_specialized": + return GENETIC_AND_SPECIALIZED; + case "primary_and_general_care": + return PRIMARY_AND_GENERAL_CARE; + case "family_and_community_events": + return FAMILY_AND_COMMUNITY_EVENTS; + case "tech_and_ai": + return TECH_AND_AI; + case "sports_betting_and_gambling": + return SPORTS_BETTING_AND_GAMBLING; + case "bars_and_breweries": + return BARS_AND_BREWERIES; + case "digital_goods_and_accounts": + return DIGITAL_GOODS_AND_ACCOUNTS; + case "entertainment_and_leisure": + return ENTERTAINMENT_AND_LEISURE; + case "healthcare_and_wellness_software": + return HEALTHCARE_AND_WELLNESS_SOFTWARE; + case "education_and_childcare": + return EDUCATION_AND_CHILDCARE; + case "legal_and_compliance": + return LEGAL_AND_COMPLIANCE; + case "communication_and_messaging_software": + return COMMUNICATION_AND_MESSAGING_SOFTWARE; + case "sports_and_fitness_events": + return SPORTS_AND_FITNESS_EVENTS; + case "pet_services": + return PET_SERVICES; + case "design_and_creative_agencies": + return DESIGN_AND_CREATIVE_AGENCIES; + case "veterinary": + return VETERINARY; + case "automotive": + return AUTOMOTIVE; + case "health_and_wellness": + return HEALTH_AND_WELLNESS; + case "lifestyle_and_personal_growth_groups": + return LIFESTYLE_AND_PERSONAL_GROWTH_GROUPS; + case "spirituality_and_mindfulness": + return SPIRITUALITY_AND_MINDFULNESS; + case "content_and_clipping_agencies": + return CONTENT_AND_CLIPPING_AGENCIES; + case "baby_and_kids": + return BABY_AND_KIDS; + case "digital_and_education_marketplaces": + return DIGITAL_AND_EDUCATION_MARKETPLACES; + case "task_and_errands": + return TASK_AND_ERRANDS; + case "food_and_beverages": + return FOOD_AND_BEVERAGES; + case "fitness_equipment_and_gear": + return FITNESS_EQUIPMENT_AND_GEAR; + case "dating_and_relationships": + return DATING_AND_RELATIONSHIPS; + case "hobby_and_interest_groups": + return HOBBY_AND_INTEREST_GROUPS; + case "rehabilitation_and_therapy": + return REHABILITATION_AND_THERAPY; + case "logistics_and_transportation_services": + return LOGISTICS_AND_TRANSPORTATION_SERVICES; + case "retail": + return RETAIL; + case "business_and_money_groups": + return BUSINESS_AND_MONEY_GROUPS; + case "clothing_and_apparel": + return CLOTHING_AND_APPAREL; + case "creative_and_education": + return CREATIVE_AND_EDUCATION; + case "news_and_politics": + return NEWS_AND_POLITICS; + case "beauty_and_personal_care": + return BEAUTY_AND_PERSONAL_CARE; + case "delivery_and_logistics": + return DELIVERY_AND_LOGISTICS; + case "health_and_wellness_services": + return HEALTH_AND_WELLNESS_SERVICES; + case "hobbies_and_lifestyle": + return HOBBIES_AND_LIFESTYLE; + case "product_marketplaces": + return PRODUCT_MARKETPLACES; + case "pets_and_animals": + return PETS_AND_ANIMALS; + case "professional_services_storefront": + return PROFESSIONAL_SERVICES_STOREFRONT; + case "creative_and_content_creation": + return CREATIVE_AND_CONTENT_CREATION; + case "social_entertainment_events": + return SOCIAL_ENTERTAINMENT_EVENTS; + case "creative_services": + return CREATIVE_SERVICES; + case "real_estate": + return REAL_ESTATE; + case "fitness_and_recreation": + return FITNESS_AND_RECREATION; + case "food_and_hospitality_marketplaces": + return FOOD_AND_HOSPITALITY_MARKETPLACES; + case "rental_marketplaces": + return RENTAL_MARKETPLACES; + case "specialty_medical_care": + return SPECIALTY_MEDICAL_CARE; + case "finance_and_investing": + return FINANCE_AND_INVESTING; + case "agriculture_and_farming": + return AGRICULTURE_AND_FARMING; + case "academic_and_test_prep": + return ACADEMIC_AND_TEST_PREP; + case "office_and_business_supplies": + return OFFICE_AND_BUSINESS_SUPPLIES; + case "b2b_and_professional_marketplaces": + return B2B_AND_PROFESSIONAL_MARKETPLACES; + case "wellness_and_alternative": + return WELLNESS_AND_ALTERNATIVE; + case "trading_and_investing_groups": + return TRADING_AND_INVESTING_GROUPS; + case "gaming_and_entertainment_software": + return GAMING_AND_ENTERTAINMENT_SOFTWARE; + case "media_and_publishing_companies": + return MEDIA_AND_PUBLISHING_COMPANIES; + case "trading_and_investing": + return TRADING_AND_INVESTING; + case "beauty_and_wellness": + return BEAUTY_AND_WELLNESS; + case "business_and_entrepreneurship": + return BUSINESS_AND_ENTREPRENEURSHIP; + case "recruiting_and_staffing": + return RECRUITING_AND_STAFFING; + case "ai_and_automation_agencies": + return AI_AND_AUTOMATION_AGENCIES; + case "productivity_and_business_ops": + return PRODUCTIVITY_AND_BUSINESS_OPS; + case "ai_and_automation_software": + return AI_AND_AUTOMATION_SOFTWARE; + case "lifestyle_and_culture": + return LIFESTYLE_AND_CULTURE; + case "charity_and_cause_events": + return CHARITY_AND_CAUSE_EVENTS; + case "security_and_investigations": + return SECURITY_AND_INVESTIGATIONS; + case "music_and_performing_arts": + return MUSIC_AND_PERFORMING_ARTS; + case "professional_services": + return PROFESSIONAL_SERVICES; + case "sales_agencies": + return SALES_AGENCIES; + case "sales_and_revenue": + return SALES_AND_REVENUE; + case "conference_and_expo_events": + return CONFERENCE_AND_EXPO_EVENTS; + case "electronics_and_gadgets": + return ELECTRONICS_AND_GADGETS; + case "educational_training_events": + return EDUCATIONAL_TRAINING_EVENTS; + case "publishing_and_info_products": + return PUBLISHING_AND_INFO_PRODUCTS; + case "fitness_and_athletics": + return FITNESS_AND_ATHLETICS; + case "development_agencies": + return DEVELOPMENT_AGENCIES; + case "miscellaneous": + return MISCELLANEOUS; + case "mental_health_and_behavioral": + return MENTAL_HEALTH_AND_BEHAVIORAL; + case "tech_and_development": + return TECH_AND_DEVELOPMENT; + case "developer_and_technical_tools": + return DEVELOPER_AND_TECHNICAL_TOOLS; + case "language_and_communication": + return LANGUAGE_AND_COMMUNICATION; + case "home_services_gigs": + return HOME_SERVICES_GIGS; + case "career_and_professional": + return CAREER_AND_PROFESSIONAL; + case "community_and_education_software": + return COMMUNITY_AND_EDUCATION_SOFTWARE; + case "accessories": + return ACCESSORIES; + case "nonprofit_and_charity": + return NONPROFIT_AND_CHARITY; + case "industry_specific_software": + return INDUSTRY_SPECIFIC_SOFTWARE; + case "consulting": + return CONSULTING; + case "personal_finance": + return PERSONAL_FINANCE; + case "home_improvement_and_tools": + return HOME_IMPROVEMENT_AND_TOOLS; + case "fitness_and_health_groups": + return FITNESS_AND_HEALTH_GROUPS; + case "industrial_and_manufacturing": + return INDUSTRIAL_AND_MANUFACTURING; + case "weight_and_metabolic_health": + return WEIGHT_AND_METABOLIC_HEALTH; + case "marketing_and_sales_software": + return MARKETING_AND_SALES_SOFTWARE; + case "transportation": + return TRANSPORTATION; + case "womens_and_mens_health": + return WOMENS_AND_MENS_HEALTH; + case "class_action_settlement": + return CLASS_ACTION_SETTLEMENT; + case "professional_gigs": + return PROFESSIONAL_GIGS; + case "tech_and_dev_groups": + return TECH_AND_DEV_GROUPS; + default: + return new AccountIndustryGroup(Value.UNKNOWN, value); + } + } + + public enum Value { + ACADEMIC_AND_TEST_PREP, + + ACCESSORIES, + + AGRICULTURE_AND_FARMING, + + AI_AND_AUTOMATION_AGENCIES, + + AI_AND_AUTOMATION_SOFTWARE, + + ARTS_AND_CRAFTS, + + AUTOMOTIVE, + + B2B_AND_PROFESSIONAL_MARKETPLACES, + + BABY_AND_KIDS, + + BARS_AND_BREWERIES, + + BEAUTY_AND_PERSONAL_CARE, + + BEAUTY_AND_WELLNESS, + + BUSINESS_AND_ENTREPRENEURSHIP, + + BUSINESS_AND_MONEY_GROUPS, + + CAFES_AND_QUICK_SERVICE, + + CAREER_AND_PROFESSIONAL, + + CHARITY_AND_CAUSE_EVENTS, + + CLASS_ACTION_SETTLEMENT, + + CLOTHING_AND_APPAREL, + + COMMUNICATION_AND_MESSAGING_SOFTWARE, + + COMMUNITY_AND_EDUCATION_SOFTWARE, + + CONFERENCE_AND_EXPO_EVENTS, + + CONSULTING, + + CONTENT_AND_CLIPPING_AGENCIES, + + CREATIVE_AND_CONTENT_CREATION, + + CREATIVE_AND_CONTENT_GROUPS, + + CREATIVE_AND_EDUCATION, + + CREATIVE_GIGS, + + CREATIVE_SERVICES, + + CUSTOMER_SUPPORT_AGENCIES, + + DATING_AND_RELATIONSHIPS, + + DELIVERY_AND_LOGISTICS, + + DENTAL_AND_VISION, + + DERMATOLOGY_AND_SKIN, + + DESIGN_AND_CREATIVE_AGENCIES, + + DEVELOPER_AND_TECHNICAL_TOOLS, + + DEVELOPMENT_AGENCIES, + + DIGITAL_AND_EDUCATION_MARKETPLACES, + + DIGITAL_GOODS_AND_ACCOUNTS, + + E_COMMERCE_SOFTWARE, + + EDUCATION_AND_CHILDCARE, + + EDUCATIONAL_TRAINING_EVENTS, + + ELECTRONICS_AND_GADGETS, + + ENTERTAINMENT_AND_LEISURE, + + FAMILY_AND_COMMUNITY_EVENTS, + + FINANCE_AND_INVESTING, + + FITNESS_AND_ATHLETICS, + + FITNESS_AND_HEALTH_GROUPS, + + FITNESS_AND_RECREATION, + + FITNESS_EQUIPMENT_AND_GEAR, + + FOOD_AND_BEVERAGES, + + FOOD_AND_HOSPITALITY_MARKETPLACES, + + FUNERAL_AND_DEATH_CARE, + + GAMING_AND_ENTERTAINMENT_SOFTWARE, + + GAMING_GROUPS, + + GENETIC_AND_SPECIALIZED, + + GOVERNMENT_AND_PUBLIC, + + HEALTH_AND_WELLNESS, + + HEALTH_AND_WELLNESS_SERVICES, + + HEALTHCARE, + + HEALTHCARE_AND_WELLNESS_SOFTWARE, + + HOBBIES_AND_LIFESTYLE, + + HOBBY_AND_INTEREST_GROUPS, + + HOME_AND_LIVING, + + HOME_AND_TRADE_SERVICES, + + HOME_AND_TRADE_STOREFRONTS, + + HOME_IMPROVEMENT_AND_TOOLS, + + HOME_SERVICES_GIGS, + + HOSPITALITY_AND_LODGING, + + INDUSTRIAL_AND_MANUFACTURING, + + INDUSTRY_SPECIFIC_SOFTWARE, + + LANGUAGE_AND_COMMUNICATION, + + LEGAL_AND_COMPLIANCE, + + LIFESTYLE_AND_CULTURE, + + LIFESTYLE_AND_PERSONAL_GROWTH, + + LIFESTYLE_AND_PERSONAL_GROWTH_GROUPS, + + LIFESTYLE_AND_WELLNESS_EVENTS, + + LOGISTICS_AND_TRANSPORTATION_SERVICES, + + MARKETING_AGENCIES, + + MARKETING_AND_ADVERTISING, + + MARKETING_AND_SALES_SOFTWARE, + + MEDIA_AND_PUBLISHING_COMPANIES, + + MENTAL_HEALTH_AND_BEHAVIORAL, + + MISCELLANEOUS, + + MUSIC_AND_PERFORMING_ARTS, + + NEWS_AND_POLITICS, + + NONPROFIT_AND_CHARITY, + + OFFICE_AND_BUSINESS_SUPPLIES, + + OUTDOOR_AND_SPORTS, + + PERFORMANCE_AND_SHOW_EVENTS, + + PERSONAL_DEVELOPMENT, + + PERSONAL_FINANCE, + + PERSONAL_SERVICES, + + PET_SERVICES, + + PETS_AND_ANIMALS, + + PRIMARY_AND_GENERAL_CARE, + + PRODUCT_MARKETPLACES, + + PRODUCTIVITY_AND_BUSINESS_OPS, + + PROFESSIONAL_GIGS, + + PROFESSIONAL_SERVICES, + + PROFESSIONAL_SERVICES_STOREFRONT, + + PUBLISHING_AND_INFO_PRODUCTS, + + REAL_ESTATE, + + REAL_ESTATE_SOFTWARE, + + RECRUITING_AND_STAFFING, + + REHABILITATION_AND_THERAPY, + + RELIGION_AND_FAITH, + + RENTAL_MARKETPLACES, + + RESTAURANTS, + + RETAIL, + + SALES_AGENCIES, + + SALES_AND_REVENUE, + + SECURITY_AND_INVESTIGATIONS, + + SECURITY_AND_PRIVACY_SOFTWARE, + + SERVICE_MARKETPLACES, + + SLEEP_AND_CHRONIC_CONDITIONS, + + SOCIAL_AND_NETWORKING_EVENTS, + + SOCIAL_ENTERTAINMENT_EVENTS, + + SPECIALIZED_GIGS, + + SPECIALTY_MEDICAL_CARE, + + SPIRITUALITY_AND_MINDFULNESS, + + SPIRITUALITY_AND_PERSONAL_GROWTH, + + SPORTS_AND_FITNESS_EVENTS, + + SPORTS_BETTING_AND_GAMBLING, + + SPORTS_BETTING_GROUPS, + + SUPPLEMENTS_AND_NUTRITION, + + SUSTAINABILITY_AND_ECO_PRODUCTS, + + TASK_AND_ERRANDS, + + TECH_AND_AI, + + TECH_AND_DEV_GROUPS, + + TECH_AND_DEVELOPMENT, + + TRADING_AND_FINANCE_SOFTWARE, + + TRADING_AND_INVESTING, + + TRADING_AND_INVESTING_GROUPS, + + TRANSPORTATION, + + VETERINARY, + + VIDEO_GAMES_AND_ESPORTS, + + WEIGHT_AND_METABOLIC_HEALTH, + + WELLNESS_AND_ALTERNATIVE, + + WOMENS_AND_MENS_HEALTH, + + UNKNOWN + } + + public interface Visitor { + T visitAcademicAndTestPrep(); + + T visitAccessories(); + + T visitAgricultureAndFarming(); + + T visitAiAndAutomationAgencies(); + + T visitAiAndAutomationSoftware(); + + T visitArtsAndCrafts(); + + T visitAutomotive(); + + T visitB2BAndProfessionalMarketplaces(); + + T visitBabyAndKids(); + + T visitBarsAndBreweries(); + + T visitBeautyAndPersonalCare(); + + T visitBeautyAndWellness(); + + T visitBusinessAndEntrepreneurship(); + + T visitBusinessAndMoneyGroups(); + + T visitCafesAndQuickService(); + + T visitCareerAndProfessional(); + + T visitCharityAndCauseEvents(); + + T visitClassActionSettlement(); + + T visitClothingAndApparel(); + + T visitCommunicationAndMessagingSoftware(); + + T visitCommunityAndEducationSoftware(); + + T visitConferenceAndExpoEvents(); + + T visitConsulting(); + + T visitContentAndClippingAgencies(); + + T visitCreativeAndContentCreation(); + + T visitCreativeAndContentGroups(); + + T visitCreativeAndEducation(); + + T visitCreativeGigs(); + + T visitCreativeServices(); + + T visitCustomerSupportAgencies(); + + T visitDatingAndRelationships(); + + T visitDeliveryAndLogistics(); + + T visitDentalAndVision(); + + T visitDermatologyAndSkin(); + + T visitDesignAndCreativeAgencies(); + + T visitDeveloperAndTechnicalTools(); + + T visitDevelopmentAgencies(); + + T visitDigitalAndEducationMarketplaces(); + + T visitDigitalGoodsAndAccounts(); + + T visitECommerceSoftware(); + + T visitEducationAndChildcare(); + + T visitEducationalTrainingEvents(); + + T visitElectronicsAndGadgets(); + + T visitEntertainmentAndLeisure(); + + T visitFamilyAndCommunityEvents(); + + T visitFinanceAndInvesting(); + + T visitFitnessAndAthletics(); + + T visitFitnessAndHealthGroups(); + + T visitFitnessAndRecreation(); + + T visitFitnessEquipmentAndGear(); + + T visitFoodAndBeverages(); + + T visitFoodAndHospitalityMarketplaces(); + + T visitFuneralAndDeathCare(); + + T visitGamingAndEntertainmentSoftware(); + + T visitGamingGroups(); + + T visitGeneticAndSpecialized(); + + T visitGovernmentAndPublic(); + + T visitHealthAndWellness(); + + T visitHealthAndWellnessServices(); + + T visitHealthcare(); + + T visitHealthcareAndWellnessSoftware(); + + T visitHobbiesAndLifestyle(); + + T visitHobbyAndInterestGroups(); + + T visitHomeAndLiving(); + + T visitHomeAndTradeServices(); + + T visitHomeAndTradeStorefronts(); + + T visitHomeImprovementAndTools(); + + T visitHomeServicesGigs(); + + T visitHospitalityAndLodging(); + + T visitIndustrialAndManufacturing(); + + T visitIndustrySpecificSoftware(); + + T visitLanguageAndCommunication(); + + T visitLegalAndCompliance(); + + T visitLifestyleAndCulture(); + + T visitLifestyleAndPersonalGrowth(); + + T visitLifestyleAndPersonalGrowthGroups(); + + T visitLifestyleAndWellnessEvents(); + + T visitLogisticsAndTransportationServices(); + + T visitMarketingAgencies(); + + T visitMarketingAndAdvertising(); + + T visitMarketingAndSalesSoftware(); + + T visitMediaAndPublishingCompanies(); + + T visitMentalHealthAndBehavioral(); + + T visitMiscellaneous(); + + T visitMusicAndPerformingArts(); + + T visitNewsAndPolitics(); + + T visitNonprofitAndCharity(); + + T visitOfficeAndBusinessSupplies(); + + T visitOutdoorAndSports(); + + T visitPerformanceAndShowEvents(); + + T visitPersonalDevelopment(); + + T visitPersonalFinance(); + + T visitPersonalServices(); + + T visitPetServices(); + + T visitPetsAndAnimals(); + + T visitPrimaryAndGeneralCare(); + + T visitProductMarketplaces(); + + T visitProductivityAndBusinessOps(); + + T visitProfessionalGigs(); + + T visitProfessionalServices(); + + T visitProfessionalServicesStorefront(); + + T visitPublishingAndInfoProducts(); + + T visitRealEstate(); + + T visitRealEstateSoftware(); + + T visitRecruitingAndStaffing(); + + T visitRehabilitationAndTherapy(); + + T visitReligionAndFaith(); + + T visitRentalMarketplaces(); + + T visitRestaurants(); + + T visitRetail(); + + T visitSalesAgencies(); + + T visitSalesAndRevenue(); + + T visitSecurityAndInvestigations(); + + T visitSecurityAndPrivacySoftware(); + + T visitServiceMarketplaces(); + + T visitSleepAndChronicConditions(); + + T visitSocialAndNetworkingEvents(); + + T visitSocialEntertainmentEvents(); + + T visitSpecializedGigs(); + + T visitSpecialtyMedicalCare(); + + T visitSpiritualityAndMindfulness(); + + T visitSpiritualityAndPersonalGrowth(); + + T visitSportsAndFitnessEvents(); + + T visitSportsBettingAndGambling(); + + T visitSportsBettingGroups(); + + T visitSupplementsAndNutrition(); + + T visitSustainabilityAndEcoProducts(); + + T visitTaskAndErrands(); + + T visitTechAndAi(); + + T visitTechAndDevGroups(); + + T visitTechAndDevelopment(); + + T visitTradingAndFinanceSoftware(); + + T visitTradingAndInvesting(); + + T visitTradingAndInvestingGroups(); + + T visitTransportation(); + + T visitVeterinary(); + + T visitVideoGamesAndEsports(); + + T visitWeightAndMetabolicHealth(); + + T visitWellnessAndAlternative(); + + T visitWomensAndMensHealth(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountLink.java b/src/main/java/com/whop/api/types/AccountLink.java new file mode 100644 index 00000000..1b114925 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountLink.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountLink.Builder.class) +public final class AccountLink { + private final OffsetDateTime expiresAt; + + private final String url; + + private final Map additionalProperties; + + private AccountLink(OffsetDateTime expiresAt, String url, Map additionalProperties) { + this.expiresAt = expiresAt; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The timestamp after which this account link URL is no longer valid. + */ + @JsonProperty("expires_at") + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + /** + * @return The temporary URL to redirect the user to for account access. Expires at the time specified by expires_at. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountLink && equalTo((AccountLink) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountLink other) { + return expiresAt.equals(other.expiresAt) && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.expiresAt, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExpiresAtStage builder() { + return new Builder(); + } + + public interface ExpiresAtStage { + /** + *

The timestamp after which this account link URL is no longer valid.

+ */ + UrlStage expiresAt(@NotNull OffsetDateTime expiresAt); + + Builder from(AccountLink other); + } + + public interface UrlStage { + /** + *

The temporary URL to redirect the user to for account access. Expires at the time specified by expires_at.

+ */ + _FinalStage url(@NotNull String url); + } + + public interface _FinalStage { + AccountLink build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExpiresAtStage, UrlStage, _FinalStage { + private OffsetDateTime expiresAt; + + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountLink other) { + expiresAt(other.getExpiresAt()); + url(other.getUrl()); + return this; + } + + /** + *

The timestamp after which this account link URL is no longer valid.

+ *

The timestamp after which this account link URL is no longer valid.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("expires_at") + public UrlStage expiresAt(@NotNull OffsetDateTime expiresAt) { + this.expiresAt = Objects.requireNonNull(expiresAt, "expiresAt must not be null"); + return this; + } + + /** + *

The temporary URL to redirect the user to for account access. Expires at the time specified by expires_at.

+ *

The temporary URL to redirect the user to for account access. Expires at the time specified by expires_at.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public AccountLink build() { + return new AccountLink(expiresAt, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountLinkUseCases.java b/src/main/java/com/whop/api/types/AccountLinkUseCases.java new file mode 100644 index 00000000..81c7ca0a --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountLinkUseCases.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountLinkUseCases { + public static final AccountLinkUseCases ACCOUNT_ONBOARDING = + new AccountLinkUseCases(Value.ACCOUNT_ONBOARDING, "account_onboarding"); + + public static final AccountLinkUseCases PAYOUTS_PORTAL = + new AccountLinkUseCases(Value.PAYOUTS_PORTAL, "payouts_portal"); + + private final Value value; + + private final String string; + + AccountLinkUseCases(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountLinkUseCases && this.string.equals(((AccountLinkUseCases) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ACCOUNT_ONBOARDING: + return visitor.visitAccountOnboarding(); + case PAYOUTS_PORTAL: + return visitor.visitPayoutsPortal(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountLinkUseCases valueOf(String value) { + switch (value) { + case "account_onboarding": + return ACCOUNT_ONBOARDING; + case "payouts_portal": + return PAYOUTS_PORTAL; + default: + return new AccountLinkUseCases(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT_ONBOARDING, + + PAYOUTS_PORTAL, + + UNKNOWN + } + + public interface Visitor { + T visitAccountOnboarding(); + + T visitPayoutsPortal(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountOnboardingType.java b/src/main/java/com/whop/api/types/AccountOnboardingType.java new file mode 100644 index 00000000..f3533ed7 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountOnboardingType.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountOnboardingType { + public static final AccountOnboardingType SELLER = new AccountOnboardingType(Value.SELLER, "seller"); + + public static final AccountOnboardingType PLATFORM = new AccountOnboardingType(Value.PLATFORM, "platform"); + + private final Value value; + + private final String string; + + AccountOnboardingType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountOnboardingType + && this.string.equals(((AccountOnboardingType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELLER: + return visitor.visitSeller(); + case PLATFORM: + return visitor.visitPlatform(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountOnboardingType valueOf(String value) { + switch (value) { + case "seller": + return SELLER; + case "platform": + return PLATFORM; + default: + return new AccountOnboardingType(Value.UNKNOWN, value); + } + } + + public enum Value { + PLATFORM, + + SELLER, + + UNKNOWN + } + + public interface Visitor { + T visitPlatform(); + + T visitSeller(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountOpengraphImageVariant.java b/src/main/java/com/whop/api/types/AccountOpengraphImageVariant.java new file mode 100644 index 00000000..b1d7ba09 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountOpengraphImageVariant.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountOpengraphImageVariant { + public static final AccountOpengraphImageVariant BLACK = new AccountOpengraphImageVariant(Value.BLACK, "black"); + + public static final AccountOpengraphImageVariant WHITE = new AccountOpengraphImageVariant(Value.WHITE, "white"); + + public static final AccountOpengraphImageVariant ORANGE = new AccountOpengraphImageVariant(Value.ORANGE, "orange"); + + private final Value value; + + private final String string; + + AccountOpengraphImageVariant(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountOpengraphImageVariant + && this.string.equals(((AccountOpengraphImageVariant) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case BLACK: + return visitor.visitBlack(); + case WHITE: + return visitor.visitWhite(); + case ORANGE: + return visitor.visitOrange(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountOpengraphImageVariant valueOf(String value) { + switch (value) { + case "black": + return BLACK; + case "white": + return WHITE; + case "orange": + return ORANGE; + default: + return new AccountOpengraphImageVariant(Value.UNKNOWN, value); + } + } + + public enum Value { + WHITE, + + BLACK, + + ORANGE, + + UNKNOWN + } + + public interface Visitor { + T visitWhite(); + + T visitBlack(); + + T visitOrange(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountParent.java b/src/main/java/com/whop/api/types/AccountParent.java new file mode 100644 index 00000000..a7413088 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountParent.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountParent.Builder.class) +public final class AccountParent { + private final String id; + + private final Optional logoUrl; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private AccountParent( + String id, Optional logoUrl, String route, String title, Map additionalProperties) { + this.id = id; + this.logoUrl = logoUrl; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account logo image URL. + */ + @JsonIgnore + public Optional getLogoUrl() { + if (logoUrl == null) { + return Optional.empty(); + } + return logoUrl; + } + + /** + * @return Account public route identifier. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return Account display name. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo_url") + private Optional _getLogoUrl() { + return logoUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountParent && equalTo((AccountParent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountParent other) { + return id.equals(other.id) + && logoUrl.equals(other.logoUrl) + && route.equals(other.route) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.logoUrl, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID, prefixed biz_.

+ */ + RouteStage id(@NotNull String id); + + Builder from(AccountParent other); + } + + public interface RouteStage { + /** + *

Account public route identifier.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

Account display name.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + AccountParent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account logo image URL.

+ */ + _FinalStage logoUrl(Optional logoUrl); + + _FinalStage logoUrl(String logoUrl); + + _FinalStage logoUrl(Nullable logoUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + private Optional logoUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountParent other) { + id(other.getId()); + logoUrl(other.getLogoUrl()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ *

Account ID, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account public route identifier.

+ *

Account public route identifier.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

Account display name.

+ *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Account logo image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(Nullable logoUrl) { + if (logoUrl.isNull()) { + this.logoUrl = null; + } else if (logoUrl.isEmpty()) { + this.logoUrl = Optional.empty(); + } else { + this.logoUrl = Optional.of(logoUrl.get()); + } + return this; + } + + /** + *

Account logo image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(String logoUrl) { + this.logoUrl = Optional.ofNullable(logoUrl); + return this; + } + + /** + *

Account logo image URL.

+ */ + @java.lang.Override + @JsonSetter(value = "logo_url", nulls = Nulls.SKIP) + public _FinalStage logoUrl(Optional logoUrl) { + this.logoUrl = logoUrl; + return this; + } + + @java.lang.Override + public AccountParent build() { + return new AccountParent(id, logoUrl, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountPaymentControls.java b/src/main/java/com/whop/api/types/AccountPaymentControls.java new file mode 100644 index 00000000..46061822 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountPaymentControls.java @@ -0,0 +1,538 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountPaymentControls.Builder.class) +public final class AccountPaymentControls { + private final AccountDisputeAlertAutoRefundControl disputeAlertAutoRefund; + + private final Optional disputeAlertFeeUsd; + + private final boolean enforce3Ds; + + private final boolean financingDisabled; + + private final double highRiskProcessingFeePercentage; + + private final double pendingAutoTopupFeePercentage; + + private final int pendingBalanceDelayDays; + + private final AccountReserveControl reserve; + + private final AccountResolutionCenterAutoRefundControl resolutionCenterAutoRefund; + + private final List restrictedPaymentMethods; + + private final Map additionalProperties; + + private AccountPaymentControls( + AccountDisputeAlertAutoRefundControl disputeAlertAutoRefund, + Optional disputeAlertFeeUsd, + boolean enforce3Ds, + boolean financingDisabled, + double highRiskProcessingFeePercentage, + double pendingAutoTopupFeePercentage, + int pendingBalanceDelayDays, + AccountReserveControl reserve, + AccountResolutionCenterAutoRefundControl resolutionCenterAutoRefund, + List restrictedPaymentMethods, + Map additionalProperties) { + this.disputeAlertAutoRefund = disputeAlertAutoRefund; + this.disputeAlertFeeUsd = disputeAlertFeeUsd; + this.enforce3Ds = enforce3Ds; + this.financingDisabled = financingDisabled; + this.highRiskProcessingFeePercentage = highRiskProcessingFeePercentage; + this.pendingAutoTopupFeePercentage = pendingAutoTopupFeePercentage; + this.pendingBalanceDelayDays = pendingBalanceDelayDays; + this.reserve = reserve; + this.resolutionCenterAutoRefund = resolutionCenterAutoRefund; + this.restrictedPaymentMethods = restrictedPaymentMethods; + this.additionalProperties = additionalProperties; + } + + /** + * @return Automatic refund settings for pre-chargeback dispute alerts. + */ + @JsonProperty("dispute_alert_auto_refund") + public AccountDisputeAlertAutoRefundControl getDisputeAlertAutoRefund() { + return disputeAlertAutoRefund; + } + + /** + * @return Fee charged for each dispute alert in USD. null when unavailable. + */ + @JsonIgnore + public Optional getDisputeAlertFeeUsd() { + if (disputeAlertFeeUsd == null) { + return Optional.empty(); + } + return disputeAlertFeeUsd; + } + + /** + * @return Whether 3-D Secure is forced on every card payment at checkout. The account cannot bypass it while set. + */ + @JsonProperty("enforce_3ds") + public boolean getEnforce3Ds() { + return enforce3Ds; + } + + /** + * @return Whether payment health controls explicitly disable financing. This is independent of financing approval in capabilities.accept_bnpl_payments. + */ + @JsonProperty("financing_disabled") + public boolean getFinancingDisabled() { + return financingDisabled; + } + + /** + * @return Additional processing fee percentage for high-risk processing. + */ + @JsonProperty("high_risk_processing_fee_percentage") + public double getHighRiskProcessingFeePercentage() { + return highRiskProcessingFeePercentage; + } + + /** + * @return Percentage fee charged when pending, not-yet-settled balance is advanced to fund the account's cards balance, where 2 means 2%. 0 when the account is exempt. + */ + @JsonProperty("pending_auto_topup_fee_percentage") + public double getPendingAutoTopupFeePercentage() { + return pendingAutoTopupFeePercentage; + } + + /** + * @return Additional days payments remain pending before becoming available. + */ + @JsonProperty("pending_balance_delay_days") + public int getPendingBalanceDelayDays() { + return pendingBalanceDelayDays; + } + + /** + * @return Reserve currently applied to incoming payment volume. + */ + @JsonProperty("reserve") + public AccountReserveControl getReserve() { + return reserve; + } + + /** + * @return Automatic refund settings for resolution center cases. + */ + @JsonProperty("resolution_center_auto_refund") + public AccountResolutionCenterAutoRefundControl getResolutionCenterAutoRefund() { + return resolutionCenterAutoRefund; + } + + @JsonProperty("restricted_payment_methods") + public List getRestrictedPaymentMethods() { + return restrictedPaymentMethods; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("dispute_alert_fee_usd") + private Optional _getDisputeAlertFeeUsd() { + return disputeAlertFeeUsd; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountPaymentControls && equalTo((AccountPaymentControls) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountPaymentControls other) { + return disputeAlertAutoRefund.equals(other.disputeAlertAutoRefund) + && disputeAlertFeeUsd.equals(other.disputeAlertFeeUsd) + && enforce3Ds == other.enforce3Ds + && financingDisabled == other.financingDisabled + && highRiskProcessingFeePercentage == other.highRiskProcessingFeePercentage + && pendingAutoTopupFeePercentage == other.pendingAutoTopupFeePercentage + && pendingBalanceDelayDays == other.pendingBalanceDelayDays + && reserve.equals(other.reserve) + && resolutionCenterAutoRefund.equals(other.resolutionCenterAutoRefund) + && restrictedPaymentMethods.equals(other.restrictedPaymentMethods); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.disputeAlertAutoRefund, + this.disputeAlertFeeUsd, + this.enforce3Ds, + this.financingDisabled, + this.highRiskProcessingFeePercentage, + this.pendingAutoTopupFeePercentage, + this.pendingBalanceDelayDays, + this.reserve, + this.resolutionCenterAutoRefund, + this.restrictedPaymentMethods); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DisputeAlertAutoRefundStage builder() { + return new Builder(); + } + + public interface DisputeAlertAutoRefundStage { + /** + *

Automatic refund settings for pre-chargeback dispute alerts.

+ */ + Enforce3DsStage disputeAlertAutoRefund(@NotNull AccountDisputeAlertAutoRefundControl disputeAlertAutoRefund); + + Builder from(AccountPaymentControls other); + } + + public interface Enforce3DsStage { + /** + *

Whether 3-D Secure is forced on every card payment at checkout. The account cannot bypass it while set.

+ */ + FinancingDisabledStage enforce3Ds(boolean enforce3Ds); + } + + public interface FinancingDisabledStage { + /** + *

Whether payment health controls explicitly disable financing. This is independent of financing approval in capabilities.accept_bnpl_payments.

+ */ + HighRiskProcessingFeePercentageStage financingDisabled(boolean financingDisabled); + } + + public interface HighRiskProcessingFeePercentageStage { + /** + *

Additional processing fee percentage for high-risk processing.

+ */ + PendingAutoTopupFeePercentageStage highRiskProcessingFeePercentage(double highRiskProcessingFeePercentage); + } + + public interface PendingAutoTopupFeePercentageStage { + /** + *

Percentage fee charged when pending, not-yet-settled balance is advanced to fund the account's cards balance, where 2 means 2%. 0 when the account is exempt.

+ */ + PendingBalanceDelayDaysStage pendingAutoTopupFeePercentage(double pendingAutoTopupFeePercentage); + } + + public interface PendingBalanceDelayDaysStage { + /** + *

Additional days payments remain pending before becoming available.

+ */ + ReserveStage pendingBalanceDelayDays(int pendingBalanceDelayDays); + } + + public interface ReserveStage { + /** + *

Reserve currently applied to incoming payment volume.

+ */ + ResolutionCenterAutoRefundStage reserve(@NotNull AccountReserveControl reserve); + } + + public interface ResolutionCenterAutoRefundStage { + /** + *

Automatic refund settings for resolution center cases.

+ */ + _FinalStage resolutionCenterAutoRefund( + @NotNull AccountResolutionCenterAutoRefundControl resolutionCenterAutoRefund); + } + + public interface _FinalStage { + AccountPaymentControls build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Fee charged for each dispute alert in USD. null when unavailable.

+ */ + _FinalStage disputeAlertFeeUsd(Optional disputeAlertFeeUsd); + + _FinalStage disputeAlertFeeUsd(Double disputeAlertFeeUsd); + + _FinalStage disputeAlertFeeUsd(Nullable disputeAlertFeeUsd); + + _FinalStage restrictedPaymentMethods( + List restrictedPaymentMethods); + + _FinalStage addRestrictedPaymentMethods( + AccountPaymentControlsRestrictedPaymentMethodsItem restrictedPaymentMethods); + + _FinalStage addAllRestrictedPaymentMethods( + List restrictedPaymentMethods); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements DisputeAlertAutoRefundStage, + Enforce3DsStage, + FinancingDisabledStage, + HighRiskProcessingFeePercentageStage, + PendingAutoTopupFeePercentageStage, + PendingBalanceDelayDaysStage, + ReserveStage, + ResolutionCenterAutoRefundStage, + _FinalStage { + private AccountDisputeAlertAutoRefundControl disputeAlertAutoRefund; + + private boolean enforce3Ds; + + private boolean financingDisabled; + + private double highRiskProcessingFeePercentage; + + private double pendingAutoTopupFeePercentage; + + private int pendingBalanceDelayDays; + + private AccountReserveControl reserve; + + private AccountResolutionCenterAutoRefundControl resolutionCenterAutoRefund; + + private List restrictedPaymentMethods = new ArrayList<>(); + + private Optional disputeAlertFeeUsd = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountPaymentControls other) { + disputeAlertAutoRefund(other.getDisputeAlertAutoRefund()); + disputeAlertFeeUsd(other.getDisputeAlertFeeUsd()); + enforce3Ds(other.getEnforce3Ds()); + financingDisabled(other.getFinancingDisabled()); + highRiskProcessingFeePercentage(other.getHighRiskProcessingFeePercentage()); + pendingAutoTopupFeePercentage(other.getPendingAutoTopupFeePercentage()); + pendingBalanceDelayDays(other.getPendingBalanceDelayDays()); + reserve(other.getReserve()); + resolutionCenterAutoRefund(other.getResolutionCenterAutoRefund()); + restrictedPaymentMethods(other.getRestrictedPaymentMethods()); + return this; + } + + /** + *

Automatic refund settings for pre-chargeback dispute alerts.

+ *

Automatic refund settings for pre-chargeback dispute alerts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dispute_alert_auto_refund") + public Enforce3DsStage disputeAlertAutoRefund( + @NotNull AccountDisputeAlertAutoRefundControl disputeAlertAutoRefund) { + this.disputeAlertAutoRefund = + Objects.requireNonNull(disputeAlertAutoRefund, "disputeAlertAutoRefund must not be null"); + return this; + } + + /** + *

Whether 3-D Secure is forced on every card payment at checkout. The account cannot bypass it while set.

+ *

Whether 3-D Secure is forced on every card payment at checkout. The account cannot bypass it while set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("enforce_3ds") + public FinancingDisabledStage enforce3Ds(boolean enforce3Ds) { + this.enforce3Ds = enforce3Ds; + return this; + } + + /** + *

Whether payment health controls explicitly disable financing. This is independent of financing approval in capabilities.accept_bnpl_payments.

+ *

Whether payment health controls explicitly disable financing. This is independent of financing approval in capabilities.accept_bnpl_payments.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("financing_disabled") + public HighRiskProcessingFeePercentageStage financingDisabled(boolean financingDisabled) { + this.financingDisabled = financingDisabled; + return this; + } + + /** + *

Additional processing fee percentage for high-risk processing.

+ *

Additional processing fee percentage for high-risk processing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("high_risk_processing_fee_percentage") + public PendingAutoTopupFeePercentageStage highRiskProcessingFeePercentage( + double highRiskProcessingFeePercentage) { + this.highRiskProcessingFeePercentage = highRiskProcessingFeePercentage; + return this; + } + + /** + *

Percentage fee charged when pending, not-yet-settled balance is advanced to fund the account's cards balance, where 2 means 2%. 0 when the account is exempt.

+ *

Percentage fee charged when pending, not-yet-settled balance is advanced to fund the account's cards balance, where 2 means 2%. 0 when the account is exempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("pending_auto_topup_fee_percentage") + public PendingBalanceDelayDaysStage pendingAutoTopupFeePercentage(double pendingAutoTopupFeePercentage) { + this.pendingAutoTopupFeePercentage = pendingAutoTopupFeePercentage; + return this; + } + + /** + *

Additional days payments remain pending before becoming available.

+ *

Additional days payments remain pending before becoming available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("pending_balance_delay_days") + public ReserveStage pendingBalanceDelayDays(int pendingBalanceDelayDays) { + this.pendingBalanceDelayDays = pendingBalanceDelayDays; + return this; + } + + /** + *

Reserve currently applied to incoming payment volume.

+ *

Reserve currently applied to incoming payment volume.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reserve") + public ResolutionCenterAutoRefundStage reserve(@NotNull AccountReserveControl reserve) { + this.reserve = Objects.requireNonNull(reserve, "reserve must not be null"); + return this; + } + + /** + *

Automatic refund settings for resolution center cases.

+ *

Automatic refund settings for resolution center cases.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resolution_center_auto_refund") + public _FinalStage resolutionCenterAutoRefund( + @NotNull AccountResolutionCenterAutoRefundControl resolutionCenterAutoRefund) { + this.resolutionCenterAutoRefund = + Objects.requireNonNull(resolutionCenterAutoRefund, "resolutionCenterAutoRefund must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllRestrictedPaymentMethods( + List restrictedPaymentMethods) { + if (restrictedPaymentMethods != null) { + this.restrictedPaymentMethods.addAll(restrictedPaymentMethods); + } + return this; + } + + @java.lang.Override + public _FinalStage addRestrictedPaymentMethods( + AccountPaymentControlsRestrictedPaymentMethodsItem restrictedPaymentMethods) { + this.restrictedPaymentMethods.add(restrictedPaymentMethods); + return this; + } + + @java.lang.Override + @JsonSetter(value = "restricted_payment_methods", nulls = Nulls.SKIP) + public _FinalStage restrictedPaymentMethods( + List restrictedPaymentMethods) { + this.restrictedPaymentMethods.clear(); + if (restrictedPaymentMethods != null) { + this.restrictedPaymentMethods.addAll(restrictedPaymentMethods); + } + return this; + } + + /** + *

Fee charged for each dispute alert in USD. null when unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputeAlertFeeUsd(Nullable disputeAlertFeeUsd) { + if (disputeAlertFeeUsd.isNull()) { + this.disputeAlertFeeUsd = null; + } else if (disputeAlertFeeUsd.isEmpty()) { + this.disputeAlertFeeUsd = Optional.empty(); + } else { + this.disputeAlertFeeUsd = Optional.of(disputeAlertFeeUsd.get()); + } + return this; + } + + /** + *

Fee charged for each dispute alert in USD. null when unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputeAlertFeeUsd(Double disputeAlertFeeUsd) { + this.disputeAlertFeeUsd = Optional.ofNullable(disputeAlertFeeUsd); + return this; + } + + /** + *

Fee charged for each dispute alert in USD. null when unavailable.

+ */ + @java.lang.Override + @JsonSetter(value = "dispute_alert_fee_usd", nulls = Nulls.SKIP) + public _FinalStage disputeAlertFeeUsd(Optional disputeAlertFeeUsd) { + this.disputeAlertFeeUsd = disputeAlertFeeUsd; + return this; + } + + @java.lang.Override + public AccountPaymentControls build() { + return new AccountPaymentControls( + disputeAlertAutoRefund, + disputeAlertFeeUsd, + enforce3Ds, + financingDisabled, + highRiskProcessingFeePercentage, + pendingAutoTopupFeePercentage, + pendingBalanceDelayDays, + reserve, + resolutionCenterAutoRefund, + restrictedPaymentMethods, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountPaymentControlsRestrictedPaymentMethodsItem.java b/src/main/java/com/whop/api/types/AccountPaymentControlsRestrictedPaymentMethodsItem.java new file mode 100644 index 00000000..7576ed71 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountPaymentControlsRestrictedPaymentMethodsItem.java @@ -0,0 +1,110 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountPaymentControlsRestrictedPaymentMethodsItem { + public static final AccountPaymentControlsRestrictedPaymentMethodsItem CARD_VISA = + new AccountPaymentControlsRestrictedPaymentMethodsItem(Value.CARD_VISA, "card_visa"); + + public static final AccountPaymentControlsRestrictedPaymentMethodsItem CARD_AMERICAN_EXPRESS = + new AccountPaymentControlsRestrictedPaymentMethodsItem( + Value.CARD_AMERICAN_EXPRESS, "card_american_express"); + + public static final AccountPaymentControlsRestrictedPaymentMethodsItem CARD_MASTERCARD = + new AccountPaymentControlsRestrictedPaymentMethodsItem(Value.CARD_MASTERCARD, "card_mastercard"); + + public static final AccountPaymentControlsRestrictedPaymentMethodsItem CARD_DISCOVER_GLOBAL_NETWORK = + new AccountPaymentControlsRestrictedPaymentMethodsItem( + Value.CARD_DISCOVER_GLOBAL_NETWORK, "card_discover_global_network"); + + private final Value value; + + private final String string; + + AccountPaymentControlsRestrictedPaymentMethodsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountPaymentControlsRestrictedPaymentMethodsItem + && this.string.equals(((AccountPaymentControlsRestrictedPaymentMethodsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_VISA: + return visitor.visitCardVisa(); + case CARD_AMERICAN_EXPRESS: + return visitor.visitCardAmericanExpress(); + case CARD_MASTERCARD: + return visitor.visitCardMastercard(); + case CARD_DISCOVER_GLOBAL_NETWORK: + return visitor.visitCardDiscoverGlobalNetwork(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountPaymentControlsRestrictedPaymentMethodsItem valueOf(String value) { + switch (value) { + case "card_visa": + return CARD_VISA; + case "card_american_express": + return CARD_AMERICAN_EXPRESS; + case "card_mastercard": + return CARD_MASTERCARD; + case "card_discover_global_network": + return CARD_DISCOVER_GLOBAL_NETWORK; + default: + return new AccountPaymentControlsRestrictedPaymentMethodsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_VISA, + + CARD_MASTERCARD, + + CARD_AMERICAN_EXPRESS, + + CARD_DISCOVER_GLOBAL_NETWORK, + + UNKNOWN + } + + public interface Visitor { + T visitCardVisa(); + + T visitCardMastercard(); + + T visitCardAmericanExpress(); + + T visitCardDiscoverGlobalNetwork(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountPreferences.java b/src/main/java/com/whop/api/types/AccountPreferences.java new file mode 100644 index 00000000..09c96773 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountPreferences.java @@ -0,0 +1,454 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountPreferences.Builder.class) +public final class AccountPreferences { + private final Map adsAgreement; + + private final Optional> adsPaymentMethods; + + private final String adsReportingCurrency; + + private final String adsSchedulingTimezone; + + private final Map adsTripleWhaleIntegration; + + private final boolean cardsAutoTopUp; + + private final boolean disputeFighterEnabled; + + private final Map additionalProperties; + + private AccountPreferences( + Map adsAgreement, + Optional> adsPaymentMethods, + String adsReportingCurrency, + String adsSchedulingTimezone, + Map adsTripleWhaleIntegration, + boolean cardsAutoTopUp, + boolean disputeFighterEnabled, + Map additionalProperties) { + this.adsAgreement = adsAgreement; + this.adsPaymentMethods = adsPaymentMethods; + this.adsReportingCurrency = adsReportingCurrency; + this.adsSchedulingTimezone = adsSchedulingTimezone; + this.adsTripleWhaleIntegration = adsTripleWhaleIntegration; + this.cardsAutoTopUp = cardsAutoTopUp; + this.disputeFighterEnabled = disputeFighterEnabled; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account's Whop Ads services and payment authorization agreement. status is not_required, pending_signature (a signature has been requested and campaign launch is blocked until it is provided), or signed. While pending, read the fields to answer from GET /verifications/{id} and sign by submitting them via PATCH /verifications/{id}. + */ + @JsonProperty("ads_agreement") + public Map getAdsAgreement() { + return adsAgreement; + } + + /** + * @return How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when it fails. Each entry has a type of platform_balance (id ldgr_) or card (id payt_), plus display fields so the configured source renders even for a viewer who doesn't own it. backup is null when only one method is configured. null until ads billing has been configured. + */ + @JsonIgnore + public Optional> getAdsPaymentMethods() { + if (adsPaymentMethods == null) { + return Optional.empty(); + } + return adsPaymentMethods; + } + + /** + * @return Lowercase ISO currency code, such as usd or eur, used to display ad spend and stats. Defaults to usd. + */ + @JsonProperty("ads_reporting_currency") + public String getAdsReportingCurrency() { + return adsReportingCurrency; + } + + /** + * @return IANA timezone (e.g. America/New_York) used to interpret campaign start/end times and to bucket reports. Defaults to America/New_York until explicitly overridden. + */ + @JsonProperty("ads_scheduling_timezone") + public String getAdsSchedulingTimezone() { + return adsSchedulingTimezone; + } + + /** + * @return The account's Triple Whale integration, which pushes Whop ad spend to Triple Whale's Data-In API so it reports as a whop channel. status is connected, not_connected, or requires_shopify_store (Triple Whale keys records by Shopify shop, so spend only flows while a store is connected). masked_api_key shows the leading characters of the stored key; the full key is never returned. shop_domain is the Shopify store spend is reported for. + */ + @JsonProperty("ads_triple_whale_integration") + public Map getAdsTripleWhaleIntegration() { + return adsTripleWhaleIntegration; + } + + /** + * @return Whether incoming funds are automatically moved to the account's cards balance. false when the account has no cards balance. + */ + @JsonProperty("cards_auto_top_up") + public boolean getCardsAutoTopUp() { + return cardsAutoTopUp; + } + + /** + * @return Whether Whop assembles and files the evidence response when this account's payments are disputed. Off by default; enabling it also opts the account into the success fee charged only on disputes it wins. + */ + @JsonProperty("dispute_fighter_enabled") + public boolean getDisputeFighterEnabled() { + return disputeFighterEnabled; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ads_payment_methods") + private Optional> _getAdsPaymentMethods() { + return adsPaymentMethods; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountPreferences && equalTo((AccountPreferences) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountPreferences other) { + return adsAgreement.equals(other.adsAgreement) + && adsPaymentMethods.equals(other.adsPaymentMethods) + && adsReportingCurrency.equals(other.adsReportingCurrency) + && adsSchedulingTimezone.equals(other.adsSchedulingTimezone) + && adsTripleWhaleIntegration.equals(other.adsTripleWhaleIntegration) + && cardsAutoTopUp == other.cardsAutoTopUp + && disputeFighterEnabled == other.disputeFighterEnabled; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adsAgreement, + this.adsPaymentMethods, + this.adsReportingCurrency, + this.adsSchedulingTimezone, + this.adsTripleWhaleIntegration, + this.cardsAutoTopUp, + this.disputeFighterEnabled); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdsReportingCurrencyStage builder() { + return new Builder(); + } + + public interface AdsReportingCurrencyStage { + /** + *

Lowercase ISO currency code, such as usd or eur, used to display ad spend and stats. Defaults to usd.

+ */ + AdsSchedulingTimezoneStage adsReportingCurrency(@NotNull String adsReportingCurrency); + + Builder from(AccountPreferences other); + } + + public interface AdsSchedulingTimezoneStage { + /** + *

IANA timezone (e.g. America/New_York) used to interpret campaign start/end times and to bucket reports. Defaults to America/New_York until explicitly overridden.

+ */ + CardsAutoTopUpStage adsSchedulingTimezone(@NotNull String adsSchedulingTimezone); + } + + public interface CardsAutoTopUpStage { + /** + *

Whether incoming funds are automatically moved to the account's cards balance. false when the account has no cards balance.

+ */ + DisputeFighterEnabledStage cardsAutoTopUp(boolean cardsAutoTopUp); + } + + public interface DisputeFighterEnabledStage { + /** + *

Whether Whop assembles and files the evidence response when this account's payments are disputed. Off by default; enabling it also opts the account into the success fee charged only on disputes it wins.

+ */ + _FinalStage disputeFighterEnabled(boolean disputeFighterEnabled); + } + + public interface _FinalStage { + AccountPreferences build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account's Whop Ads services and payment authorization agreement. status is not_required, pending_signature (a signature has been requested and campaign launch is blocked until it is provided), or signed. While pending, read the fields to answer from GET /verifications/{id} and sign by submitting them via PATCH /verifications/{id}.

+ */ + _FinalStage adsAgreement(Map adsAgreement); + + _FinalStage putAllAdsAgreement(Map adsAgreement); + + _FinalStage adsAgreement(String key, Object value); + + /** + *

How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when it fails. Each entry has a type of platform_balance (id ldgr_) or card (id payt_), plus display fields so the configured source renders even for a viewer who doesn't own it. backup is null when only one method is configured. null until ads billing has been configured.

+ */ + _FinalStage adsPaymentMethods(Optional> adsPaymentMethods); + + _FinalStage adsPaymentMethods(Map adsPaymentMethods); + + _FinalStage adsPaymentMethods(Nullable> adsPaymentMethods); + + /** + *

The account's Triple Whale integration, which pushes Whop ad spend to Triple Whale's Data-In API so it reports as a whop channel. status is connected, not_connected, or requires_shopify_store (Triple Whale keys records by Shopify shop, so spend only flows while a store is connected). masked_api_key shows the leading characters of the stored key; the full key is never returned. shop_domain is the Shopify store spend is reported for.

+ */ + _FinalStage adsTripleWhaleIntegration(Map adsTripleWhaleIntegration); + + _FinalStage putAllAdsTripleWhaleIntegration(Map adsTripleWhaleIntegration); + + _FinalStage adsTripleWhaleIntegration(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AdsReportingCurrencyStage, + AdsSchedulingTimezoneStage, + CardsAutoTopUpStage, + DisputeFighterEnabledStage, + _FinalStage { + private String adsReportingCurrency; + + private String adsSchedulingTimezone; + + private boolean cardsAutoTopUp; + + private boolean disputeFighterEnabled; + + private Map adsTripleWhaleIntegration = new LinkedHashMap<>(); + + private Optional> adsPaymentMethods = Optional.empty(); + + private Map adsAgreement = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountPreferences other) { + adsAgreement(other.getAdsAgreement()); + adsPaymentMethods(other.getAdsPaymentMethods()); + adsReportingCurrency(other.getAdsReportingCurrency()); + adsSchedulingTimezone(other.getAdsSchedulingTimezone()); + adsTripleWhaleIntegration(other.getAdsTripleWhaleIntegration()); + cardsAutoTopUp(other.getCardsAutoTopUp()); + disputeFighterEnabled(other.getDisputeFighterEnabled()); + return this; + } + + /** + *

Lowercase ISO currency code, such as usd or eur, used to display ad spend and stats. Defaults to usd.

+ *

Lowercase ISO currency code, such as usd or eur, used to display ad spend and stats. Defaults to usd.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ads_reporting_currency") + public AdsSchedulingTimezoneStage adsReportingCurrency(@NotNull String adsReportingCurrency) { + this.adsReportingCurrency = + Objects.requireNonNull(adsReportingCurrency, "adsReportingCurrency must not be null"); + return this; + } + + /** + *

IANA timezone (e.g. America/New_York) used to interpret campaign start/end times and to bucket reports. Defaults to America/New_York until explicitly overridden.

+ *

IANA timezone (e.g. America/New_York) used to interpret campaign start/end times and to bucket reports. Defaults to America/New_York until explicitly overridden.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ads_scheduling_timezone") + public CardsAutoTopUpStage adsSchedulingTimezone(@NotNull String adsSchedulingTimezone) { + this.adsSchedulingTimezone = + Objects.requireNonNull(adsSchedulingTimezone, "adsSchedulingTimezone must not be null"); + return this; + } + + /** + *

Whether incoming funds are automatically moved to the account's cards balance. false when the account has no cards balance.

+ *

Whether incoming funds are automatically moved to the account's cards balance. false when the account has no cards balance.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cards_auto_top_up") + public DisputeFighterEnabledStage cardsAutoTopUp(boolean cardsAutoTopUp) { + this.cardsAutoTopUp = cardsAutoTopUp; + return this; + } + + /** + *

Whether Whop assembles and files the evidence response when this account's payments are disputed. Off by default; enabling it also opts the account into the success fee charged only on disputes it wins.

+ *

Whether Whop assembles and files the evidence response when this account's payments are disputed. Off by default; enabling it also opts the account into the success fee charged only on disputes it wins.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dispute_fighter_enabled") + public _FinalStage disputeFighterEnabled(boolean disputeFighterEnabled) { + this.disputeFighterEnabled = disputeFighterEnabled; + return this; + } + + /** + *

The account's Triple Whale integration, which pushes Whop ad spend to Triple Whale's Data-In API so it reports as a whop channel. status is connected, not_connected, or requires_shopify_store (Triple Whale keys records by Shopify shop, so spend only flows while a store is connected). masked_api_key shows the leading characters of the stored key; the full key is never returned. shop_domain is the Shopify store spend is reported for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adsTripleWhaleIntegration(String key, Object value) { + this.adsTripleWhaleIntegration.put(key, value); + return this; + } + + /** + *

The account's Triple Whale integration, which pushes Whop ad spend to Triple Whale's Data-In API so it reports as a whop channel. status is connected, not_connected, or requires_shopify_store (Triple Whale keys records by Shopify shop, so spend only flows while a store is connected). masked_api_key shows the leading characters of the stored key; the full key is never returned. shop_domain is the Shopify store spend is reported for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllAdsTripleWhaleIntegration(Map adsTripleWhaleIntegration) { + if (adsTripleWhaleIntegration != null) { + this.adsTripleWhaleIntegration.putAll(adsTripleWhaleIntegration); + } + return this; + } + + /** + *

The account's Triple Whale integration, which pushes Whop ad spend to Triple Whale's Data-In API so it reports as a whop channel. status is connected, not_connected, or requires_shopify_store (Triple Whale keys records by Shopify shop, so spend only flows while a store is connected). masked_api_key shows the leading characters of the stored key; the full key is never returned. shop_domain is the Shopify store spend is reported for.

+ */ + @java.lang.Override + @JsonSetter(value = "ads_triple_whale_integration", nulls = Nulls.SKIP) + public _FinalStage adsTripleWhaleIntegration(Map adsTripleWhaleIntegration) { + this.adsTripleWhaleIntegration.clear(); + if (adsTripleWhaleIntegration != null) { + this.adsTripleWhaleIntegration.putAll(adsTripleWhaleIntegration); + } + return this; + } + + /** + *

How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when it fails. Each entry has a type of platform_balance (id ldgr_) or card (id payt_), plus display fields so the configured source renders even for a viewer who doesn't own it. backup is null when only one method is configured. null until ads billing has been configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adsPaymentMethods(Nullable> adsPaymentMethods) { + if (adsPaymentMethods.isNull()) { + this.adsPaymentMethods = null; + } else if (adsPaymentMethods.isEmpty()) { + this.adsPaymentMethods = Optional.empty(); + } else { + this.adsPaymentMethods = Optional.of(adsPaymentMethods.get()); + } + return this; + } + + /** + *

How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when it fails. Each entry has a type of platform_balance (id ldgr_) or card (id payt_), plus display fields so the configured source renders even for a viewer who doesn't own it. backup is null when only one method is configured. null until ads billing has been configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adsPaymentMethods(Map adsPaymentMethods) { + this.adsPaymentMethods = Optional.ofNullable(adsPaymentMethods); + return this; + } + + /** + *

How the account pays for Whop Ads spend. primary is charged first; backup covers the charge when it fails. Each entry has a type of platform_balance (id ldgr_) or card (id payt_), plus display fields so the configured source renders even for a viewer who doesn't own it. backup is null when only one method is configured. null until ads billing has been configured.

+ */ + @java.lang.Override + @JsonSetter(value = "ads_payment_methods", nulls = Nulls.SKIP) + public _FinalStage adsPaymentMethods(Optional> adsPaymentMethods) { + this.adsPaymentMethods = adsPaymentMethods; + return this; + } + + /** + *

The account's Whop Ads services and payment authorization agreement. status is not_required, pending_signature (a signature has been requested and campaign launch is blocked until it is provided), or signed. While pending, read the fields to answer from GET /verifications/{id} and sign by submitting them via PATCH /verifications/{id}.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage adsAgreement(String key, Object value) { + this.adsAgreement.put(key, value); + return this; + } + + /** + *

The account's Whop Ads services and payment authorization agreement. status is not_required, pending_signature (a signature has been requested and campaign launch is blocked until it is provided), or signed. While pending, read the fields to answer from GET /verifications/{id} and sign by submitting them via PATCH /verifications/{id}.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllAdsAgreement(Map adsAgreement) { + if (adsAgreement != null) { + this.adsAgreement.putAll(adsAgreement); + } + return this; + } + + /** + *

The account's Whop Ads services and payment authorization agreement. status is not_required, pending_signature (a signature has been requested and campaign launch is blocked until it is provided), or signed. While pending, read the fields to answer from GET /verifications/{id} and sign by submitting them via PATCH /verifications/{id}.

+ */ + @java.lang.Override + @JsonSetter(value = "ads_agreement", nulls = Nulls.SKIP) + public _FinalStage adsAgreement(Map adsAgreement) { + this.adsAgreement.clear(); + if (adsAgreement != null) { + this.adsAgreement.putAll(adsAgreement); + } + return this; + } + + @java.lang.Override + public AccountPreferences build() { + return new AccountPreferences( + adsAgreement, + adsPaymentMethods, + adsReportingCurrency, + adsSchedulingTimezone, + adsTripleWhaleIntegration, + cardsAutoTopUp, + disputeFighterEnabled, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountRecommendedAction.java b/src/main/java/com/whop/api/types/AccountRecommendedAction.java new file mode 100644 index 00000000..31c5d207 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountRecommendedAction.java @@ -0,0 +1,588 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountRecommendedAction.Builder.class) +public final class AccountRecommendedAction { + private final AccountRecommendedActionAction action; + + private final List blockedCapabilities; + + private final String cta; + + private final String ctaLabel; + + private final String description; + + private final Optional iconUrl; + + private final Optional impactScore; + + private final Optional reasoning; + + private final AccountRecommendedActionStatus status; + + private final String title; + + private final Map additionalProperties; + + private AccountRecommendedAction( + AccountRecommendedActionAction action, + List blockedCapabilities, + String cta, + String ctaLabel, + String description, + Optional iconUrl, + Optional impactScore, + Optional reasoning, + AccountRecommendedActionStatus status, + String title, + Map additionalProperties) { + this.action = action; + this.blockedCapabilities = blockedCapabilities; + this.cta = cta; + this.ctaLabel = ctaLabel; + this.description = description; + this.iconUrl = iconUrl; + this.impactScore = impactScore; + this.reasoning = reasoning; + this.status = status; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The recommendation; new values may be added, so handle unknown actions gracefully + */ + @JsonProperty("action") + public AccountRecommendedActionAction getAction() { + return action; + } + + @JsonProperty("blocked_capabilities") + public List getBlockedCapabilities() { + return blockedCapabilities; + } + + /** + * @return The URL the call-to-action links to + */ + @JsonProperty("cta") + public String getCta() { + return cta; + } + + /** + * @return Button label + */ + @JsonProperty("cta_label") + public String getCtaLabel() { + return ctaLabel; + } + + /** + * @return Supporting copy, or empty + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * @return Illustration icon URL, or null + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return Estimated impact from 0-100, or null when not ranked + */ + @JsonIgnore + public Optional getImpactScore() { + if (impactScore == null) { + return Optional.empty(); + } + return impactScore; + } + + /** + * @return Why this action was recommended, or null + */ + @JsonIgnore + public Optional getReasoning() { + if (reasoning == null) { + return Optional.empty(); + } + return reasoning; + } + + /** + * @return Always optional — never blocking + */ + @JsonProperty("status") + public AccountRecommendedActionStatus getStatus() { + return status; + } + + /** + * @return Headline for the recommendation + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("impact_score") + private Optional _getImpactScore() { + return impactScore; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reasoning") + private Optional _getReasoning() { + return reasoning; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountRecommendedAction && equalTo((AccountRecommendedAction) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountRecommendedAction other) { + return action.equals(other.action) + && blockedCapabilities.equals(other.blockedCapabilities) + && cta.equals(other.cta) + && ctaLabel.equals(other.ctaLabel) + && description.equals(other.description) + && iconUrl.equals(other.iconUrl) + && impactScore.equals(other.impactScore) + && reasoning.equals(other.reasoning) + && status.equals(other.status) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.action, + this.blockedCapabilities, + this.cta, + this.ctaLabel, + this.description, + this.iconUrl, + this.impactScore, + this.reasoning, + this.status, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + /** + *

The recommendation; new values may be added, so handle unknown actions gracefully

+ */ + CtaStage action(@NotNull AccountRecommendedActionAction action); + + Builder from(AccountRecommendedAction other); + } + + public interface CtaStage { + /** + *

The URL the call-to-action links to

+ */ + CtaLabelStage cta(@NotNull String cta); + } + + public interface CtaLabelStage { + /** + *

Button label

+ */ + DescriptionStage ctaLabel(@NotNull String ctaLabel); + } + + public interface DescriptionStage { + /** + *

Supporting copy, or empty

+ */ + StatusStage description(@NotNull String description); + } + + public interface StatusStage { + /** + *

Always optional — never blocking

+ */ + TitleStage status(@NotNull AccountRecommendedActionStatus status); + } + + public interface TitleStage { + /** + *

Headline for the recommendation

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + AccountRecommendedAction build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage blockedCapabilities(List blockedCapabilities); + + _FinalStage addBlockedCapabilities(String blockedCapabilities); + + _FinalStage addAllBlockedCapabilities(List blockedCapabilities); + + /** + *

Illustration icon URL, or null

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Estimated impact from 0-100, or null when not ranked

+ */ + _FinalStage impactScore(Optional impactScore); + + _FinalStage impactScore(Integer impactScore); + + _FinalStage impactScore(Nullable impactScore); + + /** + *

Why this action was recommended, or null

+ */ + _FinalStage reasoning(Optional reasoning); + + _FinalStage reasoning(String reasoning); + + _FinalStage reasoning(Nullable reasoning); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ActionStage, CtaStage, CtaLabelStage, DescriptionStage, StatusStage, TitleStage, _FinalStage { + private AccountRecommendedActionAction action; + + private String cta; + + private String ctaLabel; + + private String description; + + private AccountRecommendedActionStatus status; + + private String title; + + private Optional reasoning = Optional.empty(); + + private Optional impactScore = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + private List blockedCapabilities = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountRecommendedAction other) { + action(other.getAction()); + blockedCapabilities(other.getBlockedCapabilities()); + cta(other.getCta()); + ctaLabel(other.getCtaLabel()); + description(other.getDescription()); + iconUrl(other.getIconUrl()); + impactScore(other.getImpactScore()); + reasoning(other.getReasoning()); + status(other.getStatus()); + title(other.getTitle()); + return this; + } + + /** + *

The recommendation; new values may be added, so handle unknown actions gracefully

+ *

The recommendation; new values may be added, so handle unknown actions gracefully

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("action") + public CtaStage action(@NotNull AccountRecommendedActionAction action) { + this.action = Objects.requireNonNull(action, "action must not be null"); + return this; + } + + /** + *

The URL the call-to-action links to

+ *

The URL the call-to-action links to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cta") + public CtaLabelStage cta(@NotNull String cta) { + this.cta = Objects.requireNonNull(cta, "cta must not be null"); + return this; + } + + /** + *

Button label

+ *

Button label

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cta_label") + public DescriptionStage ctaLabel(@NotNull String ctaLabel) { + this.ctaLabel = Objects.requireNonNull(ctaLabel, "ctaLabel must not be null"); + return this; + } + + /** + *

Supporting copy, or empty

+ *

Supporting copy, or empty

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("description") + public StatusStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + /** + *

Always optional — never blocking

+ *

Always optional — never blocking

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TitleStage status(@NotNull AccountRecommendedActionStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Headline for the recommendation

+ *

Headline for the recommendation

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Why this action was recommended, or null

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reasoning(Nullable reasoning) { + if (reasoning.isNull()) { + this.reasoning = null; + } else if (reasoning.isEmpty()) { + this.reasoning = Optional.empty(); + } else { + this.reasoning = Optional.of(reasoning.get()); + } + return this; + } + + /** + *

Why this action was recommended, or null

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reasoning(String reasoning) { + this.reasoning = Optional.ofNullable(reasoning); + return this; + } + + /** + *

Why this action was recommended, or null

+ */ + @java.lang.Override + @JsonSetter(value = "reasoning", nulls = Nulls.SKIP) + public _FinalStage reasoning(Optional reasoning) { + this.reasoning = reasoning; + return this; + } + + /** + *

Estimated impact from 0-100, or null when not ranked

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage impactScore(Nullable impactScore) { + if (impactScore.isNull()) { + this.impactScore = null; + } else if (impactScore.isEmpty()) { + this.impactScore = Optional.empty(); + } else { + this.impactScore = Optional.of(impactScore.get()); + } + return this; + } + + /** + *

Estimated impact from 0-100, or null when not ranked

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage impactScore(Integer impactScore) { + this.impactScore = Optional.ofNullable(impactScore); + return this; + } + + /** + *

Estimated impact from 0-100, or null when not ranked

+ */ + @java.lang.Override + @JsonSetter(value = "impact_score", nulls = Nulls.SKIP) + public _FinalStage impactScore(Optional impactScore) { + this.impactScore = impactScore; + return this; + } + + /** + *

Illustration icon URL, or null

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Illustration icon URL, or null

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Illustration icon URL, or null

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + @java.lang.Override + public _FinalStage addAllBlockedCapabilities(List blockedCapabilities) { + if (blockedCapabilities != null) { + this.blockedCapabilities.addAll(blockedCapabilities); + } + return this; + } + + @java.lang.Override + public _FinalStage addBlockedCapabilities(String blockedCapabilities) { + this.blockedCapabilities.add(blockedCapabilities); + return this; + } + + @java.lang.Override + @JsonSetter(value = "blocked_capabilities", nulls = Nulls.SKIP) + public _FinalStage blockedCapabilities(List blockedCapabilities) { + this.blockedCapabilities.clear(); + if (blockedCapabilities != null) { + this.blockedCapabilities.addAll(blockedCapabilities); + } + return this; + } + + @java.lang.Override + public AccountRecommendedAction build() { + return new AccountRecommendedAction( + action, + blockedCapabilities, + cta, + ctaLabel, + description, + iconUrl, + impactScore, + reasoning, + status, + title, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountRecommendedActionAction.java b/src/main/java/com/whop/api/types/AccountRecommendedActionAction.java new file mode 100644 index 00000000..0e8b866f --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountRecommendedActionAction.java @@ -0,0 +1,284 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountRecommendedActionAction { + public static final AccountRecommendedActionAction FIX_AD_BILLING = + new AccountRecommendedActionAction(Value.FIX_AD_BILLING, "fix_ad_billing"); + + public static final AccountRecommendedActionAction LAUNCH_DRAFT_CAMPAIGN = + new AccountRecommendedActionAction(Value.LAUNCH_DRAFT_CAMPAIGN, "launch_draft_campaign"); + + public static final AccountRecommendedActionAction CREATE_CARD = + new AccountRecommendedActionAction(Value.CREATE_CARD, "create_card"); + + public static final AccountRecommendedActionAction EXCLUDE_CUSTOMERS_FROM_ADS = + new AccountRecommendedActionAction(Value.EXCLUDE_CUSTOMERS_FROM_ADS, "exclude_customers_from_ads"); + + public static final AccountRecommendedActionAction INVITE_TEAM_MEMBER = + new AccountRecommendedActionAction(Value.INVITE_TEAM_MEMBER, "invite_team_member"); + + public static final AccountRecommendedActionAction APPLY_FOR_FINANCING = + new AccountRecommendedActionAction(Value.APPLY_FOR_FINANCING, "apply_for_financing"); + + public static final AccountRecommendedActionAction CREATE_PRODUCT = + new AccountRecommendedActionAction(Value.CREATE_PRODUCT, "create_product"); + + public static final AccountRecommendedActionAction FIX_FUNNEL_DROPOFF = + new AccountRecommendedActionAction(Value.FIX_FUNNEL_DROPOFF, "fix_funnel_dropoff"); + + public static final AccountRecommendedActionAction LAUNCH_FIRST_AD = + new AccountRecommendedActionAction(Value.LAUNCH_FIRST_AD, "launch_first_ad"); + + public static final AccountRecommendedActionAction RETARGET_ABANDONED_CHECKOUTS = + new AccountRecommendedActionAction(Value.RETARGET_ABANDONED_CHECKOUTS, "retarget_abandoned_checkouts"); + + public static final AccountRecommendedActionAction CONNECT_AFFILIATE_PROGRAM = + new AccountRecommendedActionAction(Value.CONNECT_AFFILIATE_PROGRAM, "connect_affiliate_program"); + + public static final AccountRecommendedActionAction INCREASE_AD_BUDGET = + new AccountRecommendedActionAction(Value.INCREASE_AD_BUDGET, "increase_ad_budget"); + + public static final AccountRecommendedActionAction VERIFY_IDENTITY = + new AccountRecommendedActionAction(Value.VERIFY_IDENTITY, "verify_identity"); + + public static final AccountRecommendedActionAction MIGRATE_FROM_STRIPE = + new AccountRecommendedActionAction(Value.MIGRATE_FROM_STRIPE, "migrate_from_stripe"); + + public static final AccountRecommendedActionAction REFRESH_AD_CREATIVES = + new AccountRecommendedActionAction(Value.REFRESH_AD_CREATIVES, "refresh_ad_creatives"); + + public static final AccountRecommendedActionAction CREATE_PLAN = + new AccountRecommendedActionAction(Value.CREATE_PLAN, "create_plan"); + + public static final AccountRecommendedActionAction ENABLE_TAX_COLLECTION = + new AccountRecommendedActionAction(Value.ENABLE_TAX_COLLECTION, "enable_tax_collection"); + + public static final AccountRecommendedActionAction THEME_BUSINESS = + new AccountRecommendedActionAction(Value.THEME_BUSINESS, "theme_business"); + + public static final AccountRecommendedActionAction ACCEPT_FIRST_PAYMENT = + new AccountRecommendedActionAction(Value.ACCEPT_FIRST_PAYMENT, "accept_first_payment"); + + public static final AccountRecommendedActionAction CREATE_PROMOTION = + new AccountRecommendedActionAction(Value.CREATE_PROMOTION, "create_promotion"); + + private final Value value; + + private final String string; + + AccountRecommendedActionAction(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountRecommendedActionAction + && this.string.equals(((AccountRecommendedActionAction) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FIX_AD_BILLING: + return visitor.visitFixAdBilling(); + case LAUNCH_DRAFT_CAMPAIGN: + return visitor.visitLaunchDraftCampaign(); + case CREATE_CARD: + return visitor.visitCreateCard(); + case EXCLUDE_CUSTOMERS_FROM_ADS: + return visitor.visitExcludeCustomersFromAds(); + case INVITE_TEAM_MEMBER: + return visitor.visitInviteTeamMember(); + case APPLY_FOR_FINANCING: + return visitor.visitApplyForFinancing(); + case CREATE_PRODUCT: + return visitor.visitCreateProduct(); + case FIX_FUNNEL_DROPOFF: + return visitor.visitFixFunnelDropoff(); + case LAUNCH_FIRST_AD: + return visitor.visitLaunchFirstAd(); + case RETARGET_ABANDONED_CHECKOUTS: + return visitor.visitRetargetAbandonedCheckouts(); + case CONNECT_AFFILIATE_PROGRAM: + return visitor.visitConnectAffiliateProgram(); + case INCREASE_AD_BUDGET: + return visitor.visitIncreaseAdBudget(); + case VERIFY_IDENTITY: + return visitor.visitVerifyIdentity(); + case MIGRATE_FROM_STRIPE: + return visitor.visitMigrateFromStripe(); + case REFRESH_AD_CREATIVES: + return visitor.visitRefreshAdCreatives(); + case CREATE_PLAN: + return visitor.visitCreatePlan(); + case ENABLE_TAX_COLLECTION: + return visitor.visitEnableTaxCollection(); + case THEME_BUSINESS: + return visitor.visitThemeBusiness(); + case ACCEPT_FIRST_PAYMENT: + return visitor.visitAcceptFirstPayment(); + case CREATE_PROMOTION: + return visitor.visitCreatePromotion(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountRecommendedActionAction valueOf(String value) { + switch (value) { + case "fix_ad_billing": + return FIX_AD_BILLING; + case "launch_draft_campaign": + return LAUNCH_DRAFT_CAMPAIGN; + case "create_card": + return CREATE_CARD; + case "exclude_customers_from_ads": + return EXCLUDE_CUSTOMERS_FROM_ADS; + case "invite_team_member": + return INVITE_TEAM_MEMBER; + case "apply_for_financing": + return APPLY_FOR_FINANCING; + case "create_product": + return CREATE_PRODUCT; + case "fix_funnel_dropoff": + return FIX_FUNNEL_DROPOFF; + case "launch_first_ad": + return LAUNCH_FIRST_AD; + case "retarget_abandoned_checkouts": + return RETARGET_ABANDONED_CHECKOUTS; + case "connect_affiliate_program": + return CONNECT_AFFILIATE_PROGRAM; + case "increase_ad_budget": + return INCREASE_AD_BUDGET; + case "verify_identity": + return VERIFY_IDENTITY; + case "migrate_from_stripe": + return MIGRATE_FROM_STRIPE; + case "refresh_ad_creatives": + return REFRESH_AD_CREATIVES; + case "create_plan": + return CREATE_PLAN; + case "enable_tax_collection": + return ENABLE_TAX_COLLECTION; + case "theme_business": + return THEME_BUSINESS; + case "accept_first_payment": + return ACCEPT_FIRST_PAYMENT; + case "create_promotion": + return CREATE_PROMOTION; + default: + return new AccountRecommendedActionAction(Value.UNKNOWN, value); + } + } + + public enum Value { + THEME_BUSINESS, + + CREATE_PRODUCT, + + CREATE_PLAN, + + VERIFY_IDENTITY, + + CONNECT_AFFILIATE_PROGRAM, + + CREATE_PROMOTION, + + MIGRATE_FROM_STRIPE, + + ACCEPT_FIRST_PAYMENT, + + LAUNCH_FIRST_AD, + + LAUNCH_DRAFT_CAMPAIGN, + + INCREASE_AD_BUDGET, + + REFRESH_AD_CREATIVES, + + FIX_AD_BILLING, + + EXCLUDE_CUSTOMERS_FROM_ADS, + + RETARGET_ABANDONED_CHECKOUTS, + + FIX_FUNNEL_DROPOFF, + + INVITE_TEAM_MEMBER, + + ENABLE_TAX_COLLECTION, + + CREATE_CARD, + + APPLY_FOR_FINANCING, + + UNKNOWN + } + + public interface Visitor { + T visitThemeBusiness(); + + T visitCreateProduct(); + + T visitCreatePlan(); + + T visitVerifyIdentity(); + + T visitConnectAffiliateProgram(); + + T visitCreatePromotion(); + + T visitMigrateFromStripe(); + + T visitAcceptFirstPayment(); + + T visitLaunchFirstAd(); + + T visitLaunchDraftCampaign(); + + T visitIncreaseAdBudget(); + + T visitRefreshAdCreatives(); + + T visitFixAdBilling(); + + T visitExcludeCustomersFromAds(); + + T visitRetargetAbandonedCheckouts(); + + T visitFixFunnelDropoff(); + + T visitInviteTeamMember(); + + T visitEnableTaxCollection(); + + T visitCreateCard(); + + T visitApplyForFinancing(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountRecommendedActionChain.java b/src/main/java/com/whop/api/types/AccountRecommendedActionChain.java new file mode 100644 index 00000000..a59e4cbe --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountRecommendedActionChain.java @@ -0,0 +1,321 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountRecommendedActionChain.Builder.class) +public final class AccountRecommendedActionChain { + private final List actions; + + private final String description; + + private final String id; + + private final Optional> reasoning; + + private final String title; + + private final Map additionalProperties; + + private AccountRecommendedActionChain( + List actions, + String description, + String id, + Optional> reasoning, + String title, + Map additionalProperties) { + this.actions = actions; + this.description = description; + this.id = id; + this.reasoning = reasoning; + this.title = title; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("actions") + public List getActions() { + return actions; + } + + /** + * @return What running the chain accomplishes + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * @return Chain ID — rac_seed_<chain>_<nonce> for seeded chains, rac_chain_* for generated ones + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Why the generator proposed this chain, or null for seeded chains + */ + @JsonIgnore + public Optional> getReasoning() { + if (reasoning == null) { + return Optional.empty(); + } + return reasoning; + } + + /** + * @return Headline for the chain + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reasoning") + private Optional> _getReasoning() { + return reasoning; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountRecommendedActionChain && equalTo((AccountRecommendedActionChain) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountRecommendedActionChain other) { + return actions.equals(other.actions) + && description.equals(other.description) + && id.equals(other.id) + && reasoning.equals(other.reasoning) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.actions, this.description, this.id, this.reasoning, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DescriptionStage builder() { + return new Builder(); + } + + public interface DescriptionStage { + /** + *

What running the chain accomplishes

+ */ + IdStage description(@NotNull String description); + + Builder from(AccountRecommendedActionChain other); + } + + public interface IdStage { + /** + *

Chain ID — rac_seed_<chain>_<nonce> for seeded chains, rac_chain_* for generated ones

+ */ + TitleStage id(@NotNull String id); + } + + public interface TitleStage { + /** + *

Headline for the chain

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + AccountRecommendedActionChain build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage actions(List actions); + + _FinalStage addActions(AccountRecommendedActionChainStep actions); + + _FinalStage addAllActions(List actions); + + /** + *

Why the generator proposed this chain, or null for seeded chains

+ */ + _FinalStage reasoning(Optional> reasoning); + + _FinalStage reasoning(Map reasoning); + + _FinalStage reasoning(Nullable> reasoning); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DescriptionStage, IdStage, TitleStage, _FinalStage { + private String description; + + private String id; + + private String title; + + private Optional> reasoning = Optional.empty(); + + private List actions = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountRecommendedActionChain other) { + actions(other.getActions()); + description(other.getDescription()); + id(other.getId()); + reasoning(other.getReasoning()); + title(other.getTitle()); + return this; + } + + /** + *

What running the chain accomplishes

+ *

What running the chain accomplishes

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("description") + public IdStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + /** + *

Chain ID — rac_seed_<chain>_<nonce> for seeded chains, rac_chain_* for generated ones

+ *

Chain ID — rac_seed_<chain>_<nonce> for seeded chains, rac_chain_* for generated ones

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Headline for the chain

+ *

Headline for the chain

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Why the generator proposed this chain, or null for seeded chains

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reasoning(Nullable> reasoning) { + if (reasoning.isNull()) { + this.reasoning = null; + } else if (reasoning.isEmpty()) { + this.reasoning = Optional.empty(); + } else { + this.reasoning = Optional.of(reasoning.get()); + } + return this; + } + + /** + *

Why the generator proposed this chain, or null for seeded chains

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reasoning(Map reasoning) { + this.reasoning = Optional.ofNullable(reasoning); + return this; + } + + /** + *

Why the generator proposed this chain, or null for seeded chains

+ */ + @java.lang.Override + @JsonSetter(value = "reasoning", nulls = Nulls.SKIP) + public _FinalStage reasoning(Optional> reasoning) { + this.reasoning = reasoning; + return this; + } + + @java.lang.Override + public _FinalStage addAllActions(List actions) { + if (actions != null) { + this.actions.addAll(actions); + } + return this; + } + + @java.lang.Override + public _FinalStage addActions(AccountRecommendedActionChainStep actions) { + this.actions.add(actions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "actions", nulls = Nulls.SKIP) + public _FinalStage actions(List actions) { + this.actions.clear(); + if (actions != null) { + this.actions.addAll(actions); + } + return this; + } + + @java.lang.Override + public AccountRecommendedActionChain build() { + return new AccountRecommendedActionChain(actions, description, id, reasoning, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountRecommendedActionChainStep.java b/src/main/java/com/whop/api/types/AccountRecommendedActionChainStep.java new file mode 100644 index 00000000..978cf7bc --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountRecommendedActionChainStep.java @@ -0,0 +1,685 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountRecommendedActionChainStep.Builder.class) +public final class AccountRecommendedActionChainStep { + private final String action; + + private final String cta; + + private final String ctaLabel; + + private final String description; + + private final Optional error; + + private final Optional> input; + + private final Optional> output; + + private final int position; + + private final Optional> reasoning; + + private final Optional status; + + private final String title; + + private final Map additionalProperties; + + private AccountRecommendedActionChainStep( + String action, + String cta, + String ctaLabel, + String description, + Optional error, + Optional> input, + Optional> output, + int position, + Optional> reasoning, + Optional status, + String title, + Map additionalProperties) { + this.action = action; + this.cta = cta; + this.ctaLabel = ctaLabel; + this.description = description; + this.error = error; + this.input = input; + this.output = output; + this.position = position; + this.reasoning = reasoning; + this.status = status; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The action definition key this step runs; new values may be added, so handle unknown actions gracefully + */ + @JsonProperty("action") + public String getAction() { + return action; + } + + /** + * @return The URL where this step is done by hand + */ + @JsonProperty("cta") + public String getCta() { + return cta; + } + + /** + * @return Button label + */ + @JsonProperty("cta_label") + public String getCtaLabel() { + return ctaLabel; + } + + /** + * @return Supporting copy, or empty + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * @return Why the step failed, or null + */ + @JsonIgnore + public Optional getError() { + if (error == null) { + return Optional.empty(); + } + return error; + } + + /** + * @return The filled-in request body for the step's endpoint, or null when it was not recorded + */ + @JsonIgnore + public Optional> getInput() { + if (input == null) { + return Optional.empty(); + } + return input; + } + + /** + * @return The API response the step produced, or null until it succeeds + */ + @JsonIgnore + public Optional> getOutput() { + if (output == null) { + return Optional.empty(); + } + return output; + } + + /** + * @return Zero-based order of this step within the chain + */ + @JsonProperty("position") + public int getPosition() { + return position; + } + + /** + * @return Why the generator filled the step this way, or null for seeded chains + */ + @JsonIgnore + public Optional> getReasoning() { + if (reasoning == null) { + return Optional.empty(); + } + return reasoning; + } + + /** + * @return Where the run step currently stands, or null when the chain has not been run + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return Headline for the step + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("error") + private Optional _getError() { + return error; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("input") + private Optional> _getInput() { + return input; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("output") + private Optional> _getOutput() { + return output; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reasoning") + private Optional> _getReasoning() { + return reasoning; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountRecommendedActionChainStep && equalTo((AccountRecommendedActionChainStep) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountRecommendedActionChainStep other) { + return action.equals(other.action) + && cta.equals(other.cta) + && ctaLabel.equals(other.ctaLabel) + && description.equals(other.description) + && error.equals(other.error) + && input.equals(other.input) + && output.equals(other.output) + && position == other.position + && reasoning.equals(other.reasoning) + && status.equals(other.status) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.action, + this.cta, + this.ctaLabel, + this.description, + this.error, + this.input, + this.output, + this.position, + this.reasoning, + this.status, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + /** + *

The action definition key this step runs; new values may be added, so handle unknown actions gracefully

+ */ + CtaStage action(@NotNull String action); + + Builder from(AccountRecommendedActionChainStep other); + } + + public interface CtaStage { + /** + *

The URL where this step is done by hand

+ */ + CtaLabelStage cta(@NotNull String cta); + } + + public interface CtaLabelStage { + /** + *

Button label

+ */ + DescriptionStage ctaLabel(@NotNull String ctaLabel); + } + + public interface DescriptionStage { + /** + *

Supporting copy, or empty

+ */ + PositionStage description(@NotNull String description); + } + + public interface PositionStage { + /** + *

Zero-based order of this step within the chain

+ */ + TitleStage position(int position); + } + + public interface TitleStage { + /** + *

Headline for the step

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + AccountRecommendedActionChainStep build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Why the step failed, or null

+ */ + _FinalStage error(Optional error); + + _FinalStage error(String error); + + _FinalStage error(Nullable error); + + /** + *

The filled-in request body for the step's endpoint, or null when it was not recorded

+ */ + _FinalStage input(Optional> input); + + _FinalStage input(Map input); + + _FinalStage input(Nullable> input); + + /** + *

The API response the step produced, or null until it succeeds

+ */ + _FinalStage output(Optional> output); + + _FinalStage output(Map output); + + _FinalStage output(Nullable> output); + + /** + *

Why the generator filled the step this way, or null for seeded chains

+ */ + _FinalStage reasoning(Optional> reasoning); + + _FinalStage reasoning(Map reasoning); + + _FinalStage reasoning(Nullable> reasoning); + + /** + *

Where the run step currently stands, or null when the chain has not been run

+ */ + _FinalStage status(Optional status); + + _FinalStage status(AccountRecommendedActionChainStepStatus status); + + _FinalStage status(Nullable status); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ActionStage, CtaStage, CtaLabelStage, DescriptionStage, PositionStage, TitleStage, _FinalStage { + private String action; + + private String cta; + + private String ctaLabel; + + private String description; + + private int position; + + private String title; + + private Optional status = Optional.empty(); + + private Optional> reasoning = Optional.empty(); + + private Optional> output = Optional.empty(); + + private Optional> input = Optional.empty(); + + private Optional error = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountRecommendedActionChainStep other) { + action(other.getAction()); + cta(other.getCta()); + ctaLabel(other.getCtaLabel()); + description(other.getDescription()); + error(other.getError()); + input(other.getInput()); + output(other.getOutput()); + position(other.getPosition()); + reasoning(other.getReasoning()); + status(other.getStatus()); + title(other.getTitle()); + return this; + } + + /** + *

The action definition key this step runs; new values may be added, so handle unknown actions gracefully

+ *

The action definition key this step runs; new values may be added, so handle unknown actions gracefully

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("action") + public CtaStage action(@NotNull String action) { + this.action = Objects.requireNonNull(action, "action must not be null"); + return this; + } + + /** + *

The URL where this step is done by hand

+ *

The URL where this step is done by hand

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cta") + public CtaLabelStage cta(@NotNull String cta) { + this.cta = Objects.requireNonNull(cta, "cta must not be null"); + return this; + } + + /** + *

Button label

+ *

Button label

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cta_label") + public DescriptionStage ctaLabel(@NotNull String ctaLabel) { + this.ctaLabel = Objects.requireNonNull(ctaLabel, "ctaLabel must not be null"); + return this; + } + + /** + *

Supporting copy, or empty

+ *

Supporting copy, or empty

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("description") + public PositionStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + /** + *

Zero-based order of this step within the chain

+ *

Zero-based order of this step within the chain

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("position") + public TitleStage position(int position) { + this.position = position; + return this; + } + + /** + *

Headline for the step

+ *

Headline for the step

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Where the run step currently stands, or null when the chain has not been run

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

Where the run step currently stands, or null when the chain has not been run

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(AccountRecommendedActionChainStepStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Where the run step currently stands, or null when the chain has not been run

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

Why the generator filled the step this way, or null for seeded chains

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reasoning(Nullable> reasoning) { + if (reasoning.isNull()) { + this.reasoning = null; + } else if (reasoning.isEmpty()) { + this.reasoning = Optional.empty(); + } else { + this.reasoning = Optional.of(reasoning.get()); + } + return this; + } + + /** + *

Why the generator filled the step this way, or null for seeded chains

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reasoning(Map reasoning) { + this.reasoning = Optional.ofNullable(reasoning); + return this; + } + + /** + *

Why the generator filled the step this way, or null for seeded chains

+ */ + @java.lang.Override + @JsonSetter(value = "reasoning", nulls = Nulls.SKIP) + public _FinalStage reasoning(Optional> reasoning) { + this.reasoning = reasoning; + return this; + } + + /** + *

The API response the step produced, or null until it succeeds

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage output(Nullable> output) { + if (output.isNull()) { + this.output = null; + } else if (output.isEmpty()) { + this.output = Optional.empty(); + } else { + this.output = Optional.of(output.get()); + } + return this; + } + + /** + *

The API response the step produced, or null until it succeeds

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage output(Map output) { + this.output = Optional.ofNullable(output); + return this; + } + + /** + *

The API response the step produced, or null until it succeeds

+ */ + @java.lang.Override + @JsonSetter(value = "output", nulls = Nulls.SKIP) + public _FinalStage output(Optional> output) { + this.output = output; + return this; + } + + /** + *

The filled-in request body for the step's endpoint, or null when it was not recorded

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage input(Nullable> input) { + if (input.isNull()) { + this.input = null; + } else if (input.isEmpty()) { + this.input = Optional.empty(); + } else { + this.input = Optional.of(input.get()); + } + return this; + } + + /** + *

The filled-in request body for the step's endpoint, or null when it was not recorded

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage input(Map input) { + this.input = Optional.ofNullable(input); + return this; + } + + /** + *

The filled-in request body for the step's endpoint, or null when it was not recorded

+ */ + @java.lang.Override + @JsonSetter(value = "input", nulls = Nulls.SKIP) + public _FinalStage input(Optional> input) { + this.input = input; + return this; + } + + /** + *

Why the step failed, or null

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(Nullable error) { + if (error.isNull()) { + this.error = null; + } else if (error.isEmpty()) { + this.error = Optional.empty(); + } else { + this.error = Optional.of(error.get()); + } + return this; + } + + /** + *

Why the step failed, or null

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

Why the step failed, or null

+ */ + @java.lang.Override + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public _FinalStage error(Optional error) { + this.error = error; + return this; + } + + @java.lang.Override + public AccountRecommendedActionChainStep build() { + return new AccountRecommendedActionChainStep( + action, + cta, + ctaLabel, + description, + error, + input, + output, + position, + reasoning, + status, + title, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountRecommendedActionChainStepStatus.java b/src/main/java/com/whop/api/types/AccountRecommendedActionChainStepStatus.java new file mode 100644 index 00000000..87a80cc3 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountRecommendedActionChainStepStatus.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountRecommendedActionChainStepStatus { + public static final AccountRecommendedActionChainStepStatus FAILED = + new AccountRecommendedActionChainStepStatus(Value.FAILED, "failed"); + + public static final AccountRecommendedActionChainStepStatus SUCCEEDED = + new AccountRecommendedActionChainStepStatus(Value.SUCCEEDED, "succeeded"); + + public static final AccountRecommendedActionChainStepStatus PENDING = + new AccountRecommendedActionChainStepStatus(Value.PENDING, "pending"); + + public static final AccountRecommendedActionChainStepStatus REDIRECTED = + new AccountRecommendedActionChainStepStatus(Value.REDIRECTED, "redirected"); + + public static final AccountRecommendedActionChainStepStatus RUNNING = + new AccountRecommendedActionChainStepStatus(Value.RUNNING, "running"); + + private final Value value; + + private final String string; + + AccountRecommendedActionChainStepStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountRecommendedActionChainStepStatus + && this.string.equals(((AccountRecommendedActionChainStepStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case SUCCEEDED: + return visitor.visitSucceeded(); + case PENDING: + return visitor.visitPending(); + case REDIRECTED: + return visitor.visitRedirected(); + case RUNNING: + return visitor.visitRunning(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountRecommendedActionChainStepStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "succeeded": + return SUCCEEDED; + case "pending": + return PENDING; + case "redirected": + return REDIRECTED; + case "running": + return RUNNING; + default: + return new AccountRecommendedActionChainStepStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + REDIRECTED, + + RUNNING, + + SUCCEEDED, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitRedirected(); + + T visitRunning(); + + T visitSucceeded(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountRecommendedActionOutcome.java b/src/main/java/com/whop/api/types/AccountRecommendedActionOutcome.java new file mode 100644 index 00000000..28c822bb --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountRecommendedActionOutcome.java @@ -0,0 +1,729 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountRecommendedActionOutcome.Builder.class) +public final class AccountRecommendedActionOutcome { + private final Optional> account; + + private final List actions; + + private final String description; + + private final String executedAt; + + private final String id; + + private final Optional latencyMs; + + private final Optional> payment; + + private final Optional paymentAt; + + private final Optional paymentId; + + private final Optional> reasoning; + + private final String title; + + private final Map additionalProperties; + + private AccountRecommendedActionOutcome( + Optional> account, + List actions, + String description, + String executedAt, + String id, + Optional latencyMs, + Optional> payment, + Optional paymentAt, + Optional paymentId, + Optional> reasoning, + String title, + Map additionalProperties) { + this.account = account; + this.actions = actions; + this.description = description; + this.executedAt = executedAt; + this.id = id; + this.latencyMs = latencyMs; + this.payment = payment; + this.paymentAt = paymentAt; + this.paymentId = paymentId; + this.reasoning = reasoning; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The business the chain ran on. + */ + @JsonIgnore + public Optional> getAccount() { + if (account == null) { + return Optional.empty(); + } + return account; + } + + @JsonProperty("actions") + public List getActions() { + return actions; + } + + /** + * @return What running the chain accomplishes + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * @return When the chain was run, as an ISO 8601 timestamp. + */ + @JsonProperty("executed_at") + public String getExecutedAt() { + return executedAt; + } + + /** + * @return The executed chain id (rac_chain_* or rac_seed_*) + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Milliseconds from chain execution to that payment, or null. + */ + @JsonIgnore + public Optional getLatencyMs() { + if (latencyMs == null) { + return Optional.empty(); + } + return latencyMs; + } + + /** + * @return The payment amount as Money, or null. + */ + @JsonIgnore + public Optional> getPayment() { + if (payment == null) { + return Optional.empty(); + } + return payment; + } + + /** + * @return When that payment completed, ISO 8601, or null. + */ + @JsonIgnore + public Optional getPaymentAt() { + if (paymentAt == null) { + return Optional.empty(); + } + return paymentAt; + } + + /** + * @return The first payment.completed on that business after the chain, prefixed pay_, or null if none landed within 30 days. + */ + @JsonIgnore + public Optional getPaymentId() { + if (paymentId == null) { + return Optional.empty(); + } + return paymentId; + } + + /** + * @return Why the generator proposed this chain, or null for seeded chains + */ + @JsonIgnore + public Optional> getReasoning() { + if (reasoning == null) { + return Optional.empty(); + } + return reasoning; + } + + /** + * @return Headline for the chain + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account") + private Optional> _getAccount() { + return account; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("latency_ms") + private Optional _getLatencyMs() { + return latencyMs; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment") + private Optional> _getPayment() { + return payment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_at") + private Optional _getPaymentAt() { + return paymentAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_id") + private Optional _getPaymentId() { + return paymentId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reasoning") + private Optional> _getReasoning() { + return reasoning; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountRecommendedActionOutcome && equalTo((AccountRecommendedActionOutcome) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountRecommendedActionOutcome other) { + return account.equals(other.account) + && actions.equals(other.actions) + && description.equals(other.description) + && executedAt.equals(other.executedAt) + && id.equals(other.id) + && latencyMs.equals(other.latencyMs) + && payment.equals(other.payment) + && paymentAt.equals(other.paymentAt) + && paymentId.equals(other.paymentId) + && reasoning.equals(other.reasoning) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.account, + this.actions, + this.description, + this.executedAt, + this.id, + this.latencyMs, + this.payment, + this.paymentAt, + this.paymentId, + this.reasoning, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DescriptionStage builder() { + return new Builder(); + } + + public interface DescriptionStage { + /** + *

What running the chain accomplishes

+ */ + ExecutedAtStage description(@NotNull String description); + + Builder from(AccountRecommendedActionOutcome other); + } + + public interface ExecutedAtStage { + /** + *

When the chain was run, as an ISO 8601 timestamp.

+ */ + IdStage executedAt(@NotNull String executedAt); + } + + public interface IdStage { + /** + *

The executed chain id (rac_chain_* or rac_seed_*)

+ */ + TitleStage id(@NotNull String id); + } + + public interface TitleStage { + /** + *

Headline for the chain

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + AccountRecommendedActionOutcome build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The business the chain ran on.

+ */ + _FinalStage account(Optional> account); + + _FinalStage account(Map account); + + _FinalStage account(Nullable> account); + + _FinalStage actions(List actions); + + _FinalStage addActions(AccountRecommendedActionChainStep actions); + + _FinalStage addAllActions(List actions); + + /** + *

Milliseconds from chain execution to that payment, or null.

+ */ + _FinalStage latencyMs(Optional latencyMs); + + _FinalStage latencyMs(Integer latencyMs); + + _FinalStage latencyMs(Nullable latencyMs); + + /** + *

The payment amount as Money, or null.

+ */ + _FinalStage payment(Optional> payment); + + _FinalStage payment(Map payment); + + _FinalStage payment(Nullable> payment); + + /** + *

When that payment completed, ISO 8601, or null.

+ */ + _FinalStage paymentAt(Optional paymentAt); + + _FinalStage paymentAt(String paymentAt); + + _FinalStage paymentAt(Nullable paymentAt); + + /** + *

The first payment.completed on that business after the chain, prefixed pay_, or null if none landed within 30 days.

+ */ + _FinalStage paymentId(Optional paymentId); + + _FinalStage paymentId(String paymentId); + + _FinalStage paymentId(Nullable paymentId); + + /** + *

Why the generator proposed this chain, or null for seeded chains

+ */ + _FinalStage reasoning(Optional> reasoning); + + _FinalStage reasoning(Map reasoning); + + _FinalStage reasoning(Nullable> reasoning); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DescriptionStage, ExecutedAtStage, IdStage, TitleStage, _FinalStage { + private String description; + + private String executedAt; + + private String id; + + private String title; + + private Optional> reasoning = Optional.empty(); + + private Optional paymentId = Optional.empty(); + + private Optional paymentAt = Optional.empty(); + + private Optional> payment = Optional.empty(); + + private Optional latencyMs = Optional.empty(); + + private List actions = new ArrayList<>(); + + private Optional> account = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountRecommendedActionOutcome other) { + account(other.getAccount()); + actions(other.getActions()); + description(other.getDescription()); + executedAt(other.getExecutedAt()); + id(other.getId()); + latencyMs(other.getLatencyMs()); + payment(other.getPayment()); + paymentAt(other.getPaymentAt()); + paymentId(other.getPaymentId()); + reasoning(other.getReasoning()); + title(other.getTitle()); + return this; + } + + /** + *

What running the chain accomplishes

+ *

What running the chain accomplishes

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("description") + public ExecutedAtStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + /** + *

When the chain was run, as an ISO 8601 timestamp.

+ *

When the chain was run, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("executed_at") + public IdStage executedAt(@NotNull String executedAt) { + this.executedAt = Objects.requireNonNull(executedAt, "executedAt must not be null"); + return this; + } + + /** + *

The executed chain id (rac_chain_* or rac_seed_*)

+ *

The executed chain id (rac_chain_* or rac_seed_*)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Headline for the chain

+ *

Headline for the chain

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Why the generator proposed this chain, or null for seeded chains

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reasoning(Nullable> reasoning) { + if (reasoning.isNull()) { + this.reasoning = null; + } else if (reasoning.isEmpty()) { + this.reasoning = Optional.empty(); + } else { + this.reasoning = Optional.of(reasoning.get()); + } + return this; + } + + /** + *

Why the generator proposed this chain, or null for seeded chains

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reasoning(Map reasoning) { + this.reasoning = Optional.ofNullable(reasoning); + return this; + } + + /** + *

Why the generator proposed this chain, or null for seeded chains

+ */ + @java.lang.Override + @JsonSetter(value = "reasoning", nulls = Nulls.SKIP) + public _FinalStage reasoning(Optional> reasoning) { + this.reasoning = reasoning; + return this; + } + + /** + *

The first payment.completed on that business after the chain, prefixed pay_, or null if none landed within 30 days.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentId(Nullable paymentId) { + if (paymentId.isNull()) { + this.paymentId = null; + } else if (paymentId.isEmpty()) { + this.paymentId = Optional.empty(); + } else { + this.paymentId = Optional.of(paymentId.get()); + } + return this; + } + + /** + *

The first payment.completed on that business after the chain, prefixed pay_, or null if none landed within 30 days.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentId(String paymentId) { + this.paymentId = Optional.ofNullable(paymentId); + return this; + } + + /** + *

The first payment.completed on that business after the chain, prefixed pay_, or null if none landed within 30 days.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_id", nulls = Nulls.SKIP) + public _FinalStage paymentId(Optional paymentId) { + this.paymentId = paymentId; + return this; + } + + /** + *

When that payment completed, ISO 8601, or null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentAt(Nullable paymentAt) { + if (paymentAt.isNull()) { + this.paymentAt = null; + } else if (paymentAt.isEmpty()) { + this.paymentAt = Optional.empty(); + } else { + this.paymentAt = Optional.of(paymentAt.get()); + } + return this; + } + + /** + *

When that payment completed, ISO 8601, or null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentAt(String paymentAt) { + this.paymentAt = Optional.ofNullable(paymentAt); + return this; + } + + /** + *

When that payment completed, ISO 8601, or null.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_at", nulls = Nulls.SKIP) + public _FinalStage paymentAt(Optional paymentAt) { + this.paymentAt = paymentAt; + return this; + } + + /** + *

The payment amount as Money, or null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(Nullable> payment) { + if (payment.isNull()) { + this.payment = null; + } else if (payment.isEmpty()) { + this.payment = Optional.empty(); + } else { + this.payment = Optional.of(payment.get()); + } + return this; + } + + /** + *

The payment amount as Money, or null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(Map payment) { + this.payment = Optional.ofNullable(payment); + return this; + } + + /** + *

The payment amount as Money, or null.

+ */ + @java.lang.Override + @JsonSetter(value = "payment", nulls = Nulls.SKIP) + public _FinalStage payment(Optional> payment) { + this.payment = payment; + return this; + } + + /** + *

Milliseconds from chain execution to that payment, or null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage latencyMs(Nullable latencyMs) { + if (latencyMs.isNull()) { + this.latencyMs = null; + } else if (latencyMs.isEmpty()) { + this.latencyMs = Optional.empty(); + } else { + this.latencyMs = Optional.of(latencyMs.get()); + } + return this; + } + + /** + *

Milliseconds from chain execution to that payment, or null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage latencyMs(Integer latencyMs) { + this.latencyMs = Optional.ofNullable(latencyMs); + return this; + } + + /** + *

Milliseconds from chain execution to that payment, or null.

+ */ + @java.lang.Override + @JsonSetter(value = "latency_ms", nulls = Nulls.SKIP) + public _FinalStage latencyMs(Optional latencyMs) { + this.latencyMs = latencyMs; + return this; + } + + @java.lang.Override + public _FinalStage addAllActions(List actions) { + if (actions != null) { + this.actions.addAll(actions); + } + return this; + } + + @java.lang.Override + public _FinalStage addActions(AccountRecommendedActionChainStep actions) { + this.actions.add(actions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "actions", nulls = Nulls.SKIP) + public _FinalStage actions(List actions) { + this.actions.clear(); + if (actions != null) { + this.actions.addAll(actions); + } + return this; + } + + /** + *

The business the chain ran on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(Nullable> account) { + if (account.isNull()) { + this.account = null; + } else if (account.isEmpty()) { + this.account = Optional.empty(); + } else { + this.account = Optional.of(account.get()); + } + return this; + } + + /** + *

The business the chain ran on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(Map account) { + this.account = Optional.ofNullable(account); + return this; + } + + /** + *

The business the chain ran on.

+ */ + @java.lang.Override + @JsonSetter(value = "account", nulls = Nulls.SKIP) + public _FinalStage account(Optional> account) { + this.account = account; + return this; + } + + @java.lang.Override + public AccountRecommendedActionOutcome build() { + return new AccountRecommendedActionOutcome( + account, + actions, + description, + executedAt, + id, + latencyMs, + payment, + paymentAt, + paymentId, + reasoning, + title, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountRecommendedActionStatus.java b/src/main/java/com/whop/api/types/AccountRecommendedActionStatus.java new file mode 100644 index 00000000..892531b2 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountRecommendedActionStatus.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountRecommendedActionStatus { + public static final AccountRecommendedActionStatus OPTIONAL = + new AccountRecommendedActionStatus(Value.OPTIONAL, "optional"); + + private final Value value; + + private final String string; + + AccountRecommendedActionStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountRecommendedActionStatus + && this.string.equals(((AccountRecommendedActionStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case OPTIONAL: + return visitor.visitOptional(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountRecommendedActionStatus valueOf(String value) { + switch (value) { + case "optional": + return OPTIONAL; + default: + return new AccountRecommendedActionStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + OPTIONAL, + + UNKNOWN + } + + public interface Visitor { + T visitOptional(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountRequiredAction.java b/src/main/java/com/whop/api/types/AccountRequiredAction.java new file mode 100644 index 00000000..2724695c --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountRequiredAction.java @@ -0,0 +1,479 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountRequiredAction.Builder.class) +public final class AccountRequiredAction { + private final AccountRequiredActionAction action; + + private final List blockedCapabilities; + + private final Optional cta; + + private final String ctaLabel; + + private final String description; + + private final Optional iconUrl; + + private final AccountRequiredActionStatus status; + + private final String title; + + private final Map additionalProperties; + + private AccountRequiredAction( + AccountRequiredActionAction action, + List blockedCapabilities, + Optional cta, + String ctaLabel, + String description, + Optional iconUrl, + AccountRequiredActionStatus status, + String title, + Map additionalProperties) { + this.action = action; + this.blockedCapabilities = blockedCapabilities; + this.cta = cta; + this.ctaLabel = ctaLabel; + this.description = description; + this.iconUrl = iconUrl; + this.status = status; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return What the holder must do; new values may be added, so handle unknown actions gracefully + */ + @JsonProperty("action") + public AccountRequiredActionAction getAction() { + return action; + } + + @JsonProperty("blocked_capabilities") + public List getBlockedCapabilities() { + return blockedCapabilities; + } + + /** + * @return The URL the call-to-action links to, or null when there is no button + */ + @JsonIgnore + public Optional getCta() { + if (cta == null) { + return Optional.empty(); + } + return cta; + } + + /** + * @return Button label, or empty when there is no button + */ + @JsonProperty("cta_label") + public String getCtaLabel() { + return ctaLabel; + } + + /** + * @return Supporting copy, or empty + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * @return The URL of the action's illustration icon, or null if it has none + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return required (act now) or pending (under review) + */ + @JsonProperty("status") + public AccountRequiredActionStatus getStatus() { + return status; + } + + /** + * @return Headline for the action + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cta") + private Optional _getCta() { + return cta; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountRequiredAction && equalTo((AccountRequiredAction) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountRequiredAction other) { + return action.equals(other.action) + && blockedCapabilities.equals(other.blockedCapabilities) + && cta.equals(other.cta) + && ctaLabel.equals(other.ctaLabel) + && description.equals(other.description) + && iconUrl.equals(other.iconUrl) + && status.equals(other.status) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.action, + this.blockedCapabilities, + this.cta, + this.ctaLabel, + this.description, + this.iconUrl, + this.status, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + /** + *

What the holder must do; new values may be added, so handle unknown actions gracefully

+ */ + CtaLabelStage action(@NotNull AccountRequiredActionAction action); + + Builder from(AccountRequiredAction other); + } + + public interface CtaLabelStage { + /** + *

Button label, or empty when there is no button

+ */ + DescriptionStage ctaLabel(@NotNull String ctaLabel); + } + + public interface DescriptionStage { + /** + *

Supporting copy, or empty

+ */ + StatusStage description(@NotNull String description); + } + + public interface StatusStage { + /** + *

required (act now) or pending (under review)

+ */ + TitleStage status(@NotNull AccountRequiredActionStatus status); + } + + public interface TitleStage { + /** + *

Headline for the action

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + AccountRequiredAction build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage blockedCapabilities(List blockedCapabilities); + + _FinalStage addBlockedCapabilities(String blockedCapabilities); + + _FinalStage addAllBlockedCapabilities(List blockedCapabilities); + + /** + *

The URL the call-to-action links to, or null when there is no button

+ */ + _FinalStage cta(Optional cta); + + _FinalStage cta(String cta); + + _FinalStage cta(Nullable cta); + + /** + *

The URL of the action's illustration icon, or null if it has none

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ActionStage, CtaLabelStage, DescriptionStage, StatusStage, TitleStage, _FinalStage { + private AccountRequiredActionAction action; + + private String ctaLabel; + + private String description; + + private AccountRequiredActionStatus status; + + private String title; + + private Optional iconUrl = Optional.empty(); + + private Optional cta = Optional.empty(); + + private List blockedCapabilities = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountRequiredAction other) { + action(other.getAction()); + blockedCapabilities(other.getBlockedCapabilities()); + cta(other.getCta()); + ctaLabel(other.getCtaLabel()); + description(other.getDescription()); + iconUrl(other.getIconUrl()); + status(other.getStatus()); + title(other.getTitle()); + return this; + } + + /** + *

What the holder must do; new values may be added, so handle unknown actions gracefully

+ *

What the holder must do; new values may be added, so handle unknown actions gracefully

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("action") + public CtaLabelStage action(@NotNull AccountRequiredActionAction action) { + this.action = Objects.requireNonNull(action, "action must not be null"); + return this; + } + + /** + *

Button label, or empty when there is no button

+ *

Button label, or empty when there is no button

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cta_label") + public DescriptionStage ctaLabel(@NotNull String ctaLabel) { + this.ctaLabel = Objects.requireNonNull(ctaLabel, "ctaLabel must not be null"); + return this; + } + + /** + *

Supporting copy, or empty

+ *

Supporting copy, or empty

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("description") + public StatusStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + /** + *

required (act now) or pending (under review)

+ *

required (act now) or pending (under review)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TitleStage status(@NotNull AccountRequiredActionStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Headline for the action

+ *

Headline for the action

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

The URL of the action's illustration icon, or null if it has none

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

The URL of the action's illustration icon, or null if it has none

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

The URL of the action's illustration icon, or null if it has none

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + /** + *

The URL the call-to-action links to, or null when there is no button

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cta(Nullable cta) { + if (cta.isNull()) { + this.cta = null; + } else if (cta.isEmpty()) { + this.cta = Optional.empty(); + } else { + this.cta = Optional.of(cta.get()); + } + return this; + } + + /** + *

The URL the call-to-action links to, or null when there is no button

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cta(String cta) { + this.cta = Optional.ofNullable(cta); + return this; + } + + /** + *

The URL the call-to-action links to, or null when there is no button

+ */ + @java.lang.Override + @JsonSetter(value = "cta", nulls = Nulls.SKIP) + public _FinalStage cta(Optional cta) { + this.cta = cta; + return this; + } + + @java.lang.Override + public _FinalStage addAllBlockedCapabilities(List blockedCapabilities) { + if (blockedCapabilities != null) { + this.blockedCapabilities.addAll(blockedCapabilities); + } + return this; + } + + @java.lang.Override + public _FinalStage addBlockedCapabilities(String blockedCapabilities) { + this.blockedCapabilities.add(blockedCapabilities); + return this; + } + + @java.lang.Override + @JsonSetter(value = "blocked_capabilities", nulls = Nulls.SKIP) + public _FinalStage blockedCapabilities(List blockedCapabilities) { + this.blockedCapabilities.clear(); + if (blockedCapabilities != null) { + this.blockedCapabilities.addAll(blockedCapabilities); + } + return this; + } + + @java.lang.Override + public AccountRequiredAction build() { + return new AccountRequiredAction( + action, + blockedCapabilities, + cta, + ctaLabel, + description, + iconUrl, + status, + title, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountRequiredActionAction.java b/src/main/java/com/whop/api/types/AccountRequiredActionAction.java new file mode 100644 index 00000000..b53be8de --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountRequiredActionAction.java @@ -0,0 +1,185 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountRequiredActionAction { + public static final AccountRequiredActionAction VERIFY_IDENTITY = + new AccountRequiredActionAction(Value.VERIFY_IDENTITY, "verify_identity"); + + public static final AccountRequiredActionAction CONNECT_FULFILLMENT_TRACKER = + new AccountRequiredActionAction(Value.CONNECT_FULFILLMENT_TRACKER, "connect_fulfillment_tracker"); + + public static final AccountRequiredActionAction SETUP_APPLE_PAY_DOMAINS = + new AccountRequiredActionAction(Value.SETUP_APPLE_PAY_DOMAINS, "setup_apple_pay_domains"); + + public static final AccountRequiredActionAction UPDATE_PAYOUT_PROFILE = + new AccountRequiredActionAction(Value.UPDATE_PAYOUT_PROFILE, "update_payout_profile"); + + public static final AccountRequiredActionAction REAUTHORIZE_PAYOUT_METHODS = + new AccountRequiredActionAction(Value.REAUTHORIZE_PAYOUT_METHODS, "reauthorize_payout_methods"); + + public static final AccountRequiredActionAction SUBMIT_INFORMATION_REQUEST = + new AccountRequiredActionAction(Value.SUBMIT_INFORMATION_REQUEST, "submit_information_request"); + + public static final AccountRequiredActionAction ADD_VAT_REGISTRATION = + new AccountRequiredActionAction(Value.ADD_VAT_REGISTRATION, "add_vat_registration"); + + public static final AccountRequiredActionAction SIGN_FORMATION_DOCUMENTS = + new AccountRequiredActionAction(Value.SIGN_FORMATION_DOCUMENTS, "sign_formation_documents"); + + public static final AccountRequiredActionAction CONFIGURE_TAX_REMITTER = + new AccountRequiredActionAction(Value.CONFIGURE_TAX_REMITTER, "configure_tax_remitter"); + + public static final AccountRequiredActionAction DEPOSIT_FUNDS = + new AccountRequiredActionAction(Value.DEPOSIT_FUNDS, "deposit_funds"); + + public static final AccountRequiredActionAction CARD_USAGE_REVIEW = + new AccountRequiredActionAction(Value.CARD_USAGE_REVIEW, "card_usage_review"); + + private final Value value; + + private final String string; + + AccountRequiredActionAction(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountRequiredActionAction + && this.string.equals(((AccountRequiredActionAction) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VERIFY_IDENTITY: + return visitor.visitVerifyIdentity(); + case CONNECT_FULFILLMENT_TRACKER: + return visitor.visitConnectFulfillmentTracker(); + case SETUP_APPLE_PAY_DOMAINS: + return visitor.visitSetupApplePayDomains(); + case UPDATE_PAYOUT_PROFILE: + return visitor.visitUpdatePayoutProfile(); + case REAUTHORIZE_PAYOUT_METHODS: + return visitor.visitReauthorizePayoutMethods(); + case SUBMIT_INFORMATION_REQUEST: + return visitor.visitSubmitInformationRequest(); + case ADD_VAT_REGISTRATION: + return visitor.visitAddVatRegistration(); + case SIGN_FORMATION_DOCUMENTS: + return visitor.visitSignFormationDocuments(); + case CONFIGURE_TAX_REMITTER: + return visitor.visitConfigureTaxRemitter(); + case DEPOSIT_FUNDS: + return visitor.visitDepositFunds(); + case CARD_USAGE_REVIEW: + return visitor.visitCardUsageReview(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountRequiredActionAction valueOf(String value) { + switch (value) { + case "verify_identity": + return VERIFY_IDENTITY; + case "connect_fulfillment_tracker": + return CONNECT_FULFILLMENT_TRACKER; + case "setup_apple_pay_domains": + return SETUP_APPLE_PAY_DOMAINS; + case "update_payout_profile": + return UPDATE_PAYOUT_PROFILE; + case "reauthorize_payout_methods": + return REAUTHORIZE_PAYOUT_METHODS; + case "submit_information_request": + return SUBMIT_INFORMATION_REQUEST; + case "add_vat_registration": + return ADD_VAT_REGISTRATION; + case "sign_formation_documents": + return SIGN_FORMATION_DOCUMENTS; + case "configure_tax_remitter": + return CONFIGURE_TAX_REMITTER; + case "deposit_funds": + return DEPOSIT_FUNDS; + case "card_usage_review": + return CARD_USAGE_REVIEW; + default: + return new AccountRequiredActionAction(Value.UNKNOWN, value); + } + } + + public enum Value { + DEPOSIT_FUNDS, + + SUBMIT_INFORMATION_REQUEST, + + REAUTHORIZE_PAYOUT_METHODS, + + UPDATE_PAYOUT_PROFILE, + + CARD_USAGE_REVIEW, + + VERIFY_IDENTITY, + + SIGN_FORMATION_DOCUMENTS, + + CONNECT_FULFILLMENT_TRACKER, + + SETUP_APPLE_PAY_DOMAINS, + + CONFIGURE_TAX_REMITTER, + + ADD_VAT_REGISTRATION, + + UNKNOWN + } + + public interface Visitor { + T visitDepositFunds(); + + T visitSubmitInformationRequest(); + + T visitReauthorizePayoutMethods(); + + T visitUpdatePayoutProfile(); + + T visitCardUsageReview(); + + T visitVerifyIdentity(); + + T visitSignFormationDocuments(); + + T visitConnectFulfillmentTracker(); + + T visitSetupApplePayDomains(); + + T visitConfigureTaxRemitter(); + + T visitAddVatRegistration(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountRequiredActionStatus.java b/src/main/java/com/whop/api/types/AccountRequiredActionStatus.java new file mode 100644 index 00000000..46398f82 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountRequiredActionStatus.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountRequiredActionStatus { + public static final AccountRequiredActionStatus REQUIRED = + new AccountRequiredActionStatus(Value.REQUIRED, "required"); + + public static final AccountRequiredActionStatus PENDING = new AccountRequiredActionStatus(Value.PENDING, "pending"); + + private final Value value; + + private final String string; + + AccountRequiredActionStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountRequiredActionStatus + && this.string.equals(((AccountRequiredActionStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REQUIRED: + return visitor.visitRequired(); + case PENDING: + return visitor.visitPending(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountRequiredActionStatus valueOf(String value) { + switch (value) { + case "required": + return REQUIRED; + case "pending": + return PENDING; + default: + return new AccountRequiredActionStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + REQUIRED, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitRequired(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountReserve.java b/src/main/java/com/whop/api/types/AccountReserve.java new file mode 100644 index 00000000..c9a62a55 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountReserve.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountReserve.Builder.class) +public final class AccountReserve { + private final String amount; + + private final List byType; + + private final String currency; + + private final List unlocksByDate; + + private final Map additionalProperties; + + private AccountReserve( + String amount, + List byType, + String currency, + List unlocksByDate, + Map additionalProperties) { + this.amount = amount; + this.byType = byType; + this.currency = currency; + this.unlocksByDate = unlocksByDate; + this.additionalProperties = additionalProperties; + } + + /** + * @return Total held in this currency, in native units, as a decimal string. usd and usdt are reported as one usd entry, matching how the balance row groups them. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + @JsonProperty("by_type") + public List getByType() { + return byType; + } + + /** + * @return Lowercase ISO currency code, such as usd or eur. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("unlocks_by_date") + public List getUnlocksByDate() { + return unlocksByDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountReserve && equalTo((AccountReserve) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountReserve other) { + return amount.equals(other.amount) + && byType.equals(other.byType) + && currency.equals(other.currency) + && unlocksByDate.equals(other.unlocksByDate); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.byType, this.currency, this.unlocksByDate); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

Total held in this currency, in native units, as a decimal string. usd and usdt are reported as one usd entry, matching how the balance row groups them.

+ */ + CurrencyStage amount(@NotNull String amount); + + Builder from(AccountReserve other); + } + + public interface CurrencyStage { + /** + *

Lowercase ISO currency code, such as usd or eur.

+ */ + _FinalStage currency(@NotNull String currency); + } + + public interface _FinalStage { + AccountReserve build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage byType(List byType); + + _FinalStage addByType(AccountReserveType byType); + + _FinalStage addAllByType(List byType); + + _FinalStage unlocksByDate(List unlocksByDate); + + _FinalStage addUnlocksByDate(AccountReserveUnlock unlocksByDate); + + _FinalStage addAllUnlocksByDate(List unlocksByDate); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, CurrencyStage, _FinalStage { + private String amount; + + private String currency; + + private List unlocksByDate = new ArrayList<>(); + + private List byType = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountReserve other) { + amount(other.getAmount()); + byType(other.getByType()); + currency(other.getCurrency()); + unlocksByDate(other.getUnlocksByDate()); + return this; + } + + /** + *

Total held in this currency, in native units, as a decimal string. usd and usdt are reported as one usd entry, matching how the balance row groups them.

+ *

Total held in this currency, in native units, as a decimal string. usd and usdt are reported as one usd entry, matching how the balance row groups them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CurrencyStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

Lowercase ISO currency code, such as usd or eur.

+ *

Lowercase ISO currency code, such as usd or eur.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllUnlocksByDate(List unlocksByDate) { + if (unlocksByDate != null) { + this.unlocksByDate.addAll(unlocksByDate); + } + return this; + } + + @java.lang.Override + public _FinalStage addUnlocksByDate(AccountReserveUnlock unlocksByDate) { + this.unlocksByDate.add(unlocksByDate); + return this; + } + + @java.lang.Override + @JsonSetter(value = "unlocks_by_date", nulls = Nulls.SKIP) + public _FinalStage unlocksByDate(List unlocksByDate) { + this.unlocksByDate.clear(); + if (unlocksByDate != null) { + this.unlocksByDate.addAll(unlocksByDate); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllByType(List byType) { + if (byType != null) { + this.byType.addAll(byType); + } + return this; + } + + @java.lang.Override + public _FinalStage addByType(AccountReserveType byType) { + this.byType.add(byType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "by_type", nulls = Nulls.SKIP) + public _FinalStage byType(List byType) { + this.byType.clear(); + if (byType != null) { + this.byType.addAll(byType); + } + return this; + } + + @java.lang.Override + public AccountReserve build() { + return new AccountReserve(amount, byType, currency, unlocksByDate, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountReserveControl.java b/src/main/java/com/whop/api/types/AccountReserveControl.java new file mode 100644 index 00000000..7d4a02e2 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountReserveControl.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountReserveControl.Builder.class) +public final class AccountReserveControl { + private final int holdPeriodDays; + + private final Optional percentage; + + private final Map additionalProperties; + + private AccountReserveControl( + int holdPeriodDays, Optional percentage, Map additionalProperties) { + this.holdPeriodDays = holdPeriodDays; + this.percentage = percentage; + this.additionalProperties = additionalProperties; + } + + /** + * @return Number of days reserved funds are held before release. + */ + @JsonProperty("hold_period_days") + public int getHoldPeriodDays() { + return holdPeriodDays; + } + + /** + * @return Percentage of incoming payment volume held in reserve. null when no reserve is applied. + */ + @JsonIgnore + public Optional getPercentage() { + if (percentage == null) { + return Optional.empty(); + } + return percentage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("percentage") + private Optional _getPercentage() { + return percentage; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountReserveControl && equalTo((AccountReserveControl) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountReserveControl other) { + return holdPeriodDays == other.holdPeriodDays && percentage.equals(other.percentage); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.holdPeriodDays, this.percentage); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HoldPeriodDaysStage builder() { + return new Builder(); + } + + public interface HoldPeriodDaysStage { + /** + *

Number of days reserved funds are held before release.

+ */ + _FinalStage holdPeriodDays(int holdPeriodDays); + + Builder from(AccountReserveControl other); + } + + public interface _FinalStage { + AccountReserveControl build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Percentage of incoming payment volume held in reserve. null when no reserve is applied.

+ */ + _FinalStage percentage(Optional percentage); + + _FinalStage percentage(Double percentage); + + _FinalStage percentage(Nullable percentage); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HoldPeriodDaysStage, _FinalStage { + private int holdPeriodDays; + + private Optional percentage = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountReserveControl other) { + holdPeriodDays(other.getHoldPeriodDays()); + percentage(other.getPercentage()); + return this; + } + + /** + *

Number of days reserved funds are held before release.

+ *

Number of days reserved funds are held before release.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("hold_period_days") + public _FinalStage holdPeriodDays(int holdPeriodDays) { + this.holdPeriodDays = holdPeriodDays; + return this; + } + + /** + *

Percentage of incoming payment volume held in reserve. null when no reserve is applied.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage percentage(Nullable percentage) { + if (percentage.isNull()) { + this.percentage = null; + } else if (percentage.isEmpty()) { + this.percentage = Optional.empty(); + } else { + this.percentage = Optional.of(percentage.get()); + } + return this; + } + + /** + *

Percentage of incoming payment volume held in reserve. null when no reserve is applied.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage percentage(Double percentage) { + this.percentage = Optional.ofNullable(percentage); + return this; + } + + /** + *

Percentage of incoming payment volume held in reserve. null when no reserve is applied.

+ */ + @java.lang.Override + @JsonSetter(value = "percentage", nulls = Nulls.SKIP) + public _FinalStage percentage(Optional percentage) { + this.percentage = percentage; + return this; + } + + @java.lang.Override + public AccountReserveControl build() { + return new AccountReserveControl(holdPeriodDays, percentage, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountReserveType.java b/src/main/java/com/whop/api/types/AccountReserveType.java new file mode 100644 index 00000000..26313ffc --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountReserveType.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountReserveType.Builder.class) +public final class AccountReserveType { + private final String amount; + + private final Optional holdPeriodDays; + + private final Optional percentage; + + private final AccountReserveTypeType type; + + private final Map additionalProperties; + + private AccountReserveType( + String amount, + Optional holdPeriodDays, + Optional percentage, + AccountReserveTypeType type, + Map additionalProperties) { + this.amount = amount; + this.holdPeriodDays = holdPeriodDays; + this.percentage = percentage; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Amount held for this reason, in native units, as a decimal string. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + /** + * @return Days money is currently held for this reason before it unlocks, or null when release depends on something other than time. Money already held keeps the terms it was taken under. + */ + @JsonIgnore + public Optional getHoldPeriodDays() { + if (holdPeriodDays == null) { + return Optional.empty(); + } + return holdPeriodDays; + } + + /** + * @return Percentage of each incoming payment currently held for this reason, or null when the reason is not a percentage of anything. Money already held keeps the release date it was given, which unlocks_by_date reflects. + */ + @JsonIgnore + public Optional getPercentage() { + if (percentage == null) { + return Optional.empty(); + } + return percentage; + } + + /** + * @return Why this part of the balance is held. regular is the account's standing risk reserve; bnpl and sequra cover buy-now-pay-later settlement; preshipment_hold covers a physical order that has not shipped yet; fraud_hold is held while activity is reviewed. + */ + @JsonProperty("type") + public AccountReserveTypeType getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("hold_period_days") + private Optional _getHoldPeriodDays() { + return holdPeriodDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("percentage") + private Optional _getPercentage() { + return percentage; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountReserveType && equalTo((AccountReserveType) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountReserveType other) { + return amount.equals(other.amount) + && holdPeriodDays.equals(other.holdPeriodDays) + && percentage.equals(other.percentage) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.holdPeriodDays, this.percentage, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

Amount held for this reason, in native units, as a decimal string.

+ */ + TypeStage amount(@NotNull String amount); + + Builder from(AccountReserveType other); + } + + public interface TypeStage { + /** + *

Why this part of the balance is held. regular is the account's standing risk reserve; bnpl and sequra cover buy-now-pay-later settlement; preshipment_hold covers a physical order that has not shipped yet; fraud_hold is held while activity is reviewed.

+ */ + _FinalStage type(@NotNull AccountReserveTypeType type); + } + + public interface _FinalStage { + AccountReserveType build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Days money is currently held for this reason before it unlocks, or null when release depends on something other than time. Money already held keeps the terms it was taken under.

+ */ + _FinalStage holdPeriodDays(Optional holdPeriodDays); + + _FinalStage holdPeriodDays(Integer holdPeriodDays); + + _FinalStage holdPeriodDays(Nullable holdPeriodDays); + + /** + *

Percentage of each incoming payment currently held for this reason, or null when the reason is not a percentage of anything. Money already held keeps the release date it was given, which unlocks_by_date reflects.

+ */ + _FinalStage percentage(Optional percentage); + + _FinalStage percentage(Double percentage); + + _FinalStage percentage(Nullable percentage); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, TypeStage, _FinalStage { + private String amount; + + private AccountReserveTypeType type; + + private Optional percentage = Optional.empty(); + + private Optional holdPeriodDays = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountReserveType other) { + amount(other.getAmount()); + holdPeriodDays(other.getHoldPeriodDays()); + percentage(other.getPercentage()); + type(other.getType()); + return this; + } + + /** + *

Amount held for this reason, in native units, as a decimal string.

+ *

Amount held for this reason, in native units, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public TypeStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

Why this part of the balance is held. regular is the account's standing risk reserve; bnpl and sequra cover buy-now-pay-later settlement; preshipment_hold covers a physical order that has not shipped yet; fraud_hold is held while activity is reviewed.

+ *

Why this part of the balance is held. regular is the account's standing risk reserve; bnpl and sequra cover buy-now-pay-later settlement; preshipment_hold covers a physical order that has not shipped yet; fraud_hold is held while activity is reviewed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull AccountReserveTypeType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

Percentage of each incoming payment currently held for this reason, or null when the reason is not a percentage of anything. Money already held keeps the release date it was given, which unlocks_by_date reflects.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage percentage(Nullable percentage) { + if (percentage.isNull()) { + this.percentage = null; + } else if (percentage.isEmpty()) { + this.percentage = Optional.empty(); + } else { + this.percentage = Optional.of(percentage.get()); + } + return this; + } + + /** + *

Percentage of each incoming payment currently held for this reason, or null when the reason is not a percentage of anything. Money already held keeps the release date it was given, which unlocks_by_date reflects.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage percentage(Double percentage) { + this.percentage = Optional.ofNullable(percentage); + return this; + } + + /** + *

Percentage of each incoming payment currently held for this reason, or null when the reason is not a percentage of anything. Money already held keeps the release date it was given, which unlocks_by_date reflects.

+ */ + @java.lang.Override + @JsonSetter(value = "percentage", nulls = Nulls.SKIP) + public _FinalStage percentage(Optional percentage) { + this.percentage = percentage; + return this; + } + + /** + *

Days money is currently held for this reason before it unlocks, or null when release depends on something other than time. Money already held keeps the terms it was taken under.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage holdPeriodDays(Nullable holdPeriodDays) { + if (holdPeriodDays.isNull()) { + this.holdPeriodDays = null; + } else if (holdPeriodDays.isEmpty()) { + this.holdPeriodDays = Optional.empty(); + } else { + this.holdPeriodDays = Optional.of(holdPeriodDays.get()); + } + return this; + } + + /** + *

Days money is currently held for this reason before it unlocks, or null when release depends on something other than time. Money already held keeps the terms it was taken under.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage holdPeriodDays(Integer holdPeriodDays) { + this.holdPeriodDays = Optional.ofNullable(holdPeriodDays); + return this; + } + + /** + *

Days money is currently held for this reason before it unlocks, or null when release depends on something other than time. Money already held keeps the terms it was taken under.

+ */ + @java.lang.Override + @JsonSetter(value = "hold_period_days", nulls = Nulls.SKIP) + public _FinalStage holdPeriodDays(Optional holdPeriodDays) { + this.holdPeriodDays = holdPeriodDays; + return this; + } + + @java.lang.Override + public AccountReserveType build() { + return new AccountReserveType(amount, holdPeriodDays, percentage, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountReserveTypeType.java b/src/main/java/com/whop/api/types/AccountReserveTypeType.java new file mode 100644 index 00000000..35f9f648 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountReserveTypeType.java @@ -0,0 +1,115 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountReserveTypeType { + public static final AccountReserveTypeType SEQURA = new AccountReserveTypeType(Value.SEQURA, "sequra"); + + public static final AccountReserveTypeType PRESHIPMENT_HOLD = + new AccountReserveTypeType(Value.PRESHIPMENT_HOLD, "preshipment_hold"); + + public static final AccountReserveTypeType REGULAR = new AccountReserveTypeType(Value.REGULAR, "regular"); + + public static final AccountReserveTypeType BNPL = new AccountReserveTypeType(Value.BNPL, "bnpl"); + + public static final AccountReserveTypeType FRAUD_HOLD = new AccountReserveTypeType(Value.FRAUD_HOLD, "fraud_hold"); + + private final Value value; + + private final String string; + + AccountReserveTypeType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountReserveTypeType + && this.string.equals(((AccountReserveTypeType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SEQURA: + return visitor.visitSequra(); + case PRESHIPMENT_HOLD: + return visitor.visitPreshipmentHold(); + case REGULAR: + return visitor.visitRegular(); + case BNPL: + return visitor.visitBnpl(); + case FRAUD_HOLD: + return visitor.visitFraudHold(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountReserveTypeType valueOf(String value) { + switch (value) { + case "sequra": + return SEQURA; + case "preshipment_hold": + return PRESHIPMENT_HOLD; + case "regular": + return REGULAR; + case "bnpl": + return BNPL; + case "fraud_hold": + return FRAUD_HOLD; + default: + return new AccountReserveTypeType(Value.UNKNOWN, value); + } + } + + public enum Value { + REGULAR, + + BNPL, + + SEQURA, + + FRAUD_HOLD, + + PRESHIPMENT_HOLD, + + UNKNOWN + } + + public interface Visitor { + T visitRegular(); + + T visitBnpl(); + + T visitSequra(); + + T visitFraudHold(); + + T visitPreshipmentHold(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountReserveUnlock.java b/src/main/java/com/whop/api/types/AccountReserveUnlock.java new file mode 100644 index 00000000..11bfa954 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountReserveUnlock.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountReserveUnlock.Builder.class) +public final class AccountReserveUnlock { + private final String amount; + + private final String date; + + private final Map additionalProperties; + + private AccountReserveUnlock(String amount, String date, Map additionalProperties) { + this.amount = amount; + this.date = date; + this.additionalProperties = additionalProperties; + } + + /** + * @return Amount unlocking that day across every reason, in native units, as a decimal string. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + /** + * @return The day this money unlocks, as an ISO 8601 date. + */ + @JsonProperty("date") + public String getDate() { + return date; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountReserveUnlock && equalTo((AccountReserveUnlock) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountReserveUnlock other) { + return amount.equals(other.amount) && date.equals(other.date); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.date); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

Amount unlocking that day across every reason, in native units, as a decimal string.

+ */ + DateStage amount(@NotNull String amount); + + Builder from(AccountReserveUnlock other); + } + + public interface DateStage { + /** + *

The day this money unlocks, as an ISO 8601 date.

+ */ + _FinalStage date(@NotNull String date); + } + + public interface _FinalStage { + AccountReserveUnlock build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, DateStage, _FinalStage { + private String amount; + + private String date; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountReserveUnlock other) { + amount(other.getAmount()); + date(other.getDate()); + return this; + } + + /** + *

Amount unlocking that day across every reason, in native units, as a decimal string.

+ *

Amount unlocking that day across every reason, in native units, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public DateStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

The day this money unlocks, as an ISO 8601 date.

+ *

The day this money unlocks, as an ISO 8601 date.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("date") + public _FinalStage date(@NotNull String date) { + this.date = Objects.requireNonNull(date, "date must not be null"); + return this; + } + + @java.lang.Override + public AccountReserveUnlock build() { + return new AccountReserveUnlock(amount, date, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountResolutionCenterAutoRefundControl.java b/src/main/java/com/whop/api/types/AccountResolutionCenterAutoRefundControl.java new file mode 100644 index 00000000..e615c2e1 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountResolutionCenterAutoRefundControl.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountResolutionCenterAutoRefundControl.Builder.class) +public final class AccountResolutionCenterAutoRefundControl { + private final Optional cardThresholdUsd; + + private final Optional financingThresholdUsd; + + private final boolean locked; + + private final Optional paypalThresholdUsd; + + private final Map additionalProperties; + + private AccountResolutionCenterAutoRefundControl( + Optional cardThresholdUsd, + Optional financingThresholdUsd, + boolean locked, + Optional paypalThresholdUsd, + Map additionalProperties) { + this.cardThresholdUsd = cardThresholdUsd; + this.financingThresholdUsd = financingThresholdUsd; + this.locked = locked; + this.paypalThresholdUsd = paypalThresholdUsd; + this.additionalProperties = additionalProperties; + } + + /** + * @return Maximum card-funded resolution center case amount automatically refunded in USD. null when automatic refunds are disabled for cards. + */ + @JsonIgnore + public Optional getCardThresholdUsd() { + if (cardThresholdUsd == null) { + return Optional.empty(); + } + return cardThresholdUsd; + } + + /** + * @return Maximum financing-funded resolution center case amount automatically refunded in USD. null when automatic refunds are disabled for financing. + */ + @JsonIgnore + public Optional getFinancingThresholdUsd() { + if (financingThresholdUsd == null) { + return Optional.empty(); + } + return financingThresholdUsd; + } + + /** + * @return Whether the account owner is prevented from changing these thresholds. + */ + @JsonProperty("locked") + public boolean getLocked() { + return locked; + } + + /** + * @return Maximum PayPal-funded resolution center case amount automatically refunded in USD. null when automatic refunds are disabled for PayPal. + */ + @JsonIgnore + public Optional getPaypalThresholdUsd() { + if (paypalThresholdUsd == null) { + return Optional.empty(); + } + return paypalThresholdUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_threshold_usd") + private Optional _getCardThresholdUsd() { + return cardThresholdUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("financing_threshold_usd") + private Optional _getFinancingThresholdUsd() { + return financingThresholdUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("paypal_threshold_usd") + private Optional _getPaypalThresholdUsd() { + return paypalThresholdUsd; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountResolutionCenterAutoRefundControl + && equalTo((AccountResolutionCenterAutoRefundControl) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountResolutionCenterAutoRefundControl other) { + return cardThresholdUsd.equals(other.cardThresholdUsd) + && financingThresholdUsd.equals(other.financingThresholdUsd) + && locked == other.locked + && paypalThresholdUsd.equals(other.paypalThresholdUsd); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cardThresholdUsd, this.financingThresholdUsd, this.locked, this.paypalThresholdUsd); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LockedStage builder() { + return new Builder(); + } + + public interface LockedStage { + /** + *

Whether the account owner is prevented from changing these thresholds.

+ */ + _FinalStage locked(boolean locked); + + Builder from(AccountResolutionCenterAutoRefundControl other); + } + + public interface _FinalStage { + AccountResolutionCenterAutoRefundControl build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Maximum card-funded resolution center case amount automatically refunded in USD. null when automatic refunds are disabled for cards.

+ */ + _FinalStage cardThresholdUsd(Optional cardThresholdUsd); + + _FinalStage cardThresholdUsd(Double cardThresholdUsd); + + _FinalStage cardThresholdUsd(Nullable cardThresholdUsd); + + /** + *

Maximum financing-funded resolution center case amount automatically refunded in USD. null when automatic refunds are disabled for financing.

+ */ + _FinalStage financingThresholdUsd(Optional financingThresholdUsd); + + _FinalStage financingThresholdUsd(Double financingThresholdUsd); + + _FinalStage financingThresholdUsd(Nullable financingThresholdUsd); + + /** + *

Maximum PayPal-funded resolution center case amount automatically refunded in USD. null when automatic refunds are disabled for PayPal.

+ */ + _FinalStage paypalThresholdUsd(Optional paypalThresholdUsd); + + _FinalStage paypalThresholdUsd(Double paypalThresholdUsd); + + _FinalStage paypalThresholdUsd(Nullable paypalThresholdUsd); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LockedStage, _FinalStage { + private boolean locked; + + private Optional paypalThresholdUsd = Optional.empty(); + + private Optional financingThresholdUsd = Optional.empty(); + + private Optional cardThresholdUsd = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountResolutionCenterAutoRefundControl other) { + cardThresholdUsd(other.getCardThresholdUsd()); + financingThresholdUsd(other.getFinancingThresholdUsd()); + locked(other.getLocked()); + paypalThresholdUsd(other.getPaypalThresholdUsd()); + return this; + } + + /** + *

Whether the account owner is prevented from changing these thresholds.

+ *

Whether the account owner is prevented from changing these thresholds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("locked") + public _FinalStage locked(boolean locked) { + this.locked = locked; + return this; + } + + /** + *

Maximum PayPal-funded resolution center case amount automatically refunded in USD. null when automatic refunds are disabled for PayPal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paypalThresholdUsd(Nullable paypalThresholdUsd) { + if (paypalThresholdUsd.isNull()) { + this.paypalThresholdUsd = null; + } else if (paypalThresholdUsd.isEmpty()) { + this.paypalThresholdUsd = Optional.empty(); + } else { + this.paypalThresholdUsd = Optional.of(paypalThresholdUsd.get()); + } + return this; + } + + /** + *

Maximum PayPal-funded resolution center case amount automatically refunded in USD. null when automatic refunds are disabled for PayPal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paypalThresholdUsd(Double paypalThresholdUsd) { + this.paypalThresholdUsd = Optional.ofNullable(paypalThresholdUsd); + return this; + } + + /** + *

Maximum PayPal-funded resolution center case amount automatically refunded in USD. null when automatic refunds are disabled for PayPal.

+ */ + @java.lang.Override + @JsonSetter(value = "paypal_threshold_usd", nulls = Nulls.SKIP) + public _FinalStage paypalThresholdUsd(Optional paypalThresholdUsd) { + this.paypalThresholdUsd = paypalThresholdUsd; + return this; + } + + /** + *

Maximum financing-funded resolution center case amount automatically refunded in USD. null when automatic refunds are disabled for financing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage financingThresholdUsd(Nullable financingThresholdUsd) { + if (financingThresholdUsd.isNull()) { + this.financingThresholdUsd = null; + } else if (financingThresholdUsd.isEmpty()) { + this.financingThresholdUsd = Optional.empty(); + } else { + this.financingThresholdUsd = Optional.of(financingThresholdUsd.get()); + } + return this; + } + + /** + *

Maximum financing-funded resolution center case amount automatically refunded in USD. null when automatic refunds are disabled for financing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage financingThresholdUsd(Double financingThresholdUsd) { + this.financingThresholdUsd = Optional.ofNullable(financingThresholdUsd); + return this; + } + + /** + *

Maximum financing-funded resolution center case amount automatically refunded in USD. null when automatic refunds are disabled for financing.

+ */ + @java.lang.Override + @JsonSetter(value = "financing_threshold_usd", nulls = Nulls.SKIP) + public _FinalStage financingThresholdUsd(Optional financingThresholdUsd) { + this.financingThresholdUsd = financingThresholdUsd; + return this; + } + + /** + *

Maximum card-funded resolution center case amount automatically refunded in USD. null when automatic refunds are disabled for cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardThresholdUsd(Nullable cardThresholdUsd) { + if (cardThresholdUsd.isNull()) { + this.cardThresholdUsd = null; + } else if (cardThresholdUsd.isEmpty()) { + this.cardThresholdUsd = Optional.empty(); + } else { + this.cardThresholdUsd = Optional.of(cardThresholdUsd.get()); + } + return this; + } + + /** + *

Maximum card-funded resolution center case amount automatically refunded in USD. null when automatic refunds are disabled for cards.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardThresholdUsd(Double cardThresholdUsd) { + this.cardThresholdUsd = Optional.ofNullable(cardThresholdUsd); + return this; + } + + /** + *

Maximum card-funded resolution center case amount automatically refunded in USD. null when automatic refunds are disabled for cards.

+ */ + @java.lang.Override + @JsonSetter(value = "card_threshold_usd", nulls = Nulls.SKIP) + public _FinalStage cardThresholdUsd(Optional cardThresholdUsd) { + this.cardThresholdUsd = cardThresholdUsd; + return this; + } + + @java.lang.Override + public AccountResolutionCenterAutoRefundControl build() { + return new AccountResolutionCenterAutoRefundControl( + cardThresholdUsd, financingThresholdUsd, locked, paypalThresholdUsd, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountSocialLink.java b/src/main/java/com/whop/api/types/AccountSocialLink.java new file mode 100644 index 00000000..17144c94 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountSocialLink.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountSocialLink.Builder.class) +public final class AccountSocialLink { + private final String id; + + private final Optional title; + + private final String url; + + private final AccountSocialLinkWebsite website; + + private final Map additionalProperties; + + private AccountSocialLink( + String id, + Optional title, + String url, + AccountSocialLinkWebsite website, + Map additionalProperties) { + this.id = id; + this.title = title; + this.url = url; + this.website = website; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the social link + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The optional display title for the social link + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The social link URL + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + /** + * @return The social platform for this link + */ + @JsonProperty("website") + public AccountSocialLinkWebsite getWebsite() { + return website; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountSocialLink && equalTo((AccountSocialLink) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountSocialLink other) { + return id.equals(other.id) + && title.equals(other.title) + && url.equals(other.url) + && website.equals(other.website); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title, this.url, this.website); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ID of the social link

+ */ + UrlStage id(@NotNull String id); + + Builder from(AccountSocialLink other); + } + + public interface UrlStage { + /** + *

The social link URL

+ */ + WebsiteStage url(@NotNull String url); + } + + public interface WebsiteStage { + /** + *

The social platform for this link

+ */ + _FinalStage website(@NotNull AccountSocialLinkWebsite website); + } + + public interface _FinalStage { + AccountSocialLink build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The optional display title for the social link

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UrlStage, WebsiteStage, _FinalStage { + private String id; + + private String url; + + private AccountSocialLinkWebsite website; + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountSocialLink other) { + id(other.getId()); + title(other.getTitle()); + url(other.getUrl()); + website(other.getWebsite()); + return this; + } + + /** + *

The ID of the social link

+ *

The ID of the social link

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UrlStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The social link URL

+ *

The social link URL

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public WebsiteStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + /** + *

The social platform for this link

+ *

The social platform for this link

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("website") + public _FinalStage website(@NotNull AccountSocialLinkWebsite website) { + this.website = Objects.requireNonNull(website, "website must not be null"); + return this; + } + + /** + *

The optional display title for the social link

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

The optional display title for the social link

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The optional display title for the social link

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + @java.lang.Override + public AccountSocialLink build() { + return new AccountSocialLink(id, title, url, website, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountSocialLinkWebsite.java b/src/main/java/com/whop/api/types/AccountSocialLinkWebsite.java new file mode 100644 index 00000000..9b7a576d --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountSocialLinkWebsite.java @@ -0,0 +1,154 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountSocialLinkWebsite { + public static final AccountSocialLinkWebsite INSTAGRAM = new AccountSocialLinkWebsite(Value.INSTAGRAM, "instagram"); + + public static final AccountSocialLinkWebsite WEBSITE = new AccountSocialLinkWebsite(Value.WEBSITE, "website"); + + public static final AccountSocialLinkWebsite TWITCH = new AccountSocialLinkWebsite(Value.TWITCH, "twitch"); + + public static final AccountSocialLinkWebsite FACEBOOK = new AccountSocialLinkWebsite(Value.FACEBOOK, "facebook"); + + public static final AccountSocialLinkWebsite YOUTUBE = new AccountSocialLinkWebsite(Value.YOUTUBE, "youtube"); + + public static final AccountSocialLinkWebsite CUSTOM = new AccountSocialLinkWebsite(Value.CUSTOM, "custom"); + + public static final AccountSocialLinkWebsite LINKEDIN = new AccountSocialLinkWebsite(Value.LINKEDIN, "linkedin"); + + public static final AccountSocialLinkWebsite X = new AccountSocialLinkWebsite(Value.X, "x"); + + public static final AccountSocialLinkWebsite TIKTOK = new AccountSocialLinkWebsite(Value.TIKTOK, "tiktok"); + + private final Value value; + + private final String string; + + AccountSocialLinkWebsite(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountSocialLinkWebsite + && this.string.equals(((AccountSocialLinkWebsite) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTAGRAM: + return visitor.visitInstagram(); + case WEBSITE: + return visitor.visitWebsite(); + case TWITCH: + return visitor.visitTwitch(); + case FACEBOOK: + return visitor.visitFacebook(); + case YOUTUBE: + return visitor.visitYoutube(); + case CUSTOM: + return visitor.visitCustom(); + case LINKEDIN: + return visitor.visitLinkedin(); + case X: + return visitor.visitX(); + case TIKTOK: + return visitor.visitTiktok(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountSocialLinkWebsite valueOf(String value) { + switch (value) { + case "instagram": + return INSTAGRAM; + case "website": + return WEBSITE; + case "twitch": + return TWITCH; + case "facebook": + return FACEBOOK; + case "youtube": + return YOUTUBE; + case "custom": + return CUSTOM; + case "linkedin": + return LINKEDIN; + case "x": + return X; + case "tiktok": + return TIKTOK; + default: + return new AccountSocialLinkWebsite(Value.UNKNOWN, value); + } + } + + public enum Value { + X, + + INSTAGRAM, + + FACEBOOK, + + TIKTOK, + + YOUTUBE, + + LINKEDIN, + + TWITCH, + + WEBSITE, + + CUSTOM, + + UNKNOWN + } + + public interface Visitor { + T visitX(); + + T visitInstagram(); + + T visitFacebook(); + + T visitTiktok(); + + T visitYoutube(); + + T visitLinkedin(); + + T visitTwitch(); + + T visitWebsite(); + + T visitCustom(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountStorePageConfig.java b/src/main/java/com/whop/api/types/AccountStorePageConfig.java new file mode 100644 index 00000000..016654d3 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountStorePageConfig.java @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountStorePageConfig.Builder.class) +public final class AccountStorePageConfig { + private final Optional accentColor; + + private final Optional layout; + + private final Optional profileVariant; + + private final boolean whopAffiliateLink; + + private final Map additionalProperties; + + private AccountStorePageConfig( + Optional accentColor, + Optional layout, + Optional profileVariant, + boolean whopAffiliateLink, + Map additionalProperties) { + this.accentColor = accentColor; + this.layout = layout; + this.profileVariant = profileVariant; + this.whopAffiliateLink = whopAffiliateLink; + this.additionalProperties = additionalProperties; + } + + /** + * @return Accent color used on the account store page. + */ + @JsonIgnore + public Optional getAccentColor() { + if (accentColor == null) { + return Optional.empty(); + } + return accentColor; + } + + /** + * @return Layout used on the account store page. + */ + @JsonIgnore + public Optional getLayout() { + if (layout == null) { + return Optional.empty(); + } + return layout; + } + + /** + * @return Profile presentation used on the account store page. + */ + @JsonIgnore + public Optional getProfileVariant() { + if (profileVariant == null) { + return Optional.empty(); + } + return profileVariant; + } + + /** + * @return Whether the account store page shows a Whop affiliate link. + */ + @JsonProperty("whop_affiliate_link") + public boolean getWhopAffiliateLink() { + return whopAffiliateLink; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("accent_color") + private Optional _getAccentColor() { + return accentColor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("layout") + private Optional _getLayout() { + return layout; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("profile_variant") + private Optional _getProfileVariant() { + return profileVariant; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountStorePageConfig && equalTo((AccountStorePageConfig) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountStorePageConfig other) { + return accentColor.equals(other.accentColor) + && layout.equals(other.layout) + && profileVariant.equals(other.profileVariant) + && whopAffiliateLink == other.whopAffiliateLink; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accentColor, this.layout, this.profileVariant, this.whopAffiliateLink); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static WhopAffiliateLinkStage builder() { + return new Builder(); + } + + public interface WhopAffiliateLinkStage { + /** + *

Whether the account store page shows a Whop affiliate link.

+ */ + _FinalStage whopAffiliateLink(boolean whopAffiliateLink); + + Builder from(AccountStorePageConfig other); + } + + public interface _FinalStage { + AccountStorePageConfig build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Accent color used on the account store page.

+ */ + _FinalStage accentColor(Optional accentColor); + + _FinalStage accentColor(AccountStorePageConfigAccentColor accentColor); + + _FinalStage accentColor(Nullable accentColor); + + /** + *

Layout used on the account store page.

+ */ + _FinalStage layout(Optional layout); + + _FinalStage layout(AccountStorePageConfigLayout layout); + + _FinalStage layout(Nullable layout); + + /** + *

Profile presentation used on the account store page.

+ */ + _FinalStage profileVariant(Optional profileVariant); + + _FinalStage profileVariant(AccountStorePageConfigProfileVariant profileVariant); + + _FinalStage profileVariant(Nullable profileVariant); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements WhopAffiliateLinkStage, _FinalStage { + private boolean whopAffiliateLink; + + private Optional profileVariant = Optional.empty(); + + private Optional layout = Optional.empty(); + + private Optional accentColor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountStorePageConfig other) { + accentColor(other.getAccentColor()); + layout(other.getLayout()); + profileVariant(other.getProfileVariant()); + whopAffiliateLink(other.getWhopAffiliateLink()); + return this; + } + + /** + *

Whether the account store page shows a Whop affiliate link.

+ *

Whether the account store page shows a Whop affiliate link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("whop_affiliate_link") + public _FinalStage whopAffiliateLink(boolean whopAffiliateLink) { + this.whopAffiliateLink = whopAffiliateLink; + return this; + } + + /** + *

Profile presentation used on the account store page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profileVariant(Nullable profileVariant) { + if (profileVariant.isNull()) { + this.profileVariant = null; + } else if (profileVariant.isEmpty()) { + this.profileVariant = Optional.empty(); + } else { + this.profileVariant = Optional.of(profileVariant.get()); + } + return this; + } + + /** + *

Profile presentation used on the account store page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profileVariant(AccountStorePageConfigProfileVariant profileVariant) { + this.profileVariant = Optional.ofNullable(profileVariant); + return this; + } + + /** + *

Profile presentation used on the account store page.

+ */ + @java.lang.Override + @JsonSetter(value = "profile_variant", nulls = Nulls.SKIP) + public _FinalStage profileVariant(Optional profileVariant) { + this.profileVariant = profileVariant; + return this; + } + + /** + *

Layout used on the account store page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage layout(Nullable layout) { + if (layout.isNull()) { + this.layout = null; + } else if (layout.isEmpty()) { + this.layout = Optional.empty(); + } else { + this.layout = Optional.of(layout.get()); + } + return this; + } + + /** + *

Layout used on the account store page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage layout(AccountStorePageConfigLayout layout) { + this.layout = Optional.ofNullable(layout); + return this; + } + + /** + *

Layout used on the account store page.

+ */ + @java.lang.Override + @JsonSetter(value = "layout", nulls = Nulls.SKIP) + public _FinalStage layout(Optional layout) { + this.layout = layout; + return this; + } + + /** + *

Accent color used on the account store page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accentColor(Nullable accentColor) { + if (accentColor.isNull()) { + this.accentColor = null; + } else if (accentColor.isEmpty()) { + this.accentColor = Optional.empty(); + } else { + this.accentColor = Optional.of(accentColor.get()); + } + return this; + } + + /** + *

Accent color used on the account store page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accentColor(AccountStorePageConfigAccentColor accentColor) { + this.accentColor = Optional.ofNullable(accentColor); + return this; + } + + /** + *

Accent color used on the account store page.

+ */ + @java.lang.Override + @JsonSetter(value = "accent_color", nulls = Nulls.SKIP) + public _FinalStage accentColor(Optional accentColor) { + this.accentColor = accentColor; + return this; + } + + @java.lang.Override + public AccountStorePageConfig build() { + return new AccountStorePageConfig( + accentColor, layout, profileVariant, whopAffiliateLink, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountStorePageConfigAccentColor.java b/src/main/java/com/whop/api/types/AccountStorePageConfigAccentColor.java new file mode 100644 index 00000000..b16d49c8 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountStorePageConfigAccentColor.java @@ -0,0 +1,370 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountStorePageConfigAccentColor { + public static final AccountStorePageConfigAccentColor PLUM = + new AccountStorePageConfigAccentColor(Value.PLUM, "plum"); + + public static final AccountStorePageConfigAccentColor BRONZE = + new AccountStorePageConfigAccentColor(Value.BRONZE, "bronze"); + + public static final AccountStorePageConfigAccentColor GOLD = + new AccountStorePageConfigAccentColor(Value.GOLD, "gold"); + + public static final AccountStorePageConfigAccentColor YELLOW = + new AccountStorePageConfigAccentColor(Value.YELLOW, "yellow"); + + public static final AccountStorePageConfigAccentColor IRIS = + new AccountStorePageConfigAccentColor(Value.IRIS, "iris"); + + public static final AccountStorePageConfigAccentColor JADE = + new AccountStorePageConfigAccentColor(Value.JADE, "jade"); + + public static final AccountStorePageConfigAccentColor MINT = + new AccountStorePageConfigAccentColor(Value.MINT, "mint"); + + public static final AccountStorePageConfigAccentColor LIME = + new AccountStorePageConfigAccentColor(Value.LIME, "lime"); + + public static final AccountStorePageConfigAccentColor SKY = new AccountStorePageConfigAccentColor(Value.SKY, "sky"); + + public static final AccountStorePageConfigAccentColor GRAY = + new AccountStorePageConfigAccentColor(Value.GRAY, "gray"); + + public static final AccountStorePageConfigAccentColor MAGENTA = + new AccountStorePageConfigAccentColor(Value.MAGENTA, "magenta"); + + public static final AccountStorePageConfigAccentColor CYAN = + new AccountStorePageConfigAccentColor(Value.CYAN, "cyan"); + + public static final AccountStorePageConfigAccentColor BROWN = + new AccountStorePageConfigAccentColor(Value.BROWN, "brown"); + + public static final AccountStorePageConfigAccentColor BLUE = + new AccountStorePageConfigAccentColor(Value.BLUE, "blue"); + + public static final AccountStorePageConfigAccentColor VIOLET = + new AccountStorePageConfigAccentColor(Value.VIOLET, "violet"); + + public static final AccountStorePageConfigAccentColor GRASS = + new AccountStorePageConfigAccentColor(Value.GRASS, "grass"); + + public static final AccountStorePageConfigAccentColor GREEN = + new AccountStorePageConfigAccentColor(Value.GREEN, "green"); + + public static final AccountStorePageConfigAccentColor PINK = + new AccountStorePageConfigAccentColor(Value.PINK, "pink"); + + public static final AccountStorePageConfigAccentColor ORANGE = + new AccountStorePageConfigAccentColor(Value.ORANGE, "orange"); + + public static final AccountStorePageConfigAccentColor TEAL = + new AccountStorePageConfigAccentColor(Value.TEAL, "teal"); + + public static final AccountStorePageConfigAccentColor CRIMSON = + new AccountStorePageConfigAccentColor(Value.CRIMSON, "crimson"); + + public static final AccountStorePageConfigAccentColor INDIGO = + new AccountStorePageConfigAccentColor(Value.INDIGO, "indigo"); + + public static final AccountStorePageConfigAccentColor RUBY = + new AccountStorePageConfigAccentColor(Value.RUBY, "ruby"); + + public static final AccountStorePageConfigAccentColor RED = new AccountStorePageConfigAccentColor(Value.RED, "red"); + + public static final AccountStorePageConfigAccentColor AMBER = + new AccountStorePageConfigAccentColor(Value.AMBER, "amber"); + + public static final AccountStorePageConfigAccentColor PURPLE = + new AccountStorePageConfigAccentColor(Value.PURPLE, "purple"); + + public static final AccountStorePageConfigAccentColor LEMON = + new AccountStorePageConfigAccentColor(Value.LEMON, "lemon"); + + public static final AccountStorePageConfigAccentColor TOMATO = + new AccountStorePageConfigAccentColor(Value.TOMATO, "tomato"); + + private final Value value; + + private final String string; + + AccountStorePageConfigAccentColor(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountStorePageConfigAccentColor + && this.string.equals(((AccountStorePageConfigAccentColor) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PLUM: + return visitor.visitPlum(); + case BRONZE: + return visitor.visitBronze(); + case GOLD: + return visitor.visitGold(); + case YELLOW: + return visitor.visitYellow(); + case IRIS: + return visitor.visitIris(); + case JADE: + return visitor.visitJade(); + case MINT: + return visitor.visitMint(); + case LIME: + return visitor.visitLime(); + case SKY: + return visitor.visitSky(); + case GRAY: + return visitor.visitGray(); + case MAGENTA: + return visitor.visitMagenta(); + case CYAN: + return visitor.visitCyan(); + case BROWN: + return visitor.visitBrown(); + case BLUE: + return visitor.visitBlue(); + case VIOLET: + return visitor.visitViolet(); + case GRASS: + return visitor.visitGrass(); + case GREEN: + return visitor.visitGreen(); + case PINK: + return visitor.visitPink(); + case ORANGE: + return visitor.visitOrange(); + case TEAL: + return visitor.visitTeal(); + case CRIMSON: + return visitor.visitCrimson(); + case INDIGO: + return visitor.visitIndigo(); + case RUBY: + return visitor.visitRuby(); + case RED: + return visitor.visitRed(); + case AMBER: + return visitor.visitAmber(); + case PURPLE: + return visitor.visitPurple(); + case LEMON: + return visitor.visitLemon(); + case TOMATO: + return visitor.visitTomato(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountStorePageConfigAccentColor valueOf(String value) { + switch (value) { + case "plum": + return PLUM; + case "bronze": + return BRONZE; + case "gold": + return GOLD; + case "yellow": + return YELLOW; + case "iris": + return IRIS; + case "jade": + return JADE; + case "mint": + return MINT; + case "lime": + return LIME; + case "sky": + return SKY; + case "gray": + return GRAY; + case "magenta": + return MAGENTA; + case "cyan": + return CYAN; + case "brown": + return BROWN; + case "blue": + return BLUE; + case "violet": + return VIOLET; + case "grass": + return GRASS; + case "green": + return GREEN; + case "pink": + return PINK; + case "orange": + return ORANGE; + case "teal": + return TEAL; + case "crimson": + return CRIMSON; + case "indigo": + return INDIGO; + case "ruby": + return RUBY; + case "red": + return RED; + case "amber": + return AMBER; + case "purple": + return PURPLE; + case "lemon": + return LEMON; + case "tomato": + return TOMATO; + default: + return new AccountStorePageConfigAccentColor(Value.UNKNOWN, value); + } + } + + public enum Value { + RUBY, + + TOMATO, + + RED, + + CRIMSON, + + PINK, + + PLUM, + + PURPLE, + + VIOLET, + + IRIS, + + CYAN, + + TEAL, + + JADE, + + GREEN, + + GRASS, + + BROWN, + + BLUE, + + ORANGE, + + INDIGO, + + SKY, + + MINT, + + YELLOW, + + AMBER, + + LIME, + + LEMON, + + MAGENTA, + + GOLD, + + BRONZE, + + GRAY, + + UNKNOWN + } + + public interface Visitor { + T visitRuby(); + + T visitTomato(); + + T visitRed(); + + T visitCrimson(); + + T visitPink(); + + T visitPlum(); + + T visitPurple(); + + T visitViolet(); + + T visitIris(); + + T visitCyan(); + + T visitTeal(); + + T visitJade(); + + T visitGreen(); + + T visitGrass(); + + T visitBrown(); + + T visitBlue(); + + T visitOrange(); + + T visitIndigo(); + + T visitSky(); + + T visitMint(); + + T visitYellow(); + + T visitAmber(); + + T visitLime(); + + T visitLemon(); + + T visitMagenta(); + + T visitGold(); + + T visitBronze(); + + T visitGray(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountStorePageConfigLayout.java b/src/main/java/com/whop/api/types/AccountStorePageConfigLayout.java new file mode 100644 index 00000000..e9e6fb08 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountStorePageConfigLayout.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountStorePageConfigLayout { + public static final AccountStorePageConfigLayout FEATURED = + new AccountStorePageConfigLayout(Value.FEATURED, "featured"); + + public static final AccountStorePageConfigLayout COMPACT = + new AccountStorePageConfigLayout(Value.COMPACT, "compact"); + + private final Value value; + + private final String string; + + AccountStorePageConfigLayout(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountStorePageConfigLayout + && this.string.equals(((AccountStorePageConfigLayout) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FEATURED: + return visitor.visitFeatured(); + case COMPACT: + return visitor.visitCompact(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountStorePageConfigLayout valueOf(String value) { + switch (value) { + case "featured": + return FEATURED; + case "compact": + return COMPACT; + default: + return new AccountStorePageConfigLayout(Value.UNKNOWN, value); + } + } + + public enum Value { + FEATURED, + + COMPACT, + + UNKNOWN + } + + public interface Visitor { + T visitFeatured(); + + T visitCompact(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountStorePageConfigProfileVariant.java b/src/main/java/com/whop/api/types/AccountStorePageConfigProfileVariant.java new file mode 100644 index 00000000..1e2b2976 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountStorePageConfigProfileVariant.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountStorePageConfigProfileVariant { + public static final AccountStorePageConfigProfileVariant PERSONAL = + new AccountStorePageConfigProfileVariant(Value.PERSONAL, "personal"); + + public static final AccountStorePageConfigProfileVariant BUSINESS = + new AccountStorePageConfigProfileVariant(Value.BUSINESS, "business"); + + private final Value value; + + private final String string; + + AccountStorePageConfigProfileVariant(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountStorePageConfigProfileVariant + && this.string.equals(((AccountStorePageConfigProfileVariant) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PERSONAL: + return visitor.visitPersonal(); + case BUSINESS: + return visitor.visitBusiness(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountStorePageConfigProfileVariant valueOf(String value) { + switch (value) { + case "personal": + return PERSONAL; + case "business": + return BUSINESS; + default: + return new AccountStorePageConfigProfileVariant(Value.UNKNOWN, value); + } + } + + public enum Value { + PERSONAL, + + BUSINESS, + + UNKNOWN + } + + public interface Visitor { + T visitPersonal(); + + T visitBusiness(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountSummary.java b/src/main/java/com/whop/api/types/AccountSummary.java new file mode 100644 index 00000000..0dc67e80 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountSummary.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountSummary.Builder.class) +public final class AccountSummary { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private AccountSummary(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account display name. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountSummary && equalTo((AccountSummary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountSummary other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID, prefixed biz_.

+ */ + TitleStage id(@NotNull String id); + + Builder from(AccountSummary other); + } + + public interface TitleStage { + /** + *

Account display name.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + AccountSummary build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountSummary other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ *

Account ID, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account display name.

+ *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public AccountSummary build() { + return new AccountSummary(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountTaxIdentifier.java b/src/main/java/com/whop/api/types/AccountTaxIdentifier.java new file mode 100644 index 00000000..54fdd277 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountTaxIdentifier.java @@ -0,0 +1,199 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountTaxIdentifier.Builder.class) +public final class AccountTaxIdentifier { + private final String id; + + private final AccountTaxIdentifierTaxIdType taxIdType; + + private final String taxIdValue; + + private final Map additionalProperties; + + private AccountTaxIdentifier( + String id, + AccountTaxIdentifierTaxIdType taxIdType, + String taxIdValue, + Map additionalProperties) { + this.id = id; + this.taxIdType = taxIdType; + this.taxIdValue = taxIdValue; + this.additionalProperties = additionalProperties; + } + + /** + * @return Tax identifier ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Tax ID type. + */ + @JsonProperty("tax_id_type") + public AccountTaxIdentifierTaxIdType getTaxIdType() { + return taxIdType; + } + + /** + * @return Tax ID value. + */ + @JsonProperty("tax_id_value") + public String getTaxIdValue() { + return taxIdValue; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountTaxIdentifier && equalTo((AccountTaxIdentifier) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountTaxIdentifier other) { + return id.equals(other.id) && taxIdType.equals(other.taxIdType) && taxIdValue.equals(other.taxIdValue); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.taxIdType, this.taxIdValue); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Tax identifier ID.

+ */ + TaxIdTypeStage id(@NotNull String id); + + Builder from(AccountTaxIdentifier other); + } + + public interface TaxIdTypeStage { + /** + *

Tax ID type.

+ */ + TaxIdValueStage taxIdType(@NotNull AccountTaxIdentifierTaxIdType taxIdType); + } + + public interface TaxIdValueStage { + /** + *

Tax ID value.

+ */ + _FinalStage taxIdValue(@NotNull String taxIdValue); + } + + public interface _FinalStage { + AccountTaxIdentifier build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TaxIdTypeStage, TaxIdValueStage, _FinalStage { + private String id; + + private AccountTaxIdentifierTaxIdType taxIdType; + + private String taxIdValue; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountTaxIdentifier other) { + id(other.getId()); + taxIdType(other.getTaxIdType()); + taxIdValue(other.getTaxIdValue()); + return this; + } + + /** + *

Tax identifier ID.

+ *

Tax identifier ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TaxIdTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Tax ID type.

+ *

Tax ID type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tax_id_type") + public TaxIdValueStage taxIdType(@NotNull AccountTaxIdentifierTaxIdType taxIdType) { + this.taxIdType = Objects.requireNonNull(taxIdType, "taxIdType must not be null"); + return this; + } + + /** + *

Tax ID value.

+ *

Tax ID value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tax_id_value") + public _FinalStage taxIdValue(@NotNull String taxIdValue) { + this.taxIdValue = Objects.requireNonNull(taxIdValue, "taxIdValue must not be null"); + return this; + } + + @java.lang.Override + public AccountTaxIdentifier build() { + return new AccountTaxIdentifier(id, taxIdType, taxIdValue, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountTaxIdentifierTaxIdType.java b/src/main/java/com/whop/api/types/AccountTaxIdentifierTaxIdType.java new file mode 100644 index 00000000..e7dea9ed --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountTaxIdentifierTaxIdType.java @@ -0,0 +1,1303 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountTaxIdentifierTaxIdType { + public static final AccountTaxIdentifierTaxIdType TW_VAT = + new AccountTaxIdentifierTaxIdType(Value.TW_VAT, "tw_vat"); + + public static final AccountTaxIdentifierTaxIdType VE_RIF = + new AccountTaxIdentifierTaxIdType(Value.VE_RIF, "ve_rif"); + + public static final AccountTaxIdentifierTaxIdType KR_BRN = + new AccountTaxIdentifierTaxIdType(Value.KR_BRN, "kr_brn"); + + public static final AccountTaxIdentifierTaxIdType SN_NINEA = + new AccountTaxIdentifierTaxIdType(Value.SN_NINEA, "sn_ninea"); + + public static final AccountTaxIdentifierTaxIdType AU_ABN = + new AccountTaxIdentifierTaxIdType(Value.AU_ABN, "au_abn"); + + public static final AccountTaxIdentifierTaxIdType MY_SST = + new AccountTaxIdentifierTaxIdType(Value.MY_SST, "my_sst"); + + public static final AccountTaxIdentifierTaxIdType EU_VAT = + new AccountTaxIdentifierTaxIdType(Value.EU_VAT, "eu_vat"); + + public static final AccountTaxIdentifierTaxIdType IN_GST = + new AccountTaxIdentifierTaxIdType(Value.IN_GST, "in_gst"); + + public static final AccountTaxIdentifierTaxIdType CA_QST = + new AccountTaxIdentifierTaxIdType(Value.CA_QST, "ca_qst"); + + public static final AccountTaxIdentifierTaxIdType MA_VAT = + new AccountTaxIdentifierTaxIdType(Value.MA_VAT, "ma_vat"); + + public static final AccountTaxIdentifierTaxIdType MK_VAT = + new AccountTaxIdentifierTaxIdType(Value.MK_VAT, "mk_vat"); + + public static final AccountTaxIdentifierTaxIdType UA_VAT = + new AccountTaxIdentifierTaxIdType(Value.UA_VAT, "ua_vat"); + + public static final AccountTaxIdentifierTaxIdType CN_TIN = + new AccountTaxIdentifierTaxIdType(Value.CN_TIN, "cn_tin"); + + public static final AccountTaxIdentifierTaxIdType MX_RFC = + new AccountTaxIdentifierTaxIdType(Value.MX_RFC, "mx_rfc"); + + public static final AccountTaxIdentifierTaxIdType BY_TIN = + new AccountTaxIdentifierTaxIdType(Value.BY_TIN, "by_tin"); + + public static final AccountTaxIdentifierTaxIdType CA_PST_BC = + new AccountTaxIdentifierTaxIdType(Value.CA_PST_BC, "ca_pst_bc"); + + public static final AccountTaxIdentifierTaxIdType ID_NPWP = + new AccountTaxIdentifierTaxIdType(Value.ID_NPWP, "id_npwp"); + + public static final AccountTaxIdentifierTaxIdType PH_TIN = + new AccountTaxIdentifierTaxIdType(Value.PH_TIN, "ph_tin"); + + public static final AccountTaxIdentifierTaxIdType AE_TRN = + new AccountTaxIdentifierTaxIdType(Value.AE_TRN, "ae_trn"); + + public static final AccountTaxIdentifierTaxIdType EC_RUC = + new AccountTaxIdentifierTaxIdType(Value.EC_RUC, "ec_ruc"); + + public static final AccountTaxIdentifierTaxIdType XI_VAT = + new AccountTaxIdentifierTaxIdType(Value.XI_VAT, "xi_vat"); + + public static final AccountTaxIdentifierTaxIdType DE_STN = + new AccountTaxIdentifierTaxIdType(Value.DE_STN, "de_stn"); + + public static final AccountTaxIdentifierTaxIdType US_EIN = + new AccountTaxIdentifierTaxIdType(Value.US_EIN, "us_ein"); + + public static final AccountTaxIdentifierTaxIdType CM_NIU = + new AccountTaxIdentifierTaxIdType(Value.CM_NIU, "cm_niu"); + + public static final AccountTaxIdentifierTaxIdType ET_TIN = + new AccountTaxIdentifierTaxIdType(Value.ET_TIN, "et_tin"); + + public static final AccountTaxIdentifierTaxIdType IS_VAT = + new AccountTaxIdentifierTaxIdType(Value.IS_VAT, "is_vat"); + + public static final AccountTaxIdentifierTaxIdType MY_FRP = + new AccountTaxIdentifierTaxIdType(Value.MY_FRP, "my_frp"); + + public static final AccountTaxIdentifierTaxIdType SG_UEN = + new AccountTaxIdentifierTaxIdType(Value.SG_UEN, "sg_uen"); + + public static final AccountTaxIdentifierTaxIdType HU_TIN = + new AccountTaxIdentifierTaxIdType(Value.HU_TIN, "hu_tin"); + + public static final AccountTaxIdentifierTaxIdType CO_NIT = + new AccountTaxIdentifierTaxIdType(Value.CO_NIT, "co_nit"); + + public static final AccountTaxIdentifierTaxIdType JP_CN = new AccountTaxIdentifierTaxIdType(Value.JP_CN, "jp_cn"); + + public static final AccountTaxIdentifierTaxIdType MY_ITN = + new AccountTaxIdentifierTaxIdType(Value.MY_ITN, "my_itn"); + + public static final AccountTaxIdentifierTaxIdType RU_KPP = + new AccountTaxIdentifierTaxIdType(Value.RU_KPP, "ru_kpp"); + + public static final AccountTaxIdentifierTaxIdType KE_PIN = + new AccountTaxIdentifierTaxIdType(Value.KE_PIN, "ke_pin"); + + public static final AccountTaxIdentifierTaxIdType AR_CUIT = + new AccountTaxIdentifierTaxIdType(Value.AR_CUIT, "ar_cuit"); + + public static final AccountTaxIdentifierTaxIdType PE_RUC = + new AccountTaxIdentifierTaxIdType(Value.PE_RUC, "pe_ruc"); + + public static final AccountTaxIdentifierTaxIdType CA_PST_MB = + new AccountTaxIdentifierTaxIdType(Value.CA_PST_MB, "ca_pst_mb"); + + public static final AccountTaxIdentifierTaxIdType AM_TIN = + new AccountTaxIdentifierTaxIdType(Value.AM_TIN, "am_tin"); + + public static final AccountTaxIdentifierTaxIdType DO_RCN = + new AccountTaxIdentifierTaxIdType(Value.DO_RCN, "do_rcn"); + + public static final AccountTaxIdentifierTaxIdType BB_TIN = + new AccountTaxIdentifierTaxIdType(Value.BB_TIN, "bb_tin"); + + public static final AccountTaxIdentifierTaxIdType JP_TRN = + new AccountTaxIdentifierTaxIdType(Value.JP_TRN, "jp_trn"); + + public static final AccountTaxIdentifierTaxIdType HK_BR = new AccountTaxIdentifierTaxIdType(Value.HK_BR, "hk_br"); + + public static final AccountTaxIdentifierTaxIdType UZ_TIN = + new AccountTaxIdentifierTaxIdType(Value.UZ_TIN, "uz_tin"); + + public static final AccountTaxIdentifierTaxIdType ME_PIB = + new AccountTaxIdentifierTaxIdType(Value.ME_PIB, "me_pib"); + + public static final AccountTaxIdentifierTaxIdType BS_TIN = + new AccountTaxIdentifierTaxIdType(Value.BS_TIN, "bs_tin"); + + public static final AccountTaxIdentifierTaxIdType GN_NIF = + new AccountTaxIdentifierTaxIdType(Value.GN_NIF, "gn_nif"); + + public static final AccountTaxIdentifierTaxIdType KH_TIN = + new AccountTaxIdentifierTaxIdType(Value.KH_TIN, "kh_tin"); + + public static final AccountTaxIdentifierTaxIdType CD_NIF = + new AccountTaxIdentifierTaxIdType(Value.CD_NIF, "cd_nif"); + + public static final AccountTaxIdentifierTaxIdType NZ_GST = + new AccountTaxIdentifierTaxIdType(Value.NZ_GST, "nz_gst"); + + public static final AccountTaxIdentifierTaxIdType TH_VAT = + new AccountTaxIdentifierTaxIdType(Value.TH_VAT, "th_vat"); + + public static final AccountTaxIdentifierTaxIdType JP_RN = new AccountTaxIdentifierTaxIdType(Value.JP_RN, "jp_rn"); + + public static final AccountTaxIdentifierTaxIdType RU_INN = + new AccountTaxIdentifierTaxIdType(Value.RU_INN, "ru_inn"); + + public static final AccountTaxIdentifierTaxIdType SG_GST = + new AccountTaxIdentifierTaxIdType(Value.SG_GST, "sg_gst"); + + public static final AccountTaxIdentifierTaxIdType NO_VAT = + new AccountTaxIdentifierTaxIdType(Value.NO_VAT, "no_vat"); + + public static final AccountTaxIdentifierTaxIdType BA_TIN = + new AccountTaxIdentifierTaxIdType(Value.BA_TIN, "ba_tin"); + + public static final AccountTaxIdentifierTaxIdType KZ_BIN = + new AccountTaxIdentifierTaxIdType(Value.KZ_BIN, "kz_bin"); + + public static final AccountTaxIdentifierTaxIdType AL_TIN = + new AccountTaxIdentifierTaxIdType(Value.AL_TIN, "al_tin"); + + public static final AccountTaxIdentifierTaxIdType EG_TIN = + new AccountTaxIdentifierTaxIdType(Value.EG_TIN, "eg_tin"); + + public static final AccountTaxIdentifierTaxIdType NP_PAN = + new AccountTaxIdentifierTaxIdType(Value.NP_PAN, "np_pan"); + + public static final AccountTaxIdentifierTaxIdType CH_VAT = + new AccountTaxIdentifierTaxIdType(Value.CH_VAT, "ch_vat"); + + public static final AccountTaxIdentifierTaxIdType NO_VOEC = + new AccountTaxIdentifierTaxIdType(Value.NO_VOEC, "no_voec"); + + public static final AccountTaxIdentifierTaxIdType UZ_VAT = + new AccountTaxIdentifierTaxIdType(Value.UZ_VAT, "uz_vat"); + + public static final AccountTaxIdentifierTaxIdType SR_FIN = + new AccountTaxIdentifierTaxIdType(Value.SR_FIN, "sr_fin"); + + public static final AccountTaxIdentifierTaxIdType BG_UIC = + new AccountTaxIdentifierTaxIdType(Value.BG_UIC, "bg_uic"); + + public static final AccountTaxIdentifierTaxIdType AU_ARN = + new AccountTaxIdentifierTaxIdType(Value.AU_ARN, "au_arn"); + + public static final AccountTaxIdentifierTaxIdType BR_CNPJ = + new AccountTaxIdentifierTaxIdType(Value.BR_CNPJ, "br_cnpj"); + + public static final AccountTaxIdentifierTaxIdType UG_TIN = + new AccountTaxIdentifierTaxIdType(Value.UG_TIN, "ug_tin"); + + public static final AccountTaxIdentifierTaxIdType CA_PST_SK = + new AccountTaxIdentifierTaxIdType(Value.CA_PST_SK, "ca_pst_sk"); + + public static final AccountTaxIdentifierTaxIdType OM_VAT = + new AccountTaxIdentifierTaxIdType(Value.OM_VAT, "om_vat"); + + public static final AccountTaxIdentifierTaxIdType BR_CPF = + new AccountTaxIdentifierTaxIdType(Value.BR_CPF, "br_cpf"); + + public static final AccountTaxIdentifierTaxIdType MR_NIF = + new AccountTaxIdentifierTaxIdType(Value.MR_NIF, "mr_nif"); + + public static final AccountTaxIdentifierTaxIdType TR_TIN = + new AccountTaxIdentifierTaxIdType(Value.TR_TIN, "tr_tin"); + + public static final AccountTaxIdentifierTaxIdType BJ_IFU = + new AccountTaxIdentifierTaxIdType(Value.BJ_IFU, "bj_ifu"); + + public static final AccountTaxIdentifierTaxIdType ZW_TIN = + new AccountTaxIdentifierTaxIdType(Value.ZW_TIN, "zw_tin"); + + public static final AccountTaxIdentifierTaxIdType LI_VAT = + new AccountTaxIdentifierTaxIdType(Value.LI_VAT, "li_vat"); + + public static final AccountTaxIdentifierTaxIdType ZM_TIN = + new AccountTaxIdentifierTaxIdType(Value.ZM_TIN, "zm_tin"); + + public static final AccountTaxIdentifierTaxIdType SI_TIN = + new AccountTaxIdentifierTaxIdType(Value.SI_TIN, "si_tin"); + + public static final AccountTaxIdentifierTaxIdType CV_NIF = + new AccountTaxIdentifierTaxIdType(Value.CV_NIF, "cv_nif"); + + public static final AccountTaxIdentifierTaxIdType LI_UID = + new AccountTaxIdentifierTaxIdType(Value.LI_UID, "li_uid"); + + public static final AccountTaxIdentifierTaxIdType RS_PIB = + new AccountTaxIdentifierTaxIdType(Value.RS_PIB, "rs_pib"); + + public static final AccountTaxIdentifierTaxIdType IL_VAT = + new AccountTaxIdentifierTaxIdType(Value.IL_VAT, "il_vat"); + + public static final AccountTaxIdentifierTaxIdType TZ_VAT = + new AccountTaxIdentifierTaxIdType(Value.TZ_VAT, "tz_vat"); + + public static final AccountTaxIdentifierTaxIdType BH_VAT = + new AccountTaxIdentifierTaxIdType(Value.BH_VAT, "bh_vat"); + + public static final AccountTaxIdentifierTaxIdType HR_OIB = + new AccountTaxIdentifierTaxIdType(Value.HR_OIB, "hr_oib"); + + public static final AccountTaxIdentifierTaxIdType NG_TIN = + new AccountTaxIdentifierTaxIdType(Value.NG_TIN, "ng_tin"); + + public static final AccountTaxIdentifierTaxIdType ZA_VAT = + new AccountTaxIdentifierTaxIdType(Value.ZA_VAT, "za_vat"); + + public static final AccountTaxIdentifierTaxIdType AO_TIN = + new AccountTaxIdentifierTaxIdType(Value.AO_TIN, "ao_tin"); + + public static final AccountTaxIdentifierTaxIdType MD_VAT = + new AccountTaxIdentifierTaxIdType(Value.MD_VAT, "md_vat"); + + public static final AccountTaxIdentifierTaxIdType UY_RUC = + new AccountTaxIdentifierTaxIdType(Value.UY_RUC, "uy_ruc"); + + public static final AccountTaxIdentifierTaxIdType AD_NRT = + new AccountTaxIdentifierTaxIdType(Value.AD_NRT, "ad_nrt"); + + public static final AccountTaxIdentifierTaxIdType BF_IFU = + new AccountTaxIdentifierTaxIdType(Value.BF_IFU, "bf_ifu"); + + public static final AccountTaxIdentifierTaxIdType VN_TIN = + new AccountTaxIdentifierTaxIdType(Value.VN_TIN, "vn_tin"); + + public static final AccountTaxIdentifierTaxIdType CL_TIN = + new AccountTaxIdentifierTaxIdType(Value.CL_TIN, "cl_tin"); + + public static final AccountTaxIdentifierTaxIdType LA_TIN = + new AccountTaxIdentifierTaxIdType(Value.LA_TIN, "la_tin"); + + public static final AccountTaxIdentifierTaxIdType KG_TIN = + new AccountTaxIdentifierTaxIdType(Value.KG_TIN, "kg_tin"); + + public static final AccountTaxIdentifierTaxIdType CA_BN = new AccountTaxIdentifierTaxIdType(Value.CA_BN, "ca_bn"); + + public static final AccountTaxIdentifierTaxIdType SA_VAT = + new AccountTaxIdentifierTaxIdType(Value.SA_VAT, "sa_vat"); + + public static final AccountTaxIdentifierTaxIdType EU_OSS_VAT = + new AccountTaxIdentifierTaxIdType(Value.EU_OSS_VAT, "eu_oss_vat"); + + public static final AccountTaxIdentifierTaxIdType BD_BIN = + new AccountTaxIdentifierTaxIdType(Value.BD_BIN, "bd_bin"); + + public static final AccountTaxIdentifierTaxIdType SV_NIT = + new AccountTaxIdentifierTaxIdType(Value.SV_NIT, "sv_nit"); + + public static final AccountTaxIdentifierTaxIdType BO_TIN = + new AccountTaxIdentifierTaxIdType(Value.BO_TIN, "bo_tin"); + + public static final AccountTaxIdentifierTaxIdType GE_VAT = + new AccountTaxIdentifierTaxIdType(Value.GE_VAT, "ge_vat"); + + public static final AccountTaxIdentifierTaxIdType AZ_TIN = + new AccountTaxIdentifierTaxIdType(Value.AZ_TIN, "az_tin"); + + public static final AccountTaxIdentifierTaxIdType CH_UID = + new AccountTaxIdentifierTaxIdType(Value.CH_UID, "ch_uid"); + + public static final AccountTaxIdentifierTaxIdType RO_TIN = + new AccountTaxIdentifierTaxIdType(Value.RO_TIN, "ro_tin"); + + public static final AccountTaxIdentifierTaxIdType TJ_TIN = + new AccountTaxIdentifierTaxIdType(Value.TJ_TIN, "tj_tin"); + + public static final AccountTaxIdentifierTaxIdType AW_TIN = + new AccountTaxIdentifierTaxIdType(Value.AW_TIN, "aw_tin"); + + public static final AccountTaxIdentifierTaxIdType CR_TIN = + new AccountTaxIdentifierTaxIdType(Value.CR_TIN, "cr_tin"); + + public static final AccountTaxIdentifierTaxIdType GB_VAT = + new AccountTaxIdentifierTaxIdType(Value.GB_VAT, "gb_vat"); + + public static final AccountTaxIdentifierTaxIdType ES_CIF = + new AccountTaxIdentifierTaxIdType(Value.ES_CIF, "es_cif"); + + public static final AccountTaxIdentifierTaxIdType PL_NIP = + new AccountTaxIdentifierTaxIdType(Value.PL_NIP, "pl_nip"); + + public static final AccountTaxIdentifierTaxIdType GH_TIN = + new AccountTaxIdentifierTaxIdType(Value.GH_TIN, "gh_tin"); + + public static final AccountTaxIdentifierTaxIdType CA_GST_HST = + new AccountTaxIdentifierTaxIdType(Value.CA_GST_HST, "ca_gst_hst"); + + private final Value value; + + private final String string; + + AccountTaxIdentifierTaxIdType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountTaxIdentifierTaxIdType + && this.string.equals(((AccountTaxIdentifierTaxIdType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TW_VAT: + return visitor.visitTwVat(); + case VE_RIF: + return visitor.visitVeRif(); + case KR_BRN: + return visitor.visitKrBrn(); + case SN_NINEA: + return visitor.visitSnNinea(); + case AU_ABN: + return visitor.visitAuAbn(); + case MY_SST: + return visitor.visitMySst(); + case EU_VAT: + return visitor.visitEuVat(); + case IN_GST: + return visitor.visitInGst(); + case CA_QST: + return visitor.visitCaQst(); + case MA_VAT: + return visitor.visitMaVat(); + case MK_VAT: + return visitor.visitMkVat(); + case UA_VAT: + return visitor.visitUaVat(); + case CN_TIN: + return visitor.visitCnTin(); + case MX_RFC: + return visitor.visitMxRfc(); + case BY_TIN: + return visitor.visitByTin(); + case CA_PST_BC: + return visitor.visitCaPstBc(); + case ID_NPWP: + return visitor.visitIdNpwp(); + case PH_TIN: + return visitor.visitPhTin(); + case AE_TRN: + return visitor.visitAeTrn(); + case EC_RUC: + return visitor.visitEcRuc(); + case XI_VAT: + return visitor.visitXiVat(); + case DE_STN: + return visitor.visitDeStn(); + case US_EIN: + return visitor.visitUsEin(); + case CM_NIU: + return visitor.visitCmNiu(); + case ET_TIN: + return visitor.visitEtTin(); + case IS_VAT: + return visitor.visitIsVat(); + case MY_FRP: + return visitor.visitMyFrp(); + case SG_UEN: + return visitor.visitSgUen(); + case HU_TIN: + return visitor.visitHuTin(); + case CO_NIT: + return visitor.visitCoNit(); + case JP_CN: + return visitor.visitJpCn(); + case MY_ITN: + return visitor.visitMyItn(); + case RU_KPP: + return visitor.visitRuKpp(); + case KE_PIN: + return visitor.visitKePin(); + case AR_CUIT: + return visitor.visitArCuit(); + case PE_RUC: + return visitor.visitPeRuc(); + case CA_PST_MB: + return visitor.visitCaPstMb(); + case AM_TIN: + return visitor.visitAmTin(); + case DO_RCN: + return visitor.visitDoRcn(); + case BB_TIN: + return visitor.visitBbTin(); + case JP_TRN: + return visitor.visitJpTrn(); + case HK_BR: + return visitor.visitHkBr(); + case UZ_TIN: + return visitor.visitUzTin(); + case ME_PIB: + return visitor.visitMePib(); + case BS_TIN: + return visitor.visitBsTin(); + case GN_NIF: + return visitor.visitGnNif(); + case KH_TIN: + return visitor.visitKhTin(); + case CD_NIF: + return visitor.visitCdNif(); + case NZ_GST: + return visitor.visitNzGst(); + case TH_VAT: + return visitor.visitThVat(); + case JP_RN: + return visitor.visitJpRn(); + case RU_INN: + return visitor.visitRuInn(); + case SG_GST: + return visitor.visitSgGst(); + case NO_VAT: + return visitor.visitNoVat(); + case BA_TIN: + return visitor.visitBaTin(); + case KZ_BIN: + return visitor.visitKzBin(); + case AL_TIN: + return visitor.visitAlTin(); + case EG_TIN: + return visitor.visitEgTin(); + case NP_PAN: + return visitor.visitNpPan(); + case CH_VAT: + return visitor.visitChVat(); + case NO_VOEC: + return visitor.visitNoVoec(); + case UZ_VAT: + return visitor.visitUzVat(); + case SR_FIN: + return visitor.visitSrFin(); + case BG_UIC: + return visitor.visitBgUic(); + case AU_ARN: + return visitor.visitAuArn(); + case BR_CNPJ: + return visitor.visitBrCnpj(); + case UG_TIN: + return visitor.visitUgTin(); + case CA_PST_SK: + return visitor.visitCaPstSk(); + case OM_VAT: + return visitor.visitOmVat(); + case BR_CPF: + return visitor.visitBrCpf(); + case MR_NIF: + return visitor.visitMrNif(); + case TR_TIN: + return visitor.visitTrTin(); + case BJ_IFU: + return visitor.visitBjIfu(); + case ZW_TIN: + return visitor.visitZwTin(); + case LI_VAT: + return visitor.visitLiVat(); + case ZM_TIN: + return visitor.visitZmTin(); + case SI_TIN: + return visitor.visitSiTin(); + case CV_NIF: + return visitor.visitCvNif(); + case LI_UID: + return visitor.visitLiUid(); + case RS_PIB: + return visitor.visitRsPib(); + case IL_VAT: + return visitor.visitIlVat(); + case TZ_VAT: + return visitor.visitTzVat(); + case BH_VAT: + return visitor.visitBhVat(); + case HR_OIB: + return visitor.visitHrOib(); + case NG_TIN: + return visitor.visitNgTin(); + case ZA_VAT: + return visitor.visitZaVat(); + case AO_TIN: + return visitor.visitAoTin(); + case MD_VAT: + return visitor.visitMdVat(); + case UY_RUC: + return visitor.visitUyRuc(); + case AD_NRT: + return visitor.visitAdNrt(); + case BF_IFU: + return visitor.visitBfIfu(); + case VN_TIN: + return visitor.visitVnTin(); + case CL_TIN: + return visitor.visitClTin(); + case LA_TIN: + return visitor.visitLaTin(); + case KG_TIN: + return visitor.visitKgTin(); + case CA_BN: + return visitor.visitCaBn(); + case SA_VAT: + return visitor.visitSaVat(); + case EU_OSS_VAT: + return visitor.visitEuOssVat(); + case BD_BIN: + return visitor.visitBdBin(); + case SV_NIT: + return visitor.visitSvNit(); + case BO_TIN: + return visitor.visitBoTin(); + case GE_VAT: + return visitor.visitGeVat(); + case AZ_TIN: + return visitor.visitAzTin(); + case CH_UID: + return visitor.visitChUid(); + case RO_TIN: + return visitor.visitRoTin(); + case TJ_TIN: + return visitor.visitTjTin(); + case AW_TIN: + return visitor.visitAwTin(); + case CR_TIN: + return visitor.visitCrTin(); + case GB_VAT: + return visitor.visitGbVat(); + case ES_CIF: + return visitor.visitEsCif(); + case PL_NIP: + return visitor.visitPlNip(); + case GH_TIN: + return visitor.visitGhTin(); + case CA_GST_HST: + return visitor.visitCaGstHst(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountTaxIdentifierTaxIdType valueOf(String value) { + switch (value) { + case "tw_vat": + return TW_VAT; + case "ve_rif": + return VE_RIF; + case "kr_brn": + return KR_BRN; + case "sn_ninea": + return SN_NINEA; + case "au_abn": + return AU_ABN; + case "my_sst": + return MY_SST; + case "eu_vat": + return EU_VAT; + case "in_gst": + return IN_GST; + case "ca_qst": + return CA_QST; + case "ma_vat": + return MA_VAT; + case "mk_vat": + return MK_VAT; + case "ua_vat": + return UA_VAT; + case "cn_tin": + return CN_TIN; + case "mx_rfc": + return MX_RFC; + case "by_tin": + return BY_TIN; + case "ca_pst_bc": + return CA_PST_BC; + case "id_npwp": + return ID_NPWP; + case "ph_tin": + return PH_TIN; + case "ae_trn": + return AE_TRN; + case "ec_ruc": + return EC_RUC; + case "xi_vat": + return XI_VAT; + case "de_stn": + return DE_STN; + case "us_ein": + return US_EIN; + case "cm_niu": + return CM_NIU; + case "et_tin": + return ET_TIN; + case "is_vat": + return IS_VAT; + case "my_frp": + return MY_FRP; + case "sg_uen": + return SG_UEN; + case "hu_tin": + return HU_TIN; + case "co_nit": + return CO_NIT; + case "jp_cn": + return JP_CN; + case "my_itn": + return MY_ITN; + case "ru_kpp": + return RU_KPP; + case "ke_pin": + return KE_PIN; + case "ar_cuit": + return AR_CUIT; + case "pe_ruc": + return PE_RUC; + case "ca_pst_mb": + return CA_PST_MB; + case "am_tin": + return AM_TIN; + case "do_rcn": + return DO_RCN; + case "bb_tin": + return BB_TIN; + case "jp_trn": + return JP_TRN; + case "hk_br": + return HK_BR; + case "uz_tin": + return UZ_TIN; + case "me_pib": + return ME_PIB; + case "bs_tin": + return BS_TIN; + case "gn_nif": + return GN_NIF; + case "kh_tin": + return KH_TIN; + case "cd_nif": + return CD_NIF; + case "nz_gst": + return NZ_GST; + case "th_vat": + return TH_VAT; + case "jp_rn": + return JP_RN; + case "ru_inn": + return RU_INN; + case "sg_gst": + return SG_GST; + case "no_vat": + return NO_VAT; + case "ba_tin": + return BA_TIN; + case "kz_bin": + return KZ_BIN; + case "al_tin": + return AL_TIN; + case "eg_tin": + return EG_TIN; + case "np_pan": + return NP_PAN; + case "ch_vat": + return CH_VAT; + case "no_voec": + return NO_VOEC; + case "uz_vat": + return UZ_VAT; + case "sr_fin": + return SR_FIN; + case "bg_uic": + return BG_UIC; + case "au_arn": + return AU_ARN; + case "br_cnpj": + return BR_CNPJ; + case "ug_tin": + return UG_TIN; + case "ca_pst_sk": + return CA_PST_SK; + case "om_vat": + return OM_VAT; + case "br_cpf": + return BR_CPF; + case "mr_nif": + return MR_NIF; + case "tr_tin": + return TR_TIN; + case "bj_ifu": + return BJ_IFU; + case "zw_tin": + return ZW_TIN; + case "li_vat": + return LI_VAT; + case "zm_tin": + return ZM_TIN; + case "si_tin": + return SI_TIN; + case "cv_nif": + return CV_NIF; + case "li_uid": + return LI_UID; + case "rs_pib": + return RS_PIB; + case "il_vat": + return IL_VAT; + case "tz_vat": + return TZ_VAT; + case "bh_vat": + return BH_VAT; + case "hr_oib": + return HR_OIB; + case "ng_tin": + return NG_TIN; + case "za_vat": + return ZA_VAT; + case "ao_tin": + return AO_TIN; + case "md_vat": + return MD_VAT; + case "uy_ruc": + return UY_RUC; + case "ad_nrt": + return AD_NRT; + case "bf_ifu": + return BF_IFU; + case "vn_tin": + return VN_TIN; + case "cl_tin": + return CL_TIN; + case "la_tin": + return LA_TIN; + case "kg_tin": + return KG_TIN; + case "ca_bn": + return CA_BN; + case "sa_vat": + return SA_VAT; + case "eu_oss_vat": + return EU_OSS_VAT; + case "bd_bin": + return BD_BIN; + case "sv_nit": + return SV_NIT; + case "bo_tin": + return BO_TIN; + case "ge_vat": + return GE_VAT; + case "az_tin": + return AZ_TIN; + case "ch_uid": + return CH_UID; + case "ro_tin": + return RO_TIN; + case "tj_tin": + return TJ_TIN; + case "aw_tin": + return AW_TIN; + case "cr_tin": + return CR_TIN; + case "gb_vat": + return GB_VAT; + case "es_cif": + return ES_CIF; + case "pl_nip": + return PL_NIP; + case "gh_tin": + return GH_TIN; + case "ca_gst_hst": + return CA_GST_HST; + default: + return new AccountTaxIdentifierTaxIdType(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_NRT, + + AO_TIN, + + AR_CUIT, + + AL_TIN, + + AM_TIN, + + AW_TIN, + + AU_ABN, + + AU_ARN, + + EU_VAT, + + AZ_TIN, + + BS_TIN, + + BH_VAT, + + BD_BIN, + + BB_TIN, + + BY_TIN, + + BJ_IFU, + + BO_TIN, + + BA_TIN, + + BR_CNPJ, + + BR_CPF, + + BG_UIC, + + BF_IFU, + + KH_TIN, + + CM_NIU, + + CA_BN, + + CA_GST_HST, + + CA_PST_BC, + + CA_PST_MB, + + CA_PST_SK, + + CA_QST, + + CV_NIF, + + CL_TIN, + + CN_TIN, + + CO_NIT, + + CD_NIF, + + CR_TIN, + + HR_OIB, + + DO_RCN, + + EC_RUC, + + EG_TIN, + + SV_NIT, + + ET_TIN, + + EU_OSS_VAT, + + GE_VAT, + + GH_TIN, + + DE_STN, + + GB_VAT, + + GN_NIF, + + HK_BR, + + HU_TIN, + + IS_VAT, + + IN_GST, + + ID_NPWP, + + IL_VAT, + + JP_CN, + + JP_RN, + + JP_TRN, + + KZ_BIN, + + KE_PIN, + + KG_TIN, + + LA_TIN, + + LI_UID, + + LI_VAT, + + MY_FRP, + + MY_ITN, + + MY_SST, + + MR_NIF, + + MX_RFC, + + MD_VAT, + + ME_PIB, + + MA_VAT, + + NP_PAN, + + NZ_GST, + + NG_TIN, + + MK_VAT, + + NO_VAT, + + NO_VOEC, + + OM_VAT, + + PE_RUC, + + PH_TIN, + + PL_NIP, + + RO_TIN, + + RU_INN, + + RU_KPP, + + SA_VAT, + + SN_NINEA, + + RS_PIB, + + SG_GST, + + SG_UEN, + + SI_TIN, + + ZA_VAT, + + KR_BRN, + + ES_CIF, + + CH_UID, + + CH_VAT, + + TW_VAT, + + TJ_TIN, + + TZ_VAT, + + TH_VAT, + + TR_TIN, + + UG_TIN, + + UA_VAT, + + AE_TRN, + + US_EIN, + + UY_RUC, + + UZ_TIN, + + UZ_VAT, + + VE_RIF, + + VN_TIN, + + ZM_TIN, + + ZW_TIN, + + SR_FIN, + + XI_VAT, + + UNKNOWN + } + + public interface Visitor { + T visitAdNrt(); + + T visitAoTin(); + + T visitArCuit(); + + T visitAlTin(); + + T visitAmTin(); + + T visitAwTin(); + + T visitAuAbn(); + + T visitAuArn(); + + T visitEuVat(); + + T visitAzTin(); + + T visitBsTin(); + + T visitBhVat(); + + T visitBdBin(); + + T visitBbTin(); + + T visitByTin(); + + T visitBjIfu(); + + T visitBoTin(); + + T visitBaTin(); + + T visitBrCnpj(); + + T visitBrCpf(); + + T visitBgUic(); + + T visitBfIfu(); + + T visitKhTin(); + + T visitCmNiu(); + + T visitCaBn(); + + T visitCaGstHst(); + + T visitCaPstBc(); + + T visitCaPstMb(); + + T visitCaPstSk(); + + T visitCaQst(); + + T visitCvNif(); + + T visitClTin(); + + T visitCnTin(); + + T visitCoNit(); + + T visitCdNif(); + + T visitCrTin(); + + T visitHrOib(); + + T visitDoRcn(); + + T visitEcRuc(); + + T visitEgTin(); + + T visitSvNit(); + + T visitEtTin(); + + T visitEuOssVat(); + + T visitGeVat(); + + T visitGhTin(); + + T visitDeStn(); + + T visitGbVat(); + + T visitGnNif(); + + T visitHkBr(); + + T visitHuTin(); + + T visitIsVat(); + + T visitInGst(); + + T visitIdNpwp(); + + T visitIlVat(); + + T visitJpCn(); + + T visitJpRn(); + + T visitJpTrn(); + + T visitKzBin(); + + T visitKePin(); + + T visitKgTin(); + + T visitLaTin(); + + T visitLiUid(); + + T visitLiVat(); + + T visitMyFrp(); + + T visitMyItn(); + + T visitMySst(); + + T visitMrNif(); + + T visitMxRfc(); + + T visitMdVat(); + + T visitMePib(); + + T visitMaVat(); + + T visitNpPan(); + + T visitNzGst(); + + T visitNgTin(); + + T visitMkVat(); + + T visitNoVat(); + + T visitNoVoec(); + + T visitOmVat(); + + T visitPeRuc(); + + T visitPhTin(); + + T visitPlNip(); + + T visitRoTin(); + + T visitRuInn(); + + T visitRuKpp(); + + T visitSaVat(); + + T visitSnNinea(); + + T visitRsPib(); + + T visitSgGst(); + + T visitSgUen(); + + T visitSiTin(); + + T visitZaVat(); + + T visitKrBrn(); + + T visitEsCif(); + + T visitChUid(); + + T visitChVat(); + + T visitTwVat(); + + T visitTjTin(); + + T visitTzVat(); + + T visitThVat(); + + T visitTrTin(); + + T visitUgTin(); + + T visitUaVat(); + + T visitAeTrn(); + + T visitUsEin(); + + T visitUyRuc(); + + T visitUzTin(); + + T visitUzVat(); + + T visitVeRif(); + + T visitVnTin(); + + T visitZmTin(); + + T visitZwTin(); + + T visitSrFin(); + + T visitXiVat(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountTaxRemittedBy.java b/src/main/java/com/whop/api/types/AccountTaxRemittedBy.java new file mode 100644 index 00000000..4a07ea6a --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountTaxRemittedBy.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountTaxRemittedBy { + public static final AccountTaxRemittedBy SELF = new AccountTaxRemittedBy(Value.SELF, "self"); + + public static final AccountTaxRemittedBy WHOP = new AccountTaxRemittedBy(Value.WHOP, "whop"); + + public static final AccountTaxRemittedBy NONE = new AccountTaxRemittedBy(Value.NONE, "none"); + + private final Value value; + + private final String string; + + AccountTaxRemittedBy(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountTaxRemittedBy && this.string.equals(((AccountTaxRemittedBy) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF: + return visitor.visitSelf(); + case WHOP: + return visitor.visitWhop(); + case NONE: + return visitor.visitNone(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountTaxRemittedBy valueOf(String value) { + switch (value) { + case "self": + return SELF; + case "whop": + return WHOP; + case "none": + return NONE; + default: + return new AccountTaxRemittedBy(Value.UNKNOWN, value); + } + } + + public enum Value { + WHOP, + + SELF, + + NONE, + + UNKNOWN + } + + public interface Visitor { + T visitWhop(); + + T visitSelf(); + + T visitNone(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountTaxType.java b/src/main/java/com/whop/api/types/AccountTaxType.java new file mode 100644 index 00000000..3d0c6d9a --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountTaxType.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountTaxType { + public static final AccountTaxType EXCLUSIVE = new AccountTaxType(Value.EXCLUSIVE, "exclusive"); + + public static final AccountTaxType INCLUSIVE = new AccountTaxType(Value.INCLUSIVE, "inclusive"); + + private final Value value; + + private final String string; + + AccountTaxType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountTaxType && this.string.equals(((AccountTaxType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EXCLUSIVE: + return visitor.visitExclusive(); + case INCLUSIVE: + return visitor.visitInclusive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountTaxType valueOf(String value) { + switch (value) { + case "exclusive": + return EXCLUSIVE; + case "inclusive": + return INCLUSIVE; + default: + return new AccountTaxType(Value.UNKNOWN, value); + } + } + + public enum Value { + INCLUSIVE, + + EXCLUSIVE, + + UNKNOWN + } + + public interface Visitor { + T visitInclusive(); + + T visitExclusive(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountThreeDsLevel.java b/src/main/java/com/whop/api/types/AccountThreeDsLevel.java new file mode 100644 index 00000000..621b6203 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountThreeDsLevel.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountThreeDsLevel { + public static final AccountThreeDsLevel MANDATE_CHALLENGE = + new AccountThreeDsLevel(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + private final Value value; + + private final String string; + + AccountThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountThreeDsLevel && this.string.equals(((AccountThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + default: + return new AccountThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AccountWallet.java b/src/main/java/com/whop/api/types/AccountWallet.java new file mode 100644 index 00000000..35fdf7c5 --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountWallet.java @@ -0,0 +1,196 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountWallet.Builder.class) +public final class AccountWallet { + private final String address; + + private final String id; + + private final AccountWalletNetwork network; + + private final Map additionalProperties; + + private AccountWallet( + String address, String id, AccountWalletNetwork network, Map additionalProperties) { + this.address = address; + this.id = id; + this.network = network; + this.additionalProperties = additionalProperties; + } + + /** + * @return The on-chain address of the wallet + */ + @JsonProperty("address") + public String getAddress() { + return address; + } + + /** + * @return Wallet ID, prefixed wallet_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The blockchain network the wallet lives on + */ + @JsonProperty("network") + public AccountWalletNetwork getNetwork() { + return network; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountWallet && equalTo((AccountWallet) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountWallet other) { + return address.equals(other.address) && id.equals(other.id) && network.equals(other.network); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.address, this.id, this.network); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AddressStage builder() { + return new Builder(); + } + + public interface AddressStage { + /** + *

The on-chain address of the wallet

+ */ + IdStage address(@NotNull String address); + + Builder from(AccountWallet other); + } + + public interface IdStage { + /** + *

Wallet ID, prefixed wallet_.

+ */ + NetworkStage id(@NotNull String id); + } + + public interface NetworkStage { + /** + *

The blockchain network the wallet lives on

+ */ + _FinalStage network(@NotNull AccountWalletNetwork network); + } + + public interface _FinalStage { + AccountWallet build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AddressStage, IdStage, NetworkStage, _FinalStage { + private String address; + + private String id; + + private AccountWalletNetwork network; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountWallet other) { + address(other.getAddress()); + id(other.getId()); + network(other.getNetwork()); + return this; + } + + /** + *

The on-chain address of the wallet

+ *

The on-chain address of the wallet

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("address") + public IdStage address(@NotNull String address) { + this.address = Objects.requireNonNull(address, "address must not be null"); + return this; + } + + /** + *

Wallet ID, prefixed wallet_.

+ *

Wallet ID, prefixed wallet_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NetworkStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The blockchain network the wallet lives on

+ *

The blockchain network the wallet lives on

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("network") + public _FinalStage network(@NotNull AccountWalletNetwork network) { + this.network = Objects.requireNonNull(network, "network must not be null"); + return this; + } + + @java.lang.Override + public AccountWallet build() { + return new AccountWallet(address, id, network, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AccountWalletNetwork.java b/src/main/java/com/whop/api/types/AccountWalletNetwork.java new file mode 100644 index 00000000..24f9fb9f --- /dev/null +++ b/src/main/java/com/whop/api/types/AccountWalletNetwork.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AccountWalletNetwork { + public static final AccountWalletNetwork SOLANA = new AccountWalletNetwork(Value.SOLANA, "solana"); + + public static final AccountWalletNetwork ETHEREUM = new AccountWalletNetwork(Value.ETHEREUM, "ethereum"); + + public static final AccountWalletNetwork BITCOIN = new AccountWalletNetwork(Value.BITCOIN, "bitcoin"); + + private final Value value; + + private final String string; + + AccountWalletNetwork(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AccountWalletNetwork && this.string.equals(((AccountWalletNetwork) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SOLANA: + return visitor.visitSolana(); + case ETHEREUM: + return visitor.visitEthereum(); + case BITCOIN: + return visitor.visitBitcoin(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountWalletNetwork valueOf(String value) { + switch (value) { + case "solana": + return SOLANA; + case "ethereum": + return ETHEREUM; + case "bitcoin": + return BITCOIN; + default: + return new AccountWalletNetwork(Value.UNKNOWN, value); + } + } + + public enum Value { + SOLANA, + + ETHEREUM, + + BITCOIN, + + UNKNOWN + } + + public interface Visitor { + T visitSolana(); + + T visitEthereum(); + + T visitBitcoin(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Ad.java b/src/main/java/com/whop/api/types/Ad.java new file mode 100644 index 00000000..2d756272 --- /dev/null +++ b/src/main/java/com/whop/api/types/Ad.java @@ -0,0 +1,3661 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Ad.Builder.class) +public final class Ad { + private final AdEntityReference adCampaign; + + private final AdEntityReference adGroup; + + private final double addedToCartValue; + + private final double addedToCarts; + + private final Optional callToAction; + + private final double clickThroughRate; + + private final double clicks; + + private final double completedRegistrationValue; + + private final double completedRegistrations; + + private final double contactValue; + + private final double contacts; + + private final Optional costPerAddedToCart; + + private final double costPerClick; + + private final Optional costPerCompletedRegistration; + + private final Optional costPerContact; + + private final Optional costPerLead; + + private final double costPerMille; + + private final Optional costPerPurchase; + + private final Optional costPerResult; + + private final Optional costPerSchedule; + + private final Optional costPerSubmittedApplication; + + private final Optional costPerUniqueClick; + + private final Optional costPerViewedContent; + + private final String createdAt; + + private final List creatives; + + private final double customConversions; + + private final Map customEventCounts; + + private final Map customEventValues; + + private final AdDeliveryStatus deliveryStatus; + + private final List descriptions; + + private final Optional frequency; + + private final List headlines; + + private final String id; + + private final double impressions; + + private final List issues; + + private final Optional leadForm; + + private final Optional leadFormId; + + private final double leadValue; + + private final double leads; + + private final Optional messagingConfig; + + private final Optional multiAdvertiserAds; + + private final Optional postId; + + private final Optional postSource; + + private final Optional postThumbnailUrl; + + private final List primaryTexts; + + private final double purchaseValue; + + private final double purchases; + + private final double reach; + + private final Optional resultEvent; + + private final Optional resultEventName; + + private final Optional results; + + private final double returnOnAdSpend; + + private final double scheduleValue; + + private final double schedules; + + private final List socialAccounts; + + private final double spend; + + private final Optional spendCurrency; + + private final AdStatus status; + + private final double submittedApplicationValue; + + private final double submittedApplications; + + private final Optional title; + + private final Optional uniqueClickThroughRate; + + private final double uniqueClicks; + + private final String updatedAt; + + private final Optional url; + + private final Map urlParameters; + + private final double viewedContentValue; + + private final double viewedContents; + + private final Map additionalProperties; + + private Ad( + AdEntityReference adCampaign, + AdEntityReference adGroup, + double addedToCartValue, + double addedToCarts, + Optional callToAction, + double clickThroughRate, + double clicks, + double completedRegistrationValue, + double completedRegistrations, + double contactValue, + double contacts, + Optional costPerAddedToCart, + double costPerClick, + Optional costPerCompletedRegistration, + Optional costPerContact, + Optional costPerLead, + double costPerMille, + Optional costPerPurchase, + Optional costPerResult, + Optional costPerSchedule, + Optional costPerSubmittedApplication, + Optional costPerUniqueClick, + Optional costPerViewedContent, + String createdAt, + List creatives, + double customConversions, + Map customEventCounts, + Map customEventValues, + AdDeliveryStatus deliveryStatus, + List descriptions, + Optional frequency, + List headlines, + String id, + double impressions, + List issues, + Optional leadForm, + Optional leadFormId, + double leadValue, + double leads, + Optional messagingConfig, + Optional multiAdvertiserAds, + Optional postId, + Optional postSource, + Optional postThumbnailUrl, + List primaryTexts, + double purchaseValue, + double purchases, + double reach, + Optional resultEvent, + Optional resultEventName, + Optional results, + double returnOnAdSpend, + double scheduleValue, + double schedules, + List socialAccounts, + double spend, + Optional spendCurrency, + AdStatus status, + double submittedApplicationValue, + double submittedApplications, + Optional title, + Optional uniqueClickThroughRate, + double uniqueClicks, + String updatedAt, + Optional url, + Map urlParameters, + double viewedContentValue, + double viewedContents, + Map additionalProperties) { + this.adCampaign = adCampaign; + this.adGroup = adGroup; + this.addedToCartValue = addedToCartValue; + this.addedToCarts = addedToCarts; + this.callToAction = callToAction; + this.clickThroughRate = clickThroughRate; + this.clicks = clicks; + this.completedRegistrationValue = completedRegistrationValue; + this.completedRegistrations = completedRegistrations; + this.contactValue = contactValue; + this.contacts = contacts; + this.costPerAddedToCart = costPerAddedToCart; + this.costPerClick = costPerClick; + this.costPerCompletedRegistration = costPerCompletedRegistration; + this.costPerContact = costPerContact; + this.costPerLead = costPerLead; + this.costPerMille = costPerMille; + this.costPerPurchase = costPerPurchase; + this.costPerResult = costPerResult; + this.costPerSchedule = costPerSchedule; + this.costPerSubmittedApplication = costPerSubmittedApplication; + this.costPerUniqueClick = costPerUniqueClick; + this.costPerViewedContent = costPerViewedContent; + this.createdAt = createdAt; + this.creatives = creatives; + this.customConversions = customConversions; + this.customEventCounts = customEventCounts; + this.customEventValues = customEventValues; + this.deliveryStatus = deliveryStatus; + this.descriptions = descriptions; + this.frequency = frequency; + this.headlines = headlines; + this.id = id; + this.impressions = impressions; + this.issues = issues; + this.leadForm = leadForm; + this.leadFormId = leadFormId; + this.leadValue = leadValue; + this.leads = leads; + this.messagingConfig = messagingConfig; + this.multiAdvertiserAds = multiAdvertiserAds; + this.postId = postId; + this.postSource = postSource; + this.postThumbnailUrl = postThumbnailUrl; + this.primaryTexts = primaryTexts; + this.purchaseValue = purchaseValue; + this.purchases = purchases; + this.reach = reach; + this.resultEvent = resultEvent; + this.resultEventName = resultEventName; + this.results = results; + this.returnOnAdSpend = returnOnAdSpend; + this.scheduleValue = scheduleValue; + this.schedules = schedules; + this.socialAccounts = socialAccounts; + this.spend = spend; + this.spendCurrency = spendCurrency; + this.status = status; + this.submittedApplicationValue = submittedApplicationValue; + this.submittedApplications = submittedApplications; + this.title = title; + this.uniqueClickThroughRate = uniqueClickThroughRate; + this.uniqueClicks = uniqueClicks; + this.updatedAt = updatedAt; + this.url = url; + this.urlParameters = urlParameters; + this.viewedContentValue = viewedContentValue; + this.viewedContents = viewedContents; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ad campaign this ad belongs to. + */ + @JsonProperty("ad_campaign") + public AdEntityReference getAdCampaign() { + return adCampaign; + } + + /** + * @return The ad group this ad belongs to. + */ + @JsonProperty("ad_group") + public AdEntityReference getAdGroup() { + return adGroup; + } + + /** + * @return USD value attributed to add-to-cart events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("added_to_cart_value") + public double getAddedToCartValue() { + return addedToCartValue; + } + + /** + * @return Whop pixel-attributed add-to-cart events, last-click. + */ + @JsonProperty("added_to_carts") + public double getAddedToCarts() { + return addedToCarts; + } + + /** + * @return The call-to-action button shown on the ad. + */ + @JsonIgnore + public Optional getCallToAction() { + if (callToAction == null) { + return Optional.empty(); + } + return callToAction; + } + + /** + * @return Clicks divided by impressions, between 0 and 1. + */ + @JsonProperty("click_through_rate") + public double getClickThroughRate() { + return clickThroughRate; + } + + /** + * @return The number of clicks. + */ + @JsonProperty("clicks") + public double getClicks() { + return clicks; + } + + /** + * @return USD value attributed to complete-registration events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("completed_registration_value") + public double getCompletedRegistrationValue() { + return completedRegistrationValue; + } + + /** + * @return Whop pixel-attributed complete-registration events, last-click. + */ + @JsonProperty("completed_registrations") + public double getCompletedRegistrations() { + return completedRegistrations; + } + + /** + * @return USD value attributed to contact events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("contact_value") + public double getContactValue() { + return contactValue; + } + + /** + * @return Whop pixel-attributed contact events, last-click. + */ + @JsonProperty("contacts") + public double getContacts() { + return contacts; + } + + /** + * @return Spend divided by attributed add-to-cart events; null when they are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerAddedToCart() { + if (costPerAddedToCart == null) { + return Optional.empty(); + } + return costPerAddedToCart; + } + + /** + * @return Spend divided by clicks; 0 when there are no clicks. + */ + @JsonProperty("cost_per_click") + public double getCostPerClick() { + return costPerClick; + } + + /** + * @return Spend divided by attributed complete-registration events; null when they are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerCompletedRegistration() { + if (costPerCompletedRegistration == null) { + return Optional.empty(); + } + return costPerCompletedRegistration; + } + + /** + * @return Spend divided by attributed contact events; null when contacts are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerContact() { + if (costPerContact == null) { + return Optional.empty(); + } + return costPerContact; + } + + /** + * @return Spend divided by attributed leads; null when leads are not a goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerLead() { + if (costPerLead == null) { + return Optional.empty(); + } + return costPerLead; + } + + /** + * @return Spend per 1,000 impressions; 0 when there are no impressions. + */ + @JsonProperty("cost_per_mille") + public double getCostPerMille() { + return costPerMille; + } + + /** + * @return Spend divided by attributed purchases; null when purchases are not a goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerPurchase() { + if (costPerPurchase == null) { + return Optional.empty(); + } + return costPerPurchase; + } + + /** + * @return Spend divided by Whop pixel-attributed results; null when nothing Whop-attributable is being optimized for. + */ + @JsonIgnore + public Optional getCostPerResult() { + if (costPerResult == null) { + return Optional.empty(); + } + return costPerResult; + } + + /** + * @return Spend divided by attributed schedule events; null when schedules are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerSchedule() { + if (costPerSchedule == null) { + return Optional.empty(); + } + return costPerSchedule; + } + + /** + * @return Spend divided by attributed submit-application events; null when they are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerSubmittedApplication() { + if (costPerSubmittedApplication == null) { + return Optional.empty(); + } + return costPerSubmittedApplication; + } + + /** + * @return Spend divided by unique clicks; null when there are no unique clicks. + */ + @JsonIgnore + public Optional getCostPerUniqueClick() { + if (costPerUniqueClick == null) { + return Optional.empty(); + } + return costPerUniqueClick; + } + + /** + * @return Spend divided by attributed view-content events; null when they are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerViewedContent() { + if (costPerViewedContent == null) { + return Optional.empty(); + } + return costPerViewedContent; + } + + /** + * @return When the ad was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + @JsonProperty("creatives") + public List getCreatives() { + return creatives; + } + + /** + * @return Whop pixel-attributed custom (merchant-defined) conversion events, last-click, across all custom event names. + */ + @JsonProperty("custom_conversions") + public double getCustomConversions() { + return customConversions; + } + + /** + * @return Whop pixel-attributed custom conversions, keyed by your event name with its last-click count as the value. Empty when no named custom events are attributed. Custom events fired without a name are counted in custom_conversions but omitted here, so these values sum to at most custom_conversions. + */ + @JsonProperty("custom_event_counts") + public Map getCustomEventCounts() { + return customEventCounts; + } + + /** + * @return Conversion value attributed to each custom event, keyed by event name like custom_event_counts. Sums the value passed to whop.track, normalized to USD; events fired without a value contribute 0. + */ + @JsonProperty("custom_event_values") + public Map getCustomEventValues() { + return customEventValues; + } + + /** + * @return Whether the ad is delivering right now, and if not, why. When several states apply at once, the highest-precedence one is returned. + */ + @JsonProperty("delivery_status") + public AdDeliveryStatus getDeliveryStatus() { + return deliveryStatus; + } + + @JsonProperty("descriptions") + public List getDescriptions() { + return descriptions; + } + + /** + * @return Platform-reported impressions divided by reach. + */ + @JsonIgnore + public Optional getFrequency() { + if (frequency == null) { + return Optional.empty(); + } + return frequency; + } + + @JsonProperty("headlines") + public List getHeadlines() { + return headlines; + } + + /** + * @return Unique identifier for the ad, prefixed ad_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The number of impressions. + */ + @JsonProperty("impressions") + public double getImpressions() { + return impressions; + } + + @JsonProperty("issues") + public List getIssues() { + return issues; + } + + /** + * @return The instant lead form shown when someone taps this ad. null when the ad group's conversion_location is not an instant-form destination. + */ + @JsonIgnore + public Optional getLeadForm() { + if (leadForm == null) { + return Optional.empty(); + } + return leadForm; + } + + /** + * @return The ad platform's ID for the instant form the ad uses. Set when the ad references an existing form via lead_form_id, or once a form built from lead_form has been created on the platform. + */ + @JsonIgnore + public Optional getLeadFormId() { + if (leadFormId == null) { + return Optional.empty(); + } + return leadFormId; + } + + /** + * @return USD value attributed to lead events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("lead_value") + public double getLeadValue() { + return leadValue; + } + + /** + * @return Whop pixel-attributed leads, last-click. + */ + @JsonProperty("leads") + public double getLeads() { + return leads; + } + + /** + * @return Welcome message for click-to-message ads, shown when the conversation opens. null when the ad has none. + */ + @JsonIgnore + public Optional getMessagingConfig() { + if (messagingConfig == null) { + return Optional.empty(); + } + return messagingConfig; + } + + /** + * @return Whether the ad can appear alongside other advertisers' ads in the same unit. Defaults to true. + */ + @JsonProperty("multi_advertiser_ads") + public Optional getMultiAdvertiserAds() { + return multiAdvertiserAds; + } + + /** + * @return The existing post this ad promotes — a Facebook post or Instagram media ID. null when the ad uses uploaded creatives. + */ + @JsonIgnore + public Optional getPostId() { + if (postId == null) { + return Optional.empty(); + } + return postId; + } + + /** + * @return Identifies the network that owns post_id; null when the ad uses uploaded creatives. + */ + @JsonIgnore + public Optional getPostSource() { + if (postSource == null) { + return Optional.empty(); + } + return postSource; + } + + /** + * @return Preview image of the existing post this ad promotes. null for ads that use uploaded creatives, or until the post's media has been fetched from the network. + */ + @JsonIgnore + public Optional getPostThumbnailUrl() { + if (postThumbnailUrl == null) { + return Optional.empty(); + } + return postThumbnailUrl; + } + + @JsonProperty("primary_texts") + public List getPrimaryTexts() { + return primaryTexts; + } + + /** + * @return USD value of pixel-attributed purchases. + */ + @JsonProperty("purchase_value") + public double getPurchaseValue() { + return purchaseValue; + } + + /** + * @return Whop pixel-attributed purchases, last-click. + */ + @JsonProperty("purchases") + public double getPurchases() { + return purchases; + } + + /** + * @return The number of unique people who saw this. + */ + @JsonProperty("reach") + public double getReach() { + return reach; + } + + /** + * @return The Whop pixel conversion event whose attributed count represents results — the optimization goal, or the highest-volume attributed event for campaigns that budget per ad group. Null when the goal isn't a Whop-attributed event. + */ + @JsonIgnore + public Optional getResultEvent() { + if (resultEvent == null) { + return Optional.empty(); + } + return resultEvent; + } + + /** + * @return The merchant-defined event name when result_event is custom; null for the standard events. + */ + @JsonIgnore + public Optional getResultEventName() { + if (resultEventName == null) { + return Optional.empty(); + } + return resultEventName; + } + + /** + * @return The Whop pixel-attributed count behind result_event. When a campaign's ad groups optimize different goals there is no single result_event (it is null), and this is instead the sum of each ad group's own attributed results. Null when nothing Whop-attributable is being optimized for. + */ + @JsonIgnore + public Optional getResults() { + if (results == null) { + return Optional.empty(); + } + return results; + } + + /** + * @return Purchase value divided by spend, both in USD (a currency-neutral ratio); 0 when there is no spend. + */ + @JsonProperty("return_on_ad_spend") + public double getReturnOnAdSpend() { + return returnOnAdSpend; + } + + /** + * @return USD value attributed to schedule events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("schedule_value") + public double getScheduleValue() { + return scheduleValue; + } + + /** + * @return Whop pixel-attributed schedule events, last-click. + */ + @JsonProperty("schedules") + public double getSchedules() { + return schedules; + } + + @JsonProperty("social_accounts") + public List getSocialAccounts() { + return socialAccounts; + } + + /** + * @return The amount charged, in spend_currency. + */ + @JsonProperty("spend") + public double getSpend() { + return spend; + } + + /** + * @return The ISO 4217 currency code of all monetary metrics. + */ + @JsonIgnore + public Optional getSpendCurrency() { + if (spendCurrency == null) { + return Optional.empty(); + } + return spendCurrency; + } + + /** + * @return Whether the ad is enabled. active and paused are set by you; in_review and rejected come from ad review. + */ + @JsonProperty("status") + public AdStatus getStatus() { + return status; + } + + /** + * @return USD value attributed to submit-application events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("submitted_application_value") + public double getSubmittedApplicationValue() { + return submittedApplicationValue; + } + + /** + * @return Whop pixel-attributed submit-application events, last-click. + */ + @JsonProperty("submitted_applications") + public double getSubmittedApplications() { + return submittedApplications; + } + + /** + * @return Display title of the ad. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return Unique clicks divided by impressions, between 0 and 1. + */ + @JsonIgnore + public Optional getUniqueClickThroughRate() { + if (uniqueClickThroughRate == null) { + return Optional.empty(); + } + return uniqueClickThroughRate; + } + + /** + * @return People who clicked, reported by the Whop pixel, counted once per person. + */ + @JsonProperty("unique_clicks") + public double getUniqueClicks() { + return uniqueClicks; + } + + /** + * @return When the ad was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return The URL the ad links to, without its query string. Parameters belong in url_parameters; any you send on url are moved there. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + /** + * @return Every query parameter appended to the URL, keyed by parameter name — including any you sent on url itself. Whop adds its own click-attribution parameters on top; those are reserved and rejected if you set them (utm_meta_ad_id, utm_meta_adset_id, utm_meta_campaign_id, utm_source, utm_placement, utm_medium, utm_content, utm_adset, utm_whop, wacid, wasid, waid, tw_source, tw_adid). + */ + @JsonProperty("url_parameters") + public Map getUrlParameters() { + return urlParameters; + } + + /** + * @return USD value attributed to view-content events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("viewed_content_value") + public double getViewedContentValue() { + return viewedContentValue; + } + + /** + * @return Whop pixel-attributed view-content events, last-click. + */ + @JsonProperty("viewed_contents") + public double getViewedContents() { + return viewedContents; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("call_to_action") + private Optional _getCallToAction() { + return callToAction; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_added_to_cart") + private Optional _getCostPerAddedToCart() { + return costPerAddedToCart; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_completed_registration") + private Optional _getCostPerCompletedRegistration() { + return costPerCompletedRegistration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_contact") + private Optional _getCostPerContact() { + return costPerContact; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_lead") + private Optional _getCostPerLead() { + return costPerLead; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_purchase") + private Optional _getCostPerPurchase() { + return costPerPurchase; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_result") + private Optional _getCostPerResult() { + return costPerResult; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_schedule") + private Optional _getCostPerSchedule() { + return costPerSchedule; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_submitted_application") + private Optional _getCostPerSubmittedApplication() { + return costPerSubmittedApplication; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_unique_click") + private Optional _getCostPerUniqueClick() { + return costPerUniqueClick; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_viewed_content") + private Optional _getCostPerViewedContent() { + return costPerViewedContent; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("frequency") + private Optional _getFrequency() { + return frequency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("lead_form") + private Optional _getLeadForm() { + return leadForm; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("lead_form_id") + private Optional _getLeadFormId() { + return leadFormId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("messaging_config") + private Optional _getMessagingConfig() { + return messagingConfig; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("post_id") + private Optional _getPostId() { + return postId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("post_source") + private Optional _getPostSource() { + return postSource; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("post_thumbnail_url") + private Optional _getPostThumbnailUrl() { + return postThumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_event") + private Optional _getResultEvent() { + return resultEvent; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_event_name") + private Optional _getResultEventName() { + return resultEventName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("results") + private Optional _getResults() { + return results; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("spend_currency") + private Optional _getSpendCurrency() { + return spendCurrency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("unique_click_through_rate") + private Optional _getUniqueClickThroughRate() { + return uniqueClickThroughRate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Ad && equalTo((Ad) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Ad other) { + return adCampaign.equals(other.adCampaign) + && adGroup.equals(other.adGroup) + && addedToCartValue == other.addedToCartValue + && addedToCarts == other.addedToCarts + && callToAction.equals(other.callToAction) + && clickThroughRate == other.clickThroughRate + && clicks == other.clicks + && completedRegistrationValue == other.completedRegistrationValue + && completedRegistrations == other.completedRegistrations + && contactValue == other.contactValue + && contacts == other.contacts + && costPerAddedToCart.equals(other.costPerAddedToCart) + && costPerClick == other.costPerClick + && costPerCompletedRegistration.equals(other.costPerCompletedRegistration) + && costPerContact.equals(other.costPerContact) + && costPerLead.equals(other.costPerLead) + && costPerMille == other.costPerMille + && costPerPurchase.equals(other.costPerPurchase) + && costPerResult.equals(other.costPerResult) + && costPerSchedule.equals(other.costPerSchedule) + && costPerSubmittedApplication.equals(other.costPerSubmittedApplication) + && costPerUniqueClick.equals(other.costPerUniqueClick) + && costPerViewedContent.equals(other.costPerViewedContent) + && createdAt.equals(other.createdAt) + && creatives.equals(other.creatives) + && customConversions == other.customConversions + && customEventCounts.equals(other.customEventCounts) + && customEventValues.equals(other.customEventValues) + && deliveryStatus.equals(other.deliveryStatus) + && descriptions.equals(other.descriptions) + && frequency.equals(other.frequency) + && headlines.equals(other.headlines) + && id.equals(other.id) + && impressions == other.impressions + && issues.equals(other.issues) + && leadForm.equals(other.leadForm) + && leadFormId.equals(other.leadFormId) + && leadValue == other.leadValue + && leads == other.leads + && messagingConfig.equals(other.messagingConfig) + && multiAdvertiserAds.equals(other.multiAdvertiserAds) + && postId.equals(other.postId) + && postSource.equals(other.postSource) + && postThumbnailUrl.equals(other.postThumbnailUrl) + && primaryTexts.equals(other.primaryTexts) + && purchaseValue == other.purchaseValue + && purchases == other.purchases + && reach == other.reach + && resultEvent.equals(other.resultEvent) + && resultEventName.equals(other.resultEventName) + && results.equals(other.results) + && returnOnAdSpend == other.returnOnAdSpend + && scheduleValue == other.scheduleValue + && schedules == other.schedules + && socialAccounts.equals(other.socialAccounts) + && spend == other.spend + && spendCurrency.equals(other.spendCurrency) + && status.equals(other.status) + && submittedApplicationValue == other.submittedApplicationValue + && submittedApplications == other.submittedApplications + && title.equals(other.title) + && uniqueClickThroughRate.equals(other.uniqueClickThroughRate) + && uniqueClicks == other.uniqueClicks + && updatedAt.equals(other.updatedAt) + && url.equals(other.url) + && urlParameters.equals(other.urlParameters) + && viewedContentValue == other.viewedContentValue + && viewedContents == other.viewedContents; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adCampaign, + this.adGroup, + this.addedToCartValue, + this.addedToCarts, + this.callToAction, + this.clickThroughRate, + this.clicks, + this.completedRegistrationValue, + this.completedRegistrations, + this.contactValue, + this.contacts, + this.costPerAddedToCart, + this.costPerClick, + this.costPerCompletedRegistration, + this.costPerContact, + this.costPerLead, + this.costPerMille, + this.costPerPurchase, + this.costPerResult, + this.costPerSchedule, + this.costPerSubmittedApplication, + this.costPerUniqueClick, + this.costPerViewedContent, + this.createdAt, + this.creatives, + this.customConversions, + this.customEventCounts, + this.customEventValues, + this.deliveryStatus, + this.descriptions, + this.frequency, + this.headlines, + this.id, + this.impressions, + this.issues, + this.leadForm, + this.leadFormId, + this.leadValue, + this.leads, + this.messagingConfig, + this.multiAdvertiserAds, + this.postId, + this.postSource, + this.postThumbnailUrl, + this.primaryTexts, + this.purchaseValue, + this.purchases, + this.reach, + this.resultEvent, + this.resultEventName, + this.results, + this.returnOnAdSpend, + this.scheduleValue, + this.schedules, + this.socialAccounts, + this.spend, + this.spendCurrency, + this.status, + this.submittedApplicationValue, + this.submittedApplications, + this.title, + this.uniqueClickThroughRate, + this.uniqueClicks, + this.updatedAt, + this.url, + this.urlParameters, + this.viewedContentValue, + this.viewedContents); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdCampaignStage builder() { + return new Builder(); + } + + public interface AdCampaignStage { + /** + *

The ad campaign this ad belongs to.

+ */ + AdGroupStage adCampaign(@NotNull AdEntityReference adCampaign); + + Builder from(Ad other); + } + + public interface AdGroupStage { + /** + *

The ad group this ad belongs to.

+ */ + AddedToCartValueStage adGroup(@NotNull AdEntityReference adGroup); + } + + public interface AddedToCartValueStage { + /** + *

USD value attributed to add-to-cart events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + AddedToCartsStage addedToCartValue(double addedToCartValue); + } + + public interface AddedToCartsStage { + /** + *

Whop pixel-attributed add-to-cart events, last-click.

+ */ + ClickThroughRateStage addedToCarts(double addedToCarts); + } + + public interface ClickThroughRateStage { + /** + *

Clicks divided by impressions, between 0 and 1.

+ */ + ClicksStage clickThroughRate(double clickThroughRate); + } + + public interface ClicksStage { + /** + *

The number of clicks.

+ */ + CompletedRegistrationValueStage clicks(double clicks); + } + + public interface CompletedRegistrationValueStage { + /** + *

USD value attributed to complete-registration events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + CompletedRegistrationsStage completedRegistrationValue(double completedRegistrationValue); + } + + public interface CompletedRegistrationsStage { + /** + *

Whop pixel-attributed complete-registration events, last-click.

+ */ + ContactValueStage completedRegistrations(double completedRegistrations); + } + + public interface ContactValueStage { + /** + *

USD value attributed to contact events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + ContactsStage contactValue(double contactValue); + } + + public interface ContactsStage { + /** + *

Whop pixel-attributed contact events, last-click.

+ */ + CostPerClickStage contacts(double contacts); + } + + public interface CostPerClickStage { + /** + *

Spend divided by clicks; 0 when there are no clicks.

+ */ + CostPerMilleStage costPerClick(double costPerClick); + } + + public interface CostPerMilleStage { + /** + *

Spend per 1,000 impressions; 0 when there are no impressions.

+ */ + CreatedAtStage costPerMille(double costPerMille); + } + + public interface CreatedAtStage { + /** + *

When the ad was created, as an ISO 8601 timestamp.

+ */ + CustomConversionsStage createdAt(@NotNull String createdAt); + } + + public interface CustomConversionsStage { + /** + *

Whop pixel-attributed custom (merchant-defined) conversion events, last-click, across all custom event names.

+ */ + DeliveryStatusStage customConversions(double customConversions); + } + + public interface DeliveryStatusStage { + /** + *

Whether the ad is delivering right now, and if not, why. When several states apply at once, the highest-precedence one is returned.

+ */ + IdStage deliveryStatus(@NotNull AdDeliveryStatus deliveryStatus); + } + + public interface IdStage { + /** + *

Unique identifier for the ad, prefixed ad_.

+ */ + ImpressionsStage id(@NotNull String id); + } + + public interface ImpressionsStage { + /** + *

The number of impressions.

+ */ + LeadValueStage impressions(double impressions); + } + + public interface LeadValueStage { + /** + *

USD value attributed to lead events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + LeadsStage leadValue(double leadValue); + } + + public interface LeadsStage { + /** + *

Whop pixel-attributed leads, last-click.

+ */ + PurchaseValueStage leads(double leads); + } + + public interface PurchaseValueStage { + /** + *

USD value of pixel-attributed purchases.

+ */ + PurchasesStage purchaseValue(double purchaseValue); + } + + public interface PurchasesStage { + /** + *

Whop pixel-attributed purchases, last-click.

+ */ + ReachStage purchases(double purchases); + } + + public interface ReachStage { + /** + *

The number of unique people who saw this.

+ */ + ReturnOnAdSpendStage reach(double reach); + } + + public interface ReturnOnAdSpendStage { + /** + *

Purchase value divided by spend, both in USD (a currency-neutral ratio); 0 when there is no spend.

+ */ + ScheduleValueStage returnOnAdSpend(double returnOnAdSpend); + } + + public interface ScheduleValueStage { + /** + *

USD value attributed to schedule events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + SchedulesStage scheduleValue(double scheduleValue); + } + + public interface SchedulesStage { + /** + *

Whop pixel-attributed schedule events, last-click.

+ */ + SpendStage schedules(double schedules); + } + + public interface SpendStage { + /** + *

The amount charged, in spend_currency.

+ */ + StatusStage spend(double spend); + } + + public interface StatusStage { + /** + *

Whether the ad is enabled. active and paused are set by you; in_review and rejected come from ad review.

+ */ + SubmittedApplicationValueStage status(@NotNull AdStatus status); + } + + public interface SubmittedApplicationValueStage { + /** + *

USD value attributed to submit-application events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + SubmittedApplicationsStage submittedApplicationValue(double submittedApplicationValue); + } + + public interface SubmittedApplicationsStage { + /** + *

Whop pixel-attributed submit-application events, last-click.

+ */ + UniqueClicksStage submittedApplications(double submittedApplications); + } + + public interface UniqueClicksStage { + /** + *

People who clicked, reported by the Whop pixel, counted once per person.

+ */ + UpdatedAtStage uniqueClicks(double uniqueClicks); + } + + public interface UpdatedAtStage { + /** + *

When the ad was last updated, as an ISO 8601 timestamp.

+ */ + ViewedContentValueStage updatedAt(@NotNull String updatedAt); + } + + public interface ViewedContentValueStage { + /** + *

USD value attributed to view-content events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + ViewedContentsStage viewedContentValue(double viewedContentValue); + } + + public interface ViewedContentsStage { + /** + *

Whop pixel-attributed view-content events, last-click.

+ */ + _FinalStage viewedContents(double viewedContents); + } + + public interface _FinalStage { + Ad build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The call-to-action button shown on the ad.

+ */ + _FinalStage callToAction(Optional callToAction); + + _FinalStage callToAction(AdCallToAction callToAction); + + _FinalStage callToAction(Nullable callToAction); + + /** + *

Spend divided by attributed add-to-cart events; null when they are not the goal and none are attributed.

+ */ + _FinalStage costPerAddedToCart(Optional costPerAddedToCart); + + _FinalStage costPerAddedToCart(Double costPerAddedToCart); + + _FinalStage costPerAddedToCart(Nullable costPerAddedToCart); + + /** + *

Spend divided by attributed complete-registration events; null when they are not the goal and none are attributed.

+ */ + _FinalStage costPerCompletedRegistration(Optional costPerCompletedRegistration); + + _FinalStage costPerCompletedRegistration(Double costPerCompletedRegistration); + + _FinalStage costPerCompletedRegistration(Nullable costPerCompletedRegistration); + + /** + *

Spend divided by attributed contact events; null when contacts are not the goal and none are attributed.

+ */ + _FinalStage costPerContact(Optional costPerContact); + + _FinalStage costPerContact(Double costPerContact); + + _FinalStage costPerContact(Nullable costPerContact); + + /** + *

Spend divided by attributed leads; null when leads are not a goal and none are attributed.

+ */ + _FinalStage costPerLead(Optional costPerLead); + + _FinalStage costPerLead(Double costPerLead); + + _FinalStage costPerLead(Nullable costPerLead); + + /** + *

Spend divided by attributed purchases; null when purchases are not a goal and none are attributed.

+ */ + _FinalStage costPerPurchase(Optional costPerPurchase); + + _FinalStage costPerPurchase(Double costPerPurchase); + + _FinalStage costPerPurchase(Nullable costPerPurchase); + + /** + *

Spend divided by Whop pixel-attributed results; null when nothing Whop-attributable is being optimized for.

+ */ + _FinalStage costPerResult(Optional costPerResult); + + _FinalStage costPerResult(Double costPerResult); + + _FinalStage costPerResult(Nullable costPerResult); + + /** + *

Spend divided by attributed schedule events; null when schedules are not the goal and none are attributed.

+ */ + _FinalStage costPerSchedule(Optional costPerSchedule); + + _FinalStage costPerSchedule(Double costPerSchedule); + + _FinalStage costPerSchedule(Nullable costPerSchedule); + + /** + *

Spend divided by attributed submit-application events; null when they are not the goal and none are attributed.

+ */ + _FinalStage costPerSubmittedApplication(Optional costPerSubmittedApplication); + + _FinalStage costPerSubmittedApplication(Double costPerSubmittedApplication); + + _FinalStage costPerSubmittedApplication(Nullable costPerSubmittedApplication); + + /** + *

Spend divided by unique clicks; null when there are no unique clicks.

+ */ + _FinalStage costPerUniqueClick(Optional costPerUniqueClick); + + _FinalStage costPerUniqueClick(Double costPerUniqueClick); + + _FinalStage costPerUniqueClick(Nullable costPerUniqueClick); + + /** + *

Spend divided by attributed view-content events; null when they are not the goal and none are attributed.

+ */ + _FinalStage costPerViewedContent(Optional costPerViewedContent); + + _FinalStage costPerViewedContent(Double costPerViewedContent); + + _FinalStage costPerViewedContent(Nullable costPerViewedContent); + + _FinalStage creatives(List creatives); + + _FinalStage addCreatives(AdCreative creatives); + + _FinalStage addAllCreatives(List creatives); + + /** + *

Whop pixel-attributed custom conversions, keyed by your event name with its last-click count as the value. Empty when no named custom events are attributed. Custom events fired without a name are counted in custom_conversions but omitted here, so these values sum to at most custom_conversions.

+ */ + _FinalStage customEventCounts(Map customEventCounts); + + _FinalStage putAllCustomEventCounts(Map customEventCounts); + + _FinalStage customEventCounts(String key, Object value); + + /** + *

Conversion value attributed to each custom event, keyed by event name like custom_event_counts. Sums the value passed to whop.track, normalized to USD; events fired without a value contribute 0.

+ */ + _FinalStage customEventValues(Map customEventValues); + + _FinalStage putAllCustomEventValues(Map customEventValues); + + _FinalStage customEventValues(String key, Object value); + + _FinalStage descriptions(List descriptions); + + _FinalStage addDescriptions(String descriptions); + + _FinalStage addAllDescriptions(List descriptions); + + /** + *

Platform-reported impressions divided by reach.

+ */ + _FinalStage frequency(Optional frequency); + + _FinalStage frequency(Double frequency); + + _FinalStage frequency(Nullable frequency); + + _FinalStage headlines(List headlines); + + _FinalStage addHeadlines(String headlines); + + _FinalStage addAllHeadlines(List headlines); + + _FinalStage issues(List issues); + + _FinalStage addIssues(AdPlatformIssue issues); + + _FinalStage addAllIssues(List issues); + + /** + *

The instant lead form shown when someone taps this ad. null when the ad group's conversion_location is not an instant-form destination.

+ */ + _FinalStage leadForm(Optional leadForm); + + _FinalStage leadForm(AdLeadForm leadForm); + + _FinalStage leadForm(Nullable leadForm); + + /** + *

The ad platform's ID for the instant form the ad uses. Set when the ad references an existing form via lead_form_id, or once a form built from lead_form has been created on the platform.

+ */ + _FinalStage leadFormId(Optional leadFormId); + + _FinalStage leadFormId(String leadFormId); + + _FinalStage leadFormId(Nullable leadFormId); + + /** + *

Welcome message for click-to-message ads, shown when the conversation opens. null when the ad has none.

+ */ + _FinalStage messagingConfig(Optional messagingConfig); + + _FinalStage messagingConfig(AdMessagingConfig messagingConfig); + + _FinalStage messagingConfig(Nullable messagingConfig); + + /** + *

Whether the ad can appear alongside other advertisers' ads in the same unit. Defaults to true.

+ */ + _FinalStage multiAdvertiserAds(Optional multiAdvertiserAds); + + _FinalStage multiAdvertiserAds(Boolean multiAdvertiserAds); + + /** + *

The existing post this ad promotes — a Facebook post or Instagram media ID. null when the ad uses uploaded creatives.

+ */ + _FinalStage postId(Optional postId); + + _FinalStage postId(String postId); + + _FinalStage postId(Nullable postId); + + /** + *

Identifies the network that owns post_id; null when the ad uses uploaded creatives.

+ */ + _FinalStage postSource(Optional postSource); + + _FinalStage postSource(AdPostSource postSource); + + _FinalStage postSource(Nullable postSource); + + /** + *

Preview image of the existing post this ad promotes. null for ads that use uploaded creatives, or until the post's media has been fetched from the network.

+ */ + _FinalStage postThumbnailUrl(Optional postThumbnailUrl); + + _FinalStage postThumbnailUrl(String postThumbnailUrl); + + _FinalStage postThumbnailUrl(Nullable postThumbnailUrl); + + _FinalStage primaryTexts(List primaryTexts); + + _FinalStage addPrimaryTexts(String primaryTexts); + + _FinalStage addAllPrimaryTexts(List primaryTexts); + + /** + *

The Whop pixel conversion event whose attributed count represents results — the optimization goal, or the highest-volume attributed event for campaigns that budget per ad group. Null when the goal isn't a Whop-attributed event.

+ */ + _FinalStage resultEvent(Optional resultEvent); + + _FinalStage resultEvent(AdResultEvent resultEvent); + + _FinalStage resultEvent(Nullable resultEvent); + + /** + *

The merchant-defined event name when result_event is custom; null for the standard events.

+ */ + _FinalStage resultEventName(Optional resultEventName); + + _FinalStage resultEventName(String resultEventName); + + _FinalStage resultEventName(Nullable resultEventName); + + /** + *

The Whop pixel-attributed count behind result_event. When a campaign's ad groups optimize different goals there is no single result_event (it is null), and this is instead the sum of each ad group's own attributed results. Null when nothing Whop-attributable is being optimized for.

+ */ + _FinalStage results(Optional results); + + _FinalStage results(Double results); + + _FinalStage results(Nullable results); + + _FinalStage socialAccounts(List socialAccounts); + + _FinalStage addSocialAccounts(AdEntityReference socialAccounts); + + _FinalStage addAllSocialAccounts(List socialAccounts); + + /** + *

The ISO 4217 currency code of all monetary metrics.

+ */ + _FinalStage spendCurrency(Optional spendCurrency); + + _FinalStage spendCurrency(String spendCurrency); + + _FinalStage spendCurrency(Nullable spendCurrency); + + /** + *

Display title of the ad.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + + /** + *

Unique clicks divided by impressions, between 0 and 1.

+ */ + _FinalStage uniqueClickThroughRate(Optional uniqueClickThroughRate); + + _FinalStage uniqueClickThroughRate(Double uniqueClickThroughRate); + + _FinalStage uniqueClickThroughRate(Nullable uniqueClickThroughRate); + + /** + *

The URL the ad links to, without its query string. Parameters belong in url_parameters; any you send on url are moved there.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + + /** + *

Every query parameter appended to the URL, keyed by parameter name — including any you sent on url itself. Whop adds its own click-attribution parameters on top; those are reserved and rejected if you set them (utm_meta_ad_id, utm_meta_adset_id, utm_meta_campaign_id, utm_source, utm_placement, utm_medium, utm_content, utm_adset, utm_whop, wacid, wasid, waid, tw_source, tw_adid).

+ */ + _FinalStage urlParameters(Map urlParameters); + + _FinalStage putAllUrlParameters(Map urlParameters); + + _FinalStage urlParameters(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AdCampaignStage, + AdGroupStage, + AddedToCartValueStage, + AddedToCartsStage, + ClickThroughRateStage, + ClicksStage, + CompletedRegistrationValueStage, + CompletedRegistrationsStage, + ContactValueStage, + ContactsStage, + CostPerClickStage, + CostPerMilleStage, + CreatedAtStage, + CustomConversionsStage, + DeliveryStatusStage, + IdStage, + ImpressionsStage, + LeadValueStage, + LeadsStage, + PurchaseValueStage, + PurchasesStage, + ReachStage, + ReturnOnAdSpendStage, + ScheduleValueStage, + SchedulesStage, + SpendStage, + StatusStage, + SubmittedApplicationValueStage, + SubmittedApplicationsStage, + UniqueClicksStage, + UpdatedAtStage, + ViewedContentValueStage, + ViewedContentsStage, + _FinalStage { + private AdEntityReference adCampaign; + + private AdEntityReference adGroup; + + private double addedToCartValue; + + private double addedToCarts; + + private double clickThroughRate; + + private double clicks; + + private double completedRegistrationValue; + + private double completedRegistrations; + + private double contactValue; + + private double contacts; + + private double costPerClick; + + private double costPerMille; + + private String createdAt; + + private double customConversions; + + private AdDeliveryStatus deliveryStatus; + + private String id; + + private double impressions; + + private double leadValue; + + private double leads; + + private double purchaseValue; + + private double purchases; + + private double reach; + + private double returnOnAdSpend; + + private double scheduleValue; + + private double schedules; + + private double spend; + + private AdStatus status; + + private double submittedApplicationValue; + + private double submittedApplications; + + private double uniqueClicks; + + private String updatedAt; + + private double viewedContentValue; + + private double viewedContents; + + private Map urlParameters = new LinkedHashMap<>(); + + private Optional url = Optional.empty(); + + private Optional uniqueClickThroughRate = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional spendCurrency = Optional.empty(); + + private List socialAccounts = new ArrayList<>(); + + private Optional results = Optional.empty(); + + private Optional resultEventName = Optional.empty(); + + private Optional resultEvent = Optional.empty(); + + private List primaryTexts = new ArrayList<>(); + + private Optional postThumbnailUrl = Optional.empty(); + + private Optional postSource = Optional.empty(); + + private Optional postId = Optional.empty(); + + private Optional multiAdvertiserAds = Optional.empty(); + + private Optional messagingConfig = Optional.empty(); + + private Optional leadFormId = Optional.empty(); + + private Optional leadForm = Optional.empty(); + + private List issues = new ArrayList<>(); + + private List headlines = new ArrayList<>(); + + private Optional frequency = Optional.empty(); + + private List descriptions = new ArrayList<>(); + + private Map customEventValues = new LinkedHashMap<>(); + + private Map customEventCounts = new LinkedHashMap<>(); + + private List creatives = new ArrayList<>(); + + private Optional costPerViewedContent = Optional.empty(); + + private Optional costPerUniqueClick = Optional.empty(); + + private Optional costPerSubmittedApplication = Optional.empty(); + + private Optional costPerSchedule = Optional.empty(); + + private Optional costPerResult = Optional.empty(); + + private Optional costPerPurchase = Optional.empty(); + + private Optional costPerLead = Optional.empty(); + + private Optional costPerContact = Optional.empty(); + + private Optional costPerCompletedRegistration = Optional.empty(); + + private Optional costPerAddedToCart = Optional.empty(); + + private Optional callToAction = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Ad other) { + adCampaign(other.getAdCampaign()); + adGroup(other.getAdGroup()); + addedToCartValue(other.getAddedToCartValue()); + addedToCarts(other.getAddedToCarts()); + callToAction(other.getCallToAction()); + clickThroughRate(other.getClickThroughRate()); + clicks(other.getClicks()); + completedRegistrationValue(other.getCompletedRegistrationValue()); + completedRegistrations(other.getCompletedRegistrations()); + contactValue(other.getContactValue()); + contacts(other.getContacts()); + costPerAddedToCart(other.getCostPerAddedToCart()); + costPerClick(other.getCostPerClick()); + costPerCompletedRegistration(other.getCostPerCompletedRegistration()); + costPerContact(other.getCostPerContact()); + costPerLead(other.getCostPerLead()); + costPerMille(other.getCostPerMille()); + costPerPurchase(other.getCostPerPurchase()); + costPerResult(other.getCostPerResult()); + costPerSchedule(other.getCostPerSchedule()); + costPerSubmittedApplication(other.getCostPerSubmittedApplication()); + costPerUniqueClick(other.getCostPerUniqueClick()); + costPerViewedContent(other.getCostPerViewedContent()); + createdAt(other.getCreatedAt()); + creatives(other.getCreatives()); + customConversions(other.getCustomConversions()); + customEventCounts(other.getCustomEventCounts()); + customEventValues(other.getCustomEventValues()); + deliveryStatus(other.getDeliveryStatus()); + descriptions(other.getDescriptions()); + frequency(other.getFrequency()); + headlines(other.getHeadlines()); + id(other.getId()); + impressions(other.getImpressions()); + issues(other.getIssues()); + leadForm(other.getLeadForm()); + leadFormId(other.getLeadFormId()); + leadValue(other.getLeadValue()); + leads(other.getLeads()); + messagingConfig(other.getMessagingConfig()); + multiAdvertiserAds(other.getMultiAdvertiserAds()); + postId(other.getPostId()); + postSource(other.getPostSource()); + postThumbnailUrl(other.getPostThumbnailUrl()); + primaryTexts(other.getPrimaryTexts()); + purchaseValue(other.getPurchaseValue()); + purchases(other.getPurchases()); + reach(other.getReach()); + resultEvent(other.getResultEvent()); + resultEventName(other.getResultEventName()); + results(other.getResults()); + returnOnAdSpend(other.getReturnOnAdSpend()); + scheduleValue(other.getScheduleValue()); + schedules(other.getSchedules()); + socialAccounts(other.getSocialAccounts()); + spend(other.getSpend()); + spendCurrency(other.getSpendCurrency()); + status(other.getStatus()); + submittedApplicationValue(other.getSubmittedApplicationValue()); + submittedApplications(other.getSubmittedApplications()); + title(other.getTitle()); + uniqueClickThroughRate(other.getUniqueClickThroughRate()); + uniqueClicks(other.getUniqueClicks()); + updatedAt(other.getUpdatedAt()); + url(other.getUrl()); + urlParameters(other.getUrlParameters()); + viewedContentValue(other.getViewedContentValue()); + viewedContents(other.getViewedContents()); + return this; + } + + /** + *

The ad campaign this ad belongs to.

+ *

The ad campaign this ad belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ad_campaign") + public AdGroupStage adCampaign(@NotNull AdEntityReference adCampaign) { + this.adCampaign = Objects.requireNonNull(adCampaign, "adCampaign must not be null"); + return this; + } + + /** + *

The ad group this ad belongs to.

+ *

The ad group this ad belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ad_group") + public AddedToCartValueStage adGroup(@NotNull AdEntityReference adGroup) { + this.adGroup = Objects.requireNonNull(adGroup, "adGroup must not be null"); + return this; + } + + /** + *

USD value attributed to add-to-cart events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to add-to-cart events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("added_to_cart_value") + public AddedToCartsStage addedToCartValue(double addedToCartValue) { + this.addedToCartValue = addedToCartValue; + return this; + } + + /** + *

Whop pixel-attributed add-to-cart events, last-click.

+ *

Whop pixel-attributed add-to-cart events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("added_to_carts") + public ClickThroughRateStage addedToCarts(double addedToCarts) { + this.addedToCarts = addedToCarts; + return this; + } + + /** + *

Clicks divided by impressions, between 0 and 1.

+ *

Clicks divided by impressions, between 0 and 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("click_through_rate") + public ClicksStage clickThroughRate(double clickThroughRate) { + this.clickThroughRate = clickThroughRate; + return this; + } + + /** + *

The number of clicks.

+ *

The number of clicks.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("clicks") + public CompletedRegistrationValueStage clicks(double clicks) { + this.clicks = clicks; + return this; + } + + /** + *

USD value attributed to complete-registration events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to complete-registration events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completed_registration_value") + public CompletedRegistrationsStage completedRegistrationValue(double completedRegistrationValue) { + this.completedRegistrationValue = completedRegistrationValue; + return this; + } + + /** + *

Whop pixel-attributed complete-registration events, last-click.

+ *

Whop pixel-attributed complete-registration events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completed_registrations") + public ContactValueStage completedRegistrations(double completedRegistrations) { + this.completedRegistrations = completedRegistrations; + return this; + } + + /** + *

USD value attributed to contact events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to contact events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("contact_value") + public ContactsStage contactValue(double contactValue) { + this.contactValue = contactValue; + return this; + } + + /** + *

Whop pixel-attributed contact events, last-click.

+ *

Whop pixel-attributed contact events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("contacts") + public CostPerClickStage contacts(double contacts) { + this.contacts = contacts; + return this; + } + + /** + *

Spend divided by clicks; 0 when there are no clicks.

+ *

Spend divided by clicks; 0 when there are no clicks.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cost_per_click") + public CostPerMilleStage costPerClick(double costPerClick) { + this.costPerClick = costPerClick; + return this; + } + + /** + *

Spend per 1,000 impressions; 0 when there are no impressions.

+ *

Spend per 1,000 impressions; 0 when there are no impressions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cost_per_mille") + public CreatedAtStage costPerMille(double costPerMille) { + this.costPerMille = costPerMille; + return this; + } + + /** + *

When the ad was created, as an ISO 8601 timestamp.

+ *

When the ad was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CustomConversionsStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Whop pixel-attributed custom (merchant-defined) conversion events, last-click, across all custom event names.

+ *

Whop pixel-attributed custom (merchant-defined) conversion events, last-click, across all custom event names.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("custom_conversions") + public DeliveryStatusStage customConversions(double customConversions) { + this.customConversions = customConversions; + return this; + } + + /** + *

Whether the ad is delivering right now, and if not, why. When several states apply at once, the highest-precedence one is returned.

+ *

Whether the ad is delivering right now, and if not, why. When several states apply at once, the highest-precedence one is returned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("delivery_status") + public IdStage deliveryStatus(@NotNull AdDeliveryStatus deliveryStatus) { + this.deliveryStatus = Objects.requireNonNull(deliveryStatus, "deliveryStatus must not be null"); + return this; + } + + /** + *

Unique identifier for the ad, prefixed ad_.

+ *

Unique identifier for the ad, prefixed ad_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ImpressionsStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The number of impressions.

+ *

The number of impressions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("impressions") + public LeadValueStage impressions(double impressions) { + this.impressions = impressions; + return this; + } + + /** + *

USD value attributed to lead events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to lead events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("lead_value") + public LeadsStage leadValue(double leadValue) { + this.leadValue = leadValue; + return this; + } + + /** + *

Whop pixel-attributed leads, last-click.

+ *

Whop pixel-attributed leads, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("leads") + public PurchaseValueStage leads(double leads) { + this.leads = leads; + return this; + } + + /** + *

USD value of pixel-attributed purchases.

+ *

USD value of pixel-attributed purchases.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("purchase_value") + public PurchasesStage purchaseValue(double purchaseValue) { + this.purchaseValue = purchaseValue; + return this; + } + + /** + *

Whop pixel-attributed purchases, last-click.

+ *

Whop pixel-attributed purchases, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("purchases") + public ReachStage purchases(double purchases) { + this.purchases = purchases; + return this; + } + + /** + *

The number of unique people who saw this.

+ *

The number of unique people who saw this.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reach") + public ReturnOnAdSpendStage reach(double reach) { + this.reach = reach; + return this; + } + + /** + *

Purchase value divided by spend, both in USD (a currency-neutral ratio); 0 when there is no spend.

+ *

Purchase value divided by spend, both in USD (a currency-neutral ratio); 0 when there is no spend.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("return_on_ad_spend") + public ScheduleValueStage returnOnAdSpend(double returnOnAdSpend) { + this.returnOnAdSpend = returnOnAdSpend; + return this; + } + + /** + *

USD value attributed to schedule events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to schedule events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("schedule_value") + public SchedulesStage scheduleValue(double scheduleValue) { + this.scheduleValue = scheduleValue; + return this; + } + + /** + *

Whop pixel-attributed schedule events, last-click.

+ *

Whop pixel-attributed schedule events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("schedules") + public SpendStage schedules(double schedules) { + this.schedules = schedules; + return this; + } + + /** + *

The amount charged, in spend_currency.

+ *

The amount charged, in spend_currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("spend") + public StatusStage spend(double spend) { + this.spend = spend; + return this; + } + + /** + *

Whether the ad is enabled. active and paused are set by you; in_review and rejected come from ad review.

+ *

Whether the ad is enabled. active and paused are set by you; in_review and rejected come from ad review.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public SubmittedApplicationValueStage status(@NotNull AdStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

USD value attributed to submit-application events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to submit-application events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("submitted_application_value") + public SubmittedApplicationsStage submittedApplicationValue(double submittedApplicationValue) { + this.submittedApplicationValue = submittedApplicationValue; + return this; + } + + /** + *

Whop pixel-attributed submit-application events, last-click.

+ *

Whop pixel-attributed submit-application events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("submitted_applications") + public UniqueClicksStage submittedApplications(double submittedApplications) { + this.submittedApplications = submittedApplications; + return this; + } + + /** + *

People who clicked, reported by the Whop pixel, counted once per person.

+ *

People who clicked, reported by the Whop pixel, counted once per person.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("unique_clicks") + public UpdatedAtStage uniqueClicks(double uniqueClicks) { + this.uniqueClicks = uniqueClicks; + return this; + } + + /** + *

When the ad was last updated, as an ISO 8601 timestamp.

+ *

When the ad was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public ViewedContentValueStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

USD value attributed to view-content events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to view-content events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("viewed_content_value") + public ViewedContentsStage viewedContentValue(double viewedContentValue) { + this.viewedContentValue = viewedContentValue; + return this; + } + + /** + *

Whop pixel-attributed view-content events, last-click.

+ *

Whop pixel-attributed view-content events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("viewed_contents") + public _FinalStage viewedContents(double viewedContents) { + this.viewedContents = viewedContents; + return this; + } + + /** + *

Every query parameter appended to the URL, keyed by parameter name — including any you sent on url itself. Whop adds its own click-attribution parameters on top; those are reserved and rejected if you set them (utm_meta_ad_id, utm_meta_adset_id, utm_meta_campaign_id, utm_source, utm_placement, utm_medium, utm_content, utm_adset, utm_whop, wacid, wasid, waid, tw_source, tw_adid).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage urlParameters(String key, Object value) { + this.urlParameters.put(key, value); + return this; + } + + /** + *

Every query parameter appended to the URL, keyed by parameter name — including any you sent on url itself. Whop adds its own click-attribution parameters on top; those are reserved and rejected if you set them (utm_meta_ad_id, utm_meta_adset_id, utm_meta_campaign_id, utm_source, utm_placement, utm_medium, utm_content, utm_adset, utm_whop, wacid, wasid, waid, tw_source, tw_adid).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllUrlParameters(Map urlParameters) { + if (urlParameters != null) { + this.urlParameters.putAll(urlParameters); + } + return this; + } + + /** + *

Every query parameter appended to the URL, keyed by parameter name — including any you sent on url itself. Whop adds its own click-attribution parameters on top; those are reserved and rejected if you set them (utm_meta_ad_id, utm_meta_adset_id, utm_meta_campaign_id, utm_source, utm_placement, utm_medium, utm_content, utm_adset, utm_whop, wacid, wasid, waid, tw_source, tw_adid).

+ */ + @java.lang.Override + @JsonSetter(value = "url_parameters", nulls = Nulls.SKIP) + public _FinalStage urlParameters(Map urlParameters) { + this.urlParameters.clear(); + if (urlParameters != null) { + this.urlParameters.putAll(urlParameters); + } + return this; + } + + /** + *

The URL the ad links to, without its query string. Parameters belong in url_parameters; any you send on url are moved there.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

The URL the ad links to, without its query string. Parameters belong in url_parameters; any you send on url are moved there.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

The URL the ad links to, without its query string. Parameters belong in url_parameters; any you send on url are moved there.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

Unique clicks divided by impressions, between 0 and 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage uniqueClickThroughRate(Nullable uniqueClickThroughRate) { + if (uniqueClickThroughRate.isNull()) { + this.uniqueClickThroughRate = null; + } else if (uniqueClickThroughRate.isEmpty()) { + this.uniqueClickThroughRate = Optional.empty(); + } else { + this.uniqueClickThroughRate = Optional.of(uniqueClickThroughRate.get()); + } + return this; + } + + /** + *

Unique clicks divided by impressions, between 0 and 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage uniqueClickThroughRate(Double uniqueClickThroughRate) { + this.uniqueClickThroughRate = Optional.ofNullable(uniqueClickThroughRate); + return this; + } + + /** + *

Unique clicks divided by impressions, between 0 and 1.

+ */ + @java.lang.Override + @JsonSetter(value = "unique_click_through_rate", nulls = Nulls.SKIP) + public _FinalStage uniqueClickThroughRate(Optional uniqueClickThroughRate) { + this.uniqueClickThroughRate = uniqueClickThroughRate; + return this; + } + + /** + *

Display title of the ad.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Display title of the ad.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Display title of the ad.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

The ISO 4217 currency code of all monetary metrics.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spendCurrency(Nullable spendCurrency) { + if (spendCurrency.isNull()) { + this.spendCurrency = null; + } else if (spendCurrency.isEmpty()) { + this.spendCurrency = Optional.empty(); + } else { + this.spendCurrency = Optional.of(spendCurrency.get()); + } + return this; + } + + /** + *

The ISO 4217 currency code of all monetary metrics.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spendCurrency(String spendCurrency) { + this.spendCurrency = Optional.ofNullable(spendCurrency); + return this; + } + + /** + *

The ISO 4217 currency code of all monetary metrics.

+ */ + @java.lang.Override + @JsonSetter(value = "spend_currency", nulls = Nulls.SKIP) + public _FinalStage spendCurrency(Optional spendCurrency) { + this.spendCurrency = spendCurrency; + return this; + } + + @java.lang.Override + public _FinalStage addAllSocialAccounts(List socialAccounts) { + if (socialAccounts != null) { + this.socialAccounts.addAll(socialAccounts); + } + return this; + } + + @java.lang.Override + public _FinalStage addSocialAccounts(AdEntityReference socialAccounts) { + this.socialAccounts.add(socialAccounts); + return this; + } + + @java.lang.Override + @JsonSetter(value = "social_accounts", nulls = Nulls.SKIP) + public _FinalStage socialAccounts(List socialAccounts) { + this.socialAccounts.clear(); + if (socialAccounts != null) { + this.socialAccounts.addAll(socialAccounts); + } + return this; + } + + /** + *

The Whop pixel-attributed count behind result_event. When a campaign's ad groups optimize different goals there is no single result_event (it is null), and this is instead the sum of each ad group's own attributed results. Null when nothing Whop-attributable is being optimized for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage results(Nullable results) { + if (results.isNull()) { + this.results = null; + } else if (results.isEmpty()) { + this.results = Optional.empty(); + } else { + this.results = Optional.of(results.get()); + } + return this; + } + + /** + *

The Whop pixel-attributed count behind result_event. When a campaign's ad groups optimize different goals there is no single result_event (it is null), and this is instead the sum of each ad group's own attributed results. Null when nothing Whop-attributable is being optimized for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage results(Double results) { + this.results = Optional.ofNullable(results); + return this; + } + + /** + *

The Whop pixel-attributed count behind result_event. When a campaign's ad groups optimize different goals there is no single result_event (it is null), and this is instead the sum of each ad group's own attributed results. Null when nothing Whop-attributable is being optimized for.

+ */ + @java.lang.Override + @JsonSetter(value = "results", nulls = Nulls.SKIP) + public _FinalStage results(Optional results) { + this.results = results; + return this; + } + + /** + *

The merchant-defined event name when result_event is custom; null for the standard events.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultEventName(Nullable resultEventName) { + if (resultEventName.isNull()) { + this.resultEventName = null; + } else if (resultEventName.isEmpty()) { + this.resultEventName = Optional.empty(); + } else { + this.resultEventName = Optional.of(resultEventName.get()); + } + return this; + } + + /** + *

The merchant-defined event name when result_event is custom; null for the standard events.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultEventName(String resultEventName) { + this.resultEventName = Optional.ofNullable(resultEventName); + return this; + } + + /** + *

The merchant-defined event name when result_event is custom; null for the standard events.

+ */ + @java.lang.Override + @JsonSetter(value = "result_event_name", nulls = Nulls.SKIP) + public _FinalStage resultEventName(Optional resultEventName) { + this.resultEventName = resultEventName; + return this; + } + + /** + *

The Whop pixel conversion event whose attributed count represents results — the optimization goal, or the highest-volume attributed event for campaigns that budget per ad group. Null when the goal isn't a Whop-attributed event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultEvent(Nullable resultEvent) { + if (resultEvent.isNull()) { + this.resultEvent = null; + } else if (resultEvent.isEmpty()) { + this.resultEvent = Optional.empty(); + } else { + this.resultEvent = Optional.of(resultEvent.get()); + } + return this; + } + + /** + *

The Whop pixel conversion event whose attributed count represents results — the optimization goal, or the highest-volume attributed event for campaigns that budget per ad group. Null when the goal isn't a Whop-attributed event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultEvent(AdResultEvent resultEvent) { + this.resultEvent = Optional.ofNullable(resultEvent); + return this; + } + + /** + *

The Whop pixel conversion event whose attributed count represents results — the optimization goal, or the highest-volume attributed event for campaigns that budget per ad group. Null when the goal isn't a Whop-attributed event.

+ */ + @java.lang.Override + @JsonSetter(value = "result_event", nulls = Nulls.SKIP) + public _FinalStage resultEvent(Optional resultEvent) { + this.resultEvent = resultEvent; + return this; + } + + @java.lang.Override + public _FinalStage addAllPrimaryTexts(List primaryTexts) { + if (primaryTexts != null) { + this.primaryTexts.addAll(primaryTexts); + } + return this; + } + + @java.lang.Override + public _FinalStage addPrimaryTexts(String primaryTexts) { + this.primaryTexts.add(primaryTexts); + return this; + } + + @java.lang.Override + @JsonSetter(value = "primary_texts", nulls = Nulls.SKIP) + public _FinalStage primaryTexts(List primaryTexts) { + this.primaryTexts.clear(); + if (primaryTexts != null) { + this.primaryTexts.addAll(primaryTexts); + } + return this; + } + + /** + *

Preview image of the existing post this ad promotes. null for ads that use uploaded creatives, or until the post's media has been fetched from the network.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage postThumbnailUrl(Nullable postThumbnailUrl) { + if (postThumbnailUrl.isNull()) { + this.postThumbnailUrl = null; + } else if (postThumbnailUrl.isEmpty()) { + this.postThumbnailUrl = Optional.empty(); + } else { + this.postThumbnailUrl = Optional.of(postThumbnailUrl.get()); + } + return this; + } + + /** + *

Preview image of the existing post this ad promotes. null for ads that use uploaded creatives, or until the post's media has been fetched from the network.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage postThumbnailUrl(String postThumbnailUrl) { + this.postThumbnailUrl = Optional.ofNullable(postThumbnailUrl); + return this; + } + + /** + *

Preview image of the existing post this ad promotes. null for ads that use uploaded creatives, or until the post's media has been fetched from the network.

+ */ + @java.lang.Override + @JsonSetter(value = "post_thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage postThumbnailUrl(Optional postThumbnailUrl) { + this.postThumbnailUrl = postThumbnailUrl; + return this; + } + + /** + *

Identifies the network that owns post_id; null when the ad uses uploaded creatives.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage postSource(Nullable postSource) { + if (postSource.isNull()) { + this.postSource = null; + } else if (postSource.isEmpty()) { + this.postSource = Optional.empty(); + } else { + this.postSource = Optional.of(postSource.get()); + } + return this; + } + + /** + *

Identifies the network that owns post_id; null when the ad uses uploaded creatives.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage postSource(AdPostSource postSource) { + this.postSource = Optional.ofNullable(postSource); + return this; + } + + /** + *

Identifies the network that owns post_id; null when the ad uses uploaded creatives.

+ */ + @java.lang.Override + @JsonSetter(value = "post_source", nulls = Nulls.SKIP) + public _FinalStage postSource(Optional postSource) { + this.postSource = postSource; + return this; + } + + /** + *

The existing post this ad promotes — a Facebook post or Instagram media ID. null when the ad uses uploaded creatives.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage postId(Nullable postId) { + if (postId.isNull()) { + this.postId = null; + } else if (postId.isEmpty()) { + this.postId = Optional.empty(); + } else { + this.postId = Optional.of(postId.get()); + } + return this; + } + + /** + *

The existing post this ad promotes — a Facebook post or Instagram media ID. null when the ad uses uploaded creatives.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage postId(String postId) { + this.postId = Optional.ofNullable(postId); + return this; + } + + /** + *

The existing post this ad promotes — a Facebook post or Instagram media ID. null when the ad uses uploaded creatives.

+ */ + @java.lang.Override + @JsonSetter(value = "post_id", nulls = Nulls.SKIP) + public _FinalStage postId(Optional postId) { + this.postId = postId; + return this; + } + + /** + *

Whether the ad can appear alongside other advertisers' ads in the same unit. Defaults to true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage multiAdvertiserAds(Boolean multiAdvertiserAds) { + this.multiAdvertiserAds = Optional.ofNullable(multiAdvertiserAds); + return this; + } + + /** + *

Whether the ad can appear alongside other advertisers' ads in the same unit. Defaults to true.

+ */ + @java.lang.Override + @JsonSetter(value = "multi_advertiser_ads", nulls = Nulls.SKIP) + public _FinalStage multiAdvertiserAds(Optional multiAdvertiserAds) { + this.multiAdvertiserAds = multiAdvertiserAds; + return this; + } + + /** + *

Welcome message for click-to-message ads, shown when the conversation opens. null when the ad has none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messagingConfig(Nullable messagingConfig) { + if (messagingConfig.isNull()) { + this.messagingConfig = null; + } else if (messagingConfig.isEmpty()) { + this.messagingConfig = Optional.empty(); + } else { + this.messagingConfig = Optional.of(messagingConfig.get()); + } + return this; + } + + /** + *

Welcome message for click-to-message ads, shown when the conversation opens. null when the ad has none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messagingConfig(AdMessagingConfig messagingConfig) { + this.messagingConfig = Optional.ofNullable(messagingConfig); + return this; + } + + /** + *

Welcome message for click-to-message ads, shown when the conversation opens. null when the ad has none.

+ */ + @java.lang.Override + @JsonSetter(value = "messaging_config", nulls = Nulls.SKIP) + public _FinalStage messagingConfig(Optional messagingConfig) { + this.messagingConfig = messagingConfig; + return this; + } + + /** + *

The ad platform's ID for the instant form the ad uses. Set when the ad references an existing form via lead_form_id, or once a form built from lead_form has been created on the platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage leadFormId(Nullable leadFormId) { + if (leadFormId.isNull()) { + this.leadFormId = null; + } else if (leadFormId.isEmpty()) { + this.leadFormId = Optional.empty(); + } else { + this.leadFormId = Optional.of(leadFormId.get()); + } + return this; + } + + /** + *

The ad platform's ID for the instant form the ad uses. Set when the ad references an existing form via lead_form_id, or once a form built from lead_form has been created on the platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage leadFormId(String leadFormId) { + this.leadFormId = Optional.ofNullable(leadFormId); + return this; + } + + /** + *

The ad platform's ID for the instant form the ad uses. Set when the ad references an existing form via lead_form_id, or once a form built from lead_form has been created on the platform.

+ */ + @java.lang.Override + @JsonSetter(value = "lead_form_id", nulls = Nulls.SKIP) + public _FinalStage leadFormId(Optional leadFormId) { + this.leadFormId = leadFormId; + return this; + } + + /** + *

The instant lead form shown when someone taps this ad. null when the ad group's conversion_location is not an instant-form destination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage leadForm(Nullable leadForm) { + if (leadForm.isNull()) { + this.leadForm = null; + } else if (leadForm.isEmpty()) { + this.leadForm = Optional.empty(); + } else { + this.leadForm = Optional.of(leadForm.get()); + } + return this; + } + + /** + *

The instant lead form shown when someone taps this ad. null when the ad group's conversion_location is not an instant-form destination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage leadForm(AdLeadForm leadForm) { + this.leadForm = Optional.ofNullable(leadForm); + return this; + } + + /** + *

The instant lead form shown when someone taps this ad. null when the ad group's conversion_location is not an instant-form destination.

+ */ + @java.lang.Override + @JsonSetter(value = "lead_form", nulls = Nulls.SKIP) + public _FinalStage leadForm(Optional leadForm) { + this.leadForm = leadForm; + return this; + } + + @java.lang.Override + public _FinalStage addAllIssues(List issues) { + if (issues != null) { + this.issues.addAll(issues); + } + return this; + } + + @java.lang.Override + public _FinalStage addIssues(AdPlatformIssue issues) { + this.issues.add(issues); + return this; + } + + @java.lang.Override + @JsonSetter(value = "issues", nulls = Nulls.SKIP) + public _FinalStage issues(List issues) { + this.issues.clear(); + if (issues != null) { + this.issues.addAll(issues); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllHeadlines(List headlines) { + if (headlines != null) { + this.headlines.addAll(headlines); + } + return this; + } + + @java.lang.Override + public _FinalStage addHeadlines(String headlines) { + this.headlines.add(headlines); + return this; + } + + @java.lang.Override + @JsonSetter(value = "headlines", nulls = Nulls.SKIP) + public _FinalStage headlines(List headlines) { + this.headlines.clear(); + if (headlines != null) { + this.headlines.addAll(headlines); + } + return this; + } + + /** + *

Platform-reported impressions divided by reach.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frequency(Nullable frequency) { + if (frequency.isNull()) { + this.frequency = null; + } else if (frequency.isEmpty()) { + this.frequency = Optional.empty(); + } else { + this.frequency = Optional.of(frequency.get()); + } + return this; + } + + /** + *

Platform-reported impressions divided by reach.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frequency(Double frequency) { + this.frequency = Optional.ofNullable(frequency); + return this; + } + + /** + *

Platform-reported impressions divided by reach.

+ */ + @java.lang.Override + @JsonSetter(value = "frequency", nulls = Nulls.SKIP) + public _FinalStage frequency(Optional frequency) { + this.frequency = frequency; + return this; + } + + @java.lang.Override + public _FinalStage addAllDescriptions(List descriptions) { + if (descriptions != null) { + this.descriptions.addAll(descriptions); + } + return this; + } + + @java.lang.Override + public _FinalStage addDescriptions(String descriptions) { + this.descriptions.add(descriptions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "descriptions", nulls = Nulls.SKIP) + public _FinalStage descriptions(List descriptions) { + this.descriptions.clear(); + if (descriptions != null) { + this.descriptions.addAll(descriptions); + } + return this; + } + + /** + *

Conversion value attributed to each custom event, keyed by event name like custom_event_counts. Sums the value passed to whop.track, normalized to USD; events fired without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customEventValues(String key, Object value) { + this.customEventValues.put(key, value); + return this; + } + + /** + *

Conversion value attributed to each custom event, keyed by event name like custom_event_counts. Sums the value passed to whop.track, normalized to USD; events fired without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllCustomEventValues(Map customEventValues) { + if (customEventValues != null) { + this.customEventValues.putAll(customEventValues); + } + return this; + } + + /** + *

Conversion value attributed to each custom event, keyed by event name like custom_event_counts. Sums the value passed to whop.track, normalized to USD; events fired without a value contribute 0.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_event_values", nulls = Nulls.SKIP) + public _FinalStage customEventValues(Map customEventValues) { + this.customEventValues.clear(); + if (customEventValues != null) { + this.customEventValues.putAll(customEventValues); + } + return this; + } + + /** + *

Whop pixel-attributed custom conversions, keyed by your event name with its last-click count as the value. Empty when no named custom events are attributed. Custom events fired without a name are counted in custom_conversions but omitted here, so these values sum to at most custom_conversions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customEventCounts(String key, Object value) { + this.customEventCounts.put(key, value); + return this; + } + + /** + *

Whop pixel-attributed custom conversions, keyed by your event name with its last-click count as the value. Empty when no named custom events are attributed. Custom events fired without a name are counted in custom_conversions but omitted here, so these values sum to at most custom_conversions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllCustomEventCounts(Map customEventCounts) { + if (customEventCounts != null) { + this.customEventCounts.putAll(customEventCounts); + } + return this; + } + + /** + *

Whop pixel-attributed custom conversions, keyed by your event name with its last-click count as the value. Empty when no named custom events are attributed. Custom events fired without a name are counted in custom_conversions but omitted here, so these values sum to at most custom_conversions.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_event_counts", nulls = Nulls.SKIP) + public _FinalStage customEventCounts(Map customEventCounts) { + this.customEventCounts.clear(); + if (customEventCounts != null) { + this.customEventCounts.putAll(customEventCounts); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllCreatives(List creatives) { + if (creatives != null) { + this.creatives.addAll(creatives); + } + return this; + } + + @java.lang.Override + public _FinalStage addCreatives(AdCreative creatives) { + this.creatives.add(creatives); + return this; + } + + @java.lang.Override + @JsonSetter(value = "creatives", nulls = Nulls.SKIP) + public _FinalStage creatives(List creatives) { + this.creatives.clear(); + if (creatives != null) { + this.creatives.addAll(creatives); + } + return this; + } + + /** + *

Spend divided by attributed view-content events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerViewedContent(Nullable costPerViewedContent) { + if (costPerViewedContent.isNull()) { + this.costPerViewedContent = null; + } else if (costPerViewedContent.isEmpty()) { + this.costPerViewedContent = Optional.empty(); + } else { + this.costPerViewedContent = Optional.of(costPerViewedContent.get()); + } + return this; + } + + /** + *

Spend divided by attributed view-content events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerViewedContent(Double costPerViewedContent) { + this.costPerViewedContent = Optional.ofNullable(costPerViewedContent); + return this; + } + + /** + *

Spend divided by attributed view-content events; null when they are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_viewed_content", nulls = Nulls.SKIP) + public _FinalStage costPerViewedContent(Optional costPerViewedContent) { + this.costPerViewedContent = costPerViewedContent; + return this; + } + + /** + *

Spend divided by unique clicks; null when there are no unique clicks.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerUniqueClick(Nullable costPerUniqueClick) { + if (costPerUniqueClick.isNull()) { + this.costPerUniqueClick = null; + } else if (costPerUniqueClick.isEmpty()) { + this.costPerUniqueClick = Optional.empty(); + } else { + this.costPerUniqueClick = Optional.of(costPerUniqueClick.get()); + } + return this; + } + + /** + *

Spend divided by unique clicks; null when there are no unique clicks.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerUniqueClick(Double costPerUniqueClick) { + this.costPerUniqueClick = Optional.ofNullable(costPerUniqueClick); + return this; + } + + /** + *

Spend divided by unique clicks; null when there are no unique clicks.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_unique_click", nulls = Nulls.SKIP) + public _FinalStage costPerUniqueClick(Optional costPerUniqueClick) { + this.costPerUniqueClick = costPerUniqueClick; + return this; + } + + /** + *

Spend divided by attributed submit-application events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerSubmittedApplication(Nullable costPerSubmittedApplication) { + if (costPerSubmittedApplication.isNull()) { + this.costPerSubmittedApplication = null; + } else if (costPerSubmittedApplication.isEmpty()) { + this.costPerSubmittedApplication = Optional.empty(); + } else { + this.costPerSubmittedApplication = Optional.of(costPerSubmittedApplication.get()); + } + return this; + } + + /** + *

Spend divided by attributed submit-application events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerSubmittedApplication(Double costPerSubmittedApplication) { + this.costPerSubmittedApplication = Optional.ofNullable(costPerSubmittedApplication); + return this; + } + + /** + *

Spend divided by attributed submit-application events; null when they are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_submitted_application", nulls = Nulls.SKIP) + public _FinalStage costPerSubmittedApplication(Optional costPerSubmittedApplication) { + this.costPerSubmittedApplication = costPerSubmittedApplication; + return this; + } + + /** + *

Spend divided by attributed schedule events; null when schedules are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerSchedule(Nullable costPerSchedule) { + if (costPerSchedule.isNull()) { + this.costPerSchedule = null; + } else if (costPerSchedule.isEmpty()) { + this.costPerSchedule = Optional.empty(); + } else { + this.costPerSchedule = Optional.of(costPerSchedule.get()); + } + return this; + } + + /** + *

Spend divided by attributed schedule events; null when schedules are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerSchedule(Double costPerSchedule) { + this.costPerSchedule = Optional.ofNullable(costPerSchedule); + return this; + } + + /** + *

Spend divided by attributed schedule events; null when schedules are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_schedule", nulls = Nulls.SKIP) + public _FinalStage costPerSchedule(Optional costPerSchedule) { + this.costPerSchedule = costPerSchedule; + return this; + } + + /** + *

Spend divided by Whop pixel-attributed results; null when nothing Whop-attributable is being optimized for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerResult(Nullable costPerResult) { + if (costPerResult.isNull()) { + this.costPerResult = null; + } else if (costPerResult.isEmpty()) { + this.costPerResult = Optional.empty(); + } else { + this.costPerResult = Optional.of(costPerResult.get()); + } + return this; + } + + /** + *

Spend divided by Whop pixel-attributed results; null when nothing Whop-attributable is being optimized for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerResult(Double costPerResult) { + this.costPerResult = Optional.ofNullable(costPerResult); + return this; + } + + /** + *

Spend divided by Whop pixel-attributed results; null when nothing Whop-attributable is being optimized for.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_result", nulls = Nulls.SKIP) + public _FinalStage costPerResult(Optional costPerResult) { + this.costPerResult = costPerResult; + return this; + } + + /** + *

Spend divided by attributed purchases; null when purchases are not a goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerPurchase(Nullable costPerPurchase) { + if (costPerPurchase.isNull()) { + this.costPerPurchase = null; + } else if (costPerPurchase.isEmpty()) { + this.costPerPurchase = Optional.empty(); + } else { + this.costPerPurchase = Optional.of(costPerPurchase.get()); + } + return this; + } + + /** + *

Spend divided by attributed purchases; null when purchases are not a goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerPurchase(Double costPerPurchase) { + this.costPerPurchase = Optional.ofNullable(costPerPurchase); + return this; + } + + /** + *

Spend divided by attributed purchases; null when purchases are not a goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_purchase", nulls = Nulls.SKIP) + public _FinalStage costPerPurchase(Optional costPerPurchase) { + this.costPerPurchase = costPerPurchase; + return this; + } + + /** + *

Spend divided by attributed leads; null when leads are not a goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerLead(Nullable costPerLead) { + if (costPerLead.isNull()) { + this.costPerLead = null; + } else if (costPerLead.isEmpty()) { + this.costPerLead = Optional.empty(); + } else { + this.costPerLead = Optional.of(costPerLead.get()); + } + return this; + } + + /** + *

Spend divided by attributed leads; null when leads are not a goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerLead(Double costPerLead) { + this.costPerLead = Optional.ofNullable(costPerLead); + return this; + } + + /** + *

Spend divided by attributed leads; null when leads are not a goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_lead", nulls = Nulls.SKIP) + public _FinalStage costPerLead(Optional costPerLead) { + this.costPerLead = costPerLead; + return this; + } + + /** + *

Spend divided by attributed contact events; null when contacts are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerContact(Nullable costPerContact) { + if (costPerContact.isNull()) { + this.costPerContact = null; + } else if (costPerContact.isEmpty()) { + this.costPerContact = Optional.empty(); + } else { + this.costPerContact = Optional.of(costPerContact.get()); + } + return this; + } + + /** + *

Spend divided by attributed contact events; null when contacts are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerContact(Double costPerContact) { + this.costPerContact = Optional.ofNullable(costPerContact); + return this; + } + + /** + *

Spend divided by attributed contact events; null when contacts are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_contact", nulls = Nulls.SKIP) + public _FinalStage costPerContact(Optional costPerContact) { + this.costPerContact = costPerContact; + return this; + } + + /** + *

Spend divided by attributed complete-registration events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerCompletedRegistration(Nullable costPerCompletedRegistration) { + if (costPerCompletedRegistration.isNull()) { + this.costPerCompletedRegistration = null; + } else if (costPerCompletedRegistration.isEmpty()) { + this.costPerCompletedRegistration = Optional.empty(); + } else { + this.costPerCompletedRegistration = Optional.of(costPerCompletedRegistration.get()); + } + return this; + } + + /** + *

Spend divided by attributed complete-registration events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerCompletedRegistration(Double costPerCompletedRegistration) { + this.costPerCompletedRegistration = Optional.ofNullable(costPerCompletedRegistration); + return this; + } + + /** + *

Spend divided by attributed complete-registration events; null when they are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_completed_registration", nulls = Nulls.SKIP) + public _FinalStage costPerCompletedRegistration(Optional costPerCompletedRegistration) { + this.costPerCompletedRegistration = costPerCompletedRegistration; + return this; + } + + /** + *

Spend divided by attributed add-to-cart events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerAddedToCart(Nullable costPerAddedToCart) { + if (costPerAddedToCart.isNull()) { + this.costPerAddedToCart = null; + } else if (costPerAddedToCart.isEmpty()) { + this.costPerAddedToCart = Optional.empty(); + } else { + this.costPerAddedToCart = Optional.of(costPerAddedToCart.get()); + } + return this; + } + + /** + *

Spend divided by attributed add-to-cart events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerAddedToCart(Double costPerAddedToCart) { + this.costPerAddedToCart = Optional.ofNullable(costPerAddedToCart); + return this; + } + + /** + *

Spend divided by attributed add-to-cart events; null when they are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_added_to_cart", nulls = Nulls.SKIP) + public _FinalStage costPerAddedToCart(Optional costPerAddedToCart) { + this.costPerAddedToCart = costPerAddedToCart; + return this; + } + + /** + *

The call-to-action button shown on the ad.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage callToAction(Nullable callToAction) { + if (callToAction.isNull()) { + this.callToAction = null; + } else if (callToAction.isEmpty()) { + this.callToAction = Optional.empty(); + } else { + this.callToAction = Optional.of(callToAction.get()); + } + return this; + } + + /** + *

The call-to-action button shown on the ad.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage callToAction(AdCallToAction callToAction) { + this.callToAction = Optional.ofNullable(callToAction); + return this; + } + + /** + *

The call-to-action button shown on the ad.

+ */ + @java.lang.Override + @JsonSetter(value = "call_to_action", nulls = Nulls.SKIP) + public _FinalStage callToAction(Optional callToAction) { + this.callToAction = callToAction; + return this; + } + + @java.lang.Override + public Ad build() { + return new Ad( + adCampaign, + adGroup, + addedToCartValue, + addedToCarts, + callToAction, + clickThroughRate, + clicks, + completedRegistrationValue, + completedRegistrations, + contactValue, + contacts, + costPerAddedToCart, + costPerClick, + costPerCompletedRegistration, + costPerContact, + costPerLead, + costPerMille, + costPerPurchase, + costPerResult, + costPerSchedule, + costPerSubmittedApplication, + costPerUniqueClick, + costPerViewedContent, + createdAt, + creatives, + customConversions, + customEventCounts, + customEventValues, + deliveryStatus, + descriptions, + frequency, + headlines, + id, + impressions, + issues, + leadForm, + leadFormId, + leadValue, + leads, + messagingConfig, + multiAdvertiserAds, + postId, + postSource, + postThumbnailUrl, + primaryTexts, + purchaseValue, + purchases, + reach, + resultEvent, + resultEventName, + results, + returnOnAdSpend, + scheduleValue, + schedules, + socialAccounts, + spend, + spendCurrency, + status, + submittedApplicationValue, + submittedApplications, + title, + uniqueClickThroughRate, + uniqueClicks, + updatedAt, + url, + urlParameters, + viewedContentValue, + viewedContents, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdCallToAction.java b/src/main/java/com/whop/api/types/AdCallToAction.java new file mode 100644 index 00000000..ec853f5f --- /dev/null +++ b/src/main/java/com/whop/api/types/AdCallToAction.java @@ -0,0 +1,377 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdCallToAction { + public static final AdCallToAction WHATSAPP_MESSAGE = + new AdCallToAction(Value.WHATSAPP_MESSAGE, "whatsapp_message"); + + public static final AdCallToAction REQUEST_TIME = new AdCallToAction(Value.REQUEST_TIME, "request_time"); + + public static final AdCallToAction NO_BUTTON = new AdCallToAction(Value.NO_BUTTON, "no_button"); + + public static final AdCallToAction GET_STARTED = new AdCallToAction(Value.GET_STARTED, "get_started"); + + public static final AdCallToAction GET_OFFER = new AdCallToAction(Value.GET_OFFER, "get_offer"); + + public static final AdCallToAction OPEN_LINK = new AdCallToAction(Value.OPEN_LINK, "open_link"); + + public static final AdCallToAction INSTAGRAM_MESSAGE = + new AdCallToAction(Value.INSTAGRAM_MESSAGE, "instagram_message"); + + public static final AdCallToAction LISTEN_NOW = new AdCallToAction(Value.LISTEN_NOW, "listen_now"); + + public static final AdCallToAction ORDER_NOW = new AdCallToAction(Value.ORDER_NOW, "order_now"); + + public static final AdCallToAction GET_QUOTE = new AdCallToAction(Value.GET_QUOTE, "get_quote"); + + public static final AdCallToAction LEARN_MORE = new AdCallToAction(Value.LEARN_MORE, "learn_more"); + + public static final AdCallToAction DOWNLOAD = new AdCallToAction(Value.DOWNLOAD, "download"); + + public static final AdCallToAction SEND_UPDATES = new AdCallToAction(Value.SEND_UPDATES, "send_updates"); + + public static final AdCallToAction CONTACT_US = new AdCallToAction(Value.CONTACT_US, "contact_us"); + + public static final AdCallToAction WATCH_MORE = new AdCallToAction(Value.WATCH_MORE, "watch_more"); + + public static final AdCallToAction BOOK_NOW = new AdCallToAction(Value.BOOK_NOW, "book_now"); + + public static final AdCallToAction SIGN_UP = new AdCallToAction(Value.SIGN_UP, "sign_up"); + + public static final AdCallToAction GET_EVENT_TICKETS = + new AdCallToAction(Value.GET_EVENT_TICKETS, "get_event_tickets"); + + public static final AdCallToAction VIEW_INSTAGRAM_PROFILE = + new AdCallToAction(Value.VIEW_INSTAGRAM_PROFILE, "view_instagram_profile"); + + public static final AdCallToAction EVENT_RSVP = new AdCallToAction(Value.EVENT_RSVP, "event_rsvp"); + + public static final AdCallToAction SHOP_NOW = new AdCallToAction(Value.SHOP_NOW, "shop_now"); + + public static final AdCallToAction GET_OFFER_VIEW = new AdCallToAction(Value.GET_OFFER_VIEW, "get_offer_view"); + + public static final AdCallToAction MESSAGE_PAGE = new AdCallToAction(Value.MESSAGE_PAGE, "message_page"); + + public static final AdCallToAction GET_DIRECTIONS = new AdCallToAction(Value.GET_DIRECTIONS, "get_directions"); + + public static final AdCallToAction SEE_DETAILS = new AdCallToAction(Value.SEE_DETAILS, "see_details"); + + public static final AdCallToAction CALL_NOW = new AdCallToAction(Value.CALL_NOW, "call_now"); + + public static final AdCallToAction SUBSCRIBE = new AdCallToAction(Value.SUBSCRIBE, "subscribe"); + + public static final AdCallToAction BUY_NOW = new AdCallToAction(Value.BUY_NOW, "buy_now"); + + public static final AdCallToAction SEE_MENU = new AdCallToAction(Value.SEE_MENU, "see_menu"); + + public static final AdCallToAction APPLY_NOW = new AdCallToAction(Value.APPLY_NOW, "apply_now"); + + public static final AdCallToAction PLAY_GAME = new AdCallToAction(Value.PLAY_GAME, "play_game"); + + private final Value value; + + private final String string; + + AdCallToAction(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdCallToAction && this.string.equals(((AdCallToAction) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WHATSAPP_MESSAGE: + return visitor.visitWhatsappMessage(); + case REQUEST_TIME: + return visitor.visitRequestTime(); + case NO_BUTTON: + return visitor.visitNoButton(); + case GET_STARTED: + return visitor.visitGetStarted(); + case GET_OFFER: + return visitor.visitGetOffer(); + case OPEN_LINK: + return visitor.visitOpenLink(); + case INSTAGRAM_MESSAGE: + return visitor.visitInstagramMessage(); + case LISTEN_NOW: + return visitor.visitListenNow(); + case ORDER_NOW: + return visitor.visitOrderNow(); + case GET_QUOTE: + return visitor.visitGetQuote(); + case LEARN_MORE: + return visitor.visitLearnMore(); + case DOWNLOAD: + return visitor.visitDownload(); + case SEND_UPDATES: + return visitor.visitSendUpdates(); + case CONTACT_US: + return visitor.visitContactUs(); + case WATCH_MORE: + return visitor.visitWatchMore(); + case BOOK_NOW: + return visitor.visitBookNow(); + case SIGN_UP: + return visitor.visitSignUp(); + case GET_EVENT_TICKETS: + return visitor.visitGetEventTickets(); + case VIEW_INSTAGRAM_PROFILE: + return visitor.visitViewInstagramProfile(); + case EVENT_RSVP: + return visitor.visitEventRsvp(); + case SHOP_NOW: + return visitor.visitShopNow(); + case GET_OFFER_VIEW: + return visitor.visitGetOfferView(); + case MESSAGE_PAGE: + return visitor.visitMessagePage(); + case GET_DIRECTIONS: + return visitor.visitGetDirections(); + case SEE_DETAILS: + return visitor.visitSeeDetails(); + case CALL_NOW: + return visitor.visitCallNow(); + case SUBSCRIBE: + return visitor.visitSubscribe(); + case BUY_NOW: + return visitor.visitBuyNow(); + case SEE_MENU: + return visitor.visitSeeMenu(); + case APPLY_NOW: + return visitor.visitApplyNow(); + case PLAY_GAME: + return visitor.visitPlayGame(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdCallToAction valueOf(String value) { + switch (value) { + case "whatsapp_message": + return WHATSAPP_MESSAGE; + case "request_time": + return REQUEST_TIME; + case "no_button": + return NO_BUTTON; + case "get_started": + return GET_STARTED; + case "get_offer": + return GET_OFFER; + case "open_link": + return OPEN_LINK; + case "instagram_message": + return INSTAGRAM_MESSAGE; + case "listen_now": + return LISTEN_NOW; + case "order_now": + return ORDER_NOW; + case "get_quote": + return GET_QUOTE; + case "learn_more": + return LEARN_MORE; + case "download": + return DOWNLOAD; + case "send_updates": + return SEND_UPDATES; + case "contact_us": + return CONTACT_US; + case "watch_more": + return WATCH_MORE; + case "book_now": + return BOOK_NOW; + case "sign_up": + return SIGN_UP; + case "get_event_tickets": + return GET_EVENT_TICKETS; + case "view_instagram_profile": + return VIEW_INSTAGRAM_PROFILE; + case "event_rsvp": + return EVENT_RSVP; + case "shop_now": + return SHOP_NOW; + case "get_offer_view": + return GET_OFFER_VIEW; + case "message_page": + return MESSAGE_PAGE; + case "get_directions": + return GET_DIRECTIONS; + case "see_details": + return SEE_DETAILS; + case "call_now": + return CALL_NOW; + case "subscribe": + return SUBSCRIBE; + case "buy_now": + return BUY_NOW; + case "see_menu": + return SEE_MENU; + case "apply_now": + return APPLY_NOW; + case "play_game": + return PLAY_GAME; + default: + return new AdCallToAction(Value.UNKNOWN, value); + } + } + + public enum Value { + LEARN_MORE, + + SHOP_NOW, + + SIGN_UP, + + SUBSCRIBE, + + GET_STARTED, + + BOOK_NOW, + + APPLY_NOW, + + CONTACT_US, + + DOWNLOAD, + + ORDER_NOW, + + BUY_NOW, + + GET_QUOTE, + + MESSAGE_PAGE, + + WHATSAPP_MESSAGE, + + INSTAGRAM_MESSAGE, + + CALL_NOW, + + GET_DIRECTIONS, + + SEND_UPDATES, + + GET_OFFER, + + WATCH_MORE, + + LISTEN_NOW, + + PLAY_GAME, + + OPEN_LINK, + + NO_BUTTON, + + GET_OFFER_VIEW, + + GET_EVENT_TICKETS, + + SEE_MENU, + + REQUEST_TIME, + + EVENT_RSVP, + + SEE_DETAILS, + + VIEW_INSTAGRAM_PROFILE, + + UNKNOWN + } + + public interface Visitor { + T visitLearnMore(); + + T visitShopNow(); + + T visitSignUp(); + + T visitSubscribe(); + + T visitGetStarted(); + + T visitBookNow(); + + T visitApplyNow(); + + T visitContactUs(); + + T visitDownload(); + + T visitOrderNow(); + + T visitBuyNow(); + + T visitGetQuote(); + + T visitMessagePage(); + + T visitWhatsappMessage(); + + T visitInstagramMessage(); + + T visitCallNow(); + + T visitGetDirections(); + + T visitSendUpdates(); + + T visitGetOffer(); + + T visitWatchMore(); + + T visitListenNow(); + + T visitPlayGame(); + + T visitOpenLink(); + + T visitNoButton(); + + T visitGetOfferView(); + + T visitGetEventTickets(); + + T visitSeeMenu(); + + T visitRequestTime(); + + T visitEventRsvp(); + + T visitSeeDetails(); + + T visitViewInstagramProfile(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdCampaign.java b/src/main/java/com/whop/api/types/AdCampaign.java new file mode 100644 index 00000000..4fee9293 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdCampaign.java @@ -0,0 +1,3158 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdCampaign.Builder.class) +public final class AdCampaign { + private final double addedToCartValue; + + private final double addedToCarts; + + private final Optional bidType; + + private final Optional budgetAmount; + + private final Optional budgetOptimization; + + private final Optional budgetType; + + private final double clickThroughRate; + + private final double clicks; + + private final double completedRegistrationValue; + + private final double completedRegistrations; + + private final double contactValue; + + private final double contacts; + + private final Optional costPerAddedToCart; + + private final double costPerClick; + + private final Optional costPerCompletedRegistration; + + private final Optional costPerContact; + + private final Optional costPerLead; + + private final double costPerMille; + + private final Optional costPerPurchase; + + private final Optional costPerResult; + + private final Optional costPerSchedule; + + private final Optional costPerSubmittedApplication; + + private final Optional costPerUniqueClick; + + private final Optional costPerViewedContent; + + private final String createdAt; + + private final double customConversions; + + private final Map customEventCounts; + + private final Map customEventValues; + + private final AdCampaignDeliveryStatus deliveryStatus; + + private final Optional frequency; + + private final String id; + + private final double impressions; + + private final List issues; + + private final double leadValue; + + private final double leads; + + private final Optional objective; + + private final Optional optimizationGoal; + + private final AdCampaignPlatform platform; + + private final double purchaseValue; + + private final double purchases; + + private final double reach; + + private final Optional resultEvent; + + private final Optional resultEventName; + + private final Optional results; + + private final double returnOnAdSpend; + + private final double scheduleValue; + + private final double schedules; + + private final List specialAdCategories; + + private final double spend; + + private final Optional spendCurrency; + + private final AdCampaignStatus status; + + private final double submittedApplicationValue; + + private final double submittedApplications; + + private final String title; + + private final Optional uniqueClickThroughRate; + + private final double uniqueClicks; + + private final String updatedAt; + + private final double viewedContentValue; + + private final double viewedContents; + + private final Map additionalProperties; + + private AdCampaign( + double addedToCartValue, + double addedToCarts, + Optional bidType, + Optional budgetAmount, + Optional budgetOptimization, + Optional budgetType, + double clickThroughRate, + double clicks, + double completedRegistrationValue, + double completedRegistrations, + double contactValue, + double contacts, + Optional costPerAddedToCart, + double costPerClick, + Optional costPerCompletedRegistration, + Optional costPerContact, + Optional costPerLead, + double costPerMille, + Optional costPerPurchase, + Optional costPerResult, + Optional costPerSchedule, + Optional costPerSubmittedApplication, + Optional costPerUniqueClick, + Optional costPerViewedContent, + String createdAt, + double customConversions, + Map customEventCounts, + Map customEventValues, + AdCampaignDeliveryStatus deliveryStatus, + Optional frequency, + String id, + double impressions, + List issues, + double leadValue, + double leads, + Optional objective, + Optional optimizationGoal, + AdCampaignPlatform platform, + double purchaseValue, + double purchases, + double reach, + Optional resultEvent, + Optional resultEventName, + Optional results, + double returnOnAdSpend, + double scheduleValue, + double schedules, + List specialAdCategories, + double spend, + Optional spendCurrency, + AdCampaignStatus status, + double submittedApplicationValue, + double submittedApplications, + String title, + Optional uniqueClickThroughRate, + double uniqueClicks, + String updatedAt, + double viewedContentValue, + double viewedContents, + Map additionalProperties) { + this.addedToCartValue = addedToCartValue; + this.addedToCarts = addedToCarts; + this.bidType = bidType; + this.budgetAmount = budgetAmount; + this.budgetOptimization = budgetOptimization; + this.budgetType = budgetType; + this.clickThroughRate = clickThroughRate; + this.clicks = clicks; + this.completedRegistrationValue = completedRegistrationValue; + this.completedRegistrations = completedRegistrations; + this.contactValue = contactValue; + this.contacts = contacts; + this.costPerAddedToCart = costPerAddedToCart; + this.costPerClick = costPerClick; + this.costPerCompletedRegistration = costPerCompletedRegistration; + this.costPerContact = costPerContact; + this.costPerLead = costPerLead; + this.costPerMille = costPerMille; + this.costPerPurchase = costPerPurchase; + this.costPerResult = costPerResult; + this.costPerSchedule = costPerSchedule; + this.costPerSubmittedApplication = costPerSubmittedApplication; + this.costPerUniqueClick = costPerUniqueClick; + this.costPerViewedContent = costPerViewedContent; + this.createdAt = createdAt; + this.customConversions = customConversions; + this.customEventCounts = customEventCounts; + this.customEventValues = customEventValues; + this.deliveryStatus = deliveryStatus; + this.frequency = frequency; + this.id = id; + this.impressions = impressions; + this.issues = issues; + this.leadValue = leadValue; + this.leads = leads; + this.objective = objective; + this.optimizationGoal = optimizationGoal; + this.platform = platform; + this.purchaseValue = purchaseValue; + this.purchases = purchases; + this.reach = reach; + this.resultEvent = resultEvent; + this.resultEventName = resultEventName; + this.results = results; + this.returnOnAdSpend = returnOnAdSpend; + this.scheduleValue = scheduleValue; + this.schedules = schedules; + this.specialAdCategories = specialAdCategories; + this.spend = spend; + this.spendCurrency = spendCurrency; + this.status = status; + this.submittedApplicationValue = submittedApplicationValue; + this.submittedApplications = submittedApplications; + this.title = title; + this.uniqueClickThroughRate = uniqueClickThroughRate; + this.uniqueClicks = uniqueClicks; + this.updatedAt = updatedAt; + this.viewedContentValue = viewedContentValue; + this.viewedContents = viewedContents; + this.additionalProperties = additionalProperties; + } + + /** + * @return USD value attributed to add-to-cart events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("added_to_cart_value") + public double getAddedToCartValue() { + return addedToCartValue; + } + + /** + * @return Whop pixel-attributed add-to-cart events, last-click. + */ + @JsonProperty("added_to_carts") + public double getAddedToCarts() { + return addedToCarts; + } + + /** + * @return How delivery bids in the ad auction: minimum_cost gets the most results for the budget, average_target holds an average cost per result, and maximum_target never bids above a cap. + */ + @JsonIgnore + public Optional getBidType() { + if (bidType == null) { + return Optional.empty(); + } + return bidType; + } + + /** + * @return The campaign's budget, in the ad account's currency. null when each ad group sets its own budget instead. + */ + @JsonIgnore + public Optional getBudgetAmount() { + if (budgetAmount == null) { + return Optional.empty(); + } + return budgetAmount; + } + + /** + * @return Which level owns the budget: the whole campaign (ad_campaign) or each ad group individually (ad_group). + */ + @JsonIgnore + public Optional getBudgetOptimization() { + if (budgetOptimization == null) { + return Optional.empty(); + } + return budgetOptimization; + } + + /** + * @return Whether budget_amount is spent per day (daily) or over the campaign's full run (lifetime). + */ + @JsonIgnore + public Optional getBudgetType() { + if (budgetType == null) { + return Optional.empty(); + } + return budgetType; + } + + /** + * @return Clicks divided by impressions, between 0 and 1. + */ + @JsonProperty("click_through_rate") + public double getClickThroughRate() { + return clickThroughRate; + } + + /** + * @return The number of clicks. + */ + @JsonProperty("clicks") + public double getClicks() { + return clicks; + } + + /** + * @return USD value attributed to complete-registration events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("completed_registration_value") + public double getCompletedRegistrationValue() { + return completedRegistrationValue; + } + + /** + * @return Whop pixel-attributed complete-registration events, last-click. + */ + @JsonProperty("completed_registrations") + public double getCompletedRegistrations() { + return completedRegistrations; + } + + /** + * @return USD value attributed to contact events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("contact_value") + public double getContactValue() { + return contactValue; + } + + /** + * @return Whop pixel-attributed contact events, last-click. + */ + @JsonProperty("contacts") + public double getContacts() { + return contacts; + } + + /** + * @return Spend divided by attributed add-to-cart events; null when they are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerAddedToCart() { + if (costPerAddedToCart == null) { + return Optional.empty(); + } + return costPerAddedToCart; + } + + /** + * @return Spend divided by clicks; 0 when there are no clicks. + */ + @JsonProperty("cost_per_click") + public double getCostPerClick() { + return costPerClick; + } + + /** + * @return Spend divided by attributed complete-registration events; null when they are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerCompletedRegistration() { + if (costPerCompletedRegistration == null) { + return Optional.empty(); + } + return costPerCompletedRegistration; + } + + /** + * @return Spend divided by attributed contact events; null when contacts are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerContact() { + if (costPerContact == null) { + return Optional.empty(); + } + return costPerContact; + } + + /** + * @return Spend divided by attributed leads; null when leads are not a goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerLead() { + if (costPerLead == null) { + return Optional.empty(); + } + return costPerLead; + } + + /** + * @return Spend per 1,000 impressions; 0 when there are no impressions. + */ + @JsonProperty("cost_per_mille") + public double getCostPerMille() { + return costPerMille; + } + + /** + * @return Spend divided by attributed purchases; null when purchases are not a goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerPurchase() { + if (costPerPurchase == null) { + return Optional.empty(); + } + return costPerPurchase; + } + + /** + * @return Spend divided by Whop pixel-attributed results; null when nothing Whop-attributable is being optimized for. + */ + @JsonIgnore + public Optional getCostPerResult() { + if (costPerResult == null) { + return Optional.empty(); + } + return costPerResult; + } + + /** + * @return Spend divided by attributed schedule events; null when schedules are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerSchedule() { + if (costPerSchedule == null) { + return Optional.empty(); + } + return costPerSchedule; + } + + /** + * @return Spend divided by attributed submit-application events; null when they are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerSubmittedApplication() { + if (costPerSubmittedApplication == null) { + return Optional.empty(); + } + return costPerSubmittedApplication; + } + + /** + * @return Spend divided by unique clicks; null when there are no unique clicks. + */ + @JsonIgnore + public Optional getCostPerUniqueClick() { + if (costPerUniqueClick == null) { + return Optional.empty(); + } + return costPerUniqueClick; + } + + /** + * @return Spend divided by attributed view-content events; null when they are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerViewedContent() { + if (costPerViewedContent == null) { + return Optional.empty(); + } + return costPerViewedContent; + } + + /** + * @return When the campaign was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Whop pixel-attributed custom (merchant-defined) conversion events, last-click, across all custom event names. + */ + @JsonProperty("custom_conversions") + public double getCustomConversions() { + return customConversions; + } + + /** + * @return Whop pixel-attributed custom conversions, keyed by your event name with its last-click count as the value. Empty when no named custom events are attributed. Custom events fired without a name are counted in custom_conversions but omitted here, so these values sum to at most custom_conversions. + */ + @JsonProperty("custom_event_counts") + public Map getCustomEventCounts() { + return customEventCounts; + } + + /** + * @return Conversion value attributed to each custom event, keyed by event name like custom_event_counts. Sums the value passed to whop.track, normalized to USD; events fired without a value contribute 0. + */ + @JsonProperty("custom_event_values") + public Map getCustomEventValues() { + return customEventValues; + } + + /** + * @return Whether the campaign's ads are delivering right now, and if not, why. When several states apply at once, the highest-precedence one is returned. + */ + @JsonProperty("delivery_status") + public AdCampaignDeliveryStatus getDeliveryStatus() { + return deliveryStatus; + } + + /** + * @return Platform-reported impressions divided by reach. + */ + @JsonIgnore + public Optional getFrequency() { + if (frequency == null) { + return Optional.empty(); + } + return frequency; + } + + /** + * @return Unique identifier for the ad campaign, prefixed adcamp_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The number of impressions. + */ + @JsonProperty("impressions") + public double getImpressions() { + return impressions; + } + + @JsonProperty("issues") + public List getIssues() { + return issues; + } + + /** + * @return USD value attributed to lead events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("lead_value") + public double getLeadValue() { + return leadValue; + } + + /** + * @return Whop pixel-attributed leads, last-click. + */ + @JsonProperty("leads") + public double getLeads() { + return leads; + } + + /** + * @return The goal the campaign optimizes toward. + */ + @JsonIgnore + public Optional getObjective() { + if (objective == null) { + return Optional.empty(); + } + return objective; + } + + /** + * @return The event the campaign optimizes for when a single goal is set campaign-wide. null when each ad group sets its own optimization_goal. + */ + @JsonIgnore + public Optional getOptimizationGoal() { + if (optimizationGoal == null) { + return Optional.empty(); + } + return optimizationGoal; + } + + /** + * @return The ad network the campaign runs on. + */ + @JsonProperty("platform") + public AdCampaignPlatform getPlatform() { + return platform; + } + + /** + * @return USD value of pixel-attributed purchases. + */ + @JsonProperty("purchase_value") + public double getPurchaseValue() { + return purchaseValue; + } + + /** + * @return Whop pixel-attributed purchases, last-click. + */ + @JsonProperty("purchases") + public double getPurchases() { + return purchases; + } + + /** + * @return The number of unique people who saw this. + */ + @JsonProperty("reach") + public double getReach() { + return reach; + } + + /** + * @return The Whop pixel conversion event whose attributed count represents results — the optimization goal, or the highest-volume attributed event for campaigns that budget per ad group. Null when the goal isn't a Whop-attributed event. + */ + @JsonIgnore + public Optional getResultEvent() { + if (resultEvent == null) { + return Optional.empty(); + } + return resultEvent; + } + + /** + * @return The merchant-defined event name when result_event is custom; null for the standard events. + */ + @JsonIgnore + public Optional getResultEventName() { + if (resultEventName == null) { + return Optional.empty(); + } + return resultEventName; + } + + /** + * @return The Whop pixel-attributed count behind result_event. When a campaign's ad groups optimize different goals there is no single result_event (it is null), and this is instead the sum of each ad group's own attributed results. Null when nothing Whop-attributable is being optimized for. + */ + @JsonIgnore + public Optional getResults() { + if (results == null) { + return Optional.empty(); + } + return results; + } + + /** + * @return Purchase value divided by spend, both in USD (a currency-neutral ratio); 0 when there is no spend. + */ + @JsonProperty("return_on_ad_spend") + public double getReturnOnAdSpend() { + return returnOnAdSpend; + } + + /** + * @return USD value attributed to schedule events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("schedule_value") + public double getScheduleValue() { + return scheduleValue; + } + + /** + * @return Whop pixel-attributed schedule events, last-click. + */ + @JsonProperty("schedules") + public double getSchedules() { + return schedules; + } + + @JsonProperty("special_ad_categories") + public List getSpecialAdCategories() { + return specialAdCategories; + } + + /** + * @return The amount charged, in spend_currency. + */ + @JsonProperty("spend") + public double getSpend() { + return spend; + } + + /** + * @return The ISO 4217 currency code of all monetary metrics. + */ + @JsonIgnore + public Optional getSpendCurrency() { + if (spendCurrency == null) { + return Optional.empty(); + } + return spendCurrency; + } + + /** + * @return The lifecycle status of the ad campaign. + */ + @JsonProperty("status") + public AdCampaignStatus getStatus() { + return status; + } + + /** + * @return USD value attributed to submit-application events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("submitted_application_value") + public double getSubmittedApplicationValue() { + return submittedApplicationValue; + } + + /** + * @return Whop pixel-attributed submit-application events, last-click. + */ + @JsonProperty("submitted_applications") + public double getSubmittedApplications() { + return submittedApplications; + } + + /** + * @return Display name of the ad campaign. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return Unique clicks divided by impressions, between 0 and 1. + */ + @JsonIgnore + public Optional getUniqueClickThroughRate() { + if (uniqueClickThroughRate == null) { + return Optional.empty(); + } + return uniqueClickThroughRate; + } + + /** + * @return People who clicked, reported by the Whop pixel, counted once per person. + */ + @JsonProperty("unique_clicks") + public double getUniqueClicks() { + return uniqueClicks; + } + + /** + * @return When the campaign was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return USD value attributed to view-content events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("viewed_content_value") + public double getViewedContentValue() { + return viewedContentValue; + } + + /** + * @return Whop pixel-attributed view-content events, last-click. + */ + @JsonProperty("viewed_contents") + public double getViewedContents() { + return viewedContents; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bid_type") + private Optional _getBidType() { + return bidType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("budget_amount") + private Optional _getBudgetAmount() { + return budgetAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("budget_optimization") + private Optional _getBudgetOptimization() { + return budgetOptimization; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("budget_type") + private Optional _getBudgetType() { + return budgetType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_added_to_cart") + private Optional _getCostPerAddedToCart() { + return costPerAddedToCart; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_completed_registration") + private Optional _getCostPerCompletedRegistration() { + return costPerCompletedRegistration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_contact") + private Optional _getCostPerContact() { + return costPerContact; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_lead") + private Optional _getCostPerLead() { + return costPerLead; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_purchase") + private Optional _getCostPerPurchase() { + return costPerPurchase; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_result") + private Optional _getCostPerResult() { + return costPerResult; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_schedule") + private Optional _getCostPerSchedule() { + return costPerSchedule; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_submitted_application") + private Optional _getCostPerSubmittedApplication() { + return costPerSubmittedApplication; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_unique_click") + private Optional _getCostPerUniqueClick() { + return costPerUniqueClick; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_viewed_content") + private Optional _getCostPerViewedContent() { + return costPerViewedContent; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("frequency") + private Optional _getFrequency() { + return frequency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("objective") + private Optional _getObjective() { + return objective; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("optimization_goal") + private Optional _getOptimizationGoal() { + return optimizationGoal; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_event") + private Optional _getResultEvent() { + return resultEvent; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_event_name") + private Optional _getResultEventName() { + return resultEventName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("results") + private Optional _getResults() { + return results; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("spend_currency") + private Optional _getSpendCurrency() { + return spendCurrency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("unique_click_through_rate") + private Optional _getUniqueClickThroughRate() { + return uniqueClickThroughRate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdCampaign && equalTo((AdCampaign) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdCampaign other) { + return addedToCartValue == other.addedToCartValue + && addedToCarts == other.addedToCarts + && bidType.equals(other.bidType) + && budgetAmount.equals(other.budgetAmount) + && budgetOptimization.equals(other.budgetOptimization) + && budgetType.equals(other.budgetType) + && clickThroughRate == other.clickThroughRate + && clicks == other.clicks + && completedRegistrationValue == other.completedRegistrationValue + && completedRegistrations == other.completedRegistrations + && contactValue == other.contactValue + && contacts == other.contacts + && costPerAddedToCart.equals(other.costPerAddedToCart) + && costPerClick == other.costPerClick + && costPerCompletedRegistration.equals(other.costPerCompletedRegistration) + && costPerContact.equals(other.costPerContact) + && costPerLead.equals(other.costPerLead) + && costPerMille == other.costPerMille + && costPerPurchase.equals(other.costPerPurchase) + && costPerResult.equals(other.costPerResult) + && costPerSchedule.equals(other.costPerSchedule) + && costPerSubmittedApplication.equals(other.costPerSubmittedApplication) + && costPerUniqueClick.equals(other.costPerUniqueClick) + && costPerViewedContent.equals(other.costPerViewedContent) + && createdAt.equals(other.createdAt) + && customConversions == other.customConversions + && customEventCounts.equals(other.customEventCounts) + && customEventValues.equals(other.customEventValues) + && deliveryStatus.equals(other.deliveryStatus) + && frequency.equals(other.frequency) + && id.equals(other.id) + && impressions == other.impressions + && issues.equals(other.issues) + && leadValue == other.leadValue + && leads == other.leads + && objective.equals(other.objective) + && optimizationGoal.equals(other.optimizationGoal) + && platform.equals(other.platform) + && purchaseValue == other.purchaseValue + && purchases == other.purchases + && reach == other.reach + && resultEvent.equals(other.resultEvent) + && resultEventName.equals(other.resultEventName) + && results.equals(other.results) + && returnOnAdSpend == other.returnOnAdSpend + && scheduleValue == other.scheduleValue + && schedules == other.schedules + && specialAdCategories.equals(other.specialAdCategories) + && spend == other.spend + && spendCurrency.equals(other.spendCurrency) + && status.equals(other.status) + && submittedApplicationValue == other.submittedApplicationValue + && submittedApplications == other.submittedApplications + && title.equals(other.title) + && uniqueClickThroughRate.equals(other.uniqueClickThroughRate) + && uniqueClicks == other.uniqueClicks + && updatedAt.equals(other.updatedAt) + && viewedContentValue == other.viewedContentValue + && viewedContents == other.viewedContents; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.addedToCartValue, + this.addedToCarts, + this.bidType, + this.budgetAmount, + this.budgetOptimization, + this.budgetType, + this.clickThroughRate, + this.clicks, + this.completedRegistrationValue, + this.completedRegistrations, + this.contactValue, + this.contacts, + this.costPerAddedToCart, + this.costPerClick, + this.costPerCompletedRegistration, + this.costPerContact, + this.costPerLead, + this.costPerMille, + this.costPerPurchase, + this.costPerResult, + this.costPerSchedule, + this.costPerSubmittedApplication, + this.costPerUniqueClick, + this.costPerViewedContent, + this.createdAt, + this.customConversions, + this.customEventCounts, + this.customEventValues, + this.deliveryStatus, + this.frequency, + this.id, + this.impressions, + this.issues, + this.leadValue, + this.leads, + this.objective, + this.optimizationGoal, + this.platform, + this.purchaseValue, + this.purchases, + this.reach, + this.resultEvent, + this.resultEventName, + this.results, + this.returnOnAdSpend, + this.scheduleValue, + this.schedules, + this.specialAdCategories, + this.spend, + this.spendCurrency, + this.status, + this.submittedApplicationValue, + this.submittedApplications, + this.title, + this.uniqueClickThroughRate, + this.uniqueClicks, + this.updatedAt, + this.viewedContentValue, + this.viewedContents); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AddedToCartValueStage builder() { + return new Builder(); + } + + public interface AddedToCartValueStage { + /** + *

USD value attributed to add-to-cart events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + AddedToCartsStage addedToCartValue(double addedToCartValue); + + Builder from(AdCampaign other); + } + + public interface AddedToCartsStage { + /** + *

Whop pixel-attributed add-to-cart events, last-click.

+ */ + ClickThroughRateStage addedToCarts(double addedToCarts); + } + + public interface ClickThroughRateStage { + /** + *

Clicks divided by impressions, between 0 and 1.

+ */ + ClicksStage clickThroughRate(double clickThroughRate); + } + + public interface ClicksStage { + /** + *

The number of clicks.

+ */ + CompletedRegistrationValueStage clicks(double clicks); + } + + public interface CompletedRegistrationValueStage { + /** + *

USD value attributed to complete-registration events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + CompletedRegistrationsStage completedRegistrationValue(double completedRegistrationValue); + } + + public interface CompletedRegistrationsStage { + /** + *

Whop pixel-attributed complete-registration events, last-click.

+ */ + ContactValueStage completedRegistrations(double completedRegistrations); + } + + public interface ContactValueStage { + /** + *

USD value attributed to contact events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + ContactsStage contactValue(double contactValue); + } + + public interface ContactsStage { + /** + *

Whop pixel-attributed contact events, last-click.

+ */ + CostPerClickStage contacts(double contacts); + } + + public interface CostPerClickStage { + /** + *

Spend divided by clicks; 0 when there are no clicks.

+ */ + CostPerMilleStage costPerClick(double costPerClick); + } + + public interface CostPerMilleStage { + /** + *

Spend per 1,000 impressions; 0 when there are no impressions.

+ */ + CreatedAtStage costPerMille(double costPerMille); + } + + public interface CreatedAtStage { + /** + *

When the campaign was created, as an ISO 8601 timestamp.

+ */ + CustomConversionsStage createdAt(@NotNull String createdAt); + } + + public interface CustomConversionsStage { + /** + *

Whop pixel-attributed custom (merchant-defined) conversion events, last-click, across all custom event names.

+ */ + DeliveryStatusStage customConversions(double customConversions); + } + + public interface DeliveryStatusStage { + /** + *

Whether the campaign's ads are delivering right now, and if not, why. When several states apply at once, the highest-precedence one is returned.

+ */ + IdStage deliveryStatus(@NotNull AdCampaignDeliveryStatus deliveryStatus); + } + + public interface IdStage { + /** + *

Unique identifier for the ad campaign, prefixed adcamp_.

+ */ + ImpressionsStage id(@NotNull String id); + } + + public interface ImpressionsStage { + /** + *

The number of impressions.

+ */ + LeadValueStage impressions(double impressions); + } + + public interface LeadValueStage { + /** + *

USD value attributed to lead events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + LeadsStage leadValue(double leadValue); + } + + public interface LeadsStage { + /** + *

Whop pixel-attributed leads, last-click.

+ */ + PlatformStage leads(double leads); + } + + public interface PlatformStage { + /** + *

The ad network the campaign runs on.

+ */ + PurchaseValueStage platform(@NotNull AdCampaignPlatform platform); + } + + public interface PurchaseValueStage { + /** + *

USD value of pixel-attributed purchases.

+ */ + PurchasesStage purchaseValue(double purchaseValue); + } + + public interface PurchasesStage { + /** + *

Whop pixel-attributed purchases, last-click.

+ */ + ReachStage purchases(double purchases); + } + + public interface ReachStage { + /** + *

The number of unique people who saw this.

+ */ + ReturnOnAdSpendStage reach(double reach); + } + + public interface ReturnOnAdSpendStage { + /** + *

Purchase value divided by spend, both in USD (a currency-neutral ratio); 0 when there is no spend.

+ */ + ScheduleValueStage returnOnAdSpend(double returnOnAdSpend); + } + + public interface ScheduleValueStage { + /** + *

USD value attributed to schedule events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + SchedulesStage scheduleValue(double scheduleValue); + } + + public interface SchedulesStage { + /** + *

Whop pixel-attributed schedule events, last-click.

+ */ + SpendStage schedules(double schedules); + } + + public interface SpendStage { + /** + *

The amount charged, in spend_currency.

+ */ + StatusStage spend(double spend); + } + + public interface StatusStage { + /** + *

The lifecycle status of the ad campaign.

+ */ + SubmittedApplicationValueStage status(@NotNull AdCampaignStatus status); + } + + public interface SubmittedApplicationValueStage { + /** + *

USD value attributed to submit-application events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + SubmittedApplicationsStage submittedApplicationValue(double submittedApplicationValue); + } + + public interface SubmittedApplicationsStage { + /** + *

Whop pixel-attributed submit-application events, last-click.

+ */ + TitleStage submittedApplications(double submittedApplications); + } + + public interface TitleStage { + /** + *

Display name of the ad campaign.

+ */ + UniqueClicksStage title(@NotNull String title); + } + + public interface UniqueClicksStage { + /** + *

People who clicked, reported by the Whop pixel, counted once per person.

+ */ + UpdatedAtStage uniqueClicks(double uniqueClicks); + } + + public interface UpdatedAtStage { + /** + *

When the campaign was last updated, as an ISO 8601 timestamp.

+ */ + ViewedContentValueStage updatedAt(@NotNull String updatedAt); + } + + public interface ViewedContentValueStage { + /** + *

USD value attributed to view-content events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + ViewedContentsStage viewedContentValue(double viewedContentValue); + } + + public interface ViewedContentsStage { + /** + *

Whop pixel-attributed view-content events, last-click.

+ */ + _FinalStage viewedContents(double viewedContents); + } + + public interface _FinalStage { + AdCampaign build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

How delivery bids in the ad auction: minimum_cost gets the most results for the budget, average_target holds an average cost per result, and maximum_target never bids above a cap.

+ */ + _FinalStage bidType(Optional bidType); + + _FinalStage bidType(AdCampaignBidType bidType); + + _FinalStage bidType(Nullable bidType); + + /** + *

The campaign's budget, in the ad account's currency. null when each ad group sets its own budget instead.

+ */ + _FinalStage budgetAmount(Optional budgetAmount); + + _FinalStage budgetAmount(Double budgetAmount); + + _FinalStage budgetAmount(Nullable budgetAmount); + + /** + *

Which level owns the budget: the whole campaign (ad_campaign) or each ad group individually (ad_group).

+ */ + _FinalStage budgetOptimization(Optional budgetOptimization); + + _FinalStage budgetOptimization(AdCampaignBudgetOptimization budgetOptimization); + + _FinalStage budgetOptimization(Nullable budgetOptimization); + + /** + *

Whether budget_amount is spent per day (daily) or over the campaign's full run (lifetime).

+ */ + _FinalStage budgetType(Optional budgetType); + + _FinalStage budgetType(AdCampaignBudgetType budgetType); + + _FinalStage budgetType(Nullable budgetType); + + /** + *

Spend divided by attributed add-to-cart events; null when they are not the goal and none are attributed.

+ */ + _FinalStage costPerAddedToCart(Optional costPerAddedToCart); + + _FinalStage costPerAddedToCart(Double costPerAddedToCart); + + _FinalStage costPerAddedToCart(Nullable costPerAddedToCart); + + /** + *

Spend divided by attributed complete-registration events; null when they are not the goal and none are attributed.

+ */ + _FinalStage costPerCompletedRegistration(Optional costPerCompletedRegistration); + + _FinalStage costPerCompletedRegistration(Double costPerCompletedRegistration); + + _FinalStage costPerCompletedRegistration(Nullable costPerCompletedRegistration); + + /** + *

Spend divided by attributed contact events; null when contacts are not the goal and none are attributed.

+ */ + _FinalStage costPerContact(Optional costPerContact); + + _FinalStage costPerContact(Double costPerContact); + + _FinalStage costPerContact(Nullable costPerContact); + + /** + *

Spend divided by attributed leads; null when leads are not a goal and none are attributed.

+ */ + _FinalStage costPerLead(Optional costPerLead); + + _FinalStage costPerLead(Double costPerLead); + + _FinalStage costPerLead(Nullable costPerLead); + + /** + *

Spend divided by attributed purchases; null when purchases are not a goal and none are attributed.

+ */ + _FinalStage costPerPurchase(Optional costPerPurchase); + + _FinalStage costPerPurchase(Double costPerPurchase); + + _FinalStage costPerPurchase(Nullable costPerPurchase); + + /** + *

Spend divided by Whop pixel-attributed results; null when nothing Whop-attributable is being optimized for.

+ */ + _FinalStage costPerResult(Optional costPerResult); + + _FinalStage costPerResult(Double costPerResult); + + _FinalStage costPerResult(Nullable costPerResult); + + /** + *

Spend divided by attributed schedule events; null when schedules are not the goal and none are attributed.

+ */ + _FinalStage costPerSchedule(Optional costPerSchedule); + + _FinalStage costPerSchedule(Double costPerSchedule); + + _FinalStage costPerSchedule(Nullable costPerSchedule); + + /** + *

Spend divided by attributed submit-application events; null when they are not the goal and none are attributed.

+ */ + _FinalStage costPerSubmittedApplication(Optional costPerSubmittedApplication); + + _FinalStage costPerSubmittedApplication(Double costPerSubmittedApplication); + + _FinalStage costPerSubmittedApplication(Nullable costPerSubmittedApplication); + + /** + *

Spend divided by unique clicks; null when there are no unique clicks.

+ */ + _FinalStage costPerUniqueClick(Optional costPerUniqueClick); + + _FinalStage costPerUniqueClick(Double costPerUniqueClick); + + _FinalStage costPerUniqueClick(Nullable costPerUniqueClick); + + /** + *

Spend divided by attributed view-content events; null when they are not the goal and none are attributed.

+ */ + _FinalStage costPerViewedContent(Optional costPerViewedContent); + + _FinalStage costPerViewedContent(Double costPerViewedContent); + + _FinalStage costPerViewedContent(Nullable costPerViewedContent); + + /** + *

Whop pixel-attributed custom conversions, keyed by your event name with its last-click count as the value. Empty when no named custom events are attributed. Custom events fired without a name are counted in custom_conversions but omitted here, so these values sum to at most custom_conversions.

+ */ + _FinalStage customEventCounts(Map customEventCounts); + + _FinalStage putAllCustomEventCounts(Map customEventCounts); + + _FinalStage customEventCounts(String key, Object value); + + /** + *

Conversion value attributed to each custom event, keyed by event name like custom_event_counts. Sums the value passed to whop.track, normalized to USD; events fired without a value contribute 0.

+ */ + _FinalStage customEventValues(Map customEventValues); + + _FinalStage putAllCustomEventValues(Map customEventValues); + + _FinalStage customEventValues(String key, Object value); + + /** + *

Platform-reported impressions divided by reach.

+ */ + _FinalStage frequency(Optional frequency); + + _FinalStage frequency(Double frequency); + + _FinalStage frequency(Nullable frequency); + + _FinalStage issues(List issues); + + _FinalStage addIssues(AdPlatformIssue issues); + + _FinalStage addAllIssues(List issues); + + /** + *

The goal the campaign optimizes toward.

+ */ + _FinalStage objective(Optional objective); + + _FinalStage objective(AdCampaignObjective objective); + + _FinalStage objective(Nullable objective); + + /** + *

The event the campaign optimizes for when a single goal is set campaign-wide. null when each ad group sets its own optimization_goal.

+ */ + _FinalStage optimizationGoal(Optional optimizationGoal); + + _FinalStage optimizationGoal(String optimizationGoal); + + _FinalStage optimizationGoal(Nullable optimizationGoal); + + /** + *

The Whop pixel conversion event whose attributed count represents results — the optimization goal, or the highest-volume attributed event for campaigns that budget per ad group. Null when the goal isn't a Whop-attributed event.

+ */ + _FinalStage resultEvent(Optional resultEvent); + + _FinalStage resultEvent(AdCampaignResultEvent resultEvent); + + _FinalStage resultEvent(Nullable resultEvent); + + /** + *

The merchant-defined event name when result_event is custom; null for the standard events.

+ */ + _FinalStage resultEventName(Optional resultEventName); + + _FinalStage resultEventName(String resultEventName); + + _FinalStage resultEventName(Nullable resultEventName); + + /** + *

The Whop pixel-attributed count behind result_event. When a campaign's ad groups optimize different goals there is no single result_event (it is null), and this is instead the sum of each ad group's own attributed results. Null when nothing Whop-attributable is being optimized for.

+ */ + _FinalStage results(Optional results); + + _FinalStage results(Double results); + + _FinalStage results(Nullable results); + + _FinalStage specialAdCategories(List specialAdCategories); + + _FinalStage addSpecialAdCategories(AdCampaignSpecialAdCategoriesItem specialAdCategories); + + _FinalStage addAllSpecialAdCategories(List specialAdCategories); + + /** + *

The ISO 4217 currency code of all monetary metrics.

+ */ + _FinalStage spendCurrency(Optional spendCurrency); + + _FinalStage spendCurrency(String spendCurrency); + + _FinalStage spendCurrency(Nullable spendCurrency); + + /** + *

Unique clicks divided by impressions, between 0 and 1.

+ */ + _FinalStage uniqueClickThroughRate(Optional uniqueClickThroughRate); + + _FinalStage uniqueClickThroughRate(Double uniqueClickThroughRate); + + _FinalStage uniqueClickThroughRate(Nullable uniqueClickThroughRate); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AddedToCartValueStage, + AddedToCartsStage, + ClickThroughRateStage, + ClicksStage, + CompletedRegistrationValueStage, + CompletedRegistrationsStage, + ContactValueStage, + ContactsStage, + CostPerClickStage, + CostPerMilleStage, + CreatedAtStage, + CustomConversionsStage, + DeliveryStatusStage, + IdStage, + ImpressionsStage, + LeadValueStage, + LeadsStage, + PlatformStage, + PurchaseValueStage, + PurchasesStage, + ReachStage, + ReturnOnAdSpendStage, + ScheduleValueStage, + SchedulesStage, + SpendStage, + StatusStage, + SubmittedApplicationValueStage, + SubmittedApplicationsStage, + TitleStage, + UniqueClicksStage, + UpdatedAtStage, + ViewedContentValueStage, + ViewedContentsStage, + _FinalStage { + private double addedToCartValue; + + private double addedToCarts; + + private double clickThroughRate; + + private double clicks; + + private double completedRegistrationValue; + + private double completedRegistrations; + + private double contactValue; + + private double contacts; + + private double costPerClick; + + private double costPerMille; + + private String createdAt; + + private double customConversions; + + private AdCampaignDeliveryStatus deliveryStatus; + + private String id; + + private double impressions; + + private double leadValue; + + private double leads; + + private AdCampaignPlatform platform; + + private double purchaseValue; + + private double purchases; + + private double reach; + + private double returnOnAdSpend; + + private double scheduleValue; + + private double schedules; + + private double spend; + + private AdCampaignStatus status; + + private double submittedApplicationValue; + + private double submittedApplications; + + private String title; + + private double uniqueClicks; + + private String updatedAt; + + private double viewedContentValue; + + private double viewedContents; + + private Optional uniqueClickThroughRate = Optional.empty(); + + private Optional spendCurrency = Optional.empty(); + + private List specialAdCategories = new ArrayList<>(); + + private Optional results = Optional.empty(); + + private Optional resultEventName = Optional.empty(); + + private Optional resultEvent = Optional.empty(); + + private Optional optimizationGoal = Optional.empty(); + + private Optional objective = Optional.empty(); + + private List issues = new ArrayList<>(); + + private Optional frequency = Optional.empty(); + + private Map customEventValues = new LinkedHashMap<>(); + + private Map customEventCounts = new LinkedHashMap<>(); + + private Optional costPerViewedContent = Optional.empty(); + + private Optional costPerUniqueClick = Optional.empty(); + + private Optional costPerSubmittedApplication = Optional.empty(); + + private Optional costPerSchedule = Optional.empty(); + + private Optional costPerResult = Optional.empty(); + + private Optional costPerPurchase = Optional.empty(); + + private Optional costPerLead = Optional.empty(); + + private Optional costPerContact = Optional.empty(); + + private Optional costPerCompletedRegistration = Optional.empty(); + + private Optional costPerAddedToCart = Optional.empty(); + + private Optional budgetType = Optional.empty(); + + private Optional budgetOptimization = Optional.empty(); + + private Optional budgetAmount = Optional.empty(); + + private Optional bidType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdCampaign other) { + addedToCartValue(other.getAddedToCartValue()); + addedToCarts(other.getAddedToCarts()); + bidType(other.getBidType()); + budgetAmount(other.getBudgetAmount()); + budgetOptimization(other.getBudgetOptimization()); + budgetType(other.getBudgetType()); + clickThroughRate(other.getClickThroughRate()); + clicks(other.getClicks()); + completedRegistrationValue(other.getCompletedRegistrationValue()); + completedRegistrations(other.getCompletedRegistrations()); + contactValue(other.getContactValue()); + contacts(other.getContacts()); + costPerAddedToCart(other.getCostPerAddedToCart()); + costPerClick(other.getCostPerClick()); + costPerCompletedRegistration(other.getCostPerCompletedRegistration()); + costPerContact(other.getCostPerContact()); + costPerLead(other.getCostPerLead()); + costPerMille(other.getCostPerMille()); + costPerPurchase(other.getCostPerPurchase()); + costPerResult(other.getCostPerResult()); + costPerSchedule(other.getCostPerSchedule()); + costPerSubmittedApplication(other.getCostPerSubmittedApplication()); + costPerUniqueClick(other.getCostPerUniqueClick()); + costPerViewedContent(other.getCostPerViewedContent()); + createdAt(other.getCreatedAt()); + customConversions(other.getCustomConversions()); + customEventCounts(other.getCustomEventCounts()); + customEventValues(other.getCustomEventValues()); + deliveryStatus(other.getDeliveryStatus()); + frequency(other.getFrequency()); + id(other.getId()); + impressions(other.getImpressions()); + issues(other.getIssues()); + leadValue(other.getLeadValue()); + leads(other.getLeads()); + objective(other.getObjective()); + optimizationGoal(other.getOptimizationGoal()); + platform(other.getPlatform()); + purchaseValue(other.getPurchaseValue()); + purchases(other.getPurchases()); + reach(other.getReach()); + resultEvent(other.getResultEvent()); + resultEventName(other.getResultEventName()); + results(other.getResults()); + returnOnAdSpend(other.getReturnOnAdSpend()); + scheduleValue(other.getScheduleValue()); + schedules(other.getSchedules()); + specialAdCategories(other.getSpecialAdCategories()); + spend(other.getSpend()); + spendCurrency(other.getSpendCurrency()); + status(other.getStatus()); + submittedApplicationValue(other.getSubmittedApplicationValue()); + submittedApplications(other.getSubmittedApplications()); + title(other.getTitle()); + uniqueClickThroughRate(other.getUniqueClickThroughRate()); + uniqueClicks(other.getUniqueClicks()); + updatedAt(other.getUpdatedAt()); + viewedContentValue(other.getViewedContentValue()); + viewedContents(other.getViewedContents()); + return this; + } + + /** + *

USD value attributed to add-to-cart events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to add-to-cart events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("added_to_cart_value") + public AddedToCartsStage addedToCartValue(double addedToCartValue) { + this.addedToCartValue = addedToCartValue; + return this; + } + + /** + *

Whop pixel-attributed add-to-cart events, last-click.

+ *

Whop pixel-attributed add-to-cart events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("added_to_carts") + public ClickThroughRateStage addedToCarts(double addedToCarts) { + this.addedToCarts = addedToCarts; + return this; + } + + /** + *

Clicks divided by impressions, between 0 and 1.

+ *

Clicks divided by impressions, between 0 and 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("click_through_rate") + public ClicksStage clickThroughRate(double clickThroughRate) { + this.clickThroughRate = clickThroughRate; + return this; + } + + /** + *

The number of clicks.

+ *

The number of clicks.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("clicks") + public CompletedRegistrationValueStage clicks(double clicks) { + this.clicks = clicks; + return this; + } + + /** + *

USD value attributed to complete-registration events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to complete-registration events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completed_registration_value") + public CompletedRegistrationsStage completedRegistrationValue(double completedRegistrationValue) { + this.completedRegistrationValue = completedRegistrationValue; + return this; + } + + /** + *

Whop pixel-attributed complete-registration events, last-click.

+ *

Whop pixel-attributed complete-registration events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completed_registrations") + public ContactValueStage completedRegistrations(double completedRegistrations) { + this.completedRegistrations = completedRegistrations; + return this; + } + + /** + *

USD value attributed to contact events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to contact events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("contact_value") + public ContactsStage contactValue(double contactValue) { + this.contactValue = contactValue; + return this; + } + + /** + *

Whop pixel-attributed contact events, last-click.

+ *

Whop pixel-attributed contact events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("contacts") + public CostPerClickStage contacts(double contacts) { + this.contacts = contacts; + return this; + } + + /** + *

Spend divided by clicks; 0 when there are no clicks.

+ *

Spend divided by clicks; 0 when there are no clicks.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cost_per_click") + public CostPerMilleStage costPerClick(double costPerClick) { + this.costPerClick = costPerClick; + return this; + } + + /** + *

Spend per 1,000 impressions; 0 when there are no impressions.

+ *

Spend per 1,000 impressions; 0 when there are no impressions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cost_per_mille") + public CreatedAtStage costPerMille(double costPerMille) { + this.costPerMille = costPerMille; + return this; + } + + /** + *

When the campaign was created, as an ISO 8601 timestamp.

+ *

When the campaign was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CustomConversionsStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Whop pixel-attributed custom (merchant-defined) conversion events, last-click, across all custom event names.

+ *

Whop pixel-attributed custom (merchant-defined) conversion events, last-click, across all custom event names.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("custom_conversions") + public DeliveryStatusStage customConversions(double customConversions) { + this.customConversions = customConversions; + return this; + } + + /** + *

Whether the campaign's ads are delivering right now, and if not, why. When several states apply at once, the highest-precedence one is returned.

+ *

Whether the campaign's ads are delivering right now, and if not, why. When several states apply at once, the highest-precedence one is returned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("delivery_status") + public IdStage deliveryStatus(@NotNull AdCampaignDeliveryStatus deliveryStatus) { + this.deliveryStatus = Objects.requireNonNull(deliveryStatus, "deliveryStatus must not be null"); + return this; + } + + /** + *

Unique identifier for the ad campaign, prefixed adcamp_.

+ *

Unique identifier for the ad campaign, prefixed adcamp_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ImpressionsStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The number of impressions.

+ *

The number of impressions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("impressions") + public LeadValueStage impressions(double impressions) { + this.impressions = impressions; + return this; + } + + /** + *

USD value attributed to lead events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to lead events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("lead_value") + public LeadsStage leadValue(double leadValue) { + this.leadValue = leadValue; + return this; + } + + /** + *

Whop pixel-attributed leads, last-click.

+ *

Whop pixel-attributed leads, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("leads") + public PlatformStage leads(double leads) { + this.leads = leads; + return this; + } + + /** + *

The ad network the campaign runs on.

+ *

The ad network the campaign runs on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public PurchaseValueStage platform(@NotNull AdCampaignPlatform platform) { + this.platform = Objects.requireNonNull(platform, "platform must not be null"); + return this; + } + + /** + *

USD value of pixel-attributed purchases.

+ *

USD value of pixel-attributed purchases.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("purchase_value") + public PurchasesStage purchaseValue(double purchaseValue) { + this.purchaseValue = purchaseValue; + return this; + } + + /** + *

Whop pixel-attributed purchases, last-click.

+ *

Whop pixel-attributed purchases, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("purchases") + public ReachStage purchases(double purchases) { + this.purchases = purchases; + return this; + } + + /** + *

The number of unique people who saw this.

+ *

The number of unique people who saw this.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reach") + public ReturnOnAdSpendStage reach(double reach) { + this.reach = reach; + return this; + } + + /** + *

Purchase value divided by spend, both in USD (a currency-neutral ratio); 0 when there is no spend.

+ *

Purchase value divided by spend, both in USD (a currency-neutral ratio); 0 when there is no spend.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("return_on_ad_spend") + public ScheduleValueStage returnOnAdSpend(double returnOnAdSpend) { + this.returnOnAdSpend = returnOnAdSpend; + return this; + } + + /** + *

USD value attributed to schedule events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to schedule events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("schedule_value") + public SchedulesStage scheduleValue(double scheduleValue) { + this.scheduleValue = scheduleValue; + return this; + } + + /** + *

Whop pixel-attributed schedule events, last-click.

+ *

Whop pixel-attributed schedule events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("schedules") + public SpendStage schedules(double schedules) { + this.schedules = schedules; + return this; + } + + /** + *

The amount charged, in spend_currency.

+ *

The amount charged, in spend_currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("spend") + public StatusStage spend(double spend) { + this.spend = spend; + return this; + } + + /** + *

The lifecycle status of the ad campaign.

+ *

The lifecycle status of the ad campaign.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public SubmittedApplicationValueStage status(@NotNull AdCampaignStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

USD value attributed to submit-application events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to submit-application events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("submitted_application_value") + public SubmittedApplicationsStage submittedApplicationValue(double submittedApplicationValue) { + this.submittedApplicationValue = submittedApplicationValue; + return this; + } + + /** + *

Whop pixel-attributed submit-application events, last-click.

+ *

Whop pixel-attributed submit-application events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("submitted_applications") + public TitleStage submittedApplications(double submittedApplications) { + this.submittedApplications = submittedApplications; + return this; + } + + /** + *

Display name of the ad campaign.

+ *

Display name of the ad campaign.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public UniqueClicksStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

People who clicked, reported by the Whop pixel, counted once per person.

+ *

People who clicked, reported by the Whop pixel, counted once per person.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("unique_clicks") + public UpdatedAtStage uniqueClicks(double uniqueClicks) { + this.uniqueClicks = uniqueClicks; + return this; + } + + /** + *

When the campaign was last updated, as an ISO 8601 timestamp.

+ *

When the campaign was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public ViewedContentValueStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

USD value attributed to view-content events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to view-content events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("viewed_content_value") + public ViewedContentsStage viewedContentValue(double viewedContentValue) { + this.viewedContentValue = viewedContentValue; + return this; + } + + /** + *

Whop pixel-attributed view-content events, last-click.

+ *

Whop pixel-attributed view-content events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("viewed_contents") + public _FinalStage viewedContents(double viewedContents) { + this.viewedContents = viewedContents; + return this; + } + + /** + *

Unique clicks divided by impressions, between 0 and 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage uniqueClickThroughRate(Nullable uniqueClickThroughRate) { + if (uniqueClickThroughRate.isNull()) { + this.uniqueClickThroughRate = null; + } else if (uniqueClickThroughRate.isEmpty()) { + this.uniqueClickThroughRate = Optional.empty(); + } else { + this.uniqueClickThroughRate = Optional.of(uniqueClickThroughRate.get()); + } + return this; + } + + /** + *

Unique clicks divided by impressions, between 0 and 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage uniqueClickThroughRate(Double uniqueClickThroughRate) { + this.uniqueClickThroughRate = Optional.ofNullable(uniqueClickThroughRate); + return this; + } + + /** + *

Unique clicks divided by impressions, between 0 and 1.

+ */ + @java.lang.Override + @JsonSetter(value = "unique_click_through_rate", nulls = Nulls.SKIP) + public _FinalStage uniqueClickThroughRate(Optional uniqueClickThroughRate) { + this.uniqueClickThroughRate = uniqueClickThroughRate; + return this; + } + + /** + *

The ISO 4217 currency code of all monetary metrics.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spendCurrency(Nullable spendCurrency) { + if (spendCurrency.isNull()) { + this.spendCurrency = null; + } else if (spendCurrency.isEmpty()) { + this.spendCurrency = Optional.empty(); + } else { + this.spendCurrency = Optional.of(spendCurrency.get()); + } + return this; + } + + /** + *

The ISO 4217 currency code of all monetary metrics.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spendCurrency(String spendCurrency) { + this.spendCurrency = Optional.ofNullable(spendCurrency); + return this; + } + + /** + *

The ISO 4217 currency code of all monetary metrics.

+ */ + @java.lang.Override + @JsonSetter(value = "spend_currency", nulls = Nulls.SKIP) + public _FinalStage spendCurrency(Optional spendCurrency) { + this.spendCurrency = spendCurrency; + return this; + } + + @java.lang.Override + public _FinalStage addAllSpecialAdCategories(List specialAdCategories) { + if (specialAdCategories != null) { + this.specialAdCategories.addAll(specialAdCategories); + } + return this; + } + + @java.lang.Override + public _FinalStage addSpecialAdCategories(AdCampaignSpecialAdCategoriesItem specialAdCategories) { + this.specialAdCategories.add(specialAdCategories); + return this; + } + + @java.lang.Override + @JsonSetter(value = "special_ad_categories", nulls = Nulls.SKIP) + public _FinalStage specialAdCategories(List specialAdCategories) { + this.specialAdCategories.clear(); + if (specialAdCategories != null) { + this.specialAdCategories.addAll(specialAdCategories); + } + return this; + } + + /** + *

The Whop pixel-attributed count behind result_event. When a campaign's ad groups optimize different goals there is no single result_event (it is null), and this is instead the sum of each ad group's own attributed results. Null when nothing Whop-attributable is being optimized for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage results(Nullable results) { + if (results.isNull()) { + this.results = null; + } else if (results.isEmpty()) { + this.results = Optional.empty(); + } else { + this.results = Optional.of(results.get()); + } + return this; + } + + /** + *

The Whop pixel-attributed count behind result_event. When a campaign's ad groups optimize different goals there is no single result_event (it is null), and this is instead the sum of each ad group's own attributed results. Null when nothing Whop-attributable is being optimized for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage results(Double results) { + this.results = Optional.ofNullable(results); + return this; + } + + /** + *

The Whop pixel-attributed count behind result_event. When a campaign's ad groups optimize different goals there is no single result_event (it is null), and this is instead the sum of each ad group's own attributed results. Null when nothing Whop-attributable is being optimized for.

+ */ + @java.lang.Override + @JsonSetter(value = "results", nulls = Nulls.SKIP) + public _FinalStage results(Optional results) { + this.results = results; + return this; + } + + /** + *

The merchant-defined event name when result_event is custom; null for the standard events.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultEventName(Nullable resultEventName) { + if (resultEventName.isNull()) { + this.resultEventName = null; + } else if (resultEventName.isEmpty()) { + this.resultEventName = Optional.empty(); + } else { + this.resultEventName = Optional.of(resultEventName.get()); + } + return this; + } + + /** + *

The merchant-defined event name when result_event is custom; null for the standard events.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultEventName(String resultEventName) { + this.resultEventName = Optional.ofNullable(resultEventName); + return this; + } + + /** + *

The merchant-defined event name when result_event is custom; null for the standard events.

+ */ + @java.lang.Override + @JsonSetter(value = "result_event_name", nulls = Nulls.SKIP) + public _FinalStage resultEventName(Optional resultEventName) { + this.resultEventName = resultEventName; + return this; + } + + /** + *

The Whop pixel conversion event whose attributed count represents results — the optimization goal, or the highest-volume attributed event for campaigns that budget per ad group. Null when the goal isn't a Whop-attributed event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultEvent(Nullable resultEvent) { + if (resultEvent.isNull()) { + this.resultEvent = null; + } else if (resultEvent.isEmpty()) { + this.resultEvent = Optional.empty(); + } else { + this.resultEvent = Optional.of(resultEvent.get()); + } + return this; + } + + /** + *

The Whop pixel conversion event whose attributed count represents results — the optimization goal, or the highest-volume attributed event for campaigns that budget per ad group. Null when the goal isn't a Whop-attributed event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultEvent(AdCampaignResultEvent resultEvent) { + this.resultEvent = Optional.ofNullable(resultEvent); + return this; + } + + /** + *

The Whop pixel conversion event whose attributed count represents results — the optimization goal, or the highest-volume attributed event for campaigns that budget per ad group. Null when the goal isn't a Whop-attributed event.

+ */ + @java.lang.Override + @JsonSetter(value = "result_event", nulls = Nulls.SKIP) + public _FinalStage resultEvent(Optional resultEvent) { + this.resultEvent = resultEvent; + return this; + } + + /** + *

The event the campaign optimizes for when a single goal is set campaign-wide. null when each ad group sets its own optimization_goal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optimizationGoal(Nullable optimizationGoal) { + if (optimizationGoal.isNull()) { + this.optimizationGoal = null; + } else if (optimizationGoal.isEmpty()) { + this.optimizationGoal = Optional.empty(); + } else { + this.optimizationGoal = Optional.of(optimizationGoal.get()); + } + return this; + } + + /** + *

The event the campaign optimizes for when a single goal is set campaign-wide. null when each ad group sets its own optimization_goal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optimizationGoal(String optimizationGoal) { + this.optimizationGoal = Optional.ofNullable(optimizationGoal); + return this; + } + + /** + *

The event the campaign optimizes for when a single goal is set campaign-wide. null when each ad group sets its own optimization_goal.

+ */ + @java.lang.Override + @JsonSetter(value = "optimization_goal", nulls = Nulls.SKIP) + public _FinalStage optimizationGoal(Optional optimizationGoal) { + this.optimizationGoal = optimizationGoal; + return this; + } + + /** + *

The goal the campaign optimizes toward.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage objective(Nullable objective) { + if (objective.isNull()) { + this.objective = null; + } else if (objective.isEmpty()) { + this.objective = Optional.empty(); + } else { + this.objective = Optional.of(objective.get()); + } + return this; + } + + /** + *

The goal the campaign optimizes toward.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage objective(AdCampaignObjective objective) { + this.objective = Optional.ofNullable(objective); + return this; + } + + /** + *

The goal the campaign optimizes toward.

+ */ + @java.lang.Override + @JsonSetter(value = "objective", nulls = Nulls.SKIP) + public _FinalStage objective(Optional objective) { + this.objective = objective; + return this; + } + + @java.lang.Override + public _FinalStage addAllIssues(List issues) { + if (issues != null) { + this.issues.addAll(issues); + } + return this; + } + + @java.lang.Override + public _FinalStage addIssues(AdPlatformIssue issues) { + this.issues.add(issues); + return this; + } + + @java.lang.Override + @JsonSetter(value = "issues", nulls = Nulls.SKIP) + public _FinalStage issues(List issues) { + this.issues.clear(); + if (issues != null) { + this.issues.addAll(issues); + } + return this; + } + + /** + *

Platform-reported impressions divided by reach.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frequency(Nullable frequency) { + if (frequency.isNull()) { + this.frequency = null; + } else if (frequency.isEmpty()) { + this.frequency = Optional.empty(); + } else { + this.frequency = Optional.of(frequency.get()); + } + return this; + } + + /** + *

Platform-reported impressions divided by reach.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frequency(Double frequency) { + this.frequency = Optional.ofNullable(frequency); + return this; + } + + /** + *

Platform-reported impressions divided by reach.

+ */ + @java.lang.Override + @JsonSetter(value = "frequency", nulls = Nulls.SKIP) + public _FinalStage frequency(Optional frequency) { + this.frequency = frequency; + return this; + } + + /** + *

Conversion value attributed to each custom event, keyed by event name like custom_event_counts. Sums the value passed to whop.track, normalized to USD; events fired without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customEventValues(String key, Object value) { + this.customEventValues.put(key, value); + return this; + } + + /** + *

Conversion value attributed to each custom event, keyed by event name like custom_event_counts. Sums the value passed to whop.track, normalized to USD; events fired without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllCustomEventValues(Map customEventValues) { + if (customEventValues != null) { + this.customEventValues.putAll(customEventValues); + } + return this; + } + + /** + *

Conversion value attributed to each custom event, keyed by event name like custom_event_counts. Sums the value passed to whop.track, normalized to USD; events fired without a value contribute 0.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_event_values", nulls = Nulls.SKIP) + public _FinalStage customEventValues(Map customEventValues) { + this.customEventValues.clear(); + if (customEventValues != null) { + this.customEventValues.putAll(customEventValues); + } + return this; + } + + /** + *

Whop pixel-attributed custom conversions, keyed by your event name with its last-click count as the value. Empty when no named custom events are attributed. Custom events fired without a name are counted in custom_conversions but omitted here, so these values sum to at most custom_conversions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customEventCounts(String key, Object value) { + this.customEventCounts.put(key, value); + return this; + } + + /** + *

Whop pixel-attributed custom conversions, keyed by your event name with its last-click count as the value. Empty when no named custom events are attributed. Custom events fired without a name are counted in custom_conversions but omitted here, so these values sum to at most custom_conversions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllCustomEventCounts(Map customEventCounts) { + if (customEventCounts != null) { + this.customEventCounts.putAll(customEventCounts); + } + return this; + } + + /** + *

Whop pixel-attributed custom conversions, keyed by your event name with its last-click count as the value. Empty when no named custom events are attributed. Custom events fired without a name are counted in custom_conversions but omitted here, so these values sum to at most custom_conversions.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_event_counts", nulls = Nulls.SKIP) + public _FinalStage customEventCounts(Map customEventCounts) { + this.customEventCounts.clear(); + if (customEventCounts != null) { + this.customEventCounts.putAll(customEventCounts); + } + return this; + } + + /** + *

Spend divided by attributed view-content events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerViewedContent(Nullable costPerViewedContent) { + if (costPerViewedContent.isNull()) { + this.costPerViewedContent = null; + } else if (costPerViewedContent.isEmpty()) { + this.costPerViewedContent = Optional.empty(); + } else { + this.costPerViewedContent = Optional.of(costPerViewedContent.get()); + } + return this; + } + + /** + *

Spend divided by attributed view-content events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerViewedContent(Double costPerViewedContent) { + this.costPerViewedContent = Optional.ofNullable(costPerViewedContent); + return this; + } + + /** + *

Spend divided by attributed view-content events; null when they are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_viewed_content", nulls = Nulls.SKIP) + public _FinalStage costPerViewedContent(Optional costPerViewedContent) { + this.costPerViewedContent = costPerViewedContent; + return this; + } + + /** + *

Spend divided by unique clicks; null when there are no unique clicks.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerUniqueClick(Nullable costPerUniqueClick) { + if (costPerUniqueClick.isNull()) { + this.costPerUniqueClick = null; + } else if (costPerUniqueClick.isEmpty()) { + this.costPerUniqueClick = Optional.empty(); + } else { + this.costPerUniqueClick = Optional.of(costPerUniqueClick.get()); + } + return this; + } + + /** + *

Spend divided by unique clicks; null when there are no unique clicks.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerUniqueClick(Double costPerUniqueClick) { + this.costPerUniqueClick = Optional.ofNullable(costPerUniqueClick); + return this; + } + + /** + *

Spend divided by unique clicks; null when there are no unique clicks.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_unique_click", nulls = Nulls.SKIP) + public _FinalStage costPerUniqueClick(Optional costPerUniqueClick) { + this.costPerUniqueClick = costPerUniqueClick; + return this; + } + + /** + *

Spend divided by attributed submit-application events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerSubmittedApplication(Nullable costPerSubmittedApplication) { + if (costPerSubmittedApplication.isNull()) { + this.costPerSubmittedApplication = null; + } else if (costPerSubmittedApplication.isEmpty()) { + this.costPerSubmittedApplication = Optional.empty(); + } else { + this.costPerSubmittedApplication = Optional.of(costPerSubmittedApplication.get()); + } + return this; + } + + /** + *

Spend divided by attributed submit-application events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerSubmittedApplication(Double costPerSubmittedApplication) { + this.costPerSubmittedApplication = Optional.ofNullable(costPerSubmittedApplication); + return this; + } + + /** + *

Spend divided by attributed submit-application events; null when they are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_submitted_application", nulls = Nulls.SKIP) + public _FinalStage costPerSubmittedApplication(Optional costPerSubmittedApplication) { + this.costPerSubmittedApplication = costPerSubmittedApplication; + return this; + } + + /** + *

Spend divided by attributed schedule events; null when schedules are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerSchedule(Nullable costPerSchedule) { + if (costPerSchedule.isNull()) { + this.costPerSchedule = null; + } else if (costPerSchedule.isEmpty()) { + this.costPerSchedule = Optional.empty(); + } else { + this.costPerSchedule = Optional.of(costPerSchedule.get()); + } + return this; + } + + /** + *

Spend divided by attributed schedule events; null when schedules are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerSchedule(Double costPerSchedule) { + this.costPerSchedule = Optional.ofNullable(costPerSchedule); + return this; + } + + /** + *

Spend divided by attributed schedule events; null when schedules are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_schedule", nulls = Nulls.SKIP) + public _FinalStage costPerSchedule(Optional costPerSchedule) { + this.costPerSchedule = costPerSchedule; + return this; + } + + /** + *

Spend divided by Whop pixel-attributed results; null when nothing Whop-attributable is being optimized for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerResult(Nullable costPerResult) { + if (costPerResult.isNull()) { + this.costPerResult = null; + } else if (costPerResult.isEmpty()) { + this.costPerResult = Optional.empty(); + } else { + this.costPerResult = Optional.of(costPerResult.get()); + } + return this; + } + + /** + *

Spend divided by Whop pixel-attributed results; null when nothing Whop-attributable is being optimized for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerResult(Double costPerResult) { + this.costPerResult = Optional.ofNullable(costPerResult); + return this; + } + + /** + *

Spend divided by Whop pixel-attributed results; null when nothing Whop-attributable is being optimized for.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_result", nulls = Nulls.SKIP) + public _FinalStage costPerResult(Optional costPerResult) { + this.costPerResult = costPerResult; + return this; + } + + /** + *

Spend divided by attributed purchases; null when purchases are not a goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerPurchase(Nullable costPerPurchase) { + if (costPerPurchase.isNull()) { + this.costPerPurchase = null; + } else if (costPerPurchase.isEmpty()) { + this.costPerPurchase = Optional.empty(); + } else { + this.costPerPurchase = Optional.of(costPerPurchase.get()); + } + return this; + } + + /** + *

Spend divided by attributed purchases; null when purchases are not a goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerPurchase(Double costPerPurchase) { + this.costPerPurchase = Optional.ofNullable(costPerPurchase); + return this; + } + + /** + *

Spend divided by attributed purchases; null when purchases are not a goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_purchase", nulls = Nulls.SKIP) + public _FinalStage costPerPurchase(Optional costPerPurchase) { + this.costPerPurchase = costPerPurchase; + return this; + } + + /** + *

Spend divided by attributed leads; null when leads are not a goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerLead(Nullable costPerLead) { + if (costPerLead.isNull()) { + this.costPerLead = null; + } else if (costPerLead.isEmpty()) { + this.costPerLead = Optional.empty(); + } else { + this.costPerLead = Optional.of(costPerLead.get()); + } + return this; + } + + /** + *

Spend divided by attributed leads; null when leads are not a goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerLead(Double costPerLead) { + this.costPerLead = Optional.ofNullable(costPerLead); + return this; + } + + /** + *

Spend divided by attributed leads; null when leads are not a goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_lead", nulls = Nulls.SKIP) + public _FinalStage costPerLead(Optional costPerLead) { + this.costPerLead = costPerLead; + return this; + } + + /** + *

Spend divided by attributed contact events; null when contacts are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerContact(Nullable costPerContact) { + if (costPerContact.isNull()) { + this.costPerContact = null; + } else if (costPerContact.isEmpty()) { + this.costPerContact = Optional.empty(); + } else { + this.costPerContact = Optional.of(costPerContact.get()); + } + return this; + } + + /** + *

Spend divided by attributed contact events; null when contacts are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerContact(Double costPerContact) { + this.costPerContact = Optional.ofNullable(costPerContact); + return this; + } + + /** + *

Spend divided by attributed contact events; null when contacts are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_contact", nulls = Nulls.SKIP) + public _FinalStage costPerContact(Optional costPerContact) { + this.costPerContact = costPerContact; + return this; + } + + /** + *

Spend divided by attributed complete-registration events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerCompletedRegistration(Nullable costPerCompletedRegistration) { + if (costPerCompletedRegistration.isNull()) { + this.costPerCompletedRegistration = null; + } else if (costPerCompletedRegistration.isEmpty()) { + this.costPerCompletedRegistration = Optional.empty(); + } else { + this.costPerCompletedRegistration = Optional.of(costPerCompletedRegistration.get()); + } + return this; + } + + /** + *

Spend divided by attributed complete-registration events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerCompletedRegistration(Double costPerCompletedRegistration) { + this.costPerCompletedRegistration = Optional.ofNullable(costPerCompletedRegistration); + return this; + } + + /** + *

Spend divided by attributed complete-registration events; null when they are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_completed_registration", nulls = Nulls.SKIP) + public _FinalStage costPerCompletedRegistration(Optional costPerCompletedRegistration) { + this.costPerCompletedRegistration = costPerCompletedRegistration; + return this; + } + + /** + *

Spend divided by attributed add-to-cart events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerAddedToCart(Nullable costPerAddedToCart) { + if (costPerAddedToCart.isNull()) { + this.costPerAddedToCart = null; + } else if (costPerAddedToCart.isEmpty()) { + this.costPerAddedToCart = Optional.empty(); + } else { + this.costPerAddedToCart = Optional.of(costPerAddedToCart.get()); + } + return this; + } + + /** + *

Spend divided by attributed add-to-cart events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerAddedToCart(Double costPerAddedToCart) { + this.costPerAddedToCart = Optional.ofNullable(costPerAddedToCart); + return this; + } + + /** + *

Spend divided by attributed add-to-cart events; null when they are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_added_to_cart", nulls = Nulls.SKIP) + public _FinalStage costPerAddedToCart(Optional costPerAddedToCart) { + this.costPerAddedToCart = costPerAddedToCart; + return this; + } + + /** + *

Whether budget_amount is spent per day (daily) or over the campaign's full run (lifetime).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage budgetType(Nullable budgetType) { + if (budgetType.isNull()) { + this.budgetType = null; + } else if (budgetType.isEmpty()) { + this.budgetType = Optional.empty(); + } else { + this.budgetType = Optional.of(budgetType.get()); + } + return this; + } + + /** + *

Whether budget_amount is spent per day (daily) or over the campaign's full run (lifetime).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage budgetType(AdCampaignBudgetType budgetType) { + this.budgetType = Optional.ofNullable(budgetType); + return this; + } + + /** + *

Whether budget_amount is spent per day (daily) or over the campaign's full run (lifetime).

+ */ + @java.lang.Override + @JsonSetter(value = "budget_type", nulls = Nulls.SKIP) + public _FinalStage budgetType(Optional budgetType) { + this.budgetType = budgetType; + return this; + } + + /** + *

Which level owns the budget: the whole campaign (ad_campaign) or each ad group individually (ad_group).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage budgetOptimization(Nullable budgetOptimization) { + if (budgetOptimization.isNull()) { + this.budgetOptimization = null; + } else if (budgetOptimization.isEmpty()) { + this.budgetOptimization = Optional.empty(); + } else { + this.budgetOptimization = Optional.of(budgetOptimization.get()); + } + return this; + } + + /** + *

Which level owns the budget: the whole campaign (ad_campaign) or each ad group individually (ad_group).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage budgetOptimization(AdCampaignBudgetOptimization budgetOptimization) { + this.budgetOptimization = Optional.ofNullable(budgetOptimization); + return this; + } + + /** + *

Which level owns the budget: the whole campaign (ad_campaign) or each ad group individually (ad_group).

+ */ + @java.lang.Override + @JsonSetter(value = "budget_optimization", nulls = Nulls.SKIP) + public _FinalStage budgetOptimization(Optional budgetOptimization) { + this.budgetOptimization = budgetOptimization; + return this; + } + + /** + *

The campaign's budget, in the ad account's currency. null when each ad group sets its own budget instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage budgetAmount(Nullable budgetAmount) { + if (budgetAmount.isNull()) { + this.budgetAmount = null; + } else if (budgetAmount.isEmpty()) { + this.budgetAmount = Optional.empty(); + } else { + this.budgetAmount = Optional.of(budgetAmount.get()); + } + return this; + } + + /** + *

The campaign's budget, in the ad account's currency. null when each ad group sets its own budget instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage budgetAmount(Double budgetAmount) { + this.budgetAmount = Optional.ofNullable(budgetAmount); + return this; + } + + /** + *

The campaign's budget, in the ad account's currency. null when each ad group sets its own budget instead.

+ */ + @java.lang.Override + @JsonSetter(value = "budget_amount", nulls = Nulls.SKIP) + public _FinalStage budgetAmount(Optional budgetAmount) { + this.budgetAmount = budgetAmount; + return this; + } + + /** + *

How delivery bids in the ad auction: minimum_cost gets the most results for the budget, average_target holds an average cost per result, and maximum_target never bids above a cap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bidType(Nullable bidType) { + if (bidType.isNull()) { + this.bidType = null; + } else if (bidType.isEmpty()) { + this.bidType = Optional.empty(); + } else { + this.bidType = Optional.of(bidType.get()); + } + return this; + } + + /** + *

How delivery bids in the ad auction: minimum_cost gets the most results for the budget, average_target holds an average cost per result, and maximum_target never bids above a cap.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bidType(AdCampaignBidType bidType) { + this.bidType = Optional.ofNullable(bidType); + return this; + } + + /** + *

How delivery bids in the ad auction: minimum_cost gets the most results for the budget, average_target holds an average cost per result, and maximum_target never bids above a cap.

+ */ + @java.lang.Override + @JsonSetter(value = "bid_type", nulls = Nulls.SKIP) + public _FinalStage bidType(Optional bidType) { + this.bidType = bidType; + return this; + } + + @java.lang.Override + public AdCampaign build() { + return new AdCampaign( + addedToCartValue, + addedToCarts, + bidType, + budgetAmount, + budgetOptimization, + budgetType, + clickThroughRate, + clicks, + completedRegistrationValue, + completedRegistrations, + contactValue, + contacts, + costPerAddedToCart, + costPerClick, + costPerCompletedRegistration, + costPerContact, + costPerLead, + costPerMille, + costPerPurchase, + costPerResult, + costPerSchedule, + costPerSubmittedApplication, + costPerUniqueClick, + costPerViewedContent, + createdAt, + customConversions, + customEventCounts, + customEventValues, + deliveryStatus, + frequency, + id, + impressions, + issues, + leadValue, + leads, + objective, + optimizationGoal, + platform, + purchaseValue, + purchases, + reach, + resultEvent, + resultEventName, + results, + returnOnAdSpend, + scheduleValue, + schedules, + specialAdCategories, + spend, + spendCurrency, + status, + submittedApplicationValue, + submittedApplications, + title, + uniqueClickThroughRate, + uniqueClicks, + updatedAt, + viewedContentValue, + viewedContents, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdCampaignBidType.java b/src/main/java/com/whop/api/types/AdCampaignBidType.java new file mode 100644 index 00000000..fc13b9dc --- /dev/null +++ b/src/main/java/com/whop/api/types/AdCampaignBidType.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdCampaignBidType { + public static final AdCampaignBidType AVERAGE_TARGET = + new AdCampaignBidType(Value.AVERAGE_TARGET, "average_target"); + + public static final AdCampaignBidType MAXIMUM_TARGET = + new AdCampaignBidType(Value.MAXIMUM_TARGET, "maximum_target"); + + public static final AdCampaignBidType MINIMUM_COST = new AdCampaignBidType(Value.MINIMUM_COST, "minimum_cost"); + + private final Value value; + + private final String string; + + AdCampaignBidType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdCampaignBidType && this.string.equals(((AdCampaignBidType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AVERAGE_TARGET: + return visitor.visitAverageTarget(); + case MAXIMUM_TARGET: + return visitor.visitMaximumTarget(); + case MINIMUM_COST: + return visitor.visitMinimumCost(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdCampaignBidType valueOf(String value) { + switch (value) { + case "average_target": + return AVERAGE_TARGET; + case "maximum_target": + return MAXIMUM_TARGET; + case "minimum_cost": + return MINIMUM_COST; + default: + return new AdCampaignBidType(Value.UNKNOWN, value); + } + } + + public enum Value { + MINIMUM_COST, + + AVERAGE_TARGET, + + MAXIMUM_TARGET, + + UNKNOWN + } + + public interface Visitor { + T visitMinimumCost(); + + T visitAverageTarget(); + + T visitMaximumTarget(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdCampaignBudgetOptimization.java b/src/main/java/com/whop/api/types/AdCampaignBudgetOptimization.java new file mode 100644 index 00000000..82e03a92 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdCampaignBudgetOptimization.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdCampaignBudgetOptimization { + public static final AdCampaignBudgetOptimization AD_GROUP = + new AdCampaignBudgetOptimization(Value.AD_GROUP, "ad_group"); + + public static final AdCampaignBudgetOptimization AD_CAMPAIGN = + new AdCampaignBudgetOptimization(Value.AD_CAMPAIGN, "ad_campaign"); + + private final Value value; + + private final String string; + + AdCampaignBudgetOptimization(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdCampaignBudgetOptimization + && this.string.equals(((AdCampaignBudgetOptimization) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AD_GROUP: + return visitor.visitAdGroup(); + case AD_CAMPAIGN: + return visitor.visitAdCampaign(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdCampaignBudgetOptimization valueOf(String value) { + switch (value) { + case "ad_group": + return AD_GROUP; + case "ad_campaign": + return AD_CAMPAIGN; + default: + return new AdCampaignBudgetOptimization(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_CAMPAIGN, + + AD_GROUP, + + UNKNOWN + } + + public interface Visitor { + T visitAdCampaign(); + + T visitAdGroup(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdCampaignBudgetType.java b/src/main/java/com/whop/api/types/AdCampaignBudgetType.java new file mode 100644 index 00000000..992d42ae --- /dev/null +++ b/src/main/java/com/whop/api/types/AdCampaignBudgetType.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdCampaignBudgetType { + public static final AdCampaignBudgetType DAILY = new AdCampaignBudgetType(Value.DAILY, "daily"); + + public static final AdCampaignBudgetType LIFETIME = new AdCampaignBudgetType(Value.LIFETIME, "lifetime"); + + private final Value value; + + private final String string; + + AdCampaignBudgetType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdCampaignBudgetType && this.string.equals(((AdCampaignBudgetType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DAILY: + return visitor.visitDaily(); + case LIFETIME: + return visitor.visitLifetime(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdCampaignBudgetType valueOf(String value) { + switch (value) { + case "daily": + return DAILY; + case "lifetime": + return LIFETIME; + default: + return new AdCampaignBudgetType(Value.UNKNOWN, value); + } + } + + public enum Value { + DAILY, + + LIFETIME, + + UNKNOWN + } + + public interface Visitor { + T visitDaily(); + + T visitLifetime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdCampaignDeliveryStatus.java b/src/main/java/com/whop/api/types/AdCampaignDeliveryStatus.java new file mode 100644 index 00000000..6bb7c966 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdCampaignDeliveryStatus.java @@ -0,0 +1,189 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdCampaignDeliveryStatus { + public static final AdCampaignDeliveryStatus NO_ADS = new AdCampaignDeliveryStatus(Value.NO_ADS, "no_ads"); + + public static final AdCampaignDeliveryStatus PROCESSING = + new AdCampaignDeliveryStatus(Value.PROCESSING, "processing"); + + public static final AdCampaignDeliveryStatus COMPLETED = new AdCampaignDeliveryStatus(Value.COMPLETED, "completed"); + + public static final AdCampaignDeliveryStatus NO_AD_GROUPS = + new AdCampaignDeliveryStatus(Value.NO_AD_GROUPS, "no_ad_groups"); + + public static final AdCampaignDeliveryStatus ALL_ADS_REJECTED = + new AdCampaignDeliveryStatus(Value.ALL_ADS_REJECTED, "all_ads_rejected"); + + public static final AdCampaignDeliveryStatus PAUSED = new AdCampaignDeliveryStatus(Value.PAUSED, "paused"); + + public static final AdCampaignDeliveryStatus SCHEDULED = new AdCampaignDeliveryStatus(Value.SCHEDULED, "scheduled"); + + public static final AdCampaignDeliveryStatus PAYMENT_FAILED = + new AdCampaignDeliveryStatus(Value.PAYMENT_FAILED, "payment_failed"); + + public static final AdCampaignDeliveryStatus ISSUES = new AdCampaignDeliveryStatus(Value.ISSUES, "issues"); + + public static final AdCampaignDeliveryStatus DRAFT = new AdCampaignDeliveryStatus(Value.DRAFT, "draft"); + + public static final AdCampaignDeliveryStatus AD_GROUPS_OFF = + new AdCampaignDeliveryStatus(Value.AD_GROUPS_OFF, "ad_groups_off"); + + public static final AdCampaignDeliveryStatus ACTIVE = new AdCampaignDeliveryStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AdCampaignDeliveryStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdCampaignDeliveryStatus + && this.string.equals(((AdCampaignDeliveryStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NO_ADS: + return visitor.visitNoAds(); + case PROCESSING: + return visitor.visitProcessing(); + case COMPLETED: + return visitor.visitCompleted(); + case NO_AD_GROUPS: + return visitor.visitNoAdGroups(); + case ALL_ADS_REJECTED: + return visitor.visitAllAdsRejected(); + case PAUSED: + return visitor.visitPaused(); + case SCHEDULED: + return visitor.visitScheduled(); + case PAYMENT_FAILED: + return visitor.visitPaymentFailed(); + case ISSUES: + return visitor.visitIssues(); + case DRAFT: + return visitor.visitDraft(); + case AD_GROUPS_OFF: + return visitor.visitAdGroupsOff(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdCampaignDeliveryStatus valueOf(String value) { + switch (value) { + case "no_ads": + return NO_ADS; + case "processing": + return PROCESSING; + case "completed": + return COMPLETED; + case "no_ad_groups": + return NO_AD_GROUPS; + case "all_ads_rejected": + return ALL_ADS_REJECTED; + case "paused": + return PAUSED; + case "scheduled": + return SCHEDULED; + case "payment_failed": + return PAYMENT_FAILED; + case "issues": + return ISSUES; + case "draft": + return DRAFT; + case "ad_groups_off": + return AD_GROUPS_OFF; + case "active": + return ACTIVE; + default: + return new AdCampaignDeliveryStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYMENT_FAILED, + + ALL_ADS_REJECTED, + + DRAFT, + + NO_AD_GROUPS, + + NO_ADS, + + PAUSED, + + PROCESSING, + + ISSUES, + + SCHEDULED, + + COMPLETED, + + AD_GROUPS_OFF, + + ACTIVE, + + UNKNOWN + } + + public interface Visitor { + T visitPaymentFailed(); + + T visitAllAdsRejected(); + + T visitDraft(); + + T visitNoAdGroups(); + + T visitNoAds(); + + T visitPaused(); + + T visitProcessing(); + + T visitIssues(); + + T visitScheduled(); + + T visitCompleted(); + + T visitAdGroupsOff(); + + T visitActive(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdCampaignObjective.java b/src/main/java/com/whop/api/types/AdCampaignObjective.java new file mode 100644 index 00000000..5ad6d162 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdCampaignObjective.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdCampaignObjective { + public static final AdCampaignObjective LEADS = new AdCampaignObjective(Value.LEADS, "leads"); + + public static final AdCampaignObjective SALES = new AdCampaignObjective(Value.SALES, "sales"); + + public static final AdCampaignObjective AWARENESS = new AdCampaignObjective(Value.AWARENESS, "awareness"); + + public static final AdCampaignObjective TRAFFIC = new AdCampaignObjective(Value.TRAFFIC, "traffic"); + + public static final AdCampaignObjective ENGAGEMENT = new AdCampaignObjective(Value.ENGAGEMENT, "engagement"); + + private final Value value; + + private final String string; + + AdCampaignObjective(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdCampaignObjective && this.string.equals(((AdCampaignObjective) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LEADS: + return visitor.visitLeads(); + case SALES: + return visitor.visitSales(); + case AWARENESS: + return visitor.visitAwareness(); + case TRAFFIC: + return visitor.visitTraffic(); + case ENGAGEMENT: + return visitor.visitEngagement(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdCampaignObjective valueOf(String value) { + switch (value) { + case "leads": + return LEADS; + case "sales": + return SALES; + case "awareness": + return AWARENESS; + case "traffic": + return TRAFFIC; + case "engagement": + return ENGAGEMENT; + default: + return new AdCampaignObjective(Value.UNKNOWN, value); + } + } + + public enum Value { + AWARENESS, + + TRAFFIC, + + ENGAGEMENT, + + LEADS, + + SALES, + + UNKNOWN + } + + public interface Visitor { + T visitAwareness(); + + T visitTraffic(); + + T visitEngagement(); + + T visitLeads(); + + T visitSales(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdCampaignPlatform.java b/src/main/java/com/whop/api/types/AdCampaignPlatform.java new file mode 100644 index 00000000..70a6c74e --- /dev/null +++ b/src/main/java/com/whop/api/types/AdCampaignPlatform.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdCampaignPlatform { + public static final AdCampaignPlatform META = new AdCampaignPlatform(Value.META, "meta"); + + public static final AdCampaignPlatform TIKTOK = new AdCampaignPlatform(Value.TIKTOK, "tiktok"); + + private final Value value; + + private final String string; + + AdCampaignPlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdCampaignPlatform && this.string.equals(((AdCampaignPlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case META: + return visitor.visitMeta(); + case TIKTOK: + return visitor.visitTiktok(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdCampaignPlatform valueOf(String value) { + switch (value) { + case "meta": + return META; + case "tiktok": + return TIKTOK; + default: + return new AdCampaignPlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + META, + + TIKTOK, + + UNKNOWN + } + + public interface Visitor { + T visitMeta(); + + T visitTiktok(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdCampaignResultEvent.java b/src/main/java/com/whop/api/types/AdCampaignResultEvent.java new file mode 100644 index 00000000..72a51630 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdCampaignResultEvent.java @@ -0,0 +1,168 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdCampaignResultEvent { + public static final AdCampaignResultEvent PURCHASE = new AdCampaignResultEvent(Value.PURCHASE, "purchase"); + + public static final AdCampaignResultEvent SUBMIT_APPLICATION = + new AdCampaignResultEvent(Value.SUBMIT_APPLICATION, "submit_application"); + + public static final AdCampaignResultEvent SCHEDULE = new AdCampaignResultEvent(Value.SCHEDULE, "schedule"); + + public static final AdCampaignResultEvent COMPLETE_REGISTRATION = + new AdCampaignResultEvent(Value.COMPLETE_REGISTRATION, "complete_registration"); + + public static final AdCampaignResultEvent ADD_TO_CART = new AdCampaignResultEvent(Value.ADD_TO_CART, "add_to_cart"); + + public static final AdCampaignResultEvent CUSTOM = new AdCampaignResultEvent(Value.CUSTOM, "custom"); + + public static final AdCampaignResultEvent CONTACT = new AdCampaignResultEvent(Value.CONTACT, "contact"); + + public static final AdCampaignResultEvent MESSAGING_CONVERSATION = + new AdCampaignResultEvent(Value.MESSAGING_CONVERSATION, "messaging_conversation"); + + public static final AdCampaignResultEvent VIEW_CONTENT = + new AdCampaignResultEvent(Value.VIEW_CONTENT, "view_content"); + + public static final AdCampaignResultEvent LEAD = new AdCampaignResultEvent(Value.LEAD, "lead"); + + private final Value value; + + private final String string; + + AdCampaignResultEvent(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdCampaignResultEvent + && this.string.equals(((AdCampaignResultEvent) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PURCHASE: + return visitor.visitPurchase(); + case SUBMIT_APPLICATION: + return visitor.visitSubmitApplication(); + case SCHEDULE: + return visitor.visitSchedule(); + case COMPLETE_REGISTRATION: + return visitor.visitCompleteRegistration(); + case ADD_TO_CART: + return visitor.visitAddToCart(); + case CUSTOM: + return visitor.visitCustom(); + case CONTACT: + return visitor.visitContact(); + case MESSAGING_CONVERSATION: + return visitor.visitMessagingConversation(); + case VIEW_CONTENT: + return visitor.visitViewContent(); + case LEAD: + return visitor.visitLead(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdCampaignResultEvent valueOf(String value) { + switch (value) { + case "purchase": + return PURCHASE; + case "submit_application": + return SUBMIT_APPLICATION; + case "schedule": + return SCHEDULE; + case "complete_registration": + return COMPLETE_REGISTRATION; + case "add_to_cart": + return ADD_TO_CART; + case "custom": + return CUSTOM; + case "contact": + return CONTACT; + case "messaging_conversation": + return MESSAGING_CONVERSATION; + case "view_content": + return VIEW_CONTENT; + case "lead": + return LEAD; + default: + return new AdCampaignResultEvent(Value.UNKNOWN, value); + } + } + + public enum Value { + PURCHASE, + + LEAD, + + SCHEDULE, + + SUBMIT_APPLICATION, + + CONTACT, + + COMPLETE_REGISTRATION, + + VIEW_CONTENT, + + ADD_TO_CART, + + CUSTOM, + + MESSAGING_CONVERSATION, + + UNKNOWN + } + + public interface Visitor { + T visitPurchase(); + + T visitLead(); + + T visitSchedule(); + + T visitSubmitApplication(); + + T visitContact(); + + T visitCompleteRegistration(); + + T visitViewContent(); + + T visitAddToCart(); + + T visitCustom(); + + T visitMessagingConversation(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdCampaignSpecialAdCategoriesItem.java b/src/main/java/com/whop/api/types/AdCampaignSpecialAdCategoriesItem.java new file mode 100644 index 00000000..8bfb5818 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdCampaignSpecialAdCategoriesItem.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdCampaignSpecialAdCategoriesItem { + public static final AdCampaignSpecialAdCategoriesItem EMPLOYMENT = + new AdCampaignSpecialAdCategoriesItem(Value.EMPLOYMENT, "employment"); + + public static final AdCampaignSpecialAdCategoriesItem HOUSING = + new AdCampaignSpecialAdCategoriesItem(Value.HOUSING, "housing"); + + public static final AdCampaignSpecialAdCategoriesItem POLITICS = + new AdCampaignSpecialAdCategoriesItem(Value.POLITICS, "politics"); + + public static final AdCampaignSpecialAdCategoriesItem FINANCIAL_PRODUCTS = + new AdCampaignSpecialAdCategoriesItem(Value.FINANCIAL_PRODUCTS, "financial_products"); + + private final Value value; + + private final String string; + + AdCampaignSpecialAdCategoriesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdCampaignSpecialAdCategoriesItem + && this.string.equals(((AdCampaignSpecialAdCategoriesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EMPLOYMENT: + return visitor.visitEmployment(); + case HOUSING: + return visitor.visitHousing(); + case POLITICS: + return visitor.visitPolitics(); + case FINANCIAL_PRODUCTS: + return visitor.visitFinancialProducts(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdCampaignSpecialAdCategoriesItem valueOf(String value) { + switch (value) { + case "employment": + return EMPLOYMENT; + case "housing": + return HOUSING; + case "politics": + return POLITICS; + case "financial_products": + return FINANCIAL_PRODUCTS; + default: + return new AdCampaignSpecialAdCategoriesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + HOUSING, + + EMPLOYMENT, + + FINANCIAL_PRODUCTS, + + POLITICS, + + UNKNOWN + } + + public interface Visitor { + T visitHousing(); + + T visitEmployment(); + + T visitFinancialProducts(); + + T visitPolitics(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdCampaignStatus.java b/src/main/java/com/whop/api/types/AdCampaignStatus.java new file mode 100644 index 00000000..9e134f2f --- /dev/null +++ b/src/main/java/com/whop/api/types/AdCampaignStatus.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdCampaignStatus { + public static final AdCampaignStatus INACTIVE = new AdCampaignStatus(Value.INACTIVE, "inactive"); + + public static final AdCampaignStatus STALE = new AdCampaignStatus(Value.STALE, "stale"); + + public static final AdCampaignStatus DUPLICATING = new AdCampaignStatus(Value.DUPLICATING, "duplicating"); + + public static final AdCampaignStatus PAUSED = new AdCampaignStatus(Value.PAUSED, "paused"); + + public static final AdCampaignStatus IMPORTED = new AdCampaignStatus(Value.IMPORTED, "imported"); + + public static final AdCampaignStatus PENDING_REFUND = new AdCampaignStatus(Value.PENDING_REFUND, "pending_refund"); + + public static final AdCampaignStatus PAYMENT_FAILED = new AdCampaignStatus(Value.PAYMENT_FAILED, "payment_failed"); + + public static final AdCampaignStatus DRAFT = new AdCampaignStatus(Value.DRAFT, "draft"); + + public static final AdCampaignStatus FLAGGED = new AdCampaignStatus(Value.FLAGGED, "flagged"); + + public static final AdCampaignStatus IN_REVIEW = new AdCampaignStatus(Value.IN_REVIEW, "in_review"); + + public static final AdCampaignStatus ACTIVE = new AdCampaignStatus(Value.ACTIVE, "active"); + + public static final AdCampaignStatus IMPORTING = new AdCampaignStatus(Value.IMPORTING, "importing"); + + private final Value value; + + private final String string; + + AdCampaignStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdCampaignStatus && this.string.equals(((AdCampaignStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INACTIVE: + return visitor.visitInactive(); + case STALE: + return visitor.visitStale(); + case DUPLICATING: + return visitor.visitDuplicating(); + case PAUSED: + return visitor.visitPaused(); + case IMPORTED: + return visitor.visitImported(); + case PENDING_REFUND: + return visitor.visitPendingRefund(); + case PAYMENT_FAILED: + return visitor.visitPaymentFailed(); + case DRAFT: + return visitor.visitDraft(); + case FLAGGED: + return visitor.visitFlagged(); + case IN_REVIEW: + return visitor.visitInReview(); + case ACTIVE: + return visitor.visitActive(); + case IMPORTING: + return visitor.visitImporting(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdCampaignStatus valueOf(String value) { + switch (value) { + case "inactive": + return INACTIVE; + case "stale": + return STALE; + case "duplicating": + return DUPLICATING; + case "paused": + return PAUSED; + case "imported": + return IMPORTED; + case "pending_refund": + return PENDING_REFUND; + case "payment_failed": + return PAYMENT_FAILED; + case "draft": + return DRAFT; + case "flagged": + return FLAGGED; + case "in_review": + return IN_REVIEW; + case "active": + return ACTIVE; + case "importing": + return IMPORTING; + default: + return new AdCampaignStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + PAUSED, + + INACTIVE, + + STALE, + + PENDING_REFUND, + + PAYMENT_FAILED, + + DRAFT, + + IN_REVIEW, + + FLAGGED, + + IMPORTING, + + IMPORTED, + + DUPLICATING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitPaused(); + + T visitInactive(); + + T visitStale(); + + T visitPendingRefund(); + + T visitPaymentFailed(); + + T visitDraft(); + + T visitInReview(); + + T visitFlagged(); + + T visitImporting(); + + T visitImported(); + + T visitDuplicating(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdCreative.java b/src/main/java/com/whop/api/types/AdCreative.java new file mode 100644 index 00000000..c9ce7034 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdCreative.java @@ -0,0 +1,416 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdCreative.Builder.class) +public final class AdCreative { + private final Optional crop; + + private final Optional format; + + private final String id; + + private final Optional mediaType; + + private final Optional url; + + private final Map additionalProperties; + + private AdCreative( + Optional crop, + Optional format, + String id, + Optional mediaType, + Optional url, + Map additionalProperties) { + this.crop = crop; + this.format = format; + this.id = id; + this.mediaType = mediaType; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The saved crop window for this creative, in source image pixels. Null for the original asset or a format that has not been cropped. + */ + @JsonIgnore + public Optional getCrop() { + if (crop == null) { + return Optional.empty(); + } + return crop; + } + + /** + * @return The placement variant this asset covers, or null for the original asset. + */ + @JsonIgnore + public Optional getFormat() { + if (format == null) { + return Optional.empty(); + } + return format; + } + + /** + * @return The creative attachment's file id. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The kind of asset, image or video. + */ + @JsonIgnore + public Optional getMediaType() { + if (mediaType == null) { + return Optional.empty(); + } + return mediaType; + } + + /** + * @return CDN url of the asset. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("crop") + private Optional _getCrop() { + return crop; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("format") + private Optional _getFormat() { + return format; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("media_type") + private Optional _getMediaType() { + return mediaType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdCreative && equalTo((AdCreative) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdCreative other) { + return crop.equals(other.crop) + && format.equals(other.format) + && id.equals(other.id) + && mediaType.equals(other.mediaType) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.crop, this.format, this.id, this.mediaType, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The creative attachment's file id.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(AdCreative other); + } + + public interface _FinalStage { + AdCreative build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The saved crop window for this creative, in source image pixels. Null for the original asset or a format that has not been cropped.

+ */ + _FinalStage crop(Optional crop); + + _FinalStage crop(AdCreativeCrop crop); + + _FinalStage crop(Nullable crop); + + /** + *

The placement variant this asset covers, or null for the original asset.

+ */ + _FinalStage format(Optional format); + + _FinalStage format(AdCreativeFormat format); + + _FinalStage format(Nullable format); + + /** + *

The kind of asset, image or video.

+ */ + _FinalStage mediaType(Optional mediaType); + + _FinalStage mediaType(String mediaType); + + _FinalStage mediaType(Nullable mediaType); + + /** + *

CDN url of the asset.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional url = Optional.empty(); + + private Optional mediaType = Optional.empty(); + + private Optional format = Optional.empty(); + + private Optional crop = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdCreative other) { + crop(other.getCrop()); + format(other.getFormat()); + id(other.getId()); + mediaType(other.getMediaType()); + url(other.getUrl()); + return this; + } + + /** + *

The creative attachment's file id.

+ *

The creative attachment's file id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

CDN url of the asset.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

CDN url of the asset.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

CDN url of the asset.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

The kind of asset, image or video.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mediaType(Nullable mediaType) { + if (mediaType.isNull()) { + this.mediaType = null; + } else if (mediaType.isEmpty()) { + this.mediaType = Optional.empty(); + } else { + this.mediaType = Optional.of(mediaType.get()); + } + return this; + } + + /** + *

The kind of asset, image or video.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mediaType(String mediaType) { + this.mediaType = Optional.ofNullable(mediaType); + return this; + } + + /** + *

The kind of asset, image or video.

+ */ + @java.lang.Override + @JsonSetter(value = "media_type", nulls = Nulls.SKIP) + public _FinalStage mediaType(Optional mediaType) { + this.mediaType = mediaType; + return this; + } + + /** + *

The placement variant this asset covers, or null for the original asset.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage format(Nullable format) { + if (format.isNull()) { + this.format = null; + } else if (format.isEmpty()) { + this.format = Optional.empty(); + } else { + this.format = Optional.of(format.get()); + } + return this; + } + + /** + *

The placement variant this asset covers, or null for the original asset.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage format(AdCreativeFormat format) { + this.format = Optional.ofNullable(format); + return this; + } + + /** + *

The placement variant this asset covers, or null for the original asset.

+ */ + @java.lang.Override + @JsonSetter(value = "format", nulls = Nulls.SKIP) + public _FinalStage format(Optional format) { + this.format = format; + return this; + } + + /** + *

The saved crop window for this creative, in source image pixels. Null for the original asset or a format that has not been cropped.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage crop(Nullable crop) { + if (crop.isNull()) { + this.crop = null; + } else if (crop.isEmpty()) { + this.crop = Optional.empty(); + } else { + this.crop = Optional.of(crop.get()); + } + return this; + } + + /** + *

The saved crop window for this creative, in source image pixels. Null for the original asset or a format that has not been cropped.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage crop(AdCreativeCrop crop) { + this.crop = Optional.ofNullable(crop); + return this; + } + + /** + *

The saved crop window for this creative, in source image pixels. Null for the original asset or a format that has not been cropped.

+ */ + @java.lang.Override + @JsonSetter(value = "crop", nulls = Nulls.SKIP) + public _FinalStage crop(Optional crop) { + this.crop = crop; + return this; + } + + @java.lang.Override + public AdCreative build() { + return new AdCreative(crop, format, id, mediaType, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdCreativeCrop.java b/src/main/java/com/whop/api/types/AdCreativeCrop.java new file mode 100644 index 00000000..697983c0 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdCreativeCrop.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdCreativeCrop.Builder.class) +public final class AdCreativeCrop { + private final double height; + + private final double width; + + private final double x; + + private final double y; + + private final Map additionalProperties; + + private AdCreativeCrop(double height, double width, double x, double y, Map additionalProperties) { + this.height = height; + this.width = width; + this.x = x; + this.y = y; + this.additionalProperties = additionalProperties; + } + + /** + * @return Height of the crop window in source pixels. + */ + @JsonProperty("height") + public double getHeight() { + return height; + } + + /** + * @return Width of the crop window in source pixels. + */ + @JsonProperty("width") + public double getWidth() { + return width; + } + + /** + * @return Left edge of the crop window in source pixels. + */ + @JsonProperty("x") + public double getX() { + return x; + } + + /** + * @return Top edge of the crop window in source pixels. + */ + @JsonProperty("y") + public double getY() { + return y; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdCreativeCrop && equalTo((AdCreativeCrop) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdCreativeCrop other) { + return height == other.height && width == other.width && x == other.x && y == other.y; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.height, this.width, this.x, this.y); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HeightStage builder() { + return new Builder(); + } + + public interface HeightStage { + /** + *

Height of the crop window in source pixels.

+ */ + WidthStage height(double height); + + Builder from(AdCreativeCrop other); + } + + public interface WidthStage { + /** + *

Width of the crop window in source pixels.

+ */ + XStage width(double width); + } + + public interface XStage { + /** + *

Left edge of the crop window in source pixels.

+ */ + YStage x(double x); + } + + public interface YStage { + /** + *

Top edge of the crop window in source pixels.

+ */ + _FinalStage y(double y); + } + + public interface _FinalStage { + AdCreativeCrop build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HeightStage, WidthStage, XStage, YStage, _FinalStage { + private double height; + + private double width; + + private double x; + + private double y; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdCreativeCrop other) { + height(other.getHeight()); + width(other.getWidth()); + x(other.getX()); + y(other.getY()); + return this; + } + + /** + *

Height of the crop window in source pixels.

+ *

Height of the crop window in source pixels.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("height") + public WidthStage height(double height) { + this.height = height; + return this; + } + + /** + *

Width of the crop window in source pixels.

+ *

Width of the crop window in source pixels.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("width") + public XStage width(double width) { + this.width = width; + return this; + } + + /** + *

Left edge of the crop window in source pixels.

+ *

Left edge of the crop window in source pixels.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("x") + public YStage x(double x) { + this.x = x; + return this; + } + + /** + *

Top edge of the crop window in source pixels.

+ *

Top edge of the crop window in source pixels.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("y") + public _FinalStage y(double y) { + this.y = y; + return this; + } + + @java.lang.Override + public AdCreativeCrop build() { + return new AdCreativeCrop(height, width, x, y, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdCreativeFormat.java b/src/main/java/com/whop/api/types/AdCreativeFormat.java new file mode 100644 index 00000000..0af076f1 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdCreativeFormat.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdCreativeFormat { + public static final AdCreativeFormat SQUARE = new AdCreativeFormat(Value.SQUARE, "square"); + + public static final AdCreativeFormat VERTICAL = new AdCreativeFormat(Value.VERTICAL, "vertical"); + + public static final AdCreativeFormat HORIZONTAL = new AdCreativeFormat(Value.HORIZONTAL, "horizontal"); + + private final Value value; + + private final String string; + + AdCreativeFormat(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdCreativeFormat && this.string.equals(((AdCreativeFormat) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SQUARE: + return visitor.visitSquare(); + case VERTICAL: + return visitor.visitVertical(); + case HORIZONTAL: + return visitor.visitHorizontal(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdCreativeFormat valueOf(String value) { + switch (value) { + case "square": + return SQUARE; + case "vertical": + return VERTICAL; + case "horizontal": + return HORIZONTAL; + default: + return new AdCreativeFormat(Value.UNKNOWN, value); + } + } + + public enum Value { + SQUARE, + + VERTICAL, + + HORIZONTAL, + + UNKNOWN + } + + public interface Visitor { + T visitSquare(); + + T visitVertical(); + + T visitHorizontal(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdDeliveryStatus.java b/src/main/java/com/whop/api/types/AdDeliveryStatus.java new file mode 100644 index 00000000..869edaac --- /dev/null +++ b/src/main/java/com/whop/api/types/AdDeliveryStatus.java @@ -0,0 +1,186 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdDeliveryStatus { + public static final AdDeliveryStatus PROCESSING = new AdDeliveryStatus(Value.PROCESSING, "processing"); + + public static final AdDeliveryStatus CAMPAIGN_PAUSED = + new AdDeliveryStatus(Value.CAMPAIGN_PAUSED, "campaign_paused"); + + public static final AdDeliveryStatus PAUSED = new AdDeliveryStatus(Value.PAUSED, "paused"); + + public static final AdDeliveryStatus SCHEDULED = new AdDeliveryStatus(Value.SCHEDULED, "scheduled"); + + public static final AdDeliveryStatus ISSUES = new AdDeliveryStatus(Value.ISSUES, "issues"); + + public static final AdDeliveryStatus REJECTED = new AdDeliveryStatus(Value.REJECTED, "rejected"); + + public static final AdDeliveryStatus DRAFT = new AdDeliveryStatus(Value.DRAFT, "draft"); + + public static final AdDeliveryStatus LEARNING = new AdDeliveryStatus(Value.LEARNING, "learning"); + + public static final AdDeliveryStatus IN_REVIEW = new AdDeliveryStatus(Value.IN_REVIEW, "in_review"); + + public static final AdDeliveryStatus LEARNING_LIMITED = + new AdDeliveryStatus(Value.LEARNING_LIMITED, "learning_limited"); + + public static final AdDeliveryStatus AD_GROUP_PAUSED = + new AdDeliveryStatus(Value.AD_GROUP_PAUSED, "ad_group_paused"); + + public static final AdDeliveryStatus ACTIVE = new AdDeliveryStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AdDeliveryStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdDeliveryStatus && this.string.equals(((AdDeliveryStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PROCESSING: + return visitor.visitProcessing(); + case CAMPAIGN_PAUSED: + return visitor.visitCampaignPaused(); + case PAUSED: + return visitor.visitPaused(); + case SCHEDULED: + return visitor.visitScheduled(); + case ISSUES: + return visitor.visitIssues(); + case REJECTED: + return visitor.visitRejected(); + case DRAFT: + return visitor.visitDraft(); + case LEARNING: + return visitor.visitLearning(); + case IN_REVIEW: + return visitor.visitInReview(); + case LEARNING_LIMITED: + return visitor.visitLearningLimited(); + case AD_GROUP_PAUSED: + return visitor.visitAdGroupPaused(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdDeliveryStatus valueOf(String value) { + switch (value) { + case "processing": + return PROCESSING; + case "campaign_paused": + return CAMPAIGN_PAUSED; + case "paused": + return PAUSED; + case "scheduled": + return SCHEDULED; + case "issues": + return ISSUES; + case "rejected": + return REJECTED; + case "draft": + return DRAFT; + case "learning": + return LEARNING; + case "in_review": + return IN_REVIEW; + case "learning_limited": + return LEARNING_LIMITED; + case "ad_group_paused": + return AD_GROUP_PAUSED; + case "active": + return ACTIVE; + default: + return new AdDeliveryStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + REJECTED, + + IN_REVIEW, + + DRAFT, + + CAMPAIGN_PAUSED, + + AD_GROUP_PAUSED, + + PAUSED, + + PROCESSING, + + ISSUES, + + SCHEDULED, + + LEARNING_LIMITED, + + LEARNING, + + ACTIVE, + + UNKNOWN + } + + public interface Visitor { + T visitRejected(); + + T visitInReview(); + + T visitDraft(); + + T visitCampaignPaused(); + + T visitAdGroupPaused(); + + T visitPaused(); + + T visitProcessing(); + + T visitIssues(); + + T visitScheduled(); + + T visitLearningLimited(); + + T visitLearning(); + + T visitActive(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdEntityReference.java b/src/main/java/com/whop/api/types/AdEntityReference.java new file mode 100644 index 00000000..e9dfee23 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdEntityReference.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdEntityReference.Builder.class) +public final class AdEntityReference { + private final String id; + + private final Map additionalProperties; + + private AdEntityReference(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The referenced entity's id. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdEntityReference && equalTo((AdEntityReference) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdEntityReference other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The referenced entity's id.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(AdEntityReference other); + } + + public interface _FinalStage { + AdEntityReference build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdEntityReference other) { + id(other.getId()); + return this; + } + + /** + *

The referenced entity's id.

+ *

The referenced entity's id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public AdEntityReference build() { + return new AdEntityReference(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroup.java b/src/main/java/com/whop/api/types/AdGroup.java new file mode 100644 index 00000000..e2881bab --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroup.java @@ -0,0 +1,3847 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroup.Builder.class) +public final class AdGroup { + private final AdEntityReference adCampaign; + + private final double addedToCartValue; + + private final double addedToCarts; + + private final AdGroupAudiences audiences; + + private final Optional bidType; + + private final Optional budgetAmount; + + private final Optional budgetType; + + private final double clickThroughRate; + + private final double clicks; + + private final double completedRegistrationValue; + + private final double completedRegistrations; + + private final double contactValue; + + private final double contacts; + + private final Optional conversionEvent; + + private final Optional conversionLocation; + + private final Optional costPerAddedToCart; + + private final double costPerClick; + + private final Optional costPerCompletedRegistration; + + private final Optional costPerContact; + + private final Optional costPerLead; + + private final double costPerMille; + + private final Optional costPerPurchase; + + private final Optional costPerResult; + + private final Optional costPerSchedule; + + private final Optional costPerSubmittedApplication; + + private final Optional costPerUniqueClick; + + private final Optional costPerViewedContent; + + private final String createdAt; + + private final double customConversions; + + private final Map customEventCounts; + + private final Map customEventValues; + + private final AdGroupDeliveryStatus deliveryStatus; + + private final AdGroupDemographics demographics; + + private final Optional desiredCostPerResult; + + private final AdGroupDetailedTargeting detailedTargeting; + + private final AdGroupDevices devices; + + private final Optional dynamicCreative; + + private final Optional endsAt; + + private final Optional frequency; + + private final Optional frequencyCap; + + private final String id; + + private final double impressions; + + private final List issues; + + private final List languages; + + private final double leadValue; + + private final double leads; + + private final Optional> messageApps; + + private final Optional minimumDailySpend; + + private final Optional optimizationGoal; + + private final List placements; + + private final double purchaseValue; + + private final double purchases; + + private final double reach; + + private final AdGroupRegions regions; + + private final Optional resultEvent; + + private final Optional resultEventName; + + private final Optional results; + + private final double returnOnAdSpend; + + private final double scheduleValue; + + private final double schedules; + + private final double spend; + + private final Optional spendCurrency; + + private final Optional startsAt; + + private final AdGroupStatus status; + + private final double submittedApplicationValue; + + private final double submittedApplications; + + private final Optional title; + + private final Optional uniqueClickThroughRate; + + private final double uniqueClicks; + + private final String updatedAt; + + private final double viewedContentValue; + + private final double viewedContents; + + private final Map additionalProperties; + + private AdGroup( + AdEntityReference adCampaign, + double addedToCartValue, + double addedToCarts, + AdGroupAudiences audiences, + Optional bidType, + Optional budgetAmount, + Optional budgetType, + double clickThroughRate, + double clicks, + double completedRegistrationValue, + double completedRegistrations, + double contactValue, + double contacts, + Optional conversionEvent, + Optional conversionLocation, + Optional costPerAddedToCart, + double costPerClick, + Optional costPerCompletedRegistration, + Optional costPerContact, + Optional costPerLead, + double costPerMille, + Optional costPerPurchase, + Optional costPerResult, + Optional costPerSchedule, + Optional costPerSubmittedApplication, + Optional costPerUniqueClick, + Optional costPerViewedContent, + String createdAt, + double customConversions, + Map customEventCounts, + Map customEventValues, + AdGroupDeliveryStatus deliveryStatus, + AdGroupDemographics demographics, + Optional desiredCostPerResult, + AdGroupDetailedTargeting detailedTargeting, + AdGroupDevices devices, + Optional dynamicCreative, + Optional endsAt, + Optional frequency, + Optional frequencyCap, + String id, + double impressions, + List issues, + List languages, + double leadValue, + double leads, + Optional> messageApps, + Optional minimumDailySpend, + Optional optimizationGoal, + List placements, + double purchaseValue, + double purchases, + double reach, + AdGroupRegions regions, + Optional resultEvent, + Optional resultEventName, + Optional results, + double returnOnAdSpend, + double scheduleValue, + double schedules, + double spend, + Optional spendCurrency, + Optional startsAt, + AdGroupStatus status, + double submittedApplicationValue, + double submittedApplications, + Optional title, + Optional uniqueClickThroughRate, + double uniqueClicks, + String updatedAt, + double viewedContentValue, + double viewedContents, + Map additionalProperties) { + this.adCampaign = adCampaign; + this.addedToCartValue = addedToCartValue; + this.addedToCarts = addedToCarts; + this.audiences = audiences; + this.bidType = bidType; + this.budgetAmount = budgetAmount; + this.budgetType = budgetType; + this.clickThroughRate = clickThroughRate; + this.clicks = clicks; + this.completedRegistrationValue = completedRegistrationValue; + this.completedRegistrations = completedRegistrations; + this.contactValue = contactValue; + this.contacts = contacts; + this.conversionEvent = conversionEvent; + this.conversionLocation = conversionLocation; + this.costPerAddedToCart = costPerAddedToCart; + this.costPerClick = costPerClick; + this.costPerCompletedRegistration = costPerCompletedRegistration; + this.costPerContact = costPerContact; + this.costPerLead = costPerLead; + this.costPerMille = costPerMille; + this.costPerPurchase = costPerPurchase; + this.costPerResult = costPerResult; + this.costPerSchedule = costPerSchedule; + this.costPerSubmittedApplication = costPerSubmittedApplication; + this.costPerUniqueClick = costPerUniqueClick; + this.costPerViewedContent = costPerViewedContent; + this.createdAt = createdAt; + this.customConversions = customConversions; + this.customEventCounts = customEventCounts; + this.customEventValues = customEventValues; + this.deliveryStatus = deliveryStatus; + this.demographics = demographics; + this.desiredCostPerResult = desiredCostPerResult; + this.detailedTargeting = detailedTargeting; + this.devices = devices; + this.dynamicCreative = dynamicCreative; + this.endsAt = endsAt; + this.frequency = frequency; + this.frequencyCap = frequencyCap; + this.id = id; + this.impressions = impressions; + this.issues = issues; + this.languages = languages; + this.leadValue = leadValue; + this.leads = leads; + this.messageApps = messageApps; + this.minimumDailySpend = minimumDailySpend; + this.optimizationGoal = optimizationGoal; + this.placements = placements; + this.purchaseValue = purchaseValue; + this.purchases = purchases; + this.reach = reach; + this.regions = regions; + this.resultEvent = resultEvent; + this.resultEventName = resultEventName; + this.results = results; + this.returnOnAdSpend = returnOnAdSpend; + this.scheduleValue = scheduleValue; + this.schedules = schedules; + this.spend = spend; + this.spendCurrency = spendCurrency; + this.startsAt = startsAt; + this.status = status; + this.submittedApplicationValue = submittedApplicationValue; + this.submittedApplications = submittedApplications; + this.title = title; + this.uniqueClickThroughRate = uniqueClickThroughRate; + this.uniqueClicks = uniqueClicks; + this.updatedAt = updatedAt; + this.viewedContentValue = viewedContentValue; + this.viewedContents = viewedContents; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ad campaign this ad group belongs to. + */ + @JsonProperty("ad_campaign") + public AdEntityReference getAdCampaign() { + return adCampaign; + } + + /** + * @return USD value attributed to add-to-cart events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("added_to_cart_value") + public double getAddedToCartValue() { + return addedToCartValue; + } + + /** + * @return Whop pixel-attributed add-to-cart events, last-click. + */ + @JsonProperty("added_to_carts") + public double getAddedToCarts() { + return addedToCarts; + } + + /** + * @return Saved audiences this ad group delivers to or excludes. + */ + @JsonProperty("audiences") + public AdGroupAudiences getAudiences() { + return audiences; + } + + /** + * @return How delivery bids are set in the ad auction. Target-based strategies use desired_cost_per_result. + */ + @JsonIgnore + public Optional getBidType() { + if (bidType == null) { + return Optional.empty(); + } + return bidType; + } + + /** + * @return This ad group's budget, in the ad account's currency. null when the budget is set on the campaign instead. + */ + @JsonIgnore + public Optional getBudgetAmount() { + if (budgetAmount == null) { + return Optional.empty(); + } + return budgetAmount; + } + + /** + * @return Whether budget_amount is spent per day (daily) or over the ad group's full run (lifetime). + */ + @JsonIgnore + public Optional getBudgetType() { + if (budgetType == null) { + return Optional.empty(); + } + return budgetType; + } + + /** + * @return Clicks divided by impressions, between 0 and 1. + */ + @JsonProperty("click_through_rate") + public double getClickThroughRate() { + return clickThroughRate; + } + + /** + * @return The number of clicks. + */ + @JsonProperty("clicks") + public double getClicks() { + return clicks; + } + + /** + * @return USD value attributed to complete-registration events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("completed_registration_value") + public double getCompletedRegistrationValue() { + return completedRegistrationValue; + } + + /** + * @return Whop pixel-attributed complete-registration events, last-click. + */ + @JsonProperty("completed_registrations") + public double getCompletedRegistrations() { + return completedRegistrations; + } + + /** + * @return USD value attributed to contact events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("contact_value") + public double getContactValue() { + return contactValue; + } + + /** + * @return Whop pixel-attributed contact events, last-click. + */ + @JsonProperty("contacts") + public double getContacts() { + return contacts; + } + + @JsonIgnore + public Optional getConversionEvent() { + if (conversionEvent == null) { + return Optional.empty(); + } + return conversionEvent; + } + + /** + * @return Where the outcome being optimized for occurs, such as a website visit, social-profile visit, messaging conversation, ad interaction, or lead-form submission. + */ + @JsonIgnore + public Optional getConversionLocation() { + if (conversionLocation == null) { + return Optional.empty(); + } + return conversionLocation; + } + + /** + * @return Spend divided by attributed add-to-cart events; null when they are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerAddedToCart() { + if (costPerAddedToCart == null) { + return Optional.empty(); + } + return costPerAddedToCart; + } + + /** + * @return Spend divided by clicks; 0 when there are no clicks. + */ + @JsonProperty("cost_per_click") + public double getCostPerClick() { + return costPerClick; + } + + /** + * @return Spend divided by attributed complete-registration events; null when they are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerCompletedRegistration() { + if (costPerCompletedRegistration == null) { + return Optional.empty(); + } + return costPerCompletedRegistration; + } + + /** + * @return Spend divided by attributed contact events; null when contacts are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerContact() { + if (costPerContact == null) { + return Optional.empty(); + } + return costPerContact; + } + + /** + * @return Spend divided by attributed leads; null when leads are not a goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerLead() { + if (costPerLead == null) { + return Optional.empty(); + } + return costPerLead; + } + + /** + * @return Spend per 1,000 impressions; 0 when there are no impressions. + */ + @JsonProperty("cost_per_mille") + public double getCostPerMille() { + return costPerMille; + } + + /** + * @return Spend divided by attributed purchases; null when purchases are not a goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerPurchase() { + if (costPerPurchase == null) { + return Optional.empty(); + } + return costPerPurchase; + } + + /** + * @return Spend divided by Whop pixel-attributed results; null when nothing Whop-attributable is being optimized for. + */ + @JsonIgnore + public Optional getCostPerResult() { + if (costPerResult == null) { + return Optional.empty(); + } + return costPerResult; + } + + /** + * @return Spend divided by attributed schedule events; null when schedules are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerSchedule() { + if (costPerSchedule == null) { + return Optional.empty(); + } + return costPerSchedule; + } + + /** + * @return Spend divided by attributed submit-application events; null when they are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerSubmittedApplication() { + if (costPerSubmittedApplication == null) { + return Optional.empty(); + } + return costPerSubmittedApplication; + } + + /** + * @return Spend divided by unique clicks; null when there are no unique clicks. + */ + @JsonIgnore + public Optional getCostPerUniqueClick() { + if (costPerUniqueClick == null) { + return Optional.empty(); + } + return costPerUniqueClick; + } + + /** + * @return Spend divided by attributed view-content events; null when they are not the goal and none are attributed. + */ + @JsonIgnore + public Optional getCostPerViewedContent() { + if (costPerViewedContent == null) { + return Optional.empty(); + } + return costPerViewedContent; + } + + /** + * @return When the ad group was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Whop pixel-attributed custom (merchant-defined) conversion events, last-click, across all custom event names. + */ + @JsonProperty("custom_conversions") + public double getCustomConversions() { + return customConversions; + } + + /** + * @return Whop pixel-attributed custom conversions, keyed by your event name with its last-click count as the value. Empty when no named custom events are attributed. Custom events fired without a name are counted in custom_conversions but omitted here, so these values sum to at most custom_conversions. + */ + @JsonProperty("custom_event_counts") + public Map getCustomEventCounts() { + return customEventCounts; + } + + /** + * @return Conversion value attributed to each custom event, keyed by event name like custom_event_counts. Sums the value passed to whop.track, normalized to USD; events fired without a value contribute 0. + */ + @JsonProperty("custom_event_values") + public Map getCustomEventValues() { + return customEventValues; + } + + /** + * @return Whether ads in this ad group are delivering right now, and if not, why. When several states apply at once, the highest-precedence one is returned. + */ + @JsonProperty("delivery_status") + public AdGroupDeliveryStatus getDeliveryStatus() { + return deliveryStatus; + } + + /** + * @return Age, gender, and automatic-audience targeting. + */ + @JsonProperty("demographics") + public AdGroupDemographics getDemographics() { + return demographics; + } + + /** + * @return Cost per result to aim for (average_target) or never exceed (maximum_target). null for minimum_cost bidding. + */ + @JsonIgnore + public Optional getDesiredCostPerResult() { + if (desiredCostPerResult == null) { + return Optional.empty(); + } + return desiredCostPerResult; + } + + /** + * @return Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. Entries across interests, behaviors, and demographics are OR'd together (anyone matching any entry is reached), matching Ads Manager's detailed-targeting box. Can't be combined with automatic audience targeting, and unavailable to campaigns with special_ad_categories. + */ + @JsonProperty("detailed_targeting") + public AdGroupDetailedTargeting getDetailedTargeting() { + return detailedTargeting; + } + + /** + * @return Device platforms and operating systems targeted. + */ + @JsonProperty("devices") + public AdGroupDevices getDevices() { + return devices; + } + + /** + * @return Whether the ad platform automatically mixes and matches this ad group's creatives and copy to find the best-performing combinations. + */ + @JsonProperty("dynamic_creative") + public Optional getDynamicCreative() { + return dynamicCreative; + } + + /** + * @return When the ad group stops delivering, as an ISO 8601 timestamp. null when it runs until paused. + */ + @JsonIgnore + public Optional getEndsAt() { + if (endsAt == null) { + return Optional.empty(); + } + return endsAt; + } + + /** + * @return Platform-reported impressions divided by reach. + */ + @JsonIgnore + public Optional getFrequency() { + if (frequency == null) { + return Optional.empty(); + } + return frequency; + } + + /** + * @return Cap on how often one person sees ads from this ad group. Only available on campaigns with the awareness objective; null when uncapped. + */ + @JsonIgnore + public Optional getFrequencyCap() { + if (frequencyCap == null) { + return Optional.empty(); + } + return frequencyCap; + } + + /** + * @return Unique identifier for the ad group, prefixed adgrp_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The number of impressions. + */ + @JsonProperty("impressions") + public double getImpressions() { + return impressions; + } + + @JsonProperty("issues") + public List getIssues() { + return issues; + } + + @JsonProperty("languages") + public List getLanguages() { + return languages; + } + + /** + * @return USD value attributed to lead events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("lead_value") + public double getLeadValue() { + return leadValue; + } + + /** + * @return Whop pixel-attributed leads, last-click. + */ + @JsonProperty("leads") + public double getLeads() { + return leads; + } + + @JsonProperty("message_apps") + public Optional> getMessageApps() { + return messageApps; + } + + /** + * @return Minimum the ad group tries to spend each day. null when no floor is set. + */ + @JsonIgnore + public Optional getMinimumDailySpend() { + if (minimumDailySpend == null) { + return Optional.empty(); + } + return minimumDailySpend; + } + + /** + * @return The result the ad group's delivery is optimized to get the most of. + */ + @JsonIgnore + public Optional getOptimizationGoal() { + if (optimizationGoal == null) { + return Optional.empty(); + } + return optimizationGoal; + } + + @JsonProperty("placements") + public List getPlacements() { + return placements; + } + + /** + * @return USD value of pixel-attributed purchases. + */ + @JsonProperty("purchase_value") + public double getPurchaseValue() { + return purchaseValue; + } + + /** + * @return Whop pixel-attributed purchases, last-click. + */ + @JsonProperty("purchases") + public double getPurchases() { + return purchases; + } + + /** + * @return The number of unique people who saw this. + */ + @JsonProperty("reach") + public double getReach() { + return reach; + } + + /** + * @return Locations targeted and excluded. + */ + @JsonProperty("regions") + public AdGroupRegions getRegions() { + return regions; + } + + /** + * @return The Whop pixel conversion event whose attributed count represents results — the optimization goal, or the highest-volume attributed event for campaigns that budget per ad group. Null when the goal isn't a Whop-attributed event. + */ + @JsonIgnore + public Optional getResultEvent() { + if (resultEvent == null) { + return Optional.empty(); + } + return resultEvent; + } + + /** + * @return The merchant-defined event name when result_event is custom; null for the standard events. + */ + @JsonIgnore + public Optional getResultEventName() { + if (resultEventName == null) { + return Optional.empty(); + } + return resultEventName; + } + + /** + * @return The Whop pixel-attributed count behind result_event. When a campaign's ad groups optimize different goals there is no single result_event (it is null), and this is instead the sum of each ad group's own attributed results. Null when nothing Whop-attributable is being optimized for. + */ + @JsonIgnore + public Optional getResults() { + if (results == null) { + return Optional.empty(); + } + return results; + } + + /** + * @return Purchase value divided by spend, both in USD (a currency-neutral ratio); 0 when there is no spend. + */ + @JsonProperty("return_on_ad_spend") + public double getReturnOnAdSpend() { + return returnOnAdSpend; + } + + /** + * @return USD value attributed to schedule events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("schedule_value") + public double getScheduleValue() { + return scheduleValue; + } + + /** + * @return Whop pixel-attributed schedule events, last-click. + */ + @JsonProperty("schedules") + public double getSchedules() { + return schedules; + } + + /** + * @return The amount charged, in spend_currency. + */ + @JsonProperty("spend") + public double getSpend() { + return spend; + } + + /** + * @return The ISO 4217 currency code of all monetary metrics. + */ + @JsonIgnore + public Optional getSpendCurrency() { + if (spendCurrency == null) { + return Optional.empty(); + } + return spendCurrency; + } + + /** + * @return When the ad group starts delivering, as an ISO 8601 timestamp. null when it starts as soon as it's active. + */ + @JsonIgnore + public Optional getStartsAt() { + if (startsAt == null) { + return Optional.empty(); + } + return startsAt; + } + + /** + * @return Whether the ad group is enabled. active and paused are set by you; rejected means it failed ad review; duplicating is a copy still being filled in. + */ + @JsonProperty("status") + public AdGroupStatus getStatus() { + return status; + } + + /** + * @return USD value attributed to submit-application events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("submitted_application_value") + public double getSubmittedApplicationValue() { + return submittedApplicationValue; + } + + /** + * @return Whop pixel-attributed submit-application events, last-click. + */ + @JsonProperty("submitted_applications") + public double getSubmittedApplications() { + return submittedApplications; + } + + /** + * @return Display name of the ad group. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return Unique clicks divided by impressions, between 0 and 1. + */ + @JsonIgnore + public Optional getUniqueClickThroughRate() { + if (uniqueClickThroughRate == null) { + return Optional.empty(); + } + return uniqueClickThroughRate; + } + + /** + * @return People who clicked, reported by the Whop pixel, counted once per person. + */ + @JsonProperty("unique_clicks") + public double getUniqueClicks() { + return uniqueClicks; + } + + /** + * @return When the ad group was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return USD value attributed to view-content events. Sums the value sent with each event, normalized to USD; events without a value contribute 0. + */ + @JsonProperty("viewed_content_value") + public double getViewedContentValue() { + return viewedContentValue; + } + + /** + * @return Whop pixel-attributed view-content events, last-click. + */ + @JsonProperty("viewed_contents") + public double getViewedContents() { + return viewedContents; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bid_type") + private Optional _getBidType() { + return bidType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("budget_amount") + private Optional _getBudgetAmount() { + return budgetAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("budget_type") + private Optional _getBudgetType() { + return budgetType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("conversion_event") + private Optional _getConversionEvent() { + return conversionEvent; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("conversion_location") + private Optional _getConversionLocation() { + return conversionLocation; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_added_to_cart") + private Optional _getCostPerAddedToCart() { + return costPerAddedToCart; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_completed_registration") + private Optional _getCostPerCompletedRegistration() { + return costPerCompletedRegistration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_contact") + private Optional _getCostPerContact() { + return costPerContact; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_lead") + private Optional _getCostPerLead() { + return costPerLead; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_purchase") + private Optional _getCostPerPurchase() { + return costPerPurchase; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_result") + private Optional _getCostPerResult() { + return costPerResult; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_schedule") + private Optional _getCostPerSchedule() { + return costPerSchedule; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_submitted_application") + private Optional _getCostPerSubmittedApplication() { + return costPerSubmittedApplication; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_unique_click") + private Optional _getCostPerUniqueClick() { + return costPerUniqueClick; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_viewed_content") + private Optional _getCostPerViewedContent() { + return costPerViewedContent; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("desired_cost_per_result") + private Optional _getDesiredCostPerResult() { + return desiredCostPerResult; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ends_at") + private Optional _getEndsAt() { + return endsAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("frequency") + private Optional _getFrequency() { + return frequency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("frequency_cap") + private Optional _getFrequencyCap() { + return frequencyCap; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("minimum_daily_spend") + private Optional _getMinimumDailySpend() { + return minimumDailySpend; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("optimization_goal") + private Optional _getOptimizationGoal() { + return optimizationGoal; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_event") + private Optional _getResultEvent() { + return resultEvent; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_event_name") + private Optional _getResultEventName() { + return resultEventName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("results") + private Optional _getResults() { + return results; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("spend_currency") + private Optional _getSpendCurrency() { + return spendCurrency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("starts_at") + private Optional _getStartsAt() { + return startsAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("unique_click_through_rate") + private Optional _getUniqueClickThroughRate() { + return uniqueClickThroughRate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroup && equalTo((AdGroup) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroup other) { + return adCampaign.equals(other.adCampaign) + && addedToCartValue == other.addedToCartValue + && addedToCarts == other.addedToCarts + && audiences.equals(other.audiences) + && bidType.equals(other.bidType) + && budgetAmount.equals(other.budgetAmount) + && budgetType.equals(other.budgetType) + && clickThroughRate == other.clickThroughRate + && clicks == other.clicks + && completedRegistrationValue == other.completedRegistrationValue + && completedRegistrations == other.completedRegistrations + && contactValue == other.contactValue + && contacts == other.contacts + && conversionEvent.equals(other.conversionEvent) + && conversionLocation.equals(other.conversionLocation) + && costPerAddedToCart.equals(other.costPerAddedToCart) + && costPerClick == other.costPerClick + && costPerCompletedRegistration.equals(other.costPerCompletedRegistration) + && costPerContact.equals(other.costPerContact) + && costPerLead.equals(other.costPerLead) + && costPerMille == other.costPerMille + && costPerPurchase.equals(other.costPerPurchase) + && costPerResult.equals(other.costPerResult) + && costPerSchedule.equals(other.costPerSchedule) + && costPerSubmittedApplication.equals(other.costPerSubmittedApplication) + && costPerUniqueClick.equals(other.costPerUniqueClick) + && costPerViewedContent.equals(other.costPerViewedContent) + && createdAt.equals(other.createdAt) + && customConversions == other.customConversions + && customEventCounts.equals(other.customEventCounts) + && customEventValues.equals(other.customEventValues) + && deliveryStatus.equals(other.deliveryStatus) + && demographics.equals(other.demographics) + && desiredCostPerResult.equals(other.desiredCostPerResult) + && detailedTargeting.equals(other.detailedTargeting) + && devices.equals(other.devices) + && dynamicCreative.equals(other.dynamicCreative) + && endsAt.equals(other.endsAt) + && frequency.equals(other.frequency) + && frequencyCap.equals(other.frequencyCap) + && id.equals(other.id) + && impressions == other.impressions + && issues.equals(other.issues) + && languages.equals(other.languages) + && leadValue == other.leadValue + && leads == other.leads + && messageApps.equals(other.messageApps) + && minimumDailySpend.equals(other.minimumDailySpend) + && optimizationGoal.equals(other.optimizationGoal) + && placements.equals(other.placements) + && purchaseValue == other.purchaseValue + && purchases == other.purchases + && reach == other.reach + && regions.equals(other.regions) + && resultEvent.equals(other.resultEvent) + && resultEventName.equals(other.resultEventName) + && results.equals(other.results) + && returnOnAdSpend == other.returnOnAdSpend + && scheduleValue == other.scheduleValue + && schedules == other.schedules + && spend == other.spend + && spendCurrency.equals(other.spendCurrency) + && startsAt.equals(other.startsAt) + && status.equals(other.status) + && submittedApplicationValue == other.submittedApplicationValue + && submittedApplications == other.submittedApplications + && title.equals(other.title) + && uniqueClickThroughRate.equals(other.uniqueClickThroughRate) + && uniqueClicks == other.uniqueClicks + && updatedAt.equals(other.updatedAt) + && viewedContentValue == other.viewedContentValue + && viewedContents == other.viewedContents; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adCampaign, + this.addedToCartValue, + this.addedToCarts, + this.audiences, + this.bidType, + this.budgetAmount, + this.budgetType, + this.clickThroughRate, + this.clicks, + this.completedRegistrationValue, + this.completedRegistrations, + this.contactValue, + this.contacts, + this.conversionEvent, + this.conversionLocation, + this.costPerAddedToCart, + this.costPerClick, + this.costPerCompletedRegistration, + this.costPerContact, + this.costPerLead, + this.costPerMille, + this.costPerPurchase, + this.costPerResult, + this.costPerSchedule, + this.costPerSubmittedApplication, + this.costPerUniqueClick, + this.costPerViewedContent, + this.createdAt, + this.customConversions, + this.customEventCounts, + this.customEventValues, + this.deliveryStatus, + this.demographics, + this.desiredCostPerResult, + this.detailedTargeting, + this.devices, + this.dynamicCreative, + this.endsAt, + this.frequency, + this.frequencyCap, + this.id, + this.impressions, + this.issues, + this.languages, + this.leadValue, + this.leads, + this.messageApps, + this.minimumDailySpend, + this.optimizationGoal, + this.placements, + this.purchaseValue, + this.purchases, + this.reach, + this.regions, + this.resultEvent, + this.resultEventName, + this.results, + this.returnOnAdSpend, + this.scheduleValue, + this.schedules, + this.spend, + this.spendCurrency, + this.startsAt, + this.status, + this.submittedApplicationValue, + this.submittedApplications, + this.title, + this.uniqueClickThroughRate, + this.uniqueClicks, + this.updatedAt, + this.viewedContentValue, + this.viewedContents); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdCampaignStage builder() { + return new Builder(); + } + + public interface AdCampaignStage { + /** + *

The ad campaign this ad group belongs to.

+ */ + AddedToCartValueStage adCampaign(@NotNull AdEntityReference adCampaign); + + Builder from(AdGroup other); + } + + public interface AddedToCartValueStage { + /** + *

USD value attributed to add-to-cart events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + AddedToCartsStage addedToCartValue(double addedToCartValue); + } + + public interface AddedToCartsStage { + /** + *

Whop pixel-attributed add-to-cart events, last-click.

+ */ + AudiencesStage addedToCarts(double addedToCarts); + } + + public interface AudiencesStage { + /** + *

Saved audiences this ad group delivers to or excludes.

+ */ + ClickThroughRateStage audiences(@NotNull AdGroupAudiences audiences); + } + + public interface ClickThroughRateStage { + /** + *

Clicks divided by impressions, between 0 and 1.

+ */ + ClicksStage clickThroughRate(double clickThroughRate); + } + + public interface ClicksStage { + /** + *

The number of clicks.

+ */ + CompletedRegistrationValueStage clicks(double clicks); + } + + public interface CompletedRegistrationValueStage { + /** + *

USD value attributed to complete-registration events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + CompletedRegistrationsStage completedRegistrationValue(double completedRegistrationValue); + } + + public interface CompletedRegistrationsStage { + /** + *

Whop pixel-attributed complete-registration events, last-click.

+ */ + ContactValueStage completedRegistrations(double completedRegistrations); + } + + public interface ContactValueStage { + /** + *

USD value attributed to contact events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + ContactsStage contactValue(double contactValue); + } + + public interface ContactsStage { + /** + *

Whop pixel-attributed contact events, last-click.

+ */ + CostPerClickStage contacts(double contacts); + } + + public interface CostPerClickStage { + /** + *

Spend divided by clicks; 0 when there are no clicks.

+ */ + CostPerMilleStage costPerClick(double costPerClick); + } + + public interface CostPerMilleStage { + /** + *

Spend per 1,000 impressions; 0 when there are no impressions.

+ */ + CreatedAtStage costPerMille(double costPerMille); + } + + public interface CreatedAtStage { + /** + *

When the ad group was created, as an ISO 8601 timestamp.

+ */ + CustomConversionsStage createdAt(@NotNull String createdAt); + } + + public interface CustomConversionsStage { + /** + *

Whop pixel-attributed custom (merchant-defined) conversion events, last-click, across all custom event names.

+ */ + DeliveryStatusStage customConversions(double customConversions); + } + + public interface DeliveryStatusStage { + /** + *

Whether ads in this ad group are delivering right now, and if not, why. When several states apply at once, the highest-precedence one is returned.

+ */ + DemographicsStage deliveryStatus(@NotNull AdGroupDeliveryStatus deliveryStatus); + } + + public interface DemographicsStage { + /** + *

Age, gender, and automatic-audience targeting.

+ */ + DetailedTargetingStage demographics(@NotNull AdGroupDemographics demographics); + } + + public interface DetailedTargetingStage { + /** + *

Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. Entries across interests, behaviors, and demographics are OR'd together (anyone matching any entry is reached), matching Ads Manager's detailed-targeting box. Can't be combined with automatic audience targeting, and unavailable to campaigns with special_ad_categories.

+ */ + DevicesStage detailedTargeting(@NotNull AdGroupDetailedTargeting detailedTargeting); + } + + public interface DevicesStage { + /** + *

Device platforms and operating systems targeted.

+ */ + IdStage devices(@NotNull AdGroupDevices devices); + } + + public interface IdStage { + /** + *

Unique identifier for the ad group, prefixed adgrp_.

+ */ + ImpressionsStage id(@NotNull String id); + } + + public interface ImpressionsStage { + /** + *

The number of impressions.

+ */ + LeadValueStage impressions(double impressions); + } + + public interface LeadValueStage { + /** + *

USD value attributed to lead events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + LeadsStage leadValue(double leadValue); + } + + public interface LeadsStage { + /** + *

Whop pixel-attributed leads, last-click.

+ */ + PurchaseValueStage leads(double leads); + } + + public interface PurchaseValueStage { + /** + *

USD value of pixel-attributed purchases.

+ */ + PurchasesStage purchaseValue(double purchaseValue); + } + + public interface PurchasesStage { + /** + *

Whop pixel-attributed purchases, last-click.

+ */ + ReachStage purchases(double purchases); + } + + public interface ReachStage { + /** + *

The number of unique people who saw this.

+ */ + RegionsStage reach(double reach); + } + + public interface RegionsStage { + /** + *

Locations targeted and excluded.

+ */ + ReturnOnAdSpendStage regions(@NotNull AdGroupRegions regions); + } + + public interface ReturnOnAdSpendStage { + /** + *

Purchase value divided by spend, both in USD (a currency-neutral ratio); 0 when there is no spend.

+ */ + ScheduleValueStage returnOnAdSpend(double returnOnAdSpend); + } + + public interface ScheduleValueStage { + /** + *

USD value attributed to schedule events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + SchedulesStage scheduleValue(double scheduleValue); + } + + public interface SchedulesStage { + /** + *

Whop pixel-attributed schedule events, last-click.

+ */ + SpendStage schedules(double schedules); + } + + public interface SpendStage { + /** + *

The amount charged, in spend_currency.

+ */ + StatusStage spend(double spend); + } + + public interface StatusStage { + /** + *

Whether the ad group is enabled. active and paused are set by you; rejected means it failed ad review; duplicating is a copy still being filled in.

+ */ + SubmittedApplicationValueStage status(@NotNull AdGroupStatus status); + } + + public interface SubmittedApplicationValueStage { + /** + *

USD value attributed to submit-application events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + SubmittedApplicationsStage submittedApplicationValue(double submittedApplicationValue); + } + + public interface SubmittedApplicationsStage { + /** + *

Whop pixel-attributed submit-application events, last-click.

+ */ + UniqueClicksStage submittedApplications(double submittedApplications); + } + + public interface UniqueClicksStage { + /** + *

People who clicked, reported by the Whop pixel, counted once per person.

+ */ + UpdatedAtStage uniqueClicks(double uniqueClicks); + } + + public interface UpdatedAtStage { + /** + *

When the ad group was last updated, as an ISO 8601 timestamp.

+ */ + ViewedContentValueStage updatedAt(@NotNull String updatedAt); + } + + public interface ViewedContentValueStage { + /** + *

USD value attributed to view-content events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ */ + ViewedContentsStage viewedContentValue(double viewedContentValue); + } + + public interface ViewedContentsStage { + /** + *

Whop pixel-attributed view-content events, last-click.

+ */ + _FinalStage viewedContents(double viewedContents); + } + + public interface _FinalStage { + AdGroup build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

How delivery bids are set in the ad auction. Target-based strategies use desired_cost_per_result.

+ */ + _FinalStage bidType(Optional bidType); + + _FinalStage bidType(AdGroupBidType bidType); + + _FinalStage bidType(Nullable bidType); + + /** + *

This ad group's budget, in the ad account's currency. null when the budget is set on the campaign instead.

+ */ + _FinalStage budgetAmount(Optional budgetAmount); + + _FinalStage budgetAmount(Double budgetAmount); + + _FinalStage budgetAmount(Nullable budgetAmount); + + /** + *

Whether budget_amount is spent per day (daily) or over the ad group's full run (lifetime).

+ */ + _FinalStage budgetType(Optional budgetType); + + _FinalStage budgetType(AdGroupBudgetType budgetType); + + _FinalStage budgetType(Nullable budgetType); + + _FinalStage conversionEvent(Optional conversionEvent); + + _FinalStage conversionEvent(ConversionEvent conversionEvent); + + _FinalStage conversionEvent(Nullable conversionEvent); + + /** + *

Where the outcome being optimized for occurs, such as a website visit, social-profile visit, messaging conversation, ad interaction, or lead-form submission.

+ */ + _FinalStage conversionLocation(Optional conversionLocation); + + _FinalStage conversionLocation(AdGroupConversionLocation conversionLocation); + + _FinalStage conversionLocation(Nullable conversionLocation); + + /** + *

Spend divided by attributed add-to-cart events; null when they are not the goal and none are attributed.

+ */ + _FinalStage costPerAddedToCart(Optional costPerAddedToCart); + + _FinalStage costPerAddedToCart(Double costPerAddedToCart); + + _FinalStage costPerAddedToCart(Nullable costPerAddedToCart); + + /** + *

Spend divided by attributed complete-registration events; null when they are not the goal and none are attributed.

+ */ + _FinalStage costPerCompletedRegistration(Optional costPerCompletedRegistration); + + _FinalStage costPerCompletedRegistration(Double costPerCompletedRegistration); + + _FinalStage costPerCompletedRegistration(Nullable costPerCompletedRegistration); + + /** + *

Spend divided by attributed contact events; null when contacts are not the goal and none are attributed.

+ */ + _FinalStage costPerContact(Optional costPerContact); + + _FinalStage costPerContact(Double costPerContact); + + _FinalStage costPerContact(Nullable costPerContact); + + /** + *

Spend divided by attributed leads; null when leads are not a goal and none are attributed.

+ */ + _FinalStage costPerLead(Optional costPerLead); + + _FinalStage costPerLead(Double costPerLead); + + _FinalStage costPerLead(Nullable costPerLead); + + /** + *

Spend divided by attributed purchases; null when purchases are not a goal and none are attributed.

+ */ + _FinalStage costPerPurchase(Optional costPerPurchase); + + _FinalStage costPerPurchase(Double costPerPurchase); + + _FinalStage costPerPurchase(Nullable costPerPurchase); + + /** + *

Spend divided by Whop pixel-attributed results; null when nothing Whop-attributable is being optimized for.

+ */ + _FinalStage costPerResult(Optional costPerResult); + + _FinalStage costPerResult(Double costPerResult); + + _FinalStage costPerResult(Nullable costPerResult); + + /** + *

Spend divided by attributed schedule events; null when schedules are not the goal and none are attributed.

+ */ + _FinalStage costPerSchedule(Optional costPerSchedule); + + _FinalStage costPerSchedule(Double costPerSchedule); + + _FinalStage costPerSchedule(Nullable costPerSchedule); + + /** + *

Spend divided by attributed submit-application events; null when they are not the goal and none are attributed.

+ */ + _FinalStage costPerSubmittedApplication(Optional costPerSubmittedApplication); + + _FinalStage costPerSubmittedApplication(Double costPerSubmittedApplication); + + _FinalStage costPerSubmittedApplication(Nullable costPerSubmittedApplication); + + /** + *

Spend divided by unique clicks; null when there are no unique clicks.

+ */ + _FinalStage costPerUniqueClick(Optional costPerUniqueClick); + + _FinalStage costPerUniqueClick(Double costPerUniqueClick); + + _FinalStage costPerUniqueClick(Nullable costPerUniqueClick); + + /** + *

Spend divided by attributed view-content events; null when they are not the goal and none are attributed.

+ */ + _FinalStage costPerViewedContent(Optional costPerViewedContent); + + _FinalStage costPerViewedContent(Double costPerViewedContent); + + _FinalStage costPerViewedContent(Nullable costPerViewedContent); + + /** + *

Whop pixel-attributed custom conversions, keyed by your event name with its last-click count as the value. Empty when no named custom events are attributed. Custom events fired without a name are counted in custom_conversions but omitted here, so these values sum to at most custom_conversions.

+ */ + _FinalStage customEventCounts(Map customEventCounts); + + _FinalStage putAllCustomEventCounts(Map customEventCounts); + + _FinalStage customEventCounts(String key, Object value); + + /** + *

Conversion value attributed to each custom event, keyed by event name like custom_event_counts. Sums the value passed to whop.track, normalized to USD; events fired without a value contribute 0.

+ */ + _FinalStage customEventValues(Map customEventValues); + + _FinalStage putAllCustomEventValues(Map customEventValues); + + _FinalStage customEventValues(String key, Object value); + + /** + *

Cost per result to aim for (average_target) or never exceed (maximum_target). null for minimum_cost bidding.

+ */ + _FinalStage desiredCostPerResult(Optional desiredCostPerResult); + + _FinalStage desiredCostPerResult(Double desiredCostPerResult); + + _FinalStage desiredCostPerResult(Nullable desiredCostPerResult); + + /** + *

Whether the ad platform automatically mixes and matches this ad group's creatives and copy to find the best-performing combinations.

+ */ + _FinalStage dynamicCreative(Optional dynamicCreative); + + _FinalStage dynamicCreative(Boolean dynamicCreative); + + /** + *

When the ad group stops delivering, as an ISO 8601 timestamp. null when it runs until paused.

+ */ + _FinalStage endsAt(Optional endsAt); + + _FinalStage endsAt(String endsAt); + + _FinalStage endsAt(Nullable endsAt); + + /** + *

Platform-reported impressions divided by reach.

+ */ + _FinalStage frequency(Optional frequency); + + _FinalStage frequency(Double frequency); + + _FinalStage frequency(Nullable frequency); + + /** + *

Cap on how often one person sees ads from this ad group. Only available on campaigns with the awareness objective; null when uncapped.

+ */ + _FinalStage frequencyCap(Optional frequencyCap); + + _FinalStage frequencyCap(AdGroupFrequencyCap frequencyCap); + + _FinalStage frequencyCap(Nullable frequencyCap); + + _FinalStage issues(List issues); + + _FinalStage addIssues(AdPlatformIssue issues); + + _FinalStage addAllIssues(List issues); + + _FinalStage languages(List languages); + + _FinalStage addLanguages(String languages); + + _FinalStage addAllLanguages(List languages); + + _FinalStage messageApps(Optional> messageApps); + + _FinalStage messageApps(List messageApps); + + /** + *

Minimum the ad group tries to spend each day. null when no floor is set.

+ */ + _FinalStage minimumDailySpend(Optional minimumDailySpend); + + _FinalStage minimumDailySpend(Double minimumDailySpend); + + _FinalStage minimumDailySpend(Nullable minimumDailySpend); + + /** + *

The result the ad group's delivery is optimized to get the most of.

+ */ + _FinalStage optimizationGoal(Optional optimizationGoal); + + _FinalStage optimizationGoal(AdGroupOptimizationGoal optimizationGoal); + + _FinalStage optimizationGoal(Nullable optimizationGoal); + + _FinalStage placements(List placements); + + _FinalStage addPlacements(AdGroupPlacement placements); + + _FinalStage addAllPlacements(List placements); + + /** + *

The Whop pixel conversion event whose attributed count represents results — the optimization goal, or the highest-volume attributed event for campaigns that budget per ad group. Null when the goal isn't a Whop-attributed event.

+ */ + _FinalStage resultEvent(Optional resultEvent); + + _FinalStage resultEvent(AdGroupResultEvent resultEvent); + + _FinalStage resultEvent(Nullable resultEvent); + + /** + *

The merchant-defined event name when result_event is custom; null for the standard events.

+ */ + _FinalStage resultEventName(Optional resultEventName); + + _FinalStage resultEventName(String resultEventName); + + _FinalStage resultEventName(Nullable resultEventName); + + /** + *

The Whop pixel-attributed count behind result_event. When a campaign's ad groups optimize different goals there is no single result_event (it is null), and this is instead the sum of each ad group's own attributed results. Null when nothing Whop-attributable is being optimized for.

+ */ + _FinalStage results(Optional results); + + _FinalStage results(Double results); + + _FinalStage results(Nullable results); + + /** + *

The ISO 4217 currency code of all monetary metrics.

+ */ + _FinalStage spendCurrency(Optional spendCurrency); + + _FinalStage spendCurrency(String spendCurrency); + + _FinalStage spendCurrency(Nullable spendCurrency); + + /** + *

When the ad group starts delivering, as an ISO 8601 timestamp. null when it starts as soon as it's active.

+ */ + _FinalStage startsAt(Optional startsAt); + + _FinalStage startsAt(String startsAt); + + _FinalStage startsAt(Nullable startsAt); + + /** + *

Display name of the ad group.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + + /** + *

Unique clicks divided by impressions, between 0 and 1.

+ */ + _FinalStage uniqueClickThroughRate(Optional uniqueClickThroughRate); + + _FinalStage uniqueClickThroughRate(Double uniqueClickThroughRate); + + _FinalStage uniqueClickThroughRate(Nullable uniqueClickThroughRate); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AdCampaignStage, + AddedToCartValueStage, + AddedToCartsStage, + AudiencesStage, + ClickThroughRateStage, + ClicksStage, + CompletedRegistrationValueStage, + CompletedRegistrationsStage, + ContactValueStage, + ContactsStage, + CostPerClickStage, + CostPerMilleStage, + CreatedAtStage, + CustomConversionsStage, + DeliveryStatusStage, + DemographicsStage, + DetailedTargetingStage, + DevicesStage, + IdStage, + ImpressionsStage, + LeadValueStage, + LeadsStage, + PurchaseValueStage, + PurchasesStage, + ReachStage, + RegionsStage, + ReturnOnAdSpendStage, + ScheduleValueStage, + SchedulesStage, + SpendStage, + StatusStage, + SubmittedApplicationValueStage, + SubmittedApplicationsStage, + UniqueClicksStage, + UpdatedAtStage, + ViewedContentValueStage, + ViewedContentsStage, + _FinalStage { + private AdEntityReference adCampaign; + + private double addedToCartValue; + + private double addedToCarts; + + private AdGroupAudiences audiences; + + private double clickThroughRate; + + private double clicks; + + private double completedRegistrationValue; + + private double completedRegistrations; + + private double contactValue; + + private double contacts; + + private double costPerClick; + + private double costPerMille; + + private String createdAt; + + private double customConversions; + + private AdGroupDeliveryStatus deliveryStatus; + + private AdGroupDemographics demographics; + + private AdGroupDetailedTargeting detailedTargeting; + + private AdGroupDevices devices; + + private String id; + + private double impressions; + + private double leadValue; + + private double leads; + + private double purchaseValue; + + private double purchases; + + private double reach; + + private AdGroupRegions regions; + + private double returnOnAdSpend; + + private double scheduleValue; + + private double schedules; + + private double spend; + + private AdGroupStatus status; + + private double submittedApplicationValue; + + private double submittedApplications; + + private double uniqueClicks; + + private String updatedAt; + + private double viewedContentValue; + + private double viewedContents; + + private Optional uniqueClickThroughRate = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional startsAt = Optional.empty(); + + private Optional spendCurrency = Optional.empty(); + + private Optional results = Optional.empty(); + + private Optional resultEventName = Optional.empty(); + + private Optional resultEvent = Optional.empty(); + + private List placements = new ArrayList<>(); + + private Optional optimizationGoal = Optional.empty(); + + private Optional minimumDailySpend = Optional.empty(); + + private Optional> messageApps = Optional.empty(); + + private List languages = new ArrayList<>(); + + private List issues = new ArrayList<>(); + + private Optional frequencyCap = Optional.empty(); + + private Optional frequency = Optional.empty(); + + private Optional endsAt = Optional.empty(); + + private Optional dynamicCreative = Optional.empty(); + + private Optional desiredCostPerResult = Optional.empty(); + + private Map customEventValues = new LinkedHashMap<>(); + + private Map customEventCounts = new LinkedHashMap<>(); + + private Optional costPerViewedContent = Optional.empty(); + + private Optional costPerUniqueClick = Optional.empty(); + + private Optional costPerSubmittedApplication = Optional.empty(); + + private Optional costPerSchedule = Optional.empty(); + + private Optional costPerResult = Optional.empty(); + + private Optional costPerPurchase = Optional.empty(); + + private Optional costPerLead = Optional.empty(); + + private Optional costPerContact = Optional.empty(); + + private Optional costPerCompletedRegistration = Optional.empty(); + + private Optional costPerAddedToCart = Optional.empty(); + + private Optional conversionLocation = Optional.empty(); + + private Optional conversionEvent = Optional.empty(); + + private Optional budgetType = Optional.empty(); + + private Optional budgetAmount = Optional.empty(); + + private Optional bidType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroup other) { + adCampaign(other.getAdCampaign()); + addedToCartValue(other.getAddedToCartValue()); + addedToCarts(other.getAddedToCarts()); + audiences(other.getAudiences()); + bidType(other.getBidType()); + budgetAmount(other.getBudgetAmount()); + budgetType(other.getBudgetType()); + clickThroughRate(other.getClickThroughRate()); + clicks(other.getClicks()); + completedRegistrationValue(other.getCompletedRegistrationValue()); + completedRegistrations(other.getCompletedRegistrations()); + contactValue(other.getContactValue()); + contacts(other.getContacts()); + conversionEvent(other.getConversionEvent()); + conversionLocation(other.getConversionLocation()); + costPerAddedToCart(other.getCostPerAddedToCart()); + costPerClick(other.getCostPerClick()); + costPerCompletedRegistration(other.getCostPerCompletedRegistration()); + costPerContact(other.getCostPerContact()); + costPerLead(other.getCostPerLead()); + costPerMille(other.getCostPerMille()); + costPerPurchase(other.getCostPerPurchase()); + costPerResult(other.getCostPerResult()); + costPerSchedule(other.getCostPerSchedule()); + costPerSubmittedApplication(other.getCostPerSubmittedApplication()); + costPerUniqueClick(other.getCostPerUniqueClick()); + costPerViewedContent(other.getCostPerViewedContent()); + createdAt(other.getCreatedAt()); + customConversions(other.getCustomConversions()); + customEventCounts(other.getCustomEventCounts()); + customEventValues(other.getCustomEventValues()); + deliveryStatus(other.getDeliveryStatus()); + demographics(other.getDemographics()); + desiredCostPerResult(other.getDesiredCostPerResult()); + detailedTargeting(other.getDetailedTargeting()); + devices(other.getDevices()); + dynamicCreative(other.getDynamicCreative()); + endsAt(other.getEndsAt()); + frequency(other.getFrequency()); + frequencyCap(other.getFrequencyCap()); + id(other.getId()); + impressions(other.getImpressions()); + issues(other.getIssues()); + languages(other.getLanguages()); + leadValue(other.getLeadValue()); + leads(other.getLeads()); + messageApps(other.getMessageApps()); + minimumDailySpend(other.getMinimumDailySpend()); + optimizationGoal(other.getOptimizationGoal()); + placements(other.getPlacements()); + purchaseValue(other.getPurchaseValue()); + purchases(other.getPurchases()); + reach(other.getReach()); + regions(other.getRegions()); + resultEvent(other.getResultEvent()); + resultEventName(other.getResultEventName()); + results(other.getResults()); + returnOnAdSpend(other.getReturnOnAdSpend()); + scheduleValue(other.getScheduleValue()); + schedules(other.getSchedules()); + spend(other.getSpend()); + spendCurrency(other.getSpendCurrency()); + startsAt(other.getStartsAt()); + status(other.getStatus()); + submittedApplicationValue(other.getSubmittedApplicationValue()); + submittedApplications(other.getSubmittedApplications()); + title(other.getTitle()); + uniqueClickThroughRate(other.getUniqueClickThroughRate()); + uniqueClicks(other.getUniqueClicks()); + updatedAt(other.getUpdatedAt()); + viewedContentValue(other.getViewedContentValue()); + viewedContents(other.getViewedContents()); + return this; + } + + /** + *

The ad campaign this ad group belongs to.

+ *

The ad campaign this ad group belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ad_campaign") + public AddedToCartValueStage adCampaign(@NotNull AdEntityReference adCampaign) { + this.adCampaign = Objects.requireNonNull(adCampaign, "adCampaign must not be null"); + return this; + } + + /** + *

USD value attributed to add-to-cart events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to add-to-cart events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("added_to_cart_value") + public AddedToCartsStage addedToCartValue(double addedToCartValue) { + this.addedToCartValue = addedToCartValue; + return this; + } + + /** + *

Whop pixel-attributed add-to-cart events, last-click.

+ *

Whop pixel-attributed add-to-cart events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("added_to_carts") + public AudiencesStage addedToCarts(double addedToCarts) { + this.addedToCarts = addedToCarts; + return this; + } + + /** + *

Saved audiences this ad group delivers to or excludes.

+ *

Saved audiences this ad group delivers to or excludes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("audiences") + public ClickThroughRateStage audiences(@NotNull AdGroupAudiences audiences) { + this.audiences = Objects.requireNonNull(audiences, "audiences must not be null"); + return this; + } + + /** + *

Clicks divided by impressions, between 0 and 1.

+ *

Clicks divided by impressions, between 0 and 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("click_through_rate") + public ClicksStage clickThroughRate(double clickThroughRate) { + this.clickThroughRate = clickThroughRate; + return this; + } + + /** + *

The number of clicks.

+ *

The number of clicks.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("clicks") + public CompletedRegistrationValueStage clicks(double clicks) { + this.clicks = clicks; + return this; + } + + /** + *

USD value attributed to complete-registration events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to complete-registration events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completed_registration_value") + public CompletedRegistrationsStage completedRegistrationValue(double completedRegistrationValue) { + this.completedRegistrationValue = completedRegistrationValue; + return this; + } + + /** + *

Whop pixel-attributed complete-registration events, last-click.

+ *

Whop pixel-attributed complete-registration events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completed_registrations") + public ContactValueStage completedRegistrations(double completedRegistrations) { + this.completedRegistrations = completedRegistrations; + return this; + } + + /** + *

USD value attributed to contact events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to contact events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("contact_value") + public ContactsStage contactValue(double contactValue) { + this.contactValue = contactValue; + return this; + } + + /** + *

Whop pixel-attributed contact events, last-click.

+ *

Whop pixel-attributed contact events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("contacts") + public CostPerClickStage contacts(double contacts) { + this.contacts = contacts; + return this; + } + + /** + *

Spend divided by clicks; 0 when there are no clicks.

+ *

Spend divided by clicks; 0 when there are no clicks.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cost_per_click") + public CostPerMilleStage costPerClick(double costPerClick) { + this.costPerClick = costPerClick; + return this; + } + + /** + *

Spend per 1,000 impressions; 0 when there are no impressions.

+ *

Spend per 1,000 impressions; 0 when there are no impressions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cost_per_mille") + public CreatedAtStage costPerMille(double costPerMille) { + this.costPerMille = costPerMille; + return this; + } + + /** + *

When the ad group was created, as an ISO 8601 timestamp.

+ *

When the ad group was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CustomConversionsStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Whop pixel-attributed custom (merchant-defined) conversion events, last-click, across all custom event names.

+ *

Whop pixel-attributed custom (merchant-defined) conversion events, last-click, across all custom event names.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("custom_conversions") + public DeliveryStatusStage customConversions(double customConversions) { + this.customConversions = customConversions; + return this; + } + + /** + *

Whether ads in this ad group are delivering right now, and if not, why. When several states apply at once, the highest-precedence one is returned.

+ *

Whether ads in this ad group are delivering right now, and if not, why. When several states apply at once, the highest-precedence one is returned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("delivery_status") + public DemographicsStage deliveryStatus(@NotNull AdGroupDeliveryStatus deliveryStatus) { + this.deliveryStatus = Objects.requireNonNull(deliveryStatus, "deliveryStatus must not be null"); + return this; + } + + /** + *

Age, gender, and automatic-audience targeting.

+ *

Age, gender, and automatic-audience targeting.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("demographics") + public DetailedTargetingStage demographics(@NotNull AdGroupDemographics demographics) { + this.demographics = Objects.requireNonNull(demographics, "demographics must not be null"); + return this; + } + + /** + *

Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. Entries across interests, behaviors, and demographics are OR'd together (anyone matching any entry is reached), matching Ads Manager's detailed-targeting box. Can't be combined with automatic audience targeting, and unavailable to campaigns with special_ad_categories.

+ *

Interest, behavior, and demographic targeting, using categories from the ad platform's targeting taxonomy. Entries across interests, behaviors, and demographics are OR'd together (anyone matching any entry is reached), matching Ads Manager's detailed-targeting box. Can't be combined with automatic audience targeting, and unavailable to campaigns with special_ad_categories.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("detailed_targeting") + public DevicesStage detailedTargeting(@NotNull AdGroupDetailedTargeting detailedTargeting) { + this.detailedTargeting = Objects.requireNonNull(detailedTargeting, "detailedTargeting must not be null"); + return this; + } + + /** + *

Device platforms and operating systems targeted.

+ *

Device platforms and operating systems targeted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("devices") + public IdStage devices(@NotNull AdGroupDevices devices) { + this.devices = Objects.requireNonNull(devices, "devices must not be null"); + return this; + } + + /** + *

Unique identifier for the ad group, prefixed adgrp_.

+ *

Unique identifier for the ad group, prefixed adgrp_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ImpressionsStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The number of impressions.

+ *

The number of impressions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("impressions") + public LeadValueStage impressions(double impressions) { + this.impressions = impressions; + return this; + } + + /** + *

USD value attributed to lead events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to lead events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("lead_value") + public LeadsStage leadValue(double leadValue) { + this.leadValue = leadValue; + return this; + } + + /** + *

Whop pixel-attributed leads, last-click.

+ *

Whop pixel-attributed leads, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("leads") + public PurchaseValueStage leads(double leads) { + this.leads = leads; + return this; + } + + /** + *

USD value of pixel-attributed purchases.

+ *

USD value of pixel-attributed purchases.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("purchase_value") + public PurchasesStage purchaseValue(double purchaseValue) { + this.purchaseValue = purchaseValue; + return this; + } + + /** + *

Whop pixel-attributed purchases, last-click.

+ *

Whop pixel-attributed purchases, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("purchases") + public ReachStage purchases(double purchases) { + this.purchases = purchases; + return this; + } + + /** + *

The number of unique people who saw this.

+ *

The number of unique people who saw this.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reach") + public RegionsStage reach(double reach) { + this.reach = reach; + return this; + } + + /** + *

Locations targeted and excluded.

+ *

Locations targeted and excluded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("regions") + public ReturnOnAdSpendStage regions(@NotNull AdGroupRegions regions) { + this.regions = Objects.requireNonNull(regions, "regions must not be null"); + return this; + } + + /** + *

Purchase value divided by spend, both in USD (a currency-neutral ratio); 0 when there is no spend.

+ *

Purchase value divided by spend, both in USD (a currency-neutral ratio); 0 when there is no spend.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("return_on_ad_spend") + public ScheduleValueStage returnOnAdSpend(double returnOnAdSpend) { + this.returnOnAdSpend = returnOnAdSpend; + return this; + } + + /** + *

USD value attributed to schedule events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to schedule events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("schedule_value") + public SchedulesStage scheduleValue(double scheduleValue) { + this.scheduleValue = scheduleValue; + return this; + } + + /** + *

Whop pixel-attributed schedule events, last-click.

+ *

Whop pixel-attributed schedule events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("schedules") + public SpendStage schedules(double schedules) { + this.schedules = schedules; + return this; + } + + /** + *

The amount charged, in spend_currency.

+ *

The amount charged, in spend_currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("spend") + public StatusStage spend(double spend) { + this.spend = spend; + return this; + } + + /** + *

Whether the ad group is enabled. active and paused are set by you; rejected means it failed ad review; duplicating is a copy still being filled in.

+ *

Whether the ad group is enabled. active and paused are set by you; rejected means it failed ad review; duplicating is a copy still being filled in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public SubmittedApplicationValueStage status(@NotNull AdGroupStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

USD value attributed to submit-application events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to submit-application events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("submitted_application_value") + public SubmittedApplicationsStage submittedApplicationValue(double submittedApplicationValue) { + this.submittedApplicationValue = submittedApplicationValue; + return this; + } + + /** + *

Whop pixel-attributed submit-application events, last-click.

+ *

Whop pixel-attributed submit-application events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("submitted_applications") + public UniqueClicksStage submittedApplications(double submittedApplications) { + this.submittedApplications = submittedApplications; + return this; + } + + /** + *

People who clicked, reported by the Whop pixel, counted once per person.

+ *

People who clicked, reported by the Whop pixel, counted once per person.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("unique_clicks") + public UpdatedAtStage uniqueClicks(double uniqueClicks) { + this.uniqueClicks = uniqueClicks; + return this; + } + + /** + *

When the ad group was last updated, as an ISO 8601 timestamp.

+ *

When the ad group was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public ViewedContentValueStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

USD value attributed to view-content events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ *

USD value attributed to view-content events. Sums the value sent with each event, normalized to USD; events without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("viewed_content_value") + public ViewedContentsStage viewedContentValue(double viewedContentValue) { + this.viewedContentValue = viewedContentValue; + return this; + } + + /** + *

Whop pixel-attributed view-content events, last-click.

+ *

Whop pixel-attributed view-content events, last-click.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("viewed_contents") + public _FinalStage viewedContents(double viewedContents) { + this.viewedContents = viewedContents; + return this; + } + + /** + *

Unique clicks divided by impressions, between 0 and 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage uniqueClickThroughRate(Nullable uniqueClickThroughRate) { + if (uniqueClickThroughRate.isNull()) { + this.uniqueClickThroughRate = null; + } else if (uniqueClickThroughRate.isEmpty()) { + this.uniqueClickThroughRate = Optional.empty(); + } else { + this.uniqueClickThroughRate = Optional.of(uniqueClickThroughRate.get()); + } + return this; + } + + /** + *

Unique clicks divided by impressions, between 0 and 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage uniqueClickThroughRate(Double uniqueClickThroughRate) { + this.uniqueClickThroughRate = Optional.ofNullable(uniqueClickThroughRate); + return this; + } + + /** + *

Unique clicks divided by impressions, between 0 and 1.

+ */ + @java.lang.Override + @JsonSetter(value = "unique_click_through_rate", nulls = Nulls.SKIP) + public _FinalStage uniqueClickThroughRate(Optional uniqueClickThroughRate) { + this.uniqueClickThroughRate = uniqueClickThroughRate; + return this; + } + + /** + *

Display name of the ad group.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Display name of the ad group.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Display name of the ad group.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

When the ad group starts delivering, as an ISO 8601 timestamp. null when it starts as soon as it's active.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startsAt(Nullable startsAt) { + if (startsAt.isNull()) { + this.startsAt = null; + } else if (startsAt.isEmpty()) { + this.startsAt = Optional.empty(); + } else { + this.startsAt = Optional.of(startsAt.get()); + } + return this; + } + + /** + *

When the ad group starts delivering, as an ISO 8601 timestamp. null when it starts as soon as it's active.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startsAt(String startsAt) { + this.startsAt = Optional.ofNullable(startsAt); + return this; + } + + /** + *

When the ad group starts delivering, as an ISO 8601 timestamp. null when it starts as soon as it's active.

+ */ + @java.lang.Override + @JsonSetter(value = "starts_at", nulls = Nulls.SKIP) + public _FinalStage startsAt(Optional startsAt) { + this.startsAt = startsAt; + return this; + } + + /** + *

The ISO 4217 currency code of all monetary metrics.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spendCurrency(Nullable spendCurrency) { + if (spendCurrency.isNull()) { + this.spendCurrency = null; + } else if (spendCurrency.isEmpty()) { + this.spendCurrency = Optional.empty(); + } else { + this.spendCurrency = Optional.of(spendCurrency.get()); + } + return this; + } + + /** + *

The ISO 4217 currency code of all monetary metrics.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spendCurrency(String spendCurrency) { + this.spendCurrency = Optional.ofNullable(spendCurrency); + return this; + } + + /** + *

The ISO 4217 currency code of all monetary metrics.

+ */ + @java.lang.Override + @JsonSetter(value = "spend_currency", nulls = Nulls.SKIP) + public _FinalStage spendCurrency(Optional spendCurrency) { + this.spendCurrency = spendCurrency; + return this; + } + + /** + *

The Whop pixel-attributed count behind result_event. When a campaign's ad groups optimize different goals there is no single result_event (it is null), and this is instead the sum of each ad group's own attributed results. Null when nothing Whop-attributable is being optimized for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage results(Nullable results) { + if (results.isNull()) { + this.results = null; + } else if (results.isEmpty()) { + this.results = Optional.empty(); + } else { + this.results = Optional.of(results.get()); + } + return this; + } + + /** + *

The Whop pixel-attributed count behind result_event. When a campaign's ad groups optimize different goals there is no single result_event (it is null), and this is instead the sum of each ad group's own attributed results. Null when nothing Whop-attributable is being optimized for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage results(Double results) { + this.results = Optional.ofNullable(results); + return this; + } + + /** + *

The Whop pixel-attributed count behind result_event. When a campaign's ad groups optimize different goals there is no single result_event (it is null), and this is instead the sum of each ad group's own attributed results. Null when nothing Whop-attributable is being optimized for.

+ */ + @java.lang.Override + @JsonSetter(value = "results", nulls = Nulls.SKIP) + public _FinalStage results(Optional results) { + this.results = results; + return this; + } + + /** + *

The merchant-defined event name when result_event is custom; null for the standard events.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultEventName(Nullable resultEventName) { + if (resultEventName.isNull()) { + this.resultEventName = null; + } else if (resultEventName.isEmpty()) { + this.resultEventName = Optional.empty(); + } else { + this.resultEventName = Optional.of(resultEventName.get()); + } + return this; + } + + /** + *

The merchant-defined event name when result_event is custom; null for the standard events.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultEventName(String resultEventName) { + this.resultEventName = Optional.ofNullable(resultEventName); + return this; + } + + /** + *

The merchant-defined event name when result_event is custom; null for the standard events.

+ */ + @java.lang.Override + @JsonSetter(value = "result_event_name", nulls = Nulls.SKIP) + public _FinalStage resultEventName(Optional resultEventName) { + this.resultEventName = resultEventName; + return this; + } + + /** + *

The Whop pixel conversion event whose attributed count represents results — the optimization goal, or the highest-volume attributed event for campaigns that budget per ad group. Null when the goal isn't a Whop-attributed event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultEvent(Nullable resultEvent) { + if (resultEvent.isNull()) { + this.resultEvent = null; + } else if (resultEvent.isEmpty()) { + this.resultEvent = Optional.empty(); + } else { + this.resultEvent = Optional.of(resultEvent.get()); + } + return this; + } + + /** + *

The Whop pixel conversion event whose attributed count represents results — the optimization goal, or the highest-volume attributed event for campaigns that budget per ad group. Null when the goal isn't a Whop-attributed event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultEvent(AdGroupResultEvent resultEvent) { + this.resultEvent = Optional.ofNullable(resultEvent); + return this; + } + + /** + *

The Whop pixel conversion event whose attributed count represents results — the optimization goal, or the highest-volume attributed event for campaigns that budget per ad group. Null when the goal isn't a Whop-attributed event.

+ */ + @java.lang.Override + @JsonSetter(value = "result_event", nulls = Nulls.SKIP) + public _FinalStage resultEvent(Optional resultEvent) { + this.resultEvent = resultEvent; + return this; + } + + @java.lang.Override + public _FinalStage addAllPlacements(List placements) { + if (placements != null) { + this.placements.addAll(placements); + } + return this; + } + + @java.lang.Override + public _FinalStage addPlacements(AdGroupPlacement placements) { + this.placements.add(placements); + return this; + } + + @java.lang.Override + @JsonSetter(value = "placements", nulls = Nulls.SKIP) + public _FinalStage placements(List placements) { + this.placements.clear(); + if (placements != null) { + this.placements.addAll(placements); + } + return this; + } + + /** + *

The result the ad group's delivery is optimized to get the most of.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optimizationGoal(Nullable optimizationGoal) { + if (optimizationGoal.isNull()) { + this.optimizationGoal = null; + } else if (optimizationGoal.isEmpty()) { + this.optimizationGoal = Optional.empty(); + } else { + this.optimizationGoal = Optional.of(optimizationGoal.get()); + } + return this; + } + + /** + *

The result the ad group's delivery is optimized to get the most of.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optimizationGoal(AdGroupOptimizationGoal optimizationGoal) { + this.optimizationGoal = Optional.ofNullable(optimizationGoal); + return this; + } + + /** + *

The result the ad group's delivery is optimized to get the most of.

+ */ + @java.lang.Override + @JsonSetter(value = "optimization_goal", nulls = Nulls.SKIP) + public _FinalStage optimizationGoal(Optional optimizationGoal) { + this.optimizationGoal = optimizationGoal; + return this; + } + + /** + *

Minimum the ad group tries to spend each day. null when no floor is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage minimumDailySpend(Nullable minimumDailySpend) { + if (minimumDailySpend.isNull()) { + this.minimumDailySpend = null; + } else if (minimumDailySpend.isEmpty()) { + this.minimumDailySpend = Optional.empty(); + } else { + this.minimumDailySpend = Optional.of(minimumDailySpend.get()); + } + return this; + } + + /** + *

Minimum the ad group tries to spend each day. null when no floor is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage minimumDailySpend(Double minimumDailySpend) { + this.minimumDailySpend = Optional.ofNullable(minimumDailySpend); + return this; + } + + /** + *

Minimum the ad group tries to spend each day. null when no floor is set.

+ */ + @java.lang.Override + @JsonSetter(value = "minimum_daily_spend", nulls = Nulls.SKIP) + public _FinalStage minimumDailySpend(Optional minimumDailySpend) { + this.minimumDailySpend = minimumDailySpend; + return this; + } + + @java.lang.Override + public _FinalStage messageApps(List messageApps) { + this.messageApps = Optional.ofNullable(messageApps); + return this; + } + + @java.lang.Override + @JsonSetter(value = "message_apps", nulls = Nulls.SKIP) + public _FinalStage messageApps(Optional> messageApps) { + this.messageApps = messageApps; + return this; + } + + @java.lang.Override + public _FinalStage addAllLanguages(List languages) { + if (languages != null) { + this.languages.addAll(languages); + } + return this; + } + + @java.lang.Override + public _FinalStage addLanguages(String languages) { + this.languages.add(languages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "languages", nulls = Nulls.SKIP) + public _FinalStage languages(List languages) { + this.languages.clear(); + if (languages != null) { + this.languages.addAll(languages); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllIssues(List issues) { + if (issues != null) { + this.issues.addAll(issues); + } + return this; + } + + @java.lang.Override + public _FinalStage addIssues(AdPlatformIssue issues) { + this.issues.add(issues); + return this; + } + + @java.lang.Override + @JsonSetter(value = "issues", nulls = Nulls.SKIP) + public _FinalStage issues(List issues) { + this.issues.clear(); + if (issues != null) { + this.issues.addAll(issues); + } + return this; + } + + /** + *

Cap on how often one person sees ads from this ad group. Only available on campaigns with the awareness objective; null when uncapped.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frequencyCap(Nullable frequencyCap) { + if (frequencyCap.isNull()) { + this.frequencyCap = null; + } else if (frequencyCap.isEmpty()) { + this.frequencyCap = Optional.empty(); + } else { + this.frequencyCap = Optional.of(frequencyCap.get()); + } + return this; + } + + /** + *

Cap on how often one person sees ads from this ad group. Only available on campaigns with the awareness objective; null when uncapped.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frequencyCap(AdGroupFrequencyCap frequencyCap) { + this.frequencyCap = Optional.ofNullable(frequencyCap); + return this; + } + + /** + *

Cap on how often one person sees ads from this ad group. Only available on campaigns with the awareness objective; null when uncapped.

+ */ + @java.lang.Override + @JsonSetter(value = "frequency_cap", nulls = Nulls.SKIP) + public _FinalStage frequencyCap(Optional frequencyCap) { + this.frequencyCap = frequencyCap; + return this; + } + + /** + *

Platform-reported impressions divided by reach.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frequency(Nullable frequency) { + if (frequency.isNull()) { + this.frequency = null; + } else if (frequency.isEmpty()) { + this.frequency = Optional.empty(); + } else { + this.frequency = Optional.of(frequency.get()); + } + return this; + } + + /** + *

Platform-reported impressions divided by reach.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frequency(Double frequency) { + this.frequency = Optional.ofNullable(frequency); + return this; + } + + /** + *

Platform-reported impressions divided by reach.

+ */ + @java.lang.Override + @JsonSetter(value = "frequency", nulls = Nulls.SKIP) + public _FinalStage frequency(Optional frequency) { + this.frequency = frequency; + return this; + } + + /** + *

When the ad group stops delivering, as an ISO 8601 timestamp. null when it runs until paused.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endsAt(Nullable endsAt) { + if (endsAt.isNull()) { + this.endsAt = null; + } else if (endsAt.isEmpty()) { + this.endsAt = Optional.empty(); + } else { + this.endsAt = Optional.of(endsAt.get()); + } + return this; + } + + /** + *

When the ad group stops delivering, as an ISO 8601 timestamp. null when it runs until paused.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endsAt(String endsAt) { + this.endsAt = Optional.ofNullable(endsAt); + return this; + } + + /** + *

When the ad group stops delivering, as an ISO 8601 timestamp. null when it runs until paused.

+ */ + @java.lang.Override + @JsonSetter(value = "ends_at", nulls = Nulls.SKIP) + public _FinalStage endsAt(Optional endsAt) { + this.endsAt = endsAt; + return this; + } + + /** + *

Whether the ad platform automatically mixes and matches this ad group's creatives and copy to find the best-performing combinations.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dynamicCreative(Boolean dynamicCreative) { + this.dynamicCreative = Optional.ofNullable(dynamicCreative); + return this; + } + + /** + *

Whether the ad platform automatically mixes and matches this ad group's creatives and copy to find the best-performing combinations.

+ */ + @java.lang.Override + @JsonSetter(value = "dynamic_creative", nulls = Nulls.SKIP) + public _FinalStage dynamicCreative(Optional dynamicCreative) { + this.dynamicCreative = dynamicCreative; + return this; + } + + /** + *

Cost per result to aim for (average_target) or never exceed (maximum_target). null for minimum_cost bidding.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage desiredCostPerResult(Nullable desiredCostPerResult) { + if (desiredCostPerResult.isNull()) { + this.desiredCostPerResult = null; + } else if (desiredCostPerResult.isEmpty()) { + this.desiredCostPerResult = Optional.empty(); + } else { + this.desiredCostPerResult = Optional.of(desiredCostPerResult.get()); + } + return this; + } + + /** + *

Cost per result to aim for (average_target) or never exceed (maximum_target). null for minimum_cost bidding.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage desiredCostPerResult(Double desiredCostPerResult) { + this.desiredCostPerResult = Optional.ofNullable(desiredCostPerResult); + return this; + } + + /** + *

Cost per result to aim for (average_target) or never exceed (maximum_target). null for minimum_cost bidding.

+ */ + @java.lang.Override + @JsonSetter(value = "desired_cost_per_result", nulls = Nulls.SKIP) + public _FinalStage desiredCostPerResult(Optional desiredCostPerResult) { + this.desiredCostPerResult = desiredCostPerResult; + return this; + } + + /** + *

Conversion value attributed to each custom event, keyed by event name like custom_event_counts. Sums the value passed to whop.track, normalized to USD; events fired without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customEventValues(String key, Object value) { + this.customEventValues.put(key, value); + return this; + } + + /** + *

Conversion value attributed to each custom event, keyed by event name like custom_event_counts. Sums the value passed to whop.track, normalized to USD; events fired without a value contribute 0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllCustomEventValues(Map customEventValues) { + if (customEventValues != null) { + this.customEventValues.putAll(customEventValues); + } + return this; + } + + /** + *

Conversion value attributed to each custom event, keyed by event name like custom_event_counts. Sums the value passed to whop.track, normalized to USD; events fired without a value contribute 0.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_event_values", nulls = Nulls.SKIP) + public _FinalStage customEventValues(Map customEventValues) { + this.customEventValues.clear(); + if (customEventValues != null) { + this.customEventValues.putAll(customEventValues); + } + return this; + } + + /** + *

Whop pixel-attributed custom conversions, keyed by your event name with its last-click count as the value. Empty when no named custom events are attributed. Custom events fired without a name are counted in custom_conversions but omitted here, so these values sum to at most custom_conversions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customEventCounts(String key, Object value) { + this.customEventCounts.put(key, value); + return this; + } + + /** + *

Whop pixel-attributed custom conversions, keyed by your event name with its last-click count as the value. Empty when no named custom events are attributed. Custom events fired without a name are counted in custom_conversions but omitted here, so these values sum to at most custom_conversions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllCustomEventCounts(Map customEventCounts) { + if (customEventCounts != null) { + this.customEventCounts.putAll(customEventCounts); + } + return this; + } + + /** + *

Whop pixel-attributed custom conversions, keyed by your event name with its last-click count as the value. Empty when no named custom events are attributed. Custom events fired without a name are counted in custom_conversions but omitted here, so these values sum to at most custom_conversions.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_event_counts", nulls = Nulls.SKIP) + public _FinalStage customEventCounts(Map customEventCounts) { + this.customEventCounts.clear(); + if (customEventCounts != null) { + this.customEventCounts.putAll(customEventCounts); + } + return this; + } + + /** + *

Spend divided by attributed view-content events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerViewedContent(Nullable costPerViewedContent) { + if (costPerViewedContent.isNull()) { + this.costPerViewedContent = null; + } else if (costPerViewedContent.isEmpty()) { + this.costPerViewedContent = Optional.empty(); + } else { + this.costPerViewedContent = Optional.of(costPerViewedContent.get()); + } + return this; + } + + /** + *

Spend divided by attributed view-content events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerViewedContent(Double costPerViewedContent) { + this.costPerViewedContent = Optional.ofNullable(costPerViewedContent); + return this; + } + + /** + *

Spend divided by attributed view-content events; null when they are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_viewed_content", nulls = Nulls.SKIP) + public _FinalStage costPerViewedContent(Optional costPerViewedContent) { + this.costPerViewedContent = costPerViewedContent; + return this; + } + + /** + *

Spend divided by unique clicks; null when there are no unique clicks.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerUniqueClick(Nullable costPerUniqueClick) { + if (costPerUniqueClick.isNull()) { + this.costPerUniqueClick = null; + } else if (costPerUniqueClick.isEmpty()) { + this.costPerUniqueClick = Optional.empty(); + } else { + this.costPerUniqueClick = Optional.of(costPerUniqueClick.get()); + } + return this; + } + + /** + *

Spend divided by unique clicks; null when there are no unique clicks.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerUniqueClick(Double costPerUniqueClick) { + this.costPerUniqueClick = Optional.ofNullable(costPerUniqueClick); + return this; + } + + /** + *

Spend divided by unique clicks; null when there are no unique clicks.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_unique_click", nulls = Nulls.SKIP) + public _FinalStage costPerUniqueClick(Optional costPerUniqueClick) { + this.costPerUniqueClick = costPerUniqueClick; + return this; + } + + /** + *

Spend divided by attributed submit-application events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerSubmittedApplication(Nullable costPerSubmittedApplication) { + if (costPerSubmittedApplication.isNull()) { + this.costPerSubmittedApplication = null; + } else if (costPerSubmittedApplication.isEmpty()) { + this.costPerSubmittedApplication = Optional.empty(); + } else { + this.costPerSubmittedApplication = Optional.of(costPerSubmittedApplication.get()); + } + return this; + } + + /** + *

Spend divided by attributed submit-application events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerSubmittedApplication(Double costPerSubmittedApplication) { + this.costPerSubmittedApplication = Optional.ofNullable(costPerSubmittedApplication); + return this; + } + + /** + *

Spend divided by attributed submit-application events; null when they are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_submitted_application", nulls = Nulls.SKIP) + public _FinalStage costPerSubmittedApplication(Optional costPerSubmittedApplication) { + this.costPerSubmittedApplication = costPerSubmittedApplication; + return this; + } + + /** + *

Spend divided by attributed schedule events; null when schedules are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerSchedule(Nullable costPerSchedule) { + if (costPerSchedule.isNull()) { + this.costPerSchedule = null; + } else if (costPerSchedule.isEmpty()) { + this.costPerSchedule = Optional.empty(); + } else { + this.costPerSchedule = Optional.of(costPerSchedule.get()); + } + return this; + } + + /** + *

Spend divided by attributed schedule events; null when schedules are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerSchedule(Double costPerSchedule) { + this.costPerSchedule = Optional.ofNullable(costPerSchedule); + return this; + } + + /** + *

Spend divided by attributed schedule events; null when schedules are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_schedule", nulls = Nulls.SKIP) + public _FinalStage costPerSchedule(Optional costPerSchedule) { + this.costPerSchedule = costPerSchedule; + return this; + } + + /** + *

Spend divided by Whop pixel-attributed results; null when nothing Whop-attributable is being optimized for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerResult(Nullable costPerResult) { + if (costPerResult.isNull()) { + this.costPerResult = null; + } else if (costPerResult.isEmpty()) { + this.costPerResult = Optional.empty(); + } else { + this.costPerResult = Optional.of(costPerResult.get()); + } + return this; + } + + /** + *

Spend divided by Whop pixel-attributed results; null when nothing Whop-attributable is being optimized for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerResult(Double costPerResult) { + this.costPerResult = Optional.ofNullable(costPerResult); + return this; + } + + /** + *

Spend divided by Whop pixel-attributed results; null when nothing Whop-attributable is being optimized for.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_result", nulls = Nulls.SKIP) + public _FinalStage costPerResult(Optional costPerResult) { + this.costPerResult = costPerResult; + return this; + } + + /** + *

Spend divided by attributed purchases; null when purchases are not a goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerPurchase(Nullable costPerPurchase) { + if (costPerPurchase.isNull()) { + this.costPerPurchase = null; + } else if (costPerPurchase.isEmpty()) { + this.costPerPurchase = Optional.empty(); + } else { + this.costPerPurchase = Optional.of(costPerPurchase.get()); + } + return this; + } + + /** + *

Spend divided by attributed purchases; null when purchases are not a goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerPurchase(Double costPerPurchase) { + this.costPerPurchase = Optional.ofNullable(costPerPurchase); + return this; + } + + /** + *

Spend divided by attributed purchases; null when purchases are not a goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_purchase", nulls = Nulls.SKIP) + public _FinalStage costPerPurchase(Optional costPerPurchase) { + this.costPerPurchase = costPerPurchase; + return this; + } + + /** + *

Spend divided by attributed leads; null when leads are not a goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerLead(Nullable costPerLead) { + if (costPerLead.isNull()) { + this.costPerLead = null; + } else if (costPerLead.isEmpty()) { + this.costPerLead = Optional.empty(); + } else { + this.costPerLead = Optional.of(costPerLead.get()); + } + return this; + } + + /** + *

Spend divided by attributed leads; null when leads are not a goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerLead(Double costPerLead) { + this.costPerLead = Optional.ofNullable(costPerLead); + return this; + } + + /** + *

Spend divided by attributed leads; null when leads are not a goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_lead", nulls = Nulls.SKIP) + public _FinalStage costPerLead(Optional costPerLead) { + this.costPerLead = costPerLead; + return this; + } + + /** + *

Spend divided by attributed contact events; null when contacts are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerContact(Nullable costPerContact) { + if (costPerContact.isNull()) { + this.costPerContact = null; + } else if (costPerContact.isEmpty()) { + this.costPerContact = Optional.empty(); + } else { + this.costPerContact = Optional.of(costPerContact.get()); + } + return this; + } + + /** + *

Spend divided by attributed contact events; null when contacts are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerContact(Double costPerContact) { + this.costPerContact = Optional.ofNullable(costPerContact); + return this; + } + + /** + *

Spend divided by attributed contact events; null when contacts are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_contact", nulls = Nulls.SKIP) + public _FinalStage costPerContact(Optional costPerContact) { + this.costPerContact = costPerContact; + return this; + } + + /** + *

Spend divided by attributed complete-registration events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerCompletedRegistration(Nullable costPerCompletedRegistration) { + if (costPerCompletedRegistration.isNull()) { + this.costPerCompletedRegistration = null; + } else if (costPerCompletedRegistration.isEmpty()) { + this.costPerCompletedRegistration = Optional.empty(); + } else { + this.costPerCompletedRegistration = Optional.of(costPerCompletedRegistration.get()); + } + return this; + } + + /** + *

Spend divided by attributed complete-registration events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerCompletedRegistration(Double costPerCompletedRegistration) { + this.costPerCompletedRegistration = Optional.ofNullable(costPerCompletedRegistration); + return this; + } + + /** + *

Spend divided by attributed complete-registration events; null when they are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_completed_registration", nulls = Nulls.SKIP) + public _FinalStage costPerCompletedRegistration(Optional costPerCompletedRegistration) { + this.costPerCompletedRegistration = costPerCompletedRegistration; + return this; + } + + /** + *

Spend divided by attributed add-to-cart events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerAddedToCart(Nullable costPerAddedToCart) { + if (costPerAddedToCart.isNull()) { + this.costPerAddedToCart = null; + } else if (costPerAddedToCart.isEmpty()) { + this.costPerAddedToCart = Optional.empty(); + } else { + this.costPerAddedToCart = Optional.of(costPerAddedToCart.get()); + } + return this; + } + + /** + *

Spend divided by attributed add-to-cart events; null when they are not the goal and none are attributed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerAddedToCart(Double costPerAddedToCart) { + this.costPerAddedToCart = Optional.ofNullable(costPerAddedToCart); + return this; + } + + /** + *

Spend divided by attributed add-to-cart events; null when they are not the goal and none are attributed.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_added_to_cart", nulls = Nulls.SKIP) + public _FinalStage costPerAddedToCart(Optional costPerAddedToCart) { + this.costPerAddedToCart = costPerAddedToCart; + return this; + } + + /** + *

Where the outcome being optimized for occurs, such as a website visit, social-profile visit, messaging conversation, ad interaction, or lead-form submission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage conversionLocation(Nullable conversionLocation) { + if (conversionLocation.isNull()) { + this.conversionLocation = null; + } else if (conversionLocation.isEmpty()) { + this.conversionLocation = Optional.empty(); + } else { + this.conversionLocation = Optional.of(conversionLocation.get()); + } + return this; + } + + /** + *

Where the outcome being optimized for occurs, such as a website visit, social-profile visit, messaging conversation, ad interaction, or lead-form submission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage conversionLocation(AdGroupConversionLocation conversionLocation) { + this.conversionLocation = Optional.ofNullable(conversionLocation); + return this; + } + + /** + *

Where the outcome being optimized for occurs, such as a website visit, social-profile visit, messaging conversation, ad interaction, or lead-form submission.

+ */ + @java.lang.Override + @JsonSetter(value = "conversion_location", nulls = Nulls.SKIP) + public _FinalStage conversionLocation(Optional conversionLocation) { + this.conversionLocation = conversionLocation; + return this; + } + + @java.lang.Override + public _FinalStage conversionEvent(Nullable conversionEvent) { + if (conversionEvent.isNull()) { + this.conversionEvent = null; + } else if (conversionEvent.isEmpty()) { + this.conversionEvent = Optional.empty(); + } else { + this.conversionEvent = Optional.of(conversionEvent.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage conversionEvent(ConversionEvent conversionEvent) { + this.conversionEvent = Optional.ofNullable(conversionEvent); + return this; + } + + @java.lang.Override + @JsonSetter(value = "conversion_event", nulls = Nulls.SKIP) + public _FinalStage conversionEvent(Optional conversionEvent) { + this.conversionEvent = conversionEvent; + return this; + } + + /** + *

Whether budget_amount is spent per day (daily) or over the ad group's full run (lifetime).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage budgetType(Nullable budgetType) { + if (budgetType.isNull()) { + this.budgetType = null; + } else if (budgetType.isEmpty()) { + this.budgetType = Optional.empty(); + } else { + this.budgetType = Optional.of(budgetType.get()); + } + return this; + } + + /** + *

Whether budget_amount is spent per day (daily) or over the ad group's full run (lifetime).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage budgetType(AdGroupBudgetType budgetType) { + this.budgetType = Optional.ofNullable(budgetType); + return this; + } + + /** + *

Whether budget_amount is spent per day (daily) or over the ad group's full run (lifetime).

+ */ + @java.lang.Override + @JsonSetter(value = "budget_type", nulls = Nulls.SKIP) + public _FinalStage budgetType(Optional budgetType) { + this.budgetType = budgetType; + return this; + } + + /** + *

This ad group's budget, in the ad account's currency. null when the budget is set on the campaign instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage budgetAmount(Nullable budgetAmount) { + if (budgetAmount.isNull()) { + this.budgetAmount = null; + } else if (budgetAmount.isEmpty()) { + this.budgetAmount = Optional.empty(); + } else { + this.budgetAmount = Optional.of(budgetAmount.get()); + } + return this; + } + + /** + *

This ad group's budget, in the ad account's currency. null when the budget is set on the campaign instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage budgetAmount(Double budgetAmount) { + this.budgetAmount = Optional.ofNullable(budgetAmount); + return this; + } + + /** + *

This ad group's budget, in the ad account's currency. null when the budget is set on the campaign instead.

+ */ + @java.lang.Override + @JsonSetter(value = "budget_amount", nulls = Nulls.SKIP) + public _FinalStage budgetAmount(Optional budgetAmount) { + this.budgetAmount = budgetAmount; + return this; + } + + /** + *

How delivery bids are set in the ad auction. Target-based strategies use desired_cost_per_result.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bidType(Nullable bidType) { + if (bidType.isNull()) { + this.bidType = null; + } else if (bidType.isEmpty()) { + this.bidType = Optional.empty(); + } else { + this.bidType = Optional.of(bidType.get()); + } + return this; + } + + /** + *

How delivery bids are set in the ad auction. Target-based strategies use desired_cost_per_result.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bidType(AdGroupBidType bidType) { + this.bidType = Optional.ofNullable(bidType); + return this; + } + + /** + *

How delivery bids are set in the ad auction. Target-based strategies use desired_cost_per_result.

+ */ + @java.lang.Override + @JsonSetter(value = "bid_type", nulls = Nulls.SKIP) + public _FinalStage bidType(Optional bidType) { + this.bidType = bidType; + return this; + } + + @java.lang.Override + public AdGroup build() { + return new AdGroup( + adCampaign, + addedToCartValue, + addedToCarts, + audiences, + bidType, + budgetAmount, + budgetType, + clickThroughRate, + clicks, + completedRegistrationValue, + completedRegistrations, + contactValue, + contacts, + conversionEvent, + conversionLocation, + costPerAddedToCart, + costPerClick, + costPerCompletedRegistration, + costPerContact, + costPerLead, + costPerMille, + costPerPurchase, + costPerResult, + costPerSchedule, + costPerSubmittedApplication, + costPerUniqueClick, + costPerViewedContent, + createdAt, + customConversions, + customEventCounts, + customEventValues, + deliveryStatus, + demographics, + desiredCostPerResult, + detailedTargeting, + devices, + dynamicCreative, + endsAt, + frequency, + frequencyCap, + id, + impressions, + issues, + languages, + leadValue, + leads, + messageApps, + minimumDailySpend, + optimizationGoal, + placements, + purchaseValue, + purchases, + reach, + regions, + resultEvent, + resultEventName, + results, + returnOnAdSpend, + scheduleValue, + schedules, + spend, + spendCurrency, + startsAt, + status, + submittedApplicationValue, + submittedApplications, + title, + uniqueClickThroughRate, + uniqueClicks, + updatedAt, + viewedContentValue, + viewedContents, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupAudiences.java b/src/main/java/com/whop/api/types/AdGroupAudiences.java new file mode 100644 index 00000000..1fc9dafc --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupAudiences.java @@ -0,0 +1,148 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupAudiences.Builder.class) +public final class AdGroupAudiences { + private final List exclude; + + private final List include; + + private final Map additionalProperties; + + private AdGroupAudiences(List exclude, List include, Map additionalProperties) { + this.exclude = exclude; + this.include = include; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("exclude") + public List getExclude() { + return exclude; + } + + @JsonProperty("include") + public List getInclude() { + return include; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupAudiences && equalTo((AdGroupAudiences) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupAudiences other) { + return exclude.equals(other.exclude) && include.equals(other.include); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.exclude, this.include); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List exclude = new ArrayList<>(); + + private List include = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdGroupAudiences other) { + exclude(other.getExclude()); + include(other.getInclude()); + return this; + } + + @JsonSetter(value = "exclude", nulls = Nulls.SKIP) + public Builder exclude(List exclude) { + this.exclude.clear(); + if (exclude != null) { + this.exclude.addAll(exclude); + } + return this; + } + + public Builder addExclude(String exclude) { + this.exclude.add(exclude); + return this; + } + + public Builder addAllExclude(List exclude) { + if (exclude != null) { + this.exclude.addAll(exclude); + } + return this; + } + + @JsonSetter(value = "include", nulls = Nulls.SKIP) + public Builder include(List include) { + this.include.clear(); + if (include != null) { + this.include.addAll(include); + } + return this; + } + + public Builder addInclude(String include) { + this.include.add(include); + return this; + } + + public Builder addAllInclude(List include) { + if (include != null) { + this.include.addAll(include); + } + return this; + } + + public AdGroupAudiences build() { + return new AdGroupAudiences(exclude, include, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupAudiencesBody.java b/src/main/java/com/whop/api/types/AdGroupAudiencesBody.java new file mode 100644 index 00000000..d3d0e9df --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupAudiencesBody.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupAudiencesBody.Builder.class) +public final class AdGroupAudiencesBody { + private final Optional> exclude; + + private final Optional> include; + + private final Map additionalProperties; + + private AdGroupAudiencesBody( + Optional> exclude, Optional> include, Map additionalProperties) { + this.exclude = exclude; + this.include = include; + this.additionalProperties = additionalProperties; + } + + /** + * @return IDs of saved audiences to exclude from delivery, prefixed adaud_. + */ + @JsonProperty("exclude") + public Optional> getExclude() { + return exclude; + } + + /** + * @return IDs of saved audiences to deliver to, prefixed adaud_. + */ + @JsonProperty("include") + public Optional> getInclude() { + return include; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupAudiencesBody && equalTo((AdGroupAudiencesBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupAudiencesBody other) { + return exclude.equals(other.exclude) && include.equals(other.include); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.exclude, this.include); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> exclude = Optional.empty(); + + private Optional> include = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdGroupAudiencesBody other) { + exclude(other.getExclude()); + include(other.getInclude()); + return this; + } + + /** + *

IDs of saved audiences to exclude from delivery, prefixed adaud_.

+ */ + @JsonSetter(value = "exclude", nulls = Nulls.SKIP) + public Builder exclude(Optional> exclude) { + this.exclude = exclude; + return this; + } + + public Builder exclude(List exclude) { + this.exclude = Optional.ofNullable(exclude); + return this; + } + + /** + *

IDs of saved audiences to deliver to, prefixed adaud_.

+ */ + @JsonSetter(value = "include", nulls = Nulls.SKIP) + public Builder include(Optional> include) { + this.include = include; + return this; + } + + public Builder include(List include) { + this.include = Optional.ofNullable(include); + return this; + } + + public AdGroupAudiencesBody build() { + return new AdGroupAudiencesBody(exclude, include, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupBehaviorCategory.java b/src/main/java/com/whop/api/types/AdGroupBehaviorCategory.java new file mode 100644 index 00000000..6df5f649 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupBehaviorCategory.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupBehaviorCategory.Builder.class) +public final class AdGroupBehaviorCategory { + private final Optional behaviorType; + + private final String id; + + private final Optional name; + + private final Optional period; + + private final Map additionalProperties; + + private AdGroupBehaviorCategory( + Optional behaviorType, + String id, + Optional name, + Optional period, + Map additionalProperties) { + this.behaviorType = behaviorType; + this.id = id; + this.name = name; + this.period = period; + this.additionalProperties = additionalProperties; + } + + /** + * @return On ad platforms that scope behavior categories, what this one is measured on. Send back the value the targeting_options endpoint returned alongside the id. Absent on platforms that don't scope them. + */ + @JsonProperty("behavior_type") + public Optional getBehaviorType() { + return behaviorType; + } + + /** + * @return The ad platform's ID for the category in its targeting taxonomy. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Category name, such as Frequent travelers. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return On ad platforms that scope behavior categories, how many days of activity the category covers. Absent on platforms that don't scope them. + */ + @JsonProperty("period") + public Optional getPeriod() { + return period; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupBehaviorCategory && equalTo((AdGroupBehaviorCategory) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupBehaviorCategory other) { + return behaviorType.equals(other.behaviorType) + && id.equals(other.id) + && name.equals(other.name) + && period.equals(other.period); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.behaviorType, this.id, this.name, this.period); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ad platform's ID for the category in its targeting taxonomy.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(AdGroupBehaviorCategory other); + } + + public interface _FinalStage { + AdGroupBehaviorCategory build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

On ad platforms that scope behavior categories, what this one is measured on. Send back the value the targeting_options endpoint returned alongside the id. Absent on platforms that don't scope them.

+ */ + _FinalStage behaviorType(Optional behaviorType); + + _FinalStage behaviorType(AdGroupBehaviorCategoryBehaviorType behaviorType); + + /** + *

Category name, such as Frequent travelers.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + /** + *

On ad platforms that scope behavior categories, how many days of activity the category covers. Absent on platforms that don't scope them.

+ */ + _FinalStage period(Optional period); + + _FinalStage period(Double period); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional period = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional behaviorType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupBehaviorCategory other) { + behaviorType(other.getBehaviorType()); + id(other.getId()); + name(other.getName()); + period(other.getPeriod()); + return this; + } + + /** + *

The ad platform's ID for the category in its targeting taxonomy.

+ *

The ad platform's ID for the category in its targeting taxonomy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

On ad platforms that scope behavior categories, how many days of activity the category covers. Absent on platforms that don't scope them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage period(Double period) { + this.period = Optional.ofNullable(period); + return this; + } + + /** + *

On ad platforms that scope behavior categories, how many days of activity the category covers. Absent on platforms that don't scope them.

+ */ + @java.lang.Override + @JsonSetter(value = "period", nulls = Nulls.SKIP) + public _FinalStage period(Optional period) { + this.period = period; + return this; + } + + /** + *

Category name, such as Frequent travelers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Category name, such as Frequent travelers.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

On ad platforms that scope behavior categories, what this one is measured on. Send back the value the targeting_options endpoint returned alongside the id. Absent on platforms that don't scope them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage behaviorType(AdGroupBehaviorCategoryBehaviorType behaviorType) { + this.behaviorType = Optional.ofNullable(behaviorType); + return this; + } + + /** + *

On ad platforms that scope behavior categories, what this one is measured on. Send back the value the targeting_options endpoint returned alongside the id. Absent on platforms that don't scope them.

+ */ + @java.lang.Override + @JsonSetter(value = "behavior_type", nulls = Nulls.SKIP) + public _FinalStage behaviorType(Optional behaviorType) { + this.behaviorType = behaviorType; + return this; + } + + @java.lang.Override + public AdGroupBehaviorCategory build() { + return new AdGroupBehaviorCategory(behaviorType, id, name, period, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupBehaviorCategoryBehaviorType.java b/src/main/java/com/whop/api/types/AdGroupBehaviorCategoryBehaviorType.java new file mode 100644 index 00000000..638fd188 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupBehaviorCategoryBehaviorType.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupBehaviorCategoryBehaviorType { + public static final AdGroupBehaviorCategoryBehaviorType HASHTAG = + new AdGroupBehaviorCategoryBehaviorType(Value.HASHTAG, "hashtag"); + + public static final AdGroupBehaviorCategoryBehaviorType CREATOR = + new AdGroupBehaviorCategoryBehaviorType(Value.CREATOR, "creator"); + + public static final AdGroupBehaviorCategoryBehaviorType VIDEO = + new AdGroupBehaviorCategoryBehaviorType(Value.VIDEO, "video"); + + private final Value value; + + private final String string; + + AdGroupBehaviorCategoryBehaviorType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupBehaviorCategoryBehaviorType + && this.string.equals(((AdGroupBehaviorCategoryBehaviorType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HASHTAG: + return visitor.visitHashtag(); + case CREATOR: + return visitor.visitCreator(); + case VIDEO: + return visitor.visitVideo(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupBehaviorCategoryBehaviorType valueOf(String value) { + switch (value) { + case "hashtag": + return HASHTAG; + case "creator": + return CREATOR; + case "video": + return VIDEO; + default: + return new AdGroupBehaviorCategoryBehaviorType(Value.UNKNOWN, value); + } + } + + public enum Value { + VIDEO, + + CREATOR, + + HASHTAG, + + UNKNOWN + } + + public interface Visitor { + T visitVideo(); + + T visitCreator(); + + T visitHashtag(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupBidType.java b/src/main/java/com/whop/api/types/AdGroupBidType.java new file mode 100644 index 00000000..b45c90f1 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupBidType.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupBidType { + public static final AdGroupBidType AVERAGE_TARGET = new AdGroupBidType(Value.AVERAGE_TARGET, "average_target"); + + public static final AdGroupBidType MAXIMUM_TARGET = new AdGroupBidType(Value.MAXIMUM_TARGET, "maximum_target"); + + public static final AdGroupBidType MINIMUM_COST = new AdGroupBidType(Value.MINIMUM_COST, "minimum_cost"); + + private final Value value; + + private final String string; + + AdGroupBidType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupBidType && this.string.equals(((AdGroupBidType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AVERAGE_TARGET: + return visitor.visitAverageTarget(); + case MAXIMUM_TARGET: + return visitor.visitMaximumTarget(); + case MINIMUM_COST: + return visitor.visitMinimumCost(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupBidType valueOf(String value) { + switch (value) { + case "average_target": + return AVERAGE_TARGET; + case "maximum_target": + return MAXIMUM_TARGET; + case "minimum_cost": + return MINIMUM_COST; + default: + return new AdGroupBidType(Value.UNKNOWN, value); + } + } + + public enum Value { + MINIMUM_COST, + + AVERAGE_TARGET, + + MAXIMUM_TARGET, + + UNKNOWN + } + + public interface Visitor { + T visitMinimumCost(); + + T visitAverageTarget(); + + T visitMaximumTarget(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupBudgetType.java b/src/main/java/com/whop/api/types/AdGroupBudgetType.java new file mode 100644 index 00000000..81fda9fa --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupBudgetType.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupBudgetType { + public static final AdGroupBudgetType DAILY = new AdGroupBudgetType(Value.DAILY, "daily"); + + public static final AdGroupBudgetType LIFETIME = new AdGroupBudgetType(Value.LIFETIME, "lifetime"); + + private final Value value; + + private final String string; + + AdGroupBudgetType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupBudgetType && this.string.equals(((AdGroupBudgetType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DAILY: + return visitor.visitDaily(); + case LIFETIME: + return visitor.visitLifetime(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupBudgetType valueOf(String value) { + switch (value) { + case "daily": + return DAILY; + case "lifetime": + return LIFETIME; + default: + return new AdGroupBudgetType(Value.UNKNOWN, value); + } + } + + public enum Value { + DAILY, + + LIFETIME, + + UNKNOWN + } + + public interface Visitor { + T visitDaily(); + + T visitLifetime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupCity.java b/src/main/java/com/whop/api/types/AdGroupCity.java new file mode 100644 index 00000000..9119725d --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupCity.java @@ -0,0 +1,172 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupCity.Builder.class) +public final class AdGroupCity { + private final String key; + + private final Optional name; + + private final Map additionalProperties; + + private AdGroupCity(String key, Optional name, Map additionalProperties) { + this.key = key; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ad platform's key for the city in its location taxonomy. + */ + @JsonProperty("key") + public String getKey() { + return key; + } + + /** + * @return City name, such as Austin. Absent when the platform doesn't return one. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupCity && equalTo((AdGroupCity) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupCity other) { + return key.equals(other.key) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.key, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KeyStage builder() { + return new Builder(); + } + + public interface KeyStage { + /** + *

The ad platform's key for the city in its location taxonomy.

+ */ + _FinalStage key(@NotNull String key); + + Builder from(AdGroupCity other); + } + + public interface _FinalStage { + AdGroupCity build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

City name, such as Austin. Absent when the platform doesn't return one.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KeyStage, _FinalStage { + private String key; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupCity other) { + key(other.getKey()); + name(other.getName()); + return this; + } + + /** + *

The ad platform's key for the city in its location taxonomy.

+ *

The ad platform's key for the city in its location taxonomy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("key") + public _FinalStage key(@NotNull String key) { + this.key = Objects.requireNonNull(key, "key must not be null"); + return this; + } + + /** + *

City name, such as Austin. Absent when the platform doesn't return one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

City name, such as Austin. Absent when the platform doesn't return one.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public AdGroupCity build() { + return new AdGroupCity(key, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupConversionLocation.java b/src/main/java/com/whop/api/types/AdGroupConversionLocation.java new file mode 100644 index 00000000..7bbe0ee6 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupConversionLocation.java @@ -0,0 +1,160 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupConversionLocation { + public static final AdGroupConversionLocation WEBSITE = new AdGroupConversionLocation(Value.WEBSITE, "website"); + + public static final AdGroupConversionLocation MESSAGING = + new AdGroupConversionLocation(Value.MESSAGING, "messaging"); + + public static final AdGroupConversionLocation INSTANT_FORMS_AND_MESSENGER = + new AdGroupConversionLocation(Value.INSTANT_FORMS_AND_MESSENGER, "instant_forms_and_messenger"); + + public static final AdGroupConversionLocation WEBSITE_AND_INSTANT_FORMS = + new AdGroupConversionLocation(Value.WEBSITE_AND_INSTANT_FORMS, "website_and_instant_forms"); + + public static final AdGroupConversionLocation PROFILE = new AdGroupConversionLocation(Value.PROFILE, "profile"); + + public static final AdGroupConversionLocation INSTANT_FORMS = + new AdGroupConversionLocation(Value.INSTANT_FORMS, "instant_forms"); + + public static final AdGroupConversionLocation INSTAGRAM_AND_FACEBOOK = + new AdGroupConversionLocation(Value.INSTAGRAM_AND_FACEBOOK, "instagram_and_facebook"); + + public static final AdGroupConversionLocation ON_AD = new AdGroupConversionLocation(Value.ON_AD, "on_ad"); + + public static final AdGroupConversionLocation INSTAGRAM_PROFILE = + new AdGroupConversionLocation(Value.INSTAGRAM_PROFILE, "instagram_profile"); + + private final Value value; + + private final String string; + + AdGroupConversionLocation(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupConversionLocation + && this.string.equals(((AdGroupConversionLocation) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WEBSITE: + return visitor.visitWebsite(); + case MESSAGING: + return visitor.visitMessaging(); + case INSTANT_FORMS_AND_MESSENGER: + return visitor.visitInstantFormsAndMessenger(); + case WEBSITE_AND_INSTANT_FORMS: + return visitor.visitWebsiteAndInstantForms(); + case PROFILE: + return visitor.visitProfile(); + case INSTANT_FORMS: + return visitor.visitInstantForms(); + case INSTAGRAM_AND_FACEBOOK: + return visitor.visitInstagramAndFacebook(); + case ON_AD: + return visitor.visitOnAd(); + case INSTAGRAM_PROFILE: + return visitor.visitInstagramProfile(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupConversionLocation valueOf(String value) { + switch (value) { + case "website": + return WEBSITE; + case "messaging": + return MESSAGING; + case "instant_forms_and_messenger": + return INSTANT_FORMS_AND_MESSENGER; + case "website_and_instant_forms": + return WEBSITE_AND_INSTANT_FORMS; + case "profile": + return PROFILE; + case "instant_forms": + return INSTANT_FORMS; + case "instagram_and_facebook": + return INSTAGRAM_AND_FACEBOOK; + case "on_ad": + return ON_AD; + case "instagram_profile": + return INSTAGRAM_PROFILE; + default: + return new AdGroupConversionLocation(Value.UNKNOWN, value); + } + } + + public enum Value { + WEBSITE, + + PROFILE, + + INSTAGRAM_AND_FACEBOOK, + + INSTAGRAM_PROFILE, + + MESSAGING, + + ON_AD, + + INSTANT_FORMS, + + INSTANT_FORMS_AND_MESSENGER, + + WEBSITE_AND_INSTANT_FORMS, + + UNKNOWN + } + + public interface Visitor { + T visitWebsite(); + + T visitProfile(); + + T visitInstagramAndFacebook(); + + T visitInstagramProfile(); + + T visitMessaging(); + + T visitOnAd(); + + T visitInstantForms(); + + T visitInstantFormsAndMessenger(); + + T visitWebsiteAndInstantForms(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupCustomLocation.java b/src/main/java/com/whop/api/types/AdGroupCustomLocation.java new file mode 100644 index 00000000..15a658e1 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupCustomLocation.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupCustomLocation.Builder.class) +public final class AdGroupCustomLocation { + private final AdGroupCustomLocationDistanceUnit distanceUnit; + + private final double latitude; + + private final double longitude; + + private final Optional name; + + private final double radius; + + private final Map additionalProperties; + + private AdGroupCustomLocation( + AdGroupCustomLocationDistanceUnit distanceUnit, + double latitude, + double longitude, + Optional name, + double radius, + Map additionalProperties) { + this.distanceUnit = distanceUnit; + this.latitude = latitude; + this.longitude = longitude; + this.name = name; + this.radius = radius; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unit for radius. + */ + @JsonProperty("distance_unit") + public AdGroupCustomLocationDistanceUnit getDistanceUnit() { + return distanceUnit; + } + + /** + * @return Latitude of the center point. + */ + @JsonProperty("latitude") + public double getLatitude() { + return latitude; + } + + /** + * @return Longitude of the center point. + */ + @JsonProperty("longitude") + public double getLongitude() { + return longitude; + } + + /** + * @return Label for the location, such as a city or address. Absent when the location has no label. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Radius around the center point, in distance_unit. + */ + @JsonProperty("radius") + public double getRadius() { + return radius; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupCustomLocation && equalTo((AdGroupCustomLocation) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupCustomLocation other) { + return distanceUnit.equals(other.distanceUnit) + && latitude == other.latitude + && longitude == other.longitude + && name.equals(other.name) + && radius == other.radius; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.distanceUnit, this.latitude, this.longitude, this.name, this.radius); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DistanceUnitStage builder() { + return new Builder(); + } + + public interface DistanceUnitStage { + /** + *

Unit for radius.

+ */ + LatitudeStage distanceUnit(@NotNull AdGroupCustomLocationDistanceUnit distanceUnit); + + Builder from(AdGroupCustomLocation other); + } + + public interface LatitudeStage { + /** + *

Latitude of the center point.

+ */ + LongitudeStage latitude(double latitude); + } + + public interface LongitudeStage { + /** + *

Longitude of the center point.

+ */ + RadiusStage longitude(double longitude); + } + + public interface RadiusStage { + /** + *

Radius around the center point, in distance_unit.

+ */ + _FinalStage radius(double radius); + } + + public interface _FinalStage { + AdGroupCustomLocation build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Label for the location, such as a city or address. Absent when the location has no label.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements DistanceUnitStage, LatitudeStage, LongitudeStage, RadiusStage, _FinalStage { + private AdGroupCustomLocationDistanceUnit distanceUnit; + + private double latitude; + + private double longitude; + + private double radius; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupCustomLocation other) { + distanceUnit(other.getDistanceUnit()); + latitude(other.getLatitude()); + longitude(other.getLongitude()); + name(other.getName()); + radius(other.getRadius()); + return this; + } + + /** + *

Unit for radius.

+ *

Unit for radius.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("distance_unit") + public LatitudeStage distanceUnit(@NotNull AdGroupCustomLocationDistanceUnit distanceUnit) { + this.distanceUnit = Objects.requireNonNull(distanceUnit, "distanceUnit must not be null"); + return this; + } + + /** + *

Latitude of the center point.

+ *

Latitude of the center point.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("latitude") + public LongitudeStage latitude(double latitude) { + this.latitude = latitude; + return this; + } + + /** + *

Longitude of the center point.

+ *

Longitude of the center point.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("longitude") + public RadiusStage longitude(double longitude) { + this.longitude = longitude; + return this; + } + + /** + *

Radius around the center point, in distance_unit.

+ *

Radius around the center point, in distance_unit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("radius") + public _FinalStage radius(double radius) { + this.radius = radius; + return this; + } + + /** + *

Label for the location, such as a city or address. Absent when the location has no label.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Label for the location, such as a city or address. Absent when the location has no label.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public AdGroupCustomLocation build() { + return new AdGroupCustomLocation(distanceUnit, latitude, longitude, name, radius, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupCustomLocationDistanceUnit.java b/src/main/java/com/whop/api/types/AdGroupCustomLocationDistanceUnit.java new file mode 100644 index 00000000..d057ac56 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupCustomLocationDistanceUnit.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupCustomLocationDistanceUnit { + public static final AdGroupCustomLocationDistanceUnit MILE = + new AdGroupCustomLocationDistanceUnit(Value.MILE, "mile"); + + public static final AdGroupCustomLocationDistanceUnit KILOMETER = + new AdGroupCustomLocationDistanceUnit(Value.KILOMETER, "kilometer"); + + private final Value value; + + private final String string; + + AdGroupCustomLocationDistanceUnit(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupCustomLocationDistanceUnit + && this.string.equals(((AdGroupCustomLocationDistanceUnit) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MILE: + return visitor.visitMile(); + case KILOMETER: + return visitor.visitKilometer(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupCustomLocationDistanceUnit valueOf(String value) { + switch (value) { + case "mile": + return MILE; + case "kilometer": + return KILOMETER; + default: + return new AdGroupCustomLocationDistanceUnit(Value.UNKNOWN, value); + } + } + + public enum Value { + MILE, + + KILOMETER, + + UNKNOWN + } + + public interface Visitor { + T visitMile(); + + T visitKilometer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDeliveryStatus.java b/src/main/java/com/whop/api/types/AdGroupDeliveryStatus.java new file mode 100644 index 00000000..83b72991 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDeliveryStatus.java @@ -0,0 +1,207 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupDeliveryStatus { + public static final AdGroupDeliveryStatus PROCESSING = new AdGroupDeliveryStatus(Value.PROCESSING, "processing"); + + public static final AdGroupDeliveryStatus COMPLETED = new AdGroupDeliveryStatus(Value.COMPLETED, "completed"); + + public static final AdGroupDeliveryStatus ADS_OFF = new AdGroupDeliveryStatus(Value.ADS_OFF, "ads_off"); + + public static final AdGroupDeliveryStatus ALL_ADS_REJECTED = + new AdGroupDeliveryStatus(Value.ALL_ADS_REJECTED, "all_ads_rejected"); + + public static final AdGroupDeliveryStatus SCHEDULED = new AdGroupDeliveryStatus(Value.SCHEDULED, "scheduled"); + + public static final AdGroupDeliveryStatus DRAFT = new AdGroupDeliveryStatus(Value.DRAFT, "draft"); + + public static final AdGroupDeliveryStatus LEARNING = new AdGroupDeliveryStatus(Value.LEARNING, "learning"); + + public static final AdGroupDeliveryStatus NO_ADS = new AdGroupDeliveryStatus(Value.NO_ADS, "no_ads"); + + public static final AdGroupDeliveryStatus CAMPAIGN_PAUSED = + new AdGroupDeliveryStatus(Value.CAMPAIGN_PAUSED, "campaign_paused"); + + public static final AdGroupDeliveryStatus PAUSED = new AdGroupDeliveryStatus(Value.PAUSED, "paused"); + + public static final AdGroupDeliveryStatus ISSUES = new AdGroupDeliveryStatus(Value.ISSUES, "issues"); + + public static final AdGroupDeliveryStatus REJECTED = new AdGroupDeliveryStatus(Value.REJECTED, "rejected"); + + public static final AdGroupDeliveryStatus LEARNING_LIMITED = + new AdGroupDeliveryStatus(Value.LEARNING_LIMITED, "learning_limited"); + + public static final AdGroupDeliveryStatus ACTIVE = new AdGroupDeliveryStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AdGroupDeliveryStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupDeliveryStatus + && this.string.equals(((AdGroupDeliveryStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PROCESSING: + return visitor.visitProcessing(); + case COMPLETED: + return visitor.visitCompleted(); + case ADS_OFF: + return visitor.visitAdsOff(); + case ALL_ADS_REJECTED: + return visitor.visitAllAdsRejected(); + case SCHEDULED: + return visitor.visitScheduled(); + case DRAFT: + return visitor.visitDraft(); + case LEARNING: + return visitor.visitLearning(); + case NO_ADS: + return visitor.visitNoAds(); + case CAMPAIGN_PAUSED: + return visitor.visitCampaignPaused(); + case PAUSED: + return visitor.visitPaused(); + case ISSUES: + return visitor.visitIssues(); + case REJECTED: + return visitor.visitRejected(); + case LEARNING_LIMITED: + return visitor.visitLearningLimited(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupDeliveryStatus valueOf(String value) { + switch (value) { + case "processing": + return PROCESSING; + case "completed": + return COMPLETED; + case "ads_off": + return ADS_OFF; + case "all_ads_rejected": + return ALL_ADS_REJECTED; + case "scheduled": + return SCHEDULED; + case "draft": + return DRAFT; + case "learning": + return LEARNING; + case "no_ads": + return NO_ADS; + case "campaign_paused": + return CAMPAIGN_PAUSED; + case "paused": + return PAUSED; + case "issues": + return ISSUES; + case "rejected": + return REJECTED; + case "learning_limited": + return LEARNING_LIMITED; + case "active": + return ACTIVE; + default: + return new AdGroupDeliveryStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL_ADS_REJECTED, + + REJECTED, + + DRAFT, + + NO_ADS, + + CAMPAIGN_PAUSED, + + PAUSED, + + PROCESSING, + + ISSUES, + + SCHEDULED, + + COMPLETED, + + ADS_OFF, + + LEARNING_LIMITED, + + LEARNING, + + ACTIVE, + + UNKNOWN + } + + public interface Visitor { + T visitAllAdsRejected(); + + T visitRejected(); + + T visitDraft(); + + T visitNoAds(); + + T visitCampaignPaused(); + + T visitPaused(); + + T visitProcessing(); + + T visitIssues(); + + T visitScheduled(); + + T visitCompleted(); + + T visitAdsOff(); + + T visitLearningLimited(); + + T visitLearning(); + + T visitActive(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDemographicCategory.java b/src/main/java/com/whop/api/types/AdGroupDemographicCategory.java new file mode 100644 index 00000000..4a186885 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDemographicCategory.java @@ -0,0 +1,209 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupDemographicCategory.Builder.class) +public final class AdGroupDemographicCategory { + private final String id; + + private final Optional name; + + private final AdGroupDemographicCategoryType type; + + private final Map additionalProperties; + + private AdGroupDemographicCategory( + String id, + Optional name, + AdGroupDemographicCategoryType type, + Map additionalProperties) { + this.id = id; + this.name = name; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ad platform's ID for the category in its targeting taxonomy. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Category name, such as Recently moved. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Kind of demographic the category belongs to. + */ + @JsonProperty("type") + public AdGroupDemographicCategoryType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupDemographicCategory && equalTo((AdGroupDemographicCategory) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupDemographicCategory other) { + return id.equals(other.id) && name.equals(other.name) && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ad platform's ID for the category in its targeting taxonomy.

+ */ + TypeStage id(@NotNull String id); + + Builder from(AdGroupDemographicCategory other); + } + + public interface TypeStage { + /** + *

Kind of demographic the category belongs to.

+ */ + _FinalStage type(@NotNull AdGroupDemographicCategoryType type); + } + + public interface _FinalStage { + AdGroupDemographicCategory build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Category name, such as Recently moved.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TypeStage, _FinalStage { + private String id; + + private AdGroupDemographicCategoryType type; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupDemographicCategory other) { + id(other.getId()); + name(other.getName()); + type(other.getType()); + return this; + } + + /** + *

The ad platform's ID for the category in its targeting taxonomy.

+ *

The ad platform's ID for the category in its targeting taxonomy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Kind of demographic the category belongs to.

+ *

Kind of demographic the category belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull AdGroupDemographicCategoryType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

Category name, such as Recently moved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Category name, such as Recently moved.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public AdGroupDemographicCategory build() { + return new AdGroupDemographicCategory(id, name, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDemographicCategoryType.java b/src/main/java/com/whop/api/types/AdGroupDemographicCategoryType.java new file mode 100644 index 00000000..513225b9 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDemographicCategoryType.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupDemographicCategoryType { + public static final AdGroupDemographicCategoryType WORK_POSITIONS = + new AdGroupDemographicCategoryType(Value.WORK_POSITIONS, "work_positions"); + + public static final AdGroupDemographicCategoryType FAMILY_STATUSES = + new AdGroupDemographicCategoryType(Value.FAMILY_STATUSES, "family_statuses"); + + public static final AdGroupDemographicCategoryType INDUSTRIES = + new AdGroupDemographicCategoryType(Value.INDUSTRIES, "industries"); + + public static final AdGroupDemographicCategoryType EDUCATION_MAJORS = + new AdGroupDemographicCategoryType(Value.EDUCATION_MAJORS, "education_majors"); + + public static final AdGroupDemographicCategoryType INCOME = + new AdGroupDemographicCategoryType(Value.INCOME, "income"); + + public static final AdGroupDemographicCategoryType LIFE_EVENTS = + new AdGroupDemographicCategoryType(Value.LIFE_EVENTS, "life_events"); + + public static final AdGroupDemographicCategoryType EDUCATION_SCHOOLS = + new AdGroupDemographicCategoryType(Value.EDUCATION_SCHOOLS, "education_schools"); + + public static final AdGroupDemographicCategoryType WORK_EMPLOYERS = + new AdGroupDemographicCategoryType(Value.WORK_EMPLOYERS, "work_employers"); + + private final Value value; + + private final String string; + + AdGroupDemographicCategoryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupDemographicCategoryType + && this.string.equals(((AdGroupDemographicCategoryType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WORK_POSITIONS: + return visitor.visitWorkPositions(); + case FAMILY_STATUSES: + return visitor.visitFamilyStatuses(); + case INDUSTRIES: + return visitor.visitIndustries(); + case EDUCATION_MAJORS: + return visitor.visitEducationMajors(); + case INCOME: + return visitor.visitIncome(); + case LIFE_EVENTS: + return visitor.visitLifeEvents(); + case EDUCATION_SCHOOLS: + return visitor.visitEducationSchools(); + case WORK_EMPLOYERS: + return visitor.visitWorkEmployers(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupDemographicCategoryType valueOf(String value) { + switch (value) { + case "work_positions": + return WORK_POSITIONS; + case "family_statuses": + return FAMILY_STATUSES; + case "industries": + return INDUSTRIES; + case "education_majors": + return EDUCATION_MAJORS; + case "income": + return INCOME; + case "life_events": + return LIFE_EVENTS; + case "education_schools": + return EDUCATION_SCHOOLS; + case "work_employers": + return WORK_EMPLOYERS; + default: + return new AdGroupDemographicCategoryType(Value.UNKNOWN, value); + } + } + + public enum Value { + LIFE_EVENTS, + + INDUSTRIES, + + INCOME, + + FAMILY_STATUSES, + + WORK_EMPLOYERS, + + WORK_POSITIONS, + + EDUCATION_SCHOOLS, + + EDUCATION_MAJORS, + + UNKNOWN + } + + public interface Visitor { + T visitLifeEvents(); + + T visitIndustries(); + + T visitIncome(); + + T visitFamilyStatuses(); + + T visitWorkEmployers(); + + T visitWorkPositions(); + + T visitEducationSchools(); + + T visitEducationMajors(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDemographics.java b/src/main/java/com/whop/api/types/AdGroupDemographics.java new file mode 100644 index 00000000..2f78a990 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDemographics.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupDemographics.Builder.class) +public final class AdGroupDemographics { + private final boolean automatic; + + private final AdGroupDemographicsGender gender; + + private final Optional maximumAge; + + private final Optional minimumAge; + + private final Map additionalProperties; + + private AdGroupDemographics( + boolean automatic, + AdGroupDemographicsGender gender, + Optional maximumAge, + Optional minimumAge, + Map additionalProperties) { + this.automatic = automatic; + this.gender = gender; + this.maximumAge = maximumAge; + this.minimumAge = minimumAge; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether automatic audience targeting is on (Advantage+ on Meta). When true, the platform can deliver beyond the ages, genders, and detailed targeting you set, treating them as suggestions. + */ + @JsonProperty("automatic") + public boolean getAutomatic() { + return automatic; + } + + /** + * @return Gender targeted. + */ + @JsonProperty("gender") + public AdGroupDemographicsGender getGender() { + return gender; + } + + /** + * @return Oldest age targeted. null when no maximum is set. + */ + @JsonIgnore + public Optional getMaximumAge() { + if (maximumAge == null) { + return Optional.empty(); + } + return maximumAge; + } + + /** + * @return Youngest age targeted. null when no minimum is set. + */ + @JsonIgnore + public Optional getMinimumAge() { + if (minimumAge == null) { + return Optional.empty(); + } + return minimumAge; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("maximum_age") + private Optional _getMaximumAge() { + return maximumAge; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("minimum_age") + private Optional _getMinimumAge() { + return minimumAge; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupDemographics && equalTo((AdGroupDemographics) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupDemographics other) { + return automatic == other.automatic + && gender.equals(other.gender) + && maximumAge.equals(other.maximumAge) + && minimumAge.equals(other.minimumAge); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.automatic, this.gender, this.maximumAge, this.minimumAge); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AutomaticStage builder() { + return new Builder(); + } + + public interface AutomaticStage { + /** + *

Whether automatic audience targeting is on (Advantage+ on Meta). When true, the platform can deliver beyond the ages, genders, and detailed targeting you set, treating them as suggestions.

+ */ + GenderStage automatic(boolean automatic); + + Builder from(AdGroupDemographics other); + } + + public interface GenderStage { + /** + *

Gender targeted.

+ */ + _FinalStage gender(@NotNull AdGroupDemographicsGender gender); + } + + public interface _FinalStage { + AdGroupDemographics build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Oldest age targeted. null when no maximum is set.

+ */ + _FinalStage maximumAge(Optional maximumAge); + + _FinalStage maximumAge(Double maximumAge); + + _FinalStage maximumAge(Nullable maximumAge); + + /** + *

Youngest age targeted. null when no minimum is set.

+ */ + _FinalStage minimumAge(Optional minimumAge); + + _FinalStage minimumAge(Double minimumAge); + + _FinalStage minimumAge(Nullable minimumAge); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AutomaticStage, GenderStage, _FinalStage { + private boolean automatic; + + private AdGroupDemographicsGender gender; + + private Optional minimumAge = Optional.empty(); + + private Optional maximumAge = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupDemographics other) { + automatic(other.getAutomatic()); + gender(other.getGender()); + maximumAge(other.getMaximumAge()); + minimumAge(other.getMinimumAge()); + return this; + } + + /** + *

Whether automatic audience targeting is on (Advantage+ on Meta). When true, the platform can deliver beyond the ages, genders, and detailed targeting you set, treating them as suggestions.

+ *

Whether automatic audience targeting is on (Advantage+ on Meta). When true, the platform can deliver beyond the ages, genders, and detailed targeting you set, treating them as suggestions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("automatic") + public GenderStage automatic(boolean automatic) { + this.automatic = automatic; + return this; + } + + /** + *

Gender targeted.

+ *

Gender targeted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("gender") + public _FinalStage gender(@NotNull AdGroupDemographicsGender gender) { + this.gender = Objects.requireNonNull(gender, "gender must not be null"); + return this; + } + + /** + *

Youngest age targeted. null when no minimum is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage minimumAge(Nullable minimumAge) { + if (minimumAge.isNull()) { + this.minimumAge = null; + } else if (minimumAge.isEmpty()) { + this.minimumAge = Optional.empty(); + } else { + this.minimumAge = Optional.of(minimumAge.get()); + } + return this; + } + + /** + *

Youngest age targeted. null when no minimum is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage minimumAge(Double minimumAge) { + this.minimumAge = Optional.ofNullable(minimumAge); + return this; + } + + /** + *

Youngest age targeted. null when no minimum is set.

+ */ + @java.lang.Override + @JsonSetter(value = "minimum_age", nulls = Nulls.SKIP) + public _FinalStage minimumAge(Optional minimumAge) { + this.minimumAge = minimumAge; + return this; + } + + /** + *

Oldest age targeted. null when no maximum is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maximumAge(Nullable maximumAge) { + if (maximumAge.isNull()) { + this.maximumAge = null; + } else if (maximumAge.isEmpty()) { + this.maximumAge = Optional.empty(); + } else { + this.maximumAge = Optional.of(maximumAge.get()); + } + return this; + } + + /** + *

Oldest age targeted. null when no maximum is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maximumAge(Double maximumAge) { + this.maximumAge = Optional.ofNullable(maximumAge); + return this; + } + + /** + *

Oldest age targeted. null when no maximum is set.

+ */ + @java.lang.Override + @JsonSetter(value = "maximum_age", nulls = Nulls.SKIP) + public _FinalStage maximumAge(Optional maximumAge) { + this.maximumAge = maximumAge; + return this; + } + + @java.lang.Override + public AdGroupDemographics build() { + return new AdGroupDemographics(automatic, gender, maximumAge, minimumAge, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDemographicsBody.java b/src/main/java/com/whop/api/types/AdGroupDemographicsBody.java new file mode 100644 index 00000000..19f45b49 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDemographicsBody.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupDemographicsBody.Builder.class) +public final class AdGroupDemographicsBody { + private final Optional automatic; + + private final Optional gender; + + private final Optional maximumAge; + + private final Optional minimumAge; + + private final Map additionalProperties; + + private AdGroupDemographicsBody( + Optional automatic, + Optional gender, + Optional maximumAge, + Optional minimumAge, + Map additionalProperties) { + this.automatic = automatic; + this.gender = gender; + this.maximumAge = maximumAge; + this.minimumAge = minimumAge; + this.additionalProperties = additionalProperties; + } + + /** + * @return Turn on automatic audience targeting (Advantage+ on Meta): the platform can deliver beyond the ages, genders, and detailed targeting you set, treating them as suggestions. + */ + @JsonProperty("automatic") + public Optional getAutomatic() { + return automatic; + } + + /** + * @return Gender to target. + */ + @JsonProperty("gender") + public Optional getGender() { + return gender; + } + + /** + * @return Oldest age to target. + */ + @JsonProperty("maximum_age") + public Optional getMaximumAge() { + return maximumAge; + } + + /** + * @return Youngest age to target. + */ + @JsonProperty("minimum_age") + public Optional getMinimumAge() { + return minimumAge; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupDemographicsBody && equalTo((AdGroupDemographicsBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupDemographicsBody other) { + return automatic.equals(other.automatic) + && gender.equals(other.gender) + && maximumAge.equals(other.maximumAge) + && minimumAge.equals(other.minimumAge); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.automatic, this.gender, this.maximumAge, this.minimumAge); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional automatic = Optional.empty(); + + private Optional gender = Optional.empty(); + + private Optional maximumAge = Optional.empty(); + + private Optional minimumAge = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdGroupDemographicsBody other) { + automatic(other.getAutomatic()); + gender(other.getGender()); + maximumAge(other.getMaximumAge()); + minimumAge(other.getMinimumAge()); + return this; + } + + /** + *

Turn on automatic audience targeting (Advantage+ on Meta): the platform can deliver beyond the ages, genders, and detailed targeting you set, treating them as suggestions.

+ */ + @JsonSetter(value = "automatic", nulls = Nulls.SKIP) + public Builder automatic(Optional automatic) { + this.automatic = automatic; + return this; + } + + public Builder automatic(Boolean automatic) { + this.automatic = Optional.ofNullable(automatic); + return this; + } + + /** + *

Gender to target.

+ */ + @JsonSetter(value = "gender", nulls = Nulls.SKIP) + public Builder gender(Optional gender) { + this.gender = gender; + return this; + } + + public Builder gender(AdGroupDemographicsBodyGender gender) { + this.gender = Optional.ofNullable(gender); + return this; + } + + /** + *

Oldest age to target.

+ */ + @JsonSetter(value = "maximum_age", nulls = Nulls.SKIP) + public Builder maximumAge(Optional maximumAge) { + this.maximumAge = maximumAge; + return this; + } + + public Builder maximumAge(Integer maximumAge) { + this.maximumAge = Optional.ofNullable(maximumAge); + return this; + } + + /** + *

Youngest age to target.

+ */ + @JsonSetter(value = "minimum_age", nulls = Nulls.SKIP) + public Builder minimumAge(Optional minimumAge) { + this.minimumAge = minimumAge; + return this; + } + + public Builder minimumAge(Integer minimumAge) { + this.minimumAge = Optional.ofNullable(minimumAge); + return this; + } + + public AdGroupDemographicsBody build() { + return new AdGroupDemographicsBody(automatic, gender, maximumAge, minimumAge, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDemographicsBodyGender.java b/src/main/java/com/whop/api/types/AdGroupDemographicsBodyGender.java new file mode 100644 index 00000000..6fed52b8 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDemographicsBodyGender.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupDemographicsBodyGender { + public static final AdGroupDemographicsBodyGender MALE = new AdGroupDemographicsBodyGender(Value.MALE, "male"); + + public static final AdGroupDemographicsBodyGender FEMALE = + new AdGroupDemographicsBodyGender(Value.FEMALE, "female"); + + public static final AdGroupDemographicsBodyGender ALL = new AdGroupDemographicsBodyGender(Value.ALL, "all"); + + private final Value value; + + private final String string; + + AdGroupDemographicsBodyGender(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupDemographicsBodyGender + && this.string.equals(((AdGroupDemographicsBodyGender) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MALE: + return visitor.visitMale(); + case FEMALE: + return visitor.visitFemale(); + case ALL: + return visitor.visitAll(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupDemographicsBodyGender valueOf(String value) { + switch (value) { + case "male": + return MALE; + case "female": + return FEMALE; + case "all": + return ALL; + default: + return new AdGroupDemographicsBodyGender(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL, + + MALE, + + FEMALE, + + UNKNOWN + } + + public interface Visitor { + T visitAll(); + + T visitMale(); + + T visitFemale(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDemographicsGender.java b/src/main/java/com/whop/api/types/AdGroupDemographicsGender.java new file mode 100644 index 00000000..3581b6b3 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDemographicsGender.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupDemographicsGender { + public static final AdGroupDemographicsGender MALE = new AdGroupDemographicsGender(Value.MALE, "male"); + + public static final AdGroupDemographicsGender FEMALE = new AdGroupDemographicsGender(Value.FEMALE, "female"); + + public static final AdGroupDemographicsGender ALL = new AdGroupDemographicsGender(Value.ALL, "all"); + + private final Value value; + + private final String string; + + AdGroupDemographicsGender(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupDemographicsGender + && this.string.equals(((AdGroupDemographicsGender) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MALE: + return visitor.visitMale(); + case FEMALE: + return visitor.visitFemale(); + case ALL: + return visitor.visitAll(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupDemographicsGender valueOf(String value) { + switch (value) { + case "male": + return MALE; + case "female": + return FEMALE; + case "all": + return ALL; + default: + return new AdGroupDemographicsGender(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL, + + MALE, + + FEMALE, + + UNKNOWN + } + + public interface Visitor { + T visitAll(); + + T visitMale(); + + T visitFemale(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDetailedTargeting.java b/src/main/java/com/whop/api/types/AdGroupDetailedTargeting.java new file mode 100644 index 00000000..9cf88cd1 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDetailedTargeting.java @@ -0,0 +1,186 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupDetailedTargeting.Builder.class) +public final class AdGroupDetailedTargeting { + private final List behaviors; + + private final List demographics; + + private final List interests; + + private final Map additionalProperties; + + private AdGroupDetailedTargeting( + List behaviors, + List demographics, + List interests, + Map additionalProperties) { + this.behaviors = behaviors; + this.demographics = demographics; + this.interests = interests; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("behaviors") + public List getBehaviors() { + return behaviors; + } + + @JsonProperty("demographics") + public List getDemographics() { + return demographics; + } + + @JsonProperty("interests") + public List getInterests() { + return interests; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupDetailedTargeting && equalTo((AdGroupDetailedTargeting) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupDetailedTargeting other) { + return behaviors.equals(other.behaviors) + && demographics.equals(other.demographics) + && interests.equals(other.interests); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.behaviors, this.demographics, this.interests); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List behaviors = new ArrayList<>(); + + private List demographics = new ArrayList<>(); + + private List interests = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdGroupDetailedTargeting other) { + behaviors(other.getBehaviors()); + demographics(other.getDemographics()); + interests(other.getInterests()); + return this; + } + + @JsonSetter(value = "behaviors", nulls = Nulls.SKIP) + public Builder behaviors(List behaviors) { + this.behaviors.clear(); + if (behaviors != null) { + this.behaviors.addAll(behaviors); + } + return this; + } + + public Builder addBehaviors(AdGroupBehaviorCategory behaviors) { + this.behaviors.add(behaviors); + return this; + } + + public Builder addAllBehaviors(List behaviors) { + if (behaviors != null) { + this.behaviors.addAll(behaviors); + } + return this; + } + + @JsonSetter(value = "demographics", nulls = Nulls.SKIP) + public Builder demographics(List demographics) { + this.demographics.clear(); + if (demographics != null) { + this.demographics.addAll(demographics); + } + return this; + } + + public Builder addDemographics(AdGroupDemographicCategory demographics) { + this.demographics.add(demographics); + return this; + } + + public Builder addAllDemographics(List demographics) { + if (demographics != null) { + this.demographics.addAll(demographics); + } + return this; + } + + @JsonSetter(value = "interests", nulls = Nulls.SKIP) + public Builder interests(List interests) { + this.interests.clear(); + if (interests != null) { + this.interests.addAll(interests); + } + return this; + } + + public Builder addInterests(AdGroupTargetingCategory interests) { + this.interests.add(interests); + return this; + } + + public Builder addAllInterests(List interests) { + if (interests != null) { + this.interests.addAll(interests); + } + return this; + } + + public AdGroupDetailedTargeting build() { + return new AdGroupDetailedTargeting(behaviors, demographics, interests, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBody.java b/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBody.java new file mode 100644 index 00000000..7493317d --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBody.java @@ -0,0 +1,174 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupDetailedTargetingBody.Builder.class) +public final class AdGroupDetailedTargetingBody { + private final Optional> behaviors; + + private final Optional> demographics; + + private final Optional> interests; + + private final Map additionalProperties; + + private AdGroupDetailedTargetingBody( + Optional> behaviors, + Optional> demographics, + Optional> interests, + Map additionalProperties) { + this.behaviors = behaviors; + this.demographics = demographics; + this.interests = interests; + this.additionalProperties = additionalProperties; + } + + /** + * @return Behavior categories to target, such as frequent travelers. + */ + @JsonProperty("behaviors") + public Optional> getBehaviors() { + return behaviors; + } + + /** + * @return Demographic categories to target, such as life events, industries, work employers, job titles, schools, or majors. + */ + @JsonProperty("demographics") + public Optional> getDemographics() { + return demographics; + } + + /** + * @return Interest categories to target, such as an interest in movies. + */ + @JsonProperty("interests") + public Optional> getInterests() { + return interests; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupDetailedTargetingBody && equalTo((AdGroupDetailedTargetingBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupDetailedTargetingBody other) { + return behaviors.equals(other.behaviors) + && demographics.equals(other.demographics) + && interests.equals(other.interests); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.behaviors, this.demographics, this.interests); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> behaviors = Optional.empty(); + + private Optional> demographics = Optional.empty(); + + private Optional> interests = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdGroupDetailedTargetingBody other) { + behaviors(other.getBehaviors()); + demographics(other.getDemographics()); + interests(other.getInterests()); + return this; + } + + /** + *

Behavior categories to target, such as frequent travelers.

+ */ + @JsonSetter(value = "behaviors", nulls = Nulls.SKIP) + public Builder behaviors(Optional> behaviors) { + this.behaviors = behaviors; + return this; + } + + public Builder behaviors(List behaviors) { + this.behaviors = Optional.ofNullable(behaviors); + return this; + } + + /** + *

Demographic categories to target, such as life events, industries, work employers, job titles, schools, or majors.

+ */ + @JsonSetter(value = "demographics", nulls = Nulls.SKIP) + public Builder demographics(Optional> demographics) { + this.demographics = demographics; + return this; + } + + public Builder demographics(List demographics) { + this.demographics = Optional.ofNullable(demographics); + return this; + } + + /** + *

Interest categories to target, such as an interest in movies.

+ */ + @JsonSetter(value = "interests", nulls = Nulls.SKIP) + public Builder interests(Optional> interests) { + this.interests = interests; + return this; + } + + public Builder interests(List interests) { + this.interests = Optional.ofNullable(interests); + return this; + } + + public AdGroupDetailedTargetingBody build() { + return new AdGroupDetailedTargetingBody(behaviors, demographics, interests, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBodyBehaviorsItem.java b/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBodyBehaviorsItem.java new file mode 100644 index 00000000..54bda17c --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBodyBehaviorsItem.java @@ -0,0 +1,263 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupDetailedTargetingBodyBehaviorsItem.Builder.class) +public final class AdGroupDetailedTargetingBodyBehaviorsItem { + private final Optional behaviorType; + + private final String id; + + private final Optional name; + + private final Optional period; + + private final Map additionalProperties; + + private AdGroupDetailedTargetingBodyBehaviorsItem( + Optional behaviorType, + String id, + Optional name, + Optional period, + Map additionalProperties) { + this.behaviorType = behaviorType; + this.id = id; + this.name = name; + this.period = period; + this.additionalProperties = additionalProperties; + } + + /** + * @return On ad platforms that scope behavior categories, what this one is measured on. Send back the value the targeting_options endpoint returned alongside the id. + */ + @JsonProperty("behavior_type") + public Optional getBehaviorType() { + return behaviorType; + } + + /** + * @return The ad platform's ID for the category in its targeting taxonomy. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Category name, such as Frequent travelers. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return On ad platforms that scope behavior categories, how many days of activity the category covers. + */ + @JsonProperty("period") + public Optional getPeriod() { + return period; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupDetailedTargetingBodyBehaviorsItem + && equalTo((AdGroupDetailedTargetingBodyBehaviorsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupDetailedTargetingBodyBehaviorsItem other) { + return behaviorType.equals(other.behaviorType) + && id.equals(other.id) + && name.equals(other.name) + && period.equals(other.period); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.behaviorType, this.id, this.name, this.period); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ad platform's ID for the category in its targeting taxonomy.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(AdGroupDetailedTargetingBodyBehaviorsItem other); + } + + public interface _FinalStage { + AdGroupDetailedTargetingBodyBehaviorsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

On ad platforms that scope behavior categories, what this one is measured on. Send back the value the targeting_options endpoint returned alongside the id.

+ */ + _FinalStage behaviorType(Optional behaviorType); + + _FinalStage behaviorType(AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType behaviorType); + + /** + *

Category name, such as Frequent travelers.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + /** + *

On ad platforms that scope behavior categories, how many days of activity the category covers.

+ */ + _FinalStage period(Optional period); + + _FinalStage period(Integer period); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional period = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional behaviorType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupDetailedTargetingBodyBehaviorsItem other) { + behaviorType(other.getBehaviorType()); + id(other.getId()); + name(other.getName()); + period(other.getPeriod()); + return this; + } + + /** + *

The ad platform's ID for the category in its targeting taxonomy.

+ *

The ad platform's ID for the category in its targeting taxonomy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

On ad platforms that scope behavior categories, how many days of activity the category covers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage period(Integer period) { + this.period = Optional.ofNullable(period); + return this; + } + + /** + *

On ad platforms that scope behavior categories, how many days of activity the category covers.

+ */ + @java.lang.Override + @JsonSetter(value = "period", nulls = Nulls.SKIP) + public _FinalStage period(Optional period) { + this.period = period; + return this; + } + + /** + *

Category name, such as Frequent travelers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Category name, such as Frequent travelers.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

On ad platforms that scope behavior categories, what this one is measured on. Send back the value the targeting_options endpoint returned alongside the id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage behaviorType(AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType behaviorType) { + this.behaviorType = Optional.ofNullable(behaviorType); + return this; + } + + /** + *

On ad platforms that scope behavior categories, what this one is measured on. Send back the value the targeting_options endpoint returned alongside the id.

+ */ + @java.lang.Override + @JsonSetter(value = "behavior_type", nulls = Nulls.SKIP) + public _FinalStage behaviorType(Optional behaviorType) { + this.behaviorType = behaviorType; + return this; + } + + @java.lang.Override + public AdGroupDetailedTargetingBodyBehaviorsItem build() { + return new AdGroupDetailedTargetingBodyBehaviorsItem(behaviorType, id, name, period, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType.java b/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType.java new file mode 100644 index 00000000..9121cdc7 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType { + public static final AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType HASHTAG = + new AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType(Value.HASHTAG, "hashtag"); + + public static final AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType CREATOR = + new AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType(Value.CREATOR, "creator"); + + public static final AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType VIDEO = + new AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType(Value.VIDEO, "video"); + + private final Value value; + + private final String string; + + AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType + && this.string.equals(((AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HASHTAG: + return visitor.visitHashtag(); + case CREATOR: + return visitor.visitCreator(); + case VIDEO: + return visitor.visitVideo(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType valueOf(String value) { + switch (value) { + case "hashtag": + return HASHTAG; + case "creator": + return CREATOR; + case "video": + return VIDEO; + default: + return new AdGroupDetailedTargetingBodyBehaviorsItemBehaviorType(Value.UNKNOWN, value); + } + } + + public enum Value { + VIDEO, + + CREATOR, + + HASHTAG, + + UNKNOWN + } + + public interface Visitor { + T visitVideo(); + + T visitCreator(); + + T visitHashtag(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBodyDemographicsItem.java b/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBodyDemographicsItem.java new file mode 100644 index 00000000..cbfee856 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBodyDemographicsItem.java @@ -0,0 +1,210 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupDetailedTargetingBodyDemographicsItem.Builder.class) +public final class AdGroupDetailedTargetingBodyDemographicsItem { + private final String id; + + private final Optional name; + + private final AdGroupDetailedTargetingBodyDemographicsItemType type; + + private final Map additionalProperties; + + private AdGroupDetailedTargetingBodyDemographicsItem( + String id, + Optional name, + AdGroupDetailedTargetingBodyDemographicsItemType type, + Map additionalProperties) { + this.id = id; + this.name = name; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ad platform's ID for the category in its targeting taxonomy. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Category name, such as Recently moved. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Kind of demographic the category belongs to. + */ + @JsonProperty("type") + public AdGroupDetailedTargetingBodyDemographicsItemType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupDetailedTargetingBodyDemographicsItem + && equalTo((AdGroupDetailedTargetingBodyDemographicsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupDetailedTargetingBodyDemographicsItem other) { + return id.equals(other.id) && name.equals(other.name) && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ad platform's ID for the category in its targeting taxonomy.

+ */ + TypeStage id(@NotNull String id); + + Builder from(AdGroupDetailedTargetingBodyDemographicsItem other); + } + + public interface TypeStage { + /** + *

Kind of demographic the category belongs to.

+ */ + _FinalStage type(@NotNull AdGroupDetailedTargetingBodyDemographicsItemType type); + } + + public interface _FinalStage { + AdGroupDetailedTargetingBodyDemographicsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Category name, such as Recently moved.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TypeStage, _FinalStage { + private String id; + + private AdGroupDetailedTargetingBodyDemographicsItemType type; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupDetailedTargetingBodyDemographicsItem other) { + id(other.getId()); + name(other.getName()); + type(other.getType()); + return this; + } + + /** + *

The ad platform's ID for the category in its targeting taxonomy.

+ *

The ad platform's ID for the category in its targeting taxonomy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Kind of demographic the category belongs to.

+ *

Kind of demographic the category belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull AdGroupDetailedTargetingBodyDemographicsItemType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

Category name, such as Recently moved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Category name, such as Recently moved.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public AdGroupDetailedTargetingBodyDemographicsItem build() { + return new AdGroupDetailedTargetingBodyDemographicsItem(id, name, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBodyDemographicsItemType.java b/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBodyDemographicsItemType.java new file mode 100644 index 00000000..6687f5c6 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBodyDemographicsItemType.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupDetailedTargetingBodyDemographicsItemType { + public static final AdGroupDetailedTargetingBodyDemographicsItemType WORK_POSITIONS = + new AdGroupDetailedTargetingBodyDemographicsItemType(Value.WORK_POSITIONS, "work_positions"); + + public static final AdGroupDetailedTargetingBodyDemographicsItemType FAMILY_STATUSES = + new AdGroupDetailedTargetingBodyDemographicsItemType(Value.FAMILY_STATUSES, "family_statuses"); + + public static final AdGroupDetailedTargetingBodyDemographicsItemType INDUSTRIES = + new AdGroupDetailedTargetingBodyDemographicsItemType(Value.INDUSTRIES, "industries"); + + public static final AdGroupDetailedTargetingBodyDemographicsItemType EDUCATION_MAJORS = + new AdGroupDetailedTargetingBodyDemographicsItemType(Value.EDUCATION_MAJORS, "education_majors"); + + public static final AdGroupDetailedTargetingBodyDemographicsItemType INCOME = + new AdGroupDetailedTargetingBodyDemographicsItemType(Value.INCOME, "income"); + + public static final AdGroupDetailedTargetingBodyDemographicsItemType LIFE_EVENTS = + new AdGroupDetailedTargetingBodyDemographicsItemType(Value.LIFE_EVENTS, "life_events"); + + public static final AdGroupDetailedTargetingBodyDemographicsItemType EDUCATION_SCHOOLS = + new AdGroupDetailedTargetingBodyDemographicsItemType(Value.EDUCATION_SCHOOLS, "education_schools"); + + public static final AdGroupDetailedTargetingBodyDemographicsItemType WORK_EMPLOYERS = + new AdGroupDetailedTargetingBodyDemographicsItemType(Value.WORK_EMPLOYERS, "work_employers"); + + private final Value value; + + private final String string; + + AdGroupDetailedTargetingBodyDemographicsItemType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupDetailedTargetingBodyDemographicsItemType + && this.string.equals(((AdGroupDetailedTargetingBodyDemographicsItemType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WORK_POSITIONS: + return visitor.visitWorkPositions(); + case FAMILY_STATUSES: + return visitor.visitFamilyStatuses(); + case INDUSTRIES: + return visitor.visitIndustries(); + case EDUCATION_MAJORS: + return visitor.visitEducationMajors(); + case INCOME: + return visitor.visitIncome(); + case LIFE_EVENTS: + return visitor.visitLifeEvents(); + case EDUCATION_SCHOOLS: + return visitor.visitEducationSchools(); + case WORK_EMPLOYERS: + return visitor.visitWorkEmployers(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupDetailedTargetingBodyDemographicsItemType valueOf(String value) { + switch (value) { + case "work_positions": + return WORK_POSITIONS; + case "family_statuses": + return FAMILY_STATUSES; + case "industries": + return INDUSTRIES; + case "education_majors": + return EDUCATION_MAJORS; + case "income": + return INCOME; + case "life_events": + return LIFE_EVENTS; + case "education_schools": + return EDUCATION_SCHOOLS; + case "work_employers": + return WORK_EMPLOYERS; + default: + return new AdGroupDetailedTargetingBodyDemographicsItemType(Value.UNKNOWN, value); + } + } + + public enum Value { + LIFE_EVENTS, + + INDUSTRIES, + + INCOME, + + FAMILY_STATUSES, + + WORK_EMPLOYERS, + + WORK_POSITIONS, + + EDUCATION_SCHOOLS, + + EDUCATION_MAJORS, + + UNKNOWN + } + + public interface Visitor { + T visitLifeEvents(); + + T visitIndustries(); + + T visitIncome(); + + T visitFamilyStatuses(); + + T visitWorkEmployers(); + + T visitWorkPositions(); + + T visitEducationSchools(); + + T visitEducationMajors(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBodyInterestsItem.java b/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBodyInterestsItem.java new file mode 100644 index 00000000..4ab29ad4 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDetailedTargetingBodyInterestsItem.java @@ -0,0 +1,174 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupDetailedTargetingBodyInterestsItem.Builder.class) +public final class AdGroupDetailedTargetingBodyInterestsItem { + private final String id; + + private final Optional name; + + private final Map additionalProperties; + + private AdGroupDetailedTargetingBodyInterestsItem( + String id, Optional name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ad platform's ID for the category in its targeting taxonomy. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Category name, such as Movies. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupDetailedTargetingBodyInterestsItem + && equalTo((AdGroupDetailedTargetingBodyInterestsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupDetailedTargetingBodyInterestsItem other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ad platform's ID for the category in its targeting taxonomy.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(AdGroupDetailedTargetingBodyInterestsItem other); + } + + public interface _FinalStage { + AdGroupDetailedTargetingBodyInterestsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Category name, such as Movies.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupDetailedTargetingBodyInterestsItem other) { + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

The ad platform's ID for the category in its targeting taxonomy.

+ *

The ad platform's ID for the category in its targeting taxonomy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Category name, such as Movies.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Category name, such as Movies.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public AdGroupDetailedTargetingBodyInterestsItem build() { + return new AdGroupDetailedTargetingBodyInterestsItem(id, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDevices.java b/src/main/java/com/whop/api/types/AdGroupDevices.java new file mode 100644 index 00000000..3a32d02f --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDevices.java @@ -0,0 +1,151 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupDevices.Builder.class) +public final class AdGroupDevices { + private final List operatingSystems; + + private final List platforms; + + private final Map additionalProperties; + + private AdGroupDevices( + List operatingSystems, + List platforms, + Map additionalProperties) { + this.operatingSystems = operatingSystems; + this.platforms = platforms; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("operating_systems") + public List getOperatingSystems() { + return operatingSystems; + } + + @JsonProperty("platforms") + public List getPlatforms() { + return platforms; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupDevices && equalTo((AdGroupDevices) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupDevices other) { + return operatingSystems.equals(other.operatingSystems) && platforms.equals(other.platforms); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.operatingSystems, this.platforms); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List operatingSystems = new ArrayList<>(); + + private List platforms = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdGroupDevices other) { + operatingSystems(other.getOperatingSystems()); + platforms(other.getPlatforms()); + return this; + } + + @JsonSetter(value = "operating_systems", nulls = Nulls.SKIP) + public Builder operatingSystems(List operatingSystems) { + this.operatingSystems.clear(); + if (operatingSystems != null) { + this.operatingSystems.addAll(operatingSystems); + } + return this; + } + + public Builder addOperatingSystems(AdGroupOperatingSystem operatingSystems) { + this.operatingSystems.add(operatingSystems); + return this; + } + + public Builder addAllOperatingSystems(List operatingSystems) { + if (operatingSystems != null) { + this.operatingSystems.addAll(operatingSystems); + } + return this; + } + + @JsonSetter(value = "platforms", nulls = Nulls.SKIP) + public Builder platforms(List platforms) { + this.platforms.clear(); + if (platforms != null) { + this.platforms.addAll(platforms); + } + return this; + } + + public Builder addPlatforms(AdGroupDevicesPlatformsItem platforms) { + this.platforms.add(platforms); + return this; + } + + public Builder addAllPlatforms(List platforms) { + if (platforms != null) { + this.platforms.addAll(platforms); + } + return this; + } + + public AdGroupDevices build() { + return new AdGroupDevices(operatingSystems, platforms, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDevicesBody.java b/src/main/java/com/whop/api/types/AdGroupDevicesBody.java new file mode 100644 index 00000000..b6a7ffdd --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDevicesBody.java @@ -0,0 +1,143 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupDevicesBody.Builder.class) +public final class AdGroupDevicesBody { + private final Optional> operatingSystems; + + private final Optional> platforms; + + private final Map additionalProperties; + + private AdGroupDevicesBody( + Optional> operatingSystems, + Optional> platforms, + Map additionalProperties) { + this.operatingSystems = operatingSystems; + this.platforms = platforms; + this.additionalProperties = additionalProperties; + } + + /** + * @return Operating systems to target. Empty targets all operating systems. + */ + @JsonProperty("operating_systems") + public Optional> getOperatingSystems() { + return operatingSystems; + } + + /** + * @return Device types to target. Empty targets all devices. + */ + @JsonProperty("platforms") + public Optional> getPlatforms() { + return platforms; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupDevicesBody && equalTo((AdGroupDevicesBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupDevicesBody other) { + return operatingSystems.equals(other.operatingSystems) && platforms.equals(other.platforms); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.operatingSystems, this.platforms); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> operatingSystems = Optional.empty(); + + private Optional> platforms = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdGroupDevicesBody other) { + operatingSystems(other.getOperatingSystems()); + platforms(other.getPlatforms()); + return this; + } + + /** + *

Operating systems to target. Empty targets all operating systems.

+ */ + @JsonSetter(value = "operating_systems", nulls = Nulls.SKIP) + public Builder operatingSystems(Optional> operatingSystems) { + this.operatingSystems = operatingSystems; + return this; + } + + public Builder operatingSystems(List operatingSystems) { + this.operatingSystems = Optional.ofNullable(operatingSystems); + return this; + } + + /** + *

Device types to target. Empty targets all devices.

+ */ + @JsonSetter(value = "platforms", nulls = Nulls.SKIP) + public Builder platforms(Optional> platforms) { + this.platforms = platforms; + return this; + } + + public Builder platforms(List platforms) { + this.platforms = Optional.ofNullable(platforms); + return this; + } + + public AdGroupDevicesBody build() { + return new AdGroupDevicesBody(operatingSystems, platforms, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDevicesBodyOperatingSystemsItem.java b/src/main/java/com/whop/api/types/AdGroupDevicesBodyOperatingSystemsItem.java new file mode 100644 index 00000000..59531cb5 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDevicesBodyOperatingSystemsItem.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupDevicesBodyOperatingSystemsItem.Builder.class) +public final class AdGroupDevicesBodyOperatingSystemsItem { + private final Optional minimumVersion; + + private final AdGroupDevicesBodyOperatingSystemsItemOs os; + + private final Map additionalProperties; + + private AdGroupDevicesBodyOperatingSystemsItem( + Optional minimumVersion, + AdGroupDevicesBodyOperatingSystemsItemOs os, + Map additionalProperties) { + this.minimumVersion = minimumVersion; + this.os = os; + this.additionalProperties = additionalProperties; + } + + /** + * @return Lowest OS version to target, such as 18.0. Omit to target any version. + */ + @JsonProperty("minimum_version") + public Optional getMinimumVersion() { + return minimumVersion; + } + + /** + * @return Operating system to target. + */ + @JsonProperty("os") + public AdGroupDevicesBodyOperatingSystemsItemOs getOs() { + return os; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupDevicesBodyOperatingSystemsItem + && equalTo((AdGroupDevicesBodyOperatingSystemsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupDevicesBodyOperatingSystemsItem other) { + return minimumVersion.equals(other.minimumVersion) && os.equals(other.os); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.minimumVersion, this.os); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static OsStage builder() { + return new Builder(); + } + + public interface OsStage { + /** + *

Operating system to target.

+ */ + _FinalStage os(@NotNull AdGroupDevicesBodyOperatingSystemsItemOs os); + + Builder from(AdGroupDevicesBodyOperatingSystemsItem other); + } + + public interface _FinalStage { + AdGroupDevicesBodyOperatingSystemsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Lowest OS version to target, such as 18.0. Omit to target any version.

+ */ + _FinalStage minimumVersion(Optional minimumVersion); + + _FinalStage minimumVersion(String minimumVersion); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements OsStage, _FinalStage { + private AdGroupDevicesBodyOperatingSystemsItemOs os; + + private Optional minimumVersion = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupDevicesBodyOperatingSystemsItem other) { + minimumVersion(other.getMinimumVersion()); + os(other.getOs()); + return this; + } + + /** + *

Operating system to target.

+ *

Operating system to target.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("os") + public _FinalStage os(@NotNull AdGroupDevicesBodyOperatingSystemsItemOs os) { + this.os = Objects.requireNonNull(os, "os must not be null"); + return this; + } + + /** + *

Lowest OS version to target, such as 18.0. Omit to target any version.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage minimumVersion(String minimumVersion) { + this.minimumVersion = Optional.ofNullable(minimumVersion); + return this; + } + + /** + *

Lowest OS version to target, such as 18.0. Omit to target any version.

+ */ + @java.lang.Override + @JsonSetter(value = "minimum_version", nulls = Nulls.SKIP) + public _FinalStage minimumVersion(Optional minimumVersion) { + this.minimumVersion = minimumVersion; + return this; + } + + @java.lang.Override + public AdGroupDevicesBodyOperatingSystemsItem build() { + return new AdGroupDevicesBodyOperatingSystemsItem(minimumVersion, os, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDevicesBodyOperatingSystemsItemOs.java b/src/main/java/com/whop/api/types/AdGroupDevicesBodyOperatingSystemsItemOs.java new file mode 100644 index 00000000..9ef4b17d --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDevicesBodyOperatingSystemsItemOs.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupDevicesBodyOperatingSystemsItemOs { + public static final AdGroupDevicesBodyOperatingSystemsItemOs IOS = + new AdGroupDevicesBodyOperatingSystemsItemOs(Value.IOS, "ios"); + + public static final AdGroupDevicesBodyOperatingSystemsItemOs ANDROID = + new AdGroupDevicesBodyOperatingSystemsItemOs(Value.ANDROID, "android"); + + private final Value value; + + private final String string; + + AdGroupDevicesBodyOperatingSystemsItemOs(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupDevicesBodyOperatingSystemsItemOs + && this.string.equals(((AdGroupDevicesBodyOperatingSystemsItemOs) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case IOS: + return visitor.visitIos(); + case ANDROID: + return visitor.visitAndroid(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupDevicesBodyOperatingSystemsItemOs valueOf(String value) { + switch (value) { + case "ios": + return IOS; + case "android": + return ANDROID; + default: + return new AdGroupDevicesBodyOperatingSystemsItemOs(Value.UNKNOWN, value); + } + } + + public enum Value { + IOS, + + ANDROID, + + UNKNOWN + } + + public interface Visitor { + T visitIos(); + + T visitAndroid(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDevicesBodyPlatformsItem.java b/src/main/java/com/whop/api/types/AdGroupDevicesBodyPlatformsItem.java new file mode 100644 index 00000000..88bd72f7 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDevicesBodyPlatformsItem.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupDevicesBodyPlatformsItem { + public static final AdGroupDevicesBodyPlatformsItem MOBILE = + new AdGroupDevicesBodyPlatformsItem(Value.MOBILE, "mobile"); + + public static final AdGroupDevicesBodyPlatformsItem DESKTOP = + new AdGroupDevicesBodyPlatformsItem(Value.DESKTOP, "desktop"); + + private final Value value; + + private final String string; + + AdGroupDevicesBodyPlatformsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupDevicesBodyPlatformsItem + && this.string.equals(((AdGroupDevicesBodyPlatformsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MOBILE: + return visitor.visitMobile(); + case DESKTOP: + return visitor.visitDesktop(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupDevicesBodyPlatformsItem valueOf(String value) { + switch (value) { + case "mobile": + return MOBILE; + case "desktop": + return DESKTOP; + default: + return new AdGroupDevicesBodyPlatformsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + MOBILE, + + DESKTOP, + + UNKNOWN + } + + public interface Visitor { + T visitMobile(); + + T visitDesktop(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupDevicesPlatformsItem.java b/src/main/java/com/whop/api/types/AdGroupDevicesPlatformsItem.java new file mode 100644 index 00000000..6cda1013 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupDevicesPlatformsItem.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupDevicesPlatformsItem { + public static final AdGroupDevicesPlatformsItem MOBILE = new AdGroupDevicesPlatformsItem(Value.MOBILE, "mobile"); + + public static final AdGroupDevicesPlatformsItem DESKTOP = new AdGroupDevicesPlatformsItem(Value.DESKTOP, "desktop"); + + private final Value value; + + private final String string; + + AdGroupDevicesPlatformsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupDevicesPlatformsItem + && this.string.equals(((AdGroupDevicesPlatformsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MOBILE: + return visitor.visitMobile(); + case DESKTOP: + return visitor.visitDesktop(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupDevicesPlatformsItem valueOf(String value) { + switch (value) { + case "mobile": + return MOBILE; + case "desktop": + return DESKTOP; + default: + return new AdGroupDevicesPlatformsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + MOBILE, + + DESKTOP, + + UNKNOWN + } + + public interface Visitor { + T visitMobile(); + + T visitDesktop(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupFrequencyCap.java b/src/main/java/com/whop/api/types/AdGroupFrequencyCap.java new file mode 100644 index 00000000..31c002d0 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupFrequencyCap.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupFrequencyCap.Builder.class) +public final class AdGroupFrequencyCap { + private final double maximumImpressions; + + private final Optional perDays; + + private final Map additionalProperties; + + private AdGroupFrequencyCap( + double maximumImpressions, Optional perDays, Map additionalProperties) { + this.maximumImpressions = maximumImpressions; + this.perDays = perDays; + this.additionalProperties = additionalProperties; + } + + /** + * @return Most times one person can be shown ads from this ad group within the window. + */ + @JsonProperty("maximum_impressions") + public double getMaximumImpressions() { + return maximumImpressions; + } + + /** + * @return Length of the rolling window, in days. + */ + @JsonIgnore + public Optional getPerDays() { + if (perDays == null) { + return Optional.empty(); + } + return perDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("per_days") + private Optional _getPerDays() { + return perDays; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupFrequencyCap && equalTo((AdGroupFrequencyCap) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupFrequencyCap other) { + return maximumImpressions == other.maximumImpressions && perDays.equals(other.perDays); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.maximumImpressions, this.perDays); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MaximumImpressionsStage builder() { + return new Builder(); + } + + public interface MaximumImpressionsStage { + /** + *

Most times one person can be shown ads from this ad group within the window.

+ */ + _FinalStage maximumImpressions(double maximumImpressions); + + Builder from(AdGroupFrequencyCap other); + } + + public interface _FinalStage { + AdGroupFrequencyCap build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Length of the rolling window, in days.

+ */ + _FinalStage perDays(Optional perDays); + + _FinalStage perDays(Double perDays); + + _FinalStage perDays(Nullable perDays); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MaximumImpressionsStage, _FinalStage { + private double maximumImpressions; + + private Optional perDays = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupFrequencyCap other) { + maximumImpressions(other.getMaximumImpressions()); + perDays(other.getPerDays()); + return this; + } + + /** + *

Most times one person can be shown ads from this ad group within the window.

+ *

Most times one person can be shown ads from this ad group within the window.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("maximum_impressions") + public _FinalStage maximumImpressions(double maximumImpressions) { + this.maximumImpressions = maximumImpressions; + return this; + } + + /** + *

Length of the rolling window, in days.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage perDays(Nullable perDays) { + if (perDays.isNull()) { + this.perDays = null; + } else if (perDays.isEmpty()) { + this.perDays = Optional.empty(); + } else { + this.perDays = Optional.of(perDays.get()); + } + return this; + } + + /** + *

Length of the rolling window, in days.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage perDays(Double perDays) { + this.perDays = Optional.ofNullable(perDays); + return this; + } + + /** + *

Length of the rolling window, in days.

+ */ + @java.lang.Override + @JsonSetter(value = "per_days", nulls = Nulls.SKIP) + public _FinalStage perDays(Optional perDays) { + this.perDays = perDays; + return this; + } + + @java.lang.Override + public AdGroupFrequencyCap build() { + return new AdGroupFrequencyCap(maximumImpressions, perDays, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupGeoLocations.java b/src/main/java/com/whop/api/types/AdGroupGeoLocations.java new file mode 100644 index 00000000..3143883d --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupGeoLocations.java @@ -0,0 +1,290 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupGeoLocations.Builder.class) +public final class AdGroupGeoLocations { + private final List cities; + + private final List countries; + + private final List countryGroups; + + private final List customLocations; + + private final List regions; + + private final List zips; + + private final Map additionalProperties; + + private AdGroupGeoLocations( + List cities, + List countries, + List countryGroups, + List customLocations, + List regions, + List zips, + Map additionalProperties) { + this.cities = cities; + this.countries = countries; + this.countryGroups = countryGroups; + this.customLocations = customLocations; + this.regions = regions; + this.zips = zips; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("cities") + public List getCities() { + return cities; + } + + @JsonProperty("countries") + public List getCountries() { + return countries; + } + + @JsonProperty("country_groups") + public List getCountryGroups() { + return countryGroups; + } + + @JsonProperty("custom_locations") + public List getCustomLocations() { + return customLocations; + } + + @JsonProperty("regions") + public List getRegions() { + return regions; + } + + @JsonProperty("zips") + public List getZips() { + return zips; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupGeoLocations && equalTo((AdGroupGeoLocations) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupGeoLocations other) { + return cities.equals(other.cities) + && countries.equals(other.countries) + && countryGroups.equals(other.countryGroups) + && customLocations.equals(other.customLocations) + && regions.equals(other.regions) + && zips.equals(other.zips); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.cities, this.countries, this.countryGroups, this.customLocations, this.regions, this.zips); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List cities = new ArrayList<>(); + + private List countries = new ArrayList<>(); + + private List countryGroups = new ArrayList<>(); + + private List customLocations = new ArrayList<>(); + + private List regions = new ArrayList<>(); + + private List zips = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdGroupGeoLocations other) { + cities(other.getCities()); + countries(other.getCountries()); + countryGroups(other.getCountryGroups()); + customLocations(other.getCustomLocations()); + regions(other.getRegions()); + zips(other.getZips()); + return this; + } + + @JsonSetter(value = "cities", nulls = Nulls.SKIP) + public Builder cities(List cities) { + this.cities.clear(); + if (cities != null) { + this.cities.addAll(cities); + } + return this; + } + + public Builder addCities(AdGroupCity cities) { + this.cities.add(cities); + return this; + } + + public Builder addAllCities(List cities) { + if (cities != null) { + this.cities.addAll(cities); + } + return this; + } + + @JsonSetter(value = "countries", nulls = Nulls.SKIP) + public Builder countries(List countries) { + this.countries.clear(); + if (countries != null) { + this.countries.addAll(countries); + } + return this; + } + + public Builder addCountries(String countries) { + this.countries.add(countries); + return this; + } + + public Builder addAllCountries(List countries) { + if (countries != null) { + this.countries.addAll(countries); + } + return this; + } + + @JsonSetter(value = "country_groups", nulls = Nulls.SKIP) + public Builder countryGroups(List countryGroups) { + this.countryGroups.clear(); + if (countryGroups != null) { + this.countryGroups.addAll(countryGroups); + } + return this; + } + + public Builder addCountryGroups(String countryGroups) { + this.countryGroups.add(countryGroups); + return this; + } + + public Builder addAllCountryGroups(List countryGroups) { + if (countryGroups != null) { + this.countryGroups.addAll(countryGroups); + } + return this; + } + + @JsonSetter(value = "custom_locations", nulls = Nulls.SKIP) + public Builder customLocations(List customLocations) { + this.customLocations.clear(); + if (customLocations != null) { + this.customLocations.addAll(customLocations); + } + return this; + } + + public Builder addCustomLocations(AdGroupCustomLocation customLocations) { + this.customLocations.add(customLocations); + return this; + } + + public Builder addAllCustomLocations(List customLocations) { + if (customLocations != null) { + this.customLocations.addAll(customLocations); + } + return this; + } + + @JsonSetter(value = "regions", nulls = Nulls.SKIP) + public Builder regions(List regions) { + this.regions.clear(); + if (regions != null) { + this.regions.addAll(regions); + } + return this; + } + + public Builder addRegions(String regions) { + this.regions.add(regions); + return this; + } + + public Builder addAllRegions(List regions) { + if (regions != null) { + this.regions.addAll(regions); + } + return this; + } + + @JsonSetter(value = "zips", nulls = Nulls.SKIP) + public Builder zips(List zips) { + this.zips.clear(); + if (zips != null) { + this.zips.addAll(zips); + } + return this; + } + + public Builder addZips(String zips) { + this.zips.add(zips); + return this; + } + + public Builder addAllZips(List zips) { + if (zips != null) { + this.zips.addAll(zips); + } + return this; + } + + public AdGroupGeoLocations build() { + return new AdGroupGeoLocations( + cities, countries, countryGroups, customLocations, regions, zips, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupGeoLocationsBody.java b/src/main/java/com/whop/api/types/AdGroupGeoLocationsBody.java new file mode 100644 index 00000000..8098cda0 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupGeoLocationsBody.java @@ -0,0 +1,266 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupGeoLocationsBody.Builder.class) +public final class AdGroupGeoLocationsBody { + private final Optional> cities; + + private final Optional> countries; + + private final Optional> countryGroups; + + private final Optional> customLocations; + + private final Optional> regions; + + private final Optional> zips; + + private final Map additionalProperties; + + private AdGroupGeoLocationsBody( + Optional> cities, + Optional> countries, + Optional> countryGroups, + Optional> customLocations, + Optional> regions, + Optional> zips, + Map additionalProperties) { + this.cities = cities; + this.countries = countries; + this.countryGroups = countryGroups; + this.customLocations = customLocations; + this.regions = regions; + this.zips = zips; + this.additionalProperties = additionalProperties; + } + + /** + * @return Cities, keyed by the ad platform's location taxonomy. + */ + @JsonProperty("cities") + public Optional> getCities() { + return cities; + } + + /** + * @return Countries, as ISO 3166-1 alpha-2 codes such as US. + */ + @JsonProperty("countries") + public Optional> getCountries() { + return countries; + } + + /** + * @return Multi-country groups such as worldwide or europe. Include-only — groups can't be excluded. + */ + @JsonProperty("country_groups") + public Optional> getCountryGroups() { + return countryGroups; + } + + /** + * @return Circular areas, each a coordinate plus a radius. At most 200 across include and exclude. + */ + @JsonProperty("custom_locations") + public Optional> getCustomLocations() { + return customLocations; + } + + /** + * @return US states and DC, as ISO 3166-2 codes such as US-CA. US territories (PR, GU, VI, AS, MP) and everywhere outside the US are targeted through countries. + */ + @JsonProperty("regions") + public Optional> getRegions() { + return regions; + } + + /** + * @return ZIP and postal codes, as bare strings or objects with a key. + */ + @JsonProperty("zips") + public Optional> getZips() { + return zips; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupGeoLocationsBody && equalTo((AdGroupGeoLocationsBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupGeoLocationsBody other) { + return cities.equals(other.cities) + && countries.equals(other.countries) + && countryGroups.equals(other.countryGroups) + && customLocations.equals(other.customLocations) + && regions.equals(other.regions) + && zips.equals(other.zips); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.cities, this.countries, this.countryGroups, this.customLocations, this.regions, this.zips); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> cities = Optional.empty(); + + private Optional> countries = Optional.empty(); + + private Optional> countryGroups = Optional.empty(); + + private Optional> customLocations = Optional.empty(); + + private Optional> regions = Optional.empty(); + + private Optional> zips = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdGroupGeoLocationsBody other) { + cities(other.getCities()); + countries(other.getCountries()); + countryGroups(other.getCountryGroups()); + customLocations(other.getCustomLocations()); + regions(other.getRegions()); + zips(other.getZips()); + return this; + } + + /** + *

Cities, keyed by the ad platform's location taxonomy.

+ */ + @JsonSetter(value = "cities", nulls = Nulls.SKIP) + public Builder cities(Optional> cities) { + this.cities = cities; + return this; + } + + public Builder cities(List cities) { + this.cities = Optional.ofNullable(cities); + return this; + } + + /** + *

Countries, as ISO 3166-1 alpha-2 codes such as US.

+ */ + @JsonSetter(value = "countries", nulls = Nulls.SKIP) + public Builder countries(Optional> countries) { + this.countries = countries; + return this; + } + + public Builder countries(List countries) { + this.countries = Optional.ofNullable(countries); + return this; + } + + /** + *

Multi-country groups such as worldwide or europe. Include-only — groups can't be excluded.

+ */ + @JsonSetter(value = "country_groups", nulls = Nulls.SKIP) + public Builder countryGroups(Optional> countryGroups) { + this.countryGroups = countryGroups; + return this; + } + + public Builder countryGroups(List countryGroups) { + this.countryGroups = Optional.ofNullable(countryGroups); + return this; + } + + /** + *

Circular areas, each a coordinate plus a radius. At most 200 across include and exclude.

+ */ + @JsonSetter(value = "custom_locations", nulls = Nulls.SKIP) + public Builder customLocations(Optional> customLocations) { + this.customLocations = customLocations; + return this; + } + + public Builder customLocations(List customLocations) { + this.customLocations = Optional.ofNullable(customLocations); + return this; + } + + /** + *

US states and DC, as ISO 3166-2 codes such as US-CA. US territories (PR, GU, VI, AS, MP) and everywhere outside the US are targeted through countries.

+ */ + @JsonSetter(value = "regions", nulls = Nulls.SKIP) + public Builder regions(Optional> regions) { + this.regions = regions; + return this; + } + + public Builder regions(List regions) { + this.regions = Optional.ofNullable(regions); + return this; + } + + /** + *

ZIP and postal codes, as bare strings or objects with a key.

+ */ + @JsonSetter(value = "zips", nulls = Nulls.SKIP) + public Builder zips(Optional> zips) { + this.zips = zips; + return this; + } + + public Builder zips(List zips) { + this.zips = Optional.ofNullable(zips); + return this; + } + + public AdGroupGeoLocationsBody build() { + return new AdGroupGeoLocationsBody( + cities, countries, countryGroups, customLocations, regions, zips, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupGeoLocationsBodyCitiesItem.java b/src/main/java/com/whop/api/types/AdGroupGeoLocationsBodyCitiesItem.java new file mode 100644 index 00000000..ad695f0f --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupGeoLocationsBodyCitiesItem.java @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupGeoLocationsBodyCitiesItem.Builder.class) +public final class AdGroupGeoLocationsBodyCitiesItem { + private final String key; + + private final Optional name; + + private final Map additionalProperties; + + private AdGroupGeoLocationsBodyCitiesItem( + String key, Optional name, Map additionalProperties) { + this.key = key; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ad platform's key for the city in its location taxonomy. + */ + @JsonProperty("key") + public String getKey() { + return key; + } + + /** + * @return City name, such as Austin. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupGeoLocationsBodyCitiesItem && equalTo((AdGroupGeoLocationsBodyCitiesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupGeoLocationsBodyCitiesItem other) { + return key.equals(other.key) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.key, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KeyStage builder() { + return new Builder(); + } + + public interface KeyStage { + /** + *

The ad platform's key for the city in its location taxonomy.

+ */ + _FinalStage key(@NotNull String key); + + Builder from(AdGroupGeoLocationsBodyCitiesItem other); + } + + public interface _FinalStage { + AdGroupGeoLocationsBodyCitiesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

City name, such as Austin.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KeyStage, _FinalStage { + private String key; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupGeoLocationsBodyCitiesItem other) { + key(other.getKey()); + name(other.getName()); + return this; + } + + /** + *

The ad platform's key for the city in its location taxonomy.

+ *

The ad platform's key for the city in its location taxonomy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("key") + public _FinalStage key(@NotNull String key) { + this.key = Objects.requireNonNull(key, "key must not be null"); + return this; + } + + /** + *

City name, such as Austin.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

City name, such as Austin.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public AdGroupGeoLocationsBodyCitiesItem build() { + return new AdGroupGeoLocationsBodyCitiesItem(key, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupGeoLocationsBodyCustomLocationsItem.java b/src/main/java/com/whop/api/types/AdGroupGeoLocationsBodyCustomLocationsItem.java new file mode 100644 index 00000000..655d615d --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupGeoLocationsBodyCustomLocationsItem.java @@ -0,0 +1,290 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupGeoLocationsBodyCustomLocationsItem.Builder.class) +public final class AdGroupGeoLocationsBodyCustomLocationsItem { + private final Optional distanceUnit; + + private final double latitude; + + private final double longitude; + + private final Optional name; + + private final double radius; + + private final Map additionalProperties; + + private AdGroupGeoLocationsBodyCustomLocationsItem( + Optional distanceUnit, + double latitude, + double longitude, + Optional name, + double radius, + Map additionalProperties) { + this.distanceUnit = distanceUnit; + this.latitude = latitude; + this.longitude = longitude; + this.name = name; + this.radius = radius; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unit for radius. Defaults to mile. + */ + @JsonProperty("distance_unit") + public Optional getDistanceUnit() { + return distanceUnit; + } + + /** + * @return Latitude of the center point. + */ + @JsonProperty("latitude") + public double getLatitude() { + return latitude; + } + + /** + * @return Longitude of the center point. + */ + @JsonProperty("longitude") + public double getLongitude() { + return longitude; + } + + /** + * @return Label for the location, such as a city or address. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Radius around the center point: 1-50 miles or 1-80 kilometers. + */ + @JsonProperty("radius") + public double getRadius() { + return radius; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupGeoLocationsBodyCustomLocationsItem + && equalTo((AdGroupGeoLocationsBodyCustomLocationsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupGeoLocationsBodyCustomLocationsItem other) { + return distanceUnit.equals(other.distanceUnit) + && latitude == other.latitude + && longitude == other.longitude + && name.equals(other.name) + && radius == other.radius; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.distanceUnit, this.latitude, this.longitude, this.name, this.radius); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LatitudeStage builder() { + return new Builder(); + } + + public interface LatitudeStage { + /** + *

Latitude of the center point.

+ */ + LongitudeStage latitude(double latitude); + + Builder from(AdGroupGeoLocationsBodyCustomLocationsItem other); + } + + public interface LongitudeStage { + /** + *

Longitude of the center point.

+ */ + RadiusStage longitude(double longitude); + } + + public interface RadiusStage { + /** + *

Radius around the center point: 1-50 miles or 1-80 kilometers.

+ */ + _FinalStage radius(double radius); + } + + public interface _FinalStage { + AdGroupGeoLocationsBodyCustomLocationsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Unit for radius. Defaults to mile.

+ */ + _FinalStage distanceUnit(Optional distanceUnit); + + _FinalStage distanceUnit(AdGroupGeoLocationsBodyCustomLocationsItemDistanceUnit distanceUnit); + + /** + *

Label for the location, such as a city or address.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LatitudeStage, LongitudeStage, RadiusStage, _FinalStage { + private double latitude; + + private double longitude; + + private double radius; + + private Optional name = Optional.empty(); + + private Optional distanceUnit = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupGeoLocationsBodyCustomLocationsItem other) { + distanceUnit(other.getDistanceUnit()); + latitude(other.getLatitude()); + longitude(other.getLongitude()); + name(other.getName()); + radius(other.getRadius()); + return this; + } + + /** + *

Latitude of the center point.

+ *

Latitude of the center point.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("latitude") + public LongitudeStage latitude(double latitude) { + this.latitude = latitude; + return this; + } + + /** + *

Longitude of the center point.

+ *

Longitude of the center point.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("longitude") + public RadiusStage longitude(double longitude) { + this.longitude = longitude; + return this; + } + + /** + *

Radius around the center point: 1-50 miles or 1-80 kilometers.

+ *

Radius around the center point: 1-50 miles or 1-80 kilometers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("radius") + public _FinalStage radius(double radius) { + this.radius = radius; + return this; + } + + /** + *

Label for the location, such as a city or address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Label for the location, such as a city or address.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

Unit for radius. Defaults to mile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage distanceUnit(AdGroupGeoLocationsBodyCustomLocationsItemDistanceUnit distanceUnit) { + this.distanceUnit = Optional.ofNullable(distanceUnit); + return this; + } + + /** + *

Unit for radius. Defaults to mile.

+ */ + @java.lang.Override + @JsonSetter(value = "distance_unit", nulls = Nulls.SKIP) + public _FinalStage distanceUnit(Optional distanceUnit) { + this.distanceUnit = distanceUnit; + return this; + } + + @java.lang.Override + public AdGroupGeoLocationsBodyCustomLocationsItem build() { + return new AdGroupGeoLocationsBodyCustomLocationsItem( + distanceUnit, latitude, longitude, name, radius, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupGeoLocationsBodyCustomLocationsItemDistanceUnit.java b/src/main/java/com/whop/api/types/AdGroupGeoLocationsBodyCustomLocationsItemDistanceUnit.java new file mode 100644 index 00000000..6a79e208 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupGeoLocationsBodyCustomLocationsItemDistanceUnit.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupGeoLocationsBodyCustomLocationsItemDistanceUnit { + public static final AdGroupGeoLocationsBodyCustomLocationsItemDistanceUnit MILE = + new AdGroupGeoLocationsBodyCustomLocationsItemDistanceUnit(Value.MILE, "mile"); + + public static final AdGroupGeoLocationsBodyCustomLocationsItemDistanceUnit KILOMETER = + new AdGroupGeoLocationsBodyCustomLocationsItemDistanceUnit(Value.KILOMETER, "kilometer"); + + private final Value value; + + private final String string; + + AdGroupGeoLocationsBodyCustomLocationsItemDistanceUnit(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupGeoLocationsBodyCustomLocationsItemDistanceUnit + && this.string.equals(((AdGroupGeoLocationsBodyCustomLocationsItemDistanceUnit) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MILE: + return visitor.visitMile(); + case KILOMETER: + return visitor.visitKilometer(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupGeoLocationsBodyCustomLocationsItemDistanceUnit valueOf(String value) { + switch (value) { + case "mile": + return MILE; + case "kilometer": + return KILOMETER; + default: + return new AdGroupGeoLocationsBodyCustomLocationsItemDistanceUnit(Value.UNKNOWN, value); + } + } + + public enum Value { + MILE, + + KILOMETER, + + UNKNOWN + } + + public interface Visitor { + T visitMile(); + + T visitKilometer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupGeoLocationsBodyZipsItem.java b/src/main/java/com/whop/api/types/AdGroupGeoLocationsBodyZipsItem.java new file mode 100644 index 00000000..c9eedf32 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupGeoLocationsBodyZipsItem.java @@ -0,0 +1,99 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Map; +import java.util.Objects; + +@JsonDeserialize(using = AdGroupGeoLocationsBodyZipsItem.Deserializer.class) +public final class AdGroupGeoLocationsBodyZipsItem { + private final Object value; + + private final int type; + + private AdGroupGeoLocationsBodyZipsItem(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((String) this.value); + } else if (this.type == 1) { + return visitor.visit((AdGroupGeoLocationsBodyZipsItemKey) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupGeoLocationsBodyZipsItem && equalTo((AdGroupGeoLocationsBodyZipsItem) other); + } + + private boolean equalTo(AdGroupGeoLocationsBodyZipsItem other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static AdGroupGeoLocationsBodyZipsItem of(String value) { + return new AdGroupGeoLocationsBodyZipsItem(value, 0); + } + + public static AdGroupGeoLocationsBodyZipsItem of(AdGroupGeoLocationsBodyZipsItemKey value) { + return new AdGroupGeoLocationsBodyZipsItem(value, 1); + } + + public interface Visitor { + T visit(String value); + + T visit(AdGroupGeoLocationsBodyZipsItemKey value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(AdGroupGeoLocationsBodyZipsItem.class); + } + + @java.lang.Override + public AdGroupGeoLocationsBodyZipsItem deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Map && ((Map) value).containsKey("key")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, AdGroupGeoLocationsBodyZipsItemKey.class)); + } catch (RuntimeException e) { + } + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupGeoLocationsBodyZipsItemKey.java b/src/main/java/com/whop/api/types/AdGroupGeoLocationsBodyZipsItemKey.java new file mode 100644 index 00000000..b08f4b94 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupGeoLocationsBodyZipsItemKey.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupGeoLocationsBodyZipsItemKey.Builder.class) +public final class AdGroupGeoLocationsBodyZipsItemKey { + private final String key; + + private final Map additionalProperties; + + private AdGroupGeoLocationsBodyZipsItemKey(String key, Map additionalProperties) { + this.key = key; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ZIP or postal code. + */ + @JsonProperty("key") + public String getKey() { + return key; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupGeoLocationsBodyZipsItemKey + && equalTo((AdGroupGeoLocationsBodyZipsItemKey) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupGeoLocationsBodyZipsItemKey other) { + return key.equals(other.key); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.key); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KeyStage builder() { + return new Builder(); + } + + public interface KeyStage { + /** + *

The ZIP or postal code.

+ */ + _FinalStage key(@NotNull String key); + + Builder from(AdGroupGeoLocationsBodyZipsItemKey other); + } + + public interface _FinalStage { + AdGroupGeoLocationsBodyZipsItemKey build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KeyStage, _FinalStage { + private String key; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupGeoLocationsBodyZipsItemKey other) { + key(other.getKey()); + return this; + } + + /** + *

The ZIP or postal code.

+ *

The ZIP or postal code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("key") + public _FinalStage key(@NotNull String key) { + this.key = Objects.requireNonNull(key, "key must not be null"); + return this; + } + + @java.lang.Override + public AdGroupGeoLocationsBodyZipsItemKey build() { + return new AdGroupGeoLocationsBodyZipsItemKey(key, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupMessageAppsItem.java b/src/main/java/com/whop/api/types/AdGroupMessageAppsItem.java new file mode 100644 index 00000000..b75ea450 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupMessageAppsItem.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupMessageAppsItem { + public static final AdGroupMessageAppsItem INSTAGRAM = new AdGroupMessageAppsItem(Value.INSTAGRAM, "instagram"); + + public static final AdGroupMessageAppsItem WHATSAPP = new AdGroupMessageAppsItem(Value.WHATSAPP, "whatsapp"); + + public static final AdGroupMessageAppsItem MESSENGER = new AdGroupMessageAppsItem(Value.MESSENGER, "messenger"); + + private final Value value; + + private final String string; + + AdGroupMessageAppsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupMessageAppsItem + && this.string.equals(((AdGroupMessageAppsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTAGRAM: + return visitor.visitInstagram(); + case WHATSAPP: + return visitor.visitWhatsapp(); + case MESSENGER: + return visitor.visitMessenger(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupMessageAppsItem valueOf(String value) { + switch (value) { + case "instagram": + return INSTAGRAM; + case "whatsapp": + return WHATSAPP; + case "messenger": + return MESSENGER; + default: + return new AdGroupMessageAppsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + MESSENGER, + + INSTAGRAM, + + WHATSAPP, + + UNKNOWN + } + + public interface Visitor { + T visitMessenger(); + + T visitInstagram(); + + T visitWhatsapp(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupOperatingSystem.java b/src/main/java/com/whop/api/types/AdGroupOperatingSystem.java new file mode 100644 index 00000000..9dbbee95 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupOperatingSystem.java @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupOperatingSystem.Builder.class) +public final class AdGroupOperatingSystem { + private final Optional minimumVersion; + + private final AdGroupOperatingSystemOs os; + + private final Map additionalProperties; + + private AdGroupOperatingSystem( + Optional minimumVersion, AdGroupOperatingSystemOs os, Map additionalProperties) { + this.minimumVersion = minimumVersion; + this.os = os; + this.additionalProperties = additionalProperties; + } + + /** + * @return Lowest OS version targeted, such as 18.0. Absent when any version qualifies. + */ + @JsonProperty("minimum_version") + public Optional getMinimumVersion() { + return minimumVersion; + } + + /** + * @return Operating system targeted. + */ + @JsonProperty("os") + public AdGroupOperatingSystemOs getOs() { + return os; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupOperatingSystem && equalTo((AdGroupOperatingSystem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupOperatingSystem other) { + return minimumVersion.equals(other.minimumVersion) && os.equals(other.os); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.minimumVersion, this.os); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static OsStage builder() { + return new Builder(); + } + + public interface OsStage { + /** + *

Operating system targeted.

+ */ + _FinalStage os(@NotNull AdGroupOperatingSystemOs os); + + Builder from(AdGroupOperatingSystem other); + } + + public interface _FinalStage { + AdGroupOperatingSystem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Lowest OS version targeted, such as 18.0. Absent when any version qualifies.

+ */ + _FinalStage minimumVersion(Optional minimumVersion); + + _FinalStage minimumVersion(String minimumVersion); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements OsStage, _FinalStage { + private AdGroupOperatingSystemOs os; + + private Optional minimumVersion = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupOperatingSystem other) { + minimumVersion(other.getMinimumVersion()); + os(other.getOs()); + return this; + } + + /** + *

Operating system targeted.

+ *

Operating system targeted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("os") + public _FinalStage os(@NotNull AdGroupOperatingSystemOs os) { + this.os = Objects.requireNonNull(os, "os must not be null"); + return this; + } + + /** + *

Lowest OS version targeted, such as 18.0. Absent when any version qualifies.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage minimumVersion(String minimumVersion) { + this.minimumVersion = Optional.ofNullable(minimumVersion); + return this; + } + + /** + *

Lowest OS version targeted, such as 18.0. Absent when any version qualifies.

+ */ + @java.lang.Override + @JsonSetter(value = "minimum_version", nulls = Nulls.SKIP) + public _FinalStage minimumVersion(Optional minimumVersion) { + this.minimumVersion = minimumVersion; + return this; + } + + @java.lang.Override + public AdGroupOperatingSystem build() { + return new AdGroupOperatingSystem(minimumVersion, os, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupOperatingSystemOs.java b/src/main/java/com/whop/api/types/AdGroupOperatingSystemOs.java new file mode 100644 index 00000000..3a369b68 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupOperatingSystemOs.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupOperatingSystemOs { + public static final AdGroupOperatingSystemOs IOS = new AdGroupOperatingSystemOs(Value.IOS, "ios"); + + public static final AdGroupOperatingSystemOs ANDROID = new AdGroupOperatingSystemOs(Value.ANDROID, "android"); + + private final Value value; + + private final String string; + + AdGroupOperatingSystemOs(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupOperatingSystemOs + && this.string.equals(((AdGroupOperatingSystemOs) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case IOS: + return visitor.visitIos(); + case ANDROID: + return visitor.visitAndroid(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupOperatingSystemOs valueOf(String value) { + switch (value) { + case "ios": + return IOS; + case "android": + return ANDROID; + default: + return new AdGroupOperatingSystemOs(Value.UNKNOWN, value); + } + } + + public enum Value { + IOS, + + ANDROID, + + UNKNOWN + } + + public interface Visitor { + T visitIos(); + + T visitAndroid(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupOptimizationGoal.java b/src/main/java/com/whop/api/types/AdGroupOptimizationGoal.java new file mode 100644 index 00000000..ab85a22f --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupOptimizationGoal.java @@ -0,0 +1,260 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupOptimizationGoal { + public static final AdGroupOptimizationGoal AD_RECALL_LIFT = + new AdGroupOptimizationGoal(Value.AD_RECALL_LIFT, "ad_recall_lift"); + + public static final AdGroupOptimizationGoal PAGE_LIKES = + new AdGroupOptimizationGoal(Value.PAGE_LIKES, "page_likes"); + + public static final AdGroupOptimizationGoal CONVERSIONS = + new AdGroupOptimizationGoal(Value.CONVERSIONS, "conversions"); + + public static final AdGroupOptimizationGoal LINK_CLICKS = + new AdGroupOptimizationGoal(Value.LINK_CLICKS, "link_clicks"); + + public static final AdGroupOptimizationGoal TWO_SECOND_VIEWS = + new AdGroupOptimizationGoal(Value.TWO_SECOND_VIEWS, "two_second_views"); + + public static final AdGroupOptimizationGoal EVENT_RESPONSES = + new AdGroupOptimizationGoal(Value.EVENT_RESPONSES, "event_responses"); + + public static final AdGroupOptimizationGoal SOCIAL_PROFILE = + new AdGroupOptimizationGoal(Value.SOCIAL_PROFILE, "social_profile"); + + public static final AdGroupOptimizationGoal VIDEO_VIEWS = + new AdGroupOptimizationGoal(Value.VIDEO_VIEWS, "video_views"); + + public static final AdGroupOptimizationGoal VALUE = new AdGroupOptimizationGoal(Value.VALUE, "value"); + + public static final AdGroupOptimizationGoal REACH = new AdGroupOptimizationGoal(Value.REACH, "reach"); + + public static final AdGroupOptimizationGoal LANDING_PAGE_VIEWS = + new AdGroupOptimizationGoal(Value.LANDING_PAGE_VIEWS, "landing_page_views"); + + public static final AdGroupOptimizationGoal PROFILE_AND_PAGE_ENGAGEMENT = + new AdGroupOptimizationGoal(Value.PROFILE_AND_PAGE_ENGAGEMENT, "profile_and_page_engagement"); + + public static final AdGroupOptimizationGoal CONVERSATIONS = + new AdGroupOptimizationGoal(Value.CONVERSATIONS, "conversations"); + + public static final AdGroupOptimizationGoal REMINDERS_SET = + new AdGroupOptimizationGoal(Value.REMINDERS_SET, "reminders_set"); + + public static final AdGroupOptimizationGoal ENGAGEMENT = + new AdGroupOptimizationGoal(Value.ENGAGEMENT, "engagement"); + + public static final AdGroupOptimizationGoal LEAD_GENERATION = + new AdGroupOptimizationGoal(Value.LEAD_GENERATION, "lead_generation"); + + public static final AdGroupOptimizationGoal QUALITY_LEAD = + new AdGroupOptimizationGoal(Value.QUALITY_LEAD, "quality_lead"); + + public static final AdGroupOptimizationGoal IMPRESSIONS = + new AdGroupOptimizationGoal(Value.IMPRESSIONS, "impressions"); + + private final Value value; + + private final String string; + + AdGroupOptimizationGoal(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupOptimizationGoal + && this.string.equals(((AdGroupOptimizationGoal) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AD_RECALL_LIFT: + return visitor.visitAdRecallLift(); + case PAGE_LIKES: + return visitor.visitPageLikes(); + case CONVERSIONS: + return visitor.visitConversions(); + case LINK_CLICKS: + return visitor.visitLinkClicks(); + case TWO_SECOND_VIEWS: + return visitor.visitTwoSecondViews(); + case EVENT_RESPONSES: + return visitor.visitEventResponses(); + case SOCIAL_PROFILE: + return visitor.visitSocialProfile(); + case VIDEO_VIEWS: + return visitor.visitVideoViews(); + case VALUE: + return visitor.visitValue(); + case REACH: + return visitor.visitReach(); + case LANDING_PAGE_VIEWS: + return visitor.visitLandingPageViews(); + case PROFILE_AND_PAGE_ENGAGEMENT: + return visitor.visitProfileAndPageEngagement(); + case CONVERSATIONS: + return visitor.visitConversations(); + case REMINDERS_SET: + return visitor.visitRemindersSet(); + case ENGAGEMENT: + return visitor.visitEngagement(); + case LEAD_GENERATION: + return visitor.visitLeadGeneration(); + case QUALITY_LEAD: + return visitor.visitQualityLead(); + case IMPRESSIONS: + return visitor.visitImpressions(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupOptimizationGoal valueOf(String value) { + switch (value) { + case "ad_recall_lift": + return AD_RECALL_LIFT; + case "page_likes": + return PAGE_LIKES; + case "conversions": + return CONVERSIONS; + case "link_clicks": + return LINK_CLICKS; + case "two_second_views": + return TWO_SECOND_VIEWS; + case "event_responses": + return EVENT_RESPONSES; + case "social_profile": + return SOCIAL_PROFILE; + case "video_views": + return VIDEO_VIEWS; + case "value": + return VALUE; + case "reach": + return REACH; + case "landing_page_views": + return LANDING_PAGE_VIEWS; + case "profile_and_page_engagement": + return PROFILE_AND_PAGE_ENGAGEMENT; + case "conversations": + return CONVERSATIONS; + case "reminders_set": + return REMINDERS_SET; + case "engagement": + return ENGAGEMENT; + case "lead_generation": + return LEAD_GENERATION; + case "quality_lead": + return QUALITY_LEAD; + case "impressions": + return IMPRESSIONS; + default: + return new AdGroupOptimizationGoal(Value.UNKNOWN, value); + } + } + + public enum Value { + CONVERSIONS, + + LINK_CLICKS, + + LANDING_PAGE_VIEWS, + + REACH, + + IMPRESSIONS, + + ENGAGEMENT, + + CONVERSATIONS, + + VIDEO_VIEWS, + + TWO_SECOND_VIEWS, + + PAGE_LIKES, + + SOCIAL_PROFILE, + + AD_RECALL_LIFT, + + EVENT_RESPONSES, + + REMINDERS_SET, + + LEAD_GENERATION, + + QUALITY_LEAD, + + VALUE, + + PROFILE_AND_PAGE_ENGAGEMENT, + + UNKNOWN + } + + public interface Visitor { + T visitConversions(); + + T visitLinkClicks(); + + T visitLandingPageViews(); + + T visitReach(); + + T visitImpressions(); + + T visitEngagement(); + + T visitConversations(); + + T visitVideoViews(); + + T visitTwoSecondViews(); + + T visitPageLikes(); + + T visitSocialProfile(); + + T visitAdRecallLift(); + + T visitEventResponses(); + + T visitRemindersSet(); + + T visitLeadGeneration(); + + T visitQualityLead(); + + T visitValue(); + + T visitProfileAndPageEngagement(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupPlacement.java b/src/main/java/com/whop/api/types/AdGroupPlacement.java new file mode 100644 index 00000000..38a39519 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupPlacement.java @@ -0,0 +1,174 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupPlacement.Builder.class) +public final class AdGroupPlacement { + private final AdGroupPlacementPlatform platform; + + private final List positions; + + private final Map additionalProperties; + + private AdGroupPlacement( + AdGroupPlacementPlatform platform, List positions, Map additionalProperties) { + this.platform = platform; + this.positions = positions; + this.additionalProperties = additionalProperties; + } + + /** + * @return Publisher platform where the ad is eligible to appear. + */ + @JsonProperty("platform") + public AdGroupPlacementPlatform getPlatform() { + return platform; + } + + @JsonProperty("positions") + public List getPositions() { + return positions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupPlacement && equalTo((AdGroupPlacement) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupPlacement other) { + return platform.equals(other.platform) && positions.equals(other.positions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.platform, this.positions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlatformStage builder() { + return new Builder(); + } + + public interface PlatformStage { + /** + *

Publisher platform where the ad is eligible to appear.

+ */ + _FinalStage platform(@NotNull AdGroupPlacementPlatform platform); + + Builder from(AdGroupPlacement other); + } + + public interface _FinalStage { + AdGroupPlacement build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage positions(List positions); + + _FinalStage addPositions(String positions); + + _FinalStage addAllPositions(List positions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlatformStage, _FinalStage { + private AdGroupPlacementPlatform platform; + + private List positions = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupPlacement other) { + platform(other.getPlatform()); + positions(other.getPositions()); + return this; + } + + /** + *

Publisher platform where the ad is eligible to appear.

+ *

Publisher platform where the ad is eligible to appear.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public _FinalStage platform(@NotNull AdGroupPlacementPlatform platform) { + this.platform = Objects.requireNonNull(platform, "platform must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllPositions(List positions) { + if (positions != null) { + this.positions.addAll(positions); + } + return this; + } + + @java.lang.Override + public _FinalStage addPositions(String positions) { + this.positions.add(positions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "positions", nulls = Nulls.SKIP) + public _FinalStage positions(List positions) { + this.positions.clear(); + if (positions != null) { + this.positions.addAll(positions); + } + return this; + } + + @java.lang.Override + public AdGroupPlacement build() { + return new AdGroupPlacement(platform, positions, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupPlacementPlatform.java b/src/main/java/com/whop/api/types/AdGroupPlacementPlatform.java new file mode 100644 index 00000000..6b06acb7 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupPlacementPlatform.java @@ -0,0 +1,125 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupPlacementPlatform { + public static final AdGroupPlacementPlatform INSTAGRAM = new AdGroupPlacementPlatform(Value.INSTAGRAM, "instagram"); + + public static final AdGroupPlacementPlatform FACEBOOK = new AdGroupPlacementPlatform(Value.FACEBOOK, "facebook"); + + public static final AdGroupPlacementPlatform THREADS = new AdGroupPlacementPlatform(Value.THREADS, "threads"); + + public static final AdGroupPlacementPlatform WHATSAPP = new AdGroupPlacementPlatform(Value.WHATSAPP, "whatsapp"); + + public static final AdGroupPlacementPlatform MESSENGER = new AdGroupPlacementPlatform(Value.MESSENGER, "messenger"); + + public static final AdGroupPlacementPlatform AUDIENCE_NETWORK = + new AdGroupPlacementPlatform(Value.AUDIENCE_NETWORK, "audience_network"); + + private final Value value; + + private final String string; + + AdGroupPlacementPlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupPlacementPlatform + && this.string.equals(((AdGroupPlacementPlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTAGRAM: + return visitor.visitInstagram(); + case FACEBOOK: + return visitor.visitFacebook(); + case THREADS: + return visitor.visitThreads(); + case WHATSAPP: + return visitor.visitWhatsapp(); + case MESSENGER: + return visitor.visitMessenger(); + case AUDIENCE_NETWORK: + return visitor.visitAudienceNetwork(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupPlacementPlatform valueOf(String value) { + switch (value) { + case "instagram": + return INSTAGRAM; + case "facebook": + return FACEBOOK; + case "threads": + return THREADS; + case "whatsapp": + return WHATSAPP; + case "messenger": + return MESSENGER; + case "audience_network": + return AUDIENCE_NETWORK; + default: + return new AdGroupPlacementPlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + FACEBOOK, + + INSTAGRAM, + + MESSENGER, + + AUDIENCE_NETWORK, + + THREADS, + + WHATSAPP, + + UNKNOWN + } + + public interface Visitor { + T visitFacebook(); + + T visitInstagram(); + + T visitMessenger(); + + T visitAudienceNetwork(); + + T visitThreads(); + + T visitWhatsapp(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupRegions.java b/src/main/java/com/whop/api/types/AdGroupRegions.java new file mode 100644 index 00000000..fafbfade --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupRegions.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupRegions.Builder.class) +public final class AdGroupRegions { + private final AdGroupGeoLocations exclude; + + private final AdGroupGeoLocations include; + + private final Map additionalProperties; + + private AdGroupRegions( + AdGroupGeoLocations exclude, AdGroupGeoLocations include, Map additionalProperties) { + this.exclude = exclude; + this.include = include; + this.additionalProperties = additionalProperties; + } + + /** + * @return Locations excluded from targeting. Country groups can't be excluded. + */ + @JsonProperty("exclude") + public AdGroupGeoLocations getExclude() { + return exclude; + } + + /** + * @return Locations the ad group targets. + */ + @JsonProperty("include") + public AdGroupGeoLocations getInclude() { + return include; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupRegions && equalTo((AdGroupRegions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupRegions other) { + return exclude.equals(other.exclude) && include.equals(other.include); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.exclude, this.include); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExcludeStage builder() { + return new Builder(); + } + + public interface ExcludeStage { + /** + *

Locations excluded from targeting. Country groups can't be excluded.

+ */ + IncludeStage exclude(@NotNull AdGroupGeoLocations exclude); + + Builder from(AdGroupRegions other); + } + + public interface IncludeStage { + /** + *

Locations the ad group targets.

+ */ + _FinalStage include(@NotNull AdGroupGeoLocations include); + } + + public interface _FinalStage { + AdGroupRegions build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExcludeStage, IncludeStage, _FinalStage { + private AdGroupGeoLocations exclude; + + private AdGroupGeoLocations include; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupRegions other) { + exclude(other.getExclude()); + include(other.getInclude()); + return this; + } + + /** + *

Locations excluded from targeting. Country groups can't be excluded.

+ *

Locations excluded from targeting. Country groups can't be excluded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("exclude") + public IncludeStage exclude(@NotNull AdGroupGeoLocations exclude) { + this.exclude = Objects.requireNonNull(exclude, "exclude must not be null"); + return this; + } + + /** + *

Locations the ad group targets.

+ *

Locations the ad group targets.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("include") + public _FinalStage include(@NotNull AdGroupGeoLocations include) { + this.include = Objects.requireNonNull(include, "include must not be null"); + return this; + } + + @java.lang.Override + public AdGroupRegions build() { + return new AdGroupRegions(exclude, include, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupRegionsBody.java b/src/main/java/com/whop/api/types/AdGroupRegionsBody.java new file mode 100644 index 00000000..88a8fdc7 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupRegionsBody.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupRegionsBody.Builder.class) +public final class AdGroupRegionsBody { + private final Optional exclude; + + private final Optional include; + + private final Map additionalProperties; + + private AdGroupRegionsBody( + Optional exclude, + Optional include, + Map additionalProperties) { + this.exclude = exclude; + this.include = include; + this.additionalProperties = additionalProperties; + } + + /** + * @return Locations excluded from targeting. Country groups can't be excluded. + */ + @JsonProperty("exclude") + public Optional getExclude() { + return exclude; + } + + /** + * @return Locations the ad group targets. + */ + @JsonProperty("include") + public Optional getInclude() { + return include; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupRegionsBody && equalTo((AdGroupRegionsBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupRegionsBody other) { + return exclude.equals(other.exclude) && include.equals(other.include); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.exclude, this.include); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional exclude = Optional.empty(); + + private Optional include = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdGroupRegionsBody other) { + exclude(other.getExclude()); + include(other.getInclude()); + return this; + } + + /** + *

Locations excluded from targeting. Country groups can't be excluded.

+ */ + @JsonSetter(value = "exclude", nulls = Nulls.SKIP) + public Builder exclude(Optional exclude) { + this.exclude = exclude; + return this; + } + + public Builder exclude(AdGroupGeoLocationsBody exclude) { + this.exclude = Optional.ofNullable(exclude); + return this; + } + + /** + *

Locations the ad group targets.

+ */ + @JsonSetter(value = "include", nulls = Nulls.SKIP) + public Builder include(Optional include) { + this.include = include; + return this; + } + + public Builder include(AdGroupGeoLocationsBody include) { + this.include = Optional.ofNullable(include); + return this; + } + + public AdGroupRegionsBody build() { + return new AdGroupRegionsBody(exclude, include, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupResultEvent.java b/src/main/java/com/whop/api/types/AdGroupResultEvent.java new file mode 100644 index 00000000..cdaf9125 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupResultEvent.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupResultEvent { + public static final AdGroupResultEvent PURCHASE = new AdGroupResultEvent(Value.PURCHASE, "purchase"); + + public static final AdGroupResultEvent SUBMIT_APPLICATION = + new AdGroupResultEvent(Value.SUBMIT_APPLICATION, "submit_application"); + + public static final AdGroupResultEvent SCHEDULE = new AdGroupResultEvent(Value.SCHEDULE, "schedule"); + + public static final AdGroupResultEvent COMPLETE_REGISTRATION = + new AdGroupResultEvent(Value.COMPLETE_REGISTRATION, "complete_registration"); + + public static final AdGroupResultEvent ADD_TO_CART = new AdGroupResultEvent(Value.ADD_TO_CART, "add_to_cart"); + + public static final AdGroupResultEvent CUSTOM = new AdGroupResultEvent(Value.CUSTOM, "custom"); + + public static final AdGroupResultEvent CONTACT = new AdGroupResultEvent(Value.CONTACT, "contact"); + + public static final AdGroupResultEvent MESSAGING_CONVERSATION = + new AdGroupResultEvent(Value.MESSAGING_CONVERSATION, "messaging_conversation"); + + public static final AdGroupResultEvent VIEW_CONTENT = new AdGroupResultEvent(Value.VIEW_CONTENT, "view_content"); + + public static final AdGroupResultEvent LEAD = new AdGroupResultEvent(Value.LEAD, "lead"); + + private final Value value; + + private final String string; + + AdGroupResultEvent(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupResultEvent && this.string.equals(((AdGroupResultEvent) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PURCHASE: + return visitor.visitPurchase(); + case SUBMIT_APPLICATION: + return visitor.visitSubmitApplication(); + case SCHEDULE: + return visitor.visitSchedule(); + case COMPLETE_REGISTRATION: + return visitor.visitCompleteRegistration(); + case ADD_TO_CART: + return visitor.visitAddToCart(); + case CUSTOM: + return visitor.visitCustom(); + case CONTACT: + return visitor.visitContact(); + case MESSAGING_CONVERSATION: + return visitor.visitMessagingConversation(); + case VIEW_CONTENT: + return visitor.visitViewContent(); + case LEAD: + return visitor.visitLead(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupResultEvent valueOf(String value) { + switch (value) { + case "purchase": + return PURCHASE; + case "submit_application": + return SUBMIT_APPLICATION; + case "schedule": + return SCHEDULE; + case "complete_registration": + return COMPLETE_REGISTRATION; + case "add_to_cart": + return ADD_TO_CART; + case "custom": + return CUSTOM; + case "contact": + return CONTACT; + case "messaging_conversation": + return MESSAGING_CONVERSATION; + case "view_content": + return VIEW_CONTENT; + case "lead": + return LEAD; + default: + return new AdGroupResultEvent(Value.UNKNOWN, value); + } + } + + public enum Value { + PURCHASE, + + LEAD, + + SCHEDULE, + + SUBMIT_APPLICATION, + + CONTACT, + + COMPLETE_REGISTRATION, + + VIEW_CONTENT, + + ADD_TO_CART, + + CUSTOM, + + MESSAGING_CONVERSATION, + + UNKNOWN + } + + public interface Visitor { + T visitPurchase(); + + T visitLead(); + + T visitSchedule(); + + T visitSubmitApplication(); + + T visitContact(); + + T visitCompleteRegistration(); + + T visitViewContent(); + + T visitAddToCart(); + + T visitCustom(); + + T visitMessagingConversation(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupStatus.java b/src/main/java/com/whop/api/types/AdGroupStatus.java new file mode 100644 index 00000000..18b45f7c --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupStatus.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdGroupStatus { + public static final AdGroupStatus DUPLICATING = new AdGroupStatus(Value.DUPLICATING, "duplicating"); + + public static final AdGroupStatus PAUSED = new AdGroupStatus(Value.PAUSED, "paused"); + + public static final AdGroupStatus REJECTED = new AdGroupStatus(Value.REJECTED, "rejected"); + + public static final AdGroupStatus ACTIVE = new AdGroupStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AdGroupStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdGroupStatus && this.string.equals(((AdGroupStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DUPLICATING: + return visitor.visitDuplicating(); + case PAUSED: + return visitor.visitPaused(); + case REJECTED: + return visitor.visitRejected(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdGroupStatus valueOf(String value) { + switch (value) { + case "duplicating": + return DUPLICATING; + case "paused": + return PAUSED; + case "rejected": + return REJECTED; + case "active": + return ACTIVE; + default: + return new AdGroupStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + PAUSED, + + REJECTED, + + DUPLICATING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitPaused(); + + T visitRejected(); + + T visitDuplicating(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdGroupTargetingCategory.java b/src/main/java/com/whop/api/types/AdGroupTargetingCategory.java new file mode 100644 index 00000000..03514bd6 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdGroupTargetingCategory.java @@ -0,0 +1,172 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdGroupTargetingCategory.Builder.class) +public final class AdGroupTargetingCategory { + private final String id; + + private final Optional name; + + private final Map additionalProperties; + + private AdGroupTargetingCategory(String id, Optional name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ad platform's ID for the category in its targeting taxonomy. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Category name, such as Movies. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdGroupTargetingCategory && equalTo((AdGroupTargetingCategory) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdGroupTargetingCategory other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ad platform's ID for the category in its targeting taxonomy.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(AdGroupTargetingCategory other); + } + + public interface _FinalStage { + AdGroupTargetingCategory build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Category name, such as Movies.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdGroupTargetingCategory other) { + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

The ad platform's ID for the category in its targeting taxonomy.

+ *

The ad platform's ID for the category in its targeting taxonomy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Category name, such as Movies.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Category name, such as Movies.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public AdGroupTargetingCategory build() { + return new AdGroupTargetingCategory(id, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdLeadForm.java b/src/main/java/com/whop/api/types/AdLeadForm.java new file mode 100644 index 00000000..74c028b1 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdLeadForm.java @@ -0,0 +1,583 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdLeadForm.Builder.class) +public final class AdLeadForm { + private final Optional completion; + + private final Optional disclaimer; + + private final AdLeadFormFormType formType; + + private final Optional intro; + + private final Optional name; + + private final boolean phoneVerification; + + private final Optional privacyPolicy; + + private final List questions; + + private final Map additionalProperties; + + private AdLeadForm( + Optional completion, + Optional disclaimer, + AdLeadFormFormType formType, + Optional intro, + Optional name, + boolean phoneVerification, + Optional privacyPolicy, + List questions, + Map additionalProperties) { + this.completion = completion; + this.disclaimer = disclaimer; + this.formType = formType; + this.intro = intro; + this.name = name; + this.phoneVerification = phoneVerification; + this.privacyPolicy = privacyPolicy; + this.questions = questions; + this.additionalProperties = additionalProperties; + } + + /** + * @return Screen shown after the form is submitted. null when the form uses the default. + */ + @JsonIgnore + public Optional getCompletion() { + if (completion == null) { + return Optional.empty(); + } + return completion; + } + + /** + * @return Custom consent disclaimer shown before submission. null when the form has none. + */ + @JsonIgnore + public Optional getDisclaimer() { + if (disclaimer == null) { + return Optional.empty(); + } + return disclaimer; + } + + /** + * @return more_volume is quickest to submit; higher_intent adds a confirmation step before submission. + */ + @JsonProperty("form_type") + public AdLeadFormFormType getFormType() { + return formType; + } + + /** + * @return Intro screen shown before the questions. null when the form has none. + */ + @JsonIgnore + public Optional getIntro() { + if (intro == null) { + return Optional.empty(); + } + return intro; + } + + /** + * @return Internal name of the form. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return Whether the phone number must be verified by SMS before submitting. + */ + @JsonProperty("phone_verification") + public boolean getPhoneVerification() { + return phoneVerification; + } + + /** + * @return Your privacy policy, linked from the form. null when unset. + */ + @JsonIgnore + public Optional getPrivacyPolicy() { + if (privacyPolicy == null) { + return Optional.empty(); + } + return privacyPolicy; + } + + @JsonProperty("questions") + public List getQuestions() { + return questions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("completion") + private Optional _getCompletion() { + return completion; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("disclaimer") + private Optional _getDisclaimer() { + return disclaimer; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("intro") + private Optional _getIntro() { + return intro; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("privacy_policy") + private Optional _getPrivacyPolicy() { + return privacyPolicy; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdLeadForm && equalTo((AdLeadForm) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdLeadForm other) { + return completion.equals(other.completion) + && disclaimer.equals(other.disclaimer) + && formType.equals(other.formType) + && intro.equals(other.intro) + && name.equals(other.name) + && phoneVerification == other.phoneVerification + && privacyPolicy.equals(other.privacyPolicy) + && questions.equals(other.questions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.completion, + this.disclaimer, + this.formType, + this.intro, + this.name, + this.phoneVerification, + this.privacyPolicy, + this.questions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FormTypeStage builder() { + return new Builder(); + } + + public interface FormTypeStage { + /** + *

more_volume is quickest to submit; higher_intent adds a confirmation step before submission.

+ */ + PhoneVerificationStage formType(@NotNull AdLeadFormFormType formType); + + Builder from(AdLeadForm other); + } + + public interface PhoneVerificationStage { + /** + *

Whether the phone number must be verified by SMS before submitting.

+ */ + _FinalStage phoneVerification(boolean phoneVerification); + } + + public interface _FinalStage { + AdLeadForm build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Screen shown after the form is submitted. null when the form uses the default.

+ */ + _FinalStage completion(Optional completion); + + _FinalStage completion(AdLeadFormCompletion completion); + + _FinalStage completion(Nullable completion); + + /** + *

Custom consent disclaimer shown before submission. null when the form has none.

+ */ + _FinalStage disclaimer(Optional disclaimer); + + _FinalStage disclaimer(AdLeadFormDisclaimer disclaimer); + + _FinalStage disclaimer(Nullable disclaimer); + + /** + *

Intro screen shown before the questions. null when the form has none.

+ */ + _FinalStage intro(Optional intro); + + _FinalStage intro(AdLeadFormIntro intro); + + _FinalStage intro(Nullable intro); + + /** + *

Internal name of the form.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

Your privacy policy, linked from the form. null when unset.

+ */ + _FinalStage privacyPolicy(Optional privacyPolicy); + + _FinalStage privacyPolicy(AdLeadFormPrivacyPolicy privacyPolicy); + + _FinalStage privacyPolicy(Nullable privacyPolicy); + + _FinalStage questions(List questions); + + _FinalStage addQuestions(AdLeadFormQuestion questions); + + _FinalStage addAllQuestions(List questions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FormTypeStage, PhoneVerificationStage, _FinalStage { + private AdLeadFormFormType formType; + + private boolean phoneVerification; + + private List questions = new ArrayList<>(); + + private Optional privacyPolicy = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional intro = Optional.empty(); + + private Optional disclaimer = Optional.empty(); + + private Optional completion = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdLeadForm other) { + completion(other.getCompletion()); + disclaimer(other.getDisclaimer()); + formType(other.getFormType()); + intro(other.getIntro()); + name(other.getName()); + phoneVerification(other.getPhoneVerification()); + privacyPolicy(other.getPrivacyPolicy()); + questions(other.getQuestions()); + return this; + } + + /** + *

more_volume is quickest to submit; higher_intent adds a confirmation step before submission.

+ *

more_volume is quickest to submit; higher_intent adds a confirmation step before submission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("form_type") + public PhoneVerificationStage formType(@NotNull AdLeadFormFormType formType) { + this.formType = Objects.requireNonNull(formType, "formType must not be null"); + return this; + } + + /** + *

Whether the phone number must be verified by SMS before submitting.

+ *

Whether the phone number must be verified by SMS before submitting.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("phone_verification") + public _FinalStage phoneVerification(boolean phoneVerification) { + this.phoneVerification = phoneVerification; + return this; + } + + @java.lang.Override + public _FinalStage addAllQuestions(List questions) { + if (questions != null) { + this.questions.addAll(questions); + } + return this; + } + + @java.lang.Override + public _FinalStage addQuestions(AdLeadFormQuestion questions) { + this.questions.add(questions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "questions", nulls = Nulls.SKIP) + public _FinalStage questions(List questions) { + this.questions.clear(); + if (questions != null) { + this.questions.addAll(questions); + } + return this; + } + + /** + *

Your privacy policy, linked from the form. null when unset.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage privacyPolicy(Nullable privacyPolicy) { + if (privacyPolicy.isNull()) { + this.privacyPolicy = null; + } else if (privacyPolicy.isEmpty()) { + this.privacyPolicy = Optional.empty(); + } else { + this.privacyPolicy = Optional.of(privacyPolicy.get()); + } + return this; + } + + /** + *

Your privacy policy, linked from the form. null when unset.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage privacyPolicy(AdLeadFormPrivacyPolicy privacyPolicy) { + this.privacyPolicy = Optional.ofNullable(privacyPolicy); + return this; + } + + /** + *

Your privacy policy, linked from the form. null when unset.

+ */ + @java.lang.Override + @JsonSetter(value = "privacy_policy", nulls = Nulls.SKIP) + public _FinalStage privacyPolicy(Optional privacyPolicy) { + this.privacyPolicy = privacyPolicy; + return this; + } + + /** + *

Internal name of the form.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Internal name of the form.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Internal name of the form.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

Intro screen shown before the questions. null when the form has none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage intro(Nullable intro) { + if (intro.isNull()) { + this.intro = null; + } else if (intro.isEmpty()) { + this.intro = Optional.empty(); + } else { + this.intro = Optional.of(intro.get()); + } + return this; + } + + /** + *

Intro screen shown before the questions. null when the form has none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage intro(AdLeadFormIntro intro) { + this.intro = Optional.ofNullable(intro); + return this; + } + + /** + *

Intro screen shown before the questions. null when the form has none.

+ */ + @java.lang.Override + @JsonSetter(value = "intro", nulls = Nulls.SKIP) + public _FinalStage intro(Optional intro) { + this.intro = intro; + return this; + } + + /** + *

Custom consent disclaimer shown before submission. null when the form has none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disclaimer(Nullable disclaimer) { + if (disclaimer.isNull()) { + this.disclaimer = null; + } else if (disclaimer.isEmpty()) { + this.disclaimer = Optional.empty(); + } else { + this.disclaimer = Optional.of(disclaimer.get()); + } + return this; + } + + /** + *

Custom consent disclaimer shown before submission. null when the form has none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disclaimer(AdLeadFormDisclaimer disclaimer) { + this.disclaimer = Optional.ofNullable(disclaimer); + return this; + } + + /** + *

Custom consent disclaimer shown before submission. null when the form has none.

+ */ + @java.lang.Override + @JsonSetter(value = "disclaimer", nulls = Nulls.SKIP) + public _FinalStage disclaimer(Optional disclaimer) { + this.disclaimer = disclaimer; + return this; + } + + /** + *

Screen shown after the form is submitted. null when the form uses the default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage completion(Nullable completion) { + if (completion.isNull()) { + this.completion = null; + } else if (completion.isEmpty()) { + this.completion = Optional.empty(); + } else { + this.completion = Optional.of(completion.get()); + } + return this; + } + + /** + *

Screen shown after the form is submitted. null when the form uses the default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage completion(AdLeadFormCompletion completion) { + this.completion = Optional.ofNullable(completion); + return this; + } + + /** + *

Screen shown after the form is submitted. null when the form uses the default.

+ */ + @java.lang.Override + @JsonSetter(value = "completion", nulls = Nulls.SKIP) + public _FinalStage completion(Optional completion) { + this.completion = completion; + return this; + } + + @java.lang.Override + public AdLeadForm build() { + return new AdLeadForm( + completion, + disclaimer, + formType, + intro, + name, + phoneVerification, + privacyPolicy, + questions, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdLeadFormCompletion.java b/src/main/java/com/whop/api/types/AdLeadFormCompletion.java new file mode 100644 index 00000000..098d4cd5 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdLeadFormCompletion.java @@ -0,0 +1,286 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdLeadFormCompletion.Builder.class) +public final class AdLeadFormCompletion { + private final Optional buttonText; + + private final Optional description; + + private final Optional headline; + + private final Optional url; + + private final Map additionalProperties; + + private AdLeadFormCompletion( + Optional buttonText, + Optional description, + Optional headline, + Optional url, + Map additionalProperties) { + this.buttonText = buttonText; + this.description = description; + this.headline = headline; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Text of the follow-up button. + */ + @JsonIgnore + public Optional getButtonText() { + if (buttonText == null) { + return Optional.empty(); + } + return buttonText; + } + + /** + * @return Body text under the headline. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return Headline of the completion screen. + */ + @JsonIgnore + public Optional getHeadline() { + if (headline == null) { + return Optional.empty(); + } + return headline; + } + + /** + * @return Website the follow-up button opens. null when the screen has no button. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("button_text") + private Optional _getButtonText() { + return buttonText; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("headline") + private Optional _getHeadline() { + return headline; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdLeadFormCompletion && equalTo((AdLeadFormCompletion) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdLeadFormCompletion other) { + return buttonText.equals(other.buttonText) + && description.equals(other.description) + && headline.equals(other.headline) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.buttonText, this.description, this.headline, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional buttonText = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional headline = Optional.empty(); + + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdLeadFormCompletion other) { + buttonText(other.getButtonText()); + description(other.getDescription()); + headline(other.getHeadline()); + url(other.getUrl()); + return this; + } + + /** + *

Text of the follow-up button.

+ */ + @JsonSetter(value = "button_text", nulls = Nulls.SKIP) + public Builder buttonText(Optional buttonText) { + this.buttonText = buttonText; + return this; + } + + public Builder buttonText(String buttonText) { + this.buttonText = Optional.ofNullable(buttonText); + return this; + } + + public Builder buttonText(Nullable buttonText) { + if (buttonText.isNull()) { + this.buttonText = null; + } else if (buttonText.isEmpty()) { + this.buttonText = Optional.empty(); + } else { + this.buttonText = Optional.of(buttonText.get()); + } + return this; + } + + /** + *

Body text under the headline.

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public Builder description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

Headline of the completion screen.

+ */ + @JsonSetter(value = "headline", nulls = Nulls.SKIP) + public Builder headline(Optional headline) { + this.headline = headline; + return this; + } + + public Builder headline(String headline) { + this.headline = Optional.ofNullable(headline); + return this; + } + + public Builder headline(Nullable headline) { + if (headline.isNull()) { + this.headline = null; + } else if (headline.isEmpty()) { + this.headline = Optional.empty(); + } else { + this.headline = Optional.of(headline.get()); + } + return this; + } + + /** + *

Website the follow-up button opens. null when the screen has no button.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public Builder url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + public AdLeadFormCompletion build() { + return new AdLeadFormCompletion(buttonText, description, headline, url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdLeadFormDisclaimer.java b/src/main/java/com/whop/api/types/AdLeadFormDisclaimer.java new file mode 100644 index 00000000..cdcf2917 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdLeadFormDisclaimer.java @@ -0,0 +1,220 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdLeadFormDisclaimer.Builder.class) +public final class AdLeadFormDisclaimer { + private final Optional body; + + private final List checkboxes; + + private final Optional title; + + private final Map additionalProperties; + + private AdLeadFormDisclaimer( + Optional body, + List checkboxes, + Optional title, + Map additionalProperties) { + this.body = body; + this.checkboxes = checkboxes; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Disclaimer text. + */ + @JsonIgnore + public Optional getBody() { + if (body == null) { + return Optional.empty(); + } + return body; + } + + @JsonProperty("checkboxes") + public List getCheckboxes() { + return checkboxes; + } + + /** + * @return Disclaimer title. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("body") + private Optional _getBody() { + return body; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdLeadFormDisclaimer && equalTo((AdLeadFormDisclaimer) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdLeadFormDisclaimer other) { + return body.equals(other.body) && checkboxes.equals(other.checkboxes) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.body, this.checkboxes, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional body = Optional.empty(); + + private List checkboxes = new ArrayList<>(); + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdLeadFormDisclaimer other) { + body(other.getBody()); + checkboxes(other.getCheckboxes()); + title(other.getTitle()); + return this; + } + + /** + *

Disclaimer text.

+ */ + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public Builder body(Optional body) { + this.body = body; + return this; + } + + public Builder body(String body) { + this.body = Optional.ofNullable(body); + return this; + } + + public Builder body(Nullable body) { + if (body.isNull()) { + this.body = null; + } else if (body.isEmpty()) { + this.body = Optional.empty(); + } else { + this.body = Optional.of(body.get()); + } + return this; + } + + @JsonSetter(value = "checkboxes", nulls = Nulls.SKIP) + public Builder checkboxes(List checkboxes) { + this.checkboxes.clear(); + if (checkboxes != null) { + this.checkboxes.addAll(checkboxes); + } + return this; + } + + public Builder addCheckboxes(AdLeadFormDisclaimerCheckbox checkboxes) { + this.checkboxes.add(checkboxes); + return this; + } + + public Builder addAllCheckboxes(List checkboxes) { + if (checkboxes != null) { + this.checkboxes.addAll(checkboxes); + } + return this; + } + + /** + *

Disclaimer title.

+ */ + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public Builder title(Optional title) { + this.title = title; + return this; + } + + public Builder title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + public Builder title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + public AdLeadFormDisclaimer build() { + return new AdLeadFormDisclaimer(body, checkboxes, title, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdLeadFormDisclaimerCheckbox.java b/src/main/java/com/whop/api/types/AdLeadFormDisclaimerCheckbox.java new file mode 100644 index 00000000..7488ff35 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdLeadFormDisclaimerCheckbox.java @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdLeadFormDisclaimerCheckbox.Builder.class) +public final class AdLeadFormDisclaimerCheckbox { + private final Optional checkedByDefault; + + private final Optional key; + + private final Optional required; + + private final String text; + + private final Map additionalProperties; + + private AdLeadFormDisclaimerCheckbox( + Optional checkedByDefault, + Optional key, + Optional required, + String text, + Map additionalProperties) { + this.checkedByDefault = checkedByDefault; + this.key = key; + this.required = required; + this.text = text; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the checkbox starts ticked. + */ + @JsonIgnore + public Optional getCheckedByDefault() { + if (checkedByDefault == null) { + return Optional.empty(); + } + return checkedByDefault; + } + + /** + * @return Stable identifier consent responses are stored under. + */ + @JsonIgnore + public Optional getKey() { + if (key == null) { + return Optional.empty(); + } + return key; + } + + /** + * @return Whether the checkbox must be ticked to submit the form. + */ + @JsonIgnore + public Optional getRequired() { + if (required == null) { + return Optional.empty(); + } + return required; + } + + /** + * @return Consent text next to the checkbox. + */ + @JsonProperty("text") + public String getText() { + return text; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checked_by_default") + private Optional _getCheckedByDefault() { + return checkedByDefault; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("key") + private Optional _getKey() { + return key; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("required") + private Optional _getRequired() { + return required; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdLeadFormDisclaimerCheckbox && equalTo((AdLeadFormDisclaimerCheckbox) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdLeadFormDisclaimerCheckbox other) { + return checkedByDefault.equals(other.checkedByDefault) + && key.equals(other.key) + && required.equals(other.required) + && text.equals(other.text); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.checkedByDefault, this.key, this.required, this.text); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TextStage builder() { + return new Builder(); + } + + public interface TextStage { + /** + *

Consent text next to the checkbox.

+ */ + _FinalStage text(@NotNull String text); + + Builder from(AdLeadFormDisclaimerCheckbox other); + } + + public interface _FinalStage { + AdLeadFormDisclaimerCheckbox build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Whether the checkbox starts ticked.

+ */ + _FinalStage checkedByDefault(Optional checkedByDefault); + + _FinalStage checkedByDefault(Boolean checkedByDefault); + + _FinalStage checkedByDefault(Nullable checkedByDefault); + + /** + *

Stable identifier consent responses are stored under.

+ */ + _FinalStage key(Optional key); + + _FinalStage key(String key); + + _FinalStage key(Nullable key); + + /** + *

Whether the checkbox must be ticked to submit the form.

+ */ + _FinalStage required(Optional required); + + _FinalStage required(Boolean required); + + _FinalStage required(Nullable required); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TextStage, _FinalStage { + private String text; + + private Optional required = Optional.empty(); + + private Optional key = Optional.empty(); + + private Optional checkedByDefault = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdLeadFormDisclaimerCheckbox other) { + checkedByDefault(other.getCheckedByDefault()); + key(other.getKey()); + required(other.getRequired()); + text(other.getText()); + return this; + } + + /** + *

Consent text next to the checkbox.

+ *

Consent text next to the checkbox.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("text") + public _FinalStage text(@NotNull String text) { + this.text = Objects.requireNonNull(text, "text must not be null"); + return this; + } + + /** + *

Whether the checkbox must be ticked to submit the form.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage required(Nullable required) { + if (required.isNull()) { + this.required = null; + } else if (required.isEmpty()) { + this.required = Optional.empty(); + } else { + this.required = Optional.of(required.get()); + } + return this; + } + + /** + *

Whether the checkbox must be ticked to submit the form.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage required(Boolean required) { + this.required = Optional.ofNullable(required); + return this; + } + + /** + *

Whether the checkbox must be ticked to submit the form.

+ */ + @java.lang.Override + @JsonSetter(value = "required", nulls = Nulls.SKIP) + public _FinalStage required(Optional required) { + this.required = required; + return this; + } + + /** + *

Stable identifier consent responses are stored under.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage key(Nullable key) { + if (key.isNull()) { + this.key = null; + } else if (key.isEmpty()) { + this.key = Optional.empty(); + } else { + this.key = Optional.of(key.get()); + } + return this; + } + + /** + *

Stable identifier consent responses are stored under.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage key(String key) { + this.key = Optional.ofNullable(key); + return this; + } + + /** + *

Stable identifier consent responses are stored under.

+ */ + @java.lang.Override + @JsonSetter(value = "key", nulls = Nulls.SKIP) + public _FinalStage key(Optional key) { + this.key = key; + return this; + } + + /** + *

Whether the checkbox starts ticked.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkedByDefault(Nullable checkedByDefault) { + if (checkedByDefault.isNull()) { + this.checkedByDefault = null; + } else if (checkedByDefault.isEmpty()) { + this.checkedByDefault = Optional.empty(); + } else { + this.checkedByDefault = Optional.of(checkedByDefault.get()); + } + return this; + } + + /** + *

Whether the checkbox starts ticked.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkedByDefault(Boolean checkedByDefault) { + this.checkedByDefault = Optional.ofNullable(checkedByDefault); + return this; + } + + /** + *

Whether the checkbox starts ticked.

+ */ + @java.lang.Override + @JsonSetter(value = "checked_by_default", nulls = Nulls.SKIP) + public _FinalStage checkedByDefault(Optional checkedByDefault) { + this.checkedByDefault = checkedByDefault; + return this; + } + + @java.lang.Override + public AdLeadFormDisclaimerCheckbox build() { + return new AdLeadFormDisclaimerCheckbox(checkedByDefault, key, required, text, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdLeadFormFormType.java b/src/main/java/com/whop/api/types/AdLeadFormFormType.java new file mode 100644 index 00000000..5858b3a8 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdLeadFormFormType.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdLeadFormFormType { + public static final AdLeadFormFormType HIGHER_INTENT = new AdLeadFormFormType(Value.HIGHER_INTENT, "higher_intent"); + + public static final AdLeadFormFormType MORE_VOLUME = new AdLeadFormFormType(Value.MORE_VOLUME, "more_volume"); + + private final Value value; + + private final String string; + + AdLeadFormFormType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdLeadFormFormType && this.string.equals(((AdLeadFormFormType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HIGHER_INTENT: + return visitor.visitHigherIntent(); + case MORE_VOLUME: + return visitor.visitMoreVolume(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdLeadFormFormType valueOf(String value) { + switch (value) { + case "higher_intent": + return HIGHER_INTENT; + case "more_volume": + return MORE_VOLUME; + default: + return new AdLeadFormFormType(Value.UNKNOWN, value); + } + } + + public enum Value { + MORE_VOLUME, + + HIGHER_INTENT, + + UNKNOWN + } + + public interface Visitor { + T visitMoreVolume(); + + T visitHigherIntent(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdLeadFormIntro.java b/src/main/java/com/whop/api/types/AdLeadFormIntro.java new file mode 100644 index 00000000..8b3f63c9 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdLeadFormIntro.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdLeadFormIntro.Builder.class) +public final class AdLeadFormIntro { + private final Optional description; + + private final Optional headline; + + private final Map additionalProperties; + + private AdLeadFormIntro( + Optional description, Optional headline, Map additionalProperties) { + this.description = description; + this.headline = headline; + this.additionalProperties = additionalProperties; + } + + /** + * @return Body text under the headline. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return Headline of the intro screen. + */ + @JsonIgnore + public Optional getHeadline() { + if (headline == null) { + return Optional.empty(); + } + return headline; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("headline") + private Optional _getHeadline() { + return headline; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdLeadFormIntro && equalTo((AdLeadFormIntro) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdLeadFormIntro other) { + return description.equals(other.description) && headline.equals(other.headline); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.description, this.headline); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional description = Optional.empty(); + + private Optional headline = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdLeadFormIntro other) { + description(other.getDescription()); + headline(other.getHeadline()); + return this; + } + + /** + *

Body text under the headline.

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public Builder description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

Headline of the intro screen.

+ */ + @JsonSetter(value = "headline", nulls = Nulls.SKIP) + public Builder headline(Optional headline) { + this.headline = headline; + return this; + } + + public Builder headline(String headline) { + this.headline = Optional.ofNullable(headline); + return this; + } + + public Builder headline(Nullable headline) { + if (headline.isNull()) { + this.headline = null; + } else if (headline.isEmpty()) { + this.headline = Optional.empty(); + } else { + this.headline = Optional.of(headline.get()); + } + return this; + } + + public AdLeadFormIntro build() { + return new AdLeadFormIntro(description, headline, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdLeadFormOptionLogic.java b/src/main/java/com/whop/api/types/AdLeadFormOptionLogic.java new file mode 100644 index 00000000..9d0dd53c --- /dev/null +++ b/src/main/java/com/whop/api/types/AdLeadFormOptionLogic.java @@ -0,0 +1,219 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdLeadFormOptionLogic.Builder.class) +public final class AdLeadFormOptionLogic { + private final AdLeadFormOptionLogicAction action; + + private final Optional targetEndPageIndex; + + private final Optional targetQuestionIndex; + + private final Map additionalProperties; + + private AdLeadFormOptionLogic( + AdLeadFormOptionLogicAction action, + Optional targetEndPageIndex, + Optional targetQuestionIndex, + Map additionalProperties) { + this.action = action; + this.targetEndPageIndex = targetEndPageIndex; + this.targetQuestionIndex = targetQuestionIndex; + this.additionalProperties = additionalProperties; + } + + /** + * @return What happens when the choice is selected. + */ + @JsonProperty("action") + public AdLeadFormOptionLogicAction getAction() { + return action; + } + + /** + * @return Zero-based index of the ending screen to jump to. + */ + @JsonProperty("target_end_page_index") + public Optional getTargetEndPageIndex() { + return targetEndPageIndex; + } + + /** + * @return Zero-based index of the question to jump to, for go_to_question. + */ + @JsonProperty("target_question_index") + public Optional getTargetQuestionIndex() { + return targetQuestionIndex; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdLeadFormOptionLogic && equalTo((AdLeadFormOptionLogic) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdLeadFormOptionLogic other) { + return action.equals(other.action) + && targetEndPageIndex.equals(other.targetEndPageIndex) + && targetQuestionIndex.equals(other.targetQuestionIndex); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.action, this.targetEndPageIndex, this.targetQuestionIndex); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + /** + *

What happens when the choice is selected.

+ */ + _FinalStage action(@NotNull AdLeadFormOptionLogicAction action); + + Builder from(AdLeadFormOptionLogic other); + } + + public interface _FinalStage { + AdLeadFormOptionLogic build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Zero-based index of the ending screen to jump to.

+ */ + _FinalStage targetEndPageIndex(Optional targetEndPageIndex); + + _FinalStage targetEndPageIndex(Double targetEndPageIndex); + + /** + *

Zero-based index of the question to jump to, for go_to_question.

+ */ + _FinalStage targetQuestionIndex(Optional targetQuestionIndex); + + _FinalStage targetQuestionIndex(Double targetQuestionIndex); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ActionStage, _FinalStage { + private AdLeadFormOptionLogicAction action; + + private Optional targetQuestionIndex = Optional.empty(); + + private Optional targetEndPageIndex = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdLeadFormOptionLogic other) { + action(other.getAction()); + targetEndPageIndex(other.getTargetEndPageIndex()); + targetQuestionIndex(other.getTargetQuestionIndex()); + return this; + } + + /** + *

What happens when the choice is selected.

+ *

What happens when the choice is selected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("action") + public _FinalStage action(@NotNull AdLeadFormOptionLogicAction action) { + this.action = Objects.requireNonNull(action, "action must not be null"); + return this; + } + + /** + *

Zero-based index of the question to jump to, for go_to_question.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage targetQuestionIndex(Double targetQuestionIndex) { + this.targetQuestionIndex = Optional.ofNullable(targetQuestionIndex); + return this; + } + + /** + *

Zero-based index of the question to jump to, for go_to_question.

+ */ + @java.lang.Override + @JsonSetter(value = "target_question_index", nulls = Nulls.SKIP) + public _FinalStage targetQuestionIndex(Optional targetQuestionIndex) { + this.targetQuestionIndex = targetQuestionIndex; + return this; + } + + /** + *

Zero-based index of the ending screen to jump to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage targetEndPageIndex(Double targetEndPageIndex) { + this.targetEndPageIndex = Optional.ofNullable(targetEndPageIndex); + return this; + } + + /** + *

Zero-based index of the ending screen to jump to.

+ */ + @java.lang.Override + @JsonSetter(value = "target_end_page_index", nulls = Nulls.SKIP) + public _FinalStage targetEndPageIndex(Optional targetEndPageIndex) { + this.targetEndPageIndex = targetEndPageIndex; + return this; + } + + @java.lang.Override + public AdLeadFormOptionLogic build() { + return new AdLeadFormOptionLogic(action, targetEndPageIndex, targetQuestionIndex, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdLeadFormOptionLogicAction.java b/src/main/java/com/whop/api/types/AdLeadFormOptionLogicAction.java new file mode 100644 index 00000000..918ca4bb --- /dev/null +++ b/src/main/java/com/whop/api/types/AdLeadFormOptionLogicAction.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdLeadFormOptionLogicAction { + public static final AdLeadFormOptionLogicAction GO_TO_QUESTION = + new AdLeadFormOptionLogicAction(Value.GO_TO_QUESTION, "go_to_question"); + + public static final AdLeadFormOptionLogicAction CLOSE_FORM = + new AdLeadFormOptionLogicAction(Value.CLOSE_FORM, "close_form"); + + public static final AdLeadFormOptionLogicAction SUBMIT_FORM = + new AdLeadFormOptionLogicAction(Value.SUBMIT_FORM, "submit_form"); + + private final Value value; + + private final String string; + + AdLeadFormOptionLogicAction(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdLeadFormOptionLogicAction + && this.string.equals(((AdLeadFormOptionLogicAction) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case GO_TO_QUESTION: + return visitor.visitGoToQuestion(); + case CLOSE_FORM: + return visitor.visitCloseForm(); + case SUBMIT_FORM: + return visitor.visitSubmitForm(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdLeadFormOptionLogicAction valueOf(String value) { + switch (value) { + case "go_to_question": + return GO_TO_QUESTION; + case "close_form": + return CLOSE_FORM; + case "submit_form": + return SUBMIT_FORM; + default: + return new AdLeadFormOptionLogicAction(Value.UNKNOWN, value); + } + } + + public enum Value { + GO_TO_QUESTION, + + SUBMIT_FORM, + + CLOSE_FORM, + + UNKNOWN + } + + public interface Visitor { + T visitGoToQuestion(); + + T visitSubmitForm(); + + T visitCloseForm(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdLeadFormPrivacyPolicy.java b/src/main/java/com/whop/api/types/AdLeadFormPrivacyPolicy.java new file mode 100644 index 00000000..d1459311 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdLeadFormPrivacyPolicy.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdLeadFormPrivacyPolicy.Builder.class) +public final class AdLeadFormPrivacyPolicy { + private final Optional linkText; + + private final String url; + + private final Map additionalProperties; + + private AdLeadFormPrivacyPolicy(Optional linkText, String url, Map additionalProperties) { + this.linkText = linkText; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Link text shown for the policy. null uses the platform default. + */ + @JsonIgnore + public Optional getLinkText() { + if (linkText == null) { + return Optional.empty(); + } + return linkText; + } + + /** + * @return URL of your privacy policy. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("link_text") + private Optional _getLinkText() { + return linkText; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdLeadFormPrivacyPolicy && equalTo((AdLeadFormPrivacyPolicy) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdLeadFormPrivacyPolicy other) { + return linkText.equals(other.linkText) && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.linkText, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

URL of your privacy policy.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(AdLeadFormPrivacyPolicy other); + } + + public interface _FinalStage { + AdLeadFormPrivacyPolicy build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Link text shown for the policy. null uses the platform default.

+ */ + _FinalStage linkText(Optional linkText); + + _FinalStage linkText(String linkText); + + _FinalStage linkText(Nullable linkText); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + private Optional linkText = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdLeadFormPrivacyPolicy other) { + linkText(other.getLinkText()); + url(other.getUrl()); + return this; + } + + /** + *

URL of your privacy policy.

+ *

URL of your privacy policy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + /** + *

Link text shown for the policy. null uses the platform default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage linkText(Nullable linkText) { + if (linkText.isNull()) { + this.linkText = null; + } else if (linkText.isEmpty()) { + this.linkText = Optional.empty(); + } else { + this.linkText = Optional.of(linkText.get()); + } + return this; + } + + /** + *

Link text shown for the policy. null uses the platform default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage linkText(String linkText) { + this.linkText = Optional.ofNullable(linkText); + return this; + } + + /** + *

Link text shown for the policy. null uses the platform default.

+ */ + @java.lang.Override + @JsonSetter(value = "link_text", nulls = Nulls.SKIP) + public _FinalStage linkText(Optional linkText) { + this.linkText = linkText; + return this; + } + + @java.lang.Override + public AdLeadFormPrivacyPolicy build() { + return new AdLeadFormPrivacyPolicy(linkText, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdLeadFormQuestion.java b/src/main/java/com/whop/api/types/AdLeadFormQuestion.java new file mode 100644 index 00000000..446d3cf8 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdLeadFormQuestion.java @@ -0,0 +1,250 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdLeadFormQuestion.Builder.class) +public final class AdLeadFormQuestion { + private final Optional format; + + private final Optional label; + + private final Optional> options; + + private final String type; + + private final Map additionalProperties; + + private AdLeadFormQuestion( + Optional format, + Optional label, + Optional> options, + String type, + Map additionalProperties) { + this.format = format; + this.label = label; + this.options = options; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Answer format for custom questions: short_answer, multiple_choice, or appointment. Absent otherwise. + */ + @JsonProperty("format") + public Optional getFormat() { + return format; + } + + /** + * @return Question text for custom questions. Absent for standard prefill questions. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + + /** + * @return Question type: a standard prefill type such as email, phone, or full_name, or custom for your own question. + */ + @JsonProperty("type") + public String getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdLeadFormQuestion && equalTo((AdLeadFormQuestion) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdLeadFormQuestion other) { + return format.equals(other.format) + && label.equals(other.label) + && options.equals(other.options) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.format, this.label, this.options, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + /** + *

Question type: a standard prefill type such as email, phone, or full_name, or custom for your own question.

+ */ + _FinalStage type(@NotNull String type); + + Builder from(AdLeadFormQuestion other); + } + + public interface _FinalStage { + AdLeadFormQuestion build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Answer format for custom questions: short_answer, multiple_choice, or appointment. Absent otherwise.

+ */ + _FinalStage format(Optional format); + + _FinalStage format(String format); + + /** + *

Question text for custom questions. Absent for standard prefill questions.

+ */ + _FinalStage label(Optional label); + + _FinalStage label(String label); + + _FinalStage options(Optional> options); + + _FinalStage options(List options); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private String type; + + private Optional> options = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional format = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdLeadFormQuestion other) { + format(other.getFormat()); + label(other.getLabel()); + options(other.getOptions()); + type(other.getType()); + return this; + } + + /** + *

Question type: a standard prefill type such as email, phone, or full_name, or custom for your own question.

+ *

Question type: a standard prefill type such as email, phone, or full_name, or custom for your own question.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional> options) { + this.options = options; + return this; + } + + /** + *

Question text for custom questions. Absent for standard prefill questions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

Question text for custom questions. Absent for standard prefill questions.

+ */ + @java.lang.Override + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public _FinalStage label(Optional label) { + this.label = label; + return this; + } + + /** + *

Answer format for custom questions: short_answer, multiple_choice, or appointment. Absent otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage format(String format) { + this.format = Optional.ofNullable(format); + return this; + } + + /** + *

Answer format for custom questions: short_answer, multiple_choice, or appointment. Absent otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "format", nulls = Nulls.SKIP) + public _FinalStage format(Optional format) { + this.format = format; + return this; + } + + @java.lang.Override + public AdLeadFormQuestion build() { + return new AdLeadFormQuestion(format, label, options, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdLeadFormQuestionOption.java b/src/main/java/com/whop/api/types/AdLeadFormQuestionOption.java new file mode 100644 index 00000000..b773361c --- /dev/null +++ b/src/main/java/com/whop/api/types/AdLeadFormQuestionOption.java @@ -0,0 +1,247 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdLeadFormQuestionOption.Builder.class) +public final class AdLeadFormQuestionOption { + private final Optional key; + + private final Optional logic; + + private final String value; + + private final Map additionalProperties; + + private AdLeadFormQuestionOption( + Optional key, + Optional logic, + String value, + Map additionalProperties) { + this.key = key; + this.logic = logic; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return Stable identifier the choice's answers are stored under. Absent for simple choices. + */ + @JsonIgnore + public Optional getKey() { + if (key == null) { + return Optional.empty(); + } + return key; + } + + /** + * @return Where the form goes when this choice is selected. Absent when the form just continues to the next question. + */ + @JsonProperty("logic") + public Optional getLogic() { + return logic; + } + + /** + * @return Choice text shown to the person. + */ + @JsonProperty("value") + public String getValue() { + return value; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("key") + private Optional _getKey() { + return key; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdLeadFormQuestionOption && equalTo((AdLeadFormQuestionOption) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdLeadFormQuestionOption other) { + return key.equals(other.key) && logic.equals(other.logic) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.key, this.logic, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ValueStage builder() { + return new Builder(); + } + + public interface ValueStage { + /** + *

Choice text shown to the person.

+ */ + _FinalStage value(@NotNull String value); + + Builder from(AdLeadFormQuestionOption other); + } + + public interface _FinalStage { + AdLeadFormQuestionOption build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Stable identifier the choice's answers are stored under. Absent for simple choices.

+ */ + _FinalStage key(Optional key); + + _FinalStage key(String key); + + _FinalStage key(Nullable key); + + /** + *

Where the form goes when this choice is selected. Absent when the form just continues to the next question.

+ */ + _FinalStage logic(Optional logic); + + _FinalStage logic(AdLeadFormOptionLogic logic); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ValueStage, _FinalStage { + private String value; + + private Optional logic = Optional.empty(); + + private Optional key = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdLeadFormQuestionOption other) { + key(other.getKey()); + logic(other.getLogic()); + value(other.getValue()); + return this; + } + + /** + *

Choice text shown to the person.

+ *

Choice text shown to the person.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + /** + *

Where the form goes when this choice is selected. Absent when the form just continues to the next question.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logic(AdLeadFormOptionLogic logic) { + this.logic = Optional.ofNullable(logic); + return this; + } + + /** + *

Where the form goes when this choice is selected. Absent when the form just continues to the next question.

+ */ + @java.lang.Override + @JsonSetter(value = "logic", nulls = Nulls.SKIP) + public _FinalStage logic(Optional logic) { + this.logic = logic; + return this; + } + + /** + *

Stable identifier the choice's answers are stored under. Absent for simple choices.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage key(Nullable key) { + if (key.isNull()) { + this.key = null; + } else if (key.isEmpty()) { + this.key = Optional.empty(); + } else { + this.key = Optional.of(key.get()); + } + return this; + } + + /** + *

Stable identifier the choice's answers are stored under. Absent for simple choices.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage key(String key) { + this.key = Optional.ofNullable(key); + return this; + } + + /** + *

Stable identifier the choice's answers are stored under. Absent for simple choices.

+ */ + @java.lang.Override + @JsonSetter(value = "key", nulls = Nulls.SKIP) + public _FinalStage key(Optional key) { + this.key = key; + return this; + } + + @java.lang.Override + public AdLeadFormQuestionOption build() { + return new AdLeadFormQuestionOption(key, logic, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdMessagingConfig.java b/src/main/java/com/whop/api/types/AdMessagingConfig.java new file mode 100644 index 00000000..1cbfbf8e --- /dev/null +++ b/src/main/java/com/whop/api/types/AdMessagingConfig.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdMessagingConfig.Builder.class) +public final class AdMessagingConfig { + private final Optional keyword; + + private final Optional message; + + private final Map additionalProperties; + + private AdMessagingConfig( + Optional keyword, Optional message, Map additionalProperties) { + this.keyword = keyword; + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return Suggested reply the person can tap to start the conversation. + */ + @JsonIgnore + public Optional getKeyword() { + if (keyword == null) { + return Optional.empty(); + } + return keyword; + } + + /** + * @return Greeting shown when the conversation opens. + */ + @JsonIgnore + public Optional getMessage() { + if (message == null) { + return Optional.empty(); + } + return message; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("keyword") + private Optional _getKeyword() { + return keyword; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("message") + private Optional _getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdMessagingConfig && equalTo((AdMessagingConfig) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdMessagingConfig other) { + return keyword.equals(other.keyword) && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.keyword, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional keyword = Optional.empty(); + + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdMessagingConfig other) { + keyword(other.getKeyword()); + message(other.getMessage()); + return this; + } + + /** + *

Suggested reply the person can tap to start the conversation.

+ */ + @JsonSetter(value = "keyword", nulls = Nulls.SKIP) + public Builder keyword(Optional keyword) { + this.keyword = keyword; + return this; + } + + public Builder keyword(String keyword) { + this.keyword = Optional.ofNullable(keyword); + return this; + } + + public Builder keyword(Nullable keyword) { + if (keyword.isNull()) { + this.keyword = null; + } else if (keyword.isEmpty()) { + this.keyword = Optional.empty(); + } else { + this.keyword = Optional.of(keyword.get()); + } + return this; + } + + /** + *

Greeting shown when the conversation opens.

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public Builder message(Nullable message) { + if (message.isNull()) { + this.message = null; + } else if (message.isEmpty()) { + this.message = Optional.empty(); + } else { + this.message = Optional.of(message.get()); + } + return this; + } + + public AdMessagingConfig build() { + return new AdMessagingConfig(keyword, message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdPlatformIssue.java b/src/main/java/com/whop/api/types/AdPlatformIssue.java new file mode 100644 index 00000000..98b02ada --- /dev/null +++ b/src/main/java/com/whop/api/types/AdPlatformIssue.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdPlatformIssue.Builder.class) +public final class AdPlatformIssue { + private final String id; + + private final String message; + + private final Optional resourceId; + + private final AdPlatformIssueResourceType resourceType; + + private final Map additionalProperties; + + private AdPlatformIssue( + String id, + String message, + Optional resourceId, + AdPlatformIssueResourceType resourceType, + Map additionalProperties) { + this.id = id; + this.message = message; + this.resourceId = resourceId; + this.resourceType = resourceType; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unique identifier for the issue. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A description of what the issue is and how it can be resolved. + */ + @JsonProperty("message") + public String getMessage() { + return message; + } + + /** + * @return The ID of the campaign, ad group, or ad the issue is attached to. + */ + @JsonIgnore + public Optional getResourceId() { + if (resourceId == null) { + return Optional.empty(); + } + return resourceId; + } + + /** + * @return The type of resource the issue is attached to. + */ + @JsonProperty("resource_type") + public AdPlatformIssueResourceType getResourceType() { + return resourceType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resource_id") + private Optional _getResourceId() { + return resourceId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdPlatformIssue && equalTo((AdPlatformIssue) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdPlatformIssue other) { + return id.equals(other.id) + && message.equals(other.message) + && resourceId.equals(other.resourceId) + && resourceType.equals(other.resourceType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.message, this.resourceId, this.resourceType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Unique identifier for the issue.

+ */ + MessageStage id(@NotNull String id); + + Builder from(AdPlatformIssue other); + } + + public interface MessageStage { + /** + *

A description of what the issue is and how it can be resolved.

+ */ + ResourceTypeStage message(@NotNull String message); + } + + public interface ResourceTypeStage { + /** + *

The type of resource the issue is attached to.

+ */ + _FinalStage resourceType(@NotNull AdPlatformIssueResourceType resourceType); + } + + public interface _FinalStage { + AdPlatformIssue build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The ID of the campaign, ad group, or ad the issue is attached to.

+ */ + _FinalStage resourceId(Optional resourceId); + + _FinalStage resourceId(String resourceId); + + _FinalStage resourceId(Nullable resourceId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, MessageStage, ResourceTypeStage, _FinalStage { + private String id; + + private String message; + + private AdPlatformIssueResourceType resourceType; + + private Optional resourceId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdPlatformIssue other) { + id(other.getId()); + message(other.getMessage()); + resourceId(other.getResourceId()); + resourceType(other.getResourceType()); + return this; + } + + /** + *

Unique identifier for the issue.

+ *

Unique identifier for the issue.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MessageStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

A description of what the issue is and how it can be resolved.

+ *

A description of what the issue is and how it can be resolved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message") + public ResourceTypeStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + /** + *

The type of resource the issue is attached to.

+ *

The type of resource the issue is attached to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_type") + public _FinalStage resourceType(@NotNull AdPlatformIssueResourceType resourceType) { + this.resourceType = Objects.requireNonNull(resourceType, "resourceType must not be null"); + return this; + } + + /** + *

The ID of the campaign, ad group, or ad the issue is attached to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resourceId(Nullable resourceId) { + if (resourceId.isNull()) { + this.resourceId = null; + } else if (resourceId.isEmpty()) { + this.resourceId = Optional.empty(); + } else { + this.resourceId = Optional.of(resourceId.get()); + } + return this; + } + + /** + *

The ID of the campaign, ad group, or ad the issue is attached to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resourceId(String resourceId) { + this.resourceId = Optional.ofNullable(resourceId); + return this; + } + + /** + *

The ID of the campaign, ad group, or ad the issue is attached to.

+ */ + @java.lang.Override + @JsonSetter(value = "resource_id", nulls = Nulls.SKIP) + public _FinalStage resourceId(Optional resourceId) { + this.resourceId = resourceId; + return this; + } + + @java.lang.Override + public AdPlatformIssue build() { + return new AdPlatformIssue(id, message, resourceId, resourceType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdPlatformIssueResourceType.java b/src/main/java/com/whop/api/types/AdPlatformIssueResourceType.java new file mode 100644 index 00000000..5cef2e35 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdPlatformIssueResourceType.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdPlatformIssueResourceType { + public static final AdPlatformIssueResourceType AD = new AdPlatformIssueResourceType(Value.AD, "ad"); + + public static final AdPlatformIssueResourceType AD_GROUP = + new AdPlatformIssueResourceType(Value.AD_GROUP, "ad_group"); + + public static final AdPlatformIssueResourceType AD_CAMPAIGN = + new AdPlatformIssueResourceType(Value.AD_CAMPAIGN, "ad_campaign"); + + private final Value value; + + private final String string; + + AdPlatformIssueResourceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdPlatformIssueResourceType + && this.string.equals(((AdPlatformIssueResourceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AD: + return visitor.visitAd(); + case AD_GROUP: + return visitor.visitAdGroup(); + case AD_CAMPAIGN: + return visitor.visitAdCampaign(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdPlatformIssueResourceType valueOf(String value) { + switch (value) { + case "ad": + return AD; + case "ad_group": + return AD_GROUP; + case "ad_campaign": + return AD_CAMPAIGN; + default: + return new AdPlatformIssueResourceType(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_CAMPAIGN, + + AD_GROUP, + + AD, + + UNKNOWN + } + + public interface Visitor { + T visitAdCampaign(); + + T visitAdGroup(); + + T visitAd(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdPostSource.java b/src/main/java/com/whop/api/types/AdPostSource.java new file mode 100644 index 00000000..d9302210 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdPostSource.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdPostSource { + public static final AdPostSource INSTAGRAM = new AdPostSource(Value.INSTAGRAM, "instagram"); + + public static final AdPostSource FACEBOOK = new AdPostSource(Value.FACEBOOK, "facebook"); + + private final Value value; + + private final String string; + + AdPostSource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof AdPostSource && this.string.equals(((AdPostSource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTAGRAM: + return visitor.visitInstagram(); + case FACEBOOK: + return visitor.visitFacebook(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdPostSource valueOf(String value) { + switch (value) { + case "instagram": + return INSTAGRAM; + case "facebook": + return FACEBOOK; + default: + return new AdPostSource(Value.UNKNOWN, value); + } + } + + public enum Value { + FACEBOOK, + + INSTAGRAM, + + UNKNOWN + } + + public interface Visitor { + T visitFacebook(); + + T visitInstagram(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdReport.java b/src/main/java/com/whop/api/types/AdReport.java new file mode 100644 index 00000000..94dfbc14 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdReport.java @@ -0,0 +1,277 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdReport.Builder.class) +public final class AdReport { + private final Optional> breakdown; + + private final Optional> granularity; + + private final AdReportSummary summary; + + private final Map additionalProperties; + + private AdReport( + Optional> breakdown, + Optional> granularity, + AdReportSummary summary, + Map additionalProperties) { + this.breakdown = breakdown; + this.granularity = granularity; + this.summary = summary; + this.additionalProperties = additionalProperties; + } + + /** + * @return Per-entity rows over the date range. null when the breakdown arg on adReport is omitted; otherwise contains one row per ad campaign, ad group, or ad inside the requested scope at the requested level. + */ + @JsonIgnore + public Optional> getBreakdown() { + if (breakdown == null) { + return Optional.empty(); + } + return breakdown; + } + + /** + * @return Per-bucket time series over the date range, ordered ascending by bucketStart. null when the granularity arg on adReport is omitted; otherwise contains rows at the requested grain (daily or hourly). + */ + @JsonIgnore + public Optional> getGranularity() { + if (granularity == null) { + return Optional.empty(); + } + return granularity; + } + + /** + * @return Aggregate totals and rates over the date range. + */ + @JsonProperty("summary") + public AdReportSummary getSummary() { + return summary; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("breakdown") + private Optional> _getBreakdown() { + return breakdown; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("granularity") + private Optional> _getGranularity() { + return granularity; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdReport && equalTo((AdReport) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdReport other) { + return breakdown.equals(other.breakdown) + && granularity.equals(other.granularity) + && summary.equals(other.summary); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.breakdown, this.granularity, this.summary); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SummaryStage builder() { + return new Builder(); + } + + public interface SummaryStage { + /** + *

Aggregate totals and rates over the date range.

+ */ + _FinalStage summary(@NotNull AdReportSummary summary); + + Builder from(AdReport other); + } + + public interface _FinalStage { + AdReport build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Per-entity rows over the date range. null when the breakdown arg on adReport is omitted; otherwise contains one row per ad campaign, ad group, or ad inside the requested scope at the requested level.

+ */ + _FinalStage breakdown(Optional> breakdown); + + _FinalStage breakdown(List breakdown); + + _FinalStage breakdown(Nullable> breakdown); + + /** + *

Per-bucket time series over the date range, ordered ascending by bucketStart. null when the granularity arg on adReport is omitted; otherwise contains rows at the requested grain (daily or hourly).

+ */ + _FinalStage granularity(Optional> granularity); + + _FinalStage granularity(List granularity); + + _FinalStage granularity(Nullable> granularity); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SummaryStage, _FinalStage { + private AdReportSummary summary; + + private Optional> granularity = Optional.empty(); + + private Optional> breakdown = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdReport other) { + breakdown(other.getBreakdown()); + granularity(other.getGranularity()); + summary(other.getSummary()); + return this; + } + + /** + *

Aggregate totals and rates over the date range.

+ *

Aggregate totals and rates over the date range.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("summary") + public _FinalStage summary(@NotNull AdReportSummary summary) { + this.summary = Objects.requireNonNull(summary, "summary must not be null"); + return this; + } + + /** + *

Per-bucket time series over the date range, ordered ascending by bucketStart. null when the granularity arg on adReport is omitted; otherwise contains rows at the requested grain (daily or hourly).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage granularity(Nullable> granularity) { + if (granularity.isNull()) { + this.granularity = null; + } else if (granularity.isEmpty()) { + this.granularity = Optional.empty(); + } else { + this.granularity = Optional.of(granularity.get()); + } + return this; + } + + /** + *

Per-bucket time series over the date range, ordered ascending by bucketStart. null when the granularity arg on adReport is omitted; otherwise contains rows at the requested grain (daily or hourly).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage granularity(List granularity) { + this.granularity = Optional.ofNullable(granularity); + return this; + } + + /** + *

Per-bucket time series over the date range, ordered ascending by bucketStart. null when the granularity arg on adReport is omitted; otherwise contains rows at the requested grain (daily or hourly).

+ */ + @java.lang.Override + @JsonSetter(value = "granularity", nulls = Nulls.SKIP) + public _FinalStage granularity(Optional> granularity) { + this.granularity = granularity; + return this; + } + + /** + *

Per-entity rows over the date range. null when the breakdown arg on adReport is omitted; otherwise contains one row per ad campaign, ad group, or ad inside the requested scope at the requested level.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage breakdown(Nullable> breakdown) { + if (breakdown.isNull()) { + this.breakdown = null; + } else if (breakdown.isEmpty()) { + this.breakdown = Optional.empty(); + } else { + this.breakdown = Optional.of(breakdown.get()); + } + return this; + } + + /** + *

Per-entity rows over the date range. null when the breakdown arg on adReport is omitted; otherwise contains one row per ad campaign, ad group, or ad inside the requested scope at the requested level.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage breakdown(List breakdown) { + this.breakdown = Optional.ofNullable(breakdown); + return this; + } + + /** + *

Per-entity rows over the date range. null when the breakdown arg on adReport is omitted; otherwise contains one row per ad campaign, ad group, or ad inside the requested scope at the requested level.

+ */ + @java.lang.Override + @JsonSetter(value = "breakdown", nulls = Nulls.SKIP) + public _FinalStage breakdown(Optional> breakdown) { + this.breakdown = breakdown; + return this; + } + + @java.lang.Override + public AdReport build() { + return new AdReport(breakdown, granularity, summary, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdReportBreakdownItem.java b/src/main/java/com/whop/api/types/AdReportBreakdownItem.java new file mode 100644 index 00000000..2d331b1e --- /dev/null +++ b/src/main/java/com/whop/api/types/AdReportBreakdownItem.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdReportBreakdownItem.Builder.class) +public final class AdReportBreakdownItem { + private final Optional> granularity; + + private final String id; + + private final AdReportBreakdownLevels level; + + private final Optional name; + + private final AdReportBreakdownItemSummary summary; + + private final Map additionalProperties; + + private AdReportBreakdownItem( + Optional> granularity, + String id, + AdReportBreakdownLevels level, + Optional name, + AdReportBreakdownItemSummary summary, + Map additionalProperties) { + this.granularity = granularity; + this.id = id; + this.level = level; + this.name = name; + this.summary = summary; + this.additionalProperties = additionalProperties; + } + + /** + * @return Per-bucket time series for this entity over the date range, ordered ascending by bucketStart. null when the granularity arg on adReport is omitted; otherwise contains rows at the requested grain (daily or hourly). + */ + @JsonIgnore + public Optional> getGranularity() { + if (granularity == null) { + return Optional.empty(); + } + return granularity; + } + + /** + * @return Tag of the entity (ad campaign, ad group, or ad). + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The entity level of this row — matches the breakdown arg. + */ + @JsonProperty("level") + public AdReportBreakdownLevels getLevel() { + return level; + } + + /** + * @return Display name of the entity, when available. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return Aggregate totals and rates for this entity over the date range. + */ + @JsonProperty("summary") + public AdReportBreakdownItemSummary getSummary() { + return summary; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("granularity") + private Optional> _getGranularity() { + return granularity; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdReportBreakdownItem && equalTo((AdReportBreakdownItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdReportBreakdownItem other) { + return granularity.equals(other.granularity) + && id.equals(other.id) + && level.equals(other.level) + && name.equals(other.name) + && summary.equals(other.summary); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.granularity, this.id, this.level, this.name, this.summary); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Tag of the entity (ad campaign, ad group, or ad).

+ */ + LevelStage id(@NotNull String id); + + Builder from(AdReportBreakdownItem other); + } + + public interface LevelStage { + /** + *

The entity level of this row — matches the breakdown arg.

+ */ + SummaryStage level(@NotNull AdReportBreakdownLevels level); + } + + public interface SummaryStage { + /** + *

Aggregate totals and rates for this entity over the date range.

+ */ + _FinalStage summary(@NotNull AdReportBreakdownItemSummary summary); + } + + public interface _FinalStage { + AdReportBreakdownItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Per-bucket time series for this entity over the date range, ordered ascending by bucketStart. null when the granularity arg on adReport is omitted; otherwise contains rows at the requested grain (daily or hourly).

+ */ + _FinalStage granularity(Optional> granularity); + + _FinalStage granularity(List granularity); + + _FinalStage granularity(Nullable> granularity); + + /** + *

Display name of the entity, when available.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, LevelStage, SummaryStage, _FinalStage { + private String id; + + private AdReportBreakdownLevels level; + + private AdReportBreakdownItemSummary summary; + + private Optional name = Optional.empty(); + + private Optional> granularity = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdReportBreakdownItem other) { + granularity(other.getGranularity()); + id(other.getId()); + level(other.getLevel()); + name(other.getName()); + summary(other.getSummary()); + return this; + } + + /** + *

Tag of the entity (ad campaign, ad group, or ad).

+ *

Tag of the entity (ad campaign, ad group, or ad).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LevelStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The entity level of this row — matches the breakdown arg.

+ *

The entity level of this row — matches the breakdown arg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("level") + public SummaryStage level(@NotNull AdReportBreakdownLevels level) { + this.level = Objects.requireNonNull(level, "level must not be null"); + return this; + } + + /** + *

Aggregate totals and rates for this entity over the date range.

+ *

Aggregate totals and rates for this entity over the date range.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("summary") + public _FinalStage summary(@NotNull AdReportBreakdownItemSummary summary) { + this.summary = Objects.requireNonNull(summary, "summary must not be null"); + return this; + } + + /** + *

Display name of the entity, when available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Display name of the entity, when available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Display name of the entity, when available.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

Per-bucket time series for this entity over the date range, ordered ascending by bucketStart. null when the granularity arg on adReport is omitted; otherwise contains rows at the requested grain (daily or hourly).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage granularity(Nullable> granularity) { + if (granularity.isNull()) { + this.granularity = null; + } else if (granularity.isEmpty()) { + this.granularity = Optional.empty(); + } else { + this.granularity = Optional.of(granularity.get()); + } + return this; + } + + /** + *

Per-bucket time series for this entity over the date range, ordered ascending by bucketStart. null when the granularity arg on adReport is omitted; otherwise contains rows at the requested grain (daily or hourly).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage granularity(List granularity) { + this.granularity = Optional.ofNullable(granularity); + return this; + } + + /** + *

Per-bucket time series for this entity over the date range, ordered ascending by bucketStart. null when the granularity arg on adReport is omitted; otherwise contains rows at the requested grain (daily or hourly).

+ */ + @java.lang.Override + @JsonSetter(value = "granularity", nulls = Nulls.SKIP) + public _FinalStage granularity(Optional> granularity) { + this.granularity = granularity; + return this; + } + + @java.lang.Override + public AdReportBreakdownItem build() { + return new AdReportBreakdownItem(granularity, id, level, name, summary, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdReportBreakdownItemGranularityItem.java b/src/main/java/com/whop/api/types/AdReportBreakdownItemGranularityItem.java new file mode 100644 index 00000000..0921577a --- /dev/null +++ b/src/main/java/com/whop/api/types/AdReportBreakdownItemGranularityItem.java @@ -0,0 +1,697 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdReportBreakdownItemGranularityItem.Builder.class) +public final class AdReportBreakdownItemGranularityItem { + private final OffsetDateTime bucketStart; + + private final int clicks; + + private final Granularities granularity; + + private final int impressions; + + private final int reach; + + private final Optional resultCount; + + private final Optional resultLabelKey; + + private final Optional resultLabelOverride; + + private final double spend; + + private final Currencies spendCurrency; + + private final OffsetDateTime statDate; + + private final Optional statHour; + + private final Map additionalProperties; + + private AdReportBreakdownItemGranularityItem( + OffsetDateTime bucketStart, + int clicks, + Granularities granularity, + int impressions, + int reach, + Optional resultCount, + Optional resultLabelKey, + Optional resultLabelOverride, + double spend, + Currencies spendCurrency, + OffsetDateTime statDate, + Optional statHour, + Map additionalProperties) { + this.bucketStart = bucketStart; + this.clicks = clicks; + this.granularity = granularity; + this.impressions = impressions; + this.reach = reach; + this.resultCount = resultCount; + this.resultLabelKey = resultLabelKey; + this.resultLabelOverride = resultLabelOverride; + this.spend = spend; + this.spendCurrency = spendCurrency; + this.statDate = statDate; + this.statHour = statHour; + this.additionalProperties = additionalProperties; + } + + /** + * @return The bucket's start time as a real UTC instant. (statDate, statHour) resolved in the ad account's reporting timezone — render this in the viewer's local timezone. + */ + @JsonProperty("bucket_start") + public OffsetDateTime getBucketStart() { + return bucketStart; + } + + /** + * @return Clicks in this bucket. + */ + @JsonProperty("clicks") + public int getClicks() { + return clicks; + } + + /** + * @return The bucket size of this row (hourly, daily, weekly, or monthly). + */ + @JsonProperty("granularity") + public Granularities getGranularity() { + return granularity; + } + + /** + * @return Impressions in this bucket. + */ + @JsonProperty("impressions") + public int getImpressions() { + return impressions; + } + + /** + * @return Unique users reached in this bucket. Always 0 for hourly rows (Meta does not return reach at hourly grain). + */ + @JsonProperty("reach") + public int getReach() { + return reach; + } + + /** + * @return Count of the primary optimization result in this bucket. + */ + @JsonIgnore + public Optional getResultCount() { + if (resultCount == null) { + return Optional.empty(); + } + return resultCount; + } + + /** + * @return The type of optimization result represented by resultCount. + */ + @JsonIgnore + public Optional getResultLabelKey() { + if (resultLabelKey == null) { + return Optional.empty(); + } + return resultLabelKey; + } + + /** + * @return Advertiser-defined label for the result when resultLabelKey is custom. + */ + @JsonIgnore + public Optional getResultLabelOverride() { + if (resultLabelOverride == null) { + return Optional.empty(); + } + return resultLabelOverride; + } + + /** + * @return Charged spend in this bucket in the requested reporting currency — the amount billed including platform fees, not the platform-side net spend. + */ + @JsonProperty("spend") + public double getSpend() { + return spend; + } + + /** + * @return Currency of the spend value. + */ + @JsonProperty("spend_currency") + public Currencies getSpendCurrency() { + return spendCurrency; + } + + /** + * @return The date these stats cover (midnight UTC). For hourly rows, see statHour and bucketStart. + */ + @JsonProperty("stat_date") + public OffsetDateTime getStatDate() { + return statDate; + } + + /** + * @return Hour of the day in the ad account's reporting timezone (0-23). null for daily rows. + */ + @JsonIgnore + public Optional getStatHour() { + if (statHour == null) { + return Optional.empty(); + } + return statHour; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_count") + private Optional _getResultCount() { + return resultCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_label_key") + private Optional _getResultLabelKey() { + return resultLabelKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_label_override") + private Optional _getResultLabelOverride() { + return resultLabelOverride; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("stat_hour") + private Optional _getStatHour() { + return statHour; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdReportBreakdownItemGranularityItem + && equalTo((AdReportBreakdownItemGranularityItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdReportBreakdownItemGranularityItem other) { + return bucketStart.equals(other.bucketStart) + && clicks == other.clicks + && granularity.equals(other.granularity) + && impressions == other.impressions + && reach == other.reach + && resultCount.equals(other.resultCount) + && resultLabelKey.equals(other.resultLabelKey) + && resultLabelOverride.equals(other.resultLabelOverride) + && spend == other.spend + && spendCurrency.equals(other.spendCurrency) + && statDate.equals(other.statDate) + && statHour.equals(other.statHour); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bucketStart, + this.clicks, + this.granularity, + this.impressions, + this.reach, + this.resultCount, + this.resultLabelKey, + this.resultLabelOverride, + this.spend, + this.spendCurrency, + this.statDate, + this.statHour); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BucketStartStage builder() { + return new Builder(); + } + + public interface BucketStartStage { + /** + *

The bucket's start time as a real UTC instant. (statDate, statHour) resolved in the ad account's reporting timezone — render this in the viewer's local timezone.

+ */ + ClicksStage bucketStart(@NotNull OffsetDateTime bucketStart); + + Builder from(AdReportBreakdownItemGranularityItem other); + } + + public interface ClicksStage { + /** + *

Clicks in this bucket.

+ */ + GranularityStage clicks(int clicks); + } + + public interface GranularityStage { + /** + *

The bucket size of this row (hourly, daily, weekly, or monthly).

+ */ + ImpressionsStage granularity(@NotNull Granularities granularity); + } + + public interface ImpressionsStage { + /** + *

Impressions in this bucket.

+ */ + ReachStage impressions(int impressions); + } + + public interface ReachStage { + /** + *

Unique users reached in this bucket. Always 0 for hourly rows (Meta does not return reach at hourly grain).

+ */ + SpendStage reach(int reach); + } + + public interface SpendStage { + /** + *

Charged spend in this bucket in the requested reporting currency — the amount billed including platform fees, not the platform-side net spend.

+ */ + SpendCurrencyStage spend(double spend); + } + + public interface SpendCurrencyStage { + /** + *

Currency of the spend value.

+ */ + StatDateStage spendCurrency(@NotNull Currencies spendCurrency); + } + + public interface StatDateStage { + /** + *

The date these stats cover (midnight UTC). For hourly rows, see statHour and bucketStart.

+ */ + _FinalStage statDate(@NotNull OffsetDateTime statDate); + } + + public interface _FinalStage { + AdReportBreakdownItemGranularityItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Count of the primary optimization result in this bucket.

+ */ + _FinalStage resultCount(Optional resultCount); + + _FinalStage resultCount(Integer resultCount); + + _FinalStage resultCount(Nullable resultCount); + + /** + *

The type of optimization result represented by resultCount.

+ */ + _FinalStage resultLabelKey(Optional resultLabelKey); + + _FinalStage resultLabelKey(ResultLabelKeys resultLabelKey); + + _FinalStage resultLabelKey(Nullable resultLabelKey); + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ */ + _FinalStage resultLabelOverride(Optional resultLabelOverride); + + _FinalStage resultLabelOverride(String resultLabelOverride); + + _FinalStage resultLabelOverride(Nullable resultLabelOverride); + + /** + *

Hour of the day in the ad account's reporting timezone (0-23). null for daily rows.

+ */ + _FinalStage statHour(Optional statHour); + + _FinalStage statHour(Integer statHour); + + _FinalStage statHour(Nullable statHour); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BucketStartStage, + ClicksStage, + GranularityStage, + ImpressionsStage, + ReachStage, + SpendStage, + SpendCurrencyStage, + StatDateStage, + _FinalStage { + private OffsetDateTime bucketStart; + + private int clicks; + + private Granularities granularity; + + private int impressions; + + private int reach; + + private double spend; + + private Currencies spendCurrency; + + private OffsetDateTime statDate; + + private Optional statHour = Optional.empty(); + + private Optional resultLabelOverride = Optional.empty(); + + private Optional resultLabelKey = Optional.empty(); + + private Optional resultCount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdReportBreakdownItemGranularityItem other) { + bucketStart(other.getBucketStart()); + clicks(other.getClicks()); + granularity(other.getGranularity()); + impressions(other.getImpressions()); + reach(other.getReach()); + resultCount(other.getResultCount()); + resultLabelKey(other.getResultLabelKey()); + resultLabelOverride(other.getResultLabelOverride()); + spend(other.getSpend()); + spendCurrency(other.getSpendCurrency()); + statDate(other.getStatDate()); + statHour(other.getStatHour()); + return this; + } + + /** + *

The bucket's start time as a real UTC instant. (statDate, statHour) resolved in the ad account's reporting timezone — render this in the viewer's local timezone.

+ *

The bucket's start time as a real UTC instant. (statDate, statHour) resolved in the ad account's reporting timezone — render this in the viewer's local timezone.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bucket_start") + public ClicksStage bucketStart(@NotNull OffsetDateTime bucketStart) { + this.bucketStart = Objects.requireNonNull(bucketStart, "bucketStart must not be null"); + return this; + } + + /** + *

Clicks in this bucket.

+ *

Clicks in this bucket.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("clicks") + public GranularityStage clicks(int clicks) { + this.clicks = clicks; + return this; + } + + /** + *

The bucket size of this row (hourly, daily, weekly, or monthly).

+ *

The bucket size of this row (hourly, daily, weekly, or monthly).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("granularity") + public ImpressionsStage granularity(@NotNull Granularities granularity) { + this.granularity = Objects.requireNonNull(granularity, "granularity must not be null"); + return this; + } + + /** + *

Impressions in this bucket.

+ *

Impressions in this bucket.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("impressions") + public ReachStage impressions(int impressions) { + this.impressions = impressions; + return this; + } + + /** + *

Unique users reached in this bucket. Always 0 for hourly rows (Meta does not return reach at hourly grain).

+ *

Unique users reached in this bucket. Always 0 for hourly rows (Meta does not return reach at hourly grain).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reach") + public SpendStage reach(int reach) { + this.reach = reach; + return this; + } + + /** + *

Charged spend in this bucket in the requested reporting currency — the amount billed including platform fees, not the platform-side net spend.

+ *

Charged spend in this bucket in the requested reporting currency — the amount billed including platform fees, not the platform-side net spend.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("spend") + public SpendCurrencyStage spend(double spend) { + this.spend = spend; + return this; + } + + /** + *

Currency of the spend value.

+ *

Currency of the spend value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("spend_currency") + public StatDateStage spendCurrency(@NotNull Currencies spendCurrency) { + this.spendCurrency = Objects.requireNonNull(spendCurrency, "spendCurrency must not be null"); + return this; + } + + /** + *

The date these stats cover (midnight UTC). For hourly rows, see statHour and bucketStart.

+ *

The date these stats cover (midnight UTC). For hourly rows, see statHour and bucketStart.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("stat_date") + public _FinalStage statDate(@NotNull OffsetDateTime statDate) { + this.statDate = Objects.requireNonNull(statDate, "statDate must not be null"); + return this; + } + + /** + *

Hour of the day in the ad account's reporting timezone (0-23). null for daily rows.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statHour(Nullable statHour) { + if (statHour.isNull()) { + this.statHour = null; + } else if (statHour.isEmpty()) { + this.statHour = Optional.empty(); + } else { + this.statHour = Optional.of(statHour.get()); + } + return this; + } + + /** + *

Hour of the day in the ad account's reporting timezone (0-23). null for daily rows.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statHour(Integer statHour) { + this.statHour = Optional.ofNullable(statHour); + return this; + } + + /** + *

Hour of the day in the ad account's reporting timezone (0-23). null for daily rows.

+ */ + @java.lang.Override + @JsonSetter(value = "stat_hour", nulls = Nulls.SKIP) + public _FinalStage statHour(Optional statHour) { + this.statHour = statHour; + return this; + } + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelOverride(Nullable resultLabelOverride) { + if (resultLabelOverride.isNull()) { + this.resultLabelOverride = null; + } else if (resultLabelOverride.isEmpty()) { + this.resultLabelOverride = Optional.empty(); + } else { + this.resultLabelOverride = Optional.of(resultLabelOverride.get()); + } + return this; + } + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelOverride(String resultLabelOverride) { + this.resultLabelOverride = Optional.ofNullable(resultLabelOverride); + return this; + } + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ */ + @java.lang.Override + @JsonSetter(value = "result_label_override", nulls = Nulls.SKIP) + public _FinalStage resultLabelOverride(Optional resultLabelOverride) { + this.resultLabelOverride = resultLabelOverride; + return this; + } + + /** + *

The type of optimization result represented by resultCount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelKey(Nullable resultLabelKey) { + if (resultLabelKey.isNull()) { + this.resultLabelKey = null; + } else if (resultLabelKey.isEmpty()) { + this.resultLabelKey = Optional.empty(); + } else { + this.resultLabelKey = Optional.of(resultLabelKey.get()); + } + return this; + } + + /** + *

The type of optimization result represented by resultCount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelKey(ResultLabelKeys resultLabelKey) { + this.resultLabelKey = Optional.ofNullable(resultLabelKey); + return this; + } + + /** + *

The type of optimization result represented by resultCount.

+ */ + @java.lang.Override + @JsonSetter(value = "result_label_key", nulls = Nulls.SKIP) + public _FinalStage resultLabelKey(Optional resultLabelKey) { + this.resultLabelKey = resultLabelKey; + return this; + } + + /** + *

Count of the primary optimization result in this bucket.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultCount(Nullable resultCount) { + if (resultCount.isNull()) { + this.resultCount = null; + } else if (resultCount.isEmpty()) { + this.resultCount = Optional.empty(); + } else { + this.resultCount = Optional.of(resultCount.get()); + } + return this; + } + + /** + *

Count of the primary optimization result in this bucket.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultCount(Integer resultCount) { + this.resultCount = Optional.ofNullable(resultCount); + return this; + } + + /** + *

Count of the primary optimization result in this bucket.

+ */ + @java.lang.Override + @JsonSetter(value = "result_count", nulls = Nulls.SKIP) + public _FinalStage resultCount(Optional resultCount) { + this.resultCount = resultCount; + return this; + } + + @java.lang.Override + public AdReportBreakdownItemGranularityItem build() { + return new AdReportBreakdownItemGranularityItem( + bucketStart, + clicks, + granularity, + impressions, + reach, + resultCount, + resultLabelKey, + resultLabelOverride, + spend, + spendCurrency, + statDate, + statHour, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdReportBreakdownItemSummary.java b/src/main/java/com/whop/api/types/AdReportBreakdownItemSummary.java new file mode 100644 index 00000000..ac1399f9 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdReportBreakdownItemSummary.java @@ -0,0 +1,906 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdReportBreakdownItemSummary.Builder.class) +public final class AdReportBreakdownItemSummary { + private final double clickThroughRate; + + private final int clicks; + + private final double costPerClick; + + private final Optional costPerMille; + + private final Optional costPerResult; + + private final Optional frequency; + + private final int impressions; + + private final int reach; + + private final Optional resultCount; + + private final Optional resultLabelKey; + + private final Optional resultLabelOverride; + + private final Optional returnOnAdSpend; + + private final double spend; + + private final Optional spendCurrency; + + private final Map additionalProperties; + + private AdReportBreakdownItemSummary( + double clickThroughRate, + int clicks, + double costPerClick, + Optional costPerMille, + Optional costPerResult, + Optional frequency, + int impressions, + int reach, + Optional resultCount, + Optional resultLabelKey, + Optional resultLabelOverride, + Optional returnOnAdSpend, + double spend, + Optional spendCurrency, + Map additionalProperties) { + this.clickThroughRate = clickThroughRate; + this.clicks = clicks; + this.costPerClick = costPerClick; + this.costPerMille = costPerMille; + this.costPerResult = costPerResult; + this.frequency = frequency; + this.impressions = impressions; + this.reach = reach; + this.resultCount = resultCount; + this.resultLabelKey = resultLabelKey; + this.resultLabelOverride = resultLabelOverride; + this.returnOnAdSpend = returnOnAdSpend; + this.spend = spend; + this.spendCurrency = spendCurrency; + this.additionalProperties = additionalProperties; + } + + /** + * @return Click-through rate (clicks / impressions). + */ + @JsonProperty("click_through_rate") + public double getClickThroughRate() { + return clickThroughRate; + } + + /** + * @return Total clicks over the date range. + */ + @JsonProperty("clicks") + public int getClicks() { + return clicks; + } + + /** + * @return Cost per click in the requested reporting currency. + */ + @JsonProperty("cost_per_click") + public double getCostPerClick() { + return costPerClick; + } + + /** + * @return Cost per thousand impressions in the requested reporting currency. + */ + @JsonIgnore + public Optional getCostPerMille() { + if (costPerMille == null) { + return Optional.empty(); + } + return costPerMille; + } + + /** + * @return Spend divided by resultCount. Null when there are no results. + */ + @JsonIgnore + public Optional getCostPerResult() { + if (costPerResult == null) { + return Optional.empty(); + } + return costPerResult; + } + + /** + * @return Average number of times each reached user saw an ad. + */ + @JsonIgnore + public Optional getFrequency() { + if (frequency == null) { + return Optional.empty(); + } + return frequency; + } + + /** + * @return Total impressions over the date range. + */ + @JsonProperty("impressions") + public int getImpressions() { + return impressions; + } + + /** + * @return Unique users reached, deduplicated by the external ad platform. + */ + @JsonProperty("reach") + public int getReach() { + return reach; + } + + /** + * @return Count of the campaign's primary optimization result (purchases, clicks, etc.) — see resultLabelKey. + */ + @JsonIgnore + public Optional getResultCount() { + if (resultCount == null) { + return Optional.empty(); + } + return resultCount; + } + + /** + * @return The type of optimization result represented by resultCount. + */ + @JsonIgnore + public Optional getResultLabelKey() { + if (resultLabelKey == null) { + return Optional.empty(); + } + return resultLabelKey; + } + + /** + * @return Advertiser-defined label for the result when resultLabelKey is custom. + */ + @JsonIgnore + public Optional getResultLabelOverride() { + if (resultLabelOverride == null) { + return Optional.empty(); + } + return resultLabelOverride; + } + + /** + * @return Alias for purchaseReturnOnAdSpend — return on ad spend for purchases, as reported by the external ad platform. + */ + @JsonIgnore + public Optional getReturnOnAdSpend() { + if (returnOnAdSpend == null) { + return Optional.empty(); + } + return returnOnAdSpend; + } + + /** + * @return Total spend over the date range in the requested reporting currency. + */ + @JsonProperty("spend") + public double getSpend() { + return spend; + } + + /** + * @return Currency of the spend value. Matches the requested currency when set. + */ + @JsonIgnore + public Optional getSpendCurrency() { + if (spendCurrency == null) { + return Optional.empty(); + } + return spendCurrency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_mille") + private Optional _getCostPerMille() { + return costPerMille; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_result") + private Optional _getCostPerResult() { + return costPerResult; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("frequency") + private Optional _getFrequency() { + return frequency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_count") + private Optional _getResultCount() { + return resultCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_label_key") + private Optional _getResultLabelKey() { + return resultLabelKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_label_override") + private Optional _getResultLabelOverride() { + return resultLabelOverride; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("return_on_ad_spend") + private Optional _getReturnOnAdSpend() { + return returnOnAdSpend; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("spend_currency") + private Optional _getSpendCurrency() { + return spendCurrency; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdReportBreakdownItemSummary && equalTo((AdReportBreakdownItemSummary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdReportBreakdownItemSummary other) { + return clickThroughRate == other.clickThroughRate + && clicks == other.clicks + && costPerClick == other.costPerClick + && costPerMille.equals(other.costPerMille) + && costPerResult.equals(other.costPerResult) + && frequency.equals(other.frequency) + && impressions == other.impressions + && reach == other.reach + && resultCount.equals(other.resultCount) + && resultLabelKey.equals(other.resultLabelKey) + && resultLabelOverride.equals(other.resultLabelOverride) + && returnOnAdSpend.equals(other.returnOnAdSpend) + && spend == other.spend + && spendCurrency.equals(other.spendCurrency); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.clickThroughRate, + this.clicks, + this.costPerClick, + this.costPerMille, + this.costPerResult, + this.frequency, + this.impressions, + this.reach, + this.resultCount, + this.resultLabelKey, + this.resultLabelOverride, + this.returnOnAdSpend, + this.spend, + this.spendCurrency); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ClickThroughRateStage builder() { + return new Builder(); + } + + public interface ClickThroughRateStage { + /** + *

Click-through rate (clicks / impressions).

+ */ + ClicksStage clickThroughRate(double clickThroughRate); + + Builder from(AdReportBreakdownItemSummary other); + } + + public interface ClicksStage { + /** + *

Total clicks over the date range.

+ */ + CostPerClickStage clicks(int clicks); + } + + public interface CostPerClickStage { + /** + *

Cost per click in the requested reporting currency.

+ */ + ImpressionsStage costPerClick(double costPerClick); + } + + public interface ImpressionsStage { + /** + *

Total impressions over the date range.

+ */ + ReachStage impressions(int impressions); + } + + public interface ReachStage { + /** + *

Unique users reached, deduplicated by the external ad platform.

+ */ + SpendStage reach(int reach); + } + + public interface SpendStage { + /** + *

Total spend over the date range in the requested reporting currency.

+ */ + _FinalStage spend(double spend); + } + + public interface _FinalStage { + AdReportBreakdownItemSummary build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Cost per thousand impressions in the requested reporting currency.

+ */ + _FinalStage costPerMille(Optional costPerMille); + + _FinalStage costPerMille(Double costPerMille); + + _FinalStage costPerMille(Nullable costPerMille); + + /** + *

Spend divided by resultCount. Null when there are no results.

+ */ + _FinalStage costPerResult(Optional costPerResult); + + _FinalStage costPerResult(Double costPerResult); + + _FinalStage costPerResult(Nullable costPerResult); + + /** + *

Average number of times each reached user saw an ad.

+ */ + _FinalStage frequency(Optional frequency); + + _FinalStage frequency(Double frequency); + + _FinalStage frequency(Nullable frequency); + + /** + *

Count of the campaign's primary optimization result (purchases, clicks, etc.) — see resultLabelKey.

+ */ + _FinalStage resultCount(Optional resultCount); + + _FinalStage resultCount(Integer resultCount); + + _FinalStage resultCount(Nullable resultCount); + + /** + *

The type of optimization result represented by resultCount.

+ */ + _FinalStage resultLabelKey(Optional resultLabelKey); + + _FinalStage resultLabelKey(ResultLabelKeys resultLabelKey); + + _FinalStage resultLabelKey(Nullable resultLabelKey); + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ */ + _FinalStage resultLabelOverride(Optional resultLabelOverride); + + _FinalStage resultLabelOverride(String resultLabelOverride); + + _FinalStage resultLabelOverride(Nullable resultLabelOverride); + + /** + *

Alias for purchaseReturnOnAdSpend — return on ad spend for purchases, as reported by the external ad platform.

+ */ + _FinalStage returnOnAdSpend(Optional returnOnAdSpend); + + _FinalStage returnOnAdSpend(Double returnOnAdSpend); + + _FinalStage returnOnAdSpend(Nullable returnOnAdSpend); + + /** + *

Currency of the spend value. Matches the requested currency when set.

+ */ + _FinalStage spendCurrency(Optional spendCurrency); + + _FinalStage spendCurrency(Currencies spendCurrency); + + _FinalStage spendCurrency(Nullable spendCurrency); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ClickThroughRateStage, + ClicksStage, + CostPerClickStage, + ImpressionsStage, + ReachStage, + SpendStage, + _FinalStage { + private double clickThroughRate; + + private int clicks; + + private double costPerClick; + + private int impressions; + + private int reach; + + private double spend; + + private Optional spendCurrency = Optional.empty(); + + private Optional returnOnAdSpend = Optional.empty(); + + private Optional resultLabelOverride = Optional.empty(); + + private Optional resultLabelKey = Optional.empty(); + + private Optional resultCount = Optional.empty(); + + private Optional frequency = Optional.empty(); + + private Optional costPerResult = Optional.empty(); + + private Optional costPerMille = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdReportBreakdownItemSummary other) { + clickThroughRate(other.getClickThroughRate()); + clicks(other.getClicks()); + costPerClick(other.getCostPerClick()); + costPerMille(other.getCostPerMille()); + costPerResult(other.getCostPerResult()); + frequency(other.getFrequency()); + impressions(other.getImpressions()); + reach(other.getReach()); + resultCount(other.getResultCount()); + resultLabelKey(other.getResultLabelKey()); + resultLabelOverride(other.getResultLabelOverride()); + returnOnAdSpend(other.getReturnOnAdSpend()); + spend(other.getSpend()); + spendCurrency(other.getSpendCurrency()); + return this; + } + + /** + *

Click-through rate (clicks / impressions).

+ *

Click-through rate (clicks / impressions).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("click_through_rate") + public ClicksStage clickThroughRate(double clickThroughRate) { + this.clickThroughRate = clickThroughRate; + return this; + } + + /** + *

Total clicks over the date range.

+ *

Total clicks over the date range.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("clicks") + public CostPerClickStage clicks(int clicks) { + this.clicks = clicks; + return this; + } + + /** + *

Cost per click in the requested reporting currency.

+ *

Cost per click in the requested reporting currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cost_per_click") + public ImpressionsStage costPerClick(double costPerClick) { + this.costPerClick = costPerClick; + return this; + } + + /** + *

Total impressions over the date range.

+ *

Total impressions over the date range.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("impressions") + public ReachStage impressions(int impressions) { + this.impressions = impressions; + return this; + } + + /** + *

Unique users reached, deduplicated by the external ad platform.

+ *

Unique users reached, deduplicated by the external ad platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reach") + public SpendStage reach(int reach) { + this.reach = reach; + return this; + } + + /** + *

Total spend over the date range in the requested reporting currency.

+ *

Total spend over the date range in the requested reporting currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("spend") + public _FinalStage spend(double spend) { + this.spend = spend; + return this; + } + + /** + *

Currency of the spend value. Matches the requested currency when set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spendCurrency(Nullable spendCurrency) { + if (spendCurrency.isNull()) { + this.spendCurrency = null; + } else if (spendCurrency.isEmpty()) { + this.spendCurrency = Optional.empty(); + } else { + this.spendCurrency = Optional.of(spendCurrency.get()); + } + return this; + } + + /** + *

Currency of the spend value. Matches the requested currency when set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spendCurrency(Currencies spendCurrency) { + this.spendCurrency = Optional.ofNullable(spendCurrency); + return this; + } + + /** + *

Currency of the spend value. Matches the requested currency when set.

+ */ + @java.lang.Override + @JsonSetter(value = "spend_currency", nulls = Nulls.SKIP) + public _FinalStage spendCurrency(Optional spendCurrency) { + this.spendCurrency = spendCurrency; + return this; + } + + /** + *

Alias for purchaseReturnOnAdSpend — return on ad spend for purchases, as reported by the external ad platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnOnAdSpend(Nullable returnOnAdSpend) { + if (returnOnAdSpend.isNull()) { + this.returnOnAdSpend = null; + } else if (returnOnAdSpend.isEmpty()) { + this.returnOnAdSpend = Optional.empty(); + } else { + this.returnOnAdSpend = Optional.of(returnOnAdSpend.get()); + } + return this; + } + + /** + *

Alias for purchaseReturnOnAdSpend — return on ad spend for purchases, as reported by the external ad platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnOnAdSpend(Double returnOnAdSpend) { + this.returnOnAdSpend = Optional.ofNullable(returnOnAdSpend); + return this; + } + + /** + *

Alias for purchaseReturnOnAdSpend — return on ad spend for purchases, as reported by the external ad platform.

+ */ + @java.lang.Override + @JsonSetter(value = "return_on_ad_spend", nulls = Nulls.SKIP) + public _FinalStage returnOnAdSpend(Optional returnOnAdSpend) { + this.returnOnAdSpend = returnOnAdSpend; + return this; + } + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelOverride(Nullable resultLabelOverride) { + if (resultLabelOverride.isNull()) { + this.resultLabelOverride = null; + } else if (resultLabelOverride.isEmpty()) { + this.resultLabelOverride = Optional.empty(); + } else { + this.resultLabelOverride = Optional.of(resultLabelOverride.get()); + } + return this; + } + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelOverride(String resultLabelOverride) { + this.resultLabelOverride = Optional.ofNullable(resultLabelOverride); + return this; + } + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ */ + @java.lang.Override + @JsonSetter(value = "result_label_override", nulls = Nulls.SKIP) + public _FinalStage resultLabelOverride(Optional resultLabelOverride) { + this.resultLabelOverride = resultLabelOverride; + return this; + } + + /** + *

The type of optimization result represented by resultCount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelKey(Nullable resultLabelKey) { + if (resultLabelKey.isNull()) { + this.resultLabelKey = null; + } else if (resultLabelKey.isEmpty()) { + this.resultLabelKey = Optional.empty(); + } else { + this.resultLabelKey = Optional.of(resultLabelKey.get()); + } + return this; + } + + /** + *

The type of optimization result represented by resultCount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelKey(ResultLabelKeys resultLabelKey) { + this.resultLabelKey = Optional.ofNullable(resultLabelKey); + return this; + } + + /** + *

The type of optimization result represented by resultCount.

+ */ + @java.lang.Override + @JsonSetter(value = "result_label_key", nulls = Nulls.SKIP) + public _FinalStage resultLabelKey(Optional resultLabelKey) { + this.resultLabelKey = resultLabelKey; + return this; + } + + /** + *

Count of the campaign's primary optimization result (purchases, clicks, etc.) — see resultLabelKey.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultCount(Nullable resultCount) { + if (resultCount.isNull()) { + this.resultCount = null; + } else if (resultCount.isEmpty()) { + this.resultCount = Optional.empty(); + } else { + this.resultCount = Optional.of(resultCount.get()); + } + return this; + } + + /** + *

Count of the campaign's primary optimization result (purchases, clicks, etc.) — see resultLabelKey.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultCount(Integer resultCount) { + this.resultCount = Optional.ofNullable(resultCount); + return this; + } + + /** + *

Count of the campaign's primary optimization result (purchases, clicks, etc.) — see resultLabelKey.

+ */ + @java.lang.Override + @JsonSetter(value = "result_count", nulls = Nulls.SKIP) + public _FinalStage resultCount(Optional resultCount) { + this.resultCount = resultCount; + return this; + } + + /** + *

Average number of times each reached user saw an ad.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frequency(Nullable frequency) { + if (frequency.isNull()) { + this.frequency = null; + } else if (frequency.isEmpty()) { + this.frequency = Optional.empty(); + } else { + this.frequency = Optional.of(frequency.get()); + } + return this; + } + + /** + *

Average number of times each reached user saw an ad.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frequency(Double frequency) { + this.frequency = Optional.ofNullable(frequency); + return this; + } + + /** + *

Average number of times each reached user saw an ad.

+ */ + @java.lang.Override + @JsonSetter(value = "frequency", nulls = Nulls.SKIP) + public _FinalStage frequency(Optional frequency) { + this.frequency = frequency; + return this; + } + + /** + *

Spend divided by resultCount. Null when there are no results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerResult(Nullable costPerResult) { + if (costPerResult.isNull()) { + this.costPerResult = null; + } else if (costPerResult.isEmpty()) { + this.costPerResult = Optional.empty(); + } else { + this.costPerResult = Optional.of(costPerResult.get()); + } + return this; + } + + /** + *

Spend divided by resultCount. Null when there are no results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerResult(Double costPerResult) { + this.costPerResult = Optional.ofNullable(costPerResult); + return this; + } + + /** + *

Spend divided by resultCount. Null when there are no results.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_result", nulls = Nulls.SKIP) + public _FinalStage costPerResult(Optional costPerResult) { + this.costPerResult = costPerResult; + return this; + } + + /** + *

Cost per thousand impressions in the requested reporting currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerMille(Nullable costPerMille) { + if (costPerMille.isNull()) { + this.costPerMille = null; + } else if (costPerMille.isEmpty()) { + this.costPerMille = Optional.empty(); + } else { + this.costPerMille = Optional.of(costPerMille.get()); + } + return this; + } + + /** + *

Cost per thousand impressions in the requested reporting currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerMille(Double costPerMille) { + this.costPerMille = Optional.ofNullable(costPerMille); + return this; + } + + /** + *

Cost per thousand impressions in the requested reporting currency.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_mille", nulls = Nulls.SKIP) + public _FinalStage costPerMille(Optional costPerMille) { + this.costPerMille = costPerMille; + return this; + } + + @java.lang.Override + public AdReportBreakdownItemSummary build() { + return new AdReportBreakdownItemSummary( + clickThroughRate, + clicks, + costPerClick, + costPerMille, + costPerResult, + frequency, + impressions, + reach, + resultCount, + resultLabelKey, + resultLabelOverride, + returnOnAdSpend, + spend, + spendCurrency, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdReportBreakdownLevels.java b/src/main/java/com/whop/api/types/AdReportBreakdownLevels.java new file mode 100644 index 00000000..1c862a2e --- /dev/null +++ b/src/main/java/com/whop/api/types/AdReportBreakdownLevels.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdReportBreakdownLevels { + public static final AdReportBreakdownLevels AD = new AdReportBreakdownLevels(Value.AD, "ad"); + + public static final AdReportBreakdownLevels AD_GROUP = new AdReportBreakdownLevels(Value.AD_GROUP, "ad_group"); + + public static final AdReportBreakdownLevels CAMPAIGN = new AdReportBreakdownLevels(Value.CAMPAIGN, "campaign"); + + private final Value value; + + private final String string; + + AdReportBreakdownLevels(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdReportBreakdownLevels + && this.string.equals(((AdReportBreakdownLevels) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AD: + return visitor.visitAd(); + case AD_GROUP: + return visitor.visitAdGroup(); + case CAMPAIGN: + return visitor.visitCampaign(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdReportBreakdownLevels valueOf(String value) { + switch (value) { + case "ad": + return AD; + case "ad_group": + return AD_GROUP; + case "campaign": + return CAMPAIGN; + default: + return new AdReportBreakdownLevels(Value.UNKNOWN, value); + } + } + + public enum Value { + CAMPAIGN, + + AD_GROUP, + + AD, + + UNKNOWN + } + + public interface Visitor { + T visitCampaign(); + + T visitAdGroup(); + + T visitAd(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdReportGranularityItem.java b/src/main/java/com/whop/api/types/AdReportGranularityItem.java new file mode 100644 index 00000000..cde43e80 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdReportGranularityItem.java @@ -0,0 +1,696 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdReportGranularityItem.Builder.class) +public final class AdReportGranularityItem { + private final OffsetDateTime bucketStart; + + private final int clicks; + + private final Granularities granularity; + + private final int impressions; + + private final int reach; + + private final Optional resultCount; + + private final Optional resultLabelKey; + + private final Optional resultLabelOverride; + + private final double spend; + + private final Currencies spendCurrency; + + private final OffsetDateTime statDate; + + private final Optional statHour; + + private final Map additionalProperties; + + private AdReportGranularityItem( + OffsetDateTime bucketStart, + int clicks, + Granularities granularity, + int impressions, + int reach, + Optional resultCount, + Optional resultLabelKey, + Optional resultLabelOverride, + double spend, + Currencies spendCurrency, + OffsetDateTime statDate, + Optional statHour, + Map additionalProperties) { + this.bucketStart = bucketStart; + this.clicks = clicks; + this.granularity = granularity; + this.impressions = impressions; + this.reach = reach; + this.resultCount = resultCount; + this.resultLabelKey = resultLabelKey; + this.resultLabelOverride = resultLabelOverride; + this.spend = spend; + this.spendCurrency = spendCurrency; + this.statDate = statDate; + this.statHour = statHour; + this.additionalProperties = additionalProperties; + } + + /** + * @return The bucket's start time as a real UTC instant. (statDate, statHour) resolved in the ad account's reporting timezone — render this in the viewer's local timezone. + */ + @JsonProperty("bucket_start") + public OffsetDateTime getBucketStart() { + return bucketStart; + } + + /** + * @return Clicks in this bucket. + */ + @JsonProperty("clicks") + public int getClicks() { + return clicks; + } + + /** + * @return The bucket size of this row (hourly, daily, weekly, or monthly). + */ + @JsonProperty("granularity") + public Granularities getGranularity() { + return granularity; + } + + /** + * @return Impressions in this bucket. + */ + @JsonProperty("impressions") + public int getImpressions() { + return impressions; + } + + /** + * @return Unique users reached in this bucket. Always 0 for hourly rows (Meta does not return reach at hourly grain). + */ + @JsonProperty("reach") + public int getReach() { + return reach; + } + + /** + * @return Count of the primary optimization result in this bucket. + */ + @JsonIgnore + public Optional getResultCount() { + if (resultCount == null) { + return Optional.empty(); + } + return resultCount; + } + + /** + * @return The type of optimization result represented by resultCount. + */ + @JsonIgnore + public Optional getResultLabelKey() { + if (resultLabelKey == null) { + return Optional.empty(); + } + return resultLabelKey; + } + + /** + * @return Advertiser-defined label for the result when resultLabelKey is custom. + */ + @JsonIgnore + public Optional getResultLabelOverride() { + if (resultLabelOverride == null) { + return Optional.empty(); + } + return resultLabelOverride; + } + + /** + * @return Charged spend in this bucket in the requested reporting currency — the amount billed including platform fees, not the platform-side net spend. + */ + @JsonProperty("spend") + public double getSpend() { + return spend; + } + + /** + * @return Currency of the spend value. + */ + @JsonProperty("spend_currency") + public Currencies getSpendCurrency() { + return spendCurrency; + } + + /** + * @return The date these stats cover (midnight UTC). For hourly rows, see statHour and bucketStart. + */ + @JsonProperty("stat_date") + public OffsetDateTime getStatDate() { + return statDate; + } + + /** + * @return Hour of the day in the ad account's reporting timezone (0-23). null for daily rows. + */ + @JsonIgnore + public Optional getStatHour() { + if (statHour == null) { + return Optional.empty(); + } + return statHour; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_count") + private Optional _getResultCount() { + return resultCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_label_key") + private Optional _getResultLabelKey() { + return resultLabelKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_label_override") + private Optional _getResultLabelOverride() { + return resultLabelOverride; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("stat_hour") + private Optional _getStatHour() { + return statHour; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdReportGranularityItem && equalTo((AdReportGranularityItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdReportGranularityItem other) { + return bucketStart.equals(other.bucketStart) + && clicks == other.clicks + && granularity.equals(other.granularity) + && impressions == other.impressions + && reach == other.reach + && resultCount.equals(other.resultCount) + && resultLabelKey.equals(other.resultLabelKey) + && resultLabelOverride.equals(other.resultLabelOverride) + && spend == other.spend + && spendCurrency.equals(other.spendCurrency) + && statDate.equals(other.statDate) + && statHour.equals(other.statHour); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bucketStart, + this.clicks, + this.granularity, + this.impressions, + this.reach, + this.resultCount, + this.resultLabelKey, + this.resultLabelOverride, + this.spend, + this.spendCurrency, + this.statDate, + this.statHour); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BucketStartStage builder() { + return new Builder(); + } + + public interface BucketStartStage { + /** + *

The bucket's start time as a real UTC instant. (statDate, statHour) resolved in the ad account's reporting timezone — render this in the viewer's local timezone.

+ */ + ClicksStage bucketStart(@NotNull OffsetDateTime bucketStart); + + Builder from(AdReportGranularityItem other); + } + + public interface ClicksStage { + /** + *

Clicks in this bucket.

+ */ + GranularityStage clicks(int clicks); + } + + public interface GranularityStage { + /** + *

The bucket size of this row (hourly, daily, weekly, or monthly).

+ */ + ImpressionsStage granularity(@NotNull Granularities granularity); + } + + public interface ImpressionsStage { + /** + *

Impressions in this bucket.

+ */ + ReachStage impressions(int impressions); + } + + public interface ReachStage { + /** + *

Unique users reached in this bucket. Always 0 for hourly rows (Meta does not return reach at hourly grain).

+ */ + SpendStage reach(int reach); + } + + public interface SpendStage { + /** + *

Charged spend in this bucket in the requested reporting currency — the amount billed including platform fees, not the platform-side net spend.

+ */ + SpendCurrencyStage spend(double spend); + } + + public interface SpendCurrencyStage { + /** + *

Currency of the spend value.

+ */ + StatDateStage spendCurrency(@NotNull Currencies spendCurrency); + } + + public interface StatDateStage { + /** + *

The date these stats cover (midnight UTC). For hourly rows, see statHour and bucketStart.

+ */ + _FinalStage statDate(@NotNull OffsetDateTime statDate); + } + + public interface _FinalStage { + AdReportGranularityItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Count of the primary optimization result in this bucket.

+ */ + _FinalStage resultCount(Optional resultCount); + + _FinalStage resultCount(Integer resultCount); + + _FinalStage resultCount(Nullable resultCount); + + /** + *

The type of optimization result represented by resultCount.

+ */ + _FinalStage resultLabelKey(Optional resultLabelKey); + + _FinalStage resultLabelKey(ResultLabelKeys resultLabelKey); + + _FinalStage resultLabelKey(Nullable resultLabelKey); + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ */ + _FinalStage resultLabelOverride(Optional resultLabelOverride); + + _FinalStage resultLabelOverride(String resultLabelOverride); + + _FinalStage resultLabelOverride(Nullable resultLabelOverride); + + /** + *

Hour of the day in the ad account's reporting timezone (0-23). null for daily rows.

+ */ + _FinalStage statHour(Optional statHour); + + _FinalStage statHour(Integer statHour); + + _FinalStage statHour(Nullable statHour); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BucketStartStage, + ClicksStage, + GranularityStage, + ImpressionsStage, + ReachStage, + SpendStage, + SpendCurrencyStage, + StatDateStage, + _FinalStage { + private OffsetDateTime bucketStart; + + private int clicks; + + private Granularities granularity; + + private int impressions; + + private int reach; + + private double spend; + + private Currencies spendCurrency; + + private OffsetDateTime statDate; + + private Optional statHour = Optional.empty(); + + private Optional resultLabelOverride = Optional.empty(); + + private Optional resultLabelKey = Optional.empty(); + + private Optional resultCount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdReportGranularityItem other) { + bucketStart(other.getBucketStart()); + clicks(other.getClicks()); + granularity(other.getGranularity()); + impressions(other.getImpressions()); + reach(other.getReach()); + resultCount(other.getResultCount()); + resultLabelKey(other.getResultLabelKey()); + resultLabelOverride(other.getResultLabelOverride()); + spend(other.getSpend()); + spendCurrency(other.getSpendCurrency()); + statDate(other.getStatDate()); + statHour(other.getStatHour()); + return this; + } + + /** + *

The bucket's start time as a real UTC instant. (statDate, statHour) resolved in the ad account's reporting timezone — render this in the viewer's local timezone.

+ *

The bucket's start time as a real UTC instant. (statDate, statHour) resolved in the ad account's reporting timezone — render this in the viewer's local timezone.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bucket_start") + public ClicksStage bucketStart(@NotNull OffsetDateTime bucketStart) { + this.bucketStart = Objects.requireNonNull(bucketStart, "bucketStart must not be null"); + return this; + } + + /** + *

Clicks in this bucket.

+ *

Clicks in this bucket.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("clicks") + public GranularityStage clicks(int clicks) { + this.clicks = clicks; + return this; + } + + /** + *

The bucket size of this row (hourly, daily, weekly, or monthly).

+ *

The bucket size of this row (hourly, daily, weekly, or monthly).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("granularity") + public ImpressionsStage granularity(@NotNull Granularities granularity) { + this.granularity = Objects.requireNonNull(granularity, "granularity must not be null"); + return this; + } + + /** + *

Impressions in this bucket.

+ *

Impressions in this bucket.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("impressions") + public ReachStage impressions(int impressions) { + this.impressions = impressions; + return this; + } + + /** + *

Unique users reached in this bucket. Always 0 for hourly rows (Meta does not return reach at hourly grain).

+ *

Unique users reached in this bucket. Always 0 for hourly rows (Meta does not return reach at hourly grain).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reach") + public SpendStage reach(int reach) { + this.reach = reach; + return this; + } + + /** + *

Charged spend in this bucket in the requested reporting currency — the amount billed including platform fees, not the platform-side net spend.

+ *

Charged spend in this bucket in the requested reporting currency — the amount billed including platform fees, not the platform-side net spend.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("spend") + public SpendCurrencyStage spend(double spend) { + this.spend = spend; + return this; + } + + /** + *

Currency of the spend value.

+ *

Currency of the spend value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("spend_currency") + public StatDateStage spendCurrency(@NotNull Currencies spendCurrency) { + this.spendCurrency = Objects.requireNonNull(spendCurrency, "spendCurrency must not be null"); + return this; + } + + /** + *

The date these stats cover (midnight UTC). For hourly rows, see statHour and bucketStart.

+ *

The date these stats cover (midnight UTC). For hourly rows, see statHour and bucketStart.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("stat_date") + public _FinalStage statDate(@NotNull OffsetDateTime statDate) { + this.statDate = Objects.requireNonNull(statDate, "statDate must not be null"); + return this; + } + + /** + *

Hour of the day in the ad account's reporting timezone (0-23). null for daily rows.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statHour(Nullable statHour) { + if (statHour.isNull()) { + this.statHour = null; + } else if (statHour.isEmpty()) { + this.statHour = Optional.empty(); + } else { + this.statHour = Optional.of(statHour.get()); + } + return this; + } + + /** + *

Hour of the day in the ad account's reporting timezone (0-23). null for daily rows.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage statHour(Integer statHour) { + this.statHour = Optional.ofNullable(statHour); + return this; + } + + /** + *

Hour of the day in the ad account's reporting timezone (0-23). null for daily rows.

+ */ + @java.lang.Override + @JsonSetter(value = "stat_hour", nulls = Nulls.SKIP) + public _FinalStage statHour(Optional statHour) { + this.statHour = statHour; + return this; + } + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelOverride(Nullable resultLabelOverride) { + if (resultLabelOverride.isNull()) { + this.resultLabelOverride = null; + } else if (resultLabelOverride.isEmpty()) { + this.resultLabelOverride = Optional.empty(); + } else { + this.resultLabelOverride = Optional.of(resultLabelOverride.get()); + } + return this; + } + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelOverride(String resultLabelOverride) { + this.resultLabelOverride = Optional.ofNullable(resultLabelOverride); + return this; + } + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ */ + @java.lang.Override + @JsonSetter(value = "result_label_override", nulls = Nulls.SKIP) + public _FinalStage resultLabelOverride(Optional resultLabelOverride) { + this.resultLabelOverride = resultLabelOverride; + return this; + } + + /** + *

The type of optimization result represented by resultCount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelKey(Nullable resultLabelKey) { + if (resultLabelKey.isNull()) { + this.resultLabelKey = null; + } else if (resultLabelKey.isEmpty()) { + this.resultLabelKey = Optional.empty(); + } else { + this.resultLabelKey = Optional.of(resultLabelKey.get()); + } + return this; + } + + /** + *

The type of optimization result represented by resultCount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelKey(ResultLabelKeys resultLabelKey) { + this.resultLabelKey = Optional.ofNullable(resultLabelKey); + return this; + } + + /** + *

The type of optimization result represented by resultCount.

+ */ + @java.lang.Override + @JsonSetter(value = "result_label_key", nulls = Nulls.SKIP) + public _FinalStage resultLabelKey(Optional resultLabelKey) { + this.resultLabelKey = resultLabelKey; + return this; + } + + /** + *

Count of the primary optimization result in this bucket.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultCount(Nullable resultCount) { + if (resultCount.isNull()) { + this.resultCount = null; + } else if (resultCount.isEmpty()) { + this.resultCount = Optional.empty(); + } else { + this.resultCount = Optional.of(resultCount.get()); + } + return this; + } + + /** + *

Count of the primary optimization result in this bucket.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultCount(Integer resultCount) { + this.resultCount = Optional.ofNullable(resultCount); + return this; + } + + /** + *

Count of the primary optimization result in this bucket.

+ */ + @java.lang.Override + @JsonSetter(value = "result_count", nulls = Nulls.SKIP) + public _FinalStage resultCount(Optional resultCount) { + this.resultCount = resultCount; + return this; + } + + @java.lang.Override + public AdReportGranularityItem build() { + return new AdReportGranularityItem( + bucketStart, + clicks, + granularity, + impressions, + reach, + resultCount, + resultLabelKey, + resultLabelOverride, + spend, + spendCurrency, + statDate, + statHour, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdReportSummary.java b/src/main/java/com/whop/api/types/AdReportSummary.java new file mode 100644 index 00000000..bbcb95da --- /dev/null +++ b/src/main/java/com/whop/api/types/AdReportSummary.java @@ -0,0 +1,906 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdReportSummary.Builder.class) +public final class AdReportSummary { + private final double clickThroughRate; + + private final int clicks; + + private final double costPerClick; + + private final Optional costPerMille; + + private final Optional costPerResult; + + private final Optional frequency; + + private final int impressions; + + private final int reach; + + private final Optional resultCount; + + private final Optional resultLabelKey; + + private final Optional resultLabelOverride; + + private final Optional returnOnAdSpend; + + private final double spend; + + private final Optional spendCurrency; + + private final Map additionalProperties; + + private AdReportSummary( + double clickThroughRate, + int clicks, + double costPerClick, + Optional costPerMille, + Optional costPerResult, + Optional frequency, + int impressions, + int reach, + Optional resultCount, + Optional resultLabelKey, + Optional resultLabelOverride, + Optional returnOnAdSpend, + double spend, + Optional spendCurrency, + Map additionalProperties) { + this.clickThroughRate = clickThroughRate; + this.clicks = clicks; + this.costPerClick = costPerClick; + this.costPerMille = costPerMille; + this.costPerResult = costPerResult; + this.frequency = frequency; + this.impressions = impressions; + this.reach = reach; + this.resultCount = resultCount; + this.resultLabelKey = resultLabelKey; + this.resultLabelOverride = resultLabelOverride; + this.returnOnAdSpend = returnOnAdSpend; + this.spend = spend; + this.spendCurrency = spendCurrency; + this.additionalProperties = additionalProperties; + } + + /** + * @return Click-through rate (clicks / impressions). + */ + @JsonProperty("click_through_rate") + public double getClickThroughRate() { + return clickThroughRate; + } + + /** + * @return Total clicks over the date range. + */ + @JsonProperty("clicks") + public int getClicks() { + return clicks; + } + + /** + * @return Cost per click in the requested reporting currency. + */ + @JsonProperty("cost_per_click") + public double getCostPerClick() { + return costPerClick; + } + + /** + * @return Cost per thousand impressions in the requested reporting currency. + */ + @JsonIgnore + public Optional getCostPerMille() { + if (costPerMille == null) { + return Optional.empty(); + } + return costPerMille; + } + + /** + * @return Spend divided by resultCount. Null when there are no results. + */ + @JsonIgnore + public Optional getCostPerResult() { + if (costPerResult == null) { + return Optional.empty(); + } + return costPerResult; + } + + /** + * @return Average number of times each reached user saw an ad. + */ + @JsonIgnore + public Optional getFrequency() { + if (frequency == null) { + return Optional.empty(); + } + return frequency; + } + + /** + * @return Total impressions over the date range. + */ + @JsonProperty("impressions") + public int getImpressions() { + return impressions; + } + + /** + * @return Unique users reached, deduplicated by the external ad platform. + */ + @JsonProperty("reach") + public int getReach() { + return reach; + } + + /** + * @return Count of the campaign's primary optimization result (purchases, clicks, etc.) — see resultLabelKey. + */ + @JsonIgnore + public Optional getResultCount() { + if (resultCount == null) { + return Optional.empty(); + } + return resultCount; + } + + /** + * @return The type of optimization result represented by resultCount. + */ + @JsonIgnore + public Optional getResultLabelKey() { + if (resultLabelKey == null) { + return Optional.empty(); + } + return resultLabelKey; + } + + /** + * @return Advertiser-defined label for the result when resultLabelKey is custom. + */ + @JsonIgnore + public Optional getResultLabelOverride() { + if (resultLabelOverride == null) { + return Optional.empty(); + } + return resultLabelOverride; + } + + /** + * @return Alias for purchaseReturnOnAdSpend — return on ad spend for purchases, as reported by the external ad platform. + */ + @JsonIgnore + public Optional getReturnOnAdSpend() { + if (returnOnAdSpend == null) { + return Optional.empty(); + } + return returnOnAdSpend; + } + + /** + * @return Total spend over the date range in the requested reporting currency. + */ + @JsonProperty("spend") + public double getSpend() { + return spend; + } + + /** + * @return Currency of the spend value. Matches the requested currency when set. + */ + @JsonIgnore + public Optional getSpendCurrency() { + if (spendCurrency == null) { + return Optional.empty(); + } + return spendCurrency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_mille") + private Optional _getCostPerMille() { + return costPerMille; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cost_per_result") + private Optional _getCostPerResult() { + return costPerResult; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("frequency") + private Optional _getFrequency() { + return frequency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_count") + private Optional _getResultCount() { + return resultCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_label_key") + private Optional _getResultLabelKey() { + return resultLabelKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("result_label_override") + private Optional _getResultLabelOverride() { + return resultLabelOverride; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("return_on_ad_spend") + private Optional _getReturnOnAdSpend() { + return returnOnAdSpend; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("spend_currency") + private Optional _getSpendCurrency() { + return spendCurrency; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdReportSummary && equalTo((AdReportSummary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdReportSummary other) { + return clickThroughRate == other.clickThroughRate + && clicks == other.clicks + && costPerClick == other.costPerClick + && costPerMille.equals(other.costPerMille) + && costPerResult.equals(other.costPerResult) + && frequency.equals(other.frequency) + && impressions == other.impressions + && reach == other.reach + && resultCount.equals(other.resultCount) + && resultLabelKey.equals(other.resultLabelKey) + && resultLabelOverride.equals(other.resultLabelOverride) + && returnOnAdSpend.equals(other.returnOnAdSpend) + && spend == other.spend + && spendCurrency.equals(other.spendCurrency); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.clickThroughRate, + this.clicks, + this.costPerClick, + this.costPerMille, + this.costPerResult, + this.frequency, + this.impressions, + this.reach, + this.resultCount, + this.resultLabelKey, + this.resultLabelOverride, + this.returnOnAdSpend, + this.spend, + this.spendCurrency); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ClickThroughRateStage builder() { + return new Builder(); + } + + public interface ClickThroughRateStage { + /** + *

Click-through rate (clicks / impressions).

+ */ + ClicksStage clickThroughRate(double clickThroughRate); + + Builder from(AdReportSummary other); + } + + public interface ClicksStage { + /** + *

Total clicks over the date range.

+ */ + CostPerClickStage clicks(int clicks); + } + + public interface CostPerClickStage { + /** + *

Cost per click in the requested reporting currency.

+ */ + ImpressionsStage costPerClick(double costPerClick); + } + + public interface ImpressionsStage { + /** + *

Total impressions over the date range.

+ */ + ReachStage impressions(int impressions); + } + + public interface ReachStage { + /** + *

Unique users reached, deduplicated by the external ad platform.

+ */ + SpendStage reach(int reach); + } + + public interface SpendStage { + /** + *

Total spend over the date range in the requested reporting currency.

+ */ + _FinalStage spend(double spend); + } + + public interface _FinalStage { + AdReportSummary build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Cost per thousand impressions in the requested reporting currency.

+ */ + _FinalStage costPerMille(Optional costPerMille); + + _FinalStage costPerMille(Double costPerMille); + + _FinalStage costPerMille(Nullable costPerMille); + + /** + *

Spend divided by resultCount. Null when there are no results.

+ */ + _FinalStage costPerResult(Optional costPerResult); + + _FinalStage costPerResult(Double costPerResult); + + _FinalStage costPerResult(Nullable costPerResult); + + /** + *

Average number of times each reached user saw an ad.

+ */ + _FinalStage frequency(Optional frequency); + + _FinalStage frequency(Double frequency); + + _FinalStage frequency(Nullable frequency); + + /** + *

Count of the campaign's primary optimization result (purchases, clicks, etc.) — see resultLabelKey.

+ */ + _FinalStage resultCount(Optional resultCount); + + _FinalStage resultCount(Integer resultCount); + + _FinalStage resultCount(Nullable resultCount); + + /** + *

The type of optimization result represented by resultCount.

+ */ + _FinalStage resultLabelKey(Optional resultLabelKey); + + _FinalStage resultLabelKey(ResultLabelKeys resultLabelKey); + + _FinalStage resultLabelKey(Nullable resultLabelKey); + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ */ + _FinalStage resultLabelOverride(Optional resultLabelOverride); + + _FinalStage resultLabelOverride(String resultLabelOverride); + + _FinalStage resultLabelOverride(Nullable resultLabelOverride); + + /** + *

Alias for purchaseReturnOnAdSpend — return on ad spend for purchases, as reported by the external ad platform.

+ */ + _FinalStage returnOnAdSpend(Optional returnOnAdSpend); + + _FinalStage returnOnAdSpend(Double returnOnAdSpend); + + _FinalStage returnOnAdSpend(Nullable returnOnAdSpend); + + /** + *

Currency of the spend value. Matches the requested currency when set.

+ */ + _FinalStage spendCurrency(Optional spendCurrency); + + _FinalStage spendCurrency(Currencies spendCurrency); + + _FinalStage spendCurrency(Nullable spendCurrency); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ClickThroughRateStage, + ClicksStage, + CostPerClickStage, + ImpressionsStage, + ReachStage, + SpendStage, + _FinalStage { + private double clickThroughRate; + + private int clicks; + + private double costPerClick; + + private int impressions; + + private int reach; + + private double spend; + + private Optional spendCurrency = Optional.empty(); + + private Optional returnOnAdSpend = Optional.empty(); + + private Optional resultLabelOverride = Optional.empty(); + + private Optional resultLabelKey = Optional.empty(); + + private Optional resultCount = Optional.empty(); + + private Optional frequency = Optional.empty(); + + private Optional costPerResult = Optional.empty(); + + private Optional costPerMille = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdReportSummary other) { + clickThroughRate(other.getClickThroughRate()); + clicks(other.getClicks()); + costPerClick(other.getCostPerClick()); + costPerMille(other.getCostPerMille()); + costPerResult(other.getCostPerResult()); + frequency(other.getFrequency()); + impressions(other.getImpressions()); + reach(other.getReach()); + resultCount(other.getResultCount()); + resultLabelKey(other.getResultLabelKey()); + resultLabelOverride(other.getResultLabelOverride()); + returnOnAdSpend(other.getReturnOnAdSpend()); + spend(other.getSpend()); + spendCurrency(other.getSpendCurrency()); + return this; + } + + /** + *

Click-through rate (clicks / impressions).

+ *

Click-through rate (clicks / impressions).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("click_through_rate") + public ClicksStage clickThroughRate(double clickThroughRate) { + this.clickThroughRate = clickThroughRate; + return this; + } + + /** + *

Total clicks over the date range.

+ *

Total clicks over the date range.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("clicks") + public CostPerClickStage clicks(int clicks) { + this.clicks = clicks; + return this; + } + + /** + *

Cost per click in the requested reporting currency.

+ *

Cost per click in the requested reporting currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cost_per_click") + public ImpressionsStage costPerClick(double costPerClick) { + this.costPerClick = costPerClick; + return this; + } + + /** + *

Total impressions over the date range.

+ *

Total impressions over the date range.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("impressions") + public ReachStage impressions(int impressions) { + this.impressions = impressions; + return this; + } + + /** + *

Unique users reached, deduplicated by the external ad platform.

+ *

Unique users reached, deduplicated by the external ad platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reach") + public SpendStage reach(int reach) { + this.reach = reach; + return this; + } + + /** + *

Total spend over the date range in the requested reporting currency.

+ *

Total spend over the date range in the requested reporting currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("spend") + public _FinalStage spend(double spend) { + this.spend = spend; + return this; + } + + /** + *

Currency of the spend value. Matches the requested currency when set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spendCurrency(Nullable spendCurrency) { + if (spendCurrency.isNull()) { + this.spendCurrency = null; + } else if (spendCurrency.isEmpty()) { + this.spendCurrency = Optional.empty(); + } else { + this.spendCurrency = Optional.of(spendCurrency.get()); + } + return this; + } + + /** + *

Currency of the spend value. Matches the requested currency when set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage spendCurrency(Currencies spendCurrency) { + this.spendCurrency = Optional.ofNullable(spendCurrency); + return this; + } + + /** + *

Currency of the spend value. Matches the requested currency when set.

+ */ + @java.lang.Override + @JsonSetter(value = "spend_currency", nulls = Nulls.SKIP) + public _FinalStage spendCurrency(Optional spendCurrency) { + this.spendCurrency = spendCurrency; + return this; + } + + /** + *

Alias for purchaseReturnOnAdSpend — return on ad spend for purchases, as reported by the external ad platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnOnAdSpend(Nullable returnOnAdSpend) { + if (returnOnAdSpend.isNull()) { + this.returnOnAdSpend = null; + } else if (returnOnAdSpend.isEmpty()) { + this.returnOnAdSpend = Optional.empty(); + } else { + this.returnOnAdSpend = Optional.of(returnOnAdSpend.get()); + } + return this; + } + + /** + *

Alias for purchaseReturnOnAdSpend — return on ad spend for purchases, as reported by the external ad platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnOnAdSpend(Double returnOnAdSpend) { + this.returnOnAdSpend = Optional.ofNullable(returnOnAdSpend); + return this; + } + + /** + *

Alias for purchaseReturnOnAdSpend — return on ad spend for purchases, as reported by the external ad platform.

+ */ + @java.lang.Override + @JsonSetter(value = "return_on_ad_spend", nulls = Nulls.SKIP) + public _FinalStage returnOnAdSpend(Optional returnOnAdSpend) { + this.returnOnAdSpend = returnOnAdSpend; + return this; + } + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelOverride(Nullable resultLabelOverride) { + if (resultLabelOverride.isNull()) { + this.resultLabelOverride = null; + } else if (resultLabelOverride.isEmpty()) { + this.resultLabelOverride = Optional.empty(); + } else { + this.resultLabelOverride = Optional.of(resultLabelOverride.get()); + } + return this; + } + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelOverride(String resultLabelOverride) { + this.resultLabelOverride = Optional.ofNullable(resultLabelOverride); + return this; + } + + /** + *

Advertiser-defined label for the result when resultLabelKey is custom.

+ */ + @java.lang.Override + @JsonSetter(value = "result_label_override", nulls = Nulls.SKIP) + public _FinalStage resultLabelOverride(Optional resultLabelOverride) { + this.resultLabelOverride = resultLabelOverride; + return this; + } + + /** + *

The type of optimization result represented by resultCount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelKey(Nullable resultLabelKey) { + if (resultLabelKey.isNull()) { + this.resultLabelKey = null; + } else if (resultLabelKey.isEmpty()) { + this.resultLabelKey = Optional.empty(); + } else { + this.resultLabelKey = Optional.of(resultLabelKey.get()); + } + return this; + } + + /** + *

The type of optimization result represented by resultCount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultLabelKey(ResultLabelKeys resultLabelKey) { + this.resultLabelKey = Optional.ofNullable(resultLabelKey); + return this; + } + + /** + *

The type of optimization result represented by resultCount.

+ */ + @java.lang.Override + @JsonSetter(value = "result_label_key", nulls = Nulls.SKIP) + public _FinalStage resultLabelKey(Optional resultLabelKey) { + this.resultLabelKey = resultLabelKey; + return this; + } + + /** + *

Count of the campaign's primary optimization result (purchases, clicks, etc.) — see resultLabelKey.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultCount(Nullable resultCount) { + if (resultCount.isNull()) { + this.resultCount = null; + } else if (resultCount.isEmpty()) { + this.resultCount = Optional.empty(); + } else { + this.resultCount = Optional.of(resultCount.get()); + } + return this; + } + + /** + *

Count of the campaign's primary optimization result (purchases, clicks, etc.) — see resultLabelKey.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resultCount(Integer resultCount) { + this.resultCount = Optional.ofNullable(resultCount); + return this; + } + + /** + *

Count of the campaign's primary optimization result (purchases, clicks, etc.) — see resultLabelKey.

+ */ + @java.lang.Override + @JsonSetter(value = "result_count", nulls = Nulls.SKIP) + public _FinalStage resultCount(Optional resultCount) { + this.resultCount = resultCount; + return this; + } + + /** + *

Average number of times each reached user saw an ad.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frequency(Nullable frequency) { + if (frequency.isNull()) { + this.frequency = null; + } else if (frequency.isEmpty()) { + this.frequency = Optional.empty(); + } else { + this.frequency = Optional.of(frequency.get()); + } + return this; + } + + /** + *

Average number of times each reached user saw an ad.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frequency(Double frequency) { + this.frequency = Optional.ofNullable(frequency); + return this; + } + + /** + *

Average number of times each reached user saw an ad.

+ */ + @java.lang.Override + @JsonSetter(value = "frequency", nulls = Nulls.SKIP) + public _FinalStage frequency(Optional frequency) { + this.frequency = frequency; + return this; + } + + /** + *

Spend divided by resultCount. Null when there are no results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerResult(Nullable costPerResult) { + if (costPerResult.isNull()) { + this.costPerResult = null; + } else if (costPerResult.isEmpty()) { + this.costPerResult = Optional.empty(); + } else { + this.costPerResult = Optional.of(costPerResult.get()); + } + return this; + } + + /** + *

Spend divided by resultCount. Null when there are no results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerResult(Double costPerResult) { + this.costPerResult = Optional.ofNullable(costPerResult); + return this; + } + + /** + *

Spend divided by resultCount. Null when there are no results.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_result", nulls = Nulls.SKIP) + public _FinalStage costPerResult(Optional costPerResult) { + this.costPerResult = costPerResult; + return this; + } + + /** + *

Cost per thousand impressions in the requested reporting currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerMille(Nullable costPerMille) { + if (costPerMille.isNull()) { + this.costPerMille = null; + } else if (costPerMille.isEmpty()) { + this.costPerMille = Optional.empty(); + } else { + this.costPerMille = Optional.of(costPerMille.get()); + } + return this; + } + + /** + *

Cost per thousand impressions in the requested reporting currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costPerMille(Double costPerMille) { + this.costPerMille = Optional.ofNullable(costPerMille); + return this; + } + + /** + *

Cost per thousand impressions in the requested reporting currency.

+ */ + @java.lang.Override + @JsonSetter(value = "cost_per_mille", nulls = Nulls.SKIP) + public _FinalStage costPerMille(Optional costPerMille) { + this.costPerMille = costPerMille; + return this; + } + + @java.lang.Override + public AdReportSummary build() { + return new AdReportSummary( + clickThroughRate, + clicks, + costPerClick, + costPerMille, + costPerResult, + frequency, + impressions, + reach, + resultCount, + resultLabelKey, + resultLabelOverride, + returnOnAdSpend, + spend, + spendCurrency, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AdResultEvent.java b/src/main/java/com/whop/api/types/AdResultEvent.java new file mode 100644 index 00000000..d6b702a3 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdResultEvent.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdResultEvent { + public static final AdResultEvent PURCHASE = new AdResultEvent(Value.PURCHASE, "purchase"); + + public static final AdResultEvent SUBMIT_APPLICATION = + new AdResultEvent(Value.SUBMIT_APPLICATION, "submit_application"); + + public static final AdResultEvent SCHEDULE = new AdResultEvent(Value.SCHEDULE, "schedule"); + + public static final AdResultEvent COMPLETE_REGISTRATION = + new AdResultEvent(Value.COMPLETE_REGISTRATION, "complete_registration"); + + public static final AdResultEvent ADD_TO_CART = new AdResultEvent(Value.ADD_TO_CART, "add_to_cart"); + + public static final AdResultEvent CUSTOM = new AdResultEvent(Value.CUSTOM, "custom"); + + public static final AdResultEvent CONTACT = new AdResultEvent(Value.CONTACT, "contact"); + + public static final AdResultEvent MESSAGING_CONVERSATION = + new AdResultEvent(Value.MESSAGING_CONVERSATION, "messaging_conversation"); + + public static final AdResultEvent VIEW_CONTENT = new AdResultEvent(Value.VIEW_CONTENT, "view_content"); + + public static final AdResultEvent LEAD = new AdResultEvent(Value.LEAD, "lead"); + + private final Value value; + + private final String string; + + AdResultEvent(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdResultEvent && this.string.equals(((AdResultEvent) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PURCHASE: + return visitor.visitPurchase(); + case SUBMIT_APPLICATION: + return visitor.visitSubmitApplication(); + case SCHEDULE: + return visitor.visitSchedule(); + case COMPLETE_REGISTRATION: + return visitor.visitCompleteRegistration(); + case ADD_TO_CART: + return visitor.visitAddToCart(); + case CUSTOM: + return visitor.visitCustom(); + case CONTACT: + return visitor.visitContact(); + case MESSAGING_CONVERSATION: + return visitor.visitMessagingConversation(); + case VIEW_CONTENT: + return visitor.visitViewContent(); + case LEAD: + return visitor.visitLead(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdResultEvent valueOf(String value) { + switch (value) { + case "purchase": + return PURCHASE; + case "submit_application": + return SUBMIT_APPLICATION; + case "schedule": + return SCHEDULE; + case "complete_registration": + return COMPLETE_REGISTRATION; + case "add_to_cart": + return ADD_TO_CART; + case "custom": + return CUSTOM; + case "contact": + return CONTACT; + case "messaging_conversation": + return MESSAGING_CONVERSATION; + case "view_content": + return VIEW_CONTENT; + case "lead": + return LEAD; + default: + return new AdResultEvent(Value.UNKNOWN, value); + } + } + + public enum Value { + PURCHASE, + + LEAD, + + SCHEDULE, + + SUBMIT_APPLICATION, + + CONTACT, + + COMPLETE_REGISTRATION, + + VIEW_CONTENT, + + ADD_TO_CART, + + CUSTOM, + + MESSAGING_CONVERSATION, + + UNKNOWN + } + + public interface Visitor { + T visitPurchase(); + + T visitLead(); + + T visitSchedule(); + + T visitSubmitApplication(); + + T visitContact(); + + T visitCompleteRegistration(); + + T visitViewContent(); + + T visitAddToCart(); + + T visitCustom(); + + T visitMessagingConversation(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AdStatus.java b/src/main/java/com/whop/api/types/AdStatus.java new file mode 100644 index 00000000..8b16e169 --- /dev/null +++ b/src/main/java/com/whop/api/types/AdStatus.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdStatus { + public static final AdStatus PAUSED = new AdStatus(Value.PAUSED, "paused"); + + public static final AdStatus REJECTED = new AdStatus(Value.REJECTED, "rejected"); + + public static final AdStatus IN_REVIEW = new AdStatus(Value.IN_REVIEW, "in_review"); + + public static final AdStatus ACTIVE = new AdStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + AdStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof AdStatus && this.string.equals(((AdStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAUSED: + return visitor.visitPaused(); + case REJECTED: + return visitor.visitRejected(); + case IN_REVIEW: + return visitor.visitInReview(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdStatus valueOf(String value) { + switch (value) { + case "paused": + return PAUSED; + case "rejected": + return REJECTED; + case "in_review": + return IN_REVIEW; + case "active": + return ACTIVE; + default: + return new AdStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + PAUSED, + + IN_REVIEW, + + REJECTED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitPaused(); + + T visitInReview(); + + T visitRejected(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Affiliate.java b/src/main/java/com/whop/api/types/Affiliate.java new file mode 100644 index 00000000..e47e6698 --- /dev/null +++ b/src/main/java/com/whop/api/types/Affiliate.java @@ -0,0 +1,674 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Affiliate.Builder.class) +public final class Affiliate { + private final int activeMembersCount; + + private final AffiliateCompany company; + + private final OffsetDateTime createdAt; + + private final String customerRetentionRate; + + private final String customerRetentionRateNinetyDays; + + private final String id; + + private final String monthlyRecurringRevenueUsd; + + private final Optional status; + + private final int totalOverridesCount; + + private final String totalReferralEarningsUsd; + + private final int totalReferralsCount; + + private final String totalRevenueUsd; + + private final OffsetDateTime updatedAt; + + private final AffiliateUser user; + + private final Map additionalProperties; + + private Affiliate( + int activeMembersCount, + AffiliateCompany company, + OffsetDateTime createdAt, + String customerRetentionRate, + String customerRetentionRateNinetyDays, + String id, + String monthlyRecurringRevenueUsd, + Optional status, + int totalOverridesCount, + String totalReferralEarningsUsd, + int totalReferralsCount, + String totalRevenueUsd, + OffsetDateTime updatedAt, + AffiliateUser user, + Map additionalProperties) { + this.activeMembersCount = activeMembersCount; + this.company = company; + this.createdAt = createdAt; + this.customerRetentionRate = customerRetentionRate; + this.customerRetentionRateNinetyDays = customerRetentionRateNinetyDays; + this.id = id; + this.monthlyRecurringRevenueUsd = monthlyRecurringRevenueUsd; + this.status = status; + this.totalOverridesCount = totalOverridesCount; + this.totalReferralEarningsUsd = totalReferralEarningsUsd; + this.totalReferralsCount = totalReferralsCount; + this.totalRevenueUsd = totalRevenueUsd; + this.updatedAt = updatedAt; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The total active members of the affiliate + */ + @JsonProperty("active_members_count") + public int getActiveMembersCount() { + return activeMembersCount; + } + + /** + * @return The company attached to this affiliate + */ + @JsonProperty("company") + public AffiliateCompany getCompany() { + return company; + } + + /** + * @return The datetime the affiliate was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The percentage of referred customers who are still active members + */ + @JsonProperty("customer_retention_rate") + public String getCustomerRetentionRate() { + return customerRetentionRate; + } + + /** + * @return The percentage of referred customers who remained active over the last 90 days + */ + @JsonProperty("customer_retention_rate_ninety_days") + public String getCustomerRetentionRateNinetyDays() { + return customerRetentionRateNinetyDays; + } + + /** + * @return The unique identifier for the affiliate. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The monthly recurring revenue generated by this affiliate's referrals, formatted as a USD currency string + */ + @JsonProperty("monthly_recurring_revenue_usd") + public String getMonthlyRecurringRevenueUsd() { + return monthlyRecurringRevenueUsd; + } + + /** + * @return The status of the affiliate + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The total count of all overrides for this affiliate + */ + @JsonProperty("total_overrides_count") + public int getTotalOverridesCount() { + return totalOverridesCount; + } + + /** + * @return The total commission earnings paid to this affiliate, formatted as a USD currency string + */ + @JsonProperty("total_referral_earnings_usd") + public String getTotalReferralEarningsUsd() { + return totalReferralEarningsUsd; + } + + /** + * @return The total referrals of the affiliate + */ + @JsonProperty("total_referrals_count") + public int getTotalReferralsCount() { + return totalReferralsCount; + } + + /** + * @return The total revenue generated from this affiliate's referrals, formatted as a USD currency string + */ + @JsonProperty("total_revenue_usd") + public String getTotalRevenueUsd() { + return totalRevenueUsd; + } + + /** + * @return The datetime the affiliate was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user attached to this affiliate + */ + @JsonProperty("user") + public AffiliateUser getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Affiliate && equalTo((Affiliate) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Affiliate other) { + return activeMembersCount == other.activeMembersCount + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && customerRetentionRate.equals(other.customerRetentionRate) + && customerRetentionRateNinetyDays.equals(other.customerRetentionRateNinetyDays) + && id.equals(other.id) + && monthlyRecurringRevenueUsd.equals(other.monthlyRecurringRevenueUsd) + && status.equals(other.status) + && totalOverridesCount == other.totalOverridesCount + && totalReferralEarningsUsd.equals(other.totalReferralEarningsUsd) + && totalReferralsCount == other.totalReferralsCount + && totalRevenueUsd.equals(other.totalRevenueUsd) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.activeMembersCount, + this.company, + this.createdAt, + this.customerRetentionRate, + this.customerRetentionRateNinetyDays, + this.id, + this.monthlyRecurringRevenueUsd, + this.status, + this.totalOverridesCount, + this.totalReferralEarningsUsd, + this.totalReferralsCount, + this.totalRevenueUsd, + this.updatedAt, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActiveMembersCountStage builder() { + return new Builder(); + } + + public interface ActiveMembersCountStage { + /** + *

The total active members of the affiliate

+ */ + CompanyStage activeMembersCount(int activeMembersCount); + + Builder from(Affiliate other); + } + + public interface CompanyStage { + /** + *

The company attached to this affiliate

+ */ + CreatedAtStage company(@NotNull AffiliateCompany company); + } + + public interface CreatedAtStage { + /** + *

The datetime the affiliate was created.

+ */ + CustomerRetentionRateStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CustomerRetentionRateStage { + /** + *

The percentage of referred customers who are still active members

+ */ + CustomerRetentionRateNinetyDaysStage customerRetentionRate(@NotNull String customerRetentionRate); + } + + public interface CustomerRetentionRateNinetyDaysStage { + /** + *

The percentage of referred customers who remained active over the last 90 days

+ */ + IdStage customerRetentionRateNinetyDays(@NotNull String customerRetentionRateNinetyDays); + } + + public interface IdStage { + /** + *

The unique identifier for the affiliate.

+ */ + MonthlyRecurringRevenueUsdStage id(@NotNull String id); + } + + public interface MonthlyRecurringRevenueUsdStage { + /** + *

The monthly recurring revenue generated by this affiliate's referrals, formatted as a USD currency string

+ */ + TotalOverridesCountStage monthlyRecurringRevenueUsd(@NotNull String monthlyRecurringRevenueUsd); + } + + public interface TotalOverridesCountStage { + /** + *

The total count of all overrides for this affiliate

+ */ + TotalReferralEarningsUsdStage totalOverridesCount(int totalOverridesCount); + } + + public interface TotalReferralEarningsUsdStage { + /** + *

The total commission earnings paid to this affiliate, formatted as a USD currency string

+ */ + TotalReferralsCountStage totalReferralEarningsUsd(@NotNull String totalReferralEarningsUsd); + } + + public interface TotalReferralsCountStage { + /** + *

The total referrals of the affiliate

+ */ + TotalRevenueUsdStage totalReferralsCount(int totalReferralsCount); + } + + public interface TotalRevenueUsdStage { + /** + *

The total revenue generated from this affiliate's referrals, formatted as a USD currency string

+ */ + UpdatedAtStage totalRevenueUsd(@NotNull String totalRevenueUsd); + } + + public interface UpdatedAtStage { + /** + *

The datetime the affiliate was last updated.

+ */ + UserStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UserStage { + /** + *

The user attached to this affiliate

+ */ + _FinalStage user(@NotNull AffiliateUser user); + } + + public interface _FinalStage { + Affiliate build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The status of the affiliate

+ */ + _FinalStage status(Optional status); + + _FinalStage status(Status status); + + _FinalStage status(Nullable status); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ActiveMembersCountStage, + CompanyStage, + CreatedAtStage, + CustomerRetentionRateStage, + CustomerRetentionRateNinetyDaysStage, + IdStage, + MonthlyRecurringRevenueUsdStage, + TotalOverridesCountStage, + TotalReferralEarningsUsdStage, + TotalReferralsCountStage, + TotalRevenueUsdStage, + UpdatedAtStage, + UserStage, + _FinalStage { + private int activeMembersCount; + + private AffiliateCompany company; + + private OffsetDateTime createdAt; + + private String customerRetentionRate; + + private String customerRetentionRateNinetyDays; + + private String id; + + private String monthlyRecurringRevenueUsd; + + private int totalOverridesCount; + + private String totalReferralEarningsUsd; + + private int totalReferralsCount; + + private String totalRevenueUsd; + + private OffsetDateTime updatedAt; + + private AffiliateUser user; + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Affiliate other) { + activeMembersCount(other.getActiveMembersCount()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + customerRetentionRate(other.getCustomerRetentionRate()); + customerRetentionRateNinetyDays(other.getCustomerRetentionRateNinetyDays()); + id(other.getId()); + monthlyRecurringRevenueUsd(other.getMonthlyRecurringRevenueUsd()); + status(other.getStatus()); + totalOverridesCount(other.getTotalOverridesCount()); + totalReferralEarningsUsd(other.getTotalReferralEarningsUsd()); + totalReferralsCount(other.getTotalReferralsCount()); + totalRevenueUsd(other.getTotalRevenueUsd()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + return this; + } + + /** + *

The total active members of the affiliate

+ *

The total active members of the affiliate

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("active_members_count") + public CompanyStage activeMembersCount(int activeMembersCount) { + this.activeMembersCount = activeMembersCount; + return this; + } + + /** + *

The company attached to this affiliate

+ *

The company attached to this affiliate

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company") + public CreatedAtStage company(@NotNull AffiliateCompany company) { + this.company = Objects.requireNonNull(company, "company must not be null"); + return this; + } + + /** + *

The datetime the affiliate was created.

+ *

The datetime the affiliate was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CustomerRetentionRateStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The percentage of referred customers who are still active members

+ *

The percentage of referred customers who are still active members

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("customer_retention_rate") + public CustomerRetentionRateNinetyDaysStage customerRetentionRate(@NotNull String customerRetentionRate) { + this.customerRetentionRate = + Objects.requireNonNull(customerRetentionRate, "customerRetentionRate must not be null"); + return this; + } + + /** + *

The percentage of referred customers who remained active over the last 90 days

+ *

The percentage of referred customers who remained active over the last 90 days

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("customer_retention_rate_ninety_days") + public IdStage customerRetentionRateNinetyDays(@NotNull String customerRetentionRateNinetyDays) { + this.customerRetentionRateNinetyDays = Objects.requireNonNull( + customerRetentionRateNinetyDays, "customerRetentionRateNinetyDays must not be null"); + return this; + } + + /** + *

The unique identifier for the affiliate.

+ *

The unique identifier for the affiliate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MonthlyRecurringRevenueUsdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The monthly recurring revenue generated by this affiliate's referrals, formatted as a USD currency string

+ *

The monthly recurring revenue generated by this affiliate's referrals, formatted as a USD currency string

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("monthly_recurring_revenue_usd") + public TotalOverridesCountStage monthlyRecurringRevenueUsd(@NotNull String monthlyRecurringRevenueUsd) { + this.monthlyRecurringRevenueUsd = + Objects.requireNonNull(monthlyRecurringRevenueUsd, "monthlyRecurringRevenueUsd must not be null"); + return this; + } + + /** + *

The total count of all overrides for this affiliate

+ *

The total count of all overrides for this affiliate

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_overrides_count") + public TotalReferralEarningsUsdStage totalOverridesCount(int totalOverridesCount) { + this.totalOverridesCount = totalOverridesCount; + return this; + } + + /** + *

The total commission earnings paid to this affiliate, formatted as a USD currency string

+ *

The total commission earnings paid to this affiliate, formatted as a USD currency string

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_referral_earnings_usd") + public TotalReferralsCountStage totalReferralEarningsUsd(@NotNull String totalReferralEarningsUsd) { + this.totalReferralEarningsUsd = + Objects.requireNonNull(totalReferralEarningsUsd, "totalReferralEarningsUsd must not be null"); + return this; + } + + /** + *

The total referrals of the affiliate

+ *

The total referrals of the affiliate

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_referrals_count") + public TotalRevenueUsdStage totalReferralsCount(int totalReferralsCount) { + this.totalReferralsCount = totalReferralsCount; + return this; + } + + /** + *

The total revenue generated from this affiliate's referrals, formatted as a USD currency string

+ *

The total revenue generated from this affiliate's referrals, formatted as a USD currency string

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_revenue_usd") + public UpdatedAtStage totalRevenueUsd(@NotNull String totalRevenueUsd) { + this.totalRevenueUsd = Objects.requireNonNull(totalRevenueUsd, "totalRevenueUsd must not be null"); + return this; + } + + /** + *

The datetime the affiliate was last updated.

+ *

The datetime the affiliate was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UserStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user attached to this affiliate

+ *

The user attached to this affiliate

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull AffiliateUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

The status of the affiliate

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The status of the affiliate

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Status status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The status of the affiliate

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + @java.lang.Override + public Affiliate build() { + return new Affiliate( + activeMembersCount, + company, + createdAt, + customerRetentionRate, + customerRetentionRateNinetyDays, + id, + monthlyRecurringRevenueUsd, + status, + totalOverridesCount, + totalReferralEarningsUsd, + totalReferralsCount, + totalRevenueUsd, + updatedAt, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AffiliateAppliesToPayments.java b/src/main/java/com/whop/api/types/AffiliateAppliesToPayments.java new file mode 100644 index 00000000..1ea32fea --- /dev/null +++ b/src/main/java/com/whop/api/types/AffiliateAppliesToPayments.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AffiliateAppliesToPayments { + public static final AffiliateAppliesToPayments FIRST_PAYMENT = + new AffiliateAppliesToPayments(Value.FIRST_PAYMENT, "first_payment"); + + public static final AffiliateAppliesToPayments ALL_PAYMENTS = + new AffiliateAppliesToPayments(Value.ALL_PAYMENTS, "all_payments"); + + private final Value value; + + private final String string; + + AffiliateAppliesToPayments(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AffiliateAppliesToPayments + && this.string.equals(((AffiliateAppliesToPayments) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FIRST_PAYMENT: + return visitor.visitFirstPayment(); + case ALL_PAYMENTS: + return visitor.visitAllPayments(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AffiliateAppliesToPayments valueOf(String value) { + switch (value) { + case "first_payment": + return FIRST_PAYMENT; + case "all_payments": + return ALL_PAYMENTS; + default: + return new AffiliateAppliesToPayments(Value.UNKNOWN, value); + } + } + + public enum Value { + FIRST_PAYMENT, + + ALL_PAYMENTS, + + UNKNOWN + } + + public interface Visitor { + T visitFirstPayment(); + + T visitAllPayments(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AffiliateAppliesToProducts.java b/src/main/java/com/whop/api/types/AffiliateAppliesToProducts.java new file mode 100644 index 00000000..1c7a9948 --- /dev/null +++ b/src/main/java/com/whop/api/types/AffiliateAppliesToProducts.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AffiliateAppliesToProducts { + public static final AffiliateAppliesToProducts ALL_PRODUCTS = + new AffiliateAppliesToProducts(Value.ALL_PRODUCTS, "all_products"); + + public static final AffiliateAppliesToProducts SINGLE_PRODUCT = + new AffiliateAppliesToProducts(Value.SINGLE_PRODUCT, "single_product"); + + private final Value value; + + private final String string; + + AffiliateAppliesToProducts(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AffiliateAppliesToProducts + && this.string.equals(((AffiliateAppliesToProducts) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ALL_PRODUCTS: + return visitor.visitAllProducts(); + case SINGLE_PRODUCT: + return visitor.visitSingleProduct(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AffiliateAppliesToProducts valueOf(String value) { + switch (value) { + case "all_products": + return ALL_PRODUCTS; + case "single_product": + return SINGLE_PRODUCT; + default: + return new AffiliateAppliesToProducts(Value.UNKNOWN, value); + } + } + + public enum Value { + SINGLE_PRODUCT, + + ALL_PRODUCTS, + + UNKNOWN + } + + public interface Visitor { + T visitSingleProduct(); + + T visitAllProducts(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AffiliateCompany.java b/src/main/java/com/whop/api/types/AffiliateCompany.java new file mode 100644 index 00000000..2749aacc --- /dev/null +++ b/src/main/java/com/whop/api/types/AffiliateCompany.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AffiliateCompany.Builder.class) +public final class AffiliateCompany { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private AffiliateCompany(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The written name of the company. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AffiliateCompany && equalTo((AffiliateCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AffiliateCompany other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + TitleStage id(@NotNull String id); + + Builder from(AffiliateCompany other); + } + + public interface TitleStage { + /** + *

The written name of the company.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + AffiliateCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AffiliateCompany other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The written name of the company.

+ *

The written name of the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public AffiliateCompany build() { + return new AffiliateCompany(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AffiliateListItem.java b/src/main/java/com/whop/api/types/AffiliateListItem.java new file mode 100644 index 00000000..fa6eff2d --- /dev/null +++ b/src/main/java/com/whop/api/types/AffiliateListItem.java @@ -0,0 +1,674 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AffiliateListItem.Builder.class) +public final class AffiliateListItem { + private final int activeMembersCount; + + private final AffiliateListItemCompany company; + + private final OffsetDateTime createdAt; + + private final String customerRetentionRate; + + private final String customerRetentionRateNinetyDays; + + private final String id; + + private final String monthlyRecurringRevenueUsd; + + private final Optional status; + + private final int totalOverridesCount; + + private final String totalReferralEarningsUsd; + + private final int totalReferralsCount; + + private final String totalRevenueUsd; + + private final OffsetDateTime updatedAt; + + private final AffiliateListItemUser user; + + private final Map additionalProperties; + + private AffiliateListItem( + int activeMembersCount, + AffiliateListItemCompany company, + OffsetDateTime createdAt, + String customerRetentionRate, + String customerRetentionRateNinetyDays, + String id, + String monthlyRecurringRevenueUsd, + Optional status, + int totalOverridesCount, + String totalReferralEarningsUsd, + int totalReferralsCount, + String totalRevenueUsd, + OffsetDateTime updatedAt, + AffiliateListItemUser user, + Map additionalProperties) { + this.activeMembersCount = activeMembersCount; + this.company = company; + this.createdAt = createdAt; + this.customerRetentionRate = customerRetentionRate; + this.customerRetentionRateNinetyDays = customerRetentionRateNinetyDays; + this.id = id; + this.monthlyRecurringRevenueUsd = monthlyRecurringRevenueUsd; + this.status = status; + this.totalOverridesCount = totalOverridesCount; + this.totalReferralEarningsUsd = totalReferralEarningsUsd; + this.totalReferralsCount = totalReferralsCount; + this.totalRevenueUsd = totalRevenueUsd; + this.updatedAt = updatedAt; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The total active members of the affiliate + */ + @JsonProperty("active_members_count") + public int getActiveMembersCount() { + return activeMembersCount; + } + + /** + * @return The company attached to this affiliate + */ + @JsonProperty("company") + public AffiliateListItemCompany getCompany() { + return company; + } + + /** + * @return The datetime the affiliate was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The percentage of referred customers who are still active members + */ + @JsonProperty("customer_retention_rate") + public String getCustomerRetentionRate() { + return customerRetentionRate; + } + + /** + * @return The percentage of referred customers who remained active over the last 90 days + */ + @JsonProperty("customer_retention_rate_ninety_days") + public String getCustomerRetentionRateNinetyDays() { + return customerRetentionRateNinetyDays; + } + + /** + * @return The unique identifier for the affiliate. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The monthly recurring revenue generated by this affiliate's referrals, formatted as a USD currency string + */ + @JsonProperty("monthly_recurring_revenue_usd") + public String getMonthlyRecurringRevenueUsd() { + return monthlyRecurringRevenueUsd; + } + + /** + * @return The status of the affiliate + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The total count of all overrides for this affiliate + */ + @JsonProperty("total_overrides_count") + public int getTotalOverridesCount() { + return totalOverridesCount; + } + + /** + * @return The total commission earnings paid to this affiliate, formatted as a USD currency string + */ + @JsonProperty("total_referral_earnings_usd") + public String getTotalReferralEarningsUsd() { + return totalReferralEarningsUsd; + } + + /** + * @return The total referrals of the affiliate + */ + @JsonProperty("total_referrals_count") + public int getTotalReferralsCount() { + return totalReferralsCount; + } + + /** + * @return The total revenue generated from this affiliate's referrals, formatted as a USD currency string + */ + @JsonProperty("total_revenue_usd") + public String getTotalRevenueUsd() { + return totalRevenueUsd; + } + + /** + * @return The datetime the affiliate was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user attached to this affiliate + */ + @JsonProperty("user") + public AffiliateListItemUser getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AffiliateListItem && equalTo((AffiliateListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AffiliateListItem other) { + return activeMembersCount == other.activeMembersCount + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && customerRetentionRate.equals(other.customerRetentionRate) + && customerRetentionRateNinetyDays.equals(other.customerRetentionRateNinetyDays) + && id.equals(other.id) + && monthlyRecurringRevenueUsd.equals(other.monthlyRecurringRevenueUsd) + && status.equals(other.status) + && totalOverridesCount == other.totalOverridesCount + && totalReferralEarningsUsd.equals(other.totalReferralEarningsUsd) + && totalReferralsCount == other.totalReferralsCount + && totalRevenueUsd.equals(other.totalRevenueUsd) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.activeMembersCount, + this.company, + this.createdAt, + this.customerRetentionRate, + this.customerRetentionRateNinetyDays, + this.id, + this.monthlyRecurringRevenueUsd, + this.status, + this.totalOverridesCount, + this.totalReferralEarningsUsd, + this.totalReferralsCount, + this.totalRevenueUsd, + this.updatedAt, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActiveMembersCountStage builder() { + return new Builder(); + } + + public interface ActiveMembersCountStage { + /** + *

The total active members of the affiliate

+ */ + CompanyStage activeMembersCount(int activeMembersCount); + + Builder from(AffiliateListItem other); + } + + public interface CompanyStage { + /** + *

The company attached to this affiliate

+ */ + CreatedAtStage company(@NotNull AffiliateListItemCompany company); + } + + public interface CreatedAtStage { + /** + *

The datetime the affiliate was created.

+ */ + CustomerRetentionRateStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CustomerRetentionRateStage { + /** + *

The percentage of referred customers who are still active members

+ */ + CustomerRetentionRateNinetyDaysStage customerRetentionRate(@NotNull String customerRetentionRate); + } + + public interface CustomerRetentionRateNinetyDaysStage { + /** + *

The percentage of referred customers who remained active over the last 90 days

+ */ + IdStage customerRetentionRateNinetyDays(@NotNull String customerRetentionRateNinetyDays); + } + + public interface IdStage { + /** + *

The unique identifier for the affiliate.

+ */ + MonthlyRecurringRevenueUsdStage id(@NotNull String id); + } + + public interface MonthlyRecurringRevenueUsdStage { + /** + *

The monthly recurring revenue generated by this affiliate's referrals, formatted as a USD currency string

+ */ + TotalOverridesCountStage monthlyRecurringRevenueUsd(@NotNull String monthlyRecurringRevenueUsd); + } + + public interface TotalOverridesCountStage { + /** + *

The total count of all overrides for this affiliate

+ */ + TotalReferralEarningsUsdStage totalOverridesCount(int totalOverridesCount); + } + + public interface TotalReferralEarningsUsdStage { + /** + *

The total commission earnings paid to this affiliate, formatted as a USD currency string

+ */ + TotalReferralsCountStage totalReferralEarningsUsd(@NotNull String totalReferralEarningsUsd); + } + + public interface TotalReferralsCountStage { + /** + *

The total referrals of the affiliate

+ */ + TotalRevenueUsdStage totalReferralsCount(int totalReferralsCount); + } + + public interface TotalRevenueUsdStage { + /** + *

The total revenue generated from this affiliate's referrals, formatted as a USD currency string

+ */ + UpdatedAtStage totalRevenueUsd(@NotNull String totalRevenueUsd); + } + + public interface UpdatedAtStage { + /** + *

The datetime the affiliate was last updated.

+ */ + UserStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UserStage { + /** + *

The user attached to this affiliate

+ */ + _FinalStage user(@NotNull AffiliateListItemUser user); + } + + public interface _FinalStage { + AffiliateListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The status of the affiliate

+ */ + _FinalStage status(Optional status); + + _FinalStage status(Status status); + + _FinalStage status(Nullable status); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ActiveMembersCountStage, + CompanyStage, + CreatedAtStage, + CustomerRetentionRateStage, + CustomerRetentionRateNinetyDaysStage, + IdStage, + MonthlyRecurringRevenueUsdStage, + TotalOverridesCountStage, + TotalReferralEarningsUsdStage, + TotalReferralsCountStage, + TotalRevenueUsdStage, + UpdatedAtStage, + UserStage, + _FinalStage { + private int activeMembersCount; + + private AffiliateListItemCompany company; + + private OffsetDateTime createdAt; + + private String customerRetentionRate; + + private String customerRetentionRateNinetyDays; + + private String id; + + private String monthlyRecurringRevenueUsd; + + private int totalOverridesCount; + + private String totalReferralEarningsUsd; + + private int totalReferralsCount; + + private String totalRevenueUsd; + + private OffsetDateTime updatedAt; + + private AffiliateListItemUser user; + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AffiliateListItem other) { + activeMembersCount(other.getActiveMembersCount()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + customerRetentionRate(other.getCustomerRetentionRate()); + customerRetentionRateNinetyDays(other.getCustomerRetentionRateNinetyDays()); + id(other.getId()); + monthlyRecurringRevenueUsd(other.getMonthlyRecurringRevenueUsd()); + status(other.getStatus()); + totalOverridesCount(other.getTotalOverridesCount()); + totalReferralEarningsUsd(other.getTotalReferralEarningsUsd()); + totalReferralsCount(other.getTotalReferralsCount()); + totalRevenueUsd(other.getTotalRevenueUsd()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + return this; + } + + /** + *

The total active members of the affiliate

+ *

The total active members of the affiliate

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("active_members_count") + public CompanyStage activeMembersCount(int activeMembersCount) { + this.activeMembersCount = activeMembersCount; + return this; + } + + /** + *

The company attached to this affiliate

+ *

The company attached to this affiliate

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company") + public CreatedAtStage company(@NotNull AffiliateListItemCompany company) { + this.company = Objects.requireNonNull(company, "company must not be null"); + return this; + } + + /** + *

The datetime the affiliate was created.

+ *

The datetime the affiliate was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CustomerRetentionRateStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The percentage of referred customers who are still active members

+ *

The percentage of referred customers who are still active members

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("customer_retention_rate") + public CustomerRetentionRateNinetyDaysStage customerRetentionRate(@NotNull String customerRetentionRate) { + this.customerRetentionRate = + Objects.requireNonNull(customerRetentionRate, "customerRetentionRate must not be null"); + return this; + } + + /** + *

The percentage of referred customers who remained active over the last 90 days

+ *

The percentage of referred customers who remained active over the last 90 days

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("customer_retention_rate_ninety_days") + public IdStage customerRetentionRateNinetyDays(@NotNull String customerRetentionRateNinetyDays) { + this.customerRetentionRateNinetyDays = Objects.requireNonNull( + customerRetentionRateNinetyDays, "customerRetentionRateNinetyDays must not be null"); + return this; + } + + /** + *

The unique identifier for the affiliate.

+ *

The unique identifier for the affiliate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MonthlyRecurringRevenueUsdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The monthly recurring revenue generated by this affiliate's referrals, formatted as a USD currency string

+ *

The monthly recurring revenue generated by this affiliate's referrals, formatted as a USD currency string

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("monthly_recurring_revenue_usd") + public TotalOverridesCountStage monthlyRecurringRevenueUsd(@NotNull String monthlyRecurringRevenueUsd) { + this.monthlyRecurringRevenueUsd = + Objects.requireNonNull(monthlyRecurringRevenueUsd, "monthlyRecurringRevenueUsd must not be null"); + return this; + } + + /** + *

The total count of all overrides for this affiliate

+ *

The total count of all overrides for this affiliate

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_overrides_count") + public TotalReferralEarningsUsdStage totalOverridesCount(int totalOverridesCount) { + this.totalOverridesCount = totalOverridesCount; + return this; + } + + /** + *

The total commission earnings paid to this affiliate, formatted as a USD currency string

+ *

The total commission earnings paid to this affiliate, formatted as a USD currency string

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_referral_earnings_usd") + public TotalReferralsCountStage totalReferralEarningsUsd(@NotNull String totalReferralEarningsUsd) { + this.totalReferralEarningsUsd = + Objects.requireNonNull(totalReferralEarningsUsd, "totalReferralEarningsUsd must not be null"); + return this; + } + + /** + *

The total referrals of the affiliate

+ *

The total referrals of the affiliate

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_referrals_count") + public TotalRevenueUsdStage totalReferralsCount(int totalReferralsCount) { + this.totalReferralsCount = totalReferralsCount; + return this; + } + + /** + *

The total revenue generated from this affiliate's referrals, formatted as a USD currency string

+ *

The total revenue generated from this affiliate's referrals, formatted as a USD currency string

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_revenue_usd") + public UpdatedAtStage totalRevenueUsd(@NotNull String totalRevenueUsd) { + this.totalRevenueUsd = Objects.requireNonNull(totalRevenueUsd, "totalRevenueUsd must not be null"); + return this; + } + + /** + *

The datetime the affiliate was last updated.

+ *

The datetime the affiliate was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UserStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user attached to this affiliate

+ *

The user attached to this affiliate

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull AffiliateListItemUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

The status of the affiliate

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The status of the affiliate

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Status status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The status of the affiliate

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + @java.lang.Override + public AffiliateListItem build() { + return new AffiliateListItem( + activeMembersCount, + company, + createdAt, + customerRetentionRate, + customerRetentionRateNinetyDays, + id, + monthlyRecurringRevenueUsd, + status, + totalOverridesCount, + totalReferralEarningsUsd, + totalReferralsCount, + totalRevenueUsd, + updatedAt, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AffiliateListItemCompany.java b/src/main/java/com/whop/api/types/AffiliateListItemCompany.java new file mode 100644 index 00000000..11c70e2e --- /dev/null +++ b/src/main/java/com/whop/api/types/AffiliateListItemCompany.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AffiliateListItemCompany.Builder.class) +public final class AffiliateListItemCompany { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private AffiliateListItemCompany(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The written name of the company. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AffiliateListItemCompany && equalTo((AffiliateListItemCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AffiliateListItemCompany other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + TitleStage id(@NotNull String id); + + Builder from(AffiliateListItemCompany other); + } + + public interface TitleStage { + /** + *

The written name of the company.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + AffiliateListItemCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AffiliateListItemCompany other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The written name of the company.

+ *

The written name of the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public AffiliateListItemCompany build() { + return new AffiliateListItemCompany(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AffiliateListItemUser.java b/src/main/java/com/whop/api/types/AffiliateListItemUser.java new file mode 100644 index 00000000..2a625911 --- /dev/null +++ b/src/main/java/com/whop/api/types/AffiliateListItemUser.java @@ -0,0 +1,271 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AffiliateListItemUser.Builder.class) +public final class AffiliateListItemUser { + private final String id; + + private final Optional name; + + private final Optional username; + + private final Map additionalProperties; + + private AffiliateListItemUser( + String id, Optional name, Optional username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name set on the user's Whop profile. Null if the user has not set a name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The unique username chosen by the user for their Whop profile. Null if the user has not set a username. + */ + @JsonIgnore + public Optional getUsername() { + if (username == null) { + return Optional.empty(); + } + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("username") + private Optional _getUsername() { + return username; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AffiliateListItemUser && equalTo((AffiliateListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AffiliateListItemUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(AffiliateListItemUser other); + } + + public interface _FinalStage { + AffiliateListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The display name set on the user's Whop profile. Null if the user has not set a name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

The unique username chosen by the user for their Whop profile. Null if the user has not set a username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + + _FinalStage username(Nullable username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional username = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AffiliateListItemUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The unique username chosen by the user for their Whop profile. Null if the user has not set a username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(Nullable username) { + if (username.isNull()) { + this.username = null; + } else if (username.isEmpty()) { + this.username = Optional.empty(); + } else { + this.username = Optional.of(username.get()); + } + return this; + } + + /** + *

The unique username chosen by the user for their Whop profile. Null if the user has not set a username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

The unique username chosen by the user for their Whop profile. Null if the user has not set a username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

The display name set on the user's Whop profile. Null if the user has not set a name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The display name set on the user's Whop profile. Null if the user has not set a name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The display name set on the user's Whop profile. Null if the user has not set a name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public AffiliateListItemUser build() { + return new AffiliateListItemUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AffiliateOverrideRoles.java b/src/main/java/com/whop/api/types/AffiliateOverrideRoles.java new file mode 100644 index 00000000..2ae0abd9 --- /dev/null +++ b/src/main/java/com/whop/api/types/AffiliateOverrideRoles.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AffiliateOverrideRoles { + public static final AffiliateOverrideRoles STANDARD = new AffiliateOverrideRoles(Value.STANDARD, "standard"); + + public static final AffiliateOverrideRoles REV_SHARE = new AffiliateOverrideRoles(Value.REV_SHARE, "rev_share"); + + private final Value value; + + private final String string; + + AffiliateOverrideRoles(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AffiliateOverrideRoles + && this.string.equals(((AffiliateOverrideRoles) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case STANDARD: + return visitor.visitStandard(); + case REV_SHARE: + return visitor.visitRevShare(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AffiliateOverrideRoles valueOf(String value) { + switch (value) { + case "standard": + return STANDARD; + case "rev_share": + return REV_SHARE; + default: + return new AffiliateOverrideRoles(Value.UNKNOWN, value); + } + } + + public enum Value { + STANDARD, + + REV_SHARE, + + UNKNOWN + } + + public interface Visitor { + T visitStandard(); + + T visitRevShare(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AffiliatePayoutTypes.java b/src/main/java/com/whop/api/types/AffiliatePayoutTypes.java new file mode 100644 index 00000000..8e524c84 --- /dev/null +++ b/src/main/java/com/whop/api/types/AffiliatePayoutTypes.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AffiliatePayoutTypes { + public static final AffiliatePayoutTypes PERCENTAGE = new AffiliatePayoutTypes(Value.PERCENTAGE, "percentage"); + + public static final AffiliatePayoutTypes FLAT_FEE = new AffiliatePayoutTypes(Value.FLAT_FEE, "flat_fee"); + + private final Value value; + + private final String string; + + AffiliatePayoutTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AffiliatePayoutTypes && this.string.equals(((AffiliatePayoutTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PERCENTAGE: + return visitor.visitPercentage(); + case FLAT_FEE: + return visitor.visitFlatFee(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AffiliatePayoutTypes valueOf(String value) { + switch (value) { + case "percentage": + return PERCENTAGE; + case "flat_fee": + return FLAT_FEE; + default: + return new AffiliatePayoutTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + PERCENTAGE, + + FLAT_FEE, + + UNKNOWN + } + + public interface Visitor { + T visitPercentage(); + + T visitFlatFee(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AffiliateRevenueBases.java b/src/main/java/com/whop/api/types/AffiliateRevenueBases.java new file mode 100644 index 00000000..e97ff97a --- /dev/null +++ b/src/main/java/com/whop/api/types/AffiliateRevenueBases.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AffiliateRevenueBases { + public static final AffiliateRevenueBases PRE_FEES = new AffiliateRevenueBases(Value.PRE_FEES, "pre_fees"); + + public static final AffiliateRevenueBases POST_FEES = new AffiliateRevenueBases(Value.POST_FEES, "post_fees"); + + private final Value value; + + private final String string; + + AffiliateRevenueBases(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AffiliateRevenueBases + && this.string.equals(((AffiliateRevenueBases) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PRE_FEES: + return visitor.visitPreFees(); + case POST_FEES: + return visitor.visitPostFees(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AffiliateRevenueBases valueOf(String value) { + switch (value) { + case "pre_fees": + return PRE_FEES; + case "post_fees": + return POST_FEES; + default: + return new AffiliateRevenueBases(Value.UNKNOWN, value); + } + } + + public enum Value { + PRE_FEES, + + POST_FEES, + + UNKNOWN + } + + public interface Visitor { + T visitPreFees(); + + T visitPostFees(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AffiliateUser.java b/src/main/java/com/whop/api/types/AffiliateUser.java new file mode 100644 index 00000000..7801d1b9 --- /dev/null +++ b/src/main/java/com/whop/api/types/AffiliateUser.java @@ -0,0 +1,271 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AffiliateUser.Builder.class) +public final class AffiliateUser { + private final String id; + + private final Optional name; + + private final Optional username; + + private final Map additionalProperties; + + private AffiliateUser( + String id, Optional name, Optional username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name set on the user's Whop profile. Null if the user has not set a name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The unique username chosen by the user for their Whop profile. Null if the user has not set a username. + */ + @JsonIgnore + public Optional getUsername() { + if (username == null) { + return Optional.empty(); + } + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("username") + private Optional _getUsername() { + return username; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AffiliateUser && equalTo((AffiliateUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AffiliateUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(AffiliateUser other); + } + + public interface _FinalStage { + AffiliateUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The display name set on the user's Whop profile. Null if the user has not set a name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

The unique username chosen by the user for their Whop profile. Null if the user has not set a username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + + _FinalStage username(Nullable username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional username = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AffiliateUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The unique username chosen by the user for their Whop profile. Null if the user has not set a username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(Nullable username) { + if (username.isNull()) { + this.username = null; + } else if (username.isEmpty()) { + this.username = Optional.empty(); + } else { + this.username = Optional.of(username.get()); + } + return this; + } + + /** + *

The unique username chosen by the user for their Whop profile. Null if the user has not set a username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

The unique username chosen by the user for their Whop profile. Null if the user has not set a username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

The display name set on the user's Whop profile. Null if the user has not set a name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The display name set on the user's Whop profile. Null if the user has not set a name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The display name set on the user's Whop profile. Null if the user has not set a name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public AffiliateUser build() { + return new AffiliateUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AffiliatesSortableColumns.java b/src/main/java/com/whop/api/types/AffiliatesSortableColumns.java new file mode 100644 index 00000000..7ad41a76 --- /dev/null +++ b/src/main/java/com/whop/api/types/AffiliatesSortableColumns.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AffiliatesSortableColumns { + public static final AffiliatesSortableColumns CREATED_AT = + new AffiliatesSortableColumns(Value.CREATED_AT, "created_at"); + + public static final AffiliatesSortableColumns CACHED_TOTAL_REFERRALS = + new AffiliatesSortableColumns(Value.CACHED_TOTAL_REFERRALS, "cached_total_referrals"); + + public static final AffiliatesSortableColumns ID = new AffiliatesSortableColumns(Value.ID, "id"); + + public static final AffiliatesSortableColumns CACHED_TOTAL_REWARDS = + new AffiliatesSortableColumns(Value.CACHED_TOTAL_REWARDS, "cached_total_rewards"); + + private final Value value; + + private final String string; + + AffiliatesSortableColumns(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AffiliatesSortableColumns + && this.string.equals(((AffiliatesSortableColumns) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case CACHED_TOTAL_REFERRALS: + return visitor.visitCachedTotalReferrals(); + case ID: + return visitor.visitId(); + case CACHED_TOTAL_REWARDS: + return visitor.visitCachedTotalRewards(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AffiliatesSortableColumns valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + case "cached_total_referrals": + return CACHED_TOTAL_REFERRALS; + case "id": + return ID; + case "cached_total_rewards": + return CACHED_TOTAL_REWARDS; + default: + return new AffiliatesSortableColumns(Value.UNKNOWN, value); + } + } + + public enum Value { + ID, + + CREATED_AT, + + CACHED_TOTAL_REFERRALS, + + CACHED_TOTAL_REWARDS, + + UNKNOWN + } + + public interface Visitor { + T visitId(); + + T visitCreatedAt(); + + T visitCachedTotalReferrals(); + + T visitCachedTotalRewards(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AiChat.java b/src/main/java/com/whop/api/types/AiChat.java new file mode 100644 index 00000000..b134a8ca --- /dev/null +++ b/src/main/java/com/whop/api/types/AiChat.java @@ -0,0 +1,515 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AiChat.Builder.class) +public final class AiChat { + private final String blendedTokenUsage; + + private final OffsetDateTime createdAt; + + private final String id; + + private final Optional lastMessageAt; + + private final int messageCount; + + private final AiChatNotificationPreferences notificationPreference; + + private final Optional title; + + private final OffsetDateTime updatedAt; + + private final AiChatUser user; + + private final Map additionalProperties; + + private AiChat( + String blendedTokenUsage, + OffsetDateTime createdAt, + String id, + Optional lastMessageAt, + int messageCount, + AiChatNotificationPreferences notificationPreference, + Optional title, + OffsetDateTime updatedAt, + AiChatUser user, + Map additionalProperties) { + this.blendedTokenUsage = blendedTokenUsage; + this.createdAt = createdAt; + this.id = id; + this.lastMessageAt = lastMessageAt; + this.messageCount = messageCount; + this.notificationPreference = notificationPreference; + this.title = title; + this.updatedAt = updatedAt; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The total number of tokens consumed across all messages in this conversation. + */ + @JsonProperty("blended_token_usage") + public String getBlendedTokenUsage() { + return blendedTokenUsage; + } + + /** + * @return The datetime the ai chat was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the ai chat. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The timestamp of the most recent message in this conversation. Null if no messages have been sent yet. + */ + @JsonIgnore + public Optional getLastMessageAt() { + if (lastMessageAt == null) { + return Optional.empty(); + } + return lastMessageAt; + } + + /** + * @return The total number of messages exchanged in this conversation. + */ + @JsonProperty("message_count") + public int getMessageCount() { + return messageCount; + } + + /** + * @return The notification preference for this AI chat. all delivers AI chat notifications and badges, while none mutes them. + */ + @JsonProperty("notification_preference") + public AiChatNotificationPreferences getNotificationPreference() { + return notificationPreference; + } + + /** + * @return A short descriptive title for this AI chat conversation. Null if no title has been set. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The datetime the ai chat was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user who owns this AI chat conversation. + */ + @JsonProperty("user") + public AiChatUser getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_message_at") + private Optional _getLastMessageAt() { + return lastMessageAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AiChat && equalTo((AiChat) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AiChat other) { + return blendedTokenUsage.equals(other.blendedTokenUsage) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && lastMessageAt.equals(other.lastMessageAt) + && messageCount == other.messageCount + && notificationPreference.equals(other.notificationPreference) + && title.equals(other.title) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.blendedTokenUsage, + this.createdAt, + this.id, + this.lastMessageAt, + this.messageCount, + this.notificationPreference, + this.title, + this.updatedAt, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BlendedTokenUsageStage builder() { + return new Builder(); + } + + public interface BlendedTokenUsageStage { + /** + *

The total number of tokens consumed across all messages in this conversation.

+ */ + CreatedAtStage blendedTokenUsage(@NotNull String blendedTokenUsage); + + Builder from(AiChat other); + } + + public interface CreatedAtStage { + /** + *

The datetime the ai chat was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the ai chat.

+ */ + MessageCountStage id(@NotNull String id); + } + + public interface MessageCountStage { + /** + *

The total number of messages exchanged in this conversation.

+ */ + NotificationPreferenceStage messageCount(int messageCount); + } + + public interface NotificationPreferenceStage { + /** + *

The notification preference for this AI chat. all delivers AI chat notifications and badges, while none mutes them.

+ */ + UpdatedAtStage notificationPreference(@NotNull AiChatNotificationPreferences notificationPreference); + } + + public interface UpdatedAtStage { + /** + *

The datetime the ai chat was last updated.

+ */ + UserStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UserStage { + /** + *

The user who owns this AI chat conversation.

+ */ + _FinalStage user(@NotNull AiChatUser user); + } + + public interface _FinalStage { + AiChat build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The timestamp of the most recent message in this conversation. Null if no messages have been sent yet.

+ */ + _FinalStage lastMessageAt(Optional lastMessageAt); + + _FinalStage lastMessageAt(OffsetDateTime lastMessageAt); + + _FinalStage lastMessageAt(Nullable lastMessageAt); + + /** + *

A short descriptive title for this AI chat conversation. Null if no title has been set.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BlendedTokenUsageStage, + CreatedAtStage, + IdStage, + MessageCountStage, + NotificationPreferenceStage, + UpdatedAtStage, + UserStage, + _FinalStage { + private String blendedTokenUsage; + + private OffsetDateTime createdAt; + + private String id; + + private int messageCount; + + private AiChatNotificationPreferences notificationPreference; + + private OffsetDateTime updatedAt; + + private AiChatUser user; + + private Optional title = Optional.empty(); + + private Optional lastMessageAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AiChat other) { + blendedTokenUsage(other.getBlendedTokenUsage()); + createdAt(other.getCreatedAt()); + id(other.getId()); + lastMessageAt(other.getLastMessageAt()); + messageCount(other.getMessageCount()); + notificationPreference(other.getNotificationPreference()); + title(other.getTitle()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + return this; + } + + /** + *

The total number of tokens consumed across all messages in this conversation.

+ *

The total number of tokens consumed across all messages in this conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("blended_token_usage") + public CreatedAtStage blendedTokenUsage(@NotNull String blendedTokenUsage) { + this.blendedTokenUsage = Objects.requireNonNull(blendedTokenUsage, "blendedTokenUsage must not be null"); + return this; + } + + /** + *

The datetime the ai chat was created.

+ *

The datetime the ai chat was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the ai chat.

+ *

The unique identifier for the ai chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MessageCountStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The total number of messages exchanged in this conversation.

+ *

The total number of messages exchanged in this conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message_count") + public NotificationPreferenceStage messageCount(int messageCount) { + this.messageCount = messageCount; + return this; + } + + /** + *

The notification preference for this AI chat. all delivers AI chat notifications and badges, while none mutes them.

+ *

The notification preference for this AI chat. all delivers AI chat notifications and badges, while none mutes them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("notification_preference") + public UpdatedAtStage notificationPreference(@NotNull AiChatNotificationPreferences notificationPreference) { + this.notificationPreference = + Objects.requireNonNull(notificationPreference, "notificationPreference must not be null"); + return this; + } + + /** + *

The datetime the ai chat was last updated.

+ *

The datetime the ai chat was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UserStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user who owns this AI chat conversation.

+ *

The user who owns this AI chat conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull AiChatUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

A short descriptive title for this AI chat conversation. Null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

A short descriptive title for this AI chat conversation. Null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

A short descriptive title for this AI chat conversation. Null if no title has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

The timestamp of the most recent message in this conversation. Null if no messages have been sent yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastMessageAt(Nullable lastMessageAt) { + if (lastMessageAt.isNull()) { + this.lastMessageAt = null; + } else if (lastMessageAt.isEmpty()) { + this.lastMessageAt = Optional.empty(); + } else { + this.lastMessageAt = Optional.of(lastMessageAt.get()); + } + return this; + } + + /** + *

The timestamp of the most recent message in this conversation. Null if no messages have been sent yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastMessageAt(OffsetDateTime lastMessageAt) { + this.lastMessageAt = Optional.ofNullable(lastMessageAt); + return this; + } + + /** + *

The timestamp of the most recent message in this conversation. Null if no messages have been sent yet.

+ */ + @java.lang.Override + @JsonSetter(value = "last_message_at", nulls = Nulls.SKIP) + public _FinalStage lastMessageAt(Optional lastMessageAt) { + this.lastMessageAt = lastMessageAt; + return this; + } + + @java.lang.Override + public AiChat build() { + return new AiChat( + blendedTokenUsage, + createdAt, + id, + lastMessageAt, + messageCount, + notificationPreference, + title, + updatedAt, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AiChatListItem.java b/src/main/java/com/whop/api/types/AiChatListItem.java new file mode 100644 index 00000000..7566f97b --- /dev/null +++ b/src/main/java/com/whop/api/types/AiChatListItem.java @@ -0,0 +1,515 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AiChatListItem.Builder.class) +public final class AiChatListItem { + private final String blendedTokenUsage; + + private final OffsetDateTime createdAt; + + private final String id; + + private final Optional lastMessageAt; + + private final int messageCount; + + private final AiChatNotificationPreferences notificationPreference; + + private final Optional title; + + private final OffsetDateTime updatedAt; + + private final AiChatListItemUser user; + + private final Map additionalProperties; + + private AiChatListItem( + String blendedTokenUsage, + OffsetDateTime createdAt, + String id, + Optional lastMessageAt, + int messageCount, + AiChatNotificationPreferences notificationPreference, + Optional title, + OffsetDateTime updatedAt, + AiChatListItemUser user, + Map additionalProperties) { + this.blendedTokenUsage = blendedTokenUsage; + this.createdAt = createdAt; + this.id = id; + this.lastMessageAt = lastMessageAt; + this.messageCount = messageCount; + this.notificationPreference = notificationPreference; + this.title = title; + this.updatedAt = updatedAt; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The total number of tokens consumed across all messages in this conversation. + */ + @JsonProperty("blended_token_usage") + public String getBlendedTokenUsage() { + return blendedTokenUsage; + } + + /** + * @return The datetime the ai chat was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the ai chat. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The timestamp of the most recent message in this conversation. Null if no messages have been sent yet. + */ + @JsonIgnore + public Optional getLastMessageAt() { + if (lastMessageAt == null) { + return Optional.empty(); + } + return lastMessageAt; + } + + /** + * @return The total number of messages exchanged in this conversation. + */ + @JsonProperty("message_count") + public int getMessageCount() { + return messageCount; + } + + /** + * @return The notification preference for this AI chat. all delivers AI chat notifications and badges, while none mutes them. + */ + @JsonProperty("notification_preference") + public AiChatNotificationPreferences getNotificationPreference() { + return notificationPreference; + } + + /** + * @return A short descriptive title for this AI chat conversation. Null if no title has been set. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The datetime the ai chat was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user who owns this AI chat conversation. + */ + @JsonProperty("user") + public AiChatListItemUser getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_message_at") + private Optional _getLastMessageAt() { + return lastMessageAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AiChatListItem && equalTo((AiChatListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AiChatListItem other) { + return blendedTokenUsage.equals(other.blendedTokenUsage) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && lastMessageAt.equals(other.lastMessageAt) + && messageCount == other.messageCount + && notificationPreference.equals(other.notificationPreference) + && title.equals(other.title) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.blendedTokenUsage, + this.createdAt, + this.id, + this.lastMessageAt, + this.messageCount, + this.notificationPreference, + this.title, + this.updatedAt, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BlendedTokenUsageStage builder() { + return new Builder(); + } + + public interface BlendedTokenUsageStage { + /** + *

The total number of tokens consumed across all messages in this conversation.

+ */ + CreatedAtStage blendedTokenUsage(@NotNull String blendedTokenUsage); + + Builder from(AiChatListItem other); + } + + public interface CreatedAtStage { + /** + *

The datetime the ai chat was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the ai chat.

+ */ + MessageCountStage id(@NotNull String id); + } + + public interface MessageCountStage { + /** + *

The total number of messages exchanged in this conversation.

+ */ + NotificationPreferenceStage messageCount(int messageCount); + } + + public interface NotificationPreferenceStage { + /** + *

The notification preference for this AI chat. all delivers AI chat notifications and badges, while none mutes them.

+ */ + UpdatedAtStage notificationPreference(@NotNull AiChatNotificationPreferences notificationPreference); + } + + public interface UpdatedAtStage { + /** + *

The datetime the ai chat was last updated.

+ */ + UserStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UserStage { + /** + *

The user who owns this AI chat conversation.

+ */ + _FinalStage user(@NotNull AiChatListItemUser user); + } + + public interface _FinalStage { + AiChatListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The timestamp of the most recent message in this conversation. Null if no messages have been sent yet.

+ */ + _FinalStage lastMessageAt(Optional lastMessageAt); + + _FinalStage lastMessageAt(OffsetDateTime lastMessageAt); + + _FinalStage lastMessageAt(Nullable lastMessageAt); + + /** + *

A short descriptive title for this AI chat conversation. Null if no title has been set.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BlendedTokenUsageStage, + CreatedAtStage, + IdStage, + MessageCountStage, + NotificationPreferenceStage, + UpdatedAtStage, + UserStage, + _FinalStage { + private String blendedTokenUsage; + + private OffsetDateTime createdAt; + + private String id; + + private int messageCount; + + private AiChatNotificationPreferences notificationPreference; + + private OffsetDateTime updatedAt; + + private AiChatListItemUser user; + + private Optional title = Optional.empty(); + + private Optional lastMessageAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AiChatListItem other) { + blendedTokenUsage(other.getBlendedTokenUsage()); + createdAt(other.getCreatedAt()); + id(other.getId()); + lastMessageAt(other.getLastMessageAt()); + messageCount(other.getMessageCount()); + notificationPreference(other.getNotificationPreference()); + title(other.getTitle()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + return this; + } + + /** + *

The total number of tokens consumed across all messages in this conversation.

+ *

The total number of tokens consumed across all messages in this conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("blended_token_usage") + public CreatedAtStage blendedTokenUsage(@NotNull String blendedTokenUsage) { + this.blendedTokenUsage = Objects.requireNonNull(blendedTokenUsage, "blendedTokenUsage must not be null"); + return this; + } + + /** + *

The datetime the ai chat was created.

+ *

The datetime the ai chat was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the ai chat.

+ *

The unique identifier for the ai chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MessageCountStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The total number of messages exchanged in this conversation.

+ *

The total number of messages exchanged in this conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message_count") + public NotificationPreferenceStage messageCount(int messageCount) { + this.messageCount = messageCount; + return this; + } + + /** + *

The notification preference for this AI chat. all delivers AI chat notifications and badges, while none mutes them.

+ *

The notification preference for this AI chat. all delivers AI chat notifications and badges, while none mutes them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("notification_preference") + public UpdatedAtStage notificationPreference(@NotNull AiChatNotificationPreferences notificationPreference) { + this.notificationPreference = + Objects.requireNonNull(notificationPreference, "notificationPreference must not be null"); + return this; + } + + /** + *

The datetime the ai chat was last updated.

+ *

The datetime the ai chat was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UserStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user who owns this AI chat conversation.

+ *

The user who owns this AI chat conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull AiChatListItemUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

A short descriptive title for this AI chat conversation. Null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

A short descriptive title for this AI chat conversation. Null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

A short descriptive title for this AI chat conversation. Null if no title has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

The timestamp of the most recent message in this conversation. Null if no messages have been sent yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastMessageAt(Nullable lastMessageAt) { + if (lastMessageAt.isNull()) { + this.lastMessageAt = null; + } else if (lastMessageAt.isEmpty()) { + this.lastMessageAt = Optional.empty(); + } else { + this.lastMessageAt = Optional.of(lastMessageAt.get()); + } + return this; + } + + /** + *

The timestamp of the most recent message in this conversation. Null if no messages have been sent yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastMessageAt(OffsetDateTime lastMessageAt) { + this.lastMessageAt = Optional.ofNullable(lastMessageAt); + return this; + } + + /** + *

The timestamp of the most recent message in this conversation. Null if no messages have been sent yet.

+ */ + @java.lang.Override + @JsonSetter(value = "last_message_at", nulls = Nulls.SKIP) + public _FinalStage lastMessageAt(Optional lastMessageAt) { + this.lastMessageAt = lastMessageAt; + return this; + } + + @java.lang.Override + public AiChatListItem build() { + return new AiChatListItem( + blendedTokenUsage, + createdAt, + id, + lastMessageAt, + messageCount, + notificationPreference, + title, + updatedAt, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AiChatListItemUser.java b/src/main/java/com/whop/api/types/AiChatListItemUser.java new file mode 100644 index 00000000..e58a49ff --- /dev/null +++ b/src/main/java/com/whop/api/types/AiChatListItemUser.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AiChatListItemUser.Builder.class) +public final class AiChatListItemUser { + private final String id; + + private final Map additionalProperties; + + private AiChatListItemUser(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AiChatListItemUser && equalTo((AiChatListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AiChatListItemUser other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(AiChatListItemUser other); + } + + public interface _FinalStage { + AiChatListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AiChatListItemUser other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public AiChatListItemUser build() { + return new AiChatListItemUser(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AiChatMessageSourceTypes.java b/src/main/java/com/whop/api/types/AiChatMessageSourceTypes.java new file mode 100644 index 00000000..124b2b48 --- /dev/null +++ b/src/main/java/com/whop/api/types/AiChatMessageSourceTypes.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AiChatMessageSourceTypes { + public static final AiChatMessageSourceTypes SUGGESTION = + new AiChatMessageSourceTypes(Value.SUGGESTION, "suggestion"); + + public static final AiChatMessageSourceTypes LINK = new AiChatMessageSourceTypes(Value.LINK, "link"); + + public static final AiChatMessageSourceTypes MANUAL = new AiChatMessageSourceTypes(Value.MANUAL, "manual"); + + private final Value value; + + private final String string; + + AiChatMessageSourceTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AiChatMessageSourceTypes + && this.string.equals(((AiChatMessageSourceTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SUGGESTION: + return visitor.visitSuggestion(); + case LINK: + return visitor.visitLink(); + case MANUAL: + return visitor.visitManual(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AiChatMessageSourceTypes valueOf(String value) { + switch (value) { + case "suggestion": + return SUGGESTION; + case "link": + return LINK; + case "manual": + return MANUAL; + default: + return new AiChatMessageSourceTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + MANUAL, + + SUGGESTION, + + LINK, + + UNKNOWN + } + + public interface Visitor { + T visitManual(); + + T visitSuggestion(); + + T visitLink(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AiChatNotificationPreferences.java b/src/main/java/com/whop/api/types/AiChatNotificationPreferences.java new file mode 100644 index 00000000..f6c1dc1e --- /dev/null +++ b/src/main/java/com/whop/api/types/AiChatNotificationPreferences.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AiChatNotificationPreferences { + public static final AiChatNotificationPreferences ALL = new AiChatNotificationPreferences(Value.ALL, "all"); + + public static final AiChatNotificationPreferences NONE = new AiChatNotificationPreferences(Value.NONE, "none"); + + private final Value value; + + private final String string; + + AiChatNotificationPreferences(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AiChatNotificationPreferences + && this.string.equals(((AiChatNotificationPreferences) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ALL: + return visitor.visitAll(); + case NONE: + return visitor.visitNone(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AiChatNotificationPreferences valueOf(String value) { + switch (value) { + case "all": + return ALL; + case "none": + return NONE; + default: + return new AiChatNotificationPreferences(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL, + + NONE, + + UNKNOWN + } + + public interface Visitor { + T visitAll(); + + T visitNone(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AiChatUser.java b/src/main/java/com/whop/api/types/AiChatUser.java new file mode 100644 index 00000000..efb3fad2 --- /dev/null +++ b/src/main/java/com/whop/api/types/AiChatUser.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AiChatUser.Builder.class) +public final class AiChatUser { + private final String id; + + private final Map additionalProperties; + + private AiChatUser(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AiChatUser && equalTo((AiChatUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AiChatUser other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(AiChatUser other); + } + + public interface _FinalStage { + AiChatUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AiChatUser other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public AiChatUser build() { + return new AiChatUser(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ApiKey.java b/src/main/java/com/whop/api/types/ApiKey.java new file mode 100644 index 00000000..99835b0c --- /dev/null +++ b/src/main/java/com/whop/api/types/ApiKey.java @@ -0,0 +1,681 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ApiKey.Builder.class) +public final class ApiKey { + private final ApiKeyApiVersionDate apiVersionDate; + + private final String createdAt; + + private final Optional expiresAt; + + private final Optional> grants; + + private final String id; + + private final Optional> ipAllowlist; + + private final boolean isDefaultForResource; + + private final Optional name; + + private final String obfuscatedSecretKey; + + private final Optional secretKey; + + private final Optional systemRole; + + private final String updatedAt; + + private final Map additionalProperties; + + private ApiKey( + ApiKeyApiVersionDate apiVersionDate, + String createdAt, + Optional expiresAt, + Optional> grants, + String id, + Optional> ipAllowlist, + boolean isDefaultForResource, + Optional name, + String obfuscatedSecretKey, + Optional secretKey, + Optional systemRole, + String updatedAt, + Map additionalProperties) { + this.apiVersionDate = apiVersionDate; + this.createdAt = createdAt; + this.expiresAt = expiresAt; + this.grants = grants; + this.id = id; + this.ipAllowlist = ipAllowlist; + this.isDefaultForResource = isDefaultForResource; + this.name = name; + this.obfuscatedSecretKey = obfuscatedSecretKey; + this.secretKey = secretKey; + this.systemRole = systemRole; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return Dated API version used when requests authenticated with this key omit the Api-Version-Date header. + */ + @JsonProperty("api_version_date") + public ApiKeyApiVersionDate getApiVersionDate() { + return apiVersionDate; + } + + /** + * @return When the API key was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return When the API key stops working, as an ISO 8601 timestamp. null means it never expires. + */ + @JsonIgnore + public Optional getExpiresAt() { + if (expiresAt == null) { + return Optional.empty(); + } + return expiresAt; + } + + @JsonProperty("grants") + public Optional> getGrants() { + return grants; + } + + /** + * @return API key ID, prefixed apik_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonIgnore + public Optional> getIpAllowlist() { + if (ipAllowlist == null) { + return Optional.empty(); + } + return ipAllowlist; + } + + /** + * @return Whether this is the resource's default API key. Default keys cannot be updated or deleted, only rotated. + */ + @JsonProperty("is_default_for_resource") + public boolean getIsDefaultForResource() { + return isDefaultForResource; + } + + /** + * @return Human-readable name identifying the API key, or null when none was set. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return Masked version of the secret key, so the key can be recognized without revealing the full secret. + */ + @JsonProperty("obfuscated_secret_key") + public String getObfuscatedSecretKey() { + return obfuscatedSecretKey; + } + + /** + * @return The full secret used to authenticate requests. Returned only once, on create and rotate responses — store it immediately. + */ + @JsonProperty("secret_key") + public Optional getSecretKey() { + return secretKey; + } + + /** + * @return System role the key inherits its permissions from, or null when it uses an explicit permissions policy. Only account API keys can use a system role. + */ + @JsonIgnore + public Optional getSystemRole() { + if (systemRole == null) { + return Optional.empty(); + } + return systemRole; + } + + /** + * @return When the API key was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expires_at") + private Optional _getExpiresAt() { + return expiresAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ip_allowlist") + private Optional> _getIpAllowlist() { + return ipAllowlist; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("system_role") + private Optional _getSystemRole() { + return systemRole; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ApiKey && equalTo((ApiKey) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ApiKey other) { + return apiVersionDate.equals(other.apiVersionDate) + && createdAt.equals(other.createdAt) + && expiresAt.equals(other.expiresAt) + && grants.equals(other.grants) + && id.equals(other.id) + && ipAllowlist.equals(other.ipAllowlist) + && isDefaultForResource == other.isDefaultForResource + && name.equals(other.name) + && obfuscatedSecretKey.equals(other.obfuscatedSecretKey) + && secretKey.equals(other.secretKey) + && systemRole.equals(other.systemRole) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.apiVersionDate, + this.createdAt, + this.expiresAt, + this.grants, + this.id, + this.ipAllowlist, + this.isDefaultForResource, + this.name, + this.obfuscatedSecretKey, + this.secretKey, + this.systemRole, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionDateStage builder() { + return new Builder(); + } + + public interface ApiVersionDateStage { + /** + *

Dated API version used when requests authenticated with this key omit the Api-Version-Date header.

+ */ + CreatedAtStage apiVersionDate(@NotNull ApiKeyApiVersionDate apiVersionDate); + + Builder from(ApiKey other); + } + + public interface CreatedAtStage { + /** + *

When the API key was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

API key ID, prefixed apik_.

+ */ + IsDefaultForResourceStage id(@NotNull String id); + } + + public interface IsDefaultForResourceStage { + /** + *

Whether this is the resource's default API key. Default keys cannot be updated or deleted, only rotated.

+ */ + ObfuscatedSecretKeyStage isDefaultForResource(boolean isDefaultForResource); + } + + public interface ObfuscatedSecretKeyStage { + /** + *

Masked version of the secret key, so the key can be recognized without revealing the full secret.

+ */ + UpdatedAtStage obfuscatedSecretKey(@NotNull String obfuscatedSecretKey); + } + + public interface UpdatedAtStage { + /** + *

When the API key was last updated, as an ISO 8601 timestamp.

+ */ + _FinalStage updatedAt(@NotNull String updatedAt); + } + + public interface _FinalStage { + ApiKey build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When the API key stops working, as an ISO 8601 timestamp. null means it never expires.

+ */ + _FinalStage expiresAt(Optional expiresAt); + + _FinalStage expiresAt(String expiresAt); + + _FinalStage expiresAt(Nullable expiresAt); + + _FinalStage grants(Optional> grants); + + _FinalStage grants(List grants); + + _FinalStage ipAllowlist(Optional> ipAllowlist); + + _FinalStage ipAllowlist(List ipAllowlist); + + _FinalStage ipAllowlist(Nullable> ipAllowlist); + + /** + *

Human-readable name identifying the API key, or null when none was set.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

The full secret used to authenticate requests. Returned only once, on create and rotate responses — store it immediately.

+ */ + _FinalStage secretKey(Optional secretKey); + + _FinalStage secretKey(String secretKey); + + /** + *

System role the key inherits its permissions from, or null when it uses an explicit permissions policy. Only account API keys can use a system role.

+ */ + _FinalStage systemRole(Optional systemRole); + + _FinalStage systemRole(ApiKeySystemRole systemRole); + + _FinalStage systemRole(Nullable systemRole); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionDateStage, + CreatedAtStage, + IdStage, + IsDefaultForResourceStage, + ObfuscatedSecretKeyStage, + UpdatedAtStage, + _FinalStage { + private ApiKeyApiVersionDate apiVersionDate; + + private String createdAt; + + private String id; + + private boolean isDefaultForResource; + + private String obfuscatedSecretKey; + + private String updatedAt; + + private Optional systemRole = Optional.empty(); + + private Optional secretKey = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional> ipAllowlist = Optional.empty(); + + private Optional> grants = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ApiKey other) { + apiVersionDate(other.getApiVersionDate()); + createdAt(other.getCreatedAt()); + expiresAt(other.getExpiresAt()); + grants(other.getGrants()); + id(other.getId()); + ipAllowlist(other.getIpAllowlist()); + isDefaultForResource(other.getIsDefaultForResource()); + name(other.getName()); + obfuscatedSecretKey(other.getObfuscatedSecretKey()); + secretKey(other.getSecretKey()); + systemRole(other.getSystemRole()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

Dated API version used when requests authenticated with this key omit the Api-Version-Date header.

+ *

Dated API version used when requests authenticated with this key omit the Api-Version-Date header.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version_date") + public CreatedAtStage apiVersionDate(@NotNull ApiKeyApiVersionDate apiVersionDate) { + this.apiVersionDate = Objects.requireNonNull(apiVersionDate, "apiVersionDate must not be null"); + return this; + } + + /** + *

When the API key was created, as an ISO 8601 timestamp.

+ *

When the API key was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

API key ID, prefixed apik_.

+ *

API key ID, prefixed apik_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsDefaultForResourceStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether this is the resource's default API key. Default keys cannot be updated or deleted, only rotated.

+ *

Whether this is the resource's default API key. Default keys cannot be updated or deleted, only rotated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_default_for_resource") + public ObfuscatedSecretKeyStage isDefaultForResource(boolean isDefaultForResource) { + this.isDefaultForResource = isDefaultForResource; + return this; + } + + /** + *

Masked version of the secret key, so the key can be recognized without revealing the full secret.

+ *

Masked version of the secret key, so the key can be recognized without revealing the full secret.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("obfuscated_secret_key") + public UpdatedAtStage obfuscatedSecretKey(@NotNull String obfuscatedSecretKey) { + this.obfuscatedSecretKey = + Objects.requireNonNull(obfuscatedSecretKey, "obfuscatedSecretKey must not be null"); + return this; + } + + /** + *

When the API key was last updated, as an ISO 8601 timestamp.

+ *

When the API key was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

System role the key inherits its permissions from, or null when it uses an explicit permissions policy. Only account API keys can use a system role.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage systemRole(Nullable systemRole) { + if (systemRole.isNull()) { + this.systemRole = null; + } else if (systemRole.isEmpty()) { + this.systemRole = Optional.empty(); + } else { + this.systemRole = Optional.of(systemRole.get()); + } + return this; + } + + /** + *

System role the key inherits its permissions from, or null when it uses an explicit permissions policy. Only account API keys can use a system role.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage systemRole(ApiKeySystemRole systemRole) { + this.systemRole = Optional.ofNullable(systemRole); + return this; + } + + /** + *

System role the key inherits its permissions from, or null when it uses an explicit permissions policy. Only account API keys can use a system role.

+ */ + @java.lang.Override + @JsonSetter(value = "system_role", nulls = Nulls.SKIP) + public _FinalStage systemRole(Optional systemRole) { + this.systemRole = systemRole; + return this; + } + + /** + *

The full secret used to authenticate requests. Returned only once, on create and rotate responses — store it immediately.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secretKey(String secretKey) { + this.secretKey = Optional.ofNullable(secretKey); + return this; + } + + /** + *

The full secret used to authenticate requests. Returned only once, on create and rotate responses — store it immediately.

+ */ + @java.lang.Override + @JsonSetter(value = "secret_key", nulls = Nulls.SKIP) + public _FinalStage secretKey(Optional secretKey) { + this.secretKey = secretKey; + return this; + } + + /** + *

Human-readable name identifying the API key, or null when none was set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Human-readable name identifying the API key, or null when none was set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Human-readable name identifying the API key, or null when none was set.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public _FinalStage ipAllowlist(Nullable> ipAllowlist) { + if (ipAllowlist.isNull()) { + this.ipAllowlist = null; + } else if (ipAllowlist.isEmpty()) { + this.ipAllowlist = Optional.empty(); + } else { + this.ipAllowlist = Optional.of(ipAllowlist.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage ipAllowlist(List ipAllowlist) { + this.ipAllowlist = Optional.ofNullable(ipAllowlist); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ip_allowlist", nulls = Nulls.SKIP) + public _FinalStage ipAllowlist(Optional> ipAllowlist) { + this.ipAllowlist = ipAllowlist; + return this; + } + + @java.lang.Override + public _FinalStage grants(List grants) { + this.grants = Optional.ofNullable(grants); + return this; + } + + @java.lang.Override + @JsonSetter(value = "grants", nulls = Nulls.SKIP) + public _FinalStage grants(Optional> grants) { + this.grants = grants; + return this; + } + + /** + *

When the API key stops working, as an ISO 8601 timestamp. null means it never expires.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expiresAt(Nullable expiresAt) { + if (expiresAt.isNull()) { + this.expiresAt = null; + } else if (expiresAt.isEmpty()) { + this.expiresAt = Optional.empty(); + } else { + this.expiresAt = Optional.of(expiresAt.get()); + } + return this; + } + + /** + *

When the API key stops working, as an ISO 8601 timestamp. null means it never expires.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expiresAt(String expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + /** + *

When the API key stops working, as an ISO 8601 timestamp. null means it never expires.

+ */ + @java.lang.Override + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public _FinalStage expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + @java.lang.Override + public ApiKey build() { + return new ApiKey( + apiVersionDate, + createdAt, + expiresAt, + grants, + id, + ipAllowlist, + isDefaultForResource, + name, + obfuscatedSecretKey, + secretKey, + systemRole, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ApiKeyApiVersionDate.java b/src/main/java/com/whop/api/types/ApiKeyApiVersionDate.java new file mode 100644 index 00000000..72afdeee --- /dev/null +++ b/src/main/java/com/whop/api/types/ApiKeyApiVersionDate.java @@ -0,0 +1,338 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ApiKeyApiVersionDate { + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0708 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0708, "2026-07-08"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX08051 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX08051, "2026-08-05-1"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0821 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0821, "2026-08-21"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX07291 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX07291, "2026-07-29-1"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0731 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0731, "2026-07-31"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0729 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0729, "2026-07-29"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0803 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0803, "2026-08-03"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0620 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0620, "2026-06-20"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_FIVE0101 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_FIVE0101, "2025-01-01"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX07081 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX07081, "2026-07-08-1"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0723 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0723, "2026-07-23"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0810 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0810, "2026-08-10"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0722 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0722, "2026-07-22"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0720 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0720, "2026-07-20"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0718 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0718, "2026-07-18"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0805 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0805, "2026-08-05"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0727 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0727, "2026-07-27"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0726 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0726, "2026-07-26"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0701 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0701, "2026-07-01"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0813 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0813, "2026-08-13"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0725 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0725, "2026-07-25"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0814 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0814, "2026-08-14"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0608 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0608, "2026-06-08"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0609 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0609, "2026-06-09"); + + public static final ApiKeyApiVersionDate TWO_THOUSAND_TWENTY_SIX0812 = + new ApiKeyApiVersionDate(Value.TWO_THOUSAND_TWENTY_SIX0812, "2026-08-12"); + + private final Value value; + + private final String string; + + ApiKeyApiVersionDate(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ApiKeyApiVersionDate && this.string.equals(((ApiKeyApiVersionDate) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TWO_THOUSAND_TWENTY_SIX0708: + return visitor.visitTwoThousandTwentySix0708(); + case TWO_THOUSAND_TWENTY_SIX08051: + return visitor.visitTwoThousandTwentySix08051(); + case TWO_THOUSAND_TWENTY_SIX0821: + return visitor.visitTwoThousandTwentySix0821(); + case TWO_THOUSAND_TWENTY_SIX07291: + return visitor.visitTwoThousandTwentySix07291(); + case TWO_THOUSAND_TWENTY_SIX0731: + return visitor.visitTwoThousandTwentySix0731(); + case TWO_THOUSAND_TWENTY_SIX0729: + return visitor.visitTwoThousandTwentySix0729(); + case TWO_THOUSAND_TWENTY_SIX0803: + return visitor.visitTwoThousandTwentySix0803(); + case TWO_THOUSAND_TWENTY_SIX0620: + return visitor.visitTwoThousandTwentySix0620(); + case TWO_THOUSAND_TWENTY_FIVE0101: + return visitor.visitTwoThousandTwentyFive0101(); + case TWO_THOUSAND_TWENTY_SIX07081: + return visitor.visitTwoThousandTwentySix07081(); + case TWO_THOUSAND_TWENTY_SIX0723: + return visitor.visitTwoThousandTwentySix0723(); + case TWO_THOUSAND_TWENTY_SIX0810: + return visitor.visitTwoThousandTwentySix0810(); + case TWO_THOUSAND_TWENTY_SIX0722: + return visitor.visitTwoThousandTwentySix0722(); + case TWO_THOUSAND_TWENTY_SIX0720: + return visitor.visitTwoThousandTwentySix0720(); + case TWO_THOUSAND_TWENTY_SIX0718: + return visitor.visitTwoThousandTwentySix0718(); + case TWO_THOUSAND_TWENTY_SIX0805: + return visitor.visitTwoThousandTwentySix0805(); + case TWO_THOUSAND_TWENTY_SIX0727: + return visitor.visitTwoThousandTwentySix0727(); + case TWO_THOUSAND_TWENTY_SIX0726: + return visitor.visitTwoThousandTwentySix0726(); + case TWO_THOUSAND_TWENTY_SIX0701: + return visitor.visitTwoThousandTwentySix0701(); + case TWO_THOUSAND_TWENTY_SIX0813: + return visitor.visitTwoThousandTwentySix0813(); + case TWO_THOUSAND_TWENTY_SIX0725: + return visitor.visitTwoThousandTwentySix0725(); + case TWO_THOUSAND_TWENTY_SIX0814: + return visitor.visitTwoThousandTwentySix0814(); + case TWO_THOUSAND_TWENTY_SIX0608: + return visitor.visitTwoThousandTwentySix0608(); + case TWO_THOUSAND_TWENTY_SIX0609: + return visitor.visitTwoThousandTwentySix0609(); + case TWO_THOUSAND_TWENTY_SIX0812: + return visitor.visitTwoThousandTwentySix0812(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ApiKeyApiVersionDate valueOf(String value) { + switch (value) { + case "2026-07-08": + return TWO_THOUSAND_TWENTY_SIX0708; + case "2026-08-05-1": + return TWO_THOUSAND_TWENTY_SIX08051; + case "2026-08-21": + return TWO_THOUSAND_TWENTY_SIX0821; + case "2026-07-29-1": + return TWO_THOUSAND_TWENTY_SIX07291; + case "2026-07-31": + return TWO_THOUSAND_TWENTY_SIX0731; + case "2026-07-29": + return TWO_THOUSAND_TWENTY_SIX0729; + case "2026-08-03": + return TWO_THOUSAND_TWENTY_SIX0803; + case "2026-06-20": + return TWO_THOUSAND_TWENTY_SIX0620; + case "2025-01-01": + return TWO_THOUSAND_TWENTY_FIVE0101; + case "2026-07-08-1": + return TWO_THOUSAND_TWENTY_SIX07081; + case "2026-07-23": + return TWO_THOUSAND_TWENTY_SIX0723; + case "2026-08-10": + return TWO_THOUSAND_TWENTY_SIX0810; + case "2026-07-22": + return TWO_THOUSAND_TWENTY_SIX0722; + case "2026-07-20": + return TWO_THOUSAND_TWENTY_SIX0720; + case "2026-07-18": + return TWO_THOUSAND_TWENTY_SIX0718; + case "2026-08-05": + return TWO_THOUSAND_TWENTY_SIX0805; + case "2026-07-27": + return TWO_THOUSAND_TWENTY_SIX0727; + case "2026-07-26": + return TWO_THOUSAND_TWENTY_SIX0726; + case "2026-07-01": + return TWO_THOUSAND_TWENTY_SIX0701; + case "2026-08-13": + return TWO_THOUSAND_TWENTY_SIX0813; + case "2026-07-25": + return TWO_THOUSAND_TWENTY_SIX0725; + case "2026-08-14": + return TWO_THOUSAND_TWENTY_SIX0814; + case "2026-06-08": + return TWO_THOUSAND_TWENTY_SIX0608; + case "2026-06-09": + return TWO_THOUSAND_TWENTY_SIX0609; + case "2026-08-12": + return TWO_THOUSAND_TWENTY_SIX0812; + default: + return new ApiKeyApiVersionDate(Value.UNKNOWN, value); + } + } + + public enum Value { + TWO_THOUSAND_TWENTY_FIVE0101, + + TWO_THOUSAND_TWENTY_SIX0608, + + TWO_THOUSAND_TWENTY_SIX0609, + + TWO_THOUSAND_TWENTY_SIX0620, + + TWO_THOUSAND_TWENTY_SIX0701, + + TWO_THOUSAND_TWENTY_SIX0708, + + TWO_THOUSAND_TWENTY_SIX07081, + + TWO_THOUSAND_TWENTY_SIX0718, + + TWO_THOUSAND_TWENTY_SIX0720, + + TWO_THOUSAND_TWENTY_SIX0722, + + TWO_THOUSAND_TWENTY_SIX0723, + + TWO_THOUSAND_TWENTY_SIX0725, + + TWO_THOUSAND_TWENTY_SIX0726, + + TWO_THOUSAND_TWENTY_SIX0727, + + TWO_THOUSAND_TWENTY_SIX0729, + + TWO_THOUSAND_TWENTY_SIX07291, + + TWO_THOUSAND_TWENTY_SIX0731, + + TWO_THOUSAND_TWENTY_SIX0803, + + TWO_THOUSAND_TWENTY_SIX0805, + + TWO_THOUSAND_TWENTY_SIX08051, + + TWO_THOUSAND_TWENTY_SIX0810, + + TWO_THOUSAND_TWENTY_SIX0812, + + TWO_THOUSAND_TWENTY_SIX0813, + + TWO_THOUSAND_TWENTY_SIX0814, + + TWO_THOUSAND_TWENTY_SIX0821, + + UNKNOWN + } + + public interface Visitor { + T visitTwoThousandTwentyFive0101(); + + T visitTwoThousandTwentySix0608(); + + T visitTwoThousandTwentySix0609(); + + T visitTwoThousandTwentySix0620(); + + T visitTwoThousandTwentySix0701(); + + T visitTwoThousandTwentySix0708(); + + T visitTwoThousandTwentySix07081(); + + T visitTwoThousandTwentySix0718(); + + T visitTwoThousandTwentySix0720(); + + T visitTwoThousandTwentySix0722(); + + T visitTwoThousandTwentySix0723(); + + T visitTwoThousandTwentySix0725(); + + T visitTwoThousandTwentySix0726(); + + T visitTwoThousandTwentySix0727(); + + T visitTwoThousandTwentySix0729(); + + T visitTwoThousandTwentySix07291(); + + T visitTwoThousandTwentySix0731(); + + T visitTwoThousandTwentySix0803(); + + T visitTwoThousandTwentySix0805(); + + T visitTwoThousandTwentySix08051(); + + T visitTwoThousandTwentySix0810(); + + T visitTwoThousandTwentySix0812(); + + T visitTwoThousandTwentySix0813(); + + T visitTwoThousandTwentySix0814(); + + T visitTwoThousandTwentySix0821(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ApiKeyGrant.java b/src/main/java/com/whop/api/types/ApiKeyGrant.java new file mode 100644 index 00000000..473f13f3 --- /dev/null +++ b/src/main/java/com/whop/api/types/ApiKeyGrant.java @@ -0,0 +1,212 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ApiKeyGrant.Builder.class) +public final class ApiKeyGrant { + private final List actions; + + private final String resourceId; + + private final String resourceType; + + private final Map additionalProperties; + + private ApiKeyGrant( + List actions, + String resourceId, + String resourceType, + Map additionalProperties) { + this.actions = actions; + this.resourceId = resourceId; + this.resourceType = resourceType; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("actions") + public List getActions() { + return actions; + } + + /** + * @return ID of the resource the actions apply to. + */ + @JsonProperty("resource_id") + public String getResourceId() { + return resourceId; + } + + /** + * @return The type of resource the actions apply to, such as account, product, or app. + */ + @JsonProperty("resource_type") + public String getResourceType() { + return resourceType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ApiKeyGrant && equalTo((ApiKeyGrant) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ApiKeyGrant other) { + return actions.equals(other.actions) + && resourceId.equals(other.resourceId) + && resourceType.equals(other.resourceType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.actions, this.resourceId, this.resourceType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ResourceIdStage builder() { + return new Builder(); + } + + public interface ResourceIdStage { + /** + *

ID of the resource the actions apply to.

+ */ + ResourceTypeStage resourceId(@NotNull String resourceId); + + Builder from(ApiKeyGrant other); + } + + public interface ResourceTypeStage { + /** + *

The type of resource the actions apply to, such as account, product, or app.

+ */ + _FinalStage resourceType(@NotNull String resourceType); + } + + public interface _FinalStage { + ApiKeyGrant build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage actions(List actions); + + _FinalStage addActions(ApiKeyGrantAction actions); + + _FinalStage addAllActions(List actions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ResourceIdStage, ResourceTypeStage, _FinalStage { + private String resourceId; + + private String resourceType; + + private List actions = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ApiKeyGrant other) { + actions(other.getActions()); + resourceId(other.getResourceId()); + resourceType(other.getResourceType()); + return this; + } + + /** + *

ID of the resource the actions apply to.

+ *

ID of the resource the actions apply to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_id") + public ResourceTypeStage resourceId(@NotNull String resourceId) { + this.resourceId = Objects.requireNonNull(resourceId, "resourceId must not be null"); + return this; + } + + /** + *

The type of resource the actions apply to, such as account, product, or app.

+ *

The type of resource the actions apply to, such as account, product, or app.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_type") + public _FinalStage resourceType(@NotNull String resourceType) { + this.resourceType = Objects.requireNonNull(resourceType, "resourceType must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllActions(List actions) { + if (actions != null) { + this.actions.addAll(actions); + } + return this; + } + + @java.lang.Override + public _FinalStage addActions(ApiKeyGrantAction actions) { + this.actions.add(actions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "actions", nulls = Nulls.SKIP) + public _FinalStage actions(List actions) { + this.actions.clear(); + if (actions != null) { + this.actions.addAll(actions); + } + return this; + } + + @java.lang.Override + public ApiKeyGrant build() { + return new ApiKeyGrant(actions, resourceId, resourceType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ApiKeyGrantAction.java b/src/main/java/com/whop/api/types/ApiKeyGrantAction.java new file mode 100644 index 00000000..04fb8f1d --- /dev/null +++ b/src/main/java/com/whop/api/types/ApiKeyGrantAction.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ApiKeyGrantAction.Builder.class) +public final class ApiKeyGrantAction { + private final String action; + + private final boolean granted; + + private final Map additionalProperties; + + private ApiKeyGrantAction(String action, boolean granted, Map additionalProperties) { + this.action = action; + this.granted = granted; + this.additionalProperties = additionalProperties; + } + + /** + * @return The permission action's identifier, for example company:basic:read. + */ + @JsonProperty("action") + public String getAction() { + return action; + } + + /** + * @return Whether the key holds the action on the grant's resource. + */ + @JsonProperty("granted") + public boolean getGranted() { + return granted; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ApiKeyGrantAction && equalTo((ApiKeyGrantAction) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ApiKeyGrantAction other) { + return action.equals(other.action) && granted == other.granted; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.action, this.granted); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + /** + *

The permission action's identifier, for example company:basic:read.

+ */ + GrantedStage action(@NotNull String action); + + Builder from(ApiKeyGrantAction other); + } + + public interface GrantedStage { + /** + *

Whether the key holds the action on the grant's resource.

+ */ + _FinalStage granted(boolean granted); + } + + public interface _FinalStage { + ApiKeyGrantAction build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ActionStage, GrantedStage, _FinalStage { + private String action; + + private boolean granted; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ApiKeyGrantAction other) { + action(other.getAction()); + granted(other.getGranted()); + return this; + } + + /** + *

The permission action's identifier, for example company:basic:read.

+ *

The permission action's identifier, for example company:basic:read.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("action") + public GrantedStage action(@NotNull String action) { + this.action = Objects.requireNonNull(action, "action must not be null"); + return this; + } + + /** + *

Whether the key holds the action on the grant's resource.

+ *

Whether the key holds the action on the grant's resource.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("granted") + public _FinalStage granted(boolean granted) { + this.granted = granted; + return this; + } + + @java.lang.Override + public ApiKeyGrantAction build() { + return new ApiKeyGrantAction(action, granted, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ApiKeySystemRole.java b/src/main/java/com/whop/api/types/ApiKeySystemRole.java new file mode 100644 index 00000000..3076060c --- /dev/null +++ b/src/main/java/com/whop/api/types/ApiKeySystemRole.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ApiKeySystemRole { + public static final ApiKeySystemRole OWNER = new ApiKeySystemRole(Value.OWNER, "owner"); + + public static final ApiKeySystemRole ADMIN = new ApiKeySystemRole(Value.ADMIN, "admin"); + + public static final ApiKeySystemRole SALES_MANAGER = new ApiKeySystemRole(Value.SALES_MANAGER, "sales_manager"); + + public static final ApiKeySystemRole MODERATOR = new ApiKeySystemRole(Value.MODERATOR, "moderator"); + + public static final ApiKeySystemRole ADVERTISER = new ApiKeySystemRole(Value.ADVERTISER, "advertiser"); + + private final Value value; + + private final String string; + + ApiKeySystemRole(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ApiKeySystemRole && this.string.equals(((ApiKeySystemRole) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case OWNER: + return visitor.visitOwner(); + case ADMIN: + return visitor.visitAdmin(); + case SALES_MANAGER: + return visitor.visitSalesManager(); + case MODERATOR: + return visitor.visitModerator(); + case ADVERTISER: + return visitor.visitAdvertiser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ApiKeySystemRole valueOf(String value) { + switch (value) { + case "owner": + return OWNER; + case "admin": + return ADMIN; + case "sales_manager": + return SALES_MANAGER; + case "moderator": + return MODERATOR; + case "advertiser": + return ADVERTISER; + default: + return new ApiKeySystemRole(Value.UNKNOWN, value); + } + } + + public enum Value { + OWNER, + + ADMIN, + + MODERATOR, + + SALES_MANAGER, + + ADVERTISER, + + UNKNOWN + } + + public interface Visitor { + T visitOwner(); + + T visitAdmin(); + + T visitModerator(); + + T visitSalesManager(); + + T visitAdvertiser(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ApiVersion.java b/src/main/java/com/whop/api/types/ApiVersion.java new file mode 100644 index 00000000..5b39b396 --- /dev/null +++ b/src/main/java/com/whop/api/types/ApiVersion.java @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ApiVersion { + public static final ApiVersion V2 = new ApiVersion(Value.V2, "v2"); + + public static final ApiVersion V1 = new ApiVersion(Value.V1, "v1"); + + public static final ApiVersion V5 = new ApiVersion(Value.V5, "v5"); + + private final Value value; + + private final String string; + + ApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof ApiVersion && this.string.equals(((ApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V2: + return visitor.visitV2(); + case V1: + return visitor.visitV1(); + case V5: + return visitor.visitV5(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ApiVersion valueOf(String value) { + switch (value) { + case "v2": + return V2; + case "v1": + return V1; + case "v5": + return V5; + default: + return new ApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + V2, + + V5, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitV2(); + + T visitV5(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/App.java b/src/main/java/com/whop/api/types/App.java new file mode 100644 index 00000000..6b949a37 --- /dev/null +++ b/src/main/java/com/whop/api/types/App.java @@ -0,0 +1,2215 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = App.Builder.class) +public final class App { + private final AccountParent account; + + private final Optional apiKey; + + private final Optional appStoreDescription; + + private final AppAppType appType; + + private final Optional bannerImage; + + private final Optional baseUrl; + + private final int businessesCreatedCount; + + private final List businessesCreatedLogoUrls; + + private final AppCreator creator; + + private final Optional dashboardPath; + + private final Optional defaultApiKey; + + private final Optional deployment; + + private final Optional description; + + private final Optional discoverPath; + + private final String domainId; + + private final Optional experiencePath; + + private final Optional hostedUrl; + + private final AppIcon icon; + + private final String id; + + private final Optional marketplaceStatus; + + private final String name; + + private final AppOauthClientType oauthClientType; + + private final Optional openapiPath; + + private final Optional origin; + + private final Optional productId; + + private final Optional productionAndroidBuild; + + private final Optional productionIosBuild; + + private final Optional productionWebBuild; + + private final List redirectUris; + + private final List requestedPermissions; + + private final List requiredScopes; + + private final Optional route; + + private final Optional> secrets; + + private final Optional skillsPath; + + private final AppStatus status; + + private final boolean verified; + + private final Map additionalProperties; + + private App( + AccountParent account, + Optional apiKey, + Optional appStoreDescription, + AppAppType appType, + Optional bannerImage, + Optional baseUrl, + int businessesCreatedCount, + List businessesCreatedLogoUrls, + AppCreator creator, + Optional dashboardPath, + Optional defaultApiKey, + Optional deployment, + Optional description, + Optional discoverPath, + String domainId, + Optional experiencePath, + Optional hostedUrl, + AppIcon icon, + String id, + Optional marketplaceStatus, + String name, + AppOauthClientType oauthClientType, + Optional openapiPath, + Optional origin, + Optional productId, + Optional productionAndroidBuild, + Optional productionIosBuild, + Optional productionWebBuild, + List redirectUris, + List requestedPermissions, + List requiredScopes, + Optional route, + Optional> secrets, + Optional skillsPath, + AppStatus status, + boolean verified, + Map additionalProperties) { + this.account = account; + this.apiKey = apiKey; + this.appStoreDescription = appStoreDescription; + this.appType = appType; + this.bannerImage = bannerImage; + this.baseUrl = baseUrl; + this.businessesCreatedCount = businessesCreatedCount; + this.businessesCreatedLogoUrls = businessesCreatedLogoUrls; + this.creator = creator; + this.dashboardPath = dashboardPath; + this.defaultApiKey = defaultApiKey; + this.deployment = deployment; + this.description = description; + this.discoverPath = discoverPath; + this.domainId = domainId; + this.experiencePath = experiencePath; + this.hostedUrl = hostedUrl; + this.icon = icon; + this.id = id; + this.marketplaceStatus = marketplaceStatus; + this.name = name; + this.oauthClientType = oauthClientType; + this.openapiPath = openapiPath; + this.origin = origin; + this.productId = productId; + this.productionAndroidBuild = productionAndroidBuild; + this.productionIosBuild = productionIosBuild; + this.productionWebBuild = productionWebBuild; + this.redirectUris = redirectUris; + this.requestedPermissions = requestedPermissions; + this.requiredScopes = requiredScopes; + this.route = route; + this.secrets = secrets; + this.skillsPath = skillsPath; + this.status = status; + this.verified = verified; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account that owns the app. + */ + @JsonProperty("account") + public AccountParent getAccount() { + return account; + } + + /** + * @return Legacy app API key used to authenticate requests on the app's behalf. null when no key exists or the caller lacks the developer:manage_api_key permission. + */ + @JsonIgnore + public Optional getApiKey() { + if (apiKey == null) { + return Optional.empty(); + } + return apiKey; + } + + /** + * @return Detailed description shown on the app store's in-depth app page, or null when none has been set. + */ + @JsonIgnore + public Optional getAppStoreDescription() { + if (appStoreDescription == null) { + return Optional.empty(); + } + return appStoreDescription; + } + + /** + * @return The type of end-user the app is built for. + */ + @JsonProperty("app_type") + public AppAppType getAppType() { + return appType; + } + + /** + * @return Banner image from the app's product listing, or null when none is uploaded. + */ + @JsonIgnore + public Optional getBannerImage() { + if (bannerImage == null) { + return Optional.empty(); + } + return bannerImage; + } + + /** + * @return The production base URL where the app is hosted. null if no base URL is configured, if the caller lacks the developer:basic:read permission on the app's account, or on list responses, which never expose it. + */ + @JsonIgnore + public Optional getBaseUrl() { + if (baseUrl == null) { + return Optional.empty(); + } + return baseUrl; + } + + /** + * @return Website businesses created from this app as a template. + */ + @JsonProperty("businesses_created_count") + public int getBusinessesCreatedCount() { + return businessesCreatedCount; + } + + @JsonProperty("businesses_created_logo_urls") + public List getBusinessesCreatedLogoUrls() { + return businessesCreatedLogoUrls; + } + + /** + * @return The user who owns the publishing account. + */ + @JsonProperty("creator") + public AppCreator getCreator() { + return creator; + } + + /** + * @return URL path for the account dashboard view, or null when not configured. + */ + @JsonIgnore + public Optional getDashboardPath() { + if (dashboardPath == null) { + return Optional.empty(); + } + return dashboardPath; + } + + /** + * @return The app's default API key. null when the app has no default key or the caller lacks the developer:manage_api_key permission; secret_key is additionally null unless the caller could have created the key themselves. + */ + @JsonIgnore + public Optional getDefaultApiKey() { + if (defaultApiKey == null) { + return Optional.empty(); + } + return defaultApiKey; + } + + /** + * @return What the app has left to publish, and how a publish in flight is going — status is only ever unpublished, publishing, or failed here. null means there is nothing to report: the app is fully published, there is no working copy to publish from, or the caller cannot deploy this app. Tell those apart from the app's own production_web_build. + */ + @JsonIgnore + public Optional getDeployment() { + if (deployment == null) { + return Optional.empty(); + } + return deployment; + } + + /** + * @return Short description shown in listings and search results, or null if none has been set. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return URL path for the discover view, or null when not configured. + */ + @JsonIgnore + public Optional getDiscoverPath() { + if (discoverPath == null) { + return Optional.empty(); + } + return discoverPath; + } + + /** + * @return Subdomain identifier for the app's proxied URL, forming https://{domain_id}.apps.whop.com. + */ + @JsonProperty("domain_id") + public String getDomainId() { + return domainId; + } + + /** + * @return URL path for the member-facing hub view, or null when not configured. + */ + @JsonIgnore + public Optional getExperiencePath() { + if (experiencePath == null) { + return Optional.empty(); + } + return experiencePath; + } + + /** + * @return Full URL where the app's hosted web build is served, or null if no route is claimed. + */ + @JsonIgnore + public Optional getHostedUrl() { + if (hostedUrl == null) { + return Optional.empty(); + } + return hostedUrl; + } + + /** + * @return The app's icon. Falls back to the default app icon when none is uploaded. + */ + @JsonProperty("icon") + public AppIcon getIcon() { + return icon; + } + + /** + * @return App ID, prefixed app_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Approval status of the app's product listing on the Whop app store, or null when the app has no associated product. + */ + @JsonIgnore + public Optional getMarketplaceStatus() { + if (marketplaceStatus == null) { + return Optional.empty(); + } + return marketplaceStatus; + } + + /** + * @return Display name shown on the app store and in experience navigation. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return How the app authenticates at the OAuth token endpoint. + */ + @JsonProperty("oauth_client_type") + public AppOauthClientType getOauthClientType() { + return oauthClientType; + } + + /** + * @return URL path to the app's OpenAPI spec file, or null when not configured. + */ + @JsonIgnore + public Optional getOpenapiPath() { + if (openapiPath == null) { + return Optional.empty(); + } + return openapiPath; + } + + /** + * @return Full origin URL of the app's proxied domain, for example https://ab1c2d3e4f.apps.whop.com. + */ + @JsonIgnore + public Optional getOrigin() { + if (origin == null) { + return Optional.empty(); + } + return origin; + } + + /** + * @return ID of the app's product listing on the Whop app store, or null when the app has no associated product. + */ + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + /** + * @return The approved build currently served on Android, or null when none is deployed. + */ + @JsonIgnore + public Optional getProductionAndroidBuild() { + if (productionAndroidBuild == null) { + return Optional.empty(); + } + return productionAndroidBuild; + } + + /** + * @return The approved build currently served on iOS, or null when none is deployed. + */ + @JsonIgnore + public Optional getProductionIosBuild() { + if (productionIosBuild == null) { + return Optional.empty(); + } + return productionIosBuild; + } + + /** + * @return The approved build currently served on web, or null when none is deployed. + */ + @JsonIgnore + public Optional getProductionWebBuild() { + if (productionWebBuild == null) { + return Optional.empty(); + } + return productionWebBuild; + } + + @JsonProperty("redirect_uris") + public List getRedirectUris() { + return redirectUris; + } + + @JsonProperty("requested_permissions") + public List getRequestedPermissions() { + return requestedPermissions; + } + + @JsonProperty("required_scopes") + public List getRequiredScopes() { + return requiredScopes; + } + + /** + * @return Claimed subdomain route where hosted web builds are served (myapp for myapp.whop.app), or null if no route is claimed. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return The app's production secrets as an object of string values, injected into the hosted server runtime. null when the caller lacks the developer:update_app permission. + */ + @JsonIgnore + public Optional> getSecrets() { + if (secrets == null) { + return Optional.empty(); + } + return secrets; + } + + /** + * @return URL path to the app's skills directory, or null when not configured. + */ + @JsonIgnore + public Optional getSkillsPath() { + if (skillsPath == null) { + return Optional.empty(); + } + return skillsPath; + } + + /** + * @return Visibility on the Whop app store: live is publicly discoverable, unlisted is accessible only via direct link, hidden is not visible anywhere. + */ + @JsonProperty("status") + public AppStatus getStatus() { + return status; + } + + /** + * @return Whether the app has been verified by Whop and is eligible for the featured apps section. + */ + @JsonProperty("verified") + public boolean getVerified() { + return verified; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_key") + private Optional _getApiKey() { + return apiKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("app_store_description") + private Optional _getAppStoreDescription() { + return appStoreDescription; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("banner_image") + private Optional _getBannerImage() { + return bannerImage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("base_url") + private Optional _getBaseUrl() { + return baseUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("dashboard_path") + private Optional _getDashboardPath() { + return dashboardPath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("default_api_key") + private Optional _getDefaultApiKey() { + return defaultApiKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("deployment") + private Optional _getDeployment() { + return deployment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("discover_path") + private Optional _getDiscoverPath() { + return discoverPath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("experience_path") + private Optional _getExperiencePath() { + return experiencePath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("hosted_url") + private Optional _getHostedUrl() { + return hostedUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("marketplace_status") + private Optional _getMarketplaceStatus() { + return marketplaceStatus; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("openapi_path") + private Optional _getOpenapiPath() { + return openapiPath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("origin") + private Optional _getOrigin() { + return origin; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("production_android_build") + private Optional _getProductionAndroidBuild() { + return productionAndroidBuild; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("production_ios_build") + private Optional _getProductionIosBuild() { + return productionIosBuild; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("production_web_build") + private Optional _getProductionWebBuild() { + return productionWebBuild; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("secrets") + private Optional> _getSecrets() { + return secrets; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("skills_path") + private Optional _getSkillsPath() { + return skillsPath; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof App && equalTo((App) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(App other) { + return account.equals(other.account) + && apiKey.equals(other.apiKey) + && appStoreDescription.equals(other.appStoreDescription) + && appType.equals(other.appType) + && bannerImage.equals(other.bannerImage) + && baseUrl.equals(other.baseUrl) + && businessesCreatedCount == other.businessesCreatedCount + && businessesCreatedLogoUrls.equals(other.businessesCreatedLogoUrls) + && creator.equals(other.creator) + && dashboardPath.equals(other.dashboardPath) + && defaultApiKey.equals(other.defaultApiKey) + && deployment.equals(other.deployment) + && description.equals(other.description) + && discoverPath.equals(other.discoverPath) + && domainId.equals(other.domainId) + && experiencePath.equals(other.experiencePath) + && hostedUrl.equals(other.hostedUrl) + && icon.equals(other.icon) + && id.equals(other.id) + && marketplaceStatus.equals(other.marketplaceStatus) + && name.equals(other.name) + && oauthClientType.equals(other.oauthClientType) + && openapiPath.equals(other.openapiPath) + && origin.equals(other.origin) + && productId.equals(other.productId) + && productionAndroidBuild.equals(other.productionAndroidBuild) + && productionIosBuild.equals(other.productionIosBuild) + && productionWebBuild.equals(other.productionWebBuild) + && redirectUris.equals(other.redirectUris) + && requestedPermissions.equals(other.requestedPermissions) + && requiredScopes.equals(other.requiredScopes) + && route.equals(other.route) + && secrets.equals(other.secrets) + && skillsPath.equals(other.skillsPath) + && status.equals(other.status) + && verified == other.verified; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.account, + this.apiKey, + this.appStoreDescription, + this.appType, + this.bannerImage, + this.baseUrl, + this.businessesCreatedCount, + this.businessesCreatedLogoUrls, + this.creator, + this.dashboardPath, + this.defaultApiKey, + this.deployment, + this.description, + this.discoverPath, + this.domainId, + this.experiencePath, + this.hostedUrl, + this.icon, + this.id, + this.marketplaceStatus, + this.name, + this.oauthClientType, + this.openapiPath, + this.origin, + this.productId, + this.productionAndroidBuild, + this.productionIosBuild, + this.productionWebBuild, + this.redirectUris, + this.requestedPermissions, + this.requiredScopes, + this.route, + this.secrets, + this.skillsPath, + this.status, + this.verified); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountStage builder() { + return new Builder(); + } + + public interface AccountStage { + /** + *

The account that owns the app.

+ */ + AppTypeStage account(@NotNull AccountParent account); + + Builder from(App other); + } + + public interface AppTypeStage { + /** + *

The type of end-user the app is built for.

+ */ + BusinessesCreatedCountStage appType(@NotNull AppAppType appType); + } + + public interface BusinessesCreatedCountStage { + /** + *

Website businesses created from this app as a template.

+ */ + CreatorStage businessesCreatedCount(int businessesCreatedCount); + } + + public interface CreatorStage { + /** + *

The user who owns the publishing account.

+ */ + DomainIdStage creator(@NotNull AppCreator creator); + } + + public interface DomainIdStage { + /** + *

Subdomain identifier for the app's proxied URL, forming https://{domain_id}.apps.whop.com.

+ */ + IconStage domainId(@NotNull String domainId); + } + + public interface IconStage { + /** + *

The app's icon. Falls back to the default app icon when none is uploaded.

+ */ + IdStage icon(@NotNull AppIcon icon); + } + + public interface IdStage { + /** + *

App ID, prefixed app_.

+ */ + NameStage id(@NotNull String id); + } + + public interface NameStage { + /** + *

Display name shown on the app store and in experience navigation.

+ */ + OauthClientTypeStage name(@NotNull String name); + } + + public interface OauthClientTypeStage { + /** + *

How the app authenticates at the OAuth token endpoint.

+ */ + StatusStage oauthClientType(@NotNull AppOauthClientType oauthClientType); + } + + public interface StatusStage { + /** + *

Visibility on the Whop app store: live is publicly discoverable, unlisted is accessible only via direct link, hidden is not visible anywhere.

+ */ + VerifiedStage status(@NotNull AppStatus status); + } + + public interface VerifiedStage { + /** + *

Whether the app has been verified by Whop and is eligible for the featured apps section.

+ */ + _FinalStage verified(boolean verified); + } + + public interface _FinalStage { + App build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Legacy app API key used to authenticate requests on the app's behalf. null when no key exists or the caller lacks the developer:manage_api_key permission.

+ */ + _FinalStage apiKey(Optional apiKey); + + _FinalStage apiKey(AppApiKey apiKey); + + _FinalStage apiKey(Nullable apiKey); + + /** + *

Detailed description shown on the app store's in-depth app page, or null when none has been set.

+ */ + _FinalStage appStoreDescription(Optional appStoreDescription); + + _FinalStage appStoreDescription(String appStoreDescription); + + _FinalStage appStoreDescription(Nullable appStoreDescription); + + /** + *

Banner image from the app's product listing, or null when none is uploaded.

+ */ + _FinalStage bannerImage(Optional bannerImage); + + _FinalStage bannerImage(AppBannerImage bannerImage); + + _FinalStage bannerImage(Nullable bannerImage); + + /** + *

The production base URL where the app is hosted. null if no base URL is configured, if the caller lacks the developer:basic:read permission on the app's account, or on list responses, which never expose it.

+ */ + _FinalStage baseUrl(Optional baseUrl); + + _FinalStage baseUrl(String baseUrl); + + _FinalStage baseUrl(Nullable baseUrl); + + _FinalStage businessesCreatedLogoUrls(List businessesCreatedLogoUrls); + + _FinalStage addBusinessesCreatedLogoUrls(String businessesCreatedLogoUrls); + + _FinalStage addAllBusinessesCreatedLogoUrls(List businessesCreatedLogoUrls); + + /** + *

URL path for the account dashboard view, or null when not configured.

+ */ + _FinalStage dashboardPath(Optional dashboardPath); + + _FinalStage dashboardPath(String dashboardPath); + + _FinalStage dashboardPath(Nullable dashboardPath); + + /** + *

The app's default API key. null when the app has no default key or the caller lacks the developer:manage_api_key permission; secret_key is additionally null unless the caller could have created the key themselves.

+ */ + _FinalStage defaultApiKey(Optional defaultApiKey); + + _FinalStage defaultApiKey(AppDefaultApiKey defaultApiKey); + + _FinalStage defaultApiKey(Nullable defaultApiKey); + + /** + *

What the app has left to publish, and how a publish in flight is going — status is only ever unpublished, publishing, or failed here. null means there is nothing to report: the app is fully published, there is no working copy to publish from, or the caller cannot deploy this app. Tell those apart from the app's own production_web_build.

+ */ + _FinalStage deployment(Optional deployment); + + _FinalStage deployment(AppDeployment deployment); + + _FinalStage deployment(Nullable deployment); + + /** + *

Short description shown in listings and search results, or null if none has been set.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

URL path for the discover view, or null when not configured.

+ */ + _FinalStage discoverPath(Optional discoverPath); + + _FinalStage discoverPath(String discoverPath); + + _FinalStage discoverPath(Nullable discoverPath); + + /** + *

URL path for the member-facing hub view, or null when not configured.

+ */ + _FinalStage experiencePath(Optional experiencePath); + + _FinalStage experiencePath(String experiencePath); + + _FinalStage experiencePath(Nullable experiencePath); + + /** + *

Full URL where the app's hosted web build is served, or null if no route is claimed.

+ */ + _FinalStage hostedUrl(Optional hostedUrl); + + _FinalStage hostedUrl(String hostedUrl); + + _FinalStage hostedUrl(Nullable hostedUrl); + + /** + *

Approval status of the app's product listing on the Whop app store, or null when the app has no associated product.

+ */ + _FinalStage marketplaceStatus(Optional marketplaceStatus); + + _FinalStage marketplaceStatus(AppMarketplaceStatus marketplaceStatus); + + _FinalStage marketplaceStatus(Nullable marketplaceStatus); + + /** + *

URL path to the app's OpenAPI spec file, or null when not configured.

+ */ + _FinalStage openapiPath(Optional openapiPath); + + _FinalStage openapiPath(String openapiPath); + + _FinalStage openapiPath(Nullable openapiPath); + + /** + *

Full origin URL of the app's proxied domain, for example https://ab1c2d3e4f.apps.whop.com.

+ */ + _FinalStage origin(Optional origin); + + _FinalStage origin(String origin); + + _FinalStage origin(Nullable origin); + + /** + *

ID of the app's product listing on the Whop app store, or null when the app has no associated product.

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + + _FinalStage productId(Nullable productId); + + /** + *

The approved build currently served on Android, or null when none is deployed.

+ */ + _FinalStage productionAndroidBuild(Optional productionAndroidBuild); + + _FinalStage productionAndroidBuild(AppProductionBuild productionAndroidBuild); + + _FinalStage productionAndroidBuild(Nullable productionAndroidBuild); + + /** + *

The approved build currently served on iOS, or null when none is deployed.

+ */ + _FinalStage productionIosBuild(Optional productionIosBuild); + + _FinalStage productionIosBuild(AppProductionBuild productionIosBuild); + + _FinalStage productionIosBuild(Nullable productionIosBuild); + + /** + *

The approved build currently served on web, or null when none is deployed.

+ */ + _FinalStage productionWebBuild(Optional productionWebBuild); + + _FinalStage productionWebBuild(AppProductionBuild productionWebBuild); + + _FinalStage productionWebBuild(Nullable productionWebBuild); + + _FinalStage redirectUris(List redirectUris); + + _FinalStage addRedirectUris(String redirectUris); + + _FinalStage addAllRedirectUris(List redirectUris); + + _FinalStage requestedPermissions(List requestedPermissions); + + _FinalStage addRequestedPermissions(AppRequestedPermission requestedPermissions); + + _FinalStage addAllRequestedPermissions(List requestedPermissions); + + _FinalStage requiredScopes(List requiredScopes); + + _FinalStage addRequiredScopes(AppRequiredScopesItem requiredScopes); + + _FinalStage addAllRequiredScopes(List requiredScopes); + + /** + *

Claimed subdomain route where hosted web builds are served (myapp for myapp.whop.app), or null if no route is claimed.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

The app's production secrets as an object of string values, injected into the hosted server runtime. null when the caller lacks the developer:update_app permission.

+ */ + _FinalStage secrets(Optional> secrets); + + _FinalStage secrets(Map secrets); + + _FinalStage secrets(Nullable> secrets); + + /** + *

URL path to the app's skills directory, or null when not configured.

+ */ + _FinalStage skillsPath(Optional skillsPath); + + _FinalStage skillsPath(String skillsPath); + + _FinalStage skillsPath(Nullable skillsPath); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountStage, + AppTypeStage, + BusinessesCreatedCountStage, + CreatorStage, + DomainIdStage, + IconStage, + IdStage, + NameStage, + OauthClientTypeStage, + StatusStage, + VerifiedStage, + _FinalStage { + private AccountParent account; + + private AppAppType appType; + + private int businessesCreatedCount; + + private AppCreator creator; + + private String domainId; + + private AppIcon icon; + + private String id; + + private String name; + + private AppOauthClientType oauthClientType; + + private AppStatus status; + + private boolean verified; + + private Optional skillsPath = Optional.empty(); + + private Optional> secrets = Optional.empty(); + + private Optional route = Optional.empty(); + + private List requiredScopes = new ArrayList<>(); + + private List requestedPermissions = new ArrayList<>(); + + private List redirectUris = new ArrayList<>(); + + private Optional productionWebBuild = Optional.empty(); + + private Optional productionIosBuild = Optional.empty(); + + private Optional productionAndroidBuild = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional origin = Optional.empty(); + + private Optional openapiPath = Optional.empty(); + + private Optional marketplaceStatus = Optional.empty(); + + private Optional hostedUrl = Optional.empty(); + + private Optional experiencePath = Optional.empty(); + + private Optional discoverPath = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional deployment = Optional.empty(); + + private Optional defaultApiKey = Optional.empty(); + + private Optional dashboardPath = Optional.empty(); + + private List businessesCreatedLogoUrls = new ArrayList<>(); + + private Optional baseUrl = Optional.empty(); + + private Optional bannerImage = Optional.empty(); + + private Optional appStoreDescription = Optional.empty(); + + private Optional apiKey = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(App other) { + account(other.getAccount()); + apiKey(other.getApiKey()); + appStoreDescription(other.getAppStoreDescription()); + appType(other.getAppType()); + bannerImage(other.getBannerImage()); + baseUrl(other.getBaseUrl()); + businessesCreatedCount(other.getBusinessesCreatedCount()); + businessesCreatedLogoUrls(other.getBusinessesCreatedLogoUrls()); + creator(other.getCreator()); + dashboardPath(other.getDashboardPath()); + defaultApiKey(other.getDefaultApiKey()); + deployment(other.getDeployment()); + description(other.getDescription()); + discoverPath(other.getDiscoverPath()); + domainId(other.getDomainId()); + experiencePath(other.getExperiencePath()); + hostedUrl(other.getHostedUrl()); + icon(other.getIcon()); + id(other.getId()); + marketplaceStatus(other.getMarketplaceStatus()); + name(other.getName()); + oauthClientType(other.getOauthClientType()); + openapiPath(other.getOpenapiPath()); + origin(other.getOrigin()); + productId(other.getProductId()); + productionAndroidBuild(other.getProductionAndroidBuild()); + productionIosBuild(other.getProductionIosBuild()); + productionWebBuild(other.getProductionWebBuild()); + redirectUris(other.getRedirectUris()); + requestedPermissions(other.getRequestedPermissions()); + requiredScopes(other.getRequiredScopes()); + route(other.getRoute()); + secrets(other.getSecrets()); + skillsPath(other.getSkillsPath()); + status(other.getStatus()); + verified(other.getVerified()); + return this; + } + + /** + *

The account that owns the app.

+ *

The account that owns the app.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account") + public AppTypeStage account(@NotNull AccountParent account) { + this.account = Objects.requireNonNull(account, "account must not be null"); + return this; + } + + /** + *

The type of end-user the app is built for.

+ *

The type of end-user the app is built for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("app_type") + public BusinessesCreatedCountStage appType(@NotNull AppAppType appType) { + this.appType = Objects.requireNonNull(appType, "appType must not be null"); + return this; + } + + /** + *

Website businesses created from this app as a template.

+ *

Website businesses created from this app as a template.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("businesses_created_count") + public CreatorStage businessesCreatedCount(int businessesCreatedCount) { + this.businessesCreatedCount = businessesCreatedCount; + return this; + } + + /** + *

The user who owns the publishing account.

+ *

The user who owns the publishing account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("creator") + public DomainIdStage creator(@NotNull AppCreator creator) { + this.creator = Objects.requireNonNull(creator, "creator must not be null"); + return this; + } + + /** + *

Subdomain identifier for the app's proxied URL, forming https://{domain_id}.apps.whop.com.

+ *

Subdomain identifier for the app's proxied URL, forming https://{domain_id}.apps.whop.com.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("domain_id") + public IconStage domainId(@NotNull String domainId) { + this.domainId = Objects.requireNonNull(domainId, "domainId must not be null"); + return this; + } + + /** + *

The app's icon. Falls back to the default app icon when none is uploaded.

+ *

The app's icon. Falls back to the default app icon when none is uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icon") + public IdStage icon(@NotNull AppIcon icon) { + this.icon = Objects.requireNonNull(icon, "icon must not be null"); + return this; + } + + /** + *

App ID, prefixed app_.

+ *

App ID, prefixed app_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Display name shown on the app store and in experience navigation.

+ *

Display name shown on the app store and in experience navigation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public OauthClientTypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

How the app authenticates at the OAuth token endpoint.

+ *

How the app authenticates at the OAuth token endpoint.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("oauth_client_type") + public StatusStage oauthClientType(@NotNull AppOauthClientType oauthClientType) { + this.oauthClientType = Objects.requireNonNull(oauthClientType, "oauthClientType must not be null"); + return this; + } + + /** + *

Visibility on the Whop app store: live is publicly discoverable, unlisted is accessible only via direct link, hidden is not visible anywhere.

+ *

Visibility on the Whop app store: live is publicly discoverable, unlisted is accessible only via direct link, hidden is not visible anywhere.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public VerifiedStage status(@NotNull AppStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Whether the app has been verified by Whop and is eligible for the featured apps section.

+ *

Whether the app has been verified by Whop and is eligible for the featured apps section.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("verified") + public _FinalStage verified(boolean verified) { + this.verified = verified; + return this; + } + + /** + *

URL path to the app's skills directory, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage skillsPath(Nullable skillsPath) { + if (skillsPath.isNull()) { + this.skillsPath = null; + } else if (skillsPath.isEmpty()) { + this.skillsPath = Optional.empty(); + } else { + this.skillsPath = Optional.of(skillsPath.get()); + } + return this; + } + + /** + *

URL path to the app's skills directory, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage skillsPath(String skillsPath) { + this.skillsPath = Optional.ofNullable(skillsPath); + return this; + } + + /** + *

URL path to the app's skills directory, or null when not configured.

+ */ + @java.lang.Override + @JsonSetter(value = "skills_path", nulls = Nulls.SKIP) + public _FinalStage skillsPath(Optional skillsPath) { + this.skillsPath = skillsPath; + return this; + } + + /** + *

The app's production secrets as an object of string values, injected into the hosted server runtime. null when the caller lacks the developer:update_app permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(Nullable> secrets) { + if (secrets.isNull()) { + this.secrets = null; + } else if (secrets.isEmpty()) { + this.secrets = Optional.empty(); + } else { + this.secrets = Optional.of(secrets.get()); + } + return this; + } + + /** + *

The app's production secrets as an object of string values, injected into the hosted server runtime. null when the caller lacks the developer:update_app permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secrets(Map secrets) { + this.secrets = Optional.ofNullable(secrets); + return this; + } + + /** + *

The app's production secrets as an object of string values, injected into the hosted server runtime. null when the caller lacks the developer:update_app permission.

+ */ + @java.lang.Override + @JsonSetter(value = "secrets", nulls = Nulls.SKIP) + public _FinalStage secrets(Optional> secrets) { + this.secrets = secrets; + return this; + } + + /** + *

Claimed subdomain route where hosted web builds are served (myapp for myapp.whop.app), or null if no route is claimed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Claimed subdomain route where hosted web builds are served (myapp for myapp.whop.app), or null if no route is claimed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Claimed subdomain route where hosted web builds are served (myapp for myapp.whop.app), or null if no route is claimed.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + @java.lang.Override + public _FinalStage addAllRequiredScopes(List requiredScopes) { + if (requiredScopes != null) { + this.requiredScopes.addAll(requiredScopes); + } + return this; + } + + @java.lang.Override + public _FinalStage addRequiredScopes(AppRequiredScopesItem requiredScopes) { + this.requiredScopes.add(requiredScopes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "required_scopes", nulls = Nulls.SKIP) + public _FinalStage requiredScopes(List requiredScopes) { + this.requiredScopes.clear(); + if (requiredScopes != null) { + this.requiredScopes.addAll(requiredScopes); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllRequestedPermissions(List requestedPermissions) { + if (requestedPermissions != null) { + this.requestedPermissions.addAll(requestedPermissions); + } + return this; + } + + @java.lang.Override + public _FinalStage addRequestedPermissions(AppRequestedPermission requestedPermissions) { + this.requestedPermissions.add(requestedPermissions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "requested_permissions", nulls = Nulls.SKIP) + public _FinalStage requestedPermissions(List requestedPermissions) { + this.requestedPermissions.clear(); + if (requestedPermissions != null) { + this.requestedPermissions.addAll(requestedPermissions); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllRedirectUris(List redirectUris) { + if (redirectUris != null) { + this.redirectUris.addAll(redirectUris); + } + return this; + } + + @java.lang.Override + public _FinalStage addRedirectUris(String redirectUris) { + this.redirectUris.add(redirectUris); + return this; + } + + @java.lang.Override + @JsonSetter(value = "redirect_uris", nulls = Nulls.SKIP) + public _FinalStage redirectUris(List redirectUris) { + this.redirectUris.clear(); + if (redirectUris != null) { + this.redirectUris.addAll(redirectUris); + } + return this; + } + + /** + *

The approved build currently served on web, or null when none is deployed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productionWebBuild(Nullable productionWebBuild) { + if (productionWebBuild.isNull()) { + this.productionWebBuild = null; + } else if (productionWebBuild.isEmpty()) { + this.productionWebBuild = Optional.empty(); + } else { + this.productionWebBuild = Optional.of(productionWebBuild.get()); + } + return this; + } + + /** + *

The approved build currently served on web, or null when none is deployed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productionWebBuild(AppProductionBuild productionWebBuild) { + this.productionWebBuild = Optional.ofNullable(productionWebBuild); + return this; + } + + /** + *

The approved build currently served on web, or null when none is deployed.

+ */ + @java.lang.Override + @JsonSetter(value = "production_web_build", nulls = Nulls.SKIP) + public _FinalStage productionWebBuild(Optional productionWebBuild) { + this.productionWebBuild = productionWebBuild; + return this; + } + + /** + *

The approved build currently served on iOS, or null when none is deployed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productionIosBuild(Nullable productionIosBuild) { + if (productionIosBuild.isNull()) { + this.productionIosBuild = null; + } else if (productionIosBuild.isEmpty()) { + this.productionIosBuild = Optional.empty(); + } else { + this.productionIosBuild = Optional.of(productionIosBuild.get()); + } + return this; + } + + /** + *

The approved build currently served on iOS, or null when none is deployed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productionIosBuild(AppProductionBuild productionIosBuild) { + this.productionIosBuild = Optional.ofNullable(productionIosBuild); + return this; + } + + /** + *

The approved build currently served on iOS, or null when none is deployed.

+ */ + @java.lang.Override + @JsonSetter(value = "production_ios_build", nulls = Nulls.SKIP) + public _FinalStage productionIosBuild(Optional productionIosBuild) { + this.productionIosBuild = productionIosBuild; + return this; + } + + /** + *

The approved build currently served on Android, or null when none is deployed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productionAndroidBuild(Nullable productionAndroidBuild) { + if (productionAndroidBuild.isNull()) { + this.productionAndroidBuild = null; + } else if (productionAndroidBuild.isEmpty()) { + this.productionAndroidBuild = Optional.empty(); + } else { + this.productionAndroidBuild = Optional.of(productionAndroidBuild.get()); + } + return this; + } + + /** + *

The approved build currently served on Android, or null when none is deployed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productionAndroidBuild(AppProductionBuild productionAndroidBuild) { + this.productionAndroidBuild = Optional.ofNullable(productionAndroidBuild); + return this; + } + + /** + *

The approved build currently served on Android, or null when none is deployed.

+ */ + @java.lang.Override + @JsonSetter(value = "production_android_build", nulls = Nulls.SKIP) + public _FinalStage productionAndroidBuild(Optional productionAndroidBuild) { + this.productionAndroidBuild = productionAndroidBuild; + return this; + } + + /** + *

ID of the app's product listing on the Whop app store, or null when the app has no associated product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + /** + *

ID of the app's product listing on the Whop app store, or null when the app has no associated product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

ID of the app's product listing on the Whop app store, or null when the app has no associated product.

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

Full origin URL of the app's proxied domain, for example https://ab1c2d3e4f.apps.whop.com.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage origin(Nullable origin) { + if (origin.isNull()) { + this.origin = null; + } else if (origin.isEmpty()) { + this.origin = Optional.empty(); + } else { + this.origin = Optional.of(origin.get()); + } + return this; + } + + /** + *

Full origin URL of the app's proxied domain, for example https://ab1c2d3e4f.apps.whop.com.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage origin(String origin) { + this.origin = Optional.ofNullable(origin); + return this; + } + + /** + *

Full origin URL of the app's proxied domain, for example https://ab1c2d3e4f.apps.whop.com.

+ */ + @java.lang.Override + @JsonSetter(value = "origin", nulls = Nulls.SKIP) + public _FinalStage origin(Optional origin) { + this.origin = origin; + return this; + } + + /** + *

URL path to the app's OpenAPI spec file, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage openapiPath(Nullable openapiPath) { + if (openapiPath.isNull()) { + this.openapiPath = null; + } else if (openapiPath.isEmpty()) { + this.openapiPath = Optional.empty(); + } else { + this.openapiPath = Optional.of(openapiPath.get()); + } + return this; + } + + /** + *

URL path to the app's OpenAPI spec file, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage openapiPath(String openapiPath) { + this.openapiPath = Optional.ofNullable(openapiPath); + return this; + } + + /** + *

URL path to the app's OpenAPI spec file, or null when not configured.

+ */ + @java.lang.Override + @JsonSetter(value = "openapi_path", nulls = Nulls.SKIP) + public _FinalStage openapiPath(Optional openapiPath) { + this.openapiPath = openapiPath; + return this; + } + + /** + *

Approval status of the app's product listing on the Whop app store, or null when the app has no associated product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage marketplaceStatus(Nullable marketplaceStatus) { + if (marketplaceStatus.isNull()) { + this.marketplaceStatus = null; + } else if (marketplaceStatus.isEmpty()) { + this.marketplaceStatus = Optional.empty(); + } else { + this.marketplaceStatus = Optional.of(marketplaceStatus.get()); + } + return this; + } + + /** + *

Approval status of the app's product listing on the Whop app store, or null when the app has no associated product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage marketplaceStatus(AppMarketplaceStatus marketplaceStatus) { + this.marketplaceStatus = Optional.ofNullable(marketplaceStatus); + return this; + } + + /** + *

Approval status of the app's product listing on the Whop app store, or null when the app has no associated product.

+ */ + @java.lang.Override + @JsonSetter(value = "marketplace_status", nulls = Nulls.SKIP) + public _FinalStage marketplaceStatus(Optional marketplaceStatus) { + this.marketplaceStatus = marketplaceStatus; + return this; + } + + /** + *

Full URL where the app's hosted web build is served, or null if no route is claimed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostedUrl(Nullable hostedUrl) { + if (hostedUrl.isNull()) { + this.hostedUrl = null; + } else if (hostedUrl.isEmpty()) { + this.hostedUrl = Optional.empty(); + } else { + this.hostedUrl = Optional.of(hostedUrl.get()); + } + return this; + } + + /** + *

Full URL where the app's hosted web build is served, or null if no route is claimed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostedUrl(String hostedUrl) { + this.hostedUrl = Optional.ofNullable(hostedUrl); + return this; + } + + /** + *

Full URL where the app's hosted web build is served, or null if no route is claimed.

+ */ + @java.lang.Override + @JsonSetter(value = "hosted_url", nulls = Nulls.SKIP) + public _FinalStage hostedUrl(Optional hostedUrl) { + this.hostedUrl = hostedUrl; + return this; + } + + /** + *

URL path for the member-facing hub view, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage experiencePath(Nullable experiencePath) { + if (experiencePath.isNull()) { + this.experiencePath = null; + } else if (experiencePath.isEmpty()) { + this.experiencePath = Optional.empty(); + } else { + this.experiencePath = Optional.of(experiencePath.get()); + } + return this; + } + + /** + *

URL path for the member-facing hub view, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage experiencePath(String experiencePath) { + this.experiencePath = Optional.ofNullable(experiencePath); + return this; + } + + /** + *

URL path for the member-facing hub view, or null when not configured.

+ */ + @java.lang.Override + @JsonSetter(value = "experience_path", nulls = Nulls.SKIP) + public _FinalStage experiencePath(Optional experiencePath) { + this.experiencePath = experiencePath; + return this; + } + + /** + *

URL path for the discover view, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discoverPath(Nullable discoverPath) { + if (discoverPath.isNull()) { + this.discoverPath = null; + } else if (discoverPath.isEmpty()) { + this.discoverPath = Optional.empty(); + } else { + this.discoverPath = Optional.of(discoverPath.get()); + } + return this; + } + + /** + *

URL path for the discover view, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discoverPath(String discoverPath) { + this.discoverPath = Optional.ofNullable(discoverPath); + return this; + } + + /** + *

URL path for the discover view, or null when not configured.

+ */ + @java.lang.Override + @JsonSetter(value = "discover_path", nulls = Nulls.SKIP) + public _FinalStage discoverPath(Optional discoverPath) { + this.discoverPath = discoverPath; + return this; + } + + /** + *

Short description shown in listings and search results, or null if none has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

Short description shown in listings and search results, or null if none has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

Short description shown in listings and search results, or null if none has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

What the app has left to publish, and how a publish in flight is going — status is only ever unpublished, publishing, or failed here. null means there is nothing to report: the app is fully published, there is no working copy to publish from, or the caller cannot deploy this app. Tell those apart from the app's own production_web_build.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage deployment(Nullable deployment) { + if (deployment.isNull()) { + this.deployment = null; + } else if (deployment.isEmpty()) { + this.deployment = Optional.empty(); + } else { + this.deployment = Optional.of(deployment.get()); + } + return this; + } + + /** + *

What the app has left to publish, and how a publish in flight is going — status is only ever unpublished, publishing, or failed here. null means there is nothing to report: the app is fully published, there is no working copy to publish from, or the caller cannot deploy this app. Tell those apart from the app's own production_web_build.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage deployment(AppDeployment deployment) { + this.deployment = Optional.ofNullable(deployment); + return this; + } + + /** + *

What the app has left to publish, and how a publish in flight is going — status is only ever unpublished, publishing, or failed here. null means there is nothing to report: the app is fully published, there is no working copy to publish from, or the caller cannot deploy this app. Tell those apart from the app's own production_web_build.

+ */ + @java.lang.Override + @JsonSetter(value = "deployment", nulls = Nulls.SKIP) + public _FinalStage deployment(Optional deployment) { + this.deployment = deployment; + return this; + } + + /** + *

The app's default API key. null when the app has no default key or the caller lacks the developer:manage_api_key permission; secret_key is additionally null unless the caller could have created the key themselves.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage defaultApiKey(Nullable defaultApiKey) { + if (defaultApiKey.isNull()) { + this.defaultApiKey = null; + } else if (defaultApiKey.isEmpty()) { + this.defaultApiKey = Optional.empty(); + } else { + this.defaultApiKey = Optional.of(defaultApiKey.get()); + } + return this; + } + + /** + *

The app's default API key. null when the app has no default key or the caller lacks the developer:manage_api_key permission; secret_key is additionally null unless the caller could have created the key themselves.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage defaultApiKey(AppDefaultApiKey defaultApiKey) { + this.defaultApiKey = Optional.ofNullable(defaultApiKey); + return this; + } + + /** + *

The app's default API key. null when the app has no default key or the caller lacks the developer:manage_api_key permission; secret_key is additionally null unless the caller could have created the key themselves.

+ */ + @java.lang.Override + @JsonSetter(value = "default_api_key", nulls = Nulls.SKIP) + public _FinalStage defaultApiKey(Optional defaultApiKey) { + this.defaultApiKey = defaultApiKey; + return this; + } + + /** + *

URL path for the account dashboard view, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dashboardPath(Nullable dashboardPath) { + if (dashboardPath.isNull()) { + this.dashboardPath = null; + } else if (dashboardPath.isEmpty()) { + this.dashboardPath = Optional.empty(); + } else { + this.dashboardPath = Optional.of(dashboardPath.get()); + } + return this; + } + + /** + *

URL path for the account dashboard view, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dashboardPath(String dashboardPath) { + this.dashboardPath = Optional.ofNullable(dashboardPath); + return this; + } + + /** + *

URL path for the account dashboard view, or null when not configured.

+ */ + @java.lang.Override + @JsonSetter(value = "dashboard_path", nulls = Nulls.SKIP) + public _FinalStage dashboardPath(Optional dashboardPath) { + this.dashboardPath = dashboardPath; + return this; + } + + @java.lang.Override + public _FinalStage addAllBusinessesCreatedLogoUrls(List businessesCreatedLogoUrls) { + if (businessesCreatedLogoUrls != null) { + this.businessesCreatedLogoUrls.addAll(businessesCreatedLogoUrls); + } + return this; + } + + @java.lang.Override + public _FinalStage addBusinessesCreatedLogoUrls(String businessesCreatedLogoUrls) { + this.businessesCreatedLogoUrls.add(businessesCreatedLogoUrls); + return this; + } + + @java.lang.Override + @JsonSetter(value = "businesses_created_logo_urls", nulls = Nulls.SKIP) + public _FinalStage businessesCreatedLogoUrls(List businessesCreatedLogoUrls) { + this.businessesCreatedLogoUrls.clear(); + if (businessesCreatedLogoUrls != null) { + this.businessesCreatedLogoUrls.addAll(businessesCreatedLogoUrls); + } + return this; + } + + /** + *

The production base URL where the app is hosted. null if no base URL is configured, if the caller lacks the developer:basic:read permission on the app's account, or on list responses, which never expose it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage baseUrl(Nullable baseUrl) { + if (baseUrl.isNull()) { + this.baseUrl = null; + } else if (baseUrl.isEmpty()) { + this.baseUrl = Optional.empty(); + } else { + this.baseUrl = Optional.of(baseUrl.get()); + } + return this; + } + + /** + *

The production base URL where the app is hosted. null if no base URL is configured, if the caller lacks the developer:basic:read permission on the app's account, or on list responses, which never expose it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage baseUrl(String baseUrl) { + this.baseUrl = Optional.ofNullable(baseUrl); + return this; + } + + /** + *

The production base URL where the app is hosted. null if no base URL is configured, if the caller lacks the developer:basic:read permission on the app's account, or on list responses, which never expose it.

+ */ + @java.lang.Override + @JsonSetter(value = "base_url", nulls = Nulls.SKIP) + public _FinalStage baseUrl(Optional baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + /** + *

Banner image from the app's product listing, or null when none is uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bannerImage(Nullable bannerImage) { + if (bannerImage.isNull()) { + this.bannerImage = null; + } else if (bannerImage.isEmpty()) { + this.bannerImage = Optional.empty(); + } else { + this.bannerImage = Optional.of(bannerImage.get()); + } + return this; + } + + /** + *

Banner image from the app's product listing, or null when none is uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bannerImage(AppBannerImage bannerImage) { + this.bannerImage = Optional.ofNullable(bannerImage); + return this; + } + + /** + *

Banner image from the app's product listing, or null when none is uploaded.

+ */ + @java.lang.Override + @JsonSetter(value = "banner_image", nulls = Nulls.SKIP) + public _FinalStage bannerImage(Optional bannerImage) { + this.bannerImage = bannerImage; + return this; + } + + /** + *

Detailed description shown on the app store's in-depth app page, or null when none has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appStoreDescription(Nullable appStoreDescription) { + if (appStoreDescription.isNull()) { + this.appStoreDescription = null; + } else if (appStoreDescription.isEmpty()) { + this.appStoreDescription = Optional.empty(); + } else { + this.appStoreDescription = Optional.of(appStoreDescription.get()); + } + return this; + } + + /** + *

Detailed description shown on the app store's in-depth app page, or null when none has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appStoreDescription(String appStoreDescription) { + this.appStoreDescription = Optional.ofNullable(appStoreDescription); + return this; + } + + /** + *

Detailed description shown on the app store's in-depth app page, or null when none has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "app_store_description", nulls = Nulls.SKIP) + public _FinalStage appStoreDescription(Optional appStoreDescription) { + this.appStoreDescription = appStoreDescription; + return this; + } + + /** + *

Legacy app API key used to authenticate requests on the app's behalf. null when no key exists or the caller lacks the developer:manage_api_key permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiKey(Nullable apiKey) { + if (apiKey.isNull()) { + this.apiKey = null; + } else if (apiKey.isEmpty()) { + this.apiKey = Optional.empty(); + } else { + this.apiKey = Optional.of(apiKey.get()); + } + return this; + } + + /** + *

Legacy app API key used to authenticate requests on the app's behalf. null when no key exists or the caller lacks the developer:manage_api_key permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiKey(AppApiKey apiKey) { + this.apiKey = Optional.ofNullable(apiKey); + return this; + } + + /** + *

Legacy app API key used to authenticate requests on the app's behalf. null when no key exists or the caller lacks the developer:manage_api_key permission.

+ */ + @java.lang.Override + @JsonSetter(value = "api_key", nulls = Nulls.SKIP) + public _FinalStage apiKey(Optional apiKey) { + this.apiKey = apiKey; + return this; + } + + @java.lang.Override + public App build() { + return new App( + account, + apiKey, + appStoreDescription, + appType, + bannerImage, + baseUrl, + businessesCreatedCount, + businessesCreatedLogoUrls, + creator, + dashboardPath, + defaultApiKey, + deployment, + description, + discoverPath, + domainId, + experiencePath, + hostedUrl, + icon, + id, + marketplaceStatus, + name, + oauthClientType, + openapiPath, + origin, + productId, + productionAndroidBuild, + productionIosBuild, + productionWebBuild, + redirectUris, + requestedPermissions, + requiredScopes, + route, + secrets, + skillsPath, + status, + verified, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AppApiKey.java b/src/main/java/com/whop/api/types/AppApiKey.java new file mode 100644 index 00000000..057073e3 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppApiKey.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppApiKey.Builder.class) +public final class AppApiKey { + private final String createdAt; + + private final String token; + + private final String id; + + private final Map additionalProperties; + + private AppApiKey(String createdAt, String token, String id, Map additionalProperties) { + this.createdAt = createdAt; + this.token = token; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the key was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return The key's secret token, sent as a bearer token to authenticate requests on the app's behalf. + */ + @JsonProperty("token") + public String getToken() { + return token; + } + + /** + * @return The unique identifier for the private api key. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppApiKey && equalTo((AppApiKey) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppApiKey other) { + return createdAt.equals(other.createdAt) && token.equals(other.token) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.token, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the key was created, as an ISO 8601 timestamp.

+ */ + TokenStage createdAt(@NotNull String createdAt); + + Builder from(AppApiKey other); + } + + public interface TokenStage { + /** + *

The key's secret token, sent as a bearer token to authenticate requests on the app's behalf.

+ */ + IdStage token(@NotNull String token); + } + + public interface IdStage { + /** + *

The unique identifier for the private api key.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + AppApiKey build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, TokenStage, IdStage, _FinalStage { + private String createdAt; + + private String token; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AppApiKey other) { + createdAt(other.getCreatedAt()); + token(other.getToken()); + id(other.getId()); + return this; + } + + /** + *

When the key was created, as an ISO 8601 timestamp.

+ *

When the key was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public TokenStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The key's secret token, sent as a bearer token to authenticate requests on the app's behalf.

+ *

The key's secret token, sent as a bearer token to authenticate requests on the app's behalf.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("token") + public IdStage token(@NotNull String token) { + this.token = Objects.requireNonNull(token, "token must not be null"); + return this; + } + + /** + *

The unique identifier for the private api key.

+ *

The unique identifier for the private api key.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public AppApiKey build() { + return new AppApiKey(createdAt, token, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AppAppType.java b/src/main/java/com/whop/api/types/AppAppType.java new file mode 100644 index 00000000..82d2483f --- /dev/null +++ b/src/main/java/com/whop/api/types/AppAppType.java @@ -0,0 +1,112 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppAppType { + public static final AppAppType COMPONENT = new AppAppType(Value.COMPONENT, "component"); + + public static final AppAppType WEBSITE = new AppAppType(Value.WEBSITE, "website"); + + public static final AppAppType B2B_APP = new AppAppType(Value.B2B_APP, "b2b_app"); + + public static final AppAppType B2C_APP = new AppAppType(Value.B2C_APP, "b2c_app"); + + public static final AppAppType COMPANY_APP = new AppAppType(Value.COMPANY_APP, "company_app"); + + private final Value value; + + private final String string; + + AppAppType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof AppAppType && this.string.equals(((AppAppType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case COMPONENT: + return visitor.visitComponent(); + case WEBSITE: + return visitor.visitWebsite(); + case B2B_APP: + return visitor.visitB2BApp(); + case B2C_APP: + return visitor.visitB2CApp(); + case COMPANY_APP: + return visitor.visitCompanyApp(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppAppType valueOf(String value) { + switch (value) { + case "component": + return COMPONENT; + case "website": + return WEBSITE; + case "b2b_app": + return B2B_APP; + case "b2c_app": + return B2C_APP; + case "company_app": + return COMPANY_APP; + default: + return new AppAppType(Value.UNKNOWN, value); + } + } + + public enum Value { + B2B_APP, + + B2C_APP, + + COMPANY_APP, + + COMPONENT, + + WEBSITE, + + UNKNOWN + } + + public interface Visitor { + T visitB2BApp(); + + T visitB2CApp(); + + T visitCompanyApp(); + + T visitComponent(); + + T visitWebsite(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppBannerImage.java b/src/main/java/com/whop/api/types/AppBannerImage.java new file mode 100644 index 00000000..2df170ec --- /dev/null +++ b/src/main/java/com/whop/api/types/AppBannerImage.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppBannerImage.Builder.class) +public final class AppBannerImage { + private final String url; + + private final Map additionalProperties; + + private AppBannerImage(String url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Banner image URL, taken from the app's product listing. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppBannerImage && equalTo((AppBannerImage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppBannerImage other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

Banner image URL, taken from the app's product listing.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(AppBannerImage other); + } + + public interface _FinalStage { + AppBannerImage build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AppBannerImage other) { + url(other.getUrl()); + return this; + } + + /** + *

Banner image URL, taken from the app's product listing.

+ *

Banner image URL, taken from the app's product listing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public AppBannerImage build() { + return new AppBannerImage(url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AppBuild.java b/src/main/java/com/whop/api/types/AppBuild.java new file mode 100644 index 00000000..ca5d4302 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppBuild.java @@ -0,0 +1,594 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppBuild.Builder.class) +public final class AppBuild { + private final String checksum; + + private final String createdAt; + + private final Optional fileUrl; + + private final String id; + + private final boolean isProduction; + + private final AppBuildPlatform platform; + + private final Optional reviewMessage; + + private final Optional sourceUrl; + + private final AppBuildStatus status; + + private final List supportedAppViewTypes; + + private final Map additionalProperties; + + private AppBuild( + String checksum, + String createdAt, + Optional fileUrl, + String id, + boolean isProduction, + AppBuildPlatform platform, + Optional reviewMessage, + Optional sourceUrl, + AppBuildStatus status, + List supportedAppViewTypes, + Map additionalProperties) { + this.checksum = checksum; + this.createdAt = createdAt; + this.fileUrl = fileUrl; + this.id = id; + this.isProduction = isProduction; + this.platform = platform; + this.reviewMessage = reviewMessage; + this.sourceUrl = sourceUrl; + this.status = status; + this.supportedAppViewTypes = supportedAppViewTypes; + this.additionalProperties = additionalProperties; + } + + /** + * @return Client-generated checksum of the build file, used to verify file integrity. + */ + @JsonProperty("checksum") + public String getChecksum() { + return checksum; + } + + /** + * @return When the build was uploaded, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return URL to download the uploaded build artifact. + */ + @JsonIgnore + public Optional getFileUrl() { + if (fileUrl == null) { + return Optional.empty(); + } + return fileUrl; + } + + /** + * @return App build ID, prefixed abld_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whether this build is the currently active production build for its platform. + */ + @JsonProperty("is_production") + public boolean getIsProduction() { + return isProduction; + } + + /** + * @return The target platform for this build. + */ + @JsonProperty("platform") + public AppBuildPlatform getPlatform() { + return platform; + } + + /** + * @return Feedback from the reviewer explaining a rejection, or null if the build has not been reviewed or was approved. + */ + @JsonIgnore + public Optional getReviewMessage() { + if (reviewMessage == null) { + return Optional.empty(); + } + return reviewMessage; + } + + /** + * @return URL to download the compressed source code archive that produced this build, or null when the build was uploaded without a source archive. + */ + @JsonIgnore + public Optional getSourceUrl() { + if (sourceUrl == null) { + return Optional.empty(); + } + return sourceUrl; + } + + /** + * @return The build's review status. + */ + @JsonProperty("status") + public AppBuildStatus getStatus() { + return status; + } + + @JsonProperty("supported_app_view_types") + public List getSupportedAppViewTypes() { + return supportedAppViewTypes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("file_url") + private Optional _getFileUrl() { + return fileUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("review_message") + private Optional _getReviewMessage() { + return reviewMessage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source_url") + private Optional _getSourceUrl() { + return sourceUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppBuild && equalTo((AppBuild) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppBuild other) { + return checksum.equals(other.checksum) + && createdAt.equals(other.createdAt) + && fileUrl.equals(other.fileUrl) + && id.equals(other.id) + && isProduction == other.isProduction + && platform.equals(other.platform) + && reviewMessage.equals(other.reviewMessage) + && sourceUrl.equals(other.sourceUrl) + && status.equals(other.status) + && supportedAppViewTypes.equals(other.supportedAppViewTypes); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.checksum, + this.createdAt, + this.fileUrl, + this.id, + this.isProduction, + this.platform, + this.reviewMessage, + this.sourceUrl, + this.status, + this.supportedAppViewTypes); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChecksumStage builder() { + return new Builder(); + } + + public interface ChecksumStage { + /** + *

Client-generated checksum of the build file, used to verify file integrity.

+ */ + CreatedAtStage checksum(@NotNull String checksum); + + Builder from(AppBuild other); + } + + public interface CreatedAtStage { + /** + *

When the build was uploaded, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

App build ID, prefixed abld_.

+ */ + IsProductionStage id(@NotNull String id); + } + + public interface IsProductionStage { + /** + *

Whether this build is the currently active production build for its platform.

+ */ + PlatformStage isProduction(boolean isProduction); + } + + public interface PlatformStage { + /** + *

The target platform for this build.

+ */ + StatusStage platform(@NotNull AppBuildPlatform platform); + } + + public interface StatusStage { + /** + *

The build's review status.

+ */ + _FinalStage status(@NotNull AppBuildStatus status); + } + + public interface _FinalStage { + AppBuild build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

URL to download the uploaded build artifact.

+ */ + _FinalStage fileUrl(Optional fileUrl); + + _FinalStage fileUrl(String fileUrl); + + _FinalStage fileUrl(Nullable fileUrl); + + /** + *

Feedback from the reviewer explaining a rejection, or null if the build has not been reviewed or was approved.

+ */ + _FinalStage reviewMessage(Optional reviewMessage); + + _FinalStage reviewMessage(String reviewMessage); + + _FinalStage reviewMessage(Nullable reviewMessage); + + /** + *

URL to download the compressed source code archive that produced this build, or null when the build was uploaded without a source archive.

+ */ + _FinalStage sourceUrl(Optional sourceUrl); + + _FinalStage sourceUrl(String sourceUrl); + + _FinalStage sourceUrl(Nullable sourceUrl); + + _FinalStage supportedAppViewTypes(List supportedAppViewTypes); + + _FinalStage addSupportedAppViewTypes(AppBuildSupportedAppViewTypesItem supportedAppViewTypes); + + _FinalStage addAllSupportedAppViewTypes(List supportedAppViewTypes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ChecksumStage, + CreatedAtStage, + IdStage, + IsProductionStage, + PlatformStage, + StatusStage, + _FinalStage { + private String checksum; + + private String createdAt; + + private String id; + + private boolean isProduction; + + private AppBuildPlatform platform; + + private AppBuildStatus status; + + private List supportedAppViewTypes = new ArrayList<>(); + + private Optional sourceUrl = Optional.empty(); + + private Optional reviewMessage = Optional.empty(); + + private Optional fileUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AppBuild other) { + checksum(other.getChecksum()); + createdAt(other.getCreatedAt()); + fileUrl(other.getFileUrl()); + id(other.getId()); + isProduction(other.getIsProduction()); + platform(other.getPlatform()); + reviewMessage(other.getReviewMessage()); + sourceUrl(other.getSourceUrl()); + status(other.getStatus()); + supportedAppViewTypes(other.getSupportedAppViewTypes()); + return this; + } + + /** + *

Client-generated checksum of the build file, used to verify file integrity.

+ *

Client-generated checksum of the build file, used to verify file integrity.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("checksum") + public CreatedAtStage checksum(@NotNull String checksum) { + this.checksum = Objects.requireNonNull(checksum, "checksum must not be null"); + return this; + } + + /** + *

When the build was uploaded, as an ISO 8601 timestamp.

+ *

When the build was uploaded, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

App build ID, prefixed abld_.

+ *

App build ID, prefixed abld_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsProductionStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether this build is the currently active production build for its platform.

+ *

Whether this build is the currently active production build for its platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_production") + public PlatformStage isProduction(boolean isProduction) { + this.isProduction = isProduction; + return this; + } + + /** + *

The target platform for this build.

+ *

The target platform for this build.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public StatusStage platform(@NotNull AppBuildPlatform platform) { + this.platform = Objects.requireNonNull(platform, "platform must not be null"); + return this; + } + + /** + *

The build's review status.

+ *

The build's review status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull AppBuildStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllSupportedAppViewTypes(List supportedAppViewTypes) { + if (supportedAppViewTypes != null) { + this.supportedAppViewTypes.addAll(supportedAppViewTypes); + } + return this; + } + + @java.lang.Override + public _FinalStage addSupportedAppViewTypes(AppBuildSupportedAppViewTypesItem supportedAppViewTypes) { + this.supportedAppViewTypes.add(supportedAppViewTypes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "supported_app_view_types", nulls = Nulls.SKIP) + public _FinalStage supportedAppViewTypes(List supportedAppViewTypes) { + this.supportedAppViewTypes.clear(); + if (supportedAppViewTypes != null) { + this.supportedAppViewTypes.addAll(supportedAppViewTypes); + } + return this; + } + + /** + *

URL to download the compressed source code archive that produced this build, or null when the build was uploaded without a source archive.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sourceUrl(Nullable sourceUrl) { + if (sourceUrl.isNull()) { + this.sourceUrl = null; + } else if (sourceUrl.isEmpty()) { + this.sourceUrl = Optional.empty(); + } else { + this.sourceUrl = Optional.of(sourceUrl.get()); + } + return this; + } + + /** + *

URL to download the compressed source code archive that produced this build, or null when the build was uploaded without a source archive.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sourceUrl(String sourceUrl) { + this.sourceUrl = Optional.ofNullable(sourceUrl); + return this; + } + + /** + *

URL to download the compressed source code archive that produced this build, or null when the build was uploaded without a source archive.

+ */ + @java.lang.Override + @JsonSetter(value = "source_url", nulls = Nulls.SKIP) + public _FinalStage sourceUrl(Optional sourceUrl) { + this.sourceUrl = sourceUrl; + return this; + } + + /** + *

Feedback from the reviewer explaining a rejection, or null if the build has not been reviewed or was approved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reviewMessage(Nullable reviewMessage) { + if (reviewMessage.isNull()) { + this.reviewMessage = null; + } else if (reviewMessage.isEmpty()) { + this.reviewMessage = Optional.empty(); + } else { + this.reviewMessage = Optional.of(reviewMessage.get()); + } + return this; + } + + /** + *

Feedback from the reviewer explaining a rejection, or null if the build has not been reviewed or was approved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reviewMessage(String reviewMessage) { + this.reviewMessage = Optional.ofNullable(reviewMessage); + return this; + } + + /** + *

Feedback from the reviewer explaining a rejection, or null if the build has not been reviewed or was approved.

+ */ + @java.lang.Override + @JsonSetter(value = "review_message", nulls = Nulls.SKIP) + public _FinalStage reviewMessage(Optional reviewMessage) { + this.reviewMessage = reviewMessage; + return this; + } + + /** + *

URL to download the uploaded build artifact.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fileUrl(Nullable fileUrl) { + if (fileUrl.isNull()) { + this.fileUrl = null; + } else if (fileUrl.isEmpty()) { + this.fileUrl = Optional.empty(); + } else { + this.fileUrl = Optional.of(fileUrl.get()); + } + return this; + } + + /** + *

URL to download the uploaded build artifact.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fileUrl(String fileUrl) { + this.fileUrl = Optional.ofNullable(fileUrl); + return this; + } + + /** + *

URL to download the uploaded build artifact.

+ */ + @java.lang.Override + @JsonSetter(value = "file_url", nulls = Nulls.SKIP) + public _FinalStage fileUrl(Optional fileUrl) { + this.fileUrl = fileUrl; + return this; + } + + @java.lang.Override + public AppBuild build() { + return new AppBuild( + checksum, + createdAt, + fileUrl, + id, + isProduction, + platform, + reviewMessage, + sourceUrl, + status, + supportedAppViewTypes, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AppBuildListItem.java b/src/main/java/com/whop/api/types/AppBuildListItem.java new file mode 100644 index 00000000..8121a974 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppBuildListItem.java @@ -0,0 +1,578 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppBuildListItem.Builder.class) +public final class AppBuildListItem { + private final String checksum; + + private final OffsetDateTime createdAt; + + private final String fileUrl; + + private final String id; + + private final boolean isProduction; + + private final AppBuildPlatforms platform; + + private final Optional reviewMessage; + + private final Optional sourceUrl; + + private final AppBuildStatuses status; + + private final List supportedAppViewTypes; + + private final Map additionalProperties; + + private AppBuildListItem( + String checksum, + OffsetDateTime createdAt, + String fileUrl, + String id, + boolean isProduction, + AppBuildPlatforms platform, + Optional reviewMessage, + Optional sourceUrl, + AppBuildStatuses status, + List supportedAppViewTypes, + Map additionalProperties) { + this.checksum = checksum; + this.createdAt = createdAt; + this.fileUrl = fileUrl; + this.id = id; + this.isProduction = isProduction; + this.platform = platform; + this.reviewMessage = reviewMessage; + this.sourceUrl = sourceUrl; + this.status = status; + this.supportedAppViewTypes = supportedAppViewTypes; + this.additionalProperties = additionalProperties; + } + + /** + * @return A SHA-256 hash of the uploaded build file, generated by the client and used to verify file integrity. + */ + @JsonProperty("checksum") + public String getChecksum() { + return checksum; + } + + /** + * @return The datetime the app build was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return A URL to download the app build as a .zip archive. + */ + @JsonProperty("file_url") + public String getFileUrl() { + return fileUrl; + } + + /** + * @return The unique identifier for the app build. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whether this build is the currently active production build for its platform. + */ + @JsonProperty("is_production") + public boolean getIsProduction() { + return isProduction; + } + + /** + * @return The target platform for this build. + */ + @JsonProperty("platform") + public AppBuildPlatforms getPlatform() { + return platform; + } + + /** + * @return Feedback from the reviewer explaining why the build was rejected. Null if the build has not been reviewed or was approved. + */ + @JsonIgnore + public Optional getReviewMessage() { + if (reviewMessage == null) { + return Optional.empty(); + } + return reviewMessage; + } + + /** + * @return A URL to download the compressed source code archive that produced this build. Null if the build was uploaded without a source archive. + */ + @JsonIgnore + public Optional getSourceUrl() { + if (sourceUrl == null) { + return Optional.empty(); + } + return sourceUrl; + } + + /** + * @return The current review status of this build. + */ + @JsonProperty("status") + public AppBuildStatuses getStatus() { + return status; + } + + /** + * @return The list of view types this build supports, as declared by the developer. + */ + @JsonProperty("supported_app_view_types") + public List getSupportedAppViewTypes() { + return supportedAppViewTypes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("review_message") + private Optional _getReviewMessage() { + return reviewMessage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source_url") + private Optional _getSourceUrl() { + return sourceUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppBuildListItem && equalTo((AppBuildListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppBuildListItem other) { + return checksum.equals(other.checksum) + && createdAt.equals(other.createdAt) + && fileUrl.equals(other.fileUrl) + && id.equals(other.id) + && isProduction == other.isProduction + && platform.equals(other.platform) + && reviewMessage.equals(other.reviewMessage) + && sourceUrl.equals(other.sourceUrl) + && status.equals(other.status) + && supportedAppViewTypes.equals(other.supportedAppViewTypes); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.checksum, + this.createdAt, + this.fileUrl, + this.id, + this.isProduction, + this.platform, + this.reviewMessage, + this.sourceUrl, + this.status, + this.supportedAppViewTypes); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChecksumStage builder() { + return new Builder(); + } + + public interface ChecksumStage { + /** + *

A SHA-256 hash of the uploaded build file, generated by the client and used to verify file integrity.

+ */ + CreatedAtStage checksum(@NotNull String checksum); + + Builder from(AppBuildListItem other); + } + + public interface CreatedAtStage { + /** + *

The datetime the app build was created.

+ */ + FileUrlStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface FileUrlStage { + /** + *

A URL to download the app build as a .zip archive.

+ */ + IdStage fileUrl(@NotNull String fileUrl); + } + + public interface IdStage { + /** + *

The unique identifier for the app build.

+ */ + IsProductionStage id(@NotNull String id); + } + + public interface IsProductionStage { + /** + *

Whether this build is the currently active production build for its platform.

+ */ + PlatformStage isProduction(boolean isProduction); + } + + public interface PlatformStage { + /** + *

The target platform for this build.

+ */ + StatusStage platform(@NotNull AppBuildPlatforms platform); + } + + public interface StatusStage { + /** + *

The current review status of this build.

+ */ + _FinalStage status(@NotNull AppBuildStatuses status); + } + + public interface _FinalStage { + AppBuildListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Feedback from the reviewer explaining why the build was rejected. Null if the build has not been reviewed or was approved.

+ */ + _FinalStage reviewMessage(Optional reviewMessage); + + _FinalStage reviewMessage(String reviewMessage); + + _FinalStage reviewMessage(Nullable reviewMessage); + + /** + *

A URL to download the compressed source code archive that produced this build. Null if the build was uploaded without a source archive.

+ */ + _FinalStage sourceUrl(Optional sourceUrl); + + _FinalStage sourceUrl(String sourceUrl); + + _FinalStage sourceUrl(Nullable sourceUrl); + + /** + *

The list of view types this build supports, as declared by the developer.

+ */ + _FinalStage supportedAppViewTypes(List supportedAppViewTypes); + + _FinalStage addSupportedAppViewTypes(AppViewTypes supportedAppViewTypes); + + _FinalStage addAllSupportedAppViewTypes(List supportedAppViewTypes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ChecksumStage, + CreatedAtStage, + FileUrlStage, + IdStage, + IsProductionStage, + PlatformStage, + StatusStage, + _FinalStage { + private String checksum; + + private OffsetDateTime createdAt; + + private String fileUrl; + + private String id; + + private boolean isProduction; + + private AppBuildPlatforms platform; + + private AppBuildStatuses status; + + private List supportedAppViewTypes = new ArrayList<>(); + + private Optional sourceUrl = Optional.empty(); + + private Optional reviewMessage = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AppBuildListItem other) { + checksum(other.getChecksum()); + createdAt(other.getCreatedAt()); + fileUrl(other.getFileUrl()); + id(other.getId()); + isProduction(other.getIsProduction()); + platform(other.getPlatform()); + reviewMessage(other.getReviewMessage()); + sourceUrl(other.getSourceUrl()); + status(other.getStatus()); + supportedAppViewTypes(other.getSupportedAppViewTypes()); + return this; + } + + /** + *

A SHA-256 hash of the uploaded build file, generated by the client and used to verify file integrity.

+ *

A SHA-256 hash of the uploaded build file, generated by the client and used to verify file integrity.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("checksum") + public CreatedAtStage checksum(@NotNull String checksum) { + this.checksum = Objects.requireNonNull(checksum, "checksum must not be null"); + return this; + } + + /** + *

The datetime the app build was created.

+ *

The datetime the app build was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public FileUrlStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

A URL to download the app build as a .zip archive.

+ *

A URL to download the app build as a .zip archive.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("file_url") + public IdStage fileUrl(@NotNull String fileUrl) { + this.fileUrl = Objects.requireNonNull(fileUrl, "fileUrl must not be null"); + return this; + } + + /** + *

The unique identifier for the app build.

+ *

The unique identifier for the app build.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsProductionStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether this build is the currently active production build for its platform.

+ *

Whether this build is the currently active production build for its platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_production") + public PlatformStage isProduction(boolean isProduction) { + this.isProduction = isProduction; + return this; + } + + /** + *

The target platform for this build.

+ *

The target platform for this build.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public StatusStage platform(@NotNull AppBuildPlatforms platform) { + this.platform = Objects.requireNonNull(platform, "platform must not be null"); + return this; + } + + /** + *

The current review status of this build.

+ *

The current review status of this build.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull AppBuildStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The list of view types this build supports, as declared by the developer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllSupportedAppViewTypes(List supportedAppViewTypes) { + if (supportedAppViewTypes != null) { + this.supportedAppViewTypes.addAll(supportedAppViewTypes); + } + return this; + } + + /** + *

The list of view types this build supports, as declared by the developer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addSupportedAppViewTypes(AppViewTypes supportedAppViewTypes) { + this.supportedAppViewTypes.add(supportedAppViewTypes); + return this; + } + + /** + *

The list of view types this build supports, as declared by the developer.

+ */ + @java.lang.Override + @JsonSetter(value = "supported_app_view_types", nulls = Nulls.SKIP) + public _FinalStage supportedAppViewTypes(List supportedAppViewTypes) { + this.supportedAppViewTypes.clear(); + if (supportedAppViewTypes != null) { + this.supportedAppViewTypes.addAll(supportedAppViewTypes); + } + return this; + } + + /** + *

A URL to download the compressed source code archive that produced this build. Null if the build was uploaded without a source archive.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sourceUrl(Nullable sourceUrl) { + if (sourceUrl.isNull()) { + this.sourceUrl = null; + } else if (sourceUrl.isEmpty()) { + this.sourceUrl = Optional.empty(); + } else { + this.sourceUrl = Optional.of(sourceUrl.get()); + } + return this; + } + + /** + *

A URL to download the compressed source code archive that produced this build. Null if the build was uploaded without a source archive.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sourceUrl(String sourceUrl) { + this.sourceUrl = Optional.ofNullable(sourceUrl); + return this; + } + + /** + *

A URL to download the compressed source code archive that produced this build. Null if the build was uploaded without a source archive.

+ */ + @java.lang.Override + @JsonSetter(value = "source_url", nulls = Nulls.SKIP) + public _FinalStage sourceUrl(Optional sourceUrl) { + this.sourceUrl = sourceUrl; + return this; + } + + /** + *

Feedback from the reviewer explaining why the build was rejected. Null if the build has not been reviewed or was approved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reviewMessage(Nullable reviewMessage) { + if (reviewMessage.isNull()) { + this.reviewMessage = null; + } else if (reviewMessage.isEmpty()) { + this.reviewMessage = Optional.empty(); + } else { + this.reviewMessage = Optional.of(reviewMessage.get()); + } + return this; + } + + /** + *

Feedback from the reviewer explaining why the build was rejected. Null if the build has not been reviewed or was approved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reviewMessage(String reviewMessage) { + this.reviewMessage = Optional.ofNullable(reviewMessage); + return this; + } + + /** + *

Feedback from the reviewer explaining why the build was rejected. Null if the build has not been reviewed or was approved.

+ */ + @java.lang.Override + @JsonSetter(value = "review_message", nulls = Nulls.SKIP) + public _FinalStage reviewMessage(Optional reviewMessage) { + this.reviewMessage = reviewMessage; + return this; + } + + @java.lang.Override + public AppBuildListItem build() { + return new AppBuildListItem( + checksum, + createdAt, + fileUrl, + id, + isProduction, + platform, + reviewMessage, + sourceUrl, + status, + supportedAppViewTypes, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AppBuildPlatform.java b/src/main/java/com/whop/api/types/AppBuildPlatform.java new file mode 100644 index 00000000..ba325062 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppBuildPlatform.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppBuildPlatform { + public static final AppBuildPlatform WEB = new AppBuildPlatform(Value.WEB, "web"); + + public static final AppBuildPlatform IOS = new AppBuildPlatform(Value.IOS, "ios"); + + public static final AppBuildPlatform ANDROID = new AppBuildPlatform(Value.ANDROID, "android"); + + private final Value value; + + private final String string; + + AppBuildPlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AppBuildPlatform && this.string.equals(((AppBuildPlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WEB: + return visitor.visitWeb(); + case IOS: + return visitor.visitIos(); + case ANDROID: + return visitor.visitAndroid(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppBuildPlatform valueOf(String value) { + switch (value) { + case "web": + return WEB; + case "ios": + return IOS; + case "android": + return ANDROID; + default: + return new AppBuildPlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + IOS, + + ANDROID, + + WEB, + + UNKNOWN + } + + public interface Visitor { + T visitIos(); + + T visitAndroid(); + + T visitWeb(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppBuildPlatforms.java b/src/main/java/com/whop/api/types/AppBuildPlatforms.java new file mode 100644 index 00000000..90352c38 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppBuildPlatforms.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppBuildPlatforms { + public static final AppBuildPlatforms WEB = new AppBuildPlatforms(Value.WEB, "web"); + + public static final AppBuildPlatforms IOS = new AppBuildPlatforms(Value.IOS, "ios"); + + public static final AppBuildPlatforms ANDROID = new AppBuildPlatforms(Value.ANDROID, "android"); + + private final Value value; + + private final String string; + + AppBuildPlatforms(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AppBuildPlatforms && this.string.equals(((AppBuildPlatforms) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WEB: + return visitor.visitWeb(); + case IOS: + return visitor.visitIos(); + case ANDROID: + return visitor.visitAndroid(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppBuildPlatforms valueOf(String value) { + switch (value) { + case "web": + return WEB; + case "ios": + return IOS; + case "android": + return ANDROID; + default: + return new AppBuildPlatforms(Value.UNKNOWN, value); + } + } + + public enum Value { + IOS, + + ANDROID, + + WEB, + + UNKNOWN + } + + public interface Visitor { + T visitIos(); + + T visitAndroid(); + + T visitWeb(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppBuildStatus.java b/src/main/java/com/whop/api/types/AppBuildStatus.java new file mode 100644 index 00000000..f3084b32 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppBuildStatus.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppBuildStatus { + public static final AppBuildStatus APPROVED = new AppBuildStatus(Value.APPROVED, "approved"); + + public static final AppBuildStatus PENDING = new AppBuildStatus(Value.PENDING, "pending"); + + public static final AppBuildStatus DRAFT = new AppBuildStatus(Value.DRAFT, "draft"); + + public static final AppBuildStatus REJECTED = new AppBuildStatus(Value.REJECTED, "rejected"); + + private final Value value; + + private final String string; + + AppBuildStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AppBuildStatus && this.string.equals(((AppBuildStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case PENDING: + return visitor.visitPending(); + case DRAFT: + return visitor.visitDraft(); + case REJECTED: + return visitor.visitRejected(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppBuildStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "pending": + return PENDING; + case "draft": + return DRAFT; + case "rejected": + return REJECTED; + default: + return new AppBuildStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + DRAFT, + + PENDING, + + APPROVED, + + REJECTED, + + UNKNOWN + } + + public interface Visitor { + T visitDraft(); + + T visitPending(); + + T visitApproved(); + + T visitRejected(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppBuildStatuses.java b/src/main/java/com/whop/api/types/AppBuildStatuses.java new file mode 100644 index 00000000..2c62a6dc --- /dev/null +++ b/src/main/java/com/whop/api/types/AppBuildStatuses.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppBuildStatuses { + public static final AppBuildStatuses APPROVED = new AppBuildStatuses(Value.APPROVED, "approved"); + + public static final AppBuildStatuses PENDING = new AppBuildStatuses(Value.PENDING, "pending"); + + public static final AppBuildStatuses DRAFT = new AppBuildStatuses(Value.DRAFT, "draft"); + + public static final AppBuildStatuses REJECTED = new AppBuildStatuses(Value.REJECTED, "rejected"); + + private final Value value; + + private final String string; + + AppBuildStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AppBuildStatuses && this.string.equals(((AppBuildStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case PENDING: + return visitor.visitPending(); + case DRAFT: + return visitor.visitDraft(); + case REJECTED: + return visitor.visitRejected(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppBuildStatuses valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "pending": + return PENDING; + case "draft": + return DRAFT; + case "rejected": + return REJECTED; + default: + return new AppBuildStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + DRAFT, + + PENDING, + + APPROVED, + + REJECTED, + + UNKNOWN + } + + public interface Visitor { + T visitDraft(); + + T visitPending(); + + T visitApproved(); + + T visitRejected(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppBuildSupportedAppViewTypesItem.java b/src/main/java/com/whop/api/types/AppBuildSupportedAppViewTypesItem.java new file mode 100644 index 00000000..f63af08d --- /dev/null +++ b/src/main/java/com/whop/api/types/AppBuildSupportedAppViewTypesItem.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppBuildSupportedAppViewTypesItem { + public static final AppBuildSupportedAppViewTypesItem DASHBOARD = + new AppBuildSupportedAppViewTypesItem(Value.DASHBOARD, "dashboard"); + + public static final AppBuildSupportedAppViewTypesItem OPENAPI = + new AppBuildSupportedAppViewTypesItem(Value.OPENAPI, "openapi"); + + public static final AppBuildSupportedAppViewTypesItem SKILLS = + new AppBuildSupportedAppViewTypesItem(Value.SKILLS, "skills"); + + public static final AppBuildSupportedAppViewTypesItem ANALYTICS = + new AppBuildSupportedAppViewTypesItem(Value.ANALYTICS, "analytics"); + + public static final AppBuildSupportedAppViewTypesItem DISCOVER = + new AppBuildSupportedAppViewTypesItem(Value.DISCOVER, "discover"); + + public static final AppBuildSupportedAppViewTypesItem DASH = + new AppBuildSupportedAppViewTypesItem(Value.DASH, "dash"); + + public static final AppBuildSupportedAppViewTypesItem HUB = new AppBuildSupportedAppViewTypesItem(Value.HUB, "hub"); + + private final Value value; + + private final String string; + + AppBuildSupportedAppViewTypesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AppBuildSupportedAppViewTypesItem + && this.string.equals(((AppBuildSupportedAppViewTypesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DASHBOARD: + return visitor.visitDashboard(); + case OPENAPI: + return visitor.visitOpenapi(); + case SKILLS: + return visitor.visitSkills(); + case ANALYTICS: + return visitor.visitAnalytics(); + case DISCOVER: + return visitor.visitDiscover(); + case DASH: + return visitor.visitDash(); + case HUB: + return visitor.visitHub(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppBuildSupportedAppViewTypesItem valueOf(String value) { + switch (value) { + case "dashboard": + return DASHBOARD; + case "openapi": + return OPENAPI; + case "skills": + return SKILLS; + case "analytics": + return ANALYTICS; + case "discover": + return DISCOVER; + case "dash": + return DASH; + case "hub": + return HUB; + default: + return new AppBuildSupportedAppViewTypesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + HUB, + + DISCOVER, + + DASH, + + DASHBOARD, + + ANALYTICS, + + SKILLS, + + OPENAPI, + + UNKNOWN + } + + public interface Visitor { + T visitHub(); + + T visitDiscover(); + + T visitDash(); + + T visitDashboard(); + + T visitAnalytics(); + + T visitSkills(); + + T visitOpenapi(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppCreator.java b/src/main/java/com/whop/api/types/AppCreator.java new file mode 100644 index 00000000..944b969a --- /dev/null +++ b/src/main/java/com/whop/api/types/AppCreator.java @@ -0,0 +1,235 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppCreator.Builder.class) +public final class AppCreator { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private AppCreator(String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID, prefixed user_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return Public username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppCreator && equalTo((AppCreator) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppCreator other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID, prefixed user_.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(AppCreator other); + } + + public interface UsernameStage { + /** + *

Public username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + AppCreator build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AppCreator other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID, prefixed user_.

+ *

User ID, prefixed user_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Public username.

+ *

Public username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

Display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public AppCreator build() { + return new AppCreator(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AppDefaultApiKey.java b/src/main/java/com/whop/api/types/AppDefaultApiKey.java new file mode 100644 index 00000000..8a718ae3 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppDefaultApiKey.java @@ -0,0 +1,312 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppDefaultApiKey.Builder.class) +public final class AppDefaultApiKey { + private final String id; + + private final Optional name; + + private final String obfuscatedSecretKey; + + private final Optional secretKey; + + private final Map additionalProperties; + + private AppDefaultApiKey( + String id, + Optional name, + String obfuscatedSecretKey, + Optional secretKey, + Map additionalProperties) { + this.id = id; + this.name = name; + this.obfuscatedSecretKey = obfuscatedSecretKey; + this.secretKey = secretKey; + this.additionalProperties = additionalProperties; + } + + /** + * @return API key ID, prefixed apik_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Human-readable name identifying the API key, or null when none was set. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return Masked version of the secret key, so the key can be recognized without revealing the full secret. + */ + @JsonProperty("obfuscated_secret_key") + public String getObfuscatedSecretKey() { + return obfuscatedSecretKey; + } + + /** + * @return The full secret used to authenticate requests. null unless the caller could have created the key themselves. + */ + @JsonIgnore + public Optional getSecretKey() { + if (secretKey == null) { + return Optional.empty(); + } + return secretKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("secret_key") + private Optional _getSecretKey() { + return secretKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppDefaultApiKey && equalTo((AppDefaultApiKey) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppDefaultApiKey other) { + return id.equals(other.id) + && name.equals(other.name) + && obfuscatedSecretKey.equals(other.obfuscatedSecretKey) + && secretKey.equals(other.secretKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.obfuscatedSecretKey, this.secretKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

API key ID, prefixed apik_.

+ */ + ObfuscatedSecretKeyStage id(@NotNull String id); + + Builder from(AppDefaultApiKey other); + } + + public interface ObfuscatedSecretKeyStage { + /** + *

Masked version of the secret key, so the key can be recognized without revealing the full secret.

+ */ + _FinalStage obfuscatedSecretKey(@NotNull String obfuscatedSecretKey); + } + + public interface _FinalStage { + AppDefaultApiKey build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Human-readable name identifying the API key, or null when none was set.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

The full secret used to authenticate requests. null unless the caller could have created the key themselves.

+ */ + _FinalStage secretKey(Optional secretKey); + + _FinalStage secretKey(String secretKey); + + _FinalStage secretKey(Nullable secretKey); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObfuscatedSecretKeyStage, _FinalStage { + private String id; + + private String obfuscatedSecretKey; + + private Optional secretKey = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AppDefaultApiKey other) { + id(other.getId()); + name(other.getName()); + obfuscatedSecretKey(other.getObfuscatedSecretKey()); + secretKey(other.getSecretKey()); + return this; + } + + /** + *

API key ID, prefixed apik_.

+ *

API key ID, prefixed apik_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObfuscatedSecretKeyStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Masked version of the secret key, so the key can be recognized without revealing the full secret.

+ *

Masked version of the secret key, so the key can be recognized without revealing the full secret.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("obfuscated_secret_key") + public _FinalStage obfuscatedSecretKey(@NotNull String obfuscatedSecretKey) { + this.obfuscatedSecretKey = + Objects.requireNonNull(obfuscatedSecretKey, "obfuscatedSecretKey must not be null"); + return this; + } + + /** + *

The full secret used to authenticate requests. null unless the caller could have created the key themselves.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secretKey(Nullable secretKey) { + if (secretKey.isNull()) { + this.secretKey = null; + } else if (secretKey.isEmpty()) { + this.secretKey = Optional.empty(); + } else { + this.secretKey = Optional.of(secretKey.get()); + } + return this; + } + + /** + *

The full secret used to authenticate requests. null unless the caller could have created the key themselves.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secretKey(String secretKey) { + this.secretKey = Optional.ofNullable(secretKey); + return this; + } + + /** + *

The full secret used to authenticate requests. null unless the caller could have created the key themselves.

+ */ + @java.lang.Override + @JsonSetter(value = "secret_key", nulls = Nulls.SKIP) + public _FinalStage secretKey(Optional secretKey) { + this.secretKey = secretKey; + return this; + } + + /** + *

Human-readable name identifying the API key, or null when none was set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Human-readable name identifying the API key, or null when none was set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Human-readable name identifying the API key, or null when none was set.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public AppDefaultApiKey build() { + return new AppDefaultApiKey(id, name, obfuscatedSecretKey, secretKey, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AppDeployment.java b/src/main/java/com/whop/api/types/AppDeployment.java new file mode 100644 index 00000000..091f725f --- /dev/null +++ b/src/main/java/com/whop/api/types/AppDeployment.java @@ -0,0 +1,861 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppDeployment.Builder.class) +public final class AppDeployment { + private final String appId; + + private final Optional buildId; + + private final boolean draft; + + private final Optional error; + + private final Optional estimatedDurationMs; + + private final Optional estimatedRemainingMs; + + private final Optional finishedAt; + + private final Optional phase; + + private final Optional progress; + + private final Optional startedAt; + + private final AppDeploymentStatus status; + + private final Optional url; + + private final Map additionalProperties; + + private AppDeployment( + String appId, + Optional buildId, + boolean draft, + Optional error, + Optional estimatedDurationMs, + Optional estimatedRemainingMs, + Optional finishedAt, + Optional phase, + Optional progress, + Optional startedAt, + AppDeploymentStatus status, + Optional url, + Map additionalProperties) { + this.appId = appId; + this.buildId = buildId; + this.draft = draft; + this.error = error; + this.estimatedDurationMs = estimatedDurationMs; + this.estimatedRemainingMs = estimatedRemainingMs; + this.finishedAt = finishedAt; + this.phase = phase; + this.progress = progress; + this.startedAt = startedAt; + this.status = status; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app being deployed, prefixed app_. + */ + @JsonProperty("app_id") + public String getAppId() { + return appId; + } + + /** + * @return The build the deployment produced, prefixed abld_, or null until it succeeds. + */ + @JsonIgnore + public Optional getBuildId() { + if (buildId == null) { + return Optional.empty(); + } + return buildId; + } + + /** + * @return Whether the running or last deployment uploaded a build without making it live. + */ + @JsonProperty("draft") + public boolean getDraft() { + return draft; + } + + /** + * @return Why the deployment failed, or null when it did not. + */ + @JsonIgnore + public Optional getError() { + if (error == null) { + return Optional.empty(); + } + return error; + } + + /** + * @return How long this deployment is expected to take in total, estimated from previous runs. + */ + @JsonIgnore + public Optional getEstimatedDurationMs() { + if (estimatedDurationMs == null) { + return Optional.empty(); + } + return estimatedDurationMs; + } + + /** + * @return How much longer the deployment is expected to take. Held above zero until it actually finishes. + */ + @JsonIgnore + public Optional getEstimatedRemainingMs() { + if (estimatedRemainingMs == null) { + return Optional.empty(); + } + return estimatedRemainingMs; + } + + /** + * @return When the deployment ended, in milliseconds since the epoch, or null while it is still running. + */ + @JsonIgnore + public Optional getFinishedAt() { + if (finishedAt == null) { + return Optional.empty(); + } + return finishedAt; + } + + /** + * @return The stage a running deployment has reached, or null when none is running. Later phases dominate the wall clock: process_archive waits on the upload pipeline and promote waits for the build to go live. + */ + @JsonIgnore + public Optional getPhase() { + if (phase == null) { + return Optional.empty(); + } + return phase; + } + + /** + * @return Fraction of the deployment estimated to be complete, from 0 to 1. Stops just short of 1 until the run ends. + */ + @JsonIgnore + public Optional getProgress() { + if (progress == null) { + return Optional.empty(); + } + return progress; + } + + /** + * @return When the deployment began, in milliseconds since the epoch, or null when none has run. + */ + @JsonIgnore + public Optional getStartedAt() { + if (startedAt == null) { + return Optional.empty(); + } + return startedAt; + } + + /** + * @return Whether the app has anything to publish, and what a publish in flight is doing. unpublished means publishing would ship something new; no_source means the sandbox holds no copy of this app, so there is nothing to publish from. + */ + @JsonProperty("status") + public AppDeploymentStatus getStatus() { + return status; + } + + /** + * @return Where the deployed site is served, or null unless the deployment went live. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("build_id") + private Optional _getBuildId() { + return buildId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("error") + private Optional _getError() { + return error; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("estimated_duration_ms") + private Optional _getEstimatedDurationMs() { + return estimatedDurationMs; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("estimated_remaining_ms") + private Optional _getEstimatedRemainingMs() { + return estimatedRemainingMs; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("finished_at") + private Optional _getFinishedAt() { + return finishedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phase") + private Optional _getPhase() { + return phase; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("progress") + private Optional _getProgress() { + return progress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("started_at") + private Optional _getStartedAt() { + return startedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppDeployment && equalTo((AppDeployment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppDeployment other) { + return appId.equals(other.appId) + && buildId.equals(other.buildId) + && draft == other.draft + && error.equals(other.error) + && estimatedDurationMs.equals(other.estimatedDurationMs) + && estimatedRemainingMs.equals(other.estimatedRemainingMs) + && finishedAt.equals(other.finishedAt) + && phase.equals(other.phase) + && progress.equals(other.progress) + && startedAt.equals(other.startedAt) + && status.equals(other.status) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appId, + this.buildId, + this.draft, + this.error, + this.estimatedDurationMs, + this.estimatedRemainingMs, + this.finishedAt, + this.phase, + this.progress, + this.startedAt, + this.status, + this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppIdStage builder() { + return new Builder(); + } + + public interface AppIdStage { + /** + *

The app being deployed, prefixed app_.

+ */ + DraftStage appId(@NotNull String appId); + + Builder from(AppDeployment other); + } + + public interface DraftStage { + /** + *

Whether the running or last deployment uploaded a build without making it live.

+ */ + StatusStage draft(boolean draft); + } + + public interface StatusStage { + /** + *

Whether the app has anything to publish, and what a publish in flight is doing. unpublished means publishing would ship something new; no_source means the sandbox holds no copy of this app, so there is nothing to publish from.

+ */ + _FinalStage status(@NotNull AppDeploymentStatus status); + } + + public interface _FinalStage { + AppDeployment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The build the deployment produced, prefixed abld_, or null until it succeeds.

+ */ + _FinalStage buildId(Optional buildId); + + _FinalStage buildId(String buildId); + + _FinalStage buildId(Nullable buildId); + + /** + *

Why the deployment failed, or null when it did not.

+ */ + _FinalStage error(Optional error); + + _FinalStage error(String error); + + _FinalStage error(Nullable error); + + /** + *

How long this deployment is expected to take in total, estimated from previous runs.

+ */ + _FinalStage estimatedDurationMs(Optional estimatedDurationMs); + + _FinalStage estimatedDurationMs(Integer estimatedDurationMs); + + _FinalStage estimatedDurationMs(Nullable estimatedDurationMs); + + /** + *

How much longer the deployment is expected to take. Held above zero until it actually finishes.

+ */ + _FinalStage estimatedRemainingMs(Optional estimatedRemainingMs); + + _FinalStage estimatedRemainingMs(Integer estimatedRemainingMs); + + _FinalStage estimatedRemainingMs(Nullable estimatedRemainingMs); + + /** + *

When the deployment ended, in milliseconds since the epoch, or null while it is still running.

+ */ + _FinalStage finishedAt(Optional finishedAt); + + _FinalStage finishedAt(Integer finishedAt); + + _FinalStage finishedAt(Nullable finishedAt); + + /** + *

The stage a running deployment has reached, or null when none is running. Later phases dominate the wall clock: process_archive waits on the upload pipeline and promote waits for the build to go live.

+ */ + _FinalStage phase(Optional phase); + + _FinalStage phase(AppDeploymentPhase phase); + + _FinalStage phase(Nullable phase); + + /** + *

Fraction of the deployment estimated to be complete, from 0 to 1. Stops just short of 1 until the run ends.

+ */ + _FinalStage progress(Optional progress); + + _FinalStage progress(Double progress); + + _FinalStage progress(Nullable progress); + + /** + *

When the deployment began, in milliseconds since the epoch, or null when none has run.

+ */ + _FinalStage startedAt(Optional startedAt); + + _FinalStage startedAt(Integer startedAt); + + _FinalStage startedAt(Nullable startedAt); + + /** + *

Where the deployed site is served, or null unless the deployment went live.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AppIdStage, DraftStage, StatusStage, _FinalStage { + private String appId; + + private boolean draft; + + private AppDeploymentStatus status; + + private Optional url = Optional.empty(); + + private Optional startedAt = Optional.empty(); + + private Optional progress = Optional.empty(); + + private Optional phase = Optional.empty(); + + private Optional finishedAt = Optional.empty(); + + private Optional estimatedRemainingMs = Optional.empty(); + + private Optional estimatedDurationMs = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional buildId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AppDeployment other) { + appId(other.getAppId()); + buildId(other.getBuildId()); + draft(other.getDraft()); + error(other.getError()); + estimatedDurationMs(other.getEstimatedDurationMs()); + estimatedRemainingMs(other.getEstimatedRemainingMs()); + finishedAt(other.getFinishedAt()); + phase(other.getPhase()); + progress(other.getProgress()); + startedAt(other.getStartedAt()); + status(other.getStatus()); + url(other.getUrl()); + return this; + } + + /** + *

The app being deployed, prefixed app_.

+ *

The app being deployed, prefixed app_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("app_id") + public DraftStage appId(@NotNull String appId) { + this.appId = Objects.requireNonNull(appId, "appId must not be null"); + return this; + } + + /** + *

Whether the running or last deployment uploaded a build without making it live.

+ *

Whether the running or last deployment uploaded a build without making it live.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("draft") + public StatusStage draft(boolean draft) { + this.draft = draft; + return this; + } + + /** + *

Whether the app has anything to publish, and what a publish in flight is doing. unpublished means publishing would ship something new; no_source means the sandbox holds no copy of this app, so there is nothing to publish from.

+ *

Whether the app has anything to publish, and what a publish in flight is doing. unpublished means publishing would ship something new; no_source means the sandbox holds no copy of this app, so there is nothing to publish from.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull AppDeploymentStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Where the deployed site is served, or null unless the deployment went live.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

Where the deployed site is served, or null unless the deployment went live.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

Where the deployed site is served, or null unless the deployment went live.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

When the deployment began, in milliseconds since the epoch, or null when none has run.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startedAt(Nullable startedAt) { + if (startedAt.isNull()) { + this.startedAt = null; + } else if (startedAt.isEmpty()) { + this.startedAt = Optional.empty(); + } else { + this.startedAt = Optional.of(startedAt.get()); + } + return this; + } + + /** + *

When the deployment began, in milliseconds since the epoch, or null when none has run.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startedAt(Integer startedAt) { + this.startedAt = Optional.ofNullable(startedAt); + return this; + } + + /** + *

When the deployment began, in milliseconds since the epoch, or null when none has run.

+ */ + @java.lang.Override + @JsonSetter(value = "started_at", nulls = Nulls.SKIP) + public _FinalStage startedAt(Optional startedAt) { + this.startedAt = startedAt; + return this; + } + + /** + *

Fraction of the deployment estimated to be complete, from 0 to 1. Stops just short of 1 until the run ends.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage progress(Nullable progress) { + if (progress.isNull()) { + this.progress = null; + } else if (progress.isEmpty()) { + this.progress = Optional.empty(); + } else { + this.progress = Optional.of(progress.get()); + } + return this; + } + + /** + *

Fraction of the deployment estimated to be complete, from 0 to 1. Stops just short of 1 until the run ends.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage progress(Double progress) { + this.progress = Optional.ofNullable(progress); + return this; + } + + /** + *

Fraction of the deployment estimated to be complete, from 0 to 1. Stops just short of 1 until the run ends.

+ */ + @java.lang.Override + @JsonSetter(value = "progress", nulls = Nulls.SKIP) + public _FinalStage progress(Optional progress) { + this.progress = progress; + return this; + } + + /** + *

The stage a running deployment has reached, or null when none is running. Later phases dominate the wall clock: process_archive waits on the upload pipeline and promote waits for the build to go live.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phase(Nullable phase) { + if (phase.isNull()) { + this.phase = null; + } else if (phase.isEmpty()) { + this.phase = Optional.empty(); + } else { + this.phase = Optional.of(phase.get()); + } + return this; + } + + /** + *

The stage a running deployment has reached, or null when none is running. Later phases dominate the wall clock: process_archive waits on the upload pipeline and promote waits for the build to go live.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phase(AppDeploymentPhase phase) { + this.phase = Optional.ofNullable(phase); + return this; + } + + /** + *

The stage a running deployment has reached, or null when none is running. Later phases dominate the wall clock: process_archive waits on the upload pipeline and promote waits for the build to go live.

+ */ + @java.lang.Override + @JsonSetter(value = "phase", nulls = Nulls.SKIP) + public _FinalStage phase(Optional phase) { + this.phase = phase; + return this; + } + + /** + *

When the deployment ended, in milliseconds since the epoch, or null while it is still running.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage finishedAt(Nullable finishedAt) { + if (finishedAt.isNull()) { + this.finishedAt = null; + } else if (finishedAt.isEmpty()) { + this.finishedAt = Optional.empty(); + } else { + this.finishedAt = Optional.of(finishedAt.get()); + } + return this; + } + + /** + *

When the deployment ended, in milliseconds since the epoch, or null while it is still running.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage finishedAt(Integer finishedAt) { + this.finishedAt = Optional.ofNullable(finishedAt); + return this; + } + + /** + *

When the deployment ended, in milliseconds since the epoch, or null while it is still running.

+ */ + @java.lang.Override + @JsonSetter(value = "finished_at", nulls = Nulls.SKIP) + public _FinalStage finishedAt(Optional finishedAt) { + this.finishedAt = finishedAt; + return this; + } + + /** + *

How much longer the deployment is expected to take. Held above zero until it actually finishes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedRemainingMs(Nullable estimatedRemainingMs) { + if (estimatedRemainingMs.isNull()) { + this.estimatedRemainingMs = null; + } else if (estimatedRemainingMs.isEmpty()) { + this.estimatedRemainingMs = Optional.empty(); + } else { + this.estimatedRemainingMs = Optional.of(estimatedRemainingMs.get()); + } + return this; + } + + /** + *

How much longer the deployment is expected to take. Held above zero until it actually finishes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedRemainingMs(Integer estimatedRemainingMs) { + this.estimatedRemainingMs = Optional.ofNullable(estimatedRemainingMs); + return this; + } + + /** + *

How much longer the deployment is expected to take. Held above zero until it actually finishes.

+ */ + @java.lang.Override + @JsonSetter(value = "estimated_remaining_ms", nulls = Nulls.SKIP) + public _FinalStage estimatedRemainingMs(Optional estimatedRemainingMs) { + this.estimatedRemainingMs = estimatedRemainingMs; + return this; + } + + /** + *

How long this deployment is expected to take in total, estimated from previous runs.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedDurationMs(Nullable estimatedDurationMs) { + if (estimatedDurationMs.isNull()) { + this.estimatedDurationMs = null; + } else if (estimatedDurationMs.isEmpty()) { + this.estimatedDurationMs = Optional.empty(); + } else { + this.estimatedDurationMs = Optional.of(estimatedDurationMs.get()); + } + return this; + } + + /** + *

How long this deployment is expected to take in total, estimated from previous runs.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedDurationMs(Integer estimatedDurationMs) { + this.estimatedDurationMs = Optional.ofNullable(estimatedDurationMs); + return this; + } + + /** + *

How long this deployment is expected to take in total, estimated from previous runs.

+ */ + @java.lang.Override + @JsonSetter(value = "estimated_duration_ms", nulls = Nulls.SKIP) + public _FinalStage estimatedDurationMs(Optional estimatedDurationMs) { + this.estimatedDurationMs = estimatedDurationMs; + return this; + } + + /** + *

Why the deployment failed, or null when it did not.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(Nullable error) { + if (error.isNull()) { + this.error = null; + } else if (error.isEmpty()) { + this.error = Optional.empty(); + } else { + this.error = Optional.of(error.get()); + } + return this; + } + + /** + *

Why the deployment failed, or null when it did not.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

Why the deployment failed, or null when it did not.

+ */ + @java.lang.Override + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public _FinalStage error(Optional error) { + this.error = error; + return this; + } + + /** + *

The build the deployment produced, prefixed abld_, or null until it succeeds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage buildId(Nullable buildId) { + if (buildId.isNull()) { + this.buildId = null; + } else if (buildId.isEmpty()) { + this.buildId = Optional.empty(); + } else { + this.buildId = Optional.of(buildId.get()); + } + return this; + } + + /** + *

The build the deployment produced, prefixed abld_, or null until it succeeds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage buildId(String buildId) { + this.buildId = Optional.ofNullable(buildId); + return this; + } + + /** + *

The build the deployment produced, prefixed abld_, or null until it succeeds.

+ */ + @java.lang.Override + @JsonSetter(value = "build_id", nulls = Nulls.SKIP) + public _FinalStage buildId(Optional buildId) { + this.buildId = buildId; + return this; + } + + @java.lang.Override + public AppDeployment build() { + return new AppDeployment( + appId, + buildId, + draft, + error, + estimatedDurationMs, + estimatedRemainingMs, + finishedAt, + phase, + progress, + startedAt, + status, + url, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AppDeploymentPhase.java b/src/main/java/com/whop/api/types/AppDeploymentPhase.java new file mode 100644 index 00000000..c2deddf2 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppDeploymentPhase.java @@ -0,0 +1,144 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppDeploymentPhase { + public static final AppDeploymentPhase CREATE_BUILD = new AppDeploymentPhase(Value.CREATE_BUILD, "create_build"); + + public static final AppDeploymentPhase PROMOTE = new AppDeploymentPhase(Value.PROMOTE, "promote"); + + public static final AppDeploymentPhase TYPECHECK = new AppDeploymentPhase(Value.TYPECHECK, "typecheck"); + + public static final AppDeploymentPhase UPLOAD_BUILD = new AppDeploymentPhase(Value.UPLOAD_BUILD, "upload_build"); + + public static final AppDeploymentPhase BUILD = new AppDeploymentPhase(Value.BUILD, "build"); + + public static final AppDeploymentPhase PROCESS_ARCHIVE = + new AppDeploymentPhase(Value.PROCESS_ARCHIVE, "process_archive"); + + public static final AppDeploymentPhase UPLOAD_SOURCE = new AppDeploymentPhase(Value.UPLOAD_SOURCE, "upload_source"); + + public static final AppDeploymentPhase INSTALL = new AppDeploymentPhase(Value.INSTALL, "install"); + + private final Value value; + + private final String string; + + AppDeploymentPhase(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AppDeploymentPhase && this.string.equals(((AppDeploymentPhase) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATE_BUILD: + return visitor.visitCreateBuild(); + case PROMOTE: + return visitor.visitPromote(); + case TYPECHECK: + return visitor.visitTypecheck(); + case UPLOAD_BUILD: + return visitor.visitUploadBuild(); + case BUILD: + return visitor.visitBuild(); + case PROCESS_ARCHIVE: + return visitor.visitProcessArchive(); + case UPLOAD_SOURCE: + return visitor.visitUploadSource(); + case INSTALL: + return visitor.visitInstall(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppDeploymentPhase valueOf(String value) { + switch (value) { + case "create_build": + return CREATE_BUILD; + case "promote": + return PROMOTE; + case "typecheck": + return TYPECHECK; + case "upload_build": + return UPLOAD_BUILD; + case "build": + return BUILD; + case "process_archive": + return PROCESS_ARCHIVE; + case "upload_source": + return UPLOAD_SOURCE; + case "install": + return INSTALL; + default: + return new AppDeploymentPhase(Value.UNKNOWN, value); + } + } + + public enum Value { + INSTALL, + + BUILD, + + TYPECHECK, + + UPLOAD_BUILD, + + UPLOAD_SOURCE, + + PROCESS_ARCHIVE, + + CREATE_BUILD, + + PROMOTE, + + UNKNOWN + } + + public interface Visitor { + T visitInstall(); + + T visitBuild(); + + T visitTypecheck(); + + T visitUploadBuild(); + + T visitUploadSource(); + + T visitProcessArchive(); + + T visitCreateBuild(); + + T visitPromote(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppDeploymentStatus.java b/src/main/java/com/whop/api/types/AppDeploymentStatus.java new file mode 100644 index 00000000..5f360a1e --- /dev/null +++ b/src/main/java/com/whop/api/types/AppDeploymentStatus.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppDeploymentStatus { + public static final AppDeploymentStatus FAILED = new AppDeploymentStatus(Value.FAILED, "failed"); + + public static final AppDeploymentStatus NO_SOURCE = new AppDeploymentStatus(Value.NO_SOURCE, "no_source"); + + public static final AppDeploymentStatus PUBLISHING = new AppDeploymentStatus(Value.PUBLISHING, "publishing"); + + public static final AppDeploymentStatus UNPUBLISHED = new AppDeploymentStatus(Value.UNPUBLISHED, "unpublished"); + + public static final AppDeploymentStatus PUBLISHED = new AppDeploymentStatus(Value.PUBLISHED, "published"); + + private final Value value; + + private final String string; + + AppDeploymentStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AppDeploymentStatus && this.string.equals(((AppDeploymentStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case NO_SOURCE: + return visitor.visitNoSource(); + case PUBLISHING: + return visitor.visitPublishing(); + case UNPUBLISHED: + return visitor.visitUnpublished(); + case PUBLISHED: + return visitor.visitPublished(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppDeploymentStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "no_source": + return NO_SOURCE; + case "publishing": + return PUBLISHING; + case "unpublished": + return UNPUBLISHED; + case "published": + return PUBLISHED; + default: + return new AppDeploymentStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PUBLISHED, + + UNPUBLISHED, + + PUBLISHING, + + FAILED, + + NO_SOURCE, + + UNKNOWN + } + + public interface Visitor { + T visitPublished(); + + T visitUnpublished(); + + T visitPublishing(); + + T visitFailed(); + + T visitNoSource(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppIcon.java b/src/main/java/com/whop/api/types/AppIcon.java new file mode 100644 index 00000000..9b8db01e --- /dev/null +++ b/src/main/java/com/whop/api/types/AppIcon.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppIcon.Builder.class) +public final class AppIcon { + private final String url; + + private final Map additionalProperties; + + private AppIcon(String url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Icon image URL. Always present — the default app icon when none is uploaded. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppIcon && equalTo((AppIcon) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppIcon other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

Icon image URL. Always present — the default app icon when none is uploaded.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(AppIcon other); + } + + public interface _FinalStage { + AppIcon build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AppIcon other) { + url(other.getUrl()); + return this; + } + + /** + *

Icon image URL. Always present — the default app icon when none is uploaded.

+ *

Icon image URL. Always present — the default app icon when none is uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public AppIcon build() { + return new AppIcon(url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AppListItem.java b/src/main/java/com/whop/api/types/AppListItem.java new file mode 100644 index 00000000..8475a70f --- /dev/null +++ b/src/main/java/com/whop/api/types/AppListItem.java @@ -0,0 +1,1322 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppListItem.Builder.class) +public final class AppListItem { + private final AccountParent account; + + private final AppListItemAppType appType; + + private final Optional bannerImage; + + private final Optional baseUrl; + + private final int businessesCreatedCount; + + private final List businessesCreatedLogoUrls; + + private final AppCreator creator; + + private final Optional dashboardPath; + + private final Optional description; + + private final Optional discoverPath; + + private final String domainId; + + private final Optional experiencePath; + + private final Optional hostedUrl; + + private final AppIcon icon; + + private final String id; + + private final String name; + + private final Optional openapiPath; + + private final Optional origin; + + private final Optional route; + + private final Optional skillsPath; + + private final AppListItemStatus status; + + private final boolean verified; + + private final Map additionalProperties; + + private AppListItem( + AccountParent account, + AppListItemAppType appType, + Optional bannerImage, + Optional baseUrl, + int businessesCreatedCount, + List businessesCreatedLogoUrls, + AppCreator creator, + Optional dashboardPath, + Optional description, + Optional discoverPath, + String domainId, + Optional experiencePath, + Optional hostedUrl, + AppIcon icon, + String id, + String name, + Optional openapiPath, + Optional origin, + Optional route, + Optional skillsPath, + AppListItemStatus status, + boolean verified, + Map additionalProperties) { + this.account = account; + this.appType = appType; + this.bannerImage = bannerImage; + this.baseUrl = baseUrl; + this.businessesCreatedCount = businessesCreatedCount; + this.businessesCreatedLogoUrls = businessesCreatedLogoUrls; + this.creator = creator; + this.dashboardPath = dashboardPath; + this.description = description; + this.discoverPath = discoverPath; + this.domainId = domainId; + this.experiencePath = experiencePath; + this.hostedUrl = hostedUrl; + this.icon = icon; + this.id = id; + this.name = name; + this.openapiPath = openapiPath; + this.origin = origin; + this.route = route; + this.skillsPath = skillsPath; + this.status = status; + this.verified = verified; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account that owns the app. + */ + @JsonProperty("account") + public AccountParent getAccount() { + return account; + } + + /** + * @return The type of end-user the app is built for. + */ + @JsonProperty("app_type") + public AppListItemAppType getAppType() { + return appType; + } + + /** + * @return Banner image from the app's product listing, or null when none is uploaded. + */ + @JsonIgnore + public Optional getBannerImage() { + if (bannerImage == null) { + return Optional.empty(); + } + return bannerImage; + } + + /** + * @return The production base URL where the app is hosted. null if no base URL is configured, if the caller lacks the developer:basic:read permission on the app's account, or on list responses, which never expose it. + */ + @JsonIgnore + public Optional getBaseUrl() { + if (baseUrl == null) { + return Optional.empty(); + } + return baseUrl; + } + + /** + * @return Number of businesses created from this app as a template. + */ + @JsonProperty("businesses_created_count") + public int getBusinessesCreatedCount() { + return businessesCreatedCount; + } + + @JsonProperty("businesses_created_logo_urls") + public List getBusinessesCreatedLogoUrls() { + return businessesCreatedLogoUrls; + } + + /** + * @return The user who owns the publishing account. + */ + @JsonProperty("creator") + public AppCreator getCreator() { + return creator; + } + + /** + * @return URL path for the account dashboard view, or null when not configured. + */ + @JsonIgnore + public Optional getDashboardPath() { + if (dashboardPath == null) { + return Optional.empty(); + } + return dashboardPath; + } + + /** + * @return Short description shown in listings and search results, or null if none has been set. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return URL path for the discover view, or null when not configured. + */ + @JsonIgnore + public Optional getDiscoverPath() { + if (discoverPath == null) { + return Optional.empty(); + } + return discoverPath; + } + + /** + * @return Subdomain identifier for the app's proxied URL, forming https://{domain_id}.apps.whop.com. + */ + @JsonProperty("domain_id") + public String getDomainId() { + return domainId; + } + + /** + * @return URL path for the member-facing hub view, or null when not configured. + */ + @JsonIgnore + public Optional getExperiencePath() { + if (experiencePath == null) { + return Optional.empty(); + } + return experiencePath; + } + + /** + * @return Full URL where the app's hosted web build is served, or null if no route is claimed. + */ + @JsonIgnore + public Optional getHostedUrl() { + if (hostedUrl == null) { + return Optional.empty(); + } + return hostedUrl; + } + + /** + * @return The app's icon. Falls back to the default app icon when none is uploaded. + */ + @JsonProperty("icon") + public AppIcon getIcon() { + return icon; + } + + /** + * @return App ID, prefixed app_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Display name shown on the app store and in experience navigation. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return URL path to the app's OpenAPI spec file, or null when not configured. + */ + @JsonIgnore + public Optional getOpenapiPath() { + if (openapiPath == null) { + return Optional.empty(); + } + return openapiPath; + } + + /** + * @return Full origin URL of the app's proxied domain, for example https://ab1c2d3e4f.apps.whop.com. + */ + @JsonIgnore + public Optional getOrigin() { + if (origin == null) { + return Optional.empty(); + } + return origin; + } + + /** + * @return Claimed subdomain route where hosted web builds are served (myapp for myapp.whop.app), or null if no route is claimed. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return URL path to the app's skills directory, or null when not configured. + */ + @JsonIgnore + public Optional getSkillsPath() { + if (skillsPath == null) { + return Optional.empty(); + } + return skillsPath; + } + + /** + * @return Visibility on the Whop app store: live is publicly discoverable, unlisted is accessible only via direct link, hidden is not visible anywhere. + */ + @JsonProperty("status") + public AppListItemStatus getStatus() { + return status; + } + + /** + * @return Whether the app has been verified by Whop and is eligible for the featured apps section. + */ + @JsonProperty("verified") + public boolean getVerified() { + return verified; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("banner_image") + private Optional _getBannerImage() { + return bannerImage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("base_url") + private Optional _getBaseUrl() { + return baseUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("dashboard_path") + private Optional _getDashboardPath() { + return dashboardPath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("discover_path") + private Optional _getDiscoverPath() { + return discoverPath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("experience_path") + private Optional _getExperiencePath() { + return experiencePath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("hosted_url") + private Optional _getHostedUrl() { + return hostedUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("openapi_path") + private Optional _getOpenapiPath() { + return openapiPath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("origin") + private Optional _getOrigin() { + return origin; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("skills_path") + private Optional _getSkillsPath() { + return skillsPath; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppListItem && equalTo((AppListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppListItem other) { + return account.equals(other.account) + && appType.equals(other.appType) + && bannerImage.equals(other.bannerImage) + && baseUrl.equals(other.baseUrl) + && businessesCreatedCount == other.businessesCreatedCount + && businessesCreatedLogoUrls.equals(other.businessesCreatedLogoUrls) + && creator.equals(other.creator) + && dashboardPath.equals(other.dashboardPath) + && description.equals(other.description) + && discoverPath.equals(other.discoverPath) + && domainId.equals(other.domainId) + && experiencePath.equals(other.experiencePath) + && hostedUrl.equals(other.hostedUrl) + && icon.equals(other.icon) + && id.equals(other.id) + && name.equals(other.name) + && openapiPath.equals(other.openapiPath) + && origin.equals(other.origin) + && route.equals(other.route) + && skillsPath.equals(other.skillsPath) + && status.equals(other.status) + && verified == other.verified; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.account, + this.appType, + this.bannerImage, + this.baseUrl, + this.businessesCreatedCount, + this.businessesCreatedLogoUrls, + this.creator, + this.dashboardPath, + this.description, + this.discoverPath, + this.domainId, + this.experiencePath, + this.hostedUrl, + this.icon, + this.id, + this.name, + this.openapiPath, + this.origin, + this.route, + this.skillsPath, + this.status, + this.verified); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountStage builder() { + return new Builder(); + } + + public interface AccountStage { + /** + *

The account that owns the app.

+ */ + AppTypeStage account(@NotNull AccountParent account); + + Builder from(AppListItem other); + } + + public interface AppTypeStage { + /** + *

The type of end-user the app is built for.

+ */ + BusinessesCreatedCountStage appType(@NotNull AppListItemAppType appType); + } + + public interface BusinessesCreatedCountStage { + /** + *

Number of businesses created from this app as a template.

+ */ + CreatorStage businessesCreatedCount(int businessesCreatedCount); + } + + public interface CreatorStage { + /** + *

The user who owns the publishing account.

+ */ + DomainIdStage creator(@NotNull AppCreator creator); + } + + public interface DomainIdStage { + /** + *

Subdomain identifier for the app's proxied URL, forming https://{domain_id}.apps.whop.com.

+ */ + IconStage domainId(@NotNull String domainId); + } + + public interface IconStage { + /** + *

The app's icon. Falls back to the default app icon when none is uploaded.

+ */ + IdStage icon(@NotNull AppIcon icon); + } + + public interface IdStage { + /** + *

App ID, prefixed app_.

+ */ + NameStage id(@NotNull String id); + } + + public interface NameStage { + /** + *

Display name shown on the app store and in experience navigation.

+ */ + StatusStage name(@NotNull String name); + } + + public interface StatusStage { + /** + *

Visibility on the Whop app store: live is publicly discoverable, unlisted is accessible only via direct link, hidden is not visible anywhere.

+ */ + VerifiedStage status(@NotNull AppListItemStatus status); + } + + public interface VerifiedStage { + /** + *

Whether the app has been verified by Whop and is eligible for the featured apps section.

+ */ + _FinalStage verified(boolean verified); + } + + public interface _FinalStage { + AppListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Banner image from the app's product listing, or null when none is uploaded.

+ */ + _FinalStage bannerImage(Optional bannerImage); + + _FinalStage bannerImage(AppBannerImage bannerImage); + + _FinalStage bannerImage(Nullable bannerImage); + + /** + *

The production base URL where the app is hosted. null if no base URL is configured, if the caller lacks the developer:basic:read permission on the app's account, or on list responses, which never expose it.

+ */ + _FinalStage baseUrl(Optional baseUrl); + + _FinalStage baseUrl(String baseUrl); + + _FinalStage baseUrl(Nullable baseUrl); + + _FinalStage businessesCreatedLogoUrls(List businessesCreatedLogoUrls); + + _FinalStage addBusinessesCreatedLogoUrls(String businessesCreatedLogoUrls); + + _FinalStage addAllBusinessesCreatedLogoUrls(List businessesCreatedLogoUrls); + + /** + *

URL path for the account dashboard view, or null when not configured.

+ */ + _FinalStage dashboardPath(Optional dashboardPath); + + _FinalStage dashboardPath(String dashboardPath); + + _FinalStage dashboardPath(Nullable dashboardPath); + + /** + *

Short description shown in listings and search results, or null if none has been set.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

URL path for the discover view, or null when not configured.

+ */ + _FinalStage discoverPath(Optional discoverPath); + + _FinalStage discoverPath(String discoverPath); + + _FinalStage discoverPath(Nullable discoverPath); + + /** + *

URL path for the member-facing hub view, or null when not configured.

+ */ + _FinalStage experiencePath(Optional experiencePath); + + _FinalStage experiencePath(String experiencePath); + + _FinalStage experiencePath(Nullable experiencePath); + + /** + *

Full URL where the app's hosted web build is served, or null if no route is claimed.

+ */ + _FinalStage hostedUrl(Optional hostedUrl); + + _FinalStage hostedUrl(String hostedUrl); + + _FinalStage hostedUrl(Nullable hostedUrl); + + /** + *

URL path to the app's OpenAPI spec file, or null when not configured.

+ */ + _FinalStage openapiPath(Optional openapiPath); + + _FinalStage openapiPath(String openapiPath); + + _FinalStage openapiPath(Nullable openapiPath); + + /** + *

Full origin URL of the app's proxied domain, for example https://ab1c2d3e4f.apps.whop.com.

+ */ + _FinalStage origin(Optional origin); + + _FinalStage origin(String origin); + + _FinalStage origin(Nullable origin); + + /** + *

Claimed subdomain route where hosted web builds are served (myapp for myapp.whop.app), or null if no route is claimed.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

URL path to the app's skills directory, or null when not configured.

+ */ + _FinalStage skillsPath(Optional skillsPath); + + _FinalStage skillsPath(String skillsPath); + + _FinalStage skillsPath(Nullable skillsPath); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountStage, + AppTypeStage, + BusinessesCreatedCountStage, + CreatorStage, + DomainIdStage, + IconStage, + IdStage, + NameStage, + StatusStage, + VerifiedStage, + _FinalStage { + private AccountParent account; + + private AppListItemAppType appType; + + private int businessesCreatedCount; + + private AppCreator creator; + + private String domainId; + + private AppIcon icon; + + private String id; + + private String name; + + private AppListItemStatus status; + + private boolean verified; + + private Optional skillsPath = Optional.empty(); + + private Optional route = Optional.empty(); + + private Optional origin = Optional.empty(); + + private Optional openapiPath = Optional.empty(); + + private Optional hostedUrl = Optional.empty(); + + private Optional experiencePath = Optional.empty(); + + private Optional discoverPath = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional dashboardPath = Optional.empty(); + + private List businessesCreatedLogoUrls = new ArrayList<>(); + + private Optional baseUrl = Optional.empty(); + + private Optional bannerImage = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AppListItem other) { + account(other.getAccount()); + appType(other.getAppType()); + bannerImage(other.getBannerImage()); + baseUrl(other.getBaseUrl()); + businessesCreatedCount(other.getBusinessesCreatedCount()); + businessesCreatedLogoUrls(other.getBusinessesCreatedLogoUrls()); + creator(other.getCreator()); + dashboardPath(other.getDashboardPath()); + description(other.getDescription()); + discoverPath(other.getDiscoverPath()); + domainId(other.getDomainId()); + experiencePath(other.getExperiencePath()); + hostedUrl(other.getHostedUrl()); + icon(other.getIcon()); + id(other.getId()); + name(other.getName()); + openapiPath(other.getOpenapiPath()); + origin(other.getOrigin()); + route(other.getRoute()); + skillsPath(other.getSkillsPath()); + status(other.getStatus()); + verified(other.getVerified()); + return this; + } + + /** + *

The account that owns the app.

+ *

The account that owns the app.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account") + public AppTypeStage account(@NotNull AccountParent account) { + this.account = Objects.requireNonNull(account, "account must not be null"); + return this; + } + + /** + *

The type of end-user the app is built for.

+ *

The type of end-user the app is built for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("app_type") + public BusinessesCreatedCountStage appType(@NotNull AppListItemAppType appType) { + this.appType = Objects.requireNonNull(appType, "appType must not be null"); + return this; + } + + /** + *

Number of businesses created from this app as a template.

+ *

Number of businesses created from this app as a template.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("businesses_created_count") + public CreatorStage businessesCreatedCount(int businessesCreatedCount) { + this.businessesCreatedCount = businessesCreatedCount; + return this; + } + + /** + *

The user who owns the publishing account.

+ *

The user who owns the publishing account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("creator") + public DomainIdStage creator(@NotNull AppCreator creator) { + this.creator = Objects.requireNonNull(creator, "creator must not be null"); + return this; + } + + /** + *

Subdomain identifier for the app's proxied URL, forming https://{domain_id}.apps.whop.com.

+ *

Subdomain identifier for the app's proxied URL, forming https://{domain_id}.apps.whop.com.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("domain_id") + public IconStage domainId(@NotNull String domainId) { + this.domainId = Objects.requireNonNull(domainId, "domainId must not be null"); + return this; + } + + /** + *

The app's icon. Falls back to the default app icon when none is uploaded.

+ *

The app's icon. Falls back to the default app icon when none is uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icon") + public IdStage icon(@NotNull AppIcon icon) { + this.icon = Objects.requireNonNull(icon, "icon must not be null"); + return this; + } + + /** + *

App ID, prefixed app_.

+ *

App ID, prefixed app_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Display name shown on the app store and in experience navigation.

+ *

Display name shown on the app store and in experience navigation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public StatusStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

Visibility on the Whop app store: live is publicly discoverable, unlisted is accessible only via direct link, hidden is not visible anywhere.

+ *

Visibility on the Whop app store: live is publicly discoverable, unlisted is accessible only via direct link, hidden is not visible anywhere.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public VerifiedStage status(@NotNull AppListItemStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Whether the app has been verified by Whop and is eligible for the featured apps section.

+ *

Whether the app has been verified by Whop and is eligible for the featured apps section.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("verified") + public _FinalStage verified(boolean verified) { + this.verified = verified; + return this; + } + + /** + *

URL path to the app's skills directory, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage skillsPath(Nullable skillsPath) { + if (skillsPath.isNull()) { + this.skillsPath = null; + } else if (skillsPath.isEmpty()) { + this.skillsPath = Optional.empty(); + } else { + this.skillsPath = Optional.of(skillsPath.get()); + } + return this; + } + + /** + *

URL path to the app's skills directory, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage skillsPath(String skillsPath) { + this.skillsPath = Optional.ofNullable(skillsPath); + return this; + } + + /** + *

URL path to the app's skills directory, or null when not configured.

+ */ + @java.lang.Override + @JsonSetter(value = "skills_path", nulls = Nulls.SKIP) + public _FinalStage skillsPath(Optional skillsPath) { + this.skillsPath = skillsPath; + return this; + } + + /** + *

Claimed subdomain route where hosted web builds are served (myapp for myapp.whop.app), or null if no route is claimed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Claimed subdomain route where hosted web builds are served (myapp for myapp.whop.app), or null if no route is claimed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Claimed subdomain route where hosted web builds are served (myapp for myapp.whop.app), or null if no route is claimed.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + /** + *

Full origin URL of the app's proxied domain, for example https://ab1c2d3e4f.apps.whop.com.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage origin(Nullable origin) { + if (origin.isNull()) { + this.origin = null; + } else if (origin.isEmpty()) { + this.origin = Optional.empty(); + } else { + this.origin = Optional.of(origin.get()); + } + return this; + } + + /** + *

Full origin URL of the app's proxied domain, for example https://ab1c2d3e4f.apps.whop.com.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage origin(String origin) { + this.origin = Optional.ofNullable(origin); + return this; + } + + /** + *

Full origin URL of the app's proxied domain, for example https://ab1c2d3e4f.apps.whop.com.

+ */ + @java.lang.Override + @JsonSetter(value = "origin", nulls = Nulls.SKIP) + public _FinalStage origin(Optional origin) { + this.origin = origin; + return this; + } + + /** + *

URL path to the app's OpenAPI spec file, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage openapiPath(Nullable openapiPath) { + if (openapiPath.isNull()) { + this.openapiPath = null; + } else if (openapiPath.isEmpty()) { + this.openapiPath = Optional.empty(); + } else { + this.openapiPath = Optional.of(openapiPath.get()); + } + return this; + } + + /** + *

URL path to the app's OpenAPI spec file, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage openapiPath(String openapiPath) { + this.openapiPath = Optional.ofNullable(openapiPath); + return this; + } + + /** + *

URL path to the app's OpenAPI spec file, or null when not configured.

+ */ + @java.lang.Override + @JsonSetter(value = "openapi_path", nulls = Nulls.SKIP) + public _FinalStage openapiPath(Optional openapiPath) { + this.openapiPath = openapiPath; + return this; + } + + /** + *

Full URL where the app's hosted web build is served, or null if no route is claimed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostedUrl(Nullable hostedUrl) { + if (hostedUrl.isNull()) { + this.hostedUrl = null; + } else if (hostedUrl.isEmpty()) { + this.hostedUrl = Optional.empty(); + } else { + this.hostedUrl = Optional.of(hostedUrl.get()); + } + return this; + } + + /** + *

Full URL where the app's hosted web build is served, or null if no route is claimed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostedUrl(String hostedUrl) { + this.hostedUrl = Optional.ofNullable(hostedUrl); + return this; + } + + /** + *

Full URL where the app's hosted web build is served, or null if no route is claimed.

+ */ + @java.lang.Override + @JsonSetter(value = "hosted_url", nulls = Nulls.SKIP) + public _FinalStage hostedUrl(Optional hostedUrl) { + this.hostedUrl = hostedUrl; + return this; + } + + /** + *

URL path for the member-facing hub view, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage experiencePath(Nullable experiencePath) { + if (experiencePath.isNull()) { + this.experiencePath = null; + } else if (experiencePath.isEmpty()) { + this.experiencePath = Optional.empty(); + } else { + this.experiencePath = Optional.of(experiencePath.get()); + } + return this; + } + + /** + *

URL path for the member-facing hub view, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage experiencePath(String experiencePath) { + this.experiencePath = Optional.ofNullable(experiencePath); + return this; + } + + /** + *

URL path for the member-facing hub view, or null when not configured.

+ */ + @java.lang.Override + @JsonSetter(value = "experience_path", nulls = Nulls.SKIP) + public _FinalStage experiencePath(Optional experiencePath) { + this.experiencePath = experiencePath; + return this; + } + + /** + *

URL path for the discover view, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discoverPath(Nullable discoverPath) { + if (discoverPath.isNull()) { + this.discoverPath = null; + } else if (discoverPath.isEmpty()) { + this.discoverPath = Optional.empty(); + } else { + this.discoverPath = Optional.of(discoverPath.get()); + } + return this; + } + + /** + *

URL path for the discover view, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discoverPath(String discoverPath) { + this.discoverPath = Optional.ofNullable(discoverPath); + return this; + } + + /** + *

URL path for the discover view, or null when not configured.

+ */ + @java.lang.Override + @JsonSetter(value = "discover_path", nulls = Nulls.SKIP) + public _FinalStage discoverPath(Optional discoverPath) { + this.discoverPath = discoverPath; + return this; + } + + /** + *

Short description shown in listings and search results, or null if none has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

Short description shown in listings and search results, or null if none has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

Short description shown in listings and search results, or null if none has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

URL path for the account dashboard view, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dashboardPath(Nullable dashboardPath) { + if (dashboardPath.isNull()) { + this.dashboardPath = null; + } else if (dashboardPath.isEmpty()) { + this.dashboardPath = Optional.empty(); + } else { + this.dashboardPath = Optional.of(dashboardPath.get()); + } + return this; + } + + /** + *

URL path for the account dashboard view, or null when not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dashboardPath(String dashboardPath) { + this.dashboardPath = Optional.ofNullable(dashboardPath); + return this; + } + + /** + *

URL path for the account dashboard view, or null when not configured.

+ */ + @java.lang.Override + @JsonSetter(value = "dashboard_path", nulls = Nulls.SKIP) + public _FinalStage dashboardPath(Optional dashboardPath) { + this.dashboardPath = dashboardPath; + return this; + } + + @java.lang.Override + public _FinalStage addAllBusinessesCreatedLogoUrls(List businessesCreatedLogoUrls) { + if (businessesCreatedLogoUrls != null) { + this.businessesCreatedLogoUrls.addAll(businessesCreatedLogoUrls); + } + return this; + } + + @java.lang.Override + public _FinalStage addBusinessesCreatedLogoUrls(String businessesCreatedLogoUrls) { + this.businessesCreatedLogoUrls.add(businessesCreatedLogoUrls); + return this; + } + + @java.lang.Override + @JsonSetter(value = "businesses_created_logo_urls", nulls = Nulls.SKIP) + public _FinalStage businessesCreatedLogoUrls(List businessesCreatedLogoUrls) { + this.businessesCreatedLogoUrls.clear(); + if (businessesCreatedLogoUrls != null) { + this.businessesCreatedLogoUrls.addAll(businessesCreatedLogoUrls); + } + return this; + } + + /** + *

The production base URL where the app is hosted. null if no base URL is configured, if the caller lacks the developer:basic:read permission on the app's account, or on list responses, which never expose it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage baseUrl(Nullable baseUrl) { + if (baseUrl.isNull()) { + this.baseUrl = null; + } else if (baseUrl.isEmpty()) { + this.baseUrl = Optional.empty(); + } else { + this.baseUrl = Optional.of(baseUrl.get()); + } + return this; + } + + /** + *

The production base URL where the app is hosted. null if no base URL is configured, if the caller lacks the developer:basic:read permission on the app's account, or on list responses, which never expose it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage baseUrl(String baseUrl) { + this.baseUrl = Optional.ofNullable(baseUrl); + return this; + } + + /** + *

The production base URL where the app is hosted. null if no base URL is configured, if the caller lacks the developer:basic:read permission on the app's account, or on list responses, which never expose it.

+ */ + @java.lang.Override + @JsonSetter(value = "base_url", nulls = Nulls.SKIP) + public _FinalStage baseUrl(Optional baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + /** + *

Banner image from the app's product listing, or null when none is uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bannerImage(Nullable bannerImage) { + if (bannerImage.isNull()) { + this.bannerImage = null; + } else if (bannerImage.isEmpty()) { + this.bannerImage = Optional.empty(); + } else { + this.bannerImage = Optional.of(bannerImage.get()); + } + return this; + } + + /** + *

Banner image from the app's product listing, or null when none is uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bannerImage(AppBannerImage bannerImage) { + this.bannerImage = Optional.ofNullable(bannerImage); + return this; + } + + /** + *

Banner image from the app's product listing, or null when none is uploaded.

+ */ + @java.lang.Override + @JsonSetter(value = "banner_image", nulls = Nulls.SKIP) + public _FinalStage bannerImage(Optional bannerImage) { + this.bannerImage = bannerImage; + return this; + } + + @java.lang.Override + public AppListItem build() { + return new AppListItem( + account, + appType, + bannerImage, + baseUrl, + businessesCreatedCount, + businessesCreatedLogoUrls, + creator, + dashboardPath, + description, + discoverPath, + domainId, + experiencePath, + hostedUrl, + icon, + id, + name, + openapiPath, + origin, + route, + skillsPath, + status, + verified, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AppListItemAppType.java b/src/main/java/com/whop/api/types/AppListItemAppType.java new file mode 100644 index 00000000..0a98fca8 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppListItemAppType.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppListItemAppType { + public static final AppListItemAppType COMPONENT = new AppListItemAppType(Value.COMPONENT, "component"); + + public static final AppListItemAppType WEBSITE = new AppListItemAppType(Value.WEBSITE, "website"); + + public static final AppListItemAppType B2B_APP = new AppListItemAppType(Value.B2B_APP, "b2b_app"); + + public static final AppListItemAppType B2C_APP = new AppListItemAppType(Value.B2C_APP, "b2c_app"); + + public static final AppListItemAppType COMPANY_APP = new AppListItemAppType(Value.COMPANY_APP, "company_app"); + + private final Value value; + + private final String string; + + AppListItemAppType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AppListItemAppType && this.string.equals(((AppListItemAppType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case COMPONENT: + return visitor.visitComponent(); + case WEBSITE: + return visitor.visitWebsite(); + case B2B_APP: + return visitor.visitB2BApp(); + case B2C_APP: + return visitor.visitB2CApp(); + case COMPANY_APP: + return visitor.visitCompanyApp(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppListItemAppType valueOf(String value) { + switch (value) { + case "component": + return COMPONENT; + case "website": + return WEBSITE; + case "b2b_app": + return B2B_APP; + case "b2c_app": + return B2C_APP; + case "company_app": + return COMPANY_APP; + default: + return new AppListItemAppType(Value.UNKNOWN, value); + } + } + + public enum Value { + B2B_APP, + + B2C_APP, + + COMPANY_APP, + + COMPONENT, + + WEBSITE, + + UNKNOWN + } + + public interface Visitor { + T visitB2BApp(); + + T visitB2CApp(); + + T visitCompanyApp(); + + T visitComponent(); + + T visitWebsite(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppListItemStatus.java b/src/main/java/com/whop/api/types/AppListItemStatus.java new file mode 100644 index 00000000..de5809f0 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppListItemStatus.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppListItemStatus { + public static final AppListItemStatus LIVE = new AppListItemStatus(Value.LIVE, "live"); + + public static final AppListItemStatus HIDDEN = new AppListItemStatus(Value.HIDDEN, "hidden"); + + public static final AppListItemStatus UNLISTED = new AppListItemStatus(Value.UNLISTED, "unlisted"); + + private final Value value; + + private final String string; + + AppListItemStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AppListItemStatus && this.string.equals(((AppListItemStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LIVE: + return visitor.visitLive(); + case HIDDEN: + return visitor.visitHidden(); + case UNLISTED: + return visitor.visitUnlisted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppListItemStatus valueOf(String value) { + switch (value) { + case "live": + return LIVE; + case "hidden": + return HIDDEN; + case "unlisted": + return UNLISTED; + default: + return new AppListItemStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + LIVE, + + UNLISTED, + + HIDDEN, + + UNKNOWN + } + + public interface Visitor { + T visitLive(); + + T visitUnlisted(); + + T visitHidden(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppMarketplaceStatus.java b/src/main/java/com/whop/api/types/AppMarketplaceStatus.java new file mode 100644 index 00000000..119f30cd --- /dev/null +++ b/src/main/java/com/whop/api/types/AppMarketplaceStatus.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppMarketplaceStatus { + public static final AppMarketplaceStatus PENDING_REVIEW = + new AppMarketplaceStatus(Value.PENDING_REVIEW, "pending_review"); + + public static final AppMarketplaceStatus NOT_AVAILABLE = + new AppMarketplaceStatus(Value.NOT_AVAILABLE, "not_available"); + + public static final AppMarketplaceStatus LIVE_MARKETPLACE = + new AppMarketplaceStatus(Value.LIVE_MARKETPLACE, "live_marketplace"); + + private final Value value; + + private final String string; + + AppMarketplaceStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AppMarketplaceStatus && this.string.equals(((AppMarketplaceStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING_REVIEW: + return visitor.visitPendingReview(); + case NOT_AVAILABLE: + return visitor.visitNotAvailable(); + case LIVE_MARKETPLACE: + return visitor.visitLiveMarketplace(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppMarketplaceStatus valueOf(String value) { + switch (value) { + case "pending_review": + return PENDING_REVIEW; + case "not_available": + return NOT_AVAILABLE; + case "live_marketplace": + return LIVE_MARKETPLACE; + default: + return new AppMarketplaceStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + NOT_AVAILABLE, + + PENDING_REVIEW, + + LIVE_MARKETPLACE, + + UNKNOWN + } + + public interface Visitor { + T visitNotAvailable(); + + T visitPendingReview(); + + T visitLiveMarketplace(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppOauthClientType.java b/src/main/java/com/whop/api/types/AppOauthClientType.java new file mode 100644 index 00000000..646a0d1f --- /dev/null +++ b/src/main/java/com/whop/api/types/AppOauthClientType.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppOauthClientType { + public static final AppOauthClientType PUBLIC = new AppOauthClientType(Value.PUBLIC, "public"); + + public static final AppOauthClientType CONFIDENTIAL = new AppOauthClientType(Value.CONFIDENTIAL, "confidential"); + + private final Value value; + + private final String string; + + AppOauthClientType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AppOauthClientType && this.string.equals(((AppOauthClientType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PUBLIC: + return visitor.visitPublic(); + case CONFIDENTIAL: + return visitor.visitConfidential(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppOauthClientType valueOf(String value) { + switch (value) { + case "public": + return PUBLIC; + case "confidential": + return CONFIDENTIAL; + default: + return new AppOauthClientType(Value.UNKNOWN, value); + } + } + + public enum Value { + PUBLIC, + + CONFIDENTIAL, + + UNKNOWN + } + + public interface Visitor { + T visitPublic(); + + T visitConfidential(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppOauthClientTypes.java b/src/main/java/com/whop/api/types/AppOauthClientTypes.java new file mode 100644 index 00000000..64ebc8f8 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppOauthClientTypes.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppOauthClientTypes { + public static final AppOauthClientTypes PUBLIC = new AppOauthClientTypes(Value.PUBLIC, "public"); + + public static final AppOauthClientTypes CONFIDENTIAL = new AppOauthClientTypes(Value.CONFIDENTIAL, "confidential"); + + private final Value value; + + private final String string; + + AppOauthClientTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AppOauthClientTypes && this.string.equals(((AppOauthClientTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PUBLIC: + return visitor.visitPublic(); + case CONFIDENTIAL: + return visitor.visitConfidential(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppOauthClientTypes valueOf(String value) { + switch (value) { + case "public": + return PUBLIC; + case "confidential": + return CONFIDENTIAL; + default: + return new AppOauthClientTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + PUBLIC, + + CONFIDENTIAL, + + UNKNOWN + } + + public interface Visitor { + T visitPublic(); + + T visitConfidential(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppOrder.java b/src/main/java/com/whop/api/types/AppOrder.java new file mode 100644 index 00000000..42714411 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppOrder.java @@ -0,0 +1,185 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppOrder { + public static final AppOrder TOTAL_AI_TOKENS = new AppOrder(Value.TOTAL_AI_TOKENS, "total_ai_tokens"); + + public static final AppOrder TIME_SPENT_LAST24HOURS = + new AppOrder(Value.TIME_SPENT_LAST24HOURS, "time_spent_last_24_hours"); + + public static final AppOrder AI_PROMPT_COUNT = new AppOrder(Value.AI_PROMPT_COUNT, "ai_prompt_count"); + + public static final AppOrder TIME_SPENT = new AppOrder(Value.TIME_SPENT, "time_spent"); + + public static final AppOrder DAILY_ACTIVE_USERS = new AppOrder(Value.DAILY_ACTIVE_USERS, "daily_active_users"); + + public static final AppOrder TOTAL_AI_COST_USD = new AppOrder(Value.TOTAL_AI_COST_USD, "total_ai_cost_usd"); + + public static final AppOrder CREATED_AT = new AppOrder(Value.CREATED_AT, "created_at"); + + public static final AppOrder TOTAL_INSTALLS_LAST7DAYS = + new AppOrder(Value.TOTAL_INSTALLS_LAST7DAYS, "total_installs_last_7_days"); + + public static final AppOrder LAST_AI_PROMPT_AT = new AppOrder(Value.LAST_AI_PROMPT_AT, "last_ai_prompt_at"); + + public static final AppOrder DISCOVERABLE_AT = new AppOrder(Value.DISCOVERABLE_AT, "discoverable_at"); + + public static final AppOrder TOTAL_INSTALLS_LAST30DAYS = + new AppOrder(Value.TOTAL_INSTALLS_LAST30DAYS, "total_installs_last_30_days"); + + public static final AppOrder AI_AVERAGE_RATING = new AppOrder(Value.AI_AVERAGE_RATING, "ai_average_rating"); + + private final Value value; + + private final String string; + + AppOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof AppOrder && this.string.equals(((AppOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TOTAL_AI_TOKENS: + return visitor.visitTotalAiTokens(); + case TIME_SPENT_LAST24HOURS: + return visitor.visitTimeSpentLast24Hours(); + case AI_PROMPT_COUNT: + return visitor.visitAiPromptCount(); + case TIME_SPENT: + return visitor.visitTimeSpent(); + case DAILY_ACTIVE_USERS: + return visitor.visitDailyActiveUsers(); + case TOTAL_AI_COST_USD: + return visitor.visitTotalAiCostUsd(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case TOTAL_INSTALLS_LAST7DAYS: + return visitor.visitTotalInstallsLast7Days(); + case LAST_AI_PROMPT_AT: + return visitor.visitLastAiPromptAt(); + case DISCOVERABLE_AT: + return visitor.visitDiscoverableAt(); + case TOTAL_INSTALLS_LAST30DAYS: + return visitor.visitTotalInstallsLast30Days(); + case AI_AVERAGE_RATING: + return visitor.visitAiAverageRating(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppOrder valueOf(String value) { + switch (value) { + case "total_ai_tokens": + return TOTAL_AI_TOKENS; + case "time_spent_last_24_hours": + return TIME_SPENT_LAST24HOURS; + case "ai_prompt_count": + return AI_PROMPT_COUNT; + case "time_spent": + return TIME_SPENT; + case "daily_active_users": + return DAILY_ACTIVE_USERS; + case "total_ai_cost_usd": + return TOTAL_AI_COST_USD; + case "created_at": + return CREATED_AT; + case "total_installs_last_7_days": + return TOTAL_INSTALLS_LAST7DAYS; + case "last_ai_prompt_at": + return LAST_AI_PROMPT_AT; + case "discoverable_at": + return DISCOVERABLE_AT; + case "total_installs_last_30_days": + return TOTAL_INSTALLS_LAST30DAYS; + case "ai_average_rating": + return AI_AVERAGE_RATING; + default: + return new AppOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + DISCOVERABLE_AT, + + TOTAL_INSTALLS_LAST30DAYS, + + TOTAL_INSTALLS_LAST7DAYS, + + TIME_SPENT, + + TIME_SPENT_LAST24HOURS, + + DAILY_ACTIVE_USERS, + + AI_PROMPT_COUNT, + + TOTAL_AI_COST_USD, + + TOTAL_AI_TOKENS, + + LAST_AI_PROMPT_AT, + + AI_AVERAGE_RATING, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitDiscoverableAt(); + + T visitTotalInstallsLast30Days(); + + T visitTotalInstallsLast7Days(); + + T visitTimeSpent(); + + T visitTimeSpentLast24Hours(); + + T visitDailyActiveUsers(); + + T visitAiPromptCount(); + + T visitTotalAiCostUsd(); + + T visitTotalAiTokens(); + + T visitLastAiPromptAt(); + + T visitAiAverageRating(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppProductionBuild.java b/src/main/java/com/whop/api/types/AppProductionBuild.java new file mode 100644 index 00000000..17af25f4 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppProductionBuild.java @@ -0,0 +1,381 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppProductionBuild.Builder.class) +public final class AppProductionBuild { + private final Optional checksum; + + private final Optional fileUrl; + + private final String id; + + private final Optional sourceUrl; + + private final AppProductionBuildStatus status; + + private final Map additionalProperties; + + private AppProductionBuild( + Optional checksum, + Optional fileUrl, + String id, + Optional sourceUrl, + AppProductionBuildStatus status, + Map additionalProperties) { + this.checksum = checksum; + this.fileUrl = fileUrl; + this.id = id; + this.sourceUrl = sourceUrl; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Client-generated checksum of the build file, used to verify file integrity. + */ + @JsonIgnore + public Optional getChecksum() { + if (checksum == null) { + return Optional.empty(); + } + return checksum; + } + + /** + * @return URL to download the uploaded build artifact. + */ + @JsonIgnore + public Optional getFileUrl() { + if (fileUrl == null) { + return Optional.empty(); + } + return fileUrl; + } + + /** + * @return App build ID, prefixed abld_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return URL to download the compressed source code archive that produced this build, or null when the build was uploaded without a source archive. + */ + @JsonIgnore + public Optional getSourceUrl() { + if (sourceUrl == null) { + return Optional.empty(); + } + return sourceUrl; + } + + /** + * @return The build's review status. + */ + @JsonProperty("status") + public AppProductionBuildStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checksum") + private Optional _getChecksum() { + return checksum; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("file_url") + private Optional _getFileUrl() { + return fileUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source_url") + private Optional _getSourceUrl() { + return sourceUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppProductionBuild && equalTo((AppProductionBuild) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppProductionBuild other) { + return checksum.equals(other.checksum) + && fileUrl.equals(other.fileUrl) + && id.equals(other.id) + && sourceUrl.equals(other.sourceUrl) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.checksum, this.fileUrl, this.id, this.sourceUrl, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

App build ID, prefixed abld_.

+ */ + StatusStage id(@NotNull String id); + + Builder from(AppProductionBuild other); + } + + public interface StatusStage { + /** + *

The build's review status.

+ */ + _FinalStage status(@NotNull AppProductionBuildStatus status); + } + + public interface _FinalStage { + AppProductionBuild build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Client-generated checksum of the build file, used to verify file integrity.

+ */ + _FinalStage checksum(Optional checksum); + + _FinalStage checksum(String checksum); + + _FinalStage checksum(Nullable checksum); + + /** + *

URL to download the uploaded build artifact.

+ */ + _FinalStage fileUrl(Optional fileUrl); + + _FinalStage fileUrl(String fileUrl); + + _FinalStage fileUrl(Nullable fileUrl); + + /** + *

URL to download the compressed source code archive that produced this build, or null when the build was uploaded without a source archive.

+ */ + _FinalStage sourceUrl(Optional sourceUrl); + + _FinalStage sourceUrl(String sourceUrl); + + _FinalStage sourceUrl(Nullable sourceUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, StatusStage, _FinalStage { + private String id; + + private AppProductionBuildStatus status; + + private Optional sourceUrl = Optional.empty(); + + private Optional fileUrl = Optional.empty(); + + private Optional checksum = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AppProductionBuild other) { + checksum(other.getChecksum()); + fileUrl(other.getFileUrl()); + id(other.getId()); + sourceUrl(other.getSourceUrl()); + status(other.getStatus()); + return this; + } + + /** + *

App build ID, prefixed abld_.

+ *

App build ID, prefixed abld_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The build's review status.

+ *

The build's review status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull AppProductionBuildStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

URL to download the compressed source code archive that produced this build, or null when the build was uploaded without a source archive.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sourceUrl(Nullable sourceUrl) { + if (sourceUrl.isNull()) { + this.sourceUrl = null; + } else if (sourceUrl.isEmpty()) { + this.sourceUrl = Optional.empty(); + } else { + this.sourceUrl = Optional.of(sourceUrl.get()); + } + return this; + } + + /** + *

URL to download the compressed source code archive that produced this build, or null when the build was uploaded without a source archive.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sourceUrl(String sourceUrl) { + this.sourceUrl = Optional.ofNullable(sourceUrl); + return this; + } + + /** + *

URL to download the compressed source code archive that produced this build, or null when the build was uploaded without a source archive.

+ */ + @java.lang.Override + @JsonSetter(value = "source_url", nulls = Nulls.SKIP) + public _FinalStage sourceUrl(Optional sourceUrl) { + this.sourceUrl = sourceUrl; + return this; + } + + /** + *

URL to download the uploaded build artifact.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fileUrl(Nullable fileUrl) { + if (fileUrl.isNull()) { + this.fileUrl = null; + } else if (fileUrl.isEmpty()) { + this.fileUrl = Optional.empty(); + } else { + this.fileUrl = Optional.of(fileUrl.get()); + } + return this; + } + + /** + *

URL to download the uploaded build artifact.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fileUrl(String fileUrl) { + this.fileUrl = Optional.ofNullable(fileUrl); + return this; + } + + /** + *

URL to download the uploaded build artifact.

+ */ + @java.lang.Override + @JsonSetter(value = "file_url", nulls = Nulls.SKIP) + public _FinalStage fileUrl(Optional fileUrl) { + this.fileUrl = fileUrl; + return this; + } + + /** + *

Client-generated checksum of the build file, used to verify file integrity.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checksum(Nullable checksum) { + if (checksum.isNull()) { + this.checksum = null; + } else if (checksum.isEmpty()) { + this.checksum = Optional.empty(); + } else { + this.checksum = Optional.of(checksum.get()); + } + return this; + } + + /** + *

Client-generated checksum of the build file, used to verify file integrity.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checksum(String checksum) { + this.checksum = Optional.ofNullable(checksum); + return this; + } + + /** + *

Client-generated checksum of the build file, used to verify file integrity.

+ */ + @java.lang.Override + @JsonSetter(value = "checksum", nulls = Nulls.SKIP) + public _FinalStage checksum(Optional checksum) { + this.checksum = checksum; + return this; + } + + @java.lang.Override + public AppProductionBuild build() { + return new AppProductionBuild(checksum, fileUrl, id, sourceUrl, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AppProductionBuildStatus.java b/src/main/java/com/whop/api/types/AppProductionBuildStatus.java new file mode 100644 index 00000000..9752aa41 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppProductionBuildStatus.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppProductionBuildStatus { + public static final AppProductionBuildStatus APPROVED = new AppProductionBuildStatus(Value.APPROVED, "approved"); + + public static final AppProductionBuildStatus PENDING = new AppProductionBuildStatus(Value.PENDING, "pending"); + + public static final AppProductionBuildStatus DRAFT = new AppProductionBuildStatus(Value.DRAFT, "draft"); + + public static final AppProductionBuildStatus REJECTED = new AppProductionBuildStatus(Value.REJECTED, "rejected"); + + private final Value value; + + private final String string; + + AppProductionBuildStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AppProductionBuildStatus + && this.string.equals(((AppProductionBuildStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case PENDING: + return visitor.visitPending(); + case DRAFT: + return visitor.visitDraft(); + case REJECTED: + return visitor.visitRejected(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppProductionBuildStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "pending": + return PENDING; + case "draft": + return DRAFT; + case "rejected": + return REJECTED; + default: + return new AppProductionBuildStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + DRAFT, + + PENDING, + + APPROVED, + + REJECTED, + + UNKNOWN + } + + public interface Visitor { + T visitDraft(); + + T visitPending(); + + T visitApproved(); + + T visitRejected(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppRequestedPermission.java b/src/main/java/com/whop/api/types/AppRequestedPermission.java new file mode 100644 index 00000000..e06666bc --- /dev/null +++ b/src/main/java/com/whop/api/types/AppRequestedPermission.java @@ -0,0 +1,241 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppRequestedPermission.Builder.class) +public final class AppRequestedPermission { + private final boolean isRequired; + + private final Optional justification; + + private final AppRequestedPermissionAction permissionAction; + + private final Map additionalProperties; + + private AppRequestedPermission( + boolean isRequired, + Optional justification, + AppRequestedPermissionAction permissionAction, + Map additionalProperties) { + this.isRequired = isRequired; + this.justification = justification; + this.permissionAction = permissionAction; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the app requires the permission to be granted on install, as opposed to requesting it optionally. + */ + @JsonProperty("is_required") + public boolean getIsRequired() { + return isRequired; + } + + /** + * @return The developer's explanation of why the app needs the permission, or null when none was provided. + */ + @JsonIgnore + public Optional getJustification() { + if (justification == null) { + return Optional.empty(); + } + return justification; + } + + /** + * @return The permission action the app requests. + */ + @JsonProperty("permission_action") + public AppRequestedPermissionAction getPermissionAction() { + return permissionAction; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("justification") + private Optional _getJustification() { + return justification; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppRequestedPermission && equalTo((AppRequestedPermission) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppRequestedPermission other) { + return isRequired == other.isRequired + && justification.equals(other.justification) + && permissionAction.equals(other.permissionAction); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.isRequired, this.justification, this.permissionAction); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IsRequiredStage builder() { + return new Builder(); + } + + public interface IsRequiredStage { + /** + *

Whether the app requires the permission to be granted on install, as opposed to requesting it optionally.

+ */ + PermissionActionStage isRequired(boolean isRequired); + + Builder from(AppRequestedPermission other); + } + + public interface PermissionActionStage { + /** + *

The permission action the app requests.

+ */ + _FinalStage permissionAction(@NotNull AppRequestedPermissionAction permissionAction); + } + + public interface _FinalStage { + AppRequestedPermission build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The developer's explanation of why the app needs the permission, or null when none was provided.

+ */ + _FinalStage justification(Optional justification); + + _FinalStage justification(String justification); + + _FinalStage justification(Nullable justification); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IsRequiredStage, PermissionActionStage, _FinalStage { + private boolean isRequired; + + private AppRequestedPermissionAction permissionAction; + + private Optional justification = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AppRequestedPermission other) { + isRequired(other.getIsRequired()); + justification(other.getJustification()); + permissionAction(other.getPermissionAction()); + return this; + } + + /** + *

Whether the app requires the permission to be granted on install, as opposed to requesting it optionally.

+ *

Whether the app requires the permission to be granted on install, as opposed to requesting it optionally.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_required") + public PermissionActionStage isRequired(boolean isRequired) { + this.isRequired = isRequired; + return this; + } + + /** + *

The permission action the app requests.

+ *

The permission action the app requests.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("permission_action") + public _FinalStage permissionAction(@NotNull AppRequestedPermissionAction permissionAction) { + this.permissionAction = Objects.requireNonNull(permissionAction, "permissionAction must not be null"); + return this; + } + + /** + *

The developer's explanation of why the app needs the permission, or null when none was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage justification(Nullable justification) { + if (justification.isNull()) { + this.justification = null; + } else if (justification.isEmpty()) { + this.justification = Optional.empty(); + } else { + this.justification = Optional.of(justification.get()); + } + return this; + } + + /** + *

The developer's explanation of why the app needs the permission, or null when none was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage justification(String justification) { + this.justification = Optional.ofNullable(justification); + return this; + } + + /** + *

The developer's explanation of why the app needs the permission, or null when none was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "justification", nulls = Nulls.SKIP) + public _FinalStage justification(Optional justification) { + this.justification = justification; + return this; + } + + @java.lang.Override + public AppRequestedPermission build() { + return new AppRequestedPermission(isRequired, justification, permissionAction, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AppRequestedPermissionAction.java b/src/main/java/com/whop/api/types/AppRequestedPermissionAction.java new file mode 100644 index 00000000..a39e59e9 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppRequestedPermissionAction.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppRequestedPermissionAction.Builder.class) +public final class AppRequestedPermissionAction { + private final String action; + + private final String name; + + private final Map additionalProperties; + + private AppRequestedPermissionAction(String action, String name, Map additionalProperties) { + this.action = action; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The permission action's identifier, for example company:basic:read. + */ + @JsonProperty("action") + public String getAction() { + return action; + } + + /** + * @return Human-readable name of the action. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppRequestedPermissionAction && equalTo((AppRequestedPermissionAction) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppRequestedPermissionAction other) { + return action.equals(other.action) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.action, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + /** + *

The permission action's identifier, for example company:basic:read.

+ */ + NameStage action(@NotNull String action); + + Builder from(AppRequestedPermissionAction other); + } + + public interface NameStage { + /** + *

Human-readable name of the action.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + AppRequestedPermissionAction build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ActionStage, NameStage, _FinalStage { + private String action; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AppRequestedPermissionAction other) { + action(other.getAction()); + name(other.getName()); + return this; + } + + /** + *

The permission action's identifier, for example company:basic:read.

+ *

The permission action's identifier, for example company:basic:read.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("action") + public NameStage action(@NotNull String action) { + this.action = Objects.requireNonNull(action, "action must not be null"); + return this; + } + + /** + *

Human-readable name of the action.

+ *

Human-readable name of the action.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public AppRequestedPermissionAction build() { + return new AppRequestedPermissionAction(action, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AppRequiredScopesItem.java b/src/main/java/com/whop/api/types/AppRequiredScopesItem.java new file mode 100644 index 00000000..8f476cb4 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppRequiredScopesItem.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppRequiredScopesItem { + public static final AppRequiredScopesItem READ_USER = new AppRequiredScopesItem(Value.READ_USER, "read_user"); + + private final Value value; + + private final String string; + + AppRequiredScopesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AppRequiredScopesItem + && this.string.equals(((AppRequiredScopesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case READ_USER: + return visitor.visitReadUser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppRequiredScopesItem valueOf(String value) { + switch (value) { + case "read_user": + return READ_USER; + default: + return new AppRequiredScopesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + READ_USER, + + UNKNOWN + } + + public interface Visitor { + T visitReadUser(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppStatus.java b/src/main/java/com/whop/api/types/AppStatus.java new file mode 100644 index 00000000..325e0723 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppStatus.java @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppStatus { + public static final AppStatus LIVE = new AppStatus(Value.LIVE, "live"); + + public static final AppStatus HIDDEN = new AppStatus(Value.HIDDEN, "hidden"); + + public static final AppStatus UNLISTED = new AppStatus(Value.UNLISTED, "unlisted"); + + private final Value value; + + private final String string; + + AppStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof AppStatus && this.string.equals(((AppStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LIVE: + return visitor.visitLive(); + case HIDDEN: + return visitor.visitHidden(); + case UNLISTED: + return visitor.visitUnlisted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppStatus valueOf(String value) { + switch (value) { + case "live": + return LIVE; + case "hidden": + return HIDDEN; + case "unlisted": + return UNLISTED; + default: + return new AppStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + LIVE, + + UNLISTED, + + HIDDEN, + + UNKNOWN + } + + public interface Visitor { + T visitLive(); + + T visitUnlisted(); + + T visitHidden(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppStatuses.java b/src/main/java/com/whop/api/types/AppStatuses.java new file mode 100644 index 00000000..d7ed5780 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppStatuses.java @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppStatuses { + public static final AppStatuses LIVE = new AppStatuses(Value.LIVE, "live"); + + public static final AppStatuses HIDDEN = new AppStatuses(Value.HIDDEN, "hidden"); + + public static final AppStatuses UNLISTED = new AppStatuses(Value.UNLISTED, "unlisted"); + + private final Value value; + + private final String string; + + AppStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof AppStatuses && this.string.equals(((AppStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LIVE: + return visitor.visitLive(); + case HIDDEN: + return visitor.visitHidden(); + case UNLISTED: + return visitor.visitUnlisted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppStatuses valueOf(String value) { + switch (value) { + case "live": + return LIVE; + case "hidden": + return HIDDEN; + case "unlisted": + return UNLISTED; + default: + return new AppStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + LIVE, + + UNLISTED, + + HIDDEN, + + UNKNOWN + } + + public interface Visitor { + T visitLive(); + + T visitUnlisted(); + + T visitHidden(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppTypes.java b/src/main/java/com/whop/api/types/AppTypes.java new file mode 100644 index 00000000..5f38432a --- /dev/null +++ b/src/main/java/com/whop/api/types/AppTypes.java @@ -0,0 +1,112 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppTypes { + public static final AppTypes COMPONENT = new AppTypes(Value.COMPONENT, "component"); + + public static final AppTypes WEBSITE = new AppTypes(Value.WEBSITE, "website"); + + public static final AppTypes B2B_APP = new AppTypes(Value.B2B_APP, "b2b_app"); + + public static final AppTypes B2C_APP = new AppTypes(Value.B2C_APP, "b2c_app"); + + public static final AppTypes COMPANY_APP = new AppTypes(Value.COMPANY_APP, "company_app"); + + private final Value value; + + private final String string; + + AppTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof AppTypes && this.string.equals(((AppTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case COMPONENT: + return visitor.visitComponent(); + case WEBSITE: + return visitor.visitWebsite(); + case B2B_APP: + return visitor.visitB2BApp(); + case B2C_APP: + return visitor.visitB2CApp(); + case COMPANY_APP: + return visitor.visitCompanyApp(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppTypes valueOf(String value) { + switch (value) { + case "component": + return COMPONENT; + case "website": + return WEBSITE; + case "b2b_app": + return B2B_APP; + case "b2c_app": + return B2C_APP; + case "company_app": + return COMPANY_APP; + default: + return new AppTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + B2B_APP, + + B2C_APP, + + COMPANY_APP, + + COMPONENT, + + WEBSITE, + + UNKNOWN + } + + public interface Visitor { + T visitB2BApp(); + + T visitB2CApp(); + + T visitCompanyApp(); + + T visitComponent(); + + T visitWebsite(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppUsageStats.java b/src/main/java/com/whop/api/types/AppUsageStats.java new file mode 100644 index 00000000..02fb46e7 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppUsageStats.java @@ -0,0 +1,286 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppUsageStats.Builder.class) +public final class AppUsageStats { + private final Optional dau; + + private final Optional mau; + + private final Optional timeSpentLast24Hours; + + private final Optional wau; + + private final Map additionalProperties; + + private AppUsageStats( + Optional dau, + Optional mau, + Optional timeSpentLast24Hours, + Optional wau, + Map additionalProperties) { + this.dau = dau; + this.mau = mau; + this.timeSpentLast24Hours = timeSpentLast24Hours; + this.wau = wau; + this.additionalProperties = additionalProperties; + } + + /** + * @return Daily active users. + */ + @JsonIgnore + public Optional getDau() { + if (dau == null) { + return Optional.empty(); + } + return dau; + } + + /** + * @return Monthly active users. + */ + @JsonIgnore + public Optional getMau() { + if (mau == null) { + return Optional.empty(); + } + return mau; + } + + /** + * @return Total time users spent in the app over the last 24 hours, in seconds. + */ + @JsonIgnore + public Optional getTimeSpentLast24Hours() { + if (timeSpentLast24Hours == null) { + return Optional.empty(); + } + return timeSpentLast24Hours; + } + + /** + * @return Weekly active users. + */ + @JsonIgnore + public Optional getWau() { + if (wau == null) { + return Optional.empty(); + } + return wau; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("dau") + private Optional _getDau() { + return dau; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("mau") + private Optional _getMau() { + return mau; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("time_spent_last24_hours") + private Optional _getTimeSpentLast24Hours() { + return timeSpentLast24Hours; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("wau") + private Optional _getWau() { + return wau; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppUsageStats && equalTo((AppUsageStats) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppUsageStats other) { + return dau.equals(other.dau) + && mau.equals(other.mau) + && timeSpentLast24Hours.equals(other.timeSpentLast24Hours) + && wau.equals(other.wau); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dau, this.mau, this.timeSpentLast24Hours, this.wau); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional dau = Optional.empty(); + + private Optional mau = Optional.empty(); + + private Optional timeSpentLast24Hours = Optional.empty(); + + private Optional wau = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AppUsageStats other) { + dau(other.getDau()); + mau(other.getMau()); + timeSpentLast24Hours(other.getTimeSpentLast24Hours()); + wau(other.getWau()); + return this; + } + + /** + *

Daily active users.

+ */ + @JsonSetter(value = "dau", nulls = Nulls.SKIP) + public Builder dau(Optional dau) { + this.dau = dau; + return this; + } + + public Builder dau(Integer dau) { + this.dau = Optional.ofNullable(dau); + return this; + } + + public Builder dau(Nullable dau) { + if (dau.isNull()) { + this.dau = null; + } else if (dau.isEmpty()) { + this.dau = Optional.empty(); + } else { + this.dau = Optional.of(dau.get()); + } + return this; + } + + /** + *

Monthly active users.

+ */ + @JsonSetter(value = "mau", nulls = Nulls.SKIP) + public Builder mau(Optional mau) { + this.mau = mau; + return this; + } + + public Builder mau(Integer mau) { + this.mau = Optional.ofNullable(mau); + return this; + } + + public Builder mau(Nullable mau) { + if (mau.isNull()) { + this.mau = null; + } else if (mau.isEmpty()) { + this.mau = Optional.empty(); + } else { + this.mau = Optional.of(mau.get()); + } + return this; + } + + /** + *

Total time users spent in the app over the last 24 hours, in seconds.

+ */ + @JsonSetter(value = "time_spent_last24_hours", nulls = Nulls.SKIP) + public Builder timeSpentLast24Hours(Optional timeSpentLast24Hours) { + this.timeSpentLast24Hours = timeSpentLast24Hours; + return this; + } + + public Builder timeSpentLast24Hours(Integer timeSpentLast24Hours) { + this.timeSpentLast24Hours = Optional.ofNullable(timeSpentLast24Hours); + return this; + } + + public Builder timeSpentLast24Hours(Nullable timeSpentLast24Hours) { + if (timeSpentLast24Hours.isNull()) { + this.timeSpentLast24Hours = null; + } else if (timeSpentLast24Hours.isEmpty()) { + this.timeSpentLast24Hours = Optional.empty(); + } else { + this.timeSpentLast24Hours = Optional.of(timeSpentLast24Hours.get()); + } + return this; + } + + /** + *

Weekly active users.

+ */ + @JsonSetter(value = "wau", nulls = Nulls.SKIP) + public Builder wau(Optional wau) { + this.wau = wau; + return this; + } + + public Builder wau(Integer wau) { + this.wau = Optional.ofNullable(wau); + return this; + } + + public Builder wau(Nullable wau) { + if (wau.isNull()) { + this.wau = null; + } else if (wau.isEmpty()) { + this.wau = Optional.empty(); + } else { + this.wau = Optional.of(wau.get()); + } + return this; + } + + public AppUsageStats build() { + return new AppUsageStats(dau, mau, timeSpentLast24Hours, wau, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AppValidScopes.java b/src/main/java/com/whop/api/types/AppValidScopes.java new file mode 100644 index 00000000..3305ea37 --- /dev/null +++ b/src/main/java/com/whop/api/types/AppValidScopes.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppValidScopes { + public static final AppValidScopes READ_USER = new AppValidScopes(Value.READ_USER, "read_user"); + + private final Value value; + + private final String string; + + AppValidScopes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AppValidScopes && this.string.equals(((AppValidScopes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case READ_USER: + return visitor.visitReadUser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppValidScopes valueOf(String value) { + switch (value) { + case "read_user": + return READ_USER; + default: + return new AppValidScopes(Value.UNKNOWN, value); + } + } + + public enum Value { + READ_USER, + + UNKNOWN + } + + public interface Visitor { + T visitReadUser(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AppViewTypes.java b/src/main/java/com/whop/api/types/AppViewTypes.java new file mode 100644 index 00000000..140de32f --- /dev/null +++ b/src/main/java/com/whop/api/types/AppViewTypes.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AppViewTypes { + public static final AppViewTypes DASHBOARD = new AppViewTypes(Value.DASHBOARD, "dashboard"); + + public static final AppViewTypes OPENAPI = new AppViewTypes(Value.OPENAPI, "openapi"); + + public static final AppViewTypes SKILLS = new AppViewTypes(Value.SKILLS, "skills"); + + public static final AppViewTypes ANALYTICS = new AppViewTypes(Value.ANALYTICS, "analytics"); + + public static final AppViewTypes DISCOVER = new AppViewTypes(Value.DISCOVER, "discover"); + + public static final AppViewTypes DASH = new AppViewTypes(Value.DASH, "dash"); + + public static final AppViewTypes HUB = new AppViewTypes(Value.HUB, "hub"); + + private final Value value; + + private final String string; + + AppViewTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof AppViewTypes && this.string.equals(((AppViewTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DASHBOARD: + return visitor.visitDashboard(); + case OPENAPI: + return visitor.visitOpenapi(); + case SKILLS: + return visitor.visitSkills(); + case ANALYTICS: + return visitor.visitAnalytics(); + case DISCOVER: + return visitor.visitDiscover(); + case DASH: + return visitor.visitDash(); + case HUB: + return visitor.visitHub(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AppViewTypes valueOf(String value) { + switch (value) { + case "dashboard": + return DASHBOARD; + case "openapi": + return OPENAPI; + case "skills": + return SKILLS; + case "analytics": + return ANALYTICS; + case "discover": + return DISCOVER; + case "dash": + return DASH; + case "hub": + return HUB; + default: + return new AppViewTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + HUB, + + DISCOVER, + + DASH, + + DASHBOARD, + + ANALYTICS, + + SKILLS, + + OPENAPI, + + UNKNOWN + } + + public interface Visitor { + T visitHub(); + + T visitDiscover(); + + T visitDash(); + + T visitDashboard(); + + T visitAnalytics(); + + T visitSkills(); + + T visitOpenapi(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Audience.java b/src/main/java/com/whop/api/types/Audience.java new file mode 100644 index 00000000..67a2405a --- /dev/null +++ b/src/main/java/com/whop/api/types/Audience.java @@ -0,0 +1,1083 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Audience.Builder.class) +public final class Audience { + private final AudienceAudienceType audienceType; + + private final boolean autoRefresh; + + private final String createdAt; + + private final Optional errorMessage; + + private final Optional> filters; + + private final String id; + + private final Optional lastRefreshedAt; + + private final Optional lookalikeRatio; + + private final Optional lookalikeStartingRatio; + + private final List matchRates; + + private final double matchedRows; + + private final String name; + + private final List platformAudienceIds; + + private final double processedRows; + + private final double progressPercent; + + private final Optional sourceAudienceId; + + private final AudienceSourceType sourceType; + + private final AudienceStatus status; + + private final double totalRows; + + private final String updatedAt; + + private final Map additionalProperties; + + private Audience( + AudienceAudienceType audienceType, + boolean autoRefresh, + String createdAt, + Optional errorMessage, + Optional> filters, + String id, + Optional lastRefreshedAt, + Optional lookalikeRatio, + Optional lookalikeStartingRatio, + List matchRates, + double matchedRows, + String name, + List platformAudienceIds, + double processedRows, + double progressPercent, + Optional sourceAudienceId, + AudienceSourceType sourceType, + AudienceStatus status, + double totalRows, + String updatedAt, + Map additionalProperties) { + this.audienceType = audienceType; + this.autoRefresh = autoRefresh; + this.createdAt = createdAt; + this.errorMessage = errorMessage; + this.filters = filters; + this.id = id; + this.lastRefreshedAt = lastRefreshedAt; + this.lookalikeRatio = lookalikeRatio; + this.lookalikeStartingRatio = lookalikeStartingRatio; + this.matchRates = matchRates; + this.matchedRows = matchedRows; + this.name = name; + this.platformAudienceIds = platformAudienceIds; + this.processedRows = processedRows; + this.progressPercent = progressPercent; + this.sourceAudienceId = sourceAudienceId; + this.sourceType = sourceType; + this.status = status; + this.totalRows = totalRows; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return custom = a customer list (uploaded, or built from saved People filters); lookalike = Meta lookalike built from a custom audience. + */ + @JsonProperty("audience_type") + public AudienceAudienceType getAudienceType() { + return audienceType; + } + + /** + * @return Whether membership keeps updating. true rebuilds it from the saved filters twice a day, so people join and leave as they start and stop matching. false keeps whoever matched when it was built and never rebuilds. Always false for uploaded lists and lookalikes. + */ + @JsonProperty("auto_refresh") + public boolean getAutoRefresh() { + return autoRefresh; + } + + /** + * @return When the audience was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Processing error message. null unless processing is partial or failed. + */ + @JsonIgnore + public Optional getErrorMessage() { + if (errorMessage == null) { + return Optional.empty(); + } + return errorMessage; + } + + /** + * @return For audiences built from People filters: the filters that define membership, keyed exactly as GET /people accepts them — for example {"os": "iOS", "country": "US"}. null for uploaded lists and lookalikes. + */ + @JsonIgnore + public Optional> getFilters() { + if (filters == null) { + return Optional.empty(); + } + return filters; + } + + /** + * @return Audience ID, prefixed adaud_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return When the audience membership was last rebuilt, as an ISO 8601 timestamp. null until the first build completes. + */ + @JsonIgnore + public Optional getLastRefreshedAt() { + if (lastRefreshedAt == null) { + return Optional.empty(); + } + return lastRefreshedAt; + } + + /** + * @return For lookalikes: the upper bound of the similarity band as a fraction (0.02 = top 2%). null for custom audiences. + */ + @JsonIgnore + public Optional getLookalikeRatio() { + if (lookalikeRatio == null) { + return Optional.empty(); + } + return lookalikeRatio; + } + + /** + * @return For lookalikes: the lower bound of the similarity band as a fraction. null for custom audiences and first-tier lookalikes. + */ + @JsonIgnore + public Optional getLookalikeStartingRatio() { + if (lookalikeStartingRatio == null) { + return Optional.empty(); + } + return lookalikeStartingRatio; + } + + @JsonProperty("match_rates") + public List getMatchRates() { + return matchRates; + } + + /** + * @return Members successfully uploaded to connected ad accounts. Always 0 for lookalikes. + */ + @JsonProperty("matched_rows") + public double getMatchedRows() { + return matchedRows; + } + + /** + * @return Audience display name. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("platform_audience_ids") + public List getPlatformAudienceIds() { + return platformAudienceIds; + } + + /** + * @return Members processed from the source so far. Always 0 for lookalikes. + */ + @JsonProperty("processed_rows") + public double getProcessedRows() { + return processedRows; + } + + /** + * @return Processing progress from 0 to 100. + */ + @JsonProperty("progress_percent") + public double getProgressPercent() { + return progressPercent; + } + + /** + * @return For lookalikes: the audience this lookalike was built from. null for custom audiences. + */ + @JsonIgnore + public Optional getSourceAudienceId() { + if (sourceAudienceId == null) { + return Optional.empty(); + } + return sourceAudienceId; + } + + /** + * @return Where members come from. csv_upload = an uploaded customer list; people_filter = built from saved People filters. See auto_refresh for whether a people_filter audience keeps updating. + */ + @JsonProperty("source_type") + public AudienceSourceType getSourceType() { + return sourceType; + } + + /** + * @return Current state of the audience import. syncing means Whop is sending matched rows to connected ad accounts. When status is partial or failed, error_message explains what went wrong. + */ + @JsonProperty("status") + public AudienceStatus getStatus() { + return status; + } + + /** + * @return Total members detected in the source — CSV rows for uploaded lists, matching people for automatic audiences. Always 0 for lookalikes. + */ + @JsonProperty("total_rows") + public double getTotalRows() { + return totalRows; + } + + /** + * @return When the audience was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("error_message") + private Optional _getErrorMessage() { + return errorMessage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filters") + private Optional> _getFilters() { + return filters; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_refreshed_at") + private Optional _getLastRefreshedAt() { + return lastRefreshedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("lookalike_ratio") + private Optional _getLookalikeRatio() { + return lookalikeRatio; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("lookalike_starting_ratio") + private Optional _getLookalikeStartingRatio() { + return lookalikeStartingRatio; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source_audience_id") + private Optional _getSourceAudienceId() { + return sourceAudienceId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Audience && equalTo((Audience) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Audience other) { + return audienceType.equals(other.audienceType) + && autoRefresh == other.autoRefresh + && createdAt.equals(other.createdAt) + && errorMessage.equals(other.errorMessage) + && filters.equals(other.filters) + && id.equals(other.id) + && lastRefreshedAt.equals(other.lastRefreshedAt) + && lookalikeRatio.equals(other.lookalikeRatio) + && lookalikeStartingRatio.equals(other.lookalikeStartingRatio) + && matchRates.equals(other.matchRates) + && matchedRows == other.matchedRows + && name.equals(other.name) + && platformAudienceIds.equals(other.platformAudienceIds) + && processedRows == other.processedRows + && progressPercent == other.progressPercent + && sourceAudienceId.equals(other.sourceAudienceId) + && sourceType.equals(other.sourceType) + && status.equals(other.status) + && totalRows == other.totalRows + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.audienceType, + this.autoRefresh, + this.createdAt, + this.errorMessage, + this.filters, + this.id, + this.lastRefreshedAt, + this.lookalikeRatio, + this.lookalikeStartingRatio, + this.matchRates, + this.matchedRows, + this.name, + this.platformAudienceIds, + this.processedRows, + this.progressPercent, + this.sourceAudienceId, + this.sourceType, + this.status, + this.totalRows, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AudienceTypeStage builder() { + return new Builder(); + } + + public interface AudienceTypeStage { + /** + *

custom = a customer list (uploaded, or built from saved People filters); lookalike = Meta lookalike built from a custom audience.

+ */ + AutoRefreshStage audienceType(@NotNull AudienceAudienceType audienceType); + + Builder from(Audience other); + } + + public interface AutoRefreshStage { + /** + *

Whether membership keeps updating. true rebuilds it from the saved filters twice a day, so people join and leave as they start and stop matching. false keeps whoever matched when it was built and never rebuilds. Always false for uploaded lists and lookalikes.

+ */ + CreatedAtStage autoRefresh(boolean autoRefresh); + } + + public interface CreatedAtStage { + /** + *

When the audience was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Audience ID, prefixed adaud_.

+ */ + MatchedRowsStage id(@NotNull String id); + } + + public interface MatchedRowsStage { + /** + *

Members successfully uploaded to connected ad accounts. Always 0 for lookalikes.

+ */ + NameStage matchedRows(double matchedRows); + } + + public interface NameStage { + /** + *

Audience display name.

+ */ + ProcessedRowsStage name(@NotNull String name); + } + + public interface ProcessedRowsStage { + /** + *

Members processed from the source so far. Always 0 for lookalikes.

+ */ + ProgressPercentStage processedRows(double processedRows); + } + + public interface ProgressPercentStage { + /** + *

Processing progress from 0 to 100.

+ */ + SourceTypeStage progressPercent(double progressPercent); + } + + public interface SourceTypeStage { + /** + *

Where members come from. csv_upload = an uploaded customer list; people_filter = built from saved People filters. See auto_refresh for whether a people_filter audience keeps updating.

+ */ + StatusStage sourceType(@NotNull AudienceSourceType sourceType); + } + + public interface StatusStage { + /** + *

Current state of the audience import. syncing means Whop is sending matched rows to connected ad accounts. When status is partial or failed, error_message explains what went wrong.

+ */ + TotalRowsStage status(@NotNull AudienceStatus status); + } + + public interface TotalRowsStage { + /** + *

Total members detected in the source — CSV rows for uploaded lists, matching people for automatic audiences. Always 0 for lookalikes.

+ */ + UpdatedAtStage totalRows(double totalRows); + } + + public interface UpdatedAtStage { + /** + *

When the audience was last updated, as an ISO 8601 timestamp.

+ */ + _FinalStage updatedAt(@NotNull String updatedAt); + } + + public interface _FinalStage { + Audience build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Processing error message. null unless processing is partial or failed.

+ */ + _FinalStage errorMessage(Optional errorMessage); + + _FinalStage errorMessage(String errorMessage); + + _FinalStage errorMessage(Nullable errorMessage); + + /** + *

For audiences built from People filters: the filters that define membership, keyed exactly as GET /people accepts them — for example {"os": "iOS", "country": "US"}. null for uploaded lists and lookalikes.

+ */ + _FinalStage filters(Optional> filters); + + _FinalStage filters(Map filters); + + _FinalStage filters(Nullable> filters); + + /** + *

When the audience membership was last rebuilt, as an ISO 8601 timestamp. null until the first build completes.

+ */ + _FinalStage lastRefreshedAt(Optional lastRefreshedAt); + + _FinalStage lastRefreshedAt(String lastRefreshedAt); + + _FinalStage lastRefreshedAt(Nullable lastRefreshedAt); + + /** + *

For lookalikes: the upper bound of the similarity band as a fraction (0.02 = top 2%). null for custom audiences.

+ */ + _FinalStage lookalikeRatio(Optional lookalikeRatio); + + _FinalStage lookalikeRatio(Double lookalikeRatio); + + _FinalStage lookalikeRatio(Nullable lookalikeRatio); + + /** + *

For lookalikes: the lower bound of the similarity band as a fraction. null for custom audiences and first-tier lookalikes.

+ */ + _FinalStage lookalikeStartingRatio(Optional lookalikeStartingRatio); + + _FinalStage lookalikeStartingRatio(Double lookalikeStartingRatio); + + _FinalStage lookalikeStartingRatio(Nullable lookalikeStartingRatio); + + _FinalStage matchRates(List matchRates); + + _FinalStage addMatchRates(AudienceMatchRate matchRates); + + _FinalStage addAllMatchRates(List matchRates); + + _FinalStage platformAudienceIds(List platformAudienceIds); + + _FinalStage addPlatformAudienceIds(String platformAudienceIds); + + _FinalStage addAllPlatformAudienceIds(List platformAudienceIds); + + /** + *

For lookalikes: the audience this lookalike was built from. null for custom audiences.

+ */ + _FinalStage sourceAudienceId(Optional sourceAudienceId); + + _FinalStage sourceAudienceId(String sourceAudienceId); + + _FinalStage sourceAudienceId(Nullable sourceAudienceId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AudienceTypeStage, + AutoRefreshStage, + CreatedAtStage, + IdStage, + MatchedRowsStage, + NameStage, + ProcessedRowsStage, + ProgressPercentStage, + SourceTypeStage, + StatusStage, + TotalRowsStage, + UpdatedAtStage, + _FinalStage { + private AudienceAudienceType audienceType; + + private boolean autoRefresh; + + private String createdAt; + + private String id; + + private double matchedRows; + + private String name; + + private double processedRows; + + private double progressPercent; + + private AudienceSourceType sourceType; + + private AudienceStatus status; + + private double totalRows; + + private String updatedAt; + + private Optional sourceAudienceId = Optional.empty(); + + private List platformAudienceIds = new ArrayList<>(); + + private List matchRates = new ArrayList<>(); + + private Optional lookalikeStartingRatio = Optional.empty(); + + private Optional lookalikeRatio = Optional.empty(); + + private Optional lastRefreshedAt = Optional.empty(); + + private Optional> filters = Optional.empty(); + + private Optional errorMessage = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Audience other) { + audienceType(other.getAudienceType()); + autoRefresh(other.getAutoRefresh()); + createdAt(other.getCreatedAt()); + errorMessage(other.getErrorMessage()); + filters(other.getFilters()); + id(other.getId()); + lastRefreshedAt(other.getLastRefreshedAt()); + lookalikeRatio(other.getLookalikeRatio()); + lookalikeStartingRatio(other.getLookalikeStartingRatio()); + matchRates(other.getMatchRates()); + matchedRows(other.getMatchedRows()); + name(other.getName()); + platformAudienceIds(other.getPlatformAudienceIds()); + processedRows(other.getProcessedRows()); + progressPercent(other.getProgressPercent()); + sourceAudienceId(other.getSourceAudienceId()); + sourceType(other.getSourceType()); + status(other.getStatus()); + totalRows(other.getTotalRows()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

custom = a customer list (uploaded, or built from saved People filters); lookalike = Meta lookalike built from a custom audience.

+ *

custom = a customer list (uploaded, or built from saved People filters); lookalike = Meta lookalike built from a custom audience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("audience_type") + public AutoRefreshStage audienceType(@NotNull AudienceAudienceType audienceType) { + this.audienceType = Objects.requireNonNull(audienceType, "audienceType must not be null"); + return this; + } + + /** + *

Whether membership keeps updating. true rebuilds it from the saved filters twice a day, so people join and leave as they start and stop matching. false keeps whoever matched when it was built and never rebuilds. Always false for uploaded lists and lookalikes.

+ *

Whether membership keeps updating. true rebuilds it from the saved filters twice a day, so people join and leave as they start and stop matching. false keeps whoever matched when it was built and never rebuilds. Always false for uploaded lists and lookalikes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("auto_refresh") + public CreatedAtStage autoRefresh(boolean autoRefresh) { + this.autoRefresh = autoRefresh; + return this; + } + + /** + *

When the audience was created, as an ISO 8601 timestamp.

+ *

When the audience was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Audience ID, prefixed adaud_.

+ *

Audience ID, prefixed adaud_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MatchedRowsStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Members successfully uploaded to connected ad accounts. Always 0 for lookalikes.

+ *

Members successfully uploaded to connected ad accounts. Always 0 for lookalikes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("matched_rows") + public NameStage matchedRows(double matchedRows) { + this.matchedRows = matchedRows; + return this; + } + + /** + *

Audience display name.

+ *

Audience display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public ProcessedRowsStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

Members processed from the source so far. Always 0 for lookalikes.

+ *

Members processed from the source so far. Always 0 for lookalikes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("processed_rows") + public ProgressPercentStage processedRows(double processedRows) { + this.processedRows = processedRows; + return this; + } + + /** + *

Processing progress from 0 to 100.

+ *

Processing progress from 0 to 100.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("progress_percent") + public SourceTypeStage progressPercent(double progressPercent) { + this.progressPercent = progressPercent; + return this; + } + + /** + *

Where members come from. csv_upload = an uploaded customer list; people_filter = built from saved People filters. See auto_refresh for whether a people_filter audience keeps updating.

+ *

Where members come from. csv_upload = an uploaded customer list; people_filter = built from saved People filters. See auto_refresh for whether a people_filter audience keeps updating.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("source_type") + public StatusStage sourceType(@NotNull AudienceSourceType sourceType) { + this.sourceType = Objects.requireNonNull(sourceType, "sourceType must not be null"); + return this; + } + + /** + *

Current state of the audience import. syncing means Whop is sending matched rows to connected ad accounts. When status is partial or failed, error_message explains what went wrong.

+ *

Current state of the audience import. syncing means Whop is sending matched rows to connected ad accounts. When status is partial or failed, error_message explains what went wrong.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TotalRowsStage status(@NotNull AudienceStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Total members detected in the source — CSV rows for uploaded lists, matching people for automatic audiences. Always 0 for lookalikes.

+ *

Total members detected in the source — CSV rows for uploaded lists, matching people for automatic audiences. Always 0 for lookalikes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_rows") + public UpdatedAtStage totalRows(double totalRows) { + this.totalRows = totalRows; + return this; + } + + /** + *

When the audience was last updated, as an ISO 8601 timestamp.

+ *

When the audience was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

For lookalikes: the audience this lookalike was built from. null for custom audiences.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sourceAudienceId(Nullable sourceAudienceId) { + if (sourceAudienceId.isNull()) { + this.sourceAudienceId = null; + } else if (sourceAudienceId.isEmpty()) { + this.sourceAudienceId = Optional.empty(); + } else { + this.sourceAudienceId = Optional.of(sourceAudienceId.get()); + } + return this; + } + + /** + *

For lookalikes: the audience this lookalike was built from. null for custom audiences.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sourceAudienceId(String sourceAudienceId) { + this.sourceAudienceId = Optional.ofNullable(sourceAudienceId); + return this; + } + + /** + *

For lookalikes: the audience this lookalike was built from. null for custom audiences.

+ */ + @java.lang.Override + @JsonSetter(value = "source_audience_id", nulls = Nulls.SKIP) + public _FinalStage sourceAudienceId(Optional sourceAudienceId) { + this.sourceAudienceId = sourceAudienceId; + return this; + } + + @java.lang.Override + public _FinalStage addAllPlatformAudienceIds(List platformAudienceIds) { + if (platformAudienceIds != null) { + this.platformAudienceIds.addAll(platformAudienceIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addPlatformAudienceIds(String platformAudienceIds) { + this.platformAudienceIds.add(platformAudienceIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "platform_audience_ids", nulls = Nulls.SKIP) + public _FinalStage platformAudienceIds(List platformAudienceIds) { + this.platformAudienceIds.clear(); + if (platformAudienceIds != null) { + this.platformAudienceIds.addAll(platformAudienceIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllMatchRates(List matchRates) { + if (matchRates != null) { + this.matchRates.addAll(matchRates); + } + return this; + } + + @java.lang.Override + public _FinalStage addMatchRates(AudienceMatchRate matchRates) { + this.matchRates.add(matchRates); + return this; + } + + @java.lang.Override + @JsonSetter(value = "match_rates", nulls = Nulls.SKIP) + public _FinalStage matchRates(List matchRates) { + this.matchRates.clear(); + if (matchRates != null) { + this.matchRates.addAll(matchRates); + } + return this; + } + + /** + *

For lookalikes: the lower bound of the similarity band as a fraction. null for custom audiences and first-tier lookalikes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lookalikeStartingRatio(Nullable lookalikeStartingRatio) { + if (lookalikeStartingRatio.isNull()) { + this.lookalikeStartingRatio = null; + } else if (lookalikeStartingRatio.isEmpty()) { + this.lookalikeStartingRatio = Optional.empty(); + } else { + this.lookalikeStartingRatio = Optional.of(lookalikeStartingRatio.get()); + } + return this; + } + + /** + *

For lookalikes: the lower bound of the similarity band as a fraction. null for custom audiences and first-tier lookalikes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lookalikeStartingRatio(Double lookalikeStartingRatio) { + this.lookalikeStartingRatio = Optional.ofNullable(lookalikeStartingRatio); + return this; + } + + /** + *

For lookalikes: the lower bound of the similarity band as a fraction. null for custom audiences and first-tier lookalikes.

+ */ + @java.lang.Override + @JsonSetter(value = "lookalike_starting_ratio", nulls = Nulls.SKIP) + public _FinalStage lookalikeStartingRatio(Optional lookalikeStartingRatio) { + this.lookalikeStartingRatio = lookalikeStartingRatio; + return this; + } + + /** + *

For lookalikes: the upper bound of the similarity band as a fraction (0.02 = top 2%). null for custom audiences.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lookalikeRatio(Nullable lookalikeRatio) { + if (lookalikeRatio.isNull()) { + this.lookalikeRatio = null; + } else if (lookalikeRatio.isEmpty()) { + this.lookalikeRatio = Optional.empty(); + } else { + this.lookalikeRatio = Optional.of(lookalikeRatio.get()); + } + return this; + } + + /** + *

For lookalikes: the upper bound of the similarity band as a fraction (0.02 = top 2%). null for custom audiences.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lookalikeRatio(Double lookalikeRatio) { + this.lookalikeRatio = Optional.ofNullable(lookalikeRatio); + return this; + } + + /** + *

For lookalikes: the upper bound of the similarity band as a fraction (0.02 = top 2%). null for custom audiences.

+ */ + @java.lang.Override + @JsonSetter(value = "lookalike_ratio", nulls = Nulls.SKIP) + public _FinalStage lookalikeRatio(Optional lookalikeRatio) { + this.lookalikeRatio = lookalikeRatio; + return this; + } + + /** + *

When the audience membership was last rebuilt, as an ISO 8601 timestamp. null until the first build completes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastRefreshedAt(Nullable lastRefreshedAt) { + if (lastRefreshedAt.isNull()) { + this.lastRefreshedAt = null; + } else if (lastRefreshedAt.isEmpty()) { + this.lastRefreshedAt = Optional.empty(); + } else { + this.lastRefreshedAt = Optional.of(lastRefreshedAt.get()); + } + return this; + } + + /** + *

When the audience membership was last rebuilt, as an ISO 8601 timestamp. null until the first build completes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastRefreshedAt(String lastRefreshedAt) { + this.lastRefreshedAt = Optional.ofNullable(lastRefreshedAt); + return this; + } + + /** + *

When the audience membership was last rebuilt, as an ISO 8601 timestamp. null until the first build completes.

+ */ + @java.lang.Override + @JsonSetter(value = "last_refreshed_at", nulls = Nulls.SKIP) + public _FinalStage lastRefreshedAt(Optional lastRefreshedAt) { + this.lastRefreshedAt = lastRefreshedAt; + return this; + } + + /** + *

For audiences built from People filters: the filters that define membership, keyed exactly as GET /people accepts them — for example {"os": "iOS", "country": "US"}. null for uploaded lists and lookalikes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filters(Nullable> filters) { + if (filters.isNull()) { + this.filters = null; + } else if (filters.isEmpty()) { + this.filters = Optional.empty(); + } else { + this.filters = Optional.of(filters.get()); + } + return this; + } + + /** + *

For audiences built from People filters: the filters that define membership, keyed exactly as GET /people accepts them — for example {"os": "iOS", "country": "US"}. null for uploaded lists and lookalikes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filters(Map filters) { + this.filters = Optional.ofNullable(filters); + return this; + } + + /** + *

For audiences built from People filters: the filters that define membership, keyed exactly as GET /people accepts them — for example {"os": "iOS", "country": "US"}. null for uploaded lists and lookalikes.

+ */ + @java.lang.Override + @JsonSetter(value = "filters", nulls = Nulls.SKIP) + public _FinalStage filters(Optional> filters) { + this.filters = filters; + return this; + } + + /** + *

Processing error message. null unless processing is partial or failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorMessage(Nullable errorMessage) { + if (errorMessage.isNull()) { + this.errorMessage = null; + } else if (errorMessage.isEmpty()) { + this.errorMessage = Optional.empty(); + } else { + this.errorMessage = Optional.of(errorMessage.get()); + } + return this; + } + + /** + *

Processing error message. null unless processing is partial or failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorMessage(String errorMessage) { + this.errorMessage = Optional.ofNullable(errorMessage); + return this; + } + + /** + *

Processing error message. null unless processing is partial or failed.

+ */ + @java.lang.Override + @JsonSetter(value = "error_message", nulls = Nulls.SKIP) + public _FinalStage errorMessage(Optional errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + @java.lang.Override + public Audience build() { + return new Audience( + audienceType, + autoRefresh, + createdAt, + errorMessage, + filters, + id, + lastRefreshedAt, + lookalikeRatio, + lookalikeStartingRatio, + matchRates, + matchedRows, + name, + platformAudienceIds, + processedRows, + progressPercent, + sourceAudienceId, + sourceType, + status, + totalRows, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AudienceAudienceType.java b/src/main/java/com/whop/api/types/AudienceAudienceType.java new file mode 100644 index 00000000..aa9255c4 --- /dev/null +++ b/src/main/java/com/whop/api/types/AudienceAudienceType.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AudienceAudienceType { + public static final AudienceAudienceType CUSTOM = new AudienceAudienceType(Value.CUSTOM, "custom"); + + public static final AudienceAudienceType LOOKALIKE = new AudienceAudienceType(Value.LOOKALIKE, "lookalike"); + + private final Value value; + + private final String string; + + AudienceAudienceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AudienceAudienceType && this.string.equals(((AudienceAudienceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CUSTOM: + return visitor.visitCustom(); + case LOOKALIKE: + return visitor.visitLookalike(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AudienceAudienceType valueOf(String value) { + switch (value) { + case "custom": + return CUSTOM; + case "lookalike": + return LOOKALIKE; + default: + return new AudienceAudienceType(Value.UNKNOWN, value); + } + } + + public enum Value { + CUSTOM, + + LOOKALIKE, + + UNKNOWN + } + + public interface Visitor { + T visitCustom(); + + T visitLookalike(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AudienceMatchRate.java b/src/main/java/com/whop/api/types/AudienceMatchRate.java new file mode 100644 index 00000000..276892aa --- /dev/null +++ b/src/main/java/com/whop/api/types/AudienceMatchRate.java @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AudienceMatchRate.Builder.class) +public final class AudienceMatchRate { + private final Optional lowerBound; + + private final AudienceMatchRatePlatform platform; + + private final Optional status; + + private final Optional upperBound; + + private final Map additionalProperties; + + private AudienceMatchRate( + Optional lowerBound, + AudienceMatchRatePlatform platform, + Optional status, + Optional upperBound, + Map additionalProperties) { + this.lowerBound = lowerBound; + this.platform = platform; + this.status = status; + this.upperBound = upperBound; + this.additionalProperties = additionalProperties; + } + + /** + * @return Lower bound of the estimated match rate percentage. null until available. + */ + @JsonIgnore + public Optional getLowerBound() { + if (lowerBound == null) { + return Optional.empty(); + } + return lowerBound; + } + + /** + * @return The ad platform that provided the match-rate estimate. + */ + @JsonProperty("platform") + public AudienceMatchRatePlatform getPlatform() { + return platform; + } + + /** + * @return Availability of the estimated match rate. + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return Upper bound of the estimated match rate percentage. null until available. + */ + @JsonIgnore + public Optional getUpperBound() { + if (upperBound == null) { + return Optional.empty(); + } + return upperBound; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("lower_bound") + private Optional _getLowerBound() { + return lowerBound; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("upper_bound") + private Optional _getUpperBound() { + return upperBound; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AudienceMatchRate && equalTo((AudienceMatchRate) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AudienceMatchRate other) { + return lowerBound.equals(other.lowerBound) + && platform.equals(other.platform) + && status.equals(other.status) + && upperBound.equals(other.upperBound); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.lowerBound, this.platform, this.status, this.upperBound); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlatformStage builder() { + return new Builder(); + } + + public interface PlatformStage { + /** + *

The ad platform that provided the match-rate estimate.

+ */ + _FinalStage platform(@NotNull AudienceMatchRatePlatform platform); + + Builder from(AudienceMatchRate other); + } + + public interface _FinalStage { + AudienceMatchRate build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Lower bound of the estimated match rate percentage. null until available.

+ */ + _FinalStage lowerBound(Optional lowerBound); + + _FinalStage lowerBound(Double lowerBound); + + _FinalStage lowerBound(Nullable lowerBound); + + /** + *

Availability of the estimated match rate.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(AudienceMatchRateStatus status); + + _FinalStage status(Nullable status); + + /** + *

Upper bound of the estimated match rate percentage. null until available.

+ */ + _FinalStage upperBound(Optional upperBound); + + _FinalStage upperBound(Double upperBound); + + _FinalStage upperBound(Nullable upperBound); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlatformStage, _FinalStage { + private AudienceMatchRatePlatform platform; + + private Optional upperBound = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional lowerBound = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AudienceMatchRate other) { + lowerBound(other.getLowerBound()); + platform(other.getPlatform()); + status(other.getStatus()); + upperBound(other.getUpperBound()); + return this; + } + + /** + *

The ad platform that provided the match-rate estimate.

+ *

The ad platform that provided the match-rate estimate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public _FinalStage platform(@NotNull AudienceMatchRatePlatform platform) { + this.platform = Objects.requireNonNull(platform, "platform must not be null"); + return this; + } + + /** + *

Upper bound of the estimated match rate percentage. null until available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage upperBound(Nullable upperBound) { + if (upperBound.isNull()) { + this.upperBound = null; + } else if (upperBound.isEmpty()) { + this.upperBound = Optional.empty(); + } else { + this.upperBound = Optional.of(upperBound.get()); + } + return this; + } + + /** + *

Upper bound of the estimated match rate percentage. null until available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage upperBound(Double upperBound) { + this.upperBound = Optional.ofNullable(upperBound); + return this; + } + + /** + *

Upper bound of the estimated match rate percentage. null until available.

+ */ + @java.lang.Override + @JsonSetter(value = "upper_bound", nulls = Nulls.SKIP) + public _FinalStage upperBound(Optional upperBound) { + this.upperBound = upperBound; + return this; + } + + /** + *

Availability of the estimated match rate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

Availability of the estimated match rate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(AudienceMatchRateStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Availability of the estimated match rate.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

Lower bound of the estimated match rate percentage. null until available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lowerBound(Nullable lowerBound) { + if (lowerBound.isNull()) { + this.lowerBound = null; + } else if (lowerBound.isEmpty()) { + this.lowerBound = Optional.empty(); + } else { + this.lowerBound = Optional.of(lowerBound.get()); + } + return this; + } + + /** + *

Lower bound of the estimated match rate percentage. null until available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lowerBound(Double lowerBound) { + this.lowerBound = Optional.ofNullable(lowerBound); + return this; + } + + /** + *

Lower bound of the estimated match rate percentage. null until available.

+ */ + @java.lang.Override + @JsonSetter(value = "lower_bound", nulls = Nulls.SKIP) + public _FinalStage lowerBound(Optional lowerBound) { + this.lowerBound = lowerBound; + return this; + } + + @java.lang.Override + public AudienceMatchRate build() { + return new AudienceMatchRate(lowerBound, platform, status, upperBound, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AudienceMatchRatePlatform.java b/src/main/java/com/whop/api/types/AudienceMatchRatePlatform.java new file mode 100644 index 00000000..a55a9371 --- /dev/null +++ b/src/main/java/com/whop/api/types/AudienceMatchRatePlatform.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AudienceMatchRatePlatform { + public static final AudienceMatchRatePlatform META = new AudienceMatchRatePlatform(Value.META, "meta"); + + private final Value value; + + private final String string; + + AudienceMatchRatePlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AudienceMatchRatePlatform + && this.string.equals(((AudienceMatchRatePlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case META: + return visitor.visitMeta(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AudienceMatchRatePlatform valueOf(String value) { + switch (value) { + case "meta": + return META; + default: + return new AudienceMatchRatePlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + META, + + UNKNOWN + } + + public interface Visitor { + T visitMeta(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AudienceMatchRateStatus.java b/src/main/java/com/whop/api/types/AudienceMatchRateStatus.java new file mode 100644 index 00000000..2ba52455 --- /dev/null +++ b/src/main/java/com/whop/api/types/AudienceMatchRateStatus.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AudienceMatchRateStatus { + public static final AudienceMatchRateStatus CALCULATING = + new AudienceMatchRateStatus(Value.CALCULATING, "calculating"); + + public static final AudienceMatchRateStatus AVAILABLE = new AudienceMatchRateStatus(Value.AVAILABLE, "available"); + + public static final AudienceMatchRateStatus UNAVAILABLE = + new AudienceMatchRateStatus(Value.UNAVAILABLE, "unavailable"); + + private final Value value; + + private final String string; + + AudienceMatchRateStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AudienceMatchRateStatus + && this.string.equals(((AudienceMatchRateStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CALCULATING: + return visitor.visitCalculating(); + case AVAILABLE: + return visitor.visitAvailable(); + case UNAVAILABLE: + return visitor.visitUnavailable(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AudienceMatchRateStatus valueOf(String value) { + switch (value) { + case "calculating": + return CALCULATING; + case "available": + return AVAILABLE; + case "unavailable": + return UNAVAILABLE; + default: + return new AudienceMatchRateStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + CALCULATING, + + AVAILABLE, + + UNAVAILABLE, + + UNKNOWN + } + + public interface Visitor { + T visitCalculating(); + + T visitAvailable(); + + T visitUnavailable(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AudienceSourceType.java b/src/main/java/com/whop/api/types/AudienceSourceType.java new file mode 100644 index 00000000..c46443d8 --- /dev/null +++ b/src/main/java/com/whop/api/types/AudienceSourceType.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AudienceSourceType { + public static final AudienceSourceType CSV_UPLOAD = new AudienceSourceType(Value.CSV_UPLOAD, "csv_upload"); + + public static final AudienceSourceType PEOPLE_FILTER = new AudienceSourceType(Value.PEOPLE_FILTER, "people_filter"); + + private final Value value; + + private final String string; + + AudienceSourceType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AudienceSourceType && this.string.equals(((AudienceSourceType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CSV_UPLOAD: + return visitor.visitCsvUpload(); + case PEOPLE_FILTER: + return visitor.visitPeopleFilter(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AudienceSourceType valueOf(String value) { + switch (value) { + case "csv_upload": + return CSV_UPLOAD; + case "people_filter": + return PEOPLE_FILTER; + default: + return new AudienceSourceType(Value.UNKNOWN, value); + } + } + + public enum Value { + CSV_UPLOAD, + + PEOPLE_FILTER, + + UNKNOWN + } + + public interface Visitor { + T visitCsvUpload(); + + T visitPeopleFilter(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AudienceStatus.java b/src/main/java/com/whop/api/types/AudienceStatus.java new file mode 100644 index 00000000..0e0aceb0 --- /dev/null +++ b/src/main/java/com/whop/api/types/AudienceStatus.java @@ -0,0 +1,123 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AudienceStatus { + public static final AudienceStatus FAILED = new AudienceStatus(Value.FAILED, "failed"); + + public static final AudienceStatus PARTIAL = new AudienceStatus(Value.PARTIAL, "partial"); + + public static final AudienceStatus PENDING = new AudienceStatus(Value.PENDING, "pending"); + + public static final AudienceStatus PROCESSING = new AudienceStatus(Value.PROCESSING, "processing"); + + public static final AudienceStatus READY = new AudienceStatus(Value.READY, "ready"); + + public static final AudienceStatus SYNCING = new AudienceStatus(Value.SYNCING, "syncing"); + + private final Value value; + + private final String string; + + AudienceStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AudienceStatus && this.string.equals(((AudienceStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case PARTIAL: + return visitor.visitPartial(); + case PENDING: + return visitor.visitPending(); + case PROCESSING: + return visitor.visitProcessing(); + case READY: + return visitor.visitReady(); + case SYNCING: + return visitor.visitSyncing(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AudienceStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "partial": + return PARTIAL; + case "pending": + return PENDING; + case "processing": + return PROCESSING; + case "ready": + return READY; + case "syncing": + return SYNCING; + default: + return new AudienceStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + PROCESSING, + + SYNCING, + + READY, + + PARTIAL, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitProcessing(); + + T visitSyncing(); + + T visitReady(); + + T visitPartial(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AuthorizedUser.java b/src/main/java/com/whop/api/types/AuthorizedUser.java new file mode 100644 index 00000000..003e84f4 --- /dev/null +++ b/src/main/java/com/whop/api/types/AuthorizedUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AuthorizedUser.Builder.class) +public final class AuthorizedUser { + private final AuthorizedUserCompany company; + + private final String id; + + private final AuthorizedUserRoles role; + + private final AuthorizedUserUser user; + + private final Map additionalProperties; + + private AuthorizedUser( + AuthorizedUserCompany company, + String id, + AuthorizedUserRoles role, + AuthorizedUserUser user, + Map additionalProperties) { + this.company = company; + this.id = id; + this.role = role; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The company this authorized user has access to. + */ + @JsonProperty("company") + public AuthorizedUserCompany getCompany() { + return company; + } + + /** + * @return The unique identifier for the authorized user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The permission role assigned to this authorized user within the company. + */ + @JsonProperty("role") + public AuthorizedUserRoles getRole() { + return role; + } + + /** + * @return The user account linked to this authorized user record. + */ + @JsonProperty("user") + public AuthorizedUserUser getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AuthorizedUser && equalTo((AuthorizedUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AuthorizedUser other) { + return company.equals(other.company) + && id.equals(other.id) + && role.equals(other.role) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.company, this.id, this.role, this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyStage builder() { + return new Builder(); + } + + public interface CompanyStage { + /** + *

The company this authorized user has access to.

+ */ + IdStage company(@NotNull AuthorizedUserCompany company); + + Builder from(AuthorizedUser other); + } + + public interface IdStage { + /** + *

The unique identifier for the authorized user.

+ */ + RoleStage id(@NotNull String id); + } + + public interface RoleStage { + /** + *

The permission role assigned to this authorized user within the company.

+ */ + UserStage role(@NotNull AuthorizedUserRoles role); + } + + public interface UserStage { + /** + *

The user account linked to this authorized user record.

+ */ + _FinalStage user(@NotNull AuthorizedUserUser user); + } + + public interface _FinalStage { + AuthorizedUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyStage, IdStage, RoleStage, UserStage, _FinalStage { + private AuthorizedUserCompany company; + + private String id; + + private AuthorizedUserRoles role; + + private AuthorizedUserUser user; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AuthorizedUser other) { + company(other.getCompany()); + id(other.getId()); + role(other.getRole()); + user(other.getUser()); + return this; + } + + /** + *

The company this authorized user has access to.

+ *

The company this authorized user has access to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company") + public IdStage company(@NotNull AuthorizedUserCompany company) { + this.company = Objects.requireNonNull(company, "company must not be null"); + return this; + } + + /** + *

The unique identifier for the authorized user.

+ *

The unique identifier for the authorized user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RoleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The permission role assigned to this authorized user within the company.

+ *

The permission role assigned to this authorized user within the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("role") + public UserStage role(@NotNull AuthorizedUserRoles role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + /** + *

The user account linked to this authorized user record.

+ *

The user account linked to this authorized user record.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull AuthorizedUserUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + @java.lang.Override + public AuthorizedUser build() { + return new AuthorizedUser(company, id, role, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AuthorizedUserCompany.java b/src/main/java/com/whop/api/types/AuthorizedUserCompany.java new file mode 100644 index 00000000..380b132a --- /dev/null +++ b/src/main/java/com/whop/api/types/AuthorizedUserCompany.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AuthorizedUserCompany.Builder.class) +public final class AuthorizedUserCompany { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private AuthorizedUserCompany(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AuthorizedUserCompany && equalTo((AuthorizedUserCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AuthorizedUserCompany other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + TitleStage id(@NotNull String id); + + Builder from(AuthorizedUserCompany other); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + AuthorizedUserCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AuthorizedUserCompany other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public AuthorizedUserCompany build() { + return new AuthorizedUserCompany(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AuthorizedUserListItem.java b/src/main/java/com/whop/api/types/AuthorizedUserListItem.java new file mode 100644 index 00000000..ea3ea4d3 --- /dev/null +++ b/src/main/java/com/whop/api/types/AuthorizedUserListItem.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AuthorizedUserListItem.Builder.class) +public final class AuthorizedUserListItem { + private final AuthorizedUserListItemCompany company; + + private final String id; + + private final AuthorizedUserRoles role; + + private final AuthorizedUserListItemUser user; + + private final Map additionalProperties; + + private AuthorizedUserListItem( + AuthorizedUserListItemCompany company, + String id, + AuthorizedUserRoles role, + AuthorizedUserListItemUser user, + Map additionalProperties) { + this.company = company; + this.id = id; + this.role = role; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The company this authorized user has access to. + */ + @JsonProperty("company") + public AuthorizedUserListItemCompany getCompany() { + return company; + } + + /** + * @return The unique identifier for the authorized user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The permission role assigned to this authorized user within the company. + */ + @JsonProperty("role") + public AuthorizedUserRoles getRole() { + return role; + } + + /** + * @return The user account linked to this authorized user record. + */ + @JsonProperty("user") + public AuthorizedUserListItemUser getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AuthorizedUserListItem && equalTo((AuthorizedUserListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AuthorizedUserListItem other) { + return company.equals(other.company) + && id.equals(other.id) + && role.equals(other.role) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.company, this.id, this.role, this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyStage builder() { + return new Builder(); + } + + public interface CompanyStage { + /** + *

The company this authorized user has access to.

+ */ + IdStage company(@NotNull AuthorizedUserListItemCompany company); + + Builder from(AuthorizedUserListItem other); + } + + public interface IdStage { + /** + *

The unique identifier for the authorized user.

+ */ + RoleStage id(@NotNull String id); + } + + public interface RoleStage { + /** + *

The permission role assigned to this authorized user within the company.

+ */ + UserStage role(@NotNull AuthorizedUserRoles role); + } + + public interface UserStage { + /** + *

The user account linked to this authorized user record.

+ */ + _FinalStage user(@NotNull AuthorizedUserListItemUser user); + } + + public interface _FinalStage { + AuthorizedUserListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyStage, IdStage, RoleStage, UserStage, _FinalStage { + private AuthorizedUserListItemCompany company; + + private String id; + + private AuthorizedUserRoles role; + + private AuthorizedUserListItemUser user; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AuthorizedUserListItem other) { + company(other.getCompany()); + id(other.getId()); + role(other.getRole()); + user(other.getUser()); + return this; + } + + /** + *

The company this authorized user has access to.

+ *

The company this authorized user has access to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company") + public IdStage company(@NotNull AuthorizedUserListItemCompany company) { + this.company = Objects.requireNonNull(company, "company must not be null"); + return this; + } + + /** + *

The unique identifier for the authorized user.

+ *

The unique identifier for the authorized user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RoleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The permission role assigned to this authorized user within the company.

+ *

The permission role assigned to this authorized user within the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("role") + public UserStage role(@NotNull AuthorizedUserRoles role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + /** + *

The user account linked to this authorized user record.

+ *

The user account linked to this authorized user record.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull AuthorizedUserListItemUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + @java.lang.Override + public AuthorizedUserListItem build() { + return new AuthorizedUserListItem(company, id, role, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AuthorizedUserListItemCompany.java b/src/main/java/com/whop/api/types/AuthorizedUserListItemCompany.java new file mode 100644 index 00000000..285de66a --- /dev/null +++ b/src/main/java/com/whop/api/types/AuthorizedUserListItemCompany.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AuthorizedUserListItemCompany.Builder.class) +public final class AuthorizedUserListItemCompany { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private AuthorizedUserListItemCompany(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AuthorizedUserListItemCompany && equalTo((AuthorizedUserListItemCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AuthorizedUserListItemCompany other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + TitleStage id(@NotNull String id); + + Builder from(AuthorizedUserListItemCompany other); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + AuthorizedUserListItemCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AuthorizedUserListItemCompany other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public AuthorizedUserListItemCompany build() { + return new AuthorizedUserListItemCompany(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AuthorizedUserListItemUser.java b/src/main/java/com/whop/api/types/AuthorizedUserListItemUser.java new file mode 100644 index 00000000..15d870f5 --- /dev/null +++ b/src/main/java/com/whop/api/types/AuthorizedUserListItemUser.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AuthorizedUserListItemUser.Builder.class) +public final class AuthorizedUserListItemUser { + private final Optional email; + + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private AuthorizedUserListItemUser( + Optional email, + String id, + Optional name, + String username, + Map additionalProperties) { + this.email = email; + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's email address. Requires the member:email:read permission to access. Null if not authorized. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AuthorizedUserListItemUser && equalTo((AuthorizedUserListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AuthorizedUserListItemUser other) { + return email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(AuthorizedUserListItemUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + AuthorizedUserListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AuthorizedUserListItemUser other) { + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public AuthorizedUserListItemUser build() { + return new AuthorizedUserListItemUser(email, id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/AuthorizedUserRoles.java b/src/main/java/com/whop/api/types/AuthorizedUserRoles.java new file mode 100644 index 00000000..bb2632f3 --- /dev/null +++ b/src/main/java/com/whop/api/types/AuthorizedUserRoles.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AuthorizedUserRoles { + public static final AuthorizedUserRoles APP_MANAGER = new AuthorizedUserRoles(Value.APP_MANAGER, "app_manager"); + + public static final AuthorizedUserRoles OWNER = new AuthorizedUserRoles(Value.OWNER, "owner"); + + public static final AuthorizedUserRoles WORKFORCE = new AuthorizedUserRoles(Value.WORKFORCE, "workforce"); + + public static final AuthorizedUserRoles ADMIN = new AuthorizedUserRoles(Value.ADMIN, "admin"); + + public static final AuthorizedUserRoles SUPPORT = new AuthorizedUserRoles(Value.SUPPORT, "support"); + + public static final AuthorizedUserRoles CUSTOM = new AuthorizedUserRoles(Value.CUSTOM, "custom"); + + public static final AuthorizedUserRoles SALES_MANAGER = + new AuthorizedUserRoles(Value.SALES_MANAGER, "sales_manager"); + + public static final AuthorizedUserRoles MANAGER = new AuthorizedUserRoles(Value.MANAGER, "manager"); + + public static final AuthorizedUserRoles MODERATOR = new AuthorizedUserRoles(Value.MODERATOR, "moderator"); + + public static final AuthorizedUserRoles ADVERTISER = new AuthorizedUserRoles(Value.ADVERTISER, "advertiser"); + + private final Value value; + + private final String string; + + AuthorizedUserRoles(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AuthorizedUserRoles && this.string.equals(((AuthorizedUserRoles) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APP_MANAGER: + return visitor.visitAppManager(); + case OWNER: + return visitor.visitOwner(); + case WORKFORCE: + return visitor.visitWorkforce(); + case ADMIN: + return visitor.visitAdmin(); + case SUPPORT: + return visitor.visitSupport(); + case CUSTOM: + return visitor.visitCustom(); + case SALES_MANAGER: + return visitor.visitSalesManager(); + case MANAGER: + return visitor.visitManager(); + case MODERATOR: + return visitor.visitModerator(); + case ADVERTISER: + return visitor.visitAdvertiser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AuthorizedUserRoles valueOf(String value) { + switch (value) { + case "app_manager": + return APP_MANAGER; + case "owner": + return OWNER; + case "workforce": + return WORKFORCE; + case "admin": + return ADMIN; + case "support": + return SUPPORT; + case "custom": + return CUSTOM; + case "sales_manager": + return SALES_MANAGER; + case "manager": + return MANAGER; + case "moderator": + return MODERATOR; + case "advertiser": + return ADVERTISER; + default: + return new AuthorizedUserRoles(Value.UNKNOWN, value); + } + } + + public enum Value { + OWNER, + + ADMIN, + + SALES_MANAGER, + + MODERATOR, + + ADVERTISER, + + APP_MANAGER, + + SUPPORT, + + MANAGER, + + WORKFORCE, + + CUSTOM, + + UNKNOWN + } + + public interface Visitor { + T visitOwner(); + + T visitAdmin(); + + T visitSalesManager(); + + T visitModerator(); + + T visitAdvertiser(); + + T visitAppManager(); + + T visitSupport(); + + T visitManager(); + + T visitWorkforce(); + + T visitCustom(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/AuthorizedUserUser.java b/src/main/java/com/whop/api/types/AuthorizedUserUser.java new file mode 100644 index 00000000..bc67ad05 --- /dev/null +++ b/src/main/java/com/whop/api/types/AuthorizedUserUser.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AuthorizedUserUser.Builder.class) +public final class AuthorizedUserUser { + private final Optional email; + + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private AuthorizedUserUser( + Optional email, + String id, + Optional name, + String username, + Map additionalProperties) { + this.email = email; + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's email address. Requires the member:email:read permission to access. Null if not authorized. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AuthorizedUserUser && equalTo((AuthorizedUserUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AuthorizedUserUser other) { + return email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(AuthorizedUserUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + AuthorizedUserUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AuthorizedUserUser other) { + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public AuthorizedUserUser build() { + return new AuthorizedUserUser(email, id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/BadRequestErrorBody.java b/src/main/java/com/whop/api/types/BadRequestErrorBody.java new file mode 100644 index 00000000..730e1495 --- /dev/null +++ b/src/main/java/com/whop/api/types/BadRequestErrorBody.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BadRequestErrorBody.Builder.class) +public final class BadRequestErrorBody { + private final BadRequestErrorBodyError error; + + private final Map additionalProperties; + + private BadRequestErrorBody(BadRequestErrorBodyError error, Map additionalProperties) { + this.error = error; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("error") + public BadRequestErrorBodyError getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BadRequestErrorBody && equalTo((BadRequestErrorBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BadRequestErrorBody other) { + return error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + _FinalStage error(@NotNull BadRequestErrorBodyError error); + + Builder from(BadRequestErrorBody other); + } + + public interface _FinalStage { + BadRequestErrorBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private BadRequestErrorBodyError error; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BadRequestErrorBody other) { + error(other.getError()); + return this; + } + + @java.lang.Override + @JsonSetter("error") + public _FinalStage error(@NotNull BadRequestErrorBodyError error) { + this.error = Objects.requireNonNull(error, "error must not be null"); + return this; + } + + @java.lang.Override + public BadRequestErrorBody build() { + return new BadRequestErrorBody(error, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/BadRequestErrorBodyError.java b/src/main/java/com/whop/api/types/BadRequestErrorBodyError.java new file mode 100644 index 00000000..738d998f --- /dev/null +++ b/src/main/java/com/whop/api/types/BadRequestErrorBodyError.java @@ -0,0 +1,289 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BadRequestErrorBodyError.Builder.class) +public final class BadRequestErrorBodyError { + private final Optional code; + + private final String message; + + private final Optional param; + + private final String type; + + private final Map additionalProperties; + + private BadRequestErrorBodyError( + Optional code, + String message, + Optional param, + String type, + Map additionalProperties) { + this.code = code; + this.message = message; + this.param = param; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json' + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + @JsonProperty("message") + public String getMessage() { + return message; + } + + /** + * @return The parameter that caused the error, if applicable + */ + @JsonIgnore + public Optional getParam() { + if (param == null) { + return Optional.empty(); + } + return param; + } + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("param") + private Optional _getParam() { + return param; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BadRequestErrorBodyError && equalTo((BadRequestErrorBodyError) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BadRequestErrorBodyError other) { + return code.equals(other.code) + && message.equals(other.message) + && param.equals(other.param) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.message, this.param, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + TypeStage message(@NotNull String message); + + Builder from(BadRequestErrorBodyError other); + } + + public interface TypeStage { + _FinalStage type(@NotNull String type); + } + + public interface _FinalStage { + BadRequestErrorBodyError build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ */ + _FinalStage code(Optional code); + + _FinalStage code(String code); + + _FinalStage code(Nullable code); + + /** + *

The parameter that caused the error, if applicable

+ */ + _FinalStage param(Optional param); + + _FinalStage param(String param); + + _FinalStage param(Nullable param); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, TypeStage, _FinalStage { + private String message; + + private String type; + + private Optional param = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BadRequestErrorBodyError other) { + code(other.getCode()); + message(other.getMessage()); + param(other.getParam()); + type(other.getType()); + return this; + } + + @java.lang.Override + @JsonSetter("message") + public TypeStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage param(Nullable param) { + if (param.isNull()) { + this.param = null; + } else if (param.isEmpty()) { + this.param = Optional.empty(); + } else { + this.param = Optional.of(param.get()); + } + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage param(String param) { + this.param = Optional.ofNullable(param); + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ */ + @java.lang.Override + @JsonSetter(value = "param", nulls = Nulls.SKIP) + public _FinalStage param(Optional param) { + this.param = param; + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public BadRequestErrorBodyError build() { + return new BadRequestErrorBodyError(code, message, param, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/BillingReasons.java b/src/main/java/com/whop/api/types/BillingReasons.java new file mode 100644 index 00000000..52a35ae0 --- /dev/null +++ b/src/main/java/com/whop/api/types/BillingReasons.java @@ -0,0 +1,126 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BillingReasons { + public static final BillingReasons SUBSCRIPTION_CREATE = + new BillingReasons(Value.SUBSCRIPTION_CREATE, "subscription_create"); + + public static final BillingReasons SUBSCRIPTION = new BillingReasons(Value.SUBSCRIPTION, "subscription"); + + public static final BillingReasons SUBSCRIPTION_CYCLE = + new BillingReasons(Value.SUBSCRIPTION_CYCLE, "subscription_cycle"); + + public static final BillingReasons ONE_TIME = new BillingReasons(Value.ONE_TIME, "one_time"); + + public static final BillingReasons SUBSCRIPTION_UPDATE = + new BillingReasons(Value.SUBSCRIPTION_UPDATE, "subscription_update"); + + public static final BillingReasons MANUAL = new BillingReasons(Value.MANUAL, "manual"); + + private final Value value; + + private final String string; + + BillingReasons(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BillingReasons && this.string.equals(((BillingReasons) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SUBSCRIPTION_CREATE: + return visitor.visitSubscriptionCreate(); + case SUBSCRIPTION: + return visitor.visitSubscription(); + case SUBSCRIPTION_CYCLE: + return visitor.visitSubscriptionCycle(); + case ONE_TIME: + return visitor.visitOneTime(); + case SUBSCRIPTION_UPDATE: + return visitor.visitSubscriptionUpdate(); + case MANUAL: + return visitor.visitManual(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BillingReasons valueOf(String value) { + switch (value) { + case "subscription_create": + return SUBSCRIPTION_CREATE; + case "subscription": + return SUBSCRIPTION; + case "subscription_cycle": + return SUBSCRIPTION_CYCLE; + case "one_time": + return ONE_TIME; + case "subscription_update": + return SUBSCRIPTION_UPDATE; + case "manual": + return MANUAL; + default: + return new BillingReasons(Value.UNKNOWN, value); + } + } + + public enum Value { + SUBSCRIPTION_CREATE, + + SUBSCRIPTION_CYCLE, + + SUBSCRIPTION_UPDATE, + + ONE_TIME, + + MANUAL, + + SUBSCRIPTION, + + UNKNOWN + } + + public interface Visitor { + T visitSubscriptionCreate(); + + T visitSubscriptionCycle(); + + T visitSubscriptionUpdate(); + + T visitOneTime(); + + T visitManual(); + + T visitSubscription(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Bounty.java b/src/main/java/com/whop/api/types/Bounty.java new file mode 100644 index 00000000..990de271 --- /dev/null +++ b/src/main/java/com/whop/api/types/Bounty.java @@ -0,0 +1,1782 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Bounty.Builder.class) +public final class Bounty { + private final List acceptedDeliverableTypes; + + private final int acceptedSubmissionsCount; + + private final int acceptedSubmissionsLimit; + + private final int acceptedSubmissionsPerUserLimit; + + private final double affiliateShareAmount; + + private final List allowedCountryCodes; + + private final double budgetAmount; + + private final Optional businessGoalType; + + private final Optional cancelRequestedAt; + + private final Optional captureSpec; + + private final String createdAt; + + private final BountyCurrency currency; + + private final String description; + + private final Optional discussionExperienceId; + + private final Optional discussionFeedId; + + private final Optional discussionPostId; + + private final Optional experienceId; + + private final Optional fundingAccount; + + private final double grossPaidOutAmount; + + private final double grossRewardAmount; + + private final Optional hostingAccount; + + private final String id; + + private final double netRewardAmount; + + private final UserSummary poster; + + private final Optional scheduledFrequency; + + private final Optional scheduledPublishAt; + + private final int spotsRemaining; + + private final BountyStatus status; + + private final Optional submissionsClosedAt; + + private final String title; + + private final int unresolvedSubmissionsCount; + + private final String updatedAt; + + private final int viewerAcceptedSubmissionsCount; + + private final Map additionalProperties; + + private Bounty( + List acceptedDeliverableTypes, + int acceptedSubmissionsCount, + int acceptedSubmissionsLimit, + int acceptedSubmissionsPerUserLimit, + double affiliateShareAmount, + List allowedCountryCodes, + double budgetAmount, + Optional businessGoalType, + Optional cancelRequestedAt, + Optional captureSpec, + String createdAt, + BountyCurrency currency, + String description, + Optional discussionExperienceId, + Optional discussionFeedId, + Optional discussionPostId, + Optional experienceId, + Optional fundingAccount, + double grossPaidOutAmount, + double grossRewardAmount, + Optional hostingAccount, + String id, + double netRewardAmount, + UserSummary poster, + Optional scheduledFrequency, + Optional scheduledPublishAt, + int spotsRemaining, + BountyStatus status, + Optional submissionsClosedAt, + String title, + int unresolvedSubmissionsCount, + String updatedAt, + int viewerAcceptedSubmissionsCount, + Map additionalProperties) { + this.acceptedDeliverableTypes = acceptedDeliverableTypes; + this.acceptedSubmissionsCount = acceptedSubmissionsCount; + this.acceptedSubmissionsLimit = acceptedSubmissionsLimit; + this.acceptedSubmissionsPerUserLimit = acceptedSubmissionsPerUserLimit; + this.affiliateShareAmount = affiliateShareAmount; + this.allowedCountryCodes = allowedCountryCodes; + this.budgetAmount = budgetAmount; + this.businessGoalType = businessGoalType; + this.cancelRequestedAt = cancelRequestedAt; + this.captureSpec = captureSpec; + this.createdAt = createdAt; + this.currency = currency; + this.description = description; + this.discussionExperienceId = discussionExperienceId; + this.discussionFeedId = discussionFeedId; + this.discussionPostId = discussionPostId; + this.experienceId = experienceId; + this.fundingAccount = fundingAccount; + this.grossPaidOutAmount = grossPaidOutAmount; + this.grossRewardAmount = grossRewardAmount; + this.hostingAccount = hostingAccount; + this.id = id; + this.netRewardAmount = netRewardAmount; + this.poster = poster; + this.scheduledFrequency = scheduledFrequency; + this.scheduledPublishAt = scheduledPublishAt; + this.spotsRemaining = spotsRemaining; + this.status = status; + this.submissionsClosedAt = submissionsClosedAt; + this.title = title; + this.unresolvedSubmissionsCount = unresolvedSubmissionsCount; + this.updatedAt = updatedAt; + this.viewerAcceptedSubmissionsCount = viewerAcceptedSubmissionsCount; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("accepted_deliverable_types") + public List getAcceptedDeliverableTypes() { + return acceptedDeliverableTypes; + } + + /** + * @return Submissions accepted so far. + */ + @JsonProperty("accepted_submissions_count") + public int getAcceptedSubmissionsCount() { + return acceptedSubmissionsCount; + } + + /** + * @return Number of submissions that can be accepted (winner slots). + */ + @JsonProperty("accepted_submissions_limit") + public int getAcceptedSubmissionsLimit() { + return acceptedSubmissionsLimit; + } + + /** + * @return How many winner slots one worker can win. Defaults to 1. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed accepted_submissions_limit. + */ + @JsonProperty("accepted_submissions_per_user_limit") + public int getAcceptedSubmissionsPerUserLimit() { + return acceptedSubmissionsPerUserLimit; + } + + /** + * @return What a referrer earns per accepted submission when the worker arrived through their affiliate link, in whole currency units, at the standard platform fee rate. Taken out of the worker's post-fee reward rather than added on top. 0 when the bounty pays no affiliate share, including bounties tied to no account, which cannot record a referral. + */ + @JsonProperty("affiliate_share_amount") + public double getAffiliateShareAmount() { + return affiliateShareAmount; + } + + @JsonProperty("allowed_country_codes") + public List getAllowedCountryCodes() { + return allowedCountryCodes; + } + + /** + * @return Total gross budget committed to the bounty: gross_reward_amount times accepted_submissions_limit. + */ + @JsonProperty("budget_amount") + public double getBudgetAmount() { + return budgetAmount; + } + + /** + * @return What the poster wants the work to achieve, declared once at create. null for bounties created before the taxonomy rolled out. + */ + @JsonIgnore + public Optional getBusinessGoalType() { + if (businessGoalType == null) { + return Optional.empty(); + } + return businessGoalType; + } + + /** + * @return When cancellation was requested, as an ISO 8601 timestamp. On a closed bounty this means the cancel is pending: submissions are stopped and the bounty cancels once in-flight submissions resolve. On a canceled bounty it records when the cancellation was requested. null when no cancellation was ever requested. + */ + @JsonIgnore + public Optional getCancelRequestedAt() { + if (cancelRequestedAt == null) { + return Optional.empty(); + } + return cancelRequestedAt; + } + + /** + * @return The technical contract footage must be recorded against. Present only on data_capture bounties; null for every other goal type. + */ + @JsonIgnore + public Optional getCaptureSpec() { + if (captureSpec == null) { + return Optional.empty(); + } + return captureSpec; + } + + /** + * @return When the bounty was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Currency for all amounts on the bounty, as a lowercase ISO 4217 code. + */ + @JsonProperty("currency") + public BountyCurrency getCurrency() { + return currency; + } + + /** + * @return Full task instructions shown to workers. + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * @return Experience the bounty's discussion thread lives in, prefixed exp_. Read this — not experience_id — to open the thread: a platform-wide bounty has no hosting experience of its own but its discussion still lives in one. + */ + @JsonIgnore + public Optional getDiscussionExperienceId() { + if (discussionExperienceId == null) { + return Optional.empty(); + } + return discussionExperienceId; + } + + /** + * @return Forum feed containing the bounty's discussion thread. null for a bounty with no forum post. + */ + @JsonIgnore + public Optional getDiscussionFeedId() { + if (discussionFeedId == null) { + return Optional.empty(); + } + return discussionFeedId; + } + + /** + * @return Forum post anchoring the bounty's discussion thread. Read together with discussion_experience_id to address the thread. null for a bounty with no forum post. + */ + @JsonIgnore + public Optional getDiscussionPostId() { + if (discussionPostId == null) { + return Optional.empty(); + } + return discussionPostId; + } + + /** + * @return Experience the bounty is hosted in, prefixed exp_. null for platform-wide bounties; may belong to a different account than the funder. + */ + @JsonIgnore + public Optional getExperienceId() { + if (experienceId == null) { + return Optional.empty(); + } + return experienceId; + } + + /** + * @return Account whose balance funds the bounty pool, or null when a user funds it personally. May differ from the account hosting experience_id. + */ + @JsonIgnore + public Optional getFundingAccount() { + if (fundingAccount == null) { + return Optional.empty(); + } + return fundingAccount; + } + + /** + * @return Gross amount paid out from the bounty pool across accepted submissions — worker payouts, platform fees, and affiliate shares together. Tips and reviewer rewards are excluded. + */ + @JsonProperty("gross_paid_out_amount") + public double getGrossPaidOutAmount() { + return grossPaidOutAmount; + } + + /** + * @return Gross bounty-pool amount allocated per accepted submission, in whole currency units. + */ + @JsonProperty("gross_reward_amount") + public double getGrossRewardAmount() { + return grossRewardAmount; + } + + /** + * @return Account hosting the bounty's forum — the one whose route and experience_id address its discussion thread, and where its submissions dashboard lives. null for a platform-wide bounty with no host. May differ from funding_account. + */ + @JsonIgnore + public Optional getHostingAccount() { + if (hostingAccount == null) { + return Optional.empty(); + } + return hostingAccount; + } + + /** + * @return Bounty ID, prefixed bnty_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return What a worker is quoted per accepted submission after the platform fee, in whole currency units. The exact post-fee figure, at the standard platform fee rate — a worker who locked a different rate, or who arrived through an affiliate link, is paid a different amount. + */ + @JsonProperty("net_reward_amount") + public double getNetRewardAmount() { + return netRewardAmount; + } + + /** + * @return User who posted the bounty — the account owner when created with an account API key. + */ + @JsonProperty("poster") + public UserSummary getPoster() { + return poster; + } + + /** + * @return How often the schedule creates a new bounty. Each occurrence is a separate bounty; the original is not republished. + */ + @JsonIgnore + public Optional getScheduledFrequency() { + if (scheduledFrequency == null) { + return Optional.empty(); + } + return scheduledFrequency; + } + + /** + * @return When a scheduled bounty will publish, as an ISO 8601 timestamp. null once published, for bounties that were never scheduled, and for terminally failed drafts parked for manual rescheduling. + */ + @JsonIgnore + public Optional getScheduledPublishAt() { + if (scheduledPublishAt == null) { + return Optional.empty(); + } + return scheduledPublishAt; + } + + /** + * @return Unfilled winner capacity: accepted_submissions_limit minus accepted_submissions_count, clamped to zero. Not on its own a signal that the bounty accepts new claims — read status for that: only an open bounty takes new submissions. + */ + @JsonProperty("spots_remaining") + public int getSpotsRemaining() { + return spotsRemaining; + } + + /** + * @return Lifecycle state. scheduled bounties are unpublished drafts, visible to their poster and the account's authorized managers; open bounties accept new submissions; closed bounties are live but no longer accept new submissions; completed bounties paid out every winner slot; canceled bounties ended before filling their slots. + */ + @JsonProperty("status") + public BountyStatus getStatus() { + return status; + } + + /** + * @return When new submissions stopped being accepted, as an ISO 8601 timestamp. Set when a cancellation is requested on a bounty with work in flight, so in-flight submissions can resolve before the bounty cancels. null when submissions were never stopped — including completed bounties that simply filled every winner slot. + */ + @JsonIgnore + public Optional getSubmissionsClosedAt() { + if (submissionsClosedAt == null) { + return Optional.empty(); + } + return submissionsClosedAt; + } + + /** + * @return Short name of the task shown to workers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return Submissions still awaiting an outcome: in progress or pending review. + */ + @JsonProperty("unresolved_submissions_count") + public int getUnresolvedSubmissionsCount() { + return unresolvedSubmissionsCount; + } + + /** + * @return When the bounty was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return How many winner slots the authenticated user has already won on this bounty. Read against accepted_submissions_per_user_limit to show a worker their remaining allowance. 0 when the request has no authenticated user. + */ + @JsonProperty("viewer_accepted_submissions_count") + public int getViewerAcceptedSubmissionsCount() { + return viewerAcceptedSubmissionsCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_goal_type") + private Optional _getBusinessGoalType() { + return businessGoalType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancel_requested_at") + private Optional _getCancelRequestedAt() { + return cancelRequestedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("capture_spec") + private Optional _getCaptureSpec() { + return captureSpec; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("discussion_experience_id") + private Optional _getDiscussionExperienceId() { + return discussionExperienceId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("discussion_feed_id") + private Optional _getDiscussionFeedId() { + return discussionFeedId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("discussion_post_id") + private Optional _getDiscussionPostId() { + return discussionPostId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("experience_id") + private Optional _getExperienceId() { + return experienceId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("funding_account") + private Optional _getFundingAccount() { + return fundingAccount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("hosting_account") + private Optional _getHostingAccount() { + return hostingAccount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("scheduled_frequency") + private Optional _getScheduledFrequency() { + return scheduledFrequency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("scheduled_publish_at") + private Optional _getScheduledPublishAt() { + return scheduledPublishAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("submissions_closed_at") + private Optional _getSubmissionsClosedAt() { + return submissionsClosedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Bounty && equalTo((Bounty) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Bounty other) { + return acceptedDeliverableTypes.equals(other.acceptedDeliverableTypes) + && acceptedSubmissionsCount == other.acceptedSubmissionsCount + && acceptedSubmissionsLimit == other.acceptedSubmissionsLimit + && acceptedSubmissionsPerUserLimit == other.acceptedSubmissionsPerUserLimit + && affiliateShareAmount == other.affiliateShareAmount + && allowedCountryCodes.equals(other.allowedCountryCodes) + && budgetAmount == other.budgetAmount + && businessGoalType.equals(other.businessGoalType) + && cancelRequestedAt.equals(other.cancelRequestedAt) + && captureSpec.equals(other.captureSpec) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && description.equals(other.description) + && discussionExperienceId.equals(other.discussionExperienceId) + && discussionFeedId.equals(other.discussionFeedId) + && discussionPostId.equals(other.discussionPostId) + && experienceId.equals(other.experienceId) + && fundingAccount.equals(other.fundingAccount) + && grossPaidOutAmount == other.grossPaidOutAmount + && grossRewardAmount == other.grossRewardAmount + && hostingAccount.equals(other.hostingAccount) + && id.equals(other.id) + && netRewardAmount == other.netRewardAmount + && poster.equals(other.poster) + && scheduledFrequency.equals(other.scheduledFrequency) + && scheduledPublishAt.equals(other.scheduledPublishAt) + && spotsRemaining == other.spotsRemaining + && status.equals(other.status) + && submissionsClosedAt.equals(other.submissionsClosedAt) + && title.equals(other.title) + && unresolvedSubmissionsCount == other.unresolvedSubmissionsCount + && updatedAt.equals(other.updatedAt) + && viewerAcceptedSubmissionsCount == other.viewerAcceptedSubmissionsCount; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.acceptedDeliverableTypes, + this.acceptedSubmissionsCount, + this.acceptedSubmissionsLimit, + this.acceptedSubmissionsPerUserLimit, + this.affiliateShareAmount, + this.allowedCountryCodes, + this.budgetAmount, + this.businessGoalType, + this.cancelRequestedAt, + this.captureSpec, + this.createdAt, + this.currency, + this.description, + this.discussionExperienceId, + this.discussionFeedId, + this.discussionPostId, + this.experienceId, + this.fundingAccount, + this.grossPaidOutAmount, + this.grossRewardAmount, + this.hostingAccount, + this.id, + this.netRewardAmount, + this.poster, + this.scheduledFrequency, + this.scheduledPublishAt, + this.spotsRemaining, + this.status, + this.submissionsClosedAt, + this.title, + this.unresolvedSubmissionsCount, + this.updatedAt, + this.viewerAcceptedSubmissionsCount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AcceptedSubmissionsCountStage builder() { + return new Builder(); + } + + public interface AcceptedSubmissionsCountStage { + /** + *

Submissions accepted so far.

+ */ + AcceptedSubmissionsLimitStage acceptedSubmissionsCount(int acceptedSubmissionsCount); + + Builder from(Bounty other); + } + + public interface AcceptedSubmissionsLimitStage { + /** + *

Number of submissions that can be accepted (winner slots).

+ */ + AcceptedSubmissionsPerUserLimitStage acceptedSubmissionsLimit(int acceptedSubmissionsLimit); + } + + public interface AcceptedSubmissionsPerUserLimitStage { + /** + *

How many winner slots one worker can win. Defaults to 1. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed accepted_submissions_limit.

+ */ + AffiliateShareAmountStage acceptedSubmissionsPerUserLimit(int acceptedSubmissionsPerUserLimit); + } + + public interface AffiliateShareAmountStage { + /** + *

What a referrer earns per accepted submission when the worker arrived through their affiliate link, in whole currency units, at the standard platform fee rate. Taken out of the worker's post-fee reward rather than added on top. 0 when the bounty pays no affiliate share, including bounties tied to no account, which cannot record a referral.

+ */ + BudgetAmountStage affiliateShareAmount(double affiliateShareAmount); + } + + public interface BudgetAmountStage { + /** + *

Total gross budget committed to the bounty: gross_reward_amount times accepted_submissions_limit.

+ */ + CreatedAtStage budgetAmount(double budgetAmount); + } + + public interface CreatedAtStage { + /** + *

When the bounty was created, as an ISO 8601 timestamp.

+ */ + CurrencyStage createdAt(@NotNull String createdAt); + } + + public interface CurrencyStage { + /** + *

Currency for all amounts on the bounty, as a lowercase ISO 4217 code.

+ */ + DescriptionStage currency(@NotNull BountyCurrency currency); + } + + public interface DescriptionStage { + /** + *

Full task instructions shown to workers.

+ */ + GrossPaidOutAmountStage description(@NotNull String description); + } + + public interface GrossPaidOutAmountStage { + /** + *

Gross amount paid out from the bounty pool across accepted submissions — worker payouts, platform fees, and affiliate shares together. Tips and reviewer rewards are excluded.

+ */ + GrossRewardAmountStage grossPaidOutAmount(double grossPaidOutAmount); + } + + public interface GrossRewardAmountStage { + /** + *

Gross bounty-pool amount allocated per accepted submission, in whole currency units.

+ */ + IdStage grossRewardAmount(double grossRewardAmount); + } + + public interface IdStage { + /** + *

Bounty ID, prefixed bnty_.

+ */ + NetRewardAmountStage id(@NotNull String id); + } + + public interface NetRewardAmountStage { + /** + *

What a worker is quoted per accepted submission after the platform fee, in whole currency units. The exact post-fee figure, at the standard platform fee rate — a worker who locked a different rate, or who arrived through an affiliate link, is paid a different amount.

+ */ + PosterStage netRewardAmount(double netRewardAmount); + } + + public interface PosterStage { + /** + *

User who posted the bounty — the account owner when created with an account API key.

+ */ + SpotsRemainingStage poster(@NotNull UserSummary poster); + } + + public interface SpotsRemainingStage { + /** + *

Unfilled winner capacity: accepted_submissions_limit minus accepted_submissions_count, clamped to zero. Not on its own a signal that the bounty accepts new claims — read status for that: only an open bounty takes new submissions.

+ */ + StatusStage spotsRemaining(int spotsRemaining); + } + + public interface StatusStage { + /** + *

Lifecycle state. scheduled bounties are unpublished drafts, visible to their poster and the account's authorized managers; open bounties accept new submissions; closed bounties are live but no longer accept new submissions; completed bounties paid out every winner slot; canceled bounties ended before filling their slots.

+ */ + TitleStage status(@NotNull BountyStatus status); + } + + public interface TitleStage { + /** + *

Short name of the task shown to workers.

+ */ + UnresolvedSubmissionsCountStage title(@NotNull String title); + } + + public interface UnresolvedSubmissionsCountStage { + /** + *

Submissions still awaiting an outcome: in progress or pending review.

+ */ + UpdatedAtStage unresolvedSubmissionsCount(int unresolvedSubmissionsCount); + } + + public interface UpdatedAtStage { + /** + *

When the bounty was last updated, as an ISO 8601 timestamp.

+ */ + ViewerAcceptedSubmissionsCountStage updatedAt(@NotNull String updatedAt); + } + + public interface ViewerAcceptedSubmissionsCountStage { + /** + *

How many winner slots the authenticated user has already won on this bounty. Read against accepted_submissions_per_user_limit to show a worker their remaining allowance. 0 when the request has no authenticated user.

+ */ + _FinalStage viewerAcceptedSubmissionsCount(int viewerAcceptedSubmissionsCount); + } + + public interface _FinalStage { + Bounty build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage acceptedDeliverableTypes(List acceptedDeliverableTypes); + + _FinalStage addAcceptedDeliverableTypes(BountyAcceptedDeliverableTypesItem acceptedDeliverableTypes); + + _FinalStage addAllAcceptedDeliverableTypes(List acceptedDeliverableTypes); + + _FinalStage allowedCountryCodes(List allowedCountryCodes); + + _FinalStage addAllowedCountryCodes(String allowedCountryCodes); + + _FinalStage addAllAllowedCountryCodes(List allowedCountryCodes); + + /** + *

What the poster wants the work to achieve, declared once at create. null for bounties created before the taxonomy rolled out.

+ */ + _FinalStage businessGoalType(Optional businessGoalType); + + _FinalStage businessGoalType(BountyBusinessGoalType businessGoalType); + + _FinalStage businessGoalType(Nullable businessGoalType); + + /** + *

When cancellation was requested, as an ISO 8601 timestamp. On a closed bounty this means the cancel is pending: submissions are stopped and the bounty cancels once in-flight submissions resolve. On a canceled bounty it records when the cancellation was requested. null when no cancellation was ever requested.

+ */ + _FinalStage cancelRequestedAt(Optional cancelRequestedAt); + + _FinalStage cancelRequestedAt(String cancelRequestedAt); + + _FinalStage cancelRequestedAt(Nullable cancelRequestedAt); + + /** + *

The technical contract footage must be recorded against. Present only on data_capture bounties; null for every other goal type.

+ */ + _FinalStage captureSpec(Optional captureSpec); + + _FinalStage captureSpec(CaptureSpec captureSpec); + + _FinalStage captureSpec(Nullable captureSpec); + + /** + *

Experience the bounty's discussion thread lives in, prefixed exp_. Read this — not experience_id — to open the thread: a platform-wide bounty has no hosting experience of its own but its discussion still lives in one.

+ */ + _FinalStage discussionExperienceId(Optional discussionExperienceId); + + _FinalStage discussionExperienceId(String discussionExperienceId); + + _FinalStage discussionExperienceId(Nullable discussionExperienceId); + + /** + *

Forum feed containing the bounty's discussion thread. null for a bounty with no forum post.

+ */ + _FinalStage discussionFeedId(Optional discussionFeedId); + + _FinalStage discussionFeedId(String discussionFeedId); + + _FinalStage discussionFeedId(Nullable discussionFeedId); + + /** + *

Forum post anchoring the bounty's discussion thread. Read together with discussion_experience_id to address the thread. null for a bounty with no forum post.

+ */ + _FinalStage discussionPostId(Optional discussionPostId); + + _FinalStage discussionPostId(String discussionPostId); + + _FinalStage discussionPostId(Nullable discussionPostId); + + /** + *

Experience the bounty is hosted in, prefixed exp_. null for platform-wide bounties; may belong to a different account than the funder.

+ */ + _FinalStage experienceId(Optional experienceId); + + _FinalStage experienceId(String experienceId); + + _FinalStage experienceId(Nullable experienceId); + + /** + *

Account whose balance funds the bounty pool, or null when a user funds it personally. May differ from the account hosting experience_id.

+ */ + _FinalStage fundingAccount(Optional fundingAccount); + + _FinalStage fundingAccount(AccountSummary fundingAccount); + + _FinalStage fundingAccount(Nullable fundingAccount); + + /** + *

Account hosting the bounty's forum — the one whose route and experience_id address its discussion thread, and where its submissions dashboard lives. null for a platform-wide bounty with no host. May differ from funding_account.

+ */ + _FinalStage hostingAccount(Optional hostingAccount); + + _FinalStage hostingAccount(StorefrontAccount hostingAccount); + + _FinalStage hostingAccount(Nullable hostingAccount); + + /** + *

How often the schedule creates a new bounty. Each occurrence is a separate bounty; the original is not republished.

+ */ + _FinalStage scheduledFrequency(Optional scheduledFrequency); + + _FinalStage scheduledFrequency(BountyScheduledFrequency scheduledFrequency); + + _FinalStage scheduledFrequency(Nullable scheduledFrequency); + + /** + *

When a scheduled bounty will publish, as an ISO 8601 timestamp. null once published, for bounties that were never scheduled, and for terminally failed drafts parked for manual rescheduling.

+ */ + _FinalStage scheduledPublishAt(Optional scheduledPublishAt); + + _FinalStage scheduledPublishAt(String scheduledPublishAt); + + _FinalStage scheduledPublishAt(Nullable scheduledPublishAt); + + /** + *

When new submissions stopped being accepted, as an ISO 8601 timestamp. Set when a cancellation is requested on a bounty with work in flight, so in-flight submissions can resolve before the bounty cancels. null when submissions were never stopped — including completed bounties that simply filled every winner slot.

+ */ + _FinalStage submissionsClosedAt(Optional submissionsClosedAt); + + _FinalStage submissionsClosedAt(String submissionsClosedAt); + + _FinalStage submissionsClosedAt(Nullable submissionsClosedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AcceptedSubmissionsCountStage, + AcceptedSubmissionsLimitStage, + AcceptedSubmissionsPerUserLimitStage, + AffiliateShareAmountStage, + BudgetAmountStage, + CreatedAtStage, + CurrencyStage, + DescriptionStage, + GrossPaidOutAmountStage, + GrossRewardAmountStage, + IdStage, + NetRewardAmountStage, + PosterStage, + SpotsRemainingStage, + StatusStage, + TitleStage, + UnresolvedSubmissionsCountStage, + UpdatedAtStage, + ViewerAcceptedSubmissionsCountStage, + _FinalStage { + private int acceptedSubmissionsCount; + + private int acceptedSubmissionsLimit; + + private int acceptedSubmissionsPerUserLimit; + + private double affiliateShareAmount; + + private double budgetAmount; + + private String createdAt; + + private BountyCurrency currency; + + private String description; + + private double grossPaidOutAmount; + + private double grossRewardAmount; + + private String id; + + private double netRewardAmount; + + private UserSummary poster; + + private int spotsRemaining; + + private BountyStatus status; + + private String title; + + private int unresolvedSubmissionsCount; + + private String updatedAt; + + private int viewerAcceptedSubmissionsCount; + + private Optional submissionsClosedAt = Optional.empty(); + + private Optional scheduledPublishAt = Optional.empty(); + + private Optional scheduledFrequency = Optional.empty(); + + private Optional hostingAccount = Optional.empty(); + + private Optional fundingAccount = Optional.empty(); + + private Optional experienceId = Optional.empty(); + + private Optional discussionPostId = Optional.empty(); + + private Optional discussionFeedId = Optional.empty(); + + private Optional discussionExperienceId = Optional.empty(); + + private Optional captureSpec = Optional.empty(); + + private Optional cancelRequestedAt = Optional.empty(); + + private Optional businessGoalType = Optional.empty(); + + private List allowedCountryCodes = new ArrayList<>(); + + private List acceptedDeliverableTypes = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Bounty other) { + acceptedDeliverableTypes(other.getAcceptedDeliverableTypes()); + acceptedSubmissionsCount(other.getAcceptedSubmissionsCount()); + acceptedSubmissionsLimit(other.getAcceptedSubmissionsLimit()); + acceptedSubmissionsPerUserLimit(other.getAcceptedSubmissionsPerUserLimit()); + affiliateShareAmount(other.getAffiliateShareAmount()); + allowedCountryCodes(other.getAllowedCountryCodes()); + budgetAmount(other.getBudgetAmount()); + businessGoalType(other.getBusinessGoalType()); + cancelRequestedAt(other.getCancelRequestedAt()); + captureSpec(other.getCaptureSpec()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + description(other.getDescription()); + discussionExperienceId(other.getDiscussionExperienceId()); + discussionFeedId(other.getDiscussionFeedId()); + discussionPostId(other.getDiscussionPostId()); + experienceId(other.getExperienceId()); + fundingAccount(other.getFundingAccount()); + grossPaidOutAmount(other.getGrossPaidOutAmount()); + grossRewardAmount(other.getGrossRewardAmount()); + hostingAccount(other.getHostingAccount()); + id(other.getId()); + netRewardAmount(other.getNetRewardAmount()); + poster(other.getPoster()); + scheduledFrequency(other.getScheduledFrequency()); + scheduledPublishAt(other.getScheduledPublishAt()); + spotsRemaining(other.getSpotsRemaining()); + status(other.getStatus()); + submissionsClosedAt(other.getSubmissionsClosedAt()); + title(other.getTitle()); + unresolvedSubmissionsCount(other.getUnresolvedSubmissionsCount()); + updatedAt(other.getUpdatedAt()); + viewerAcceptedSubmissionsCount(other.getViewerAcceptedSubmissionsCount()); + return this; + } + + /** + *

Submissions accepted so far.

+ *

Submissions accepted so far.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("accepted_submissions_count") + public AcceptedSubmissionsLimitStage acceptedSubmissionsCount(int acceptedSubmissionsCount) { + this.acceptedSubmissionsCount = acceptedSubmissionsCount; + return this; + } + + /** + *

Number of submissions that can be accepted (winner slots).

+ *

Number of submissions that can be accepted (winner slots).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("accepted_submissions_limit") + public AcceptedSubmissionsPerUserLimitStage acceptedSubmissionsLimit(int acceptedSubmissionsLimit) { + this.acceptedSubmissionsLimit = acceptedSubmissionsLimit; + return this; + } + + /** + *

How many winner slots one worker can win. Defaults to 1. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed accepted_submissions_limit.

+ *

How many winner slots one worker can win. Defaults to 1. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed accepted_submissions_limit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("accepted_submissions_per_user_limit") + public AffiliateShareAmountStage acceptedSubmissionsPerUserLimit(int acceptedSubmissionsPerUserLimit) { + this.acceptedSubmissionsPerUserLimit = acceptedSubmissionsPerUserLimit; + return this; + } + + /** + *

What a referrer earns per accepted submission when the worker arrived through their affiliate link, in whole currency units, at the standard platform fee rate. Taken out of the worker's post-fee reward rather than added on top. 0 when the bounty pays no affiliate share, including bounties tied to no account, which cannot record a referral.

+ *

What a referrer earns per accepted submission when the worker arrived through their affiliate link, in whole currency units, at the standard platform fee rate. Taken out of the worker's post-fee reward rather than added on top. 0 when the bounty pays no affiliate share, including bounties tied to no account, which cannot record a referral.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("affiliate_share_amount") + public BudgetAmountStage affiliateShareAmount(double affiliateShareAmount) { + this.affiliateShareAmount = affiliateShareAmount; + return this; + } + + /** + *

Total gross budget committed to the bounty: gross_reward_amount times accepted_submissions_limit.

+ *

Total gross budget committed to the bounty: gross_reward_amount times accepted_submissions_limit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("budget_amount") + public CreatedAtStage budgetAmount(double budgetAmount) { + this.budgetAmount = budgetAmount; + return this; + } + + /** + *

When the bounty was created, as an ISO 8601 timestamp.

+ *

When the bounty was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Currency for all amounts on the bounty, as a lowercase ISO 4217 code.

+ *

Currency for all amounts on the bounty, as a lowercase ISO 4217 code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DescriptionStage currency(@NotNull BountyCurrency currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Full task instructions shown to workers.

+ *

Full task instructions shown to workers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("description") + public GrossPaidOutAmountStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + /** + *

Gross amount paid out from the bounty pool across accepted submissions — worker payouts, platform fees, and affiliate shares together. Tips and reviewer rewards are excluded.

+ *

Gross amount paid out from the bounty pool across accepted submissions — worker payouts, platform fees, and affiliate shares together. Tips and reviewer rewards are excluded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("gross_paid_out_amount") + public GrossRewardAmountStage grossPaidOutAmount(double grossPaidOutAmount) { + this.grossPaidOutAmount = grossPaidOutAmount; + return this; + } + + /** + *

Gross bounty-pool amount allocated per accepted submission, in whole currency units.

+ *

Gross bounty-pool amount allocated per accepted submission, in whole currency units.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("gross_reward_amount") + public IdStage grossRewardAmount(double grossRewardAmount) { + this.grossRewardAmount = grossRewardAmount; + return this; + } + + /** + *

Bounty ID, prefixed bnty_.

+ *

Bounty ID, prefixed bnty_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NetRewardAmountStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

What a worker is quoted per accepted submission after the platform fee, in whole currency units. The exact post-fee figure, at the standard platform fee rate — a worker who locked a different rate, or who arrived through an affiliate link, is paid a different amount.

+ *

What a worker is quoted per accepted submission after the platform fee, in whole currency units. The exact post-fee figure, at the standard platform fee rate — a worker who locked a different rate, or who arrived through an affiliate link, is paid a different amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("net_reward_amount") + public PosterStage netRewardAmount(double netRewardAmount) { + this.netRewardAmount = netRewardAmount; + return this; + } + + /** + *

User who posted the bounty — the account owner when created with an account API key.

+ *

User who posted the bounty — the account owner when created with an account API key.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("poster") + public SpotsRemainingStage poster(@NotNull UserSummary poster) { + this.poster = Objects.requireNonNull(poster, "poster must not be null"); + return this; + } + + /** + *

Unfilled winner capacity: accepted_submissions_limit minus accepted_submissions_count, clamped to zero. Not on its own a signal that the bounty accepts new claims — read status for that: only an open bounty takes new submissions.

+ *

Unfilled winner capacity: accepted_submissions_limit minus accepted_submissions_count, clamped to zero. Not on its own a signal that the bounty accepts new claims — read status for that: only an open bounty takes new submissions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("spots_remaining") + public StatusStage spotsRemaining(int spotsRemaining) { + this.spotsRemaining = spotsRemaining; + return this; + } + + /** + *

Lifecycle state. scheduled bounties are unpublished drafts, visible to their poster and the account's authorized managers; open bounties accept new submissions; closed bounties are live but no longer accept new submissions; completed bounties paid out every winner slot; canceled bounties ended before filling their slots.

+ *

Lifecycle state. scheduled bounties are unpublished drafts, visible to their poster and the account's authorized managers; open bounties accept new submissions; closed bounties are live but no longer accept new submissions; completed bounties paid out every winner slot; canceled bounties ended before filling their slots.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TitleStage status(@NotNull BountyStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Short name of the task shown to workers.

+ *

Short name of the task shown to workers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public UnresolvedSubmissionsCountStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Submissions still awaiting an outcome: in progress or pending review.

+ *

Submissions still awaiting an outcome: in progress or pending review.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("unresolved_submissions_count") + public UpdatedAtStage unresolvedSubmissionsCount(int unresolvedSubmissionsCount) { + this.unresolvedSubmissionsCount = unresolvedSubmissionsCount; + return this; + } + + /** + *

When the bounty was last updated, as an ISO 8601 timestamp.

+ *

When the bounty was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public ViewerAcceptedSubmissionsCountStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

How many winner slots the authenticated user has already won on this bounty. Read against accepted_submissions_per_user_limit to show a worker their remaining allowance. 0 when the request has no authenticated user.

+ *

How many winner slots the authenticated user has already won on this bounty. Read against accepted_submissions_per_user_limit to show a worker their remaining allowance. 0 when the request has no authenticated user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("viewer_accepted_submissions_count") + public _FinalStage viewerAcceptedSubmissionsCount(int viewerAcceptedSubmissionsCount) { + this.viewerAcceptedSubmissionsCount = viewerAcceptedSubmissionsCount; + return this; + } + + /** + *

When new submissions stopped being accepted, as an ISO 8601 timestamp. Set when a cancellation is requested on a bounty with work in flight, so in-flight submissions can resolve before the bounty cancels. null when submissions were never stopped — including completed bounties that simply filled every winner slot.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage submissionsClosedAt(Nullable submissionsClosedAt) { + if (submissionsClosedAt.isNull()) { + this.submissionsClosedAt = null; + } else if (submissionsClosedAt.isEmpty()) { + this.submissionsClosedAt = Optional.empty(); + } else { + this.submissionsClosedAt = Optional.of(submissionsClosedAt.get()); + } + return this; + } + + /** + *

When new submissions stopped being accepted, as an ISO 8601 timestamp. Set when a cancellation is requested on a bounty with work in flight, so in-flight submissions can resolve before the bounty cancels. null when submissions were never stopped — including completed bounties that simply filled every winner slot.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage submissionsClosedAt(String submissionsClosedAt) { + this.submissionsClosedAt = Optional.ofNullable(submissionsClosedAt); + return this; + } + + /** + *

When new submissions stopped being accepted, as an ISO 8601 timestamp. Set when a cancellation is requested on a bounty with work in flight, so in-flight submissions can resolve before the bounty cancels. null when submissions were never stopped — including completed bounties that simply filled every winner slot.

+ */ + @java.lang.Override + @JsonSetter(value = "submissions_closed_at", nulls = Nulls.SKIP) + public _FinalStage submissionsClosedAt(Optional submissionsClosedAt) { + this.submissionsClosedAt = submissionsClosedAt; + return this; + } + + /** + *

When a scheduled bounty will publish, as an ISO 8601 timestamp. null once published, for bounties that were never scheduled, and for terminally failed drafts parked for manual rescheduling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage scheduledPublishAt(Nullable scheduledPublishAt) { + if (scheduledPublishAt.isNull()) { + this.scheduledPublishAt = null; + } else if (scheduledPublishAt.isEmpty()) { + this.scheduledPublishAt = Optional.empty(); + } else { + this.scheduledPublishAt = Optional.of(scheduledPublishAt.get()); + } + return this; + } + + /** + *

When a scheduled bounty will publish, as an ISO 8601 timestamp. null once published, for bounties that were never scheduled, and for terminally failed drafts parked for manual rescheduling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage scheduledPublishAt(String scheduledPublishAt) { + this.scheduledPublishAt = Optional.ofNullable(scheduledPublishAt); + return this; + } + + /** + *

When a scheduled bounty will publish, as an ISO 8601 timestamp. null once published, for bounties that were never scheduled, and for terminally failed drafts parked for manual rescheduling.

+ */ + @java.lang.Override + @JsonSetter(value = "scheduled_publish_at", nulls = Nulls.SKIP) + public _FinalStage scheduledPublishAt(Optional scheduledPublishAt) { + this.scheduledPublishAt = scheduledPublishAt; + return this; + } + + /** + *

How often the schedule creates a new bounty. Each occurrence is a separate bounty; the original is not republished.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage scheduledFrequency(Nullable scheduledFrequency) { + if (scheduledFrequency.isNull()) { + this.scheduledFrequency = null; + } else if (scheduledFrequency.isEmpty()) { + this.scheduledFrequency = Optional.empty(); + } else { + this.scheduledFrequency = Optional.of(scheduledFrequency.get()); + } + return this; + } + + /** + *

How often the schedule creates a new bounty. Each occurrence is a separate bounty; the original is not republished.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage scheduledFrequency(BountyScheduledFrequency scheduledFrequency) { + this.scheduledFrequency = Optional.ofNullable(scheduledFrequency); + return this; + } + + /** + *

How often the schedule creates a new bounty. Each occurrence is a separate bounty; the original is not republished.

+ */ + @java.lang.Override + @JsonSetter(value = "scheduled_frequency", nulls = Nulls.SKIP) + public _FinalStage scheduledFrequency(Optional scheduledFrequency) { + this.scheduledFrequency = scheduledFrequency; + return this; + } + + /** + *

Account hosting the bounty's forum — the one whose route and experience_id address its discussion thread, and where its submissions dashboard lives. null for a platform-wide bounty with no host. May differ from funding_account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostingAccount(Nullable hostingAccount) { + if (hostingAccount.isNull()) { + this.hostingAccount = null; + } else if (hostingAccount.isEmpty()) { + this.hostingAccount = Optional.empty(); + } else { + this.hostingAccount = Optional.of(hostingAccount.get()); + } + return this; + } + + /** + *

Account hosting the bounty's forum — the one whose route and experience_id address its discussion thread, and where its submissions dashboard lives. null for a platform-wide bounty with no host. May differ from funding_account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hostingAccount(StorefrontAccount hostingAccount) { + this.hostingAccount = Optional.ofNullable(hostingAccount); + return this; + } + + /** + *

Account hosting the bounty's forum — the one whose route and experience_id address its discussion thread, and where its submissions dashboard lives. null for a platform-wide bounty with no host. May differ from funding_account.

+ */ + @java.lang.Override + @JsonSetter(value = "hosting_account", nulls = Nulls.SKIP) + public _FinalStage hostingAccount(Optional hostingAccount) { + this.hostingAccount = hostingAccount; + return this; + } + + /** + *

Account whose balance funds the bounty pool, or null when a user funds it personally. May differ from the account hosting experience_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fundingAccount(Nullable fundingAccount) { + if (fundingAccount.isNull()) { + this.fundingAccount = null; + } else if (fundingAccount.isEmpty()) { + this.fundingAccount = Optional.empty(); + } else { + this.fundingAccount = Optional.of(fundingAccount.get()); + } + return this; + } + + /** + *

Account whose balance funds the bounty pool, or null when a user funds it personally. May differ from the account hosting experience_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fundingAccount(AccountSummary fundingAccount) { + this.fundingAccount = Optional.ofNullable(fundingAccount); + return this; + } + + /** + *

Account whose balance funds the bounty pool, or null when a user funds it personally. May differ from the account hosting experience_id.

+ */ + @java.lang.Override + @JsonSetter(value = "funding_account", nulls = Nulls.SKIP) + public _FinalStage fundingAccount(Optional fundingAccount) { + this.fundingAccount = fundingAccount; + return this; + } + + /** + *

Experience the bounty is hosted in, prefixed exp_. null for platform-wide bounties; may belong to a different account than the funder.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage experienceId(Nullable experienceId) { + if (experienceId.isNull()) { + this.experienceId = null; + } else if (experienceId.isEmpty()) { + this.experienceId = Optional.empty(); + } else { + this.experienceId = Optional.of(experienceId.get()); + } + return this; + } + + /** + *

Experience the bounty is hosted in, prefixed exp_. null for platform-wide bounties; may belong to a different account than the funder.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage experienceId(String experienceId) { + this.experienceId = Optional.ofNullable(experienceId); + return this; + } + + /** + *

Experience the bounty is hosted in, prefixed exp_. null for platform-wide bounties; may belong to a different account than the funder.

+ */ + @java.lang.Override + @JsonSetter(value = "experience_id", nulls = Nulls.SKIP) + public _FinalStage experienceId(Optional experienceId) { + this.experienceId = experienceId; + return this; + } + + /** + *

Forum post anchoring the bounty's discussion thread. Read together with discussion_experience_id to address the thread. null for a bounty with no forum post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discussionPostId(Nullable discussionPostId) { + if (discussionPostId.isNull()) { + this.discussionPostId = null; + } else if (discussionPostId.isEmpty()) { + this.discussionPostId = Optional.empty(); + } else { + this.discussionPostId = Optional.of(discussionPostId.get()); + } + return this; + } + + /** + *

Forum post anchoring the bounty's discussion thread. Read together with discussion_experience_id to address the thread. null for a bounty with no forum post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discussionPostId(String discussionPostId) { + this.discussionPostId = Optional.ofNullable(discussionPostId); + return this; + } + + /** + *

Forum post anchoring the bounty's discussion thread. Read together with discussion_experience_id to address the thread. null for a bounty with no forum post.

+ */ + @java.lang.Override + @JsonSetter(value = "discussion_post_id", nulls = Nulls.SKIP) + public _FinalStage discussionPostId(Optional discussionPostId) { + this.discussionPostId = discussionPostId; + return this; + } + + /** + *

Forum feed containing the bounty's discussion thread. null for a bounty with no forum post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discussionFeedId(Nullable discussionFeedId) { + if (discussionFeedId.isNull()) { + this.discussionFeedId = null; + } else if (discussionFeedId.isEmpty()) { + this.discussionFeedId = Optional.empty(); + } else { + this.discussionFeedId = Optional.of(discussionFeedId.get()); + } + return this; + } + + /** + *

Forum feed containing the bounty's discussion thread. null for a bounty with no forum post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discussionFeedId(String discussionFeedId) { + this.discussionFeedId = Optional.ofNullable(discussionFeedId); + return this; + } + + /** + *

Forum feed containing the bounty's discussion thread. null for a bounty with no forum post.

+ */ + @java.lang.Override + @JsonSetter(value = "discussion_feed_id", nulls = Nulls.SKIP) + public _FinalStage discussionFeedId(Optional discussionFeedId) { + this.discussionFeedId = discussionFeedId; + return this; + } + + /** + *

Experience the bounty's discussion thread lives in, prefixed exp_. Read this — not experience_id — to open the thread: a platform-wide bounty has no hosting experience of its own but its discussion still lives in one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discussionExperienceId(Nullable discussionExperienceId) { + if (discussionExperienceId.isNull()) { + this.discussionExperienceId = null; + } else if (discussionExperienceId.isEmpty()) { + this.discussionExperienceId = Optional.empty(); + } else { + this.discussionExperienceId = Optional.of(discussionExperienceId.get()); + } + return this; + } + + /** + *

Experience the bounty's discussion thread lives in, prefixed exp_. Read this — not experience_id — to open the thread: a platform-wide bounty has no hosting experience of its own but its discussion still lives in one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discussionExperienceId(String discussionExperienceId) { + this.discussionExperienceId = Optional.ofNullable(discussionExperienceId); + return this; + } + + /** + *

Experience the bounty's discussion thread lives in, prefixed exp_. Read this — not experience_id — to open the thread: a platform-wide bounty has no hosting experience of its own but its discussion still lives in one.

+ */ + @java.lang.Override + @JsonSetter(value = "discussion_experience_id", nulls = Nulls.SKIP) + public _FinalStage discussionExperienceId(Optional discussionExperienceId) { + this.discussionExperienceId = discussionExperienceId; + return this; + } + + /** + *

The technical contract footage must be recorded against. Present only on data_capture bounties; null for every other goal type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage captureSpec(Nullable captureSpec) { + if (captureSpec.isNull()) { + this.captureSpec = null; + } else if (captureSpec.isEmpty()) { + this.captureSpec = Optional.empty(); + } else { + this.captureSpec = Optional.of(captureSpec.get()); + } + return this; + } + + /** + *

The technical contract footage must be recorded against. Present only on data_capture bounties; null for every other goal type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage captureSpec(CaptureSpec captureSpec) { + this.captureSpec = Optional.ofNullable(captureSpec); + return this; + } + + /** + *

The technical contract footage must be recorded against. Present only on data_capture bounties; null for every other goal type.

+ */ + @java.lang.Override + @JsonSetter(value = "capture_spec", nulls = Nulls.SKIP) + public _FinalStage captureSpec(Optional captureSpec) { + this.captureSpec = captureSpec; + return this; + } + + /** + *

When cancellation was requested, as an ISO 8601 timestamp. On a closed bounty this means the cancel is pending: submissions are stopped and the bounty cancels once in-flight submissions resolve. On a canceled bounty it records when the cancellation was requested. null when no cancellation was ever requested.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelRequestedAt(Nullable cancelRequestedAt) { + if (cancelRequestedAt.isNull()) { + this.cancelRequestedAt = null; + } else if (cancelRequestedAt.isEmpty()) { + this.cancelRequestedAt = Optional.empty(); + } else { + this.cancelRequestedAt = Optional.of(cancelRequestedAt.get()); + } + return this; + } + + /** + *

When cancellation was requested, as an ISO 8601 timestamp. On a closed bounty this means the cancel is pending: submissions are stopped and the bounty cancels once in-flight submissions resolve. On a canceled bounty it records when the cancellation was requested. null when no cancellation was ever requested.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelRequestedAt(String cancelRequestedAt) { + this.cancelRequestedAt = Optional.ofNullable(cancelRequestedAt); + return this; + } + + /** + *

When cancellation was requested, as an ISO 8601 timestamp. On a closed bounty this means the cancel is pending: submissions are stopped and the bounty cancels once in-flight submissions resolve. On a canceled bounty it records when the cancellation was requested. null when no cancellation was ever requested.

+ */ + @java.lang.Override + @JsonSetter(value = "cancel_requested_at", nulls = Nulls.SKIP) + public _FinalStage cancelRequestedAt(Optional cancelRequestedAt) { + this.cancelRequestedAt = cancelRequestedAt; + return this; + } + + /** + *

What the poster wants the work to achieve, declared once at create. null for bounties created before the taxonomy rolled out.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessGoalType(Nullable businessGoalType) { + if (businessGoalType.isNull()) { + this.businessGoalType = null; + } else if (businessGoalType.isEmpty()) { + this.businessGoalType = Optional.empty(); + } else { + this.businessGoalType = Optional.of(businessGoalType.get()); + } + return this; + } + + /** + *

What the poster wants the work to achieve, declared once at create. null for bounties created before the taxonomy rolled out.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessGoalType(BountyBusinessGoalType businessGoalType) { + this.businessGoalType = Optional.ofNullable(businessGoalType); + return this; + } + + /** + *

What the poster wants the work to achieve, declared once at create. null for bounties created before the taxonomy rolled out.

+ */ + @java.lang.Override + @JsonSetter(value = "business_goal_type", nulls = Nulls.SKIP) + public _FinalStage businessGoalType(Optional businessGoalType) { + this.businessGoalType = businessGoalType; + return this; + } + + @java.lang.Override + public _FinalStage addAllAllowedCountryCodes(List allowedCountryCodes) { + if (allowedCountryCodes != null) { + this.allowedCountryCodes.addAll(allowedCountryCodes); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllowedCountryCodes(String allowedCountryCodes) { + this.allowedCountryCodes.add(allowedCountryCodes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allowed_country_codes", nulls = Nulls.SKIP) + public _FinalStage allowedCountryCodes(List allowedCountryCodes) { + this.allowedCountryCodes.clear(); + if (allowedCountryCodes != null) { + this.allowedCountryCodes.addAll(allowedCountryCodes); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllAcceptedDeliverableTypes( + List acceptedDeliverableTypes) { + if (acceptedDeliverableTypes != null) { + this.acceptedDeliverableTypes.addAll(acceptedDeliverableTypes); + } + return this; + } + + @java.lang.Override + public _FinalStage addAcceptedDeliverableTypes(BountyAcceptedDeliverableTypesItem acceptedDeliverableTypes) { + this.acceptedDeliverableTypes.add(acceptedDeliverableTypes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "accepted_deliverable_types", nulls = Nulls.SKIP) + public _FinalStage acceptedDeliverableTypes(List acceptedDeliverableTypes) { + this.acceptedDeliverableTypes.clear(); + if (acceptedDeliverableTypes != null) { + this.acceptedDeliverableTypes.addAll(acceptedDeliverableTypes); + } + return this; + } + + @java.lang.Override + public Bounty build() { + return new Bounty( + acceptedDeliverableTypes, + acceptedSubmissionsCount, + acceptedSubmissionsLimit, + acceptedSubmissionsPerUserLimit, + affiliateShareAmount, + allowedCountryCodes, + budgetAmount, + businessGoalType, + cancelRequestedAt, + captureSpec, + createdAt, + currency, + description, + discussionExperienceId, + discussionFeedId, + discussionPostId, + experienceId, + fundingAccount, + grossPaidOutAmount, + grossRewardAmount, + hostingAccount, + id, + netRewardAmount, + poster, + scheduledFrequency, + scheduledPublishAt, + spotsRemaining, + status, + submissionsClosedAt, + title, + unresolvedSubmissionsCount, + updatedAt, + viewerAcceptedSubmissionsCount, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/BountyAcceptedDeliverableTypesItem.java b/src/main/java/com/whop/api/types/BountyAcceptedDeliverableTypesItem.java new file mode 100644 index 00000000..7e9d4e78 --- /dev/null +++ b/src/main/java/com/whop/api/types/BountyAcceptedDeliverableTypesItem.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BountyAcceptedDeliverableTypesItem { + public static final BountyAcceptedDeliverableTypesItem CONTENT_URL = + new BountyAcceptedDeliverableTypesItem(Value.CONTENT_URL, "content_url"); + + public static final BountyAcceptedDeliverableTypesItem MEDIA = + new BountyAcceptedDeliverableTypesItem(Value.MEDIA, "media"); + + public static final BountyAcceptedDeliverableTypesItem DATA_CAPTURE = + new BountyAcceptedDeliverableTypesItem(Value.DATA_CAPTURE, "data_capture"); + + private final Value value; + + private final String string; + + BountyAcceptedDeliverableTypesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BountyAcceptedDeliverableTypesItem + && this.string.equals(((BountyAcceptedDeliverableTypesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CONTENT_URL: + return visitor.visitContentUrl(); + case MEDIA: + return visitor.visitMedia(); + case DATA_CAPTURE: + return visitor.visitDataCapture(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BountyAcceptedDeliverableTypesItem valueOf(String value) { + switch (value) { + case "content_url": + return CONTENT_URL; + case "media": + return MEDIA; + case "data_capture": + return DATA_CAPTURE; + default: + return new BountyAcceptedDeliverableTypesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + CONTENT_URL, + + MEDIA, + + DATA_CAPTURE, + + UNKNOWN + } + + public interface Visitor { + T visitContentUrl(); + + T visitMedia(); + + T visitDataCapture(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/BountyBusinessGoalType.java b/src/main/java/com/whop/api/types/BountyBusinessGoalType.java new file mode 100644 index 00000000..2e29e14f --- /dev/null +++ b/src/main/java/com/whop/api/types/BountyBusinessGoalType.java @@ -0,0 +1,139 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BountyBusinessGoalType { + public static final BountyBusinessGoalType LOCAL_ACTIVATION = + new BountyBusinessGoalType(Value.LOCAL_ACTIVATION, "local_activation"); + + public static final BountyBusinessGoalType OTHER = new BountyBusinessGoalType(Value.OTHER, "other"); + + public static final BountyBusinessGoalType UGC_CONTENT = + new BountyBusinessGoalType(Value.UGC_CONTENT, "ugc_content"); + + public static final BountyBusinessGoalType CLIPPING = new BountyBusinessGoalType(Value.CLIPPING, "clipping"); + + public static final BountyBusinessGoalType POST_ENGAGEMENT = + new BountyBusinessGoalType(Value.POST_ENGAGEMENT, "post_engagement"); + + public static final BountyBusinessGoalType OWNED_ACCOUNT_GROWTH = + new BountyBusinessGoalType(Value.OWNED_ACCOUNT_GROWTH, "owned_account_growth"); + + public static final BountyBusinessGoalType DATA_CAPTURE = + new BountyBusinessGoalType(Value.DATA_CAPTURE, "data_capture"); + + private final Value value; + + private final String string; + + BountyBusinessGoalType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BountyBusinessGoalType + && this.string.equals(((BountyBusinessGoalType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LOCAL_ACTIVATION: + return visitor.visitLocalActivation(); + case OTHER: + return visitor.visitOther(); + case UGC_CONTENT: + return visitor.visitUgcContent(); + case CLIPPING: + return visitor.visitClipping(); + case POST_ENGAGEMENT: + return visitor.visitPostEngagement(); + case OWNED_ACCOUNT_GROWTH: + return visitor.visitOwnedAccountGrowth(); + case DATA_CAPTURE: + return visitor.visitDataCapture(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BountyBusinessGoalType valueOf(String value) { + switch (value) { + case "local_activation": + return LOCAL_ACTIVATION; + case "other": + return OTHER; + case "ugc_content": + return UGC_CONTENT; + case "clipping": + return CLIPPING; + case "post_engagement": + return POST_ENGAGEMENT; + case "owned_account_growth": + return OWNED_ACCOUNT_GROWTH; + case "data_capture": + return DATA_CAPTURE; + default: + return new BountyBusinessGoalType(Value.UNKNOWN, value); + } + } + + public enum Value { + CLIPPING, + + POST_ENGAGEMENT, + + OWNED_ACCOUNT_GROWTH, + + UGC_CONTENT, + + LOCAL_ACTIVATION, + + DATA_CAPTURE, + + OTHER, + + UNKNOWN + } + + public interface Visitor { + T visitClipping(); + + T visitPostEngagement(); + + T visitOwnedAccountGrowth(); + + T visitUgcContent(); + + T visitLocalActivation(); + + T visitDataCapture(); + + T visitOther(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/BountyCaptureClip.java b/src/main/java/com/whop/api/types/BountyCaptureClip.java new file mode 100644 index 00000000..5a5e1b14 --- /dev/null +++ b/src/main/java/com/whop/api/types/BountyCaptureClip.java @@ -0,0 +1,907 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BountyCaptureClip.Builder.class) +public final class BountyCaptureClip { + private final String bountySubmissionId; + + private final String createdAt; + + private final Optional durationSeconds; + + private final Optional failureCode; + + private final Optional failureMessage; + + private final Optional framesUrl; + + private final String id; + + private final Optional imuUrl; + + private final Optional manifestUrl; + + private final Optional readyAt; + + private final int sequence; + + private final BountyCaptureClipStatus status; + + private final String updatedAt; + + private final Optional videoUrl; + + private final Map additionalProperties; + + private BountyCaptureClip( + String bountySubmissionId, + String createdAt, + Optional durationSeconds, + Optional failureCode, + Optional failureMessage, + Optional framesUrl, + String id, + Optional imuUrl, + Optional manifestUrl, + Optional readyAt, + int sequence, + BountyCaptureClipStatus status, + String updatedAt, + Optional videoUrl, + Map additionalProperties) { + this.bountySubmissionId = bountySubmissionId; + this.createdAt = createdAt; + this.durationSeconds = durationSeconds; + this.failureCode = failureCode; + this.failureMessage = failureMessage; + this.framesUrl = framesUrl; + this.id = id; + this.imuUrl = imuUrl; + this.manifestUrl = manifestUrl; + this.readyAt = readyAt; + this.sequence = sequence; + this.status = status; + this.updatedAt = updatedAt; + this.videoUrl = videoUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The bounty submission (attempt) this clip belongs to, prefixed btys_. + */ + @JsonProperty("bounty_submission_id") + public String getBountySubmissionId() { + return bountySubmissionId; + } + + /** + * @return When the clip was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Server-validated clip duration in whole seconds. null until validation completes. + */ + @JsonIgnore + public Optional getDurationSeconds() { + if (durationSeconds == null) { + return Optional.empty(); + } + return durationSeconds; + } + + /** + * @return Stable validation failure code. null unless status is failed. + */ + @JsonIgnore + public Optional getFailureCode() { + if (failureCode == null) { + return Optional.empty(); + } + return failureCode; + } + + /** + * @return Human-readable validation failure reason. null unless status is failed. + */ + @JsonIgnore + public Optional getFailureMessage() { + if (failureMessage == null) { + return Optional.empty(); + } + return failureMessage; + } + + /** + * @return Temporary signed URL for the video frame timestamp log. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached. + */ + @JsonIgnore + public Optional getFramesUrl() { + if (framesUrl == null) { + return Optional.empty(); + } + return framesUrl; + } + + /** + * @return Capture clip ID, prefixed bclip_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Temporary signed URL for the IMU (accelerometer + gyroscope) log. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached. + */ + @JsonIgnore + public Optional getImuUrl() { + if (imuUrl == null) { + return Optional.empty(); + } + return imuUrl; + } + + /** + * @return Temporary signed URL for the capture manifest. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached. + */ + @JsonIgnore + public Optional getManifestUrl() { + if (manifestUrl == null) { + return Optional.empty(); + } + return manifestUrl; + } + + /** + * @return When server-side validation completed successfully, as an ISO 8601 timestamp. null until then. + */ + @JsonIgnore + public Optional getReadyAt() { + if (readyAt == null) { + return Optional.empty(); + } + return readyAt; + } + + /** + * @return The clip's stable order within the attempt, starting at 1. + */ + @JsonProperty("sequence") + public int getSequence() { + return sequence; + } + + /** + * @return Recording and validation state. recording is still capturing; verifying is running server-side validation; ready passed validation and counts toward the verified-duration payout gate; failed did not validate. + */ + @JsonProperty("status") + public BountyCaptureClipStatus getStatus() { + return status; + } + + /** + * @return When the clip was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return Temporary signed URL for the synchronized MP4 video. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached. + */ + @JsonIgnore + public Optional getVideoUrl() { + if (videoUrl == null) { + return Optional.empty(); + } + return videoUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("duration_seconds") + private Optional _getDurationSeconds() { + return durationSeconds; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_code") + private Optional _getFailureCode() { + return failureCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_message") + private Optional _getFailureMessage() { + return failureMessage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("frames_url") + private Optional _getFramesUrl() { + return framesUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("imu_url") + private Optional _getImuUrl() { + return imuUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("manifest_url") + private Optional _getManifestUrl() { + return manifestUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ready_at") + private Optional _getReadyAt() { + return readyAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("video_url") + private Optional _getVideoUrl() { + return videoUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BountyCaptureClip && equalTo((BountyCaptureClip) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BountyCaptureClip other) { + return bountySubmissionId.equals(other.bountySubmissionId) + && createdAt.equals(other.createdAt) + && durationSeconds.equals(other.durationSeconds) + && failureCode.equals(other.failureCode) + && failureMessage.equals(other.failureMessage) + && framesUrl.equals(other.framesUrl) + && id.equals(other.id) + && imuUrl.equals(other.imuUrl) + && manifestUrl.equals(other.manifestUrl) + && readyAt.equals(other.readyAt) + && sequence == other.sequence + && status.equals(other.status) + && updatedAt.equals(other.updatedAt) + && videoUrl.equals(other.videoUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bountySubmissionId, + this.createdAt, + this.durationSeconds, + this.failureCode, + this.failureMessage, + this.framesUrl, + this.id, + this.imuUrl, + this.manifestUrl, + this.readyAt, + this.sequence, + this.status, + this.updatedAt, + this.videoUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BountySubmissionIdStage builder() { + return new Builder(); + } + + public interface BountySubmissionIdStage { + /** + *

The bounty submission (attempt) this clip belongs to, prefixed btys_.

+ */ + CreatedAtStage bountySubmissionId(@NotNull String bountySubmissionId); + + Builder from(BountyCaptureClip other); + } + + public interface CreatedAtStage { + /** + *

When the clip was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Capture clip ID, prefixed bclip_.

+ */ + SequenceStage id(@NotNull String id); + } + + public interface SequenceStage { + /** + *

The clip's stable order within the attempt, starting at 1.

+ */ + StatusStage sequence(int sequence); + } + + public interface StatusStage { + /** + *

Recording and validation state. recording is still capturing; verifying is running server-side validation; ready passed validation and counts toward the verified-duration payout gate; failed did not validate.

+ */ + UpdatedAtStage status(@NotNull BountyCaptureClipStatus status); + } + + public interface UpdatedAtStage { + /** + *

When the clip was last updated, as an ISO 8601 timestamp.

+ */ + _FinalStage updatedAt(@NotNull String updatedAt); + } + + public interface _FinalStage { + BountyCaptureClip build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Server-validated clip duration in whole seconds. null until validation completes.

+ */ + _FinalStage durationSeconds(Optional durationSeconds); + + _FinalStage durationSeconds(Integer durationSeconds); + + _FinalStage durationSeconds(Nullable durationSeconds); + + /** + *

Stable validation failure code. null unless status is failed.

+ */ + _FinalStage failureCode(Optional failureCode); + + _FinalStage failureCode(String failureCode); + + _FinalStage failureCode(Nullable failureCode); + + /** + *

Human-readable validation failure reason. null unless status is failed.

+ */ + _FinalStage failureMessage(Optional failureMessage); + + _FinalStage failureMessage(String failureMessage); + + _FinalStage failureMessage(Nullable failureMessage); + + /** + *

Temporary signed URL for the video frame timestamp log. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ */ + _FinalStage framesUrl(Optional framesUrl); + + _FinalStage framesUrl(String framesUrl); + + _FinalStage framesUrl(Nullable framesUrl); + + /** + *

Temporary signed URL for the IMU (accelerometer + gyroscope) log. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ */ + _FinalStage imuUrl(Optional imuUrl); + + _FinalStage imuUrl(String imuUrl); + + _FinalStage imuUrl(Nullable imuUrl); + + /** + *

Temporary signed URL for the capture manifest. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ */ + _FinalStage manifestUrl(Optional manifestUrl); + + _FinalStage manifestUrl(String manifestUrl); + + _FinalStage manifestUrl(Nullable manifestUrl); + + /** + *

When server-side validation completed successfully, as an ISO 8601 timestamp. null until then.

+ */ + _FinalStage readyAt(Optional readyAt); + + _FinalStage readyAt(String readyAt); + + _FinalStage readyAt(Nullable readyAt); + + /** + *

Temporary signed URL for the synchronized MP4 video. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ */ + _FinalStage videoUrl(Optional videoUrl); + + _FinalStage videoUrl(String videoUrl); + + _FinalStage videoUrl(Nullable videoUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BountySubmissionIdStage, + CreatedAtStage, + IdStage, + SequenceStage, + StatusStage, + UpdatedAtStage, + _FinalStage { + private String bountySubmissionId; + + private String createdAt; + + private String id; + + private int sequence; + + private BountyCaptureClipStatus status; + + private String updatedAt; + + private Optional videoUrl = Optional.empty(); + + private Optional readyAt = Optional.empty(); + + private Optional manifestUrl = Optional.empty(); + + private Optional imuUrl = Optional.empty(); + + private Optional framesUrl = Optional.empty(); + + private Optional failureMessage = Optional.empty(); + + private Optional failureCode = Optional.empty(); + + private Optional durationSeconds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BountyCaptureClip other) { + bountySubmissionId(other.getBountySubmissionId()); + createdAt(other.getCreatedAt()); + durationSeconds(other.getDurationSeconds()); + failureCode(other.getFailureCode()); + failureMessage(other.getFailureMessage()); + framesUrl(other.getFramesUrl()); + id(other.getId()); + imuUrl(other.getImuUrl()); + manifestUrl(other.getManifestUrl()); + readyAt(other.getReadyAt()); + sequence(other.getSequence()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + videoUrl(other.getVideoUrl()); + return this; + } + + /** + *

The bounty submission (attempt) this clip belongs to, prefixed btys_.

+ *

The bounty submission (attempt) this clip belongs to, prefixed btys_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bounty_submission_id") + public CreatedAtStage bountySubmissionId(@NotNull String bountySubmissionId) { + this.bountySubmissionId = Objects.requireNonNull(bountySubmissionId, "bountySubmissionId must not be null"); + return this; + } + + /** + *

When the clip was created, as an ISO 8601 timestamp.

+ *

When the clip was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Capture clip ID, prefixed bclip_.

+ *

Capture clip ID, prefixed bclip_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public SequenceStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The clip's stable order within the attempt, starting at 1.

+ *

The clip's stable order within the attempt, starting at 1.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sequence") + public StatusStage sequence(int sequence) { + this.sequence = sequence; + return this; + } + + /** + *

Recording and validation state. recording is still capturing; verifying is running server-side validation; ready passed validation and counts toward the verified-duration payout gate; failed did not validate.

+ *

Recording and validation state. recording is still capturing; verifying is running server-side validation; ready passed validation and counts toward the verified-duration payout gate; failed did not validate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull BountyCaptureClipStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

When the clip was last updated, as an ISO 8601 timestamp.

+ *

When the clip was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

Temporary signed URL for the synchronized MP4 video. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage videoUrl(Nullable videoUrl) { + if (videoUrl.isNull()) { + this.videoUrl = null; + } else if (videoUrl.isEmpty()) { + this.videoUrl = Optional.empty(); + } else { + this.videoUrl = Optional.of(videoUrl.get()); + } + return this; + } + + /** + *

Temporary signed URL for the synchronized MP4 video. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage videoUrl(String videoUrl) { + this.videoUrl = Optional.ofNullable(videoUrl); + return this; + } + + /** + *

Temporary signed URL for the synchronized MP4 video. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ */ + @java.lang.Override + @JsonSetter(value = "video_url", nulls = Nulls.SKIP) + public _FinalStage videoUrl(Optional videoUrl) { + this.videoUrl = videoUrl; + return this; + } + + /** + *

When server-side validation completed successfully, as an ISO 8601 timestamp. null until then.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage readyAt(Nullable readyAt) { + if (readyAt.isNull()) { + this.readyAt = null; + } else if (readyAt.isEmpty()) { + this.readyAt = Optional.empty(); + } else { + this.readyAt = Optional.of(readyAt.get()); + } + return this; + } + + /** + *

When server-side validation completed successfully, as an ISO 8601 timestamp. null until then.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage readyAt(String readyAt) { + this.readyAt = Optional.ofNullable(readyAt); + return this; + } + + /** + *

When server-side validation completed successfully, as an ISO 8601 timestamp. null until then.

+ */ + @java.lang.Override + @JsonSetter(value = "ready_at", nulls = Nulls.SKIP) + public _FinalStage readyAt(Optional readyAt) { + this.readyAt = readyAt; + return this; + } + + /** + *

Temporary signed URL for the capture manifest. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage manifestUrl(Nullable manifestUrl) { + if (manifestUrl.isNull()) { + this.manifestUrl = null; + } else if (manifestUrl.isEmpty()) { + this.manifestUrl = Optional.empty(); + } else { + this.manifestUrl = Optional.of(manifestUrl.get()); + } + return this; + } + + /** + *

Temporary signed URL for the capture manifest. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage manifestUrl(String manifestUrl) { + this.manifestUrl = Optional.ofNullable(manifestUrl); + return this; + } + + /** + *

Temporary signed URL for the capture manifest. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ */ + @java.lang.Override + @JsonSetter(value = "manifest_url", nulls = Nulls.SKIP) + public _FinalStage manifestUrl(Optional manifestUrl) { + this.manifestUrl = manifestUrl; + return this; + } + + /** + *

Temporary signed URL for the IMU (accelerometer + gyroscope) log. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage imuUrl(Nullable imuUrl) { + if (imuUrl.isNull()) { + this.imuUrl = null; + } else if (imuUrl.isEmpty()) { + this.imuUrl = Optional.empty(); + } else { + this.imuUrl = Optional.of(imuUrl.get()); + } + return this; + } + + /** + *

Temporary signed URL for the IMU (accelerometer + gyroscope) log. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage imuUrl(String imuUrl) { + this.imuUrl = Optional.ofNullable(imuUrl); + return this; + } + + /** + *

Temporary signed URL for the IMU (accelerometer + gyroscope) log. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ */ + @java.lang.Override + @JsonSetter(value = "imu_url", nulls = Nulls.SKIP) + public _FinalStage imuUrl(Optional imuUrl) { + this.imuUrl = imuUrl; + return this; + } + + /** + *

Temporary signed URL for the video frame timestamp log. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage framesUrl(Nullable framesUrl) { + if (framesUrl.isNull()) { + this.framesUrl = null; + } else if (framesUrl.isEmpty()) { + this.framesUrl = Optional.empty(); + } else { + this.framesUrl = Optional.of(framesUrl.get()); + } + return this; + } + + /** + *

Temporary signed URL for the video frame timestamp log. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage framesUrl(String framesUrl) { + this.framesUrl = Optional.ofNullable(framesUrl); + return this; + } + + /** + *

Temporary signed URL for the video frame timestamp log. Returned only on single-clip reads for an authorized viewer; null on list responses or until the artifact is attached.

+ */ + @java.lang.Override + @JsonSetter(value = "frames_url", nulls = Nulls.SKIP) + public _FinalStage framesUrl(Optional framesUrl) { + this.framesUrl = framesUrl; + return this; + } + + /** + *

Human-readable validation failure reason. null unless status is failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureMessage(Nullable failureMessage) { + if (failureMessage.isNull()) { + this.failureMessage = null; + } else if (failureMessage.isEmpty()) { + this.failureMessage = Optional.empty(); + } else { + this.failureMessage = Optional.of(failureMessage.get()); + } + return this; + } + + /** + *

Human-readable validation failure reason. null unless status is failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureMessage(String failureMessage) { + this.failureMessage = Optional.ofNullable(failureMessage); + return this; + } + + /** + *

Human-readable validation failure reason. null unless status is failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_message", nulls = Nulls.SKIP) + public _FinalStage failureMessage(Optional failureMessage) { + this.failureMessage = failureMessage; + return this; + } + + /** + *

Stable validation failure code. null unless status is failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureCode(Nullable failureCode) { + if (failureCode.isNull()) { + this.failureCode = null; + } else if (failureCode.isEmpty()) { + this.failureCode = Optional.empty(); + } else { + this.failureCode = Optional.of(failureCode.get()); + } + return this; + } + + /** + *

Stable validation failure code. null unless status is failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureCode(String failureCode) { + this.failureCode = Optional.ofNullable(failureCode); + return this; + } + + /** + *

Stable validation failure code. null unless status is failed.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_code", nulls = Nulls.SKIP) + public _FinalStage failureCode(Optional failureCode) { + this.failureCode = failureCode; + return this; + } + + /** + *

Server-validated clip duration in whole seconds. null until validation completes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage durationSeconds(Nullable durationSeconds) { + if (durationSeconds.isNull()) { + this.durationSeconds = null; + } else if (durationSeconds.isEmpty()) { + this.durationSeconds = Optional.empty(); + } else { + this.durationSeconds = Optional.of(durationSeconds.get()); + } + return this; + } + + /** + *

Server-validated clip duration in whole seconds. null until validation completes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage durationSeconds(Integer durationSeconds) { + this.durationSeconds = Optional.ofNullable(durationSeconds); + return this; + } + + /** + *

Server-validated clip duration in whole seconds. null until validation completes.

+ */ + @java.lang.Override + @JsonSetter(value = "duration_seconds", nulls = Nulls.SKIP) + public _FinalStage durationSeconds(Optional durationSeconds) { + this.durationSeconds = durationSeconds; + return this; + } + + @java.lang.Override + public BountyCaptureClip build() { + return new BountyCaptureClip( + bountySubmissionId, + createdAt, + durationSeconds, + failureCode, + failureMessage, + framesUrl, + id, + imuUrl, + manifestUrl, + readyAt, + sequence, + status, + updatedAt, + videoUrl, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/BountyCaptureClipStatus.java b/src/main/java/com/whop/api/types/BountyCaptureClipStatus.java new file mode 100644 index 00000000..69cb7035 --- /dev/null +++ b/src/main/java/com/whop/api/types/BountyCaptureClipStatus.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BountyCaptureClipStatus { + public static final BountyCaptureClipStatus FAILED = new BountyCaptureClipStatus(Value.FAILED, "failed"); + + public static final BountyCaptureClipStatus RECORDING = new BountyCaptureClipStatus(Value.RECORDING, "recording"); + + public static final BountyCaptureClipStatus VERIFYING = new BountyCaptureClipStatus(Value.VERIFYING, "verifying"); + + public static final BountyCaptureClipStatus READY = new BountyCaptureClipStatus(Value.READY, "ready"); + + private final Value value; + + private final String string; + + BountyCaptureClipStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BountyCaptureClipStatus + && this.string.equals(((BountyCaptureClipStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case RECORDING: + return visitor.visitRecording(); + case VERIFYING: + return visitor.visitVerifying(); + case READY: + return visitor.visitReady(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BountyCaptureClipStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "recording": + return RECORDING; + case "verifying": + return VERIFYING; + case "ready": + return READY; + default: + return new BountyCaptureClipStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + RECORDING, + + VERIFYING, + + READY, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitRecording(); + + T visitVerifying(); + + T visitReady(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/BountyCurrency.java b/src/main/java/com/whop/api/types/BountyCurrency.java new file mode 100644 index 00000000..c7ca6fa3 --- /dev/null +++ b/src/main/java/com/whop/api/types/BountyCurrency.java @@ -0,0 +1,903 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BountyCurrency { + public static final BountyCurrency CRC = new BountyCurrency(Value.CRC, "crc"); + + public static final BountyCurrency OMR = new BountyCurrency(Value.OMR, "omr"); + + public static final BountyCurrency RUB = new BountyCurrency(Value.RUB, "rub"); + + public static final BountyCurrency BGN = new BountyCurrency(Value.BGN, "bgn"); + + public static final BountyCurrency SAR = new BountyCurrency(Value.SAR, "sar"); + + public static final BountyCurrency UYU = new BountyCurrency(Value.UYU, "uyu"); + + public static final BountyCurrency TZS = new BountyCurrency(Value.TZS, "tzs"); + + public static final BountyCurrency XCD = new BountyCurrency(Value.XCD, "xcd"); + + public static final BountyCurrency GTQ = new BountyCurrency(Value.GTQ, "gtq"); + + public static final BountyCurrency CHF = new BountyCurrency(Value.CHF, "chf"); + + public static final BountyCurrency RON = new BountyCurrency(Value.RON, "ron"); + + public static final BountyCurrency PHP = new BountyCurrency(Value.PHP, "php"); + + public static final BountyCurrency KES = new BountyCurrency(Value.KES, "kes"); + + public static final BountyCurrency BSD = new BountyCurrency(Value.BSD, "bsd"); + + public static final BountyCurrency INR = new BountyCurrency(Value.INR, "inr"); + + public static final BountyCurrency HKD = new BountyCurrency(Value.HKD, "hkd"); + + public static final BountyCurrency JOD = new BountyCurrency(Value.JOD, "jod"); + + public static final BountyCurrency MKD = new BountyCurrency(Value.MKD, "mkd"); + + public static final BountyCurrency CLP = new BountyCurrency(Value.CLP, "clp"); + + public static final BountyCurrency NZD = new BountyCurrency(Value.NZD, "nzd"); + + public static final BountyCurrency IDR = new BountyCurrency(Value.IDR, "idr"); + + public static final BountyCurrency MOP = new BountyCurrency(Value.MOP, "mop"); + + public static final BountyCurrency HUF = new BountyCurrency(Value.HUF, "huf"); + + public static final BountyCurrency MAD = new BountyCurrency(Value.MAD, "mad"); + + public static final BountyCurrency KHR = new BountyCurrency(Value.KHR, "khr"); + + public static final BountyCurrency NGN = new BountyCurrency(Value.NGN, "ngn"); + + public static final BountyCurrency THB = new BountyCurrency(Value.THB, "thb"); + + public static final BountyCurrency DZD = new BountyCurrency(Value.DZD, "dzd"); + + public static final BountyCurrency ARS = new BountyCurrency(Value.ARS, "ars"); + + public static final BountyCurrency CAD = new BountyCurrency(Value.CAD, "cad"); + + public static final BountyCurrency MYR = new BountyCurrency(Value.MYR, "myr"); + + public static final BountyCurrency KRW = new BountyCurrency(Value.KRW, "krw"); + + public static final BountyCurrency KZT = new BountyCurrency(Value.KZT, "kzt"); + + public static final BountyCurrency COP = new BountyCurrency(Value.COP, "cop"); + + public static final BountyCurrency JMD = new BountyCurrency(Value.JMD, "jmd"); + + public static final BountyCurrency NAD = new BountyCurrency(Value.NAD, "nad"); + + public static final BountyCurrency GYD = new BountyCurrency(Value.GYD, "gyd"); + + public static final BountyCurrency KWD = new BountyCurrency(Value.KWD, "kwd"); + + public static final BountyCurrency DOP = new BountyCurrency(Value.DOP, "dop"); + + public static final BountyCurrency AMD = new BountyCurrency(Value.AMD, "amd"); + + public static final BountyCurrency LKR = new BountyCurrency(Value.LKR, "lkr"); + + public static final BountyCurrency ALL = new BountyCurrency(Value.ALL, "all"); + + public static final BountyCurrency TND = new BountyCurrency(Value.TND, "tnd"); + + public static final BountyCurrency MUR = new BountyCurrency(Value.MUR, "mur"); + + public static final BountyCurrency PEN = new BountyCurrency(Value.PEN, "pen"); + + public static final BountyCurrency USD = new BountyCurrency(Value.USD, "usd"); + + public static final BountyCurrency BHD = new BountyCurrency(Value.BHD, "bhd"); + + public static final BountyCurrency XOF = new BountyCurrency(Value.XOF, "xof"); + + public static final BountyCurrency RWF = new BountyCurrency(Value.RWF, "rwf"); + + public static final BountyCurrency GBP = new BountyCurrency(Value.GBP, "gbp"); + + public static final BountyCurrency VND = new BountyCurrency(Value.VND, "vnd"); + + public static final BountyCurrency MNT = new BountyCurrency(Value.MNT, "mnt"); + + public static final BountyCurrency ETB = new BountyCurrency(Value.ETB, "etb"); + + public static final BountyCurrency TTD = new BountyCurrency(Value.TTD, "ttd"); + + public static final BountyCurrency EUR = new BountyCurrency(Value.EUR, "eur"); + + public static final BountyCurrency BRL = new BountyCurrency(Value.BRL, "brl"); + + public static final BountyCurrency SEK = new BountyCurrency(Value.SEK, "sek"); + + public static final BountyCurrency RSD = new BountyCurrency(Value.RSD, "rsd"); + + public static final BountyCurrency UZS = new BountyCurrency(Value.UZS, "uzs"); + + public static final BountyCurrency TWD = new BountyCurrency(Value.TWD, "twd"); + + public static final BountyCurrency NOK = new BountyCurrency(Value.NOK, "nok"); + + public static final BountyCurrency PYG = new BountyCurrency(Value.PYG, "pyg"); + + public static final BountyCurrency TRY = new BountyCurrency(Value.TRY, "try"); + + public static final BountyCurrency ZAR = new BountyCurrency(Value.ZAR, "zar"); + + public static final BountyCurrency PKR = new BountyCurrency(Value.PKR, "pkr"); + + public static final BountyCurrency CNY = new BountyCurrency(Value.CNY, "cny"); + + public static final BountyCurrency CZK = new BountyCurrency(Value.CZK, "czk"); + + public static final BountyCurrency ILS = new BountyCurrency(Value.ILS, "ils"); + + public static final BountyCurrency MGA = new BountyCurrency(Value.MGA, "mga"); + + public static final BountyCurrency AED = new BountyCurrency(Value.AED, "aed"); + + public static final BountyCurrency GHS = new BountyCurrency(Value.GHS, "ghs"); + + public static final BountyCurrency BAM = new BountyCurrency(Value.BAM, "bam"); + + public static final BountyCurrency JPY = new BountyCurrency(Value.JPY, "jpy"); + + public static final BountyCurrency PLN = new BountyCurrency(Value.PLN, "pln"); + + public static final BountyCurrency BOB = new BountyCurrency(Value.BOB, "bob"); + + public static final BountyCurrency QAR = new BountyCurrency(Value.QAR, "qar"); + + public static final BountyCurrency EGP = new BountyCurrency(Value.EGP, "egp"); + + public static final BountyCurrency AWG = new BountyCurrency(Value.AWG, "awg"); + + public static final BountyCurrency DKK = new BountyCurrency(Value.DKK, "dkk"); + + public static final BountyCurrency MDL = new BountyCurrency(Value.MDL, "mdl"); + + public static final BountyCurrency MXN = new BountyCurrency(Value.MXN, "mxn"); + + public static final BountyCurrency SGD = new BountyCurrency(Value.SGD, "sgd"); + + public static final BountyCurrency AUD = new BountyCurrency(Value.AUD, "aud"); + + public static final BountyCurrency GMD = new BountyCurrency(Value.GMD, "gmd"); + + private final Value value; + + private final String string; + + BountyCurrency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BountyCurrency && this.string.equals(((BountyCurrency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CRC: + return visitor.visitCrc(); + case OMR: + return visitor.visitOmr(); + case RUB: + return visitor.visitRub(); + case BGN: + return visitor.visitBgn(); + case SAR: + return visitor.visitSar(); + case UYU: + return visitor.visitUyu(); + case TZS: + return visitor.visitTzs(); + case XCD: + return visitor.visitXcd(); + case GTQ: + return visitor.visitGtq(); + case CHF: + return visitor.visitChf(); + case RON: + return visitor.visitRon(); + case PHP: + return visitor.visitPhp(); + case KES: + return visitor.visitKes(); + case BSD: + return visitor.visitBsd(); + case INR: + return visitor.visitInr(); + case HKD: + return visitor.visitHkd(); + case JOD: + return visitor.visitJod(); + case MKD: + return visitor.visitMkd(); + case CLP: + return visitor.visitClp(); + case NZD: + return visitor.visitNzd(); + case IDR: + return visitor.visitIdr(); + case MOP: + return visitor.visitMop(); + case HUF: + return visitor.visitHuf(); + case MAD: + return visitor.visitMad(); + case KHR: + return visitor.visitKhr(); + case NGN: + return visitor.visitNgn(); + case THB: + return visitor.visitThb(); + case DZD: + return visitor.visitDzd(); + case ARS: + return visitor.visitArs(); + case CAD: + return visitor.visitCad(); + case MYR: + return visitor.visitMyr(); + case KRW: + return visitor.visitKrw(); + case KZT: + return visitor.visitKzt(); + case COP: + return visitor.visitCop(); + case JMD: + return visitor.visitJmd(); + case NAD: + return visitor.visitNad(); + case GYD: + return visitor.visitGyd(); + case KWD: + return visitor.visitKwd(); + case DOP: + return visitor.visitDop(); + case AMD: + return visitor.visitAmd(); + case LKR: + return visitor.visitLkr(); + case ALL: + return visitor.visitAll(); + case TND: + return visitor.visitTnd(); + case MUR: + return visitor.visitMur(); + case PEN: + return visitor.visitPen(); + case USD: + return visitor.visitUsd(); + case BHD: + return visitor.visitBhd(); + case XOF: + return visitor.visitXof(); + case RWF: + return visitor.visitRwf(); + case GBP: + return visitor.visitGbp(); + case VND: + return visitor.visitVnd(); + case MNT: + return visitor.visitMnt(); + case ETB: + return visitor.visitEtb(); + case TTD: + return visitor.visitTtd(); + case EUR: + return visitor.visitEur(); + case BRL: + return visitor.visitBrl(); + case SEK: + return visitor.visitSek(); + case RSD: + return visitor.visitRsd(); + case UZS: + return visitor.visitUzs(); + case TWD: + return visitor.visitTwd(); + case NOK: + return visitor.visitNok(); + case PYG: + return visitor.visitPyg(); + case TRY: + return visitor.visitTry(); + case ZAR: + return visitor.visitZar(); + case PKR: + return visitor.visitPkr(); + case CNY: + return visitor.visitCny(); + case CZK: + return visitor.visitCzk(); + case ILS: + return visitor.visitIls(); + case MGA: + return visitor.visitMga(); + case AED: + return visitor.visitAed(); + case GHS: + return visitor.visitGhs(); + case BAM: + return visitor.visitBam(); + case JPY: + return visitor.visitJpy(); + case PLN: + return visitor.visitPln(); + case BOB: + return visitor.visitBob(); + case QAR: + return visitor.visitQar(); + case EGP: + return visitor.visitEgp(); + case AWG: + return visitor.visitAwg(); + case DKK: + return visitor.visitDkk(); + case MDL: + return visitor.visitMdl(); + case MXN: + return visitor.visitMxn(); + case SGD: + return visitor.visitSgd(); + case AUD: + return visitor.visitAud(); + case GMD: + return visitor.visitGmd(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BountyCurrency valueOf(String value) { + switch (value) { + case "crc": + return CRC; + case "omr": + return OMR; + case "rub": + return RUB; + case "bgn": + return BGN; + case "sar": + return SAR; + case "uyu": + return UYU; + case "tzs": + return TZS; + case "xcd": + return XCD; + case "gtq": + return GTQ; + case "chf": + return CHF; + case "ron": + return RON; + case "php": + return PHP; + case "kes": + return KES; + case "bsd": + return BSD; + case "inr": + return INR; + case "hkd": + return HKD; + case "jod": + return JOD; + case "mkd": + return MKD; + case "clp": + return CLP; + case "nzd": + return NZD; + case "idr": + return IDR; + case "mop": + return MOP; + case "huf": + return HUF; + case "mad": + return MAD; + case "khr": + return KHR; + case "ngn": + return NGN; + case "thb": + return THB; + case "dzd": + return DZD; + case "ars": + return ARS; + case "cad": + return CAD; + case "myr": + return MYR; + case "krw": + return KRW; + case "kzt": + return KZT; + case "cop": + return COP; + case "jmd": + return JMD; + case "nad": + return NAD; + case "gyd": + return GYD; + case "kwd": + return KWD; + case "dop": + return DOP; + case "amd": + return AMD; + case "lkr": + return LKR; + case "all": + return ALL; + case "tnd": + return TND; + case "mur": + return MUR; + case "pen": + return PEN; + case "usd": + return USD; + case "bhd": + return BHD; + case "xof": + return XOF; + case "rwf": + return RWF; + case "gbp": + return GBP; + case "vnd": + return VND; + case "mnt": + return MNT; + case "etb": + return ETB; + case "ttd": + return TTD; + case "eur": + return EUR; + case "brl": + return BRL; + case "sek": + return SEK; + case "rsd": + return RSD; + case "uzs": + return UZS; + case "twd": + return TWD; + case "nok": + return NOK; + case "pyg": + return PYG; + case "try": + return TRY; + case "zar": + return ZAR; + case "pkr": + return PKR; + case "cny": + return CNY; + case "czk": + return CZK; + case "ils": + return ILS; + case "mga": + return MGA; + case "aed": + return AED; + case "ghs": + return GHS; + case "bam": + return BAM; + case "jpy": + return JPY; + case "pln": + return PLN; + case "bob": + return BOB; + case "qar": + return QAR; + case "egp": + return EGP; + case "awg": + return AWG; + case "dkk": + return DKK; + case "mdl": + return MDL; + case "mxn": + return MXN; + case "sgd": + return SGD; + case "aud": + return AUD; + case "gmd": + return GMD; + default: + return new BountyCurrency(Value.UNKNOWN, value); + } + } + + public enum Value { + USD, + + SGD, + + INR, + + AUD, + + BRL, + + CAD, + + DKK, + + EUR, + + NOK, + + GBP, + + SEK, + + CHF, + + HKD, + + HUF, + + JPY, + + MXN, + + MYR, + + PLN, + + CZK, + + NZD, + + AED, + + COP, + + RON, + + THB, + + BGN, + + IDR, + + DOP, + + PHP, + + TRY, + + KRW, + + TWD, + + VND, + + PKR, + + CLP, + + UYU, + + ARS, + + ZAR, + + DZD, + + TND, + + MAD, + + KES, + + KWD, + + JOD, + + ALL, + + XCD, + + AMD, + + BSD, + + BHD, + + BOB, + + BAM, + + KHR, + + CRC, + + XOF, + + EGP, + + ETB, + + GMD, + + GHS, + + GTQ, + + GYD, + + ILS, + + JMD, + + MOP, + + MGA, + + MUR, + + MDL, + + MNT, + + NAD, + + NGN, + + MKD, + + OMR, + + PYG, + + PEN, + + QAR, + + RWF, + + SAR, + + RSD, + + LKR, + + TZS, + + TTD, + + UZS, + + RUB, + + CNY, + + KZT, + + AWG, + + UNKNOWN + } + + public interface Visitor { + T visitUsd(); + + T visitSgd(); + + T visitInr(); + + T visitAud(); + + T visitBrl(); + + T visitCad(); + + T visitDkk(); + + T visitEur(); + + T visitNok(); + + T visitGbp(); + + T visitSek(); + + T visitChf(); + + T visitHkd(); + + T visitHuf(); + + T visitJpy(); + + T visitMxn(); + + T visitMyr(); + + T visitPln(); + + T visitCzk(); + + T visitNzd(); + + T visitAed(); + + T visitCop(); + + T visitRon(); + + T visitThb(); + + T visitBgn(); + + T visitIdr(); + + T visitDop(); + + T visitPhp(); + + T visitTry(); + + T visitKrw(); + + T visitTwd(); + + T visitVnd(); + + T visitPkr(); + + T visitClp(); + + T visitUyu(); + + T visitArs(); + + T visitZar(); + + T visitDzd(); + + T visitTnd(); + + T visitMad(); + + T visitKes(); + + T visitKwd(); + + T visitJod(); + + T visitAll(); + + T visitXcd(); + + T visitAmd(); + + T visitBsd(); + + T visitBhd(); + + T visitBob(); + + T visitBam(); + + T visitKhr(); + + T visitCrc(); + + T visitXof(); + + T visitEgp(); + + T visitEtb(); + + T visitGmd(); + + T visitGhs(); + + T visitGtq(); + + T visitGyd(); + + T visitIls(); + + T visitJmd(); + + T visitMop(); + + T visitMga(); + + T visitMur(); + + T visitMdl(); + + T visitMnt(); + + T visitNad(); + + T visitNgn(); + + T visitMkd(); + + T visitOmr(); + + T visitPyg(); + + T visitPen(); + + T visitQar(); + + T visitRwf(); + + T visitSar(); + + T visitRsd(); + + T visitLkr(); + + T visitTzs(); + + T visitTtd(); + + T visitUzs(); + + T visitRub(); + + T visitCny(); + + T visitKzt(); + + T visitAwg(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/BountyListItem.java b/src/main/java/com/whop/api/types/BountyListItem.java new file mode 100644 index 00000000..32abd8d6 --- /dev/null +++ b/src/main/java/com/whop/api/types/BountyListItem.java @@ -0,0 +1,1641 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BountyListItem.Builder.class) +public final class BountyListItem { + private final List acceptedDeliverableTypes; + + private final int acceptedSubmissionsCount; + + private final int acceptedSubmissionsLimit; + + private final int acceptedSubmissionsPerUserLimit; + + private final double affiliateShareAmount; + + private final List allowedCountryCodes; + + private final double budgetAmount; + + private final Optional businessGoalType; + + private final Optional cancelRequestedAt; + + private final String createdAt; + + private final String currency; + + private final String description; + + private final Optional discussionExperienceId; + + private final Optional discussionFeedId; + + private final Optional discussionPostId; + + private final Optional experienceId; + + private final Optional fundingAccount; + + private final double grossPaidOutAmount; + + private final double grossRewardAmount; + + private final String id; + + private final double netRewardAmount; + + private final UserSummary poster; + + private final Optional scheduledFrequency; + + private final Optional scheduledPublishAt; + + private final int spotsRemaining; + + private final BountyListItemStatus status; + + private final Optional submissionsClosedAt; + + private final String title; + + private final int unresolvedSubmissionsCount; + + private final String updatedAt; + + private final int viewerAcceptedSubmissionsCount; + + private final Map additionalProperties; + + private BountyListItem( + List acceptedDeliverableTypes, + int acceptedSubmissionsCount, + int acceptedSubmissionsLimit, + int acceptedSubmissionsPerUserLimit, + double affiliateShareAmount, + List allowedCountryCodes, + double budgetAmount, + Optional businessGoalType, + Optional cancelRequestedAt, + String createdAt, + String currency, + String description, + Optional discussionExperienceId, + Optional discussionFeedId, + Optional discussionPostId, + Optional experienceId, + Optional fundingAccount, + double grossPaidOutAmount, + double grossRewardAmount, + String id, + double netRewardAmount, + UserSummary poster, + Optional scheduledFrequency, + Optional scheduledPublishAt, + int spotsRemaining, + BountyListItemStatus status, + Optional submissionsClosedAt, + String title, + int unresolvedSubmissionsCount, + String updatedAt, + int viewerAcceptedSubmissionsCount, + Map additionalProperties) { + this.acceptedDeliverableTypes = acceptedDeliverableTypes; + this.acceptedSubmissionsCount = acceptedSubmissionsCount; + this.acceptedSubmissionsLimit = acceptedSubmissionsLimit; + this.acceptedSubmissionsPerUserLimit = acceptedSubmissionsPerUserLimit; + this.affiliateShareAmount = affiliateShareAmount; + this.allowedCountryCodes = allowedCountryCodes; + this.budgetAmount = budgetAmount; + this.businessGoalType = businessGoalType; + this.cancelRequestedAt = cancelRequestedAt; + this.createdAt = createdAt; + this.currency = currency; + this.description = description; + this.discussionExperienceId = discussionExperienceId; + this.discussionFeedId = discussionFeedId; + this.discussionPostId = discussionPostId; + this.experienceId = experienceId; + this.fundingAccount = fundingAccount; + this.grossPaidOutAmount = grossPaidOutAmount; + this.grossRewardAmount = grossRewardAmount; + this.id = id; + this.netRewardAmount = netRewardAmount; + this.poster = poster; + this.scheduledFrequency = scheduledFrequency; + this.scheduledPublishAt = scheduledPublishAt; + this.spotsRemaining = spotsRemaining; + this.status = status; + this.submissionsClosedAt = submissionsClosedAt; + this.title = title; + this.unresolvedSubmissionsCount = unresolvedSubmissionsCount; + this.updatedAt = updatedAt; + this.viewerAcceptedSubmissionsCount = viewerAcceptedSubmissionsCount; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("accepted_deliverable_types") + public List getAcceptedDeliverableTypes() { + return acceptedDeliverableTypes; + } + + /** + * @return Submissions accepted so far. + */ + @JsonProperty("accepted_submissions_count") + public int getAcceptedSubmissionsCount() { + return acceptedSubmissionsCount; + } + + /** + * @return Number of submissions that can be accepted (winner slots). + */ + @JsonProperty("accepted_submissions_limit") + public int getAcceptedSubmissionsLimit() { + return acceptedSubmissionsLimit; + } + + /** + * @return How many winner slots one worker can win. Defaults to 1. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed accepted_submissions_limit. + */ + @JsonProperty("accepted_submissions_per_user_limit") + public int getAcceptedSubmissionsPerUserLimit() { + return acceptedSubmissionsPerUserLimit; + } + + /** + * @return What a referrer earns per accepted submission when the worker arrived through their affiliate link, in whole currency units, at the standard platform fee rate. Taken out of the worker's post-fee reward rather than added on top. 0 when the bounty pays no affiliate share, including bounties tied to no account, which cannot record a referral. + */ + @JsonProperty("affiliate_share_amount") + public double getAffiliateShareAmount() { + return affiliateShareAmount; + } + + @JsonProperty("allowed_country_codes") + public List getAllowedCountryCodes() { + return allowedCountryCodes; + } + + /** + * @return Total gross budget committed to the bounty: gross_reward_amount times accepted_submissions_limit. + */ + @JsonProperty("budget_amount") + public double getBudgetAmount() { + return budgetAmount; + } + + /** + * @return What the poster wants the work to achieve, declared once at create. null for bounties created before the taxonomy rolled out. + */ + @JsonIgnore + public Optional getBusinessGoalType() { + if (businessGoalType == null) { + return Optional.empty(); + } + return businessGoalType; + } + + /** + * @return When cancellation was requested, as an ISO 8601 timestamp. On a closed bounty this means the cancel is pending: submissions are stopped and the bounty cancels once in-flight submissions resolve. On a canceled bounty it records when the cancellation was requested. null when no cancellation was ever requested. + */ + @JsonIgnore + public Optional getCancelRequestedAt() { + if (cancelRequestedAt == null) { + return Optional.empty(); + } + return cancelRequestedAt; + } + + /** + * @return When the bounty was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Currency for all amounts on the bounty, as a lowercase ISO 4217 code. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Full task instructions shown to workers. + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * @return Experience the bounty's discussion thread lives in, prefixed exp_. Read this — not experience_id — to open the thread: a platform-wide bounty has no hosting experience of its own but its discussion still lives in one. + */ + @JsonIgnore + public Optional getDiscussionExperienceId() { + if (discussionExperienceId == null) { + return Optional.empty(); + } + return discussionExperienceId; + } + + /** + * @return Forum feed containing the bounty's discussion thread. null for a bounty with no forum post. + */ + @JsonIgnore + public Optional getDiscussionFeedId() { + if (discussionFeedId == null) { + return Optional.empty(); + } + return discussionFeedId; + } + + /** + * @return Forum post anchoring the bounty's discussion thread. Read together with discussion_experience_id to address the thread. null for a bounty with no forum post. + */ + @JsonIgnore + public Optional getDiscussionPostId() { + if (discussionPostId == null) { + return Optional.empty(); + } + return discussionPostId; + } + + /** + * @return Experience the bounty is hosted in, prefixed exp_. null for platform-wide bounties; may belong to a different account than the funder. + */ + @JsonIgnore + public Optional getExperienceId() { + if (experienceId == null) { + return Optional.empty(); + } + return experienceId; + } + + /** + * @return Account whose balance funds the bounty pool, or null when a user funds it personally. May differ from the account hosting experience_id. + */ + @JsonIgnore + public Optional getFundingAccount() { + if (fundingAccount == null) { + return Optional.empty(); + } + return fundingAccount; + } + + /** + * @return Gross amount paid out from the bounty pool across accepted submissions — worker payouts, platform fees, and affiliate shares together. Tips and reviewer rewards are excluded. + */ + @JsonProperty("gross_paid_out_amount") + public double getGrossPaidOutAmount() { + return grossPaidOutAmount; + } + + /** + * @return Gross bounty-pool amount allocated per accepted submission, in whole currency units. + */ + @JsonProperty("gross_reward_amount") + public double getGrossRewardAmount() { + return grossRewardAmount; + } + + /** + * @return Bounty ID, prefixed bnty_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return What a worker is quoted per accepted submission after the platform fee, in whole currency units. The exact post-fee figure, at the standard platform fee rate — a worker who locked a different rate, or who arrived through an affiliate link, is paid a different amount. + */ + @JsonProperty("net_reward_amount") + public double getNetRewardAmount() { + return netRewardAmount; + } + + /** + * @return User who posted the bounty — the account owner when created with an account API key. + */ + @JsonProperty("poster") + public UserSummary getPoster() { + return poster; + } + + /** + * @return How often the schedule creates a new bounty. Each occurrence is a separate bounty; the original is not republished. + */ + @JsonIgnore + public Optional getScheduledFrequency() { + if (scheduledFrequency == null) { + return Optional.empty(); + } + return scheduledFrequency; + } + + /** + * @return When a scheduled bounty will publish, as an ISO 8601 timestamp. null once published, for bounties that were never scheduled, and for terminally failed drafts parked for manual rescheduling. + */ + @JsonIgnore + public Optional getScheduledPublishAt() { + if (scheduledPublishAt == null) { + return Optional.empty(); + } + return scheduledPublishAt; + } + + /** + * @return Unfilled winner capacity: accepted_submissions_limit minus accepted_submissions_count, clamped to zero. Not on its own a signal that the bounty accepts new claims — read status for that: only an open bounty takes new submissions. + */ + @JsonProperty("spots_remaining") + public int getSpotsRemaining() { + return spotsRemaining; + } + + /** + * @return Lifecycle state. scheduled bounties are unpublished drafts, visible to their poster and the account's authorized managers; open bounties accept new submissions; closed bounties are live but no longer accept new submissions; completed bounties paid out every winner slot; canceled bounties ended before filling their slots. + */ + @JsonProperty("status") + public BountyListItemStatus getStatus() { + return status; + } + + /** + * @return When new submissions stopped being accepted, as an ISO 8601 timestamp. Set when a cancellation is requested on a bounty with work in flight, so in-flight submissions can resolve before the bounty cancels. null when submissions were never stopped — including completed bounties that simply filled every winner slot. + */ + @JsonIgnore + public Optional getSubmissionsClosedAt() { + if (submissionsClosedAt == null) { + return Optional.empty(); + } + return submissionsClosedAt; + } + + /** + * @return Short name of the task shown to workers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return Submissions still awaiting an outcome: in progress or pending review. + */ + @JsonProperty("unresolved_submissions_count") + public int getUnresolvedSubmissionsCount() { + return unresolvedSubmissionsCount; + } + + /** + * @return When the bounty was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return How many winner slots the authenticated user has already won on this bounty. Read against accepted_submissions_per_user_limit to show a worker their remaining allowance. 0 when the request has no authenticated user. + */ + @JsonProperty("viewer_accepted_submissions_count") + public int getViewerAcceptedSubmissionsCount() { + return viewerAcceptedSubmissionsCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_goal_type") + private Optional _getBusinessGoalType() { + return businessGoalType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancel_requested_at") + private Optional _getCancelRequestedAt() { + return cancelRequestedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("discussion_experience_id") + private Optional _getDiscussionExperienceId() { + return discussionExperienceId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("discussion_feed_id") + private Optional _getDiscussionFeedId() { + return discussionFeedId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("discussion_post_id") + private Optional _getDiscussionPostId() { + return discussionPostId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("experience_id") + private Optional _getExperienceId() { + return experienceId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("funding_account") + private Optional _getFundingAccount() { + return fundingAccount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("scheduled_frequency") + private Optional _getScheduledFrequency() { + return scheduledFrequency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("scheduled_publish_at") + private Optional _getScheduledPublishAt() { + return scheduledPublishAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("submissions_closed_at") + private Optional _getSubmissionsClosedAt() { + return submissionsClosedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BountyListItem && equalTo((BountyListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BountyListItem other) { + return acceptedDeliverableTypes.equals(other.acceptedDeliverableTypes) + && acceptedSubmissionsCount == other.acceptedSubmissionsCount + && acceptedSubmissionsLimit == other.acceptedSubmissionsLimit + && acceptedSubmissionsPerUserLimit == other.acceptedSubmissionsPerUserLimit + && affiliateShareAmount == other.affiliateShareAmount + && allowedCountryCodes.equals(other.allowedCountryCodes) + && budgetAmount == other.budgetAmount + && businessGoalType.equals(other.businessGoalType) + && cancelRequestedAt.equals(other.cancelRequestedAt) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && description.equals(other.description) + && discussionExperienceId.equals(other.discussionExperienceId) + && discussionFeedId.equals(other.discussionFeedId) + && discussionPostId.equals(other.discussionPostId) + && experienceId.equals(other.experienceId) + && fundingAccount.equals(other.fundingAccount) + && grossPaidOutAmount == other.grossPaidOutAmount + && grossRewardAmount == other.grossRewardAmount + && id.equals(other.id) + && netRewardAmount == other.netRewardAmount + && poster.equals(other.poster) + && scheduledFrequency.equals(other.scheduledFrequency) + && scheduledPublishAt.equals(other.scheduledPublishAt) + && spotsRemaining == other.spotsRemaining + && status.equals(other.status) + && submissionsClosedAt.equals(other.submissionsClosedAt) + && title.equals(other.title) + && unresolvedSubmissionsCount == other.unresolvedSubmissionsCount + && updatedAt.equals(other.updatedAt) + && viewerAcceptedSubmissionsCount == other.viewerAcceptedSubmissionsCount; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.acceptedDeliverableTypes, + this.acceptedSubmissionsCount, + this.acceptedSubmissionsLimit, + this.acceptedSubmissionsPerUserLimit, + this.affiliateShareAmount, + this.allowedCountryCodes, + this.budgetAmount, + this.businessGoalType, + this.cancelRequestedAt, + this.createdAt, + this.currency, + this.description, + this.discussionExperienceId, + this.discussionFeedId, + this.discussionPostId, + this.experienceId, + this.fundingAccount, + this.grossPaidOutAmount, + this.grossRewardAmount, + this.id, + this.netRewardAmount, + this.poster, + this.scheduledFrequency, + this.scheduledPublishAt, + this.spotsRemaining, + this.status, + this.submissionsClosedAt, + this.title, + this.unresolvedSubmissionsCount, + this.updatedAt, + this.viewerAcceptedSubmissionsCount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AcceptedSubmissionsCountStage builder() { + return new Builder(); + } + + public interface AcceptedSubmissionsCountStage { + /** + *

Submissions accepted so far.

+ */ + AcceptedSubmissionsLimitStage acceptedSubmissionsCount(int acceptedSubmissionsCount); + + Builder from(BountyListItem other); + } + + public interface AcceptedSubmissionsLimitStage { + /** + *

Number of submissions that can be accepted (winner slots).

+ */ + AcceptedSubmissionsPerUserLimitStage acceptedSubmissionsLimit(int acceptedSubmissionsLimit); + } + + public interface AcceptedSubmissionsPerUserLimitStage { + /** + *

How many winner slots one worker can win. Defaults to 1. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed accepted_submissions_limit.

+ */ + AffiliateShareAmountStage acceptedSubmissionsPerUserLimit(int acceptedSubmissionsPerUserLimit); + } + + public interface AffiliateShareAmountStage { + /** + *

What a referrer earns per accepted submission when the worker arrived through their affiliate link, in whole currency units, at the standard platform fee rate. Taken out of the worker's post-fee reward rather than added on top. 0 when the bounty pays no affiliate share, including bounties tied to no account, which cannot record a referral.

+ */ + BudgetAmountStage affiliateShareAmount(double affiliateShareAmount); + } + + public interface BudgetAmountStage { + /** + *

Total gross budget committed to the bounty: gross_reward_amount times accepted_submissions_limit.

+ */ + CreatedAtStage budgetAmount(double budgetAmount); + } + + public interface CreatedAtStage { + /** + *

When the bounty was created, as an ISO 8601 timestamp.

+ */ + CurrencyStage createdAt(@NotNull String createdAt); + } + + public interface CurrencyStage { + /** + *

Currency for all amounts on the bounty, as a lowercase ISO 4217 code.

+ */ + DescriptionStage currency(@NotNull String currency); + } + + public interface DescriptionStage { + /** + *

Full task instructions shown to workers.

+ */ + GrossPaidOutAmountStage description(@NotNull String description); + } + + public interface GrossPaidOutAmountStage { + /** + *

Gross amount paid out from the bounty pool across accepted submissions — worker payouts, platform fees, and affiliate shares together. Tips and reviewer rewards are excluded.

+ */ + GrossRewardAmountStage grossPaidOutAmount(double grossPaidOutAmount); + } + + public interface GrossRewardAmountStage { + /** + *

Gross bounty-pool amount allocated per accepted submission, in whole currency units.

+ */ + IdStage grossRewardAmount(double grossRewardAmount); + } + + public interface IdStage { + /** + *

Bounty ID, prefixed bnty_.

+ */ + NetRewardAmountStage id(@NotNull String id); + } + + public interface NetRewardAmountStage { + /** + *

What a worker is quoted per accepted submission after the platform fee, in whole currency units. The exact post-fee figure, at the standard platform fee rate — a worker who locked a different rate, or who arrived through an affiliate link, is paid a different amount.

+ */ + PosterStage netRewardAmount(double netRewardAmount); + } + + public interface PosterStage { + /** + *

User who posted the bounty — the account owner when created with an account API key.

+ */ + SpotsRemainingStage poster(@NotNull UserSummary poster); + } + + public interface SpotsRemainingStage { + /** + *

Unfilled winner capacity: accepted_submissions_limit minus accepted_submissions_count, clamped to zero. Not on its own a signal that the bounty accepts new claims — read status for that: only an open bounty takes new submissions.

+ */ + StatusStage spotsRemaining(int spotsRemaining); + } + + public interface StatusStage { + /** + *

Lifecycle state. scheduled bounties are unpublished drafts, visible to their poster and the account's authorized managers; open bounties accept new submissions; closed bounties are live but no longer accept new submissions; completed bounties paid out every winner slot; canceled bounties ended before filling their slots.

+ */ + TitleStage status(@NotNull BountyListItemStatus status); + } + + public interface TitleStage { + /** + *

Short name of the task shown to workers.

+ */ + UnresolvedSubmissionsCountStage title(@NotNull String title); + } + + public interface UnresolvedSubmissionsCountStage { + /** + *

Submissions still awaiting an outcome: in progress or pending review.

+ */ + UpdatedAtStage unresolvedSubmissionsCount(int unresolvedSubmissionsCount); + } + + public interface UpdatedAtStage { + /** + *

When the bounty was last updated, as an ISO 8601 timestamp.

+ */ + ViewerAcceptedSubmissionsCountStage updatedAt(@NotNull String updatedAt); + } + + public interface ViewerAcceptedSubmissionsCountStage { + /** + *

How many winner slots the authenticated user has already won on this bounty. Read against accepted_submissions_per_user_limit to show a worker their remaining allowance. 0 when the request has no authenticated user.

+ */ + _FinalStage viewerAcceptedSubmissionsCount(int viewerAcceptedSubmissionsCount); + } + + public interface _FinalStage { + BountyListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage acceptedDeliverableTypes(List acceptedDeliverableTypes); + + _FinalStage addAcceptedDeliverableTypes(BountyListItemAcceptedDeliverableTypesItem acceptedDeliverableTypes); + + _FinalStage addAllAcceptedDeliverableTypes( + List acceptedDeliverableTypes); + + _FinalStage allowedCountryCodes(List allowedCountryCodes); + + _FinalStage addAllowedCountryCodes(String allowedCountryCodes); + + _FinalStage addAllAllowedCountryCodes(List allowedCountryCodes); + + /** + *

What the poster wants the work to achieve, declared once at create. null for bounties created before the taxonomy rolled out.

+ */ + _FinalStage businessGoalType(Optional businessGoalType); + + _FinalStage businessGoalType(BountyListItemBusinessGoalType businessGoalType); + + _FinalStage businessGoalType(Nullable businessGoalType); + + /** + *

When cancellation was requested, as an ISO 8601 timestamp. On a closed bounty this means the cancel is pending: submissions are stopped and the bounty cancels once in-flight submissions resolve. On a canceled bounty it records when the cancellation was requested. null when no cancellation was ever requested.

+ */ + _FinalStage cancelRequestedAt(Optional cancelRequestedAt); + + _FinalStage cancelRequestedAt(String cancelRequestedAt); + + _FinalStage cancelRequestedAt(Nullable cancelRequestedAt); + + /** + *

Experience the bounty's discussion thread lives in, prefixed exp_. Read this — not experience_id — to open the thread: a platform-wide bounty has no hosting experience of its own but its discussion still lives in one.

+ */ + _FinalStage discussionExperienceId(Optional discussionExperienceId); + + _FinalStage discussionExperienceId(String discussionExperienceId); + + _FinalStage discussionExperienceId(Nullable discussionExperienceId); + + /** + *

Forum feed containing the bounty's discussion thread. null for a bounty with no forum post.

+ */ + _FinalStage discussionFeedId(Optional discussionFeedId); + + _FinalStage discussionFeedId(String discussionFeedId); + + _FinalStage discussionFeedId(Nullable discussionFeedId); + + /** + *

Forum post anchoring the bounty's discussion thread. Read together with discussion_experience_id to address the thread. null for a bounty with no forum post.

+ */ + _FinalStage discussionPostId(Optional discussionPostId); + + _FinalStage discussionPostId(String discussionPostId); + + _FinalStage discussionPostId(Nullable discussionPostId); + + /** + *

Experience the bounty is hosted in, prefixed exp_. null for platform-wide bounties; may belong to a different account than the funder.

+ */ + _FinalStage experienceId(Optional experienceId); + + _FinalStage experienceId(String experienceId); + + _FinalStage experienceId(Nullable experienceId); + + /** + *

Account whose balance funds the bounty pool, or null when a user funds it personally. May differ from the account hosting experience_id.

+ */ + _FinalStage fundingAccount(Optional fundingAccount); + + _FinalStage fundingAccount(AccountSummary fundingAccount); + + _FinalStage fundingAccount(Nullable fundingAccount); + + /** + *

How often the schedule creates a new bounty. Each occurrence is a separate bounty; the original is not republished.

+ */ + _FinalStage scheduledFrequency(Optional scheduledFrequency); + + _FinalStage scheduledFrequency(BountyListItemScheduledFrequency scheduledFrequency); + + _FinalStage scheduledFrequency(Nullable scheduledFrequency); + + /** + *

When a scheduled bounty will publish, as an ISO 8601 timestamp. null once published, for bounties that were never scheduled, and for terminally failed drafts parked for manual rescheduling.

+ */ + _FinalStage scheduledPublishAt(Optional scheduledPublishAt); + + _FinalStage scheduledPublishAt(String scheduledPublishAt); + + _FinalStage scheduledPublishAt(Nullable scheduledPublishAt); + + /** + *

When new submissions stopped being accepted, as an ISO 8601 timestamp. Set when a cancellation is requested on a bounty with work in flight, so in-flight submissions can resolve before the bounty cancels. null when submissions were never stopped — including completed bounties that simply filled every winner slot.

+ */ + _FinalStage submissionsClosedAt(Optional submissionsClosedAt); + + _FinalStage submissionsClosedAt(String submissionsClosedAt); + + _FinalStage submissionsClosedAt(Nullable submissionsClosedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AcceptedSubmissionsCountStage, + AcceptedSubmissionsLimitStage, + AcceptedSubmissionsPerUserLimitStage, + AffiliateShareAmountStage, + BudgetAmountStage, + CreatedAtStage, + CurrencyStage, + DescriptionStage, + GrossPaidOutAmountStage, + GrossRewardAmountStage, + IdStage, + NetRewardAmountStage, + PosterStage, + SpotsRemainingStage, + StatusStage, + TitleStage, + UnresolvedSubmissionsCountStage, + UpdatedAtStage, + ViewerAcceptedSubmissionsCountStage, + _FinalStage { + private int acceptedSubmissionsCount; + + private int acceptedSubmissionsLimit; + + private int acceptedSubmissionsPerUserLimit; + + private double affiliateShareAmount; + + private double budgetAmount; + + private String createdAt; + + private String currency; + + private String description; + + private double grossPaidOutAmount; + + private double grossRewardAmount; + + private String id; + + private double netRewardAmount; + + private UserSummary poster; + + private int spotsRemaining; + + private BountyListItemStatus status; + + private String title; + + private int unresolvedSubmissionsCount; + + private String updatedAt; + + private int viewerAcceptedSubmissionsCount; + + private Optional submissionsClosedAt = Optional.empty(); + + private Optional scheduledPublishAt = Optional.empty(); + + private Optional scheduledFrequency = Optional.empty(); + + private Optional fundingAccount = Optional.empty(); + + private Optional experienceId = Optional.empty(); + + private Optional discussionPostId = Optional.empty(); + + private Optional discussionFeedId = Optional.empty(); + + private Optional discussionExperienceId = Optional.empty(); + + private Optional cancelRequestedAt = Optional.empty(); + + private Optional businessGoalType = Optional.empty(); + + private List allowedCountryCodes = new ArrayList<>(); + + private List acceptedDeliverableTypes = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BountyListItem other) { + acceptedDeliverableTypes(other.getAcceptedDeliverableTypes()); + acceptedSubmissionsCount(other.getAcceptedSubmissionsCount()); + acceptedSubmissionsLimit(other.getAcceptedSubmissionsLimit()); + acceptedSubmissionsPerUserLimit(other.getAcceptedSubmissionsPerUserLimit()); + affiliateShareAmount(other.getAffiliateShareAmount()); + allowedCountryCodes(other.getAllowedCountryCodes()); + budgetAmount(other.getBudgetAmount()); + businessGoalType(other.getBusinessGoalType()); + cancelRequestedAt(other.getCancelRequestedAt()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + description(other.getDescription()); + discussionExperienceId(other.getDiscussionExperienceId()); + discussionFeedId(other.getDiscussionFeedId()); + discussionPostId(other.getDiscussionPostId()); + experienceId(other.getExperienceId()); + fundingAccount(other.getFundingAccount()); + grossPaidOutAmount(other.getGrossPaidOutAmount()); + grossRewardAmount(other.getGrossRewardAmount()); + id(other.getId()); + netRewardAmount(other.getNetRewardAmount()); + poster(other.getPoster()); + scheduledFrequency(other.getScheduledFrequency()); + scheduledPublishAt(other.getScheduledPublishAt()); + spotsRemaining(other.getSpotsRemaining()); + status(other.getStatus()); + submissionsClosedAt(other.getSubmissionsClosedAt()); + title(other.getTitle()); + unresolvedSubmissionsCount(other.getUnresolvedSubmissionsCount()); + updatedAt(other.getUpdatedAt()); + viewerAcceptedSubmissionsCount(other.getViewerAcceptedSubmissionsCount()); + return this; + } + + /** + *

Submissions accepted so far.

+ *

Submissions accepted so far.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("accepted_submissions_count") + public AcceptedSubmissionsLimitStage acceptedSubmissionsCount(int acceptedSubmissionsCount) { + this.acceptedSubmissionsCount = acceptedSubmissionsCount; + return this; + } + + /** + *

Number of submissions that can be accepted (winner slots).

+ *

Number of submissions that can be accepted (winner slots).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("accepted_submissions_limit") + public AcceptedSubmissionsPerUserLimitStage acceptedSubmissionsLimit(int acceptedSubmissionsLimit) { + this.acceptedSubmissionsLimit = acceptedSubmissionsLimit; + return this; + } + + /** + *

How many winner slots one worker can win. Defaults to 1. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed accepted_submissions_limit.

+ *

How many winner slots one worker can win. Defaults to 1. Wins plus proofs awaiting review never exceed this number, and a worker runs one attempt at a time. Cannot exceed accepted_submissions_limit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("accepted_submissions_per_user_limit") + public AffiliateShareAmountStage acceptedSubmissionsPerUserLimit(int acceptedSubmissionsPerUserLimit) { + this.acceptedSubmissionsPerUserLimit = acceptedSubmissionsPerUserLimit; + return this; + } + + /** + *

What a referrer earns per accepted submission when the worker arrived through their affiliate link, in whole currency units, at the standard platform fee rate. Taken out of the worker's post-fee reward rather than added on top. 0 when the bounty pays no affiliate share, including bounties tied to no account, which cannot record a referral.

+ *

What a referrer earns per accepted submission when the worker arrived through their affiliate link, in whole currency units, at the standard platform fee rate. Taken out of the worker's post-fee reward rather than added on top. 0 when the bounty pays no affiliate share, including bounties tied to no account, which cannot record a referral.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("affiliate_share_amount") + public BudgetAmountStage affiliateShareAmount(double affiliateShareAmount) { + this.affiliateShareAmount = affiliateShareAmount; + return this; + } + + /** + *

Total gross budget committed to the bounty: gross_reward_amount times accepted_submissions_limit.

+ *

Total gross budget committed to the bounty: gross_reward_amount times accepted_submissions_limit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("budget_amount") + public CreatedAtStage budgetAmount(double budgetAmount) { + this.budgetAmount = budgetAmount; + return this; + } + + /** + *

When the bounty was created, as an ISO 8601 timestamp.

+ *

When the bounty was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Currency for all amounts on the bounty, as a lowercase ISO 4217 code.

+ *

Currency for all amounts on the bounty, as a lowercase ISO 4217 code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DescriptionStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Full task instructions shown to workers.

+ *

Full task instructions shown to workers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("description") + public GrossPaidOutAmountStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + /** + *

Gross amount paid out from the bounty pool across accepted submissions — worker payouts, platform fees, and affiliate shares together. Tips and reviewer rewards are excluded.

+ *

Gross amount paid out from the bounty pool across accepted submissions — worker payouts, platform fees, and affiliate shares together. Tips and reviewer rewards are excluded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("gross_paid_out_amount") + public GrossRewardAmountStage grossPaidOutAmount(double grossPaidOutAmount) { + this.grossPaidOutAmount = grossPaidOutAmount; + return this; + } + + /** + *

Gross bounty-pool amount allocated per accepted submission, in whole currency units.

+ *

Gross bounty-pool amount allocated per accepted submission, in whole currency units.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("gross_reward_amount") + public IdStage grossRewardAmount(double grossRewardAmount) { + this.grossRewardAmount = grossRewardAmount; + return this; + } + + /** + *

Bounty ID, prefixed bnty_.

+ *

Bounty ID, prefixed bnty_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NetRewardAmountStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

What a worker is quoted per accepted submission after the platform fee, in whole currency units. The exact post-fee figure, at the standard platform fee rate — a worker who locked a different rate, or who arrived through an affiliate link, is paid a different amount.

+ *

What a worker is quoted per accepted submission after the platform fee, in whole currency units. The exact post-fee figure, at the standard platform fee rate — a worker who locked a different rate, or who arrived through an affiliate link, is paid a different amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("net_reward_amount") + public PosterStage netRewardAmount(double netRewardAmount) { + this.netRewardAmount = netRewardAmount; + return this; + } + + /** + *

User who posted the bounty — the account owner when created with an account API key.

+ *

User who posted the bounty — the account owner when created with an account API key.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("poster") + public SpotsRemainingStage poster(@NotNull UserSummary poster) { + this.poster = Objects.requireNonNull(poster, "poster must not be null"); + return this; + } + + /** + *

Unfilled winner capacity: accepted_submissions_limit minus accepted_submissions_count, clamped to zero. Not on its own a signal that the bounty accepts new claims — read status for that: only an open bounty takes new submissions.

+ *

Unfilled winner capacity: accepted_submissions_limit minus accepted_submissions_count, clamped to zero. Not on its own a signal that the bounty accepts new claims — read status for that: only an open bounty takes new submissions.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("spots_remaining") + public StatusStage spotsRemaining(int spotsRemaining) { + this.spotsRemaining = spotsRemaining; + return this; + } + + /** + *

Lifecycle state. scheduled bounties are unpublished drafts, visible to their poster and the account's authorized managers; open bounties accept new submissions; closed bounties are live but no longer accept new submissions; completed bounties paid out every winner slot; canceled bounties ended before filling their slots.

+ *

Lifecycle state. scheduled bounties are unpublished drafts, visible to their poster and the account's authorized managers; open bounties accept new submissions; closed bounties are live but no longer accept new submissions; completed bounties paid out every winner slot; canceled bounties ended before filling their slots.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TitleStage status(@NotNull BountyListItemStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Short name of the task shown to workers.

+ *

Short name of the task shown to workers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public UnresolvedSubmissionsCountStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Submissions still awaiting an outcome: in progress or pending review.

+ *

Submissions still awaiting an outcome: in progress or pending review.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("unresolved_submissions_count") + public UpdatedAtStage unresolvedSubmissionsCount(int unresolvedSubmissionsCount) { + this.unresolvedSubmissionsCount = unresolvedSubmissionsCount; + return this; + } + + /** + *

When the bounty was last updated, as an ISO 8601 timestamp.

+ *

When the bounty was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public ViewerAcceptedSubmissionsCountStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

How many winner slots the authenticated user has already won on this bounty. Read against accepted_submissions_per_user_limit to show a worker their remaining allowance. 0 when the request has no authenticated user.

+ *

How many winner slots the authenticated user has already won on this bounty. Read against accepted_submissions_per_user_limit to show a worker their remaining allowance. 0 when the request has no authenticated user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("viewer_accepted_submissions_count") + public _FinalStage viewerAcceptedSubmissionsCount(int viewerAcceptedSubmissionsCount) { + this.viewerAcceptedSubmissionsCount = viewerAcceptedSubmissionsCount; + return this; + } + + /** + *

When new submissions stopped being accepted, as an ISO 8601 timestamp. Set when a cancellation is requested on a bounty with work in flight, so in-flight submissions can resolve before the bounty cancels. null when submissions were never stopped — including completed bounties that simply filled every winner slot.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage submissionsClosedAt(Nullable submissionsClosedAt) { + if (submissionsClosedAt.isNull()) { + this.submissionsClosedAt = null; + } else if (submissionsClosedAt.isEmpty()) { + this.submissionsClosedAt = Optional.empty(); + } else { + this.submissionsClosedAt = Optional.of(submissionsClosedAt.get()); + } + return this; + } + + /** + *

When new submissions stopped being accepted, as an ISO 8601 timestamp. Set when a cancellation is requested on a bounty with work in flight, so in-flight submissions can resolve before the bounty cancels. null when submissions were never stopped — including completed bounties that simply filled every winner slot.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage submissionsClosedAt(String submissionsClosedAt) { + this.submissionsClosedAt = Optional.ofNullable(submissionsClosedAt); + return this; + } + + /** + *

When new submissions stopped being accepted, as an ISO 8601 timestamp. Set when a cancellation is requested on a bounty with work in flight, so in-flight submissions can resolve before the bounty cancels. null when submissions were never stopped — including completed bounties that simply filled every winner slot.

+ */ + @java.lang.Override + @JsonSetter(value = "submissions_closed_at", nulls = Nulls.SKIP) + public _FinalStage submissionsClosedAt(Optional submissionsClosedAt) { + this.submissionsClosedAt = submissionsClosedAt; + return this; + } + + /** + *

When a scheduled bounty will publish, as an ISO 8601 timestamp. null once published, for bounties that were never scheduled, and for terminally failed drafts parked for manual rescheduling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage scheduledPublishAt(Nullable scheduledPublishAt) { + if (scheduledPublishAt.isNull()) { + this.scheduledPublishAt = null; + } else if (scheduledPublishAt.isEmpty()) { + this.scheduledPublishAt = Optional.empty(); + } else { + this.scheduledPublishAt = Optional.of(scheduledPublishAt.get()); + } + return this; + } + + /** + *

When a scheduled bounty will publish, as an ISO 8601 timestamp. null once published, for bounties that were never scheduled, and for terminally failed drafts parked for manual rescheduling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage scheduledPublishAt(String scheduledPublishAt) { + this.scheduledPublishAt = Optional.ofNullable(scheduledPublishAt); + return this; + } + + /** + *

When a scheduled bounty will publish, as an ISO 8601 timestamp. null once published, for bounties that were never scheduled, and for terminally failed drafts parked for manual rescheduling.

+ */ + @java.lang.Override + @JsonSetter(value = "scheduled_publish_at", nulls = Nulls.SKIP) + public _FinalStage scheduledPublishAt(Optional scheduledPublishAt) { + this.scheduledPublishAt = scheduledPublishAt; + return this; + } + + /** + *

How often the schedule creates a new bounty. Each occurrence is a separate bounty; the original is not republished.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage scheduledFrequency(Nullable scheduledFrequency) { + if (scheduledFrequency.isNull()) { + this.scheduledFrequency = null; + } else if (scheduledFrequency.isEmpty()) { + this.scheduledFrequency = Optional.empty(); + } else { + this.scheduledFrequency = Optional.of(scheduledFrequency.get()); + } + return this; + } + + /** + *

How often the schedule creates a new bounty. Each occurrence is a separate bounty; the original is not republished.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage scheduledFrequency(BountyListItemScheduledFrequency scheduledFrequency) { + this.scheduledFrequency = Optional.ofNullable(scheduledFrequency); + return this; + } + + /** + *

How often the schedule creates a new bounty. Each occurrence is a separate bounty; the original is not republished.

+ */ + @java.lang.Override + @JsonSetter(value = "scheduled_frequency", nulls = Nulls.SKIP) + public _FinalStage scheduledFrequency(Optional scheduledFrequency) { + this.scheduledFrequency = scheduledFrequency; + return this; + } + + /** + *

Account whose balance funds the bounty pool, or null when a user funds it personally. May differ from the account hosting experience_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fundingAccount(Nullable fundingAccount) { + if (fundingAccount.isNull()) { + this.fundingAccount = null; + } else if (fundingAccount.isEmpty()) { + this.fundingAccount = Optional.empty(); + } else { + this.fundingAccount = Optional.of(fundingAccount.get()); + } + return this; + } + + /** + *

Account whose balance funds the bounty pool, or null when a user funds it personally. May differ from the account hosting experience_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fundingAccount(AccountSummary fundingAccount) { + this.fundingAccount = Optional.ofNullable(fundingAccount); + return this; + } + + /** + *

Account whose balance funds the bounty pool, or null when a user funds it personally. May differ from the account hosting experience_id.

+ */ + @java.lang.Override + @JsonSetter(value = "funding_account", nulls = Nulls.SKIP) + public _FinalStage fundingAccount(Optional fundingAccount) { + this.fundingAccount = fundingAccount; + return this; + } + + /** + *

Experience the bounty is hosted in, prefixed exp_. null for platform-wide bounties; may belong to a different account than the funder.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage experienceId(Nullable experienceId) { + if (experienceId.isNull()) { + this.experienceId = null; + } else if (experienceId.isEmpty()) { + this.experienceId = Optional.empty(); + } else { + this.experienceId = Optional.of(experienceId.get()); + } + return this; + } + + /** + *

Experience the bounty is hosted in, prefixed exp_. null for platform-wide bounties; may belong to a different account than the funder.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage experienceId(String experienceId) { + this.experienceId = Optional.ofNullable(experienceId); + return this; + } + + /** + *

Experience the bounty is hosted in, prefixed exp_. null for platform-wide bounties; may belong to a different account than the funder.

+ */ + @java.lang.Override + @JsonSetter(value = "experience_id", nulls = Nulls.SKIP) + public _FinalStage experienceId(Optional experienceId) { + this.experienceId = experienceId; + return this; + } + + /** + *

Forum post anchoring the bounty's discussion thread. Read together with discussion_experience_id to address the thread. null for a bounty with no forum post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discussionPostId(Nullable discussionPostId) { + if (discussionPostId.isNull()) { + this.discussionPostId = null; + } else if (discussionPostId.isEmpty()) { + this.discussionPostId = Optional.empty(); + } else { + this.discussionPostId = Optional.of(discussionPostId.get()); + } + return this; + } + + /** + *

Forum post anchoring the bounty's discussion thread. Read together with discussion_experience_id to address the thread. null for a bounty with no forum post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discussionPostId(String discussionPostId) { + this.discussionPostId = Optional.ofNullable(discussionPostId); + return this; + } + + /** + *

Forum post anchoring the bounty's discussion thread. Read together with discussion_experience_id to address the thread. null for a bounty with no forum post.

+ */ + @java.lang.Override + @JsonSetter(value = "discussion_post_id", nulls = Nulls.SKIP) + public _FinalStage discussionPostId(Optional discussionPostId) { + this.discussionPostId = discussionPostId; + return this; + } + + /** + *

Forum feed containing the bounty's discussion thread. null for a bounty with no forum post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discussionFeedId(Nullable discussionFeedId) { + if (discussionFeedId.isNull()) { + this.discussionFeedId = null; + } else if (discussionFeedId.isEmpty()) { + this.discussionFeedId = Optional.empty(); + } else { + this.discussionFeedId = Optional.of(discussionFeedId.get()); + } + return this; + } + + /** + *

Forum feed containing the bounty's discussion thread. null for a bounty with no forum post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discussionFeedId(String discussionFeedId) { + this.discussionFeedId = Optional.ofNullable(discussionFeedId); + return this; + } + + /** + *

Forum feed containing the bounty's discussion thread. null for a bounty with no forum post.

+ */ + @java.lang.Override + @JsonSetter(value = "discussion_feed_id", nulls = Nulls.SKIP) + public _FinalStage discussionFeedId(Optional discussionFeedId) { + this.discussionFeedId = discussionFeedId; + return this; + } + + /** + *

Experience the bounty's discussion thread lives in, prefixed exp_. Read this — not experience_id — to open the thread: a platform-wide bounty has no hosting experience of its own but its discussion still lives in one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discussionExperienceId(Nullable discussionExperienceId) { + if (discussionExperienceId.isNull()) { + this.discussionExperienceId = null; + } else if (discussionExperienceId.isEmpty()) { + this.discussionExperienceId = Optional.empty(); + } else { + this.discussionExperienceId = Optional.of(discussionExperienceId.get()); + } + return this; + } + + /** + *

Experience the bounty's discussion thread lives in, prefixed exp_. Read this — not experience_id — to open the thread: a platform-wide bounty has no hosting experience of its own but its discussion still lives in one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage discussionExperienceId(String discussionExperienceId) { + this.discussionExperienceId = Optional.ofNullable(discussionExperienceId); + return this; + } + + /** + *

Experience the bounty's discussion thread lives in, prefixed exp_. Read this — not experience_id — to open the thread: a platform-wide bounty has no hosting experience of its own but its discussion still lives in one.

+ */ + @java.lang.Override + @JsonSetter(value = "discussion_experience_id", nulls = Nulls.SKIP) + public _FinalStage discussionExperienceId(Optional discussionExperienceId) { + this.discussionExperienceId = discussionExperienceId; + return this; + } + + /** + *

When cancellation was requested, as an ISO 8601 timestamp. On a closed bounty this means the cancel is pending: submissions are stopped and the bounty cancels once in-flight submissions resolve. On a canceled bounty it records when the cancellation was requested. null when no cancellation was ever requested.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelRequestedAt(Nullable cancelRequestedAt) { + if (cancelRequestedAt.isNull()) { + this.cancelRequestedAt = null; + } else if (cancelRequestedAt.isEmpty()) { + this.cancelRequestedAt = Optional.empty(); + } else { + this.cancelRequestedAt = Optional.of(cancelRequestedAt.get()); + } + return this; + } + + /** + *

When cancellation was requested, as an ISO 8601 timestamp. On a closed bounty this means the cancel is pending: submissions are stopped and the bounty cancels once in-flight submissions resolve. On a canceled bounty it records when the cancellation was requested. null when no cancellation was ever requested.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelRequestedAt(String cancelRequestedAt) { + this.cancelRequestedAt = Optional.ofNullable(cancelRequestedAt); + return this; + } + + /** + *

When cancellation was requested, as an ISO 8601 timestamp. On a closed bounty this means the cancel is pending: submissions are stopped and the bounty cancels once in-flight submissions resolve. On a canceled bounty it records when the cancellation was requested. null when no cancellation was ever requested.

+ */ + @java.lang.Override + @JsonSetter(value = "cancel_requested_at", nulls = Nulls.SKIP) + public _FinalStage cancelRequestedAt(Optional cancelRequestedAt) { + this.cancelRequestedAt = cancelRequestedAt; + return this; + } + + /** + *

What the poster wants the work to achieve, declared once at create. null for bounties created before the taxonomy rolled out.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessGoalType(Nullable businessGoalType) { + if (businessGoalType.isNull()) { + this.businessGoalType = null; + } else if (businessGoalType.isEmpty()) { + this.businessGoalType = Optional.empty(); + } else { + this.businessGoalType = Optional.of(businessGoalType.get()); + } + return this; + } + + /** + *

What the poster wants the work to achieve, declared once at create. null for bounties created before the taxonomy rolled out.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessGoalType(BountyListItemBusinessGoalType businessGoalType) { + this.businessGoalType = Optional.ofNullable(businessGoalType); + return this; + } + + /** + *

What the poster wants the work to achieve, declared once at create. null for bounties created before the taxonomy rolled out.

+ */ + @java.lang.Override + @JsonSetter(value = "business_goal_type", nulls = Nulls.SKIP) + public _FinalStage businessGoalType(Optional businessGoalType) { + this.businessGoalType = businessGoalType; + return this; + } + + @java.lang.Override + public _FinalStage addAllAllowedCountryCodes(List allowedCountryCodes) { + if (allowedCountryCodes != null) { + this.allowedCountryCodes.addAll(allowedCountryCodes); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllowedCountryCodes(String allowedCountryCodes) { + this.allowedCountryCodes.add(allowedCountryCodes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "allowed_country_codes", nulls = Nulls.SKIP) + public _FinalStage allowedCountryCodes(List allowedCountryCodes) { + this.allowedCountryCodes.clear(); + if (allowedCountryCodes != null) { + this.allowedCountryCodes.addAll(allowedCountryCodes); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllAcceptedDeliverableTypes( + List acceptedDeliverableTypes) { + if (acceptedDeliverableTypes != null) { + this.acceptedDeliverableTypes.addAll(acceptedDeliverableTypes); + } + return this; + } + + @java.lang.Override + public _FinalStage addAcceptedDeliverableTypes( + BountyListItemAcceptedDeliverableTypesItem acceptedDeliverableTypes) { + this.acceptedDeliverableTypes.add(acceptedDeliverableTypes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "accepted_deliverable_types", nulls = Nulls.SKIP) + public _FinalStage acceptedDeliverableTypes( + List acceptedDeliverableTypes) { + this.acceptedDeliverableTypes.clear(); + if (acceptedDeliverableTypes != null) { + this.acceptedDeliverableTypes.addAll(acceptedDeliverableTypes); + } + return this; + } + + @java.lang.Override + public BountyListItem build() { + return new BountyListItem( + acceptedDeliverableTypes, + acceptedSubmissionsCount, + acceptedSubmissionsLimit, + acceptedSubmissionsPerUserLimit, + affiliateShareAmount, + allowedCountryCodes, + budgetAmount, + businessGoalType, + cancelRequestedAt, + createdAt, + currency, + description, + discussionExperienceId, + discussionFeedId, + discussionPostId, + experienceId, + fundingAccount, + grossPaidOutAmount, + grossRewardAmount, + id, + netRewardAmount, + poster, + scheduledFrequency, + scheduledPublishAt, + spotsRemaining, + status, + submissionsClosedAt, + title, + unresolvedSubmissionsCount, + updatedAt, + viewerAcceptedSubmissionsCount, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/BountyListItemAcceptedDeliverableTypesItem.java b/src/main/java/com/whop/api/types/BountyListItemAcceptedDeliverableTypesItem.java new file mode 100644 index 00000000..fe780e31 --- /dev/null +++ b/src/main/java/com/whop/api/types/BountyListItemAcceptedDeliverableTypesItem.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BountyListItemAcceptedDeliverableTypesItem { + public static final BountyListItemAcceptedDeliverableTypesItem CONTENT_URL = + new BountyListItemAcceptedDeliverableTypesItem(Value.CONTENT_URL, "content_url"); + + public static final BountyListItemAcceptedDeliverableTypesItem MEDIA = + new BountyListItemAcceptedDeliverableTypesItem(Value.MEDIA, "media"); + + public static final BountyListItemAcceptedDeliverableTypesItem DATA_CAPTURE = + new BountyListItemAcceptedDeliverableTypesItem(Value.DATA_CAPTURE, "data_capture"); + + private final Value value; + + private final String string; + + BountyListItemAcceptedDeliverableTypesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BountyListItemAcceptedDeliverableTypesItem + && this.string.equals(((BountyListItemAcceptedDeliverableTypesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CONTENT_URL: + return visitor.visitContentUrl(); + case MEDIA: + return visitor.visitMedia(); + case DATA_CAPTURE: + return visitor.visitDataCapture(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BountyListItemAcceptedDeliverableTypesItem valueOf(String value) { + switch (value) { + case "content_url": + return CONTENT_URL; + case "media": + return MEDIA; + case "data_capture": + return DATA_CAPTURE; + default: + return new BountyListItemAcceptedDeliverableTypesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + CONTENT_URL, + + MEDIA, + + DATA_CAPTURE, + + UNKNOWN + } + + public interface Visitor { + T visitContentUrl(); + + T visitMedia(); + + T visitDataCapture(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/BountyListItemBusinessGoalType.java b/src/main/java/com/whop/api/types/BountyListItemBusinessGoalType.java new file mode 100644 index 00000000..a3052020 --- /dev/null +++ b/src/main/java/com/whop/api/types/BountyListItemBusinessGoalType.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BountyListItemBusinessGoalType { + public static final BountyListItemBusinessGoalType LOCAL_ACTIVATION = + new BountyListItemBusinessGoalType(Value.LOCAL_ACTIVATION, "local_activation"); + + public static final BountyListItemBusinessGoalType OTHER = new BountyListItemBusinessGoalType(Value.OTHER, "other"); + + public static final BountyListItemBusinessGoalType UGC_CONTENT = + new BountyListItemBusinessGoalType(Value.UGC_CONTENT, "ugc_content"); + + public static final BountyListItemBusinessGoalType CLIPPING = + new BountyListItemBusinessGoalType(Value.CLIPPING, "clipping"); + + public static final BountyListItemBusinessGoalType POST_ENGAGEMENT = + new BountyListItemBusinessGoalType(Value.POST_ENGAGEMENT, "post_engagement"); + + public static final BountyListItemBusinessGoalType OWNED_ACCOUNT_GROWTH = + new BountyListItemBusinessGoalType(Value.OWNED_ACCOUNT_GROWTH, "owned_account_growth"); + + public static final BountyListItemBusinessGoalType DATA_CAPTURE = + new BountyListItemBusinessGoalType(Value.DATA_CAPTURE, "data_capture"); + + private final Value value; + + private final String string; + + BountyListItemBusinessGoalType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BountyListItemBusinessGoalType + && this.string.equals(((BountyListItemBusinessGoalType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LOCAL_ACTIVATION: + return visitor.visitLocalActivation(); + case OTHER: + return visitor.visitOther(); + case UGC_CONTENT: + return visitor.visitUgcContent(); + case CLIPPING: + return visitor.visitClipping(); + case POST_ENGAGEMENT: + return visitor.visitPostEngagement(); + case OWNED_ACCOUNT_GROWTH: + return visitor.visitOwnedAccountGrowth(); + case DATA_CAPTURE: + return visitor.visitDataCapture(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BountyListItemBusinessGoalType valueOf(String value) { + switch (value) { + case "local_activation": + return LOCAL_ACTIVATION; + case "other": + return OTHER; + case "ugc_content": + return UGC_CONTENT; + case "clipping": + return CLIPPING; + case "post_engagement": + return POST_ENGAGEMENT; + case "owned_account_growth": + return OWNED_ACCOUNT_GROWTH; + case "data_capture": + return DATA_CAPTURE; + default: + return new BountyListItemBusinessGoalType(Value.UNKNOWN, value); + } + } + + public enum Value { + CLIPPING, + + POST_ENGAGEMENT, + + OWNED_ACCOUNT_GROWTH, + + UGC_CONTENT, + + LOCAL_ACTIVATION, + + DATA_CAPTURE, + + OTHER, + + UNKNOWN + } + + public interface Visitor { + T visitClipping(); + + T visitPostEngagement(); + + T visitOwnedAccountGrowth(); + + T visitUgcContent(); + + T visitLocalActivation(); + + T visitDataCapture(); + + T visitOther(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/BountyListItemScheduledFrequency.java b/src/main/java/com/whop/api/types/BountyListItemScheduledFrequency.java new file mode 100644 index 00000000..55aa99ad --- /dev/null +++ b/src/main/java/com/whop/api/types/BountyListItemScheduledFrequency.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BountyListItemScheduledFrequency { + public static final BountyListItemScheduledFrequency HOURLY = + new BountyListItemScheduledFrequency(Value.HOURLY, "hourly"); + + public static final BountyListItemScheduledFrequency ONCE = + new BountyListItemScheduledFrequency(Value.ONCE, "once"); + + public static final BountyListItemScheduledFrequency DAILY = + new BountyListItemScheduledFrequency(Value.DAILY, "daily"); + + public static final BountyListItemScheduledFrequency WEEKLY = + new BountyListItemScheduledFrequency(Value.WEEKLY, "weekly"); + + public static final BountyListItemScheduledFrequency MONTHLY = + new BountyListItemScheduledFrequency(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + BountyListItemScheduledFrequency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BountyListItemScheduledFrequency + && this.string.equals(((BountyListItemScheduledFrequency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HOURLY: + return visitor.visitHourly(); + case ONCE: + return visitor.visitOnce(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BountyListItemScheduledFrequency valueOf(String value) { + switch (value) { + case "hourly": + return HOURLY; + case "once": + return ONCE; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new BountyListItemScheduledFrequency(Value.UNKNOWN, value); + } + } + + public enum Value { + ONCE, + + HOURLY, + + DAILY, + + WEEKLY, + + MONTHLY, + + UNKNOWN + } + + public interface Visitor { + T visitOnce(); + + T visitHourly(); + + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/BountyListItemStatus.java b/src/main/java/com/whop/api/types/BountyListItemStatus.java new file mode 100644 index 00000000..86ade4d8 --- /dev/null +++ b/src/main/java/com/whop/api/types/BountyListItemStatus.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BountyListItemStatus { + public static final BountyListItemStatus CLOSED = new BountyListItemStatus(Value.CLOSED, "closed"); + + public static final BountyListItemStatus CANCELED = new BountyListItemStatus(Value.CANCELED, "canceled"); + + public static final BountyListItemStatus COMPLETED = new BountyListItemStatus(Value.COMPLETED, "completed"); + + public static final BountyListItemStatus SCHEDULED = new BountyListItemStatus(Value.SCHEDULED, "scheduled"); + + public static final BountyListItemStatus OPEN = new BountyListItemStatus(Value.OPEN, "open"); + + private final Value value; + + private final String string; + + BountyListItemStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BountyListItemStatus && this.string.equals(((BountyListItemStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CLOSED: + return visitor.visitClosed(); + case CANCELED: + return visitor.visitCanceled(); + case COMPLETED: + return visitor.visitCompleted(); + case SCHEDULED: + return visitor.visitScheduled(); + case OPEN: + return visitor.visitOpen(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BountyListItemStatus valueOf(String value) { + switch (value) { + case "closed": + return CLOSED; + case "canceled": + return CANCELED; + case "completed": + return COMPLETED; + case "scheduled": + return SCHEDULED; + case "open": + return OPEN; + default: + return new BountyListItemStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + SCHEDULED, + + OPEN, + + CLOSED, + + COMPLETED, + + CANCELED, + + UNKNOWN + } + + public interface Visitor { + T visitScheduled(); + + T visitOpen(); + + T visitClosed(); + + T visitCompleted(); + + T visitCanceled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/BountyScheduledFrequency.java b/src/main/java/com/whop/api/types/BountyScheduledFrequency.java new file mode 100644 index 00000000..1458f4b3 --- /dev/null +++ b/src/main/java/com/whop/api/types/BountyScheduledFrequency.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BountyScheduledFrequency { + public static final BountyScheduledFrequency HOURLY = new BountyScheduledFrequency(Value.HOURLY, "hourly"); + + public static final BountyScheduledFrequency ONCE = new BountyScheduledFrequency(Value.ONCE, "once"); + + public static final BountyScheduledFrequency DAILY = new BountyScheduledFrequency(Value.DAILY, "daily"); + + public static final BountyScheduledFrequency WEEKLY = new BountyScheduledFrequency(Value.WEEKLY, "weekly"); + + public static final BountyScheduledFrequency MONTHLY = new BountyScheduledFrequency(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + BountyScheduledFrequency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BountyScheduledFrequency + && this.string.equals(((BountyScheduledFrequency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HOURLY: + return visitor.visitHourly(); + case ONCE: + return visitor.visitOnce(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BountyScheduledFrequency valueOf(String value) { + switch (value) { + case "hourly": + return HOURLY; + case "once": + return ONCE; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new BountyScheduledFrequency(Value.UNKNOWN, value); + } + } + + public enum Value { + ONCE, + + HOURLY, + + DAILY, + + WEEKLY, + + MONTHLY, + + UNKNOWN + } + + public interface Visitor { + T visitOnce(); + + T visitHourly(); + + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/BountyStatus.java b/src/main/java/com/whop/api/types/BountyStatus.java new file mode 100644 index 00000000..99999fbd --- /dev/null +++ b/src/main/java/com/whop/api/types/BountyStatus.java @@ -0,0 +1,112 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BountyStatus { + public static final BountyStatus CLOSED = new BountyStatus(Value.CLOSED, "closed"); + + public static final BountyStatus CANCELED = new BountyStatus(Value.CANCELED, "canceled"); + + public static final BountyStatus COMPLETED = new BountyStatus(Value.COMPLETED, "completed"); + + public static final BountyStatus SCHEDULED = new BountyStatus(Value.SCHEDULED, "scheduled"); + + public static final BountyStatus OPEN = new BountyStatus(Value.OPEN, "open"); + + private final Value value; + + private final String string; + + BountyStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof BountyStatus && this.string.equals(((BountyStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CLOSED: + return visitor.visitClosed(); + case CANCELED: + return visitor.visitCanceled(); + case COMPLETED: + return visitor.visitCompleted(); + case SCHEDULED: + return visitor.visitScheduled(); + case OPEN: + return visitor.visitOpen(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BountyStatus valueOf(String value) { + switch (value) { + case "closed": + return CLOSED; + case "canceled": + return CANCELED; + case "completed": + return COMPLETED; + case "scheduled": + return SCHEDULED; + case "open": + return OPEN; + default: + return new BountyStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + SCHEDULED, + + OPEN, + + CLOSED, + + COMPLETED, + + CANCELED, + + UNKNOWN + } + + public interface Visitor { + T visitScheduled(); + + T visitOpen(); + + T visitClosed(); + + T visitCompleted(); + + T visitCanceled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/BountySubmission.java b/src/main/java/com/whop/api/types/BountySubmission.java new file mode 100644 index 00000000..c46c5c24 --- /dev/null +++ b/src/main/java/com/whop/api/types/BountySubmission.java @@ -0,0 +1,1680 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BountySubmission.Builder.class) +public final class BountySubmission { + private final String bountyId; + + private final Optional> captureClips; + + private final Optional captureFilename; + + private final int capturedClipCount; + + private final int capturedDurationSeconds; + + private final Optional city; + + private final Optional claimedAt; + + private final Optional content; + + private final Optional country; + + private final String createdAt; + + private final Optional deliverableType; + + private final Optional> deliverableUrls; + + private final Optional denialReason; + + private final Optional device; + + private final List files; + + private final Optional fov; + + private final String id; + + private final Optional latestProofLivestreamFeed; + + private final Optional operator; + + private final Optional resolvedAt; + + private final Optional site; + + private final Optional station; + + private final Optional status; + + private final Optional submittedAt; + + private final String updatedAt; + + private final UserSummary worker; + + private final Map additionalProperties; + + private BountySubmission( + String bountyId, + Optional> captureClips, + Optional captureFilename, + int capturedClipCount, + int capturedDurationSeconds, + Optional city, + Optional claimedAt, + Optional content, + Optional country, + String createdAt, + Optional deliverableType, + Optional> deliverableUrls, + Optional denialReason, + Optional device, + List files, + Optional fov, + String id, + Optional latestProofLivestreamFeed, + Optional operator, + Optional resolvedAt, + Optional site, + Optional station, + Optional status, + Optional submittedAt, + String updatedAt, + UserSummary worker, + Map additionalProperties) { + this.bountyId = bountyId; + this.captureClips = captureClips; + this.captureFilename = captureFilename; + this.capturedClipCount = capturedClipCount; + this.capturedDurationSeconds = capturedDurationSeconds; + this.city = city; + this.claimedAt = claimedAt; + this.content = content; + this.country = country; + this.createdAt = createdAt; + this.deliverableType = deliverableType; + this.deliverableUrls = deliverableUrls; + this.denialReason = denialReason; + this.device = device; + this.files = files; + this.fov = fov; + this.id = id; + this.latestProofLivestreamFeed = latestProofLivestreamFeed; + this.operator = operator; + this.resolvedAt = resolvedAt; + this.site = site; + this.station = station; + this.status = status; + this.submittedAt = submittedAt; + this.updatedAt = updatedAt; + this.worker = worker; + this.additionalProperties = additionalProperties; + } + + /** + * @return The bounty the work was submitted to, prefixed bnty_. + */ + @JsonProperty("bounty_id") + public String getBountyId() { + return bountyId; + } + + @JsonIgnore + public Optional> getCaptureClips() { + if (captureClips == null) { + return Optional.empty(); + } + return captureClips; + } + + /** + * @return The vendor filename stem Country_City_Site_Station_Operator, derived from the capture metadata. null until every component is present. + */ + @JsonIgnore + public Optional getCaptureFilename() { + if (captureFilename == null) { + return Optional.empty(); + } + return captureFilename; + } + + /** + * @return Number of verified capture clips accepted for this submission so far. 0 for submissions whose deliverable doesn't accumulate clips. + */ + @JsonProperty("captured_clip_count") + public int getCapturedClipCount() { + return capturedClipCount; + } + + /** + * @return Total verified duration of accepted capture clips, in whole seconds. 0 for submissions whose deliverable doesn't accumulate clips. + */ + @JsonProperty("captured_duration_seconds") + public int getCapturedDurationSeconds() { + return capturedDurationSeconds; + } + + /** + * @return Capture metadata: city the footage was recorded in. null unless capture metadata was provided. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return When the worker claimed the submission, as an ISO 8601 timestamp. + */ + @JsonIgnore + public Optional getClaimedAt() { + if (claimedAt == null) { + return Optional.empty(); + } + return claimedAt; + } + + /** + * @return Written proof the worker submitted with their work. + */ + @JsonIgnore + public Optional getContent() { + if (content == null) { + return Optional.empty(); + } + return content; + } + + /** + * @return Capture metadata: country the footage was recorded in. null unless capture metadata was provided. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return When the submission was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return How the work arrived when it came in through the API in one shot, informational only — read the work from deliverable_urls, files, and capture_clips directly. null for submissions whose proof is a livestream recording, including ones that attached links or files on submit. + */ + @JsonIgnore + public Optional getDeliverableType() { + if (deliverableType == null) { + return Optional.empty(); + } + return deliverableType; + } + + @JsonIgnore + public Optional> getDeliverableUrls() { + if (deliverableUrls == null) { + return Optional.empty(); + } + return deliverableUrls; + } + + /** + * @return Why the submission was denied, when a presentable reason exists. Always null unless status is denied. + */ + @JsonIgnore + public Optional getDenialReason() { + if (denialReason == null) { + return Optional.empty(); + } + return denialReason; + } + + /** + * @return Capture metadata: device the footage was recorded on. null unless capture metadata was provided. + */ + @JsonIgnore + public Optional getDevice() { + if (device == null) { + return Optional.empty(); + } + return device; + } + + @JsonProperty("files") + public List getFiles() { + return files; + } + + /** + * @return Capture metadata: horizontal field of view in degrees. null when not reported. + */ + @JsonIgnore + public Optional getFov() { + if (fov == null) { + return Optional.empty(); + } + return fov; + } + + /** + * @return Submission ID, prefixed btys_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Latest public proof livestream attached to the submission. + */ + @JsonIgnore + public Optional getLatestProofLivestreamFeed() { + if (latestProofLivestreamFeed == null) { + return Optional.empty(); + } + return latestProofLivestreamFeed; + } + + /** + * @return Capture metadata: identifier of the person who recorded the footage. null unless capture metadata was provided. + */ + @JsonIgnore + public Optional getOperator() { + if (operator == null) { + return Optional.empty(); + } + return operator; + } + + /** + * @return When the submission was approved or denied, as an ISO 8601 timestamp. null until then. + */ + @JsonIgnore + public Optional getResolvedAt() { + if (resolvedAt == null) { + return Optional.empty(); + } + return resolvedAt; + } + + /** + * @return Capture metadata: site or venue the footage was recorded at. null unless capture metadata was provided. + */ + @JsonIgnore + public Optional getSite() { + if (site == null) { + return Optional.empty(); + } + return site; + } + + /** + * @return Capture metadata: station or position within the site. null unless capture metadata was provided. + */ + @JsonIgnore + public Optional getStation() { + if (station == null) { + return Optional.empty(); + } + return station; + } + + /** + * @return Lifecycle state. in_progress submissions are active attempts that have not submitted proof yet; submitted submissions await review; approved submissions were accepted and paid; denied submissions were rejected. null when the attempt ended without proof, taking it out of the public lifecycle — those attempts are absent from every public list and read. + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return When proof was submitted for review, as an ISO 8601 timestamp. null while the attempt is in progress. + */ + @JsonIgnore + public Optional getSubmittedAt() { + if (submittedAt == null) { + return Optional.empty(); + } + return submittedAt; + } + + /** + * @return When the submission was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return User who submitted the work. + */ + @JsonProperty("worker") + public UserSummary getWorker() { + return worker; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("capture_clips") + private Optional> _getCaptureClips() { + return captureClips; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("capture_filename") + private Optional _getCaptureFilename() { + return captureFilename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("claimed_at") + private Optional _getClaimedAt() { + return claimedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content") + private Optional _getContent() { + return content; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("deliverable_type") + private Optional _getDeliverableType() { + return deliverableType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("deliverable_urls") + private Optional> _getDeliverableUrls() { + return deliverableUrls; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("denial_reason") + private Optional _getDenialReason() { + return denialReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("device") + private Optional _getDevice() { + return device; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fov") + private Optional _getFov() { + return fov; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("latest_proof_livestream_feed") + private Optional _getLatestProofLivestreamFeed() { + return latestProofLivestreamFeed; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("operator") + private Optional _getOperator() { + return operator; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resolved_at") + private Optional _getResolvedAt() { + return resolvedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("site") + private Optional _getSite() { + return site; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("station") + private Optional _getStation() { + return station; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("submitted_at") + private Optional _getSubmittedAt() { + return submittedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BountySubmission && equalTo((BountySubmission) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BountySubmission other) { + return bountyId.equals(other.bountyId) + && captureClips.equals(other.captureClips) + && captureFilename.equals(other.captureFilename) + && capturedClipCount == other.capturedClipCount + && capturedDurationSeconds == other.capturedDurationSeconds + && city.equals(other.city) + && claimedAt.equals(other.claimedAt) + && content.equals(other.content) + && country.equals(other.country) + && createdAt.equals(other.createdAt) + && deliverableType.equals(other.deliverableType) + && deliverableUrls.equals(other.deliverableUrls) + && denialReason.equals(other.denialReason) + && device.equals(other.device) + && files.equals(other.files) + && fov.equals(other.fov) + && id.equals(other.id) + && latestProofLivestreamFeed.equals(other.latestProofLivestreamFeed) + && operator.equals(other.operator) + && resolvedAt.equals(other.resolvedAt) + && site.equals(other.site) + && station.equals(other.station) + && status.equals(other.status) + && submittedAt.equals(other.submittedAt) + && updatedAt.equals(other.updatedAt) + && worker.equals(other.worker); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bountyId, + this.captureClips, + this.captureFilename, + this.capturedClipCount, + this.capturedDurationSeconds, + this.city, + this.claimedAt, + this.content, + this.country, + this.createdAt, + this.deliverableType, + this.deliverableUrls, + this.denialReason, + this.device, + this.files, + this.fov, + this.id, + this.latestProofLivestreamFeed, + this.operator, + this.resolvedAt, + this.site, + this.station, + this.status, + this.submittedAt, + this.updatedAt, + this.worker); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BountyIdStage builder() { + return new Builder(); + } + + public interface BountyIdStage { + /** + *

The bounty the work was submitted to, prefixed bnty_.

+ */ + CapturedClipCountStage bountyId(@NotNull String bountyId); + + Builder from(BountySubmission other); + } + + public interface CapturedClipCountStage { + /** + *

Number of verified capture clips accepted for this submission so far. 0 for submissions whose deliverable doesn't accumulate clips.

+ */ + CapturedDurationSecondsStage capturedClipCount(int capturedClipCount); + } + + public interface CapturedDurationSecondsStage { + /** + *

Total verified duration of accepted capture clips, in whole seconds. 0 for submissions whose deliverable doesn't accumulate clips.

+ */ + CreatedAtStage capturedDurationSeconds(int capturedDurationSeconds); + } + + public interface CreatedAtStage { + /** + *

When the submission was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Submission ID, prefixed btys_.

+ */ + UpdatedAtStage id(@NotNull String id); + } + + public interface UpdatedAtStage { + /** + *

When the submission was last updated, as an ISO 8601 timestamp.

+ */ + WorkerStage updatedAt(@NotNull String updatedAt); + } + + public interface WorkerStage { + /** + *

User who submitted the work.

+ */ + _FinalStage worker(@NotNull UserSummary worker); + } + + public interface _FinalStage { + BountySubmission build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage captureClips(Optional> captureClips); + + _FinalStage captureClips(List captureClips); + + _FinalStage captureClips(Nullable> captureClips); + + /** + *

The vendor filename stem Country_City_Site_Station_Operator, derived from the capture metadata. null until every component is present.

+ */ + _FinalStage captureFilename(Optional captureFilename); + + _FinalStage captureFilename(String captureFilename); + + _FinalStage captureFilename(Nullable captureFilename); + + /** + *

Capture metadata: city the footage was recorded in. null unless capture metadata was provided.

+ */ + _FinalStage city(Optional city); + + _FinalStage city(String city); + + _FinalStage city(Nullable city); + + /** + *

When the worker claimed the submission, as an ISO 8601 timestamp.

+ */ + _FinalStage claimedAt(Optional claimedAt); + + _FinalStage claimedAt(String claimedAt); + + _FinalStage claimedAt(Nullable claimedAt); + + /** + *

Written proof the worker submitted with their work.

+ */ + _FinalStage content(Optional content); + + _FinalStage content(String content); + + _FinalStage content(Nullable content); + + /** + *

Capture metadata: country the footage was recorded in. null unless capture metadata was provided.

+ */ + _FinalStage country(Optional country); + + _FinalStage country(String country); + + _FinalStage country(Nullable country); + + /** + *

How the work arrived when it came in through the API in one shot, informational only — read the work from deliverable_urls, files, and capture_clips directly. null for submissions whose proof is a livestream recording, including ones that attached links or files on submit.

+ */ + _FinalStage deliverableType(Optional deliverableType); + + _FinalStage deliverableType(BountySubmissionDeliverableType deliverableType); + + _FinalStage deliverableType(Nullable deliverableType); + + _FinalStage deliverableUrls(Optional> deliverableUrls); + + _FinalStage deliverableUrls(List deliverableUrls); + + _FinalStage deliverableUrls(Nullable> deliverableUrls); + + /** + *

Why the submission was denied, when a presentable reason exists. Always null unless status is denied.

+ */ + _FinalStage denialReason(Optional denialReason); + + _FinalStage denialReason(String denialReason); + + _FinalStage denialReason(Nullable denialReason); + + /** + *

Capture metadata: device the footage was recorded on. null unless capture metadata was provided.

+ */ + _FinalStage device(Optional device); + + _FinalStage device(String device); + + _FinalStage device(Nullable device); + + _FinalStage files(List files); + + _FinalStage addFiles(BountySubmissionFile files); + + _FinalStage addAllFiles(List files); + + /** + *

Capture metadata: horizontal field of view in degrees. null when not reported.

+ */ + _FinalStage fov(Optional fov); + + _FinalStage fov(Integer fov); + + _FinalStage fov(Nullable fov); + + /** + *

Latest public proof livestream attached to the submission.

+ */ + _FinalStage latestProofLivestreamFeed(Optional latestProofLivestreamFeed); + + _FinalStage latestProofLivestreamFeed(BountySubmissionLivestreamFeed latestProofLivestreamFeed); + + _FinalStage latestProofLivestreamFeed(Nullable latestProofLivestreamFeed); + + /** + *

Capture metadata: identifier of the person who recorded the footage. null unless capture metadata was provided.

+ */ + _FinalStage operator(Optional operator); + + _FinalStage operator(String operator); + + _FinalStage operator(Nullable operator); + + /** + *

When the submission was approved or denied, as an ISO 8601 timestamp. null until then.

+ */ + _FinalStage resolvedAt(Optional resolvedAt); + + _FinalStage resolvedAt(String resolvedAt); + + _FinalStage resolvedAt(Nullable resolvedAt); + + /** + *

Capture metadata: site or venue the footage was recorded at. null unless capture metadata was provided.

+ */ + _FinalStage site(Optional site); + + _FinalStage site(String site); + + _FinalStage site(Nullable site); + + /** + *

Capture metadata: station or position within the site. null unless capture metadata was provided.

+ */ + _FinalStage station(Optional station); + + _FinalStage station(String station); + + _FinalStage station(Nullable station); + + /** + *

Lifecycle state. in_progress submissions are active attempts that have not submitted proof yet; submitted submissions await review; approved submissions were accepted and paid; denied submissions were rejected. null when the attempt ended without proof, taking it out of the public lifecycle — those attempts are absent from every public list and read.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(BountySubmissionStatus status); + + _FinalStage status(Nullable status); + + /** + *

When proof was submitted for review, as an ISO 8601 timestamp. null while the attempt is in progress.

+ */ + _FinalStage submittedAt(Optional submittedAt); + + _FinalStage submittedAt(String submittedAt); + + _FinalStage submittedAt(Nullable submittedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BountyIdStage, + CapturedClipCountStage, + CapturedDurationSecondsStage, + CreatedAtStage, + IdStage, + UpdatedAtStage, + WorkerStage, + _FinalStage { + private String bountyId; + + private int capturedClipCount; + + private int capturedDurationSeconds; + + private String createdAt; + + private String id; + + private String updatedAt; + + private UserSummary worker; + + private Optional submittedAt = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional station = Optional.empty(); + + private Optional site = Optional.empty(); + + private Optional resolvedAt = Optional.empty(); + + private Optional operator = Optional.empty(); + + private Optional latestProofLivestreamFeed = Optional.empty(); + + private Optional fov = Optional.empty(); + + private List files = new ArrayList<>(); + + private Optional device = Optional.empty(); + + private Optional denialReason = Optional.empty(); + + private Optional> deliverableUrls = Optional.empty(); + + private Optional deliverableType = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional content = Optional.empty(); + + private Optional claimedAt = Optional.empty(); + + private Optional city = Optional.empty(); + + private Optional captureFilename = Optional.empty(); + + private Optional> captureClips = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BountySubmission other) { + bountyId(other.getBountyId()); + captureClips(other.getCaptureClips()); + captureFilename(other.getCaptureFilename()); + capturedClipCount(other.getCapturedClipCount()); + capturedDurationSeconds(other.getCapturedDurationSeconds()); + city(other.getCity()); + claimedAt(other.getClaimedAt()); + content(other.getContent()); + country(other.getCountry()); + createdAt(other.getCreatedAt()); + deliverableType(other.getDeliverableType()); + deliverableUrls(other.getDeliverableUrls()); + denialReason(other.getDenialReason()); + device(other.getDevice()); + files(other.getFiles()); + fov(other.getFov()); + id(other.getId()); + latestProofLivestreamFeed(other.getLatestProofLivestreamFeed()); + operator(other.getOperator()); + resolvedAt(other.getResolvedAt()); + site(other.getSite()); + station(other.getStation()); + status(other.getStatus()); + submittedAt(other.getSubmittedAt()); + updatedAt(other.getUpdatedAt()); + worker(other.getWorker()); + return this; + } + + /** + *

The bounty the work was submitted to, prefixed bnty_.

+ *

The bounty the work was submitted to, prefixed bnty_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bounty_id") + public CapturedClipCountStage bountyId(@NotNull String bountyId) { + this.bountyId = Objects.requireNonNull(bountyId, "bountyId must not be null"); + return this; + } + + /** + *

Number of verified capture clips accepted for this submission so far. 0 for submissions whose deliverable doesn't accumulate clips.

+ *

Number of verified capture clips accepted for this submission so far. 0 for submissions whose deliverable doesn't accumulate clips.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("captured_clip_count") + public CapturedDurationSecondsStage capturedClipCount(int capturedClipCount) { + this.capturedClipCount = capturedClipCount; + return this; + } + + /** + *

Total verified duration of accepted capture clips, in whole seconds. 0 for submissions whose deliverable doesn't accumulate clips.

+ *

Total verified duration of accepted capture clips, in whole seconds. 0 for submissions whose deliverable doesn't accumulate clips.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("captured_duration_seconds") + public CreatedAtStage capturedDurationSeconds(int capturedDurationSeconds) { + this.capturedDurationSeconds = capturedDurationSeconds; + return this; + } + + /** + *

When the submission was created, as an ISO 8601 timestamp.

+ *

When the submission was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Submission ID, prefixed btys_.

+ *

Submission ID, prefixed btys_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UpdatedAtStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

When the submission was last updated, as an ISO 8601 timestamp.

+ *

When the submission was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public WorkerStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

User who submitted the work.

+ *

User who submitted the work.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("worker") + public _FinalStage worker(@NotNull UserSummary worker) { + this.worker = Objects.requireNonNull(worker, "worker must not be null"); + return this; + } + + /** + *

When proof was submitted for review, as an ISO 8601 timestamp. null while the attempt is in progress.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage submittedAt(Nullable submittedAt) { + if (submittedAt.isNull()) { + this.submittedAt = null; + } else if (submittedAt.isEmpty()) { + this.submittedAt = Optional.empty(); + } else { + this.submittedAt = Optional.of(submittedAt.get()); + } + return this; + } + + /** + *

When proof was submitted for review, as an ISO 8601 timestamp. null while the attempt is in progress.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage submittedAt(String submittedAt) { + this.submittedAt = Optional.ofNullable(submittedAt); + return this; + } + + /** + *

When proof was submitted for review, as an ISO 8601 timestamp. null while the attempt is in progress.

+ */ + @java.lang.Override + @JsonSetter(value = "submitted_at", nulls = Nulls.SKIP) + public _FinalStage submittedAt(Optional submittedAt) { + this.submittedAt = submittedAt; + return this; + } + + /** + *

Lifecycle state. in_progress submissions are active attempts that have not submitted proof yet; submitted submissions await review; approved submissions were accepted and paid; denied submissions were rejected. null when the attempt ended without proof, taking it out of the public lifecycle — those attempts are absent from every public list and read.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

Lifecycle state. in_progress submissions are active attempts that have not submitted proof yet; submitted submissions await review; approved submissions were accepted and paid; denied submissions were rejected. null when the attempt ended without proof, taking it out of the public lifecycle — those attempts are absent from every public list and read.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(BountySubmissionStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Lifecycle state. in_progress submissions are active attempts that have not submitted proof yet; submitted submissions await review; approved submissions were accepted and paid; denied submissions were rejected. null when the attempt ended without proof, taking it out of the public lifecycle — those attempts are absent from every public list and read.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

Capture metadata: station or position within the site. null unless capture metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage station(Nullable station) { + if (station.isNull()) { + this.station = null; + } else if (station.isEmpty()) { + this.station = Optional.empty(); + } else { + this.station = Optional.of(station.get()); + } + return this; + } + + /** + *

Capture metadata: station or position within the site. null unless capture metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage station(String station) { + this.station = Optional.ofNullable(station); + return this; + } + + /** + *

Capture metadata: station or position within the site. null unless capture metadata was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "station", nulls = Nulls.SKIP) + public _FinalStage station(Optional station) { + this.station = station; + return this; + } + + /** + *

Capture metadata: site or venue the footage was recorded at. null unless capture metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage site(Nullable site) { + if (site.isNull()) { + this.site = null; + } else if (site.isEmpty()) { + this.site = Optional.empty(); + } else { + this.site = Optional.of(site.get()); + } + return this; + } + + /** + *

Capture metadata: site or venue the footage was recorded at. null unless capture metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage site(String site) { + this.site = Optional.ofNullable(site); + return this; + } + + /** + *

Capture metadata: site or venue the footage was recorded at. null unless capture metadata was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "site", nulls = Nulls.SKIP) + public _FinalStage site(Optional site) { + this.site = site; + return this; + } + + /** + *

When the submission was approved or denied, as an ISO 8601 timestamp. null until then.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolvedAt(Nullable resolvedAt) { + if (resolvedAt.isNull()) { + this.resolvedAt = null; + } else if (resolvedAt.isEmpty()) { + this.resolvedAt = Optional.empty(); + } else { + this.resolvedAt = Optional.of(resolvedAt.get()); + } + return this; + } + + /** + *

When the submission was approved or denied, as an ISO 8601 timestamp. null until then.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolvedAt(String resolvedAt) { + this.resolvedAt = Optional.ofNullable(resolvedAt); + return this; + } + + /** + *

When the submission was approved or denied, as an ISO 8601 timestamp. null until then.

+ */ + @java.lang.Override + @JsonSetter(value = "resolved_at", nulls = Nulls.SKIP) + public _FinalStage resolvedAt(Optional resolvedAt) { + this.resolvedAt = resolvedAt; + return this; + } + + /** + *

Capture metadata: identifier of the person who recorded the footage. null unless capture metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage operator(Nullable operator) { + if (operator.isNull()) { + this.operator = null; + } else if (operator.isEmpty()) { + this.operator = Optional.empty(); + } else { + this.operator = Optional.of(operator.get()); + } + return this; + } + + /** + *

Capture metadata: identifier of the person who recorded the footage. null unless capture metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage operator(String operator) { + this.operator = Optional.ofNullable(operator); + return this; + } + + /** + *

Capture metadata: identifier of the person who recorded the footage. null unless capture metadata was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "operator", nulls = Nulls.SKIP) + public _FinalStage operator(Optional operator) { + this.operator = operator; + return this; + } + + /** + *

Latest public proof livestream attached to the submission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage latestProofLivestreamFeed( + Nullable latestProofLivestreamFeed) { + if (latestProofLivestreamFeed.isNull()) { + this.latestProofLivestreamFeed = null; + } else if (latestProofLivestreamFeed.isEmpty()) { + this.latestProofLivestreamFeed = Optional.empty(); + } else { + this.latestProofLivestreamFeed = Optional.of(latestProofLivestreamFeed.get()); + } + return this; + } + + /** + *

Latest public proof livestream attached to the submission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage latestProofLivestreamFeed(BountySubmissionLivestreamFeed latestProofLivestreamFeed) { + this.latestProofLivestreamFeed = Optional.ofNullable(latestProofLivestreamFeed); + return this; + } + + /** + *

Latest public proof livestream attached to the submission.

+ */ + @java.lang.Override + @JsonSetter(value = "latest_proof_livestream_feed", nulls = Nulls.SKIP) + public _FinalStage latestProofLivestreamFeed( + Optional latestProofLivestreamFeed) { + this.latestProofLivestreamFeed = latestProofLivestreamFeed; + return this; + } + + /** + *

Capture metadata: horizontal field of view in degrees. null when not reported.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fov(Nullable fov) { + if (fov.isNull()) { + this.fov = null; + } else if (fov.isEmpty()) { + this.fov = Optional.empty(); + } else { + this.fov = Optional.of(fov.get()); + } + return this; + } + + /** + *

Capture metadata: horizontal field of view in degrees. null when not reported.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fov(Integer fov) { + this.fov = Optional.ofNullable(fov); + return this; + } + + /** + *

Capture metadata: horizontal field of view in degrees. null when not reported.

+ */ + @java.lang.Override + @JsonSetter(value = "fov", nulls = Nulls.SKIP) + public _FinalStage fov(Optional fov) { + this.fov = fov; + return this; + } + + @java.lang.Override + public _FinalStage addAllFiles(List files) { + if (files != null) { + this.files.addAll(files); + } + return this; + } + + @java.lang.Override + public _FinalStage addFiles(BountySubmissionFile files) { + this.files.add(files); + return this; + } + + @java.lang.Override + @JsonSetter(value = "files", nulls = Nulls.SKIP) + public _FinalStage files(List files) { + this.files.clear(); + if (files != null) { + this.files.addAll(files); + } + return this; + } + + /** + *

Capture metadata: device the footage was recorded on. null unless capture metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage device(Nullable device) { + if (device.isNull()) { + this.device = null; + } else if (device.isEmpty()) { + this.device = Optional.empty(); + } else { + this.device = Optional.of(device.get()); + } + return this; + } + + /** + *

Capture metadata: device the footage was recorded on. null unless capture metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage device(String device) { + this.device = Optional.ofNullable(device); + return this; + } + + /** + *

Capture metadata: device the footage was recorded on. null unless capture metadata was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "device", nulls = Nulls.SKIP) + public _FinalStage device(Optional device) { + this.device = device; + return this; + } + + /** + *

Why the submission was denied, when a presentable reason exists. Always null unless status is denied.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage denialReason(Nullable denialReason) { + if (denialReason.isNull()) { + this.denialReason = null; + } else if (denialReason.isEmpty()) { + this.denialReason = Optional.empty(); + } else { + this.denialReason = Optional.of(denialReason.get()); + } + return this; + } + + /** + *

Why the submission was denied, when a presentable reason exists. Always null unless status is denied.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage denialReason(String denialReason) { + this.denialReason = Optional.ofNullable(denialReason); + return this; + } + + /** + *

Why the submission was denied, when a presentable reason exists. Always null unless status is denied.

+ */ + @java.lang.Override + @JsonSetter(value = "denial_reason", nulls = Nulls.SKIP) + public _FinalStage denialReason(Optional denialReason) { + this.denialReason = denialReason; + return this; + } + + @java.lang.Override + public _FinalStage deliverableUrls(Nullable> deliverableUrls) { + if (deliverableUrls.isNull()) { + this.deliverableUrls = null; + } else if (deliverableUrls.isEmpty()) { + this.deliverableUrls = Optional.empty(); + } else { + this.deliverableUrls = Optional.of(deliverableUrls.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage deliverableUrls(List deliverableUrls) { + this.deliverableUrls = Optional.ofNullable(deliverableUrls); + return this; + } + + @java.lang.Override + @JsonSetter(value = "deliverable_urls", nulls = Nulls.SKIP) + public _FinalStage deliverableUrls(Optional> deliverableUrls) { + this.deliverableUrls = deliverableUrls; + return this; + } + + /** + *

How the work arrived when it came in through the API in one shot, informational only — read the work from deliverable_urls, files, and capture_clips directly. null for submissions whose proof is a livestream recording, including ones that attached links or files on submit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage deliverableType(Nullable deliverableType) { + if (deliverableType.isNull()) { + this.deliverableType = null; + } else if (deliverableType.isEmpty()) { + this.deliverableType = Optional.empty(); + } else { + this.deliverableType = Optional.of(deliverableType.get()); + } + return this; + } + + /** + *

How the work arrived when it came in through the API in one shot, informational only — read the work from deliverable_urls, files, and capture_clips directly. null for submissions whose proof is a livestream recording, including ones that attached links or files on submit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage deliverableType(BountySubmissionDeliverableType deliverableType) { + this.deliverableType = Optional.ofNullable(deliverableType); + return this; + } + + /** + *

How the work arrived when it came in through the API in one shot, informational only — read the work from deliverable_urls, files, and capture_clips directly. null for submissions whose proof is a livestream recording, including ones that attached links or files on submit.

+ */ + @java.lang.Override + @JsonSetter(value = "deliverable_type", nulls = Nulls.SKIP) + public _FinalStage deliverableType(Optional deliverableType) { + this.deliverableType = deliverableType; + return this; + } + + /** + *

Capture metadata: country the footage was recorded in. null unless capture metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

Capture metadata: country the footage was recorded in. null unless capture metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

Capture metadata: country the footage was recorded in. null unless capture metadata was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public _FinalStage country(Optional country) { + this.country = country; + return this; + } + + /** + *

Written proof the worker submitted with their work.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(Nullable content) { + if (content.isNull()) { + this.content = null; + } else if (content.isEmpty()) { + this.content = Optional.empty(); + } else { + this.content = Optional.of(content.get()); + } + return this; + } + + /** + *

Written proof the worker submitted with their work.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

Written proof the worker submitted with their work.

+ */ + @java.lang.Override + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public _FinalStage content(Optional content) { + this.content = content; + return this; + } + + /** + *

When the worker claimed the submission, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage claimedAt(Nullable claimedAt) { + if (claimedAt.isNull()) { + this.claimedAt = null; + } else if (claimedAt.isEmpty()) { + this.claimedAt = Optional.empty(); + } else { + this.claimedAt = Optional.of(claimedAt.get()); + } + return this; + } + + /** + *

When the worker claimed the submission, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage claimedAt(String claimedAt) { + this.claimedAt = Optional.ofNullable(claimedAt); + return this; + } + + /** + *

When the worker claimed the submission, as an ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "claimed_at", nulls = Nulls.SKIP) + public _FinalStage claimedAt(Optional claimedAt) { + this.claimedAt = claimedAt; + return this; + } + + /** + *

Capture metadata: city the footage was recorded in. null unless capture metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

Capture metadata: city the footage was recorded in. null unless capture metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + /** + *

Capture metadata: city the footage was recorded in. null unless capture metadata was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public _FinalStage city(Optional city) { + this.city = city; + return this; + } + + /** + *

The vendor filename stem Country_City_Site_Station_Operator, derived from the capture metadata. null until every component is present.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage captureFilename(Nullable captureFilename) { + if (captureFilename.isNull()) { + this.captureFilename = null; + } else if (captureFilename.isEmpty()) { + this.captureFilename = Optional.empty(); + } else { + this.captureFilename = Optional.of(captureFilename.get()); + } + return this; + } + + /** + *

The vendor filename stem Country_City_Site_Station_Operator, derived from the capture metadata. null until every component is present.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage captureFilename(String captureFilename) { + this.captureFilename = Optional.ofNullable(captureFilename); + return this; + } + + /** + *

The vendor filename stem Country_City_Site_Station_Operator, derived from the capture metadata. null until every component is present.

+ */ + @java.lang.Override + @JsonSetter(value = "capture_filename", nulls = Nulls.SKIP) + public _FinalStage captureFilename(Optional captureFilename) { + this.captureFilename = captureFilename; + return this; + } + + @java.lang.Override + public _FinalStage captureClips(Nullable> captureClips) { + if (captureClips.isNull()) { + this.captureClips = null; + } else if (captureClips.isEmpty()) { + this.captureClips = Optional.empty(); + } else { + this.captureClips = Optional.of(captureClips.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage captureClips(List captureClips) { + this.captureClips = Optional.ofNullable(captureClips); + return this; + } + + @java.lang.Override + @JsonSetter(value = "capture_clips", nulls = Nulls.SKIP) + public _FinalStage captureClips(Optional> captureClips) { + this.captureClips = captureClips; + return this; + } + + @java.lang.Override + public BountySubmission build() { + return new BountySubmission( + bountyId, + captureClips, + captureFilename, + capturedClipCount, + capturedDurationSeconds, + city, + claimedAt, + content, + country, + createdAt, + deliverableType, + deliverableUrls, + denialReason, + device, + files, + fov, + id, + latestProofLivestreamFeed, + operator, + resolvedAt, + site, + station, + status, + submittedAt, + updatedAt, + worker, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/BountySubmissionDeliverableType.java b/src/main/java/com/whop/api/types/BountySubmissionDeliverableType.java new file mode 100644 index 00000000..2e54ef9e --- /dev/null +++ b/src/main/java/com/whop/api/types/BountySubmissionDeliverableType.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BountySubmissionDeliverableType { + public static final BountySubmissionDeliverableType CONTENT_URL = + new BountySubmissionDeliverableType(Value.CONTENT_URL, "content_url"); + + public static final BountySubmissionDeliverableType MEDIA = + new BountySubmissionDeliverableType(Value.MEDIA, "media"); + + public static final BountySubmissionDeliverableType DATA_CAPTURE = + new BountySubmissionDeliverableType(Value.DATA_CAPTURE, "data_capture"); + + private final Value value; + + private final String string; + + BountySubmissionDeliverableType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BountySubmissionDeliverableType + && this.string.equals(((BountySubmissionDeliverableType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CONTENT_URL: + return visitor.visitContentUrl(); + case MEDIA: + return visitor.visitMedia(); + case DATA_CAPTURE: + return visitor.visitDataCapture(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BountySubmissionDeliverableType valueOf(String value) { + switch (value) { + case "content_url": + return CONTENT_URL; + case "media": + return MEDIA; + case "data_capture": + return DATA_CAPTURE; + default: + return new BountySubmissionDeliverableType(Value.UNKNOWN, value); + } + } + + public enum Value { + CONTENT_URL, + + MEDIA, + + DATA_CAPTURE, + + UNKNOWN + } + + public interface Visitor { + T visitContentUrl(); + + T visitMedia(); + + T visitDataCapture(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/BountySubmissionFile.java b/src/main/java/com/whop/api/types/BountySubmissionFile.java new file mode 100644 index 00000000..2f7fcd88 --- /dev/null +++ b/src/main/java/com/whop/api/types/BountySubmissionFile.java @@ -0,0 +1,416 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BountySubmissionFile.Builder.class) +public final class BountySubmissionFile { + private final Optional attachmentType; + + private final Optional contentType; + + private final Optional filename; + + private final String id; + + private final Optional url; + + private final Map additionalProperties; + + private BountySubmissionFile( + Optional attachmentType, + Optional contentType, + Optional filename, + String id, + Optional url, + Map additionalProperties) { + this.attachmentType = attachmentType; + this.contentType = contentType; + this.filename = filename; + this.id = id; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Broad kind of file. + */ + @JsonIgnore + public Optional getAttachmentType() { + if (attachmentType == null) { + return Optional.empty(); + } + return attachmentType; + } + + /** + * @return MIME type of the file. + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return Name the file was uploaded with. + */ + @JsonIgnore + public Optional getFilename() { + if (filename == null) { + return Optional.empty(); + } + return filename; + } + + /** + * @return File ID, prefixed file_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Temporary download URL for the file. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("attachment_type") + private Optional _getAttachmentType() { + return attachmentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filename") + private Optional _getFilename() { + return filename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BountySubmissionFile && equalTo((BountySubmissionFile) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BountySubmissionFile other) { + return attachmentType.equals(other.attachmentType) + && contentType.equals(other.contentType) + && filename.equals(other.filename) + && id.equals(other.id) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.attachmentType, this.contentType, this.filename, this.id, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

File ID, prefixed file_.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(BountySubmissionFile other); + } + + public interface _FinalStage { + BountySubmissionFile build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Broad kind of file.

+ */ + _FinalStage attachmentType(Optional attachmentType); + + _FinalStage attachmentType(BountySubmissionFileAttachmentType attachmentType); + + _FinalStage attachmentType(Nullable attachmentType); + + /** + *

MIME type of the file.

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

Name the file was uploaded with.

+ */ + _FinalStage filename(Optional filename); + + _FinalStage filename(String filename); + + _FinalStage filename(Nullable filename); + + /** + *

Temporary download URL for the file.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional url = Optional.empty(); + + private Optional filename = Optional.empty(); + + private Optional contentType = Optional.empty(); + + private Optional attachmentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BountySubmissionFile other) { + attachmentType(other.getAttachmentType()); + contentType(other.getContentType()); + filename(other.getFilename()); + id(other.getId()); + url(other.getUrl()); + return this; + } + + /** + *

File ID, prefixed file_.

+ *

File ID, prefixed file_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Temporary download URL for the file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

Temporary download URL for the file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

Temporary download URL for the file.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

Name the file was uploaded with.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(Nullable filename) { + if (filename.isNull()) { + this.filename = null; + } else if (filename.isEmpty()) { + this.filename = Optional.empty(); + } else { + this.filename = Optional.of(filename.get()); + } + return this; + } + + /** + *

Name the file was uploaded with.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(String filename) { + this.filename = Optional.ofNullable(filename); + return this; + } + + /** + *

Name the file was uploaded with.

+ */ + @java.lang.Override + @JsonSetter(value = "filename", nulls = Nulls.SKIP) + public _FinalStage filename(Optional filename) { + this.filename = filename; + return this; + } + + /** + *

MIME type of the file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

MIME type of the file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

MIME type of the file.

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + /** + *

Broad kind of file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage attachmentType(Nullable attachmentType) { + if (attachmentType.isNull()) { + this.attachmentType = null; + } else if (attachmentType.isEmpty()) { + this.attachmentType = Optional.empty(); + } else { + this.attachmentType = Optional.of(attachmentType.get()); + } + return this; + } + + /** + *

Broad kind of file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage attachmentType(BountySubmissionFileAttachmentType attachmentType) { + this.attachmentType = Optional.ofNullable(attachmentType); + return this; + } + + /** + *

Broad kind of file.

+ */ + @java.lang.Override + @JsonSetter(value = "attachment_type", nulls = Nulls.SKIP) + public _FinalStage attachmentType(Optional attachmentType) { + this.attachmentType = attachmentType; + return this; + } + + @java.lang.Override + public BountySubmissionFile build() { + return new BountySubmissionFile(attachmentType, contentType, filename, id, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/BountySubmissionFileAttachmentType.java b/src/main/java/com/whop/api/types/BountySubmissionFileAttachmentType.java new file mode 100644 index 00000000..76d912b6 --- /dev/null +++ b/src/main/java/com/whop/api/types/BountySubmissionFileAttachmentType.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BountySubmissionFileAttachmentType { + public static final BountySubmissionFileAttachmentType OTHER = + new BountySubmissionFileAttachmentType(Value.OTHER, "other"); + + public static final BountySubmissionFileAttachmentType AUDIO = + new BountySubmissionFileAttachmentType(Value.AUDIO, "audio"); + + public static final BountySubmissionFileAttachmentType IMAGE = + new BountySubmissionFileAttachmentType(Value.IMAGE, "image"); + + public static final BountySubmissionFileAttachmentType VIDEO = + new BountySubmissionFileAttachmentType(Value.VIDEO, "video"); + + private final Value value; + + private final String string; + + BountySubmissionFileAttachmentType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BountySubmissionFileAttachmentType + && this.string.equals(((BountySubmissionFileAttachmentType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case OTHER: + return visitor.visitOther(); + case AUDIO: + return visitor.visitAudio(); + case IMAGE: + return visitor.visitImage(); + case VIDEO: + return visitor.visitVideo(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BountySubmissionFileAttachmentType valueOf(String value) { + switch (value) { + case "other": + return OTHER; + case "audio": + return AUDIO; + case "image": + return IMAGE; + case "video": + return VIDEO; + default: + return new BountySubmissionFileAttachmentType(Value.UNKNOWN, value); + } + } + + public enum Value { + IMAGE, + + VIDEO, + + AUDIO, + + OTHER, + + UNKNOWN + } + + public interface Visitor { + T visitImage(); + + T visitVideo(); + + T visitAudio(); + + T visitOther(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/BountySubmissionLivestreamFeed.java b/src/main/java/com/whop/api/types/BountySubmissionLivestreamFeed.java new file mode 100644 index 00000000..f0a5aa8f --- /dev/null +++ b/src/main/java/com/whop/api/types/BountySubmissionLivestreamFeed.java @@ -0,0 +1,529 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BountySubmissionLivestreamFeed.Builder.class) +public final class BountySubmissionLivestreamFeed { + private final Optional endedAt; + + private final String id; + + private final Optional recordingStatus; + + private final Optional recordingUrl; + + private final Optional startedAt; + + private final Optional thumbnailUrl; + + private final String title; + + private final Map additionalProperties; + + private BountySubmissionLivestreamFeed( + Optional endedAt, + String id, + Optional recordingStatus, + Optional recordingUrl, + Optional startedAt, + Optional thumbnailUrl, + String title, + Map additionalProperties) { + this.endedAt = endedAt; + this.id = id; + this.recordingStatus = recordingStatus; + this.recordingUrl = recordingUrl; + this.startedAt = startedAt; + this.thumbnailUrl = thumbnailUrl; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the proof livestream ended, as an ISO 8601 timestamp. null while it is still live — a feed with a started_at and no ended_at is streaming right now. + */ + @JsonIgnore + public Optional getEndedAt() { + if (endedAt == null) { + return Optional.empty(); + } + return endedAt; + } + + /** + * @return Livestream feed ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Recording lifecycle state. + */ + @JsonIgnore + public Optional getRecordingStatus() { + if (recordingStatus == null) { + return Optional.empty(); + } + return recordingStatus; + } + + /** + * @return Playback URL for a completed proof recording, when available. + */ + @JsonIgnore + public Optional getRecordingUrl() { + if (recordingUrl == null) { + return Optional.empty(); + } + return recordingUrl; + } + + /** + * @return When the proof livestream went live, as an ISO 8601 timestamp. null before it starts. + */ + @JsonIgnore + public Optional getStartedAt() { + if (startedAt == null) { + return Optional.empty(); + } + return startedAt; + } + + /** + * @return Current proof thumbnail URL, when available. + */ + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + /** + * @return Display title for the proof livestream. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ended_at") + private Optional _getEndedAt() { + return endedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("recording_status") + private Optional _getRecordingStatus() { + return recordingStatus; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("recording_url") + private Optional _getRecordingUrl() { + return recordingUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("started_at") + private Optional _getStartedAt() { + return startedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BountySubmissionLivestreamFeed && equalTo((BountySubmissionLivestreamFeed) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BountySubmissionLivestreamFeed other) { + return endedAt.equals(other.endedAt) + && id.equals(other.id) + && recordingStatus.equals(other.recordingStatus) + && recordingUrl.equals(other.recordingUrl) + && startedAt.equals(other.startedAt) + && thumbnailUrl.equals(other.thumbnailUrl) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.endedAt, + this.id, + this.recordingStatus, + this.recordingUrl, + this.startedAt, + this.thumbnailUrl, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Livestream feed ID.

+ */ + TitleStage id(@NotNull String id); + + Builder from(BountySubmissionLivestreamFeed other); + } + + public interface TitleStage { + /** + *

Display title for the proof livestream.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + BountySubmissionLivestreamFeed build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When the proof livestream ended, as an ISO 8601 timestamp. null while it is still live — a feed with a started_at and no ended_at is streaming right now.

+ */ + _FinalStage endedAt(Optional endedAt); + + _FinalStage endedAt(String endedAt); + + _FinalStage endedAt(Nullable endedAt); + + /** + *

Recording lifecycle state.

+ */ + _FinalStage recordingStatus(Optional recordingStatus); + + _FinalStage recordingStatus(BountySubmissionLivestreamFeedRecordingStatus recordingStatus); + + _FinalStage recordingStatus(Nullable recordingStatus); + + /** + *

Playback URL for a completed proof recording, when available.

+ */ + _FinalStage recordingUrl(Optional recordingUrl); + + _FinalStage recordingUrl(String recordingUrl); + + _FinalStage recordingUrl(Nullable recordingUrl); + + /** + *

When the proof livestream went live, as an ISO 8601 timestamp. null before it starts.

+ */ + _FinalStage startedAt(Optional startedAt); + + _FinalStage startedAt(String startedAt); + + _FinalStage startedAt(Nullable startedAt); + + /** + *

Current proof thumbnail URL, when available.

+ */ + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + private Optional thumbnailUrl = Optional.empty(); + + private Optional startedAt = Optional.empty(); + + private Optional recordingUrl = Optional.empty(); + + private Optional recordingStatus = Optional.empty(); + + private Optional endedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BountySubmissionLivestreamFeed other) { + endedAt(other.getEndedAt()); + id(other.getId()); + recordingStatus(other.getRecordingStatus()); + recordingUrl(other.getRecordingUrl()); + startedAt(other.getStartedAt()); + thumbnailUrl(other.getThumbnailUrl()); + title(other.getTitle()); + return this; + } + + /** + *

Livestream feed ID.

+ *

Livestream feed ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Display title for the proof livestream.

+ *

Display title for the proof livestream.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Current proof thumbnail URL, when available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + /** + *

Current proof thumbnail URL, when available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + /** + *

Current proof thumbnail URL, when available.

+ */ + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + /** + *

When the proof livestream went live, as an ISO 8601 timestamp. null before it starts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startedAt(Nullable startedAt) { + if (startedAt.isNull()) { + this.startedAt = null; + } else if (startedAt.isEmpty()) { + this.startedAt = Optional.empty(); + } else { + this.startedAt = Optional.of(startedAt.get()); + } + return this; + } + + /** + *

When the proof livestream went live, as an ISO 8601 timestamp. null before it starts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startedAt(String startedAt) { + this.startedAt = Optional.ofNullable(startedAt); + return this; + } + + /** + *

When the proof livestream went live, as an ISO 8601 timestamp. null before it starts.

+ */ + @java.lang.Override + @JsonSetter(value = "started_at", nulls = Nulls.SKIP) + public _FinalStage startedAt(Optional startedAt) { + this.startedAt = startedAt; + return this; + } + + /** + *

Playback URL for a completed proof recording, when available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage recordingUrl(Nullable recordingUrl) { + if (recordingUrl.isNull()) { + this.recordingUrl = null; + } else if (recordingUrl.isEmpty()) { + this.recordingUrl = Optional.empty(); + } else { + this.recordingUrl = Optional.of(recordingUrl.get()); + } + return this; + } + + /** + *

Playback URL for a completed proof recording, when available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage recordingUrl(String recordingUrl) { + this.recordingUrl = Optional.ofNullable(recordingUrl); + return this; + } + + /** + *

Playback URL for a completed proof recording, when available.

+ */ + @java.lang.Override + @JsonSetter(value = "recording_url", nulls = Nulls.SKIP) + public _FinalStage recordingUrl(Optional recordingUrl) { + this.recordingUrl = recordingUrl; + return this; + } + + /** + *

Recording lifecycle state.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage recordingStatus(Nullable recordingStatus) { + if (recordingStatus.isNull()) { + this.recordingStatus = null; + } else if (recordingStatus.isEmpty()) { + this.recordingStatus = Optional.empty(); + } else { + this.recordingStatus = Optional.of(recordingStatus.get()); + } + return this; + } + + /** + *

Recording lifecycle state.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage recordingStatus(BountySubmissionLivestreamFeedRecordingStatus recordingStatus) { + this.recordingStatus = Optional.ofNullable(recordingStatus); + return this; + } + + /** + *

Recording lifecycle state.

+ */ + @java.lang.Override + @JsonSetter(value = "recording_status", nulls = Nulls.SKIP) + public _FinalStage recordingStatus(Optional recordingStatus) { + this.recordingStatus = recordingStatus; + return this; + } + + /** + *

When the proof livestream ended, as an ISO 8601 timestamp. null while it is still live — a feed with a started_at and no ended_at is streaming right now.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endedAt(Nullable endedAt) { + if (endedAt.isNull()) { + this.endedAt = null; + } else if (endedAt.isEmpty()) { + this.endedAt = Optional.empty(); + } else { + this.endedAt = Optional.of(endedAt.get()); + } + return this; + } + + /** + *

When the proof livestream ended, as an ISO 8601 timestamp. null while it is still live — a feed with a started_at and no ended_at is streaming right now.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endedAt(String endedAt) { + this.endedAt = Optional.ofNullable(endedAt); + return this; + } + + /** + *

When the proof livestream ended, as an ISO 8601 timestamp. null while it is still live — a feed with a started_at and no ended_at is streaming right now.

+ */ + @java.lang.Override + @JsonSetter(value = "ended_at", nulls = Nulls.SKIP) + public _FinalStage endedAt(Optional endedAt) { + this.endedAt = endedAt; + return this; + } + + @java.lang.Override + public BountySubmissionLivestreamFeed build() { + return new BountySubmissionLivestreamFeed( + endedAt, id, recordingStatus, recordingUrl, startedAt, thumbnailUrl, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/BountySubmissionLivestreamFeedRecordingStatus.java b/src/main/java/com/whop/api/types/BountySubmissionLivestreamFeedRecordingStatus.java new file mode 100644 index 00000000..5253d957 --- /dev/null +++ b/src/main/java/com/whop/api/types/BountySubmissionLivestreamFeedRecordingStatus.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BountySubmissionLivestreamFeedRecordingStatus { + public static final BountySubmissionLivestreamFeedRecordingStatus FAILED = + new BountySubmissionLivestreamFeedRecordingStatus(Value.FAILED, "failed"); + + public static final BountySubmissionLivestreamFeedRecordingStatus PROCESSING = + new BountySubmissionLivestreamFeedRecordingStatus(Value.PROCESSING, "processing"); + + public static final BountySubmissionLivestreamFeedRecordingStatus RECORDING = + new BountySubmissionLivestreamFeedRecordingStatus(Value.RECORDING, "recording"); + + public static final BountySubmissionLivestreamFeedRecordingStatus COMPLETED = + new BountySubmissionLivestreamFeedRecordingStatus(Value.COMPLETED, "completed"); + + private final Value value; + + private final String string; + + BountySubmissionLivestreamFeedRecordingStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BountySubmissionLivestreamFeedRecordingStatus + && this.string.equals(((BountySubmissionLivestreamFeedRecordingStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case PROCESSING: + return visitor.visitProcessing(); + case RECORDING: + return visitor.visitRecording(); + case COMPLETED: + return visitor.visitCompleted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BountySubmissionLivestreamFeedRecordingStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "processing": + return PROCESSING; + case "recording": + return RECORDING; + case "completed": + return COMPLETED; + default: + return new BountySubmissionLivestreamFeedRecordingStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + RECORDING, + + PROCESSING, + + COMPLETED, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitRecording(); + + T visitProcessing(); + + T visitCompleted(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/BountySubmissionStatus.java b/src/main/java/com/whop/api/types/BountySubmissionStatus.java new file mode 100644 index 00000000..db860218 --- /dev/null +++ b/src/main/java/com/whop/api/types/BountySubmissionStatus.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BountySubmissionStatus { + public static final BountySubmissionStatus APPROVED = new BountySubmissionStatus(Value.APPROVED, "approved"); + + public static final BountySubmissionStatus IN_PROGRESS = + new BountySubmissionStatus(Value.IN_PROGRESS, "in_progress"); + + public static final BountySubmissionStatus DENIED = new BountySubmissionStatus(Value.DENIED, "denied"); + + public static final BountySubmissionStatus SUBMITTED = new BountySubmissionStatus(Value.SUBMITTED, "submitted"); + + private final Value value; + + private final String string; + + BountySubmissionStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BountySubmissionStatus + && this.string.equals(((BountySubmissionStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case IN_PROGRESS: + return visitor.visitInProgress(); + case DENIED: + return visitor.visitDenied(); + case SUBMITTED: + return visitor.visitSubmitted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BountySubmissionStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "in_progress": + return IN_PROGRESS; + case "denied": + return DENIED; + case "submitted": + return SUBMITTED; + default: + return new BountySubmissionStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + IN_PROGRESS, + + SUBMITTED, + + APPROVED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitInProgress(); + + T visitSubmitted(); + + T visitApproved(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/BountyTypes.java b/src/main/java/com/whop/api/types/BountyTypes.java new file mode 100644 index 00000000..4c071f96 --- /dev/null +++ b/src/main/java/com/whop/api/types/BountyTypes.java @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BountyTypes { + public static final BountyTypes WORKFORCE = new BountyTypes(Value.WORKFORCE, "workforce"); + + public static final BountyTypes USER_FUNDED = new BountyTypes(Value.USER_FUNDED, "user_funded"); + + public static final BountyTypes CLASSIC = new BountyTypes(Value.CLASSIC, "classic"); + + private final Value value; + + private final String string; + + BountyTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof BountyTypes && this.string.equals(((BountyTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WORKFORCE: + return visitor.visitWorkforce(); + case USER_FUNDED: + return visitor.visitUserFunded(); + case CLASSIC: + return visitor.visitClassic(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BountyTypes valueOf(String value) { + switch (value) { + case "workforce": + return WORKFORCE; + case "user_funded": + return USER_FUNDED; + case "classic": + return CLASSIC; + default: + return new BountyTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + CLASSIC, + + USER_FUNDED, + + WORKFORCE, + + UNKNOWN + } + + public interface Visitor { + T visitClassic(); + + T visitUserFunded(); + + T visitWorkforce(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/BusinessGoalTypes.java b/src/main/java/com/whop/api/types/BusinessGoalTypes.java new file mode 100644 index 00000000..6c459a72 --- /dev/null +++ b/src/main/java/com/whop/api/types/BusinessGoalTypes.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BusinessGoalTypes { + public static final BusinessGoalTypes LOCAL_ACTIVATION = + new BusinessGoalTypes(Value.LOCAL_ACTIVATION, "local_activation"); + + public static final BusinessGoalTypes OTHER = new BusinessGoalTypes(Value.OTHER, "other"); + + public static final BusinessGoalTypes UGC_CONTENT = new BusinessGoalTypes(Value.UGC_CONTENT, "ugc_content"); + + public static final BusinessGoalTypes CLIPPING = new BusinessGoalTypes(Value.CLIPPING, "clipping"); + + public static final BusinessGoalTypes POST_ENGAGEMENT = + new BusinessGoalTypes(Value.POST_ENGAGEMENT, "post_engagement"); + + public static final BusinessGoalTypes OWNED_ACCOUNT_GROWTH = + new BusinessGoalTypes(Value.OWNED_ACCOUNT_GROWTH, "owned_account_growth"); + + public static final BusinessGoalTypes DATA_CAPTURE = new BusinessGoalTypes(Value.DATA_CAPTURE, "data_capture"); + + private final Value value; + + private final String string; + + BusinessGoalTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BusinessGoalTypes && this.string.equals(((BusinessGoalTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LOCAL_ACTIVATION: + return visitor.visitLocalActivation(); + case OTHER: + return visitor.visitOther(); + case UGC_CONTENT: + return visitor.visitUgcContent(); + case CLIPPING: + return visitor.visitClipping(); + case POST_ENGAGEMENT: + return visitor.visitPostEngagement(); + case OWNED_ACCOUNT_GROWTH: + return visitor.visitOwnedAccountGrowth(); + case DATA_CAPTURE: + return visitor.visitDataCapture(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BusinessGoalTypes valueOf(String value) { + switch (value) { + case "local_activation": + return LOCAL_ACTIVATION; + case "other": + return OTHER; + case "ugc_content": + return UGC_CONTENT; + case "clipping": + return CLIPPING; + case "post_engagement": + return POST_ENGAGEMENT; + case "owned_account_growth": + return OWNED_ACCOUNT_GROWTH; + case "data_capture": + return DATA_CAPTURE; + default: + return new BusinessGoalTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + CLIPPING, + + POST_ENGAGEMENT, + + OWNED_ACCOUNT_GROWTH, + + UGC_CONTENT, + + LOCAL_ACTIVATION, + + DATA_CAPTURE, + + OTHER, + + UNKNOWN + } + + public interface Visitor { + T visitClipping(); + + T visitPostEngagement(); + + T visitOwnedAccountGrowth(); + + T visitUgcContent(); + + T visitLocalActivation(); + + T visitDataCapture(); + + T visitOther(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CancelOptions.java b/src/main/java/com/whop/api/types/CancelOptions.java new file mode 100644 index 00000000..e4723a04 --- /dev/null +++ b/src/main/java/com/whop/api/types/CancelOptions.java @@ -0,0 +1,133 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CancelOptions { + public static final CancelOptions SWITCHING = new CancelOptions(Value.SWITCHING, "switching"); + + public static final CancelOptions TESTING = new CancelOptions(Value.TESTING, "testing"); + + public static final CancelOptions OTHER = new CancelOptions(Value.OTHER, "other"); + + public static final CancelOptions BAD_EXPERIENCE = new CancelOptions(Value.BAD_EXPERIENCE, "bad_experience"); + + public static final CancelOptions TOO_EXPENSIVE = new CancelOptions(Value.TOO_EXPENSIVE, "too_expensive"); + + public static final CancelOptions TECHNICAL_ISSUES = new CancelOptions(Value.TECHNICAL_ISSUES, "technical_issues"); + + public static final CancelOptions MISSING_FEATURES = new CancelOptions(Value.MISSING_FEATURES, "missing_features"); + + private final Value value; + + private final String string; + + CancelOptions(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CancelOptions && this.string.equals(((CancelOptions) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SWITCHING: + return visitor.visitSwitching(); + case TESTING: + return visitor.visitTesting(); + case OTHER: + return visitor.visitOther(); + case BAD_EXPERIENCE: + return visitor.visitBadExperience(); + case TOO_EXPENSIVE: + return visitor.visitTooExpensive(); + case TECHNICAL_ISSUES: + return visitor.visitTechnicalIssues(); + case MISSING_FEATURES: + return visitor.visitMissingFeatures(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CancelOptions valueOf(String value) { + switch (value) { + case "switching": + return SWITCHING; + case "testing": + return TESTING; + case "other": + return OTHER; + case "bad_experience": + return BAD_EXPERIENCE; + case "too_expensive": + return TOO_EXPENSIVE; + case "technical_issues": + return TECHNICAL_ISSUES; + case "missing_features": + return MISSING_FEATURES; + default: + return new CancelOptions(Value.UNKNOWN, value); + } + } + + public enum Value { + TOO_EXPENSIVE, + + SWITCHING, + + MISSING_FEATURES, + + TECHNICAL_ISSUES, + + BAD_EXPERIENCE, + + OTHER, + + TESTING, + + UNKNOWN + } + + public interface Visitor { + T visitTooExpensive(); + + T visitSwitching(); + + T visitMissingFeatures(); + + T visitTechnicalIssues(); + + T visitBadExperience(); + + T visitOther(); + + T visitTesting(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CancelationStatus.java b/src/main/java/com/whop/api/types/CancelationStatus.java new file mode 100644 index 00000000..9445414f --- /dev/null +++ b/src/main/java/com/whop/api/types/CancelationStatus.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CancelationStatus { + public static final CancelationStatus LEFT = new CancelationStatus(Value.LEFT, "left"); + + public static final CancelationStatus WON_BACK = new CancelationStatus(Value.WON_BACK, "won_back"); + + public static final CancelationStatus CANCELING = new CancelationStatus(Value.CANCELING, "canceling"); + + private final Value value; + + private final String string; + + CancelationStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CancelationStatus && this.string.equals(((CancelationStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LEFT: + return visitor.visitLeft(); + case WON_BACK: + return visitor.visitWonBack(); + case CANCELING: + return visitor.visitCanceling(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CancelationStatus valueOf(String value) { + switch (value) { + case "left": + return LEFT; + case "won_back": + return WON_BACK; + case "canceling": + return CANCELING; + default: + return new CancelationStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + WON_BACK, + + LEFT, + + CANCELING, + + UNKNOWN + } + + public interface Visitor { + T visitWonBack(); + + T visitLeft(); + + T visitCanceling(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CaptureSpec.java b/src/main/java/com/whop/api/types/CaptureSpec.java new file mode 100644 index 00000000..75e9e44d --- /dev/null +++ b/src/main/java/com/whop/api/types/CaptureSpec.java @@ -0,0 +1,412 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CaptureSpec.Builder.class) +public final class CaptureSpec { + private final String filenamePattern; + + private final CaptureSpecImu imu; + + private final int manifestSchemaVersion; + + private final int minClipDurationSeconds; + + private final int minTotalVerifiedDurationSeconds; + + private final List requiredMetadataFields; + + private final boolean singleContinuousTake; + + private final CaptureSpecVideo video; + + private final Map additionalProperties; + + private CaptureSpec( + String filenamePattern, + CaptureSpecImu imu, + int manifestSchemaVersion, + int minClipDurationSeconds, + int minTotalVerifiedDurationSeconds, + List requiredMetadataFields, + boolean singleContinuousTake, + CaptureSpecVideo video, + Map additionalProperties) { + this.filenamePattern = filenamePattern; + this.imu = imu; + this.manifestSchemaVersion = manifestSchemaVersion; + this.minClipDurationSeconds = minClipDurationSeconds; + this.minTotalVerifiedDurationSeconds = minTotalVerifiedDurationSeconds; + this.requiredMetadataFields = requiredMetadataFields; + this.singleContinuousTake = singleContinuousTake; + this.video = video; + this.additionalProperties = additionalProperties; + } + + /** + * @return The naming convention for uploaded files, built from the required metadata fields. + */ + @JsonProperty("filename_pattern") + public String getFilenamePattern() { + return filenamePattern; + } + + /** + * @return Inertial measurement unit (IMU) recording requirements. + */ + @JsonProperty("imu") + public CaptureSpecImu getImu() { + return imu; + } + + /** + * @return Schema version the client must stamp on the capture manifest it uploads. + */ + @JsonProperty("manifest_schema_version") + public int getManifestSchemaVersion() { + return manifestSchemaVersion; + } + + /** + * @return Minimum length of a single clip, in seconds. + */ + @JsonProperty("min_clip_duration_seconds") + public int getMinClipDurationSeconds() { + return minClipDurationSeconds; + } + + /** + * @return Total verified footage a submission must accumulate across all its clips before it can be submitted, in seconds. Always a whole number of hours. + */ + @JsonProperty("min_total_verified_duration_seconds") + public int getMinTotalVerifiedDurationSeconds() { + return minTotalVerifiedDurationSeconds; + } + + @JsonProperty("required_metadata_fields") + public List getRequiredMetadataFields() { + return requiredMetadataFields; + } + + /** + * @return Whether each clip must be one uninterrupted recording rather than stitched segments. + */ + @JsonProperty("single_continuous_take") + public boolean getSingleContinuousTake() { + return singleContinuousTake; + } + + /** + * @return Video recording requirements. + */ + @JsonProperty("video") + public CaptureSpecVideo getVideo() { + return video; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CaptureSpec && equalTo((CaptureSpec) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CaptureSpec other) { + return filenamePattern.equals(other.filenamePattern) + && imu.equals(other.imu) + && manifestSchemaVersion == other.manifestSchemaVersion + && minClipDurationSeconds == other.minClipDurationSeconds + && minTotalVerifiedDurationSeconds == other.minTotalVerifiedDurationSeconds + && requiredMetadataFields.equals(other.requiredMetadataFields) + && singleContinuousTake == other.singleContinuousTake + && video.equals(other.video); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.filenamePattern, + this.imu, + this.manifestSchemaVersion, + this.minClipDurationSeconds, + this.minTotalVerifiedDurationSeconds, + this.requiredMetadataFields, + this.singleContinuousTake, + this.video); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FilenamePatternStage builder() { + return new Builder(); + } + + public interface FilenamePatternStage { + /** + *

The naming convention for uploaded files, built from the required metadata fields.

+ */ + ImuStage filenamePattern(@NotNull String filenamePattern); + + Builder from(CaptureSpec other); + } + + public interface ImuStage { + /** + *

Inertial measurement unit (IMU) recording requirements.

+ */ + ManifestSchemaVersionStage imu(@NotNull CaptureSpecImu imu); + } + + public interface ManifestSchemaVersionStage { + /** + *

Schema version the client must stamp on the capture manifest it uploads.

+ */ + MinClipDurationSecondsStage manifestSchemaVersion(int manifestSchemaVersion); + } + + public interface MinClipDurationSecondsStage { + /** + *

Minimum length of a single clip, in seconds.

+ */ + MinTotalVerifiedDurationSecondsStage minClipDurationSeconds(int minClipDurationSeconds); + } + + public interface MinTotalVerifiedDurationSecondsStage { + /** + *

Total verified footage a submission must accumulate across all its clips before it can be submitted, in seconds. Always a whole number of hours.

+ */ + SingleContinuousTakeStage minTotalVerifiedDurationSeconds(int minTotalVerifiedDurationSeconds); + } + + public interface SingleContinuousTakeStage { + /** + *

Whether each clip must be one uninterrupted recording rather than stitched segments.

+ */ + VideoStage singleContinuousTake(boolean singleContinuousTake); + } + + public interface VideoStage { + /** + *

Video recording requirements.

+ */ + _FinalStage video(@NotNull CaptureSpecVideo video); + } + + public interface _FinalStage { + CaptureSpec build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage requiredMetadataFields(List requiredMetadataFields); + + _FinalStage addRequiredMetadataFields(String requiredMetadataFields); + + _FinalStage addAllRequiredMetadataFields(List requiredMetadataFields); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements FilenamePatternStage, + ImuStage, + ManifestSchemaVersionStage, + MinClipDurationSecondsStage, + MinTotalVerifiedDurationSecondsStage, + SingleContinuousTakeStage, + VideoStage, + _FinalStage { + private String filenamePattern; + + private CaptureSpecImu imu; + + private int manifestSchemaVersion; + + private int minClipDurationSeconds; + + private int minTotalVerifiedDurationSeconds; + + private boolean singleContinuousTake; + + private CaptureSpecVideo video; + + private List requiredMetadataFields = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CaptureSpec other) { + filenamePattern(other.getFilenamePattern()); + imu(other.getImu()); + manifestSchemaVersion(other.getManifestSchemaVersion()); + minClipDurationSeconds(other.getMinClipDurationSeconds()); + minTotalVerifiedDurationSeconds(other.getMinTotalVerifiedDurationSeconds()); + requiredMetadataFields(other.getRequiredMetadataFields()); + singleContinuousTake(other.getSingleContinuousTake()); + video(other.getVideo()); + return this; + } + + /** + *

The naming convention for uploaded files, built from the required metadata fields.

+ *

The naming convention for uploaded files, built from the required metadata fields.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("filename_pattern") + public ImuStage filenamePattern(@NotNull String filenamePattern) { + this.filenamePattern = Objects.requireNonNull(filenamePattern, "filenamePattern must not be null"); + return this; + } + + /** + *

Inertial measurement unit (IMU) recording requirements.

+ *

Inertial measurement unit (IMU) recording requirements.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("imu") + public ManifestSchemaVersionStage imu(@NotNull CaptureSpecImu imu) { + this.imu = Objects.requireNonNull(imu, "imu must not be null"); + return this; + } + + /** + *

Schema version the client must stamp on the capture manifest it uploads.

+ *

Schema version the client must stamp on the capture manifest it uploads.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("manifest_schema_version") + public MinClipDurationSecondsStage manifestSchemaVersion(int manifestSchemaVersion) { + this.manifestSchemaVersion = manifestSchemaVersion; + return this; + } + + /** + *

Minimum length of a single clip, in seconds.

+ *

Minimum length of a single clip, in seconds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("min_clip_duration_seconds") + public MinTotalVerifiedDurationSecondsStage minClipDurationSeconds(int minClipDurationSeconds) { + this.minClipDurationSeconds = minClipDurationSeconds; + return this; + } + + /** + *

Total verified footage a submission must accumulate across all its clips before it can be submitted, in seconds. Always a whole number of hours.

+ *

Total verified footage a submission must accumulate across all its clips before it can be submitted, in seconds. Always a whole number of hours.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("min_total_verified_duration_seconds") + public SingleContinuousTakeStage minTotalVerifiedDurationSeconds(int minTotalVerifiedDurationSeconds) { + this.minTotalVerifiedDurationSeconds = minTotalVerifiedDurationSeconds; + return this; + } + + /** + *

Whether each clip must be one uninterrupted recording rather than stitched segments.

+ *

Whether each clip must be one uninterrupted recording rather than stitched segments.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("single_continuous_take") + public VideoStage singleContinuousTake(boolean singleContinuousTake) { + this.singleContinuousTake = singleContinuousTake; + return this; + } + + /** + *

Video recording requirements.

+ *

Video recording requirements.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("video") + public _FinalStage video(@NotNull CaptureSpecVideo video) { + this.video = Objects.requireNonNull(video, "video must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllRequiredMetadataFields(List requiredMetadataFields) { + if (requiredMetadataFields != null) { + this.requiredMetadataFields.addAll(requiredMetadataFields); + } + return this; + } + + @java.lang.Override + public _FinalStage addRequiredMetadataFields(String requiredMetadataFields) { + this.requiredMetadataFields.add(requiredMetadataFields); + return this; + } + + @java.lang.Override + @JsonSetter(value = "required_metadata_fields", nulls = Nulls.SKIP) + public _FinalStage requiredMetadataFields(List requiredMetadataFields) { + this.requiredMetadataFields.clear(); + if (requiredMetadataFields != null) { + this.requiredMetadataFields.addAll(requiredMetadataFields); + } + return this; + } + + @java.lang.Override + public CaptureSpec build() { + return new CaptureSpec( + filenamePattern, + imu, + manifestSchemaVersion, + minClipDurationSeconds, + minTotalVerifiedDurationSeconds, + requiredMetadataFields, + singleContinuousTake, + video, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CaptureSpecImu.java b/src/main/java/com/whop/api/types/CaptureSpecImu.java new file mode 100644 index 00000000..0649667f --- /dev/null +++ b/src/main/java/com/whop/api/types/CaptureSpecImu.java @@ -0,0 +1,326 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CaptureSpecImu.Builder.class) +public final class CaptureSpecImu { + private final String deviceMotionUnits; + + private final String magnetometerUnits; + + private final double minRateHz; + + private final int targetRateHz; + + private final double warmupMinRateHz; + + private final int warmupNs; + + private final Map additionalProperties; + + private CaptureSpecImu( + String deviceMotionUnits, + String magnetometerUnits, + double minRateHz, + int targetRateHz, + double warmupMinRateHz, + int warmupNs, + Map additionalProperties) { + this.deviceMotionUnits = deviceMotionUnits; + this.magnetometerUnits = magnetometerUnits; + this.minRateHz = minRateHz; + this.targetRateHz = targetRateHz; + this.warmupMinRateHz = warmupMinRateHz; + this.warmupNs = warmupNs; + this.additionalProperties = additionalProperties; + } + + /** + * @return Units for the device-motion channels, as a compact key=unit string. + */ + @JsonProperty("device_motion_units") + public String getDeviceMotionUnits() { + return deviceMotionUnits; + } + + /** + * @return Units for the magnetometer channel. + */ + @JsonProperty("magnetometer_units") + public String getMagnetometerUnits() { + return magnetometerUnits; + } + + /** + * @return Minimum sustained IMU sample rate in hertz for a clip to pass validation. + */ + @JsonProperty("min_rate_hz") + public double getMinRateHz() { + return minRateHz; + } + + /** + * @return Target IMU sample rate in hertz. + */ + @JsonProperty("target_rate_hz") + public int getTargetRateHz() { + return targetRateHz; + } + + /** + * @return Minimum IMU sample rate in hertz tolerated during the warmup window. + */ + @JsonProperty("warmup_min_rate_hz") + public double getWarmupMinRateHz() { + return warmupMinRateHz; + } + + /** + * @return Startup window, in nanoseconds, during which the relaxed warmup rate applies. + */ + @JsonProperty("warmup_ns") + public int getWarmupNs() { + return warmupNs; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CaptureSpecImu && equalTo((CaptureSpecImu) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CaptureSpecImu other) { + return deviceMotionUnits.equals(other.deviceMotionUnits) + && magnetometerUnits.equals(other.magnetometerUnits) + && minRateHz == other.minRateHz + && targetRateHz == other.targetRateHz + && warmupMinRateHz == other.warmupMinRateHz + && warmupNs == other.warmupNs; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.deviceMotionUnits, + this.magnetometerUnits, + this.minRateHz, + this.targetRateHz, + this.warmupMinRateHz, + this.warmupNs); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DeviceMotionUnitsStage builder() { + return new Builder(); + } + + public interface DeviceMotionUnitsStage { + /** + *

Units for the device-motion channels, as a compact key=unit string.

+ */ + MagnetometerUnitsStage deviceMotionUnits(@NotNull String deviceMotionUnits); + + Builder from(CaptureSpecImu other); + } + + public interface MagnetometerUnitsStage { + /** + *

Units for the magnetometer channel.

+ */ + MinRateHzStage magnetometerUnits(@NotNull String magnetometerUnits); + } + + public interface MinRateHzStage { + /** + *

Minimum sustained IMU sample rate in hertz for a clip to pass validation.

+ */ + TargetRateHzStage minRateHz(double minRateHz); + } + + public interface TargetRateHzStage { + /** + *

Target IMU sample rate in hertz.

+ */ + WarmupMinRateHzStage targetRateHz(int targetRateHz); + } + + public interface WarmupMinRateHzStage { + /** + *

Minimum IMU sample rate in hertz tolerated during the warmup window.

+ */ + WarmupNsStage warmupMinRateHz(double warmupMinRateHz); + } + + public interface WarmupNsStage { + /** + *

Startup window, in nanoseconds, during which the relaxed warmup rate applies.

+ */ + _FinalStage warmupNs(int warmupNs); + } + + public interface _FinalStage { + CaptureSpecImu build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements DeviceMotionUnitsStage, + MagnetometerUnitsStage, + MinRateHzStage, + TargetRateHzStage, + WarmupMinRateHzStage, + WarmupNsStage, + _FinalStage { + private String deviceMotionUnits; + + private String magnetometerUnits; + + private double minRateHz; + + private int targetRateHz; + + private double warmupMinRateHz; + + private int warmupNs; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CaptureSpecImu other) { + deviceMotionUnits(other.getDeviceMotionUnits()); + magnetometerUnits(other.getMagnetometerUnits()); + minRateHz(other.getMinRateHz()); + targetRateHz(other.getTargetRateHz()); + warmupMinRateHz(other.getWarmupMinRateHz()); + warmupNs(other.getWarmupNs()); + return this; + } + + /** + *

Units for the device-motion channels, as a compact key=unit string.

+ *

Units for the device-motion channels, as a compact key=unit string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("device_motion_units") + public MagnetometerUnitsStage deviceMotionUnits(@NotNull String deviceMotionUnits) { + this.deviceMotionUnits = Objects.requireNonNull(deviceMotionUnits, "deviceMotionUnits must not be null"); + return this; + } + + /** + *

Units for the magnetometer channel.

+ *

Units for the magnetometer channel.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("magnetometer_units") + public MinRateHzStage magnetometerUnits(@NotNull String magnetometerUnits) { + this.magnetometerUnits = Objects.requireNonNull(magnetometerUnits, "magnetometerUnits must not be null"); + return this; + } + + /** + *

Minimum sustained IMU sample rate in hertz for a clip to pass validation.

+ *

Minimum sustained IMU sample rate in hertz for a clip to pass validation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("min_rate_hz") + public TargetRateHzStage minRateHz(double minRateHz) { + this.minRateHz = minRateHz; + return this; + } + + /** + *

Target IMU sample rate in hertz.

+ *

Target IMU sample rate in hertz.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("target_rate_hz") + public WarmupMinRateHzStage targetRateHz(int targetRateHz) { + this.targetRateHz = targetRateHz; + return this; + } + + /** + *

Minimum IMU sample rate in hertz tolerated during the warmup window.

+ *

Minimum IMU sample rate in hertz tolerated during the warmup window.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("warmup_min_rate_hz") + public WarmupNsStage warmupMinRateHz(double warmupMinRateHz) { + this.warmupMinRateHz = warmupMinRateHz; + return this; + } + + /** + *

Startup window, in nanoseconds, during which the relaxed warmup rate applies.

+ *

Startup window, in nanoseconds, during which the relaxed warmup rate applies.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("warmup_ns") + public _FinalStage warmupNs(int warmupNs) { + this.warmupNs = warmupNs; + return this; + } + + @java.lang.Override + public CaptureSpecImu build() { + return new CaptureSpecImu( + deviceMotionUnits, + magnetometerUnits, + minRateHz, + targetRateHz, + warmupMinRateHz, + warmupNs, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CaptureSpecVideo.java b/src/main/java/com/whop/api/types/CaptureSpecVideo.java new file mode 100644 index 00000000..5b5ad51b --- /dev/null +++ b/src/main/java/com/whop/api/types/CaptureSpecVideo.java @@ -0,0 +1,679 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CaptureSpecVideo.Builder.class) +public final class CaptureSpecVideo { + private final int bitrateCeilingMbps; + + private final int bitrateFloorMbps; + + private final int bitrateTargetMbps; + + private final String cameraLens; + + private final List codecs; + + private final boolean embedCameraMetadata; + + private final int fps; + + private final int frameGapToleranceMs; + + private final int height; + + private final int minFovDegrees; + + private final String orientation; + + private final int preferredFovDegrees; + + private final CaptureSpecVideoStabilizationMode stabilizationMode; + + private final boolean stabilizationRequired; + + private final int width; + + private final Map additionalProperties; + + private CaptureSpecVideo( + int bitrateCeilingMbps, + int bitrateFloorMbps, + int bitrateTargetMbps, + String cameraLens, + List codecs, + boolean embedCameraMetadata, + int fps, + int frameGapToleranceMs, + int height, + int minFovDegrees, + String orientation, + int preferredFovDegrees, + CaptureSpecVideoStabilizationMode stabilizationMode, + boolean stabilizationRequired, + int width, + Map additionalProperties) { + this.bitrateCeilingMbps = bitrateCeilingMbps; + this.bitrateFloorMbps = bitrateFloorMbps; + this.bitrateTargetMbps = bitrateTargetMbps; + this.cameraLens = cameraLens; + this.codecs = codecs; + this.embedCameraMetadata = embedCameraMetadata; + this.fps = fps; + this.frameGapToleranceMs = frameGapToleranceMs; + this.height = height; + this.minFovDegrees = minFovDegrees; + this.orientation = orientation; + this.preferredFovDegrees = preferredFovDegrees; + this.stabilizationMode = stabilizationMode; + this.stabilizationRequired = stabilizationRequired; + this.width = width; + this.additionalProperties = additionalProperties; + } + + /** + * @return Maximum acceptable average bitrate, in megabits per second. + */ + @JsonProperty("bitrate_ceiling_mbps") + public int getBitrateCeilingMbps() { + return bitrateCeilingMbps; + } + + /** + * @return Minimum acceptable average bitrate, in megabits per second. + */ + @JsonProperty("bitrate_floor_mbps") + public int getBitrateFloorMbps() { + return bitrateFloorMbps; + } + + /** + * @return Recommended average bitrate to encode at, in megabits per second. + */ + @JsonProperty("bitrate_target_mbps") + public int getBitrateTargetMbps() { + return bitrateTargetMbps; + } + + /** + * @return Which physical lens to record with. + */ + @JsonProperty("camera_lens") + public String getCameraLens() { + return cameraLens; + } + + @JsonProperty("codecs") + public List getCodecs() { + return codecs; + } + + /** + * @return Whether the client must also write the camera make and model into the video container's metadata. When false, the capture manifest and export CSV are the metadata carrier. + */ + @JsonProperty("embed_camera_metadata") + public boolean getEmbedCameraMetadata() { + return embedCameraMetadata; + } + + /** + * @return Target capture frame rate. + */ + @JsonProperty("fps") + public int getFps() { + return fps; + } + + /** + * @return Longest stall between consecutive frames a clip may contain before the client rejects it, in milliseconds. Every frame is timestamped in the frame log, so a stall stays alignable downstream — this bounds how broken a capture may be, not how evenly it must be paced. + */ + @JsonProperty("frame_gap_tolerance_ms") + public int getFrameGapToleranceMs() { + return frameGapToleranceMs; + } + + /** + * @return Required frame height in pixels — recorded footage must match exactly. + */ + @JsonProperty("height") + public int getHeight() { + return height; + } + + /** + * @return Minimum acceptable horizontal field of view, in degrees. + */ + @JsonProperty("min_fov_degrees") + public int getMinFovDegrees() { + return minFovDegrees; + } + + /** + * @return Device orientation to record in. + */ + @JsonProperty("orientation") + public String getOrientation() { + return orientation; + } + + /** + * @return Preferred horizontal field of view, in degrees. + */ + @JsonProperty("preferred_fov_degrees") + public int getPreferredFovDegrees() { + return preferredFovDegrees; + } + + /** + * @return How the client must configure video stabilization: off disables EIS so raw motion is preserved for pose extraction, on requires it, any leaves the device default. + */ + @JsonProperty("stabilization_mode") + public CaptureSpecVideoStabilizationMode getStabilizationMode() { + return stabilizationMode; + } + + /** + * @return Whether hardware/software stabilization must be enabled. True exactly when stabilization_mode is on. + */ + @JsonProperty("stabilization_required") + public boolean getStabilizationRequired() { + return stabilizationRequired; + } + + /** + * @return Required frame width in pixels — recorded footage must match exactly. + */ + @JsonProperty("width") + public int getWidth() { + return width; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CaptureSpecVideo && equalTo((CaptureSpecVideo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CaptureSpecVideo other) { + return bitrateCeilingMbps == other.bitrateCeilingMbps + && bitrateFloorMbps == other.bitrateFloorMbps + && bitrateTargetMbps == other.bitrateTargetMbps + && cameraLens.equals(other.cameraLens) + && codecs.equals(other.codecs) + && embedCameraMetadata == other.embedCameraMetadata + && fps == other.fps + && frameGapToleranceMs == other.frameGapToleranceMs + && height == other.height + && minFovDegrees == other.minFovDegrees + && orientation.equals(other.orientation) + && preferredFovDegrees == other.preferredFovDegrees + && stabilizationMode.equals(other.stabilizationMode) + && stabilizationRequired == other.stabilizationRequired + && width == other.width; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bitrateCeilingMbps, + this.bitrateFloorMbps, + this.bitrateTargetMbps, + this.cameraLens, + this.codecs, + this.embedCameraMetadata, + this.fps, + this.frameGapToleranceMs, + this.height, + this.minFovDegrees, + this.orientation, + this.preferredFovDegrees, + this.stabilizationMode, + this.stabilizationRequired, + this.width); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BitrateCeilingMbpsStage builder() { + return new Builder(); + } + + public interface BitrateCeilingMbpsStage { + /** + *

Maximum acceptable average bitrate, in megabits per second.

+ */ + BitrateFloorMbpsStage bitrateCeilingMbps(int bitrateCeilingMbps); + + Builder from(CaptureSpecVideo other); + } + + public interface BitrateFloorMbpsStage { + /** + *

Minimum acceptable average bitrate, in megabits per second.

+ */ + BitrateTargetMbpsStage bitrateFloorMbps(int bitrateFloorMbps); + } + + public interface BitrateTargetMbpsStage { + /** + *

Recommended average bitrate to encode at, in megabits per second.

+ */ + CameraLensStage bitrateTargetMbps(int bitrateTargetMbps); + } + + public interface CameraLensStage { + /** + *

Which physical lens to record with.

+ */ + EmbedCameraMetadataStage cameraLens(@NotNull String cameraLens); + } + + public interface EmbedCameraMetadataStage { + /** + *

Whether the client must also write the camera make and model into the video container's metadata. When false, the capture manifest and export CSV are the metadata carrier.

+ */ + FpsStage embedCameraMetadata(boolean embedCameraMetadata); + } + + public interface FpsStage { + /** + *

Target capture frame rate.

+ */ + FrameGapToleranceMsStage fps(int fps); + } + + public interface FrameGapToleranceMsStage { + /** + *

Longest stall between consecutive frames a clip may contain before the client rejects it, in milliseconds. Every frame is timestamped in the frame log, so a stall stays alignable downstream — this bounds how broken a capture may be, not how evenly it must be paced.

+ */ + HeightStage frameGapToleranceMs(int frameGapToleranceMs); + } + + public interface HeightStage { + /** + *

Required frame height in pixels — recorded footage must match exactly.

+ */ + MinFovDegreesStage height(int height); + } + + public interface MinFovDegreesStage { + /** + *

Minimum acceptable horizontal field of view, in degrees.

+ */ + OrientationStage minFovDegrees(int minFovDegrees); + } + + public interface OrientationStage { + /** + *

Device orientation to record in.

+ */ + PreferredFovDegreesStage orientation(@NotNull String orientation); + } + + public interface PreferredFovDegreesStage { + /** + *

Preferred horizontal field of view, in degrees.

+ */ + StabilizationModeStage preferredFovDegrees(int preferredFovDegrees); + } + + public interface StabilizationModeStage { + /** + *

How the client must configure video stabilization: off disables EIS so raw motion is preserved for pose extraction, on requires it, any leaves the device default.

+ */ + StabilizationRequiredStage stabilizationMode(@NotNull CaptureSpecVideoStabilizationMode stabilizationMode); + } + + public interface StabilizationRequiredStage { + /** + *

Whether hardware/software stabilization must be enabled. True exactly when stabilization_mode is on.

+ */ + WidthStage stabilizationRequired(boolean stabilizationRequired); + } + + public interface WidthStage { + /** + *

Required frame width in pixels — recorded footage must match exactly.

+ */ + _FinalStage width(int width); + } + + public interface _FinalStage { + CaptureSpecVideo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage codecs(List codecs); + + _FinalStage addCodecs(String codecs); + + _FinalStage addAllCodecs(List codecs); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BitrateCeilingMbpsStage, + BitrateFloorMbpsStage, + BitrateTargetMbpsStage, + CameraLensStage, + EmbedCameraMetadataStage, + FpsStage, + FrameGapToleranceMsStage, + HeightStage, + MinFovDegreesStage, + OrientationStage, + PreferredFovDegreesStage, + StabilizationModeStage, + StabilizationRequiredStage, + WidthStage, + _FinalStage { + private int bitrateCeilingMbps; + + private int bitrateFloorMbps; + + private int bitrateTargetMbps; + + private String cameraLens; + + private boolean embedCameraMetadata; + + private int fps; + + private int frameGapToleranceMs; + + private int height; + + private int minFovDegrees; + + private String orientation; + + private int preferredFovDegrees; + + private CaptureSpecVideoStabilizationMode stabilizationMode; + + private boolean stabilizationRequired; + + private int width; + + private List codecs = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CaptureSpecVideo other) { + bitrateCeilingMbps(other.getBitrateCeilingMbps()); + bitrateFloorMbps(other.getBitrateFloorMbps()); + bitrateTargetMbps(other.getBitrateTargetMbps()); + cameraLens(other.getCameraLens()); + codecs(other.getCodecs()); + embedCameraMetadata(other.getEmbedCameraMetadata()); + fps(other.getFps()); + frameGapToleranceMs(other.getFrameGapToleranceMs()); + height(other.getHeight()); + minFovDegrees(other.getMinFovDegrees()); + orientation(other.getOrientation()); + preferredFovDegrees(other.getPreferredFovDegrees()); + stabilizationMode(other.getStabilizationMode()); + stabilizationRequired(other.getStabilizationRequired()); + width(other.getWidth()); + return this; + } + + /** + *

Maximum acceptable average bitrate, in megabits per second.

+ *

Maximum acceptable average bitrate, in megabits per second.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bitrate_ceiling_mbps") + public BitrateFloorMbpsStage bitrateCeilingMbps(int bitrateCeilingMbps) { + this.bitrateCeilingMbps = bitrateCeilingMbps; + return this; + } + + /** + *

Minimum acceptable average bitrate, in megabits per second.

+ *

Minimum acceptable average bitrate, in megabits per second.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bitrate_floor_mbps") + public BitrateTargetMbpsStage bitrateFloorMbps(int bitrateFloorMbps) { + this.bitrateFloorMbps = bitrateFloorMbps; + return this; + } + + /** + *

Recommended average bitrate to encode at, in megabits per second.

+ *

Recommended average bitrate to encode at, in megabits per second.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bitrate_target_mbps") + public CameraLensStage bitrateTargetMbps(int bitrateTargetMbps) { + this.bitrateTargetMbps = bitrateTargetMbps; + return this; + } + + /** + *

Which physical lens to record with.

+ *

Which physical lens to record with.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("camera_lens") + public EmbedCameraMetadataStage cameraLens(@NotNull String cameraLens) { + this.cameraLens = Objects.requireNonNull(cameraLens, "cameraLens must not be null"); + return this; + } + + /** + *

Whether the client must also write the camera make and model into the video container's metadata. When false, the capture manifest and export CSV are the metadata carrier.

+ *

Whether the client must also write the camera make and model into the video container's metadata. When false, the capture manifest and export CSV are the metadata carrier.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("embed_camera_metadata") + public FpsStage embedCameraMetadata(boolean embedCameraMetadata) { + this.embedCameraMetadata = embedCameraMetadata; + return this; + } + + /** + *

Target capture frame rate.

+ *

Target capture frame rate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fps") + public FrameGapToleranceMsStage fps(int fps) { + this.fps = fps; + return this; + } + + /** + *

Longest stall between consecutive frames a clip may contain before the client rejects it, in milliseconds. Every frame is timestamped in the frame log, so a stall stays alignable downstream — this bounds how broken a capture may be, not how evenly it must be paced.

+ *

Longest stall between consecutive frames a clip may contain before the client rejects it, in milliseconds. Every frame is timestamped in the frame log, so a stall stays alignable downstream — this bounds how broken a capture may be, not how evenly it must be paced.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("frame_gap_tolerance_ms") + public HeightStage frameGapToleranceMs(int frameGapToleranceMs) { + this.frameGapToleranceMs = frameGapToleranceMs; + return this; + } + + /** + *

Required frame height in pixels — recorded footage must match exactly.

+ *

Required frame height in pixels — recorded footage must match exactly.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("height") + public MinFovDegreesStage height(int height) { + this.height = height; + return this; + } + + /** + *

Minimum acceptable horizontal field of view, in degrees.

+ *

Minimum acceptable horizontal field of view, in degrees.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("min_fov_degrees") + public OrientationStage minFovDegrees(int minFovDegrees) { + this.minFovDegrees = minFovDegrees; + return this; + } + + /** + *

Device orientation to record in.

+ *

Device orientation to record in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orientation") + public PreferredFovDegreesStage orientation(@NotNull String orientation) { + this.orientation = Objects.requireNonNull(orientation, "orientation must not be null"); + return this; + } + + /** + *

Preferred horizontal field of view, in degrees.

+ *

Preferred horizontal field of view, in degrees.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("preferred_fov_degrees") + public StabilizationModeStage preferredFovDegrees(int preferredFovDegrees) { + this.preferredFovDegrees = preferredFovDegrees; + return this; + } + + /** + *

How the client must configure video stabilization: off disables EIS so raw motion is preserved for pose extraction, on requires it, any leaves the device default.

+ *

How the client must configure video stabilization: off disables EIS so raw motion is preserved for pose extraction, on requires it, any leaves the device default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("stabilization_mode") + public StabilizationRequiredStage stabilizationMode( + @NotNull CaptureSpecVideoStabilizationMode stabilizationMode) { + this.stabilizationMode = Objects.requireNonNull(stabilizationMode, "stabilizationMode must not be null"); + return this; + } + + /** + *

Whether hardware/software stabilization must be enabled. True exactly when stabilization_mode is on.

+ *

Whether hardware/software stabilization must be enabled. True exactly when stabilization_mode is on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("stabilization_required") + public WidthStage stabilizationRequired(boolean stabilizationRequired) { + this.stabilizationRequired = stabilizationRequired; + return this; + } + + /** + *

Required frame width in pixels — recorded footage must match exactly.

+ *

Required frame width in pixels — recorded footage must match exactly.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("width") + public _FinalStage width(int width) { + this.width = width; + return this; + } + + @java.lang.Override + public _FinalStage addAllCodecs(List codecs) { + if (codecs != null) { + this.codecs.addAll(codecs); + } + return this; + } + + @java.lang.Override + public _FinalStage addCodecs(String codecs) { + this.codecs.add(codecs); + return this; + } + + @java.lang.Override + @JsonSetter(value = "codecs", nulls = Nulls.SKIP) + public _FinalStage codecs(List codecs) { + this.codecs.clear(); + if (codecs != null) { + this.codecs.addAll(codecs); + } + return this; + } + + @java.lang.Override + public CaptureSpecVideo build() { + return new CaptureSpecVideo( + bitrateCeilingMbps, + bitrateFloorMbps, + bitrateTargetMbps, + cameraLens, + codecs, + embedCameraMetadata, + fps, + frameGapToleranceMs, + height, + minFovDegrees, + orientation, + preferredFovDegrees, + stabilizationMode, + stabilizationRequired, + width, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CaptureSpecVideoStabilizationMode.java b/src/main/java/com/whop/api/types/CaptureSpecVideoStabilizationMode.java new file mode 100644 index 00000000..9a9daeee --- /dev/null +++ b/src/main/java/com/whop/api/types/CaptureSpecVideoStabilizationMode.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CaptureSpecVideoStabilizationMode { + public static final CaptureSpecVideoStabilizationMode OFF = new CaptureSpecVideoStabilizationMode(Value.OFF, "off"); + + public static final CaptureSpecVideoStabilizationMode ANY = new CaptureSpecVideoStabilizationMode(Value.ANY, "any"); + + public static final CaptureSpecVideoStabilizationMode ON = new CaptureSpecVideoStabilizationMode(Value.ON, "on"); + + private final Value value; + + private final String string; + + CaptureSpecVideoStabilizationMode(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CaptureSpecVideoStabilizationMode + && this.string.equals(((CaptureSpecVideoStabilizationMode) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case OFF: + return visitor.visitOff(); + case ANY: + return visitor.visitAny(); + case ON: + return visitor.visitOn(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CaptureSpecVideoStabilizationMode valueOf(String value) { + switch (value) { + case "off": + return OFF; + case "any": + return ANY; + case "on": + return ON; + default: + return new CaptureSpecVideoStabilizationMode(Value.UNKNOWN, value); + } + } + + public enum Value { + OFF, + + ON, + + ANY, + + UNKNOWN + } + + public interface Visitor { + T visitOff(); + + T visitOn(); + + T visitAny(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CardBrands.java b/src/main/java/com/whop/api/types/CardBrands.java new file mode 100644 index 00000000..dac85dae --- /dev/null +++ b/src/main/java/com/whop/api/types/CardBrands.java @@ -0,0 +1,473 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CardBrands { + public static final CardBrands WEXCARD = new CardBrands(Value.WEXCARD, "wexcard"); + + public static final CardBrands UNKNOWN = new CardBrands(Value.UNKNOWN, "unknown"); + + public static final CardBrands MASTERCARD = new CardBrands(Value.MASTERCARD, "mastercard"); + + public static final CardBrands GIROCARD = new CardBrands(Value.GIROCARD, "girocard"); + + public static final CardBrands HRG_STORE_CARD = new CardBrands(Value.HRG_STORE_CARD, "hrg_store_card"); + + public static final CardBrands RUPAY = new CardBrands(Value.RUPAY, "rupay"); + + public static final CardBrands HIPERCARD = new CardBrands(Value.HIPERCARD, "hipercard"); + + public static final CardBrands AMEX = new CardBrands(Value.AMEX, "amex"); + + public static final CardBrands FUEL_CARD = new CardBrands(Value.FUEL_CARD, "fuel_card"); + + public static final CardBrands TROY = new CardBrands(Value.TROY, "troy"); + + public static final CardBrands UZCARD = new CardBrands(Value.UZCARD, "uzcard"); + + public static final CardBrands CMI = new CardBrands(Value.CMI, "cmi"); + + public static final CardBrands TARJETA_NARANJA = new CardBrands(Value.TARJETA_NARANJA, "tarjeta_naranja"); + + public static final CardBrands DANKORT = new CardBrands(Value.DANKORT, "dankort"); + + public static final CardBrands CHINA_UNION_PAYUZCARD = + new CardBrands(Value.CHINA_UNION_PAYUZCARD, "china_union_payuzcard"); + + public static final CardBrands CARNET = new CardBrands(Value.CARNET, "carnet"); + + public static final CardBrands CABAL = new CardBrands(Value.CABAL, "cabal"); + + public static final CardBrands VISADANKORT = new CardBrands(Value.VISADANKORT, "visadankort"); + + public static final CardBrands PRIVATE_LABEL = new CardBrands(Value.PRIVATE_LABEL, "private_label"); + + public static final CardBrands JCB = new CardBrands(Value.JCB, "jcb"); + + public static final CardBrands UATP = new CardBrands(Value.UATP, "uatp"); + + public static final CardBrands ATM_CARD = new CardBrands(Value.ATM_CARD, "atm_card"); + + public static final CardBrands VERVE = new CardBrands(Value.VERVE, "verve"); + + public static final CardBrands MEEZA = new CardBrands(Value.MEEZA, "meeza"); + + public static final CardBrands ELO = new CardBrands(Value.ELO, "elo"); + + public static final CardBrands JCBRUPAY = new CardBrands(Value.JCBRUPAY, "jcbrupay"); + + public static final CardBrands UNIONPAY = new CardBrands(Value.UNIONPAY, "unionpay"); + + public static final CardBrands CHINA_UNION_PAY = new CardBrands(Value.CHINA_UNION_PAY, "china_union_pay"); + + public static final CardBrands CODENSA = new CardBrands(Value.CODENSA, "codensa"); + + public static final CardBrands MAESTRO = new CardBrands(Value.MAESTRO, "maestro"); + + public static final CardBrands JCBLANKAPAY = new CardBrands(Value.JCBLANKAPAY, "jcblankapay"); + + public static final CardBrands NSPK_MIR = new CardBrands(Value.NSPK_MIR, "nspk_mir"); + + public static final CardBrands LOCAL_BRAND = new CardBrands(Value.LOCAL_BRAND, "local_brand"); + + public static final CardBrands AURA = new CardBrands(Value.AURA, "aura"); + + public static final CardBrands LINK = new CardBrands(Value.LINK, "link"); + + public static final CardBrands DISCOVER = new CardBrands(Value.DISCOVER, "discover"); + + public static final CardBrands DINERS = new CardBrands(Value.DINERS, "diners"); + + public static final CardBrands VISABANCONTACT = new CardBrands(Value.VISABANCONTACT, "visabancontact"); + + public static final CardBrands VISA = new CardBrands(Value.VISA, "visa"); + + public static final CardBrands CIRRUS = new CardBrands(Value.CIRRUS, "cirrus"); + + public static final CardBrands EBT = new CardBrands(Value.EBT, "ebt"); + + private final Value value; + + private final String string; + + CardBrands(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof CardBrands && this.string.equals(((CardBrands) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WEXCARD: + return visitor.visitWexcard(); + case UNKNOWN: + return visitor.visitUnknown(); + case MASTERCARD: + return visitor.visitMastercard(); + case GIROCARD: + return visitor.visitGirocard(); + case HRG_STORE_CARD: + return visitor.visitHrgStoreCard(); + case RUPAY: + return visitor.visitRupay(); + case HIPERCARD: + return visitor.visitHipercard(); + case AMEX: + return visitor.visitAmex(); + case FUEL_CARD: + return visitor.visitFuelCard(); + case TROY: + return visitor.visitTroy(); + case UZCARD: + return visitor.visitUzcard(); + case CMI: + return visitor.visitCmi(); + case TARJETA_NARANJA: + return visitor.visitTarjetaNaranja(); + case DANKORT: + return visitor.visitDankort(); + case CHINA_UNION_PAYUZCARD: + return visitor.visitChinaUnionPayuzcard(); + case CARNET: + return visitor.visitCarnet(); + case CABAL: + return visitor.visitCabal(); + case VISADANKORT: + return visitor.visitVisadankort(); + case PRIVATE_LABEL: + return visitor.visitPrivateLabel(); + case JCB: + return visitor.visitJcb(); + case UATP: + return visitor.visitUatp(); + case ATM_CARD: + return visitor.visitAtmCard(); + case VERVE: + return visitor.visitVerve(); + case MEEZA: + return visitor.visitMeeza(); + case ELO: + return visitor.visitElo(); + case JCBRUPAY: + return visitor.visitJcbrupay(); + case UNIONPAY: + return visitor.visitUnionpay(); + case CHINA_UNION_PAY: + return visitor.visitChinaUnionPay(); + case CODENSA: + return visitor.visitCodensa(); + case MAESTRO: + return visitor.visitMaestro(); + case JCBLANKAPAY: + return visitor.visitJcblankapay(); + case NSPK_MIR: + return visitor.visitNspkMir(); + case LOCAL_BRAND: + return visitor.visitLocalBrand(); + case AURA: + return visitor.visitAura(); + case LINK: + return visitor.visitLink(); + case DISCOVER: + return visitor.visitDiscover(); + case DINERS: + return visitor.visitDiners(); + case VISABANCONTACT: + return visitor.visitVisabancontact(); + case VISA: + return visitor.visitVisa(); + case CIRRUS: + return visitor.visitCirrus(); + case EBT: + return visitor.visitEbt(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CardBrands valueOf(String value) { + switch (value) { + case "wexcard": + return WEXCARD; + case "unknown": + return UNKNOWN; + case "mastercard": + return MASTERCARD; + case "girocard": + return GIROCARD; + case "hrg_store_card": + return HRG_STORE_CARD; + case "rupay": + return RUPAY; + case "hipercard": + return HIPERCARD; + case "amex": + return AMEX; + case "fuel_card": + return FUEL_CARD; + case "troy": + return TROY; + case "uzcard": + return UZCARD; + case "cmi": + return CMI; + case "tarjeta_naranja": + return TARJETA_NARANJA; + case "dankort": + return DANKORT; + case "china_union_payuzcard": + return CHINA_UNION_PAYUZCARD; + case "carnet": + return CARNET; + case "cabal": + return CABAL; + case "visadankort": + return VISADANKORT; + case "private_label": + return PRIVATE_LABEL; + case "jcb": + return JCB; + case "uatp": + return UATP; + case "atm_card": + return ATM_CARD; + case "verve": + return VERVE; + case "meeza": + return MEEZA; + case "elo": + return ELO; + case "jcbrupay": + return JCBRUPAY; + case "unionpay": + return UNIONPAY; + case "china_union_pay": + return CHINA_UNION_PAY; + case "codensa": + return CODENSA; + case "maestro": + return MAESTRO; + case "jcblankapay": + return JCBLANKAPAY; + case "nspk_mir": + return NSPK_MIR; + case "local_brand": + return LOCAL_BRAND; + case "aura": + return AURA; + case "link": + return LINK; + case "discover": + return DISCOVER; + case "diners": + return DINERS; + case "visabancontact": + return VISABANCONTACT; + case "visa": + return VISA; + case "cirrus": + return CIRRUS; + case "ebt": + return EBT; + default: + return new CardBrands(Value._UNKNOWN, value); + } + } + + public enum Value { + MASTERCARD, + + VISA, + + AMEX, + + DISCOVER, + + UNIONPAY, + + JCB, + + DINERS, + + LINK, + + TROY, + + VISADANKORT, + + VISABANCONTACT, + + CHINA_UNION_PAY, + + RUPAY, + + JCBRUPAY, + + ELO, + + MAESTRO, + + TARJETA_NARANJA, + + CIRRUS, + + NSPK_MIR, + + VERVE, + + EBT, + + PRIVATE_LABEL, + + LOCAL_BRAND, + + UATP, + + WEXCARD, + + UZCARD, + + MEEZA, + + HRG_STORE_CARD, + + GIROCARD, + + FUEL_CARD, + + DANKORT, + + CARNET, + + ATM_CARD, + + CHINA_UNION_PAYUZCARD, + + CODENSA, + + CABAL, + + HIPERCARD, + + JCBLANKAPAY, + + CMI, + + AURA, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitMastercard(); + + T visitVisa(); + + T visitAmex(); + + T visitDiscover(); + + T visitUnionpay(); + + T visitJcb(); + + T visitDiners(); + + T visitLink(); + + T visitTroy(); + + T visitVisadankort(); + + T visitVisabancontact(); + + T visitChinaUnionPay(); + + T visitRupay(); + + T visitJcbrupay(); + + T visitElo(); + + T visitMaestro(); + + T visitTarjetaNaranja(); + + T visitCirrus(); + + T visitNspkMir(); + + T visitVerve(); + + T visitEbt(); + + T visitPrivateLabel(); + + T visitLocalBrand(); + + T visitUatp(); + + T visitWexcard(); + + T visitUzcard(); + + T visitMeeza(); + + T visitHrgStoreCard(); + + T visitGirocard(); + + T visitFuelCard(); + + T visitDankort(); + + T visitCarnet(); + + T visitAtmCard(); + + T visitChinaUnionPayuzcard(); + + T visitCodensa(); + + T visitCabal(); + + T visitHipercard(); + + T visitJcblankapay(); + + T visitCmi(); + + T visitAura(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CardFundingTypes.java b/src/main/java/com/whop/api/types/CardFundingTypes.java new file mode 100644 index 00000000..4c4bd687 --- /dev/null +++ b/src/main/java/com/whop/api/types/CardFundingTypes.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CardFundingTypes { + public static final CardFundingTypes DEBIT = new CardFundingTypes(Value.DEBIT, "debit"); + + public static final CardFundingTypes PREPAID = new CardFundingTypes(Value.PREPAID, "prepaid"); + + public static final CardFundingTypes CREDIT = new CardFundingTypes(Value.CREDIT, "credit"); + + private final Value value; + + private final String string; + + CardFundingTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CardFundingTypes && this.string.equals(((CardFundingTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DEBIT: + return visitor.visitDebit(); + case PREPAID: + return visitor.visitPrepaid(); + case CREDIT: + return visitor.visitCredit(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CardFundingTypes valueOf(String value) { + switch (value) { + case "debit": + return DEBIT; + case "prepaid": + return PREPAID; + case "credit": + return CREDIT; + default: + return new CardFundingTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + CREDIT, + + DEBIT, + + PREPAID, + + UNKNOWN + } + + public interface Visitor { + T visitCredit(); + + T visitDebit(); + + T visitPrepaid(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CardIssuingTransactionStatus.java b/src/main/java/com/whop/api/types/CardIssuingTransactionStatus.java new file mode 100644 index 00000000..f66c5646 --- /dev/null +++ b/src/main/java/com/whop/api/types/CardIssuingTransactionStatus.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CardIssuingTransactionStatus { + public static final CardIssuingTransactionStatus DECLINED = + new CardIssuingTransactionStatus(Value.DECLINED, "declined"); + + public static final CardIssuingTransactionStatus PENDING = + new CardIssuingTransactionStatus(Value.PENDING, "pending"); + + public static final CardIssuingTransactionStatus COMPLETED = + new CardIssuingTransactionStatus(Value.COMPLETED, "completed"); + + public static final CardIssuingTransactionStatus REVERSED = + new CardIssuingTransactionStatus(Value.REVERSED, "reversed"); + + private final Value value; + + private final String string; + + CardIssuingTransactionStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CardIssuingTransactionStatus + && this.string.equals(((CardIssuingTransactionStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DECLINED: + return visitor.visitDeclined(); + case PENDING: + return visitor.visitPending(); + case COMPLETED: + return visitor.visitCompleted(); + case REVERSED: + return visitor.visitReversed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CardIssuingTransactionStatus valueOf(String value) { + switch (value) { + case "declined": + return DECLINED; + case "pending": + return PENDING; + case "completed": + return COMPLETED; + case "reversed": + return REVERSED; + default: + return new CardIssuingTransactionStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + COMPLETED, + + REVERSED, + + DECLINED, + + UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitCompleted(); + + T visitReversed(); + + T visitDeclined(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CardTransaction.java b/src/main/java/com/whop/api/types/CardTransaction.java new file mode 100644 index 00000000..2806d322 --- /dev/null +++ b/src/main/java/com/whop/api/types/CardTransaction.java @@ -0,0 +1,1123 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CardTransaction.Builder.class) +public final class CardTransaction { + private final String cardId; + + private final Optional cardholderId; + + private final Optional cashbackUsdAmount; + + private final String createdAt; + + private final Optional currency; + + private final Optional declinedReason; + + private final String id; + + private final boolean international; + + private final Optional localAmount; + + private final Optional merchantCategory; + + private final Optional merchantCategoryCode; + + private final Optional merchantIconUrl; + + private final Optional merchantName; + + private final Optional postedAt; + + private final CardTransactionStatus status; + + private final CardTransactionTransactionType transactionType; + + private final Optional usdAmount; + + private final Map additionalProperties; + + private CardTransaction( + String cardId, + Optional cardholderId, + Optional cashbackUsdAmount, + String createdAt, + Optional currency, + Optional declinedReason, + String id, + boolean international, + Optional localAmount, + Optional merchantCategory, + Optional merchantCategoryCode, + Optional merchantIconUrl, + Optional merchantName, + Optional postedAt, + CardTransactionStatus status, + CardTransactionTransactionType transactionType, + Optional usdAmount, + Map additionalProperties) { + this.cardId = cardId; + this.cardholderId = cardholderId; + this.cashbackUsdAmount = cashbackUsdAmount; + this.createdAt = createdAt; + this.currency = currency; + this.declinedReason = declinedReason; + this.id = id; + this.international = international; + this.localAmount = localAmount; + this.merchantCategory = merchantCategory; + this.merchantCategoryCode = merchantCategoryCode; + this.merchantIconUrl = merchantIconUrl; + this.merchantName = merchantName; + this.postedAt = postedAt; + this.status = status; + this.transactionType = transactionType; + this.usdAmount = usdAmount; + this.additionalProperties = additionalProperties; + } + + /** + * @return The card this transaction was charged to, prefixed icrd_. + */ + @JsonProperty("card_id") + public String getCardId() { + return cardId; + } + + /** + * @return The user the card is assigned to, prefixed user_. Null when the card has no assigned cardholder. + */ + @JsonIgnore + public Optional getCardholderId() { + if (cardholderId == null) { + return Optional.empty(); + } + return cardholderId; + } + + /** + * @return Cashback earned on this transaction as a USD amount. Zero for declined or ineligible transactions, and null when cashback has not been computed yet. + */ + @JsonIgnore + public Optional getCashbackUsdAmount() { + if (cashbackUsdAmount == null) { + return Optional.empty(); + } + return cashbackUsdAmount; + } + + /** + * @return When the transaction was authorized, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return ISO 4217 currency code the merchant charged in. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return Why the transaction was declined. Null unless status is declined. + */ + @JsonIgnore + public Optional getDeclinedReason() { + if (declinedReason == null) { + return Optional.empty(); + } + return declinedReason; + } + + /** + * @return Card transaction ID, prefixed citx_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return True when the merchant is outside the card's home country. + */ + @JsonProperty("international") + public boolean getInternational() { + return international; + } + + /** + * @return Amount the merchant charged in their own currency. Pair with currency. + */ + @JsonIgnore + public Optional getLocalAmount() { + if (localAmount == null) { + return Optional.empty(); + } + return localAmount; + } + + /** + * @return Merchant category label, enriched where available and otherwise as the card network reported it. + */ + @JsonIgnore + public Optional getMerchantCategory() { + if (merchantCategory == null) { + return Optional.empty(); + } + return merchantCategory; + } + + /** + * @return Four-digit ISO 18245 merchant category code (MCC). + */ + @JsonIgnore + public Optional getMerchantCategoryCode() { + if (merchantCategoryCode == null) { + return Optional.empty(); + } + return merchantCategoryCode; + } + + /** + * @return URL of the enriched merchant logo. Null when no logo was matched. + */ + @JsonIgnore + public Optional getMerchantIconUrl() { + if (merchantIconUrl == null) { + return Optional.empty(); + } + return merchantIconUrl; + } + + /** + * @return Merchant name, enriched where available and otherwise as the card network reported it. + */ + @JsonIgnore + public Optional getMerchantName() { + if (merchantName == null) { + return Optional.empty(); + } + return merchantName; + } + + /** + * @return When the card network settled the transaction, as an ISO 8601 timestamp. Null until it settles. + */ + @JsonIgnore + public Optional getPostedAt() { + if (postedAt == null) { + return Optional.empty(); + } + return postedAt; + } + + /** + * @return Current status of the transaction. + */ + @JsonProperty("status") + public CardTransactionStatus getStatus() { + return status; + } + + /** + * @return The kind of card transaction. Always spend today. + */ + @JsonProperty("transaction_type") + public CardTransactionTransactionType getTransactionType() { + return transactionType; + } + + /** + * @return Amount charged in USD. Negative when the merchant refunded the card. + */ + @JsonIgnore + public Optional getUsdAmount() { + if (usdAmount == null) { + return Optional.empty(); + } + return usdAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cardholder_id") + private Optional _getCardholderId() { + return cardholderId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cashback_usd_amount") + private Optional _getCashbackUsdAmount() { + return cashbackUsdAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("declined_reason") + private Optional _getDeclinedReason() { + return declinedReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("local_amount") + private Optional _getLocalAmount() { + return localAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("merchant_category") + private Optional _getMerchantCategory() { + return merchantCategory; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("merchant_category_code") + private Optional _getMerchantCategoryCode() { + return merchantCategoryCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("merchant_icon_url") + private Optional _getMerchantIconUrl() { + return merchantIconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("merchant_name") + private Optional _getMerchantName() { + return merchantName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("posted_at") + private Optional _getPostedAt() { + return postedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("usd_amount") + private Optional _getUsdAmount() { + return usdAmount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CardTransaction && equalTo((CardTransaction) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CardTransaction other) { + return cardId.equals(other.cardId) + && cardholderId.equals(other.cardholderId) + && cashbackUsdAmount.equals(other.cashbackUsdAmount) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && declinedReason.equals(other.declinedReason) + && id.equals(other.id) + && international == other.international + && localAmount.equals(other.localAmount) + && merchantCategory.equals(other.merchantCategory) + && merchantCategoryCode.equals(other.merchantCategoryCode) + && merchantIconUrl.equals(other.merchantIconUrl) + && merchantName.equals(other.merchantName) + && postedAt.equals(other.postedAt) + && status.equals(other.status) + && transactionType.equals(other.transactionType) + && usdAmount.equals(other.usdAmount); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.cardId, + this.cardholderId, + this.cashbackUsdAmount, + this.createdAt, + this.currency, + this.declinedReason, + this.id, + this.international, + this.localAmount, + this.merchantCategory, + this.merchantCategoryCode, + this.merchantIconUrl, + this.merchantName, + this.postedAt, + this.status, + this.transactionType, + this.usdAmount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardIdStage builder() { + return new Builder(); + } + + public interface CardIdStage { + /** + *

The card this transaction was charged to, prefixed icrd_.

+ */ + CreatedAtStage cardId(@NotNull String cardId); + + Builder from(CardTransaction other); + } + + public interface CreatedAtStage { + /** + *

When the transaction was authorized, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Card transaction ID, prefixed citx_.

+ */ + InternationalStage id(@NotNull String id); + } + + public interface InternationalStage { + /** + *

True when the merchant is outside the card's home country.

+ */ + StatusStage international(boolean international); + } + + public interface StatusStage { + /** + *

Current status of the transaction.

+ */ + TransactionTypeStage status(@NotNull CardTransactionStatus status); + } + + public interface TransactionTypeStage { + /** + *

The kind of card transaction. Always spend today.

+ */ + _FinalStage transactionType(@NotNull CardTransactionTransactionType transactionType); + } + + public interface _FinalStage { + CardTransaction build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user the card is assigned to, prefixed user_. Null when the card has no assigned cardholder.

+ */ + _FinalStage cardholderId(Optional cardholderId); + + _FinalStage cardholderId(String cardholderId); + + _FinalStage cardholderId(Nullable cardholderId); + + /** + *

Cashback earned on this transaction as a USD amount. Zero for declined or ineligible transactions, and null when cashback has not been computed yet.

+ */ + _FinalStage cashbackUsdAmount(Optional cashbackUsdAmount); + + _FinalStage cashbackUsdAmount(Double cashbackUsdAmount); + + _FinalStage cashbackUsdAmount(Nullable cashbackUsdAmount); + + /** + *

ISO 4217 currency code the merchant charged in.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + _FinalStage currency(Nullable currency); + + /** + *

Why the transaction was declined. Null unless status is declined.

+ */ + _FinalStage declinedReason(Optional declinedReason); + + _FinalStage declinedReason(String declinedReason); + + _FinalStage declinedReason(Nullable declinedReason); + + /** + *

Amount the merchant charged in their own currency. Pair with currency.

+ */ + _FinalStage localAmount(Optional localAmount); + + _FinalStage localAmount(Double localAmount); + + _FinalStage localAmount(Nullable localAmount); + + /** + *

Merchant category label, enriched where available and otherwise as the card network reported it.

+ */ + _FinalStage merchantCategory(Optional merchantCategory); + + _FinalStage merchantCategory(String merchantCategory); + + _FinalStage merchantCategory(Nullable merchantCategory); + + /** + *

Four-digit ISO 18245 merchant category code (MCC).

+ */ + _FinalStage merchantCategoryCode(Optional merchantCategoryCode); + + _FinalStage merchantCategoryCode(String merchantCategoryCode); + + _FinalStage merchantCategoryCode(Nullable merchantCategoryCode); + + /** + *

URL of the enriched merchant logo. Null when no logo was matched.

+ */ + _FinalStage merchantIconUrl(Optional merchantIconUrl); + + _FinalStage merchantIconUrl(String merchantIconUrl); + + _FinalStage merchantIconUrl(Nullable merchantIconUrl); + + /** + *

Merchant name, enriched where available and otherwise as the card network reported it.

+ */ + _FinalStage merchantName(Optional merchantName); + + _FinalStage merchantName(String merchantName); + + _FinalStage merchantName(Nullable merchantName); + + /** + *

When the card network settled the transaction, as an ISO 8601 timestamp. Null until it settles.

+ */ + _FinalStage postedAt(Optional postedAt); + + _FinalStage postedAt(String postedAt); + + _FinalStage postedAt(Nullable postedAt); + + /** + *

Amount charged in USD. Negative when the merchant refunded the card.

+ */ + _FinalStage usdAmount(Optional usdAmount); + + _FinalStage usdAmount(Double usdAmount); + + _FinalStage usdAmount(Nullable usdAmount); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CardIdStage, + CreatedAtStage, + IdStage, + InternationalStage, + StatusStage, + TransactionTypeStage, + _FinalStage { + private String cardId; + + private String createdAt; + + private String id; + + private boolean international; + + private CardTransactionStatus status; + + private CardTransactionTransactionType transactionType; + + private Optional usdAmount = Optional.empty(); + + private Optional postedAt = Optional.empty(); + + private Optional merchantName = Optional.empty(); + + private Optional merchantIconUrl = Optional.empty(); + + private Optional merchantCategoryCode = Optional.empty(); + + private Optional merchantCategory = Optional.empty(); + + private Optional localAmount = Optional.empty(); + + private Optional declinedReason = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional cashbackUsdAmount = Optional.empty(); + + private Optional cardholderId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CardTransaction other) { + cardId(other.getCardId()); + cardholderId(other.getCardholderId()); + cashbackUsdAmount(other.getCashbackUsdAmount()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + declinedReason(other.getDeclinedReason()); + id(other.getId()); + international(other.getInternational()); + localAmount(other.getLocalAmount()); + merchantCategory(other.getMerchantCategory()); + merchantCategoryCode(other.getMerchantCategoryCode()); + merchantIconUrl(other.getMerchantIconUrl()); + merchantName(other.getMerchantName()); + postedAt(other.getPostedAt()); + status(other.getStatus()); + transactionType(other.getTransactionType()); + usdAmount(other.getUsdAmount()); + return this; + } + + /** + *

The card this transaction was charged to, prefixed icrd_.

+ *

The card this transaction was charged to, prefixed icrd_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card_id") + public CreatedAtStage cardId(@NotNull String cardId) { + this.cardId = Objects.requireNonNull(cardId, "cardId must not be null"); + return this; + } + + /** + *

When the transaction was authorized, as an ISO 8601 timestamp.

+ *

When the transaction was authorized, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Card transaction ID, prefixed citx_.

+ *

Card transaction ID, prefixed citx_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public InternationalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

True when the merchant is outside the card's home country.

+ *

True when the merchant is outside the card's home country.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("international") + public StatusStage international(boolean international) { + this.international = international; + return this; + } + + /** + *

Current status of the transaction.

+ *

Current status of the transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TransactionTypeStage status(@NotNull CardTransactionStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The kind of card transaction. Always spend today.

+ *

The kind of card transaction. Always spend today.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("transaction_type") + public _FinalStage transactionType(@NotNull CardTransactionTransactionType transactionType) { + this.transactionType = Objects.requireNonNull(transactionType, "transactionType must not be null"); + return this; + } + + /** + *

Amount charged in USD. Negative when the merchant refunded the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdAmount(Nullable usdAmount) { + if (usdAmount.isNull()) { + this.usdAmount = null; + } else if (usdAmount.isEmpty()) { + this.usdAmount = Optional.empty(); + } else { + this.usdAmount = Optional.of(usdAmount.get()); + } + return this; + } + + /** + *

Amount charged in USD. Negative when the merchant refunded the card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdAmount(Double usdAmount) { + this.usdAmount = Optional.ofNullable(usdAmount); + return this; + } + + /** + *

Amount charged in USD. Negative when the merchant refunded the card.

+ */ + @java.lang.Override + @JsonSetter(value = "usd_amount", nulls = Nulls.SKIP) + public _FinalStage usdAmount(Optional usdAmount) { + this.usdAmount = usdAmount; + return this; + } + + /** + *

When the card network settled the transaction, as an ISO 8601 timestamp. Null until it settles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage postedAt(Nullable postedAt) { + if (postedAt.isNull()) { + this.postedAt = null; + } else if (postedAt.isEmpty()) { + this.postedAt = Optional.empty(); + } else { + this.postedAt = Optional.of(postedAt.get()); + } + return this; + } + + /** + *

When the card network settled the transaction, as an ISO 8601 timestamp. Null until it settles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage postedAt(String postedAt) { + this.postedAt = Optional.ofNullable(postedAt); + return this; + } + + /** + *

When the card network settled the transaction, as an ISO 8601 timestamp. Null until it settles.

+ */ + @java.lang.Override + @JsonSetter(value = "posted_at", nulls = Nulls.SKIP) + public _FinalStage postedAt(Optional postedAt) { + this.postedAt = postedAt; + return this; + } + + /** + *

Merchant name, enriched where available and otherwise as the card network reported it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantName(Nullable merchantName) { + if (merchantName.isNull()) { + this.merchantName = null; + } else if (merchantName.isEmpty()) { + this.merchantName = Optional.empty(); + } else { + this.merchantName = Optional.of(merchantName.get()); + } + return this; + } + + /** + *

Merchant name, enriched where available and otherwise as the card network reported it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantName(String merchantName) { + this.merchantName = Optional.ofNullable(merchantName); + return this; + } + + /** + *

Merchant name, enriched where available and otherwise as the card network reported it.

+ */ + @java.lang.Override + @JsonSetter(value = "merchant_name", nulls = Nulls.SKIP) + public _FinalStage merchantName(Optional merchantName) { + this.merchantName = merchantName; + return this; + } + + /** + *

URL of the enriched merchant logo. Null when no logo was matched.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantIconUrl(Nullable merchantIconUrl) { + if (merchantIconUrl.isNull()) { + this.merchantIconUrl = null; + } else if (merchantIconUrl.isEmpty()) { + this.merchantIconUrl = Optional.empty(); + } else { + this.merchantIconUrl = Optional.of(merchantIconUrl.get()); + } + return this; + } + + /** + *

URL of the enriched merchant logo. Null when no logo was matched.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantIconUrl(String merchantIconUrl) { + this.merchantIconUrl = Optional.ofNullable(merchantIconUrl); + return this; + } + + /** + *

URL of the enriched merchant logo. Null when no logo was matched.

+ */ + @java.lang.Override + @JsonSetter(value = "merchant_icon_url", nulls = Nulls.SKIP) + public _FinalStage merchantIconUrl(Optional merchantIconUrl) { + this.merchantIconUrl = merchantIconUrl; + return this; + } + + /** + *

Four-digit ISO 18245 merchant category code (MCC).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantCategoryCode(Nullable merchantCategoryCode) { + if (merchantCategoryCode.isNull()) { + this.merchantCategoryCode = null; + } else if (merchantCategoryCode.isEmpty()) { + this.merchantCategoryCode = Optional.empty(); + } else { + this.merchantCategoryCode = Optional.of(merchantCategoryCode.get()); + } + return this; + } + + /** + *

Four-digit ISO 18245 merchant category code (MCC).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantCategoryCode(String merchantCategoryCode) { + this.merchantCategoryCode = Optional.ofNullable(merchantCategoryCode); + return this; + } + + /** + *

Four-digit ISO 18245 merchant category code (MCC).

+ */ + @java.lang.Override + @JsonSetter(value = "merchant_category_code", nulls = Nulls.SKIP) + public _FinalStage merchantCategoryCode(Optional merchantCategoryCode) { + this.merchantCategoryCode = merchantCategoryCode; + return this; + } + + /** + *

Merchant category label, enriched where available and otherwise as the card network reported it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantCategory(Nullable merchantCategory) { + if (merchantCategory.isNull()) { + this.merchantCategory = null; + } else if (merchantCategory.isEmpty()) { + this.merchantCategory = Optional.empty(); + } else { + this.merchantCategory = Optional.of(merchantCategory.get()); + } + return this; + } + + /** + *

Merchant category label, enriched where available and otherwise as the card network reported it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantCategory(String merchantCategory) { + this.merchantCategory = Optional.ofNullable(merchantCategory); + return this; + } + + /** + *

Merchant category label, enriched where available and otherwise as the card network reported it.

+ */ + @java.lang.Override + @JsonSetter(value = "merchant_category", nulls = Nulls.SKIP) + public _FinalStage merchantCategory(Optional merchantCategory) { + this.merchantCategory = merchantCategory; + return this; + } + + /** + *

Amount the merchant charged in their own currency. Pair with currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage localAmount(Nullable localAmount) { + if (localAmount.isNull()) { + this.localAmount = null; + } else if (localAmount.isEmpty()) { + this.localAmount = Optional.empty(); + } else { + this.localAmount = Optional.of(localAmount.get()); + } + return this; + } + + /** + *

Amount the merchant charged in their own currency. Pair with currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage localAmount(Double localAmount) { + this.localAmount = Optional.ofNullable(localAmount); + return this; + } + + /** + *

Amount the merchant charged in their own currency. Pair with currency.

+ */ + @java.lang.Override + @JsonSetter(value = "local_amount", nulls = Nulls.SKIP) + public _FinalStage localAmount(Optional localAmount) { + this.localAmount = localAmount; + return this; + } + + /** + *

Why the transaction was declined. Null unless status is declined.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage declinedReason(Nullable declinedReason) { + if (declinedReason.isNull()) { + this.declinedReason = null; + } else if (declinedReason.isEmpty()) { + this.declinedReason = Optional.empty(); + } else { + this.declinedReason = Optional.of(declinedReason.get()); + } + return this; + } + + /** + *

Why the transaction was declined. Null unless status is declined.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage declinedReason(String declinedReason) { + this.declinedReason = Optional.ofNullable(declinedReason); + return this; + } + + /** + *

Why the transaction was declined. Null unless status is declined.

+ */ + @java.lang.Override + @JsonSetter(value = "declined_reason", nulls = Nulls.SKIP) + public _FinalStage declinedReason(Optional declinedReason) { + this.declinedReason = declinedReason; + return this; + } + + /** + *

ISO 4217 currency code the merchant charged in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

ISO 4217 currency code the merchant charged in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

ISO 4217 currency code the merchant charged in.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + /** + *

Cashback earned on this transaction as a USD amount. Zero for declined or ineligible transactions, and null when cashback has not been computed yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cashbackUsdAmount(Nullable cashbackUsdAmount) { + if (cashbackUsdAmount.isNull()) { + this.cashbackUsdAmount = null; + } else if (cashbackUsdAmount.isEmpty()) { + this.cashbackUsdAmount = Optional.empty(); + } else { + this.cashbackUsdAmount = Optional.of(cashbackUsdAmount.get()); + } + return this; + } + + /** + *

Cashback earned on this transaction as a USD amount. Zero for declined or ineligible transactions, and null when cashback has not been computed yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cashbackUsdAmount(Double cashbackUsdAmount) { + this.cashbackUsdAmount = Optional.ofNullable(cashbackUsdAmount); + return this; + } + + /** + *

Cashback earned on this transaction as a USD amount. Zero for declined or ineligible transactions, and null when cashback has not been computed yet.

+ */ + @java.lang.Override + @JsonSetter(value = "cashback_usd_amount", nulls = Nulls.SKIP) + public _FinalStage cashbackUsdAmount(Optional cashbackUsdAmount) { + this.cashbackUsdAmount = cashbackUsdAmount; + return this; + } + + /** + *

The user the card is assigned to, prefixed user_. Null when the card has no assigned cardholder.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardholderId(Nullable cardholderId) { + if (cardholderId.isNull()) { + this.cardholderId = null; + } else if (cardholderId.isEmpty()) { + this.cardholderId = Optional.empty(); + } else { + this.cardholderId = Optional.of(cardholderId.get()); + } + return this; + } + + /** + *

The user the card is assigned to, prefixed user_. Null when the card has no assigned cardholder.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardholderId(String cardholderId) { + this.cardholderId = Optional.ofNullable(cardholderId); + return this; + } + + /** + *

The user the card is assigned to, prefixed user_. Null when the card has no assigned cardholder.

+ */ + @java.lang.Override + @JsonSetter(value = "cardholder_id", nulls = Nulls.SKIP) + public _FinalStage cardholderId(Optional cardholderId) { + this.cardholderId = cardholderId; + return this; + } + + @java.lang.Override + public CardTransaction build() { + return new CardTransaction( + cardId, + cardholderId, + cashbackUsdAmount, + createdAt, + currency, + declinedReason, + id, + international, + localAmount, + merchantCategory, + merchantCategoryCode, + merchantIconUrl, + merchantName, + postedAt, + status, + transactionType, + usdAmount, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CardTransactionListItem.java b/src/main/java/com/whop/api/types/CardTransactionListItem.java new file mode 100644 index 00000000..479296e5 --- /dev/null +++ b/src/main/java/com/whop/api/types/CardTransactionListItem.java @@ -0,0 +1,1196 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CardTransactionListItem.Builder.class) +public final class CardTransactionListItem { + private final Optional authorizationMethod; + + private final String cardId; + + private final Optional cashbackUsdAmount; + + private final OffsetDateTime createdAt; + + private final Optional currency; + + private final Optional declinedReason; + + private final String id; + + private final boolean international; + + private final Optional localAmount; + + private final Optional memo; + + private final Optional merchantCategory; + + private final Optional merchantCategoryCode; + + private final Optional merchantIconUrl; + + private final Optional merchantName; + + private final Optional postedAt; + + private final CardIssuingTransactionStatus status; + + private final String transactionType; + + private final Optional usdAmount; + + private final Map additionalProperties; + + private CardTransactionListItem( + Optional authorizationMethod, + String cardId, + Optional cashbackUsdAmount, + OffsetDateTime createdAt, + Optional currency, + Optional declinedReason, + String id, + boolean international, + Optional localAmount, + Optional memo, + Optional merchantCategory, + Optional merchantCategoryCode, + Optional merchantIconUrl, + Optional merchantName, + Optional postedAt, + CardIssuingTransactionStatus status, + String transactionType, + Optional usdAmount, + Map additionalProperties) { + this.authorizationMethod = authorizationMethod; + this.cardId = cardId; + this.cashbackUsdAmount = cashbackUsdAmount; + this.createdAt = createdAt; + this.currency = currency; + this.declinedReason = declinedReason; + this.id = id; + this.international = international; + this.localAmount = localAmount; + this.memo = memo; + this.merchantCategory = merchantCategory; + this.merchantCategoryCode = merchantCategoryCode; + this.merchantIconUrl = merchantIconUrl; + this.merchantName = merchantName; + this.postedAt = postedAt; + this.status = status; + this.transactionType = transactionType; + this.usdAmount = usdAmount; + this.additionalProperties = additionalProperties; + } + + /** + * @return How the card was presented or authenticated for the purchase. + */ + @JsonIgnore + public Optional getAuthorizationMethod() { + if (authorizationMethod == null) { + return Optional.empty(); + } + return authorizationMethod; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("card_id") + public String getCardId() { + return cardId; + } + + /** + * @return The cashback reward amount earned on this transaction, in USD. + */ + @JsonIgnore + public Optional getCashbackUsdAmount() { + if (cashbackUsdAmount == null) { + return Optional.empty(); + } + return cashbackUsdAmount; + } + + /** + * @return The datetime the card transaction was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The ISO 4217 currency code for the transaction amount. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return The issuer-provided reason the transaction was declined. + */ + @JsonIgnore + public Optional getDeclinedReason() { + if (declinedReason == null) { + return Optional.empty(); + } + return declinedReason; + } + + /** + * @return The unique identifier for the card transaction. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whether the transaction was made with a merchant outside the card's home country. + */ + @JsonProperty("international") + public boolean getInternational() { + return international; + } + + /** + * @return The transaction amount in the merchant's local currency before conversion. + */ + @JsonIgnore + public Optional getLocalAmount() { + if (localAmount == null) { + return Optional.empty(); + } + return localAmount; + } + + /** + * @return A user-provided note attached to the transaction. + */ + @JsonIgnore + public Optional getMemo() { + if (memo == null) { + return Optional.empty(); + } + return memo; + } + + /** + * @return The enriched or raw category label for the merchant. + */ + @JsonIgnore + public Optional getMerchantCategory() { + if (merchantCategory == null) { + return Optional.empty(); + } + return merchantCategory; + } + + /** + * @return The four-digit ISO 18245 merchant category code (MCC). + */ + @JsonIgnore + public Optional getMerchantCategoryCode() { + if (merchantCategoryCode == null) { + return Optional.empty(); + } + return merchantCategoryCode; + } + + /** + * @return A URL to the enriched merchant logo image. + */ + @JsonIgnore + public Optional getMerchantIconUrl() { + if (merchantIconUrl == null) { + return Optional.empty(); + } + return merchantIconUrl; + } + + /** + * @return The enriched or raw name of the merchant where the purchase was made. + */ + @JsonIgnore + public Optional getMerchantName() { + if (merchantName == null) { + return Optional.empty(); + } + return merchantName; + } + + /** + * @return When the transaction was settled by the card network. + */ + @JsonIgnore + public Optional getPostedAt() { + if (postedAt == null) { + return Optional.empty(); + } + return postedAt; + } + + /** + * @return The current lifecycle status of the transaction. + */ + @JsonProperty("status") + public CardIssuingTransactionStatus getStatus() { + return status; + } + + /** + * @return The type of transaction. + */ + @JsonProperty("transaction_type") + public String getTransactionType() { + return transactionType; + } + + /** + * @return The transaction amount in USD. + */ + @JsonIgnore + public Optional getUsdAmount() { + if (usdAmount == null) { + return Optional.empty(); + } + return usdAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("authorization_method") + private Optional _getAuthorizationMethod() { + return authorizationMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cashback_usd_amount") + private Optional _getCashbackUsdAmount() { + return cashbackUsdAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("declined_reason") + private Optional _getDeclinedReason() { + return declinedReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("local_amount") + private Optional _getLocalAmount() { + return localAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("memo") + private Optional _getMemo() { + return memo; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("merchant_category") + private Optional _getMerchantCategory() { + return merchantCategory; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("merchant_category_code") + private Optional _getMerchantCategoryCode() { + return merchantCategoryCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("merchant_icon_url") + private Optional _getMerchantIconUrl() { + return merchantIconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("merchant_name") + private Optional _getMerchantName() { + return merchantName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("posted_at") + private Optional _getPostedAt() { + return postedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("usd_amount") + private Optional _getUsdAmount() { + return usdAmount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CardTransactionListItem && equalTo((CardTransactionListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CardTransactionListItem other) { + return authorizationMethod.equals(other.authorizationMethod) + && cardId.equals(other.cardId) + && cashbackUsdAmount.equals(other.cashbackUsdAmount) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && declinedReason.equals(other.declinedReason) + && id.equals(other.id) + && international == other.international + && localAmount.equals(other.localAmount) + && memo.equals(other.memo) + && merchantCategory.equals(other.merchantCategory) + && merchantCategoryCode.equals(other.merchantCategoryCode) + && merchantIconUrl.equals(other.merchantIconUrl) + && merchantName.equals(other.merchantName) + && postedAt.equals(other.postedAt) + && status.equals(other.status) + && transactionType.equals(other.transactionType) + && usdAmount.equals(other.usdAmount); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.authorizationMethod, + this.cardId, + this.cashbackUsdAmount, + this.createdAt, + this.currency, + this.declinedReason, + this.id, + this.international, + this.localAmount, + this.memo, + this.merchantCategory, + this.merchantCategoryCode, + this.merchantIconUrl, + this.merchantName, + this.postedAt, + this.status, + this.transactionType, + this.usdAmount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardIdStage builder() { + return new Builder(); + } + + public interface CardIdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + CreatedAtStage cardId(@NotNull String cardId); + + Builder from(CardTransactionListItem other); + } + + public interface CreatedAtStage { + /** + *

The datetime the card transaction was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the card transaction.

+ */ + InternationalStage id(@NotNull String id); + } + + public interface InternationalStage { + /** + *

Whether the transaction was made with a merchant outside the card's home country.

+ */ + StatusStage international(boolean international); + } + + public interface StatusStage { + /** + *

The current lifecycle status of the transaction.

+ */ + TransactionTypeStage status(@NotNull CardIssuingTransactionStatus status); + } + + public interface TransactionTypeStage { + /** + *

The type of transaction.

+ */ + _FinalStage transactionType(@NotNull String transactionType); + } + + public interface _FinalStage { + CardTransactionListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

How the card was presented or authenticated for the purchase.

+ */ + _FinalStage authorizationMethod(Optional authorizationMethod); + + _FinalStage authorizationMethod(String authorizationMethod); + + _FinalStage authorizationMethod(Nullable authorizationMethod); + + /** + *

The cashback reward amount earned on this transaction, in USD.

+ */ + _FinalStage cashbackUsdAmount(Optional cashbackUsdAmount); + + _FinalStage cashbackUsdAmount(Double cashbackUsdAmount); + + _FinalStage cashbackUsdAmount(Nullable cashbackUsdAmount); + + /** + *

The ISO 4217 currency code for the transaction amount.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + _FinalStage currency(Nullable currency); + + /** + *

The issuer-provided reason the transaction was declined.

+ */ + _FinalStage declinedReason(Optional declinedReason); + + _FinalStage declinedReason(String declinedReason); + + _FinalStage declinedReason(Nullable declinedReason); + + /** + *

The transaction amount in the merchant's local currency before conversion.

+ */ + _FinalStage localAmount(Optional localAmount); + + _FinalStage localAmount(Double localAmount); + + _FinalStage localAmount(Nullable localAmount); + + /** + *

A user-provided note attached to the transaction.

+ */ + _FinalStage memo(Optional memo); + + _FinalStage memo(String memo); + + _FinalStage memo(Nullable memo); + + /** + *

The enriched or raw category label for the merchant.

+ */ + _FinalStage merchantCategory(Optional merchantCategory); + + _FinalStage merchantCategory(String merchantCategory); + + _FinalStage merchantCategory(Nullable merchantCategory); + + /** + *

The four-digit ISO 18245 merchant category code (MCC).

+ */ + _FinalStage merchantCategoryCode(Optional merchantCategoryCode); + + _FinalStage merchantCategoryCode(String merchantCategoryCode); + + _FinalStage merchantCategoryCode(Nullable merchantCategoryCode); + + /** + *

A URL to the enriched merchant logo image.

+ */ + _FinalStage merchantIconUrl(Optional merchantIconUrl); + + _FinalStage merchantIconUrl(String merchantIconUrl); + + _FinalStage merchantIconUrl(Nullable merchantIconUrl); + + /** + *

The enriched or raw name of the merchant where the purchase was made.

+ */ + _FinalStage merchantName(Optional merchantName); + + _FinalStage merchantName(String merchantName); + + _FinalStage merchantName(Nullable merchantName); + + /** + *

When the transaction was settled by the card network.

+ */ + _FinalStage postedAt(Optional postedAt); + + _FinalStage postedAt(OffsetDateTime postedAt); + + _FinalStage postedAt(Nullable postedAt); + + /** + *

The transaction amount in USD.

+ */ + _FinalStage usdAmount(Optional usdAmount); + + _FinalStage usdAmount(Double usdAmount); + + _FinalStage usdAmount(Nullable usdAmount); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CardIdStage, + CreatedAtStage, + IdStage, + InternationalStage, + StatusStage, + TransactionTypeStage, + _FinalStage { + private String cardId; + + private OffsetDateTime createdAt; + + private String id; + + private boolean international; + + private CardIssuingTransactionStatus status; + + private String transactionType; + + private Optional usdAmount = Optional.empty(); + + private Optional postedAt = Optional.empty(); + + private Optional merchantName = Optional.empty(); + + private Optional merchantIconUrl = Optional.empty(); + + private Optional merchantCategoryCode = Optional.empty(); + + private Optional merchantCategory = Optional.empty(); + + private Optional memo = Optional.empty(); + + private Optional localAmount = Optional.empty(); + + private Optional declinedReason = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional cashbackUsdAmount = Optional.empty(); + + private Optional authorizationMethod = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CardTransactionListItem other) { + authorizationMethod(other.getAuthorizationMethod()); + cardId(other.getCardId()); + cashbackUsdAmount(other.getCashbackUsdAmount()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + declinedReason(other.getDeclinedReason()); + id(other.getId()); + international(other.getInternational()); + localAmount(other.getLocalAmount()); + memo(other.getMemo()); + merchantCategory(other.getMerchantCategory()); + merchantCategoryCode(other.getMerchantCategoryCode()); + merchantIconUrl(other.getMerchantIconUrl()); + merchantName(other.getMerchantName()); + postedAt(other.getPostedAt()); + status(other.getStatus()); + transactionType(other.getTransactionType()); + usdAmount(other.getUsdAmount()); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card_id") + public CreatedAtStage cardId(@NotNull String cardId) { + this.cardId = Objects.requireNonNull(cardId, "cardId must not be null"); + return this; + } + + /** + *

The datetime the card transaction was created.

+ *

The datetime the card transaction was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the card transaction.

+ *

The unique identifier for the card transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public InternationalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether the transaction was made with a merchant outside the card's home country.

+ *

Whether the transaction was made with a merchant outside the card's home country.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("international") + public StatusStage international(boolean international) { + this.international = international; + return this; + } + + /** + *

The current lifecycle status of the transaction.

+ *

The current lifecycle status of the transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TransactionTypeStage status(@NotNull CardIssuingTransactionStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The type of transaction.

+ *

The type of transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("transaction_type") + public _FinalStage transactionType(@NotNull String transactionType) { + this.transactionType = Objects.requireNonNull(transactionType, "transactionType must not be null"); + return this; + } + + /** + *

The transaction amount in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdAmount(Nullable usdAmount) { + if (usdAmount.isNull()) { + this.usdAmount = null; + } else if (usdAmount.isEmpty()) { + this.usdAmount = Optional.empty(); + } else { + this.usdAmount = Optional.of(usdAmount.get()); + } + return this; + } + + /** + *

The transaction amount in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdAmount(Double usdAmount) { + this.usdAmount = Optional.ofNullable(usdAmount); + return this; + } + + /** + *

The transaction amount in USD.

+ */ + @java.lang.Override + @JsonSetter(value = "usd_amount", nulls = Nulls.SKIP) + public _FinalStage usdAmount(Optional usdAmount) { + this.usdAmount = usdAmount; + return this; + } + + /** + *

When the transaction was settled by the card network.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage postedAt(Nullable postedAt) { + if (postedAt.isNull()) { + this.postedAt = null; + } else if (postedAt.isEmpty()) { + this.postedAt = Optional.empty(); + } else { + this.postedAt = Optional.of(postedAt.get()); + } + return this; + } + + /** + *

When the transaction was settled by the card network.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage postedAt(OffsetDateTime postedAt) { + this.postedAt = Optional.ofNullable(postedAt); + return this; + } + + /** + *

When the transaction was settled by the card network.

+ */ + @java.lang.Override + @JsonSetter(value = "posted_at", nulls = Nulls.SKIP) + public _FinalStage postedAt(Optional postedAt) { + this.postedAt = postedAt; + return this; + } + + /** + *

The enriched or raw name of the merchant where the purchase was made.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantName(Nullable merchantName) { + if (merchantName.isNull()) { + this.merchantName = null; + } else if (merchantName.isEmpty()) { + this.merchantName = Optional.empty(); + } else { + this.merchantName = Optional.of(merchantName.get()); + } + return this; + } + + /** + *

The enriched or raw name of the merchant where the purchase was made.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantName(String merchantName) { + this.merchantName = Optional.ofNullable(merchantName); + return this; + } + + /** + *

The enriched or raw name of the merchant where the purchase was made.

+ */ + @java.lang.Override + @JsonSetter(value = "merchant_name", nulls = Nulls.SKIP) + public _FinalStage merchantName(Optional merchantName) { + this.merchantName = merchantName; + return this; + } + + /** + *

A URL to the enriched merchant logo image.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantIconUrl(Nullable merchantIconUrl) { + if (merchantIconUrl.isNull()) { + this.merchantIconUrl = null; + } else if (merchantIconUrl.isEmpty()) { + this.merchantIconUrl = Optional.empty(); + } else { + this.merchantIconUrl = Optional.of(merchantIconUrl.get()); + } + return this; + } + + /** + *

A URL to the enriched merchant logo image.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantIconUrl(String merchantIconUrl) { + this.merchantIconUrl = Optional.ofNullable(merchantIconUrl); + return this; + } + + /** + *

A URL to the enriched merchant logo image.

+ */ + @java.lang.Override + @JsonSetter(value = "merchant_icon_url", nulls = Nulls.SKIP) + public _FinalStage merchantIconUrl(Optional merchantIconUrl) { + this.merchantIconUrl = merchantIconUrl; + return this; + } + + /** + *

The four-digit ISO 18245 merchant category code (MCC).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantCategoryCode(Nullable merchantCategoryCode) { + if (merchantCategoryCode.isNull()) { + this.merchantCategoryCode = null; + } else if (merchantCategoryCode.isEmpty()) { + this.merchantCategoryCode = Optional.empty(); + } else { + this.merchantCategoryCode = Optional.of(merchantCategoryCode.get()); + } + return this; + } + + /** + *

The four-digit ISO 18245 merchant category code (MCC).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantCategoryCode(String merchantCategoryCode) { + this.merchantCategoryCode = Optional.ofNullable(merchantCategoryCode); + return this; + } + + /** + *

The four-digit ISO 18245 merchant category code (MCC).

+ */ + @java.lang.Override + @JsonSetter(value = "merchant_category_code", nulls = Nulls.SKIP) + public _FinalStage merchantCategoryCode(Optional merchantCategoryCode) { + this.merchantCategoryCode = merchantCategoryCode; + return this; + } + + /** + *

The enriched or raw category label for the merchant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantCategory(Nullable merchantCategory) { + if (merchantCategory.isNull()) { + this.merchantCategory = null; + } else if (merchantCategory.isEmpty()) { + this.merchantCategory = Optional.empty(); + } else { + this.merchantCategory = Optional.of(merchantCategory.get()); + } + return this; + } + + /** + *

The enriched or raw category label for the merchant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantCategory(String merchantCategory) { + this.merchantCategory = Optional.ofNullable(merchantCategory); + return this; + } + + /** + *

The enriched or raw category label for the merchant.

+ */ + @java.lang.Override + @JsonSetter(value = "merchant_category", nulls = Nulls.SKIP) + public _FinalStage merchantCategory(Optional merchantCategory) { + this.merchantCategory = merchantCategory; + return this; + } + + /** + *

A user-provided note attached to the transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memo(Nullable memo) { + if (memo.isNull()) { + this.memo = null; + } else if (memo.isEmpty()) { + this.memo = Optional.empty(); + } else { + this.memo = Optional.of(memo.get()); + } + return this; + } + + /** + *

A user-provided note attached to the transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memo(String memo) { + this.memo = Optional.ofNullable(memo); + return this; + } + + /** + *

A user-provided note attached to the transaction.

+ */ + @java.lang.Override + @JsonSetter(value = "memo", nulls = Nulls.SKIP) + public _FinalStage memo(Optional memo) { + this.memo = memo; + return this; + } + + /** + *

The transaction amount in the merchant's local currency before conversion.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage localAmount(Nullable localAmount) { + if (localAmount.isNull()) { + this.localAmount = null; + } else if (localAmount.isEmpty()) { + this.localAmount = Optional.empty(); + } else { + this.localAmount = Optional.of(localAmount.get()); + } + return this; + } + + /** + *

The transaction amount in the merchant's local currency before conversion.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage localAmount(Double localAmount) { + this.localAmount = Optional.ofNullable(localAmount); + return this; + } + + /** + *

The transaction amount in the merchant's local currency before conversion.

+ */ + @java.lang.Override + @JsonSetter(value = "local_amount", nulls = Nulls.SKIP) + public _FinalStage localAmount(Optional localAmount) { + this.localAmount = localAmount; + return this; + } + + /** + *

The issuer-provided reason the transaction was declined.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage declinedReason(Nullable declinedReason) { + if (declinedReason.isNull()) { + this.declinedReason = null; + } else if (declinedReason.isEmpty()) { + this.declinedReason = Optional.empty(); + } else { + this.declinedReason = Optional.of(declinedReason.get()); + } + return this; + } + + /** + *

The issuer-provided reason the transaction was declined.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage declinedReason(String declinedReason) { + this.declinedReason = Optional.ofNullable(declinedReason); + return this; + } + + /** + *

The issuer-provided reason the transaction was declined.

+ */ + @java.lang.Override + @JsonSetter(value = "declined_reason", nulls = Nulls.SKIP) + public _FinalStage declinedReason(Optional declinedReason) { + this.declinedReason = declinedReason; + return this; + } + + /** + *

The ISO 4217 currency code for the transaction amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

The ISO 4217 currency code for the transaction amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

The ISO 4217 currency code for the transaction amount.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + /** + *

The cashback reward amount earned on this transaction, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cashbackUsdAmount(Nullable cashbackUsdAmount) { + if (cashbackUsdAmount.isNull()) { + this.cashbackUsdAmount = null; + } else if (cashbackUsdAmount.isEmpty()) { + this.cashbackUsdAmount = Optional.empty(); + } else { + this.cashbackUsdAmount = Optional.of(cashbackUsdAmount.get()); + } + return this; + } + + /** + *

The cashback reward amount earned on this transaction, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cashbackUsdAmount(Double cashbackUsdAmount) { + this.cashbackUsdAmount = Optional.ofNullable(cashbackUsdAmount); + return this; + } + + /** + *

The cashback reward amount earned on this transaction, in USD.

+ */ + @java.lang.Override + @JsonSetter(value = "cashback_usd_amount", nulls = Nulls.SKIP) + public _FinalStage cashbackUsdAmount(Optional cashbackUsdAmount) { + this.cashbackUsdAmount = cashbackUsdAmount; + return this; + } + + /** + *

How the card was presented or authenticated for the purchase.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage authorizationMethod(Nullable authorizationMethod) { + if (authorizationMethod.isNull()) { + this.authorizationMethod = null; + } else if (authorizationMethod.isEmpty()) { + this.authorizationMethod = Optional.empty(); + } else { + this.authorizationMethod = Optional.of(authorizationMethod.get()); + } + return this; + } + + /** + *

How the card was presented or authenticated for the purchase.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage authorizationMethod(String authorizationMethod) { + this.authorizationMethod = Optional.ofNullable(authorizationMethod); + return this; + } + + /** + *

How the card was presented or authenticated for the purchase.

+ */ + @java.lang.Override + @JsonSetter(value = "authorization_method", nulls = Nulls.SKIP) + public _FinalStage authorizationMethod(Optional authorizationMethod) { + this.authorizationMethod = authorizationMethod; + return this; + } + + @java.lang.Override + public CardTransactionListItem build() { + return new CardTransactionListItem( + authorizationMethod, + cardId, + cashbackUsdAmount, + createdAt, + currency, + declinedReason, + id, + international, + localAmount, + memo, + merchantCategory, + merchantCategoryCode, + merchantIconUrl, + merchantName, + postedAt, + status, + transactionType, + usdAmount, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CardTransactionStatus.java b/src/main/java/com/whop/api/types/CardTransactionStatus.java new file mode 100644 index 00000000..342bea44 --- /dev/null +++ b/src/main/java/com/whop/api/types/CardTransactionStatus.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CardTransactionStatus { + public static final CardTransactionStatus DECLINED = new CardTransactionStatus(Value.DECLINED, "declined"); + + public static final CardTransactionStatus PENDING = new CardTransactionStatus(Value.PENDING, "pending"); + + public static final CardTransactionStatus COMPLETED = new CardTransactionStatus(Value.COMPLETED, "completed"); + + public static final CardTransactionStatus REVERSED = new CardTransactionStatus(Value.REVERSED, "reversed"); + + private final Value value; + + private final String string; + + CardTransactionStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CardTransactionStatus + && this.string.equals(((CardTransactionStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DECLINED: + return visitor.visitDeclined(); + case PENDING: + return visitor.visitPending(); + case COMPLETED: + return visitor.visitCompleted(); + case REVERSED: + return visitor.visitReversed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CardTransactionStatus valueOf(String value) { + switch (value) { + case "declined": + return DECLINED; + case "pending": + return PENDING; + case "completed": + return COMPLETED; + case "reversed": + return REVERSED; + default: + return new CardTransactionStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + COMPLETED, + + REVERSED, + + DECLINED, + + UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitCompleted(); + + T visitReversed(); + + T visitDeclined(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CardTransactionTransactionType.java b/src/main/java/com/whop/api/types/CardTransactionTransactionType.java new file mode 100644 index 00000000..230b2bde --- /dev/null +++ b/src/main/java/com/whop/api/types/CardTransactionTransactionType.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CardTransactionTransactionType { + public static final CardTransactionTransactionType SPEND = new CardTransactionTransactionType(Value.SPEND, "spend"); + + private final Value value; + + private final String string; + + CardTransactionTransactionType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CardTransactionTransactionType + && this.string.equals(((CardTransactionTransactionType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SPEND: + return visitor.visitSpend(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CardTransactionTransactionType valueOf(String value) { + switch (value) { + case "spend": + return SPEND; + default: + return new CardTransactionTransactionType(Value.UNKNOWN, value); + } + } + + public enum Value { + SPEND, + + UNKNOWN + } + + public interface Visitor { + T visitSpend(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ChatChannel.java b/src/main/java/com/whop/api/types/ChatChannel.java new file mode 100644 index 00000000..782e2928 --- /dev/null +++ b/src/main/java/com/whop/api/types/ChatChannel.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ChatChannel.Builder.class) +public final class ChatChannel { + private final boolean banMedia; + + private final boolean banUrls; + + private final List bannedWords; + + private final ChatChannelExperience experience; + + private final String id; + + private final Optional userPostsCooldownSeconds; + + private final WhoCanPostTypes whoCanPost; + + private final WhoCanReactTypes whoCanReact; + + private final Map additionalProperties; + + private ChatChannel( + boolean banMedia, + boolean banUrls, + List bannedWords, + ChatChannelExperience experience, + String id, + Optional userPostsCooldownSeconds, + WhoCanPostTypes whoCanPost, + WhoCanReactTypes whoCanReact, + Map additionalProperties) { + this.banMedia = banMedia; + this.banUrls = banUrls; + this.bannedWords = bannedWords; + this.experience = experience; + this.id = id; + this.userPostsCooldownSeconds = userPostsCooldownSeconds; + this.whoCanPost = whoCanPost; + this.whoCanReact = whoCanReact; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether media uploads such as images and videos are blocked in this chat. + */ + @JsonProperty("ban_media") + public boolean getBanMedia() { + return banMedia; + } + + /** + * @return Whether URL links are blocked from being posted in this chat. + */ + @JsonProperty("ban_urls") + public boolean getBanUrls() { + return banUrls; + } + + /** + * @return A list of words that are automatically filtered from messages in this chat. + */ + @JsonProperty("banned_words") + public List getBannedWords() { + return bannedWords; + } + + /** + * @return The experience this chat feed is attached to. + */ + @JsonProperty("experience") + public ChatChannelExperience getExperience() { + return experience; + } + + /** + * @return The unique identifier for the entity + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The minimum number of seconds a user must wait between consecutive messages. Null if no cooldown is enforced. + */ + @JsonIgnore + public Optional getUserPostsCooldownSeconds() { + if (userPostsCooldownSeconds == null) { + return Optional.empty(); + } + return userPostsCooldownSeconds; + } + + /** + * @return The permission level controlling which users can send messages in this chat. + */ + @JsonProperty("who_can_post") + public WhoCanPostTypes getWhoCanPost() { + return whoCanPost; + } + + /** + * @return The permission level controlling which users can add reactions in this chat. + */ + @JsonProperty("who_can_react") + public WhoCanReactTypes getWhoCanReact() { + return whoCanReact; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_posts_cooldown_seconds") + private Optional _getUserPostsCooldownSeconds() { + return userPostsCooldownSeconds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ChatChannel && equalTo((ChatChannel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ChatChannel other) { + return banMedia == other.banMedia + && banUrls == other.banUrls + && bannedWords.equals(other.bannedWords) + && experience.equals(other.experience) + && id.equals(other.id) + && userPostsCooldownSeconds.equals(other.userPostsCooldownSeconds) + && whoCanPost.equals(other.whoCanPost) + && whoCanReact.equals(other.whoCanReact); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.banMedia, + this.banUrls, + this.bannedWords, + this.experience, + this.id, + this.userPostsCooldownSeconds, + this.whoCanPost, + this.whoCanReact); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BanMediaStage builder() { + return new Builder(); + } + + public interface BanMediaStage { + /** + *

Whether media uploads such as images and videos are blocked in this chat.

+ */ + BanUrlsStage banMedia(boolean banMedia); + + Builder from(ChatChannel other); + } + + public interface BanUrlsStage { + /** + *

Whether URL links are blocked from being posted in this chat.

+ */ + ExperienceStage banUrls(boolean banUrls); + } + + public interface ExperienceStage { + /** + *

The experience this chat feed is attached to.

+ */ + IdStage experience(@NotNull ChatChannelExperience experience); + } + + public interface IdStage { + /** + *

The unique identifier for the entity

+ */ + WhoCanPostStage id(@NotNull String id); + } + + public interface WhoCanPostStage { + /** + *

The permission level controlling which users can send messages in this chat.

+ */ + WhoCanReactStage whoCanPost(@NotNull WhoCanPostTypes whoCanPost); + } + + public interface WhoCanReactStage { + /** + *

The permission level controlling which users can add reactions in this chat.

+ */ + _FinalStage whoCanReact(@NotNull WhoCanReactTypes whoCanReact); + } + + public interface _FinalStage { + ChatChannel build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of words that are automatically filtered from messages in this chat.

+ */ + _FinalStage bannedWords(List bannedWords); + + _FinalStage addBannedWords(String bannedWords); + + _FinalStage addAllBannedWords(List bannedWords); + + /** + *

The minimum number of seconds a user must wait between consecutive messages. Null if no cooldown is enforced.

+ */ + _FinalStage userPostsCooldownSeconds(Optional userPostsCooldownSeconds); + + _FinalStage userPostsCooldownSeconds(Integer userPostsCooldownSeconds); + + _FinalStage userPostsCooldownSeconds(Nullable userPostsCooldownSeconds); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BanMediaStage, + BanUrlsStage, + ExperienceStage, + IdStage, + WhoCanPostStage, + WhoCanReactStage, + _FinalStage { + private boolean banMedia; + + private boolean banUrls; + + private ChatChannelExperience experience; + + private String id; + + private WhoCanPostTypes whoCanPost; + + private WhoCanReactTypes whoCanReact; + + private Optional userPostsCooldownSeconds = Optional.empty(); + + private List bannedWords = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ChatChannel other) { + banMedia(other.getBanMedia()); + banUrls(other.getBanUrls()); + bannedWords(other.getBannedWords()); + experience(other.getExperience()); + id(other.getId()); + userPostsCooldownSeconds(other.getUserPostsCooldownSeconds()); + whoCanPost(other.getWhoCanPost()); + whoCanReact(other.getWhoCanReact()); + return this; + } + + /** + *

Whether media uploads such as images and videos are blocked in this chat.

+ *

Whether media uploads such as images and videos are blocked in this chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ban_media") + public BanUrlsStage banMedia(boolean banMedia) { + this.banMedia = banMedia; + return this; + } + + /** + *

Whether URL links are blocked from being posted in this chat.

+ *

Whether URL links are blocked from being posted in this chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ban_urls") + public ExperienceStage banUrls(boolean banUrls) { + this.banUrls = banUrls; + return this; + } + + /** + *

The experience this chat feed is attached to.

+ *

The experience this chat feed is attached to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("experience") + public IdStage experience(@NotNull ChatChannelExperience experience) { + this.experience = Objects.requireNonNull(experience, "experience must not be null"); + return this; + } + + /** + *

The unique identifier for the entity

+ *

The unique identifier for the entity

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public WhoCanPostStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The permission level controlling which users can send messages in this chat.

+ *

The permission level controlling which users can send messages in this chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("who_can_post") + public WhoCanReactStage whoCanPost(@NotNull WhoCanPostTypes whoCanPost) { + this.whoCanPost = Objects.requireNonNull(whoCanPost, "whoCanPost must not be null"); + return this; + } + + /** + *

The permission level controlling which users can add reactions in this chat.

+ *

The permission level controlling which users can add reactions in this chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("who_can_react") + public _FinalStage whoCanReact(@NotNull WhoCanReactTypes whoCanReact) { + this.whoCanReact = Objects.requireNonNull(whoCanReact, "whoCanReact must not be null"); + return this; + } + + /** + *

The minimum number of seconds a user must wait between consecutive messages. Null if no cooldown is enforced.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userPostsCooldownSeconds(Nullable userPostsCooldownSeconds) { + if (userPostsCooldownSeconds.isNull()) { + this.userPostsCooldownSeconds = null; + } else if (userPostsCooldownSeconds.isEmpty()) { + this.userPostsCooldownSeconds = Optional.empty(); + } else { + this.userPostsCooldownSeconds = Optional.of(userPostsCooldownSeconds.get()); + } + return this; + } + + /** + *

The minimum number of seconds a user must wait between consecutive messages. Null if no cooldown is enforced.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userPostsCooldownSeconds(Integer userPostsCooldownSeconds) { + this.userPostsCooldownSeconds = Optional.ofNullable(userPostsCooldownSeconds); + return this; + } + + /** + *

The minimum number of seconds a user must wait between consecutive messages. Null if no cooldown is enforced.

+ */ + @java.lang.Override + @JsonSetter(value = "user_posts_cooldown_seconds", nulls = Nulls.SKIP) + public _FinalStage userPostsCooldownSeconds(Optional userPostsCooldownSeconds) { + this.userPostsCooldownSeconds = userPostsCooldownSeconds; + return this; + } + + /** + *

A list of words that are automatically filtered from messages in this chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllBannedWords(List bannedWords) { + if (bannedWords != null) { + this.bannedWords.addAll(bannedWords); + } + return this; + } + + /** + *

A list of words that are automatically filtered from messages in this chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addBannedWords(String bannedWords) { + this.bannedWords.add(bannedWords); + return this; + } + + /** + *

A list of words that are automatically filtered from messages in this chat.

+ */ + @java.lang.Override + @JsonSetter(value = "banned_words", nulls = Nulls.SKIP) + public _FinalStage bannedWords(List bannedWords) { + this.bannedWords.clear(); + if (bannedWords != null) { + this.bannedWords.addAll(bannedWords); + } + return this; + } + + @java.lang.Override + public ChatChannel build() { + return new ChatChannel( + banMedia, + banUrls, + bannedWords, + experience, + id, + userPostsCooldownSeconds, + whoCanPost, + whoCanReact, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ChatChannelExperience.java b/src/main/java/com/whop/api/types/ChatChannelExperience.java new file mode 100644 index 00000000..6472c65b --- /dev/null +++ b/src/main/java/com/whop/api/types/ChatChannelExperience.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ChatChannelExperience.Builder.class) +public final class ChatChannelExperience { + private final String id; + + private final String name; + + private final Map additionalProperties; + + private ChatChannelExperience(String id, String name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the experience. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of this experience shown to users in the product navigation. Maximum 255 characters. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ChatChannelExperience && equalTo((ChatChannelExperience) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ChatChannelExperience other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the experience.

+ */ + NameStage id(@NotNull String id); + + Builder from(ChatChannelExperience other); + } + + public interface NameStage { + /** + *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + ChatChannelExperience build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ChatChannelExperience other) { + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

The unique identifier for the experience.

+ *

The unique identifier for the experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public ChatChannelExperience build() { + return new ChatChannelExperience(id, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ChatChannelListItem.java b/src/main/java/com/whop/api/types/ChatChannelListItem.java new file mode 100644 index 00000000..60cdac61 --- /dev/null +++ b/src/main/java/com/whop/api/types/ChatChannelListItem.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ChatChannelListItem.Builder.class) +public final class ChatChannelListItem { + private final boolean banMedia; + + private final boolean banUrls; + + private final List bannedWords; + + private final ChatChannelListItemExperience experience; + + private final String id; + + private final Optional userPostsCooldownSeconds; + + private final WhoCanPostTypes whoCanPost; + + private final WhoCanReactTypes whoCanReact; + + private final Map additionalProperties; + + private ChatChannelListItem( + boolean banMedia, + boolean banUrls, + List bannedWords, + ChatChannelListItemExperience experience, + String id, + Optional userPostsCooldownSeconds, + WhoCanPostTypes whoCanPost, + WhoCanReactTypes whoCanReact, + Map additionalProperties) { + this.banMedia = banMedia; + this.banUrls = banUrls; + this.bannedWords = bannedWords; + this.experience = experience; + this.id = id; + this.userPostsCooldownSeconds = userPostsCooldownSeconds; + this.whoCanPost = whoCanPost; + this.whoCanReact = whoCanReact; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether media uploads such as images and videos are blocked in this chat. + */ + @JsonProperty("ban_media") + public boolean getBanMedia() { + return banMedia; + } + + /** + * @return Whether URL links are blocked from being posted in this chat. + */ + @JsonProperty("ban_urls") + public boolean getBanUrls() { + return banUrls; + } + + /** + * @return A list of words that are automatically filtered from messages in this chat. + */ + @JsonProperty("banned_words") + public List getBannedWords() { + return bannedWords; + } + + /** + * @return The experience this chat feed is attached to. + */ + @JsonProperty("experience") + public ChatChannelListItemExperience getExperience() { + return experience; + } + + /** + * @return The unique identifier for the entity + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The minimum number of seconds a user must wait between consecutive messages. Null if no cooldown is enforced. + */ + @JsonIgnore + public Optional getUserPostsCooldownSeconds() { + if (userPostsCooldownSeconds == null) { + return Optional.empty(); + } + return userPostsCooldownSeconds; + } + + /** + * @return The permission level controlling which users can send messages in this chat. + */ + @JsonProperty("who_can_post") + public WhoCanPostTypes getWhoCanPost() { + return whoCanPost; + } + + /** + * @return The permission level controlling which users can add reactions in this chat. + */ + @JsonProperty("who_can_react") + public WhoCanReactTypes getWhoCanReact() { + return whoCanReact; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_posts_cooldown_seconds") + private Optional _getUserPostsCooldownSeconds() { + return userPostsCooldownSeconds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ChatChannelListItem && equalTo((ChatChannelListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ChatChannelListItem other) { + return banMedia == other.banMedia + && banUrls == other.banUrls + && bannedWords.equals(other.bannedWords) + && experience.equals(other.experience) + && id.equals(other.id) + && userPostsCooldownSeconds.equals(other.userPostsCooldownSeconds) + && whoCanPost.equals(other.whoCanPost) + && whoCanReact.equals(other.whoCanReact); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.banMedia, + this.banUrls, + this.bannedWords, + this.experience, + this.id, + this.userPostsCooldownSeconds, + this.whoCanPost, + this.whoCanReact); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BanMediaStage builder() { + return new Builder(); + } + + public interface BanMediaStage { + /** + *

Whether media uploads such as images and videos are blocked in this chat.

+ */ + BanUrlsStage banMedia(boolean banMedia); + + Builder from(ChatChannelListItem other); + } + + public interface BanUrlsStage { + /** + *

Whether URL links are blocked from being posted in this chat.

+ */ + ExperienceStage banUrls(boolean banUrls); + } + + public interface ExperienceStage { + /** + *

The experience this chat feed is attached to.

+ */ + IdStage experience(@NotNull ChatChannelListItemExperience experience); + } + + public interface IdStage { + /** + *

The unique identifier for the entity

+ */ + WhoCanPostStage id(@NotNull String id); + } + + public interface WhoCanPostStage { + /** + *

The permission level controlling which users can send messages in this chat.

+ */ + WhoCanReactStage whoCanPost(@NotNull WhoCanPostTypes whoCanPost); + } + + public interface WhoCanReactStage { + /** + *

The permission level controlling which users can add reactions in this chat.

+ */ + _FinalStage whoCanReact(@NotNull WhoCanReactTypes whoCanReact); + } + + public interface _FinalStage { + ChatChannelListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of words that are automatically filtered from messages in this chat.

+ */ + _FinalStage bannedWords(List bannedWords); + + _FinalStage addBannedWords(String bannedWords); + + _FinalStage addAllBannedWords(List bannedWords); + + /** + *

The minimum number of seconds a user must wait between consecutive messages. Null if no cooldown is enforced.

+ */ + _FinalStage userPostsCooldownSeconds(Optional userPostsCooldownSeconds); + + _FinalStage userPostsCooldownSeconds(Integer userPostsCooldownSeconds); + + _FinalStage userPostsCooldownSeconds(Nullable userPostsCooldownSeconds); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BanMediaStage, + BanUrlsStage, + ExperienceStage, + IdStage, + WhoCanPostStage, + WhoCanReactStage, + _FinalStage { + private boolean banMedia; + + private boolean banUrls; + + private ChatChannelListItemExperience experience; + + private String id; + + private WhoCanPostTypes whoCanPost; + + private WhoCanReactTypes whoCanReact; + + private Optional userPostsCooldownSeconds = Optional.empty(); + + private List bannedWords = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ChatChannelListItem other) { + banMedia(other.getBanMedia()); + banUrls(other.getBanUrls()); + bannedWords(other.getBannedWords()); + experience(other.getExperience()); + id(other.getId()); + userPostsCooldownSeconds(other.getUserPostsCooldownSeconds()); + whoCanPost(other.getWhoCanPost()); + whoCanReact(other.getWhoCanReact()); + return this; + } + + /** + *

Whether media uploads such as images and videos are blocked in this chat.

+ *

Whether media uploads such as images and videos are blocked in this chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ban_media") + public BanUrlsStage banMedia(boolean banMedia) { + this.banMedia = banMedia; + return this; + } + + /** + *

Whether URL links are blocked from being posted in this chat.

+ *

Whether URL links are blocked from being posted in this chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ban_urls") + public ExperienceStage banUrls(boolean banUrls) { + this.banUrls = banUrls; + return this; + } + + /** + *

The experience this chat feed is attached to.

+ *

The experience this chat feed is attached to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("experience") + public IdStage experience(@NotNull ChatChannelListItemExperience experience) { + this.experience = Objects.requireNonNull(experience, "experience must not be null"); + return this; + } + + /** + *

The unique identifier for the entity

+ *

The unique identifier for the entity

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public WhoCanPostStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The permission level controlling which users can send messages in this chat.

+ *

The permission level controlling which users can send messages in this chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("who_can_post") + public WhoCanReactStage whoCanPost(@NotNull WhoCanPostTypes whoCanPost) { + this.whoCanPost = Objects.requireNonNull(whoCanPost, "whoCanPost must not be null"); + return this; + } + + /** + *

The permission level controlling which users can add reactions in this chat.

+ *

The permission level controlling which users can add reactions in this chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("who_can_react") + public _FinalStage whoCanReact(@NotNull WhoCanReactTypes whoCanReact) { + this.whoCanReact = Objects.requireNonNull(whoCanReact, "whoCanReact must not be null"); + return this; + } + + /** + *

The minimum number of seconds a user must wait between consecutive messages. Null if no cooldown is enforced.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userPostsCooldownSeconds(Nullable userPostsCooldownSeconds) { + if (userPostsCooldownSeconds.isNull()) { + this.userPostsCooldownSeconds = null; + } else if (userPostsCooldownSeconds.isEmpty()) { + this.userPostsCooldownSeconds = Optional.empty(); + } else { + this.userPostsCooldownSeconds = Optional.of(userPostsCooldownSeconds.get()); + } + return this; + } + + /** + *

The minimum number of seconds a user must wait between consecutive messages. Null if no cooldown is enforced.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userPostsCooldownSeconds(Integer userPostsCooldownSeconds) { + this.userPostsCooldownSeconds = Optional.ofNullable(userPostsCooldownSeconds); + return this; + } + + /** + *

The minimum number of seconds a user must wait between consecutive messages. Null if no cooldown is enforced.

+ */ + @java.lang.Override + @JsonSetter(value = "user_posts_cooldown_seconds", nulls = Nulls.SKIP) + public _FinalStage userPostsCooldownSeconds(Optional userPostsCooldownSeconds) { + this.userPostsCooldownSeconds = userPostsCooldownSeconds; + return this; + } + + /** + *

A list of words that are automatically filtered from messages in this chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllBannedWords(List bannedWords) { + if (bannedWords != null) { + this.bannedWords.addAll(bannedWords); + } + return this; + } + + /** + *

A list of words that are automatically filtered from messages in this chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addBannedWords(String bannedWords) { + this.bannedWords.add(bannedWords); + return this; + } + + /** + *

A list of words that are automatically filtered from messages in this chat.

+ */ + @java.lang.Override + @JsonSetter(value = "banned_words", nulls = Nulls.SKIP) + public _FinalStage bannedWords(List bannedWords) { + this.bannedWords.clear(); + if (bannedWords != null) { + this.bannedWords.addAll(bannedWords); + } + return this; + } + + @java.lang.Override + public ChatChannelListItem build() { + return new ChatChannelListItem( + banMedia, + banUrls, + bannedWords, + experience, + id, + userPostsCooldownSeconds, + whoCanPost, + whoCanReact, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ChatChannelListItemExperience.java b/src/main/java/com/whop/api/types/ChatChannelListItemExperience.java new file mode 100644 index 00000000..934932d1 --- /dev/null +++ b/src/main/java/com/whop/api/types/ChatChannelListItemExperience.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ChatChannelListItemExperience.Builder.class) +public final class ChatChannelListItemExperience { + private final String id; + + private final String name; + + private final Map additionalProperties; + + private ChatChannelListItemExperience(String id, String name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the experience. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of this experience shown to users in the product navigation. Maximum 255 characters. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ChatChannelListItemExperience && equalTo((ChatChannelListItemExperience) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ChatChannelListItemExperience other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the experience.

+ */ + NameStage id(@NotNull String id); + + Builder from(ChatChannelListItemExperience other); + } + + public interface NameStage { + /** + *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + ChatChannelListItemExperience build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ChatChannelListItemExperience other) { + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

The unique identifier for the experience.

+ *

The unique identifier for the experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public ChatChannelListItemExperience build() { + return new ChatChannelListItemExperience(id, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutConfiguration.java b/src/main/java/com/whop/api/types/CheckoutConfiguration.java new file mode 100644 index 00000000..99c771fa --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutConfiguration.java @@ -0,0 +1,932 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CheckoutConfiguration.Builder.class) +public final class CheckoutConfiguration { + private final String accountId; + + private final Optional affiliateCode; + + private final String createdAt; + + private final Optional currency; + + private final Optional effectivePaymentMethodConfiguration; + + private final String id; + + private final Optional> metadata; + + private final CheckoutConfigurationMode mode; + + private final Optional> paymentMethodConfiguration; + + private final Optional plan; + + private final Optional purchaseUrl; + + private final Optional redirectUrl; + + private final Optional threeDsLevel; + + private final String updatedAt; + + private final Map additionalProperties; + + private CheckoutConfiguration( + String accountId, + Optional affiliateCode, + String createdAt, + Optional currency, + Optional effectivePaymentMethodConfiguration, + String id, + Optional> metadata, + CheckoutConfigurationMode mode, + Optional> paymentMethodConfiguration, + Optional plan, + Optional purchaseUrl, + Optional redirectUrl, + Optional threeDsLevel, + String updatedAt, + Map additionalProperties) { + this.accountId = accountId; + this.affiliateCode = affiliateCode; + this.createdAt = createdAt; + this.currency = currency; + this.effectivePaymentMethodConfiguration = effectivePaymentMethodConfiguration; + this.id = id; + this.metadata = metadata; + this.mode = mode; + this.paymentMethodConfiguration = paymentMethodConfiguration; + this.plan = plan; + this.purchaseUrl = purchaseUrl; + this.redirectUrl = redirectUrl; + this.threeDsLevel = threeDsLevel; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Affiliate code applied at checkout, or null when none is set. + */ + @JsonIgnore + public Optional getAffiliateCode() { + if (affiliateCode == null) { + return Optional.empty(); + } + return affiliateCode; + } + + /** + * @return When the checkout configuration was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Currency used for setup-mode payment method availability; defaults to usd when omitted. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override. + */ + @JsonIgnore + public Optional getEffectivePaymentMethodConfiguration() { + if (effectivePaymentMethodConfiguration == null) { + return Optional.empty(); + } + return effectivePaymentMethodConfiguration; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Controls whether checkout charges the buyer immediately or saves payment details for later. + */ + @JsonProperty("mode") + public CheckoutConfigurationMode getMode() { + return mode; + } + + /** + * @return Payment method overrides for this checkout. null when it uses the plan or platform defaults. + */ + @JsonIgnore + public Optional> getPaymentMethodConfiguration() { + if (paymentMethodConfiguration == null) { + return Optional.empty(); + } + return paymentMethodConfiguration; + } + + /** + * @return Plan used for payment checkout. null in setup mode. + */ + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + /** + * @return Checkout URL you can send to customers. + */ + @JsonIgnore + public Optional getPurchaseUrl() { + if (purchaseUrl == null) { + return Optional.empty(); + } + return purchaseUrl; + } + + /** + * @return URL customers are sent to after checkout, or null when no redirect is configured. + */ + @JsonIgnore + public Optional getRedirectUrl() { + if (redirectUrl == null) { + return Optional.empty(); + } + return redirectUrl; + } + + /** + * @return 3D Secure behavior for this checkout, or null to use the account default. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return When the checkout configuration was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("affiliate_code") + private Optional _getAffiliateCode() { + return affiliateCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("effective_payment_method_configuration") + private Optional _getEffectivePaymentMethodConfiguration() { + return effectivePaymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_configuration") + private Optional> _getPaymentMethodConfiguration() { + return paymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("purchase_url") + private Optional _getPurchaseUrl() { + return purchaseUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("redirect_url") + private Optional _getRedirectUrl() { + return redirectUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckoutConfiguration && equalTo((CheckoutConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CheckoutConfiguration other) { + return accountId.equals(other.accountId) + && affiliateCode.equals(other.affiliateCode) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && effectivePaymentMethodConfiguration.equals(other.effectivePaymentMethodConfiguration) + && id.equals(other.id) + && metadata.equals(other.metadata) + && mode.equals(other.mode) + && paymentMethodConfiguration.equals(other.paymentMethodConfiguration) + && plan.equals(other.plan) + && purchaseUrl.equals(other.purchaseUrl) + && redirectUrl.equals(other.redirectUrl) + && threeDsLevel.equals(other.threeDsLevel) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.affiliateCode, + this.createdAt, + this.currency, + this.effectivePaymentMethodConfiguration, + this.id, + this.metadata, + this.mode, + this.paymentMethodConfiguration, + this.plan, + this.purchaseUrl, + this.redirectUrl, + this.threeDsLevel, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

Account ID, prefixed biz_.

+ */ + CreatedAtStage accountId(@NotNull String accountId); + + Builder from(CheckoutConfiguration other); + } + + public interface CreatedAtStage { + /** + *

When the checkout configuration was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + ModeStage id(@NotNull String id); + } + + public interface ModeStage { + /** + *

Controls whether checkout charges the buyer immediately or saves payment details for later.

+ */ + UpdatedAtStage mode(@NotNull CheckoutConfigurationMode mode); + } + + public interface UpdatedAtStage { + /** + *

When the checkout configuration was last updated, as an ISO 8601 timestamp.

+ */ + _FinalStage updatedAt(@NotNull String updatedAt); + } + + public interface _FinalStage { + CheckoutConfiguration build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ */ + _FinalStage affiliateCode(Optional affiliateCode); + + _FinalStage affiliateCode(String affiliateCode); + + _FinalStage affiliateCode(Nullable affiliateCode); + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(CheckoutConfigurationCurrency currency); + + _FinalStage currency(Nullable currency); + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ */ + _FinalStage effectivePaymentMethodConfiguration( + Optional effectivePaymentMethodConfiguration); + + _FinalStage effectivePaymentMethodConfiguration( + CheckoutSessionPaymentMethodConfiguration effectivePaymentMethodConfiguration); + + _FinalStage effectivePaymentMethodConfiguration( + Nullable effectivePaymentMethodConfiguration); + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ */ + _FinalStage paymentMethodConfiguration(Optional> paymentMethodConfiguration); + + _FinalStage paymentMethodConfiguration(Map paymentMethodConfiguration); + + _FinalStage paymentMethodConfiguration(Nullable> paymentMethodConfiguration); + + /** + *

Plan used for payment checkout. null in setup mode.

+ */ + _FinalStage plan(Optional plan); + + _FinalStage plan(CheckoutConfigurationPlan plan); + + _FinalStage plan(Nullable plan); + + /** + *

Checkout URL you can send to customers.

+ */ + _FinalStage purchaseUrl(Optional purchaseUrl); + + _FinalStage purchaseUrl(String purchaseUrl); + + _FinalStage purchaseUrl(Nullable purchaseUrl); + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ */ + _FinalStage redirectUrl(Optional redirectUrl); + + _FinalStage redirectUrl(String redirectUrl); + + _FinalStage redirectUrl(Nullable redirectUrl); + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ */ + _FinalStage threeDsLevel(Optional threeDsLevel); + + _FinalStage threeDsLevel(CheckoutConfigurationThreeDsLevel threeDsLevel); + + _FinalStage threeDsLevel(Nullable threeDsLevel); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, CreatedAtStage, IdStage, ModeStage, UpdatedAtStage, _FinalStage { + private String accountId; + + private String createdAt; + + private String id; + + private CheckoutConfigurationMode mode; + + private String updatedAt; + + private Optional threeDsLevel = Optional.empty(); + + private Optional redirectUrl = Optional.empty(); + + private Optional purchaseUrl = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional> paymentMethodConfiguration = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional effectivePaymentMethodConfiguration = + Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional affiliateCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CheckoutConfiguration other) { + accountId(other.getAccountId()); + affiliateCode(other.getAffiliateCode()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + effectivePaymentMethodConfiguration(other.getEffectivePaymentMethodConfiguration()); + id(other.getId()); + metadata(other.getMetadata()); + mode(other.getMode()); + paymentMethodConfiguration(other.getPaymentMethodConfiguration()); + plan(other.getPlan()); + purchaseUrl(other.getPurchaseUrl()); + redirectUrl(other.getRedirectUrl()); + threeDsLevel(other.getThreeDsLevel()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ *

Account ID, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public CreatedAtStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

When the checkout configuration was created, as an ISO 8601 timestamp.

+ *

When the checkout configuration was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public ModeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Controls whether checkout charges the buyer immediately or saves payment details for later.

+ *

Controls whether checkout charges the buyer immediately or saves payment details for later.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("mode") + public UpdatedAtStage mode(@NotNull CheckoutConfigurationMode mode) { + this.mode = Objects.requireNonNull(mode, "mode must not be null"); + return this; + } + + /** + *

When the checkout configuration was last updated, as an ISO 8601 timestamp.

+ *

When the checkout configuration was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(CheckoutConfigurationThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + /** + *

3D Secure behavior for this checkout, or null to use the account default.

+ */ + @java.lang.Override + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public _FinalStage threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectUrl(Nullable redirectUrl) { + if (redirectUrl.isNull()) { + this.redirectUrl = null; + } else if (redirectUrl.isEmpty()) { + this.redirectUrl = Optional.empty(); + } else { + this.redirectUrl = Optional.of(redirectUrl.get()); + } + return this; + } + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectUrl(String redirectUrl) { + this.redirectUrl = Optional.ofNullable(redirectUrl); + return this; + } + + /** + *

URL customers are sent to after checkout, or null when no redirect is configured.

+ */ + @java.lang.Override + @JsonSetter(value = "redirect_url", nulls = Nulls.SKIP) + public _FinalStage redirectUrl(Optional redirectUrl) { + this.redirectUrl = redirectUrl; + return this; + } + + /** + *

Checkout URL you can send to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage purchaseUrl(Nullable purchaseUrl) { + if (purchaseUrl.isNull()) { + this.purchaseUrl = null; + } else if (purchaseUrl.isEmpty()) { + this.purchaseUrl = Optional.empty(); + } else { + this.purchaseUrl = Optional.of(purchaseUrl.get()); + } + return this; + } + + /** + *

Checkout URL you can send to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage purchaseUrl(String purchaseUrl) { + this.purchaseUrl = Optional.ofNullable(purchaseUrl); + return this; + } + + /** + *

Checkout URL you can send to customers.

+ */ + @java.lang.Override + @JsonSetter(value = "purchase_url", nulls = Nulls.SKIP) + public _FinalStage purchaseUrl(Optional purchaseUrl) { + this.purchaseUrl = purchaseUrl; + return this; + } + + /** + *

Plan used for payment checkout. null in setup mode.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + /** + *

Plan used for payment checkout. null in setup mode.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(CheckoutConfigurationPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + /** + *

Plan used for payment checkout. null in setup mode.

+ */ + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodConfiguration(Nullable> paymentMethodConfiguration) { + if (paymentMethodConfiguration.isNull()) { + this.paymentMethodConfiguration = null; + } else if (paymentMethodConfiguration.isEmpty()) { + this.paymentMethodConfiguration = Optional.empty(); + } else { + this.paymentMethodConfiguration = Optional.of(paymentMethodConfiguration.get()); + } + return this; + } + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodConfiguration(Map paymentMethodConfiguration) { + this.paymentMethodConfiguration = Optional.ofNullable(paymentMethodConfiguration); + return this; + } + + /** + *

Payment method overrides for this checkout. null when it uses the plan or platform defaults.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_configuration", nulls = Nulls.SKIP) + public _FinalStage paymentMethodConfiguration(Optional> paymentMethodConfiguration) { + this.paymentMethodConfiguration = paymentMethodConfiguration; + return this; + } + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value metadata copied to payments and memberships. null without the checkout_configuration:basic:read scope.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage effectivePaymentMethodConfiguration( + Nullable effectivePaymentMethodConfiguration) { + if (effectivePaymentMethodConfiguration.isNull()) { + this.effectivePaymentMethodConfiguration = null; + } else if (effectivePaymentMethodConfiguration.isEmpty()) { + this.effectivePaymentMethodConfiguration = Optional.empty(); + } else { + this.effectivePaymentMethodConfiguration = Optional.of(effectivePaymentMethodConfiguration.get()); + } + return this; + } + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage effectivePaymentMethodConfiguration( + CheckoutSessionPaymentMethodConfiguration effectivePaymentMethodConfiguration) { + this.effectivePaymentMethodConfiguration = Optional.ofNullable(effectivePaymentMethodConfiguration); + return this; + } + + /** + *

The configuration governing a checkout mounted from this configuration, resolved through every layer (its own overrides, the plan's, and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays this configuration's own editable override.

+ */ + @java.lang.Override + @JsonSetter(value = "effective_payment_method_configuration", nulls = Nulls.SKIP) + public _FinalStage effectivePaymentMethodConfiguration( + Optional effectivePaymentMethodConfiguration) { + this.effectivePaymentMethodConfiguration = effectivePaymentMethodConfiguration; + return this; + } + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(CheckoutConfigurationCurrency currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

Currency used for setup-mode payment method availability; defaults to usd when omitted.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage affiliateCode(Nullable affiliateCode) { + if (affiliateCode.isNull()) { + this.affiliateCode = null; + } else if (affiliateCode.isEmpty()) { + this.affiliateCode = Optional.empty(); + } else { + this.affiliateCode = Optional.of(affiliateCode.get()); + } + return this; + } + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage affiliateCode(String affiliateCode) { + this.affiliateCode = Optional.ofNullable(affiliateCode); + return this; + } + + /** + *

Affiliate code applied at checkout, or null when none is set.

+ */ + @java.lang.Override + @JsonSetter(value = "affiliate_code", nulls = Nulls.SKIP) + public _FinalStage affiliateCode(Optional affiliateCode) { + this.affiliateCode = affiliateCode; + return this; + } + + @java.lang.Override + public CheckoutConfiguration build() { + return new CheckoutConfiguration( + accountId, + affiliateCode, + createdAt, + currency, + effectivePaymentMethodConfiguration, + id, + metadata, + mode, + paymentMethodConfiguration, + plan, + purchaseUrl, + redirectUrl, + threeDsLevel, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutConfigurationCurrency.java b/src/main/java/com/whop/api/types/CheckoutConfigurationCurrency.java new file mode 100644 index 00000000..fcd2ca3a --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutConfigurationCurrency.java @@ -0,0 +1,965 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CheckoutConfigurationCurrency { + public static final CheckoutConfigurationCurrency CRC = new CheckoutConfigurationCurrency(Value.CRC, "crc"); + + public static final CheckoutConfigurationCurrency OMR = new CheckoutConfigurationCurrency(Value.OMR, "omr"); + + public static final CheckoutConfigurationCurrency RUB = new CheckoutConfigurationCurrency(Value.RUB, "rub"); + + public static final CheckoutConfigurationCurrency BGN = new CheckoutConfigurationCurrency(Value.BGN, "bgn"); + + public static final CheckoutConfigurationCurrency SAR = new CheckoutConfigurationCurrency(Value.SAR, "sar"); + + public static final CheckoutConfigurationCurrency UYU = new CheckoutConfigurationCurrency(Value.UYU, "uyu"); + + public static final CheckoutConfigurationCurrency TZS = new CheckoutConfigurationCurrency(Value.TZS, "tzs"); + + public static final CheckoutConfigurationCurrency XCD = new CheckoutConfigurationCurrency(Value.XCD, "xcd"); + + public static final CheckoutConfigurationCurrency GTQ = new CheckoutConfigurationCurrency(Value.GTQ, "gtq"); + + public static final CheckoutConfigurationCurrency CHF = new CheckoutConfigurationCurrency(Value.CHF, "chf"); + + public static final CheckoutConfigurationCurrency RON = new CheckoutConfigurationCurrency(Value.RON, "ron"); + + public static final CheckoutConfigurationCurrency PHP = new CheckoutConfigurationCurrency(Value.PHP, "php"); + + public static final CheckoutConfigurationCurrency KES = new CheckoutConfigurationCurrency(Value.KES, "kes"); + + public static final CheckoutConfigurationCurrency XAU = new CheckoutConfigurationCurrency(Value.XAU, "xau"); + + public static final CheckoutConfigurationCurrency BSD = new CheckoutConfigurationCurrency(Value.BSD, "bsd"); + + public static final CheckoutConfigurationCurrency INR = new CheckoutConfigurationCurrency(Value.INR, "inr"); + + public static final CheckoutConfigurationCurrency HKD = new CheckoutConfigurationCurrency(Value.HKD, "hkd"); + + public static final CheckoutConfigurationCurrency JOD = new CheckoutConfigurationCurrency(Value.JOD, "jod"); + + public static final CheckoutConfigurationCurrency MKD = new CheckoutConfigurationCurrency(Value.MKD, "mkd"); + + public static final CheckoutConfigurationCurrency CLP = new CheckoutConfigurationCurrency(Value.CLP, "clp"); + + public static final CheckoutConfigurationCurrency NZD = new CheckoutConfigurationCurrency(Value.NZD, "nzd"); + + public static final CheckoutConfigurationCurrency IDR = new CheckoutConfigurationCurrency(Value.IDR, "idr"); + + public static final CheckoutConfigurationCurrency MOP = new CheckoutConfigurationCurrency(Value.MOP, "mop"); + + public static final CheckoutConfigurationCurrency HUF = new CheckoutConfigurationCurrency(Value.HUF, "huf"); + + public static final CheckoutConfigurationCurrency MAD = new CheckoutConfigurationCurrency(Value.MAD, "mad"); + + public static final CheckoutConfigurationCurrency KHR = new CheckoutConfigurationCurrency(Value.KHR, "khr"); + + public static final CheckoutConfigurationCurrency NGN = new CheckoutConfigurationCurrency(Value.NGN, "ngn"); + + public static final CheckoutConfigurationCurrency THB = new CheckoutConfigurationCurrency(Value.THB, "thb"); + + public static final CheckoutConfigurationCurrency DZD = new CheckoutConfigurationCurrency(Value.DZD, "dzd"); + + public static final CheckoutConfigurationCurrency ARS = new CheckoutConfigurationCurrency(Value.ARS, "ars"); + + public static final CheckoutConfigurationCurrency CAD = new CheckoutConfigurationCurrency(Value.CAD, "cad"); + + public static final CheckoutConfigurationCurrency MYR = new CheckoutConfigurationCurrency(Value.MYR, "myr"); + + public static final CheckoutConfigurationCurrency KRW = new CheckoutConfigurationCurrency(Value.KRW, "krw"); + + public static final CheckoutConfigurationCurrency KZT = new CheckoutConfigurationCurrency(Value.KZT, "kzt"); + + public static final CheckoutConfigurationCurrency ETH = new CheckoutConfigurationCurrency(Value.ETH, "eth"); + + public static final CheckoutConfigurationCurrency COP = new CheckoutConfigurationCurrency(Value.COP, "cop"); + + public static final CheckoutConfigurationCurrency JMD = new CheckoutConfigurationCurrency(Value.JMD, "jmd"); + + public static final CheckoutConfigurationCurrency NAD = new CheckoutConfigurationCurrency(Value.NAD, "nad"); + + public static final CheckoutConfigurationCurrency GYD = new CheckoutConfigurationCurrency(Value.GYD, "gyd"); + + public static final CheckoutConfigurationCurrency KWD = new CheckoutConfigurationCurrency(Value.KWD, "kwd"); + + public static final CheckoutConfigurationCurrency DOP = new CheckoutConfigurationCurrency(Value.DOP, "dop"); + + public static final CheckoutConfigurationCurrency BTC = new CheckoutConfigurationCurrency(Value.BTC, "btc"); + + public static final CheckoutConfigurationCurrency AMD = new CheckoutConfigurationCurrency(Value.AMD, "amd"); + + public static final CheckoutConfigurationCurrency LKR = new CheckoutConfigurationCurrency(Value.LKR, "lkr"); + + public static final CheckoutConfigurationCurrency ALL = new CheckoutConfigurationCurrency(Value.ALL, "all"); + + public static final CheckoutConfigurationCurrency USDT = new CheckoutConfigurationCurrency(Value.USDT, "usdt"); + + public static final CheckoutConfigurationCurrency TND = new CheckoutConfigurationCurrency(Value.TND, "tnd"); + + public static final CheckoutConfigurationCurrency MUR = new CheckoutConfigurationCurrency(Value.MUR, "mur"); + + public static final CheckoutConfigurationCurrency PEN = new CheckoutConfigurationCurrency(Value.PEN, "pen"); + + public static final CheckoutConfigurationCurrency USD = new CheckoutConfigurationCurrency(Value.USD, "usd"); + + public static final CheckoutConfigurationCurrency APE = new CheckoutConfigurationCurrency(Value.APE, "ape"); + + public static final CheckoutConfigurationCurrency BHD = new CheckoutConfigurationCurrency(Value.BHD, "bhd"); + + public static final CheckoutConfigurationCurrency XOF = new CheckoutConfigurationCurrency(Value.XOF, "xof"); + + public static final CheckoutConfigurationCurrency RWF = new CheckoutConfigurationCurrency(Value.RWF, "rwf"); + + public static final CheckoutConfigurationCurrency GBP = new CheckoutConfigurationCurrency(Value.GBP, "gbp"); + + public static final CheckoutConfigurationCurrency VND = new CheckoutConfigurationCurrency(Value.VND, "vnd"); + + public static final CheckoutConfigurationCurrency MNT = new CheckoutConfigurationCurrency(Value.MNT, "mnt"); + + public static final CheckoutConfigurationCurrency ETB = new CheckoutConfigurationCurrency(Value.ETB, "etb"); + + public static final CheckoutConfigurationCurrency TTD = new CheckoutConfigurationCurrency(Value.TTD, "ttd"); + + public static final CheckoutConfigurationCurrency EUR = new CheckoutConfigurationCurrency(Value.EUR, "eur"); + + public static final CheckoutConfigurationCurrency BRL = new CheckoutConfigurationCurrency(Value.BRL, "brl"); + + public static final CheckoutConfigurationCurrency SEK = new CheckoutConfigurationCurrency(Value.SEK, "sek"); + + public static final CheckoutConfigurationCurrency RSD = new CheckoutConfigurationCurrency(Value.RSD, "rsd"); + + public static final CheckoutConfigurationCurrency UZS = new CheckoutConfigurationCurrency(Value.UZS, "uzs"); + + public static final CheckoutConfigurationCurrency TWD = new CheckoutConfigurationCurrency(Value.TWD, "twd"); + + public static final CheckoutConfigurationCurrency NOK = new CheckoutConfigurationCurrency(Value.NOK, "nok"); + + public static final CheckoutConfigurationCurrency WHOP_USD = + new CheckoutConfigurationCurrency(Value.WHOP_USD, "whop_usd"); + + public static final CheckoutConfigurationCurrency PYG = new CheckoutConfigurationCurrency(Value.PYG, "pyg"); + + public static final CheckoutConfigurationCurrency TRY = new CheckoutConfigurationCurrency(Value.TRY, "try"); + + public static final CheckoutConfigurationCurrency ZAR = new CheckoutConfigurationCurrency(Value.ZAR, "zar"); + + public static final CheckoutConfigurationCurrency PKR = new CheckoutConfigurationCurrency(Value.PKR, "pkr"); + + public static final CheckoutConfigurationCurrency CNY = new CheckoutConfigurationCurrency(Value.CNY, "cny"); + + public static final CheckoutConfigurationCurrency CZK = new CheckoutConfigurationCurrency(Value.CZK, "czk"); + + public static final CheckoutConfigurationCurrency ILS = new CheckoutConfigurationCurrency(Value.ILS, "ils"); + + public static final CheckoutConfigurationCurrency MGA = new CheckoutConfigurationCurrency(Value.MGA, "mga"); + + public static final CheckoutConfigurationCurrency AED = new CheckoutConfigurationCurrency(Value.AED, "aed"); + + public static final CheckoutConfigurationCurrency GHS = new CheckoutConfigurationCurrency(Value.GHS, "ghs"); + + public static final CheckoutConfigurationCurrency BAM = new CheckoutConfigurationCurrency(Value.BAM, "bam"); + + public static final CheckoutConfigurationCurrency JPY = new CheckoutConfigurationCurrency(Value.JPY, "jpy"); + + public static final CheckoutConfigurationCurrency PLN = new CheckoutConfigurationCurrency(Value.PLN, "pln"); + + public static final CheckoutConfigurationCurrency BOB = new CheckoutConfigurationCurrency(Value.BOB, "bob"); + + public static final CheckoutConfigurationCurrency QAR = new CheckoutConfigurationCurrency(Value.QAR, "qar"); + + public static final CheckoutConfigurationCurrency EGP = new CheckoutConfigurationCurrency(Value.EGP, "egp"); + + public static final CheckoutConfigurationCurrency AWG = new CheckoutConfigurationCurrency(Value.AWG, "awg"); + + public static final CheckoutConfigurationCurrency DKK = new CheckoutConfigurationCurrency(Value.DKK, "dkk"); + + public static final CheckoutConfigurationCurrency MDL = new CheckoutConfigurationCurrency(Value.MDL, "mdl"); + + public static final CheckoutConfigurationCurrency MXN = new CheckoutConfigurationCurrency(Value.MXN, "mxn"); + + public static final CheckoutConfigurationCurrency SGD = new CheckoutConfigurationCurrency(Value.SGD, "sgd"); + + public static final CheckoutConfigurationCurrency AUD = new CheckoutConfigurationCurrency(Value.AUD, "aud"); + + public static final CheckoutConfigurationCurrency GMD = new CheckoutConfigurationCurrency(Value.GMD, "gmd"); + + private final Value value; + + private final String string; + + CheckoutConfigurationCurrency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CheckoutConfigurationCurrency + && this.string.equals(((CheckoutConfigurationCurrency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CRC: + return visitor.visitCrc(); + case OMR: + return visitor.visitOmr(); + case RUB: + return visitor.visitRub(); + case BGN: + return visitor.visitBgn(); + case SAR: + return visitor.visitSar(); + case UYU: + return visitor.visitUyu(); + case TZS: + return visitor.visitTzs(); + case XCD: + return visitor.visitXcd(); + case GTQ: + return visitor.visitGtq(); + case CHF: + return visitor.visitChf(); + case RON: + return visitor.visitRon(); + case PHP: + return visitor.visitPhp(); + case KES: + return visitor.visitKes(); + case XAU: + return visitor.visitXau(); + case BSD: + return visitor.visitBsd(); + case INR: + return visitor.visitInr(); + case HKD: + return visitor.visitHkd(); + case JOD: + return visitor.visitJod(); + case MKD: + return visitor.visitMkd(); + case CLP: + return visitor.visitClp(); + case NZD: + return visitor.visitNzd(); + case IDR: + return visitor.visitIdr(); + case MOP: + return visitor.visitMop(); + case HUF: + return visitor.visitHuf(); + case MAD: + return visitor.visitMad(); + case KHR: + return visitor.visitKhr(); + case NGN: + return visitor.visitNgn(); + case THB: + return visitor.visitThb(); + case DZD: + return visitor.visitDzd(); + case ARS: + return visitor.visitArs(); + case CAD: + return visitor.visitCad(); + case MYR: + return visitor.visitMyr(); + case KRW: + return visitor.visitKrw(); + case KZT: + return visitor.visitKzt(); + case ETH: + return visitor.visitEth(); + case COP: + return visitor.visitCop(); + case JMD: + return visitor.visitJmd(); + case NAD: + return visitor.visitNad(); + case GYD: + return visitor.visitGyd(); + case KWD: + return visitor.visitKwd(); + case DOP: + return visitor.visitDop(); + case BTC: + return visitor.visitBtc(); + case AMD: + return visitor.visitAmd(); + case LKR: + return visitor.visitLkr(); + case ALL: + return visitor.visitAll(); + case USDT: + return visitor.visitUsdt(); + case TND: + return visitor.visitTnd(); + case MUR: + return visitor.visitMur(); + case PEN: + return visitor.visitPen(); + case USD: + return visitor.visitUsd(); + case APE: + return visitor.visitApe(); + case BHD: + return visitor.visitBhd(); + case XOF: + return visitor.visitXof(); + case RWF: + return visitor.visitRwf(); + case GBP: + return visitor.visitGbp(); + case VND: + return visitor.visitVnd(); + case MNT: + return visitor.visitMnt(); + case ETB: + return visitor.visitEtb(); + case TTD: + return visitor.visitTtd(); + case EUR: + return visitor.visitEur(); + case BRL: + return visitor.visitBrl(); + case SEK: + return visitor.visitSek(); + case RSD: + return visitor.visitRsd(); + case UZS: + return visitor.visitUzs(); + case TWD: + return visitor.visitTwd(); + case NOK: + return visitor.visitNok(); + case WHOP_USD: + return visitor.visitWhopUsd(); + case PYG: + return visitor.visitPyg(); + case TRY: + return visitor.visitTry(); + case ZAR: + return visitor.visitZar(); + case PKR: + return visitor.visitPkr(); + case CNY: + return visitor.visitCny(); + case CZK: + return visitor.visitCzk(); + case ILS: + return visitor.visitIls(); + case MGA: + return visitor.visitMga(); + case AED: + return visitor.visitAed(); + case GHS: + return visitor.visitGhs(); + case BAM: + return visitor.visitBam(); + case JPY: + return visitor.visitJpy(); + case PLN: + return visitor.visitPln(); + case BOB: + return visitor.visitBob(); + case QAR: + return visitor.visitQar(); + case EGP: + return visitor.visitEgp(); + case AWG: + return visitor.visitAwg(); + case DKK: + return visitor.visitDkk(); + case MDL: + return visitor.visitMdl(); + case MXN: + return visitor.visitMxn(); + case SGD: + return visitor.visitSgd(); + case AUD: + return visitor.visitAud(); + case GMD: + return visitor.visitGmd(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CheckoutConfigurationCurrency valueOf(String value) { + switch (value) { + case "crc": + return CRC; + case "omr": + return OMR; + case "rub": + return RUB; + case "bgn": + return BGN; + case "sar": + return SAR; + case "uyu": + return UYU; + case "tzs": + return TZS; + case "xcd": + return XCD; + case "gtq": + return GTQ; + case "chf": + return CHF; + case "ron": + return RON; + case "php": + return PHP; + case "kes": + return KES; + case "xau": + return XAU; + case "bsd": + return BSD; + case "inr": + return INR; + case "hkd": + return HKD; + case "jod": + return JOD; + case "mkd": + return MKD; + case "clp": + return CLP; + case "nzd": + return NZD; + case "idr": + return IDR; + case "mop": + return MOP; + case "huf": + return HUF; + case "mad": + return MAD; + case "khr": + return KHR; + case "ngn": + return NGN; + case "thb": + return THB; + case "dzd": + return DZD; + case "ars": + return ARS; + case "cad": + return CAD; + case "myr": + return MYR; + case "krw": + return KRW; + case "kzt": + return KZT; + case "eth": + return ETH; + case "cop": + return COP; + case "jmd": + return JMD; + case "nad": + return NAD; + case "gyd": + return GYD; + case "kwd": + return KWD; + case "dop": + return DOP; + case "btc": + return BTC; + case "amd": + return AMD; + case "lkr": + return LKR; + case "all": + return ALL; + case "usdt": + return USDT; + case "tnd": + return TND; + case "mur": + return MUR; + case "pen": + return PEN; + case "usd": + return USD; + case "ape": + return APE; + case "bhd": + return BHD; + case "xof": + return XOF; + case "rwf": + return RWF; + case "gbp": + return GBP; + case "vnd": + return VND; + case "mnt": + return MNT; + case "etb": + return ETB; + case "ttd": + return TTD; + case "eur": + return EUR; + case "brl": + return BRL; + case "sek": + return SEK; + case "rsd": + return RSD; + case "uzs": + return UZS; + case "twd": + return TWD; + case "nok": + return NOK; + case "whop_usd": + return WHOP_USD; + case "pyg": + return PYG; + case "try": + return TRY; + case "zar": + return ZAR; + case "pkr": + return PKR; + case "cny": + return CNY; + case "czk": + return CZK; + case "ils": + return ILS; + case "mga": + return MGA; + case "aed": + return AED; + case "ghs": + return GHS; + case "bam": + return BAM; + case "jpy": + return JPY; + case "pln": + return PLN; + case "bob": + return BOB; + case "qar": + return QAR; + case "egp": + return EGP; + case "awg": + return AWG; + case "dkk": + return DKK; + case "mdl": + return MDL; + case "mxn": + return MXN; + case "sgd": + return SGD; + case "aud": + return AUD; + case "gmd": + return GMD; + default: + return new CheckoutConfigurationCurrency(Value.UNKNOWN, value); + } + } + + public enum Value { + USD, + + SGD, + + INR, + + AUD, + + BRL, + + CAD, + + DKK, + + EUR, + + NOK, + + GBP, + + SEK, + + CHF, + + HKD, + + HUF, + + JPY, + + MXN, + + MYR, + + PLN, + + CZK, + + NZD, + + AED, + + ETH, + + APE, + + COP, + + RON, + + THB, + + BGN, + + IDR, + + DOP, + + PHP, + + TRY, + + KRW, + + TWD, + + VND, + + PKR, + + CLP, + + UYU, + + ARS, + + ZAR, + + DZD, + + TND, + + MAD, + + KES, + + KWD, + + JOD, + + ALL, + + XCD, + + AMD, + + BSD, + + BHD, + + BOB, + + BAM, + + KHR, + + CRC, + + XOF, + + EGP, + + ETB, + + GMD, + + GHS, + + GTQ, + + GYD, + + ILS, + + JMD, + + MOP, + + MGA, + + MUR, + + MDL, + + MNT, + + NAD, + + NGN, + + MKD, + + OMR, + + PYG, + + PEN, + + QAR, + + RWF, + + SAR, + + RSD, + + LKR, + + TZS, + + TTD, + + UZS, + + RUB, + + BTC, + + CNY, + + USDT, + + KZT, + + AWG, + + WHOP_USD, + + XAU, + + UNKNOWN + } + + public interface Visitor { + T visitUsd(); + + T visitSgd(); + + T visitInr(); + + T visitAud(); + + T visitBrl(); + + T visitCad(); + + T visitDkk(); + + T visitEur(); + + T visitNok(); + + T visitGbp(); + + T visitSek(); + + T visitChf(); + + T visitHkd(); + + T visitHuf(); + + T visitJpy(); + + T visitMxn(); + + T visitMyr(); + + T visitPln(); + + T visitCzk(); + + T visitNzd(); + + T visitAed(); + + T visitEth(); + + T visitApe(); + + T visitCop(); + + T visitRon(); + + T visitThb(); + + T visitBgn(); + + T visitIdr(); + + T visitDop(); + + T visitPhp(); + + T visitTry(); + + T visitKrw(); + + T visitTwd(); + + T visitVnd(); + + T visitPkr(); + + T visitClp(); + + T visitUyu(); + + T visitArs(); + + T visitZar(); + + T visitDzd(); + + T visitTnd(); + + T visitMad(); + + T visitKes(); + + T visitKwd(); + + T visitJod(); + + T visitAll(); + + T visitXcd(); + + T visitAmd(); + + T visitBsd(); + + T visitBhd(); + + T visitBob(); + + T visitBam(); + + T visitKhr(); + + T visitCrc(); + + T visitXof(); + + T visitEgp(); + + T visitEtb(); + + T visitGmd(); + + T visitGhs(); + + T visitGtq(); + + T visitGyd(); + + T visitIls(); + + T visitJmd(); + + T visitMop(); + + T visitMga(); + + T visitMur(); + + T visitMdl(); + + T visitMnt(); + + T visitNad(); + + T visitNgn(); + + T visitMkd(); + + T visitOmr(); + + T visitPyg(); + + T visitPen(); + + T visitQar(); + + T visitRwf(); + + T visitSar(); + + T visitRsd(); + + T visitLkr(); + + T visitTzs(); + + T visitTtd(); + + T visitUzs(); + + T visitRub(); + + T visitBtc(); + + T visitCny(); + + T visitUsdt(); + + T visitKzt(); + + T visitAwg(); + + T visitWhopUsd(); + + T visitXau(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutConfigurationListItem.java b/src/main/java/com/whop/api/types/CheckoutConfigurationListItem.java new file mode 100644 index 00000000..f5933c38 --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutConfigurationListItem.java @@ -0,0 +1,689 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CheckoutConfigurationListItem.Builder.class) +public final class CheckoutConfigurationListItem { + private final Optional affiliateCode; + + private final String companyId; + + private final Optional currency; + + private final String id; + + private final Optional> metadata; + + private final CheckoutModes mode; + + private final Optional paymentMethodConfiguration; + + private final Optional plan; + + private final String purchaseUrl; + + private final Optional redirectUrl; + + private final Map additionalProperties; + + private CheckoutConfigurationListItem( + Optional affiliateCode, + String companyId, + Optional currency, + String id, + Optional> metadata, + CheckoutModes mode, + Optional paymentMethodConfiguration, + Optional plan, + String purchaseUrl, + Optional redirectUrl, + Map additionalProperties) { + this.affiliateCode = affiliateCode; + this.companyId = companyId; + this.currency = currency; + this.id = id; + this.metadata = metadata; + this.mode = mode; + this.paymentMethodConfiguration = paymentMethodConfiguration; + this.plan = plan; + this.purchaseUrl = purchaseUrl; + this.redirectUrl = redirectUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The affiliate code to use for the checkout configuration + */ + @JsonIgnore + public Optional getAffiliateCode() { + if (affiliateCode == null) { + return Optional.empty(); + } + return affiliateCode; + } + + /** + * @return The ID of the company to use for the checkout configuration + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return The currency to use for the configuration when in 'setup' mode. This is used to target which currency specific payment methods are available. If not provided, it will default to 'usd' when in setup mode. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return The unique identifier for the checkout session. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The metadata to use for the checkout configuration + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The mode of the checkout session. + */ + @JsonProperty("mode") + public CheckoutModes getMode() { + return mode; + } + + /** + * @return The explicit payment method configuration for the session, if any. This currently only works in 'setup' mode. Use the plan's payment_method_configuration for payment method. + */ + @JsonIgnore + public Optional getPaymentMethodConfiguration() { + if (paymentMethodConfiguration == null) { + return Optional.empty(); + } + return paymentMethodConfiguration; + } + + /** + * @return The plan to use for the checkout configuration + */ + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + /** + * @return A URL you can send to customers to complete a checkout. It looks like /checkout/ch_xxxx/ + */ + @JsonProperty("purchase_url") + public String getPurchaseUrl() { + return purchaseUrl; + } + + /** + * @return The URL to redirect the user to after the checkout configuration is created + */ + @JsonIgnore + public Optional getRedirectUrl() { + if (redirectUrl == null) { + return Optional.empty(); + } + return redirectUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("affiliate_code") + private Optional _getAffiliateCode() { + return affiliateCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_configuration") + private Optional _getPaymentMethodConfiguration() { + return paymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("redirect_url") + private Optional _getRedirectUrl() { + return redirectUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckoutConfigurationListItem && equalTo((CheckoutConfigurationListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CheckoutConfigurationListItem other) { + return affiliateCode.equals(other.affiliateCode) + && companyId.equals(other.companyId) + && currency.equals(other.currency) + && id.equals(other.id) + && metadata.equals(other.metadata) + && mode.equals(other.mode) + && paymentMethodConfiguration.equals(other.paymentMethodConfiguration) + && plan.equals(other.plan) + && purchaseUrl.equals(other.purchaseUrl) + && redirectUrl.equals(other.redirectUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.affiliateCode, + this.companyId, + this.currency, + this.id, + this.metadata, + this.mode, + this.paymentMethodConfiguration, + this.plan, + this.purchaseUrl, + this.redirectUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

The ID of the company to use for the checkout configuration

+ */ + IdStage companyId(@NotNull String companyId); + + Builder from(CheckoutConfigurationListItem other); + } + + public interface IdStage { + /** + *

The unique identifier for the checkout session.

+ */ + ModeStage id(@NotNull String id); + } + + public interface ModeStage { + /** + *

The mode of the checkout session.

+ */ + PurchaseUrlStage mode(@NotNull CheckoutModes mode); + } + + public interface PurchaseUrlStage { + /** + *

A URL you can send to customers to complete a checkout. It looks like /checkout/ch_xxxx/

+ */ + _FinalStage purchaseUrl(@NotNull String purchaseUrl); + } + + public interface _FinalStage { + CheckoutConfigurationListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The affiliate code to use for the checkout configuration

+ */ + _FinalStage affiliateCode(Optional affiliateCode); + + _FinalStage affiliateCode(String affiliateCode); + + _FinalStage affiliateCode(Nullable affiliateCode); + + /** + *

The currency to use for the configuration when in 'setup' mode. This is used to target which currency specific payment methods are available. If not provided, it will default to 'usd' when in setup mode.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(Currencies currency); + + _FinalStage currency(Nullable currency); + + /** + *

The metadata to use for the checkout configuration

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The explicit payment method configuration for the session, if any. This currently only works in 'setup' mode. Use the plan's payment_method_configuration for payment method.

+ */ + _FinalStage paymentMethodConfiguration( + Optional paymentMethodConfiguration); + + _FinalStage paymentMethodConfiguration( + CheckoutConfigurationListItemPaymentMethodConfiguration paymentMethodConfiguration); + + _FinalStage paymentMethodConfiguration( + Nullable paymentMethodConfiguration); + + /** + *

The plan to use for the checkout configuration

+ */ + _FinalStage plan(Optional plan); + + _FinalStage plan(CheckoutConfigurationListItemPlan plan); + + _FinalStage plan(Nullable plan); + + /** + *

The URL to redirect the user to after the checkout configuration is created

+ */ + _FinalStage redirectUrl(Optional redirectUrl); + + _FinalStage redirectUrl(String redirectUrl); + + _FinalStage redirectUrl(Nullable redirectUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, IdStage, ModeStage, PurchaseUrlStage, _FinalStage { + private String companyId; + + private String id; + + private CheckoutModes mode; + + private String purchaseUrl; + + private Optional redirectUrl = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional paymentMethodConfiguration = + Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional affiliateCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CheckoutConfigurationListItem other) { + affiliateCode(other.getAffiliateCode()); + companyId(other.getCompanyId()); + currency(other.getCurrency()); + id(other.getId()); + metadata(other.getMetadata()); + mode(other.getMode()); + paymentMethodConfiguration(other.getPaymentMethodConfiguration()); + plan(other.getPlan()); + purchaseUrl(other.getPurchaseUrl()); + redirectUrl(other.getRedirectUrl()); + return this; + } + + /** + *

The ID of the company to use for the checkout configuration

+ *

The ID of the company to use for the checkout configuration

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_id") + public IdStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

The unique identifier for the checkout session.

+ *

The unique identifier for the checkout session.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ModeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The mode of the checkout session.

+ *

The mode of the checkout session.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("mode") + public PurchaseUrlStage mode(@NotNull CheckoutModes mode) { + this.mode = Objects.requireNonNull(mode, "mode must not be null"); + return this; + } + + /** + *

A URL you can send to customers to complete a checkout. It looks like /checkout/ch_xxxx/

+ *

A URL you can send to customers to complete a checkout. It looks like /checkout/ch_xxxx/

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("purchase_url") + public _FinalStage purchaseUrl(@NotNull String purchaseUrl) { + this.purchaseUrl = Objects.requireNonNull(purchaseUrl, "purchaseUrl must not be null"); + return this; + } + + /** + *

The URL to redirect the user to after the checkout configuration is created

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectUrl(Nullable redirectUrl) { + if (redirectUrl.isNull()) { + this.redirectUrl = null; + } else if (redirectUrl.isEmpty()) { + this.redirectUrl = Optional.empty(); + } else { + this.redirectUrl = Optional.of(redirectUrl.get()); + } + return this; + } + + /** + *

The URL to redirect the user to after the checkout configuration is created

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectUrl(String redirectUrl) { + this.redirectUrl = Optional.ofNullable(redirectUrl); + return this; + } + + /** + *

The URL to redirect the user to after the checkout configuration is created

+ */ + @java.lang.Override + @JsonSetter(value = "redirect_url", nulls = Nulls.SKIP) + public _FinalStage redirectUrl(Optional redirectUrl) { + this.redirectUrl = redirectUrl; + return this; + } + + /** + *

The plan to use for the checkout configuration

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + /** + *

The plan to use for the checkout configuration

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(CheckoutConfigurationListItemPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + /** + *

The plan to use for the checkout configuration

+ */ + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + + /** + *

The explicit payment method configuration for the session, if any. This currently only works in 'setup' mode. Use the plan's payment_method_configuration for payment method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodConfiguration( + Nullable paymentMethodConfiguration) { + if (paymentMethodConfiguration.isNull()) { + this.paymentMethodConfiguration = null; + } else if (paymentMethodConfiguration.isEmpty()) { + this.paymentMethodConfiguration = Optional.empty(); + } else { + this.paymentMethodConfiguration = Optional.of(paymentMethodConfiguration.get()); + } + return this; + } + + /** + *

The explicit payment method configuration for the session, if any. This currently only works in 'setup' mode. Use the plan's payment_method_configuration for payment method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodConfiguration( + CheckoutConfigurationListItemPaymentMethodConfiguration paymentMethodConfiguration) { + this.paymentMethodConfiguration = Optional.ofNullable(paymentMethodConfiguration); + return this; + } + + /** + *

The explicit payment method configuration for the session, if any. This currently only works in 'setup' mode. Use the plan's payment_method_configuration for payment method.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_configuration", nulls = Nulls.SKIP) + public _FinalStage paymentMethodConfiguration( + Optional paymentMethodConfiguration) { + this.paymentMethodConfiguration = paymentMethodConfiguration; + return this; + } + + /** + *

The metadata to use for the checkout configuration

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

The metadata to use for the checkout configuration

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

The metadata to use for the checkout configuration

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The currency to use for the configuration when in 'setup' mode. This is used to target which currency specific payment methods are available. If not provided, it will default to 'usd' when in setup mode.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

The currency to use for the configuration when in 'setup' mode. This is used to target which currency specific payment methods are available. If not provided, it will default to 'usd' when in setup mode.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Currencies currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

The currency to use for the configuration when in 'setup' mode. This is used to target which currency specific payment methods are available. If not provided, it will default to 'usd' when in setup mode.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + /** + *

The affiliate code to use for the checkout configuration

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage affiliateCode(Nullable affiliateCode) { + if (affiliateCode.isNull()) { + this.affiliateCode = null; + } else if (affiliateCode.isEmpty()) { + this.affiliateCode = Optional.empty(); + } else { + this.affiliateCode = Optional.of(affiliateCode.get()); + } + return this; + } + + /** + *

The affiliate code to use for the checkout configuration

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage affiliateCode(String affiliateCode) { + this.affiliateCode = Optional.ofNullable(affiliateCode); + return this; + } + + /** + *

The affiliate code to use for the checkout configuration

+ */ + @java.lang.Override + @JsonSetter(value = "affiliate_code", nulls = Nulls.SKIP) + public _FinalStage affiliateCode(Optional affiliateCode) { + this.affiliateCode = affiliateCode; + return this; + } + + @java.lang.Override + public CheckoutConfigurationListItem build() { + return new CheckoutConfigurationListItem( + affiliateCode, + companyId, + currency, + id, + metadata, + mode, + paymentMethodConfiguration, + plan, + purchaseUrl, + redirectUrl, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutConfigurationListItemPaymentMethodConfiguration.java b/src/main/java/com/whop/api/types/CheckoutConfigurationListItemPaymentMethodConfiguration.java new file mode 100644 index 00000000..35e78c4b --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutConfigurationListItemPaymentMethodConfiguration.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CheckoutConfigurationListItemPaymentMethodConfiguration.Builder.class) +public final class CheckoutConfigurationListItemPaymentMethodConfiguration { + private final List disabled; + + private final List enabled; + + private final boolean includePlatformDefaults; + + private final Map additionalProperties; + + private CheckoutConfigurationListItemPaymentMethodConfiguration( + List disabled, + List enabled, + boolean includePlatformDefaults, + Map additionalProperties) { + this.disabled = disabled; + this.enabled = enabled; + this.includePlatformDefaults = includePlatformDefaults; + this.additionalProperties = additionalProperties; + } + + /** + * @return An array of payment method identifiers that are explicitly disabled. Only applies if the include_platform_defaults is true. + */ + @JsonProperty("disabled") + public List getDisabled() { + return disabled; + } + + /** + * @return An array of payment method identifiers that are explicitly enabled. This means these payment methods will be shown on checkout. Example use case is to only enable a specific payment method like cashapp, or extending the platform defaults with additional methods. + */ + @JsonProperty("enabled") + public List getEnabled() { + return enabled; + } + + /** + * @return Whether Whop's platform default payment method enablement settings are included in this configuration. The full list of default payment methods can be found in the documentation at docs.whop.com/payments. + */ + @JsonProperty("include_platform_defaults") + public boolean getIncludePlatformDefaults() { + return includePlatformDefaults; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckoutConfigurationListItemPaymentMethodConfiguration + && equalTo((CheckoutConfigurationListItemPaymentMethodConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CheckoutConfigurationListItemPaymentMethodConfiguration other) { + return disabled.equals(other.disabled) + && enabled.equals(other.enabled) + && includePlatformDefaults == other.includePlatformDefaults; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.disabled, this.enabled, this.includePlatformDefaults); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IncludePlatformDefaultsStage builder() { + return new Builder(); + } + + public interface IncludePlatformDefaultsStage { + /** + *

Whether Whop's platform default payment method enablement settings are included in this configuration. The full list of default payment methods can be found in the documentation at docs.whop.com/payments.

+ */ + _FinalStage includePlatformDefaults(boolean includePlatformDefaults); + + Builder from(CheckoutConfigurationListItemPaymentMethodConfiguration other); + } + + public interface _FinalStage { + CheckoutConfigurationListItemPaymentMethodConfiguration build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

An array of payment method identifiers that are explicitly disabled. Only applies if the include_platform_defaults is true.

+ */ + _FinalStage disabled(List disabled); + + _FinalStage addDisabled(PaymentMethodTypes disabled); + + _FinalStage addAllDisabled(List disabled); + + /** + *

An array of payment method identifiers that are explicitly enabled. This means these payment methods will be shown on checkout. Example use case is to only enable a specific payment method like cashapp, or extending the platform defaults with additional methods.

+ */ + _FinalStage enabled(List enabled); + + _FinalStage addEnabled(PaymentMethodTypes enabled); + + _FinalStage addAllEnabled(List enabled); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IncludePlatformDefaultsStage, _FinalStage { + private boolean includePlatformDefaults; + + private List enabled = new ArrayList<>(); + + private List disabled = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CheckoutConfigurationListItemPaymentMethodConfiguration other) { + disabled(other.getDisabled()); + enabled(other.getEnabled()); + includePlatformDefaults(other.getIncludePlatformDefaults()); + return this; + } + + /** + *

Whether Whop's platform default payment method enablement settings are included in this configuration. The full list of default payment methods can be found in the documentation at docs.whop.com/payments.

+ *

Whether Whop's platform default payment method enablement settings are included in this configuration. The full list of default payment methods can be found in the documentation at docs.whop.com/payments.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("include_platform_defaults") + public _FinalStage includePlatformDefaults(boolean includePlatformDefaults) { + this.includePlatformDefaults = includePlatformDefaults; + return this; + } + + /** + *

An array of payment method identifiers that are explicitly enabled. This means these payment methods will be shown on checkout. Example use case is to only enable a specific payment method like cashapp, or extending the platform defaults with additional methods.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllEnabled(List enabled) { + if (enabled != null) { + this.enabled.addAll(enabled); + } + return this; + } + + /** + *

An array of payment method identifiers that are explicitly enabled. This means these payment methods will be shown on checkout. Example use case is to only enable a specific payment method like cashapp, or extending the platform defaults with additional methods.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addEnabled(PaymentMethodTypes enabled) { + this.enabled.add(enabled); + return this; + } + + /** + *

An array of payment method identifiers that are explicitly enabled. This means these payment methods will be shown on checkout. Example use case is to only enable a specific payment method like cashapp, or extending the platform defaults with additional methods.

+ */ + @java.lang.Override + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public _FinalStage enabled(List enabled) { + this.enabled.clear(); + if (enabled != null) { + this.enabled.addAll(enabled); + } + return this; + } + + /** + *

An array of payment method identifiers that are explicitly disabled. Only applies if the include_platform_defaults is true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllDisabled(List disabled) { + if (disabled != null) { + this.disabled.addAll(disabled); + } + return this; + } + + /** + *

An array of payment method identifiers that are explicitly disabled. Only applies if the include_platform_defaults is true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addDisabled(PaymentMethodTypes disabled) { + this.disabled.add(disabled); + return this; + } + + /** + *

An array of payment method identifiers that are explicitly disabled. Only applies if the include_platform_defaults is true.

+ */ + @java.lang.Override + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public _FinalStage disabled(List disabled) { + this.disabled.clear(); + if (disabled != null) { + this.disabled.addAll(disabled); + } + return this; + } + + @java.lang.Override + public CheckoutConfigurationListItemPaymentMethodConfiguration build() { + return new CheckoutConfigurationListItemPaymentMethodConfiguration( + disabled, enabled, includePlatformDefaults, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutConfigurationListItemPlan.java b/src/main/java/com/whop/api/types/CheckoutConfigurationListItemPlan.java new file mode 100644 index 00000000..deebac3d --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutConfigurationListItemPlan.java @@ -0,0 +1,695 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CheckoutConfigurationListItemPlan.Builder.class) +public final class CheckoutConfigurationListItemPlan { + private final boolean adaptivePricingEnabled; + + private final Optional billingPeriod; + + private final Currencies currency; + + private final Optional expirationDays; + + private final String id; + + private final double initialPrice; + + private final PlanTypes planType; + + private final ReleaseMethod releaseMethod; + + private final double renewalPrice; + + private final Optional threeDsLevel; + + private final Optional trialPeriodDays; + + private final Visibility visibility; + + private final Map additionalProperties; + + private CheckoutConfigurationListItemPlan( + boolean adaptivePricingEnabled, + Optional billingPeriod, + Currencies currency, + Optional expirationDays, + String id, + double initialPrice, + PlanTypes planType, + ReleaseMethod releaseMethod, + double renewalPrice, + Optional threeDsLevel, + Optional trialPeriodDays, + Visibility visibility, + Map additionalProperties) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + this.billingPeriod = billingPeriod; + this.currency = currency; + this.expirationDays = expirationDays; + this.id = id; + this.initialPrice = initialPrice; + this.planType = planType; + this.releaseMethod = releaseMethod; + this.renewalPrice = renewalPrice; + this.threeDsLevel = threeDsLevel; + this.trialPeriodDays = trialPeriodDays; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the creator has turned on adaptive pricing for this plan. Raw setting — does not check processor compatibility or feature flags. + */ + @JsonProperty("adaptive_pricing_enabled") + public boolean getAdaptivePricingEnabled() { + return adaptivePricingEnabled; + } + + /** + * @return Number of days between recurring charges, such as 30 for monthly or 365 for annual. null for one-time plans. + */ + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + /** + * @return The currency used for all prices on this plan (e.g., 'usd', 'eur'). All monetary amounts on the plan are denominated in this currency. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return Access duration in days for expiration-based plans, such as 365 for a one-year pass. + */ + @JsonIgnore + public Optional getExpirationDays() { + if (expirationDays == null) { + return Optional.empty(); + } + return expirationDays; + } + + /** + * @return The unique identifier for the plan. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The initial purchase price in the plan's base_currency (e.g., 49.99 for $49.99). For one-time plans, this is the full price. For renewal plans, this is charged on top of the first renewal_price. + */ + @JsonProperty("initial_price") + public double getInitialPrice() { + return initialPrice; + } + + /** + * @return The billing model for this plan: 'renewal' for recurring subscriptions or 'one_time' for single payments. + */ + @JsonProperty("plan_type") + public PlanTypes getPlanType() { + return planType; + } + + /** + * @return Sales method for this plan: buy_now for immediate purchase or waitlist for waitlist-based access. + */ + @JsonProperty("release_method") + public ReleaseMethod getReleaseMethod() { + return releaseMethod; + } + + /** + * @return The recurring price charged every billing_period in the plan's base_currency (e.g., 9.99 for $9.99/period). Zero for one-time plans. + */ + @JsonProperty("renewal_price") + public double getRenewalPrice() { + return renewalPrice; + } + + /** + * @return The 3D Secure behavior for this plan. Null means the plan inherits the account default. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return Free trial days before first renewal charge. null if no trial is configured or the user has already used a trial for this plan. + */ + @JsonIgnore + public Optional getTrialPeriodDays() { + if (trialPeriodDays == null) { + return Optional.empty(); + } + return trialPeriodDays; + } + + /** + * @return Controls whether the plan is visible to customers. When set to 'hidden', the plan is only accessible via direct link. + */ + @JsonProperty("visibility") + public Visibility getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_days") + private Optional _getExpirationDays() { + return expirationDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trial_period_days") + private Optional _getTrialPeriodDays() { + return trialPeriodDays; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckoutConfigurationListItemPlan && equalTo((CheckoutConfigurationListItemPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CheckoutConfigurationListItemPlan other) { + return adaptivePricingEnabled == other.adaptivePricingEnabled + && billingPeriod.equals(other.billingPeriod) + && currency.equals(other.currency) + && expirationDays.equals(other.expirationDays) + && id.equals(other.id) + && initialPrice == other.initialPrice + && planType.equals(other.planType) + && releaseMethod.equals(other.releaseMethod) + && renewalPrice == other.renewalPrice + && threeDsLevel.equals(other.threeDsLevel) + && trialPeriodDays.equals(other.trialPeriodDays) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adaptivePricingEnabled, + this.billingPeriod, + this.currency, + this.expirationDays, + this.id, + this.initialPrice, + this.planType, + this.releaseMethod, + this.renewalPrice, + this.threeDsLevel, + this.trialPeriodDays, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdaptivePricingEnabledStage builder() { + return new Builder(); + } + + public interface AdaptivePricingEnabledStage { + /** + *

Whether the creator has turned on adaptive pricing for this plan. Raw setting — does not check processor compatibility or feature flags.

+ */ + CurrencyStage adaptivePricingEnabled(boolean adaptivePricingEnabled); + + Builder from(CheckoutConfigurationListItemPlan other); + } + + public interface CurrencyStage { + /** + *

The currency used for all prices on this plan (e.g., 'usd', 'eur'). All monetary amounts on the plan are denominated in this currency.

+ */ + IdStage currency(@NotNull Currencies currency); + } + + public interface IdStage { + /** + *

The unique identifier for the plan.

+ */ + InitialPriceStage id(@NotNull String id); + } + + public interface InitialPriceStage { + /** + *

The initial purchase price in the plan's base_currency (e.g., 49.99 for $49.99). For one-time plans, this is the full price. For renewal plans, this is charged on top of the first renewal_price.

+ */ + PlanTypeStage initialPrice(double initialPrice); + } + + public interface PlanTypeStage { + /** + *

The billing model for this plan: 'renewal' for recurring subscriptions or 'one_time' for single payments.

+ */ + ReleaseMethodStage planType(@NotNull PlanTypes planType); + } + + public interface ReleaseMethodStage { + /** + *

Sales method for this plan: buy_now for immediate purchase or waitlist for waitlist-based access.

+ */ + RenewalPriceStage releaseMethod(@NotNull ReleaseMethod releaseMethod); + } + + public interface RenewalPriceStage { + /** + *

The recurring price charged every billing_period in the plan's base_currency (e.g., 9.99 for $9.99/period). Zero for one-time plans.

+ */ + VisibilityStage renewalPrice(double renewalPrice); + } + + public interface VisibilityStage { + /** + *

Controls whether the plan is visible to customers. When set to 'hidden', the plan is only accessible via direct link.

+ */ + _FinalStage visibility(@NotNull Visibility visibility); + } + + public interface _FinalStage { + CheckoutConfigurationListItemPlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Number of days between recurring charges, such as 30 for monthly or 365 for annual. null for one-time plans.

+ */ + _FinalStage billingPeriod(Optional billingPeriod); + + _FinalStage billingPeriod(Integer billingPeriod); + + _FinalStage billingPeriod(Nullable billingPeriod); + + /** + *

Access duration in days for expiration-based plans, such as 365 for a one-year pass.

+ */ + _FinalStage expirationDays(Optional expirationDays); + + _FinalStage expirationDays(Integer expirationDays); + + _FinalStage expirationDays(Nullable expirationDays); + + /** + *

The 3D Secure behavior for this plan. Null means the plan inherits the account default.

+ */ + _FinalStage threeDsLevel(Optional threeDsLevel); + + _FinalStage threeDsLevel(PlanThreeDsLevels threeDsLevel); + + _FinalStage threeDsLevel(Nullable threeDsLevel); + + /** + *

Free trial days before first renewal charge. null if no trial is configured or the user has already used a trial for this plan.

+ */ + _FinalStage trialPeriodDays(Optional trialPeriodDays); + + _FinalStage trialPeriodDays(Integer trialPeriodDays); + + _FinalStage trialPeriodDays(Nullable trialPeriodDays); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AdaptivePricingEnabledStage, + CurrencyStage, + IdStage, + InitialPriceStage, + PlanTypeStage, + ReleaseMethodStage, + RenewalPriceStage, + VisibilityStage, + _FinalStage { + private boolean adaptivePricingEnabled; + + private Currencies currency; + + private String id; + + private double initialPrice; + + private PlanTypes planType; + + private ReleaseMethod releaseMethod; + + private double renewalPrice; + + private Visibility visibility; + + private Optional trialPeriodDays = Optional.empty(); + + private Optional threeDsLevel = Optional.empty(); + + private Optional expirationDays = Optional.empty(); + + private Optional billingPeriod = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CheckoutConfigurationListItemPlan other) { + adaptivePricingEnabled(other.getAdaptivePricingEnabled()); + billingPeriod(other.getBillingPeriod()); + currency(other.getCurrency()); + expirationDays(other.getExpirationDays()); + id(other.getId()); + initialPrice(other.getInitialPrice()); + planType(other.getPlanType()); + releaseMethod(other.getReleaseMethod()); + renewalPrice(other.getRenewalPrice()); + threeDsLevel(other.getThreeDsLevel()); + trialPeriodDays(other.getTrialPeriodDays()); + visibility(other.getVisibility()); + return this; + } + + /** + *

Whether the creator has turned on adaptive pricing for this plan. Raw setting — does not check processor compatibility or feature flags.

+ *

Whether the creator has turned on adaptive pricing for this plan. Raw setting — does not check processor compatibility or feature flags.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("adaptive_pricing_enabled") + public CurrencyStage adaptivePricingEnabled(boolean adaptivePricingEnabled) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + return this; + } + + /** + *

The currency used for all prices on this plan (e.g., 'usd', 'eur'). All monetary amounts on the plan are denominated in this currency.

+ *

The currency used for all prices on this plan (e.g., 'usd', 'eur'). All monetary amounts on the plan are denominated in this currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier for the plan.

+ *

The unique identifier for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public InitialPriceStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The initial purchase price in the plan's base_currency (e.g., 49.99 for $49.99). For one-time plans, this is the full price. For renewal plans, this is charged on top of the first renewal_price.

+ *

The initial purchase price in the plan's base_currency (e.g., 49.99 for $49.99). For one-time plans, this is the full price. For renewal plans, this is charged on top of the first renewal_price.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("initial_price") + public PlanTypeStage initialPrice(double initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + /** + *

The billing model for this plan: 'renewal' for recurring subscriptions or 'one_time' for single payments.

+ *

The billing model for this plan: 'renewal' for recurring subscriptions or 'one_time' for single payments.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan_type") + public ReleaseMethodStage planType(@NotNull PlanTypes planType) { + this.planType = Objects.requireNonNull(planType, "planType must not be null"); + return this; + } + + /** + *

Sales method for this plan: buy_now for immediate purchase or waitlist for waitlist-based access.

+ *

Sales method for this plan: buy_now for immediate purchase or waitlist for waitlist-based access.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("release_method") + public RenewalPriceStage releaseMethod(@NotNull ReleaseMethod releaseMethod) { + this.releaseMethod = Objects.requireNonNull(releaseMethod, "releaseMethod must not be null"); + return this; + } + + /** + *

The recurring price charged every billing_period in the plan's base_currency (e.g., 9.99 for $9.99/period). Zero for one-time plans.

+ *

The recurring price charged every billing_period in the plan's base_currency (e.g., 9.99 for $9.99/period). Zero for one-time plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("renewal_price") + public VisibilityStage renewalPrice(double renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + /** + *

Controls whether the plan is visible to customers. When set to 'hidden', the plan is only accessible via direct link.

+ *

Controls whether the plan is visible to customers. When set to 'hidden', the plan is only accessible via direct link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("visibility") + public _FinalStage visibility(@NotNull Visibility visibility) { + this.visibility = Objects.requireNonNull(visibility, "visibility must not be null"); + return this; + } + + /** + *

Free trial days before first renewal charge. null if no trial is configured or the user has already used a trial for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Nullable trialPeriodDays) { + if (trialPeriodDays.isNull()) { + this.trialPeriodDays = null; + } else if (trialPeriodDays.isEmpty()) { + this.trialPeriodDays = Optional.empty(); + } else { + this.trialPeriodDays = Optional.of(trialPeriodDays.get()); + } + return this; + } + + /** + *

Free trial days before first renewal charge. null if no trial is configured or the user has already used a trial for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Integer trialPeriodDays) { + this.trialPeriodDays = Optional.ofNullable(trialPeriodDays); + return this; + } + + /** + *

Free trial days before first renewal charge. null if no trial is configured or the user has already used a trial for this plan.

+ */ + @java.lang.Override + @JsonSetter(value = "trial_period_days", nulls = Nulls.SKIP) + public _FinalStage trialPeriodDays(Optional trialPeriodDays) { + this.trialPeriodDays = trialPeriodDays; + return this; + } + + /** + *

The 3D Secure behavior for this plan. Null means the plan inherits the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

The 3D Secure behavior for this plan. Null means the plan inherits the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(PlanThreeDsLevels threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + /** + *

The 3D Secure behavior for this plan. Null means the plan inherits the account default.

+ */ + @java.lang.Override + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public _FinalStage threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + /** + *

Access duration in days for expiration-based plans, such as 365 for a one-year pass.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Nullable expirationDays) { + if (expirationDays.isNull()) { + this.expirationDays = null; + } else if (expirationDays.isEmpty()) { + this.expirationDays = Optional.empty(); + } else { + this.expirationDays = Optional.of(expirationDays.get()); + } + return this; + } + + /** + *

Access duration in days for expiration-based plans, such as 365 for a one-year pass.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Integer expirationDays) { + this.expirationDays = Optional.ofNullable(expirationDays); + return this; + } + + /** + *

Access duration in days for expiration-based plans, such as 365 for a one-year pass.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_days", nulls = Nulls.SKIP) + public _FinalStage expirationDays(Optional expirationDays) { + this.expirationDays = expirationDays; + return this; + } + + /** + *

Number of days between recurring charges, such as 30 for monthly or 365 for annual. null for one-time plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + /** + *

Number of days between recurring charges, such as 30 for monthly or 365 for annual. null for one-time plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Integer billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + /** + *

Number of days between recurring charges, such as 30 for monthly or 365 for annual. null for one-time plans.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public _FinalStage billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + @java.lang.Override + public CheckoutConfigurationListItemPlan build() { + return new CheckoutConfigurationListItemPlan( + adaptivePricingEnabled, + billingPeriod, + currency, + expirationDays, + id, + initialPrice, + planType, + releaseMethod, + renewalPrice, + threeDsLevel, + trialPeriodDays, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutConfigurationMode.java b/src/main/java/com/whop/api/types/CheckoutConfigurationMode.java new file mode 100644 index 00000000..1763be6a --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutConfigurationMode.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CheckoutConfigurationMode { + public static final CheckoutConfigurationMode SETUP = new CheckoutConfigurationMode(Value.SETUP, "setup"); + + public static final CheckoutConfigurationMode PAYMENT = new CheckoutConfigurationMode(Value.PAYMENT, "payment"); + + private final Value value; + + private final String string; + + CheckoutConfigurationMode(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CheckoutConfigurationMode + && this.string.equals(((CheckoutConfigurationMode) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SETUP: + return visitor.visitSetup(); + case PAYMENT: + return visitor.visitPayment(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CheckoutConfigurationMode valueOf(String value) { + switch (value) { + case "setup": + return SETUP; + case "payment": + return PAYMENT; + default: + return new CheckoutConfigurationMode(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYMENT, + + SETUP, + + UNKNOWN + } + + public interface Visitor { + T visitPayment(); + + T visitSetup(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutConfigurationPlan.java b/src/main/java/com/whop/api/types/CheckoutConfigurationPlan.java new file mode 100644 index 00000000..b7b8b7c7 --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutConfigurationPlan.java @@ -0,0 +1,695 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CheckoutConfigurationPlan.Builder.class) +public final class CheckoutConfigurationPlan { + private final boolean adaptivePricingEnabled; + + private final Optional billingPeriod; + + private final String currency; + + private final Optional expirationDays; + + private final String id; + + private final double initialPrice; + + private final CheckoutConfigurationPlanPlanType planType; + + private final CheckoutConfigurationPlanReleaseMethod releaseMethod; + + private final double renewalPrice; + + private final Optional threeDsLevel; + + private final Optional trialPeriodDays; + + private final CheckoutConfigurationPlanVisibility visibility; + + private final Map additionalProperties; + + private CheckoutConfigurationPlan( + boolean adaptivePricingEnabled, + Optional billingPeriod, + String currency, + Optional expirationDays, + String id, + double initialPrice, + CheckoutConfigurationPlanPlanType planType, + CheckoutConfigurationPlanReleaseMethod releaseMethod, + double renewalPrice, + Optional threeDsLevel, + Optional trialPeriodDays, + CheckoutConfigurationPlanVisibility visibility, + Map additionalProperties) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + this.billingPeriod = billingPeriod; + this.currency = currency; + this.expirationDays = expirationDays; + this.id = id; + this.initialPrice = initialPrice; + this.planType = planType; + this.releaseMethod = releaseMethod; + this.renewalPrice = renewalPrice; + this.threeDsLevel = threeDsLevel; + this.trialPeriodDays = trialPeriodDays; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether this plan accepts local currency payments via adaptive pricing. + */ + @JsonProperty("adaptive_pricing_enabled") + public boolean getAdaptivePricingEnabled() { + return adaptivePricingEnabled; + } + + /** + * @return Recurring billing interval in days. + */ + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + /** + * @return Three-letter ISO currency code for the plan's prices. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Access duration in days for expiration-based plans. + */ + @JsonIgnore + public Optional getExpirationDays() { + if (expirationDays == null) { + return Optional.empty(); + } + return expirationDays; + } + + /** + * @return Plan ID, prefixed plan_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Initial purchase price in the plan currency. + */ + @JsonProperty("initial_price") + public double getInitialPrice() { + return initialPrice; + } + + /** + * @return Billing model for the plan. + */ + @JsonProperty("plan_type") + public CheckoutConfigurationPlanPlanType getPlanType() { + return planType; + } + + /** + * @return Sales method for the plan. + */ + @JsonProperty("release_method") + public CheckoutConfigurationPlanReleaseMethod getReleaseMethod() { + return releaseMethod; + } + + /** + * @return Recurring price charged each billing period. + */ + @JsonProperty("renewal_price") + public double getRenewalPrice() { + return renewalPrice; + } + + /** + * @return 3D Secure behavior for this plan, or null to use the account default. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return Free trial days before the first renewal charge. + */ + @JsonIgnore + public Optional getTrialPeriodDays() { + if (trialPeriodDays == null) { + return Optional.empty(); + } + return trialPeriodDays; + } + + /** + * @return Whether the plan is visible to customers or hidden from public view. + */ + @JsonProperty("visibility") + public CheckoutConfigurationPlanVisibility getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_days") + private Optional _getExpirationDays() { + return expirationDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trial_period_days") + private Optional _getTrialPeriodDays() { + return trialPeriodDays; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckoutConfigurationPlan && equalTo((CheckoutConfigurationPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CheckoutConfigurationPlan other) { + return adaptivePricingEnabled == other.adaptivePricingEnabled + && billingPeriod.equals(other.billingPeriod) + && currency.equals(other.currency) + && expirationDays.equals(other.expirationDays) + && id.equals(other.id) + && initialPrice == other.initialPrice + && planType.equals(other.planType) + && releaseMethod.equals(other.releaseMethod) + && renewalPrice == other.renewalPrice + && threeDsLevel.equals(other.threeDsLevel) + && trialPeriodDays.equals(other.trialPeriodDays) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.adaptivePricingEnabled, + this.billingPeriod, + this.currency, + this.expirationDays, + this.id, + this.initialPrice, + this.planType, + this.releaseMethod, + this.renewalPrice, + this.threeDsLevel, + this.trialPeriodDays, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdaptivePricingEnabledStage builder() { + return new Builder(); + } + + public interface AdaptivePricingEnabledStage { + /** + *

Whether this plan accepts local currency payments via adaptive pricing.

+ */ + CurrencyStage adaptivePricingEnabled(boolean adaptivePricingEnabled); + + Builder from(CheckoutConfigurationPlan other); + } + + public interface CurrencyStage { + /** + *

Three-letter ISO currency code for the plan's prices.

+ */ + IdStage currency(@NotNull String currency); + } + + public interface IdStage { + /** + *

Plan ID, prefixed plan_.

+ */ + InitialPriceStage id(@NotNull String id); + } + + public interface InitialPriceStage { + /** + *

Initial purchase price in the plan currency.

+ */ + PlanTypeStage initialPrice(double initialPrice); + } + + public interface PlanTypeStage { + /** + *

Billing model for the plan.

+ */ + ReleaseMethodStage planType(@NotNull CheckoutConfigurationPlanPlanType planType); + } + + public interface ReleaseMethodStage { + /** + *

Sales method for the plan.

+ */ + RenewalPriceStage releaseMethod(@NotNull CheckoutConfigurationPlanReleaseMethod releaseMethod); + } + + public interface RenewalPriceStage { + /** + *

Recurring price charged each billing period.

+ */ + VisibilityStage renewalPrice(double renewalPrice); + } + + public interface VisibilityStage { + /** + *

Whether the plan is visible to customers or hidden from public view.

+ */ + _FinalStage visibility(@NotNull CheckoutConfigurationPlanVisibility visibility); + } + + public interface _FinalStage { + CheckoutConfigurationPlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Recurring billing interval in days.

+ */ + _FinalStage billingPeriod(Optional billingPeriod); + + _FinalStage billingPeriod(Integer billingPeriod); + + _FinalStage billingPeriod(Nullable billingPeriod); + + /** + *

Access duration in days for expiration-based plans.

+ */ + _FinalStage expirationDays(Optional expirationDays); + + _FinalStage expirationDays(Integer expirationDays); + + _FinalStage expirationDays(Nullable expirationDays); + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ */ + _FinalStage threeDsLevel(Optional threeDsLevel); + + _FinalStage threeDsLevel(CheckoutConfigurationPlanThreeDsLevel threeDsLevel); + + _FinalStage threeDsLevel(Nullable threeDsLevel); + + /** + *

Free trial days before the first renewal charge.

+ */ + _FinalStage trialPeriodDays(Optional trialPeriodDays); + + _FinalStage trialPeriodDays(Integer trialPeriodDays); + + _FinalStage trialPeriodDays(Nullable trialPeriodDays); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AdaptivePricingEnabledStage, + CurrencyStage, + IdStage, + InitialPriceStage, + PlanTypeStage, + ReleaseMethodStage, + RenewalPriceStage, + VisibilityStage, + _FinalStage { + private boolean adaptivePricingEnabled; + + private String currency; + + private String id; + + private double initialPrice; + + private CheckoutConfigurationPlanPlanType planType; + + private CheckoutConfigurationPlanReleaseMethod releaseMethod; + + private double renewalPrice; + + private CheckoutConfigurationPlanVisibility visibility; + + private Optional trialPeriodDays = Optional.empty(); + + private Optional threeDsLevel = Optional.empty(); + + private Optional expirationDays = Optional.empty(); + + private Optional billingPeriod = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CheckoutConfigurationPlan other) { + adaptivePricingEnabled(other.getAdaptivePricingEnabled()); + billingPeriod(other.getBillingPeriod()); + currency(other.getCurrency()); + expirationDays(other.getExpirationDays()); + id(other.getId()); + initialPrice(other.getInitialPrice()); + planType(other.getPlanType()); + releaseMethod(other.getReleaseMethod()); + renewalPrice(other.getRenewalPrice()); + threeDsLevel(other.getThreeDsLevel()); + trialPeriodDays(other.getTrialPeriodDays()); + visibility(other.getVisibility()); + return this; + } + + /** + *

Whether this plan accepts local currency payments via adaptive pricing.

+ *

Whether this plan accepts local currency payments via adaptive pricing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("adaptive_pricing_enabled") + public CurrencyStage adaptivePricingEnabled(boolean adaptivePricingEnabled) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + return this; + } + + /** + *

Three-letter ISO currency code for the plan's prices.

+ *

Three-letter ISO currency code for the plan's prices.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Plan ID, prefixed plan_.

+ *

Plan ID, prefixed plan_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public InitialPriceStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Initial purchase price in the plan currency.

+ *

Initial purchase price in the plan currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("initial_price") + public PlanTypeStage initialPrice(double initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + /** + *

Billing model for the plan.

+ *

Billing model for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan_type") + public ReleaseMethodStage planType(@NotNull CheckoutConfigurationPlanPlanType planType) { + this.planType = Objects.requireNonNull(planType, "planType must not be null"); + return this; + } + + /** + *

Sales method for the plan.

+ *

Sales method for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("release_method") + public RenewalPriceStage releaseMethod(@NotNull CheckoutConfigurationPlanReleaseMethod releaseMethod) { + this.releaseMethod = Objects.requireNonNull(releaseMethod, "releaseMethod must not be null"); + return this; + } + + /** + *

Recurring price charged each billing period.

+ *

Recurring price charged each billing period.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("renewal_price") + public VisibilityStage renewalPrice(double renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + /** + *

Whether the plan is visible to customers or hidden from public view.

+ *

Whether the plan is visible to customers or hidden from public view.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("visibility") + public _FinalStage visibility(@NotNull CheckoutConfigurationPlanVisibility visibility) { + this.visibility = Objects.requireNonNull(visibility, "visibility must not be null"); + return this; + } + + /** + *

Free trial days before the first renewal charge.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Nullable trialPeriodDays) { + if (trialPeriodDays.isNull()) { + this.trialPeriodDays = null; + } else if (trialPeriodDays.isEmpty()) { + this.trialPeriodDays = Optional.empty(); + } else { + this.trialPeriodDays = Optional.of(trialPeriodDays.get()); + } + return this; + } + + /** + *

Free trial days before the first renewal charge.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Integer trialPeriodDays) { + this.trialPeriodDays = Optional.ofNullable(trialPeriodDays); + return this; + } + + /** + *

Free trial days before the first renewal charge.

+ */ + @java.lang.Override + @JsonSetter(value = "trial_period_days", nulls = Nulls.SKIP) + public _FinalStage trialPeriodDays(Optional trialPeriodDays) { + this.trialPeriodDays = trialPeriodDays; + return this; + } + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(CheckoutConfigurationPlanThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + /** + *

3D Secure behavior for this plan, or null to use the account default.

+ */ + @java.lang.Override + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public _FinalStage threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + /** + *

Access duration in days for expiration-based plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Nullable expirationDays) { + if (expirationDays.isNull()) { + this.expirationDays = null; + } else if (expirationDays.isEmpty()) { + this.expirationDays = Optional.empty(); + } else { + this.expirationDays = Optional.of(expirationDays.get()); + } + return this; + } + + /** + *

Access duration in days for expiration-based plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Integer expirationDays) { + this.expirationDays = Optional.ofNullable(expirationDays); + return this; + } + + /** + *

Access duration in days for expiration-based plans.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_days", nulls = Nulls.SKIP) + public _FinalStage expirationDays(Optional expirationDays) { + this.expirationDays = expirationDays; + return this; + } + + /** + *

Recurring billing interval in days.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + /** + *

Recurring billing interval in days.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Integer billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + /** + *

Recurring billing interval in days.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public _FinalStage billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + @java.lang.Override + public CheckoutConfigurationPlan build() { + return new CheckoutConfigurationPlan( + adaptivePricingEnabled, + billingPeriod, + currency, + expirationDays, + id, + initialPrice, + planType, + releaseMethod, + renewalPrice, + threeDsLevel, + trialPeriodDays, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutConfigurationPlanPlanType.java b/src/main/java/com/whop/api/types/CheckoutConfigurationPlanPlanType.java new file mode 100644 index 00000000..187c4f42 --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutConfigurationPlanPlanType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CheckoutConfigurationPlanPlanType { + public static final CheckoutConfigurationPlanPlanType RENEWAL = + new CheckoutConfigurationPlanPlanType(Value.RENEWAL, "renewal"); + + public static final CheckoutConfigurationPlanPlanType ONE_TIME = + new CheckoutConfigurationPlanPlanType(Value.ONE_TIME, "one_time"); + + private final Value value; + + private final String string; + + CheckoutConfigurationPlanPlanType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CheckoutConfigurationPlanPlanType + && this.string.equals(((CheckoutConfigurationPlanPlanType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RENEWAL: + return visitor.visitRenewal(); + case ONE_TIME: + return visitor.visitOneTime(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CheckoutConfigurationPlanPlanType valueOf(String value) { + switch (value) { + case "renewal": + return RENEWAL; + case "one_time": + return ONE_TIME; + default: + return new CheckoutConfigurationPlanPlanType(Value.UNKNOWN, value); + } + } + + public enum Value { + RENEWAL, + + ONE_TIME, + + UNKNOWN + } + + public interface Visitor { + T visitRenewal(); + + T visitOneTime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutConfigurationPlanReleaseMethod.java b/src/main/java/com/whop/api/types/CheckoutConfigurationPlanReleaseMethod.java new file mode 100644 index 00000000..86752d2a --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutConfigurationPlanReleaseMethod.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CheckoutConfigurationPlanReleaseMethod { + public static final CheckoutConfigurationPlanReleaseMethod WAITLIST = + new CheckoutConfigurationPlanReleaseMethod(Value.WAITLIST, "waitlist"); + + public static final CheckoutConfigurationPlanReleaseMethod BUY_NOW = + new CheckoutConfigurationPlanReleaseMethod(Value.BUY_NOW, "buy_now"); + + private final Value value; + + private final String string; + + CheckoutConfigurationPlanReleaseMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CheckoutConfigurationPlanReleaseMethod + && this.string.equals(((CheckoutConfigurationPlanReleaseMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WAITLIST: + return visitor.visitWaitlist(); + case BUY_NOW: + return visitor.visitBuyNow(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CheckoutConfigurationPlanReleaseMethod valueOf(String value) { + switch (value) { + case "waitlist": + return WAITLIST; + case "buy_now": + return BUY_NOW; + default: + return new CheckoutConfigurationPlanReleaseMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + BUY_NOW, + + WAITLIST, + + UNKNOWN + } + + public interface Visitor { + T visitBuyNow(); + + T visitWaitlist(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutConfigurationPlanThreeDsLevel.java b/src/main/java/com/whop/api/types/CheckoutConfigurationPlanThreeDsLevel.java new file mode 100644 index 00000000..96491544 --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutConfigurationPlanThreeDsLevel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CheckoutConfigurationPlanThreeDsLevel { + public static final CheckoutConfigurationPlanThreeDsLevel MANDATE_CHALLENGE = + new CheckoutConfigurationPlanThreeDsLevel(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + public static final CheckoutConfigurationPlanThreeDsLevel FRICTIONLESS = + new CheckoutConfigurationPlanThreeDsLevel(Value.FRICTIONLESS, "frictionless"); + + private final Value value; + + private final String string; + + CheckoutConfigurationPlanThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CheckoutConfigurationPlanThreeDsLevel + && this.string.equals(((CheckoutConfigurationPlanThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case FRICTIONLESS: + return visitor.visitFrictionless(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CheckoutConfigurationPlanThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + case "frictionless": + return FRICTIONLESS; + default: + return new CheckoutConfigurationPlanThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + FRICTIONLESS, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitFrictionless(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutConfigurationPlanVisibility.java b/src/main/java/com/whop/api/types/CheckoutConfigurationPlanVisibility.java new file mode 100644 index 00000000..1c1fa45a --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutConfigurationPlanVisibility.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CheckoutConfigurationPlanVisibility { + public static final CheckoutConfigurationPlanVisibility VISIBLE = + new CheckoutConfigurationPlanVisibility(Value.VISIBLE, "visible"); + + public static final CheckoutConfigurationPlanVisibility HIDDEN = + new CheckoutConfigurationPlanVisibility(Value.HIDDEN, "hidden"); + + public static final CheckoutConfigurationPlanVisibility QUICK_LINK = + new CheckoutConfigurationPlanVisibility(Value.QUICK_LINK, "quick_link"); + + public static final CheckoutConfigurationPlanVisibility ARCHIVED = + new CheckoutConfigurationPlanVisibility(Value.ARCHIVED, "archived"); + + private final Value value; + + private final String string; + + CheckoutConfigurationPlanVisibility(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CheckoutConfigurationPlanVisibility + && this.string.equals(((CheckoutConfigurationPlanVisibility) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VISIBLE: + return visitor.visitVisible(); + case HIDDEN: + return visitor.visitHidden(); + case QUICK_LINK: + return visitor.visitQuickLink(); + case ARCHIVED: + return visitor.visitArchived(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CheckoutConfigurationPlanVisibility valueOf(String value) { + switch (value) { + case "visible": + return VISIBLE; + case "hidden": + return HIDDEN; + case "quick_link": + return QUICK_LINK; + case "archived": + return ARCHIVED; + default: + return new CheckoutConfigurationPlanVisibility(Value.UNKNOWN, value); + } + } + + public enum Value { + VISIBLE, + + HIDDEN, + + ARCHIVED, + + QUICK_LINK, + + UNKNOWN + } + + public interface Visitor { + T visitVisible(); + + T visitHidden(); + + T visitArchived(); + + T visitQuickLink(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutConfigurationThreeDsLevel.java b/src/main/java/com/whop/api/types/CheckoutConfigurationThreeDsLevel.java new file mode 100644 index 00000000..54d74ceb --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutConfigurationThreeDsLevel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CheckoutConfigurationThreeDsLevel { + public static final CheckoutConfigurationThreeDsLevel MANDATE_CHALLENGE = + new CheckoutConfigurationThreeDsLevel(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + public static final CheckoutConfigurationThreeDsLevel FRICTIONLESS = + new CheckoutConfigurationThreeDsLevel(Value.FRICTIONLESS, "frictionless"); + + private final Value value; + + private final String string; + + CheckoutConfigurationThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CheckoutConfigurationThreeDsLevel + && this.string.equals(((CheckoutConfigurationThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case FRICTIONLESS: + return visitor.visitFrictionless(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CheckoutConfigurationThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + case "frictionless": + return FRICTIONLESS; + default: + return new CheckoutConfigurationThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + FRICTIONLESS, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitFrictionless(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutFonts.java b/src/main/java/com/whop/api/types/CheckoutFonts.java new file mode 100644 index 00000000..e561a875 --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutFonts.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CheckoutFonts { + public static final CheckoutFonts ROBOTO = new CheckoutFonts(Value.ROBOTO, "roboto"); + + public static final CheckoutFonts OPEN_SANS = new CheckoutFonts(Value.OPEN_SANS, "open_sans"); + + public static final CheckoutFonts SYSTEM = new CheckoutFonts(Value.SYSTEM, "system"); + + private final Value value; + + private final String string; + + CheckoutFonts(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CheckoutFonts && this.string.equals(((CheckoutFonts) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ROBOTO: + return visitor.visitRoboto(); + case OPEN_SANS: + return visitor.visitOpenSans(); + case SYSTEM: + return visitor.visitSystem(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CheckoutFonts valueOf(String value) { + switch (value) { + case "roboto": + return ROBOTO; + case "open_sans": + return OPEN_SANS; + case "system": + return SYSTEM; + default: + return new CheckoutFonts(Value.UNKNOWN, value); + } + } + + public enum Value { + SYSTEM, + + ROBOTO, + + OPEN_SANS, + + UNKNOWN + } + + public interface Visitor { + T visitSystem(); + + T visitRoboto(); + + T visitOpenSans(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutModes.java b/src/main/java/com/whop/api/types/CheckoutModes.java new file mode 100644 index 00000000..3db74ea8 --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutModes.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CheckoutModes { + public static final CheckoutModes SETUP = new CheckoutModes(Value.SETUP, "setup"); + + public static final CheckoutModes PAYMENT = new CheckoutModes(Value.PAYMENT, "payment"); + + private final Value value; + + private final String string; + + CheckoutModes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CheckoutModes && this.string.equals(((CheckoutModes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SETUP: + return visitor.visitSetup(); + case PAYMENT: + return visitor.visitPayment(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CheckoutModes valueOf(String value) { + switch (value) { + case "setup": + return SETUP; + case "payment": + return PAYMENT; + default: + return new CheckoutModes(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYMENT, + + SETUP, + + UNKNOWN + } + + public interface Visitor { + T visitPayment(); + + T visitSetup(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutSessionPaymentMethodConfiguration.java b/src/main/java/com/whop/api/types/CheckoutSessionPaymentMethodConfiguration.java new file mode 100644 index 00000000..13fba2b7 --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutSessionPaymentMethodConfiguration.java @@ -0,0 +1,221 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CheckoutSessionPaymentMethodConfiguration.Builder.class) +public final class CheckoutSessionPaymentMethodConfiguration { + private final List disabled; + + private final List enabled; + + private final boolean includePlatformDefaults; + + private final Map additionalProperties; + + private CheckoutSessionPaymentMethodConfiguration( + List disabled, + List enabled, + boolean includePlatformDefaults, + Map additionalProperties) { + this.disabled = disabled; + this.enabled = enabled; + this.includePlatformDefaults = includePlatformDefaults; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("disabled") + public List getDisabled() { + return disabled; + } + + @JsonProperty("enabled") + public List getEnabled() { + return enabled; + } + + /** + * @return Whether Whop's default set is the starting point. When false, only enabled is offered. + */ + @JsonProperty("include_platform_defaults") + public boolean getIncludePlatformDefaults() { + return includePlatformDefaults; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckoutSessionPaymentMethodConfiguration + && equalTo((CheckoutSessionPaymentMethodConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CheckoutSessionPaymentMethodConfiguration other) { + return disabled.equals(other.disabled) + && enabled.equals(other.enabled) + && includePlatformDefaults == other.includePlatformDefaults; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.disabled, this.enabled, this.includePlatformDefaults); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IncludePlatformDefaultsStage builder() { + return new Builder(); + } + + public interface IncludePlatformDefaultsStage { + /** + *

Whether Whop's default set is the starting point. When false, only enabled is offered.

+ */ + _FinalStage includePlatformDefaults(boolean includePlatformDefaults); + + Builder from(CheckoutSessionPaymentMethodConfiguration other); + } + + public interface _FinalStage { + CheckoutSessionPaymentMethodConfiguration build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage disabled(List disabled); + + _FinalStage addDisabled(String disabled); + + _FinalStage addAllDisabled(List disabled); + + _FinalStage enabled(List enabled); + + _FinalStage addEnabled(String enabled); + + _FinalStage addAllEnabled(List enabled); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IncludePlatformDefaultsStage, _FinalStage { + private boolean includePlatformDefaults; + + private List enabled = new ArrayList<>(); + + private List disabled = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CheckoutSessionPaymentMethodConfiguration other) { + disabled(other.getDisabled()); + enabled(other.getEnabled()); + includePlatformDefaults(other.getIncludePlatformDefaults()); + return this; + } + + /** + *

Whether Whop's default set is the starting point. When false, only enabled is offered.

+ *

Whether Whop's default set is the starting point. When false, only enabled is offered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("include_platform_defaults") + public _FinalStage includePlatformDefaults(boolean includePlatformDefaults) { + this.includePlatformDefaults = includePlatformDefaults; + return this; + } + + @java.lang.Override + public _FinalStage addAllEnabled(List enabled) { + if (enabled != null) { + this.enabled.addAll(enabled); + } + return this; + } + + @java.lang.Override + public _FinalStage addEnabled(String enabled) { + this.enabled.add(enabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public _FinalStage enabled(List enabled) { + this.enabled.clear(); + if (enabled != null) { + this.enabled.addAll(enabled); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllDisabled(List disabled) { + if (disabled != null) { + this.disabled.addAll(disabled); + } + return this; + } + + @java.lang.Override + public _FinalStage addDisabled(String disabled) { + this.disabled.add(disabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public _FinalStage disabled(List disabled) { + this.disabled.clear(); + if (disabled != null) { + this.disabled.addAll(disabled); + } + return this; + } + + @java.lang.Override + public CheckoutSessionPaymentMethodConfiguration build() { + return new CheckoutSessionPaymentMethodConfiguration( + disabled, enabled, includePlatformDefaults, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CheckoutShapes.java b/src/main/java/com/whop/api/types/CheckoutShapes.java new file mode 100644 index 00000000..0c30cd0c --- /dev/null +++ b/src/main/java/com/whop/api/types/CheckoutShapes.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CheckoutShapes { + public static final CheckoutShapes RECTANGULAR = new CheckoutShapes(Value.RECTANGULAR, "rectangular"); + + public static final CheckoutShapes ROUNDED = new CheckoutShapes(Value.ROUNDED, "rounded"); + + public static final CheckoutShapes PILL = new CheckoutShapes(Value.PILL, "pill"); + + private final Value value; + + private final String string; + + CheckoutShapes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CheckoutShapes && this.string.equals(((CheckoutShapes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RECTANGULAR: + return visitor.visitRectangular(); + case ROUNDED: + return visitor.visitRounded(); + case PILL: + return visitor.visitPill(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CheckoutShapes valueOf(String value) { + switch (value) { + case "rectangular": + return RECTANGULAR; + case "rounded": + return ROUNDED; + case "pill": + return PILL; + default: + return new CheckoutShapes(Value.UNKNOWN, value); + } + } + + public enum Value { + ROUNDED, + + PILL, + + RECTANGULAR, + + UNKNOWN + } + + public interface Visitor { + T visitRounded(); + + T visitPill(); + + T visitRectangular(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Company.java b/src/main/java/com/whop/api/types/Company.java new file mode 100644 index 00000000..dc28c4a0 --- /dev/null +++ b/src/main/java/com/whop/api/types/Company.java @@ -0,0 +1,982 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Company.Builder.class) +public final class Company { + private final Optional affiliateInstructions; + + private final OffsetDateTime createdAt; + + private final Optional description; + + private final Optional featuredAffiliateProduct; + + private final String id; + + private final Optional logo; + + private final int memberCount; + + private final Optional> metadata; + + private final CompanyOwnerUser ownerUser; + + private final int publishedReviewsCount; + + private final String route; + + private final boolean sendCustomerEmails; + + private final List socialLinks; + + private final Optional targetAudience; + + private final String title; + + private final OffsetDateTime updatedAt; + + private final boolean verified; + + private final Map additionalProperties; + + private Company( + Optional affiliateInstructions, + OffsetDateTime createdAt, + Optional description, + Optional featuredAffiliateProduct, + String id, + Optional logo, + int memberCount, + Optional> metadata, + CompanyOwnerUser ownerUser, + int publishedReviewsCount, + String route, + boolean sendCustomerEmails, + List socialLinks, + Optional targetAudience, + String title, + OffsetDateTime updatedAt, + boolean verified, + Map additionalProperties) { + this.affiliateInstructions = affiliateInstructions; + this.createdAt = createdAt; + this.description = description; + this.featuredAffiliateProduct = featuredAffiliateProduct; + this.id = id; + this.logo = logo; + this.memberCount = memberCount; + this.metadata = metadata; + this.ownerUser = ownerUser; + this.publishedReviewsCount = publishedReviewsCount; + this.route = route; + this.sendCustomerEmails = sendCustomerEmails; + this.socialLinks = socialLinks; + this.targetAudience = targetAudience; + this.title = title; + this.updatedAt = updatedAt; + this.verified = verified; + this.additionalProperties = additionalProperties; + } + + /** + * @return Guidelines and instructions provided to affiliates explaining how to promote this company's products. + */ + @JsonIgnore + public Optional getAffiliateInstructions() { + if (affiliateInstructions == null) { + return Optional.empty(); + } + return affiliateInstructions; + } + + /** + * @return The datetime the company was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return A promotional pitch written by the company creator, displayed to potential customers on the store page. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The product featured for affiliates to promote on this company's affiliate page. Null if none is configured. + */ + @JsonIgnore + public Optional getFeaturedAffiliateProduct() { + if (featuredAffiliateProduct == null) { + return Optional.empty(); + } + return featuredAffiliateProduct; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The company's logo. + */ + @JsonIgnore + public Optional getLogo() { + if (logo == null) { + return Optional.empty(); + } + return logo; + } + + /** + * @return The total number of users who currently hold active memberships across all of this company's products. + */ + @JsonProperty("member_count") + public int getMemberCount() { + return memberCount; + } + + /** + * @return A key-value JSON object of custom metadata for this company, managed by the platform that created the account. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The user who owns and has full administrative control over this company. + */ + @JsonProperty("owner_user") + public CompanyOwnerUser getOwnerUser() { + return ownerUser; + } + + /** + * @return The total number of published customer reviews across all products for this company. + */ + @JsonProperty("published_reviews_count") + public int getPublishedReviewsCount() { + return publishedReviewsCount; + } + + /** + * @return URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return Whether Whop sends transactional emails (receipts, updates) to customers on behalf of this company. + */ + @JsonProperty("send_customer_emails") + public boolean getSendCustomerEmails() { + return sendCustomerEmails; + } + + /** + * @return The list of social media accounts and external links associated with this company. + */ + @JsonProperty("social_links") + public List getSocialLinks() { + return socialLinks; + } + + /** + * @return The target audience for the company. Null if not set. + */ + @JsonIgnore + public Optional getTargetAudience() { + if (targetAudience == null) { + return Optional.empty(); + } + return targetAudience; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return The datetime the company was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return Whether this company has been verified by Whop's trust and safety team. + */ + @JsonProperty("verified") + public boolean getVerified() { + return verified; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("affiliate_instructions") + private Optional _getAffiliateInstructions() { + return affiliateInstructions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("featured_affiliate_product") + private Optional _getFeaturedAffiliateProduct() { + return featuredAffiliateProduct; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo") + private Optional _getLogo() { + return logo; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("target_audience") + private Optional _getTargetAudience() { + return targetAudience; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Company && equalTo((Company) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Company other) { + return affiliateInstructions.equals(other.affiliateInstructions) + && createdAt.equals(other.createdAt) + && description.equals(other.description) + && featuredAffiliateProduct.equals(other.featuredAffiliateProduct) + && id.equals(other.id) + && logo.equals(other.logo) + && memberCount == other.memberCount + && metadata.equals(other.metadata) + && ownerUser.equals(other.ownerUser) + && publishedReviewsCount == other.publishedReviewsCount + && route.equals(other.route) + && sendCustomerEmails == other.sendCustomerEmails + && socialLinks.equals(other.socialLinks) + && targetAudience.equals(other.targetAudience) + && title.equals(other.title) + && updatedAt.equals(other.updatedAt) + && verified == other.verified; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.affiliateInstructions, + this.createdAt, + this.description, + this.featuredAffiliateProduct, + this.id, + this.logo, + this.memberCount, + this.metadata, + this.ownerUser, + this.publishedReviewsCount, + this.route, + this.sendCustomerEmails, + this.socialLinks, + this.targetAudience, + this.title, + this.updatedAt, + this.verified); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the company was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(Company other); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + MemberCountStage id(@NotNull String id); + } + + public interface MemberCountStage { + /** + *

The total number of users who currently hold active memberships across all of this company's products.

+ */ + OwnerUserStage memberCount(int memberCount); + } + + public interface OwnerUserStage { + /** + *

The user who owns and has full administrative control over this company.

+ */ + PublishedReviewsCountStage ownerUser(@NotNull CompanyOwnerUser ownerUser); + } + + public interface PublishedReviewsCountStage { + /** + *

The total number of published customer reviews across all products for this company.

+ */ + RouteStage publishedReviewsCount(int publishedReviewsCount); + } + + public interface RouteStage { + /** + *

URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe.

+ */ + SendCustomerEmailsStage route(@NotNull String route); + } + + public interface SendCustomerEmailsStage { + /** + *

Whether Whop sends transactional emails (receipts, updates) to customers on behalf of this company.

+ */ + TitleStage sendCustomerEmails(boolean sendCustomerEmails); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + UpdatedAtStage title(@NotNull String title); + } + + public interface UpdatedAtStage { + /** + *

The datetime the company was last updated.

+ */ + VerifiedStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface VerifiedStage { + /** + *

Whether this company has been verified by Whop's trust and safety team.

+ */ + _FinalStage verified(boolean verified); + } + + public interface _FinalStage { + Company build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Guidelines and instructions provided to affiliates explaining how to promote this company's products.

+ */ + _FinalStage affiliateInstructions(Optional affiliateInstructions); + + _FinalStage affiliateInstructions(String affiliateInstructions); + + _FinalStage affiliateInstructions(Nullable affiliateInstructions); + + /** + *

A promotional pitch written by the company creator, displayed to potential customers on the store page.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

The product featured for affiliates to promote on this company's affiliate page. Null if none is configured.

+ */ + _FinalStage featuredAffiliateProduct(Optional featuredAffiliateProduct); + + _FinalStage featuredAffiliateProduct(CompanyFeaturedAffiliateProduct featuredAffiliateProduct); + + _FinalStage featuredAffiliateProduct(Nullable featuredAffiliateProduct); + + /** + *

The company's logo.

+ */ + _FinalStage logo(Optional logo); + + _FinalStage logo(CompanyLogo logo); + + _FinalStage logo(Nullable logo); + + /** + *

A key-value JSON object of custom metadata for this company, managed by the platform that created the account.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The list of social media accounts and external links associated with this company.

+ */ + _FinalStage socialLinks(List socialLinks); + + _FinalStage addSocialLinks(CompanySocialLinksItem socialLinks); + + _FinalStage addAllSocialLinks(List socialLinks); + + /** + *

The target audience for the company. Null if not set.

+ */ + _FinalStage targetAudience(Optional targetAudience); + + _FinalStage targetAudience(String targetAudience); + + _FinalStage targetAudience(Nullable targetAudience); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + IdStage, + MemberCountStage, + OwnerUserStage, + PublishedReviewsCountStage, + RouteStage, + SendCustomerEmailsStage, + TitleStage, + UpdatedAtStage, + VerifiedStage, + _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private int memberCount; + + private CompanyOwnerUser ownerUser; + + private int publishedReviewsCount; + + private String route; + + private boolean sendCustomerEmails; + + private String title; + + private OffsetDateTime updatedAt; + + private boolean verified; + + private Optional targetAudience = Optional.empty(); + + private List socialLinks = new ArrayList<>(); + + private Optional> metadata = Optional.empty(); + + private Optional logo = Optional.empty(); + + private Optional featuredAffiliateProduct = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional affiliateInstructions = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Company other) { + affiliateInstructions(other.getAffiliateInstructions()); + createdAt(other.getCreatedAt()); + description(other.getDescription()); + featuredAffiliateProduct(other.getFeaturedAffiliateProduct()); + id(other.getId()); + logo(other.getLogo()); + memberCount(other.getMemberCount()); + metadata(other.getMetadata()); + ownerUser(other.getOwnerUser()); + publishedReviewsCount(other.getPublishedReviewsCount()); + route(other.getRoute()); + sendCustomerEmails(other.getSendCustomerEmails()); + socialLinks(other.getSocialLinks()); + targetAudience(other.getTargetAudience()); + title(other.getTitle()); + updatedAt(other.getUpdatedAt()); + verified(other.getVerified()); + return this; + } + + /** + *

The datetime the company was created.

+ *

The datetime the company was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MemberCountStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The total number of users who currently hold active memberships across all of this company's products.

+ *

The total number of users who currently hold active memberships across all of this company's products.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("member_count") + public OwnerUserStage memberCount(int memberCount) { + this.memberCount = memberCount; + return this; + } + + /** + *

The user who owns and has full administrative control over this company.

+ *

The user who owns and has full administrative control over this company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("owner_user") + public PublishedReviewsCountStage ownerUser(@NotNull CompanyOwnerUser ownerUser) { + this.ownerUser = Objects.requireNonNull(ownerUser, "ownerUser must not be null"); + return this; + } + + /** + *

The total number of published customer reviews across all products for this company.

+ *

The total number of published customer reviews across all products for this company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("published_reviews_count") + public RouteStage publishedReviewsCount(int publishedReviewsCount) { + this.publishedReviewsCount = publishedReviewsCount; + return this; + } + + /** + *

URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe.

+ *

URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public SendCustomerEmailsStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

Whether Whop sends transactional emails (receipts, updates) to customers on behalf of this company.

+ *

Whether Whop sends transactional emails (receipts, updates) to customers on behalf of this company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("send_customer_emails") + public TitleStage sendCustomerEmails(boolean sendCustomerEmails) { + this.sendCustomerEmails = sendCustomerEmails; + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public UpdatedAtStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

The datetime the company was last updated.

+ *

The datetime the company was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public VerifiedStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

Whether this company has been verified by Whop's trust and safety team.

+ *

Whether this company has been verified by Whop's trust and safety team.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("verified") + public _FinalStage verified(boolean verified) { + this.verified = verified; + return this; + } + + /** + *

The target audience for the company. Null if not set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage targetAudience(Nullable targetAudience) { + if (targetAudience.isNull()) { + this.targetAudience = null; + } else if (targetAudience.isEmpty()) { + this.targetAudience = Optional.empty(); + } else { + this.targetAudience = Optional.of(targetAudience.get()); + } + return this; + } + + /** + *

The target audience for the company. Null if not set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage targetAudience(String targetAudience) { + this.targetAudience = Optional.ofNullable(targetAudience); + return this; + } + + /** + *

The target audience for the company. Null if not set.

+ */ + @java.lang.Override + @JsonSetter(value = "target_audience", nulls = Nulls.SKIP) + public _FinalStage targetAudience(Optional targetAudience) { + this.targetAudience = targetAudience; + return this; + } + + /** + *

The list of social media accounts and external links associated with this company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllSocialLinks(List socialLinks) { + if (socialLinks != null) { + this.socialLinks.addAll(socialLinks); + } + return this; + } + + /** + *

The list of social media accounts and external links associated with this company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addSocialLinks(CompanySocialLinksItem socialLinks) { + this.socialLinks.add(socialLinks); + return this; + } + + /** + *

The list of social media accounts and external links associated with this company.

+ */ + @java.lang.Override + @JsonSetter(value = "social_links", nulls = Nulls.SKIP) + public _FinalStage socialLinks(List socialLinks) { + this.socialLinks.clear(); + if (socialLinks != null) { + this.socialLinks.addAll(socialLinks); + } + return this; + } + + /** + *

A key-value JSON object of custom metadata for this company, managed by the platform that created the account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

A key-value JSON object of custom metadata for this company, managed by the platform that created the account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

A key-value JSON object of custom metadata for this company, managed by the platform that created the account.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The company's logo.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logo(Nullable logo) { + if (logo.isNull()) { + this.logo = null; + } else if (logo.isEmpty()) { + this.logo = Optional.empty(); + } else { + this.logo = Optional.of(logo.get()); + } + return this; + } + + /** + *

The company's logo.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logo(CompanyLogo logo) { + this.logo = Optional.ofNullable(logo); + return this; + } + + /** + *

The company's logo.

+ */ + @java.lang.Override + @JsonSetter(value = "logo", nulls = Nulls.SKIP) + public _FinalStage logo(Optional logo) { + this.logo = logo; + return this; + } + + /** + *

The product featured for affiliates to promote on this company's affiliate page. Null if none is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage featuredAffiliateProduct( + Nullable featuredAffiliateProduct) { + if (featuredAffiliateProduct.isNull()) { + this.featuredAffiliateProduct = null; + } else if (featuredAffiliateProduct.isEmpty()) { + this.featuredAffiliateProduct = Optional.empty(); + } else { + this.featuredAffiliateProduct = Optional.of(featuredAffiliateProduct.get()); + } + return this; + } + + /** + *

The product featured for affiliates to promote on this company's affiliate page. Null if none is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage featuredAffiliateProduct(CompanyFeaturedAffiliateProduct featuredAffiliateProduct) { + this.featuredAffiliateProduct = Optional.ofNullable(featuredAffiliateProduct); + return this; + } + + /** + *

The product featured for affiliates to promote on this company's affiliate page. Null if none is configured.

+ */ + @java.lang.Override + @JsonSetter(value = "featured_affiliate_product", nulls = Nulls.SKIP) + public _FinalStage featuredAffiliateProduct( + Optional featuredAffiliateProduct) { + this.featuredAffiliateProduct = featuredAffiliateProduct; + return this; + } + + /** + *

A promotional pitch written by the company creator, displayed to potential customers on the store page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

A promotional pitch written by the company creator, displayed to potential customers on the store page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

A promotional pitch written by the company creator, displayed to potential customers on the store page.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

Guidelines and instructions provided to affiliates explaining how to promote this company's products.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage affiliateInstructions(Nullable affiliateInstructions) { + if (affiliateInstructions.isNull()) { + this.affiliateInstructions = null; + } else if (affiliateInstructions.isEmpty()) { + this.affiliateInstructions = Optional.empty(); + } else { + this.affiliateInstructions = Optional.of(affiliateInstructions.get()); + } + return this; + } + + /** + *

Guidelines and instructions provided to affiliates explaining how to promote this company's products.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage affiliateInstructions(String affiliateInstructions) { + this.affiliateInstructions = Optional.ofNullable(affiliateInstructions); + return this; + } + + /** + *

Guidelines and instructions provided to affiliates explaining how to promote this company's products.

+ */ + @java.lang.Override + @JsonSetter(value = "affiliate_instructions", nulls = Nulls.SKIP) + public _FinalStage affiliateInstructions(Optional affiliateInstructions) { + this.affiliateInstructions = affiliateInstructions; + return this; + } + + @java.lang.Override + public Company build() { + return new Company( + affiliateInstructions, + createdAt, + description, + featuredAffiliateProduct, + id, + logo, + memberCount, + metadata, + ownerUser, + publishedReviewsCount, + route, + sendCustomerEmails, + socialLinks, + targetAudience, + title, + updatedAt, + verified, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CompanyFeaturedAffiliateProduct.java b/src/main/java/com/whop/api/types/CompanyFeaturedAffiliateProduct.java new file mode 100644 index 00000000..529be102 --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanyFeaturedAffiliateProduct.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyFeaturedAffiliateProduct.Builder.class) +public final class CompanyFeaturedAffiliateProduct { + private final String id; + + private final String name; + + private final Map additionalProperties; + + private CompanyFeaturedAffiliateProduct(String id, String name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the product. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the product shown to customers. Maximum 50 characters. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyFeaturedAffiliateProduct && equalTo((CompanyFeaturedAffiliateProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyFeaturedAffiliateProduct other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the product.

+ */ + NameStage id(@NotNull String id); + + Builder from(CompanyFeaturedAffiliateProduct other); + } + + public interface NameStage { + /** + *

The display name of the product shown to customers. Maximum 50 characters.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + CompanyFeaturedAffiliateProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyFeaturedAffiliateProduct other) { + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

The unique identifier for the product.

+ *

The unique identifier for the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the product shown to customers. Maximum 50 characters.

+ *

The display name of the product shown to customers. Maximum 50 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public CompanyFeaturedAffiliateProduct build() { + return new CompanyFeaturedAffiliateProduct(id, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CompanyListItem.java b/src/main/java/com/whop/api/types/CompanyListItem.java new file mode 100644 index 00000000..eb551e16 --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanyListItem.java @@ -0,0 +1,772 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyListItem.Builder.class) +public final class CompanyListItem { + private final OffsetDateTime createdAt; + + private final Optional description; + + private final String id; + + private final Optional logo; + + private final int memberCount; + + private final Optional> metadata; + + private final CompanyListItemOwnerUser ownerUser; + + private final int publishedReviewsCount; + + private final String route; + + private final boolean sendCustomerEmails; + + private final Optional targetAudience; + + private final String title; + + private final OffsetDateTime updatedAt; + + private final boolean verified; + + private final Map additionalProperties; + + private CompanyListItem( + OffsetDateTime createdAt, + Optional description, + String id, + Optional logo, + int memberCount, + Optional> metadata, + CompanyListItemOwnerUser ownerUser, + int publishedReviewsCount, + String route, + boolean sendCustomerEmails, + Optional targetAudience, + String title, + OffsetDateTime updatedAt, + boolean verified, + Map additionalProperties) { + this.createdAt = createdAt; + this.description = description; + this.id = id; + this.logo = logo; + this.memberCount = memberCount; + this.metadata = metadata; + this.ownerUser = ownerUser; + this.publishedReviewsCount = publishedReviewsCount; + this.route = route; + this.sendCustomerEmails = sendCustomerEmails; + this.targetAudience = targetAudience; + this.title = title; + this.updatedAt = updatedAt; + this.verified = verified; + this.additionalProperties = additionalProperties; + } + + /** + * @return The datetime the company was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return A promotional pitch written by the company creator, displayed to potential customers on the store page. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The company's logo. + */ + @JsonIgnore + public Optional getLogo() { + if (logo == null) { + return Optional.empty(); + } + return logo; + } + + /** + * @return The total number of users who currently hold active memberships across all of this company's products. + */ + @JsonProperty("member_count") + public int getMemberCount() { + return memberCount; + } + + /** + * @return A key-value JSON object of custom metadata for this company, managed by the platform that created the account. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The user who owns and has full administrative control over this company. + */ + @JsonProperty("owner_user") + public CompanyListItemOwnerUser getOwnerUser() { + return ownerUser; + } + + /** + * @return The total number of published customer reviews across all products for this company. + */ + @JsonProperty("published_reviews_count") + public int getPublishedReviewsCount() { + return publishedReviewsCount; + } + + /** + * @return URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return Whether Whop sends transactional emails (receipts, updates) to customers on behalf of this company. + */ + @JsonProperty("send_customer_emails") + public boolean getSendCustomerEmails() { + return sendCustomerEmails; + } + + /** + * @return The target audience for the company. Null if not set. + */ + @JsonIgnore + public Optional getTargetAudience() { + if (targetAudience == null) { + return Optional.empty(); + } + return targetAudience; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return The datetime the company was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return Whether this company has been verified by Whop's trust and safety team. + */ + @JsonProperty("verified") + public boolean getVerified() { + return verified; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo") + private Optional _getLogo() { + return logo; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("target_audience") + private Optional _getTargetAudience() { + return targetAudience; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyListItem && equalTo((CompanyListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyListItem other) { + return createdAt.equals(other.createdAt) + && description.equals(other.description) + && id.equals(other.id) + && logo.equals(other.logo) + && memberCount == other.memberCount + && metadata.equals(other.metadata) + && ownerUser.equals(other.ownerUser) + && publishedReviewsCount == other.publishedReviewsCount + && route.equals(other.route) + && sendCustomerEmails == other.sendCustomerEmails + && targetAudience.equals(other.targetAudience) + && title.equals(other.title) + && updatedAt.equals(other.updatedAt) + && verified == other.verified; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, + this.description, + this.id, + this.logo, + this.memberCount, + this.metadata, + this.ownerUser, + this.publishedReviewsCount, + this.route, + this.sendCustomerEmails, + this.targetAudience, + this.title, + this.updatedAt, + this.verified); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the company was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(CompanyListItem other); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + MemberCountStage id(@NotNull String id); + } + + public interface MemberCountStage { + /** + *

The total number of users who currently hold active memberships across all of this company's products.

+ */ + OwnerUserStage memberCount(int memberCount); + } + + public interface OwnerUserStage { + /** + *

The user who owns and has full administrative control over this company.

+ */ + PublishedReviewsCountStage ownerUser(@NotNull CompanyListItemOwnerUser ownerUser); + } + + public interface PublishedReviewsCountStage { + /** + *

The total number of published customer reviews across all products for this company.

+ */ + RouteStage publishedReviewsCount(int publishedReviewsCount); + } + + public interface RouteStage { + /** + *

URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe.

+ */ + SendCustomerEmailsStage route(@NotNull String route); + } + + public interface SendCustomerEmailsStage { + /** + *

Whether Whop sends transactional emails (receipts, updates) to customers on behalf of this company.

+ */ + TitleStage sendCustomerEmails(boolean sendCustomerEmails); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + UpdatedAtStage title(@NotNull String title); + } + + public interface UpdatedAtStage { + /** + *

The datetime the company was last updated.

+ */ + VerifiedStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface VerifiedStage { + /** + *

Whether this company has been verified by Whop's trust and safety team.

+ */ + _FinalStage verified(boolean verified); + } + + public interface _FinalStage { + CompanyListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A promotional pitch written by the company creator, displayed to potential customers on the store page.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

The company's logo.

+ */ + _FinalStage logo(Optional logo); + + _FinalStage logo(CompanyListItemLogo logo); + + _FinalStage logo(Nullable logo); + + /** + *

A key-value JSON object of custom metadata for this company, managed by the platform that created the account.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The target audience for the company. Null if not set.

+ */ + _FinalStage targetAudience(Optional targetAudience); + + _FinalStage targetAudience(String targetAudience); + + _FinalStage targetAudience(Nullable targetAudience); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + IdStage, + MemberCountStage, + OwnerUserStage, + PublishedReviewsCountStage, + RouteStage, + SendCustomerEmailsStage, + TitleStage, + UpdatedAtStage, + VerifiedStage, + _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private int memberCount; + + private CompanyListItemOwnerUser ownerUser; + + private int publishedReviewsCount; + + private String route; + + private boolean sendCustomerEmails; + + private String title; + + private OffsetDateTime updatedAt; + + private boolean verified; + + private Optional targetAudience = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional logo = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyListItem other) { + createdAt(other.getCreatedAt()); + description(other.getDescription()); + id(other.getId()); + logo(other.getLogo()); + memberCount(other.getMemberCount()); + metadata(other.getMetadata()); + ownerUser(other.getOwnerUser()); + publishedReviewsCount(other.getPublishedReviewsCount()); + route(other.getRoute()); + sendCustomerEmails(other.getSendCustomerEmails()); + targetAudience(other.getTargetAudience()); + title(other.getTitle()); + updatedAt(other.getUpdatedAt()); + verified(other.getVerified()); + return this; + } + + /** + *

The datetime the company was created.

+ *

The datetime the company was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MemberCountStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The total number of users who currently hold active memberships across all of this company's products.

+ *

The total number of users who currently hold active memberships across all of this company's products.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("member_count") + public OwnerUserStage memberCount(int memberCount) { + this.memberCount = memberCount; + return this; + } + + /** + *

The user who owns and has full administrative control over this company.

+ *

The user who owns and has full administrative control over this company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("owner_user") + public PublishedReviewsCountStage ownerUser(@NotNull CompanyListItemOwnerUser ownerUser) { + this.ownerUser = Objects.requireNonNull(ownerUser, "ownerUser must not be null"); + return this; + } + + /** + *

The total number of published customer reviews across all products for this company.

+ *

The total number of published customer reviews across all products for this company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("published_reviews_count") + public RouteStage publishedReviewsCount(int publishedReviewsCount) { + this.publishedReviewsCount = publishedReviewsCount; + return this; + } + + /** + *

URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe.

+ *

URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public SendCustomerEmailsStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

Whether Whop sends transactional emails (receipts, updates) to customers on behalf of this company.

+ *

Whether Whop sends transactional emails (receipts, updates) to customers on behalf of this company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("send_customer_emails") + public TitleStage sendCustomerEmails(boolean sendCustomerEmails) { + this.sendCustomerEmails = sendCustomerEmails; + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public UpdatedAtStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

The datetime the company was last updated.

+ *

The datetime the company was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public VerifiedStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

Whether this company has been verified by Whop's trust and safety team.

+ *

Whether this company has been verified by Whop's trust and safety team.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("verified") + public _FinalStage verified(boolean verified) { + this.verified = verified; + return this; + } + + /** + *

The target audience for the company. Null if not set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage targetAudience(Nullable targetAudience) { + if (targetAudience.isNull()) { + this.targetAudience = null; + } else if (targetAudience.isEmpty()) { + this.targetAudience = Optional.empty(); + } else { + this.targetAudience = Optional.of(targetAudience.get()); + } + return this; + } + + /** + *

The target audience for the company. Null if not set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage targetAudience(String targetAudience) { + this.targetAudience = Optional.ofNullable(targetAudience); + return this; + } + + /** + *

The target audience for the company. Null if not set.

+ */ + @java.lang.Override + @JsonSetter(value = "target_audience", nulls = Nulls.SKIP) + public _FinalStage targetAudience(Optional targetAudience) { + this.targetAudience = targetAudience; + return this; + } + + /** + *

A key-value JSON object of custom metadata for this company, managed by the platform that created the account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

A key-value JSON object of custom metadata for this company, managed by the platform that created the account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

A key-value JSON object of custom metadata for this company, managed by the platform that created the account.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The company's logo.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logo(Nullable logo) { + if (logo.isNull()) { + this.logo = null; + } else if (logo.isEmpty()) { + this.logo = Optional.empty(); + } else { + this.logo = Optional.of(logo.get()); + } + return this; + } + + /** + *

The company's logo.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logo(CompanyListItemLogo logo) { + this.logo = Optional.ofNullable(logo); + return this; + } + + /** + *

The company's logo.

+ */ + @java.lang.Override + @JsonSetter(value = "logo", nulls = Nulls.SKIP) + public _FinalStage logo(Optional logo) { + this.logo = logo; + return this; + } + + /** + *

A promotional pitch written by the company creator, displayed to potential customers on the store page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

A promotional pitch written by the company creator, displayed to potential customers on the store page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

A promotional pitch written by the company creator, displayed to potential customers on the store page.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public CompanyListItem build() { + return new CompanyListItem( + createdAt, + description, + id, + logo, + memberCount, + metadata, + ownerUser, + publishedReviewsCount, + route, + sendCustomerEmails, + targetAudience, + title, + updatedAt, + verified, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CompanyListItemLogo.java b/src/main/java/com/whop/api/types/CompanyListItemLogo.java new file mode 100644 index 00000000..0c4368b2 --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanyListItemLogo.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyListItemLogo.Builder.class) +public final class CompanyListItemLogo { + private final Optional url; + + private final Map additionalProperties; + + private CompanyListItemLogo(Optional url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyListItemLogo && equalTo((CompanyListItemLogo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyListItemLogo other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CompanyListItemLogo other) { + url(other.getUrl()); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public Builder url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + public CompanyListItemLogo build() { + return new CompanyListItemLogo(url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CompanyListItemOwnerUser.java b/src/main/java/com/whop/api/types/CompanyListItemOwnerUser.java new file mode 100644 index 00000000..3f06eabc --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanyListItemOwnerUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyListItemOwnerUser.Builder.class) +public final class CompanyListItemOwnerUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private CompanyListItemOwnerUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyListItemOwnerUser && equalTo((CompanyListItemOwnerUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyListItemOwnerUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(CompanyListItemOwnerUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + CompanyListItemOwnerUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyListItemOwnerUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public CompanyListItemOwnerUser build() { + return new CompanyListItemOwnerUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CompanyLogo.java b/src/main/java/com/whop/api/types/CompanyLogo.java new file mode 100644 index 00000000..f495f0bc --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanyLogo.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyLogo.Builder.class) +public final class CompanyLogo { + private final Optional url; + + private final Map additionalProperties; + + private CompanyLogo(Optional url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyLogo && equalTo((CompanyLogo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyLogo other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CompanyLogo other) { + url(other.getUrl()); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public Builder url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + public CompanyLogo build() { + return new CompanyLogo(url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CompanyOwnerUser.java b/src/main/java/com/whop/api/types/CompanyOwnerUser.java new file mode 100644 index 00000000..c66c2510 --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanyOwnerUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyOwnerUser.Builder.class) +public final class CompanyOwnerUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private CompanyOwnerUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyOwnerUser && equalTo((CompanyOwnerUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyOwnerUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(CompanyOwnerUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + CompanyOwnerUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyOwnerUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public CompanyOwnerUser build() { + return new CompanyOwnerUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CompanySocialLinksItem.java b/src/main/java/com/whop/api/types/CompanySocialLinksItem.java new file mode 100644 index 00000000..4cc1fea9 --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanySocialLinksItem.java @@ -0,0 +1,196 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanySocialLinksItem.Builder.class) +public final class CompanySocialLinksItem { + private final String id; + + private final String url; + + private final SocialLinkWebsites website; + + private final Map additionalProperties; + + private CompanySocialLinksItem( + String id, String url, SocialLinkWebsites website, Map additionalProperties) { + this.id = id; + this.url = url; + this.website = website; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the social link. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The URL of the social media profile or external link. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + /** + * @return The website + */ + @JsonProperty("website") + public SocialLinkWebsites getWebsite() { + return website; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanySocialLinksItem && equalTo((CompanySocialLinksItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanySocialLinksItem other) { + return id.equals(other.id) && url.equals(other.url) && website.equals(other.website); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.url, this.website); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the social link.

+ */ + UrlStage id(@NotNull String id); + + Builder from(CompanySocialLinksItem other); + } + + public interface UrlStage { + /** + *

The URL of the social media profile or external link.

+ */ + WebsiteStage url(@NotNull String url); + } + + public interface WebsiteStage { + /** + *

The website

+ */ + _FinalStage website(@NotNull SocialLinkWebsites website); + } + + public interface _FinalStage { + CompanySocialLinksItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UrlStage, WebsiteStage, _FinalStage { + private String id; + + private String url; + + private SocialLinkWebsites website; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanySocialLinksItem other) { + id(other.getId()); + url(other.getUrl()); + website(other.getWebsite()); + return this; + } + + /** + *

The unique identifier for the social link.

+ *

The unique identifier for the social link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UrlStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The URL of the social media profile or external link.

+ *

The URL of the social media profile or external link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public WebsiteStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + /** + *

The website

+ *

The website

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("website") + public _FinalStage website(@NotNull SocialLinkWebsites website) { + this.website = Objects.requireNonNull(website, "website must not be null"); + return this; + } + + @java.lang.Override + public CompanySocialLinksItem build() { + return new CompanySocialLinksItem(id, url, website, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CompanyTokenTransaction.java b/src/main/java/com/whop/api/types/CompanyTokenTransaction.java new file mode 100644 index 00000000..d2773890 --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanyTokenTransaction.java @@ -0,0 +1,586 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyTokenTransaction.Builder.class) +public final class CompanyTokenTransaction { + private final double amount; + + private final CompanyTokenTransactionCompany company; + + private final OffsetDateTime createdAt; + + private final Optional description; + + private final String id; + + private final Optional idempotencyKey; + + private final Optional linkedTransactionId; + + private final CompanyTokenTransactionMember member; + + private final CompanyTokenTransactionTypes transactionType; + + private final CompanyTokenTransactionUser user; + + private final Map additionalProperties; + + private CompanyTokenTransaction( + double amount, + CompanyTokenTransactionCompany company, + OffsetDateTime createdAt, + Optional description, + String id, + Optional idempotencyKey, + Optional linkedTransactionId, + CompanyTokenTransactionMember member, + CompanyTokenTransactionTypes transactionType, + CompanyTokenTransactionUser user, + Map additionalProperties) { + this.amount = amount; + this.company = company; + this.createdAt = createdAt; + this.description = description; + this.id = id; + this.idempotencyKey = idempotencyKey; + this.linkedTransactionId = linkedTransactionId; + this.member = member; + this.transactionType = transactionType; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The token amount for this transaction. Always a positive value regardless of transaction type. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The company whose token balance this transaction affects. + */ + @JsonProperty("company") + public CompanyTokenTransactionCompany getCompany() { + return company; + } + + /** + * @return The datetime the company token transaction was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Free-text description explaining the reason for this token transaction. Null if no description was provided. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The unique identifier for the company token transaction. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A unique key used to prevent duplicate transactions when retrying API requests. Null if no idempotency key was provided. + */ + @JsonIgnore + public Optional getIdempotencyKey() { + if (idempotencyKey == null) { + return Optional.empty(); + } + return idempotencyKey; + } + + /** + * @return The ID of the corresponding transaction on the other side of a transfer. Null if this is not a transfer transaction. + */ + @JsonIgnore + public Optional getLinkedTransactionId() { + if (linkedTransactionId == null) { + return Optional.empty(); + } + return linkedTransactionId; + } + + /** + * @return The member whose token balance was affected by this transaction. + */ + @JsonProperty("member") + public CompanyTokenTransactionMember getMember() { + return member; + } + + /** + * @return The direction of this token transaction (add, subtract, or transfer). + */ + @JsonProperty("transaction_type") + public CompanyTokenTransactionTypes getTransactionType() { + return transactionType; + } + + /** + * @return The user whose token balance was affected by this transaction. + */ + @JsonProperty("user") + public CompanyTokenTransactionUser getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("idempotency_key") + private Optional _getIdempotencyKey() { + return idempotencyKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("linked_transaction_id") + private Optional _getLinkedTransactionId() { + return linkedTransactionId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyTokenTransaction && equalTo((CompanyTokenTransaction) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyTokenTransaction other) { + return amount == other.amount + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && description.equals(other.description) + && id.equals(other.id) + && idempotencyKey.equals(other.idempotencyKey) + && linkedTransactionId.equals(other.linkedTransactionId) + && member.equals(other.member) + && transactionType.equals(other.transactionType) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.company, + this.createdAt, + this.description, + this.id, + this.idempotencyKey, + this.linkedTransactionId, + this.member, + this.transactionType, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The token amount for this transaction. Always a positive value regardless of transaction type.

+ */ + CompanyStage amount(double amount); + + Builder from(CompanyTokenTransaction other); + } + + public interface CompanyStage { + /** + *

The company whose token balance this transaction affects.

+ */ + CreatedAtStage company(@NotNull CompanyTokenTransactionCompany company); + } + + public interface CreatedAtStage { + /** + *

The datetime the company token transaction was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the company token transaction.

+ */ + MemberStage id(@NotNull String id); + } + + public interface MemberStage { + /** + *

The member whose token balance was affected by this transaction.

+ */ + TransactionTypeStage member(@NotNull CompanyTokenTransactionMember member); + } + + public interface TransactionTypeStage { + /** + *

The direction of this token transaction (add, subtract, or transfer).

+ */ + UserStage transactionType(@NotNull CompanyTokenTransactionTypes transactionType); + } + + public interface UserStage { + /** + *

The user whose token balance was affected by this transaction.

+ */ + _FinalStage user(@NotNull CompanyTokenTransactionUser user); + } + + public interface _FinalStage { + CompanyTokenTransaction build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Free-text description explaining the reason for this token transaction. Null if no description was provided.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

A unique key used to prevent duplicate transactions when retrying API requests. Null if no idempotency key was provided.

+ */ + _FinalStage idempotencyKey(Optional idempotencyKey); + + _FinalStage idempotencyKey(String idempotencyKey); + + _FinalStage idempotencyKey(Nullable idempotencyKey); + + /** + *

The ID of the corresponding transaction on the other side of a transfer. Null if this is not a transfer transaction.

+ */ + _FinalStage linkedTransactionId(Optional linkedTransactionId); + + _FinalStage linkedTransactionId(String linkedTransactionId); + + _FinalStage linkedTransactionId(Nullable linkedTransactionId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CompanyStage, + CreatedAtStage, + IdStage, + MemberStage, + TransactionTypeStage, + UserStage, + _FinalStage { + private double amount; + + private CompanyTokenTransactionCompany company; + + private OffsetDateTime createdAt; + + private String id; + + private CompanyTokenTransactionMember member; + + private CompanyTokenTransactionTypes transactionType; + + private CompanyTokenTransactionUser user; + + private Optional linkedTransactionId = Optional.empty(); + + private Optional idempotencyKey = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyTokenTransaction other) { + amount(other.getAmount()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + description(other.getDescription()); + id(other.getId()); + idempotencyKey(other.getIdempotencyKey()); + linkedTransactionId(other.getLinkedTransactionId()); + member(other.getMember()); + transactionType(other.getTransactionType()); + user(other.getUser()); + return this; + } + + /** + *

The token amount for this transaction. Always a positive value regardless of transaction type.

+ *

The token amount for this transaction. Always a positive value regardless of transaction type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CompanyStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The company whose token balance this transaction affects.

+ *

The company whose token balance this transaction affects.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company") + public CreatedAtStage company(@NotNull CompanyTokenTransactionCompany company) { + this.company = Objects.requireNonNull(company, "company must not be null"); + return this; + } + + /** + *

The datetime the company token transaction was created.

+ *

The datetime the company token transaction was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the company token transaction.

+ *

The unique identifier for the company token transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MemberStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The member whose token balance was affected by this transaction.

+ *

The member whose token balance was affected by this transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("member") + public TransactionTypeStage member(@NotNull CompanyTokenTransactionMember member) { + this.member = Objects.requireNonNull(member, "member must not be null"); + return this; + } + + /** + *

The direction of this token transaction (add, subtract, or transfer).

+ *

The direction of this token transaction (add, subtract, or transfer).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("transaction_type") + public UserStage transactionType(@NotNull CompanyTokenTransactionTypes transactionType) { + this.transactionType = Objects.requireNonNull(transactionType, "transactionType must not be null"); + return this; + } + + /** + *

The user whose token balance was affected by this transaction.

+ *

The user whose token balance was affected by this transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull CompanyTokenTransactionUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

The ID of the corresponding transaction on the other side of a transfer. Null if this is not a transfer transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage linkedTransactionId(Nullable linkedTransactionId) { + if (linkedTransactionId.isNull()) { + this.linkedTransactionId = null; + } else if (linkedTransactionId.isEmpty()) { + this.linkedTransactionId = Optional.empty(); + } else { + this.linkedTransactionId = Optional.of(linkedTransactionId.get()); + } + return this; + } + + /** + *

The ID of the corresponding transaction on the other side of a transfer. Null if this is not a transfer transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage linkedTransactionId(String linkedTransactionId) { + this.linkedTransactionId = Optional.ofNullable(linkedTransactionId); + return this; + } + + /** + *

The ID of the corresponding transaction on the other side of a transfer. Null if this is not a transfer transaction.

+ */ + @java.lang.Override + @JsonSetter(value = "linked_transaction_id", nulls = Nulls.SKIP) + public _FinalStage linkedTransactionId(Optional linkedTransactionId) { + this.linkedTransactionId = linkedTransactionId; + return this; + } + + /** + *

A unique key used to prevent duplicate transactions when retrying API requests. Null if no idempotency key was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage idempotencyKey(Nullable idempotencyKey) { + if (idempotencyKey.isNull()) { + this.idempotencyKey = null; + } else if (idempotencyKey.isEmpty()) { + this.idempotencyKey = Optional.empty(); + } else { + this.idempotencyKey = Optional.of(idempotencyKey.get()); + } + return this; + } + + /** + *

A unique key used to prevent duplicate transactions when retrying API requests. Null if no idempotency key was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage idempotencyKey(String idempotencyKey) { + this.idempotencyKey = Optional.ofNullable(idempotencyKey); + return this; + } + + /** + *

A unique key used to prevent duplicate transactions when retrying API requests. Null if no idempotency key was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "idempotency_key", nulls = Nulls.SKIP) + public _FinalStage idempotencyKey(Optional idempotencyKey) { + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + *

Free-text description explaining the reason for this token transaction. Null if no description was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

Free-text description explaining the reason for this token transaction. Null if no description was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

Free-text description explaining the reason for this token transaction. Null if no description was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public CompanyTokenTransaction build() { + return new CompanyTokenTransaction( + amount, + company, + createdAt, + description, + id, + idempotencyKey, + linkedTransactionId, + member, + transactionType, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CompanyTokenTransactionCompany.java b/src/main/java/com/whop/api/types/CompanyTokenTransactionCompany.java new file mode 100644 index 00000000..0622e3c6 --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanyTokenTransactionCompany.java @@ -0,0 +1,196 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyTokenTransactionCompany.Builder.class) +public final class CompanyTokenTransactionCompany { + private final String id; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private CompanyTokenTransactionCompany( + String id, String route, String title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The slug/route of the company on the Whop site. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return The written name of the company. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyTokenTransactionCompany && equalTo((CompanyTokenTransactionCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyTokenTransactionCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + RouteStage id(@NotNull String id); + + Builder from(CompanyTokenTransactionCompany other); + } + + public interface RouteStage { + /** + *

The slug/route of the company on the Whop site.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

The written name of the company.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + CompanyTokenTransactionCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyTokenTransactionCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The slug/route of the company on the Whop site.

+ *

The slug/route of the company on the Whop site.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

The written name of the company.

+ *

The written name of the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public CompanyTokenTransactionCompany build() { + return new CompanyTokenTransactionCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CompanyTokenTransactionListItem.java b/src/main/java/com/whop/api/types/CompanyTokenTransactionListItem.java new file mode 100644 index 00000000..8fef11cb --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanyTokenTransactionListItem.java @@ -0,0 +1,586 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyTokenTransactionListItem.Builder.class) +public final class CompanyTokenTransactionListItem { + private final double amount; + + private final CompanyTokenTransactionListItemCompany company; + + private final OffsetDateTime createdAt; + + private final Optional description; + + private final String id; + + private final Optional idempotencyKey; + + private final Optional linkedTransactionId; + + private final CompanyTokenTransactionListItemMember member; + + private final CompanyTokenTransactionTypes transactionType; + + private final CompanyTokenTransactionListItemUser user; + + private final Map additionalProperties; + + private CompanyTokenTransactionListItem( + double amount, + CompanyTokenTransactionListItemCompany company, + OffsetDateTime createdAt, + Optional description, + String id, + Optional idempotencyKey, + Optional linkedTransactionId, + CompanyTokenTransactionListItemMember member, + CompanyTokenTransactionTypes transactionType, + CompanyTokenTransactionListItemUser user, + Map additionalProperties) { + this.amount = amount; + this.company = company; + this.createdAt = createdAt; + this.description = description; + this.id = id; + this.idempotencyKey = idempotencyKey; + this.linkedTransactionId = linkedTransactionId; + this.member = member; + this.transactionType = transactionType; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The token amount for this transaction. Always a positive value regardless of transaction type. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The company whose token balance this transaction affects. + */ + @JsonProperty("company") + public CompanyTokenTransactionListItemCompany getCompany() { + return company; + } + + /** + * @return The datetime the company token transaction was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Free-text description explaining the reason for this token transaction. Null if no description was provided. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The unique identifier for the company token transaction. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A unique key used to prevent duplicate transactions when retrying API requests. Null if no idempotency key was provided. + */ + @JsonIgnore + public Optional getIdempotencyKey() { + if (idempotencyKey == null) { + return Optional.empty(); + } + return idempotencyKey; + } + + /** + * @return The ID of the corresponding transaction on the other side of a transfer. Null if this is not a transfer transaction. + */ + @JsonIgnore + public Optional getLinkedTransactionId() { + if (linkedTransactionId == null) { + return Optional.empty(); + } + return linkedTransactionId; + } + + /** + * @return The member whose token balance was affected by this transaction. + */ + @JsonProperty("member") + public CompanyTokenTransactionListItemMember getMember() { + return member; + } + + /** + * @return The direction of this token transaction (add, subtract, or transfer). + */ + @JsonProperty("transaction_type") + public CompanyTokenTransactionTypes getTransactionType() { + return transactionType; + } + + /** + * @return The user whose token balance was affected by this transaction. + */ + @JsonProperty("user") + public CompanyTokenTransactionListItemUser getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("idempotency_key") + private Optional _getIdempotencyKey() { + return idempotencyKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("linked_transaction_id") + private Optional _getLinkedTransactionId() { + return linkedTransactionId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyTokenTransactionListItem && equalTo((CompanyTokenTransactionListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyTokenTransactionListItem other) { + return amount == other.amount + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && description.equals(other.description) + && id.equals(other.id) + && idempotencyKey.equals(other.idempotencyKey) + && linkedTransactionId.equals(other.linkedTransactionId) + && member.equals(other.member) + && transactionType.equals(other.transactionType) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.company, + this.createdAt, + this.description, + this.id, + this.idempotencyKey, + this.linkedTransactionId, + this.member, + this.transactionType, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The token amount for this transaction. Always a positive value regardless of transaction type.

+ */ + CompanyStage amount(double amount); + + Builder from(CompanyTokenTransactionListItem other); + } + + public interface CompanyStage { + /** + *

The company whose token balance this transaction affects.

+ */ + CreatedAtStage company(@NotNull CompanyTokenTransactionListItemCompany company); + } + + public interface CreatedAtStage { + /** + *

The datetime the company token transaction was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the company token transaction.

+ */ + MemberStage id(@NotNull String id); + } + + public interface MemberStage { + /** + *

The member whose token balance was affected by this transaction.

+ */ + TransactionTypeStage member(@NotNull CompanyTokenTransactionListItemMember member); + } + + public interface TransactionTypeStage { + /** + *

The direction of this token transaction (add, subtract, or transfer).

+ */ + UserStage transactionType(@NotNull CompanyTokenTransactionTypes transactionType); + } + + public interface UserStage { + /** + *

The user whose token balance was affected by this transaction.

+ */ + _FinalStage user(@NotNull CompanyTokenTransactionListItemUser user); + } + + public interface _FinalStage { + CompanyTokenTransactionListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Free-text description explaining the reason for this token transaction. Null if no description was provided.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

A unique key used to prevent duplicate transactions when retrying API requests. Null if no idempotency key was provided.

+ */ + _FinalStage idempotencyKey(Optional idempotencyKey); + + _FinalStage idempotencyKey(String idempotencyKey); + + _FinalStage idempotencyKey(Nullable idempotencyKey); + + /** + *

The ID of the corresponding transaction on the other side of a transfer. Null if this is not a transfer transaction.

+ */ + _FinalStage linkedTransactionId(Optional linkedTransactionId); + + _FinalStage linkedTransactionId(String linkedTransactionId); + + _FinalStage linkedTransactionId(Nullable linkedTransactionId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CompanyStage, + CreatedAtStage, + IdStage, + MemberStage, + TransactionTypeStage, + UserStage, + _FinalStage { + private double amount; + + private CompanyTokenTransactionListItemCompany company; + + private OffsetDateTime createdAt; + + private String id; + + private CompanyTokenTransactionListItemMember member; + + private CompanyTokenTransactionTypes transactionType; + + private CompanyTokenTransactionListItemUser user; + + private Optional linkedTransactionId = Optional.empty(); + + private Optional idempotencyKey = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyTokenTransactionListItem other) { + amount(other.getAmount()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + description(other.getDescription()); + id(other.getId()); + idempotencyKey(other.getIdempotencyKey()); + linkedTransactionId(other.getLinkedTransactionId()); + member(other.getMember()); + transactionType(other.getTransactionType()); + user(other.getUser()); + return this; + } + + /** + *

The token amount for this transaction. Always a positive value regardless of transaction type.

+ *

The token amount for this transaction. Always a positive value regardless of transaction type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CompanyStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The company whose token balance this transaction affects.

+ *

The company whose token balance this transaction affects.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company") + public CreatedAtStage company(@NotNull CompanyTokenTransactionListItemCompany company) { + this.company = Objects.requireNonNull(company, "company must not be null"); + return this; + } + + /** + *

The datetime the company token transaction was created.

+ *

The datetime the company token transaction was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the company token transaction.

+ *

The unique identifier for the company token transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MemberStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The member whose token balance was affected by this transaction.

+ *

The member whose token balance was affected by this transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("member") + public TransactionTypeStage member(@NotNull CompanyTokenTransactionListItemMember member) { + this.member = Objects.requireNonNull(member, "member must not be null"); + return this; + } + + /** + *

The direction of this token transaction (add, subtract, or transfer).

+ *

The direction of this token transaction (add, subtract, or transfer).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("transaction_type") + public UserStage transactionType(@NotNull CompanyTokenTransactionTypes transactionType) { + this.transactionType = Objects.requireNonNull(transactionType, "transactionType must not be null"); + return this; + } + + /** + *

The user whose token balance was affected by this transaction.

+ *

The user whose token balance was affected by this transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull CompanyTokenTransactionListItemUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

The ID of the corresponding transaction on the other side of a transfer. Null if this is not a transfer transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage linkedTransactionId(Nullable linkedTransactionId) { + if (linkedTransactionId.isNull()) { + this.linkedTransactionId = null; + } else if (linkedTransactionId.isEmpty()) { + this.linkedTransactionId = Optional.empty(); + } else { + this.linkedTransactionId = Optional.of(linkedTransactionId.get()); + } + return this; + } + + /** + *

The ID of the corresponding transaction on the other side of a transfer. Null if this is not a transfer transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage linkedTransactionId(String linkedTransactionId) { + this.linkedTransactionId = Optional.ofNullable(linkedTransactionId); + return this; + } + + /** + *

The ID of the corresponding transaction on the other side of a transfer. Null if this is not a transfer transaction.

+ */ + @java.lang.Override + @JsonSetter(value = "linked_transaction_id", nulls = Nulls.SKIP) + public _FinalStage linkedTransactionId(Optional linkedTransactionId) { + this.linkedTransactionId = linkedTransactionId; + return this; + } + + /** + *

A unique key used to prevent duplicate transactions when retrying API requests. Null if no idempotency key was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage idempotencyKey(Nullable idempotencyKey) { + if (idempotencyKey.isNull()) { + this.idempotencyKey = null; + } else if (idempotencyKey.isEmpty()) { + this.idempotencyKey = Optional.empty(); + } else { + this.idempotencyKey = Optional.of(idempotencyKey.get()); + } + return this; + } + + /** + *

A unique key used to prevent duplicate transactions when retrying API requests. Null if no idempotency key was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage idempotencyKey(String idempotencyKey) { + this.idempotencyKey = Optional.ofNullable(idempotencyKey); + return this; + } + + /** + *

A unique key used to prevent duplicate transactions when retrying API requests. Null if no idempotency key was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "idempotency_key", nulls = Nulls.SKIP) + public _FinalStage idempotencyKey(Optional idempotencyKey) { + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + *

Free-text description explaining the reason for this token transaction. Null if no description was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

Free-text description explaining the reason for this token transaction. Null if no description was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

Free-text description explaining the reason for this token transaction. Null if no description was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public CompanyTokenTransactionListItem build() { + return new CompanyTokenTransactionListItem( + amount, + company, + createdAt, + description, + id, + idempotencyKey, + linkedTransactionId, + member, + transactionType, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CompanyTokenTransactionListItemCompany.java b/src/main/java/com/whop/api/types/CompanyTokenTransactionListItemCompany.java new file mode 100644 index 00000000..13b2118d --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanyTokenTransactionListItemCompany.java @@ -0,0 +1,197 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyTokenTransactionListItemCompany.Builder.class) +public final class CompanyTokenTransactionListItemCompany { + private final String id; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private CompanyTokenTransactionListItemCompany( + String id, String route, String title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The slug/route of the company on the Whop site. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return The written name of the company. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyTokenTransactionListItemCompany + && equalTo((CompanyTokenTransactionListItemCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyTokenTransactionListItemCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + RouteStage id(@NotNull String id); + + Builder from(CompanyTokenTransactionListItemCompany other); + } + + public interface RouteStage { + /** + *

The slug/route of the company on the Whop site.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

The written name of the company.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + CompanyTokenTransactionListItemCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyTokenTransactionListItemCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The slug/route of the company on the Whop site.

+ *

The slug/route of the company on the Whop site.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

The written name of the company.

+ *

The written name of the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public CompanyTokenTransactionListItemCompany build() { + return new CompanyTokenTransactionListItemCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CompanyTokenTransactionListItemMember.java b/src/main/java/com/whop/api/types/CompanyTokenTransactionListItemMember.java new file mode 100644 index 00000000..08826dce --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanyTokenTransactionListItemMember.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyTokenTransactionListItemMember.Builder.class) +public final class CompanyTokenTransactionListItemMember { + private final String id; + + private final Map additionalProperties; + + private CompanyTokenTransactionListItemMember(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company member. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyTokenTransactionListItemMember + && equalTo((CompanyTokenTransactionListItemMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyTokenTransactionListItemMember other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company member.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CompanyTokenTransactionListItemMember other); + } + + public interface _FinalStage { + CompanyTokenTransactionListItemMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyTokenTransactionListItemMember other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the company member.

+ *

The unique identifier for the company member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CompanyTokenTransactionListItemMember build() { + return new CompanyTokenTransactionListItemMember(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CompanyTokenTransactionListItemUser.java b/src/main/java/com/whop/api/types/CompanyTokenTransactionListItemUser.java new file mode 100644 index 00000000..8b41327f --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanyTokenTransactionListItemUser.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyTokenTransactionListItemUser.Builder.class) +public final class CompanyTokenTransactionListItemUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private CompanyTokenTransactionListItemUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyTokenTransactionListItemUser + && equalTo((CompanyTokenTransactionListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyTokenTransactionListItemUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(CompanyTokenTransactionListItemUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + CompanyTokenTransactionListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyTokenTransactionListItemUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public CompanyTokenTransactionListItemUser build() { + return new CompanyTokenTransactionListItemUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CompanyTokenTransactionMember.java b/src/main/java/com/whop/api/types/CompanyTokenTransactionMember.java new file mode 100644 index 00000000..4e77c0f4 --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanyTokenTransactionMember.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyTokenTransactionMember.Builder.class) +public final class CompanyTokenTransactionMember { + private final String id; + + private final Map additionalProperties; + + private CompanyTokenTransactionMember(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company member. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyTokenTransactionMember && equalTo((CompanyTokenTransactionMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyTokenTransactionMember other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company member.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CompanyTokenTransactionMember other); + } + + public interface _FinalStage { + CompanyTokenTransactionMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyTokenTransactionMember other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the company member.

+ *

The unique identifier for the company member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CompanyTokenTransactionMember build() { + return new CompanyTokenTransactionMember(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CompanyTokenTransactionTypes.java b/src/main/java/com/whop/api/types/CompanyTokenTransactionTypes.java new file mode 100644 index 00000000..0c6834ee --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanyTokenTransactionTypes.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CompanyTokenTransactionTypes { + public static final CompanyTokenTransactionTypes ADD = new CompanyTokenTransactionTypes(Value.ADD, "add"); + + public static final CompanyTokenTransactionTypes SUBTRACT = + new CompanyTokenTransactionTypes(Value.SUBTRACT, "subtract"); + + public static final CompanyTokenTransactionTypes TRANSFER = + new CompanyTokenTransactionTypes(Value.TRANSFER, "transfer"); + + private final Value value; + + private final String string; + + CompanyTokenTransactionTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CompanyTokenTransactionTypes + && this.string.equals(((CompanyTokenTransactionTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ADD: + return visitor.visitAdd(); + case SUBTRACT: + return visitor.visitSubtract(); + case TRANSFER: + return visitor.visitTransfer(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CompanyTokenTransactionTypes valueOf(String value) { + switch (value) { + case "add": + return ADD; + case "subtract": + return SUBTRACT; + case "transfer": + return TRANSFER; + default: + return new CompanyTokenTransactionTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + ADD, + + SUBTRACT, + + TRANSFER, + + UNKNOWN + } + + public interface Visitor { + T visitAdd(); + + T visitSubtract(); + + T visitTransfer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CompanyTokenTransactionUser.java b/src/main/java/com/whop/api/types/CompanyTokenTransactionUser.java new file mode 100644 index 00000000..21f31827 --- /dev/null +++ b/src/main/java/com/whop/api/types/CompanyTokenTransactionUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyTokenTransactionUser.Builder.class) +public final class CompanyTokenTransactionUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private CompanyTokenTransactionUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyTokenTransactionUser && equalTo((CompanyTokenTransactionUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyTokenTransactionUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(CompanyTokenTransactionUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + CompanyTokenTransactionUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyTokenTransactionUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public CompanyTokenTransactionUser build() { + return new CompanyTokenTransactionUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ConversionEvent.java b/src/main/java/com/whop/api/types/ConversionEvent.java new file mode 100644 index 00000000..62652429 --- /dev/null +++ b/src/main/java/com/whop/api/types/ConversionEvent.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = ConversionEvent.Deserializer.class) +public final class ConversionEvent { + private final Object value; + + private final int type; + + private ConversionEvent(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((ConversionEventZero) this.value); + } else if (this.type == 1) { + return visitor.visit((String) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConversionEvent && equalTo((ConversionEvent) other); + } + + private boolean equalTo(ConversionEvent other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static ConversionEvent of(ConversionEventZero value) { + return new ConversionEvent(value, 0); + } + + public static ConversionEvent of(String value) { + return new ConversionEvent(value, 1); + } + + public interface Visitor { + T visit(ConversionEventZero value); + + T visit(String value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(ConversionEvent.class); + } + + @java.lang.Override + public ConversionEvent deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ConversionEventZero.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/types/ConversionEventZero.java b/src/main/java/com/whop/api/types/ConversionEventZero.java new file mode 100644 index 00000000..10549e54 --- /dev/null +++ b/src/main/java/com/whop/api/types/ConversionEventZero.java @@ -0,0 +1,229 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ConversionEventZero { + public static final ConversionEventZero SUBMIT_APPLICATION = + new ConversionEventZero(Value.SUBMIT_APPLICATION, "submit_application"); + + public static final ConversionEventZero CONTENT_VIEW = new ConversionEventZero(Value.CONTENT_VIEW, "content_view"); + + public static final ConversionEventZero COMPLETE_REGISTRATION = + new ConversionEventZero(Value.COMPLETE_REGISTRATION, "complete_registration"); + + public static final ConversionEventZero SEARCH = new ConversionEventZero(Value.SEARCH, "search"); + + public static final ConversionEventZero START_TRIAL = new ConversionEventZero(Value.START_TRIAL, "start_trial"); + + public static final ConversionEventZero LEAD = new ConversionEventZero(Value.LEAD, "lead"); + + public static final ConversionEventZero PURCHASE = new ConversionEventZero(Value.PURCHASE, "purchase"); + + public static final ConversionEventZero SCHEDULE = new ConversionEventZero(Value.SCHEDULE, "schedule"); + + public static final ConversionEventZero ADD_TO_CART = new ConversionEventZero(Value.ADD_TO_CART, "add_to_cart"); + + public static final ConversionEventZero CUSTOMIZE_PRODUCT = + new ConversionEventZero(Value.CUSTOMIZE_PRODUCT, "customize_product"); + + public static final ConversionEventZero DONATE = new ConversionEventZero(Value.DONATE, "donate"); + + public static final ConversionEventZero FIND_LOCATION = + new ConversionEventZero(Value.FIND_LOCATION, "find_location"); + + public static final ConversionEventZero INITIATED_CHECKOUT = + new ConversionEventZero(Value.INITIATED_CHECKOUT, "initiated_checkout"); + + public static final ConversionEventZero CONTACT = new ConversionEventZero(Value.CONTACT, "contact"); + + public static final ConversionEventZero SUBSCRIBE = new ConversionEventZero(Value.SUBSCRIBE, "subscribe"); + + public static final ConversionEventZero ADD_PAYMENT_INFO = + new ConversionEventZero(Value.ADD_PAYMENT_INFO, "add_payment_info"); + + private final Value value; + + private final String string; + + ConversionEventZero(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ConversionEventZero && this.string.equals(((ConversionEventZero) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SUBMIT_APPLICATION: + return visitor.visitSubmitApplication(); + case CONTENT_VIEW: + return visitor.visitContentView(); + case COMPLETE_REGISTRATION: + return visitor.visitCompleteRegistration(); + case SEARCH: + return visitor.visitSearch(); + case START_TRIAL: + return visitor.visitStartTrial(); + case LEAD: + return visitor.visitLead(); + case PURCHASE: + return visitor.visitPurchase(); + case SCHEDULE: + return visitor.visitSchedule(); + case ADD_TO_CART: + return visitor.visitAddToCart(); + case CUSTOMIZE_PRODUCT: + return visitor.visitCustomizeProduct(); + case DONATE: + return visitor.visitDonate(); + case FIND_LOCATION: + return visitor.visitFindLocation(); + case INITIATED_CHECKOUT: + return visitor.visitInitiatedCheckout(); + case CONTACT: + return visitor.visitContact(); + case SUBSCRIBE: + return visitor.visitSubscribe(); + case ADD_PAYMENT_INFO: + return visitor.visitAddPaymentInfo(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ConversionEventZero valueOf(String value) { + switch (value) { + case "submit_application": + return SUBMIT_APPLICATION; + case "content_view": + return CONTENT_VIEW; + case "complete_registration": + return COMPLETE_REGISTRATION; + case "search": + return SEARCH; + case "start_trial": + return START_TRIAL; + case "lead": + return LEAD; + case "purchase": + return PURCHASE; + case "schedule": + return SCHEDULE; + case "add_to_cart": + return ADD_TO_CART; + case "customize_product": + return CUSTOMIZE_PRODUCT; + case "donate": + return DONATE; + case "find_location": + return FIND_LOCATION; + case "initiated_checkout": + return INITIATED_CHECKOUT; + case "contact": + return CONTACT; + case "subscribe": + return SUBSCRIBE; + case "add_payment_info": + return ADD_PAYMENT_INFO; + default: + return new ConversionEventZero(Value.UNKNOWN, value); + } + } + + public enum Value { + PURCHASE, + + ADD_TO_CART, + + INITIATED_CHECKOUT, + + ADD_PAYMENT_INFO, + + COMPLETE_REGISTRATION, + + LEAD, + + CONTENT_VIEW, + + SEARCH, + + CONTACT, + + CUSTOMIZE_PRODUCT, + + DONATE, + + FIND_LOCATION, + + SCHEDULE, + + START_TRIAL, + + SUBMIT_APPLICATION, + + SUBSCRIBE, + + UNKNOWN + } + + public interface Visitor { + T visitPurchase(); + + T visitAddToCart(); + + T visitInitiatedCheckout(); + + T visitAddPaymentInfo(); + + T visitCompleteRegistration(); + + T visitLead(); + + T visitContentView(); + + T visitSearch(); + + T visitContact(); + + T visitCustomizeProduct(); + + T visitDonate(); + + T visitFindLocation(); + + T visitSchedule(); + + T visitStartTrial(); + + T visitSubmitApplication(); + + T visitSubscribe(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Countries.java b/src/main/java/com/whop/api/types/Countries.java new file mode 100644 index 00000000..0378de94 --- /dev/null +++ b/src/main/java/com/whop/api/types/Countries.java @@ -0,0 +1,2482 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class Countries { + public static final Countries SY = new Countries(Value.SY, "sy"); + + public static final Countries KG = new Countries(Value.KG, "kg"); + + public static final Countries AF = new Countries(Value.AF, "af"); + + public static final Countries LU = new Countries(Value.LU, "lu"); + + public static final Countries BT = new Countries(Value.BT, "bt"); + + public static final Countries HN = new Countries(Value.HN, "hn"); + + public static final Countries QA = new Countries(Value.QA, "qa"); + + public static final Countries RO = new Countries(Value.RO, "ro"); + + public static final Countries LY = new Countries(Value.LY, "ly"); + + public static final Countries DO = new Countries(Value.DO, "do"); + + public static final Countries HR = new Countries(Value.HR, "hr"); + + public static final Countries GD = new Countries(Value.GD, "gd"); + + public static final Countries RS = new Countries(Value.RS, "rs"); + + public static final Countries AN = new Countries(Value.AN, "an"); + + public static final Countries IL = new Countries(Value.IL, "il"); + + public static final Countries NL = new Countries(Value.NL, "nl"); + + public static final Countries LI = new Countries(Value.LI, "li"); + + public static final Countries CV = new Countries(Value.CV, "cv"); + + public static final Countries CA = new Countries(Value.CA, "ca"); + + public static final Countries NP = new Countries(Value.NP, "np"); + + public static final Countries TJ = new Countries(Value.TJ, "tj"); + + public static final Countries CZ = new Countries(Value.CZ, "cz"); + + public static final Countries KW = new Countries(Value.KW, "kw"); + + public static final Countries IT = new Countries(Value.IT, "it"); + + public static final Countries AB = new Countries(Value.AB, "ab"); + + public static final Countries TN = new Countries(Value.TN, "tn"); + + public static final Countries CI = new Countries(Value.CI, "ci"); + + public static final Countries TO = new Countries(Value.TO, "to"); + + public static final Countries AZ = new Countries(Value.AZ, "az"); + + public static final Countries GT = new Countries(Value.GT, "gt"); + + public static final Countries PH = new Countries(Value.PH, "ph"); + + public static final Countries SD = new Countries(Value.SD, "sd"); + + public static final Countries ID = new Countries(Value.ID, "id"); + + public static final Countries TR = new Countries(Value.TR, "tr"); + + public static final Countries CM = new Countries(Value.CM, "cm"); + + public static final Countries MN = new Countries(Value.MN, "mn"); + + public static final Countries PL = new Countries(Value.PL, "pl"); + + public static final Countries SH = new Countries(Value.SH, "sh"); + + public static final Countries CN = new Countries(Value.CN, "cn"); + + public static final Countries ZM = new Countries(Value.ZM, "zm"); + + public static final Countries TW = new Countries(Value.TW, "tw"); + + public static final Countries TV = new Countries(Value.TV, "tv"); + + public static final Countries MR = new Countries(Value.MR, "mr"); + + public static final Countries SL = new Countries(Value.SL, "sl"); + + public static final Countries TZ = new Countries(Value.TZ, "tz"); + + public static final Countries CR = new Countries(Value.CR, "cr"); + + public static final Countries GH = new Countries(Value.GH, "gh"); + + public static final Countries RW = new Countries(Value.RW, "rw"); + + public static final Countries CU = new Countries(Value.CU, "cu"); + + public static final Countries AR = new Countries(Value.AR, "ar"); + + public static final Countries PT = new Countries(Value.PT, "pt"); + + public static final Countries IO = new Countries(Value.IO, "io"); + + public static final Countries EE = new Countries(Value.EE, "ee"); + + public static final Countries TG = new Countries(Value.TG, "tg"); + + public static final Countries ZA = new Countries(Value.ZA, "za"); + + public static final Countries VN = new Countries(Value.VN, "vn"); + + public static final Countries GL = new Countries(Value.GL, "gl"); + + public static final Countries CY = new Countries(Value.CY, "cy"); + + public static final Countries IS = new Countries(Value.IS, "is"); + + public static final Countries MF = new Countries(Value.MF, "mf"); + + public static final Countries TK = new Countries(Value.TK, "tk"); + + public static final Countries CF = new Countries(Value.CF, "cf"); + + public static final Countries NU = new Countries(Value.NU, "nu"); + + public static final Countries GP = new Countries(Value.GP, "gp"); + + public static final Countries OM = new Countries(Value.OM, "om"); + + public static final Countries VU = new Countries(Value.VU, "vu"); + + public static final Countries NA = new Countries(Value.NA, "na"); + + public static final Countries BS = new Countries(Value.BS, "bs"); + + public static final Countries HK = new Countries(Value.HK, "hk"); + + public static final Countries AE = new Countries(Value.AE, "ae"); + + public static final Countries LV = new Countries(Value.LV, "lv"); + + public static final Countries KH = new Countries(Value.KH, "kh"); + + public static final Countries YT = new Countries(Value.YT, "yt"); + + public static final Countries NG = new Countries(Value.NG, "ng"); + + public static final Countries UM = new Countries(Value.UM, "um"); + + public static final Countries GA = new Countries(Value.GA, "ga"); + + public static final Countries ET = new Countries(Value.ET, "et"); + + public static final Countries NI = new Countries(Value.NI, "ni"); + + public static final Countries DJ = new Countries(Value.DJ, "dj"); + + public static final Countries AM = new Countries(Value.AM, "am"); + + public static final Countries GI = new Countries(Value.GI, "gi"); + + public static final Countries MA = new Countries(Value.MA, "ma"); + + public static final Countries US = new Countries(Value.US, "us"); + + public static final Countries MV = new Countries(Value.MV, "mv"); + + public static final Countries SN = new Countries(Value.SN, "sn"); + + public static final Countries MX = new Countries(Value.MX, "mx"); + + public static final Countries AS = new Countries(Value.AS, "as"); + + public static final Countries PW = new Countries(Value.PW, "pw"); + + public static final Countries AU = new Countries(Value.AU, "au"); + + public static final Countries BM = new Countries(Value.BM, "bm"); + + public static final Countries ST = new Countries(Value.ST, "st"); + + public static final Countries SV = new Countries(Value.SV, "sv"); + + public static final Countries MG = new Countries(Value.MG, "mg"); + + public static final Countries GQ = new Countries(Value.GQ, "gq"); + + public static final Countries PF = new Countries(Value.PF, "pf"); + + public static final Countries GR = new Countries(Value.GR, "gr"); + + public static final Countries JP = new Countries(Value.JP, "jp"); + + public static final Countries PG = new Countries(Value.PG, "pg"); + + public static final Countries SE = new Countries(Value.SE, "se"); + + public static final Countries CL = new Countries(Value.CL, "cl"); + + public static final Countries CK = new Countries(Value.CK, "ck"); + + public static final Countries LA = new Countries(Value.LA, "la"); + + public static final Countries TT = new Countries(Value.TT, "tt"); + + public static final Countries DZ = new Countries(Value.DZ, "dz"); + + public static final Countries MP = new Countries(Value.MP, "mp"); + + public static final Countries MO = new Countries(Value.MO, "mo"); + + public static final Countries FJ = new Countries(Value.FJ, "fj"); + + public static final Countries WS = new Countries(Value.WS, "ws"); + + public static final Countries FK = new Countries(Value.FK, "fk"); + + public static final Countries GY = new Countries(Value.GY, "gy"); + + public static final Countries VE = new Countries(Value.VE, "ve"); + + public static final Countries BD = new Countries(Value.BD, "bd"); + + public static final Countries PN = new Countries(Value.PN, "pn"); + + public static final Countries BE = new Countries(Value.BE, "be"); + + public static final Countries DK = new Countries(Value.DK, "dk"); + + public static final Countries SM = new Countries(Value.SM, "sm"); + + public static final Countries MW = new Countries(Value.MW, "mw"); + + public static final Countries EC = new Countries(Value.EC, "ec"); + + public static final Countries FR = new Countries(Value.FR, "fr"); + + public static final Countries NO = new Countries(Value.NO, "no"); + + public static final Countries BL = new Countries(Value.BL, "bl"); + + public static final Countries AT = new Countries(Value.AT, "at"); + + public static final Countries IQ = new Countries(Value.IQ, "iq"); + + public static final Countries CD = new Countries(Value.CD, "cd"); + + public static final Countries TM = new Countries(Value.TM, "tm"); + + public static final Countries MH = new Countries(Value.MH, "mh"); + + public static final Countries AD = new Countries(Value.AD, "ad"); + + public static final Countries LS = new Countries(Value.LS, "ls"); + + public static final Countries BR = new Countries(Value.BR, "br"); + + public static final Countries KE = new Countries(Value.KE, "ke"); + + public static final Countries KI = new Countries(Value.KI, "ki"); + + public static final Countries ES = new Countries(Value.ES, "es"); + + public static final Countries GB = new Countries(Value.GB, "gb"); + + public static final Countries DE = new Countries(Value.DE, "de"); + + public static final Countries BZ = new Countries(Value.BZ, "bz"); + + public static final Countries KM = new Countries(Value.KM, "km"); + + public static final Countries AL = new Countries(Value.AL, "al"); + + public static final Countries XK = new Countries(Value.XK, "xk"); + + public static final Countries GF = new Countries(Value.GF, "gf"); + + public static final Countries RU = new Countries(Value.RU, "ru"); + + public static final Countries TD = new Countries(Value.TD, "td"); + + public static final Countries HT = new Countries(Value.HT, "ht"); + + public static final Countries LK = new Countries(Value.LK, "lk"); + + public static final Countries IN = new Countries(Value.IN, "in"); + + public static final Countries CX = new Countries(Value.CX, "cx"); + + public static final Countries ZW = new Countries(Value.ZW, "zw"); + + public static final Countries TH = new Countries(Value.TH, "th"); + + public static final Countries CC = new Countries(Value.CC, "cc"); + + public static final Countries NR = new Countries(Value.NR, "nr"); + + public static final Countries RE = new Countries(Value.RE, "re"); + + public static final Countries TL = new Countries(Value.TL, "tl"); + + public static final Countries KY = new Countries(Value.KY, "ky"); + + public static final Countries CG = new Countries(Value.CG, "cg"); + + public static final Countries JO = new Countries(Value.JO, "jo"); + + public static final Countries SC = new Countries(Value.SC, "sc"); + + public static final Countries MM = new Countries(Value.MM, "mm"); + + public static final Countries FI = new Countries(Value.FI, "fi"); + + public static final Countries GW = new Countries(Value.GW, "gw"); + + public static final Countries VC = new Countries(Value.VC, "vc"); + + public static final Countries SG = new Countries(Value.SG, "sg"); + + public static final Countries LB = new Countries(Value.LB, "lb"); + + public static final Countries LC = new Countries(Value.LC, "lc"); + + public static final Countries BB = new Countries(Value.BB, "bb"); + + public static final Countries MQ = new Countries(Value.MQ, "mq"); + + public static final Countries PM = new Countries(Value.PM, "pm"); + + public static final Countries FM = new Countries(Value.FM, "fm"); + + public static final Countries VG = new Countries(Value.VG, "vg"); + + public static final Countries SK = new Countries(Value.SK, "sk"); + + public static final Countries BF = new Countries(Value.BF, "bf"); + + public static final Countries MU = new Countries(Value.MU, "mu"); + + public static final Countries YE = new Countries(Value.YE, "ye"); + + public static final Countries KR = new Countries(Value.KR, "kr"); + + public static final Countries DM = new Countries(Value.DM, "dm"); + + public static final Countries SO = new Countries(Value.SO, "so"); + + public static final Countries BJ = new Countries(Value.BJ, "bj"); + + public static final Countries MY = new Countries(Value.MY, "my"); + + public static final Countries SS = new Countries(Value.SS, "ss"); + + public static final Countries PA = new Countries(Value.PA, "pa"); + + public static final Countries WF = new Countries(Value.WF, "wf"); + + public static final Countries BN = new Countries(Value.BN, "bn"); + + public static final Countries UZ = new Countries(Value.UZ, "uz"); + + public static final Countries PE = new Countries(Value.PE, "pe"); + + public static final Countries LR = new Countries(Value.LR, "lr"); + + public static final Countries KZ = new Countries(Value.KZ, "kz"); + + public static final Countries UG = new Countries(Value.UG, "ug"); + + public static final Countries SX = new Countries(Value.SX, "sx"); + + public static final Countries NC = new Countries(Value.NC, "nc"); + + public static final Countries SZ = new Countries(Value.SZ, "sz"); + + public static final Countries LT = new Countries(Value.LT, "lt"); + + public static final Countries AG = new Countries(Value.AG, "ag"); + + public static final Countries NE = new Countries(Value.NE, "ne"); + + public static final Countries BW = new Countries(Value.BW, "bw"); + + public static final Countries AI = new Countries(Value.AI, "ai"); + + public static final Countries KN = new Countries(Value.KN, "kn"); + + public static final Countries BY = new Countries(Value.BY, "by"); + + public static final Countries GE = new Countries(Value.GE, "ge"); + + public static final Countries TC = new Countries(Value.TC, "tc"); + + public static final Countries AO = new Countries(Value.AO, "ao"); + + public static final Countries GG = new Countries(Value.GG, "gg"); + + public static final Countries VI = new Countries(Value.VI, "vi"); + + public static final Countries AQ = new Countries(Value.AQ, "aq"); + + public static final Countries PS = new Countries(Value.PS, "ps"); + + public static final Countries BG = new Countries(Value.BG, "bg"); + + public static final Countries BI = new Countries(Value.BI, "bi"); + + public static final Countries MZ = new Countries(Value.MZ, "mz"); + + public static final Countries SR = new Countries(Value.SR, "sr"); + + public static final Countries MC = new Countries(Value.MC, "mc"); + + public static final Countries EH = new Countries(Value.EH, "eh"); + + public static final Countries GM = new Countries(Value.GM, "gm"); + + public static final Countries ME = new Countries(Value.ME, "me"); + + public static final Countries UY = new Countries(Value.UY, "uy"); + + public static final Countries BO = new Countries(Value.BO, "bo"); + + public static final Countries PY = new Countries(Value.PY, "py"); + + public static final Countries AW = new Countries(Value.AW, "aw"); + + public static final Countries SA = new Countries(Value.SA, "sa"); + + public static final Countries CH = new Countries(Value.CH, "ch"); + + public static final Countries SB = new Countries(Value.SB, "sb"); + + public static final Countries ML = new Countries(Value.ML, "ml"); + + public static final Countries MK = new Countries(Value.MK, "mk"); + + public static final Countries GU = new Countries(Value.GU, "gu"); + + public static final Countries VA = new Countries(Value.VA, "va"); + + public static final Countries NZ = new Countries(Value.NZ, "nz"); + + public static final Countries IE = new Countries(Value.IE, "ie"); + + public static final Countries BA = new Countries(Value.BA, "ba"); + + public static final Countries PK = new Countries(Value.PK, "pk"); + + public static final Countries CO = new Countries(Value.CO, "co"); + + public static final Countries SI = new Countries(Value.SI, "si"); + + public static final Countries MS = new Countries(Value.MS, "ms"); + + public static final Countries SJ = new Countries(Value.SJ, "sj"); + + public static final Countries MT = new Countries(Value.MT, "mt"); + + public static final Countries FO = new Countries(Value.FO, "fo"); + + public static final Countries HU = new Countries(Value.HU, "hu"); + + public static final Countries BH = new Countries(Value.BH, "bh"); + + public static final Countries JE = new Countries(Value.JE, "je"); + + public static final Countries PR = new Countries(Value.PR, "pr"); + + public static final Countries IM = new Countries(Value.IM, "im"); + + public static final Countries CW = new Countries(Value.CW, "cw"); + + public static final Countries EG = new Countries(Value.EG, "eg"); + + public static final Countries MD = new Countries(Value.MD, "md"); + + public static final Countries UA = new Countries(Value.UA, "ua"); + + public static final Countries GN = new Countries(Value.GN, "gn"); + + public static final Countries JM = new Countries(Value.JM, "jm"); + + private final Value value; + + private final String string; + + Countries(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof Countries && this.string.equals(((Countries) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SY: + return visitor.visitSy(); + case KG: + return visitor.visitKg(); + case AF: + return visitor.visitAf(); + case LU: + return visitor.visitLu(); + case BT: + return visitor.visitBt(); + case HN: + return visitor.visitHn(); + case QA: + return visitor.visitQa(); + case RO: + return visitor.visitRo(); + case LY: + return visitor.visitLy(); + case DO: + return visitor.visitDo(); + case HR: + return visitor.visitHr(); + case GD: + return visitor.visitGd(); + case RS: + return visitor.visitRs(); + case AN: + return visitor.visitAn(); + case IL: + return visitor.visitIl(); + case NL: + return visitor.visitNl(); + case LI: + return visitor.visitLi(); + case CV: + return visitor.visitCv(); + case CA: + return visitor.visitCa(); + case NP: + return visitor.visitNp(); + case TJ: + return visitor.visitTj(); + case CZ: + return visitor.visitCz(); + case KW: + return visitor.visitKw(); + case IT: + return visitor.visitIt(); + case AB: + return visitor.visitAb(); + case TN: + return visitor.visitTn(); + case CI: + return visitor.visitCi(); + case TO: + return visitor.visitTo(); + case AZ: + return visitor.visitAz(); + case GT: + return visitor.visitGt(); + case PH: + return visitor.visitPh(); + case SD: + return visitor.visitSd(); + case ID: + return visitor.visitId(); + case TR: + return visitor.visitTr(); + case CM: + return visitor.visitCm(); + case MN: + return visitor.visitMn(); + case PL: + return visitor.visitPl(); + case SH: + return visitor.visitSh(); + case CN: + return visitor.visitCn(); + case ZM: + return visitor.visitZm(); + case TW: + return visitor.visitTw(); + case TV: + return visitor.visitTv(); + case MR: + return visitor.visitMr(); + case SL: + return visitor.visitSl(); + case TZ: + return visitor.visitTz(); + case CR: + return visitor.visitCr(); + case GH: + return visitor.visitGh(); + case RW: + return visitor.visitRw(); + case CU: + return visitor.visitCu(); + case AR: + return visitor.visitAr(); + case PT: + return visitor.visitPt(); + case IO: + return visitor.visitIo(); + case EE: + return visitor.visitEe(); + case TG: + return visitor.visitTg(); + case ZA: + return visitor.visitZa(); + case VN: + return visitor.visitVn(); + case GL: + return visitor.visitGl(); + case CY: + return visitor.visitCy(); + case IS: + return visitor.visitIs(); + case MF: + return visitor.visitMf(); + case TK: + return visitor.visitTk(); + case CF: + return visitor.visitCf(); + case NU: + return visitor.visitNu(); + case GP: + return visitor.visitGp(); + case OM: + return visitor.visitOm(); + case VU: + return visitor.visitVu(); + case NA: + return visitor.visitNa(); + case BS: + return visitor.visitBs(); + case HK: + return visitor.visitHk(); + case AE: + return visitor.visitAe(); + case LV: + return visitor.visitLv(); + case KH: + return visitor.visitKh(); + case YT: + return visitor.visitYt(); + case NG: + return visitor.visitNg(); + case UM: + return visitor.visitUm(); + case GA: + return visitor.visitGa(); + case ET: + return visitor.visitEt(); + case NI: + return visitor.visitNi(); + case DJ: + return visitor.visitDj(); + case AM: + return visitor.visitAm(); + case GI: + return visitor.visitGi(); + case MA: + return visitor.visitMa(); + case US: + return visitor.visitUs(); + case MV: + return visitor.visitMv(); + case SN: + return visitor.visitSn(); + case MX: + return visitor.visitMx(); + case AS: + return visitor.visitAs(); + case PW: + return visitor.visitPw(); + case AU: + return visitor.visitAu(); + case BM: + return visitor.visitBm(); + case ST: + return visitor.visitSt(); + case SV: + return visitor.visitSv(); + case MG: + return visitor.visitMg(); + case GQ: + return visitor.visitGq(); + case PF: + return visitor.visitPf(); + case GR: + return visitor.visitGr(); + case JP: + return visitor.visitJp(); + case PG: + return visitor.visitPg(); + case SE: + return visitor.visitSe(); + case CL: + return visitor.visitCl(); + case CK: + return visitor.visitCk(); + case LA: + return visitor.visitLa(); + case TT: + return visitor.visitTt(); + case DZ: + return visitor.visitDz(); + case MP: + return visitor.visitMp(); + case MO: + return visitor.visitMo(); + case FJ: + return visitor.visitFj(); + case WS: + return visitor.visitWs(); + case FK: + return visitor.visitFk(); + case GY: + return visitor.visitGy(); + case VE: + return visitor.visitVe(); + case BD: + return visitor.visitBd(); + case PN: + return visitor.visitPn(); + case BE: + return visitor.visitBe(); + case DK: + return visitor.visitDk(); + case SM: + return visitor.visitSm(); + case MW: + return visitor.visitMw(); + case EC: + return visitor.visitEc(); + case FR: + return visitor.visitFr(); + case NO: + return visitor.visitNo(); + case BL: + return visitor.visitBl(); + case AT: + return visitor.visitAt(); + case IQ: + return visitor.visitIq(); + case CD: + return visitor.visitCd(); + case TM: + return visitor.visitTm(); + case MH: + return visitor.visitMh(); + case AD: + return visitor.visitAd(); + case LS: + return visitor.visitLs(); + case BR: + return visitor.visitBr(); + case KE: + return visitor.visitKe(); + case KI: + return visitor.visitKi(); + case ES: + return visitor.visitEs(); + case GB: + return visitor.visitGb(); + case DE: + return visitor.visitDe(); + case BZ: + return visitor.visitBz(); + case KM: + return visitor.visitKm(); + case AL: + return visitor.visitAl(); + case XK: + return visitor.visitXk(); + case GF: + return visitor.visitGf(); + case RU: + return visitor.visitRu(); + case TD: + return visitor.visitTd(); + case HT: + return visitor.visitHt(); + case LK: + return visitor.visitLk(); + case IN: + return visitor.visitIn(); + case CX: + return visitor.visitCx(); + case ZW: + return visitor.visitZw(); + case TH: + return visitor.visitTh(); + case CC: + return visitor.visitCc(); + case NR: + return visitor.visitNr(); + case RE: + return visitor.visitRe(); + case TL: + return visitor.visitTl(); + case KY: + return visitor.visitKy(); + case CG: + return visitor.visitCg(); + case JO: + return visitor.visitJo(); + case SC: + return visitor.visitSc(); + case MM: + return visitor.visitMm(); + case FI: + return visitor.visitFi(); + case GW: + return visitor.visitGw(); + case VC: + return visitor.visitVc(); + case SG: + return visitor.visitSg(); + case LB: + return visitor.visitLb(); + case LC: + return visitor.visitLc(); + case BB: + return visitor.visitBb(); + case MQ: + return visitor.visitMq(); + case PM: + return visitor.visitPm(); + case FM: + return visitor.visitFm(); + case VG: + return visitor.visitVg(); + case SK: + return visitor.visitSk(); + case BF: + return visitor.visitBf(); + case MU: + return visitor.visitMu(); + case YE: + return visitor.visitYe(); + case KR: + return visitor.visitKr(); + case DM: + return visitor.visitDm(); + case SO: + return visitor.visitSo(); + case BJ: + return visitor.visitBj(); + case MY: + return visitor.visitMy(); + case SS: + return visitor.visitSs(); + case PA: + return visitor.visitPa(); + case WF: + return visitor.visitWf(); + case BN: + return visitor.visitBn(); + case UZ: + return visitor.visitUz(); + case PE: + return visitor.visitPe(); + case LR: + return visitor.visitLr(); + case KZ: + return visitor.visitKz(); + case UG: + return visitor.visitUg(); + case SX: + return visitor.visitSx(); + case NC: + return visitor.visitNc(); + case SZ: + return visitor.visitSz(); + case LT: + return visitor.visitLt(); + case AG: + return visitor.visitAg(); + case NE: + return visitor.visitNe(); + case BW: + return visitor.visitBw(); + case AI: + return visitor.visitAi(); + case KN: + return visitor.visitKn(); + case BY: + return visitor.visitBy(); + case GE: + return visitor.visitGe(); + case TC: + return visitor.visitTc(); + case AO: + return visitor.visitAo(); + case GG: + return visitor.visitGg(); + case VI: + return visitor.visitVi(); + case AQ: + return visitor.visitAq(); + case PS: + return visitor.visitPs(); + case BG: + return visitor.visitBg(); + case BI: + return visitor.visitBi(); + case MZ: + return visitor.visitMz(); + case SR: + return visitor.visitSr(); + case MC: + return visitor.visitMc(); + case EH: + return visitor.visitEh(); + case GM: + return visitor.visitGm(); + case ME: + return visitor.visitMe(); + case UY: + return visitor.visitUy(); + case BO: + return visitor.visitBo(); + case PY: + return visitor.visitPy(); + case AW: + return visitor.visitAw(); + case SA: + return visitor.visitSa(); + case CH: + return visitor.visitCh(); + case SB: + return visitor.visitSb(); + case ML: + return visitor.visitMl(); + case MK: + return visitor.visitMk(); + case GU: + return visitor.visitGu(); + case VA: + return visitor.visitVa(); + case NZ: + return visitor.visitNz(); + case IE: + return visitor.visitIe(); + case BA: + return visitor.visitBa(); + case PK: + return visitor.visitPk(); + case CO: + return visitor.visitCo(); + case SI: + return visitor.visitSi(); + case MS: + return visitor.visitMs(); + case SJ: + return visitor.visitSj(); + case MT: + return visitor.visitMt(); + case FO: + return visitor.visitFo(); + case HU: + return visitor.visitHu(); + case BH: + return visitor.visitBh(); + case JE: + return visitor.visitJe(); + case PR: + return visitor.visitPr(); + case IM: + return visitor.visitIm(); + case CW: + return visitor.visitCw(); + case EG: + return visitor.visitEg(); + case MD: + return visitor.visitMd(); + case UA: + return visitor.visitUa(); + case GN: + return visitor.visitGn(); + case JM: + return visitor.visitJm(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static Countries valueOf(String value) { + switch (value) { + case "sy": + return SY; + case "kg": + return KG; + case "af": + return AF; + case "lu": + return LU; + case "bt": + return BT; + case "hn": + return HN; + case "qa": + return QA; + case "ro": + return RO; + case "ly": + return LY; + case "do": + return DO; + case "hr": + return HR; + case "gd": + return GD; + case "rs": + return RS; + case "an": + return AN; + case "il": + return IL; + case "nl": + return NL; + case "li": + return LI; + case "cv": + return CV; + case "ca": + return CA; + case "np": + return NP; + case "tj": + return TJ; + case "cz": + return CZ; + case "kw": + return KW; + case "it": + return IT; + case "ab": + return AB; + case "tn": + return TN; + case "ci": + return CI; + case "to": + return TO; + case "az": + return AZ; + case "gt": + return GT; + case "ph": + return PH; + case "sd": + return SD; + case "id": + return ID; + case "tr": + return TR; + case "cm": + return CM; + case "mn": + return MN; + case "pl": + return PL; + case "sh": + return SH; + case "cn": + return CN; + case "zm": + return ZM; + case "tw": + return TW; + case "tv": + return TV; + case "mr": + return MR; + case "sl": + return SL; + case "tz": + return TZ; + case "cr": + return CR; + case "gh": + return GH; + case "rw": + return RW; + case "cu": + return CU; + case "ar": + return AR; + case "pt": + return PT; + case "io": + return IO; + case "ee": + return EE; + case "tg": + return TG; + case "za": + return ZA; + case "vn": + return VN; + case "gl": + return GL; + case "cy": + return CY; + case "is": + return IS; + case "mf": + return MF; + case "tk": + return TK; + case "cf": + return CF; + case "nu": + return NU; + case "gp": + return GP; + case "om": + return OM; + case "vu": + return VU; + case "na": + return NA; + case "bs": + return BS; + case "hk": + return HK; + case "ae": + return AE; + case "lv": + return LV; + case "kh": + return KH; + case "yt": + return YT; + case "ng": + return NG; + case "um": + return UM; + case "ga": + return GA; + case "et": + return ET; + case "ni": + return NI; + case "dj": + return DJ; + case "am": + return AM; + case "gi": + return GI; + case "ma": + return MA; + case "us": + return US; + case "mv": + return MV; + case "sn": + return SN; + case "mx": + return MX; + case "as": + return AS; + case "pw": + return PW; + case "au": + return AU; + case "bm": + return BM; + case "st": + return ST; + case "sv": + return SV; + case "mg": + return MG; + case "gq": + return GQ; + case "pf": + return PF; + case "gr": + return GR; + case "jp": + return JP; + case "pg": + return PG; + case "se": + return SE; + case "cl": + return CL; + case "ck": + return CK; + case "la": + return LA; + case "tt": + return TT; + case "dz": + return DZ; + case "mp": + return MP; + case "mo": + return MO; + case "fj": + return FJ; + case "ws": + return WS; + case "fk": + return FK; + case "gy": + return GY; + case "ve": + return VE; + case "bd": + return BD; + case "pn": + return PN; + case "be": + return BE; + case "dk": + return DK; + case "sm": + return SM; + case "mw": + return MW; + case "ec": + return EC; + case "fr": + return FR; + case "no": + return NO; + case "bl": + return BL; + case "at": + return AT; + case "iq": + return IQ; + case "cd": + return CD; + case "tm": + return TM; + case "mh": + return MH; + case "ad": + return AD; + case "ls": + return LS; + case "br": + return BR; + case "ke": + return KE; + case "ki": + return KI; + case "es": + return ES; + case "gb": + return GB; + case "de": + return DE; + case "bz": + return BZ; + case "km": + return KM; + case "al": + return AL; + case "xk": + return XK; + case "gf": + return GF; + case "ru": + return RU; + case "td": + return TD; + case "ht": + return HT; + case "lk": + return LK; + case "in": + return IN; + case "cx": + return CX; + case "zw": + return ZW; + case "th": + return TH; + case "cc": + return CC; + case "nr": + return NR; + case "re": + return RE; + case "tl": + return TL; + case "ky": + return KY; + case "cg": + return CG; + case "jo": + return JO; + case "sc": + return SC; + case "mm": + return MM; + case "fi": + return FI; + case "gw": + return GW; + case "vc": + return VC; + case "sg": + return SG; + case "lb": + return LB; + case "lc": + return LC; + case "bb": + return BB; + case "mq": + return MQ; + case "pm": + return PM; + case "fm": + return FM; + case "vg": + return VG; + case "sk": + return SK; + case "bf": + return BF; + case "mu": + return MU; + case "ye": + return YE; + case "kr": + return KR; + case "dm": + return DM; + case "so": + return SO; + case "bj": + return BJ; + case "my": + return MY; + case "ss": + return SS; + case "pa": + return PA; + case "wf": + return WF; + case "bn": + return BN; + case "uz": + return UZ; + case "pe": + return PE; + case "lr": + return LR; + case "kz": + return KZ; + case "ug": + return UG; + case "sx": + return SX; + case "nc": + return NC; + case "sz": + return SZ; + case "lt": + return LT; + case "ag": + return AG; + case "ne": + return NE; + case "bw": + return BW; + case "ai": + return AI; + case "kn": + return KN; + case "by": + return BY; + case "ge": + return GE; + case "tc": + return TC; + case "ao": + return AO; + case "gg": + return GG; + case "vi": + return VI; + case "aq": + return AQ; + case "ps": + return PS; + case "bg": + return BG; + case "bi": + return BI; + case "mz": + return MZ; + case "sr": + return SR; + case "mc": + return MC; + case "eh": + return EH; + case "gm": + return GM; + case "me": + return ME; + case "uy": + return UY; + case "bo": + return BO; + case "py": + return PY; + case "aw": + return AW; + case "sa": + return SA; + case "ch": + return CH; + case "sb": + return SB; + case "ml": + return ML; + case "mk": + return MK; + case "gu": + return GU; + case "va": + return VA; + case "nz": + return NZ; + case "ie": + return IE; + case "ba": + return BA; + case "pk": + return PK; + case "co": + return CO; + case "si": + return SI; + case "ms": + return MS; + case "sj": + return SJ; + case "mt": + return MT; + case "fo": + return FO; + case "hu": + return HU; + case "bh": + return BH; + case "je": + return JE; + case "pr": + return PR; + case "im": + return IM; + case "cw": + return CW; + case "eg": + return EG; + case "md": + return MD; + case "ua": + return UA; + case "gn": + return GN; + case "jm": + return JM; + default: + return new Countries(Value.UNKNOWN, value); + } + } + + public enum Value { + US, + + CA, + + GB, + + AB, + + AF, + + AL, + + DZ, + + AS, + + AD, + + AO, + + AI, + + AQ, + + AG, + + AR, + + AM, + + AW, + + AU, + + AT, + + AZ, + + BS, + + BH, + + BD, + + BB, + + BY, + + BE, + + BZ, + + BJ, + + BM, + + BT, + + BO, + + BA, + + BW, + + BR, + + IO, + + VG, + + BN, + + BG, + + BF, + + BI, + + KH, + + CM, + + CV, + + KY, + + CF, + + TD, + + CL, + + CN, + + CX, + + CC, + + CO, + + KM, + + CG, + + CK, + + CR, + + CI, + + HR, + + CU, + + CW, + + CY, + + CZ, + + CD, + + DK, + + DJ, + + DM, + + DO, + + EC, + + EG, + + SV, + + GQ, + + EE, + + ET, + + FK, + + FO, + + FJ, + + FI, + + FR, + + GF, + + PF, + + GA, + + GM, + + GE, + + DE, + + GH, + + GI, + + GR, + + GL, + + GD, + + GP, + + GU, + + GT, + + GG, + + GN, + + GW, + + GY, + + HT, + + HN, + + HK, + + HU, + + IS, + + IN, + + ID, + + IQ, + + IE, + + IM, + + IL, + + IT, + + JM, + + SJ, + + JP, + + JE, + + JO, + + KZ, + + KE, + + KI, + + XK, + + KW, + + KG, + + LA, + + LV, + + LB, + + LS, + + LR, + + LY, + + LI, + + LT, + + LU, + + MO, + + MK, + + MG, + + MW, + + MY, + + MV, + + ML, + + MT, + + MH, + + MQ, + + MR, + + MU, + + YT, + + MX, + + FM, + + MD, + + MC, + + MN, + + ME, + + MS, + + MA, + + MZ, + + MM, + + NA, + + NR, + + NP, + + NL, + + AN, + + NC, + + NZ, + + NI, + + NE, + + NG, + + NU, + + MP, + + NO, + + OM, + + PK, + + PW, + + PS, + + PA, + + PG, + + PY, + + PE, + + PH, + + PN, + + PL, + + PT, + + PR, + + QA, + + RE, + + RO, + + RU, + + RW, + + BL, + + SH, + + KN, + + LC, + + MF, + + PM, + + VC, + + WS, + + SM, + + ST, + + SA, + + SN, + + RS, + + SC, + + SL, + + SG, + + SX, + + SK, + + SI, + + SB, + + SO, + + ZA, + + KR, + + SS, + + ES, + + LK, + + SD, + + SR, + + SZ, + + SE, + + CH, + + TW, + + TJ, + + TZ, + + TH, + + TL, + + TG, + + TK, + + TO, + + TT, + + TN, + + TR, + + TM, + + TC, + + TV, + + VI, + + UG, + + UA, + + AE, + + UM, + + UY, + + UZ, + + VU, + + VA, + + VE, + + VN, + + WF, + + EH, + + YE, + + ZM, + + ZW, + + SY, + + UNKNOWN + } + + public interface Visitor { + T visitUs(); + + T visitCa(); + + T visitGb(); + + T visitAb(); + + T visitAf(); + + T visitAl(); + + T visitDz(); + + T visitAs(); + + T visitAd(); + + T visitAo(); + + T visitAi(); + + T visitAq(); + + T visitAg(); + + T visitAr(); + + T visitAm(); + + T visitAw(); + + T visitAu(); + + T visitAt(); + + T visitAz(); + + T visitBs(); + + T visitBh(); + + T visitBd(); + + T visitBb(); + + T visitBy(); + + T visitBe(); + + T visitBz(); + + T visitBj(); + + T visitBm(); + + T visitBt(); + + T visitBo(); + + T visitBa(); + + T visitBw(); + + T visitBr(); + + T visitIo(); + + T visitVg(); + + T visitBn(); + + T visitBg(); + + T visitBf(); + + T visitBi(); + + T visitKh(); + + T visitCm(); + + T visitCv(); + + T visitKy(); + + T visitCf(); + + T visitTd(); + + T visitCl(); + + T visitCn(); + + T visitCx(); + + T visitCc(); + + T visitCo(); + + T visitKm(); + + T visitCg(); + + T visitCk(); + + T visitCr(); + + T visitCi(); + + T visitHr(); + + T visitCu(); + + T visitCw(); + + T visitCy(); + + T visitCz(); + + T visitCd(); + + T visitDk(); + + T visitDj(); + + T visitDm(); + + T visitDo(); + + T visitEc(); + + T visitEg(); + + T visitSv(); + + T visitGq(); + + T visitEe(); + + T visitEt(); + + T visitFk(); + + T visitFo(); + + T visitFj(); + + T visitFi(); + + T visitFr(); + + T visitGf(); + + T visitPf(); + + T visitGa(); + + T visitGm(); + + T visitGe(); + + T visitDe(); + + T visitGh(); + + T visitGi(); + + T visitGr(); + + T visitGl(); + + T visitGd(); + + T visitGp(); + + T visitGu(); + + T visitGt(); + + T visitGg(); + + T visitGn(); + + T visitGw(); + + T visitGy(); + + T visitHt(); + + T visitHn(); + + T visitHk(); + + T visitHu(); + + T visitIs(); + + T visitIn(); + + T visitId(); + + T visitIq(); + + T visitIe(); + + T visitIm(); + + T visitIl(); + + T visitIt(); + + T visitJm(); + + T visitSj(); + + T visitJp(); + + T visitJe(); + + T visitJo(); + + T visitKz(); + + T visitKe(); + + T visitKi(); + + T visitXk(); + + T visitKw(); + + T visitKg(); + + T visitLa(); + + T visitLv(); + + T visitLb(); + + T visitLs(); + + T visitLr(); + + T visitLy(); + + T visitLi(); + + T visitLt(); + + T visitLu(); + + T visitMo(); + + T visitMk(); + + T visitMg(); + + T visitMw(); + + T visitMy(); + + T visitMv(); + + T visitMl(); + + T visitMt(); + + T visitMh(); + + T visitMq(); + + T visitMr(); + + T visitMu(); + + T visitYt(); + + T visitMx(); + + T visitFm(); + + T visitMd(); + + T visitMc(); + + T visitMn(); + + T visitMe(); + + T visitMs(); + + T visitMa(); + + T visitMz(); + + T visitMm(); + + T visitNa(); + + T visitNr(); + + T visitNp(); + + T visitNl(); + + T visitAn(); + + T visitNc(); + + T visitNz(); + + T visitNi(); + + T visitNe(); + + T visitNg(); + + T visitNu(); + + T visitMp(); + + T visitNo(); + + T visitOm(); + + T visitPk(); + + T visitPw(); + + T visitPs(); + + T visitPa(); + + T visitPg(); + + T visitPy(); + + T visitPe(); + + T visitPh(); + + T visitPn(); + + T visitPl(); + + T visitPt(); + + T visitPr(); + + T visitQa(); + + T visitRe(); + + T visitRo(); + + T visitRu(); + + T visitRw(); + + T visitBl(); + + T visitSh(); + + T visitKn(); + + T visitLc(); + + T visitMf(); + + T visitPm(); + + T visitVc(); + + T visitWs(); + + T visitSm(); + + T visitSt(); + + T visitSa(); + + T visitSn(); + + T visitRs(); + + T visitSc(); + + T visitSl(); + + T visitSg(); + + T visitSx(); + + T visitSk(); + + T visitSi(); + + T visitSb(); + + T visitSo(); + + T visitZa(); + + T visitKr(); + + T visitSs(); + + T visitEs(); + + T visitLk(); + + T visitSd(); + + T visitSr(); + + T visitSz(); + + T visitSe(); + + T visitCh(); + + T visitTw(); + + T visitTj(); + + T visitTz(); + + T visitTh(); + + T visitTl(); + + T visitTg(); + + T visitTk(); + + T visitTo(); + + T visitTt(); + + T visitTn(); + + T visitTr(); + + T visitTm(); + + T visitTc(); + + T visitTv(); + + T visitVi(); + + T visitUg(); + + T visitUa(); + + T visitAe(); + + T visitUm(); + + T visitUy(); + + T visitUz(); + + T visitVu(); + + T visitVa(); + + T visitVe(); + + T visitVn(); + + T visitWf(); + + T visitEh(); + + T visitYe(); + + T visitZm(); + + T visitZw(); + + T visitSy(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Course.java b/src/main/java/com/whop/api/types/Course.java new file mode 100644 index 00000000..14bf172c --- /dev/null +++ b/src/main/java/com/whop/api/types/Course.java @@ -0,0 +1,1296 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Course.Builder.class) +public final class Course { + private final Optional certificateAfterCompletionEnabled; + + private final List chapters; + + private final int chaptersCount; + + private final int completedLessonsCount; + + private final Optional coverImage; + + private final OffsetDateTime createdAt; + + private final Optional description; + + private final String id; + + private final Languages language; + + private final Optional latestLessonCreatedAt; + + private final List lessonUnlockDays; + + private final String order; + + private final boolean requireCompletingLessonsInOrder; + + private final Optional resumeLesson; + + private final Optional startedAt; + + private final Optional tagline; + + private final Optional thumbnail; + + private final Optional title; + + private final int totalDurationSeconds; + + private final int totalLessonsCount; + + private final OffsetDateTime updatedAt; + + private final CourseVisibilities visibility; + + private final Map additionalProperties; + + private Course( + Optional certificateAfterCompletionEnabled, + List chapters, + int chaptersCount, + int completedLessonsCount, + Optional coverImage, + OffsetDateTime createdAt, + Optional description, + String id, + Languages language, + Optional latestLessonCreatedAt, + List lessonUnlockDays, + String order, + boolean requireCompletingLessonsInOrder, + Optional resumeLesson, + Optional startedAt, + Optional tagline, + Optional thumbnail, + Optional title, + int totalDurationSeconds, + int totalLessonsCount, + OffsetDateTime updatedAt, + CourseVisibilities visibility, + Map additionalProperties) { + this.certificateAfterCompletionEnabled = certificateAfterCompletionEnabled; + this.chapters = chapters; + this.chaptersCount = chaptersCount; + this.completedLessonsCount = completedLessonsCount; + this.coverImage = coverImage; + this.createdAt = createdAt; + this.description = description; + this.id = id; + this.language = language; + this.latestLessonCreatedAt = latestLessonCreatedAt; + this.lessonUnlockDays = lessonUnlockDays; + this.order = order; + this.requireCompletingLessonsInOrder = requireCompletingLessonsInOrder; + this.resumeLesson = resumeLesson; + this.startedAt = startedAt; + this.tagline = tagline; + this.thumbnail = thumbnail; + this.title = title; + this.totalDurationSeconds = totalDurationSeconds; + this.totalLessonsCount = totalLessonsCount; + this.updatedAt = updatedAt; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether students receive a PDF certificate after completing all lessons in this course. Null if the setting has not been configured. + */ + @JsonIgnore + public Optional getCertificateAfterCompletionEnabled() { + if (certificateAfterCompletionEnabled == null) { + return Optional.empty(); + } + return certificateAfterCompletionEnabled; + } + + /** + * @return An ordered list of all chapters in this course, sorted by their display position. + */ + @JsonProperty("chapters") + public List getChapters() { + return chapters; + } + + /** + * @return The total number of chapters in this course, including chapters whose lessons are all hidden from the current user. + */ + @JsonProperty("chapters_count") + public int getChaptersCount() { + return chaptersCount; + } + + /** + * @return The number of lessons in this course that the current user has marked as completed. Zero when the request is not made on behalf of a user. + */ + @JsonProperty("completed_lessons_count") + public int getCompletedLessonsCount() { + return completedLessonsCount; + } + + /** + * @return The URL of the course cover image shown on preview cards. Null if no cover image has been uploaded. + */ + @JsonIgnore + public Optional getCoverImage() { + if (coverImage == null) { + return Optional.empty(); + } + return coverImage; + } + + /** + * @return The datetime the course was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return A brief summary of the course content and objectives. Null if no description has been set. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The unique identifier for the course. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The spoken language of the video content, used to generate accurate closed captions. One of: en, es, it, pt, de, fr, pl, ru, nl, ca, tr, sv, uk, no, fi, sk, el, cs, hr, da, ro, bg. + */ + @JsonProperty("language") + public Languages getLanguage() { + return language; + } + + /** + * @return The creation timestamp of the most recently added lesson visible to the current user. Null if the course has no lessons. + */ + @JsonIgnore + public Optional getLatestLessonCreatedAt() { + if (latestLessonCreatedAt == null) { + return Optional.empty(); + } + return latestLessonCreatedAt; + } + + /** + * @return The distinct drip schedules, in days after the course start, of lessons visible to the current user. Combine with startedAt to work out which have unlocked. Empty when the user has not started the course or no lesson is on a schedule. + */ + @JsonProperty("lesson_unlock_days") + public List getLessonUnlockDays() { + return lessonUnlockDays; + } + + /** + * @return The sort position of this course within its parent experience, as a decimal for flexible ordering. + */ + @JsonProperty("order") + public String getOrder() { + return order; + } + + /** + * @return Whether students must complete each lesson sequentially before advancing to the next one. + */ + @JsonProperty("require_completing_lessons_in_order") + public boolean getRequireCompletingLessonsInOrder() { + return requireCompletingLessonsInOrder; + } + + /** + * @return The lesson the current user should continue from: their first incomplete lesson, or the first lesson when they have finished the course, have not started it, or can edit it. Null if the course has no lessons. + */ + @JsonIgnore + public Optional getResumeLesson() { + if (resumeLesson == null) { + return Optional.empty(); + } + return resumeLesson; + } + + /** + * @return The earliest time the current user is known to have started this course. Null if they have not started it. Drip unlock schedules are measured from this point. + */ + @JsonIgnore + public Optional getStartedAt() { + if (startedAt == null) { + return Optional.empty(); + } + return startedAt; + } + + /** + * @return A short marketing tagline displayed beneath the course title. Null if no tagline has been set. + */ + @JsonIgnore + public Optional getTagline() { + if (tagline == null) { + return Optional.empty(); + } + return tagline; + } + + /** + * @return The thumbnail image displayed on course cards and previews. Null if no thumbnail has been uploaded. + */ + @JsonIgnore + public Optional getThumbnail() { + if (thumbnail == null) { + return Optional.empty(); + } + return thumbnail; + } + + /** + * @return The display name of the course shown to students. Null if no title has been set. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The combined duration in seconds of every hosted video across the lessons visible to the current user. + */ + @JsonProperty("total_duration_seconds") + public int getTotalDurationSeconds() { + return totalDurationSeconds; + } + + /** + * @return The number of lessons in this course visible to the current user. + */ + @JsonProperty("total_lessons_count") + public int getTotalLessonsCount() { + return totalLessonsCount; + } + + /** + * @return The datetime the course was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The visibility setting that controls whether this course appears to students. One of: visible, hidden. + */ + @JsonProperty("visibility") + public CourseVisibilities getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("certificate_after_completion_enabled") + private Optional _getCertificateAfterCompletionEnabled() { + return certificateAfterCompletionEnabled; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cover_image") + private Optional _getCoverImage() { + return coverImage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("latest_lesson_created_at") + private Optional _getLatestLessonCreatedAt() { + return latestLessonCreatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resume_lesson") + private Optional _getResumeLesson() { + return resumeLesson; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("started_at") + private Optional _getStartedAt() { + return startedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tagline") + private Optional _getTagline() { + return tagline; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail") + private Optional _getThumbnail() { + return thumbnail; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Course && equalTo((Course) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Course other) { + return certificateAfterCompletionEnabled.equals(other.certificateAfterCompletionEnabled) + && chapters.equals(other.chapters) + && chaptersCount == other.chaptersCount + && completedLessonsCount == other.completedLessonsCount + && coverImage.equals(other.coverImage) + && createdAt.equals(other.createdAt) + && description.equals(other.description) + && id.equals(other.id) + && language.equals(other.language) + && latestLessonCreatedAt.equals(other.latestLessonCreatedAt) + && lessonUnlockDays.equals(other.lessonUnlockDays) + && order.equals(other.order) + && requireCompletingLessonsInOrder == other.requireCompletingLessonsInOrder + && resumeLesson.equals(other.resumeLesson) + && startedAt.equals(other.startedAt) + && tagline.equals(other.tagline) + && thumbnail.equals(other.thumbnail) + && title.equals(other.title) + && totalDurationSeconds == other.totalDurationSeconds + && totalLessonsCount == other.totalLessonsCount + && updatedAt.equals(other.updatedAt) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.certificateAfterCompletionEnabled, + this.chapters, + this.chaptersCount, + this.completedLessonsCount, + this.coverImage, + this.createdAt, + this.description, + this.id, + this.language, + this.latestLessonCreatedAt, + this.lessonUnlockDays, + this.order, + this.requireCompletingLessonsInOrder, + this.resumeLesson, + this.startedAt, + this.tagline, + this.thumbnail, + this.title, + this.totalDurationSeconds, + this.totalLessonsCount, + this.updatedAt, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChaptersCountStage builder() { + return new Builder(); + } + + public interface ChaptersCountStage { + /** + *

The total number of chapters in this course, including chapters whose lessons are all hidden from the current user.

+ */ + CompletedLessonsCountStage chaptersCount(int chaptersCount); + + Builder from(Course other); + } + + public interface CompletedLessonsCountStage { + /** + *

The number of lessons in this course that the current user has marked as completed. Zero when the request is not made on behalf of a user.

+ */ + CreatedAtStage completedLessonsCount(int completedLessonsCount); + } + + public interface CreatedAtStage { + /** + *

The datetime the course was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the course.

+ */ + LanguageStage id(@NotNull String id); + } + + public interface LanguageStage { + /** + *

The spoken language of the video content, used to generate accurate closed captions. One of: en, es, it, pt, de, fr, pl, ru, nl, ca, tr, sv, uk, no, fi, sk, el, cs, hr, da, ro, bg.

+ */ + OrderStage language(@NotNull Languages language); + } + + public interface OrderStage { + /** + *

The sort position of this course within its parent experience, as a decimal for flexible ordering.

+ */ + RequireCompletingLessonsInOrderStage order(@NotNull String order); + } + + public interface RequireCompletingLessonsInOrderStage { + /** + *

Whether students must complete each lesson sequentially before advancing to the next one.

+ */ + TotalDurationSecondsStage requireCompletingLessonsInOrder(boolean requireCompletingLessonsInOrder); + } + + public interface TotalDurationSecondsStage { + /** + *

The combined duration in seconds of every hosted video across the lessons visible to the current user.

+ */ + TotalLessonsCountStage totalDurationSeconds(int totalDurationSeconds); + } + + public interface TotalLessonsCountStage { + /** + *

The number of lessons in this course visible to the current user.

+ */ + UpdatedAtStage totalLessonsCount(int totalLessonsCount); + } + + public interface UpdatedAtStage { + /** + *

The datetime the course was last updated.

+ */ + VisibilityStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface VisibilityStage { + /** + *

The visibility setting that controls whether this course appears to students. One of: visible, hidden.

+ */ + _FinalStage visibility(@NotNull CourseVisibilities visibility); + } + + public interface _FinalStage { + Course build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Whether students receive a PDF certificate after completing all lessons in this course. Null if the setting has not been configured.

+ */ + _FinalStage certificateAfterCompletionEnabled(Optional certificateAfterCompletionEnabled); + + _FinalStage certificateAfterCompletionEnabled(Boolean certificateAfterCompletionEnabled); + + _FinalStage certificateAfterCompletionEnabled(Nullable certificateAfterCompletionEnabled); + + /** + *

An ordered list of all chapters in this course, sorted by their display position.

+ */ + _FinalStage chapters(List chapters); + + _FinalStage addChapters(CourseChaptersItem chapters); + + _FinalStage addAllChapters(List chapters); + + /** + *

The URL of the course cover image shown on preview cards. Null if no cover image has been uploaded.

+ */ + _FinalStage coverImage(Optional coverImage); + + _FinalStage coverImage(String coverImage); + + _FinalStage coverImage(Nullable coverImage); + + /** + *

A brief summary of the course content and objectives. Null if no description has been set.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

The creation timestamp of the most recently added lesson visible to the current user. Null if the course has no lessons.

+ */ + _FinalStage latestLessonCreatedAt(Optional latestLessonCreatedAt); + + _FinalStage latestLessonCreatedAt(OffsetDateTime latestLessonCreatedAt); + + _FinalStage latestLessonCreatedAt(Nullable latestLessonCreatedAt); + + /** + *

The distinct drip schedules, in days after the course start, of lessons visible to the current user. Combine with startedAt to work out which have unlocked. Empty when the user has not started the course or no lesson is on a schedule.

+ */ + _FinalStage lessonUnlockDays(List lessonUnlockDays); + + _FinalStage addLessonUnlockDays(Integer lessonUnlockDays); + + _FinalStage addAllLessonUnlockDays(List lessonUnlockDays); + + /** + *

The lesson the current user should continue from: their first incomplete lesson, or the first lesson when they have finished the course, have not started it, or can edit it. Null if the course has no lessons.

+ */ + _FinalStage resumeLesson(Optional resumeLesson); + + _FinalStage resumeLesson(CourseResumeLesson resumeLesson); + + _FinalStage resumeLesson(Nullable resumeLesson); + + /** + *

The earliest time the current user is known to have started this course. Null if they have not started it. Drip unlock schedules are measured from this point.

+ */ + _FinalStage startedAt(Optional startedAt); + + _FinalStage startedAt(OffsetDateTime startedAt); + + _FinalStage startedAt(Nullable startedAt); + + /** + *

A short marketing tagline displayed beneath the course title. Null if no tagline has been set.

+ */ + _FinalStage tagline(Optional tagline); + + _FinalStage tagline(String tagline); + + _FinalStage tagline(Nullable tagline); + + /** + *

The thumbnail image displayed on course cards and previews. Null if no thumbnail has been uploaded.

+ */ + _FinalStage thumbnail(Optional thumbnail); + + _FinalStage thumbnail(CourseThumbnail thumbnail); + + _FinalStage thumbnail(Nullable thumbnail); + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ChaptersCountStage, + CompletedLessonsCountStage, + CreatedAtStage, + IdStage, + LanguageStage, + OrderStage, + RequireCompletingLessonsInOrderStage, + TotalDurationSecondsStage, + TotalLessonsCountStage, + UpdatedAtStage, + VisibilityStage, + _FinalStage { + private int chaptersCount; + + private int completedLessonsCount; + + private OffsetDateTime createdAt; + + private String id; + + private Languages language; + + private String order; + + private boolean requireCompletingLessonsInOrder; + + private int totalDurationSeconds; + + private int totalLessonsCount; + + private OffsetDateTime updatedAt; + + private CourseVisibilities visibility; + + private Optional title = Optional.empty(); + + private Optional thumbnail = Optional.empty(); + + private Optional tagline = Optional.empty(); + + private Optional startedAt = Optional.empty(); + + private Optional resumeLesson = Optional.empty(); + + private List lessonUnlockDays = new ArrayList<>(); + + private Optional latestLessonCreatedAt = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional coverImage = Optional.empty(); + + private List chapters = new ArrayList<>(); + + private Optional certificateAfterCompletionEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Course other) { + certificateAfterCompletionEnabled(other.getCertificateAfterCompletionEnabled()); + chapters(other.getChapters()); + chaptersCount(other.getChaptersCount()); + completedLessonsCount(other.getCompletedLessonsCount()); + coverImage(other.getCoverImage()); + createdAt(other.getCreatedAt()); + description(other.getDescription()); + id(other.getId()); + language(other.getLanguage()); + latestLessonCreatedAt(other.getLatestLessonCreatedAt()); + lessonUnlockDays(other.getLessonUnlockDays()); + order(other.getOrder()); + requireCompletingLessonsInOrder(other.getRequireCompletingLessonsInOrder()); + resumeLesson(other.getResumeLesson()); + startedAt(other.getStartedAt()); + tagline(other.getTagline()); + thumbnail(other.getThumbnail()); + title(other.getTitle()); + totalDurationSeconds(other.getTotalDurationSeconds()); + totalLessonsCount(other.getTotalLessonsCount()); + updatedAt(other.getUpdatedAt()); + visibility(other.getVisibility()); + return this; + } + + /** + *

The total number of chapters in this course, including chapters whose lessons are all hidden from the current user.

+ *

The total number of chapters in this course, including chapters whose lessons are all hidden from the current user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("chapters_count") + public CompletedLessonsCountStage chaptersCount(int chaptersCount) { + this.chaptersCount = chaptersCount; + return this; + } + + /** + *

The number of lessons in this course that the current user has marked as completed. Zero when the request is not made on behalf of a user.

+ *

The number of lessons in this course that the current user has marked as completed. Zero when the request is not made on behalf of a user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completed_lessons_count") + public CreatedAtStage completedLessonsCount(int completedLessonsCount) { + this.completedLessonsCount = completedLessonsCount; + return this; + } + + /** + *

The datetime the course was created.

+ *

The datetime the course was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the course.

+ *

The unique identifier for the course.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LanguageStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The spoken language of the video content, used to generate accurate closed captions. One of: en, es, it, pt, de, fr, pl, ru, nl, ca, tr, sv, uk, no, fi, sk, el, cs, hr, da, ro, bg.

+ *

The spoken language of the video content, used to generate accurate closed captions. One of: en, es, it, pt, de, fr, pl, ru, nl, ca, tr, sv, uk, no, fi, sk, el, cs, hr, da, ro, bg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("language") + public OrderStage language(@NotNull Languages language) { + this.language = Objects.requireNonNull(language, "language must not be null"); + return this; + } + + /** + *

The sort position of this course within its parent experience, as a decimal for flexible ordering.

+ *

The sort position of this course within its parent experience, as a decimal for flexible ordering.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("order") + public RequireCompletingLessonsInOrderStage order(@NotNull String order) { + this.order = Objects.requireNonNull(order, "order must not be null"); + return this; + } + + /** + *

Whether students must complete each lesson sequentially before advancing to the next one.

+ *

Whether students must complete each lesson sequentially before advancing to the next one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("require_completing_lessons_in_order") + public TotalDurationSecondsStage requireCompletingLessonsInOrder(boolean requireCompletingLessonsInOrder) { + this.requireCompletingLessonsInOrder = requireCompletingLessonsInOrder; + return this; + } + + /** + *

The combined duration in seconds of every hosted video across the lessons visible to the current user.

+ *

The combined duration in seconds of every hosted video across the lessons visible to the current user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_duration_seconds") + public TotalLessonsCountStage totalDurationSeconds(int totalDurationSeconds) { + this.totalDurationSeconds = totalDurationSeconds; + return this; + } + + /** + *

The number of lessons in this course visible to the current user.

+ *

The number of lessons in this course visible to the current user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_lessons_count") + public UpdatedAtStage totalLessonsCount(int totalLessonsCount) { + this.totalLessonsCount = totalLessonsCount; + return this; + } + + /** + *

The datetime the course was last updated.

+ *

The datetime the course was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public VisibilityStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The visibility setting that controls whether this course appears to students. One of: visible, hidden.

+ *

The visibility setting that controls whether this course appears to students. One of: visible, hidden.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("visibility") + public _FinalStage visibility(@NotNull CourseVisibilities visibility) { + this.visibility = Objects.requireNonNull(visibility, "visibility must not be null"); + return this; + } + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

The thumbnail image displayed on course cards and previews. Null if no thumbnail has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnail(Nullable thumbnail) { + if (thumbnail.isNull()) { + this.thumbnail = null; + } else if (thumbnail.isEmpty()) { + this.thumbnail = Optional.empty(); + } else { + this.thumbnail = Optional.of(thumbnail.get()); + } + return this; + } + + /** + *

The thumbnail image displayed on course cards and previews. Null if no thumbnail has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnail(CourseThumbnail thumbnail) { + this.thumbnail = Optional.ofNullable(thumbnail); + return this; + } + + /** + *

The thumbnail image displayed on course cards and previews. Null if no thumbnail has been uploaded.

+ */ + @java.lang.Override + @JsonSetter(value = "thumbnail", nulls = Nulls.SKIP) + public _FinalStage thumbnail(Optional thumbnail) { + this.thumbnail = thumbnail; + return this; + } + + /** + *

A short marketing tagline displayed beneath the course title. Null if no tagline has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tagline(Nullable tagline) { + if (tagline.isNull()) { + this.tagline = null; + } else if (tagline.isEmpty()) { + this.tagline = Optional.empty(); + } else { + this.tagline = Optional.of(tagline.get()); + } + return this; + } + + /** + *

A short marketing tagline displayed beneath the course title. Null if no tagline has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tagline(String tagline) { + this.tagline = Optional.ofNullable(tagline); + return this; + } + + /** + *

A short marketing tagline displayed beneath the course title. Null if no tagline has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "tagline", nulls = Nulls.SKIP) + public _FinalStage tagline(Optional tagline) { + this.tagline = tagline; + return this; + } + + /** + *

The earliest time the current user is known to have started this course. Null if they have not started it. Drip unlock schedules are measured from this point.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startedAt(Nullable startedAt) { + if (startedAt.isNull()) { + this.startedAt = null; + } else if (startedAt.isEmpty()) { + this.startedAt = Optional.empty(); + } else { + this.startedAt = Optional.of(startedAt.get()); + } + return this; + } + + /** + *

The earliest time the current user is known to have started this course. Null if they have not started it. Drip unlock schedules are measured from this point.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startedAt(OffsetDateTime startedAt) { + this.startedAt = Optional.ofNullable(startedAt); + return this; + } + + /** + *

The earliest time the current user is known to have started this course. Null if they have not started it. Drip unlock schedules are measured from this point.

+ */ + @java.lang.Override + @JsonSetter(value = "started_at", nulls = Nulls.SKIP) + public _FinalStage startedAt(Optional startedAt) { + this.startedAt = startedAt; + return this; + } + + /** + *

The lesson the current user should continue from: their first incomplete lesson, or the first lesson when they have finished the course, have not started it, or can edit it. Null if the course has no lessons.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resumeLesson(Nullable resumeLesson) { + if (resumeLesson.isNull()) { + this.resumeLesson = null; + } else if (resumeLesson.isEmpty()) { + this.resumeLesson = Optional.empty(); + } else { + this.resumeLesson = Optional.of(resumeLesson.get()); + } + return this; + } + + /** + *

The lesson the current user should continue from: their first incomplete lesson, or the first lesson when they have finished the course, have not started it, or can edit it. Null if the course has no lessons.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resumeLesson(CourseResumeLesson resumeLesson) { + this.resumeLesson = Optional.ofNullable(resumeLesson); + return this; + } + + /** + *

The lesson the current user should continue from: their first incomplete lesson, or the first lesson when they have finished the course, have not started it, or can edit it. Null if the course has no lessons.

+ */ + @java.lang.Override + @JsonSetter(value = "resume_lesson", nulls = Nulls.SKIP) + public _FinalStage resumeLesson(Optional resumeLesson) { + this.resumeLesson = resumeLesson; + return this; + } + + /** + *

The distinct drip schedules, in days after the course start, of lessons visible to the current user. Combine with startedAt to work out which have unlocked. Empty when the user has not started the course or no lesson is on a schedule.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllLessonUnlockDays(List lessonUnlockDays) { + if (lessonUnlockDays != null) { + this.lessonUnlockDays.addAll(lessonUnlockDays); + } + return this; + } + + /** + *

The distinct drip schedules, in days after the course start, of lessons visible to the current user. Combine with startedAt to work out which have unlocked. Empty when the user has not started the course or no lesson is on a schedule.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addLessonUnlockDays(Integer lessonUnlockDays) { + this.lessonUnlockDays.add(lessonUnlockDays); + return this; + } + + /** + *

The distinct drip schedules, in days after the course start, of lessons visible to the current user. Combine with startedAt to work out which have unlocked. Empty when the user has not started the course or no lesson is on a schedule.

+ */ + @java.lang.Override + @JsonSetter(value = "lesson_unlock_days", nulls = Nulls.SKIP) + public _FinalStage lessonUnlockDays(List lessonUnlockDays) { + this.lessonUnlockDays.clear(); + if (lessonUnlockDays != null) { + this.lessonUnlockDays.addAll(lessonUnlockDays); + } + return this; + } + + /** + *

The creation timestamp of the most recently added lesson visible to the current user. Null if the course has no lessons.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage latestLessonCreatedAt(Nullable latestLessonCreatedAt) { + if (latestLessonCreatedAt.isNull()) { + this.latestLessonCreatedAt = null; + } else if (latestLessonCreatedAt.isEmpty()) { + this.latestLessonCreatedAt = Optional.empty(); + } else { + this.latestLessonCreatedAt = Optional.of(latestLessonCreatedAt.get()); + } + return this; + } + + /** + *

The creation timestamp of the most recently added lesson visible to the current user. Null if the course has no lessons.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage latestLessonCreatedAt(OffsetDateTime latestLessonCreatedAt) { + this.latestLessonCreatedAt = Optional.ofNullable(latestLessonCreatedAt); + return this; + } + + /** + *

The creation timestamp of the most recently added lesson visible to the current user. Null if the course has no lessons.

+ */ + @java.lang.Override + @JsonSetter(value = "latest_lesson_created_at", nulls = Nulls.SKIP) + public _FinalStage latestLessonCreatedAt(Optional latestLessonCreatedAt) { + this.latestLessonCreatedAt = latestLessonCreatedAt; + return this; + } + + /** + *

A brief summary of the course content and objectives. Null if no description has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

A brief summary of the course content and objectives. Null if no description has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

A brief summary of the course content and objectives. Null if no description has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

The URL of the course cover image shown on preview cards. Null if no cover image has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage coverImage(Nullable coverImage) { + if (coverImage.isNull()) { + this.coverImage = null; + } else if (coverImage.isEmpty()) { + this.coverImage = Optional.empty(); + } else { + this.coverImage = Optional.of(coverImage.get()); + } + return this; + } + + /** + *

The URL of the course cover image shown on preview cards. Null if no cover image has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage coverImage(String coverImage) { + this.coverImage = Optional.ofNullable(coverImage); + return this; + } + + /** + *

The URL of the course cover image shown on preview cards. Null if no cover image has been uploaded.

+ */ + @java.lang.Override + @JsonSetter(value = "cover_image", nulls = Nulls.SKIP) + public _FinalStage coverImage(Optional coverImage) { + this.coverImage = coverImage; + return this; + } + + /** + *

An ordered list of all chapters in this course, sorted by their display position.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllChapters(List chapters) { + if (chapters != null) { + this.chapters.addAll(chapters); + } + return this; + } + + /** + *

An ordered list of all chapters in this course, sorted by their display position.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addChapters(CourseChaptersItem chapters) { + this.chapters.add(chapters); + return this; + } + + /** + *

An ordered list of all chapters in this course, sorted by their display position.

+ */ + @java.lang.Override + @JsonSetter(value = "chapters", nulls = Nulls.SKIP) + public _FinalStage chapters(List chapters) { + this.chapters.clear(); + if (chapters != null) { + this.chapters.addAll(chapters); + } + return this; + } + + /** + *

Whether students receive a PDF certificate after completing all lessons in this course. Null if the setting has not been configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage certificateAfterCompletionEnabled(Nullable certificateAfterCompletionEnabled) { + if (certificateAfterCompletionEnabled.isNull()) { + this.certificateAfterCompletionEnabled = null; + } else if (certificateAfterCompletionEnabled.isEmpty()) { + this.certificateAfterCompletionEnabled = Optional.empty(); + } else { + this.certificateAfterCompletionEnabled = Optional.of(certificateAfterCompletionEnabled.get()); + } + return this; + } + + /** + *

Whether students receive a PDF certificate after completing all lessons in this course. Null if the setting has not been configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage certificateAfterCompletionEnabled(Boolean certificateAfterCompletionEnabled) { + this.certificateAfterCompletionEnabled = Optional.ofNullable(certificateAfterCompletionEnabled); + return this; + } + + /** + *

Whether students receive a PDF certificate after completing all lessons in this course. Null if the setting has not been configured.

+ */ + @java.lang.Override + @JsonSetter(value = "certificate_after_completion_enabled", nulls = Nulls.SKIP) + public _FinalStage certificateAfterCompletionEnabled(Optional certificateAfterCompletionEnabled) { + this.certificateAfterCompletionEnabled = certificateAfterCompletionEnabled; + return this; + } + + @java.lang.Override + public Course build() { + return new Course( + certificateAfterCompletionEnabled, + chapters, + chaptersCount, + completedLessonsCount, + coverImage, + createdAt, + description, + id, + language, + latestLessonCreatedAt, + lessonUnlockDays, + order, + requireCompletingLessonsInOrder, + resumeLesson, + startedAt, + tagline, + thumbnail, + title, + totalDurationSeconds, + totalLessonsCount, + updatedAt, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseChapter.java b/src/main/java/com/whop/api/types/CourseChapter.java new file mode 100644 index 00000000..d1f40f2e --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseChapter.java @@ -0,0 +1,264 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseChapter.Builder.class) +public final class CourseChapter { + private final String id; + + private final List lessons; + + private final int order; + + private final String title; + + private final Map additionalProperties; + + private CourseChapter( + String id, + List lessons, + int order, + String title, + Map additionalProperties) { + this.id = id; + this.lessons = lessons; + this.order = order; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the chapter. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return An ordered list of lessons in this chapter, sorted by display position. Hidden lessons are excluded for non-admin users. + */ + @JsonProperty("lessons") + public List getLessons() { + return lessons; + } + + /** + * @return The sort position of this chapter within its parent course, starting from zero. + */ + @JsonProperty("order") + public int getOrder() { + return order; + } + + /** + * @return The display name of the chapter shown to students. Maximum 150 characters. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseChapter && equalTo((CourseChapter) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseChapter other) { + return id.equals(other.id) + && lessons.equals(other.lessons) + && order == other.order + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.lessons, this.order, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the chapter.

+ */ + OrderStage id(@NotNull String id); + + Builder from(CourseChapter other); + } + + public interface OrderStage { + /** + *

The sort position of this chapter within its parent course, starting from zero.

+ */ + TitleStage order(int order); + } + + public interface TitleStage { + /** + *

The display name of the chapter shown to students. Maximum 150 characters.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + CourseChapter build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

An ordered list of lessons in this chapter, sorted by display position. Hidden lessons are excluded for non-admin users.

+ */ + _FinalStage lessons(List lessons); + + _FinalStage addLessons(CourseChapterLessonsItem lessons); + + _FinalStage addAllLessons(List lessons); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrderStage, TitleStage, _FinalStage { + private String id; + + private int order; + + private String title; + + private List lessons = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseChapter other) { + id(other.getId()); + lessons(other.getLessons()); + order(other.getOrder()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the chapter.

+ *

The unique identifier for the chapter.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrderStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The sort position of this chapter within its parent course, starting from zero.

+ *

The sort position of this chapter within its parent course, starting from zero.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("order") + public TitleStage order(int order) { + this.order = order; + return this; + } + + /** + *

The display name of the chapter shown to students. Maximum 150 characters.

+ *

The display name of the chapter shown to students. Maximum 150 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

An ordered list of lessons in this chapter, sorted by display position. Hidden lessons are excluded for non-admin users.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllLessons(List lessons) { + if (lessons != null) { + this.lessons.addAll(lessons); + } + return this; + } + + /** + *

An ordered list of lessons in this chapter, sorted by display position. Hidden lessons are excluded for non-admin users.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addLessons(CourseChapterLessonsItem lessons) { + this.lessons.add(lessons); + return this; + } + + /** + *

An ordered list of lessons in this chapter, sorted by display position. Hidden lessons are excluded for non-admin users.

+ */ + @java.lang.Override + @JsonSetter(value = "lessons", nulls = Nulls.SKIP) + public _FinalStage lessons(List lessons) { + this.lessons.clear(); + if (lessons != null) { + this.lessons.addAll(lessons); + } + return this; + } + + @java.lang.Override + public CourseChapter build() { + return new CourseChapter(id, lessons, order, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseChapterLessonsItem.java b/src/main/java/com/whop/api/types/CourseChapterLessonsItem.java new file mode 100644 index 00000000..65f902e1 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseChapterLessonsItem.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseChapterLessonsItem.Builder.class) +public final class CourseChapterLessonsItem { + private final String id; + + private final int order; + + private final String title; + + private final Map additionalProperties; + + private CourseChapterLessonsItem(String id, int order, String title, Map additionalProperties) { + this.id = id; + this.order = order; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the lesson. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The sort position of this lesson within its parent chapter, starting from zero. + */ + @JsonProperty("order") + public int getOrder() { + return order; + } + + /** + * @return The display name of the lesson shown to students. Maximum 120 characters. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseChapterLessonsItem && equalTo((CourseChapterLessonsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseChapterLessonsItem other) { + return id.equals(other.id) && order == other.order && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.order, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the lesson.

+ */ + OrderStage id(@NotNull String id); + + Builder from(CourseChapterLessonsItem other); + } + + public interface OrderStage { + /** + *

The sort position of this lesson within its parent chapter, starting from zero.

+ */ + TitleStage order(int order); + } + + public interface TitleStage { + /** + *

The display name of the lesson shown to students. Maximum 120 characters.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + CourseChapterLessonsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrderStage, TitleStage, _FinalStage { + private String id; + + private int order; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseChapterLessonsItem other) { + id(other.getId()); + order(other.getOrder()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the lesson.

+ *

The unique identifier for the lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrderStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The sort position of this lesson within its parent chapter, starting from zero.

+ *

The sort position of this lesson within its parent chapter, starting from zero.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("order") + public TitleStage order(int order) { + this.order = order; + return this; + } + + /** + *

The display name of the lesson shown to students. Maximum 120 characters.

+ *

The display name of the lesson shown to students. Maximum 120 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public CourseChapterLessonsItem build() { + return new CourseChapterLessonsItem(id, order, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseChapterListItem.java b/src/main/java/com/whop/api/types/CourseChapterListItem.java new file mode 100644 index 00000000..20c5815c --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseChapterListItem.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseChapterListItem.Builder.class) +public final class CourseChapterListItem { + private final String id; + + private final int order; + + private final String title; + + private final Map additionalProperties; + + private CourseChapterListItem(String id, int order, String title, Map additionalProperties) { + this.id = id; + this.order = order; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the chapter. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The sort position of this chapter within its parent course, starting from zero. + */ + @JsonProperty("order") + public int getOrder() { + return order; + } + + /** + * @return The display name of the chapter shown to students. Maximum 150 characters. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseChapterListItem && equalTo((CourseChapterListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseChapterListItem other) { + return id.equals(other.id) && order == other.order && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.order, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the chapter.

+ */ + OrderStage id(@NotNull String id); + + Builder from(CourseChapterListItem other); + } + + public interface OrderStage { + /** + *

The sort position of this chapter within its parent course, starting from zero.

+ */ + TitleStage order(int order); + } + + public interface TitleStage { + /** + *

The display name of the chapter shown to students. Maximum 150 characters.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + CourseChapterListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrderStage, TitleStage, _FinalStage { + private String id; + + private int order; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseChapterListItem other) { + id(other.getId()); + order(other.getOrder()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the chapter.

+ *

The unique identifier for the chapter.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrderStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The sort position of this chapter within its parent course, starting from zero.

+ *

The sort position of this chapter within its parent course, starting from zero.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("order") + public TitleStage order(int order) { + this.order = order; + return this; + } + + /** + *

The display name of the chapter shown to students. Maximum 150 characters.

+ *

The display name of the chapter shown to students. Maximum 150 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public CourseChapterListItem build() { + return new CourseChapterListItem(id, order, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseChaptersItem.java b/src/main/java/com/whop/api/types/CourseChaptersItem.java new file mode 100644 index 00000000..6a7cabfe --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseChaptersItem.java @@ -0,0 +1,264 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseChaptersItem.Builder.class) +public final class CourseChaptersItem { + private final String id; + + private final List lessons; + + private final int order; + + private final String title; + + private final Map additionalProperties; + + private CourseChaptersItem( + String id, + List lessons, + int order, + String title, + Map additionalProperties) { + this.id = id; + this.lessons = lessons; + this.order = order; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the chapter. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return An ordered list of lessons in this chapter, sorted by display position. Hidden lessons are excluded for non-admin users. + */ + @JsonProperty("lessons") + public List getLessons() { + return lessons; + } + + /** + * @return The sort position of this chapter within its parent course, starting from zero. + */ + @JsonProperty("order") + public int getOrder() { + return order; + } + + /** + * @return The display name of the chapter shown to students. Maximum 150 characters. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseChaptersItem && equalTo((CourseChaptersItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseChaptersItem other) { + return id.equals(other.id) + && lessons.equals(other.lessons) + && order == other.order + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.lessons, this.order, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the chapter.

+ */ + OrderStage id(@NotNull String id); + + Builder from(CourseChaptersItem other); + } + + public interface OrderStage { + /** + *

The sort position of this chapter within its parent course, starting from zero.

+ */ + TitleStage order(int order); + } + + public interface TitleStage { + /** + *

The display name of the chapter shown to students. Maximum 150 characters.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + CourseChaptersItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

An ordered list of lessons in this chapter, sorted by display position. Hidden lessons are excluded for non-admin users.

+ */ + _FinalStage lessons(List lessons); + + _FinalStage addLessons(CourseChaptersItemLessonsItem lessons); + + _FinalStage addAllLessons(List lessons); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrderStage, TitleStage, _FinalStage { + private String id; + + private int order; + + private String title; + + private List lessons = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseChaptersItem other) { + id(other.getId()); + lessons(other.getLessons()); + order(other.getOrder()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the chapter.

+ *

The unique identifier for the chapter.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrderStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The sort position of this chapter within its parent course, starting from zero.

+ *

The sort position of this chapter within its parent course, starting from zero.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("order") + public TitleStage order(int order) { + this.order = order; + return this; + } + + /** + *

The display name of the chapter shown to students. Maximum 150 characters.

+ *

The display name of the chapter shown to students. Maximum 150 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

An ordered list of lessons in this chapter, sorted by display position. Hidden lessons are excluded for non-admin users.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllLessons(List lessons) { + if (lessons != null) { + this.lessons.addAll(lessons); + } + return this; + } + + /** + *

An ordered list of lessons in this chapter, sorted by display position. Hidden lessons are excluded for non-admin users.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addLessons(CourseChaptersItemLessonsItem lessons) { + this.lessons.add(lessons); + return this; + } + + /** + *

An ordered list of lessons in this chapter, sorted by display position. Hidden lessons are excluded for non-admin users.

+ */ + @java.lang.Override + @JsonSetter(value = "lessons", nulls = Nulls.SKIP) + public _FinalStage lessons(List lessons) { + this.lessons.clear(); + if (lessons != null) { + this.lessons.addAll(lessons); + } + return this; + } + + @java.lang.Override + public CourseChaptersItem build() { + return new CourseChaptersItem(id, lessons, order, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseChaptersItemLessonsItem.java b/src/main/java/com/whop/api/types/CourseChaptersItemLessonsItem.java new file mode 100644 index 00000000..59e0f6b7 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseChaptersItemLessonsItem.java @@ -0,0 +1,382 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseChaptersItemLessonsItem.Builder.class) +public final class CourseChaptersItemLessonsItem { + private final String id; + + private final LessonTypes lessonType; + + private final int order; + + private final Optional thumbnail; + + private final String title; + + private final Optional videoAsset; + + private final Map additionalProperties; + + private CourseChaptersItemLessonsItem( + String id, + LessonTypes lessonType, + int order, + Optional thumbnail, + String title, + Optional videoAsset, + Map additionalProperties) { + this.id = id; + this.lessonType = lessonType; + this.order = order; + this.thumbnail = thumbnail; + this.title = title; + this.videoAsset = videoAsset; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the lesson. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The content format of this lesson. One of: text, video, pdf, multi, quiz, knowledge_check. + */ + @JsonProperty("lesson_type") + public LessonTypes getLessonType() { + return lessonType; + } + + /** + * @return The sort position of this lesson within its parent chapter, starting from zero. + */ + @JsonProperty("order") + public int getOrder() { + return order; + } + + /** + * @return The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded. + */ + @JsonIgnore + public Optional getThumbnail() { + if (thumbnail == null) { + return Optional.empty(); + } + return thumbnail; + } + + /** + * @return The display name of the lesson shown to students. Maximum 120 characters. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return The Mux video asset for video-type lessons, used for streaming playback. Null if this lesson has no hosted video. + */ + @JsonIgnore + public Optional getVideoAsset() { + if (videoAsset == null) { + return Optional.empty(); + } + return videoAsset; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail") + private Optional _getThumbnail() { + return thumbnail; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("video_asset") + private Optional _getVideoAsset() { + return videoAsset; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseChaptersItemLessonsItem && equalTo((CourseChaptersItemLessonsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseChaptersItemLessonsItem other) { + return id.equals(other.id) + && lessonType.equals(other.lessonType) + && order == other.order + && thumbnail.equals(other.thumbnail) + && title.equals(other.title) + && videoAsset.equals(other.videoAsset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.lessonType, this.order, this.thumbnail, this.title, this.videoAsset); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the lesson.

+ */ + LessonTypeStage id(@NotNull String id); + + Builder from(CourseChaptersItemLessonsItem other); + } + + public interface LessonTypeStage { + /** + *

The content format of this lesson. One of: text, video, pdf, multi, quiz, knowledge_check.

+ */ + OrderStage lessonType(@NotNull LessonTypes lessonType); + } + + public interface OrderStage { + /** + *

The sort position of this lesson within its parent chapter, starting from zero.

+ */ + TitleStage order(int order); + } + + public interface TitleStage { + /** + *

The display name of the lesson shown to students. Maximum 120 characters.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + CourseChaptersItemLessonsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded.

+ */ + _FinalStage thumbnail(Optional thumbnail); + + _FinalStage thumbnail(CourseChaptersItemLessonsItemThumbnail thumbnail); + + _FinalStage thumbnail(Nullable thumbnail); + + /** + *

The Mux video asset for video-type lessons, used for streaming playback. Null if this lesson has no hosted video.

+ */ + _FinalStage videoAsset(Optional videoAsset); + + _FinalStage videoAsset(CourseChaptersItemLessonsItemVideoAsset videoAsset); + + _FinalStage videoAsset(Nullable videoAsset); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, LessonTypeStage, OrderStage, TitleStage, _FinalStage { + private String id; + + private LessonTypes lessonType; + + private int order; + + private String title; + + private Optional videoAsset = Optional.empty(); + + private Optional thumbnail = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseChaptersItemLessonsItem other) { + id(other.getId()); + lessonType(other.getLessonType()); + order(other.getOrder()); + thumbnail(other.getThumbnail()); + title(other.getTitle()); + videoAsset(other.getVideoAsset()); + return this; + } + + /** + *

The unique identifier for the lesson.

+ *

The unique identifier for the lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LessonTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The content format of this lesson. One of: text, video, pdf, multi, quiz, knowledge_check.

+ *

The content format of this lesson. One of: text, video, pdf, multi, quiz, knowledge_check.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("lesson_type") + public OrderStage lessonType(@NotNull LessonTypes lessonType) { + this.lessonType = Objects.requireNonNull(lessonType, "lessonType must not be null"); + return this; + } + + /** + *

The sort position of this lesson within its parent chapter, starting from zero.

+ *

The sort position of this lesson within its parent chapter, starting from zero.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("order") + public TitleStage order(int order) { + this.order = order; + return this; + } + + /** + *

The display name of the lesson shown to students. Maximum 120 characters.

+ *

The display name of the lesson shown to students. Maximum 120 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

The Mux video asset for video-type lessons, used for streaming playback. Null if this lesson has no hosted video.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage videoAsset(Nullable videoAsset) { + if (videoAsset.isNull()) { + this.videoAsset = null; + } else if (videoAsset.isEmpty()) { + this.videoAsset = Optional.empty(); + } else { + this.videoAsset = Optional.of(videoAsset.get()); + } + return this; + } + + /** + *

The Mux video asset for video-type lessons, used for streaming playback. Null if this lesson has no hosted video.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage videoAsset(CourseChaptersItemLessonsItemVideoAsset videoAsset) { + this.videoAsset = Optional.ofNullable(videoAsset); + return this; + } + + /** + *

The Mux video asset for video-type lessons, used for streaming playback. Null if this lesson has no hosted video.

+ */ + @java.lang.Override + @JsonSetter(value = "video_asset", nulls = Nulls.SKIP) + public _FinalStage videoAsset(Optional videoAsset) { + this.videoAsset = videoAsset; + return this; + } + + /** + *

The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnail(Nullable thumbnail) { + if (thumbnail.isNull()) { + this.thumbnail = null; + } else if (thumbnail.isEmpty()) { + this.thumbnail = Optional.empty(); + } else { + this.thumbnail = Optional.of(thumbnail.get()); + } + return this; + } + + /** + *

The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnail(CourseChaptersItemLessonsItemThumbnail thumbnail) { + this.thumbnail = Optional.ofNullable(thumbnail); + return this; + } + + /** + *

The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded.

+ */ + @java.lang.Override + @JsonSetter(value = "thumbnail", nulls = Nulls.SKIP) + public _FinalStage thumbnail(Optional thumbnail) { + this.thumbnail = thumbnail; + return this; + } + + @java.lang.Override + public CourseChaptersItemLessonsItem build() { + return new CourseChaptersItemLessonsItem( + id, lessonType, order, thumbnail, title, videoAsset, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseChaptersItemLessonsItemThumbnail.java b/src/main/java/com/whop/api/types/CourseChaptersItemLessonsItemThumbnail.java new file mode 100644 index 00000000..b208ad7d --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseChaptersItemLessonsItemThumbnail.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseChaptersItemLessonsItemThumbnail.Builder.class) +public final class CourseChaptersItemLessonsItemThumbnail { + private final Optional url; + + private final Map additionalProperties; + + private CourseChaptersItemLessonsItemThumbnail(Optional url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseChaptersItemLessonsItemThumbnail + && equalTo((CourseChaptersItemLessonsItemThumbnail) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseChaptersItemLessonsItemThumbnail other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CourseChaptersItemLessonsItemThumbnail other) { + url(other.getUrl()); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public Builder url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + public CourseChaptersItemLessonsItemThumbnail build() { + return new CourseChaptersItemLessonsItemThumbnail(url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseChaptersItemLessonsItemVideoAsset.java b/src/main/java/com/whop/api/types/CourseChaptersItemLessonsItemVideoAsset.java new file mode 100644 index 00000000..97144da9 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseChaptersItemLessonsItemVideoAsset.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseChaptersItemLessonsItemVideoAsset.Builder.class) +public final class CourseChaptersItemLessonsItemVideoAsset { + private final Optional durationSeconds; + + private final Optional signedPlaybackId; + + private final Optional signedThumbnailPlaybackToken; + + private final Map additionalProperties; + + private CourseChaptersItemLessonsItemVideoAsset( + Optional durationSeconds, + Optional signedPlaybackId, + Optional signedThumbnailPlaybackToken, + Map additionalProperties) { + this.durationSeconds = durationSeconds; + this.signedPlaybackId = signedPlaybackId; + this.signedThumbnailPlaybackToken = signedThumbnailPlaybackToken; + this.additionalProperties = additionalProperties; + } + + /** + * @return The duration of the video in seconds + */ + @JsonIgnore + public Optional getDurationSeconds() { + if (durationSeconds == null) { + return Optional.empty(); + } + return durationSeconds; + } + + /** + * @return The signed playback ID of the Mux asset + */ + @JsonIgnore + public Optional getSignedPlaybackId() { + if (signedPlaybackId == null) { + return Optional.empty(); + } + return signedPlaybackId; + } + + /** + * @return The signed thumbnail playback token of the Mux asset + */ + @JsonIgnore + public Optional getSignedThumbnailPlaybackToken() { + if (signedThumbnailPlaybackToken == null) { + return Optional.empty(); + } + return signedThumbnailPlaybackToken; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("duration_seconds") + private Optional _getDurationSeconds() { + return durationSeconds; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("signed_playback_id") + private Optional _getSignedPlaybackId() { + return signedPlaybackId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("signed_thumbnail_playback_token") + private Optional _getSignedThumbnailPlaybackToken() { + return signedThumbnailPlaybackToken; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseChaptersItemLessonsItemVideoAsset + && equalTo((CourseChaptersItemLessonsItemVideoAsset) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseChaptersItemLessonsItemVideoAsset other) { + return durationSeconds.equals(other.durationSeconds) + && signedPlaybackId.equals(other.signedPlaybackId) + && signedThumbnailPlaybackToken.equals(other.signedThumbnailPlaybackToken); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.durationSeconds, this.signedPlaybackId, this.signedThumbnailPlaybackToken); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional durationSeconds = Optional.empty(); + + private Optional signedPlaybackId = Optional.empty(); + + private Optional signedThumbnailPlaybackToken = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CourseChaptersItemLessonsItemVideoAsset other) { + durationSeconds(other.getDurationSeconds()); + signedPlaybackId(other.getSignedPlaybackId()); + signedThumbnailPlaybackToken(other.getSignedThumbnailPlaybackToken()); + return this; + } + + /** + *

The duration of the video in seconds

+ */ + @JsonSetter(value = "duration_seconds", nulls = Nulls.SKIP) + public Builder durationSeconds(Optional durationSeconds) { + this.durationSeconds = durationSeconds; + return this; + } + + public Builder durationSeconds(Integer durationSeconds) { + this.durationSeconds = Optional.ofNullable(durationSeconds); + return this; + } + + public Builder durationSeconds(Nullable durationSeconds) { + if (durationSeconds.isNull()) { + this.durationSeconds = null; + } else if (durationSeconds.isEmpty()) { + this.durationSeconds = Optional.empty(); + } else { + this.durationSeconds = Optional.of(durationSeconds.get()); + } + return this; + } + + /** + *

The signed playback ID of the Mux asset

+ */ + @JsonSetter(value = "signed_playback_id", nulls = Nulls.SKIP) + public Builder signedPlaybackId(Optional signedPlaybackId) { + this.signedPlaybackId = signedPlaybackId; + return this; + } + + public Builder signedPlaybackId(String signedPlaybackId) { + this.signedPlaybackId = Optional.ofNullable(signedPlaybackId); + return this; + } + + public Builder signedPlaybackId(Nullable signedPlaybackId) { + if (signedPlaybackId.isNull()) { + this.signedPlaybackId = null; + } else if (signedPlaybackId.isEmpty()) { + this.signedPlaybackId = Optional.empty(); + } else { + this.signedPlaybackId = Optional.of(signedPlaybackId.get()); + } + return this; + } + + /** + *

The signed thumbnail playback token of the Mux asset

+ */ + @JsonSetter(value = "signed_thumbnail_playback_token", nulls = Nulls.SKIP) + public Builder signedThumbnailPlaybackToken(Optional signedThumbnailPlaybackToken) { + this.signedThumbnailPlaybackToken = signedThumbnailPlaybackToken; + return this; + } + + public Builder signedThumbnailPlaybackToken(String signedThumbnailPlaybackToken) { + this.signedThumbnailPlaybackToken = Optional.ofNullable(signedThumbnailPlaybackToken); + return this; + } + + public Builder signedThumbnailPlaybackToken(Nullable signedThumbnailPlaybackToken) { + if (signedThumbnailPlaybackToken.isNull()) { + this.signedThumbnailPlaybackToken = null; + } else if (signedThumbnailPlaybackToken.isEmpty()) { + this.signedThumbnailPlaybackToken = Optional.empty(); + } else { + this.signedThumbnailPlaybackToken = Optional.of(signedThumbnailPlaybackToken.get()); + } + return this; + } + + public CourseChaptersItemLessonsItemVideoAsset build() { + return new CourseChaptersItemLessonsItemVideoAsset( + durationSeconds, signedPlaybackId, signedThumbnailPlaybackToken, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLesson.java b/src/main/java/com/whop/api/types/CourseLesson.java new file mode 100644 index 00000000..5c74348a --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLesson.java @@ -0,0 +1,956 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLesson.Builder.class) +public final class CourseLesson { + private final List assessmentQuestions; + + private final List attachments; + + private final Optional content; + + private final OffsetDateTime createdAt; + + private final Optional daysFromCourseStartUntilUnlock; + + private final Optional embedId; + + private final Optional embedType; + + private final String id; + + private final LessonTypes lessonType; + + private final Optional mainPdf; + + private final int order; + + private final Optional thumbnail; + + private final String title; + + private final Optional videoAsset; + + private final LessonVisibilities visibility; + + private final Map additionalProperties; + + private CourseLesson( + List assessmentQuestions, + List attachments, + Optional content, + OffsetDateTime createdAt, + Optional daysFromCourseStartUntilUnlock, + Optional embedId, + Optional embedType, + String id, + LessonTypes lessonType, + Optional mainPdf, + int order, + Optional thumbnail, + String title, + Optional videoAsset, + LessonVisibilities visibility, + Map additionalProperties) { + this.assessmentQuestions = assessmentQuestions; + this.attachments = attachments; + this.content = content; + this.createdAt = createdAt; + this.daysFromCourseStartUntilUnlock = daysFromCourseStartUntilUnlock; + this.embedId = embedId; + this.embedType = embedType; + this.id = id; + this.lessonType = lessonType; + this.mainPdf = mainPdf; + this.order = order; + this.thumbnail = thumbnail; + this.title = title; + this.videoAsset = videoAsset; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return The list of questions for quiz or knowledge check lessons. Empty for non-assessment lesson types. + */ + @JsonProperty("assessment_questions") + public List getAssessmentQuestions() { + return assessmentQuestions; + } + + /** + * @return All supplementary files attached to this lesson returned as a flat array rather than a paginated connection. + */ + @JsonProperty("attachments") + public List getAttachments() { + return attachments; + } + + /** + * @return The Markdown content body of the lesson. Null if the lesson has no text content. + */ + @JsonIgnore + public Optional getContent() { + if (content == null) { + return Optional.empty(); + } + return content; + } + + /** + * @return The datetime the lesson was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The number of days after a student starts the course before this lesson becomes accessible. Null if the lesson is available immediately. + */ + @JsonIgnore + public Optional getDaysFromCourseStartUntilUnlock() { + if (daysFromCourseStartUntilUnlock == null) { + return Optional.empty(); + } + return daysFromCourseStartUntilUnlock; + } + + /** + * @return The external video identifier for embedded video lessons, such as a YouTube video ID or Loom share ID. Null if the lesson has no embed. + */ + @JsonIgnore + public Optional getEmbedId() { + if (embedId == null) { + return Optional.empty(); + } + return embedId; + } + + /** + * @return The platform type for the embedded video. One of: youtube, loom. Null if the lesson has no embed. + */ + @JsonIgnore + public Optional getEmbedType() { + if (embedType == null) { + return Optional.empty(); + } + return embedType; + } + + /** + * @return The unique identifier for the lesson. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The content format of this lesson. One of: text, video, pdf, multi, quiz, knowledge_check. + */ + @JsonProperty("lesson_type") + public LessonTypes getLessonType() { + return lessonType; + } + + /** + * @return The primary PDF document for PDF-type lessons. Null if this lesson is not a PDF lesson or no PDF has been uploaded. + */ + @JsonIgnore + public Optional getMainPdf() { + if (mainPdf == null) { + return Optional.empty(); + } + return mainPdf; + } + + /** + * @return The sort position of this lesson within its parent chapter, starting from zero. + */ + @JsonProperty("order") + public int getOrder() { + return order; + } + + /** + * @return The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded. + */ + @JsonIgnore + public Optional getThumbnail() { + if (thumbnail == null) { + return Optional.empty(); + } + return thumbnail; + } + + /** + * @return The display name of the lesson shown to students. Maximum 120 characters. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return The Mux video asset for video-type lessons, used for streaming playback. Null if this lesson has no hosted video. + */ + @JsonIgnore + public Optional getVideoAsset() { + if (videoAsset == null) { + return Optional.empty(); + } + return videoAsset; + } + + /** + * @return The visibility setting that controls whether this lesson appears to students. One of: visible, hidden. + */ + @JsonProperty("visibility") + public LessonVisibilities getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content") + private Optional _getContent() { + return content; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("days_from_course_start_until_unlock") + private Optional _getDaysFromCourseStartUntilUnlock() { + return daysFromCourseStartUntilUnlock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("embed_id") + private Optional _getEmbedId() { + return embedId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("embed_type") + private Optional _getEmbedType() { + return embedType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("main_pdf") + private Optional _getMainPdf() { + return mainPdf; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail") + private Optional _getThumbnail() { + return thumbnail; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("video_asset") + private Optional _getVideoAsset() { + return videoAsset; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLesson && equalTo((CourseLesson) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLesson other) { + return assessmentQuestions.equals(other.assessmentQuestions) + && attachments.equals(other.attachments) + && content.equals(other.content) + && createdAt.equals(other.createdAt) + && daysFromCourseStartUntilUnlock.equals(other.daysFromCourseStartUntilUnlock) + && embedId.equals(other.embedId) + && embedType.equals(other.embedType) + && id.equals(other.id) + && lessonType.equals(other.lessonType) + && mainPdf.equals(other.mainPdf) + && order == other.order + && thumbnail.equals(other.thumbnail) + && title.equals(other.title) + && videoAsset.equals(other.videoAsset) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.assessmentQuestions, + this.attachments, + this.content, + this.createdAt, + this.daysFromCourseStartUntilUnlock, + this.embedId, + this.embedType, + this.id, + this.lessonType, + this.mainPdf, + this.order, + this.thumbnail, + this.title, + this.videoAsset, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the lesson was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(CourseLesson other); + } + + public interface IdStage { + /** + *

The unique identifier for the lesson.

+ */ + LessonTypeStage id(@NotNull String id); + } + + public interface LessonTypeStage { + /** + *

The content format of this lesson. One of: text, video, pdf, multi, quiz, knowledge_check.

+ */ + OrderStage lessonType(@NotNull LessonTypes lessonType); + } + + public interface OrderStage { + /** + *

The sort position of this lesson within its parent chapter, starting from zero.

+ */ + TitleStage order(int order); + } + + public interface TitleStage { + /** + *

The display name of the lesson shown to students. Maximum 120 characters.

+ */ + VisibilityStage title(@NotNull String title); + } + + public interface VisibilityStage { + /** + *

The visibility setting that controls whether this lesson appears to students. One of: visible, hidden.

+ */ + _FinalStage visibility(@NotNull LessonVisibilities visibility); + } + + public interface _FinalStage { + CourseLesson build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The list of questions for quiz or knowledge check lessons. Empty for non-assessment lesson types.

+ */ + _FinalStage assessmentQuestions(List assessmentQuestions); + + _FinalStage addAssessmentQuestions(CourseLessonAssessmentQuestionsItem assessmentQuestions); + + _FinalStage addAllAssessmentQuestions(List assessmentQuestions); + + /** + *

All supplementary files attached to this lesson returned as a flat array rather than a paginated connection.

+ */ + _FinalStage attachments(List attachments); + + _FinalStage addAttachments(CourseLessonAttachmentsItem attachments); + + _FinalStage addAllAttachments(List attachments); + + /** + *

The Markdown content body of the lesson. Null if the lesson has no text content.

+ */ + _FinalStage content(Optional content); + + _FinalStage content(String content); + + _FinalStage content(Nullable content); + + /** + *

The number of days after a student starts the course before this lesson becomes accessible. Null if the lesson is available immediately.

+ */ + _FinalStage daysFromCourseStartUntilUnlock(Optional daysFromCourseStartUntilUnlock); + + _FinalStage daysFromCourseStartUntilUnlock(Integer daysFromCourseStartUntilUnlock); + + _FinalStage daysFromCourseStartUntilUnlock(Nullable daysFromCourseStartUntilUnlock); + + /** + *

The external video identifier for embedded video lessons, such as a YouTube video ID or Loom share ID. Null if the lesson has no embed.

+ */ + _FinalStage embedId(Optional embedId); + + _FinalStage embedId(String embedId); + + _FinalStage embedId(Nullable embedId); + + /** + *

The platform type for the embedded video. One of: youtube, loom. Null if the lesson has no embed.

+ */ + _FinalStage embedType(Optional embedType); + + _FinalStage embedType(EmbedTypes embedType); + + _FinalStage embedType(Nullable embedType); + + /** + *

The primary PDF document for PDF-type lessons. Null if this lesson is not a PDF lesson or no PDF has been uploaded.

+ */ + _FinalStage mainPdf(Optional mainPdf); + + _FinalStage mainPdf(CourseLessonMainPdf mainPdf); + + _FinalStage mainPdf(Nullable mainPdf); + + /** + *

The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded.

+ */ + _FinalStage thumbnail(Optional thumbnail); + + _FinalStage thumbnail(CourseLessonThumbnail thumbnail); + + _FinalStage thumbnail(Nullable thumbnail); + + /** + *

The Mux video asset for video-type lessons, used for streaming playback. Null if this lesson has no hosted video.

+ */ + _FinalStage videoAsset(Optional videoAsset); + + _FinalStage videoAsset(CourseLessonVideoAsset videoAsset); + + _FinalStage videoAsset(Nullable videoAsset); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IdStage, LessonTypeStage, OrderStage, TitleStage, VisibilityStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private LessonTypes lessonType; + + private int order; + + private String title; + + private LessonVisibilities visibility; + + private Optional videoAsset = Optional.empty(); + + private Optional thumbnail = Optional.empty(); + + private Optional mainPdf = Optional.empty(); + + private Optional embedType = Optional.empty(); + + private Optional embedId = Optional.empty(); + + private Optional daysFromCourseStartUntilUnlock = Optional.empty(); + + private Optional content = Optional.empty(); + + private List attachments = new ArrayList<>(); + + private List assessmentQuestions = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLesson other) { + assessmentQuestions(other.getAssessmentQuestions()); + attachments(other.getAttachments()); + content(other.getContent()); + createdAt(other.getCreatedAt()); + daysFromCourseStartUntilUnlock(other.getDaysFromCourseStartUntilUnlock()); + embedId(other.getEmbedId()); + embedType(other.getEmbedType()); + id(other.getId()); + lessonType(other.getLessonType()); + mainPdf(other.getMainPdf()); + order(other.getOrder()); + thumbnail(other.getThumbnail()); + title(other.getTitle()); + videoAsset(other.getVideoAsset()); + visibility(other.getVisibility()); + return this; + } + + /** + *

The datetime the lesson was created.

+ *

The datetime the lesson was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the lesson.

+ *

The unique identifier for the lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LessonTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The content format of this lesson. One of: text, video, pdf, multi, quiz, knowledge_check.

+ *

The content format of this lesson. One of: text, video, pdf, multi, quiz, knowledge_check.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("lesson_type") + public OrderStage lessonType(@NotNull LessonTypes lessonType) { + this.lessonType = Objects.requireNonNull(lessonType, "lessonType must not be null"); + return this; + } + + /** + *

The sort position of this lesson within its parent chapter, starting from zero.

+ *

The sort position of this lesson within its parent chapter, starting from zero.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("order") + public TitleStage order(int order) { + this.order = order; + return this; + } + + /** + *

The display name of the lesson shown to students. Maximum 120 characters.

+ *

The display name of the lesson shown to students. Maximum 120 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public VisibilityStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

The visibility setting that controls whether this lesson appears to students. One of: visible, hidden.

+ *

The visibility setting that controls whether this lesson appears to students. One of: visible, hidden.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("visibility") + public _FinalStage visibility(@NotNull LessonVisibilities visibility) { + this.visibility = Objects.requireNonNull(visibility, "visibility must not be null"); + return this; + } + + /** + *

The Mux video asset for video-type lessons, used for streaming playback. Null if this lesson has no hosted video.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage videoAsset(Nullable videoAsset) { + if (videoAsset.isNull()) { + this.videoAsset = null; + } else if (videoAsset.isEmpty()) { + this.videoAsset = Optional.empty(); + } else { + this.videoAsset = Optional.of(videoAsset.get()); + } + return this; + } + + /** + *

The Mux video asset for video-type lessons, used for streaming playback. Null if this lesson has no hosted video.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage videoAsset(CourseLessonVideoAsset videoAsset) { + this.videoAsset = Optional.ofNullable(videoAsset); + return this; + } + + /** + *

The Mux video asset for video-type lessons, used for streaming playback. Null if this lesson has no hosted video.

+ */ + @java.lang.Override + @JsonSetter(value = "video_asset", nulls = Nulls.SKIP) + public _FinalStage videoAsset(Optional videoAsset) { + this.videoAsset = videoAsset; + return this; + } + + /** + *

The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnail(Nullable thumbnail) { + if (thumbnail.isNull()) { + this.thumbnail = null; + } else if (thumbnail.isEmpty()) { + this.thumbnail = Optional.empty(); + } else { + this.thumbnail = Optional.of(thumbnail.get()); + } + return this; + } + + /** + *

The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnail(CourseLessonThumbnail thumbnail) { + this.thumbnail = Optional.ofNullable(thumbnail); + return this; + } + + /** + *

The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded.

+ */ + @java.lang.Override + @JsonSetter(value = "thumbnail", nulls = Nulls.SKIP) + public _FinalStage thumbnail(Optional thumbnail) { + this.thumbnail = thumbnail; + return this; + } + + /** + *

The primary PDF document for PDF-type lessons. Null if this lesson is not a PDF lesson or no PDF has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mainPdf(Nullable mainPdf) { + if (mainPdf.isNull()) { + this.mainPdf = null; + } else if (mainPdf.isEmpty()) { + this.mainPdf = Optional.empty(); + } else { + this.mainPdf = Optional.of(mainPdf.get()); + } + return this; + } + + /** + *

The primary PDF document for PDF-type lessons. Null if this lesson is not a PDF lesson or no PDF has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mainPdf(CourseLessonMainPdf mainPdf) { + this.mainPdf = Optional.ofNullable(mainPdf); + return this; + } + + /** + *

The primary PDF document for PDF-type lessons. Null if this lesson is not a PDF lesson or no PDF has been uploaded.

+ */ + @java.lang.Override + @JsonSetter(value = "main_pdf", nulls = Nulls.SKIP) + public _FinalStage mainPdf(Optional mainPdf) { + this.mainPdf = mainPdf; + return this; + } + + /** + *

The platform type for the embedded video. One of: youtube, loom. Null if the lesson has no embed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage embedType(Nullable embedType) { + if (embedType.isNull()) { + this.embedType = null; + } else if (embedType.isEmpty()) { + this.embedType = Optional.empty(); + } else { + this.embedType = Optional.of(embedType.get()); + } + return this; + } + + /** + *

The platform type for the embedded video. One of: youtube, loom. Null if the lesson has no embed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage embedType(EmbedTypes embedType) { + this.embedType = Optional.ofNullable(embedType); + return this; + } + + /** + *

The platform type for the embedded video. One of: youtube, loom. Null if the lesson has no embed.

+ */ + @java.lang.Override + @JsonSetter(value = "embed_type", nulls = Nulls.SKIP) + public _FinalStage embedType(Optional embedType) { + this.embedType = embedType; + return this; + } + + /** + *

The external video identifier for embedded video lessons, such as a YouTube video ID or Loom share ID. Null if the lesson has no embed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage embedId(Nullable embedId) { + if (embedId.isNull()) { + this.embedId = null; + } else if (embedId.isEmpty()) { + this.embedId = Optional.empty(); + } else { + this.embedId = Optional.of(embedId.get()); + } + return this; + } + + /** + *

The external video identifier for embedded video lessons, such as a YouTube video ID or Loom share ID. Null if the lesson has no embed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage embedId(String embedId) { + this.embedId = Optional.ofNullable(embedId); + return this; + } + + /** + *

The external video identifier for embedded video lessons, such as a YouTube video ID or Loom share ID. Null if the lesson has no embed.

+ */ + @java.lang.Override + @JsonSetter(value = "embed_id", nulls = Nulls.SKIP) + public _FinalStage embedId(Optional embedId) { + this.embedId = embedId; + return this; + } + + /** + *

The number of days after a student starts the course before this lesson becomes accessible. Null if the lesson is available immediately.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage daysFromCourseStartUntilUnlock(Nullable daysFromCourseStartUntilUnlock) { + if (daysFromCourseStartUntilUnlock.isNull()) { + this.daysFromCourseStartUntilUnlock = null; + } else if (daysFromCourseStartUntilUnlock.isEmpty()) { + this.daysFromCourseStartUntilUnlock = Optional.empty(); + } else { + this.daysFromCourseStartUntilUnlock = Optional.of(daysFromCourseStartUntilUnlock.get()); + } + return this; + } + + /** + *

The number of days after a student starts the course before this lesson becomes accessible. Null if the lesson is available immediately.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage daysFromCourseStartUntilUnlock(Integer daysFromCourseStartUntilUnlock) { + this.daysFromCourseStartUntilUnlock = Optional.ofNullable(daysFromCourseStartUntilUnlock); + return this; + } + + /** + *

The number of days after a student starts the course before this lesson becomes accessible. Null if the lesson is available immediately.

+ */ + @java.lang.Override + @JsonSetter(value = "days_from_course_start_until_unlock", nulls = Nulls.SKIP) + public _FinalStage daysFromCourseStartUntilUnlock(Optional daysFromCourseStartUntilUnlock) { + this.daysFromCourseStartUntilUnlock = daysFromCourseStartUntilUnlock; + return this; + } + + /** + *

The Markdown content body of the lesson. Null if the lesson has no text content.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(Nullable content) { + if (content.isNull()) { + this.content = null; + } else if (content.isEmpty()) { + this.content = Optional.empty(); + } else { + this.content = Optional.of(content.get()); + } + return this; + } + + /** + *

The Markdown content body of the lesson. Null if the lesson has no text content.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

The Markdown content body of the lesson. Null if the lesson has no text content.

+ */ + @java.lang.Override + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public _FinalStage content(Optional content) { + this.content = content; + return this; + } + + /** + *

All supplementary files attached to this lesson returned as a flat array rather than a paginated connection.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllAttachments(List attachments) { + if (attachments != null) { + this.attachments.addAll(attachments); + } + return this; + } + + /** + *

All supplementary files attached to this lesson returned as a flat array rather than a paginated connection.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAttachments(CourseLessonAttachmentsItem attachments) { + this.attachments.add(attachments); + return this; + } + + /** + *

All supplementary files attached to this lesson returned as a flat array rather than a paginated connection.

+ */ + @java.lang.Override + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public _FinalStage attachments(List attachments) { + this.attachments.clear(); + if (attachments != null) { + this.attachments.addAll(attachments); + } + return this; + } + + /** + *

The list of questions for quiz or knowledge check lessons. Empty for non-assessment lesson types.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllAssessmentQuestions(List assessmentQuestions) { + if (assessmentQuestions != null) { + this.assessmentQuestions.addAll(assessmentQuestions); + } + return this; + } + + /** + *

The list of questions for quiz or knowledge check lessons. Empty for non-assessment lesson types.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAssessmentQuestions(CourseLessonAssessmentQuestionsItem assessmentQuestions) { + this.assessmentQuestions.add(assessmentQuestions); + return this; + } + + /** + *

The list of questions for quiz or knowledge check lessons. Empty for non-assessment lesson types.

+ */ + @java.lang.Override + @JsonSetter(value = "assessment_questions", nulls = Nulls.SKIP) + public _FinalStage assessmentQuestions(List assessmentQuestions) { + this.assessmentQuestions.clear(); + if (assessmentQuestions != null) { + this.assessmentQuestions.addAll(assessmentQuestions); + } + return this; + } + + @java.lang.Override + public CourseLesson build() { + return new CourseLesson( + assessmentQuestions, + attachments, + content, + createdAt, + daysFromCourseStartUntilUnlock, + embedId, + embedType, + id, + lessonType, + mainPdf, + order, + thumbnail, + title, + videoAsset, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonAssessmentQuestionsItem.java b/src/main/java/com/whop/api/types/CourseLessonAssessmentQuestionsItem.java new file mode 100644 index 00000000..c7e4430f --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonAssessmentQuestionsItem.java @@ -0,0 +1,498 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonAssessmentQuestionsItem.Builder.class) +public final class CourseLessonAssessmentQuestionsItem { + private final Optional correctAnswer; + + private final OffsetDateTime createdAt; + + private final String id; + + private final Optional image; + + private final List options; + + private final int order; + + private final String questionText; + + private final CoursesAssessmentQuestionTypes questionType; + + private final Map additionalProperties; + + private CourseLessonAssessmentQuestionsItem( + Optional correctAnswer, + OffsetDateTime createdAt, + String id, + Optional image, + List options, + int order, + String questionText, + CoursesAssessmentQuestionTypes questionType, + Map additionalProperties) { + this.correctAnswer = correctAnswer; + this.createdAt = createdAt; + this.id = id; + this.image = image; + this.options = options; + this.order = order; + this.questionText = questionText; + this.questionType = questionType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The correct answer for the question. Used for short answer questions. Only visible to admins (users with courses:update permission) + */ + @JsonIgnore + public Optional getCorrectAnswer() { + if (correctAnswer == null) { + return Optional.empty(); + } + return correctAnswer; + } + + /** + * @return The datetime the assessment question was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the assessment question. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Optional image attachment for the question + */ + @JsonIgnore + public Optional getImage() { + if (image == null) { + return Optional.empty(); + } + return image; + } + + /** + * @return The answer options for multiple choice/select questions + */ + @JsonProperty("options") + public List getOptions() { + return options; + } + + /** + * @return The order of the question within its lesson + */ + @JsonProperty("order") + public int getOrder() { + return order; + } + + /** + * @return The text of the question + */ + @JsonProperty("question_text") + public String getQuestionText() { + return questionText; + } + + /** + * @return The type of the question + */ + @JsonProperty("question_type") + public CoursesAssessmentQuestionTypes getQuestionType() { + return questionType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("correct_answer") + private Optional _getCorrectAnswer() { + return correctAnswer; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("image") + private Optional _getImage() { + return image; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonAssessmentQuestionsItem + && equalTo((CourseLessonAssessmentQuestionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonAssessmentQuestionsItem other) { + return correctAnswer.equals(other.correctAnswer) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && image.equals(other.image) + && options.equals(other.options) + && order == other.order + && questionText.equals(other.questionText) + && questionType.equals(other.questionType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.correctAnswer, + this.createdAt, + this.id, + this.image, + this.options, + this.order, + this.questionText, + this.questionType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the assessment question was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(CourseLessonAssessmentQuestionsItem other); + } + + public interface IdStage { + /** + *

The unique identifier for the assessment question.

+ */ + OrderStage id(@NotNull String id); + } + + public interface OrderStage { + /** + *

The order of the question within its lesson

+ */ + QuestionTextStage order(int order); + } + + public interface QuestionTextStage { + /** + *

The text of the question

+ */ + QuestionTypeStage questionText(@NotNull String questionText); + } + + public interface QuestionTypeStage { + /** + *

The type of the question

+ */ + _FinalStage questionType(@NotNull CoursesAssessmentQuestionTypes questionType); + } + + public interface _FinalStage { + CourseLessonAssessmentQuestionsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The correct answer for the question. Used for short answer questions. Only visible to admins (users with courses:update permission)

+ */ + _FinalStage correctAnswer(Optional correctAnswer); + + _FinalStage correctAnswer(String correctAnswer); + + _FinalStage correctAnswer(Nullable correctAnswer); + + /** + *

Optional image attachment for the question

+ */ + _FinalStage image(Optional image); + + _FinalStage image(CourseLessonAssessmentQuestionsItemImage image); + + _FinalStage image(Nullable image); + + /** + *

The answer options for multiple choice/select questions

+ */ + _FinalStage options(List options); + + _FinalStage addOptions(CourseLessonAssessmentQuestionsItemOptionsItem options); + + _FinalStage addAllOptions(List options); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IdStage, OrderStage, QuestionTextStage, QuestionTypeStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private int order; + + private String questionText; + + private CoursesAssessmentQuestionTypes questionType; + + private List options = new ArrayList<>(); + + private Optional image = Optional.empty(); + + private Optional correctAnswer = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonAssessmentQuestionsItem other) { + correctAnswer(other.getCorrectAnswer()); + createdAt(other.getCreatedAt()); + id(other.getId()); + image(other.getImage()); + options(other.getOptions()); + order(other.getOrder()); + questionText(other.getQuestionText()); + questionType(other.getQuestionType()); + return this; + } + + /** + *

The datetime the assessment question was created.

+ *

The datetime the assessment question was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the assessment question.

+ *

The unique identifier for the assessment question.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrderStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The order of the question within its lesson

+ *

The order of the question within its lesson

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("order") + public QuestionTextStage order(int order) { + this.order = order; + return this; + } + + /** + *

The text of the question

+ *

The text of the question

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("question_text") + public QuestionTypeStage questionText(@NotNull String questionText) { + this.questionText = Objects.requireNonNull(questionText, "questionText must not be null"); + return this; + } + + /** + *

The type of the question

+ *

The type of the question

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("question_type") + public _FinalStage questionType(@NotNull CoursesAssessmentQuestionTypes questionType) { + this.questionType = Objects.requireNonNull(questionType, "questionType must not be null"); + return this; + } + + /** + *

The answer options for multiple choice/select questions

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllOptions(List options) { + if (options != null) { + this.options.addAll(options); + } + return this; + } + + /** + *

The answer options for multiple choice/select questions

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addOptions(CourseLessonAssessmentQuestionsItemOptionsItem options) { + this.options.add(options); + return this; + } + + /** + *

The answer options for multiple choice/select questions

+ */ + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(List options) { + this.options.clear(); + if (options != null) { + this.options.addAll(options); + } + return this; + } + + /** + *

Optional image attachment for the question

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage image(Nullable image) { + if (image.isNull()) { + this.image = null; + } else if (image.isEmpty()) { + this.image = Optional.empty(); + } else { + this.image = Optional.of(image.get()); + } + return this; + } + + /** + *

Optional image attachment for the question

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage image(CourseLessonAssessmentQuestionsItemImage image) { + this.image = Optional.ofNullable(image); + return this; + } + + /** + *

Optional image attachment for the question

+ */ + @java.lang.Override + @JsonSetter(value = "image", nulls = Nulls.SKIP) + public _FinalStage image(Optional image) { + this.image = image; + return this; + } + + /** + *

The correct answer for the question. Used for short answer questions. Only visible to admins (users with courses:update permission)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage correctAnswer(Nullable correctAnswer) { + if (correctAnswer.isNull()) { + this.correctAnswer = null; + } else if (correctAnswer.isEmpty()) { + this.correctAnswer = Optional.empty(); + } else { + this.correctAnswer = Optional.of(correctAnswer.get()); + } + return this; + } + + /** + *

The correct answer for the question. Used for short answer questions. Only visible to admins (users with courses:update permission)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage correctAnswer(String correctAnswer) { + this.correctAnswer = Optional.ofNullable(correctAnswer); + return this; + } + + /** + *

The correct answer for the question. Used for short answer questions. Only visible to admins (users with courses:update permission)

+ */ + @java.lang.Override + @JsonSetter(value = "correct_answer", nulls = Nulls.SKIP) + public _FinalStage correctAnswer(Optional correctAnswer) { + this.correctAnswer = correctAnswer; + return this; + } + + @java.lang.Override + public CourseLessonAssessmentQuestionsItem build() { + return new CourseLessonAssessmentQuestionsItem( + correctAnswer, + createdAt, + id, + image, + options, + order, + questionText, + questionType, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonAssessmentQuestionsItemImage.java b/src/main/java/com/whop/api/types/CourseLessonAssessmentQuestionsItemImage.java new file mode 100644 index 00000000..5f128d39 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonAssessmentQuestionsItemImage.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonAssessmentQuestionsItemImage.Builder.class) +public final class CourseLessonAssessmentQuestionsItemImage { + private final Optional contentType; + + private final Optional filename; + + private final String id; + + private final Optional url; + + private final Map additionalProperties; + + private CourseLessonAssessmentQuestionsItemImage( + Optional contentType, + Optional filename, + String id, + Optional url, + Map additionalProperties) { + this.contentType = contentType; + this.filename = filename; + this.id = id; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg. + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return The original filename of the uploaded attachment, including its file extension. + */ + @JsonIgnore + public Optional getFilename() { + if (filename == null) { + return Optional.empty(); + } + return filename; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filename") + private Optional _getFilename() { + return filename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonAssessmentQuestionsItemImage + && equalTo((CourseLessonAssessmentQuestionsItemImage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonAssessmentQuestionsItemImage other) { + return contentType.equals(other.contentType) + && filename.equals(other.filename) + && id.equals(other.id) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contentType, this.filename, this.id, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CourseLessonAssessmentQuestionsItemImage other); + } + + public interface _FinalStage { + CourseLessonAssessmentQuestionsItemImage build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + _FinalStage filename(Optional filename); + + _FinalStage filename(String filename); + + _FinalStage filename(Nullable filename); + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional url = Optional.empty(); + + private Optional filename = Optional.empty(); + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonAssessmentQuestionsItemImage other) { + contentType(other.getContentType()); + filename(other.getFilename()); + id(other.getId()); + url(other.getUrl()); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(Nullable filename) { + if (filename.isNull()) { + this.filename = null; + } else if (filename.isEmpty()) { + this.filename = Optional.empty(); + } else { + this.filename = Optional.of(filename.get()); + } + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(String filename) { + this.filename = Optional.ofNullable(filename); + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + @java.lang.Override + @JsonSetter(value = "filename", nulls = Nulls.SKIP) + public _FinalStage filename(Optional filename) { + this.filename = filename; + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public CourseLessonAssessmentQuestionsItemImage build() { + return new CourseLessonAssessmentQuestionsItemImage(contentType, filename, id, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonAssessmentQuestionsItemOptionsItem.java b/src/main/java/com/whop/api/types/CourseLessonAssessmentQuestionsItemOptionsItem.java new file mode 100644 index 00000000..08ea610c --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonAssessmentQuestionsItemOptionsItem.java @@ -0,0 +1,278 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonAssessmentQuestionsItemOptionsItem.Builder.class) +public final class CourseLessonAssessmentQuestionsItemOptionsItem { + private final String id; + + private final Optional isCorrect; + + private final String optionText; + + private final int order; + + private final Map additionalProperties; + + private CourseLessonAssessmentQuestionsItemOptionsItem( + String id, + Optional isCorrect, + String optionText, + int order, + Map additionalProperties) { + this.id = id; + this.isCorrect = isCorrect; + this.optionText = optionText; + this.order = order; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the assessment question option. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whether this option is a correct answer. Only visible to admins (users with courses:update permission) + */ + @JsonIgnore + public Optional getIsCorrect() { + if (isCorrect == null) { + return Optional.empty(); + } + return isCorrect; + } + + /** + * @return The text of the answer option + */ + @JsonProperty("option_text") + public String getOptionText() { + return optionText; + } + + /** + * @return The order of this option within the question + */ + @JsonProperty("order") + public int getOrder() { + return order; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("is_correct") + private Optional _getIsCorrect() { + return isCorrect; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonAssessmentQuestionsItemOptionsItem + && equalTo((CourseLessonAssessmentQuestionsItemOptionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonAssessmentQuestionsItemOptionsItem other) { + return id.equals(other.id) + && isCorrect.equals(other.isCorrect) + && optionText.equals(other.optionText) + && order == other.order; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.isCorrect, this.optionText, this.order); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the assessment question option.

+ */ + OptionTextStage id(@NotNull String id); + + Builder from(CourseLessonAssessmentQuestionsItemOptionsItem other); + } + + public interface OptionTextStage { + /** + *

The text of the answer option

+ */ + OrderStage optionText(@NotNull String optionText); + } + + public interface OrderStage { + /** + *

The order of this option within the question

+ */ + _FinalStage order(int order); + } + + public interface _FinalStage { + CourseLessonAssessmentQuestionsItemOptionsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Whether this option is a correct answer. Only visible to admins (users with courses:update permission)

+ */ + _FinalStage isCorrect(Optional isCorrect); + + _FinalStage isCorrect(Boolean isCorrect); + + _FinalStage isCorrect(Nullable isCorrect); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OptionTextStage, OrderStage, _FinalStage { + private String id; + + private String optionText; + + private int order; + + private Optional isCorrect = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonAssessmentQuestionsItemOptionsItem other) { + id(other.getId()); + isCorrect(other.getIsCorrect()); + optionText(other.getOptionText()); + order(other.getOrder()); + return this; + } + + /** + *

The unique identifier for the assessment question option.

+ *

The unique identifier for the assessment question option.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OptionTextStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The text of the answer option

+ *

The text of the answer option

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("option_text") + public OrderStage optionText(@NotNull String optionText) { + this.optionText = Objects.requireNonNull(optionText, "optionText must not be null"); + return this; + } + + /** + *

The order of this option within the question

+ *

The order of this option within the question

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("order") + public _FinalStage order(int order) { + this.order = order; + return this; + } + + /** + *

Whether this option is a correct answer. Only visible to admins (users with courses:update permission)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage isCorrect(Nullable isCorrect) { + if (isCorrect.isNull()) { + this.isCorrect = null; + } else if (isCorrect.isEmpty()) { + this.isCorrect = Optional.empty(); + } else { + this.isCorrect = Optional.of(isCorrect.get()); + } + return this; + } + + /** + *

Whether this option is a correct answer. Only visible to admins (users with courses:update permission)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage isCorrect(Boolean isCorrect) { + this.isCorrect = Optional.ofNullable(isCorrect); + return this; + } + + /** + *

Whether this option is a correct answer. Only visible to admins (users with courses:update permission)

+ */ + @java.lang.Override + @JsonSetter(value = "is_correct", nulls = Nulls.SKIP) + public _FinalStage isCorrect(Optional isCorrect) { + this.isCorrect = isCorrect; + return this; + } + + @java.lang.Override + public CourseLessonAssessmentQuestionsItemOptionsItem build() { + return new CourseLessonAssessmentQuestionsItemOptionsItem( + id, isCorrect, optionText, order, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonAttachmentsItem.java b/src/main/java/com/whop/api/types/CourseLessonAttachmentsItem.java new file mode 100644 index 00000000..3e18996b --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonAttachmentsItem.java @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonAttachmentsItem.Builder.class) +public final class CourseLessonAttachmentsItem { + private final Optional contentType; + + private final Optional filename; + + private final String id; + + private final Optional url; + + private final Map additionalProperties; + + private CourseLessonAttachmentsItem( + Optional contentType, + Optional filename, + String id, + Optional url, + Map additionalProperties) { + this.contentType = contentType; + this.filename = filename; + this.id = id; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg. + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return The original filename of the uploaded attachment, including its file extension. + */ + @JsonIgnore + public Optional getFilename() { + if (filename == null) { + return Optional.empty(); + } + return filename; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filename") + private Optional _getFilename() { + return filename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonAttachmentsItem && equalTo((CourseLessonAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonAttachmentsItem other) { + return contentType.equals(other.contentType) + && filename.equals(other.filename) + && id.equals(other.id) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contentType, this.filename, this.id, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CourseLessonAttachmentsItem other); + } + + public interface _FinalStage { + CourseLessonAttachmentsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + _FinalStage filename(Optional filename); + + _FinalStage filename(String filename); + + _FinalStage filename(Nullable filename); + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional url = Optional.empty(); + + private Optional filename = Optional.empty(); + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonAttachmentsItem other) { + contentType(other.getContentType()); + filename(other.getFilename()); + id(other.getId()); + url(other.getUrl()); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(Nullable filename) { + if (filename.isNull()) { + this.filename = null; + } else if (filename.isEmpty()) { + this.filename = Optional.empty(); + } else { + this.filename = Optional.of(filename.get()); + } + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(String filename) { + this.filename = Optional.ofNullable(filename); + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + @java.lang.Override + @JsonSetter(value = "filename", nulls = Nulls.SKIP) + public _FinalStage filename(Optional filename) { + this.filename = filename; + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public CourseLessonAttachmentsItem build() { + return new CourseLessonAttachmentsItem(contentType, filename, id, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonInteraction.java b/src/main/java/com/whop/api/types/CourseLessonInteraction.java new file mode 100644 index 00000000..f6026150 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonInteraction.java @@ -0,0 +1,308 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonInteraction.Builder.class) +public final class CourseLessonInteraction { + private final boolean completed; + + private final CourseLessonInteractionCourse course; + + private final OffsetDateTime createdAt; + + private final String id; + + private final CourseLessonInteractionLesson lesson; + + private final CourseLessonInteractionUser user; + + private final Map additionalProperties; + + private CourseLessonInteraction( + boolean completed, + CourseLessonInteractionCourse course, + OffsetDateTime createdAt, + String id, + CourseLessonInteractionLesson lesson, + CourseLessonInteractionUser user, + Map additionalProperties) { + this.completed = completed; + this.course = course; + this.createdAt = createdAt; + this.id = id; + this.lesson = lesson; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the user has finished this lesson. + */ + @JsonProperty("completed") + public boolean getCompleted() { + return completed; + } + + /** + * @return The course that contains the tracked lesson. + */ + @JsonProperty("course") + public CourseLessonInteractionCourse getCourse() { + return course; + } + + /** + * @return The datetime the lesson interaction was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the lesson interaction. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The lesson that this progress record belongs to. + */ + @JsonProperty("lesson") + public CourseLessonInteractionLesson getLesson() { + return lesson; + } + + /** + * @return The user whose progress is being tracked. + */ + @JsonProperty("user") + public CourseLessonInteractionUser getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonInteraction && equalTo((CourseLessonInteraction) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonInteraction other) { + return completed == other.completed + && course.equals(other.course) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && lesson.equals(other.lesson) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.completed, this.course, this.createdAt, this.id, this.lesson, this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompletedStage builder() { + return new Builder(); + } + + public interface CompletedStage { + /** + *

Whether the user has finished this lesson.

+ */ + CourseStage completed(boolean completed); + + Builder from(CourseLessonInteraction other); + } + + public interface CourseStage { + /** + *

The course that contains the tracked lesson.

+ */ + CreatedAtStage course(@NotNull CourseLessonInteractionCourse course); + } + + public interface CreatedAtStage { + /** + *

The datetime the lesson interaction was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the lesson interaction.

+ */ + LessonStage id(@NotNull String id); + } + + public interface LessonStage { + /** + *

The lesson that this progress record belongs to.

+ */ + UserStage lesson(@NotNull CourseLessonInteractionLesson lesson); + } + + public interface UserStage { + /** + *

The user whose progress is being tracked.

+ */ + _FinalStage user(@NotNull CourseLessonInteractionUser user); + } + + public interface _FinalStage { + CourseLessonInteraction build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CompletedStage, CourseStage, CreatedAtStage, IdStage, LessonStage, UserStage, _FinalStage { + private boolean completed; + + private CourseLessonInteractionCourse course; + + private OffsetDateTime createdAt; + + private String id; + + private CourseLessonInteractionLesson lesson; + + private CourseLessonInteractionUser user; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonInteraction other) { + completed(other.getCompleted()); + course(other.getCourse()); + createdAt(other.getCreatedAt()); + id(other.getId()); + lesson(other.getLesson()); + user(other.getUser()); + return this; + } + + /** + *

Whether the user has finished this lesson.

+ *

Whether the user has finished this lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completed") + public CourseStage completed(boolean completed) { + this.completed = completed; + return this; + } + + /** + *

The course that contains the tracked lesson.

+ *

The course that contains the tracked lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("course") + public CreatedAtStage course(@NotNull CourseLessonInteractionCourse course) { + this.course = Objects.requireNonNull(course, "course must not be null"); + return this; + } + + /** + *

The datetime the lesson interaction was created.

+ *

The datetime the lesson interaction was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the lesson interaction.

+ *

The unique identifier for the lesson interaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LessonStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The lesson that this progress record belongs to.

+ *

The lesson that this progress record belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("lesson") + public UserStage lesson(@NotNull CourseLessonInteractionLesson lesson) { + this.lesson = Objects.requireNonNull(lesson, "lesson must not be null"); + return this; + } + + /** + *

The user whose progress is being tracked.

+ *

The user whose progress is being tracked.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull CourseLessonInteractionUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + @java.lang.Override + public CourseLessonInteraction build() { + return new CourseLessonInteraction(completed, course, createdAt, id, lesson, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonInteractionCourse.java b/src/main/java/com/whop/api/types/CourseLessonInteractionCourse.java new file mode 100644 index 00000000..d1e465a3 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonInteractionCourse.java @@ -0,0 +1,239 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonInteractionCourse.Builder.class) +public final class CourseLessonInteractionCourse { + private final CourseLessonInteractionCourseExperience experience; + + private final String id; + + private final Optional title; + + private final Map additionalProperties; + + private CourseLessonInteractionCourse( + CourseLessonInteractionCourseExperience experience, + String id, + Optional title, + Map additionalProperties) { + this.experience = experience; + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The parent experience that this course belongs to. + */ + @JsonProperty("experience") + public CourseLessonInteractionCourseExperience getExperience() { + return experience; + } + + /** + * @return The unique identifier for the course. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the course shown to students. Null if no title has been set. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonInteractionCourse && equalTo((CourseLessonInteractionCourse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonInteractionCourse other) { + return experience.equals(other.experience) && id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.experience, this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExperienceStage builder() { + return new Builder(); + } + + public interface ExperienceStage { + /** + *

The parent experience that this course belongs to.

+ */ + IdStage experience(@NotNull CourseLessonInteractionCourseExperience experience); + + Builder from(CourseLessonInteractionCourse other); + } + + public interface IdStage { + /** + *

The unique identifier for the course.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + CourseLessonInteractionCourse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExperienceStage, IdStage, _FinalStage { + private CourseLessonInteractionCourseExperience experience; + + private String id; + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonInteractionCourse other) { + experience(other.getExperience()); + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The parent experience that this course belongs to.

+ *

The parent experience that this course belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("experience") + public IdStage experience(@NotNull CourseLessonInteractionCourseExperience experience) { + this.experience = Objects.requireNonNull(experience, "experience must not be null"); + return this; + } + + /** + *

The unique identifier for the course.

+ *

The unique identifier for the course.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + @java.lang.Override + public CourseLessonInteractionCourse build() { + return new CourseLessonInteractionCourse(experience, id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonInteractionCourseExperience.java b/src/main/java/com/whop/api/types/CourseLessonInteractionCourseExperience.java new file mode 100644 index 00000000..05ab1f62 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonInteractionCourseExperience.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonInteractionCourseExperience.Builder.class) +public final class CourseLessonInteractionCourseExperience { + private final String id; + + private final Map additionalProperties; + + private CourseLessonInteractionCourseExperience(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the experience. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonInteractionCourseExperience + && equalTo((CourseLessonInteractionCourseExperience) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonInteractionCourseExperience other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the experience.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CourseLessonInteractionCourseExperience other); + } + + public interface _FinalStage { + CourseLessonInteractionCourseExperience build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonInteractionCourseExperience other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the experience.

+ *

The unique identifier for the experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CourseLessonInteractionCourseExperience build() { + return new CourseLessonInteractionCourseExperience(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonInteractionLesson.java b/src/main/java/com/whop/api/types/CourseLessonInteractionLesson.java new file mode 100644 index 00000000..f664fbb8 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonInteractionLesson.java @@ -0,0 +1,199 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonInteractionLesson.Builder.class) +public final class CourseLessonInteractionLesson { + private final CourseLessonInteractionLessonChapter chapter; + + private final String id; + + private final String title; + + private final Map additionalProperties; + + private CourseLessonInteractionLesson( + CourseLessonInteractionLessonChapter chapter, + String id, + String title, + Map additionalProperties) { + this.chapter = chapter; + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The parent chapter that contains this lesson. + */ + @JsonProperty("chapter") + public CourseLessonInteractionLessonChapter getChapter() { + return chapter; + } + + /** + * @return The unique identifier for the lesson. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the lesson shown to students. Maximum 120 characters. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonInteractionLesson && equalTo((CourseLessonInteractionLesson) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonInteractionLesson other) { + return chapter.equals(other.chapter) && id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.chapter, this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChapterStage builder() { + return new Builder(); + } + + public interface ChapterStage { + /** + *

The parent chapter that contains this lesson.

+ */ + IdStage chapter(@NotNull CourseLessonInteractionLessonChapter chapter); + + Builder from(CourseLessonInteractionLesson other); + } + + public interface IdStage { + /** + *

The unique identifier for the lesson.

+ */ + TitleStage id(@NotNull String id); + } + + public interface TitleStage { + /** + *

The display name of the lesson shown to students. Maximum 120 characters.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + CourseLessonInteractionLesson build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ChapterStage, IdStage, TitleStage, _FinalStage { + private CourseLessonInteractionLessonChapter chapter; + + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonInteractionLesson other) { + chapter(other.getChapter()); + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The parent chapter that contains this lesson.

+ *

The parent chapter that contains this lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("chapter") + public IdStage chapter(@NotNull CourseLessonInteractionLessonChapter chapter) { + this.chapter = Objects.requireNonNull(chapter, "chapter must not be null"); + return this; + } + + /** + *

The unique identifier for the lesson.

+ *

The unique identifier for the lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the lesson shown to students. Maximum 120 characters.

+ *

The display name of the lesson shown to students. Maximum 120 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public CourseLessonInteractionLesson build() { + return new CourseLessonInteractionLesson(chapter, id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonInteractionLessonChapter.java b/src/main/java/com/whop/api/types/CourseLessonInteractionLessonChapter.java new file mode 100644 index 00000000..d5081a8a --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonInteractionLessonChapter.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonInteractionLessonChapter.Builder.class) +public final class CourseLessonInteractionLessonChapter { + private final String id; + + private final Map additionalProperties; + + private CourseLessonInteractionLessonChapter(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the chapter. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonInteractionLessonChapter + && equalTo((CourseLessonInteractionLessonChapter) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonInteractionLessonChapter other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the chapter.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CourseLessonInteractionLessonChapter other); + } + + public interface _FinalStage { + CourseLessonInteractionLessonChapter build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonInteractionLessonChapter other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the chapter.

+ *

The unique identifier for the chapter.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CourseLessonInteractionLessonChapter build() { + return new CourseLessonInteractionLessonChapter(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonInteractionListItem.java b/src/main/java/com/whop/api/types/CourseLessonInteractionListItem.java new file mode 100644 index 00000000..3d14eec7 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonInteractionListItem.java @@ -0,0 +1,273 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonInteractionListItem.Builder.class) +public final class CourseLessonInteractionListItem { + private final boolean completed; + + private final OffsetDateTime createdAt; + + private final String id; + + private final CourseLessonInteractionListItemLesson lesson; + + private final CourseLessonInteractionListItemUser user; + + private final Map additionalProperties; + + private CourseLessonInteractionListItem( + boolean completed, + OffsetDateTime createdAt, + String id, + CourseLessonInteractionListItemLesson lesson, + CourseLessonInteractionListItemUser user, + Map additionalProperties) { + this.completed = completed; + this.createdAt = createdAt; + this.id = id; + this.lesson = lesson; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the user has finished this lesson. + */ + @JsonProperty("completed") + public boolean getCompleted() { + return completed; + } + + /** + * @return The datetime the lesson interaction was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the lesson interaction. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The lesson that this progress record belongs to. + */ + @JsonProperty("lesson") + public CourseLessonInteractionListItemLesson getLesson() { + return lesson; + } + + /** + * @return The user whose progress is being tracked. + */ + @JsonProperty("user") + public CourseLessonInteractionListItemUser getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonInteractionListItem && equalTo((CourseLessonInteractionListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonInteractionListItem other) { + return completed == other.completed + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && lesson.equals(other.lesson) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.completed, this.createdAt, this.id, this.lesson, this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompletedStage builder() { + return new Builder(); + } + + public interface CompletedStage { + /** + *

Whether the user has finished this lesson.

+ */ + CreatedAtStage completed(boolean completed); + + Builder from(CourseLessonInteractionListItem other); + } + + public interface CreatedAtStage { + /** + *

The datetime the lesson interaction was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the lesson interaction.

+ */ + LessonStage id(@NotNull String id); + } + + public interface LessonStage { + /** + *

The lesson that this progress record belongs to.

+ */ + UserStage lesson(@NotNull CourseLessonInteractionListItemLesson lesson); + } + + public interface UserStage { + /** + *

The user whose progress is being tracked.

+ */ + _FinalStage user(@NotNull CourseLessonInteractionListItemUser user); + } + + public interface _FinalStage { + CourseLessonInteractionListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CompletedStage, CreatedAtStage, IdStage, LessonStage, UserStage, _FinalStage { + private boolean completed; + + private OffsetDateTime createdAt; + + private String id; + + private CourseLessonInteractionListItemLesson lesson; + + private CourseLessonInteractionListItemUser user; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonInteractionListItem other) { + completed(other.getCompleted()); + createdAt(other.getCreatedAt()); + id(other.getId()); + lesson(other.getLesson()); + user(other.getUser()); + return this; + } + + /** + *

Whether the user has finished this lesson.

+ *

Whether the user has finished this lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completed") + public CreatedAtStage completed(boolean completed) { + this.completed = completed; + return this; + } + + /** + *

The datetime the lesson interaction was created.

+ *

The datetime the lesson interaction was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the lesson interaction.

+ *

The unique identifier for the lesson interaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LessonStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The lesson that this progress record belongs to.

+ *

The lesson that this progress record belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("lesson") + public UserStage lesson(@NotNull CourseLessonInteractionListItemLesson lesson) { + this.lesson = Objects.requireNonNull(lesson, "lesson must not be null"); + return this; + } + + /** + *

The user whose progress is being tracked.

+ *

The user whose progress is being tracked.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull CourseLessonInteractionListItemUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + @java.lang.Override + public CourseLessonInteractionListItem build() { + return new CourseLessonInteractionListItem(completed, createdAt, id, lesson, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonInteractionListItemLesson.java b/src/main/java/com/whop/api/types/CourseLessonInteractionListItemLesson.java new file mode 100644 index 00000000..733a54fd --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonInteractionListItemLesson.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonInteractionListItemLesson.Builder.class) +public final class CourseLessonInteractionListItemLesson { + private final CourseLessonInteractionListItemLessonChapter chapter; + + private final String id; + + private final String title; + + private final Map additionalProperties; + + private CourseLessonInteractionListItemLesson( + CourseLessonInteractionListItemLessonChapter chapter, + String id, + String title, + Map additionalProperties) { + this.chapter = chapter; + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The parent chapter that contains this lesson. + */ + @JsonProperty("chapter") + public CourseLessonInteractionListItemLessonChapter getChapter() { + return chapter; + } + + /** + * @return The unique identifier for the lesson. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the lesson shown to students. Maximum 120 characters. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonInteractionListItemLesson + && equalTo((CourseLessonInteractionListItemLesson) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonInteractionListItemLesson other) { + return chapter.equals(other.chapter) && id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.chapter, this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChapterStage builder() { + return new Builder(); + } + + public interface ChapterStage { + /** + *

The parent chapter that contains this lesson.

+ */ + IdStage chapter(@NotNull CourseLessonInteractionListItemLessonChapter chapter); + + Builder from(CourseLessonInteractionListItemLesson other); + } + + public interface IdStage { + /** + *

The unique identifier for the lesson.

+ */ + TitleStage id(@NotNull String id); + } + + public interface TitleStage { + /** + *

The display name of the lesson shown to students. Maximum 120 characters.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + CourseLessonInteractionListItemLesson build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ChapterStage, IdStage, TitleStage, _FinalStage { + private CourseLessonInteractionListItemLessonChapter chapter; + + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonInteractionListItemLesson other) { + chapter(other.getChapter()); + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The parent chapter that contains this lesson.

+ *

The parent chapter that contains this lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("chapter") + public IdStage chapter(@NotNull CourseLessonInteractionListItemLessonChapter chapter) { + this.chapter = Objects.requireNonNull(chapter, "chapter must not be null"); + return this; + } + + /** + *

The unique identifier for the lesson.

+ *

The unique identifier for the lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the lesson shown to students. Maximum 120 characters.

+ *

The display name of the lesson shown to students. Maximum 120 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public CourseLessonInteractionListItemLesson build() { + return new CourseLessonInteractionListItemLesson(chapter, id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonInteractionListItemLessonChapter.java b/src/main/java/com/whop/api/types/CourseLessonInteractionListItemLessonChapter.java new file mode 100644 index 00000000..bcc3ee75 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonInteractionListItemLessonChapter.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonInteractionListItemLessonChapter.Builder.class) +public final class CourseLessonInteractionListItemLessonChapter { + private final String id; + + private final Map additionalProperties; + + private CourseLessonInteractionListItemLessonChapter(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the chapter. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonInteractionListItemLessonChapter + && equalTo((CourseLessonInteractionListItemLessonChapter) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonInteractionListItemLessonChapter other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the chapter.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CourseLessonInteractionListItemLessonChapter other); + } + + public interface _FinalStage { + CourseLessonInteractionListItemLessonChapter build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonInteractionListItemLessonChapter other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the chapter.

+ *

The unique identifier for the chapter.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CourseLessonInteractionListItemLessonChapter build() { + return new CourseLessonInteractionListItemLessonChapter(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonInteractionListItemUser.java b/src/main/java/com/whop/api/types/CourseLessonInteractionListItemUser.java new file mode 100644 index 00000000..cb3ce240 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonInteractionListItemUser.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonInteractionListItemUser.Builder.class) +public final class CourseLessonInteractionListItemUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private CourseLessonInteractionListItemUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonInteractionListItemUser + && equalTo((CourseLessonInteractionListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonInteractionListItemUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(CourseLessonInteractionListItemUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + CourseLessonInteractionListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonInteractionListItemUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public CourseLessonInteractionListItemUser build() { + return new CourseLessonInteractionListItemUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonInteractionUser.java b/src/main/java/com/whop/api/types/CourseLessonInteractionUser.java new file mode 100644 index 00000000..c4385755 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonInteractionUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonInteractionUser.Builder.class) +public final class CourseLessonInteractionUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private CourseLessonInteractionUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonInteractionUser && equalTo((CourseLessonInteractionUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonInteractionUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(CourseLessonInteractionUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + CourseLessonInteractionUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonInteractionUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public CourseLessonInteractionUser build() { + return new CourseLessonInteractionUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonListItem.java b/src/main/java/com/whop/api/types/CourseLessonListItem.java new file mode 100644 index 00000000..29c1ed9a --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonListItem.java @@ -0,0 +1,686 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonListItem.Builder.class) +public final class CourseLessonListItem { + private final Optional content; + + private final OffsetDateTime createdAt; + + private final Optional daysFromCourseStartUntilUnlock; + + private final Optional embedId; + + private final Optional embedType; + + private final String id; + + private final LessonTypes lessonType; + + private final int order; + + private final Optional thumbnail; + + private final String title; + + private final LessonVisibilities visibility; + + private final Map additionalProperties; + + private CourseLessonListItem( + Optional content, + OffsetDateTime createdAt, + Optional daysFromCourseStartUntilUnlock, + Optional embedId, + Optional embedType, + String id, + LessonTypes lessonType, + int order, + Optional thumbnail, + String title, + LessonVisibilities visibility, + Map additionalProperties) { + this.content = content; + this.createdAt = createdAt; + this.daysFromCourseStartUntilUnlock = daysFromCourseStartUntilUnlock; + this.embedId = embedId; + this.embedType = embedType; + this.id = id; + this.lessonType = lessonType; + this.order = order; + this.thumbnail = thumbnail; + this.title = title; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Markdown content body of the lesson. Null if the lesson has no text content. + */ + @JsonIgnore + public Optional getContent() { + if (content == null) { + return Optional.empty(); + } + return content; + } + + /** + * @return The datetime the lesson was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The number of days after a student starts the course before this lesson becomes accessible. Null if the lesson is available immediately. + */ + @JsonIgnore + public Optional getDaysFromCourseStartUntilUnlock() { + if (daysFromCourseStartUntilUnlock == null) { + return Optional.empty(); + } + return daysFromCourseStartUntilUnlock; + } + + /** + * @return The external video identifier for embedded video lessons, such as a YouTube video ID or Loom share ID. Null if the lesson has no embed. + */ + @JsonIgnore + public Optional getEmbedId() { + if (embedId == null) { + return Optional.empty(); + } + return embedId; + } + + /** + * @return The platform type for the embedded video. One of: youtube, loom. Null if the lesson has no embed. + */ + @JsonIgnore + public Optional getEmbedType() { + if (embedType == null) { + return Optional.empty(); + } + return embedType; + } + + /** + * @return The unique identifier for the lesson. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The content format of this lesson. One of: text, video, pdf, multi, quiz, knowledge_check. + */ + @JsonProperty("lesson_type") + public LessonTypes getLessonType() { + return lessonType; + } + + /** + * @return The sort position of this lesson within its parent chapter, starting from zero. + */ + @JsonProperty("order") + public int getOrder() { + return order; + } + + /** + * @return The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded. + */ + @JsonIgnore + public Optional getThumbnail() { + if (thumbnail == null) { + return Optional.empty(); + } + return thumbnail; + } + + /** + * @return The display name of the lesson shown to students. Maximum 120 characters. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return The visibility setting that controls whether this lesson appears to students. One of: visible, hidden. + */ + @JsonProperty("visibility") + public LessonVisibilities getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content") + private Optional _getContent() { + return content; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("days_from_course_start_until_unlock") + private Optional _getDaysFromCourseStartUntilUnlock() { + return daysFromCourseStartUntilUnlock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("embed_id") + private Optional _getEmbedId() { + return embedId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("embed_type") + private Optional _getEmbedType() { + return embedType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail") + private Optional _getThumbnail() { + return thumbnail; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonListItem && equalTo((CourseLessonListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonListItem other) { + return content.equals(other.content) + && createdAt.equals(other.createdAt) + && daysFromCourseStartUntilUnlock.equals(other.daysFromCourseStartUntilUnlock) + && embedId.equals(other.embedId) + && embedType.equals(other.embedType) + && id.equals(other.id) + && lessonType.equals(other.lessonType) + && order == other.order + && thumbnail.equals(other.thumbnail) + && title.equals(other.title) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.content, + this.createdAt, + this.daysFromCourseStartUntilUnlock, + this.embedId, + this.embedType, + this.id, + this.lessonType, + this.order, + this.thumbnail, + this.title, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the lesson was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(CourseLessonListItem other); + } + + public interface IdStage { + /** + *

The unique identifier for the lesson.

+ */ + LessonTypeStage id(@NotNull String id); + } + + public interface LessonTypeStage { + /** + *

The content format of this lesson. One of: text, video, pdf, multi, quiz, knowledge_check.

+ */ + OrderStage lessonType(@NotNull LessonTypes lessonType); + } + + public interface OrderStage { + /** + *

The sort position of this lesson within its parent chapter, starting from zero.

+ */ + TitleStage order(int order); + } + + public interface TitleStage { + /** + *

The display name of the lesson shown to students. Maximum 120 characters.

+ */ + VisibilityStage title(@NotNull String title); + } + + public interface VisibilityStage { + /** + *

The visibility setting that controls whether this lesson appears to students. One of: visible, hidden.

+ */ + _FinalStage visibility(@NotNull LessonVisibilities visibility); + } + + public interface _FinalStage { + CourseLessonListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The Markdown content body of the lesson. Null if the lesson has no text content.

+ */ + _FinalStage content(Optional content); + + _FinalStage content(String content); + + _FinalStage content(Nullable content); + + /** + *

The number of days after a student starts the course before this lesson becomes accessible. Null if the lesson is available immediately.

+ */ + _FinalStage daysFromCourseStartUntilUnlock(Optional daysFromCourseStartUntilUnlock); + + _FinalStage daysFromCourseStartUntilUnlock(Integer daysFromCourseStartUntilUnlock); + + _FinalStage daysFromCourseStartUntilUnlock(Nullable daysFromCourseStartUntilUnlock); + + /** + *

The external video identifier for embedded video lessons, such as a YouTube video ID or Loom share ID. Null if the lesson has no embed.

+ */ + _FinalStage embedId(Optional embedId); + + _FinalStage embedId(String embedId); + + _FinalStage embedId(Nullable embedId); + + /** + *

The platform type for the embedded video. One of: youtube, loom. Null if the lesson has no embed.

+ */ + _FinalStage embedType(Optional embedType); + + _FinalStage embedType(EmbedTypes embedType); + + _FinalStage embedType(Nullable embedType); + + /** + *

The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded.

+ */ + _FinalStage thumbnail(Optional thumbnail); + + _FinalStage thumbnail(CourseLessonListItemThumbnail thumbnail); + + _FinalStage thumbnail(Nullable thumbnail); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IdStage, LessonTypeStage, OrderStage, TitleStage, VisibilityStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private LessonTypes lessonType; + + private int order; + + private String title; + + private LessonVisibilities visibility; + + private Optional thumbnail = Optional.empty(); + + private Optional embedType = Optional.empty(); + + private Optional embedId = Optional.empty(); + + private Optional daysFromCourseStartUntilUnlock = Optional.empty(); + + private Optional content = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonListItem other) { + content(other.getContent()); + createdAt(other.getCreatedAt()); + daysFromCourseStartUntilUnlock(other.getDaysFromCourseStartUntilUnlock()); + embedId(other.getEmbedId()); + embedType(other.getEmbedType()); + id(other.getId()); + lessonType(other.getLessonType()); + order(other.getOrder()); + thumbnail(other.getThumbnail()); + title(other.getTitle()); + visibility(other.getVisibility()); + return this; + } + + /** + *

The datetime the lesson was created.

+ *

The datetime the lesson was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the lesson.

+ *

The unique identifier for the lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LessonTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The content format of this lesson. One of: text, video, pdf, multi, quiz, knowledge_check.

+ *

The content format of this lesson. One of: text, video, pdf, multi, quiz, knowledge_check.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("lesson_type") + public OrderStage lessonType(@NotNull LessonTypes lessonType) { + this.lessonType = Objects.requireNonNull(lessonType, "lessonType must not be null"); + return this; + } + + /** + *

The sort position of this lesson within its parent chapter, starting from zero.

+ *

The sort position of this lesson within its parent chapter, starting from zero.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("order") + public TitleStage order(int order) { + this.order = order; + return this; + } + + /** + *

The display name of the lesson shown to students. Maximum 120 characters.

+ *

The display name of the lesson shown to students. Maximum 120 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public VisibilityStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

The visibility setting that controls whether this lesson appears to students. One of: visible, hidden.

+ *

The visibility setting that controls whether this lesson appears to students. One of: visible, hidden.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("visibility") + public _FinalStage visibility(@NotNull LessonVisibilities visibility) { + this.visibility = Objects.requireNonNull(visibility, "visibility must not be null"); + return this; + } + + /** + *

The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnail(Nullable thumbnail) { + if (thumbnail.isNull()) { + this.thumbnail = null; + } else if (thumbnail.isEmpty()) { + this.thumbnail = Optional.empty(); + } else { + this.thumbnail = Optional.of(thumbnail.get()); + } + return this; + } + + /** + *

The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnail(CourseLessonListItemThumbnail thumbnail) { + this.thumbnail = Optional.ofNullable(thumbnail); + return this; + } + + /** + *

The thumbnail image displayed on lesson cards and previews. Null if no thumbnail has been uploaded.

+ */ + @java.lang.Override + @JsonSetter(value = "thumbnail", nulls = Nulls.SKIP) + public _FinalStage thumbnail(Optional thumbnail) { + this.thumbnail = thumbnail; + return this; + } + + /** + *

The platform type for the embedded video. One of: youtube, loom. Null if the lesson has no embed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage embedType(Nullable embedType) { + if (embedType.isNull()) { + this.embedType = null; + } else if (embedType.isEmpty()) { + this.embedType = Optional.empty(); + } else { + this.embedType = Optional.of(embedType.get()); + } + return this; + } + + /** + *

The platform type for the embedded video. One of: youtube, loom. Null if the lesson has no embed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage embedType(EmbedTypes embedType) { + this.embedType = Optional.ofNullable(embedType); + return this; + } + + /** + *

The platform type for the embedded video. One of: youtube, loom. Null if the lesson has no embed.

+ */ + @java.lang.Override + @JsonSetter(value = "embed_type", nulls = Nulls.SKIP) + public _FinalStage embedType(Optional embedType) { + this.embedType = embedType; + return this; + } + + /** + *

The external video identifier for embedded video lessons, such as a YouTube video ID or Loom share ID. Null if the lesson has no embed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage embedId(Nullable embedId) { + if (embedId.isNull()) { + this.embedId = null; + } else if (embedId.isEmpty()) { + this.embedId = Optional.empty(); + } else { + this.embedId = Optional.of(embedId.get()); + } + return this; + } + + /** + *

The external video identifier for embedded video lessons, such as a YouTube video ID or Loom share ID. Null if the lesson has no embed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage embedId(String embedId) { + this.embedId = Optional.ofNullable(embedId); + return this; + } + + /** + *

The external video identifier for embedded video lessons, such as a YouTube video ID or Loom share ID. Null if the lesson has no embed.

+ */ + @java.lang.Override + @JsonSetter(value = "embed_id", nulls = Nulls.SKIP) + public _FinalStage embedId(Optional embedId) { + this.embedId = embedId; + return this; + } + + /** + *

The number of days after a student starts the course before this lesson becomes accessible. Null if the lesson is available immediately.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage daysFromCourseStartUntilUnlock(Nullable daysFromCourseStartUntilUnlock) { + if (daysFromCourseStartUntilUnlock.isNull()) { + this.daysFromCourseStartUntilUnlock = null; + } else if (daysFromCourseStartUntilUnlock.isEmpty()) { + this.daysFromCourseStartUntilUnlock = Optional.empty(); + } else { + this.daysFromCourseStartUntilUnlock = Optional.of(daysFromCourseStartUntilUnlock.get()); + } + return this; + } + + /** + *

The number of days after a student starts the course before this lesson becomes accessible. Null if the lesson is available immediately.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage daysFromCourseStartUntilUnlock(Integer daysFromCourseStartUntilUnlock) { + this.daysFromCourseStartUntilUnlock = Optional.ofNullable(daysFromCourseStartUntilUnlock); + return this; + } + + /** + *

The number of days after a student starts the course before this lesson becomes accessible. Null if the lesson is available immediately.

+ */ + @java.lang.Override + @JsonSetter(value = "days_from_course_start_until_unlock", nulls = Nulls.SKIP) + public _FinalStage daysFromCourseStartUntilUnlock(Optional daysFromCourseStartUntilUnlock) { + this.daysFromCourseStartUntilUnlock = daysFromCourseStartUntilUnlock; + return this; + } + + /** + *

The Markdown content body of the lesson. Null if the lesson has no text content.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(Nullable content) { + if (content.isNull()) { + this.content = null; + } else if (content.isEmpty()) { + this.content = Optional.empty(); + } else { + this.content = Optional.of(content.get()); + } + return this; + } + + /** + *

The Markdown content body of the lesson. Null if the lesson has no text content.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

The Markdown content body of the lesson. Null if the lesson has no text content.

+ */ + @java.lang.Override + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public _FinalStage content(Optional content) { + this.content = content; + return this; + } + + @java.lang.Override + public CourseLessonListItem build() { + return new CourseLessonListItem( + content, + createdAt, + daysFromCourseStartUntilUnlock, + embedId, + embedType, + id, + lessonType, + order, + thumbnail, + title, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonListItemThumbnail.java b/src/main/java/com/whop/api/types/CourseLessonListItemThumbnail.java new file mode 100644 index 00000000..321adb61 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonListItemThumbnail.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonListItemThumbnail.Builder.class) +public final class CourseLessonListItemThumbnail { + private final Optional url; + + private final Map additionalProperties; + + private CourseLessonListItemThumbnail(Optional url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonListItemThumbnail && equalTo((CourseLessonListItemThumbnail) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonListItemThumbnail other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CourseLessonListItemThumbnail other) { + url(other.getUrl()); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public Builder url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + public CourseLessonListItemThumbnail build() { + return new CourseLessonListItemThumbnail(url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonMainPdf.java b/src/main/java/com/whop/api/types/CourseLessonMainPdf.java new file mode 100644 index 00000000..8eab1aea --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonMainPdf.java @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonMainPdf.Builder.class) +public final class CourseLessonMainPdf { + private final Optional contentType; + + private final Optional filename; + + private final String id; + + private final Optional url; + + private final Map additionalProperties; + + private CourseLessonMainPdf( + Optional contentType, + Optional filename, + String id, + Optional url, + Map additionalProperties) { + this.contentType = contentType; + this.filename = filename; + this.id = id; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg. + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return The original filename of the uploaded attachment, including its file extension. + */ + @JsonIgnore + public Optional getFilename() { + if (filename == null) { + return Optional.empty(); + } + return filename; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filename") + private Optional _getFilename() { + return filename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonMainPdf && equalTo((CourseLessonMainPdf) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonMainPdf other) { + return contentType.equals(other.contentType) + && filename.equals(other.filename) + && id.equals(other.id) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contentType, this.filename, this.id, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CourseLessonMainPdf other); + } + + public interface _FinalStage { + CourseLessonMainPdf build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + _FinalStage filename(Optional filename); + + _FinalStage filename(String filename); + + _FinalStage filename(Nullable filename); + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional url = Optional.empty(); + + private Optional filename = Optional.empty(); + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonMainPdf other) { + contentType(other.getContentType()); + filename(other.getFilename()); + id(other.getId()); + url(other.getUrl()); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(Nullable filename) { + if (filename.isNull()) { + this.filename = null; + } else if (filename.isEmpty()) { + this.filename = Optional.empty(); + } else { + this.filename = Optional.of(filename.get()); + } + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(String filename) { + this.filename = Optional.ofNullable(filename); + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + @java.lang.Override + @JsonSetter(value = "filename", nulls = Nulls.SKIP) + public _FinalStage filename(Optional filename) { + this.filename = filename; + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public CourseLessonMainPdf build() { + return new CourseLessonMainPdf(contentType, filename, id, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonThumbnail.java b/src/main/java/com/whop/api/types/CourseLessonThumbnail.java new file mode 100644 index 00000000..81f07aef --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonThumbnail.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonThumbnail.Builder.class) +public final class CourseLessonThumbnail { + private final Optional url; + + private final Map additionalProperties; + + private CourseLessonThumbnail(Optional url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonThumbnail && equalTo((CourseLessonThumbnail) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonThumbnail other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CourseLessonThumbnail other) { + url(other.getUrl()); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public Builder url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + public CourseLessonThumbnail build() { + return new CourseLessonThumbnail(url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseLessonVideoAsset.java b/src/main/java/com/whop/api/types/CourseLessonVideoAsset.java new file mode 100644 index 00000000..8c26edd8 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseLessonVideoAsset.java @@ -0,0 +1,865 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseLessonVideoAsset.Builder.class) +public final class CourseLessonVideoAsset { + private final Optional assetId; + + private final boolean audioOnly; + + private final OffsetDateTime createdAt; + + private final Optional durationSeconds; + + private final Optional finishedUploadingAt; + + private final String id; + + private final Optional playbackId; + + private final Optional signedPlaybackId; + + private final Optional signedStoryboardPlaybackToken; + + private final Optional signedThumbnailPlaybackToken; + + private final Optional signedVideoPlaybackToken; + + private final MuxAssetStatuses status; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private CourseLessonVideoAsset( + Optional assetId, + boolean audioOnly, + OffsetDateTime createdAt, + Optional durationSeconds, + Optional finishedUploadingAt, + String id, + Optional playbackId, + Optional signedPlaybackId, + Optional signedStoryboardPlaybackToken, + Optional signedThumbnailPlaybackToken, + Optional signedVideoPlaybackToken, + MuxAssetStatuses status, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.assetId = assetId; + this.audioOnly = audioOnly; + this.createdAt = createdAt; + this.durationSeconds = durationSeconds; + this.finishedUploadingAt = finishedUploadingAt; + this.id = id; + this.playbackId = playbackId; + this.signedPlaybackId = signedPlaybackId; + this.signedStoryboardPlaybackToken = signedStoryboardPlaybackToken; + this.signedThumbnailPlaybackToken = signedThumbnailPlaybackToken; + this.signedVideoPlaybackToken = signedVideoPlaybackToken; + this.status = status; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Mux-provided ID of the asset + */ + @JsonIgnore + public Optional getAssetId() { + if (assetId == null) { + return Optional.empty(); + } + return assetId; + } + + /** + * @return Whether this asset contains only audio + */ + @JsonProperty("audio_only") + public boolean getAudioOnly() { + return audioOnly; + } + + /** + * @return The datetime the mux asset was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The duration of the video in seconds + */ + @JsonIgnore + public Optional getDurationSeconds() { + if (durationSeconds == null) { + return Optional.empty(); + } + return durationSeconds; + } + + /** + * @return The time at which the video finished uploading + */ + @JsonIgnore + public Optional getFinishedUploadingAt() { + if (finishedUploadingAt == null) { + return Optional.empty(); + } + return finishedUploadingAt; + } + + /** + * @return The unique identifier for the mux asset. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The public playback ID of the Mux asset + */ + @JsonIgnore + public Optional getPlaybackId() { + if (playbackId == null) { + return Optional.empty(); + } + return playbackId; + } + + /** + * @return The signed playback ID of the Mux asset + */ + @JsonIgnore + public Optional getSignedPlaybackId() { + if (signedPlaybackId == null) { + return Optional.empty(); + } + return signedPlaybackId; + } + + /** + * @return The signed storyboard playback token of the Mux asset + */ + @JsonIgnore + public Optional getSignedStoryboardPlaybackToken() { + if (signedStoryboardPlaybackToken == null) { + return Optional.empty(); + } + return signedStoryboardPlaybackToken; + } + + /** + * @return The signed thumbnail playback token of the Mux asset + */ + @JsonIgnore + public Optional getSignedThumbnailPlaybackToken() { + if (signedThumbnailPlaybackToken == null) { + return Optional.empty(); + } + return signedThumbnailPlaybackToken; + } + + /** + * @return The signed video playback token of the Mux asset + */ + @JsonIgnore + public Optional getSignedVideoPlaybackToken() { + if (signedVideoPlaybackToken == null) { + return Optional.empty(); + } + return signedVideoPlaybackToken; + } + + /** + * @return The status of the Mux asset + */ + @JsonProperty("status") + public MuxAssetStatuses getStatus() { + return status; + } + + /** + * @return The datetime the mux asset was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("asset_id") + private Optional _getAssetId() { + return assetId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("duration_seconds") + private Optional _getDurationSeconds() { + return durationSeconds; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("finished_uploading_at") + private Optional _getFinishedUploadingAt() { + return finishedUploadingAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("playback_id") + private Optional _getPlaybackId() { + return playbackId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("signed_playback_id") + private Optional _getSignedPlaybackId() { + return signedPlaybackId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("signed_storyboard_playback_token") + private Optional _getSignedStoryboardPlaybackToken() { + return signedStoryboardPlaybackToken; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("signed_thumbnail_playback_token") + private Optional _getSignedThumbnailPlaybackToken() { + return signedThumbnailPlaybackToken; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("signed_video_playback_token") + private Optional _getSignedVideoPlaybackToken() { + return signedVideoPlaybackToken; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseLessonVideoAsset && equalTo((CourseLessonVideoAsset) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseLessonVideoAsset other) { + return assetId.equals(other.assetId) + && audioOnly == other.audioOnly + && createdAt.equals(other.createdAt) + && durationSeconds.equals(other.durationSeconds) + && finishedUploadingAt.equals(other.finishedUploadingAt) + && id.equals(other.id) + && playbackId.equals(other.playbackId) + && signedPlaybackId.equals(other.signedPlaybackId) + && signedStoryboardPlaybackToken.equals(other.signedStoryboardPlaybackToken) + && signedThumbnailPlaybackToken.equals(other.signedThumbnailPlaybackToken) + && signedVideoPlaybackToken.equals(other.signedVideoPlaybackToken) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.assetId, + this.audioOnly, + this.createdAt, + this.durationSeconds, + this.finishedUploadingAt, + this.id, + this.playbackId, + this.signedPlaybackId, + this.signedStoryboardPlaybackToken, + this.signedThumbnailPlaybackToken, + this.signedVideoPlaybackToken, + this.status, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AudioOnlyStage builder() { + return new Builder(); + } + + public interface AudioOnlyStage { + /** + *

Whether this asset contains only audio

+ */ + CreatedAtStage audioOnly(boolean audioOnly); + + Builder from(CourseLessonVideoAsset other); + } + + public interface CreatedAtStage { + /** + *

The datetime the mux asset was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the mux asset.

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

The status of the Mux asset

+ */ + UpdatedAtStage status(@NotNull MuxAssetStatuses status); + } + + public interface UpdatedAtStage { + /** + *

The datetime the mux asset was last updated.

+ */ + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + CourseLessonVideoAsset build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The Mux-provided ID of the asset

+ */ + _FinalStage assetId(Optional assetId); + + _FinalStage assetId(String assetId); + + _FinalStage assetId(Nullable assetId); + + /** + *

The duration of the video in seconds

+ */ + _FinalStage durationSeconds(Optional durationSeconds); + + _FinalStage durationSeconds(Integer durationSeconds); + + _FinalStage durationSeconds(Nullable durationSeconds); + + /** + *

The time at which the video finished uploading

+ */ + _FinalStage finishedUploadingAt(Optional finishedUploadingAt); + + _FinalStage finishedUploadingAt(OffsetDateTime finishedUploadingAt); + + _FinalStage finishedUploadingAt(Nullable finishedUploadingAt); + + /** + *

The public playback ID of the Mux asset

+ */ + _FinalStage playbackId(Optional playbackId); + + _FinalStage playbackId(String playbackId); + + _FinalStage playbackId(Nullable playbackId); + + /** + *

The signed playback ID of the Mux asset

+ */ + _FinalStage signedPlaybackId(Optional signedPlaybackId); + + _FinalStage signedPlaybackId(String signedPlaybackId); + + _FinalStage signedPlaybackId(Nullable signedPlaybackId); + + /** + *

The signed storyboard playback token of the Mux asset

+ */ + _FinalStage signedStoryboardPlaybackToken(Optional signedStoryboardPlaybackToken); + + _FinalStage signedStoryboardPlaybackToken(String signedStoryboardPlaybackToken); + + _FinalStage signedStoryboardPlaybackToken(Nullable signedStoryboardPlaybackToken); + + /** + *

The signed thumbnail playback token of the Mux asset

+ */ + _FinalStage signedThumbnailPlaybackToken(Optional signedThumbnailPlaybackToken); + + _FinalStage signedThumbnailPlaybackToken(String signedThumbnailPlaybackToken); + + _FinalStage signedThumbnailPlaybackToken(Nullable signedThumbnailPlaybackToken); + + /** + *

The signed video playback token of the Mux asset

+ */ + _FinalStage signedVideoPlaybackToken(Optional signedVideoPlaybackToken); + + _FinalStage signedVideoPlaybackToken(String signedVideoPlaybackToken); + + _FinalStage signedVideoPlaybackToken(Nullable signedVideoPlaybackToken); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AudioOnlyStage, CreatedAtStage, IdStage, StatusStage, UpdatedAtStage, _FinalStage { + private boolean audioOnly; + + private OffsetDateTime createdAt; + + private String id; + + private MuxAssetStatuses status; + + private OffsetDateTime updatedAt; + + private Optional signedVideoPlaybackToken = Optional.empty(); + + private Optional signedThumbnailPlaybackToken = Optional.empty(); + + private Optional signedStoryboardPlaybackToken = Optional.empty(); + + private Optional signedPlaybackId = Optional.empty(); + + private Optional playbackId = Optional.empty(); + + private Optional finishedUploadingAt = Optional.empty(); + + private Optional durationSeconds = Optional.empty(); + + private Optional assetId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseLessonVideoAsset other) { + assetId(other.getAssetId()); + audioOnly(other.getAudioOnly()); + createdAt(other.getCreatedAt()); + durationSeconds(other.getDurationSeconds()); + finishedUploadingAt(other.getFinishedUploadingAt()); + id(other.getId()); + playbackId(other.getPlaybackId()); + signedPlaybackId(other.getSignedPlaybackId()); + signedStoryboardPlaybackToken(other.getSignedStoryboardPlaybackToken()); + signedThumbnailPlaybackToken(other.getSignedThumbnailPlaybackToken()); + signedVideoPlaybackToken(other.getSignedVideoPlaybackToken()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

Whether this asset contains only audio

+ *

Whether this asset contains only audio

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("audio_only") + public CreatedAtStage audioOnly(boolean audioOnly) { + this.audioOnly = audioOnly; + return this; + } + + /** + *

The datetime the mux asset was created.

+ *

The datetime the mux asset was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the mux asset.

+ *

The unique identifier for the mux asset.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The status of the Mux asset

+ *

The status of the Mux asset

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull MuxAssetStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The datetime the mux asset was last updated.

+ *

The datetime the mux asset was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The signed video playback token of the Mux asset

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage signedVideoPlaybackToken(Nullable signedVideoPlaybackToken) { + if (signedVideoPlaybackToken.isNull()) { + this.signedVideoPlaybackToken = null; + } else if (signedVideoPlaybackToken.isEmpty()) { + this.signedVideoPlaybackToken = Optional.empty(); + } else { + this.signedVideoPlaybackToken = Optional.of(signedVideoPlaybackToken.get()); + } + return this; + } + + /** + *

The signed video playback token of the Mux asset

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage signedVideoPlaybackToken(String signedVideoPlaybackToken) { + this.signedVideoPlaybackToken = Optional.ofNullable(signedVideoPlaybackToken); + return this; + } + + /** + *

The signed video playback token of the Mux asset

+ */ + @java.lang.Override + @JsonSetter(value = "signed_video_playback_token", nulls = Nulls.SKIP) + public _FinalStage signedVideoPlaybackToken(Optional signedVideoPlaybackToken) { + this.signedVideoPlaybackToken = signedVideoPlaybackToken; + return this; + } + + /** + *

The signed thumbnail playback token of the Mux asset

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage signedThumbnailPlaybackToken(Nullable signedThumbnailPlaybackToken) { + if (signedThumbnailPlaybackToken.isNull()) { + this.signedThumbnailPlaybackToken = null; + } else if (signedThumbnailPlaybackToken.isEmpty()) { + this.signedThumbnailPlaybackToken = Optional.empty(); + } else { + this.signedThumbnailPlaybackToken = Optional.of(signedThumbnailPlaybackToken.get()); + } + return this; + } + + /** + *

The signed thumbnail playback token of the Mux asset

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage signedThumbnailPlaybackToken(String signedThumbnailPlaybackToken) { + this.signedThumbnailPlaybackToken = Optional.ofNullable(signedThumbnailPlaybackToken); + return this; + } + + /** + *

The signed thumbnail playback token of the Mux asset

+ */ + @java.lang.Override + @JsonSetter(value = "signed_thumbnail_playback_token", nulls = Nulls.SKIP) + public _FinalStage signedThumbnailPlaybackToken(Optional signedThumbnailPlaybackToken) { + this.signedThumbnailPlaybackToken = signedThumbnailPlaybackToken; + return this; + } + + /** + *

The signed storyboard playback token of the Mux asset

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage signedStoryboardPlaybackToken(Nullable signedStoryboardPlaybackToken) { + if (signedStoryboardPlaybackToken.isNull()) { + this.signedStoryboardPlaybackToken = null; + } else if (signedStoryboardPlaybackToken.isEmpty()) { + this.signedStoryboardPlaybackToken = Optional.empty(); + } else { + this.signedStoryboardPlaybackToken = Optional.of(signedStoryboardPlaybackToken.get()); + } + return this; + } + + /** + *

The signed storyboard playback token of the Mux asset

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage signedStoryboardPlaybackToken(String signedStoryboardPlaybackToken) { + this.signedStoryboardPlaybackToken = Optional.ofNullable(signedStoryboardPlaybackToken); + return this; + } + + /** + *

The signed storyboard playback token of the Mux asset

+ */ + @java.lang.Override + @JsonSetter(value = "signed_storyboard_playback_token", nulls = Nulls.SKIP) + public _FinalStage signedStoryboardPlaybackToken(Optional signedStoryboardPlaybackToken) { + this.signedStoryboardPlaybackToken = signedStoryboardPlaybackToken; + return this; + } + + /** + *

The signed playback ID of the Mux asset

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage signedPlaybackId(Nullable signedPlaybackId) { + if (signedPlaybackId.isNull()) { + this.signedPlaybackId = null; + } else if (signedPlaybackId.isEmpty()) { + this.signedPlaybackId = Optional.empty(); + } else { + this.signedPlaybackId = Optional.of(signedPlaybackId.get()); + } + return this; + } + + /** + *

The signed playback ID of the Mux asset

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage signedPlaybackId(String signedPlaybackId) { + this.signedPlaybackId = Optional.ofNullable(signedPlaybackId); + return this; + } + + /** + *

The signed playback ID of the Mux asset

+ */ + @java.lang.Override + @JsonSetter(value = "signed_playback_id", nulls = Nulls.SKIP) + public _FinalStage signedPlaybackId(Optional signedPlaybackId) { + this.signedPlaybackId = signedPlaybackId; + return this; + } + + /** + *

The public playback ID of the Mux asset

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage playbackId(Nullable playbackId) { + if (playbackId.isNull()) { + this.playbackId = null; + } else if (playbackId.isEmpty()) { + this.playbackId = Optional.empty(); + } else { + this.playbackId = Optional.of(playbackId.get()); + } + return this; + } + + /** + *

The public playback ID of the Mux asset

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage playbackId(String playbackId) { + this.playbackId = Optional.ofNullable(playbackId); + return this; + } + + /** + *

The public playback ID of the Mux asset

+ */ + @java.lang.Override + @JsonSetter(value = "playback_id", nulls = Nulls.SKIP) + public _FinalStage playbackId(Optional playbackId) { + this.playbackId = playbackId; + return this; + } + + /** + *

The time at which the video finished uploading

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage finishedUploadingAt(Nullable finishedUploadingAt) { + if (finishedUploadingAt.isNull()) { + this.finishedUploadingAt = null; + } else if (finishedUploadingAt.isEmpty()) { + this.finishedUploadingAt = Optional.empty(); + } else { + this.finishedUploadingAt = Optional.of(finishedUploadingAt.get()); + } + return this; + } + + /** + *

The time at which the video finished uploading

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage finishedUploadingAt(OffsetDateTime finishedUploadingAt) { + this.finishedUploadingAt = Optional.ofNullable(finishedUploadingAt); + return this; + } + + /** + *

The time at which the video finished uploading

+ */ + @java.lang.Override + @JsonSetter(value = "finished_uploading_at", nulls = Nulls.SKIP) + public _FinalStage finishedUploadingAt(Optional finishedUploadingAt) { + this.finishedUploadingAt = finishedUploadingAt; + return this; + } + + /** + *

The duration of the video in seconds

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage durationSeconds(Nullable durationSeconds) { + if (durationSeconds.isNull()) { + this.durationSeconds = null; + } else if (durationSeconds.isEmpty()) { + this.durationSeconds = Optional.empty(); + } else { + this.durationSeconds = Optional.of(durationSeconds.get()); + } + return this; + } + + /** + *

The duration of the video in seconds

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage durationSeconds(Integer durationSeconds) { + this.durationSeconds = Optional.ofNullable(durationSeconds); + return this; + } + + /** + *

The duration of the video in seconds

+ */ + @java.lang.Override + @JsonSetter(value = "duration_seconds", nulls = Nulls.SKIP) + public _FinalStage durationSeconds(Optional durationSeconds) { + this.durationSeconds = durationSeconds; + return this; + } + + /** + *

The Mux-provided ID of the asset

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assetId(Nullable assetId) { + if (assetId.isNull()) { + this.assetId = null; + } else if (assetId.isEmpty()) { + this.assetId = Optional.empty(); + } else { + this.assetId = Optional.of(assetId.get()); + } + return this; + } + + /** + *

The Mux-provided ID of the asset

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assetId(String assetId) { + this.assetId = Optional.ofNullable(assetId); + return this; + } + + /** + *

The Mux-provided ID of the asset

+ */ + @java.lang.Override + @JsonSetter(value = "asset_id", nulls = Nulls.SKIP) + public _FinalStage assetId(Optional assetId) { + this.assetId = assetId; + return this; + } + + @java.lang.Override + public CourseLessonVideoAsset build() { + return new CourseLessonVideoAsset( + assetId, + audioOnly, + createdAt, + durationSeconds, + finishedUploadingAt, + id, + playbackId, + signedPlaybackId, + signedStoryboardPlaybackToken, + signedThumbnailPlaybackToken, + signedVideoPlaybackToken, + status, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseListItem.java b/src/main/java/com/whop/api/types/CourseListItem.java new file mode 100644 index 00000000..652b199f --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseListItem.java @@ -0,0 +1,1234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseListItem.Builder.class) +public final class CourseListItem { + private final Optional certificateAfterCompletionEnabled; + + private final int chaptersCount; + + private final int completedLessonsCount; + + private final Optional coverImage; + + private final OffsetDateTime createdAt; + + private final Optional description; + + private final String id; + + private final Languages language; + + private final Optional latestLessonCreatedAt; + + private final List lessonUnlockDays; + + private final String order; + + private final boolean requireCompletingLessonsInOrder; + + private final Optional resumeLesson; + + private final Optional startedAt; + + private final Optional tagline; + + private final Optional thumbnail; + + private final Optional title; + + private final int totalDurationSeconds; + + private final int totalLessonsCount; + + private final OffsetDateTime updatedAt; + + private final CourseVisibilities visibility; + + private final Map additionalProperties; + + private CourseListItem( + Optional certificateAfterCompletionEnabled, + int chaptersCount, + int completedLessonsCount, + Optional coverImage, + OffsetDateTime createdAt, + Optional description, + String id, + Languages language, + Optional latestLessonCreatedAt, + List lessonUnlockDays, + String order, + boolean requireCompletingLessonsInOrder, + Optional resumeLesson, + Optional startedAt, + Optional tagline, + Optional thumbnail, + Optional title, + int totalDurationSeconds, + int totalLessonsCount, + OffsetDateTime updatedAt, + CourseVisibilities visibility, + Map additionalProperties) { + this.certificateAfterCompletionEnabled = certificateAfterCompletionEnabled; + this.chaptersCount = chaptersCount; + this.completedLessonsCount = completedLessonsCount; + this.coverImage = coverImage; + this.createdAt = createdAt; + this.description = description; + this.id = id; + this.language = language; + this.latestLessonCreatedAt = latestLessonCreatedAt; + this.lessonUnlockDays = lessonUnlockDays; + this.order = order; + this.requireCompletingLessonsInOrder = requireCompletingLessonsInOrder; + this.resumeLesson = resumeLesson; + this.startedAt = startedAt; + this.tagline = tagline; + this.thumbnail = thumbnail; + this.title = title; + this.totalDurationSeconds = totalDurationSeconds; + this.totalLessonsCount = totalLessonsCount; + this.updatedAt = updatedAt; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether students receive a PDF certificate after completing all lessons in this course. Null if the setting has not been configured. + */ + @JsonIgnore + public Optional getCertificateAfterCompletionEnabled() { + if (certificateAfterCompletionEnabled == null) { + return Optional.empty(); + } + return certificateAfterCompletionEnabled; + } + + /** + * @return The total number of chapters in this course, including chapters whose lessons are all hidden from the current user. + */ + @JsonProperty("chapters_count") + public int getChaptersCount() { + return chaptersCount; + } + + /** + * @return The number of lessons in this course that the current user has marked as completed. Zero when the request is not made on behalf of a user. + */ + @JsonProperty("completed_lessons_count") + public int getCompletedLessonsCount() { + return completedLessonsCount; + } + + /** + * @return The URL of the course cover image shown on preview cards. Null if no cover image has been uploaded. + */ + @JsonIgnore + public Optional getCoverImage() { + if (coverImage == null) { + return Optional.empty(); + } + return coverImage; + } + + /** + * @return The datetime the course was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return A brief summary of the course content and objectives. Null if no description has been set. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The unique identifier for the course. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The spoken language of the video content, used to generate accurate closed captions. One of: en, es, it, pt, de, fr, pl, ru, nl, ca, tr, sv, uk, no, fi, sk, el, cs, hr, da, ro, bg. + */ + @JsonProperty("language") + public Languages getLanguage() { + return language; + } + + /** + * @return The creation timestamp of the most recently added lesson visible to the current user. Null if the course has no lessons. + */ + @JsonIgnore + public Optional getLatestLessonCreatedAt() { + if (latestLessonCreatedAt == null) { + return Optional.empty(); + } + return latestLessonCreatedAt; + } + + /** + * @return The distinct drip schedules, in days after the course start, of lessons visible to the current user. Combine with startedAt to work out which have unlocked. Empty when the user has not started the course or no lesson is on a schedule. + */ + @JsonProperty("lesson_unlock_days") + public List getLessonUnlockDays() { + return lessonUnlockDays; + } + + /** + * @return The sort position of this course within its parent experience, as a decimal for flexible ordering. + */ + @JsonProperty("order") + public String getOrder() { + return order; + } + + /** + * @return Whether students must complete each lesson sequentially before advancing to the next one. + */ + @JsonProperty("require_completing_lessons_in_order") + public boolean getRequireCompletingLessonsInOrder() { + return requireCompletingLessonsInOrder; + } + + /** + * @return The lesson the current user should continue from: their first incomplete lesson, or the first lesson when they have finished the course, have not started it, or can edit it. Null if the course has no lessons. + */ + @JsonIgnore + public Optional getResumeLesson() { + if (resumeLesson == null) { + return Optional.empty(); + } + return resumeLesson; + } + + /** + * @return The earliest time the current user is known to have started this course. Null if they have not started it. Drip unlock schedules are measured from this point. + */ + @JsonIgnore + public Optional getStartedAt() { + if (startedAt == null) { + return Optional.empty(); + } + return startedAt; + } + + /** + * @return A short marketing tagline displayed beneath the course title. Null if no tagline has been set. + */ + @JsonIgnore + public Optional getTagline() { + if (tagline == null) { + return Optional.empty(); + } + return tagline; + } + + /** + * @return The thumbnail image displayed on course cards and previews. Null if no thumbnail has been uploaded. + */ + @JsonIgnore + public Optional getThumbnail() { + if (thumbnail == null) { + return Optional.empty(); + } + return thumbnail; + } + + /** + * @return The display name of the course shown to students. Null if no title has been set. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The combined duration in seconds of every hosted video across the lessons visible to the current user. + */ + @JsonProperty("total_duration_seconds") + public int getTotalDurationSeconds() { + return totalDurationSeconds; + } + + /** + * @return The number of lessons in this course visible to the current user. + */ + @JsonProperty("total_lessons_count") + public int getTotalLessonsCount() { + return totalLessonsCount; + } + + /** + * @return The datetime the course was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The visibility setting that controls whether this course appears to students. One of: visible, hidden. + */ + @JsonProperty("visibility") + public CourseVisibilities getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("certificate_after_completion_enabled") + private Optional _getCertificateAfterCompletionEnabled() { + return certificateAfterCompletionEnabled; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cover_image") + private Optional _getCoverImage() { + return coverImage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("latest_lesson_created_at") + private Optional _getLatestLessonCreatedAt() { + return latestLessonCreatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resume_lesson") + private Optional _getResumeLesson() { + return resumeLesson; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("started_at") + private Optional _getStartedAt() { + return startedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tagline") + private Optional _getTagline() { + return tagline; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail") + private Optional _getThumbnail() { + return thumbnail; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseListItem && equalTo((CourseListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseListItem other) { + return certificateAfterCompletionEnabled.equals(other.certificateAfterCompletionEnabled) + && chaptersCount == other.chaptersCount + && completedLessonsCount == other.completedLessonsCount + && coverImage.equals(other.coverImage) + && createdAt.equals(other.createdAt) + && description.equals(other.description) + && id.equals(other.id) + && language.equals(other.language) + && latestLessonCreatedAt.equals(other.latestLessonCreatedAt) + && lessonUnlockDays.equals(other.lessonUnlockDays) + && order.equals(other.order) + && requireCompletingLessonsInOrder == other.requireCompletingLessonsInOrder + && resumeLesson.equals(other.resumeLesson) + && startedAt.equals(other.startedAt) + && tagline.equals(other.tagline) + && thumbnail.equals(other.thumbnail) + && title.equals(other.title) + && totalDurationSeconds == other.totalDurationSeconds + && totalLessonsCount == other.totalLessonsCount + && updatedAt.equals(other.updatedAt) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.certificateAfterCompletionEnabled, + this.chaptersCount, + this.completedLessonsCount, + this.coverImage, + this.createdAt, + this.description, + this.id, + this.language, + this.latestLessonCreatedAt, + this.lessonUnlockDays, + this.order, + this.requireCompletingLessonsInOrder, + this.resumeLesson, + this.startedAt, + this.tagline, + this.thumbnail, + this.title, + this.totalDurationSeconds, + this.totalLessonsCount, + this.updatedAt, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChaptersCountStage builder() { + return new Builder(); + } + + public interface ChaptersCountStage { + /** + *

The total number of chapters in this course, including chapters whose lessons are all hidden from the current user.

+ */ + CompletedLessonsCountStage chaptersCount(int chaptersCount); + + Builder from(CourseListItem other); + } + + public interface CompletedLessonsCountStage { + /** + *

The number of lessons in this course that the current user has marked as completed. Zero when the request is not made on behalf of a user.

+ */ + CreatedAtStage completedLessonsCount(int completedLessonsCount); + } + + public interface CreatedAtStage { + /** + *

The datetime the course was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the course.

+ */ + LanguageStage id(@NotNull String id); + } + + public interface LanguageStage { + /** + *

The spoken language of the video content, used to generate accurate closed captions. One of: en, es, it, pt, de, fr, pl, ru, nl, ca, tr, sv, uk, no, fi, sk, el, cs, hr, da, ro, bg.

+ */ + OrderStage language(@NotNull Languages language); + } + + public interface OrderStage { + /** + *

The sort position of this course within its parent experience, as a decimal for flexible ordering.

+ */ + RequireCompletingLessonsInOrderStage order(@NotNull String order); + } + + public interface RequireCompletingLessonsInOrderStage { + /** + *

Whether students must complete each lesson sequentially before advancing to the next one.

+ */ + TotalDurationSecondsStage requireCompletingLessonsInOrder(boolean requireCompletingLessonsInOrder); + } + + public interface TotalDurationSecondsStage { + /** + *

The combined duration in seconds of every hosted video across the lessons visible to the current user.

+ */ + TotalLessonsCountStage totalDurationSeconds(int totalDurationSeconds); + } + + public interface TotalLessonsCountStage { + /** + *

The number of lessons in this course visible to the current user.

+ */ + UpdatedAtStage totalLessonsCount(int totalLessonsCount); + } + + public interface UpdatedAtStage { + /** + *

The datetime the course was last updated.

+ */ + VisibilityStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface VisibilityStage { + /** + *

The visibility setting that controls whether this course appears to students. One of: visible, hidden.

+ */ + _FinalStage visibility(@NotNull CourseVisibilities visibility); + } + + public interface _FinalStage { + CourseListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Whether students receive a PDF certificate after completing all lessons in this course. Null if the setting has not been configured.

+ */ + _FinalStage certificateAfterCompletionEnabled(Optional certificateAfterCompletionEnabled); + + _FinalStage certificateAfterCompletionEnabled(Boolean certificateAfterCompletionEnabled); + + _FinalStage certificateAfterCompletionEnabled(Nullable certificateAfterCompletionEnabled); + + /** + *

The URL of the course cover image shown on preview cards. Null if no cover image has been uploaded.

+ */ + _FinalStage coverImage(Optional coverImage); + + _FinalStage coverImage(String coverImage); + + _FinalStage coverImage(Nullable coverImage); + + /** + *

A brief summary of the course content and objectives. Null if no description has been set.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

The creation timestamp of the most recently added lesson visible to the current user. Null if the course has no lessons.

+ */ + _FinalStage latestLessonCreatedAt(Optional latestLessonCreatedAt); + + _FinalStage latestLessonCreatedAt(OffsetDateTime latestLessonCreatedAt); + + _FinalStage latestLessonCreatedAt(Nullable latestLessonCreatedAt); + + /** + *

The distinct drip schedules, in days after the course start, of lessons visible to the current user. Combine with startedAt to work out which have unlocked. Empty when the user has not started the course or no lesson is on a schedule.

+ */ + _FinalStage lessonUnlockDays(List lessonUnlockDays); + + _FinalStage addLessonUnlockDays(Integer lessonUnlockDays); + + _FinalStage addAllLessonUnlockDays(List lessonUnlockDays); + + /** + *

The lesson the current user should continue from: their first incomplete lesson, or the first lesson when they have finished the course, have not started it, or can edit it. Null if the course has no lessons.

+ */ + _FinalStage resumeLesson(Optional resumeLesson); + + _FinalStage resumeLesson(CourseListItemResumeLesson resumeLesson); + + _FinalStage resumeLesson(Nullable resumeLesson); + + /** + *

The earliest time the current user is known to have started this course. Null if they have not started it. Drip unlock schedules are measured from this point.

+ */ + _FinalStage startedAt(Optional startedAt); + + _FinalStage startedAt(OffsetDateTime startedAt); + + _FinalStage startedAt(Nullable startedAt); + + /** + *

A short marketing tagline displayed beneath the course title. Null if no tagline has been set.

+ */ + _FinalStage tagline(Optional tagline); + + _FinalStage tagline(String tagline); + + _FinalStage tagline(Nullable tagline); + + /** + *

The thumbnail image displayed on course cards and previews. Null if no thumbnail has been uploaded.

+ */ + _FinalStage thumbnail(Optional thumbnail); + + _FinalStage thumbnail(CourseListItemThumbnail thumbnail); + + _FinalStage thumbnail(Nullable thumbnail); + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ChaptersCountStage, + CompletedLessonsCountStage, + CreatedAtStage, + IdStage, + LanguageStage, + OrderStage, + RequireCompletingLessonsInOrderStage, + TotalDurationSecondsStage, + TotalLessonsCountStage, + UpdatedAtStage, + VisibilityStage, + _FinalStage { + private int chaptersCount; + + private int completedLessonsCount; + + private OffsetDateTime createdAt; + + private String id; + + private Languages language; + + private String order; + + private boolean requireCompletingLessonsInOrder; + + private int totalDurationSeconds; + + private int totalLessonsCount; + + private OffsetDateTime updatedAt; + + private CourseVisibilities visibility; + + private Optional title = Optional.empty(); + + private Optional thumbnail = Optional.empty(); + + private Optional tagline = Optional.empty(); + + private Optional startedAt = Optional.empty(); + + private Optional resumeLesson = Optional.empty(); + + private List lessonUnlockDays = new ArrayList<>(); + + private Optional latestLessonCreatedAt = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional coverImage = Optional.empty(); + + private Optional certificateAfterCompletionEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseListItem other) { + certificateAfterCompletionEnabled(other.getCertificateAfterCompletionEnabled()); + chaptersCount(other.getChaptersCount()); + completedLessonsCount(other.getCompletedLessonsCount()); + coverImage(other.getCoverImage()); + createdAt(other.getCreatedAt()); + description(other.getDescription()); + id(other.getId()); + language(other.getLanguage()); + latestLessonCreatedAt(other.getLatestLessonCreatedAt()); + lessonUnlockDays(other.getLessonUnlockDays()); + order(other.getOrder()); + requireCompletingLessonsInOrder(other.getRequireCompletingLessonsInOrder()); + resumeLesson(other.getResumeLesson()); + startedAt(other.getStartedAt()); + tagline(other.getTagline()); + thumbnail(other.getThumbnail()); + title(other.getTitle()); + totalDurationSeconds(other.getTotalDurationSeconds()); + totalLessonsCount(other.getTotalLessonsCount()); + updatedAt(other.getUpdatedAt()); + visibility(other.getVisibility()); + return this; + } + + /** + *

The total number of chapters in this course, including chapters whose lessons are all hidden from the current user.

+ *

The total number of chapters in this course, including chapters whose lessons are all hidden from the current user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("chapters_count") + public CompletedLessonsCountStage chaptersCount(int chaptersCount) { + this.chaptersCount = chaptersCount; + return this; + } + + /** + *

The number of lessons in this course that the current user has marked as completed. Zero when the request is not made on behalf of a user.

+ *

The number of lessons in this course that the current user has marked as completed. Zero when the request is not made on behalf of a user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completed_lessons_count") + public CreatedAtStage completedLessonsCount(int completedLessonsCount) { + this.completedLessonsCount = completedLessonsCount; + return this; + } + + /** + *

The datetime the course was created.

+ *

The datetime the course was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the course.

+ *

The unique identifier for the course.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LanguageStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The spoken language of the video content, used to generate accurate closed captions. One of: en, es, it, pt, de, fr, pl, ru, nl, ca, tr, sv, uk, no, fi, sk, el, cs, hr, da, ro, bg.

+ *

The spoken language of the video content, used to generate accurate closed captions. One of: en, es, it, pt, de, fr, pl, ru, nl, ca, tr, sv, uk, no, fi, sk, el, cs, hr, da, ro, bg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("language") + public OrderStage language(@NotNull Languages language) { + this.language = Objects.requireNonNull(language, "language must not be null"); + return this; + } + + /** + *

The sort position of this course within its parent experience, as a decimal for flexible ordering.

+ *

The sort position of this course within its parent experience, as a decimal for flexible ordering.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("order") + public RequireCompletingLessonsInOrderStage order(@NotNull String order) { + this.order = Objects.requireNonNull(order, "order must not be null"); + return this; + } + + /** + *

Whether students must complete each lesson sequentially before advancing to the next one.

+ *

Whether students must complete each lesson sequentially before advancing to the next one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("require_completing_lessons_in_order") + public TotalDurationSecondsStage requireCompletingLessonsInOrder(boolean requireCompletingLessonsInOrder) { + this.requireCompletingLessonsInOrder = requireCompletingLessonsInOrder; + return this; + } + + /** + *

The combined duration in seconds of every hosted video across the lessons visible to the current user.

+ *

The combined duration in seconds of every hosted video across the lessons visible to the current user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_duration_seconds") + public TotalLessonsCountStage totalDurationSeconds(int totalDurationSeconds) { + this.totalDurationSeconds = totalDurationSeconds; + return this; + } + + /** + *

The number of lessons in this course visible to the current user.

+ *

The number of lessons in this course visible to the current user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_lessons_count") + public UpdatedAtStage totalLessonsCount(int totalLessonsCount) { + this.totalLessonsCount = totalLessonsCount; + return this; + } + + /** + *

The datetime the course was last updated.

+ *

The datetime the course was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public VisibilityStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The visibility setting that controls whether this course appears to students. One of: visible, hidden.

+ *

The visibility setting that controls whether this course appears to students. One of: visible, hidden.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("visibility") + public _FinalStage visibility(@NotNull CourseVisibilities visibility) { + this.visibility = Objects.requireNonNull(visibility, "visibility must not be null"); + return this; + } + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

The thumbnail image displayed on course cards and previews. Null if no thumbnail has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnail(Nullable thumbnail) { + if (thumbnail.isNull()) { + this.thumbnail = null; + } else if (thumbnail.isEmpty()) { + this.thumbnail = Optional.empty(); + } else { + this.thumbnail = Optional.of(thumbnail.get()); + } + return this; + } + + /** + *

The thumbnail image displayed on course cards and previews. Null if no thumbnail has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnail(CourseListItemThumbnail thumbnail) { + this.thumbnail = Optional.ofNullable(thumbnail); + return this; + } + + /** + *

The thumbnail image displayed on course cards and previews. Null if no thumbnail has been uploaded.

+ */ + @java.lang.Override + @JsonSetter(value = "thumbnail", nulls = Nulls.SKIP) + public _FinalStage thumbnail(Optional thumbnail) { + this.thumbnail = thumbnail; + return this; + } + + /** + *

A short marketing tagline displayed beneath the course title. Null if no tagline has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tagline(Nullable tagline) { + if (tagline.isNull()) { + this.tagline = null; + } else if (tagline.isEmpty()) { + this.tagline = Optional.empty(); + } else { + this.tagline = Optional.of(tagline.get()); + } + return this; + } + + /** + *

A short marketing tagline displayed beneath the course title. Null if no tagline has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tagline(String tagline) { + this.tagline = Optional.ofNullable(tagline); + return this; + } + + /** + *

A short marketing tagline displayed beneath the course title. Null if no tagline has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "tagline", nulls = Nulls.SKIP) + public _FinalStage tagline(Optional tagline) { + this.tagline = tagline; + return this; + } + + /** + *

The earliest time the current user is known to have started this course. Null if they have not started it. Drip unlock schedules are measured from this point.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startedAt(Nullable startedAt) { + if (startedAt.isNull()) { + this.startedAt = null; + } else if (startedAt.isEmpty()) { + this.startedAt = Optional.empty(); + } else { + this.startedAt = Optional.of(startedAt.get()); + } + return this; + } + + /** + *

The earliest time the current user is known to have started this course. Null if they have not started it. Drip unlock schedules are measured from this point.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startedAt(OffsetDateTime startedAt) { + this.startedAt = Optional.ofNullable(startedAt); + return this; + } + + /** + *

The earliest time the current user is known to have started this course. Null if they have not started it. Drip unlock schedules are measured from this point.

+ */ + @java.lang.Override + @JsonSetter(value = "started_at", nulls = Nulls.SKIP) + public _FinalStage startedAt(Optional startedAt) { + this.startedAt = startedAt; + return this; + } + + /** + *

The lesson the current user should continue from: their first incomplete lesson, or the first lesson when they have finished the course, have not started it, or can edit it. Null if the course has no lessons.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resumeLesson(Nullable resumeLesson) { + if (resumeLesson.isNull()) { + this.resumeLesson = null; + } else if (resumeLesson.isEmpty()) { + this.resumeLesson = Optional.empty(); + } else { + this.resumeLesson = Optional.of(resumeLesson.get()); + } + return this; + } + + /** + *

The lesson the current user should continue from: their first incomplete lesson, or the first lesson when they have finished the course, have not started it, or can edit it. Null if the course has no lessons.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resumeLesson(CourseListItemResumeLesson resumeLesson) { + this.resumeLesson = Optional.ofNullable(resumeLesson); + return this; + } + + /** + *

The lesson the current user should continue from: their first incomplete lesson, or the first lesson when they have finished the course, have not started it, or can edit it. Null if the course has no lessons.

+ */ + @java.lang.Override + @JsonSetter(value = "resume_lesson", nulls = Nulls.SKIP) + public _FinalStage resumeLesson(Optional resumeLesson) { + this.resumeLesson = resumeLesson; + return this; + } + + /** + *

The distinct drip schedules, in days after the course start, of lessons visible to the current user. Combine with startedAt to work out which have unlocked. Empty when the user has not started the course or no lesson is on a schedule.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllLessonUnlockDays(List lessonUnlockDays) { + if (lessonUnlockDays != null) { + this.lessonUnlockDays.addAll(lessonUnlockDays); + } + return this; + } + + /** + *

The distinct drip schedules, in days after the course start, of lessons visible to the current user. Combine with startedAt to work out which have unlocked. Empty when the user has not started the course or no lesson is on a schedule.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addLessonUnlockDays(Integer lessonUnlockDays) { + this.lessonUnlockDays.add(lessonUnlockDays); + return this; + } + + /** + *

The distinct drip schedules, in days after the course start, of lessons visible to the current user. Combine with startedAt to work out which have unlocked. Empty when the user has not started the course or no lesson is on a schedule.

+ */ + @java.lang.Override + @JsonSetter(value = "lesson_unlock_days", nulls = Nulls.SKIP) + public _FinalStage lessonUnlockDays(List lessonUnlockDays) { + this.lessonUnlockDays.clear(); + if (lessonUnlockDays != null) { + this.lessonUnlockDays.addAll(lessonUnlockDays); + } + return this; + } + + /** + *

The creation timestamp of the most recently added lesson visible to the current user. Null if the course has no lessons.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage latestLessonCreatedAt(Nullable latestLessonCreatedAt) { + if (latestLessonCreatedAt.isNull()) { + this.latestLessonCreatedAt = null; + } else if (latestLessonCreatedAt.isEmpty()) { + this.latestLessonCreatedAt = Optional.empty(); + } else { + this.latestLessonCreatedAt = Optional.of(latestLessonCreatedAt.get()); + } + return this; + } + + /** + *

The creation timestamp of the most recently added lesson visible to the current user. Null if the course has no lessons.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage latestLessonCreatedAt(OffsetDateTime latestLessonCreatedAt) { + this.latestLessonCreatedAt = Optional.ofNullable(latestLessonCreatedAt); + return this; + } + + /** + *

The creation timestamp of the most recently added lesson visible to the current user. Null if the course has no lessons.

+ */ + @java.lang.Override + @JsonSetter(value = "latest_lesson_created_at", nulls = Nulls.SKIP) + public _FinalStage latestLessonCreatedAt(Optional latestLessonCreatedAt) { + this.latestLessonCreatedAt = latestLessonCreatedAt; + return this; + } + + /** + *

A brief summary of the course content and objectives. Null if no description has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

A brief summary of the course content and objectives. Null if no description has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

A brief summary of the course content and objectives. Null if no description has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

The URL of the course cover image shown on preview cards. Null if no cover image has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage coverImage(Nullable coverImage) { + if (coverImage.isNull()) { + this.coverImage = null; + } else if (coverImage.isEmpty()) { + this.coverImage = Optional.empty(); + } else { + this.coverImage = Optional.of(coverImage.get()); + } + return this; + } + + /** + *

The URL of the course cover image shown on preview cards. Null if no cover image has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage coverImage(String coverImage) { + this.coverImage = Optional.ofNullable(coverImage); + return this; + } + + /** + *

The URL of the course cover image shown on preview cards. Null if no cover image has been uploaded.

+ */ + @java.lang.Override + @JsonSetter(value = "cover_image", nulls = Nulls.SKIP) + public _FinalStage coverImage(Optional coverImage) { + this.coverImage = coverImage; + return this; + } + + /** + *

Whether students receive a PDF certificate after completing all lessons in this course. Null if the setting has not been configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage certificateAfterCompletionEnabled(Nullable certificateAfterCompletionEnabled) { + if (certificateAfterCompletionEnabled.isNull()) { + this.certificateAfterCompletionEnabled = null; + } else if (certificateAfterCompletionEnabled.isEmpty()) { + this.certificateAfterCompletionEnabled = Optional.empty(); + } else { + this.certificateAfterCompletionEnabled = Optional.of(certificateAfterCompletionEnabled.get()); + } + return this; + } + + /** + *

Whether students receive a PDF certificate after completing all lessons in this course. Null if the setting has not been configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage certificateAfterCompletionEnabled(Boolean certificateAfterCompletionEnabled) { + this.certificateAfterCompletionEnabled = Optional.ofNullable(certificateAfterCompletionEnabled); + return this; + } + + /** + *

Whether students receive a PDF certificate after completing all lessons in this course. Null if the setting has not been configured.

+ */ + @java.lang.Override + @JsonSetter(value = "certificate_after_completion_enabled", nulls = Nulls.SKIP) + public _FinalStage certificateAfterCompletionEnabled(Optional certificateAfterCompletionEnabled) { + this.certificateAfterCompletionEnabled = certificateAfterCompletionEnabled; + return this; + } + + @java.lang.Override + public CourseListItem build() { + return new CourseListItem( + certificateAfterCompletionEnabled, + chaptersCount, + completedLessonsCount, + coverImage, + createdAt, + description, + id, + language, + latestLessonCreatedAt, + lessonUnlockDays, + order, + requireCompletingLessonsInOrder, + resumeLesson, + startedAt, + tagline, + thumbnail, + title, + totalDurationSeconds, + totalLessonsCount, + updatedAt, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseListItemResumeLesson.java b/src/main/java/com/whop/api/types/CourseListItemResumeLesson.java new file mode 100644 index 00000000..3c343b36 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseListItemResumeLesson.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseListItemResumeLesson.Builder.class) +public final class CourseListItemResumeLesson { + private final String id; + + private final Map additionalProperties; + + private CourseListItemResumeLesson(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the lesson. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseListItemResumeLesson && equalTo((CourseListItemResumeLesson) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseListItemResumeLesson other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the lesson.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CourseListItemResumeLesson other); + } + + public interface _FinalStage { + CourseListItemResumeLesson build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseListItemResumeLesson other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the lesson.

+ *

The unique identifier for the lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CourseListItemResumeLesson build() { + return new CourseListItemResumeLesson(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseListItemThumbnail.java b/src/main/java/com/whop/api/types/CourseListItemThumbnail.java new file mode 100644 index 00000000..05917faa --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseListItemThumbnail.java @@ -0,0 +1,417 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseListItemThumbnail.Builder.class) +public final class CourseListItemThumbnail { + private final Optional contentType; + + private final Optional filename; + + private final String id; + + private final Optional optimizedUrl; + + private final Optional sourceUrl; + + private final Map additionalProperties; + + private CourseListItemThumbnail( + Optional contentType, + Optional filename, + String id, + Optional optimizedUrl, + Optional sourceUrl, + Map additionalProperties) { + this.contentType = contentType; + this.filename = filename; + this.id = id; + this.optimizedUrl = optimizedUrl; + this.sourceUrl = sourceUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg. + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return The original filename of the uploaded attachment, including its file extension. + */ + @JsonIgnore + public Optional getFilename() { + if (filename == null) { + return Optional.empty(); + } + return filename; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getOptimizedUrl() { + if (optimizedUrl == null) { + return Optional.empty(); + } + return optimizedUrl; + } + + /** + * @return The original source URL of the attachment, such as a direct link to S3. This should never be displayed on the client and should always be passed through an Imgproxy transformer. + */ + @JsonIgnore + public Optional getSourceUrl() { + if (sourceUrl == null) { + return Optional.empty(); + } + return sourceUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filename") + private Optional _getFilename() { + return filename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("optimized_url") + private Optional _getOptimizedUrl() { + return optimizedUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source_url") + private Optional _getSourceUrl() { + return sourceUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseListItemThumbnail && equalTo((CourseListItemThumbnail) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseListItemThumbnail other) { + return contentType.equals(other.contentType) + && filename.equals(other.filename) + && id.equals(other.id) + && optimizedUrl.equals(other.optimizedUrl) + && sourceUrl.equals(other.sourceUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contentType, this.filename, this.id, this.optimizedUrl, this.sourceUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CourseListItemThumbnail other); + } + + public interface _FinalStage { + CourseListItemThumbnail build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + _FinalStage filename(Optional filename); + + _FinalStage filename(String filename); + + _FinalStage filename(Nullable filename); + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + _FinalStage optimizedUrl(Optional optimizedUrl); + + _FinalStage optimizedUrl(String optimizedUrl); + + _FinalStage optimizedUrl(Nullable optimizedUrl); + + /** + *

The original source URL of the attachment, such as a direct link to S3. This should never be displayed on the client and should always be passed through an Imgproxy transformer.

+ */ + _FinalStage sourceUrl(Optional sourceUrl); + + _FinalStage sourceUrl(String sourceUrl); + + _FinalStage sourceUrl(Nullable sourceUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional sourceUrl = Optional.empty(); + + private Optional optimizedUrl = Optional.empty(); + + private Optional filename = Optional.empty(); + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseListItemThumbnail other) { + contentType(other.getContentType()); + filename(other.getFilename()); + id(other.getId()); + optimizedUrl(other.getOptimizedUrl()); + sourceUrl(other.getSourceUrl()); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The original source URL of the attachment, such as a direct link to S3. This should never be displayed on the client and should always be passed through an Imgproxy transformer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sourceUrl(Nullable sourceUrl) { + if (sourceUrl.isNull()) { + this.sourceUrl = null; + } else if (sourceUrl.isEmpty()) { + this.sourceUrl = Optional.empty(); + } else { + this.sourceUrl = Optional.of(sourceUrl.get()); + } + return this; + } + + /** + *

The original source URL of the attachment, such as a direct link to S3. This should never be displayed on the client and should always be passed through an Imgproxy transformer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sourceUrl(String sourceUrl) { + this.sourceUrl = Optional.ofNullable(sourceUrl); + return this; + } + + /** + *

The original source URL of the attachment, such as a direct link to S3. This should never be displayed on the client and should always be passed through an Imgproxy transformer.

+ */ + @java.lang.Override + @JsonSetter(value = "source_url", nulls = Nulls.SKIP) + public _FinalStage sourceUrl(Optional sourceUrl) { + this.sourceUrl = sourceUrl; + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optimizedUrl(Nullable optimizedUrl) { + if (optimizedUrl.isNull()) { + this.optimizedUrl = null; + } else if (optimizedUrl.isEmpty()) { + this.optimizedUrl = Optional.empty(); + } else { + this.optimizedUrl = Optional.of(optimizedUrl.get()); + } + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optimizedUrl(String optimizedUrl) { + this.optimizedUrl = Optional.ofNullable(optimizedUrl); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @java.lang.Override + @JsonSetter(value = "optimized_url", nulls = Nulls.SKIP) + public _FinalStage optimizedUrl(Optional optimizedUrl) { + this.optimizedUrl = optimizedUrl; + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(Nullable filename) { + if (filename.isNull()) { + this.filename = null; + } else if (filename.isEmpty()) { + this.filename = Optional.empty(); + } else { + this.filename = Optional.of(filename.get()); + } + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(String filename) { + this.filename = Optional.ofNullable(filename); + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + @java.lang.Override + @JsonSetter(value = "filename", nulls = Nulls.SKIP) + public _FinalStage filename(Optional filename) { + this.filename = filename; + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public CourseListItemThumbnail build() { + return new CourseListItemThumbnail( + contentType, filename, id, optimizedUrl, sourceUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseResumeLesson.java b/src/main/java/com/whop/api/types/CourseResumeLesson.java new file mode 100644 index 00000000..cc7076da --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseResumeLesson.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseResumeLesson.Builder.class) +public final class CourseResumeLesson { + private final String id; + + private final Map additionalProperties; + + private CourseResumeLesson(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the lesson. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseResumeLesson && equalTo((CourseResumeLesson) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseResumeLesson other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the lesson.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CourseResumeLesson other); + } + + public interface _FinalStage { + CourseResumeLesson build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseResumeLesson other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the lesson.

+ *

The unique identifier for the lesson.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CourseResumeLesson build() { + return new CourseResumeLesson(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseStudent.java b/src/main/java/com/whop/api/types/CourseStudent.java new file mode 100644 index 00000000..9eb962a3 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseStudent.java @@ -0,0 +1,403 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseStudent.Builder.class) +public final class CourseStudent { + private final int completedLessonsCount; + + private final double completionRate; + + private final CourseStudentCourse course; + + private final OffsetDateTime firstInteractionAt; + + private final String id; + + private final OffsetDateTime lastInteractionAt; + + private final int totalLessonsCount; + + private final CourseStudentUser user; + + private final Map additionalProperties; + + private CourseStudent( + int completedLessonsCount, + double completionRate, + CourseStudentCourse course, + OffsetDateTime firstInteractionAt, + String id, + OffsetDateTime lastInteractionAt, + int totalLessonsCount, + CourseStudentUser user, + Map additionalProperties) { + this.completedLessonsCount = completedLessonsCount; + this.completionRate = completionRate; + this.course = course; + this.firstInteractionAt = firstInteractionAt; + this.id = id; + this.lastInteractionAt = lastInteractionAt; + this.totalLessonsCount = totalLessonsCount; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The total number of lessons this student has marked as completed in the course. + */ + @JsonProperty("completed_lessons_count") + public int getCompletedLessonsCount() { + return completedLessonsCount; + } + + /** + * @return The percentage of available lessons the student has completed, as a value from 0 to 100 rounded to two decimal places. + */ + @JsonProperty("completion_rate") + public double getCompletionRate() { + return completionRate; + } + + /** + * @return The course this student is enrolled in. + */ + @JsonProperty("course") + public CourseStudentCourse getCourse() { + return course; + } + + /** + * @return The timestamp when the student first interacted with this course, as a Unix timestamp. + */ + @JsonProperty("first_interaction_at") + public OffsetDateTime getFirstInteractionAt() { + return firstInteractionAt; + } + + /** + * @return The unique identifier for the course student type. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The timestamp when the student most recently interacted with this course, as a Unix timestamp. + */ + @JsonProperty("last_interaction_at") + public OffsetDateTime getLastInteractionAt() { + return lastInteractionAt; + } + + /** + * @return The total number of visible lessons available to this student in the course. + */ + @JsonProperty("total_lessons_count") + public int getTotalLessonsCount() { + return totalLessonsCount; + } + + /** + * @return The user profile of the enrolled student. + */ + @JsonProperty("user") + public CourseStudentUser getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseStudent && equalTo((CourseStudent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseStudent other) { + return completedLessonsCount == other.completedLessonsCount + && completionRate == other.completionRate + && course.equals(other.course) + && firstInteractionAt.equals(other.firstInteractionAt) + && id.equals(other.id) + && lastInteractionAt.equals(other.lastInteractionAt) + && totalLessonsCount == other.totalLessonsCount + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.completedLessonsCount, + this.completionRate, + this.course, + this.firstInteractionAt, + this.id, + this.lastInteractionAt, + this.totalLessonsCount, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompletedLessonsCountStage builder() { + return new Builder(); + } + + public interface CompletedLessonsCountStage { + /** + *

The total number of lessons this student has marked as completed in the course.

+ */ + CompletionRateStage completedLessonsCount(int completedLessonsCount); + + Builder from(CourseStudent other); + } + + public interface CompletionRateStage { + /** + *

The percentage of available lessons the student has completed, as a value from 0 to 100 rounded to two decimal places.

+ */ + CourseStage completionRate(double completionRate); + } + + public interface CourseStage { + /** + *

The course this student is enrolled in.

+ */ + FirstInteractionAtStage course(@NotNull CourseStudentCourse course); + } + + public interface FirstInteractionAtStage { + /** + *

The timestamp when the student first interacted with this course, as a Unix timestamp.

+ */ + IdStage firstInteractionAt(@NotNull OffsetDateTime firstInteractionAt); + } + + public interface IdStage { + /** + *

The unique identifier for the course student type.

+ */ + LastInteractionAtStage id(@NotNull String id); + } + + public interface LastInteractionAtStage { + /** + *

The timestamp when the student most recently interacted with this course, as a Unix timestamp.

+ */ + TotalLessonsCountStage lastInteractionAt(@NotNull OffsetDateTime lastInteractionAt); + } + + public interface TotalLessonsCountStage { + /** + *

The total number of visible lessons available to this student in the course.

+ */ + UserStage totalLessonsCount(int totalLessonsCount); + } + + public interface UserStage { + /** + *

The user profile of the enrolled student.

+ */ + _FinalStage user(@NotNull CourseStudentUser user); + } + + public interface _FinalStage { + CourseStudent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CompletedLessonsCountStage, + CompletionRateStage, + CourseStage, + FirstInteractionAtStage, + IdStage, + LastInteractionAtStage, + TotalLessonsCountStage, + UserStage, + _FinalStage { + private int completedLessonsCount; + + private double completionRate; + + private CourseStudentCourse course; + + private OffsetDateTime firstInteractionAt; + + private String id; + + private OffsetDateTime lastInteractionAt; + + private int totalLessonsCount; + + private CourseStudentUser user; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseStudent other) { + completedLessonsCount(other.getCompletedLessonsCount()); + completionRate(other.getCompletionRate()); + course(other.getCourse()); + firstInteractionAt(other.getFirstInteractionAt()); + id(other.getId()); + lastInteractionAt(other.getLastInteractionAt()); + totalLessonsCount(other.getTotalLessonsCount()); + user(other.getUser()); + return this; + } + + /** + *

The total number of lessons this student has marked as completed in the course.

+ *

The total number of lessons this student has marked as completed in the course.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completed_lessons_count") + public CompletionRateStage completedLessonsCount(int completedLessonsCount) { + this.completedLessonsCount = completedLessonsCount; + return this; + } + + /** + *

The percentage of available lessons the student has completed, as a value from 0 to 100 rounded to two decimal places.

+ *

The percentage of available lessons the student has completed, as a value from 0 to 100 rounded to two decimal places.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completion_rate") + public CourseStage completionRate(double completionRate) { + this.completionRate = completionRate; + return this; + } + + /** + *

The course this student is enrolled in.

+ *

The course this student is enrolled in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("course") + public FirstInteractionAtStage course(@NotNull CourseStudentCourse course) { + this.course = Objects.requireNonNull(course, "course must not be null"); + return this; + } + + /** + *

The timestamp when the student first interacted with this course, as a Unix timestamp.

+ *

The timestamp when the student first interacted with this course, as a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("first_interaction_at") + public IdStage firstInteractionAt(@NotNull OffsetDateTime firstInteractionAt) { + this.firstInteractionAt = Objects.requireNonNull(firstInteractionAt, "firstInteractionAt must not be null"); + return this; + } + + /** + *

The unique identifier for the course student type.

+ *

The unique identifier for the course student type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LastInteractionAtStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp when the student most recently interacted with this course, as a Unix timestamp.

+ *

The timestamp when the student most recently interacted with this course, as a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("last_interaction_at") + public TotalLessonsCountStage lastInteractionAt(@NotNull OffsetDateTime lastInteractionAt) { + this.lastInteractionAt = Objects.requireNonNull(lastInteractionAt, "lastInteractionAt must not be null"); + return this; + } + + /** + *

The total number of visible lessons available to this student in the course.

+ *

The total number of visible lessons available to this student in the course.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_lessons_count") + public UserStage totalLessonsCount(int totalLessonsCount) { + this.totalLessonsCount = totalLessonsCount; + return this; + } + + /** + *

The user profile of the enrolled student.

+ *

The user profile of the enrolled student.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull CourseStudentUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + @java.lang.Override + public CourseStudent build() { + return new CourseStudent( + completedLessonsCount, + completionRate, + course, + firstInteractionAt, + id, + lastInteractionAt, + totalLessonsCount, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseStudentCourse.java b/src/main/java/com/whop/api/types/CourseStudentCourse.java new file mode 100644 index 00000000..9fda0664 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseStudentCourse.java @@ -0,0 +1,239 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseStudentCourse.Builder.class) +public final class CourseStudentCourse { + private final CourseStudentCourseExperience experience; + + private final String id; + + private final Optional title; + + private final Map additionalProperties; + + private CourseStudentCourse( + CourseStudentCourseExperience experience, + String id, + Optional title, + Map additionalProperties) { + this.experience = experience; + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The parent experience that this course belongs to. + */ + @JsonProperty("experience") + public CourseStudentCourseExperience getExperience() { + return experience; + } + + /** + * @return The unique identifier for the course. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the course shown to students. Null if no title has been set. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseStudentCourse && equalTo((CourseStudentCourse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseStudentCourse other) { + return experience.equals(other.experience) && id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.experience, this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExperienceStage builder() { + return new Builder(); + } + + public interface ExperienceStage { + /** + *

The parent experience that this course belongs to.

+ */ + IdStage experience(@NotNull CourseStudentCourseExperience experience); + + Builder from(CourseStudentCourse other); + } + + public interface IdStage { + /** + *

The unique identifier for the course.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + CourseStudentCourse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExperienceStage, IdStage, _FinalStage { + private CourseStudentCourseExperience experience; + + private String id; + + private Optional title = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseStudentCourse other) { + experience(other.getExperience()); + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The parent experience that this course belongs to.

+ *

The parent experience that this course belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("experience") + public IdStage experience(@NotNull CourseStudentCourseExperience experience) { + this.experience = Objects.requireNonNull(experience, "experience must not be null"); + return this; + } + + /** + *

The unique identifier for the course.

+ *

The unique identifier for the course.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The display name of the course shown to students. Null if no title has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + @java.lang.Override + public CourseStudentCourse build() { + return new CourseStudentCourse(experience, id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseStudentCourseExperience.java b/src/main/java/com/whop/api/types/CourseStudentCourseExperience.java new file mode 100644 index 00000000..63d98824 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseStudentCourseExperience.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseStudentCourseExperience.Builder.class) +public final class CourseStudentCourseExperience { + private final String id; + + private final Map additionalProperties; + + private CourseStudentCourseExperience(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the experience. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseStudentCourseExperience && equalTo((CourseStudentCourseExperience) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseStudentCourseExperience other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the experience.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CourseStudentCourseExperience other); + } + + public interface _FinalStage { + CourseStudentCourseExperience build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseStudentCourseExperience other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the experience.

+ *

The unique identifier for the experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public CourseStudentCourseExperience build() { + return new CourseStudentCourseExperience(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseStudentListItem.java b/src/main/java/com/whop/api/types/CourseStudentListItem.java new file mode 100644 index 00000000..3e5c1fdd --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseStudentListItem.java @@ -0,0 +1,365 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseStudentListItem.Builder.class) +public final class CourseStudentListItem { + private final int completedLessonsCount; + + private final double completionRate; + + private final OffsetDateTime firstInteractionAt; + + private final String id; + + private final OffsetDateTime lastInteractionAt; + + private final int totalLessonsCount; + + private final CourseStudentListItemUser user; + + private final Map additionalProperties; + + private CourseStudentListItem( + int completedLessonsCount, + double completionRate, + OffsetDateTime firstInteractionAt, + String id, + OffsetDateTime lastInteractionAt, + int totalLessonsCount, + CourseStudentListItemUser user, + Map additionalProperties) { + this.completedLessonsCount = completedLessonsCount; + this.completionRate = completionRate; + this.firstInteractionAt = firstInteractionAt; + this.id = id; + this.lastInteractionAt = lastInteractionAt; + this.totalLessonsCount = totalLessonsCount; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The total number of lessons this student has marked as completed in the course. + */ + @JsonProperty("completed_lessons_count") + public int getCompletedLessonsCount() { + return completedLessonsCount; + } + + /** + * @return The percentage of available lessons the student has completed, as a value from 0 to 100 rounded to two decimal places. + */ + @JsonProperty("completion_rate") + public double getCompletionRate() { + return completionRate; + } + + /** + * @return The timestamp when the student first interacted with this course, as a Unix timestamp. + */ + @JsonProperty("first_interaction_at") + public OffsetDateTime getFirstInteractionAt() { + return firstInteractionAt; + } + + /** + * @return The unique identifier for the course student type. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The timestamp when the student most recently interacted with this course, as a Unix timestamp. + */ + @JsonProperty("last_interaction_at") + public OffsetDateTime getLastInteractionAt() { + return lastInteractionAt; + } + + /** + * @return The total number of visible lessons available to this student in the course. + */ + @JsonProperty("total_lessons_count") + public int getTotalLessonsCount() { + return totalLessonsCount; + } + + /** + * @return The user profile of the enrolled student. + */ + @JsonProperty("user") + public CourseStudentListItemUser getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseStudentListItem && equalTo((CourseStudentListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseStudentListItem other) { + return completedLessonsCount == other.completedLessonsCount + && completionRate == other.completionRate + && firstInteractionAt.equals(other.firstInteractionAt) + && id.equals(other.id) + && lastInteractionAt.equals(other.lastInteractionAt) + && totalLessonsCount == other.totalLessonsCount + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.completedLessonsCount, + this.completionRate, + this.firstInteractionAt, + this.id, + this.lastInteractionAt, + this.totalLessonsCount, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompletedLessonsCountStage builder() { + return new Builder(); + } + + public interface CompletedLessonsCountStage { + /** + *

The total number of lessons this student has marked as completed in the course.

+ */ + CompletionRateStage completedLessonsCount(int completedLessonsCount); + + Builder from(CourseStudentListItem other); + } + + public interface CompletionRateStage { + /** + *

The percentage of available lessons the student has completed, as a value from 0 to 100 rounded to two decimal places.

+ */ + FirstInteractionAtStage completionRate(double completionRate); + } + + public interface FirstInteractionAtStage { + /** + *

The timestamp when the student first interacted with this course, as a Unix timestamp.

+ */ + IdStage firstInteractionAt(@NotNull OffsetDateTime firstInteractionAt); + } + + public interface IdStage { + /** + *

The unique identifier for the course student type.

+ */ + LastInteractionAtStage id(@NotNull String id); + } + + public interface LastInteractionAtStage { + /** + *

The timestamp when the student most recently interacted with this course, as a Unix timestamp.

+ */ + TotalLessonsCountStage lastInteractionAt(@NotNull OffsetDateTime lastInteractionAt); + } + + public interface TotalLessonsCountStage { + /** + *

The total number of visible lessons available to this student in the course.

+ */ + UserStage totalLessonsCount(int totalLessonsCount); + } + + public interface UserStage { + /** + *

The user profile of the enrolled student.

+ */ + _FinalStage user(@NotNull CourseStudentListItemUser user); + } + + public interface _FinalStage { + CourseStudentListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CompletedLessonsCountStage, + CompletionRateStage, + FirstInteractionAtStage, + IdStage, + LastInteractionAtStage, + TotalLessonsCountStage, + UserStage, + _FinalStage { + private int completedLessonsCount; + + private double completionRate; + + private OffsetDateTime firstInteractionAt; + + private String id; + + private OffsetDateTime lastInteractionAt; + + private int totalLessonsCount; + + private CourseStudentListItemUser user; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseStudentListItem other) { + completedLessonsCount(other.getCompletedLessonsCount()); + completionRate(other.getCompletionRate()); + firstInteractionAt(other.getFirstInteractionAt()); + id(other.getId()); + lastInteractionAt(other.getLastInteractionAt()); + totalLessonsCount(other.getTotalLessonsCount()); + user(other.getUser()); + return this; + } + + /** + *

The total number of lessons this student has marked as completed in the course.

+ *

The total number of lessons this student has marked as completed in the course.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completed_lessons_count") + public CompletionRateStage completedLessonsCount(int completedLessonsCount) { + this.completedLessonsCount = completedLessonsCount; + return this; + } + + /** + *

The percentage of available lessons the student has completed, as a value from 0 to 100 rounded to two decimal places.

+ *

The percentage of available lessons the student has completed, as a value from 0 to 100 rounded to two decimal places.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completion_rate") + public FirstInteractionAtStage completionRate(double completionRate) { + this.completionRate = completionRate; + return this; + } + + /** + *

The timestamp when the student first interacted with this course, as a Unix timestamp.

+ *

The timestamp when the student first interacted with this course, as a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("first_interaction_at") + public IdStage firstInteractionAt(@NotNull OffsetDateTime firstInteractionAt) { + this.firstInteractionAt = Objects.requireNonNull(firstInteractionAt, "firstInteractionAt must not be null"); + return this; + } + + /** + *

The unique identifier for the course student type.

+ *

The unique identifier for the course student type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LastInteractionAtStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp when the student most recently interacted with this course, as a Unix timestamp.

+ *

The timestamp when the student most recently interacted with this course, as a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("last_interaction_at") + public TotalLessonsCountStage lastInteractionAt(@NotNull OffsetDateTime lastInteractionAt) { + this.lastInteractionAt = Objects.requireNonNull(lastInteractionAt, "lastInteractionAt must not be null"); + return this; + } + + /** + *

The total number of visible lessons available to this student in the course.

+ *

The total number of visible lessons available to this student in the course.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_lessons_count") + public UserStage totalLessonsCount(int totalLessonsCount) { + this.totalLessonsCount = totalLessonsCount; + return this; + } + + /** + *

The user profile of the enrolled student.

+ *

The user profile of the enrolled student.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull CourseStudentListItemUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + @java.lang.Override + public CourseStudentListItem build() { + return new CourseStudentListItem( + completedLessonsCount, + completionRate, + firstInteractionAt, + id, + lastInteractionAt, + totalLessonsCount, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseStudentListItemUser.java b/src/main/java/com/whop/api/types/CourseStudentListItemUser.java new file mode 100644 index 00000000..6efc26e8 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseStudentListItemUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseStudentListItemUser.Builder.class) +public final class CourseStudentListItemUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private CourseStudentListItemUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseStudentListItemUser && equalTo((CourseStudentListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseStudentListItemUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(CourseStudentListItemUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + CourseStudentListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseStudentListItemUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public CourseStudentListItemUser build() { + return new CourseStudentListItemUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseStudentUser.java b/src/main/java/com/whop/api/types/CourseStudentUser.java new file mode 100644 index 00000000..84c98313 --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseStudentUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseStudentUser.Builder.class) +public final class CourseStudentUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private CourseStudentUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseStudentUser && equalTo((CourseStudentUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseStudentUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(CourseStudentUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + CourseStudentUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseStudentUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public CourseStudentUser build() { + return new CourseStudentUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseThumbnail.java b/src/main/java/com/whop/api/types/CourseThumbnail.java new file mode 100644 index 00000000..b121ef7b --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseThumbnail.java @@ -0,0 +1,416 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CourseThumbnail.Builder.class) +public final class CourseThumbnail { + private final Optional contentType; + + private final Optional filename; + + private final String id; + + private final Optional optimizedUrl; + + private final Optional sourceUrl; + + private final Map additionalProperties; + + private CourseThumbnail( + Optional contentType, + Optional filename, + String id, + Optional optimizedUrl, + Optional sourceUrl, + Map additionalProperties) { + this.contentType = contentType; + this.filename = filename; + this.id = id; + this.optimizedUrl = optimizedUrl; + this.sourceUrl = sourceUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg. + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return The original filename of the uploaded attachment, including its file extension. + */ + @JsonIgnore + public Optional getFilename() { + if (filename == null) { + return Optional.empty(); + } + return filename; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getOptimizedUrl() { + if (optimizedUrl == null) { + return Optional.empty(); + } + return optimizedUrl; + } + + /** + * @return The original source URL of the attachment, such as a direct link to S3. This should never be displayed on the client and should always be passed through an Imgproxy transformer. + */ + @JsonIgnore + public Optional getSourceUrl() { + if (sourceUrl == null) { + return Optional.empty(); + } + return sourceUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filename") + private Optional _getFilename() { + return filename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("optimized_url") + private Optional _getOptimizedUrl() { + return optimizedUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source_url") + private Optional _getSourceUrl() { + return sourceUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CourseThumbnail && equalTo((CourseThumbnail) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CourseThumbnail other) { + return contentType.equals(other.contentType) + && filename.equals(other.filename) + && id.equals(other.id) + && optimizedUrl.equals(other.optimizedUrl) + && sourceUrl.equals(other.sourceUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contentType, this.filename, this.id, this.optimizedUrl, this.sourceUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(CourseThumbnail other); + } + + public interface _FinalStage { + CourseThumbnail build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + _FinalStage filename(Optional filename); + + _FinalStage filename(String filename); + + _FinalStage filename(Nullable filename); + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + _FinalStage optimizedUrl(Optional optimizedUrl); + + _FinalStage optimizedUrl(String optimizedUrl); + + _FinalStage optimizedUrl(Nullable optimizedUrl); + + /** + *

The original source URL of the attachment, such as a direct link to S3. This should never be displayed on the client and should always be passed through an Imgproxy transformer.

+ */ + _FinalStage sourceUrl(Optional sourceUrl); + + _FinalStage sourceUrl(String sourceUrl); + + _FinalStage sourceUrl(Nullable sourceUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional sourceUrl = Optional.empty(); + + private Optional optimizedUrl = Optional.empty(); + + private Optional filename = Optional.empty(); + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CourseThumbnail other) { + contentType(other.getContentType()); + filename(other.getFilename()); + id(other.getId()); + optimizedUrl(other.getOptimizedUrl()); + sourceUrl(other.getSourceUrl()); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The original source URL of the attachment, such as a direct link to S3. This should never be displayed on the client and should always be passed through an Imgproxy transformer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sourceUrl(Nullable sourceUrl) { + if (sourceUrl.isNull()) { + this.sourceUrl = null; + } else if (sourceUrl.isEmpty()) { + this.sourceUrl = Optional.empty(); + } else { + this.sourceUrl = Optional.of(sourceUrl.get()); + } + return this; + } + + /** + *

The original source URL of the attachment, such as a direct link to S3. This should never be displayed on the client and should always be passed through an Imgproxy transformer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sourceUrl(String sourceUrl) { + this.sourceUrl = Optional.ofNullable(sourceUrl); + return this; + } + + /** + *

The original source URL of the attachment, such as a direct link to S3. This should never be displayed on the client and should always be passed through an Imgproxy transformer.

+ */ + @java.lang.Override + @JsonSetter(value = "source_url", nulls = Nulls.SKIP) + public _FinalStage sourceUrl(Optional sourceUrl) { + this.sourceUrl = sourceUrl; + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optimizedUrl(Nullable optimizedUrl) { + if (optimizedUrl.isNull()) { + this.optimizedUrl = null; + } else if (optimizedUrl.isEmpty()) { + this.optimizedUrl = Optional.empty(); + } else { + this.optimizedUrl = Optional.of(optimizedUrl.get()); + } + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optimizedUrl(String optimizedUrl) { + this.optimizedUrl = Optional.ofNullable(optimizedUrl); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @java.lang.Override + @JsonSetter(value = "optimized_url", nulls = Nulls.SKIP) + public _FinalStage optimizedUrl(Optional optimizedUrl) { + this.optimizedUrl = optimizedUrl; + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(Nullable filename) { + if (filename.isNull()) { + this.filename = null; + } else if (filename.isEmpty()) { + this.filename = Optional.empty(); + } else { + this.filename = Optional.of(filename.get()); + } + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(String filename) { + this.filename = Optional.ofNullable(filename); + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + @java.lang.Override + @JsonSetter(value = "filename", nulls = Nulls.SKIP) + public _FinalStage filename(Optional filename) { + this.filename = filename; + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public CourseThumbnail build() { + return new CourseThumbnail(contentType, filename, id, optimizedUrl, sourceUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/CourseVisibilities.java b/src/main/java/com/whop/api/types/CourseVisibilities.java new file mode 100644 index 00000000..59cf240c --- /dev/null +++ b/src/main/java/com/whop/api/types/CourseVisibilities.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CourseVisibilities { + public static final CourseVisibilities VISIBLE = new CourseVisibilities(Value.VISIBLE, "visible"); + + public static final CourseVisibilities HIDDEN = new CourseVisibilities(Value.HIDDEN, "hidden"); + + private final Value value; + + private final String string; + + CourseVisibilities(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CourseVisibilities && this.string.equals(((CourseVisibilities) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VISIBLE: + return visitor.visitVisible(); + case HIDDEN: + return visitor.visitHidden(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CourseVisibilities valueOf(String value) { + switch (value) { + case "visible": + return VISIBLE; + case "hidden": + return HIDDEN; + default: + return new CourseVisibilities(Value.UNKNOWN, value); + } + } + + public enum Value { + VISIBLE, + + HIDDEN, + + UNKNOWN + } + + public interface Visitor { + T visitVisible(); + + T visitHidden(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CoursesAssessmentQuestionTypes.java b/src/main/java/com/whop/api/types/CoursesAssessmentQuestionTypes.java new file mode 100644 index 00000000..4ec34757 --- /dev/null +++ b/src/main/java/com/whop/api/types/CoursesAssessmentQuestionTypes.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CoursesAssessmentQuestionTypes { + public static final CoursesAssessmentQuestionTypes TRUE_FALSE = + new CoursesAssessmentQuestionTypes(Value.TRUE_FALSE, "true_false"); + + public static final CoursesAssessmentQuestionTypes MULTIPLE_SELECT = + new CoursesAssessmentQuestionTypes(Value.MULTIPLE_SELECT, "multiple_select"); + + public static final CoursesAssessmentQuestionTypes SHORT_ANSWER = + new CoursesAssessmentQuestionTypes(Value.SHORT_ANSWER, "short_answer"); + + public static final CoursesAssessmentQuestionTypes MULTIPLE_CHOICE = + new CoursesAssessmentQuestionTypes(Value.MULTIPLE_CHOICE, "multiple_choice"); + + private final Value value; + + private final String string; + + CoursesAssessmentQuestionTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CoursesAssessmentQuestionTypes + && this.string.equals(((CoursesAssessmentQuestionTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TRUE_FALSE: + return visitor.visitTrueFalse(); + case MULTIPLE_SELECT: + return visitor.visitMultipleSelect(); + case SHORT_ANSWER: + return visitor.visitShortAnswer(); + case MULTIPLE_CHOICE: + return visitor.visitMultipleChoice(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CoursesAssessmentQuestionTypes valueOf(String value) { + switch (value) { + case "true_false": + return TRUE_FALSE; + case "multiple_select": + return MULTIPLE_SELECT; + case "short_answer": + return SHORT_ANSWER; + case "multiple_choice": + return MULTIPLE_CHOICE; + default: + return new CoursesAssessmentQuestionTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + SHORT_ANSWER, + + TRUE_FALSE, + + MULTIPLE_CHOICE, + + MULTIPLE_SELECT, + + UNKNOWN + } + + public interface Visitor { + T visitShortAnswer(); + + T visitTrueFalse(); + + T visitMultipleChoice(); + + T visitMultipleSelect(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Currencies.java b/src/main/java/com/whop/api/types/Currencies.java new file mode 100644 index 00000000..f2e48690 --- /dev/null +++ b/src/main/java/com/whop/api/types/Currencies.java @@ -0,0 +1,962 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class Currencies { + public static final Currencies CRC = new Currencies(Value.CRC, "crc"); + + public static final Currencies OMR = new Currencies(Value.OMR, "omr"); + + public static final Currencies RUB = new Currencies(Value.RUB, "rub"); + + public static final Currencies BGN = new Currencies(Value.BGN, "bgn"); + + public static final Currencies SAR = new Currencies(Value.SAR, "sar"); + + public static final Currencies UYU = new Currencies(Value.UYU, "uyu"); + + public static final Currencies TZS = new Currencies(Value.TZS, "tzs"); + + public static final Currencies XCD = new Currencies(Value.XCD, "xcd"); + + public static final Currencies GTQ = new Currencies(Value.GTQ, "gtq"); + + public static final Currencies CHF = new Currencies(Value.CHF, "chf"); + + public static final Currencies RON = new Currencies(Value.RON, "ron"); + + public static final Currencies PHP = new Currencies(Value.PHP, "php"); + + public static final Currencies KES = new Currencies(Value.KES, "kes"); + + public static final Currencies XAU = new Currencies(Value.XAU, "xau"); + + public static final Currencies BSD = new Currencies(Value.BSD, "bsd"); + + public static final Currencies INR = new Currencies(Value.INR, "inr"); + + public static final Currencies HKD = new Currencies(Value.HKD, "hkd"); + + public static final Currencies JOD = new Currencies(Value.JOD, "jod"); + + public static final Currencies MKD = new Currencies(Value.MKD, "mkd"); + + public static final Currencies CLP = new Currencies(Value.CLP, "clp"); + + public static final Currencies NZD = new Currencies(Value.NZD, "nzd"); + + public static final Currencies IDR = new Currencies(Value.IDR, "idr"); + + public static final Currencies MOP = new Currencies(Value.MOP, "mop"); + + public static final Currencies HUF = new Currencies(Value.HUF, "huf"); + + public static final Currencies MAD = new Currencies(Value.MAD, "mad"); + + public static final Currencies KHR = new Currencies(Value.KHR, "khr"); + + public static final Currencies NGN = new Currencies(Value.NGN, "ngn"); + + public static final Currencies THB = new Currencies(Value.THB, "thb"); + + public static final Currencies DZD = new Currencies(Value.DZD, "dzd"); + + public static final Currencies ARS = new Currencies(Value.ARS, "ars"); + + public static final Currencies CAD = new Currencies(Value.CAD, "cad"); + + public static final Currencies MYR = new Currencies(Value.MYR, "myr"); + + public static final Currencies KRW = new Currencies(Value.KRW, "krw"); + + public static final Currencies KZT = new Currencies(Value.KZT, "kzt"); + + public static final Currencies ETH = new Currencies(Value.ETH, "eth"); + + public static final Currencies COP = new Currencies(Value.COP, "cop"); + + public static final Currencies JMD = new Currencies(Value.JMD, "jmd"); + + public static final Currencies NAD = new Currencies(Value.NAD, "nad"); + + public static final Currencies GYD = new Currencies(Value.GYD, "gyd"); + + public static final Currencies KWD = new Currencies(Value.KWD, "kwd"); + + public static final Currencies DOP = new Currencies(Value.DOP, "dop"); + + public static final Currencies BTC = new Currencies(Value.BTC, "btc"); + + public static final Currencies AMD = new Currencies(Value.AMD, "amd"); + + public static final Currencies LKR = new Currencies(Value.LKR, "lkr"); + + public static final Currencies ALL = new Currencies(Value.ALL, "all"); + + public static final Currencies USDT = new Currencies(Value.USDT, "usdt"); + + public static final Currencies TND = new Currencies(Value.TND, "tnd"); + + public static final Currencies MUR = new Currencies(Value.MUR, "mur"); + + public static final Currencies PEN = new Currencies(Value.PEN, "pen"); + + public static final Currencies USD = new Currencies(Value.USD, "usd"); + + public static final Currencies APE = new Currencies(Value.APE, "ape"); + + public static final Currencies BHD = new Currencies(Value.BHD, "bhd"); + + public static final Currencies XOF = new Currencies(Value.XOF, "xof"); + + public static final Currencies RWF = new Currencies(Value.RWF, "rwf"); + + public static final Currencies GBP = new Currencies(Value.GBP, "gbp"); + + public static final Currencies VND = new Currencies(Value.VND, "vnd"); + + public static final Currencies MNT = new Currencies(Value.MNT, "mnt"); + + public static final Currencies ETB = new Currencies(Value.ETB, "etb"); + + public static final Currencies TTD = new Currencies(Value.TTD, "ttd"); + + public static final Currencies EUR = new Currencies(Value.EUR, "eur"); + + public static final Currencies BRL = new Currencies(Value.BRL, "brl"); + + public static final Currencies SEK = new Currencies(Value.SEK, "sek"); + + public static final Currencies RSD = new Currencies(Value.RSD, "rsd"); + + public static final Currencies UZS = new Currencies(Value.UZS, "uzs"); + + public static final Currencies TWD = new Currencies(Value.TWD, "twd"); + + public static final Currencies NOK = new Currencies(Value.NOK, "nok"); + + public static final Currencies WHOP_USD = new Currencies(Value.WHOP_USD, "whop_usd"); + + public static final Currencies PYG = new Currencies(Value.PYG, "pyg"); + + public static final Currencies TRY = new Currencies(Value.TRY, "try"); + + public static final Currencies ZAR = new Currencies(Value.ZAR, "zar"); + + public static final Currencies PKR = new Currencies(Value.PKR, "pkr"); + + public static final Currencies CNY = new Currencies(Value.CNY, "cny"); + + public static final Currencies CZK = new Currencies(Value.CZK, "czk"); + + public static final Currencies ILS = new Currencies(Value.ILS, "ils"); + + public static final Currencies MGA = new Currencies(Value.MGA, "mga"); + + public static final Currencies AED = new Currencies(Value.AED, "aed"); + + public static final Currencies GHS = new Currencies(Value.GHS, "ghs"); + + public static final Currencies BAM = new Currencies(Value.BAM, "bam"); + + public static final Currencies JPY = new Currencies(Value.JPY, "jpy"); + + public static final Currencies PLN = new Currencies(Value.PLN, "pln"); + + public static final Currencies BOB = new Currencies(Value.BOB, "bob"); + + public static final Currencies QAR = new Currencies(Value.QAR, "qar"); + + public static final Currencies EGP = new Currencies(Value.EGP, "egp"); + + public static final Currencies AWG = new Currencies(Value.AWG, "awg"); + + public static final Currencies DKK = new Currencies(Value.DKK, "dkk"); + + public static final Currencies MDL = new Currencies(Value.MDL, "mdl"); + + public static final Currencies MXN = new Currencies(Value.MXN, "mxn"); + + public static final Currencies SGD = new Currencies(Value.SGD, "sgd"); + + public static final Currencies AUD = new Currencies(Value.AUD, "aud"); + + public static final Currencies GMD = new Currencies(Value.GMD, "gmd"); + + private final Value value; + + private final String string; + + Currencies(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof Currencies && this.string.equals(((Currencies) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CRC: + return visitor.visitCrc(); + case OMR: + return visitor.visitOmr(); + case RUB: + return visitor.visitRub(); + case BGN: + return visitor.visitBgn(); + case SAR: + return visitor.visitSar(); + case UYU: + return visitor.visitUyu(); + case TZS: + return visitor.visitTzs(); + case XCD: + return visitor.visitXcd(); + case GTQ: + return visitor.visitGtq(); + case CHF: + return visitor.visitChf(); + case RON: + return visitor.visitRon(); + case PHP: + return visitor.visitPhp(); + case KES: + return visitor.visitKes(); + case XAU: + return visitor.visitXau(); + case BSD: + return visitor.visitBsd(); + case INR: + return visitor.visitInr(); + case HKD: + return visitor.visitHkd(); + case JOD: + return visitor.visitJod(); + case MKD: + return visitor.visitMkd(); + case CLP: + return visitor.visitClp(); + case NZD: + return visitor.visitNzd(); + case IDR: + return visitor.visitIdr(); + case MOP: + return visitor.visitMop(); + case HUF: + return visitor.visitHuf(); + case MAD: + return visitor.visitMad(); + case KHR: + return visitor.visitKhr(); + case NGN: + return visitor.visitNgn(); + case THB: + return visitor.visitThb(); + case DZD: + return visitor.visitDzd(); + case ARS: + return visitor.visitArs(); + case CAD: + return visitor.visitCad(); + case MYR: + return visitor.visitMyr(); + case KRW: + return visitor.visitKrw(); + case KZT: + return visitor.visitKzt(); + case ETH: + return visitor.visitEth(); + case COP: + return visitor.visitCop(); + case JMD: + return visitor.visitJmd(); + case NAD: + return visitor.visitNad(); + case GYD: + return visitor.visitGyd(); + case KWD: + return visitor.visitKwd(); + case DOP: + return visitor.visitDop(); + case BTC: + return visitor.visitBtc(); + case AMD: + return visitor.visitAmd(); + case LKR: + return visitor.visitLkr(); + case ALL: + return visitor.visitAll(); + case USDT: + return visitor.visitUsdt(); + case TND: + return visitor.visitTnd(); + case MUR: + return visitor.visitMur(); + case PEN: + return visitor.visitPen(); + case USD: + return visitor.visitUsd(); + case APE: + return visitor.visitApe(); + case BHD: + return visitor.visitBhd(); + case XOF: + return visitor.visitXof(); + case RWF: + return visitor.visitRwf(); + case GBP: + return visitor.visitGbp(); + case VND: + return visitor.visitVnd(); + case MNT: + return visitor.visitMnt(); + case ETB: + return visitor.visitEtb(); + case TTD: + return visitor.visitTtd(); + case EUR: + return visitor.visitEur(); + case BRL: + return visitor.visitBrl(); + case SEK: + return visitor.visitSek(); + case RSD: + return visitor.visitRsd(); + case UZS: + return visitor.visitUzs(); + case TWD: + return visitor.visitTwd(); + case NOK: + return visitor.visitNok(); + case WHOP_USD: + return visitor.visitWhopUsd(); + case PYG: + return visitor.visitPyg(); + case TRY: + return visitor.visitTry(); + case ZAR: + return visitor.visitZar(); + case PKR: + return visitor.visitPkr(); + case CNY: + return visitor.visitCny(); + case CZK: + return visitor.visitCzk(); + case ILS: + return visitor.visitIls(); + case MGA: + return visitor.visitMga(); + case AED: + return visitor.visitAed(); + case GHS: + return visitor.visitGhs(); + case BAM: + return visitor.visitBam(); + case JPY: + return visitor.visitJpy(); + case PLN: + return visitor.visitPln(); + case BOB: + return visitor.visitBob(); + case QAR: + return visitor.visitQar(); + case EGP: + return visitor.visitEgp(); + case AWG: + return visitor.visitAwg(); + case DKK: + return visitor.visitDkk(); + case MDL: + return visitor.visitMdl(); + case MXN: + return visitor.visitMxn(); + case SGD: + return visitor.visitSgd(); + case AUD: + return visitor.visitAud(); + case GMD: + return visitor.visitGmd(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static Currencies valueOf(String value) { + switch (value) { + case "crc": + return CRC; + case "omr": + return OMR; + case "rub": + return RUB; + case "bgn": + return BGN; + case "sar": + return SAR; + case "uyu": + return UYU; + case "tzs": + return TZS; + case "xcd": + return XCD; + case "gtq": + return GTQ; + case "chf": + return CHF; + case "ron": + return RON; + case "php": + return PHP; + case "kes": + return KES; + case "xau": + return XAU; + case "bsd": + return BSD; + case "inr": + return INR; + case "hkd": + return HKD; + case "jod": + return JOD; + case "mkd": + return MKD; + case "clp": + return CLP; + case "nzd": + return NZD; + case "idr": + return IDR; + case "mop": + return MOP; + case "huf": + return HUF; + case "mad": + return MAD; + case "khr": + return KHR; + case "ngn": + return NGN; + case "thb": + return THB; + case "dzd": + return DZD; + case "ars": + return ARS; + case "cad": + return CAD; + case "myr": + return MYR; + case "krw": + return KRW; + case "kzt": + return KZT; + case "eth": + return ETH; + case "cop": + return COP; + case "jmd": + return JMD; + case "nad": + return NAD; + case "gyd": + return GYD; + case "kwd": + return KWD; + case "dop": + return DOP; + case "btc": + return BTC; + case "amd": + return AMD; + case "lkr": + return LKR; + case "all": + return ALL; + case "usdt": + return USDT; + case "tnd": + return TND; + case "mur": + return MUR; + case "pen": + return PEN; + case "usd": + return USD; + case "ape": + return APE; + case "bhd": + return BHD; + case "xof": + return XOF; + case "rwf": + return RWF; + case "gbp": + return GBP; + case "vnd": + return VND; + case "mnt": + return MNT; + case "etb": + return ETB; + case "ttd": + return TTD; + case "eur": + return EUR; + case "brl": + return BRL; + case "sek": + return SEK; + case "rsd": + return RSD; + case "uzs": + return UZS; + case "twd": + return TWD; + case "nok": + return NOK; + case "whop_usd": + return WHOP_USD; + case "pyg": + return PYG; + case "try": + return TRY; + case "zar": + return ZAR; + case "pkr": + return PKR; + case "cny": + return CNY; + case "czk": + return CZK; + case "ils": + return ILS; + case "mga": + return MGA; + case "aed": + return AED; + case "ghs": + return GHS; + case "bam": + return BAM; + case "jpy": + return JPY; + case "pln": + return PLN; + case "bob": + return BOB; + case "qar": + return QAR; + case "egp": + return EGP; + case "awg": + return AWG; + case "dkk": + return DKK; + case "mdl": + return MDL; + case "mxn": + return MXN; + case "sgd": + return SGD; + case "aud": + return AUD; + case "gmd": + return GMD; + default: + return new Currencies(Value.UNKNOWN, value); + } + } + + public enum Value { + USD, + + SGD, + + INR, + + AUD, + + BRL, + + CAD, + + DKK, + + EUR, + + NOK, + + GBP, + + SEK, + + CHF, + + HKD, + + HUF, + + JPY, + + MXN, + + MYR, + + PLN, + + CZK, + + NZD, + + AED, + + ETH, + + APE, + + COP, + + RON, + + THB, + + BGN, + + IDR, + + DOP, + + PHP, + + TRY, + + KRW, + + TWD, + + VND, + + PKR, + + CLP, + + UYU, + + ARS, + + ZAR, + + DZD, + + TND, + + MAD, + + KES, + + KWD, + + JOD, + + ALL, + + XCD, + + AMD, + + BSD, + + BHD, + + BOB, + + BAM, + + KHR, + + CRC, + + XOF, + + EGP, + + ETB, + + GMD, + + GHS, + + GTQ, + + GYD, + + ILS, + + JMD, + + MOP, + + MGA, + + MUR, + + MDL, + + MNT, + + NAD, + + NGN, + + MKD, + + OMR, + + PYG, + + PEN, + + QAR, + + RWF, + + SAR, + + RSD, + + LKR, + + TZS, + + TTD, + + UZS, + + RUB, + + BTC, + + CNY, + + USDT, + + KZT, + + AWG, + + WHOP_USD, + + XAU, + + UNKNOWN + } + + public interface Visitor { + T visitUsd(); + + T visitSgd(); + + T visitInr(); + + T visitAud(); + + T visitBrl(); + + T visitCad(); + + T visitDkk(); + + T visitEur(); + + T visitNok(); + + T visitGbp(); + + T visitSek(); + + T visitChf(); + + T visitHkd(); + + T visitHuf(); + + T visitJpy(); + + T visitMxn(); + + T visitMyr(); + + T visitPln(); + + T visitCzk(); + + T visitNzd(); + + T visitAed(); + + T visitEth(); + + T visitApe(); + + T visitCop(); + + T visitRon(); + + T visitThb(); + + T visitBgn(); + + T visitIdr(); + + T visitDop(); + + T visitPhp(); + + T visitTry(); + + T visitKrw(); + + T visitTwd(); + + T visitVnd(); + + T visitPkr(); + + T visitClp(); + + T visitUyu(); + + T visitArs(); + + T visitZar(); + + T visitDzd(); + + T visitTnd(); + + T visitMad(); + + T visitKes(); + + T visitKwd(); + + T visitJod(); + + T visitAll(); + + T visitXcd(); + + T visitAmd(); + + T visitBsd(); + + T visitBhd(); + + T visitBob(); + + T visitBam(); + + T visitKhr(); + + T visitCrc(); + + T visitXof(); + + T visitEgp(); + + T visitEtb(); + + T visitGmd(); + + T visitGhs(); + + T visitGtq(); + + T visitGyd(); + + T visitIls(); + + T visitJmd(); + + T visitMop(); + + T visitMga(); + + T visitMur(); + + T visitMdl(); + + T visitMnt(); + + T visitNad(); + + T visitNgn(); + + T visitMkd(); + + T visitOmr(); + + T visitPyg(); + + T visitPen(); + + T visitQar(); + + T visitRwf(); + + T visitSar(); + + T visitRsd(); + + T visitLkr(); + + T visitTzs(); + + T visitTtd(); + + T visitUzs(); + + T visitRub(); + + T visitBtc(); + + T visitCny(); + + T visitUsdt(); + + T visitKzt(); + + T visitAwg(); + + T visitWhopUsd(); + + T visitXau(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CustomCtas.java b/src/main/java/com/whop/api/types/CustomCtas.java new file mode 100644 index 00000000..8e6a3421 --- /dev/null +++ b/src/main/java/com/whop/api/types/CustomCtas.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CustomCtas { + public static final CustomCtas DONATE_NOW = new CustomCtas(Value.DONATE_NOW, "donate_now"); + + public static final CustomCtas SIGN_UP = new CustomCtas(Value.SIGN_UP, "sign_up"); + + public static final CustomCtas GET_OFFER = new CustomCtas(Value.GET_OFFER, "get_offer"); + + public static final CustomCtas COMPLETE_ORDER = new CustomCtas(Value.COMPLETE_ORDER, "complete_order"); + + public static final CustomCtas PURCHASE = new CustomCtas(Value.PURCHASE, "purchase"); + + public static final CustomCtas SHOP_NOW = new CustomCtas(Value.SHOP_NOW, "shop_now"); + + public static final CustomCtas GET_ACCESS = new CustomCtas(Value.GET_ACCESS, "get_access"); + + public static final CustomCtas JOIN = new CustomCtas(Value.JOIN, "join"); + + public static final CustomCtas CALL_NOW = new CustomCtas(Value.CALL_NOW, "call_now"); + + public static final CustomCtas ORDER_NOW = new CustomCtas(Value.ORDER_NOW, "order_now"); + + public static final CustomCtas SUBSCRIBE = new CustomCtas(Value.SUBSCRIBE, "subscribe"); + + public static final CustomCtas APPLY_NOW = new CustomCtas(Value.APPLY_NOW, "apply_now"); + + public static final CustomCtas CONTACT_US = new CustomCtas(Value.CONTACT_US, "contact_us"); + + private final Value value; + + private final String string; + + CustomCtas(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof CustomCtas && this.string.equals(((CustomCtas) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DONATE_NOW: + return visitor.visitDonateNow(); + case SIGN_UP: + return visitor.visitSignUp(); + case GET_OFFER: + return visitor.visitGetOffer(); + case COMPLETE_ORDER: + return visitor.visitCompleteOrder(); + case PURCHASE: + return visitor.visitPurchase(); + case SHOP_NOW: + return visitor.visitShopNow(); + case GET_ACCESS: + return visitor.visitGetAccess(); + case JOIN: + return visitor.visitJoin(); + case CALL_NOW: + return visitor.visitCallNow(); + case ORDER_NOW: + return visitor.visitOrderNow(); + case SUBSCRIBE: + return visitor.visitSubscribe(); + case APPLY_NOW: + return visitor.visitApplyNow(); + case CONTACT_US: + return visitor.visitContactUs(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CustomCtas valueOf(String value) { + switch (value) { + case "donate_now": + return DONATE_NOW; + case "sign_up": + return SIGN_UP; + case "get_offer": + return GET_OFFER; + case "complete_order": + return COMPLETE_ORDER; + case "purchase": + return PURCHASE; + case "shop_now": + return SHOP_NOW; + case "get_access": + return GET_ACCESS; + case "join": + return JOIN; + case "call_now": + return CALL_NOW; + case "order_now": + return ORDER_NOW; + case "subscribe": + return SUBSCRIBE; + case "apply_now": + return APPLY_NOW; + case "contact_us": + return CONTACT_US; + default: + return new CustomCtas(Value.UNKNOWN, value); + } + } + + public enum Value { + GET_ACCESS, + + JOIN, + + ORDER_NOW, + + SHOP_NOW, + + CALL_NOW, + + DONATE_NOW, + + CONTACT_US, + + SIGN_UP, + + SUBSCRIBE, + + PURCHASE, + + GET_OFFER, + + APPLY_NOW, + + COMPLETE_ORDER, + + UNKNOWN + } + + public interface Visitor { + T visitGetAccess(); + + T visitJoin(); + + T visitOrderNow(); + + T visitShopNow(); + + T visitCallNow(); + + T visitDonateNow(); + + T visitContactUs(); + + T visitSignUp(); + + T visitSubscribe(); + + T visitPurchase(); + + T visitGetOffer(); + + T visitApplyNow(); + + T visitCompleteOrder(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/CustomFieldTypes.java b/src/main/java/com/whop/api/types/CustomFieldTypes.java new file mode 100644 index 00000000..25dede1b --- /dev/null +++ b/src/main/java/com/whop/api/types/CustomFieldTypes.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CustomFieldTypes { + public static final CustomFieldTypes TEXT = new CustomFieldTypes(Value.TEXT, "text"); + + private final Value value; + + private final String string; + + CustomFieldTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CustomFieldTypes && this.string.equals(((CustomFieldTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TEXT: + return visitor.visitText(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CustomFieldTypes valueOf(String value) { + switch (value) { + case "text": + return TEXT; + default: + return new CustomFieldTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + TEXT, + + UNKNOWN + } + + public interface Visitor { + T visitText(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeMetric.java b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeMetric.java new file mode 100644 index 00000000..6e978bcc --- /dev/null +++ b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeMetric.java @@ -0,0 +1,584 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DescribeStatsResponseDescribeMetric.Builder.class) +public final class DescribeStatsResponseDescribeMetric { + private final String metric; + + private final String node; + + private final String engine; + + private final String timestampColumn; + + private final List supportedEngines; + + private final List filterableColumns; + + private final List breakdownableColumns; + + private final Optional sql; + + private final Optional debug; + + private final Map additionalProperties; + + private DescribeStatsResponseDescribeMetric( + String metric, + String node, + String engine, + String timestampColumn, + List supportedEngines, + List filterableColumns, + List breakdownableColumns, + Optional sql, + Optional debug, + Map additionalProperties) { + this.metric = metric; + this.node = node; + this.engine = engine; + this.timestampColumn = timestampColumn; + this.supportedEngines = supportedEngines; + this.filterableColumns = filterableColumns; + this.breakdownableColumns = breakdownableColumns; + this.sql = sql; + this.debug = debug; + this.additionalProperties = additionalProperties; + } + + /** + * @return The metric name. + */ + @JsonProperty("metric") + public String getMetric() { + return metric; + } + + /** + * @return The node path this metric operates on. + */ + @JsonProperty("node") + public String getNode() { + return node; + } + + /** + * @return The query engine being used. + */ + @JsonProperty("engine") + public String getEngine() { + return engine; + } + + /** + * @return The timestamp column used for time filtering. + */ + @JsonProperty("timestamp_column") + public String getTimestampColumn() { + return timestampColumn; + } + + /** + * @return Query engines that support this metric. + */ + @JsonProperty("supported_engines") + public List getSupportedEngines() { + return supportedEngines; + } + + /** + * @return Columns that can be used for filtering. + */ + @JsonProperty("filterable_columns") + public List getFilterableColumns() { + return filterableColumns; + } + + /** + * @return Columns that can be used for breakdowns. + */ + @JsonProperty("breakdownable_columns") + public List getBreakdownableColumns() { + return breakdownableColumns; + } + + /** + * @return The generated SQL query. + */ + @JsonIgnore + public Optional getSql() { + if (sql == null) { + return Optional.empty(); + } + return sql; + } + + /** + * @return Debug information. + */ + @JsonIgnore + public Optional getDebug() { + if (debug == null) { + return Optional.empty(); + } + return debug; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("sql") + private Optional _getSql() { + return sql; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("debug") + private Optional _getDebug() { + return debug; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeStatsResponseDescribeMetric + && equalTo((DescribeStatsResponseDescribeMetric) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DescribeStatsResponseDescribeMetric other) { + return metric.equals(other.metric) + && node.equals(other.node) + && engine.equals(other.engine) + && timestampColumn.equals(other.timestampColumn) + && supportedEngines.equals(other.supportedEngines) + && filterableColumns.equals(other.filterableColumns) + && breakdownableColumns.equals(other.breakdownableColumns) + && sql.equals(other.sql) + && debug.equals(other.debug); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.metric, + this.node, + this.engine, + this.timestampColumn, + this.supportedEngines, + this.filterableColumns, + this.breakdownableColumns, + this.sql, + this.debug); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MetricStage builder() { + return new Builder(); + } + + public interface MetricStage { + /** + *

The metric name.

+ */ + NodeStage metric(@NotNull String metric); + + Builder from(DescribeStatsResponseDescribeMetric other); + } + + public interface NodeStage { + /** + *

The node path this metric operates on.

+ */ + EngineStage node(@NotNull String node); + } + + public interface EngineStage { + /** + *

The query engine being used.

+ */ + TimestampColumnStage engine(@NotNull String engine); + } + + public interface TimestampColumnStage { + /** + *

The timestamp column used for time filtering.

+ */ + _FinalStage timestampColumn(@NotNull String timestampColumn); + } + + public interface _FinalStage { + DescribeStatsResponseDescribeMetric build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Query engines that support this metric.

+ */ + _FinalStage supportedEngines(List supportedEngines); + + _FinalStage addSupportedEngines(String supportedEngines); + + _FinalStage addAllSupportedEngines(List supportedEngines); + + /** + *

Columns that can be used for filtering.

+ */ + _FinalStage filterableColumns(List filterableColumns); + + _FinalStage addFilterableColumns(String filterableColumns); + + _FinalStage addAllFilterableColumns(List filterableColumns); + + /** + *

Columns that can be used for breakdowns.

+ */ + _FinalStage breakdownableColumns(List breakdownableColumns); + + _FinalStage addBreakdownableColumns(String breakdownableColumns); + + _FinalStage addAllBreakdownableColumns(List breakdownableColumns); + + /** + *

The generated SQL query.

+ */ + _FinalStage sql(Optional sql); + + _FinalStage sql(String sql); + + _FinalStage sql(Nullable sql); + + /** + *

Debug information.

+ */ + _FinalStage debug(Optional debug); + + _FinalStage debug(DescribeStatsResponseDescribeMetricDebug debug); + + _FinalStage debug(Nullable debug); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements MetricStage, NodeStage, EngineStage, TimestampColumnStage, _FinalStage { + private String metric; + + private String node; + + private String engine; + + private String timestampColumn; + + private Optional debug = Optional.empty(); + + private Optional sql = Optional.empty(); + + private List breakdownableColumns = new ArrayList<>(); + + private List filterableColumns = new ArrayList<>(); + + private List supportedEngines = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DescribeStatsResponseDescribeMetric other) { + metric(other.getMetric()); + node(other.getNode()); + engine(other.getEngine()); + timestampColumn(other.getTimestampColumn()); + supportedEngines(other.getSupportedEngines()); + filterableColumns(other.getFilterableColumns()); + breakdownableColumns(other.getBreakdownableColumns()); + sql(other.getSql()); + debug(other.getDebug()); + return this; + } + + /** + *

The metric name.

+ *

The metric name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("metric") + public NodeStage metric(@NotNull String metric) { + this.metric = Objects.requireNonNull(metric, "metric must not be null"); + return this; + } + + /** + *

The node path this metric operates on.

+ *

The node path this metric operates on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("node") + public EngineStage node(@NotNull String node) { + this.node = Objects.requireNonNull(node, "node must not be null"); + return this; + } + + /** + *

The query engine being used.

+ *

The query engine being used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("engine") + public TimestampColumnStage engine(@NotNull String engine) { + this.engine = Objects.requireNonNull(engine, "engine must not be null"); + return this; + } + + /** + *

The timestamp column used for time filtering.

+ *

The timestamp column used for time filtering.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timestamp_column") + public _FinalStage timestampColumn(@NotNull String timestampColumn) { + this.timestampColumn = Objects.requireNonNull(timestampColumn, "timestampColumn must not be null"); + return this; + } + + /** + *

Debug information.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage debug(Nullable debug) { + if (debug.isNull()) { + this.debug = null; + } else if (debug.isEmpty()) { + this.debug = Optional.empty(); + } else { + this.debug = Optional.of(debug.get()); + } + return this; + } + + /** + *

Debug information.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage debug(DescribeStatsResponseDescribeMetricDebug debug) { + this.debug = Optional.ofNullable(debug); + return this; + } + + /** + *

Debug information.

+ */ + @java.lang.Override + @JsonSetter(value = "debug", nulls = Nulls.SKIP) + public _FinalStage debug(Optional debug) { + this.debug = debug; + return this; + } + + /** + *

The generated SQL query.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sql(Nullable sql) { + if (sql.isNull()) { + this.sql = null; + } else if (sql.isEmpty()) { + this.sql = Optional.empty(); + } else { + this.sql = Optional.of(sql.get()); + } + return this; + } + + /** + *

The generated SQL query.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sql(String sql) { + this.sql = Optional.ofNullable(sql); + return this; + } + + /** + *

The generated SQL query.

+ */ + @java.lang.Override + @JsonSetter(value = "sql", nulls = Nulls.SKIP) + public _FinalStage sql(Optional sql) { + this.sql = sql; + return this; + } + + /** + *

Columns that can be used for breakdowns.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllBreakdownableColumns(List breakdownableColumns) { + if (breakdownableColumns != null) { + this.breakdownableColumns.addAll(breakdownableColumns); + } + return this; + } + + /** + *

Columns that can be used for breakdowns.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addBreakdownableColumns(String breakdownableColumns) { + this.breakdownableColumns.add(breakdownableColumns); + return this; + } + + /** + *

Columns that can be used for breakdowns.

+ */ + @java.lang.Override + @JsonSetter(value = "breakdownable_columns", nulls = Nulls.SKIP) + public _FinalStage breakdownableColumns(List breakdownableColumns) { + this.breakdownableColumns.clear(); + if (breakdownableColumns != null) { + this.breakdownableColumns.addAll(breakdownableColumns); + } + return this; + } + + /** + *

Columns that can be used for filtering.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllFilterableColumns(List filterableColumns) { + if (filterableColumns != null) { + this.filterableColumns.addAll(filterableColumns); + } + return this; + } + + /** + *

Columns that can be used for filtering.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addFilterableColumns(String filterableColumns) { + this.filterableColumns.add(filterableColumns); + return this; + } + + /** + *

Columns that can be used for filtering.

+ */ + @java.lang.Override + @JsonSetter(value = "filterable_columns", nulls = Nulls.SKIP) + public _FinalStage filterableColumns(List filterableColumns) { + this.filterableColumns.clear(); + if (filterableColumns != null) { + this.filterableColumns.addAll(filterableColumns); + } + return this; + } + + /** + *

Query engines that support this metric.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllSupportedEngines(List supportedEngines) { + if (supportedEngines != null) { + this.supportedEngines.addAll(supportedEngines); + } + return this; + } + + /** + *

Query engines that support this metric.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addSupportedEngines(String supportedEngines) { + this.supportedEngines.add(supportedEngines); + return this; + } + + /** + *

Query engines that support this metric.

+ */ + @java.lang.Override + @JsonSetter(value = "supported_engines", nulls = Nulls.SKIP) + public _FinalStage supportedEngines(List supportedEngines) { + this.supportedEngines.clear(); + if (supportedEngines != null) { + this.supportedEngines.addAll(supportedEngines); + } + return this; + } + + @java.lang.Override + public DescribeStatsResponseDescribeMetric build() { + return new DescribeStatsResponseDescribeMetric( + metric, + node, + engine, + timestampColumn, + supportedEngines, + filterableColumns, + breakdownableColumns, + sql, + debug, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeMetricDebug.java b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeMetricDebug.java new file mode 100644 index 00000000..2118dec2 --- /dev/null +++ b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeMetricDebug.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DescribeStatsResponseDescribeMetricDebug.Builder.class) +public final class DescribeStatsResponseDescribeMetricDebug { + private final Optional requestId; + + private final Map additionalProperties; + + private DescribeStatsResponseDescribeMetricDebug( + Optional requestId, Map additionalProperties) { + this.requestId = requestId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unique request identifier for debugging. + */ + @JsonIgnore + public Optional getRequestId() { + if (requestId == null) { + return Optional.empty(); + } + return requestId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("request_id") + private Optional _getRequestId() { + return requestId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeStatsResponseDescribeMetricDebug + && equalTo((DescribeStatsResponseDescribeMetricDebug) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DescribeStatsResponseDescribeMetricDebug other) { + return requestId.equals(other.requestId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.requestId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional requestId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DescribeStatsResponseDescribeMetricDebug other) { + requestId(other.getRequestId()); + return this; + } + + /** + *

Unique request identifier for debugging.

+ */ + @JsonSetter(value = "request_id", nulls = Nulls.SKIP) + public Builder requestId(Optional requestId) { + this.requestId = requestId; + return this; + } + + public Builder requestId(String requestId) { + this.requestId = Optional.ofNullable(requestId); + return this; + } + + public Builder requestId(Nullable requestId) { + if (requestId.isNull()) { + this.requestId = null; + } else if (requestId.isEmpty()) { + this.requestId = Optional.empty(); + } else { + this.requestId = Optional.of(requestId.get()); + } + return this; + } + + public DescribeStatsResponseDescribeMetricDebug build() { + return new DescribeStatsResponseDescribeMetricDebug(requestId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeNode.java b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeNode.java new file mode 100644 index 00000000..f58fbcb5 --- /dev/null +++ b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeNode.java @@ -0,0 +1,562 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DescribeStatsResponseDescribeNode.Builder.class) +public final class DescribeStatsResponseDescribeNode { + private final String node; + + private final String engine; + + private final List columns; + + private final List sortableColumns; + + private final List associations; + + private final List metrics; + + private final Optional>> sample; + + private final Optional debug; + + private final Map additionalProperties; + + private DescribeStatsResponseDescribeNode( + String node, + String engine, + List columns, + List sortableColumns, + List associations, + List metrics, + Optional>> sample, + Optional debug, + Map additionalProperties) { + this.node = node; + this.engine = engine; + this.columns = columns; + this.sortableColumns = sortableColumns; + this.associations = associations; + this.metrics = metrics; + this.sample = sample; + this.debug = debug; + this.additionalProperties = additionalProperties; + } + + /** + * @return The node path being described. + */ + @JsonProperty("node") + public String getNode() { + return node; + } + + /** + * @return The query engine being used. + */ + @JsonProperty("engine") + public String getEngine() { + return engine; + } + + /** + * @return Available columns. + */ + @JsonProperty("columns") + public List getColumns() { + return columns; + } + + /** + * @return Columns that can be used for sorting. + */ + @JsonProperty("sortable_columns") + public List getSortableColumns() { + return sortableColumns; + } + + /** + * @return Available associations or child paths. + */ + @JsonProperty("associations") + public List getAssociations() { + return associations; + } + + /** + * @return Available metrics for this node. + */ + @JsonProperty("metrics") + public List getMetrics() { + return metrics; + } + + /** + * @return Sample data rows. + */ + @JsonIgnore + public Optional>> getSample() { + if (sample == null) { + return Optional.empty(); + } + return sample; + } + + /** + * @return Debug information. + */ + @JsonIgnore + public Optional getDebug() { + if (debug == null) { + return Optional.empty(); + } + return debug; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("sample") + private Optional>> _getSample() { + return sample; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("debug") + private Optional _getDebug() { + return debug; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeStatsResponseDescribeNode && equalTo((DescribeStatsResponseDescribeNode) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DescribeStatsResponseDescribeNode other) { + return node.equals(other.node) + && engine.equals(other.engine) + && columns.equals(other.columns) + && sortableColumns.equals(other.sortableColumns) + && associations.equals(other.associations) + && metrics.equals(other.metrics) + && sample.equals(other.sample) + && debug.equals(other.debug); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.node, + this.engine, + this.columns, + this.sortableColumns, + this.associations, + this.metrics, + this.sample, + this.debug); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NodeStage builder() { + return new Builder(); + } + + public interface NodeStage { + /** + *

The node path being described.

+ */ + EngineStage node(@NotNull String node); + + Builder from(DescribeStatsResponseDescribeNode other); + } + + public interface EngineStage { + /** + *

The query engine being used.

+ */ + _FinalStage engine(@NotNull String engine); + } + + public interface _FinalStage { + DescribeStatsResponseDescribeNode build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Available columns.

+ */ + _FinalStage columns(List columns); + + _FinalStage addColumns(String columns); + + _FinalStage addAllColumns(List columns); + + /** + *

Columns that can be used for sorting.

+ */ + _FinalStage sortableColumns(List sortableColumns); + + _FinalStage addSortableColumns(String sortableColumns); + + _FinalStage addAllSortableColumns(List sortableColumns); + + /** + *

Available associations or child paths.

+ */ + _FinalStage associations(List associations); + + _FinalStage addAssociations(DescribeStatsResponseDescribeNodeAssociationsItem associations); + + _FinalStage addAllAssociations(List associations); + + /** + *

Available metrics for this node.

+ */ + _FinalStage metrics(List metrics); + + _FinalStage addMetrics(DescribeStatsResponseDescribeNodeMetricsItem metrics); + + _FinalStage addAllMetrics(List metrics); + + /** + *

Sample data rows.

+ */ + _FinalStage sample(Optional>> sample); + + _FinalStage sample(List> sample); + + _FinalStage sample(Nullable>> sample); + + /** + *

Debug information.

+ */ + _FinalStage debug(Optional debug); + + _FinalStage debug(DescribeStatsResponseDescribeNodeDebug debug); + + _FinalStage debug(Nullable debug); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NodeStage, EngineStage, _FinalStage { + private String node; + + private String engine; + + private Optional debug = Optional.empty(); + + private Optional>> sample = Optional.empty(); + + private List metrics = new ArrayList<>(); + + private List associations = new ArrayList<>(); + + private List sortableColumns = new ArrayList<>(); + + private List columns = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DescribeStatsResponseDescribeNode other) { + node(other.getNode()); + engine(other.getEngine()); + columns(other.getColumns()); + sortableColumns(other.getSortableColumns()); + associations(other.getAssociations()); + metrics(other.getMetrics()); + sample(other.getSample()); + debug(other.getDebug()); + return this; + } + + /** + *

The node path being described.

+ *

The node path being described.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("node") + public EngineStage node(@NotNull String node) { + this.node = Objects.requireNonNull(node, "node must not be null"); + return this; + } + + /** + *

The query engine being used.

+ *

The query engine being used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("engine") + public _FinalStage engine(@NotNull String engine) { + this.engine = Objects.requireNonNull(engine, "engine must not be null"); + return this; + } + + /** + *

Debug information.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage debug(Nullable debug) { + if (debug.isNull()) { + this.debug = null; + } else if (debug.isEmpty()) { + this.debug = Optional.empty(); + } else { + this.debug = Optional.of(debug.get()); + } + return this; + } + + /** + *

Debug information.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage debug(DescribeStatsResponseDescribeNodeDebug debug) { + this.debug = Optional.ofNullable(debug); + return this; + } + + /** + *

Debug information.

+ */ + @java.lang.Override + @JsonSetter(value = "debug", nulls = Nulls.SKIP) + public _FinalStage debug(Optional debug) { + this.debug = debug; + return this; + } + + /** + *

Sample data rows.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sample(Nullable>> sample) { + if (sample.isNull()) { + this.sample = null; + } else if (sample.isEmpty()) { + this.sample = Optional.empty(); + } else { + this.sample = Optional.of(sample.get()); + } + return this; + } + + /** + *

Sample data rows.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sample(List> sample) { + this.sample = Optional.ofNullable(sample); + return this; + } + + /** + *

Sample data rows.

+ */ + @java.lang.Override + @JsonSetter(value = "sample", nulls = Nulls.SKIP) + public _FinalStage sample(Optional>> sample) { + this.sample = sample; + return this; + } + + /** + *

Available metrics for this node.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllMetrics(List metrics) { + if (metrics != null) { + this.metrics.addAll(metrics); + } + return this; + } + + /** + *

Available metrics for this node.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addMetrics(DescribeStatsResponseDescribeNodeMetricsItem metrics) { + this.metrics.add(metrics); + return this; + } + + /** + *

Available metrics for this node.

+ */ + @java.lang.Override + @JsonSetter(value = "metrics", nulls = Nulls.SKIP) + public _FinalStage metrics(List metrics) { + this.metrics.clear(); + if (metrics != null) { + this.metrics.addAll(metrics); + } + return this; + } + + /** + *

Available associations or child paths.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllAssociations(List associations) { + if (associations != null) { + this.associations.addAll(associations); + } + return this; + } + + /** + *

Available associations or child paths.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAssociations(DescribeStatsResponseDescribeNodeAssociationsItem associations) { + this.associations.add(associations); + return this; + } + + /** + *

Available associations or child paths.

+ */ + @java.lang.Override + @JsonSetter(value = "associations", nulls = Nulls.SKIP) + public _FinalStage associations(List associations) { + this.associations.clear(); + if (associations != null) { + this.associations.addAll(associations); + } + return this; + } + + /** + *

Columns that can be used for sorting.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllSortableColumns(List sortableColumns) { + if (sortableColumns != null) { + this.sortableColumns.addAll(sortableColumns); + } + return this; + } + + /** + *

Columns that can be used for sorting.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addSortableColumns(String sortableColumns) { + this.sortableColumns.add(sortableColumns); + return this; + } + + /** + *

Columns that can be used for sorting.

+ */ + @java.lang.Override + @JsonSetter(value = "sortable_columns", nulls = Nulls.SKIP) + public _FinalStage sortableColumns(List sortableColumns) { + this.sortableColumns.clear(); + if (sortableColumns != null) { + this.sortableColumns.addAll(sortableColumns); + } + return this; + } + + /** + *

Available columns.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllColumns(List columns) { + if (columns != null) { + this.columns.addAll(columns); + } + return this; + } + + /** + *

Available columns.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addColumns(String columns) { + this.columns.add(columns); + return this; + } + + /** + *

Available columns.

+ */ + @java.lang.Override + @JsonSetter(value = "columns", nulls = Nulls.SKIP) + public _FinalStage columns(List columns) { + this.columns.clear(); + if (columns != null) { + this.columns.addAll(columns); + } + return this; + } + + @java.lang.Override + public DescribeStatsResponseDescribeNode build() { + return new DescribeStatsResponseDescribeNode( + node, engine, columns, sortableColumns, associations, metrics, sample, debug, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeNodeAssociationsItem.java b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeNodeAssociationsItem.java new file mode 100644 index 00000000..2a2aab6b --- /dev/null +++ b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeNodeAssociationsItem.java @@ -0,0 +1,383 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DescribeStatsResponseDescribeNodeAssociationsItem.Builder.class) +public final class DescribeStatsResponseDescribeNodeAssociationsItem { + private final String name; + + private final String type; + + private final Optional model; + + private final Optional path; + + private final Optional eventName; + + private final Map additionalProperties; + + private DescribeStatsResponseDescribeNodeAssociationsItem( + String name, + String type, + Optional model, + Optional path, + Optional eventName, + Map additionalProperties) { + this.name = name; + this.type = type; + this.model = model; + this.path = path; + this.eventName = eventName; + this.additionalProperties = additionalProperties; + } + + /** + * @return The association name. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The type (belongs_to, has_many, has_one, event, namespace). + */ + @JsonProperty("type") + public String getType() { + return type; + } + + /** + * @return The associated model class name (for model associations). + */ + @JsonIgnore + public Optional getModel() { + if (model == null) { + return Optional.empty(); + } + return model; + } + + /** + * @return The full path (for event associations). + */ + @JsonIgnore + public Optional getPath() { + if (path == null) { + return Optional.empty(); + } + return path; + } + + /** + * @return The event name (for event type). + */ + @JsonIgnore + public Optional getEventName() { + if (eventName == null) { + return Optional.empty(); + } + return eventName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("model") + private Optional _getModel() { + return model; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("path") + private Optional _getPath() { + return path; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("event_name") + private Optional _getEventName() { + return eventName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeStatsResponseDescribeNodeAssociationsItem + && equalTo((DescribeStatsResponseDescribeNodeAssociationsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DescribeStatsResponseDescribeNodeAssociationsItem other) { + return name.equals(other.name) + && type.equals(other.type) + && model.equals(other.model) + && path.equals(other.path) + && eventName.equals(other.eventName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.type, this.model, this.path, this.eventName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

The association name.

+ */ + TypeStage name(@NotNull String name); + + Builder from(DescribeStatsResponseDescribeNodeAssociationsItem other); + } + + public interface TypeStage { + /** + *

The type (belongs_to, has_many, has_one, event, namespace).

+ */ + _FinalStage type(@NotNull String type); + } + + public interface _FinalStage { + DescribeStatsResponseDescribeNodeAssociationsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The associated model class name (for model associations).

+ */ + _FinalStage model(Optional model); + + _FinalStage model(String model); + + _FinalStage model(Nullable model); + + /** + *

The full path (for event associations).

+ */ + _FinalStage path(Optional path); + + _FinalStage path(String path); + + _FinalStage path(Nullable path); + + /** + *

The event name (for event type).

+ */ + _FinalStage eventName(Optional eventName); + + _FinalStage eventName(String eventName); + + _FinalStage eventName(Nullable eventName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, TypeStage, _FinalStage { + private String name; + + private String type; + + private Optional eventName = Optional.empty(); + + private Optional path = Optional.empty(); + + private Optional model = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DescribeStatsResponseDescribeNodeAssociationsItem other) { + name(other.getName()); + type(other.getType()); + model(other.getModel()); + path(other.getPath()); + eventName(other.getEventName()); + return this; + } + + /** + *

The association name.

+ *

The association name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public TypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The type (belongs_to, has_many, has_one, event, namespace).

+ *

The type (belongs_to, has_many, has_one, event, namespace).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

The event name (for event type).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage eventName(Nullable eventName) { + if (eventName.isNull()) { + this.eventName = null; + } else if (eventName.isEmpty()) { + this.eventName = Optional.empty(); + } else { + this.eventName = Optional.of(eventName.get()); + } + return this; + } + + /** + *

The event name (for event type).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage eventName(String eventName) { + this.eventName = Optional.ofNullable(eventName); + return this; + } + + /** + *

The event name (for event type).

+ */ + @java.lang.Override + @JsonSetter(value = "event_name", nulls = Nulls.SKIP) + public _FinalStage eventName(Optional eventName) { + this.eventName = eventName; + return this; + } + + /** + *

The full path (for event associations).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage path(Nullable path) { + if (path.isNull()) { + this.path = null; + } else if (path.isEmpty()) { + this.path = Optional.empty(); + } else { + this.path = Optional.of(path.get()); + } + return this; + } + + /** + *

The full path (for event associations).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage path(String path) { + this.path = Optional.ofNullable(path); + return this; + } + + /** + *

The full path (for event associations).

+ */ + @java.lang.Override + @JsonSetter(value = "path", nulls = Nulls.SKIP) + public _FinalStage path(Optional path) { + this.path = path; + return this; + } + + /** + *

The associated model class name (for model associations).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage model(Nullable model) { + if (model.isNull()) { + this.model = null; + } else if (model.isEmpty()) { + this.model = Optional.empty(); + } else { + this.model = Optional.of(model.get()); + } + return this; + } + + /** + *

The associated model class name (for model associations).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage model(String model) { + this.model = Optional.ofNullable(model); + return this; + } + + /** + *

The associated model class name (for model associations).

+ */ + @java.lang.Override + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public _FinalStage model(Optional model) { + this.model = model; + return this; + } + + @java.lang.Override + public DescribeStatsResponseDescribeNodeAssociationsItem build() { + return new DescribeStatsResponseDescribeNodeAssociationsItem( + name, type, model, path, eventName, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeNodeDebug.java b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeNodeDebug.java new file mode 100644 index 00000000..344f645a --- /dev/null +++ b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeNodeDebug.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DescribeStatsResponseDescribeNodeDebug.Builder.class) +public final class DescribeStatsResponseDescribeNodeDebug { + private final Optional requestId; + + private final Map additionalProperties; + + private DescribeStatsResponseDescribeNodeDebug( + Optional requestId, Map additionalProperties) { + this.requestId = requestId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unique request identifier for debugging. + */ + @JsonIgnore + public Optional getRequestId() { + if (requestId == null) { + return Optional.empty(); + } + return requestId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("request_id") + private Optional _getRequestId() { + return requestId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeStatsResponseDescribeNodeDebug + && equalTo((DescribeStatsResponseDescribeNodeDebug) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DescribeStatsResponseDescribeNodeDebug other) { + return requestId.equals(other.requestId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.requestId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional requestId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DescribeStatsResponseDescribeNodeDebug other) { + requestId(other.getRequestId()); + return this; + } + + /** + *

Unique request identifier for debugging.

+ */ + @JsonSetter(value = "request_id", nulls = Nulls.SKIP) + public Builder requestId(Optional requestId) { + this.requestId = requestId; + return this; + } + + public Builder requestId(String requestId) { + this.requestId = Optional.ofNullable(requestId); + return this; + } + + public Builder requestId(Nullable requestId) { + if (requestId.isNull()) { + this.requestId = null; + } else if (requestId.isEmpty()) { + this.requestId = Optional.empty(); + } else { + this.requestId = Optional.of(requestId.get()); + } + return this; + } + + public DescribeStatsResponseDescribeNodeDebug build() { + return new DescribeStatsResponseDescribeNodeDebug(requestId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeNodeMetricsItem.java b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeNodeMetricsItem.java new file mode 100644 index 00000000..a7b98950 --- /dev/null +++ b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeNodeMetricsItem.java @@ -0,0 +1,228 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DescribeStatsResponseDescribeNodeMetricsItem.Builder.class) +public final class DescribeStatsResponseDescribeNodeMetricsItem { + private final String name; + + private final String nodePath; + + private final List supportedEngines; + + private final Map additionalProperties; + + private DescribeStatsResponseDescribeNodeMetricsItem( + String name, String nodePath, List supportedEngines, Map additionalProperties) { + this.name = name; + this.nodePath = nodePath; + this.supportedEngines = supportedEngines; + this.additionalProperties = additionalProperties; + } + + /** + * @return The metric name. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The node path this metric operates on. + */ + @JsonProperty("node_path") + public String getNodePath() { + return nodePath; + } + + /** + * @return Query engines that support this metric. + */ + @JsonProperty("supported_engines") + public List getSupportedEngines() { + return supportedEngines; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeStatsResponseDescribeNodeMetricsItem + && equalTo((DescribeStatsResponseDescribeNodeMetricsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DescribeStatsResponseDescribeNodeMetricsItem other) { + return name.equals(other.name) + && nodePath.equals(other.nodePath) + && supportedEngines.equals(other.supportedEngines); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.nodePath, this.supportedEngines); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

The metric name.

+ */ + NodePathStage name(@NotNull String name); + + Builder from(DescribeStatsResponseDescribeNodeMetricsItem other); + } + + public interface NodePathStage { + /** + *

The node path this metric operates on.

+ */ + _FinalStage nodePath(@NotNull String nodePath); + } + + public interface _FinalStage { + DescribeStatsResponseDescribeNodeMetricsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Query engines that support this metric.

+ */ + _FinalStage supportedEngines(List supportedEngines); + + _FinalStage addSupportedEngines(String supportedEngines); + + _FinalStage addAllSupportedEngines(List supportedEngines); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, NodePathStage, _FinalStage { + private String name; + + private String nodePath; + + private List supportedEngines = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DescribeStatsResponseDescribeNodeMetricsItem other) { + name(other.getName()); + nodePath(other.getNodePath()); + supportedEngines(other.getSupportedEngines()); + return this; + } + + /** + *

The metric name.

+ *

The metric name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public NodePathStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The node path this metric operates on.

+ *

The node path this metric operates on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("node_path") + public _FinalStage nodePath(@NotNull String nodePath) { + this.nodePath = Objects.requireNonNull(nodePath, "nodePath must not be null"); + return this; + } + + /** + *

Query engines that support this metric.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllSupportedEngines(List supportedEngines) { + if (supportedEngines != null) { + this.supportedEngines.addAll(supportedEngines); + } + return this; + } + + /** + *

Query engines that support this metric.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addSupportedEngines(String supportedEngines) { + this.supportedEngines.add(supportedEngines); + return this; + } + + /** + *

Query engines that support this metric.

+ */ + @java.lang.Override + @JsonSetter(value = "supported_engines", nulls = Nulls.SKIP) + public _FinalStage supportedEngines(List supportedEngines) { + this.supportedEngines.clear(); + if (supportedEngines != null) { + this.supportedEngines.addAll(supportedEngines); + } + return this; + } + + @java.lang.Override + public DescribeStatsResponseDescribeNodeMetricsItem build() { + return new DescribeStatsResponseDescribeNodeMetricsItem( + name, nodePath, supportedEngines, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeRoot.java b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeRoot.java new file mode 100644 index 00000000..4778f642 --- /dev/null +++ b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeRoot.java @@ -0,0 +1,258 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DescribeStatsResponseDescribeRoot.Builder.class) +public final class DescribeStatsResponseDescribeRoot { + private final List nodes; + + private final List views; + + private final List metrics; + + private final Optional debug; + + private final Map additionalProperties; + + private DescribeStatsResponseDescribeRoot( + List nodes, + List views, + List metrics, + Optional debug, + Map additionalProperties) { + this.nodes = nodes; + this.views = views; + this.metrics = metrics; + this.debug = debug; + this.additionalProperties = additionalProperties; + } + + /** + * @return Available root nodes. + */ + @JsonProperty("nodes") + public List getNodes() { + return nodes; + } + + /** + * @return Available API resource views. + */ + @JsonProperty("views") + public List getViews() { + return views; + } + + /** + * @return Available metrics. + */ + @JsonProperty("metrics") + public List getMetrics() { + return metrics; + } + + /** + * @return Debug information. + */ + @JsonIgnore + public Optional getDebug() { + if (debug == null) { + return Optional.empty(); + } + return debug; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("debug") + private Optional _getDebug() { + return debug; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeStatsResponseDescribeRoot && equalTo((DescribeStatsResponseDescribeRoot) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DescribeStatsResponseDescribeRoot other) { + return nodes.equals(other.nodes) + && views.equals(other.views) + && metrics.equals(other.metrics) + && debug.equals(other.debug); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.nodes, this.views, this.metrics, this.debug); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List nodes = new ArrayList<>(); + + private List views = new ArrayList<>(); + + private List metrics = new ArrayList<>(); + + private Optional debug = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DescribeStatsResponseDescribeRoot other) { + nodes(other.getNodes()); + views(other.getViews()); + metrics(other.getMetrics()); + debug(other.getDebug()); + return this; + } + + /** + *

Available root nodes.

+ */ + @JsonSetter(value = "nodes", nulls = Nulls.SKIP) + public Builder nodes(List nodes) { + this.nodes.clear(); + if (nodes != null) { + this.nodes.addAll(nodes); + } + return this; + } + + public Builder addNodes(String nodes) { + this.nodes.add(nodes); + return this; + } + + public Builder addAllNodes(List nodes) { + if (nodes != null) { + this.nodes.addAll(nodes); + } + return this; + } + + /** + *

Available API resource views.

+ */ + @JsonSetter(value = "views", nulls = Nulls.SKIP) + public Builder views(List views) { + this.views.clear(); + if (views != null) { + this.views.addAll(views); + } + return this; + } + + public Builder addViews(String views) { + this.views.add(views); + return this; + } + + public Builder addAllViews(List views) { + if (views != null) { + this.views.addAll(views); + } + return this; + } + + /** + *

Available metrics.

+ */ + @JsonSetter(value = "metrics", nulls = Nulls.SKIP) + public Builder metrics(List metrics) { + this.metrics.clear(); + if (metrics != null) { + this.metrics.addAll(metrics); + } + return this; + } + + public Builder addMetrics(DescribeStatsResponseDescribeRootMetricsItem metrics) { + this.metrics.add(metrics); + return this; + } + + public Builder addAllMetrics(List metrics) { + if (metrics != null) { + this.metrics.addAll(metrics); + } + return this; + } + + /** + *

Debug information.

+ */ + @JsonSetter(value = "debug", nulls = Nulls.SKIP) + public Builder debug(Optional debug) { + this.debug = debug; + return this; + } + + public Builder debug(DescribeStatsResponseDescribeRootDebug debug) { + this.debug = Optional.ofNullable(debug); + return this; + } + + public Builder debug(Nullable debug) { + if (debug.isNull()) { + this.debug = null; + } else if (debug.isEmpty()) { + this.debug = Optional.empty(); + } else { + this.debug = Optional.of(debug.get()); + } + return this; + } + + public DescribeStatsResponseDescribeRoot build() { + return new DescribeStatsResponseDescribeRoot(nodes, views, metrics, debug, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeRootDebug.java b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeRootDebug.java new file mode 100644 index 00000000..d12efa8d --- /dev/null +++ b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeRootDebug.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DescribeStatsResponseDescribeRootDebug.Builder.class) +public final class DescribeStatsResponseDescribeRootDebug { + private final Optional requestId; + + private final Map additionalProperties; + + private DescribeStatsResponseDescribeRootDebug( + Optional requestId, Map additionalProperties) { + this.requestId = requestId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unique request identifier for debugging. + */ + @JsonIgnore + public Optional getRequestId() { + if (requestId == null) { + return Optional.empty(); + } + return requestId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("request_id") + private Optional _getRequestId() { + return requestId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeStatsResponseDescribeRootDebug + && equalTo((DescribeStatsResponseDescribeRootDebug) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DescribeStatsResponseDescribeRootDebug other) { + return requestId.equals(other.requestId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.requestId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional requestId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DescribeStatsResponseDescribeRootDebug other) { + requestId(other.getRequestId()); + return this; + } + + /** + *

Unique request identifier for debugging.

+ */ + @JsonSetter(value = "request_id", nulls = Nulls.SKIP) + public Builder requestId(Optional requestId) { + this.requestId = requestId; + return this; + } + + public Builder requestId(String requestId) { + this.requestId = Optional.ofNullable(requestId); + return this; + } + + public Builder requestId(Nullable requestId) { + if (requestId.isNull()) { + this.requestId = null; + } else if (requestId.isEmpty()) { + this.requestId = Optional.empty(); + } else { + this.requestId = Optional.of(requestId.get()); + } + return this; + } + + public DescribeStatsResponseDescribeRootDebug build() { + return new DescribeStatsResponseDescribeRootDebug(requestId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeRootMetricsItem.java b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeRootMetricsItem.java new file mode 100644 index 00000000..44b304aa --- /dev/null +++ b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeRootMetricsItem.java @@ -0,0 +1,228 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DescribeStatsResponseDescribeRootMetricsItem.Builder.class) +public final class DescribeStatsResponseDescribeRootMetricsItem { + private final String name; + + private final String nodePath; + + private final List supportedEngines; + + private final Map additionalProperties; + + private DescribeStatsResponseDescribeRootMetricsItem( + String name, String nodePath, List supportedEngines, Map additionalProperties) { + this.name = name; + this.nodePath = nodePath; + this.supportedEngines = supportedEngines; + this.additionalProperties = additionalProperties; + } + + /** + * @return The metric name. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The node path this metric operates on. + */ + @JsonProperty("node_path") + public String getNodePath() { + return nodePath; + } + + /** + * @return Query engines that support this metric. + */ + @JsonProperty("supported_engines") + public List getSupportedEngines() { + return supportedEngines; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeStatsResponseDescribeRootMetricsItem + && equalTo((DescribeStatsResponseDescribeRootMetricsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DescribeStatsResponseDescribeRootMetricsItem other) { + return name.equals(other.name) + && nodePath.equals(other.nodePath) + && supportedEngines.equals(other.supportedEngines); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.nodePath, this.supportedEngines); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

The metric name.

+ */ + NodePathStage name(@NotNull String name); + + Builder from(DescribeStatsResponseDescribeRootMetricsItem other); + } + + public interface NodePathStage { + /** + *

The node path this metric operates on.

+ */ + _FinalStage nodePath(@NotNull String nodePath); + } + + public interface _FinalStage { + DescribeStatsResponseDescribeRootMetricsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Query engines that support this metric.

+ */ + _FinalStage supportedEngines(List supportedEngines); + + _FinalStage addSupportedEngines(String supportedEngines); + + _FinalStage addAllSupportedEngines(List supportedEngines); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, NodePathStage, _FinalStage { + private String name; + + private String nodePath; + + private List supportedEngines = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DescribeStatsResponseDescribeRootMetricsItem other) { + name(other.getName()); + nodePath(other.getNodePath()); + supportedEngines(other.getSupportedEngines()); + return this; + } + + /** + *

The metric name.

+ *

The metric name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public NodePathStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The node path this metric operates on.

+ *

The node path this metric operates on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("node_path") + public _FinalStage nodePath(@NotNull String nodePath) { + this.nodePath = Objects.requireNonNull(nodePath, "nodePath must not be null"); + return this; + } + + /** + *

Query engines that support this metric.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllSupportedEngines(List supportedEngines) { + if (supportedEngines != null) { + this.supportedEngines.addAll(supportedEngines); + } + return this; + } + + /** + *

Query engines that support this metric.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addSupportedEngines(String supportedEngines) { + this.supportedEngines.add(supportedEngines); + return this; + } + + /** + *

Query engines that support this metric.

+ */ + @java.lang.Override + @JsonSetter(value = "supported_engines", nulls = Nulls.SKIP) + public _FinalStage supportedEngines(List supportedEngines) { + this.supportedEngines.clear(); + if (supportedEngines != null) { + this.supportedEngines.addAll(supportedEngines); + } + return this; + } + + @java.lang.Override + public DescribeStatsResponseDescribeRootMetricsItem build() { + return new DescribeStatsResponseDescribeRootMetricsItem( + name, nodePath, supportedEngines, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeView.java b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeView.java new file mode 100644 index 00000000..dc30e172 --- /dev/null +++ b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeView.java @@ -0,0 +1,644 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DescribeStatsResponseDescribeView.Builder.class) +public final class DescribeStatsResponseDescribeView { + private final String view; + + private final String resource; + + private final String model; + + private final String engine; + + private final List columns; + + private final List sortableColumns; + + private final List associations; + + private final List metrics; + + private final Optional>> sample; + + private final Optional debug; + + private final Map additionalProperties; + + private DescribeStatsResponseDescribeView( + String view, + String resource, + String model, + String engine, + List columns, + List sortableColumns, + List associations, + List metrics, + Optional>> sample, + Optional debug, + Map additionalProperties) { + this.view = view; + this.resource = resource; + this.model = model; + this.engine = engine; + this.columns = columns; + this.sortableColumns = sortableColumns; + this.associations = associations; + this.metrics = metrics; + this.sample = sample; + this.debug = debug; + this.additionalProperties = additionalProperties; + } + + /** + * @return The view name being described. + */ + @JsonProperty("view") + public String getView() { + return view; + } + + /** + * @return The API resource name. + */ + @JsonProperty("resource") + public String getResource() { + return resource; + } + + /** + * @return The underlying model class. + */ + @JsonProperty("model") + public String getModel() { + return model; + } + + /** + * @return The query engine being used. + */ + @JsonProperty("engine") + public String getEngine() { + return engine; + } + + /** + * @return Available columns. + */ + @JsonProperty("columns") + public List getColumns() { + return columns; + } + + /** + * @return Columns that can be used for sorting. + */ + @JsonProperty("sortable_columns") + public List getSortableColumns() { + return sortableColumns; + } + + /** + * @return Available associations. + */ + @JsonProperty("associations") + public List getAssociations() { + return associations; + } + + /** + * @return Available metrics. + */ + @JsonProperty("metrics") + public List getMetrics() { + return metrics; + } + + /** + * @return Sample data rows. + */ + @JsonIgnore + public Optional>> getSample() { + if (sample == null) { + return Optional.empty(); + } + return sample; + } + + /** + * @return Debug information. + */ + @JsonIgnore + public Optional getDebug() { + if (debug == null) { + return Optional.empty(); + } + return debug; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("sample") + private Optional>> _getSample() { + return sample; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("debug") + private Optional _getDebug() { + return debug; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeStatsResponseDescribeView && equalTo((DescribeStatsResponseDescribeView) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DescribeStatsResponseDescribeView other) { + return view.equals(other.view) + && resource.equals(other.resource) + && model.equals(other.model) + && engine.equals(other.engine) + && columns.equals(other.columns) + && sortableColumns.equals(other.sortableColumns) + && associations.equals(other.associations) + && metrics.equals(other.metrics) + && sample.equals(other.sample) + && debug.equals(other.debug); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.view, + this.resource, + this.model, + this.engine, + this.columns, + this.sortableColumns, + this.associations, + this.metrics, + this.sample, + this.debug); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ViewStage builder() { + return new Builder(); + } + + public interface ViewStage { + /** + *

The view name being described.

+ */ + ResourceStage view(@NotNull String view); + + Builder from(DescribeStatsResponseDescribeView other); + } + + public interface ResourceStage { + /** + *

The API resource name.

+ */ + ModelStage resource(@NotNull String resource); + } + + public interface ModelStage { + /** + *

The underlying model class.

+ */ + EngineStage model(@NotNull String model); + } + + public interface EngineStage { + /** + *

The query engine being used.

+ */ + _FinalStage engine(@NotNull String engine); + } + + public interface _FinalStage { + DescribeStatsResponseDescribeView build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Available columns.

+ */ + _FinalStage columns(List columns); + + _FinalStage addColumns(String columns); + + _FinalStage addAllColumns(List columns); + + /** + *

Columns that can be used for sorting.

+ */ + _FinalStage sortableColumns(List sortableColumns); + + _FinalStage addSortableColumns(String sortableColumns); + + _FinalStage addAllSortableColumns(List sortableColumns); + + /** + *

Available associations.

+ */ + _FinalStage associations(List associations); + + _FinalStage addAssociations(DescribeStatsResponseDescribeViewAssociationsItem associations); + + _FinalStage addAllAssociations(List associations); + + /** + *

Available metrics.

+ */ + _FinalStage metrics(List metrics); + + _FinalStage addMetrics(DescribeStatsResponseDescribeViewMetricsItem metrics); + + _FinalStage addAllMetrics(List metrics); + + /** + *

Sample data rows.

+ */ + _FinalStage sample(Optional>> sample); + + _FinalStage sample(List> sample); + + _FinalStage sample(Nullable>> sample); + + /** + *

Debug information.

+ */ + _FinalStage debug(Optional debug); + + _FinalStage debug(DescribeStatsResponseDescribeViewDebug debug); + + _FinalStage debug(Nullable debug); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ViewStage, ResourceStage, ModelStage, EngineStage, _FinalStage { + private String view; + + private String resource; + + private String model; + + private String engine; + + private Optional debug = Optional.empty(); + + private Optional>> sample = Optional.empty(); + + private List metrics = new ArrayList<>(); + + private List associations = new ArrayList<>(); + + private List sortableColumns = new ArrayList<>(); + + private List columns = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DescribeStatsResponseDescribeView other) { + view(other.getView()); + resource(other.getResource()); + model(other.getModel()); + engine(other.getEngine()); + columns(other.getColumns()); + sortableColumns(other.getSortableColumns()); + associations(other.getAssociations()); + metrics(other.getMetrics()); + sample(other.getSample()); + debug(other.getDebug()); + return this; + } + + /** + *

The view name being described.

+ *

The view name being described.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("view") + public ResourceStage view(@NotNull String view) { + this.view = Objects.requireNonNull(view, "view must not be null"); + return this; + } + + /** + *

The API resource name.

+ *

The API resource name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource") + public ModelStage resource(@NotNull String resource) { + this.resource = Objects.requireNonNull(resource, "resource must not be null"); + return this; + } + + /** + *

The underlying model class.

+ *

The underlying model class.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("model") + public EngineStage model(@NotNull String model) { + this.model = Objects.requireNonNull(model, "model must not be null"); + return this; + } + + /** + *

The query engine being used.

+ *

The query engine being used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("engine") + public _FinalStage engine(@NotNull String engine) { + this.engine = Objects.requireNonNull(engine, "engine must not be null"); + return this; + } + + /** + *

Debug information.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage debug(Nullable debug) { + if (debug.isNull()) { + this.debug = null; + } else if (debug.isEmpty()) { + this.debug = Optional.empty(); + } else { + this.debug = Optional.of(debug.get()); + } + return this; + } + + /** + *

Debug information.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage debug(DescribeStatsResponseDescribeViewDebug debug) { + this.debug = Optional.ofNullable(debug); + return this; + } + + /** + *

Debug information.

+ */ + @java.lang.Override + @JsonSetter(value = "debug", nulls = Nulls.SKIP) + public _FinalStage debug(Optional debug) { + this.debug = debug; + return this; + } + + /** + *

Sample data rows.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sample(Nullable>> sample) { + if (sample.isNull()) { + this.sample = null; + } else if (sample.isEmpty()) { + this.sample = Optional.empty(); + } else { + this.sample = Optional.of(sample.get()); + } + return this; + } + + /** + *

Sample data rows.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sample(List> sample) { + this.sample = Optional.ofNullable(sample); + return this; + } + + /** + *

Sample data rows.

+ */ + @java.lang.Override + @JsonSetter(value = "sample", nulls = Nulls.SKIP) + public _FinalStage sample(Optional>> sample) { + this.sample = sample; + return this; + } + + /** + *

Available metrics.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllMetrics(List metrics) { + if (metrics != null) { + this.metrics.addAll(metrics); + } + return this; + } + + /** + *

Available metrics.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addMetrics(DescribeStatsResponseDescribeViewMetricsItem metrics) { + this.metrics.add(metrics); + return this; + } + + /** + *

Available metrics.

+ */ + @java.lang.Override + @JsonSetter(value = "metrics", nulls = Nulls.SKIP) + public _FinalStage metrics(List metrics) { + this.metrics.clear(); + if (metrics != null) { + this.metrics.addAll(metrics); + } + return this; + } + + /** + *

Available associations.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllAssociations(List associations) { + if (associations != null) { + this.associations.addAll(associations); + } + return this; + } + + /** + *

Available associations.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAssociations(DescribeStatsResponseDescribeViewAssociationsItem associations) { + this.associations.add(associations); + return this; + } + + /** + *

Available associations.

+ */ + @java.lang.Override + @JsonSetter(value = "associations", nulls = Nulls.SKIP) + public _FinalStage associations(List associations) { + this.associations.clear(); + if (associations != null) { + this.associations.addAll(associations); + } + return this; + } + + /** + *

Columns that can be used for sorting.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllSortableColumns(List sortableColumns) { + if (sortableColumns != null) { + this.sortableColumns.addAll(sortableColumns); + } + return this; + } + + /** + *

Columns that can be used for sorting.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addSortableColumns(String sortableColumns) { + this.sortableColumns.add(sortableColumns); + return this; + } + + /** + *

Columns that can be used for sorting.

+ */ + @java.lang.Override + @JsonSetter(value = "sortable_columns", nulls = Nulls.SKIP) + public _FinalStage sortableColumns(List sortableColumns) { + this.sortableColumns.clear(); + if (sortableColumns != null) { + this.sortableColumns.addAll(sortableColumns); + } + return this; + } + + /** + *

Available columns.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllColumns(List columns) { + if (columns != null) { + this.columns.addAll(columns); + } + return this; + } + + /** + *

Available columns.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addColumns(String columns) { + this.columns.add(columns); + return this; + } + + /** + *

Available columns.

+ */ + @java.lang.Override + @JsonSetter(value = "columns", nulls = Nulls.SKIP) + public _FinalStage columns(List columns) { + this.columns.clear(); + if (columns != null) { + this.columns.addAll(columns); + } + return this; + } + + @java.lang.Override + public DescribeStatsResponseDescribeView build() { + return new DescribeStatsResponseDescribeView( + view, + resource, + model, + engine, + columns, + sortableColumns, + associations, + metrics, + sample, + debug, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeViewAssociationsItem.java b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeViewAssociationsItem.java new file mode 100644 index 00000000..1bc72dcd --- /dev/null +++ b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeViewAssociationsItem.java @@ -0,0 +1,383 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DescribeStatsResponseDescribeViewAssociationsItem.Builder.class) +public final class DescribeStatsResponseDescribeViewAssociationsItem { + private final String name; + + private final String type; + + private final Optional model; + + private final Optional path; + + private final Optional eventName; + + private final Map additionalProperties; + + private DescribeStatsResponseDescribeViewAssociationsItem( + String name, + String type, + Optional model, + Optional path, + Optional eventName, + Map additionalProperties) { + this.name = name; + this.type = type; + this.model = model; + this.path = path; + this.eventName = eventName; + this.additionalProperties = additionalProperties; + } + + /** + * @return The association name. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The type (belongs_to, has_many, has_one, event, namespace). + */ + @JsonProperty("type") + public String getType() { + return type; + } + + /** + * @return The associated model class name (for model associations). + */ + @JsonIgnore + public Optional getModel() { + if (model == null) { + return Optional.empty(); + } + return model; + } + + /** + * @return The full path (for event associations). + */ + @JsonIgnore + public Optional getPath() { + if (path == null) { + return Optional.empty(); + } + return path; + } + + /** + * @return The event name (for event type). + */ + @JsonIgnore + public Optional getEventName() { + if (eventName == null) { + return Optional.empty(); + } + return eventName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("model") + private Optional _getModel() { + return model; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("path") + private Optional _getPath() { + return path; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("event_name") + private Optional _getEventName() { + return eventName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeStatsResponseDescribeViewAssociationsItem + && equalTo((DescribeStatsResponseDescribeViewAssociationsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DescribeStatsResponseDescribeViewAssociationsItem other) { + return name.equals(other.name) + && type.equals(other.type) + && model.equals(other.model) + && path.equals(other.path) + && eventName.equals(other.eventName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.type, this.model, this.path, this.eventName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

The association name.

+ */ + TypeStage name(@NotNull String name); + + Builder from(DescribeStatsResponseDescribeViewAssociationsItem other); + } + + public interface TypeStage { + /** + *

The type (belongs_to, has_many, has_one, event, namespace).

+ */ + _FinalStage type(@NotNull String type); + } + + public interface _FinalStage { + DescribeStatsResponseDescribeViewAssociationsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The associated model class name (for model associations).

+ */ + _FinalStage model(Optional model); + + _FinalStage model(String model); + + _FinalStage model(Nullable model); + + /** + *

The full path (for event associations).

+ */ + _FinalStage path(Optional path); + + _FinalStage path(String path); + + _FinalStage path(Nullable path); + + /** + *

The event name (for event type).

+ */ + _FinalStage eventName(Optional eventName); + + _FinalStage eventName(String eventName); + + _FinalStage eventName(Nullable eventName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, TypeStage, _FinalStage { + private String name; + + private String type; + + private Optional eventName = Optional.empty(); + + private Optional path = Optional.empty(); + + private Optional model = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DescribeStatsResponseDescribeViewAssociationsItem other) { + name(other.getName()); + type(other.getType()); + model(other.getModel()); + path(other.getPath()); + eventName(other.getEventName()); + return this; + } + + /** + *

The association name.

+ *

The association name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public TypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The type (belongs_to, has_many, has_one, event, namespace).

+ *

The type (belongs_to, has_many, has_one, event, namespace).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

The event name (for event type).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage eventName(Nullable eventName) { + if (eventName.isNull()) { + this.eventName = null; + } else if (eventName.isEmpty()) { + this.eventName = Optional.empty(); + } else { + this.eventName = Optional.of(eventName.get()); + } + return this; + } + + /** + *

The event name (for event type).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage eventName(String eventName) { + this.eventName = Optional.ofNullable(eventName); + return this; + } + + /** + *

The event name (for event type).

+ */ + @java.lang.Override + @JsonSetter(value = "event_name", nulls = Nulls.SKIP) + public _FinalStage eventName(Optional eventName) { + this.eventName = eventName; + return this; + } + + /** + *

The full path (for event associations).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage path(Nullable path) { + if (path.isNull()) { + this.path = null; + } else if (path.isEmpty()) { + this.path = Optional.empty(); + } else { + this.path = Optional.of(path.get()); + } + return this; + } + + /** + *

The full path (for event associations).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage path(String path) { + this.path = Optional.ofNullable(path); + return this; + } + + /** + *

The full path (for event associations).

+ */ + @java.lang.Override + @JsonSetter(value = "path", nulls = Nulls.SKIP) + public _FinalStage path(Optional path) { + this.path = path; + return this; + } + + /** + *

The associated model class name (for model associations).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage model(Nullable model) { + if (model.isNull()) { + this.model = null; + } else if (model.isEmpty()) { + this.model = Optional.empty(); + } else { + this.model = Optional.of(model.get()); + } + return this; + } + + /** + *

The associated model class name (for model associations).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage model(String model) { + this.model = Optional.ofNullable(model); + return this; + } + + /** + *

The associated model class name (for model associations).

+ */ + @java.lang.Override + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public _FinalStage model(Optional model) { + this.model = model; + return this; + } + + @java.lang.Override + public DescribeStatsResponseDescribeViewAssociationsItem build() { + return new DescribeStatsResponseDescribeViewAssociationsItem( + name, type, model, path, eventName, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeViewDebug.java b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeViewDebug.java new file mode 100644 index 00000000..1a0e4aec --- /dev/null +++ b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeViewDebug.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DescribeStatsResponseDescribeViewDebug.Builder.class) +public final class DescribeStatsResponseDescribeViewDebug { + private final Optional requestId; + + private final Map additionalProperties; + + private DescribeStatsResponseDescribeViewDebug( + Optional requestId, Map additionalProperties) { + this.requestId = requestId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unique request identifier for debugging. + */ + @JsonIgnore + public Optional getRequestId() { + if (requestId == null) { + return Optional.empty(); + } + return requestId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("request_id") + private Optional _getRequestId() { + return requestId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeStatsResponseDescribeViewDebug + && equalTo((DescribeStatsResponseDescribeViewDebug) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DescribeStatsResponseDescribeViewDebug other) { + return requestId.equals(other.requestId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.requestId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional requestId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DescribeStatsResponseDescribeViewDebug other) { + requestId(other.getRequestId()); + return this; + } + + /** + *

Unique request identifier for debugging.

+ */ + @JsonSetter(value = "request_id", nulls = Nulls.SKIP) + public Builder requestId(Optional requestId) { + this.requestId = requestId; + return this; + } + + public Builder requestId(String requestId) { + this.requestId = Optional.ofNullable(requestId); + return this; + } + + public Builder requestId(Nullable requestId) { + if (requestId.isNull()) { + this.requestId = null; + } else if (requestId.isEmpty()) { + this.requestId = Optional.empty(); + } else { + this.requestId = Optional.of(requestId.get()); + } + return this; + } + + public DescribeStatsResponseDescribeViewDebug build() { + return new DescribeStatsResponseDescribeViewDebug(requestId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeViewMetricsItem.java b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeViewMetricsItem.java new file mode 100644 index 00000000..319f0f2f --- /dev/null +++ b/src/main/java/com/whop/api/types/DescribeStatsResponseDescribeViewMetricsItem.java @@ -0,0 +1,228 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DescribeStatsResponseDescribeViewMetricsItem.Builder.class) +public final class DescribeStatsResponseDescribeViewMetricsItem { + private final String name; + + private final String nodePath; + + private final List supportedEngines; + + private final Map additionalProperties; + + private DescribeStatsResponseDescribeViewMetricsItem( + String name, String nodePath, List supportedEngines, Map additionalProperties) { + this.name = name; + this.nodePath = nodePath; + this.supportedEngines = supportedEngines; + this.additionalProperties = additionalProperties; + } + + /** + * @return The metric name. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The node path this metric operates on. + */ + @JsonProperty("node_path") + public String getNodePath() { + return nodePath; + } + + /** + * @return Query engines that support this metric. + */ + @JsonProperty("supported_engines") + public List getSupportedEngines() { + return supportedEngines; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DescribeStatsResponseDescribeViewMetricsItem + && equalTo((DescribeStatsResponseDescribeViewMetricsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DescribeStatsResponseDescribeViewMetricsItem other) { + return name.equals(other.name) + && nodePath.equals(other.nodePath) + && supportedEngines.equals(other.supportedEngines); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.nodePath, this.supportedEngines); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

The metric name.

+ */ + NodePathStage name(@NotNull String name); + + Builder from(DescribeStatsResponseDescribeViewMetricsItem other); + } + + public interface NodePathStage { + /** + *

The node path this metric operates on.

+ */ + _FinalStage nodePath(@NotNull String nodePath); + } + + public interface _FinalStage { + DescribeStatsResponseDescribeViewMetricsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Query engines that support this metric.

+ */ + _FinalStage supportedEngines(List supportedEngines); + + _FinalStage addSupportedEngines(String supportedEngines); + + _FinalStage addAllSupportedEngines(List supportedEngines); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, NodePathStage, _FinalStage { + private String name; + + private String nodePath; + + private List supportedEngines = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DescribeStatsResponseDescribeViewMetricsItem other) { + name(other.getName()); + nodePath(other.getNodePath()); + supportedEngines(other.getSupportedEngines()); + return this; + } + + /** + *

The metric name.

+ *

The metric name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public NodePathStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The node path this metric operates on.

+ *

The node path this metric operates on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("node_path") + public _FinalStage nodePath(@NotNull String nodePath) { + this.nodePath = Objects.requireNonNull(nodePath, "nodePath must not be null"); + return this; + } + + /** + *

Query engines that support this metric.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllSupportedEngines(List supportedEngines) { + if (supportedEngines != null) { + this.supportedEngines.addAll(supportedEngines); + } + return this; + } + + /** + *

Query engines that support this metric.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addSupportedEngines(String supportedEngines) { + this.supportedEngines.add(supportedEngines); + return this; + } + + /** + *

Query engines that support this metric.

+ */ + @java.lang.Override + @JsonSetter(value = "supported_engines", nulls = Nulls.SKIP) + public _FinalStage supportedEngines(List supportedEngines) { + this.supportedEngines.clear(); + if (supportedEngines != null) { + this.supportedEngines.addAll(supportedEngines); + } + return this; + } + + @java.lang.Override + public DescribeStatsResponseDescribeViewMetricsItem build() { + return new DescribeStatsResponseDescribeViewMetricsItem( + name, nodePath, supportedEngines, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DetailedTargetingOption.java b/src/main/java/com/whop/api/types/DetailedTargetingOption.java new file mode 100644 index 00000000..68f605c9 --- /dev/null +++ b/src/main/java/com/whop/api/types/DetailedTargetingOption.java @@ -0,0 +1,464 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DetailedTargetingOption.Builder.class) +public final class DetailedTargetingOption { + private final Optional audienceSizeLowerBound; + + private final Optional audienceSizeUpperBound; + + private final Optional behaviorType; + + private final Optional description; + + private final String id; + + private final String name; + + private final Map additionalProperties; + + private DetailedTargetingOption( + Optional audienceSizeLowerBound, + Optional audienceSizeUpperBound, + Optional behaviorType, + Optional description, + String id, + String name, + Map additionalProperties) { + this.audienceSizeLowerBound = audienceSizeLowerBound; + this.audienceSizeUpperBound = audienceSizeUpperBound; + this.behaviorType = behaviorType; + this.description = description; + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return Low end of the ad platform's estimate of how many people this option can reach. Null when the platform doesn't publish one. + */ + @JsonIgnore + public Optional getAudienceSizeLowerBound() { + if (audienceSizeLowerBound == null) { + return Optional.empty(); + } + return audienceSizeLowerBound; + } + + /** + * @return High end of the ad platform's estimate of how many people this option can reach. Null when the platform doesn't publish one. + */ + @JsonIgnore + public Optional getAudienceSizeUpperBound() { + if (audienceSizeUpperBound == null) { + return Optional.empty(); + } + return audienceSizeUpperBound; + } + + /** + * @return What a behavior category is measured on, on ad platforms that scope them. Send it back on the detailed_targeting.behaviors entry alongside the id. Null for options that aren't scoped. + */ + @JsonIgnore + public Optional getBehaviorType() { + if (behaviorType == null) { + return Optional.empty(); + } + return behaviorType; + } + + /** + * @return The ad platform's description of who the option covers, when it publishes one. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The ad platform's ID for the option in its targeting taxonomy. Use it as the id of a detailed_targeting entry. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Display name, such as Movies. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("audience_size_lower_bound") + private Optional _getAudienceSizeLowerBound() { + return audienceSizeLowerBound; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("audience_size_upper_bound") + private Optional _getAudienceSizeUpperBound() { + return audienceSizeUpperBound; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("behavior_type") + private Optional _getBehaviorType() { + return behaviorType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DetailedTargetingOption && equalTo((DetailedTargetingOption) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DetailedTargetingOption other) { + return audienceSizeLowerBound.equals(other.audienceSizeLowerBound) + && audienceSizeUpperBound.equals(other.audienceSizeUpperBound) + && behaviorType.equals(other.behaviorType) + && description.equals(other.description) + && id.equals(other.id) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.audienceSizeLowerBound, + this.audienceSizeUpperBound, + this.behaviorType, + this.description, + this.id, + this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The ad platform's ID for the option in its targeting taxonomy. Use it as the id of a detailed_targeting entry.

+ */ + NameStage id(@NotNull String id); + + Builder from(DetailedTargetingOption other); + } + + public interface NameStage { + /** + *

Display name, such as Movies.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + DetailedTargetingOption build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Low end of the ad platform's estimate of how many people this option can reach. Null when the platform doesn't publish one.

+ */ + _FinalStage audienceSizeLowerBound(Optional audienceSizeLowerBound); + + _FinalStage audienceSizeLowerBound(Double audienceSizeLowerBound); + + _FinalStage audienceSizeLowerBound(Nullable audienceSizeLowerBound); + + /** + *

High end of the ad platform's estimate of how many people this option can reach. Null when the platform doesn't publish one.

+ */ + _FinalStage audienceSizeUpperBound(Optional audienceSizeUpperBound); + + _FinalStage audienceSizeUpperBound(Double audienceSizeUpperBound); + + _FinalStage audienceSizeUpperBound(Nullable audienceSizeUpperBound); + + /** + *

What a behavior category is measured on, on ad platforms that scope them. Send it back on the detailed_targeting.behaviors entry alongside the id. Null for options that aren't scoped.

+ */ + _FinalStage behaviorType(Optional behaviorType); + + _FinalStage behaviorType(DetailedTargetingOptionBehaviorType behaviorType); + + _FinalStage behaviorType(Nullable behaviorType); + + /** + *

The ad platform's description of who the option covers, when it publishes one.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + private Optional description = Optional.empty(); + + private Optional behaviorType = Optional.empty(); + + private Optional audienceSizeUpperBound = Optional.empty(); + + private Optional audienceSizeLowerBound = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DetailedTargetingOption other) { + audienceSizeLowerBound(other.getAudienceSizeLowerBound()); + audienceSizeUpperBound(other.getAudienceSizeUpperBound()); + behaviorType(other.getBehaviorType()); + description(other.getDescription()); + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

The ad platform's ID for the option in its targeting taxonomy. Use it as the id of a detailed_targeting entry.

+ *

The ad platform's ID for the option in its targeting taxonomy. Use it as the id of a detailed_targeting entry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Display name, such as Movies.

+ *

Display name, such as Movies.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The ad platform's description of who the option covers, when it publishes one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

The ad platform's description of who the option covers, when it publishes one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

The ad platform's description of who the option covers, when it publishes one.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

What a behavior category is measured on, on ad platforms that scope them. Send it back on the detailed_targeting.behaviors entry alongside the id. Null for options that aren't scoped.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage behaviorType(Nullable behaviorType) { + if (behaviorType.isNull()) { + this.behaviorType = null; + } else if (behaviorType.isEmpty()) { + this.behaviorType = Optional.empty(); + } else { + this.behaviorType = Optional.of(behaviorType.get()); + } + return this; + } + + /** + *

What a behavior category is measured on, on ad platforms that scope them. Send it back on the detailed_targeting.behaviors entry alongside the id. Null for options that aren't scoped.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage behaviorType(DetailedTargetingOptionBehaviorType behaviorType) { + this.behaviorType = Optional.ofNullable(behaviorType); + return this; + } + + /** + *

What a behavior category is measured on, on ad platforms that scope them. Send it back on the detailed_targeting.behaviors entry alongside the id. Null for options that aren't scoped.

+ */ + @java.lang.Override + @JsonSetter(value = "behavior_type", nulls = Nulls.SKIP) + public _FinalStage behaviorType(Optional behaviorType) { + this.behaviorType = behaviorType; + return this; + } + + /** + *

High end of the ad platform's estimate of how many people this option can reach. Null when the platform doesn't publish one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage audienceSizeUpperBound(Nullable audienceSizeUpperBound) { + if (audienceSizeUpperBound.isNull()) { + this.audienceSizeUpperBound = null; + } else if (audienceSizeUpperBound.isEmpty()) { + this.audienceSizeUpperBound = Optional.empty(); + } else { + this.audienceSizeUpperBound = Optional.of(audienceSizeUpperBound.get()); + } + return this; + } + + /** + *

High end of the ad platform's estimate of how many people this option can reach. Null when the platform doesn't publish one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage audienceSizeUpperBound(Double audienceSizeUpperBound) { + this.audienceSizeUpperBound = Optional.ofNullable(audienceSizeUpperBound); + return this; + } + + /** + *

High end of the ad platform's estimate of how many people this option can reach. Null when the platform doesn't publish one.

+ */ + @java.lang.Override + @JsonSetter(value = "audience_size_upper_bound", nulls = Nulls.SKIP) + public _FinalStage audienceSizeUpperBound(Optional audienceSizeUpperBound) { + this.audienceSizeUpperBound = audienceSizeUpperBound; + return this; + } + + /** + *

Low end of the ad platform's estimate of how many people this option can reach. Null when the platform doesn't publish one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage audienceSizeLowerBound(Nullable audienceSizeLowerBound) { + if (audienceSizeLowerBound.isNull()) { + this.audienceSizeLowerBound = null; + } else if (audienceSizeLowerBound.isEmpty()) { + this.audienceSizeLowerBound = Optional.empty(); + } else { + this.audienceSizeLowerBound = Optional.of(audienceSizeLowerBound.get()); + } + return this; + } + + /** + *

Low end of the ad platform's estimate of how many people this option can reach. Null when the platform doesn't publish one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage audienceSizeLowerBound(Double audienceSizeLowerBound) { + this.audienceSizeLowerBound = Optional.ofNullable(audienceSizeLowerBound); + return this; + } + + /** + *

Low end of the ad platform's estimate of how many people this option can reach. Null when the platform doesn't publish one.

+ */ + @java.lang.Override + @JsonSetter(value = "audience_size_lower_bound", nulls = Nulls.SKIP) + public _FinalStage audienceSizeLowerBound(Optional audienceSizeLowerBound) { + this.audienceSizeLowerBound = audienceSizeLowerBound; + return this; + } + + @java.lang.Override + public DetailedTargetingOption build() { + return new DetailedTargetingOption( + audienceSizeLowerBound, + audienceSizeUpperBound, + behaviorType, + description, + id, + name, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DetailedTargetingOptionBehaviorType.java b/src/main/java/com/whop/api/types/DetailedTargetingOptionBehaviorType.java new file mode 100644 index 00000000..9189b95a --- /dev/null +++ b/src/main/java/com/whop/api/types/DetailedTargetingOptionBehaviorType.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DetailedTargetingOptionBehaviorType { + public static final DetailedTargetingOptionBehaviorType HASHTAG = + new DetailedTargetingOptionBehaviorType(Value.HASHTAG, "hashtag"); + + public static final DetailedTargetingOptionBehaviorType CREATOR = + new DetailedTargetingOptionBehaviorType(Value.CREATOR, "creator"); + + public static final DetailedTargetingOptionBehaviorType VIDEO = + new DetailedTargetingOptionBehaviorType(Value.VIDEO, "video"); + + private final Value value; + + private final String string; + + DetailedTargetingOptionBehaviorType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof DetailedTargetingOptionBehaviorType + && this.string.equals(((DetailedTargetingOptionBehaviorType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HASHTAG: + return visitor.visitHashtag(); + case CREATOR: + return visitor.visitCreator(); + case VIDEO: + return visitor.visitVideo(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DetailedTargetingOptionBehaviorType valueOf(String value) { + switch (value) { + case "hashtag": + return HASHTAG; + case "creator": + return CREATOR; + case "video": + return VIDEO; + default: + return new DetailedTargetingOptionBehaviorType(Value.UNKNOWN, value); + } + } + + public enum Value { + VIDEO, + + CREATOR, + + HASHTAG, + + UNKNOWN + } + + public interface Visitor { + T visitVideo(); + + T visitCreator(); + + T visitHashtag(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Direction.java b/src/main/java/com/whop/api/types/Direction.java new file mode 100644 index 00000000..cb89002f --- /dev/null +++ b/src/main/java/com/whop/api/types/Direction.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class Direction { + public static final Direction ASC = new Direction(Value.ASC, "asc"); + + public static final Direction DESC = new Direction(Value.DESC, "desc"); + + private final Value value; + + private final String string; + + Direction(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof Direction && this.string.equals(((Direction) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASC: + return visitor.visitAsc(); + case DESC: + return visitor.visitDesc(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static Direction valueOf(String value) { + switch (value) { + case "asc": + return ASC; + case "desc": + return DESC; + default: + return new Direction(Value.UNKNOWN, value); + } + } + + public enum Value { + ASC, + + DESC, + + UNKNOWN + } + + public interface Visitor { + T visitAsc(); + + T visitDesc(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Dispute.java b/src/main/java/com/whop/api/types/Dispute.java new file mode 100644 index 00000000..8b86dc21 --- /dev/null +++ b/src/main/java/com/whop/api/types/Dispute.java @@ -0,0 +1,1288 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Dispute.Builder.class) +public final class Dispute { + private final Optional accountId; + + private final double amount; + + private final Optional buyer; + + private final String createdAt; + + private final String currency; + + private final DisputeEvidence evidence; + + private final Optional evidenceDueAt; + + private final boolean evidenceEditable; + + private final Optional evidenceLockedReason; + + private final Optional evidenceSubmittedAt; + + private final Optional generatedResponseAttachment; + + private final String id; + + private final boolean inquiry; + + private final List issuerComments; + + private final Optional payment; + + private final Optional planId; + + private final Optional productId; + + private final boolean rapidDisputeResolution; + + private final DisputeReason reason; + + private final Optional reasonCode; + + private final DisputeStatus status; + + private final String updatedAt; + + private final Map additionalProperties; + + private Dispute( + Optional accountId, + double amount, + Optional buyer, + String createdAt, + String currency, + DisputeEvidence evidence, + Optional evidenceDueAt, + boolean evidenceEditable, + Optional evidenceLockedReason, + Optional evidenceSubmittedAt, + Optional generatedResponseAttachment, + String id, + boolean inquiry, + List issuerComments, + Optional payment, + Optional planId, + Optional productId, + boolean rapidDisputeResolution, + DisputeReason reason, + Optional reasonCode, + DisputeStatus status, + String updatedAt, + Map additionalProperties) { + this.accountId = accountId; + this.amount = amount; + this.buyer = buyer; + this.createdAt = createdAt; + this.currency = currency; + this.evidence = evidence; + this.evidenceDueAt = evidenceDueAt; + this.evidenceEditable = evidenceEditable; + this.evidenceLockedReason = evidenceLockedReason; + this.evidenceSubmittedAt = evidenceSubmittedAt; + this.generatedResponseAttachment = generatedResponseAttachment; + this.id = id; + this.inquiry = inquiry; + this.issuerComments = issuerComments; + this.payment = payment; + this.planId = planId; + this.productId = productId; + this.rapidDisputeResolution = rapidDisputeResolution; + this.reason = reason; + this.reasonCode = reasonCode; + this.status = status; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account the dispute was filed against, prefixed biz_. + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The disputed amount, in whole units of currency. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The customer who filed the dispute. + */ + @JsonIgnore + public Optional getBuyer() { + if (buyer == null) { + return Optional.empty(); + } + return buyer; + } + + /** + * @return When the dispute was opened, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Three-letter ISO currency code of the disputed amount. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return The evidence packet sent to the processor to contest the dispute. + */ + @JsonProperty("evidence") + public DisputeEvidence getEvidence() { + return evidence; + } + + /** + * @return The deadline to submit evidence, as an ISO 8601 timestamp. Whop reserves the last 24 hours before the processor's own cutoff to forward the submission. + */ + @JsonIgnore + public Optional getEvidenceDueAt() { + if (evidenceDueAt == null) { + return Optional.empty(); + } + return evidenceDueAt; + } + + /** + * @return Whether evidence can still be changed and submitted. + */ + @JsonProperty("evidence_editable") + public boolean getEvidenceEditable() { + return evidenceEditable; + } + + /** + * @return Why evidence can no longer be edited. null while evidence_editable is true. + */ + @JsonIgnore + public Optional getEvidenceLockedReason() { + if (evidenceLockedReason == null) { + return Optional.empty(); + } + return evidenceLockedReason; + } + + /** + * @return When the evidence was submitted to the processor, as an ISO 8601 timestamp. + */ + @JsonIgnore + public Optional getEvidenceSubmittedAt() { + if (evidenceSubmittedAt == null) { + return Optional.empty(); + } + return evidenceSubmittedAt; + } + + /** + * @return The AI-generated representment document filed with the processor on the seller's behalf, once ready. Null until generation completes, and for disputes not using Whop Dispute Fighter. + */ + @JsonIgnore + public Optional getGeneratedResponseAttachment() { + if (generatedResponseAttachment == null) { + return Optional.empty(); + } + return generatedResponseAttachment; + } + + /** + * @return Dispute ID, prefixed dspt_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whether this is a pre-dispute inquiry rather than a formal chargeback. Inquiries follow the same lifecycle but move no funds unless one escalates. + */ + @JsonProperty("inquiry") + public boolean getInquiry() { + return inquiry; + } + + @JsonProperty("issuer_comments") + public List getIssuerComments() { + return issuerComments; + } + + /** + * @return The payment being disputed. + */ + @JsonIgnore + public Optional getPayment() { + if (payment == null) { + return Optional.empty(); + } + return payment; + } + + /** + * @return The plan the disputed payment was made on, prefixed plan_. + */ + @JsonIgnore + public Optional getPlanId() { + if (planId == null) { + return Optional.empty(); + } + return planId; + } + + /** + * @return The product the disputed payment was for, prefixed prod_. + */ + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + /** + * @return Whether Visa Rapid Dispute Resolution settled this automatically. These refund the customer without an evidence round. + */ + @JsonProperty("rapid_dispute_resolution") + public boolean getRapidDisputeResolution() { + return rapidDisputeResolution; + } + + /** + * @return Why the customer says they are disputing, normalized across card networks. other covers a code Whop has not categorized yet — read reason_code for the raw value. + */ + @JsonProperty("reason") + public DisputeReason getReason() { + return reason; + } + + /** + * @return The raw card-network or processor reason code, such as 10.4. + */ + @JsonIgnore + public Optional getReasonCode() { + if (reasonCode == null) { + return Optional.empty(); + } + return reasonCode; + } + + /** + * @return Where the dispute stands. needs_response is awaiting evidence, under_review is with the processor, won returned the funds to the seller, lost returned them to the customer, and closed ended without a ruling. A dispute past its evidence_due_at reports under_review — the window to respond has closed. + */ + @JsonProperty("status") + public DisputeStatus getStatus() { + return status; + } + + /** + * @return When the dispute was last changed, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("buyer") + private Optional _getBuyer() { + return buyer; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("evidence_due_at") + private Optional _getEvidenceDueAt() { + return evidenceDueAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("evidence_locked_reason") + private Optional _getEvidenceLockedReason() { + return evidenceLockedReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("evidence_submitted_at") + private Optional _getEvidenceSubmittedAt() { + return evidenceSubmittedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("generated_response_attachment") + private Optional _getGeneratedResponseAttachment() { + return generatedResponseAttachment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment") + private Optional _getPayment() { + return payment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan_id") + private Optional _getPlanId() { + return planId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reason_code") + private Optional _getReasonCode() { + return reasonCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Dispute && equalTo((Dispute) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Dispute other) { + return accountId.equals(other.accountId) + && amount == other.amount + && buyer.equals(other.buyer) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && evidence.equals(other.evidence) + && evidenceDueAt.equals(other.evidenceDueAt) + && evidenceEditable == other.evidenceEditable + && evidenceLockedReason.equals(other.evidenceLockedReason) + && evidenceSubmittedAt.equals(other.evidenceSubmittedAt) + && generatedResponseAttachment.equals(other.generatedResponseAttachment) + && id.equals(other.id) + && inquiry == other.inquiry + && issuerComments.equals(other.issuerComments) + && payment.equals(other.payment) + && planId.equals(other.planId) + && productId.equals(other.productId) + && rapidDisputeResolution == other.rapidDisputeResolution + && reason.equals(other.reason) + && reasonCode.equals(other.reasonCode) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.amount, + this.buyer, + this.createdAt, + this.currency, + this.evidence, + this.evidenceDueAt, + this.evidenceEditable, + this.evidenceLockedReason, + this.evidenceSubmittedAt, + this.generatedResponseAttachment, + this.id, + this.inquiry, + this.issuerComments, + this.payment, + this.planId, + this.productId, + this.rapidDisputeResolution, + this.reason, + this.reasonCode, + this.status, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The disputed amount, in whole units of currency.

+ */ + CreatedAtStage amount(double amount); + + Builder from(Dispute other); + } + + public interface CreatedAtStage { + /** + *

When the dispute was opened, as an ISO 8601 timestamp.

+ */ + CurrencyStage createdAt(@NotNull String createdAt); + } + + public interface CurrencyStage { + /** + *

Three-letter ISO currency code of the disputed amount.

+ */ + EvidenceStage currency(@NotNull String currency); + } + + public interface EvidenceStage { + /** + *

The evidence packet sent to the processor to contest the dispute.

+ */ + EvidenceEditableStage evidence(@NotNull DisputeEvidence evidence); + } + + public interface EvidenceEditableStage { + /** + *

Whether evidence can still be changed and submitted.

+ */ + IdStage evidenceEditable(boolean evidenceEditable); + } + + public interface IdStage { + /** + *

Dispute ID, prefixed dspt_.

+ */ + InquiryStage id(@NotNull String id); + } + + public interface InquiryStage { + /** + *

Whether this is a pre-dispute inquiry rather than a formal chargeback. Inquiries follow the same lifecycle but move no funds unless one escalates.

+ */ + RapidDisputeResolutionStage inquiry(boolean inquiry); + } + + public interface RapidDisputeResolutionStage { + /** + *

Whether Visa Rapid Dispute Resolution settled this automatically. These refund the customer without an evidence round.

+ */ + ReasonStage rapidDisputeResolution(boolean rapidDisputeResolution); + } + + public interface ReasonStage { + /** + *

Why the customer says they are disputing, normalized across card networks. other covers a code Whop has not categorized yet — read reason_code for the raw value.

+ */ + StatusStage reason(@NotNull DisputeReason reason); + } + + public interface StatusStage { + /** + *

Where the dispute stands. needs_response is awaiting evidence, under_review is with the processor, won returned the funds to the seller, lost returned them to the customer, and closed ended without a ruling. A dispute past its evidence_due_at reports under_review — the window to respond has closed.

+ */ + UpdatedAtStage status(@NotNull DisputeStatus status); + } + + public interface UpdatedAtStage { + /** + *

When the dispute was last changed, as an ISO 8601 timestamp.

+ */ + _FinalStage updatedAt(@NotNull String updatedAt); + } + + public interface _FinalStage { + Dispute build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account the dispute was filed against, prefixed biz_.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The customer who filed the dispute.

+ */ + _FinalStage buyer(Optional buyer); + + _FinalStage buyer(DisputeBuyer buyer); + + _FinalStage buyer(Nullable buyer); + + /** + *

The deadline to submit evidence, as an ISO 8601 timestamp. Whop reserves the last 24 hours before the processor's own cutoff to forward the submission.

+ */ + _FinalStage evidenceDueAt(Optional evidenceDueAt); + + _FinalStage evidenceDueAt(String evidenceDueAt); + + _FinalStage evidenceDueAt(Nullable evidenceDueAt); + + /** + *

Why evidence can no longer be edited. null while evidence_editable is true.

+ */ + _FinalStage evidenceLockedReason(Optional evidenceLockedReason); + + _FinalStage evidenceLockedReason(DisputeEvidenceLockedReason evidenceLockedReason); + + _FinalStage evidenceLockedReason(Nullable evidenceLockedReason); + + /** + *

When the evidence was submitted to the processor, as an ISO 8601 timestamp.

+ */ + _FinalStage evidenceSubmittedAt(Optional evidenceSubmittedAt); + + _FinalStage evidenceSubmittedAt(String evidenceSubmittedAt); + + _FinalStage evidenceSubmittedAt(Nullable evidenceSubmittedAt); + + /** + *

The AI-generated representment document filed with the processor on the seller's behalf, once ready. Null until generation completes, and for disputes not using Whop Dispute Fighter.

+ */ + _FinalStage generatedResponseAttachment(Optional generatedResponseAttachment); + + _FinalStage generatedResponseAttachment(DisputeAttachment generatedResponseAttachment); + + _FinalStage generatedResponseAttachment(Nullable generatedResponseAttachment); + + _FinalStage issuerComments(List issuerComments); + + _FinalStage addIssuerComments(DisputeIssuerComment issuerComments); + + _FinalStage addAllIssuerComments(List issuerComments); + + /** + *

The payment being disputed.

+ */ + _FinalStage payment(Optional payment); + + _FinalStage payment(DisputePayment payment); + + _FinalStage payment(Nullable payment); + + /** + *

The plan the disputed payment was made on, prefixed plan_.

+ */ + _FinalStage planId(Optional planId); + + _FinalStage planId(String planId); + + _FinalStage planId(Nullable planId); + + /** + *

The product the disputed payment was for, prefixed prod_.

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + + _FinalStage productId(Nullable productId); + + /** + *

The raw card-network or processor reason code, such as 10.4.

+ */ + _FinalStage reasonCode(Optional reasonCode); + + _FinalStage reasonCode(String reasonCode); + + _FinalStage reasonCode(Nullable reasonCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + CurrencyStage, + EvidenceStage, + EvidenceEditableStage, + IdStage, + InquiryStage, + RapidDisputeResolutionStage, + ReasonStage, + StatusStage, + UpdatedAtStage, + _FinalStage { + private double amount; + + private String createdAt; + + private String currency; + + private DisputeEvidence evidence; + + private boolean evidenceEditable; + + private String id; + + private boolean inquiry; + + private boolean rapidDisputeResolution; + + private DisputeReason reason; + + private DisputeStatus status; + + private String updatedAt; + + private Optional reasonCode = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional planId = Optional.empty(); + + private Optional payment = Optional.empty(); + + private List issuerComments = new ArrayList<>(); + + private Optional generatedResponseAttachment = Optional.empty(); + + private Optional evidenceSubmittedAt = Optional.empty(); + + private Optional evidenceLockedReason = Optional.empty(); + + private Optional evidenceDueAt = Optional.empty(); + + private Optional buyer = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Dispute other) { + accountId(other.getAccountId()); + amount(other.getAmount()); + buyer(other.getBuyer()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + evidence(other.getEvidence()); + evidenceDueAt(other.getEvidenceDueAt()); + evidenceEditable(other.getEvidenceEditable()); + evidenceLockedReason(other.getEvidenceLockedReason()); + evidenceSubmittedAt(other.getEvidenceSubmittedAt()); + generatedResponseAttachment(other.getGeneratedResponseAttachment()); + id(other.getId()); + inquiry(other.getInquiry()); + issuerComments(other.getIssuerComments()); + payment(other.getPayment()); + planId(other.getPlanId()); + productId(other.getProductId()); + rapidDisputeResolution(other.getRapidDisputeResolution()); + reason(other.getReason()); + reasonCode(other.getReasonCode()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

The disputed amount, in whole units of currency.

+ *

The disputed amount, in whole units of currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

When the dispute was opened, as an ISO 8601 timestamp.

+ *

When the dispute was opened, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Three-letter ISO currency code of the disputed amount.

+ *

Three-letter ISO currency code of the disputed amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public EvidenceStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The evidence packet sent to the processor to contest the dispute.

+ *

The evidence packet sent to the processor to contest the dispute.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("evidence") + public EvidenceEditableStage evidence(@NotNull DisputeEvidence evidence) { + this.evidence = Objects.requireNonNull(evidence, "evidence must not be null"); + return this; + } + + /** + *

Whether evidence can still be changed and submitted.

+ *

Whether evidence can still be changed and submitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("evidence_editable") + public IdStage evidenceEditable(boolean evidenceEditable) { + this.evidenceEditable = evidenceEditable; + return this; + } + + /** + *

Dispute ID, prefixed dspt_.

+ *

Dispute ID, prefixed dspt_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public InquiryStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether this is a pre-dispute inquiry rather than a formal chargeback. Inquiries follow the same lifecycle but move no funds unless one escalates.

+ *

Whether this is a pre-dispute inquiry rather than a formal chargeback. Inquiries follow the same lifecycle but move no funds unless one escalates.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("inquiry") + public RapidDisputeResolutionStage inquiry(boolean inquiry) { + this.inquiry = inquiry; + return this; + } + + /** + *

Whether Visa Rapid Dispute Resolution settled this automatically. These refund the customer without an evidence round.

+ *

Whether Visa Rapid Dispute Resolution settled this automatically. These refund the customer without an evidence round.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("rapid_dispute_resolution") + public ReasonStage rapidDisputeResolution(boolean rapidDisputeResolution) { + this.rapidDisputeResolution = rapidDisputeResolution; + return this; + } + + /** + *

Why the customer says they are disputing, normalized across card networks. other covers a code Whop has not categorized yet — read reason_code for the raw value.

+ *

Why the customer says they are disputing, normalized across card networks. other covers a code Whop has not categorized yet — read reason_code for the raw value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reason") + public StatusStage reason(@NotNull DisputeReason reason) { + this.reason = Objects.requireNonNull(reason, "reason must not be null"); + return this; + } + + /** + *

Where the dispute stands. needs_response is awaiting evidence, under_review is with the processor, won returned the funds to the seller, lost returned them to the customer, and closed ended without a ruling. A dispute past its evidence_due_at reports under_review — the window to respond has closed.

+ *

Where the dispute stands. needs_response is awaiting evidence, under_review is with the processor, won returned the funds to the seller, lost returned them to the customer, and closed ended without a ruling. A dispute past its evidence_due_at reports under_review — the window to respond has closed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull DisputeStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

When the dispute was last changed, as an ISO 8601 timestamp.

+ *

When the dispute was last changed, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The raw card-network or processor reason code, such as 10.4.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reasonCode(Nullable reasonCode) { + if (reasonCode.isNull()) { + this.reasonCode = null; + } else if (reasonCode.isEmpty()) { + this.reasonCode = Optional.empty(); + } else { + this.reasonCode = Optional.of(reasonCode.get()); + } + return this; + } + + /** + *

The raw card-network or processor reason code, such as 10.4.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reasonCode(String reasonCode) { + this.reasonCode = Optional.ofNullable(reasonCode); + return this; + } + + /** + *

The raw card-network or processor reason code, such as 10.4.

+ */ + @java.lang.Override + @JsonSetter(value = "reason_code", nulls = Nulls.SKIP) + public _FinalStage reasonCode(Optional reasonCode) { + this.reasonCode = reasonCode; + return this; + } + + /** + *

The product the disputed payment was for, prefixed prod_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + /** + *

The product the disputed payment was for, prefixed prod_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

The product the disputed payment was for, prefixed prod_.

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

The plan the disputed payment was made on, prefixed plan_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planId(Nullable planId) { + if (planId.isNull()) { + this.planId = null; + } else if (planId.isEmpty()) { + this.planId = Optional.empty(); + } else { + this.planId = Optional.of(planId.get()); + } + return this; + } + + /** + *

The plan the disputed payment was made on, prefixed plan_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planId(String planId) { + this.planId = Optional.ofNullable(planId); + return this; + } + + /** + *

The plan the disputed payment was made on, prefixed plan_.

+ */ + @java.lang.Override + @JsonSetter(value = "plan_id", nulls = Nulls.SKIP) + public _FinalStage planId(Optional planId) { + this.planId = planId; + return this; + } + + /** + *

The payment being disputed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(Nullable payment) { + if (payment.isNull()) { + this.payment = null; + } else if (payment.isEmpty()) { + this.payment = Optional.empty(); + } else { + this.payment = Optional.of(payment.get()); + } + return this; + } + + /** + *

The payment being disputed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(DisputePayment payment) { + this.payment = Optional.ofNullable(payment); + return this; + } + + /** + *

The payment being disputed.

+ */ + @java.lang.Override + @JsonSetter(value = "payment", nulls = Nulls.SKIP) + public _FinalStage payment(Optional payment) { + this.payment = payment; + return this; + } + + @java.lang.Override + public _FinalStage addAllIssuerComments(List issuerComments) { + if (issuerComments != null) { + this.issuerComments.addAll(issuerComments); + } + return this; + } + + @java.lang.Override + public _FinalStage addIssuerComments(DisputeIssuerComment issuerComments) { + this.issuerComments.add(issuerComments); + return this; + } + + @java.lang.Override + @JsonSetter(value = "issuer_comments", nulls = Nulls.SKIP) + public _FinalStage issuerComments(List issuerComments) { + this.issuerComments.clear(); + if (issuerComments != null) { + this.issuerComments.addAll(issuerComments); + } + return this; + } + + /** + *

The AI-generated representment document filed with the processor on the seller's behalf, once ready. Null until generation completes, and for disputes not using Whop Dispute Fighter.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage generatedResponseAttachment(Nullable generatedResponseAttachment) { + if (generatedResponseAttachment.isNull()) { + this.generatedResponseAttachment = null; + } else if (generatedResponseAttachment.isEmpty()) { + this.generatedResponseAttachment = Optional.empty(); + } else { + this.generatedResponseAttachment = Optional.of(generatedResponseAttachment.get()); + } + return this; + } + + /** + *

The AI-generated representment document filed with the processor on the seller's behalf, once ready. Null until generation completes, and for disputes not using Whop Dispute Fighter.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage generatedResponseAttachment(DisputeAttachment generatedResponseAttachment) { + this.generatedResponseAttachment = Optional.ofNullable(generatedResponseAttachment); + return this; + } + + /** + *

The AI-generated representment document filed with the processor on the seller's behalf, once ready. Null until generation completes, and for disputes not using Whop Dispute Fighter.

+ */ + @java.lang.Override + @JsonSetter(value = "generated_response_attachment", nulls = Nulls.SKIP) + public _FinalStage generatedResponseAttachment(Optional generatedResponseAttachment) { + this.generatedResponseAttachment = generatedResponseAttachment; + return this; + } + + /** + *

When the evidence was submitted to the processor, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage evidenceSubmittedAt(Nullable evidenceSubmittedAt) { + if (evidenceSubmittedAt.isNull()) { + this.evidenceSubmittedAt = null; + } else if (evidenceSubmittedAt.isEmpty()) { + this.evidenceSubmittedAt = Optional.empty(); + } else { + this.evidenceSubmittedAt = Optional.of(evidenceSubmittedAt.get()); + } + return this; + } + + /** + *

When the evidence was submitted to the processor, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage evidenceSubmittedAt(String evidenceSubmittedAt) { + this.evidenceSubmittedAt = Optional.ofNullable(evidenceSubmittedAt); + return this; + } + + /** + *

When the evidence was submitted to the processor, as an ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "evidence_submitted_at", nulls = Nulls.SKIP) + public _FinalStage evidenceSubmittedAt(Optional evidenceSubmittedAt) { + this.evidenceSubmittedAt = evidenceSubmittedAt; + return this; + } + + /** + *

Why evidence can no longer be edited. null while evidence_editable is true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage evidenceLockedReason(Nullable evidenceLockedReason) { + if (evidenceLockedReason.isNull()) { + this.evidenceLockedReason = null; + } else if (evidenceLockedReason.isEmpty()) { + this.evidenceLockedReason = Optional.empty(); + } else { + this.evidenceLockedReason = Optional.of(evidenceLockedReason.get()); + } + return this; + } + + /** + *

Why evidence can no longer be edited. null while evidence_editable is true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage evidenceLockedReason(DisputeEvidenceLockedReason evidenceLockedReason) { + this.evidenceLockedReason = Optional.ofNullable(evidenceLockedReason); + return this; + } + + /** + *

Why evidence can no longer be edited. null while evidence_editable is true.

+ */ + @java.lang.Override + @JsonSetter(value = "evidence_locked_reason", nulls = Nulls.SKIP) + public _FinalStage evidenceLockedReason(Optional evidenceLockedReason) { + this.evidenceLockedReason = evidenceLockedReason; + return this; + } + + /** + *

The deadline to submit evidence, as an ISO 8601 timestamp. Whop reserves the last 24 hours before the processor's own cutoff to forward the submission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage evidenceDueAt(Nullable evidenceDueAt) { + if (evidenceDueAt.isNull()) { + this.evidenceDueAt = null; + } else if (evidenceDueAt.isEmpty()) { + this.evidenceDueAt = Optional.empty(); + } else { + this.evidenceDueAt = Optional.of(evidenceDueAt.get()); + } + return this; + } + + /** + *

The deadline to submit evidence, as an ISO 8601 timestamp. Whop reserves the last 24 hours before the processor's own cutoff to forward the submission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage evidenceDueAt(String evidenceDueAt) { + this.evidenceDueAt = Optional.ofNullable(evidenceDueAt); + return this; + } + + /** + *

The deadline to submit evidence, as an ISO 8601 timestamp. Whop reserves the last 24 hours before the processor's own cutoff to forward the submission.

+ */ + @java.lang.Override + @JsonSetter(value = "evidence_due_at", nulls = Nulls.SKIP) + public _FinalStage evidenceDueAt(Optional evidenceDueAt) { + this.evidenceDueAt = evidenceDueAt; + return this; + } + + /** + *

The customer who filed the dispute.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage buyer(Nullable buyer) { + if (buyer.isNull()) { + this.buyer = null; + } else if (buyer.isEmpty()) { + this.buyer = Optional.empty(); + } else { + this.buyer = Optional.of(buyer.get()); + } + return this; + } + + /** + *

The customer who filed the dispute.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage buyer(DisputeBuyer buyer) { + this.buyer = Optional.ofNullable(buyer); + return this; + } + + /** + *

The customer who filed the dispute.

+ */ + @java.lang.Override + @JsonSetter(value = "buyer", nulls = Nulls.SKIP) + public _FinalStage buyer(Optional buyer) { + this.buyer = buyer; + return this; + } + + /** + *

The account the dispute was filed against, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account the dispute was filed against, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account the dispute was filed against, prefixed biz_.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public Dispute build() { + return new Dispute( + accountId, + amount, + buyer, + createdAt, + currency, + evidence, + evidenceDueAt, + evidenceEditable, + evidenceLockedReason, + evidenceSubmittedAt, + generatedResponseAttachment, + id, + inquiry, + issuerComments, + payment, + planId, + productId, + rapidDisputeResolution, + reason, + reasonCode, + status, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeAlert.java b/src/main/java/com/whop/api/types/DisputeAlert.java new file mode 100644 index 00000000..e0c40645 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeAlert.java @@ -0,0 +1,949 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeAlert.Builder.class) +public final class DisputeAlert { + private final Optional accountId; + + private final boolean actionable; + + private final double amount; + + private final Optional cardBrand; + + private final String createdAt; + + private final String currency; + + private final boolean feeCharged; + + private final String id; + + private final Optional issuer; + + private final Optional notActionableReason; + + private final Optional paymentId; + + private final Optional productId; + + private final String reportedAt; + + private final Optional transactionAt; + + private final DisputeAlertType type; + + private final String updatedAt; + + private final Map additionalProperties; + + private DisputeAlert( + Optional accountId, + boolean actionable, + double amount, + Optional cardBrand, + String createdAt, + String currency, + boolean feeCharged, + String id, + Optional issuer, + Optional notActionableReason, + Optional paymentId, + Optional productId, + String reportedAt, + Optional transactionAt, + DisputeAlertType type, + String updatedAt, + Map additionalProperties) { + this.accountId = accountId; + this.actionable = actionable; + this.amount = amount; + this.cardBrand = cardBrand; + this.createdAt = createdAt; + this.currency = currency; + this.feeCharged = feeCharged; + this.id = id; + this.issuer = issuer; + this.notActionableReason = notActionableReason; + this.paymentId = paymentId; + this.productId = productId; + this.reportedAt = reportedAt; + this.transactionAt = transactionAt; + this.type = type; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account the alerted payment belongs to, prefixed biz_. null while the alert is unmatched. + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return Whether refunding the payment can still avoid a chargeback. false once the payment has been disputed or fully refunded, or when the alert could not be matched to a payment — not_actionable_reason says which. + */ + @JsonProperty("actionable") + public boolean getActionable() { + return actionable; + } + + /** + * @return The alerted amount, in whole units of currency. This is what the issuer reported, which can differ from the payment's own amount. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The card network as reported by the issuer, lowercased, such as visa or mastercard. unknown when the report carries neither a network nor a recognizable BIN. + */ + @JsonIgnore + public Optional getCardBrand() { + if (cardBrand == null) { + return Optional.empty(); + } + return cardBrand; + } + + /** + * @return When Whop received the alert, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Three-letter ISO currency code of the alerted amount. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Whether Whop charged the account an alert fee for this one. Always false for early_fraud_warning, which Whop is not billed for and never passes on. + */ + @JsonProperty("fee_charged") + public boolean getFeeCharged() { + return feeCharged; + } + + /** + * @return Dispute alert ID, prefixed dspa_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Name of the bank that issued the card and filed the report. + */ + @JsonIgnore + public Optional getIssuer() { + if (issuer == null) { + return Optional.empty(); + } + return issuer; + } + + /** + * @return Why refunding can no longer avoid a chargeback. network_resolved when a Visa RDR already closed the case, payment_unmatched when no payment matched, payment_not_captured when it never captured money, payment_disputed once the payment carries a dispute, payment_refunded once fully refunded. null while actionable is true. + */ + @JsonIgnore + public Optional getNotActionableReason() { + if (notActionableReason == null) { + return Optional.empty(); + } + return notActionableReason; + } + + /** + * @return The payment the issuer reported, prefixed pay_. null when Whop could not match the report to a payment. + */ + @JsonIgnore + public Optional getPaymentId() { + if (paymentId == null) { + return Optional.empty(); + } + return paymentId; + } + + /** + * @return The product the alerted payment was for, prefixed prod_. + */ + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + /** + * @return When the issuer filed the report, as an ISO 8601 timestamp. Earlier than created_at, which is when Whop received it. + */ + @JsonProperty("reported_at") + public String getReportedAt() { + return reportedAt; + } + + /** + * @return When the reported transaction was made, as an ISO 8601 timestamp. + */ + @JsonIgnore + public Optional getTransactionAt() { + if (transactionAt == null) { + return Optional.empty(); + } + return transactionAt; + } + + /** + * @return What the issuer sent. early_fraud_warning is a fraud report on a settled payment (Visa TC40 / Mastercard SAFE) — refunding still avoids the chargeback, and Whop never charges a fee for one. dispute_alert is a pre-dispute notice from the issuer's alert network, which Whop pays for and passes on as a fee. rapid_dispute_resolution is a Visa RDR case the network already closed by refunding the payment — nothing is left to act on. + */ + @JsonProperty("type") + public DisputeAlertType getType() { + return type; + } + + /** + * @return When the alert was last changed, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_brand") + private Optional _getCardBrand() { + return cardBrand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("issuer") + private Optional _getIssuer() { + return issuer; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("not_actionable_reason") + private Optional _getNotActionableReason() { + return notActionableReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_id") + private Optional _getPaymentId() { + return paymentId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("transaction_at") + private Optional _getTransactionAt() { + return transactionAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeAlert && equalTo((DisputeAlert) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeAlert other) { + return accountId.equals(other.accountId) + && actionable == other.actionable + && amount == other.amount + && cardBrand.equals(other.cardBrand) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && feeCharged == other.feeCharged + && id.equals(other.id) + && issuer.equals(other.issuer) + && notActionableReason.equals(other.notActionableReason) + && paymentId.equals(other.paymentId) + && productId.equals(other.productId) + && reportedAt.equals(other.reportedAt) + && transactionAt.equals(other.transactionAt) + && type.equals(other.type) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.actionable, + this.amount, + this.cardBrand, + this.createdAt, + this.currency, + this.feeCharged, + this.id, + this.issuer, + this.notActionableReason, + this.paymentId, + this.productId, + this.reportedAt, + this.transactionAt, + this.type, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionableStage builder() { + return new Builder(); + } + + public interface ActionableStage { + /** + *

Whether refunding the payment can still avoid a chargeback. false once the payment has been disputed or fully refunded, or when the alert could not be matched to a payment — not_actionable_reason says which.

+ */ + AmountStage actionable(boolean actionable); + + Builder from(DisputeAlert other); + } + + public interface AmountStage { + /** + *

The alerted amount, in whole units of currency. This is what the issuer reported, which can differ from the payment's own amount.

+ */ + CreatedAtStage amount(double amount); + } + + public interface CreatedAtStage { + /** + *

When Whop received the alert, as an ISO 8601 timestamp.

+ */ + CurrencyStage createdAt(@NotNull String createdAt); + } + + public interface CurrencyStage { + /** + *

Three-letter ISO currency code of the alerted amount.

+ */ + FeeChargedStage currency(@NotNull String currency); + } + + public interface FeeChargedStage { + /** + *

Whether Whop charged the account an alert fee for this one. Always false for early_fraud_warning, which Whop is not billed for and never passes on.

+ */ + IdStage feeCharged(boolean feeCharged); + } + + public interface IdStage { + /** + *

Dispute alert ID, prefixed dspa_.

+ */ + ReportedAtStage id(@NotNull String id); + } + + public interface ReportedAtStage { + /** + *

When the issuer filed the report, as an ISO 8601 timestamp. Earlier than created_at, which is when Whop received it.

+ */ + TypeStage reportedAt(@NotNull String reportedAt); + } + + public interface TypeStage { + /** + *

What the issuer sent. early_fraud_warning is a fraud report on a settled payment (Visa TC40 / Mastercard SAFE) — refunding still avoids the chargeback, and Whop never charges a fee for one. dispute_alert is a pre-dispute notice from the issuer's alert network, which Whop pays for and passes on as a fee. rapid_dispute_resolution is a Visa RDR case the network already closed by refunding the payment — nothing is left to act on.

+ */ + UpdatedAtStage type(@NotNull DisputeAlertType type); + } + + public interface UpdatedAtStage { + /** + *

When the alert was last changed, as an ISO 8601 timestamp.

+ */ + _FinalStage updatedAt(@NotNull String updatedAt); + } + + public interface _FinalStage { + DisputeAlert build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account the alerted payment belongs to, prefixed biz_. null while the alert is unmatched.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The card network as reported by the issuer, lowercased, such as visa or mastercard. unknown when the report carries neither a network nor a recognizable BIN.

+ */ + _FinalStage cardBrand(Optional cardBrand); + + _FinalStage cardBrand(String cardBrand); + + _FinalStage cardBrand(Nullable cardBrand); + + /** + *

Name of the bank that issued the card and filed the report.

+ */ + _FinalStage issuer(Optional issuer); + + _FinalStage issuer(String issuer); + + _FinalStage issuer(Nullable issuer); + + /** + *

Why refunding can no longer avoid a chargeback. network_resolved when a Visa RDR already closed the case, payment_unmatched when no payment matched, payment_not_captured when it never captured money, payment_disputed once the payment carries a dispute, payment_refunded once fully refunded. null while actionable is true.

+ */ + _FinalStage notActionableReason(Optional notActionableReason); + + _FinalStage notActionableReason(DisputeAlertNotActionableReason notActionableReason); + + _FinalStage notActionableReason(Nullable notActionableReason); + + /** + *

The payment the issuer reported, prefixed pay_. null when Whop could not match the report to a payment.

+ */ + _FinalStage paymentId(Optional paymentId); + + _FinalStage paymentId(String paymentId); + + _FinalStage paymentId(Nullable paymentId); + + /** + *

The product the alerted payment was for, prefixed prod_.

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + + _FinalStage productId(Nullable productId); + + /** + *

When the reported transaction was made, as an ISO 8601 timestamp.

+ */ + _FinalStage transactionAt(Optional transactionAt); + + _FinalStage transactionAt(String transactionAt); + + _FinalStage transactionAt(Nullable transactionAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ActionableStage, + AmountStage, + CreatedAtStage, + CurrencyStage, + FeeChargedStage, + IdStage, + ReportedAtStage, + TypeStage, + UpdatedAtStage, + _FinalStage { + private boolean actionable; + + private double amount; + + private String createdAt; + + private String currency; + + private boolean feeCharged; + + private String id; + + private String reportedAt; + + private DisputeAlertType type; + + private String updatedAt; + + private Optional transactionAt = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional paymentId = Optional.empty(); + + private Optional notActionableReason = Optional.empty(); + + private Optional issuer = Optional.empty(); + + private Optional cardBrand = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeAlert other) { + accountId(other.getAccountId()); + actionable(other.getActionable()); + amount(other.getAmount()); + cardBrand(other.getCardBrand()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + feeCharged(other.getFeeCharged()); + id(other.getId()); + issuer(other.getIssuer()); + notActionableReason(other.getNotActionableReason()); + paymentId(other.getPaymentId()); + productId(other.getProductId()); + reportedAt(other.getReportedAt()); + transactionAt(other.getTransactionAt()); + type(other.getType()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

Whether refunding the payment can still avoid a chargeback. false once the payment has been disputed or fully refunded, or when the alert could not be matched to a payment — not_actionable_reason says which.

+ *

Whether refunding the payment can still avoid a chargeback. false once the payment has been disputed or fully refunded, or when the alert could not be matched to a payment — not_actionable_reason says which.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("actionable") + public AmountStage actionable(boolean actionable) { + this.actionable = actionable; + return this; + } + + /** + *

The alerted amount, in whole units of currency. This is what the issuer reported, which can differ from the payment's own amount.

+ *

The alerted amount, in whole units of currency. This is what the issuer reported, which can differ from the payment's own amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

When Whop received the alert, as an ISO 8601 timestamp.

+ *

When Whop received the alert, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Three-letter ISO currency code of the alerted amount.

+ *

Three-letter ISO currency code of the alerted amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public FeeChargedStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Whether Whop charged the account an alert fee for this one. Always false for early_fraud_warning, which Whop is not billed for and never passes on.

+ *

Whether Whop charged the account an alert fee for this one. Always false for early_fraud_warning, which Whop is not billed for and never passes on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_charged") + public IdStage feeCharged(boolean feeCharged) { + this.feeCharged = feeCharged; + return this; + } + + /** + *

Dispute alert ID, prefixed dspa_.

+ *

Dispute alert ID, prefixed dspa_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ReportedAtStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

When the issuer filed the report, as an ISO 8601 timestamp. Earlier than created_at, which is when Whop received it.

+ *

When the issuer filed the report, as an ISO 8601 timestamp. Earlier than created_at, which is when Whop received it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reported_at") + public TypeStage reportedAt(@NotNull String reportedAt) { + this.reportedAt = Objects.requireNonNull(reportedAt, "reportedAt must not be null"); + return this; + } + + /** + *

What the issuer sent. early_fraud_warning is a fraud report on a settled payment (Visa TC40 / Mastercard SAFE) — refunding still avoids the chargeback, and Whop never charges a fee for one. dispute_alert is a pre-dispute notice from the issuer's alert network, which Whop pays for and passes on as a fee. rapid_dispute_resolution is a Visa RDR case the network already closed by refunding the payment — nothing is left to act on.

+ *

What the issuer sent. early_fraud_warning is a fraud report on a settled payment (Visa TC40 / Mastercard SAFE) — refunding still avoids the chargeback, and Whop never charges a fee for one. dispute_alert is a pre-dispute notice from the issuer's alert network, which Whop pays for and passes on as a fee. rapid_dispute_resolution is a Visa RDR case the network already closed by refunding the payment — nothing is left to act on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public UpdatedAtStage type(@NotNull DisputeAlertType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

When the alert was last changed, as an ISO 8601 timestamp.

+ *

When the alert was last changed, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

When the reported transaction was made, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage transactionAt(Nullable transactionAt) { + if (transactionAt.isNull()) { + this.transactionAt = null; + } else if (transactionAt.isEmpty()) { + this.transactionAt = Optional.empty(); + } else { + this.transactionAt = Optional.of(transactionAt.get()); + } + return this; + } + + /** + *

When the reported transaction was made, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage transactionAt(String transactionAt) { + this.transactionAt = Optional.ofNullable(transactionAt); + return this; + } + + /** + *

When the reported transaction was made, as an ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "transaction_at", nulls = Nulls.SKIP) + public _FinalStage transactionAt(Optional transactionAt) { + this.transactionAt = transactionAt; + return this; + } + + /** + *

The product the alerted payment was for, prefixed prod_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + /** + *

The product the alerted payment was for, prefixed prod_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

The product the alerted payment was for, prefixed prod_.

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

The payment the issuer reported, prefixed pay_. null when Whop could not match the report to a payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentId(Nullable paymentId) { + if (paymentId.isNull()) { + this.paymentId = null; + } else if (paymentId.isEmpty()) { + this.paymentId = Optional.empty(); + } else { + this.paymentId = Optional.of(paymentId.get()); + } + return this; + } + + /** + *

The payment the issuer reported, prefixed pay_. null when Whop could not match the report to a payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentId(String paymentId) { + this.paymentId = Optional.ofNullable(paymentId); + return this; + } + + /** + *

The payment the issuer reported, prefixed pay_. null when Whop could not match the report to a payment.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_id", nulls = Nulls.SKIP) + public _FinalStage paymentId(Optional paymentId) { + this.paymentId = paymentId; + return this; + } + + /** + *

Why refunding can no longer avoid a chargeback. network_resolved when a Visa RDR already closed the case, payment_unmatched when no payment matched, payment_not_captured when it never captured money, payment_disputed once the payment carries a dispute, payment_refunded once fully refunded. null while actionable is true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notActionableReason(Nullable notActionableReason) { + if (notActionableReason.isNull()) { + this.notActionableReason = null; + } else if (notActionableReason.isEmpty()) { + this.notActionableReason = Optional.empty(); + } else { + this.notActionableReason = Optional.of(notActionableReason.get()); + } + return this; + } + + /** + *

Why refunding can no longer avoid a chargeback. network_resolved when a Visa RDR already closed the case, payment_unmatched when no payment matched, payment_not_captured when it never captured money, payment_disputed once the payment carries a dispute, payment_refunded once fully refunded. null while actionable is true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notActionableReason(DisputeAlertNotActionableReason notActionableReason) { + this.notActionableReason = Optional.ofNullable(notActionableReason); + return this; + } + + /** + *

Why refunding can no longer avoid a chargeback. network_resolved when a Visa RDR already closed the case, payment_unmatched when no payment matched, payment_not_captured when it never captured money, payment_disputed once the payment carries a dispute, payment_refunded once fully refunded. null while actionable is true.

+ */ + @java.lang.Override + @JsonSetter(value = "not_actionable_reason", nulls = Nulls.SKIP) + public _FinalStage notActionableReason(Optional notActionableReason) { + this.notActionableReason = notActionableReason; + return this; + } + + /** + *

Name of the bank that issued the card and filed the report.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage issuer(Nullable issuer) { + if (issuer.isNull()) { + this.issuer = null; + } else if (issuer.isEmpty()) { + this.issuer = Optional.empty(); + } else { + this.issuer = Optional.of(issuer.get()); + } + return this; + } + + /** + *

Name of the bank that issued the card and filed the report.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage issuer(String issuer) { + this.issuer = Optional.ofNullable(issuer); + return this; + } + + /** + *

Name of the bank that issued the card and filed the report.

+ */ + @java.lang.Override + @JsonSetter(value = "issuer", nulls = Nulls.SKIP) + public _FinalStage issuer(Optional issuer) { + this.issuer = issuer; + return this; + } + + /** + *

The card network as reported by the issuer, lowercased, such as visa or mastercard. unknown when the report carries neither a network nor a recognizable BIN.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(Nullable cardBrand) { + if (cardBrand.isNull()) { + this.cardBrand = null; + } else if (cardBrand.isEmpty()) { + this.cardBrand = Optional.empty(); + } else { + this.cardBrand = Optional.of(cardBrand.get()); + } + return this; + } + + /** + *

The card network as reported by the issuer, lowercased, such as visa or mastercard. unknown when the report carries neither a network nor a recognizable BIN.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(String cardBrand) { + this.cardBrand = Optional.ofNullable(cardBrand); + return this; + } + + /** + *

The card network as reported by the issuer, lowercased, such as visa or mastercard. unknown when the report carries neither a network nor a recognizable BIN.

+ */ + @java.lang.Override + @JsonSetter(value = "card_brand", nulls = Nulls.SKIP) + public _FinalStage cardBrand(Optional cardBrand) { + this.cardBrand = cardBrand; + return this; + } + + /** + *

The account the alerted payment belongs to, prefixed biz_. null while the alert is unmatched.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account the alerted payment belongs to, prefixed biz_. null while the alert is unmatched.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account the alerted payment belongs to, prefixed biz_. null while the alert is unmatched.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public DisputeAlert build() { + return new DisputeAlert( + accountId, + actionable, + amount, + cardBrand, + createdAt, + currency, + feeCharged, + id, + issuer, + notActionableReason, + paymentId, + productId, + reportedAt, + transactionAt, + type, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeAlertListItem.java b/src/main/java/com/whop/api/types/DisputeAlertListItem.java new file mode 100644 index 00000000..f8f1217f --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeAlertListItem.java @@ -0,0 +1,548 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeAlertListItem.Builder.class) +public final class DisputeAlertListItem { + private final DisputeAlertTypes alertType; + + private final double amount; + + private final boolean chargeForAlert; + + private final OffsetDateTime createdAt; + + private final Currencies currency; + + private final Optional dispute; + + private final String id; + + private final Optional payment; + + private final Optional transactionDate; + + private final Map additionalProperties; + + private DisputeAlertListItem( + DisputeAlertTypes alertType, + double amount, + boolean chargeForAlert, + OffsetDateTime createdAt, + Currencies currency, + Optional dispute, + String id, + Optional payment, + Optional transactionDate, + Map additionalProperties) { + this.alertType = alertType; + this.amount = amount; + this.chargeForAlert = chargeForAlert; + this.createdAt = createdAt; + this.currency = currency; + this.dispute = dispute; + this.id = id; + this.payment = payment; + this.transactionDate = transactionDate; + this.additionalProperties = additionalProperties; + } + + /** + * @return The type of the dispute alert. + */ + @JsonProperty("alert_type") + public DisputeAlertTypes getAlertType() { + return alertType; + } + + /** + * @return The alerted amount in the specified currency. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return Whether this alert incurs a charge. + */ + @JsonProperty("charge_for_alert") + public boolean getChargeForAlert() { + return chargeForAlert; + } + + /** + * @return The time the dispute alert was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code for the alerted amount. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The dispute associated with the dispute alert. + */ + @JsonIgnore + public Optional getDispute() { + if (dispute == null) { + return Optional.empty(); + } + return dispute; + } + + /** + * @return The unique identifier of the dispute alert. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The payment associated with the dispute alert. + */ + @JsonIgnore + public Optional getPayment() { + if (payment == null) { + return Optional.empty(); + } + return payment; + } + + /** + * @return The date of the original transaction. + */ + @JsonIgnore + public Optional getTransactionDate() { + if (transactionDate == null) { + return Optional.empty(); + } + return transactionDate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("dispute") + private Optional _getDispute() { + return dispute; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment") + private Optional _getPayment() { + return payment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("transaction_date") + private Optional _getTransactionDate() { + return transactionDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeAlertListItem && equalTo((DisputeAlertListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeAlertListItem other) { + return alertType.equals(other.alertType) + && amount == other.amount + && chargeForAlert == other.chargeForAlert + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && dispute.equals(other.dispute) + && id.equals(other.id) + && payment.equals(other.payment) + && transactionDate.equals(other.transactionDate); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.alertType, + this.amount, + this.chargeForAlert, + this.createdAt, + this.currency, + this.dispute, + this.id, + this.payment, + this.transactionDate); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AlertTypeStage builder() { + return new Builder(); + } + + public interface AlertTypeStage { + /** + *

The type of the dispute alert.

+ */ + AmountStage alertType(@NotNull DisputeAlertTypes alertType); + + Builder from(DisputeAlertListItem other); + } + + public interface AmountStage { + /** + *

The alerted amount in the specified currency.

+ */ + ChargeForAlertStage amount(double amount); + } + + public interface ChargeForAlertStage { + /** + *

Whether this alert incurs a charge.

+ */ + CreatedAtStage chargeForAlert(boolean chargeForAlert); + } + + public interface CreatedAtStage { + /** + *

The time the dispute alert was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

The three-letter ISO currency code for the alerted amount.

+ */ + IdStage currency(@NotNull Currencies currency); + } + + public interface IdStage { + /** + *

The unique identifier of the dispute alert.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DisputeAlertListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The dispute associated with the dispute alert.

+ */ + _FinalStage dispute(Optional dispute); + + _FinalStage dispute(DisputeAlertListItemDispute dispute); + + _FinalStage dispute(Nullable dispute); + + /** + *

The payment associated with the dispute alert.

+ */ + _FinalStage payment(Optional payment); + + _FinalStage payment(DisputeAlertListItemPayment payment); + + _FinalStage payment(Nullable payment); + + /** + *

The date of the original transaction.

+ */ + _FinalStage transactionDate(Optional transactionDate); + + _FinalStage transactionDate(OffsetDateTime transactionDate); + + _FinalStage transactionDate(Nullable transactionDate); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AlertTypeStage, + AmountStage, + ChargeForAlertStage, + CreatedAtStage, + CurrencyStage, + IdStage, + _FinalStage { + private DisputeAlertTypes alertType; + + private double amount; + + private boolean chargeForAlert; + + private OffsetDateTime createdAt; + + private Currencies currency; + + private String id; + + private Optional transactionDate = Optional.empty(); + + private Optional payment = Optional.empty(); + + private Optional dispute = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeAlertListItem other) { + alertType(other.getAlertType()); + amount(other.getAmount()); + chargeForAlert(other.getChargeForAlert()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + dispute(other.getDispute()); + id(other.getId()); + payment(other.getPayment()); + transactionDate(other.getTransactionDate()); + return this; + } + + /** + *

The type of the dispute alert.

+ *

The type of the dispute alert.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("alert_type") + public AmountStage alertType(@NotNull DisputeAlertTypes alertType) { + this.alertType = Objects.requireNonNull(alertType, "alertType must not be null"); + return this; + } + + /** + *

The alerted amount in the specified currency.

+ *

The alerted amount in the specified currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public ChargeForAlertStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

Whether this alert incurs a charge.

+ *

Whether this alert incurs a charge.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("charge_for_alert") + public CreatedAtStage chargeForAlert(boolean chargeForAlert) { + this.chargeForAlert = chargeForAlert; + return this; + } + + /** + *

The time the dispute alert was created.

+ *

The time the dispute alert was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The three-letter ISO currency code for the alerted amount.

+ *

The three-letter ISO currency code for the alerted amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier of the dispute alert.

+ *

The unique identifier of the dispute alert.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The date of the original transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage transactionDate(Nullable transactionDate) { + if (transactionDate.isNull()) { + this.transactionDate = null; + } else if (transactionDate.isEmpty()) { + this.transactionDate = Optional.empty(); + } else { + this.transactionDate = Optional.of(transactionDate.get()); + } + return this; + } + + /** + *

The date of the original transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage transactionDate(OffsetDateTime transactionDate) { + this.transactionDate = Optional.ofNullable(transactionDate); + return this; + } + + /** + *

The date of the original transaction.

+ */ + @java.lang.Override + @JsonSetter(value = "transaction_date", nulls = Nulls.SKIP) + public _FinalStage transactionDate(Optional transactionDate) { + this.transactionDate = transactionDate; + return this; + } + + /** + *

The payment associated with the dispute alert.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(Nullable payment) { + if (payment.isNull()) { + this.payment = null; + } else if (payment.isEmpty()) { + this.payment = Optional.empty(); + } else { + this.payment = Optional.of(payment.get()); + } + return this; + } + + /** + *

The payment associated with the dispute alert.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(DisputeAlertListItemPayment payment) { + this.payment = Optional.ofNullable(payment); + return this; + } + + /** + *

The payment associated with the dispute alert.

+ */ + @java.lang.Override + @JsonSetter(value = "payment", nulls = Nulls.SKIP) + public _FinalStage payment(Optional payment) { + this.payment = payment; + return this; + } + + /** + *

The dispute associated with the dispute alert.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dispute(Nullable dispute) { + if (dispute.isNull()) { + this.dispute = null; + } else if (dispute.isEmpty()) { + this.dispute = Optional.empty(); + } else { + this.dispute = Optional.of(dispute.get()); + } + return this; + } + + /** + *

The dispute associated with the dispute alert.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dispute(DisputeAlertListItemDispute dispute) { + this.dispute = Optional.ofNullable(dispute); + return this; + } + + /** + *

The dispute associated with the dispute alert.

+ */ + @java.lang.Override + @JsonSetter(value = "dispute", nulls = Nulls.SKIP) + public _FinalStage dispute(Optional dispute) { + this.dispute = dispute; + return this; + } + + @java.lang.Override + public DisputeAlertListItem build() { + return new DisputeAlertListItem( + alertType, + amount, + chargeForAlert, + createdAt, + currency, + dispute, + id, + payment, + transactionDate, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeAlertListItemDispute.java b/src/main/java/com/whop/api/types/DisputeAlertListItemDispute.java new file mode 100644 index 00000000..fb0c1437 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeAlertListItemDispute.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeAlertListItemDispute.Builder.class) +public final class DisputeAlertListItemDispute { + private final String id; + + private final Map additionalProperties; + + private DisputeAlertListItemDispute(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the dispute. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeAlertListItemDispute && equalTo((DisputeAlertListItemDispute) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeAlertListItemDispute other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the dispute.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(DisputeAlertListItemDispute other); + } + + public interface _FinalStage { + DisputeAlertListItemDispute build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeAlertListItemDispute other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the dispute.

+ *

The unique identifier for the dispute.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DisputeAlertListItemDispute build() { + return new DisputeAlertListItemDispute(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeAlertListItemPayment.java b/src/main/java/com/whop/api/types/DisputeAlertListItemPayment.java new file mode 100644 index 00000000..cd08d629 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeAlertListItemPayment.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeAlertListItemPayment.Builder.class) +public final class DisputeAlertListItemPayment { + private final String id; + + private final Map additionalProperties; + + private DisputeAlertListItemPayment(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the payment. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeAlertListItemPayment && equalTo((DisputeAlertListItemPayment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeAlertListItemPayment other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the payment.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(DisputeAlertListItemPayment other); + } + + public interface _FinalStage { + DisputeAlertListItemPayment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeAlertListItemPayment other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the payment.

+ *

The unique identifier for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DisputeAlertListItemPayment build() { + return new DisputeAlertListItemPayment(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeAlertNotActionableReason.java b/src/main/java/com/whop/api/types/DisputeAlertNotActionableReason.java new file mode 100644 index 00000000..49d80af0 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeAlertNotActionableReason.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DisputeAlertNotActionableReason { + public static final DisputeAlertNotActionableReason PAYMENT_NOT_CAPTURED = + new DisputeAlertNotActionableReason(Value.PAYMENT_NOT_CAPTURED, "payment_not_captured"); + + public static final DisputeAlertNotActionableReason PAYMENT_REFUNDED = + new DisputeAlertNotActionableReason(Value.PAYMENT_REFUNDED, "payment_refunded"); + + public static final DisputeAlertNotActionableReason NETWORK_RESOLVED = + new DisputeAlertNotActionableReason(Value.NETWORK_RESOLVED, "network_resolved"); + + public static final DisputeAlertNotActionableReason PAYMENT_UNMATCHED = + new DisputeAlertNotActionableReason(Value.PAYMENT_UNMATCHED, "payment_unmatched"); + + public static final DisputeAlertNotActionableReason PAYMENT_DISPUTED = + new DisputeAlertNotActionableReason(Value.PAYMENT_DISPUTED, "payment_disputed"); + + private final Value value; + + private final String string; + + DisputeAlertNotActionableReason(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof DisputeAlertNotActionableReason + && this.string.equals(((DisputeAlertNotActionableReason) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYMENT_NOT_CAPTURED: + return visitor.visitPaymentNotCaptured(); + case PAYMENT_REFUNDED: + return visitor.visitPaymentRefunded(); + case NETWORK_RESOLVED: + return visitor.visitNetworkResolved(); + case PAYMENT_UNMATCHED: + return visitor.visitPaymentUnmatched(); + case PAYMENT_DISPUTED: + return visitor.visitPaymentDisputed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DisputeAlertNotActionableReason valueOf(String value) { + switch (value) { + case "payment_not_captured": + return PAYMENT_NOT_CAPTURED; + case "payment_refunded": + return PAYMENT_REFUNDED; + case "network_resolved": + return NETWORK_RESOLVED; + case "payment_unmatched": + return PAYMENT_UNMATCHED; + case "payment_disputed": + return PAYMENT_DISPUTED; + default: + return new DisputeAlertNotActionableReason(Value.UNKNOWN, value); + } + } + + public enum Value { + NETWORK_RESOLVED, + + PAYMENT_UNMATCHED, + + PAYMENT_NOT_CAPTURED, + + PAYMENT_DISPUTED, + + PAYMENT_REFUNDED, + + UNKNOWN + } + + public interface Visitor { + T visitNetworkResolved(); + + T visitPaymentUnmatched(); + + T visitPaymentNotCaptured(); + + T visitPaymentDisputed(); + + T visitPaymentRefunded(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/DisputeAlertType.java b/src/main/java/com/whop/api/types/DisputeAlertType.java new file mode 100644 index 00000000..1140ca5c --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeAlertType.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DisputeAlertType { + public static final DisputeAlertType RAPID_DISPUTE_RESOLUTION = + new DisputeAlertType(Value.RAPID_DISPUTE_RESOLUTION, "rapid_dispute_resolution"); + + public static final DisputeAlertType EARLY_FRAUD_WARNING = + new DisputeAlertType(Value.EARLY_FRAUD_WARNING, "early_fraud_warning"); + + public static final DisputeAlertType DISPUTE_ALERT = new DisputeAlertType(Value.DISPUTE_ALERT, "dispute_alert"); + + private final Value value; + + private final String string; + + DisputeAlertType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof DisputeAlertType && this.string.equals(((DisputeAlertType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RAPID_DISPUTE_RESOLUTION: + return visitor.visitRapidDisputeResolution(); + case EARLY_FRAUD_WARNING: + return visitor.visitEarlyFraudWarning(); + case DISPUTE_ALERT: + return visitor.visitDisputeAlert(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DisputeAlertType valueOf(String value) { + switch (value) { + case "rapid_dispute_resolution": + return RAPID_DISPUTE_RESOLUTION; + case "early_fraud_warning": + return EARLY_FRAUD_WARNING; + case "dispute_alert": + return DISPUTE_ALERT; + default: + return new DisputeAlertType(Value.UNKNOWN, value); + } + } + + public enum Value { + EARLY_FRAUD_WARNING, + + DISPUTE_ALERT, + + RAPID_DISPUTE_RESOLUTION, + + UNKNOWN + } + + public interface Visitor { + T visitEarlyFraudWarning(); + + T visitDisputeAlert(); + + T visitRapidDisputeResolution(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/DisputeAlertTypes.java b/src/main/java/com/whop/api/types/DisputeAlertTypes.java new file mode 100644 index 00000000..a09cd2b3 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeAlertTypes.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DisputeAlertTypes { + public static final DisputeAlertTypes FRAUD = new DisputeAlertTypes(Value.FRAUD, "fraud"); + + public static final DisputeAlertTypes DISPUTE_RDR = new DisputeAlertTypes(Value.DISPUTE_RDR, "dispute_rdr"); + + public static final DisputeAlertTypes DISPUTE = new DisputeAlertTypes(Value.DISPUTE, "dispute"); + + private final Value value; + + private final String string; + + DisputeAlertTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof DisputeAlertTypes && this.string.equals(((DisputeAlertTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FRAUD: + return visitor.visitFraud(); + case DISPUTE_RDR: + return visitor.visitDisputeRdr(); + case DISPUTE: + return visitor.visitDispute(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DisputeAlertTypes valueOf(String value) { + switch (value) { + case "fraud": + return FRAUD; + case "dispute_rdr": + return DISPUTE_RDR; + case "dispute": + return DISPUTE; + default: + return new DisputeAlertTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + DISPUTE, + + DISPUTE_RDR, + + FRAUD, + + UNKNOWN + } + + public interface Visitor { + T visitDispute(); + + T visitDisputeRdr(); + + T visitFraud(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/DisputeAttachment.java b/src/main/java/com/whop/api/types/DisputeAttachment.java new file mode 100644 index 00000000..8391f59c --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeAttachment.java @@ -0,0 +1,415 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeAttachment.Builder.class) +public final class DisputeAttachment { + private final Optional contentType; + + private final Optional filename; + + private final Optional id; + + private final boolean platform; + + private final Optional url; + + private final Map additionalProperties; + + private DisputeAttachment( + Optional contentType, + Optional filename, + Optional id, + boolean platform, + Optional url, + Map additionalProperties) { + this.contentType = contentType; + this.filename = filename; + this.id = id; + this.platform = platform; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The uploaded file's MIME type. + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return The uploaded file's name. + */ + @JsonIgnore + public Optional getFilename() { + if (filename == null) { + return Optional.empty(); + } + return filename; + } + + /** + * @return The attachment's ID. null for a Whop-hosted policy, which is not an uploaded file. + */ + @JsonIgnore + public Optional getId() { + if (id == null) { + return Optional.empty(); + } + return id; + } + + /** + * @return Whether this is Whop's own hosted policy, standing in because the seller uploaded none. Sending it back on a PATCH changes nothing. + */ + @JsonProperty("platform") + public boolean getPlatform() { + return platform; + } + + /** + * @return A URL to download the attachment. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filename") + private Optional _getFilename() { + return filename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("id") + private Optional _getId() { + return id; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeAttachment && equalTo((DisputeAttachment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeAttachment other) { + return contentType.equals(other.contentType) + && filename.equals(other.filename) + && id.equals(other.id) + && platform == other.platform + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contentType, this.filename, this.id, this.platform, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlatformStage builder() { + return new Builder(); + } + + public interface PlatformStage { + /** + *

Whether this is Whop's own hosted policy, standing in because the seller uploaded none. Sending it back on a PATCH changes nothing.

+ */ + _FinalStage platform(boolean platform); + + Builder from(DisputeAttachment other); + } + + public interface _FinalStage { + DisputeAttachment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The uploaded file's MIME type.

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

The uploaded file's name.

+ */ + _FinalStage filename(Optional filename); + + _FinalStage filename(String filename); + + _FinalStage filename(Nullable filename); + + /** + *

The attachment's ID. null for a Whop-hosted policy, which is not an uploaded file.

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + + _FinalStage id(Nullable id); + + /** + *

A URL to download the attachment.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlatformStage, _FinalStage { + private boolean platform; + + private Optional url = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional filename = Optional.empty(); + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeAttachment other) { + contentType(other.getContentType()); + filename(other.getFilename()); + id(other.getId()); + platform(other.getPlatform()); + url(other.getUrl()); + return this; + } + + /** + *

Whether this is Whop's own hosted policy, standing in because the seller uploaded none. Sending it back on a PATCH changes nothing.

+ *

Whether this is Whop's own hosted policy, standing in because the seller uploaded none. Sending it back on a PATCH changes nothing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public _FinalStage platform(boolean platform) { + this.platform = platform; + return this; + } + + /** + *

A URL to download the attachment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

A URL to download the attachment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

A URL to download the attachment.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

The attachment's ID. null for a Whop-hosted policy, which is not an uploaded file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(Nullable id) { + if (id.isNull()) { + this.id = null; + } else if (id.isEmpty()) { + this.id = Optional.empty(); + } else { + this.id = Optional.of(id.get()); + } + return this; + } + + /** + *

The attachment's ID. null for a Whop-hosted policy, which is not an uploaded file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The attachment's ID. null for a Whop-hosted policy, which is not an uploaded file.

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + /** + *

The uploaded file's name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(Nullable filename) { + if (filename.isNull()) { + this.filename = null; + } else if (filename.isEmpty()) { + this.filename = Optional.empty(); + } else { + this.filename = Optional.of(filename.get()); + } + return this; + } + + /** + *

The uploaded file's name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(String filename) { + this.filename = Optional.ofNullable(filename); + return this; + } + + /** + *

The uploaded file's name.

+ */ + @java.lang.Override + @JsonSetter(value = "filename", nulls = Nulls.SKIP) + public _FinalStage filename(Optional filename) { + this.filename = filename; + return this; + } + + /** + *

The uploaded file's MIME type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

The uploaded file's MIME type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

The uploaded file's MIME type.

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public DisputeAttachment build() { + return new DisputeAttachment(contentType, filename, id, platform, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeBuyer.java b/src/main/java/com/whop/api/types/DisputeBuyer.java new file mode 100644 index 00000000..bdd8fa48 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeBuyer.java @@ -0,0 +1,336 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeBuyer.Builder.class) +public final class DisputeBuyer { + private final Optional email; + + private final Optional memberId; + + private final Optional name; + + private final Optional userId; + + private final Optional username; + + private final Map additionalProperties; + + private DisputeBuyer( + Optional email, + Optional memberId, + Optional name, + Optional userId, + Optional username, + Map additionalProperties) { + this.email = email; + this.memberId = memberId; + this.name = name; + this.userId = userId; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The customer's email address. Requires the member:email:read scope; null without it. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The customer's member row on the account, prefixed mem_. + */ + @JsonIgnore + public Optional getMemberId() { + if (memberId == null) { + return Optional.empty(); + } + return memberId; + } + + /** + * @return The customer's display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The customer's user ID, prefixed user_. null for a guest checkout. + */ + @JsonIgnore + public Optional getUserId() { + if (userId == null) { + return Optional.empty(); + } + return userId; + } + + /** + * @return The customer's Whop username. + */ + @JsonIgnore + public Optional getUsername() { + if (username == null) { + return Optional.empty(); + } + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member_id") + private Optional _getMemberId() { + return memberId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_id") + private Optional _getUserId() { + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("username") + private Optional _getUsername() { + return username; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeBuyer && equalTo((DisputeBuyer) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeBuyer other) { + return email.equals(other.email) + && memberId.equals(other.memberId) + && name.equals(other.name) + && userId.equals(other.userId) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.memberId, this.name, this.userId, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional email = Optional.empty(); + + private Optional memberId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional username = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DisputeBuyer other) { + email(other.getEmail()); + memberId(other.getMemberId()); + name(other.getName()); + userId(other.getUserId()); + username(other.getUsername()); + return this; + } + + /** + *

The customer's email address. Requires the member:email:read scope; null without it.

+ */ + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + public Builder email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The customer's member row on the account, prefixed mem_.

+ */ + @JsonSetter(value = "member_id", nulls = Nulls.SKIP) + public Builder memberId(Optional memberId) { + this.memberId = memberId; + return this; + } + + public Builder memberId(String memberId) { + this.memberId = Optional.ofNullable(memberId); + return this; + } + + public Builder memberId(Nullable memberId) { + if (memberId.isNull()) { + this.memberId = null; + } else if (memberId.isEmpty()) { + this.memberId = Optional.empty(); + } else { + this.memberId = Optional.of(memberId.get()); + } + return this; + } + + /** + *

The customer's display name.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The customer's user ID, prefixed user_. null for a guest checkout.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + public Builder userId(Nullable userId) { + if (userId.isNull()) { + this.userId = null; + } else if (userId.isEmpty()) { + this.userId = Optional.empty(); + } else { + this.userId = Optional.of(userId.get()); + } + return this; + } + + /** + *

The customer's Whop username.

+ */ + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public Builder username(Optional username) { + this.username = username; + return this; + } + + public Builder username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + public Builder username(Nullable username) { + if (username.isNull()) { + this.username = null; + } else if (username.isEmpty()) { + this.username = Optional.empty(); + } else { + this.username = Optional.of(username.get()); + } + return this; + } + + public DisputeBuyer build() { + return new DisputeBuyer(email, memberId, name, userId, username, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeEvidence.java b/src/main/java/com/whop/api/types/DisputeEvidence.java new file mode 100644 index 00000000..a07bf0e9 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeEvidence.java @@ -0,0 +1,853 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeEvidence.Builder.class) +public final class DisputeEvidence { + private final Optional accessActivityLog; + + private final Optional billingAddress; + + private final Optional cancellationPolicyAttachment; + + private final Optional cancellationPolicyDisclosure; + + private final Optional customerCommunicationAttachment; + + private final Optional customerEmailAddress; + + private final Optional customerName; + + private final List documents; + + private final Optional notes; + + private final Optional productDescription; + + private final Optional refundPolicyAttachment; + + private final Optional refundPolicyDisclosure; + + private final Optional refundRefusalExplanation; + + private final Optional serviceDate; + + private final Optional uncategorizedAttachment; + + private final Map additionalProperties; + + private DisputeEvidence( + Optional accessActivityLog, + Optional billingAddress, + Optional cancellationPolicyAttachment, + Optional cancellationPolicyDisclosure, + Optional customerCommunicationAttachment, + Optional customerEmailAddress, + Optional customerName, + List documents, + Optional notes, + Optional productDescription, + Optional refundPolicyAttachment, + Optional refundPolicyDisclosure, + Optional refundRefusalExplanation, + Optional serviceDate, + Optional uncategorizedAttachment, + Map additionalProperties) { + this.accessActivityLog = accessActivityLog; + this.billingAddress = billingAddress; + this.cancellationPolicyAttachment = cancellationPolicyAttachment; + this.cancellationPolicyDisclosure = cancellationPolicyDisclosure; + this.customerCommunicationAttachment = customerCommunicationAttachment; + this.customerEmailAddress = customerEmailAddress; + this.customerName = customerName; + this.documents = documents; + this.notes = notes; + this.productDescription = productDescription; + this.refundPolicyAttachment = refundPolicyAttachment; + this.refundPolicyDisclosure = refundPolicyDisclosure; + this.refundRefusalExplanation = refundRefusalExplanation; + this.serviceDate = serviceDate; + this.uncategorizedAttachment = uncategorizedAttachment; + this.additionalProperties = additionalProperties; + } + + /** + * @return Log of the customer's access to the product, such as sign-in or download activity. + */ + @JsonIgnore + public Optional getAccessActivityLog() { + if (accessActivityLog == null) { + return Optional.empty(); + } + return accessActivityLog; + } + + /** + * @return The billing address the customer provided at checkout. + */ + @JsonIgnore + public Optional getBillingAddress() { + if (billingAddress == null) { + return Optional.empty(); + } + return billingAddress; + } + + /** + * @return The cancellation policy document. Falls back to Whop's platform policy when the seller has not uploaded their own. + */ + @JsonIgnore + public Optional getCancellationPolicyAttachment() { + if (cancellationPolicyAttachment == null) { + return Optional.empty(); + } + return cancellationPolicyAttachment; + } + + /** + * @return How the cancellation policy was shown to the customer before purchase. + */ + @JsonIgnore + public Optional getCancellationPolicyDisclosure() { + if (cancellationPolicyDisclosure == null) { + return Optional.empty(); + } + return cancellationPolicyDisclosure; + } + + /** + * @return Correspondence with the customer, or proof they used the product. + */ + @JsonIgnore + public Optional getCustomerCommunicationAttachment() { + if (customerCommunicationAttachment == null) { + return Optional.empty(); + } + return customerCommunicationAttachment; + } + + /** + * @return The email address the customer used at checkout. + */ + @JsonIgnore + public Optional getCustomerEmailAddress() { + if (customerEmailAddress == null) { + return Optional.empty(); + } + return customerEmailAddress; + } + + /** + * @return The customer's name as given at checkout. + */ + @JsonIgnore + public Optional getCustomerName() { + if (customerName == null) { + return Optional.empty(); + } + return customerName; + } + + @JsonProperty("documents") + public List getDocuments() { + return documents; + } + + /** + * @return Any additional context for the processor reviewing the dispute. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + /** + * @return What the customer purchased, in the seller's own words. + */ + @JsonIgnore + public Optional getProductDescription() { + if (productDescription == null) { + return Optional.empty(); + } + return productDescription; + } + + /** + * @return The refund policy document. Falls back to Whop's platform policy when the seller has not uploaded their own. + */ + @JsonIgnore + public Optional getRefundPolicyAttachment() { + if (refundPolicyAttachment == null) { + return Optional.empty(); + } + return refundPolicyAttachment; + } + + /** + * @return How the refund policy was shown to the customer before purchase. + */ + @JsonIgnore + public Optional getRefundPolicyDisclosure() { + if (refundPolicyDisclosure == null) { + return Optional.empty(); + } + return refundPolicyDisclosure; + } + + /** + * @return Why a refund was refused, when one was requested and denied. + */ + @JsonIgnore + public Optional getRefundRefusalExplanation() { + if (refundRefusalExplanation == null) { + return Optional.empty(); + } + return refundRefusalExplanation; + } + + /** + * @return When the product or service was delivered. + */ + @JsonIgnore + public Optional getServiceDate() { + if (serviceDate == null) { + return Optional.empty(); + } + return serviceDate; + } + + /** + * @return Supporting evidence that does not fit the other categories. + */ + @JsonIgnore + public Optional getUncategorizedAttachment() { + if (uncategorizedAttachment == null) { + return Optional.empty(); + } + return uncategorizedAttachment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("access_activity_log") + private Optional _getAccessActivityLog() { + return accessActivityLog; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_address") + private Optional _getBillingAddress() { + return billingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancellation_policy_attachment") + private Optional _getCancellationPolicyAttachment() { + return cancellationPolicyAttachment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancellation_policy_disclosure") + private Optional _getCancellationPolicyDisclosure() { + return cancellationPolicyDisclosure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_communication_attachment") + private Optional _getCustomerCommunicationAttachment() { + return customerCommunicationAttachment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_email_address") + private Optional _getCustomerEmailAddress() { + return customerEmailAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_name") + private Optional _getCustomerName() { + return customerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_description") + private Optional _getProductDescription() { + return productDescription; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refund_policy_attachment") + private Optional _getRefundPolicyAttachment() { + return refundPolicyAttachment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refund_policy_disclosure") + private Optional _getRefundPolicyDisclosure() { + return refundPolicyDisclosure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refund_refusal_explanation") + private Optional _getRefundRefusalExplanation() { + return refundRefusalExplanation; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("service_date") + private Optional _getServiceDate() { + return serviceDate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("uncategorized_attachment") + private Optional _getUncategorizedAttachment() { + return uncategorizedAttachment; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeEvidence && equalTo((DisputeEvidence) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeEvidence other) { + return accessActivityLog.equals(other.accessActivityLog) + && billingAddress.equals(other.billingAddress) + && cancellationPolicyAttachment.equals(other.cancellationPolicyAttachment) + && cancellationPolicyDisclosure.equals(other.cancellationPolicyDisclosure) + && customerCommunicationAttachment.equals(other.customerCommunicationAttachment) + && customerEmailAddress.equals(other.customerEmailAddress) + && customerName.equals(other.customerName) + && documents.equals(other.documents) + && notes.equals(other.notes) + && productDescription.equals(other.productDescription) + && refundPolicyAttachment.equals(other.refundPolicyAttachment) + && refundPolicyDisclosure.equals(other.refundPolicyDisclosure) + && refundRefusalExplanation.equals(other.refundRefusalExplanation) + && serviceDate.equals(other.serviceDate) + && uncategorizedAttachment.equals(other.uncategorizedAttachment); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accessActivityLog, + this.billingAddress, + this.cancellationPolicyAttachment, + this.cancellationPolicyDisclosure, + this.customerCommunicationAttachment, + this.customerEmailAddress, + this.customerName, + this.documents, + this.notes, + this.productDescription, + this.refundPolicyAttachment, + this.refundPolicyDisclosure, + this.refundRefusalExplanation, + this.serviceDate, + this.uncategorizedAttachment); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accessActivityLog = Optional.empty(); + + private Optional billingAddress = Optional.empty(); + + private Optional cancellationPolicyAttachment = Optional.empty(); + + private Optional cancellationPolicyDisclosure = Optional.empty(); + + private Optional customerCommunicationAttachment = Optional.empty(); + + private Optional customerEmailAddress = Optional.empty(); + + private Optional customerName = Optional.empty(); + + private List documents = new ArrayList<>(); + + private Optional notes = Optional.empty(); + + private Optional productDescription = Optional.empty(); + + private Optional refundPolicyAttachment = Optional.empty(); + + private Optional refundPolicyDisclosure = Optional.empty(); + + private Optional refundRefusalExplanation = Optional.empty(); + + private Optional serviceDate = Optional.empty(); + + private Optional uncategorizedAttachment = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DisputeEvidence other) { + accessActivityLog(other.getAccessActivityLog()); + billingAddress(other.getBillingAddress()); + cancellationPolicyAttachment(other.getCancellationPolicyAttachment()); + cancellationPolicyDisclosure(other.getCancellationPolicyDisclosure()); + customerCommunicationAttachment(other.getCustomerCommunicationAttachment()); + customerEmailAddress(other.getCustomerEmailAddress()); + customerName(other.getCustomerName()); + documents(other.getDocuments()); + notes(other.getNotes()); + productDescription(other.getProductDescription()); + refundPolicyAttachment(other.getRefundPolicyAttachment()); + refundPolicyDisclosure(other.getRefundPolicyDisclosure()); + refundRefusalExplanation(other.getRefundRefusalExplanation()); + serviceDate(other.getServiceDate()); + uncategorizedAttachment(other.getUncategorizedAttachment()); + return this; + } + + /** + *

Log of the customer's access to the product, such as sign-in or download activity.

+ */ + @JsonSetter(value = "access_activity_log", nulls = Nulls.SKIP) + public Builder accessActivityLog(Optional accessActivityLog) { + this.accessActivityLog = accessActivityLog; + return this; + } + + public Builder accessActivityLog(String accessActivityLog) { + this.accessActivityLog = Optional.ofNullable(accessActivityLog); + return this; + } + + public Builder accessActivityLog(Nullable accessActivityLog) { + if (accessActivityLog.isNull()) { + this.accessActivityLog = null; + } else if (accessActivityLog.isEmpty()) { + this.accessActivityLog = Optional.empty(); + } else { + this.accessActivityLog = Optional.of(accessActivityLog.get()); + } + return this; + } + + /** + *

The billing address the customer provided at checkout.

+ */ + @JsonSetter(value = "billing_address", nulls = Nulls.SKIP) + public Builder billingAddress(Optional billingAddress) { + this.billingAddress = billingAddress; + return this; + } + + public Builder billingAddress(String billingAddress) { + this.billingAddress = Optional.ofNullable(billingAddress); + return this; + } + + public Builder billingAddress(Nullable billingAddress) { + if (billingAddress.isNull()) { + this.billingAddress = null; + } else if (billingAddress.isEmpty()) { + this.billingAddress = Optional.empty(); + } else { + this.billingAddress = Optional.of(billingAddress.get()); + } + return this; + } + + /** + *

The cancellation policy document. Falls back to Whop's platform policy when the seller has not uploaded their own.

+ */ + @JsonSetter(value = "cancellation_policy_attachment", nulls = Nulls.SKIP) + public Builder cancellationPolicyAttachment(Optional cancellationPolicyAttachment) { + this.cancellationPolicyAttachment = cancellationPolicyAttachment; + return this; + } + + public Builder cancellationPolicyAttachment(DisputeAttachment cancellationPolicyAttachment) { + this.cancellationPolicyAttachment = Optional.ofNullable(cancellationPolicyAttachment); + return this; + } + + public Builder cancellationPolicyAttachment(Nullable cancellationPolicyAttachment) { + if (cancellationPolicyAttachment.isNull()) { + this.cancellationPolicyAttachment = null; + } else if (cancellationPolicyAttachment.isEmpty()) { + this.cancellationPolicyAttachment = Optional.empty(); + } else { + this.cancellationPolicyAttachment = Optional.of(cancellationPolicyAttachment.get()); + } + return this; + } + + /** + *

How the cancellation policy was shown to the customer before purchase.

+ */ + @JsonSetter(value = "cancellation_policy_disclosure", nulls = Nulls.SKIP) + public Builder cancellationPolicyDisclosure(Optional cancellationPolicyDisclosure) { + this.cancellationPolicyDisclosure = cancellationPolicyDisclosure; + return this; + } + + public Builder cancellationPolicyDisclosure(String cancellationPolicyDisclosure) { + this.cancellationPolicyDisclosure = Optional.ofNullable(cancellationPolicyDisclosure); + return this; + } + + public Builder cancellationPolicyDisclosure(Nullable cancellationPolicyDisclosure) { + if (cancellationPolicyDisclosure.isNull()) { + this.cancellationPolicyDisclosure = null; + } else if (cancellationPolicyDisclosure.isEmpty()) { + this.cancellationPolicyDisclosure = Optional.empty(); + } else { + this.cancellationPolicyDisclosure = Optional.of(cancellationPolicyDisclosure.get()); + } + return this; + } + + /** + *

Correspondence with the customer, or proof they used the product.

+ */ + @JsonSetter(value = "customer_communication_attachment", nulls = Nulls.SKIP) + public Builder customerCommunicationAttachment(Optional customerCommunicationAttachment) { + this.customerCommunicationAttachment = customerCommunicationAttachment; + return this; + } + + public Builder customerCommunicationAttachment(DisputeAttachment customerCommunicationAttachment) { + this.customerCommunicationAttachment = Optional.ofNullable(customerCommunicationAttachment); + return this; + } + + public Builder customerCommunicationAttachment(Nullable customerCommunicationAttachment) { + if (customerCommunicationAttachment.isNull()) { + this.customerCommunicationAttachment = null; + } else if (customerCommunicationAttachment.isEmpty()) { + this.customerCommunicationAttachment = Optional.empty(); + } else { + this.customerCommunicationAttachment = Optional.of(customerCommunicationAttachment.get()); + } + return this; + } + + /** + *

The email address the customer used at checkout.

+ */ + @JsonSetter(value = "customer_email_address", nulls = Nulls.SKIP) + public Builder customerEmailAddress(Optional customerEmailAddress) { + this.customerEmailAddress = customerEmailAddress; + return this; + } + + public Builder customerEmailAddress(String customerEmailAddress) { + this.customerEmailAddress = Optional.ofNullable(customerEmailAddress); + return this; + } + + public Builder customerEmailAddress(Nullable customerEmailAddress) { + if (customerEmailAddress.isNull()) { + this.customerEmailAddress = null; + } else if (customerEmailAddress.isEmpty()) { + this.customerEmailAddress = Optional.empty(); + } else { + this.customerEmailAddress = Optional.of(customerEmailAddress.get()); + } + return this; + } + + /** + *

The customer's name as given at checkout.

+ */ + @JsonSetter(value = "customer_name", nulls = Nulls.SKIP) + public Builder customerName(Optional customerName) { + this.customerName = customerName; + return this; + } + + public Builder customerName(String customerName) { + this.customerName = Optional.ofNullable(customerName); + return this; + } + + public Builder customerName(Nullable customerName) { + if (customerName.isNull()) { + this.customerName = null; + } else if (customerName.isEmpty()) { + this.customerName = Optional.empty(); + } else { + this.customerName = Optional.of(customerName.get()); + } + return this; + } + + @JsonSetter(value = "documents", nulls = Nulls.SKIP) + public Builder documents(List documents) { + this.documents.clear(); + if (documents != null) { + this.documents.addAll(documents); + } + return this; + } + + public Builder addDocuments(DisputeEvidenceDocument documents) { + this.documents.add(documents); + return this; + } + + public Builder addAllDocuments(List documents) { + if (documents != null) { + this.documents.addAll(documents); + } + return this; + } + + /** + *

Any additional context for the processor reviewing the dispute.

+ */ + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public Builder notes(Optional notes) { + this.notes = notes; + return this; + } + + public Builder notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + public Builder notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

What the customer purchased, in the seller's own words.

+ */ + @JsonSetter(value = "product_description", nulls = Nulls.SKIP) + public Builder productDescription(Optional productDescription) { + this.productDescription = productDescription; + return this; + } + + public Builder productDescription(String productDescription) { + this.productDescription = Optional.ofNullable(productDescription); + return this; + } + + public Builder productDescription(Nullable productDescription) { + if (productDescription.isNull()) { + this.productDescription = null; + } else if (productDescription.isEmpty()) { + this.productDescription = Optional.empty(); + } else { + this.productDescription = Optional.of(productDescription.get()); + } + return this; + } + + /** + *

The refund policy document. Falls back to Whop's platform policy when the seller has not uploaded their own.

+ */ + @JsonSetter(value = "refund_policy_attachment", nulls = Nulls.SKIP) + public Builder refundPolicyAttachment(Optional refundPolicyAttachment) { + this.refundPolicyAttachment = refundPolicyAttachment; + return this; + } + + public Builder refundPolicyAttachment(DisputeAttachment refundPolicyAttachment) { + this.refundPolicyAttachment = Optional.ofNullable(refundPolicyAttachment); + return this; + } + + public Builder refundPolicyAttachment(Nullable refundPolicyAttachment) { + if (refundPolicyAttachment.isNull()) { + this.refundPolicyAttachment = null; + } else if (refundPolicyAttachment.isEmpty()) { + this.refundPolicyAttachment = Optional.empty(); + } else { + this.refundPolicyAttachment = Optional.of(refundPolicyAttachment.get()); + } + return this; + } + + /** + *

How the refund policy was shown to the customer before purchase.

+ */ + @JsonSetter(value = "refund_policy_disclosure", nulls = Nulls.SKIP) + public Builder refundPolicyDisclosure(Optional refundPolicyDisclosure) { + this.refundPolicyDisclosure = refundPolicyDisclosure; + return this; + } + + public Builder refundPolicyDisclosure(String refundPolicyDisclosure) { + this.refundPolicyDisclosure = Optional.ofNullable(refundPolicyDisclosure); + return this; + } + + public Builder refundPolicyDisclosure(Nullable refundPolicyDisclosure) { + if (refundPolicyDisclosure.isNull()) { + this.refundPolicyDisclosure = null; + } else if (refundPolicyDisclosure.isEmpty()) { + this.refundPolicyDisclosure = Optional.empty(); + } else { + this.refundPolicyDisclosure = Optional.of(refundPolicyDisclosure.get()); + } + return this; + } + + /** + *

Why a refund was refused, when one was requested and denied.

+ */ + @JsonSetter(value = "refund_refusal_explanation", nulls = Nulls.SKIP) + public Builder refundRefusalExplanation(Optional refundRefusalExplanation) { + this.refundRefusalExplanation = refundRefusalExplanation; + return this; + } + + public Builder refundRefusalExplanation(String refundRefusalExplanation) { + this.refundRefusalExplanation = Optional.ofNullable(refundRefusalExplanation); + return this; + } + + public Builder refundRefusalExplanation(Nullable refundRefusalExplanation) { + if (refundRefusalExplanation.isNull()) { + this.refundRefusalExplanation = null; + } else if (refundRefusalExplanation.isEmpty()) { + this.refundRefusalExplanation = Optional.empty(); + } else { + this.refundRefusalExplanation = Optional.of(refundRefusalExplanation.get()); + } + return this; + } + + /** + *

When the product or service was delivered.

+ */ + @JsonSetter(value = "service_date", nulls = Nulls.SKIP) + public Builder serviceDate(Optional serviceDate) { + this.serviceDate = serviceDate; + return this; + } + + public Builder serviceDate(String serviceDate) { + this.serviceDate = Optional.ofNullable(serviceDate); + return this; + } + + public Builder serviceDate(Nullable serviceDate) { + if (serviceDate.isNull()) { + this.serviceDate = null; + } else if (serviceDate.isEmpty()) { + this.serviceDate = Optional.empty(); + } else { + this.serviceDate = Optional.of(serviceDate.get()); + } + return this; + } + + /** + *

Supporting evidence that does not fit the other categories.

+ */ + @JsonSetter(value = "uncategorized_attachment", nulls = Nulls.SKIP) + public Builder uncategorizedAttachment(Optional uncategorizedAttachment) { + this.uncategorizedAttachment = uncategorizedAttachment; + return this; + } + + public Builder uncategorizedAttachment(DisputeAttachment uncategorizedAttachment) { + this.uncategorizedAttachment = Optional.ofNullable(uncategorizedAttachment); + return this; + } + + public Builder uncategorizedAttachment(Nullable uncategorizedAttachment) { + if (uncategorizedAttachment.isNull()) { + this.uncategorizedAttachment = null; + } else if (uncategorizedAttachment.isEmpty()) { + this.uncategorizedAttachment = Optional.empty(); + } else { + this.uncategorizedAttachment = Optional.of(uncategorizedAttachment.get()); + } + return this; + } + + public DisputeEvidence build() { + return new DisputeEvidence( + accessActivityLog, + billingAddress, + cancellationPolicyAttachment, + cancellationPolicyDisclosure, + customerCommunicationAttachment, + customerEmailAddress, + customerName, + documents, + notes, + productDescription, + refundPolicyAttachment, + refundPolicyDisclosure, + refundRefusalExplanation, + serviceDate, + uncategorizedAttachment, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeEvidenceDocument.java b/src/main/java/com/whop/api/types/DisputeEvidenceDocument.java new file mode 100644 index 00000000..fba23ff3 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeEvidenceDocument.java @@ -0,0 +1,381 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeEvidenceDocument.Builder.class) +public final class DisputeEvidenceDocument { + private final Optional contentType; + + private final DisputeEvidenceDocumentDocumentType documentType; + + private final Optional filename; + + private final String id; + + private final Optional url; + + private final Map additionalProperties; + + private DisputeEvidenceDocument( + Optional contentType, + DisputeEvidenceDocumentDocumentType documentType, + Optional filename, + String id, + Optional url, + Map additionalProperties) { + this.contentType = contentType; + this.documentType = documentType; + this.filename = filename; + this.id = id; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The uploaded file's MIME type. Uploads are restricted to the types the processor accepts. + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return What kind of evidence the document is. + */ + @JsonProperty("document_type") + public DisputeEvidenceDocumentDocumentType getDocumentType() { + return documentType; + } + + /** + * @return The uploaded file's name. + */ + @JsonIgnore + public Optional getFilename() { + if (filename == null) { + return Optional.empty(); + } + return filename; + } + + /** + * @return The attachment's ID, prefixed file_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A URL to download the document. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filename") + private Optional _getFilename() { + return filename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeEvidenceDocument && equalTo((DisputeEvidenceDocument) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeEvidenceDocument other) { + return contentType.equals(other.contentType) + && documentType.equals(other.documentType) + && filename.equals(other.filename) + && id.equals(other.id) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contentType, this.documentType, this.filename, this.id, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DocumentTypeStage builder() { + return new Builder(); + } + + public interface DocumentTypeStage { + /** + *

What kind of evidence the document is.

+ */ + IdStage documentType(@NotNull DisputeEvidenceDocumentDocumentType documentType); + + Builder from(DisputeEvidenceDocument other); + } + + public interface IdStage { + /** + *

The attachment's ID, prefixed file_.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DisputeEvidenceDocument build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The uploaded file's MIME type. Uploads are restricted to the types the processor accepts.

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(DisputeEvidenceDocumentContentType contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

The uploaded file's name.

+ */ + _FinalStage filename(Optional filename); + + _FinalStage filename(String filename); + + _FinalStage filename(Nullable filename); + + /** + *

A URL to download the document.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DocumentTypeStage, IdStage, _FinalStage { + private DisputeEvidenceDocumentDocumentType documentType; + + private String id; + + private Optional url = Optional.empty(); + + private Optional filename = Optional.empty(); + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeEvidenceDocument other) { + contentType(other.getContentType()); + documentType(other.getDocumentType()); + filename(other.getFilename()); + id(other.getId()); + url(other.getUrl()); + return this; + } + + /** + *

What kind of evidence the document is.

+ *

What kind of evidence the document is.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("document_type") + public IdStage documentType(@NotNull DisputeEvidenceDocumentDocumentType documentType) { + this.documentType = Objects.requireNonNull(documentType, "documentType must not be null"); + return this; + } + + /** + *

The attachment's ID, prefixed file_.

+ *

The attachment's ID, prefixed file_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

A URL to download the document.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

A URL to download the document.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

A URL to download the document.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

The uploaded file's name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(Nullable filename) { + if (filename.isNull()) { + this.filename = null; + } else if (filename.isEmpty()) { + this.filename = Optional.empty(); + } else { + this.filename = Optional.of(filename.get()); + } + return this; + } + + /** + *

The uploaded file's name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(String filename) { + this.filename = Optional.ofNullable(filename); + return this; + } + + /** + *

The uploaded file's name.

+ */ + @java.lang.Override + @JsonSetter(value = "filename", nulls = Nulls.SKIP) + public _FinalStage filename(Optional filename) { + this.filename = filename; + return this; + } + + /** + *

The uploaded file's MIME type. Uploads are restricted to the types the processor accepts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

The uploaded file's MIME type. Uploads are restricted to the types the processor accepts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(DisputeEvidenceDocumentContentType contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

The uploaded file's MIME type. Uploads are restricted to the types the processor accepts.

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public DisputeEvidenceDocument build() { + return new DisputeEvidenceDocument(contentType, documentType, filename, id, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeEvidenceDocumentContentType.java b/src/main/java/com/whop/api/types/DisputeEvidenceDocumentContentType.java new file mode 100644 index 00000000..f2c0b10f --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeEvidenceDocumentContentType.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DisputeEvidenceDocumentContentType { + public static final DisputeEvidenceDocumentContentType IMAGE_WEBP = + new DisputeEvidenceDocumentContentType(Value.IMAGE_WEBP, "image/webp"); + + public static final DisputeEvidenceDocumentContentType APPLICATION_PDF = + new DisputeEvidenceDocumentContentType(Value.APPLICATION_PDF, "application/pdf"); + + public static final DisputeEvidenceDocumentContentType IMAGE_JPEG = + new DisputeEvidenceDocumentContentType(Value.IMAGE_JPEG, "image/jpeg"); + + public static final DisputeEvidenceDocumentContentType IMAGE_PNG = + new DisputeEvidenceDocumentContentType(Value.IMAGE_PNG, "image/png"); + + public static final DisputeEvidenceDocumentContentType APPLICATION_JSON = + new DisputeEvidenceDocumentContentType(Value.APPLICATION_JSON, "application/json"); + + private final Value value; + + private final String string; + + DisputeEvidenceDocumentContentType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof DisputeEvidenceDocumentContentType + && this.string.equals(((DisputeEvidenceDocumentContentType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case IMAGE_WEBP: + return visitor.visitImageWebp(); + case APPLICATION_PDF: + return visitor.visitApplicationPdf(); + case IMAGE_JPEG: + return visitor.visitImageJpeg(); + case IMAGE_PNG: + return visitor.visitImagePng(); + case APPLICATION_JSON: + return visitor.visitApplicationJson(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DisputeEvidenceDocumentContentType valueOf(String value) { + switch (value) { + case "image/webp": + return IMAGE_WEBP; + case "application/pdf": + return APPLICATION_PDF; + case "image/jpeg": + return IMAGE_JPEG; + case "image/png": + return IMAGE_PNG; + case "application/json": + return APPLICATION_JSON; + default: + return new DisputeEvidenceDocumentContentType(Value.UNKNOWN, value); + } + } + + public enum Value { + APPLICATION_PDF, + + APPLICATION_JSON, + + IMAGE_JPEG, + + IMAGE_PNG, + + IMAGE_WEBP, + + UNKNOWN + } + + public interface Visitor { + T visitApplicationPdf(); + + T visitApplicationJson(); + + T visitImageJpeg(); + + T visitImagePng(); + + T visitImageWebp(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/DisputeEvidenceDocumentDocumentType.java b/src/main/java/com/whop/api/types/DisputeEvidenceDocumentDocumentType.java new file mode 100644 index 00000000..0bbffb5e --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeEvidenceDocumentDocumentType.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DisputeEvidenceDocumentDocumentType { + public static final DisputeEvidenceDocumentDocumentType DIGITAL_FULFILLMENT = + new DisputeEvidenceDocumentDocumentType(Value.DIGITAL_FULFILLMENT, "digital_fulfillment"); + + public static final DisputeEvidenceDocumentDocumentType RETURN_POLICY = + new DisputeEvidenceDocumentDocumentType(Value.RETURN_POLICY, "return_policy"); + + public static final DisputeEvidenceDocumentDocumentType SHIPPING_POLICY = + new DisputeEvidenceDocumentDocumentType(Value.SHIPPING_POLICY, "shipping_policy"); + + public static final DisputeEvidenceDocumentDocumentType CUSTOMER_ORDER_HISTORY = + new DisputeEvidenceDocumentDocumentType(Value.CUSTOMER_ORDER_HISTORY, "customer_order_history"); + + public static final DisputeEvidenceDocumentDocumentType SUBSCRIPTION = + new DisputeEvidenceDocumentDocumentType(Value.SUBSCRIPTION, "subscription"); + + public static final DisputeEvidenceDocumentDocumentType PRODUCT_IMAGE = + new DisputeEvidenceDocumentDocumentType(Value.PRODUCT_IMAGE, "product_image"); + + public static final DisputeEvidenceDocumentDocumentType PHYSICAL_FULFILLMENT = + new DisputeEvidenceDocumentDocumentType(Value.PHYSICAL_FULFILLMENT, "physical_fulfillment"); + + public static final DisputeEvidenceDocumentDocumentType CUSTOMER_SESSION = + new DisputeEvidenceDocumentDocumentType(Value.CUSTOMER_SESSION, "customer_session"); + + public static final DisputeEvidenceDocumentDocumentType PRIOR_TRANSACTIONS = + new DisputeEvidenceDocumentDocumentType(Value.PRIOR_TRANSACTIONS, "prior_transactions"); + + private final Value value; + + private final String string; + + DisputeEvidenceDocumentDocumentType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof DisputeEvidenceDocumentDocumentType + && this.string.equals(((DisputeEvidenceDocumentDocumentType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DIGITAL_FULFILLMENT: + return visitor.visitDigitalFulfillment(); + case RETURN_POLICY: + return visitor.visitReturnPolicy(); + case SHIPPING_POLICY: + return visitor.visitShippingPolicy(); + case CUSTOMER_ORDER_HISTORY: + return visitor.visitCustomerOrderHistory(); + case SUBSCRIPTION: + return visitor.visitSubscription(); + case PRODUCT_IMAGE: + return visitor.visitProductImage(); + case PHYSICAL_FULFILLMENT: + return visitor.visitPhysicalFulfillment(); + case CUSTOMER_SESSION: + return visitor.visitCustomerSession(); + case PRIOR_TRANSACTIONS: + return visitor.visitPriorTransactions(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DisputeEvidenceDocumentDocumentType valueOf(String value) { + switch (value) { + case "digital_fulfillment": + return DIGITAL_FULFILLMENT; + case "return_policy": + return RETURN_POLICY; + case "shipping_policy": + return SHIPPING_POLICY; + case "customer_order_history": + return CUSTOMER_ORDER_HISTORY; + case "subscription": + return SUBSCRIPTION; + case "product_image": + return PRODUCT_IMAGE; + case "physical_fulfillment": + return PHYSICAL_FULFILLMENT; + case "customer_session": + return CUSTOMER_SESSION; + case "prior_transactions": + return PRIOR_TRANSACTIONS; + default: + return new DisputeEvidenceDocumentDocumentType(Value.UNKNOWN, value); + } + } + + public enum Value { + RETURN_POLICY, + + SHIPPING_POLICY, + + PHYSICAL_FULFILLMENT, + + CUSTOMER_ORDER_HISTORY, + + PRODUCT_IMAGE, + + PRIOR_TRANSACTIONS, + + CUSTOMER_SESSION, + + DIGITAL_FULFILLMENT, + + SUBSCRIPTION, + + UNKNOWN + } + + public interface Visitor { + T visitReturnPolicy(); + + T visitShippingPolicy(); + + T visitPhysicalFulfillment(); + + T visitCustomerOrderHistory(); + + T visitProductImage(); + + T visitPriorTransactions(); + + T visitCustomerSession(); + + T visitDigitalFulfillment(); + + T visitSubscription(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/DisputeEvidenceLockedReason.java b/src/main/java/com/whop/api/types/DisputeEvidenceLockedReason.java new file mode 100644 index 00000000..c74d15bb --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeEvidenceLockedReason.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DisputeEvidenceLockedReason { + public static final DisputeEvidenceLockedReason RESPONSE_WINDOW_CLOSED = + new DisputeEvidenceLockedReason(Value.RESPONSE_WINDOW_CLOSED, "response_window_closed"); + + public static final DisputeEvidenceLockedReason SUBMITTED = + new DisputeEvidenceLockedReason(Value.SUBMITTED, "submitted"); + + public static final DisputeEvidenceLockedReason NOT_CONTESTABLE = + new DisputeEvidenceLockedReason(Value.NOT_CONTESTABLE, "not_contestable"); + + private final Value value; + + private final String string; + + DisputeEvidenceLockedReason(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof DisputeEvidenceLockedReason + && this.string.equals(((DisputeEvidenceLockedReason) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RESPONSE_WINDOW_CLOSED: + return visitor.visitResponseWindowClosed(); + case SUBMITTED: + return visitor.visitSubmitted(); + case NOT_CONTESTABLE: + return visitor.visitNotContestable(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DisputeEvidenceLockedReason valueOf(String value) { + switch (value) { + case "response_window_closed": + return RESPONSE_WINDOW_CLOSED; + case "submitted": + return SUBMITTED; + case "not_contestable": + return NOT_CONTESTABLE; + default: + return new DisputeEvidenceLockedReason(Value.UNKNOWN, value); + } + } + + public enum Value { + SUBMITTED, + + RESPONSE_WINDOW_CLOSED, + + NOT_CONTESTABLE, + + UNKNOWN + } + + public interface Visitor { + T visitSubmitted(); + + T visitResponseWindowClosed(); + + T visitNotContestable(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/DisputeIssuerComment.java b/src/main/java/com/whop/api/types/DisputeIssuerComment.java new file mode 100644 index 00000000..8d8a813c --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeIssuerComment.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeIssuerComment.Builder.class) +public final class DisputeIssuerComment { + private final Optional receivedAt; + + private final String text; + + private final Map additionalProperties; + + private DisputeIssuerComment(Optional receivedAt, String text, Map additionalProperties) { + this.receivedAt = receivedAt; + this.text = text; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the comment was received, as an ISO 8601 timestamp. + */ + @JsonIgnore + public Optional getReceivedAt() { + if (receivedAt == null) { + return Optional.empty(); + } + return receivedAt; + } + + /** + * @return What the issuer wrote, as received. + */ + @JsonProperty("text") + public String getText() { + return text; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("received_at") + private Optional _getReceivedAt() { + return receivedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeIssuerComment && equalTo((DisputeIssuerComment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeIssuerComment other) { + return receivedAt.equals(other.receivedAt) && text.equals(other.text); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.receivedAt, this.text); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TextStage builder() { + return new Builder(); + } + + public interface TextStage { + /** + *

What the issuer wrote, as received.

+ */ + _FinalStage text(@NotNull String text); + + Builder from(DisputeIssuerComment other); + } + + public interface _FinalStage { + DisputeIssuerComment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When the comment was received, as an ISO 8601 timestamp.

+ */ + _FinalStage receivedAt(Optional receivedAt); + + _FinalStage receivedAt(String receivedAt); + + _FinalStage receivedAt(Nullable receivedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TextStage, _FinalStage { + private String text; + + private Optional receivedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeIssuerComment other) { + receivedAt(other.getReceivedAt()); + text(other.getText()); + return this; + } + + /** + *

What the issuer wrote, as received.

+ *

What the issuer wrote, as received.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("text") + public _FinalStage text(@NotNull String text) { + this.text = Objects.requireNonNull(text, "text must not be null"); + return this; + } + + /** + *

When the comment was received, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage receivedAt(Nullable receivedAt) { + if (receivedAt.isNull()) { + this.receivedAt = null; + } else if (receivedAt.isEmpty()) { + this.receivedAt = Optional.empty(); + } else { + this.receivedAt = Optional.of(receivedAt.get()); + } + return this; + } + + /** + *

When the comment was received, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage receivedAt(String receivedAt) { + this.receivedAt = Optional.ofNullable(receivedAt); + return this; + } + + /** + *

When the comment was received, as an ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "received_at", nulls = Nulls.SKIP) + public _FinalStage receivedAt(Optional receivedAt) { + this.receivedAt = receivedAt; + return this; + } + + @java.lang.Override + public DisputeIssuerComment build() { + return new DisputeIssuerComment(receivedAt, text, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeListItem.java b/src/main/java/com/whop/api/types/DisputeListItem.java new file mode 100644 index 00000000..aa88e162 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeListItem.java @@ -0,0 +1,937 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeListItem.Builder.class) +public final class DisputeListItem { + private final double amount; + + private final Optional company; + + private final Optional createdAt; + + private final Currencies currency; + + private final Optional editable; + + private final String id; + + private final Optional needsResponseBy; + + private final Optional payment; + + private final Optional plan; + + private final Optional product; + + private final Optional reason; + + private final Optional reasonCode; + + private final DisputeStatuses status; + + private final boolean visaRdr; + + private final Map additionalProperties; + + private DisputeListItem( + double amount, + Optional company, + Optional createdAt, + Currencies currency, + Optional editable, + String id, + Optional needsResponseBy, + Optional payment, + Optional plan, + Optional product, + Optional reason, + Optional reasonCode, + DisputeStatuses status, + boolean visaRdr, + Map additionalProperties) { + this.amount = amount; + this.company = company; + this.createdAt = createdAt; + this.currency = currency; + this.editable = editable; + this.id = id; + this.needsResponseBy = needsResponseBy; + this.payment = payment; + this.plan = plan; + this.product = product; + this.reason = reason; + this.reasonCode = reasonCode; + this.status = status; + this.visaRdr = visaRdr; + this.additionalProperties = additionalProperties; + } + + /** + * @return The disputed amount in the specified currency, formatted as a decimal. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The company that the dispute was filed against. + */ + @JsonIgnore + public Optional getCompany() { + if (company == null) { + return Optional.empty(); + } + return company; + } + + /** + * @return The datetime the dispute was created. + */ + @JsonIgnore + public Optional getCreatedAt() { + if (createdAt == null) { + return Optional.empty(); + } + return createdAt; + } + + /** + * @return The three-letter ISO currency code for the disputed amount. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return Whether the dispute evidence can still be edited and submitted. + */ + @JsonIgnore + public Optional getEditable() { + if (editable == null) { + return Optional.empty(); + } + return editable; + } + + /** + * @return The unique identifier for the dispute. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The deadline by which dispute evidence must be submitted. Null if no response deadline is set. + */ + @JsonIgnore + public Optional getNeedsResponseBy() { + if (needsResponseBy == null) { + return Optional.empty(); + } + return needsResponseBy; + } + + /** + * @return The original payment that was disputed. + */ + @JsonIgnore + public Optional getPayment() { + if (payment == null) { + return Optional.empty(); + } + return payment; + } + + /** + * @return The plan associated with the disputed payment. Null if the dispute is not linked to a specific plan. + */ + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + /** + * @return The product associated with the disputed payment. Null if the dispute is not linked to a specific product. + */ + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return A human-readable reason for the dispute. + */ + @JsonIgnore + public Optional getReason() { + if (reason == null) { + return Optional.empty(); + } + return reason; + } + + /** + * @return The card network reason code for the dispute. Null when the payment processor did not provide one. + */ + @JsonIgnore + public Optional getReasonCode() { + if (reasonCode == null) { + return Optional.empty(); + } + return reasonCode; + } + + /** + * @return The current status of the dispute lifecycle, such as needs_response, under_review, won, or lost. + */ + @JsonProperty("status") + public DisputeStatuses getStatus() { + return status; + } + + /** + * @return Whether the dispute was automatically resolved through Visa Rapid Dispute Resolution (RDR). + */ + @JsonProperty("visa_rdr") + public boolean getVisaRdr() { + return visaRdr; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company") + private Optional _getCompany() { + return company; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_at") + private Optional _getCreatedAt() { + return createdAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("editable") + private Optional _getEditable() { + return editable; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("needs_response_by") + private Optional _getNeedsResponseBy() { + return needsResponseBy; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment") + private Optional _getPayment() { + return payment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reason") + private Optional _getReason() { + return reason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reason_code") + private Optional _getReasonCode() { + return reasonCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeListItem && equalTo((DisputeListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeListItem other) { + return amount == other.amount + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && editable.equals(other.editable) + && id.equals(other.id) + && needsResponseBy.equals(other.needsResponseBy) + && payment.equals(other.payment) + && plan.equals(other.plan) + && product.equals(other.product) + && reason.equals(other.reason) + && reasonCode.equals(other.reasonCode) + && status.equals(other.status) + && visaRdr == other.visaRdr; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.company, + this.createdAt, + this.currency, + this.editable, + this.id, + this.needsResponseBy, + this.payment, + this.plan, + this.product, + this.reason, + this.reasonCode, + this.status, + this.visaRdr); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The disputed amount in the specified currency, formatted as a decimal.

+ */ + CurrencyStage amount(double amount); + + Builder from(DisputeListItem other); + } + + public interface CurrencyStage { + /** + *

The three-letter ISO currency code for the disputed amount.

+ */ + IdStage currency(@NotNull Currencies currency); + } + + public interface IdStage { + /** + *

The unique identifier for the dispute.

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

The current status of the dispute lifecycle, such as needs_response, under_review, won, or lost.

+ */ + VisaRdrStage status(@NotNull DisputeStatuses status); + } + + public interface VisaRdrStage { + /** + *

Whether the dispute was automatically resolved through Visa Rapid Dispute Resolution (RDR).

+ */ + _FinalStage visaRdr(boolean visaRdr); + } + + public interface _FinalStage { + DisputeListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The company that the dispute was filed against.

+ */ + _FinalStage company(Optional company); + + _FinalStage company(DisputeListItemCompany company); + + _FinalStage company(Nullable company); + + /** + *

The datetime the dispute was created.

+ */ + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage createdAt(Nullable createdAt); + + /** + *

Whether the dispute evidence can still be edited and submitted.

+ */ + _FinalStage editable(Optional editable); + + _FinalStage editable(Boolean editable); + + _FinalStage editable(Nullable editable); + + /** + *

The deadline by which dispute evidence must be submitted. Null if no response deadline is set.

+ */ + _FinalStage needsResponseBy(Optional needsResponseBy); + + _FinalStage needsResponseBy(OffsetDateTime needsResponseBy); + + _FinalStage needsResponseBy(Nullable needsResponseBy); + + /** + *

The original payment that was disputed.

+ */ + _FinalStage payment(Optional payment); + + _FinalStage payment(DisputeListItemPayment payment); + + _FinalStage payment(Nullable payment); + + /** + *

The plan associated with the disputed payment. Null if the dispute is not linked to a specific plan.

+ */ + _FinalStage plan(Optional plan); + + _FinalStage plan(DisputeListItemPlan plan); + + _FinalStage plan(Nullable plan); + + /** + *

The product associated with the disputed payment. Null if the dispute is not linked to a specific product.

+ */ + _FinalStage product(Optional product); + + _FinalStage product(DisputeListItemProduct product); + + _FinalStage product(Nullable product); + + /** + *

A human-readable reason for the dispute.

+ */ + _FinalStage reason(Optional reason); + + _FinalStage reason(String reason); + + _FinalStage reason(Nullable reason); + + /** + *

The card network reason code for the dispute. Null when the payment processor did not provide one.

+ */ + _FinalStage reasonCode(Optional reasonCode); + + _FinalStage reasonCode(String reasonCode); + + _FinalStage reasonCode(Nullable reasonCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, CurrencyStage, IdStage, StatusStage, VisaRdrStage, _FinalStage { + private double amount; + + private Currencies currency; + + private String id; + + private DisputeStatuses status; + + private boolean visaRdr; + + private Optional reasonCode = Optional.empty(); + + private Optional reason = Optional.empty(); + + private Optional product = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional payment = Optional.empty(); + + private Optional needsResponseBy = Optional.empty(); + + private Optional editable = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional company = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeListItem other) { + amount(other.getAmount()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + editable(other.getEditable()); + id(other.getId()); + needsResponseBy(other.getNeedsResponseBy()); + payment(other.getPayment()); + plan(other.getPlan()); + product(other.getProduct()); + reason(other.getReason()); + reasonCode(other.getReasonCode()); + status(other.getStatus()); + visaRdr(other.getVisaRdr()); + return this; + } + + /** + *

The disputed amount in the specified currency, formatted as a decimal.

+ *

The disputed amount in the specified currency, formatted as a decimal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CurrencyStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The three-letter ISO currency code for the disputed amount.

+ *

The three-letter ISO currency code for the disputed amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier for the dispute.

+ *

The unique identifier for the dispute.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current status of the dispute lifecycle, such as needs_response, under_review, won, or lost.

+ *

The current status of the dispute lifecycle, such as needs_response, under_review, won, or lost.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public VisaRdrStage status(@NotNull DisputeStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Whether the dispute was automatically resolved through Visa Rapid Dispute Resolution (RDR).

+ *

Whether the dispute was automatically resolved through Visa Rapid Dispute Resolution (RDR).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("visa_rdr") + public _FinalStage visaRdr(boolean visaRdr) { + this.visaRdr = visaRdr; + return this; + } + + /** + *

The card network reason code for the dispute. Null when the payment processor did not provide one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reasonCode(Nullable reasonCode) { + if (reasonCode.isNull()) { + this.reasonCode = null; + } else if (reasonCode.isEmpty()) { + this.reasonCode = Optional.empty(); + } else { + this.reasonCode = Optional.of(reasonCode.get()); + } + return this; + } + + /** + *

The card network reason code for the dispute. Null when the payment processor did not provide one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reasonCode(String reasonCode) { + this.reasonCode = Optional.ofNullable(reasonCode); + return this; + } + + /** + *

The card network reason code for the dispute. Null when the payment processor did not provide one.

+ */ + @java.lang.Override + @JsonSetter(value = "reason_code", nulls = Nulls.SKIP) + public _FinalStage reasonCode(Optional reasonCode) { + this.reasonCode = reasonCode; + return this; + } + + /** + *

A human-readable reason for the dispute.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reason(Nullable reason) { + if (reason.isNull()) { + this.reason = null; + } else if (reason.isEmpty()) { + this.reason = Optional.empty(); + } else { + this.reason = Optional.of(reason.get()); + } + return this; + } + + /** + *

A human-readable reason for the dispute.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reason(String reason) { + this.reason = Optional.ofNullable(reason); + return this; + } + + /** + *

A human-readable reason for the dispute.

+ */ + @java.lang.Override + @JsonSetter(value = "reason", nulls = Nulls.SKIP) + public _FinalStage reason(Optional reason) { + this.reason = reason; + return this; + } + + /** + *

The product associated with the disputed payment. Null if the dispute is not linked to a specific product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

The product associated with the disputed payment. Null if the dispute is not linked to a specific product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(DisputeListItemProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

The product associated with the disputed payment. Null if the dispute is not linked to a specific product.

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

The plan associated with the disputed payment. Null if the dispute is not linked to a specific plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + /** + *

The plan associated with the disputed payment. Null if the dispute is not linked to a specific plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(DisputeListItemPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + /** + *

The plan associated with the disputed payment. Null if the dispute is not linked to a specific plan.

+ */ + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + + /** + *

The original payment that was disputed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(Nullable payment) { + if (payment.isNull()) { + this.payment = null; + } else if (payment.isEmpty()) { + this.payment = Optional.empty(); + } else { + this.payment = Optional.of(payment.get()); + } + return this; + } + + /** + *

The original payment that was disputed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(DisputeListItemPayment payment) { + this.payment = Optional.ofNullable(payment); + return this; + } + + /** + *

The original payment that was disputed.

+ */ + @java.lang.Override + @JsonSetter(value = "payment", nulls = Nulls.SKIP) + public _FinalStage payment(Optional payment) { + this.payment = payment; + return this; + } + + /** + *

The deadline by which dispute evidence must be submitted. Null if no response deadline is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage needsResponseBy(Nullable needsResponseBy) { + if (needsResponseBy.isNull()) { + this.needsResponseBy = null; + } else if (needsResponseBy.isEmpty()) { + this.needsResponseBy = Optional.empty(); + } else { + this.needsResponseBy = Optional.of(needsResponseBy.get()); + } + return this; + } + + /** + *

The deadline by which dispute evidence must be submitted. Null if no response deadline is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage needsResponseBy(OffsetDateTime needsResponseBy) { + this.needsResponseBy = Optional.ofNullable(needsResponseBy); + return this; + } + + /** + *

The deadline by which dispute evidence must be submitted. Null if no response deadline is set.

+ */ + @java.lang.Override + @JsonSetter(value = "needs_response_by", nulls = Nulls.SKIP) + public _FinalStage needsResponseBy(Optional needsResponseBy) { + this.needsResponseBy = needsResponseBy; + return this; + } + + /** + *

Whether the dispute evidence can still be edited and submitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage editable(Nullable editable) { + if (editable.isNull()) { + this.editable = null; + } else if (editable.isEmpty()) { + this.editable = Optional.empty(); + } else { + this.editable = Optional.of(editable.get()); + } + return this; + } + + /** + *

Whether the dispute evidence can still be edited and submitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage editable(Boolean editable) { + this.editable = Optional.ofNullable(editable); + return this; + } + + /** + *

Whether the dispute evidence can still be edited and submitted.

+ */ + @java.lang.Override + @JsonSetter(value = "editable", nulls = Nulls.SKIP) + public _FinalStage editable(Optional editable) { + this.editable = editable; + return this; + } + + /** + *

The datetime the dispute was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(Nullable createdAt) { + if (createdAt.isNull()) { + this.createdAt = null; + } else if (createdAt.isEmpty()) { + this.createdAt = Optional.empty(); + } else { + this.createdAt = Optional.of(createdAt.get()); + } + return this; + } + + /** + *

The datetime the dispute was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

The datetime the dispute was created.

+ */ + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

The company that the dispute was filed against.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(Nullable company) { + if (company.isNull()) { + this.company = null; + } else if (company.isEmpty()) { + this.company = Optional.empty(); + } else { + this.company = Optional.of(company.get()); + } + return this; + } + + /** + *

The company that the dispute was filed against.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(DisputeListItemCompany company) { + this.company = Optional.ofNullable(company); + return this; + } + + /** + *

The company that the dispute was filed against.

+ */ + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + + @java.lang.Override + public DisputeListItem build() { + return new DisputeListItem( + amount, + company, + createdAt, + currency, + editable, + id, + needsResponseBy, + payment, + plan, + product, + reason, + reasonCode, + status, + visaRdr, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeListItemCompany.java b/src/main/java/com/whop/api/types/DisputeListItemCompany.java new file mode 100644 index 00000000..8e67eecf --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeListItemCompany.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeListItemCompany.Builder.class) +public final class DisputeListItemCompany { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private DisputeListItemCompany(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The written name of the company. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeListItemCompany && equalTo((DisputeListItemCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeListItemCompany other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + TitleStage id(@NotNull String id); + + Builder from(DisputeListItemCompany other); + } + + public interface TitleStage { + /** + *

The written name of the company.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + DisputeListItemCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeListItemCompany other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The written name of the company.

+ *

The written name of the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public DisputeListItemCompany build() { + return new DisputeListItemCompany(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeListItemPayment.java b/src/main/java/com/whop/api/types/DisputeListItemPayment.java new file mode 100644 index 00000000..a4f3ffef --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeListItemPayment.java @@ -0,0 +1,205 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeListItemPayment.Builder.class) +public final class DisputeListItemPayment { + private final String id; + + private final Optional paymentInstrument; + + private final Map additionalProperties; + + private DisputeListItemPayment( + String id, + Optional paymentInstrument, + Map additionalProperties) { + this.id = id; + this.paymentInstrument = paymentInstrument; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the payment. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method. + */ + @JsonIgnore + public Optional getPaymentInstrument() { + if (paymentInstrument == null) { + return Optional.empty(); + } + return paymentInstrument; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_instrument") + private Optional _getPaymentInstrument() { + return paymentInstrument; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeListItemPayment && equalTo((DisputeListItemPayment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeListItemPayment other) { + return id.equals(other.id) && paymentInstrument.equals(other.paymentInstrument); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.paymentInstrument); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the payment.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(DisputeListItemPayment other); + } + + public interface _FinalStage { + DisputeListItemPayment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ */ + _FinalStage paymentInstrument(Optional paymentInstrument); + + _FinalStage paymentInstrument(DisputeListItemPaymentPaymentInstrument paymentInstrument); + + _FinalStage paymentInstrument(Nullable paymentInstrument); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional paymentInstrument = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeListItemPayment other) { + id(other.getId()); + paymentInstrument(other.getPaymentInstrument()); + return this; + } + + /** + *

The unique identifier for the payment.

+ *

The unique identifier for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentInstrument(Nullable paymentInstrument) { + if (paymentInstrument.isNull()) { + this.paymentInstrument = null; + } else if (paymentInstrument.isEmpty()) { + this.paymentInstrument = Optional.empty(); + } else { + this.paymentInstrument = Optional.of(paymentInstrument.get()); + } + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentInstrument(DisputeListItemPaymentPaymentInstrument paymentInstrument) { + this.paymentInstrument = Optional.ofNullable(paymentInstrument); + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_instrument", nulls = Nulls.SKIP) + public _FinalStage paymentInstrument(Optional paymentInstrument) { + this.paymentInstrument = paymentInstrument; + return this; + } + + @java.lang.Override + public DisputeListItemPayment build() { + return new DisputeListItemPayment(id, paymentInstrument, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeListItemPaymentPaymentInstrument.java b/src/main/java/com/whop/api/types/DisputeListItemPaymentPaymentInstrument.java new file mode 100644 index 00000000..446a9b43 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeListItemPaymentPaymentInstrument.java @@ -0,0 +1,278 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeListItemPaymentPaymentInstrument.Builder.class) +public final class DisputeListItemPaymentPaymentInstrument { + private final String displayName; + + private final DisputeListItemPaymentPaymentInstrumentIcons icons; + + private final Optional installmentCount; + + private final String paymentMethodType; + + private final Map additionalProperties; + + private DisputeListItemPaymentPaymentInstrument( + String displayName, + DisputeListItemPaymentPaymentInstrumentIcons icons, + Optional installmentCount, + String paymentMethodType, + Map additionalProperties) { + this.displayName = displayName; + this.icons = icons; + this.installmentCount = installmentCount; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna"). + */ + @JsonProperty("display_name") + public String getDisplayName() { + return displayName; + } + + /** + * @return The standard icon set: square and card shapes, each in light and dark colorways. + */ + @JsonProperty("icons") + public DisputeListItemPaymentPaymentInstrumentIcons getIcons() { + return icons; + } + + /** + * @return Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side. + */ + @JsonIgnore + public Optional getInstallmentCount() { + if (installmentCount == null) { + return Optional.empty(); + } + return installmentCount; + } + + /** + * @return The payment method type identifier, e.g. card, klarna, apple_pay. + */ + @JsonProperty("payment_method_type") + public String getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("installment_count") + private Optional _getInstallmentCount() { + return installmentCount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeListItemPaymentPaymentInstrument + && equalTo((DisputeListItemPaymentPaymentInstrument) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeListItemPaymentPaymentInstrument other) { + return displayName.equals(other.displayName) + && icons.equals(other.icons) + && installmentCount.equals(other.installmentCount) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.displayName, this.icons, this.installmentCount, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DisplayNameStage builder() { + return new Builder(); + } + + public interface DisplayNameStage { + /** + *

Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna").

+ */ + IconsStage displayName(@NotNull String displayName); + + Builder from(DisputeListItemPaymentPaymentInstrument other); + } + + public interface IconsStage { + /** + *

The standard icon set: square and card shapes, each in light and dark colorways.

+ */ + PaymentMethodTypeStage icons(@NotNull DisputeListItemPaymentPaymentInstrumentIcons icons); + } + + public interface PaymentMethodTypeStage { + /** + *

The payment method type identifier, e.g. card, klarna, apple_pay.

+ */ + _FinalStage paymentMethodType(@NotNull String paymentMethodType); + } + + public interface _FinalStage { + DisputeListItemPaymentPaymentInstrument build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ */ + _FinalStage installmentCount(Optional installmentCount); + + _FinalStage installmentCount(Integer installmentCount); + + _FinalStage installmentCount(Nullable installmentCount); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DisplayNameStage, IconsStage, PaymentMethodTypeStage, _FinalStage { + private String displayName; + + private DisputeListItemPaymentPaymentInstrumentIcons icons; + + private String paymentMethodType; + + private Optional installmentCount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeListItemPaymentPaymentInstrument other) { + displayName(other.getDisplayName()); + icons(other.getIcons()); + installmentCount(other.getInstallmentCount()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna").

+ *

Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("display_name") + public IconsStage displayName(@NotNull String displayName) { + this.displayName = Objects.requireNonNull(displayName, "displayName must not be null"); + return this; + } + + /** + *

The standard icon set: square and card shapes, each in light and dark colorways.

+ *

The standard icon set: square and card shapes, each in light and dark colorways.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public PaymentMethodTypeStage icons(@NotNull DisputeListItemPaymentPaymentInstrumentIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

The payment method type identifier, e.g. card, klarna, apple_pay.

+ *

The payment method type identifier, e.g. card, klarna, apple_pay.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull String paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage installmentCount(Nullable installmentCount) { + if (installmentCount.isNull()) { + this.installmentCount = null; + } else if (installmentCount.isEmpty()) { + this.installmentCount = Optional.empty(); + } else { + this.installmentCount = Optional.of(installmentCount.get()); + } + return this; + } + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage installmentCount(Integer installmentCount) { + this.installmentCount = Optional.ofNullable(installmentCount); + return this; + } + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ */ + @java.lang.Override + @JsonSetter(value = "installment_count", nulls = Nulls.SKIP) + public _FinalStage installmentCount(Optional installmentCount) { + this.installmentCount = installmentCount; + return this; + } + + @java.lang.Override + public DisputeListItemPaymentPaymentInstrument build() { + return new DisputeListItemPaymentPaymentInstrument( + displayName, icons, installmentCount, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeListItemPaymentPaymentInstrumentIcons.java b/src/main/java/com/whop/api/types/DisputeListItemPaymentPaymentInstrumentIcons.java new file mode 100644 index 00000000..05919e46 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeListItemPaymentPaymentInstrumentIcons.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeListItemPaymentPaymentInstrumentIcons.Builder.class) +public final class DisputeListItemPaymentPaymentInstrumentIcons { + private final DisputeListItemPaymentPaymentInstrumentIconsSquare square; + + private final Map additionalProperties; + + private DisputeListItemPaymentPaymentInstrumentIcons( + DisputeListItemPaymentPaymentInstrumentIconsSquare square, Map additionalProperties) { + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public DisputeListItemPaymentPaymentInstrumentIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeListItemPaymentPaymentInstrumentIcons + && equalTo((DisputeListItemPaymentPaymentInstrumentIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeListItemPaymentPaymentInstrumentIcons other) { + return square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SquareStage builder() { + return new Builder(); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull DisputeListItemPaymentPaymentInstrumentIconsSquare square); + + Builder from(DisputeListItemPaymentPaymentInstrumentIcons other); + } + + public interface _FinalStage { + DisputeListItemPaymentPaymentInstrumentIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SquareStage, _FinalStage { + private DisputeListItemPaymentPaymentInstrumentIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeListItemPaymentPaymentInstrumentIcons other) { + square(other.getSquare()); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull DisputeListItemPaymentPaymentInstrumentIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public DisputeListItemPaymentPaymentInstrumentIcons build() { + return new DisputeListItemPaymentPaymentInstrumentIcons(square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeListItemPaymentPaymentInstrumentIconsSquare.java b/src/main/java/com/whop/api/types/DisputeListItemPaymentPaymentInstrumentIconsSquare.java new file mode 100644 index 00000000..af7e52c1 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeListItemPaymentPaymentInstrumentIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeListItemPaymentPaymentInstrumentIconsSquare.Builder.class) +public final class DisputeListItemPaymentPaymentInstrumentIconsSquare { + private final DisputeListItemPaymentPaymentInstrumentIconsSquareDark dark; + + private final DisputeListItemPaymentPaymentInstrumentIconsSquareLight light; + + private final Map additionalProperties; + + private DisputeListItemPaymentPaymentInstrumentIconsSquare( + DisputeListItemPaymentPaymentInstrumentIconsSquareDark dark, + DisputeListItemPaymentPaymentInstrumentIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public DisputeListItemPaymentPaymentInstrumentIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public DisputeListItemPaymentPaymentInstrumentIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeListItemPaymentPaymentInstrumentIconsSquare + && equalTo((DisputeListItemPaymentPaymentInstrumentIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeListItemPaymentPaymentInstrumentIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull DisputeListItemPaymentPaymentInstrumentIconsSquareDark dark); + + Builder from(DisputeListItemPaymentPaymentInstrumentIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull DisputeListItemPaymentPaymentInstrumentIconsSquareLight light); + } + + public interface _FinalStage { + DisputeListItemPaymentPaymentInstrumentIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private DisputeListItemPaymentPaymentInstrumentIconsSquareDark dark; + + private DisputeListItemPaymentPaymentInstrumentIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeListItemPaymentPaymentInstrumentIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull DisputeListItemPaymentPaymentInstrumentIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull DisputeListItemPaymentPaymentInstrumentIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public DisputeListItemPaymentPaymentInstrumentIconsSquare build() { + return new DisputeListItemPaymentPaymentInstrumentIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeListItemPaymentPaymentInstrumentIconsSquareDark.java b/src/main/java/com/whop/api/types/DisputeListItemPaymentPaymentInstrumentIconsSquareDark.java new file mode 100644 index 00000000..e8ac1ff4 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeListItemPaymentPaymentInstrumentIconsSquareDark.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeListItemPaymentPaymentInstrumentIconsSquareDark.Builder.class) +public final class DisputeListItemPaymentPaymentInstrumentIconsSquareDark { + private final String svg; + + private final Map additionalProperties; + + private DisputeListItemPaymentPaymentInstrumentIconsSquareDark( + String svg, Map additionalProperties) { + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeListItemPaymentPaymentInstrumentIconsSquareDark + && equalTo((DisputeListItemPaymentPaymentInstrumentIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeListItemPaymentPaymentInstrumentIconsSquareDark other) { + return svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SvgStage builder() { + return new Builder(); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + + Builder from(DisputeListItemPaymentPaymentInstrumentIconsSquareDark other); + } + + public interface _FinalStage { + DisputeListItemPaymentPaymentInstrumentIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SvgStage, _FinalStage { + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeListItemPaymentPaymentInstrumentIconsSquareDark other) { + svg(other.getSvg()); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public DisputeListItemPaymentPaymentInstrumentIconsSquareDark build() { + return new DisputeListItemPaymentPaymentInstrumentIconsSquareDark(svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeListItemPaymentPaymentInstrumentIconsSquareLight.java b/src/main/java/com/whop/api/types/DisputeListItemPaymentPaymentInstrumentIconsSquareLight.java new file mode 100644 index 00000000..7377cd89 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeListItemPaymentPaymentInstrumentIconsSquareLight.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeListItemPaymentPaymentInstrumentIconsSquareLight.Builder.class) +public final class DisputeListItemPaymentPaymentInstrumentIconsSquareLight { + private final String svg; + + private final Map additionalProperties; + + private DisputeListItemPaymentPaymentInstrumentIconsSquareLight( + String svg, Map additionalProperties) { + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeListItemPaymentPaymentInstrumentIconsSquareLight + && equalTo((DisputeListItemPaymentPaymentInstrumentIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeListItemPaymentPaymentInstrumentIconsSquareLight other) { + return svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SvgStage builder() { + return new Builder(); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + + Builder from(DisputeListItemPaymentPaymentInstrumentIconsSquareLight other); + } + + public interface _FinalStage { + DisputeListItemPaymentPaymentInstrumentIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SvgStage, _FinalStage { + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeListItemPaymentPaymentInstrumentIconsSquareLight other) { + svg(other.getSvg()); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public DisputeListItemPaymentPaymentInstrumentIconsSquareLight build() { + return new DisputeListItemPaymentPaymentInstrumentIconsSquareLight(svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeListItemPlan.java b/src/main/java/com/whop/api/types/DisputeListItemPlan.java new file mode 100644 index 00000000..39655961 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeListItemPlan.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeListItemPlan.Builder.class) +public final class DisputeListItemPlan { + private final String id; + + private final Map additionalProperties; + + private DisputeListItemPlan(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the plan. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeListItemPlan && equalTo((DisputeListItemPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeListItemPlan other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the plan.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(DisputeListItemPlan other); + } + + public interface _FinalStage { + DisputeListItemPlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeListItemPlan other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the plan.

+ *

The unique identifier for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public DisputeListItemPlan build() { + return new DisputeListItemPlan(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeListItemProduct.java b/src/main/java/com/whop/api/types/DisputeListItemProduct.java new file mode 100644 index 00000000..e78760f3 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeListItemProduct.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputeListItemProduct.Builder.class) +public final class DisputeListItemProduct { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private DisputeListItemProduct(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the product. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the product shown to customers on the product page and in search results. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputeListItemProduct && equalTo((DisputeListItemProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputeListItemProduct other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the product.

+ */ + TitleStage id(@NotNull String id); + + Builder from(DisputeListItemProduct other); + } + + public interface TitleStage { + /** + *

The display name of the product shown to customers on the product page and in search results.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + DisputeListItemProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputeListItemProduct other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the product.

+ *

The unique identifier for the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the product shown to customers on the product page and in search results.

+ *

The display name of the product shown to customers on the product page and in search results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public DisputeListItemProduct build() { + return new DisputeListItemProduct(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputePayment.java b/src/main/java/com/whop/api/types/DisputePayment.java new file mode 100644 index 00000000..196e5330 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputePayment.java @@ -0,0 +1,680 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisputePayment.Builder.class) +public final class DisputePayment { + private final Optional amount; + + private final Optional cardBrand; + + private final Optional cardLast4; + + private final String createdAt; + + private final Optional currency; + + private final String id; + + private final Optional paymentInstrument; + + private final Optional paymentMethodType; + + private final Optional paymentProcessor; + + private final Map additionalProperties; + + private DisputePayment( + Optional amount, + Optional cardBrand, + Optional cardLast4, + String createdAt, + Optional currency, + String id, + Optional paymentInstrument, + Optional paymentMethodType, + Optional paymentProcessor, + Map additionalProperties) { + this.amount = amount; + this.cardBrand = cardBrand; + this.cardLast4 = cardLast4; + this.createdAt = createdAt; + this.currency = currency; + this.id = id; + this.paymentInstrument = paymentInstrument; + this.paymentMethodType = paymentMethodType; + this.paymentProcessor = paymentProcessor; + this.additionalProperties = additionalProperties; + } + + /** + * @return What the customer was charged, in whole units of the payment's currency. + */ + @JsonIgnore + public Optional getAmount() { + if (amount == null) { + return Optional.empty(); + } + return amount; + } + + /** + * @return Card brand, when the customer paid by card. + */ + @JsonIgnore + public Optional getCardBrand() { + if (cardBrand == null) { + return Optional.empty(); + } + return cardBrand; + } + + /** + * @return Last four digits of the card, when the customer paid by card. + */ + @JsonIgnore + public Optional getCardLast4() { + if (cardLast4 == null) { + return Optional.empty(); + } + return cardLast4; + } + + /** + * @return When the payment was made, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Three-letter ISO currency code of the payment. Can differ from the dispute's currency when the processor settles in another currency. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return Payment ID, prefixed pay_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the payment names no method. + */ + @JsonIgnore + public Optional getPaymentInstrument() { + if (paymentInstrument == null) { + return Optional.empty(); + } + return paymentInstrument; + } + + /** + * @return How the customer paid, such as card or paypal. + */ + @JsonIgnore + public Optional getPaymentMethodType() { + if (paymentMethodType == null) { + return Optional.empty(); + } + return paymentMethodType; + } + + /** + * @return The processor that handled the payment, such as stripe. + */ + @JsonIgnore + public Optional getPaymentProcessor() { + if (paymentProcessor == null) { + return Optional.empty(); + } + return paymentProcessor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("amount") + private Optional _getAmount() { + return amount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_brand") + private Optional _getCardBrand() { + return cardBrand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_last4") + private Optional _getCardLast4() { + return cardLast4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_instrument") + private Optional _getPaymentInstrument() { + return paymentInstrument; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_type") + private Optional _getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_processor") + private Optional _getPaymentProcessor() { + return paymentProcessor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisputePayment && equalTo((DisputePayment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisputePayment other) { + return amount.equals(other.amount) + && cardBrand.equals(other.cardBrand) + && cardLast4.equals(other.cardLast4) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && id.equals(other.id) + && paymentInstrument.equals(other.paymentInstrument) + && paymentMethodType.equals(other.paymentMethodType) + && paymentProcessor.equals(other.paymentProcessor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.cardBrand, + this.cardLast4, + this.createdAt, + this.currency, + this.id, + this.paymentInstrument, + this.paymentMethodType, + this.paymentProcessor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the payment was made, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + + Builder from(DisputePayment other); + } + + public interface IdStage { + /** + *

Payment ID, prefixed pay_.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DisputePayment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

What the customer was charged, in whole units of the payment's currency.

+ */ + _FinalStage amount(Optional amount); + + _FinalStage amount(Double amount); + + _FinalStage amount(Nullable amount); + + /** + *

Card brand, when the customer paid by card.

+ */ + _FinalStage cardBrand(Optional cardBrand); + + _FinalStage cardBrand(String cardBrand); + + _FinalStage cardBrand(Nullable cardBrand); + + /** + *

Last four digits of the card, when the customer paid by card.

+ */ + _FinalStage cardLast4(Optional cardLast4); + + _FinalStage cardLast4(String cardLast4); + + _FinalStage cardLast4(Nullable cardLast4); + + /** + *

Three-letter ISO currency code of the payment. Can differ from the dispute's currency when the processor settles in another currency.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + _FinalStage currency(Nullable currency); + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the payment names no method.

+ */ + _FinalStage paymentInstrument(Optional paymentInstrument); + + _FinalStage paymentInstrument(PaymentInstrument paymentInstrument); + + _FinalStage paymentInstrument(Nullable paymentInstrument); + + /** + *

How the customer paid, such as card or paypal.

+ */ + _FinalStage paymentMethodType(Optional paymentMethodType); + + _FinalStage paymentMethodType(String paymentMethodType); + + _FinalStage paymentMethodType(Nullable paymentMethodType); + + /** + *

The processor that handled the payment, such as stripe.

+ */ + _FinalStage paymentProcessor(Optional paymentProcessor); + + _FinalStage paymentProcessor(String paymentProcessor); + + _FinalStage paymentProcessor(Nullable paymentProcessor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, _FinalStage { + private String createdAt; + + private String id; + + private Optional paymentProcessor = Optional.empty(); + + private Optional paymentMethodType = Optional.empty(); + + private Optional paymentInstrument = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional cardLast4 = Optional.empty(); + + private Optional cardBrand = Optional.empty(); + + private Optional amount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisputePayment other) { + amount(other.getAmount()); + cardBrand(other.getCardBrand()); + cardLast4(other.getCardLast4()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + id(other.getId()); + paymentInstrument(other.getPaymentInstrument()); + paymentMethodType(other.getPaymentMethodType()); + paymentProcessor(other.getPaymentProcessor()); + return this; + } + + /** + *

When the payment was made, as an ISO 8601 timestamp.

+ *

When the payment was made, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Payment ID, prefixed pay_.

+ *

Payment ID, prefixed pay_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The processor that handled the payment, such as stripe.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentProcessor(Nullable paymentProcessor) { + if (paymentProcessor.isNull()) { + this.paymentProcessor = null; + } else if (paymentProcessor.isEmpty()) { + this.paymentProcessor = Optional.empty(); + } else { + this.paymentProcessor = Optional.of(paymentProcessor.get()); + } + return this; + } + + /** + *

The processor that handled the payment, such as stripe.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentProcessor(String paymentProcessor) { + this.paymentProcessor = Optional.ofNullable(paymentProcessor); + return this; + } + + /** + *

The processor that handled the payment, such as stripe.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_processor", nulls = Nulls.SKIP) + public _FinalStage paymentProcessor(Optional paymentProcessor) { + this.paymentProcessor = paymentProcessor; + return this; + } + + /** + *

How the customer paid, such as card or paypal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(Nullable paymentMethodType) { + if (paymentMethodType.isNull()) { + this.paymentMethodType = null; + } else if (paymentMethodType.isEmpty()) { + this.paymentMethodType = Optional.empty(); + } else { + this.paymentMethodType = Optional.of(paymentMethodType.get()); + } + return this; + } + + /** + *

How the customer paid, such as card or paypal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(String paymentMethodType) { + this.paymentMethodType = Optional.ofNullable(paymentMethodType); + return this; + } + + /** + *

How the customer paid, such as card or paypal.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_type", nulls = Nulls.SKIP) + public _FinalStage paymentMethodType(Optional paymentMethodType) { + this.paymentMethodType = paymentMethodType; + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the payment names no method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentInstrument(Nullable paymentInstrument) { + if (paymentInstrument.isNull()) { + this.paymentInstrument = null; + } else if (paymentInstrument.isEmpty()) { + this.paymentInstrument = Optional.empty(); + } else { + this.paymentInstrument = Optional.of(paymentInstrument.get()); + } + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the payment names no method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentInstrument(PaymentInstrument paymentInstrument) { + this.paymentInstrument = Optional.ofNullable(paymentInstrument); + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the payment names no method.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_instrument", nulls = Nulls.SKIP) + public _FinalStage paymentInstrument(Optional paymentInstrument) { + this.paymentInstrument = paymentInstrument; + return this; + } + + /** + *

Three-letter ISO currency code of the payment. Can differ from the dispute's currency when the processor settles in another currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

Three-letter ISO currency code of the payment. Can differ from the dispute's currency when the processor settles in another currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

Three-letter ISO currency code of the payment. Can differ from the dispute's currency when the processor settles in another currency.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + /** + *

Last four digits of the card, when the customer paid by card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardLast4(Nullable cardLast4) { + if (cardLast4.isNull()) { + this.cardLast4 = null; + } else if (cardLast4.isEmpty()) { + this.cardLast4 = Optional.empty(); + } else { + this.cardLast4 = Optional.of(cardLast4.get()); + } + return this; + } + + /** + *

Last four digits of the card, when the customer paid by card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardLast4(String cardLast4) { + this.cardLast4 = Optional.ofNullable(cardLast4); + return this; + } + + /** + *

Last four digits of the card, when the customer paid by card.

+ */ + @java.lang.Override + @JsonSetter(value = "card_last4", nulls = Nulls.SKIP) + public _FinalStage cardLast4(Optional cardLast4) { + this.cardLast4 = cardLast4; + return this; + } + + /** + *

Card brand, when the customer paid by card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(Nullable cardBrand) { + if (cardBrand.isNull()) { + this.cardBrand = null; + } else if (cardBrand.isEmpty()) { + this.cardBrand = Optional.empty(); + } else { + this.cardBrand = Optional.of(cardBrand.get()); + } + return this; + } + + /** + *

Card brand, when the customer paid by card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(String cardBrand) { + this.cardBrand = Optional.ofNullable(cardBrand); + return this; + } + + /** + *

Card brand, when the customer paid by card.

+ */ + @java.lang.Override + @JsonSetter(value = "card_brand", nulls = Nulls.SKIP) + public _FinalStage cardBrand(Optional cardBrand) { + this.cardBrand = cardBrand; + return this; + } + + /** + *

What the customer was charged, in whole units of the payment's currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amount(Nullable amount) { + if (amount.isNull()) { + this.amount = null; + } else if (amount.isEmpty()) { + this.amount = Optional.empty(); + } else { + this.amount = Optional.of(amount.get()); + } + return this; + } + + /** + *

What the customer was charged, in whole units of the payment's currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amount(Double amount) { + this.amount = Optional.ofNullable(amount); + return this; + } + + /** + *

What the customer was charged, in whole units of the payment's currency.

+ */ + @java.lang.Override + @JsonSetter(value = "amount", nulls = Nulls.SKIP) + public _FinalStage amount(Optional amount) { + this.amount = amount; + return this; + } + + @java.lang.Override + public DisputePayment build() { + return new DisputePayment( + amount, + cardBrand, + cardLast4, + createdAt, + currency, + id, + paymentInstrument, + paymentMethodType, + paymentProcessor, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DisputeReason.java b/src/main/java/com/whop/api/types/DisputeReason.java new file mode 100644 index 00000000..52711861 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeReason.java @@ -0,0 +1,190 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DisputeReason { + public static final DisputeReason PROCESSING_ERROR = new DisputeReason(Value.PROCESSING_ERROR, "processing_error"); + + public static final DisputeReason OTHER = new DisputeReason(Value.OTHER, "other"); + + public static final DisputeReason FRAUDULENT = new DisputeReason(Value.FRAUDULENT, "fraudulent"); + + public static final DisputeReason PRODUCT_UNACCEPTABLE = + new DisputeReason(Value.PRODUCT_UNACCEPTABLE, "product_unacceptable"); + + public static final DisputeReason UNRECOGNIZED = new DisputeReason(Value.UNRECOGNIZED, "unrecognized"); + + public static final DisputeReason DECLINED_AUTHORIZATION = + new DisputeReason(Value.DECLINED_AUTHORIZATION, "declined_authorization"); + + public static final DisputeReason CREDIT_NOT_PROCESSED = + new DisputeReason(Value.CREDIT_NOT_PROCESSED, "credit_not_processed"); + + public static final DisputeReason BANK_CANNOT_PROCESS = + new DisputeReason(Value.BANK_CANNOT_PROCESS, "bank_cannot_process"); + + public static final DisputeReason PRODUCT_NOT_RECEIVED = + new DisputeReason(Value.PRODUCT_NOT_RECEIVED, "product_not_received"); + + public static final DisputeReason DUPLICATE = new DisputeReason(Value.DUPLICATE, "duplicate"); + + public static final DisputeReason DOCUMENTATION_REQUEST = + new DisputeReason(Value.DOCUMENTATION_REQUEST, "documentation_request"); + + public static final DisputeReason SUBSCRIPTION_CANCELED = + new DisputeReason(Value.SUBSCRIPTION_CANCELED, "subscription_canceled"); + + private final Value value; + + private final String string; + + DisputeReason(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof DisputeReason && this.string.equals(((DisputeReason) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PROCESSING_ERROR: + return visitor.visitProcessingError(); + case OTHER: + return visitor.visitOther(); + case FRAUDULENT: + return visitor.visitFraudulent(); + case PRODUCT_UNACCEPTABLE: + return visitor.visitProductUnacceptable(); + case UNRECOGNIZED: + return visitor.visitUnrecognized(); + case DECLINED_AUTHORIZATION: + return visitor.visitDeclinedAuthorization(); + case CREDIT_NOT_PROCESSED: + return visitor.visitCreditNotProcessed(); + case BANK_CANNOT_PROCESS: + return visitor.visitBankCannotProcess(); + case PRODUCT_NOT_RECEIVED: + return visitor.visitProductNotReceived(); + case DUPLICATE: + return visitor.visitDuplicate(); + case DOCUMENTATION_REQUEST: + return visitor.visitDocumentationRequest(); + case SUBSCRIPTION_CANCELED: + return visitor.visitSubscriptionCanceled(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DisputeReason valueOf(String value) { + switch (value) { + case "processing_error": + return PROCESSING_ERROR; + case "other": + return OTHER; + case "fraudulent": + return FRAUDULENT; + case "product_unacceptable": + return PRODUCT_UNACCEPTABLE; + case "unrecognized": + return UNRECOGNIZED; + case "declined_authorization": + return DECLINED_AUTHORIZATION; + case "credit_not_processed": + return CREDIT_NOT_PROCESSED; + case "bank_cannot_process": + return BANK_CANNOT_PROCESS; + case "product_not_received": + return PRODUCT_NOT_RECEIVED; + case "duplicate": + return DUPLICATE; + case "documentation_request": + return DOCUMENTATION_REQUEST; + case "subscription_canceled": + return SUBSCRIPTION_CANCELED; + default: + return new DisputeReason(Value.UNKNOWN, value); + } + } + + public enum Value { + FRAUDULENT, + + UNRECOGNIZED, + + DECLINED_AUTHORIZATION, + + PRODUCT_NOT_RECEIVED, + + PRODUCT_UNACCEPTABLE, + + SUBSCRIPTION_CANCELED, + + CREDIT_NOT_PROCESSED, + + DUPLICATE, + + PROCESSING_ERROR, + + DOCUMENTATION_REQUEST, + + BANK_CANNOT_PROCESS, + + OTHER, + + UNKNOWN + } + + public interface Visitor { + T visitFraudulent(); + + T visitUnrecognized(); + + T visitDeclinedAuthorization(); + + T visitProductNotReceived(); + + T visitProductUnacceptable(); + + T visitSubscriptionCanceled(); + + T visitCreditNotProcessed(); + + T visitDuplicate(); + + T visitProcessingError(); + + T visitDocumentationRequest(); + + T visitBankCannotProcess(); + + T visitOther(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/DisputeStatus.java b/src/main/java/com/whop/api/types/DisputeStatus.java new file mode 100644 index 00000000..7b5fcc16 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeStatus.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DisputeStatus { + public static final DisputeStatus NEEDS_RESPONSE = new DisputeStatus(Value.NEEDS_RESPONSE, "needs_response"); + + public static final DisputeStatus WON = new DisputeStatus(Value.WON, "won"); + + public static final DisputeStatus CLOSED = new DisputeStatus(Value.CLOSED, "closed"); + + public static final DisputeStatus UNDER_REVIEW = new DisputeStatus(Value.UNDER_REVIEW, "under_review"); + + public static final DisputeStatus LOST = new DisputeStatus(Value.LOST, "lost"); + + private final Value value; + + private final String string; + + DisputeStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof DisputeStatus && this.string.equals(((DisputeStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NEEDS_RESPONSE: + return visitor.visitNeedsResponse(); + case WON: + return visitor.visitWon(); + case CLOSED: + return visitor.visitClosed(); + case UNDER_REVIEW: + return visitor.visitUnderReview(); + case LOST: + return visitor.visitLost(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DisputeStatus valueOf(String value) { + switch (value) { + case "needs_response": + return NEEDS_RESPONSE; + case "won": + return WON; + case "closed": + return CLOSED; + case "under_review": + return UNDER_REVIEW; + case "lost": + return LOST; + default: + return new DisputeStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + NEEDS_RESPONSE, + + UNDER_REVIEW, + + WON, + + LOST, + + CLOSED, + + UNKNOWN + } + + public interface Visitor { + T visitNeedsResponse(); + + T visitUnderReview(); + + T visitWon(); + + T visitLost(); + + T visitClosed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/DisputeStatuses.java b/src/main/java/com/whop/api/types/DisputeStatuses.java new file mode 100644 index 00000000..71418291 --- /dev/null +++ b/src/main/java/com/whop/api/types/DisputeStatuses.java @@ -0,0 +1,155 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DisputeStatuses { + public static final DisputeStatuses WARNING_UNDER_REVIEW = + new DisputeStatuses(Value.WARNING_UNDER_REVIEW, "warning_under_review"); + + public static final DisputeStatuses WARNING_NEEDS_RESPONSE = + new DisputeStatuses(Value.WARNING_NEEDS_RESPONSE, "warning_needs_response"); + + public static final DisputeStatuses NEEDS_RESPONSE = new DisputeStatuses(Value.NEEDS_RESPONSE, "needs_response"); + + public static final DisputeStatuses WON = new DisputeStatuses(Value.WON, "won"); + + public static final DisputeStatuses OTHER = new DisputeStatuses(Value.OTHER, "other"); + + public static final DisputeStatuses CLOSED = new DisputeStatuses(Value.CLOSED, "closed"); + + public static final DisputeStatuses WARNING_CLOSED = new DisputeStatuses(Value.WARNING_CLOSED, "warning_closed"); + + public static final DisputeStatuses UNDER_REVIEW = new DisputeStatuses(Value.UNDER_REVIEW, "under_review"); + + public static final DisputeStatuses LOST = new DisputeStatuses(Value.LOST, "lost"); + + private final Value value; + + private final String string; + + DisputeStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof DisputeStatuses && this.string.equals(((DisputeStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WARNING_UNDER_REVIEW: + return visitor.visitWarningUnderReview(); + case WARNING_NEEDS_RESPONSE: + return visitor.visitWarningNeedsResponse(); + case NEEDS_RESPONSE: + return visitor.visitNeedsResponse(); + case WON: + return visitor.visitWon(); + case OTHER: + return visitor.visitOther(); + case CLOSED: + return visitor.visitClosed(); + case WARNING_CLOSED: + return visitor.visitWarningClosed(); + case UNDER_REVIEW: + return visitor.visitUnderReview(); + case LOST: + return visitor.visitLost(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DisputeStatuses valueOf(String value) { + switch (value) { + case "warning_under_review": + return WARNING_UNDER_REVIEW; + case "warning_needs_response": + return WARNING_NEEDS_RESPONSE; + case "needs_response": + return NEEDS_RESPONSE; + case "won": + return WON; + case "other": + return OTHER; + case "closed": + return CLOSED; + case "warning_closed": + return WARNING_CLOSED; + case "under_review": + return UNDER_REVIEW; + case "lost": + return LOST; + default: + return new DisputeStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + WARNING_NEEDS_RESPONSE, + + WARNING_UNDER_REVIEW, + + WARNING_CLOSED, + + NEEDS_RESPONSE, + + UNDER_REVIEW, + + WON, + + LOST, + + CLOSED, + + OTHER, + + UNKNOWN + } + + public interface Visitor { + T visitWarningNeedsResponse(); + + T visitWarningUnderReview(); + + T visitWarningClosed(); + + T visitNeedsResponse(); + + T visitUnderReview(); + + T visitWon(); + + T visitLost(); + + T visitClosed(); + + T visitOther(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/DmChannel.java b/src/main/java/com/whop/api/types/DmChannel.java new file mode 100644 index 00000000..9b562184 --- /dev/null +++ b/src/main/java/com/whop/api/types/DmChannel.java @@ -0,0 +1,312 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DmChannel.Builder.class) +public final class DmChannel { + private final String createdAt; + + private final String id; + + private final Optional lastMessageAt; + + private final Optional name; + + private final Map additionalProperties; + + private DmChannel( + String createdAt, + String id, + Optional lastMessageAt, + Optional name, + Map additionalProperties) { + this.createdAt = createdAt; + this.id = id; + this.lastMessageAt = lastMessageAt; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The time the entity was created (in milliseconds since Unix epoch) + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the entity + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The timestamp when the most recent message was sent in this channel. Null if no messages have been sent. + */ + @JsonIgnore + public Optional getLastMessageAt() { + if (lastMessageAt == null) { + return Optional.empty(); + } + return lastMessageAt; + } + + /** + * @return A custom display name assigned to this channel by the user. Null if no custom name has been set. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_message_at") + private Optional _getLastMessageAt() { + return lastMessageAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DmChannel && equalTo((DmChannel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DmChannel other) { + return createdAt.equals(other.createdAt) + && id.equals(other.id) + && lastMessageAt.equals(other.lastMessageAt) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.id, this.lastMessageAt, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The time the entity was created (in milliseconds since Unix epoch)

+ */ + IdStage createdAt(@NotNull String createdAt); + + Builder from(DmChannel other); + } + + public interface IdStage { + /** + *

The unique identifier for the entity

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DmChannel build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ */ + _FinalStage lastMessageAt(Optional lastMessageAt); + + _FinalStage lastMessageAt(OffsetDateTime lastMessageAt); + + _FinalStage lastMessageAt(Nullable lastMessageAt); + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, _FinalStage { + private String createdAt; + + private String id; + + private Optional name = Optional.empty(); + + private Optional lastMessageAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DmChannel other) { + createdAt(other.getCreatedAt()); + id(other.getId()); + lastMessageAt(other.getLastMessageAt()); + name(other.getName()); + return this; + } + + /** + *

The time the entity was created (in milliseconds since Unix epoch)

+ *

The time the entity was created (in milliseconds since Unix epoch)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the entity

+ *

The unique identifier for the entity

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastMessageAt(Nullable lastMessageAt) { + if (lastMessageAt.isNull()) { + this.lastMessageAt = null; + } else if (lastMessageAt.isEmpty()) { + this.lastMessageAt = Optional.empty(); + } else { + this.lastMessageAt = Optional.of(lastMessageAt.get()); + } + return this; + } + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastMessageAt(OffsetDateTime lastMessageAt) { + this.lastMessageAt = Optional.ofNullable(lastMessageAt); + return this; + } + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ */ + @java.lang.Override + @JsonSetter(value = "last_message_at", nulls = Nulls.SKIP) + public _FinalStage lastMessageAt(Optional lastMessageAt) { + this.lastMessageAt = lastMessageAt; + return this; + } + + @java.lang.Override + public DmChannel build() { + return new DmChannel(createdAt, id, lastMessageAt, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DmChannelListItem.java b/src/main/java/com/whop/api/types/DmChannelListItem.java new file mode 100644 index 00000000..0ecfe36c --- /dev/null +++ b/src/main/java/com/whop/api/types/DmChannelListItem.java @@ -0,0 +1,312 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DmChannelListItem.Builder.class) +public final class DmChannelListItem { + private final String createdAt; + + private final String id; + + private final Optional lastMessageAt; + + private final Optional name; + + private final Map additionalProperties; + + private DmChannelListItem( + String createdAt, + String id, + Optional lastMessageAt, + Optional name, + Map additionalProperties) { + this.createdAt = createdAt; + this.id = id; + this.lastMessageAt = lastMessageAt; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The time the entity was created (in milliseconds since Unix epoch) + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the entity + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The timestamp when the most recent message was sent in this channel. Null if no messages have been sent. + */ + @JsonIgnore + public Optional getLastMessageAt() { + if (lastMessageAt == null) { + return Optional.empty(); + } + return lastMessageAt; + } + + /** + * @return A custom display name assigned to this channel by the user. Null if no custom name has been set. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_message_at") + private Optional _getLastMessageAt() { + return lastMessageAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DmChannelListItem && equalTo((DmChannelListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DmChannelListItem other) { + return createdAt.equals(other.createdAt) + && id.equals(other.id) + && lastMessageAt.equals(other.lastMessageAt) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.id, this.lastMessageAt, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The time the entity was created (in milliseconds since Unix epoch)

+ */ + IdStage createdAt(@NotNull String createdAt); + + Builder from(DmChannelListItem other); + } + + public interface IdStage { + /** + *

The unique identifier for the entity

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + DmChannelListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ */ + _FinalStage lastMessageAt(Optional lastMessageAt); + + _FinalStage lastMessageAt(OffsetDateTime lastMessageAt); + + _FinalStage lastMessageAt(Nullable lastMessageAt); + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, _FinalStage { + private String createdAt; + + private String id; + + private Optional name = Optional.empty(); + + private Optional lastMessageAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DmChannelListItem other) { + createdAt(other.getCreatedAt()); + id(other.getId()); + lastMessageAt(other.getLastMessageAt()); + name(other.getName()); + return this; + } + + /** + *

The time the entity was created (in milliseconds since Unix epoch)

+ *

The time the entity was created (in milliseconds since Unix epoch)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the entity

+ *

The unique identifier for the entity

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastMessageAt(Nullable lastMessageAt) { + if (lastMessageAt.isNull()) { + this.lastMessageAt = null; + } else if (lastMessageAt.isEmpty()) { + this.lastMessageAt = Optional.empty(); + } else { + this.lastMessageAt = Optional.of(lastMessageAt.get()); + } + return this; + } + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastMessageAt(OffsetDateTime lastMessageAt) { + this.lastMessageAt = Optional.ofNullable(lastMessageAt); + return this; + } + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ */ + @java.lang.Override + @JsonSetter(value = "last_message_at", nulls = Nulls.SKIP) + public _FinalStage lastMessageAt(Optional lastMessageAt) { + this.lastMessageAt = lastMessageAt; + return this; + } + + @java.lang.Override + public DmChannelListItem build() { + return new DmChannelListItem(createdAt, id, lastMessageAt, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DmMember.java b/src/main/java/com/whop/api/types/DmMember.java new file mode 100644 index 00000000..af84d2ef --- /dev/null +++ b/src/main/java/com/whop/api/types/DmMember.java @@ -0,0 +1,351 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DmMember.Builder.class) +public final class DmMember { + private final String channelId; + + private final String id; + + private final Optional lastViewedAt; + + private final DmsFeedMemberNotificationPreferences notificationPreference; + + private final DmsFeedMemberStatuses status; + + private final String userId; + + private final Map additionalProperties; + + private DmMember( + String channelId, + String id, + Optional lastViewedAt, + DmsFeedMemberNotificationPreferences notificationPreference, + DmsFeedMemberStatuses status, + String userId, + Map additionalProperties) { + this.channelId = channelId; + this.id = id; + this.lastViewedAt = lastViewedAt; + this.notificationPreference = notificationPreference; + this.status = status; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the messaging channel this membership belongs to. + */ + @JsonProperty("channel_id") + public String getChannelId() { + return channelId; + } + + /** + * @return The unique identifier for the entity + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The timestamp when this member last viewed the channel, as a Unix timestamp in milliseconds. Null if the member has never viewed the channel. + */ + @JsonIgnore + public Optional getLastViewedAt() { + if (lastViewedAt == null) { + return Optional.empty(); + } + return lastViewedAt; + } + + /** + * @return The notification level for this channel: all, mentions, or none. + */ + @JsonProperty("notification_preference") + public DmsFeedMemberNotificationPreferences getNotificationPreference() { + return notificationPreference; + } + + /** + * @return The current state of this membership: requested, accepted, hidden, closed, or archived. + */ + @JsonProperty("status") + public DmsFeedMemberStatuses getStatus() { + return status; + } + + /** + * @return The unique identifier of the user who holds this channel membership. + */ + @JsonProperty("user_id") + public String getUserId() { + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_viewed_at") + private Optional _getLastViewedAt() { + return lastViewedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DmMember && equalTo((DmMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DmMember other) { + return channelId.equals(other.channelId) + && id.equals(other.id) + && lastViewedAt.equals(other.lastViewedAt) + && notificationPreference.equals(other.notificationPreference) + && status.equals(other.status) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.channelId, this.id, this.lastViewedAt, this.notificationPreference, this.status, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChannelIdStage builder() { + return new Builder(); + } + + public interface ChannelIdStage { + /** + *

The unique identifier of the messaging channel this membership belongs to.

+ */ + IdStage channelId(@NotNull String channelId); + + Builder from(DmMember other); + } + + public interface IdStage { + /** + *

The unique identifier for the entity

+ */ + NotificationPreferenceStage id(@NotNull String id); + } + + public interface NotificationPreferenceStage { + /** + *

The notification level for this channel: all, mentions, or none.

+ */ + StatusStage notificationPreference(@NotNull DmsFeedMemberNotificationPreferences notificationPreference); + } + + public interface StatusStage { + /** + *

The current state of this membership: requested, accepted, hidden, closed, or archived.

+ */ + UserIdStage status(@NotNull DmsFeedMemberStatuses status); + } + + public interface UserIdStage { + /** + *

The unique identifier of the user who holds this channel membership.

+ */ + _FinalStage userId(@NotNull String userId); + } + + public interface _FinalStage { + DmMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The timestamp when this member last viewed the channel, as a Unix timestamp in milliseconds. Null if the member has never viewed the channel.

+ */ + _FinalStage lastViewedAt(Optional lastViewedAt); + + _FinalStage lastViewedAt(String lastViewedAt); + + _FinalStage lastViewedAt(Nullable lastViewedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ChannelIdStage, IdStage, NotificationPreferenceStage, StatusStage, UserIdStage, _FinalStage { + private String channelId; + + private String id; + + private DmsFeedMemberNotificationPreferences notificationPreference; + + private DmsFeedMemberStatuses status; + + private String userId; + + private Optional lastViewedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DmMember other) { + channelId(other.getChannelId()); + id(other.getId()); + lastViewedAt(other.getLastViewedAt()); + notificationPreference(other.getNotificationPreference()); + status(other.getStatus()); + userId(other.getUserId()); + return this; + } + + /** + *

The unique identifier of the messaging channel this membership belongs to.

+ *

The unique identifier of the messaging channel this membership belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("channel_id") + public IdStage channelId(@NotNull String channelId) { + this.channelId = Objects.requireNonNull(channelId, "channelId must not be null"); + return this; + } + + /** + *

The unique identifier for the entity

+ *

The unique identifier for the entity

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NotificationPreferenceStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The notification level for this channel: all, mentions, or none.

+ *

The notification level for this channel: all, mentions, or none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("notification_preference") + public StatusStage notificationPreference( + @NotNull DmsFeedMemberNotificationPreferences notificationPreference) { + this.notificationPreference = + Objects.requireNonNull(notificationPreference, "notificationPreference must not be null"); + return this; + } + + /** + *

The current state of this membership: requested, accepted, hidden, closed, or archived.

+ *

The current state of this membership: requested, accepted, hidden, closed, or archived.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UserIdStage status(@NotNull DmsFeedMemberStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The unique identifier of the user who holds this channel membership.

+ *

The unique identifier of the user who holds this channel membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user_id") + public _FinalStage userId(@NotNull String userId) { + this.userId = Objects.requireNonNull(userId, "userId must not be null"); + return this; + } + + /** + *

The timestamp when this member last viewed the channel, as a Unix timestamp in milliseconds. Null if the member has never viewed the channel.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastViewedAt(Nullable lastViewedAt) { + if (lastViewedAt.isNull()) { + this.lastViewedAt = null; + } else if (lastViewedAt.isEmpty()) { + this.lastViewedAt = Optional.empty(); + } else { + this.lastViewedAt = Optional.of(lastViewedAt.get()); + } + return this; + } + + /** + *

The timestamp when this member last viewed the channel, as a Unix timestamp in milliseconds. Null if the member has never viewed the channel.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastViewedAt(String lastViewedAt) { + this.lastViewedAt = Optional.ofNullable(lastViewedAt); + return this; + } + + /** + *

The timestamp when this member last viewed the channel, as a Unix timestamp in milliseconds. Null if the member has never viewed the channel.

+ */ + @java.lang.Override + @JsonSetter(value = "last_viewed_at", nulls = Nulls.SKIP) + public _FinalStage lastViewedAt(Optional lastViewedAt) { + this.lastViewedAt = lastViewedAt; + return this; + } + + @java.lang.Override + public DmMember build() { + return new DmMember( + channelId, id, lastViewedAt, notificationPreference, status, userId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DmMemberListItem.java b/src/main/java/com/whop/api/types/DmMemberListItem.java new file mode 100644 index 00000000..ac78fe31 --- /dev/null +++ b/src/main/java/com/whop/api/types/DmMemberListItem.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DmMemberListItem.Builder.class) +public final class DmMemberListItem { + private final String channelId; + + private final String id; + + private final Optional lastViewedAt; + + private final DmsFeedMemberStatuses status; + + private final String userId; + + private final Map additionalProperties; + + private DmMemberListItem( + String channelId, + String id, + Optional lastViewedAt, + DmsFeedMemberStatuses status, + String userId, + Map additionalProperties) { + this.channelId = channelId; + this.id = id; + this.lastViewedAt = lastViewedAt; + this.status = status; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the messaging channel this membership belongs to. + */ + @JsonProperty("channel_id") + public String getChannelId() { + return channelId; + } + + /** + * @return The unique identifier for the entity + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The timestamp when this member last viewed the channel, as a Unix timestamp in milliseconds. Null if the member has never viewed the channel. + */ + @JsonIgnore + public Optional getLastViewedAt() { + if (lastViewedAt == null) { + return Optional.empty(); + } + return lastViewedAt; + } + + /** + * @return The current state of this membership: requested, accepted, hidden, closed, or archived. + */ + @JsonProperty("status") + public DmsFeedMemberStatuses getStatus() { + return status; + } + + /** + * @return The unique identifier of the user who holds this channel membership. + */ + @JsonProperty("user_id") + public String getUserId() { + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_viewed_at") + private Optional _getLastViewedAt() { + return lastViewedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DmMemberListItem && equalTo((DmMemberListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DmMemberListItem other) { + return channelId.equals(other.channelId) + && id.equals(other.id) + && lastViewedAt.equals(other.lastViewedAt) + && status.equals(other.status) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.channelId, this.id, this.lastViewedAt, this.status, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChannelIdStage builder() { + return new Builder(); + } + + public interface ChannelIdStage { + /** + *

The unique identifier of the messaging channel this membership belongs to.

+ */ + IdStage channelId(@NotNull String channelId); + + Builder from(DmMemberListItem other); + } + + public interface IdStage { + /** + *

The unique identifier for the entity

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

The current state of this membership: requested, accepted, hidden, closed, or archived.

+ */ + UserIdStage status(@NotNull DmsFeedMemberStatuses status); + } + + public interface UserIdStage { + /** + *

The unique identifier of the user who holds this channel membership.

+ */ + _FinalStage userId(@NotNull String userId); + } + + public interface _FinalStage { + DmMemberListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The timestamp when this member last viewed the channel, as a Unix timestamp in milliseconds. Null if the member has never viewed the channel.

+ */ + _FinalStage lastViewedAt(Optional lastViewedAt); + + _FinalStage lastViewedAt(String lastViewedAt); + + _FinalStage lastViewedAt(Nullable lastViewedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ChannelIdStage, IdStage, StatusStage, UserIdStage, _FinalStage { + private String channelId; + + private String id; + + private DmsFeedMemberStatuses status; + + private String userId; + + private Optional lastViewedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DmMemberListItem other) { + channelId(other.getChannelId()); + id(other.getId()); + lastViewedAt(other.getLastViewedAt()); + status(other.getStatus()); + userId(other.getUserId()); + return this; + } + + /** + *

The unique identifier of the messaging channel this membership belongs to.

+ *

The unique identifier of the messaging channel this membership belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("channel_id") + public IdStage channelId(@NotNull String channelId) { + this.channelId = Objects.requireNonNull(channelId, "channelId must not be null"); + return this; + } + + /** + *

The unique identifier for the entity

+ *

The unique identifier for the entity

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current state of this membership: requested, accepted, hidden, closed, or archived.

+ *

The current state of this membership: requested, accepted, hidden, closed, or archived.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UserIdStage status(@NotNull DmsFeedMemberStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The unique identifier of the user who holds this channel membership.

+ *

The unique identifier of the user who holds this channel membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user_id") + public _FinalStage userId(@NotNull String userId) { + this.userId = Objects.requireNonNull(userId, "userId must not be null"); + return this; + } + + /** + *

The timestamp when this member last viewed the channel, as a Unix timestamp in milliseconds. Null if the member has never viewed the channel.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastViewedAt(Nullable lastViewedAt) { + if (lastViewedAt.isNull()) { + this.lastViewedAt = null; + } else if (lastViewedAt.isEmpty()) { + this.lastViewedAt = Optional.empty(); + } else { + this.lastViewedAt = Optional.of(lastViewedAt.get()); + } + return this; + } + + /** + *

The timestamp when this member last viewed the channel, as a Unix timestamp in milliseconds. Null if the member has never viewed the channel.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastViewedAt(String lastViewedAt) { + this.lastViewedAt = Optional.ofNullable(lastViewedAt); + return this; + } + + /** + *

The timestamp when this member last viewed the channel, as a Unix timestamp in milliseconds. Null if the member has never viewed the channel.

+ */ + @java.lang.Override + @JsonSetter(value = "last_viewed_at", nulls = Nulls.SKIP) + public _FinalStage lastViewedAt(Optional lastViewedAt) { + this.lastViewedAt = lastViewedAt; + return this; + } + + @java.lang.Override + public DmMemberListItem build() { + return new DmMemberListItem(channelId, id, lastViewedAt, status, userId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/DmsFeedMemberNotificationPreferences.java b/src/main/java/com/whop/api/types/DmsFeedMemberNotificationPreferences.java new file mode 100644 index 00000000..6f3a71f4 --- /dev/null +++ b/src/main/java/com/whop/api/types/DmsFeedMemberNotificationPreferences.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DmsFeedMemberNotificationPreferences { + public static final DmsFeedMemberNotificationPreferences ALL = + new DmsFeedMemberNotificationPreferences(Value.ALL, "all"); + + public static final DmsFeedMemberNotificationPreferences MENTIONS = + new DmsFeedMemberNotificationPreferences(Value.MENTIONS, "mentions"); + + public static final DmsFeedMemberNotificationPreferences NONE = + new DmsFeedMemberNotificationPreferences(Value.NONE, "none"); + + private final Value value; + + private final String string; + + DmsFeedMemberNotificationPreferences(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof DmsFeedMemberNotificationPreferences + && this.string.equals(((DmsFeedMemberNotificationPreferences) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ALL: + return visitor.visitAll(); + case MENTIONS: + return visitor.visitMentions(); + case NONE: + return visitor.visitNone(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DmsFeedMemberNotificationPreferences valueOf(String value) { + switch (value) { + case "all": + return ALL; + case "mentions": + return MENTIONS; + case "none": + return NONE; + default: + return new DmsFeedMemberNotificationPreferences(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL, + + MENTIONS, + + NONE, + + UNKNOWN + } + + public interface Visitor { + T visitAll(); + + T visitMentions(); + + T visitNone(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/DmsFeedMemberStatuses.java b/src/main/java/com/whop/api/types/DmsFeedMemberStatuses.java new file mode 100644 index 00000000..9be6f5d7 --- /dev/null +++ b/src/main/java/com/whop/api/types/DmsFeedMemberStatuses.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DmsFeedMemberStatuses { + public static final DmsFeedMemberStatuses HIDDEN = new DmsFeedMemberStatuses(Value.HIDDEN, "hidden"); + + public static final DmsFeedMemberStatuses CLOSED = new DmsFeedMemberStatuses(Value.CLOSED, "closed"); + + public static final DmsFeedMemberStatuses REQUESTED = new DmsFeedMemberStatuses(Value.REQUESTED, "requested"); + + public static final DmsFeedMemberStatuses ACCEPTED = new DmsFeedMemberStatuses(Value.ACCEPTED, "accepted"); + + public static final DmsFeedMemberStatuses ARCHIVED = new DmsFeedMemberStatuses(Value.ARCHIVED, "archived"); + + private final Value value; + + private final String string; + + DmsFeedMemberStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof DmsFeedMemberStatuses + && this.string.equals(((DmsFeedMemberStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HIDDEN: + return visitor.visitHidden(); + case CLOSED: + return visitor.visitClosed(); + case REQUESTED: + return visitor.visitRequested(); + case ACCEPTED: + return visitor.visitAccepted(); + case ARCHIVED: + return visitor.visitArchived(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DmsFeedMemberStatuses valueOf(String value) { + switch (value) { + case "hidden": + return HIDDEN; + case "closed": + return CLOSED; + case "requested": + return REQUESTED; + case "accepted": + return ACCEPTED; + case "archived": + return ARCHIVED; + default: + return new DmsFeedMemberStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + REQUESTED, + + ACCEPTED, + + HIDDEN, + + CLOSED, + + ARCHIVED, + + UNKNOWN + } + + public interface Visitor { + T visitRequested(); + + T visitAccepted(); + + T visitHidden(); + + T visitClosed(); + + T visitArchived(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/DmsPostTypes.java b/src/main/java/com/whop/api/types/DmsPostTypes.java new file mode 100644 index 00000000..42ff2730 --- /dev/null +++ b/src/main/java/com/whop/api/types/DmsPostTypes.java @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DmsPostTypes { + public static final DmsPostTypes REGULAR = new DmsPostTypes(Value.REGULAR, "regular"); + + public static final DmsPostTypes SYSTEM = new DmsPostTypes(Value.SYSTEM, "system"); + + public static final DmsPostTypes AUTOMATED = new DmsPostTypes(Value.AUTOMATED, "automated"); + + private final Value value; + + private final String string; + + DmsPostTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof DmsPostTypes && this.string.equals(((DmsPostTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REGULAR: + return visitor.visitRegular(); + case SYSTEM: + return visitor.visitSystem(); + case AUTOMATED: + return visitor.visitAutomated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DmsPostTypes valueOf(String value) { + switch (value) { + case "regular": + return REGULAR; + case "system": + return SYSTEM; + case "automated": + return AUTOMATED; + default: + return new DmsPostTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + REGULAR, + + SYSTEM, + + AUTOMATED, + + UNKNOWN + } + + public interface Visitor { + T visitRegular(); + + T visitSystem(); + + T visitAutomated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/EmbedTypes.java b/src/main/java/com/whop/api/types/EmbedTypes.java new file mode 100644 index 00000000..da89c00c --- /dev/null +++ b/src/main/java/com/whop/api/types/EmbedTypes.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class EmbedTypes { + public static final EmbedTypes YOUTUBE = new EmbedTypes(Value.YOUTUBE, "youtube"); + + public static final EmbedTypes LOOM = new EmbedTypes(Value.LOOM, "loom"); + + private final Value value; + + private final String string; + + EmbedTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof EmbedTypes && this.string.equals(((EmbedTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case YOUTUBE: + return visitor.visitYoutube(); + case LOOM: + return visitor.visitLoom(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static EmbedTypes valueOf(String value) { + switch (value) { + case "youtube": + return YOUTUBE; + case "loom": + return LOOM; + default: + return new EmbedTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + YOUTUBE, + + LOOM, + + UNKNOWN + } + + public interface Visitor { + T visitYoutube(); + + T visitLoom(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/EntriesSortableColumns.java b/src/main/java/com/whop/api/types/EntriesSortableColumns.java new file mode 100644 index 00000000..4131c1d2 --- /dev/null +++ b/src/main/java/com/whop/api/types/EntriesSortableColumns.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class EntriesSortableColumns { + public static final EntriesSortableColumns CREATED_AT = new EntriesSortableColumns(Value.CREATED_AT, "created_at"); + + public static final EntriesSortableColumns ID = new EntriesSortableColumns(Value.ID, "id"); + + private final Value value; + + private final String string; + + EntriesSortableColumns(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof EntriesSortableColumns + && this.string.equals(((EntriesSortableColumns) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case ID: + return visitor.visitId(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static EntriesSortableColumns valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + case "id": + return ID; + default: + return new EntriesSortableColumns(Value.UNKNOWN, value); + } + } + + public enum Value { + ID, + + CREATED_AT, + + UNKNOWN + } + + public interface Visitor { + T visitId(); + + T visitCreatedAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Entry.java b/src/main/java/com/whop/api/types/Entry.java new file mode 100644 index 00000000..ea3bce6e --- /dev/null +++ b/src/main/java/com/whop/api/types/Entry.java @@ -0,0 +1,489 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Entry.Builder.class) +public final class Entry { + private final Optional createdAt; + + private final Optional> customFieldResponses; + + private final String id; + + private final Optional plan; + + private final Optional product; + + private final EntryStatus status; + + private final EntryUser user; + + private final Map additionalProperties; + + private Entry( + Optional createdAt, + Optional> customFieldResponses, + String id, + Optional plan, + Optional product, + EntryStatus status, + EntryUser user, + Map additionalProperties) { + this.createdAt = createdAt; + this.customFieldResponses = customFieldResponses; + this.id = id; + this.plan = plan; + this.product = product; + this.status = status; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The datetime the entry was created. + */ + @JsonIgnore + public Optional getCreatedAt() { + if (createdAt == null) { + return Optional.empty(); + } + return createdAt; + } + + /** + * @return The list of responses collected from the user when submitting their waitlist entry. + */ + @JsonIgnore + public Optional> getCustomFieldResponses() { + if (customFieldResponses == null) { + return Optional.empty(); + } + return customFieldResponses; + } + + /** + * @return The unique identifier for the entry. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The waitlisted plan that this entry is a signup for. + */ + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + /** + * @return The product associated with this entry's waitlisted plan. Null if the plan is not tied to a product. + */ + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return The current status of the waitlist entry (e.g., drafted, pending, approved, denied). + */ + @JsonProperty("status") + public EntryStatus getStatus() { + return status; + } + + /** + * @return The user who submitted this waitlist entry. + */ + @JsonProperty("user") + public EntryUser getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_at") + private Optional _getCreatedAt() { + return createdAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_field_responses") + private Optional> _getCustomFieldResponses() { + return customFieldResponses; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Entry && equalTo((Entry) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Entry other) { + return createdAt.equals(other.createdAt) + && customFieldResponses.equals(other.customFieldResponses) + && id.equals(other.id) + && plan.equals(other.plan) + && product.equals(other.product) + && status.equals(other.status) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, this.customFieldResponses, this.id, this.plan, this.product, this.status, this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the entry.

+ */ + StatusStage id(@NotNull String id); + + Builder from(Entry other); + } + + public interface StatusStage { + /** + *

The current status of the waitlist entry (e.g., drafted, pending, approved, denied).

+ */ + UserStage status(@NotNull EntryStatus status); + } + + public interface UserStage { + /** + *

The user who submitted this waitlist entry.

+ */ + _FinalStage user(@NotNull EntryUser user); + } + + public interface _FinalStage { + Entry build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The datetime the entry was created.

+ */ + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage createdAt(Nullable createdAt); + + /** + *

The list of responses collected from the user when submitting their waitlist entry.

+ */ + _FinalStage customFieldResponses(Optional> customFieldResponses); + + _FinalStage customFieldResponses(List customFieldResponses); + + _FinalStage customFieldResponses(Nullable> customFieldResponses); + + /** + *

The waitlisted plan that this entry is a signup for.

+ */ + _FinalStage plan(Optional plan); + + _FinalStage plan(EntryPlan plan); + + _FinalStage plan(Nullable plan); + + /** + *

The product associated with this entry's waitlisted plan. Null if the plan is not tied to a product.

+ */ + _FinalStage product(Optional product); + + _FinalStage product(EntryProduct product); + + _FinalStage product(Nullable product); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, StatusStage, UserStage, _FinalStage { + private String id; + + private EntryStatus status; + + private EntryUser user; + + private Optional product = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional> customFieldResponses = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Entry other) { + createdAt(other.getCreatedAt()); + customFieldResponses(other.getCustomFieldResponses()); + id(other.getId()); + plan(other.getPlan()); + product(other.getProduct()); + status(other.getStatus()); + user(other.getUser()); + return this; + } + + /** + *

The unique identifier for the entry.

+ *

The unique identifier for the entry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current status of the waitlist entry (e.g., drafted, pending, approved, denied).

+ *

The current status of the waitlist entry (e.g., drafted, pending, approved, denied).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UserStage status(@NotNull EntryStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The user who submitted this waitlist entry.

+ *

The user who submitted this waitlist entry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull EntryUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

The product associated with this entry's waitlisted plan. Null if the plan is not tied to a product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

The product associated with this entry's waitlisted plan. Null if the plan is not tied to a product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(EntryProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

The product associated with this entry's waitlisted plan. Null if the plan is not tied to a product.

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

The waitlisted plan that this entry is a signup for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + /** + *

The waitlisted plan that this entry is a signup for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(EntryPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + /** + *

The waitlisted plan that this entry is a signup for.

+ */ + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + + /** + *

The list of responses collected from the user when submitting their waitlist entry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customFieldResponses(Nullable> customFieldResponses) { + if (customFieldResponses.isNull()) { + this.customFieldResponses = null; + } else if (customFieldResponses.isEmpty()) { + this.customFieldResponses = Optional.empty(); + } else { + this.customFieldResponses = Optional.of(customFieldResponses.get()); + } + return this; + } + + /** + *

The list of responses collected from the user when submitting their waitlist entry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customFieldResponses(List customFieldResponses) { + this.customFieldResponses = Optional.ofNullable(customFieldResponses); + return this; + } + + /** + *

The list of responses collected from the user when submitting their waitlist entry.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_field_responses", nulls = Nulls.SKIP) + public _FinalStage customFieldResponses(Optional> customFieldResponses) { + this.customFieldResponses = customFieldResponses; + return this; + } + + /** + *

The datetime the entry was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(Nullable createdAt) { + if (createdAt.isNull()) { + this.createdAt = null; + } else if (createdAt.isEmpty()) { + this.createdAt = Optional.empty(); + } else { + this.createdAt = Optional.of(createdAt.get()); + } + return this; + } + + /** + *

The datetime the entry was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

The datetime the entry was created.

+ */ + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + @java.lang.Override + public Entry build() { + return new Entry(createdAt, customFieldResponses, id, plan, product, status, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/EntryCustomFieldResponsesItem.java b/src/main/java/com/whop/api/types/EntryCustomFieldResponsesItem.java new file mode 100644 index 00000000..35c0cb8b --- /dev/null +++ b/src/main/java/com/whop/api/types/EntryCustomFieldResponsesItem.java @@ -0,0 +1,196 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EntryCustomFieldResponsesItem.Builder.class) +public final class EntryCustomFieldResponsesItem { + private final String answer; + + private final String id; + + private final String question; + + private final Map additionalProperties; + + private EntryCustomFieldResponsesItem( + String answer, String id, String question, Map additionalProperties) { + this.answer = answer; + this.id = id; + this.question = question; + this.additionalProperties = additionalProperties; + } + + /** + * @return The response a user gave to the specific question or field. + */ + @JsonProperty("answer") + public String getAnswer() { + return answer; + } + + /** + * @return The unique identifier for the custom field response. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The question asked by the custom field + */ + @JsonProperty("question") + public String getQuestion() { + return question; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EntryCustomFieldResponsesItem && equalTo((EntryCustomFieldResponsesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EntryCustomFieldResponsesItem other) { + return answer.equals(other.answer) && id.equals(other.id) && question.equals(other.question); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.answer, this.id, this.question); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AnswerStage builder() { + return new Builder(); + } + + public interface AnswerStage { + /** + *

The response a user gave to the specific question or field.

+ */ + IdStage answer(@NotNull String answer); + + Builder from(EntryCustomFieldResponsesItem other); + } + + public interface IdStage { + /** + *

The unique identifier for the custom field response.

+ */ + QuestionStage id(@NotNull String id); + } + + public interface QuestionStage { + /** + *

The question asked by the custom field

+ */ + _FinalStage question(@NotNull String question); + } + + public interface _FinalStage { + EntryCustomFieldResponsesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AnswerStage, IdStage, QuestionStage, _FinalStage { + private String answer; + + private String id; + + private String question; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EntryCustomFieldResponsesItem other) { + answer(other.getAnswer()); + id(other.getId()); + question(other.getQuestion()); + return this; + } + + /** + *

The response a user gave to the specific question or field.

+ *

The response a user gave to the specific question or field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("answer") + public IdStage answer(@NotNull String answer) { + this.answer = Objects.requireNonNull(answer, "answer must not be null"); + return this; + } + + /** + *

The unique identifier for the custom field response.

+ *

The unique identifier for the custom field response.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public QuestionStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The question asked by the custom field

+ *

The question asked by the custom field

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("question") + public _FinalStage question(@NotNull String question) { + this.question = Objects.requireNonNull(question, "question must not be null"); + return this; + } + + @java.lang.Override + public EntryCustomFieldResponsesItem build() { + return new EntryCustomFieldResponsesItem(answer, id, question, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/EntryListItem.java b/src/main/java/com/whop/api/types/EntryListItem.java new file mode 100644 index 00000000..2db6b273 --- /dev/null +++ b/src/main/java/com/whop/api/types/EntryListItem.java @@ -0,0 +1,417 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EntryListItem.Builder.class) +public final class EntryListItem { + private final Optional createdAt; + + private final String id; + + private final Optional plan; + + private final Optional product; + + private final EntryStatus status; + + private final EntryListItemUser user; + + private final Map additionalProperties; + + private EntryListItem( + Optional createdAt, + String id, + Optional plan, + Optional product, + EntryStatus status, + EntryListItemUser user, + Map additionalProperties) { + this.createdAt = createdAt; + this.id = id; + this.plan = plan; + this.product = product; + this.status = status; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The datetime the entry was created. + */ + @JsonIgnore + public Optional getCreatedAt() { + if (createdAt == null) { + return Optional.empty(); + } + return createdAt; + } + + /** + * @return The unique identifier for the entry. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The waitlisted plan that this entry is a signup for. + */ + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + /** + * @return The product associated with this entry's waitlisted plan. Null if the plan is not tied to a product. + */ + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return The current status of the waitlist entry (e.g., drafted, pending, approved, denied). + */ + @JsonProperty("status") + public EntryStatus getStatus() { + return status; + } + + /** + * @return The user who submitted this waitlist entry. + */ + @JsonProperty("user") + public EntryListItemUser getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_at") + private Optional _getCreatedAt() { + return createdAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EntryListItem && equalTo((EntryListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EntryListItem other) { + return createdAt.equals(other.createdAt) + && id.equals(other.id) + && plan.equals(other.plan) + && product.equals(other.product) + && status.equals(other.status) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.id, this.plan, this.product, this.status, this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the entry.

+ */ + StatusStage id(@NotNull String id); + + Builder from(EntryListItem other); + } + + public interface StatusStage { + /** + *

The current status of the waitlist entry (e.g., drafted, pending, approved, denied).

+ */ + UserStage status(@NotNull EntryStatus status); + } + + public interface UserStage { + /** + *

The user who submitted this waitlist entry.

+ */ + _FinalStage user(@NotNull EntryListItemUser user); + } + + public interface _FinalStage { + EntryListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The datetime the entry was created.

+ */ + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage createdAt(Nullable createdAt); + + /** + *

The waitlisted plan that this entry is a signup for.

+ */ + _FinalStage plan(Optional plan); + + _FinalStage plan(EntryListItemPlan plan); + + _FinalStage plan(Nullable plan); + + /** + *

The product associated with this entry's waitlisted plan. Null if the plan is not tied to a product.

+ */ + _FinalStage product(Optional product); + + _FinalStage product(EntryListItemProduct product); + + _FinalStage product(Nullable product); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, StatusStage, UserStage, _FinalStage { + private String id; + + private EntryStatus status; + + private EntryListItemUser user; + + private Optional product = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EntryListItem other) { + createdAt(other.getCreatedAt()); + id(other.getId()); + plan(other.getPlan()); + product(other.getProduct()); + status(other.getStatus()); + user(other.getUser()); + return this; + } + + /** + *

The unique identifier for the entry.

+ *

The unique identifier for the entry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current status of the waitlist entry (e.g., drafted, pending, approved, denied).

+ *

The current status of the waitlist entry (e.g., drafted, pending, approved, denied).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UserStage status(@NotNull EntryStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The user who submitted this waitlist entry.

+ *

The user who submitted this waitlist entry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull EntryListItemUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

The product associated with this entry's waitlisted plan. Null if the plan is not tied to a product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

The product associated with this entry's waitlisted plan. Null if the plan is not tied to a product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(EntryListItemProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

The product associated with this entry's waitlisted plan. Null if the plan is not tied to a product.

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

The waitlisted plan that this entry is a signup for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + /** + *

The waitlisted plan that this entry is a signup for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(EntryListItemPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + /** + *

The waitlisted plan that this entry is a signup for.

+ */ + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + + /** + *

The datetime the entry was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(Nullable createdAt) { + if (createdAt.isNull()) { + this.createdAt = null; + } else if (createdAt.isEmpty()) { + this.createdAt = Optional.empty(); + } else { + this.createdAt = Optional.of(createdAt.get()); + } + return this; + } + + /** + *

The datetime the entry was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

The datetime the entry was created.

+ */ + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + @java.lang.Override + public EntryListItem build() { + return new EntryListItem(createdAt, id, plan, product, status, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/EntryListItemPlan.java b/src/main/java/com/whop/api/types/EntryListItemPlan.java new file mode 100644 index 00000000..879ff015 --- /dev/null +++ b/src/main/java/com/whop/api/types/EntryListItemPlan.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EntryListItemPlan.Builder.class) +public final class EntryListItemPlan { + private final String id; + + private final Map additionalProperties; + + private EntryListItemPlan(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the plan. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EntryListItemPlan && equalTo((EntryListItemPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EntryListItemPlan other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the plan.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(EntryListItemPlan other); + } + + public interface _FinalStage { + EntryListItemPlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EntryListItemPlan other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the plan.

+ *

The unique identifier for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public EntryListItemPlan build() { + return new EntryListItemPlan(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/EntryListItemProduct.java b/src/main/java/com/whop/api/types/EntryListItemProduct.java new file mode 100644 index 00000000..874afdb6 --- /dev/null +++ b/src/main/java/com/whop/api/types/EntryListItemProduct.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EntryListItemProduct.Builder.class) +public final class EntryListItemProduct { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private EntryListItemProduct(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the product. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the product shown to customers on the product page and in search results. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EntryListItemProduct && equalTo((EntryListItemProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EntryListItemProduct other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the product.

+ */ + TitleStage id(@NotNull String id); + + Builder from(EntryListItemProduct other); + } + + public interface TitleStage { + /** + *

The display name of the product shown to customers on the product page and in search results.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + EntryListItemProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EntryListItemProduct other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the product.

+ *

The unique identifier for the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the product shown to customers on the product page and in search results.

+ *

The display name of the product shown to customers on the product page and in search results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public EntryListItemProduct build() { + return new EntryListItemProduct(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/EntryListItemUser.java b/src/main/java/com/whop/api/types/EntryListItemUser.java new file mode 100644 index 00000000..f6369a21 --- /dev/null +++ b/src/main/java/com/whop/api/types/EntryListItemUser.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EntryListItemUser.Builder.class) +public final class EntryListItemUser { + private final Optional email; + + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private EntryListItemUser( + Optional email, + String id, + Optional name, + String username, + Map additionalProperties) { + this.email = email; + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's email address. Requires the member:email:read permission to access. Null if not authorized. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EntryListItemUser && equalTo((EntryListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EntryListItemUser other) { + return email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(EntryListItemUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + EntryListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EntryListItemUser other) { + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public EntryListItemUser build() { + return new EntryListItemUser(email, id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/EntryPlan.java b/src/main/java/com/whop/api/types/EntryPlan.java new file mode 100644 index 00000000..dc06cc17 --- /dev/null +++ b/src/main/java/com/whop/api/types/EntryPlan.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EntryPlan.Builder.class) +public final class EntryPlan { + private final String id; + + private final Map additionalProperties; + + private EntryPlan(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the plan. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EntryPlan && equalTo((EntryPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EntryPlan other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the plan.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(EntryPlan other); + } + + public interface _FinalStage { + EntryPlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EntryPlan other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the plan.

+ *

The unique identifier for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public EntryPlan build() { + return new EntryPlan(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/EntryProduct.java b/src/main/java/com/whop/api/types/EntryProduct.java new file mode 100644 index 00000000..7216d390 --- /dev/null +++ b/src/main/java/com/whop/api/types/EntryProduct.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EntryProduct.Builder.class) +public final class EntryProduct { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private EntryProduct(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the product. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the product shown to customers on the product page and in search results. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EntryProduct && equalTo((EntryProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EntryProduct other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the product.

+ */ + TitleStage id(@NotNull String id); + + Builder from(EntryProduct other); + } + + public interface TitleStage { + /** + *

The display name of the product shown to customers on the product page and in search results.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + EntryProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EntryProduct other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the product.

+ *

The unique identifier for the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the product shown to customers on the product page and in search results.

+ *

The display name of the product shown to customers on the product page and in search results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public EntryProduct build() { + return new EntryProduct(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/EntryStatus.java b/src/main/java/com/whop/api/types/EntryStatus.java new file mode 100644 index 00000000..8cef3191 --- /dev/null +++ b/src/main/java/com/whop/api/types/EntryStatus.java @@ -0,0 +1,112 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class EntryStatus { + public static final EntryStatus APPROVED = new EntryStatus(Value.APPROVED, "approved"); + + public static final EntryStatus PENDING = new EntryStatus(Value.PENDING, "pending"); + + public static final EntryStatus DENIED = new EntryStatus(Value.DENIED, "denied"); + + public static final EntryStatus ANY = new EntryStatus(Value.ANY, "any"); + + public static final EntryStatus DRAFTED = new EntryStatus(Value.DRAFTED, "drafted"); + + private final Value value; + + private final String string; + + EntryStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof EntryStatus && this.string.equals(((EntryStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case PENDING: + return visitor.visitPending(); + case DENIED: + return visitor.visitDenied(); + case ANY: + return visitor.visitAny(); + case DRAFTED: + return visitor.visitDrafted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static EntryStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "pending": + return PENDING; + case "denied": + return DENIED; + case "any": + return ANY; + case "drafted": + return DRAFTED; + default: + return new EntryStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + DRAFTED, + + PENDING, + + APPROVED, + + DENIED, + + ANY, + + UNKNOWN + } + + public interface Visitor { + T visitDrafted(); + + T visitPending(); + + T visitApproved(); + + T visitDenied(); + + T visitAny(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/EntryUser.java b/src/main/java/com/whop/api/types/EntryUser.java new file mode 100644 index 00000000..a7fc411b --- /dev/null +++ b/src/main/java/com/whop/api/types/EntryUser.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EntryUser.Builder.class) +public final class EntryUser { + private final Optional email; + + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private EntryUser( + Optional email, + String id, + Optional name, + String username, + Map additionalProperties) { + this.email = email; + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's email address. Requires the member:email:read permission to access. Null if not authorized. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EntryUser && equalTo((EntryUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EntryUser other) { + return email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(EntryUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + EntryUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EntryUser other) { + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public EntryUser build() { + return new EntryUser(email, id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Experience.java b/src/main/java/com/whop/api/types/Experience.java new file mode 100644 index 00000000..f30fba36 --- /dev/null +++ b/src/main/java/com/whop/api/types/Experience.java @@ -0,0 +1,525 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Experience.Builder.class) +public final class Experience { + private final ExperienceApp app; + + private final ExperienceCompany company; + + private final OffsetDateTime createdAt; + + private final String id; + + private final Optional image; + + private final boolean isPublic; + + private final String name; + + private final Optional order; + + private final List products; + + private final Map additionalProperties; + + private Experience( + ExperienceApp app, + ExperienceCompany company, + OffsetDateTime createdAt, + String id, + Optional image, + boolean isPublic, + String name, + Optional order, + List products, + Map additionalProperties) { + this.app = app; + this.company = company; + this.createdAt = createdAt; + this.id = id; + this.image = image; + this.isPublic = isPublic; + this.name = name; + this.order = order; + this.products = products; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app that powers this experience, defining its interface and behavior. + */ + @JsonProperty("app") + public ExperienceApp getApp() { + return app; + } + + /** + * @return The company that owns this experience. + */ + @JsonProperty("company") + public ExperienceCompany getCompany() { + return company; + } + + /** + * @return The datetime the experience was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the experience. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The custom logo image for this experience. Null if no custom logo has been uploaded. + */ + @JsonIgnore + public Optional getImage() { + if (image == null) { + return Optional.empty(); + } + return image; + } + + /** + * @return Whether this experience is publicly visible to all users, including those without a membership. + */ + @JsonProperty("is_public") + public boolean getIsPublic() { + return isPublic; + } + + /** + * @return The display name of this experience shown to users in the product navigation. Maximum 255 characters. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The sort position of this experience within its section. Lower values appear first. Null if no position has been set. + */ + @JsonIgnore + public Optional getOrder() { + if (order == null) { + return Optional.empty(); + } + return order; + } + + /** + * @return The list of products this experience is attached to, which determines which customers have access. Empty if the experience is only visible to authorized company team members. + */ + @JsonProperty("products") + public List getProducts() { + return products; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("image") + private Optional _getImage() { + return image; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("order") + private Optional _getOrder() { + return order; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Experience && equalTo((Experience) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Experience other) { + return app.equals(other.app) + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && image.equals(other.image) + && isPublic == other.isPublic + && name.equals(other.name) + && order.equals(other.order) + && products.equals(other.products); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.app, + this.company, + this.createdAt, + this.id, + this.image, + this.isPublic, + this.name, + this.order, + this.products); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppStage builder() { + return new Builder(); + } + + public interface AppStage { + /** + *

The app that powers this experience, defining its interface and behavior.

+ */ + CompanyStage app(@NotNull ExperienceApp app); + + Builder from(Experience other); + } + + public interface CompanyStage { + /** + *

The company that owns this experience.

+ */ + CreatedAtStage company(@NotNull ExperienceCompany company); + } + + public interface CreatedAtStage { + /** + *

The datetime the experience was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the experience.

+ */ + IsPublicStage id(@NotNull String id); + } + + public interface IsPublicStage { + /** + *

Whether this experience is publicly visible to all users, including those without a membership.

+ */ + NameStage isPublic(boolean isPublic); + } + + public interface NameStage { + /** + *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + Experience build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The custom logo image for this experience. Null if no custom logo has been uploaded.

+ */ + _FinalStage image(Optional image); + + _FinalStage image(ExperienceImage image); + + _FinalStage image(Nullable image); + + /** + *

The sort position of this experience within its section. Lower values appear first. Null if no position has been set.

+ */ + _FinalStage order(Optional order); + + _FinalStage order(String order); + + _FinalStage order(Nullable order); + + /** + *

The list of products this experience is attached to, which determines which customers have access. Empty if the experience is only visible to authorized company team members.

+ */ + _FinalStage products(List products); + + _FinalStage addProducts(ExperienceProductsItem products); + + _FinalStage addAllProducts(List products); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AppStage, CompanyStage, CreatedAtStage, IdStage, IsPublicStage, NameStage, _FinalStage { + private ExperienceApp app; + + private ExperienceCompany company; + + private OffsetDateTime createdAt; + + private String id; + + private boolean isPublic; + + private String name; + + private List products = new ArrayList<>(); + + private Optional order = Optional.empty(); + + private Optional image = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Experience other) { + app(other.getApp()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + id(other.getId()); + image(other.getImage()); + isPublic(other.getIsPublic()); + name(other.getName()); + order(other.getOrder()); + products(other.getProducts()); + return this; + } + + /** + *

The app that powers this experience, defining its interface and behavior.

+ *

The app that powers this experience, defining its interface and behavior.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("app") + public CompanyStage app(@NotNull ExperienceApp app) { + this.app = Objects.requireNonNull(app, "app must not be null"); + return this; + } + + /** + *

The company that owns this experience.

+ *

The company that owns this experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company") + public CreatedAtStage company(@NotNull ExperienceCompany company) { + this.company = Objects.requireNonNull(company, "company must not be null"); + return this; + } + + /** + *

The datetime the experience was created.

+ *

The datetime the experience was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the experience.

+ *

The unique identifier for the experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsPublicStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether this experience is publicly visible to all users, including those without a membership.

+ *

Whether this experience is publicly visible to all users, including those without a membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_public") + public NameStage isPublic(boolean isPublic) { + this.isPublic = isPublic; + return this; + } + + /** + *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The list of products this experience is attached to, which determines which customers have access. Empty if the experience is only visible to authorized company team members.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllProducts(List products) { + if (products != null) { + this.products.addAll(products); + } + return this; + } + + /** + *

The list of products this experience is attached to, which determines which customers have access. Empty if the experience is only visible to authorized company team members.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addProducts(ExperienceProductsItem products) { + this.products.add(products); + return this; + } + + /** + *

The list of products this experience is attached to, which determines which customers have access. Empty if the experience is only visible to authorized company team members.

+ */ + @java.lang.Override + @JsonSetter(value = "products", nulls = Nulls.SKIP) + public _FinalStage products(List products) { + this.products.clear(); + if (products != null) { + this.products.addAll(products); + } + return this; + } + + /** + *

The sort position of this experience within its section. Lower values appear first. Null if no position has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(Nullable order) { + if (order.isNull()) { + this.order = null; + } else if (order.isEmpty()) { + this.order = Optional.empty(); + } else { + this.order = Optional.of(order.get()); + } + return this; + } + + /** + *

The sort position of this experience within its section. Lower values appear first. Null if no position has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(String order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The sort position of this experience within its section. Lower values appear first. Null if no position has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + /** + *

The custom logo image for this experience. Null if no custom logo has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage image(Nullable image) { + if (image.isNull()) { + this.image = null; + } else if (image.isEmpty()) { + this.image = Optional.empty(); + } else { + this.image = Optional.of(image.get()); + } + return this; + } + + /** + *

The custom logo image for this experience. Null if no custom logo has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage image(ExperienceImage image) { + this.image = Optional.ofNullable(image); + return this; + } + + /** + *

The custom logo image for this experience. Null if no custom logo has been uploaded.

+ */ + @java.lang.Override + @JsonSetter(value = "image", nulls = Nulls.SKIP) + public _FinalStage image(Optional image) { + this.image = image; + return this; + } + + @java.lang.Override + public Experience build() { + return new Experience( + app, company, createdAt, id, image, isPublic, name, order, products, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ExperienceAccessLevels.java b/src/main/java/com/whop/api/types/ExperienceAccessLevels.java new file mode 100644 index 00000000..621ba046 --- /dev/null +++ b/src/main/java/com/whop/api/types/ExperienceAccessLevels.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ExperienceAccessLevels { + public static final ExperienceAccessLevels PRIVATE = new ExperienceAccessLevels(Value.PRIVATE, "private"); + + public static final ExperienceAccessLevels PUBLIC = new ExperienceAccessLevels(Value.PUBLIC, "public"); + + private final Value value; + + private final String string; + + ExperienceAccessLevels(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ExperienceAccessLevels + && this.string.equals(((ExperienceAccessLevels) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PRIVATE: + return visitor.visitPrivate(); + case PUBLIC: + return visitor.visitPublic(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ExperienceAccessLevels valueOf(String value) { + switch (value) { + case "private": + return PRIVATE; + case "public": + return PUBLIC; + default: + return new ExperienceAccessLevels(Value.UNKNOWN, value); + } + } + + public enum Value { + PUBLIC, + + PRIVATE, + + UNKNOWN + } + + public interface Visitor { + T visitPublic(); + + T visitPrivate(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ExperienceApp.java b/src/main/java/com/whop/api/types/ExperienceApp.java new file mode 100644 index 00000000..8347f269 --- /dev/null +++ b/src/main/java/com/whop/api/types/ExperienceApp.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExperienceApp.Builder.class) +public final class ExperienceApp { + private final Optional icon; + + private final String id; + + private final String name; + + private final Map additionalProperties; + + private ExperienceApp( + Optional icon, String id, String name, Map additionalProperties) { + this.icon = icon; + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The icon image for this app, displayed on the app store, product pages, checkout, and as the default icon for experiences using this app. + */ + @JsonIgnore + public Optional getIcon() { + if (icon == null) { + return Optional.empty(); + } + return icon; + } + + /** + * @return The unique identifier for the app. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of this app shown on the app store and in experience navigation. Maximum 30 characters. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon") + private Optional _getIcon() { + return icon; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExperienceApp && equalTo((ExperienceApp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExperienceApp other) { + return icon.equals(other.icon) && id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.icon, this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the app.

+ */ + NameStage id(@NotNull String id); + + Builder from(ExperienceApp other); + } + + public interface NameStage { + /** + *

The display name of this app shown on the app store and in experience navigation. Maximum 30 characters.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + ExperienceApp build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The icon image for this app, displayed on the app store, product pages, checkout, and as the default icon for experiences using this app.

+ */ + _FinalStage icon(Optional icon); + + _FinalStage icon(ExperienceAppIcon icon); + + _FinalStage icon(Nullable icon); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + private Optional icon = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ExperienceApp other) { + icon(other.getIcon()); + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

The unique identifier for the app.

+ *

The unique identifier for the app.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of this app shown on the app store and in experience navigation. Maximum 30 characters.

+ *

The display name of this app shown on the app store and in experience navigation. Maximum 30 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The icon image for this app, displayed on the app store, product pages, checkout, and as the default icon for experiences using this app.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage icon(Nullable icon) { + if (icon.isNull()) { + this.icon = null; + } else if (icon.isEmpty()) { + this.icon = Optional.empty(); + } else { + this.icon = Optional.of(icon.get()); + } + return this; + } + + /** + *

The icon image for this app, displayed on the app store, product pages, checkout, and as the default icon for experiences using this app.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage icon(ExperienceAppIcon icon) { + this.icon = Optional.ofNullable(icon); + return this; + } + + /** + *

The icon image for this app, displayed on the app store, product pages, checkout, and as the default icon for experiences using this app.

+ */ + @java.lang.Override + @JsonSetter(value = "icon", nulls = Nulls.SKIP) + public _FinalStage icon(Optional icon) { + this.icon = icon; + return this; + } + + @java.lang.Override + public ExperienceApp build() { + return new ExperienceApp(icon, id, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ExperienceAppIcon.java b/src/main/java/com/whop/api/types/ExperienceAppIcon.java new file mode 100644 index 00000000..66024a61 --- /dev/null +++ b/src/main/java/com/whop/api/types/ExperienceAppIcon.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExperienceAppIcon.Builder.class) +public final class ExperienceAppIcon { + private final Optional url; + + private final Map additionalProperties; + + private ExperienceAppIcon(Optional url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExperienceAppIcon && equalTo((ExperienceAppIcon) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExperienceAppIcon other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ExperienceAppIcon other) { + url(other.getUrl()); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public Builder url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + public ExperienceAppIcon build() { + return new ExperienceAppIcon(url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ExperienceCompany.java b/src/main/java/com/whop/api/types/ExperienceCompany.java new file mode 100644 index 00000000..a6ffd756 --- /dev/null +++ b/src/main/java/com/whop/api/types/ExperienceCompany.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExperienceCompany.Builder.class) +public final class ExperienceCompany { + private final String id; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private ExperienceCompany(String id, String route, String title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExperienceCompany && equalTo((ExperienceCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExperienceCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + RouteStage id(@NotNull String id); + + Builder from(ExperienceCompany other); + } + + public interface RouteStage { + /** + *

URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + ExperienceCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ExperienceCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe.

+ *

URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public ExperienceCompany build() { + return new ExperienceCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ExperienceImage.java b/src/main/java/com/whop/api/types/ExperienceImage.java new file mode 100644 index 00000000..c4dcc30b --- /dev/null +++ b/src/main/java/com/whop/api/types/ExperienceImage.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExperienceImage.Builder.class) +public final class ExperienceImage { + private final Optional url; + + private final Map additionalProperties; + + private ExperienceImage(Optional url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExperienceImage && equalTo((ExperienceImage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExperienceImage other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ExperienceImage other) { + url(other.getUrl()); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public Builder url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + public ExperienceImage build() { + return new ExperienceImage(url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ExperienceListItem.java b/src/main/java/com/whop/api/types/ExperienceListItem.java new file mode 100644 index 00000000..b03466aa --- /dev/null +++ b/src/main/java/com/whop/api/types/ExperienceListItem.java @@ -0,0 +1,455 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExperienceListItem.Builder.class) +public final class ExperienceListItem { + private final ExperienceListItemApp app; + + private final ExperienceListItemCompany company; + + private final OffsetDateTime createdAt; + + private final String id; + + private final Optional image; + + private final boolean isPublic; + + private final String name; + + private final Optional order; + + private final Map additionalProperties; + + private ExperienceListItem( + ExperienceListItemApp app, + ExperienceListItemCompany company, + OffsetDateTime createdAt, + String id, + Optional image, + boolean isPublic, + String name, + Optional order, + Map additionalProperties) { + this.app = app; + this.company = company; + this.createdAt = createdAt; + this.id = id; + this.image = image; + this.isPublic = isPublic; + this.name = name; + this.order = order; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app that powers this experience, defining its interface and behavior. + */ + @JsonProperty("app") + public ExperienceListItemApp getApp() { + return app; + } + + /** + * @return The company that owns this experience. + */ + @JsonProperty("company") + public ExperienceListItemCompany getCompany() { + return company; + } + + /** + * @return The datetime the experience was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the experience. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The custom logo image for this experience. Null if no custom logo has been uploaded. + */ + @JsonIgnore + public Optional getImage() { + if (image == null) { + return Optional.empty(); + } + return image; + } + + /** + * @return Whether this experience is publicly visible to all users, including those without a membership. + */ + @JsonProperty("is_public") + public boolean getIsPublic() { + return isPublic; + } + + /** + * @return The display name of this experience shown to users in the product navigation. Maximum 255 characters. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The sort position of this experience within its section. Lower values appear first. Null if no position has been set. + */ + @JsonIgnore + public Optional getOrder() { + if (order == null) { + return Optional.empty(); + } + return order; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("image") + private Optional _getImage() { + return image; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("order") + private Optional _getOrder() { + return order; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExperienceListItem && equalTo((ExperienceListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExperienceListItem other) { + return app.equals(other.app) + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && image.equals(other.image) + && isPublic == other.isPublic + && name.equals(other.name) + && order.equals(other.order); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.app, this.company, this.createdAt, this.id, this.image, this.isPublic, this.name, this.order); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppStage builder() { + return new Builder(); + } + + public interface AppStage { + /** + *

The app that powers this experience, defining its interface and behavior.

+ */ + CompanyStage app(@NotNull ExperienceListItemApp app); + + Builder from(ExperienceListItem other); + } + + public interface CompanyStage { + /** + *

The company that owns this experience.

+ */ + CreatedAtStage company(@NotNull ExperienceListItemCompany company); + } + + public interface CreatedAtStage { + /** + *

The datetime the experience was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the experience.

+ */ + IsPublicStage id(@NotNull String id); + } + + public interface IsPublicStage { + /** + *

Whether this experience is publicly visible to all users, including those without a membership.

+ */ + NameStage isPublic(boolean isPublic); + } + + public interface NameStage { + /** + *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + ExperienceListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The custom logo image for this experience. Null if no custom logo has been uploaded.

+ */ + _FinalStage image(Optional image); + + _FinalStage image(ExperienceListItemImage image); + + _FinalStage image(Nullable image); + + /** + *

The sort position of this experience within its section. Lower values appear first. Null if no position has been set.

+ */ + _FinalStage order(Optional order); + + _FinalStage order(String order); + + _FinalStage order(Nullable order); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AppStage, CompanyStage, CreatedAtStage, IdStage, IsPublicStage, NameStage, _FinalStage { + private ExperienceListItemApp app; + + private ExperienceListItemCompany company; + + private OffsetDateTime createdAt; + + private String id; + + private boolean isPublic; + + private String name; + + private Optional order = Optional.empty(); + + private Optional image = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ExperienceListItem other) { + app(other.getApp()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + id(other.getId()); + image(other.getImage()); + isPublic(other.getIsPublic()); + name(other.getName()); + order(other.getOrder()); + return this; + } + + /** + *

The app that powers this experience, defining its interface and behavior.

+ *

The app that powers this experience, defining its interface and behavior.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("app") + public CompanyStage app(@NotNull ExperienceListItemApp app) { + this.app = Objects.requireNonNull(app, "app must not be null"); + return this; + } + + /** + *

The company that owns this experience.

+ *

The company that owns this experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company") + public CreatedAtStage company(@NotNull ExperienceListItemCompany company) { + this.company = Objects.requireNonNull(company, "company must not be null"); + return this; + } + + /** + *

The datetime the experience was created.

+ *

The datetime the experience was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the experience.

+ *

The unique identifier for the experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsPublicStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether this experience is publicly visible to all users, including those without a membership.

+ *

Whether this experience is publicly visible to all users, including those without a membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_public") + public NameStage isPublic(boolean isPublic) { + this.isPublic = isPublic; + return this; + } + + /** + *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The sort position of this experience within its section. Lower values appear first. Null if no position has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(Nullable order) { + if (order.isNull()) { + this.order = null; + } else if (order.isEmpty()) { + this.order = Optional.empty(); + } else { + this.order = Optional.of(order.get()); + } + return this; + } + + /** + *

The sort position of this experience within its section. Lower values appear first. Null if no position has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage order(String order) { + this.order = Optional.ofNullable(order); + return this; + } + + /** + *

The sort position of this experience within its section. Lower values appear first. Null if no position has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; + return this; + } + + /** + *

The custom logo image for this experience. Null if no custom logo has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage image(Nullable image) { + if (image.isNull()) { + this.image = null; + } else if (image.isEmpty()) { + this.image = Optional.empty(); + } else { + this.image = Optional.of(image.get()); + } + return this; + } + + /** + *

The custom logo image for this experience. Null if no custom logo has been uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage image(ExperienceListItemImage image) { + this.image = Optional.ofNullable(image); + return this; + } + + /** + *

The custom logo image for this experience. Null if no custom logo has been uploaded.

+ */ + @java.lang.Override + @JsonSetter(value = "image", nulls = Nulls.SKIP) + public _FinalStage image(Optional image) { + this.image = image; + return this; + } + + @java.lang.Override + public ExperienceListItem build() { + return new ExperienceListItem( + app, company, createdAt, id, image, isPublic, name, order, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ExperienceListItemApp.java b/src/main/java/com/whop/api/types/ExperienceListItemApp.java new file mode 100644 index 00000000..ad0f97ab --- /dev/null +++ b/src/main/java/com/whop/api/types/ExperienceListItemApp.java @@ -0,0 +1,239 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExperienceListItemApp.Builder.class) +public final class ExperienceListItemApp { + private final Optional icon; + + private final String id; + + private final String name; + + private final Map additionalProperties; + + private ExperienceListItemApp( + Optional icon, + String id, + String name, + Map additionalProperties) { + this.icon = icon; + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The icon image for this app, displayed on the app store, product pages, checkout, and as the default icon for experiences using this app. + */ + @JsonIgnore + public Optional getIcon() { + if (icon == null) { + return Optional.empty(); + } + return icon; + } + + /** + * @return The unique identifier for the app. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of this app shown on the app store and in experience navigation. Maximum 30 characters. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon") + private Optional _getIcon() { + return icon; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExperienceListItemApp && equalTo((ExperienceListItemApp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExperienceListItemApp other) { + return icon.equals(other.icon) && id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.icon, this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the app.

+ */ + NameStage id(@NotNull String id); + + Builder from(ExperienceListItemApp other); + } + + public interface NameStage { + /** + *

The display name of this app shown on the app store and in experience navigation. Maximum 30 characters.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + ExperienceListItemApp build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The icon image for this app, displayed on the app store, product pages, checkout, and as the default icon for experiences using this app.

+ */ + _FinalStage icon(Optional icon); + + _FinalStage icon(ExperienceListItemAppIcon icon); + + _FinalStage icon(Nullable icon); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + private Optional icon = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ExperienceListItemApp other) { + icon(other.getIcon()); + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

The unique identifier for the app.

+ *

The unique identifier for the app.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of this app shown on the app store and in experience navigation. Maximum 30 characters.

+ *

The display name of this app shown on the app store and in experience navigation. Maximum 30 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The icon image for this app, displayed on the app store, product pages, checkout, and as the default icon for experiences using this app.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage icon(Nullable icon) { + if (icon.isNull()) { + this.icon = null; + } else if (icon.isEmpty()) { + this.icon = Optional.empty(); + } else { + this.icon = Optional.of(icon.get()); + } + return this; + } + + /** + *

The icon image for this app, displayed on the app store, product pages, checkout, and as the default icon for experiences using this app.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage icon(ExperienceListItemAppIcon icon) { + this.icon = Optional.ofNullable(icon); + return this; + } + + /** + *

The icon image for this app, displayed on the app store, product pages, checkout, and as the default icon for experiences using this app.

+ */ + @java.lang.Override + @JsonSetter(value = "icon", nulls = Nulls.SKIP) + public _FinalStage icon(Optional icon) { + this.icon = icon; + return this; + } + + @java.lang.Override + public ExperienceListItemApp build() { + return new ExperienceListItemApp(icon, id, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ExperienceListItemAppIcon.java b/src/main/java/com/whop/api/types/ExperienceListItemAppIcon.java new file mode 100644 index 00000000..cd2f2f02 --- /dev/null +++ b/src/main/java/com/whop/api/types/ExperienceListItemAppIcon.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExperienceListItemAppIcon.Builder.class) +public final class ExperienceListItemAppIcon { + private final Optional url; + + private final Map additionalProperties; + + private ExperienceListItemAppIcon(Optional url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExperienceListItemAppIcon && equalTo((ExperienceListItemAppIcon) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExperienceListItemAppIcon other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ExperienceListItemAppIcon other) { + url(other.getUrl()); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public Builder url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + public ExperienceListItemAppIcon build() { + return new ExperienceListItemAppIcon(url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ExperienceListItemCompany.java b/src/main/java/com/whop/api/types/ExperienceListItemCompany.java new file mode 100644 index 00000000..26311fd7 --- /dev/null +++ b/src/main/java/com/whop/api/types/ExperienceListItemCompany.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExperienceListItemCompany.Builder.class) +public final class ExperienceListItemCompany { + private final String id; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private ExperienceListItemCompany(String id, String route, String title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExperienceListItemCompany && equalTo((ExperienceListItemCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExperienceListItemCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + RouteStage id(@NotNull String id); + + Builder from(ExperienceListItemCompany other); + } + + public interface RouteStage { + /** + *

URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + ExperienceListItemCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ExperienceListItemCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe.

+ *

URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public ExperienceListItemCompany build() { + return new ExperienceListItemCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ExperienceListItemImage.java b/src/main/java/com/whop/api/types/ExperienceListItemImage.java new file mode 100644 index 00000000..0b487f44 --- /dev/null +++ b/src/main/java/com/whop/api/types/ExperienceListItemImage.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExperienceListItemImage.Builder.class) +public final class ExperienceListItemImage { + private final Optional url; + + private final Map additionalProperties; + + private ExperienceListItemImage(Optional url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExperienceListItemImage && equalTo((ExperienceListItemImage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExperienceListItemImage other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ExperienceListItemImage other) { + url(other.getUrl()); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public Builder url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + public ExperienceListItemImage build() { + return new ExperienceListItemImage(url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ExperienceNotificationPreference.java b/src/main/java/com/whop/api/types/ExperienceNotificationPreference.java new file mode 100644 index 00000000..f454bb7d --- /dev/null +++ b/src/main/java/com/whop/api/types/ExperienceNotificationPreference.java @@ -0,0 +1,199 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExperienceNotificationPreference.Builder.class) +public final class ExperienceNotificationPreference { + private final ExperienceNotificationPreferenceLevel level; + + private final ExperienceNotificationPreferenceObject object; + + private final NotificationPreferenceScope scope; + + private final Map additionalProperties; + + private ExperienceNotificationPreference( + ExperienceNotificationPreferenceLevel level, + ExperienceNotificationPreferenceObject object, + NotificationPreferenceScope scope, + Map additionalProperties) { + this.level = level; + this.object = object; + this.scope = scope; + this.additionalProperties = additionalProperties; + } + + /** + * @return What the user is notified about in the experience: all notifications, only mentions, or nothing. + */ + @JsonProperty("level") + public ExperienceNotificationPreferenceLevel getLevel() { + return level; + } + + /** + * @return The type of object. Always experience_notification_preference. + */ + @JsonProperty("object") + public ExperienceNotificationPreferenceObject getObject() { + return object; + } + + /** + * @return What the preference applies to. Echo it back to PATCH /users/me/preferences/notifications to change this preference. + */ + @JsonProperty("scope") + public NotificationPreferenceScope getScope() { + return scope; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExperienceNotificationPreference && equalTo((ExperienceNotificationPreference) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExperienceNotificationPreference other) { + return level.equals(other.level) && object.equals(other.object) && scope.equals(other.scope); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.level, this.object, this.scope); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LevelStage builder() { + return new Builder(); + } + + public interface LevelStage { + /** + *

What the user is notified about in the experience: all notifications, only mentions, or nothing.

+ */ + ObjectStage level(@NotNull ExperienceNotificationPreferenceLevel level); + + Builder from(ExperienceNotificationPreference other); + } + + public interface ObjectStage { + /** + *

The type of object. Always experience_notification_preference.

+ */ + ScopeStage object(@NotNull ExperienceNotificationPreferenceObject object); + } + + public interface ScopeStage { + /** + *

What the preference applies to. Echo it back to PATCH /users/me/preferences/notifications to change this preference.

+ */ + _FinalStage scope(@NotNull NotificationPreferenceScope scope); + } + + public interface _FinalStage { + ExperienceNotificationPreference build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LevelStage, ObjectStage, ScopeStage, _FinalStage { + private ExperienceNotificationPreferenceLevel level; + + private ExperienceNotificationPreferenceObject object; + + private NotificationPreferenceScope scope; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ExperienceNotificationPreference other) { + level(other.getLevel()); + object(other.getObject()); + scope(other.getScope()); + return this; + } + + /** + *

What the user is notified about in the experience: all notifications, only mentions, or nothing.

+ *

What the user is notified about in the experience: all notifications, only mentions, or nothing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("level") + public ObjectStage level(@NotNull ExperienceNotificationPreferenceLevel level) { + this.level = Objects.requireNonNull(level, "level must not be null"); + return this; + } + + /** + *

The type of object. Always experience_notification_preference.

+ *

The type of object. Always experience_notification_preference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("object") + public ScopeStage object(@NotNull ExperienceNotificationPreferenceObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

What the preference applies to. Echo it back to PATCH /users/me/preferences/notifications to change this preference.

+ *

What the preference applies to. Echo it back to PATCH /users/me/preferences/notifications to change this preference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("scope") + public _FinalStage scope(@NotNull NotificationPreferenceScope scope) { + this.scope = Objects.requireNonNull(scope, "scope must not be null"); + return this; + } + + @java.lang.Override + public ExperienceNotificationPreference build() { + return new ExperienceNotificationPreference(level, object, scope, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ExperienceNotificationPreferenceLevel.java b/src/main/java/com/whop/api/types/ExperienceNotificationPreferenceLevel.java new file mode 100644 index 00000000..d31642bb --- /dev/null +++ b/src/main/java/com/whop/api/types/ExperienceNotificationPreferenceLevel.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ExperienceNotificationPreferenceLevel { + public static final ExperienceNotificationPreferenceLevel ALL = + new ExperienceNotificationPreferenceLevel(Value.ALL, "all"); + + public static final ExperienceNotificationPreferenceLevel NOTHING = + new ExperienceNotificationPreferenceLevel(Value.NOTHING, "nothing"); + + public static final ExperienceNotificationPreferenceLevel MENTIONS = + new ExperienceNotificationPreferenceLevel(Value.MENTIONS, "mentions"); + + private final Value value; + + private final String string; + + ExperienceNotificationPreferenceLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ExperienceNotificationPreferenceLevel + && this.string.equals(((ExperienceNotificationPreferenceLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ALL: + return visitor.visitAll(); + case NOTHING: + return visitor.visitNothing(); + case MENTIONS: + return visitor.visitMentions(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ExperienceNotificationPreferenceLevel valueOf(String value) { + switch (value) { + case "all": + return ALL; + case "nothing": + return NOTHING; + case "mentions": + return MENTIONS; + default: + return new ExperienceNotificationPreferenceLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL, + + MENTIONS, + + NOTHING, + + UNKNOWN + } + + public interface Visitor { + T visitAll(); + + T visitMentions(); + + T visitNothing(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ExperienceNotificationPreferenceObject.java b/src/main/java/com/whop/api/types/ExperienceNotificationPreferenceObject.java new file mode 100644 index 00000000..5e08cfe4 --- /dev/null +++ b/src/main/java/com/whop/api/types/ExperienceNotificationPreferenceObject.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ExperienceNotificationPreferenceObject { + public static final ExperienceNotificationPreferenceObject EXPERIENCE_NOTIFICATION_PREFERENCE = + new ExperienceNotificationPreferenceObject( + Value.EXPERIENCE_NOTIFICATION_PREFERENCE, "experience_notification_preference"); + + private final Value value; + + private final String string; + + ExperienceNotificationPreferenceObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ExperienceNotificationPreferenceObject + && this.string.equals(((ExperienceNotificationPreferenceObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EXPERIENCE_NOTIFICATION_PREFERENCE: + return visitor.visitExperienceNotificationPreference(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ExperienceNotificationPreferenceObject valueOf(String value) { + switch (value) { + case "experience_notification_preference": + return EXPERIENCE_NOTIFICATION_PREFERENCE; + default: + return new ExperienceNotificationPreferenceObject(Value.UNKNOWN, value); + } + } + + public enum Value { + EXPERIENCE_NOTIFICATION_PREFERENCE, + + UNKNOWN + } + + public interface Visitor { + T visitExperienceNotificationPreference(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ExperienceProductsItem.java b/src/main/java/com/whop/api/types/ExperienceProductsItem.java new file mode 100644 index 00000000..107dd5a1 --- /dev/null +++ b/src/main/java/com/whop/api/types/ExperienceProductsItem.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExperienceProductsItem.Builder.class) +public final class ExperienceProductsItem { + private final String id; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private ExperienceProductsItem(String id, String route, String title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the product. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return URL slug in the product's public link, e.g. pickaxe-analytics in whop.com/company/pickaxe-analytics. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return The display name of the product shown to customers on the product page and in search results. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExperienceProductsItem && equalTo((ExperienceProductsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExperienceProductsItem other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the product.

+ */ + RouteStage id(@NotNull String id); + + Builder from(ExperienceProductsItem other); + } + + public interface RouteStage { + /** + *

URL slug in the product's public link, e.g. pickaxe-analytics in whop.com/company/pickaxe-analytics.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

The display name of the product shown to customers on the product page and in search results.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + ExperienceProductsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ExperienceProductsItem other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the product.

+ *

The unique identifier for the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

URL slug in the product's public link, e.g. pickaxe-analytics in whop.com/company/pickaxe-analytics.

+ *

URL slug in the product's public link, e.g. pickaxe-analytics in whop.com/company/pickaxe-analytics.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

The display name of the product shown to customers on the product page and in search results.

+ *

The display name of the product shown to customers on the product page and in search results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public ExperienceProductsItem build() { + return new ExperienceProductsItem(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Export.java b/src/main/java/com/whop/api/types/Export.java new file mode 100644 index 00000000..d8577cb9 --- /dev/null +++ b/src/main/java/com/whop/api/types/Export.java @@ -0,0 +1,475 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Export.Builder.class) +public final class Export { + private final String createdAt; + + private final Optional downloadUrl; + + private final String expiresAt; + + private final String id; + + private final Optional progressPercent; + + private final ExportResource resource; + + private final ExportStatus status; + + private final String updatedAt; + + private final Map additionalProperties; + + private Export( + String createdAt, + Optional downloadUrl, + String expiresAt, + String id, + Optional progressPercent, + ExportResource resource, + ExportStatus status, + String updatedAt, + Map additionalProperties) { + this.createdAt = createdAt; + this.downloadUrl = downloadUrl; + this.expiresAt = expiresAt; + this.id = id; + this.progressPercent = progressPercent; + this.resource = resource; + this.status = status; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the export was requested, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return A short-lived link to download the finished CSV. null until status is completed, and again once the export has expired. + */ + @JsonIgnore + public Optional getDownloadUrl() { + if (downloadUrl == null) { + return Optional.empty(); + } + return downloadUrl; + } + + /** + * @return When the CSV is deleted and the export moves to expired, as an ISO 8601 timestamp. Exports are retained for 30 days. + */ + @JsonProperty("expires_at") + public String getExpiresAt() { + return expiresAt; + } + + /** + * @return Export ID, prefixed exprt_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Estimated completion percentage from 0 to 100. + */ + @JsonIgnore + public Optional getProgressPercent() { + if (progressPercent == null) { + return Optional.empty(); + } + return progressPercent; + } + + /** + * @return The resource that was exported, e.g. receipts, members, or payouts. + */ + @JsonProperty("resource") + public ExportResource getResource() { + return resource; + } + + /** + * @return pending or processing while the CSV is generated, completed when the download is ready, failed if it errored, expired once the CSV has been deleted. + */ + @JsonProperty("status") + public ExportStatus getStatus() { + return status; + } + + /** + * @return When the export last changed, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("download_url") + private Optional _getDownloadUrl() { + return downloadUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("progress_percent") + private Optional _getProgressPercent() { + return progressPercent; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Export && equalTo((Export) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Export other) { + return createdAt.equals(other.createdAt) + && downloadUrl.equals(other.downloadUrl) + && expiresAt.equals(other.expiresAt) + && id.equals(other.id) + && progressPercent.equals(other.progressPercent) + && resource.equals(other.resource) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, + this.downloadUrl, + this.expiresAt, + this.id, + this.progressPercent, + this.resource, + this.status, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the export was requested, as an ISO 8601 timestamp.

+ */ + ExpiresAtStage createdAt(@NotNull String createdAt); + + Builder from(Export other); + } + + public interface ExpiresAtStage { + /** + *

When the CSV is deleted and the export moves to expired, as an ISO 8601 timestamp. Exports are retained for 30 days.

+ */ + IdStage expiresAt(@NotNull String expiresAt); + } + + public interface IdStage { + /** + *

Export ID, prefixed exprt_.

+ */ + ResourceStage id(@NotNull String id); + } + + public interface ResourceStage { + /** + *

The resource that was exported, e.g. receipts, members, or payouts.

+ */ + StatusStage resource(@NotNull ExportResource resource); + } + + public interface StatusStage { + /** + *

pending or processing while the CSV is generated, completed when the download is ready, failed if it errored, expired once the CSV has been deleted.

+ */ + UpdatedAtStage status(@NotNull ExportStatus status); + } + + public interface UpdatedAtStage { + /** + *

When the export last changed, as an ISO 8601 timestamp.

+ */ + _FinalStage updatedAt(@NotNull String updatedAt); + } + + public interface _FinalStage { + Export build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A short-lived link to download the finished CSV. null until status is completed, and again once the export has expired.

+ */ + _FinalStage downloadUrl(Optional downloadUrl); + + _FinalStage downloadUrl(String downloadUrl); + + _FinalStage downloadUrl(Nullable downloadUrl); + + /** + *

Estimated completion percentage from 0 to 100.

+ */ + _FinalStage progressPercent(Optional progressPercent); + + _FinalStage progressPercent(Integer progressPercent); + + _FinalStage progressPercent(Nullable progressPercent); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + ExpiresAtStage, + IdStage, + ResourceStage, + StatusStage, + UpdatedAtStage, + _FinalStage { + private String createdAt; + + private String expiresAt; + + private String id; + + private ExportResource resource; + + private ExportStatus status; + + private String updatedAt; + + private Optional progressPercent = Optional.empty(); + + private Optional downloadUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Export other) { + createdAt(other.getCreatedAt()); + downloadUrl(other.getDownloadUrl()); + expiresAt(other.getExpiresAt()); + id(other.getId()); + progressPercent(other.getProgressPercent()); + resource(other.getResource()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

When the export was requested, as an ISO 8601 timestamp.

+ *

When the export was requested, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public ExpiresAtStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

When the CSV is deleted and the export moves to expired, as an ISO 8601 timestamp. Exports are retained for 30 days.

+ *

When the CSV is deleted and the export moves to expired, as an ISO 8601 timestamp. Exports are retained for 30 days.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("expires_at") + public IdStage expiresAt(@NotNull String expiresAt) { + this.expiresAt = Objects.requireNonNull(expiresAt, "expiresAt must not be null"); + return this; + } + + /** + *

Export ID, prefixed exprt_.

+ *

Export ID, prefixed exprt_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ResourceStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The resource that was exported, e.g. receipts, members, or payouts.

+ *

The resource that was exported, e.g. receipts, members, or payouts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource") + public StatusStage resource(@NotNull ExportResource resource) { + this.resource = Objects.requireNonNull(resource, "resource must not be null"); + return this; + } + + /** + *

pending or processing while the CSV is generated, completed when the download is ready, failed if it errored, expired once the CSV has been deleted.

+ *

pending or processing while the CSV is generated, completed when the download is ready, failed if it errored, expired once the CSV has been deleted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull ExportStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

When the export last changed, as an ISO 8601 timestamp.

+ *

When the export last changed, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

Estimated completion percentage from 0 to 100.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage progressPercent(Nullable progressPercent) { + if (progressPercent.isNull()) { + this.progressPercent = null; + } else if (progressPercent.isEmpty()) { + this.progressPercent = Optional.empty(); + } else { + this.progressPercent = Optional.of(progressPercent.get()); + } + return this; + } + + /** + *

Estimated completion percentage from 0 to 100.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage progressPercent(Integer progressPercent) { + this.progressPercent = Optional.ofNullable(progressPercent); + return this; + } + + /** + *

Estimated completion percentage from 0 to 100.

+ */ + @java.lang.Override + @JsonSetter(value = "progress_percent", nulls = Nulls.SKIP) + public _FinalStage progressPercent(Optional progressPercent) { + this.progressPercent = progressPercent; + return this; + } + + /** + *

A short-lived link to download the finished CSV. null until status is completed, and again once the export has expired.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage downloadUrl(Nullable downloadUrl) { + if (downloadUrl.isNull()) { + this.downloadUrl = null; + } else if (downloadUrl.isEmpty()) { + this.downloadUrl = Optional.empty(); + } else { + this.downloadUrl = Optional.of(downloadUrl.get()); + } + return this; + } + + /** + *

A short-lived link to download the finished CSV. null until status is completed, and again once the export has expired.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage downloadUrl(String downloadUrl) { + this.downloadUrl = Optional.ofNullable(downloadUrl); + return this; + } + + /** + *

A short-lived link to download the finished CSV. null until status is completed, and again once the export has expired.

+ */ + @java.lang.Override + @JsonSetter(value = "download_url", nulls = Nulls.SKIP) + public _FinalStage downloadUrl(Optional downloadUrl) { + this.downloadUrl = downloadUrl; + return this; + } + + @java.lang.Override + public Export build() { + return new Export( + createdAt, + downloadUrl, + expiresAt, + id, + progressPercent, + resource, + status, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ExportResource.java b/src/main/java/com/whop/api/types/ExportResource.java new file mode 100644 index 00000000..be48ffec --- /dev/null +++ b/src/main/java/com/whop/api/types/ExportResource.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ExportResource { + public static final ExportResource RECEIPTS = new ExportResource(Value.RECEIPTS, "receipts"); + + public static final ExportResource AD_GROUPS = new ExportResource(Value.AD_GROUPS, "ad_groups"); + + public static final ExportResource MEMBERS = new ExportResource(Value.MEMBERS, "members"); + + public static final ExportResource PEOPLE = new ExportResource(Value.PEOPLE, "people"); + + public static final ExportResource TEAM_MEMBERS = new ExportResource(Value.TEAM_MEMBERS, "team_members"); + + public static final ExportResource PROMO_CODES = new ExportResource(Value.PROMO_CODES, "promo_codes"); + + public static final ExportResource CARD_TRANSACTIONS = + new ExportResource(Value.CARD_TRANSACTIONS, "card_transactions"); + + public static final ExportResource PAYOUTS = new ExportResource(Value.PAYOUTS, "payouts"); + + public static final ExportResource FINANCIAL_ACTIVITY = + new ExportResource(Value.FINANCIAL_ACTIVITY, "financial-activity"); + + public static final ExportResource CONTENT_REWARDS_SUBMISSIONS = + new ExportResource(Value.CONTENT_REWARDS_SUBMISSIONS, "content_rewards_submissions"); + + public static final ExportResource LEADS = new ExportResource(Value.LEADS, "leads"); + + public static final ExportResource TRACKING_LINKS = new ExportResource(Value.TRACKING_LINKS, "tracking_links"); + + public static final ExportResource LEDGER_LINES = new ExportResource(Value.LEDGER_LINES, "ledger_lines"); + + public static final ExportResource AUDIENCES = new ExportResource(Value.AUDIENCES, "audiences"); + + public static final ExportResource BOUNTY_SUBMISSIONS = + new ExportResource(Value.BOUNTY_SUBMISSIONS, "bounty_submissions"); + + public static final ExportResource SHIPMENTS = new ExportResource(Value.SHIPMENTS, "shipments"); + + public static final ExportResource ENTRIES = new ExportResource(Value.ENTRIES, "entries"); + + public static final ExportResource MEMBERSHIPS = new ExportResource(Value.MEMBERSHIPS, "memberships"); + + public static final ExportResource TRANSFERS = new ExportResource(Value.TRANSFERS, "transfers"); + + public static final ExportResource CHILD_COMPANIES = new ExportResource(Value.CHILD_COMPANIES, "child_companies"); + + public static final ExportResource WITHDRAWAL_LINES = + new ExportResource(Value.WITHDRAWAL_LINES, "withdrawal_lines"); + + public static final ExportResource CHECKOUT_CONFIGURATIONS = + new ExportResource(Value.CHECKOUT_CONFIGURATIONS, "checkout_configurations"); + + public static final ExportResource PAYOUT_METHODS = new ExportResource(Value.PAYOUT_METHODS, "payout_methods"); + + public static final ExportResource CANCELATION_REASONS = + new ExportResource(Value.CANCELATION_REASONS, "cancelation_reasons"); + + public static final ExportResource BOUNTIES = new ExportResource(Value.BOUNTIES, "bounties"); + + public static final ExportResource UNCLAIMED_MEMBERSHIPS = + new ExportResource(Value.UNCLAIMED_MEMBERSHIPS, "unclaimed_memberships"); + + public static final ExportResource INVOICES = new ExportResource(Value.INVOICES, "invoices"); + + public static final ExportResource DISPUTES = new ExportResource(Value.DISPUTES, "disputes"); + + public static final ExportResource WEBHOOKS = new ExportResource(Value.WEBHOOKS, "webhooks"); + + public static final ExportResource RESOLUTION_CENTER_CASES = + new ExportResource(Value.RESOLUTION_CENTER_CASES, "resolution_center_cases"); + + public static final ExportResource PLANS = new ExportResource(Value.PLANS, "plans"); + + public static final ExportResource RESOLUTIONS = new ExportResource(Value.RESOLUTIONS, "resolutions"); + + public static final ExportResource PRODUCTS = new ExportResource(Value.PRODUCTS, "products"); + + public static final ExportResource EVENTS = new ExportResource(Value.EVENTS, "events"); + + public static final ExportResource APPS = new ExportResource(Value.APPS, "apps"); + + public static final ExportResource SOCIAL_ACCOUNTS = new ExportResource(Value.SOCIAL_ACCOUNTS, "social_accounts"); + + public static final ExportResource ADS = new ExportResource(Value.ADS, "ads"); + + public static final ExportResource AD_CAMPAIGNS = new ExportResource(Value.AD_CAMPAIGNS, "ad_campaigns"); + + private final Value value; + + private final String string; + + ExportResource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ExportResource && this.string.equals(((ExportResource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RECEIPTS: + return visitor.visitReceipts(); + case AD_GROUPS: + return visitor.visitAdGroups(); + case MEMBERS: + return visitor.visitMembers(); + case PEOPLE: + return visitor.visitPeople(); + case TEAM_MEMBERS: + return visitor.visitTeamMembers(); + case PROMO_CODES: + return visitor.visitPromoCodes(); + case CARD_TRANSACTIONS: + return visitor.visitCardTransactions(); + case PAYOUTS: + return visitor.visitPayouts(); + case FINANCIAL_ACTIVITY: + return visitor.visitFinancialActivity(); + case CONTENT_REWARDS_SUBMISSIONS: + return visitor.visitContentRewardsSubmissions(); + case LEADS: + return visitor.visitLeads(); + case TRACKING_LINKS: + return visitor.visitTrackingLinks(); + case LEDGER_LINES: + return visitor.visitLedgerLines(); + case AUDIENCES: + return visitor.visitAudiences(); + case BOUNTY_SUBMISSIONS: + return visitor.visitBountySubmissions(); + case SHIPMENTS: + return visitor.visitShipments(); + case ENTRIES: + return visitor.visitEntries(); + case MEMBERSHIPS: + return visitor.visitMemberships(); + case TRANSFERS: + return visitor.visitTransfers(); + case CHILD_COMPANIES: + return visitor.visitChildCompanies(); + case WITHDRAWAL_LINES: + return visitor.visitWithdrawalLines(); + case CHECKOUT_CONFIGURATIONS: + return visitor.visitCheckoutConfigurations(); + case PAYOUT_METHODS: + return visitor.visitPayoutMethods(); + case CANCELATION_REASONS: + return visitor.visitCancelationReasons(); + case BOUNTIES: + return visitor.visitBounties(); + case UNCLAIMED_MEMBERSHIPS: + return visitor.visitUnclaimedMemberships(); + case INVOICES: + return visitor.visitInvoices(); + case DISPUTES: + return visitor.visitDisputes(); + case WEBHOOKS: + return visitor.visitWebhooks(); + case RESOLUTION_CENTER_CASES: + return visitor.visitResolutionCenterCases(); + case PLANS: + return visitor.visitPlans(); + case RESOLUTIONS: + return visitor.visitResolutions(); + case PRODUCTS: + return visitor.visitProducts(); + case EVENTS: + return visitor.visitEvents(); + case APPS: + return visitor.visitApps(); + case SOCIAL_ACCOUNTS: + return visitor.visitSocialAccounts(); + case ADS: + return visitor.visitAds(); + case AD_CAMPAIGNS: + return visitor.visitAdCampaigns(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ExportResource valueOf(String value) { + switch (value) { + case "receipts": + return RECEIPTS; + case "ad_groups": + return AD_GROUPS; + case "members": + return MEMBERS; + case "people": + return PEOPLE; + case "team_members": + return TEAM_MEMBERS; + case "promo_codes": + return PROMO_CODES; + case "card_transactions": + return CARD_TRANSACTIONS; + case "payouts": + return PAYOUTS; + case "financial-activity": + return FINANCIAL_ACTIVITY; + case "content_rewards_submissions": + return CONTENT_REWARDS_SUBMISSIONS; + case "leads": + return LEADS; + case "tracking_links": + return TRACKING_LINKS; + case "ledger_lines": + return LEDGER_LINES; + case "audiences": + return AUDIENCES; + case "bounty_submissions": + return BOUNTY_SUBMISSIONS; + case "shipments": + return SHIPMENTS; + case "entries": + return ENTRIES; + case "memberships": + return MEMBERSHIPS; + case "transfers": + return TRANSFERS; + case "child_companies": + return CHILD_COMPANIES; + case "withdrawal_lines": + return WITHDRAWAL_LINES; + case "checkout_configurations": + return CHECKOUT_CONFIGURATIONS; + case "payout_methods": + return PAYOUT_METHODS; + case "cancelation_reasons": + return CANCELATION_REASONS; + case "bounties": + return BOUNTIES; + case "unclaimed_memberships": + return UNCLAIMED_MEMBERSHIPS; + case "invoices": + return INVOICES; + case "disputes": + return DISPUTES; + case "webhooks": + return WEBHOOKS; + case "resolution_center_cases": + return RESOLUTION_CENTER_CASES; + case "plans": + return PLANS; + case "resolutions": + return RESOLUTIONS; + case "products": + return PRODUCTS; + case "events": + return EVENTS; + case "apps": + return APPS; + case "social_accounts": + return SOCIAL_ACCOUNTS; + case "ads": + return ADS; + case "ad_campaigns": + return AD_CAMPAIGNS; + default: + return new ExportResource(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_CAMPAIGNS, + + AD_GROUPS, + + ADS, + + APPS, + + AUDIENCES, + + BOUNTIES, + + BOUNTY_SUBMISSIONS, + + CARD_TRANSACTIONS, + + CHECKOUT_CONFIGURATIONS, + + DISPUTES, + + EVENTS, + + FINANCIAL_ACTIVITY, + + MEMBERS, + + MEMBERSHIPS, + + PAYOUT_METHODS, + + PAYOUTS, + + PEOPLE, + + PLANS, + + PRODUCTS, + + RESOLUTION_CENTER_CASES, + + SHIPMENTS, + + SOCIAL_ACCOUNTS, + + TEAM_MEMBERS, + + TRANSFERS, + + WEBHOOKS, + + RECEIPTS, + + UNCLAIMED_MEMBERSHIPS, + + TRACKING_LINKS, + + PROMO_CODES, + + RESOLUTIONS, + + ENTRIES, + + LEADS, + + CONTENT_REWARDS_SUBMISSIONS, + + INVOICES, + + CANCELATION_REASONS, + + CHILD_COMPANIES, + + LEDGER_LINES, + + WITHDRAWAL_LINES, + + UNKNOWN + } + + public interface Visitor { + T visitAdCampaigns(); + + T visitAdGroups(); + + T visitAds(); + + T visitApps(); + + T visitAudiences(); + + T visitBounties(); + + T visitBountySubmissions(); + + T visitCardTransactions(); + + T visitCheckoutConfigurations(); + + T visitDisputes(); + + T visitEvents(); + + T visitFinancialActivity(); + + T visitMembers(); + + T visitMemberships(); + + T visitPayoutMethods(); + + T visitPayouts(); + + T visitPeople(); + + T visitPlans(); + + T visitProducts(); + + T visitResolutionCenterCases(); + + T visitShipments(); + + T visitSocialAccounts(); + + T visitTeamMembers(); + + T visitTransfers(); + + T visitWebhooks(); + + T visitReceipts(); + + T visitUnclaimedMemberships(); + + T visitTrackingLinks(); + + T visitPromoCodes(); + + T visitResolutions(); + + T visitEntries(); + + T visitLeads(); + + T visitContentRewardsSubmissions(); + + T visitInvoices(); + + T visitCancelationReasons(); + + T visitChildCompanies(); + + T visitLedgerLines(); + + T visitWithdrawalLines(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ExportStatus.java b/src/main/java/com/whop/api/types/ExportStatus.java new file mode 100644 index 00000000..023feaca --- /dev/null +++ b/src/main/java/com/whop/api/types/ExportStatus.java @@ -0,0 +1,112 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ExportStatus { + public static final ExportStatus FAILED = new ExportStatus(Value.FAILED, "failed"); + + public static final ExportStatus PENDING = new ExportStatus(Value.PENDING, "pending"); + + public static final ExportStatus PROCESSING = new ExportStatus(Value.PROCESSING, "processing"); + + public static final ExportStatus COMPLETED = new ExportStatus(Value.COMPLETED, "completed"); + + public static final ExportStatus EXPIRED = new ExportStatus(Value.EXPIRED, "expired"); + + private final Value value; + + private final String string; + + ExportStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof ExportStatus && this.string.equals(((ExportStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case PENDING: + return visitor.visitPending(); + case PROCESSING: + return visitor.visitProcessing(); + case COMPLETED: + return visitor.visitCompleted(); + case EXPIRED: + return visitor.visitExpired(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ExportStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "pending": + return PENDING; + case "processing": + return PROCESSING; + case "completed": + return COMPLETED; + case "expired": + return EXPIRED; + default: + return new ExportStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + PROCESSING, + + COMPLETED, + + FAILED, + + EXPIRED, + + UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitProcessing(); + + T visitCompleted(); + + T visitFailed(); + + T visitExpired(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/FeeMarkup.java b/src/main/java/com/whop/api/types/FeeMarkup.java new file mode 100644 index 00000000..acecb5fc --- /dev/null +++ b/src/main/java/com/whop/api/types/FeeMarkup.java @@ -0,0 +1,460 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FeeMarkup.Builder.class) +public final class FeeMarkup { + private final OffsetDateTime createdAt; + + private final FeeMarkupTypes feeType; + + private final Optional fixedFeeUsd; + + private final String id; + + private final Optional notes; + + private final Optional percentageFee; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private FeeMarkup( + OffsetDateTime createdAt, + FeeMarkupTypes feeType, + Optional fixedFeeUsd, + String id, + Optional notes, + Optional percentageFee, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.createdAt = createdAt; + this.feeType = feeType; + this.fixedFeeUsd = fixedFeeUsd; + this.id = id; + this.notes = notes; + this.percentageFee = percentageFee; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The datetime the fee markup was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The category of fee this markup applies to. + */ + @JsonProperty("fee_type") + public FeeMarkupTypes getFeeType() { + return feeType; + } + + /** + * @return A flat fee charged per transaction, in USD. Ranges from 0 to 50. Null if no fixed fee is configured. + */ + @JsonIgnore + public Optional getFixedFeeUsd() { + if (fixedFeeUsd == null) { + return Optional.empty(); + } + return fixedFeeUsd; + } + + /** + * @return The unique identifier for the fee markup. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Internal notes about this fee markup, visible only to administrators. Null if no notes have been added. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + /** + * @return A percentage-based fee charged per transaction. Ranges from 0 to 25. Null if no percentage fee is configured. + */ + @JsonIgnore + public Optional getPercentageFee() { + if (percentageFee == null) { + return Optional.empty(); + } + return percentageFee; + } + + /** + * @return The datetime the fee markup was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fixed_fee_usd") + private Optional _getFixedFeeUsd() { + return fixedFeeUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("percentage_fee") + private Optional _getPercentageFee() { + return percentageFee; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FeeMarkup && equalTo((FeeMarkup) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FeeMarkup other) { + return createdAt.equals(other.createdAt) + && feeType.equals(other.feeType) + && fixedFeeUsd.equals(other.fixedFeeUsd) + && id.equals(other.id) + && notes.equals(other.notes) + && percentageFee.equals(other.percentageFee) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, + this.feeType, + this.fixedFeeUsd, + this.id, + this.notes, + this.percentageFee, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the fee markup was created.

+ */ + FeeTypeStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(FeeMarkup other); + } + + public interface FeeTypeStage { + /** + *

The category of fee this markup applies to.

+ */ + IdStage feeType(@NotNull FeeMarkupTypes feeType); + } + + public interface IdStage { + /** + *

The unique identifier for the fee markup.

+ */ + UpdatedAtStage id(@NotNull String id); + } + + public interface UpdatedAtStage { + /** + *

The datetime the fee markup was last updated.

+ */ + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + FeeMarkup build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A flat fee charged per transaction, in USD. Ranges from 0 to 50. Null if no fixed fee is configured.

+ */ + _FinalStage fixedFeeUsd(Optional fixedFeeUsd); + + _FinalStage fixedFeeUsd(Double fixedFeeUsd); + + _FinalStage fixedFeeUsd(Nullable fixedFeeUsd); + + /** + *

Internal notes about this fee markup, visible only to administrators. Null if no notes have been added.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + + /** + *

A percentage-based fee charged per transaction. Ranges from 0 to 25. Null if no percentage fee is configured.

+ */ + _FinalStage percentageFee(Optional percentageFee); + + _FinalStage percentageFee(Double percentageFee); + + _FinalStage percentageFee(Nullable percentageFee); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, FeeTypeStage, IdStage, UpdatedAtStage, _FinalStage { + private OffsetDateTime createdAt; + + private FeeMarkupTypes feeType; + + private String id; + + private OffsetDateTime updatedAt; + + private Optional percentageFee = Optional.empty(); + + private Optional notes = Optional.empty(); + + private Optional fixedFeeUsd = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FeeMarkup other) { + createdAt(other.getCreatedAt()); + feeType(other.getFeeType()); + fixedFeeUsd(other.getFixedFeeUsd()); + id(other.getId()); + notes(other.getNotes()); + percentageFee(other.getPercentageFee()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

The datetime the fee markup was created.

+ *

The datetime the fee markup was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public FeeTypeStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The category of fee this markup applies to.

+ *

The category of fee this markup applies to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_type") + public IdStage feeType(@NotNull FeeMarkupTypes feeType) { + this.feeType = Objects.requireNonNull(feeType, "feeType must not be null"); + return this; + } + + /** + *

The unique identifier for the fee markup.

+ *

The unique identifier for the fee markup.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UpdatedAtStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The datetime the fee markup was last updated.

+ *

The datetime the fee markup was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

A percentage-based fee charged per transaction. Ranges from 0 to 25. Null if no percentage fee is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage percentageFee(Nullable percentageFee) { + if (percentageFee.isNull()) { + this.percentageFee = null; + } else if (percentageFee.isEmpty()) { + this.percentageFee = Optional.empty(); + } else { + this.percentageFee = Optional.of(percentageFee.get()); + } + return this; + } + + /** + *

A percentage-based fee charged per transaction. Ranges from 0 to 25. Null if no percentage fee is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage percentageFee(Double percentageFee) { + this.percentageFee = Optional.ofNullable(percentageFee); + return this; + } + + /** + *

A percentage-based fee charged per transaction. Ranges from 0 to 25. Null if no percentage fee is configured.

+ */ + @java.lang.Override + @JsonSetter(value = "percentage_fee", nulls = Nulls.SKIP) + public _FinalStage percentageFee(Optional percentageFee) { + this.percentageFee = percentageFee; + return this; + } + + /** + *

Internal notes about this fee markup, visible only to administrators. Null if no notes have been added.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Internal notes about this fee markup, visible only to administrators. Null if no notes have been added.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Internal notes about this fee markup, visible only to administrators. Null if no notes have been added.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

A flat fee charged per transaction, in USD. Ranges from 0 to 50. Null if no fixed fee is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fixedFeeUsd(Nullable fixedFeeUsd) { + if (fixedFeeUsd.isNull()) { + this.fixedFeeUsd = null; + } else if (fixedFeeUsd.isEmpty()) { + this.fixedFeeUsd = Optional.empty(); + } else { + this.fixedFeeUsd = Optional.of(fixedFeeUsd.get()); + } + return this; + } + + /** + *

A flat fee charged per transaction, in USD. Ranges from 0 to 50. Null if no fixed fee is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fixedFeeUsd(Double fixedFeeUsd) { + this.fixedFeeUsd = Optional.ofNullable(fixedFeeUsd); + return this; + } + + /** + *

A flat fee charged per transaction, in USD. Ranges from 0 to 50. Null if no fixed fee is configured.

+ */ + @java.lang.Override + @JsonSetter(value = "fixed_fee_usd", nulls = Nulls.SKIP) + public _FinalStage fixedFeeUsd(Optional fixedFeeUsd) { + this.fixedFeeUsd = fixedFeeUsd; + return this; + } + + @java.lang.Override + public FeeMarkup build() { + return new FeeMarkup( + createdAt, feeType, fixedFeeUsd, id, notes, percentageFee, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/FeeMarkupListItem.java b/src/main/java/com/whop/api/types/FeeMarkupListItem.java new file mode 100644 index 00000000..b56b4e61 --- /dev/null +++ b/src/main/java/com/whop/api/types/FeeMarkupListItem.java @@ -0,0 +1,460 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FeeMarkupListItem.Builder.class) +public final class FeeMarkupListItem { + private final OffsetDateTime createdAt; + + private final FeeMarkupTypes feeType; + + private final Optional fixedFeeUsd; + + private final String id; + + private final Optional notes; + + private final Optional percentageFee; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private FeeMarkupListItem( + OffsetDateTime createdAt, + FeeMarkupTypes feeType, + Optional fixedFeeUsd, + String id, + Optional notes, + Optional percentageFee, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.createdAt = createdAt; + this.feeType = feeType; + this.fixedFeeUsd = fixedFeeUsd; + this.id = id; + this.notes = notes; + this.percentageFee = percentageFee; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The datetime the fee markup was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The category of fee this markup applies to. + */ + @JsonProperty("fee_type") + public FeeMarkupTypes getFeeType() { + return feeType; + } + + /** + * @return A flat fee charged per transaction, in USD. Ranges from 0 to 50. Null if no fixed fee is configured. + */ + @JsonIgnore + public Optional getFixedFeeUsd() { + if (fixedFeeUsd == null) { + return Optional.empty(); + } + return fixedFeeUsd; + } + + /** + * @return The unique identifier for the fee markup. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Internal notes about this fee markup, visible only to administrators. Null if no notes have been added. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + /** + * @return A percentage-based fee charged per transaction. Ranges from 0 to 25. Null if no percentage fee is configured. + */ + @JsonIgnore + public Optional getPercentageFee() { + if (percentageFee == null) { + return Optional.empty(); + } + return percentageFee; + } + + /** + * @return The datetime the fee markup was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fixed_fee_usd") + private Optional _getFixedFeeUsd() { + return fixedFeeUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("percentage_fee") + private Optional _getPercentageFee() { + return percentageFee; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FeeMarkupListItem && equalTo((FeeMarkupListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FeeMarkupListItem other) { + return createdAt.equals(other.createdAt) + && feeType.equals(other.feeType) + && fixedFeeUsd.equals(other.fixedFeeUsd) + && id.equals(other.id) + && notes.equals(other.notes) + && percentageFee.equals(other.percentageFee) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, + this.feeType, + this.fixedFeeUsd, + this.id, + this.notes, + this.percentageFee, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the fee markup was created.

+ */ + FeeTypeStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(FeeMarkupListItem other); + } + + public interface FeeTypeStage { + /** + *

The category of fee this markup applies to.

+ */ + IdStage feeType(@NotNull FeeMarkupTypes feeType); + } + + public interface IdStage { + /** + *

The unique identifier for the fee markup.

+ */ + UpdatedAtStage id(@NotNull String id); + } + + public interface UpdatedAtStage { + /** + *

The datetime the fee markup was last updated.

+ */ + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + FeeMarkupListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A flat fee charged per transaction, in USD. Ranges from 0 to 50. Null if no fixed fee is configured.

+ */ + _FinalStage fixedFeeUsd(Optional fixedFeeUsd); + + _FinalStage fixedFeeUsd(Double fixedFeeUsd); + + _FinalStage fixedFeeUsd(Nullable fixedFeeUsd); + + /** + *

Internal notes about this fee markup, visible only to administrators. Null if no notes have been added.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + + /** + *

A percentage-based fee charged per transaction. Ranges from 0 to 25. Null if no percentage fee is configured.

+ */ + _FinalStage percentageFee(Optional percentageFee); + + _FinalStage percentageFee(Double percentageFee); + + _FinalStage percentageFee(Nullable percentageFee); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, FeeTypeStage, IdStage, UpdatedAtStage, _FinalStage { + private OffsetDateTime createdAt; + + private FeeMarkupTypes feeType; + + private String id; + + private OffsetDateTime updatedAt; + + private Optional percentageFee = Optional.empty(); + + private Optional notes = Optional.empty(); + + private Optional fixedFeeUsd = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FeeMarkupListItem other) { + createdAt(other.getCreatedAt()); + feeType(other.getFeeType()); + fixedFeeUsd(other.getFixedFeeUsd()); + id(other.getId()); + notes(other.getNotes()); + percentageFee(other.getPercentageFee()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

The datetime the fee markup was created.

+ *

The datetime the fee markup was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public FeeTypeStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The category of fee this markup applies to.

+ *

The category of fee this markup applies to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_type") + public IdStage feeType(@NotNull FeeMarkupTypes feeType) { + this.feeType = Objects.requireNonNull(feeType, "feeType must not be null"); + return this; + } + + /** + *

The unique identifier for the fee markup.

+ *

The unique identifier for the fee markup.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UpdatedAtStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The datetime the fee markup was last updated.

+ *

The datetime the fee markup was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

A percentage-based fee charged per transaction. Ranges from 0 to 25. Null if no percentage fee is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage percentageFee(Nullable percentageFee) { + if (percentageFee.isNull()) { + this.percentageFee = null; + } else if (percentageFee.isEmpty()) { + this.percentageFee = Optional.empty(); + } else { + this.percentageFee = Optional.of(percentageFee.get()); + } + return this; + } + + /** + *

A percentage-based fee charged per transaction. Ranges from 0 to 25. Null if no percentage fee is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage percentageFee(Double percentageFee) { + this.percentageFee = Optional.ofNullable(percentageFee); + return this; + } + + /** + *

A percentage-based fee charged per transaction. Ranges from 0 to 25. Null if no percentage fee is configured.

+ */ + @java.lang.Override + @JsonSetter(value = "percentage_fee", nulls = Nulls.SKIP) + public _FinalStage percentageFee(Optional percentageFee) { + this.percentageFee = percentageFee; + return this; + } + + /** + *

Internal notes about this fee markup, visible only to administrators. Null if no notes have been added.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Internal notes about this fee markup, visible only to administrators. Null if no notes have been added.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Internal notes about this fee markup, visible only to administrators. Null if no notes have been added.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

A flat fee charged per transaction, in USD. Ranges from 0 to 50. Null if no fixed fee is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fixedFeeUsd(Nullable fixedFeeUsd) { + if (fixedFeeUsd.isNull()) { + this.fixedFeeUsd = null; + } else if (fixedFeeUsd.isEmpty()) { + this.fixedFeeUsd = Optional.empty(); + } else { + this.fixedFeeUsd = Optional.of(fixedFeeUsd.get()); + } + return this; + } + + /** + *

A flat fee charged per transaction, in USD. Ranges from 0 to 50. Null if no fixed fee is configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fixedFeeUsd(Double fixedFeeUsd) { + this.fixedFeeUsd = Optional.ofNullable(fixedFeeUsd); + return this; + } + + /** + *

A flat fee charged per transaction, in USD. Ranges from 0 to 50. Null if no fixed fee is configured.

+ */ + @java.lang.Override + @JsonSetter(value = "fixed_fee_usd", nulls = Nulls.SKIP) + public _FinalStage fixedFeeUsd(Optional fixedFeeUsd) { + this.fixedFeeUsd = fixedFeeUsd; + return this; + } + + @java.lang.Override + public FeeMarkupListItem build() { + return new FeeMarkupListItem( + createdAt, feeType, fixedFeeUsd, id, notes, percentageFee, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/FeeMarkupTypes.java b/src/main/java/com/whop/api/types/FeeMarkupTypes.java new file mode 100644 index 00000000..df1c00b8 --- /dev/null +++ b/src/main/java/com/whop/api/types/FeeMarkupTypes.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class FeeMarkupTypes { + public static final FeeMarkupTypes DIGITAL_WALLET_WITHDRAWAL_MARKUP = + new FeeMarkupTypes(Value.DIGITAL_WALLET_WITHDRAWAL_MARKUP, "digital_wallet_withdrawal_markup"); + + public static final FeeMarkupTypes BANK_WIRE_WITHDRAWAL_MARKUP = + new FeeMarkupTypes(Value.BANK_WIRE_WITHDRAWAL_MARKUP, "bank_wire_withdrawal_markup"); + + public static final FeeMarkupTypes CRYPTO_WITHDRAWAL_MARKUP = + new FeeMarkupTypes(Value.CRYPTO_WITHDRAWAL_MARKUP, "crypto_withdrawal_markup"); + + public static final FeeMarkupTypes RTP_WITHDRAWAL_MARKUP = + new FeeMarkupTypes(Value.RTP_WITHDRAWAL_MARKUP, "rtp_withdrawal_markup"); + + public static final FeeMarkupTypes NEXT_DAY_BANK_WITHDRAWAL_MARKUP = + new FeeMarkupTypes(Value.NEXT_DAY_BANK_WITHDRAWAL_MARKUP, "next_day_bank_withdrawal_markup"); + + private final Value value; + + private final String string; + + FeeMarkupTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof FeeMarkupTypes && this.string.equals(((FeeMarkupTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DIGITAL_WALLET_WITHDRAWAL_MARKUP: + return visitor.visitDigitalWalletWithdrawalMarkup(); + case BANK_WIRE_WITHDRAWAL_MARKUP: + return visitor.visitBankWireWithdrawalMarkup(); + case CRYPTO_WITHDRAWAL_MARKUP: + return visitor.visitCryptoWithdrawalMarkup(); + case RTP_WITHDRAWAL_MARKUP: + return visitor.visitRtpWithdrawalMarkup(); + case NEXT_DAY_BANK_WITHDRAWAL_MARKUP: + return visitor.visitNextDayBankWithdrawalMarkup(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static FeeMarkupTypes valueOf(String value) { + switch (value) { + case "digital_wallet_withdrawal_markup": + return DIGITAL_WALLET_WITHDRAWAL_MARKUP; + case "bank_wire_withdrawal_markup": + return BANK_WIRE_WITHDRAWAL_MARKUP; + case "crypto_withdrawal_markup": + return CRYPTO_WITHDRAWAL_MARKUP; + case "rtp_withdrawal_markup": + return RTP_WITHDRAWAL_MARKUP; + case "next_day_bank_withdrawal_markup": + return NEXT_DAY_BANK_WITHDRAWAL_MARKUP; + default: + return new FeeMarkupTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + CRYPTO_WITHDRAWAL_MARKUP, + + RTP_WITHDRAWAL_MARKUP, + + NEXT_DAY_BANK_WITHDRAWAL_MARKUP, + + BANK_WIRE_WITHDRAWAL_MARKUP, + + DIGITAL_WALLET_WITHDRAWAL_MARKUP, + + UNKNOWN + } + + public interface Visitor { + T visitCryptoWithdrawalMarkup(); + + T visitRtpWithdrawalMarkup(); + + T visitNextDayBankWithdrawalMarkup(); + + T visitBankWireWithdrawalMarkup(); + + T visitDigitalWalletWithdrawalMarkup(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/File.java b/src/main/java/com/whop/api/types/File.java new file mode 100644 index 00000000..a32808bf --- /dev/null +++ b/src/main/java/com/whop/api/types/File.java @@ -0,0 +1,487 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = File.Builder.class) +public final class File { + private final Optional contentType; + + private final Optional filename; + + private final String id; + + private final Optional size; + + private final UploadStatuses uploadStatus; + + private final Optional url; + + private final FileVisibility visibility; + + private final Map additionalProperties; + + private File( + Optional contentType, + Optional filename, + String id, + Optional size, + UploadStatuses uploadStatus, + Optional url, + FileVisibility visibility, + Map additionalProperties) { + this.contentType = contentType; + this.filename = filename; + this.id = id; + this.size = size; + this.uploadStatus = uploadStatus; + this.url = url; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return The MIME type of the uploaded file (e.g., image/jpeg, video/mp4, audio/mpeg). + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return The original filename of the uploaded file, including its file extension. + */ + @JsonIgnore + public Optional getFilename() { + if (filename == null) { + return Optional.empty(); + } + return filename; + } + + /** + * @return The unique identifier for the file. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The file size in bytes. Null if the file has not finished uploading. + */ + @JsonIgnore + public Optional getSize() { + if (size == null) { + return Optional.empty(); + } + return size; + } + + /** + * @return The current upload status of the file (e.g., pending, ready). + */ + @JsonProperty("upload_status") + public UploadStatuses getUploadStatus() { + return uploadStatus; + } + + /** + * @return The URL for accessing the file. For public files, this is a permanent CDN URL. For private files, this is a signed URL that expires. Null if the file has not finished uploading. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + /** + * @return Whether the file is publicly accessible or requires authentication. + */ + @JsonProperty("visibility") + public FileVisibility getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filename") + private Optional _getFilename() { + return filename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("size") + private Optional _getSize() { + return size; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof File && equalTo((File) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(File other) { + return contentType.equals(other.contentType) + && filename.equals(other.filename) + && id.equals(other.id) + && size.equals(other.size) + && uploadStatus.equals(other.uploadStatus) + && url.equals(other.url) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.contentType, this.filename, this.id, this.size, this.uploadStatus, this.url, this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the file.

+ */ + UploadStatusStage id(@NotNull String id); + + Builder from(File other); + } + + public interface UploadStatusStage { + /** + *

The current upload status of the file (e.g., pending, ready).

+ */ + VisibilityStage uploadStatus(@NotNull UploadStatuses uploadStatus); + } + + public interface VisibilityStage { + /** + *

Whether the file is publicly accessible or requires authentication.

+ */ + _FinalStage visibility(@NotNull FileVisibility visibility); + } + + public interface _FinalStage { + File build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The MIME type of the uploaded file (e.g., image/jpeg, video/mp4, audio/mpeg).

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

The original filename of the uploaded file, including its file extension.

+ */ + _FinalStage filename(Optional filename); + + _FinalStage filename(String filename); + + _FinalStage filename(Nullable filename); + + /** + *

The file size in bytes. Null if the file has not finished uploading.

+ */ + _FinalStage size(Optional size); + + _FinalStage size(String size); + + _FinalStage size(Nullable size); + + /** + *

The URL for accessing the file. For public files, this is a permanent CDN URL. For private files, this is a signed URL that expires. Null if the file has not finished uploading.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UploadStatusStage, VisibilityStage, _FinalStage { + private String id; + + private UploadStatuses uploadStatus; + + private FileVisibility visibility; + + private Optional url = Optional.empty(); + + private Optional size = Optional.empty(); + + private Optional filename = Optional.empty(); + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(File other) { + contentType(other.getContentType()); + filename(other.getFilename()); + id(other.getId()); + size(other.getSize()); + uploadStatus(other.getUploadStatus()); + url(other.getUrl()); + visibility(other.getVisibility()); + return this; + } + + /** + *

The unique identifier for the file.

+ *

The unique identifier for the file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UploadStatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current upload status of the file (e.g., pending, ready).

+ *

The current upload status of the file (e.g., pending, ready).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("upload_status") + public VisibilityStage uploadStatus(@NotNull UploadStatuses uploadStatus) { + this.uploadStatus = Objects.requireNonNull(uploadStatus, "uploadStatus must not be null"); + return this; + } + + /** + *

Whether the file is publicly accessible or requires authentication.

+ *

Whether the file is publicly accessible or requires authentication.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("visibility") + public _FinalStage visibility(@NotNull FileVisibility visibility) { + this.visibility = Objects.requireNonNull(visibility, "visibility must not be null"); + return this; + } + + /** + *

The URL for accessing the file. For public files, this is a permanent CDN URL. For private files, this is a signed URL that expires. Null if the file has not finished uploading.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

The URL for accessing the file. For public files, this is a permanent CDN URL. For private files, this is a signed URL that expires. Null if the file has not finished uploading.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

The URL for accessing the file. For public files, this is a permanent CDN URL. For private files, this is a signed URL that expires. Null if the file has not finished uploading.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

The file size in bytes. Null if the file has not finished uploading.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage size(Nullable size) { + if (size.isNull()) { + this.size = null; + } else if (size.isEmpty()) { + this.size = Optional.empty(); + } else { + this.size = Optional.of(size.get()); + } + return this; + } + + /** + *

The file size in bytes. Null if the file has not finished uploading.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage size(String size) { + this.size = Optional.ofNullable(size); + return this; + } + + /** + *

The file size in bytes. Null if the file has not finished uploading.

+ */ + @java.lang.Override + @JsonSetter(value = "size", nulls = Nulls.SKIP) + public _FinalStage size(Optional size) { + this.size = size; + return this; + } + + /** + *

The original filename of the uploaded file, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(Nullable filename) { + if (filename.isNull()) { + this.filename = null; + } else if (filename.isEmpty()) { + this.filename = Optional.empty(); + } else { + this.filename = Optional.of(filename.get()); + } + return this; + } + + /** + *

The original filename of the uploaded file, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(String filename) { + this.filename = Optional.ofNullable(filename); + return this; + } + + /** + *

The original filename of the uploaded file, including its file extension.

+ */ + @java.lang.Override + @JsonSetter(value = "filename", nulls = Nulls.SKIP) + public _FinalStage filename(Optional filename) { + this.filename = filename; + return this; + } + + /** + *

The MIME type of the uploaded file (e.g., image/jpeg, video/mp4, audio/mpeg).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

The MIME type of the uploaded file (e.g., image/jpeg, video/mp4, audio/mpeg).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

The MIME type of the uploaded file (e.g., image/jpeg, video/mp4, audio/mpeg).

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public File build() { + return new File(contentType, filename, id, size, uploadStatus, url, visibility, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/FileVisibility.java b/src/main/java/com/whop/api/types/FileVisibility.java new file mode 100644 index 00000000..13e67f06 --- /dev/null +++ b/src/main/java/com/whop/api/types/FileVisibility.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class FileVisibility { + public static final FileVisibility PRIVATE = new FileVisibility(Value.PRIVATE, "private"); + + public static final FileVisibility PUBLIC = new FileVisibility(Value.PUBLIC, "public"); + + private final Value value; + + private final String string; + + FileVisibility(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof FileVisibility && this.string.equals(((FileVisibility) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PRIVATE: + return visitor.visitPrivate(); + case PUBLIC: + return visitor.visitPublic(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static FileVisibility valueOf(String value) { + switch (value) { + case "private": + return PRIVATE; + case "public": + return PUBLIC; + default: + return new FileVisibility(Value.UNKNOWN, value); + } + } + + public enum Value { + PUBLIC, + + PRIVATE, + + UNKNOWN + } + + public interface Visitor { + T visitPublic(); + + T visitPrivate(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ForbiddenErrorBody.java b/src/main/java/com/whop/api/types/ForbiddenErrorBody.java new file mode 100644 index 00000000..2aa92d36 --- /dev/null +++ b/src/main/java/com/whop/api/types/ForbiddenErrorBody.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ForbiddenErrorBody.Builder.class) +public final class ForbiddenErrorBody { + private final ForbiddenErrorBodyError error; + + private final Map additionalProperties; + + private ForbiddenErrorBody(ForbiddenErrorBodyError error, Map additionalProperties) { + this.error = error; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("error") + public ForbiddenErrorBodyError getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ForbiddenErrorBody && equalTo((ForbiddenErrorBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ForbiddenErrorBody other) { + return error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + _FinalStage error(@NotNull ForbiddenErrorBodyError error); + + Builder from(ForbiddenErrorBody other); + } + + public interface _FinalStage { + ForbiddenErrorBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private ForbiddenErrorBodyError error; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ForbiddenErrorBody other) { + error(other.getError()); + return this; + } + + @java.lang.Override + @JsonSetter("error") + public _FinalStage error(@NotNull ForbiddenErrorBodyError error) { + this.error = Objects.requireNonNull(error, "error must not be null"); + return this; + } + + @java.lang.Override + public ForbiddenErrorBody build() { + return new ForbiddenErrorBody(error, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ForbiddenErrorBodyError.java b/src/main/java/com/whop/api/types/ForbiddenErrorBodyError.java new file mode 100644 index 00000000..4baa1399 --- /dev/null +++ b/src/main/java/com/whop/api/types/ForbiddenErrorBodyError.java @@ -0,0 +1,289 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ForbiddenErrorBodyError.Builder.class) +public final class ForbiddenErrorBodyError { + private final Optional code; + + private final String message; + + private final Optional param; + + private final String type; + + private final Map additionalProperties; + + private ForbiddenErrorBodyError( + Optional code, + String message, + Optional param, + String type, + Map additionalProperties) { + this.code = code; + this.message = message; + this.param = param; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json' + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + @JsonProperty("message") + public String getMessage() { + return message; + } + + /** + * @return The parameter that caused the error, if applicable + */ + @JsonIgnore + public Optional getParam() { + if (param == null) { + return Optional.empty(); + } + return param; + } + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("param") + private Optional _getParam() { + return param; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ForbiddenErrorBodyError && equalTo((ForbiddenErrorBodyError) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ForbiddenErrorBodyError other) { + return code.equals(other.code) + && message.equals(other.message) + && param.equals(other.param) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.message, this.param, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + TypeStage message(@NotNull String message); + + Builder from(ForbiddenErrorBodyError other); + } + + public interface TypeStage { + _FinalStage type(@NotNull String type); + } + + public interface _FinalStage { + ForbiddenErrorBodyError build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ */ + _FinalStage code(Optional code); + + _FinalStage code(String code); + + _FinalStage code(Nullable code); + + /** + *

The parameter that caused the error, if applicable

+ */ + _FinalStage param(Optional param); + + _FinalStage param(String param); + + _FinalStage param(Nullable param); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, TypeStage, _FinalStage { + private String message; + + private String type; + + private Optional param = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ForbiddenErrorBodyError other) { + code(other.getCode()); + message(other.getMessage()); + param(other.getParam()); + type(other.getType()); + return this; + } + + @java.lang.Override + @JsonSetter("message") + public TypeStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage param(Nullable param) { + if (param.isNull()) { + this.param = null; + } else if (param.isEmpty()) { + this.param = Optional.empty(); + } else { + this.param = Optional.of(param.get()); + } + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage param(String param) { + this.param = Optional.ofNullable(param); + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ */ + @java.lang.Override + @JsonSetter(value = "param", nulls = Nulls.SKIP) + public _FinalStage param(Optional param) { + this.param = param; + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public ForbiddenErrorBodyError build() { + return new ForbiddenErrorBodyError(code, message, param, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Forum.java b/src/main/java/com/whop/api/types/Forum.java new file mode 100644 index 00000000..f4cc7f13 --- /dev/null +++ b/src/main/java/com/whop/api/types/Forum.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Forum.Builder.class) +public final class Forum { + private final ForumEmailNotificationPreferences emailNotificationPreference; + + private final ForumExperience experience; + + private final String id; + + private final ForumWhoCanCommentTypes whoCanComment; + + private final ForumWhoCanPostTypes whoCanPost; + + private final Map additionalProperties; + + private Forum( + ForumEmailNotificationPreferences emailNotificationPreference, + ForumExperience experience, + String id, + ForumWhoCanCommentTypes whoCanComment, + ForumWhoCanPostTypes whoCanPost, + Map additionalProperties) { + this.emailNotificationPreference = emailNotificationPreference; + this.experience = experience; + this.id = id; + this.whoCanComment = whoCanComment; + this.whoCanPost = whoCanPost; + this.additionalProperties = additionalProperties; + } + + /** + * @return The email notification setting that controls which posts trigger email alerts. One of: all_admin_posts, only_weekly_summary, none. + */ + @JsonProperty("email_notification_preference") + public ForumEmailNotificationPreferences getEmailNotificationPreference() { + return emailNotificationPreference; + } + + /** + * @return The parent experience that this forum belongs to. + */ + @JsonProperty("experience") + public ForumExperience getExperience() { + return experience; + } + + /** + * @return The unique identifier for the entity + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The permission level controlling who can comment on posts. One of: everyone, admins. + */ + @JsonProperty("who_can_comment") + public ForumWhoCanCommentTypes getWhoCanComment() { + return whoCanComment; + } + + /** + * @return The permission level controlling who can create new posts. One of: everyone, admins. + */ + @JsonProperty("who_can_post") + public ForumWhoCanPostTypes getWhoCanPost() { + return whoCanPost; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Forum && equalTo((Forum) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Forum other) { + return emailNotificationPreference.equals(other.emailNotificationPreference) + && experience.equals(other.experience) + && id.equals(other.id) + && whoCanComment.equals(other.whoCanComment) + && whoCanPost.equals(other.whoCanPost); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.emailNotificationPreference, this.experience, this.id, this.whoCanComment, this.whoCanPost); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EmailNotificationPreferenceStage builder() { + return new Builder(); + } + + public interface EmailNotificationPreferenceStage { + /** + *

The email notification setting that controls which posts trigger email alerts. One of: all_admin_posts, only_weekly_summary, none.

+ */ + ExperienceStage emailNotificationPreference( + @NotNull ForumEmailNotificationPreferences emailNotificationPreference); + + Builder from(Forum other); + } + + public interface ExperienceStage { + /** + *

The parent experience that this forum belongs to.

+ */ + IdStage experience(@NotNull ForumExperience experience); + } + + public interface IdStage { + /** + *

The unique identifier for the entity

+ */ + WhoCanCommentStage id(@NotNull String id); + } + + public interface WhoCanCommentStage { + /** + *

The permission level controlling who can comment on posts. One of: everyone, admins.

+ */ + WhoCanPostStage whoCanComment(@NotNull ForumWhoCanCommentTypes whoCanComment); + } + + public interface WhoCanPostStage { + /** + *

The permission level controlling who can create new posts. One of: everyone, admins.

+ */ + _FinalStage whoCanPost(@NotNull ForumWhoCanPostTypes whoCanPost); + } + + public interface _FinalStage { + Forum build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements EmailNotificationPreferenceStage, + ExperienceStage, + IdStage, + WhoCanCommentStage, + WhoCanPostStage, + _FinalStage { + private ForumEmailNotificationPreferences emailNotificationPreference; + + private ForumExperience experience; + + private String id; + + private ForumWhoCanCommentTypes whoCanComment; + + private ForumWhoCanPostTypes whoCanPost; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Forum other) { + emailNotificationPreference(other.getEmailNotificationPreference()); + experience(other.getExperience()); + id(other.getId()); + whoCanComment(other.getWhoCanComment()); + whoCanPost(other.getWhoCanPost()); + return this; + } + + /** + *

The email notification setting that controls which posts trigger email alerts. One of: all_admin_posts, only_weekly_summary, none.

+ *

The email notification setting that controls which posts trigger email alerts. One of: all_admin_posts, only_weekly_summary, none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("email_notification_preference") + public ExperienceStage emailNotificationPreference( + @NotNull ForumEmailNotificationPreferences emailNotificationPreference) { + this.emailNotificationPreference = + Objects.requireNonNull(emailNotificationPreference, "emailNotificationPreference must not be null"); + return this; + } + + /** + *

The parent experience that this forum belongs to.

+ *

The parent experience that this forum belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("experience") + public IdStage experience(@NotNull ForumExperience experience) { + this.experience = Objects.requireNonNull(experience, "experience must not be null"); + return this; + } + + /** + *

The unique identifier for the entity

+ *

The unique identifier for the entity

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public WhoCanCommentStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The permission level controlling who can comment on posts. One of: everyone, admins.

+ *

The permission level controlling who can comment on posts. One of: everyone, admins.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("who_can_comment") + public WhoCanPostStage whoCanComment(@NotNull ForumWhoCanCommentTypes whoCanComment) { + this.whoCanComment = Objects.requireNonNull(whoCanComment, "whoCanComment must not be null"); + return this; + } + + /** + *

The permission level controlling who can create new posts. One of: everyone, admins.

+ *

The permission level controlling who can create new posts. One of: everyone, admins.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("who_can_post") + public _FinalStage whoCanPost(@NotNull ForumWhoCanPostTypes whoCanPost) { + this.whoCanPost = Objects.requireNonNull(whoCanPost, "whoCanPost must not be null"); + return this; + } + + @java.lang.Override + public Forum build() { + return new Forum( + emailNotificationPreference, experience, id, whoCanComment, whoCanPost, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ForumEmailNotificationPreferences.java b/src/main/java/com/whop/api/types/ForumEmailNotificationPreferences.java new file mode 100644 index 00000000..92a3da07 --- /dev/null +++ b/src/main/java/com/whop/api/types/ForumEmailNotificationPreferences.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ForumEmailNotificationPreferences { + public static final ForumEmailNotificationPreferences ONLY_WEEKLY_SUMMARY = + new ForumEmailNotificationPreferences(Value.ONLY_WEEKLY_SUMMARY, "only_weekly_summary"); + + public static final ForumEmailNotificationPreferences ALL_ADMIN_POSTS = + new ForumEmailNotificationPreferences(Value.ALL_ADMIN_POSTS, "all_admin_posts"); + + public static final ForumEmailNotificationPreferences NONE = + new ForumEmailNotificationPreferences(Value.NONE, "none"); + + private final Value value; + + private final String string; + + ForumEmailNotificationPreferences(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ForumEmailNotificationPreferences + && this.string.equals(((ForumEmailNotificationPreferences) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ONLY_WEEKLY_SUMMARY: + return visitor.visitOnlyWeeklySummary(); + case ALL_ADMIN_POSTS: + return visitor.visitAllAdminPosts(); + case NONE: + return visitor.visitNone(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ForumEmailNotificationPreferences valueOf(String value) { + switch (value) { + case "only_weekly_summary": + return ONLY_WEEKLY_SUMMARY; + case "all_admin_posts": + return ALL_ADMIN_POSTS; + case "none": + return NONE; + default: + return new ForumEmailNotificationPreferences(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL_ADMIN_POSTS, + + ONLY_WEEKLY_SUMMARY, + + NONE, + + UNKNOWN + } + + public interface Visitor { + T visitAllAdminPosts(); + + T visitOnlyWeeklySummary(); + + T visitNone(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ForumExperience.java b/src/main/java/com/whop/api/types/ForumExperience.java new file mode 100644 index 00000000..f8d69d82 --- /dev/null +++ b/src/main/java/com/whop/api/types/ForumExperience.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ForumExperience.Builder.class) +public final class ForumExperience { + private final String id; + + private final String name; + + private final Map additionalProperties; + + private ForumExperience(String id, String name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the experience. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of this experience shown to users in the product navigation. Maximum 255 characters. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ForumExperience && equalTo((ForumExperience) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ForumExperience other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the experience.

+ */ + NameStage id(@NotNull String id); + + Builder from(ForumExperience other); + } + + public interface NameStage { + /** + *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + ForumExperience build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ForumExperience other) { + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

The unique identifier for the experience.

+ *

The unique identifier for the experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public ForumExperience build() { + return new ForumExperience(id, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ForumListItem.java b/src/main/java/com/whop/api/types/ForumListItem.java new file mode 100644 index 00000000..6cf49555 --- /dev/null +++ b/src/main/java/com/whop/api/types/ForumListItem.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ForumListItem.Builder.class) +public final class ForumListItem { + private final ForumEmailNotificationPreferences emailNotificationPreference; + + private final ForumListItemExperience experience; + + private final String id; + + private final ForumWhoCanCommentTypes whoCanComment; + + private final ForumWhoCanPostTypes whoCanPost; + + private final Map additionalProperties; + + private ForumListItem( + ForumEmailNotificationPreferences emailNotificationPreference, + ForumListItemExperience experience, + String id, + ForumWhoCanCommentTypes whoCanComment, + ForumWhoCanPostTypes whoCanPost, + Map additionalProperties) { + this.emailNotificationPreference = emailNotificationPreference; + this.experience = experience; + this.id = id; + this.whoCanComment = whoCanComment; + this.whoCanPost = whoCanPost; + this.additionalProperties = additionalProperties; + } + + /** + * @return The email notification setting that controls which posts trigger email alerts. One of: all_admin_posts, only_weekly_summary, none. + */ + @JsonProperty("email_notification_preference") + public ForumEmailNotificationPreferences getEmailNotificationPreference() { + return emailNotificationPreference; + } + + /** + * @return The parent experience that this forum belongs to. + */ + @JsonProperty("experience") + public ForumListItemExperience getExperience() { + return experience; + } + + /** + * @return The unique identifier for the entity + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The permission level controlling who can comment on posts. One of: everyone, admins. + */ + @JsonProperty("who_can_comment") + public ForumWhoCanCommentTypes getWhoCanComment() { + return whoCanComment; + } + + /** + * @return The permission level controlling who can create new posts. One of: everyone, admins. + */ + @JsonProperty("who_can_post") + public ForumWhoCanPostTypes getWhoCanPost() { + return whoCanPost; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ForumListItem && equalTo((ForumListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ForumListItem other) { + return emailNotificationPreference.equals(other.emailNotificationPreference) + && experience.equals(other.experience) + && id.equals(other.id) + && whoCanComment.equals(other.whoCanComment) + && whoCanPost.equals(other.whoCanPost); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.emailNotificationPreference, this.experience, this.id, this.whoCanComment, this.whoCanPost); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EmailNotificationPreferenceStage builder() { + return new Builder(); + } + + public interface EmailNotificationPreferenceStage { + /** + *

The email notification setting that controls which posts trigger email alerts. One of: all_admin_posts, only_weekly_summary, none.

+ */ + ExperienceStage emailNotificationPreference( + @NotNull ForumEmailNotificationPreferences emailNotificationPreference); + + Builder from(ForumListItem other); + } + + public interface ExperienceStage { + /** + *

The parent experience that this forum belongs to.

+ */ + IdStage experience(@NotNull ForumListItemExperience experience); + } + + public interface IdStage { + /** + *

The unique identifier for the entity

+ */ + WhoCanCommentStage id(@NotNull String id); + } + + public interface WhoCanCommentStage { + /** + *

The permission level controlling who can comment on posts. One of: everyone, admins.

+ */ + WhoCanPostStage whoCanComment(@NotNull ForumWhoCanCommentTypes whoCanComment); + } + + public interface WhoCanPostStage { + /** + *

The permission level controlling who can create new posts. One of: everyone, admins.

+ */ + _FinalStage whoCanPost(@NotNull ForumWhoCanPostTypes whoCanPost); + } + + public interface _FinalStage { + ForumListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements EmailNotificationPreferenceStage, + ExperienceStage, + IdStage, + WhoCanCommentStage, + WhoCanPostStage, + _FinalStage { + private ForumEmailNotificationPreferences emailNotificationPreference; + + private ForumListItemExperience experience; + + private String id; + + private ForumWhoCanCommentTypes whoCanComment; + + private ForumWhoCanPostTypes whoCanPost; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ForumListItem other) { + emailNotificationPreference(other.getEmailNotificationPreference()); + experience(other.getExperience()); + id(other.getId()); + whoCanComment(other.getWhoCanComment()); + whoCanPost(other.getWhoCanPost()); + return this; + } + + /** + *

The email notification setting that controls which posts trigger email alerts. One of: all_admin_posts, only_weekly_summary, none.

+ *

The email notification setting that controls which posts trigger email alerts. One of: all_admin_posts, only_weekly_summary, none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("email_notification_preference") + public ExperienceStage emailNotificationPreference( + @NotNull ForumEmailNotificationPreferences emailNotificationPreference) { + this.emailNotificationPreference = + Objects.requireNonNull(emailNotificationPreference, "emailNotificationPreference must not be null"); + return this; + } + + /** + *

The parent experience that this forum belongs to.

+ *

The parent experience that this forum belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("experience") + public IdStage experience(@NotNull ForumListItemExperience experience) { + this.experience = Objects.requireNonNull(experience, "experience must not be null"); + return this; + } + + /** + *

The unique identifier for the entity

+ *

The unique identifier for the entity

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public WhoCanCommentStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The permission level controlling who can comment on posts. One of: everyone, admins.

+ *

The permission level controlling who can comment on posts. One of: everyone, admins.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("who_can_comment") + public WhoCanPostStage whoCanComment(@NotNull ForumWhoCanCommentTypes whoCanComment) { + this.whoCanComment = Objects.requireNonNull(whoCanComment, "whoCanComment must not be null"); + return this; + } + + /** + *

The permission level controlling who can create new posts. One of: everyone, admins.

+ *

The permission level controlling who can create new posts. One of: everyone, admins.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("who_can_post") + public _FinalStage whoCanPost(@NotNull ForumWhoCanPostTypes whoCanPost) { + this.whoCanPost = Objects.requireNonNull(whoCanPost, "whoCanPost must not be null"); + return this; + } + + @java.lang.Override + public ForumListItem build() { + return new ForumListItem( + emailNotificationPreference, experience, id, whoCanComment, whoCanPost, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ForumListItemExperience.java b/src/main/java/com/whop/api/types/ForumListItemExperience.java new file mode 100644 index 00000000..d6f726e1 --- /dev/null +++ b/src/main/java/com/whop/api/types/ForumListItemExperience.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ForumListItemExperience.Builder.class) +public final class ForumListItemExperience { + private final String id; + + private final String name; + + private final Map additionalProperties; + + private ForumListItemExperience(String id, String name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the experience. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of this experience shown to users in the product navigation. Maximum 255 characters. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ForumListItemExperience && equalTo((ForumListItemExperience) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ForumListItemExperience other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the experience.

+ */ + NameStage id(@NotNull String id); + + Builder from(ForumListItemExperience other); + } + + public interface NameStage { + /** + *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + ForumListItemExperience build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ForumListItemExperience other) { + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

The unique identifier for the experience.

+ *

The unique identifier for the experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ *

The display name of this experience shown to users in the product navigation. Maximum 255 characters.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public ForumListItemExperience build() { + return new ForumListItemExperience(id, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ForumPost.java b/src/main/java/com/whop/api/types/ForumPost.java new file mode 100644 index 00000000..c2c92ac5 --- /dev/null +++ b/src/main/java/com/whop/api/types/ForumPost.java @@ -0,0 +1,832 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ForumPost.Builder.class) +public final class ForumPost { + private final List attachments; + + private final int commentCount; + + private final Optional content; + + private final OffsetDateTime createdAt; + + private final String id; + + private final boolean isEdited; + + private final boolean isPinned; + + private final boolean isPosterAdmin; + + private final Optional likeCount; + + private final Optional parentId; + + private final Optional title; + + private final OffsetDateTime updatedAt; + + private final ForumPostUser user; + + private final Optional viewCount; + + private final Map additionalProperties; + + private ForumPost( + List attachments, + int commentCount, + Optional content, + OffsetDateTime createdAt, + String id, + boolean isEdited, + boolean isPinned, + boolean isPosterAdmin, + Optional likeCount, + Optional parentId, + Optional title, + OffsetDateTime updatedAt, + ForumPostUser user, + Optional viewCount, + Map additionalProperties) { + this.attachments = attachments; + this.commentCount = commentCount; + this.content = content; + this.createdAt = createdAt; + this.id = id; + this.isEdited = isEdited; + this.isPinned = isPinned; + this.isPosterAdmin = isPosterAdmin; + this.likeCount = likeCount; + this.parentId = parentId; + this.title = title; + this.updatedAt = updatedAt; + this.user = user; + this.viewCount = viewCount; + this.additionalProperties = additionalProperties; + } + + /** + * @return All file attachments on this post, such as images, documents, and videos. + */ + @JsonProperty("attachments") + public List getAttachments() { + return attachments; + } + + /** + * @return The total number of direct comments on this post. + */ + @JsonProperty("comment_count") + public int getCommentCount() { + return commentCount; + } + + /** + * @return The body of the forum post in Markdown format. Null if the post is paywalled and the current user does not have access. + */ + @JsonIgnore + public Optional getContent() { + if (content == null) { + return Optional.empty(); + } + return content; + } + + /** + * @return The time this post was created, as a Unix timestamp. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whether this post has been edited after its initial creation. + */ + @JsonProperty("is_edited") + public boolean getIsEdited() { + return isEdited; + } + + /** + * @return Whether this post is pinned to the top of the forum feed. + */ + @JsonProperty("is_pinned") + public boolean getIsPinned() { + return isPinned; + } + + /** + * @return Whether the author of this post is an admin of the company that owns the forum. + */ + @JsonProperty("is_poster_admin") + public boolean getIsPosterAdmin() { + return isPosterAdmin; + } + + /** + * @return The total number of like reactions this post has received. + */ + @JsonIgnore + public Optional getLikeCount() { + if (likeCount == null) { + return Optional.empty(); + } + return likeCount; + } + + /** + * @return The unique identifier of the parent post. Null if this is a top-level post. + */ + @JsonIgnore + public Optional getParentId() { + if (parentId == null) { + return Optional.empty(); + } + return parentId; + } + + /** + * @return The headline of the forum post. Null if the post has no title. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The time this post was last updated, as a Unix timestamp. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user who authored this forum post. + */ + @JsonProperty("user") + public ForumPostUser getUser() { + return user; + } + + /** + * @return The total number of times this post has been viewed by users. + */ + @JsonIgnore + public Optional getViewCount() { + if (viewCount == null) { + return Optional.empty(); + } + return viewCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content") + private Optional _getContent() { + return content; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("like_count") + private Optional _getLikeCount() { + return likeCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("parent_id") + private Optional _getParentId() { + return parentId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("view_count") + private Optional _getViewCount() { + return viewCount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ForumPost && equalTo((ForumPost) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ForumPost other) { + return attachments.equals(other.attachments) + && commentCount == other.commentCount + && content.equals(other.content) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && isEdited == other.isEdited + && isPinned == other.isPinned + && isPosterAdmin == other.isPosterAdmin + && likeCount.equals(other.likeCount) + && parentId.equals(other.parentId) + && title.equals(other.title) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user) + && viewCount.equals(other.viewCount); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.attachments, + this.commentCount, + this.content, + this.createdAt, + this.id, + this.isEdited, + this.isPinned, + this.isPosterAdmin, + this.likeCount, + this.parentId, + this.title, + this.updatedAt, + this.user, + this.viewCount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CommentCountStage builder() { + return new Builder(); + } + + public interface CommentCountStage { + /** + *

The total number of direct comments on this post.

+ */ + CreatedAtStage commentCount(int commentCount); + + Builder from(ForumPost other); + } + + public interface CreatedAtStage { + /** + *

The time this post was created, as a Unix timestamp.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + IsEditedStage id(@NotNull String id); + } + + public interface IsEditedStage { + /** + *

Whether this post has been edited after its initial creation.

+ */ + IsPinnedStage isEdited(boolean isEdited); + } + + public interface IsPinnedStage { + /** + *

Whether this post is pinned to the top of the forum feed.

+ */ + IsPosterAdminStage isPinned(boolean isPinned); + } + + public interface IsPosterAdminStage { + /** + *

Whether the author of this post is an admin of the company that owns the forum.

+ */ + UpdatedAtStage isPosterAdmin(boolean isPosterAdmin); + } + + public interface UpdatedAtStage { + /** + *

The time this post was last updated, as a Unix timestamp.

+ */ + UserStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UserStage { + /** + *

The user who authored this forum post.

+ */ + _FinalStage user(@NotNull ForumPostUser user); + } + + public interface _FinalStage { + ForumPost build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

All file attachments on this post, such as images, documents, and videos.

+ */ + _FinalStage attachments(List attachments); + + _FinalStage addAttachments(ForumPostAttachmentsItem attachments); + + _FinalStage addAllAttachments(List attachments); + + /** + *

The body of the forum post in Markdown format. Null if the post is paywalled and the current user does not have access.

+ */ + _FinalStage content(Optional content); + + _FinalStage content(String content); + + _FinalStage content(Nullable content); + + /** + *

The total number of like reactions this post has received.

+ */ + _FinalStage likeCount(Optional likeCount); + + _FinalStage likeCount(Integer likeCount); + + _FinalStage likeCount(Nullable likeCount); + + /** + *

The unique identifier of the parent post. Null if this is a top-level post.

+ */ + _FinalStage parentId(Optional parentId); + + _FinalStage parentId(String parentId); + + _FinalStage parentId(Nullable parentId); + + /** + *

The headline of the forum post. Null if the post has no title.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + + /** + *

The total number of times this post has been viewed by users.

+ */ + _FinalStage viewCount(Optional viewCount); + + _FinalStage viewCount(Integer viewCount); + + _FinalStage viewCount(Nullable viewCount); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CommentCountStage, + CreatedAtStage, + IdStage, + IsEditedStage, + IsPinnedStage, + IsPosterAdminStage, + UpdatedAtStage, + UserStage, + _FinalStage { + private int commentCount; + + private OffsetDateTime createdAt; + + private String id; + + private boolean isEdited; + + private boolean isPinned; + + private boolean isPosterAdmin; + + private OffsetDateTime updatedAt; + + private ForumPostUser user; + + private Optional viewCount = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional parentId = Optional.empty(); + + private Optional likeCount = Optional.empty(); + + private Optional content = Optional.empty(); + + private List attachments = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ForumPost other) { + attachments(other.getAttachments()); + commentCount(other.getCommentCount()); + content(other.getContent()); + createdAt(other.getCreatedAt()); + id(other.getId()); + isEdited(other.getIsEdited()); + isPinned(other.getIsPinned()); + isPosterAdmin(other.getIsPosterAdmin()); + likeCount(other.getLikeCount()); + parentId(other.getParentId()); + title(other.getTitle()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + viewCount(other.getViewCount()); + return this; + } + + /** + *

The total number of direct comments on this post.

+ *

The total number of direct comments on this post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("comment_count") + public CreatedAtStage commentCount(int commentCount) { + this.commentCount = commentCount; + return this; + } + + /** + *

The time this post was created, as a Unix timestamp.

+ *

The time this post was created, as a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsEditedStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether this post has been edited after its initial creation.

+ *

Whether this post has been edited after its initial creation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_edited") + public IsPinnedStage isEdited(boolean isEdited) { + this.isEdited = isEdited; + return this; + } + + /** + *

Whether this post is pinned to the top of the forum feed.

+ *

Whether this post is pinned to the top of the forum feed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_pinned") + public IsPosterAdminStage isPinned(boolean isPinned) { + this.isPinned = isPinned; + return this; + } + + /** + *

Whether the author of this post is an admin of the company that owns the forum.

+ *

Whether the author of this post is an admin of the company that owns the forum.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_poster_admin") + public UpdatedAtStage isPosterAdmin(boolean isPosterAdmin) { + this.isPosterAdmin = isPosterAdmin; + return this; + } + + /** + *

The time this post was last updated, as a Unix timestamp.

+ *

The time this post was last updated, as a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UserStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user who authored this forum post.

+ *

The user who authored this forum post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull ForumPostUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

The total number of times this post has been viewed by users.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage viewCount(Nullable viewCount) { + if (viewCount.isNull()) { + this.viewCount = null; + } else if (viewCount.isEmpty()) { + this.viewCount = Optional.empty(); + } else { + this.viewCount = Optional.of(viewCount.get()); + } + return this; + } + + /** + *

The total number of times this post has been viewed by users.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage viewCount(Integer viewCount) { + this.viewCount = Optional.ofNullable(viewCount); + return this; + } + + /** + *

The total number of times this post has been viewed by users.

+ */ + @java.lang.Override + @JsonSetter(value = "view_count", nulls = Nulls.SKIP) + public _FinalStage viewCount(Optional viewCount) { + this.viewCount = viewCount; + return this; + } + + /** + *

The headline of the forum post. Null if the post has no title.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

The headline of the forum post. Null if the post has no title.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The headline of the forum post. Null if the post has no title.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

The unique identifier of the parent post. Null if this is a top-level post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage parentId(Nullable parentId) { + if (parentId.isNull()) { + this.parentId = null; + } else if (parentId.isEmpty()) { + this.parentId = Optional.empty(); + } else { + this.parentId = Optional.of(parentId.get()); + } + return this; + } + + /** + *

The unique identifier of the parent post. Null if this is a top-level post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage parentId(String parentId) { + this.parentId = Optional.ofNullable(parentId); + return this; + } + + /** + *

The unique identifier of the parent post. Null if this is a top-level post.

+ */ + @java.lang.Override + @JsonSetter(value = "parent_id", nulls = Nulls.SKIP) + public _FinalStage parentId(Optional parentId) { + this.parentId = parentId; + return this; + } + + /** + *

The total number of like reactions this post has received.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage likeCount(Nullable likeCount) { + if (likeCount.isNull()) { + this.likeCount = null; + } else if (likeCount.isEmpty()) { + this.likeCount = Optional.empty(); + } else { + this.likeCount = Optional.of(likeCount.get()); + } + return this; + } + + /** + *

The total number of like reactions this post has received.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage likeCount(Integer likeCount) { + this.likeCount = Optional.ofNullable(likeCount); + return this; + } + + /** + *

The total number of like reactions this post has received.

+ */ + @java.lang.Override + @JsonSetter(value = "like_count", nulls = Nulls.SKIP) + public _FinalStage likeCount(Optional likeCount) { + this.likeCount = likeCount; + return this; + } + + /** + *

The body of the forum post in Markdown format. Null if the post is paywalled and the current user does not have access.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(Nullable content) { + if (content.isNull()) { + this.content = null; + } else if (content.isEmpty()) { + this.content = Optional.empty(); + } else { + this.content = Optional.of(content.get()); + } + return this; + } + + /** + *

The body of the forum post in Markdown format. Null if the post is paywalled and the current user does not have access.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

The body of the forum post in Markdown format. Null if the post is paywalled and the current user does not have access.

+ */ + @java.lang.Override + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public _FinalStage content(Optional content) { + this.content = content; + return this; + } + + /** + *

All file attachments on this post, such as images, documents, and videos.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllAttachments(List attachments) { + if (attachments != null) { + this.attachments.addAll(attachments); + } + return this; + } + + /** + *

All file attachments on this post, such as images, documents, and videos.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAttachments(ForumPostAttachmentsItem attachments) { + this.attachments.add(attachments); + return this; + } + + /** + *

All file attachments on this post, such as images, documents, and videos.

+ */ + @java.lang.Override + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public _FinalStage attachments(List attachments) { + this.attachments.clear(); + if (attachments != null) { + this.attachments.addAll(attachments); + } + return this; + } + + @java.lang.Override + public ForumPost build() { + return new ForumPost( + attachments, + commentCount, + content, + createdAt, + id, + isEdited, + isPinned, + isPosterAdmin, + likeCount, + parentId, + title, + updatedAt, + user, + viewCount, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ForumPostAttachmentsItem.java b/src/main/java/com/whop/api/types/ForumPostAttachmentsItem.java new file mode 100644 index 00000000..bfd96bdd --- /dev/null +++ b/src/main/java/com/whop/api/types/ForumPostAttachmentsItem.java @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ForumPostAttachmentsItem.Builder.class) +public final class ForumPostAttachmentsItem { + private final Optional contentType; + + private final Optional filename; + + private final String id; + + private final Optional url; + + private final Map additionalProperties; + + private ForumPostAttachmentsItem( + Optional contentType, + Optional filename, + String id, + Optional url, + Map additionalProperties) { + this.contentType = contentType; + this.filename = filename; + this.id = id; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg. + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return The original filename of the uploaded attachment, including its file extension. + */ + @JsonIgnore + public Optional getFilename() { + if (filename == null) { + return Optional.empty(); + } + return filename; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filename") + private Optional _getFilename() { + return filename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ForumPostAttachmentsItem && equalTo((ForumPostAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ForumPostAttachmentsItem other) { + return contentType.equals(other.contentType) + && filename.equals(other.filename) + && id.equals(other.id) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contentType, this.filename, this.id, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(ForumPostAttachmentsItem other); + } + + public interface _FinalStage { + ForumPostAttachmentsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + _FinalStage filename(Optional filename); + + _FinalStage filename(String filename); + + _FinalStage filename(Nullable filename); + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional url = Optional.empty(); + + private Optional filename = Optional.empty(); + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ForumPostAttachmentsItem other) { + contentType(other.getContentType()); + filename(other.getFilename()); + id(other.getId()); + url(other.getUrl()); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(Nullable filename) { + if (filename.isNull()) { + this.filename = null; + } else if (filename.isEmpty()) { + this.filename = Optional.empty(); + } else { + this.filename = Optional.of(filename.get()); + } + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(String filename) { + this.filename = Optional.ofNullable(filename); + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + @java.lang.Override + @JsonSetter(value = "filename", nulls = Nulls.SKIP) + public _FinalStage filename(Optional filename) { + this.filename = filename; + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public ForumPostAttachmentsItem build() { + return new ForumPostAttachmentsItem(contentType, filename, id, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ForumPostListItem.java b/src/main/java/com/whop/api/types/ForumPostListItem.java new file mode 100644 index 00000000..40dcb475 --- /dev/null +++ b/src/main/java/com/whop/api/types/ForumPostListItem.java @@ -0,0 +1,832 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ForumPostListItem.Builder.class) +public final class ForumPostListItem { + private final List attachments; + + private final int commentCount; + + private final Optional content; + + private final OffsetDateTime createdAt; + + private final String id; + + private final boolean isEdited; + + private final boolean isPinned; + + private final boolean isPosterAdmin; + + private final Optional likeCount; + + private final Optional parentId; + + private final Optional title; + + private final OffsetDateTime updatedAt; + + private final ForumPostListItemUser user; + + private final Optional viewCount; + + private final Map additionalProperties; + + private ForumPostListItem( + List attachments, + int commentCount, + Optional content, + OffsetDateTime createdAt, + String id, + boolean isEdited, + boolean isPinned, + boolean isPosterAdmin, + Optional likeCount, + Optional parentId, + Optional title, + OffsetDateTime updatedAt, + ForumPostListItemUser user, + Optional viewCount, + Map additionalProperties) { + this.attachments = attachments; + this.commentCount = commentCount; + this.content = content; + this.createdAt = createdAt; + this.id = id; + this.isEdited = isEdited; + this.isPinned = isPinned; + this.isPosterAdmin = isPosterAdmin; + this.likeCount = likeCount; + this.parentId = parentId; + this.title = title; + this.updatedAt = updatedAt; + this.user = user; + this.viewCount = viewCount; + this.additionalProperties = additionalProperties; + } + + /** + * @return All file attachments on this post, such as images, documents, and videos. + */ + @JsonProperty("attachments") + public List getAttachments() { + return attachments; + } + + /** + * @return The total number of direct comments on this post. + */ + @JsonProperty("comment_count") + public int getCommentCount() { + return commentCount; + } + + /** + * @return The body of the forum post in Markdown format. Null if the post is paywalled and the current user does not have access. + */ + @JsonIgnore + public Optional getContent() { + if (content == null) { + return Optional.empty(); + } + return content; + } + + /** + * @return The time this post was created, as a Unix timestamp. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whether this post has been edited after its initial creation. + */ + @JsonProperty("is_edited") + public boolean getIsEdited() { + return isEdited; + } + + /** + * @return Whether this post is pinned to the top of the forum feed. + */ + @JsonProperty("is_pinned") + public boolean getIsPinned() { + return isPinned; + } + + /** + * @return Whether the author of this post is an admin of the company that owns the forum. + */ + @JsonProperty("is_poster_admin") + public boolean getIsPosterAdmin() { + return isPosterAdmin; + } + + /** + * @return The total number of like reactions this post has received. + */ + @JsonIgnore + public Optional getLikeCount() { + if (likeCount == null) { + return Optional.empty(); + } + return likeCount; + } + + /** + * @return The unique identifier of the parent post. Null if this is a top-level post. + */ + @JsonIgnore + public Optional getParentId() { + if (parentId == null) { + return Optional.empty(); + } + return parentId; + } + + /** + * @return The headline of the forum post. Null if the post has no title. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The time this post was last updated, as a Unix timestamp. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user who authored this forum post. + */ + @JsonProperty("user") + public ForumPostListItemUser getUser() { + return user; + } + + /** + * @return The total number of times this post has been viewed by users. + */ + @JsonIgnore + public Optional getViewCount() { + if (viewCount == null) { + return Optional.empty(); + } + return viewCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content") + private Optional _getContent() { + return content; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("like_count") + private Optional _getLikeCount() { + return likeCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("parent_id") + private Optional _getParentId() { + return parentId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("view_count") + private Optional _getViewCount() { + return viewCount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ForumPostListItem && equalTo((ForumPostListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ForumPostListItem other) { + return attachments.equals(other.attachments) + && commentCount == other.commentCount + && content.equals(other.content) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && isEdited == other.isEdited + && isPinned == other.isPinned + && isPosterAdmin == other.isPosterAdmin + && likeCount.equals(other.likeCount) + && parentId.equals(other.parentId) + && title.equals(other.title) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user) + && viewCount.equals(other.viewCount); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.attachments, + this.commentCount, + this.content, + this.createdAt, + this.id, + this.isEdited, + this.isPinned, + this.isPosterAdmin, + this.likeCount, + this.parentId, + this.title, + this.updatedAt, + this.user, + this.viewCount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CommentCountStage builder() { + return new Builder(); + } + + public interface CommentCountStage { + /** + *

The total number of direct comments on this post.

+ */ + CreatedAtStage commentCount(int commentCount); + + Builder from(ForumPostListItem other); + } + + public interface CreatedAtStage { + /** + *

The time this post was created, as a Unix timestamp.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + IsEditedStage id(@NotNull String id); + } + + public interface IsEditedStage { + /** + *

Whether this post has been edited after its initial creation.

+ */ + IsPinnedStage isEdited(boolean isEdited); + } + + public interface IsPinnedStage { + /** + *

Whether this post is pinned to the top of the forum feed.

+ */ + IsPosterAdminStage isPinned(boolean isPinned); + } + + public interface IsPosterAdminStage { + /** + *

Whether the author of this post is an admin of the company that owns the forum.

+ */ + UpdatedAtStage isPosterAdmin(boolean isPosterAdmin); + } + + public interface UpdatedAtStage { + /** + *

The time this post was last updated, as a Unix timestamp.

+ */ + UserStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UserStage { + /** + *

The user who authored this forum post.

+ */ + _FinalStage user(@NotNull ForumPostListItemUser user); + } + + public interface _FinalStage { + ForumPostListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

All file attachments on this post, such as images, documents, and videos.

+ */ + _FinalStage attachments(List attachments); + + _FinalStage addAttachments(ForumPostListItemAttachmentsItem attachments); + + _FinalStage addAllAttachments(List attachments); + + /** + *

The body of the forum post in Markdown format. Null if the post is paywalled and the current user does not have access.

+ */ + _FinalStage content(Optional content); + + _FinalStage content(String content); + + _FinalStage content(Nullable content); + + /** + *

The total number of like reactions this post has received.

+ */ + _FinalStage likeCount(Optional likeCount); + + _FinalStage likeCount(Integer likeCount); + + _FinalStage likeCount(Nullable likeCount); + + /** + *

The unique identifier of the parent post. Null if this is a top-level post.

+ */ + _FinalStage parentId(Optional parentId); + + _FinalStage parentId(String parentId); + + _FinalStage parentId(Nullable parentId); + + /** + *

The headline of the forum post. Null if the post has no title.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + + /** + *

The total number of times this post has been viewed by users.

+ */ + _FinalStage viewCount(Optional viewCount); + + _FinalStage viewCount(Integer viewCount); + + _FinalStage viewCount(Nullable viewCount); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CommentCountStage, + CreatedAtStage, + IdStage, + IsEditedStage, + IsPinnedStage, + IsPosterAdminStage, + UpdatedAtStage, + UserStage, + _FinalStage { + private int commentCount; + + private OffsetDateTime createdAt; + + private String id; + + private boolean isEdited; + + private boolean isPinned; + + private boolean isPosterAdmin; + + private OffsetDateTime updatedAt; + + private ForumPostListItemUser user; + + private Optional viewCount = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional parentId = Optional.empty(); + + private Optional likeCount = Optional.empty(); + + private Optional content = Optional.empty(); + + private List attachments = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ForumPostListItem other) { + attachments(other.getAttachments()); + commentCount(other.getCommentCount()); + content(other.getContent()); + createdAt(other.getCreatedAt()); + id(other.getId()); + isEdited(other.getIsEdited()); + isPinned(other.getIsPinned()); + isPosterAdmin(other.getIsPosterAdmin()); + likeCount(other.getLikeCount()); + parentId(other.getParentId()); + title(other.getTitle()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + viewCount(other.getViewCount()); + return this; + } + + /** + *

The total number of direct comments on this post.

+ *

The total number of direct comments on this post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("comment_count") + public CreatedAtStage commentCount(int commentCount) { + this.commentCount = commentCount; + return this; + } + + /** + *

The time this post was created, as a Unix timestamp.

+ *

The time this post was created, as a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsEditedStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether this post has been edited after its initial creation.

+ *

Whether this post has been edited after its initial creation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_edited") + public IsPinnedStage isEdited(boolean isEdited) { + this.isEdited = isEdited; + return this; + } + + /** + *

Whether this post is pinned to the top of the forum feed.

+ *

Whether this post is pinned to the top of the forum feed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_pinned") + public IsPosterAdminStage isPinned(boolean isPinned) { + this.isPinned = isPinned; + return this; + } + + /** + *

Whether the author of this post is an admin of the company that owns the forum.

+ *

Whether the author of this post is an admin of the company that owns the forum.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_poster_admin") + public UpdatedAtStage isPosterAdmin(boolean isPosterAdmin) { + this.isPosterAdmin = isPosterAdmin; + return this; + } + + /** + *

The time this post was last updated, as a Unix timestamp.

+ *

The time this post was last updated, as a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UserStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user who authored this forum post.

+ *

The user who authored this forum post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull ForumPostListItemUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

The total number of times this post has been viewed by users.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage viewCount(Nullable viewCount) { + if (viewCount.isNull()) { + this.viewCount = null; + } else if (viewCount.isEmpty()) { + this.viewCount = Optional.empty(); + } else { + this.viewCount = Optional.of(viewCount.get()); + } + return this; + } + + /** + *

The total number of times this post has been viewed by users.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage viewCount(Integer viewCount) { + this.viewCount = Optional.ofNullable(viewCount); + return this; + } + + /** + *

The total number of times this post has been viewed by users.

+ */ + @java.lang.Override + @JsonSetter(value = "view_count", nulls = Nulls.SKIP) + public _FinalStage viewCount(Optional viewCount) { + this.viewCount = viewCount; + return this; + } + + /** + *

The headline of the forum post. Null if the post has no title.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

The headline of the forum post. Null if the post has no title.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

The headline of the forum post. Null if the post has no title.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

The unique identifier of the parent post. Null if this is a top-level post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage parentId(Nullable parentId) { + if (parentId.isNull()) { + this.parentId = null; + } else if (parentId.isEmpty()) { + this.parentId = Optional.empty(); + } else { + this.parentId = Optional.of(parentId.get()); + } + return this; + } + + /** + *

The unique identifier of the parent post. Null if this is a top-level post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage parentId(String parentId) { + this.parentId = Optional.ofNullable(parentId); + return this; + } + + /** + *

The unique identifier of the parent post. Null if this is a top-level post.

+ */ + @java.lang.Override + @JsonSetter(value = "parent_id", nulls = Nulls.SKIP) + public _FinalStage parentId(Optional parentId) { + this.parentId = parentId; + return this; + } + + /** + *

The total number of like reactions this post has received.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage likeCount(Nullable likeCount) { + if (likeCount.isNull()) { + this.likeCount = null; + } else if (likeCount.isEmpty()) { + this.likeCount = Optional.empty(); + } else { + this.likeCount = Optional.of(likeCount.get()); + } + return this; + } + + /** + *

The total number of like reactions this post has received.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage likeCount(Integer likeCount) { + this.likeCount = Optional.ofNullable(likeCount); + return this; + } + + /** + *

The total number of like reactions this post has received.

+ */ + @java.lang.Override + @JsonSetter(value = "like_count", nulls = Nulls.SKIP) + public _FinalStage likeCount(Optional likeCount) { + this.likeCount = likeCount; + return this; + } + + /** + *

The body of the forum post in Markdown format. Null if the post is paywalled and the current user does not have access.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(Nullable content) { + if (content.isNull()) { + this.content = null; + } else if (content.isEmpty()) { + this.content = Optional.empty(); + } else { + this.content = Optional.of(content.get()); + } + return this; + } + + /** + *

The body of the forum post in Markdown format. Null if the post is paywalled and the current user does not have access.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

The body of the forum post in Markdown format. Null if the post is paywalled and the current user does not have access.

+ */ + @java.lang.Override + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public _FinalStage content(Optional content) { + this.content = content; + return this; + } + + /** + *

All file attachments on this post, such as images, documents, and videos.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllAttachments(List attachments) { + if (attachments != null) { + this.attachments.addAll(attachments); + } + return this; + } + + /** + *

All file attachments on this post, such as images, documents, and videos.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAttachments(ForumPostListItemAttachmentsItem attachments) { + this.attachments.add(attachments); + return this; + } + + /** + *

All file attachments on this post, such as images, documents, and videos.

+ */ + @java.lang.Override + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public _FinalStage attachments(List attachments) { + this.attachments.clear(); + if (attachments != null) { + this.attachments.addAll(attachments); + } + return this; + } + + @java.lang.Override + public ForumPostListItem build() { + return new ForumPostListItem( + attachments, + commentCount, + content, + createdAt, + id, + isEdited, + isPinned, + isPosterAdmin, + likeCount, + parentId, + title, + updatedAt, + user, + viewCount, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ForumPostListItemAttachmentsItem.java b/src/main/java/com/whop/api/types/ForumPostListItemAttachmentsItem.java new file mode 100644 index 00000000..e0f11547 --- /dev/null +++ b/src/main/java/com/whop/api/types/ForumPostListItemAttachmentsItem.java @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ForumPostListItemAttachmentsItem.Builder.class) +public final class ForumPostListItemAttachmentsItem { + private final Optional contentType; + + private final Optional filename; + + private final String id; + + private final Optional url; + + private final Map additionalProperties; + + private ForumPostListItemAttachmentsItem( + Optional contentType, + Optional filename, + String id, + Optional url, + Map additionalProperties) { + this.contentType = contentType; + this.filename = filename; + this.id = id; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg. + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return The original filename of the uploaded attachment, including its file extension. + */ + @JsonIgnore + public Optional getFilename() { + if (filename == null) { + return Optional.empty(); + } + return filename; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filename") + private Optional _getFilename() { + return filename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ForumPostListItemAttachmentsItem && equalTo((ForumPostListItemAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ForumPostListItemAttachmentsItem other) { + return contentType.equals(other.contentType) + && filename.equals(other.filename) + && id.equals(other.id) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contentType, this.filename, this.id, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(ForumPostListItemAttachmentsItem other); + } + + public interface _FinalStage { + ForumPostListItemAttachmentsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + _FinalStage filename(Optional filename); + + _FinalStage filename(String filename); + + _FinalStage filename(Nullable filename); + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional url = Optional.empty(); + + private Optional filename = Optional.empty(); + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ForumPostListItemAttachmentsItem other) { + contentType(other.getContentType()); + filename(other.getFilename()); + id(other.getId()); + url(other.getUrl()); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(Nullable filename) { + if (filename.isNull()) { + this.filename = null; + } else if (filename.isEmpty()) { + this.filename = Optional.empty(); + } else { + this.filename = Optional.of(filename.get()); + } + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(String filename) { + this.filename = Optional.ofNullable(filename); + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + @java.lang.Override + @JsonSetter(value = "filename", nulls = Nulls.SKIP) + public _FinalStage filename(Optional filename) { + this.filename = filename; + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public ForumPostListItemAttachmentsItem build() { + return new ForumPostListItemAttachmentsItem(contentType, filename, id, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ForumPostListItemUser.java b/src/main/java/com/whop/api/types/ForumPostListItemUser.java new file mode 100644 index 00000000..1d20a563 --- /dev/null +++ b/src/main/java/com/whop/api/types/ForumPostListItemUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ForumPostListItemUser.Builder.class) +public final class ForumPostListItemUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private ForumPostListItemUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ForumPostListItemUser && equalTo((ForumPostListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ForumPostListItemUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(ForumPostListItemUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + ForumPostListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ForumPostListItemUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ForumPostListItemUser build() { + return new ForumPostListItemUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ForumPostUser.java b/src/main/java/com/whop/api/types/ForumPostUser.java new file mode 100644 index 00000000..5e914a38 --- /dev/null +++ b/src/main/java/com/whop/api/types/ForumPostUser.java @@ -0,0 +1,235 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ForumPostUser.Builder.class) +public final class ForumPostUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private ForumPostUser(String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ForumPostUser && equalTo((ForumPostUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ForumPostUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(ForumPostUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + ForumPostUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ForumPostUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ForumPostUser build() { + return new ForumPostUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ForumPostVisibilityTypes.java b/src/main/java/com/whop/api/types/ForumPostVisibilityTypes.java new file mode 100644 index 00000000..bc59dbd2 --- /dev/null +++ b/src/main/java/com/whop/api/types/ForumPostVisibilityTypes.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ForumPostVisibilityTypes { + public static final ForumPostVisibilityTypes MEMBERS_ONLY = + new ForumPostVisibilityTypes(Value.MEMBERS_ONLY, "members_only"); + + public static final ForumPostVisibilityTypes GLOBALLY_VISIBLE = + new ForumPostVisibilityTypes(Value.GLOBALLY_VISIBLE, "globally_visible"); + + private final Value value; + + private final String string; + + ForumPostVisibilityTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ForumPostVisibilityTypes + && this.string.equals(((ForumPostVisibilityTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MEMBERS_ONLY: + return visitor.visitMembersOnly(); + case GLOBALLY_VISIBLE: + return visitor.visitGloballyVisible(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ForumPostVisibilityTypes valueOf(String value) { + switch (value) { + case "members_only": + return MEMBERS_ONLY; + case "globally_visible": + return GLOBALLY_VISIBLE; + default: + return new ForumPostVisibilityTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + MEMBERS_ONLY, + + GLOBALLY_VISIBLE, + + UNKNOWN + } + + public interface Visitor { + T visitMembersOnly(); + + T visitGloballyVisible(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ForumWhoCanCommentTypes.java b/src/main/java/com/whop/api/types/ForumWhoCanCommentTypes.java new file mode 100644 index 00000000..e6d8fe74 --- /dev/null +++ b/src/main/java/com/whop/api/types/ForumWhoCanCommentTypes.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ForumWhoCanCommentTypes { + public static final ForumWhoCanCommentTypes ADMINS = new ForumWhoCanCommentTypes(Value.ADMINS, "admins"); + + public static final ForumWhoCanCommentTypes EVERYONE = new ForumWhoCanCommentTypes(Value.EVERYONE, "everyone"); + + private final Value value; + + private final String string; + + ForumWhoCanCommentTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ForumWhoCanCommentTypes + && this.string.equals(((ForumWhoCanCommentTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ADMINS: + return visitor.visitAdmins(); + case EVERYONE: + return visitor.visitEveryone(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ForumWhoCanCommentTypes valueOf(String value) { + switch (value) { + case "admins": + return ADMINS; + case "everyone": + return EVERYONE; + default: + return new ForumWhoCanCommentTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + EVERYONE, + + ADMINS, + + UNKNOWN + } + + public interface Visitor { + T visitEveryone(); + + T visitAdmins(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ForumWhoCanPostTypes.java b/src/main/java/com/whop/api/types/ForumWhoCanPostTypes.java new file mode 100644 index 00000000..28caf0f5 --- /dev/null +++ b/src/main/java/com/whop/api/types/ForumWhoCanPostTypes.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ForumWhoCanPostTypes { + public static final ForumWhoCanPostTypes ADMINS = new ForumWhoCanPostTypes(Value.ADMINS, "admins"); + + public static final ForumWhoCanPostTypes EVERYONE = new ForumWhoCanPostTypes(Value.EVERYONE, "everyone"); + + private final Value value; + + private final String string; + + ForumWhoCanPostTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ForumWhoCanPostTypes && this.string.equals(((ForumWhoCanPostTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ADMINS: + return visitor.visitAdmins(); + case EVERYONE: + return visitor.visitEveryone(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ForumWhoCanPostTypes valueOf(String value) { + switch (value) { + case "admins": + return ADMINS; + case "everyone": + return EVERYONE; + default: + return new ForumWhoCanPostTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + EVERYONE, + + ADMINS, + + UNKNOWN + } + + public interface Visitor { + T visitEveryone(); + + T visitAdmins(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/FriendlyReceiptStatus.java b/src/main/java/com/whop/api/types/FriendlyReceiptStatus.java new file mode 100644 index 00000000..299a9bfa --- /dev/null +++ b/src/main/java/com/whop/api/types/FriendlyReceiptStatus.java @@ -0,0 +1,362 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class FriendlyReceiptStatus { + public static final FriendlyReceiptStatus FAILED = new FriendlyReceiptStatus(Value.FAILED, "failed"); + + public static final FriendlyReceiptStatus DISPUTE_WARNING_NEEDS_RESPONSE = + new FriendlyReceiptStatus(Value.DISPUTE_WARNING_NEEDS_RESPONSE, "dispute_warning_needs_response"); + + public static final FriendlyReceiptStatus DISPUTE_NEEDS_RESPONSE = + new FriendlyReceiptStatus(Value.DISPUTE_NEEDS_RESPONSE, "dispute_needs_response"); + + public static final FriendlyReceiptStatus REFUNDED = new FriendlyReceiptStatus(Value.REFUNDED, "refunded"); + + public static final FriendlyReceiptStatus AUTO_REFUNDED = + new FriendlyReceiptStatus(Value.AUTO_REFUNDED, "auto_refunded"); + + public static final FriendlyReceiptStatus DISPUTE_UNDER_REVIEW = + new FriendlyReceiptStatus(Value.DISPUTE_UNDER_REVIEW, "dispute_under_review"); + + public static final FriendlyReceiptStatus DRAFTED = new FriendlyReceiptStatus(Value.DRAFTED, "drafted"); + + public static final FriendlyReceiptStatus UNCOLLECTIBLE = + new FriendlyReceiptStatus(Value.UNCOLLECTIBLE, "uncollectible"); + + public static final FriendlyReceiptStatus PENDING = new FriendlyReceiptStatus(Value.PENDING, "pending"); + + public static final FriendlyReceiptStatus DISPUTE_WARNING_UNDER_REVIEW = + new FriendlyReceiptStatus(Value.DISPUTE_WARNING_UNDER_REVIEW, "dispute_warning_under_review"); + + public static final FriendlyReceiptStatus DISPUTE_LOST = + new FriendlyReceiptStatus(Value.DISPUTE_LOST, "dispute_lost"); + + public static final FriendlyReceiptStatus PARTIALLY_REFUNDED = + new FriendlyReceiptStatus(Value.PARTIALLY_REFUNDED, "partially_refunded"); + + public static final FriendlyReceiptStatus DISPUTE_WON = new FriendlyReceiptStatus(Value.DISPUTE_WON, "dispute_won"); + + public static final FriendlyReceiptStatus RESOLUTION_LOST = + new FriendlyReceiptStatus(Value.RESOLUTION_LOST, "resolution_lost"); + + public static final FriendlyReceiptStatus PRICE_TOO_LOW = + new FriendlyReceiptStatus(Value.PRICE_TOO_LOW, "price_too_low"); + + public static final FriendlyReceiptStatus INCOMPLETE = new FriendlyReceiptStatus(Value.INCOMPLETE, "incomplete"); + + public static final FriendlyReceiptStatus RESOLUTION_UNDER_REVIEW = + new FriendlyReceiptStatus(Value.RESOLUTION_UNDER_REVIEW, "resolution_under_review"); + + public static final FriendlyReceiptStatus UNRESOLVED = new FriendlyReceiptStatus(Value.UNRESOLVED, "unresolved"); + + public static final FriendlyReceiptStatus OPEN_DISPUTE = + new FriendlyReceiptStatus(Value.OPEN_DISPUTE, "open_dispute"); + + public static final FriendlyReceiptStatus PAST_DUE = new FriendlyReceiptStatus(Value.PAST_DUE, "past_due"); + + public static final FriendlyReceiptStatus RESOLUTION_WON = + new FriendlyReceiptStatus(Value.RESOLUTION_WON, "resolution_won"); + + public static final FriendlyReceiptStatus DISPUTE_CLOSED = + new FriendlyReceiptStatus(Value.DISPUTE_CLOSED, "dispute_closed"); + + public static final FriendlyReceiptStatus SUCCEEDED = new FriendlyReceiptStatus(Value.SUCCEEDED, "succeeded"); + + public static final FriendlyReceiptStatus OPEN_RESOLUTION = + new FriendlyReceiptStatus(Value.OPEN_RESOLUTION, "open_resolution"); + + public static final FriendlyReceiptStatus DISPUTE_WARNING = + new FriendlyReceiptStatus(Value.DISPUTE_WARNING, "dispute_warning"); + + public static final FriendlyReceiptStatus CANCELED = new FriendlyReceiptStatus(Value.CANCELED, "canceled"); + + public static final FriendlyReceiptStatus DISPUTE_WARNING_CLOSED = + new FriendlyReceiptStatus(Value.DISPUTE_WARNING_CLOSED, "dispute_warning_closed"); + + public static final FriendlyReceiptStatus RESOLUTION_NEEDS_RESPONSE = + new FriendlyReceiptStatus(Value.RESOLUTION_NEEDS_RESPONSE, "resolution_needs_response"); + + private final Value value; + + private final String string; + + FriendlyReceiptStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof FriendlyReceiptStatus + && this.string.equals(((FriendlyReceiptStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case DISPUTE_WARNING_NEEDS_RESPONSE: + return visitor.visitDisputeWarningNeedsResponse(); + case DISPUTE_NEEDS_RESPONSE: + return visitor.visitDisputeNeedsResponse(); + case REFUNDED: + return visitor.visitRefunded(); + case AUTO_REFUNDED: + return visitor.visitAutoRefunded(); + case DISPUTE_UNDER_REVIEW: + return visitor.visitDisputeUnderReview(); + case DRAFTED: + return visitor.visitDrafted(); + case UNCOLLECTIBLE: + return visitor.visitUncollectible(); + case PENDING: + return visitor.visitPending(); + case DISPUTE_WARNING_UNDER_REVIEW: + return visitor.visitDisputeWarningUnderReview(); + case DISPUTE_LOST: + return visitor.visitDisputeLost(); + case PARTIALLY_REFUNDED: + return visitor.visitPartiallyRefunded(); + case DISPUTE_WON: + return visitor.visitDisputeWon(); + case RESOLUTION_LOST: + return visitor.visitResolutionLost(); + case PRICE_TOO_LOW: + return visitor.visitPriceTooLow(); + case INCOMPLETE: + return visitor.visitIncomplete(); + case RESOLUTION_UNDER_REVIEW: + return visitor.visitResolutionUnderReview(); + case UNRESOLVED: + return visitor.visitUnresolved(); + case OPEN_DISPUTE: + return visitor.visitOpenDispute(); + case PAST_DUE: + return visitor.visitPastDue(); + case RESOLUTION_WON: + return visitor.visitResolutionWon(); + case DISPUTE_CLOSED: + return visitor.visitDisputeClosed(); + case SUCCEEDED: + return visitor.visitSucceeded(); + case OPEN_RESOLUTION: + return visitor.visitOpenResolution(); + case DISPUTE_WARNING: + return visitor.visitDisputeWarning(); + case CANCELED: + return visitor.visitCanceled(); + case DISPUTE_WARNING_CLOSED: + return visitor.visitDisputeWarningClosed(); + case RESOLUTION_NEEDS_RESPONSE: + return visitor.visitResolutionNeedsResponse(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static FriendlyReceiptStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "dispute_warning_needs_response": + return DISPUTE_WARNING_NEEDS_RESPONSE; + case "dispute_needs_response": + return DISPUTE_NEEDS_RESPONSE; + case "refunded": + return REFUNDED; + case "auto_refunded": + return AUTO_REFUNDED; + case "dispute_under_review": + return DISPUTE_UNDER_REVIEW; + case "drafted": + return DRAFTED; + case "uncollectible": + return UNCOLLECTIBLE; + case "pending": + return PENDING; + case "dispute_warning_under_review": + return DISPUTE_WARNING_UNDER_REVIEW; + case "dispute_lost": + return DISPUTE_LOST; + case "partially_refunded": + return PARTIALLY_REFUNDED; + case "dispute_won": + return DISPUTE_WON; + case "resolution_lost": + return RESOLUTION_LOST; + case "price_too_low": + return PRICE_TOO_LOW; + case "incomplete": + return INCOMPLETE; + case "resolution_under_review": + return RESOLUTION_UNDER_REVIEW; + case "unresolved": + return UNRESOLVED; + case "open_dispute": + return OPEN_DISPUTE; + case "past_due": + return PAST_DUE; + case "resolution_won": + return RESOLUTION_WON; + case "dispute_closed": + return DISPUTE_CLOSED; + case "succeeded": + return SUCCEEDED; + case "open_resolution": + return OPEN_RESOLUTION; + case "dispute_warning": + return DISPUTE_WARNING; + case "canceled": + return CANCELED; + case "dispute_warning_closed": + return DISPUTE_WARNING_CLOSED; + case "resolution_needs_response": + return RESOLUTION_NEEDS_RESPONSE; + default: + return new FriendlyReceiptStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + SUCCEEDED, + + PENDING, + + FAILED, + + PAST_DUE, + + CANCELED, + + PRICE_TOO_LOW, + + UNCOLLECTIBLE, + + REFUNDED, + + AUTO_REFUNDED, + + PARTIALLY_REFUNDED, + + DISPUTE_WARNING, + + DISPUTE_NEEDS_RESPONSE, + + DISPUTE_WARNING_NEEDS_RESPONSE, + + RESOLUTION_NEEDS_RESPONSE, + + DISPUTE_UNDER_REVIEW, + + DISPUTE_WARNING_UNDER_REVIEW, + + RESOLUTION_UNDER_REVIEW, + + DISPUTE_WON, + + DISPUTE_WARNING_CLOSED, + + RESOLUTION_WON, + + DISPUTE_LOST, + + DISPUTE_CLOSED, + + RESOLUTION_LOST, + + DRAFTED, + + INCOMPLETE, + + UNRESOLVED, + + OPEN_DISPUTE, + + OPEN_RESOLUTION, + + UNKNOWN + } + + public interface Visitor { + T visitSucceeded(); + + T visitPending(); + + T visitFailed(); + + T visitPastDue(); + + T visitCanceled(); + + T visitPriceTooLow(); + + T visitUncollectible(); + + T visitRefunded(); + + T visitAutoRefunded(); + + T visitPartiallyRefunded(); + + T visitDisputeWarning(); + + T visitDisputeNeedsResponse(); + + T visitDisputeWarningNeedsResponse(); + + T visitResolutionNeedsResponse(); + + T visitDisputeUnderReview(); + + T visitDisputeWarningUnderReview(); + + T visitResolutionUnderReview(); + + T visitDisputeWon(); + + T visitDisputeWarningClosed(); + + T visitResolutionWon(); + + T visitDisputeLost(); + + T visitDisputeClosed(); + + T visitResolutionLost(); + + T visitDrafted(); + + T visitIncomplete(); + + T visitUnresolved(); + + T visitOpenDispute(); + + T visitOpenResolution(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/FutureUsageTypes.java b/src/main/java/com/whop/api/types/FutureUsageTypes.java new file mode 100644 index 00000000..586a398d --- /dev/null +++ b/src/main/java/com/whop/api/types/FutureUsageTypes.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class FutureUsageTypes { + public static final FutureUsageTypes ON_SESSION = new FutureUsageTypes(Value.ON_SESSION, "on_session"); + + public static final FutureUsageTypes OFF_SESSION = new FutureUsageTypes(Value.OFF_SESSION, "off_session"); + + private final Value value; + + private final String string; + + FutureUsageTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof FutureUsageTypes && this.string.equals(((FutureUsageTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ON_SESSION: + return visitor.visitOnSession(); + case OFF_SESSION: + return visitor.visitOffSession(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static FutureUsageTypes valueOf(String value) { + switch (value) { + case "on_session": + return ON_SESSION; + case "off_session": + return OFF_SESSION; + default: + return new FutureUsageTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + OFF_SESSION, + + ON_SESSION, + + UNKNOWN + } + + public interface Visitor { + T visitOffSession(); + + T visitOnSession(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/GlobalAffiliateStatuses.java b/src/main/java/com/whop/api/types/GlobalAffiliateStatuses.java new file mode 100644 index 00000000..e09d0184 --- /dev/null +++ b/src/main/java/com/whop/api/types/GlobalAffiliateStatuses.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class GlobalAffiliateStatuses { + public static final GlobalAffiliateStatuses ENABLED = new GlobalAffiliateStatuses(Value.ENABLED, "enabled"); + + public static final GlobalAffiliateStatuses DISABLED = new GlobalAffiliateStatuses(Value.DISABLED, "disabled"); + + private final Value value; + + private final String string; + + GlobalAffiliateStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof GlobalAffiliateStatuses + && this.string.equals(((GlobalAffiliateStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ENABLED: + return visitor.visitEnabled(); + case DISABLED: + return visitor.visitDisabled(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static GlobalAffiliateStatuses valueOf(String value) { + switch (value) { + case "enabled": + return ENABLED; + case "disabled": + return DISABLED; + default: + return new GlobalAffiliateStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + ENABLED, + + DISABLED, + + UNKNOWN + } + + public interface Visitor { + T visitEnabled(); + + T visitDisabled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/GrantableAuthorizedUserRoles.java b/src/main/java/com/whop/api/types/GrantableAuthorizedUserRoles.java new file mode 100644 index 00000000..d3356b8e --- /dev/null +++ b/src/main/java/com/whop/api/types/GrantableAuthorizedUserRoles.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class GrantableAuthorizedUserRoles { + public static final GrantableAuthorizedUserRoles OWNER = new GrantableAuthorizedUserRoles(Value.OWNER, "owner"); + + public static final GrantableAuthorizedUserRoles ADMIN = new GrantableAuthorizedUserRoles(Value.ADMIN, "admin"); + + public static final GrantableAuthorizedUserRoles SALES_MANAGER = + new GrantableAuthorizedUserRoles(Value.SALES_MANAGER, "sales_manager"); + + public static final GrantableAuthorizedUserRoles MODERATOR = + new GrantableAuthorizedUserRoles(Value.MODERATOR, "moderator"); + + public static final GrantableAuthorizedUserRoles ADVERTISER = + new GrantableAuthorizedUserRoles(Value.ADVERTISER, "advertiser"); + + private final Value value; + + private final String string; + + GrantableAuthorizedUserRoles(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof GrantableAuthorizedUserRoles + && this.string.equals(((GrantableAuthorizedUserRoles) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case OWNER: + return visitor.visitOwner(); + case ADMIN: + return visitor.visitAdmin(); + case SALES_MANAGER: + return visitor.visitSalesManager(); + case MODERATOR: + return visitor.visitModerator(); + case ADVERTISER: + return visitor.visitAdvertiser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static GrantableAuthorizedUserRoles valueOf(String value) { + switch (value) { + case "owner": + return OWNER; + case "admin": + return ADMIN; + case "sales_manager": + return SALES_MANAGER; + case "moderator": + return MODERATOR; + case "advertiser": + return ADVERTISER; + default: + return new GrantableAuthorizedUserRoles(Value.UNKNOWN, value); + } + } + + public enum Value { + OWNER, + + ADMIN, + + SALES_MANAGER, + + MODERATOR, + + ADVERTISER, + + UNKNOWN + } + + public interface Visitor { + T visitOwner(); + + T visitAdmin(); + + T visitSalesManager(); + + T visitModerator(); + + T visitAdvertiser(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Granularities.java b/src/main/java/com/whop/api/types/Granularities.java new file mode 100644 index 00000000..2be59702 --- /dev/null +++ b/src/main/java/com/whop/api/types/Granularities.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class Granularities { + public static final Granularities HOURLY = new Granularities(Value.HOURLY, "hourly"); + + public static final Granularities DAILY = new Granularities(Value.DAILY, "daily"); + + public static final Granularities WEEKLY = new Granularities(Value.WEEKLY, "weekly"); + + public static final Granularities MONTHLY = new Granularities(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + Granularities(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof Granularities && this.string.equals(((Granularities) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HOURLY: + return visitor.visitHourly(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static Granularities valueOf(String value) { + switch (value) { + case "hourly": + return HOURLY; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new Granularities(Value.UNKNOWN, value); + } + } + + public enum Value { + HOURLY, + + DAILY, + + WEEKLY, + + MONTHLY, + + UNKNOWN + } + + public interface Visitor { + T visitHourly(); + + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/IPayment.java b/src/main/java/com/whop/api/types/IPayment.java new file mode 100644 index 00000000..b51a6cd9 --- /dev/null +++ b/src/main/java/com/whop/api/types/IPayment.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +public interface IPayment { + double getAmountAfterFees(); + + Optional getApplicationFee(); + + boolean getAutoRefunded(); + + Optional getBillingAddress(); + + Optional getBillingReason(); + + Optional getCardBrand(); + + Optional getCardExpMonth(); + + Optional getCardExpYear(); + + Optional getCardLast4(); + + Optional getCheckoutConfigurationId(); + + Optional getCompany(); + + OffsetDateTime getCreatedAt(); + + Currencies getCurrency(); + + Optional getCustomerPhone(); + + Optional getDeclineCode(); + + Optional getDisputeAlertedAt(); + + Optional> getDisputes(); + + Optional getFailureMessage(); + + Optional getFinancingInstallmentsCount(); + + List getFinancingTransactions(); + + String getId(); + + Optional getLastPaymentAttempt(); + + Optional getMember(); + + Optional getMembership(); + + Optional> getMetadata(); + + Optional getNeedsTracking(); + + Optional getNextPaymentAttempt(); + + Optional getPaidAt(); + + Optional getPaymentInstrument(); + + Optional getPaymentMethod(); + + Optional getPaymentMethodType(); + + Optional getPaymentsFailed(); + + Optional getPlan(); + + Optional getProduct(); + + Optional getPromoCode(); + + boolean getRefundable(); + + Optional getRefundedAmount(); + + Optional getRefundedAt(); + + List getRefunds(); + + Optional> getResolutions(); + + boolean getRetryable(); + + Optional getRiskScore(); + + Optional> getRiskSignals(); + + double getSettlementAmount(); + + Currencies getSettlementCurrency(); + + Optional getSettlementExchangeRate(); + + Optional getSettlementTimeAt(); + + Optional getShipment(); + + Optional getShippingAddress(); + + Optional getStatus(); + + FriendlyReceiptStatus getSubstatus(); + + Optional getSubtotal(); + + Optional getTaxAmount(); + + Optional getTaxBehavior(); + + Optional getTaxRefundedAmount(); + + boolean getThreeDsVerified(); + + Optional getTotal(); + + OffsetDateTime getUpdatedAt(); + + Optional getUsdTotal(); + + Optional getUser(); + + Optional getVerificationChecks(); + + boolean getVoidable(); +} diff --git a/src/main/java/com/whop/api/types/IdentityProfile.java b/src/main/java/com/whop/api/types/IdentityProfile.java new file mode 100644 index 00000000..f23c7f37 --- /dev/null +++ b/src/main/java/com/whop/api/types/IdentityProfile.java @@ -0,0 +1,1216 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = IdentityProfile.Builder.class) +public final class IdentityProfile { + private final Optional businessAddress; + + private final Optional businessName; + + private final Optional businessStructure; + + private final Optional country; + + private final OffsetDateTime createdAt; + + private final Optional dateOfBirth; + + private final Optional email; + + private final Optional firstName; + + private final String id; + + private final Optional lastName; + + private final List linkedCompanies; + + private final PayoutAccountCalculatedStatuses payoutStatus; + + private final boolean payoutsEnabled; + + private final Optional personalAddress; + + private final Optional phone; + + private final String profileType; + + private final IdentityProfileStatuses status; + + private final OffsetDateTime updatedAt; + + private final List verifications; + + private final Map additionalProperties; + + private IdentityProfile( + Optional businessAddress, + Optional businessName, + Optional businessStructure, + Optional country, + OffsetDateTime createdAt, + Optional dateOfBirth, + Optional email, + Optional firstName, + String id, + Optional lastName, + List linkedCompanies, + PayoutAccountCalculatedStatuses payoutStatus, + boolean payoutsEnabled, + Optional personalAddress, + Optional phone, + String profileType, + IdentityProfileStatuses status, + OffsetDateTime updatedAt, + List verifications, + Map additionalProperties) { + this.businessAddress = businessAddress; + this.businessName = businessName; + this.businessStructure = businessStructure; + this.country = country; + this.createdAt = createdAt; + this.dateOfBirth = dateOfBirth; + this.email = email; + this.firstName = firstName; + this.id = id; + this.lastName = lastName; + this.linkedCompanies = linkedCompanies; + this.payoutStatus = payoutStatus; + this.payoutsEnabled = payoutsEnabled; + this.personalAddress = personalAddress; + this.phone = phone; + this.profileType = profileType; + this.status = status; + this.updatedAt = updatedAt; + this.verifications = verifications; + this.additionalProperties = additionalProperties; + } + + /** + * @return Registered business address reported by the identity provider. Present on business profiles. + */ + @JsonIgnore + public Optional getBusinessAddress() { + if (businessAddress == null) { + return Optional.empty(); + } + return businessAddress; + } + + /** + * @return Business entity name. Present on business profiles. + */ + @JsonIgnore + public Optional getBusinessName() { + if (businessName == null) { + return Optional.empty(); + } + return businessName; + } + + /** + * @return Reported legal structure of a business profile (e.g. corp, llc). Provider-specific values; present on business profiles. + */ + @JsonIgnore + public Optional getBusinessStructure() { + if (businessStructure == null) { + return Optional.empty(); + } + return businessStructure; + } + + /** + * @return ISO 3166-1 alpha-2 country code reported by the identity provider, such as US or GB. For individuals this is the country of citizenship or residence; for businesses, the country of incorporation. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return When the identity profile was first created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return ISO date (YYYY-MM-DD) reported by the identity provider. Present on individual profiles. + */ + @JsonIgnore + public Optional getDateOfBirth() { + if (dateOfBirth == null) { + return Optional.empty(); + } + return dateOfBirth; + } + + /** + * @return Email address reported by the identity provider. Typically present on individual profiles. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return Individual's first name. + */ + @JsonIgnore + public Optional getFirstName() { + if (firstName == null) { + return Optional.empty(); + } + return firstName; + } + + /** + * @return The tag of the identity profile (idpf_xxx). + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Individual's last name. + */ + @JsonIgnore + public Optional getLastName() { + if (lastName == null) { + return Optional.empty(); + } + return lastName; + } + + /** + * @return The companies this identity profile is currently linked to. Only populated for direct Whop user sessions; always empty when authenticated via API key, app, or OAuth scope (a single identity can be linked to companies the calling platform is not entitled to see). + */ + @JsonProperty("linked_companies") + public List getLinkedCompanies() { + return linkedCompanies; + } + + /** + * @return Progress of payout-account setup for this profile, independent of holds. connected means onboarding is complete; a connected status paired with payouts_enabled: false indicates an active account restriction rather than incomplete setup. + */ + @JsonProperty("payout_status") + public PayoutAccountCalculatedStatuses getPayoutStatus() { + return payoutStatus; + } + + /** + * @return Whether this profile can receive payouts right now. True only when payout onboarding is complete and no payout holds are active on the linked account. Treat this as the single source of truth for payout readiness. + */ + @JsonProperty("payouts_enabled") + public boolean getPayoutsEnabled() { + return payoutsEnabled; + } + + /** + * @return Residential address reported by the identity provider. Present on individual profiles. + */ + @JsonIgnore + public Optional getPersonalAddress() { + if (personalAddress == null) { + return Optional.empty(); + } + return personalAddress; + } + + /** + * @return Phone number reported by the identity provider. Typically present on individual profiles. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + /** + * @return Whether this is an 'individual' or 'business' profile. + */ + @JsonProperty("profile_type") + public String getProfileType() { + return profileType; + } + + /** + * @return Derived verification status across all linked verifications. Returns action_required whenever the profile has an open request for information (whether a verification, payout, or audit RFI) — i.e. the merchant must submit something before it is in good standing. + */ + @JsonProperty("status") + public IdentityProfileStatuses getStatus() { + return status; + } + + /** + * @return When the identity profile was last synced from a verification. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return All verification attempts attached to this identity profile, ordered most-recent first. + */ + @JsonProperty("verifications") + public List getVerifications() { + return verifications; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_address") + private Optional _getBusinessAddress() { + return businessAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_name") + private Optional _getBusinessName() { + return businessName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_structure") + private Optional _getBusinessStructure() { + return businessStructure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("date_of_birth") + private Optional _getDateOfBirth() { + return dateOfBirth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_name") + private Optional _getFirstName() { + return firstName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_name") + private Optional _getLastName() { + return lastName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("personal_address") + private Optional _getPersonalAddress() { + return personalAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IdentityProfile && equalTo((IdentityProfile) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(IdentityProfile other) { + return businessAddress.equals(other.businessAddress) + && businessName.equals(other.businessName) + && businessStructure.equals(other.businessStructure) + && country.equals(other.country) + && createdAt.equals(other.createdAt) + && dateOfBirth.equals(other.dateOfBirth) + && email.equals(other.email) + && firstName.equals(other.firstName) + && id.equals(other.id) + && lastName.equals(other.lastName) + && linkedCompanies.equals(other.linkedCompanies) + && payoutStatus.equals(other.payoutStatus) + && payoutsEnabled == other.payoutsEnabled + && personalAddress.equals(other.personalAddress) + && phone.equals(other.phone) + && profileType.equals(other.profileType) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt) + && verifications.equals(other.verifications); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.businessAddress, + this.businessName, + this.businessStructure, + this.country, + this.createdAt, + this.dateOfBirth, + this.email, + this.firstName, + this.id, + this.lastName, + this.linkedCompanies, + this.payoutStatus, + this.payoutsEnabled, + this.personalAddress, + this.phone, + this.profileType, + this.status, + this.updatedAt, + this.verifications); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the identity profile was first created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(IdentityProfile other); + } + + public interface IdStage { + /** + *

The tag of the identity profile (idpf_xxx).

+ */ + PayoutStatusStage id(@NotNull String id); + } + + public interface PayoutStatusStage { + /** + *

Progress of payout-account setup for this profile, independent of holds. connected means onboarding is complete; a connected status paired with payouts_enabled: false indicates an active account restriction rather than incomplete setup.

+ */ + PayoutsEnabledStage payoutStatus(@NotNull PayoutAccountCalculatedStatuses payoutStatus); + } + + public interface PayoutsEnabledStage { + /** + *

Whether this profile can receive payouts right now. True only when payout onboarding is complete and no payout holds are active on the linked account. Treat this as the single source of truth for payout readiness.

+ */ + ProfileTypeStage payoutsEnabled(boolean payoutsEnabled); + } + + public interface ProfileTypeStage { + /** + *

Whether this is an 'individual' or 'business' profile.

+ */ + StatusStage profileType(@NotNull String profileType); + } + + public interface StatusStage { + /** + *

Derived verification status across all linked verifications. Returns action_required whenever the profile has an open request for information (whether a verification, payout, or audit RFI) — i.e. the merchant must submit something before it is in good standing.

+ */ + UpdatedAtStage status(@NotNull IdentityProfileStatuses status); + } + + public interface UpdatedAtStage { + /** + *

When the identity profile was last synced from a verification.

+ */ + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + IdentityProfile build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Registered business address reported by the identity provider. Present on business profiles.

+ */ + _FinalStage businessAddress(Optional businessAddress); + + _FinalStage businessAddress(IdentityProfileBusinessAddress businessAddress); + + _FinalStage businessAddress(Nullable businessAddress); + + /** + *

Business entity name. Present on business profiles.

+ */ + _FinalStage businessName(Optional businessName); + + _FinalStage businessName(String businessName); + + _FinalStage businessName(Nullable businessName); + + /** + *

Reported legal structure of a business profile (e.g. corp, llc). Provider-specific values; present on business profiles.

+ */ + _FinalStage businessStructure(Optional businessStructure); + + _FinalStage businessStructure(String businessStructure); + + _FinalStage businessStructure(Nullable businessStructure); + + /** + *

ISO 3166-1 alpha-2 country code reported by the identity provider, such as US or GB. For individuals this is the country of citizenship or residence; for businesses, the country of incorporation.

+ */ + _FinalStage country(Optional country); + + _FinalStage country(String country); + + _FinalStage country(Nullable country); + + /** + *

ISO date (YYYY-MM-DD) reported by the identity provider. Present on individual profiles.

+ */ + _FinalStage dateOfBirth(Optional dateOfBirth); + + _FinalStage dateOfBirth(String dateOfBirth); + + _FinalStage dateOfBirth(Nullable dateOfBirth); + + /** + *

Email address reported by the identity provider. Typically present on individual profiles.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

Individual's first name.

+ */ + _FinalStage firstName(Optional firstName); + + _FinalStage firstName(String firstName); + + _FinalStage firstName(Nullable firstName); + + /** + *

Individual's last name.

+ */ + _FinalStage lastName(Optional lastName); + + _FinalStage lastName(String lastName); + + _FinalStage lastName(Nullable lastName); + + /** + *

The companies this identity profile is currently linked to. Only populated for direct Whop user sessions; always empty when authenticated via API key, app, or OAuth scope (a single identity can be linked to companies the calling platform is not entitled to see).

+ */ + _FinalStage linkedCompanies(List linkedCompanies); + + _FinalStage addLinkedCompanies(IdentityProfileLinkedCompaniesItem linkedCompanies); + + _FinalStage addAllLinkedCompanies(List linkedCompanies); + + /** + *

Residential address reported by the identity provider. Present on individual profiles.

+ */ + _FinalStage personalAddress(Optional personalAddress); + + _FinalStage personalAddress(IdentityProfilePersonalAddress personalAddress); + + _FinalStage personalAddress(Nullable personalAddress); + + /** + *

Phone number reported by the identity provider. Typically present on individual profiles.

+ */ + _FinalStage phone(Optional phone); + + _FinalStage phone(String phone); + + _FinalStage phone(Nullable phone); + + /** + *

All verification attempts attached to this identity profile, ordered most-recent first.

+ */ + _FinalStage verifications(List verifications); + + _FinalStage addVerifications(IdentityProfileVerificationsItem verifications); + + _FinalStage addAllVerifications(List verifications); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + IdStage, + PayoutStatusStage, + PayoutsEnabledStage, + ProfileTypeStage, + StatusStage, + UpdatedAtStage, + _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private PayoutAccountCalculatedStatuses payoutStatus; + + private boolean payoutsEnabled; + + private String profileType; + + private IdentityProfileStatuses status; + + private OffsetDateTime updatedAt; + + private List verifications = new ArrayList<>(); + + private Optional phone = Optional.empty(); + + private Optional personalAddress = Optional.empty(); + + private List linkedCompanies = new ArrayList<>(); + + private Optional lastName = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional dateOfBirth = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional businessStructure = Optional.empty(); + + private Optional businessName = Optional.empty(); + + private Optional businessAddress = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(IdentityProfile other) { + businessAddress(other.getBusinessAddress()); + businessName(other.getBusinessName()); + businessStructure(other.getBusinessStructure()); + country(other.getCountry()); + createdAt(other.getCreatedAt()); + dateOfBirth(other.getDateOfBirth()); + email(other.getEmail()); + firstName(other.getFirstName()); + id(other.getId()); + lastName(other.getLastName()); + linkedCompanies(other.getLinkedCompanies()); + payoutStatus(other.getPayoutStatus()); + payoutsEnabled(other.getPayoutsEnabled()); + personalAddress(other.getPersonalAddress()); + phone(other.getPhone()); + profileType(other.getProfileType()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + verifications(other.getVerifications()); + return this; + } + + /** + *

When the identity profile was first created.

+ *

When the identity profile was first created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The tag of the identity profile (idpf_xxx).

+ *

The tag of the identity profile (idpf_xxx).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PayoutStatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Progress of payout-account setup for this profile, independent of holds. connected means onboarding is complete; a connected status paired with payouts_enabled: false indicates an active account restriction rather than incomplete setup.

+ *

Progress of payout-account setup for this profile, independent of holds. connected means onboarding is complete; a connected status paired with payouts_enabled: false indicates an active account restriction rather than incomplete setup.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payout_status") + public PayoutsEnabledStage payoutStatus(@NotNull PayoutAccountCalculatedStatuses payoutStatus) { + this.payoutStatus = Objects.requireNonNull(payoutStatus, "payoutStatus must not be null"); + return this; + } + + /** + *

Whether this profile can receive payouts right now. True only when payout onboarding is complete and no payout holds are active on the linked account. Treat this as the single source of truth for payout readiness.

+ *

Whether this profile can receive payouts right now. True only when payout onboarding is complete and no payout holds are active on the linked account. Treat this as the single source of truth for payout readiness.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payouts_enabled") + public ProfileTypeStage payoutsEnabled(boolean payoutsEnabled) { + this.payoutsEnabled = payoutsEnabled; + return this; + } + + /** + *

Whether this is an 'individual' or 'business' profile.

+ *

Whether this is an 'individual' or 'business' profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("profile_type") + public StatusStage profileType(@NotNull String profileType) { + this.profileType = Objects.requireNonNull(profileType, "profileType must not be null"); + return this; + } + + /** + *

Derived verification status across all linked verifications. Returns action_required whenever the profile has an open request for information (whether a verification, payout, or audit RFI) — i.e. the merchant must submit something before it is in good standing.

+ *

Derived verification status across all linked verifications. Returns action_required whenever the profile has an open request for information (whether a verification, payout, or audit RFI) — i.e. the merchant must submit something before it is in good standing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull IdentityProfileStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

When the identity profile was last synced from a verification.

+ *

When the identity profile was last synced from a verification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

All verification attempts attached to this identity profile, ordered most-recent first.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllVerifications(List verifications) { + if (verifications != null) { + this.verifications.addAll(verifications); + } + return this; + } + + /** + *

All verification attempts attached to this identity profile, ordered most-recent first.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addVerifications(IdentityProfileVerificationsItem verifications) { + this.verifications.add(verifications); + return this; + } + + /** + *

All verification attempts attached to this identity profile, ordered most-recent first.

+ */ + @java.lang.Override + @JsonSetter(value = "verifications", nulls = Nulls.SKIP) + public _FinalStage verifications(List verifications) { + this.verifications.clear(); + if (verifications != null) { + this.verifications.addAll(verifications); + } + return this; + } + + /** + *

Phone number reported by the identity provider. Typically present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

Phone number reported by the identity provider. Typically present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + /** + *

Phone number reported by the identity provider. Typically present on individual profiles.

+ */ + @java.lang.Override + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public _FinalStage phone(Optional phone) { + this.phone = phone; + return this; + } + + /** + *

Residential address reported by the identity provider. Present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage personalAddress(Nullable personalAddress) { + if (personalAddress.isNull()) { + this.personalAddress = null; + } else if (personalAddress.isEmpty()) { + this.personalAddress = Optional.empty(); + } else { + this.personalAddress = Optional.of(personalAddress.get()); + } + return this; + } + + /** + *

Residential address reported by the identity provider. Present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage personalAddress(IdentityProfilePersonalAddress personalAddress) { + this.personalAddress = Optional.ofNullable(personalAddress); + return this; + } + + /** + *

Residential address reported by the identity provider. Present on individual profiles.

+ */ + @java.lang.Override + @JsonSetter(value = "personal_address", nulls = Nulls.SKIP) + public _FinalStage personalAddress(Optional personalAddress) { + this.personalAddress = personalAddress; + return this; + } + + /** + *

The companies this identity profile is currently linked to. Only populated for direct Whop user sessions; always empty when authenticated via API key, app, or OAuth scope (a single identity can be linked to companies the calling platform is not entitled to see).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllLinkedCompanies(List linkedCompanies) { + if (linkedCompanies != null) { + this.linkedCompanies.addAll(linkedCompanies); + } + return this; + } + + /** + *

The companies this identity profile is currently linked to. Only populated for direct Whop user sessions; always empty when authenticated via API key, app, or OAuth scope (a single identity can be linked to companies the calling platform is not entitled to see).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addLinkedCompanies(IdentityProfileLinkedCompaniesItem linkedCompanies) { + this.linkedCompanies.add(linkedCompanies); + return this; + } + + /** + *

The companies this identity profile is currently linked to. Only populated for direct Whop user sessions; always empty when authenticated via API key, app, or OAuth scope (a single identity can be linked to companies the calling platform is not entitled to see).

+ */ + @java.lang.Override + @JsonSetter(value = "linked_companies", nulls = Nulls.SKIP) + public _FinalStage linkedCompanies(List linkedCompanies) { + this.linkedCompanies.clear(); + if (linkedCompanies != null) { + this.linkedCompanies.addAll(linkedCompanies); + } + return this; + } + + /** + *

Individual's last name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastName(Nullable lastName) { + if (lastName.isNull()) { + this.lastName = null; + } else if (lastName.isEmpty()) { + this.lastName = Optional.empty(); + } else { + this.lastName = Optional.of(lastName.get()); + } + return this; + } + + /** + *

Individual's last name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + /** + *

Individual's last name.

+ */ + @java.lang.Override + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public _FinalStage lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + /** + *

Individual's first name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstName(Nullable firstName) { + if (firstName.isNull()) { + this.firstName = null; + } else if (firstName.isEmpty()) { + this.firstName = Optional.empty(); + } else { + this.firstName = Optional.of(firstName.get()); + } + return this; + } + + /** + *

Individual's first name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + /** + *

Individual's first name.

+ */ + @java.lang.Override + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public _FinalStage firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + /** + *

Email address reported by the identity provider. Typically present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

Email address reported by the identity provider. Typically present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

Email address reported by the identity provider. Typically present on individual profiles.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + /** + *

ISO date (YYYY-MM-DD) reported by the identity provider. Present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dateOfBirth(Nullable dateOfBirth) { + if (dateOfBirth.isNull()) { + this.dateOfBirth = null; + } else if (dateOfBirth.isEmpty()) { + this.dateOfBirth = Optional.empty(); + } else { + this.dateOfBirth = Optional.of(dateOfBirth.get()); + } + return this; + } + + /** + *

ISO date (YYYY-MM-DD) reported by the identity provider. Present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dateOfBirth(String dateOfBirth) { + this.dateOfBirth = Optional.ofNullable(dateOfBirth); + return this; + } + + /** + *

ISO date (YYYY-MM-DD) reported by the identity provider. Present on individual profiles.

+ */ + @java.lang.Override + @JsonSetter(value = "date_of_birth", nulls = Nulls.SKIP) + public _FinalStage dateOfBirth(Optional dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + *

ISO 3166-1 alpha-2 country code reported by the identity provider, such as US or GB. For individuals this is the country of citizenship or residence; for businesses, the country of incorporation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

ISO 3166-1 alpha-2 country code reported by the identity provider, such as US or GB. For individuals this is the country of citizenship or residence; for businesses, the country of incorporation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

ISO 3166-1 alpha-2 country code reported by the identity provider, such as US or GB. For individuals this is the country of citizenship or residence; for businesses, the country of incorporation.

+ */ + @java.lang.Override + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public _FinalStage country(Optional country) { + this.country = country; + return this; + } + + /** + *

Reported legal structure of a business profile (e.g. corp, llc). Provider-specific values; present on business profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessStructure(Nullable businessStructure) { + if (businessStructure.isNull()) { + this.businessStructure = null; + } else if (businessStructure.isEmpty()) { + this.businessStructure = Optional.empty(); + } else { + this.businessStructure = Optional.of(businessStructure.get()); + } + return this; + } + + /** + *

Reported legal structure of a business profile (e.g. corp, llc). Provider-specific values; present on business profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessStructure(String businessStructure) { + this.businessStructure = Optional.ofNullable(businessStructure); + return this; + } + + /** + *

Reported legal structure of a business profile (e.g. corp, llc). Provider-specific values; present on business profiles.

+ */ + @java.lang.Override + @JsonSetter(value = "business_structure", nulls = Nulls.SKIP) + public _FinalStage businessStructure(Optional businessStructure) { + this.businessStructure = businessStructure; + return this; + } + + /** + *

Business entity name. Present on business profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessName(Nullable businessName) { + if (businessName.isNull()) { + this.businessName = null; + } else if (businessName.isEmpty()) { + this.businessName = Optional.empty(); + } else { + this.businessName = Optional.of(businessName.get()); + } + return this; + } + + /** + *

Business entity name. Present on business profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessName(String businessName) { + this.businessName = Optional.ofNullable(businessName); + return this; + } + + /** + *

Business entity name. Present on business profiles.

+ */ + @java.lang.Override + @JsonSetter(value = "business_name", nulls = Nulls.SKIP) + public _FinalStage businessName(Optional businessName) { + this.businessName = businessName; + return this; + } + + /** + *

Registered business address reported by the identity provider. Present on business profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessAddress(Nullable businessAddress) { + if (businessAddress.isNull()) { + this.businessAddress = null; + } else if (businessAddress.isEmpty()) { + this.businessAddress = Optional.empty(); + } else { + this.businessAddress = Optional.of(businessAddress.get()); + } + return this; + } + + /** + *

Registered business address reported by the identity provider. Present on business profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessAddress(IdentityProfileBusinessAddress businessAddress) { + this.businessAddress = Optional.ofNullable(businessAddress); + return this; + } + + /** + *

Registered business address reported by the identity provider. Present on business profiles.

+ */ + @java.lang.Override + @JsonSetter(value = "business_address", nulls = Nulls.SKIP) + public _FinalStage businessAddress(Optional businessAddress) { + this.businessAddress = businessAddress; + return this; + } + + @java.lang.Override + public IdentityProfile build() { + return new IdentityProfile( + businessAddress, + businessName, + businessStructure, + country, + createdAt, + dateOfBirth, + email, + firstName, + id, + lastName, + linkedCompanies, + payoutStatus, + payoutsEnabled, + personalAddress, + phone, + profileType, + status, + updatedAt, + verifications, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/IdentityProfileBusinessAddress.java b/src/main/java/com/whop/api/types/IdentityProfileBusinessAddress.java new file mode 100644 index 00000000..ed7b446a --- /dev/null +++ b/src/main/java/com/whop/api/types/IdentityProfileBusinessAddress.java @@ -0,0 +1,387 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = IdentityProfileBusinessAddress.Builder.class) +public final class IdentityProfileBusinessAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private IdentityProfileBusinessAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IdentityProfileBusinessAddress && equalTo((IdentityProfileBusinessAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(IdentityProfileBusinessAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(IdentityProfileBusinessAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public IdentityProfileBusinessAddress build() { + return new IdentityProfileBusinessAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/IdentityProfileKinds.java b/src/main/java/com/whop/api/types/IdentityProfileKinds.java new file mode 100644 index 00000000..f05c9ce0 --- /dev/null +++ b/src/main/java/com/whop/api/types/IdentityProfileKinds.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class IdentityProfileKinds { + public static final IdentityProfileKinds INDIVIDUAL = new IdentityProfileKinds(Value.INDIVIDUAL, "individual"); + + public static final IdentityProfileKinds BUSINESS = new IdentityProfileKinds(Value.BUSINESS, "business"); + + private final Value value; + + private final String string; + + IdentityProfileKinds(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof IdentityProfileKinds && this.string.equals(((IdentityProfileKinds) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INDIVIDUAL: + return visitor.visitIndividual(); + case BUSINESS: + return visitor.visitBusiness(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static IdentityProfileKinds valueOf(String value) { + switch (value) { + case "individual": + return INDIVIDUAL; + case "business": + return BUSINESS; + default: + return new IdentityProfileKinds(Value.UNKNOWN, value); + } + } + + public enum Value { + INDIVIDUAL, + + BUSINESS, + + UNKNOWN + } + + public interface Visitor { + T visitIndividual(); + + T visitBusiness(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/IdentityProfileLinkedCompaniesItem.java b/src/main/java/com/whop/api/types/IdentityProfileLinkedCompaniesItem.java new file mode 100644 index 00000000..98705dd3 --- /dev/null +++ b/src/main/java/com/whop/api/types/IdentityProfileLinkedCompaniesItem.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = IdentityProfileLinkedCompaniesItem.Builder.class) +public final class IdentityProfileLinkedCompaniesItem { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private IdentityProfileLinkedCompaniesItem(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IdentityProfileLinkedCompaniesItem + && equalTo((IdentityProfileLinkedCompaniesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(IdentityProfileLinkedCompaniesItem other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + TitleStage id(@NotNull String id); + + Builder from(IdentityProfileLinkedCompaniesItem other); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + IdentityProfileLinkedCompaniesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(IdentityProfileLinkedCompaniesItem other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public IdentityProfileLinkedCompaniesItem build() { + return new IdentityProfileLinkedCompaniesItem(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/IdentityProfileListItem.java b/src/main/java/com/whop/api/types/IdentityProfileListItem.java new file mode 100644 index 00000000..8ba07654 --- /dev/null +++ b/src/main/java/com/whop/api/types/IdentityProfileListItem.java @@ -0,0 +1,1216 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = IdentityProfileListItem.Builder.class) +public final class IdentityProfileListItem { + private final Optional businessAddress; + + private final Optional businessName; + + private final Optional businessStructure; + + private final Optional country; + + private final OffsetDateTime createdAt; + + private final Optional dateOfBirth; + + private final Optional email; + + private final Optional firstName; + + private final String id; + + private final Optional lastName; + + private final List linkedCompanies; + + private final PayoutAccountCalculatedStatuses payoutStatus; + + private final boolean payoutsEnabled; + + private final Optional personalAddress; + + private final Optional phone; + + private final String profileType; + + private final IdentityProfileStatuses status; + + private final OffsetDateTime updatedAt; + + private final List verifications; + + private final Map additionalProperties; + + private IdentityProfileListItem( + Optional businessAddress, + Optional businessName, + Optional businessStructure, + Optional country, + OffsetDateTime createdAt, + Optional dateOfBirth, + Optional email, + Optional firstName, + String id, + Optional lastName, + List linkedCompanies, + PayoutAccountCalculatedStatuses payoutStatus, + boolean payoutsEnabled, + Optional personalAddress, + Optional phone, + String profileType, + IdentityProfileStatuses status, + OffsetDateTime updatedAt, + List verifications, + Map additionalProperties) { + this.businessAddress = businessAddress; + this.businessName = businessName; + this.businessStructure = businessStructure; + this.country = country; + this.createdAt = createdAt; + this.dateOfBirth = dateOfBirth; + this.email = email; + this.firstName = firstName; + this.id = id; + this.lastName = lastName; + this.linkedCompanies = linkedCompanies; + this.payoutStatus = payoutStatus; + this.payoutsEnabled = payoutsEnabled; + this.personalAddress = personalAddress; + this.phone = phone; + this.profileType = profileType; + this.status = status; + this.updatedAt = updatedAt; + this.verifications = verifications; + this.additionalProperties = additionalProperties; + } + + /** + * @return Registered business address reported by the identity provider. Present on business profiles. + */ + @JsonIgnore + public Optional getBusinessAddress() { + if (businessAddress == null) { + return Optional.empty(); + } + return businessAddress; + } + + /** + * @return Business entity name. Present on business profiles. + */ + @JsonIgnore + public Optional getBusinessName() { + if (businessName == null) { + return Optional.empty(); + } + return businessName; + } + + /** + * @return Reported legal structure of a business profile (e.g. corp, llc). Provider-specific values; present on business profiles. + */ + @JsonIgnore + public Optional getBusinessStructure() { + if (businessStructure == null) { + return Optional.empty(); + } + return businessStructure; + } + + /** + * @return ISO 3166-1 alpha-2 country code reported by the identity provider, such as US or GB. For individuals this is the country of citizenship or residence; for businesses, the country of incorporation. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return When the identity profile was first created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return ISO date (YYYY-MM-DD) reported by the identity provider. Present on individual profiles. + */ + @JsonIgnore + public Optional getDateOfBirth() { + if (dateOfBirth == null) { + return Optional.empty(); + } + return dateOfBirth; + } + + /** + * @return Email address reported by the identity provider. Typically present on individual profiles. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return Individual's first name. + */ + @JsonIgnore + public Optional getFirstName() { + if (firstName == null) { + return Optional.empty(); + } + return firstName; + } + + /** + * @return The tag of the identity profile (idpf_xxx). + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Individual's last name. + */ + @JsonIgnore + public Optional getLastName() { + if (lastName == null) { + return Optional.empty(); + } + return lastName; + } + + /** + * @return The companies this identity profile is currently linked to. Only populated for direct Whop user sessions; always empty when authenticated via API key, app, or OAuth scope (a single identity can be linked to companies the calling platform is not entitled to see). + */ + @JsonProperty("linked_companies") + public List getLinkedCompanies() { + return linkedCompanies; + } + + /** + * @return Progress of payout-account setup for this profile, independent of holds. connected means onboarding is complete; a connected status paired with payouts_enabled: false indicates an active account restriction rather than incomplete setup. + */ + @JsonProperty("payout_status") + public PayoutAccountCalculatedStatuses getPayoutStatus() { + return payoutStatus; + } + + /** + * @return Whether this profile can receive payouts right now. True only when payout onboarding is complete and no payout holds are active on the linked account. Treat this as the single source of truth for payout readiness. + */ + @JsonProperty("payouts_enabled") + public boolean getPayoutsEnabled() { + return payoutsEnabled; + } + + /** + * @return Residential address reported by the identity provider. Present on individual profiles. + */ + @JsonIgnore + public Optional getPersonalAddress() { + if (personalAddress == null) { + return Optional.empty(); + } + return personalAddress; + } + + /** + * @return Phone number reported by the identity provider. Typically present on individual profiles. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + /** + * @return Whether this is an 'individual' or 'business' profile. + */ + @JsonProperty("profile_type") + public String getProfileType() { + return profileType; + } + + /** + * @return Derived verification status across all linked verifications. Returns action_required whenever the profile has an open request for information (whether a verification, payout, or audit RFI) — i.e. the merchant must submit something before it is in good standing. + */ + @JsonProperty("status") + public IdentityProfileStatuses getStatus() { + return status; + } + + /** + * @return When the identity profile was last synced from a verification. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return All verification attempts attached to this identity profile, ordered most-recent first. + */ + @JsonProperty("verifications") + public List getVerifications() { + return verifications; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_address") + private Optional _getBusinessAddress() { + return businessAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_name") + private Optional _getBusinessName() { + return businessName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_structure") + private Optional _getBusinessStructure() { + return businessStructure; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("date_of_birth") + private Optional _getDateOfBirth() { + return dateOfBirth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_name") + private Optional _getFirstName() { + return firstName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_name") + private Optional _getLastName() { + return lastName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("personal_address") + private Optional _getPersonalAddress() { + return personalAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IdentityProfileListItem && equalTo((IdentityProfileListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(IdentityProfileListItem other) { + return businessAddress.equals(other.businessAddress) + && businessName.equals(other.businessName) + && businessStructure.equals(other.businessStructure) + && country.equals(other.country) + && createdAt.equals(other.createdAt) + && dateOfBirth.equals(other.dateOfBirth) + && email.equals(other.email) + && firstName.equals(other.firstName) + && id.equals(other.id) + && lastName.equals(other.lastName) + && linkedCompanies.equals(other.linkedCompanies) + && payoutStatus.equals(other.payoutStatus) + && payoutsEnabled == other.payoutsEnabled + && personalAddress.equals(other.personalAddress) + && phone.equals(other.phone) + && profileType.equals(other.profileType) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt) + && verifications.equals(other.verifications); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.businessAddress, + this.businessName, + this.businessStructure, + this.country, + this.createdAt, + this.dateOfBirth, + this.email, + this.firstName, + this.id, + this.lastName, + this.linkedCompanies, + this.payoutStatus, + this.payoutsEnabled, + this.personalAddress, + this.phone, + this.profileType, + this.status, + this.updatedAt, + this.verifications); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the identity profile was first created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(IdentityProfileListItem other); + } + + public interface IdStage { + /** + *

The tag of the identity profile (idpf_xxx).

+ */ + PayoutStatusStage id(@NotNull String id); + } + + public interface PayoutStatusStage { + /** + *

Progress of payout-account setup for this profile, independent of holds. connected means onboarding is complete; a connected status paired with payouts_enabled: false indicates an active account restriction rather than incomplete setup.

+ */ + PayoutsEnabledStage payoutStatus(@NotNull PayoutAccountCalculatedStatuses payoutStatus); + } + + public interface PayoutsEnabledStage { + /** + *

Whether this profile can receive payouts right now. True only when payout onboarding is complete and no payout holds are active on the linked account. Treat this as the single source of truth for payout readiness.

+ */ + ProfileTypeStage payoutsEnabled(boolean payoutsEnabled); + } + + public interface ProfileTypeStage { + /** + *

Whether this is an 'individual' or 'business' profile.

+ */ + StatusStage profileType(@NotNull String profileType); + } + + public interface StatusStage { + /** + *

Derived verification status across all linked verifications. Returns action_required whenever the profile has an open request for information (whether a verification, payout, or audit RFI) — i.e. the merchant must submit something before it is in good standing.

+ */ + UpdatedAtStage status(@NotNull IdentityProfileStatuses status); + } + + public interface UpdatedAtStage { + /** + *

When the identity profile was last synced from a verification.

+ */ + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + IdentityProfileListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Registered business address reported by the identity provider. Present on business profiles.

+ */ + _FinalStage businessAddress(Optional businessAddress); + + _FinalStage businessAddress(IdentityProfileListItemBusinessAddress businessAddress); + + _FinalStage businessAddress(Nullable businessAddress); + + /** + *

Business entity name. Present on business profiles.

+ */ + _FinalStage businessName(Optional businessName); + + _FinalStage businessName(String businessName); + + _FinalStage businessName(Nullable businessName); + + /** + *

Reported legal structure of a business profile (e.g. corp, llc). Provider-specific values; present on business profiles.

+ */ + _FinalStage businessStructure(Optional businessStructure); + + _FinalStage businessStructure(String businessStructure); + + _FinalStage businessStructure(Nullable businessStructure); + + /** + *

ISO 3166-1 alpha-2 country code reported by the identity provider, such as US or GB. For individuals this is the country of citizenship or residence; for businesses, the country of incorporation.

+ */ + _FinalStage country(Optional country); + + _FinalStage country(String country); + + _FinalStage country(Nullable country); + + /** + *

ISO date (YYYY-MM-DD) reported by the identity provider. Present on individual profiles.

+ */ + _FinalStage dateOfBirth(Optional dateOfBirth); + + _FinalStage dateOfBirth(String dateOfBirth); + + _FinalStage dateOfBirth(Nullable dateOfBirth); + + /** + *

Email address reported by the identity provider. Typically present on individual profiles.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

Individual's first name.

+ */ + _FinalStage firstName(Optional firstName); + + _FinalStage firstName(String firstName); + + _FinalStage firstName(Nullable firstName); + + /** + *

Individual's last name.

+ */ + _FinalStage lastName(Optional lastName); + + _FinalStage lastName(String lastName); + + _FinalStage lastName(Nullable lastName); + + /** + *

The companies this identity profile is currently linked to. Only populated for direct Whop user sessions; always empty when authenticated via API key, app, or OAuth scope (a single identity can be linked to companies the calling platform is not entitled to see).

+ */ + _FinalStage linkedCompanies(List linkedCompanies); + + _FinalStage addLinkedCompanies(IdentityProfileListItemLinkedCompaniesItem linkedCompanies); + + _FinalStage addAllLinkedCompanies(List linkedCompanies); + + /** + *

Residential address reported by the identity provider. Present on individual profiles.

+ */ + _FinalStage personalAddress(Optional personalAddress); + + _FinalStage personalAddress(IdentityProfileListItemPersonalAddress personalAddress); + + _FinalStage personalAddress(Nullable personalAddress); + + /** + *

Phone number reported by the identity provider. Typically present on individual profiles.

+ */ + _FinalStage phone(Optional phone); + + _FinalStage phone(String phone); + + _FinalStage phone(Nullable phone); + + /** + *

All verification attempts attached to this identity profile, ordered most-recent first.

+ */ + _FinalStage verifications(List verifications); + + _FinalStage addVerifications(IdentityProfileListItemVerificationsItem verifications); + + _FinalStage addAllVerifications(List verifications); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + IdStage, + PayoutStatusStage, + PayoutsEnabledStage, + ProfileTypeStage, + StatusStage, + UpdatedAtStage, + _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private PayoutAccountCalculatedStatuses payoutStatus; + + private boolean payoutsEnabled; + + private String profileType; + + private IdentityProfileStatuses status; + + private OffsetDateTime updatedAt; + + private List verifications = new ArrayList<>(); + + private Optional phone = Optional.empty(); + + private Optional personalAddress = Optional.empty(); + + private List linkedCompanies = new ArrayList<>(); + + private Optional lastName = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional dateOfBirth = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional businessStructure = Optional.empty(); + + private Optional businessName = Optional.empty(); + + private Optional businessAddress = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(IdentityProfileListItem other) { + businessAddress(other.getBusinessAddress()); + businessName(other.getBusinessName()); + businessStructure(other.getBusinessStructure()); + country(other.getCountry()); + createdAt(other.getCreatedAt()); + dateOfBirth(other.getDateOfBirth()); + email(other.getEmail()); + firstName(other.getFirstName()); + id(other.getId()); + lastName(other.getLastName()); + linkedCompanies(other.getLinkedCompanies()); + payoutStatus(other.getPayoutStatus()); + payoutsEnabled(other.getPayoutsEnabled()); + personalAddress(other.getPersonalAddress()); + phone(other.getPhone()); + profileType(other.getProfileType()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + verifications(other.getVerifications()); + return this; + } + + /** + *

When the identity profile was first created.

+ *

When the identity profile was first created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The tag of the identity profile (idpf_xxx).

+ *

The tag of the identity profile (idpf_xxx).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PayoutStatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Progress of payout-account setup for this profile, independent of holds. connected means onboarding is complete; a connected status paired with payouts_enabled: false indicates an active account restriction rather than incomplete setup.

+ *

Progress of payout-account setup for this profile, independent of holds. connected means onboarding is complete; a connected status paired with payouts_enabled: false indicates an active account restriction rather than incomplete setup.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payout_status") + public PayoutsEnabledStage payoutStatus(@NotNull PayoutAccountCalculatedStatuses payoutStatus) { + this.payoutStatus = Objects.requireNonNull(payoutStatus, "payoutStatus must not be null"); + return this; + } + + /** + *

Whether this profile can receive payouts right now. True only when payout onboarding is complete and no payout holds are active on the linked account. Treat this as the single source of truth for payout readiness.

+ *

Whether this profile can receive payouts right now. True only when payout onboarding is complete and no payout holds are active on the linked account. Treat this as the single source of truth for payout readiness.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payouts_enabled") + public ProfileTypeStage payoutsEnabled(boolean payoutsEnabled) { + this.payoutsEnabled = payoutsEnabled; + return this; + } + + /** + *

Whether this is an 'individual' or 'business' profile.

+ *

Whether this is an 'individual' or 'business' profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("profile_type") + public StatusStage profileType(@NotNull String profileType) { + this.profileType = Objects.requireNonNull(profileType, "profileType must not be null"); + return this; + } + + /** + *

Derived verification status across all linked verifications. Returns action_required whenever the profile has an open request for information (whether a verification, payout, or audit RFI) — i.e. the merchant must submit something before it is in good standing.

+ *

Derived verification status across all linked verifications. Returns action_required whenever the profile has an open request for information (whether a verification, payout, or audit RFI) — i.e. the merchant must submit something before it is in good standing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull IdentityProfileStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

When the identity profile was last synced from a verification.

+ *

When the identity profile was last synced from a verification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

All verification attempts attached to this identity profile, ordered most-recent first.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllVerifications(List verifications) { + if (verifications != null) { + this.verifications.addAll(verifications); + } + return this; + } + + /** + *

All verification attempts attached to this identity profile, ordered most-recent first.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addVerifications(IdentityProfileListItemVerificationsItem verifications) { + this.verifications.add(verifications); + return this; + } + + /** + *

All verification attempts attached to this identity profile, ordered most-recent first.

+ */ + @java.lang.Override + @JsonSetter(value = "verifications", nulls = Nulls.SKIP) + public _FinalStage verifications(List verifications) { + this.verifications.clear(); + if (verifications != null) { + this.verifications.addAll(verifications); + } + return this; + } + + /** + *

Phone number reported by the identity provider. Typically present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

Phone number reported by the identity provider. Typically present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + /** + *

Phone number reported by the identity provider. Typically present on individual profiles.

+ */ + @java.lang.Override + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public _FinalStage phone(Optional phone) { + this.phone = phone; + return this; + } + + /** + *

Residential address reported by the identity provider. Present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage personalAddress(Nullable personalAddress) { + if (personalAddress.isNull()) { + this.personalAddress = null; + } else if (personalAddress.isEmpty()) { + this.personalAddress = Optional.empty(); + } else { + this.personalAddress = Optional.of(personalAddress.get()); + } + return this; + } + + /** + *

Residential address reported by the identity provider. Present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage personalAddress(IdentityProfileListItemPersonalAddress personalAddress) { + this.personalAddress = Optional.ofNullable(personalAddress); + return this; + } + + /** + *

Residential address reported by the identity provider. Present on individual profiles.

+ */ + @java.lang.Override + @JsonSetter(value = "personal_address", nulls = Nulls.SKIP) + public _FinalStage personalAddress(Optional personalAddress) { + this.personalAddress = personalAddress; + return this; + } + + /** + *

The companies this identity profile is currently linked to. Only populated for direct Whop user sessions; always empty when authenticated via API key, app, or OAuth scope (a single identity can be linked to companies the calling platform is not entitled to see).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllLinkedCompanies(List linkedCompanies) { + if (linkedCompanies != null) { + this.linkedCompanies.addAll(linkedCompanies); + } + return this; + } + + /** + *

The companies this identity profile is currently linked to. Only populated for direct Whop user sessions; always empty when authenticated via API key, app, or OAuth scope (a single identity can be linked to companies the calling platform is not entitled to see).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addLinkedCompanies(IdentityProfileListItemLinkedCompaniesItem linkedCompanies) { + this.linkedCompanies.add(linkedCompanies); + return this; + } + + /** + *

The companies this identity profile is currently linked to. Only populated for direct Whop user sessions; always empty when authenticated via API key, app, or OAuth scope (a single identity can be linked to companies the calling platform is not entitled to see).

+ */ + @java.lang.Override + @JsonSetter(value = "linked_companies", nulls = Nulls.SKIP) + public _FinalStage linkedCompanies(List linkedCompanies) { + this.linkedCompanies.clear(); + if (linkedCompanies != null) { + this.linkedCompanies.addAll(linkedCompanies); + } + return this; + } + + /** + *

Individual's last name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastName(Nullable lastName) { + if (lastName.isNull()) { + this.lastName = null; + } else if (lastName.isEmpty()) { + this.lastName = Optional.empty(); + } else { + this.lastName = Optional.of(lastName.get()); + } + return this; + } + + /** + *

Individual's last name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + /** + *

Individual's last name.

+ */ + @java.lang.Override + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public _FinalStage lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + /** + *

Individual's first name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstName(Nullable firstName) { + if (firstName.isNull()) { + this.firstName = null; + } else if (firstName.isEmpty()) { + this.firstName = Optional.empty(); + } else { + this.firstName = Optional.of(firstName.get()); + } + return this; + } + + /** + *

Individual's first name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + /** + *

Individual's first name.

+ */ + @java.lang.Override + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public _FinalStage firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + /** + *

Email address reported by the identity provider. Typically present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

Email address reported by the identity provider. Typically present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

Email address reported by the identity provider. Typically present on individual profiles.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + /** + *

ISO date (YYYY-MM-DD) reported by the identity provider. Present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dateOfBirth(Nullable dateOfBirth) { + if (dateOfBirth.isNull()) { + this.dateOfBirth = null; + } else if (dateOfBirth.isEmpty()) { + this.dateOfBirth = Optional.empty(); + } else { + this.dateOfBirth = Optional.of(dateOfBirth.get()); + } + return this; + } + + /** + *

ISO date (YYYY-MM-DD) reported by the identity provider. Present on individual profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dateOfBirth(String dateOfBirth) { + this.dateOfBirth = Optional.ofNullable(dateOfBirth); + return this; + } + + /** + *

ISO date (YYYY-MM-DD) reported by the identity provider. Present on individual profiles.

+ */ + @java.lang.Override + @JsonSetter(value = "date_of_birth", nulls = Nulls.SKIP) + public _FinalStage dateOfBirth(Optional dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + *

ISO 3166-1 alpha-2 country code reported by the identity provider, such as US or GB. For individuals this is the country of citizenship or residence; for businesses, the country of incorporation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

ISO 3166-1 alpha-2 country code reported by the identity provider, such as US or GB. For individuals this is the country of citizenship or residence; for businesses, the country of incorporation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + /** + *

ISO 3166-1 alpha-2 country code reported by the identity provider, such as US or GB. For individuals this is the country of citizenship or residence; for businesses, the country of incorporation.

+ */ + @java.lang.Override + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public _FinalStage country(Optional country) { + this.country = country; + return this; + } + + /** + *

Reported legal structure of a business profile (e.g. corp, llc). Provider-specific values; present on business profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessStructure(Nullable businessStructure) { + if (businessStructure.isNull()) { + this.businessStructure = null; + } else if (businessStructure.isEmpty()) { + this.businessStructure = Optional.empty(); + } else { + this.businessStructure = Optional.of(businessStructure.get()); + } + return this; + } + + /** + *

Reported legal structure of a business profile (e.g. corp, llc). Provider-specific values; present on business profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessStructure(String businessStructure) { + this.businessStructure = Optional.ofNullable(businessStructure); + return this; + } + + /** + *

Reported legal structure of a business profile (e.g. corp, llc). Provider-specific values; present on business profiles.

+ */ + @java.lang.Override + @JsonSetter(value = "business_structure", nulls = Nulls.SKIP) + public _FinalStage businessStructure(Optional businessStructure) { + this.businessStructure = businessStructure; + return this; + } + + /** + *

Business entity name. Present on business profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessName(Nullable businessName) { + if (businessName.isNull()) { + this.businessName = null; + } else if (businessName.isEmpty()) { + this.businessName = Optional.empty(); + } else { + this.businessName = Optional.of(businessName.get()); + } + return this; + } + + /** + *

Business entity name. Present on business profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessName(String businessName) { + this.businessName = Optional.ofNullable(businessName); + return this; + } + + /** + *

Business entity name. Present on business profiles.

+ */ + @java.lang.Override + @JsonSetter(value = "business_name", nulls = Nulls.SKIP) + public _FinalStage businessName(Optional businessName) { + this.businessName = businessName; + return this; + } + + /** + *

Registered business address reported by the identity provider. Present on business profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessAddress(Nullable businessAddress) { + if (businessAddress.isNull()) { + this.businessAddress = null; + } else if (businessAddress.isEmpty()) { + this.businessAddress = Optional.empty(); + } else { + this.businessAddress = Optional.of(businessAddress.get()); + } + return this; + } + + /** + *

Registered business address reported by the identity provider. Present on business profiles.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessAddress(IdentityProfileListItemBusinessAddress businessAddress) { + this.businessAddress = Optional.ofNullable(businessAddress); + return this; + } + + /** + *

Registered business address reported by the identity provider. Present on business profiles.

+ */ + @java.lang.Override + @JsonSetter(value = "business_address", nulls = Nulls.SKIP) + public _FinalStage businessAddress(Optional businessAddress) { + this.businessAddress = businessAddress; + return this; + } + + @java.lang.Override + public IdentityProfileListItem build() { + return new IdentityProfileListItem( + businessAddress, + businessName, + businessStructure, + country, + createdAt, + dateOfBirth, + email, + firstName, + id, + lastName, + linkedCompanies, + payoutStatus, + payoutsEnabled, + personalAddress, + phone, + profileType, + status, + updatedAt, + verifications, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/IdentityProfileListItemBusinessAddress.java b/src/main/java/com/whop/api/types/IdentityProfileListItemBusinessAddress.java new file mode 100644 index 00000000..8da3e450 --- /dev/null +++ b/src/main/java/com/whop/api/types/IdentityProfileListItemBusinessAddress.java @@ -0,0 +1,388 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = IdentityProfileListItemBusinessAddress.Builder.class) +public final class IdentityProfileListItemBusinessAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private IdentityProfileListItemBusinessAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IdentityProfileListItemBusinessAddress + && equalTo((IdentityProfileListItemBusinessAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(IdentityProfileListItemBusinessAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(IdentityProfileListItemBusinessAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public IdentityProfileListItemBusinessAddress build() { + return new IdentityProfileListItemBusinessAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/IdentityProfileListItemLinkedCompaniesItem.java b/src/main/java/com/whop/api/types/IdentityProfileListItemLinkedCompaniesItem.java new file mode 100644 index 00000000..2d1aa298 --- /dev/null +++ b/src/main/java/com/whop/api/types/IdentityProfileListItemLinkedCompaniesItem.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = IdentityProfileListItemLinkedCompaniesItem.Builder.class) +public final class IdentityProfileListItemLinkedCompaniesItem { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private IdentityProfileListItemLinkedCompaniesItem( + String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IdentityProfileListItemLinkedCompaniesItem + && equalTo((IdentityProfileListItemLinkedCompaniesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(IdentityProfileListItemLinkedCompaniesItem other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + TitleStage id(@NotNull String id); + + Builder from(IdentityProfileListItemLinkedCompaniesItem other); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + IdentityProfileListItemLinkedCompaniesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(IdentityProfileListItemLinkedCompaniesItem other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public IdentityProfileListItemLinkedCompaniesItem build() { + return new IdentityProfileListItemLinkedCompaniesItem(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/IdentityProfileListItemPersonalAddress.java b/src/main/java/com/whop/api/types/IdentityProfileListItemPersonalAddress.java new file mode 100644 index 00000000..fab355c9 --- /dev/null +++ b/src/main/java/com/whop/api/types/IdentityProfileListItemPersonalAddress.java @@ -0,0 +1,388 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = IdentityProfileListItemPersonalAddress.Builder.class) +public final class IdentityProfileListItemPersonalAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private IdentityProfileListItemPersonalAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IdentityProfileListItemPersonalAddress + && equalTo((IdentityProfileListItemPersonalAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(IdentityProfileListItemPersonalAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(IdentityProfileListItemPersonalAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public IdentityProfileListItemPersonalAddress build() { + return new IdentityProfileListItemPersonalAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/IdentityProfileListItemVerificationsItem.java b/src/main/java/com/whop/api/types/IdentityProfileListItemVerificationsItem.java new file mode 100644 index 00000000..ef820fd9 --- /dev/null +++ b/src/main/java/com/whop/api/types/IdentityProfileListItemVerificationsItem.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = IdentityProfileListItemVerificationsItem.Builder.class) +public final class IdentityProfileListItemVerificationsItem { + private final OffsetDateTime createdAt; + + private final String id; + + private final Optional lastErrorCode; + + private final Optional lastErrorReason; + + private final Optional sessionUrl; + + private final VerificationStatuses status; + + private final Map additionalProperties; + + private IdentityProfileListItemVerificationsItem( + OffsetDateTime createdAt, + String id, + Optional lastErrorCode, + Optional lastErrorReason, + Optional sessionUrl, + VerificationStatuses status, + Map additionalProperties) { + this.createdAt = createdAt; + this.id = id; + this.lastErrorCode = lastErrorCode; + this.lastErrorReason = lastErrorReason; + this.sessionUrl = sessionUrl; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the verification record was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The numeric id of the verification record. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The most recent error code returned during verification. Null if no error has occurred. + */ + @JsonIgnore + public Optional getLastErrorCode() { + if (lastErrorCode == null) { + return Optional.empty(); + } + return lastErrorCode; + } + + /** + * @return A human-readable explanation of the most recent verification error. Null if no error has occurred. + */ + @JsonIgnore + public Optional getLastErrorReason() { + if (lastErrorReason == null) { + return Optional.empty(); + } + return lastErrorReason; + } + + /** + * @return A URL the user can visit to complete the verification process. Null if the session does not require user interaction. + */ + @JsonIgnore + public Optional getSessionUrl() { + if (sessionUrl == null) { + return Optional.empty(); + } + return sessionUrl; + } + + /** + * @return The current status of this verification session. + */ + @JsonProperty("status") + public VerificationStatuses getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_error_code") + private Optional _getLastErrorCode() { + return lastErrorCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_error_reason") + private Optional _getLastErrorReason() { + return lastErrorReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("session_url") + private Optional _getSessionUrl() { + return sessionUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IdentityProfileListItemVerificationsItem + && equalTo((IdentityProfileListItemVerificationsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(IdentityProfileListItemVerificationsItem other) { + return createdAt.equals(other.createdAt) + && id.equals(other.id) + && lastErrorCode.equals(other.lastErrorCode) + && lastErrorReason.equals(other.lastErrorReason) + && sessionUrl.equals(other.sessionUrl) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, this.id, this.lastErrorCode, this.lastErrorReason, this.sessionUrl, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the verification record was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(IdentityProfileListItemVerificationsItem other); + } + + public interface IdStage { + /** + *

The numeric id of the verification record.

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

The current status of this verification session.

+ */ + _FinalStage status(@NotNull VerificationStatuses status); + } + + public interface _FinalStage { + IdentityProfileListItemVerificationsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ */ + _FinalStage lastErrorCode(Optional lastErrorCode); + + _FinalStage lastErrorCode(VerificationErrorCodes lastErrorCode); + + _FinalStage lastErrorCode(Nullable lastErrorCode); + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ */ + _FinalStage lastErrorReason(Optional lastErrorReason); + + _FinalStage lastErrorReason(String lastErrorReason); + + _FinalStage lastErrorReason(Nullable lastErrorReason); + + /** + *

A URL the user can visit to complete the verification process. Null if the session does not require user interaction.

+ */ + _FinalStage sessionUrl(Optional sessionUrl); + + _FinalStage sessionUrl(String sessionUrl); + + _FinalStage sessionUrl(Nullable sessionUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, StatusStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private VerificationStatuses status; + + private Optional sessionUrl = Optional.empty(); + + private Optional lastErrorReason = Optional.empty(); + + private Optional lastErrorCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(IdentityProfileListItemVerificationsItem other) { + createdAt(other.getCreatedAt()); + id(other.getId()); + lastErrorCode(other.getLastErrorCode()); + lastErrorReason(other.getLastErrorReason()); + sessionUrl(other.getSessionUrl()); + status(other.getStatus()); + return this; + } + + /** + *

When the verification record was created.

+ *

When the verification record was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The numeric id of the verification record.

+ *

The numeric id of the verification record.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current status of this verification session.

+ *

The current status of this verification session.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull VerificationStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

A URL the user can visit to complete the verification process. Null if the session does not require user interaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sessionUrl(Nullable sessionUrl) { + if (sessionUrl.isNull()) { + this.sessionUrl = null; + } else if (sessionUrl.isEmpty()) { + this.sessionUrl = Optional.empty(); + } else { + this.sessionUrl = Optional.of(sessionUrl.get()); + } + return this; + } + + /** + *

A URL the user can visit to complete the verification process. Null if the session does not require user interaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sessionUrl(String sessionUrl) { + this.sessionUrl = Optional.ofNullable(sessionUrl); + return this; + } + + /** + *

A URL the user can visit to complete the verification process. Null if the session does not require user interaction.

+ */ + @java.lang.Override + @JsonSetter(value = "session_url", nulls = Nulls.SKIP) + public _FinalStage sessionUrl(Optional sessionUrl) { + this.sessionUrl = sessionUrl; + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorReason(Nullable lastErrorReason) { + if (lastErrorReason.isNull()) { + this.lastErrorReason = null; + } else if (lastErrorReason.isEmpty()) { + this.lastErrorReason = Optional.empty(); + } else { + this.lastErrorReason = Optional.of(lastErrorReason.get()); + } + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorReason(String lastErrorReason) { + this.lastErrorReason = Optional.ofNullable(lastErrorReason); + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "last_error_reason", nulls = Nulls.SKIP) + public _FinalStage lastErrorReason(Optional lastErrorReason) { + this.lastErrorReason = lastErrorReason; + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorCode(Nullable lastErrorCode) { + if (lastErrorCode.isNull()) { + this.lastErrorCode = null; + } else if (lastErrorCode.isEmpty()) { + this.lastErrorCode = Optional.empty(); + } else { + this.lastErrorCode = Optional.of(lastErrorCode.get()); + } + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorCode(VerificationErrorCodes lastErrorCode) { + this.lastErrorCode = Optional.ofNullable(lastErrorCode); + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "last_error_code", nulls = Nulls.SKIP) + public _FinalStage lastErrorCode(Optional lastErrorCode) { + this.lastErrorCode = lastErrorCode; + return this; + } + + @java.lang.Override + public IdentityProfileListItemVerificationsItem build() { + return new IdentityProfileListItemVerificationsItem( + createdAt, id, lastErrorCode, lastErrorReason, sessionUrl, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/IdentityProfilePersonalAddress.java b/src/main/java/com/whop/api/types/IdentityProfilePersonalAddress.java new file mode 100644 index 00000000..34d23625 --- /dev/null +++ b/src/main/java/com/whop/api/types/IdentityProfilePersonalAddress.java @@ -0,0 +1,387 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = IdentityProfilePersonalAddress.Builder.class) +public final class IdentityProfilePersonalAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private IdentityProfilePersonalAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IdentityProfilePersonalAddress && equalTo((IdentityProfilePersonalAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(IdentityProfilePersonalAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(IdentityProfilePersonalAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public IdentityProfilePersonalAddress build() { + return new IdentityProfilePersonalAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/IdentityProfileStatuses.java b/src/main/java/com/whop/api/types/IdentityProfileStatuses.java new file mode 100644 index 00000000..3b7d7d41 --- /dev/null +++ b/src/main/java/com/whop/api/types/IdentityProfileStatuses.java @@ -0,0 +1,127 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class IdentityProfileStatuses { + public static final IdentityProfileStatuses APPROVED = new IdentityProfileStatuses(Value.APPROVED, "approved"); + + public static final IdentityProfileStatuses MANUAL_REVIEW = + new IdentityProfileStatuses(Value.MANUAL_REVIEW, "manual_review"); + + public static final IdentityProfileStatuses PENDING = new IdentityProfileStatuses(Value.PENDING, "pending"); + + public static final IdentityProfileStatuses NOT_STARTED = + new IdentityProfileStatuses(Value.NOT_STARTED, "not_started"); + + public static final IdentityProfileStatuses REJECTED = new IdentityProfileStatuses(Value.REJECTED, "rejected"); + + public static final IdentityProfileStatuses ACTION_REQUIRED = + new IdentityProfileStatuses(Value.ACTION_REQUIRED, "action_required"); + + private final Value value; + + private final String string; + + IdentityProfileStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof IdentityProfileStatuses + && this.string.equals(((IdentityProfileStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case MANUAL_REVIEW: + return visitor.visitManualReview(); + case PENDING: + return visitor.visitPending(); + case NOT_STARTED: + return visitor.visitNotStarted(); + case REJECTED: + return visitor.visitRejected(); + case ACTION_REQUIRED: + return visitor.visitActionRequired(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static IdentityProfileStatuses valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "manual_review": + return MANUAL_REVIEW; + case "pending": + return PENDING; + case "not_started": + return NOT_STARTED; + case "rejected": + return REJECTED; + case "action_required": + return ACTION_REQUIRED; + default: + return new IdentityProfileStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + NOT_STARTED, + + PENDING, + + MANUAL_REVIEW, + + APPROVED, + + REJECTED, + + ACTION_REQUIRED, + + UNKNOWN + } + + public interface Visitor { + T visitNotStarted(); + + T visitPending(); + + T visitManualReview(); + + T visitApproved(); + + T visitRejected(); + + T visitActionRequired(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/IdentityProfileVerificationsItem.java b/src/main/java/com/whop/api/types/IdentityProfileVerificationsItem.java new file mode 100644 index 00000000..c74e6223 --- /dev/null +++ b/src/main/java/com/whop/api/types/IdentityProfileVerificationsItem.java @@ -0,0 +1,419 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = IdentityProfileVerificationsItem.Builder.class) +public final class IdentityProfileVerificationsItem { + private final OffsetDateTime createdAt; + + private final String id; + + private final Optional lastErrorCode; + + private final Optional lastErrorReason; + + private final Optional sessionUrl; + + private final VerificationStatuses status; + + private final Map additionalProperties; + + private IdentityProfileVerificationsItem( + OffsetDateTime createdAt, + String id, + Optional lastErrorCode, + Optional lastErrorReason, + Optional sessionUrl, + VerificationStatuses status, + Map additionalProperties) { + this.createdAt = createdAt; + this.id = id; + this.lastErrorCode = lastErrorCode; + this.lastErrorReason = lastErrorReason; + this.sessionUrl = sessionUrl; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the verification record was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The numeric id of the verification record. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The most recent error code returned during verification. Null if no error has occurred. + */ + @JsonIgnore + public Optional getLastErrorCode() { + if (lastErrorCode == null) { + return Optional.empty(); + } + return lastErrorCode; + } + + /** + * @return A human-readable explanation of the most recent verification error. Null if no error has occurred. + */ + @JsonIgnore + public Optional getLastErrorReason() { + if (lastErrorReason == null) { + return Optional.empty(); + } + return lastErrorReason; + } + + /** + * @return A URL the user can visit to complete the verification process. Null if the session does not require user interaction. + */ + @JsonIgnore + public Optional getSessionUrl() { + if (sessionUrl == null) { + return Optional.empty(); + } + return sessionUrl; + } + + /** + * @return The current status of this verification session. + */ + @JsonProperty("status") + public VerificationStatuses getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_error_code") + private Optional _getLastErrorCode() { + return lastErrorCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_error_reason") + private Optional _getLastErrorReason() { + return lastErrorReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("session_url") + private Optional _getSessionUrl() { + return sessionUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IdentityProfileVerificationsItem && equalTo((IdentityProfileVerificationsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(IdentityProfileVerificationsItem other) { + return createdAt.equals(other.createdAt) + && id.equals(other.id) + && lastErrorCode.equals(other.lastErrorCode) + && lastErrorReason.equals(other.lastErrorReason) + && sessionUrl.equals(other.sessionUrl) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, this.id, this.lastErrorCode, this.lastErrorReason, this.sessionUrl, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the verification record was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(IdentityProfileVerificationsItem other); + } + + public interface IdStage { + /** + *

The numeric id of the verification record.

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

The current status of this verification session.

+ */ + _FinalStage status(@NotNull VerificationStatuses status); + } + + public interface _FinalStage { + IdentityProfileVerificationsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ */ + _FinalStage lastErrorCode(Optional lastErrorCode); + + _FinalStage lastErrorCode(VerificationErrorCodes lastErrorCode); + + _FinalStage lastErrorCode(Nullable lastErrorCode); + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ */ + _FinalStage lastErrorReason(Optional lastErrorReason); + + _FinalStage lastErrorReason(String lastErrorReason); + + _FinalStage lastErrorReason(Nullable lastErrorReason); + + /** + *

A URL the user can visit to complete the verification process. Null if the session does not require user interaction.

+ */ + _FinalStage sessionUrl(Optional sessionUrl); + + _FinalStage sessionUrl(String sessionUrl); + + _FinalStage sessionUrl(Nullable sessionUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, StatusStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private VerificationStatuses status; + + private Optional sessionUrl = Optional.empty(); + + private Optional lastErrorReason = Optional.empty(); + + private Optional lastErrorCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(IdentityProfileVerificationsItem other) { + createdAt(other.getCreatedAt()); + id(other.getId()); + lastErrorCode(other.getLastErrorCode()); + lastErrorReason(other.getLastErrorReason()); + sessionUrl(other.getSessionUrl()); + status(other.getStatus()); + return this; + } + + /** + *

When the verification record was created.

+ *

When the verification record was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The numeric id of the verification record.

+ *

The numeric id of the verification record.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current status of this verification session.

+ *

The current status of this verification session.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull VerificationStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

A URL the user can visit to complete the verification process. Null if the session does not require user interaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sessionUrl(Nullable sessionUrl) { + if (sessionUrl.isNull()) { + this.sessionUrl = null; + } else if (sessionUrl.isEmpty()) { + this.sessionUrl = Optional.empty(); + } else { + this.sessionUrl = Optional.of(sessionUrl.get()); + } + return this; + } + + /** + *

A URL the user can visit to complete the verification process. Null if the session does not require user interaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sessionUrl(String sessionUrl) { + this.sessionUrl = Optional.ofNullable(sessionUrl); + return this; + } + + /** + *

A URL the user can visit to complete the verification process. Null if the session does not require user interaction.

+ */ + @java.lang.Override + @JsonSetter(value = "session_url", nulls = Nulls.SKIP) + public _FinalStage sessionUrl(Optional sessionUrl) { + this.sessionUrl = sessionUrl; + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorReason(Nullable lastErrorReason) { + if (lastErrorReason.isNull()) { + this.lastErrorReason = null; + } else if (lastErrorReason.isEmpty()) { + this.lastErrorReason = Optional.empty(); + } else { + this.lastErrorReason = Optional.of(lastErrorReason.get()); + } + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorReason(String lastErrorReason) { + this.lastErrorReason = Optional.ofNullable(lastErrorReason); + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "last_error_reason", nulls = Nulls.SKIP) + public _FinalStage lastErrorReason(Optional lastErrorReason) { + this.lastErrorReason = lastErrorReason; + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorCode(Nullable lastErrorCode) { + if (lastErrorCode.isNull()) { + this.lastErrorCode = null; + } else if (lastErrorCode.isEmpty()) { + this.lastErrorCode = Optional.empty(); + } else { + this.lastErrorCode = Optional.of(lastErrorCode.get()); + } + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorCode(VerificationErrorCodes lastErrorCode) { + this.lastErrorCode = Optional.ofNullable(lastErrorCode); + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "last_error_code", nulls = Nulls.SKIP) + public _FinalStage lastErrorCode(Optional lastErrorCode) { + this.lastErrorCode = lastErrorCode; + return this; + } + + @java.lang.Override + public IdentityProfileVerificationsItem build() { + return new IdentityProfileVerificationsItem( + createdAt, id, lastErrorCode, lastErrorReason, sessionUrl, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/InternalServerErrorBody.java b/src/main/java/com/whop/api/types/InternalServerErrorBody.java new file mode 100644 index 00000000..a85cbf85 --- /dev/null +++ b/src/main/java/com/whop/api/types/InternalServerErrorBody.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InternalServerErrorBody.Builder.class) +public final class InternalServerErrorBody { + private final InternalServerErrorBodyError error; + + private final Map additionalProperties; + + private InternalServerErrorBody(InternalServerErrorBodyError error, Map additionalProperties) { + this.error = error; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("error") + public InternalServerErrorBodyError getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InternalServerErrorBody && equalTo((InternalServerErrorBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InternalServerErrorBody other) { + return error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + _FinalStage error(@NotNull InternalServerErrorBodyError error); + + Builder from(InternalServerErrorBody other); + } + + public interface _FinalStage { + InternalServerErrorBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private InternalServerErrorBodyError error; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InternalServerErrorBody other) { + error(other.getError()); + return this; + } + + @java.lang.Override + @JsonSetter("error") + public _FinalStage error(@NotNull InternalServerErrorBodyError error) { + this.error = Objects.requireNonNull(error, "error must not be null"); + return this; + } + + @java.lang.Override + public InternalServerErrorBody build() { + return new InternalServerErrorBody(error, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/InternalServerErrorBodyError.java b/src/main/java/com/whop/api/types/InternalServerErrorBodyError.java new file mode 100644 index 00000000..7b13a67d --- /dev/null +++ b/src/main/java/com/whop/api/types/InternalServerErrorBodyError.java @@ -0,0 +1,289 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InternalServerErrorBodyError.Builder.class) +public final class InternalServerErrorBodyError { + private final Optional code; + + private final String message; + + private final Optional param; + + private final String type; + + private final Map additionalProperties; + + private InternalServerErrorBodyError( + Optional code, + String message, + Optional param, + String type, + Map additionalProperties) { + this.code = code; + this.message = message; + this.param = param; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json' + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + @JsonProperty("message") + public String getMessage() { + return message; + } + + /** + * @return The parameter that caused the error, if applicable + */ + @JsonIgnore + public Optional getParam() { + if (param == null) { + return Optional.empty(); + } + return param; + } + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("param") + private Optional _getParam() { + return param; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InternalServerErrorBodyError && equalTo((InternalServerErrorBodyError) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InternalServerErrorBodyError other) { + return code.equals(other.code) + && message.equals(other.message) + && param.equals(other.param) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.message, this.param, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + TypeStage message(@NotNull String message); + + Builder from(InternalServerErrorBodyError other); + } + + public interface TypeStage { + _FinalStage type(@NotNull String type); + } + + public interface _FinalStage { + InternalServerErrorBodyError build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ */ + _FinalStage code(Optional code); + + _FinalStage code(String code); + + _FinalStage code(Nullable code); + + /** + *

The parameter that caused the error, if applicable

+ */ + _FinalStage param(Optional param); + + _FinalStage param(String param); + + _FinalStage param(Nullable param); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, TypeStage, _FinalStage { + private String message; + + private String type; + + private Optional param = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InternalServerErrorBodyError other) { + code(other.getCode()); + message(other.getMessage()); + param(other.getParam()); + type(other.getType()); + return this; + } + + @java.lang.Override + @JsonSetter("message") + public TypeStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage param(Nullable param) { + if (param.isNull()) { + this.param = null; + } else if (param.isEmpty()) { + this.param = Optional.empty(); + } else { + this.param = Optional.of(param.get()); + } + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage param(String param) { + this.param = Optional.ofNullable(param); + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ */ + @java.lang.Override + @JsonSetter(value = "param", nulls = Nulls.SKIP) + public _FinalStage param(Optional param) { + this.param = param; + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public InternalServerErrorBodyError build() { + return new InternalServerErrorBodyError(code, message, param, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Invoice.java b/src/main/java/com/whop/api/types/Invoice.java new file mode 100644 index 00000000..bcb35481 --- /dev/null +++ b/src/main/java/com/whop/api/types/Invoice.java @@ -0,0 +1,1344 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Invoice.Builder.class) +public final class Invoice { + private final Optional automaticallyFinalizesAt; + + private final boolean chargeBuyerFee; + + private final InvoiceCollectionMethods collectionMethod; + + private final InvoiceCompany company; + + private final OffsetDateTime createdAt; + + private final InvoiceCurrentPlan currentPlan; + + private final Optional customerName; + + private final Optional dueDate; + + private final Optional emailAddress; + + private final String fetchInvoiceToken; + + private final String id; + + private final List lineItems; + + private final Optional mailingAddress; + + private final Optional member; + + private final String number; + + private final Optional payOnlineUrl; + + private final Optional payment; + + private final boolean paymentProcessing; + + private final InvoiceProduct product; + + private final InvoiceStatuses status; + + private final Optional subscriptionBillingAnchorAt; + + private final OffsetDateTime updatedAt; + + private final Optional user; + + private final Map additionalProperties; + + private Invoice( + Optional automaticallyFinalizesAt, + boolean chargeBuyerFee, + InvoiceCollectionMethods collectionMethod, + InvoiceCompany company, + OffsetDateTime createdAt, + InvoiceCurrentPlan currentPlan, + Optional customerName, + Optional dueDate, + Optional emailAddress, + String fetchInvoiceToken, + String id, + List lineItems, + Optional mailingAddress, + Optional member, + String number, + Optional payOnlineUrl, + Optional payment, + boolean paymentProcessing, + InvoiceProduct product, + InvoiceStatuses status, + Optional subscriptionBillingAnchorAt, + OffsetDateTime updatedAt, + Optional user, + Map additionalProperties) { + this.automaticallyFinalizesAt = automaticallyFinalizesAt; + this.chargeBuyerFee = chargeBuyerFee; + this.collectionMethod = collectionMethod; + this.company = company; + this.createdAt = createdAt; + this.currentPlan = currentPlan; + this.customerName = customerName; + this.dueDate = dueDate; + this.emailAddress = emailAddress; + this.fetchInvoiceToken = fetchInvoiceToken; + this.id = id; + this.lineItems = lineItems; + this.mailingAddress = mailingAddress; + this.member = member; + this.number = number; + this.payOnlineUrl = payOnlineUrl; + this.payment = payment; + this.paymentProcessing = paymentProcessing; + this.product = product; + this.status = status; + this.subscriptionBillingAnchorAt = subscriptionBillingAnchorAt; + this.updatedAt = updatedAt; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email at the specified time. + */ + @JsonIgnore + public Optional getAutomaticallyFinalizesAt() { + if (automaticallyFinalizesAt == null) { + return Optional.empty(); + } + return automaticallyFinalizesAt; + } + + /** + * @return Whether the invoice includes a buyer processing fee on top of the plan price. + */ + @JsonProperty("charge_buyer_fee") + public boolean getChargeBuyerFee() { + return chargeBuyerFee; + } + + /** + * @return The method used to collect payment for this invoice, such as automatic charging or manual payment. + */ + @JsonProperty("collection_method") + public InvoiceCollectionMethods getCollectionMethod() { + return collectionMethod; + } + + /** + * @return The company that issued this invoice. + */ + @JsonProperty("company") + public InvoiceCompany getCompany() { + return company; + } + + /** + * @return The datetime the invoice was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The plan that this invoice charges for. + */ + @JsonProperty("current_plan") + public InvoiceCurrentPlan getCurrentPlan() { + return currentPlan; + } + + /** + * @return The full name of the customer this invoice is addressed to. Null if no name is on file. + */ + @JsonIgnore + public Optional getCustomerName() { + if (customerName == null) { + return Optional.empty(); + } + return customerName; + } + + /** + * @return The deadline by which payment is expected. Null if the invoice is collected automatically. + */ + @JsonIgnore + public Optional getDueDate() { + if (dueDate == null) { + return Optional.empty(); + } + return dueDate; + } + + /** + * @return The email address of the customer this invoice is addressed to. Null if no email is on file. + */ + @JsonIgnore + public Optional getEmailAddress() { + if (emailAddress == null) { + return Optional.empty(); + } + return emailAddress; + } + + /** + * @return A signed token that allows fetching invoice data publicly without authentication. + */ + @JsonProperty("fetch_invoice_token") + public String getFetchInvoiceToken() { + return fetchInvoiceToken; + } + + /** + * @return The unique identifier for the invoice. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Optional line items that break down the invoice total into individual charges. + */ + @JsonProperty("line_items") + public List getLineItems() { + return lineItems; + } + + /** + * @return The billing/mailing address associated with this invoice, if one was provided at creation time. + */ + @JsonIgnore + public Optional getMailingAddress() { + if (mailingAddress == null) { + return Optional.empty(); + } + return mailingAddress; + } + + /** + * @return The member that the invoice was created for. Null when the invoice is addressed to an email address with no member record behind it. + */ + @JsonIgnore + public Optional getMember() { + if (member == null) { + return Optional.empty(); + } + return member; + } + + /** + * @return The sequential invoice number for display purposes. + */ + @JsonProperty("number") + public String getNumber() { + return number; + } + + /** + * @return The checkout URL where the customer can pay this invoice online, with their email address pre-filled and locked. + */ + @JsonIgnore + public Optional getPayOnlineUrl() { + if (payOnlineUrl == null) { + return Optional.empty(); + } + return payOnlineUrl; + } + + /** + * @return The payment that settled this invoice. Null while the invoice is unpaid, when the invoice was marked paid manually, and on a subscription renewal invoice, where the settling payment cannot yet be identified. + */ + @JsonIgnore + public Optional getPayment() { + if (payment == null) { + return Optional.empty(); + } + return payment; + } + + /** + * @return Whether a payment on this invoice is still clearing. True while a delayed payment method such as ACH or SEPA settles, during which the invoice stays open and is not marked past due. + */ + @JsonProperty("payment_processing") + public boolean getPaymentProcessing() { + return paymentProcessing; + } + + /** + * @return The product that this invoice was generated for. + */ + @JsonProperty("product") + public InvoiceProduct getProduct() { + return product; + } + + /** + * @return The current payment status of the invoice, such as draft, open, paid, or void. + */ + @JsonProperty("status") + public InvoiceStatuses getStatus() { + return status; + } + + /** + * @return The date that defines when the subscription billing cycle starts. When set on a renewal plan invoice, all future billing periods anchor to this date. + */ + @JsonIgnore + public Optional getSubscriptionBillingAnchorAt() { + if (subscriptionBillingAnchorAt == null) { + return Optional.empty(); + } + return subscriptionBillingAnchorAt; + } + + /** + * @return The datetime the invoice was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user this invoice is addressed to. Null if the user account has been removed. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("automatically_finalizes_at") + private Optional _getAutomaticallyFinalizesAt() { + return automaticallyFinalizesAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_name") + private Optional _getCustomerName() { + return customerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("due_date") + private Optional _getDueDate() { + return dueDate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email_address") + private Optional _getEmailAddress() { + return emailAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("mailing_address") + private Optional _getMailingAddress() { + return mailingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member") + private Optional _getMember() { + return member; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("pay_online_url") + private Optional _getPayOnlineUrl() { + return payOnlineUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment") + private Optional _getPayment() { + return payment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("subscription_billing_anchor_at") + private Optional _getSubscriptionBillingAnchorAt() { + return subscriptionBillingAnchorAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Invoice && equalTo((Invoice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Invoice other) { + return automaticallyFinalizesAt.equals(other.automaticallyFinalizesAt) + && chargeBuyerFee == other.chargeBuyerFee + && collectionMethod.equals(other.collectionMethod) + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && currentPlan.equals(other.currentPlan) + && customerName.equals(other.customerName) + && dueDate.equals(other.dueDate) + && emailAddress.equals(other.emailAddress) + && fetchInvoiceToken.equals(other.fetchInvoiceToken) + && id.equals(other.id) + && lineItems.equals(other.lineItems) + && mailingAddress.equals(other.mailingAddress) + && member.equals(other.member) + && number.equals(other.number) + && payOnlineUrl.equals(other.payOnlineUrl) + && payment.equals(other.payment) + && paymentProcessing == other.paymentProcessing + && product.equals(other.product) + && status.equals(other.status) + && subscriptionBillingAnchorAt.equals(other.subscriptionBillingAnchorAt) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.automaticallyFinalizesAt, + this.chargeBuyerFee, + this.collectionMethod, + this.company, + this.createdAt, + this.currentPlan, + this.customerName, + this.dueDate, + this.emailAddress, + this.fetchInvoiceToken, + this.id, + this.lineItems, + this.mailingAddress, + this.member, + this.number, + this.payOnlineUrl, + this.payment, + this.paymentProcessing, + this.product, + this.status, + this.subscriptionBillingAnchorAt, + this.updatedAt, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChargeBuyerFeeStage builder() { + return new Builder(); + } + + public interface ChargeBuyerFeeStage { + /** + *

Whether the invoice includes a buyer processing fee on top of the plan price.

+ */ + CollectionMethodStage chargeBuyerFee(boolean chargeBuyerFee); + + Builder from(Invoice other); + } + + public interface CollectionMethodStage { + /** + *

The method used to collect payment for this invoice, such as automatic charging or manual payment.

+ */ + CompanyStage collectionMethod(@NotNull InvoiceCollectionMethods collectionMethod); + } + + public interface CompanyStage { + /** + *

The company that issued this invoice.

+ */ + CreatedAtStage company(@NotNull InvoiceCompany company); + } + + public interface CreatedAtStage { + /** + *

The datetime the invoice was created.

+ */ + CurrentPlanStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrentPlanStage { + /** + *

The plan that this invoice charges for.

+ */ + FetchInvoiceTokenStage currentPlan(@NotNull InvoiceCurrentPlan currentPlan); + } + + public interface FetchInvoiceTokenStage { + /** + *

A signed token that allows fetching invoice data publicly without authentication.

+ */ + IdStage fetchInvoiceToken(@NotNull String fetchInvoiceToken); + } + + public interface IdStage { + /** + *

The unique identifier for the invoice.

+ */ + NumberStage id(@NotNull String id); + } + + public interface NumberStage { + /** + *

The sequential invoice number for display purposes.

+ */ + PaymentProcessingStage number(@NotNull String number); + } + + public interface PaymentProcessingStage { + /** + *

Whether a payment on this invoice is still clearing. True while a delayed payment method such as ACH or SEPA settles, during which the invoice stays open and is not marked past due.

+ */ + ProductStage paymentProcessing(boolean paymentProcessing); + } + + public interface ProductStage { + /** + *

The product that this invoice was generated for.

+ */ + StatusStage product(@NotNull InvoiceProduct product); + } + + public interface StatusStage { + /** + *

The current payment status of the invoice, such as draft, open, paid, or void.

+ */ + UpdatedAtStage status(@NotNull InvoiceStatuses status); + } + + public interface UpdatedAtStage { + /** + *

The datetime the invoice was last updated.

+ */ + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + Invoice build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email at the specified time.

+ */ + _FinalStage automaticallyFinalizesAt(Optional automaticallyFinalizesAt); + + _FinalStage automaticallyFinalizesAt(OffsetDateTime automaticallyFinalizesAt); + + _FinalStage automaticallyFinalizesAt(Nullable automaticallyFinalizesAt); + + /** + *

The full name of the customer this invoice is addressed to. Null if no name is on file.

+ */ + _FinalStage customerName(Optional customerName); + + _FinalStage customerName(String customerName); + + _FinalStage customerName(Nullable customerName); + + /** + *

The deadline by which payment is expected. Null if the invoice is collected automatically.

+ */ + _FinalStage dueDate(Optional dueDate); + + _FinalStage dueDate(OffsetDateTime dueDate); + + _FinalStage dueDate(Nullable dueDate); + + /** + *

The email address of the customer this invoice is addressed to. Null if no email is on file.

+ */ + _FinalStage emailAddress(Optional emailAddress); + + _FinalStage emailAddress(String emailAddress); + + _FinalStage emailAddress(Nullable emailAddress); + + /** + *

Optional line items that break down the invoice total into individual charges.

+ */ + _FinalStage lineItems(List lineItems); + + _FinalStage addLineItems(InvoiceLineItemsItem lineItems); + + _FinalStage addAllLineItems(List lineItems); + + /** + *

The billing/mailing address associated with this invoice, if one was provided at creation time.

+ */ + _FinalStage mailingAddress(Optional mailingAddress); + + _FinalStage mailingAddress(InvoiceMailingAddress mailingAddress); + + _FinalStage mailingAddress(Nullable mailingAddress); + + /** + *

The member that the invoice was created for. Null when the invoice is addressed to an email address with no member record behind it.

+ */ + _FinalStage member(Optional member); + + _FinalStage member(InvoiceMember member); + + _FinalStage member(Nullable member); + + /** + *

The checkout URL where the customer can pay this invoice online, with their email address pre-filled and locked.

+ */ + _FinalStage payOnlineUrl(Optional payOnlineUrl); + + _FinalStage payOnlineUrl(String payOnlineUrl); + + _FinalStage payOnlineUrl(Nullable payOnlineUrl); + + /** + *

The payment that settled this invoice. Null while the invoice is unpaid, when the invoice was marked paid manually, and on a subscription renewal invoice, where the settling payment cannot yet be identified.

+ */ + _FinalStage payment(Optional payment); + + _FinalStage payment(InvoicePayment payment); + + _FinalStage payment(Nullable payment); + + /** + *

The date that defines when the subscription billing cycle starts. When set on a renewal plan invoice, all future billing periods anchor to this date.

+ */ + _FinalStage subscriptionBillingAnchorAt(Optional subscriptionBillingAnchorAt); + + _FinalStage subscriptionBillingAnchorAt(OffsetDateTime subscriptionBillingAnchorAt); + + _FinalStage subscriptionBillingAnchorAt(Nullable subscriptionBillingAnchorAt); + + /** + *

The user this invoice is addressed to. Null if the user account has been removed.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(InvoiceUser user); + + _FinalStage user(Nullable user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ChargeBuyerFeeStage, + CollectionMethodStage, + CompanyStage, + CreatedAtStage, + CurrentPlanStage, + FetchInvoiceTokenStage, + IdStage, + NumberStage, + PaymentProcessingStage, + ProductStage, + StatusStage, + UpdatedAtStage, + _FinalStage { + private boolean chargeBuyerFee; + + private InvoiceCollectionMethods collectionMethod; + + private InvoiceCompany company; + + private OffsetDateTime createdAt; + + private InvoiceCurrentPlan currentPlan; + + private String fetchInvoiceToken; + + private String id; + + private String number; + + private boolean paymentProcessing; + + private InvoiceProduct product; + + private InvoiceStatuses status; + + private OffsetDateTime updatedAt; + + private Optional user = Optional.empty(); + + private Optional subscriptionBillingAnchorAt = Optional.empty(); + + private Optional payment = Optional.empty(); + + private Optional payOnlineUrl = Optional.empty(); + + private Optional member = Optional.empty(); + + private Optional mailingAddress = Optional.empty(); + + private List lineItems = new ArrayList<>(); + + private Optional emailAddress = Optional.empty(); + + private Optional dueDate = Optional.empty(); + + private Optional customerName = Optional.empty(); + + private Optional automaticallyFinalizesAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Invoice other) { + automaticallyFinalizesAt(other.getAutomaticallyFinalizesAt()); + chargeBuyerFee(other.getChargeBuyerFee()); + collectionMethod(other.getCollectionMethod()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + currentPlan(other.getCurrentPlan()); + customerName(other.getCustomerName()); + dueDate(other.getDueDate()); + emailAddress(other.getEmailAddress()); + fetchInvoiceToken(other.getFetchInvoiceToken()); + id(other.getId()); + lineItems(other.getLineItems()); + mailingAddress(other.getMailingAddress()); + member(other.getMember()); + number(other.getNumber()); + payOnlineUrl(other.getPayOnlineUrl()); + payment(other.getPayment()); + paymentProcessing(other.getPaymentProcessing()); + product(other.getProduct()); + status(other.getStatus()); + subscriptionBillingAnchorAt(other.getSubscriptionBillingAnchorAt()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + return this; + } + + /** + *

Whether the invoice includes a buyer processing fee on top of the plan price.

+ *

Whether the invoice includes a buyer processing fee on top of the plan price.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("charge_buyer_fee") + public CollectionMethodStage chargeBuyerFee(boolean chargeBuyerFee) { + this.chargeBuyerFee = chargeBuyerFee; + return this; + } + + /** + *

The method used to collect payment for this invoice, such as automatic charging or manual payment.

+ *

The method used to collect payment for this invoice, such as automatic charging or manual payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("collection_method") + public CompanyStage collectionMethod(@NotNull InvoiceCollectionMethods collectionMethod) { + this.collectionMethod = Objects.requireNonNull(collectionMethod, "collectionMethod must not be null"); + return this; + } + + /** + *

The company that issued this invoice.

+ *

The company that issued this invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company") + public CreatedAtStage company(@NotNull InvoiceCompany company) { + this.company = Objects.requireNonNull(company, "company must not be null"); + return this; + } + + /** + *

The datetime the invoice was created.

+ *

The datetime the invoice was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrentPlanStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The plan that this invoice charges for.

+ *

The plan that this invoice charges for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("current_plan") + public FetchInvoiceTokenStage currentPlan(@NotNull InvoiceCurrentPlan currentPlan) { + this.currentPlan = Objects.requireNonNull(currentPlan, "currentPlan must not be null"); + return this; + } + + /** + *

A signed token that allows fetching invoice data publicly without authentication.

+ *

A signed token that allows fetching invoice data publicly without authentication.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fetch_invoice_token") + public IdStage fetchInvoiceToken(@NotNull String fetchInvoiceToken) { + this.fetchInvoiceToken = Objects.requireNonNull(fetchInvoiceToken, "fetchInvoiceToken must not be null"); + return this; + } + + /** + *

The unique identifier for the invoice.

+ *

The unique identifier for the invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NumberStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The sequential invoice number for display purposes.

+ *

The sequential invoice number for display purposes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("number") + public PaymentProcessingStage number(@NotNull String number) { + this.number = Objects.requireNonNull(number, "number must not be null"); + return this; + } + + /** + *

Whether a payment on this invoice is still clearing. True while a delayed payment method such as ACH or SEPA settles, during which the invoice stays open and is not marked past due.

+ *

Whether a payment on this invoice is still clearing. True while a delayed payment method such as ACH or SEPA settles, during which the invoice stays open and is not marked past due.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_processing") + public ProductStage paymentProcessing(boolean paymentProcessing) { + this.paymentProcessing = paymentProcessing; + return this; + } + + /** + *

The product that this invoice was generated for.

+ *

The product that this invoice was generated for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("product") + public StatusStage product(@NotNull InvoiceProduct product) { + this.product = Objects.requireNonNull(product, "product must not be null"); + return this; + } + + /** + *

The current payment status of the invoice, such as draft, open, paid, or void.

+ *

The current payment status of the invoice, such as draft, open, paid, or void.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull InvoiceStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The datetime the invoice was last updated.

+ *

The datetime the invoice was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user this invoice is addressed to. Null if the user account has been removed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The user this invoice is addressed to. Null if the user account has been removed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(InvoiceUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The user this invoice is addressed to. Null if the user account has been removed.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + /** + *

The date that defines when the subscription billing cycle starts. When set on a renewal plan invoice, all future billing periods anchor to this date.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subscriptionBillingAnchorAt(Nullable subscriptionBillingAnchorAt) { + if (subscriptionBillingAnchorAt.isNull()) { + this.subscriptionBillingAnchorAt = null; + } else if (subscriptionBillingAnchorAt.isEmpty()) { + this.subscriptionBillingAnchorAt = Optional.empty(); + } else { + this.subscriptionBillingAnchorAt = Optional.of(subscriptionBillingAnchorAt.get()); + } + return this; + } + + /** + *

The date that defines when the subscription billing cycle starts. When set on a renewal plan invoice, all future billing periods anchor to this date.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subscriptionBillingAnchorAt(OffsetDateTime subscriptionBillingAnchorAt) { + this.subscriptionBillingAnchorAt = Optional.ofNullable(subscriptionBillingAnchorAt); + return this; + } + + /** + *

The date that defines when the subscription billing cycle starts. When set on a renewal plan invoice, all future billing periods anchor to this date.

+ */ + @java.lang.Override + @JsonSetter(value = "subscription_billing_anchor_at", nulls = Nulls.SKIP) + public _FinalStage subscriptionBillingAnchorAt(Optional subscriptionBillingAnchorAt) { + this.subscriptionBillingAnchorAt = subscriptionBillingAnchorAt; + return this; + } + + /** + *

The payment that settled this invoice. Null while the invoice is unpaid, when the invoice was marked paid manually, and on a subscription renewal invoice, where the settling payment cannot yet be identified.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(Nullable payment) { + if (payment.isNull()) { + this.payment = null; + } else if (payment.isEmpty()) { + this.payment = Optional.empty(); + } else { + this.payment = Optional.of(payment.get()); + } + return this; + } + + /** + *

The payment that settled this invoice. Null while the invoice is unpaid, when the invoice was marked paid manually, and on a subscription renewal invoice, where the settling payment cannot yet be identified.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(InvoicePayment payment) { + this.payment = Optional.ofNullable(payment); + return this; + } + + /** + *

The payment that settled this invoice. Null while the invoice is unpaid, when the invoice was marked paid manually, and on a subscription renewal invoice, where the settling payment cannot yet be identified.

+ */ + @java.lang.Override + @JsonSetter(value = "payment", nulls = Nulls.SKIP) + public _FinalStage payment(Optional payment) { + this.payment = payment; + return this; + } + + /** + *

The checkout URL where the customer can pay this invoice online, with their email address pre-filled and locked.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payOnlineUrl(Nullable payOnlineUrl) { + if (payOnlineUrl.isNull()) { + this.payOnlineUrl = null; + } else if (payOnlineUrl.isEmpty()) { + this.payOnlineUrl = Optional.empty(); + } else { + this.payOnlineUrl = Optional.of(payOnlineUrl.get()); + } + return this; + } + + /** + *

The checkout URL where the customer can pay this invoice online, with their email address pre-filled and locked.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payOnlineUrl(String payOnlineUrl) { + this.payOnlineUrl = Optional.ofNullable(payOnlineUrl); + return this; + } + + /** + *

The checkout URL where the customer can pay this invoice online, with their email address pre-filled and locked.

+ */ + @java.lang.Override + @JsonSetter(value = "pay_online_url", nulls = Nulls.SKIP) + public _FinalStage payOnlineUrl(Optional payOnlineUrl) { + this.payOnlineUrl = payOnlineUrl; + return this; + } + + /** + *

The member that the invoice was created for. Null when the invoice is addressed to an email address with no member record behind it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(Nullable member) { + if (member.isNull()) { + this.member = null; + } else if (member.isEmpty()) { + this.member = Optional.empty(); + } else { + this.member = Optional.of(member.get()); + } + return this; + } + + /** + *

The member that the invoice was created for. Null when the invoice is addressed to an email address with no member record behind it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(InvoiceMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + /** + *

The member that the invoice was created for. Null when the invoice is addressed to an email address with no member record behind it.

+ */ + @java.lang.Override + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public _FinalStage member(Optional member) { + this.member = member; + return this; + } + + /** + *

The billing/mailing address associated with this invoice, if one was provided at creation time.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mailingAddress(Nullable mailingAddress) { + if (mailingAddress.isNull()) { + this.mailingAddress = null; + } else if (mailingAddress.isEmpty()) { + this.mailingAddress = Optional.empty(); + } else { + this.mailingAddress = Optional.of(mailingAddress.get()); + } + return this; + } + + /** + *

The billing/mailing address associated with this invoice, if one was provided at creation time.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mailingAddress(InvoiceMailingAddress mailingAddress) { + this.mailingAddress = Optional.ofNullable(mailingAddress); + return this; + } + + /** + *

The billing/mailing address associated with this invoice, if one was provided at creation time.

+ */ + @java.lang.Override + @JsonSetter(value = "mailing_address", nulls = Nulls.SKIP) + public _FinalStage mailingAddress(Optional mailingAddress) { + this.mailingAddress = mailingAddress; + return this; + } + + /** + *

Optional line items that break down the invoice total into individual charges.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllLineItems(List lineItems) { + if (lineItems != null) { + this.lineItems.addAll(lineItems); + } + return this; + } + + /** + *

Optional line items that break down the invoice total into individual charges.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addLineItems(InvoiceLineItemsItem lineItems) { + this.lineItems.add(lineItems); + return this; + } + + /** + *

Optional line items that break down the invoice total into individual charges.

+ */ + @java.lang.Override + @JsonSetter(value = "line_items", nulls = Nulls.SKIP) + public _FinalStage lineItems(List lineItems) { + this.lineItems.clear(); + if (lineItems != null) { + this.lineItems.addAll(lineItems); + } + return this; + } + + /** + *

The email address of the customer this invoice is addressed to. Null if no email is on file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emailAddress(Nullable emailAddress) { + if (emailAddress.isNull()) { + this.emailAddress = null; + } else if (emailAddress.isEmpty()) { + this.emailAddress = Optional.empty(); + } else { + this.emailAddress = Optional.of(emailAddress.get()); + } + return this; + } + + /** + *

The email address of the customer this invoice is addressed to. Null if no email is on file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emailAddress(String emailAddress) { + this.emailAddress = Optional.ofNullable(emailAddress); + return this; + } + + /** + *

The email address of the customer this invoice is addressed to. Null if no email is on file.

+ */ + @java.lang.Override + @JsonSetter(value = "email_address", nulls = Nulls.SKIP) + public _FinalStage emailAddress(Optional emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + *

The deadline by which payment is expected. Null if the invoice is collected automatically.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dueDate(Nullable dueDate) { + if (dueDate.isNull()) { + this.dueDate = null; + } else if (dueDate.isEmpty()) { + this.dueDate = Optional.empty(); + } else { + this.dueDate = Optional.of(dueDate.get()); + } + return this; + } + + /** + *

The deadline by which payment is expected. Null if the invoice is collected automatically.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dueDate(OffsetDateTime dueDate) { + this.dueDate = Optional.ofNullable(dueDate); + return this; + } + + /** + *

The deadline by which payment is expected. Null if the invoice is collected automatically.

+ */ + @java.lang.Override + @JsonSetter(value = "due_date", nulls = Nulls.SKIP) + public _FinalStage dueDate(Optional dueDate) { + this.dueDate = dueDate; + return this; + } + + /** + *

The full name of the customer this invoice is addressed to. Null if no name is on file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerName(Nullable customerName) { + if (customerName.isNull()) { + this.customerName = null; + } else if (customerName.isEmpty()) { + this.customerName = Optional.empty(); + } else { + this.customerName = Optional.of(customerName.get()); + } + return this; + } + + /** + *

The full name of the customer this invoice is addressed to. Null if no name is on file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerName(String customerName) { + this.customerName = Optional.ofNullable(customerName); + return this; + } + + /** + *

The full name of the customer this invoice is addressed to. Null if no name is on file.

+ */ + @java.lang.Override + @JsonSetter(value = "customer_name", nulls = Nulls.SKIP) + public _FinalStage customerName(Optional customerName) { + this.customerName = customerName; + return this; + } + + /** + *

The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email at the specified time.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage automaticallyFinalizesAt(Nullable automaticallyFinalizesAt) { + if (automaticallyFinalizesAt.isNull()) { + this.automaticallyFinalizesAt = null; + } else if (automaticallyFinalizesAt.isEmpty()) { + this.automaticallyFinalizesAt = Optional.empty(); + } else { + this.automaticallyFinalizesAt = Optional.of(automaticallyFinalizesAt.get()); + } + return this; + } + + /** + *

The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email at the specified time.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage automaticallyFinalizesAt(OffsetDateTime automaticallyFinalizesAt) { + this.automaticallyFinalizesAt = Optional.ofNullable(automaticallyFinalizesAt); + return this; + } + + /** + *

The date and time when the invoice will be automatically finalized. For charge_automatically, triggers an automatic charge. For send_invoice, sends the invoice email at the specified time.

+ */ + @java.lang.Override + @JsonSetter(value = "automatically_finalizes_at", nulls = Nulls.SKIP) + public _FinalStage automaticallyFinalizesAt(Optional automaticallyFinalizesAt) { + this.automaticallyFinalizesAt = automaticallyFinalizesAt; + return this; + } + + @java.lang.Override + public Invoice build() { + return new Invoice( + automaticallyFinalizesAt, + chargeBuyerFee, + collectionMethod, + company, + createdAt, + currentPlan, + customerName, + dueDate, + emailAddress, + fetchInvoiceToken, + id, + lineItems, + mailingAddress, + member, + number, + payOnlineUrl, + payment, + paymentProcessing, + product, + status, + subscriptionBillingAnchorAt, + updatedAt, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/InvoiceCollectionMethods.java b/src/main/java/com/whop/api/types/InvoiceCollectionMethods.java new file mode 100644 index 00000000..ffda5028 --- /dev/null +++ b/src/main/java/com/whop/api/types/InvoiceCollectionMethods.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class InvoiceCollectionMethods { + public static final InvoiceCollectionMethods CHARGE_AUTOMATICALLY = + new InvoiceCollectionMethods(Value.CHARGE_AUTOMATICALLY, "charge_automatically"); + + public static final InvoiceCollectionMethods SEND_INVOICE = + new InvoiceCollectionMethods(Value.SEND_INVOICE, "send_invoice"); + + private final Value value; + + private final String string; + + InvoiceCollectionMethods(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof InvoiceCollectionMethods + && this.string.equals(((InvoiceCollectionMethods) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CHARGE_AUTOMATICALLY: + return visitor.visitChargeAutomatically(); + case SEND_INVOICE: + return visitor.visitSendInvoice(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static InvoiceCollectionMethods valueOf(String value) { + switch (value) { + case "charge_automatically": + return CHARGE_AUTOMATICALLY; + case "send_invoice": + return SEND_INVOICE; + default: + return new InvoiceCollectionMethods(Value.UNKNOWN, value); + } + } + + public enum Value { + SEND_INVOICE, + + CHARGE_AUTOMATICALLY, + + UNKNOWN + } + + public interface Visitor { + T visitSendInvoice(); + + T visitChargeAutomatically(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/InvoiceCompany.java b/src/main/java/com/whop/api/types/InvoiceCompany.java new file mode 100644 index 00000000..1977e293 --- /dev/null +++ b/src/main/java/com/whop/api/types/InvoiceCompany.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InvoiceCompany.Builder.class) +public final class InvoiceCompany { + private final String id; + + private final Map additionalProperties; + + private InvoiceCompany(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InvoiceCompany && equalTo((InvoiceCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InvoiceCompany other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(InvoiceCompany other); + } + + public interface _FinalStage { + InvoiceCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InvoiceCompany other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public InvoiceCompany build() { + return new InvoiceCompany(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/InvoiceCurrentPlan.java b/src/main/java/com/whop/api/types/InvoiceCurrentPlan.java new file mode 100644 index 00000000..ee52694e --- /dev/null +++ b/src/main/java/com/whop/api/types/InvoiceCurrentPlan.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InvoiceCurrentPlan.Builder.class) +public final class InvoiceCurrentPlan { + private final Currencies currency; + + private final Optional description; + + private final String formattedPrice; + + private final String id; + + private final Map additionalProperties; + + private InvoiceCurrentPlan( + Currencies currency, + Optional description, + String formattedPrice, + String id, + Map additionalProperties) { + this.currency = currency; + this.description = description; + this.formattedPrice = formattedPrice; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The currency used for all prices on this plan (e.g., 'usd', 'eur'). All monetary amounts on the plan are denominated in this currency. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return A text description of the plan visible to customers. Maximum 1000 characters. Null if no description is set. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The formatted price (including currency) for the plan. + */ + @JsonProperty("formatted_price") + public String getFormattedPrice() { + return formattedPrice; + } + + /** + * @return The unique identifier for the plan. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InvoiceCurrentPlan && equalTo((InvoiceCurrentPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InvoiceCurrentPlan other) { + return currency.equals(other.currency) + && description.equals(other.description) + && formattedPrice.equals(other.formattedPrice) + && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.description, this.formattedPrice, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + /** + *

The currency used for all prices on this plan (e.g., 'usd', 'eur'). All monetary amounts on the plan are denominated in this currency.

+ */ + FormattedPriceStage currency(@NotNull Currencies currency); + + Builder from(InvoiceCurrentPlan other); + } + + public interface FormattedPriceStage { + /** + *

The formatted price (including currency) for the plan.

+ */ + IdStage formattedPrice(@NotNull String formattedPrice); + } + + public interface IdStage { + /** + *

The unique identifier for the plan.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + InvoiceCurrentPlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A text description of the plan visible to customers. Maximum 1000 characters. Null if no description is set.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, FormattedPriceStage, IdStage, _FinalStage { + private Currencies currency; + + private String formattedPrice; + + private String id; + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InvoiceCurrentPlan other) { + currency(other.getCurrency()); + description(other.getDescription()); + formattedPrice(other.getFormattedPrice()); + id(other.getId()); + return this; + } + + /** + *

The currency used for all prices on this plan (e.g., 'usd', 'eur'). All monetary amounts on the plan are denominated in this currency.

+ *

The currency used for all prices on this plan (e.g., 'usd', 'eur'). All monetary amounts on the plan are denominated in this currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public FormattedPriceStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The formatted price (including currency) for the plan.

+ *

The formatted price (including currency) for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("formatted_price") + public IdStage formattedPrice(@NotNull String formattedPrice) { + this.formattedPrice = Objects.requireNonNull(formattedPrice, "formattedPrice must not be null"); + return this; + } + + /** + *

The unique identifier for the plan.

+ *

The unique identifier for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

A text description of the plan visible to customers. Maximum 1000 characters. Null if no description is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

A text description of the plan visible to customers. Maximum 1000 characters. Null if no description is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

A text description of the plan visible to customers. Maximum 1000 characters. Null if no description is set.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public InvoiceCurrentPlan build() { + return new InvoiceCurrentPlan(currency, description, formattedPrice, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/InvoiceLineItemsItem.java b/src/main/java/com/whop/api/types/InvoiceLineItemsItem.java new file mode 100644 index 00000000..2fa1d6d0 --- /dev/null +++ b/src/main/java/com/whop/api/types/InvoiceLineItemsItem.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InvoiceLineItemsItem.Builder.class) +public final class InvoiceLineItemsItem { + private final String label; + + private final int position; + + private final double quantity; + + private final double total; + + private final double unitPrice; + + private final Map additionalProperties; + + private InvoiceLineItemsItem( + String label, + int position, + double quantity, + double total, + double unitPrice, + Map additionalProperties) { + this.label = label; + this.position = position; + this.quantity = quantity; + this.total = total; + this.unitPrice = unitPrice; + this.additionalProperties = additionalProperties; + } + + /** + * @return The label or description for this line item. + */ + @JsonProperty("label") + public String getLabel() { + return label; + } + + /** + * @return The display order of this line item within the invoice. + */ + @JsonProperty("position") + public int getPosition() { + return position; + } + + /** + * @return The quantity of this line item. + */ + @JsonProperty("quantity") + public double getQuantity() { + return quantity; + } + + /** + * @return The computed total for this line item (quantity * unit_price). + */ + @JsonProperty("total") + public double getTotal() { + return total; + } + + /** + * @return The unit price for this line item. + */ + @JsonProperty("unit_price") + public double getUnitPrice() { + return unitPrice; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InvoiceLineItemsItem && equalTo((InvoiceLineItemsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InvoiceLineItemsItem other) { + return label.equals(other.label) + && position == other.position + && quantity == other.quantity + && total == other.total + && unitPrice == other.unitPrice; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.label, this.position, this.quantity, this.total, this.unitPrice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LabelStage builder() { + return new Builder(); + } + + public interface LabelStage { + /** + *

The label or description for this line item.

+ */ + PositionStage label(@NotNull String label); + + Builder from(InvoiceLineItemsItem other); + } + + public interface PositionStage { + /** + *

The display order of this line item within the invoice.

+ */ + QuantityStage position(int position); + } + + public interface QuantityStage { + /** + *

The quantity of this line item.

+ */ + TotalStage quantity(double quantity); + } + + public interface TotalStage { + /** + *

The computed total for this line item (quantity * unit_price).

+ */ + UnitPriceStage total(double total); + } + + public interface UnitPriceStage { + /** + *

The unit price for this line item.

+ */ + _FinalStage unitPrice(double unitPrice); + } + + public interface _FinalStage { + InvoiceLineItemsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements LabelStage, PositionStage, QuantityStage, TotalStage, UnitPriceStage, _FinalStage { + private String label; + + private int position; + + private double quantity; + + private double total; + + private double unitPrice; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InvoiceLineItemsItem other) { + label(other.getLabel()); + position(other.getPosition()); + quantity(other.getQuantity()); + total(other.getTotal()); + unitPrice(other.getUnitPrice()); + return this; + } + + /** + *

The label or description for this line item.

+ *

The label or description for this line item.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("label") + public PositionStage label(@NotNull String label) { + this.label = Objects.requireNonNull(label, "label must not be null"); + return this; + } + + /** + *

The display order of this line item within the invoice.

+ *

The display order of this line item within the invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("position") + public QuantityStage position(int position) { + this.position = position; + return this; + } + + /** + *

The quantity of this line item.

+ *

The quantity of this line item.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("quantity") + public TotalStage quantity(double quantity) { + this.quantity = quantity; + return this; + } + + /** + *

The computed total for this line item (quantity * unit_price).

+ *

The computed total for this line item (quantity * unit_price).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total") + public UnitPriceStage total(double total) { + this.total = total; + return this; + } + + /** + *

The unit price for this line item.

+ *

The unit price for this line item.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("unit_price") + public _FinalStage unitPrice(double unitPrice) { + this.unitPrice = unitPrice; + return this; + } + + @java.lang.Override + public InvoiceLineItemsItem build() { + return new InvoiceLineItemsItem(label, position, quantity, total, unitPrice, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/InvoiceListItem.java b/src/main/java/com/whop/api/types/InvoiceListItem.java new file mode 100644 index 00000000..d528edf7 --- /dev/null +++ b/src/main/java/com/whop/api/types/InvoiceListItem.java @@ -0,0 +1,650 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InvoiceListItem.Builder.class) +public final class InvoiceListItem { + private final OffsetDateTime createdAt; + + private final InvoiceListItemCurrentPlan currentPlan; + + private final Optional dueDate; + + private final Optional emailAddress; + + private final String fetchInvoiceToken; + + private final String id; + + private final List lineItems; + + private final String number; + + private final boolean paymentProcessing; + + private final InvoiceStatuses status; + + private final Optional user; + + private final Map additionalProperties; + + private InvoiceListItem( + OffsetDateTime createdAt, + InvoiceListItemCurrentPlan currentPlan, + Optional dueDate, + Optional emailAddress, + String fetchInvoiceToken, + String id, + List lineItems, + String number, + boolean paymentProcessing, + InvoiceStatuses status, + Optional user, + Map additionalProperties) { + this.createdAt = createdAt; + this.currentPlan = currentPlan; + this.dueDate = dueDate; + this.emailAddress = emailAddress; + this.fetchInvoiceToken = fetchInvoiceToken; + this.id = id; + this.lineItems = lineItems; + this.number = number; + this.paymentProcessing = paymentProcessing; + this.status = status; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The datetime the invoice was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The plan that this invoice charges for. + */ + @JsonProperty("current_plan") + public InvoiceListItemCurrentPlan getCurrentPlan() { + return currentPlan; + } + + /** + * @return The deadline by which payment is expected. Null if the invoice is collected automatically. + */ + @JsonIgnore + public Optional getDueDate() { + if (dueDate == null) { + return Optional.empty(); + } + return dueDate; + } + + /** + * @return The email address of the customer this invoice is addressed to. Null if no email is on file. + */ + @JsonIgnore + public Optional getEmailAddress() { + if (emailAddress == null) { + return Optional.empty(); + } + return emailAddress; + } + + /** + * @return A signed token that allows fetching invoice data publicly without authentication. + */ + @JsonProperty("fetch_invoice_token") + public String getFetchInvoiceToken() { + return fetchInvoiceToken; + } + + /** + * @return The unique identifier for the invoice. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Optional line items that break down the invoice total into individual charges. + */ + @JsonProperty("line_items") + public List getLineItems() { + return lineItems; + } + + /** + * @return The sequential invoice number for display purposes. + */ + @JsonProperty("number") + public String getNumber() { + return number; + } + + /** + * @return Whether a payment on this invoice is still clearing. True while a delayed payment method such as ACH or SEPA settles, during which the invoice stays open and is not marked past due. + */ + @JsonProperty("payment_processing") + public boolean getPaymentProcessing() { + return paymentProcessing; + } + + /** + * @return The current payment status of the invoice, such as draft, open, paid, or void. + */ + @JsonProperty("status") + public InvoiceStatuses getStatus() { + return status; + } + + /** + * @return The user this invoice is addressed to. Null if the user account has been removed. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("due_date") + private Optional _getDueDate() { + return dueDate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email_address") + private Optional _getEmailAddress() { + return emailAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InvoiceListItem && equalTo((InvoiceListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InvoiceListItem other) { + return createdAt.equals(other.createdAt) + && currentPlan.equals(other.currentPlan) + && dueDate.equals(other.dueDate) + && emailAddress.equals(other.emailAddress) + && fetchInvoiceToken.equals(other.fetchInvoiceToken) + && id.equals(other.id) + && lineItems.equals(other.lineItems) + && number.equals(other.number) + && paymentProcessing == other.paymentProcessing + && status.equals(other.status) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, + this.currentPlan, + this.dueDate, + this.emailAddress, + this.fetchInvoiceToken, + this.id, + this.lineItems, + this.number, + this.paymentProcessing, + this.status, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the invoice was created.

+ */ + CurrentPlanStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(InvoiceListItem other); + } + + public interface CurrentPlanStage { + /** + *

The plan that this invoice charges for.

+ */ + FetchInvoiceTokenStage currentPlan(@NotNull InvoiceListItemCurrentPlan currentPlan); + } + + public interface FetchInvoiceTokenStage { + /** + *

A signed token that allows fetching invoice data publicly without authentication.

+ */ + IdStage fetchInvoiceToken(@NotNull String fetchInvoiceToken); + } + + public interface IdStage { + /** + *

The unique identifier for the invoice.

+ */ + NumberStage id(@NotNull String id); + } + + public interface NumberStage { + /** + *

The sequential invoice number for display purposes.

+ */ + PaymentProcessingStage number(@NotNull String number); + } + + public interface PaymentProcessingStage { + /** + *

Whether a payment on this invoice is still clearing. True while a delayed payment method such as ACH or SEPA settles, during which the invoice stays open and is not marked past due.

+ */ + StatusStage paymentProcessing(boolean paymentProcessing); + } + + public interface StatusStage { + /** + *

The current payment status of the invoice, such as draft, open, paid, or void.

+ */ + _FinalStage status(@NotNull InvoiceStatuses status); + } + + public interface _FinalStage { + InvoiceListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The deadline by which payment is expected. Null if the invoice is collected automatically.

+ */ + _FinalStage dueDate(Optional dueDate); + + _FinalStage dueDate(OffsetDateTime dueDate); + + _FinalStage dueDate(Nullable dueDate); + + /** + *

The email address of the customer this invoice is addressed to. Null if no email is on file.

+ */ + _FinalStage emailAddress(Optional emailAddress); + + _FinalStage emailAddress(String emailAddress); + + _FinalStage emailAddress(Nullable emailAddress); + + /** + *

Optional line items that break down the invoice total into individual charges.

+ */ + _FinalStage lineItems(List lineItems); + + _FinalStage addLineItems(InvoiceListItemLineItemsItem lineItems); + + _FinalStage addAllLineItems(List lineItems); + + /** + *

The user this invoice is addressed to. Null if the user account has been removed.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(InvoiceListItemUser user); + + _FinalStage user(Nullable user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + CurrentPlanStage, + FetchInvoiceTokenStage, + IdStage, + NumberStage, + PaymentProcessingStage, + StatusStage, + _FinalStage { + private OffsetDateTime createdAt; + + private InvoiceListItemCurrentPlan currentPlan; + + private String fetchInvoiceToken; + + private String id; + + private String number; + + private boolean paymentProcessing; + + private InvoiceStatuses status; + + private Optional user = Optional.empty(); + + private List lineItems = new ArrayList<>(); + + private Optional emailAddress = Optional.empty(); + + private Optional dueDate = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InvoiceListItem other) { + createdAt(other.getCreatedAt()); + currentPlan(other.getCurrentPlan()); + dueDate(other.getDueDate()); + emailAddress(other.getEmailAddress()); + fetchInvoiceToken(other.getFetchInvoiceToken()); + id(other.getId()); + lineItems(other.getLineItems()); + number(other.getNumber()); + paymentProcessing(other.getPaymentProcessing()); + status(other.getStatus()); + user(other.getUser()); + return this; + } + + /** + *

The datetime the invoice was created.

+ *

The datetime the invoice was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrentPlanStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The plan that this invoice charges for.

+ *

The plan that this invoice charges for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("current_plan") + public FetchInvoiceTokenStage currentPlan(@NotNull InvoiceListItemCurrentPlan currentPlan) { + this.currentPlan = Objects.requireNonNull(currentPlan, "currentPlan must not be null"); + return this; + } + + /** + *

A signed token that allows fetching invoice data publicly without authentication.

+ *

A signed token that allows fetching invoice data publicly without authentication.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fetch_invoice_token") + public IdStage fetchInvoiceToken(@NotNull String fetchInvoiceToken) { + this.fetchInvoiceToken = Objects.requireNonNull(fetchInvoiceToken, "fetchInvoiceToken must not be null"); + return this; + } + + /** + *

The unique identifier for the invoice.

+ *

The unique identifier for the invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NumberStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The sequential invoice number for display purposes.

+ *

The sequential invoice number for display purposes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("number") + public PaymentProcessingStage number(@NotNull String number) { + this.number = Objects.requireNonNull(number, "number must not be null"); + return this; + } + + /** + *

Whether a payment on this invoice is still clearing. True while a delayed payment method such as ACH or SEPA settles, during which the invoice stays open and is not marked past due.

+ *

Whether a payment on this invoice is still clearing. True while a delayed payment method such as ACH or SEPA settles, during which the invoice stays open and is not marked past due.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_processing") + public StatusStage paymentProcessing(boolean paymentProcessing) { + this.paymentProcessing = paymentProcessing; + return this; + } + + /** + *

The current payment status of the invoice, such as draft, open, paid, or void.

+ *

The current payment status of the invoice, such as draft, open, paid, or void.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull InvoiceStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The user this invoice is addressed to. Null if the user account has been removed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The user this invoice is addressed to. Null if the user account has been removed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(InvoiceListItemUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The user this invoice is addressed to. Null if the user account has been removed.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + /** + *

Optional line items that break down the invoice total into individual charges.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllLineItems(List lineItems) { + if (lineItems != null) { + this.lineItems.addAll(lineItems); + } + return this; + } + + /** + *

Optional line items that break down the invoice total into individual charges.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addLineItems(InvoiceListItemLineItemsItem lineItems) { + this.lineItems.add(lineItems); + return this; + } + + /** + *

Optional line items that break down the invoice total into individual charges.

+ */ + @java.lang.Override + @JsonSetter(value = "line_items", nulls = Nulls.SKIP) + public _FinalStage lineItems(List lineItems) { + this.lineItems.clear(); + if (lineItems != null) { + this.lineItems.addAll(lineItems); + } + return this; + } + + /** + *

The email address of the customer this invoice is addressed to. Null if no email is on file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emailAddress(Nullable emailAddress) { + if (emailAddress.isNull()) { + this.emailAddress = null; + } else if (emailAddress.isEmpty()) { + this.emailAddress = Optional.empty(); + } else { + this.emailAddress = Optional.of(emailAddress.get()); + } + return this; + } + + /** + *

The email address of the customer this invoice is addressed to. Null if no email is on file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emailAddress(String emailAddress) { + this.emailAddress = Optional.ofNullable(emailAddress); + return this; + } + + /** + *

The email address of the customer this invoice is addressed to. Null if no email is on file.

+ */ + @java.lang.Override + @JsonSetter(value = "email_address", nulls = Nulls.SKIP) + public _FinalStage emailAddress(Optional emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + *

The deadline by which payment is expected. Null if the invoice is collected automatically.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dueDate(Nullable dueDate) { + if (dueDate.isNull()) { + this.dueDate = null; + } else if (dueDate.isEmpty()) { + this.dueDate = Optional.empty(); + } else { + this.dueDate = Optional.of(dueDate.get()); + } + return this; + } + + /** + *

The deadline by which payment is expected. Null if the invoice is collected automatically.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dueDate(OffsetDateTime dueDate) { + this.dueDate = Optional.ofNullable(dueDate); + return this; + } + + /** + *

The deadline by which payment is expected. Null if the invoice is collected automatically.

+ */ + @java.lang.Override + @JsonSetter(value = "due_date", nulls = Nulls.SKIP) + public _FinalStage dueDate(Optional dueDate) { + this.dueDate = dueDate; + return this; + } + + @java.lang.Override + public InvoiceListItem build() { + return new InvoiceListItem( + createdAt, + currentPlan, + dueDate, + emailAddress, + fetchInvoiceToken, + id, + lineItems, + number, + paymentProcessing, + status, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/InvoiceListItemCurrentPlan.java b/src/main/java/com/whop/api/types/InvoiceListItemCurrentPlan.java new file mode 100644 index 00000000..657b45a6 --- /dev/null +++ b/src/main/java/com/whop/api/types/InvoiceListItemCurrentPlan.java @@ -0,0 +1,196 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InvoiceListItemCurrentPlan.Builder.class) +public final class InvoiceListItemCurrentPlan { + private final Currencies currency; + + private final String formattedPrice; + + private final String id; + + private final Map additionalProperties; + + private InvoiceListItemCurrentPlan( + Currencies currency, String formattedPrice, String id, Map additionalProperties) { + this.currency = currency; + this.formattedPrice = formattedPrice; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The currency used for all prices on this plan (e.g., 'usd', 'eur'). All monetary amounts on the plan are denominated in this currency. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The formatted price (including currency) for the plan. + */ + @JsonProperty("formatted_price") + public String getFormattedPrice() { + return formattedPrice; + } + + /** + * @return The unique identifier for the plan. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InvoiceListItemCurrentPlan && equalTo((InvoiceListItemCurrentPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InvoiceListItemCurrentPlan other) { + return currency.equals(other.currency) && formattedPrice.equals(other.formattedPrice) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.formattedPrice, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + /** + *

The currency used for all prices on this plan (e.g., 'usd', 'eur'). All monetary amounts on the plan are denominated in this currency.

+ */ + FormattedPriceStage currency(@NotNull Currencies currency); + + Builder from(InvoiceListItemCurrentPlan other); + } + + public interface FormattedPriceStage { + /** + *

The formatted price (including currency) for the plan.

+ */ + IdStage formattedPrice(@NotNull String formattedPrice); + } + + public interface IdStage { + /** + *

The unique identifier for the plan.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + InvoiceListItemCurrentPlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, FormattedPriceStage, IdStage, _FinalStage { + private Currencies currency; + + private String formattedPrice; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InvoiceListItemCurrentPlan other) { + currency(other.getCurrency()); + formattedPrice(other.getFormattedPrice()); + id(other.getId()); + return this; + } + + /** + *

The currency used for all prices on this plan (e.g., 'usd', 'eur'). All monetary amounts on the plan are denominated in this currency.

+ *

The currency used for all prices on this plan (e.g., 'usd', 'eur'). All monetary amounts on the plan are denominated in this currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public FormattedPriceStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The formatted price (including currency) for the plan.

+ *

The formatted price (including currency) for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("formatted_price") + public IdStage formattedPrice(@NotNull String formattedPrice) { + this.formattedPrice = Objects.requireNonNull(formattedPrice, "formattedPrice must not be null"); + return this; + } + + /** + *

The unique identifier for the plan.

+ *

The unique identifier for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public InvoiceListItemCurrentPlan build() { + return new InvoiceListItemCurrentPlan(currency, formattedPrice, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/InvoiceListItemLineItemsItem.java b/src/main/java/com/whop/api/types/InvoiceListItemLineItemsItem.java new file mode 100644 index 00000000..d4eeabfc --- /dev/null +++ b/src/main/java/com/whop/api/types/InvoiceListItemLineItemsItem.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InvoiceListItemLineItemsItem.Builder.class) +public final class InvoiceListItemLineItemsItem { + private final String label; + + private final int position; + + private final double quantity; + + private final double total; + + private final double unitPrice; + + private final Map additionalProperties; + + private InvoiceListItemLineItemsItem( + String label, + int position, + double quantity, + double total, + double unitPrice, + Map additionalProperties) { + this.label = label; + this.position = position; + this.quantity = quantity; + this.total = total; + this.unitPrice = unitPrice; + this.additionalProperties = additionalProperties; + } + + /** + * @return The label or description for this line item. + */ + @JsonProperty("label") + public String getLabel() { + return label; + } + + /** + * @return The display order of this line item within the invoice. + */ + @JsonProperty("position") + public int getPosition() { + return position; + } + + /** + * @return The quantity of this line item. + */ + @JsonProperty("quantity") + public double getQuantity() { + return quantity; + } + + /** + * @return The computed total for this line item (quantity * unit_price). + */ + @JsonProperty("total") + public double getTotal() { + return total; + } + + /** + * @return The unit price for this line item. + */ + @JsonProperty("unit_price") + public double getUnitPrice() { + return unitPrice; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InvoiceListItemLineItemsItem && equalTo((InvoiceListItemLineItemsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InvoiceListItemLineItemsItem other) { + return label.equals(other.label) + && position == other.position + && quantity == other.quantity + && total == other.total + && unitPrice == other.unitPrice; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.label, this.position, this.quantity, this.total, this.unitPrice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LabelStage builder() { + return new Builder(); + } + + public interface LabelStage { + /** + *

The label or description for this line item.

+ */ + PositionStage label(@NotNull String label); + + Builder from(InvoiceListItemLineItemsItem other); + } + + public interface PositionStage { + /** + *

The display order of this line item within the invoice.

+ */ + QuantityStage position(int position); + } + + public interface QuantityStage { + /** + *

The quantity of this line item.

+ */ + TotalStage quantity(double quantity); + } + + public interface TotalStage { + /** + *

The computed total for this line item (quantity * unit_price).

+ */ + UnitPriceStage total(double total); + } + + public interface UnitPriceStage { + /** + *

The unit price for this line item.

+ */ + _FinalStage unitPrice(double unitPrice); + } + + public interface _FinalStage { + InvoiceListItemLineItemsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements LabelStage, PositionStage, QuantityStage, TotalStage, UnitPriceStage, _FinalStage { + private String label; + + private int position; + + private double quantity; + + private double total; + + private double unitPrice; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InvoiceListItemLineItemsItem other) { + label(other.getLabel()); + position(other.getPosition()); + quantity(other.getQuantity()); + total(other.getTotal()); + unitPrice(other.getUnitPrice()); + return this; + } + + /** + *

The label or description for this line item.

+ *

The label or description for this line item.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("label") + public PositionStage label(@NotNull String label) { + this.label = Objects.requireNonNull(label, "label must not be null"); + return this; + } + + /** + *

The display order of this line item within the invoice.

+ *

The display order of this line item within the invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("position") + public QuantityStage position(int position) { + this.position = position; + return this; + } + + /** + *

The quantity of this line item.

+ *

The quantity of this line item.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("quantity") + public TotalStage quantity(double quantity) { + this.quantity = quantity; + return this; + } + + /** + *

The computed total for this line item (quantity * unit_price).

+ *

The computed total for this line item (quantity * unit_price).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total") + public UnitPriceStage total(double total) { + this.total = total; + return this; + } + + /** + *

The unit price for this line item.

+ *

The unit price for this line item.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("unit_price") + public _FinalStage unitPrice(double unitPrice) { + this.unitPrice = unitPrice; + return this; + } + + @java.lang.Override + public InvoiceListItemLineItemsItem build() { + return new InvoiceListItemLineItemsItem(label, position, quantity, total, unitPrice, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/InvoiceListItemUser.java b/src/main/java/com/whop/api/types/InvoiceListItemUser.java new file mode 100644 index 00000000..1504c65e --- /dev/null +++ b/src/main/java/com/whop/api/types/InvoiceListItemUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InvoiceListItemUser.Builder.class) +public final class InvoiceListItemUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private InvoiceListItemUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InvoiceListItemUser && equalTo((InvoiceListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InvoiceListItemUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(InvoiceListItemUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + InvoiceListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InvoiceListItemUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public InvoiceListItemUser build() { + return new InvoiceListItemUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/InvoiceMailingAddress.java b/src/main/java/com/whop/api/types/InvoiceMailingAddress.java new file mode 100644 index 00000000..1d484cbf --- /dev/null +++ b/src/main/java/com/whop/api/types/InvoiceMailingAddress.java @@ -0,0 +1,488 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InvoiceMailingAddress.Builder.class) +public final class InvoiceMailingAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional name; + + private final Optional phone; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private InvoiceMailingAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional name, + Optional phone, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.name = name; + this.phone = phone; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The name of the customer. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The phone number of the customer. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InvoiceMailingAddress && equalTo((InvoiceMailingAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InvoiceMailingAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && name.equals(other.name) + && phone.equals(other.phone) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.city, this.country, this.line1, this.line2, this.name, this.phone, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(InvoiceMailingAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + name(other.getName()); + phone(other.getPhone()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The name of the customer.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The phone number of the customer.

+ */ + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + public Builder phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public InvoiceMailingAddress build() { + return new InvoiceMailingAddress( + city, country, line1, line2, name, phone, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/InvoiceMember.java b/src/main/java/com/whop/api/types/InvoiceMember.java new file mode 100644 index 00000000..3308693a --- /dev/null +++ b/src/main/java/com/whop/api/types/InvoiceMember.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InvoiceMember.Builder.class) +public final class InvoiceMember { + private final String id; + + private final Map additionalProperties; + + private InvoiceMember(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company member. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InvoiceMember && equalTo((InvoiceMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InvoiceMember other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company member.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(InvoiceMember other); + } + + public interface _FinalStage { + InvoiceMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InvoiceMember other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the company member.

+ *

The unique identifier for the company member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public InvoiceMember build() { + return new InvoiceMember(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/InvoicePayment.java b/src/main/java/com/whop/api/types/InvoicePayment.java new file mode 100644 index 00000000..fbceae25 --- /dev/null +++ b/src/main/java/com/whop/api/types/InvoicePayment.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InvoicePayment.Builder.class) +public final class InvoicePayment { + private final String id; + + private final Map additionalProperties; + + private InvoicePayment(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the payment. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InvoicePayment && equalTo((InvoicePayment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InvoicePayment other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the payment.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(InvoicePayment other); + } + + public interface _FinalStage { + InvoicePayment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InvoicePayment other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the payment.

+ *

The unique identifier for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public InvoicePayment build() { + return new InvoicePayment(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/InvoiceProduct.java b/src/main/java/com/whop/api/types/InvoiceProduct.java new file mode 100644 index 00000000..07a34b43 --- /dev/null +++ b/src/main/java/com/whop/api/types/InvoiceProduct.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InvoiceProduct.Builder.class) +public final class InvoiceProduct { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private InvoiceProduct(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the product. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the product shown to customers on the product page and in search results. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InvoiceProduct && equalTo((InvoiceProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InvoiceProduct other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the product.

+ */ + TitleStage id(@NotNull String id); + + Builder from(InvoiceProduct other); + } + + public interface TitleStage { + /** + *

The display name of the product shown to customers on the product page and in search results.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + InvoiceProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InvoiceProduct other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the product.

+ *

The unique identifier for the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the product shown to customers on the product page and in search results.

+ *

The display name of the product shown to customers on the product page and in search results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public InvoiceProduct build() { + return new InvoiceProduct(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/InvoiceStatuses.java b/src/main/java/com/whop/api/types/InvoiceStatuses.java new file mode 100644 index 00000000..5fbf248c --- /dev/null +++ b/src/main/java/com/whop/api/types/InvoiceStatuses.java @@ -0,0 +1,123 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class InvoiceStatuses { + public static final InvoiceStatuses PAST_DUE = new InvoiceStatuses(Value.PAST_DUE, "past_due"); + + public static final InvoiceStatuses VOID = new InvoiceStatuses(Value.VOID, "void"); + + public static final InvoiceStatuses PAID = new InvoiceStatuses(Value.PAID, "paid"); + + public static final InvoiceStatuses DRAFT = new InvoiceStatuses(Value.DRAFT, "draft"); + + public static final InvoiceStatuses UNCOLLECTIBLE = new InvoiceStatuses(Value.UNCOLLECTIBLE, "uncollectible"); + + public static final InvoiceStatuses OPEN = new InvoiceStatuses(Value.OPEN, "open"); + + private final Value value; + + private final String string; + + InvoiceStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof InvoiceStatuses && this.string.equals(((InvoiceStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAST_DUE: + return visitor.visitPastDue(); + case VOID: + return visitor.visitVoid(); + case PAID: + return visitor.visitPaid(); + case DRAFT: + return visitor.visitDraft(); + case UNCOLLECTIBLE: + return visitor.visitUncollectible(); + case OPEN: + return visitor.visitOpen(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static InvoiceStatuses valueOf(String value) { + switch (value) { + case "past_due": + return PAST_DUE; + case "void": + return VOID; + case "paid": + return PAID; + case "draft": + return DRAFT; + case "uncollectible": + return UNCOLLECTIBLE; + case "open": + return OPEN; + default: + return new InvoiceStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + DRAFT, + + OPEN, + + PAID, + + PAST_DUE, + + UNCOLLECTIBLE, + + VOID, + + UNKNOWN + } + + public interface Visitor { + T visitDraft(); + + T visitOpen(); + + T visitPaid(); + + T visitPastDue(); + + T visitUncollectible(); + + T visitVoid(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/InvoiceUser.java b/src/main/java/com/whop/api/types/InvoiceUser.java new file mode 100644 index 00000000..4d7cd912 --- /dev/null +++ b/src/main/java/com/whop/api/types/InvoiceUser.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InvoiceUser.Builder.class) +public final class InvoiceUser { + private final Optional email; + + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private InvoiceUser( + Optional email, + String id, + Optional name, + String username, + Map additionalProperties) { + this.email = email; + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's email address. Requires the member:email:read permission to access. Null if not authorized. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InvoiceUser && equalTo((InvoiceUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InvoiceUser other) { + return email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(InvoiceUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + InvoiceUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InvoiceUser other) { + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public InvoiceUser build() { + return new InvoiceUser(email, id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/InvoicesSortableColumns.java b/src/main/java/com/whop/api/types/InvoicesSortableColumns.java new file mode 100644 index 00000000..cc7729f3 --- /dev/null +++ b/src/main/java/com/whop/api/types/InvoicesSortableColumns.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class InvoicesSortableColumns { + public static final InvoicesSortableColumns CREATED_AT = + new InvoicesSortableColumns(Value.CREATED_AT, "created_at"); + + public static final InvoicesSortableColumns ID = new InvoicesSortableColumns(Value.ID, "id"); + + public static final InvoicesSortableColumns DUE_DATE = new InvoicesSortableColumns(Value.DUE_DATE, "due_date"); + + private final Value value; + + private final String string; + + InvoicesSortableColumns(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof InvoicesSortableColumns + && this.string.equals(((InvoicesSortableColumns) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATED_AT: + return visitor.visitCreatedAt(); + case ID: + return visitor.visitId(); + case DUE_DATE: + return visitor.visitDueDate(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static InvoicesSortableColumns valueOf(String value) { + switch (value) { + case "created_at": + return CREATED_AT; + case "id": + return ID; + case "due_date": + return DUE_DATE; + default: + return new InvoicesSortableColumns(Value.UNKNOWN, value); + } + } + + public enum Value { + ID, + + CREATED_AT, + + DUE_DATE, + + UNKNOWN + } + + public interface Visitor { + T visitId(); + + T visitCreatedAt(); + + T visitDueDate(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/LanguageTargetingOption.java b/src/main/java/com/whop/api/types/LanguageTargetingOption.java new file mode 100644 index 00000000..6a2b56fa --- /dev/null +++ b/src/main/java/com/whop/api/types/LanguageTargetingOption.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LanguageTargetingOption.Builder.class) +public final class LanguageTargetingOption { + private final String code; + + private final String name; + + private final Map additionalProperties; + + private LanguageTargetingOption(String code, String name, Map additionalProperties) { + this.code = code; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return ISO 639 code the ad-group languages field takes, such as en. + */ + @JsonProperty("code") + public String getCode() { + return code; + } + + /** + * @return Display name, such as English. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LanguageTargetingOption && equalTo((LanguageTargetingOption) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LanguageTargetingOption other) { + return code.equals(other.code) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CodeStage builder() { + return new Builder(); + } + + public interface CodeStage { + /** + *

ISO 639 code the ad-group languages field takes, such as en.

+ */ + NameStage code(@NotNull String code); + + Builder from(LanguageTargetingOption other); + } + + public interface NameStage { + /** + *

Display name, such as English.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + LanguageTargetingOption build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CodeStage, NameStage, _FinalStage { + private String code; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LanguageTargetingOption other) { + code(other.getCode()); + name(other.getName()); + return this; + } + + /** + *

ISO 639 code the ad-group languages field takes, such as en.

+ *

ISO 639 code the ad-group languages field takes, such as en.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("code") + public NameStage code(@NotNull String code) { + this.code = Objects.requireNonNull(code, "code must not be null"); + return this; + } + + /** + *

Display name, such as English.

+ *

Display name, such as English.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public LanguageTargetingOption build() { + return new LanguageTargetingOption(code, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Languages.java b/src/main/java/com/whop/api/types/Languages.java new file mode 100644 index 00000000..0563422a --- /dev/null +++ b/src/main/java/com/whop/api/types/Languages.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class Languages { + public static final Languages EN = new Languages(Value.EN, "en"); + + public static final Languages NL = new Languages(Value.NL, "nl"); + + public static final Languages BG = new Languages(Value.BG, "bg"); + + public static final Languages DA = new Languages(Value.DA, "da"); + + public static final Languages PT = new Languages(Value.PT, "pt"); + + public static final Languages FR = new Languages(Value.FR, "fr"); + + public static final Languages TR = new Languages(Value.TR, "tr"); + + public static final Languages NO = new Languages(Value.NO, "no"); + + public static final Languages FI = new Languages(Value.FI, "fi"); + + public static final Languages CA = new Languages(Value.CA, "ca"); + + public static final Languages UK = new Languages(Value.UK, "uk"); + + public static final Languages RO = new Languages(Value.RO, "ro"); + + public static final Languages ES = new Languages(Value.ES, "es"); + + public static final Languages PL = new Languages(Value.PL, "pl"); + + public static final Languages DE = new Languages(Value.DE, "de"); + + public static final Languages HR = new Languages(Value.HR, "hr"); + + public static final Languages SV = new Languages(Value.SV, "sv"); + + public static final Languages SK = new Languages(Value.SK, "sk"); + + public static final Languages IT = new Languages(Value.IT, "it"); + + public static final Languages EL = new Languages(Value.EL, "el"); + + public static final Languages RU = new Languages(Value.RU, "ru"); + + public static final Languages CS = new Languages(Value.CS, "cs"); + + private final Value value; + + private final String string; + + Languages(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof Languages && this.string.equals(((Languages) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EN: + return visitor.visitEn(); + case NL: + return visitor.visitNl(); + case BG: + return visitor.visitBg(); + case DA: + return visitor.visitDa(); + case PT: + return visitor.visitPt(); + case FR: + return visitor.visitFr(); + case TR: + return visitor.visitTr(); + case NO: + return visitor.visitNo(); + case FI: + return visitor.visitFi(); + case CA: + return visitor.visitCa(); + case UK: + return visitor.visitUk(); + case RO: + return visitor.visitRo(); + case ES: + return visitor.visitEs(); + case PL: + return visitor.visitPl(); + case DE: + return visitor.visitDe(); + case HR: + return visitor.visitHr(); + case SV: + return visitor.visitSv(); + case SK: + return visitor.visitSk(); + case IT: + return visitor.visitIt(); + case EL: + return visitor.visitEl(); + case RU: + return visitor.visitRu(); + case CS: + return visitor.visitCs(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static Languages valueOf(String value) { + switch (value) { + case "en": + return EN; + case "nl": + return NL; + case "bg": + return BG; + case "da": + return DA; + case "pt": + return PT; + case "fr": + return FR; + case "tr": + return TR; + case "no": + return NO; + case "fi": + return FI; + case "ca": + return CA; + case "uk": + return UK; + case "ro": + return RO; + case "es": + return ES; + case "pl": + return PL; + case "de": + return DE; + case "hr": + return HR; + case "sv": + return SV; + case "sk": + return SK; + case "it": + return IT; + case "el": + return EL; + case "ru": + return RU; + case "cs": + return CS; + default: + return new Languages(Value.UNKNOWN, value); + } + } + + public enum Value { + EN, + + ES, + + IT, + + PT, + + DE, + + FR, + + PL, + + RU, + + NL, + + CA, + + TR, + + SV, + + UK, + + NO, + + FI, + + SK, + + EL, + + CS, + + HR, + + DA, + + RO, + + BG, + + UNKNOWN + } + + public interface Visitor { + T visitEn(); + + T visitEs(); + + T visitIt(); + + T visitPt(); + + T visitDe(); + + T visitFr(); + + T visitPl(); + + T visitRu(); + + T visitNl(); + + T visitCa(); + + T visitTr(); + + T visitSv(); + + T visitUk(); + + T visitNo(); + + T visitFi(); + + T visitSk(); + + T visitEl(); + + T visitCs(); + + T visitHr(); + + T visitDa(); + + T visitRo(); + + T visitBg(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Lead.java b/src/main/java/com/whop/api/types/Lead.java new file mode 100644 index 00000000..42873d0d --- /dev/null +++ b/src/main/java/com/whop/api/types/Lead.java @@ -0,0 +1,530 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Lead.Builder.class) +public final class Lead { + private final OffsetDateTime createdAt; + + private final String id; + + private final Optional member; + + private final Optional> metadata; + + private final Optional product; + + private final Optional referrer; + + private final OffsetDateTime updatedAt; + + private final LeadUser user; + + private final Map additionalProperties; + + private Lead( + OffsetDateTime createdAt, + String id, + Optional member, + Optional> metadata, + Optional product, + Optional referrer, + OffsetDateTime updatedAt, + LeadUser user, + Map additionalProperties) { + this.createdAt = createdAt; + this.id = id; + this.member = member; + this.metadata = metadata; + this.product = product; + this.referrer = referrer; + this.updatedAt = updatedAt; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The datetime the lead was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the lead. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The company member record if this lead has converted into a paying customer. Null if the lead has not converted. + */ + @JsonIgnore + public Optional getMember() { + if (member == null) { + return Optional.empty(); + } + return member; + } + + /** + * @return Custom key-value pairs attached to this lead. Null if no metadata was provided. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The product the lead expressed interest in. Null if the lead is not associated with a specific product. + */ + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return The URL of the page that referred this lead to the company. Null if no referrer was captured. + */ + @JsonIgnore + public Optional getReferrer() { + if (referrer == null) { + return Optional.empty(); + } + return referrer; + } + + /** + * @return The datetime the lead was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user account associated with this lead. + */ + @JsonProperty("user") + public LeadUser getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member") + private Optional _getMember() { + return member; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("referrer") + private Optional _getReferrer() { + return referrer; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Lead && equalTo((Lead) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Lead other) { + return createdAt.equals(other.createdAt) + && id.equals(other.id) + && member.equals(other.member) + && metadata.equals(other.metadata) + && product.equals(other.product) + && referrer.equals(other.referrer) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, + this.id, + this.member, + this.metadata, + this.product, + this.referrer, + this.updatedAt, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the lead was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(Lead other); + } + + public interface IdStage { + /** + *

The unique identifier for the lead.

+ */ + UpdatedAtStage id(@NotNull String id); + } + + public interface UpdatedAtStage { + /** + *

The datetime the lead was last updated.

+ */ + UserStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UserStage { + /** + *

The user account associated with this lead.

+ */ + _FinalStage user(@NotNull LeadUser user); + } + + public interface _FinalStage { + Lead build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The company member record if this lead has converted into a paying customer. Null if the lead has not converted.

+ */ + _FinalStage member(Optional member); + + _FinalStage member(LeadMember member); + + _FinalStage member(Nullable member); + + /** + *

Custom key-value pairs attached to this lead. Null if no metadata was provided.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The product the lead expressed interest in. Null if the lead is not associated with a specific product.

+ */ + _FinalStage product(Optional product); + + _FinalStage product(LeadProduct product); + + _FinalStage product(Nullable product); + + /** + *

The URL of the page that referred this lead to the company. Null if no referrer was captured.

+ */ + _FinalStage referrer(Optional referrer); + + _FinalStage referrer(String referrer); + + _FinalStage referrer(Nullable referrer); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, UpdatedAtStage, UserStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private OffsetDateTime updatedAt; + + private LeadUser user; + + private Optional referrer = Optional.empty(); + + private Optional product = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional member = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Lead other) { + createdAt(other.getCreatedAt()); + id(other.getId()); + member(other.getMember()); + metadata(other.getMetadata()); + product(other.getProduct()); + referrer(other.getReferrer()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + return this; + } + + /** + *

The datetime the lead was created.

+ *

The datetime the lead was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the lead.

+ *

The unique identifier for the lead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UpdatedAtStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The datetime the lead was last updated.

+ *

The datetime the lead was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UserStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user account associated with this lead.

+ *

The user account associated with this lead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull LeadUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

The URL of the page that referred this lead to the company. Null if no referrer was captured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referrer(Nullable referrer) { + if (referrer.isNull()) { + this.referrer = null; + } else if (referrer.isEmpty()) { + this.referrer = Optional.empty(); + } else { + this.referrer = Optional.of(referrer.get()); + } + return this; + } + + /** + *

The URL of the page that referred this lead to the company. Null if no referrer was captured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referrer(String referrer) { + this.referrer = Optional.ofNullable(referrer); + return this; + } + + /** + *

The URL of the page that referred this lead to the company. Null if no referrer was captured.

+ */ + @java.lang.Override + @JsonSetter(value = "referrer", nulls = Nulls.SKIP) + public _FinalStage referrer(Optional referrer) { + this.referrer = referrer; + return this; + } + + /** + *

The product the lead expressed interest in. Null if the lead is not associated with a specific product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

The product the lead expressed interest in. Null if the lead is not associated with a specific product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(LeadProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

The product the lead expressed interest in. Null if the lead is not associated with a specific product.

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

Custom key-value pairs attached to this lead. Null if no metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs attached to this lead. Null if no metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs attached to this lead. Null if no metadata was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The company member record if this lead has converted into a paying customer. Null if the lead has not converted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(Nullable member) { + if (member.isNull()) { + this.member = null; + } else if (member.isEmpty()) { + this.member = Optional.empty(); + } else { + this.member = Optional.of(member.get()); + } + return this; + } + + /** + *

The company member record if this lead has converted into a paying customer. Null if the lead has not converted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(LeadMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + /** + *

The company member record if this lead has converted into a paying customer. Null if the lead has not converted.

+ */ + @java.lang.Override + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public _FinalStage member(Optional member) { + this.member = member; + return this; + } + + @java.lang.Override + public Lead build() { + return new Lead(createdAt, id, member, metadata, product, referrer, updatedAt, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LeadListItem.java b/src/main/java/com/whop/api/types/LeadListItem.java new file mode 100644 index 00000000..4707e3ff --- /dev/null +++ b/src/main/java/com/whop/api/types/LeadListItem.java @@ -0,0 +1,531 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeadListItem.Builder.class) +public final class LeadListItem { + private final OffsetDateTime createdAt; + + private final String id; + + private final Optional member; + + private final Optional> metadata; + + private final Optional product; + + private final Optional referrer; + + private final OffsetDateTime updatedAt; + + private final LeadListItemUser user; + + private final Map additionalProperties; + + private LeadListItem( + OffsetDateTime createdAt, + String id, + Optional member, + Optional> metadata, + Optional product, + Optional referrer, + OffsetDateTime updatedAt, + LeadListItemUser user, + Map additionalProperties) { + this.createdAt = createdAt; + this.id = id; + this.member = member; + this.metadata = metadata; + this.product = product; + this.referrer = referrer; + this.updatedAt = updatedAt; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The datetime the lead was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the lead. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The company member record if this lead has converted into a paying customer. Null if the lead has not converted. + */ + @JsonIgnore + public Optional getMember() { + if (member == null) { + return Optional.empty(); + } + return member; + } + + /** + * @return Custom key-value pairs attached to this lead. Null if no metadata was provided. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The product the lead expressed interest in. Null if the lead is not associated with a specific product. + */ + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return The URL of the page that referred this lead to the company. Null if no referrer was captured. + */ + @JsonIgnore + public Optional getReferrer() { + if (referrer == null) { + return Optional.empty(); + } + return referrer; + } + + /** + * @return The datetime the lead was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user account associated with this lead. + */ + @JsonProperty("user") + public LeadListItemUser getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member") + private Optional _getMember() { + return member; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("referrer") + private Optional _getReferrer() { + return referrer; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeadListItem && equalTo((LeadListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeadListItem other) { + return createdAt.equals(other.createdAt) + && id.equals(other.id) + && member.equals(other.member) + && metadata.equals(other.metadata) + && product.equals(other.product) + && referrer.equals(other.referrer) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, + this.id, + this.member, + this.metadata, + this.product, + this.referrer, + this.updatedAt, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the lead was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(LeadListItem other); + } + + public interface IdStage { + /** + *

The unique identifier for the lead.

+ */ + UpdatedAtStage id(@NotNull String id); + } + + public interface UpdatedAtStage { + /** + *

The datetime the lead was last updated.

+ */ + UserStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UserStage { + /** + *

The user account associated with this lead.

+ */ + _FinalStage user(@NotNull LeadListItemUser user); + } + + public interface _FinalStage { + LeadListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The company member record if this lead has converted into a paying customer. Null if the lead has not converted.

+ */ + _FinalStage member(Optional member); + + _FinalStage member(LeadListItemMember member); + + _FinalStage member(Nullable member); + + /** + *

Custom key-value pairs attached to this lead. Null if no metadata was provided.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The product the lead expressed interest in. Null if the lead is not associated with a specific product.

+ */ + _FinalStage product(Optional product); + + _FinalStage product(LeadListItemProduct product); + + _FinalStage product(Nullable product); + + /** + *

The URL of the page that referred this lead to the company. Null if no referrer was captured.

+ */ + _FinalStage referrer(Optional referrer); + + _FinalStage referrer(String referrer); + + _FinalStage referrer(Nullable referrer); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, UpdatedAtStage, UserStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private OffsetDateTime updatedAt; + + private LeadListItemUser user; + + private Optional referrer = Optional.empty(); + + private Optional product = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional member = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LeadListItem other) { + createdAt(other.getCreatedAt()); + id(other.getId()); + member(other.getMember()); + metadata(other.getMetadata()); + product(other.getProduct()); + referrer(other.getReferrer()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + return this; + } + + /** + *

The datetime the lead was created.

+ *

The datetime the lead was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the lead.

+ *

The unique identifier for the lead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UpdatedAtStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The datetime the lead was last updated.

+ *

The datetime the lead was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UserStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user account associated with this lead.

+ *

The user account associated with this lead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull LeadListItemUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

The URL of the page that referred this lead to the company. Null if no referrer was captured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referrer(Nullable referrer) { + if (referrer.isNull()) { + this.referrer = null; + } else if (referrer.isEmpty()) { + this.referrer = Optional.empty(); + } else { + this.referrer = Optional.of(referrer.get()); + } + return this; + } + + /** + *

The URL of the page that referred this lead to the company. Null if no referrer was captured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referrer(String referrer) { + this.referrer = Optional.ofNullable(referrer); + return this; + } + + /** + *

The URL of the page that referred this lead to the company. Null if no referrer was captured.

+ */ + @java.lang.Override + @JsonSetter(value = "referrer", nulls = Nulls.SKIP) + public _FinalStage referrer(Optional referrer) { + this.referrer = referrer; + return this; + } + + /** + *

The product the lead expressed interest in. Null if the lead is not associated with a specific product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

The product the lead expressed interest in. Null if the lead is not associated with a specific product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(LeadListItemProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

The product the lead expressed interest in. Null if the lead is not associated with a specific product.

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

Custom key-value pairs attached to this lead. Null if no metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs attached to this lead. Null if no metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs attached to this lead. Null if no metadata was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The company member record if this lead has converted into a paying customer. Null if the lead has not converted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(Nullable member) { + if (member.isNull()) { + this.member = null; + } else if (member.isEmpty()) { + this.member = Optional.empty(); + } else { + this.member = Optional.of(member.get()); + } + return this; + } + + /** + *

The company member record if this lead has converted into a paying customer. Null if the lead has not converted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(LeadListItemMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + /** + *

The company member record if this lead has converted into a paying customer. Null if the lead has not converted.

+ */ + @java.lang.Override + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public _FinalStage member(Optional member) { + this.member = member; + return this; + } + + @java.lang.Override + public LeadListItem build() { + return new LeadListItem( + createdAt, id, member, metadata, product, referrer, updatedAt, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LeadListItemMember.java b/src/main/java/com/whop/api/types/LeadListItemMember.java new file mode 100644 index 00000000..7d58c0b2 --- /dev/null +++ b/src/main/java/com/whop/api/types/LeadListItemMember.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeadListItemMember.Builder.class) +public final class LeadListItemMember { + private final String id; + + private final Map additionalProperties; + + private LeadListItemMember(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company member. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeadListItemMember && equalTo((LeadListItemMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeadListItemMember other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company member.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(LeadListItemMember other); + } + + public interface _FinalStage { + LeadListItemMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LeadListItemMember other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the company member.

+ *

The unique identifier for the company member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public LeadListItemMember build() { + return new LeadListItemMember(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LeadListItemProduct.java b/src/main/java/com/whop/api/types/LeadListItemProduct.java new file mode 100644 index 00000000..d015e0e0 --- /dev/null +++ b/src/main/java/com/whop/api/types/LeadListItemProduct.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeadListItemProduct.Builder.class) +public final class LeadListItemProduct { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private LeadListItemProduct(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the product. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the product shown to customers on the product page and in search results. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeadListItemProduct && equalTo((LeadListItemProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeadListItemProduct other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the product.

+ */ + TitleStage id(@NotNull String id); + + Builder from(LeadListItemProduct other); + } + + public interface TitleStage { + /** + *

The display name of the product shown to customers on the product page and in search results.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + LeadListItemProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LeadListItemProduct other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the product.

+ *

The unique identifier for the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the product shown to customers on the product page and in search results.

+ *

The display name of the product shown to customers on the product page and in search results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public LeadListItemProduct build() { + return new LeadListItemProduct(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LeadListItemUser.java b/src/main/java/com/whop/api/types/LeadListItemUser.java new file mode 100644 index 00000000..6f628ce0 --- /dev/null +++ b/src/main/java/com/whop/api/types/LeadListItemUser.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeadListItemUser.Builder.class) +public final class LeadListItemUser { + private final Optional email; + + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private LeadListItemUser( + Optional email, + String id, + Optional name, + String username, + Map additionalProperties) { + this.email = email; + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's email address. Requires the member:email:read permission to access. Null if not authorized. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeadListItemUser && equalTo((LeadListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeadListItemUser other) { + return email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(LeadListItemUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + LeadListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LeadListItemUser other) { + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public LeadListItemUser build() { + return new LeadListItemUser(email, id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LeadMember.java b/src/main/java/com/whop/api/types/LeadMember.java new file mode 100644 index 00000000..6a1fe56e --- /dev/null +++ b/src/main/java/com/whop/api/types/LeadMember.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeadMember.Builder.class) +public final class LeadMember { + private final String id; + + private final Map additionalProperties; + + private LeadMember(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company member. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeadMember && equalTo((LeadMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeadMember other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company member.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(LeadMember other); + } + + public interface _FinalStage { + LeadMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LeadMember other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the company member.

+ *

The unique identifier for the company member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public LeadMember build() { + return new LeadMember(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LeadProduct.java b/src/main/java/com/whop/api/types/LeadProduct.java new file mode 100644 index 00000000..a9596d4d --- /dev/null +++ b/src/main/java/com/whop/api/types/LeadProduct.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeadProduct.Builder.class) +public final class LeadProduct { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private LeadProduct(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the product. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the product shown to customers on the product page and in search results. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeadProduct && equalTo((LeadProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeadProduct other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the product.

+ */ + TitleStage id(@NotNull String id); + + Builder from(LeadProduct other); + } + + public interface TitleStage { + /** + *

The display name of the product shown to customers on the product page and in search results.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + LeadProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LeadProduct other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the product.

+ *

The unique identifier for the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the product shown to customers on the product page and in search results.

+ *

The display name of the product shown to customers on the product page and in search results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public LeadProduct build() { + return new LeadProduct(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LeadUser.java b/src/main/java/com/whop/api/types/LeadUser.java new file mode 100644 index 00000000..3a0f175e --- /dev/null +++ b/src/main/java/com/whop/api/types/LeadUser.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeadUser.Builder.class) +public final class LeadUser { + private final Optional email; + + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private LeadUser( + Optional email, + String id, + Optional name, + String username, + Map additionalProperties) { + this.email = email; + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's email address. Requires the member:email:read permission to access. Null if not authorized. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeadUser && equalTo((LeadUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeadUser other) { + return email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(LeadUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + LeadUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LeadUser other) { + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public LeadUser build() { + return new LeadUser(email, id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerAccount.java b/src/main/java/com/whop/api/types/LedgerAccount.java new file mode 100644 index 00000000..10901be9 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerAccount.java @@ -0,0 +1,638 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerAccount.Builder.class) +public final class LedgerAccount { + private final List balances; + + private final String id; + + private final LedgerTypes ledgerType; + + private final LedgerAccountOwner owner; + + private final Optional paymentsApprovalStatus; + + private final Optional payoutAccountDetails; + + private final Optional settlementTimeAt; + + private final Optional transferFee; + + private final Optional treasuryBalance; + + private final Map additionalProperties; + + private LedgerAccount( + List balances, + String id, + LedgerTypes ledgerType, + LedgerAccountOwner owner, + Optional paymentsApprovalStatus, + Optional payoutAccountDetails, + Optional settlementTimeAt, + Optional transferFee, + Optional treasuryBalance, + Map additionalProperties) { + this.balances = balances; + this.id = id; + this.ledgerType = ledgerType; + this.owner = owner; + this.paymentsApprovalStatus = paymentsApprovalStatus; + this.payoutAccountDetails = payoutAccountDetails; + this.settlementTimeAt = settlementTimeAt; + this.transferFee = transferFee; + this.treasuryBalance = treasuryBalance; + this.additionalProperties = additionalProperties; + } + + /** + * @return The balances associated with the account. + */ + @JsonProperty("balances") + public List getBalances() { + return balances; + } + + /** + * @return The unique identifier for the ledger account. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of ledger account. + */ + @JsonProperty("ledger_type") + public LedgerTypes getLedgerType() { + return ledgerType; + } + + /** + * @return The owner of the ledger account. + */ + @JsonProperty("owner") + public LedgerAccountOwner getOwner() { + return owner; + } + + /** + * @return The status of payments approval for the ledger account. + */ + @JsonIgnore + public Optional getPaymentsApprovalStatus() { + if (paymentsApprovalStatus == null) { + return Optional.empty(); + } + return paymentsApprovalStatus; + } + + /** + * @return The payout account associated with the LedgerAccount, if any. + */ + @JsonIgnore + public Optional getPayoutAccountDetails() { + if (payoutAccountDetails == null) { + return Optional.empty(); + } + return payoutAccountDetails; + } + + /** + * @return The settlement batch most recently posted to this account's available balance, at midnight UTC. Every payment settling in that batch carries the same settlement_time_at. + */ + @JsonIgnore + public Optional getSettlementTimeAt() { + if (settlementTimeAt == null) { + return Optional.empty(); + } + return settlementTimeAt; + } + + /** + * @return The fee for transfers, if applicable. + */ + @JsonIgnore + public Optional getTransferFee() { + if (transferFee == null) { + return Optional.empty(); + } + return transferFee; + } + + /** + * @return The balance cache associated with the account by currency. + */ + @JsonIgnore + public Optional getTreasuryBalance() { + if (treasuryBalance == null) { + return Optional.empty(); + } + return treasuryBalance; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payments_approval_status") + private Optional _getPaymentsApprovalStatus() { + return paymentsApprovalStatus; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_account_details") + private Optional _getPayoutAccountDetails() { + return payoutAccountDetails; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("settlement_time_at") + private Optional _getSettlementTimeAt() { + return settlementTimeAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("transfer_fee") + private Optional _getTransferFee() { + return transferFee; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("treasury_balance") + private Optional _getTreasuryBalance() { + return treasuryBalance; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerAccount && equalTo((LedgerAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerAccount other) { + return balances.equals(other.balances) + && id.equals(other.id) + && ledgerType.equals(other.ledgerType) + && owner.equals(other.owner) + && paymentsApprovalStatus.equals(other.paymentsApprovalStatus) + && payoutAccountDetails.equals(other.payoutAccountDetails) + && settlementTimeAt.equals(other.settlementTimeAt) + && transferFee.equals(other.transferFee) + && treasuryBalance.equals(other.treasuryBalance); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.balances, + this.id, + this.ledgerType, + this.owner, + this.paymentsApprovalStatus, + this.payoutAccountDetails, + this.settlementTimeAt, + this.transferFee, + this.treasuryBalance); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the ledger account.

+ */ + LedgerTypeStage id(@NotNull String id); + + Builder from(LedgerAccount other); + } + + public interface LedgerTypeStage { + /** + *

The type of ledger account.

+ */ + OwnerStage ledgerType(@NotNull LedgerTypes ledgerType); + } + + public interface OwnerStage { + /** + *

The owner of the ledger account.

+ */ + _FinalStage owner(@NotNull LedgerAccountOwner owner); + } + + public interface _FinalStage { + LedgerAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The balances associated with the account.

+ */ + _FinalStage balances(List balances); + + _FinalStage addBalances(LedgerAccountBalancesItem balances); + + _FinalStage addAllBalances(List balances); + + /** + *

The status of payments approval for the ledger account.

+ */ + _FinalStage paymentsApprovalStatus(Optional paymentsApprovalStatus); + + _FinalStage paymentsApprovalStatus(PaymentsApprovalStatuses paymentsApprovalStatus); + + _FinalStage paymentsApprovalStatus(Nullable paymentsApprovalStatus); + + /** + *

The payout account associated with the LedgerAccount, if any.

+ */ + _FinalStage payoutAccountDetails(Optional payoutAccountDetails); + + _FinalStage payoutAccountDetails(LedgerAccountPayoutAccountDetails payoutAccountDetails); + + _FinalStage payoutAccountDetails(Nullable payoutAccountDetails); + + /** + *

The settlement batch most recently posted to this account's available balance, at midnight UTC. Every payment settling in that batch carries the same settlement_time_at.

+ */ + _FinalStage settlementTimeAt(Optional settlementTimeAt); + + _FinalStage settlementTimeAt(OffsetDateTime settlementTimeAt); + + _FinalStage settlementTimeAt(Nullable settlementTimeAt); + + /** + *

The fee for transfers, if applicable.

+ */ + _FinalStage transferFee(Optional transferFee); + + _FinalStage transferFee(Double transferFee); + + _FinalStage transferFee(Nullable transferFee); + + /** + *

The balance cache associated with the account by currency.

+ */ + _FinalStage treasuryBalance(Optional treasuryBalance); + + _FinalStage treasuryBalance(LedgerAccountTreasuryBalance treasuryBalance); + + _FinalStage treasuryBalance(Nullable treasuryBalance); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, LedgerTypeStage, OwnerStage, _FinalStage { + private String id; + + private LedgerTypes ledgerType; + + private LedgerAccountOwner owner; + + private Optional treasuryBalance = Optional.empty(); + + private Optional transferFee = Optional.empty(); + + private Optional settlementTimeAt = Optional.empty(); + + private Optional payoutAccountDetails = Optional.empty(); + + private Optional paymentsApprovalStatus = Optional.empty(); + + private List balances = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerAccount other) { + balances(other.getBalances()); + id(other.getId()); + ledgerType(other.getLedgerType()); + owner(other.getOwner()); + paymentsApprovalStatus(other.getPaymentsApprovalStatus()); + payoutAccountDetails(other.getPayoutAccountDetails()); + settlementTimeAt(other.getSettlementTimeAt()); + transferFee(other.getTransferFee()); + treasuryBalance(other.getTreasuryBalance()); + return this; + } + + /** + *

The unique identifier for the ledger account.

+ *

The unique identifier for the ledger account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LedgerTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of ledger account.

+ *

The type of ledger account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ledger_type") + public OwnerStage ledgerType(@NotNull LedgerTypes ledgerType) { + this.ledgerType = Objects.requireNonNull(ledgerType, "ledgerType must not be null"); + return this; + } + + /** + *

The owner of the ledger account.

+ *

The owner of the ledger account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("owner") + public _FinalStage owner(@NotNull LedgerAccountOwner owner) { + this.owner = Objects.requireNonNull(owner, "owner must not be null"); + return this; + } + + /** + *

The balance cache associated with the account by currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage treasuryBalance(Nullable treasuryBalance) { + if (treasuryBalance.isNull()) { + this.treasuryBalance = null; + } else if (treasuryBalance.isEmpty()) { + this.treasuryBalance = Optional.empty(); + } else { + this.treasuryBalance = Optional.of(treasuryBalance.get()); + } + return this; + } + + /** + *

The balance cache associated with the account by currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage treasuryBalance(LedgerAccountTreasuryBalance treasuryBalance) { + this.treasuryBalance = Optional.ofNullable(treasuryBalance); + return this; + } + + /** + *

The balance cache associated with the account by currency.

+ */ + @java.lang.Override + @JsonSetter(value = "treasury_balance", nulls = Nulls.SKIP) + public _FinalStage treasuryBalance(Optional treasuryBalance) { + this.treasuryBalance = treasuryBalance; + return this; + } + + /** + *

The fee for transfers, if applicable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage transferFee(Nullable transferFee) { + if (transferFee.isNull()) { + this.transferFee = null; + } else if (transferFee.isEmpty()) { + this.transferFee = Optional.empty(); + } else { + this.transferFee = Optional.of(transferFee.get()); + } + return this; + } + + /** + *

The fee for transfers, if applicable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage transferFee(Double transferFee) { + this.transferFee = Optional.ofNullable(transferFee); + return this; + } + + /** + *

The fee for transfers, if applicable.

+ */ + @java.lang.Override + @JsonSetter(value = "transfer_fee", nulls = Nulls.SKIP) + public _FinalStage transferFee(Optional transferFee) { + this.transferFee = transferFee; + return this; + } + + /** + *

The settlement batch most recently posted to this account's available balance, at midnight UTC. Every payment settling in that batch carries the same settlement_time_at.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage settlementTimeAt(Nullable settlementTimeAt) { + if (settlementTimeAt.isNull()) { + this.settlementTimeAt = null; + } else if (settlementTimeAt.isEmpty()) { + this.settlementTimeAt = Optional.empty(); + } else { + this.settlementTimeAt = Optional.of(settlementTimeAt.get()); + } + return this; + } + + /** + *

The settlement batch most recently posted to this account's available balance, at midnight UTC. Every payment settling in that batch carries the same settlement_time_at.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage settlementTimeAt(OffsetDateTime settlementTimeAt) { + this.settlementTimeAt = Optional.ofNullable(settlementTimeAt); + return this; + } + + /** + *

The settlement batch most recently posted to this account's available balance, at midnight UTC. Every payment settling in that batch carries the same settlement_time_at.

+ */ + @java.lang.Override + @JsonSetter(value = "settlement_time_at", nulls = Nulls.SKIP) + public _FinalStage settlementTimeAt(Optional settlementTimeAt) { + this.settlementTimeAt = settlementTimeAt; + return this; + } + + /** + *

The payout account associated with the LedgerAccount, if any.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutAccountDetails(Nullable payoutAccountDetails) { + if (payoutAccountDetails.isNull()) { + this.payoutAccountDetails = null; + } else if (payoutAccountDetails.isEmpty()) { + this.payoutAccountDetails = Optional.empty(); + } else { + this.payoutAccountDetails = Optional.of(payoutAccountDetails.get()); + } + return this; + } + + /** + *

The payout account associated with the LedgerAccount, if any.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutAccountDetails(LedgerAccountPayoutAccountDetails payoutAccountDetails) { + this.payoutAccountDetails = Optional.ofNullable(payoutAccountDetails); + return this; + } + + /** + *

The payout account associated with the LedgerAccount, if any.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_account_details", nulls = Nulls.SKIP) + public _FinalStage payoutAccountDetails(Optional payoutAccountDetails) { + this.payoutAccountDetails = payoutAccountDetails; + return this; + } + + /** + *

The status of payments approval for the ledger account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentsApprovalStatus(Nullable paymentsApprovalStatus) { + if (paymentsApprovalStatus.isNull()) { + this.paymentsApprovalStatus = null; + } else if (paymentsApprovalStatus.isEmpty()) { + this.paymentsApprovalStatus = Optional.empty(); + } else { + this.paymentsApprovalStatus = Optional.of(paymentsApprovalStatus.get()); + } + return this; + } + + /** + *

The status of payments approval for the ledger account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentsApprovalStatus(PaymentsApprovalStatuses paymentsApprovalStatus) { + this.paymentsApprovalStatus = Optional.ofNullable(paymentsApprovalStatus); + return this; + } + + /** + *

The status of payments approval for the ledger account.

+ */ + @java.lang.Override + @JsonSetter(value = "payments_approval_status", nulls = Nulls.SKIP) + public _FinalStage paymentsApprovalStatus(Optional paymentsApprovalStatus) { + this.paymentsApprovalStatus = paymentsApprovalStatus; + return this; + } + + /** + *

The balances associated with the account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllBalances(List balances) { + if (balances != null) { + this.balances.addAll(balances); + } + return this; + } + + /** + *

The balances associated with the account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addBalances(LedgerAccountBalancesItem balances) { + this.balances.add(balances); + return this; + } + + /** + *

The balances associated with the account.

+ */ + @java.lang.Override + @JsonSetter(value = "balances", nulls = Nulls.SKIP) + public _FinalStage balances(List balances) { + this.balances.clear(); + if (balances != null) { + this.balances.addAll(balances); + } + return this; + } + + @java.lang.Override + public LedgerAccount build() { + return new LedgerAccount( + balances, + id, + ledgerType, + owner, + paymentsApprovalStatus, + payoutAccountDetails, + settlementTimeAt, + transferFee, + treasuryBalance, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerAccountBalancesItem.java b/src/main/java/com/whop/api/types/LedgerAccountBalancesItem.java new file mode 100644 index 00000000..c7e79287 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerAccountBalancesItem.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerAccountBalancesItem.Builder.class) +public final class LedgerAccountBalancesItem { + private final double balance; + + private final Currencies currency; + + private final double pendingBalance; + + private final double reserveBalance; + + private final Map additionalProperties; + + private LedgerAccountBalancesItem( + double balance, + Currencies currency, + double pendingBalance, + double reserveBalance, + Map additionalProperties) { + this.balance = balance; + this.currency = currency; + this.pendingBalance = pendingBalance; + this.reserveBalance = reserveBalance; + this.additionalProperties = additionalProperties; + } + + /** + * @return The amount of the balance. + */ + @JsonProperty("balance") + public double getBalance() { + return balance; + } + + /** + * @return The currency of the balance. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The amount of the balance that is pending. + */ + @JsonProperty("pending_balance") + public double getPendingBalance() { + return pendingBalance; + } + + /** + * @return The amount of the balance that is reserved. + */ + @JsonProperty("reserve_balance") + public double getReserveBalance() { + return reserveBalance; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerAccountBalancesItem && equalTo((LedgerAccountBalancesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerAccountBalancesItem other) { + return balance == other.balance + && currency.equals(other.currency) + && pendingBalance == other.pendingBalance + && reserveBalance == other.reserveBalance; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.balance, this.currency, this.pendingBalance, this.reserveBalance); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BalanceStage builder() { + return new Builder(); + } + + public interface BalanceStage { + /** + *

The amount of the balance.

+ */ + CurrencyStage balance(double balance); + + Builder from(LedgerAccountBalancesItem other); + } + + public interface CurrencyStage { + /** + *

The currency of the balance.

+ */ + PendingBalanceStage currency(@NotNull Currencies currency); + } + + public interface PendingBalanceStage { + /** + *

The amount of the balance that is pending.

+ */ + ReserveBalanceStage pendingBalance(double pendingBalance); + } + + public interface ReserveBalanceStage { + /** + *

The amount of the balance that is reserved.

+ */ + _FinalStage reserveBalance(double reserveBalance); + } + + public interface _FinalStage { + LedgerAccountBalancesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BalanceStage, CurrencyStage, PendingBalanceStage, ReserveBalanceStage, _FinalStage { + private double balance; + + private Currencies currency; + + private double pendingBalance; + + private double reserveBalance; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerAccountBalancesItem other) { + balance(other.getBalance()); + currency(other.getCurrency()); + pendingBalance(other.getPendingBalance()); + reserveBalance(other.getReserveBalance()); + return this; + } + + /** + *

The amount of the balance.

+ *

The amount of the balance.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("balance") + public CurrencyStage balance(double balance) { + this.balance = balance; + return this; + } + + /** + *

The currency of the balance.

+ *

The currency of the balance.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public PendingBalanceStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The amount of the balance that is pending.

+ *

The amount of the balance that is pending.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("pending_balance") + public ReserveBalanceStage pendingBalance(double pendingBalance) { + this.pendingBalance = pendingBalance; + return this; + } + + /** + *

The amount of the balance that is reserved.

+ *

The amount of the balance that is reserved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reserve_balance") + public _FinalStage reserveBalance(double reserveBalance) { + this.reserveBalance = reserveBalance; + return this; + } + + @java.lang.Override + public LedgerAccountBalancesItem build() { + return new LedgerAccountBalancesItem( + balance, currency, pendingBalance, reserveBalance, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerAccountOwner.java b/src/main/java/com/whop/api/types/LedgerAccountOwner.java new file mode 100644 index 00000000..9877fb73 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerAccountOwner.java @@ -0,0 +1,221 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class LedgerAccountOwner { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private LedgerAccountOwner(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static LedgerAccountOwner user(LedgerAccountOwnerUser value) { + return new LedgerAccountOwner(new UserValue(value)); + } + + public static LedgerAccountOwner company(LedgerAccountOwnerCompany value) { + return new LedgerAccountOwner(new CompanyValue(value)); + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean isCompany() { + return value instanceof CompanyValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional getCompany() { + if (isCompany()) { + return Optional.of(((CompanyValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerAccountOwner && value.equals(((LedgerAccountOwner) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitUser(LedgerAccountOwnerUser user); + + T visitCompany(LedgerAccountOwnerCompany company); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(UserValue.class), @JsonSubTypes.Type(CompanyValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("User") + @JsonIgnoreProperties("typename") + private static final class UserValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private LedgerAccountOwnerUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(LedgerAccountOwnerUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "LedgerAccountOwner{" + "value: " + value + "}"; + } + } + + @JsonTypeName("Company") + @JsonIgnoreProperties("typename") + private static final class CompanyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private LedgerAccountOwnerCompany value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CompanyValue() {} + + private CompanyValue(LedgerAccountOwnerCompany value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCompany(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyValue && equalTo((CompanyValue) other); + } + + private boolean equalTo(CompanyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "LedgerAccountOwner{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "LedgerAccountOwner{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerAccountOwnerCompany.java b/src/main/java/com/whop/api/types/LedgerAccountOwnerCompany.java new file mode 100644 index 00000000..6c79b3ac --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerAccountOwnerCompany.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerAccountOwnerCompany.Builder.class) +public final class LedgerAccountOwnerCompany { + private final String id; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private LedgerAccountOwnerCompany(String id, String route, String title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The URL slug for the company's store page. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerAccountOwnerCompany && equalTo((LedgerAccountOwnerCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerAccountOwnerCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + RouteStage id(@NotNull String id); + + Builder from(LedgerAccountOwnerCompany other); + } + + public interface RouteStage { + /** + *

The URL slug for the company's store page.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + LedgerAccountOwnerCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerAccountOwnerCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The URL slug for the company's store page.

+ *

The URL slug for the company's store page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public LedgerAccountOwnerCompany build() { + return new LedgerAccountOwnerCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerAccountOwnerUser.java b/src/main/java/com/whop/api/types/LedgerAccountOwnerUser.java new file mode 100644 index 00000000..52e0f4dc --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerAccountOwnerUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerAccountOwnerUser.Builder.class) +public final class LedgerAccountOwnerUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private LedgerAccountOwnerUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerAccountOwnerUser && equalTo((LedgerAccountOwnerUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerAccountOwnerUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(LedgerAccountOwnerUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + LedgerAccountOwnerUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerAccountOwnerUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public LedgerAccountOwnerUser build() { + return new LedgerAccountOwnerUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerAccountPayoutAccountDetails.java b/src/main/java/com/whop/api/types/LedgerAccountPayoutAccountDetails.java new file mode 100644 index 00000000..9337963f --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerAccountPayoutAccountDetails.java @@ -0,0 +1,654 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerAccountPayoutAccountDetails.Builder.class) +public final class LedgerAccountPayoutAccountDetails { + private final Optional address; + + private final Optional businessName; + + private final Optional businessRepresentative; + + private final Optional email; + + private final String id; + + private final Optional latestVerification; + + private final Optional phone; + + private final Optional status; + + private final Map additionalProperties; + + private LedgerAccountPayoutAccountDetails( + Optional address, + Optional businessName, + Optional businessRepresentative, + Optional email, + String id, + Optional latestVerification, + Optional phone, + Optional status, + Map additionalProperties) { + this.address = address; + this.businessName = businessName; + this.businessRepresentative = businessRepresentative; + this.email = email; + this.id = id; + this.latestVerification = latestVerification; + this.phone = phone; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The physical address associated with this payout account + */ + @JsonIgnore + public Optional getAddress() { + if (address == null) { + return Optional.empty(); + } + return address; + } + + /** + * @return The company's legal name + */ + @JsonIgnore + public Optional getBusinessName() { + if (businessName == null) { + return Optional.empty(); + } + return businessName; + } + + /** + * @return The business representative for this payout account + */ + @JsonIgnore + public Optional getBusinessRepresentative() { + if (businessRepresentative == null) { + return Optional.empty(); + } + return businessRepresentative; + } + + /** + * @return The email address of the representative + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the payout account. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The latest verification for the connected account. + */ + @JsonIgnore + public Optional getLatestVerification() { + if (latestVerification == null) { + return Optional.empty(); + } + return latestVerification; + } + + /** + * @return The business representative's phone + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + /** + * @return The granular calculated status of the payout account reflecting its current KYC and withdrawal readiness state. + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("address") + private Optional _getAddress() { + return address; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_name") + private Optional _getBusinessName() { + return businessName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_representative") + private Optional _getBusinessRepresentative() { + return businessRepresentative; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("latest_verification") + private Optional _getLatestVerification() { + return latestVerification; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerAccountPayoutAccountDetails && equalTo((LedgerAccountPayoutAccountDetails) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerAccountPayoutAccountDetails other) { + return address.equals(other.address) + && businessName.equals(other.businessName) + && businessRepresentative.equals(other.businessRepresentative) + && email.equals(other.email) + && id.equals(other.id) + && latestVerification.equals(other.latestVerification) + && phone.equals(other.phone) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.address, + this.businessName, + this.businessRepresentative, + this.email, + this.id, + this.latestVerification, + this.phone, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the payout account.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(LedgerAccountPayoutAccountDetails other); + } + + public interface _FinalStage { + LedgerAccountPayoutAccountDetails build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The physical address associated with this payout account

+ */ + _FinalStage address(Optional address); + + _FinalStage address(LedgerAccountPayoutAccountDetailsAddress address); + + _FinalStage address(Nullable address); + + /** + *

The company's legal name

+ */ + _FinalStage businessName(Optional businessName); + + _FinalStage businessName(String businessName); + + _FinalStage businessName(Nullable businessName); + + /** + *

The business representative for this payout account

+ */ + _FinalStage businessRepresentative( + Optional businessRepresentative); + + _FinalStage businessRepresentative( + LedgerAccountPayoutAccountDetailsBusinessRepresentative businessRepresentative); + + _FinalStage businessRepresentative( + Nullable businessRepresentative); + + /** + *

The email address of the representative

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The latest verification for the connected account.

+ */ + _FinalStage latestVerification( + Optional latestVerification); + + _FinalStage latestVerification(LedgerAccountPayoutAccountDetailsLatestVerification latestVerification); + + _FinalStage latestVerification( + Nullable latestVerification); + + /** + *

The business representative's phone

+ */ + _FinalStage phone(Optional phone); + + _FinalStage phone(String phone); + + _FinalStage phone(Nullable phone); + + /** + *

The granular calculated status of the payout account reflecting its current KYC and withdrawal readiness state.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(PayoutAccountCalculatedStatuses status); + + _FinalStage status(Nullable status); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional status = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional latestVerification = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional businessRepresentative = + Optional.empty(); + + private Optional businessName = Optional.empty(); + + private Optional address = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerAccountPayoutAccountDetails other) { + address(other.getAddress()); + businessName(other.getBusinessName()); + businessRepresentative(other.getBusinessRepresentative()); + email(other.getEmail()); + id(other.getId()); + latestVerification(other.getLatestVerification()); + phone(other.getPhone()); + status(other.getStatus()); + return this; + } + + /** + *

The unique identifier for the payout account.

+ *

The unique identifier for the payout account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The granular calculated status of the payout account reflecting its current KYC and withdrawal readiness state.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The granular calculated status of the payout account reflecting its current KYC and withdrawal readiness state.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(PayoutAccountCalculatedStatuses status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The granular calculated status of the payout account reflecting its current KYC and withdrawal readiness state.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

The business representative's phone

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

The business representative's phone

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + /** + *

The business representative's phone

+ */ + @java.lang.Override + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public _FinalStage phone(Optional phone) { + this.phone = phone; + return this; + } + + /** + *

The latest verification for the connected account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage latestVerification( + Nullable latestVerification) { + if (latestVerification.isNull()) { + this.latestVerification = null; + } else if (latestVerification.isEmpty()) { + this.latestVerification = Optional.empty(); + } else { + this.latestVerification = Optional.of(latestVerification.get()); + } + return this; + } + + /** + *

The latest verification for the connected account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage latestVerification(LedgerAccountPayoutAccountDetailsLatestVerification latestVerification) { + this.latestVerification = Optional.ofNullable(latestVerification); + return this; + } + + /** + *

The latest verification for the connected account.

+ */ + @java.lang.Override + @JsonSetter(value = "latest_verification", nulls = Nulls.SKIP) + public _FinalStage latestVerification( + Optional latestVerification) { + this.latestVerification = latestVerification; + return this; + } + + /** + *

The email address of the representative

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The email address of the representative

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The email address of the representative

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + /** + *

The business representative for this payout account

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessRepresentative( + Nullable businessRepresentative) { + if (businessRepresentative.isNull()) { + this.businessRepresentative = null; + } else if (businessRepresentative.isEmpty()) { + this.businessRepresentative = Optional.empty(); + } else { + this.businessRepresentative = Optional.of(businessRepresentative.get()); + } + return this; + } + + /** + *

The business representative for this payout account

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessRepresentative( + LedgerAccountPayoutAccountDetailsBusinessRepresentative businessRepresentative) { + this.businessRepresentative = Optional.ofNullable(businessRepresentative); + return this; + } + + /** + *

The business representative for this payout account

+ */ + @java.lang.Override + @JsonSetter(value = "business_representative", nulls = Nulls.SKIP) + public _FinalStage businessRepresentative( + Optional businessRepresentative) { + this.businessRepresentative = businessRepresentative; + return this; + } + + /** + *

The company's legal name

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessName(Nullable businessName) { + if (businessName.isNull()) { + this.businessName = null; + } else if (businessName.isEmpty()) { + this.businessName = Optional.empty(); + } else { + this.businessName = Optional.of(businessName.get()); + } + return this; + } + + /** + *

The company's legal name

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessName(String businessName) { + this.businessName = Optional.ofNullable(businessName); + return this; + } + + /** + *

The company's legal name

+ */ + @java.lang.Override + @JsonSetter(value = "business_name", nulls = Nulls.SKIP) + public _FinalStage businessName(Optional businessName) { + this.businessName = businessName; + return this; + } + + /** + *

The physical address associated with this payout account

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage address(Nullable address) { + if (address.isNull()) { + this.address = null; + } else if (address.isEmpty()) { + this.address = Optional.empty(); + } else { + this.address = Optional.of(address.get()); + } + return this; + } + + /** + *

The physical address associated with this payout account

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage address(LedgerAccountPayoutAccountDetailsAddress address) { + this.address = Optional.ofNullable(address); + return this; + } + + /** + *

The physical address associated with this payout account

+ */ + @java.lang.Override + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public _FinalStage address(Optional address) { + this.address = address; + return this; + } + + @java.lang.Override + public LedgerAccountPayoutAccountDetails build() { + return new LedgerAccountPayoutAccountDetails( + address, + businessName, + businessRepresentative, + email, + id, + latestVerification, + phone, + status, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerAccountPayoutAccountDetailsAddress.java b/src/main/java/com/whop/api/types/LedgerAccountPayoutAccountDetailsAddress.java new file mode 100644 index 00000000..362f8590 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerAccountPayoutAccountDetailsAddress.java @@ -0,0 +1,388 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerAccountPayoutAccountDetailsAddress.Builder.class) +public final class LedgerAccountPayoutAccountDetailsAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private LedgerAccountPayoutAccountDetailsAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerAccountPayoutAccountDetailsAddress + && equalTo((LedgerAccountPayoutAccountDetailsAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerAccountPayoutAccountDetailsAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(LedgerAccountPayoutAccountDetailsAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public LedgerAccountPayoutAccountDetailsAddress build() { + return new LedgerAccountPayoutAccountDetailsAddress( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerAccountPayoutAccountDetailsBusinessRepresentative.java b/src/main/java/com/whop/api/types/LedgerAccountPayoutAccountDetailsBusinessRepresentative.java new file mode 100644 index 00000000..6101130e --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerAccountPayoutAccountDetailsBusinessRepresentative.java @@ -0,0 +1,288 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerAccountPayoutAccountDetailsBusinessRepresentative.Builder.class) +public final class LedgerAccountPayoutAccountDetailsBusinessRepresentative { + private final Optional dateOfBirth; + + private final Optional firstName; + + private final Optional lastName; + + private final Optional middleName; + + private final Map additionalProperties; + + private LedgerAccountPayoutAccountDetailsBusinessRepresentative( + Optional dateOfBirth, + Optional firstName, + Optional lastName, + Optional middleName, + Map additionalProperties) { + this.dateOfBirth = dateOfBirth; + this.firstName = firstName; + this.lastName = lastName; + this.middleName = middleName; + this.additionalProperties = additionalProperties; + } + + /** + * @return The date of birth of the business representative in ISO 8601 format (YYYY-MM-DD). + */ + @JsonIgnore + public Optional getDateOfBirth() { + if (dateOfBirth == null) { + return Optional.empty(); + } + return dateOfBirth; + } + + /** + * @return The first name of the business representative. + */ + @JsonIgnore + public Optional getFirstName() { + if (firstName == null) { + return Optional.empty(); + } + return firstName; + } + + /** + * @return The last name of the business representative. + */ + @JsonIgnore + public Optional getLastName() { + if (lastName == null) { + return Optional.empty(); + } + return lastName; + } + + /** + * @return The middle name of the business representative. + */ + @JsonIgnore + public Optional getMiddleName() { + if (middleName == null) { + return Optional.empty(); + } + return middleName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("date_of_birth") + private Optional _getDateOfBirth() { + return dateOfBirth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_name") + private Optional _getFirstName() { + return firstName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_name") + private Optional _getLastName() { + return lastName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("middle_name") + private Optional _getMiddleName() { + return middleName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerAccountPayoutAccountDetailsBusinessRepresentative + && equalTo((LedgerAccountPayoutAccountDetailsBusinessRepresentative) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerAccountPayoutAccountDetailsBusinessRepresentative other) { + return dateOfBirth.equals(other.dateOfBirth) + && firstName.equals(other.firstName) + && lastName.equals(other.lastName) + && middleName.equals(other.middleName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dateOfBirth, this.firstName, this.lastName, this.middleName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional dateOfBirth = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional lastName = Optional.empty(); + + private Optional middleName = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(LedgerAccountPayoutAccountDetailsBusinessRepresentative other) { + dateOfBirth(other.getDateOfBirth()); + firstName(other.getFirstName()); + lastName(other.getLastName()); + middleName(other.getMiddleName()); + return this; + } + + /** + *

The date of birth of the business representative in ISO 8601 format (YYYY-MM-DD).

+ */ + @JsonSetter(value = "date_of_birth", nulls = Nulls.SKIP) + public Builder dateOfBirth(Optional dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + public Builder dateOfBirth(String dateOfBirth) { + this.dateOfBirth = Optional.ofNullable(dateOfBirth); + return this; + } + + public Builder dateOfBirth(Nullable dateOfBirth) { + if (dateOfBirth.isNull()) { + this.dateOfBirth = null; + } else if (dateOfBirth.isEmpty()) { + this.dateOfBirth = Optional.empty(); + } else { + this.dateOfBirth = Optional.of(dateOfBirth.get()); + } + return this; + } + + /** + *

The first name of the business representative.

+ */ + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public Builder firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + public Builder firstName(Nullable firstName) { + if (firstName.isNull()) { + this.firstName = null; + } else if (firstName.isEmpty()) { + this.firstName = Optional.empty(); + } else { + this.firstName = Optional.of(firstName.get()); + } + return this; + } + + /** + *

The last name of the business representative.

+ */ + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public Builder lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + public Builder lastName(Nullable lastName) { + if (lastName.isNull()) { + this.lastName = null; + } else if (lastName.isEmpty()) { + this.lastName = Optional.empty(); + } else { + this.lastName = Optional.of(lastName.get()); + } + return this; + } + + /** + *

The middle name of the business representative.

+ */ + @JsonSetter(value = "middle_name", nulls = Nulls.SKIP) + public Builder middleName(Optional middleName) { + this.middleName = middleName; + return this; + } + + public Builder middleName(String middleName) { + this.middleName = Optional.ofNullable(middleName); + return this; + } + + public Builder middleName(Nullable middleName) { + if (middleName.isNull()) { + this.middleName = null; + } else if (middleName.isEmpty()) { + this.middleName = Optional.empty(); + } else { + this.middleName = Optional.of(middleName.get()); + } + return this; + } + + public LedgerAccountPayoutAccountDetailsBusinessRepresentative build() { + return new LedgerAccountPayoutAccountDetailsBusinessRepresentative( + dateOfBirth, firstName, lastName, middleName, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerAccountPayoutAccountDetailsLatestVerification.java b/src/main/java/com/whop/api/types/LedgerAccountPayoutAccountDetailsLatestVerification.java new file mode 100644 index 00000000..bc2d0e7f --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerAccountPayoutAccountDetailsLatestVerification.java @@ -0,0 +1,313 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerAccountPayoutAccountDetailsLatestVerification.Builder.class) +public final class LedgerAccountPayoutAccountDetailsLatestVerification { + private final String id; + + private final Optional lastErrorCode; + + private final Optional lastErrorReason; + + private final VerificationStatuses status; + + private final Map additionalProperties; + + private LedgerAccountPayoutAccountDetailsLatestVerification( + String id, + Optional lastErrorCode, + Optional lastErrorReason, + VerificationStatuses status, + Map additionalProperties) { + this.id = id; + this.lastErrorCode = lastErrorCode; + this.lastErrorReason = lastErrorReason; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The numeric id of the verification record. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The most recent error code returned during verification. Null if no error has occurred. + */ + @JsonIgnore + public Optional getLastErrorCode() { + if (lastErrorCode == null) { + return Optional.empty(); + } + return lastErrorCode; + } + + /** + * @return A human-readable explanation of the most recent verification error. Null if no error has occurred. + */ + @JsonIgnore + public Optional getLastErrorReason() { + if (lastErrorReason == null) { + return Optional.empty(); + } + return lastErrorReason; + } + + /** + * @return The current status of this verification session. + */ + @JsonProperty("status") + public VerificationStatuses getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_error_code") + private Optional _getLastErrorCode() { + return lastErrorCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_error_reason") + private Optional _getLastErrorReason() { + return lastErrorReason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerAccountPayoutAccountDetailsLatestVerification + && equalTo((LedgerAccountPayoutAccountDetailsLatestVerification) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerAccountPayoutAccountDetailsLatestVerification other) { + return id.equals(other.id) + && lastErrorCode.equals(other.lastErrorCode) + && lastErrorReason.equals(other.lastErrorReason) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.lastErrorCode, this.lastErrorReason, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The numeric id of the verification record.

+ */ + StatusStage id(@NotNull String id); + + Builder from(LedgerAccountPayoutAccountDetailsLatestVerification other); + } + + public interface StatusStage { + /** + *

The current status of this verification session.

+ */ + _FinalStage status(@NotNull VerificationStatuses status); + } + + public interface _FinalStage { + LedgerAccountPayoutAccountDetailsLatestVerification build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ */ + _FinalStage lastErrorCode(Optional lastErrorCode); + + _FinalStage lastErrorCode(VerificationErrorCodes lastErrorCode); + + _FinalStage lastErrorCode(Nullable lastErrorCode); + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ */ + _FinalStage lastErrorReason(Optional lastErrorReason); + + _FinalStage lastErrorReason(String lastErrorReason); + + _FinalStage lastErrorReason(Nullable lastErrorReason); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, StatusStage, _FinalStage { + private String id; + + private VerificationStatuses status; + + private Optional lastErrorReason = Optional.empty(); + + private Optional lastErrorCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerAccountPayoutAccountDetailsLatestVerification other) { + id(other.getId()); + lastErrorCode(other.getLastErrorCode()); + lastErrorReason(other.getLastErrorReason()); + status(other.getStatus()); + return this; + } + + /** + *

The numeric id of the verification record.

+ *

The numeric id of the verification record.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current status of this verification session.

+ *

The current status of this verification session.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull VerificationStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorReason(Nullable lastErrorReason) { + if (lastErrorReason.isNull()) { + this.lastErrorReason = null; + } else if (lastErrorReason.isEmpty()) { + this.lastErrorReason = Optional.empty(); + } else { + this.lastErrorReason = Optional.of(lastErrorReason.get()); + } + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorReason(String lastErrorReason) { + this.lastErrorReason = Optional.ofNullable(lastErrorReason); + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "last_error_reason", nulls = Nulls.SKIP) + public _FinalStage lastErrorReason(Optional lastErrorReason) { + this.lastErrorReason = lastErrorReason; + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorCode(Nullable lastErrorCode) { + if (lastErrorCode.isNull()) { + this.lastErrorCode = null; + } else if (lastErrorCode.isEmpty()) { + this.lastErrorCode = Optional.empty(); + } else { + this.lastErrorCode = Optional.of(lastErrorCode.get()); + } + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorCode(VerificationErrorCodes lastErrorCode) { + this.lastErrorCode = Optional.ofNullable(lastErrorCode); + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "last_error_code", nulls = Nulls.SKIP) + public _FinalStage lastErrorCode(Optional lastErrorCode) { + this.lastErrorCode = lastErrorCode; + return this; + } + + @java.lang.Override + public LedgerAccountPayoutAccountDetailsLatestVerification build() { + return new LedgerAccountPayoutAccountDetailsLatestVerification( + id, lastErrorCode, lastErrorReason, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerAccountTreasuryBalance.java b/src/main/java/com/whop/api/types/LedgerAccountTreasuryBalance.java new file mode 100644 index 00000000..b0796003 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerAccountTreasuryBalance.java @@ -0,0 +1,326 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerAccountTreasuryBalance.Builder.class) +public final class LedgerAccountTreasuryBalance { + private final double balance; + + private final double balanceUsd; + + private final Currencies currency; + + private final double pendingBalance; + + private final double reserveBalance; + + private final double totalWithdrawableBalance; + + private final Map additionalProperties; + + private LedgerAccountTreasuryBalance( + double balance, + double balanceUsd, + Currencies currency, + double pendingBalance, + double reserveBalance, + double totalWithdrawableBalance, + Map additionalProperties) { + this.balance = balance; + this.balanceUsd = balanceUsd; + this.currency = currency; + this.pendingBalance = pendingBalance; + this.reserveBalance = reserveBalance; + this.totalWithdrawableBalance = totalWithdrawableBalance; + this.additionalProperties = additionalProperties; + } + + /** + * @return The amount of the balance. + */ + @JsonProperty("balance") + public double getBalance() { + return balance; + } + + /** + * @return The balance converted to USD. + */ + @JsonProperty("balance_usd") + public double getBalanceUsd() { + return balanceUsd; + } + + /** + * @return The currency of the balance. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The amount of the balance that is pending. + */ + @JsonProperty("pending_balance") + public double getPendingBalance() { + return pendingBalance; + } + + /** + * @return The amount of the balance that is reserved. + */ + @JsonProperty("reserve_balance") + public double getReserveBalance() { + return reserveBalance; + } + + /** + * @return The amount of the balance that is withdrawable. + */ + @JsonProperty("total_withdrawable_balance") + public double getTotalWithdrawableBalance() { + return totalWithdrawableBalance; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerAccountTreasuryBalance && equalTo((LedgerAccountTreasuryBalance) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerAccountTreasuryBalance other) { + return balance == other.balance + && balanceUsd == other.balanceUsd + && currency.equals(other.currency) + && pendingBalance == other.pendingBalance + && reserveBalance == other.reserveBalance + && totalWithdrawableBalance == other.totalWithdrawableBalance; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.balance, + this.balanceUsd, + this.currency, + this.pendingBalance, + this.reserveBalance, + this.totalWithdrawableBalance); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BalanceStage builder() { + return new Builder(); + } + + public interface BalanceStage { + /** + *

The amount of the balance.

+ */ + BalanceUsdStage balance(double balance); + + Builder from(LedgerAccountTreasuryBalance other); + } + + public interface BalanceUsdStage { + /** + *

The balance converted to USD.

+ */ + CurrencyStage balanceUsd(double balanceUsd); + } + + public interface CurrencyStage { + /** + *

The currency of the balance.

+ */ + PendingBalanceStage currency(@NotNull Currencies currency); + } + + public interface PendingBalanceStage { + /** + *

The amount of the balance that is pending.

+ */ + ReserveBalanceStage pendingBalance(double pendingBalance); + } + + public interface ReserveBalanceStage { + /** + *

The amount of the balance that is reserved.

+ */ + TotalWithdrawableBalanceStage reserveBalance(double reserveBalance); + } + + public interface TotalWithdrawableBalanceStage { + /** + *

The amount of the balance that is withdrawable.

+ */ + _FinalStage totalWithdrawableBalance(double totalWithdrawableBalance); + } + + public interface _FinalStage { + LedgerAccountTreasuryBalance build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BalanceStage, + BalanceUsdStage, + CurrencyStage, + PendingBalanceStage, + ReserveBalanceStage, + TotalWithdrawableBalanceStage, + _FinalStage { + private double balance; + + private double balanceUsd; + + private Currencies currency; + + private double pendingBalance; + + private double reserveBalance; + + private double totalWithdrawableBalance; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerAccountTreasuryBalance other) { + balance(other.getBalance()); + balanceUsd(other.getBalanceUsd()); + currency(other.getCurrency()); + pendingBalance(other.getPendingBalance()); + reserveBalance(other.getReserveBalance()); + totalWithdrawableBalance(other.getTotalWithdrawableBalance()); + return this; + } + + /** + *

The amount of the balance.

+ *

The amount of the balance.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("balance") + public BalanceUsdStage balance(double balance) { + this.balance = balance; + return this; + } + + /** + *

The balance converted to USD.

+ *

The balance converted to USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("balance_usd") + public CurrencyStage balanceUsd(double balanceUsd) { + this.balanceUsd = balanceUsd; + return this; + } + + /** + *

The currency of the balance.

+ *

The currency of the balance.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public PendingBalanceStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The amount of the balance that is pending.

+ *

The amount of the balance that is pending.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("pending_balance") + public ReserveBalanceStage pendingBalance(double pendingBalance) { + this.pendingBalance = pendingBalance; + return this; + } + + /** + *

The amount of the balance that is reserved.

+ *

The amount of the balance that is reserved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reserve_balance") + public TotalWithdrawableBalanceStage reserveBalance(double reserveBalance) { + this.reserveBalance = reserveBalance; + return this; + } + + /** + *

The amount of the balance that is withdrawable.

+ *

The amount of the balance that is withdrawable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_withdrawable_balance") + public _FinalStage totalWithdrawableBalance(double totalWithdrawableBalance) { + this.totalWithdrawableBalance = totalWithdrawableBalance; + return this; + } + + @java.lang.Override + public LedgerAccountTreasuryBalance build() { + return new LedgerAccountTreasuryBalance( + balance, + balanceUsd, + currency, + pendingBalance, + reserveBalance, + totalWithdrawableBalance, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivity.java b/src/main/java/com/whop/api/types/LedgerActivity.java new file mode 100644 index 00000000..19b0c916 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivity.java @@ -0,0 +1,720 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivity.Builder.class) +public final class LedgerActivity { + private final Optional account; + + private final String amount; + + private final Optional availableAt; + + private final Optional createdAt; + + private final LedgerActivityCurrency currency; + + private final String id; + + private final Optional ledgerAccountId; + + private final LedgerActivityLineType lineType; + + private final LedgerActivityObject object; + + private final OffsetDateTime postedAt; + + private final Optional resource; + + private final Optional source; + + private final Map additionalProperties; + + private LedgerActivity( + Optional account, + String amount, + Optional availableAt, + Optional createdAt, + LedgerActivityCurrency currency, + String id, + Optional ledgerAccountId, + LedgerActivityLineType lineType, + LedgerActivityObject object, + OffsetDateTime postedAt, + Optional resource, + Optional source, + Map additionalProperties) { + this.account = account; + this.amount = amount; + this.availableAt = availableAt; + this.createdAt = createdAt; + this.currency = currency; + this.id = id; + this.ledgerAccountId = ledgerAccountId; + this.lineType = lineType; + this.object = object; + this.postedAt = postedAt; + this.resource = resource; + this.source = source; + this.additionalProperties = additionalProperties; + } + + /** + * @return The viewer account that owns this row's ledger. Present only when the response aggregates owned accounts (include_owned_accounts=true); omitted otherwise. + */ + @JsonProperty("account") + public Optional getAccount() { + return account; + } + + /** + * @return Signed amount in the currency's smallest precision units. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + /** + * @return ISO 8601 timestamp these funds became (or are scheduled to become) withdrawable: the posted time for already-settled funds, or 00:00:00 UTC on the scheduled release date for pending funds. Present only on inflows entering the balance (payments, top-ups, incoming transfers/affiliate); null on withdrawals, refunds, disputes and on-chain rows. The available_after/before filters window on its UTC settlement date. + */ + @JsonIgnore + public Optional getAvailableAt() { + if (availableAt == null) { + return Optional.empty(); + } + return availableAt; + } + + /** + * @return When the activity record was created. + */ + @JsonIgnore + public Optional getCreatedAt() { + if (createdAt == null) { + return Optional.empty(); + } + return createdAt; + } + + /** + * @return Currency for this ledger activity. + */ + @JsonProperty("currency") + public LedgerActivityCurrency getCurrency() { + return currency; + } + + /** + * @return Ledger activity ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The ledger account (a ldgr_ identifier) this row belongs to. Present only when the response aggregates owned accounts (include_owned_accounts=true); omitted otherwise. Pair it with account to scope drawers and dashboard links to the owning business. + */ + @JsonIgnore + public Optional getLedgerAccountId() { + if (ledgerAccountId == null) { + return Optional.empty(); + } + return ledgerAccountId; + } + + /** + * @return The ledger line category this activity was posted under. + */ + @JsonProperty("line_type") + public LedgerActivityLineType getLineType() { + return lineType; + } + + @JsonProperty("object") + public LedgerActivityObject getObject() { + return object; + } + + /** + * @return When the activity posted to the ledger. + */ + @JsonProperty("posted_at") + public OffsetDateTime getPostedAt() { + return postedAt; + } + + /** + * @return Resource associated with this ledger activity. + */ + @JsonIgnore + public Optional getResource() { + if (resource == null) { + return Optional.empty(); + } + return resource; + } + + /** + * @return Source of this ledger activity. + */ + @JsonIgnore + public Optional getSource() { + if (source == null) { + return Optional.empty(); + } + return source; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("available_at") + private Optional _getAvailableAt() { + return availableAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_at") + private Optional _getCreatedAt() { + return createdAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("ledger_account_id") + private Optional _getLedgerAccountId() { + return ledgerAccountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resource") + private Optional _getResource() { + return resource; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source") + private Optional _getSource() { + return source; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivity && equalTo((LedgerActivity) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivity other) { + return account.equals(other.account) + && amount.equals(other.amount) + && availableAt.equals(other.availableAt) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && id.equals(other.id) + && ledgerAccountId.equals(other.ledgerAccountId) + && lineType.equals(other.lineType) + && object.equals(other.object) + && postedAt.equals(other.postedAt) + && resource.equals(other.resource) + && source.equals(other.source); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.account, + this.amount, + this.availableAt, + this.createdAt, + this.currency, + this.id, + this.ledgerAccountId, + this.lineType, + this.object, + this.postedAt, + this.resource, + this.source); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

Signed amount in the currency's smallest precision units.

+ */ + CurrencyStage amount(@NotNull String amount); + + Builder from(LedgerActivity other); + } + + public interface CurrencyStage { + /** + *

Currency for this ledger activity.

+ */ + IdStage currency(@NotNull LedgerActivityCurrency currency); + } + + public interface IdStage { + /** + *

Ledger activity ID.

+ */ + LineTypeStage id(@NotNull String id); + } + + public interface LineTypeStage { + /** + *

The ledger line category this activity was posted under.

+ */ + ObjectStage lineType(@NotNull LedgerActivityLineType lineType); + } + + public interface ObjectStage { + PostedAtStage object(@NotNull LedgerActivityObject object); + } + + public interface PostedAtStage { + /** + *

When the activity posted to the ledger.

+ */ + _FinalStage postedAt(@NotNull OffsetDateTime postedAt); + } + + public interface _FinalStage { + LedgerActivity build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The viewer account that owns this row's ledger. Present only when the response aggregates owned accounts (include_owned_accounts=true); omitted otherwise.

+ */ + _FinalStage account(Optional account); + + _FinalStage account(LedgerActivityAccount account); + + /** + *

ISO 8601 timestamp these funds became (or are scheduled to become) withdrawable: the posted time for already-settled funds, or 00:00:00 UTC on the scheduled release date for pending funds. Present only on inflows entering the balance (payments, top-ups, incoming transfers/affiliate); null on withdrawals, refunds, disputes and on-chain rows. The available_after/before filters window on its UTC settlement date.

+ */ + _FinalStage availableAt(Optional availableAt); + + _FinalStage availableAt(OffsetDateTime availableAt); + + _FinalStage availableAt(Nullable availableAt); + + /** + *

When the activity record was created.

+ */ + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage createdAt(Nullable createdAt); + + /** + *

The ledger account (a ldgr_ identifier) this row belongs to. Present only when the response aggregates owned accounts (include_owned_accounts=true); omitted otherwise. Pair it with account to scope drawers and dashboard links to the owning business.

+ */ + _FinalStage ledgerAccountId(Optional ledgerAccountId); + + _FinalStage ledgerAccountId(String ledgerAccountId); + + _FinalStage ledgerAccountId(Nullable ledgerAccountId); + + /** + *

Resource associated with this ledger activity.

+ */ + _FinalStage resource(Optional resource); + + _FinalStage resource(LedgerActivityResource resource); + + _FinalStage resource(Nullable resource); + + /** + *

Source of this ledger activity.

+ */ + _FinalStage source(Optional source); + + _FinalStage source(LedgerActivitySource source); + + _FinalStage source(Nullable source); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, CurrencyStage, IdStage, LineTypeStage, ObjectStage, PostedAtStage, _FinalStage { + private String amount; + + private LedgerActivityCurrency currency; + + private String id; + + private LedgerActivityLineType lineType; + + private LedgerActivityObject object; + + private OffsetDateTime postedAt; + + private Optional source = Optional.empty(); + + private Optional resource = Optional.empty(); + + private Optional ledgerAccountId = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional availableAt = Optional.empty(); + + private Optional account = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerActivity other) { + account(other.getAccount()); + amount(other.getAmount()); + availableAt(other.getAvailableAt()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + id(other.getId()); + ledgerAccountId(other.getLedgerAccountId()); + lineType(other.getLineType()); + object(other.getObject()); + postedAt(other.getPostedAt()); + resource(other.getResource()); + source(other.getSource()); + return this; + } + + /** + *

Signed amount in the currency's smallest precision units.

+ *

Signed amount in the currency's smallest precision units.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CurrencyStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

Currency for this ledger activity.

+ *

Currency for this ledger activity.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull LedgerActivityCurrency currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Ledger activity ID.

+ *

Ledger activity ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LineTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The ledger line category this activity was posted under.

+ *

The ledger line category this activity was posted under.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("line_type") + public ObjectStage lineType(@NotNull LedgerActivityLineType lineType) { + this.lineType = Objects.requireNonNull(lineType, "lineType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public PostedAtStage object(@NotNull LedgerActivityObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

When the activity posted to the ledger.

+ *

When the activity posted to the ledger.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("posted_at") + public _FinalStage postedAt(@NotNull OffsetDateTime postedAt) { + this.postedAt = Objects.requireNonNull(postedAt, "postedAt must not be null"); + return this; + } + + /** + *

Source of this ledger activity.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(Nullable source) { + if (source.isNull()) { + this.source = null; + } else if (source.isEmpty()) { + this.source = Optional.empty(); + } else { + this.source = Optional.of(source.get()); + } + return this; + } + + /** + *

Source of this ledger activity.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(LedgerActivitySource source) { + this.source = Optional.ofNullable(source); + return this; + } + + /** + *

Source of this ledger activity.

+ */ + @java.lang.Override + @JsonSetter(value = "source", nulls = Nulls.SKIP) + public _FinalStage source(Optional source) { + this.source = source; + return this; + } + + /** + *

Resource associated with this ledger activity.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resource(Nullable resource) { + if (resource.isNull()) { + this.resource = null; + } else if (resource.isEmpty()) { + this.resource = Optional.empty(); + } else { + this.resource = Optional.of(resource.get()); + } + return this; + } + + /** + *

Resource associated with this ledger activity.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resource(LedgerActivityResource resource) { + this.resource = Optional.ofNullable(resource); + return this; + } + + /** + *

Resource associated with this ledger activity.

+ */ + @java.lang.Override + @JsonSetter(value = "resource", nulls = Nulls.SKIP) + public _FinalStage resource(Optional resource) { + this.resource = resource; + return this; + } + + /** + *

The ledger account (a ldgr_ identifier) this row belongs to. Present only when the response aggregates owned accounts (include_owned_accounts=true); omitted otherwise. Pair it with account to scope drawers and dashboard links to the owning business.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage ledgerAccountId(Nullable ledgerAccountId) { + if (ledgerAccountId.isNull()) { + this.ledgerAccountId = null; + } else if (ledgerAccountId.isEmpty()) { + this.ledgerAccountId = Optional.empty(); + } else { + this.ledgerAccountId = Optional.of(ledgerAccountId.get()); + } + return this; + } + + /** + *

The ledger account (a ldgr_ identifier) this row belongs to. Present only when the response aggregates owned accounts (include_owned_accounts=true); omitted otherwise. Pair it with account to scope drawers and dashboard links to the owning business.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage ledgerAccountId(String ledgerAccountId) { + this.ledgerAccountId = Optional.ofNullable(ledgerAccountId); + return this; + } + + /** + *

The ledger account (a ldgr_ identifier) this row belongs to. Present only when the response aggregates owned accounts (include_owned_accounts=true); omitted otherwise. Pair it with account to scope drawers and dashboard links to the owning business.

+ */ + @java.lang.Override + @JsonSetter(value = "ledger_account_id", nulls = Nulls.SKIP) + public _FinalStage ledgerAccountId(Optional ledgerAccountId) { + this.ledgerAccountId = ledgerAccountId; + return this; + } + + /** + *

When the activity record was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(Nullable createdAt) { + if (createdAt.isNull()) { + this.createdAt = null; + } else if (createdAt.isEmpty()) { + this.createdAt = Optional.empty(); + } else { + this.createdAt = Optional.of(createdAt.get()); + } + return this; + } + + /** + *

When the activity record was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

When the activity record was created.

+ */ + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

ISO 8601 timestamp these funds became (or are scheduled to become) withdrawable: the posted time for already-settled funds, or 00:00:00 UTC on the scheduled release date for pending funds. Present only on inflows entering the balance (payments, top-ups, incoming transfers/affiliate); null on withdrawals, refunds, disputes and on-chain rows. The available_after/before filters window on its UTC settlement date.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage availableAt(Nullable availableAt) { + if (availableAt.isNull()) { + this.availableAt = null; + } else if (availableAt.isEmpty()) { + this.availableAt = Optional.empty(); + } else { + this.availableAt = Optional.of(availableAt.get()); + } + return this; + } + + /** + *

ISO 8601 timestamp these funds became (or are scheduled to become) withdrawable: the posted time for already-settled funds, or 00:00:00 UTC on the scheduled release date for pending funds. Present only on inflows entering the balance (payments, top-ups, incoming transfers/affiliate); null on withdrawals, refunds, disputes and on-chain rows. The available_after/before filters window on its UTC settlement date.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage availableAt(OffsetDateTime availableAt) { + this.availableAt = Optional.ofNullable(availableAt); + return this; + } + + /** + *

ISO 8601 timestamp these funds became (or are scheduled to become) withdrawable: the posted time for already-settled funds, or 00:00:00 UTC on the scheduled release date for pending funds. Present only on inflows entering the balance (payments, top-ups, incoming transfers/affiliate); null on withdrawals, refunds, disputes and on-chain rows. The available_after/before filters window on its UTC settlement date.

+ */ + @java.lang.Override + @JsonSetter(value = "available_at", nulls = Nulls.SKIP) + public _FinalStage availableAt(Optional availableAt) { + this.availableAt = availableAt; + return this; + } + + /** + *

The viewer account that owns this row's ledger. Present only when the response aggregates owned accounts (include_owned_accounts=true); omitted otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(LedgerActivityAccount account) { + this.account = Optional.ofNullable(account); + return this; + } + + /** + *

The viewer account that owns this row's ledger. Present only when the response aggregates owned accounts (include_owned_accounts=true); omitted otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "account", nulls = Nulls.SKIP) + public _FinalStage account(Optional account) { + this.account = account; + return this; + } + + @java.lang.Override + public LedgerActivity build() { + return new LedgerActivity( + account, + amount, + availableAt, + createdAt, + currency, + id, + ledgerAccountId, + lineType, + object, + postedAt, + resource, + source, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityAccount.java b/src/main/java/com/whop/api/types/LedgerActivityAccount.java new file mode 100644 index 00000000..5a3b024d --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityAccount.java @@ -0,0 +1,221 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class LedgerActivityAccount { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private LedgerActivityAccount(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static LedgerActivityAccount account(LedgerActivityAccountAccount value) { + return new LedgerActivityAccount(new AccountValue(value)); + } + + public static LedgerActivityAccount user(LedgerActivityAccountUser value) { + return new LedgerActivityAccount(new UserValue(value)); + } + + public boolean isAccount() { + return value instanceof AccountValue; + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAccount() { + if (isAccount()) { + return Optional.of(((AccountValue) value).value); + } + return Optional.empty(); + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityAccount && value.equals(((LedgerActivityAccount) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAccount(LedgerActivityAccountAccount account); + + T visitUser(LedgerActivityAccountUser user); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "object", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(AccountValue.class), @JsonSubTypes.Type(UserValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("account") + @JsonIgnoreProperties("object") + private static final class AccountValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "object", allowSetters = true) + private LedgerActivityAccountAccount value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AccountValue() {} + + private AccountValue(LedgerActivityAccountAccount value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAccount(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountValue && equalTo((AccountValue) other); + } + + private boolean equalTo(AccountValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "LedgerActivityAccount{" + "value: " + value + "}"; + } + } + + @JsonTypeName("user") + @JsonIgnoreProperties("object") + private static final class UserValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "object", allowSetters = true) + private LedgerActivityAccountUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(LedgerActivityAccountUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "LedgerActivityAccount{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("object") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "LedgerActivityAccount{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityAccountAccount.java b/src/main/java/com/whop/api/types/LedgerActivityAccountAccount.java new file mode 100644 index 00000000..3dd9d6b5 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityAccountAccount.java @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivityAccountAccount.Builder.class) +public final class LedgerActivityAccountAccount { + private final String id; + + private final Optional logoUrl; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private LedgerActivityAccountAccount( + String id, + Optional logoUrl, + Optional route, + Optional title, + Map additionalProperties) { + this.id = id; + this.logoUrl = logoUrl; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account logo URL. + */ + @JsonIgnore + public Optional getLogoUrl() { + if (logoUrl == null) { + return Optional.empty(); + } + return logoUrl; + } + + /** + * @return Account route. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Account display name. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo_url") + private Optional _getLogoUrl() { + return logoUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityAccountAccount && equalTo((LedgerActivityAccountAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivityAccountAccount other) { + return id.equals(other.id) + && logoUrl.equals(other.logoUrl) + && route.equals(other.route) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.logoUrl, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(LedgerActivityAccountAccount other); + } + + public interface _FinalStage { + LedgerActivityAccountAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account logo URL.

+ */ + _FinalStage logoUrl(Optional logoUrl); + + _FinalStage logoUrl(String logoUrl); + + _FinalStage logoUrl(Nullable logoUrl); + + /** + *

Account route.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

Account display name.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional title = Optional.empty(); + + private Optional route = Optional.empty(); + + private Optional logoUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerActivityAccountAccount other) { + id(other.getId()); + logoUrl(other.getLogoUrl()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID.

+ *

Account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Account display name.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Account route.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + /** + *

Account logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(Nullable logoUrl) { + if (logoUrl.isNull()) { + this.logoUrl = null; + } else if (logoUrl.isEmpty()) { + this.logoUrl = Optional.empty(); + } else { + this.logoUrl = Optional.of(logoUrl.get()); + } + return this; + } + + /** + *

Account logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(String logoUrl) { + this.logoUrl = Optional.ofNullable(logoUrl); + return this; + } + + /** + *

Account logo URL.

+ */ + @java.lang.Override + @JsonSetter(value = "logo_url", nulls = Nulls.SKIP) + public _FinalStage logoUrl(Optional logoUrl) { + this.logoUrl = logoUrl; + return this; + } + + @java.lang.Override + public LedgerActivityAccountAccount build() { + return new LedgerActivityAccountAccount(id, logoUrl, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityAccountUser.java b/src/main/java/com/whop/api/types/LedgerActivityAccountUser.java new file mode 100644 index 00000000..7272c493 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityAccountUser.java @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivityAccountUser.Builder.class) +public final class LedgerActivityAccountUser { + private final String id; + + private final Optional name; + + private final Optional profilePictureUrl; + + private final Optional username; + + private final Map additionalProperties; + + private LedgerActivityAccountUser( + String id, + Optional name, + Optional profilePictureUrl, + Optional username, + Map additionalProperties) { + this.id = id; + this.name = name; + this.profilePictureUrl = profilePictureUrl; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return User profile image URL. + */ + @JsonIgnore + public Optional getProfilePictureUrl() { + if (profilePictureUrl == null) { + return Optional.empty(); + } + return profilePictureUrl; + } + + /** + * @return User's username. + */ + @JsonIgnore + public Optional getUsername() { + if (username == null) { + return Optional.empty(); + } + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("profile_picture_url") + private Optional _getProfilePictureUrl() { + return profilePictureUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("username") + private Optional _getUsername() { + return username; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityAccountUser && equalTo((LedgerActivityAccountUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivityAccountUser other) { + return id.equals(other.id) + && name.equals(other.name) + && profilePictureUrl.equals(other.profilePictureUrl) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.profilePictureUrl, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(LedgerActivityAccountUser other); + } + + public interface _FinalStage { + LedgerActivityAccountUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

User profile image URL.

+ */ + _FinalStage profilePictureUrl(Optional profilePictureUrl); + + _FinalStage profilePictureUrl(String profilePictureUrl); + + _FinalStage profilePictureUrl(Nullable profilePictureUrl); + + /** + *

User's username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + + _FinalStage username(Nullable username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional username = Optional.empty(); + + private Optional profilePictureUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerActivityAccountUser other) { + id(other.getId()); + name(other.getName()); + profilePictureUrl(other.getProfilePictureUrl()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(Nullable username) { + if (username.isNull()) { + this.username = null; + } else if (username.isEmpty()) { + this.username = Optional.empty(); + } else { + this.username = Optional.of(username.get()); + } + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

User's username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

User profile image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profilePictureUrl(Nullable profilePictureUrl) { + if (profilePictureUrl.isNull()) { + this.profilePictureUrl = null; + } else if (profilePictureUrl.isEmpty()) { + this.profilePictureUrl = Optional.empty(); + } else { + this.profilePictureUrl = Optional.of(profilePictureUrl.get()); + } + return this; + } + + /** + *

User profile image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profilePictureUrl(String profilePictureUrl) { + this.profilePictureUrl = Optional.ofNullable(profilePictureUrl); + return this; + } + + /** + *

User profile image URL.

+ */ + @java.lang.Override + @JsonSetter(value = "profile_picture_url", nulls = Nulls.SKIP) + public _FinalStage profilePictureUrl(Optional profilePictureUrl) { + this.profilePictureUrl = profilePictureUrl; + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public LedgerActivityAccountUser build() { + return new LedgerActivityAccountUser(id, name, profilePictureUrl, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityCurrency.java b/src/main/java/com/whop/api/types/LedgerActivityCurrency.java new file mode 100644 index 00000000..4ed9a71a --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityCurrency.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivityCurrency.Builder.class) +public final class LedgerActivityCurrency { + private final String code; + + private final String precision; + + private final Map additionalProperties; + + private LedgerActivityCurrency(String code, String precision, Map additionalProperties) { + this.code = code; + this.precision = precision; + this.additionalProperties = additionalProperties; + } + + /** + * @return Currency code. + */ + @JsonProperty("code") + public String getCode() { + return code; + } + + /** + * @return Precision factor for the currency, for example 100000000 for USD. + */ + @JsonProperty("precision") + public String getPrecision() { + return precision; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityCurrency && equalTo((LedgerActivityCurrency) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivityCurrency other) { + return code.equals(other.code) && precision.equals(other.precision); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.precision); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CodeStage builder() { + return new Builder(); + } + + public interface CodeStage { + /** + *

Currency code.

+ */ + PrecisionStage code(@NotNull String code); + + Builder from(LedgerActivityCurrency other); + } + + public interface PrecisionStage { + /** + *

Precision factor for the currency, for example 100000000 for USD.

+ */ + _FinalStage precision(@NotNull String precision); + } + + public interface _FinalStage { + LedgerActivityCurrency build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CodeStage, PrecisionStage, _FinalStage { + private String code; + + private String precision; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerActivityCurrency other) { + code(other.getCode()); + precision(other.getPrecision()); + return this; + } + + /** + *

Currency code.

+ *

Currency code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("code") + public PrecisionStage code(@NotNull String code) { + this.code = Objects.requireNonNull(code, "code must not be null"); + return this; + } + + /** + *

Precision factor for the currency, for example 100000000 for USD.

+ *

Precision factor for the currency, for example 100000000 for USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("precision") + public _FinalStage precision(@NotNull String precision) { + this.precision = Objects.requireNonNull(precision, "precision must not be null"); + return this; + } + + @java.lang.Override + public LedgerActivityCurrency build() { + return new LedgerActivityCurrency(code, precision, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityLineType.java b/src/main/java/com/whop/api/types/LedgerActivityLineType.java new file mode 100644 index 00000000..62f9fcf3 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityLineType.java @@ -0,0 +1,1103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LedgerActivityLineType { + public static final LedgerActivityLineType DISPUTE_REPRESENTMENT_FEE = + new LedgerActivityLineType(Value.DISPUTE_REPRESENTMENT_FEE, "dispute_representment_fee"); + + public static final LedgerActivityLineType PLATFORM_BALANCE_PAYMENT_REFUND = + new LedgerActivityLineType(Value.PLATFORM_BALANCE_PAYMENT_REFUND, "platform_balance_payment_refund"); + + public static final LedgerActivityLineType STRIPE_INTERNATIONAL_PROCESSING_FEE = new LedgerActivityLineType( + Value.STRIPE_INTERNATIONAL_PROCESSING_FEE, "stripe_international_processing_fee"); + + public static final LedgerActivityLineType PAYMENT_DISPUTE_REVERSAL = + new LedgerActivityLineType(Value.PAYMENT_DISPUTE_REVERSAL, "payment_dispute_reversal"); + + public static final LedgerActivityLineType TREASURY_PAYIN = + new LedgerActivityLineType(Value.TREASURY_PAYIN, "treasury_payin"); + + public static final LedgerActivityLineType PLATFORM_COVERED_DISPUTE = + new LedgerActivityLineType(Value.PLATFORM_COVERED_DISPUTE, "platform_covered_dispute"); + + public static final LedgerActivityLineType RESOLUTION_CENTER_REFUND = + new LedgerActivityLineType(Value.RESOLUTION_CENTER_REFUND, "resolution_center_refund"); + + public static final LedgerActivityLineType AD_PUBLISHER_PAYOUT = + new LedgerActivityLineType(Value.AD_PUBLISHER_PAYOUT, "ad_publisher_payout"); + + public static final LedgerActivityLineType BILLING_PERCENTAGE_FEE = + new LedgerActivityLineType(Value.BILLING_PERCENTAGE_FEE, "billing_percentage_fee"); + + public static final LedgerActivityLineType PAYMENT_DISPUTE = + new LedgerActivityLineType(Value.PAYMENT_DISPUTE, "payment_dispute"); + + public static final LedgerActivityLineType PAYMENT_DISPUTE_ADJUSTMENT = + new LedgerActivityLineType(Value.PAYMENT_DISPUTE_ADJUSTMENT, "payment_dispute_adjustment"); + + public static final LedgerActivityLineType PAYMENT_PROCESSING_PERCENTAGE_FEE = + new LedgerActivityLineType(Value.PAYMENT_PROCESSING_PERCENTAGE_FEE, "payment_processing_percentage_fee"); + + public static final LedgerActivityLineType THREE_DS_FIXED_FEE = + new LedgerActivityLineType(Value.THREE_DS_FIXED_FEE, "three_ds_fixed_fee"); + + public static final LedgerActivityLineType PAYMENT_REVSHARE_REFUND = + new LedgerActivityLineType(Value.PAYMENT_REVSHARE_REFUND, "payment_revshare_refund"); + + public static final LedgerActivityLineType DISPUTE_ALERT_FEE = + new LedgerActivityLineType(Value.DISPUTE_ALERT_FEE, "dispute_alert_fee"); + + public static final LedgerActivityLineType APPLICATION_FEE = + new LedgerActivityLineType(Value.APPLICATION_FEE, "application_fee"); + + public static final LedgerActivityLineType AIRDROP_LINK_RETURNED = + new LedgerActivityLineType(Value.AIRDROP_LINK_RETURNED, "airdrop_link_returned"); + + public static final LedgerActivityLineType WITHDRAWAL = new LedgerActivityLineType(Value.WITHDRAWAL, "withdrawal"); + + public static final LedgerActivityLineType PAYOUT_FEE = new LedgerActivityLineType(Value.PAYOUT_FEE, "payout_fee"); + + public static final LedgerActivityLineType INSTALLMENT_DEFAULT = + new LedgerActivityLineType(Value.INSTALLMENT_DEFAULT, "installment_default"); + + public static final LedgerActivityLineType ONCHAIN_WALLET_TRANSFER_OUTGOING = + new LedgerActivityLineType(Value.ONCHAIN_WALLET_TRANSFER_OUTGOING, "onchain_wallet_transfer_outgoing"); + + public static final LedgerActivityLineType LICENSE_SALE = + new LedgerActivityLineType(Value.LICENSE_SALE, "license_sale"); + + public static final LedgerActivityLineType APPLICATION_FEE_PAYOUT = + new LedgerActivityLineType(Value.APPLICATION_FEE_PAYOUT, "application_fee_payout"); + + public static final LedgerActivityLineType PLATFORM_BALANCE_PAYMENT = + new LedgerActivityLineType(Value.PLATFORM_BALANCE_PAYMENT, "platform_balance_payment"); + + public static final LedgerActivityLineType LEGACY_PAYMENT = + new LedgerActivityLineType(Value.LEGACY_PAYMENT, "legacy_payment"); + + public static final LedgerActivityLineType AD_PUBLISHER_PAYOUT_RECEIVED = + new LedgerActivityLineType(Value.AD_PUBLISHER_PAYOUT_RECEIVED, "ad_publisher_payout_received"); + + public static final LedgerActivityLineType PAYMENT_REFERRAL_REVERSAL = + new LedgerActivityLineType(Value.PAYMENT_REFERRAL_REVERSAL, "payment_referral_reversal"); + + public static final LedgerActivityLineType LEGACY_CRYPTO_PAYMENT = + new LedgerActivityLineType(Value.LEGACY_CRYPTO_PAYMENT, "legacy_crypto_payment"); + + public static final LedgerActivityLineType AD_BUDGET_RELEASE = + new LedgerActivityLineType(Value.AD_BUDGET_RELEASE, "ad_budget_release"); + + public static final LedgerActivityLineType AD_SPEND_CHARGE = + new LedgerActivityLineType(Value.AD_SPEND_CHARGE, "ad_spend_charge"); + + public static final LedgerActivityLineType PLATFORM_BALANCE_TRANSFER_INCOMING = + new LedgerActivityLineType(Value.PLATFORM_BALANCE_TRANSFER_INCOMING, "platform_balance_transfer_incoming"); + + public static final LedgerActivityLineType PAYMENT_REFERRAL = + new LedgerActivityLineType(Value.PAYMENT_REFERRAL, "payment_referral"); + + public static final LedgerActivityLineType PROMO_REVERSAL = + new LedgerActivityLineType(Value.PROMO_REVERSAL, "promo_reversal"); + + public static final LedgerActivityLineType TOPUP_REVERSAL = + new LedgerActivityLineType(Value.TOPUP_REVERSAL, "topup_reversal"); + + public static final LedgerActivityLineType PLATFORM_AFFILIATE_PAYMENT_REVERSAL = new LedgerActivityLineType( + Value.PLATFORM_AFFILIATE_PAYMENT_REVERSAL, "platform_affiliate_payment_reversal"); + + public static final LedgerActivityLineType AIRDROP = new LedgerActivityLineType(Value.AIRDROP, "airdrop"); + + public static final LedgerActivityLineType WITHDRAWAL_CLAWBACK_REVERSAL = + new LedgerActivityLineType(Value.WITHDRAWAL_CLAWBACK_REVERSAL, "withdrawal_clawback_reversal"); + + public static final LedgerActivityLineType CARD_SPEND_AUTHORIZATION = + new LedgerActivityLineType(Value.CARD_SPEND_AUTHORIZATION, "card_spend_authorization"); + + public static final LedgerActivityLineType LICENSE_SALE_REVENUE = + new LedgerActivityLineType(Value.LICENSE_SALE_REVENUE, "license_sale_revenue"); + + public static final LedgerActivityLineType TOPUP = new LedgerActivityLineType(Value.TOPUP, "topup"); + + public static final LedgerActivityLineType HIGH_RISK_MERCHANT_FEE = + new LedgerActivityLineType(Value.HIGH_RISK_MERCHANT_FEE, "high_risk_merchant_fee"); + + public static final LedgerActivityLineType PAYMENT_REVSHARE_PAYOUT = + new LedgerActivityLineType(Value.PAYMENT_REVSHARE_PAYOUT, "payment_revshare_payout"); + + public static final LedgerActivityLineType INTERNAL_BALANCE_TRANSFER_INCOMING = + new LedgerActivityLineType(Value.INTERNAL_BALANCE_TRANSFER_INCOMING, "internal_balance_transfer_incoming"); + + public static final LedgerActivityLineType PAYMENT_REFUND_REVERSAL = + new LedgerActivityLineType(Value.PAYMENT_REFUND_REVERSAL, "payment_refund_reversal"); + + public static final LedgerActivityLineType ONCHAIN_DEPOSIT = + new LedgerActivityLineType(Value.ONCHAIN_DEPOSIT, "onchain_deposit"); + + public static final LedgerActivityLineType WITHDRAWAL_RECLASSIFICATION = + new LedgerActivityLineType(Value.WITHDRAWAL_RECLASSIFICATION, "withdrawal_reclassification"); + + public static final LedgerActivityLineType FRAUD_PREVENTION_FEE = + new LedgerActivityLineType(Value.FRAUD_PREVENTION_FEE, "fraud_prevention_fee"); + + public static final LedgerActivityLineType STRIPE_DOMESTIC_PROCESSING_FEE = + new LedgerActivityLineType(Value.STRIPE_DOMESTIC_PROCESSING_FEE, "stripe_domestic_processing_fee"); + + public static final LedgerActivityLineType MISC_PURCHASE = + new LedgerActivityLineType(Value.MISC_PURCHASE, "misc_purchase"); + + public static final LedgerActivityLineType PLATFORM_BALANCE_TRANSFER_OUTGOING = + new LedgerActivityLineType(Value.PLATFORM_BALANCE_TRANSFER_OUTGOING, "platform_balance_transfer_outgoing"); + + public static final LedgerActivityLineType MISC_REVERSAL = + new LedgerActivityLineType(Value.MISC_REVERSAL, "misc_reversal"); + + public static final LedgerActivityLineType AIRDROP_LINK_REDEEMED = + new LedgerActivityLineType(Value.AIRDROP_LINK_REDEEMED, "airdrop_link_redeemed"); + + public static final LedgerActivityLineType ONCHAIN_SWAP_TARGET = + new LedgerActivityLineType(Value.ONCHAIN_SWAP_TARGET, "onchain_swap_target"); + + public static final LedgerActivityLineType AD_CAMPAIGN_BUDGET = + new LedgerActivityLineType(Value.AD_CAMPAIGN_BUDGET, "ad_campaign_budget"); + + public static final LedgerActivityLineType SOFTWARE_RENTAL_TRANSACTION = + new LedgerActivityLineType(Value.SOFTWARE_RENTAL_TRANSACTION, "software_rental_transaction"); + + public static final LedgerActivityLineType CURRENCY_CONVERSION_INCOMING = + new LedgerActivityLineType(Value.CURRENCY_CONVERSION_INCOMING, "currency_conversion_incoming"); + + public static final LedgerActivityLineType AFFILIATE_FEE = + new LedgerActivityLineType(Value.AFFILIATE_FEE, "affiliate_fee"); + + public static final LedgerActivityLineType CARD_SPEND_AUTHORIZATION_VOID = + new LedgerActivityLineType(Value.CARD_SPEND_AUTHORIZATION_VOID, "card_spend_authorization_void"); + + public static final LedgerActivityLineType PAYMENT_GROSS_REVERSAL = + new LedgerActivityLineType(Value.PAYMENT_GROSS_REVERSAL, "payment_gross_reversal"); + + public static final LedgerActivityLineType LEGACY_PAYMENT_REFUND = + new LedgerActivityLineType(Value.LEGACY_PAYMENT_REFUND, "legacy_payment_refund"); + + public static final LedgerActivityLineType PASSTHROUGH_GMV = + new LedgerActivityLineType(Value.PASSTHROUGH_GMV, "passthrough_gmv"); + + public static final LedgerActivityLineType DISPUTE_HOLD_ADJUSTMENT = + new LedgerActivityLineType(Value.DISPUTE_HOLD_ADJUSTMENT, "dispute_hold_adjustment"); + + public static final LedgerActivityLineType INTERNAL_WITHDRAWAL = + new LedgerActivityLineType(Value.INTERNAL_WITHDRAWAL, "internal_withdrawal"); + + public static final LedgerActivityLineType PAYMENT_GROSS = + new LedgerActivityLineType(Value.PAYMENT_GROSS, "payment_gross"); + + public static final LedgerActivityLineType BANK_TRANSFER = + new LedgerActivityLineType(Value.BANK_TRANSFER, "bank_transfer"); + + public static final LedgerActivityLineType REFERRAL_BONUS = + new LedgerActivityLineType(Value.REFERRAL_BONUS, "referral_bonus"); + + public static final LedgerActivityLineType INTERNAL_BALANCE_TRANSFER_OUTGOING = + new LedgerActivityLineType(Value.INTERNAL_BALANCE_TRANSFER_OUTGOING, "internal_balance_transfer_outgoing"); + + public static final LedgerActivityLineType SALES_TAX_REMITTANCE_REVERSAL = + new LedgerActivityLineType(Value.SALES_TAX_REMITTANCE_REVERSAL, "sales_tax_remittance_reversal"); + + public static final LedgerActivityLineType WITHDRAWAL_CLAWBACK = + new LedgerActivityLineType(Value.WITHDRAWAL_CLAWBACK, "withdrawal_clawback"); + + public static final LedgerActivityLineType LICENSE_SALE_COMMISSION = + new LedgerActivityLineType(Value.LICENSE_SALE_COMMISSION, "license_sale_commission"); + + public static final LedgerActivityLineType REVSHARE_PERCENTAGE_FEE = + new LedgerActivityLineType(Value.REVSHARE_PERCENTAGE_FEE, "revshare_percentage_fee"); + + public static final LedgerActivityLineType SALES_TAX_FEE = + new LedgerActivityLineType(Value.SALES_TAX_FEE, "sales_tax_fee"); + + public static final LedgerActivityLineType WITHDRAWAL_REVERSAL = + new LedgerActivityLineType(Value.WITHDRAWAL_REVERSAL, "withdrawal_reversal"); + + public static final LedgerActivityLineType AIRDROP_REVERSAL = + new LedgerActivityLineType(Value.AIRDROP_REVERSAL, "airdrop_reversal"); + + public static final LedgerActivityLineType PAYMENT_REFUND = + new LedgerActivityLineType(Value.PAYMENT_REFUND, "payment_refund"); + + public static final LedgerActivityLineType CROSS_BORDER_PERCENTAGE_FEE = + new LedgerActivityLineType(Value.CROSS_BORDER_PERCENTAGE_FEE, "cross_border_percentage_fee"); + + public static final LedgerActivityLineType TOPUP_FEE = new LedgerActivityLineType(Value.TOPUP_FEE, "topup_fee"); + + public static final LedgerActivityLineType AIRDROP_LINK_CREATED = + new LedgerActivityLineType(Value.AIRDROP_LINK_CREATED, "airdrop_link_created"); + + public static final LedgerActivityLineType FX_PERCENTAGE_FEE = + new LedgerActivityLineType(Value.FX_PERCENTAGE_FEE, "fx_percentage_fee"); + + public static final LedgerActivityLineType CURRENCY_CONVERSION_OUTGOING = + new LedgerActivityLineType(Value.CURRENCY_CONVERSION_OUTGOING, "currency_conversion_outgoing"); + + public static final LedgerActivityLineType COMPANY_REFERRAL = + new LedgerActivityLineType(Value.COMPANY_REFERRAL, "company_referral"); + + public static final LedgerActivityLineType ORCHESTRATION_PERCENTAGE_FEE = + new LedgerActivityLineType(Value.ORCHESTRATION_PERCENTAGE_FEE, "orchestration_percentage_fee"); + + public static final LedgerActivityLineType CARD_SPEND_REFUND = + new LedgerActivityLineType(Value.CARD_SPEND_REFUND, "card_spend_refund"); + + public static final LedgerActivityLineType PAYMENT_REVSHARE_REVERSAL = + new LedgerActivityLineType(Value.PAYMENT_REVSHARE_REVERSAL, "payment_revshare_reversal"); + + public static final LedgerActivityLineType PLATFORM_AFFILIATE_PAYMENT = + new LedgerActivityLineType(Value.PLATFORM_AFFILIATE_PAYMENT, "platform_affiliate_payment"); + + public static final LedgerActivityLineType SALES_TAX_REMITTANCE = + new LedgerActivityLineType(Value.SALES_TAX_REMITTANCE, "sales_tax_remittance"); + + public static final LedgerActivityLineType MISC_REFUND = + new LedgerActivityLineType(Value.MISC_REFUND, "misc_refund"); + + public static final LedgerActivityLineType PAYMENT_PROCESSING_FIXED_FEE = + new LedgerActivityLineType(Value.PAYMENT_PROCESSING_FIXED_FEE, "payment_processing_fixed_fee"); + + public static final LedgerActivityLineType INTERNAL_WITHDRAWAL_REVERSAL = + new LedgerActivityLineType(Value.INTERNAL_WITHDRAWAL_REVERSAL, "internal_withdrawal_reversal"); + + public static final LedgerActivityLineType SOFTWARE_RENTAL_REVSHARE = + new LedgerActivityLineType(Value.SOFTWARE_RENTAL_REVSHARE, "software_rental_revshare"); + + public static final LedgerActivityLineType BUYER_FEE = new LedgerActivityLineType(Value.BUYER_FEE, "buyer_fee"); + + public static final LedgerActivityLineType WHOP_PROCESSING_FEE = + new LedgerActivityLineType(Value.WHOP_PROCESSING_FEE, "whop_processing_fee"); + + public static final LedgerActivityLineType ONCHAIN_WALLET_TRANSFER_INCOMING = + new LedgerActivityLineType(Value.ONCHAIN_WALLET_TRANSFER_INCOMING, "onchain_wallet_transfer_incoming"); + + public static final LedgerActivityLineType PAYMENT_REVSHARE = + new LedgerActivityLineType(Value.PAYMENT_REVSHARE, "payment_revshare"); + + public static final LedgerActivityLineType PAYMENT_DISPUTE_FEE = + new LedgerActivityLineType(Value.PAYMENT_DISPUTE_FEE, "payment_dispute_fee"); + + private final Value value; + + private final String string; + + LedgerActivityLineType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LedgerActivityLineType + && this.string.equals(((LedgerActivityLineType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DISPUTE_REPRESENTMENT_FEE: + return visitor.visitDisputeRepresentmentFee(); + case PLATFORM_BALANCE_PAYMENT_REFUND: + return visitor.visitPlatformBalancePaymentRefund(); + case STRIPE_INTERNATIONAL_PROCESSING_FEE: + return visitor.visitStripeInternationalProcessingFee(); + case PAYMENT_DISPUTE_REVERSAL: + return visitor.visitPaymentDisputeReversal(); + case TREASURY_PAYIN: + return visitor.visitTreasuryPayin(); + case PLATFORM_COVERED_DISPUTE: + return visitor.visitPlatformCoveredDispute(); + case RESOLUTION_CENTER_REFUND: + return visitor.visitResolutionCenterRefund(); + case AD_PUBLISHER_PAYOUT: + return visitor.visitAdPublisherPayout(); + case BILLING_PERCENTAGE_FEE: + return visitor.visitBillingPercentageFee(); + case PAYMENT_DISPUTE: + return visitor.visitPaymentDispute(); + case PAYMENT_DISPUTE_ADJUSTMENT: + return visitor.visitPaymentDisputeAdjustment(); + case PAYMENT_PROCESSING_PERCENTAGE_FEE: + return visitor.visitPaymentProcessingPercentageFee(); + case THREE_DS_FIXED_FEE: + return visitor.visitThreeDsFixedFee(); + case PAYMENT_REVSHARE_REFUND: + return visitor.visitPaymentRevshareRefund(); + case DISPUTE_ALERT_FEE: + return visitor.visitDisputeAlertFee(); + case APPLICATION_FEE: + return visitor.visitApplicationFee(); + case AIRDROP_LINK_RETURNED: + return visitor.visitAirdropLinkReturned(); + case WITHDRAWAL: + return visitor.visitWithdrawal(); + case PAYOUT_FEE: + return visitor.visitPayoutFee(); + case INSTALLMENT_DEFAULT: + return visitor.visitInstallmentDefault(); + case ONCHAIN_WALLET_TRANSFER_OUTGOING: + return visitor.visitOnchainWalletTransferOutgoing(); + case LICENSE_SALE: + return visitor.visitLicenseSale(); + case APPLICATION_FEE_PAYOUT: + return visitor.visitApplicationFeePayout(); + case PLATFORM_BALANCE_PAYMENT: + return visitor.visitPlatformBalancePayment(); + case LEGACY_PAYMENT: + return visitor.visitLegacyPayment(); + case AD_PUBLISHER_PAYOUT_RECEIVED: + return visitor.visitAdPublisherPayoutReceived(); + case PAYMENT_REFERRAL_REVERSAL: + return visitor.visitPaymentReferralReversal(); + case LEGACY_CRYPTO_PAYMENT: + return visitor.visitLegacyCryptoPayment(); + case AD_BUDGET_RELEASE: + return visitor.visitAdBudgetRelease(); + case AD_SPEND_CHARGE: + return visitor.visitAdSpendCharge(); + case PLATFORM_BALANCE_TRANSFER_INCOMING: + return visitor.visitPlatformBalanceTransferIncoming(); + case PAYMENT_REFERRAL: + return visitor.visitPaymentReferral(); + case PROMO_REVERSAL: + return visitor.visitPromoReversal(); + case TOPUP_REVERSAL: + return visitor.visitTopupReversal(); + case PLATFORM_AFFILIATE_PAYMENT_REVERSAL: + return visitor.visitPlatformAffiliatePaymentReversal(); + case AIRDROP: + return visitor.visitAirdrop(); + case WITHDRAWAL_CLAWBACK_REVERSAL: + return visitor.visitWithdrawalClawbackReversal(); + case CARD_SPEND_AUTHORIZATION: + return visitor.visitCardSpendAuthorization(); + case LICENSE_SALE_REVENUE: + return visitor.visitLicenseSaleRevenue(); + case TOPUP: + return visitor.visitTopup(); + case HIGH_RISK_MERCHANT_FEE: + return visitor.visitHighRiskMerchantFee(); + case PAYMENT_REVSHARE_PAYOUT: + return visitor.visitPaymentRevsharePayout(); + case INTERNAL_BALANCE_TRANSFER_INCOMING: + return visitor.visitInternalBalanceTransferIncoming(); + case PAYMENT_REFUND_REVERSAL: + return visitor.visitPaymentRefundReversal(); + case ONCHAIN_DEPOSIT: + return visitor.visitOnchainDeposit(); + case WITHDRAWAL_RECLASSIFICATION: + return visitor.visitWithdrawalReclassification(); + case FRAUD_PREVENTION_FEE: + return visitor.visitFraudPreventionFee(); + case STRIPE_DOMESTIC_PROCESSING_FEE: + return visitor.visitStripeDomesticProcessingFee(); + case MISC_PURCHASE: + return visitor.visitMiscPurchase(); + case PLATFORM_BALANCE_TRANSFER_OUTGOING: + return visitor.visitPlatformBalanceTransferOutgoing(); + case MISC_REVERSAL: + return visitor.visitMiscReversal(); + case AIRDROP_LINK_REDEEMED: + return visitor.visitAirdropLinkRedeemed(); + case ONCHAIN_SWAP_TARGET: + return visitor.visitOnchainSwapTarget(); + case AD_CAMPAIGN_BUDGET: + return visitor.visitAdCampaignBudget(); + case SOFTWARE_RENTAL_TRANSACTION: + return visitor.visitSoftwareRentalTransaction(); + case CURRENCY_CONVERSION_INCOMING: + return visitor.visitCurrencyConversionIncoming(); + case AFFILIATE_FEE: + return visitor.visitAffiliateFee(); + case CARD_SPEND_AUTHORIZATION_VOID: + return visitor.visitCardSpendAuthorizationVoid(); + case PAYMENT_GROSS_REVERSAL: + return visitor.visitPaymentGrossReversal(); + case LEGACY_PAYMENT_REFUND: + return visitor.visitLegacyPaymentRefund(); + case PASSTHROUGH_GMV: + return visitor.visitPassthroughGmv(); + case DISPUTE_HOLD_ADJUSTMENT: + return visitor.visitDisputeHoldAdjustment(); + case INTERNAL_WITHDRAWAL: + return visitor.visitInternalWithdrawal(); + case PAYMENT_GROSS: + return visitor.visitPaymentGross(); + case BANK_TRANSFER: + return visitor.visitBankTransfer(); + case REFERRAL_BONUS: + return visitor.visitReferralBonus(); + case INTERNAL_BALANCE_TRANSFER_OUTGOING: + return visitor.visitInternalBalanceTransferOutgoing(); + case SALES_TAX_REMITTANCE_REVERSAL: + return visitor.visitSalesTaxRemittanceReversal(); + case WITHDRAWAL_CLAWBACK: + return visitor.visitWithdrawalClawback(); + case LICENSE_SALE_COMMISSION: + return visitor.visitLicenseSaleCommission(); + case REVSHARE_PERCENTAGE_FEE: + return visitor.visitRevsharePercentageFee(); + case SALES_TAX_FEE: + return visitor.visitSalesTaxFee(); + case WITHDRAWAL_REVERSAL: + return visitor.visitWithdrawalReversal(); + case AIRDROP_REVERSAL: + return visitor.visitAirdropReversal(); + case PAYMENT_REFUND: + return visitor.visitPaymentRefund(); + case CROSS_BORDER_PERCENTAGE_FEE: + return visitor.visitCrossBorderPercentageFee(); + case TOPUP_FEE: + return visitor.visitTopupFee(); + case AIRDROP_LINK_CREATED: + return visitor.visitAirdropLinkCreated(); + case FX_PERCENTAGE_FEE: + return visitor.visitFxPercentageFee(); + case CURRENCY_CONVERSION_OUTGOING: + return visitor.visitCurrencyConversionOutgoing(); + case COMPANY_REFERRAL: + return visitor.visitCompanyReferral(); + case ORCHESTRATION_PERCENTAGE_FEE: + return visitor.visitOrchestrationPercentageFee(); + case CARD_SPEND_REFUND: + return visitor.visitCardSpendRefund(); + case PAYMENT_REVSHARE_REVERSAL: + return visitor.visitPaymentRevshareReversal(); + case PLATFORM_AFFILIATE_PAYMENT: + return visitor.visitPlatformAffiliatePayment(); + case SALES_TAX_REMITTANCE: + return visitor.visitSalesTaxRemittance(); + case MISC_REFUND: + return visitor.visitMiscRefund(); + case PAYMENT_PROCESSING_FIXED_FEE: + return visitor.visitPaymentProcessingFixedFee(); + case INTERNAL_WITHDRAWAL_REVERSAL: + return visitor.visitInternalWithdrawalReversal(); + case SOFTWARE_RENTAL_REVSHARE: + return visitor.visitSoftwareRentalRevshare(); + case BUYER_FEE: + return visitor.visitBuyerFee(); + case WHOP_PROCESSING_FEE: + return visitor.visitWhopProcessingFee(); + case ONCHAIN_WALLET_TRANSFER_INCOMING: + return visitor.visitOnchainWalletTransferIncoming(); + case PAYMENT_REVSHARE: + return visitor.visitPaymentRevshare(); + case PAYMENT_DISPUTE_FEE: + return visitor.visitPaymentDisputeFee(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LedgerActivityLineType valueOf(String value) { + switch (value) { + case "dispute_representment_fee": + return DISPUTE_REPRESENTMENT_FEE; + case "platform_balance_payment_refund": + return PLATFORM_BALANCE_PAYMENT_REFUND; + case "stripe_international_processing_fee": + return STRIPE_INTERNATIONAL_PROCESSING_FEE; + case "payment_dispute_reversal": + return PAYMENT_DISPUTE_REVERSAL; + case "treasury_payin": + return TREASURY_PAYIN; + case "platform_covered_dispute": + return PLATFORM_COVERED_DISPUTE; + case "resolution_center_refund": + return RESOLUTION_CENTER_REFUND; + case "ad_publisher_payout": + return AD_PUBLISHER_PAYOUT; + case "billing_percentage_fee": + return BILLING_PERCENTAGE_FEE; + case "payment_dispute": + return PAYMENT_DISPUTE; + case "payment_dispute_adjustment": + return PAYMENT_DISPUTE_ADJUSTMENT; + case "payment_processing_percentage_fee": + return PAYMENT_PROCESSING_PERCENTAGE_FEE; + case "three_ds_fixed_fee": + return THREE_DS_FIXED_FEE; + case "payment_revshare_refund": + return PAYMENT_REVSHARE_REFUND; + case "dispute_alert_fee": + return DISPUTE_ALERT_FEE; + case "application_fee": + return APPLICATION_FEE; + case "airdrop_link_returned": + return AIRDROP_LINK_RETURNED; + case "withdrawal": + return WITHDRAWAL; + case "payout_fee": + return PAYOUT_FEE; + case "installment_default": + return INSTALLMENT_DEFAULT; + case "onchain_wallet_transfer_outgoing": + return ONCHAIN_WALLET_TRANSFER_OUTGOING; + case "license_sale": + return LICENSE_SALE; + case "application_fee_payout": + return APPLICATION_FEE_PAYOUT; + case "platform_balance_payment": + return PLATFORM_BALANCE_PAYMENT; + case "legacy_payment": + return LEGACY_PAYMENT; + case "ad_publisher_payout_received": + return AD_PUBLISHER_PAYOUT_RECEIVED; + case "payment_referral_reversal": + return PAYMENT_REFERRAL_REVERSAL; + case "legacy_crypto_payment": + return LEGACY_CRYPTO_PAYMENT; + case "ad_budget_release": + return AD_BUDGET_RELEASE; + case "ad_spend_charge": + return AD_SPEND_CHARGE; + case "platform_balance_transfer_incoming": + return PLATFORM_BALANCE_TRANSFER_INCOMING; + case "payment_referral": + return PAYMENT_REFERRAL; + case "promo_reversal": + return PROMO_REVERSAL; + case "topup_reversal": + return TOPUP_REVERSAL; + case "platform_affiliate_payment_reversal": + return PLATFORM_AFFILIATE_PAYMENT_REVERSAL; + case "airdrop": + return AIRDROP; + case "withdrawal_clawback_reversal": + return WITHDRAWAL_CLAWBACK_REVERSAL; + case "card_spend_authorization": + return CARD_SPEND_AUTHORIZATION; + case "license_sale_revenue": + return LICENSE_SALE_REVENUE; + case "topup": + return TOPUP; + case "high_risk_merchant_fee": + return HIGH_RISK_MERCHANT_FEE; + case "payment_revshare_payout": + return PAYMENT_REVSHARE_PAYOUT; + case "internal_balance_transfer_incoming": + return INTERNAL_BALANCE_TRANSFER_INCOMING; + case "payment_refund_reversal": + return PAYMENT_REFUND_REVERSAL; + case "onchain_deposit": + return ONCHAIN_DEPOSIT; + case "withdrawal_reclassification": + return WITHDRAWAL_RECLASSIFICATION; + case "fraud_prevention_fee": + return FRAUD_PREVENTION_FEE; + case "stripe_domestic_processing_fee": + return STRIPE_DOMESTIC_PROCESSING_FEE; + case "misc_purchase": + return MISC_PURCHASE; + case "platform_balance_transfer_outgoing": + return PLATFORM_BALANCE_TRANSFER_OUTGOING; + case "misc_reversal": + return MISC_REVERSAL; + case "airdrop_link_redeemed": + return AIRDROP_LINK_REDEEMED; + case "onchain_swap_target": + return ONCHAIN_SWAP_TARGET; + case "ad_campaign_budget": + return AD_CAMPAIGN_BUDGET; + case "software_rental_transaction": + return SOFTWARE_RENTAL_TRANSACTION; + case "currency_conversion_incoming": + return CURRENCY_CONVERSION_INCOMING; + case "affiliate_fee": + return AFFILIATE_FEE; + case "card_spend_authorization_void": + return CARD_SPEND_AUTHORIZATION_VOID; + case "payment_gross_reversal": + return PAYMENT_GROSS_REVERSAL; + case "legacy_payment_refund": + return LEGACY_PAYMENT_REFUND; + case "passthrough_gmv": + return PASSTHROUGH_GMV; + case "dispute_hold_adjustment": + return DISPUTE_HOLD_ADJUSTMENT; + case "internal_withdrawal": + return INTERNAL_WITHDRAWAL; + case "payment_gross": + return PAYMENT_GROSS; + case "bank_transfer": + return BANK_TRANSFER; + case "referral_bonus": + return REFERRAL_BONUS; + case "internal_balance_transfer_outgoing": + return INTERNAL_BALANCE_TRANSFER_OUTGOING; + case "sales_tax_remittance_reversal": + return SALES_TAX_REMITTANCE_REVERSAL; + case "withdrawal_clawback": + return WITHDRAWAL_CLAWBACK; + case "license_sale_commission": + return LICENSE_SALE_COMMISSION; + case "revshare_percentage_fee": + return REVSHARE_PERCENTAGE_FEE; + case "sales_tax_fee": + return SALES_TAX_FEE; + case "withdrawal_reversal": + return WITHDRAWAL_REVERSAL; + case "airdrop_reversal": + return AIRDROP_REVERSAL; + case "payment_refund": + return PAYMENT_REFUND; + case "cross_border_percentage_fee": + return CROSS_BORDER_PERCENTAGE_FEE; + case "topup_fee": + return TOPUP_FEE; + case "airdrop_link_created": + return AIRDROP_LINK_CREATED; + case "fx_percentage_fee": + return FX_PERCENTAGE_FEE; + case "currency_conversion_outgoing": + return CURRENCY_CONVERSION_OUTGOING; + case "company_referral": + return COMPANY_REFERRAL; + case "orchestration_percentage_fee": + return ORCHESTRATION_PERCENTAGE_FEE; + case "card_spend_refund": + return CARD_SPEND_REFUND; + case "payment_revshare_reversal": + return PAYMENT_REVSHARE_REVERSAL; + case "platform_affiliate_payment": + return PLATFORM_AFFILIATE_PAYMENT; + case "sales_tax_remittance": + return SALES_TAX_REMITTANCE; + case "misc_refund": + return MISC_REFUND; + case "payment_processing_fixed_fee": + return PAYMENT_PROCESSING_FIXED_FEE; + case "internal_withdrawal_reversal": + return INTERNAL_WITHDRAWAL_REVERSAL; + case "software_rental_revshare": + return SOFTWARE_RENTAL_REVSHARE; + case "buyer_fee": + return BUYER_FEE; + case "whop_processing_fee": + return WHOP_PROCESSING_FEE; + case "onchain_wallet_transfer_incoming": + return ONCHAIN_WALLET_TRANSFER_INCOMING; + case "payment_revshare": + return PAYMENT_REVSHARE; + case "payment_dispute_fee": + return PAYMENT_DISPUTE_FEE; + default: + return new LedgerActivityLineType(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_BUDGET_RELEASE, + + AD_CAMPAIGN_BUDGET, + + AD_PUBLISHER_PAYOUT, + + AD_PUBLISHER_PAYOUT_RECEIVED, + + AD_SPEND_CHARGE, + + AFFILIATE_FEE, + + AIRDROP, + + AIRDROP_LINK_CREATED, + + AIRDROP_LINK_REDEEMED, + + AIRDROP_LINK_RETURNED, + + AIRDROP_REVERSAL, + + APPLICATION_FEE, + + APPLICATION_FEE_PAYOUT, + + BANK_TRANSFER, + + BILLING_PERCENTAGE_FEE, + + BUYER_FEE, + + CARD_SPEND_AUTHORIZATION, + + CARD_SPEND_AUTHORIZATION_VOID, + + CARD_SPEND_REFUND, + + COMPANY_REFERRAL, + + CROSS_BORDER_PERCENTAGE_FEE, + + CURRENCY_CONVERSION_INCOMING, + + CURRENCY_CONVERSION_OUTGOING, + + DISPUTE_ALERT_FEE, + + DISPUTE_HOLD_ADJUSTMENT, + + DISPUTE_REPRESENTMENT_FEE, + + FRAUD_PREVENTION_FEE, + + FX_PERCENTAGE_FEE, + + HIGH_RISK_MERCHANT_FEE, + + INSTALLMENT_DEFAULT, + + INTERNAL_BALANCE_TRANSFER_INCOMING, + + INTERNAL_BALANCE_TRANSFER_OUTGOING, + + INTERNAL_WITHDRAWAL, + + INTERNAL_WITHDRAWAL_REVERSAL, + + LEGACY_CRYPTO_PAYMENT, + + LEGACY_PAYMENT, + + LEGACY_PAYMENT_REFUND, + + LICENSE_SALE, + + LICENSE_SALE_COMMISSION, + + LICENSE_SALE_REVENUE, + + MISC_PURCHASE, + + MISC_REFUND, + + MISC_REVERSAL, + + ONCHAIN_DEPOSIT, + + ONCHAIN_SWAP_TARGET, + + ONCHAIN_WALLET_TRANSFER_INCOMING, + + ONCHAIN_WALLET_TRANSFER_OUTGOING, + + ORCHESTRATION_PERCENTAGE_FEE, + + PASSTHROUGH_GMV, + + PAYMENT_DISPUTE, + + PAYMENT_DISPUTE_ADJUSTMENT, + + PAYMENT_DISPUTE_FEE, + + PAYMENT_DISPUTE_REVERSAL, + + PAYMENT_GROSS, + + PAYMENT_GROSS_REVERSAL, + + PAYMENT_PROCESSING_FIXED_FEE, + + PAYMENT_PROCESSING_PERCENTAGE_FEE, + + PAYMENT_REFERRAL, + + PAYMENT_REFERRAL_REVERSAL, + + PAYMENT_REFUND, + + PAYMENT_REFUND_REVERSAL, + + PAYMENT_REVSHARE, + + PAYMENT_REVSHARE_PAYOUT, + + PAYMENT_REVSHARE_REFUND, + + PAYMENT_REVSHARE_REVERSAL, + + PAYOUT_FEE, + + PLATFORM_AFFILIATE_PAYMENT, + + PLATFORM_AFFILIATE_PAYMENT_REVERSAL, + + PLATFORM_BALANCE_PAYMENT, + + PLATFORM_BALANCE_PAYMENT_REFUND, + + PLATFORM_BALANCE_TRANSFER_INCOMING, + + PLATFORM_BALANCE_TRANSFER_OUTGOING, + + PLATFORM_COVERED_DISPUTE, + + PROMO_REVERSAL, + + REFERRAL_BONUS, + + RESOLUTION_CENTER_REFUND, + + REVSHARE_PERCENTAGE_FEE, + + SALES_TAX_FEE, + + SALES_TAX_REMITTANCE, + + SALES_TAX_REMITTANCE_REVERSAL, + + SOFTWARE_RENTAL_REVSHARE, + + SOFTWARE_RENTAL_TRANSACTION, + + STRIPE_DOMESTIC_PROCESSING_FEE, + + STRIPE_INTERNATIONAL_PROCESSING_FEE, + + THREE_DS_FIXED_FEE, + + TOPUP, + + TOPUP_FEE, + + TOPUP_REVERSAL, + + TREASURY_PAYIN, + + WHOP_PROCESSING_FEE, + + WITHDRAWAL, + + WITHDRAWAL_CLAWBACK, + + WITHDRAWAL_CLAWBACK_REVERSAL, + + WITHDRAWAL_RECLASSIFICATION, + + WITHDRAWAL_REVERSAL, + + UNKNOWN + } + + public interface Visitor { + T visitAdBudgetRelease(); + + T visitAdCampaignBudget(); + + T visitAdPublisherPayout(); + + T visitAdPublisherPayoutReceived(); + + T visitAdSpendCharge(); + + T visitAffiliateFee(); + + T visitAirdrop(); + + T visitAirdropLinkCreated(); + + T visitAirdropLinkRedeemed(); + + T visitAirdropLinkReturned(); + + T visitAirdropReversal(); + + T visitApplicationFee(); + + T visitApplicationFeePayout(); + + T visitBankTransfer(); + + T visitBillingPercentageFee(); + + T visitBuyerFee(); + + T visitCardSpendAuthorization(); + + T visitCardSpendAuthorizationVoid(); + + T visitCardSpendRefund(); + + T visitCompanyReferral(); + + T visitCrossBorderPercentageFee(); + + T visitCurrencyConversionIncoming(); + + T visitCurrencyConversionOutgoing(); + + T visitDisputeAlertFee(); + + T visitDisputeHoldAdjustment(); + + T visitDisputeRepresentmentFee(); + + T visitFraudPreventionFee(); + + T visitFxPercentageFee(); + + T visitHighRiskMerchantFee(); + + T visitInstallmentDefault(); + + T visitInternalBalanceTransferIncoming(); + + T visitInternalBalanceTransferOutgoing(); + + T visitInternalWithdrawal(); + + T visitInternalWithdrawalReversal(); + + T visitLegacyCryptoPayment(); + + T visitLegacyPayment(); + + T visitLegacyPaymentRefund(); + + T visitLicenseSale(); + + T visitLicenseSaleCommission(); + + T visitLicenseSaleRevenue(); + + T visitMiscPurchase(); + + T visitMiscRefund(); + + T visitMiscReversal(); + + T visitOnchainDeposit(); + + T visitOnchainSwapTarget(); + + T visitOnchainWalletTransferIncoming(); + + T visitOnchainWalletTransferOutgoing(); + + T visitOrchestrationPercentageFee(); + + T visitPassthroughGmv(); + + T visitPaymentDispute(); + + T visitPaymentDisputeAdjustment(); + + T visitPaymentDisputeFee(); + + T visitPaymentDisputeReversal(); + + T visitPaymentGross(); + + T visitPaymentGrossReversal(); + + T visitPaymentProcessingFixedFee(); + + T visitPaymentProcessingPercentageFee(); + + T visitPaymentReferral(); + + T visitPaymentReferralReversal(); + + T visitPaymentRefund(); + + T visitPaymentRefundReversal(); + + T visitPaymentRevshare(); + + T visitPaymentRevsharePayout(); + + T visitPaymentRevshareRefund(); + + T visitPaymentRevshareReversal(); + + T visitPayoutFee(); + + T visitPlatformAffiliatePayment(); + + T visitPlatformAffiliatePaymentReversal(); + + T visitPlatformBalancePayment(); + + T visitPlatformBalancePaymentRefund(); + + T visitPlatformBalanceTransferIncoming(); + + T visitPlatformBalanceTransferOutgoing(); + + T visitPlatformCoveredDispute(); + + T visitPromoReversal(); + + T visitReferralBonus(); + + T visitResolutionCenterRefund(); + + T visitRevsharePercentageFee(); + + T visitSalesTaxFee(); + + T visitSalesTaxRemittance(); + + T visitSalesTaxRemittanceReversal(); + + T visitSoftwareRentalRevshare(); + + T visitSoftwareRentalTransaction(); + + T visitStripeDomesticProcessingFee(); + + T visitStripeInternationalProcessingFee(); + + T visitThreeDsFixedFee(); + + T visitTopup(); + + T visitTopupFee(); + + T visitTopupReversal(); + + T visitTreasuryPayin(); + + T visitWhopProcessingFee(); + + T visitWithdrawal(); + + T visitWithdrawalClawback(); + + T visitWithdrawalClawbackReversal(); + + T visitWithdrawalReclassification(); + + T visitWithdrawalReversal(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityObject.java b/src/main/java/com/whop/api/types/LedgerActivityObject.java new file mode 100644 index 00000000..b4d65803 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityObject.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LedgerActivityObject { + public static final LedgerActivityObject LEDGER_ACTIVITY = + new LedgerActivityObject(Value.LEDGER_ACTIVITY, "ledger_activity"); + + private final Value value; + + private final String string; + + LedgerActivityObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LedgerActivityObject && this.string.equals(((LedgerActivityObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LEDGER_ACTIVITY: + return visitor.visitLedgerActivity(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LedgerActivityObject valueOf(String value) { + switch (value) { + case "ledger_activity": + return LEDGER_ACTIVITY; + default: + return new LedgerActivityObject(Value.UNKNOWN, value); + } + } + + public enum Value { + LEDGER_ACTIVITY, + + UNKNOWN + } + + public interface Visitor { + T visitLedgerActivity(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResource.java b/src/main/java/com/whop/api/types/LedgerActivityResource.java new file mode 100644 index 00000000..4a330317 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResource.java @@ -0,0 +1,187 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Map; +import java.util.Objects; + +@JsonDeserialize(using = LedgerActivityResource.Deserializer.class) +public final class LedgerActivityResource { + private final Object value; + + private final int type; + + private LedgerActivityResource(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((LedgerActivityResourceLogoUrl) this.value); + } else if (this.type == 1) { + return visitor.visit((LedgerActivityResourceName) this.value); + } else if (this.type == 2) { + return visitor.visit((LedgerActivityResourceTwo) this.value); + } else if (this.type == 3) { + return visitor.visit((LedgerActivityResourceOwner) this.value); + } else if (this.type == 4) { + return visitor.visit((LedgerActivityResourceBank) this.value); + } else if (this.type == 5) { + return visitor.visit((LedgerActivityResourceAccountReference) this.value); + } else if (this.type == 6) { + return visitor.visit((LedgerActivityResourceAuthorizedAt) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityResource && equalTo((LedgerActivityResource) other); + } + + private boolean equalTo(LedgerActivityResource other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static LedgerActivityResource of(LedgerActivityResourceLogoUrl value) { + return new LedgerActivityResource(value, 0); + } + + public static LedgerActivityResource of(LedgerActivityResourceName value) { + return new LedgerActivityResource(value, 1); + } + + public static LedgerActivityResource of(LedgerActivityResourceTwo value) { + return new LedgerActivityResource(value, 2); + } + + public static LedgerActivityResource of(LedgerActivityResourceOwner value) { + return new LedgerActivityResource(value, 3); + } + + public static LedgerActivityResource of(LedgerActivityResourceBank value) { + return new LedgerActivityResource(value, 4); + } + + public static LedgerActivityResource of(LedgerActivityResourceAccountReference value) { + return new LedgerActivityResource(value, 5); + } + + public static LedgerActivityResource of(LedgerActivityResourceAuthorizedAt value) { + return new LedgerActivityResource(value, 6); + } + + public interface Visitor { + T visit(LedgerActivityResourceLogoUrl value); + + T visit(LedgerActivityResourceName value); + + T visit(LedgerActivityResourceTwo value); + + T visit(LedgerActivityResourceOwner value); + + T visit(LedgerActivityResourceBank value); + + T visit(LedgerActivityResourceAccountReference value); + + T visit(LedgerActivityResourceAuthorizedAt value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(LedgerActivityResource.class); + } + + @java.lang.Override + public LedgerActivityResource deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Map + && ((Map) value).containsKey("id") + && ((Map) value).containsKey("object")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, LedgerActivityResourceLogoUrl.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map + && ((Map) value).containsKey("id") + && ((Map) value).containsKey("object")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, LedgerActivityResourceName.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map + && ((Map) value).containsKey("id") + && ((Map) value).containsKey("object") + && ((Map) value).containsKey("status") + && ((Map) value).containsKey("title")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, LedgerActivityResourceTwo.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map + && ((Map) value).containsKey("id") + && ((Map) value).containsKey("object")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, LedgerActivityResourceOwner.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map + && ((Map) value).containsKey("id") + && ((Map) value).containsKey("object")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, LedgerActivityResourceBank.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map + && ((Map) value).containsKey("id") + && ((Map) value).containsKey("object")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, LedgerActivityResourceAccountReference.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map + && ((Map) value).containsKey("id") + && ((Map) value).containsKey("object")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, LedgerActivityResourceAuthorizedAt.class)); + } catch (RuntimeException e) { + } + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceAccountReference.java b/src/main/java/com/whop/api/types/LedgerActivityResourceAccountReference.java new file mode 100644 index 00000000..e7859c9e --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceAccountReference.java @@ -0,0 +1,526 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivityResourceAccountReference.Builder.class) +public final class LedgerActivityResourceAccountReference { + private final Optional accountReference; + + private final Optional destinationCurrencyCode; + + private final String id; + + private final Optional institutionName; + + private final Optional nickname; + + private final LedgerActivityResourceAccountReferenceObject object; + + private final Optional provider; + + private final Map additionalProperties; + + private LedgerActivityResourceAccountReference( + Optional accountReference, + Optional destinationCurrencyCode, + String id, + Optional institutionName, + Optional nickname, + LedgerActivityResourceAccountReferenceObject object, + Optional provider, + Map additionalProperties) { + this.accountReference = accountReference; + this.destinationCurrencyCode = destinationCurrencyCode; + this.id = id; + this.institutionName = institutionName; + this.nickname = nickname; + this.object = object; + this.provider = provider; + this.additionalProperties = additionalProperties; + } + + /** + * @return Masked account reference. + */ + @JsonIgnore + public Optional getAccountReference() { + if (accountReference == null) { + return Optional.empty(); + } + return accountReference; + } + + /** + * @return Destination currency code. + */ + @JsonIgnore + public Optional getDestinationCurrencyCode() { + if (destinationCurrencyCode == null) { + return Optional.empty(); + } + return destinationCurrencyCode; + } + + /** + * @return Payout method ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Payout institution name. + */ + @JsonIgnore + public Optional getInstitutionName() { + if (institutionName == null) { + return Optional.empty(); + } + return institutionName; + } + + /** + * @return Payout method nickname. + */ + @JsonIgnore + public Optional getNickname() { + if (nickname == null) { + return Optional.empty(); + } + return nickname; + } + + @JsonProperty("object") + public LedgerActivityResourceAccountReferenceObject getObject() { + return object; + } + + /** + * @return Payout provider. + */ + @JsonIgnore + public Optional getProvider() { + if (provider == null) { + return Optional.empty(); + } + return provider; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_reference") + private Optional _getAccountReference() { + return accountReference; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination_currency_code") + private Optional _getDestinationCurrencyCode() { + return destinationCurrencyCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("institution_name") + private Optional _getInstitutionName() { + return institutionName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("nickname") + private Optional _getNickname() { + return nickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("provider") + private Optional _getProvider() { + return provider; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityResourceAccountReference + && equalTo((LedgerActivityResourceAccountReference) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivityResourceAccountReference other) { + return accountReference.equals(other.accountReference) + && destinationCurrencyCode.equals(other.destinationCurrencyCode) + && id.equals(other.id) + && institutionName.equals(other.institutionName) + && nickname.equals(other.nickname) + && object.equals(other.object) + && provider.equals(other.provider); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountReference, + this.destinationCurrencyCode, + this.id, + this.institutionName, + this.nickname, + this.object, + this.provider); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Payout method ID.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(LedgerActivityResourceAccountReference other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull LedgerActivityResourceAccountReferenceObject object); + } + + public interface _FinalStage { + LedgerActivityResourceAccountReference build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Masked account reference.

+ */ + _FinalStage accountReference(Optional accountReference); + + _FinalStage accountReference(String accountReference); + + _FinalStage accountReference(Nullable accountReference); + + /** + *

Destination currency code.

+ */ + _FinalStage destinationCurrencyCode(Optional destinationCurrencyCode); + + _FinalStage destinationCurrencyCode(String destinationCurrencyCode); + + _FinalStage destinationCurrencyCode(Nullable destinationCurrencyCode); + + /** + *

Payout institution name.

+ */ + _FinalStage institutionName(Optional institutionName); + + _FinalStage institutionName(String institutionName); + + _FinalStage institutionName(Nullable institutionName); + + /** + *

Payout method nickname.

+ */ + _FinalStage nickname(Optional nickname); + + _FinalStage nickname(String nickname); + + _FinalStage nickname(Nullable nickname); + + /** + *

Payout provider.

+ */ + _FinalStage provider(Optional provider); + + _FinalStage provider(String provider); + + _FinalStage provider(Nullable provider); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private LedgerActivityResourceAccountReferenceObject object; + + private Optional provider = Optional.empty(); + + private Optional nickname = Optional.empty(); + + private Optional institutionName = Optional.empty(); + + private Optional destinationCurrencyCode = Optional.empty(); + + private Optional accountReference = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerActivityResourceAccountReference other) { + accountReference(other.getAccountReference()); + destinationCurrencyCode(other.getDestinationCurrencyCode()); + id(other.getId()); + institutionName(other.getInstitutionName()); + nickname(other.getNickname()); + object(other.getObject()); + provider(other.getProvider()); + return this; + } + + /** + *

Payout method ID.

+ *

Payout method ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull LedgerActivityResourceAccountReferenceObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Payout provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage provider(Nullable provider) { + if (provider.isNull()) { + this.provider = null; + } else if (provider.isEmpty()) { + this.provider = Optional.empty(); + } else { + this.provider = Optional.of(provider.get()); + } + return this; + } + + /** + *

Payout provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage provider(String provider) { + this.provider = Optional.ofNullable(provider); + return this; + } + + /** + *

Payout provider.

+ */ + @java.lang.Override + @JsonSetter(value = "provider", nulls = Nulls.SKIP) + public _FinalStage provider(Optional provider) { + this.provider = provider; + return this; + } + + /** + *

Payout method nickname.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(Nullable nickname) { + if (nickname.isNull()) { + this.nickname = null; + } else if (nickname.isEmpty()) { + this.nickname = Optional.empty(); + } else { + this.nickname = Optional.of(nickname.get()); + } + return this; + } + + /** + *

Payout method nickname.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(String nickname) { + this.nickname = Optional.ofNullable(nickname); + return this; + } + + /** + *

Payout method nickname.

+ */ + @java.lang.Override + @JsonSetter(value = "nickname", nulls = Nulls.SKIP) + public _FinalStage nickname(Optional nickname) { + this.nickname = nickname; + return this; + } + + /** + *

Payout institution name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage institutionName(Nullable institutionName) { + if (institutionName.isNull()) { + this.institutionName = null; + } else if (institutionName.isEmpty()) { + this.institutionName = Optional.empty(); + } else { + this.institutionName = Optional.of(institutionName.get()); + } + return this; + } + + /** + *

Payout institution name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage institutionName(String institutionName) { + this.institutionName = Optional.ofNullable(institutionName); + return this; + } + + /** + *

Payout institution name.

+ */ + @java.lang.Override + @JsonSetter(value = "institution_name", nulls = Nulls.SKIP) + public _FinalStage institutionName(Optional institutionName) { + this.institutionName = institutionName; + return this; + } + + /** + *

Destination currency code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationCurrencyCode(Nullable destinationCurrencyCode) { + if (destinationCurrencyCode.isNull()) { + this.destinationCurrencyCode = null; + } else if (destinationCurrencyCode.isEmpty()) { + this.destinationCurrencyCode = Optional.empty(); + } else { + this.destinationCurrencyCode = Optional.of(destinationCurrencyCode.get()); + } + return this; + } + + /** + *

Destination currency code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationCurrencyCode(String destinationCurrencyCode) { + this.destinationCurrencyCode = Optional.ofNullable(destinationCurrencyCode); + return this; + } + + /** + *

Destination currency code.

+ */ + @java.lang.Override + @JsonSetter(value = "destination_currency_code", nulls = Nulls.SKIP) + public _FinalStage destinationCurrencyCode(Optional destinationCurrencyCode) { + this.destinationCurrencyCode = destinationCurrencyCode; + return this; + } + + /** + *

Masked account reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountReference(Nullable accountReference) { + if (accountReference.isNull()) { + this.accountReference = null; + } else if (accountReference.isEmpty()) { + this.accountReference = Optional.empty(); + } else { + this.accountReference = Optional.of(accountReference.get()); + } + return this; + } + + /** + *

Masked account reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountReference(String accountReference) { + this.accountReference = Optional.ofNullable(accountReference); + return this; + } + + /** + *

Masked account reference.

+ */ + @java.lang.Override + @JsonSetter(value = "account_reference", nulls = Nulls.SKIP) + public _FinalStage accountReference(Optional accountReference) { + this.accountReference = accountReference; + return this; + } + + @java.lang.Override + public LedgerActivityResourceAccountReference build() { + return new LedgerActivityResourceAccountReference( + accountReference, + destinationCurrencyCode, + id, + institutionName, + nickname, + object, + provider, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceAccountReferenceObject.java b/src/main/java/com/whop/api/types/LedgerActivityResourceAccountReferenceObject.java new file mode 100644 index 00000000..43596123 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceAccountReferenceObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LedgerActivityResourceAccountReferenceObject { + public static final LedgerActivityResourceAccountReferenceObject PAYOUT_METHOD = + new LedgerActivityResourceAccountReferenceObject(Value.PAYOUT_METHOD, "payout_method"); + + private final Value value; + + private final String string; + + LedgerActivityResourceAccountReferenceObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LedgerActivityResourceAccountReferenceObject + && this.string.equals(((LedgerActivityResourceAccountReferenceObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYOUT_METHOD: + return visitor.visitPayoutMethod(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LedgerActivityResourceAccountReferenceObject valueOf(String value) { + switch (value) { + case "payout_method": + return PAYOUT_METHOD; + default: + return new LedgerActivityResourceAccountReferenceObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYOUT_METHOD, + + UNKNOWN + } + + public interface Visitor { + T visitPayoutMethod(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceAuthorizedAt.java b/src/main/java/com/whop/api/types/LedgerActivityResourceAuthorizedAt.java new file mode 100644 index 00000000..7827953e --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceAuthorizedAt.java @@ -0,0 +1,1031 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivityResourceAuthorizedAt.Builder.class) +public final class LedgerActivityResourceAuthorizedAt { + private final Optional authorizedAt; + + private final Optional cardId; + + private final Optional cashbackUsd; + + private final Optional declinedReason; + + private final String id; + + private final Optional localAmount; + + private final Optional localCurrency; + + private final Optional merchantCategory; + + private final Optional merchantIconUrl; + + private final Optional merchantName; + + private final LedgerActivityResourceAuthorizedAtObject object; + + private final Optional postedAt; + + private final Optional status; + + private final Optional usdAmount; + + private final Map additionalProperties; + + private LedgerActivityResourceAuthorizedAt( + Optional authorizedAt, + Optional cardId, + Optional cashbackUsd, + Optional declinedReason, + String id, + Optional localAmount, + Optional localCurrency, + Optional merchantCategory, + Optional merchantIconUrl, + Optional merchantName, + LedgerActivityResourceAuthorizedAtObject object, + Optional postedAt, + Optional status, + Optional usdAmount, + Map additionalProperties) { + this.authorizedAt = authorizedAt; + this.cardId = cardId; + this.cashbackUsd = cashbackUsd; + this.declinedReason = declinedReason; + this.id = id; + this.localAmount = localAmount; + this.localCurrency = localCurrency; + this.merchantCategory = merchantCategory; + this.merchantIconUrl = merchantIconUrl; + this.merchantName = merchantName; + this.object = object; + this.postedAt = postedAt; + this.status = status; + this.usdAmount = usdAmount; + this.additionalProperties = additionalProperties; + } + + /** + * @return ISO 8601 timestamp the transaction was authorized. + */ + @JsonIgnore + public Optional getAuthorizedAt() { + if (authorizedAt == null) { + return Optional.empty(); + } + return authorizedAt; + } + + /** + * @return Identifier of the card that the transaction was charged to. + */ + @JsonIgnore + public Optional getCardId() { + if (cardId == null) { + return Optional.empty(); + } + return cardId; + } + + /** + * @return Cashback earned on this transaction as a USD decimal string. Zero for declined or ineligible transactions; null when cashback has not been computed yet. + */ + @JsonIgnore + public Optional getCashbackUsd() { + if (cashbackUsd == null) { + return Optional.empty(); + } + return cashbackUsd; + } + + /** + * @return Reason the transaction was declined (when status is declined). + */ + @JsonIgnore + public Optional getDeclinedReason() { + if (declinedReason == null) { + return Optional.empty(); + } + return declinedReason; + } + + /** + * @return Card transaction ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Amount the merchant charged in their local currency, as a decimal string. Pair with local_currency. + */ + @JsonIgnore + public Optional getLocalAmount() { + if (localAmount == null) { + return Optional.empty(); + } + return localAmount; + } + + /** + * @return ISO 4217 currency code of the merchant-charged amount in local_amount. + */ + @JsonIgnore + public Optional getLocalCurrency() { + if (localCurrency == null) { + return Optional.empty(); + } + return localCurrency; + } + + /** + * @return Merchant category. + */ + @JsonIgnore + public Optional getMerchantCategory() { + if (merchantCategory == null) { + return Optional.empty(); + } + return merchantCategory; + } + + /** + * @return Merchant icon URL. + */ + @JsonIgnore + public Optional getMerchantIconUrl() { + if (merchantIconUrl == null) { + return Optional.empty(); + } + return merchantIconUrl; + } + + /** + * @return Merchant display name. + */ + @JsonIgnore + public Optional getMerchantName() { + if (merchantName == null) { + return Optional.empty(); + } + return merchantName; + } + + @JsonProperty("object") + public LedgerActivityResourceAuthorizedAtObject getObject() { + return object; + } + + /** + * @return ISO 8601 timestamp the transaction was settled by the card network. + */ + @JsonIgnore + public Optional getPostedAt() { + if (postedAt == null) { + return Optional.empty(); + } + return postedAt; + } + + /** + * @return Current card transaction status. + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The processor-settled USD amount as a decimal string. The ledger's USDT leg is posted 1:1 from this value. + */ + @JsonIgnore + public Optional getUsdAmount() { + if (usdAmount == null) { + return Optional.empty(); + } + return usdAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("authorized_at") + private Optional _getAuthorizedAt() { + return authorizedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_id") + private Optional _getCardId() { + return cardId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cashback_usd") + private Optional _getCashbackUsd() { + return cashbackUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("declined_reason") + private Optional _getDeclinedReason() { + return declinedReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("local_amount") + private Optional _getLocalAmount() { + return localAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("local_currency") + private Optional _getLocalCurrency() { + return localCurrency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("merchant_category") + private Optional _getMerchantCategory() { + return merchantCategory; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("merchant_icon_url") + private Optional _getMerchantIconUrl() { + return merchantIconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("merchant_name") + private Optional _getMerchantName() { + return merchantName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("posted_at") + private Optional _getPostedAt() { + return postedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("usd_amount") + private Optional _getUsdAmount() { + return usdAmount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityResourceAuthorizedAt + && equalTo((LedgerActivityResourceAuthorizedAt) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivityResourceAuthorizedAt other) { + return authorizedAt.equals(other.authorizedAt) + && cardId.equals(other.cardId) + && cashbackUsd.equals(other.cashbackUsd) + && declinedReason.equals(other.declinedReason) + && id.equals(other.id) + && localAmount.equals(other.localAmount) + && localCurrency.equals(other.localCurrency) + && merchantCategory.equals(other.merchantCategory) + && merchantIconUrl.equals(other.merchantIconUrl) + && merchantName.equals(other.merchantName) + && object.equals(other.object) + && postedAt.equals(other.postedAt) + && status.equals(other.status) + && usdAmount.equals(other.usdAmount); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.authorizedAt, + this.cardId, + this.cashbackUsd, + this.declinedReason, + this.id, + this.localAmount, + this.localCurrency, + this.merchantCategory, + this.merchantIconUrl, + this.merchantName, + this.object, + this.postedAt, + this.status, + this.usdAmount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Card transaction ID.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(LedgerActivityResourceAuthorizedAt other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull LedgerActivityResourceAuthorizedAtObject object); + } + + public interface _FinalStage { + LedgerActivityResourceAuthorizedAt build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

ISO 8601 timestamp the transaction was authorized.

+ */ + _FinalStage authorizedAt(Optional authorizedAt); + + _FinalStage authorizedAt(OffsetDateTime authorizedAt); + + _FinalStage authorizedAt(Nullable authorizedAt); + + /** + *

Identifier of the card that the transaction was charged to.

+ */ + _FinalStage cardId(Optional cardId); + + _FinalStage cardId(String cardId); + + _FinalStage cardId(Nullable cardId); + + /** + *

Cashback earned on this transaction as a USD decimal string. Zero for declined or ineligible transactions; null when cashback has not been computed yet.

+ */ + _FinalStage cashbackUsd(Optional cashbackUsd); + + _FinalStage cashbackUsd(String cashbackUsd); + + _FinalStage cashbackUsd(Nullable cashbackUsd); + + /** + *

Reason the transaction was declined (when status is declined).

+ */ + _FinalStage declinedReason(Optional declinedReason); + + _FinalStage declinedReason(String declinedReason); + + _FinalStage declinedReason(Nullable declinedReason); + + /** + *

Amount the merchant charged in their local currency, as a decimal string. Pair with local_currency.

+ */ + _FinalStage localAmount(Optional localAmount); + + _FinalStage localAmount(String localAmount); + + _FinalStage localAmount(Nullable localAmount); + + /** + *

ISO 4217 currency code of the merchant-charged amount in local_amount.

+ */ + _FinalStage localCurrency(Optional localCurrency); + + _FinalStage localCurrency(String localCurrency); + + _FinalStage localCurrency(Nullable localCurrency); + + /** + *

Merchant category.

+ */ + _FinalStage merchantCategory(Optional merchantCategory); + + _FinalStage merchantCategory(String merchantCategory); + + _FinalStage merchantCategory(Nullable merchantCategory); + + /** + *

Merchant icon URL.

+ */ + _FinalStage merchantIconUrl(Optional merchantIconUrl); + + _FinalStage merchantIconUrl(String merchantIconUrl); + + _FinalStage merchantIconUrl(Nullable merchantIconUrl); + + /** + *

Merchant display name.

+ */ + _FinalStage merchantName(Optional merchantName); + + _FinalStage merchantName(String merchantName); + + _FinalStage merchantName(Nullable merchantName); + + /** + *

ISO 8601 timestamp the transaction was settled by the card network.

+ */ + _FinalStage postedAt(Optional postedAt); + + _FinalStage postedAt(OffsetDateTime postedAt); + + _FinalStage postedAt(Nullable postedAt); + + /** + *

Current card transaction status.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(String status); + + _FinalStage status(Nullable status); + + /** + *

The processor-settled USD amount as a decimal string. The ledger's USDT leg is posted 1:1 from this value.

+ */ + _FinalStage usdAmount(Optional usdAmount); + + _FinalStage usdAmount(String usdAmount); + + _FinalStage usdAmount(Nullable usdAmount); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private LedgerActivityResourceAuthorizedAtObject object; + + private Optional usdAmount = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional postedAt = Optional.empty(); + + private Optional merchantName = Optional.empty(); + + private Optional merchantIconUrl = Optional.empty(); + + private Optional merchantCategory = Optional.empty(); + + private Optional localCurrency = Optional.empty(); + + private Optional localAmount = Optional.empty(); + + private Optional declinedReason = Optional.empty(); + + private Optional cashbackUsd = Optional.empty(); + + private Optional cardId = Optional.empty(); + + private Optional authorizedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerActivityResourceAuthorizedAt other) { + authorizedAt(other.getAuthorizedAt()); + cardId(other.getCardId()); + cashbackUsd(other.getCashbackUsd()); + declinedReason(other.getDeclinedReason()); + id(other.getId()); + localAmount(other.getLocalAmount()); + localCurrency(other.getLocalCurrency()); + merchantCategory(other.getMerchantCategory()); + merchantIconUrl(other.getMerchantIconUrl()); + merchantName(other.getMerchantName()); + object(other.getObject()); + postedAt(other.getPostedAt()); + status(other.getStatus()); + usdAmount(other.getUsdAmount()); + return this; + } + + /** + *

Card transaction ID.

+ *

Card transaction ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull LedgerActivityResourceAuthorizedAtObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

The processor-settled USD amount as a decimal string. The ledger's USDT leg is posted 1:1 from this value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdAmount(Nullable usdAmount) { + if (usdAmount.isNull()) { + this.usdAmount = null; + } else if (usdAmount.isEmpty()) { + this.usdAmount = Optional.empty(); + } else { + this.usdAmount = Optional.of(usdAmount.get()); + } + return this; + } + + /** + *

The processor-settled USD amount as a decimal string. The ledger's USDT leg is posted 1:1 from this value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdAmount(String usdAmount) { + this.usdAmount = Optional.ofNullable(usdAmount); + return this; + } + + /** + *

The processor-settled USD amount as a decimal string. The ledger's USDT leg is posted 1:1 from this value.

+ */ + @java.lang.Override + @JsonSetter(value = "usd_amount", nulls = Nulls.SKIP) + public _FinalStage usdAmount(Optional usdAmount) { + this.usdAmount = usdAmount; + return this; + } + + /** + *

Current card transaction status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

Current card transaction status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(String status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Current card transaction status.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

ISO 8601 timestamp the transaction was settled by the card network.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage postedAt(Nullable postedAt) { + if (postedAt.isNull()) { + this.postedAt = null; + } else if (postedAt.isEmpty()) { + this.postedAt = Optional.empty(); + } else { + this.postedAt = Optional.of(postedAt.get()); + } + return this; + } + + /** + *

ISO 8601 timestamp the transaction was settled by the card network.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage postedAt(OffsetDateTime postedAt) { + this.postedAt = Optional.ofNullable(postedAt); + return this; + } + + /** + *

ISO 8601 timestamp the transaction was settled by the card network.

+ */ + @java.lang.Override + @JsonSetter(value = "posted_at", nulls = Nulls.SKIP) + public _FinalStage postedAt(Optional postedAt) { + this.postedAt = postedAt; + return this; + } + + /** + *

Merchant display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantName(Nullable merchantName) { + if (merchantName.isNull()) { + this.merchantName = null; + } else if (merchantName.isEmpty()) { + this.merchantName = Optional.empty(); + } else { + this.merchantName = Optional.of(merchantName.get()); + } + return this; + } + + /** + *

Merchant display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantName(String merchantName) { + this.merchantName = Optional.ofNullable(merchantName); + return this; + } + + /** + *

Merchant display name.

+ */ + @java.lang.Override + @JsonSetter(value = "merchant_name", nulls = Nulls.SKIP) + public _FinalStage merchantName(Optional merchantName) { + this.merchantName = merchantName; + return this; + } + + /** + *

Merchant icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantIconUrl(Nullable merchantIconUrl) { + if (merchantIconUrl.isNull()) { + this.merchantIconUrl = null; + } else if (merchantIconUrl.isEmpty()) { + this.merchantIconUrl = Optional.empty(); + } else { + this.merchantIconUrl = Optional.of(merchantIconUrl.get()); + } + return this; + } + + /** + *

Merchant icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantIconUrl(String merchantIconUrl) { + this.merchantIconUrl = Optional.ofNullable(merchantIconUrl); + return this; + } + + /** + *

Merchant icon URL.

+ */ + @java.lang.Override + @JsonSetter(value = "merchant_icon_url", nulls = Nulls.SKIP) + public _FinalStage merchantIconUrl(Optional merchantIconUrl) { + this.merchantIconUrl = merchantIconUrl; + return this; + } + + /** + *

Merchant category.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantCategory(Nullable merchantCategory) { + if (merchantCategory.isNull()) { + this.merchantCategory = null; + } else if (merchantCategory.isEmpty()) { + this.merchantCategory = Optional.empty(); + } else { + this.merchantCategory = Optional.of(merchantCategory.get()); + } + return this; + } + + /** + *

Merchant category.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage merchantCategory(String merchantCategory) { + this.merchantCategory = Optional.ofNullable(merchantCategory); + return this; + } + + /** + *

Merchant category.

+ */ + @java.lang.Override + @JsonSetter(value = "merchant_category", nulls = Nulls.SKIP) + public _FinalStage merchantCategory(Optional merchantCategory) { + this.merchantCategory = merchantCategory; + return this; + } + + /** + *

ISO 4217 currency code of the merchant-charged amount in local_amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage localCurrency(Nullable localCurrency) { + if (localCurrency.isNull()) { + this.localCurrency = null; + } else if (localCurrency.isEmpty()) { + this.localCurrency = Optional.empty(); + } else { + this.localCurrency = Optional.of(localCurrency.get()); + } + return this; + } + + /** + *

ISO 4217 currency code of the merchant-charged amount in local_amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage localCurrency(String localCurrency) { + this.localCurrency = Optional.ofNullable(localCurrency); + return this; + } + + /** + *

ISO 4217 currency code of the merchant-charged amount in local_amount.

+ */ + @java.lang.Override + @JsonSetter(value = "local_currency", nulls = Nulls.SKIP) + public _FinalStage localCurrency(Optional localCurrency) { + this.localCurrency = localCurrency; + return this; + } + + /** + *

Amount the merchant charged in their local currency, as a decimal string. Pair with local_currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage localAmount(Nullable localAmount) { + if (localAmount.isNull()) { + this.localAmount = null; + } else if (localAmount.isEmpty()) { + this.localAmount = Optional.empty(); + } else { + this.localAmount = Optional.of(localAmount.get()); + } + return this; + } + + /** + *

Amount the merchant charged in their local currency, as a decimal string. Pair with local_currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage localAmount(String localAmount) { + this.localAmount = Optional.ofNullable(localAmount); + return this; + } + + /** + *

Amount the merchant charged in their local currency, as a decimal string. Pair with local_currency.

+ */ + @java.lang.Override + @JsonSetter(value = "local_amount", nulls = Nulls.SKIP) + public _FinalStage localAmount(Optional localAmount) { + this.localAmount = localAmount; + return this; + } + + /** + *

Reason the transaction was declined (when status is declined).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage declinedReason(Nullable declinedReason) { + if (declinedReason.isNull()) { + this.declinedReason = null; + } else if (declinedReason.isEmpty()) { + this.declinedReason = Optional.empty(); + } else { + this.declinedReason = Optional.of(declinedReason.get()); + } + return this; + } + + /** + *

Reason the transaction was declined (when status is declined).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage declinedReason(String declinedReason) { + this.declinedReason = Optional.ofNullable(declinedReason); + return this; + } + + /** + *

Reason the transaction was declined (when status is declined).

+ */ + @java.lang.Override + @JsonSetter(value = "declined_reason", nulls = Nulls.SKIP) + public _FinalStage declinedReason(Optional declinedReason) { + this.declinedReason = declinedReason; + return this; + } + + /** + *

Cashback earned on this transaction as a USD decimal string. Zero for declined or ineligible transactions; null when cashback has not been computed yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cashbackUsd(Nullable cashbackUsd) { + if (cashbackUsd.isNull()) { + this.cashbackUsd = null; + } else if (cashbackUsd.isEmpty()) { + this.cashbackUsd = Optional.empty(); + } else { + this.cashbackUsd = Optional.of(cashbackUsd.get()); + } + return this; + } + + /** + *

Cashback earned on this transaction as a USD decimal string. Zero for declined or ineligible transactions; null when cashback has not been computed yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cashbackUsd(String cashbackUsd) { + this.cashbackUsd = Optional.ofNullable(cashbackUsd); + return this; + } + + /** + *

Cashback earned on this transaction as a USD decimal string. Zero for declined or ineligible transactions; null when cashback has not been computed yet.

+ */ + @java.lang.Override + @JsonSetter(value = "cashback_usd", nulls = Nulls.SKIP) + public _FinalStage cashbackUsd(Optional cashbackUsd) { + this.cashbackUsd = cashbackUsd; + return this; + } + + /** + *

Identifier of the card that the transaction was charged to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardId(Nullable cardId) { + if (cardId.isNull()) { + this.cardId = null; + } else if (cardId.isEmpty()) { + this.cardId = Optional.empty(); + } else { + this.cardId = Optional.of(cardId.get()); + } + return this; + } + + /** + *

Identifier of the card that the transaction was charged to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardId(String cardId) { + this.cardId = Optional.ofNullable(cardId); + return this; + } + + /** + *

Identifier of the card that the transaction was charged to.

+ */ + @java.lang.Override + @JsonSetter(value = "card_id", nulls = Nulls.SKIP) + public _FinalStage cardId(Optional cardId) { + this.cardId = cardId; + return this; + } + + /** + *

ISO 8601 timestamp the transaction was authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage authorizedAt(Nullable authorizedAt) { + if (authorizedAt.isNull()) { + this.authorizedAt = null; + } else if (authorizedAt.isEmpty()) { + this.authorizedAt = Optional.empty(); + } else { + this.authorizedAt = Optional.of(authorizedAt.get()); + } + return this; + } + + /** + *

ISO 8601 timestamp the transaction was authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage authorizedAt(OffsetDateTime authorizedAt) { + this.authorizedAt = Optional.ofNullable(authorizedAt); + return this; + } + + /** + *

ISO 8601 timestamp the transaction was authorized.

+ */ + @java.lang.Override + @JsonSetter(value = "authorized_at", nulls = Nulls.SKIP) + public _FinalStage authorizedAt(Optional authorizedAt) { + this.authorizedAt = authorizedAt; + return this; + } + + @java.lang.Override + public LedgerActivityResourceAuthorizedAt build() { + return new LedgerActivityResourceAuthorizedAt( + authorizedAt, + cardId, + cashbackUsd, + declinedReason, + id, + localAmount, + localCurrency, + merchantCategory, + merchantIconUrl, + merchantName, + object, + postedAt, + status, + usdAmount, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceAuthorizedAtObject.java b/src/main/java/com/whop/api/types/LedgerActivityResourceAuthorizedAtObject.java new file mode 100644 index 00000000..234502e1 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceAuthorizedAtObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LedgerActivityResourceAuthorizedAtObject { + public static final LedgerActivityResourceAuthorizedAtObject CARD_TRANSACTION = + new LedgerActivityResourceAuthorizedAtObject(Value.CARD_TRANSACTION, "card_transaction"); + + private final Value value; + + private final String string; + + LedgerActivityResourceAuthorizedAtObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LedgerActivityResourceAuthorizedAtObject + && this.string.equals(((LedgerActivityResourceAuthorizedAtObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CARD_TRANSACTION: + return visitor.visitCardTransaction(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LedgerActivityResourceAuthorizedAtObject valueOf(String value) { + switch (value) { + case "card_transaction": + return CARD_TRANSACTION; + default: + return new LedgerActivityResourceAuthorizedAtObject(Value.UNKNOWN, value); + } + } + + public enum Value { + CARD_TRANSACTION, + + UNKNOWN + } + + public interface Visitor { + T visitCardTransaction(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceBank.java b/src/main/java/com/whop/api/types/LedgerActivityResourceBank.java new file mode 100644 index 00000000..2f8a2ccb --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceBank.java @@ -0,0 +1,484 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivityResourceBank.Builder.class) +public final class LedgerActivityResourceBank { + private final Optional bank; + + private final Optional card; + + private final Optional emailIdentifier; + + private final Optional gatewayType; + + private final String id; + + private final LedgerActivityResourceBankObject object; + + private final Optional paymentMethodType; + + private final Map additionalProperties; + + private LedgerActivityResourceBank( + Optional bank, + Optional card, + Optional emailIdentifier, + Optional gatewayType, + String id, + LedgerActivityResourceBankObject object, + Optional paymentMethodType, + Map additionalProperties) { + this.bank = bank; + this.card = card; + this.emailIdentifier = emailIdentifier; + this.gatewayType = gatewayType; + this.id = id; + this.object = object; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getBank() { + if (bank == null) { + return Optional.empty(); + } + return bank; + } + + @JsonIgnore + public Optional getCard() { + if (card == null) { + return Optional.empty(); + } + return card; + } + + /** + * @return Email identifier for email-based payment methods. + */ + @JsonIgnore + public Optional getEmailIdentifier() { + if (emailIdentifier == null) { + return Optional.empty(); + } + return emailIdentifier; + } + + /** + * @return Payment gateway type. + */ + @JsonIgnore + public Optional getGatewayType() { + if (gatewayType == null) { + return Optional.empty(); + } + return gatewayType; + } + + /** + * @return Payment method ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("object") + public LedgerActivityResourceBankObject getObject() { + return object; + } + + /** + * @return Payment method type. + */ + @JsonIgnore + public Optional getPaymentMethodType() { + if (paymentMethodType == null) { + return Optional.empty(); + } + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bank") + private Optional _getBank() { + return bank; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card") + private Optional _getCard() { + return card; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email_identifier") + private Optional _getEmailIdentifier() { + return emailIdentifier; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("gateway_type") + private Optional _getGatewayType() { + return gatewayType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_type") + private Optional _getPaymentMethodType() { + return paymentMethodType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityResourceBank && equalTo((LedgerActivityResourceBank) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivityResourceBank other) { + return bank.equals(other.bank) + && card.equals(other.card) + && emailIdentifier.equals(other.emailIdentifier) + && gatewayType.equals(other.gatewayType) + && id.equals(other.id) + && object.equals(other.object) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bank, + this.card, + this.emailIdentifier, + this.gatewayType, + this.id, + this.object, + this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Payment method ID.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(LedgerActivityResourceBank other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull LedgerActivityResourceBankObject object); + } + + public interface _FinalStage { + LedgerActivityResourceBank build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage bank(Optional bank); + + _FinalStage bank(LedgerActivityResourceBankBank bank); + + _FinalStage bank(Nullable bank); + + _FinalStage card(Optional card); + + _FinalStage card(LedgerActivityResourceBankCard card); + + _FinalStage card(Nullable card); + + /** + *

Email identifier for email-based payment methods.

+ */ + _FinalStage emailIdentifier(Optional emailIdentifier); + + _FinalStage emailIdentifier(String emailIdentifier); + + _FinalStage emailIdentifier(Nullable emailIdentifier); + + /** + *

Payment gateway type.

+ */ + _FinalStage gatewayType(Optional gatewayType); + + _FinalStage gatewayType(String gatewayType); + + _FinalStage gatewayType(Nullable gatewayType); + + /** + *

Payment method type.

+ */ + _FinalStage paymentMethodType(Optional paymentMethodType); + + _FinalStage paymentMethodType(String paymentMethodType); + + _FinalStage paymentMethodType(Nullable paymentMethodType); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private LedgerActivityResourceBankObject object; + + private Optional paymentMethodType = Optional.empty(); + + private Optional gatewayType = Optional.empty(); + + private Optional emailIdentifier = Optional.empty(); + + private Optional card = Optional.empty(); + + private Optional bank = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerActivityResourceBank other) { + bank(other.getBank()); + card(other.getCard()); + emailIdentifier(other.getEmailIdentifier()); + gatewayType(other.getGatewayType()); + id(other.getId()); + object(other.getObject()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

Payment method ID.

+ *

Payment method ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull LedgerActivityResourceBankObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Payment method type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(Nullable paymentMethodType) { + if (paymentMethodType.isNull()) { + this.paymentMethodType = null; + } else if (paymentMethodType.isEmpty()) { + this.paymentMethodType = Optional.empty(); + } else { + this.paymentMethodType = Optional.of(paymentMethodType.get()); + } + return this; + } + + /** + *

Payment method type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(String paymentMethodType) { + this.paymentMethodType = Optional.ofNullable(paymentMethodType); + return this; + } + + /** + *

Payment method type.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_type", nulls = Nulls.SKIP) + public _FinalStage paymentMethodType(Optional paymentMethodType) { + this.paymentMethodType = paymentMethodType; + return this; + } + + /** + *

Payment gateway type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage gatewayType(Nullable gatewayType) { + if (gatewayType.isNull()) { + this.gatewayType = null; + } else if (gatewayType.isEmpty()) { + this.gatewayType = Optional.empty(); + } else { + this.gatewayType = Optional.of(gatewayType.get()); + } + return this; + } + + /** + *

Payment gateway type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage gatewayType(String gatewayType) { + this.gatewayType = Optional.ofNullable(gatewayType); + return this; + } + + /** + *

Payment gateway type.

+ */ + @java.lang.Override + @JsonSetter(value = "gateway_type", nulls = Nulls.SKIP) + public _FinalStage gatewayType(Optional gatewayType) { + this.gatewayType = gatewayType; + return this; + } + + /** + *

Email identifier for email-based payment methods.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emailIdentifier(Nullable emailIdentifier) { + if (emailIdentifier.isNull()) { + this.emailIdentifier = null; + } else if (emailIdentifier.isEmpty()) { + this.emailIdentifier = Optional.empty(); + } else { + this.emailIdentifier = Optional.of(emailIdentifier.get()); + } + return this; + } + + /** + *

Email identifier for email-based payment methods.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emailIdentifier(String emailIdentifier) { + this.emailIdentifier = Optional.ofNullable(emailIdentifier); + return this; + } + + /** + *

Email identifier for email-based payment methods.

+ */ + @java.lang.Override + @JsonSetter(value = "email_identifier", nulls = Nulls.SKIP) + public _FinalStage emailIdentifier(Optional emailIdentifier) { + this.emailIdentifier = emailIdentifier; + return this; + } + + @java.lang.Override + public _FinalStage card(Nullable card) { + if (card.isNull()) { + this.card = null; + } else if (card.isEmpty()) { + this.card = Optional.empty(); + } else { + this.card = Optional.of(card.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage card(LedgerActivityResourceBankCard card) { + this.card = Optional.ofNullable(card); + return this; + } + + @java.lang.Override + @JsonSetter(value = "card", nulls = Nulls.SKIP) + public _FinalStage card(Optional card) { + this.card = card; + return this; + } + + @java.lang.Override + public _FinalStage bank(Nullable bank) { + if (bank.isNull()) { + this.bank = null; + } else if (bank.isEmpty()) { + this.bank = Optional.empty(); + } else { + this.bank = Optional.of(bank.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage bank(LedgerActivityResourceBankBank bank) { + this.bank = Optional.ofNullable(bank); + return this; + } + + @java.lang.Override + @JsonSetter(value = "bank", nulls = Nulls.SKIP) + public _FinalStage bank(Optional bank) { + this.bank = bank; + return this; + } + + @java.lang.Override + public LedgerActivityResourceBank build() { + return new LedgerActivityResourceBank( + bank, card, emailIdentifier, gatewayType, id, object, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceBankBank.java b/src/main/java/com/whop/api/types/LedgerActivityResourceBankBank.java new file mode 100644 index 00000000..b87ac795 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceBankBank.java @@ -0,0 +1,286 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivityResourceBankBank.Builder.class) +public final class LedgerActivityResourceBankBank { + private final Optional accountName; + + private final Optional accountType; + + private final Optional bankName; + + private final Optional last4; + + private final Map additionalProperties; + + private LedgerActivityResourceBankBank( + Optional accountName, + Optional accountType, + Optional bankName, + Optional last4, + Map additionalProperties) { + this.accountName = accountName; + this.accountType = accountType; + this.bankName = bankName; + this.last4 = last4; + this.additionalProperties = additionalProperties; + } + + /** + * @return Bank account holder name. + */ + @JsonIgnore + public Optional getAccountName() { + if (accountName == null) { + return Optional.empty(); + } + return accountName; + } + + /** + * @return Bank account type. + */ + @JsonIgnore + public Optional getAccountType() { + if (accountType == null) { + return Optional.empty(); + } + return accountType; + } + + /** + * @return Bank name. + */ + @JsonIgnore + public Optional getBankName() { + if (bankName == null) { + return Optional.empty(); + } + return bankName; + } + + /** + * @return Last four digits of the bank account. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_name") + private Optional _getAccountName() { + return accountName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_type") + private Optional _getAccountType() { + return accountType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bank_name") + private Optional _getBankName() { + return bankName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityResourceBankBank && equalTo((LedgerActivityResourceBankBank) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivityResourceBankBank other) { + return accountName.equals(other.accountName) + && accountType.equals(other.accountType) + && bankName.equals(other.bankName) + && last4.equals(other.last4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountName, this.accountType, this.bankName, this.last4); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountName = Optional.empty(); + + private Optional accountType = Optional.empty(); + + private Optional bankName = Optional.empty(); + + private Optional last4 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(LedgerActivityResourceBankBank other) { + accountName(other.getAccountName()); + accountType(other.getAccountType()); + bankName(other.getBankName()); + last4(other.getLast4()); + return this; + } + + /** + *

Bank account holder name.

+ */ + @JsonSetter(value = "account_name", nulls = Nulls.SKIP) + public Builder accountName(Optional accountName) { + this.accountName = accountName; + return this; + } + + public Builder accountName(String accountName) { + this.accountName = Optional.ofNullable(accountName); + return this; + } + + public Builder accountName(Nullable accountName) { + if (accountName.isNull()) { + this.accountName = null; + } else if (accountName.isEmpty()) { + this.accountName = Optional.empty(); + } else { + this.accountName = Optional.of(accountName.get()); + } + return this; + } + + /** + *

Bank account type.

+ */ + @JsonSetter(value = "account_type", nulls = Nulls.SKIP) + public Builder accountType(Optional accountType) { + this.accountType = accountType; + return this; + } + + public Builder accountType(String accountType) { + this.accountType = Optional.ofNullable(accountType); + return this; + } + + public Builder accountType(Nullable accountType) { + if (accountType.isNull()) { + this.accountType = null; + } else if (accountType.isEmpty()) { + this.accountType = Optional.empty(); + } else { + this.accountType = Optional.of(accountType.get()); + } + return this; + } + + /** + *

Bank name.

+ */ + @JsonSetter(value = "bank_name", nulls = Nulls.SKIP) + public Builder bankName(Optional bankName) { + this.bankName = bankName; + return this; + } + + public Builder bankName(String bankName) { + this.bankName = Optional.ofNullable(bankName); + return this; + } + + public Builder bankName(Nullable bankName) { + if (bankName.isNull()) { + this.bankName = null; + } else if (bankName.isEmpty()) { + this.bankName = Optional.empty(); + } else { + this.bankName = Optional.of(bankName.get()); + } + return this; + } + + /** + *

Last four digits of the bank account.

+ */ + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public Builder last4(Optional last4) { + this.last4 = last4; + return this; + } + + public Builder last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + public Builder last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + public LedgerActivityResourceBankBank build() { + return new LedgerActivityResourceBankBank(accountName, accountType, bankName, last4, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceBankCard.java b/src/main/java/com/whop/api/types/LedgerActivityResourceBankCard.java new file mode 100644 index 00000000..bf747d19 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceBankCard.java @@ -0,0 +1,286 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivityResourceBankCard.Builder.class) +public final class LedgerActivityResourceBankCard { + private final Optional brand; + + private final Optional expMonth; + + private final Optional expYear; + + private final Optional last4; + + private final Map additionalProperties; + + private LedgerActivityResourceBankCard( + Optional brand, + Optional expMonth, + Optional expYear, + Optional last4, + Map additionalProperties) { + this.brand = brand; + this.expMonth = expMonth; + this.expYear = expYear; + this.last4 = last4; + this.additionalProperties = additionalProperties; + } + + /** + * @return Card brand. + */ + @JsonIgnore + public Optional getBrand() { + if (brand == null) { + return Optional.empty(); + } + return brand; + } + + /** + * @return Card expiration month. + */ + @JsonIgnore + public Optional getExpMonth() { + if (expMonth == null) { + return Optional.empty(); + } + return expMonth; + } + + /** + * @return Card expiration year. + */ + @JsonIgnore + public Optional getExpYear() { + if (expYear == null) { + return Optional.empty(); + } + return expYear; + } + + /** + * @return Last four digits of the card. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("brand") + private Optional _getBrand() { + return brand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_month") + private Optional _getExpMonth() { + return expMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_year") + private Optional _getExpYear() { + return expYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityResourceBankCard && equalTo((LedgerActivityResourceBankCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivityResourceBankCard other) { + return brand.equals(other.brand) + && expMonth.equals(other.expMonth) + && expYear.equals(other.expYear) + && last4.equals(other.last4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.brand, this.expMonth, this.expYear, this.last4); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional brand = Optional.empty(); + + private Optional expMonth = Optional.empty(); + + private Optional expYear = Optional.empty(); + + private Optional last4 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(LedgerActivityResourceBankCard other) { + brand(other.getBrand()); + expMonth(other.getExpMonth()); + expYear(other.getExpYear()); + last4(other.getLast4()); + return this; + } + + /** + *

Card brand.

+ */ + @JsonSetter(value = "brand", nulls = Nulls.SKIP) + public Builder brand(Optional brand) { + this.brand = brand; + return this; + } + + public Builder brand(String brand) { + this.brand = Optional.ofNullable(brand); + return this; + } + + public Builder brand(Nullable brand) { + if (brand.isNull()) { + this.brand = null; + } else if (brand.isEmpty()) { + this.brand = Optional.empty(); + } else { + this.brand = Optional.of(brand.get()); + } + return this; + } + + /** + *

Card expiration month.

+ */ + @JsonSetter(value = "exp_month", nulls = Nulls.SKIP) + public Builder expMonth(Optional expMonth) { + this.expMonth = expMonth; + return this; + } + + public Builder expMonth(Integer expMonth) { + this.expMonth = Optional.ofNullable(expMonth); + return this; + } + + public Builder expMonth(Nullable expMonth) { + if (expMonth.isNull()) { + this.expMonth = null; + } else if (expMonth.isEmpty()) { + this.expMonth = Optional.empty(); + } else { + this.expMonth = Optional.of(expMonth.get()); + } + return this; + } + + /** + *

Card expiration year.

+ */ + @JsonSetter(value = "exp_year", nulls = Nulls.SKIP) + public Builder expYear(Optional expYear) { + this.expYear = expYear; + return this; + } + + public Builder expYear(Integer expYear) { + this.expYear = Optional.ofNullable(expYear); + return this; + } + + public Builder expYear(Nullable expYear) { + if (expYear.isNull()) { + this.expYear = null; + } else if (expYear.isEmpty()) { + this.expYear = Optional.empty(); + } else { + this.expYear = Optional.of(expYear.get()); + } + return this; + } + + /** + *

Last four digits of the card.

+ */ + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public Builder last4(Optional last4) { + this.last4 = last4; + return this; + } + + public Builder last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + public Builder last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + public LedgerActivityResourceBankCard build() { + return new LedgerActivityResourceBankCard(brand, expMonth, expYear, last4, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceBankObject.java b/src/main/java/com/whop/api/types/LedgerActivityResourceBankObject.java new file mode 100644 index 00000000..bf2ea019 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceBankObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LedgerActivityResourceBankObject { + public static final LedgerActivityResourceBankObject PAYMENT_METHOD = + new LedgerActivityResourceBankObject(Value.PAYMENT_METHOD, "payment_method"); + + private final Value value; + + private final String string; + + LedgerActivityResourceBankObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LedgerActivityResourceBankObject + && this.string.equals(((LedgerActivityResourceBankObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYMENT_METHOD: + return visitor.visitPaymentMethod(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LedgerActivityResourceBankObject valueOf(String value) { + switch (value) { + case "payment_method": + return PAYMENT_METHOD; + default: + return new LedgerActivityResourceBankObject(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYMENT_METHOD, + + UNKNOWN + } + + public interface Visitor { + T visitPaymentMethod(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceLogoUrl.java b/src/main/java/com/whop/api/types/LedgerActivityResourceLogoUrl.java new file mode 100644 index 00000000..61c1add4 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceLogoUrl.java @@ -0,0 +1,370 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivityResourceLogoUrl.Builder.class) +public final class LedgerActivityResourceLogoUrl { + private final String id; + + private final Optional logoUrl; + + private final LedgerActivityResourceLogoUrlObject object; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private LedgerActivityResourceLogoUrl( + String id, + Optional logoUrl, + LedgerActivityResourceLogoUrlObject object, + Optional route, + Optional title, + Map additionalProperties) { + this.id = id; + this.logoUrl = logoUrl; + this.object = object; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account logo URL. + */ + @JsonIgnore + public Optional getLogoUrl() { + if (logoUrl == null) { + return Optional.empty(); + } + return logoUrl; + } + + @JsonProperty("object") + public LedgerActivityResourceLogoUrlObject getObject() { + return object; + } + + /** + * @return Account route. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Account display name. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo_url") + private Optional _getLogoUrl() { + return logoUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityResourceLogoUrl && equalTo((LedgerActivityResourceLogoUrl) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivityResourceLogoUrl other) { + return id.equals(other.id) + && logoUrl.equals(other.logoUrl) + && object.equals(other.object) + && route.equals(other.route) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.logoUrl, this.object, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(LedgerActivityResourceLogoUrl other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull LedgerActivityResourceLogoUrlObject object); + } + + public interface _FinalStage { + LedgerActivityResourceLogoUrl build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account logo URL.

+ */ + _FinalStage logoUrl(Optional logoUrl); + + _FinalStage logoUrl(String logoUrl); + + _FinalStage logoUrl(Nullable logoUrl); + + /** + *

Account route.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

Account display name.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private LedgerActivityResourceLogoUrlObject object; + + private Optional title = Optional.empty(); + + private Optional route = Optional.empty(); + + private Optional logoUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerActivityResourceLogoUrl other) { + id(other.getId()); + logoUrl(other.getLogoUrl()); + object(other.getObject()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID.

+ *

Account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull LedgerActivityResourceLogoUrlObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Account display name.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Account route.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + /** + *

Account logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(Nullable logoUrl) { + if (logoUrl.isNull()) { + this.logoUrl = null; + } else if (logoUrl.isEmpty()) { + this.logoUrl = Optional.empty(); + } else { + this.logoUrl = Optional.of(logoUrl.get()); + } + return this; + } + + /** + *

Account logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(String logoUrl) { + this.logoUrl = Optional.ofNullable(logoUrl); + return this; + } + + /** + *

Account logo URL.

+ */ + @java.lang.Override + @JsonSetter(value = "logo_url", nulls = Nulls.SKIP) + public _FinalStage logoUrl(Optional logoUrl) { + this.logoUrl = logoUrl; + return this; + } + + @java.lang.Override + public LedgerActivityResourceLogoUrl build() { + return new LedgerActivityResourceLogoUrl(id, logoUrl, object, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceLogoUrlObject.java b/src/main/java/com/whop/api/types/LedgerActivityResourceLogoUrlObject.java new file mode 100644 index 00000000..5d7de72d --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceLogoUrlObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LedgerActivityResourceLogoUrlObject { + public static final LedgerActivityResourceLogoUrlObject ACCOUNT = + new LedgerActivityResourceLogoUrlObject(Value.ACCOUNT, "account"); + + private final Value value; + + private final String string; + + LedgerActivityResourceLogoUrlObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LedgerActivityResourceLogoUrlObject + && this.string.equals(((LedgerActivityResourceLogoUrlObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ACCOUNT: + return visitor.visitAccount(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LedgerActivityResourceLogoUrlObject valueOf(String value) { + switch (value) { + case "account": + return ACCOUNT; + default: + return new LedgerActivityResourceLogoUrlObject(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT, + + UNKNOWN + } + + public interface Visitor { + T visitAccount(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceName.java b/src/main/java/com/whop/api/types/LedgerActivityResourceName.java new file mode 100644 index 00000000..9543b62a --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceName.java @@ -0,0 +1,370 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivityResourceName.Builder.class) +public final class LedgerActivityResourceName { + private final String id; + + private final Optional name; + + private final LedgerActivityResourceNameObject object; + + private final Optional profilePictureUrl; + + private final Optional username; + + private final Map additionalProperties; + + private LedgerActivityResourceName( + String id, + Optional name, + LedgerActivityResourceNameObject object, + Optional profilePictureUrl, + Optional username, + Map additionalProperties) { + this.id = id; + this.name = name; + this.object = object; + this.profilePictureUrl = profilePictureUrl; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("object") + public LedgerActivityResourceNameObject getObject() { + return object; + } + + /** + * @return User profile image URL. + */ + @JsonIgnore + public Optional getProfilePictureUrl() { + if (profilePictureUrl == null) { + return Optional.empty(); + } + return profilePictureUrl; + } + + /** + * @return User's username. + */ + @JsonIgnore + public Optional getUsername() { + if (username == null) { + return Optional.empty(); + } + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("profile_picture_url") + private Optional _getProfilePictureUrl() { + return profilePictureUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("username") + private Optional _getUsername() { + return username; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityResourceName && equalTo((LedgerActivityResourceName) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivityResourceName other) { + return id.equals(other.id) + && name.equals(other.name) + && object.equals(other.object) + && profilePictureUrl.equals(other.profilePictureUrl) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.object, this.profilePictureUrl, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(LedgerActivityResourceName other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull LedgerActivityResourceNameObject object); + } + + public interface _FinalStage { + LedgerActivityResourceName build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

User profile image URL.

+ */ + _FinalStage profilePictureUrl(Optional profilePictureUrl); + + _FinalStage profilePictureUrl(String profilePictureUrl); + + _FinalStage profilePictureUrl(Nullable profilePictureUrl); + + /** + *

User's username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + + _FinalStage username(Nullable username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private LedgerActivityResourceNameObject object; + + private Optional username = Optional.empty(); + + private Optional profilePictureUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerActivityResourceName other) { + id(other.getId()); + name(other.getName()); + object(other.getObject()); + profilePictureUrl(other.getProfilePictureUrl()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull LedgerActivityResourceNameObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(Nullable username) { + if (username.isNull()) { + this.username = null; + } else if (username.isEmpty()) { + this.username = Optional.empty(); + } else { + this.username = Optional.of(username.get()); + } + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

User's username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

User profile image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profilePictureUrl(Nullable profilePictureUrl) { + if (profilePictureUrl.isNull()) { + this.profilePictureUrl = null; + } else if (profilePictureUrl.isEmpty()) { + this.profilePictureUrl = Optional.empty(); + } else { + this.profilePictureUrl = Optional.of(profilePictureUrl.get()); + } + return this; + } + + /** + *

User profile image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profilePictureUrl(String profilePictureUrl) { + this.profilePictureUrl = Optional.ofNullable(profilePictureUrl); + return this; + } + + /** + *

User profile image URL.

+ */ + @java.lang.Override + @JsonSetter(value = "profile_picture_url", nulls = Nulls.SKIP) + public _FinalStage profilePictureUrl(Optional profilePictureUrl) { + this.profilePictureUrl = profilePictureUrl; + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public LedgerActivityResourceName build() { + return new LedgerActivityResourceName(id, name, object, profilePictureUrl, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceNameObject.java b/src/main/java/com/whop/api/types/LedgerActivityResourceNameObject.java new file mode 100644 index 00000000..b8f8fa39 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceNameObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LedgerActivityResourceNameObject { + public static final LedgerActivityResourceNameObject USER = + new LedgerActivityResourceNameObject(Value.USER, "user"); + + private final Value value; + + private final String string; + + LedgerActivityResourceNameObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LedgerActivityResourceNameObject + && this.string.equals(((LedgerActivityResourceNameObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case USER: + return visitor.visitUser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LedgerActivityResourceNameObject valueOf(String value) { + switch (value) { + case "user": + return USER; + default: + return new LedgerActivityResourceNameObject(Value.UNKNOWN, value); + } + } + + public enum Value { + USER, + + UNKNOWN + } + + public interface Visitor { + T visitUser(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceOwner.java b/src/main/java/com/whop/api/types/LedgerActivityResourceOwner.java new file mode 100644 index 00000000..e4de1cbd --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceOwner.java @@ -0,0 +1,211 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivityResourceOwner.Builder.class) +public final class LedgerActivityResourceOwner { + private final String id; + + private final LedgerActivityResourceOwnerObject object; + + private final Optional owner; + + private final Map additionalProperties; + + private LedgerActivityResourceOwner( + String id, + LedgerActivityResourceOwnerObject object, + Optional owner, + Map additionalProperties) { + this.id = id; + this.object = object; + this.owner = owner; + this.additionalProperties = additionalProperties; + } + + /** + * @return Ledger account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("object") + public LedgerActivityResourceOwnerObject getObject() { + return object; + } + + @JsonIgnore + public Optional getOwner() { + if (owner == null) { + return Optional.empty(); + } + return owner; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("owner") + private Optional _getOwner() { + return owner; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityResourceOwner && equalTo((LedgerActivityResourceOwner) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivityResourceOwner other) { + return id.equals(other.id) && object.equals(other.object) && owner.equals(other.owner); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.object, this.owner); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Ledger account ID.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(LedgerActivityResourceOwner other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull LedgerActivityResourceOwnerObject object); + } + + public interface _FinalStage { + LedgerActivityResourceOwner build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage owner(Optional owner); + + _FinalStage owner(LedgerActivityResourceOwnerOwner owner); + + _FinalStage owner(Nullable owner); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private LedgerActivityResourceOwnerObject object; + + private Optional owner = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerActivityResourceOwner other) { + id(other.getId()); + object(other.getObject()); + owner(other.getOwner()); + return this; + } + + /** + *

Ledger account ID.

+ *

Ledger account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull LedgerActivityResourceOwnerObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage owner(Nullable owner) { + if (owner.isNull()) { + this.owner = null; + } else if (owner.isEmpty()) { + this.owner = Optional.empty(); + } else { + this.owner = Optional.of(owner.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage owner(LedgerActivityResourceOwnerOwner owner) { + this.owner = Optional.ofNullable(owner); + return this; + } + + @java.lang.Override + @JsonSetter(value = "owner", nulls = Nulls.SKIP) + public _FinalStage owner(Optional owner) { + this.owner = owner; + return this; + } + + @java.lang.Override + public LedgerActivityResourceOwner build() { + return new LedgerActivityResourceOwner(id, object, owner, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerObject.java b/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerObject.java new file mode 100644 index 00000000..d25ae710 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LedgerActivityResourceOwnerObject { + public static final LedgerActivityResourceOwnerObject LEDGER_ACCOUNT = + new LedgerActivityResourceOwnerObject(Value.LEDGER_ACCOUNT, "ledger_account"); + + private final Value value; + + private final String string; + + LedgerActivityResourceOwnerObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LedgerActivityResourceOwnerObject + && this.string.equals(((LedgerActivityResourceOwnerObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LEDGER_ACCOUNT: + return visitor.visitLedgerAccount(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LedgerActivityResourceOwnerObject valueOf(String value) { + switch (value) { + case "ledger_account": + return LEDGER_ACCOUNT; + default: + return new LedgerActivityResourceOwnerObject(Value.UNKNOWN, value); + } + } + + public enum Value { + LEDGER_ACCOUNT, + + UNKNOWN + } + + public interface Visitor { + T visitLedgerAccount(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerOwner.java b/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerOwner.java new file mode 100644 index 00000000..0d12c515 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerOwner.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Map; +import java.util.Objects; + +@JsonDeserialize(using = LedgerActivityResourceOwnerOwner.Deserializer.class) +public final class LedgerActivityResourceOwnerOwner { + private final Object value; + + private final int type; + + private LedgerActivityResourceOwnerOwner(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((LedgerActivityResourceOwnerOwnerLogoUrl) this.value); + } else if (this.type == 1) { + return visitor.visit((LedgerActivityResourceOwnerOwnerName) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityResourceOwnerOwner && equalTo((LedgerActivityResourceOwnerOwner) other); + } + + private boolean equalTo(LedgerActivityResourceOwnerOwner other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static LedgerActivityResourceOwnerOwner of(LedgerActivityResourceOwnerOwnerLogoUrl value) { + return new LedgerActivityResourceOwnerOwner(value, 0); + } + + public static LedgerActivityResourceOwnerOwner of(LedgerActivityResourceOwnerOwnerName value) { + return new LedgerActivityResourceOwnerOwner(value, 1); + } + + public interface Visitor { + T visit(LedgerActivityResourceOwnerOwnerLogoUrl value); + + T visit(LedgerActivityResourceOwnerOwnerName value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(LedgerActivityResourceOwnerOwner.class); + } + + @java.lang.Override + public LedgerActivityResourceOwnerOwner deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Map + && ((Map) value).containsKey("id") + && ((Map) value).containsKey("object")) { + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, LedgerActivityResourceOwnerOwnerLogoUrl.class)); + } catch (RuntimeException e) { + } + } + if (value instanceof Map + && ((Map) value).containsKey("id") + && ((Map) value).containsKey("object")) { + try { + return of( + ObjectMappers.JSON_MAPPER.convertValue(value, LedgerActivityResourceOwnerOwnerName.class)); + } catch (RuntimeException e) { + } + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerOwnerLogoUrl.java b/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerOwnerLogoUrl.java new file mode 100644 index 00000000..3d67c78a --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerOwnerLogoUrl.java @@ -0,0 +1,371 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivityResourceOwnerOwnerLogoUrl.Builder.class) +public final class LedgerActivityResourceOwnerOwnerLogoUrl { + private final String id; + + private final Optional logoUrl; + + private final LedgerActivityResourceOwnerOwnerLogoUrlObject object; + + private final Optional route; + + private final Optional title; + + private final Map additionalProperties; + + private LedgerActivityResourceOwnerOwnerLogoUrl( + String id, + Optional logoUrl, + LedgerActivityResourceOwnerOwnerLogoUrlObject object, + Optional route, + Optional title, + Map additionalProperties) { + this.id = id; + this.logoUrl = logoUrl; + this.object = object; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account logo URL. + */ + @JsonIgnore + public Optional getLogoUrl() { + if (logoUrl == null) { + return Optional.empty(); + } + return logoUrl; + } + + @JsonProperty("object") + public LedgerActivityResourceOwnerOwnerLogoUrlObject getObject() { + return object; + } + + /** + * @return Account route. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Account display name. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo_url") + private Optional _getLogoUrl() { + return logoUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityResourceOwnerOwnerLogoUrl + && equalTo((LedgerActivityResourceOwnerOwnerLogoUrl) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivityResourceOwnerOwnerLogoUrl other) { + return id.equals(other.id) + && logoUrl.equals(other.logoUrl) + && object.equals(other.object) + && route.equals(other.route) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.logoUrl, this.object, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(LedgerActivityResourceOwnerOwnerLogoUrl other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull LedgerActivityResourceOwnerOwnerLogoUrlObject object); + } + + public interface _FinalStage { + LedgerActivityResourceOwnerOwnerLogoUrl build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account logo URL.

+ */ + _FinalStage logoUrl(Optional logoUrl); + + _FinalStage logoUrl(String logoUrl); + + _FinalStage logoUrl(Nullable logoUrl); + + /** + *

Account route.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + + /** + *

Account display name.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private LedgerActivityResourceOwnerOwnerLogoUrlObject object; + + private Optional title = Optional.empty(); + + private Optional route = Optional.empty(); + + private Optional logoUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerActivityResourceOwnerOwnerLogoUrl other) { + id(other.getId()); + logoUrl(other.getLogoUrl()); + object(other.getObject()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID.

+ *

Account ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull LedgerActivityResourceOwnerOwnerLogoUrlObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Account display name.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

Account route.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

Account route.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + /** + *

Account logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(Nullable logoUrl) { + if (logoUrl.isNull()) { + this.logoUrl = null; + } else if (logoUrl.isEmpty()) { + this.logoUrl = Optional.empty(); + } else { + this.logoUrl = Optional.of(logoUrl.get()); + } + return this; + } + + /** + *

Account logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(String logoUrl) { + this.logoUrl = Optional.ofNullable(logoUrl); + return this; + } + + /** + *

Account logo URL.

+ */ + @java.lang.Override + @JsonSetter(value = "logo_url", nulls = Nulls.SKIP) + public _FinalStage logoUrl(Optional logoUrl) { + this.logoUrl = logoUrl; + return this; + } + + @java.lang.Override + public LedgerActivityResourceOwnerOwnerLogoUrl build() { + return new LedgerActivityResourceOwnerOwnerLogoUrl(id, logoUrl, object, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerOwnerLogoUrlObject.java b/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerOwnerLogoUrlObject.java new file mode 100644 index 00000000..1fc9e1b1 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerOwnerLogoUrlObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LedgerActivityResourceOwnerOwnerLogoUrlObject { + public static final LedgerActivityResourceOwnerOwnerLogoUrlObject ACCOUNT = + new LedgerActivityResourceOwnerOwnerLogoUrlObject(Value.ACCOUNT, "account"); + + private final Value value; + + private final String string; + + LedgerActivityResourceOwnerOwnerLogoUrlObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LedgerActivityResourceOwnerOwnerLogoUrlObject + && this.string.equals(((LedgerActivityResourceOwnerOwnerLogoUrlObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ACCOUNT: + return visitor.visitAccount(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LedgerActivityResourceOwnerOwnerLogoUrlObject valueOf(String value) { + switch (value) { + case "account": + return ACCOUNT; + default: + return new LedgerActivityResourceOwnerOwnerLogoUrlObject(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT, + + UNKNOWN + } + + public interface Visitor { + T visitAccount(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerOwnerName.java b/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerOwnerName.java new file mode 100644 index 00000000..ebb7b4f5 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerOwnerName.java @@ -0,0 +1,372 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivityResourceOwnerOwnerName.Builder.class) +public final class LedgerActivityResourceOwnerOwnerName { + private final String id; + + private final Optional name; + + private final LedgerActivityResourceOwnerOwnerNameObject object; + + private final Optional profilePictureUrl; + + private final Optional username; + + private final Map additionalProperties; + + private LedgerActivityResourceOwnerOwnerName( + String id, + Optional name, + LedgerActivityResourceOwnerOwnerNameObject object, + Optional profilePictureUrl, + Optional username, + Map additionalProperties) { + this.id = id; + this.name = name; + this.object = object; + this.profilePictureUrl = profilePictureUrl; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return User display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonProperty("object") + public LedgerActivityResourceOwnerOwnerNameObject getObject() { + return object; + } + + /** + * @return User profile image URL. + */ + @JsonIgnore + public Optional getProfilePictureUrl() { + if (profilePictureUrl == null) { + return Optional.empty(); + } + return profilePictureUrl; + } + + /** + * @return User's username. + */ + @JsonIgnore + public Optional getUsername() { + if (username == null) { + return Optional.empty(); + } + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("profile_picture_url") + private Optional _getProfilePictureUrl() { + return profilePictureUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("username") + private Optional _getUsername() { + return username; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityResourceOwnerOwnerName + && equalTo((LedgerActivityResourceOwnerOwnerName) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivityResourceOwnerOwnerName other) { + return id.equals(other.id) + && name.equals(other.name) + && object.equals(other.object) + && profilePictureUrl.equals(other.profilePictureUrl) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.object, this.profilePictureUrl, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(LedgerActivityResourceOwnerOwnerName other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull LedgerActivityResourceOwnerOwnerNameObject object); + } + + public interface _FinalStage { + LedgerActivityResourceOwnerOwnerName build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

User display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

User profile image URL.

+ */ + _FinalStage profilePictureUrl(Optional profilePictureUrl); + + _FinalStage profilePictureUrl(String profilePictureUrl); + + _FinalStage profilePictureUrl(Nullable profilePictureUrl); + + /** + *

User's username.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + + _FinalStage username(Nullable username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private LedgerActivityResourceOwnerOwnerNameObject object; + + private Optional username = Optional.empty(); + + private Optional profilePictureUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerActivityResourceOwnerOwnerName other) { + id(other.getId()); + name(other.getName()); + object(other.getObject()); + profilePictureUrl(other.getProfilePictureUrl()); + username(other.getUsername()); + return this; + } + + /** + *

User ID.

+ *

User ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull LedgerActivityResourceOwnerOwnerNameObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(Nullable username) { + if (username.isNull()) { + this.username = null; + } else if (username.isEmpty()) { + this.username = Optional.empty(); + } else { + this.username = Optional.of(username.get()); + } + return this; + } + + /** + *

User's username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

User's username.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

User profile image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profilePictureUrl(Nullable profilePictureUrl) { + if (profilePictureUrl.isNull()) { + this.profilePictureUrl = null; + } else if (profilePictureUrl.isEmpty()) { + this.profilePictureUrl = Optional.empty(); + } else { + this.profilePictureUrl = Optional.of(profilePictureUrl.get()); + } + return this; + } + + /** + *

User profile image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profilePictureUrl(String profilePictureUrl) { + this.profilePictureUrl = Optional.ofNullable(profilePictureUrl); + return this; + } + + /** + *

User profile image URL.

+ */ + @java.lang.Override + @JsonSetter(value = "profile_picture_url", nulls = Nulls.SKIP) + public _FinalStage profilePictureUrl(Optional profilePictureUrl) { + this.profilePictureUrl = profilePictureUrl; + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

User display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

User display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public LedgerActivityResourceOwnerOwnerName build() { + return new LedgerActivityResourceOwnerOwnerName( + id, name, object, profilePictureUrl, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerOwnerNameObject.java b/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerOwnerNameObject.java new file mode 100644 index 00000000..99ea17d1 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceOwnerOwnerNameObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LedgerActivityResourceOwnerOwnerNameObject { + public static final LedgerActivityResourceOwnerOwnerNameObject USER = + new LedgerActivityResourceOwnerOwnerNameObject(Value.USER, "user"); + + private final Value value; + + private final String string; + + LedgerActivityResourceOwnerOwnerNameObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LedgerActivityResourceOwnerOwnerNameObject + && this.string.equals(((LedgerActivityResourceOwnerOwnerNameObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case USER: + return visitor.visitUser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LedgerActivityResourceOwnerOwnerNameObject valueOf(String value) { + switch (value) { + case "user": + return USER; + default: + return new LedgerActivityResourceOwnerOwnerNameObject(Value.UNKNOWN, value); + } + } + + public enum Value { + USER, + + UNKNOWN + } + + public interface Visitor { + T visitUser(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceTwo.java b/src/main/java/com/whop/api/types/LedgerActivityResourceTwo.java new file mode 100644 index 00000000..5c66fb86 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceTwo.java @@ -0,0 +1,225 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivityResourceTwo.Builder.class) +public final class LedgerActivityResourceTwo { + private final String id; + + private final LedgerActivityResourceTwoObject object; + + private final String status; + + private final String title; + + private final Map additionalProperties; + + private LedgerActivityResourceTwo( + String id, + LedgerActivityResourceTwoObject object, + String status, + String title, + Map additionalProperties) { + this.id = id; + this.object = object; + this.status = status; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Bounty ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("object") + public LedgerActivityResourceTwoObject getObject() { + return object; + } + + /** + * @return Bounty lifecycle status. + */ + @JsonProperty("status") + public String getStatus() { + return status; + } + + /** + * @return Bounty title. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivityResourceTwo && equalTo((LedgerActivityResourceTwo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivityResourceTwo other) { + return id.equals(other.id) + && object.equals(other.object) + && status.equals(other.status) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.object, this.status, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Bounty ID.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(LedgerActivityResourceTwo other); + } + + public interface ObjectStage { + StatusStage object(@NotNull LedgerActivityResourceTwoObject object); + } + + public interface StatusStage { + /** + *

Bounty lifecycle status.

+ */ + TitleStage status(@NotNull String status); + } + + public interface TitleStage { + /** + *

Bounty title.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + LedgerActivityResourceTwo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, StatusStage, TitleStage, _FinalStage { + private String id; + + private LedgerActivityResourceTwoObject object; + + private String status; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerActivityResourceTwo other) { + id(other.getId()); + object(other.getObject()); + status(other.getStatus()); + title(other.getTitle()); + return this; + } + + /** + *

Bounty ID.

+ *

Bounty ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public StatusStage object(@NotNull LedgerActivityResourceTwoObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

Bounty lifecycle status.

+ *

Bounty lifecycle status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TitleStage status(@NotNull String status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Bounty title.

+ *

Bounty title.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public LedgerActivityResourceTwo build() { + return new LedgerActivityResourceTwo(id, object, status, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivityResourceTwoObject.java b/src/main/java/com/whop/api/types/LedgerActivityResourceTwoObject.java new file mode 100644 index 00000000..e814e39c --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivityResourceTwoObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LedgerActivityResourceTwoObject { + public static final LedgerActivityResourceTwoObject BOUNTY = + new LedgerActivityResourceTwoObject(Value.BOUNTY, "bounty"); + + private final Value value; + + private final String string; + + LedgerActivityResourceTwoObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LedgerActivityResourceTwoObject + && this.string.equals(((LedgerActivityResourceTwoObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case BOUNTY: + return visitor.visitBounty(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LedgerActivityResourceTwoObject valueOf(String value) { + switch (value) { + case "bounty": + return BOUNTY; + default: + return new LedgerActivityResourceTwoObject(Value.UNKNOWN, value); + } + } + + public enum Value { + BOUNTY, + + UNKNOWN + } + + public interface Visitor { + T visitBounty(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivitySource.java b/src/main/java/com/whop/api/types/LedgerActivitySource.java new file mode 100644 index 00000000..3b06e969 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivitySource.java @@ -0,0 +1,1307 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivitySource.Builder.class) +public final class LedgerActivitySource { + private final Optional amountFloat; + + private final Optional chain; + + private final Optional claimUrl; + + private final Optional createdAt; + + private final Optional estimatedArrival; + + private final Optional fromAmount; + + private final Optional fromCurrency; + + private final String id; + + private final String object; + + private final Optional payerName; + + private final Optional payoutDestination; + + private final Optional payoutTokenNickname; + + private final Optional reason; + + private final Optional senderAddress; + + private final Optional status; + + private final Optional toAmount; + + private final Optional toCurrency; + + private final Optional txHash; + + private final Map additionalProperties; + + private LedgerActivitySource( + Optional amountFloat, + Optional chain, + Optional claimUrl, + Optional createdAt, + Optional estimatedArrival, + Optional fromAmount, + Optional fromCurrency, + String id, + String object, + Optional payerName, + Optional payoutDestination, + Optional payoutTokenNickname, + Optional reason, + Optional senderAddress, + Optional status, + Optional toAmount, + Optional toCurrency, + Optional txHash, + Map additionalProperties) { + this.amountFloat = amountFloat; + this.chain = chain; + this.claimUrl = claimUrl; + this.createdAt = createdAt; + this.estimatedArrival = estimatedArrival; + this.fromAmount = fromAmount; + this.fromCurrency = fromCurrency; + this.id = id; + this.object = object; + this.payerName = payerName; + this.payoutDestination = payoutDestination; + this.payoutTokenNickname = payoutTokenNickname; + this.reason = reason; + this.senderAddress = senderAddress; + this.status = status; + this.toAmount = toAmount; + this.toCurrency = toCurrency; + this.txHash = txHash; + this.additionalProperties = additionalProperties; + } + + /** + * @return Withdrawal amount as a decimal number in the destination currency (withdrawal sources only; requires payout:withdrawal:read). + */ + @JsonIgnore + public Optional getAmountFloat() { + if (amountFloat == null) { + return Optional.empty(); + } + return amountFloat; + } + + /** + * @return Chain the deposit landed on, for example plasma (onchain_transaction sources only). + */ + @JsonIgnore + public Optional getChain() { + if (chain == null) { + return Optional.empty(); + } + return chain; + } + + /** + * @return Public claim URL for the airdrop link (airdrop_link sources only). + */ + @JsonIgnore + public Optional getClaimUrl() { + if (claimUrl == null) { + return Optional.empty(); + } + return claimUrl; + } + + /** + * @return Withdrawal creation time as an ISO 8601 timestamp (withdrawal sources only; requires payout:withdrawal:read). + */ + @JsonIgnore + public Optional getCreatedAt() { + if (createdAt == null) { + return Optional.empty(); + } + return createdAt; + } + + /** + * @return Estimated arrival as an ISO 8601 timestamp (withdrawal sources only; requires payout:withdrawal:read). + */ + @JsonIgnore + public Optional getEstimatedArrival() { + if (estimatedArrival == null) { + return Optional.empty(); + } + return estimatedArrival; + } + + /** + * @return Amount converted out of from_currency as a decimal string (swap sources only). + */ + @JsonIgnore + public Optional getFromAmount() { + if (fromAmount == null) { + return Optional.empty(); + } + return fromAmount; + } + + /** + * @return Lowercase currency code converted from (swap sources only). + */ + @JsonIgnore + public Optional getFromCurrency() { + if (fromCurrency == null) { + return Optional.empty(); + } + return fromCurrency; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("object") + public String getObject() { + return object; + } + + /** + * @return Name of the entity processing the payout (withdrawal sources only; requires payout:withdrawal:read). + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + /** + * @return Payout destination display info (withdrawal sources only). + */ + @JsonIgnore + public Optional getPayoutDestination() { + if (payoutDestination == null) { + return Optional.empty(); + } + return payoutDestination; + } + + /** + * @return Saved payout destination nickname (withdrawal sources only). + */ + @JsonIgnore + public Optional getPayoutTokenNickname() { + if (payoutTokenNickname == null) { + return Optional.empty(); + } + return payoutTokenNickname; + } + + /** + * @return Why the activity happened. On transfer sources this is the transfer reason, for example pool_top_up or bounty_return. On withdrawal sources it explains why the withdrawal was canceled, denied, or failed (requires payout:withdrawal:read); null while the withdrawal is progressing normally. + */ + @JsonIgnore + public Optional getReason() { + if (reason == null) { + return Optional.empty(); + } + return reason; + } + + /** + * @return Sender wallet address or onramp provider identifier (onchain_transaction sources only). + */ + @JsonIgnore + public Optional getSenderAddress() { + if (senderAddress == null) { + return Optional.empty(); + } + return senderAddress; + } + + /** + * @return Lifecycle status. On withdrawal sources this is the withdrawal status (requires payout:withdrawal:read); on airdrop_link sources it is the claim-link status (ungated); on payment and top-up sources it is the friendly payment status such as succeeded/pending/failed (ungated). + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return Amount received in to_currency as a decimal string (swap sources only). + */ + @JsonIgnore + public Optional getToAmount() { + if (toAmount == null) { + return Optional.empty(); + } + return toAmount; + } + + /** + * @return Lowercase currency code converted to (swap sources only). + */ + @JsonIgnore + public Optional getToCurrency() { + if (toCurrency == null) { + return Optional.empty(); + } + return toCurrency; + } + + /** + * @return On-chain transaction hash (onchain_transaction and swap sources only). + */ + @JsonIgnore + public Optional getTxHash() { + if (txHash == null) { + return Optional.empty(); + } + return txHash; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("amount_float") + private Optional _getAmountFloat() { + return amountFloat; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("chain") + private Optional _getChain() { + return chain; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("claim_url") + private Optional _getClaimUrl() { + return claimUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_at") + private Optional _getCreatedAt() { + return createdAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("estimated_arrival") + private Optional _getEstimatedArrival() { + return estimatedArrival; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("from_amount") + private Optional _getFromAmount() { + return fromAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("from_currency") + private Optional _getFromCurrency() { + return fromCurrency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_destination") + private Optional _getPayoutDestination() { + return payoutDestination; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_token_nickname") + private Optional _getPayoutTokenNickname() { + return payoutTokenNickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reason") + private Optional _getReason() { + return reason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("sender_address") + private Optional _getSenderAddress() { + return senderAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("to_amount") + private Optional _getToAmount() { + return toAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("to_currency") + private Optional _getToCurrency() { + return toCurrency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tx_hash") + private Optional _getTxHash() { + return txHash; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivitySource && equalTo((LedgerActivitySource) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivitySource other) { + return amountFloat.equals(other.amountFloat) + && chain.equals(other.chain) + && claimUrl.equals(other.claimUrl) + && createdAt.equals(other.createdAt) + && estimatedArrival.equals(other.estimatedArrival) + && fromAmount.equals(other.fromAmount) + && fromCurrency.equals(other.fromCurrency) + && id.equals(other.id) + && object.equals(other.object) + && payerName.equals(other.payerName) + && payoutDestination.equals(other.payoutDestination) + && payoutTokenNickname.equals(other.payoutTokenNickname) + && reason.equals(other.reason) + && senderAddress.equals(other.senderAddress) + && status.equals(other.status) + && toAmount.equals(other.toAmount) + && toCurrency.equals(other.toCurrency) + && txHash.equals(other.txHash); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amountFloat, + this.chain, + this.claimUrl, + this.createdAt, + this.estimatedArrival, + this.fromAmount, + this.fromCurrency, + this.id, + this.object, + this.payerName, + this.payoutDestination, + this.payoutTokenNickname, + this.reason, + this.senderAddress, + this.status, + this.toAmount, + this.toCurrency, + this.txHash); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + ObjectStage id(@NotNull String id); + + Builder from(LedgerActivitySource other); + } + + public interface ObjectStage { + _FinalStage object(@NotNull String object); + } + + public interface _FinalStage { + LedgerActivitySource build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Withdrawal amount as a decimal number in the destination currency (withdrawal sources only; requires payout:withdrawal:read).

+ */ + _FinalStage amountFloat(Optional amountFloat); + + _FinalStage amountFloat(Double amountFloat); + + _FinalStage amountFloat(Nullable amountFloat); + + /** + *

Chain the deposit landed on, for example plasma (onchain_transaction sources only).

+ */ + _FinalStage chain(Optional chain); + + _FinalStage chain(String chain); + + _FinalStage chain(Nullable chain); + + /** + *

Public claim URL for the airdrop link (airdrop_link sources only).

+ */ + _FinalStage claimUrl(Optional claimUrl); + + _FinalStage claimUrl(String claimUrl); + + _FinalStage claimUrl(Nullable claimUrl); + + /** + *

Withdrawal creation time as an ISO 8601 timestamp (withdrawal sources only; requires payout:withdrawal:read).

+ */ + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(OffsetDateTime createdAt); + + _FinalStage createdAt(Nullable createdAt); + + /** + *

Estimated arrival as an ISO 8601 timestamp (withdrawal sources only; requires payout:withdrawal:read).

+ */ + _FinalStage estimatedArrival(Optional estimatedArrival); + + _FinalStage estimatedArrival(OffsetDateTime estimatedArrival); + + _FinalStage estimatedArrival(Nullable estimatedArrival); + + /** + *

Amount converted out of from_currency as a decimal string (swap sources only).

+ */ + _FinalStage fromAmount(Optional fromAmount); + + _FinalStage fromAmount(String fromAmount); + + _FinalStage fromAmount(Nullable fromAmount); + + /** + *

Lowercase currency code converted from (swap sources only).

+ */ + _FinalStage fromCurrency(Optional fromCurrency); + + _FinalStage fromCurrency(String fromCurrency); + + _FinalStage fromCurrency(Nullable fromCurrency); + + /** + *

Name of the entity processing the payout (withdrawal sources only; requires payout:withdrawal:read).

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + + /** + *

Payout destination display info (withdrawal sources only).

+ */ + _FinalStage payoutDestination(Optional payoutDestination); + + _FinalStage payoutDestination(LedgerActivitySourcePayoutDestination payoutDestination); + + _FinalStage payoutDestination(Nullable payoutDestination); + + /** + *

Saved payout destination nickname (withdrawal sources only).

+ */ + _FinalStage payoutTokenNickname(Optional payoutTokenNickname); + + _FinalStage payoutTokenNickname(String payoutTokenNickname); + + _FinalStage payoutTokenNickname(Nullable payoutTokenNickname); + + /** + *

Why the activity happened. On transfer sources this is the transfer reason, for example pool_top_up or bounty_return. On withdrawal sources it explains why the withdrawal was canceled, denied, or failed (requires payout:withdrawal:read); null while the withdrawal is progressing normally.

+ */ + _FinalStage reason(Optional reason); + + _FinalStage reason(String reason); + + _FinalStage reason(Nullable reason); + + /** + *

Sender wallet address or onramp provider identifier (onchain_transaction sources only).

+ */ + _FinalStage senderAddress(Optional senderAddress); + + _FinalStage senderAddress(String senderAddress); + + _FinalStage senderAddress(Nullable senderAddress); + + /** + *

Lifecycle status. On withdrawal sources this is the withdrawal status (requires payout:withdrawal:read); on airdrop_link sources it is the claim-link status (ungated); on payment and top-up sources it is the friendly payment status such as succeeded/pending/failed (ungated).

+ */ + _FinalStage status(Optional status); + + _FinalStage status(String status); + + _FinalStage status(Nullable status); + + /** + *

Amount received in to_currency as a decimal string (swap sources only).

+ */ + _FinalStage toAmount(Optional toAmount); + + _FinalStage toAmount(String toAmount); + + _FinalStage toAmount(Nullable toAmount); + + /** + *

Lowercase currency code converted to (swap sources only).

+ */ + _FinalStage toCurrency(Optional toCurrency); + + _FinalStage toCurrency(String toCurrency); + + _FinalStage toCurrency(Nullable toCurrency); + + /** + *

On-chain transaction hash (onchain_transaction and swap sources only).

+ */ + _FinalStage txHash(Optional txHash); + + _FinalStage txHash(String txHash); + + _FinalStage txHash(Nullable txHash); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, _FinalStage { + private String id; + + private String object; + + private Optional txHash = Optional.empty(); + + private Optional toCurrency = Optional.empty(); + + private Optional toAmount = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional senderAddress = Optional.empty(); + + private Optional reason = Optional.empty(); + + private Optional payoutTokenNickname = Optional.empty(); + + private Optional payoutDestination = Optional.empty(); + + private Optional payerName = Optional.empty(); + + private Optional fromCurrency = Optional.empty(); + + private Optional fromAmount = Optional.empty(); + + private Optional estimatedArrival = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional claimUrl = Optional.empty(); + + private Optional chain = Optional.empty(); + + private Optional amountFloat = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LedgerActivitySource other) { + amountFloat(other.getAmountFloat()); + chain(other.getChain()); + claimUrl(other.getClaimUrl()); + createdAt(other.getCreatedAt()); + estimatedArrival(other.getEstimatedArrival()); + fromAmount(other.getFromAmount()); + fromCurrency(other.getFromCurrency()); + id(other.getId()); + object(other.getObject()); + payerName(other.getPayerName()); + payoutDestination(other.getPayoutDestination()); + payoutTokenNickname(other.getPayoutTokenNickname()); + reason(other.getReason()); + senderAddress(other.getSenderAddress()); + status(other.getStatus()); + toAmount(other.getToAmount()); + toCurrency(other.getToCurrency()); + txHash(other.getTxHash()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("object") + public _FinalStage object(@NotNull String object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

On-chain transaction hash (onchain_transaction and swap sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage txHash(Nullable txHash) { + if (txHash.isNull()) { + this.txHash = null; + } else if (txHash.isEmpty()) { + this.txHash = Optional.empty(); + } else { + this.txHash = Optional.of(txHash.get()); + } + return this; + } + + /** + *

On-chain transaction hash (onchain_transaction and swap sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage txHash(String txHash) { + this.txHash = Optional.ofNullable(txHash); + return this; + } + + /** + *

On-chain transaction hash (onchain_transaction and swap sources only).

+ */ + @java.lang.Override + @JsonSetter(value = "tx_hash", nulls = Nulls.SKIP) + public _FinalStage txHash(Optional txHash) { + this.txHash = txHash; + return this; + } + + /** + *

Lowercase currency code converted to (swap sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toCurrency(Nullable toCurrency) { + if (toCurrency.isNull()) { + this.toCurrency = null; + } else if (toCurrency.isEmpty()) { + this.toCurrency = Optional.empty(); + } else { + this.toCurrency = Optional.of(toCurrency.get()); + } + return this; + } + + /** + *

Lowercase currency code converted to (swap sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toCurrency(String toCurrency) { + this.toCurrency = Optional.ofNullable(toCurrency); + return this; + } + + /** + *

Lowercase currency code converted to (swap sources only).

+ */ + @java.lang.Override + @JsonSetter(value = "to_currency", nulls = Nulls.SKIP) + public _FinalStage toCurrency(Optional toCurrency) { + this.toCurrency = toCurrency; + return this; + } + + /** + *

Amount received in to_currency as a decimal string (swap sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toAmount(Nullable toAmount) { + if (toAmount.isNull()) { + this.toAmount = null; + } else if (toAmount.isEmpty()) { + this.toAmount = Optional.empty(); + } else { + this.toAmount = Optional.of(toAmount.get()); + } + return this; + } + + /** + *

Amount received in to_currency as a decimal string (swap sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toAmount(String toAmount) { + this.toAmount = Optional.ofNullable(toAmount); + return this; + } + + /** + *

Amount received in to_currency as a decimal string (swap sources only).

+ */ + @java.lang.Override + @JsonSetter(value = "to_amount", nulls = Nulls.SKIP) + public _FinalStage toAmount(Optional toAmount) { + this.toAmount = toAmount; + return this; + } + + /** + *

Lifecycle status. On withdrawal sources this is the withdrawal status (requires payout:withdrawal:read); on airdrop_link sources it is the claim-link status (ungated); on payment and top-up sources it is the friendly payment status such as succeeded/pending/failed (ungated).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

Lifecycle status. On withdrawal sources this is the withdrawal status (requires payout:withdrawal:read); on airdrop_link sources it is the claim-link status (ungated); on payment and top-up sources it is the friendly payment status such as succeeded/pending/failed (ungated).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(String status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Lifecycle status. On withdrawal sources this is the withdrawal status (requires payout:withdrawal:read); on airdrop_link sources it is the claim-link status (ungated); on payment and top-up sources it is the friendly payment status such as succeeded/pending/failed (ungated).

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

Sender wallet address or onramp provider identifier (onchain_transaction sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage senderAddress(Nullable senderAddress) { + if (senderAddress.isNull()) { + this.senderAddress = null; + } else if (senderAddress.isEmpty()) { + this.senderAddress = Optional.empty(); + } else { + this.senderAddress = Optional.of(senderAddress.get()); + } + return this; + } + + /** + *

Sender wallet address or onramp provider identifier (onchain_transaction sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage senderAddress(String senderAddress) { + this.senderAddress = Optional.ofNullable(senderAddress); + return this; + } + + /** + *

Sender wallet address or onramp provider identifier (onchain_transaction sources only).

+ */ + @java.lang.Override + @JsonSetter(value = "sender_address", nulls = Nulls.SKIP) + public _FinalStage senderAddress(Optional senderAddress) { + this.senderAddress = senderAddress; + return this; + } + + /** + *

Why the activity happened. On transfer sources this is the transfer reason, for example pool_top_up or bounty_return. On withdrawal sources it explains why the withdrawal was canceled, denied, or failed (requires payout:withdrawal:read); null while the withdrawal is progressing normally.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reason(Nullable reason) { + if (reason.isNull()) { + this.reason = null; + } else if (reason.isEmpty()) { + this.reason = Optional.empty(); + } else { + this.reason = Optional.of(reason.get()); + } + return this; + } + + /** + *

Why the activity happened. On transfer sources this is the transfer reason, for example pool_top_up or bounty_return. On withdrawal sources it explains why the withdrawal was canceled, denied, or failed (requires payout:withdrawal:read); null while the withdrawal is progressing normally.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reason(String reason) { + this.reason = Optional.ofNullable(reason); + return this; + } + + /** + *

Why the activity happened. On transfer sources this is the transfer reason, for example pool_top_up or bounty_return. On withdrawal sources it explains why the withdrawal was canceled, denied, or failed (requires payout:withdrawal:read); null while the withdrawal is progressing normally.

+ */ + @java.lang.Override + @JsonSetter(value = "reason", nulls = Nulls.SKIP) + public _FinalStage reason(Optional reason) { + this.reason = reason; + return this; + } + + /** + *

Saved payout destination nickname (withdrawal sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutTokenNickname(Nullable payoutTokenNickname) { + if (payoutTokenNickname.isNull()) { + this.payoutTokenNickname = null; + } else if (payoutTokenNickname.isEmpty()) { + this.payoutTokenNickname = Optional.empty(); + } else { + this.payoutTokenNickname = Optional.of(payoutTokenNickname.get()); + } + return this; + } + + /** + *

Saved payout destination nickname (withdrawal sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutTokenNickname(String payoutTokenNickname) { + this.payoutTokenNickname = Optional.ofNullable(payoutTokenNickname); + return this; + } + + /** + *

Saved payout destination nickname (withdrawal sources only).

+ */ + @java.lang.Override + @JsonSetter(value = "payout_token_nickname", nulls = Nulls.SKIP) + public _FinalStage payoutTokenNickname(Optional payoutTokenNickname) { + this.payoutTokenNickname = payoutTokenNickname; + return this; + } + + /** + *

Payout destination display info (withdrawal sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutDestination(Nullable payoutDestination) { + if (payoutDestination.isNull()) { + this.payoutDestination = null; + } else if (payoutDestination.isEmpty()) { + this.payoutDestination = Optional.empty(); + } else { + this.payoutDestination = Optional.of(payoutDestination.get()); + } + return this; + } + + /** + *

Payout destination display info (withdrawal sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutDestination(LedgerActivitySourcePayoutDestination payoutDestination) { + this.payoutDestination = Optional.ofNullable(payoutDestination); + return this; + } + + /** + *

Payout destination display info (withdrawal sources only).

+ */ + @java.lang.Override + @JsonSetter(value = "payout_destination", nulls = Nulls.SKIP) + public _FinalStage payoutDestination(Optional payoutDestination) { + this.payoutDestination = payoutDestination; + return this; + } + + /** + *

Name of the entity processing the payout (withdrawal sources only; requires payout:withdrawal:read).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

Name of the entity processing the payout (withdrawal sources only; requires payout:withdrawal:read).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

Name of the entity processing the payout (withdrawal sources only; requires payout:withdrawal:read).

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

Lowercase currency code converted from (swap sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromCurrency(Nullable fromCurrency) { + if (fromCurrency.isNull()) { + this.fromCurrency = null; + } else if (fromCurrency.isEmpty()) { + this.fromCurrency = Optional.empty(); + } else { + this.fromCurrency = Optional.of(fromCurrency.get()); + } + return this; + } + + /** + *

Lowercase currency code converted from (swap sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromCurrency(String fromCurrency) { + this.fromCurrency = Optional.ofNullable(fromCurrency); + return this; + } + + /** + *

Lowercase currency code converted from (swap sources only).

+ */ + @java.lang.Override + @JsonSetter(value = "from_currency", nulls = Nulls.SKIP) + public _FinalStage fromCurrency(Optional fromCurrency) { + this.fromCurrency = fromCurrency; + return this; + } + + /** + *

Amount converted out of from_currency as a decimal string (swap sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromAmount(Nullable fromAmount) { + if (fromAmount.isNull()) { + this.fromAmount = null; + } else if (fromAmount.isEmpty()) { + this.fromAmount = Optional.empty(); + } else { + this.fromAmount = Optional.of(fromAmount.get()); + } + return this; + } + + /** + *

Amount converted out of from_currency as a decimal string (swap sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromAmount(String fromAmount) { + this.fromAmount = Optional.ofNullable(fromAmount); + return this; + } + + /** + *

Amount converted out of from_currency as a decimal string (swap sources only).

+ */ + @java.lang.Override + @JsonSetter(value = "from_amount", nulls = Nulls.SKIP) + public _FinalStage fromAmount(Optional fromAmount) { + this.fromAmount = fromAmount; + return this; + } + + /** + *

Estimated arrival as an ISO 8601 timestamp (withdrawal sources only; requires payout:withdrawal:read).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(Nullable estimatedArrival) { + if (estimatedArrival.isNull()) { + this.estimatedArrival = null; + } else if (estimatedArrival.isEmpty()) { + this.estimatedArrival = Optional.empty(); + } else { + this.estimatedArrival = Optional.of(estimatedArrival.get()); + } + return this; + } + + /** + *

Estimated arrival as an ISO 8601 timestamp (withdrawal sources only; requires payout:withdrawal:read).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedArrival(OffsetDateTime estimatedArrival) { + this.estimatedArrival = Optional.ofNullable(estimatedArrival); + return this; + } + + /** + *

Estimated arrival as an ISO 8601 timestamp (withdrawal sources only; requires payout:withdrawal:read).

+ */ + @java.lang.Override + @JsonSetter(value = "estimated_arrival", nulls = Nulls.SKIP) + public _FinalStage estimatedArrival(Optional estimatedArrival) { + this.estimatedArrival = estimatedArrival; + return this; + } + + /** + *

Withdrawal creation time as an ISO 8601 timestamp (withdrawal sources only; requires payout:withdrawal:read).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(Nullable createdAt) { + if (createdAt.isNull()) { + this.createdAt = null; + } else if (createdAt.isEmpty()) { + this.createdAt = Optional.empty(); + } else { + this.createdAt = Optional.of(createdAt.get()); + } + return this; + } + + /** + *

Withdrawal creation time as an ISO 8601 timestamp (withdrawal sources only; requires payout:withdrawal:read).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

Withdrawal creation time as an ISO 8601 timestamp (withdrawal sources only; requires payout:withdrawal:read).

+ */ + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

Public claim URL for the airdrop link (airdrop_link sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage claimUrl(Nullable claimUrl) { + if (claimUrl.isNull()) { + this.claimUrl = null; + } else if (claimUrl.isEmpty()) { + this.claimUrl = Optional.empty(); + } else { + this.claimUrl = Optional.of(claimUrl.get()); + } + return this; + } + + /** + *

Public claim URL for the airdrop link (airdrop_link sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage claimUrl(String claimUrl) { + this.claimUrl = Optional.ofNullable(claimUrl); + return this; + } + + /** + *

Public claim URL for the airdrop link (airdrop_link sources only).

+ */ + @java.lang.Override + @JsonSetter(value = "claim_url", nulls = Nulls.SKIP) + public _FinalStage claimUrl(Optional claimUrl) { + this.claimUrl = claimUrl; + return this; + } + + /** + *

Chain the deposit landed on, for example plasma (onchain_transaction sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage chain(Nullable chain) { + if (chain.isNull()) { + this.chain = null; + } else if (chain.isEmpty()) { + this.chain = Optional.empty(); + } else { + this.chain = Optional.of(chain.get()); + } + return this; + } + + /** + *

Chain the deposit landed on, for example plasma (onchain_transaction sources only).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage chain(String chain) { + this.chain = Optional.ofNullable(chain); + return this; + } + + /** + *

Chain the deposit landed on, for example plasma (onchain_transaction sources only).

+ */ + @java.lang.Override + @JsonSetter(value = "chain", nulls = Nulls.SKIP) + public _FinalStage chain(Optional chain) { + this.chain = chain; + return this; + } + + /** + *

Withdrawal amount as a decimal number in the destination currency (withdrawal sources only; requires payout:withdrawal:read).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amountFloat(Nullable amountFloat) { + if (amountFloat.isNull()) { + this.amountFloat = null; + } else if (amountFloat.isEmpty()) { + this.amountFloat = Optional.empty(); + } else { + this.amountFloat = Optional.of(amountFloat.get()); + } + return this; + } + + /** + *

Withdrawal amount as a decimal number in the destination currency (withdrawal sources only; requires payout:withdrawal:read).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amountFloat(Double amountFloat) { + this.amountFloat = Optional.ofNullable(amountFloat); + return this; + } + + /** + *

Withdrawal amount as a decimal number in the destination currency (withdrawal sources only; requires payout:withdrawal:read).

+ */ + @java.lang.Override + @JsonSetter(value = "amount_float", nulls = Nulls.SKIP) + public _FinalStage amountFloat(Optional amountFloat) { + this.amountFloat = amountFloat; + return this; + } + + @java.lang.Override + public LedgerActivitySource build() { + return new LedgerActivitySource( + amountFloat, + chain, + claimUrl, + createdAt, + estimatedArrival, + fromAmount, + fromCurrency, + id, + object, + payerName, + payoutDestination, + payoutTokenNickname, + reason, + senderAddress, + status, + toAmount, + toCurrency, + txHash, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerActivitySourcePayoutDestination.java b/src/main/java/com/whop/api/types/LedgerActivitySourcePayoutDestination.java new file mode 100644 index 00000000..39cece68 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerActivitySourcePayoutDestination.java @@ -0,0 +1,172 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LedgerActivitySourcePayoutDestination.Builder.class) +public final class LedgerActivitySourcePayoutDestination { + private final Optional iconUrl; + + private final Optional payerName; + + private final Map additionalProperties; + + private LedgerActivitySourcePayoutDestination( + Optional iconUrl, Optional payerName, Map additionalProperties) { + this.iconUrl = iconUrl; + this.payerName = payerName; + this.additionalProperties = additionalProperties; + } + + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LedgerActivitySourcePayoutDestination + && equalTo((LedgerActivitySourcePayoutDestination) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LedgerActivitySourcePayoutDestination other) { + return iconUrl.equals(other.iconUrl) && payerName.equals(other.payerName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.iconUrl, this.payerName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional iconUrl = Optional.empty(); + + private Optional payerName = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(LedgerActivitySourcePayoutDestination other) { + iconUrl(other.getIconUrl()); + payerName(other.getPayerName()); + return this; + } + + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public Builder iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + public Builder iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + public Builder iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public Builder payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + public Builder payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + public Builder payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + public LedgerActivitySourcePayoutDestination build() { + return new LedgerActivitySourcePayoutDestination(iconUrl, payerName, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LedgerTypes.java b/src/main/java/com/whop/api/types/LedgerTypes.java new file mode 100644 index 00000000..6160ed61 --- /dev/null +++ b/src/main/java/com/whop/api/types/LedgerTypes.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LedgerTypes { + public static final LedgerTypes POOL = new LedgerTypes(Value.POOL, "pool"); + + public static final LedgerTypes PRIMARY = new LedgerTypes(Value.PRIMARY, "primary"); + + private final Value value; + + private final String string; + + LedgerTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof LedgerTypes && this.string.equals(((LedgerTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case POOL: + return visitor.visitPool(); + case PRIMARY: + return visitor.visitPrimary(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LedgerTypes valueOf(String value) { + switch (value) { + case "pool": + return POOL; + case "primary": + return PRIMARY; + default: + return new LedgerTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + PRIMARY, + + POOL, + + UNKNOWN + } + + public interface Visitor { + T visitPrimary(); + + T visitPool(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/LessonTypes.java b/src/main/java/com/whop/api/types/LessonTypes.java new file mode 100644 index 00000000..3a00f18e --- /dev/null +++ b/src/main/java/com/whop/api/types/LessonTypes.java @@ -0,0 +1,122 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LessonTypes { + public static final LessonTypes TEXT = new LessonTypes(Value.TEXT, "text"); + + public static final LessonTypes MULTI = new LessonTypes(Value.MULTI, "multi"); + + public static final LessonTypes PDF = new LessonTypes(Value.PDF, "pdf"); + + public static final LessonTypes VIDEO = new LessonTypes(Value.VIDEO, "video"); + + public static final LessonTypes QUIZ = new LessonTypes(Value.QUIZ, "quiz"); + + public static final LessonTypes KNOWLEDGE_CHECK = new LessonTypes(Value.KNOWLEDGE_CHECK, "knowledge_check"); + + private final Value value; + + private final String string; + + LessonTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof LessonTypes && this.string.equals(((LessonTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TEXT: + return visitor.visitText(); + case MULTI: + return visitor.visitMulti(); + case PDF: + return visitor.visitPdf(); + case VIDEO: + return visitor.visitVideo(); + case QUIZ: + return visitor.visitQuiz(); + case KNOWLEDGE_CHECK: + return visitor.visitKnowledgeCheck(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LessonTypes valueOf(String value) { + switch (value) { + case "text": + return TEXT; + case "multi": + return MULTI; + case "pdf": + return PDF; + case "video": + return VIDEO; + case "quiz": + return QUIZ; + case "knowledge_check": + return KNOWLEDGE_CHECK; + default: + return new LessonTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + TEXT, + + VIDEO, + + PDF, + + MULTI, + + QUIZ, + + KNOWLEDGE_CHECK, + + UNKNOWN + } + + public interface Visitor { + T visitText(); + + T visitVideo(); + + T visitPdf(); + + T visitMulti(); + + T visitQuiz(); + + T visitKnowledgeCheck(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/LessonVisibilities.java b/src/main/java/com/whop/api/types/LessonVisibilities.java new file mode 100644 index 00000000..45fc8f41 --- /dev/null +++ b/src/main/java/com/whop/api/types/LessonVisibilities.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LessonVisibilities { + public static final LessonVisibilities VISIBLE = new LessonVisibilities(Value.VISIBLE, "visible"); + + public static final LessonVisibilities HIDDEN = new LessonVisibilities(Value.HIDDEN, "hidden"); + + private final Value value; + + private final String string; + + LessonVisibilities(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LessonVisibilities && this.string.equals(((LessonVisibilities) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VISIBLE: + return visitor.visitVisible(); + case HIDDEN: + return visitor.visitHidden(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LessonVisibilities valueOf(String value) { + switch (value) { + case "visible": + return VISIBLE; + case "hidden": + return HIDDEN; + default: + return new LessonVisibilities(Value.UNKNOWN, value); + } + } + + public enum Value { + VISIBLE, + + HIDDEN, + + UNKNOWN + } + + public interface Visitor { + T visitVisible(); + + T visitHidden(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ListApiKeysRequestCreatedAfter.java b/src/main/java/com/whop/api/types/ListApiKeysRequestCreatedAfter.java new file mode 100644 index 00000000..995c8b91 --- /dev/null +++ b/src/main/java/com/whop/api/types/ListApiKeysRequestCreatedAfter.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = ListApiKeysRequestCreatedAfter.Deserializer.class) +public final class ListApiKeysRequestCreatedAfter { + private final Object value; + + private final int type; + + private ListApiKeysRequestCreatedAfter(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((int) this.value); + } else if (this.type == 1) { + return visitor.visit((String) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListApiKeysRequestCreatedAfter && equalTo((ListApiKeysRequestCreatedAfter) other); + } + + private boolean equalTo(ListApiKeysRequestCreatedAfter other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static ListApiKeysRequestCreatedAfter of(int value) { + return new ListApiKeysRequestCreatedAfter(value, 0); + } + + public static ListApiKeysRequestCreatedAfter of(String value) { + return new ListApiKeysRequestCreatedAfter(value, 1); + } + + public interface Visitor { + T visit(int value); + + T visit(String value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(ListApiKeysRequestCreatedAfter.class); + } + + @java.lang.Override + public ListApiKeysRequestCreatedAfter deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Integer) { + return of((Integer) value); + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/types/ListApiKeysRequestCreatedBefore.java b/src/main/java/com/whop/api/types/ListApiKeysRequestCreatedBefore.java new file mode 100644 index 00000000..2dd0ea7c --- /dev/null +++ b/src/main/java/com/whop/api/types/ListApiKeysRequestCreatedBefore.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = ListApiKeysRequestCreatedBefore.Deserializer.class) +public final class ListApiKeysRequestCreatedBefore { + private final Object value; + + private final int type; + + private ListApiKeysRequestCreatedBefore(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((int) this.value); + } else if (this.type == 1) { + return visitor.visit((String) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListApiKeysRequestCreatedBefore && equalTo((ListApiKeysRequestCreatedBefore) other); + } + + private boolean equalTo(ListApiKeysRequestCreatedBefore other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static ListApiKeysRequestCreatedBefore of(int value) { + return new ListApiKeysRequestCreatedBefore(value, 0); + } + + public static ListApiKeysRequestCreatedBefore of(String value) { + return new ListApiKeysRequestCreatedBefore(value, 1); + } + + public interface Visitor { + T visit(int value); + + T visit(String value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(ListApiKeysRequestCreatedBefore.class); + } + + @java.lang.Override + public ListApiKeysRequestCreatedBefore deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Integer) { + return of((Integer) value); + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/types/ListAppBuildsRequestCreatedAfter.java b/src/main/java/com/whop/api/types/ListAppBuildsRequestCreatedAfter.java new file mode 100644 index 00000000..2d7020e1 --- /dev/null +++ b/src/main/java/com/whop/api/types/ListAppBuildsRequestCreatedAfter.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = ListAppBuildsRequestCreatedAfter.Deserializer.class) +public final class ListAppBuildsRequestCreatedAfter { + private final Object value; + + private final int type; + + private ListAppBuildsRequestCreatedAfter(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((int) this.value); + } else if (this.type == 1) { + return visitor.visit((String) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAppBuildsRequestCreatedAfter && equalTo((ListAppBuildsRequestCreatedAfter) other); + } + + private boolean equalTo(ListAppBuildsRequestCreatedAfter other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static ListAppBuildsRequestCreatedAfter of(int value) { + return new ListAppBuildsRequestCreatedAfter(value, 0); + } + + public static ListAppBuildsRequestCreatedAfter of(String value) { + return new ListAppBuildsRequestCreatedAfter(value, 1); + } + + public interface Visitor { + T visit(int value); + + T visit(String value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(ListAppBuildsRequestCreatedAfter.class); + } + + @java.lang.Override + public ListAppBuildsRequestCreatedAfter deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Integer) { + return of((Integer) value); + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/types/ListAppBuildsRequestCreatedBefore.java b/src/main/java/com/whop/api/types/ListAppBuildsRequestCreatedBefore.java new file mode 100644 index 00000000..632c2318 --- /dev/null +++ b/src/main/java/com/whop/api/types/ListAppBuildsRequestCreatedBefore.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.whop.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = ListAppBuildsRequestCreatedBefore.Deserializer.class) +public final class ListAppBuildsRequestCreatedBefore { + private final Object value; + + private final int type; + + private ListAppBuildsRequestCreatedBefore(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((int) this.value); + } else if (this.type == 1) { + return visitor.visit((String) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAppBuildsRequestCreatedBefore && equalTo((ListAppBuildsRequestCreatedBefore) other); + } + + private boolean equalTo(ListAppBuildsRequestCreatedBefore other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static ListAppBuildsRequestCreatedBefore of(int value) { + return new ListAppBuildsRequestCreatedBefore(value, 0); + } + + public static ListAppBuildsRequestCreatedBefore of(String value) { + return new ListAppBuildsRequestCreatedBefore(value, 1); + } + + public interface Visitor { + T visit(int value); + + T visit(String value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(ListAppBuildsRequestCreatedBefore.class); + } + + @java.lang.Override + public ListAppBuildsRequestCreatedBefore deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + if (value instanceof Integer) { + return of((Integer) value); + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/whop/api/types/LocationTargetingOption.java b/src/main/java/com/whop/api/types/LocationTargetingOption.java new file mode 100644 index 00000000..b61dd3e3 --- /dev/null +++ b/src/main/java/com/whop/api/types/LocationTargetingOption.java @@ -0,0 +1,488 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LocationTargetingOption.Builder.class) +public final class LocationTargetingOption { + private final Optional code; + + private final Optional countryCode; + + private final Optional countryName; + + private final String key; + + private final LocationTargetingOptionLocationType locationType; + + private final String name; + + private final Optional region; + + private final Map additionalProperties; + + private LocationTargetingOption( + Optional code, + Optional countryCode, + Optional countryName, + String key, + LocationTargetingOptionLocationType locationType, + String name, + Optional region, + Map additionalProperties) { + this.code = code; + this.countryCode = countryCode; + this.countryName = countryName; + this.key = key; + this.locationType = locationType; + this.name = name; + this.region = region; + this.additionalProperties = additionalProperties; + } + + /** + * @return The standardized code the ad-group regions field takes: an ISO 3166-1 code for countries (US) or an ISO 3166-2 code for states and provinces (US-CA, CA-ON). Null for a location that has no standard code, such as a city or a metro area — target those by key in the regions cities list instead. + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + /** + * @return ISO 3166-1 code of the country the location sits in. + */ + @JsonIgnore + public Optional getCountryCode() { + if (countryCode == null) { + return Optional.empty(); + } + return countryCode; + } + + /** + * @return Name of the country the location sits in. + */ + @JsonIgnore + public Optional getCountryName() { + if (countryName == null) { + return Optional.empty(); + } + return countryName; + } + + /** + * @return The ad platform's key for the location in its location taxonomy. Use it as the key of a regions city or zip entry. + */ + @JsonProperty("key") + public String getKey() { + return key; + } + + /** + * @return Granularity of the location. Which of these an ad platform reports depends on how finely it divides its location taxonomy. + */ + @JsonProperty("location_type") + public LocationTargetingOptionLocationType getLocationType() { + return locationType; + } + + /** + * @return Display name, such as California. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return Name of the state or province a city sits in. Null for everything but cities. + */ + @JsonIgnore + public Optional getRegion() { + if (region == null) { + return Optional.empty(); + } + return region; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country_code") + private Optional _getCountryCode() { + return countryCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country_name") + private Optional _getCountryName() { + return countryName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("region") + private Optional _getRegion() { + return region; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LocationTargetingOption && equalTo((LocationTargetingOption) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LocationTargetingOption other) { + return code.equals(other.code) + && countryCode.equals(other.countryCode) + && countryName.equals(other.countryName) + && key.equals(other.key) + && locationType.equals(other.locationType) + && name.equals(other.name) + && region.equals(other.region); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.code, this.countryCode, this.countryName, this.key, this.locationType, this.name, this.region); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KeyStage builder() { + return new Builder(); + } + + public interface KeyStage { + /** + *

The ad platform's key for the location in its location taxonomy. Use it as the key of a regions city or zip entry.

+ */ + LocationTypeStage key(@NotNull String key); + + Builder from(LocationTargetingOption other); + } + + public interface LocationTypeStage { + /** + *

Granularity of the location. Which of these an ad platform reports depends on how finely it divides its location taxonomy.

+ */ + NameStage locationType(@NotNull LocationTargetingOptionLocationType locationType); + } + + public interface NameStage { + /** + *

Display name, such as California.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + LocationTargetingOption build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The standardized code the ad-group regions field takes: an ISO 3166-1 code for countries (US) or an ISO 3166-2 code for states and provinces (US-CA, CA-ON). Null for a location that has no standard code, such as a city or a metro area — target those by key in the regions cities list instead.

+ */ + _FinalStage code(Optional code); + + _FinalStage code(String code); + + _FinalStage code(Nullable code); + + /** + *

ISO 3166-1 code of the country the location sits in.

+ */ + _FinalStage countryCode(Optional countryCode); + + _FinalStage countryCode(String countryCode); + + _FinalStage countryCode(Nullable countryCode); + + /** + *

Name of the country the location sits in.

+ */ + _FinalStage countryName(Optional countryName); + + _FinalStage countryName(String countryName); + + _FinalStage countryName(Nullable countryName); + + /** + *

Name of the state or province a city sits in. Null for everything but cities.

+ */ + _FinalStage region(Optional region); + + _FinalStage region(String region); + + _FinalStage region(Nullable region); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KeyStage, LocationTypeStage, NameStage, _FinalStage { + private String key; + + private LocationTargetingOptionLocationType locationType; + + private String name; + + private Optional region = Optional.empty(); + + private Optional countryName = Optional.empty(); + + private Optional countryCode = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LocationTargetingOption other) { + code(other.getCode()); + countryCode(other.getCountryCode()); + countryName(other.getCountryName()); + key(other.getKey()); + locationType(other.getLocationType()); + name(other.getName()); + region(other.getRegion()); + return this; + } + + /** + *

The ad platform's key for the location in its location taxonomy. Use it as the key of a regions city or zip entry.

+ *

The ad platform's key for the location in its location taxonomy. Use it as the key of a regions city or zip entry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("key") + public LocationTypeStage key(@NotNull String key) { + this.key = Objects.requireNonNull(key, "key must not be null"); + return this; + } + + /** + *

Granularity of the location. Which of these an ad platform reports depends on how finely it divides its location taxonomy.

+ *

Granularity of the location. Which of these an ad platform reports depends on how finely it divides its location taxonomy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("location_type") + public NameStage locationType(@NotNull LocationTargetingOptionLocationType locationType) { + this.locationType = Objects.requireNonNull(locationType, "locationType must not be null"); + return this; + } + + /** + *

Display name, such as California.

+ *

Display name, such as California.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

Name of the state or province a city sits in. Null for everything but cities.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage region(Nullable region) { + if (region.isNull()) { + this.region = null; + } else if (region.isEmpty()) { + this.region = Optional.empty(); + } else { + this.region = Optional.of(region.get()); + } + return this; + } + + /** + *

Name of the state or province a city sits in. Null for everything but cities.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage region(String region) { + this.region = Optional.ofNullable(region); + return this; + } + + /** + *

Name of the state or province a city sits in. Null for everything but cities.

+ */ + @java.lang.Override + @JsonSetter(value = "region", nulls = Nulls.SKIP) + public _FinalStage region(Optional region) { + this.region = region; + return this; + } + + /** + *

Name of the country the location sits in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage countryName(Nullable countryName) { + if (countryName.isNull()) { + this.countryName = null; + } else if (countryName.isEmpty()) { + this.countryName = Optional.empty(); + } else { + this.countryName = Optional.of(countryName.get()); + } + return this; + } + + /** + *

Name of the country the location sits in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage countryName(String countryName) { + this.countryName = Optional.ofNullable(countryName); + return this; + } + + /** + *

Name of the country the location sits in.

+ */ + @java.lang.Override + @JsonSetter(value = "country_name", nulls = Nulls.SKIP) + public _FinalStage countryName(Optional countryName) { + this.countryName = countryName; + return this; + } + + /** + *

ISO 3166-1 code of the country the location sits in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage countryCode(Nullable countryCode) { + if (countryCode.isNull()) { + this.countryCode = null; + } else if (countryCode.isEmpty()) { + this.countryCode = Optional.empty(); + } else { + this.countryCode = Optional.of(countryCode.get()); + } + return this; + } + + /** + *

ISO 3166-1 code of the country the location sits in.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage countryCode(String countryCode) { + this.countryCode = Optional.ofNullable(countryCode); + return this; + } + + /** + *

ISO 3166-1 code of the country the location sits in.

+ */ + @java.lang.Override + @JsonSetter(value = "country_code", nulls = Nulls.SKIP) + public _FinalStage countryCode(Optional countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + *

The standardized code the ad-group regions field takes: an ISO 3166-1 code for countries (US) or an ISO 3166-2 code for states and provinces (US-CA, CA-ON). Null for a location that has no standard code, such as a city or a metro area — target those by key in the regions cities list instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

The standardized code the ad-group regions field takes: an ISO 3166-1 code for countries (US) or an ISO 3166-2 code for states and provinces (US-CA, CA-ON). Null for a location that has no standard code, such as a city or a metro area — target those by key in the regions cities list instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

The standardized code the ad-group regions field takes: an ISO 3166-1 code for countries (US) or an ISO 3166-2 code for states and provinces (US-CA, CA-ON). Null for a location that has no standard code, such as a city or a metro area — target those by key in the regions cities list instead.

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public LocationTargetingOption build() { + return new LocationTargetingOption( + code, countryCode, countryName, key, locationType, name, region, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/LocationTargetingOptionLocationType.java b/src/main/java/com/whop/api/types/LocationTargetingOptionLocationType.java new file mode 100644 index 00000000..475cf0fa --- /dev/null +++ b/src/main/java/com/whop/api/types/LocationTargetingOptionLocationType.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class LocationTargetingOptionLocationType { + public static final LocationTargetingOptionLocationType SUBCITY = + new LocationTargetingOptionLocationType(Value.SUBCITY, "subcity"); + + public static final LocationTargetingOptionLocationType COUNTRY = + new LocationTargetingOptionLocationType(Value.COUNTRY, "country"); + + public static final LocationTargetingOptionLocationType MEDIUM_GEO_AREA = + new LocationTargetingOptionLocationType(Value.MEDIUM_GEO_AREA, "medium_geo_area"); + + public static final LocationTargetingOptionLocationType CITY = + new LocationTargetingOptionLocationType(Value.CITY, "city"); + + public static final LocationTargetingOptionLocationType ZIP = + new LocationTargetingOptionLocationType(Value.ZIP, "zip"); + + public static final LocationTargetingOptionLocationType REGION = + new LocationTargetingOptionLocationType(Value.REGION, "region"); + + public static final LocationTargetingOptionLocationType DISTRICT = + new LocationTargetingOptionLocationType(Value.DISTRICT, "district"); + + public static final LocationTargetingOptionLocationType NEIGHBORHOOD = + new LocationTargetingOptionLocationType(Value.NEIGHBORHOOD, "neighborhood"); + + public static final LocationTargetingOptionLocationType DMA = + new LocationTargetingOptionLocationType(Value.DMA, "dma"); + + private final Value value; + + private final String string; + + LocationTargetingOptionLocationType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof LocationTargetingOptionLocationType + && this.string.equals(((LocationTargetingOptionLocationType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SUBCITY: + return visitor.visitSubcity(); + case COUNTRY: + return visitor.visitCountry(); + case MEDIUM_GEO_AREA: + return visitor.visitMediumGeoArea(); + case CITY: + return visitor.visitCity(); + case ZIP: + return visitor.visitZip(); + case REGION: + return visitor.visitRegion(); + case DISTRICT: + return visitor.visitDistrict(); + case NEIGHBORHOOD: + return visitor.visitNeighborhood(); + case DMA: + return visitor.visitDma(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static LocationTargetingOptionLocationType valueOf(String value) { + switch (value) { + case "subcity": + return SUBCITY; + case "country": + return COUNTRY; + case "medium_geo_area": + return MEDIUM_GEO_AREA; + case "city": + return CITY; + case "zip": + return ZIP; + case "region": + return REGION; + case "district": + return DISTRICT; + case "neighborhood": + return NEIGHBORHOOD; + case "dma": + return DMA; + default: + return new LocationTargetingOptionLocationType(Value.UNKNOWN, value); + } + } + + public enum Value { + COUNTRY, + + REGION, + + CITY, + + ZIP, + + NEIGHBORHOOD, + + SUBCITY, + + MEDIUM_GEO_AREA, + + DISTRICT, + + DMA, + + UNKNOWN + } + + public interface Visitor { + T visitCountry(); + + T visitRegion(); + + T visitCity(); + + T visitZip(); + + T visitNeighborhood(); + + T visitSubcity(); + + T visitMediumGeoArea(); + + T visitDistrict(); + + T visitDma(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/MarketplaceStatuses.java b/src/main/java/com/whop/api/types/MarketplaceStatuses.java new file mode 100644 index 00000000..68d9dfa0 --- /dev/null +++ b/src/main/java/com/whop/api/types/MarketplaceStatuses.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MarketplaceStatuses { + public static final MarketplaceStatuses PENDING_REVIEW = + new MarketplaceStatuses(Value.PENDING_REVIEW, "pending_review"); + + public static final MarketplaceStatuses NOT_AVAILABLE = + new MarketplaceStatuses(Value.NOT_AVAILABLE, "not_available"); + + public static final MarketplaceStatuses LIVE_MARKETPLACE = + new MarketplaceStatuses(Value.LIVE_MARKETPLACE, "live_marketplace"); + + private final Value value; + + private final String string; + + MarketplaceStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MarketplaceStatuses && this.string.equals(((MarketplaceStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING_REVIEW: + return visitor.visitPendingReview(); + case NOT_AVAILABLE: + return visitor.visitNotAvailable(); + case LIVE_MARKETPLACE: + return visitor.visitLiveMarketplace(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MarketplaceStatuses valueOf(String value) { + switch (value) { + case "pending_review": + return PENDING_REVIEW; + case "not_available": + return NOT_AVAILABLE; + case "live_marketplace": + return LIVE_MARKETPLACE; + default: + return new MarketplaceStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + NOT_AVAILABLE, + + PENDING_REVIEW, + + LIVE_MARKETPLACE, + + UNKNOWN + } + + public interface Visitor { + T visitNotAvailable(); + + T visitPendingReview(); + + T visitLiveMarketplace(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/MediaAsset.java b/src/main/java/com/whop/api/types/MediaAsset.java new file mode 100644 index 00000000..6c978fd8 --- /dev/null +++ b/src/main/java/com/whop/api/types/MediaAsset.java @@ -0,0 +1,657 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MediaAsset.Builder.class) +public final class MediaAsset { + private final Optional amountCharged; + + private final Optional completedAt; + + private final String createdAt; + + private final String currency; + + private final Optional errorMessage; + + private final Optional file; + + private final MediaAssetGeneration generation; + + private final String id; + + private final MediaAssetMediaType mediaType; + + private final MediaAssetSource source; + + private final MediaAssetStatus status; + + private final Map additionalProperties; + + private MediaAsset( + Optional amountCharged, + Optional completedAt, + String createdAt, + String currency, + Optional errorMessage, + Optional file, + MediaAssetGeneration generation, + String id, + MediaAssetMediaType mediaType, + MediaAssetSource source, + MediaAssetStatus status, + Map additionalProperties) { + this.amountCharged = amountCharged; + this.completedAt = completedAt; + this.createdAt = createdAt; + this.currency = currency; + this.errorMessage = errorMessage; + this.file = file; + this.generation = generation; + this.id = id; + this.mediaType = mediaType; + this.source = source; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return USD amount charged to the account's balance for this generation. null if the generation wasn't billed. + */ + @JsonIgnore + public Optional getAmountCharged() { + if (amountCharged == null) { + return Optional.empty(); + } + return amountCharged; + } + + /** + * @return ISO 8601 timestamp when the asset reached a terminal state. null while processing. + */ + @JsonIgnore + public Optional getCompletedAt() { + if (completedAt == null) { + return Optional.empty(); + } + return completedAt; + } + + /** + * @return ISO 8601 timestamp when the generation was requested. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Currency of amount_charged. Always usd. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Why generation failed. null unless status is failed. + */ + @JsonIgnore + public Optional getErrorMessage() { + if (errorMessage == null) { + return Optional.empty(); + } + return errorMessage; + } + + /** + * @return The produced file, usable anywhere attachments are accepted. null until the asset is ready. + */ + @JsonIgnore + public Optional getFile() { + if (file == null) { + return Optional.empty(); + } + return file; + } + + /** + * @return The inputs the asset was generated from. + */ + @JsonProperty("generation") + public MediaAssetGeneration getGeneration() { + return generation; + } + + /** + * @return Media asset ID, prefixed media_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The kind of media this asset holds. + */ + @JsonProperty("media_type") + public MediaAssetMediaType getMediaType() { + return mediaType; + } + + /** + * @return How the asset was created. Always generated. + */ + @JsonProperty("source") + public MediaAssetSource getSource() { + return source; + } + + /** + * @return Lifecycle state: processing while generation runs, ready when the file is available, failed when generation failed and the charge was refunded. + */ + @JsonProperty("status") + public MediaAssetStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("amount_charged") + private Optional _getAmountCharged() { + return amountCharged; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("completed_at") + private Optional _getCompletedAt() { + return completedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("error_message") + private Optional _getErrorMessage() { + return errorMessage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("file") + private Optional _getFile() { + return file; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MediaAsset && equalTo((MediaAsset) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MediaAsset other) { + return amountCharged.equals(other.amountCharged) + && completedAt.equals(other.completedAt) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && errorMessage.equals(other.errorMessage) + && file.equals(other.file) + && generation.equals(other.generation) + && id.equals(other.id) + && mediaType.equals(other.mediaType) + && source.equals(other.source) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amountCharged, + this.completedAt, + this.createdAt, + this.currency, + this.errorMessage, + this.file, + this.generation, + this.id, + this.mediaType, + this.source, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

ISO 8601 timestamp when the generation was requested.

+ */ + CurrencyStage createdAt(@NotNull String createdAt); + + Builder from(MediaAsset other); + } + + public interface CurrencyStage { + /** + *

Currency of amount_charged. Always usd.

+ */ + GenerationStage currency(@NotNull String currency); + } + + public interface GenerationStage { + /** + *

The inputs the asset was generated from.

+ */ + IdStage generation(@NotNull MediaAssetGeneration generation); + } + + public interface IdStage { + /** + *

Media asset ID, prefixed media_.

+ */ + MediaTypeStage id(@NotNull String id); + } + + public interface MediaTypeStage { + /** + *

The kind of media this asset holds.

+ */ + SourceStage mediaType(@NotNull MediaAssetMediaType mediaType); + } + + public interface SourceStage { + /** + *

How the asset was created. Always generated.

+ */ + StatusStage source(@NotNull MediaAssetSource source); + } + + public interface StatusStage { + /** + *

Lifecycle state: processing while generation runs, ready when the file is available, failed when generation failed and the charge was refunded.

+ */ + _FinalStage status(@NotNull MediaAssetStatus status); + } + + public interface _FinalStage { + MediaAsset build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

USD amount charged to the account's balance for this generation. null if the generation wasn't billed.

+ */ + _FinalStage amountCharged(Optional amountCharged); + + _FinalStage amountCharged(Double amountCharged); + + _FinalStage amountCharged(Nullable amountCharged); + + /** + *

ISO 8601 timestamp when the asset reached a terminal state. null while processing.

+ */ + _FinalStage completedAt(Optional completedAt); + + _FinalStage completedAt(String completedAt); + + _FinalStage completedAt(Nullable completedAt); + + /** + *

Why generation failed. null unless status is failed.

+ */ + _FinalStage errorMessage(Optional errorMessage); + + _FinalStage errorMessage(String errorMessage); + + _FinalStage errorMessage(Nullable errorMessage); + + /** + *

The produced file, usable anywhere attachments are accepted. null until the asset is ready.

+ */ + _FinalStage file(Optional file); + + _FinalStage file(MediaAssetFile file); + + _FinalStage file(Nullable file); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + CurrencyStage, + GenerationStage, + IdStage, + MediaTypeStage, + SourceStage, + StatusStage, + _FinalStage { + private String createdAt; + + private String currency; + + private MediaAssetGeneration generation; + + private String id; + + private MediaAssetMediaType mediaType; + + private MediaAssetSource source; + + private MediaAssetStatus status; + + private Optional file = Optional.empty(); + + private Optional errorMessage = Optional.empty(); + + private Optional completedAt = Optional.empty(); + + private Optional amountCharged = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MediaAsset other) { + amountCharged(other.getAmountCharged()); + completedAt(other.getCompletedAt()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + errorMessage(other.getErrorMessage()); + file(other.getFile()); + generation(other.getGeneration()); + id(other.getId()); + mediaType(other.getMediaType()); + source(other.getSource()); + status(other.getStatus()); + return this; + } + + /** + *

ISO 8601 timestamp when the generation was requested.

+ *

ISO 8601 timestamp when the generation was requested.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Currency of amount_charged. Always usd.

+ *

Currency of amount_charged. Always usd.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public GenerationStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The inputs the asset was generated from.

+ *

The inputs the asset was generated from.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("generation") + public IdStage generation(@NotNull MediaAssetGeneration generation) { + this.generation = Objects.requireNonNull(generation, "generation must not be null"); + return this; + } + + /** + *

Media asset ID, prefixed media_.

+ *

Media asset ID, prefixed media_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MediaTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The kind of media this asset holds.

+ *

The kind of media this asset holds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("media_type") + public SourceStage mediaType(@NotNull MediaAssetMediaType mediaType) { + this.mediaType = Objects.requireNonNull(mediaType, "mediaType must not be null"); + return this; + } + + /** + *

How the asset was created. Always generated.

+ *

How the asset was created. Always generated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("source") + public StatusStage source(@NotNull MediaAssetSource source) { + this.source = Objects.requireNonNull(source, "source must not be null"); + return this; + } + + /** + *

Lifecycle state: processing while generation runs, ready when the file is available, failed when generation failed and the charge was refunded.

+ *

Lifecycle state: processing while generation runs, ready when the file is available, failed when generation failed and the charge was refunded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull MediaAssetStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The produced file, usable anywhere attachments are accepted. null until the asset is ready.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage file(Nullable file) { + if (file.isNull()) { + this.file = null; + } else if (file.isEmpty()) { + this.file = Optional.empty(); + } else { + this.file = Optional.of(file.get()); + } + return this; + } + + /** + *

The produced file, usable anywhere attachments are accepted. null until the asset is ready.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage file(MediaAssetFile file) { + this.file = Optional.ofNullable(file); + return this; + } + + /** + *

The produced file, usable anywhere attachments are accepted. null until the asset is ready.

+ */ + @java.lang.Override + @JsonSetter(value = "file", nulls = Nulls.SKIP) + public _FinalStage file(Optional file) { + this.file = file; + return this; + } + + /** + *

Why generation failed. null unless status is failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorMessage(Nullable errorMessage) { + if (errorMessage.isNull()) { + this.errorMessage = null; + } else if (errorMessage.isEmpty()) { + this.errorMessage = Optional.empty(); + } else { + this.errorMessage = Optional.of(errorMessage.get()); + } + return this; + } + + /** + *

Why generation failed. null unless status is failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorMessage(String errorMessage) { + this.errorMessage = Optional.ofNullable(errorMessage); + return this; + } + + /** + *

Why generation failed. null unless status is failed.

+ */ + @java.lang.Override + @JsonSetter(value = "error_message", nulls = Nulls.SKIP) + public _FinalStage errorMessage(Optional errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + *

ISO 8601 timestamp when the asset reached a terminal state. null while processing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage completedAt(Nullable completedAt) { + if (completedAt.isNull()) { + this.completedAt = null; + } else if (completedAt.isEmpty()) { + this.completedAt = Optional.empty(); + } else { + this.completedAt = Optional.of(completedAt.get()); + } + return this; + } + + /** + *

ISO 8601 timestamp when the asset reached a terminal state. null while processing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage completedAt(String completedAt) { + this.completedAt = Optional.ofNullable(completedAt); + return this; + } + + /** + *

ISO 8601 timestamp when the asset reached a terminal state. null while processing.

+ */ + @java.lang.Override + @JsonSetter(value = "completed_at", nulls = Nulls.SKIP) + public _FinalStage completedAt(Optional completedAt) { + this.completedAt = completedAt; + return this; + } + + /** + *

USD amount charged to the account's balance for this generation. null if the generation wasn't billed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amountCharged(Nullable amountCharged) { + if (amountCharged.isNull()) { + this.amountCharged = null; + } else if (amountCharged.isEmpty()) { + this.amountCharged = Optional.empty(); + } else { + this.amountCharged = Optional.of(amountCharged.get()); + } + return this; + } + + /** + *

USD amount charged to the account's balance for this generation. null if the generation wasn't billed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage amountCharged(Double amountCharged) { + this.amountCharged = Optional.ofNullable(amountCharged); + return this; + } + + /** + *

USD amount charged to the account's balance for this generation. null if the generation wasn't billed.

+ */ + @java.lang.Override + @JsonSetter(value = "amount_charged", nulls = Nulls.SKIP) + public _FinalStage amountCharged(Optional amountCharged) { + this.amountCharged = amountCharged; + return this; + } + + @java.lang.Override + public MediaAsset build() { + return new MediaAsset( + amountCharged, + completedAt, + createdAt, + currency, + errorMessage, + file, + generation, + id, + mediaType, + source, + status, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MediaAssetFile.java b/src/main/java/com/whop/api/types/MediaAssetFile.java new file mode 100644 index 00000000..f1ab6fa4 --- /dev/null +++ b/src/main/java/com/whop/api/types/MediaAssetFile.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MediaAssetFile.Builder.class) +public final class MediaAssetFile { + private final String id; + + private final String url; + + private final Map additionalProperties; + + private MediaAssetFile(String id, String url, Map additionalProperties) { + this.id = id; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return File ID, prefixed file_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return CDN URL for downloading the file. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MediaAssetFile && equalTo((MediaAssetFile) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MediaAssetFile other) { + return id.equals(other.id) && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

File ID, prefixed file_.

+ */ + UrlStage id(@NotNull String id); + + Builder from(MediaAssetFile other); + } + + public interface UrlStage { + /** + *

CDN URL for downloading the file.

+ */ + _FinalStage url(@NotNull String url); + } + + public interface _FinalStage { + MediaAssetFile build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UrlStage, _FinalStage { + private String id; + + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MediaAssetFile other) { + id(other.getId()); + url(other.getUrl()); + return this; + } + + /** + *

File ID, prefixed file_.

+ *

File ID, prefixed file_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UrlStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

CDN URL for downloading the file.

+ *

CDN URL for downloading the file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public MediaAssetFile build() { + return new MediaAssetFile(id, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MediaAssetGeneration.java b/src/main/java/com/whop/api/types/MediaAssetGeneration.java new file mode 100644 index 00000000..21094906 --- /dev/null +++ b/src/main/java/com/whop/api/types/MediaAssetGeneration.java @@ -0,0 +1,321 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MediaAssetGeneration.Builder.class) +public final class MediaAssetGeneration { + private final Optional durationSeconds; + + private final String prompt; + + private final List referenceMedia; + + private final Optional resolution; + + private final Map additionalProperties; + + private MediaAssetGeneration( + Optional durationSeconds, + String prompt, + List referenceMedia, + Optional resolution, + Map additionalProperties) { + this.durationSeconds = durationSeconds; + this.prompt = prompt; + this.referenceMedia = referenceMedia; + this.resolution = resolution; + this.additionalProperties = additionalProperties; + } + + /** + * @return Requested video length in seconds. null for images. + */ + @JsonIgnore + public Optional getDurationSeconds() { + if (durationSeconds == null) { + return Optional.empty(); + } + return durationSeconds; + } + + /** + * @return What the asset was generated from. + */ + @JsonProperty("prompt") + public String getPrompt() { + return prompt; + } + + @JsonProperty("reference_media") + public List getReferenceMedia() { + return referenceMedia; + } + + /** + * @return Requested video resolution. null for images. 1080p is not supported by Seedance 2.0 Fast or Mini; 4k is only supported by Seedance 2.0. + */ + @JsonIgnore + public Optional getResolution() { + if (resolution == null) { + return Optional.empty(); + } + return resolution; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("duration_seconds") + private Optional _getDurationSeconds() { + return durationSeconds; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resolution") + private Optional _getResolution() { + return resolution; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MediaAssetGeneration && equalTo((MediaAssetGeneration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MediaAssetGeneration other) { + return durationSeconds.equals(other.durationSeconds) + && prompt.equals(other.prompt) + && referenceMedia.equals(other.referenceMedia) + && resolution.equals(other.resolution); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.durationSeconds, this.prompt, this.referenceMedia, this.resolution); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PromptStage builder() { + return new Builder(); + } + + public interface PromptStage { + /** + *

What the asset was generated from.

+ */ + _FinalStage prompt(@NotNull String prompt); + + Builder from(MediaAssetGeneration other); + } + + public interface _FinalStage { + MediaAssetGeneration build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Requested video length in seconds. null for images.

+ */ + _FinalStage durationSeconds(Optional durationSeconds); + + _FinalStage durationSeconds(Double durationSeconds); + + _FinalStage durationSeconds(Nullable durationSeconds); + + _FinalStage referenceMedia(List referenceMedia); + + _FinalStage addReferenceMedia(String referenceMedia); + + _FinalStage addAllReferenceMedia(List referenceMedia); + + /** + *

Requested video resolution. null for images. 1080p is not supported by Seedance 2.0 Fast or Mini; 4k is only supported by Seedance 2.0.

+ */ + _FinalStage resolution(Optional resolution); + + _FinalStage resolution(MediaAssetGenerationResolution resolution); + + _FinalStage resolution(Nullable resolution); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PromptStage, _FinalStage { + private String prompt; + + private Optional resolution = Optional.empty(); + + private List referenceMedia = new ArrayList<>(); + + private Optional durationSeconds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MediaAssetGeneration other) { + durationSeconds(other.getDurationSeconds()); + prompt(other.getPrompt()); + referenceMedia(other.getReferenceMedia()); + resolution(other.getResolution()); + return this; + } + + /** + *

What the asset was generated from.

+ *

What the asset was generated from.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("prompt") + public _FinalStage prompt(@NotNull String prompt) { + this.prompt = Objects.requireNonNull(prompt, "prompt must not be null"); + return this; + } + + /** + *

Requested video resolution. null for images. 1080p is not supported by Seedance 2.0 Fast or Mini; 4k is only supported by Seedance 2.0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolution(Nullable resolution) { + if (resolution.isNull()) { + this.resolution = null; + } else if (resolution.isEmpty()) { + this.resolution = Optional.empty(); + } else { + this.resolution = Optional.of(resolution.get()); + } + return this; + } + + /** + *

Requested video resolution. null for images. 1080p is not supported by Seedance 2.0 Fast or Mini; 4k is only supported by Seedance 2.0.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolution(MediaAssetGenerationResolution resolution) { + this.resolution = Optional.ofNullable(resolution); + return this; + } + + /** + *

Requested video resolution. null for images. 1080p is not supported by Seedance 2.0 Fast or Mini; 4k is only supported by Seedance 2.0.

+ */ + @java.lang.Override + @JsonSetter(value = "resolution", nulls = Nulls.SKIP) + public _FinalStage resolution(Optional resolution) { + this.resolution = resolution; + return this; + } + + @java.lang.Override + public _FinalStage addAllReferenceMedia(List referenceMedia) { + if (referenceMedia != null) { + this.referenceMedia.addAll(referenceMedia); + } + return this; + } + + @java.lang.Override + public _FinalStage addReferenceMedia(String referenceMedia) { + this.referenceMedia.add(referenceMedia); + return this; + } + + @java.lang.Override + @JsonSetter(value = "reference_media", nulls = Nulls.SKIP) + public _FinalStage referenceMedia(List referenceMedia) { + this.referenceMedia.clear(); + if (referenceMedia != null) { + this.referenceMedia.addAll(referenceMedia); + } + return this; + } + + /** + *

Requested video length in seconds. null for images.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage durationSeconds(Nullable durationSeconds) { + if (durationSeconds.isNull()) { + this.durationSeconds = null; + } else if (durationSeconds.isEmpty()) { + this.durationSeconds = Optional.empty(); + } else { + this.durationSeconds = Optional.of(durationSeconds.get()); + } + return this; + } + + /** + *

Requested video length in seconds. null for images.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage durationSeconds(Double durationSeconds) { + this.durationSeconds = Optional.ofNullable(durationSeconds); + return this; + } + + /** + *

Requested video length in seconds. null for images.

+ */ + @java.lang.Override + @JsonSetter(value = "duration_seconds", nulls = Nulls.SKIP) + public _FinalStage durationSeconds(Optional durationSeconds) { + this.durationSeconds = durationSeconds; + return this; + } + + @java.lang.Override + public MediaAssetGeneration build() { + return new MediaAssetGeneration(durationSeconds, prompt, referenceMedia, resolution, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MediaAssetGenerationResolution.java b/src/main/java/com/whop/api/types/MediaAssetGenerationResolution.java new file mode 100644 index 00000000..9b6f060b --- /dev/null +++ b/src/main/java/com/whop/api/types/MediaAssetGenerationResolution.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MediaAssetGenerationResolution { + public static final MediaAssetGenerationResolution ONE_THOUSAND_EIGHTY_P = + new MediaAssetGenerationResolution(Value.ONE_THOUSAND_EIGHTY_P, "1080p"); + + public static final MediaAssetGenerationResolution FOUR_K = new MediaAssetGenerationResolution(Value.FOUR_K, "4k"); + + public static final MediaAssetGenerationResolution FOUR_HUNDRED_EIGHTY_P = + new MediaAssetGenerationResolution(Value.FOUR_HUNDRED_EIGHTY_P, "480p"); + + public static final MediaAssetGenerationResolution SEVEN_HUNDRED_TWENTY_P = + new MediaAssetGenerationResolution(Value.SEVEN_HUNDRED_TWENTY_P, "720p"); + + private final Value value; + + private final String string; + + MediaAssetGenerationResolution(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MediaAssetGenerationResolution + && this.string.equals(((MediaAssetGenerationResolution) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ONE_THOUSAND_EIGHTY_P: + return visitor.visitOneThousandEightyP(); + case FOUR_K: + return visitor.visitFourK(); + case FOUR_HUNDRED_EIGHTY_P: + return visitor.visitFourHundredEightyP(); + case SEVEN_HUNDRED_TWENTY_P: + return visitor.visitSevenHundredTwentyP(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MediaAssetGenerationResolution valueOf(String value) { + switch (value) { + case "1080p": + return ONE_THOUSAND_EIGHTY_P; + case "4k": + return FOUR_K; + case "480p": + return FOUR_HUNDRED_EIGHTY_P; + case "720p": + return SEVEN_HUNDRED_TWENTY_P; + default: + return new MediaAssetGenerationResolution(Value.UNKNOWN, value); + } + } + + public enum Value { + FOUR_HUNDRED_EIGHTY_P, + + SEVEN_HUNDRED_TWENTY_P, + + ONE_THOUSAND_EIGHTY_P, + + FOUR_K, + + UNKNOWN + } + + public interface Visitor { + T visitFourHundredEightyP(); + + T visitSevenHundredTwentyP(); + + T visitOneThousandEightyP(); + + T visitFourK(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/MediaAssetMediaType.java b/src/main/java/com/whop/api/types/MediaAssetMediaType.java new file mode 100644 index 00000000..7e15aee8 --- /dev/null +++ b/src/main/java/com/whop/api/types/MediaAssetMediaType.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MediaAssetMediaType { + public static final MediaAssetMediaType IMAGE = new MediaAssetMediaType(Value.IMAGE, "image"); + + public static final MediaAssetMediaType VIDEO = new MediaAssetMediaType(Value.VIDEO, "video"); + + private final Value value; + + private final String string; + + MediaAssetMediaType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MediaAssetMediaType && this.string.equals(((MediaAssetMediaType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case IMAGE: + return visitor.visitImage(); + case VIDEO: + return visitor.visitVideo(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MediaAssetMediaType valueOf(String value) { + switch (value) { + case "image": + return IMAGE; + case "video": + return VIDEO; + default: + return new MediaAssetMediaType(Value.UNKNOWN, value); + } + } + + public enum Value { + VIDEO, + + IMAGE, + + UNKNOWN + } + + public interface Visitor { + T visitVideo(); + + T visitImage(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/MediaAssetSource.java b/src/main/java/com/whop/api/types/MediaAssetSource.java new file mode 100644 index 00000000..64bb547b --- /dev/null +++ b/src/main/java/com/whop/api/types/MediaAssetSource.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MediaAssetSource { + public static final MediaAssetSource GENERATED = new MediaAssetSource(Value.GENERATED, "generated"); + + private final Value value; + + private final String string; + + MediaAssetSource(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MediaAssetSource && this.string.equals(((MediaAssetSource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case GENERATED: + return visitor.visitGenerated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MediaAssetSource valueOf(String value) { + switch (value) { + case "generated": + return GENERATED; + default: + return new MediaAssetSource(Value.UNKNOWN, value); + } + } + + public enum Value { + GENERATED, + + UNKNOWN + } + + public interface Visitor { + T visitGenerated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/MediaAssetStatus.java b/src/main/java/com/whop/api/types/MediaAssetStatus.java new file mode 100644 index 00000000..cbc69f20 --- /dev/null +++ b/src/main/java/com/whop/api/types/MediaAssetStatus.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MediaAssetStatus { + public static final MediaAssetStatus FAILED = new MediaAssetStatus(Value.FAILED, "failed"); + + public static final MediaAssetStatus PROCESSING = new MediaAssetStatus(Value.PROCESSING, "processing"); + + public static final MediaAssetStatus READY = new MediaAssetStatus(Value.READY, "ready"); + + private final Value value; + + private final String string; + + MediaAssetStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MediaAssetStatus && this.string.equals(((MediaAssetStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case PROCESSING: + return visitor.visitProcessing(); + case READY: + return visitor.visitReady(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MediaAssetStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "processing": + return PROCESSING; + case "ready": + return READY; + default: + return new MediaAssetStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PROCESSING, + + READY, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitProcessing(); + + T visitReady(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Member.java b/src/main/java/com/whop/api/types/Member.java new file mode 100644 index 00000000..94cdad85 --- /dev/null +++ b/src/main/java/com/whop/api/types/Member.java @@ -0,0 +1,475 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Member.Builder.class) +public final class Member { + private final MemberAccessLevel accessLevel; + + private final String accountId; + + private final String createdAt; + + private final String id; + + private final String joinedAt; + + private final Optional lastAccessedAt; + + private final MemberStatus status; + + private final Optional user; + + private final Map additionalProperties; + + private Member( + MemberAccessLevel accessLevel, + String accountId, + String createdAt, + String id, + String joinedAt, + Optional lastAccessedAt, + MemberStatus status, + Optional user, + Map additionalProperties) { + this.accessLevel = accessLevel; + this.accountId = accountId; + this.createdAt = createdAt; + this.id = id; + this.joinedAt = joinedAt; + this.lastAccessedAt = lastAccessedAt; + this.status = status; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return What the member can reach on the account: customer for paying members, admin for team members, no_access once every grant has lapsed. + */ + @JsonProperty("access_level") + public MemberAccessLevel getAccessLevel() { + return accessLevel; + } + + /** + * @return The account this member belongs to, prefixed biz_. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return When the member record was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Member ID, prefixed mber_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return When the member first joined the account, as an ISO 8601 timestamp. + */ + @JsonProperty("joined_at") + public String getJoinedAt() { + return joinedAt; + } + + /** + * @return When the member last opened the account's content, as an ISO 8601 timestamp. null if they never have. + */ + @JsonIgnore + public Optional getLastAccessedAt() { + if (lastAccessedAt == null) { + return Optional.empty(); + } + return lastAccessedAt; + } + + /** + * @return joined while the member is part of the account, left after they leave. + */ + @JsonProperty("status") + public MemberStatus getStatus() { + return status; + } + + /** + * @return The user behind this member. null when the buyer is another business rather than a person. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_accessed_at") + private Optional _getLastAccessedAt() { + return lastAccessedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Member && equalTo((Member) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Member other) { + return accessLevel.equals(other.accessLevel) + && accountId.equals(other.accountId) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && joinedAt.equals(other.joinedAt) + && lastAccessedAt.equals(other.lastAccessedAt) + && status.equals(other.status) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accessLevel, + this.accountId, + this.createdAt, + this.id, + this.joinedAt, + this.lastAccessedAt, + this.status, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccessLevelStage builder() { + return new Builder(); + } + + public interface AccessLevelStage { + /** + *

What the member can reach on the account: customer for paying members, admin for team members, no_access once every grant has lapsed.

+ */ + AccountIdStage accessLevel(@NotNull MemberAccessLevel accessLevel); + + Builder from(Member other); + } + + public interface AccountIdStage { + /** + *

The account this member belongs to, prefixed biz_.

+ */ + CreatedAtStage accountId(@NotNull String accountId); + } + + public interface CreatedAtStage { + /** + *

When the member record was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Member ID, prefixed mber_.

+ */ + JoinedAtStage id(@NotNull String id); + } + + public interface JoinedAtStage { + /** + *

When the member first joined the account, as an ISO 8601 timestamp.

+ */ + StatusStage joinedAt(@NotNull String joinedAt); + } + + public interface StatusStage { + /** + *

joined while the member is part of the account, left after they leave.

+ */ + _FinalStage status(@NotNull MemberStatus status); + } + + public interface _FinalStage { + Member build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When the member last opened the account's content, as an ISO 8601 timestamp. null if they never have.

+ */ + _FinalStage lastAccessedAt(Optional lastAccessedAt); + + _FinalStage lastAccessedAt(String lastAccessedAt); + + _FinalStage lastAccessedAt(Nullable lastAccessedAt); + + /** + *

The user behind this member. null when the buyer is another business rather than a person.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(UserSummary user); + + _FinalStage user(Nullable user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccessLevelStage, + AccountIdStage, + CreatedAtStage, + IdStage, + JoinedAtStage, + StatusStage, + _FinalStage { + private MemberAccessLevel accessLevel; + + private String accountId; + + private String createdAt; + + private String id; + + private String joinedAt; + + private MemberStatus status; + + private Optional user = Optional.empty(); + + private Optional lastAccessedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Member other) { + accessLevel(other.getAccessLevel()); + accountId(other.getAccountId()); + createdAt(other.getCreatedAt()); + id(other.getId()); + joinedAt(other.getJoinedAt()); + lastAccessedAt(other.getLastAccessedAt()); + status(other.getStatus()); + user(other.getUser()); + return this; + } + + /** + *

What the member can reach on the account: customer for paying members, admin for team members, no_access once every grant has lapsed.

+ *

What the member can reach on the account: customer for paying members, admin for team members, no_access once every grant has lapsed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("access_level") + public AccountIdStage accessLevel(@NotNull MemberAccessLevel accessLevel) { + this.accessLevel = Objects.requireNonNull(accessLevel, "accessLevel must not be null"); + return this; + } + + /** + *

The account this member belongs to, prefixed biz_.

+ *

The account this member belongs to, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public CreatedAtStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

When the member record was created, as an ISO 8601 timestamp.

+ *

When the member record was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Member ID, prefixed mber_.

+ *

Member ID, prefixed mber_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public JoinedAtStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

When the member first joined the account, as an ISO 8601 timestamp.

+ *

When the member first joined the account, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("joined_at") + public StatusStage joinedAt(@NotNull String joinedAt) { + this.joinedAt = Objects.requireNonNull(joinedAt, "joinedAt must not be null"); + return this; + } + + /** + *

joined while the member is part of the account, left after they leave.

+ *

joined while the member is part of the account, left after they leave.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull MemberStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The user behind this member. null when the buyer is another business rather than a person.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The user behind this member. null when the buyer is another business rather than a person.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(UserSummary user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The user behind this member. null when the buyer is another business rather than a person.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + /** + *

When the member last opened the account's content, as an ISO 8601 timestamp. null if they never have.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastAccessedAt(Nullable lastAccessedAt) { + if (lastAccessedAt.isNull()) { + this.lastAccessedAt = null; + } else if (lastAccessedAt.isEmpty()) { + this.lastAccessedAt = Optional.empty(); + } else { + this.lastAccessedAt = Optional.of(lastAccessedAt.get()); + } + return this; + } + + /** + *

When the member last opened the account's content, as an ISO 8601 timestamp. null if they never have.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastAccessedAt(String lastAccessedAt) { + this.lastAccessedAt = Optional.ofNullable(lastAccessedAt); + return this; + } + + /** + *

When the member last opened the account's content, as an ISO 8601 timestamp. null if they never have.

+ */ + @java.lang.Override + @JsonSetter(value = "last_accessed_at", nulls = Nulls.SKIP) + public _FinalStage lastAccessedAt(Optional lastAccessedAt) { + this.lastAccessedAt = lastAccessedAt; + return this; + } + + @java.lang.Override + public Member build() { + return new Member( + accessLevel, + accountId, + createdAt, + id, + joinedAt, + lastAccessedAt, + status, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MemberAccessLevel.java b/src/main/java/com/whop/api/types/MemberAccessLevel.java new file mode 100644 index 00000000..a14e2418 --- /dev/null +++ b/src/main/java/com/whop/api/types/MemberAccessLevel.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MemberAccessLevel { + public static final MemberAccessLevel ADMIN = new MemberAccessLevel(Value.ADMIN, "admin"); + + public static final MemberAccessLevel CUSTOMER = new MemberAccessLevel(Value.CUSTOMER, "customer"); + + public static final MemberAccessLevel NO_ACCESS = new MemberAccessLevel(Value.NO_ACCESS, "no_access"); + + private final Value value; + + private final String string; + + MemberAccessLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MemberAccessLevel && this.string.equals(((MemberAccessLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ADMIN: + return visitor.visitAdmin(); + case CUSTOMER: + return visitor.visitCustomer(); + case NO_ACCESS: + return visitor.visitNoAccess(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MemberAccessLevel valueOf(String value) { + switch (value) { + case "admin": + return ADMIN; + case "customer": + return CUSTOMER; + case "no_access": + return NO_ACCESS; + default: + return new MemberAccessLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + NO_ACCESS, + + ADMIN, + + CUSTOMER, + + UNKNOWN + } + + public interface Visitor { + T visitNoAccess(); + + T visitAdmin(); + + T visitCustomer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/MemberListItem.java b/src/main/java/com/whop/api/types/MemberListItem.java new file mode 100644 index 00000000..7fc3c70e --- /dev/null +++ b/src/main/java/com/whop/api/types/MemberListItem.java @@ -0,0 +1,696 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MemberListItem.Builder.class) +public final class MemberListItem { + private final AccessLevel accessLevel; + + private final double companyTokenBalance; + + private final OffsetDateTime createdAt; + + private final String id; + + private final OffsetDateTime joinedAt; + + private final Optional mostRecentAction; + + private final Optional mostRecentActionAt; + + private final Optional phone; + + private final MemberStatuses status; + + private final OffsetDateTime updatedAt; + + private final double usdTotalSpent; + + private final Optional user; + + private final Map additionalProperties; + + private MemberListItem( + AccessLevel accessLevel, + double companyTokenBalance, + OffsetDateTime createdAt, + String id, + OffsetDateTime joinedAt, + Optional mostRecentAction, + Optional mostRecentActionAt, + Optional phone, + MemberStatuses status, + OffsetDateTime updatedAt, + double usdTotalSpent, + Optional user, + Map additionalProperties) { + this.accessLevel = accessLevel; + this.companyTokenBalance = companyTokenBalance; + this.createdAt = createdAt; + this.id = id; + this.joinedAt = joinedAt; + this.mostRecentAction = mostRecentAction; + this.mostRecentActionAt = mostRecentActionAt; + this.phone = phone; + this.status = status; + this.updatedAt = updatedAt; + this.usdTotalSpent = usdTotalSpent; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The member's content access level. admin means their team role grants administrative content access, customer means they hold a valid product membership, and no_access means they cannot access company content. + */ + @JsonProperty("access_level") + public AccessLevel getAccessLevel() { + return accessLevel; + } + + /** + * @return The member's token balance for this company. Computed live from the ledger, not from a cache. + */ + @JsonProperty("company_token_balance") + public double getCompanyTokenBalance() { + return companyTokenBalance; + } + + /** + * @return The datetime the company member was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the company member. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return When the member joined the company + */ + @JsonProperty("joined_at") + public OffsetDateTime getJoinedAt() { + return joinedAt; + } + + /** + * @return The most recent action the member has taken. + */ + @JsonIgnore + public Optional getMostRecentAction() { + if (mostRecentAction == null) { + return Optional.empty(); + } + return mostRecentAction; + } + + /** + * @return The time for the most recent action, if applicable. + */ + @JsonIgnore + public Optional getMostRecentActionAt() { + if (mostRecentActionAt == null) { + return Optional.empty(); + } + return mostRecentActionAt; + } + + /** + * @return The phone number for the member, if available. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + /** + * @return The status of the member + */ + @JsonProperty("status") + public MemberStatuses getStatus() { + return status; + } + + /** + * @return The datetime the company member was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return How much money this customer has spent on the company's products and plans + */ + @JsonProperty("usd_total_spent") + public double getUsdTotalSpent() { + return usdTotalSpent; + } + + /** + * @return The user for this member, if any. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("most_recent_action") + private Optional _getMostRecentAction() { + return mostRecentAction; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("most_recent_action_at") + private Optional _getMostRecentActionAt() { + return mostRecentActionAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MemberListItem && equalTo((MemberListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MemberListItem other) { + return accessLevel.equals(other.accessLevel) + && companyTokenBalance == other.companyTokenBalance + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && joinedAt.equals(other.joinedAt) + && mostRecentAction.equals(other.mostRecentAction) + && mostRecentActionAt.equals(other.mostRecentActionAt) + && phone.equals(other.phone) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt) + && usdTotalSpent == other.usdTotalSpent + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accessLevel, + this.companyTokenBalance, + this.createdAt, + this.id, + this.joinedAt, + this.mostRecentAction, + this.mostRecentActionAt, + this.phone, + this.status, + this.updatedAt, + this.usdTotalSpent, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccessLevelStage builder() { + return new Builder(); + } + + public interface AccessLevelStage { + /** + *

The member's content access level. admin means their team role grants administrative content access, customer means they hold a valid product membership, and no_access means they cannot access company content.

+ */ + CompanyTokenBalanceStage accessLevel(@NotNull AccessLevel accessLevel); + + Builder from(MemberListItem other); + } + + public interface CompanyTokenBalanceStage { + /** + *

The member's token balance for this company. Computed live from the ledger, not from a cache.

+ */ + CreatedAtStage companyTokenBalance(double companyTokenBalance); + } + + public interface CreatedAtStage { + /** + *

The datetime the company member was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the company member.

+ */ + JoinedAtStage id(@NotNull String id); + } + + public interface JoinedAtStage { + /** + *

When the member joined the company

+ */ + StatusStage joinedAt(@NotNull OffsetDateTime joinedAt); + } + + public interface StatusStage { + /** + *

The status of the member

+ */ + UpdatedAtStage status(@NotNull MemberStatuses status); + } + + public interface UpdatedAtStage { + /** + *

The datetime the company member was last updated.

+ */ + UsdTotalSpentStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UsdTotalSpentStage { + /** + *

How much money this customer has spent on the company's products and plans

+ */ + _FinalStage usdTotalSpent(double usdTotalSpent); + } + + public interface _FinalStage { + MemberListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The most recent action the member has taken.

+ */ + _FinalStage mostRecentAction(Optional mostRecentAction); + + _FinalStage mostRecentAction(MemberMostRecentActions mostRecentAction); + + _FinalStage mostRecentAction(Nullable mostRecentAction); + + /** + *

The time for the most recent action, if applicable.

+ */ + _FinalStage mostRecentActionAt(Optional mostRecentActionAt); + + _FinalStage mostRecentActionAt(OffsetDateTime mostRecentActionAt); + + _FinalStage mostRecentActionAt(Nullable mostRecentActionAt); + + /** + *

The phone number for the member, if available.

+ */ + _FinalStage phone(Optional phone); + + _FinalStage phone(String phone); + + _FinalStage phone(Nullable phone); + + /** + *

The user for this member, if any.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(MemberListItemUser user); + + _FinalStage user(Nullable user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccessLevelStage, + CompanyTokenBalanceStage, + CreatedAtStage, + IdStage, + JoinedAtStage, + StatusStage, + UpdatedAtStage, + UsdTotalSpentStage, + _FinalStage { + private AccessLevel accessLevel; + + private double companyTokenBalance; + + private OffsetDateTime createdAt; + + private String id; + + private OffsetDateTime joinedAt; + + private MemberStatuses status; + + private OffsetDateTime updatedAt; + + private double usdTotalSpent; + + private Optional user = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional mostRecentActionAt = Optional.empty(); + + private Optional mostRecentAction = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MemberListItem other) { + accessLevel(other.getAccessLevel()); + companyTokenBalance(other.getCompanyTokenBalance()); + createdAt(other.getCreatedAt()); + id(other.getId()); + joinedAt(other.getJoinedAt()); + mostRecentAction(other.getMostRecentAction()); + mostRecentActionAt(other.getMostRecentActionAt()); + phone(other.getPhone()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + usdTotalSpent(other.getUsdTotalSpent()); + user(other.getUser()); + return this; + } + + /** + *

The member's content access level. admin means their team role grants administrative content access, customer means they hold a valid product membership, and no_access means they cannot access company content.

+ *

The member's content access level. admin means their team role grants administrative content access, customer means they hold a valid product membership, and no_access means they cannot access company content.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("access_level") + public CompanyTokenBalanceStage accessLevel(@NotNull AccessLevel accessLevel) { + this.accessLevel = Objects.requireNonNull(accessLevel, "accessLevel must not be null"); + return this; + } + + /** + *

The member's token balance for this company. Computed live from the ledger, not from a cache.

+ *

The member's token balance for this company. Computed live from the ledger, not from a cache.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_token_balance") + public CreatedAtStage companyTokenBalance(double companyTokenBalance) { + this.companyTokenBalance = companyTokenBalance; + return this; + } + + /** + *

The datetime the company member was created.

+ *

The datetime the company member was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the company member.

+ *

The unique identifier for the company member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public JoinedAtStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

When the member joined the company

+ *

When the member joined the company

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("joined_at") + public StatusStage joinedAt(@NotNull OffsetDateTime joinedAt) { + this.joinedAt = Objects.requireNonNull(joinedAt, "joinedAt must not be null"); + return this; + } + + /** + *

The status of the member

+ *

The status of the member

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull MemberStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The datetime the company member was last updated.

+ *

The datetime the company member was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UsdTotalSpentStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

How much money this customer has spent on the company's products and plans

+ *

How much money this customer has spent on the company's products and plans

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("usd_total_spent") + public _FinalStage usdTotalSpent(double usdTotalSpent) { + this.usdTotalSpent = usdTotalSpent; + return this; + } + + /** + *

The user for this member, if any.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The user for this member, if any.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(MemberListItemUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The user for this member, if any.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + /** + *

The phone number for the member, if available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

The phone number for the member, if available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + /** + *

The phone number for the member, if available.

+ */ + @java.lang.Override + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public _FinalStage phone(Optional phone) { + this.phone = phone; + return this; + } + + /** + *

The time for the most recent action, if applicable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mostRecentActionAt(Nullable mostRecentActionAt) { + if (mostRecentActionAt.isNull()) { + this.mostRecentActionAt = null; + } else if (mostRecentActionAt.isEmpty()) { + this.mostRecentActionAt = Optional.empty(); + } else { + this.mostRecentActionAt = Optional.of(mostRecentActionAt.get()); + } + return this; + } + + /** + *

The time for the most recent action, if applicable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mostRecentActionAt(OffsetDateTime mostRecentActionAt) { + this.mostRecentActionAt = Optional.ofNullable(mostRecentActionAt); + return this; + } + + /** + *

The time for the most recent action, if applicable.

+ */ + @java.lang.Override + @JsonSetter(value = "most_recent_action_at", nulls = Nulls.SKIP) + public _FinalStage mostRecentActionAt(Optional mostRecentActionAt) { + this.mostRecentActionAt = mostRecentActionAt; + return this; + } + + /** + *

The most recent action the member has taken.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mostRecentAction(Nullable mostRecentAction) { + if (mostRecentAction.isNull()) { + this.mostRecentAction = null; + } else if (mostRecentAction.isEmpty()) { + this.mostRecentAction = Optional.empty(); + } else { + this.mostRecentAction = Optional.of(mostRecentAction.get()); + } + return this; + } + + /** + *

The most recent action the member has taken.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mostRecentAction(MemberMostRecentActions mostRecentAction) { + this.mostRecentAction = Optional.ofNullable(mostRecentAction); + return this; + } + + /** + *

The most recent action the member has taken.

+ */ + @java.lang.Override + @JsonSetter(value = "most_recent_action", nulls = Nulls.SKIP) + public _FinalStage mostRecentAction(Optional mostRecentAction) { + this.mostRecentAction = mostRecentAction; + return this; + } + + @java.lang.Override + public MemberListItem build() { + return new MemberListItem( + accessLevel, + companyTokenBalance, + createdAt, + id, + joinedAt, + mostRecentAction, + mostRecentActionAt, + phone, + status, + updatedAt, + usdTotalSpent, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MemberListItemUser.java b/src/main/java/com/whop/api/types/MemberListItemUser.java new file mode 100644 index 00000000..c5ee8985 --- /dev/null +++ b/src/main/java/com/whop/api/types/MemberListItemUser.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MemberListItemUser.Builder.class) +public final class MemberListItemUser { + private final Optional email; + + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private MemberListItemUser( + Optional email, + String id, + Optional name, + String username, + Map additionalProperties) { + this.email = email; + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The digital mailing address of the user. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the company member user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's full name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The whop username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MemberListItemUser && equalTo((MemberListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MemberListItemUser other) { + return email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company member user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(MemberListItemUser other); + } + + public interface UsernameStage { + /** + *

The whop username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + MemberListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The digital mailing address of the user.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's full name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MemberListItemUser other) { + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the company member user.

+ *

The unique identifier for the company member user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The whop username.

+ *

The whop username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's full name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's full name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's full name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The digital mailing address of the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The digital mailing address of the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The digital mailing address of the user.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public MemberListItemUser build() { + return new MemberListItemUser(email, id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MemberMostRecentActions.java b/src/main/java/com/whop/api/types/MemberMostRecentActions.java new file mode 100644 index 00000000..f8b9f135 --- /dev/null +++ b/src/main/java/com/whop/api/types/MemberMostRecentActions.java @@ -0,0 +1,207 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MemberMostRecentActions { + public static final MemberMostRecentActions PAID_ONCE = new MemberMostRecentActions(Value.PAID_ONCE, "paid_once"); + + public static final MemberMostRecentActions PENDING_ENTRY = + new MemberMostRecentActions(Value.PENDING_ENTRY, "pending_entry"); + + public static final MemberMostRecentActions PAID_SUBSCRIBER = + new MemberMostRecentActions(Value.PAID_SUBSCRIBER, "paid_subscriber"); + + public static final MemberMostRecentActions JOINED = new MemberMostRecentActions(Value.JOINED, "joined"); + + public static final MemberMostRecentActions CANCELING = new MemberMostRecentActions(Value.CANCELING, "canceling"); + + public static final MemberMostRecentActions DRAFTED = new MemberMostRecentActions(Value.DRAFTED, "drafted"); + + public static final MemberMostRecentActions CHURNED = new MemberMostRecentActions(Value.CHURNED, "churned"); + + public static final MemberMostRecentActions RENEWING = new MemberMostRecentActions(Value.RENEWING, "renewing"); + + public static final MemberMostRecentActions PAST_DUE = new MemberMostRecentActions(Value.PAST_DUE, "past_due"); + + public static final MemberMostRecentActions FINISHED_SPLIT_PAY = + new MemberMostRecentActions(Value.FINISHED_SPLIT_PAY, "finished_split_pay"); + + public static final MemberMostRecentActions LEFT = new MemberMostRecentActions(Value.LEFT, "left"); + + public static final MemberMostRecentActions EXPIRING = new MemberMostRecentActions(Value.EXPIRING, "expiring"); + + public static final MemberMostRecentActions PAUSED = new MemberMostRecentActions(Value.PAUSED, "paused"); + + public static final MemberMostRecentActions TRIALING = new MemberMostRecentActions(Value.TRIALING, "trialing"); + + private final Value value; + + private final String string; + + MemberMostRecentActions(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MemberMostRecentActions + && this.string.equals(((MemberMostRecentActions) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAID_ONCE: + return visitor.visitPaidOnce(); + case PENDING_ENTRY: + return visitor.visitPendingEntry(); + case PAID_SUBSCRIBER: + return visitor.visitPaidSubscriber(); + case JOINED: + return visitor.visitJoined(); + case CANCELING: + return visitor.visitCanceling(); + case DRAFTED: + return visitor.visitDrafted(); + case CHURNED: + return visitor.visitChurned(); + case RENEWING: + return visitor.visitRenewing(); + case PAST_DUE: + return visitor.visitPastDue(); + case FINISHED_SPLIT_PAY: + return visitor.visitFinishedSplitPay(); + case LEFT: + return visitor.visitLeft(); + case EXPIRING: + return visitor.visitExpiring(); + case PAUSED: + return visitor.visitPaused(); + case TRIALING: + return visitor.visitTrialing(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MemberMostRecentActions valueOf(String value) { + switch (value) { + case "paid_once": + return PAID_ONCE; + case "pending_entry": + return PENDING_ENTRY; + case "paid_subscriber": + return PAID_SUBSCRIBER; + case "joined": + return JOINED; + case "canceling": + return CANCELING; + case "drafted": + return DRAFTED; + case "churned": + return CHURNED; + case "renewing": + return RENEWING; + case "past_due": + return PAST_DUE; + case "finished_split_pay": + return FINISHED_SPLIT_PAY; + case "left": + return LEFT; + case "expiring": + return EXPIRING; + case "paused": + return PAUSED; + case "trialing": + return TRIALING; + default: + return new MemberMostRecentActions(Value.UNKNOWN, value); + } + } + + public enum Value { + CANCELING, + + CHURNED, + + FINISHED_SPLIT_PAY, + + PAUSED, + + PAID_SUBSCRIBER, + + PAID_ONCE, + + EXPIRING, + + JOINED, + + DRAFTED, + + LEFT, + + TRIALING, + + PENDING_ENTRY, + + RENEWING, + + PAST_DUE, + + UNKNOWN + } + + public interface Visitor { + T visitCanceling(); + + T visitChurned(); + + T visitFinishedSplitPay(); + + T visitPaused(); + + T visitPaidSubscriber(); + + T visitPaidOnce(); + + T visitExpiring(); + + T visitJoined(); + + T visitDrafted(); + + T visitLeft(); + + T visitTrialing(); + + T visitPendingEntry(); + + T visitRenewing(); + + T visitPastDue(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/MemberStatus.java b/src/main/java/com/whop/api/types/MemberStatus.java new file mode 100644 index 00000000..68e11865 --- /dev/null +++ b/src/main/java/com/whop/api/types/MemberStatus.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MemberStatus { + public static final MemberStatus LEFT = new MemberStatus(Value.LEFT, "left"); + + public static final MemberStatus JOINED = new MemberStatus(Value.JOINED, "joined"); + + private final Value value; + + private final String string; + + MemberStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof MemberStatus && this.string.equals(((MemberStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LEFT: + return visitor.visitLeft(); + case JOINED: + return visitor.visitJoined(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MemberStatus valueOf(String value) { + switch (value) { + case "left": + return LEFT; + case "joined": + return JOINED; + default: + return new MemberStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + JOINED, + + LEFT, + + UNKNOWN + } + + public interface Visitor { + T visitJoined(); + + T visitLeft(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/MemberStatuses.java b/src/main/java/com/whop/api/types/MemberStatuses.java new file mode 100644 index 00000000..ee141c90 --- /dev/null +++ b/src/main/java/com/whop/api/types/MemberStatuses.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MemberStatuses { + public static final MemberStatuses LEFT = new MemberStatuses(Value.LEFT, "left"); + + public static final MemberStatuses JOINED = new MemberStatuses(Value.JOINED, "joined"); + + public static final MemberStatuses DRAFTED = new MemberStatuses(Value.DRAFTED, "drafted"); + + private final Value value; + + private final String string; + + MemberStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MemberStatuses && this.string.equals(((MemberStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LEFT: + return visitor.visitLeft(); + case JOINED: + return visitor.visitJoined(); + case DRAFTED: + return visitor.visitDrafted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MemberStatuses valueOf(String value) { + switch (value) { + case "left": + return LEFT; + case "joined": + return JOINED; + case "drafted": + return DRAFTED; + default: + return new MemberStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + DRAFTED, + + JOINED, + + LEFT, + + UNKNOWN + } + + public interface Visitor { + T visitDrafted(); + + T visitJoined(); + + T visitLeft(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/MembersSortableColumns.java b/src/main/java/com/whop/api/types/MembersSortableColumns.java new file mode 100644 index 00000000..ed566e18 --- /dev/null +++ b/src/main/java/com/whop/api/types/MembersSortableColumns.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MembersSortableColumns { + public static final MembersSortableColumns MOST_RECENT_ACTION = + new MembersSortableColumns(Value.MOST_RECENT_ACTION, "most_recent_action"); + + public static final MembersSortableColumns USD_TOTAL_SPENT = + new MembersSortableColumns(Value.USD_TOTAL_SPENT, "usd_total_spent"); + + public static final MembersSortableColumns JOINED_AT = new MembersSortableColumns(Value.JOINED_AT, "joined_at"); + + public static final MembersSortableColumns CREATED_AT = new MembersSortableColumns(Value.CREATED_AT, "created_at"); + + public static final MembersSortableColumns ID = new MembersSortableColumns(Value.ID, "id"); + + private final Value value; + + private final String string; + + MembersSortableColumns(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MembersSortableColumns + && this.string.equals(((MembersSortableColumns) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MOST_RECENT_ACTION: + return visitor.visitMostRecentAction(); + case USD_TOTAL_SPENT: + return visitor.visitUsdTotalSpent(); + case JOINED_AT: + return visitor.visitJoinedAt(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case ID: + return visitor.visitId(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MembersSortableColumns valueOf(String value) { + switch (value) { + case "most_recent_action": + return MOST_RECENT_ACTION; + case "usd_total_spent": + return USD_TOTAL_SPENT; + case "joined_at": + return JOINED_AT; + case "created_at": + return CREATED_AT; + case "id": + return ID; + default: + return new MembersSortableColumns(Value.UNKNOWN, value); + } + } + + public enum Value { + ID, + + USD_TOTAL_SPENT, + + CREATED_AT, + + JOINED_AT, + + MOST_RECENT_ACTION, + + UNKNOWN + } + + public interface Visitor { + T visitId(); + + T visitUsdTotalSpent(); + + T visitCreatedAt(); + + T visitJoinedAt(); + + T visitMostRecentAction(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Membership.java b/src/main/java/com/whop/api/types/Membership.java new file mode 100644 index 00000000..2d10142a --- /dev/null +++ b/src/main/java/com/whop/api/types/Membership.java @@ -0,0 +1,720 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Membership.Builder.class) +public final class Membership { + private final MembershipAccount account; + + private final boolean cancelAtPeriodEnd; + + private final String createdAt; + + private final Optional currentPeriodEnd; + + private final String id; + + private final Optional licenseKey; + + private final Optional member; + + private final Map metadata; + + private final String planId; + + private final String productId; + + private final MembershipStatus status; + + private final Optional userId; + + private final Map additionalProperties; + + private Membership( + MembershipAccount account, + boolean cancelAtPeriodEnd, + String createdAt, + Optional currentPeriodEnd, + String id, + Optional licenseKey, + Optional member, + Map metadata, + String planId, + String productId, + MembershipStatus status, + Optional userId, + Map additionalProperties) { + this.account = account; + this.cancelAtPeriodEnd = cancelAtPeriodEnd; + this.createdAt = createdAt; + this.currentPeriodEnd = currentPeriodEnd; + this.id = id; + this.licenseKey = licenseKey; + this.member = member; + this.metadata = metadata; + this.planId = planId; + this.productId = productId; + this.status = status; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account (seller) this membership belongs to. + */ + @JsonProperty("account") + public MembershipAccount getAccount() { + return account; + } + + /** + * @return Whether the membership is set to cancel when the current billing period ends. Only meaningful for recurring plans. + */ + @JsonProperty("cancel_at_period_end") + public boolean getCancelAtPeriodEnd() { + return cancelAtPeriodEnd; + } + + /** + * @return When the membership was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return When the current billing period renews, or when a non-renewing membership expires, as an ISO 8601 timestamp. null for one-time purchases with no expiration. + */ + @JsonIgnore + public Optional getCurrentPeriodEnd() { + if (currentPeriodEnd == null) { + return Optional.empty(); + } + return currentPeriodEnd; + } + + /** + * @return Membership ID, prefixed mem_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The software license key for this membership. Only present when the product includes a software licensing experience. + */ + @JsonIgnore + public Optional getLicenseKey() { + if (licenseKey == null) { + return Optional.empty(); + } + return licenseKey; + } + + /** + * @return The caller's member row on the account. Present only when the membership belongs to the caller; null on seller-side reads. + */ + @JsonIgnore + public Optional getMember() { + if (member == null) { + return Optional.empty(); + } + return member; + } + + /** + * @return Custom key-value pairs stored on the membership, commonly used for software licensing. + */ + @JsonProperty("metadata") + public Map getMetadata() { + return metadata; + } + + /** + * @return The plan the buyer purchased, prefixed plan_. + */ + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + /** + * @return The product this membership grants access to, prefixed prod_. + */ + @JsonProperty("product_id") + public String getProductId() { + return productId; + } + + /** + * @return Billing state of the membership. active/trialing memberships grant access; past_due is the grace period after a failed payment; completed one-time purchases keep access; canceled/expired do not. + */ + @JsonProperty("status") + public MembershipStatus getStatus() { + return status; + } + + /** + * @return The buyer, prefixed user_. null when the buyer is another business or the membership is unclaimed. + */ + @JsonIgnore + public Optional getUserId() { + if (userId == null) { + return Optional.empty(); + } + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("current_period_end") + private Optional _getCurrentPeriodEnd() { + return currentPeriodEnd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("license_key") + private Optional _getLicenseKey() { + return licenseKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member") + private Optional _getMember() { + return member; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_id") + private Optional _getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Membership && equalTo((Membership) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Membership other) { + return account.equals(other.account) + && cancelAtPeriodEnd == other.cancelAtPeriodEnd + && createdAt.equals(other.createdAt) + && currentPeriodEnd.equals(other.currentPeriodEnd) + && id.equals(other.id) + && licenseKey.equals(other.licenseKey) + && member.equals(other.member) + && metadata.equals(other.metadata) + && planId.equals(other.planId) + && productId.equals(other.productId) + && status.equals(other.status) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.account, + this.cancelAtPeriodEnd, + this.createdAt, + this.currentPeriodEnd, + this.id, + this.licenseKey, + this.member, + this.metadata, + this.planId, + this.productId, + this.status, + this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountStage builder() { + return new Builder(); + } + + public interface AccountStage { + /** + *

The account (seller) this membership belongs to.

+ */ + CancelAtPeriodEndStage account(@NotNull MembershipAccount account); + + Builder from(Membership other); + } + + public interface CancelAtPeriodEndStage { + /** + *

Whether the membership is set to cancel when the current billing period ends. Only meaningful for recurring plans.

+ */ + CreatedAtStage cancelAtPeriodEnd(boolean cancelAtPeriodEnd); + } + + public interface CreatedAtStage { + /** + *

When the membership was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Membership ID, prefixed mem_.

+ */ + PlanIdStage id(@NotNull String id); + } + + public interface PlanIdStage { + /** + *

The plan the buyer purchased, prefixed plan_.

+ */ + ProductIdStage planId(@NotNull String planId); + } + + public interface ProductIdStage { + /** + *

The product this membership grants access to, prefixed prod_.

+ */ + StatusStage productId(@NotNull String productId); + } + + public interface StatusStage { + /** + *

Billing state of the membership. active/trialing memberships grant access; past_due is the grace period after a failed payment; completed one-time purchases keep access; canceled/expired do not.

+ */ + _FinalStage status(@NotNull MembershipStatus status); + } + + public interface _FinalStage { + Membership build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When the current billing period renews, or when a non-renewing membership expires, as an ISO 8601 timestamp. null for one-time purchases with no expiration.

+ */ + _FinalStage currentPeriodEnd(Optional currentPeriodEnd); + + _FinalStage currentPeriodEnd(String currentPeriodEnd); + + _FinalStage currentPeriodEnd(Nullable currentPeriodEnd); + + /** + *

The software license key for this membership. Only present when the product includes a software licensing experience.

+ */ + _FinalStage licenseKey(Optional licenseKey); + + _FinalStage licenseKey(String licenseKey); + + _FinalStage licenseKey(Nullable licenseKey); + + /** + *

The caller's member row on the account. Present only when the membership belongs to the caller; null on seller-side reads.

+ */ + _FinalStage member(Optional member); + + _FinalStage member(MembershipMember member); + + _FinalStage member(Nullable member); + + /** + *

Custom key-value pairs stored on the membership, commonly used for software licensing.

+ */ + _FinalStage metadata(Map metadata); + + _FinalStage putAllMetadata(Map metadata); + + _FinalStage metadata(String key, Object value); + + /** + *

The buyer, prefixed user_. null when the buyer is another business or the membership is unclaimed.

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + + _FinalStage userId(Nullable userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountStage, + CancelAtPeriodEndStage, + CreatedAtStage, + IdStage, + PlanIdStage, + ProductIdStage, + StatusStage, + _FinalStage { + private MembershipAccount account; + + private boolean cancelAtPeriodEnd; + + private String createdAt; + + private String id; + + private String planId; + + private String productId; + + private MembershipStatus status; + + private Optional userId = Optional.empty(); + + private Map metadata = new LinkedHashMap<>(); + + private Optional member = Optional.empty(); + + private Optional licenseKey = Optional.empty(); + + private Optional currentPeriodEnd = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Membership other) { + account(other.getAccount()); + cancelAtPeriodEnd(other.getCancelAtPeriodEnd()); + createdAt(other.getCreatedAt()); + currentPeriodEnd(other.getCurrentPeriodEnd()); + id(other.getId()); + licenseKey(other.getLicenseKey()); + member(other.getMember()); + metadata(other.getMetadata()); + planId(other.getPlanId()); + productId(other.getProductId()); + status(other.getStatus()); + userId(other.getUserId()); + return this; + } + + /** + *

The account (seller) this membership belongs to.

+ *

The account (seller) this membership belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account") + public CancelAtPeriodEndStage account(@NotNull MembershipAccount account) { + this.account = Objects.requireNonNull(account, "account must not be null"); + return this; + } + + /** + *

Whether the membership is set to cancel when the current billing period ends. Only meaningful for recurring plans.

+ *

Whether the membership is set to cancel when the current billing period ends. Only meaningful for recurring plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cancel_at_period_end") + public CreatedAtStage cancelAtPeriodEnd(boolean cancelAtPeriodEnd) { + this.cancelAtPeriodEnd = cancelAtPeriodEnd; + return this; + } + + /** + *

When the membership was created, as an ISO 8601 timestamp.

+ *

When the membership was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Membership ID, prefixed mem_.

+ *

Membership ID, prefixed mem_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PlanIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The plan the buyer purchased, prefixed plan_.

+ *

The plan the buyer purchased, prefixed plan_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan_id") + public ProductIdStage planId(@NotNull String planId) { + this.planId = Objects.requireNonNull(planId, "planId must not be null"); + return this; + } + + /** + *

The product this membership grants access to, prefixed prod_.

+ *

The product this membership grants access to, prefixed prod_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("product_id") + public StatusStage productId(@NotNull String productId) { + this.productId = Objects.requireNonNull(productId, "productId must not be null"); + return this; + } + + /** + *

Billing state of the membership. active/trialing memberships grant access; past_due is the grace period after a failed payment; completed one-time purchases keep access; canceled/expired do not.

+ *

Billing state of the membership. active/trialing memberships grant access; past_due is the grace period after a failed payment; completed one-time purchases keep access; canceled/expired do not.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull MembershipStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The buyer, prefixed user_. null when the buyer is another business or the membership is unclaimed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(Nullable userId) { + if (userId.isNull()) { + this.userId = null; + } else if (userId.isEmpty()) { + this.userId = Optional.empty(); + } else { + this.userId = Optional.of(userId.get()); + } + return this; + } + + /** + *

The buyer, prefixed user_. null when the buyer is another business or the membership is unclaimed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + /** + *

The buyer, prefixed user_. null when the buyer is another business or the membership is unclaimed.

+ */ + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + /** + *

Custom key-value pairs stored on the membership, commonly used for software licensing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(String key, Object value) { + this.metadata.put(key, value); + return this; + } + + /** + *

Custom key-value pairs stored on the membership, commonly used for software licensing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllMetadata(Map metadata) { + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Custom key-value pairs stored on the membership, commonly used for software licensing.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Map metadata) { + this.metadata.clear(); + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

The caller's member row on the account. Present only when the membership belongs to the caller; null on seller-side reads.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(Nullable member) { + if (member.isNull()) { + this.member = null; + } else if (member.isEmpty()) { + this.member = Optional.empty(); + } else { + this.member = Optional.of(member.get()); + } + return this; + } + + /** + *

The caller's member row on the account. Present only when the membership belongs to the caller; null on seller-side reads.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(MembershipMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + /** + *

The caller's member row on the account. Present only when the membership belongs to the caller; null on seller-side reads.

+ */ + @java.lang.Override + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public _FinalStage member(Optional member) { + this.member = member; + return this; + } + + /** + *

The software license key for this membership. Only present when the product includes a software licensing experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage licenseKey(Nullable licenseKey) { + if (licenseKey.isNull()) { + this.licenseKey = null; + } else if (licenseKey.isEmpty()) { + this.licenseKey = Optional.empty(); + } else { + this.licenseKey = Optional.of(licenseKey.get()); + } + return this; + } + + /** + *

The software license key for this membership. Only present when the product includes a software licensing experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage licenseKey(String licenseKey) { + this.licenseKey = Optional.ofNullable(licenseKey); + return this; + } + + /** + *

The software license key for this membership. Only present when the product includes a software licensing experience.

+ */ + @java.lang.Override + @JsonSetter(value = "license_key", nulls = Nulls.SKIP) + public _FinalStage licenseKey(Optional licenseKey) { + this.licenseKey = licenseKey; + return this; + } + + /** + *

When the current billing period renews, or when a non-renewing membership expires, as an ISO 8601 timestamp. null for one-time purchases with no expiration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentPeriodEnd(Nullable currentPeriodEnd) { + if (currentPeriodEnd.isNull()) { + this.currentPeriodEnd = null; + } else if (currentPeriodEnd.isEmpty()) { + this.currentPeriodEnd = Optional.empty(); + } else { + this.currentPeriodEnd = Optional.of(currentPeriodEnd.get()); + } + return this; + } + + /** + *

When the current billing period renews, or when a non-renewing membership expires, as an ISO 8601 timestamp. null for one-time purchases with no expiration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currentPeriodEnd(String currentPeriodEnd) { + this.currentPeriodEnd = Optional.ofNullable(currentPeriodEnd); + return this; + } + + /** + *

When the current billing period renews, or when a non-renewing membership expires, as an ISO 8601 timestamp. null for one-time purchases with no expiration.

+ */ + @java.lang.Override + @JsonSetter(value = "current_period_end", nulls = Nulls.SKIP) + public _FinalStage currentPeriodEnd(Optional currentPeriodEnd) { + this.currentPeriodEnd = currentPeriodEnd; + return this; + } + + @java.lang.Override + public Membership build() { + return new Membership( + account, + cancelAtPeriodEnd, + createdAt, + currentPeriodEnd, + id, + licenseKey, + member, + metadata, + planId, + productId, + status, + userId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MembershipAccount.java b/src/main/java/com/whop/api/types/MembershipAccount.java new file mode 100644 index 00000000..ca5716d0 --- /dev/null +++ b/src/main/java/com/whop/api/types/MembershipAccount.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MembershipAccount.Builder.class) +public final class MembershipAccount { + private final String id; + + private final Optional logoUrl; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private MembershipAccount( + String id, Optional logoUrl, String route, String title, Map additionalProperties) { + this.id = id; + this.logoUrl = logoUrl; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account logo image URL. + */ + @JsonIgnore + public Optional getLogoUrl() { + if (logoUrl == null) { + return Optional.empty(); + } + return logoUrl; + } + + /** + * @return Account public route identifier — the whop.com/{route} storefront path. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return Account display name. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo_url") + private Optional _getLogoUrl() { + return logoUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MembershipAccount && equalTo((MembershipAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MembershipAccount other) { + return id.equals(other.id) + && logoUrl.equals(other.logoUrl) + && route.equals(other.route) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.logoUrl, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID, prefixed biz_.

+ */ + RouteStage id(@NotNull String id); + + Builder from(MembershipAccount other); + } + + public interface RouteStage { + /** + *

Account public route identifier — the whop.com/{route} storefront path.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

Account display name.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + MembershipAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account logo image URL.

+ */ + _FinalStage logoUrl(Optional logoUrl); + + _FinalStage logoUrl(String logoUrl); + + _FinalStage logoUrl(Nullable logoUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + private Optional logoUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MembershipAccount other) { + id(other.getId()); + logoUrl(other.getLogoUrl()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ *

Account ID, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account public route identifier — the whop.com/{route} storefront path.

+ *

Account public route identifier — the whop.com/{route} storefront path.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

Account display name.

+ *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Account logo image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(Nullable logoUrl) { + if (logoUrl.isNull()) { + this.logoUrl = null; + } else if (logoUrl.isEmpty()) { + this.logoUrl = Optional.empty(); + } else { + this.logoUrl = Optional.of(logoUrl.get()); + } + return this; + } + + /** + *

Account logo image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(String logoUrl) { + this.logoUrl = Optional.ofNullable(logoUrl); + return this; + } + + /** + *

Account logo image URL.

+ */ + @java.lang.Override + @JsonSetter(value = "logo_url", nulls = Nulls.SKIP) + public _FinalStage logoUrl(Optional logoUrl) { + this.logoUrl = logoUrl; + return this; + } + + @java.lang.Override + public MembershipAccount build() { + return new MembershipAccount(id, logoUrl, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MembershipCancellationModes.java b/src/main/java/com/whop/api/types/MembershipCancellationModes.java new file mode 100644 index 00000000..97bcd9ee --- /dev/null +++ b/src/main/java/com/whop/api/types/MembershipCancellationModes.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MembershipCancellationModes { + public static final MembershipCancellationModes IMMEDIATE = + new MembershipCancellationModes(Value.IMMEDIATE, "immediate"); + + public static final MembershipCancellationModes AT_PERIOD_END = + new MembershipCancellationModes(Value.AT_PERIOD_END, "at_period_end"); + + private final Value value; + + private final String string; + + MembershipCancellationModes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MembershipCancellationModes + && this.string.equals(((MembershipCancellationModes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case IMMEDIATE: + return visitor.visitImmediate(); + case AT_PERIOD_END: + return visitor.visitAtPeriodEnd(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MembershipCancellationModes valueOf(String value) { + switch (value) { + case "immediate": + return IMMEDIATE; + case "at_period_end": + return AT_PERIOD_END; + default: + return new MembershipCancellationModes(Value.UNKNOWN, value); + } + } + + public enum Value { + AT_PERIOD_END, + + IMMEDIATE, + + UNKNOWN + } + + public interface Visitor { + T visitAtPeriodEnd(); + + T visitImmediate(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/MembershipListItem.java b/src/main/java/com/whop/api/types/MembershipListItem.java new file mode 100644 index 00000000..41854352 --- /dev/null +++ b/src/main/java/com/whop/api/types/MembershipListItem.java @@ -0,0 +1,1636 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MembershipListItem.Builder.class) +public final class MembershipListItem { + private final boolean cancelAtPeriodEnd; + + private final Optional cancelOption; + + private final Optional cancelationStatus; + + private final Optional canceledAt; + + private final Optional cancellationReason; + + private final Optional checkoutConfigurationId; + + private final MembershipListItemCompany company; + + private final OffsetDateTime createdAt; + + private final Optional currency; + + private final Optional formattedRenewalPrice; + + private final String id; + + private final String initialPricePaid; + + private final Optional joinedAt; + + private final Optional licenseKey; + + private final Optional manageUrl; + + private final Optional member; + + private final Optional> metadata; + + private final boolean paymentCollectionPaused; + + private final MembershipListItemPlan plan; + + private final MembershipListItemProduct product; + + private final Optional promoCode; + + private final Optional renewalPeriodEnd; + + private final Optional renewalPeriodStart; + + private final MembershipStatus status; + + private final OffsetDateTime updatedAt; + + private final Optional user; + + private final Map additionalProperties; + + private MembershipListItem( + boolean cancelAtPeriodEnd, + Optional cancelOption, + Optional cancelationStatus, + Optional canceledAt, + Optional cancellationReason, + Optional checkoutConfigurationId, + MembershipListItemCompany company, + OffsetDateTime createdAt, + Optional currency, + Optional formattedRenewalPrice, + String id, + String initialPricePaid, + Optional joinedAt, + Optional licenseKey, + Optional manageUrl, + Optional member, + Optional> metadata, + boolean paymentCollectionPaused, + MembershipListItemPlan plan, + MembershipListItemProduct product, + Optional promoCode, + Optional renewalPeriodEnd, + Optional renewalPeriodStart, + MembershipStatus status, + OffsetDateTime updatedAt, + Optional user, + Map additionalProperties) { + this.cancelAtPeriodEnd = cancelAtPeriodEnd; + this.cancelOption = cancelOption; + this.cancelationStatus = cancelationStatus; + this.canceledAt = canceledAt; + this.cancellationReason = cancellationReason; + this.checkoutConfigurationId = checkoutConfigurationId; + this.company = company; + this.createdAt = createdAt; + this.currency = currency; + this.formattedRenewalPrice = formattedRenewalPrice; + this.id = id; + this.initialPricePaid = initialPricePaid; + this.joinedAt = joinedAt; + this.licenseKey = licenseKey; + this.manageUrl = manageUrl; + this.member = member; + this.metadata = metadata; + this.paymentCollectionPaused = paymentCollectionPaused; + this.plan = plan; + this.product = product; + this.promoCode = promoCode; + this.renewalPeriodEnd = renewalPeriodEnd; + this.renewalPeriodStart = renewalPeriodStart; + this.status = status; + this.updatedAt = updatedAt; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether this membership is set to cancel at the end of the current billing cycle. Only applies to memberships with a recurring plan. + */ + @JsonProperty("cancel_at_period_end") + public boolean getCancelAtPeriodEnd() { + return cancelAtPeriodEnd; + } + + /** + * @return The category selected for why the member canceled (e.g. too_expensive, switching, missing_features). + */ + @JsonIgnore + public Optional getCancelOption() { + if (cancelOption == null) { + return Optional.empty(); + } + return cancelOption; + } + + /** + * @return Whether the customer is canceling, left, or was won back. Null if the membership has no cancellation reason or its cancellation state is indeterminate. + */ + @JsonIgnore + public Optional getCancelationStatus() { + if (cancelationStatus == null) { + return Optional.empty(); + } + return cancelationStatus; + } + + /** + * @return The time the customer initiated cancellation of this membership. As a Unix timestamp. Null if the membership has not been canceled. + */ + @JsonIgnore + public Optional getCanceledAt() { + if (canceledAt == null) { + return Optional.empty(); + } + return canceledAt; + } + + /** + * @return Free-text explanation provided by the customer when canceling. Null if the customer did not provide a reason. + */ + @JsonIgnore + public Optional getCancellationReason() { + if (cancellationReason == null) { + return Optional.empty(); + } + return cancellationReason; + } + + /** + * @return The ID of the checkout session/configuration that produced this membership, if any. Use this to map memberships back to the checkout configuration that created them. + */ + @JsonIgnore + public Optional getCheckoutConfigurationId() { + if (checkoutConfigurationId == null) { + return Optional.empty(); + } + return checkoutConfigurationId; + } + + /** + * @return The company this membership belongs to. + */ + @JsonProperty("company") + public MembershipListItemCompany getCompany() { + return company; + } + + /** + * @return The datetime the membership was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code for this membership's billing. Null if the membership is free. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return The recurring renewal price for this membership, formatted with currency symbol and billing interval. Null if the membership is not recurring. + */ + @JsonIgnore + public Optional getFormattedRenewalPrice() { + if (formattedRenewalPrice == null) { + return Optional.empty(); + } + return formattedRenewalPrice; + } + + /** + * @return The unique identifier for the membership. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The amount the customer paid when first purchasing this membership, formatted with currency symbol. + */ + @JsonProperty("initial_price_paid") + public String getInitialPricePaid() { + return initialPricePaid; + } + + /** + * @return The time the user first joined the company associated with this membership. As a Unix timestamp. Null if the member record does not exist. + */ + @JsonIgnore + public Optional getJoinedAt() { + if (joinedAt == null) { + return Optional.empty(); + } + return joinedAt; + } + + /** + * @return The software license key associated with this membership. Only present if the product includes a Whop Software Licensing experience. Null otherwise. + */ + @JsonIgnore + public Optional getLicenseKey() { + if (licenseKey == null) { + return Optional.empty(); + } + return licenseKey; + } + + /** + * @return The URL where the customer can view and manage this membership, including cancellation and plan changes. Null if no member record exists. + */ + @JsonIgnore + public Optional getManageUrl() { + if (manageUrl == null) { + return Optional.empty(); + } + return manageUrl; + } + + /** + * @return The member record linking the user to the company for this membership. Null if the member record has not been created yet. + */ + @JsonIgnore + public Optional getMember() { + if (member == null) { + return Optional.empty(); + } + return member; + } + + /** + * @return Custom key-value pairs for the membership (commonly used for software licensing, e.g., HWID). Max 50 keys, 100 chars per key, 500 chars per string value. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Whether recurring payment collection for this membership is temporarily paused by the company. + */ + @JsonProperty("payment_collection_paused") + public boolean getPaymentCollectionPaused() { + return paymentCollectionPaused; + } + + /** + * @return The plan the customer purchased to create this membership. + */ + @JsonProperty("plan") + public MembershipListItemPlan getPlan() { + return plan; + } + + /** + * @return The product this membership grants access to. + */ + @JsonProperty("product") + public MembershipListItemProduct getProduct() { + return product; + } + + /** + * @return The promotional code currently applied to this membership's billing. Null if no promo code is active. + */ + @JsonIgnore + public Optional getPromoCode() { + if (promoCode == null) { + return Optional.empty(); + } + return promoCode; + } + + /** + * @return The end of the current billing period for this recurring membership. As a Unix timestamp. Null if the membership is not recurring. + */ + @JsonIgnore + public Optional getRenewalPeriodEnd() { + if (renewalPeriodEnd == null) { + return Optional.empty(); + } + return renewalPeriodEnd; + } + + /** + * @return The start of the current billing period for this recurring membership. As a Unix timestamp. Null if the membership is not recurring. + */ + @JsonIgnore + public Optional getRenewalPeriodStart() { + if (renewalPeriodStart == null) { + return Optional.empty(); + } + return renewalPeriodStart; + } + + /** + * @return The current lifecycle status of the membership (e.g., active, trialing, past_due, canceled, expired, completed). + */ + @JsonProperty("status") + public MembershipStatus getStatus() { + return status; + } + + /** + * @return The datetime the membership was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user who owns this membership. Null if the user account has been deleted. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancel_option") + private Optional _getCancelOption() { + return cancelOption; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancelation_status") + private Optional _getCancelationStatus() { + return cancelationStatus; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("canceled_at") + private Optional _getCanceledAt() { + return canceledAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancellation_reason") + private Optional _getCancellationReason() { + return cancellationReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_configuration_id") + private Optional _getCheckoutConfigurationId() { + return checkoutConfigurationId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("formatted_renewal_price") + private Optional _getFormattedRenewalPrice() { + return formattedRenewalPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("joined_at") + private Optional _getJoinedAt() { + return joinedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("license_key") + private Optional _getLicenseKey() { + return licenseKey; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("manage_url") + private Optional _getManageUrl() { + return manageUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member") + private Optional _getMember() { + return member; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("promo_code") + private Optional _getPromoCode() { + return promoCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("renewal_period_end") + private Optional _getRenewalPeriodEnd() { + return renewalPeriodEnd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("renewal_period_start") + private Optional _getRenewalPeriodStart() { + return renewalPeriodStart; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MembershipListItem && equalTo((MembershipListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MembershipListItem other) { + return cancelAtPeriodEnd == other.cancelAtPeriodEnd + && cancelOption.equals(other.cancelOption) + && cancelationStatus.equals(other.cancelationStatus) + && canceledAt.equals(other.canceledAt) + && cancellationReason.equals(other.cancellationReason) + && checkoutConfigurationId.equals(other.checkoutConfigurationId) + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && formattedRenewalPrice.equals(other.formattedRenewalPrice) + && id.equals(other.id) + && initialPricePaid.equals(other.initialPricePaid) + && joinedAt.equals(other.joinedAt) + && licenseKey.equals(other.licenseKey) + && manageUrl.equals(other.manageUrl) + && member.equals(other.member) + && metadata.equals(other.metadata) + && paymentCollectionPaused == other.paymentCollectionPaused + && plan.equals(other.plan) + && product.equals(other.product) + && promoCode.equals(other.promoCode) + && renewalPeriodEnd.equals(other.renewalPeriodEnd) + && renewalPeriodStart.equals(other.renewalPeriodStart) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.cancelAtPeriodEnd, + this.cancelOption, + this.cancelationStatus, + this.canceledAt, + this.cancellationReason, + this.checkoutConfigurationId, + this.company, + this.createdAt, + this.currency, + this.formattedRenewalPrice, + this.id, + this.initialPricePaid, + this.joinedAt, + this.licenseKey, + this.manageUrl, + this.member, + this.metadata, + this.paymentCollectionPaused, + this.plan, + this.product, + this.promoCode, + this.renewalPeriodEnd, + this.renewalPeriodStart, + this.status, + this.updatedAt, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CancelAtPeriodEndStage builder() { + return new Builder(); + } + + public interface CancelAtPeriodEndStage { + /** + *

Whether this membership is set to cancel at the end of the current billing cycle. Only applies to memberships with a recurring plan.

+ */ + CompanyStage cancelAtPeriodEnd(boolean cancelAtPeriodEnd); + + Builder from(MembershipListItem other); + } + + public interface CompanyStage { + /** + *

The company this membership belongs to.

+ */ + CreatedAtStage company(@NotNull MembershipListItemCompany company); + } + + public interface CreatedAtStage { + /** + *

The datetime the membership was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the membership.

+ */ + InitialPricePaidStage id(@NotNull String id); + } + + public interface InitialPricePaidStage { + /** + *

The amount the customer paid when first purchasing this membership, formatted with currency symbol.

+ */ + PaymentCollectionPausedStage initialPricePaid(@NotNull String initialPricePaid); + } + + public interface PaymentCollectionPausedStage { + /** + *

Whether recurring payment collection for this membership is temporarily paused by the company.

+ */ + PlanStage paymentCollectionPaused(boolean paymentCollectionPaused); + } + + public interface PlanStage { + /** + *

The plan the customer purchased to create this membership.

+ */ + ProductStage plan(@NotNull MembershipListItemPlan plan); + } + + public interface ProductStage { + /** + *

The product this membership grants access to.

+ */ + StatusStage product(@NotNull MembershipListItemProduct product); + } + + public interface StatusStage { + /** + *

The current lifecycle status of the membership (e.g., active, trialing, past_due, canceled, expired, completed).

+ */ + UpdatedAtStage status(@NotNull MembershipStatus status); + } + + public interface UpdatedAtStage { + /** + *

The datetime the membership was last updated.

+ */ + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + MembershipListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The category selected for why the member canceled (e.g. too_expensive, switching, missing_features).

+ */ + _FinalStage cancelOption(Optional cancelOption); + + _FinalStage cancelOption(CancelOptions cancelOption); + + _FinalStage cancelOption(Nullable cancelOption); + + /** + *

Whether the customer is canceling, left, or was won back. Null if the membership has no cancellation reason or its cancellation state is indeterminate.

+ */ + _FinalStage cancelationStatus(Optional cancelationStatus); + + _FinalStage cancelationStatus(CancelationStatus cancelationStatus); + + _FinalStage cancelationStatus(Nullable cancelationStatus); + + /** + *

The time the customer initiated cancellation of this membership. As a Unix timestamp. Null if the membership has not been canceled.

+ */ + _FinalStage canceledAt(Optional canceledAt); + + _FinalStage canceledAt(OffsetDateTime canceledAt); + + _FinalStage canceledAt(Nullable canceledAt); + + /** + *

Free-text explanation provided by the customer when canceling. Null if the customer did not provide a reason.

+ */ + _FinalStage cancellationReason(Optional cancellationReason); + + _FinalStage cancellationReason(String cancellationReason); + + _FinalStage cancellationReason(Nullable cancellationReason); + + /** + *

The ID of the checkout session/configuration that produced this membership, if any. Use this to map memberships back to the checkout configuration that created them.

+ */ + _FinalStage checkoutConfigurationId(Optional checkoutConfigurationId); + + _FinalStage checkoutConfigurationId(String checkoutConfigurationId); + + _FinalStage checkoutConfigurationId(Nullable checkoutConfigurationId); + + /** + *

The three-letter ISO currency code for this membership's billing. Null if the membership is free.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(Currencies currency); + + _FinalStage currency(Nullable currency); + + /** + *

The recurring renewal price for this membership, formatted with currency symbol and billing interval. Null if the membership is not recurring.

+ */ + _FinalStage formattedRenewalPrice(Optional formattedRenewalPrice); + + _FinalStage formattedRenewalPrice(String formattedRenewalPrice); + + _FinalStage formattedRenewalPrice(Nullable formattedRenewalPrice); + + /** + *

The time the user first joined the company associated with this membership. As a Unix timestamp. Null if the member record does not exist.

+ */ + _FinalStage joinedAt(Optional joinedAt); + + _FinalStage joinedAt(OffsetDateTime joinedAt); + + _FinalStage joinedAt(Nullable joinedAt); + + /** + *

The software license key associated with this membership. Only present if the product includes a Whop Software Licensing experience. Null otherwise.

+ */ + _FinalStage licenseKey(Optional licenseKey); + + _FinalStage licenseKey(String licenseKey); + + _FinalStage licenseKey(Nullable licenseKey); + + /** + *

The URL where the customer can view and manage this membership, including cancellation and plan changes. Null if no member record exists.

+ */ + _FinalStage manageUrl(Optional manageUrl); + + _FinalStage manageUrl(String manageUrl); + + _FinalStage manageUrl(Nullable manageUrl); + + /** + *

The member record linking the user to the company for this membership. Null if the member record has not been created yet.

+ */ + _FinalStage member(Optional member); + + _FinalStage member(MembershipListItemMember member); + + _FinalStage member(Nullable member); + + /** + *

Custom key-value pairs for the membership (commonly used for software licensing, e.g., HWID). Max 50 keys, 100 chars per key, 500 chars per string value.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The promotional code currently applied to this membership's billing. Null if no promo code is active.

+ */ + _FinalStage promoCode(Optional promoCode); + + _FinalStage promoCode(MembershipListItemPromoCode promoCode); + + _FinalStage promoCode(Nullable promoCode); + + /** + *

The end of the current billing period for this recurring membership. As a Unix timestamp. Null if the membership is not recurring.

+ */ + _FinalStage renewalPeriodEnd(Optional renewalPeriodEnd); + + _FinalStage renewalPeriodEnd(OffsetDateTime renewalPeriodEnd); + + _FinalStage renewalPeriodEnd(Nullable renewalPeriodEnd); + + /** + *

The start of the current billing period for this recurring membership. As a Unix timestamp. Null if the membership is not recurring.

+ */ + _FinalStage renewalPeriodStart(Optional renewalPeriodStart); + + _FinalStage renewalPeriodStart(OffsetDateTime renewalPeriodStart); + + _FinalStage renewalPeriodStart(Nullable renewalPeriodStart); + + /** + *

The user who owns this membership. Null if the user account has been deleted.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(MembershipListItemUser user); + + _FinalStage user(Nullable user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CancelAtPeriodEndStage, + CompanyStage, + CreatedAtStage, + IdStage, + InitialPricePaidStage, + PaymentCollectionPausedStage, + PlanStage, + ProductStage, + StatusStage, + UpdatedAtStage, + _FinalStage { + private boolean cancelAtPeriodEnd; + + private MembershipListItemCompany company; + + private OffsetDateTime createdAt; + + private String id; + + private String initialPricePaid; + + private boolean paymentCollectionPaused; + + private MembershipListItemPlan plan; + + private MembershipListItemProduct product; + + private MembershipStatus status; + + private OffsetDateTime updatedAt; + + private Optional user = Optional.empty(); + + private Optional renewalPeriodStart = Optional.empty(); + + private Optional renewalPeriodEnd = Optional.empty(); + + private Optional promoCode = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional member = Optional.empty(); + + private Optional manageUrl = Optional.empty(); + + private Optional licenseKey = Optional.empty(); + + private Optional joinedAt = Optional.empty(); + + private Optional formattedRenewalPrice = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional checkoutConfigurationId = Optional.empty(); + + private Optional cancellationReason = Optional.empty(); + + private Optional canceledAt = Optional.empty(); + + private Optional cancelationStatus = Optional.empty(); + + private Optional cancelOption = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MembershipListItem other) { + cancelAtPeriodEnd(other.getCancelAtPeriodEnd()); + cancelOption(other.getCancelOption()); + cancelationStatus(other.getCancelationStatus()); + canceledAt(other.getCanceledAt()); + cancellationReason(other.getCancellationReason()); + checkoutConfigurationId(other.getCheckoutConfigurationId()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + formattedRenewalPrice(other.getFormattedRenewalPrice()); + id(other.getId()); + initialPricePaid(other.getInitialPricePaid()); + joinedAt(other.getJoinedAt()); + licenseKey(other.getLicenseKey()); + manageUrl(other.getManageUrl()); + member(other.getMember()); + metadata(other.getMetadata()); + paymentCollectionPaused(other.getPaymentCollectionPaused()); + plan(other.getPlan()); + product(other.getProduct()); + promoCode(other.getPromoCode()); + renewalPeriodEnd(other.getRenewalPeriodEnd()); + renewalPeriodStart(other.getRenewalPeriodStart()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + return this; + } + + /** + *

Whether this membership is set to cancel at the end of the current billing cycle. Only applies to memberships with a recurring plan.

+ *

Whether this membership is set to cancel at the end of the current billing cycle. Only applies to memberships with a recurring plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cancel_at_period_end") + public CompanyStage cancelAtPeriodEnd(boolean cancelAtPeriodEnd) { + this.cancelAtPeriodEnd = cancelAtPeriodEnd; + return this; + } + + /** + *

The company this membership belongs to.

+ *

The company this membership belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company") + public CreatedAtStage company(@NotNull MembershipListItemCompany company) { + this.company = Objects.requireNonNull(company, "company must not be null"); + return this; + } + + /** + *

The datetime the membership was created.

+ *

The datetime the membership was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the membership.

+ *

The unique identifier for the membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public InitialPricePaidStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The amount the customer paid when first purchasing this membership, formatted with currency symbol.

+ *

The amount the customer paid when first purchasing this membership, formatted with currency symbol.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("initial_price_paid") + public PaymentCollectionPausedStage initialPricePaid(@NotNull String initialPricePaid) { + this.initialPricePaid = Objects.requireNonNull(initialPricePaid, "initialPricePaid must not be null"); + return this; + } + + /** + *

Whether recurring payment collection for this membership is temporarily paused by the company.

+ *

Whether recurring payment collection for this membership is temporarily paused by the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_collection_paused") + public PlanStage paymentCollectionPaused(boolean paymentCollectionPaused) { + this.paymentCollectionPaused = paymentCollectionPaused; + return this; + } + + /** + *

The plan the customer purchased to create this membership.

+ *

The plan the customer purchased to create this membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan") + public ProductStage plan(@NotNull MembershipListItemPlan plan) { + this.plan = Objects.requireNonNull(plan, "plan must not be null"); + return this; + } + + /** + *

The product this membership grants access to.

+ *

The product this membership grants access to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("product") + public StatusStage product(@NotNull MembershipListItemProduct product) { + this.product = Objects.requireNonNull(product, "product must not be null"); + return this; + } + + /** + *

The current lifecycle status of the membership (e.g., active, trialing, past_due, canceled, expired, completed).

+ *

The current lifecycle status of the membership (e.g., active, trialing, past_due, canceled, expired, completed).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull MembershipStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The datetime the membership was last updated.

+ *

The datetime the membership was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user who owns this membership. Null if the user account has been deleted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The user who owns this membership. Null if the user account has been deleted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(MembershipListItemUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The user who owns this membership. Null if the user account has been deleted.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + /** + *

The start of the current billing period for this recurring membership. As a Unix timestamp. Null if the membership is not recurring.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage renewalPeriodStart(Nullable renewalPeriodStart) { + if (renewalPeriodStart.isNull()) { + this.renewalPeriodStart = null; + } else if (renewalPeriodStart.isEmpty()) { + this.renewalPeriodStart = Optional.empty(); + } else { + this.renewalPeriodStart = Optional.of(renewalPeriodStart.get()); + } + return this; + } + + /** + *

The start of the current billing period for this recurring membership. As a Unix timestamp. Null if the membership is not recurring.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage renewalPeriodStart(OffsetDateTime renewalPeriodStart) { + this.renewalPeriodStart = Optional.ofNullable(renewalPeriodStart); + return this; + } + + /** + *

The start of the current billing period for this recurring membership. As a Unix timestamp. Null if the membership is not recurring.

+ */ + @java.lang.Override + @JsonSetter(value = "renewal_period_start", nulls = Nulls.SKIP) + public _FinalStage renewalPeriodStart(Optional renewalPeriodStart) { + this.renewalPeriodStart = renewalPeriodStart; + return this; + } + + /** + *

The end of the current billing period for this recurring membership. As a Unix timestamp. Null if the membership is not recurring.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage renewalPeriodEnd(Nullable renewalPeriodEnd) { + if (renewalPeriodEnd.isNull()) { + this.renewalPeriodEnd = null; + } else if (renewalPeriodEnd.isEmpty()) { + this.renewalPeriodEnd = Optional.empty(); + } else { + this.renewalPeriodEnd = Optional.of(renewalPeriodEnd.get()); + } + return this; + } + + /** + *

The end of the current billing period for this recurring membership. As a Unix timestamp. Null if the membership is not recurring.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage renewalPeriodEnd(OffsetDateTime renewalPeriodEnd) { + this.renewalPeriodEnd = Optional.ofNullable(renewalPeriodEnd); + return this; + } + + /** + *

The end of the current billing period for this recurring membership. As a Unix timestamp. Null if the membership is not recurring.

+ */ + @java.lang.Override + @JsonSetter(value = "renewal_period_end", nulls = Nulls.SKIP) + public _FinalStage renewalPeriodEnd(Optional renewalPeriodEnd) { + this.renewalPeriodEnd = renewalPeriodEnd; + return this; + } + + /** + *

The promotional code currently applied to this membership's billing. Null if no promo code is active.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCode(Nullable promoCode) { + if (promoCode.isNull()) { + this.promoCode = null; + } else if (promoCode.isEmpty()) { + this.promoCode = Optional.empty(); + } else { + this.promoCode = Optional.of(promoCode.get()); + } + return this; + } + + /** + *

The promotional code currently applied to this membership's billing. Null if no promo code is active.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCode(MembershipListItemPromoCode promoCode) { + this.promoCode = Optional.ofNullable(promoCode); + return this; + } + + /** + *

The promotional code currently applied to this membership's billing. Null if no promo code is active.

+ */ + @java.lang.Override + @JsonSetter(value = "promo_code", nulls = Nulls.SKIP) + public _FinalStage promoCode(Optional promoCode) { + this.promoCode = promoCode; + return this; + } + + /** + *

Custom key-value pairs for the membership (commonly used for software licensing, e.g., HWID). Max 50 keys, 100 chars per key, 500 chars per string value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs for the membership (commonly used for software licensing, e.g., HWID). Max 50 keys, 100 chars per key, 500 chars per string value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs for the membership (commonly used for software licensing, e.g., HWID). Max 50 keys, 100 chars per key, 500 chars per string value.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The member record linking the user to the company for this membership. Null if the member record has not been created yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(Nullable member) { + if (member.isNull()) { + this.member = null; + } else if (member.isEmpty()) { + this.member = Optional.empty(); + } else { + this.member = Optional.of(member.get()); + } + return this; + } + + /** + *

The member record linking the user to the company for this membership. Null if the member record has not been created yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(MembershipListItemMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + /** + *

The member record linking the user to the company for this membership. Null if the member record has not been created yet.

+ */ + @java.lang.Override + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public _FinalStage member(Optional member) { + this.member = member; + return this; + } + + /** + *

The URL where the customer can view and manage this membership, including cancellation and plan changes. Null if no member record exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage manageUrl(Nullable manageUrl) { + if (manageUrl.isNull()) { + this.manageUrl = null; + } else if (manageUrl.isEmpty()) { + this.manageUrl = Optional.empty(); + } else { + this.manageUrl = Optional.of(manageUrl.get()); + } + return this; + } + + /** + *

The URL where the customer can view and manage this membership, including cancellation and plan changes. Null if no member record exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage manageUrl(String manageUrl) { + this.manageUrl = Optional.ofNullable(manageUrl); + return this; + } + + /** + *

The URL where the customer can view and manage this membership, including cancellation and plan changes. Null if no member record exists.

+ */ + @java.lang.Override + @JsonSetter(value = "manage_url", nulls = Nulls.SKIP) + public _FinalStage manageUrl(Optional manageUrl) { + this.manageUrl = manageUrl; + return this; + } + + /** + *

The software license key associated with this membership. Only present if the product includes a Whop Software Licensing experience. Null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage licenseKey(Nullable licenseKey) { + if (licenseKey.isNull()) { + this.licenseKey = null; + } else if (licenseKey.isEmpty()) { + this.licenseKey = Optional.empty(); + } else { + this.licenseKey = Optional.of(licenseKey.get()); + } + return this; + } + + /** + *

The software license key associated with this membership. Only present if the product includes a Whop Software Licensing experience. Null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage licenseKey(String licenseKey) { + this.licenseKey = Optional.ofNullable(licenseKey); + return this; + } + + /** + *

The software license key associated with this membership. Only present if the product includes a Whop Software Licensing experience. Null otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "license_key", nulls = Nulls.SKIP) + public _FinalStage licenseKey(Optional licenseKey) { + this.licenseKey = licenseKey; + return this; + } + + /** + *

The time the user first joined the company associated with this membership. As a Unix timestamp. Null if the member record does not exist.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage joinedAt(Nullable joinedAt) { + if (joinedAt.isNull()) { + this.joinedAt = null; + } else if (joinedAt.isEmpty()) { + this.joinedAt = Optional.empty(); + } else { + this.joinedAt = Optional.of(joinedAt.get()); + } + return this; + } + + /** + *

The time the user first joined the company associated with this membership. As a Unix timestamp. Null if the member record does not exist.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage joinedAt(OffsetDateTime joinedAt) { + this.joinedAt = Optional.ofNullable(joinedAt); + return this; + } + + /** + *

The time the user first joined the company associated with this membership. As a Unix timestamp. Null if the member record does not exist.

+ */ + @java.lang.Override + @JsonSetter(value = "joined_at", nulls = Nulls.SKIP) + public _FinalStage joinedAt(Optional joinedAt) { + this.joinedAt = joinedAt; + return this; + } + + /** + *

The recurring renewal price for this membership, formatted with currency symbol and billing interval. Null if the membership is not recurring.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage formattedRenewalPrice(Nullable formattedRenewalPrice) { + if (formattedRenewalPrice.isNull()) { + this.formattedRenewalPrice = null; + } else if (formattedRenewalPrice.isEmpty()) { + this.formattedRenewalPrice = Optional.empty(); + } else { + this.formattedRenewalPrice = Optional.of(formattedRenewalPrice.get()); + } + return this; + } + + /** + *

The recurring renewal price for this membership, formatted with currency symbol and billing interval. Null if the membership is not recurring.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage formattedRenewalPrice(String formattedRenewalPrice) { + this.formattedRenewalPrice = Optional.ofNullable(formattedRenewalPrice); + return this; + } + + /** + *

The recurring renewal price for this membership, formatted with currency symbol and billing interval. Null if the membership is not recurring.

+ */ + @java.lang.Override + @JsonSetter(value = "formatted_renewal_price", nulls = Nulls.SKIP) + public _FinalStage formattedRenewalPrice(Optional formattedRenewalPrice) { + this.formattedRenewalPrice = formattedRenewalPrice; + return this; + } + + /** + *

The three-letter ISO currency code for this membership's billing. Null if the membership is free.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

The three-letter ISO currency code for this membership's billing. Null if the membership is free.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Currencies currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

The three-letter ISO currency code for this membership's billing. Null if the membership is free.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + /** + *

The ID of the checkout session/configuration that produced this membership, if any. Use this to map memberships back to the checkout configuration that created them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfigurationId(Nullable checkoutConfigurationId) { + if (checkoutConfigurationId.isNull()) { + this.checkoutConfigurationId = null; + } else if (checkoutConfigurationId.isEmpty()) { + this.checkoutConfigurationId = Optional.empty(); + } else { + this.checkoutConfigurationId = Optional.of(checkoutConfigurationId.get()); + } + return this; + } + + /** + *

The ID of the checkout session/configuration that produced this membership, if any. Use this to map memberships back to the checkout configuration that created them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfigurationId(String checkoutConfigurationId) { + this.checkoutConfigurationId = Optional.ofNullable(checkoutConfigurationId); + return this; + } + + /** + *

The ID of the checkout session/configuration that produced this membership, if any. Use this to map memberships back to the checkout configuration that created them.

+ */ + @java.lang.Override + @JsonSetter(value = "checkout_configuration_id", nulls = Nulls.SKIP) + public _FinalStage checkoutConfigurationId(Optional checkoutConfigurationId) { + this.checkoutConfigurationId = checkoutConfigurationId; + return this; + } + + /** + *

Free-text explanation provided by the customer when canceling. Null if the customer did not provide a reason.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancellationReason(Nullable cancellationReason) { + if (cancellationReason.isNull()) { + this.cancellationReason = null; + } else if (cancellationReason.isEmpty()) { + this.cancellationReason = Optional.empty(); + } else { + this.cancellationReason = Optional.of(cancellationReason.get()); + } + return this; + } + + /** + *

Free-text explanation provided by the customer when canceling. Null if the customer did not provide a reason.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancellationReason(String cancellationReason) { + this.cancellationReason = Optional.ofNullable(cancellationReason); + return this; + } + + /** + *

Free-text explanation provided by the customer when canceling. Null if the customer did not provide a reason.

+ */ + @java.lang.Override + @JsonSetter(value = "cancellation_reason", nulls = Nulls.SKIP) + public _FinalStage cancellationReason(Optional cancellationReason) { + this.cancellationReason = cancellationReason; + return this; + } + + /** + *

The time the customer initiated cancellation of this membership. As a Unix timestamp. Null if the membership has not been canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(Nullable canceledAt) { + if (canceledAt.isNull()) { + this.canceledAt = null; + } else if (canceledAt.isEmpty()) { + this.canceledAt = Optional.empty(); + } else { + this.canceledAt = Optional.of(canceledAt.get()); + } + return this; + } + + /** + *

The time the customer initiated cancellation of this membership. As a Unix timestamp. Null if the membership has not been canceled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage canceledAt(OffsetDateTime canceledAt) { + this.canceledAt = Optional.ofNullable(canceledAt); + return this; + } + + /** + *

The time the customer initiated cancellation of this membership. As a Unix timestamp. Null if the membership has not been canceled.

+ */ + @java.lang.Override + @JsonSetter(value = "canceled_at", nulls = Nulls.SKIP) + public _FinalStage canceledAt(Optional canceledAt) { + this.canceledAt = canceledAt; + return this; + } + + /** + *

Whether the customer is canceling, left, or was won back. Null if the membership has no cancellation reason or its cancellation state is indeterminate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelationStatus(Nullable cancelationStatus) { + if (cancelationStatus.isNull()) { + this.cancelationStatus = null; + } else if (cancelationStatus.isEmpty()) { + this.cancelationStatus = Optional.empty(); + } else { + this.cancelationStatus = Optional.of(cancelationStatus.get()); + } + return this; + } + + /** + *

Whether the customer is canceling, left, or was won back. Null if the membership has no cancellation reason or its cancellation state is indeterminate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelationStatus(CancelationStatus cancelationStatus) { + this.cancelationStatus = Optional.ofNullable(cancelationStatus); + return this; + } + + /** + *

Whether the customer is canceling, left, or was won back. Null if the membership has no cancellation reason or its cancellation state is indeterminate.

+ */ + @java.lang.Override + @JsonSetter(value = "cancelation_status", nulls = Nulls.SKIP) + public _FinalStage cancelationStatus(Optional cancelationStatus) { + this.cancelationStatus = cancelationStatus; + return this; + } + + /** + *

The category selected for why the member canceled (e.g. too_expensive, switching, missing_features).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelOption(Nullable cancelOption) { + if (cancelOption.isNull()) { + this.cancelOption = null; + } else if (cancelOption.isEmpty()) { + this.cancelOption = Optional.empty(); + } else { + this.cancelOption = Optional.of(cancelOption.get()); + } + return this; + } + + /** + *

The category selected for why the member canceled (e.g. too_expensive, switching, missing_features).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelOption(CancelOptions cancelOption) { + this.cancelOption = Optional.ofNullable(cancelOption); + return this; + } + + /** + *

The category selected for why the member canceled (e.g. too_expensive, switching, missing_features).

+ */ + @java.lang.Override + @JsonSetter(value = "cancel_option", nulls = Nulls.SKIP) + public _FinalStage cancelOption(Optional cancelOption) { + this.cancelOption = cancelOption; + return this; + } + + @java.lang.Override + public MembershipListItem build() { + return new MembershipListItem( + cancelAtPeriodEnd, + cancelOption, + cancelationStatus, + canceledAt, + cancellationReason, + checkoutConfigurationId, + company, + createdAt, + currency, + formattedRenewalPrice, + id, + initialPricePaid, + joinedAt, + licenseKey, + manageUrl, + member, + metadata, + paymentCollectionPaused, + plan, + product, + promoCode, + renewalPeriodEnd, + renewalPeriodStart, + status, + updatedAt, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MembershipListItemCompany.java b/src/main/java/com/whop/api/types/MembershipListItemCompany.java new file mode 100644 index 00000000..51e747c0 --- /dev/null +++ b/src/main/java/com/whop/api/types/MembershipListItemCompany.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MembershipListItemCompany.Builder.class) +public final class MembershipListItemCompany { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private MembershipListItemCompany(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MembershipListItemCompany && equalTo((MembershipListItemCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MembershipListItemCompany other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + TitleStage id(@NotNull String id); + + Builder from(MembershipListItemCompany other); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + MembershipListItemCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MembershipListItemCompany other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public MembershipListItemCompany build() { + return new MembershipListItemCompany(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MembershipListItemMember.java b/src/main/java/com/whop/api/types/MembershipListItemMember.java new file mode 100644 index 00000000..b0614617 --- /dev/null +++ b/src/main/java/com/whop/api/types/MembershipListItemMember.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MembershipListItemMember.Builder.class) +public final class MembershipListItemMember { + private final String id; + + private final Map additionalProperties; + + private MembershipListItemMember(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the member. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MembershipListItemMember && equalTo((MembershipListItemMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MembershipListItemMember other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the member.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(MembershipListItemMember other); + } + + public interface _FinalStage { + MembershipListItemMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MembershipListItemMember other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the member.

+ *

The unique identifier for the member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public MembershipListItemMember build() { + return new MembershipListItemMember(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MembershipListItemPlan.java b/src/main/java/com/whop/api/types/MembershipListItemPlan.java new file mode 100644 index 00000000..cac5cbfe --- /dev/null +++ b/src/main/java/com/whop/api/types/MembershipListItemPlan.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MembershipListItemPlan.Builder.class) +public final class MembershipListItemPlan { + private final String id; + + private final Optional> metadata; + + private final Map additionalProperties; + + private MembershipListItemPlan( + String id, Optional> metadata, Map additionalProperties) { + this.id = id; + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the plan. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MembershipListItemPlan && equalTo((MembershipListItemPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MembershipListItemPlan other) { + return id.equals(other.id) && metadata.equals(other.metadata); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.metadata); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the plan.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(MembershipListItemPlan other); + } + + public interface _FinalStage { + MembershipListItemPlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional> metadata = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MembershipListItemPlan other) { + id(other.getId()); + metadata(other.getMetadata()); + return this; + } + + /** + *

The unique identifier for the plan.

+ *

The unique identifier for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + @java.lang.Override + public MembershipListItemPlan build() { + return new MembershipListItemPlan(id, metadata, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MembershipListItemProduct.java b/src/main/java/com/whop/api/types/MembershipListItemProduct.java new file mode 100644 index 00000000..b5193a7e --- /dev/null +++ b/src/main/java/com/whop/api/types/MembershipListItemProduct.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MembershipListItemProduct.Builder.class) +public final class MembershipListItemProduct { + private final String id; + + private final Optional> metadata; + + private final String title; + + private final Map additionalProperties; + + private MembershipListItemProduct( + String id, Optional> metadata, String title, Map additionalProperties) { + this.id = id; + this.metadata = metadata; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the product. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The display name of the product shown to customers on the product page and in search results. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MembershipListItemProduct && equalTo((MembershipListItemProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MembershipListItemProduct other) { + return id.equals(other.id) && metadata.equals(other.metadata) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.metadata, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the product.

+ */ + TitleStage id(@NotNull String id); + + Builder from(MembershipListItemProduct other); + } + + public interface TitleStage { + /** + *

The display name of the product shown to customers on the product page and in search results.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + MembershipListItemProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + private Optional> metadata = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MembershipListItemProduct other) { + id(other.getId()); + metadata(other.getMetadata()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the product.

+ *

The unique identifier for the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the product shown to customers on the product page and in search results.

+ *

The display name of the product shown to customers on the product page and in search results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + @java.lang.Override + public MembershipListItemProduct build() { + return new MembershipListItemProduct(id, metadata, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MembershipListItemPromoCode.java b/src/main/java/com/whop/api/types/MembershipListItemPromoCode.java new file mode 100644 index 00000000..b3589859 --- /dev/null +++ b/src/main/java/com/whop/api/types/MembershipListItemPromoCode.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MembershipListItemPromoCode.Builder.class) +public final class MembershipListItemPromoCode { + private final String id; + + private final Map additionalProperties; + + private MembershipListItemPromoCode(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the promo code. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MembershipListItemPromoCode && equalTo((MembershipListItemPromoCode) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MembershipListItemPromoCode other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the promo code.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(MembershipListItemPromoCode other); + } + + public interface _FinalStage { + MembershipListItemPromoCode build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MembershipListItemPromoCode other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the promo code.

+ *

The unique identifier for the promo code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public MembershipListItemPromoCode build() { + return new MembershipListItemPromoCode(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MembershipListItemUser.java b/src/main/java/com/whop/api/types/MembershipListItemUser.java new file mode 100644 index 00000000..d3e2926b --- /dev/null +++ b/src/main/java/com/whop/api/types/MembershipListItemUser.java @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MembershipListItemUser.Builder.class) +public final class MembershipListItemUser { + private final Optional email; + + private final String id; + + private final Optional name; + + private final String profilePic; + + private final String username; + + private final Map additionalProperties; + + private MembershipListItemUser( + Optional email, + String id, + Optional name, + String profilePic, + String username, + Map additionalProperties) { + this.email = email; + this.id = id; + this.name = name; + this.profilePic = profilePic; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's email address. Requires the member:email:read permission to access. Null if not authorized. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The URL of the user's profile picture. Use profilePicture for the full attachment object. + */ + @JsonProperty("profile_pic") + public String getProfilePic() { + return profilePic; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MembershipListItemUser && equalTo((MembershipListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MembershipListItemUser other) { + return email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && profilePic.equals(other.profilePic) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.id, this.name, this.profilePic, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + ProfilePicStage id(@NotNull String id); + + Builder from(MembershipListItemUser other); + } + + public interface ProfilePicStage { + /** + *

The URL of the user's profile picture. Use profilePicture for the full attachment object.

+ */ + UsernameStage profilePic(@NotNull String profilePic); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + MembershipListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ProfilePicStage, UsernameStage, _FinalStage { + private String id; + + private String profilePic; + + private String username; + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MembershipListItemUser other) { + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + profilePic(other.getProfilePic()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ProfilePicStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The URL of the user's profile picture. Use profilePicture for the full attachment object.

+ *

The URL of the user's profile picture. Use profilePicture for the full attachment object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("profile_pic") + public UsernameStage profilePic(@NotNull String profilePic) { + this.profilePic = Objects.requireNonNull(profilePic, "profilePic must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public MembershipListItemUser build() { + return new MembershipListItemUser(email, id, name, profilePic, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MembershipMember.java b/src/main/java/com/whop/api/types/MembershipMember.java new file mode 100644 index 00000000..1f25c73b --- /dev/null +++ b/src/main/java/com/whop/api/types/MembershipMember.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MembershipMember.Builder.class) +public final class MembershipMember { + private final MembershipMemberAccessLevel accessLevel; + + private final Optional lastAccessedAt; + + private final Optional position; + + private final Map additionalProperties; + + private MembershipMember( + MembershipMemberAccessLevel accessLevel, + Optional lastAccessedAt, + Optional position, + Map additionalProperties) { + this.accessLevel = accessLevel; + this.lastAccessedAt = lastAccessedAt; + this.position = position; + this.additionalProperties = additionalProperties; + } + + /** + * @return What the member can reach on the account: customer for paying members, admin for team members, no_access once every grant has lapsed. + */ + @JsonProperty("access_level") + public MembershipMemberAccessLevel getAccessLevel() { + return accessLevel; + } + + /** + * @return When the member last opened the account's content, as an ISO 8601 timestamp. null if they never have. + */ + @JsonIgnore + public Optional getLastAccessedAt() { + if (lastAccessedAt == null) { + return Optional.empty(); + } + return lastAccessedAt; + } + + /** + * @return The member's sort position in the buyer's own account list. null until they arrange it. + */ + @JsonIgnore + public Optional getPosition() { + if (position == null) { + return Optional.empty(); + } + return position; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_accessed_at") + private Optional _getLastAccessedAt() { + return lastAccessedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("position") + private Optional _getPosition() { + return position; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MembershipMember && equalTo((MembershipMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MembershipMember other) { + return accessLevel.equals(other.accessLevel) + && lastAccessedAt.equals(other.lastAccessedAt) + && position.equals(other.position); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accessLevel, this.lastAccessedAt, this.position); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccessLevelStage builder() { + return new Builder(); + } + + public interface AccessLevelStage { + /** + *

What the member can reach on the account: customer for paying members, admin for team members, no_access once every grant has lapsed.

+ */ + _FinalStage accessLevel(@NotNull MembershipMemberAccessLevel accessLevel); + + Builder from(MembershipMember other); + } + + public interface _FinalStage { + MembershipMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When the member last opened the account's content, as an ISO 8601 timestamp. null if they never have.

+ */ + _FinalStage lastAccessedAt(Optional lastAccessedAt); + + _FinalStage lastAccessedAt(String lastAccessedAt); + + _FinalStage lastAccessedAt(Nullable lastAccessedAt); + + /** + *

The member's sort position in the buyer's own account list. null until they arrange it.

+ */ + _FinalStage position(Optional position); + + _FinalStage position(Double position); + + _FinalStage position(Nullable position); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccessLevelStage, _FinalStage { + private MembershipMemberAccessLevel accessLevel; + + private Optional position = Optional.empty(); + + private Optional lastAccessedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MembershipMember other) { + accessLevel(other.getAccessLevel()); + lastAccessedAt(other.getLastAccessedAt()); + position(other.getPosition()); + return this; + } + + /** + *

What the member can reach on the account: customer for paying members, admin for team members, no_access once every grant has lapsed.

+ *

What the member can reach on the account: customer for paying members, admin for team members, no_access once every grant has lapsed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("access_level") + public _FinalStage accessLevel(@NotNull MembershipMemberAccessLevel accessLevel) { + this.accessLevel = Objects.requireNonNull(accessLevel, "accessLevel must not be null"); + return this; + } + + /** + *

The member's sort position in the buyer's own account list. null until they arrange it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage position(Nullable position) { + if (position.isNull()) { + this.position = null; + } else if (position.isEmpty()) { + this.position = Optional.empty(); + } else { + this.position = Optional.of(position.get()); + } + return this; + } + + /** + *

The member's sort position in the buyer's own account list. null until they arrange it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage position(Double position) { + this.position = Optional.ofNullable(position); + return this; + } + + /** + *

The member's sort position in the buyer's own account list. null until they arrange it.

+ */ + @java.lang.Override + @JsonSetter(value = "position", nulls = Nulls.SKIP) + public _FinalStage position(Optional position) { + this.position = position; + return this; + } + + /** + *

When the member last opened the account's content, as an ISO 8601 timestamp. null if they never have.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastAccessedAt(Nullable lastAccessedAt) { + if (lastAccessedAt.isNull()) { + this.lastAccessedAt = null; + } else if (lastAccessedAt.isEmpty()) { + this.lastAccessedAt = Optional.empty(); + } else { + this.lastAccessedAt = Optional.of(lastAccessedAt.get()); + } + return this; + } + + /** + *

When the member last opened the account's content, as an ISO 8601 timestamp. null if they never have.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastAccessedAt(String lastAccessedAt) { + this.lastAccessedAt = Optional.ofNullable(lastAccessedAt); + return this; + } + + /** + *

When the member last opened the account's content, as an ISO 8601 timestamp. null if they never have.

+ */ + @java.lang.Override + @JsonSetter(value = "last_accessed_at", nulls = Nulls.SKIP) + public _FinalStage lastAccessedAt(Optional lastAccessedAt) { + this.lastAccessedAt = lastAccessedAt; + return this; + } + + @java.lang.Override + public MembershipMember build() { + return new MembershipMember(accessLevel, lastAccessedAt, position, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MembershipMemberAccessLevel.java b/src/main/java/com/whop/api/types/MembershipMemberAccessLevel.java new file mode 100644 index 00000000..236b8e14 --- /dev/null +++ b/src/main/java/com/whop/api/types/MembershipMemberAccessLevel.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MembershipMemberAccessLevel { + public static final MembershipMemberAccessLevel ADMIN = new MembershipMemberAccessLevel(Value.ADMIN, "admin"); + + public static final MembershipMemberAccessLevel CUSTOMER = + new MembershipMemberAccessLevel(Value.CUSTOMER, "customer"); + + public static final MembershipMemberAccessLevel NO_ACCESS = + new MembershipMemberAccessLevel(Value.NO_ACCESS, "no_access"); + + private final Value value; + + private final String string; + + MembershipMemberAccessLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MembershipMemberAccessLevel + && this.string.equals(((MembershipMemberAccessLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ADMIN: + return visitor.visitAdmin(); + case CUSTOMER: + return visitor.visitCustomer(); + case NO_ACCESS: + return visitor.visitNoAccess(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MembershipMemberAccessLevel valueOf(String value) { + switch (value) { + case "admin": + return ADMIN; + case "customer": + return CUSTOMER; + case "no_access": + return NO_ACCESS; + default: + return new MembershipMemberAccessLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + NO_ACCESS, + + ADMIN, + + CUSTOMER, + + UNKNOWN + } + + public interface Visitor { + T visitNoAccess(); + + T visitAdmin(); + + T visitCustomer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/MembershipStatus.java b/src/main/java/com/whop/api/types/MembershipStatus.java new file mode 100644 index 00000000..2ab220cc --- /dev/null +++ b/src/main/java/com/whop/api/types/MembershipStatus.java @@ -0,0 +1,153 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MembershipStatus { + public static final MembershipStatus PAST_DUE = new MembershipStatus(Value.PAST_DUE, "past_due"); + + public static final MembershipStatus CANCELED = new MembershipStatus(Value.CANCELED, "canceled"); + + public static final MembershipStatus COMPLETED = new MembershipStatus(Value.COMPLETED, "completed"); + + public static final MembershipStatus EXPIRED = new MembershipStatus(Value.EXPIRED, "expired"); + + public static final MembershipStatus DRAFTED = new MembershipStatus(Value.DRAFTED, "drafted"); + + public static final MembershipStatus CANCELING = new MembershipStatus(Value.CANCELING, "canceling"); + + public static final MembershipStatus TRIALING = new MembershipStatus(Value.TRIALING, "trialing"); + + public static final MembershipStatus UNRESOLVED = new MembershipStatus(Value.UNRESOLVED, "unresolved"); + + public static final MembershipStatus ACTIVE = new MembershipStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + MembershipStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MembershipStatus && this.string.equals(((MembershipStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAST_DUE: + return visitor.visitPastDue(); + case CANCELED: + return visitor.visitCanceled(); + case COMPLETED: + return visitor.visitCompleted(); + case EXPIRED: + return visitor.visitExpired(); + case DRAFTED: + return visitor.visitDrafted(); + case CANCELING: + return visitor.visitCanceling(); + case TRIALING: + return visitor.visitTrialing(); + case UNRESOLVED: + return visitor.visitUnresolved(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MembershipStatus valueOf(String value) { + switch (value) { + case "past_due": + return PAST_DUE; + case "canceled": + return CANCELED; + case "completed": + return COMPLETED; + case "expired": + return EXPIRED; + case "drafted": + return DRAFTED; + case "canceling": + return CANCELING; + case "trialing": + return TRIALING; + case "unresolved": + return UNRESOLVED; + case "active": + return ACTIVE; + default: + return new MembershipStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + TRIALING, + + ACTIVE, + + PAST_DUE, + + COMPLETED, + + CANCELED, + + EXPIRED, + + UNRESOLVED, + + DRAFTED, + + CANCELING, + + UNKNOWN + } + + public interface Visitor { + T visitTrialing(); + + T visitActive(); + + T visitPastDue(); + + T visitCompleted(); + + T visitCanceled(); + + T visitExpired(); + + T visitUnresolved(); + + T visitDrafted(); + + T visitCanceling(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/MembershipsSortableColumns.java b/src/main/java/com/whop/api/types/MembershipsSortableColumns.java new file mode 100644 index 00000000..95e59caa --- /dev/null +++ b/src/main/java/com/whop/api/types/MembershipsSortableColumns.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MembershipsSortableColumns { + public static final MembershipsSortableColumns STATUS = new MembershipsSortableColumns(Value.STATUS, "status"); + + public static final MembershipsSortableColumns DATE_JOINED = + new MembershipsSortableColumns(Value.DATE_JOINED, "date_joined"); + + public static final MembershipsSortableColumns CREATED_AT = + new MembershipsSortableColumns(Value.CREATED_AT, "created_at"); + + public static final MembershipsSortableColumns TOTAL_SPEND = + new MembershipsSortableColumns(Value.TOTAL_SPEND, "total_spend"); + + public static final MembershipsSortableColumns ID = new MembershipsSortableColumns(Value.ID, "id"); + + public static final MembershipsSortableColumns CANCELED_AT = + new MembershipsSortableColumns(Value.CANCELED_AT, "canceled_at"); + + private final Value value; + + private final String string; + + MembershipsSortableColumns(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MembershipsSortableColumns + && this.string.equals(((MembershipsSortableColumns) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case STATUS: + return visitor.visitStatus(); + case DATE_JOINED: + return visitor.visitDateJoined(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case TOTAL_SPEND: + return visitor.visitTotalSpend(); + case ID: + return visitor.visitId(); + case CANCELED_AT: + return visitor.visitCanceledAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MembershipsSortableColumns valueOf(String value) { + switch (value) { + case "status": + return STATUS; + case "date_joined": + return DATE_JOINED; + case "created_at": + return CREATED_AT; + case "total_spend": + return TOTAL_SPEND; + case "id": + return ID; + case "canceled_at": + return CANCELED_AT; + default: + return new MembershipsSortableColumns(Value.UNKNOWN, value); + } + } + + public enum Value { + ID, + + CREATED_AT, + + STATUS, + + CANCELED_AT, + + DATE_JOINED, + + TOTAL_SPEND, + + UNKNOWN + } + + public interface Visitor { + T visitId(); + + T visitCreatedAt(); + + T visitStatus(); + + T visitCanceledAt(); + + T visitDateJoined(); + + T visitTotalSpend(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Message.java b/src/main/java/com/whop/api/types/Message.java new file mode 100644 index 00000000..46aa740c --- /dev/null +++ b/src/main/java/com/whop/api/types/Message.java @@ -0,0 +1,884 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Message.Builder.class) +public final class Message { + private final Optional content; + + private final OffsetDateTime createdAt; + + private final String id; + + private final boolean isEdited; + + private final boolean isPinned; + + private final List mentions; + + private final boolean mentionsEveryone; + + private final DmsPostTypes messageType; + + private final Optional poll; + + private final List pollVotes; + + private final List reactionCounts; + + private final Optional replyingToMessageId; + + private final OffsetDateTime updatedAt; + + private final MessageUser user; + + private final Optional viewCount; + + private final Map additionalProperties; + + private Message( + Optional content, + OffsetDateTime createdAt, + String id, + boolean isEdited, + boolean isPinned, + List mentions, + boolean mentionsEveryone, + DmsPostTypes messageType, + Optional poll, + List pollVotes, + List reactionCounts, + Optional replyingToMessageId, + OffsetDateTime updatedAt, + MessageUser user, + Optional viewCount, + Map additionalProperties) { + this.content = content; + this.createdAt = createdAt; + this.id = id; + this.isEdited = isEdited; + this.isPinned = isPinned; + this.mentions = mentions; + this.mentionsEveryone = mentionsEveryone; + this.messageType = messageType; + this.poll = poll; + this.pollVotes = pollVotes; + this.reactionCounts = reactionCounts; + this.replyingToMessageId = replyingToMessageId; + this.updatedAt = updatedAt; + this.user = user; + this.viewCount = viewCount; + this.additionalProperties = additionalProperties; + } + + /** + * @return The message content formatted as Markdown. Null if the message has no text content. + */ + @JsonIgnore + public Optional getContent() { + if (content == null) { + return Optional.empty(); + } + return content; + } + + /** + * @return The timestamp when this message was originally created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whether the message content has been edited after it was originally sent. + */ + @JsonProperty("is_edited") + public boolean getIsEdited() { + return isEdited; + } + + /** + * @return Whether this message is pinned to the top of the channel for easy access. + */ + @JsonProperty("is_pinned") + public boolean getIsPinned() { + return isPinned; + } + + /** + * @return A list of user IDs that are explicitly mentioned in this message. + */ + @JsonProperty("mentions") + public List getMentions() { + return mentions; + } + + /** + * @return Whether the message includes an @everyone mention that notifies all channel members. + */ + @JsonProperty("mentions_everyone") + public boolean getMentionsEveryone() { + return mentionsEveryone; + } + + /** + * @return The classification of this message: regular, system, or automated. + */ + @JsonProperty("message_type") + public DmsPostTypes getMessageType() { + return messageType; + } + + /** + * @return A poll attached to this message. Null if the message does not contain a poll. + */ + @JsonIgnore + public Optional getPoll() { + if (poll == null) { + return Optional.empty(); + } + return poll; + } + + /** + * @return Aggregated reaction counts on this message, filtered to a specific reaction type. + */ + @JsonProperty("poll_votes") + public List getPollVotes() { + return pollVotes; + } + + /** + * @return Aggregated reaction counts on this message, filtered to a specific reaction type. + */ + @JsonProperty("reaction_counts") + public List getReactionCounts() { + return reactionCounts; + } + + /** + * @return The unique identifier of the message this post is replying to. Null if this is not a reply. + */ + @JsonIgnore + public Optional getReplyingToMessageId() { + if (replyingToMessageId == null) { + return Optional.empty(); + } + return replyingToMessageId; + } + + /** + * @return The timestamp when this message was last modified. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user who authored this message. + */ + @JsonProperty("user") + public MessageUser getUser() { + return user; + } + + /** + * @return The number of unique views this message has received. Null if view tracking is not enabled for this channel. + */ + @JsonIgnore + public Optional getViewCount() { + if (viewCount == null) { + return Optional.empty(); + } + return viewCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content") + private Optional _getContent() { + return content; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("poll") + private Optional _getPoll() { + return poll; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("replying_to_message_id") + private Optional _getReplyingToMessageId() { + return replyingToMessageId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("view_count") + private Optional _getViewCount() { + return viewCount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Message && equalTo((Message) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Message other) { + return content.equals(other.content) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && isEdited == other.isEdited + && isPinned == other.isPinned + && mentions.equals(other.mentions) + && mentionsEveryone == other.mentionsEveryone + && messageType.equals(other.messageType) + && poll.equals(other.poll) + && pollVotes.equals(other.pollVotes) + && reactionCounts.equals(other.reactionCounts) + && replyingToMessageId.equals(other.replyingToMessageId) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user) + && viewCount.equals(other.viewCount); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.content, + this.createdAt, + this.id, + this.isEdited, + this.isPinned, + this.mentions, + this.mentionsEveryone, + this.messageType, + this.poll, + this.pollVotes, + this.reactionCounts, + this.replyingToMessageId, + this.updatedAt, + this.user, + this.viewCount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The timestamp when this message was originally created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(Message other); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + IsEditedStage id(@NotNull String id); + } + + public interface IsEditedStage { + /** + *

Whether the message content has been edited after it was originally sent.

+ */ + IsPinnedStage isEdited(boolean isEdited); + } + + public interface IsPinnedStage { + /** + *

Whether this message is pinned to the top of the channel for easy access.

+ */ + MentionsEveryoneStage isPinned(boolean isPinned); + } + + public interface MentionsEveryoneStage { + /** + *

Whether the message includes an @everyone mention that notifies all channel members.

+ */ + MessageTypeStage mentionsEveryone(boolean mentionsEveryone); + } + + public interface MessageTypeStage { + /** + *

The classification of this message: regular, system, or automated.

+ */ + UpdatedAtStage messageType(@NotNull DmsPostTypes messageType); + } + + public interface UpdatedAtStage { + /** + *

The timestamp when this message was last modified.

+ */ + UserStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UserStage { + /** + *

The user who authored this message.

+ */ + _FinalStage user(@NotNull MessageUser user); + } + + public interface _FinalStage { + Message build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The message content formatted as Markdown. Null if the message has no text content.

+ */ + _FinalStage content(Optional content); + + _FinalStage content(String content); + + _FinalStage content(Nullable content); + + /** + *

A list of user IDs that are explicitly mentioned in this message.

+ */ + _FinalStage mentions(List mentions); + + _FinalStage addMentions(String mentions); + + _FinalStage addAllMentions(List mentions); + + /** + *

A poll attached to this message. Null if the message does not contain a poll.

+ */ + _FinalStage poll(Optional poll); + + _FinalStage poll(MessagePoll poll); + + _FinalStage poll(Nullable poll); + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ */ + _FinalStage pollVotes(List pollVotes); + + _FinalStage addPollVotes(MessagePollVotesItem pollVotes); + + _FinalStage addAllPollVotes(List pollVotes); + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ */ + _FinalStage reactionCounts(List reactionCounts); + + _FinalStage addReactionCounts(MessageReactionCountsItem reactionCounts); + + _FinalStage addAllReactionCounts(List reactionCounts); + + /** + *

The unique identifier of the message this post is replying to. Null if this is not a reply.

+ */ + _FinalStage replyingToMessageId(Optional replyingToMessageId); + + _FinalStage replyingToMessageId(String replyingToMessageId); + + _FinalStage replyingToMessageId(Nullable replyingToMessageId); + + /** + *

The number of unique views this message has received. Null if view tracking is not enabled for this channel.

+ */ + _FinalStage viewCount(Optional viewCount); + + _FinalStage viewCount(Integer viewCount); + + _FinalStage viewCount(Nullable viewCount); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + IdStage, + IsEditedStage, + IsPinnedStage, + MentionsEveryoneStage, + MessageTypeStage, + UpdatedAtStage, + UserStage, + _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private boolean isEdited; + + private boolean isPinned; + + private boolean mentionsEveryone; + + private DmsPostTypes messageType; + + private OffsetDateTime updatedAt; + + private MessageUser user; + + private Optional viewCount = Optional.empty(); + + private Optional replyingToMessageId = Optional.empty(); + + private List reactionCounts = new ArrayList<>(); + + private List pollVotes = new ArrayList<>(); + + private Optional poll = Optional.empty(); + + private List mentions = new ArrayList<>(); + + private Optional content = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Message other) { + content(other.getContent()); + createdAt(other.getCreatedAt()); + id(other.getId()); + isEdited(other.getIsEdited()); + isPinned(other.getIsPinned()); + mentions(other.getMentions()); + mentionsEveryone(other.getMentionsEveryone()); + messageType(other.getMessageType()); + poll(other.getPoll()); + pollVotes(other.getPollVotes()); + reactionCounts(other.getReactionCounts()); + replyingToMessageId(other.getReplyingToMessageId()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + viewCount(other.getViewCount()); + return this; + } + + /** + *

The timestamp when this message was originally created.

+ *

The timestamp when this message was originally created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsEditedStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether the message content has been edited after it was originally sent.

+ *

Whether the message content has been edited after it was originally sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_edited") + public IsPinnedStage isEdited(boolean isEdited) { + this.isEdited = isEdited; + return this; + } + + /** + *

Whether this message is pinned to the top of the channel for easy access.

+ *

Whether this message is pinned to the top of the channel for easy access.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_pinned") + public MentionsEveryoneStage isPinned(boolean isPinned) { + this.isPinned = isPinned; + return this; + } + + /** + *

Whether the message includes an @everyone mention that notifies all channel members.

+ *

Whether the message includes an @everyone mention that notifies all channel members.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("mentions_everyone") + public MessageTypeStage mentionsEveryone(boolean mentionsEveryone) { + this.mentionsEveryone = mentionsEveryone; + return this; + } + + /** + *

The classification of this message: regular, system, or automated.

+ *

The classification of this message: regular, system, or automated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message_type") + public UpdatedAtStage messageType(@NotNull DmsPostTypes messageType) { + this.messageType = Objects.requireNonNull(messageType, "messageType must not be null"); + return this; + } + + /** + *

The timestamp when this message was last modified.

+ *

The timestamp when this message was last modified.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UserStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user who authored this message.

+ *

The user who authored this message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull MessageUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

The number of unique views this message has received. Null if view tracking is not enabled for this channel.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage viewCount(Nullable viewCount) { + if (viewCount.isNull()) { + this.viewCount = null; + } else if (viewCount.isEmpty()) { + this.viewCount = Optional.empty(); + } else { + this.viewCount = Optional.of(viewCount.get()); + } + return this; + } + + /** + *

The number of unique views this message has received. Null if view tracking is not enabled for this channel.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage viewCount(Integer viewCount) { + this.viewCount = Optional.ofNullable(viewCount); + return this; + } + + /** + *

The number of unique views this message has received. Null if view tracking is not enabled for this channel.

+ */ + @java.lang.Override + @JsonSetter(value = "view_count", nulls = Nulls.SKIP) + public _FinalStage viewCount(Optional viewCount) { + this.viewCount = viewCount; + return this; + } + + /** + *

The unique identifier of the message this post is replying to. Null if this is not a reply.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage replyingToMessageId(Nullable replyingToMessageId) { + if (replyingToMessageId.isNull()) { + this.replyingToMessageId = null; + } else if (replyingToMessageId.isEmpty()) { + this.replyingToMessageId = Optional.empty(); + } else { + this.replyingToMessageId = Optional.of(replyingToMessageId.get()); + } + return this; + } + + /** + *

The unique identifier of the message this post is replying to. Null if this is not a reply.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage replyingToMessageId(String replyingToMessageId) { + this.replyingToMessageId = Optional.ofNullable(replyingToMessageId); + return this; + } + + /** + *

The unique identifier of the message this post is replying to. Null if this is not a reply.

+ */ + @java.lang.Override + @JsonSetter(value = "replying_to_message_id", nulls = Nulls.SKIP) + public _FinalStage replyingToMessageId(Optional replyingToMessageId) { + this.replyingToMessageId = replyingToMessageId; + return this; + } + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllReactionCounts(List reactionCounts) { + if (reactionCounts != null) { + this.reactionCounts.addAll(reactionCounts); + } + return this; + } + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addReactionCounts(MessageReactionCountsItem reactionCounts) { + this.reactionCounts.add(reactionCounts); + return this; + } + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ */ + @java.lang.Override + @JsonSetter(value = "reaction_counts", nulls = Nulls.SKIP) + public _FinalStage reactionCounts(List reactionCounts) { + this.reactionCounts.clear(); + if (reactionCounts != null) { + this.reactionCounts.addAll(reactionCounts); + } + return this; + } + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllPollVotes(List pollVotes) { + if (pollVotes != null) { + this.pollVotes.addAll(pollVotes); + } + return this; + } + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addPollVotes(MessagePollVotesItem pollVotes) { + this.pollVotes.add(pollVotes); + return this; + } + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ */ + @java.lang.Override + @JsonSetter(value = "poll_votes", nulls = Nulls.SKIP) + public _FinalStage pollVotes(List pollVotes) { + this.pollVotes.clear(); + if (pollVotes != null) { + this.pollVotes.addAll(pollVotes); + } + return this; + } + + /** + *

A poll attached to this message. Null if the message does not contain a poll.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage poll(Nullable poll) { + if (poll.isNull()) { + this.poll = null; + } else if (poll.isEmpty()) { + this.poll = Optional.empty(); + } else { + this.poll = Optional.of(poll.get()); + } + return this; + } + + /** + *

A poll attached to this message. Null if the message does not contain a poll.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage poll(MessagePoll poll) { + this.poll = Optional.ofNullable(poll); + return this; + } + + /** + *

A poll attached to this message. Null if the message does not contain a poll.

+ */ + @java.lang.Override + @JsonSetter(value = "poll", nulls = Nulls.SKIP) + public _FinalStage poll(Optional poll) { + this.poll = poll; + return this; + } + + /** + *

A list of user IDs that are explicitly mentioned in this message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllMentions(List mentions) { + if (mentions != null) { + this.mentions.addAll(mentions); + } + return this; + } + + /** + *

A list of user IDs that are explicitly mentioned in this message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addMentions(String mentions) { + this.mentions.add(mentions); + return this; + } + + /** + *

A list of user IDs that are explicitly mentioned in this message.

+ */ + @java.lang.Override + @JsonSetter(value = "mentions", nulls = Nulls.SKIP) + public _FinalStage mentions(List mentions) { + this.mentions.clear(); + if (mentions != null) { + this.mentions.addAll(mentions); + } + return this; + } + + /** + *

The message content formatted as Markdown. Null if the message has no text content.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(Nullable content) { + if (content.isNull()) { + this.content = null; + } else if (content.isEmpty()) { + this.content = Optional.empty(); + } else { + this.content = Optional.of(content.get()); + } + return this; + } + + /** + *

The message content formatted as Markdown. Null if the message has no text content.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

The message content formatted as Markdown. Null if the message has no text content.

+ */ + @java.lang.Override + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public _FinalStage content(Optional content) { + this.content = content; + return this; + } + + @java.lang.Override + public Message build() { + return new Message( + content, + createdAt, + id, + isEdited, + isPinned, + mentions, + mentionsEveryone, + messageType, + poll, + pollVotes, + reactionCounts, + replyingToMessageId, + updatedAt, + user, + viewCount, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MessageChannelOrder.java b/src/main/java/com/whop/api/types/MessageChannelOrder.java new file mode 100644 index 00000000..9f00eacd --- /dev/null +++ b/src/main/java/com/whop/api/types/MessageChannelOrder.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MessageChannelOrder { + public static final MessageChannelOrder LAST_POST_SENT_AT = + new MessageChannelOrder(Value.LAST_POST_SENT_AT, "last_post_sent_at"); + + public static final MessageChannelOrder CREATED_AT = new MessageChannelOrder(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + MessageChannelOrder(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MessageChannelOrder && this.string.equals(((MessageChannelOrder) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LAST_POST_SENT_AT: + return visitor.visitLastPostSentAt(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MessageChannelOrder valueOf(String value) { + switch (value) { + case "last_post_sent_at": + return LAST_POST_SENT_AT; + case "created_at": + return CREATED_AT; + default: + return new MessageChannelOrder(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED_AT, + + LAST_POST_SENT_AT, + + UNKNOWN + } + + public interface Visitor { + T visitCreatedAt(); + + T visitLastPostSentAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/MessageListItem.java b/src/main/java/com/whop/api/types/MessageListItem.java new file mode 100644 index 00000000..0a49c5e7 --- /dev/null +++ b/src/main/java/com/whop/api/types/MessageListItem.java @@ -0,0 +1,884 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MessageListItem.Builder.class) +public final class MessageListItem { + private final Optional content; + + private final OffsetDateTime createdAt; + + private final String id; + + private final boolean isEdited; + + private final boolean isPinned; + + private final List mentions; + + private final boolean mentionsEveryone; + + private final DmsPostTypes messageType; + + private final Optional poll; + + private final List pollVotes; + + private final List reactionCounts; + + private final Optional replyingToMessageId; + + private final OffsetDateTime updatedAt; + + private final MessageListItemUser user; + + private final Optional viewCount; + + private final Map additionalProperties; + + private MessageListItem( + Optional content, + OffsetDateTime createdAt, + String id, + boolean isEdited, + boolean isPinned, + List mentions, + boolean mentionsEveryone, + DmsPostTypes messageType, + Optional poll, + List pollVotes, + List reactionCounts, + Optional replyingToMessageId, + OffsetDateTime updatedAt, + MessageListItemUser user, + Optional viewCount, + Map additionalProperties) { + this.content = content; + this.createdAt = createdAt; + this.id = id; + this.isEdited = isEdited; + this.isPinned = isPinned; + this.mentions = mentions; + this.mentionsEveryone = mentionsEveryone; + this.messageType = messageType; + this.poll = poll; + this.pollVotes = pollVotes; + this.reactionCounts = reactionCounts; + this.replyingToMessageId = replyingToMessageId; + this.updatedAt = updatedAt; + this.user = user; + this.viewCount = viewCount; + this.additionalProperties = additionalProperties; + } + + /** + * @return The message content formatted as Markdown. Null if the message has no text content. + */ + @JsonIgnore + public Optional getContent() { + if (content == null) { + return Optional.empty(); + } + return content; + } + + /** + * @return The timestamp when this message was originally created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whether the message content has been edited after it was originally sent. + */ + @JsonProperty("is_edited") + public boolean getIsEdited() { + return isEdited; + } + + /** + * @return Whether this message is pinned to the top of the channel for easy access. + */ + @JsonProperty("is_pinned") + public boolean getIsPinned() { + return isPinned; + } + + /** + * @return A list of user IDs that are explicitly mentioned in this message. + */ + @JsonProperty("mentions") + public List getMentions() { + return mentions; + } + + /** + * @return Whether the message includes an @everyone mention that notifies all channel members. + */ + @JsonProperty("mentions_everyone") + public boolean getMentionsEveryone() { + return mentionsEveryone; + } + + /** + * @return The classification of this message: regular, system, or automated. + */ + @JsonProperty("message_type") + public DmsPostTypes getMessageType() { + return messageType; + } + + /** + * @return A poll attached to this message. Null if the message does not contain a poll. + */ + @JsonIgnore + public Optional getPoll() { + if (poll == null) { + return Optional.empty(); + } + return poll; + } + + /** + * @return Aggregated reaction counts on this message, filtered to a specific reaction type. + */ + @JsonProperty("poll_votes") + public List getPollVotes() { + return pollVotes; + } + + /** + * @return Aggregated reaction counts on this message, filtered to a specific reaction type. + */ + @JsonProperty("reaction_counts") + public List getReactionCounts() { + return reactionCounts; + } + + /** + * @return The unique identifier of the message this post is replying to. Null if this is not a reply. + */ + @JsonIgnore + public Optional getReplyingToMessageId() { + if (replyingToMessageId == null) { + return Optional.empty(); + } + return replyingToMessageId; + } + + /** + * @return The timestamp when this message was last modified. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user who authored this message. + */ + @JsonProperty("user") + public MessageListItemUser getUser() { + return user; + } + + /** + * @return The number of unique views this message has received. Null if view tracking is not enabled for this channel. + */ + @JsonIgnore + public Optional getViewCount() { + if (viewCount == null) { + return Optional.empty(); + } + return viewCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content") + private Optional _getContent() { + return content; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("poll") + private Optional _getPoll() { + return poll; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("replying_to_message_id") + private Optional _getReplyingToMessageId() { + return replyingToMessageId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("view_count") + private Optional _getViewCount() { + return viewCount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MessageListItem && equalTo((MessageListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MessageListItem other) { + return content.equals(other.content) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && isEdited == other.isEdited + && isPinned == other.isPinned + && mentions.equals(other.mentions) + && mentionsEveryone == other.mentionsEveryone + && messageType.equals(other.messageType) + && poll.equals(other.poll) + && pollVotes.equals(other.pollVotes) + && reactionCounts.equals(other.reactionCounts) + && replyingToMessageId.equals(other.replyingToMessageId) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user) + && viewCount.equals(other.viewCount); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.content, + this.createdAt, + this.id, + this.isEdited, + this.isPinned, + this.mentions, + this.mentionsEveryone, + this.messageType, + this.poll, + this.pollVotes, + this.reactionCounts, + this.replyingToMessageId, + this.updatedAt, + this.user, + this.viewCount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The timestamp when this message was originally created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(MessageListItem other); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + IsEditedStage id(@NotNull String id); + } + + public interface IsEditedStage { + /** + *

Whether the message content has been edited after it was originally sent.

+ */ + IsPinnedStage isEdited(boolean isEdited); + } + + public interface IsPinnedStage { + /** + *

Whether this message is pinned to the top of the channel for easy access.

+ */ + MentionsEveryoneStage isPinned(boolean isPinned); + } + + public interface MentionsEveryoneStage { + /** + *

Whether the message includes an @everyone mention that notifies all channel members.

+ */ + MessageTypeStage mentionsEveryone(boolean mentionsEveryone); + } + + public interface MessageTypeStage { + /** + *

The classification of this message: regular, system, or automated.

+ */ + UpdatedAtStage messageType(@NotNull DmsPostTypes messageType); + } + + public interface UpdatedAtStage { + /** + *

The timestamp when this message was last modified.

+ */ + UserStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UserStage { + /** + *

The user who authored this message.

+ */ + _FinalStage user(@NotNull MessageListItemUser user); + } + + public interface _FinalStage { + MessageListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The message content formatted as Markdown. Null if the message has no text content.

+ */ + _FinalStage content(Optional content); + + _FinalStage content(String content); + + _FinalStage content(Nullable content); + + /** + *

A list of user IDs that are explicitly mentioned in this message.

+ */ + _FinalStage mentions(List mentions); + + _FinalStage addMentions(String mentions); + + _FinalStage addAllMentions(List mentions); + + /** + *

A poll attached to this message. Null if the message does not contain a poll.

+ */ + _FinalStage poll(Optional poll); + + _FinalStage poll(MessageListItemPoll poll); + + _FinalStage poll(Nullable poll); + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ */ + _FinalStage pollVotes(List pollVotes); + + _FinalStage addPollVotes(MessageListItemPollVotesItem pollVotes); + + _FinalStage addAllPollVotes(List pollVotes); + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ */ + _FinalStage reactionCounts(List reactionCounts); + + _FinalStage addReactionCounts(MessageListItemReactionCountsItem reactionCounts); + + _FinalStage addAllReactionCounts(List reactionCounts); + + /** + *

The unique identifier of the message this post is replying to. Null if this is not a reply.

+ */ + _FinalStage replyingToMessageId(Optional replyingToMessageId); + + _FinalStage replyingToMessageId(String replyingToMessageId); + + _FinalStage replyingToMessageId(Nullable replyingToMessageId); + + /** + *

The number of unique views this message has received. Null if view tracking is not enabled for this channel.

+ */ + _FinalStage viewCount(Optional viewCount); + + _FinalStage viewCount(Integer viewCount); + + _FinalStage viewCount(Nullable viewCount); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + IdStage, + IsEditedStage, + IsPinnedStage, + MentionsEveryoneStage, + MessageTypeStage, + UpdatedAtStage, + UserStage, + _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private boolean isEdited; + + private boolean isPinned; + + private boolean mentionsEveryone; + + private DmsPostTypes messageType; + + private OffsetDateTime updatedAt; + + private MessageListItemUser user; + + private Optional viewCount = Optional.empty(); + + private Optional replyingToMessageId = Optional.empty(); + + private List reactionCounts = new ArrayList<>(); + + private List pollVotes = new ArrayList<>(); + + private Optional poll = Optional.empty(); + + private List mentions = new ArrayList<>(); + + private Optional content = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MessageListItem other) { + content(other.getContent()); + createdAt(other.getCreatedAt()); + id(other.getId()); + isEdited(other.getIsEdited()); + isPinned(other.getIsPinned()); + mentions(other.getMentions()); + mentionsEveryone(other.getMentionsEveryone()); + messageType(other.getMessageType()); + poll(other.getPoll()); + pollVotes(other.getPollVotes()); + reactionCounts(other.getReactionCounts()); + replyingToMessageId(other.getReplyingToMessageId()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + viewCount(other.getViewCount()); + return this; + } + + /** + *

The timestamp when this message was originally created.

+ *

The timestamp when this message was originally created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsEditedStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether the message content has been edited after it was originally sent.

+ *

Whether the message content has been edited after it was originally sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_edited") + public IsPinnedStage isEdited(boolean isEdited) { + this.isEdited = isEdited; + return this; + } + + /** + *

Whether this message is pinned to the top of the channel for easy access.

+ *

Whether this message is pinned to the top of the channel for easy access.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_pinned") + public MentionsEveryoneStage isPinned(boolean isPinned) { + this.isPinned = isPinned; + return this; + } + + /** + *

Whether the message includes an @everyone mention that notifies all channel members.

+ *

Whether the message includes an @everyone mention that notifies all channel members.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("mentions_everyone") + public MessageTypeStage mentionsEveryone(boolean mentionsEveryone) { + this.mentionsEveryone = mentionsEveryone; + return this; + } + + /** + *

The classification of this message: regular, system, or automated.

+ *

The classification of this message: regular, system, or automated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message_type") + public UpdatedAtStage messageType(@NotNull DmsPostTypes messageType) { + this.messageType = Objects.requireNonNull(messageType, "messageType must not be null"); + return this; + } + + /** + *

The timestamp when this message was last modified.

+ *

The timestamp when this message was last modified.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UserStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user who authored this message.

+ *

The user who authored this message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull MessageListItemUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

The number of unique views this message has received. Null if view tracking is not enabled for this channel.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage viewCount(Nullable viewCount) { + if (viewCount.isNull()) { + this.viewCount = null; + } else if (viewCount.isEmpty()) { + this.viewCount = Optional.empty(); + } else { + this.viewCount = Optional.of(viewCount.get()); + } + return this; + } + + /** + *

The number of unique views this message has received. Null if view tracking is not enabled for this channel.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage viewCount(Integer viewCount) { + this.viewCount = Optional.ofNullable(viewCount); + return this; + } + + /** + *

The number of unique views this message has received. Null if view tracking is not enabled for this channel.

+ */ + @java.lang.Override + @JsonSetter(value = "view_count", nulls = Nulls.SKIP) + public _FinalStage viewCount(Optional viewCount) { + this.viewCount = viewCount; + return this; + } + + /** + *

The unique identifier of the message this post is replying to. Null if this is not a reply.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage replyingToMessageId(Nullable replyingToMessageId) { + if (replyingToMessageId.isNull()) { + this.replyingToMessageId = null; + } else if (replyingToMessageId.isEmpty()) { + this.replyingToMessageId = Optional.empty(); + } else { + this.replyingToMessageId = Optional.of(replyingToMessageId.get()); + } + return this; + } + + /** + *

The unique identifier of the message this post is replying to. Null if this is not a reply.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage replyingToMessageId(String replyingToMessageId) { + this.replyingToMessageId = Optional.ofNullable(replyingToMessageId); + return this; + } + + /** + *

The unique identifier of the message this post is replying to. Null if this is not a reply.

+ */ + @java.lang.Override + @JsonSetter(value = "replying_to_message_id", nulls = Nulls.SKIP) + public _FinalStage replyingToMessageId(Optional replyingToMessageId) { + this.replyingToMessageId = replyingToMessageId; + return this; + } + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllReactionCounts(List reactionCounts) { + if (reactionCounts != null) { + this.reactionCounts.addAll(reactionCounts); + } + return this; + } + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addReactionCounts(MessageListItemReactionCountsItem reactionCounts) { + this.reactionCounts.add(reactionCounts); + return this; + } + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ */ + @java.lang.Override + @JsonSetter(value = "reaction_counts", nulls = Nulls.SKIP) + public _FinalStage reactionCounts(List reactionCounts) { + this.reactionCounts.clear(); + if (reactionCounts != null) { + this.reactionCounts.addAll(reactionCounts); + } + return this; + } + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllPollVotes(List pollVotes) { + if (pollVotes != null) { + this.pollVotes.addAll(pollVotes); + } + return this; + } + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addPollVotes(MessageListItemPollVotesItem pollVotes) { + this.pollVotes.add(pollVotes); + return this; + } + + /** + *

Aggregated reaction counts on this message, filtered to a specific reaction type.

+ */ + @java.lang.Override + @JsonSetter(value = "poll_votes", nulls = Nulls.SKIP) + public _FinalStage pollVotes(List pollVotes) { + this.pollVotes.clear(); + if (pollVotes != null) { + this.pollVotes.addAll(pollVotes); + } + return this; + } + + /** + *

A poll attached to this message. Null if the message does not contain a poll.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage poll(Nullable poll) { + if (poll.isNull()) { + this.poll = null; + } else if (poll.isEmpty()) { + this.poll = Optional.empty(); + } else { + this.poll = Optional.of(poll.get()); + } + return this; + } + + /** + *

A poll attached to this message. Null if the message does not contain a poll.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage poll(MessageListItemPoll poll) { + this.poll = Optional.ofNullable(poll); + return this; + } + + /** + *

A poll attached to this message. Null if the message does not contain a poll.

+ */ + @java.lang.Override + @JsonSetter(value = "poll", nulls = Nulls.SKIP) + public _FinalStage poll(Optional poll) { + this.poll = poll; + return this; + } + + /** + *

A list of user IDs that are explicitly mentioned in this message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllMentions(List mentions) { + if (mentions != null) { + this.mentions.addAll(mentions); + } + return this; + } + + /** + *

A list of user IDs that are explicitly mentioned in this message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addMentions(String mentions) { + this.mentions.add(mentions); + return this; + } + + /** + *

A list of user IDs that are explicitly mentioned in this message.

+ */ + @java.lang.Override + @JsonSetter(value = "mentions", nulls = Nulls.SKIP) + public _FinalStage mentions(List mentions) { + this.mentions.clear(); + if (mentions != null) { + this.mentions.addAll(mentions); + } + return this; + } + + /** + *

The message content formatted as Markdown. Null if the message has no text content.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(Nullable content) { + if (content.isNull()) { + this.content = null; + } else if (content.isEmpty()) { + this.content = Optional.empty(); + } else { + this.content = Optional.of(content.get()); + } + return this; + } + + /** + *

The message content formatted as Markdown. Null if the message has no text content.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

The message content formatted as Markdown. Null if the message has no text content.

+ */ + @java.lang.Override + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public _FinalStage content(Optional content) { + this.content = content; + return this; + } + + @java.lang.Override + public MessageListItem build() { + return new MessageListItem( + content, + createdAt, + id, + isEdited, + isPinned, + mentions, + mentionsEveryone, + messageType, + poll, + pollVotes, + reactionCounts, + replyingToMessageId, + updatedAt, + user, + viewCount, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MessageListItemPoll.java b/src/main/java/com/whop/api/types/MessageListItemPoll.java new file mode 100644 index 00000000..3d808bb3 --- /dev/null +++ b/src/main/java/com/whop/api/types/MessageListItemPoll.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MessageListItemPoll.Builder.class) +public final class MessageListItemPoll { + private final Optional> options; + + private final Map additionalProperties; + + private MessageListItemPoll( + Optional> options, Map additionalProperties) { + this.options = options; + this.additionalProperties = additionalProperties; + } + + /** + * @return The options for the poll + */ + @JsonIgnore + public Optional> getOptions() { + if (options == null) { + return Optional.empty(); + } + return options; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("options") + private Optional> _getOptions() { + return options; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MessageListItemPoll && equalTo((MessageListItemPoll) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MessageListItemPoll other) { + return options.equals(other.options); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.options); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> options = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MessageListItemPoll other) { + options(other.getOptions()); + return this; + } + + /** + *

The options for the poll

+ */ + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public Builder options(Optional> options) { + this.options = options; + return this; + } + + public Builder options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + public Builder options(Nullable> options) { + if (options.isNull()) { + this.options = null; + } else if (options.isEmpty()) { + this.options = Optional.empty(); + } else { + this.options = Optional.of(options.get()); + } + return this; + } + + public MessageListItemPoll build() { + return new MessageListItemPoll(options, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MessageListItemPollOptionsItem.java b/src/main/java/com/whop/api/types/MessageListItemPollOptionsItem.java new file mode 100644 index 00000000..8cce8ea3 --- /dev/null +++ b/src/main/java/com/whop/api/types/MessageListItemPollOptionsItem.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MessageListItemPollOptionsItem.Builder.class) +public final class MessageListItemPollOptionsItem { + private final String id; + + private final String text; + + private final Map additionalProperties; + + private MessageListItemPollOptionsItem(String id, String text, Map additionalProperties) { + this.id = id; + this.text = text; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the poll option. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The text of the poll option + */ + @JsonProperty("text") + public String getText() { + return text; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MessageListItemPollOptionsItem && equalTo((MessageListItemPollOptionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MessageListItemPollOptionsItem other) { + return id.equals(other.id) && text.equals(other.text); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.text); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the poll option.

+ */ + TextStage id(@NotNull String id); + + Builder from(MessageListItemPollOptionsItem other); + } + + public interface TextStage { + /** + *

The text of the poll option

+ */ + _FinalStage text(@NotNull String text); + } + + public interface _FinalStage { + MessageListItemPollOptionsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TextStage, _FinalStage { + private String id; + + private String text; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MessageListItemPollOptionsItem other) { + id(other.getId()); + text(other.getText()); + return this; + } + + /** + *

The unique identifier for the poll option.

+ *

The unique identifier for the poll option.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TextStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The text of the poll option

+ *

The text of the poll option

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("text") + public _FinalStage text(@NotNull String text) { + this.text = Objects.requireNonNull(text, "text must not be null"); + return this; + } + + @java.lang.Override + public MessageListItemPollOptionsItem build() { + return new MessageListItemPollOptionsItem(id, text, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MessageListItemPollVotesItem.java b/src/main/java/com/whop/api/types/MessageListItemPollVotesItem.java new file mode 100644 index 00000000..f4f90cc5 --- /dev/null +++ b/src/main/java/com/whop/api/types/MessageListItemPollVotesItem.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MessageListItemPollVotesItem.Builder.class) +public final class MessageListItemPollVotesItem { + private final int count; + + private final Optional optionId; + + private final Map additionalProperties; + + private MessageListItemPollVotesItem( + int count, Optional optionId, Map additionalProperties) { + this.count = count; + this.optionId = optionId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The number of users who reacted + */ + @JsonProperty("count") + public int getCount() { + return count; + } + + /** + * @return The reaction that was used + */ + @JsonIgnore + public Optional getOptionId() { + if (optionId == null) { + return Optional.empty(); + } + return optionId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("option_id") + private Optional _getOptionId() { + return optionId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MessageListItemPollVotesItem && equalTo((MessageListItemPollVotesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MessageListItemPollVotesItem other) { + return count == other.count && optionId.equals(other.optionId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.count, this.optionId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CountStage builder() { + return new Builder(); + } + + public interface CountStage { + /** + *

The number of users who reacted

+ */ + _FinalStage count(int count); + + Builder from(MessageListItemPollVotesItem other); + } + + public interface _FinalStage { + MessageListItemPollVotesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The reaction that was used

+ */ + _FinalStage optionId(Optional optionId); + + _FinalStage optionId(String optionId); + + _FinalStage optionId(Nullable optionId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CountStage, _FinalStage { + private int count; + + private Optional optionId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MessageListItemPollVotesItem other) { + count(other.getCount()); + optionId(other.getOptionId()); + return this; + } + + /** + *

The number of users who reacted

+ *

The number of users who reacted

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("count") + public _FinalStage count(int count) { + this.count = count; + return this; + } + + /** + *

The reaction that was used

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optionId(Nullable optionId) { + if (optionId.isNull()) { + this.optionId = null; + } else if (optionId.isEmpty()) { + this.optionId = Optional.empty(); + } else { + this.optionId = Optional.of(optionId.get()); + } + return this; + } + + /** + *

The reaction that was used

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optionId(String optionId) { + this.optionId = Optional.ofNullable(optionId); + return this; + } + + /** + *

The reaction that was used

+ */ + @java.lang.Override + @JsonSetter(value = "option_id", nulls = Nulls.SKIP) + public _FinalStage optionId(Optional optionId) { + this.optionId = optionId; + return this; + } + + @java.lang.Override + public MessageListItemPollVotesItem build() { + return new MessageListItemPollVotesItem(count, optionId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MessageListItemReactionCountsItem.java b/src/main/java/com/whop/api/types/MessageListItemReactionCountsItem.java new file mode 100644 index 00000000..b33bc499 --- /dev/null +++ b/src/main/java/com/whop/api/types/MessageListItemReactionCountsItem.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MessageListItemReactionCountsItem.Builder.class) +public final class MessageListItemReactionCountsItem { + private final int count; + + private final Optional emoji; + + private final Map additionalProperties; + + private MessageListItemReactionCountsItem( + int count, Optional emoji, Map additionalProperties) { + this.count = count; + this.emoji = emoji; + this.additionalProperties = additionalProperties; + } + + /** + * @return The number of users who reacted + */ + @JsonProperty("count") + public int getCount() { + return count; + } + + /** + * @return The emoji that was used in shortcode format (:heart:) + */ + @JsonIgnore + public Optional getEmoji() { + if (emoji == null) { + return Optional.empty(); + } + return emoji; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("emoji") + private Optional _getEmoji() { + return emoji; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MessageListItemReactionCountsItem && equalTo((MessageListItemReactionCountsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MessageListItemReactionCountsItem other) { + return count == other.count && emoji.equals(other.emoji); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.count, this.emoji); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CountStage builder() { + return new Builder(); + } + + public interface CountStage { + /** + *

The number of users who reacted

+ */ + _FinalStage count(int count); + + Builder from(MessageListItemReactionCountsItem other); + } + + public interface _FinalStage { + MessageListItemReactionCountsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The emoji that was used in shortcode format (:heart:)

+ */ + _FinalStage emoji(Optional emoji); + + _FinalStage emoji(String emoji); + + _FinalStage emoji(Nullable emoji); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CountStage, _FinalStage { + private int count; + + private Optional emoji = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MessageListItemReactionCountsItem other) { + count(other.getCount()); + emoji(other.getEmoji()); + return this; + } + + /** + *

The number of users who reacted

+ *

The number of users who reacted

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("count") + public _FinalStage count(int count) { + this.count = count; + return this; + } + + /** + *

The emoji that was used in shortcode format (:heart:)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emoji(Nullable emoji) { + if (emoji.isNull()) { + this.emoji = null; + } else if (emoji.isEmpty()) { + this.emoji = Optional.empty(); + } else { + this.emoji = Optional.of(emoji.get()); + } + return this; + } + + /** + *

The emoji that was used in shortcode format (:heart:)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emoji(String emoji) { + this.emoji = Optional.ofNullable(emoji); + return this; + } + + /** + *

The emoji that was used in shortcode format (:heart:)

+ */ + @java.lang.Override + @JsonSetter(value = "emoji", nulls = Nulls.SKIP) + public _FinalStage emoji(Optional emoji) { + this.emoji = emoji; + return this; + } + + @java.lang.Override + public MessageListItemReactionCountsItem build() { + return new MessageListItemReactionCountsItem(count, emoji, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MessageListItemUser.java b/src/main/java/com/whop/api/types/MessageListItemUser.java new file mode 100644 index 00000000..2aaad17b --- /dev/null +++ b/src/main/java/com/whop/api/types/MessageListItemUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MessageListItemUser.Builder.class) +public final class MessageListItemUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private MessageListItemUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MessageListItemUser && equalTo((MessageListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MessageListItemUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(MessageListItemUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + MessageListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MessageListItemUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public MessageListItemUser build() { + return new MessageListItemUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MessagePoll.java b/src/main/java/com/whop/api/types/MessagePoll.java new file mode 100644 index 00000000..b6870a2b --- /dev/null +++ b/src/main/java/com/whop/api/types/MessagePoll.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MessagePoll.Builder.class) +public final class MessagePoll { + private final Optional> options; + + private final Map additionalProperties; + + private MessagePoll(Optional> options, Map additionalProperties) { + this.options = options; + this.additionalProperties = additionalProperties; + } + + /** + * @return The options for the poll + */ + @JsonIgnore + public Optional> getOptions() { + if (options == null) { + return Optional.empty(); + } + return options; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("options") + private Optional> _getOptions() { + return options; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MessagePoll && equalTo((MessagePoll) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MessagePoll other) { + return options.equals(other.options); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.options); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> options = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MessagePoll other) { + options(other.getOptions()); + return this; + } + + /** + *

The options for the poll

+ */ + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public Builder options(Optional> options) { + this.options = options; + return this; + } + + public Builder options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + public Builder options(Nullable> options) { + if (options.isNull()) { + this.options = null; + } else if (options.isEmpty()) { + this.options = Optional.empty(); + } else { + this.options = Optional.of(options.get()); + } + return this; + } + + public MessagePoll build() { + return new MessagePoll(options, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MessagePollOptionsItem.java b/src/main/java/com/whop/api/types/MessagePollOptionsItem.java new file mode 100644 index 00000000..49b3cad2 --- /dev/null +++ b/src/main/java/com/whop/api/types/MessagePollOptionsItem.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MessagePollOptionsItem.Builder.class) +public final class MessagePollOptionsItem { + private final String id; + + private final String text; + + private final Map additionalProperties; + + private MessagePollOptionsItem(String id, String text, Map additionalProperties) { + this.id = id; + this.text = text; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the poll option. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The text of the poll option + */ + @JsonProperty("text") + public String getText() { + return text; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MessagePollOptionsItem && equalTo((MessagePollOptionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MessagePollOptionsItem other) { + return id.equals(other.id) && text.equals(other.text); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.text); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the poll option.

+ */ + TextStage id(@NotNull String id); + + Builder from(MessagePollOptionsItem other); + } + + public interface TextStage { + /** + *

The text of the poll option

+ */ + _FinalStage text(@NotNull String text); + } + + public interface _FinalStage { + MessagePollOptionsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TextStage, _FinalStage { + private String id; + + private String text; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MessagePollOptionsItem other) { + id(other.getId()); + text(other.getText()); + return this; + } + + /** + *

The unique identifier for the poll option.

+ *

The unique identifier for the poll option.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TextStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The text of the poll option

+ *

The text of the poll option

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("text") + public _FinalStage text(@NotNull String text) { + this.text = Objects.requireNonNull(text, "text must not be null"); + return this; + } + + @java.lang.Override + public MessagePollOptionsItem build() { + return new MessagePollOptionsItem(id, text, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MessagePollVotesItem.java b/src/main/java/com/whop/api/types/MessagePollVotesItem.java new file mode 100644 index 00000000..7d8c7231 --- /dev/null +++ b/src/main/java/com/whop/api/types/MessagePollVotesItem.java @@ -0,0 +1,201 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MessagePollVotesItem.Builder.class) +public final class MessagePollVotesItem { + private final int count; + + private final Optional optionId; + + private final Map additionalProperties; + + private MessagePollVotesItem(int count, Optional optionId, Map additionalProperties) { + this.count = count; + this.optionId = optionId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The number of users who reacted + */ + @JsonProperty("count") + public int getCount() { + return count; + } + + /** + * @return The reaction that was used + */ + @JsonIgnore + public Optional getOptionId() { + if (optionId == null) { + return Optional.empty(); + } + return optionId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("option_id") + private Optional _getOptionId() { + return optionId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MessagePollVotesItem && equalTo((MessagePollVotesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MessagePollVotesItem other) { + return count == other.count && optionId.equals(other.optionId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.count, this.optionId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CountStage builder() { + return new Builder(); + } + + public interface CountStage { + /** + *

The number of users who reacted

+ */ + _FinalStage count(int count); + + Builder from(MessagePollVotesItem other); + } + + public interface _FinalStage { + MessagePollVotesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The reaction that was used

+ */ + _FinalStage optionId(Optional optionId); + + _FinalStage optionId(String optionId); + + _FinalStage optionId(Nullable optionId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CountStage, _FinalStage { + private int count; + + private Optional optionId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MessagePollVotesItem other) { + count(other.getCount()); + optionId(other.getOptionId()); + return this; + } + + /** + *

The number of users who reacted

+ *

The number of users who reacted

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("count") + public _FinalStage count(int count) { + this.count = count; + return this; + } + + /** + *

The reaction that was used

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optionId(Nullable optionId) { + if (optionId.isNull()) { + this.optionId = null; + } else if (optionId.isEmpty()) { + this.optionId = Optional.empty(); + } else { + this.optionId = Optional.of(optionId.get()); + } + return this; + } + + /** + *

The reaction that was used

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optionId(String optionId) { + this.optionId = Optional.ofNullable(optionId); + return this; + } + + /** + *

The reaction that was used

+ */ + @java.lang.Override + @JsonSetter(value = "option_id", nulls = Nulls.SKIP) + public _FinalStage optionId(Optional optionId) { + this.optionId = optionId; + return this; + } + + @java.lang.Override + public MessagePollVotesItem build() { + return new MessagePollVotesItem(count, optionId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MessageReactionCountsItem.java b/src/main/java/com/whop/api/types/MessageReactionCountsItem.java new file mode 100644 index 00000000..4b780ba5 --- /dev/null +++ b/src/main/java/com/whop/api/types/MessageReactionCountsItem.java @@ -0,0 +1,201 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MessageReactionCountsItem.Builder.class) +public final class MessageReactionCountsItem { + private final int count; + + private final Optional emoji; + + private final Map additionalProperties; + + private MessageReactionCountsItem(int count, Optional emoji, Map additionalProperties) { + this.count = count; + this.emoji = emoji; + this.additionalProperties = additionalProperties; + } + + /** + * @return The number of users who reacted + */ + @JsonProperty("count") + public int getCount() { + return count; + } + + /** + * @return The emoji that was used in shortcode format (:heart:) + */ + @JsonIgnore + public Optional getEmoji() { + if (emoji == null) { + return Optional.empty(); + } + return emoji; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("emoji") + private Optional _getEmoji() { + return emoji; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MessageReactionCountsItem && equalTo((MessageReactionCountsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MessageReactionCountsItem other) { + return count == other.count && emoji.equals(other.emoji); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.count, this.emoji); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CountStage builder() { + return new Builder(); + } + + public interface CountStage { + /** + *

The number of users who reacted

+ */ + _FinalStage count(int count); + + Builder from(MessageReactionCountsItem other); + } + + public interface _FinalStage { + MessageReactionCountsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The emoji that was used in shortcode format (:heart:)

+ */ + _FinalStage emoji(Optional emoji); + + _FinalStage emoji(String emoji); + + _FinalStage emoji(Nullable emoji); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CountStage, _FinalStage { + private int count; + + private Optional emoji = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MessageReactionCountsItem other) { + count(other.getCount()); + emoji(other.getEmoji()); + return this; + } + + /** + *

The number of users who reacted

+ *

The number of users who reacted

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("count") + public _FinalStage count(int count) { + this.count = count; + return this; + } + + /** + *

The emoji that was used in shortcode format (:heart:)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emoji(Nullable emoji) { + if (emoji.isNull()) { + this.emoji = null; + } else if (emoji.isEmpty()) { + this.emoji = Optional.empty(); + } else { + this.emoji = Optional.of(emoji.get()); + } + return this; + } + + /** + *

The emoji that was used in shortcode format (:heart:)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emoji(String emoji) { + this.emoji = Optional.ofNullable(emoji); + return this; + } + + /** + *

The emoji that was used in shortcode format (:heart:)

+ */ + @java.lang.Override + @JsonSetter(value = "emoji", nulls = Nulls.SKIP) + public _FinalStage emoji(Optional emoji) { + this.emoji = emoji; + return this; + } + + @java.lang.Override + public MessageReactionCountsItem build() { + return new MessageReactionCountsItem(count, emoji, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MessageUser.java b/src/main/java/com/whop/api/types/MessageUser.java new file mode 100644 index 00000000..a28afb73 --- /dev/null +++ b/src/main/java/com/whop/api/types/MessageUser.java @@ -0,0 +1,235 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MessageUser.Builder.class) +public final class MessageUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private MessageUser(String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MessageUser && equalTo((MessageUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MessageUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(MessageUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + MessageUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MessageUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public MessageUser build() { + return new MessageUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Money.java b/src/main/java/com/whop/api/types/Money.java new file mode 100644 index 00000000..7b38ef9c --- /dev/null +++ b/src/main/java/com/whop/api/types/Money.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Money.Builder.class) +public final class Money { + private final String amount; + + private final String currency; + + private final int decimals; + + private final int displayDecimals; + + private final Map additionalProperties; + + private Money( + String amount, + String currency, + int decimals, + int displayDecimals, + Map additionalProperties) { + this.amount = amount; + this.currency = currency; + this.decimals = decimals; + this.displayDecimals = displayDecimals; + this.additionalProperties = additionalProperties; + } + + /** + * @return The amount in major units, as an exact decimal string — "10.00" is ten dollars. A string so no float rounds it in transit. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + /** + * @return Three-letter ISO 4217 currency code, lowercase. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return How many decimal places the amount CARRIES — the precision the charge itself runs at. + */ + @JsonProperty("decimals") + public int getDecimals() { + return decimals; + } + + /** + * @return How many decimal places to SHOW. Usually equal to decimals, and deliberately not always: COP is charged in centavos but written in whole pesos, so it is 2 and 0. Format the number in your own locale using this. + */ + @JsonProperty("display_decimals") + public int getDisplayDecimals() { + return displayDecimals; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Money && equalTo((Money) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Money other) { + return amount.equals(other.amount) + && currency.equals(other.currency) + && decimals == other.decimals + && displayDecimals == other.displayDecimals; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.currency, this.decimals, this.displayDecimals); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The amount in major units, as an exact decimal string — "10.00" is ten dollars. A string so no float rounds it in transit.

+ */ + CurrencyStage amount(@NotNull String amount); + + Builder from(Money other); + } + + public interface CurrencyStage { + /** + *

Three-letter ISO 4217 currency code, lowercase.

+ */ + DecimalsStage currency(@NotNull String currency); + } + + public interface DecimalsStage { + /** + *

How many decimal places the amount CARRIES — the precision the charge itself runs at.

+ */ + DisplayDecimalsStage decimals(int decimals); + } + + public interface DisplayDecimalsStage { + /** + *

How many decimal places to SHOW. Usually equal to decimals, and deliberately not always: COP is charged in centavos but written in whole pesos, so it is 2 and 0. Format the number in your own locale using this.

+ */ + _FinalStage displayDecimals(int displayDecimals); + } + + public interface _FinalStage { + Money build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, CurrencyStage, DecimalsStage, DisplayDecimalsStage, _FinalStage { + private String amount; + + private String currency; + + private int decimals; + + private int displayDecimals; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Money other) { + amount(other.getAmount()); + currency(other.getCurrency()); + decimals(other.getDecimals()); + displayDecimals(other.getDisplayDecimals()); + return this; + } + + /** + *

The amount in major units, as an exact decimal string — "10.00" is ten dollars. A string so no float rounds it in transit.

+ *

The amount in major units, as an exact decimal string — "10.00" is ten dollars. A string so no float rounds it in transit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CurrencyStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

Three-letter ISO 4217 currency code, lowercase.

+ *

Three-letter ISO 4217 currency code, lowercase.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DecimalsStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

How many decimal places the amount CARRIES — the precision the charge itself runs at.

+ *

How many decimal places the amount CARRIES — the precision the charge itself runs at.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("decimals") + public DisplayDecimalsStage decimals(int decimals) { + this.decimals = decimals; + return this; + } + + /** + *

How many decimal places to SHOW. Usually equal to decimals, and deliberately not always: COP is charged in centavos but written in whole pesos, so it is 2 and 0. Format the number in your own locale using this.

+ *

How many decimal places to SHOW. Usually equal to decimals, and deliberately not always: COP is charged in centavos but written in whole pesos, so it is 2 and 0. Format the number in your own locale using this.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("display_decimals") + public _FinalStage displayDecimals(int displayDecimals) { + this.displayDecimals = displayDecimals; + return this; + } + + @java.lang.Override + public Money build() { + return new Money(amount, currency, decimals, displayDecimals, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/MuxAssetStatuses.java b/src/main/java/com/whop/api/types/MuxAssetStatuses.java new file mode 100644 index 00000000..2d6a4a0e --- /dev/null +++ b/src/main/java/com/whop/api/types/MuxAssetStatuses.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MuxAssetStatuses { + public static final MuxAssetStatuses UPLOADING = new MuxAssetStatuses(Value.UPLOADING, "uploading"); + + public static final MuxAssetStatuses READY = new MuxAssetStatuses(Value.READY, "ready"); + + public static final MuxAssetStatuses CREATED = new MuxAssetStatuses(Value.CREATED, "created"); + + private final Value value; + + private final String string; + + MuxAssetStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MuxAssetStatuses && this.string.equals(((MuxAssetStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case UPLOADING: + return visitor.visitUploading(); + case READY: + return visitor.visitReady(); + case CREATED: + return visitor.visitCreated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MuxAssetStatuses valueOf(String value) { + switch (value) { + case "uploading": + return UPLOADING; + case "ready": + return READY; + case "created": + return CREATED; + default: + return new MuxAssetStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + UPLOADING, + + CREATED, + + READY, + + UNKNOWN + } + + public interface Visitor { + T visitUploading(); + + T visitCreated(); + + T visitReady(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/NotFoundErrorBody.java b/src/main/java/com/whop/api/types/NotFoundErrorBody.java new file mode 100644 index 00000000..07cd2be2 --- /dev/null +++ b/src/main/java/com/whop/api/types/NotFoundErrorBody.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = NotFoundErrorBody.Builder.class) +public final class NotFoundErrorBody { + private final NotFoundErrorBodyError error; + + private final Map additionalProperties; + + private NotFoundErrorBody(NotFoundErrorBodyError error, Map additionalProperties) { + this.error = error; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("error") + public NotFoundErrorBodyError getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NotFoundErrorBody && equalTo((NotFoundErrorBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(NotFoundErrorBody other) { + return error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + _FinalStage error(@NotNull NotFoundErrorBodyError error); + + Builder from(NotFoundErrorBody other); + } + + public interface _FinalStage { + NotFoundErrorBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private NotFoundErrorBodyError error; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(NotFoundErrorBody other) { + error(other.getError()); + return this; + } + + @java.lang.Override + @JsonSetter("error") + public _FinalStage error(@NotNull NotFoundErrorBodyError error) { + this.error = Objects.requireNonNull(error, "error must not be null"); + return this; + } + + @java.lang.Override + public NotFoundErrorBody build() { + return new NotFoundErrorBody(error, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/NotFoundErrorBodyError.java b/src/main/java/com/whop/api/types/NotFoundErrorBodyError.java new file mode 100644 index 00000000..3b0156f4 --- /dev/null +++ b/src/main/java/com/whop/api/types/NotFoundErrorBodyError.java @@ -0,0 +1,289 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = NotFoundErrorBodyError.Builder.class) +public final class NotFoundErrorBodyError { + private final Optional code; + + private final String message; + + private final Optional param; + + private final String type; + + private final Map additionalProperties; + + private NotFoundErrorBodyError( + Optional code, + String message, + Optional param, + String type, + Map additionalProperties) { + this.code = code; + this.message = message; + this.param = param; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json' + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + @JsonProperty("message") + public String getMessage() { + return message; + } + + /** + * @return The parameter that caused the error, if applicable + */ + @JsonIgnore + public Optional getParam() { + if (param == null) { + return Optional.empty(); + } + return param; + } + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("param") + private Optional _getParam() { + return param; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NotFoundErrorBodyError && equalTo((NotFoundErrorBodyError) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(NotFoundErrorBodyError other) { + return code.equals(other.code) + && message.equals(other.message) + && param.equals(other.param) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.message, this.param, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + TypeStage message(@NotNull String message); + + Builder from(NotFoundErrorBodyError other); + } + + public interface TypeStage { + _FinalStage type(@NotNull String type); + } + + public interface _FinalStage { + NotFoundErrorBodyError build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ */ + _FinalStage code(Optional code); + + _FinalStage code(String code); + + _FinalStage code(Nullable code); + + /** + *

The parameter that caused the error, if applicable

+ */ + _FinalStage param(Optional param); + + _FinalStage param(String param); + + _FinalStage param(Nullable param); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, TypeStage, _FinalStage { + private String message; + + private String type; + + private Optional param = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(NotFoundErrorBodyError other) { + code(other.getCode()); + message(other.getMessage()); + param(other.getParam()); + type(other.getType()); + return this; + } + + @java.lang.Override + @JsonSetter("message") + public TypeStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage param(Nullable param) { + if (param.isNull()) { + this.param = null; + } else if (param.isEmpty()) { + this.param = Optional.empty(); + } else { + this.param = Optional.of(param.get()); + } + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage param(String param) { + this.param = Optional.ofNullable(param); + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ */ + @java.lang.Override + @JsonSetter(value = "param", nulls = Nulls.SKIP) + public _FinalStage param(Optional param) { + this.param = param; + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public NotFoundErrorBodyError build() { + return new NotFoundErrorBodyError(code, message, param, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Notification.java b/src/main/java/com/whop/api/types/Notification.java new file mode 100644 index 00000000..d4df6cb2 --- /dev/null +++ b/src/main/java/com/whop/api/types/Notification.java @@ -0,0 +1,835 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Notification.Builder.class) +public final class Notification { + private final Optional account; + + private final String attachmentUrl; + + private final String content; + + private final String createdAt; + + private final Optional experience; + + private final String id; + + private final Optional iframeLink; + + private final Optional link; + + private final boolean mentionsMe; + + private final Optional restPath; + + private final Optional sender; + + private final String subject; + + private final Optional topic; + + private final Map additionalProperties; + + private Notification( + Optional account, + String attachmentUrl, + String content, + String createdAt, + Optional experience, + String id, + Optional iframeLink, + Optional link, + boolean mentionsMe, + Optional restPath, + Optional sender, + String subject, + Optional topic, + Map additionalProperties) { + this.account = account; + this.attachmentUrl = attachmentUrl; + this.content = content; + this.createdAt = createdAt; + this.experience = experience; + this.id = id; + this.iframeLink = iframeLink; + this.link = link; + this.mentionsMe = mentionsMe; + this.restPath = restPath; + this.sender = sender; + this.subject = subject; + this.topic = topic; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account the notification belongs to. null when the notification is not associated with an account. + */ + @JsonIgnore + public Optional getAccount() { + if (account == null) { + return Optional.empty(); + } + return account; + } + + /** + * @return Image displayed alongside the notification — the sender's avatar, or the default notification image. + */ + @JsonProperty("attachment_url") + public String getAttachmentUrl() { + return attachmentUrl; + } + + /** + * @return The body text of the notification displayed to the user. + */ + @JsonProperty("content") + public String getContent() { + return content; + } + + /** + * @return When the notification was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Experience the notification is related to. null when not tied to a specific experience. + */ + @JsonIgnore + public Optional getExperience() { + if (experience == null) { + return Optional.empty(); + } + return experience; + } + + /** + * @return Notification ID. Feed rows carry a composite id that doubles as the list cursor. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The same destination on the app's own domain, which the Whop web and mobile clients embed instead of navigating to it. Only relevant if you render Whop apps yourself. null when the notification carries its own link. + */ + @JsonIgnore + public Optional getIframeLink() { + if (iframeLink == null) { + return Optional.empty(); + } + return iframeLink; + } + + /** + * @return The whop.com page the notification opens, as a normal top-level navigation. This is the link to use unless you host Whop apps yourself. null when the notification has no click-through destination. + */ + @JsonIgnore + public Optional getLink() { + if (link == null) { + return Optional.empty(); + } + return link; + } + + /** + * @return Whether the authenticated user was directly mentioned in this notification. + */ + @JsonProperty("mentions_me") + public boolean getMentionsMe() { + return mentionsMe; + } + + /** + * @return Additional path information appended to the notification's deep link, if any. + */ + @JsonIgnore + public Optional getRestPath() { + if (restPath == null) { + return Optional.empty(); + } + return restPath; + } + + /** + * @return User who triggered the notification. null when it was system-generated. + */ + @JsonIgnore + public Optional getSender() { + if (sender == null) { + return Optional.empty(); + } + return sender; + } + + /** + * @return The title line of the notification displayed to the user. + */ + @JsonProperty("subject") + public String getSubject() { + return subject; + } + + /** + * @return Topic category the notification belongs to, used for grouping and preference management. null when uncategorized. + */ + @JsonIgnore + public Optional getTopic() { + if (topic == null) { + return Optional.empty(); + } + return topic; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account") + private Optional _getAccount() { + return account; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("experience") + private Optional _getExperience() { + return experience; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("iframe_link") + private Optional _getIframeLink() { + return iframeLink; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("link") + private Optional _getLink() { + return link; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("rest_path") + private Optional _getRestPath() { + return restPath; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("sender") + private Optional _getSender() { + return sender; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("topic") + private Optional _getTopic() { + return topic; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Notification && equalTo((Notification) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Notification other) { + return account.equals(other.account) + && attachmentUrl.equals(other.attachmentUrl) + && content.equals(other.content) + && createdAt.equals(other.createdAt) + && experience.equals(other.experience) + && id.equals(other.id) + && iframeLink.equals(other.iframeLink) + && link.equals(other.link) + && mentionsMe == other.mentionsMe + && restPath.equals(other.restPath) + && sender.equals(other.sender) + && subject.equals(other.subject) + && topic.equals(other.topic); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.account, + this.attachmentUrl, + this.content, + this.createdAt, + this.experience, + this.id, + this.iframeLink, + this.link, + this.mentionsMe, + this.restPath, + this.sender, + this.subject, + this.topic); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AttachmentUrlStage builder() { + return new Builder(); + } + + public interface AttachmentUrlStage { + /** + *

Image displayed alongside the notification — the sender's avatar, or the default notification image.

+ */ + ContentStage attachmentUrl(@NotNull String attachmentUrl); + + Builder from(Notification other); + } + + public interface ContentStage { + /** + *

The body text of the notification displayed to the user.

+ */ + CreatedAtStage content(@NotNull String content); + } + + public interface CreatedAtStage { + /** + *

When the notification was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Notification ID. Feed rows carry a composite id that doubles as the list cursor.

+ */ + MentionsMeStage id(@NotNull String id); + } + + public interface MentionsMeStage { + /** + *

Whether the authenticated user was directly mentioned in this notification.

+ */ + SubjectStage mentionsMe(boolean mentionsMe); + } + + public interface SubjectStage { + /** + *

The title line of the notification displayed to the user.

+ */ + _FinalStage subject(@NotNull String subject); + } + + public interface _FinalStage { + Notification build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account the notification belongs to. null when the notification is not associated with an account.

+ */ + _FinalStage account(Optional account); + + _FinalStage account(NotificationAccount account); + + _FinalStage account(Nullable account); + + /** + *

Experience the notification is related to. null when not tied to a specific experience.

+ */ + _FinalStage experience(Optional experience); + + _FinalStage experience(NotificationExperience experience); + + _FinalStage experience(Nullable experience); + + /** + *

The same destination on the app's own domain, which the Whop web and mobile clients embed instead of navigating to it. Only relevant if you render Whop apps yourself. null when the notification carries its own link.

+ */ + _FinalStage iframeLink(Optional iframeLink); + + _FinalStage iframeLink(String iframeLink); + + _FinalStage iframeLink(Nullable iframeLink); + + /** + *

The whop.com page the notification opens, as a normal top-level navigation. This is the link to use unless you host Whop apps yourself. null when the notification has no click-through destination.

+ */ + _FinalStage link(Optional link); + + _FinalStage link(String link); + + _FinalStage link(Nullable link); + + /** + *

Additional path information appended to the notification's deep link, if any.

+ */ + _FinalStage restPath(Optional restPath); + + _FinalStage restPath(String restPath); + + _FinalStage restPath(Nullable restPath); + + /** + *

User who triggered the notification. null when it was system-generated.

+ */ + _FinalStage sender(Optional sender); + + _FinalStage sender(NotificationSender sender); + + _FinalStage sender(Nullable sender); + + /** + *

Topic category the notification belongs to, used for grouping and preference management. null when uncategorized.

+ */ + _FinalStage topic(Optional topic); + + _FinalStage topic(NotificationTopicSummary topic); + + _FinalStage topic(Nullable topic); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AttachmentUrlStage, + ContentStage, + CreatedAtStage, + IdStage, + MentionsMeStage, + SubjectStage, + _FinalStage { + private String attachmentUrl; + + private String content; + + private String createdAt; + + private String id; + + private boolean mentionsMe; + + private String subject; + + private Optional topic = Optional.empty(); + + private Optional sender = Optional.empty(); + + private Optional restPath = Optional.empty(); + + private Optional link = Optional.empty(); + + private Optional iframeLink = Optional.empty(); + + private Optional experience = Optional.empty(); + + private Optional account = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Notification other) { + account(other.getAccount()); + attachmentUrl(other.getAttachmentUrl()); + content(other.getContent()); + createdAt(other.getCreatedAt()); + experience(other.getExperience()); + id(other.getId()); + iframeLink(other.getIframeLink()); + link(other.getLink()); + mentionsMe(other.getMentionsMe()); + restPath(other.getRestPath()); + sender(other.getSender()); + subject(other.getSubject()); + topic(other.getTopic()); + return this; + } + + /** + *

Image displayed alongside the notification — the sender's avatar, or the default notification image.

+ *

Image displayed alongside the notification — the sender's avatar, or the default notification image.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("attachment_url") + public ContentStage attachmentUrl(@NotNull String attachmentUrl) { + this.attachmentUrl = Objects.requireNonNull(attachmentUrl, "attachmentUrl must not be null"); + return this; + } + + /** + *

The body text of the notification displayed to the user.

+ *

The body text of the notification displayed to the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("content") + public CreatedAtStage content(@NotNull String content) { + this.content = Objects.requireNonNull(content, "content must not be null"); + return this; + } + + /** + *

When the notification was created, as an ISO 8601 timestamp.

+ *

When the notification was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Notification ID. Feed rows carry a composite id that doubles as the list cursor.

+ *

Notification ID. Feed rows carry a composite id that doubles as the list cursor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MentionsMeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether the authenticated user was directly mentioned in this notification.

+ *

Whether the authenticated user was directly mentioned in this notification.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("mentions_me") + public SubjectStage mentionsMe(boolean mentionsMe) { + this.mentionsMe = mentionsMe; + return this; + } + + /** + *

The title line of the notification displayed to the user.

+ *

The title line of the notification displayed to the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("subject") + public _FinalStage subject(@NotNull String subject) { + this.subject = Objects.requireNonNull(subject, "subject must not be null"); + return this; + } + + /** + *

Topic category the notification belongs to, used for grouping and preference management. null when uncategorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage topic(Nullable topic) { + if (topic.isNull()) { + this.topic = null; + } else if (topic.isEmpty()) { + this.topic = Optional.empty(); + } else { + this.topic = Optional.of(topic.get()); + } + return this; + } + + /** + *

Topic category the notification belongs to, used for grouping and preference management. null when uncategorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage topic(NotificationTopicSummary topic) { + this.topic = Optional.ofNullable(topic); + return this; + } + + /** + *

Topic category the notification belongs to, used for grouping and preference management. null when uncategorized.

+ */ + @java.lang.Override + @JsonSetter(value = "topic", nulls = Nulls.SKIP) + public _FinalStage topic(Optional topic) { + this.topic = topic; + return this; + } + + /** + *

User who triggered the notification. null when it was system-generated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sender(Nullable sender) { + if (sender.isNull()) { + this.sender = null; + } else if (sender.isEmpty()) { + this.sender = Optional.empty(); + } else { + this.sender = Optional.of(sender.get()); + } + return this; + } + + /** + *

User who triggered the notification. null when it was system-generated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sender(NotificationSender sender) { + this.sender = Optional.ofNullable(sender); + return this; + } + + /** + *

User who triggered the notification. null when it was system-generated.

+ */ + @java.lang.Override + @JsonSetter(value = "sender", nulls = Nulls.SKIP) + public _FinalStage sender(Optional sender) { + this.sender = sender; + return this; + } + + /** + *

Additional path information appended to the notification's deep link, if any.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage restPath(Nullable restPath) { + if (restPath.isNull()) { + this.restPath = null; + } else if (restPath.isEmpty()) { + this.restPath = Optional.empty(); + } else { + this.restPath = Optional.of(restPath.get()); + } + return this; + } + + /** + *

Additional path information appended to the notification's deep link, if any.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage restPath(String restPath) { + this.restPath = Optional.ofNullable(restPath); + return this; + } + + /** + *

Additional path information appended to the notification's deep link, if any.

+ */ + @java.lang.Override + @JsonSetter(value = "rest_path", nulls = Nulls.SKIP) + public _FinalStage restPath(Optional restPath) { + this.restPath = restPath; + return this; + } + + /** + *

The whop.com page the notification opens, as a normal top-level navigation. This is the link to use unless you host Whop apps yourself. null when the notification has no click-through destination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage link(Nullable link) { + if (link.isNull()) { + this.link = null; + } else if (link.isEmpty()) { + this.link = Optional.empty(); + } else { + this.link = Optional.of(link.get()); + } + return this; + } + + /** + *

The whop.com page the notification opens, as a normal top-level navigation. This is the link to use unless you host Whop apps yourself. null when the notification has no click-through destination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage link(String link) { + this.link = Optional.ofNullable(link); + return this; + } + + /** + *

The whop.com page the notification opens, as a normal top-level navigation. This is the link to use unless you host Whop apps yourself. null when the notification has no click-through destination.

+ */ + @java.lang.Override + @JsonSetter(value = "link", nulls = Nulls.SKIP) + public _FinalStage link(Optional link) { + this.link = link; + return this; + } + + /** + *

The same destination on the app's own domain, which the Whop web and mobile clients embed instead of navigating to it. Only relevant if you render Whop apps yourself. null when the notification carries its own link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iframeLink(Nullable iframeLink) { + if (iframeLink.isNull()) { + this.iframeLink = null; + } else if (iframeLink.isEmpty()) { + this.iframeLink = Optional.empty(); + } else { + this.iframeLink = Optional.of(iframeLink.get()); + } + return this; + } + + /** + *

The same destination on the app's own domain, which the Whop web and mobile clients embed instead of navigating to it. Only relevant if you render Whop apps yourself. null when the notification carries its own link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iframeLink(String iframeLink) { + this.iframeLink = Optional.ofNullable(iframeLink); + return this; + } + + /** + *

The same destination on the app's own domain, which the Whop web and mobile clients embed instead of navigating to it. Only relevant if you render Whop apps yourself. null when the notification carries its own link.

+ */ + @java.lang.Override + @JsonSetter(value = "iframe_link", nulls = Nulls.SKIP) + public _FinalStage iframeLink(Optional iframeLink) { + this.iframeLink = iframeLink; + return this; + } + + /** + *

Experience the notification is related to. null when not tied to a specific experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage experience(Nullable experience) { + if (experience.isNull()) { + this.experience = null; + } else if (experience.isEmpty()) { + this.experience = Optional.empty(); + } else { + this.experience = Optional.of(experience.get()); + } + return this; + } + + /** + *

Experience the notification is related to. null when not tied to a specific experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage experience(NotificationExperience experience) { + this.experience = Optional.ofNullable(experience); + return this; + } + + /** + *

Experience the notification is related to. null when not tied to a specific experience.

+ */ + @java.lang.Override + @JsonSetter(value = "experience", nulls = Nulls.SKIP) + public _FinalStage experience(Optional experience) { + this.experience = experience; + return this; + } + + /** + *

Account the notification belongs to. null when the notification is not associated with an account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(Nullable account) { + if (account.isNull()) { + this.account = null; + } else if (account.isEmpty()) { + this.account = Optional.empty(); + } else { + this.account = Optional.of(account.get()); + } + return this; + } + + /** + *

Account the notification belongs to. null when the notification is not associated with an account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(NotificationAccount account) { + this.account = Optional.ofNullable(account); + return this; + } + + /** + *

Account the notification belongs to. null when the notification is not associated with an account.

+ */ + @java.lang.Override + @JsonSetter(value = "account", nulls = Nulls.SKIP) + public _FinalStage account(Optional account) { + this.account = account; + return this; + } + + @java.lang.Override + public Notification build() { + return new Notification( + account, + attachmentUrl, + content, + createdAt, + experience, + id, + iframeLink, + link, + mentionsMe, + restPath, + sender, + subject, + topic, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/NotificationAccount.java b/src/main/java/com/whop/api/types/NotificationAccount.java new file mode 100644 index 00000000..eefa200a --- /dev/null +++ b/src/main/java/com/whop/api/types/NotificationAccount.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = NotificationAccount.Builder.class) +public final class NotificationAccount { + private final String id; + + private final Optional logoUrl; + + private final Optional route; + + private final String title; + + private final Map additionalProperties; + + private NotificationAccount( + String id, + Optional logoUrl, + Optional route, + String title, + Map additionalProperties) { + this.id = id; + this.logoUrl = logoUrl; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account logo image URL. null when the account has not uploaded one. + */ + @JsonIgnore + public Optional getLogoUrl() { + if (logoUrl == null) { + return Optional.empty(); + } + return logoUrl; + } + + /** + * @return URL slug of the account's store page on whop.com. + */ + @JsonIgnore + public Optional getRoute() { + if (route == null) { + return Optional.empty(); + } + return route; + } + + /** + * @return Account display name. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo_url") + private Optional _getLogoUrl() { + return logoUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("route") + private Optional _getRoute() { + return route; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NotificationAccount && equalTo((NotificationAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(NotificationAccount other) { + return id.equals(other.id) + && logoUrl.equals(other.logoUrl) + && route.equals(other.route) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.logoUrl, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID, prefixed biz_.

+ */ + TitleStage id(@NotNull String id); + + Builder from(NotificationAccount other); + } + + public interface TitleStage { + /** + *

Account display name.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + NotificationAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account logo image URL. null when the account has not uploaded one.

+ */ + _FinalStage logoUrl(Optional logoUrl); + + _FinalStage logoUrl(String logoUrl); + + _FinalStage logoUrl(Nullable logoUrl); + + /** + *

URL slug of the account's store page on whop.com.

+ */ + _FinalStage route(Optional route); + + _FinalStage route(String route); + + _FinalStage route(Nullable route); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + private Optional route = Optional.empty(); + + private Optional logoUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(NotificationAccount other) { + id(other.getId()); + logoUrl(other.getLogoUrl()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ *

Account ID, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account display name.

+ *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

URL slug of the account's store page on whop.com.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(Nullable route) { + if (route.isNull()) { + this.route = null; + } else if (route.isEmpty()) { + this.route = Optional.empty(); + } else { + this.route = Optional.of(route.get()); + } + return this; + } + + /** + *

URL slug of the account's store page on whop.com.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage route(String route) { + this.route = Optional.ofNullable(route); + return this; + } + + /** + *

URL slug of the account's store page on whop.com.

+ */ + @java.lang.Override + @JsonSetter(value = "route", nulls = Nulls.SKIP) + public _FinalStage route(Optional route) { + this.route = route; + return this; + } + + /** + *

Account logo image URL. null when the account has not uploaded one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(Nullable logoUrl) { + if (logoUrl.isNull()) { + this.logoUrl = null; + } else if (logoUrl.isEmpty()) { + this.logoUrl = Optional.empty(); + } else { + this.logoUrl = Optional.of(logoUrl.get()); + } + return this; + } + + /** + *

Account logo image URL. null when the account has not uploaded one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(String logoUrl) { + this.logoUrl = Optional.ofNullable(logoUrl); + return this; + } + + /** + *

Account logo image URL. null when the account has not uploaded one.

+ */ + @java.lang.Override + @JsonSetter(value = "logo_url", nulls = Nulls.SKIP) + public _FinalStage logoUrl(Optional logoUrl) { + this.logoUrl = logoUrl; + return this; + } + + @java.lang.Override + public NotificationAccount build() { + return new NotificationAccount(id, logoUrl, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/NotificationBadge.java b/src/main/java/com/whop/api/types/NotificationBadge.java new file mode 100644 index 00000000..1b23753d --- /dev/null +++ b/src/main/java/com/whop/api/types/NotificationBadge.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = NotificationBadge.Builder.class) +public final class NotificationBadge { + private final Optional accountId; + + private final String experienceId; + + private final boolean hasUnread; + + private final int importantCount; + + private final Optional lastViewedAt; + + private final Map additionalProperties; + + private NotificationBadge( + Optional accountId, + String experienceId, + boolean hasUnread, + int importantCount, + Optional lastViewedAt, + Map additionalProperties) { + this.accountId = accountId; + this.experienceId = experienceId; + this.hasUnread = hasUnread; + this.importantCount = importantCount; + this.lastViewedAt = lastViewedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account the experience belongs to, prefixed biz_. + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return Experience the badge counts, prefixed exp_. + */ + @JsonProperty("experience_id") + public String getExperienceId() { + return experienceId; + } + + /** + * @return Whether the caller has unread notifications in this experience. + */ + @JsonProperty("has_unread") + public boolean getHasUnread() { + return hasUnread; + } + + /** + * @return Number of unread important (mention) notifications in this experience. + */ + @JsonProperty("important_count") + public int getImportantCount() { + return importantCount; + } + + /** + * @return When the caller last viewed the experience, as an ISO 8601 timestamp. null when never viewed. + */ + @JsonIgnore + public Optional getLastViewedAt() { + if (lastViewedAt == null) { + return Optional.empty(); + } + return lastViewedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_viewed_at") + private Optional _getLastViewedAt() { + return lastViewedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NotificationBadge && equalTo((NotificationBadge) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(NotificationBadge other) { + return accountId.equals(other.accountId) + && experienceId.equals(other.experienceId) + && hasUnread == other.hasUnread + && importantCount == other.importantCount + && lastViewedAt.equals(other.lastViewedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.experienceId, this.hasUnread, this.importantCount, this.lastViewedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExperienceIdStage builder() { + return new Builder(); + } + + public interface ExperienceIdStage { + /** + *

Experience the badge counts, prefixed exp_.

+ */ + HasUnreadStage experienceId(@NotNull String experienceId); + + Builder from(NotificationBadge other); + } + + public interface HasUnreadStage { + /** + *

Whether the caller has unread notifications in this experience.

+ */ + ImportantCountStage hasUnread(boolean hasUnread); + } + + public interface ImportantCountStage { + /** + *

Number of unread important (mention) notifications in this experience.

+ */ + _FinalStage importantCount(int importantCount); + } + + public interface _FinalStage { + NotificationBadge build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account the experience belongs to, prefixed biz_.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

When the caller last viewed the experience, as an ISO 8601 timestamp. null when never viewed.

+ */ + _FinalStage lastViewedAt(Optional lastViewedAt); + + _FinalStage lastViewedAt(String lastViewedAt); + + _FinalStage lastViewedAt(Nullable lastViewedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExperienceIdStage, HasUnreadStage, ImportantCountStage, _FinalStage { + private String experienceId; + + private boolean hasUnread; + + private int importantCount; + + private Optional lastViewedAt = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(NotificationBadge other) { + accountId(other.getAccountId()); + experienceId(other.getExperienceId()); + hasUnread(other.getHasUnread()); + importantCount(other.getImportantCount()); + lastViewedAt(other.getLastViewedAt()); + return this; + } + + /** + *

Experience the badge counts, prefixed exp_.

+ *

Experience the badge counts, prefixed exp_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("experience_id") + public HasUnreadStage experienceId(@NotNull String experienceId) { + this.experienceId = Objects.requireNonNull(experienceId, "experienceId must not be null"); + return this; + } + + /** + *

Whether the caller has unread notifications in this experience.

+ *

Whether the caller has unread notifications in this experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("has_unread") + public ImportantCountStage hasUnread(boolean hasUnread) { + this.hasUnread = hasUnread; + return this; + } + + /** + *

Number of unread important (mention) notifications in this experience.

+ *

Number of unread important (mention) notifications in this experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("important_count") + public _FinalStage importantCount(int importantCount) { + this.importantCount = importantCount; + return this; + } + + /** + *

When the caller last viewed the experience, as an ISO 8601 timestamp. null when never viewed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastViewedAt(Nullable lastViewedAt) { + if (lastViewedAt.isNull()) { + this.lastViewedAt = null; + } else if (lastViewedAt.isEmpty()) { + this.lastViewedAt = Optional.empty(); + } else { + this.lastViewedAt = Optional.of(lastViewedAt.get()); + } + return this; + } + + /** + *

When the caller last viewed the experience, as an ISO 8601 timestamp. null when never viewed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastViewedAt(String lastViewedAt) { + this.lastViewedAt = Optional.ofNullable(lastViewedAt); + return this; + } + + /** + *

When the caller last viewed the experience, as an ISO 8601 timestamp. null when never viewed.

+ */ + @java.lang.Override + @JsonSetter(value = "last_viewed_at", nulls = Nulls.SKIP) + public _FinalStage lastViewedAt(Optional lastViewedAt) { + this.lastViewedAt = lastViewedAt; + return this; + } + + /** + *

Account the experience belongs to, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

Account the experience belongs to, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

Account the experience belongs to, prefixed biz_.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public NotificationBadge build() { + return new NotificationBadge( + accountId, experienceId, hasUnread, importantCount, lastViewedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/NotificationExperience.java b/src/main/java/com/whop/api/types/NotificationExperience.java new file mode 100644 index 00000000..b897aa71 --- /dev/null +++ b/src/main/java/com/whop/api/types/NotificationExperience.java @@ -0,0 +1,274 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = NotificationExperience.Builder.class) +public final class NotificationExperience { + private final Optional app; + + private final String id; + + private final Optional name; + + private final Map additionalProperties; + + private NotificationExperience( + Optional app, + String id, + Optional name, + Map additionalProperties) { + this.app = app; + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return App the experience belongs to. + */ + @JsonIgnore + public Optional getApp() { + if (app == null) { + return Optional.empty(); + } + return app; + } + + /** + * @return Experience ID, prefixed exp_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Display name of the experience. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("app") + private Optional _getApp() { + return app; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NotificationExperience && equalTo((NotificationExperience) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(NotificationExperience other) { + return app.equals(other.app) && id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.app, this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Experience ID, prefixed exp_.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(NotificationExperience other); + } + + public interface _FinalStage { + NotificationExperience build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

App the experience belongs to.

+ */ + _FinalStage app(Optional app); + + _FinalStage app(NotificationExperienceApp app); + + _FinalStage app(Nullable app); + + /** + *

Display name of the experience.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional name = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(NotificationExperience other) { + app(other.getApp()); + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

Experience ID, prefixed exp_.

+ *

Experience ID, prefixed exp_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Display name of the experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Display name of the experience.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Display name of the experience.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

App the experience belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage app(Nullable app) { + if (app.isNull()) { + this.app = null; + } else if (app.isEmpty()) { + this.app = Optional.empty(); + } else { + this.app = Optional.of(app.get()); + } + return this; + } + + /** + *

App the experience belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage app(NotificationExperienceApp app) { + this.app = Optional.ofNullable(app); + return this; + } + + /** + *

App the experience belongs to.

+ */ + @java.lang.Override + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public _FinalStage app(Optional app) { + this.app = app; + return this; + } + + @java.lang.Override + public NotificationExperience build() { + return new NotificationExperience(app, id, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/NotificationExperienceApp.java b/src/main/java/com/whop/api/types/NotificationExperienceApp.java new file mode 100644 index 00000000..c9373244 --- /dev/null +++ b/src/main/java/com/whop/api/types/NotificationExperienceApp.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = NotificationExperienceApp.Builder.class) +public final class NotificationExperienceApp { + private final String iconUrl; + + private final String id; + + private final Map additionalProperties; + + private NotificationExperienceApp(String iconUrl, String id, Map additionalProperties) { + this.iconUrl = iconUrl; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Icon image URL. Always present — the default app icon when none is uploaded. + */ + @JsonProperty("icon_url") + public String getIconUrl() { + return iconUrl; + } + + /** + * @return App ID, prefixed app_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NotificationExperienceApp && equalTo((NotificationExperienceApp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(NotificationExperienceApp other) { + return iconUrl.equals(other.iconUrl) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.iconUrl, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IconUrlStage builder() { + return new Builder(); + } + + public interface IconUrlStage { + /** + *

Icon image URL. Always present — the default app icon when none is uploaded.

+ */ + IdStage iconUrl(@NotNull String iconUrl); + + Builder from(NotificationExperienceApp other); + } + + public interface IdStage { + /** + *

App ID, prefixed app_.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + NotificationExperienceApp build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IconUrlStage, IdStage, _FinalStage { + private String iconUrl; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(NotificationExperienceApp other) { + iconUrl(other.getIconUrl()); + id(other.getId()); + return this; + } + + /** + *

Icon image URL. Always present — the default app icon when none is uploaded.

+ *

Icon image URL. Always present — the default app icon when none is uploaded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icon_url") + public IdStage iconUrl(@NotNull String iconUrl) { + this.iconUrl = Objects.requireNonNull(iconUrl, "iconUrl must not be null"); + return this; + } + + /** + *

App ID, prefixed app_.

+ *

App ID, prefixed app_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public NotificationExperienceApp build() { + return new NotificationExperienceApp(iconUrl, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/NotificationPreferenceScope.java b/src/main/java/com/whop/api/types/NotificationPreferenceScope.java new file mode 100644 index 00000000..f438ff7b --- /dev/null +++ b/src/main/java/com/whop/api/types/NotificationPreferenceScope.java @@ -0,0 +1,337 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = NotificationPreferenceScope.Builder.class) +public final class NotificationPreferenceScope { + private final Optional accountId; + + private final Optional channel; + + private final Optional experienceId; + + private final Optional teamAccountId; + + private final Optional topicId; + + private final Map additionalProperties; + + private NotificationPreferenceScope( + Optional accountId, + Optional channel, + Optional experienceId, + Optional teamAccountId, + Optional topicId, + Map additionalProperties) { + this.accountId = accountId; + this.channel = channel; + this.experienceId = experienceId; + this.teamAccountId = teamAccountId; + this.topicId = topicId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account the preference is scoped to (member notifications), prefixed biz_. + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return Delivery channel the preference applies to. null applies to every channel. + */ + @JsonIgnore + public Optional getChannel() { + if (channel == null) { + return Optional.empty(); + } + return channel; + } + + /** + * @return Experience the preference is scoped to, prefixed exp_. + */ + @JsonIgnore + public Optional getExperienceId() { + if (experienceId == null) { + return Optional.empty(); + } + return experienceId; + } + + /** + * @return Account whose team notifications the preference is scoped to, prefixed biz_. + */ + @JsonIgnore + public Optional getTeamAccountId() { + if (teamAccountId == null) { + return Optional.empty(); + } + return teamAccountId; + } + + /** + * @return Notification topic the preference is scoped to, prefixed topic_. + */ + @JsonIgnore + public Optional getTopicId() { + if (topicId == null) { + return Optional.empty(); + } + return topicId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("channel") + private Optional _getChannel() { + return channel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("experience_id") + private Optional _getExperienceId() { + return experienceId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("team_account_id") + private Optional _getTeamAccountId() { + return teamAccountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("topic_id") + private Optional _getTopicId() { + return topicId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NotificationPreferenceScope && equalTo((NotificationPreferenceScope) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(NotificationPreferenceScope other) { + return accountId.equals(other.accountId) + && channel.equals(other.channel) + && experienceId.equals(other.experienceId) + && teamAccountId.equals(other.teamAccountId) + && topicId.equals(other.topicId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.channel, this.experienceId, this.teamAccountId, this.topicId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountId = Optional.empty(); + + private Optional channel = Optional.empty(); + + private Optional experienceId = Optional.empty(); + + private Optional teamAccountId = Optional.empty(); + + private Optional topicId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(NotificationPreferenceScope other) { + accountId(other.getAccountId()); + channel(other.getChannel()); + experienceId(other.getExperienceId()); + teamAccountId(other.getTeamAccountId()); + topicId(other.getTopicId()); + return this; + } + + /** + *

Account the preference is scoped to (member notifications), prefixed biz_.

+ */ + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public Builder accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + public Builder accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + public Builder accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

Delivery channel the preference applies to. null applies to every channel.

+ */ + @JsonSetter(value = "channel", nulls = Nulls.SKIP) + public Builder channel(Optional channel) { + this.channel = channel; + return this; + } + + public Builder channel(NotificationPreferenceScopeChannel channel) { + this.channel = Optional.ofNullable(channel); + return this; + } + + public Builder channel(Nullable channel) { + if (channel.isNull()) { + this.channel = null; + } else if (channel.isEmpty()) { + this.channel = Optional.empty(); + } else { + this.channel = Optional.of(channel.get()); + } + return this; + } + + /** + *

Experience the preference is scoped to, prefixed exp_.

+ */ + @JsonSetter(value = "experience_id", nulls = Nulls.SKIP) + public Builder experienceId(Optional experienceId) { + this.experienceId = experienceId; + return this; + } + + public Builder experienceId(String experienceId) { + this.experienceId = Optional.ofNullable(experienceId); + return this; + } + + public Builder experienceId(Nullable experienceId) { + if (experienceId.isNull()) { + this.experienceId = null; + } else if (experienceId.isEmpty()) { + this.experienceId = Optional.empty(); + } else { + this.experienceId = Optional.of(experienceId.get()); + } + return this; + } + + /** + *

Account whose team notifications the preference is scoped to, prefixed biz_.

+ */ + @JsonSetter(value = "team_account_id", nulls = Nulls.SKIP) + public Builder teamAccountId(Optional teamAccountId) { + this.teamAccountId = teamAccountId; + return this; + } + + public Builder teamAccountId(String teamAccountId) { + this.teamAccountId = Optional.ofNullable(teamAccountId); + return this; + } + + public Builder teamAccountId(Nullable teamAccountId) { + if (teamAccountId.isNull()) { + this.teamAccountId = null; + } else if (teamAccountId.isEmpty()) { + this.teamAccountId = Optional.empty(); + } else { + this.teamAccountId = Optional.of(teamAccountId.get()); + } + return this; + } + + /** + *

Notification topic the preference is scoped to, prefixed topic_.

+ */ + @JsonSetter(value = "topic_id", nulls = Nulls.SKIP) + public Builder topicId(Optional topicId) { + this.topicId = topicId; + return this; + } + + public Builder topicId(String topicId) { + this.topicId = Optional.ofNullable(topicId); + return this; + } + + public Builder topicId(Nullable topicId) { + if (topicId.isNull()) { + this.topicId = null; + } else if (topicId.isEmpty()) { + this.topicId = Optional.empty(); + } else { + this.topicId = Optional.of(topicId.get()); + } + return this; + } + + public NotificationPreferenceScope build() { + return new NotificationPreferenceScope( + accountId, channel, experienceId, teamAccountId, topicId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/NotificationPreferenceScopeChannel.java b/src/main/java/com/whop/api/types/NotificationPreferenceScopeChannel.java new file mode 100644 index 00000000..c39e3964 --- /dev/null +++ b/src/main/java/com/whop/api/types/NotificationPreferenceScopeChannel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class NotificationPreferenceScopeChannel { + public static final NotificationPreferenceScopeChannel MOBILE = + new NotificationPreferenceScopeChannel(Value.MOBILE, "mobile"); + + public static final NotificationPreferenceScopeChannel IN_APP = + new NotificationPreferenceScopeChannel(Value.IN_APP, "in_app"); + + private final Value value; + + private final String string; + + NotificationPreferenceScopeChannel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof NotificationPreferenceScopeChannel + && this.string.equals(((NotificationPreferenceScopeChannel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MOBILE: + return visitor.visitMobile(); + case IN_APP: + return visitor.visitInApp(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static NotificationPreferenceScopeChannel valueOf(String value) { + switch (value) { + case "mobile": + return MOBILE; + case "in_app": + return IN_APP; + default: + return new NotificationPreferenceScopeChannel(Value.UNKNOWN, value); + } + } + + public enum Value { + IN_APP, + + MOBILE, + + UNKNOWN + } + + public interface Visitor { + T visitInApp(); + + T visitMobile(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/NotificationPreferenceState.java b/src/main/java/com/whop/api/types/NotificationPreferenceState.java new file mode 100644 index 00000000..f08c5c82 --- /dev/null +++ b/src/main/java/com/whop/api/types/NotificationPreferenceState.java @@ -0,0 +1,239 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = NotificationPreferenceState.Builder.class) +public final class NotificationPreferenceState { + private final Optional level; + + private final NotificationPreferenceStateObject object; + + private final NotificationPreferenceScope scope; + + private final Map additionalProperties; + + private NotificationPreferenceState( + Optional level, + NotificationPreferenceStateObject object, + NotificationPreferenceScope scope, + Map additionalProperties) { + this.level = level; + this.object = object; + this.scope = scope; + this.additionalProperties = additionalProperties; + } + + /** + * @return What the user is now notified about in this scope, or null if the preference was cleared and the scope inherits its default again. + */ + @JsonIgnore + public Optional getLevel() { + if (level == null) { + return Optional.empty(); + } + return level; + } + + /** + * @return Which kind of preference was written: experience_notification_preference for an experience level, notification_preference for a topic override. + */ + @JsonProperty("object") + public NotificationPreferenceStateObject getObject() { + return object; + } + + /** + * @return The scope that was written, resolved. null on a dimension means the preference is not narrowed there. + */ + @JsonProperty("scope") + public NotificationPreferenceScope getScope() { + return scope; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("level") + private Optional _getLevel() { + return level; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NotificationPreferenceState && equalTo((NotificationPreferenceState) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(NotificationPreferenceState other) { + return level.equals(other.level) && object.equals(other.object) && scope.equals(other.scope); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.level, this.object, this.scope); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ObjectStage builder() { + return new Builder(); + } + + public interface ObjectStage { + /** + *

Which kind of preference was written: experience_notification_preference for an experience level, notification_preference for a topic override.

+ */ + ScopeStage object(@NotNull NotificationPreferenceStateObject object); + + Builder from(NotificationPreferenceState other); + } + + public interface ScopeStage { + /** + *

The scope that was written, resolved. null on a dimension means the preference is not narrowed there.

+ */ + _FinalStage scope(@NotNull NotificationPreferenceScope scope); + } + + public interface _FinalStage { + NotificationPreferenceState build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

What the user is now notified about in this scope, or null if the preference was cleared and the scope inherits its default again.

+ */ + _FinalStage level(Optional level); + + _FinalStage level(NotificationPreferenceStateLevel level); + + _FinalStage level(Nullable level); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ObjectStage, ScopeStage, _FinalStage { + private NotificationPreferenceStateObject object; + + private NotificationPreferenceScope scope; + + private Optional level = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(NotificationPreferenceState other) { + level(other.getLevel()); + object(other.getObject()); + scope(other.getScope()); + return this; + } + + /** + *

Which kind of preference was written: experience_notification_preference for an experience level, notification_preference for a topic override.

+ *

Which kind of preference was written: experience_notification_preference for an experience level, notification_preference for a topic override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("object") + public ScopeStage object(@NotNull NotificationPreferenceStateObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

The scope that was written, resolved. null on a dimension means the preference is not narrowed there.

+ *

The scope that was written, resolved. null on a dimension means the preference is not narrowed there.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("scope") + public _FinalStage scope(@NotNull NotificationPreferenceScope scope) { + this.scope = Objects.requireNonNull(scope, "scope must not be null"); + return this; + } + + /** + *

What the user is now notified about in this scope, or null if the preference was cleared and the scope inherits its default again.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage level(Nullable level) { + if (level.isNull()) { + this.level = null; + } else if (level.isEmpty()) { + this.level = Optional.empty(); + } else { + this.level = Optional.of(level.get()); + } + return this; + } + + /** + *

What the user is now notified about in this scope, or null if the preference was cleared and the scope inherits its default again.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage level(NotificationPreferenceStateLevel level) { + this.level = Optional.ofNullable(level); + return this; + } + + /** + *

What the user is now notified about in this scope, or null if the preference was cleared and the scope inherits its default again.

+ */ + @java.lang.Override + @JsonSetter(value = "level", nulls = Nulls.SKIP) + public _FinalStage level(Optional level) { + this.level = level; + return this; + } + + @java.lang.Override + public NotificationPreferenceState build() { + return new NotificationPreferenceState(level, object, scope, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/NotificationPreferenceStateLevel.java b/src/main/java/com/whop/api/types/NotificationPreferenceStateLevel.java new file mode 100644 index 00000000..783e4a42 --- /dev/null +++ b/src/main/java/com/whop/api/types/NotificationPreferenceStateLevel.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class NotificationPreferenceStateLevel { + public static final NotificationPreferenceStateLevel ALL = new NotificationPreferenceStateLevel(Value.ALL, "all"); + + public static final NotificationPreferenceStateLevel NOTHING = + new NotificationPreferenceStateLevel(Value.NOTHING, "nothing"); + + public static final NotificationPreferenceStateLevel MENTIONS = + new NotificationPreferenceStateLevel(Value.MENTIONS, "mentions"); + + private final Value value; + + private final String string; + + NotificationPreferenceStateLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof NotificationPreferenceStateLevel + && this.string.equals(((NotificationPreferenceStateLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ALL: + return visitor.visitAll(); + case NOTHING: + return visitor.visitNothing(); + case MENTIONS: + return visitor.visitMentions(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static NotificationPreferenceStateLevel valueOf(String value) { + switch (value) { + case "all": + return ALL; + case "nothing": + return NOTHING; + case "mentions": + return MENTIONS; + default: + return new NotificationPreferenceStateLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL, + + MENTIONS, + + NOTHING, + + UNKNOWN + } + + public interface Visitor { + T visitAll(); + + T visitMentions(); + + T visitNothing(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/NotificationPreferenceStateObject.java b/src/main/java/com/whop/api/types/NotificationPreferenceStateObject.java new file mode 100644 index 00000000..429dc5ff --- /dev/null +++ b/src/main/java/com/whop/api/types/NotificationPreferenceStateObject.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class NotificationPreferenceStateObject { + public static final NotificationPreferenceStateObject NOTIFICATION_PREFERENCE = + new NotificationPreferenceStateObject(Value.NOTIFICATION_PREFERENCE, "notification_preference"); + + public static final NotificationPreferenceStateObject EXPERIENCE_NOTIFICATION_PREFERENCE = + new NotificationPreferenceStateObject( + Value.EXPERIENCE_NOTIFICATION_PREFERENCE, "experience_notification_preference"); + + private final Value value; + + private final String string; + + NotificationPreferenceStateObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof NotificationPreferenceStateObject + && this.string.equals(((NotificationPreferenceStateObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NOTIFICATION_PREFERENCE: + return visitor.visitNotificationPreference(); + case EXPERIENCE_NOTIFICATION_PREFERENCE: + return visitor.visitExperienceNotificationPreference(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static NotificationPreferenceStateObject valueOf(String value) { + switch (value) { + case "notification_preference": + return NOTIFICATION_PREFERENCE; + case "experience_notification_preference": + return EXPERIENCE_NOTIFICATION_PREFERENCE; + default: + return new NotificationPreferenceStateObject(Value.UNKNOWN, value); + } + } + + public enum Value { + NOTIFICATION_PREFERENCE, + + EXPERIENCE_NOTIFICATION_PREFERENCE, + + UNKNOWN + } + + public interface Visitor { + T visitNotificationPreference(); + + T visitExperienceNotificationPreference(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/NotificationSender.java b/src/main/java/com/whop/api/types/NotificationSender.java new file mode 100644 index 00000000..27299dd0 --- /dev/null +++ b/src/main/java/com/whop/api/types/NotificationSender.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = NotificationSender.Builder.class) +public final class NotificationSender { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private NotificationSender( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID, prefixed user_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return Public username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NotificationSender && equalTo((NotificationSender) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(NotificationSender other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID, prefixed user_.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(NotificationSender other); + } + + public interface UsernameStage { + /** + *

Public username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + NotificationSender build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(NotificationSender other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

User ID, prefixed user_.

+ *

User ID, prefixed user_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Public username.

+ *

Public username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

Display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public NotificationSender build() { + return new NotificationSender(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/NotificationTopic.java b/src/main/java/com/whop/api/types/NotificationTopic.java new file mode 100644 index 00000000..ace9a932 --- /dev/null +++ b/src/main/java/com/whop/api/types/NotificationTopic.java @@ -0,0 +1,403 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = NotificationTopic.Builder.class) +public final class NotificationTopic { + private final boolean defaultPreferenceValue; + + private final Optional description; + + private final String id; + + private final String identifier; + + private final boolean isMention; + + private final String name; + + private final NotificationTopicTopicType topicType; + + private final Map additionalProperties; + + private NotificationTopic( + boolean defaultPreferenceValue, + Optional description, + String id, + String identifier, + boolean isMention, + String name, + NotificationTopicTopicType topicType, + Map additionalProperties) { + this.defaultPreferenceValue = defaultPreferenceValue; + this.description = description; + this.id = id; + this.identifier = identifier; + this.isMention = isMention; + this.name = name; + this.topicType = topicType; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether notifications for this topic are enabled by default when the user has not set a preference. + */ + @JsonProperty("default_preference_value") + public boolean getDefaultPreferenceValue() { + return defaultPreferenceValue; + } + + /** + * @return Human-readable explanation of what notifications in this topic are about. null when no description has been set. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return Notification topic ID, prefixed topic_. This is the value the notification preference endpoints take as topic_id. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Stable, human-readable name for the category, such as new-follower. Unlike id, it is the same in every environment, which makes it the value to match on in code and to read in logs. Treat it as an opaque string: the set is open and the casing is historical rather than normalized. + */ + @JsonProperty("identifier") + public String getIdentifier() { + return identifier; + } + + /** + * @return Whether this topic exclusively handles mention-based notifications. + */ + @JsonProperty("is_mention") + public boolean getIsMention() { + return isMention; + } + + /** + * @return Display name shown in notification preference settings. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return Scope of the topic: whether it applies to an account, a user, or an account's team. + */ + @JsonProperty("topic_type") + public NotificationTopicTopicType getTopicType() { + return topicType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NotificationTopic && equalTo((NotificationTopic) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(NotificationTopic other) { + return defaultPreferenceValue == other.defaultPreferenceValue + && description.equals(other.description) + && id.equals(other.id) + && identifier.equals(other.identifier) + && isMention == other.isMention + && name.equals(other.name) + && topicType.equals(other.topicType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.defaultPreferenceValue, + this.description, + this.id, + this.identifier, + this.isMention, + this.name, + this.topicType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DefaultPreferenceValueStage builder() { + return new Builder(); + } + + public interface DefaultPreferenceValueStage { + /** + *

Whether notifications for this topic are enabled by default when the user has not set a preference.

+ */ + IdStage defaultPreferenceValue(boolean defaultPreferenceValue); + + Builder from(NotificationTopic other); + } + + public interface IdStage { + /** + *

Notification topic ID, prefixed topic_. This is the value the notification preference endpoints take as topic_id.

+ */ + IdentifierStage id(@NotNull String id); + } + + public interface IdentifierStage { + /** + *

Stable, human-readable name for the category, such as new-follower. Unlike id, it is the same in every environment, which makes it the value to match on in code and to read in logs. Treat it as an opaque string: the set is open and the casing is historical rather than normalized.

+ */ + IsMentionStage identifier(@NotNull String identifier); + } + + public interface IsMentionStage { + /** + *

Whether this topic exclusively handles mention-based notifications.

+ */ + NameStage isMention(boolean isMention); + } + + public interface NameStage { + /** + *

Display name shown in notification preference settings.

+ */ + TopicTypeStage name(@NotNull String name); + } + + public interface TopicTypeStage { + /** + *

Scope of the topic: whether it applies to an account, a user, or an account's team.

+ */ + _FinalStage topicType(@NotNull NotificationTopicTopicType topicType); + } + + public interface _FinalStage { + NotificationTopic build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Human-readable explanation of what notifications in this topic are about. null when no description has been set.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements DefaultPreferenceValueStage, + IdStage, + IdentifierStage, + IsMentionStage, + NameStage, + TopicTypeStage, + _FinalStage { + private boolean defaultPreferenceValue; + + private String id; + + private String identifier; + + private boolean isMention; + + private String name; + + private NotificationTopicTopicType topicType; + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(NotificationTopic other) { + defaultPreferenceValue(other.getDefaultPreferenceValue()); + description(other.getDescription()); + id(other.getId()); + identifier(other.getIdentifier()); + isMention(other.getIsMention()); + name(other.getName()); + topicType(other.getTopicType()); + return this; + } + + /** + *

Whether notifications for this topic are enabled by default when the user has not set a preference.

+ *

Whether notifications for this topic are enabled by default when the user has not set a preference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("default_preference_value") + public IdStage defaultPreferenceValue(boolean defaultPreferenceValue) { + this.defaultPreferenceValue = defaultPreferenceValue; + return this; + } + + /** + *

Notification topic ID, prefixed topic_. This is the value the notification preference endpoints take as topic_id.

+ *

Notification topic ID, prefixed topic_. This is the value the notification preference endpoints take as topic_id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IdentifierStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Stable, human-readable name for the category, such as new-follower. Unlike id, it is the same in every environment, which makes it the value to match on in code and to read in logs. Treat it as an opaque string: the set is open and the casing is historical rather than normalized.

+ *

Stable, human-readable name for the category, such as new-follower. Unlike id, it is the same in every environment, which makes it the value to match on in code and to read in logs. Treat it as an opaque string: the set is open and the casing is historical rather than normalized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("identifier") + public IsMentionStage identifier(@NotNull String identifier) { + this.identifier = Objects.requireNonNull(identifier, "identifier must not be null"); + return this; + } + + /** + *

Whether this topic exclusively handles mention-based notifications.

+ *

Whether this topic exclusively handles mention-based notifications.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_mention") + public NameStage isMention(boolean isMention) { + this.isMention = isMention; + return this; + } + + /** + *

Display name shown in notification preference settings.

+ *

Display name shown in notification preference settings.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public TopicTypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

Scope of the topic: whether it applies to an account, a user, or an account's team.

+ *

Scope of the topic: whether it applies to an account, a user, or an account's team.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("topic_type") + public _FinalStage topicType(@NotNull NotificationTopicTopicType topicType) { + this.topicType = Objects.requireNonNull(topicType, "topicType must not be null"); + return this; + } + + /** + *

Human-readable explanation of what notifications in this topic are about. null when no description has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

Human-readable explanation of what notifications in this topic are about. null when no description has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

Human-readable explanation of what notifications in this topic are about. null when no description has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public NotificationTopic build() { + return new NotificationTopic( + defaultPreferenceValue, + description, + id, + identifier, + isMention, + name, + topicType, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/NotificationTopicSummary.java b/src/main/java/com/whop/api/types/NotificationTopicSummary.java new file mode 100644 index 00000000..e44c560d --- /dev/null +++ b/src/main/java/com/whop/api/types/NotificationTopicSummary.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = NotificationTopicSummary.Builder.class) +public final class NotificationTopicSummary { + private final boolean defaultPreferenceValue; + + private final String id; + + private final boolean isMention; + + private final NotificationTopicSummaryTopicType topicType; + + private final Map additionalProperties; + + private NotificationTopicSummary( + boolean defaultPreferenceValue, + String id, + boolean isMention, + NotificationTopicSummaryTopicType topicType, + Map additionalProperties) { + this.defaultPreferenceValue = defaultPreferenceValue; + this.id = id; + this.isMention = isMention; + this.topicType = topicType; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether notifications for this topic are enabled by default when the user has not set a preference. + */ + @JsonProperty("default_preference_value") + public boolean getDefaultPreferenceValue() { + return defaultPreferenceValue; + } + + /** + * @return Notification topic ID, prefixed topic_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whether this topic exclusively handles mention-based notifications. + */ + @JsonProperty("is_mention") + public boolean getIsMention() { + return isMention; + } + + /** + * @return Scope of the topic: whether it applies to an account, a user, or an account's team. + */ + @JsonProperty("topic_type") + public NotificationTopicSummaryTopicType getTopicType() { + return topicType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NotificationTopicSummary && equalTo((NotificationTopicSummary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(NotificationTopicSummary other) { + return defaultPreferenceValue == other.defaultPreferenceValue + && id.equals(other.id) + && isMention == other.isMention + && topicType.equals(other.topicType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.defaultPreferenceValue, this.id, this.isMention, this.topicType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DefaultPreferenceValueStage builder() { + return new Builder(); + } + + public interface DefaultPreferenceValueStage { + /** + *

Whether notifications for this topic are enabled by default when the user has not set a preference.

+ */ + IdStage defaultPreferenceValue(boolean defaultPreferenceValue); + + Builder from(NotificationTopicSummary other); + } + + public interface IdStage { + /** + *

Notification topic ID, prefixed topic_.

+ */ + IsMentionStage id(@NotNull String id); + } + + public interface IsMentionStage { + /** + *

Whether this topic exclusively handles mention-based notifications.

+ */ + TopicTypeStage isMention(boolean isMention); + } + + public interface TopicTypeStage { + /** + *

Scope of the topic: whether it applies to an account, a user, or an account's team.

+ */ + _FinalStage topicType(@NotNull NotificationTopicSummaryTopicType topicType); + } + + public interface _FinalStage { + NotificationTopicSummary build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements DefaultPreferenceValueStage, IdStage, IsMentionStage, TopicTypeStage, _FinalStage { + private boolean defaultPreferenceValue; + + private String id; + + private boolean isMention; + + private NotificationTopicSummaryTopicType topicType; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(NotificationTopicSummary other) { + defaultPreferenceValue(other.getDefaultPreferenceValue()); + id(other.getId()); + isMention(other.getIsMention()); + topicType(other.getTopicType()); + return this; + } + + /** + *

Whether notifications for this topic are enabled by default when the user has not set a preference.

+ *

Whether notifications for this topic are enabled by default when the user has not set a preference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("default_preference_value") + public IdStage defaultPreferenceValue(boolean defaultPreferenceValue) { + this.defaultPreferenceValue = defaultPreferenceValue; + return this; + } + + /** + *

Notification topic ID, prefixed topic_.

+ *

Notification topic ID, prefixed topic_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsMentionStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether this topic exclusively handles mention-based notifications.

+ *

Whether this topic exclusively handles mention-based notifications.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_mention") + public TopicTypeStage isMention(boolean isMention) { + this.isMention = isMention; + return this; + } + + /** + *

Scope of the topic: whether it applies to an account, a user, or an account's team.

+ *

Scope of the topic: whether it applies to an account, a user, or an account's team.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("topic_type") + public _FinalStage topicType(@NotNull NotificationTopicSummaryTopicType topicType) { + this.topicType = Objects.requireNonNull(topicType, "topicType must not be null"); + return this; + } + + @java.lang.Override + public NotificationTopicSummary build() { + return new NotificationTopicSummary(defaultPreferenceValue, id, isMention, topicType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/NotificationTopicSummaryTopicType.java b/src/main/java/com/whop/api/types/NotificationTopicSummaryTopicType.java new file mode 100644 index 00000000..35498c6c --- /dev/null +++ b/src/main/java/com/whop/api/types/NotificationTopicSummaryTopicType.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class NotificationTopicSummaryTopicType { + public static final NotificationTopicSummaryTopicType ACCOUNT = + new NotificationTopicSummaryTopicType(Value.ACCOUNT, "account"); + + public static final NotificationTopicSummaryTopicType USER = + new NotificationTopicSummaryTopicType(Value.USER, "user"); + + public static final NotificationTopicSummaryTopicType ACCOUNT_TEAM = + new NotificationTopicSummaryTopicType(Value.ACCOUNT_TEAM, "account_team"); + + private final Value value; + + private final String string; + + NotificationTopicSummaryTopicType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof NotificationTopicSummaryTopicType + && this.string.equals(((NotificationTopicSummaryTopicType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ACCOUNT: + return visitor.visitAccount(); + case USER: + return visitor.visitUser(); + case ACCOUNT_TEAM: + return visitor.visitAccountTeam(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static NotificationTopicSummaryTopicType valueOf(String value) { + switch (value) { + case "account": + return ACCOUNT; + case "user": + return USER; + case "account_team": + return ACCOUNT_TEAM; + default: + return new NotificationTopicSummaryTopicType(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT, + + USER, + + ACCOUNT_TEAM, + + UNKNOWN + } + + public interface Visitor { + T visitAccount(); + + T visitUser(); + + T visitAccountTeam(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/NotificationTopicTopicType.java b/src/main/java/com/whop/api/types/NotificationTopicTopicType.java new file mode 100644 index 00000000..a3ab738e --- /dev/null +++ b/src/main/java/com/whop/api/types/NotificationTopicTopicType.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class NotificationTopicTopicType { + public static final NotificationTopicTopicType ACCOUNT = new NotificationTopicTopicType(Value.ACCOUNT, "account"); + + public static final NotificationTopicTopicType USER = new NotificationTopicTopicType(Value.USER, "user"); + + public static final NotificationTopicTopicType ACCOUNT_TEAM = + new NotificationTopicTopicType(Value.ACCOUNT_TEAM, "account_team"); + + private final Value value; + + private final String string; + + NotificationTopicTopicType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof NotificationTopicTopicType + && this.string.equals(((NotificationTopicTopicType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ACCOUNT: + return visitor.visitAccount(); + case USER: + return visitor.visitUser(); + case ACCOUNT_TEAM: + return visitor.visitAccountTeam(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static NotificationTopicTopicType valueOf(String value) { + switch (value) { + case "account": + return ACCOUNT; + case "user": + return USER; + case "account_team": + return ACCOUNT_TEAM; + default: + return new NotificationTopicTopicType(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT, + + USER, + + ACCOUNT_TEAM, + + UNKNOWN + } + + public interface Visitor { + T visitAccount(); + + T visitUser(); + + T visitAccountTeam(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/OauthGrant.java b/src/main/java/com/whop/api/types/OauthGrant.java new file mode 100644 index 00000000..98203f4b --- /dev/null +++ b/src/main/java/com/whop/api/types/OauthGrant.java @@ -0,0 +1,521 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = OauthGrant.Builder.class) +public final class OauthGrant { + private final Optional accountId; + + private final String appId; + + private final Optional authorizedAt; + + private final String createdAt; + + private final String id; + + private final Optional redirectUrl; + + private final Optional revokedAt; + + private final List scopes; + + private final Map additionalProperties; + + private OauthGrant( + Optional accountId, + String appId, + Optional authorizedAt, + String createdAt, + String id, + Optional redirectUrl, + Optional revokedAt, + List scopes, + Map additionalProperties) { + this.accountId = accountId; + this.appId = appId; + this.authorizedAt = authorizedAt; + this.createdAt = createdAt; + this.id = id; + this.redirectUrl = redirectUrl; + this.revokedAt = revokedAt; + this.scopes = scopes; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account the grant is scoped to, prefixed biz_. null when the user authorized the app for themselves rather than for one of their accounts. + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The app this grant authorizes, prefixed app_. + */ + @JsonProperty("app_id") + public String getAppId() { + return appId; + } + + /** + * @return When the user last authorized the app, as an ISO 8601 timestamp. + */ + @JsonIgnore + public Optional getAuthorizedAt() { + if (authorizedAt == null) { + return Optional.empty(); + } + return authorizedAt; + } + + /** + * @return When the user first authorized the app, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Grant ID, prefixed oag_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Where to send the user to finish the flow: the redirect_uri you supplied with the authorization code appended, and state when you supplied one. Its scheme, host, port, and path come back exactly as sent — never re-cased or re-encoded — because the client matches them against its registered URI. Returned only once, on create: the code is single-use and expires 10 minutes after it is issued, so redirect immediately. + */ + @JsonProperty("redirect_url") + public Optional getRedirectUrl() { + return redirectUrl; + } + + /** + * @return When the grant was revoked, as an ISO 8601 timestamp, or null while it is still in force. A revoked grant authorizes nothing — treat its scopes as no longer granted. + */ + @JsonIgnore + public Optional getRevokedAt() { + if (revokedAt == null) { + return Optional.empty(); + } + return revokedAt; + } + + @JsonProperty("scopes") + public List getScopes() { + return scopes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("authorized_at") + private Optional _getAuthorizedAt() { + return authorizedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("revoked_at") + private Optional _getRevokedAt() { + return revokedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OauthGrant && equalTo((OauthGrant) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OauthGrant other) { + return accountId.equals(other.accountId) + && appId.equals(other.appId) + && authorizedAt.equals(other.authorizedAt) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && redirectUrl.equals(other.redirectUrl) + && revokedAt.equals(other.revokedAt) + && scopes.equals(other.scopes); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.appId, + this.authorizedAt, + this.createdAt, + this.id, + this.redirectUrl, + this.revokedAt, + this.scopes); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppIdStage builder() { + return new Builder(); + } + + public interface AppIdStage { + /** + *

The app this grant authorizes, prefixed app_.

+ */ + CreatedAtStage appId(@NotNull String appId); + + Builder from(OauthGrant other); + } + + public interface CreatedAtStage { + /** + *

When the user first authorized the app, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Grant ID, prefixed oag_.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + OauthGrant build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account the grant is scoped to, prefixed biz_. null when the user authorized the app for themselves rather than for one of their accounts.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

When the user last authorized the app, as an ISO 8601 timestamp.

+ */ + _FinalStage authorizedAt(Optional authorizedAt); + + _FinalStage authorizedAt(String authorizedAt); + + _FinalStage authorizedAt(Nullable authorizedAt); + + /** + *

Where to send the user to finish the flow: the redirect_uri you supplied with the authorization code appended, and state when you supplied one. Its scheme, host, port, and path come back exactly as sent — never re-cased or re-encoded — because the client matches them against its registered URI. Returned only once, on create: the code is single-use and expires 10 minutes after it is issued, so redirect immediately.

+ */ + _FinalStage redirectUrl(Optional redirectUrl); + + _FinalStage redirectUrl(String redirectUrl); + + /** + *

When the grant was revoked, as an ISO 8601 timestamp, or null while it is still in force. A revoked grant authorizes nothing — treat its scopes as no longer granted.

+ */ + _FinalStage revokedAt(Optional revokedAt); + + _FinalStage revokedAt(String revokedAt); + + _FinalStage revokedAt(Nullable revokedAt); + + _FinalStage scopes(List scopes); + + _FinalStage addScopes(String scopes); + + _FinalStage addAllScopes(List scopes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AppIdStage, CreatedAtStage, IdStage, _FinalStage { + private String appId; + + private String createdAt; + + private String id; + + private List scopes = new ArrayList<>(); + + private Optional revokedAt = Optional.empty(); + + private Optional redirectUrl = Optional.empty(); + + private Optional authorizedAt = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(OauthGrant other) { + accountId(other.getAccountId()); + appId(other.getAppId()); + authorizedAt(other.getAuthorizedAt()); + createdAt(other.getCreatedAt()); + id(other.getId()); + redirectUrl(other.getRedirectUrl()); + revokedAt(other.getRevokedAt()); + scopes(other.getScopes()); + return this; + } + + /** + *

The app this grant authorizes, prefixed app_.

+ *

The app this grant authorizes, prefixed app_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("app_id") + public CreatedAtStage appId(@NotNull String appId) { + this.appId = Objects.requireNonNull(appId, "appId must not be null"); + return this; + } + + /** + *

When the user first authorized the app, as an ISO 8601 timestamp.

+ *

When the user first authorized the app, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Grant ID, prefixed oag_.

+ *

Grant ID, prefixed oag_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllScopes(List scopes) { + if (scopes != null) { + this.scopes.addAll(scopes); + } + return this; + } + + @java.lang.Override + public _FinalStage addScopes(String scopes) { + this.scopes.add(scopes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scopes", nulls = Nulls.SKIP) + public _FinalStage scopes(List scopes) { + this.scopes.clear(); + if (scopes != null) { + this.scopes.addAll(scopes); + } + return this; + } + + /** + *

When the grant was revoked, as an ISO 8601 timestamp, or null while it is still in force. A revoked grant authorizes nothing — treat its scopes as no longer granted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage revokedAt(Nullable revokedAt) { + if (revokedAt.isNull()) { + this.revokedAt = null; + } else if (revokedAt.isEmpty()) { + this.revokedAt = Optional.empty(); + } else { + this.revokedAt = Optional.of(revokedAt.get()); + } + return this; + } + + /** + *

When the grant was revoked, as an ISO 8601 timestamp, or null while it is still in force. A revoked grant authorizes nothing — treat its scopes as no longer granted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage revokedAt(String revokedAt) { + this.revokedAt = Optional.ofNullable(revokedAt); + return this; + } + + /** + *

When the grant was revoked, as an ISO 8601 timestamp, or null while it is still in force. A revoked grant authorizes nothing — treat its scopes as no longer granted.

+ */ + @java.lang.Override + @JsonSetter(value = "revoked_at", nulls = Nulls.SKIP) + public _FinalStage revokedAt(Optional revokedAt) { + this.revokedAt = revokedAt; + return this; + } + + /** + *

Where to send the user to finish the flow: the redirect_uri you supplied with the authorization code appended, and state when you supplied one. Its scheme, host, port, and path come back exactly as sent — never re-cased or re-encoded — because the client matches them against its registered URI. Returned only once, on create: the code is single-use and expires 10 minutes after it is issued, so redirect immediately.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redirectUrl(String redirectUrl) { + this.redirectUrl = Optional.ofNullable(redirectUrl); + return this; + } + + /** + *

Where to send the user to finish the flow: the redirect_uri you supplied with the authorization code appended, and state when you supplied one. Its scheme, host, port, and path come back exactly as sent — never re-cased or re-encoded — because the client matches them against its registered URI. Returned only once, on create: the code is single-use and expires 10 minutes after it is issued, so redirect immediately.

+ */ + @java.lang.Override + @JsonSetter(value = "redirect_url", nulls = Nulls.SKIP) + public _FinalStage redirectUrl(Optional redirectUrl) { + this.redirectUrl = redirectUrl; + return this; + } + + /** + *

When the user last authorized the app, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage authorizedAt(Nullable authorizedAt) { + if (authorizedAt.isNull()) { + this.authorizedAt = null; + } else if (authorizedAt.isEmpty()) { + this.authorizedAt = Optional.empty(); + } else { + this.authorizedAt = Optional.of(authorizedAt.get()); + } + return this; + } + + /** + *

When the user last authorized the app, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage authorizedAt(String authorizedAt) { + this.authorizedAt = Optional.ofNullable(authorizedAt); + return this; + } + + /** + *

When the user last authorized the app, as an ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "authorized_at", nulls = Nulls.SKIP) + public _FinalStage authorizedAt(Optional authorizedAt) { + this.authorizedAt = authorizedAt; + return this; + } + + /** + *

The account the grant is scoped to, prefixed biz_. null when the user authorized the app for themselves rather than for one of their accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account the grant is scoped to, prefixed biz_. null when the user authorized the app for themselves rather than for one of their accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account the grant is scoped to, prefixed biz_. null when the user authorized the app for themselves rather than for one of their accounts.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public OauthGrant build() { + return new OauthGrant( + accountId, + appId, + authorizedAt, + createdAt, + id, + redirectUrl, + revokedAt, + scopes, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PageInfo.java b/src/main/java/com/whop/api/types/PageInfo.java new file mode 100644 index 00000000..5696693d --- /dev/null +++ b/src/main/java/com/whop/api/types/PageInfo.java @@ -0,0 +1,310 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PageInfo.Builder.class) +public final class PageInfo { + private final Optional endCursor; + + private final boolean hasNextPage; + + private final boolean hasPreviousPage; + + private final Optional startCursor; + + private final Map additionalProperties; + + private PageInfo( + Optional endCursor, + boolean hasNextPage, + boolean hasPreviousPage, + Optional startCursor, + Map additionalProperties) { + this.endCursor = endCursor; + this.hasNextPage = hasNextPage; + this.hasPreviousPage = hasPreviousPage; + this.startCursor = startCursor; + this.additionalProperties = additionalProperties; + } + + /** + * @return When paginating forwards, the cursor to continue. + */ + @JsonIgnore + public Optional getEndCursor() { + if (endCursor == null) { + return Optional.empty(); + } + return endCursor; + } + + /** + * @return When paginating forwards, are there more items? + */ + @JsonProperty("has_next_page") + public boolean getHasNextPage() { + return hasNextPage; + } + + /** + * @return When paginating backwards, are there more items? + */ + @JsonProperty("has_previous_page") + public boolean getHasPreviousPage() { + return hasPreviousPage; + } + + /** + * @return When paginating backwards, the cursor to continue. + */ + @JsonIgnore + public Optional getStartCursor() { + if (startCursor == null) { + return Optional.empty(); + } + return startCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("end_cursor") + private Optional _getEndCursor() { + return endCursor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("start_cursor") + private Optional _getStartCursor() { + return startCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PageInfo && equalTo((PageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PageInfo other) { + return endCursor.equals(other.endCursor) + && hasNextPage == other.hasNextPage + && hasPreviousPage == other.hasPreviousPage + && startCursor.equals(other.startCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCursor, this.hasNextPage, this.hasPreviousPage, this.startCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HasNextPageStage builder() { + return new Builder(); + } + + public interface HasNextPageStage { + /** + *

When paginating forwards, are there more items?

+ */ + HasPreviousPageStage hasNextPage(boolean hasNextPage); + + Builder from(PageInfo other); + } + + public interface HasPreviousPageStage { + /** + *

When paginating backwards, are there more items?

+ */ + _FinalStage hasPreviousPage(boolean hasPreviousPage); + } + + public interface _FinalStage { + PageInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When paginating forwards, the cursor to continue.

+ */ + _FinalStage endCursor(Optional endCursor); + + _FinalStage endCursor(String endCursor); + + _FinalStage endCursor(Nullable endCursor); + + /** + *

When paginating backwards, the cursor to continue.

+ */ + _FinalStage startCursor(Optional startCursor); + + _FinalStage startCursor(String startCursor); + + _FinalStage startCursor(Nullable startCursor); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HasNextPageStage, HasPreviousPageStage, _FinalStage { + private boolean hasNextPage; + + private boolean hasPreviousPage; + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PageInfo other) { + endCursor(other.getEndCursor()); + hasNextPage(other.getHasNextPage()); + hasPreviousPage(other.getHasPreviousPage()); + startCursor(other.getStartCursor()); + return this; + } + + /** + *

When paginating forwards, are there more items?

+ *

When paginating forwards, are there more items?

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("has_next_page") + public HasPreviousPageStage hasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + /** + *

When paginating backwards, are there more items?

+ *

When paginating backwards, are there more items?

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("has_previous_page") + public _FinalStage hasPreviousPage(boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + return this; + } + + /** + *

When paginating backwards, the cursor to continue.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startCursor(Nullable startCursor) { + if (startCursor.isNull()) { + this.startCursor = null; + } else if (startCursor.isEmpty()) { + this.startCursor = Optional.empty(); + } else { + this.startCursor = Optional.of(startCursor.get()); + } + return this; + } + + /** + *

When paginating backwards, the cursor to continue.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + /** + *

When paginating backwards, the cursor to continue.

+ */ + @java.lang.Override + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public _FinalStage startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + /** + *

When paginating forwards, the cursor to continue.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endCursor(Nullable endCursor) { + if (endCursor.isNull()) { + this.endCursor = null; + } else if (endCursor.isEmpty()) { + this.endCursor = Optional.empty(); + } else { + this.endCursor = Optional.of(endCursor.get()); + } + return this; + } + + /** + *

When paginating forwards, the cursor to continue.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + /** + *

When paginating forwards, the cursor to continue.

+ */ + @java.lang.Override + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public _FinalStage endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + @java.lang.Override + public PageInfo build() { + return new PageInfo(endCursor, hasNextPage, hasPreviousPage, startCursor, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Pagination.java b/src/main/java/com/whop/api/types/Pagination.java new file mode 100644 index 00000000..1490b1fe --- /dev/null +++ b/src/main/java/com/whop/api/types/Pagination.java @@ -0,0 +1,345 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Pagination.Builder.class) +public final class Pagination { + private final double currentPage; + + private final Optional nextPage; + + private final Optional prevPage; + + private final double totalCount; + + private final double totalPages; + + private final Map additionalProperties; + + private Pagination( + double currentPage, + Optional nextPage, + Optional prevPage, + double totalCount, + double totalPages, + Map additionalProperties) { + this.currentPage = currentPage; + this.nextPage = nextPage; + this.prevPage = prevPage; + this.totalCount = totalCount; + this.totalPages = totalPages; + this.additionalProperties = additionalProperties; + } + + /** + * @return Current page number + */ + @JsonProperty("current_page") + public double getCurrentPage() { + return currentPage; + } + + /** + * @return Next page number + */ + @JsonIgnore + public Optional getNextPage() { + if (nextPage == null) { + return Optional.empty(); + } + return nextPage; + } + + /** + * @return Previous page number + */ + @JsonIgnore + public Optional getPrevPage() { + if (prevPage == null) { + return Optional.empty(); + } + return prevPage; + } + + /** + * @return Total number of records + */ + @JsonProperty("total_count") + public double getTotalCount() { + return totalCount; + } + + /** + * @return Total number of pages + */ + @JsonProperty("total_pages") + public double getTotalPages() { + return totalPages; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("next_page") + private Optional _getNextPage() { + return nextPage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("prev_page") + private Optional _getPrevPage() { + return prevPage; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Pagination && equalTo((Pagination) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Pagination other) { + return currentPage == other.currentPage + && nextPage.equals(other.nextPage) + && prevPage.equals(other.prevPage) + && totalCount == other.totalCount + && totalPages == other.totalPages; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currentPage, this.nextPage, this.prevPage, this.totalCount, this.totalPages); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrentPageStage builder() { + return new Builder(); + } + + public interface CurrentPageStage { + /** + *

Current page number

+ */ + TotalCountStage currentPage(double currentPage); + + Builder from(Pagination other); + } + + public interface TotalCountStage { + /** + *

Total number of records

+ */ + TotalPagesStage totalCount(double totalCount); + } + + public interface TotalPagesStage { + /** + *

Total number of pages

+ */ + _FinalStage totalPages(double totalPages); + } + + public interface _FinalStage { + Pagination build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Next page number

+ */ + _FinalStage nextPage(Optional nextPage); + + _FinalStage nextPage(Double nextPage); + + _FinalStage nextPage(Nullable nextPage); + + /** + *

Previous page number

+ */ + _FinalStage prevPage(Optional prevPage); + + _FinalStage prevPage(Double prevPage); + + _FinalStage prevPage(Nullable prevPage); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrentPageStage, TotalCountStage, TotalPagesStage, _FinalStage { + private double currentPage; + + private double totalCount; + + private double totalPages; + + private Optional prevPage = Optional.empty(); + + private Optional nextPage = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Pagination other) { + currentPage(other.getCurrentPage()); + nextPage(other.getNextPage()); + prevPage(other.getPrevPage()); + totalCount(other.getTotalCount()); + totalPages(other.getTotalPages()); + return this; + } + + /** + *

Current page number

+ *

Current page number

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("current_page") + public TotalCountStage currentPage(double currentPage) { + this.currentPage = currentPage; + return this; + } + + /** + *

Total number of records

+ *

Total number of records

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_count") + public TotalPagesStage totalCount(double totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + *

Total number of pages

+ *

Total number of pages

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_pages") + public _FinalStage totalPages(double totalPages) { + this.totalPages = totalPages; + return this; + } + + /** + *

Previous page number

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage prevPage(Nullable prevPage) { + if (prevPage.isNull()) { + this.prevPage = null; + } else if (prevPage.isEmpty()) { + this.prevPage = Optional.empty(); + } else { + this.prevPage = Optional.of(prevPage.get()); + } + return this; + } + + /** + *

Previous page number

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage prevPage(Double prevPage) { + this.prevPage = Optional.ofNullable(prevPage); + return this; + } + + /** + *

Previous page number

+ */ + @java.lang.Override + @JsonSetter(value = "prev_page", nulls = Nulls.SKIP) + public _FinalStage prevPage(Optional prevPage) { + this.prevPage = prevPage; + return this; + } + + /** + *

Next page number

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nextPage(Nullable nextPage) { + if (nextPage.isNull()) { + this.nextPage = null; + } else if (nextPage.isEmpty()) { + this.nextPage = Optional.empty(); + } else { + this.nextPage = Optional.of(nextPage.get()); + } + return this; + } + + /** + *

Next page number

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nextPage(Double nextPage) { + this.nextPage = Optional.ofNullable(nextPage); + return this; + } + + /** + *

Next page number

+ */ + @java.lang.Override + @JsonSetter(value = "next_page", nulls = Nulls.SKIP) + public _FinalStage nextPage(Optional nextPage) { + this.nextPage = nextPage; + return this; + } + + @java.lang.Override + public Pagination build() { + return new Pagination(currentPage, nextPage, prevPage, totalCount, totalPages, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Passkey.java b/src/main/java/com/whop/api/types/Passkey.java new file mode 100644 index 00000000..ca8a2ad0 --- /dev/null +++ b/src/main/java/com/whop/api/types/Passkey.java @@ -0,0 +1,312 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Passkey.Builder.class) +public final class Passkey { + private final String createdAt; + + private final String credentialId; + + private final String id; + + private final Optional lastUsedAt; + + private final String nickname; + + private final Map additionalProperties; + + private Passkey( + String createdAt, + String credentialId, + String id, + Optional lastUsedAt, + String nickname, + Map additionalProperties) { + this.createdAt = createdAt; + this.credentialId = credentialId; + this.id = id; + this.lastUsedAt = lastUsedAt; + this.nickname = nickname; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the user registered this passkey, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return The WebAuthn credential ID as a base64url string. Pass it in allowCredentials when you run a ceremony against this specific passkey. + */ + @JsonProperty("credential_id") + public String getCredentialId() { + return credentialId; + } + + /** + * @return Passkey ID, prefixed wcred_. Use it to delete the passkey. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return When this passkey last completed a WebAuthn ceremony, as an ISO 8601 timestamp, or null if it never has. + */ + @JsonIgnore + public Optional getLastUsedAt() { + if (lastUsedAt == null) { + return Optional.empty(); + } + return lastUsedAt; + } + + /** + * @return The name the user gave this passkey, usually the device it lives on. + */ + @JsonProperty("nickname") + public String getNickname() { + return nickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_used_at") + private Optional _getLastUsedAt() { + return lastUsedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Passkey && equalTo((Passkey) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Passkey other) { + return createdAt.equals(other.createdAt) + && credentialId.equals(other.credentialId) + && id.equals(other.id) + && lastUsedAt.equals(other.lastUsedAt) + && nickname.equals(other.nickname); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.credentialId, this.id, this.lastUsedAt, this.nickname); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the user registered this passkey, as an ISO 8601 timestamp.

+ */ + CredentialIdStage createdAt(@NotNull String createdAt); + + Builder from(Passkey other); + } + + public interface CredentialIdStage { + /** + *

The WebAuthn credential ID as a base64url string. Pass it in allowCredentials when you run a ceremony against this specific passkey.

+ */ + IdStage credentialId(@NotNull String credentialId); + } + + public interface IdStage { + /** + *

Passkey ID, prefixed wcred_. Use it to delete the passkey.

+ */ + NicknameStage id(@NotNull String id); + } + + public interface NicknameStage { + /** + *

The name the user gave this passkey, usually the device it lives on.

+ */ + _FinalStage nickname(@NotNull String nickname); + } + + public interface _FinalStage { + Passkey build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When this passkey last completed a WebAuthn ceremony, as an ISO 8601 timestamp, or null if it never has.

+ */ + _FinalStage lastUsedAt(Optional lastUsedAt); + + _FinalStage lastUsedAt(String lastUsedAt); + + _FinalStage lastUsedAt(Nullable lastUsedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, CredentialIdStage, IdStage, NicknameStage, _FinalStage { + private String createdAt; + + private String credentialId; + + private String id; + + private String nickname; + + private Optional lastUsedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Passkey other) { + createdAt(other.getCreatedAt()); + credentialId(other.getCredentialId()); + id(other.getId()); + lastUsedAt(other.getLastUsedAt()); + nickname(other.getNickname()); + return this; + } + + /** + *

When the user registered this passkey, as an ISO 8601 timestamp.

+ *

When the user registered this passkey, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CredentialIdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The WebAuthn credential ID as a base64url string. Pass it in allowCredentials when you run a ceremony against this specific passkey.

+ *

The WebAuthn credential ID as a base64url string. Pass it in allowCredentials when you run a ceremony against this specific passkey.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("credential_id") + public IdStage credentialId(@NotNull String credentialId) { + this.credentialId = Objects.requireNonNull(credentialId, "credentialId must not be null"); + return this; + } + + /** + *

Passkey ID, prefixed wcred_. Use it to delete the passkey.

+ *

Passkey ID, prefixed wcred_. Use it to delete the passkey.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NicknameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The name the user gave this passkey, usually the device it lives on.

+ *

The name the user gave this passkey, usually the device it lives on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("nickname") + public _FinalStage nickname(@NotNull String nickname) { + this.nickname = Objects.requireNonNull(nickname, "nickname must not be null"); + return this; + } + + /** + *

When this passkey last completed a WebAuthn ceremony, as an ISO 8601 timestamp, or null if it never has.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastUsedAt(Nullable lastUsedAt) { + if (lastUsedAt.isNull()) { + this.lastUsedAt = null; + } else if (lastUsedAt.isEmpty()) { + this.lastUsedAt = Optional.empty(); + } else { + this.lastUsedAt = Optional.of(lastUsedAt.get()); + } + return this; + } + + /** + *

When this passkey last completed a WebAuthn ceremony, as an ISO 8601 timestamp, or null if it never has.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastUsedAt(String lastUsedAt) { + this.lastUsedAt = Optional.ofNullable(lastUsedAt); + return this; + } + + /** + *

When this passkey last completed a WebAuthn ceremony, as an ISO 8601 timestamp, or null if it never has.

+ */ + @java.lang.Override + @JsonSetter(value = "last_used_at", nulls = Nulls.SKIP) + public _FinalStage lastUsedAt(Optional lastUsedAt) { + this.lastUsedAt = lastUsedAt; + return this; + } + + @java.lang.Override + public Passkey build() { + return new Passkey(createdAt, credentialId, id, lastUsedAt, nickname, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Payment.java b/src/main/java/com/whop/api/types/Payment.java new file mode 100644 index 00000000..f5759167 --- /dev/null +++ b/src/main/java/com/whop/api/types/Payment.java @@ -0,0 +1,4152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Payment.Builder.class) +public final class Payment implements IPayment { + private final double amountAfterFees; + + private final Optional applicationFee; + + private final boolean autoRefunded; + + private final Optional billingAddress; + + private final Optional billingReason; + + private final Optional cardBrand; + + private final Optional cardExpMonth; + + private final Optional cardExpYear; + + private final Optional cardLast4; + + private final Optional checkoutConfigurationId; + + private final Optional company; + + private final OffsetDateTime createdAt; + + private final Currencies currency; + + private final Optional customerPhone; + + private final Optional declineCode; + + private final Optional disputeAlertedAt; + + private final Optional> disputes; + + private final Optional failureMessage; + + private final Optional financingInstallmentsCount; + + private final List financingTransactions; + + private final String id; + + private final Optional lastPaymentAttempt; + + private final Optional member; + + private final Optional membership; + + private final Optional> metadata; + + private final Optional needsTracking; + + private final Optional nextPaymentAttempt; + + private final Optional paidAt; + + private final Optional paymentInstrument; + + private final Optional paymentMethod; + + private final Optional paymentMethodType; + + private final Optional paymentsFailed; + + private final Optional plan; + + private final Optional product; + + private final Optional promoCode; + + private final boolean refundable; + + private final Optional refundedAmount; + + private final Optional refundedAt; + + private final List refunds; + + private final Optional> resolutions; + + private final boolean retryable; + + private final Optional riskScore; + + private final Optional> riskSignals; + + private final double settlementAmount; + + private final Currencies settlementCurrency; + + private final Optional settlementExchangeRate; + + private final Optional settlementTimeAt; + + private final Optional shipment; + + private final Optional shippingAddress; + + private final Optional status; + + private final FriendlyReceiptStatus substatus; + + private final Optional subtotal; + + private final Optional taxAmount; + + private final Optional taxBehavior; + + private final Optional taxRefundedAmount; + + private final boolean threeDsVerified; + + private final Optional total; + + private final OffsetDateTime updatedAt; + + private final Optional usdTotal; + + private final Optional user; + + private final Optional verificationChecks; + + private final boolean voidable; + + private final Map additionalProperties; + + private Payment( + double amountAfterFees, + Optional applicationFee, + boolean autoRefunded, + Optional billingAddress, + Optional billingReason, + Optional cardBrand, + Optional cardExpMonth, + Optional cardExpYear, + Optional cardLast4, + Optional checkoutConfigurationId, + Optional company, + OffsetDateTime createdAt, + Currencies currency, + Optional customerPhone, + Optional declineCode, + Optional disputeAlertedAt, + Optional> disputes, + Optional failureMessage, + Optional financingInstallmentsCount, + List financingTransactions, + String id, + Optional lastPaymentAttempt, + Optional member, + Optional membership, + Optional> metadata, + Optional needsTracking, + Optional nextPaymentAttempt, + Optional paidAt, + Optional paymentInstrument, + Optional paymentMethod, + Optional paymentMethodType, + Optional paymentsFailed, + Optional plan, + Optional product, + Optional promoCode, + boolean refundable, + Optional refundedAmount, + Optional refundedAt, + List refunds, + Optional> resolutions, + boolean retryable, + Optional riskScore, + Optional> riskSignals, + double settlementAmount, + Currencies settlementCurrency, + Optional settlementExchangeRate, + Optional settlementTimeAt, + Optional shipment, + Optional shippingAddress, + Optional status, + FriendlyReceiptStatus substatus, + Optional subtotal, + Optional taxAmount, + Optional taxBehavior, + Optional taxRefundedAmount, + boolean threeDsVerified, + Optional total, + OffsetDateTime updatedAt, + Optional usdTotal, + Optional user, + Optional verificationChecks, + boolean voidable, + Map additionalProperties) { + this.amountAfterFees = amountAfterFees; + this.applicationFee = applicationFee; + this.autoRefunded = autoRefunded; + this.billingAddress = billingAddress; + this.billingReason = billingReason; + this.cardBrand = cardBrand; + this.cardExpMonth = cardExpMonth; + this.cardExpYear = cardExpYear; + this.cardLast4 = cardLast4; + this.checkoutConfigurationId = checkoutConfigurationId; + this.company = company; + this.createdAt = createdAt; + this.currency = currency; + this.customerPhone = customerPhone; + this.declineCode = declineCode; + this.disputeAlertedAt = disputeAlertedAt; + this.disputes = disputes; + this.failureMessage = failureMessage; + this.financingInstallmentsCount = financingInstallmentsCount; + this.financingTransactions = financingTransactions; + this.id = id; + this.lastPaymentAttempt = lastPaymentAttempt; + this.member = member; + this.membership = membership; + this.metadata = metadata; + this.needsTracking = needsTracking; + this.nextPaymentAttempt = nextPaymentAttempt; + this.paidAt = paidAt; + this.paymentInstrument = paymentInstrument; + this.paymentMethod = paymentMethod; + this.paymentMethodType = paymentMethodType; + this.paymentsFailed = paymentsFailed; + this.plan = plan; + this.product = product; + this.promoCode = promoCode; + this.refundable = refundable; + this.refundedAmount = refundedAmount; + this.refundedAt = refundedAt; + this.refunds = refunds; + this.resolutions = resolutions; + this.retryable = retryable; + this.riskScore = riskScore; + this.riskSignals = riskSignals; + this.settlementAmount = settlementAmount; + this.settlementCurrency = settlementCurrency; + this.settlementExchangeRate = settlementExchangeRate; + this.settlementTimeAt = settlementTimeAt; + this.shipment = shipment; + this.shippingAddress = shippingAddress; + this.status = status; + this.substatus = substatus; + this.subtotal = subtotal; + this.taxAmount = taxAmount; + this.taxBehavior = taxBehavior; + this.taxRefundedAmount = taxRefundedAmount; + this.threeDsVerified = threeDsVerified; + this.total = total; + this.updatedAt = updatedAt; + this.usdTotal = usdTotal; + this.user = user; + this.verificationChecks = verificationChecks; + this.voidable = voidable; + this.additionalProperties = additionalProperties; + } + + /** + * @return How much the payment is for after fees + */ + @JsonProperty("amount_after_fees") + @java.lang.Override + public double getAmountAfterFees() { + return amountAfterFees; + } + + /** + * @return The application fee charged on this payment. + */ + @JsonIgnore + public Optional getApplicationFee() { + if (applicationFee == null) { + return Optional.empty(); + } + return applicationFee; + } + + /** + * @return Whether this payment was auto refunded or not + */ + @JsonProperty("auto_refunded") + @java.lang.Override + public boolean getAutoRefunded() { + return autoRefunded; + } + + /** + * @return The address of the user who made the payment. + */ + @JsonIgnore + public Optional getBillingAddress() { + if (billingAddress == null) { + return Optional.empty(); + } + return billingAddress; + } + + /** + * @return The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment. + */ + @JsonIgnore + @java.lang.Override + public Optional getBillingReason() { + if (billingReason == null) { + return Optional.empty(); + } + return billingReason; + } + + /** + * @return Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'. + */ + @JsonIgnore + @java.lang.Override + public Optional getCardBrand() { + if (cardBrand == null) { + return Optional.empty(); + } + return cardBrand; + } + + /** + * @return The expiration month (1-12) of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable. + */ + @JsonIgnore + @java.lang.Override + public Optional getCardExpMonth() { + if (cardExpMonth == null) { + return Optional.empty(); + } + return cardExpMonth; + } + + /** + * @return The four-digit expiration year of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable. + */ + @JsonIgnore + @java.lang.Override + public Optional getCardExpYear() { + if (cardExpYear == null) { + return Optional.empty(); + } + return cardExpYear; + } + + /** + * @return The last four digits of the card used to make this payment. Null if the payment was not made with a card. + */ + @JsonIgnore + @java.lang.Override + public Optional getCardLast4() { + if (cardLast4 == null) { + return Optional.empty(); + } + return cardLast4; + } + + /** + * @return The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them. + */ + @JsonIgnore + @java.lang.Override + public Optional getCheckoutConfigurationId() { + if (checkoutConfigurationId == null) { + return Optional.empty(); + } + return checkoutConfigurationId; + } + + /** + * @return The company for the payment. + */ + @JsonIgnore + public Optional getCompany() { + if (company == null) { + return Optional.empty(); + } + return company; + } + + /** + * @return The datetime the payment was created. + */ + @JsonProperty("created_at") + @java.lang.Override + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code for this payment (e.g., 'usd', 'eur'). + */ + @JsonProperty("currency") + @java.lang.Override + public Currencies getCurrency() { + return currency; + } + + /** + * @return Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected. + */ + @JsonIgnore + @java.lang.Override + public Optional getCustomerPhone() { + if (customerPhone == null) { + return Optional.empty(); + } + return customerPhone; + } + + /** + * @return The reason the payment was declined. Null if the payment did not fail. + */ + @JsonIgnore + @java.lang.Override + public Optional getDeclineCode() { + if (declineCode == null) { + return Optional.empty(); + } + return declineCode; + } + + /** + * @return When an alert came in that this transaction will be disputed + */ + @JsonIgnore + @java.lang.Override + public Optional getDisputeAlertedAt() { + if (disputeAlertedAt == null) { + return Optional.empty(); + } + return disputeAlertedAt; + } + + /** + * @return The disputes attached to this payment. Null if the actor in context does not have the payment:dispute:read permission. + */ + @JsonIgnore + public Optional> getDisputes() { + if (disputes == null) { + return Optional.empty(); + } + return disputes; + } + + /** + * @return If the payment failed, the reason for the failure. + */ + @JsonIgnore + @java.lang.Override + public Optional getFailureMessage() { + if (failureMessage == null) { + return Optional.empty(); + } + return failureMessage; + } + + /** + * @return The number of financing installments for the payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.). + */ + @JsonIgnore + @java.lang.Override + public Optional getFinancingInstallmentsCount() { + if (financingInstallmentsCount == null) { + return Optional.empty(); + } + return financingInstallmentsCount; + } + + /** + * @return The financing transactions attached to this payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.). + */ + @JsonProperty("financing_transactions") + public List getFinancingTransactions() { + return financingTransactions; + } + + /** + * @return The unique identifier for the payment. + */ + @JsonProperty("id") + @java.lang.Override + public String getId() { + return id; + } + + /** + * @return The time of the last payment attempt. + */ + @JsonIgnore + @java.lang.Override + public Optional getLastPaymentAttempt() { + if (lastPaymentAttempt == null) { + return Optional.empty(); + } + return lastPaymentAttempt; + } + + /** + * @return The member attached to this payment. + */ + @JsonIgnore + public Optional getMember() { + if (member == null) { + return Optional.empty(); + } + return member; + } + + /** + * @return The membership attached to this payment. + */ + @JsonIgnore + public Optional getMembership() { + if (membership == null) { + return Optional.empty(); + } + return membership; + } + + /** + * @return The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made + */ + @JsonIgnore + @java.lang.Override + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Whether this payment is holding funds until the order ships and has no tracking number yet. + */ + @JsonIgnore + @java.lang.Override + public Optional getNeedsTracking() { + if (needsTracking == null) { + return Optional.empty(); + } + return needsTracking; + } + + /** + * @return The time of the next schedule payment retry. + */ + @JsonIgnore + @java.lang.Override + public Optional getNextPaymentAttempt() { + if (nextPaymentAttempt == null) { + return Optional.empty(); + } + return nextPaymentAttempt; + } + + /** + * @return The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp. + */ + @JsonIgnore + @java.lang.Override + public Optional getPaidAt() { + if (paidAt == null) { + return Optional.empty(); + } + return paidAt; + } + + /** + * @return The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method. + */ + @JsonIgnore + public Optional getPaymentInstrument() { + if (paymentInstrument == null) { + return Optional.empty(); + } + return paymentInstrument; + } + + /** + * @return The tokenized payment method reference used for this payment. Null if no token was used. + */ + @JsonIgnore + public Optional getPaymentMethod() { + if (paymentMethod == null) { + return Optional.empty(); + } + return paymentMethod; + } + + /** + * @return The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type. + */ + @JsonIgnore + @java.lang.Override + public Optional getPaymentMethodType() { + if (paymentMethodType == null) { + return Optional.empty(); + } + return paymentMethodType; + } + + /** + * @return The number of failed payment attempts for the payment. + */ + @JsonIgnore + @java.lang.Override + public Optional getPaymentsFailed() { + if (paymentsFailed == null) { + return Optional.empty(); + } + return paymentsFailed; + } + + /** + * @return The plan attached to this payment. + */ + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + /** + * @return The product this payment was made for + */ + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return The promo code used for this payment. + */ + @JsonIgnore + public Optional getPromoCode() { + if (promoCode == null) { + return Optional.empty(); + } + return promoCode; + } + + /** + * @return True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds. + */ + @JsonProperty("refundable") + @java.lang.Override + public boolean getRefundable() { + return refundable; + } + + /** + * @return The payment refund amount(if applicable). + */ + @JsonIgnore + @java.lang.Override + public Optional getRefundedAmount() { + if (refundedAmount == null) { + return Optional.empty(); + } + return refundedAmount; + } + + /** + * @return When the payment was refunded (if applicable). + */ + @JsonIgnore + @java.lang.Override + public Optional getRefundedAt() { + if (refundedAt == null) { + return Optional.empty(); + } + return refundedAt; + } + + /** + * @return The refunds issued against this payment, newest first, including failed and canceled refund attempts. Limited to the 100 most recent. + */ + @JsonProperty("refunds") + public List getRefunds() { + return refunds; + } + + /** + * @return The resolution center cases opened by the customer on this payment. Null if the actor in context does not have the payment:resolution_center_case:read permission. + */ + @JsonIgnore + public Optional> getResolutions() { + if (resolutions == null) { + return Optional.empty(); + } + return resolutions; + } + + /** + * @return True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again. + */ + @JsonProperty("retryable") + @java.lang.Override + public boolean getRetryable() { + return retryable; + } + + /** + * @return Whop's in-house fraud risk score for this payment, from 0 (lowest risk) to 100 (highest risk). Null when the payment has not been scored or scoring has not yet completed. + */ + @JsonIgnore + @java.lang.Override + public Optional getRiskScore() { + if (riskScore == null) { + return Optional.empty(); + } + return riskScore; + } + + /** + * @return A curated set of factors behind the risk score, grouped by category (business transaction history, buyer, device). Each entry has a key, human-readable label, category, and value. Null when there is no risk assessment for this payment. + */ + @JsonIgnore + @java.lang.Override + public Optional> getRiskSignals() { + if (riskSignals == null) { + return Optional.empty(); + } + return riskSignals; + } + + /** + * @return The total amount charged to the customer for this payment, including taxes and after any discounts. In the currency specified by the currency field. + */ + @JsonProperty("settlement_amount") + @java.lang.Override + public double getSettlementAmount() { + return settlementAmount; + } + + /** + * @return The three-letter ISO currency code for this payment (e.g., 'usd', 'eur'). + */ + @JsonProperty("settlement_currency") + @java.lang.Override + public Currencies getSettlementCurrency() { + return settlementCurrency; + } + + /** + * @return Deprecated. Always returns null. + */ + @JsonIgnore + @java.lang.Override + public Optional getSettlementExchangeRate() { + if (settlementExchangeRate == null) { + return Optional.empty(); + } + return settlementExchangeRate; + } + + /** + * @return When this payment's funds post to the company's available balance, at midnight UTC. Known at payment time and never changes. The ledger_account.funds_available webhook carries the same settlement_time_at when that batch posts — match them to know these funds are now withdrawable. + */ + @JsonIgnore + @java.lang.Override + public Optional getSettlementTimeAt() { + if (settlementTimeAt == null) { + return Optional.empty(); + } + return settlementTimeAt; + } + + /** + * @return The shipment attached to this payment. + */ + @JsonIgnore + public Optional getShipment() { + if (shipment == null) { + return Optional.empty(); + } + return shipment; + } + + /** + * @return The shipping address provided by the customer for physical goods. Null if no shipping address was collected. + */ + @JsonIgnore + public Optional getShippingAddress() { + if (shippingAddress == null) { + return Optional.empty(); + } + return shippingAddress; + } + + /** + * @return The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void'). + */ + @JsonIgnore + @java.lang.Override + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The friendly status of the payment. + */ + @JsonProperty("substatus") + @java.lang.Override + public FriendlyReceiptStatus getSubstatus() { + return substatus; + } + + /** + * @return The subtotal to show to the creator (excluding buyer fees). + */ + @JsonIgnore + @java.lang.Override + public Optional getSubtotal() { + if (subtotal == null) { + return Optional.empty(); + } + return subtotal; + } + + /** + * @return The calculated amount of the sales/VAT tax (if applicable). + */ + @JsonIgnore + @java.lang.Override + public Optional getTaxAmount() { + if (taxAmount == null) { + return Optional.empty(); + } + return taxAmount; + } + + /** + * @return The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top. + */ + @JsonIgnore + @java.lang.Override + public Optional getTaxBehavior() { + if (taxBehavior == null) { + return Optional.empty(); + } + return taxBehavior; + } + + /** + * @return The amount of tax that has been refunded (if applicable). + */ + @JsonIgnore + @java.lang.Override + public Optional getTaxRefundedAmount() { + if (taxRefundedAmount == null) { + return Optional.empty(); + } + return taxRefundedAmount; + } + + /** + * @return Whether 3D Secure authentication was completed for this payment. + */ + @JsonProperty("three_ds_verified") + @java.lang.Override + public boolean getThreeDsVerified() { + return threeDsVerified; + } + + /** + * @return The total to show to the creator (excluding buyer fees). + */ + @JsonIgnore + @java.lang.Override + public Optional getTotal() { + if (total == null) { + return Optional.empty(); + } + return total; + } + + /** + * @return The datetime the payment was last updated. + */ + @JsonProperty("updated_at") + @java.lang.Override + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The total in USD to show to the creator (excluding buyer fees). + */ + @JsonIgnore + @java.lang.Override + public Optional getUsdTotal() { + if (usdTotal == null) { + return Optional.empty(); + } + return usdTotal; + } + + /** + * @return The user that made this payment. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + /** + * @return The issuer's address and card security code check results for this payment. Null when the processor returned none. + */ + @JsonIgnore + public Optional getVerificationChecks() { + if (verificationChecks == null) { + return Optional.empty(); + } + return verificationChecks; + } + + /** + * @return True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false. + */ + @JsonProperty("voidable") + @java.lang.Override + public boolean getVoidable() { + return voidable; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("application_fee") + private Optional _getApplicationFee() { + return applicationFee; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_address") + private Optional _getBillingAddress() { + return billingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_reason") + private Optional _getBillingReason() { + return billingReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_brand") + private Optional _getCardBrand() { + return cardBrand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_exp_month") + private Optional _getCardExpMonth() { + return cardExpMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_exp_year") + private Optional _getCardExpYear() { + return cardExpYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_last4") + private Optional _getCardLast4() { + return cardLast4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_configuration_id") + private Optional _getCheckoutConfigurationId() { + return checkoutConfigurationId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company") + private Optional _getCompany() { + return company; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_phone") + private Optional _getCustomerPhone() { + return customerPhone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("decline_code") + private Optional _getDeclineCode() { + return declineCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("dispute_alerted_at") + private Optional _getDisputeAlertedAt() { + return disputeAlertedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("disputes") + private Optional> _getDisputes() { + return disputes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_message") + private Optional _getFailureMessage() { + return failureMessage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("financing_installments_count") + private Optional _getFinancingInstallmentsCount() { + return financingInstallmentsCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_payment_attempt") + private Optional _getLastPaymentAttempt() { + return lastPaymentAttempt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member") + private Optional _getMember() { + return member; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("membership") + private Optional _getMembership() { + return membership; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("needs_tracking") + private Optional _getNeedsTracking() { + return needsTracking; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("next_payment_attempt") + private Optional _getNextPaymentAttempt() { + return nextPaymentAttempt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("paid_at") + private Optional _getPaidAt() { + return paidAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_instrument") + private Optional _getPaymentInstrument() { + return paymentInstrument; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method") + private Optional _getPaymentMethod() { + return paymentMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_type") + private Optional _getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payments_failed") + private Optional _getPaymentsFailed() { + return paymentsFailed; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("promo_code") + private Optional _getPromoCode() { + return promoCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refunded_amount") + private Optional _getRefundedAmount() { + return refundedAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refunded_at") + private Optional _getRefundedAt() { + return refundedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resolutions") + private Optional> _getResolutions() { + return resolutions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("risk_score") + private Optional _getRiskScore() { + return riskScore; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("risk_signals") + private Optional> _getRiskSignals() { + return riskSignals; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("settlement_exchange_rate") + private Optional _getSettlementExchangeRate() { + return settlementExchangeRate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("settlement_time_at") + private Optional _getSettlementTimeAt() { + return settlementTimeAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("shipment") + private Optional _getShipment() { + return shipment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("shipping_address") + private Optional _getShippingAddress() { + return shippingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("subtotal") + private Optional _getSubtotal() { + return subtotal; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_amount") + private Optional _getTaxAmount() { + return taxAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_behavior") + private Optional _getTaxBehavior() { + return taxBehavior; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_refunded_amount") + private Optional _getTaxRefundedAmount() { + return taxRefundedAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("total") + private Optional _getTotal() { + return total; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("usd_total") + private Optional _getUsdTotal() { + return usdTotal; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("verification_checks") + private Optional _getVerificationChecks() { + return verificationChecks; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Payment && equalTo((Payment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Payment other) { + return amountAfterFees == other.amountAfterFees + && applicationFee.equals(other.applicationFee) + && autoRefunded == other.autoRefunded + && billingAddress.equals(other.billingAddress) + && billingReason.equals(other.billingReason) + && cardBrand.equals(other.cardBrand) + && cardExpMonth.equals(other.cardExpMonth) + && cardExpYear.equals(other.cardExpYear) + && cardLast4.equals(other.cardLast4) + && checkoutConfigurationId.equals(other.checkoutConfigurationId) + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && customerPhone.equals(other.customerPhone) + && declineCode.equals(other.declineCode) + && disputeAlertedAt.equals(other.disputeAlertedAt) + && disputes.equals(other.disputes) + && failureMessage.equals(other.failureMessage) + && financingInstallmentsCount.equals(other.financingInstallmentsCount) + && financingTransactions.equals(other.financingTransactions) + && id.equals(other.id) + && lastPaymentAttempt.equals(other.lastPaymentAttempt) + && member.equals(other.member) + && membership.equals(other.membership) + && metadata.equals(other.metadata) + && needsTracking.equals(other.needsTracking) + && nextPaymentAttempt.equals(other.nextPaymentAttempt) + && paidAt.equals(other.paidAt) + && paymentInstrument.equals(other.paymentInstrument) + && paymentMethod.equals(other.paymentMethod) + && paymentMethodType.equals(other.paymentMethodType) + && paymentsFailed.equals(other.paymentsFailed) + && plan.equals(other.plan) + && product.equals(other.product) + && promoCode.equals(other.promoCode) + && refundable == other.refundable + && refundedAmount.equals(other.refundedAmount) + && refundedAt.equals(other.refundedAt) + && refunds.equals(other.refunds) + && resolutions.equals(other.resolutions) + && retryable == other.retryable + && riskScore.equals(other.riskScore) + && riskSignals.equals(other.riskSignals) + && settlementAmount == other.settlementAmount + && settlementCurrency.equals(other.settlementCurrency) + && settlementExchangeRate.equals(other.settlementExchangeRate) + && settlementTimeAt.equals(other.settlementTimeAt) + && shipment.equals(other.shipment) + && shippingAddress.equals(other.shippingAddress) + && status.equals(other.status) + && substatus.equals(other.substatus) + && subtotal.equals(other.subtotal) + && taxAmount.equals(other.taxAmount) + && taxBehavior.equals(other.taxBehavior) + && taxRefundedAmount.equals(other.taxRefundedAmount) + && threeDsVerified == other.threeDsVerified + && total.equals(other.total) + && updatedAt.equals(other.updatedAt) + && usdTotal.equals(other.usdTotal) + && user.equals(other.user) + && verificationChecks.equals(other.verificationChecks) + && voidable == other.voidable; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amountAfterFees, + this.applicationFee, + this.autoRefunded, + this.billingAddress, + this.billingReason, + this.cardBrand, + this.cardExpMonth, + this.cardExpYear, + this.cardLast4, + this.checkoutConfigurationId, + this.company, + this.createdAt, + this.currency, + this.customerPhone, + this.declineCode, + this.disputeAlertedAt, + this.disputes, + this.failureMessage, + this.financingInstallmentsCount, + this.financingTransactions, + this.id, + this.lastPaymentAttempt, + this.member, + this.membership, + this.metadata, + this.needsTracking, + this.nextPaymentAttempt, + this.paidAt, + this.paymentInstrument, + this.paymentMethod, + this.paymentMethodType, + this.paymentsFailed, + this.plan, + this.product, + this.promoCode, + this.refundable, + this.refundedAmount, + this.refundedAt, + this.refunds, + this.resolutions, + this.retryable, + this.riskScore, + this.riskSignals, + this.settlementAmount, + this.settlementCurrency, + this.settlementExchangeRate, + this.settlementTimeAt, + this.shipment, + this.shippingAddress, + this.status, + this.substatus, + this.subtotal, + this.taxAmount, + this.taxBehavior, + this.taxRefundedAmount, + this.threeDsVerified, + this.total, + this.updatedAt, + this.usdTotal, + this.user, + this.verificationChecks, + this.voidable); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountAfterFeesStage builder() { + return new Builder(); + } + + public interface AmountAfterFeesStage { + /** + *

How much the payment is for after fees

+ */ + AutoRefundedStage amountAfterFees(double amountAfterFees); + + Builder from(Payment other); + } + + public interface AutoRefundedStage { + /** + *

Whether this payment was auto refunded or not

+ */ + CreatedAtStage autoRefunded(boolean autoRefunded); + } + + public interface CreatedAtStage { + /** + *

The datetime the payment was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ */ + IdStage currency(@NotNull Currencies currency); + } + + public interface IdStage { + /** + *

The unique identifier for the payment.

+ */ + RefundableStage id(@NotNull String id); + } + + public interface RefundableStage { + /** + *

True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds.

+ */ + RetryableStage refundable(boolean refundable); + } + + public interface RetryableStage { + /** + *

True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again.

+ */ + SettlementAmountStage retryable(boolean retryable); + } + + public interface SettlementAmountStage { + /** + *

The total amount charged to the customer for this payment, including taxes and after any discounts. In the currency specified by the currency field.

+ */ + SettlementCurrencyStage settlementAmount(double settlementAmount); + } + + public interface SettlementCurrencyStage { + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ */ + SubstatusStage settlementCurrency(@NotNull Currencies settlementCurrency); + } + + public interface SubstatusStage { + /** + *

The friendly status of the payment.

+ */ + ThreeDsVerifiedStage substatus(@NotNull FriendlyReceiptStatus substatus); + } + + public interface ThreeDsVerifiedStage { + /** + *

Whether 3D Secure authentication was completed for this payment.

+ */ + UpdatedAtStage threeDsVerified(boolean threeDsVerified); + } + + public interface UpdatedAtStage { + /** + *

The datetime the payment was last updated.

+ */ + VoidableStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface VoidableStage { + /** + *

True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false.

+ */ + _FinalStage voidable(boolean voidable); + } + + public interface _FinalStage { + Payment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The application fee charged on this payment.

+ */ + _FinalStage applicationFee(Optional applicationFee); + + _FinalStage applicationFee(PaymentApplicationFee applicationFee); + + _FinalStage applicationFee(Nullable applicationFee); + + /** + *

The address of the user who made the payment.

+ */ + _FinalStage billingAddress(Optional billingAddress); + + _FinalStage billingAddress(PaymentBillingAddress billingAddress); + + _FinalStage billingAddress(Nullable billingAddress); + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ */ + _FinalStage billingReason(Optional billingReason); + + _FinalStage billingReason(BillingReasons billingReason); + + _FinalStage billingReason(Nullable billingReason); + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ */ + _FinalStage cardBrand(Optional cardBrand); + + _FinalStage cardBrand(CardBrands cardBrand); + + _FinalStage cardBrand(Nullable cardBrand); + + /** + *

The expiration month (1-12) of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ */ + _FinalStage cardExpMonth(Optional cardExpMonth); + + _FinalStage cardExpMonth(Integer cardExpMonth); + + _FinalStage cardExpMonth(Nullable cardExpMonth); + + /** + *

The four-digit expiration year of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ */ + _FinalStage cardExpYear(Optional cardExpYear); + + _FinalStage cardExpYear(Integer cardExpYear); + + _FinalStage cardExpYear(Nullable cardExpYear); + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ */ + _FinalStage cardLast4(Optional cardLast4); + + _FinalStage cardLast4(String cardLast4); + + _FinalStage cardLast4(Nullable cardLast4); + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ */ + _FinalStage checkoutConfigurationId(Optional checkoutConfigurationId); + + _FinalStage checkoutConfigurationId(String checkoutConfigurationId); + + _FinalStage checkoutConfigurationId(Nullable checkoutConfigurationId); + + /** + *

The company for the payment.

+ */ + _FinalStage company(Optional company); + + _FinalStage company(PaymentCompany company); + + _FinalStage company(Nullable company); + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ */ + _FinalStage customerPhone(Optional customerPhone); + + _FinalStage customerPhone(String customerPhone); + + _FinalStage customerPhone(Nullable customerPhone); + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ */ + _FinalStage declineCode(Optional declineCode); + + _FinalStage declineCode(PaymentDeclineCodes declineCode); + + _FinalStage declineCode(Nullable declineCode); + + /** + *

When an alert came in that this transaction will be disputed

+ */ + _FinalStage disputeAlertedAt(Optional disputeAlertedAt); + + _FinalStage disputeAlertedAt(OffsetDateTime disputeAlertedAt); + + _FinalStage disputeAlertedAt(Nullable disputeAlertedAt); + + /** + *

The disputes attached to this payment. Null if the actor in context does not have the payment:dispute:read permission.

+ */ + _FinalStage disputes(Optional> disputes); + + _FinalStage disputes(List disputes); + + _FinalStage disputes(Nullable> disputes); + + /** + *

If the payment failed, the reason for the failure.

+ */ + _FinalStage failureMessage(Optional failureMessage); + + _FinalStage failureMessage(String failureMessage); + + _FinalStage failureMessage(Nullable failureMessage); + + /** + *

The number of financing installments for the payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ */ + _FinalStage financingInstallmentsCount(Optional financingInstallmentsCount); + + _FinalStage financingInstallmentsCount(Integer financingInstallmentsCount); + + _FinalStage financingInstallmentsCount(Nullable financingInstallmentsCount); + + /** + *

The financing transactions attached to this payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ */ + _FinalStage financingTransactions(List financingTransactions); + + _FinalStage addFinancingTransactions(PaymentFinancingTransactionsItem financingTransactions); + + _FinalStage addAllFinancingTransactions(List financingTransactions); + + /** + *

The time of the last payment attempt.

+ */ + _FinalStage lastPaymentAttempt(Optional lastPaymentAttempt); + + _FinalStage lastPaymentAttempt(OffsetDateTime lastPaymentAttempt); + + _FinalStage lastPaymentAttempt(Nullable lastPaymentAttempt); + + /** + *

The member attached to this payment.

+ */ + _FinalStage member(Optional member); + + _FinalStage member(PaymentMember member); + + _FinalStage member(Nullable member); + + /** + *

The membership attached to this payment.

+ */ + _FinalStage membership(Optional membership); + + _FinalStage membership(PaymentMembership membership); + + _FinalStage membership(Nullable membership); + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ */ + _FinalStage needsTracking(Optional needsTracking); + + _FinalStage needsTracking(Boolean needsTracking); + + _FinalStage needsTracking(Nullable needsTracking); + + /** + *

The time of the next schedule payment retry.

+ */ + _FinalStage nextPaymentAttempt(Optional nextPaymentAttempt); + + _FinalStage nextPaymentAttempt(OffsetDateTime nextPaymentAttempt); + + _FinalStage nextPaymentAttempt(Nullable nextPaymentAttempt); + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ */ + _FinalStage paidAt(Optional paidAt); + + _FinalStage paidAt(OffsetDateTime paidAt); + + _FinalStage paidAt(Nullable paidAt); + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ */ + _FinalStage paymentInstrument(Optional paymentInstrument); + + _FinalStage paymentInstrument(PaymentPaymentInstrument paymentInstrument); + + _FinalStage paymentInstrument(Nullable paymentInstrument); + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ */ + _FinalStage paymentMethod(Optional paymentMethod); + + _FinalStage paymentMethod(PaymentPaymentMethod paymentMethod); + + _FinalStage paymentMethod(Nullable paymentMethod); + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ */ + _FinalStage paymentMethodType(Optional paymentMethodType); + + _FinalStage paymentMethodType(PaymentMethodTypes paymentMethodType); + + _FinalStage paymentMethodType(Nullable paymentMethodType); + + /** + *

The number of failed payment attempts for the payment.

+ */ + _FinalStage paymentsFailed(Optional paymentsFailed); + + _FinalStage paymentsFailed(Integer paymentsFailed); + + _FinalStage paymentsFailed(Nullable paymentsFailed); + + /** + *

The plan attached to this payment.

+ */ + _FinalStage plan(Optional plan); + + _FinalStage plan(PaymentPlan plan); + + _FinalStage plan(Nullable plan); + + /** + *

The product this payment was made for

+ */ + _FinalStage product(Optional product); + + _FinalStage product(PaymentProduct product); + + _FinalStage product(Nullable product); + + /** + *

The promo code used for this payment.

+ */ + _FinalStage promoCode(Optional promoCode); + + _FinalStage promoCode(PaymentPromoCode promoCode); + + _FinalStage promoCode(Nullable promoCode); + + /** + *

The payment refund amount(if applicable).

+ */ + _FinalStage refundedAmount(Optional refundedAmount); + + _FinalStage refundedAmount(Double refundedAmount); + + _FinalStage refundedAmount(Nullable refundedAmount); + + /** + *

When the payment was refunded (if applicable).

+ */ + _FinalStage refundedAt(Optional refundedAt); + + _FinalStage refundedAt(OffsetDateTime refundedAt); + + _FinalStage refundedAt(Nullable refundedAt); + + /** + *

The refunds issued against this payment, newest first, including failed and canceled refund attempts. Limited to the 100 most recent.

+ */ + _FinalStage refunds(List refunds); + + _FinalStage addRefunds(PaymentRefundsItem refunds); + + _FinalStage addAllRefunds(List refunds); + + /** + *

The resolution center cases opened by the customer on this payment. Null if the actor in context does not have the payment:resolution_center_case:read permission.

+ */ + _FinalStage resolutions(Optional> resolutions); + + _FinalStage resolutions(List resolutions); + + _FinalStage resolutions(Nullable> resolutions); + + /** + *

Whop's in-house fraud risk score for this payment, from 0 (lowest risk) to 100 (highest risk). Null when the payment has not been scored or scoring has not yet completed.

+ */ + _FinalStage riskScore(Optional riskScore); + + _FinalStage riskScore(Integer riskScore); + + _FinalStage riskScore(Nullable riskScore); + + /** + *

A curated set of factors behind the risk score, grouped by category (business transaction history, buyer, device). Each entry has a key, human-readable label, category, and value. Null when there is no risk assessment for this payment.

+ */ + _FinalStage riskSignals(Optional> riskSignals); + + _FinalStage riskSignals(Map riskSignals); + + _FinalStage riskSignals(Nullable> riskSignals); + + /** + *

Deprecated. Always returns null.

+ */ + _FinalStage settlementExchangeRate(Optional settlementExchangeRate); + + _FinalStage settlementExchangeRate(Double settlementExchangeRate); + + _FinalStage settlementExchangeRate(Nullable settlementExchangeRate); + + /** + *

When this payment's funds post to the company's available balance, at midnight UTC. Known at payment time and never changes. The ledger_account.funds_available webhook carries the same settlement_time_at when that batch posts — match them to know these funds are now withdrawable.

+ */ + _FinalStage settlementTimeAt(Optional settlementTimeAt); + + _FinalStage settlementTimeAt(OffsetDateTime settlementTimeAt); + + _FinalStage settlementTimeAt(Nullable settlementTimeAt); + + /** + *

The shipment attached to this payment.

+ */ + _FinalStage shipment(Optional shipment); + + _FinalStage shipment(PaymentShipment shipment); + + _FinalStage shipment(Nullable shipment); + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ */ + _FinalStage shippingAddress(Optional shippingAddress); + + _FinalStage shippingAddress(PaymentShippingAddress shippingAddress); + + _FinalStage shippingAddress(Nullable shippingAddress); + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ */ + _FinalStage status(Optional status); + + _FinalStage status(ReceiptStatus status); + + _FinalStage status(Nullable status); + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ */ + _FinalStage subtotal(Optional subtotal); + + _FinalStage subtotal(Double subtotal); + + _FinalStage subtotal(Nullable subtotal); + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ */ + _FinalStage taxAmount(Optional taxAmount); + + _FinalStage taxAmount(Double taxAmount); + + _FinalStage taxAmount(Nullable taxAmount); + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ */ + _FinalStage taxBehavior(Optional taxBehavior); + + _FinalStage taxBehavior(ReceiptTaxBehaviors taxBehavior); + + _FinalStage taxBehavior(Nullable taxBehavior); + + /** + *

The amount of tax that has been refunded (if applicable).

+ */ + _FinalStage taxRefundedAmount(Optional taxRefundedAmount); + + _FinalStage taxRefundedAmount(Double taxRefundedAmount); + + _FinalStage taxRefundedAmount(Nullable taxRefundedAmount); + + /** + *

The total to show to the creator (excluding buyer fees).

+ */ + _FinalStage total(Optional total); + + _FinalStage total(Double total); + + _FinalStage total(Nullable total); + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ */ + _FinalStage usdTotal(Optional usdTotal); + + _FinalStage usdTotal(Double usdTotal); + + _FinalStage usdTotal(Nullable usdTotal); + + /** + *

The user that made this payment.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(PaymentUser user); + + _FinalStage user(Nullable user); + + /** + *

The issuer's address and card security code check results for this payment. Null when the processor returned none.

+ */ + _FinalStage verificationChecks(Optional verificationChecks); + + _FinalStage verificationChecks(PaymentVerificationChecks verificationChecks); + + _FinalStage verificationChecks(Nullable verificationChecks); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountAfterFeesStage, + AutoRefundedStage, + CreatedAtStage, + CurrencyStage, + IdStage, + RefundableStage, + RetryableStage, + SettlementAmountStage, + SettlementCurrencyStage, + SubstatusStage, + ThreeDsVerifiedStage, + UpdatedAtStage, + VoidableStage, + _FinalStage { + private double amountAfterFees; + + private boolean autoRefunded; + + private OffsetDateTime createdAt; + + private Currencies currency; + + private String id; + + private boolean refundable; + + private boolean retryable; + + private double settlementAmount; + + private Currencies settlementCurrency; + + private FriendlyReceiptStatus substatus; + + private boolean threeDsVerified; + + private OffsetDateTime updatedAt; + + private boolean voidable; + + private Optional verificationChecks = Optional.empty(); + + private Optional user = Optional.empty(); + + private Optional usdTotal = Optional.empty(); + + private Optional total = Optional.empty(); + + private Optional taxRefundedAmount = Optional.empty(); + + private Optional taxBehavior = Optional.empty(); + + private Optional taxAmount = Optional.empty(); + + private Optional subtotal = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional shippingAddress = Optional.empty(); + + private Optional shipment = Optional.empty(); + + private Optional settlementTimeAt = Optional.empty(); + + private Optional settlementExchangeRate = Optional.empty(); + + private Optional> riskSignals = Optional.empty(); + + private Optional riskScore = Optional.empty(); + + private Optional> resolutions = Optional.empty(); + + private List refunds = new ArrayList<>(); + + private Optional refundedAt = Optional.empty(); + + private Optional refundedAmount = Optional.empty(); + + private Optional promoCode = Optional.empty(); + + private Optional product = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional paymentsFailed = Optional.empty(); + + private Optional paymentMethodType = Optional.empty(); + + private Optional paymentMethod = Optional.empty(); + + private Optional paymentInstrument = Optional.empty(); + + private Optional paidAt = Optional.empty(); + + private Optional nextPaymentAttempt = Optional.empty(); + + private Optional needsTracking = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional membership = Optional.empty(); + + private Optional member = Optional.empty(); + + private Optional lastPaymentAttempt = Optional.empty(); + + private List financingTransactions = new ArrayList<>(); + + private Optional financingInstallmentsCount = Optional.empty(); + + private Optional failureMessage = Optional.empty(); + + private Optional> disputes = Optional.empty(); + + private Optional disputeAlertedAt = Optional.empty(); + + private Optional declineCode = Optional.empty(); + + private Optional customerPhone = Optional.empty(); + + private Optional company = Optional.empty(); + + private Optional checkoutConfigurationId = Optional.empty(); + + private Optional cardLast4 = Optional.empty(); + + private Optional cardExpYear = Optional.empty(); + + private Optional cardExpMonth = Optional.empty(); + + private Optional cardBrand = Optional.empty(); + + private Optional billingReason = Optional.empty(); + + private Optional billingAddress = Optional.empty(); + + private Optional applicationFee = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Payment other) { + amountAfterFees(other.getAmountAfterFees()); + applicationFee(other.getApplicationFee()); + autoRefunded(other.getAutoRefunded()); + billingAddress(other.getBillingAddress()); + billingReason(other.getBillingReason()); + cardBrand(other.getCardBrand()); + cardExpMonth(other.getCardExpMonth()); + cardExpYear(other.getCardExpYear()); + cardLast4(other.getCardLast4()); + checkoutConfigurationId(other.getCheckoutConfigurationId()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + customerPhone(other.getCustomerPhone()); + declineCode(other.getDeclineCode()); + disputeAlertedAt(other.getDisputeAlertedAt()); + disputes(other.getDisputes()); + failureMessage(other.getFailureMessage()); + financingInstallmentsCount(other.getFinancingInstallmentsCount()); + financingTransactions(other.getFinancingTransactions()); + id(other.getId()); + lastPaymentAttempt(other.getLastPaymentAttempt()); + member(other.getMember()); + membership(other.getMembership()); + metadata(other.getMetadata()); + needsTracking(other.getNeedsTracking()); + nextPaymentAttempt(other.getNextPaymentAttempt()); + paidAt(other.getPaidAt()); + paymentInstrument(other.getPaymentInstrument()); + paymentMethod(other.getPaymentMethod()); + paymentMethodType(other.getPaymentMethodType()); + paymentsFailed(other.getPaymentsFailed()); + plan(other.getPlan()); + product(other.getProduct()); + promoCode(other.getPromoCode()); + refundable(other.getRefundable()); + refundedAmount(other.getRefundedAmount()); + refundedAt(other.getRefundedAt()); + refunds(other.getRefunds()); + resolutions(other.getResolutions()); + retryable(other.getRetryable()); + riskScore(other.getRiskScore()); + riskSignals(other.getRiskSignals()); + settlementAmount(other.getSettlementAmount()); + settlementCurrency(other.getSettlementCurrency()); + settlementExchangeRate(other.getSettlementExchangeRate()); + settlementTimeAt(other.getSettlementTimeAt()); + shipment(other.getShipment()); + shippingAddress(other.getShippingAddress()); + status(other.getStatus()); + substatus(other.getSubstatus()); + subtotal(other.getSubtotal()); + taxAmount(other.getTaxAmount()); + taxBehavior(other.getTaxBehavior()); + taxRefundedAmount(other.getTaxRefundedAmount()); + threeDsVerified(other.getThreeDsVerified()); + total(other.getTotal()); + updatedAt(other.getUpdatedAt()); + usdTotal(other.getUsdTotal()); + user(other.getUser()); + verificationChecks(other.getVerificationChecks()); + voidable(other.getVoidable()); + return this; + } + + /** + *

How much the payment is for after fees

+ *

How much the payment is for after fees

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount_after_fees") + public AutoRefundedStage amountAfterFees(double amountAfterFees) { + this.amountAfterFees = amountAfterFees; + return this; + } + + /** + *

Whether this payment was auto refunded or not

+ *

Whether this payment was auto refunded or not

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("auto_refunded") + public CreatedAtStage autoRefunded(boolean autoRefunded) { + this.autoRefunded = autoRefunded; + return this; + } + + /** + *

The datetime the payment was created.

+ *

The datetime the payment was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier for the payment.

+ *

The unique identifier for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RefundableStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds.

+ *

True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("refundable") + public RetryableStage refundable(boolean refundable) { + this.refundable = refundable; + return this; + } + + /** + *

True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again.

+ *

True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("retryable") + public SettlementAmountStage retryable(boolean retryable) { + this.retryable = retryable; + return this; + } + + /** + *

The total amount charged to the customer for this payment, including taxes and after any discounts. In the currency specified by the currency field.

+ *

The total amount charged to the customer for this payment, including taxes and after any discounts. In the currency specified by the currency field.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("settlement_amount") + public SettlementCurrencyStage settlementAmount(double settlementAmount) { + this.settlementAmount = settlementAmount; + return this; + } + + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("settlement_currency") + public SubstatusStage settlementCurrency(@NotNull Currencies settlementCurrency) { + this.settlementCurrency = Objects.requireNonNull(settlementCurrency, "settlementCurrency must not be null"); + return this; + } + + /** + *

The friendly status of the payment.

+ *

The friendly status of the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("substatus") + public ThreeDsVerifiedStage substatus(@NotNull FriendlyReceiptStatus substatus) { + this.substatus = Objects.requireNonNull(substatus, "substatus must not be null"); + return this; + } + + /** + *

Whether 3D Secure authentication was completed for this payment.

+ *

Whether 3D Secure authentication was completed for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("three_ds_verified") + public UpdatedAtStage threeDsVerified(boolean threeDsVerified) { + this.threeDsVerified = threeDsVerified; + return this; + } + + /** + *

The datetime the payment was last updated.

+ *

The datetime the payment was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public VoidableStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false.

+ *

True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("voidable") + public _FinalStage voidable(boolean voidable) { + this.voidable = voidable; + return this; + } + + /** + *

The issuer's address and card security code check results for this payment. Null when the processor returned none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage verificationChecks(Nullable verificationChecks) { + if (verificationChecks.isNull()) { + this.verificationChecks = null; + } else if (verificationChecks.isEmpty()) { + this.verificationChecks = Optional.empty(); + } else { + this.verificationChecks = Optional.of(verificationChecks.get()); + } + return this; + } + + /** + *

The issuer's address and card security code check results for this payment. Null when the processor returned none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage verificationChecks(PaymentVerificationChecks verificationChecks) { + this.verificationChecks = Optional.ofNullable(verificationChecks); + return this; + } + + /** + *

The issuer's address and card security code check results for this payment. Null when the processor returned none.

+ */ + @java.lang.Override + @JsonSetter(value = "verification_checks", nulls = Nulls.SKIP) + public _FinalStage verificationChecks(Optional verificationChecks) { + this.verificationChecks = verificationChecks; + return this; + } + + /** + *

The user that made this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The user that made this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(PaymentUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The user that made this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdTotal(Nullable usdTotal) { + if (usdTotal.isNull()) { + this.usdTotal = null; + } else if (usdTotal.isEmpty()) { + this.usdTotal = Optional.empty(); + } else { + this.usdTotal = Optional.of(usdTotal.get()); + } + return this; + } + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdTotal(Double usdTotal) { + this.usdTotal = Optional.ofNullable(usdTotal); + return this; + } + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "usd_total", nulls = Nulls.SKIP) + public _FinalStage usdTotal(Optional usdTotal) { + this.usdTotal = usdTotal; + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage total(Nullable total) { + if (total.isNull()) { + this.total = null; + } else if (total.isEmpty()) { + this.total = Optional.empty(); + } else { + this.total = Optional.of(total.get()); + } + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage total(Double total) { + this.total = Optional.ofNullable(total); + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "total", nulls = Nulls.SKIP) + public _FinalStage total(Optional total) { + this.total = total; + return this; + } + + /** + *

The amount of tax that has been refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxRefundedAmount(Nullable taxRefundedAmount) { + if (taxRefundedAmount.isNull()) { + this.taxRefundedAmount = null; + } else if (taxRefundedAmount.isEmpty()) { + this.taxRefundedAmount = Optional.empty(); + } else { + this.taxRefundedAmount = Optional.of(taxRefundedAmount.get()); + } + return this; + } + + /** + *

The amount of tax that has been refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxRefundedAmount(Double taxRefundedAmount) { + this.taxRefundedAmount = Optional.ofNullable(taxRefundedAmount); + return this; + } + + /** + *

The amount of tax that has been refunded (if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "tax_refunded_amount", nulls = Nulls.SKIP) + public _FinalStage taxRefundedAmount(Optional taxRefundedAmount) { + this.taxRefundedAmount = taxRefundedAmount; + return this; + } + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxBehavior(Nullable taxBehavior) { + if (taxBehavior.isNull()) { + this.taxBehavior = null; + } else if (taxBehavior.isEmpty()) { + this.taxBehavior = Optional.empty(); + } else { + this.taxBehavior = Optional.of(taxBehavior.get()); + } + return this; + } + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxBehavior(ReceiptTaxBehaviors taxBehavior) { + this.taxBehavior = Optional.ofNullable(taxBehavior); + return this; + } + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ */ + @java.lang.Override + @JsonSetter(value = "tax_behavior", nulls = Nulls.SKIP) + public _FinalStage taxBehavior(Optional taxBehavior) { + this.taxBehavior = taxBehavior; + return this; + } + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxAmount(Nullable taxAmount) { + if (taxAmount.isNull()) { + this.taxAmount = null; + } else if (taxAmount.isEmpty()) { + this.taxAmount = Optional.empty(); + } else { + this.taxAmount = Optional.of(taxAmount.get()); + } + return this; + } + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxAmount(Double taxAmount) { + this.taxAmount = Optional.ofNullable(taxAmount); + return this; + } + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "tax_amount", nulls = Nulls.SKIP) + public _FinalStage taxAmount(Optional taxAmount) { + this.taxAmount = taxAmount; + return this; + } + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subtotal(Nullable subtotal) { + if (subtotal.isNull()) { + this.subtotal = null; + } else if (subtotal.isEmpty()) { + this.subtotal = Optional.empty(); + } else { + this.subtotal = Optional.of(subtotal.get()); + } + return this; + } + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subtotal(Double subtotal) { + this.subtotal = Optional.ofNullable(subtotal); + return this; + } + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "subtotal", nulls = Nulls.SKIP) + public _FinalStage subtotal(Optional subtotal) { + this.subtotal = subtotal; + return this; + } + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(ReceiptStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shippingAddress(Nullable shippingAddress) { + if (shippingAddress.isNull()) { + this.shippingAddress = null; + } else if (shippingAddress.isEmpty()) { + this.shippingAddress = Optional.empty(); + } else { + this.shippingAddress = Optional.of(shippingAddress.get()); + } + return this; + } + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shippingAddress(PaymentShippingAddress shippingAddress) { + this.shippingAddress = Optional.ofNullable(shippingAddress); + return this; + } + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ */ + @java.lang.Override + @JsonSetter(value = "shipping_address", nulls = Nulls.SKIP) + public _FinalStage shippingAddress(Optional shippingAddress) { + this.shippingAddress = shippingAddress; + return this; + } + + /** + *

The shipment attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shipment(Nullable shipment) { + if (shipment.isNull()) { + this.shipment = null; + } else if (shipment.isEmpty()) { + this.shipment = Optional.empty(); + } else { + this.shipment = Optional.of(shipment.get()); + } + return this; + } + + /** + *

The shipment attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shipment(PaymentShipment shipment) { + this.shipment = Optional.ofNullable(shipment); + return this; + } + + /** + *

The shipment attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "shipment", nulls = Nulls.SKIP) + public _FinalStage shipment(Optional shipment) { + this.shipment = shipment; + return this; + } + + /** + *

When this payment's funds post to the company's available balance, at midnight UTC. Known at payment time and never changes. The ledger_account.funds_available webhook carries the same settlement_time_at when that batch posts — match them to know these funds are now withdrawable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage settlementTimeAt(Nullable settlementTimeAt) { + if (settlementTimeAt.isNull()) { + this.settlementTimeAt = null; + } else if (settlementTimeAt.isEmpty()) { + this.settlementTimeAt = Optional.empty(); + } else { + this.settlementTimeAt = Optional.of(settlementTimeAt.get()); + } + return this; + } + + /** + *

When this payment's funds post to the company's available balance, at midnight UTC. Known at payment time and never changes. The ledger_account.funds_available webhook carries the same settlement_time_at when that batch posts — match them to know these funds are now withdrawable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage settlementTimeAt(OffsetDateTime settlementTimeAt) { + this.settlementTimeAt = Optional.ofNullable(settlementTimeAt); + return this; + } + + /** + *

When this payment's funds post to the company's available balance, at midnight UTC. Known at payment time and never changes. The ledger_account.funds_available webhook carries the same settlement_time_at when that batch posts — match them to know these funds are now withdrawable.

+ */ + @java.lang.Override + @JsonSetter(value = "settlement_time_at", nulls = Nulls.SKIP) + public _FinalStage settlementTimeAt(Optional settlementTimeAt) { + this.settlementTimeAt = settlementTimeAt; + return this; + } + + /** + *

Deprecated. Always returns null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage settlementExchangeRate(Nullable settlementExchangeRate) { + if (settlementExchangeRate.isNull()) { + this.settlementExchangeRate = null; + } else if (settlementExchangeRate.isEmpty()) { + this.settlementExchangeRate = Optional.empty(); + } else { + this.settlementExchangeRate = Optional.of(settlementExchangeRate.get()); + } + return this; + } + + /** + *

Deprecated. Always returns null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage settlementExchangeRate(Double settlementExchangeRate) { + this.settlementExchangeRate = Optional.ofNullable(settlementExchangeRate); + return this; + } + + /** + *

Deprecated. Always returns null.

+ */ + @java.lang.Override + @JsonSetter(value = "settlement_exchange_rate", nulls = Nulls.SKIP) + public _FinalStage settlementExchangeRate(Optional settlementExchangeRate) { + this.settlementExchangeRate = settlementExchangeRate; + return this; + } + + /** + *

A curated set of factors behind the risk score, grouped by category (business transaction history, buyer, device). Each entry has a key, human-readable label, category, and value. Null when there is no risk assessment for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage riskSignals(Nullable> riskSignals) { + if (riskSignals.isNull()) { + this.riskSignals = null; + } else if (riskSignals.isEmpty()) { + this.riskSignals = Optional.empty(); + } else { + this.riskSignals = Optional.of(riskSignals.get()); + } + return this; + } + + /** + *

A curated set of factors behind the risk score, grouped by category (business transaction history, buyer, device). Each entry has a key, human-readable label, category, and value. Null when there is no risk assessment for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage riskSignals(Map riskSignals) { + this.riskSignals = Optional.ofNullable(riskSignals); + return this; + } + + /** + *

A curated set of factors behind the risk score, grouped by category (business transaction history, buyer, device). Each entry has a key, human-readable label, category, and value. Null when there is no risk assessment for this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "risk_signals", nulls = Nulls.SKIP) + public _FinalStage riskSignals(Optional> riskSignals) { + this.riskSignals = riskSignals; + return this; + } + + /** + *

Whop's in-house fraud risk score for this payment, from 0 (lowest risk) to 100 (highest risk). Null when the payment has not been scored or scoring has not yet completed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage riskScore(Nullable riskScore) { + if (riskScore.isNull()) { + this.riskScore = null; + } else if (riskScore.isEmpty()) { + this.riskScore = Optional.empty(); + } else { + this.riskScore = Optional.of(riskScore.get()); + } + return this; + } + + /** + *

Whop's in-house fraud risk score for this payment, from 0 (lowest risk) to 100 (highest risk). Null when the payment has not been scored or scoring has not yet completed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage riskScore(Integer riskScore) { + this.riskScore = Optional.ofNullable(riskScore); + return this; + } + + /** + *

Whop's in-house fraud risk score for this payment, from 0 (lowest risk) to 100 (highest risk). Null when the payment has not been scored or scoring has not yet completed.

+ */ + @java.lang.Override + @JsonSetter(value = "risk_score", nulls = Nulls.SKIP) + public _FinalStage riskScore(Optional riskScore) { + this.riskScore = riskScore; + return this; + } + + /** + *

The resolution center cases opened by the customer on this payment. Null if the actor in context does not have the payment:resolution_center_case:read permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolutions(Nullable> resolutions) { + if (resolutions.isNull()) { + this.resolutions = null; + } else if (resolutions.isEmpty()) { + this.resolutions = Optional.empty(); + } else { + this.resolutions = Optional.of(resolutions.get()); + } + return this; + } + + /** + *

The resolution center cases opened by the customer on this payment. Null if the actor in context does not have the payment:resolution_center_case:read permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolutions(List resolutions) { + this.resolutions = Optional.ofNullable(resolutions); + return this; + } + + /** + *

The resolution center cases opened by the customer on this payment. Null if the actor in context does not have the payment:resolution_center_case:read permission.

+ */ + @java.lang.Override + @JsonSetter(value = "resolutions", nulls = Nulls.SKIP) + public _FinalStage resolutions(Optional> resolutions) { + this.resolutions = resolutions; + return this; + } + + /** + *

The refunds issued against this payment, newest first, including failed and canceled refund attempts. Limited to the 100 most recent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllRefunds(List refunds) { + if (refunds != null) { + this.refunds.addAll(refunds); + } + return this; + } + + /** + *

The refunds issued against this payment, newest first, including failed and canceled refund attempts. Limited to the 100 most recent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addRefunds(PaymentRefundsItem refunds) { + this.refunds.add(refunds); + return this; + } + + /** + *

The refunds issued against this payment, newest first, including failed and canceled refund attempts. Limited to the 100 most recent.

+ */ + @java.lang.Override + @JsonSetter(value = "refunds", nulls = Nulls.SKIP) + public _FinalStage refunds(List refunds) { + this.refunds.clear(); + if (refunds != null) { + this.refunds.addAll(refunds); + } + return this; + } + + /** + *

When the payment was refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAt(Nullable refundedAt) { + if (refundedAt.isNull()) { + this.refundedAt = null; + } else if (refundedAt.isEmpty()) { + this.refundedAt = Optional.empty(); + } else { + this.refundedAt = Optional.of(refundedAt.get()); + } + return this; + } + + /** + *

When the payment was refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAt(OffsetDateTime refundedAt) { + this.refundedAt = Optional.ofNullable(refundedAt); + return this; + } + + /** + *

When the payment was refunded (if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "refunded_at", nulls = Nulls.SKIP) + public _FinalStage refundedAt(Optional refundedAt) { + this.refundedAt = refundedAt; + return this; + } + + /** + *

The payment refund amount(if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAmount(Nullable refundedAmount) { + if (refundedAmount.isNull()) { + this.refundedAmount = null; + } else if (refundedAmount.isEmpty()) { + this.refundedAmount = Optional.empty(); + } else { + this.refundedAmount = Optional.of(refundedAmount.get()); + } + return this; + } + + /** + *

The payment refund amount(if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAmount(Double refundedAmount) { + this.refundedAmount = Optional.ofNullable(refundedAmount); + return this; + } + + /** + *

The payment refund amount(if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "refunded_amount", nulls = Nulls.SKIP) + public _FinalStage refundedAmount(Optional refundedAmount) { + this.refundedAmount = refundedAmount; + return this; + } + + /** + *

The promo code used for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCode(Nullable promoCode) { + if (promoCode.isNull()) { + this.promoCode = null; + } else if (promoCode.isEmpty()) { + this.promoCode = Optional.empty(); + } else { + this.promoCode = Optional.of(promoCode.get()); + } + return this; + } + + /** + *

The promo code used for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCode(PaymentPromoCode promoCode) { + this.promoCode = Optional.ofNullable(promoCode); + return this; + } + + /** + *

The promo code used for this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "promo_code", nulls = Nulls.SKIP) + public _FinalStage promoCode(Optional promoCode) { + this.promoCode = promoCode; + return this; + } + + /** + *

The product this payment was made for

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

The product this payment was made for

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(PaymentProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

The product this payment was made for

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

The plan attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + /** + *

The plan attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(PaymentPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + /** + *

The plan attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + + /** + *

The number of failed payment attempts for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentsFailed(Nullable paymentsFailed) { + if (paymentsFailed.isNull()) { + this.paymentsFailed = null; + } else if (paymentsFailed.isEmpty()) { + this.paymentsFailed = Optional.empty(); + } else { + this.paymentsFailed = Optional.of(paymentsFailed.get()); + } + return this; + } + + /** + *

The number of failed payment attempts for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentsFailed(Integer paymentsFailed) { + this.paymentsFailed = Optional.ofNullable(paymentsFailed); + return this; + } + + /** + *

The number of failed payment attempts for the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "payments_failed", nulls = Nulls.SKIP) + public _FinalStage paymentsFailed(Optional paymentsFailed) { + this.paymentsFailed = paymentsFailed; + return this; + } + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(Nullable paymentMethodType) { + if (paymentMethodType.isNull()) { + this.paymentMethodType = null; + } else if (paymentMethodType.isEmpty()) { + this.paymentMethodType = Optional.empty(); + } else { + this.paymentMethodType = Optional.of(paymentMethodType.get()); + } + return this; + } + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Optional.ofNullable(paymentMethodType); + return this; + } + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_type", nulls = Nulls.SKIP) + public _FinalStage paymentMethodType(Optional paymentMethodType) { + this.paymentMethodType = paymentMethodType; + return this; + } + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethod(Nullable paymentMethod) { + if (paymentMethod.isNull()) { + this.paymentMethod = null; + } else if (paymentMethod.isEmpty()) { + this.paymentMethod = Optional.empty(); + } else { + this.paymentMethod = Optional.of(paymentMethod.get()); + } + return this; + } + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethod(PaymentPaymentMethod paymentMethod) { + this.paymentMethod = Optional.ofNullable(paymentMethod); + return this; + } + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method", nulls = Nulls.SKIP) + public _FinalStage paymentMethod(Optional paymentMethod) { + this.paymentMethod = paymentMethod; + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentInstrument(Nullable paymentInstrument) { + if (paymentInstrument.isNull()) { + this.paymentInstrument = null; + } else if (paymentInstrument.isEmpty()) { + this.paymentInstrument = Optional.empty(); + } else { + this.paymentInstrument = Optional.of(paymentInstrument.get()); + } + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentInstrument(PaymentPaymentInstrument paymentInstrument) { + this.paymentInstrument = Optional.ofNullable(paymentInstrument); + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_instrument", nulls = Nulls.SKIP) + public _FinalStage paymentInstrument(Optional paymentInstrument) { + this.paymentInstrument = paymentInstrument; + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidAt(Nullable paidAt) { + if (paidAt.isNull()) { + this.paidAt = null; + } else if (paidAt.isEmpty()) { + this.paidAt = Optional.empty(); + } else { + this.paidAt = Optional.of(paidAt.get()); + } + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidAt(OffsetDateTime paidAt) { + this.paidAt = Optional.ofNullable(paidAt); + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "paid_at", nulls = Nulls.SKIP) + public _FinalStage paidAt(Optional paidAt) { + this.paidAt = paidAt; + return this; + } + + /** + *

The time of the next schedule payment retry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nextPaymentAttempt(Nullable nextPaymentAttempt) { + if (nextPaymentAttempt.isNull()) { + this.nextPaymentAttempt = null; + } else if (nextPaymentAttempt.isEmpty()) { + this.nextPaymentAttempt = Optional.empty(); + } else { + this.nextPaymentAttempt = Optional.of(nextPaymentAttempt.get()); + } + return this; + } + + /** + *

The time of the next schedule payment retry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nextPaymentAttempt(OffsetDateTime nextPaymentAttempt) { + this.nextPaymentAttempt = Optional.ofNullable(nextPaymentAttempt); + return this; + } + + /** + *

The time of the next schedule payment retry.

+ */ + @java.lang.Override + @JsonSetter(value = "next_payment_attempt", nulls = Nulls.SKIP) + public _FinalStage nextPaymentAttempt(Optional nextPaymentAttempt) { + this.nextPaymentAttempt = nextPaymentAttempt; + return this; + } + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage needsTracking(Nullable needsTracking) { + if (needsTracking.isNull()) { + this.needsTracking = null; + } else if (needsTracking.isEmpty()) { + this.needsTracking = Optional.empty(); + } else { + this.needsTracking = Optional.of(needsTracking.get()); + } + return this; + } + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage needsTracking(Boolean needsTracking) { + this.needsTracking = Optional.ofNullable(needsTracking); + return this; + } + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ */ + @java.lang.Override + @JsonSetter(value = "needs_tracking", nulls = Nulls.SKIP) + public _FinalStage needsTracking(Optional needsTracking) { + this.needsTracking = needsTracking; + return this; + } + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The membership attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage membership(Nullable membership) { + if (membership.isNull()) { + this.membership = null; + } else if (membership.isEmpty()) { + this.membership = Optional.empty(); + } else { + this.membership = Optional.of(membership.get()); + } + return this; + } + + /** + *

The membership attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage membership(PaymentMembership membership) { + this.membership = Optional.ofNullable(membership); + return this; + } + + /** + *

The membership attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "membership", nulls = Nulls.SKIP) + public _FinalStage membership(Optional membership) { + this.membership = membership; + return this; + } + + /** + *

The member attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(Nullable member) { + if (member.isNull()) { + this.member = null; + } else if (member.isEmpty()) { + this.member = Optional.empty(); + } else { + this.member = Optional.of(member.get()); + } + return this; + } + + /** + *

The member attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(PaymentMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + /** + *

The member attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public _FinalStage member(Optional member) { + this.member = member; + return this; + } + + /** + *

The time of the last payment attempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaymentAttempt(Nullable lastPaymentAttempt) { + if (lastPaymentAttempt.isNull()) { + this.lastPaymentAttempt = null; + } else if (lastPaymentAttempt.isEmpty()) { + this.lastPaymentAttempt = Optional.empty(); + } else { + this.lastPaymentAttempt = Optional.of(lastPaymentAttempt.get()); + } + return this; + } + + /** + *

The time of the last payment attempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaymentAttempt(OffsetDateTime lastPaymentAttempt) { + this.lastPaymentAttempt = Optional.ofNullable(lastPaymentAttempt); + return this; + } + + /** + *

The time of the last payment attempt.

+ */ + @java.lang.Override + @JsonSetter(value = "last_payment_attempt", nulls = Nulls.SKIP) + public _FinalStage lastPaymentAttempt(Optional lastPaymentAttempt) { + this.lastPaymentAttempt = lastPaymentAttempt; + return this; + } + + /** + *

The financing transactions attached to this payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllFinancingTransactions(List financingTransactions) { + if (financingTransactions != null) { + this.financingTransactions.addAll(financingTransactions); + } + return this; + } + + /** + *

The financing transactions attached to this payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addFinancingTransactions(PaymentFinancingTransactionsItem financingTransactions) { + this.financingTransactions.add(financingTransactions); + return this; + } + + /** + *

The financing transactions attached to this payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ */ + @java.lang.Override + @JsonSetter(value = "financing_transactions", nulls = Nulls.SKIP) + public _FinalStage financingTransactions(List financingTransactions) { + this.financingTransactions.clear(); + if (financingTransactions != null) { + this.financingTransactions.addAll(financingTransactions); + } + return this; + } + + /** + *

The number of financing installments for the payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage financingInstallmentsCount(Nullable financingInstallmentsCount) { + if (financingInstallmentsCount.isNull()) { + this.financingInstallmentsCount = null; + } else if (financingInstallmentsCount.isEmpty()) { + this.financingInstallmentsCount = Optional.empty(); + } else { + this.financingInstallmentsCount = Optional.of(financingInstallmentsCount.get()); + } + return this; + } + + /** + *

The number of financing installments for the payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage financingInstallmentsCount(Integer financingInstallmentsCount) { + this.financingInstallmentsCount = Optional.ofNullable(financingInstallmentsCount); + return this; + } + + /** + *

The number of financing installments for the payment. Present if the payment is a financing payment (e.g. Splitit, Klarna, etc.).

+ */ + @java.lang.Override + @JsonSetter(value = "financing_installments_count", nulls = Nulls.SKIP) + public _FinalStage financingInstallmentsCount(Optional financingInstallmentsCount) { + this.financingInstallmentsCount = financingInstallmentsCount; + return this; + } + + /** + *

If the payment failed, the reason for the failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureMessage(Nullable failureMessage) { + if (failureMessage.isNull()) { + this.failureMessage = null; + } else if (failureMessage.isEmpty()) { + this.failureMessage = Optional.empty(); + } else { + this.failureMessage = Optional.of(failureMessage.get()); + } + return this; + } + + /** + *

If the payment failed, the reason for the failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureMessage(String failureMessage) { + this.failureMessage = Optional.ofNullable(failureMessage); + return this; + } + + /** + *

If the payment failed, the reason for the failure.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_message", nulls = Nulls.SKIP) + public _FinalStage failureMessage(Optional failureMessage) { + this.failureMessage = failureMessage; + return this; + } + + /** + *

The disputes attached to this payment. Null if the actor in context does not have the payment:dispute:read permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputes(Nullable> disputes) { + if (disputes.isNull()) { + this.disputes = null; + } else if (disputes.isEmpty()) { + this.disputes = Optional.empty(); + } else { + this.disputes = Optional.of(disputes.get()); + } + return this; + } + + /** + *

The disputes attached to this payment. Null if the actor in context does not have the payment:dispute:read permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputes(List disputes) { + this.disputes = Optional.ofNullable(disputes); + return this; + } + + /** + *

The disputes attached to this payment. Null if the actor in context does not have the payment:dispute:read permission.

+ */ + @java.lang.Override + @JsonSetter(value = "disputes", nulls = Nulls.SKIP) + public _FinalStage disputes(Optional> disputes) { + this.disputes = disputes; + return this; + } + + /** + *

When an alert came in that this transaction will be disputed

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputeAlertedAt(Nullable disputeAlertedAt) { + if (disputeAlertedAt.isNull()) { + this.disputeAlertedAt = null; + } else if (disputeAlertedAt.isEmpty()) { + this.disputeAlertedAt = Optional.empty(); + } else { + this.disputeAlertedAt = Optional.of(disputeAlertedAt.get()); + } + return this; + } + + /** + *

When an alert came in that this transaction will be disputed

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputeAlertedAt(OffsetDateTime disputeAlertedAt) { + this.disputeAlertedAt = Optional.ofNullable(disputeAlertedAt); + return this; + } + + /** + *

When an alert came in that this transaction will be disputed

+ */ + @java.lang.Override + @JsonSetter(value = "dispute_alerted_at", nulls = Nulls.SKIP) + public _FinalStage disputeAlertedAt(Optional disputeAlertedAt) { + this.disputeAlertedAt = disputeAlertedAt; + return this; + } + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage declineCode(Nullable declineCode) { + if (declineCode.isNull()) { + this.declineCode = null; + } else if (declineCode.isEmpty()) { + this.declineCode = Optional.empty(); + } else { + this.declineCode = Optional.of(declineCode.get()); + } + return this; + } + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage declineCode(PaymentDeclineCodes declineCode) { + this.declineCode = Optional.ofNullable(declineCode); + return this; + } + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ */ + @java.lang.Override + @JsonSetter(value = "decline_code", nulls = Nulls.SKIP) + public _FinalStage declineCode(Optional declineCode) { + this.declineCode = declineCode; + return this; + } + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerPhone(Nullable customerPhone) { + if (customerPhone.isNull()) { + this.customerPhone = null; + } else if (customerPhone.isEmpty()) { + this.customerPhone = Optional.empty(); + } else { + this.customerPhone = Optional.of(customerPhone.get()); + } + return this; + } + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerPhone(String customerPhone) { + this.customerPhone = Optional.ofNullable(customerPhone); + return this; + } + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ */ + @java.lang.Override + @JsonSetter(value = "customer_phone", nulls = Nulls.SKIP) + public _FinalStage customerPhone(Optional customerPhone) { + this.customerPhone = customerPhone; + return this; + } + + /** + *

The company for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(Nullable company) { + if (company.isNull()) { + this.company = null; + } else if (company.isEmpty()) { + this.company = Optional.empty(); + } else { + this.company = Optional.of(company.get()); + } + return this; + } + + /** + *

The company for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(PaymentCompany company) { + this.company = Optional.ofNullable(company); + return this; + } + + /** + *

The company for the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfigurationId(Nullable checkoutConfigurationId) { + if (checkoutConfigurationId.isNull()) { + this.checkoutConfigurationId = null; + } else if (checkoutConfigurationId.isEmpty()) { + this.checkoutConfigurationId = Optional.empty(); + } else { + this.checkoutConfigurationId = Optional.of(checkoutConfigurationId.get()); + } + return this; + } + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfigurationId(String checkoutConfigurationId) { + this.checkoutConfigurationId = Optional.ofNullable(checkoutConfigurationId); + return this; + } + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ */ + @java.lang.Override + @JsonSetter(value = "checkout_configuration_id", nulls = Nulls.SKIP) + public _FinalStage checkoutConfigurationId(Optional checkoutConfigurationId) { + this.checkoutConfigurationId = checkoutConfigurationId; + return this; + } + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardLast4(Nullable cardLast4) { + if (cardLast4.isNull()) { + this.cardLast4 = null; + } else if (cardLast4.isEmpty()) { + this.cardLast4 = Optional.empty(); + } else { + this.cardLast4 = Optional.of(cardLast4.get()); + } + return this; + } + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardLast4(String cardLast4) { + this.cardLast4 = Optional.ofNullable(cardLast4); + return this; + } + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ */ + @java.lang.Override + @JsonSetter(value = "card_last4", nulls = Nulls.SKIP) + public _FinalStage cardLast4(Optional cardLast4) { + this.cardLast4 = cardLast4; + return this; + } + + /** + *

The four-digit expiration year of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardExpYear(Nullable cardExpYear) { + if (cardExpYear.isNull()) { + this.cardExpYear = null; + } else if (cardExpYear.isEmpty()) { + this.cardExpYear = Optional.empty(); + } else { + this.cardExpYear = Optional.of(cardExpYear.get()); + } + return this; + } + + /** + *

The four-digit expiration year of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardExpYear(Integer cardExpYear) { + this.cardExpYear = Optional.ofNullable(cardExpYear); + return this; + } + + /** + *

The four-digit expiration year of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ */ + @java.lang.Override + @JsonSetter(value = "card_exp_year", nulls = Nulls.SKIP) + public _FinalStage cardExpYear(Optional cardExpYear) { + this.cardExpYear = cardExpYear; + return this; + } + + /** + *

The expiration month (1-12) of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardExpMonth(Nullable cardExpMonth) { + if (cardExpMonth.isNull()) { + this.cardExpMonth = null; + } else if (cardExpMonth.isEmpty()) { + this.cardExpMonth = Optional.empty(); + } else { + this.cardExpMonth = Optional.of(cardExpMonth.get()); + } + return this; + } + + /** + *

The expiration month (1-12) of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardExpMonth(Integer cardExpMonth) { + this.cardExpMonth = Optional.ofNullable(cardExpMonth); + return this; + } + + /** + *

The expiration month (1-12) of the card used for this payment. Falls back to the declined card on failed payments with no saved card. Null when the payment was not made with a card or the expiry is unavailable.

+ */ + @java.lang.Override + @JsonSetter(value = "card_exp_month", nulls = Nulls.SKIP) + public _FinalStage cardExpMonth(Optional cardExpMonth) { + this.cardExpMonth = cardExpMonth; + return this; + } + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(Nullable cardBrand) { + if (cardBrand.isNull()) { + this.cardBrand = null; + } else if (cardBrand.isEmpty()) { + this.cardBrand = Optional.empty(); + } else { + this.cardBrand = Optional.of(cardBrand.get()); + } + return this; + } + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(CardBrands cardBrand) { + this.cardBrand = Optional.ofNullable(cardBrand); + return this; + } + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ */ + @java.lang.Override + @JsonSetter(value = "card_brand", nulls = Nulls.SKIP) + public _FinalStage cardBrand(Optional cardBrand) { + this.cardBrand = cardBrand; + return this; + } + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingReason(Nullable billingReason) { + if (billingReason.isNull()) { + this.billingReason = null; + } else if (billingReason.isEmpty()) { + this.billingReason = Optional.empty(); + } else { + this.billingReason = Optional.of(billingReason.get()); + } + return this; + } + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingReason(BillingReasons billingReason) { + this.billingReason = Optional.ofNullable(billingReason); + return this; + } + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_reason", nulls = Nulls.SKIP) + public _FinalStage billingReason(Optional billingReason) { + this.billingReason = billingReason; + return this; + } + + /** + *

The address of the user who made the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingAddress(Nullable billingAddress) { + if (billingAddress.isNull()) { + this.billingAddress = null; + } else if (billingAddress.isEmpty()) { + this.billingAddress = Optional.empty(); + } else { + this.billingAddress = Optional.of(billingAddress.get()); + } + return this; + } + + /** + *

The address of the user who made the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingAddress(PaymentBillingAddress billingAddress) { + this.billingAddress = Optional.ofNullable(billingAddress); + return this; + } + + /** + *

The address of the user who made the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_address", nulls = Nulls.SKIP) + public _FinalStage billingAddress(Optional billingAddress) { + this.billingAddress = billingAddress; + return this; + } + + /** + *

The application fee charged on this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage applicationFee(Nullable applicationFee) { + if (applicationFee.isNull()) { + this.applicationFee = null; + } else if (applicationFee.isEmpty()) { + this.applicationFee = Optional.empty(); + } else { + this.applicationFee = Optional.of(applicationFee.get()); + } + return this; + } + + /** + *

The application fee charged on this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage applicationFee(PaymentApplicationFee applicationFee) { + this.applicationFee = Optional.ofNullable(applicationFee); + return this; + } + + /** + *

The application fee charged on this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "application_fee", nulls = Nulls.SKIP) + public _FinalStage applicationFee(Optional applicationFee) { + this.applicationFee = applicationFee; + return this; + } + + @java.lang.Override + public Payment build() { + return new Payment( + amountAfterFees, + applicationFee, + autoRefunded, + billingAddress, + billingReason, + cardBrand, + cardExpMonth, + cardExpYear, + cardLast4, + checkoutConfigurationId, + company, + createdAt, + currency, + customerPhone, + declineCode, + disputeAlertedAt, + disputes, + failureMessage, + financingInstallmentsCount, + financingTransactions, + id, + lastPaymentAttempt, + member, + membership, + metadata, + needsTracking, + nextPaymentAttempt, + paidAt, + paymentInstrument, + paymentMethod, + paymentMethodType, + paymentsFailed, + plan, + product, + promoCode, + refundable, + refundedAmount, + refundedAt, + refunds, + resolutions, + retryable, + riskScore, + riskSignals, + settlementAmount, + settlementCurrency, + settlementExchangeRate, + settlementTimeAt, + shipment, + shippingAddress, + status, + substatus, + subtotal, + taxAmount, + taxBehavior, + taxRefundedAmount, + threeDsVerified, + total, + updatedAt, + usdTotal, + user, + verificationChecks, + voidable, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentApplicationFee.java b/src/main/java/com/whop/api/types/PaymentApplicationFee.java new file mode 100644 index 00000000..6e592819 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentApplicationFee.java @@ -0,0 +1,316 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentApplicationFee.Builder.class) +public final class PaymentApplicationFee { + private final double amount; + + private final double amountCaptured; + + private final double amountRefunded; + + private final OffsetDateTime createdAt; + + private final Currencies currency; + + private final String id; + + private final Map additionalProperties; + + private PaymentApplicationFee( + double amount, + double amountCaptured, + double amountRefunded, + OffsetDateTime createdAt, + Currencies currency, + String id, + Map additionalProperties) { + this.amount = amount; + this.amountCaptured = amountCaptured; + this.amountRefunded = amountRefunded; + this.createdAt = createdAt; + this.currency = currency; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The application fee amount. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The amount of the application fee that has been captured. + */ + @JsonProperty("amount_captured") + public double getAmountCaptured() { + return amountCaptured; + } + + /** + * @return The amount of the application fee that has been refunded. + */ + @JsonProperty("amount_refunded") + public double getAmountRefunded() { + return amountRefunded; + } + + /** + * @return The datetime the application fee was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The currency of the application fee. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The unique identifier for the application fee. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentApplicationFee && equalTo((PaymentApplicationFee) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentApplicationFee other) { + return amount == other.amount + && amountCaptured == other.amountCaptured + && amountRefunded == other.amountRefunded + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, this.amountCaptured, this.amountRefunded, this.createdAt, this.currency, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The application fee amount.

+ */ + AmountCapturedStage amount(double amount); + + Builder from(PaymentApplicationFee other); + } + + public interface AmountCapturedStage { + /** + *

The amount of the application fee that has been captured.

+ */ + AmountRefundedStage amountCaptured(double amountCaptured); + } + + public interface AmountRefundedStage { + /** + *

The amount of the application fee that has been refunded.

+ */ + CreatedAtStage amountRefunded(double amountRefunded); + } + + public interface CreatedAtStage { + /** + *

The datetime the application fee was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

The currency of the application fee.

+ */ + IdStage currency(@NotNull Currencies currency); + } + + public interface IdStage { + /** + *

The unique identifier for the application fee.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + PaymentApplicationFee build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + AmountCapturedStage, + AmountRefundedStage, + CreatedAtStage, + CurrencyStage, + IdStage, + _FinalStage { + private double amount; + + private double amountCaptured; + + private double amountRefunded; + + private OffsetDateTime createdAt; + + private Currencies currency; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentApplicationFee other) { + amount(other.getAmount()); + amountCaptured(other.getAmountCaptured()); + amountRefunded(other.getAmountRefunded()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + id(other.getId()); + return this; + } + + /** + *

The application fee amount.

+ *

The application fee amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public AmountCapturedStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The amount of the application fee that has been captured.

+ *

The amount of the application fee that has been captured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount_captured") + public AmountRefundedStage amountCaptured(double amountCaptured) { + this.amountCaptured = amountCaptured; + return this; + } + + /** + *

The amount of the application fee that has been refunded.

+ *

The amount of the application fee that has been refunded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount_refunded") + public CreatedAtStage amountRefunded(double amountRefunded) { + this.amountRefunded = amountRefunded; + return this; + } + + /** + *

The datetime the application fee was created.

+ *

The datetime the application fee was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The currency of the application fee.

+ *

The currency of the application fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier for the application fee.

+ *

The unique identifier for the application fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public PaymentApplicationFee build() { + return new PaymentApplicationFee( + amount, amountCaptured, amountRefunded, createdAt, currency, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentBankTransfer.java b/src/main/java/com/whop/api/types/PaymentBankTransfer.java new file mode 100644 index 00000000..fb2eebbe --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentBankTransfer.java @@ -0,0 +1,596 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentBankTransfer.Builder.class) +public final class PaymentBankTransfer { + private final Optional accountNumber; + + private final Optional accountNumberLabel; + + private final Optional amount; + + private final Optional bankAccountType; + + private final Optional bankBranch; + + private final Optional bankCode; + + private final Optional bankName; + + private final Optional beneficiaryDocument; + + private final Optional beneficiaryDocumentType; + + private final Optional beneficiaryName; + + private final Optional documentUrl; + + private final Optional expiresAt; + + private final Optional instructions; + + private final Optional reference; + + private final Optional secondaryAccountNumber; + + private final Optional secondaryAccountNumberLabel; + + private final Map additionalProperties; + + private PaymentBankTransfer( + Optional accountNumber, + Optional accountNumberLabel, + Optional amount, + Optional bankAccountType, + Optional bankBranch, + Optional bankCode, + Optional bankName, + Optional beneficiaryDocument, + Optional beneficiaryDocumentType, + Optional beneficiaryName, + Optional documentUrl, + Optional expiresAt, + Optional instructions, + Optional reference, + Optional secondaryAccountNumber, + Optional secondaryAccountNumberLabel, + Map additionalProperties) { + this.accountNumber = accountNumber; + this.accountNumberLabel = accountNumberLabel; + this.amount = amount; + this.bankAccountType = bankAccountType; + this.bankBranch = bankBranch; + this.bankCode = bankCode; + this.bankName = bankName; + this.beneficiaryDocument = beneficiaryDocument; + this.beneficiaryDocumentType = beneficiaryDocumentType; + this.beneficiaryName = beneficiaryName; + this.documentUrl = documentUrl; + this.expiresAt = expiresAt; + this.instructions = instructions; + this.reference = reference; + this.secondaryAccountNumber = secondaryAccountNumber; + this.secondaryAccountNumberLabel = secondaryAccountNumberLabel; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account to send to, in the local scheme's format — account_number_label says what to call it. + */ + @JsonProperty("account_number") + public Optional getAccountNumber() { + return accountNumber; + } + + /** + * @return What to call account_number when showing it, in the local scheme's own terms — CLABE in Mexico, for example. + */ + @JsonProperty("account_number_label") + public Optional getAccountNumberLabel() { + return accountNumberLabel; + } + + /** + * @return Exactly what the buyer must send, in the charged currency. + */ + @JsonProperty("amount") + public Optional getAmount() { + return amount; + } + + /** + * @return The kind of account receiving the transfer, such as a checking account, in the local system's own vocabulary. + */ + @JsonProperty("bank_account_type") + public Optional getBankAccountType() { + return bankAccountType; + } + + /** + * @return The receiving branch, where the local system routes by branch. + */ + @JsonProperty("bank_branch") + public Optional getBankBranch() { + return bankBranch; + } + + /** + * @return The receiving bank's code in the local clearing system. + */ + @JsonProperty("bank_code") + public Optional getBankCode() { + return bankCode; + } + + /** + * @return The receiving bank's name. + */ + @JsonProperty("bank_name") + public Optional getBankName() { + return bankName; + } + + /** + * @return The account holder's tax or identity document number, where the local system needs it to send. + */ + @JsonProperty("beneficiary_document") + public Optional getBeneficiaryDocument() { + return beneficiaryDocument; + } + + /** + * @return What kind of document beneficiary_document is, in the local system's own vocabulary. + */ + @JsonProperty("beneficiary_document_type") + public Optional getBeneficiaryDocumentType() { + return beneficiaryDocumentType; + } + + /** + * @return Who the account belongs to — the name the buyer's bank may ask them to confirm. + */ + @JsonProperty("beneficiary_name") + public Optional getBeneficiaryName() { + return beneficiaryName; + } + + /** + * @return A hosted page with the complete, printable instructions. If you would rather not render the details yourself, send the buyer here. + */ + @JsonProperty("document_url") + public Optional getDocumentUrl() { + return documentUrl; + } + + /** + * @return When these details stop being payable, as an ISO 8601 timestamp. + */ + @JsonProperty("expires_at") + public Optional getExpiresAt() { + return expiresAt; + } + + /** + * @return The rail's own step-by-step payment text, when it supplies one. + */ + @JsonProperty("instructions") + public Optional getInstructions() { + return instructions; + } + + /** + * @return The reference the buyer must attach to the transfer so it can be matched to this payment. + */ + @JsonProperty("reference") + public Optional getReference() { + return reference; + } + + /** + * @return A second account number, where the rail publishes the same destination in more than one format. + */ + @JsonProperty("secondary_account_number") + public Optional getSecondaryAccountNumber() { + return secondaryAccountNumber; + } + + /** + * @return What to call secondary_account_number when showing it. + */ + @JsonProperty("secondary_account_number_label") + public Optional getSecondaryAccountNumberLabel() { + return secondaryAccountNumberLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentBankTransfer && equalTo((PaymentBankTransfer) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentBankTransfer other) { + return accountNumber.equals(other.accountNumber) + && accountNumberLabel.equals(other.accountNumberLabel) + && amount.equals(other.amount) + && bankAccountType.equals(other.bankAccountType) + && bankBranch.equals(other.bankBranch) + && bankCode.equals(other.bankCode) + && bankName.equals(other.bankName) + && beneficiaryDocument.equals(other.beneficiaryDocument) + && beneficiaryDocumentType.equals(other.beneficiaryDocumentType) + && beneficiaryName.equals(other.beneficiaryName) + && documentUrl.equals(other.documentUrl) + && expiresAt.equals(other.expiresAt) + && instructions.equals(other.instructions) + && reference.equals(other.reference) + && secondaryAccountNumber.equals(other.secondaryAccountNumber) + && secondaryAccountNumberLabel.equals(other.secondaryAccountNumberLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountNumber, + this.accountNumberLabel, + this.amount, + this.bankAccountType, + this.bankBranch, + this.bankCode, + this.bankName, + this.beneficiaryDocument, + this.beneficiaryDocumentType, + this.beneficiaryName, + this.documentUrl, + this.expiresAt, + this.instructions, + this.reference, + this.secondaryAccountNumber, + this.secondaryAccountNumberLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional accountNumber = Optional.empty(); + + private Optional accountNumberLabel = Optional.empty(); + + private Optional amount = Optional.empty(); + + private Optional bankAccountType = Optional.empty(); + + private Optional bankBranch = Optional.empty(); + + private Optional bankCode = Optional.empty(); + + private Optional bankName = Optional.empty(); + + private Optional beneficiaryDocument = Optional.empty(); + + private Optional beneficiaryDocumentType = Optional.empty(); + + private Optional beneficiaryName = Optional.empty(); + + private Optional documentUrl = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + private Optional instructions = Optional.empty(); + + private Optional reference = Optional.empty(); + + private Optional secondaryAccountNumber = Optional.empty(); + + private Optional secondaryAccountNumberLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentBankTransfer other) { + accountNumber(other.getAccountNumber()); + accountNumberLabel(other.getAccountNumberLabel()); + amount(other.getAmount()); + bankAccountType(other.getBankAccountType()); + bankBranch(other.getBankBranch()); + bankCode(other.getBankCode()); + bankName(other.getBankName()); + beneficiaryDocument(other.getBeneficiaryDocument()); + beneficiaryDocumentType(other.getBeneficiaryDocumentType()); + beneficiaryName(other.getBeneficiaryName()); + documentUrl(other.getDocumentUrl()); + expiresAt(other.getExpiresAt()); + instructions(other.getInstructions()); + reference(other.getReference()); + secondaryAccountNumber(other.getSecondaryAccountNumber()); + secondaryAccountNumberLabel(other.getSecondaryAccountNumberLabel()); + return this; + } + + /** + *

The account to send to, in the local scheme's format — account_number_label says what to call it.

+ */ + @JsonSetter(value = "account_number", nulls = Nulls.SKIP) + public Builder accountNumber(Optional accountNumber) { + this.accountNumber = accountNumber; + return this; + } + + public Builder accountNumber(String accountNumber) { + this.accountNumber = Optional.ofNullable(accountNumber); + return this; + } + + /** + *

What to call account_number when showing it, in the local scheme's own terms — CLABE in Mexico, for example.

+ */ + @JsonSetter(value = "account_number_label", nulls = Nulls.SKIP) + public Builder accountNumberLabel(Optional accountNumberLabel) { + this.accountNumberLabel = accountNumberLabel; + return this; + } + + public Builder accountNumberLabel(String accountNumberLabel) { + this.accountNumberLabel = Optional.ofNullable(accountNumberLabel); + return this; + } + + /** + *

Exactly what the buyer must send, in the charged currency.

+ */ + @JsonSetter(value = "amount", nulls = Nulls.SKIP) + public Builder amount(Optional amount) { + this.amount = amount; + return this; + } + + public Builder amount(Money amount) { + this.amount = Optional.ofNullable(amount); + return this; + } + + /** + *

The kind of account receiving the transfer, such as a checking account, in the local system's own vocabulary.

+ */ + @JsonSetter(value = "bank_account_type", nulls = Nulls.SKIP) + public Builder bankAccountType(Optional bankAccountType) { + this.bankAccountType = bankAccountType; + return this; + } + + public Builder bankAccountType(String bankAccountType) { + this.bankAccountType = Optional.ofNullable(bankAccountType); + return this; + } + + /** + *

The receiving branch, where the local system routes by branch.

+ */ + @JsonSetter(value = "bank_branch", nulls = Nulls.SKIP) + public Builder bankBranch(Optional bankBranch) { + this.bankBranch = bankBranch; + return this; + } + + public Builder bankBranch(String bankBranch) { + this.bankBranch = Optional.ofNullable(bankBranch); + return this; + } + + /** + *

The receiving bank's code in the local clearing system.

+ */ + @JsonSetter(value = "bank_code", nulls = Nulls.SKIP) + public Builder bankCode(Optional bankCode) { + this.bankCode = bankCode; + return this; + } + + public Builder bankCode(String bankCode) { + this.bankCode = Optional.ofNullable(bankCode); + return this; + } + + /** + *

The receiving bank's name.

+ */ + @JsonSetter(value = "bank_name", nulls = Nulls.SKIP) + public Builder bankName(Optional bankName) { + this.bankName = bankName; + return this; + } + + public Builder bankName(String bankName) { + this.bankName = Optional.ofNullable(bankName); + return this; + } + + /** + *

The account holder's tax or identity document number, where the local system needs it to send.

+ */ + @JsonSetter(value = "beneficiary_document", nulls = Nulls.SKIP) + public Builder beneficiaryDocument(Optional beneficiaryDocument) { + this.beneficiaryDocument = beneficiaryDocument; + return this; + } + + public Builder beneficiaryDocument(String beneficiaryDocument) { + this.beneficiaryDocument = Optional.ofNullable(beneficiaryDocument); + return this; + } + + /** + *

What kind of document beneficiary_document is, in the local system's own vocabulary.

+ */ + @JsonSetter(value = "beneficiary_document_type", nulls = Nulls.SKIP) + public Builder beneficiaryDocumentType(Optional beneficiaryDocumentType) { + this.beneficiaryDocumentType = beneficiaryDocumentType; + return this; + } + + public Builder beneficiaryDocumentType(String beneficiaryDocumentType) { + this.beneficiaryDocumentType = Optional.ofNullable(beneficiaryDocumentType); + return this; + } + + /** + *

Who the account belongs to — the name the buyer's bank may ask them to confirm.

+ */ + @JsonSetter(value = "beneficiary_name", nulls = Nulls.SKIP) + public Builder beneficiaryName(Optional beneficiaryName) { + this.beneficiaryName = beneficiaryName; + return this; + } + + public Builder beneficiaryName(String beneficiaryName) { + this.beneficiaryName = Optional.ofNullable(beneficiaryName); + return this; + } + + /** + *

A hosted page with the complete, printable instructions. If you would rather not render the details yourself, send the buyer here.

+ */ + @JsonSetter(value = "document_url", nulls = Nulls.SKIP) + public Builder documentUrl(Optional documentUrl) { + this.documentUrl = documentUrl; + return this; + } + + public Builder documentUrl(String documentUrl) { + this.documentUrl = Optional.ofNullable(documentUrl); + return this; + } + + /** + *

When these details stop being payable, as an ISO 8601 timestamp.

+ */ + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public Builder expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + public Builder expiresAt(String expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + /** + *

The rail's own step-by-step payment text, when it supplies one.

+ */ + @JsonSetter(value = "instructions", nulls = Nulls.SKIP) + public Builder instructions(Optional instructions) { + this.instructions = instructions; + return this; + } + + public Builder instructions(String instructions) { + this.instructions = Optional.ofNullable(instructions); + return this; + } + + /** + *

The reference the buyer must attach to the transfer so it can be matched to this payment.

+ */ + @JsonSetter(value = "reference", nulls = Nulls.SKIP) + public Builder reference(Optional reference) { + this.reference = reference; + return this; + } + + public Builder reference(String reference) { + this.reference = Optional.ofNullable(reference); + return this; + } + + /** + *

A second account number, where the rail publishes the same destination in more than one format.

+ */ + @JsonSetter(value = "secondary_account_number", nulls = Nulls.SKIP) + public Builder secondaryAccountNumber(Optional secondaryAccountNumber) { + this.secondaryAccountNumber = secondaryAccountNumber; + return this; + } + + public Builder secondaryAccountNumber(String secondaryAccountNumber) { + this.secondaryAccountNumber = Optional.ofNullable(secondaryAccountNumber); + return this; + } + + /** + *

What to call secondary_account_number when showing it.

+ */ + @JsonSetter(value = "secondary_account_number_label", nulls = Nulls.SKIP) + public Builder secondaryAccountNumberLabel(Optional secondaryAccountNumberLabel) { + this.secondaryAccountNumberLabel = secondaryAccountNumberLabel; + return this; + } + + public Builder secondaryAccountNumberLabel(String secondaryAccountNumberLabel) { + this.secondaryAccountNumberLabel = Optional.ofNullable(secondaryAccountNumberLabel); + return this; + } + + public PaymentBankTransfer build() { + return new PaymentBankTransfer( + accountNumber, + accountNumberLabel, + amount, + bankAccountType, + bankBranch, + bankCode, + bankName, + beneficiaryDocument, + beneficiaryDocumentType, + beneficiaryName, + documentUrl, + expiresAt, + instructions, + reference, + secondaryAccountNumber, + secondaryAccountNumberLabel, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentBankTransferInstructions.java b/src/main/java/com/whop/api/types/PaymentBankTransferInstructions.java new file mode 100644 index 00000000..5c8e6d40 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentBankTransferInstructions.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentBankTransferInstructions.Builder.class) +public final class PaymentBankTransferInstructions { + private final PaymentBankTransfer bankTransfer; + + private final Map additionalProperties; + + private PaymentBankTransferInstructions( + PaymentBankTransfer bankTransfer, Map additionalProperties) { + this.bankTransfer = bankTransfer; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account details to show. + */ + @JsonProperty("bank_transfer") + public PaymentBankTransfer getBankTransfer() { + return bankTransfer; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentBankTransferInstructions && equalTo((PaymentBankTransferInstructions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentBankTransferInstructions other) { + return bankTransfer.equals(other.bankTransfer); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.bankTransfer); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BankTransferStage builder() { + return new Builder(); + } + + public interface BankTransferStage { + /** + *

The account details to show.

+ */ + _FinalStage bankTransfer(@NotNull PaymentBankTransfer bankTransfer); + + Builder from(PaymentBankTransferInstructions other); + } + + public interface _FinalStage { + PaymentBankTransferInstructions build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BankTransferStage, _FinalStage { + private PaymentBankTransfer bankTransfer; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentBankTransferInstructions other) { + bankTransfer(other.getBankTransfer()); + return this; + } + + /** + *

The account details to show.

+ *

The account details to show.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bank_transfer") + public _FinalStage bankTransfer(@NotNull PaymentBankTransfer bankTransfer) { + this.bankTransfer = Objects.requireNonNull(bankTransfer, "bankTransfer must not be null"); + return this; + } + + @java.lang.Override + public PaymentBankTransferInstructions build() { + return new PaymentBankTransferInstructions(bankTransfer, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentBillingAddress.java b/src/main/java/com/whop/api/types/PaymentBillingAddress.java new file mode 100644 index 00000000..3c92b685 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentBillingAddress.java @@ -0,0 +1,437 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentBillingAddress.Builder.class) +public final class PaymentBillingAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional name; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private PaymentBillingAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional name, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.name = name; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The name of the customer. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentBillingAddress && equalTo((PaymentBillingAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentBillingAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && name.equals(other.name) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.name, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentBillingAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + name(other.getName()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The name of the customer.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public PaymentBillingAddress build() { + return new PaymentBillingAddress( + city, country, line1, line2, name, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentCompany.java b/src/main/java/com/whop/api/types/PaymentCompany.java new file mode 100644 index 00000000..9107c98e --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentCompany.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentCompany.Builder.class) +public final class PaymentCompany { + private final String id; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private PaymentCompany(String id, String route, String title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The slug/route of the company on the Whop site. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return The written name of the company. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentCompany && equalTo((PaymentCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + RouteStage id(@NotNull String id); + + Builder from(PaymentCompany other); + } + + public interface RouteStage { + /** + *

The slug/route of the company on the Whop site.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

The written name of the company.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + PaymentCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The slug/route of the company on the Whop site.

+ *

The slug/route of the company on the Whop site.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

The written name of the company.

+ *

The written name of the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public PaymentCompany build() { + return new PaymentCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentDeclineCodes.java b/src/main/java/com/whop/api/types/PaymentDeclineCodes.java new file mode 100644 index 00000000..246d1ab1 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentDeclineCodes.java @@ -0,0 +1,999 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PaymentDeclineCodes { + public static final PaymentDeclineCodes PROCESSING_ERROR = + new PaymentDeclineCodes(Value.PROCESSING_ERROR, "processing_error"); + + public static final PaymentDeclineCodes REENTER_TRANSACTION = + new PaymentDeclineCodes(Value.REENTER_TRANSACTION, "reenter_transaction"); + + public static final PaymentDeclineCodes INVALID_ACCOUNT = + new PaymentDeclineCodes(Value.INVALID_ACCOUNT, "invalid_account"); + + public static final PaymentDeclineCodes THREE_D_SECURE_CANCELED = + new PaymentDeclineCodes(Value.THREE_D_SECURE_CANCELED, "three_d_secure_canceled"); + + public static final PaymentDeclineCodes TRANSACTION_NOT_ALLOWED = + new PaymentDeclineCodes(Value.TRANSACTION_NOT_ALLOWED, "transaction_not_allowed"); + + public static final PaymentDeclineCodes HIGH_RISK = new PaymentDeclineCodes(Value.HIGH_RISK, "high_risk"); + + public static final PaymentDeclineCodes THREE_D_SECURE_SUCCESS = + new PaymentDeclineCodes(Value.THREE_D_SECURE_SUCCESS, "three_d_secure_success"); + + public static final PaymentDeclineCodes STOLEN_CARD = new PaymentDeclineCodes(Value.STOLEN_CARD, "stolen_card"); + + public static final PaymentDeclineCodes CANNOT_AUTHORIZE = + new PaymentDeclineCodes(Value.CANNOT_AUTHORIZE, "cannot_authorize"); + + public static final PaymentDeclineCodes CARD_NOT_SUPPORTED = + new PaymentDeclineCodes(Value.CARD_NOT_SUPPORTED, "card_not_supported"); + + public static final PaymentDeclineCodes NO_ACCOUNTS = new PaymentDeclineCodes(Value.NO_ACCOUNTS, "no_accounts"); + + public static final PaymentDeclineCodes TRANSACTION_STOPPED = + new PaymentDeclineCodes(Value.TRANSACTION_STOPPED, "transaction_stopped"); + + public static final PaymentDeclineCodes LOST_CARD = new PaymentDeclineCodes(Value.LOST_CARD, "lost_card"); + + public static final PaymentDeclineCodes BANK_PROCESSING_ERROR = + new PaymentDeclineCodes(Value.BANK_PROCESSING_ERROR, "bank_processing_error"); + + public static final PaymentDeclineCodes GENERIC_DECLINE = + new PaymentDeclineCodes(Value.GENERIC_DECLINE, "generic_decline"); + + public static final PaymentDeclineCodes CARD_TYPE_NOT_SUPPORTED = + new PaymentDeclineCodes(Value.CARD_TYPE_NOT_SUPPORTED, "card_type_not_supported"); + + public static final PaymentDeclineCodes AUTHENTICATION_REQUIRED = + new PaymentDeclineCodes(Value.AUTHENTICATION_REQUIRED, "authentication_required"); + + public static final PaymentDeclineCodes BANK_DECLINED = + new PaymentDeclineCodes(Value.BANK_DECLINED, "bank_declined"); + + public static final PaymentDeclineCodes RESTRICTED_CARD = + new PaymentDeclineCodes(Value.RESTRICTED_CARD, "restricted_card"); + + public static final PaymentDeclineCodes SUSPECTED_FRAUD = + new PaymentDeclineCodes(Value.SUSPECTED_FRAUD, "suspected_fraud"); + + public static final PaymentDeclineCodes ISSUER_NOT_FOUND = + new PaymentDeclineCodes(Value.ISSUER_NOT_FOUND, "issuer_not_found"); + + public static final PaymentDeclineCodes BANK_AUTHORIZATION_REVOKED = + new PaymentDeclineCodes(Value.BANK_AUTHORIZATION_REVOKED, "bank_authorization_revoked"); + + public static final PaymentDeclineCodes SEPA_NO_MANDATE = + new PaymentDeclineCodes(Value.SEPA_NO_MANDATE, "sepa_no_mandate"); + + public static final PaymentDeclineCodes THREE_D_SECURE_FAILED = + new PaymentDeclineCodes(Value.THREE_D_SECURE_FAILED, "three_d_secure_failed"); + + public static final PaymentDeclineCodes BANK_ACCOUNT_FROZEN = + new PaymentDeclineCodes(Value.BANK_ACCOUNT_FROZEN, "bank_account_frozen"); + + public static final PaymentDeclineCodes INVALID_CVC_OR_EXPIRATION = + new PaymentDeclineCodes(Value.INVALID_CVC_OR_EXPIRATION, "invalid_cvc_or_expiration"); + + public static final PaymentDeclineCodes THREE_D_SECURE_REPORTED_LOST_OR_STOLEN = new PaymentDeclineCodes( + Value.THREE_D_SECURE_REPORTED_LOST_OR_STOLEN, "three_d_secure_reported_lost_or_stolen"); + + public static final PaymentDeclineCodes CLOSED_ACCOUNT = + new PaymentDeclineCodes(Value.CLOSED_ACCOUNT, "closed_account"); + + public static final PaymentDeclineCodes SEPA_DISPUTED = + new PaymentDeclineCodes(Value.SEPA_DISPUTED, "sepa_disputed"); + + public static final PaymentDeclineCodes INVALID_PIN = new PaymentDeclineCodes(Value.INVALID_PIN, "invalid_pin"); + + public static final PaymentDeclineCodes INVALID_ZIP = new PaymentDeclineCodes(Value.INVALID_ZIP, "invalid_zip"); + + public static final PaymentDeclineCodes INVALID_EXPIRY = + new PaymentDeclineCodes(Value.INVALID_EXPIRY, "invalid_expiry"); + + public static final PaymentDeclineCodes BANK_AMOUNT_ERROR = + new PaymentDeclineCodes(Value.BANK_AMOUNT_ERROR, "bank_amount_error"); + + public static final PaymentDeclineCodes WITHDRAWAL_COUNT_LIMIT_EXCEEDED = + new PaymentDeclineCodes(Value.WITHDRAWAL_COUNT_LIMIT_EXCEEDED, "withdrawal_count_limit_exceeded"); + + public static final PaymentDeclineCodes MERCHANT_BLACKLIST = + new PaymentDeclineCodes(Value.MERCHANT_BLACKLIST, "merchant_blacklist"); + + public static final PaymentDeclineCodes BANK_PAYMENT_STOPPED = + new PaymentDeclineCodes(Value.BANK_PAYMENT_STOPPED, "bank_payment_stopped"); + + public static final PaymentDeclineCodes CONTACT_ISSUER = + new PaymentDeclineCodes(Value.CONTACT_ISSUER, "contact_issuer"); + + public static final PaymentDeclineCodes TEST_MODE_TEST_CARD = + new PaymentDeclineCodes(Value.TEST_MODE_TEST_CARD, "test_mode_test_card"); + + public static final PaymentDeclineCodes TRANSACTION_NOT_PERMITTED = + new PaymentDeclineCodes(Value.TRANSACTION_NOT_PERMITTED, "transaction_not_permitted"); + + public static final PaymentDeclineCodes BANK_ACCOUNT_CLOSED = + new PaymentDeclineCodes(Value.BANK_ACCOUNT_CLOSED, "bank_account_closed"); + + public static final PaymentDeclineCodes TRY_AGAIN_LATER = + new PaymentDeclineCodes(Value.TRY_AGAIN_LATER, "try_again_later"); + + public static final PaymentDeclineCodes BANK_NON_TRANSACTION_ACCOUNT = + new PaymentDeclineCodes(Value.BANK_NON_TRANSACTION_ACCOUNT, "bank_non_transaction_account"); + + public static final PaymentDeclineCodes BANK_DUPLICATE = + new PaymentDeclineCodes(Value.BANK_DUPLICATE, "bank_duplicate"); + + public static final PaymentDeclineCodes THREE_D_SECURE_GENERIC_ERROR = + new PaymentDeclineCodes(Value.THREE_D_SECURE_GENERIC_ERROR, "three_d_secure_generic_error"); + + public static final PaymentDeclineCodes INVALID_CARD_NUMBER = + new PaymentDeclineCodes(Value.INVALID_CARD_NUMBER, "invalid_card_number"); + + public static final PaymentDeclineCodes THREE_D_SECURE_INVALID_CARD_NUMBER = + new PaymentDeclineCodes(Value.THREE_D_SECURE_INVALID_CARD_NUMBER, "three_d_secure_invalid_card_number"); + + public static final PaymentDeclineCodes INVALID_EXPIRY_MONTH = + new PaymentDeclineCodes(Value.INVALID_EXPIRY_MONTH, "invalid_expiry_month"); + + public static final PaymentDeclineCodes CURRENCY_NOT_SUPPORTED = + new PaymentDeclineCodes(Value.CURRENCY_NOT_SUPPORTED, "currency_not_supported"); + + public static final PaymentDeclineCodes BLOCKED_BY_CARDHOLDER = + new PaymentDeclineCodes(Value.BLOCKED_BY_CARDHOLDER, "blocked_by_cardholder"); + + public static final PaymentDeclineCodes CARD_VELOCITY_EXCEEDED = + new PaymentDeclineCodes(Value.CARD_VELOCITY_EXCEEDED, "card_velocity_exceeded"); + + public static final PaymentDeclineCodes TRANSACTION_CANCELLED = + new PaymentDeclineCodes(Value.TRANSACTION_CANCELLED, "transaction_cancelled"); + + public static final PaymentDeclineCodes BANK_NOT_AUTHORIZED = + new PaymentDeclineCodes(Value.BANK_NOT_AUTHORIZED, "bank_not_authorized"); + + public static final PaymentDeclineCodes INCORRECT_PIN = + new PaymentDeclineCodes(Value.INCORRECT_PIN, "incorrect_pin"); + + public static final PaymentDeclineCodes BANK_DETAILS_INVALID = + new PaymentDeclineCodes(Value.BANK_DETAILS_INVALID, "bank_details_invalid"); + + public static final PaymentDeclineCodes INVALID_TRANSACTION = + new PaymentDeclineCodes(Value.INVALID_TRANSACTION, "invalid_transaction"); + + public static final PaymentDeclineCodes PROVIDER_DECLINED = + new PaymentDeclineCodes(Value.PROVIDER_DECLINED, "provider_declined"); + + public static final PaymentDeclineCodes THREE_D_SECURE_CARD_NOT_ENROLLED = + new PaymentDeclineCodes(Value.THREE_D_SECURE_CARD_NOT_ENROLLED, "three_d_secure_card_not_enrolled"); + + public static final PaymentDeclineCodes BANK_INSUFFICIENT_FUNDS = + new PaymentDeclineCodes(Value.BANK_INSUFFICIENT_FUNDS, "bank_insufficient_funds"); + + public static final PaymentDeclineCodes TEST_MODE_DECLINE = + new PaymentDeclineCodes(Value.TEST_MODE_DECLINE, "test_mode_decline"); + + public static final PaymentDeclineCodes THREE_D_SECURE_TOO_MANY_ATTEMPTS = + new PaymentDeclineCodes(Value.THREE_D_SECURE_TOO_MANY_ATTEMPTS, "three_d_secure_too_many_attempts"); + + public static final PaymentDeclineCodes PIN_REQUIRED_AS = + new PaymentDeclineCodes(Value.PIN_REQUIRED_AS, "pin_required_as"); + + public static final PaymentDeclineCodes DUPLICATE_TRANSACTION = + new PaymentDeclineCodes(Value.DUPLICATE_TRANSACTION, "duplicate_transaction"); + + public static final PaymentDeclineCodes BANK_ACCOUNT_HOLDER_DECEASED = + new PaymentDeclineCodes(Value.BANK_ACCOUNT_HOLDER_DECEASED, "bank_account_holder_deceased"); + + public static final PaymentDeclineCodes BANK_REGULATORY_BLOCKED = + new PaymentDeclineCodes(Value.BANK_REGULATORY_BLOCKED, "bank_regulatory_blocked"); + + public static final PaymentDeclineCodes SEPA_REFUSED_BY_CUSTOMER = + new PaymentDeclineCodes(Value.SEPA_REFUSED_BY_CUSTOMER, "sepa_refused_by_customer"); + + public static final PaymentDeclineCodes PIN_TRY_EXCEEDED = + new PaymentDeclineCodes(Value.PIN_TRY_EXCEEDED, "pin_try_exceeded"); + + public static final PaymentDeclineCodes BANK_INVALID_ROUTING_NUMBER = + new PaymentDeclineCodes(Value.BANK_INVALID_ROUTING_NUMBER, "bank_invalid_routing_number"); + + public static final PaymentDeclineCodes BANK_ACCOUNT_NOT_FOUND = + new PaymentDeclineCodes(Value.BANK_ACCOUNT_NOT_FOUND, "bank_account_not_found"); + + public static final PaymentDeclineCodes INSUFFICIENT_FUNDS = + new PaymentDeclineCodes(Value.INSUFFICIENT_FUNDS, "insufficient_funds"); + + public static final PaymentDeclineCodes INVALID_CARD_HOLDER_NAME = + new PaymentDeclineCodes(Value.INVALID_CARD_HOLDER_NAME, "invalid_card_holder_name"); + + public static final PaymentDeclineCodes SEPA_INVALID_IBAN = + new PaymentDeclineCodes(Value.SEPA_INVALID_IBAN, "sepa_invalid_iban"); + + public static final PaymentDeclineCodes REGULATORY_BLOCKED = + new PaymentDeclineCodes(Value.REGULATORY_BLOCKED, "regulatory_blocked"); + + public static final PaymentDeclineCodes INVALID_EXPIRY_YEAR = + new PaymentDeclineCodes(Value.INVALID_EXPIRY_YEAR, "invalid_expiry_year"); + + public static final PaymentDeclineCodes THREE_D_SECURE_FRAUD = + new PaymentDeclineCodes(Value.THREE_D_SECURE_FRAUD, "three_d_secure_fraud"); + + public static final PaymentDeclineCodes THREE_D_SECURE_REJECTED_BY_BANK = + new PaymentDeclineCodes(Value.THREE_D_SECURE_REJECTED_BY_BANK, "three_d_secure_rejected_by_bank"); + + public static final PaymentDeclineCodes SEPA_MANDATE_DATA_INVALID = + new PaymentDeclineCodes(Value.SEPA_MANDATE_DATA_INVALID, "sepa_mandate_data_invalid"); + + public static final PaymentDeclineCodes ISSUER_UNAVAILABLE = + new PaymentDeclineCodes(Value.ISSUER_UNAVAILABLE, "issuer_unavailable"); + + public static final PaymentDeclineCodes BANK_GENERIC_DECLINE = + new PaymentDeclineCodes(Value.BANK_GENERIC_DECLINE, "bank_generic_decline"); + + public static final PaymentDeclineCodes SEPA_GENERIC_DECLINE = + new PaymentDeclineCodes(Value.SEPA_GENERIC_DECLINE, "sepa_generic_decline"); + + public static final PaymentDeclineCodes PIN_REQUIRED = new PaymentDeclineCodes(Value.PIN_REQUIRED, "pin_required"); + + public static final PaymentDeclineCodes ISSUER_ERROR = new PaymentDeclineCodes(Value.ISSUER_ERROR, "issuer_error"); + + public static final PaymentDeclineCodes INVALID_CVC = new PaymentDeclineCodes(Value.INVALID_CVC, "invalid_cvc"); + + public static final PaymentDeclineCodes INVALID_COUNTRY = + new PaymentDeclineCodes(Value.INVALID_COUNTRY, "invalid_country"); + + public static final PaymentDeclineCodes EXPIRED_CARD = new PaymentDeclineCodes(Value.EXPIRED_CARD, "expired_card"); + + public static final PaymentDeclineCodes INVALID_AMOUNT = + new PaymentDeclineCodes(Value.INVALID_AMOUNT, "invalid_amount"); + + public static final PaymentDeclineCodes THREE_D_SECURE_TIMEOUT = + new PaymentDeclineCodes(Value.THREE_D_SECURE_TIMEOUT, "three_d_secure_timeout"); + + private final Value value; + + private final String string; + + PaymentDeclineCodes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PaymentDeclineCodes && this.string.equals(((PaymentDeclineCodes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PROCESSING_ERROR: + return visitor.visitProcessingError(); + case REENTER_TRANSACTION: + return visitor.visitReenterTransaction(); + case INVALID_ACCOUNT: + return visitor.visitInvalidAccount(); + case THREE_D_SECURE_CANCELED: + return visitor.visitThreeDSecureCanceled(); + case TRANSACTION_NOT_ALLOWED: + return visitor.visitTransactionNotAllowed(); + case HIGH_RISK: + return visitor.visitHighRisk(); + case THREE_D_SECURE_SUCCESS: + return visitor.visitThreeDSecureSuccess(); + case STOLEN_CARD: + return visitor.visitStolenCard(); + case CANNOT_AUTHORIZE: + return visitor.visitCannotAuthorize(); + case CARD_NOT_SUPPORTED: + return visitor.visitCardNotSupported(); + case NO_ACCOUNTS: + return visitor.visitNoAccounts(); + case TRANSACTION_STOPPED: + return visitor.visitTransactionStopped(); + case LOST_CARD: + return visitor.visitLostCard(); + case BANK_PROCESSING_ERROR: + return visitor.visitBankProcessingError(); + case GENERIC_DECLINE: + return visitor.visitGenericDecline(); + case CARD_TYPE_NOT_SUPPORTED: + return visitor.visitCardTypeNotSupported(); + case AUTHENTICATION_REQUIRED: + return visitor.visitAuthenticationRequired(); + case BANK_DECLINED: + return visitor.visitBankDeclined(); + case RESTRICTED_CARD: + return visitor.visitRestrictedCard(); + case SUSPECTED_FRAUD: + return visitor.visitSuspectedFraud(); + case ISSUER_NOT_FOUND: + return visitor.visitIssuerNotFound(); + case BANK_AUTHORIZATION_REVOKED: + return visitor.visitBankAuthorizationRevoked(); + case SEPA_NO_MANDATE: + return visitor.visitSepaNoMandate(); + case THREE_D_SECURE_FAILED: + return visitor.visitThreeDSecureFailed(); + case BANK_ACCOUNT_FROZEN: + return visitor.visitBankAccountFrozen(); + case INVALID_CVC_OR_EXPIRATION: + return visitor.visitInvalidCvcOrExpiration(); + case THREE_D_SECURE_REPORTED_LOST_OR_STOLEN: + return visitor.visitThreeDSecureReportedLostOrStolen(); + case CLOSED_ACCOUNT: + return visitor.visitClosedAccount(); + case SEPA_DISPUTED: + return visitor.visitSepaDisputed(); + case INVALID_PIN: + return visitor.visitInvalidPin(); + case INVALID_ZIP: + return visitor.visitInvalidZip(); + case INVALID_EXPIRY: + return visitor.visitInvalidExpiry(); + case BANK_AMOUNT_ERROR: + return visitor.visitBankAmountError(); + case WITHDRAWAL_COUNT_LIMIT_EXCEEDED: + return visitor.visitWithdrawalCountLimitExceeded(); + case MERCHANT_BLACKLIST: + return visitor.visitMerchantBlacklist(); + case BANK_PAYMENT_STOPPED: + return visitor.visitBankPaymentStopped(); + case CONTACT_ISSUER: + return visitor.visitContactIssuer(); + case TEST_MODE_TEST_CARD: + return visitor.visitTestModeTestCard(); + case TRANSACTION_NOT_PERMITTED: + return visitor.visitTransactionNotPermitted(); + case BANK_ACCOUNT_CLOSED: + return visitor.visitBankAccountClosed(); + case TRY_AGAIN_LATER: + return visitor.visitTryAgainLater(); + case BANK_NON_TRANSACTION_ACCOUNT: + return visitor.visitBankNonTransactionAccount(); + case BANK_DUPLICATE: + return visitor.visitBankDuplicate(); + case THREE_D_SECURE_GENERIC_ERROR: + return visitor.visitThreeDSecureGenericError(); + case INVALID_CARD_NUMBER: + return visitor.visitInvalidCardNumber(); + case THREE_D_SECURE_INVALID_CARD_NUMBER: + return visitor.visitThreeDSecureInvalidCardNumber(); + case INVALID_EXPIRY_MONTH: + return visitor.visitInvalidExpiryMonth(); + case CURRENCY_NOT_SUPPORTED: + return visitor.visitCurrencyNotSupported(); + case BLOCKED_BY_CARDHOLDER: + return visitor.visitBlockedByCardholder(); + case CARD_VELOCITY_EXCEEDED: + return visitor.visitCardVelocityExceeded(); + case TRANSACTION_CANCELLED: + return visitor.visitTransactionCancelled(); + case BANK_NOT_AUTHORIZED: + return visitor.visitBankNotAuthorized(); + case INCORRECT_PIN: + return visitor.visitIncorrectPin(); + case BANK_DETAILS_INVALID: + return visitor.visitBankDetailsInvalid(); + case INVALID_TRANSACTION: + return visitor.visitInvalidTransaction(); + case PROVIDER_DECLINED: + return visitor.visitProviderDeclined(); + case THREE_D_SECURE_CARD_NOT_ENROLLED: + return visitor.visitThreeDSecureCardNotEnrolled(); + case BANK_INSUFFICIENT_FUNDS: + return visitor.visitBankInsufficientFunds(); + case TEST_MODE_DECLINE: + return visitor.visitTestModeDecline(); + case THREE_D_SECURE_TOO_MANY_ATTEMPTS: + return visitor.visitThreeDSecureTooManyAttempts(); + case PIN_REQUIRED_AS: + return visitor.visitPinRequiredAs(); + case DUPLICATE_TRANSACTION: + return visitor.visitDuplicateTransaction(); + case BANK_ACCOUNT_HOLDER_DECEASED: + return visitor.visitBankAccountHolderDeceased(); + case BANK_REGULATORY_BLOCKED: + return visitor.visitBankRegulatoryBlocked(); + case SEPA_REFUSED_BY_CUSTOMER: + return visitor.visitSepaRefusedByCustomer(); + case PIN_TRY_EXCEEDED: + return visitor.visitPinTryExceeded(); + case BANK_INVALID_ROUTING_NUMBER: + return visitor.visitBankInvalidRoutingNumber(); + case BANK_ACCOUNT_NOT_FOUND: + return visitor.visitBankAccountNotFound(); + case INSUFFICIENT_FUNDS: + return visitor.visitInsufficientFunds(); + case INVALID_CARD_HOLDER_NAME: + return visitor.visitInvalidCardHolderName(); + case SEPA_INVALID_IBAN: + return visitor.visitSepaInvalidIban(); + case REGULATORY_BLOCKED: + return visitor.visitRegulatoryBlocked(); + case INVALID_EXPIRY_YEAR: + return visitor.visitInvalidExpiryYear(); + case THREE_D_SECURE_FRAUD: + return visitor.visitThreeDSecureFraud(); + case THREE_D_SECURE_REJECTED_BY_BANK: + return visitor.visitThreeDSecureRejectedByBank(); + case SEPA_MANDATE_DATA_INVALID: + return visitor.visitSepaMandateDataInvalid(); + case ISSUER_UNAVAILABLE: + return visitor.visitIssuerUnavailable(); + case BANK_GENERIC_DECLINE: + return visitor.visitBankGenericDecline(); + case SEPA_GENERIC_DECLINE: + return visitor.visitSepaGenericDecline(); + case PIN_REQUIRED: + return visitor.visitPinRequired(); + case ISSUER_ERROR: + return visitor.visitIssuerError(); + case INVALID_CVC: + return visitor.visitInvalidCvc(); + case INVALID_COUNTRY: + return visitor.visitInvalidCountry(); + case EXPIRED_CARD: + return visitor.visitExpiredCard(); + case INVALID_AMOUNT: + return visitor.visitInvalidAmount(); + case THREE_D_SECURE_TIMEOUT: + return visitor.visitThreeDSecureTimeout(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PaymentDeclineCodes valueOf(String value) { + switch (value) { + case "processing_error": + return PROCESSING_ERROR; + case "reenter_transaction": + return REENTER_TRANSACTION; + case "invalid_account": + return INVALID_ACCOUNT; + case "three_d_secure_canceled": + return THREE_D_SECURE_CANCELED; + case "transaction_not_allowed": + return TRANSACTION_NOT_ALLOWED; + case "high_risk": + return HIGH_RISK; + case "three_d_secure_success": + return THREE_D_SECURE_SUCCESS; + case "stolen_card": + return STOLEN_CARD; + case "cannot_authorize": + return CANNOT_AUTHORIZE; + case "card_not_supported": + return CARD_NOT_SUPPORTED; + case "no_accounts": + return NO_ACCOUNTS; + case "transaction_stopped": + return TRANSACTION_STOPPED; + case "lost_card": + return LOST_CARD; + case "bank_processing_error": + return BANK_PROCESSING_ERROR; + case "generic_decline": + return GENERIC_DECLINE; + case "card_type_not_supported": + return CARD_TYPE_NOT_SUPPORTED; + case "authentication_required": + return AUTHENTICATION_REQUIRED; + case "bank_declined": + return BANK_DECLINED; + case "restricted_card": + return RESTRICTED_CARD; + case "suspected_fraud": + return SUSPECTED_FRAUD; + case "issuer_not_found": + return ISSUER_NOT_FOUND; + case "bank_authorization_revoked": + return BANK_AUTHORIZATION_REVOKED; + case "sepa_no_mandate": + return SEPA_NO_MANDATE; + case "three_d_secure_failed": + return THREE_D_SECURE_FAILED; + case "bank_account_frozen": + return BANK_ACCOUNT_FROZEN; + case "invalid_cvc_or_expiration": + return INVALID_CVC_OR_EXPIRATION; + case "three_d_secure_reported_lost_or_stolen": + return THREE_D_SECURE_REPORTED_LOST_OR_STOLEN; + case "closed_account": + return CLOSED_ACCOUNT; + case "sepa_disputed": + return SEPA_DISPUTED; + case "invalid_pin": + return INVALID_PIN; + case "invalid_zip": + return INVALID_ZIP; + case "invalid_expiry": + return INVALID_EXPIRY; + case "bank_amount_error": + return BANK_AMOUNT_ERROR; + case "withdrawal_count_limit_exceeded": + return WITHDRAWAL_COUNT_LIMIT_EXCEEDED; + case "merchant_blacklist": + return MERCHANT_BLACKLIST; + case "bank_payment_stopped": + return BANK_PAYMENT_STOPPED; + case "contact_issuer": + return CONTACT_ISSUER; + case "test_mode_test_card": + return TEST_MODE_TEST_CARD; + case "transaction_not_permitted": + return TRANSACTION_NOT_PERMITTED; + case "bank_account_closed": + return BANK_ACCOUNT_CLOSED; + case "try_again_later": + return TRY_AGAIN_LATER; + case "bank_non_transaction_account": + return BANK_NON_TRANSACTION_ACCOUNT; + case "bank_duplicate": + return BANK_DUPLICATE; + case "three_d_secure_generic_error": + return THREE_D_SECURE_GENERIC_ERROR; + case "invalid_card_number": + return INVALID_CARD_NUMBER; + case "three_d_secure_invalid_card_number": + return THREE_D_SECURE_INVALID_CARD_NUMBER; + case "invalid_expiry_month": + return INVALID_EXPIRY_MONTH; + case "currency_not_supported": + return CURRENCY_NOT_SUPPORTED; + case "blocked_by_cardholder": + return BLOCKED_BY_CARDHOLDER; + case "card_velocity_exceeded": + return CARD_VELOCITY_EXCEEDED; + case "transaction_cancelled": + return TRANSACTION_CANCELLED; + case "bank_not_authorized": + return BANK_NOT_AUTHORIZED; + case "incorrect_pin": + return INCORRECT_PIN; + case "bank_details_invalid": + return BANK_DETAILS_INVALID; + case "invalid_transaction": + return INVALID_TRANSACTION; + case "provider_declined": + return PROVIDER_DECLINED; + case "three_d_secure_card_not_enrolled": + return THREE_D_SECURE_CARD_NOT_ENROLLED; + case "bank_insufficient_funds": + return BANK_INSUFFICIENT_FUNDS; + case "test_mode_decline": + return TEST_MODE_DECLINE; + case "three_d_secure_too_many_attempts": + return THREE_D_SECURE_TOO_MANY_ATTEMPTS; + case "pin_required_as": + return PIN_REQUIRED_AS; + case "duplicate_transaction": + return DUPLICATE_TRANSACTION; + case "bank_account_holder_deceased": + return BANK_ACCOUNT_HOLDER_DECEASED; + case "bank_regulatory_blocked": + return BANK_REGULATORY_BLOCKED; + case "sepa_refused_by_customer": + return SEPA_REFUSED_BY_CUSTOMER; + case "pin_try_exceeded": + return PIN_TRY_EXCEEDED; + case "bank_invalid_routing_number": + return BANK_INVALID_ROUTING_NUMBER; + case "bank_account_not_found": + return BANK_ACCOUNT_NOT_FOUND; + case "insufficient_funds": + return INSUFFICIENT_FUNDS; + case "invalid_card_holder_name": + return INVALID_CARD_HOLDER_NAME; + case "sepa_invalid_iban": + return SEPA_INVALID_IBAN; + case "regulatory_blocked": + return REGULATORY_BLOCKED; + case "invalid_expiry_year": + return INVALID_EXPIRY_YEAR; + case "three_d_secure_fraud": + return THREE_D_SECURE_FRAUD; + case "three_d_secure_rejected_by_bank": + return THREE_D_SECURE_REJECTED_BY_BANK; + case "sepa_mandate_data_invalid": + return SEPA_MANDATE_DATA_INVALID; + case "issuer_unavailable": + return ISSUER_UNAVAILABLE; + case "bank_generic_decline": + return BANK_GENERIC_DECLINE; + case "sepa_generic_decline": + return SEPA_GENERIC_DECLINE; + case "pin_required": + return PIN_REQUIRED; + case "issuer_error": + return ISSUER_ERROR; + case "invalid_cvc": + return INVALID_CVC; + case "invalid_country": + return INVALID_COUNTRY; + case "expired_card": + return EXPIRED_CARD; + case "invalid_amount": + return INVALID_AMOUNT; + case "three_d_secure_timeout": + return THREE_D_SECURE_TIMEOUT; + default: + return new PaymentDeclineCodes(Value.UNKNOWN, value); + } + } + + public enum Value { + INSUFFICIENT_FUNDS, + + LOST_CARD, + + STOLEN_CARD, + + EXPIRED_CARD, + + SUSPECTED_FRAUD, + + INVALID_CARD_NUMBER, + + INVALID_CVC, + + INVALID_CVC_OR_EXPIRATION, + + INCORRECT_PIN, + + AUTHENTICATION_REQUIRED, + + CARD_NOT_SUPPORTED, + + CURRENCY_NOT_SUPPORTED, + + DUPLICATE_TRANSACTION, + + GENERIC_DECLINE, + + INVALID_ACCOUNT, + + INVALID_AMOUNT, + + PROCESSING_ERROR, + + RESTRICTED_CARD, + + CARD_VELOCITY_EXCEEDED, + + CONTACT_ISSUER, + + BANK_DECLINED, + + REGULATORY_BLOCKED, + + TRANSACTION_NOT_PERMITTED, + + TRANSACTION_STOPPED, + + CARD_TYPE_NOT_SUPPORTED, + + ISSUER_NOT_FOUND, + + CLOSED_ACCOUNT, + + ISSUER_UNAVAILABLE, + + INVALID_ZIP, + + INVALID_EXPIRY_MONTH, + + INVALID_EXPIRY_YEAR, + + INVALID_EXPIRY, + + INVALID_TRANSACTION, + + CANNOT_AUTHORIZE, + + PIN_REQUIRED, + + PIN_TRY_EXCEEDED, + + PROVIDER_DECLINED, + + HIGH_RISK, + + TEST_MODE_DECLINE, + + MERCHANT_BLACKLIST, + + REENTER_TRANSACTION, + + INVALID_PIN, + + PIN_REQUIRED_AS, + + WITHDRAWAL_COUNT_LIMIT_EXCEEDED, + + INVALID_COUNTRY, + + ISSUER_ERROR, + + INVALID_CARD_HOLDER_NAME, + + NO_ACCOUNTS, + + TRANSACTION_CANCELLED, + + THREE_D_SECURE_SUCCESS, + + THREE_D_SECURE_CANCELED, + + THREE_D_SECURE_INVALID_CARD_NUMBER, + + THREE_D_SECURE_GENERIC_ERROR, + + THREE_D_SECURE_TIMEOUT, + + THREE_D_SECURE_FAILED, + + THREE_D_SECURE_CARD_NOT_ENROLLED, + + THREE_D_SECURE_FRAUD, + + THREE_D_SECURE_TOO_MANY_ATTEMPTS, + + THREE_D_SECURE_REJECTED_BY_BANK, + + THREE_D_SECURE_REPORTED_LOST_OR_STOLEN, + + BLOCKED_BY_CARDHOLDER, + + TEST_MODE_TEST_CARD, + + TRY_AGAIN_LATER, + + TRANSACTION_NOT_ALLOWED, + + BANK_INSUFFICIENT_FUNDS, + + BANK_ACCOUNT_NOT_FOUND, + + BANK_ACCOUNT_CLOSED, + + BANK_ACCOUNT_FROZEN, + + BANK_INVALID_ROUTING_NUMBER, + + BANK_NON_TRANSACTION_ACCOUNT, + + BANK_AUTHORIZATION_REVOKED, + + BANK_PAYMENT_STOPPED, + + BANK_NOT_AUTHORIZED, + + BANK_ACCOUNT_HOLDER_DECEASED, + + BANK_DUPLICATE, + + BANK_AMOUNT_ERROR, + + BANK_REGULATORY_BLOCKED, + + BANK_DETAILS_INVALID, + + BANK_PROCESSING_ERROR, + + BANK_GENERIC_DECLINE, + + SEPA_INVALID_IBAN, + + SEPA_NO_MANDATE, + + SEPA_MANDATE_DATA_INVALID, + + SEPA_DISPUTED, + + SEPA_REFUSED_BY_CUSTOMER, + + SEPA_GENERIC_DECLINE, + + UNKNOWN + } + + public interface Visitor { + T visitInsufficientFunds(); + + T visitLostCard(); + + T visitStolenCard(); + + T visitExpiredCard(); + + T visitSuspectedFraud(); + + T visitInvalidCardNumber(); + + T visitInvalidCvc(); + + T visitInvalidCvcOrExpiration(); + + T visitIncorrectPin(); + + T visitAuthenticationRequired(); + + T visitCardNotSupported(); + + T visitCurrencyNotSupported(); + + T visitDuplicateTransaction(); + + T visitGenericDecline(); + + T visitInvalidAccount(); + + T visitInvalidAmount(); + + T visitProcessingError(); + + T visitRestrictedCard(); + + T visitCardVelocityExceeded(); + + T visitContactIssuer(); + + T visitBankDeclined(); + + T visitRegulatoryBlocked(); + + T visitTransactionNotPermitted(); + + T visitTransactionStopped(); + + T visitCardTypeNotSupported(); + + T visitIssuerNotFound(); + + T visitClosedAccount(); + + T visitIssuerUnavailable(); + + T visitInvalidZip(); + + T visitInvalidExpiryMonth(); + + T visitInvalidExpiryYear(); + + T visitInvalidExpiry(); + + T visitInvalidTransaction(); + + T visitCannotAuthorize(); + + T visitPinRequired(); + + T visitPinTryExceeded(); + + T visitProviderDeclined(); + + T visitHighRisk(); + + T visitTestModeDecline(); + + T visitMerchantBlacklist(); + + T visitReenterTransaction(); + + T visitInvalidPin(); + + T visitPinRequiredAs(); + + T visitWithdrawalCountLimitExceeded(); + + T visitInvalidCountry(); + + T visitIssuerError(); + + T visitInvalidCardHolderName(); + + T visitNoAccounts(); + + T visitTransactionCancelled(); + + T visitThreeDSecureSuccess(); + + T visitThreeDSecureCanceled(); + + T visitThreeDSecureInvalidCardNumber(); + + T visitThreeDSecureGenericError(); + + T visitThreeDSecureTimeout(); + + T visitThreeDSecureFailed(); + + T visitThreeDSecureCardNotEnrolled(); + + T visitThreeDSecureFraud(); + + T visitThreeDSecureTooManyAttempts(); + + T visitThreeDSecureRejectedByBank(); + + T visitThreeDSecureReportedLostOrStolen(); + + T visitBlockedByCardholder(); + + T visitTestModeTestCard(); + + T visitTryAgainLater(); + + T visitTransactionNotAllowed(); + + T visitBankInsufficientFunds(); + + T visitBankAccountNotFound(); + + T visitBankAccountClosed(); + + T visitBankAccountFrozen(); + + T visitBankInvalidRoutingNumber(); + + T visitBankNonTransactionAccount(); + + T visitBankAuthorizationRevoked(); + + T visitBankPaymentStopped(); + + T visitBankNotAuthorized(); + + T visitBankAccountHolderDeceased(); + + T visitBankDuplicate(); + + T visitBankAmountError(); + + T visitBankRegulatoryBlocked(); + + T visitBankDetailsInvalid(); + + T visitBankProcessingError(); + + T visitBankGenericDecline(); + + T visitSepaInvalidIban(); + + T visitSepaNoMandate(); + + T visitSepaMandateDataInvalid(); + + T visitSepaDisputed(); + + T visitSepaRefusedByCustomer(); + + T visitSepaGenericDecline(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PaymentDisputesItem.java b/src/main/java/com/whop/api/types/PaymentDisputesItem.java new file mode 100644 index 00000000..1791f254 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentDisputesItem.java @@ -0,0 +1,531 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentDisputesItem.Builder.class) +public final class PaymentDisputesItem { + private final double amount; + + private final Currencies currency; + + private final Optional editable; + + private final String id; + + private final Optional needsResponseBy; + + private final Optional notes; + + private final Optional reason; + + private final DisputeStatuses status; + + private final Map additionalProperties; + + private PaymentDisputesItem( + double amount, + Currencies currency, + Optional editable, + String id, + Optional needsResponseBy, + Optional notes, + Optional reason, + DisputeStatuses status, + Map additionalProperties) { + this.amount = amount; + this.currency = currency; + this.editable = editable; + this.id = id; + this.needsResponseBy = needsResponseBy; + this.notes = notes; + this.reason = reason; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The disputed amount in the specified currency, formatted as a decimal. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The three-letter ISO currency code for the disputed amount. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return Whether the dispute evidence can still be edited and submitted. + */ + @JsonIgnore + public Optional getEditable() { + if (editable == null) { + return Optional.empty(); + } + return editable; + } + + /** + * @return The unique identifier for the dispute. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The deadline by which dispute evidence must be submitted. Null if no response deadline is set. + */ + @JsonIgnore + public Optional getNeedsResponseBy() { + if (needsResponseBy == null) { + return Optional.empty(); + } + return needsResponseBy; + } + + /** + * @return Additional freeform notes submitted by the company as part of the dispute evidence. + */ + @JsonIgnore + public Optional getNotes() { + if (notes == null) { + return Optional.empty(); + } + return notes; + } + + /** + * @return A human-readable reason for the dispute. + */ + @JsonIgnore + public Optional getReason() { + if (reason == null) { + return Optional.empty(); + } + return reason; + } + + /** + * @return The current status of the dispute lifecycle, such as needs_response, under_review, won, or lost. + */ + @JsonProperty("status") + public DisputeStatuses getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("editable") + private Optional _getEditable() { + return editable; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("needs_response_by") + private Optional _getNeedsResponseBy() { + return needsResponseBy; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("notes") + private Optional _getNotes() { + return notes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reason") + private Optional _getReason() { + return reason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentDisputesItem && equalTo((PaymentDisputesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentDisputesItem other) { + return amount == other.amount + && currency.equals(other.currency) + && editable.equals(other.editable) + && id.equals(other.id) + && needsResponseBy.equals(other.needsResponseBy) + && notes.equals(other.notes) + && reason.equals(other.reason) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.currency, + this.editable, + this.id, + this.needsResponseBy, + this.notes, + this.reason, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The disputed amount in the specified currency, formatted as a decimal.

+ */ + CurrencyStage amount(double amount); + + Builder from(PaymentDisputesItem other); + } + + public interface CurrencyStage { + /** + *

The three-letter ISO currency code for the disputed amount.

+ */ + IdStage currency(@NotNull Currencies currency); + } + + public interface IdStage { + /** + *

The unique identifier for the dispute.

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

The current status of the dispute lifecycle, such as needs_response, under_review, won, or lost.

+ */ + _FinalStage status(@NotNull DisputeStatuses status); + } + + public interface _FinalStage { + PaymentDisputesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Whether the dispute evidence can still be edited and submitted.

+ */ + _FinalStage editable(Optional editable); + + _FinalStage editable(Boolean editable); + + _FinalStage editable(Nullable editable); + + /** + *

The deadline by which dispute evidence must be submitted. Null if no response deadline is set.

+ */ + _FinalStage needsResponseBy(Optional needsResponseBy); + + _FinalStage needsResponseBy(OffsetDateTime needsResponseBy); + + _FinalStage needsResponseBy(Nullable needsResponseBy); + + /** + *

Additional freeform notes submitted by the company as part of the dispute evidence.

+ */ + _FinalStage notes(Optional notes); + + _FinalStage notes(String notes); + + _FinalStage notes(Nullable notes); + + /** + *

A human-readable reason for the dispute.

+ */ + _FinalStage reason(Optional reason); + + _FinalStage reason(String reason); + + _FinalStage reason(Nullable reason); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, CurrencyStage, IdStage, StatusStage, _FinalStage { + private double amount; + + private Currencies currency; + + private String id; + + private DisputeStatuses status; + + private Optional reason = Optional.empty(); + + private Optional notes = Optional.empty(); + + private Optional needsResponseBy = Optional.empty(); + + private Optional editable = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentDisputesItem other) { + amount(other.getAmount()); + currency(other.getCurrency()); + editable(other.getEditable()); + id(other.getId()); + needsResponseBy(other.getNeedsResponseBy()); + notes(other.getNotes()); + reason(other.getReason()); + status(other.getStatus()); + return this; + } + + /** + *

The disputed amount in the specified currency, formatted as a decimal.

+ *

The disputed amount in the specified currency, formatted as a decimal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CurrencyStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The three-letter ISO currency code for the disputed amount.

+ *

The three-letter ISO currency code for the disputed amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier for the dispute.

+ *

The unique identifier for the dispute.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current status of the dispute lifecycle, such as needs_response, under_review, won, or lost.

+ *

The current status of the dispute lifecycle, such as needs_response, under_review, won, or lost.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull DisputeStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

A human-readable reason for the dispute.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reason(Nullable reason) { + if (reason.isNull()) { + this.reason = null; + } else if (reason.isEmpty()) { + this.reason = Optional.empty(); + } else { + this.reason = Optional.of(reason.get()); + } + return this; + } + + /** + *

A human-readable reason for the dispute.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reason(String reason) { + this.reason = Optional.ofNullable(reason); + return this; + } + + /** + *

A human-readable reason for the dispute.

+ */ + @java.lang.Override + @JsonSetter(value = "reason", nulls = Nulls.SKIP) + public _FinalStage reason(Optional reason) { + this.reason = reason; + return this; + } + + /** + *

Additional freeform notes submitted by the company as part of the dispute evidence.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(Nullable notes) { + if (notes.isNull()) { + this.notes = null; + } else if (notes.isEmpty()) { + this.notes = Optional.empty(); + } else { + this.notes = Optional.of(notes.get()); + } + return this; + } + + /** + *

Additional freeform notes submitted by the company as part of the dispute evidence.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notes(String notes) { + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + *

Additional freeform notes submitted by the company as part of the dispute evidence.

+ */ + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(Optional notes) { + this.notes = notes; + return this; + } + + /** + *

The deadline by which dispute evidence must be submitted. Null if no response deadline is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage needsResponseBy(Nullable needsResponseBy) { + if (needsResponseBy.isNull()) { + this.needsResponseBy = null; + } else if (needsResponseBy.isEmpty()) { + this.needsResponseBy = Optional.empty(); + } else { + this.needsResponseBy = Optional.of(needsResponseBy.get()); + } + return this; + } + + /** + *

The deadline by which dispute evidence must be submitted. Null if no response deadline is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage needsResponseBy(OffsetDateTime needsResponseBy) { + this.needsResponseBy = Optional.ofNullable(needsResponseBy); + return this; + } + + /** + *

The deadline by which dispute evidence must be submitted. Null if no response deadline is set.

+ */ + @java.lang.Override + @JsonSetter(value = "needs_response_by", nulls = Nulls.SKIP) + public _FinalStage needsResponseBy(Optional needsResponseBy) { + this.needsResponseBy = needsResponseBy; + return this; + } + + /** + *

Whether the dispute evidence can still be edited and submitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage editable(Nullable editable) { + if (editable.isNull()) { + this.editable = null; + } else if (editable.isEmpty()) { + this.editable = Optional.empty(); + } else { + this.editable = Optional.of(editable.get()); + } + return this; + } + + /** + *

Whether the dispute evidence can still be edited and submitted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage editable(Boolean editable) { + this.editable = Optional.ofNullable(editable); + return this; + } + + /** + *

Whether the dispute evidence can still be edited and submitted.

+ */ + @java.lang.Override + @JsonSetter(value = "editable", nulls = Nulls.SKIP) + public _FinalStage editable(Optional editable) { + this.editable = editable; + return this; + } + + @java.lang.Override + public PaymentDisputesItem build() { + return new PaymentDisputesItem( + amount, currency, editable, id, needsResponseBy, notes, reason, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentFinancingTransactionsItem.java b/src/main/java/com/whop/api/types/PaymentFinancingTransactionsItem.java new file mode 100644 index 00000000..64a72252 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentFinancingTransactionsItem.java @@ -0,0 +1,274 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentFinancingTransactionsItem.Builder.class) +public final class PaymentFinancingTransactionsItem { + private final double amount; + + private final OffsetDateTime createdAt; + + private final String id; + + private final PaymentTransactionStatuses status; + + private final PaymentTransactionTypes transactionType; + + private final Map additionalProperties; + + private PaymentFinancingTransactionsItem( + double amount, + OffsetDateTime createdAt, + String id, + PaymentTransactionStatuses status, + PaymentTransactionTypes transactionType, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.id = id; + this.status = status; + this.transactionType = transactionType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The amount of the payment transaction. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The date and time the payment transaction was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the payment transaction. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The status of the payment transaction. + */ + @JsonProperty("status") + public PaymentTransactionStatuses getStatus() { + return status; + } + + /** + * @return The type of the payment transaction. + */ + @JsonProperty("transaction_type") + public PaymentTransactionTypes getTransactionType() { + return transactionType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentFinancingTransactionsItem && equalTo((PaymentFinancingTransactionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentFinancingTransactionsItem other) { + return amount == other.amount + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && status.equals(other.status) + && transactionType.equals(other.transactionType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.createdAt, this.id, this.status, this.transactionType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The amount of the payment transaction.

+ */ + CreatedAtStage amount(double amount); + + Builder from(PaymentFinancingTransactionsItem other); + } + + public interface CreatedAtStage { + /** + *

The date and time the payment transaction was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the payment transaction.

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

The status of the payment transaction.

+ */ + TransactionTypeStage status(@NotNull PaymentTransactionStatuses status); + } + + public interface TransactionTypeStage { + /** + *

The type of the payment transaction.

+ */ + _FinalStage transactionType(@NotNull PaymentTransactionTypes transactionType); + } + + public interface _FinalStage { + PaymentFinancingTransactionsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, CreatedAtStage, IdStage, StatusStage, TransactionTypeStage, _FinalStage { + private double amount; + + private OffsetDateTime createdAt; + + private String id; + + private PaymentTransactionStatuses status; + + private PaymentTransactionTypes transactionType; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentFinancingTransactionsItem other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + id(other.getId()); + status(other.getStatus()); + transactionType(other.getTransactionType()); + return this; + } + + /** + *

The amount of the payment transaction.

+ *

The amount of the payment transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The date and time the payment transaction was created.

+ *

The date and time the payment transaction was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the payment transaction.

+ *

The unique identifier for the payment transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The status of the payment transaction.

+ *

The status of the payment transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TransactionTypeStage status(@NotNull PaymentTransactionStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The type of the payment transaction.

+ *

The type of the payment transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("transaction_type") + public _FinalStage transactionType(@NotNull PaymentTransactionTypes transactionType) { + this.transactionType = Objects.requireNonNull(transactionType, "transactionType must not be null"); + return this; + } + + @java.lang.Override + public PaymentFinancingTransactionsItem build() { + return new PaymentFinancingTransactionsItem( + amount, createdAt, id, status, transactionType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentInstructions.java b/src/main/java/com/whop/api/types/PaymentInstructions.java new file mode 100644 index 00000000..77f50895 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentInstructions.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class PaymentInstructions { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PaymentInstructions(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PaymentInstructions bankTransfer(PaymentBankTransferInstructions value) { + return new PaymentInstructions(new BankTransferValue(value)); + } + + public static PaymentInstructions qr(PaymentQrInstructions value) { + return new PaymentInstructions(new QrValue(value)); + } + + public static PaymentInstructions voucher(PaymentVoucherInstructions value) { + return new PaymentInstructions(new VoucherValue(value)); + } + + public boolean isBankTransfer() { + return value instanceof BankTransferValue; + } + + public boolean isQr() { + return value instanceof QrValue; + } + + public boolean isVoucher() { + return value instanceof VoucherValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getBankTransfer() { + if (isBankTransfer()) { + return Optional.of(((BankTransferValue) value).value); + } + return Optional.empty(); + } + + public Optional getQr() { + if (isQr()) { + return Optional.of(((QrValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoucher() { + if (isVoucher()) { + return Optional.of(((VoucherValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentInstructions && value.equals(((PaymentInstructions) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitBankTransfer(PaymentBankTransferInstructions bankTransfer); + + T visitQr(PaymentQrInstructions qr); + + T visitVoucher(PaymentVoucherInstructions voucher); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "kind", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(BankTransferValue.class), + @JsonSubTypes.Type(QrValue.class), + @JsonSubTypes.Type(VoucherValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("bank_transfer") + @JsonIgnoreProperties("kind") + private static final class BankTransferValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "kind", allowSetters = true) + private PaymentBankTransferInstructions value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BankTransferValue() {} + + private BankTransferValue(PaymentBankTransferInstructions value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBankTransfer(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BankTransferValue && equalTo((BankTransferValue) other); + } + + private boolean equalTo(BankTransferValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentInstructions{" + "value: " + value + "}"; + } + } + + @JsonTypeName("qr") + @JsonIgnoreProperties("kind") + private static final class QrValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "kind", allowSetters = true) + private PaymentQrInstructions value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private QrValue() {} + + private QrValue(PaymentQrInstructions value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitQr(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof QrValue && equalTo((QrValue) other); + } + + private boolean equalTo(QrValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentInstructions{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voucher") + @JsonIgnoreProperties("kind") + private static final class VoucherValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "kind", allowSetters = true) + private PaymentVoucherInstructions value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoucherValue() {} + + private VoucherValue(PaymentVoucherInstructions value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoucher(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoucherValue && equalTo((VoucherValue) other); + } + + private boolean equalTo(VoucherValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentInstructions{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("kind") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentInstructions{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentInstrument.java b/src/main/java/com/whop/api/types/PaymentInstrument.java new file mode 100644 index 00000000..8f9977d3 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentInstrument.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentInstrument.Builder.class) +public final class PaymentInstrument { + private final Optional card; + + private final String displayName; + + private final PaymentMethodIcons icons; + + private final Optional installmentCount; + + private final String paymentMethodType; + + private final Map additionalProperties; + + private PaymentInstrument( + Optional card, + String displayName, + PaymentMethodIcons icons, + Optional installmentCount, + String paymentMethodType, + Map additionalProperties) { + this.card = card; + this.displayName = displayName; + this.icons = icons; + this.installmentCount = installmentCount; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return Card payments only: the card's network and last four. + */ + @JsonIgnore + public Optional getCard() { + if (card == null) { + return Optional.empty(); + } + return card; + } + + /** + * @return Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna"). + */ + @JsonProperty("display_name") + public String getDisplayName() { + return displayName; + } + + /** + * @return The standard icon set: square and card shapes, each in light and dark colorways. + */ + @JsonProperty("icons") + public PaymentMethodIcons getIcons() { + return icons; + } + + /** + * @return Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side. + */ + @JsonIgnore + public Optional getInstallmentCount() { + if (installmentCount == null) { + return Optional.empty(); + } + return installmentCount; + } + + /** + * @return The payment method type identifier, e.g. card, klarna, apple_pay. + */ + @JsonProperty("payment_method_type") + public String getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card") + private Optional _getCard() { + return card; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("installment_count") + private Optional _getInstallmentCount() { + return installmentCount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentInstrument && equalTo((PaymentInstrument) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentInstrument other) { + return card.equals(other.card) + && displayName.equals(other.displayName) + && icons.equals(other.icons) + && installmentCount.equals(other.installmentCount) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.displayName, this.icons, this.installmentCount, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DisplayNameStage builder() { + return new Builder(); + } + + public interface DisplayNameStage { + /** + *

Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna").

+ */ + IconsStage displayName(@NotNull String displayName); + + Builder from(PaymentInstrument other); + } + + public interface IconsStage { + /** + *

The standard icon set: square and card shapes, each in light and dark colorways.

+ */ + PaymentMethodTypeStage icons(@NotNull PaymentMethodIcons icons); + } + + public interface PaymentMethodTypeStage { + /** + *

The payment method type identifier, e.g. card, klarna, apple_pay.

+ */ + _FinalStage paymentMethodType(@NotNull String paymentMethodType); + } + + public interface _FinalStage { + PaymentInstrument build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Card payments only: the card's network and last four.

+ */ + _FinalStage card(Optional card); + + _FinalStage card(PaymentInstrumentCard card); + + _FinalStage card(Nullable card); + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ */ + _FinalStage installmentCount(Optional installmentCount); + + _FinalStage installmentCount(Double installmentCount); + + _FinalStage installmentCount(Nullable installmentCount); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DisplayNameStage, IconsStage, PaymentMethodTypeStage, _FinalStage { + private String displayName; + + private PaymentMethodIcons icons; + + private String paymentMethodType; + + private Optional installmentCount = Optional.empty(); + + private Optional card = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentInstrument other) { + card(other.getCard()); + displayName(other.getDisplayName()); + icons(other.getIcons()); + installmentCount(other.getInstallmentCount()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna").

+ *

Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("display_name") + public IconsStage displayName(@NotNull String displayName) { + this.displayName = Objects.requireNonNull(displayName, "displayName must not be null"); + return this; + } + + /** + *

The standard icon set: square and card shapes, each in light and dark colorways.

+ *

The standard icon set: square and card shapes, each in light and dark colorways.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public PaymentMethodTypeStage icons(@NotNull PaymentMethodIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

The payment method type identifier, e.g. card, klarna, apple_pay.

+ *

The payment method type identifier, e.g. card, klarna, apple_pay.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull String paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage installmentCount(Nullable installmentCount) { + if (installmentCount.isNull()) { + this.installmentCount = null; + } else if (installmentCount.isEmpty()) { + this.installmentCount = Optional.empty(); + } else { + this.installmentCount = Optional.of(installmentCount.get()); + } + return this; + } + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage installmentCount(Double installmentCount) { + this.installmentCount = Optional.ofNullable(installmentCount); + return this; + } + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ */ + @java.lang.Override + @JsonSetter(value = "installment_count", nulls = Nulls.SKIP) + public _FinalStage installmentCount(Optional installmentCount) { + this.installmentCount = installmentCount; + return this; + } + + /** + *

Card payments only: the card's network and last four.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(Nullable card) { + if (card.isNull()) { + this.card = null; + } else if (card.isEmpty()) { + this.card = Optional.empty(); + } else { + this.card = Optional.of(card.get()); + } + return this; + } + + /** + *

Card payments only: the card's network and last four.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(PaymentInstrumentCard card) { + this.card = Optional.ofNullable(card); + return this; + } + + /** + *

Card payments only: the card's network and last four.

+ */ + @java.lang.Override + @JsonSetter(value = "card", nulls = Nulls.SKIP) + public _FinalStage card(Optional card) { + this.card = card; + return this; + } + + @java.lang.Override + public PaymentInstrument build() { + return new PaymentInstrument( + card, displayName, icons, installmentCount, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentInstrumentCard.java b/src/main/java/com/whop/api/types/PaymentInstrumentCard.java new file mode 100644 index 00000000..c2b4adbb --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentInstrumentCard.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentInstrumentCard.Builder.class) +public final class PaymentInstrumentCard { + private final String brand; + + private final Optional last4; + + private final Map additionalProperties; + + private PaymentInstrumentCard(String brand, Optional last4, Map additionalProperties) { + this.brand = brand; + this.last4 = last4; + this.additionalProperties = additionalProperties; + } + + /** + * @return The network identifier (visa, amex, …), matching card.networks entries and saved card payment methods. + */ + @JsonProperty("brand") + public String getBrand() { + return brand; + } + + /** + * @return The card's last four digits, when captured. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentInstrumentCard && equalTo((PaymentInstrumentCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentInstrumentCard other) { + return brand.equals(other.brand) && last4.equals(other.last4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.brand, this.last4); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BrandStage builder() { + return new Builder(); + } + + public interface BrandStage { + /** + *

The network identifier (visa, amex, …), matching card.networks entries and saved card payment methods.

+ */ + _FinalStage brand(@NotNull String brand); + + Builder from(PaymentInstrumentCard other); + } + + public interface _FinalStage { + PaymentInstrumentCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The card's last four digits, when captured.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BrandStage, _FinalStage { + private String brand; + + private Optional last4 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentInstrumentCard other) { + brand(other.getBrand()); + last4(other.getLast4()); + return this; + } + + /** + *

The network identifier (visa, amex, …), matching card.networks entries and saved card payment methods.

+ *

The network identifier (visa, amex, …), matching card.networks entries and saved card payment methods.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("brand") + public _FinalStage brand(@NotNull String brand) { + this.brand = Objects.requireNonNull(brand, "brand must not be null"); + return this; + } + + /** + *

The card's last four digits, when captured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

The card's last four digits, when captured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

The card's last four digits, when captured.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + @java.lang.Override + public PaymentInstrumentCard build() { + return new PaymentInstrumentCard(brand, last4, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentLastPaymentError.java b/src/main/java/com/whop/api/types/PaymentLastPaymentError.java new file mode 100644 index 00000000..a9a64eb6 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentLastPaymentError.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentLastPaymentError.Builder.class) +public final class PaymentLastPaymentError { + private final Optional code; + + private final Optional declineCode; + + private final Optional message; + + private final Map additionalProperties; + + private PaymentLastPaymentError( + Optional code, + Optional declineCode, + Optional message, + Map additionalProperties) { + this.code = code; + this.declineCode = declineCode; + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return A machine-readable classification of the failure. + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + /** + * @return The reason the payment was declined. + */ + @JsonIgnore + public Optional getDeclineCode() { + if (declineCode == null) { + return Optional.empty(); + } + return declineCode; + } + + /** + * @return A human-readable explanation of the failure. + */ + @JsonIgnore + public Optional getMessage() { + if (message == null) { + return Optional.empty(); + } + return message; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("decline_code") + private Optional _getDeclineCode() { + return declineCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("message") + private Optional _getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentLastPaymentError && equalTo((PaymentLastPaymentError) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentLastPaymentError other) { + return code.equals(other.code) && declineCode.equals(other.declineCode) && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.declineCode, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional code = Optional.empty(); + + private Optional declineCode = Optional.empty(); + + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentLastPaymentError other) { + code(other.getCode()); + declineCode(other.getDeclineCode()); + message(other.getMessage()); + return this; + } + + /** + *

A machine-readable classification of the failure.

+ */ + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public Builder code(Optional code) { + this.code = code; + return this; + } + + public Builder code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + public Builder code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

The reason the payment was declined.

+ */ + @JsonSetter(value = "decline_code", nulls = Nulls.SKIP) + public Builder declineCode(Optional declineCode) { + this.declineCode = declineCode; + return this; + } + + public Builder declineCode(PaymentLastPaymentErrorDeclineCode declineCode) { + this.declineCode = Optional.ofNullable(declineCode); + return this; + } + + public Builder declineCode(Nullable declineCode) { + if (declineCode.isNull()) { + this.declineCode = null; + } else if (declineCode.isEmpty()) { + this.declineCode = Optional.empty(); + } else { + this.declineCode = Optional.of(declineCode.get()); + } + return this; + } + + /** + *

A human-readable explanation of the failure.

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public Builder message(Nullable message) { + if (message.isNull()) { + this.message = null; + } else if (message.isEmpty()) { + this.message = Optional.empty(); + } else { + this.message = Optional.of(message.get()); + } + return this; + } + + public PaymentLastPaymentError build() { + return new PaymentLastPaymentError(code, declineCode, message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentLastPaymentErrorDeclineCode.java b/src/main/java/com/whop/api/types/PaymentLastPaymentErrorDeclineCode.java new file mode 100644 index 00000000..860fa838 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentLastPaymentErrorDeclineCode.java @@ -0,0 +1,1016 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PaymentLastPaymentErrorDeclineCode { + public static final PaymentLastPaymentErrorDeclineCode PROCESSING_ERROR = + new PaymentLastPaymentErrorDeclineCode(Value.PROCESSING_ERROR, "processing_error"); + + public static final PaymentLastPaymentErrorDeclineCode REENTER_TRANSACTION = + new PaymentLastPaymentErrorDeclineCode(Value.REENTER_TRANSACTION, "reenter_transaction"); + + public static final PaymentLastPaymentErrorDeclineCode INVALID_ACCOUNT = + new PaymentLastPaymentErrorDeclineCode(Value.INVALID_ACCOUNT, "invalid_account"); + + public static final PaymentLastPaymentErrorDeclineCode THREE_D_SECURE_CANCELED = + new PaymentLastPaymentErrorDeclineCode(Value.THREE_D_SECURE_CANCELED, "three_d_secure_canceled"); + + public static final PaymentLastPaymentErrorDeclineCode TRANSACTION_NOT_ALLOWED = + new PaymentLastPaymentErrorDeclineCode(Value.TRANSACTION_NOT_ALLOWED, "transaction_not_allowed"); + + public static final PaymentLastPaymentErrorDeclineCode HIGH_RISK = + new PaymentLastPaymentErrorDeclineCode(Value.HIGH_RISK, "high_risk"); + + public static final PaymentLastPaymentErrorDeclineCode THREE_D_SECURE_SUCCESS = + new PaymentLastPaymentErrorDeclineCode(Value.THREE_D_SECURE_SUCCESS, "three_d_secure_success"); + + public static final PaymentLastPaymentErrorDeclineCode STOLEN_CARD = + new PaymentLastPaymentErrorDeclineCode(Value.STOLEN_CARD, "stolen_card"); + + public static final PaymentLastPaymentErrorDeclineCode CANNOT_AUTHORIZE = + new PaymentLastPaymentErrorDeclineCode(Value.CANNOT_AUTHORIZE, "cannot_authorize"); + + public static final PaymentLastPaymentErrorDeclineCode CARD_NOT_SUPPORTED = + new PaymentLastPaymentErrorDeclineCode(Value.CARD_NOT_SUPPORTED, "card_not_supported"); + + public static final PaymentLastPaymentErrorDeclineCode NO_ACCOUNTS = + new PaymentLastPaymentErrorDeclineCode(Value.NO_ACCOUNTS, "no_accounts"); + + public static final PaymentLastPaymentErrorDeclineCode TRANSACTION_STOPPED = + new PaymentLastPaymentErrorDeclineCode(Value.TRANSACTION_STOPPED, "transaction_stopped"); + + public static final PaymentLastPaymentErrorDeclineCode LOST_CARD = + new PaymentLastPaymentErrorDeclineCode(Value.LOST_CARD, "lost_card"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_PROCESSING_ERROR = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_PROCESSING_ERROR, "bank_processing_error"); + + public static final PaymentLastPaymentErrorDeclineCode GENERIC_DECLINE = + new PaymentLastPaymentErrorDeclineCode(Value.GENERIC_DECLINE, "generic_decline"); + + public static final PaymentLastPaymentErrorDeclineCode CARD_TYPE_NOT_SUPPORTED = + new PaymentLastPaymentErrorDeclineCode(Value.CARD_TYPE_NOT_SUPPORTED, "card_type_not_supported"); + + public static final PaymentLastPaymentErrorDeclineCode AUTHENTICATION_REQUIRED = + new PaymentLastPaymentErrorDeclineCode(Value.AUTHENTICATION_REQUIRED, "authentication_required"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_DECLINED = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_DECLINED, "bank_declined"); + + public static final PaymentLastPaymentErrorDeclineCode RESTRICTED_CARD = + new PaymentLastPaymentErrorDeclineCode(Value.RESTRICTED_CARD, "restricted_card"); + + public static final PaymentLastPaymentErrorDeclineCode SUSPECTED_FRAUD = + new PaymentLastPaymentErrorDeclineCode(Value.SUSPECTED_FRAUD, "suspected_fraud"); + + public static final PaymentLastPaymentErrorDeclineCode ISSUER_NOT_FOUND = + new PaymentLastPaymentErrorDeclineCode(Value.ISSUER_NOT_FOUND, "issuer_not_found"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_AUTHORIZATION_REVOKED = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_AUTHORIZATION_REVOKED, "bank_authorization_revoked"); + + public static final PaymentLastPaymentErrorDeclineCode SEPA_NO_MANDATE = + new PaymentLastPaymentErrorDeclineCode(Value.SEPA_NO_MANDATE, "sepa_no_mandate"); + + public static final PaymentLastPaymentErrorDeclineCode THREE_D_SECURE_FAILED = + new PaymentLastPaymentErrorDeclineCode(Value.THREE_D_SECURE_FAILED, "three_d_secure_failed"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_ACCOUNT_FROZEN = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_ACCOUNT_FROZEN, "bank_account_frozen"); + + public static final PaymentLastPaymentErrorDeclineCode INVALID_CVC_OR_EXPIRATION = + new PaymentLastPaymentErrorDeclineCode(Value.INVALID_CVC_OR_EXPIRATION, "invalid_cvc_or_expiration"); + + public static final PaymentLastPaymentErrorDeclineCode THREE_D_SECURE_REPORTED_LOST_OR_STOLEN = + new PaymentLastPaymentErrorDeclineCode( + Value.THREE_D_SECURE_REPORTED_LOST_OR_STOLEN, "three_d_secure_reported_lost_or_stolen"); + + public static final PaymentLastPaymentErrorDeclineCode CLOSED_ACCOUNT = + new PaymentLastPaymentErrorDeclineCode(Value.CLOSED_ACCOUNT, "closed_account"); + + public static final PaymentLastPaymentErrorDeclineCode SEPA_DISPUTED = + new PaymentLastPaymentErrorDeclineCode(Value.SEPA_DISPUTED, "sepa_disputed"); + + public static final PaymentLastPaymentErrorDeclineCode INVALID_PIN = + new PaymentLastPaymentErrorDeclineCode(Value.INVALID_PIN, "invalid_pin"); + + public static final PaymentLastPaymentErrorDeclineCode INVALID_ZIP = + new PaymentLastPaymentErrorDeclineCode(Value.INVALID_ZIP, "invalid_zip"); + + public static final PaymentLastPaymentErrorDeclineCode INVALID_EXPIRY = + new PaymentLastPaymentErrorDeclineCode(Value.INVALID_EXPIRY, "invalid_expiry"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_AMOUNT_ERROR = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_AMOUNT_ERROR, "bank_amount_error"); + + public static final PaymentLastPaymentErrorDeclineCode WITHDRAWAL_COUNT_LIMIT_EXCEEDED = + new PaymentLastPaymentErrorDeclineCode( + Value.WITHDRAWAL_COUNT_LIMIT_EXCEEDED, "withdrawal_count_limit_exceeded"); + + public static final PaymentLastPaymentErrorDeclineCode MERCHANT_BLACKLIST = + new PaymentLastPaymentErrorDeclineCode(Value.MERCHANT_BLACKLIST, "merchant_blacklist"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_PAYMENT_STOPPED = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_PAYMENT_STOPPED, "bank_payment_stopped"); + + public static final PaymentLastPaymentErrorDeclineCode CONTACT_ISSUER = + new PaymentLastPaymentErrorDeclineCode(Value.CONTACT_ISSUER, "contact_issuer"); + + public static final PaymentLastPaymentErrorDeclineCode TEST_MODE_TEST_CARD = + new PaymentLastPaymentErrorDeclineCode(Value.TEST_MODE_TEST_CARD, "test_mode_test_card"); + + public static final PaymentLastPaymentErrorDeclineCode TRANSACTION_NOT_PERMITTED = + new PaymentLastPaymentErrorDeclineCode(Value.TRANSACTION_NOT_PERMITTED, "transaction_not_permitted"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_ACCOUNT_CLOSED = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_ACCOUNT_CLOSED, "bank_account_closed"); + + public static final PaymentLastPaymentErrorDeclineCode TRY_AGAIN_LATER = + new PaymentLastPaymentErrorDeclineCode(Value.TRY_AGAIN_LATER, "try_again_later"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_NON_TRANSACTION_ACCOUNT = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_NON_TRANSACTION_ACCOUNT, "bank_non_transaction_account"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_DUPLICATE = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_DUPLICATE, "bank_duplicate"); + + public static final PaymentLastPaymentErrorDeclineCode THREE_D_SECURE_GENERIC_ERROR = + new PaymentLastPaymentErrorDeclineCode(Value.THREE_D_SECURE_GENERIC_ERROR, "three_d_secure_generic_error"); + + public static final PaymentLastPaymentErrorDeclineCode INVALID_CARD_NUMBER = + new PaymentLastPaymentErrorDeclineCode(Value.INVALID_CARD_NUMBER, "invalid_card_number"); + + public static final PaymentLastPaymentErrorDeclineCode THREE_D_SECURE_INVALID_CARD_NUMBER = + new PaymentLastPaymentErrorDeclineCode( + Value.THREE_D_SECURE_INVALID_CARD_NUMBER, "three_d_secure_invalid_card_number"); + + public static final PaymentLastPaymentErrorDeclineCode INVALID_EXPIRY_MONTH = + new PaymentLastPaymentErrorDeclineCode(Value.INVALID_EXPIRY_MONTH, "invalid_expiry_month"); + + public static final PaymentLastPaymentErrorDeclineCode CURRENCY_NOT_SUPPORTED = + new PaymentLastPaymentErrorDeclineCode(Value.CURRENCY_NOT_SUPPORTED, "currency_not_supported"); + + public static final PaymentLastPaymentErrorDeclineCode BLOCKED_BY_CARDHOLDER = + new PaymentLastPaymentErrorDeclineCode(Value.BLOCKED_BY_CARDHOLDER, "blocked_by_cardholder"); + + public static final PaymentLastPaymentErrorDeclineCode CARD_VELOCITY_EXCEEDED = + new PaymentLastPaymentErrorDeclineCode(Value.CARD_VELOCITY_EXCEEDED, "card_velocity_exceeded"); + + public static final PaymentLastPaymentErrorDeclineCode TRANSACTION_CANCELLED = + new PaymentLastPaymentErrorDeclineCode(Value.TRANSACTION_CANCELLED, "transaction_cancelled"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_NOT_AUTHORIZED = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_NOT_AUTHORIZED, "bank_not_authorized"); + + public static final PaymentLastPaymentErrorDeclineCode INCORRECT_PIN = + new PaymentLastPaymentErrorDeclineCode(Value.INCORRECT_PIN, "incorrect_pin"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_DETAILS_INVALID = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_DETAILS_INVALID, "bank_details_invalid"); + + public static final PaymentLastPaymentErrorDeclineCode INVALID_TRANSACTION = + new PaymentLastPaymentErrorDeclineCode(Value.INVALID_TRANSACTION, "invalid_transaction"); + + public static final PaymentLastPaymentErrorDeclineCode PROVIDER_DECLINED = + new PaymentLastPaymentErrorDeclineCode(Value.PROVIDER_DECLINED, "provider_declined"); + + public static final PaymentLastPaymentErrorDeclineCode THREE_D_SECURE_CARD_NOT_ENROLLED = + new PaymentLastPaymentErrorDeclineCode( + Value.THREE_D_SECURE_CARD_NOT_ENROLLED, "three_d_secure_card_not_enrolled"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_INSUFFICIENT_FUNDS = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_INSUFFICIENT_FUNDS, "bank_insufficient_funds"); + + public static final PaymentLastPaymentErrorDeclineCode TEST_MODE_DECLINE = + new PaymentLastPaymentErrorDeclineCode(Value.TEST_MODE_DECLINE, "test_mode_decline"); + + public static final PaymentLastPaymentErrorDeclineCode THREE_D_SECURE_TOO_MANY_ATTEMPTS = + new PaymentLastPaymentErrorDeclineCode( + Value.THREE_D_SECURE_TOO_MANY_ATTEMPTS, "three_d_secure_too_many_attempts"); + + public static final PaymentLastPaymentErrorDeclineCode PIN_REQUIRED_AS = + new PaymentLastPaymentErrorDeclineCode(Value.PIN_REQUIRED_AS, "pin_required_as"); + + public static final PaymentLastPaymentErrorDeclineCode DUPLICATE_TRANSACTION = + new PaymentLastPaymentErrorDeclineCode(Value.DUPLICATE_TRANSACTION, "duplicate_transaction"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_ACCOUNT_HOLDER_DECEASED = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_ACCOUNT_HOLDER_DECEASED, "bank_account_holder_deceased"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_REGULATORY_BLOCKED = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_REGULATORY_BLOCKED, "bank_regulatory_blocked"); + + public static final PaymentLastPaymentErrorDeclineCode SEPA_REFUSED_BY_CUSTOMER = + new PaymentLastPaymentErrorDeclineCode(Value.SEPA_REFUSED_BY_CUSTOMER, "sepa_refused_by_customer"); + + public static final PaymentLastPaymentErrorDeclineCode PIN_TRY_EXCEEDED = + new PaymentLastPaymentErrorDeclineCode(Value.PIN_TRY_EXCEEDED, "pin_try_exceeded"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_INVALID_ROUTING_NUMBER = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_INVALID_ROUTING_NUMBER, "bank_invalid_routing_number"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_ACCOUNT_NOT_FOUND = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_ACCOUNT_NOT_FOUND, "bank_account_not_found"); + + public static final PaymentLastPaymentErrorDeclineCode INSUFFICIENT_FUNDS = + new PaymentLastPaymentErrorDeclineCode(Value.INSUFFICIENT_FUNDS, "insufficient_funds"); + + public static final PaymentLastPaymentErrorDeclineCode INVALID_CARD_HOLDER_NAME = + new PaymentLastPaymentErrorDeclineCode(Value.INVALID_CARD_HOLDER_NAME, "invalid_card_holder_name"); + + public static final PaymentLastPaymentErrorDeclineCode SEPA_INVALID_IBAN = + new PaymentLastPaymentErrorDeclineCode(Value.SEPA_INVALID_IBAN, "sepa_invalid_iban"); + + public static final PaymentLastPaymentErrorDeclineCode REGULATORY_BLOCKED = + new PaymentLastPaymentErrorDeclineCode(Value.REGULATORY_BLOCKED, "regulatory_blocked"); + + public static final PaymentLastPaymentErrorDeclineCode INVALID_EXPIRY_YEAR = + new PaymentLastPaymentErrorDeclineCode(Value.INVALID_EXPIRY_YEAR, "invalid_expiry_year"); + + public static final PaymentLastPaymentErrorDeclineCode THREE_D_SECURE_FRAUD = + new PaymentLastPaymentErrorDeclineCode(Value.THREE_D_SECURE_FRAUD, "three_d_secure_fraud"); + + public static final PaymentLastPaymentErrorDeclineCode THREE_D_SECURE_REJECTED_BY_BANK = + new PaymentLastPaymentErrorDeclineCode( + Value.THREE_D_SECURE_REJECTED_BY_BANK, "three_d_secure_rejected_by_bank"); + + public static final PaymentLastPaymentErrorDeclineCode SEPA_MANDATE_DATA_INVALID = + new PaymentLastPaymentErrorDeclineCode(Value.SEPA_MANDATE_DATA_INVALID, "sepa_mandate_data_invalid"); + + public static final PaymentLastPaymentErrorDeclineCode ISSUER_UNAVAILABLE = + new PaymentLastPaymentErrorDeclineCode(Value.ISSUER_UNAVAILABLE, "issuer_unavailable"); + + public static final PaymentLastPaymentErrorDeclineCode BANK_GENERIC_DECLINE = + new PaymentLastPaymentErrorDeclineCode(Value.BANK_GENERIC_DECLINE, "bank_generic_decline"); + + public static final PaymentLastPaymentErrorDeclineCode SEPA_GENERIC_DECLINE = + new PaymentLastPaymentErrorDeclineCode(Value.SEPA_GENERIC_DECLINE, "sepa_generic_decline"); + + public static final PaymentLastPaymentErrorDeclineCode PIN_REQUIRED = + new PaymentLastPaymentErrorDeclineCode(Value.PIN_REQUIRED, "pin_required"); + + public static final PaymentLastPaymentErrorDeclineCode ISSUER_ERROR = + new PaymentLastPaymentErrorDeclineCode(Value.ISSUER_ERROR, "issuer_error"); + + public static final PaymentLastPaymentErrorDeclineCode INVALID_CVC = + new PaymentLastPaymentErrorDeclineCode(Value.INVALID_CVC, "invalid_cvc"); + + public static final PaymentLastPaymentErrorDeclineCode INVALID_COUNTRY = + new PaymentLastPaymentErrorDeclineCode(Value.INVALID_COUNTRY, "invalid_country"); + + public static final PaymentLastPaymentErrorDeclineCode EXPIRED_CARD = + new PaymentLastPaymentErrorDeclineCode(Value.EXPIRED_CARD, "expired_card"); + + public static final PaymentLastPaymentErrorDeclineCode INVALID_AMOUNT = + new PaymentLastPaymentErrorDeclineCode(Value.INVALID_AMOUNT, "invalid_amount"); + + public static final PaymentLastPaymentErrorDeclineCode THREE_D_SECURE_TIMEOUT = + new PaymentLastPaymentErrorDeclineCode(Value.THREE_D_SECURE_TIMEOUT, "three_d_secure_timeout"); + + private final Value value; + + private final String string; + + PaymentLastPaymentErrorDeclineCode(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PaymentLastPaymentErrorDeclineCode + && this.string.equals(((PaymentLastPaymentErrorDeclineCode) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PROCESSING_ERROR: + return visitor.visitProcessingError(); + case REENTER_TRANSACTION: + return visitor.visitReenterTransaction(); + case INVALID_ACCOUNT: + return visitor.visitInvalidAccount(); + case THREE_D_SECURE_CANCELED: + return visitor.visitThreeDSecureCanceled(); + case TRANSACTION_NOT_ALLOWED: + return visitor.visitTransactionNotAllowed(); + case HIGH_RISK: + return visitor.visitHighRisk(); + case THREE_D_SECURE_SUCCESS: + return visitor.visitThreeDSecureSuccess(); + case STOLEN_CARD: + return visitor.visitStolenCard(); + case CANNOT_AUTHORIZE: + return visitor.visitCannotAuthorize(); + case CARD_NOT_SUPPORTED: + return visitor.visitCardNotSupported(); + case NO_ACCOUNTS: + return visitor.visitNoAccounts(); + case TRANSACTION_STOPPED: + return visitor.visitTransactionStopped(); + case LOST_CARD: + return visitor.visitLostCard(); + case BANK_PROCESSING_ERROR: + return visitor.visitBankProcessingError(); + case GENERIC_DECLINE: + return visitor.visitGenericDecline(); + case CARD_TYPE_NOT_SUPPORTED: + return visitor.visitCardTypeNotSupported(); + case AUTHENTICATION_REQUIRED: + return visitor.visitAuthenticationRequired(); + case BANK_DECLINED: + return visitor.visitBankDeclined(); + case RESTRICTED_CARD: + return visitor.visitRestrictedCard(); + case SUSPECTED_FRAUD: + return visitor.visitSuspectedFraud(); + case ISSUER_NOT_FOUND: + return visitor.visitIssuerNotFound(); + case BANK_AUTHORIZATION_REVOKED: + return visitor.visitBankAuthorizationRevoked(); + case SEPA_NO_MANDATE: + return visitor.visitSepaNoMandate(); + case THREE_D_SECURE_FAILED: + return visitor.visitThreeDSecureFailed(); + case BANK_ACCOUNT_FROZEN: + return visitor.visitBankAccountFrozen(); + case INVALID_CVC_OR_EXPIRATION: + return visitor.visitInvalidCvcOrExpiration(); + case THREE_D_SECURE_REPORTED_LOST_OR_STOLEN: + return visitor.visitThreeDSecureReportedLostOrStolen(); + case CLOSED_ACCOUNT: + return visitor.visitClosedAccount(); + case SEPA_DISPUTED: + return visitor.visitSepaDisputed(); + case INVALID_PIN: + return visitor.visitInvalidPin(); + case INVALID_ZIP: + return visitor.visitInvalidZip(); + case INVALID_EXPIRY: + return visitor.visitInvalidExpiry(); + case BANK_AMOUNT_ERROR: + return visitor.visitBankAmountError(); + case WITHDRAWAL_COUNT_LIMIT_EXCEEDED: + return visitor.visitWithdrawalCountLimitExceeded(); + case MERCHANT_BLACKLIST: + return visitor.visitMerchantBlacklist(); + case BANK_PAYMENT_STOPPED: + return visitor.visitBankPaymentStopped(); + case CONTACT_ISSUER: + return visitor.visitContactIssuer(); + case TEST_MODE_TEST_CARD: + return visitor.visitTestModeTestCard(); + case TRANSACTION_NOT_PERMITTED: + return visitor.visitTransactionNotPermitted(); + case BANK_ACCOUNT_CLOSED: + return visitor.visitBankAccountClosed(); + case TRY_AGAIN_LATER: + return visitor.visitTryAgainLater(); + case BANK_NON_TRANSACTION_ACCOUNT: + return visitor.visitBankNonTransactionAccount(); + case BANK_DUPLICATE: + return visitor.visitBankDuplicate(); + case THREE_D_SECURE_GENERIC_ERROR: + return visitor.visitThreeDSecureGenericError(); + case INVALID_CARD_NUMBER: + return visitor.visitInvalidCardNumber(); + case THREE_D_SECURE_INVALID_CARD_NUMBER: + return visitor.visitThreeDSecureInvalidCardNumber(); + case INVALID_EXPIRY_MONTH: + return visitor.visitInvalidExpiryMonth(); + case CURRENCY_NOT_SUPPORTED: + return visitor.visitCurrencyNotSupported(); + case BLOCKED_BY_CARDHOLDER: + return visitor.visitBlockedByCardholder(); + case CARD_VELOCITY_EXCEEDED: + return visitor.visitCardVelocityExceeded(); + case TRANSACTION_CANCELLED: + return visitor.visitTransactionCancelled(); + case BANK_NOT_AUTHORIZED: + return visitor.visitBankNotAuthorized(); + case INCORRECT_PIN: + return visitor.visitIncorrectPin(); + case BANK_DETAILS_INVALID: + return visitor.visitBankDetailsInvalid(); + case INVALID_TRANSACTION: + return visitor.visitInvalidTransaction(); + case PROVIDER_DECLINED: + return visitor.visitProviderDeclined(); + case THREE_D_SECURE_CARD_NOT_ENROLLED: + return visitor.visitThreeDSecureCardNotEnrolled(); + case BANK_INSUFFICIENT_FUNDS: + return visitor.visitBankInsufficientFunds(); + case TEST_MODE_DECLINE: + return visitor.visitTestModeDecline(); + case THREE_D_SECURE_TOO_MANY_ATTEMPTS: + return visitor.visitThreeDSecureTooManyAttempts(); + case PIN_REQUIRED_AS: + return visitor.visitPinRequiredAs(); + case DUPLICATE_TRANSACTION: + return visitor.visitDuplicateTransaction(); + case BANK_ACCOUNT_HOLDER_DECEASED: + return visitor.visitBankAccountHolderDeceased(); + case BANK_REGULATORY_BLOCKED: + return visitor.visitBankRegulatoryBlocked(); + case SEPA_REFUSED_BY_CUSTOMER: + return visitor.visitSepaRefusedByCustomer(); + case PIN_TRY_EXCEEDED: + return visitor.visitPinTryExceeded(); + case BANK_INVALID_ROUTING_NUMBER: + return visitor.visitBankInvalidRoutingNumber(); + case BANK_ACCOUNT_NOT_FOUND: + return visitor.visitBankAccountNotFound(); + case INSUFFICIENT_FUNDS: + return visitor.visitInsufficientFunds(); + case INVALID_CARD_HOLDER_NAME: + return visitor.visitInvalidCardHolderName(); + case SEPA_INVALID_IBAN: + return visitor.visitSepaInvalidIban(); + case REGULATORY_BLOCKED: + return visitor.visitRegulatoryBlocked(); + case INVALID_EXPIRY_YEAR: + return visitor.visitInvalidExpiryYear(); + case THREE_D_SECURE_FRAUD: + return visitor.visitThreeDSecureFraud(); + case THREE_D_SECURE_REJECTED_BY_BANK: + return visitor.visitThreeDSecureRejectedByBank(); + case SEPA_MANDATE_DATA_INVALID: + return visitor.visitSepaMandateDataInvalid(); + case ISSUER_UNAVAILABLE: + return visitor.visitIssuerUnavailable(); + case BANK_GENERIC_DECLINE: + return visitor.visitBankGenericDecline(); + case SEPA_GENERIC_DECLINE: + return visitor.visitSepaGenericDecline(); + case PIN_REQUIRED: + return visitor.visitPinRequired(); + case ISSUER_ERROR: + return visitor.visitIssuerError(); + case INVALID_CVC: + return visitor.visitInvalidCvc(); + case INVALID_COUNTRY: + return visitor.visitInvalidCountry(); + case EXPIRED_CARD: + return visitor.visitExpiredCard(); + case INVALID_AMOUNT: + return visitor.visitInvalidAmount(); + case THREE_D_SECURE_TIMEOUT: + return visitor.visitThreeDSecureTimeout(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PaymentLastPaymentErrorDeclineCode valueOf(String value) { + switch (value) { + case "processing_error": + return PROCESSING_ERROR; + case "reenter_transaction": + return REENTER_TRANSACTION; + case "invalid_account": + return INVALID_ACCOUNT; + case "three_d_secure_canceled": + return THREE_D_SECURE_CANCELED; + case "transaction_not_allowed": + return TRANSACTION_NOT_ALLOWED; + case "high_risk": + return HIGH_RISK; + case "three_d_secure_success": + return THREE_D_SECURE_SUCCESS; + case "stolen_card": + return STOLEN_CARD; + case "cannot_authorize": + return CANNOT_AUTHORIZE; + case "card_not_supported": + return CARD_NOT_SUPPORTED; + case "no_accounts": + return NO_ACCOUNTS; + case "transaction_stopped": + return TRANSACTION_STOPPED; + case "lost_card": + return LOST_CARD; + case "bank_processing_error": + return BANK_PROCESSING_ERROR; + case "generic_decline": + return GENERIC_DECLINE; + case "card_type_not_supported": + return CARD_TYPE_NOT_SUPPORTED; + case "authentication_required": + return AUTHENTICATION_REQUIRED; + case "bank_declined": + return BANK_DECLINED; + case "restricted_card": + return RESTRICTED_CARD; + case "suspected_fraud": + return SUSPECTED_FRAUD; + case "issuer_not_found": + return ISSUER_NOT_FOUND; + case "bank_authorization_revoked": + return BANK_AUTHORIZATION_REVOKED; + case "sepa_no_mandate": + return SEPA_NO_MANDATE; + case "three_d_secure_failed": + return THREE_D_SECURE_FAILED; + case "bank_account_frozen": + return BANK_ACCOUNT_FROZEN; + case "invalid_cvc_or_expiration": + return INVALID_CVC_OR_EXPIRATION; + case "three_d_secure_reported_lost_or_stolen": + return THREE_D_SECURE_REPORTED_LOST_OR_STOLEN; + case "closed_account": + return CLOSED_ACCOUNT; + case "sepa_disputed": + return SEPA_DISPUTED; + case "invalid_pin": + return INVALID_PIN; + case "invalid_zip": + return INVALID_ZIP; + case "invalid_expiry": + return INVALID_EXPIRY; + case "bank_amount_error": + return BANK_AMOUNT_ERROR; + case "withdrawal_count_limit_exceeded": + return WITHDRAWAL_COUNT_LIMIT_EXCEEDED; + case "merchant_blacklist": + return MERCHANT_BLACKLIST; + case "bank_payment_stopped": + return BANK_PAYMENT_STOPPED; + case "contact_issuer": + return CONTACT_ISSUER; + case "test_mode_test_card": + return TEST_MODE_TEST_CARD; + case "transaction_not_permitted": + return TRANSACTION_NOT_PERMITTED; + case "bank_account_closed": + return BANK_ACCOUNT_CLOSED; + case "try_again_later": + return TRY_AGAIN_LATER; + case "bank_non_transaction_account": + return BANK_NON_TRANSACTION_ACCOUNT; + case "bank_duplicate": + return BANK_DUPLICATE; + case "three_d_secure_generic_error": + return THREE_D_SECURE_GENERIC_ERROR; + case "invalid_card_number": + return INVALID_CARD_NUMBER; + case "three_d_secure_invalid_card_number": + return THREE_D_SECURE_INVALID_CARD_NUMBER; + case "invalid_expiry_month": + return INVALID_EXPIRY_MONTH; + case "currency_not_supported": + return CURRENCY_NOT_SUPPORTED; + case "blocked_by_cardholder": + return BLOCKED_BY_CARDHOLDER; + case "card_velocity_exceeded": + return CARD_VELOCITY_EXCEEDED; + case "transaction_cancelled": + return TRANSACTION_CANCELLED; + case "bank_not_authorized": + return BANK_NOT_AUTHORIZED; + case "incorrect_pin": + return INCORRECT_PIN; + case "bank_details_invalid": + return BANK_DETAILS_INVALID; + case "invalid_transaction": + return INVALID_TRANSACTION; + case "provider_declined": + return PROVIDER_DECLINED; + case "three_d_secure_card_not_enrolled": + return THREE_D_SECURE_CARD_NOT_ENROLLED; + case "bank_insufficient_funds": + return BANK_INSUFFICIENT_FUNDS; + case "test_mode_decline": + return TEST_MODE_DECLINE; + case "three_d_secure_too_many_attempts": + return THREE_D_SECURE_TOO_MANY_ATTEMPTS; + case "pin_required_as": + return PIN_REQUIRED_AS; + case "duplicate_transaction": + return DUPLICATE_TRANSACTION; + case "bank_account_holder_deceased": + return BANK_ACCOUNT_HOLDER_DECEASED; + case "bank_regulatory_blocked": + return BANK_REGULATORY_BLOCKED; + case "sepa_refused_by_customer": + return SEPA_REFUSED_BY_CUSTOMER; + case "pin_try_exceeded": + return PIN_TRY_EXCEEDED; + case "bank_invalid_routing_number": + return BANK_INVALID_ROUTING_NUMBER; + case "bank_account_not_found": + return BANK_ACCOUNT_NOT_FOUND; + case "insufficient_funds": + return INSUFFICIENT_FUNDS; + case "invalid_card_holder_name": + return INVALID_CARD_HOLDER_NAME; + case "sepa_invalid_iban": + return SEPA_INVALID_IBAN; + case "regulatory_blocked": + return REGULATORY_BLOCKED; + case "invalid_expiry_year": + return INVALID_EXPIRY_YEAR; + case "three_d_secure_fraud": + return THREE_D_SECURE_FRAUD; + case "three_d_secure_rejected_by_bank": + return THREE_D_SECURE_REJECTED_BY_BANK; + case "sepa_mandate_data_invalid": + return SEPA_MANDATE_DATA_INVALID; + case "issuer_unavailable": + return ISSUER_UNAVAILABLE; + case "bank_generic_decline": + return BANK_GENERIC_DECLINE; + case "sepa_generic_decline": + return SEPA_GENERIC_DECLINE; + case "pin_required": + return PIN_REQUIRED; + case "issuer_error": + return ISSUER_ERROR; + case "invalid_cvc": + return INVALID_CVC; + case "invalid_country": + return INVALID_COUNTRY; + case "expired_card": + return EXPIRED_CARD; + case "invalid_amount": + return INVALID_AMOUNT; + case "three_d_secure_timeout": + return THREE_D_SECURE_TIMEOUT; + default: + return new PaymentLastPaymentErrorDeclineCode(Value.UNKNOWN, value); + } + } + + public enum Value { + INSUFFICIENT_FUNDS, + + LOST_CARD, + + STOLEN_CARD, + + EXPIRED_CARD, + + SUSPECTED_FRAUD, + + INVALID_CARD_NUMBER, + + INVALID_CVC, + + INVALID_CVC_OR_EXPIRATION, + + INCORRECT_PIN, + + AUTHENTICATION_REQUIRED, + + CARD_NOT_SUPPORTED, + + CURRENCY_NOT_SUPPORTED, + + DUPLICATE_TRANSACTION, + + GENERIC_DECLINE, + + INVALID_ACCOUNT, + + INVALID_AMOUNT, + + PROCESSING_ERROR, + + RESTRICTED_CARD, + + CARD_VELOCITY_EXCEEDED, + + CONTACT_ISSUER, + + BANK_DECLINED, + + REGULATORY_BLOCKED, + + TRANSACTION_NOT_PERMITTED, + + TRANSACTION_STOPPED, + + CARD_TYPE_NOT_SUPPORTED, + + ISSUER_NOT_FOUND, + + CLOSED_ACCOUNT, + + ISSUER_UNAVAILABLE, + + INVALID_ZIP, + + INVALID_EXPIRY_MONTH, + + INVALID_EXPIRY_YEAR, + + INVALID_EXPIRY, + + INVALID_TRANSACTION, + + CANNOT_AUTHORIZE, + + PIN_REQUIRED, + + PIN_TRY_EXCEEDED, + + PROVIDER_DECLINED, + + HIGH_RISK, + + TEST_MODE_DECLINE, + + MERCHANT_BLACKLIST, + + REENTER_TRANSACTION, + + INVALID_PIN, + + PIN_REQUIRED_AS, + + WITHDRAWAL_COUNT_LIMIT_EXCEEDED, + + INVALID_COUNTRY, + + ISSUER_ERROR, + + INVALID_CARD_HOLDER_NAME, + + NO_ACCOUNTS, + + TRANSACTION_CANCELLED, + + THREE_D_SECURE_SUCCESS, + + THREE_D_SECURE_CANCELED, + + THREE_D_SECURE_INVALID_CARD_NUMBER, + + THREE_D_SECURE_GENERIC_ERROR, + + THREE_D_SECURE_TIMEOUT, + + THREE_D_SECURE_FAILED, + + THREE_D_SECURE_CARD_NOT_ENROLLED, + + THREE_D_SECURE_FRAUD, + + THREE_D_SECURE_TOO_MANY_ATTEMPTS, + + THREE_D_SECURE_REJECTED_BY_BANK, + + THREE_D_SECURE_REPORTED_LOST_OR_STOLEN, + + BLOCKED_BY_CARDHOLDER, + + TEST_MODE_TEST_CARD, + + TRY_AGAIN_LATER, + + TRANSACTION_NOT_ALLOWED, + + BANK_INSUFFICIENT_FUNDS, + + BANK_ACCOUNT_NOT_FOUND, + + BANK_ACCOUNT_CLOSED, + + BANK_ACCOUNT_FROZEN, + + BANK_INVALID_ROUTING_NUMBER, + + BANK_NON_TRANSACTION_ACCOUNT, + + BANK_AUTHORIZATION_REVOKED, + + BANK_PAYMENT_STOPPED, + + BANK_NOT_AUTHORIZED, + + BANK_ACCOUNT_HOLDER_DECEASED, + + BANK_DUPLICATE, + + BANK_AMOUNT_ERROR, + + BANK_REGULATORY_BLOCKED, + + BANK_DETAILS_INVALID, + + BANK_PROCESSING_ERROR, + + BANK_GENERIC_DECLINE, + + SEPA_INVALID_IBAN, + + SEPA_NO_MANDATE, + + SEPA_MANDATE_DATA_INVALID, + + SEPA_DISPUTED, + + SEPA_REFUSED_BY_CUSTOMER, + + SEPA_GENERIC_DECLINE, + + UNKNOWN + } + + public interface Visitor { + T visitInsufficientFunds(); + + T visitLostCard(); + + T visitStolenCard(); + + T visitExpiredCard(); + + T visitSuspectedFraud(); + + T visitInvalidCardNumber(); + + T visitInvalidCvc(); + + T visitInvalidCvcOrExpiration(); + + T visitIncorrectPin(); + + T visitAuthenticationRequired(); + + T visitCardNotSupported(); + + T visitCurrencyNotSupported(); + + T visitDuplicateTransaction(); + + T visitGenericDecline(); + + T visitInvalidAccount(); + + T visitInvalidAmount(); + + T visitProcessingError(); + + T visitRestrictedCard(); + + T visitCardVelocityExceeded(); + + T visitContactIssuer(); + + T visitBankDeclined(); + + T visitRegulatoryBlocked(); + + T visitTransactionNotPermitted(); + + T visitTransactionStopped(); + + T visitCardTypeNotSupported(); + + T visitIssuerNotFound(); + + T visitClosedAccount(); + + T visitIssuerUnavailable(); + + T visitInvalidZip(); + + T visitInvalidExpiryMonth(); + + T visitInvalidExpiryYear(); + + T visitInvalidExpiry(); + + T visitInvalidTransaction(); + + T visitCannotAuthorize(); + + T visitPinRequired(); + + T visitPinTryExceeded(); + + T visitProviderDeclined(); + + T visitHighRisk(); + + T visitTestModeDecline(); + + T visitMerchantBlacklist(); + + T visitReenterTransaction(); + + T visitInvalidPin(); + + T visitPinRequiredAs(); + + T visitWithdrawalCountLimitExceeded(); + + T visitInvalidCountry(); + + T visitIssuerError(); + + T visitInvalidCardHolderName(); + + T visitNoAccounts(); + + T visitTransactionCancelled(); + + T visitThreeDSecureSuccess(); + + T visitThreeDSecureCanceled(); + + T visitThreeDSecureInvalidCardNumber(); + + T visitThreeDSecureGenericError(); + + T visitThreeDSecureTimeout(); + + T visitThreeDSecureFailed(); + + T visitThreeDSecureCardNotEnrolled(); + + T visitThreeDSecureFraud(); + + T visitThreeDSecureTooManyAttempts(); + + T visitThreeDSecureRejectedByBank(); + + T visitThreeDSecureReportedLostOrStolen(); + + T visitBlockedByCardholder(); + + T visitTestModeTestCard(); + + T visitTryAgainLater(); + + T visitTransactionNotAllowed(); + + T visitBankInsufficientFunds(); + + T visitBankAccountNotFound(); + + T visitBankAccountClosed(); + + T visitBankAccountFrozen(); + + T visitBankInvalidRoutingNumber(); + + T visitBankNonTransactionAccount(); + + T visitBankAuthorizationRevoked(); + + T visitBankPaymentStopped(); + + T visitBankNotAuthorized(); + + T visitBankAccountHolderDeceased(); + + T visitBankDuplicate(); + + T visitBankAmountError(); + + T visitBankRegulatoryBlocked(); + + T visitBankDetailsInvalid(); + + T visitBankProcessingError(); + + T visitBankGenericDecline(); + + T visitSepaInvalidIban(); + + T visitSepaNoMandate(); + + T visitSepaMandateDataInvalid(); + + T visitSepaDisputed(); + + T visitSepaRefusedByCustomer(); + + T visitSepaGenericDecline(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItem.java b/src/main/java/com/whop/api/types/PaymentListItem.java new file mode 100644 index 00000000..b08f9359 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItem.java @@ -0,0 +1,3114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItem.Builder.class) +public final class PaymentListItem { + private final double amountAfterFees; + + private final Optional applicationFee; + + private final boolean autoRefunded; + + private final Optional billingAddress; + + private final Optional billingReason; + + private final Optional cardBrand; + + private final Optional cardLast4; + + private final Optional checkoutConfigurationId; + + private final Optional company; + + private final OffsetDateTime createdAt; + + private final Currencies currency; + + private final Optional customerPhone; + + private final Optional declineCode; + + private final Optional disputeAlertedAt; + + private final Optional failureMessage; + + private final String id; + + private final Optional lastPaymentAttempt; + + private final Optional member; + + private final Optional membership; + + private final Optional> metadata; + + private final Optional needsTracking; + + private final Optional nextPaymentAttempt; + + private final Optional paidAt; + + private final Optional paymentInstrument; + + private final Optional paymentMethod; + + private final Optional paymentMethodType; + + private final Optional paymentsFailed; + + private final Optional plan; + + private final Optional product; + + private final Optional promoCode; + + private final boolean refundable; + + private final Optional refundedAmount; + + private final Optional refundedAt; + + private final boolean retryable; + + private final Currencies settlementCurrency; + + private final Optional shipment; + + private final Optional shippingAddress; + + private final Optional status; + + private final FriendlyReceiptStatus substatus; + + private final Optional subtotal; + + private final Optional taxAmount; + + private final Optional taxBehavior; + + private final Optional total; + + private final OffsetDateTime updatedAt; + + private final Optional usdTotal; + + private final Optional user; + + private final boolean voidable; + + private final Map additionalProperties; + + private PaymentListItem( + double amountAfterFees, + Optional applicationFee, + boolean autoRefunded, + Optional billingAddress, + Optional billingReason, + Optional cardBrand, + Optional cardLast4, + Optional checkoutConfigurationId, + Optional company, + OffsetDateTime createdAt, + Currencies currency, + Optional customerPhone, + Optional declineCode, + Optional disputeAlertedAt, + Optional failureMessage, + String id, + Optional lastPaymentAttempt, + Optional member, + Optional membership, + Optional> metadata, + Optional needsTracking, + Optional nextPaymentAttempt, + Optional paidAt, + Optional paymentInstrument, + Optional paymentMethod, + Optional paymentMethodType, + Optional paymentsFailed, + Optional plan, + Optional product, + Optional promoCode, + boolean refundable, + Optional refundedAmount, + Optional refundedAt, + boolean retryable, + Currencies settlementCurrency, + Optional shipment, + Optional shippingAddress, + Optional status, + FriendlyReceiptStatus substatus, + Optional subtotal, + Optional taxAmount, + Optional taxBehavior, + Optional total, + OffsetDateTime updatedAt, + Optional usdTotal, + Optional user, + boolean voidable, + Map additionalProperties) { + this.amountAfterFees = amountAfterFees; + this.applicationFee = applicationFee; + this.autoRefunded = autoRefunded; + this.billingAddress = billingAddress; + this.billingReason = billingReason; + this.cardBrand = cardBrand; + this.cardLast4 = cardLast4; + this.checkoutConfigurationId = checkoutConfigurationId; + this.company = company; + this.createdAt = createdAt; + this.currency = currency; + this.customerPhone = customerPhone; + this.declineCode = declineCode; + this.disputeAlertedAt = disputeAlertedAt; + this.failureMessage = failureMessage; + this.id = id; + this.lastPaymentAttempt = lastPaymentAttempt; + this.member = member; + this.membership = membership; + this.metadata = metadata; + this.needsTracking = needsTracking; + this.nextPaymentAttempt = nextPaymentAttempt; + this.paidAt = paidAt; + this.paymentInstrument = paymentInstrument; + this.paymentMethod = paymentMethod; + this.paymentMethodType = paymentMethodType; + this.paymentsFailed = paymentsFailed; + this.plan = plan; + this.product = product; + this.promoCode = promoCode; + this.refundable = refundable; + this.refundedAmount = refundedAmount; + this.refundedAt = refundedAt; + this.retryable = retryable; + this.settlementCurrency = settlementCurrency; + this.shipment = shipment; + this.shippingAddress = shippingAddress; + this.status = status; + this.substatus = substatus; + this.subtotal = subtotal; + this.taxAmount = taxAmount; + this.taxBehavior = taxBehavior; + this.total = total; + this.updatedAt = updatedAt; + this.usdTotal = usdTotal; + this.user = user; + this.voidable = voidable; + this.additionalProperties = additionalProperties; + } + + /** + * @return How much the payment is for after fees + */ + @JsonProperty("amount_after_fees") + public double getAmountAfterFees() { + return amountAfterFees; + } + + /** + * @return The application fee charged on this payment. + */ + @JsonIgnore + public Optional getApplicationFee() { + if (applicationFee == null) { + return Optional.empty(); + } + return applicationFee; + } + + /** + * @return Whether this payment was auto refunded or not + */ + @JsonProperty("auto_refunded") + public boolean getAutoRefunded() { + return autoRefunded; + } + + /** + * @return The address of the user who made the payment. + */ + @JsonIgnore + public Optional getBillingAddress() { + if (billingAddress == null) { + return Optional.empty(); + } + return billingAddress; + } + + /** + * @return The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment. + */ + @JsonIgnore + public Optional getBillingReason() { + if (billingReason == null) { + return Optional.empty(); + } + return billingReason; + } + + /** + * @return Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'. + */ + @JsonIgnore + public Optional getCardBrand() { + if (cardBrand == null) { + return Optional.empty(); + } + return cardBrand; + } + + /** + * @return The last four digits of the card used to make this payment. Null if the payment was not made with a card. + */ + @JsonIgnore + public Optional getCardLast4() { + if (cardLast4 == null) { + return Optional.empty(); + } + return cardLast4; + } + + /** + * @return The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them. + */ + @JsonIgnore + public Optional getCheckoutConfigurationId() { + if (checkoutConfigurationId == null) { + return Optional.empty(); + } + return checkoutConfigurationId; + } + + /** + * @return The company for the payment. + */ + @JsonIgnore + public Optional getCompany() { + if (company == null) { + return Optional.empty(); + } + return company; + } + + /** + * @return The datetime the payment was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code for this payment (e.g., 'usd', 'eur'). + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected. + */ + @JsonIgnore + public Optional getCustomerPhone() { + if (customerPhone == null) { + return Optional.empty(); + } + return customerPhone; + } + + /** + * @return The reason the payment was declined. Null if the payment did not fail. + */ + @JsonIgnore + public Optional getDeclineCode() { + if (declineCode == null) { + return Optional.empty(); + } + return declineCode; + } + + /** + * @return When an alert came in that this transaction will be disputed + */ + @JsonIgnore + public Optional getDisputeAlertedAt() { + if (disputeAlertedAt == null) { + return Optional.empty(); + } + return disputeAlertedAt; + } + + /** + * @return If the payment failed, the reason for the failure. + */ + @JsonIgnore + public Optional getFailureMessage() { + if (failureMessage == null) { + return Optional.empty(); + } + return failureMessage; + } + + /** + * @return The unique identifier for the payment. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The time of the last payment attempt. + */ + @JsonIgnore + public Optional getLastPaymentAttempt() { + if (lastPaymentAttempt == null) { + return Optional.empty(); + } + return lastPaymentAttempt; + } + + /** + * @return The member attached to this payment. + */ + @JsonIgnore + public Optional getMember() { + if (member == null) { + return Optional.empty(); + } + return member; + } + + /** + * @return The membership attached to this payment. + */ + @JsonIgnore + public Optional getMembership() { + if (membership == null) { + return Optional.empty(); + } + return membership; + } + + /** + * @return The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Whether this payment is holding funds until the order ships and has no tracking number yet. + */ + @JsonIgnore + public Optional getNeedsTracking() { + if (needsTracking == null) { + return Optional.empty(); + } + return needsTracking; + } + + /** + * @return The time of the next schedule payment retry. + */ + @JsonIgnore + public Optional getNextPaymentAttempt() { + if (nextPaymentAttempt == null) { + return Optional.empty(); + } + return nextPaymentAttempt; + } + + /** + * @return The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp. + */ + @JsonIgnore + public Optional getPaidAt() { + if (paidAt == null) { + return Optional.empty(); + } + return paidAt; + } + + /** + * @return The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method. + */ + @JsonIgnore + public Optional getPaymentInstrument() { + if (paymentInstrument == null) { + return Optional.empty(); + } + return paymentInstrument; + } + + /** + * @return The tokenized payment method reference used for this payment. Null if no token was used. + */ + @JsonIgnore + public Optional getPaymentMethod() { + if (paymentMethod == null) { + return Optional.empty(); + } + return paymentMethod; + } + + /** + * @return The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type. + */ + @JsonIgnore + public Optional getPaymentMethodType() { + if (paymentMethodType == null) { + return Optional.empty(); + } + return paymentMethodType; + } + + /** + * @return The number of failed payment attempts for the payment. + */ + @JsonIgnore + public Optional getPaymentsFailed() { + if (paymentsFailed == null) { + return Optional.empty(); + } + return paymentsFailed; + } + + /** + * @return The plan attached to this payment. + */ + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + /** + * @return The product this payment was made for + */ + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return The promo code used for this payment. + */ + @JsonIgnore + public Optional getPromoCode() { + if (promoCode == null) { + return Optional.empty(); + } + return promoCode; + } + + /** + * @return True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds. + */ + @JsonProperty("refundable") + public boolean getRefundable() { + return refundable; + } + + /** + * @return The payment refund amount(if applicable). + */ + @JsonIgnore + public Optional getRefundedAmount() { + if (refundedAmount == null) { + return Optional.empty(); + } + return refundedAmount; + } + + /** + * @return When the payment was refunded (if applicable). + */ + @JsonIgnore + public Optional getRefundedAt() { + if (refundedAt == null) { + return Optional.empty(); + } + return refundedAt; + } + + /** + * @return True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again. + */ + @JsonProperty("retryable") + public boolean getRetryable() { + return retryable; + } + + /** + * @return The three-letter ISO currency code for this payment (e.g., 'usd', 'eur'). + */ + @JsonProperty("settlement_currency") + public Currencies getSettlementCurrency() { + return settlementCurrency; + } + + /** + * @return The shipment attached to this payment. + */ + @JsonIgnore + public Optional getShipment() { + if (shipment == null) { + return Optional.empty(); + } + return shipment; + } + + /** + * @return The shipping address provided by the customer for physical goods. Null if no shipping address was collected. + */ + @JsonIgnore + public Optional getShippingAddress() { + if (shippingAddress == null) { + return Optional.empty(); + } + return shippingAddress; + } + + /** + * @return The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void'). + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The friendly status of the payment. + */ + @JsonProperty("substatus") + public FriendlyReceiptStatus getSubstatus() { + return substatus; + } + + /** + * @return The subtotal to show to the creator (excluding buyer fees). + */ + @JsonIgnore + public Optional getSubtotal() { + if (subtotal == null) { + return Optional.empty(); + } + return subtotal; + } + + /** + * @return The calculated amount of the sales/VAT tax (if applicable). + */ + @JsonIgnore + public Optional getTaxAmount() { + if (taxAmount == null) { + return Optional.empty(); + } + return taxAmount; + } + + /** + * @return The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top. + */ + @JsonIgnore + public Optional getTaxBehavior() { + if (taxBehavior == null) { + return Optional.empty(); + } + return taxBehavior; + } + + /** + * @return The total to show to the creator (excluding buyer fees). + */ + @JsonIgnore + public Optional getTotal() { + if (total == null) { + return Optional.empty(); + } + return total; + } + + /** + * @return The datetime the payment was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The total in USD to show to the creator (excluding buyer fees). + */ + @JsonIgnore + public Optional getUsdTotal() { + if (usdTotal == null) { + return Optional.empty(); + } + return usdTotal; + } + + /** + * @return The user that made this payment. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + /** + * @return True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false. + */ + @JsonProperty("voidable") + public boolean getVoidable() { + return voidable; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("application_fee") + private Optional _getApplicationFee() { + return applicationFee; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_address") + private Optional _getBillingAddress() { + return billingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_reason") + private Optional _getBillingReason() { + return billingReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_brand") + private Optional _getCardBrand() { + return cardBrand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_last4") + private Optional _getCardLast4() { + return cardLast4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_configuration_id") + private Optional _getCheckoutConfigurationId() { + return checkoutConfigurationId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company") + private Optional _getCompany() { + return company; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_phone") + private Optional _getCustomerPhone() { + return customerPhone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("decline_code") + private Optional _getDeclineCode() { + return declineCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("dispute_alerted_at") + private Optional _getDisputeAlertedAt() { + return disputeAlertedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_message") + private Optional _getFailureMessage() { + return failureMessage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_payment_attempt") + private Optional _getLastPaymentAttempt() { + return lastPaymentAttempt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member") + private Optional _getMember() { + return member; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("membership") + private Optional _getMembership() { + return membership; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("needs_tracking") + private Optional _getNeedsTracking() { + return needsTracking; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("next_payment_attempt") + private Optional _getNextPaymentAttempt() { + return nextPaymentAttempt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("paid_at") + private Optional _getPaidAt() { + return paidAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_instrument") + private Optional _getPaymentInstrument() { + return paymentInstrument; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method") + private Optional _getPaymentMethod() { + return paymentMethod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_type") + private Optional _getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payments_failed") + private Optional _getPaymentsFailed() { + return paymentsFailed; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("promo_code") + private Optional _getPromoCode() { + return promoCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refunded_amount") + private Optional _getRefundedAmount() { + return refundedAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refunded_at") + private Optional _getRefundedAt() { + return refundedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("shipment") + private Optional _getShipment() { + return shipment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("shipping_address") + private Optional _getShippingAddress() { + return shippingAddress; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("subtotal") + private Optional _getSubtotal() { + return subtotal; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_amount") + private Optional _getTaxAmount() { + return taxAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_behavior") + private Optional _getTaxBehavior() { + return taxBehavior; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("total") + private Optional _getTotal() { + return total; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("usd_total") + private Optional _getUsdTotal() { + return usdTotal; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItem && equalTo((PaymentListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItem other) { + return amountAfterFees == other.amountAfterFees + && applicationFee.equals(other.applicationFee) + && autoRefunded == other.autoRefunded + && billingAddress.equals(other.billingAddress) + && billingReason.equals(other.billingReason) + && cardBrand.equals(other.cardBrand) + && cardLast4.equals(other.cardLast4) + && checkoutConfigurationId.equals(other.checkoutConfigurationId) + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && customerPhone.equals(other.customerPhone) + && declineCode.equals(other.declineCode) + && disputeAlertedAt.equals(other.disputeAlertedAt) + && failureMessage.equals(other.failureMessage) + && id.equals(other.id) + && lastPaymentAttempt.equals(other.lastPaymentAttempt) + && member.equals(other.member) + && membership.equals(other.membership) + && metadata.equals(other.metadata) + && needsTracking.equals(other.needsTracking) + && nextPaymentAttempt.equals(other.nextPaymentAttempt) + && paidAt.equals(other.paidAt) + && paymentInstrument.equals(other.paymentInstrument) + && paymentMethod.equals(other.paymentMethod) + && paymentMethodType.equals(other.paymentMethodType) + && paymentsFailed.equals(other.paymentsFailed) + && plan.equals(other.plan) + && product.equals(other.product) + && promoCode.equals(other.promoCode) + && refundable == other.refundable + && refundedAmount.equals(other.refundedAmount) + && refundedAt.equals(other.refundedAt) + && retryable == other.retryable + && settlementCurrency.equals(other.settlementCurrency) + && shipment.equals(other.shipment) + && shippingAddress.equals(other.shippingAddress) + && status.equals(other.status) + && substatus.equals(other.substatus) + && subtotal.equals(other.subtotal) + && taxAmount.equals(other.taxAmount) + && taxBehavior.equals(other.taxBehavior) + && total.equals(other.total) + && updatedAt.equals(other.updatedAt) + && usdTotal.equals(other.usdTotal) + && user.equals(other.user) + && voidable == other.voidable; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amountAfterFees, + this.applicationFee, + this.autoRefunded, + this.billingAddress, + this.billingReason, + this.cardBrand, + this.cardLast4, + this.checkoutConfigurationId, + this.company, + this.createdAt, + this.currency, + this.customerPhone, + this.declineCode, + this.disputeAlertedAt, + this.failureMessage, + this.id, + this.lastPaymentAttempt, + this.member, + this.membership, + this.metadata, + this.needsTracking, + this.nextPaymentAttempt, + this.paidAt, + this.paymentInstrument, + this.paymentMethod, + this.paymentMethodType, + this.paymentsFailed, + this.plan, + this.product, + this.promoCode, + this.refundable, + this.refundedAmount, + this.refundedAt, + this.retryable, + this.settlementCurrency, + this.shipment, + this.shippingAddress, + this.status, + this.substatus, + this.subtotal, + this.taxAmount, + this.taxBehavior, + this.total, + this.updatedAt, + this.usdTotal, + this.user, + this.voidable); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountAfterFeesStage builder() { + return new Builder(); + } + + public interface AmountAfterFeesStage { + /** + *

How much the payment is for after fees

+ */ + AutoRefundedStage amountAfterFees(double amountAfterFees); + + Builder from(PaymentListItem other); + } + + public interface AutoRefundedStage { + /** + *

Whether this payment was auto refunded or not

+ */ + CreatedAtStage autoRefunded(boolean autoRefunded); + } + + public interface CreatedAtStage { + /** + *

The datetime the payment was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ */ + IdStage currency(@NotNull Currencies currency); + } + + public interface IdStage { + /** + *

The unique identifier for the payment.

+ */ + RefundableStage id(@NotNull String id); + } + + public interface RefundableStage { + /** + *

True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds.

+ */ + RetryableStage refundable(boolean refundable); + } + + public interface RetryableStage { + /** + *

True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again.

+ */ + SettlementCurrencyStage retryable(boolean retryable); + } + + public interface SettlementCurrencyStage { + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ */ + SubstatusStage settlementCurrency(@NotNull Currencies settlementCurrency); + } + + public interface SubstatusStage { + /** + *

The friendly status of the payment.

+ */ + UpdatedAtStage substatus(@NotNull FriendlyReceiptStatus substatus); + } + + public interface UpdatedAtStage { + /** + *

The datetime the payment was last updated.

+ */ + VoidableStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface VoidableStage { + /** + *

True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false.

+ */ + _FinalStage voidable(boolean voidable); + } + + public interface _FinalStage { + PaymentListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The application fee charged on this payment.

+ */ + _FinalStage applicationFee(Optional applicationFee); + + _FinalStage applicationFee(PaymentListItemApplicationFee applicationFee); + + _FinalStage applicationFee(Nullable applicationFee); + + /** + *

The address of the user who made the payment.

+ */ + _FinalStage billingAddress(Optional billingAddress); + + _FinalStage billingAddress(PaymentListItemBillingAddress billingAddress); + + _FinalStage billingAddress(Nullable billingAddress); + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ */ + _FinalStage billingReason(Optional billingReason); + + _FinalStage billingReason(BillingReasons billingReason); + + _FinalStage billingReason(Nullable billingReason); + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ */ + _FinalStage cardBrand(Optional cardBrand); + + _FinalStage cardBrand(CardBrands cardBrand); + + _FinalStage cardBrand(Nullable cardBrand); + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ */ + _FinalStage cardLast4(Optional cardLast4); + + _FinalStage cardLast4(String cardLast4); + + _FinalStage cardLast4(Nullable cardLast4); + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ */ + _FinalStage checkoutConfigurationId(Optional checkoutConfigurationId); + + _FinalStage checkoutConfigurationId(String checkoutConfigurationId); + + _FinalStage checkoutConfigurationId(Nullable checkoutConfigurationId); + + /** + *

The company for the payment.

+ */ + _FinalStage company(Optional company); + + _FinalStage company(PaymentListItemCompany company); + + _FinalStage company(Nullable company); + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ */ + _FinalStage customerPhone(Optional customerPhone); + + _FinalStage customerPhone(String customerPhone); + + _FinalStage customerPhone(Nullable customerPhone); + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ */ + _FinalStage declineCode(Optional declineCode); + + _FinalStage declineCode(PaymentDeclineCodes declineCode); + + _FinalStage declineCode(Nullable declineCode); + + /** + *

When an alert came in that this transaction will be disputed

+ */ + _FinalStage disputeAlertedAt(Optional disputeAlertedAt); + + _FinalStage disputeAlertedAt(OffsetDateTime disputeAlertedAt); + + _FinalStage disputeAlertedAt(Nullable disputeAlertedAt); + + /** + *

If the payment failed, the reason for the failure.

+ */ + _FinalStage failureMessage(Optional failureMessage); + + _FinalStage failureMessage(String failureMessage); + + _FinalStage failureMessage(Nullable failureMessage); + + /** + *

The time of the last payment attempt.

+ */ + _FinalStage lastPaymentAttempt(Optional lastPaymentAttempt); + + _FinalStage lastPaymentAttempt(OffsetDateTime lastPaymentAttempt); + + _FinalStage lastPaymentAttempt(Nullable lastPaymentAttempt); + + /** + *

The member attached to this payment.

+ */ + _FinalStage member(Optional member); + + _FinalStage member(PaymentListItemMember member); + + _FinalStage member(Nullable member); + + /** + *

The membership attached to this payment.

+ */ + _FinalStage membership(Optional membership); + + _FinalStage membership(PaymentListItemMembership membership); + + _FinalStage membership(Nullable membership); + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ */ + _FinalStage needsTracking(Optional needsTracking); + + _FinalStage needsTracking(Boolean needsTracking); + + _FinalStage needsTracking(Nullable needsTracking); + + /** + *

The time of the next schedule payment retry.

+ */ + _FinalStage nextPaymentAttempt(Optional nextPaymentAttempt); + + _FinalStage nextPaymentAttempt(OffsetDateTime nextPaymentAttempt); + + _FinalStage nextPaymentAttempt(Nullable nextPaymentAttempt); + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ */ + _FinalStage paidAt(Optional paidAt); + + _FinalStage paidAt(OffsetDateTime paidAt); + + _FinalStage paidAt(Nullable paidAt); + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ */ + _FinalStage paymentInstrument(Optional paymentInstrument); + + _FinalStage paymentInstrument(PaymentListItemPaymentInstrument paymentInstrument); + + _FinalStage paymentInstrument(Nullable paymentInstrument); + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ */ + _FinalStage paymentMethod(Optional paymentMethod); + + _FinalStage paymentMethod(PaymentListItemPaymentMethod paymentMethod); + + _FinalStage paymentMethod(Nullable paymentMethod); + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ */ + _FinalStage paymentMethodType(Optional paymentMethodType); + + _FinalStage paymentMethodType(PaymentMethodTypes paymentMethodType); + + _FinalStage paymentMethodType(Nullable paymentMethodType); + + /** + *

The number of failed payment attempts for the payment.

+ */ + _FinalStage paymentsFailed(Optional paymentsFailed); + + _FinalStage paymentsFailed(Integer paymentsFailed); + + _FinalStage paymentsFailed(Nullable paymentsFailed); + + /** + *

The plan attached to this payment.

+ */ + _FinalStage plan(Optional plan); + + _FinalStage plan(PaymentListItemPlan plan); + + _FinalStage plan(Nullable plan); + + /** + *

The product this payment was made for

+ */ + _FinalStage product(Optional product); + + _FinalStage product(PaymentListItemProduct product); + + _FinalStage product(Nullable product); + + /** + *

The promo code used for this payment.

+ */ + _FinalStage promoCode(Optional promoCode); + + _FinalStage promoCode(PaymentListItemPromoCode promoCode); + + _FinalStage promoCode(Nullable promoCode); + + /** + *

The payment refund amount(if applicable).

+ */ + _FinalStage refundedAmount(Optional refundedAmount); + + _FinalStage refundedAmount(Double refundedAmount); + + _FinalStage refundedAmount(Nullable refundedAmount); + + /** + *

When the payment was refunded (if applicable).

+ */ + _FinalStage refundedAt(Optional refundedAt); + + _FinalStage refundedAt(OffsetDateTime refundedAt); + + _FinalStage refundedAt(Nullable refundedAt); + + /** + *

The shipment attached to this payment.

+ */ + _FinalStage shipment(Optional shipment); + + _FinalStage shipment(PaymentListItemShipment shipment); + + _FinalStage shipment(Nullable shipment); + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ */ + _FinalStage shippingAddress(Optional shippingAddress); + + _FinalStage shippingAddress(PaymentListItemShippingAddress shippingAddress); + + _FinalStage shippingAddress(Nullable shippingAddress); + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ */ + _FinalStage status(Optional status); + + _FinalStage status(ReceiptStatus status); + + _FinalStage status(Nullable status); + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ */ + _FinalStage subtotal(Optional subtotal); + + _FinalStage subtotal(Double subtotal); + + _FinalStage subtotal(Nullable subtotal); + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ */ + _FinalStage taxAmount(Optional taxAmount); + + _FinalStage taxAmount(Double taxAmount); + + _FinalStage taxAmount(Nullable taxAmount); + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ */ + _FinalStage taxBehavior(Optional taxBehavior); + + _FinalStage taxBehavior(ReceiptTaxBehaviors taxBehavior); + + _FinalStage taxBehavior(Nullable taxBehavior); + + /** + *

The total to show to the creator (excluding buyer fees).

+ */ + _FinalStage total(Optional total); + + _FinalStage total(Double total); + + _FinalStage total(Nullable total); + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ */ + _FinalStage usdTotal(Optional usdTotal); + + _FinalStage usdTotal(Double usdTotal); + + _FinalStage usdTotal(Nullable usdTotal); + + /** + *

The user that made this payment.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(PaymentListItemUser user); + + _FinalStage user(Nullable user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountAfterFeesStage, + AutoRefundedStage, + CreatedAtStage, + CurrencyStage, + IdStage, + RefundableStage, + RetryableStage, + SettlementCurrencyStage, + SubstatusStage, + UpdatedAtStage, + VoidableStage, + _FinalStage { + private double amountAfterFees; + + private boolean autoRefunded; + + private OffsetDateTime createdAt; + + private Currencies currency; + + private String id; + + private boolean refundable; + + private boolean retryable; + + private Currencies settlementCurrency; + + private FriendlyReceiptStatus substatus; + + private OffsetDateTime updatedAt; + + private boolean voidable; + + private Optional user = Optional.empty(); + + private Optional usdTotal = Optional.empty(); + + private Optional total = Optional.empty(); + + private Optional taxBehavior = Optional.empty(); + + private Optional taxAmount = Optional.empty(); + + private Optional subtotal = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional shippingAddress = Optional.empty(); + + private Optional shipment = Optional.empty(); + + private Optional refundedAt = Optional.empty(); + + private Optional refundedAmount = Optional.empty(); + + private Optional promoCode = Optional.empty(); + + private Optional product = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional paymentsFailed = Optional.empty(); + + private Optional paymentMethodType = Optional.empty(); + + private Optional paymentMethod = Optional.empty(); + + private Optional paymentInstrument = Optional.empty(); + + private Optional paidAt = Optional.empty(); + + private Optional nextPaymentAttempt = Optional.empty(); + + private Optional needsTracking = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional membership = Optional.empty(); + + private Optional member = Optional.empty(); + + private Optional lastPaymentAttempt = Optional.empty(); + + private Optional failureMessage = Optional.empty(); + + private Optional disputeAlertedAt = Optional.empty(); + + private Optional declineCode = Optional.empty(); + + private Optional customerPhone = Optional.empty(); + + private Optional company = Optional.empty(); + + private Optional checkoutConfigurationId = Optional.empty(); + + private Optional cardLast4 = Optional.empty(); + + private Optional cardBrand = Optional.empty(); + + private Optional billingReason = Optional.empty(); + + private Optional billingAddress = Optional.empty(); + + private Optional applicationFee = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItem other) { + amountAfterFees(other.getAmountAfterFees()); + applicationFee(other.getApplicationFee()); + autoRefunded(other.getAutoRefunded()); + billingAddress(other.getBillingAddress()); + billingReason(other.getBillingReason()); + cardBrand(other.getCardBrand()); + cardLast4(other.getCardLast4()); + checkoutConfigurationId(other.getCheckoutConfigurationId()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + customerPhone(other.getCustomerPhone()); + declineCode(other.getDeclineCode()); + disputeAlertedAt(other.getDisputeAlertedAt()); + failureMessage(other.getFailureMessage()); + id(other.getId()); + lastPaymentAttempt(other.getLastPaymentAttempt()); + member(other.getMember()); + membership(other.getMembership()); + metadata(other.getMetadata()); + needsTracking(other.getNeedsTracking()); + nextPaymentAttempt(other.getNextPaymentAttempt()); + paidAt(other.getPaidAt()); + paymentInstrument(other.getPaymentInstrument()); + paymentMethod(other.getPaymentMethod()); + paymentMethodType(other.getPaymentMethodType()); + paymentsFailed(other.getPaymentsFailed()); + plan(other.getPlan()); + product(other.getProduct()); + promoCode(other.getPromoCode()); + refundable(other.getRefundable()); + refundedAmount(other.getRefundedAmount()); + refundedAt(other.getRefundedAt()); + retryable(other.getRetryable()); + settlementCurrency(other.getSettlementCurrency()); + shipment(other.getShipment()); + shippingAddress(other.getShippingAddress()); + status(other.getStatus()); + substatus(other.getSubstatus()); + subtotal(other.getSubtotal()); + taxAmount(other.getTaxAmount()); + taxBehavior(other.getTaxBehavior()); + total(other.getTotal()); + updatedAt(other.getUpdatedAt()); + usdTotal(other.getUsdTotal()); + user(other.getUser()); + voidable(other.getVoidable()); + return this; + } + + /** + *

How much the payment is for after fees

+ *

How much the payment is for after fees

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount_after_fees") + public AutoRefundedStage amountAfterFees(double amountAfterFees) { + this.amountAfterFees = amountAfterFees; + return this; + } + + /** + *

Whether this payment was auto refunded or not

+ *

Whether this payment was auto refunded or not

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("auto_refunded") + public CreatedAtStage autoRefunded(boolean autoRefunded) { + this.autoRefunded = autoRefunded; + return this; + } + + /** + *

The datetime the payment was created.

+ *

The datetime the payment was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier for the payment.

+ *

The unique identifier for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RefundableStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds.

+ *

True only for payments that are paid, have not been fully refunded, and were processed by a payment processor that allows refunds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("refundable") + public RetryableStage refundable(boolean refundable) { + this.refundable = refundable; + return this; + } + + /** + *

True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again.

+ *

True when the payment status is open and its membership is in one of the retry-eligible states (active, trialing, completed, or past_due), or when it is a failed initial billing-engine payment on a drafted membership with an unlimited-stock plan; otherwise false. Used to decide if Whop can attempt the charge again.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("retryable") + public SettlementCurrencyStage retryable(boolean retryable) { + this.retryable = retryable; + return this; + } + + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("settlement_currency") + public SubstatusStage settlementCurrency(@NotNull Currencies settlementCurrency) { + this.settlementCurrency = Objects.requireNonNull(settlementCurrency, "settlementCurrency must not be null"); + return this; + } + + /** + *

The friendly status of the payment.

+ *

The friendly status of the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("substatus") + public UpdatedAtStage substatus(@NotNull FriendlyReceiptStatus substatus) { + this.substatus = Objects.requireNonNull(substatus, "substatus must not be null"); + return this; + } + + /** + *

The datetime the payment was last updated.

+ *

The datetime the payment was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public VoidableStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false.

+ *

True when the payment is tied to a membership in past_due, the payment status is open, and the processor allows voiding payments; otherwise false.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("voidable") + public _FinalStage voidable(boolean voidable) { + this.voidable = voidable; + return this; + } + + /** + *

The user that made this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The user that made this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(PaymentListItemUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The user that made this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdTotal(Nullable usdTotal) { + if (usdTotal.isNull()) { + this.usdTotal = null; + } else if (usdTotal.isEmpty()) { + this.usdTotal = Optional.empty(); + } else { + this.usdTotal = Optional.of(usdTotal.get()); + } + return this; + } + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdTotal(Double usdTotal) { + this.usdTotal = Optional.ofNullable(usdTotal); + return this; + } + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "usd_total", nulls = Nulls.SKIP) + public _FinalStage usdTotal(Optional usdTotal) { + this.usdTotal = usdTotal; + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage total(Nullable total) { + if (total.isNull()) { + this.total = null; + } else if (total.isEmpty()) { + this.total = Optional.empty(); + } else { + this.total = Optional.of(total.get()); + } + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage total(Double total) { + this.total = Optional.ofNullable(total); + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "total", nulls = Nulls.SKIP) + public _FinalStage total(Optional total) { + this.total = total; + return this; + } + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxBehavior(Nullable taxBehavior) { + if (taxBehavior.isNull()) { + this.taxBehavior = null; + } else if (taxBehavior.isEmpty()) { + this.taxBehavior = Optional.empty(); + } else { + this.taxBehavior = Optional.of(taxBehavior.get()); + } + return this; + } + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxBehavior(ReceiptTaxBehaviors taxBehavior) { + this.taxBehavior = Optional.ofNullable(taxBehavior); + return this; + } + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ */ + @java.lang.Override + @JsonSetter(value = "tax_behavior", nulls = Nulls.SKIP) + public _FinalStage taxBehavior(Optional taxBehavior) { + this.taxBehavior = taxBehavior; + return this; + } + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxAmount(Nullable taxAmount) { + if (taxAmount.isNull()) { + this.taxAmount = null; + } else if (taxAmount.isEmpty()) { + this.taxAmount = Optional.empty(); + } else { + this.taxAmount = Optional.of(taxAmount.get()); + } + return this; + } + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxAmount(Double taxAmount) { + this.taxAmount = Optional.ofNullable(taxAmount); + return this; + } + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "tax_amount", nulls = Nulls.SKIP) + public _FinalStage taxAmount(Optional taxAmount) { + this.taxAmount = taxAmount; + return this; + } + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subtotal(Nullable subtotal) { + if (subtotal.isNull()) { + this.subtotal = null; + } else if (subtotal.isEmpty()) { + this.subtotal = Optional.empty(); + } else { + this.subtotal = Optional.of(subtotal.get()); + } + return this; + } + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subtotal(Double subtotal) { + this.subtotal = Optional.ofNullable(subtotal); + return this; + } + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "subtotal", nulls = Nulls.SKIP) + public _FinalStage subtotal(Optional subtotal) { + this.subtotal = subtotal; + return this; + } + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(ReceiptStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shippingAddress(Nullable shippingAddress) { + if (shippingAddress.isNull()) { + this.shippingAddress = null; + } else if (shippingAddress.isEmpty()) { + this.shippingAddress = Optional.empty(); + } else { + this.shippingAddress = Optional.of(shippingAddress.get()); + } + return this; + } + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shippingAddress(PaymentListItemShippingAddress shippingAddress) { + this.shippingAddress = Optional.ofNullable(shippingAddress); + return this; + } + + /** + *

The shipping address provided by the customer for physical goods. Null if no shipping address was collected.

+ */ + @java.lang.Override + @JsonSetter(value = "shipping_address", nulls = Nulls.SKIP) + public _FinalStage shippingAddress(Optional shippingAddress) { + this.shippingAddress = shippingAddress; + return this; + } + + /** + *

The shipment attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shipment(Nullable shipment) { + if (shipment.isNull()) { + this.shipment = null; + } else if (shipment.isEmpty()) { + this.shipment = Optional.empty(); + } else { + this.shipment = Optional.of(shipment.get()); + } + return this; + } + + /** + *

The shipment attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage shipment(PaymentListItemShipment shipment) { + this.shipment = Optional.ofNullable(shipment); + return this; + } + + /** + *

The shipment attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "shipment", nulls = Nulls.SKIP) + public _FinalStage shipment(Optional shipment) { + this.shipment = shipment; + return this; + } + + /** + *

When the payment was refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAt(Nullable refundedAt) { + if (refundedAt.isNull()) { + this.refundedAt = null; + } else if (refundedAt.isEmpty()) { + this.refundedAt = Optional.empty(); + } else { + this.refundedAt = Optional.of(refundedAt.get()); + } + return this; + } + + /** + *

When the payment was refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAt(OffsetDateTime refundedAt) { + this.refundedAt = Optional.ofNullable(refundedAt); + return this; + } + + /** + *

When the payment was refunded (if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "refunded_at", nulls = Nulls.SKIP) + public _FinalStage refundedAt(Optional refundedAt) { + this.refundedAt = refundedAt; + return this; + } + + /** + *

The payment refund amount(if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAmount(Nullable refundedAmount) { + if (refundedAmount.isNull()) { + this.refundedAmount = null; + } else if (refundedAmount.isEmpty()) { + this.refundedAmount = Optional.empty(); + } else { + this.refundedAmount = Optional.of(refundedAmount.get()); + } + return this; + } + + /** + *

The payment refund amount(if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refundedAmount(Double refundedAmount) { + this.refundedAmount = Optional.ofNullable(refundedAmount); + return this; + } + + /** + *

The payment refund amount(if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "refunded_amount", nulls = Nulls.SKIP) + public _FinalStage refundedAmount(Optional refundedAmount) { + this.refundedAmount = refundedAmount; + return this; + } + + /** + *

The promo code used for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCode(Nullable promoCode) { + if (promoCode.isNull()) { + this.promoCode = null; + } else if (promoCode.isEmpty()) { + this.promoCode = Optional.empty(); + } else { + this.promoCode = Optional.of(promoCode.get()); + } + return this; + } + + /** + *

The promo code used for this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoCode(PaymentListItemPromoCode promoCode) { + this.promoCode = Optional.ofNullable(promoCode); + return this; + } + + /** + *

The promo code used for this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "promo_code", nulls = Nulls.SKIP) + public _FinalStage promoCode(Optional promoCode) { + this.promoCode = promoCode; + return this; + } + + /** + *

The product this payment was made for

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

The product this payment was made for

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(PaymentListItemProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

The product this payment was made for

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

The plan attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + /** + *

The plan attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(PaymentListItemPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + /** + *

The plan attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + + /** + *

The number of failed payment attempts for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentsFailed(Nullable paymentsFailed) { + if (paymentsFailed.isNull()) { + this.paymentsFailed = null; + } else if (paymentsFailed.isEmpty()) { + this.paymentsFailed = Optional.empty(); + } else { + this.paymentsFailed = Optional.of(paymentsFailed.get()); + } + return this; + } + + /** + *

The number of failed payment attempts for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentsFailed(Integer paymentsFailed) { + this.paymentsFailed = Optional.ofNullable(paymentsFailed); + return this; + } + + /** + *

The number of failed payment attempts for the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "payments_failed", nulls = Nulls.SKIP) + public _FinalStage paymentsFailed(Optional paymentsFailed) { + this.paymentsFailed = paymentsFailed; + return this; + } + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(Nullable paymentMethodType) { + if (paymentMethodType.isNull()) { + this.paymentMethodType = null; + } else if (paymentMethodType.isEmpty()) { + this.paymentMethodType = Optional.empty(); + } else { + this.paymentMethodType = Optional.of(paymentMethodType.get()); + } + return this; + } + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Optional.ofNullable(paymentMethodType); + return this; + } + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_type", nulls = Nulls.SKIP) + public _FinalStage paymentMethodType(Optional paymentMethodType) { + this.paymentMethodType = paymentMethodType; + return this; + } + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethod(Nullable paymentMethod) { + if (paymentMethod.isNull()) { + this.paymentMethod = null; + } else if (paymentMethod.isEmpty()) { + this.paymentMethod = Optional.empty(); + } else { + this.paymentMethod = Optional.of(paymentMethod.get()); + } + return this; + } + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethod(PaymentListItemPaymentMethod paymentMethod) { + this.paymentMethod = Optional.ofNullable(paymentMethod); + return this; + } + + /** + *

The tokenized payment method reference used for this payment. Null if no token was used.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method", nulls = Nulls.SKIP) + public _FinalStage paymentMethod(Optional paymentMethod) { + this.paymentMethod = paymentMethod; + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentInstrument(Nullable paymentInstrument) { + if (paymentInstrument.isNull()) { + this.paymentInstrument = null; + } else if (paymentInstrument.isEmpty()) { + this.paymentInstrument = Optional.empty(); + } else { + this.paymentInstrument = Optional.of(paymentInstrument.get()); + } + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentInstrument(PaymentListItemPaymentInstrument paymentInstrument) { + this.paymentInstrument = Optional.ofNullable(paymentInstrument); + return this; + } + + /** + *

The instrument this payment was made with, shaped for display: the method type, a buyer-facing name, the standard icon set, and the card facts when it was a card. Null when the receipt names no payment method.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_instrument", nulls = Nulls.SKIP) + public _FinalStage paymentInstrument(Optional paymentInstrument) { + this.paymentInstrument = paymentInstrument; + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidAt(Nullable paidAt) { + if (paidAt.isNull()) { + this.paidAt = null; + } else if (paidAt.isEmpty()) { + this.paidAt = Optional.empty(); + } else { + this.paidAt = Optional.of(paidAt.get()); + } + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidAt(OffsetDateTime paidAt) { + this.paidAt = Optional.ofNullable(paidAt); + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "paid_at", nulls = Nulls.SKIP) + public _FinalStage paidAt(Optional paidAt) { + this.paidAt = paidAt; + return this; + } + + /** + *

The time of the next schedule payment retry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nextPaymentAttempt(Nullable nextPaymentAttempt) { + if (nextPaymentAttempt.isNull()) { + this.nextPaymentAttempt = null; + } else if (nextPaymentAttempt.isEmpty()) { + this.nextPaymentAttempt = Optional.empty(); + } else { + this.nextPaymentAttempt = Optional.of(nextPaymentAttempt.get()); + } + return this; + } + + /** + *

The time of the next schedule payment retry.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nextPaymentAttempt(OffsetDateTime nextPaymentAttempt) { + this.nextPaymentAttempt = Optional.ofNullable(nextPaymentAttempt); + return this; + } + + /** + *

The time of the next schedule payment retry.

+ */ + @java.lang.Override + @JsonSetter(value = "next_payment_attempt", nulls = Nulls.SKIP) + public _FinalStage nextPaymentAttempt(Optional nextPaymentAttempt) { + this.nextPaymentAttempt = nextPaymentAttempt; + return this; + } + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage needsTracking(Nullable needsTracking) { + if (needsTracking.isNull()) { + this.needsTracking = null; + } else if (needsTracking.isEmpty()) { + this.needsTracking = Optional.empty(); + } else { + this.needsTracking = Optional.of(needsTracking.get()); + } + return this; + } + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage needsTracking(Boolean needsTracking) { + this.needsTracking = Optional.ofNullable(needsTracking); + return this; + } + + /** + *

Whether this payment is holding funds until the order ships and has no tracking number yet.

+ */ + @java.lang.Override + @JsonSetter(value = "needs_tracking", nulls = Nulls.SKIP) + public _FinalStage needsTracking(Optional needsTracking) { + this.needsTracking = needsTracking; + return this; + } + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The membership attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage membership(Nullable membership) { + if (membership.isNull()) { + this.membership = null; + } else if (membership.isEmpty()) { + this.membership = Optional.empty(); + } else { + this.membership = Optional.of(membership.get()); + } + return this; + } + + /** + *

The membership attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage membership(PaymentListItemMembership membership) { + this.membership = Optional.ofNullable(membership); + return this; + } + + /** + *

The membership attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "membership", nulls = Nulls.SKIP) + public _FinalStage membership(Optional membership) { + this.membership = membership; + return this; + } + + /** + *

The member attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(Nullable member) { + if (member.isNull()) { + this.member = null; + } else if (member.isEmpty()) { + this.member = Optional.empty(); + } else { + this.member = Optional.of(member.get()); + } + return this; + } + + /** + *

The member attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(PaymentListItemMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + /** + *

The member attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public _FinalStage member(Optional member) { + this.member = member; + return this; + } + + /** + *

The time of the last payment attempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaymentAttempt(Nullable lastPaymentAttempt) { + if (lastPaymentAttempt.isNull()) { + this.lastPaymentAttempt = null; + } else if (lastPaymentAttempt.isEmpty()) { + this.lastPaymentAttempt = Optional.empty(); + } else { + this.lastPaymentAttempt = Optional.of(lastPaymentAttempt.get()); + } + return this; + } + + /** + *

The time of the last payment attempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaymentAttempt(OffsetDateTime lastPaymentAttempt) { + this.lastPaymentAttempt = Optional.ofNullable(lastPaymentAttempt); + return this; + } + + /** + *

The time of the last payment attempt.

+ */ + @java.lang.Override + @JsonSetter(value = "last_payment_attempt", nulls = Nulls.SKIP) + public _FinalStage lastPaymentAttempt(Optional lastPaymentAttempt) { + this.lastPaymentAttempt = lastPaymentAttempt; + return this; + } + + /** + *

If the payment failed, the reason for the failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureMessage(Nullable failureMessage) { + if (failureMessage.isNull()) { + this.failureMessage = null; + } else if (failureMessage.isEmpty()) { + this.failureMessage = Optional.empty(); + } else { + this.failureMessage = Optional.of(failureMessage.get()); + } + return this; + } + + /** + *

If the payment failed, the reason for the failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureMessage(String failureMessage) { + this.failureMessage = Optional.ofNullable(failureMessage); + return this; + } + + /** + *

If the payment failed, the reason for the failure.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_message", nulls = Nulls.SKIP) + public _FinalStage failureMessage(Optional failureMessage) { + this.failureMessage = failureMessage; + return this; + } + + /** + *

When an alert came in that this transaction will be disputed

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputeAlertedAt(Nullable disputeAlertedAt) { + if (disputeAlertedAt.isNull()) { + this.disputeAlertedAt = null; + } else if (disputeAlertedAt.isEmpty()) { + this.disputeAlertedAt = Optional.empty(); + } else { + this.disputeAlertedAt = Optional.of(disputeAlertedAt.get()); + } + return this; + } + + /** + *

When an alert came in that this transaction will be disputed

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputeAlertedAt(OffsetDateTime disputeAlertedAt) { + this.disputeAlertedAt = Optional.ofNullable(disputeAlertedAt); + return this; + } + + /** + *

When an alert came in that this transaction will be disputed

+ */ + @java.lang.Override + @JsonSetter(value = "dispute_alerted_at", nulls = Nulls.SKIP) + public _FinalStage disputeAlertedAt(Optional disputeAlertedAt) { + this.disputeAlertedAt = disputeAlertedAt; + return this; + } + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage declineCode(Nullable declineCode) { + if (declineCode.isNull()) { + this.declineCode = null; + } else if (declineCode.isEmpty()) { + this.declineCode = Optional.empty(); + } else { + this.declineCode = Optional.of(declineCode.get()); + } + return this; + } + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage declineCode(PaymentDeclineCodes declineCode) { + this.declineCode = Optional.ofNullable(declineCode); + return this; + } + + /** + *

The reason the payment was declined. Null if the payment did not fail.

+ */ + @java.lang.Override + @JsonSetter(value = "decline_code", nulls = Nulls.SKIP) + public _FinalStage declineCode(Optional declineCode) { + this.declineCode = declineCode; + return this; + } + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerPhone(Nullable customerPhone) { + if (customerPhone.isNull()) { + this.customerPhone = null; + } else if (customerPhone.isEmpty()) { + this.customerPhone = Optional.empty(); + } else { + this.customerPhone = Optional.of(customerPhone.get()); + } + return this; + } + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerPhone(String customerPhone) { + this.customerPhone = Optional.ofNullable(customerPhone); + return this; + } + + /** + *

Phone number the customer provided at checkout, or their verified phone number when your checkout requires phone verification. null when no phone number was collected.

+ */ + @java.lang.Override + @JsonSetter(value = "customer_phone", nulls = Nulls.SKIP) + public _FinalStage customerPhone(Optional customerPhone) { + this.customerPhone = customerPhone; + return this; + } + + /** + *

The company for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(Nullable company) { + if (company.isNull()) { + this.company = null; + } else if (company.isEmpty()) { + this.company = Optional.empty(); + } else { + this.company = Optional.of(company.get()); + } + return this; + } + + /** + *

The company for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(PaymentListItemCompany company) { + this.company = Optional.ofNullable(company); + return this; + } + + /** + *

The company for the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfigurationId(Nullable checkoutConfigurationId) { + if (checkoutConfigurationId.isNull()) { + this.checkoutConfigurationId = null; + } else if (checkoutConfigurationId.isEmpty()) { + this.checkoutConfigurationId = Optional.empty(); + } else { + this.checkoutConfigurationId = Optional.of(checkoutConfigurationId.get()); + } + return this; + } + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfigurationId(String checkoutConfigurationId) { + this.checkoutConfigurationId = Optional.ofNullable(checkoutConfigurationId); + return this; + } + + /** + *

The ID of the checkout session/configuration that produced this payment, if any. Use this to map payments back to the checkout configuration that created them.

+ */ + @java.lang.Override + @JsonSetter(value = "checkout_configuration_id", nulls = Nulls.SKIP) + public _FinalStage checkoutConfigurationId(Optional checkoutConfigurationId) { + this.checkoutConfigurationId = checkoutConfigurationId; + return this; + } + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardLast4(Nullable cardLast4) { + if (cardLast4.isNull()) { + this.cardLast4 = null; + } else if (cardLast4.isEmpty()) { + this.cardLast4 = Optional.empty(); + } else { + this.cardLast4 = Optional.of(cardLast4.get()); + } + return this; + } + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardLast4(String cardLast4) { + this.cardLast4 = Optional.ofNullable(cardLast4); + return this; + } + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ */ + @java.lang.Override + @JsonSetter(value = "card_last4", nulls = Nulls.SKIP) + public _FinalStage cardLast4(Optional cardLast4) { + this.cardLast4 = cardLast4; + return this; + } + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(Nullable cardBrand) { + if (cardBrand.isNull()) { + this.cardBrand = null; + } else if (cardBrand.isEmpty()) { + this.cardBrand = Optional.empty(); + } else { + this.cardBrand = Optional.of(cardBrand.get()); + } + return this; + } + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(CardBrands cardBrand) { + this.cardBrand = Optional.ofNullable(cardBrand); + return this; + } + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ */ + @java.lang.Override + @JsonSetter(value = "card_brand", nulls = Nulls.SKIP) + public _FinalStage cardBrand(Optional cardBrand) { + this.cardBrand = cardBrand; + return this; + } + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingReason(Nullable billingReason) { + if (billingReason.isNull()) { + this.billingReason = null; + } else if (billingReason.isEmpty()) { + this.billingReason = Optional.empty(); + } else { + this.billingReason = Optional.of(billingReason.get()); + } + return this; + } + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingReason(BillingReasons billingReason) { + this.billingReason = Optional.ofNullable(billingReason); + return this; + } + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_reason", nulls = Nulls.SKIP) + public _FinalStage billingReason(Optional billingReason) { + this.billingReason = billingReason; + return this; + } + + /** + *

The address of the user who made the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingAddress(Nullable billingAddress) { + if (billingAddress.isNull()) { + this.billingAddress = null; + } else if (billingAddress.isEmpty()) { + this.billingAddress = Optional.empty(); + } else { + this.billingAddress = Optional.of(billingAddress.get()); + } + return this; + } + + /** + *

The address of the user who made the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingAddress(PaymentListItemBillingAddress billingAddress) { + this.billingAddress = Optional.ofNullable(billingAddress); + return this; + } + + /** + *

The address of the user who made the payment.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_address", nulls = Nulls.SKIP) + public _FinalStage billingAddress(Optional billingAddress) { + this.billingAddress = billingAddress; + return this; + } + + /** + *

The application fee charged on this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage applicationFee(Nullable applicationFee) { + if (applicationFee.isNull()) { + this.applicationFee = null; + } else if (applicationFee.isEmpty()) { + this.applicationFee = Optional.empty(); + } else { + this.applicationFee = Optional.of(applicationFee.get()); + } + return this; + } + + /** + *

The application fee charged on this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage applicationFee(PaymentListItemApplicationFee applicationFee) { + this.applicationFee = Optional.ofNullable(applicationFee); + return this; + } + + /** + *

The application fee charged on this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "application_fee", nulls = Nulls.SKIP) + public _FinalStage applicationFee(Optional applicationFee) { + this.applicationFee = applicationFee; + return this; + } + + @java.lang.Override + public PaymentListItem build() { + return new PaymentListItem( + amountAfterFees, + applicationFee, + autoRefunded, + billingAddress, + billingReason, + cardBrand, + cardLast4, + checkoutConfigurationId, + company, + createdAt, + currency, + customerPhone, + declineCode, + disputeAlertedAt, + failureMessage, + id, + lastPaymentAttempt, + member, + membership, + metadata, + needsTracking, + nextPaymentAttempt, + paidAt, + paymentInstrument, + paymentMethod, + paymentMethodType, + paymentsFailed, + plan, + product, + promoCode, + refundable, + refundedAmount, + refundedAt, + retryable, + settlementCurrency, + shipment, + shippingAddress, + status, + substatus, + subtotal, + taxAmount, + taxBehavior, + total, + updatedAt, + usdTotal, + user, + voidable, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemApplicationFee.java b/src/main/java/com/whop/api/types/PaymentListItemApplicationFee.java new file mode 100644 index 00000000..c1a7b804 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemApplicationFee.java @@ -0,0 +1,316 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemApplicationFee.Builder.class) +public final class PaymentListItemApplicationFee { + private final double amount; + + private final double amountCaptured; + + private final double amountRefunded; + + private final OffsetDateTime createdAt; + + private final Currencies currency; + + private final String id; + + private final Map additionalProperties; + + private PaymentListItemApplicationFee( + double amount, + double amountCaptured, + double amountRefunded, + OffsetDateTime createdAt, + Currencies currency, + String id, + Map additionalProperties) { + this.amount = amount; + this.amountCaptured = amountCaptured; + this.amountRefunded = amountRefunded; + this.createdAt = createdAt; + this.currency = currency; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The application fee amount. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The amount of the application fee that has been captured. + */ + @JsonProperty("amount_captured") + public double getAmountCaptured() { + return amountCaptured; + } + + /** + * @return The amount of the application fee that has been refunded. + */ + @JsonProperty("amount_refunded") + public double getAmountRefunded() { + return amountRefunded; + } + + /** + * @return The datetime the application fee was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The currency of the application fee. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The unique identifier for the application fee. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemApplicationFee && equalTo((PaymentListItemApplicationFee) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemApplicationFee other) { + return amount == other.amount + && amountCaptured == other.amountCaptured + && amountRefunded == other.amountRefunded + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, this.amountCaptured, this.amountRefunded, this.createdAt, this.currency, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The application fee amount.

+ */ + AmountCapturedStage amount(double amount); + + Builder from(PaymentListItemApplicationFee other); + } + + public interface AmountCapturedStage { + /** + *

The amount of the application fee that has been captured.

+ */ + AmountRefundedStage amountCaptured(double amountCaptured); + } + + public interface AmountRefundedStage { + /** + *

The amount of the application fee that has been refunded.

+ */ + CreatedAtStage amountRefunded(double amountRefunded); + } + + public interface CreatedAtStage { + /** + *

The datetime the application fee was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

The currency of the application fee.

+ */ + IdStage currency(@NotNull Currencies currency); + } + + public interface IdStage { + /** + *

The unique identifier for the application fee.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + PaymentListItemApplicationFee build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + AmountCapturedStage, + AmountRefundedStage, + CreatedAtStage, + CurrencyStage, + IdStage, + _FinalStage { + private double amount; + + private double amountCaptured; + + private double amountRefunded; + + private OffsetDateTime createdAt; + + private Currencies currency; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemApplicationFee other) { + amount(other.getAmount()); + amountCaptured(other.getAmountCaptured()); + amountRefunded(other.getAmountRefunded()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + id(other.getId()); + return this; + } + + /** + *

The application fee amount.

+ *

The application fee amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public AmountCapturedStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The amount of the application fee that has been captured.

+ *

The amount of the application fee that has been captured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount_captured") + public AmountRefundedStage amountCaptured(double amountCaptured) { + this.amountCaptured = amountCaptured; + return this; + } + + /** + *

The amount of the application fee that has been refunded.

+ *

The amount of the application fee that has been refunded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount_refunded") + public CreatedAtStage amountRefunded(double amountRefunded) { + this.amountRefunded = amountRefunded; + return this; + } + + /** + *

The datetime the application fee was created.

+ *

The datetime the application fee was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The currency of the application fee.

+ *

The currency of the application fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier for the application fee.

+ *

The unique identifier for the application fee.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public PaymentListItemApplicationFee build() { + return new PaymentListItemApplicationFee( + amount, amountCaptured, amountRefunded, createdAt, currency, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemBillingAddress.java b/src/main/java/com/whop/api/types/PaymentListItemBillingAddress.java new file mode 100644 index 00000000..acf0550c --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemBillingAddress.java @@ -0,0 +1,437 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemBillingAddress.Builder.class) +public final class PaymentListItemBillingAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional name; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private PaymentListItemBillingAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional name, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.name = name; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The name of the customer. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemBillingAddress && equalTo((PaymentListItemBillingAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemBillingAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && name.equals(other.name) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.name, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentListItemBillingAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + name(other.getName()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The name of the customer.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public PaymentListItemBillingAddress build() { + return new PaymentListItemBillingAddress( + city, country, line1, line2, name, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemCompany.java b/src/main/java/com/whop/api/types/PaymentListItemCompany.java new file mode 100644 index 00000000..901c0c93 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemCompany.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemCompany.Builder.class) +public final class PaymentListItemCompany { + private final String id; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private PaymentListItemCompany(String id, String route, String title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The slug/route of the company on the Whop site. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return The written name of the company. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemCompany && equalTo((PaymentListItemCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + RouteStage id(@NotNull String id); + + Builder from(PaymentListItemCompany other); + } + + public interface RouteStage { + /** + *

The slug/route of the company on the Whop site.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

The written name of the company.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + PaymentListItemCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The slug/route of the company on the Whop site.

+ *

The slug/route of the company on the Whop site.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

The written name of the company.

+ *

The written name of the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public PaymentListItemCompany build() { + return new PaymentListItemCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemMember.java b/src/main/java/com/whop/api/types/PaymentListItemMember.java new file mode 100644 index 00000000..d24fbcd1 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemMember.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemMember.Builder.class) +public final class PaymentListItemMember { + private final String id; + + private final Optional phone; + + private final Map additionalProperties; + + private PaymentListItemMember(String id, Optional phone, Map additionalProperties) { + this.id = id; + this.phone = phone; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company member. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The phone number for the member, if available. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemMember && equalTo((PaymentListItemMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemMember other) { + return id.equals(other.id) && phone.equals(other.phone); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.phone); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company member.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PaymentListItemMember other); + } + + public interface _FinalStage { + PaymentListItemMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The phone number for the member, if available.

+ */ + _FinalStage phone(Optional phone); + + _FinalStage phone(String phone); + + _FinalStage phone(Nullable phone); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional phone = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemMember other) { + id(other.getId()); + phone(other.getPhone()); + return this; + } + + /** + *

The unique identifier for the company member.

+ *

The unique identifier for the company member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The phone number for the member, if available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

The phone number for the member, if available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + /** + *

The phone number for the member, if available.

+ */ + @java.lang.Override + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public _FinalStage phone(Optional phone) { + this.phone = phone; + return this; + } + + @java.lang.Override + public PaymentListItemMember build() { + return new PaymentListItemMember(id, phone, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemMembership.java b/src/main/java/com/whop/api/types/PaymentListItemMembership.java new file mode 100644 index 00000000..486360fc --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemMembership.java @@ -0,0 +1,239 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemMembership.Builder.class) +public final class PaymentListItemMembership { + private final String id; + + private final Optional phoneNumber; + + private final MembershipStatus status; + + private final Map additionalProperties; + + private PaymentListItemMembership( + String id, + Optional phoneNumber, + MembershipStatus status, + Map additionalProperties) { + this.id = id; + this.phoneNumber = phoneNumber; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the membership. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The phone number associated with this membership. + */ + @JsonIgnore + public Optional getPhoneNumber() { + if (phoneNumber == null) { + return Optional.empty(); + } + return phoneNumber; + } + + /** + * @return The state of the membership. + */ + @JsonProperty("status") + public MembershipStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone_number") + private Optional _getPhoneNumber() { + return phoneNumber; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemMembership && equalTo((PaymentListItemMembership) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemMembership other) { + return id.equals(other.id) && phoneNumber.equals(other.phoneNumber) && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.phoneNumber, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the membership.

+ */ + StatusStage id(@NotNull String id); + + Builder from(PaymentListItemMembership other); + } + + public interface StatusStage { + /** + *

The state of the membership.

+ */ + _FinalStage status(@NotNull MembershipStatus status); + } + + public interface _FinalStage { + PaymentListItemMembership build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The phone number associated with this membership.

+ */ + _FinalStage phoneNumber(Optional phoneNumber); + + _FinalStage phoneNumber(String phoneNumber); + + _FinalStage phoneNumber(Nullable phoneNumber); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, StatusStage, _FinalStage { + private String id; + + private MembershipStatus status; + + private Optional phoneNumber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemMembership other) { + id(other.getId()); + phoneNumber(other.getPhoneNumber()); + status(other.getStatus()); + return this; + } + + /** + *

The unique identifier for the membership.

+ *

The unique identifier for the membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The state of the membership.

+ *

The state of the membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull MembershipStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The phone number associated with this membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneNumber(Nullable phoneNumber) { + if (phoneNumber.isNull()) { + this.phoneNumber = null; + } else if (phoneNumber.isEmpty()) { + this.phoneNumber = Optional.empty(); + } else { + this.phoneNumber = Optional.of(phoneNumber.get()); + } + return this; + } + + /** + *

The phone number associated with this membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneNumber(String phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + /** + *

The phone number associated with this membership.

+ */ + @java.lang.Override + @JsonSetter(value = "phone_number", nulls = Nulls.SKIP) + public _FinalStage phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + @java.lang.Override + public PaymentListItemMembership build() { + return new PaymentListItemMembership(id, phoneNumber, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrument.java b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrument.java new file mode 100644 index 00000000..02f9a115 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrument.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemPaymentInstrument.Builder.class) +public final class PaymentListItemPaymentInstrument { + private final Optional card; + + private final String displayName; + + private final PaymentListItemPaymentInstrumentIcons icons; + + private final Optional installmentCount; + + private final String paymentMethodType; + + private final Map additionalProperties; + + private PaymentListItemPaymentInstrument( + Optional card, + String displayName, + PaymentListItemPaymentInstrumentIcons icons, + Optional installmentCount, + String paymentMethodType, + Map additionalProperties) { + this.card = card; + this.displayName = displayName; + this.icons = icons; + this.installmentCount = installmentCount; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return Card payments only: the card's network and last four. + */ + @JsonIgnore + public Optional getCard() { + if (card == null) { + return Optional.empty(); + } + return card; + } + + /** + * @return Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna"). + */ + @JsonProperty("display_name") + public String getDisplayName() { + return displayName; + } + + /** + * @return The standard icon set: square and card shapes, each in light and dark colorways. + */ + @JsonProperty("icons") + public PaymentListItemPaymentInstrumentIcons getIcons() { + return icons; + } + + /** + * @return Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side. + */ + @JsonIgnore + public Optional getInstallmentCount() { + if (installmentCount == null) { + return Optional.empty(); + } + return installmentCount; + } + + /** + * @return The payment method type identifier, e.g. card, klarna, apple_pay. + */ + @JsonProperty("payment_method_type") + public String getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card") + private Optional _getCard() { + return card; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("installment_count") + private Optional _getInstallmentCount() { + return installmentCount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemPaymentInstrument && equalTo((PaymentListItemPaymentInstrument) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemPaymentInstrument other) { + return card.equals(other.card) + && displayName.equals(other.displayName) + && icons.equals(other.icons) + && installmentCount.equals(other.installmentCount) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.displayName, this.icons, this.installmentCount, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DisplayNameStage builder() { + return new Builder(); + } + + public interface DisplayNameStage { + /** + *

Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna").

+ */ + IconsStage displayName(@NotNull String displayName); + + Builder from(PaymentListItemPaymentInstrument other); + } + + public interface IconsStage { + /** + *

The standard icon set: square and card shapes, each in light and dark colorways.

+ */ + PaymentMethodTypeStage icons(@NotNull PaymentListItemPaymentInstrumentIcons icons); + } + + public interface PaymentMethodTypeStage { + /** + *

The payment method type identifier, e.g. card, klarna, apple_pay.

+ */ + _FinalStage paymentMethodType(@NotNull String paymentMethodType); + } + + public interface _FinalStage { + PaymentListItemPaymentInstrument build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Card payments only: the card's network and last four.

+ */ + _FinalStage card(Optional card); + + _FinalStage card(PaymentListItemPaymentInstrumentCard card); + + _FinalStage card(Nullable card); + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ */ + _FinalStage installmentCount(Optional installmentCount); + + _FinalStage installmentCount(Integer installmentCount); + + _FinalStage installmentCount(Nullable installmentCount); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DisplayNameStage, IconsStage, PaymentMethodTypeStage, _FinalStage { + private String displayName; + + private PaymentListItemPaymentInstrumentIcons icons; + + private String paymentMethodType; + + private Optional installmentCount = Optional.empty(); + + private Optional card = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemPaymentInstrument other) { + card(other.getCard()); + displayName(other.getDisplayName()); + icons(other.getIcons()); + installmentCount(other.getInstallmentCount()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna").

+ *

Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("display_name") + public IconsStage displayName(@NotNull String displayName) { + this.displayName = Objects.requireNonNull(displayName, "displayName must not be null"); + return this; + } + + /** + *

The standard icon set: square and card shapes, each in light and dark colorways.

+ *

The standard icon set: square and card shapes, each in light and dark colorways.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public PaymentMethodTypeStage icons(@NotNull PaymentListItemPaymentInstrumentIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

The payment method type identifier, e.g. card, klarna, apple_pay.

+ *

The payment method type identifier, e.g. card, klarna, apple_pay.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull String paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage installmentCount(Nullable installmentCount) { + if (installmentCount.isNull()) { + this.installmentCount = null; + } else if (installmentCount.isEmpty()) { + this.installmentCount = Optional.empty(); + } else { + this.installmentCount = Optional.of(installmentCount.get()); + } + return this; + } + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage installmentCount(Integer installmentCount) { + this.installmentCount = Optional.ofNullable(installmentCount); + return this; + } + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ */ + @java.lang.Override + @JsonSetter(value = "installment_count", nulls = Nulls.SKIP) + public _FinalStage installmentCount(Optional installmentCount) { + this.installmentCount = installmentCount; + return this; + } + + /** + *

Card payments only: the card's network and last four.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(Nullable card) { + if (card.isNull()) { + this.card = null; + } else if (card.isEmpty()) { + this.card = Optional.empty(); + } else { + this.card = Optional.of(card.get()); + } + return this; + } + + /** + *

Card payments only: the card's network and last four.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(PaymentListItemPaymentInstrumentCard card) { + this.card = Optional.ofNullable(card); + return this; + } + + /** + *

Card payments only: the card's network and last four.

+ */ + @java.lang.Override + @JsonSetter(value = "card", nulls = Nulls.SKIP) + public _FinalStage card(Optional card) { + this.card = card; + return this; + } + + @java.lang.Override + public PaymentListItemPaymentInstrument build() { + return new PaymentListItemPaymentInstrument( + card, displayName, icons, installmentCount, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentCard.java b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentCard.java new file mode 100644 index 00000000..53bd0c8d --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentCard.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemPaymentInstrumentCard.Builder.class) +public final class PaymentListItemPaymentInstrumentCard { + private final String brand; + + private final Optional last4; + + private final Map additionalProperties; + + private PaymentListItemPaymentInstrumentCard( + String brand, Optional last4, Map additionalProperties) { + this.brand = brand; + this.last4 = last4; + this.additionalProperties = additionalProperties; + } + + /** + * @return The network identifier (visa, amex, …), matching card.networks entries and saved card payment methods. + */ + @JsonProperty("brand") + public String getBrand() { + return brand; + } + + /** + * @return The card's last four digits, when captured. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemPaymentInstrumentCard + && equalTo((PaymentListItemPaymentInstrumentCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemPaymentInstrumentCard other) { + return brand.equals(other.brand) && last4.equals(other.last4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.brand, this.last4); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BrandStage builder() { + return new Builder(); + } + + public interface BrandStage { + /** + *

The network identifier (visa, amex, …), matching card.networks entries and saved card payment methods.

+ */ + _FinalStage brand(@NotNull String brand); + + Builder from(PaymentListItemPaymentInstrumentCard other); + } + + public interface _FinalStage { + PaymentListItemPaymentInstrumentCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The card's last four digits, when captured.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BrandStage, _FinalStage { + private String brand; + + private Optional last4 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemPaymentInstrumentCard other) { + brand(other.getBrand()); + last4(other.getLast4()); + return this; + } + + /** + *

The network identifier (visa, amex, …), matching card.networks entries and saved card payment methods.

+ *

The network identifier (visa, amex, …), matching card.networks entries and saved card payment methods.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("brand") + public _FinalStage brand(@NotNull String brand) { + this.brand = Objects.requireNonNull(brand, "brand must not be null"); + return this; + } + + /** + *

The card's last four digits, when captured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

The card's last four digits, when captured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

The card's last four digits, when captured.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + @java.lang.Override + public PaymentListItemPaymentInstrumentCard build() { + return new PaymentListItemPaymentInstrumentCard(brand, last4, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIcons.java b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIcons.java new file mode 100644 index 00000000..a7aab659 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIcons.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemPaymentInstrumentIcons.Builder.class) +public final class PaymentListItemPaymentInstrumentIcons { + private final PaymentListItemPaymentInstrumentIconsCard card; + + private final PaymentListItemPaymentInstrumentIconsSquare square; + + private final Map additionalProperties; + + private PaymentListItemPaymentInstrumentIcons( + PaymentListItemPaymentInstrumentIconsCard card, + PaymentListItemPaymentInstrumentIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentListItemPaymentInstrumentIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentListItemPaymentInstrumentIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemPaymentInstrumentIcons + && equalTo((PaymentListItemPaymentInstrumentIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemPaymentInstrumentIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentListItemPaymentInstrumentIconsCard card); + + Builder from(PaymentListItemPaymentInstrumentIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentListItemPaymentInstrumentIconsSquare square); + } + + public interface _FinalStage { + PaymentListItemPaymentInstrumentIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentListItemPaymentInstrumentIconsCard card; + + private PaymentListItemPaymentInstrumentIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemPaymentInstrumentIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentListItemPaymentInstrumentIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentListItemPaymentInstrumentIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentListItemPaymentInstrumentIcons build() { + return new PaymentListItemPaymentInstrumentIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsCard.java b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsCard.java new file mode 100644 index 00000000..d0533b55 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsCard.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemPaymentInstrumentIconsCard.Builder.class) +public final class PaymentListItemPaymentInstrumentIconsCard { + private final PaymentListItemPaymentInstrumentIconsCardDark dark; + + private final PaymentListItemPaymentInstrumentIconsCardLight light; + + private final Map additionalProperties; + + private PaymentListItemPaymentInstrumentIconsCard( + PaymentListItemPaymentInstrumentIconsCardDark dark, + PaymentListItemPaymentInstrumentIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentListItemPaymentInstrumentIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentListItemPaymentInstrumentIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemPaymentInstrumentIconsCard + && equalTo((PaymentListItemPaymentInstrumentIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemPaymentInstrumentIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentListItemPaymentInstrumentIconsCardDark dark); + + Builder from(PaymentListItemPaymentInstrumentIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentListItemPaymentInstrumentIconsCardLight light); + } + + public interface _FinalStage { + PaymentListItemPaymentInstrumentIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentListItemPaymentInstrumentIconsCardDark dark; + + private PaymentListItemPaymentInstrumentIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemPaymentInstrumentIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentListItemPaymentInstrumentIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentListItemPaymentInstrumentIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentListItemPaymentInstrumentIconsCard build() { + return new PaymentListItemPaymentInstrumentIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsCardDark.java new file mode 100644 index 00000000..1d95e3e9 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsCardDark.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemPaymentInstrumentIconsCardDark.Builder.class) +public final class PaymentListItemPaymentInstrumentIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentListItemPaymentInstrumentIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemPaymentInstrumentIconsCardDark + && equalTo((PaymentListItemPaymentInstrumentIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemPaymentInstrumentIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentListItemPaymentInstrumentIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentListItemPaymentInstrumentIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemPaymentInstrumentIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentListItemPaymentInstrumentIconsCardDark build() { + return new PaymentListItemPaymentInstrumentIconsCardDark(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsCardLight.java new file mode 100644 index 00000000..59d64229 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsCardLight.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemPaymentInstrumentIconsCardLight.Builder.class) +public final class PaymentListItemPaymentInstrumentIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentListItemPaymentInstrumentIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemPaymentInstrumentIconsCardLight + && equalTo((PaymentListItemPaymentInstrumentIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemPaymentInstrumentIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentListItemPaymentInstrumentIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentListItemPaymentInstrumentIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemPaymentInstrumentIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentListItemPaymentInstrumentIconsCardLight build() { + return new PaymentListItemPaymentInstrumentIconsCardLight(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsSquare.java b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsSquare.java new file mode 100644 index 00000000..5ca8eeb7 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemPaymentInstrumentIconsSquare.Builder.class) +public final class PaymentListItemPaymentInstrumentIconsSquare { + private final PaymentListItemPaymentInstrumentIconsSquareDark dark; + + private final PaymentListItemPaymentInstrumentIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentListItemPaymentInstrumentIconsSquare( + PaymentListItemPaymentInstrumentIconsSquareDark dark, + PaymentListItemPaymentInstrumentIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentListItemPaymentInstrumentIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentListItemPaymentInstrumentIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemPaymentInstrumentIconsSquare + && equalTo((PaymentListItemPaymentInstrumentIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemPaymentInstrumentIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentListItemPaymentInstrumentIconsSquareDark dark); + + Builder from(PaymentListItemPaymentInstrumentIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentListItemPaymentInstrumentIconsSquareLight light); + } + + public interface _FinalStage { + PaymentListItemPaymentInstrumentIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentListItemPaymentInstrumentIconsSquareDark dark; + + private PaymentListItemPaymentInstrumentIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemPaymentInstrumentIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentListItemPaymentInstrumentIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentListItemPaymentInstrumentIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentListItemPaymentInstrumentIconsSquare build() { + return new PaymentListItemPaymentInstrumentIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsSquareDark.java new file mode 100644 index 00000000..7882ea2c --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsSquareDark.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemPaymentInstrumentIconsSquareDark.Builder.class) +public final class PaymentListItemPaymentInstrumentIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentListItemPaymentInstrumentIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemPaymentInstrumentIconsSquareDark + && equalTo((PaymentListItemPaymentInstrumentIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemPaymentInstrumentIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentListItemPaymentInstrumentIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentListItemPaymentInstrumentIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemPaymentInstrumentIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentListItemPaymentInstrumentIconsSquareDark build() { + return new PaymentListItemPaymentInstrumentIconsSquareDark(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsSquareLight.java new file mode 100644 index 00000000..bed83855 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemPaymentInstrumentIconsSquareLight.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemPaymentInstrumentIconsSquareLight.Builder.class) +public final class PaymentListItemPaymentInstrumentIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentListItemPaymentInstrumentIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemPaymentInstrumentIconsSquareLight + && equalTo((PaymentListItemPaymentInstrumentIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemPaymentInstrumentIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentListItemPaymentInstrumentIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentListItemPaymentInstrumentIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemPaymentInstrumentIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentListItemPaymentInstrumentIconsSquareLight build() { + return new PaymentListItemPaymentInstrumentIconsSquareLight(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemPaymentMethod.java b/src/main/java/com/whop/api/types/PaymentListItemPaymentMethod.java new file mode 100644 index 00000000..c7b10f18 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemPaymentMethod.java @@ -0,0 +1,277 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemPaymentMethod.Builder.class) +public final class PaymentListItemPaymentMethod { + private final Optional card; + + private final OffsetDateTime createdAt; + + private final String id; + + private final PaymentMethodTypes paymentMethodType; + + private final Map additionalProperties; + + private PaymentListItemPaymentMethod( + Optional card, + OffsetDateTime createdAt, + String id, + PaymentMethodTypes paymentMethodType, + Map additionalProperties) { + this.card = card; + this.createdAt = createdAt; + this.id = id; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The card data associated with the payment method, if its a debit or credit card. + */ + @JsonIgnore + public Optional getCard() { + if (card == null) { + return Optional.empty(); + } + return card; + } + + /** + * @return The datetime the payment token was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the payment token. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The payment method type of the payment method + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card") + private Optional _getCard() { + return card; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemPaymentMethod && equalTo((PaymentListItemPaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemPaymentMethod other) { + return card.equals(other.card) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.createdAt, this.id, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the payment token was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PaymentListItemPaymentMethod other); + } + + public interface IdStage { + /** + *

The unique identifier for the payment token.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The payment method type of the payment method

+ */ + _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface _FinalStage { + PaymentListItemPaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ */ + _FinalStage card(Optional card); + + _FinalStage card(PaymentListItemPaymentMethodCard card); + + _FinalStage card(Nullable card); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, PaymentMethodTypeStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + private Optional card = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemPaymentMethod other) { + card(other.getCard()); + createdAt(other.getCreatedAt()); + id(other.getId()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

The datetime the payment token was created.

+ *

The datetime the payment token was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the payment token.

+ *

The unique identifier for the payment token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The payment method type of the payment method

+ *

The payment method type of the payment method

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(Nullable card) { + if (card.isNull()) { + this.card = null; + } else if (card.isEmpty()) { + this.card = Optional.empty(); + } else { + this.card = Optional.of(card.get()); + } + return this; + } + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(PaymentListItemPaymentMethodCard card) { + this.card = Optional.ofNullable(card); + return this; + } + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ */ + @java.lang.Override + @JsonSetter(value = "card", nulls = Nulls.SKIP) + public _FinalStage card(Optional card) { + this.card = card; + return this; + } + + @java.lang.Override + public PaymentListItemPaymentMethod build() { + return new PaymentListItemPaymentMethod(card, createdAt, id, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemPaymentMethodCard.java b/src/main/java/com/whop/api/types/PaymentListItemPaymentMethodCard.java new file mode 100644 index 00000000..a7e0f819 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemPaymentMethodCard.java @@ -0,0 +1,337 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemPaymentMethodCard.Builder.class) +public final class PaymentListItemPaymentMethodCard { + private final Optional brand; + + private final Optional expMonth; + + private final Optional expYear; + + private final Optional fingerprint; + + private final Optional last4; + + private final Map additionalProperties; + + private PaymentListItemPaymentMethodCard( + Optional brand, + Optional expMonth, + Optional expYear, + Optional fingerprint, + Optional last4, + Map additionalProperties) { + this.brand = brand; + this.expMonth = expMonth; + this.expYear = expYear; + this.fingerprint = fingerprint; + this.last4 = last4; + this.additionalProperties = additionalProperties; + } + + /** + * @return The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined. + */ + @JsonIgnore + public Optional getBrand() { + if (brand == null) { + return Optional.empty(); + } + return brand; + } + + /** + * @return The two-digit expiration month of the card (1-12). Null if not available. + */ + @JsonIgnore + public Optional getExpMonth() { + if (expMonth == null) { + return Optional.empty(); + } + return expMonth; + } + + /** + * @return The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available. + */ + @JsonIgnore + public Optional getExpYear() { + if (expYear == null) { + return Optional.empty(); + } + return expYear; + } + + /** + * @return A stable identifier for the underlying card. Two payment methods with the same fingerprint are the same card. Null if not available. + */ + @JsonIgnore + public Optional getFingerprint() { + if (fingerprint == null) { + return Optional.empty(); + } + return fingerprint; + } + + /** + * @return The last four digits of the card number. Null if not available. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("brand") + private Optional _getBrand() { + return brand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_month") + private Optional _getExpMonth() { + return expMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_year") + private Optional _getExpYear() { + return expYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fingerprint") + private Optional _getFingerprint() { + return fingerprint; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemPaymentMethodCard && equalTo((PaymentListItemPaymentMethodCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemPaymentMethodCard other) { + return brand.equals(other.brand) + && expMonth.equals(other.expMonth) + && expYear.equals(other.expYear) + && fingerprint.equals(other.fingerprint) + && last4.equals(other.last4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.brand, this.expMonth, this.expYear, this.fingerprint, this.last4); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional brand = Optional.empty(); + + private Optional expMonth = Optional.empty(); + + private Optional expYear = Optional.empty(); + + private Optional fingerprint = Optional.empty(); + + private Optional last4 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentListItemPaymentMethodCard other) { + brand(other.getBrand()); + expMonth(other.getExpMonth()); + expYear(other.getExpYear()); + fingerprint(other.getFingerprint()); + last4(other.getLast4()); + return this; + } + + /** + *

The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined.

+ */ + @JsonSetter(value = "brand", nulls = Nulls.SKIP) + public Builder brand(Optional brand) { + this.brand = brand; + return this; + } + + public Builder brand(CardBrands brand) { + this.brand = Optional.ofNullable(brand); + return this; + } + + public Builder brand(Nullable brand) { + if (brand.isNull()) { + this.brand = null; + } else if (brand.isEmpty()) { + this.brand = Optional.empty(); + } else { + this.brand = Optional.of(brand.get()); + } + return this; + } + + /** + *

The two-digit expiration month of the card (1-12). Null if not available.

+ */ + @JsonSetter(value = "exp_month", nulls = Nulls.SKIP) + public Builder expMonth(Optional expMonth) { + this.expMonth = expMonth; + return this; + } + + public Builder expMonth(Integer expMonth) { + this.expMonth = Optional.ofNullable(expMonth); + return this; + } + + public Builder expMonth(Nullable expMonth) { + if (expMonth.isNull()) { + this.expMonth = null; + } else if (expMonth.isEmpty()) { + this.expMonth = Optional.empty(); + } else { + this.expMonth = Optional.of(expMonth.get()); + } + return this; + } + + /** + *

The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available.

+ */ + @JsonSetter(value = "exp_year", nulls = Nulls.SKIP) + public Builder expYear(Optional expYear) { + this.expYear = expYear; + return this; + } + + public Builder expYear(Integer expYear) { + this.expYear = Optional.ofNullable(expYear); + return this; + } + + public Builder expYear(Nullable expYear) { + if (expYear.isNull()) { + this.expYear = null; + } else if (expYear.isEmpty()) { + this.expYear = Optional.empty(); + } else { + this.expYear = Optional.of(expYear.get()); + } + return this; + } + + /** + *

A stable identifier for the underlying card. Two payment methods with the same fingerprint are the same card. Null if not available.

+ */ + @JsonSetter(value = "fingerprint", nulls = Nulls.SKIP) + public Builder fingerprint(Optional fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public Builder fingerprint(String fingerprint) { + this.fingerprint = Optional.ofNullable(fingerprint); + return this; + } + + public Builder fingerprint(Nullable fingerprint) { + if (fingerprint.isNull()) { + this.fingerprint = null; + } else if (fingerprint.isEmpty()) { + this.fingerprint = Optional.empty(); + } else { + this.fingerprint = Optional.of(fingerprint.get()); + } + return this; + } + + /** + *

The last four digits of the card number. Null if not available.

+ */ + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public Builder last4(Optional last4) { + this.last4 = last4; + return this; + } + + public Builder last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + public Builder last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + public PaymentListItemPaymentMethodCard build() { + return new PaymentListItemPaymentMethodCard( + brand, expMonth, expYear, fingerprint, last4, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemPlan.java b/src/main/java/com/whop/api/types/PaymentListItemPlan.java new file mode 100644 index 00000000..e6bb92cd --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemPlan.java @@ -0,0 +1,274 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemPlan.Builder.class) +public final class PaymentListItemPlan { + private final String id; + + private final Optional internalNotes; + + private final Optional> metadata; + + private final Map additionalProperties; + + private PaymentListItemPlan( + String id, + Optional internalNotes, + Optional> metadata, + Map additionalProperties) { + this.id = id; + this.internalNotes = internalNotes; + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the plan. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A personal description or notes section for the business. + */ + @JsonIgnore + public Optional getInternalNotes() { + if (internalNotes == null) { + return Optional.empty(); + } + return internalNotes; + } + + /** + * @return Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("internal_notes") + private Optional _getInternalNotes() { + return internalNotes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemPlan && equalTo((PaymentListItemPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemPlan other) { + return id.equals(other.id) && internalNotes.equals(other.internalNotes) && metadata.equals(other.metadata); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.internalNotes, this.metadata); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the plan.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PaymentListItemPlan other); + } + + public interface _FinalStage { + PaymentListItemPlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A personal description or notes section for the business.

+ */ + _FinalStage internalNotes(Optional internalNotes); + + _FinalStage internalNotes(String internalNotes); + + _FinalStage internalNotes(Nullable internalNotes); + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional> metadata = Optional.empty(); + + private Optional internalNotes = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemPlan other) { + id(other.getId()); + internalNotes(other.getInternalNotes()); + metadata(other.getMetadata()); + return this; + } + + /** + *

The unique identifier for the plan.

+ *

The unique identifier for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

A personal description or notes section for the business.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage internalNotes(Nullable internalNotes) { + if (internalNotes.isNull()) { + this.internalNotes = null; + } else if (internalNotes.isEmpty()) { + this.internalNotes = Optional.empty(); + } else { + this.internalNotes = Optional.of(internalNotes.get()); + } + return this; + } + + /** + *

A personal description or notes section for the business.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage internalNotes(String internalNotes) { + this.internalNotes = Optional.ofNullable(internalNotes); + return this; + } + + /** + *

A personal description or notes section for the business.

+ */ + @java.lang.Override + @JsonSetter(value = "internal_notes", nulls = Nulls.SKIP) + public _FinalStage internalNotes(Optional internalNotes) { + this.internalNotes = internalNotes; + return this; + } + + @java.lang.Override + public PaymentListItemPlan build() { + return new PaymentListItemPlan(id, internalNotes, metadata, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemProduct.java b/src/main/java/com/whop/api/types/PaymentListItemProduct.java new file mode 100644 index 00000000..36787aaf --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemProduct.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemProduct.Builder.class) +public final class PaymentListItemProduct { + private final String id; + + private final Optional> metadata; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private PaymentListItemProduct( + String id, + Optional> metadata, + String route, + String title, + Map additionalProperties) { + this.id = id; + this.metadata = metadata; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the product. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return URL slug in the product's public link, e.g. pickaxe-analytics in whop.com/company/pickaxe-analytics. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return The display name of the product shown to customers on the product page and in search results. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemProduct && equalTo((PaymentListItemProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemProduct other) { + return id.equals(other.id) + && metadata.equals(other.metadata) + && route.equals(other.route) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.metadata, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the product.

+ */ + RouteStage id(@NotNull String id); + + Builder from(PaymentListItemProduct other); + } + + public interface RouteStage { + /** + *

URL slug in the product's public link, e.g. pickaxe-analytics in whop.com/company/pickaxe-analytics.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

The display name of the product shown to customers on the product page and in search results.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + PaymentListItemProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + private Optional> metadata = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemProduct other) { + id(other.getId()); + metadata(other.getMetadata()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the product.

+ *

The unique identifier for the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

URL slug in the product's public link, e.g. pickaxe-analytics in whop.com/company/pickaxe-analytics.

+ *

URL slug in the product's public link, e.g. pickaxe-analytics in whop.com/company/pickaxe-analytics.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

The display name of the product shown to customers on the product page and in search results.

+ *

The display name of the product shown to customers on the product page and in search results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + @java.lang.Override + public PaymentListItemProduct build() { + return new PaymentListItemProduct(id, metadata, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemPromoCode.java b/src/main/java/com/whop/api/types/PaymentListItemPromoCode.java new file mode 100644 index 00000000..956732f9 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemPromoCode.java @@ -0,0 +1,384 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemPromoCode.Builder.class) +public final class PaymentListItemPromoCode { + private final double amountOff; + + private final Currencies baseCurrency; + + private final Optional code; + + private final String id; + + private final Optional numberOfIntervals; + + private final PromoTypes promoType; + + private final Map additionalProperties; + + private PaymentListItemPromoCode( + double amountOff, + Currencies baseCurrency, + Optional code, + String id, + Optional numberOfIntervals, + PromoTypes promoType, + Map additionalProperties) { + this.amountOff = amountOff; + this.baseCurrency = baseCurrency; + this.code = code; + this.id = id; + this.numberOfIntervals = numberOfIntervals; + this.promoType = promoType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The discount amount. Interpretation depends on promo_type: if 'percentage', this is the percentage (e.g., 20 means 20% off); if 'flat_amount', this is dollars off (e.g., 10.00 means $10.00 off). + */ + @JsonProperty("amount_off") + public double getAmountOff() { + return amountOff; + } + + /** + * @return The monetary currency of the promo code. + */ + @JsonProperty("base_currency") + public Currencies getBaseCurrency() { + return baseCurrency; + } + + /** + * @return The specific code used to apply the promo at checkout. + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + /** + * @return The unique identifier for the promo code. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The number of months the promo is applied for. + */ + @JsonIgnore + public Optional getNumberOfIntervals() { + if (numberOfIntervals == null) { + return Optional.empty(); + } + return numberOfIntervals; + } + + /** + * @return The type (% or flat amount) of the promo. + */ + @JsonProperty("promo_type") + public PromoTypes getPromoType() { + return promoType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("number_of_intervals") + private Optional _getNumberOfIntervals() { + return numberOfIntervals; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemPromoCode && equalTo((PaymentListItemPromoCode) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemPromoCode other) { + return amountOff == other.amountOff + && baseCurrency.equals(other.baseCurrency) + && code.equals(other.code) + && id.equals(other.id) + && numberOfIntervals.equals(other.numberOfIntervals) + && promoType.equals(other.promoType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amountOff, this.baseCurrency, this.code, this.id, this.numberOfIntervals, this.promoType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountOffStage builder() { + return new Builder(); + } + + public interface AmountOffStage { + /** + *

The discount amount. Interpretation depends on promo_type: if 'percentage', this is the percentage (e.g., 20 means 20% off); if 'flat_amount', this is dollars off (e.g., 10.00 means $10.00 off).

+ */ + BaseCurrencyStage amountOff(double amountOff); + + Builder from(PaymentListItemPromoCode other); + } + + public interface BaseCurrencyStage { + /** + *

The monetary currency of the promo code.

+ */ + IdStage baseCurrency(@NotNull Currencies baseCurrency); + } + + public interface IdStage { + /** + *

The unique identifier for the promo code.

+ */ + PromoTypeStage id(@NotNull String id); + } + + public interface PromoTypeStage { + /** + *

The type (% or flat amount) of the promo.

+ */ + _FinalStage promoType(@NotNull PromoTypes promoType); + } + + public interface _FinalStage { + PaymentListItemPromoCode build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The specific code used to apply the promo at checkout.

+ */ + _FinalStage code(Optional code); + + _FinalStage code(String code); + + _FinalStage code(Nullable code); + + /** + *

The number of months the promo is applied for.

+ */ + _FinalStage numberOfIntervals(Optional numberOfIntervals); + + _FinalStage numberOfIntervals(Integer numberOfIntervals); + + _FinalStage numberOfIntervals(Nullable numberOfIntervals); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountOffStage, BaseCurrencyStage, IdStage, PromoTypeStage, _FinalStage { + private double amountOff; + + private Currencies baseCurrency; + + private String id; + + private PromoTypes promoType; + + private Optional numberOfIntervals = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemPromoCode other) { + amountOff(other.getAmountOff()); + baseCurrency(other.getBaseCurrency()); + code(other.getCode()); + id(other.getId()); + numberOfIntervals(other.getNumberOfIntervals()); + promoType(other.getPromoType()); + return this; + } + + /** + *

The discount amount. Interpretation depends on promo_type: if 'percentage', this is the percentage (e.g., 20 means 20% off); if 'flat_amount', this is dollars off (e.g., 10.00 means $10.00 off).

+ *

The discount amount. Interpretation depends on promo_type: if 'percentage', this is the percentage (e.g., 20 means 20% off); if 'flat_amount', this is dollars off (e.g., 10.00 means $10.00 off).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount_off") + public BaseCurrencyStage amountOff(double amountOff) { + this.amountOff = amountOff; + return this; + } + + /** + *

The monetary currency of the promo code.

+ *

The monetary currency of the promo code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("base_currency") + public IdStage baseCurrency(@NotNull Currencies baseCurrency) { + this.baseCurrency = Objects.requireNonNull(baseCurrency, "baseCurrency must not be null"); + return this; + } + + /** + *

The unique identifier for the promo code.

+ *

The unique identifier for the promo code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PromoTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type (% or flat amount) of the promo.

+ *

The type (% or flat amount) of the promo.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("promo_type") + public _FinalStage promoType(@NotNull PromoTypes promoType) { + this.promoType = Objects.requireNonNull(promoType, "promoType must not be null"); + return this; + } + + /** + *

The number of months the promo is applied for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numberOfIntervals(Nullable numberOfIntervals) { + if (numberOfIntervals.isNull()) { + this.numberOfIntervals = null; + } else if (numberOfIntervals.isEmpty()) { + this.numberOfIntervals = Optional.empty(); + } else { + this.numberOfIntervals = Optional.of(numberOfIntervals.get()); + } + return this; + } + + /** + *

The number of months the promo is applied for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numberOfIntervals(Integer numberOfIntervals) { + this.numberOfIntervals = Optional.ofNullable(numberOfIntervals); + return this; + } + + /** + *

The number of months the promo is applied for.

+ */ + @java.lang.Override + @JsonSetter(value = "number_of_intervals", nulls = Nulls.SKIP) + public _FinalStage numberOfIntervals(Optional numberOfIntervals) { + this.numberOfIntervals = numberOfIntervals; + return this; + } + + /** + *

The specific code used to apply the promo at checkout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

The specific code used to apply the promo at checkout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

The specific code used to apply the promo at checkout.

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public PaymentListItemPromoCode build() { + return new PaymentListItemPromoCode( + amountOff, baseCurrency, code, id, numberOfIntervals, promoType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemShipment.java b/src/main/java/com/whop/api/types/PaymentListItemShipment.java new file mode 100644 index 00000000..404445fe --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemShipment.java @@ -0,0 +1,312 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemShipment.Builder.class) +public final class PaymentListItemShipment { + private final Optional carrier; + + private final String id; + + private final ShipmentStatuses status; + + private final String trackingNumber; + + private final String trackingUrl; + + private final Map additionalProperties; + + private PaymentListItemShipment( + Optional carrier, + String id, + ShipmentStatuses status, + String trackingNumber, + String trackingUrl, + Map additionalProperties) { + this.carrier = carrier; + this.id = id; + this.status = status; + this.trackingNumber = trackingNumber; + this.trackingUrl = trackingUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The shipping carrier detected for this shipment. Null until a tracking update identifies it. + */ + @JsonIgnore + public Optional getCarrier() { + if (carrier == null) { + return Optional.empty(); + } + return carrier; + } + + /** + * @return The unique identifier for the shipment. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The current delivery status of this shipment. + */ + @JsonProperty("status") + public ShipmentStatuses getStatus() { + return status; + } + + /** + * @return The carrier-assigned tracking number used to look up shipment progress. + */ + @JsonProperty("tracking_number") + public String getTrackingNumber() { + return trackingNumber; + } + + /** + * @return A customer-facing URL to track this shipment's progress. + */ + @JsonProperty("tracking_url") + public String getTrackingUrl() { + return trackingUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("carrier") + private Optional _getCarrier() { + return carrier; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemShipment && equalTo((PaymentListItemShipment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemShipment other) { + return carrier.equals(other.carrier) + && id.equals(other.id) + && status.equals(other.status) + && trackingNumber.equals(other.trackingNumber) + && trackingUrl.equals(other.trackingUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.carrier, this.id, this.status, this.trackingNumber, this.trackingUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the shipment.

+ */ + StatusStage id(@NotNull String id); + + Builder from(PaymentListItemShipment other); + } + + public interface StatusStage { + /** + *

The current delivery status of this shipment.

+ */ + TrackingNumberStage status(@NotNull ShipmentStatuses status); + } + + public interface TrackingNumberStage { + /** + *

The carrier-assigned tracking number used to look up shipment progress.

+ */ + TrackingUrlStage trackingNumber(@NotNull String trackingNumber); + } + + public interface TrackingUrlStage { + /** + *

A customer-facing URL to track this shipment's progress.

+ */ + _FinalStage trackingUrl(@NotNull String trackingUrl); + } + + public interface _FinalStage { + PaymentListItemShipment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The shipping carrier detected for this shipment. Null until a tracking update identifies it.

+ */ + _FinalStage carrier(Optional carrier); + + _FinalStage carrier(String carrier); + + _FinalStage carrier(Nullable carrier); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, StatusStage, TrackingNumberStage, TrackingUrlStage, _FinalStage { + private String id; + + private ShipmentStatuses status; + + private String trackingNumber; + + private String trackingUrl; + + private Optional carrier = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemShipment other) { + carrier(other.getCarrier()); + id(other.getId()); + status(other.getStatus()); + trackingNumber(other.getTrackingNumber()); + trackingUrl(other.getTrackingUrl()); + return this; + } + + /** + *

The unique identifier for the shipment.

+ *

The unique identifier for the shipment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current delivery status of this shipment.

+ *

The current delivery status of this shipment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TrackingNumberStage status(@NotNull ShipmentStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The carrier-assigned tracking number used to look up shipment progress.

+ *

The carrier-assigned tracking number used to look up shipment progress.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tracking_number") + public TrackingUrlStage trackingNumber(@NotNull String trackingNumber) { + this.trackingNumber = Objects.requireNonNull(trackingNumber, "trackingNumber must not be null"); + return this; + } + + /** + *

A customer-facing URL to track this shipment's progress.

+ *

A customer-facing URL to track this shipment's progress.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tracking_url") + public _FinalStage trackingUrl(@NotNull String trackingUrl) { + this.trackingUrl = Objects.requireNonNull(trackingUrl, "trackingUrl must not be null"); + return this; + } + + /** + *

The shipping carrier detected for this shipment. Null until a tracking update identifies it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage carrier(Nullable carrier) { + if (carrier.isNull()) { + this.carrier = null; + } else if (carrier.isEmpty()) { + this.carrier = Optional.empty(); + } else { + this.carrier = Optional.of(carrier.get()); + } + return this; + } + + /** + *

The shipping carrier detected for this shipment. Null until a tracking update identifies it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage carrier(String carrier) { + this.carrier = Optional.ofNullable(carrier); + return this; + } + + /** + *

The shipping carrier detected for this shipment. Null until a tracking update identifies it.

+ */ + @java.lang.Override + @JsonSetter(value = "carrier", nulls = Nulls.SKIP) + public _FinalStage carrier(Optional carrier) { + this.carrier = carrier; + return this; + } + + @java.lang.Override + public PaymentListItemShipment build() { + return new PaymentListItemShipment(carrier, id, status, trackingNumber, trackingUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemShippingAddress.java b/src/main/java/com/whop/api/types/PaymentListItemShippingAddress.java new file mode 100644 index 00000000..d786370b --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemShippingAddress.java @@ -0,0 +1,437 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemShippingAddress.Builder.class) +public final class PaymentListItemShippingAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional name; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private PaymentListItemShippingAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional name, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.name = name; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The name of the customer. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemShippingAddress && equalTo((PaymentListItemShippingAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemShippingAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && name.equals(other.name) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.name, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentListItemShippingAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + name(other.getName()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The name of the customer.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public PaymentListItemShippingAddress build() { + return new PaymentListItemShippingAddress( + city, country, line1, line2, name, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentListItemUser.java b/src/main/java/com/whop/api/types/PaymentListItemUser.java new file mode 100644 index 00000000..48e6f88e --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentListItemUser.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentListItemUser.Builder.class) +public final class PaymentListItemUser { + private final Optional email; + + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private PaymentListItemUser( + Optional email, + String id, + Optional name, + String username, + Map additionalProperties) { + this.email = email; + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's email address. Requires the member:email:read permission to access. Null if not authorized. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentListItemUser && equalTo((PaymentListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentListItemUser other) { + return email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(PaymentListItemUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + PaymentListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentListItemUser other) { + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public PaymentListItemUser build() { + return new PaymentListItemUser(email, id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMember.java b/src/main/java/com/whop/api/types/PaymentMember.java new file mode 100644 index 00000000..6a42f9e6 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMember.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMember.Builder.class) +public final class PaymentMember { + private final String id; + + private final Optional phone; + + private final Map additionalProperties; + + private PaymentMember(String id, Optional phone, Map additionalProperties) { + this.id = id; + this.phone = phone; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company member. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The phone number for the member, if available. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMember && equalTo((PaymentMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMember other) { + return id.equals(other.id) && phone.equals(other.phone); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.phone); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company member.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PaymentMember other); + } + + public interface _FinalStage { + PaymentMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The phone number for the member, if available.

+ */ + _FinalStage phone(Optional phone); + + _FinalStage phone(String phone); + + _FinalStage phone(Nullable phone); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional phone = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMember other) { + id(other.getId()); + phone(other.getPhone()); + return this; + } + + /** + *

The unique identifier for the company member.

+ *

The unique identifier for the company member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The phone number for the member, if available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

The phone number for the member, if available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + /** + *

The phone number for the member, if available.

+ */ + @java.lang.Override + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public _FinalStage phone(Optional phone) { + this.phone = phone; + return this; + } + + @java.lang.Override + public PaymentMember build() { + return new PaymentMember(id, phone, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMembership.java b/src/main/java/com/whop/api/types/PaymentMembership.java new file mode 100644 index 00000000..ec892ee6 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMembership.java @@ -0,0 +1,239 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMembership.Builder.class) +public final class PaymentMembership { + private final String id; + + private final Optional phoneNumber; + + private final MembershipStatus status; + + private final Map additionalProperties; + + private PaymentMembership( + String id, + Optional phoneNumber, + MembershipStatus status, + Map additionalProperties) { + this.id = id; + this.phoneNumber = phoneNumber; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the membership. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The phone number associated with this membership. + */ + @JsonIgnore + public Optional getPhoneNumber() { + if (phoneNumber == null) { + return Optional.empty(); + } + return phoneNumber; + } + + /** + * @return The state of the membership. + */ + @JsonProperty("status") + public MembershipStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone_number") + private Optional _getPhoneNumber() { + return phoneNumber; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMembership && equalTo((PaymentMembership) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMembership other) { + return id.equals(other.id) && phoneNumber.equals(other.phoneNumber) && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.phoneNumber, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the membership.

+ */ + StatusStage id(@NotNull String id); + + Builder from(PaymentMembership other); + } + + public interface StatusStage { + /** + *

The state of the membership.

+ */ + _FinalStage status(@NotNull MembershipStatus status); + } + + public interface _FinalStage { + PaymentMembership build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The phone number associated with this membership.

+ */ + _FinalStage phoneNumber(Optional phoneNumber); + + _FinalStage phoneNumber(String phoneNumber); + + _FinalStage phoneNumber(Nullable phoneNumber); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, StatusStage, _FinalStage { + private String id; + + private MembershipStatus status; + + private Optional phoneNumber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMembership other) { + id(other.getId()); + phoneNumber(other.getPhoneNumber()); + status(other.getStatus()); + return this; + } + + /** + *

The unique identifier for the membership.

+ *

The unique identifier for the membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The state of the membership.

+ *

The state of the membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull MembershipStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The phone number associated with this membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneNumber(Nullable phoneNumber) { + if (phoneNumber.isNull()) { + this.phoneNumber = null; + } else if (phoneNumber.isEmpty()) { + this.phoneNumber = Optional.empty(); + } else { + this.phoneNumber = Optional.of(phoneNumber.get()); + } + return this; + } + + /** + *

The phone number associated with this membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneNumber(String phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + /** + *

The phone number associated with this membership.

+ */ + @java.lang.Override + @JsonSetter(value = "phone_number", nulls = Nulls.SKIP) + public _FinalStage phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + @java.lang.Override + public PaymentMembership build() { + return new PaymentMembership(id, phoneNumber, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethod.java b/src/main/java/com/whop/api/types/PaymentMethod.java new file mode 100644 index 00000000..d29e8174 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethod.java @@ -0,0 +1,515 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class PaymentMethod { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PaymentMethod(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PaymentMethod basePaymentMethod(PaymentMethodBasePaymentMethod value) { + return new PaymentMethod(new BasePaymentMethodValue(value)); + } + + public static PaymentMethod cardPaymentMethod(PaymentMethodCardPaymentMethod value) { + return new PaymentMethod(new CardPaymentMethodValue(value)); + } + + public static PaymentMethod usBankAccountPaymentMethod(PaymentMethodUsBankAccountPaymentMethod value) { + return new PaymentMethod(new UsBankAccountPaymentMethodValue(value)); + } + + public static PaymentMethod cashappPaymentMethod(PaymentMethodCashappPaymentMethod value) { + return new PaymentMethod(new CashappPaymentMethodValue(value)); + } + + public static PaymentMethod idealPaymentMethod(PaymentMethodIdealPaymentMethod value) { + return new PaymentMethod(new IdealPaymentMethodValue(value)); + } + + public static PaymentMethod sepaDebitPaymentMethod(PaymentMethodSepaDebitPaymentMethod value) { + return new PaymentMethod(new SepaDebitPaymentMethodValue(value)); + } + + public static PaymentMethod platformBalancePaymentMethod(PaymentMethodPlatformBalancePaymentMethod value) { + return new PaymentMethod(new PlatformBalancePaymentMethodValue(value)); + } + + public boolean isBasePaymentMethod() { + return value instanceof BasePaymentMethodValue; + } + + public boolean isCardPaymentMethod() { + return value instanceof CardPaymentMethodValue; + } + + public boolean isUsBankAccountPaymentMethod() { + return value instanceof UsBankAccountPaymentMethodValue; + } + + public boolean isCashappPaymentMethod() { + return value instanceof CashappPaymentMethodValue; + } + + public boolean isIdealPaymentMethod() { + return value instanceof IdealPaymentMethodValue; + } + + public boolean isSepaDebitPaymentMethod() { + return value instanceof SepaDebitPaymentMethodValue; + } + + public boolean isPlatformBalancePaymentMethod() { + return value instanceof PlatformBalancePaymentMethodValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getBasePaymentMethod() { + if (isBasePaymentMethod()) { + return Optional.of(((BasePaymentMethodValue) value).value); + } + return Optional.empty(); + } + + public Optional getCardPaymentMethod() { + if (isCardPaymentMethod()) { + return Optional.of(((CardPaymentMethodValue) value).value); + } + return Optional.empty(); + } + + public Optional getUsBankAccountPaymentMethod() { + if (isUsBankAccountPaymentMethod()) { + return Optional.of(((UsBankAccountPaymentMethodValue) value).value); + } + return Optional.empty(); + } + + public Optional getCashappPaymentMethod() { + if (isCashappPaymentMethod()) { + return Optional.of(((CashappPaymentMethodValue) value).value); + } + return Optional.empty(); + } + + public Optional getIdealPaymentMethod() { + if (isIdealPaymentMethod()) { + return Optional.of(((IdealPaymentMethodValue) value).value); + } + return Optional.empty(); + } + + public Optional getSepaDebitPaymentMethod() { + if (isSepaDebitPaymentMethod()) { + return Optional.of(((SepaDebitPaymentMethodValue) value).value); + } + return Optional.empty(); + } + + public Optional getPlatformBalancePaymentMethod() { + if (isPlatformBalancePaymentMethod()) { + return Optional.of(((PlatformBalancePaymentMethodValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethod && value.equals(((PaymentMethod) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitBasePaymentMethod(PaymentMethodBasePaymentMethod basePaymentMethod); + + T visitCardPaymentMethod(PaymentMethodCardPaymentMethod cardPaymentMethod); + + T visitUsBankAccountPaymentMethod(PaymentMethodUsBankAccountPaymentMethod usBankAccountPaymentMethod); + + T visitCashappPaymentMethod(PaymentMethodCashappPaymentMethod cashappPaymentMethod); + + T visitIdealPaymentMethod(PaymentMethodIdealPaymentMethod idealPaymentMethod); + + T visitSepaDebitPaymentMethod(PaymentMethodSepaDebitPaymentMethod sepaDebitPaymentMethod); + + T visitPlatformBalancePaymentMethod(PaymentMethodPlatformBalancePaymentMethod platformBalancePaymentMethod); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(BasePaymentMethodValue.class), + @JsonSubTypes.Type(CardPaymentMethodValue.class), + @JsonSubTypes.Type(UsBankAccountPaymentMethodValue.class), + @JsonSubTypes.Type(CashappPaymentMethodValue.class), + @JsonSubTypes.Type(IdealPaymentMethodValue.class), + @JsonSubTypes.Type(SepaDebitPaymentMethodValue.class), + @JsonSubTypes.Type(PlatformBalancePaymentMethodValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("BasePaymentMethod") + @JsonIgnoreProperties("typename") + private static final class BasePaymentMethodValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PaymentMethodBasePaymentMethod value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BasePaymentMethodValue() {} + + private BasePaymentMethodValue(PaymentMethodBasePaymentMethod value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBasePaymentMethod(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BasePaymentMethodValue && equalTo((BasePaymentMethodValue) other); + } + + private boolean equalTo(BasePaymentMethodValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethod{" + "value: " + value + "}"; + } + } + + @JsonTypeName("CardPaymentMethod") + @JsonIgnoreProperties("typename") + private static final class CardPaymentMethodValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PaymentMethodCardPaymentMethod value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CardPaymentMethodValue() {} + + private CardPaymentMethodValue(PaymentMethodCardPaymentMethod value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCardPaymentMethod(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CardPaymentMethodValue && equalTo((CardPaymentMethodValue) other); + } + + private boolean equalTo(CardPaymentMethodValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethod{" + "value: " + value + "}"; + } + } + + @JsonTypeName("UsBankAccountPaymentMethod") + @JsonIgnoreProperties("typename") + private static final class UsBankAccountPaymentMethodValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PaymentMethodUsBankAccountPaymentMethod value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UsBankAccountPaymentMethodValue() {} + + private UsBankAccountPaymentMethodValue(PaymentMethodUsBankAccountPaymentMethod value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUsBankAccountPaymentMethod(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UsBankAccountPaymentMethodValue && equalTo((UsBankAccountPaymentMethodValue) other); + } + + private boolean equalTo(UsBankAccountPaymentMethodValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethod{" + "value: " + value + "}"; + } + } + + @JsonTypeName("CashappPaymentMethod") + @JsonIgnoreProperties("typename") + private static final class CashappPaymentMethodValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PaymentMethodCashappPaymentMethod value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CashappPaymentMethodValue() {} + + private CashappPaymentMethodValue(PaymentMethodCashappPaymentMethod value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCashappPaymentMethod(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CashappPaymentMethodValue && equalTo((CashappPaymentMethodValue) other); + } + + private boolean equalTo(CashappPaymentMethodValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethod{" + "value: " + value + "}"; + } + } + + @JsonTypeName("IdealPaymentMethod") + @JsonIgnoreProperties("typename") + private static final class IdealPaymentMethodValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PaymentMethodIdealPaymentMethod value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private IdealPaymentMethodValue() {} + + private IdealPaymentMethodValue(PaymentMethodIdealPaymentMethod value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitIdealPaymentMethod(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IdealPaymentMethodValue && equalTo((IdealPaymentMethodValue) other); + } + + private boolean equalTo(IdealPaymentMethodValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethod{" + "value: " + value + "}"; + } + } + + @JsonTypeName("SepaDebitPaymentMethod") + @JsonIgnoreProperties("typename") + private static final class SepaDebitPaymentMethodValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PaymentMethodSepaDebitPaymentMethod value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SepaDebitPaymentMethodValue() {} + + private SepaDebitPaymentMethodValue(PaymentMethodSepaDebitPaymentMethod value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSepaDebitPaymentMethod(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SepaDebitPaymentMethodValue && equalTo((SepaDebitPaymentMethodValue) other); + } + + private boolean equalTo(SepaDebitPaymentMethodValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethod{" + "value: " + value + "}"; + } + } + + @JsonTypeName("PlatformBalancePaymentMethod") + @JsonIgnoreProperties("typename") + private static final class PlatformBalancePaymentMethodValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PaymentMethodPlatformBalancePaymentMethod value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private PlatformBalancePaymentMethodValue() {} + + private PlatformBalancePaymentMethodValue(PaymentMethodPlatformBalancePaymentMethod value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitPlatformBalancePaymentMethod(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlatformBalancePaymentMethodValue + && equalTo((PlatformBalancePaymentMethodValue) other); + } + + private boolean equalTo(PlatformBalancePaymentMethodValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethod{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethod{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethod.java b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethod.java new file mode 100644 index 00000000..2483b4d9 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethod.java @@ -0,0 +1,238 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodBasePaymentMethod.Builder.class) +public final class PaymentMethodBasePaymentMethod { + private final OffsetDateTime createdAt; + + private final PaymentMethodBasePaymentMethodIcons icons; + + private final String id; + + private final PaymentMethodTypes paymentMethodType; + + private final Map additionalProperties; + + private PaymentMethodBasePaymentMethod( + OffsetDateTime createdAt, + PaymentMethodBasePaymentMethodIcons icons, + String id, + PaymentMethodTypes paymentMethodType, + Map additionalProperties) { + this.createdAt = createdAt; + this.icons = icons; + this.id = id; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The time of the event in ISO 8601 UTC format with millisecond precision + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art. + */ + @JsonProperty("icons") + public PaymentMethodBasePaymentMethodIcons getIcons() { + return icons; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit). + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodBasePaymentMethod && equalTo((PaymentMethodBasePaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodBasePaymentMethod other) { + return createdAt.equals(other.createdAt) + && icons.equals(other.icons) + && id.equals(other.id) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.icons, this.id, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ */ + IconsStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PaymentMethodBasePaymentMethod other); + } + + public interface IconsStage { + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ */ + IdStage icons(@NotNull PaymentMethodBasePaymentMethodIcons icons); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ */ + _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface _FinalStage { + PaymentMethodBasePaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IconsStage, IdStage, PaymentMethodTypeStage, _FinalStage { + private OffsetDateTime createdAt; + + private PaymentMethodBasePaymentMethodIcons icons; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodBasePaymentMethod other) { + createdAt(other.getCreatedAt()); + icons(other.getIcons()); + id(other.getId()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ *

The time of the event in ISO 8601 UTC format with millisecond precision

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IconsStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public IdStage icons(@NotNull PaymentMethodBasePaymentMethodIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodBasePaymentMethod build() { + return new PaymentMethodBasePaymentMethod(createdAt, icons, id, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIcons.java b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIcons.java new file mode 100644 index 00000000..131309a8 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIcons.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodBasePaymentMethodIcons.Builder.class) +public final class PaymentMethodBasePaymentMethodIcons { + private final PaymentMethodBasePaymentMethodIconsCard card; + + private final PaymentMethodBasePaymentMethodIconsSquare square; + + private final Map additionalProperties; + + private PaymentMethodBasePaymentMethodIcons( + PaymentMethodBasePaymentMethodIconsCard card, + PaymentMethodBasePaymentMethodIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentMethodBasePaymentMethodIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentMethodBasePaymentMethodIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodBasePaymentMethodIcons + && equalTo((PaymentMethodBasePaymentMethodIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodBasePaymentMethodIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentMethodBasePaymentMethodIconsCard card); + + Builder from(PaymentMethodBasePaymentMethodIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentMethodBasePaymentMethodIconsSquare square); + } + + public interface _FinalStage { + PaymentMethodBasePaymentMethodIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentMethodBasePaymentMethodIconsCard card; + + private PaymentMethodBasePaymentMethodIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodBasePaymentMethodIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentMethodBasePaymentMethodIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentMethodBasePaymentMethodIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodBasePaymentMethodIcons build() { + return new PaymentMethodBasePaymentMethodIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsCard.java b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsCard.java new file mode 100644 index 00000000..9eafa75c --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsCard.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodBasePaymentMethodIconsCard.Builder.class) +public final class PaymentMethodBasePaymentMethodIconsCard { + private final PaymentMethodBasePaymentMethodIconsCardDark dark; + + private final PaymentMethodBasePaymentMethodIconsCardLight light; + + private final Map additionalProperties; + + private PaymentMethodBasePaymentMethodIconsCard( + PaymentMethodBasePaymentMethodIconsCardDark dark, + PaymentMethodBasePaymentMethodIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodBasePaymentMethodIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodBasePaymentMethodIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodBasePaymentMethodIconsCard + && equalTo((PaymentMethodBasePaymentMethodIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodBasePaymentMethodIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodBasePaymentMethodIconsCardDark dark); + + Builder from(PaymentMethodBasePaymentMethodIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodBasePaymentMethodIconsCardLight light); + } + + public interface _FinalStage { + PaymentMethodBasePaymentMethodIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodBasePaymentMethodIconsCardDark dark; + + private PaymentMethodBasePaymentMethodIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodBasePaymentMethodIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodBasePaymentMethodIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodBasePaymentMethodIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodBasePaymentMethodIconsCard build() { + return new PaymentMethodBasePaymentMethodIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsCardDark.java new file mode 100644 index 00000000..201c0d8f --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsCardDark.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodBasePaymentMethodIconsCardDark.Builder.class) +public final class PaymentMethodBasePaymentMethodIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodBasePaymentMethodIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodBasePaymentMethodIconsCardDark + && equalTo((PaymentMethodBasePaymentMethodIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodBasePaymentMethodIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodBasePaymentMethodIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodBasePaymentMethodIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodBasePaymentMethodIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodBasePaymentMethodIconsCardDark build() { + return new PaymentMethodBasePaymentMethodIconsCardDark(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsCardLight.java new file mode 100644 index 00000000..19cddb1d --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsCardLight.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodBasePaymentMethodIconsCardLight.Builder.class) +public final class PaymentMethodBasePaymentMethodIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodBasePaymentMethodIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodBasePaymentMethodIconsCardLight + && equalTo((PaymentMethodBasePaymentMethodIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodBasePaymentMethodIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodBasePaymentMethodIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodBasePaymentMethodIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodBasePaymentMethodIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodBasePaymentMethodIconsCardLight build() { + return new PaymentMethodBasePaymentMethodIconsCardLight(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsSquare.java b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsSquare.java new file mode 100644 index 00000000..79555847 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodBasePaymentMethodIconsSquare.Builder.class) +public final class PaymentMethodBasePaymentMethodIconsSquare { + private final PaymentMethodBasePaymentMethodIconsSquareDark dark; + + private final PaymentMethodBasePaymentMethodIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentMethodBasePaymentMethodIconsSquare( + PaymentMethodBasePaymentMethodIconsSquareDark dark, + PaymentMethodBasePaymentMethodIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodBasePaymentMethodIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodBasePaymentMethodIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodBasePaymentMethodIconsSquare + && equalTo((PaymentMethodBasePaymentMethodIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodBasePaymentMethodIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodBasePaymentMethodIconsSquareDark dark); + + Builder from(PaymentMethodBasePaymentMethodIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodBasePaymentMethodIconsSquareLight light); + } + + public interface _FinalStage { + PaymentMethodBasePaymentMethodIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodBasePaymentMethodIconsSquareDark dark; + + private PaymentMethodBasePaymentMethodIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodBasePaymentMethodIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodBasePaymentMethodIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodBasePaymentMethodIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodBasePaymentMethodIconsSquare build() { + return new PaymentMethodBasePaymentMethodIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsSquareDark.java new file mode 100644 index 00000000..47f9c8b3 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsSquareDark.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodBasePaymentMethodIconsSquareDark.Builder.class) +public final class PaymentMethodBasePaymentMethodIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodBasePaymentMethodIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodBasePaymentMethodIconsSquareDark + && equalTo((PaymentMethodBasePaymentMethodIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodBasePaymentMethodIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodBasePaymentMethodIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodBasePaymentMethodIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodBasePaymentMethodIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodBasePaymentMethodIconsSquareDark build() { + return new PaymentMethodBasePaymentMethodIconsSquareDark(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsSquareLight.java new file mode 100644 index 00000000..4f54bcb2 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodBasePaymentMethodIconsSquareLight.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodBasePaymentMethodIconsSquareLight.Builder.class) +public final class PaymentMethodBasePaymentMethodIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodBasePaymentMethodIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodBasePaymentMethodIconsSquareLight + && equalTo((PaymentMethodBasePaymentMethodIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodBasePaymentMethodIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodBasePaymentMethodIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodBasePaymentMethodIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodBasePaymentMethodIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodBasePaymentMethodIconsSquareLight build() { + return new PaymentMethodBasePaymentMethodIconsSquareLight(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethod.java b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethod.java new file mode 100644 index 00000000..f19a0d9b --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethod.java @@ -0,0 +1,316 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCardPaymentMethod.Builder.class) +public final class PaymentMethodCardPaymentMethod { + private final PaymentMethodCardPaymentMethodCard card; + + private final OffsetDateTime createdAt; + + private final boolean hasPayerDocument; + + private final PaymentMethodCardPaymentMethodIcons icons; + + private final String id; + + private final PaymentMethodTypes paymentMethodType; + + private final Map additionalProperties; + + private PaymentMethodCardPaymentMethod( + PaymentMethodCardPaymentMethodCard card, + OffsetDateTime createdAt, + boolean hasPayerDocument, + PaymentMethodCardPaymentMethodIcons icons, + String id, + PaymentMethodTypes paymentMethodType, + Map additionalProperties) { + this.card = card; + this.createdAt = createdAt; + this.hasPayerDocument = hasPayerDocument; + this.icons = icons; + this.id = id; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The card-specific details for this payment method, including brand, last four digits, and expiration. + */ + @JsonProperty("card") + public PaymentMethodCardPaymentMethodCard getCard() { + return card; + } + + /** + * @return The time of the event in ISO 8601 UTC format with millisecond precision + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Whether this card has the payer identity document required by its payment provider. + */ + @JsonProperty("has_payer_document") + public boolean getHasPayerDocument() { + return hasPayerDocument; + } + + /** + * @return Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art. + */ + @JsonProperty("icons") + public PaymentMethodCardPaymentMethodIcons getIcons() { + return icons; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit). + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCardPaymentMethod && equalTo((PaymentMethodCardPaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCardPaymentMethod other) { + return card.equals(other.card) + && createdAt.equals(other.createdAt) + && hasPayerDocument == other.hasPayerDocument + && icons.equals(other.icons) + && id.equals(other.id) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.card, this.createdAt, this.hasPayerDocument, this.icons, this.id, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The card-specific details for this payment method, including brand, last four digits, and expiration.

+ */ + CreatedAtStage card(@NotNull PaymentMethodCardPaymentMethodCard card); + + Builder from(PaymentMethodCardPaymentMethod other); + } + + public interface CreatedAtStage { + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ */ + HasPayerDocumentStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface HasPayerDocumentStage { + /** + *

Whether this card has the payer identity document required by its payment provider.

+ */ + IconsStage hasPayerDocument(boolean hasPayerDocument); + } + + public interface IconsStage { + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ */ + IdStage icons(@NotNull PaymentMethodCardPaymentMethodIcons icons); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ */ + _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface _FinalStage { + PaymentMethodCardPaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CardStage, + CreatedAtStage, + HasPayerDocumentStage, + IconsStage, + IdStage, + PaymentMethodTypeStage, + _FinalStage { + private PaymentMethodCardPaymentMethodCard card; + + private OffsetDateTime createdAt; + + private boolean hasPayerDocument; + + private PaymentMethodCardPaymentMethodIcons icons; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCardPaymentMethod other) { + card(other.getCard()); + createdAt(other.getCreatedAt()); + hasPayerDocument(other.getHasPayerDocument()); + icons(other.getIcons()); + id(other.getId()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

The card-specific details for this payment method, including brand, last four digits, and expiration.

+ *

The card-specific details for this payment method, including brand, last four digits, and expiration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public CreatedAtStage card(@NotNull PaymentMethodCardPaymentMethodCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ *

The time of the event in ISO 8601 UTC format with millisecond precision

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public HasPayerDocumentStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Whether this card has the payer identity document required by its payment provider.

+ *

Whether this card has the payer identity document required by its payment provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("has_payer_document") + public IconsStage hasPayerDocument(boolean hasPayerDocument) { + this.hasPayerDocument = hasPayerDocument; + return this; + } + + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public IdStage icons(@NotNull PaymentMethodCardPaymentMethodIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCardPaymentMethod build() { + return new PaymentMethodCardPaymentMethod( + card, createdAt, hasPayerDocument, icons, id, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodCard.java b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodCard.java new file mode 100644 index 00000000..aca1b21f --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodCard.java @@ -0,0 +1,608 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCardPaymentMethodCard.Builder.class) +public final class PaymentMethodCardPaymentMethodCard { + private final Optional brand; + + private final Optional expMonth; + + private final Optional expYear; + + private final boolean expired; + + private final Optional fingerprint; + + private final Optional fundingType; + + private final Optional last4; + + private final boolean threeDsVerified; + + private final Map additionalProperties; + + private PaymentMethodCardPaymentMethodCard( + Optional brand, + Optional expMonth, + Optional expYear, + boolean expired, + Optional fingerprint, + Optional fundingType, + Optional last4, + boolean threeDsVerified, + Map additionalProperties) { + this.brand = brand; + this.expMonth = expMonth; + this.expYear = expYear; + this.expired = expired; + this.fingerprint = fingerprint; + this.fundingType = fundingType; + this.last4 = last4; + this.threeDsVerified = threeDsVerified; + this.additionalProperties = additionalProperties; + } + + /** + * @return The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined. + */ + @JsonIgnore + public Optional getBrand() { + if (brand == null) { + return Optional.empty(); + } + return brand; + } + + /** + * @return The two-digit expiration month of the card (1-12). Null if not available. + */ + @JsonIgnore + public Optional getExpMonth() { + if (expMonth == null) { + return Optional.empty(); + } + return expMonth; + } + + /** + * @return The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available. + */ + @JsonIgnore + public Optional getExpYear() { + if (expYear == null) { + return Optional.empty(); + } + return expYear; + } + + /** + * @return Whether the card is past its expiration month. An expired card cannot take a new charge. + */ + @JsonProperty("expired") + public boolean getExpired() { + return expired; + } + + /** + * @return A stable identifier for the underlying card. Two payment methods with the same fingerprint are the same card. Null if not available. + */ + @JsonIgnore + public Optional getFingerprint() { + if (fingerprint == null) { + return Optional.empty(); + } + return fingerprint; + } + + /** + * @return How the card is funded by the issuer. Null if the funding type could not be determined. + */ + @JsonIgnore + public Optional getFundingType() { + if (fundingType == null) { + return Optional.empty(); + } + return fundingType; + } + + /** + * @return The last four digits of the card number. Null if not available. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + /** + * @return Whether this card was verified with 3D Secure, either when it was saved or on a payment that used it. + */ + @JsonProperty("three_ds_verified") + public boolean getThreeDsVerified() { + return threeDsVerified; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("brand") + private Optional _getBrand() { + return brand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_month") + private Optional _getExpMonth() { + return expMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_year") + private Optional _getExpYear() { + return expYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fingerprint") + private Optional _getFingerprint() { + return fingerprint; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("funding_type") + private Optional _getFundingType() { + return fundingType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCardPaymentMethodCard + && equalTo((PaymentMethodCardPaymentMethodCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCardPaymentMethodCard other) { + return brand.equals(other.brand) + && expMonth.equals(other.expMonth) + && expYear.equals(other.expYear) + && expired == other.expired + && fingerprint.equals(other.fingerprint) + && fundingType.equals(other.fundingType) + && last4.equals(other.last4) + && threeDsVerified == other.threeDsVerified; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.brand, + this.expMonth, + this.expYear, + this.expired, + this.fingerprint, + this.fundingType, + this.last4, + this.threeDsVerified); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExpiredStage builder() { + return new Builder(); + } + + public interface ExpiredStage { + /** + *

Whether the card is past its expiration month. An expired card cannot take a new charge.

+ */ + ThreeDsVerifiedStage expired(boolean expired); + + Builder from(PaymentMethodCardPaymentMethodCard other); + } + + public interface ThreeDsVerifiedStage { + /** + *

Whether this card was verified with 3D Secure, either when it was saved or on a payment that used it.

+ */ + _FinalStage threeDsVerified(boolean threeDsVerified); + } + + public interface _FinalStage { + PaymentMethodCardPaymentMethodCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined.

+ */ + _FinalStage brand(Optional brand); + + _FinalStage brand(CardBrands brand); + + _FinalStage brand(Nullable brand); + + /** + *

The two-digit expiration month of the card (1-12). Null if not available.

+ */ + _FinalStage expMonth(Optional expMonth); + + _FinalStage expMonth(Integer expMonth); + + _FinalStage expMonth(Nullable expMonth); + + /** + *

The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available.

+ */ + _FinalStage expYear(Optional expYear); + + _FinalStage expYear(Integer expYear); + + _FinalStage expYear(Nullable expYear); + + /** + *

A stable identifier for the underlying card. Two payment methods with the same fingerprint are the same card. Null if not available.

+ */ + _FinalStage fingerprint(Optional fingerprint); + + _FinalStage fingerprint(String fingerprint); + + _FinalStage fingerprint(Nullable fingerprint); + + /** + *

How the card is funded by the issuer. Null if the funding type could not be determined.

+ */ + _FinalStage fundingType(Optional fundingType); + + _FinalStage fundingType(CardFundingTypes fundingType); + + _FinalStage fundingType(Nullable fundingType); + + /** + *

The last four digits of the card number. Null if not available.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExpiredStage, ThreeDsVerifiedStage, _FinalStage { + private boolean expired; + + private boolean threeDsVerified; + + private Optional last4 = Optional.empty(); + + private Optional fundingType = Optional.empty(); + + private Optional fingerprint = Optional.empty(); + + private Optional expYear = Optional.empty(); + + private Optional expMonth = Optional.empty(); + + private Optional brand = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCardPaymentMethodCard other) { + brand(other.getBrand()); + expMonth(other.getExpMonth()); + expYear(other.getExpYear()); + expired(other.getExpired()); + fingerprint(other.getFingerprint()); + fundingType(other.getFundingType()); + last4(other.getLast4()); + threeDsVerified(other.getThreeDsVerified()); + return this; + } + + /** + *

Whether the card is past its expiration month. An expired card cannot take a new charge.

+ *

Whether the card is past its expiration month. An expired card cannot take a new charge.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("expired") + public ThreeDsVerifiedStage expired(boolean expired) { + this.expired = expired; + return this; + } + + /** + *

Whether this card was verified with 3D Secure, either when it was saved or on a payment that used it.

+ *

Whether this card was verified with 3D Secure, either when it was saved or on a payment that used it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("three_ds_verified") + public _FinalStage threeDsVerified(boolean threeDsVerified) { + this.threeDsVerified = threeDsVerified; + return this; + } + + /** + *

The last four digits of the card number. Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

The last four digits of the card number. Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

The last four digits of the card number. Null if not available.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + /** + *

How the card is funded by the issuer. Null if the funding type could not be determined.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fundingType(Nullable fundingType) { + if (fundingType.isNull()) { + this.fundingType = null; + } else if (fundingType.isEmpty()) { + this.fundingType = Optional.empty(); + } else { + this.fundingType = Optional.of(fundingType.get()); + } + return this; + } + + /** + *

How the card is funded by the issuer. Null if the funding type could not be determined.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fundingType(CardFundingTypes fundingType) { + this.fundingType = Optional.ofNullable(fundingType); + return this; + } + + /** + *

How the card is funded by the issuer. Null if the funding type could not be determined.

+ */ + @java.lang.Override + @JsonSetter(value = "funding_type", nulls = Nulls.SKIP) + public _FinalStage fundingType(Optional fundingType) { + this.fundingType = fundingType; + return this; + } + + /** + *

A stable identifier for the underlying card. Two payment methods with the same fingerprint are the same card. Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fingerprint(Nullable fingerprint) { + if (fingerprint.isNull()) { + this.fingerprint = null; + } else if (fingerprint.isEmpty()) { + this.fingerprint = Optional.empty(); + } else { + this.fingerprint = Optional.of(fingerprint.get()); + } + return this; + } + + /** + *

A stable identifier for the underlying card. Two payment methods with the same fingerprint are the same card. Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fingerprint(String fingerprint) { + this.fingerprint = Optional.ofNullable(fingerprint); + return this; + } + + /** + *

A stable identifier for the underlying card. Two payment methods with the same fingerprint are the same card. Null if not available.

+ */ + @java.lang.Override + @JsonSetter(value = "fingerprint", nulls = Nulls.SKIP) + public _FinalStage fingerprint(Optional fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + /** + *

The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expYear(Nullable expYear) { + if (expYear.isNull()) { + this.expYear = null; + } else if (expYear.isEmpty()) { + this.expYear = Optional.empty(); + } else { + this.expYear = Optional.of(expYear.get()); + } + return this; + } + + /** + *

The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expYear(Integer expYear) { + this.expYear = Optional.ofNullable(expYear); + return this; + } + + /** + *

The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available.

+ */ + @java.lang.Override + @JsonSetter(value = "exp_year", nulls = Nulls.SKIP) + public _FinalStage expYear(Optional expYear) { + this.expYear = expYear; + return this; + } + + /** + *

The two-digit expiration month of the card (1-12). Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expMonth(Nullable expMonth) { + if (expMonth.isNull()) { + this.expMonth = null; + } else if (expMonth.isEmpty()) { + this.expMonth = Optional.empty(); + } else { + this.expMonth = Optional.of(expMonth.get()); + } + return this; + } + + /** + *

The two-digit expiration month of the card (1-12). Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expMonth(Integer expMonth) { + this.expMonth = Optional.ofNullable(expMonth); + return this; + } + + /** + *

The two-digit expiration month of the card (1-12). Null if not available.

+ */ + @java.lang.Override + @JsonSetter(value = "exp_month", nulls = Nulls.SKIP) + public _FinalStage expMonth(Optional expMonth) { + this.expMonth = expMonth; + return this; + } + + /** + *

The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage brand(Nullable brand) { + if (brand.isNull()) { + this.brand = null; + } else if (brand.isEmpty()) { + this.brand = Optional.empty(); + } else { + this.brand = Optional.of(brand.get()); + } + return this; + } + + /** + *

The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage brand(CardBrands brand) { + this.brand = Optional.ofNullable(brand); + return this; + } + + /** + *

The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined.

+ */ + @java.lang.Override + @JsonSetter(value = "brand", nulls = Nulls.SKIP) + public _FinalStage brand(Optional brand) { + this.brand = brand; + return this; + } + + @java.lang.Override + public PaymentMethodCardPaymentMethodCard build() { + return new PaymentMethodCardPaymentMethodCard( + brand, + expMonth, + expYear, + expired, + fingerprint, + fundingType, + last4, + threeDsVerified, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIcons.java b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIcons.java new file mode 100644 index 00000000..48759a7b --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIcons.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCardPaymentMethodIcons.Builder.class) +public final class PaymentMethodCardPaymentMethodIcons { + private final PaymentMethodCardPaymentMethodIconsCard card; + + private final PaymentMethodCardPaymentMethodIconsSquare square; + + private final Map additionalProperties; + + private PaymentMethodCardPaymentMethodIcons( + PaymentMethodCardPaymentMethodIconsCard card, + PaymentMethodCardPaymentMethodIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentMethodCardPaymentMethodIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentMethodCardPaymentMethodIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCardPaymentMethodIcons + && equalTo((PaymentMethodCardPaymentMethodIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCardPaymentMethodIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentMethodCardPaymentMethodIconsCard card); + + Builder from(PaymentMethodCardPaymentMethodIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentMethodCardPaymentMethodIconsSquare square); + } + + public interface _FinalStage { + PaymentMethodCardPaymentMethodIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentMethodCardPaymentMethodIconsCard card; + + private PaymentMethodCardPaymentMethodIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCardPaymentMethodIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentMethodCardPaymentMethodIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentMethodCardPaymentMethodIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCardPaymentMethodIcons build() { + return new PaymentMethodCardPaymentMethodIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsCard.java b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsCard.java new file mode 100644 index 00000000..38469ce8 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsCard.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCardPaymentMethodIconsCard.Builder.class) +public final class PaymentMethodCardPaymentMethodIconsCard { + private final PaymentMethodCardPaymentMethodIconsCardDark dark; + + private final PaymentMethodCardPaymentMethodIconsCardLight light; + + private final Map additionalProperties; + + private PaymentMethodCardPaymentMethodIconsCard( + PaymentMethodCardPaymentMethodIconsCardDark dark, + PaymentMethodCardPaymentMethodIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodCardPaymentMethodIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodCardPaymentMethodIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCardPaymentMethodIconsCard + && equalTo((PaymentMethodCardPaymentMethodIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCardPaymentMethodIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodCardPaymentMethodIconsCardDark dark); + + Builder from(PaymentMethodCardPaymentMethodIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodCardPaymentMethodIconsCardLight light); + } + + public interface _FinalStage { + PaymentMethodCardPaymentMethodIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodCardPaymentMethodIconsCardDark dark; + + private PaymentMethodCardPaymentMethodIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCardPaymentMethodIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodCardPaymentMethodIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodCardPaymentMethodIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCardPaymentMethodIconsCard build() { + return new PaymentMethodCardPaymentMethodIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsCardDark.java new file mode 100644 index 00000000..2645d14f --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsCardDark.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCardPaymentMethodIconsCardDark.Builder.class) +public final class PaymentMethodCardPaymentMethodIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodCardPaymentMethodIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCardPaymentMethodIconsCardDark + && equalTo((PaymentMethodCardPaymentMethodIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCardPaymentMethodIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodCardPaymentMethodIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodCardPaymentMethodIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCardPaymentMethodIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCardPaymentMethodIconsCardDark build() { + return new PaymentMethodCardPaymentMethodIconsCardDark(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsCardLight.java new file mode 100644 index 00000000..24b1b1be --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsCardLight.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCardPaymentMethodIconsCardLight.Builder.class) +public final class PaymentMethodCardPaymentMethodIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodCardPaymentMethodIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCardPaymentMethodIconsCardLight + && equalTo((PaymentMethodCardPaymentMethodIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCardPaymentMethodIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodCardPaymentMethodIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodCardPaymentMethodIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCardPaymentMethodIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCardPaymentMethodIconsCardLight build() { + return new PaymentMethodCardPaymentMethodIconsCardLight(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsSquare.java b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsSquare.java new file mode 100644 index 00000000..963cf599 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCardPaymentMethodIconsSquare.Builder.class) +public final class PaymentMethodCardPaymentMethodIconsSquare { + private final PaymentMethodCardPaymentMethodIconsSquareDark dark; + + private final PaymentMethodCardPaymentMethodIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentMethodCardPaymentMethodIconsSquare( + PaymentMethodCardPaymentMethodIconsSquareDark dark, + PaymentMethodCardPaymentMethodIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodCardPaymentMethodIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodCardPaymentMethodIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCardPaymentMethodIconsSquare + && equalTo((PaymentMethodCardPaymentMethodIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCardPaymentMethodIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodCardPaymentMethodIconsSquareDark dark); + + Builder from(PaymentMethodCardPaymentMethodIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodCardPaymentMethodIconsSquareLight light); + } + + public interface _FinalStage { + PaymentMethodCardPaymentMethodIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodCardPaymentMethodIconsSquareDark dark; + + private PaymentMethodCardPaymentMethodIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCardPaymentMethodIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodCardPaymentMethodIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodCardPaymentMethodIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCardPaymentMethodIconsSquare build() { + return new PaymentMethodCardPaymentMethodIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsSquareDark.java new file mode 100644 index 00000000..39cc1cad --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsSquareDark.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCardPaymentMethodIconsSquareDark.Builder.class) +public final class PaymentMethodCardPaymentMethodIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodCardPaymentMethodIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCardPaymentMethodIconsSquareDark + && equalTo((PaymentMethodCardPaymentMethodIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCardPaymentMethodIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodCardPaymentMethodIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodCardPaymentMethodIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCardPaymentMethodIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCardPaymentMethodIconsSquareDark build() { + return new PaymentMethodCardPaymentMethodIconsSquareDark(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsSquareLight.java new file mode 100644 index 00000000..7eab725b --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCardPaymentMethodIconsSquareLight.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCardPaymentMethodIconsSquareLight.Builder.class) +public final class PaymentMethodCardPaymentMethodIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodCardPaymentMethodIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCardPaymentMethodIconsSquareLight + && equalTo((PaymentMethodCardPaymentMethodIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCardPaymentMethodIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodCardPaymentMethodIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodCardPaymentMethodIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCardPaymentMethodIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCardPaymentMethodIconsSquareLight build() { + return new PaymentMethodCardPaymentMethodIconsSquareLight(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethod.java b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethod.java new file mode 100644 index 00000000..6ff78cd3 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethod.java @@ -0,0 +1,274 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCashappPaymentMethod.Builder.class) +public final class PaymentMethodCashappPaymentMethod { + private final PaymentMethodCashappPaymentMethodCashapp cashapp; + + private final OffsetDateTime createdAt; + + private final PaymentMethodCashappPaymentMethodIcons icons; + + private final String id; + + private final PaymentMethodTypes paymentMethodType; + + private final Map additionalProperties; + + private PaymentMethodCashappPaymentMethod( + PaymentMethodCashappPaymentMethodCashapp cashapp, + OffsetDateTime createdAt, + PaymentMethodCashappPaymentMethodIcons icons, + String id, + PaymentMethodTypes paymentMethodType, + Map additionalProperties) { + this.cashapp = cashapp; + this.createdAt = createdAt; + this.icons = icons; + this.id = id; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Cash App-specific details for this payment method, including cashtag and buyer ID. + */ + @JsonProperty("cashapp") + public PaymentMethodCashappPaymentMethodCashapp getCashapp() { + return cashapp; + } + + /** + * @return The time of the event in ISO 8601 UTC format with millisecond precision + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art. + */ + @JsonProperty("icons") + public PaymentMethodCashappPaymentMethodIcons getIcons() { + return icons; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit). + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCashappPaymentMethod && equalTo((PaymentMethodCashappPaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCashappPaymentMethod other) { + return cashapp.equals(other.cashapp) + && createdAt.equals(other.createdAt) + && icons.equals(other.icons) + && id.equals(other.id) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cashapp, this.createdAt, this.icons, this.id, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CashappStage builder() { + return new Builder(); + } + + public interface CashappStage { + /** + *

The Cash App-specific details for this payment method, including cashtag and buyer ID.

+ */ + CreatedAtStage cashapp(@NotNull PaymentMethodCashappPaymentMethodCashapp cashapp); + + Builder from(PaymentMethodCashappPaymentMethod other); + } + + public interface CreatedAtStage { + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ */ + IconsStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IconsStage { + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ */ + IdStage icons(@NotNull PaymentMethodCashappPaymentMethodIcons icons); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ */ + _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface _FinalStage { + PaymentMethodCashappPaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CashappStage, CreatedAtStage, IconsStage, IdStage, PaymentMethodTypeStage, _FinalStage { + private PaymentMethodCashappPaymentMethodCashapp cashapp; + + private OffsetDateTime createdAt; + + private PaymentMethodCashappPaymentMethodIcons icons; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCashappPaymentMethod other) { + cashapp(other.getCashapp()); + createdAt(other.getCreatedAt()); + icons(other.getIcons()); + id(other.getId()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

The Cash App-specific details for this payment method, including cashtag and buyer ID.

+ *

The Cash App-specific details for this payment method, including cashtag and buyer ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cashapp") + public CreatedAtStage cashapp(@NotNull PaymentMethodCashappPaymentMethodCashapp cashapp) { + this.cashapp = Objects.requireNonNull(cashapp, "cashapp must not be null"); + return this; + } + + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ *

The time of the event in ISO 8601 UTC format with millisecond precision

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IconsStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public IdStage icons(@NotNull PaymentMethodCashappPaymentMethodIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCashappPaymentMethod build() { + return new PaymentMethodCashappPaymentMethod( + cashapp, createdAt, icons, id, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodCashapp.java b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodCashapp.java new file mode 100644 index 00000000..d0432464 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodCashapp.java @@ -0,0 +1,184 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCashappPaymentMethodCashapp.Builder.class) +public final class PaymentMethodCashappPaymentMethodCashapp { + private final Optional buyerId; + + private final Optional cashtag; + + private final Map additionalProperties; + + private PaymentMethodCashappPaymentMethodCashapp( + Optional buyerId, Optional cashtag, Map additionalProperties) { + this.buyerId = buyerId; + this.cashtag = cashtag; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique and immutable identifier assigned by Cash App to the buyer. Null if not available. + */ + @JsonIgnore + public Optional getBuyerId() { + if (buyerId == null) { + return Optional.empty(); + } + return buyerId; + } + + /** + * @return The public cashtag handle of the buyer on Cash App. Null if not available. + */ + @JsonIgnore + public Optional getCashtag() { + if (cashtag == null) { + return Optional.empty(); + } + return cashtag; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("buyer_id") + private Optional _getBuyerId() { + return buyerId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cashtag") + private Optional _getCashtag() { + return cashtag; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCashappPaymentMethodCashapp + && equalTo((PaymentMethodCashappPaymentMethodCashapp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCashappPaymentMethodCashapp other) { + return buyerId.equals(other.buyerId) && cashtag.equals(other.cashtag); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.buyerId, this.cashtag); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional buyerId = Optional.empty(); + + private Optional cashtag = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentMethodCashappPaymentMethodCashapp other) { + buyerId(other.getBuyerId()); + cashtag(other.getCashtag()); + return this; + } + + /** + *

The unique and immutable identifier assigned by Cash App to the buyer. Null if not available.

+ */ + @JsonSetter(value = "buyer_id", nulls = Nulls.SKIP) + public Builder buyerId(Optional buyerId) { + this.buyerId = buyerId; + return this; + } + + public Builder buyerId(String buyerId) { + this.buyerId = Optional.ofNullable(buyerId); + return this; + } + + public Builder buyerId(Nullable buyerId) { + if (buyerId.isNull()) { + this.buyerId = null; + } else if (buyerId.isEmpty()) { + this.buyerId = Optional.empty(); + } else { + this.buyerId = Optional.of(buyerId.get()); + } + return this; + } + + /** + *

The public cashtag handle of the buyer on Cash App. Null if not available.

+ */ + @JsonSetter(value = "cashtag", nulls = Nulls.SKIP) + public Builder cashtag(Optional cashtag) { + this.cashtag = cashtag; + return this; + } + + public Builder cashtag(String cashtag) { + this.cashtag = Optional.ofNullable(cashtag); + return this; + } + + public Builder cashtag(Nullable cashtag) { + if (cashtag.isNull()) { + this.cashtag = null; + } else if (cashtag.isEmpty()) { + this.cashtag = Optional.empty(); + } else { + this.cashtag = Optional.of(cashtag.get()); + } + return this; + } + + public PaymentMethodCashappPaymentMethodCashapp build() { + return new PaymentMethodCashappPaymentMethodCashapp(buyerId, cashtag, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIcons.java b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIcons.java new file mode 100644 index 00000000..35c38203 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIcons.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCashappPaymentMethodIcons.Builder.class) +public final class PaymentMethodCashappPaymentMethodIcons { + private final PaymentMethodCashappPaymentMethodIconsCard card; + + private final PaymentMethodCashappPaymentMethodIconsSquare square; + + private final Map additionalProperties; + + private PaymentMethodCashappPaymentMethodIcons( + PaymentMethodCashappPaymentMethodIconsCard card, + PaymentMethodCashappPaymentMethodIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentMethodCashappPaymentMethodIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentMethodCashappPaymentMethodIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCashappPaymentMethodIcons + && equalTo((PaymentMethodCashappPaymentMethodIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCashappPaymentMethodIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentMethodCashappPaymentMethodIconsCard card); + + Builder from(PaymentMethodCashappPaymentMethodIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentMethodCashappPaymentMethodIconsSquare square); + } + + public interface _FinalStage { + PaymentMethodCashappPaymentMethodIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentMethodCashappPaymentMethodIconsCard card; + + private PaymentMethodCashappPaymentMethodIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCashappPaymentMethodIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentMethodCashappPaymentMethodIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentMethodCashappPaymentMethodIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCashappPaymentMethodIcons build() { + return new PaymentMethodCashappPaymentMethodIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsCard.java b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsCard.java new file mode 100644 index 00000000..1df3c753 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsCard.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCashappPaymentMethodIconsCard.Builder.class) +public final class PaymentMethodCashappPaymentMethodIconsCard { + private final PaymentMethodCashappPaymentMethodIconsCardDark dark; + + private final PaymentMethodCashappPaymentMethodIconsCardLight light; + + private final Map additionalProperties; + + private PaymentMethodCashappPaymentMethodIconsCard( + PaymentMethodCashappPaymentMethodIconsCardDark dark, + PaymentMethodCashappPaymentMethodIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodCashappPaymentMethodIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodCashappPaymentMethodIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCashappPaymentMethodIconsCard + && equalTo((PaymentMethodCashappPaymentMethodIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCashappPaymentMethodIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodCashappPaymentMethodIconsCardDark dark); + + Builder from(PaymentMethodCashappPaymentMethodIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodCashappPaymentMethodIconsCardLight light); + } + + public interface _FinalStage { + PaymentMethodCashappPaymentMethodIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodCashappPaymentMethodIconsCardDark dark; + + private PaymentMethodCashappPaymentMethodIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCashappPaymentMethodIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodCashappPaymentMethodIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodCashappPaymentMethodIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCashappPaymentMethodIconsCard build() { + return new PaymentMethodCashappPaymentMethodIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsCardDark.java new file mode 100644 index 00000000..a7e68b9c --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsCardDark.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCashappPaymentMethodIconsCardDark.Builder.class) +public final class PaymentMethodCashappPaymentMethodIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodCashappPaymentMethodIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCashappPaymentMethodIconsCardDark + && equalTo((PaymentMethodCashappPaymentMethodIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCashappPaymentMethodIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodCashappPaymentMethodIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodCashappPaymentMethodIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCashappPaymentMethodIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCashappPaymentMethodIconsCardDark build() { + return new PaymentMethodCashappPaymentMethodIconsCardDark(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsCardLight.java new file mode 100644 index 00000000..c8d11c7f --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsCardLight.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCashappPaymentMethodIconsCardLight.Builder.class) +public final class PaymentMethodCashappPaymentMethodIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodCashappPaymentMethodIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCashappPaymentMethodIconsCardLight + && equalTo((PaymentMethodCashappPaymentMethodIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCashappPaymentMethodIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodCashappPaymentMethodIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodCashappPaymentMethodIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCashappPaymentMethodIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCashappPaymentMethodIconsCardLight build() { + return new PaymentMethodCashappPaymentMethodIconsCardLight(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsSquare.java b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsSquare.java new file mode 100644 index 00000000..7f04bbfe --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCashappPaymentMethodIconsSquare.Builder.class) +public final class PaymentMethodCashappPaymentMethodIconsSquare { + private final PaymentMethodCashappPaymentMethodIconsSquareDark dark; + + private final PaymentMethodCashappPaymentMethodIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentMethodCashappPaymentMethodIconsSquare( + PaymentMethodCashappPaymentMethodIconsSquareDark dark, + PaymentMethodCashappPaymentMethodIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodCashappPaymentMethodIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodCashappPaymentMethodIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCashappPaymentMethodIconsSquare + && equalTo((PaymentMethodCashappPaymentMethodIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCashappPaymentMethodIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodCashappPaymentMethodIconsSquareDark dark); + + Builder from(PaymentMethodCashappPaymentMethodIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodCashappPaymentMethodIconsSquareLight light); + } + + public interface _FinalStage { + PaymentMethodCashappPaymentMethodIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodCashappPaymentMethodIconsSquareDark dark; + + private PaymentMethodCashappPaymentMethodIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCashappPaymentMethodIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodCashappPaymentMethodIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodCashappPaymentMethodIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCashappPaymentMethodIconsSquare build() { + return new PaymentMethodCashappPaymentMethodIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsSquareDark.java new file mode 100644 index 00000000..9302c55a --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsSquareDark.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCashappPaymentMethodIconsSquareDark.Builder.class) +public final class PaymentMethodCashappPaymentMethodIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodCashappPaymentMethodIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCashappPaymentMethodIconsSquareDark + && equalTo((PaymentMethodCashappPaymentMethodIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCashappPaymentMethodIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodCashappPaymentMethodIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodCashappPaymentMethodIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCashappPaymentMethodIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCashappPaymentMethodIconsSquareDark build() { + return new PaymentMethodCashappPaymentMethodIconsSquareDark(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsSquareLight.java new file mode 100644 index 00000000..c690003c --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodCashappPaymentMethodIconsSquareLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodCashappPaymentMethodIconsSquareLight.Builder.class) +public final class PaymentMethodCashappPaymentMethodIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodCashappPaymentMethodIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodCashappPaymentMethodIconsSquareLight + && equalTo((PaymentMethodCashappPaymentMethodIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodCashappPaymentMethodIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodCashappPaymentMethodIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodCashappPaymentMethodIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodCashappPaymentMethodIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodCashappPaymentMethodIconsSquareLight build() { + return new PaymentMethodCashappPaymentMethodIconsSquareLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodDomain.java b/src/main/java/com/whop/api/types/PaymentMethodDomain.java new file mode 100644 index 00000000..fb4df331 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodDomain.java @@ -0,0 +1,384 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodDomain.Builder.class) +public final class PaymentMethodDomain { + private final Optional accountId; + + private final String createdAt; + + private final String hostname; + + private final String id; + + private final PaymentMethodDomainProvider provider; + + private final PaymentMethodDomainStatus status; + + private final String updatedAt; + + private final Map additionalProperties; + + private PaymentMethodDomain( + Optional accountId, + String createdAt, + String hostname, + String id, + PaymentMethodDomainProvider provider, + PaymentMethodDomainStatus status, + String updatedAt, + Map additionalProperties) { + this.accountId = accountId; + this.createdAt = createdAt; + this.hostname = hostname; + this.id = id; + this.provider = provider; + this.status = status; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the account the domain is registered for, prefixed biz_. + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return When the domain was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Hostname the checkout is served from (e.g. checkout.example.com). + */ + @JsonProperty("hostname") + public String getHostname() { + return hostname; + } + + /** + * @return Payment method domain ID, prefixed pmd_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Wallet provider the domain is registered with. + */ + @JsonProperty("provider") + public PaymentMethodDomainProvider getProvider() { + return provider; + } + + /** + * @return Verification status. pending means the provider could not fetch the domain-association file yet; only verified domains show wallet payment methods at checkout. + */ + @JsonProperty("status") + public PaymentMethodDomainStatus getStatus() { + return status; + } + + /** + * @return When the domain was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodDomain && equalTo((PaymentMethodDomain) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodDomain other) { + return accountId.equals(other.accountId) + && createdAt.equals(other.createdAt) + && hostname.equals(other.hostname) + && id.equals(other.id) + && provider.equals(other.provider) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, this.createdAt, this.hostname, this.id, this.provider, this.status, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the domain was created, as an ISO 8601 timestamp.

+ */ + HostnameStage createdAt(@NotNull String createdAt); + + Builder from(PaymentMethodDomain other); + } + + public interface HostnameStage { + /** + *

Hostname the checkout is served from (e.g. checkout.example.com).

+ */ + IdStage hostname(@NotNull String hostname); + } + + public interface IdStage { + /** + *

Payment method domain ID, prefixed pmd_.

+ */ + ProviderStage id(@NotNull String id); + } + + public interface ProviderStage { + /** + *

Wallet provider the domain is registered with.

+ */ + StatusStage provider(@NotNull PaymentMethodDomainProvider provider); + } + + public interface StatusStage { + /** + *

Verification status. pending means the provider could not fetch the domain-association file yet; only verified domains show wallet payment methods at checkout.

+ */ + UpdatedAtStage status(@NotNull PaymentMethodDomainStatus status); + } + + public interface UpdatedAtStage { + /** + *

When the domain was last updated, as an ISO 8601 timestamp.

+ */ + _FinalStage updatedAt(@NotNull String updatedAt); + } + + public interface _FinalStage { + PaymentMethodDomain build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

ID of the account the domain is registered for, prefixed biz_.

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, HostnameStage, IdStage, ProviderStage, StatusStage, UpdatedAtStage, _FinalStage { + private String createdAt; + + private String hostname; + + private String id; + + private PaymentMethodDomainProvider provider; + + private PaymentMethodDomainStatus status; + + private String updatedAt; + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodDomain other) { + accountId(other.getAccountId()); + createdAt(other.getCreatedAt()); + hostname(other.getHostname()); + id(other.getId()); + provider(other.getProvider()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

When the domain was created, as an ISO 8601 timestamp.

+ *

When the domain was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public HostnameStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Hostname the checkout is served from (e.g. checkout.example.com).

+ *

Hostname the checkout is served from (e.g. checkout.example.com).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("hostname") + public IdStage hostname(@NotNull String hostname) { + this.hostname = Objects.requireNonNull(hostname, "hostname must not be null"); + return this; + } + + /** + *

Payment method domain ID, prefixed pmd_.

+ *

Payment method domain ID, prefixed pmd_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ProviderStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Wallet provider the domain is registered with.

+ *

Wallet provider the domain is registered with.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("provider") + public StatusStage provider(@NotNull PaymentMethodDomainProvider provider) { + this.provider = Objects.requireNonNull(provider, "provider must not be null"); + return this; + } + + /** + *

Verification status. pending means the provider could not fetch the domain-association file yet; only verified domains show wallet payment methods at checkout.

+ *

Verification status. pending means the provider could not fetch the domain-association file yet; only verified domains show wallet payment methods at checkout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull PaymentMethodDomainStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

When the domain was last updated, as an ISO 8601 timestamp.

+ *

When the domain was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

ID of the account the domain is registered for, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

ID of the account the domain is registered for, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

ID of the account the domain is registered for, prefixed biz_.

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public PaymentMethodDomain build() { + return new PaymentMethodDomain( + accountId, createdAt, hostname, id, provider, status, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodDomainProvider.java b/src/main/java/com/whop/api/types/PaymentMethodDomainProvider.java new file mode 100644 index 00000000..809918cd --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodDomainProvider.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PaymentMethodDomainProvider { + public static final PaymentMethodDomainProvider APPLE = new PaymentMethodDomainProvider(Value.APPLE, "apple"); + + private final Value value; + + private final String string; + + PaymentMethodDomainProvider(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PaymentMethodDomainProvider + && this.string.equals(((PaymentMethodDomainProvider) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPLE: + return visitor.visitApple(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PaymentMethodDomainProvider valueOf(String value) { + switch (value) { + case "apple": + return APPLE; + default: + return new PaymentMethodDomainProvider(Value.UNKNOWN, value); + } + } + + public enum Value { + APPLE, + + UNKNOWN + } + + public interface Visitor { + T visitApple(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodDomainStatus.java b/src/main/java/com/whop/api/types/PaymentMethodDomainStatus.java new file mode 100644 index 00000000..d239873c --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodDomainStatus.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PaymentMethodDomainStatus { + public static final PaymentMethodDomainStatus PENDING = new PaymentMethodDomainStatus(Value.PENDING, "pending"); + + public static final PaymentMethodDomainStatus VERIFIED = new PaymentMethodDomainStatus(Value.VERIFIED, "verified"); + + private final Value value; + + private final String string; + + PaymentMethodDomainStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PaymentMethodDomainStatus + && this.string.equals(((PaymentMethodDomainStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case VERIFIED: + return visitor.visitVerified(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PaymentMethodDomainStatus valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "verified": + return VERIFIED; + default: + return new PaymentMethodDomainStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + VERIFIED, + + UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitVerified(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodIconFiles.java b/src/main/java/com/whop/api/types/PaymentMethodIconFiles.java new file mode 100644 index 00000000..da109eeb --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodIconFiles.java @@ -0,0 +1,232 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodIconFiles.Builder.class) +public final class PaymentMethodIconFiles { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodIconFiles( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodIconFiles && equalTo((PaymentMethodIconFiles) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodIconFiles other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodIconFiles other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodIconFiles build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodIconFiles other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodIconFiles build() { + return new PaymentMethodIconFiles(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodIconVariants.java b/src/main/java/com/whop/api/types/PaymentMethodIconVariants.java new file mode 100644 index 00000000..98835bc2 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodIconVariants.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodIconVariants.Builder.class) +public final class PaymentMethodIconVariants { + private final PaymentMethodIconFiles dark; + + private final PaymentMethodIconFiles light; + + private final Map additionalProperties; + + private PaymentMethodIconVariants( + PaymentMethodIconFiles dark, PaymentMethodIconFiles light, Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodIconFiles getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodIconFiles getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodIconVariants && equalTo((PaymentMethodIconVariants) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodIconVariants other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodIconFiles dark); + + Builder from(PaymentMethodIconVariants other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodIconFiles light); + } + + public interface _FinalStage { + PaymentMethodIconVariants build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodIconFiles dark; + + private PaymentMethodIconFiles light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodIconVariants other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodIconFiles dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodIconFiles light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodIconVariants build() { + return new PaymentMethodIconVariants(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodIcons.java b/src/main/java/com/whop/api/types/PaymentMethodIcons.java new file mode 100644 index 00000000..f96acd2f --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodIcons.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodIcons.Builder.class) +public final class PaymentMethodIcons { + private final PaymentMethodIconVariants card; + + private final PaymentMethodIconVariants square; + + private final Map additionalProperties; + + private PaymentMethodIcons( + PaymentMethodIconVariants card, + PaymentMethodIconVariants square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentMethodIconVariants getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentMethodIconVariants getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodIcons && equalTo((PaymentMethodIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentMethodIconVariants card); + + Builder from(PaymentMethodIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentMethodIconVariants square); + } + + public interface _FinalStage { + PaymentMethodIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentMethodIconVariants card; + + private PaymentMethodIconVariants square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentMethodIconVariants card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentMethodIconVariants square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodIcons build() { + return new PaymentMethodIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethod.java b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethod.java new file mode 100644 index 00000000..a0843ecf --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethod.java @@ -0,0 +1,274 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodIdealPaymentMethod.Builder.class) +public final class PaymentMethodIdealPaymentMethod { + private final OffsetDateTime createdAt; + + private final PaymentMethodIdealPaymentMethodIcons icons; + + private final String id; + + private final PaymentMethodIdealPaymentMethodIdeal ideal; + + private final PaymentMethodTypes paymentMethodType; + + private final Map additionalProperties; + + private PaymentMethodIdealPaymentMethod( + OffsetDateTime createdAt, + PaymentMethodIdealPaymentMethodIcons icons, + String id, + PaymentMethodIdealPaymentMethodIdeal ideal, + PaymentMethodTypes paymentMethodType, + Map additionalProperties) { + this.createdAt = createdAt; + this.icons = icons; + this.id = id; + this.ideal = ideal; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The time of the event in ISO 8601 UTC format with millisecond precision + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art. + */ + @JsonProperty("icons") + public PaymentMethodIdealPaymentMethodIcons getIcons() { + return icons; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The iDEAL-specific details for this payment method, including bank name and BIC. + */ + @JsonProperty("ideal") + public PaymentMethodIdealPaymentMethodIdeal getIdeal() { + return ideal; + } + + /** + * @return The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit). + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodIdealPaymentMethod && equalTo((PaymentMethodIdealPaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodIdealPaymentMethod other) { + return createdAt.equals(other.createdAt) + && icons.equals(other.icons) + && id.equals(other.id) + && ideal.equals(other.ideal) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.icons, this.id, this.ideal, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ */ + IconsStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PaymentMethodIdealPaymentMethod other); + } + + public interface IconsStage { + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ */ + IdStage icons(@NotNull PaymentMethodIdealPaymentMethodIcons icons); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + IdealStage id(@NotNull String id); + } + + public interface IdealStage { + /** + *

The iDEAL-specific details for this payment method, including bank name and BIC.

+ */ + PaymentMethodTypeStage ideal(@NotNull PaymentMethodIdealPaymentMethodIdeal ideal); + } + + public interface PaymentMethodTypeStage { + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ */ + _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface _FinalStage { + PaymentMethodIdealPaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IconsStage, IdStage, IdealStage, PaymentMethodTypeStage, _FinalStage { + private OffsetDateTime createdAt; + + private PaymentMethodIdealPaymentMethodIcons icons; + + private String id; + + private PaymentMethodIdealPaymentMethodIdeal ideal; + + private PaymentMethodTypes paymentMethodType; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodIdealPaymentMethod other) { + createdAt(other.getCreatedAt()); + icons(other.getIcons()); + id(other.getId()); + ideal(other.getIdeal()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ *

The time of the event in ISO 8601 UTC format with millisecond precision

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IconsStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public IdStage icons(@NotNull PaymentMethodIdealPaymentMethodIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IdealStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The iDEAL-specific details for this payment method, including bank name and BIC.

+ *

The iDEAL-specific details for this payment method, including bank name and BIC.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ideal") + public PaymentMethodTypeStage ideal(@NotNull PaymentMethodIdealPaymentMethodIdeal ideal) { + this.ideal = Objects.requireNonNull(ideal, "ideal must not be null"); + return this; + } + + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodIdealPaymentMethod build() { + return new PaymentMethodIdealPaymentMethod( + createdAt, icons, id, ideal, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIcons.java b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIcons.java new file mode 100644 index 00000000..bc8ca12d --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIcons.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodIdealPaymentMethodIcons.Builder.class) +public final class PaymentMethodIdealPaymentMethodIcons { + private final PaymentMethodIdealPaymentMethodIconsCard card; + + private final PaymentMethodIdealPaymentMethodIconsSquare square; + + private final Map additionalProperties; + + private PaymentMethodIdealPaymentMethodIcons( + PaymentMethodIdealPaymentMethodIconsCard card, + PaymentMethodIdealPaymentMethodIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentMethodIdealPaymentMethodIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentMethodIdealPaymentMethodIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodIdealPaymentMethodIcons + && equalTo((PaymentMethodIdealPaymentMethodIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodIdealPaymentMethodIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentMethodIdealPaymentMethodIconsCard card); + + Builder from(PaymentMethodIdealPaymentMethodIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentMethodIdealPaymentMethodIconsSquare square); + } + + public interface _FinalStage { + PaymentMethodIdealPaymentMethodIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentMethodIdealPaymentMethodIconsCard card; + + private PaymentMethodIdealPaymentMethodIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodIdealPaymentMethodIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentMethodIdealPaymentMethodIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentMethodIdealPaymentMethodIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodIdealPaymentMethodIcons build() { + return new PaymentMethodIdealPaymentMethodIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsCard.java b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsCard.java new file mode 100644 index 00000000..82cae0a4 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsCard.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodIdealPaymentMethodIconsCard.Builder.class) +public final class PaymentMethodIdealPaymentMethodIconsCard { + private final PaymentMethodIdealPaymentMethodIconsCardDark dark; + + private final PaymentMethodIdealPaymentMethodIconsCardLight light; + + private final Map additionalProperties; + + private PaymentMethodIdealPaymentMethodIconsCard( + PaymentMethodIdealPaymentMethodIconsCardDark dark, + PaymentMethodIdealPaymentMethodIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodIdealPaymentMethodIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodIdealPaymentMethodIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodIdealPaymentMethodIconsCard + && equalTo((PaymentMethodIdealPaymentMethodIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodIdealPaymentMethodIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodIdealPaymentMethodIconsCardDark dark); + + Builder from(PaymentMethodIdealPaymentMethodIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodIdealPaymentMethodIconsCardLight light); + } + + public interface _FinalStage { + PaymentMethodIdealPaymentMethodIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodIdealPaymentMethodIconsCardDark dark; + + private PaymentMethodIdealPaymentMethodIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodIdealPaymentMethodIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodIdealPaymentMethodIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodIdealPaymentMethodIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodIdealPaymentMethodIconsCard build() { + return new PaymentMethodIdealPaymentMethodIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsCardDark.java new file mode 100644 index 00000000..f11f4b57 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsCardDark.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodIdealPaymentMethodIconsCardDark.Builder.class) +public final class PaymentMethodIdealPaymentMethodIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodIdealPaymentMethodIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodIdealPaymentMethodIconsCardDark + && equalTo((PaymentMethodIdealPaymentMethodIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodIdealPaymentMethodIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodIdealPaymentMethodIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodIdealPaymentMethodIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodIdealPaymentMethodIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodIdealPaymentMethodIconsCardDark build() { + return new PaymentMethodIdealPaymentMethodIconsCardDark(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsCardLight.java new file mode 100644 index 00000000..ac4107d1 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsCardLight.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodIdealPaymentMethodIconsCardLight.Builder.class) +public final class PaymentMethodIdealPaymentMethodIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodIdealPaymentMethodIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodIdealPaymentMethodIconsCardLight + && equalTo((PaymentMethodIdealPaymentMethodIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodIdealPaymentMethodIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodIdealPaymentMethodIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodIdealPaymentMethodIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodIdealPaymentMethodIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodIdealPaymentMethodIconsCardLight build() { + return new PaymentMethodIdealPaymentMethodIconsCardLight(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsSquare.java b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsSquare.java new file mode 100644 index 00000000..92d8d752 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodIdealPaymentMethodIconsSquare.Builder.class) +public final class PaymentMethodIdealPaymentMethodIconsSquare { + private final PaymentMethodIdealPaymentMethodIconsSquareDark dark; + + private final PaymentMethodIdealPaymentMethodIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentMethodIdealPaymentMethodIconsSquare( + PaymentMethodIdealPaymentMethodIconsSquareDark dark, + PaymentMethodIdealPaymentMethodIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodIdealPaymentMethodIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodIdealPaymentMethodIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodIdealPaymentMethodIconsSquare + && equalTo((PaymentMethodIdealPaymentMethodIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodIdealPaymentMethodIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodIdealPaymentMethodIconsSquareDark dark); + + Builder from(PaymentMethodIdealPaymentMethodIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodIdealPaymentMethodIconsSquareLight light); + } + + public interface _FinalStage { + PaymentMethodIdealPaymentMethodIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodIdealPaymentMethodIconsSquareDark dark; + + private PaymentMethodIdealPaymentMethodIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodIdealPaymentMethodIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodIdealPaymentMethodIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodIdealPaymentMethodIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodIdealPaymentMethodIconsSquare build() { + return new PaymentMethodIdealPaymentMethodIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsSquareDark.java new file mode 100644 index 00000000..052ad31f --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsSquareDark.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodIdealPaymentMethodIconsSquareDark.Builder.class) +public final class PaymentMethodIdealPaymentMethodIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodIdealPaymentMethodIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodIdealPaymentMethodIconsSquareDark + && equalTo((PaymentMethodIdealPaymentMethodIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodIdealPaymentMethodIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodIdealPaymentMethodIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodIdealPaymentMethodIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodIdealPaymentMethodIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodIdealPaymentMethodIconsSquareDark build() { + return new PaymentMethodIdealPaymentMethodIconsSquareDark(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsSquareLight.java new file mode 100644 index 00000000..c62a8737 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIconsSquareLight.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodIdealPaymentMethodIconsSquareLight.Builder.class) +public final class PaymentMethodIdealPaymentMethodIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodIdealPaymentMethodIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodIdealPaymentMethodIconsSquareLight + && equalTo((PaymentMethodIdealPaymentMethodIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodIdealPaymentMethodIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodIdealPaymentMethodIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodIdealPaymentMethodIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodIdealPaymentMethodIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodIdealPaymentMethodIconsSquareLight build() { + return new PaymentMethodIdealPaymentMethodIconsSquareLight(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIdeal.java b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIdeal.java new file mode 100644 index 00000000..640e871a --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodIdealPaymentMethodIdeal.java @@ -0,0 +1,184 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodIdealPaymentMethodIdeal.Builder.class) +public final class PaymentMethodIdealPaymentMethodIdeal { + private final Optional bank; + + private final Optional bic; + + private final Map additionalProperties; + + private PaymentMethodIdealPaymentMethodIdeal( + Optional bank, Optional bic, Map additionalProperties) { + this.bank = bank; + this.bic = bic; + this.additionalProperties = additionalProperties; + } + + /** + * @return The name of the customer's bank used for the iDEAL transaction. Null if not available. + */ + @JsonIgnore + public Optional getBank() { + if (bank == null) { + return Optional.empty(); + } + return bank; + } + + /** + * @return The Bank Identifier Code (BIC/SWIFT) of the customer's bank. Null if not available. + */ + @JsonIgnore + public Optional getBic() { + if (bic == null) { + return Optional.empty(); + } + return bic; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bank") + private Optional _getBank() { + return bank; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bic") + private Optional _getBic() { + return bic; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodIdealPaymentMethodIdeal + && equalTo((PaymentMethodIdealPaymentMethodIdeal) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodIdealPaymentMethodIdeal other) { + return bank.equals(other.bank) && bic.equals(other.bic); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.bank, this.bic); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional bank = Optional.empty(); + + private Optional bic = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentMethodIdealPaymentMethodIdeal other) { + bank(other.getBank()); + bic(other.getBic()); + return this; + } + + /** + *

The name of the customer's bank used for the iDEAL transaction. Null if not available.

+ */ + @JsonSetter(value = "bank", nulls = Nulls.SKIP) + public Builder bank(Optional bank) { + this.bank = bank; + return this; + } + + public Builder bank(String bank) { + this.bank = Optional.ofNullable(bank); + return this; + } + + public Builder bank(Nullable bank) { + if (bank.isNull()) { + this.bank = null; + } else if (bank.isEmpty()) { + this.bank = Optional.empty(); + } else { + this.bank = Optional.of(bank.get()); + } + return this; + } + + /** + *

The Bank Identifier Code (BIC/SWIFT) of the customer's bank. Null if not available.

+ */ + @JsonSetter(value = "bic", nulls = Nulls.SKIP) + public Builder bic(Optional bic) { + this.bic = bic; + return this; + } + + public Builder bic(String bic) { + this.bic = Optional.ofNullable(bic); + return this; + } + + public Builder bic(Nullable bic) { + if (bic.isNull()) { + this.bic = null; + } else if (bic.isEmpty()) { + this.bic = Optional.empty(); + } else { + this.bic = Optional.of(bic.get()); + } + return this; + } + + public PaymentMethodIdealPaymentMethodIdeal build() { + return new PaymentMethodIdealPaymentMethodIdeal(bank, bic, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItem.java b/src/main/java/com/whop/api/types/PaymentMethodListItem.java new file mode 100644 index 00000000..4f60b03d --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItem.java @@ -0,0 +1,518 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class PaymentMethodListItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PaymentMethodListItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PaymentMethodListItem basePaymentMethod(PaymentMethodListItemBasePaymentMethod value) { + return new PaymentMethodListItem(new BasePaymentMethodValue(value)); + } + + public static PaymentMethodListItem cardPaymentMethod(PaymentMethodListItemCardPaymentMethod value) { + return new PaymentMethodListItem(new CardPaymentMethodValue(value)); + } + + public static PaymentMethodListItem usBankAccountPaymentMethod( + PaymentMethodListItemUsBankAccountPaymentMethod value) { + return new PaymentMethodListItem(new UsBankAccountPaymentMethodValue(value)); + } + + public static PaymentMethodListItem cashappPaymentMethod(PaymentMethodListItemCashappPaymentMethod value) { + return new PaymentMethodListItem(new CashappPaymentMethodValue(value)); + } + + public static PaymentMethodListItem idealPaymentMethod(PaymentMethodListItemIdealPaymentMethod value) { + return new PaymentMethodListItem(new IdealPaymentMethodValue(value)); + } + + public static PaymentMethodListItem sepaDebitPaymentMethod(PaymentMethodListItemSepaDebitPaymentMethod value) { + return new PaymentMethodListItem(new SepaDebitPaymentMethodValue(value)); + } + + public static PaymentMethodListItem platformBalancePaymentMethod( + PaymentMethodListItemPlatformBalancePaymentMethod value) { + return new PaymentMethodListItem(new PlatformBalancePaymentMethodValue(value)); + } + + public boolean isBasePaymentMethod() { + return value instanceof BasePaymentMethodValue; + } + + public boolean isCardPaymentMethod() { + return value instanceof CardPaymentMethodValue; + } + + public boolean isUsBankAccountPaymentMethod() { + return value instanceof UsBankAccountPaymentMethodValue; + } + + public boolean isCashappPaymentMethod() { + return value instanceof CashappPaymentMethodValue; + } + + public boolean isIdealPaymentMethod() { + return value instanceof IdealPaymentMethodValue; + } + + public boolean isSepaDebitPaymentMethod() { + return value instanceof SepaDebitPaymentMethodValue; + } + + public boolean isPlatformBalancePaymentMethod() { + return value instanceof PlatformBalancePaymentMethodValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getBasePaymentMethod() { + if (isBasePaymentMethod()) { + return Optional.of(((BasePaymentMethodValue) value).value); + } + return Optional.empty(); + } + + public Optional getCardPaymentMethod() { + if (isCardPaymentMethod()) { + return Optional.of(((CardPaymentMethodValue) value).value); + } + return Optional.empty(); + } + + public Optional getUsBankAccountPaymentMethod() { + if (isUsBankAccountPaymentMethod()) { + return Optional.of(((UsBankAccountPaymentMethodValue) value).value); + } + return Optional.empty(); + } + + public Optional getCashappPaymentMethod() { + if (isCashappPaymentMethod()) { + return Optional.of(((CashappPaymentMethodValue) value).value); + } + return Optional.empty(); + } + + public Optional getIdealPaymentMethod() { + if (isIdealPaymentMethod()) { + return Optional.of(((IdealPaymentMethodValue) value).value); + } + return Optional.empty(); + } + + public Optional getSepaDebitPaymentMethod() { + if (isSepaDebitPaymentMethod()) { + return Optional.of(((SepaDebitPaymentMethodValue) value).value); + } + return Optional.empty(); + } + + public Optional getPlatformBalancePaymentMethod() { + if (isPlatformBalancePaymentMethod()) { + return Optional.of(((PlatformBalancePaymentMethodValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItem && value.equals(((PaymentMethodListItem) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitBasePaymentMethod(PaymentMethodListItemBasePaymentMethod basePaymentMethod); + + T visitCardPaymentMethod(PaymentMethodListItemCardPaymentMethod cardPaymentMethod); + + T visitUsBankAccountPaymentMethod(PaymentMethodListItemUsBankAccountPaymentMethod usBankAccountPaymentMethod); + + T visitCashappPaymentMethod(PaymentMethodListItemCashappPaymentMethod cashappPaymentMethod); + + T visitIdealPaymentMethod(PaymentMethodListItemIdealPaymentMethod idealPaymentMethod); + + T visitSepaDebitPaymentMethod(PaymentMethodListItemSepaDebitPaymentMethod sepaDebitPaymentMethod); + + T visitPlatformBalancePaymentMethod( + PaymentMethodListItemPlatformBalancePaymentMethod platformBalancePaymentMethod); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(BasePaymentMethodValue.class), + @JsonSubTypes.Type(CardPaymentMethodValue.class), + @JsonSubTypes.Type(UsBankAccountPaymentMethodValue.class), + @JsonSubTypes.Type(CashappPaymentMethodValue.class), + @JsonSubTypes.Type(IdealPaymentMethodValue.class), + @JsonSubTypes.Type(SepaDebitPaymentMethodValue.class), + @JsonSubTypes.Type(PlatformBalancePaymentMethodValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("BasePaymentMethod") + @JsonIgnoreProperties("typename") + private static final class BasePaymentMethodValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PaymentMethodListItemBasePaymentMethod value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BasePaymentMethodValue() {} + + private BasePaymentMethodValue(PaymentMethodListItemBasePaymentMethod value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBasePaymentMethod(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BasePaymentMethodValue && equalTo((BasePaymentMethodValue) other); + } + + private boolean equalTo(BasePaymentMethodValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethodListItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("CardPaymentMethod") + @JsonIgnoreProperties("typename") + private static final class CardPaymentMethodValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PaymentMethodListItemCardPaymentMethod value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CardPaymentMethodValue() {} + + private CardPaymentMethodValue(PaymentMethodListItemCardPaymentMethod value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCardPaymentMethod(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CardPaymentMethodValue && equalTo((CardPaymentMethodValue) other); + } + + private boolean equalTo(CardPaymentMethodValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethodListItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("UsBankAccountPaymentMethod") + @JsonIgnoreProperties("typename") + private static final class UsBankAccountPaymentMethodValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PaymentMethodListItemUsBankAccountPaymentMethod value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UsBankAccountPaymentMethodValue() {} + + private UsBankAccountPaymentMethodValue(PaymentMethodListItemUsBankAccountPaymentMethod value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUsBankAccountPaymentMethod(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UsBankAccountPaymentMethodValue && equalTo((UsBankAccountPaymentMethodValue) other); + } + + private boolean equalTo(UsBankAccountPaymentMethodValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethodListItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("CashappPaymentMethod") + @JsonIgnoreProperties("typename") + private static final class CashappPaymentMethodValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PaymentMethodListItemCashappPaymentMethod value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CashappPaymentMethodValue() {} + + private CashappPaymentMethodValue(PaymentMethodListItemCashappPaymentMethod value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCashappPaymentMethod(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CashappPaymentMethodValue && equalTo((CashappPaymentMethodValue) other); + } + + private boolean equalTo(CashappPaymentMethodValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethodListItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("IdealPaymentMethod") + @JsonIgnoreProperties("typename") + private static final class IdealPaymentMethodValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PaymentMethodListItemIdealPaymentMethod value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private IdealPaymentMethodValue() {} + + private IdealPaymentMethodValue(PaymentMethodListItemIdealPaymentMethod value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitIdealPaymentMethod(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IdealPaymentMethodValue && equalTo((IdealPaymentMethodValue) other); + } + + private boolean equalTo(IdealPaymentMethodValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethodListItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("SepaDebitPaymentMethod") + @JsonIgnoreProperties("typename") + private static final class SepaDebitPaymentMethodValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PaymentMethodListItemSepaDebitPaymentMethod value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SepaDebitPaymentMethodValue() {} + + private SepaDebitPaymentMethodValue(PaymentMethodListItemSepaDebitPaymentMethod value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSepaDebitPaymentMethod(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SepaDebitPaymentMethodValue && equalTo((SepaDebitPaymentMethodValue) other); + } + + private boolean equalTo(SepaDebitPaymentMethodValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethodListItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("PlatformBalancePaymentMethod") + @JsonIgnoreProperties("typename") + private static final class PlatformBalancePaymentMethodValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private PaymentMethodListItemPlatformBalancePaymentMethod value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private PlatformBalancePaymentMethodValue() {} + + private PlatformBalancePaymentMethodValue(PaymentMethodListItemPlatformBalancePaymentMethod value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitPlatformBalancePaymentMethod(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlatformBalancePaymentMethodValue + && equalTo((PlatformBalancePaymentMethodValue) other); + } + + private boolean equalTo(PlatformBalancePaymentMethodValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethodListItem{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentMethodListItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethod.java b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethod.java new file mode 100644 index 00000000..ffd1c895 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethod.java @@ -0,0 +1,240 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemBasePaymentMethod.Builder.class) +public final class PaymentMethodListItemBasePaymentMethod { + private final OffsetDateTime createdAt; + + private final PaymentMethodListItemBasePaymentMethodIcons icons; + + private final String id; + + private final PaymentMethodTypes paymentMethodType; + + private final Map additionalProperties; + + private PaymentMethodListItemBasePaymentMethod( + OffsetDateTime createdAt, + PaymentMethodListItemBasePaymentMethodIcons icons, + String id, + PaymentMethodTypes paymentMethodType, + Map additionalProperties) { + this.createdAt = createdAt; + this.icons = icons; + this.id = id; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The time of the event in ISO 8601 UTC format with millisecond precision + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art. + */ + @JsonProperty("icons") + public PaymentMethodListItemBasePaymentMethodIcons getIcons() { + return icons; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit). + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemBasePaymentMethod + && equalTo((PaymentMethodListItemBasePaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemBasePaymentMethod other) { + return createdAt.equals(other.createdAt) + && icons.equals(other.icons) + && id.equals(other.id) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.icons, this.id, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ */ + IconsStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PaymentMethodListItemBasePaymentMethod other); + } + + public interface IconsStage { + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ */ + IdStage icons(@NotNull PaymentMethodListItemBasePaymentMethodIcons icons); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ */ + _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface _FinalStage { + PaymentMethodListItemBasePaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IconsStage, IdStage, PaymentMethodTypeStage, _FinalStage { + private OffsetDateTime createdAt; + + private PaymentMethodListItemBasePaymentMethodIcons icons; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemBasePaymentMethod other) { + createdAt(other.getCreatedAt()); + icons(other.getIcons()); + id(other.getId()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ *

The time of the event in ISO 8601 UTC format with millisecond precision

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IconsStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public IdStage icons(@NotNull PaymentMethodListItemBasePaymentMethodIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemBasePaymentMethod build() { + return new PaymentMethodListItemBasePaymentMethod( + createdAt, icons, id, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIcons.java b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIcons.java new file mode 100644 index 00000000..bf55226b --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIcons.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemBasePaymentMethodIcons.Builder.class) +public final class PaymentMethodListItemBasePaymentMethodIcons { + private final PaymentMethodListItemBasePaymentMethodIconsCard card; + + private final PaymentMethodListItemBasePaymentMethodIconsSquare square; + + private final Map additionalProperties; + + private PaymentMethodListItemBasePaymentMethodIcons( + PaymentMethodListItemBasePaymentMethodIconsCard card, + PaymentMethodListItemBasePaymentMethodIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentMethodListItemBasePaymentMethodIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentMethodListItemBasePaymentMethodIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemBasePaymentMethodIcons + && equalTo((PaymentMethodListItemBasePaymentMethodIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemBasePaymentMethodIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentMethodListItemBasePaymentMethodIconsCard card); + + Builder from(PaymentMethodListItemBasePaymentMethodIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentMethodListItemBasePaymentMethodIconsSquare square); + } + + public interface _FinalStage { + PaymentMethodListItemBasePaymentMethodIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentMethodListItemBasePaymentMethodIconsCard card; + + private PaymentMethodListItemBasePaymentMethodIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemBasePaymentMethodIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentMethodListItemBasePaymentMethodIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentMethodListItemBasePaymentMethodIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemBasePaymentMethodIcons build() { + return new PaymentMethodListItemBasePaymentMethodIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsCard.java b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsCard.java new file mode 100644 index 00000000..f0120aaf --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsCard.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemBasePaymentMethodIconsCard.Builder.class) +public final class PaymentMethodListItemBasePaymentMethodIconsCard { + private final PaymentMethodListItemBasePaymentMethodIconsCardDark dark; + + private final PaymentMethodListItemBasePaymentMethodIconsCardLight light; + + private final Map additionalProperties; + + private PaymentMethodListItemBasePaymentMethodIconsCard( + PaymentMethodListItemBasePaymentMethodIconsCardDark dark, + PaymentMethodListItemBasePaymentMethodIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodListItemBasePaymentMethodIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodListItemBasePaymentMethodIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemBasePaymentMethodIconsCard + && equalTo((PaymentMethodListItemBasePaymentMethodIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemBasePaymentMethodIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodListItemBasePaymentMethodIconsCardDark dark); + + Builder from(PaymentMethodListItemBasePaymentMethodIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodListItemBasePaymentMethodIconsCardLight light); + } + + public interface _FinalStage { + PaymentMethodListItemBasePaymentMethodIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodListItemBasePaymentMethodIconsCardDark dark; + + private PaymentMethodListItemBasePaymentMethodIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemBasePaymentMethodIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodListItemBasePaymentMethodIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodListItemBasePaymentMethodIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemBasePaymentMethodIconsCard build() { + return new PaymentMethodListItemBasePaymentMethodIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsCardDark.java new file mode 100644 index 00000000..d2d9cff3 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsCardDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemBasePaymentMethodIconsCardDark.Builder.class) +public final class PaymentMethodListItemBasePaymentMethodIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemBasePaymentMethodIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemBasePaymentMethodIconsCardDark + && equalTo((PaymentMethodListItemBasePaymentMethodIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemBasePaymentMethodIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemBasePaymentMethodIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemBasePaymentMethodIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemBasePaymentMethodIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemBasePaymentMethodIconsCardDark build() { + return new PaymentMethodListItemBasePaymentMethodIconsCardDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsCardLight.java new file mode 100644 index 00000000..124db230 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsCardLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemBasePaymentMethodIconsCardLight.Builder.class) +public final class PaymentMethodListItemBasePaymentMethodIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemBasePaymentMethodIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemBasePaymentMethodIconsCardLight + && equalTo((PaymentMethodListItemBasePaymentMethodIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemBasePaymentMethodIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemBasePaymentMethodIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemBasePaymentMethodIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemBasePaymentMethodIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemBasePaymentMethodIconsCardLight build() { + return new PaymentMethodListItemBasePaymentMethodIconsCardLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsSquare.java b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsSquare.java new file mode 100644 index 00000000..1bbd0f26 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemBasePaymentMethodIconsSquare.Builder.class) +public final class PaymentMethodListItemBasePaymentMethodIconsSquare { + private final PaymentMethodListItemBasePaymentMethodIconsSquareDark dark; + + private final PaymentMethodListItemBasePaymentMethodIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentMethodListItemBasePaymentMethodIconsSquare( + PaymentMethodListItemBasePaymentMethodIconsSquareDark dark, + PaymentMethodListItemBasePaymentMethodIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodListItemBasePaymentMethodIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodListItemBasePaymentMethodIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemBasePaymentMethodIconsSquare + && equalTo((PaymentMethodListItemBasePaymentMethodIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemBasePaymentMethodIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodListItemBasePaymentMethodIconsSquareDark dark); + + Builder from(PaymentMethodListItemBasePaymentMethodIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodListItemBasePaymentMethodIconsSquareLight light); + } + + public interface _FinalStage { + PaymentMethodListItemBasePaymentMethodIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodListItemBasePaymentMethodIconsSquareDark dark; + + private PaymentMethodListItemBasePaymentMethodIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemBasePaymentMethodIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodListItemBasePaymentMethodIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodListItemBasePaymentMethodIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemBasePaymentMethodIconsSquare build() { + return new PaymentMethodListItemBasePaymentMethodIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsSquareDark.java new file mode 100644 index 00000000..81a37a67 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsSquareDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemBasePaymentMethodIconsSquareDark.Builder.class) +public final class PaymentMethodListItemBasePaymentMethodIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemBasePaymentMethodIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemBasePaymentMethodIconsSquareDark + && equalTo((PaymentMethodListItemBasePaymentMethodIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemBasePaymentMethodIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemBasePaymentMethodIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemBasePaymentMethodIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemBasePaymentMethodIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemBasePaymentMethodIconsSquareDark build() { + return new PaymentMethodListItemBasePaymentMethodIconsSquareDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsSquareLight.java new file mode 100644 index 00000000..fe0a07ae --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemBasePaymentMethodIconsSquareLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemBasePaymentMethodIconsSquareLight.Builder.class) +public final class PaymentMethodListItemBasePaymentMethodIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemBasePaymentMethodIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemBasePaymentMethodIconsSquareLight + && equalTo((PaymentMethodListItemBasePaymentMethodIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemBasePaymentMethodIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemBasePaymentMethodIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemBasePaymentMethodIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemBasePaymentMethodIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemBasePaymentMethodIconsSquareLight build() { + return new PaymentMethodListItemBasePaymentMethodIconsSquareLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethod.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethod.java new file mode 100644 index 00000000..99031374 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethod.java @@ -0,0 +1,317 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCardPaymentMethod.Builder.class) +public final class PaymentMethodListItemCardPaymentMethod { + private final PaymentMethodListItemCardPaymentMethodCard card; + + private final OffsetDateTime createdAt; + + private final boolean hasPayerDocument; + + private final PaymentMethodListItemCardPaymentMethodIcons icons; + + private final String id; + + private final PaymentMethodTypes paymentMethodType; + + private final Map additionalProperties; + + private PaymentMethodListItemCardPaymentMethod( + PaymentMethodListItemCardPaymentMethodCard card, + OffsetDateTime createdAt, + boolean hasPayerDocument, + PaymentMethodListItemCardPaymentMethodIcons icons, + String id, + PaymentMethodTypes paymentMethodType, + Map additionalProperties) { + this.card = card; + this.createdAt = createdAt; + this.hasPayerDocument = hasPayerDocument; + this.icons = icons; + this.id = id; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The card-specific details for this payment method, including brand, last four digits, and expiration. + */ + @JsonProperty("card") + public PaymentMethodListItemCardPaymentMethodCard getCard() { + return card; + } + + /** + * @return The time of the event in ISO 8601 UTC format with millisecond precision + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Whether this card has the payer identity document required by its payment provider. + */ + @JsonProperty("has_payer_document") + public boolean getHasPayerDocument() { + return hasPayerDocument; + } + + /** + * @return Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art. + */ + @JsonProperty("icons") + public PaymentMethodListItemCardPaymentMethodIcons getIcons() { + return icons; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit). + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCardPaymentMethod + && equalTo((PaymentMethodListItemCardPaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCardPaymentMethod other) { + return card.equals(other.card) + && createdAt.equals(other.createdAt) + && hasPayerDocument == other.hasPayerDocument + && icons.equals(other.icons) + && id.equals(other.id) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.card, this.createdAt, this.hasPayerDocument, this.icons, this.id, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The card-specific details for this payment method, including brand, last four digits, and expiration.

+ */ + CreatedAtStage card(@NotNull PaymentMethodListItemCardPaymentMethodCard card); + + Builder from(PaymentMethodListItemCardPaymentMethod other); + } + + public interface CreatedAtStage { + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ */ + HasPayerDocumentStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface HasPayerDocumentStage { + /** + *

Whether this card has the payer identity document required by its payment provider.

+ */ + IconsStage hasPayerDocument(boolean hasPayerDocument); + } + + public interface IconsStage { + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ */ + IdStage icons(@NotNull PaymentMethodListItemCardPaymentMethodIcons icons); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ */ + _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface _FinalStage { + PaymentMethodListItemCardPaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CardStage, + CreatedAtStage, + HasPayerDocumentStage, + IconsStage, + IdStage, + PaymentMethodTypeStage, + _FinalStage { + private PaymentMethodListItemCardPaymentMethodCard card; + + private OffsetDateTime createdAt; + + private boolean hasPayerDocument; + + private PaymentMethodListItemCardPaymentMethodIcons icons; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCardPaymentMethod other) { + card(other.getCard()); + createdAt(other.getCreatedAt()); + hasPayerDocument(other.getHasPayerDocument()); + icons(other.getIcons()); + id(other.getId()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

The card-specific details for this payment method, including brand, last four digits, and expiration.

+ *

The card-specific details for this payment method, including brand, last four digits, and expiration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public CreatedAtStage card(@NotNull PaymentMethodListItemCardPaymentMethodCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ *

The time of the event in ISO 8601 UTC format with millisecond precision

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public HasPayerDocumentStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Whether this card has the payer identity document required by its payment provider.

+ *

Whether this card has the payer identity document required by its payment provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("has_payer_document") + public IconsStage hasPayerDocument(boolean hasPayerDocument) { + this.hasPayerDocument = hasPayerDocument; + return this; + } + + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public IdStage icons(@NotNull PaymentMethodListItemCardPaymentMethodIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCardPaymentMethod build() { + return new PaymentMethodListItemCardPaymentMethod( + card, createdAt, hasPayerDocument, icons, id, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodCard.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodCard.java new file mode 100644 index 00000000..ba1ce9d7 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodCard.java @@ -0,0 +1,608 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCardPaymentMethodCard.Builder.class) +public final class PaymentMethodListItemCardPaymentMethodCard { + private final Optional brand; + + private final Optional expMonth; + + private final Optional expYear; + + private final boolean expired; + + private final Optional fingerprint; + + private final Optional fundingType; + + private final Optional last4; + + private final boolean threeDsVerified; + + private final Map additionalProperties; + + private PaymentMethodListItemCardPaymentMethodCard( + Optional brand, + Optional expMonth, + Optional expYear, + boolean expired, + Optional fingerprint, + Optional fundingType, + Optional last4, + boolean threeDsVerified, + Map additionalProperties) { + this.brand = brand; + this.expMonth = expMonth; + this.expYear = expYear; + this.expired = expired; + this.fingerprint = fingerprint; + this.fundingType = fundingType; + this.last4 = last4; + this.threeDsVerified = threeDsVerified; + this.additionalProperties = additionalProperties; + } + + /** + * @return The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined. + */ + @JsonIgnore + public Optional getBrand() { + if (brand == null) { + return Optional.empty(); + } + return brand; + } + + /** + * @return The two-digit expiration month of the card (1-12). Null if not available. + */ + @JsonIgnore + public Optional getExpMonth() { + if (expMonth == null) { + return Optional.empty(); + } + return expMonth; + } + + /** + * @return The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available. + */ + @JsonIgnore + public Optional getExpYear() { + if (expYear == null) { + return Optional.empty(); + } + return expYear; + } + + /** + * @return Whether the card is past its expiration month. An expired card cannot take a new charge. + */ + @JsonProperty("expired") + public boolean getExpired() { + return expired; + } + + /** + * @return A stable identifier for the underlying card. Two payment methods with the same fingerprint are the same card. Null if not available. + */ + @JsonIgnore + public Optional getFingerprint() { + if (fingerprint == null) { + return Optional.empty(); + } + return fingerprint; + } + + /** + * @return How the card is funded by the issuer. Null if the funding type could not be determined. + */ + @JsonIgnore + public Optional getFundingType() { + if (fundingType == null) { + return Optional.empty(); + } + return fundingType; + } + + /** + * @return The last four digits of the card number. Null if not available. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + /** + * @return Whether this card was verified with 3D Secure, either when it was saved or on a payment that used it. + */ + @JsonProperty("three_ds_verified") + public boolean getThreeDsVerified() { + return threeDsVerified; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("brand") + private Optional _getBrand() { + return brand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_month") + private Optional _getExpMonth() { + return expMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_year") + private Optional _getExpYear() { + return expYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fingerprint") + private Optional _getFingerprint() { + return fingerprint; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("funding_type") + private Optional _getFundingType() { + return fundingType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCardPaymentMethodCard + && equalTo((PaymentMethodListItemCardPaymentMethodCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCardPaymentMethodCard other) { + return brand.equals(other.brand) + && expMonth.equals(other.expMonth) + && expYear.equals(other.expYear) + && expired == other.expired + && fingerprint.equals(other.fingerprint) + && fundingType.equals(other.fundingType) + && last4.equals(other.last4) + && threeDsVerified == other.threeDsVerified; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.brand, + this.expMonth, + this.expYear, + this.expired, + this.fingerprint, + this.fundingType, + this.last4, + this.threeDsVerified); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExpiredStage builder() { + return new Builder(); + } + + public interface ExpiredStage { + /** + *

Whether the card is past its expiration month. An expired card cannot take a new charge.

+ */ + ThreeDsVerifiedStage expired(boolean expired); + + Builder from(PaymentMethodListItemCardPaymentMethodCard other); + } + + public interface ThreeDsVerifiedStage { + /** + *

Whether this card was verified with 3D Secure, either when it was saved or on a payment that used it.

+ */ + _FinalStage threeDsVerified(boolean threeDsVerified); + } + + public interface _FinalStage { + PaymentMethodListItemCardPaymentMethodCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined.

+ */ + _FinalStage brand(Optional brand); + + _FinalStage brand(CardBrands brand); + + _FinalStage brand(Nullable brand); + + /** + *

The two-digit expiration month of the card (1-12). Null if not available.

+ */ + _FinalStage expMonth(Optional expMonth); + + _FinalStage expMonth(Integer expMonth); + + _FinalStage expMonth(Nullable expMonth); + + /** + *

The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available.

+ */ + _FinalStage expYear(Optional expYear); + + _FinalStage expYear(Integer expYear); + + _FinalStage expYear(Nullable expYear); + + /** + *

A stable identifier for the underlying card. Two payment methods with the same fingerprint are the same card. Null if not available.

+ */ + _FinalStage fingerprint(Optional fingerprint); + + _FinalStage fingerprint(String fingerprint); + + _FinalStage fingerprint(Nullable fingerprint); + + /** + *

How the card is funded by the issuer. Null if the funding type could not be determined.

+ */ + _FinalStage fundingType(Optional fundingType); + + _FinalStage fundingType(CardFundingTypes fundingType); + + _FinalStage fundingType(Nullable fundingType); + + /** + *

The last four digits of the card number. Null if not available.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExpiredStage, ThreeDsVerifiedStage, _FinalStage { + private boolean expired; + + private boolean threeDsVerified; + + private Optional last4 = Optional.empty(); + + private Optional fundingType = Optional.empty(); + + private Optional fingerprint = Optional.empty(); + + private Optional expYear = Optional.empty(); + + private Optional expMonth = Optional.empty(); + + private Optional brand = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCardPaymentMethodCard other) { + brand(other.getBrand()); + expMonth(other.getExpMonth()); + expYear(other.getExpYear()); + expired(other.getExpired()); + fingerprint(other.getFingerprint()); + fundingType(other.getFundingType()); + last4(other.getLast4()); + threeDsVerified(other.getThreeDsVerified()); + return this; + } + + /** + *

Whether the card is past its expiration month. An expired card cannot take a new charge.

+ *

Whether the card is past its expiration month. An expired card cannot take a new charge.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("expired") + public ThreeDsVerifiedStage expired(boolean expired) { + this.expired = expired; + return this; + } + + /** + *

Whether this card was verified with 3D Secure, either when it was saved or on a payment that used it.

+ *

Whether this card was verified with 3D Secure, either when it was saved or on a payment that used it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("three_ds_verified") + public _FinalStage threeDsVerified(boolean threeDsVerified) { + this.threeDsVerified = threeDsVerified; + return this; + } + + /** + *

The last four digits of the card number. Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

The last four digits of the card number. Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

The last four digits of the card number. Null if not available.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + /** + *

How the card is funded by the issuer. Null if the funding type could not be determined.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fundingType(Nullable fundingType) { + if (fundingType.isNull()) { + this.fundingType = null; + } else if (fundingType.isEmpty()) { + this.fundingType = Optional.empty(); + } else { + this.fundingType = Optional.of(fundingType.get()); + } + return this; + } + + /** + *

How the card is funded by the issuer. Null if the funding type could not be determined.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fundingType(CardFundingTypes fundingType) { + this.fundingType = Optional.ofNullable(fundingType); + return this; + } + + /** + *

How the card is funded by the issuer. Null if the funding type could not be determined.

+ */ + @java.lang.Override + @JsonSetter(value = "funding_type", nulls = Nulls.SKIP) + public _FinalStage fundingType(Optional fundingType) { + this.fundingType = fundingType; + return this; + } + + /** + *

A stable identifier for the underlying card. Two payment methods with the same fingerprint are the same card. Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fingerprint(Nullable fingerprint) { + if (fingerprint.isNull()) { + this.fingerprint = null; + } else if (fingerprint.isEmpty()) { + this.fingerprint = Optional.empty(); + } else { + this.fingerprint = Optional.of(fingerprint.get()); + } + return this; + } + + /** + *

A stable identifier for the underlying card. Two payment methods with the same fingerprint are the same card. Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fingerprint(String fingerprint) { + this.fingerprint = Optional.ofNullable(fingerprint); + return this; + } + + /** + *

A stable identifier for the underlying card. Two payment methods with the same fingerprint are the same card. Null if not available.

+ */ + @java.lang.Override + @JsonSetter(value = "fingerprint", nulls = Nulls.SKIP) + public _FinalStage fingerprint(Optional fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + /** + *

The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expYear(Nullable expYear) { + if (expYear.isNull()) { + this.expYear = null; + } else if (expYear.isEmpty()) { + this.expYear = Optional.empty(); + } else { + this.expYear = Optional.of(expYear.get()); + } + return this; + } + + /** + *

The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expYear(Integer expYear) { + this.expYear = Optional.ofNullable(expYear); + return this; + } + + /** + *

The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available.

+ */ + @java.lang.Override + @JsonSetter(value = "exp_year", nulls = Nulls.SKIP) + public _FinalStage expYear(Optional expYear) { + this.expYear = expYear; + return this; + } + + /** + *

The two-digit expiration month of the card (1-12). Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expMonth(Nullable expMonth) { + if (expMonth.isNull()) { + this.expMonth = null; + } else if (expMonth.isEmpty()) { + this.expMonth = Optional.empty(); + } else { + this.expMonth = Optional.of(expMonth.get()); + } + return this; + } + + /** + *

The two-digit expiration month of the card (1-12). Null if not available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expMonth(Integer expMonth) { + this.expMonth = Optional.ofNullable(expMonth); + return this; + } + + /** + *

The two-digit expiration month of the card (1-12). Null if not available.

+ */ + @java.lang.Override + @JsonSetter(value = "exp_month", nulls = Nulls.SKIP) + public _FinalStage expMonth(Optional expMonth) { + this.expMonth = expMonth; + return this; + } + + /** + *

The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage brand(Nullable brand) { + if (brand.isNull()) { + this.brand = null; + } else if (brand.isEmpty()) { + this.brand = Optional.empty(); + } else { + this.brand = Optional.of(brand.get()); + } + return this; + } + + /** + *

The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage brand(CardBrands brand) { + this.brand = Optional.ofNullable(brand); + return this; + } + + /** + *

The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined.

+ */ + @java.lang.Override + @JsonSetter(value = "brand", nulls = Nulls.SKIP) + public _FinalStage brand(Optional brand) { + this.brand = brand; + return this; + } + + @java.lang.Override + public PaymentMethodListItemCardPaymentMethodCard build() { + return new PaymentMethodListItemCardPaymentMethodCard( + brand, + expMonth, + expYear, + expired, + fingerprint, + fundingType, + last4, + threeDsVerified, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIcons.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIcons.java new file mode 100644 index 00000000..115a52cd --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIcons.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCardPaymentMethodIcons.Builder.class) +public final class PaymentMethodListItemCardPaymentMethodIcons { + private final PaymentMethodListItemCardPaymentMethodIconsCard card; + + private final PaymentMethodListItemCardPaymentMethodIconsSquare square; + + private final Map additionalProperties; + + private PaymentMethodListItemCardPaymentMethodIcons( + PaymentMethodListItemCardPaymentMethodIconsCard card, + PaymentMethodListItemCardPaymentMethodIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentMethodListItemCardPaymentMethodIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentMethodListItemCardPaymentMethodIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCardPaymentMethodIcons + && equalTo((PaymentMethodListItemCardPaymentMethodIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCardPaymentMethodIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentMethodListItemCardPaymentMethodIconsCard card); + + Builder from(PaymentMethodListItemCardPaymentMethodIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentMethodListItemCardPaymentMethodIconsSquare square); + } + + public interface _FinalStage { + PaymentMethodListItemCardPaymentMethodIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentMethodListItemCardPaymentMethodIconsCard card; + + private PaymentMethodListItemCardPaymentMethodIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCardPaymentMethodIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentMethodListItemCardPaymentMethodIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentMethodListItemCardPaymentMethodIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCardPaymentMethodIcons build() { + return new PaymentMethodListItemCardPaymentMethodIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsCard.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsCard.java new file mode 100644 index 00000000..5825e195 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsCard.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCardPaymentMethodIconsCard.Builder.class) +public final class PaymentMethodListItemCardPaymentMethodIconsCard { + private final PaymentMethodListItemCardPaymentMethodIconsCardDark dark; + + private final PaymentMethodListItemCardPaymentMethodIconsCardLight light; + + private final Map additionalProperties; + + private PaymentMethodListItemCardPaymentMethodIconsCard( + PaymentMethodListItemCardPaymentMethodIconsCardDark dark, + PaymentMethodListItemCardPaymentMethodIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodListItemCardPaymentMethodIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodListItemCardPaymentMethodIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCardPaymentMethodIconsCard + && equalTo((PaymentMethodListItemCardPaymentMethodIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCardPaymentMethodIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodListItemCardPaymentMethodIconsCardDark dark); + + Builder from(PaymentMethodListItemCardPaymentMethodIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodListItemCardPaymentMethodIconsCardLight light); + } + + public interface _FinalStage { + PaymentMethodListItemCardPaymentMethodIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodListItemCardPaymentMethodIconsCardDark dark; + + private PaymentMethodListItemCardPaymentMethodIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCardPaymentMethodIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodListItemCardPaymentMethodIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodListItemCardPaymentMethodIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCardPaymentMethodIconsCard build() { + return new PaymentMethodListItemCardPaymentMethodIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsCardDark.java new file mode 100644 index 00000000..035f349b --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsCardDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCardPaymentMethodIconsCardDark.Builder.class) +public final class PaymentMethodListItemCardPaymentMethodIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemCardPaymentMethodIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCardPaymentMethodIconsCardDark + && equalTo((PaymentMethodListItemCardPaymentMethodIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCardPaymentMethodIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemCardPaymentMethodIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemCardPaymentMethodIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCardPaymentMethodIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCardPaymentMethodIconsCardDark build() { + return new PaymentMethodListItemCardPaymentMethodIconsCardDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsCardLight.java new file mode 100644 index 00000000..8f159c8e --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsCardLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCardPaymentMethodIconsCardLight.Builder.class) +public final class PaymentMethodListItemCardPaymentMethodIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemCardPaymentMethodIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCardPaymentMethodIconsCardLight + && equalTo((PaymentMethodListItemCardPaymentMethodIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCardPaymentMethodIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemCardPaymentMethodIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemCardPaymentMethodIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCardPaymentMethodIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCardPaymentMethodIconsCardLight build() { + return new PaymentMethodListItemCardPaymentMethodIconsCardLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsSquare.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsSquare.java new file mode 100644 index 00000000..cd3dc7dc --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCardPaymentMethodIconsSquare.Builder.class) +public final class PaymentMethodListItemCardPaymentMethodIconsSquare { + private final PaymentMethodListItemCardPaymentMethodIconsSquareDark dark; + + private final PaymentMethodListItemCardPaymentMethodIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentMethodListItemCardPaymentMethodIconsSquare( + PaymentMethodListItemCardPaymentMethodIconsSquareDark dark, + PaymentMethodListItemCardPaymentMethodIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodListItemCardPaymentMethodIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodListItemCardPaymentMethodIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCardPaymentMethodIconsSquare + && equalTo((PaymentMethodListItemCardPaymentMethodIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCardPaymentMethodIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodListItemCardPaymentMethodIconsSquareDark dark); + + Builder from(PaymentMethodListItemCardPaymentMethodIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodListItemCardPaymentMethodIconsSquareLight light); + } + + public interface _FinalStage { + PaymentMethodListItemCardPaymentMethodIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodListItemCardPaymentMethodIconsSquareDark dark; + + private PaymentMethodListItemCardPaymentMethodIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCardPaymentMethodIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodListItemCardPaymentMethodIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodListItemCardPaymentMethodIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCardPaymentMethodIconsSquare build() { + return new PaymentMethodListItemCardPaymentMethodIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsSquareDark.java new file mode 100644 index 00000000..a17f1c9b --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsSquareDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCardPaymentMethodIconsSquareDark.Builder.class) +public final class PaymentMethodListItemCardPaymentMethodIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemCardPaymentMethodIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCardPaymentMethodIconsSquareDark + && equalTo((PaymentMethodListItemCardPaymentMethodIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCardPaymentMethodIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemCardPaymentMethodIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemCardPaymentMethodIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCardPaymentMethodIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCardPaymentMethodIconsSquareDark build() { + return new PaymentMethodListItemCardPaymentMethodIconsSquareDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsSquareLight.java new file mode 100644 index 00000000..06b5055c --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCardPaymentMethodIconsSquareLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCardPaymentMethodIconsSquareLight.Builder.class) +public final class PaymentMethodListItemCardPaymentMethodIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemCardPaymentMethodIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCardPaymentMethodIconsSquareLight + && equalTo((PaymentMethodListItemCardPaymentMethodIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCardPaymentMethodIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemCardPaymentMethodIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemCardPaymentMethodIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCardPaymentMethodIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCardPaymentMethodIconsSquareLight build() { + return new PaymentMethodListItemCardPaymentMethodIconsSquareLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethod.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethod.java new file mode 100644 index 00000000..64a372ab --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethod.java @@ -0,0 +1,275 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCashappPaymentMethod.Builder.class) +public final class PaymentMethodListItemCashappPaymentMethod { + private final PaymentMethodListItemCashappPaymentMethodCashapp cashapp; + + private final OffsetDateTime createdAt; + + private final PaymentMethodListItemCashappPaymentMethodIcons icons; + + private final String id; + + private final PaymentMethodTypes paymentMethodType; + + private final Map additionalProperties; + + private PaymentMethodListItemCashappPaymentMethod( + PaymentMethodListItemCashappPaymentMethodCashapp cashapp, + OffsetDateTime createdAt, + PaymentMethodListItemCashappPaymentMethodIcons icons, + String id, + PaymentMethodTypes paymentMethodType, + Map additionalProperties) { + this.cashapp = cashapp; + this.createdAt = createdAt; + this.icons = icons; + this.id = id; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Cash App-specific details for this payment method, including cashtag and buyer ID. + */ + @JsonProperty("cashapp") + public PaymentMethodListItemCashappPaymentMethodCashapp getCashapp() { + return cashapp; + } + + /** + * @return The time of the event in ISO 8601 UTC format with millisecond precision + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art. + */ + @JsonProperty("icons") + public PaymentMethodListItemCashappPaymentMethodIcons getIcons() { + return icons; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit). + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCashappPaymentMethod + && equalTo((PaymentMethodListItemCashappPaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCashappPaymentMethod other) { + return cashapp.equals(other.cashapp) + && createdAt.equals(other.createdAt) + && icons.equals(other.icons) + && id.equals(other.id) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cashapp, this.createdAt, this.icons, this.id, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CashappStage builder() { + return new Builder(); + } + + public interface CashappStage { + /** + *

The Cash App-specific details for this payment method, including cashtag and buyer ID.

+ */ + CreatedAtStage cashapp(@NotNull PaymentMethodListItemCashappPaymentMethodCashapp cashapp); + + Builder from(PaymentMethodListItemCashappPaymentMethod other); + } + + public interface CreatedAtStage { + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ */ + IconsStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IconsStage { + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ */ + IdStage icons(@NotNull PaymentMethodListItemCashappPaymentMethodIcons icons); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ */ + _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface _FinalStage { + PaymentMethodListItemCashappPaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CashappStage, CreatedAtStage, IconsStage, IdStage, PaymentMethodTypeStage, _FinalStage { + private PaymentMethodListItemCashappPaymentMethodCashapp cashapp; + + private OffsetDateTime createdAt; + + private PaymentMethodListItemCashappPaymentMethodIcons icons; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCashappPaymentMethod other) { + cashapp(other.getCashapp()); + createdAt(other.getCreatedAt()); + icons(other.getIcons()); + id(other.getId()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

The Cash App-specific details for this payment method, including cashtag and buyer ID.

+ *

The Cash App-specific details for this payment method, including cashtag and buyer ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cashapp") + public CreatedAtStage cashapp(@NotNull PaymentMethodListItemCashappPaymentMethodCashapp cashapp) { + this.cashapp = Objects.requireNonNull(cashapp, "cashapp must not be null"); + return this; + } + + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ *

The time of the event in ISO 8601 UTC format with millisecond precision

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IconsStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public IdStage icons(@NotNull PaymentMethodListItemCashappPaymentMethodIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCashappPaymentMethod build() { + return new PaymentMethodListItemCashappPaymentMethod( + cashapp, createdAt, icons, id, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodCashapp.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodCashapp.java new file mode 100644 index 00000000..35d888c3 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodCashapp.java @@ -0,0 +1,184 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCashappPaymentMethodCashapp.Builder.class) +public final class PaymentMethodListItemCashappPaymentMethodCashapp { + private final Optional buyerId; + + private final Optional cashtag; + + private final Map additionalProperties; + + private PaymentMethodListItemCashappPaymentMethodCashapp( + Optional buyerId, Optional cashtag, Map additionalProperties) { + this.buyerId = buyerId; + this.cashtag = cashtag; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique and immutable identifier assigned by Cash App to the buyer. Null if not available. + */ + @JsonIgnore + public Optional getBuyerId() { + if (buyerId == null) { + return Optional.empty(); + } + return buyerId; + } + + /** + * @return The public cashtag handle of the buyer on Cash App. Null if not available. + */ + @JsonIgnore + public Optional getCashtag() { + if (cashtag == null) { + return Optional.empty(); + } + return cashtag; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("buyer_id") + private Optional _getBuyerId() { + return buyerId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cashtag") + private Optional _getCashtag() { + return cashtag; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCashappPaymentMethodCashapp + && equalTo((PaymentMethodListItemCashappPaymentMethodCashapp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCashappPaymentMethodCashapp other) { + return buyerId.equals(other.buyerId) && cashtag.equals(other.cashtag); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.buyerId, this.cashtag); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional buyerId = Optional.empty(); + + private Optional cashtag = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentMethodListItemCashappPaymentMethodCashapp other) { + buyerId(other.getBuyerId()); + cashtag(other.getCashtag()); + return this; + } + + /** + *

The unique and immutable identifier assigned by Cash App to the buyer. Null if not available.

+ */ + @JsonSetter(value = "buyer_id", nulls = Nulls.SKIP) + public Builder buyerId(Optional buyerId) { + this.buyerId = buyerId; + return this; + } + + public Builder buyerId(String buyerId) { + this.buyerId = Optional.ofNullable(buyerId); + return this; + } + + public Builder buyerId(Nullable buyerId) { + if (buyerId.isNull()) { + this.buyerId = null; + } else if (buyerId.isEmpty()) { + this.buyerId = Optional.empty(); + } else { + this.buyerId = Optional.of(buyerId.get()); + } + return this; + } + + /** + *

The public cashtag handle of the buyer on Cash App. Null if not available.

+ */ + @JsonSetter(value = "cashtag", nulls = Nulls.SKIP) + public Builder cashtag(Optional cashtag) { + this.cashtag = cashtag; + return this; + } + + public Builder cashtag(String cashtag) { + this.cashtag = Optional.ofNullable(cashtag); + return this; + } + + public Builder cashtag(Nullable cashtag) { + if (cashtag.isNull()) { + this.cashtag = null; + } else if (cashtag.isEmpty()) { + this.cashtag = Optional.empty(); + } else { + this.cashtag = Optional.of(cashtag.get()); + } + return this; + } + + public PaymentMethodListItemCashappPaymentMethodCashapp build() { + return new PaymentMethodListItemCashappPaymentMethodCashapp(buyerId, cashtag, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIcons.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIcons.java new file mode 100644 index 00000000..8ef18984 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIcons.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCashappPaymentMethodIcons.Builder.class) +public final class PaymentMethodListItemCashappPaymentMethodIcons { + private final PaymentMethodListItemCashappPaymentMethodIconsCard card; + + private final PaymentMethodListItemCashappPaymentMethodIconsSquare square; + + private final Map additionalProperties; + + private PaymentMethodListItemCashappPaymentMethodIcons( + PaymentMethodListItemCashappPaymentMethodIconsCard card, + PaymentMethodListItemCashappPaymentMethodIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentMethodListItemCashappPaymentMethodIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentMethodListItemCashappPaymentMethodIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCashappPaymentMethodIcons + && equalTo((PaymentMethodListItemCashappPaymentMethodIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCashappPaymentMethodIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentMethodListItemCashappPaymentMethodIconsCard card); + + Builder from(PaymentMethodListItemCashappPaymentMethodIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentMethodListItemCashappPaymentMethodIconsSquare square); + } + + public interface _FinalStage { + PaymentMethodListItemCashappPaymentMethodIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentMethodListItemCashappPaymentMethodIconsCard card; + + private PaymentMethodListItemCashappPaymentMethodIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCashappPaymentMethodIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentMethodListItemCashappPaymentMethodIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentMethodListItemCashappPaymentMethodIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCashappPaymentMethodIcons build() { + return new PaymentMethodListItemCashappPaymentMethodIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsCard.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsCard.java new file mode 100644 index 00000000..2b992117 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsCard.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCashappPaymentMethodIconsCard.Builder.class) +public final class PaymentMethodListItemCashappPaymentMethodIconsCard { + private final PaymentMethodListItemCashappPaymentMethodIconsCardDark dark; + + private final PaymentMethodListItemCashappPaymentMethodIconsCardLight light; + + private final Map additionalProperties; + + private PaymentMethodListItemCashappPaymentMethodIconsCard( + PaymentMethodListItemCashappPaymentMethodIconsCardDark dark, + PaymentMethodListItemCashappPaymentMethodIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodListItemCashappPaymentMethodIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodListItemCashappPaymentMethodIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCashappPaymentMethodIconsCard + && equalTo((PaymentMethodListItemCashappPaymentMethodIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCashappPaymentMethodIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodListItemCashappPaymentMethodIconsCardDark dark); + + Builder from(PaymentMethodListItemCashappPaymentMethodIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodListItemCashappPaymentMethodIconsCardLight light); + } + + public interface _FinalStage { + PaymentMethodListItemCashappPaymentMethodIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodListItemCashappPaymentMethodIconsCardDark dark; + + private PaymentMethodListItemCashappPaymentMethodIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCashappPaymentMethodIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodListItemCashappPaymentMethodIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodListItemCashappPaymentMethodIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCashappPaymentMethodIconsCard build() { + return new PaymentMethodListItemCashappPaymentMethodIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsCardDark.java new file mode 100644 index 00000000..dc93c0f9 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsCardDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCashappPaymentMethodIconsCardDark.Builder.class) +public final class PaymentMethodListItemCashappPaymentMethodIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemCashappPaymentMethodIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCashappPaymentMethodIconsCardDark + && equalTo((PaymentMethodListItemCashappPaymentMethodIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCashappPaymentMethodIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemCashappPaymentMethodIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemCashappPaymentMethodIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCashappPaymentMethodIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCashappPaymentMethodIconsCardDark build() { + return new PaymentMethodListItemCashappPaymentMethodIconsCardDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsCardLight.java new file mode 100644 index 00000000..54c67430 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsCardLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCashappPaymentMethodIconsCardLight.Builder.class) +public final class PaymentMethodListItemCashappPaymentMethodIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemCashappPaymentMethodIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCashappPaymentMethodIconsCardLight + && equalTo((PaymentMethodListItemCashappPaymentMethodIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCashappPaymentMethodIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemCashappPaymentMethodIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemCashappPaymentMethodIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCashappPaymentMethodIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCashappPaymentMethodIconsCardLight build() { + return new PaymentMethodListItemCashappPaymentMethodIconsCardLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsSquare.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsSquare.java new file mode 100644 index 00000000..34f6a389 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCashappPaymentMethodIconsSquare.Builder.class) +public final class PaymentMethodListItemCashappPaymentMethodIconsSquare { + private final PaymentMethodListItemCashappPaymentMethodIconsSquareDark dark; + + private final PaymentMethodListItemCashappPaymentMethodIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentMethodListItemCashappPaymentMethodIconsSquare( + PaymentMethodListItemCashappPaymentMethodIconsSquareDark dark, + PaymentMethodListItemCashappPaymentMethodIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodListItemCashappPaymentMethodIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodListItemCashappPaymentMethodIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCashappPaymentMethodIconsSquare + && equalTo((PaymentMethodListItemCashappPaymentMethodIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCashappPaymentMethodIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodListItemCashappPaymentMethodIconsSquareDark dark); + + Builder from(PaymentMethodListItemCashappPaymentMethodIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodListItemCashappPaymentMethodIconsSquareLight light); + } + + public interface _FinalStage { + PaymentMethodListItemCashappPaymentMethodIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodListItemCashappPaymentMethodIconsSquareDark dark; + + private PaymentMethodListItemCashappPaymentMethodIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCashappPaymentMethodIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodListItemCashappPaymentMethodIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodListItemCashappPaymentMethodIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCashappPaymentMethodIconsSquare build() { + return new PaymentMethodListItemCashappPaymentMethodIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsSquareDark.java new file mode 100644 index 00000000..6436d2fa --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsSquareDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCashappPaymentMethodIconsSquareDark.Builder.class) +public final class PaymentMethodListItemCashappPaymentMethodIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemCashappPaymentMethodIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCashappPaymentMethodIconsSquareDark + && equalTo((PaymentMethodListItemCashappPaymentMethodIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCashappPaymentMethodIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemCashappPaymentMethodIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemCashappPaymentMethodIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCashappPaymentMethodIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCashappPaymentMethodIconsSquareDark build() { + return new PaymentMethodListItemCashappPaymentMethodIconsSquareDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsSquareLight.java new file mode 100644 index 00000000..ac37cbfe --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemCashappPaymentMethodIconsSquareLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemCashappPaymentMethodIconsSquareLight.Builder.class) +public final class PaymentMethodListItemCashappPaymentMethodIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemCashappPaymentMethodIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemCashappPaymentMethodIconsSquareLight + && equalTo((PaymentMethodListItemCashappPaymentMethodIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemCashappPaymentMethodIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemCashappPaymentMethodIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemCashappPaymentMethodIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemCashappPaymentMethodIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemCashappPaymentMethodIconsSquareLight build() { + return new PaymentMethodListItemCashappPaymentMethodIconsSquareLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethod.java b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethod.java new file mode 100644 index 00000000..4d1cd40e --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethod.java @@ -0,0 +1,275 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemIdealPaymentMethod.Builder.class) +public final class PaymentMethodListItemIdealPaymentMethod { + private final OffsetDateTime createdAt; + + private final PaymentMethodListItemIdealPaymentMethodIcons icons; + + private final String id; + + private final PaymentMethodListItemIdealPaymentMethodIdeal ideal; + + private final PaymentMethodTypes paymentMethodType; + + private final Map additionalProperties; + + private PaymentMethodListItemIdealPaymentMethod( + OffsetDateTime createdAt, + PaymentMethodListItemIdealPaymentMethodIcons icons, + String id, + PaymentMethodListItemIdealPaymentMethodIdeal ideal, + PaymentMethodTypes paymentMethodType, + Map additionalProperties) { + this.createdAt = createdAt; + this.icons = icons; + this.id = id; + this.ideal = ideal; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The time of the event in ISO 8601 UTC format with millisecond precision + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art. + */ + @JsonProperty("icons") + public PaymentMethodListItemIdealPaymentMethodIcons getIcons() { + return icons; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The iDEAL-specific details for this payment method, including bank name and BIC. + */ + @JsonProperty("ideal") + public PaymentMethodListItemIdealPaymentMethodIdeal getIdeal() { + return ideal; + } + + /** + * @return The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit). + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemIdealPaymentMethod + && equalTo((PaymentMethodListItemIdealPaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemIdealPaymentMethod other) { + return createdAt.equals(other.createdAt) + && icons.equals(other.icons) + && id.equals(other.id) + && ideal.equals(other.ideal) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.icons, this.id, this.ideal, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ */ + IconsStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PaymentMethodListItemIdealPaymentMethod other); + } + + public interface IconsStage { + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ */ + IdStage icons(@NotNull PaymentMethodListItemIdealPaymentMethodIcons icons); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + IdealStage id(@NotNull String id); + } + + public interface IdealStage { + /** + *

The iDEAL-specific details for this payment method, including bank name and BIC.

+ */ + PaymentMethodTypeStage ideal(@NotNull PaymentMethodListItemIdealPaymentMethodIdeal ideal); + } + + public interface PaymentMethodTypeStage { + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ */ + _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface _FinalStage { + PaymentMethodListItemIdealPaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IconsStage, IdStage, IdealStage, PaymentMethodTypeStage, _FinalStage { + private OffsetDateTime createdAt; + + private PaymentMethodListItemIdealPaymentMethodIcons icons; + + private String id; + + private PaymentMethodListItemIdealPaymentMethodIdeal ideal; + + private PaymentMethodTypes paymentMethodType; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemIdealPaymentMethod other) { + createdAt(other.getCreatedAt()); + icons(other.getIcons()); + id(other.getId()); + ideal(other.getIdeal()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ *

The time of the event in ISO 8601 UTC format with millisecond precision

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IconsStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public IdStage icons(@NotNull PaymentMethodListItemIdealPaymentMethodIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IdealStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The iDEAL-specific details for this payment method, including bank name and BIC.

+ *

The iDEAL-specific details for this payment method, including bank name and BIC.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ideal") + public PaymentMethodTypeStage ideal(@NotNull PaymentMethodListItemIdealPaymentMethodIdeal ideal) { + this.ideal = Objects.requireNonNull(ideal, "ideal must not be null"); + return this; + } + + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemIdealPaymentMethod build() { + return new PaymentMethodListItemIdealPaymentMethod( + createdAt, icons, id, ideal, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIcons.java b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIcons.java new file mode 100644 index 00000000..820d65f2 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIcons.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemIdealPaymentMethodIcons.Builder.class) +public final class PaymentMethodListItemIdealPaymentMethodIcons { + private final PaymentMethodListItemIdealPaymentMethodIconsCard card; + + private final PaymentMethodListItemIdealPaymentMethodIconsSquare square; + + private final Map additionalProperties; + + private PaymentMethodListItemIdealPaymentMethodIcons( + PaymentMethodListItemIdealPaymentMethodIconsCard card, + PaymentMethodListItemIdealPaymentMethodIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentMethodListItemIdealPaymentMethodIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentMethodListItemIdealPaymentMethodIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemIdealPaymentMethodIcons + && equalTo((PaymentMethodListItemIdealPaymentMethodIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemIdealPaymentMethodIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentMethodListItemIdealPaymentMethodIconsCard card); + + Builder from(PaymentMethodListItemIdealPaymentMethodIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentMethodListItemIdealPaymentMethodIconsSquare square); + } + + public interface _FinalStage { + PaymentMethodListItemIdealPaymentMethodIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentMethodListItemIdealPaymentMethodIconsCard card; + + private PaymentMethodListItemIdealPaymentMethodIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemIdealPaymentMethodIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentMethodListItemIdealPaymentMethodIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentMethodListItemIdealPaymentMethodIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemIdealPaymentMethodIcons build() { + return new PaymentMethodListItemIdealPaymentMethodIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsCard.java b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsCard.java new file mode 100644 index 00000000..69479a26 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsCard.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemIdealPaymentMethodIconsCard.Builder.class) +public final class PaymentMethodListItemIdealPaymentMethodIconsCard { + private final PaymentMethodListItemIdealPaymentMethodIconsCardDark dark; + + private final PaymentMethodListItemIdealPaymentMethodIconsCardLight light; + + private final Map additionalProperties; + + private PaymentMethodListItemIdealPaymentMethodIconsCard( + PaymentMethodListItemIdealPaymentMethodIconsCardDark dark, + PaymentMethodListItemIdealPaymentMethodIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodListItemIdealPaymentMethodIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodListItemIdealPaymentMethodIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemIdealPaymentMethodIconsCard + && equalTo((PaymentMethodListItemIdealPaymentMethodIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemIdealPaymentMethodIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodListItemIdealPaymentMethodIconsCardDark dark); + + Builder from(PaymentMethodListItemIdealPaymentMethodIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodListItemIdealPaymentMethodIconsCardLight light); + } + + public interface _FinalStage { + PaymentMethodListItemIdealPaymentMethodIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodListItemIdealPaymentMethodIconsCardDark dark; + + private PaymentMethodListItemIdealPaymentMethodIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemIdealPaymentMethodIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodListItemIdealPaymentMethodIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodListItemIdealPaymentMethodIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemIdealPaymentMethodIconsCard build() { + return new PaymentMethodListItemIdealPaymentMethodIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsCardDark.java new file mode 100644 index 00000000..70acc983 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsCardDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemIdealPaymentMethodIconsCardDark.Builder.class) +public final class PaymentMethodListItemIdealPaymentMethodIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemIdealPaymentMethodIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemIdealPaymentMethodIconsCardDark + && equalTo((PaymentMethodListItemIdealPaymentMethodIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemIdealPaymentMethodIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemIdealPaymentMethodIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemIdealPaymentMethodIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemIdealPaymentMethodIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemIdealPaymentMethodIconsCardDark build() { + return new PaymentMethodListItemIdealPaymentMethodIconsCardDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsCardLight.java new file mode 100644 index 00000000..f21059f4 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsCardLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemIdealPaymentMethodIconsCardLight.Builder.class) +public final class PaymentMethodListItemIdealPaymentMethodIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemIdealPaymentMethodIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemIdealPaymentMethodIconsCardLight + && equalTo((PaymentMethodListItemIdealPaymentMethodIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemIdealPaymentMethodIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemIdealPaymentMethodIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemIdealPaymentMethodIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemIdealPaymentMethodIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemIdealPaymentMethodIconsCardLight build() { + return new PaymentMethodListItemIdealPaymentMethodIconsCardLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsSquare.java b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsSquare.java new file mode 100644 index 00000000..d11ec7a9 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemIdealPaymentMethodIconsSquare.Builder.class) +public final class PaymentMethodListItemIdealPaymentMethodIconsSquare { + private final PaymentMethodListItemIdealPaymentMethodIconsSquareDark dark; + + private final PaymentMethodListItemIdealPaymentMethodIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentMethodListItemIdealPaymentMethodIconsSquare( + PaymentMethodListItemIdealPaymentMethodIconsSquareDark dark, + PaymentMethodListItemIdealPaymentMethodIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodListItemIdealPaymentMethodIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodListItemIdealPaymentMethodIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemIdealPaymentMethodIconsSquare + && equalTo((PaymentMethodListItemIdealPaymentMethodIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemIdealPaymentMethodIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodListItemIdealPaymentMethodIconsSquareDark dark); + + Builder from(PaymentMethodListItemIdealPaymentMethodIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodListItemIdealPaymentMethodIconsSquareLight light); + } + + public interface _FinalStage { + PaymentMethodListItemIdealPaymentMethodIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodListItemIdealPaymentMethodIconsSquareDark dark; + + private PaymentMethodListItemIdealPaymentMethodIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemIdealPaymentMethodIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodListItemIdealPaymentMethodIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodListItemIdealPaymentMethodIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemIdealPaymentMethodIconsSquare build() { + return new PaymentMethodListItemIdealPaymentMethodIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsSquareDark.java new file mode 100644 index 00000000..03825652 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsSquareDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemIdealPaymentMethodIconsSquareDark.Builder.class) +public final class PaymentMethodListItemIdealPaymentMethodIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemIdealPaymentMethodIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemIdealPaymentMethodIconsSquareDark + && equalTo((PaymentMethodListItemIdealPaymentMethodIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemIdealPaymentMethodIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemIdealPaymentMethodIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemIdealPaymentMethodIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemIdealPaymentMethodIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemIdealPaymentMethodIconsSquareDark build() { + return new PaymentMethodListItemIdealPaymentMethodIconsSquareDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsSquareLight.java new file mode 100644 index 00000000..4af85105 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIconsSquareLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemIdealPaymentMethodIconsSquareLight.Builder.class) +public final class PaymentMethodListItemIdealPaymentMethodIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemIdealPaymentMethodIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemIdealPaymentMethodIconsSquareLight + && equalTo((PaymentMethodListItemIdealPaymentMethodIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemIdealPaymentMethodIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemIdealPaymentMethodIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemIdealPaymentMethodIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemIdealPaymentMethodIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemIdealPaymentMethodIconsSquareLight build() { + return new PaymentMethodListItemIdealPaymentMethodIconsSquareLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIdeal.java b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIdeal.java new file mode 100644 index 00000000..002f9944 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemIdealPaymentMethodIdeal.java @@ -0,0 +1,184 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemIdealPaymentMethodIdeal.Builder.class) +public final class PaymentMethodListItemIdealPaymentMethodIdeal { + private final Optional bank; + + private final Optional bic; + + private final Map additionalProperties; + + private PaymentMethodListItemIdealPaymentMethodIdeal( + Optional bank, Optional bic, Map additionalProperties) { + this.bank = bank; + this.bic = bic; + this.additionalProperties = additionalProperties; + } + + /** + * @return The name of the customer's bank used for the iDEAL transaction. Null if not available. + */ + @JsonIgnore + public Optional getBank() { + if (bank == null) { + return Optional.empty(); + } + return bank; + } + + /** + * @return The Bank Identifier Code (BIC/SWIFT) of the customer's bank. Null if not available. + */ + @JsonIgnore + public Optional getBic() { + if (bic == null) { + return Optional.empty(); + } + return bic; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bank") + private Optional _getBank() { + return bank; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bic") + private Optional _getBic() { + return bic; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemIdealPaymentMethodIdeal + && equalTo((PaymentMethodListItemIdealPaymentMethodIdeal) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemIdealPaymentMethodIdeal other) { + return bank.equals(other.bank) && bic.equals(other.bic); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.bank, this.bic); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional bank = Optional.empty(); + + private Optional bic = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentMethodListItemIdealPaymentMethodIdeal other) { + bank(other.getBank()); + bic(other.getBic()); + return this; + } + + /** + *

The name of the customer's bank used for the iDEAL transaction. Null if not available.

+ */ + @JsonSetter(value = "bank", nulls = Nulls.SKIP) + public Builder bank(Optional bank) { + this.bank = bank; + return this; + } + + public Builder bank(String bank) { + this.bank = Optional.ofNullable(bank); + return this; + } + + public Builder bank(Nullable bank) { + if (bank.isNull()) { + this.bank = null; + } else if (bank.isEmpty()) { + this.bank = Optional.empty(); + } else { + this.bank = Optional.of(bank.get()); + } + return this; + } + + /** + *

The Bank Identifier Code (BIC/SWIFT) of the customer's bank. Null if not available.

+ */ + @JsonSetter(value = "bic", nulls = Nulls.SKIP) + public Builder bic(Optional bic) { + this.bic = bic; + return this; + } + + public Builder bic(String bic) { + this.bic = Optional.ofNullable(bic); + return this; + } + + public Builder bic(Nullable bic) { + if (bic.isNull()) { + this.bic = null; + } else if (bic.isEmpty()) { + this.bic = Optional.empty(); + } else { + this.bic = Optional.of(bic.get()); + } + return this; + } + + public PaymentMethodListItemIdealPaymentMethodIdeal build() { + return new PaymentMethodListItemIdealPaymentMethodIdeal(bank, bic, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethod.java b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethod.java new file mode 100644 index 00000000..d6c620a7 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethod.java @@ -0,0 +1,277 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemPlatformBalancePaymentMethod.Builder.class) +public final class PaymentMethodListItemPlatformBalancePaymentMethod { + private final OffsetDateTime createdAt; + + private final PaymentMethodListItemPlatformBalancePaymentMethodIcons icons; + + private final String id; + + private final PaymentMethodTypes paymentMethodType; + + private final PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance platformBalance; + + private final Map additionalProperties; + + private PaymentMethodListItemPlatformBalancePaymentMethod( + OffsetDateTime createdAt, + PaymentMethodListItemPlatformBalancePaymentMethodIcons icons, + String id, + PaymentMethodTypes paymentMethodType, + PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance platformBalance, + Map additionalProperties) { + this.createdAt = createdAt; + this.icons = icons; + this.id = id; + this.paymentMethodType = paymentMethodType; + this.platformBalance = platformBalance; + this.additionalProperties = additionalProperties; + } + + /** + * @return The time of the event in ISO 8601 UTC format with millisecond precision + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art. + */ + @JsonProperty("icons") + public PaymentMethodListItemPlatformBalancePaymentMethodIcons getIcons() { + return icons; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit). + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + /** + * @return What is available to spend, and whether the account may spend it. + */ + @JsonProperty("platform_balance") + public PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance getPlatformBalance() { + return platformBalance; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemPlatformBalancePaymentMethod + && equalTo((PaymentMethodListItemPlatformBalancePaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemPlatformBalancePaymentMethod other) { + return createdAt.equals(other.createdAt) + && icons.equals(other.icons) + && id.equals(other.id) + && paymentMethodType.equals(other.paymentMethodType) + && platformBalance.equals(other.platformBalance); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.icons, this.id, this.paymentMethodType, this.platformBalance); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ */ + IconsStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PaymentMethodListItemPlatformBalancePaymentMethod other); + } + + public interface IconsStage { + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ */ + IdStage icons(@NotNull PaymentMethodListItemPlatformBalancePaymentMethodIcons icons); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ */ + PlatformBalanceStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface PlatformBalanceStage { + /** + *

What is available to spend, and whether the account may spend it.

+ */ + _FinalStage platformBalance( + @NotNull PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance platformBalance); + } + + public interface _FinalStage { + PaymentMethodListItemPlatformBalancePaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IconsStage, IdStage, PaymentMethodTypeStage, PlatformBalanceStage, _FinalStage { + private OffsetDateTime createdAt; + + private PaymentMethodListItemPlatformBalancePaymentMethodIcons icons; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + private PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance platformBalance; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemPlatformBalancePaymentMethod other) { + createdAt(other.getCreatedAt()); + icons(other.getIcons()); + id(other.getId()); + paymentMethodType(other.getPaymentMethodType()); + platformBalance(other.getPlatformBalance()); + return this; + } + + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ *

The time of the event in ISO 8601 UTC format with millisecond precision

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IconsStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public IdStage icons(@NotNull PaymentMethodListItemPlatformBalancePaymentMethodIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public PlatformBalanceStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + /** + *

What is available to spend, and whether the account may spend it.

+ *

What is available to spend, and whether the account may spend it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform_balance") + public _FinalStage platformBalance( + @NotNull PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance platformBalance) { + this.platformBalance = Objects.requireNonNull(platformBalance, "platformBalance must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemPlatformBalancePaymentMethod build() { + return new PaymentMethodListItemPlatformBalancePaymentMethod( + createdAt, icons, id, paymentMethodType, platformBalance, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIcons.java b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIcons.java new file mode 100644 index 00000000..5505e674 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIcons.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemPlatformBalancePaymentMethodIcons.Builder.class) +public final class PaymentMethodListItemPlatformBalancePaymentMethodIcons { + private final PaymentMethodListItemPlatformBalancePaymentMethodIconsCard card; + + private final PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare square; + + private final Map additionalProperties; + + private PaymentMethodListItemPlatformBalancePaymentMethodIcons( + PaymentMethodListItemPlatformBalancePaymentMethodIconsCard card, + PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentMethodListItemPlatformBalancePaymentMethodIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemPlatformBalancePaymentMethodIcons + && equalTo((PaymentMethodListItemPlatformBalancePaymentMethodIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemPlatformBalancePaymentMethodIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentMethodListItemPlatformBalancePaymentMethodIconsCard card); + + Builder from(PaymentMethodListItemPlatformBalancePaymentMethodIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare square); + } + + public interface _FinalStage { + PaymentMethodListItemPlatformBalancePaymentMethodIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentMethodListItemPlatformBalancePaymentMethodIconsCard card; + + private PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemPlatformBalancePaymentMethodIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentMethodListItemPlatformBalancePaymentMethodIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemPlatformBalancePaymentMethodIcons build() { + return new PaymentMethodListItemPlatformBalancePaymentMethodIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsCard.java b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsCard.java new file mode 100644 index 00000000..3fcd469a --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsCard.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemPlatformBalancePaymentMethodIconsCard.Builder.class) +public final class PaymentMethodListItemPlatformBalancePaymentMethodIconsCard { + private final PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark dark; + + private final PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight light; + + private final Map additionalProperties; + + private PaymentMethodListItemPlatformBalancePaymentMethodIconsCard( + PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark dark, + PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemPlatformBalancePaymentMethodIconsCard + && equalTo((PaymentMethodListItemPlatformBalancePaymentMethodIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemPlatformBalancePaymentMethodIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark dark); + + Builder from(PaymentMethodListItemPlatformBalancePaymentMethodIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight light); + } + + public interface _FinalStage { + PaymentMethodListItemPlatformBalancePaymentMethodIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark dark; + + private PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemPlatformBalancePaymentMethodIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemPlatformBalancePaymentMethodIconsCard build() { + return new PaymentMethodListItemPlatformBalancePaymentMethodIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark.java new file mode 100644 index 00000000..8531994c --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark.Builder.class) +public final class PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark + && equalTo((PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark build() { + return new PaymentMethodListItemPlatformBalancePaymentMethodIconsCardDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight.java new file mode 100644 index 00000000..c30cde00 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight.Builder.class) +public final class PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight + && equalTo((PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight build() { + return new PaymentMethodListItemPlatformBalancePaymentMethodIconsCardLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare.java b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare.java new file mode 100644 index 00000000..ec837ade --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare.Builder.class) +public final class PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare { + private final PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark dark; + + private final PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare( + PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark dark, + PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare + && equalTo((PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark dark); + + Builder from(PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight light); + } + + public interface _FinalStage { + PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark dark; + + private PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare build() { + return new PaymentMethodListItemPlatformBalancePaymentMethodIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark.java new file mode 100644 index 00000000..9ec371bc --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark.Builder.class) +public final class PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark + && equalTo((PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark build() { + return new PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight.java new file mode 100644 index 00000000..c701aeab --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight.Builder.class) +public final class PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight + && equalTo((PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight build() { + return new PaymentMethodListItemPlatformBalancePaymentMethodIconsSquareLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance.java b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance.java new file mode 100644 index 00000000..e0b14c44 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance.Builder.class) +public final class PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance { + private final Optional account; + + private final List balances; + + private final boolean spendable; + + private final Map additionalProperties; + + private PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance( + Optional account, + List balances, + boolean spendable, + Map additionalProperties) { + this.account = account; + this.balances = balances; + this.spendable = spendable; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account whose wallet this is. Null for the buyer's own personal wallet. A buyer sees an account's balance here when they hold permission to spend it, so a list can hold several — their own and one per account they are on. + */ + @JsonIgnore + public Optional getAccount() { + if (account == null) { + return Optional.empty(); + } + return account; + } + + /** + * @return Available amount per currency. Read from the balance cache, so it is indicative — the charge revalidates against settled funds and may still refuse. + */ + @JsonProperty("balances") + public List getBalances() { + return balances; + } + + /** + * @return Whether this balance can pay right now, which here means only whether it holds funds — an account blocked from spending is not listed at all. A zero balance is still returned so a client can show it as an option the buyer could top up. + */ + @JsonProperty("spendable") + public boolean getSpendable() { + return spendable; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account") + private Optional _getAccount() { + return account; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance + && equalTo((PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance other) { + return account.equals(other.account) && balances.equals(other.balances) && spendable == other.spendable; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.account, this.balances, this.spendable); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SpendableStage builder() { + return new Builder(); + } + + public interface SpendableStage { + /** + *

Whether this balance can pay right now, which here means only whether it holds funds — an account blocked from spending is not listed at all. A zero balance is still returned so a client can show it as an option the buyer could top up.

+ */ + _FinalStage spendable(boolean spendable); + + Builder from(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance other); + } + + public interface _FinalStage { + PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account whose wallet this is. Null for the buyer's own personal wallet. A buyer sees an account's balance here when they hold permission to spend it, so a list can hold several — their own and one per account they are on.

+ */ + _FinalStage account(Optional account); + + _FinalStage account(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount account); + + _FinalStage account(Nullable account); + + /** + *

Available amount per currency. Read from the balance cache, so it is indicative — the charge revalidates against settled funds and may still refuse.

+ */ + _FinalStage balances( + List balances); + + _FinalStage addBalances(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem balances); + + _FinalStage addAllBalances( + List balances); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SpendableStage, _FinalStage { + private boolean spendable; + + private List balances = + new ArrayList<>(); + + private Optional account = + Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance other) { + account(other.getAccount()); + balances(other.getBalances()); + spendable(other.getSpendable()); + return this; + } + + /** + *

Whether this balance can pay right now, which here means only whether it holds funds — an account blocked from spending is not listed at all. A zero balance is still returned so a client can show it as an option the buyer could top up.

+ *

Whether this balance can pay right now, which here means only whether it holds funds — an account blocked from spending is not listed at all. A zero balance is still returned so a client can show it as an option the buyer could top up.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("spendable") + public _FinalStage spendable(boolean spendable) { + this.spendable = spendable; + return this; + } + + /** + *

Available amount per currency. Read from the balance cache, so it is indicative — the charge revalidates against settled funds and may still refuse.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllBalances( + List balances) { + if (balances != null) { + this.balances.addAll(balances); + } + return this; + } + + /** + *

Available amount per currency. Read from the balance cache, so it is indicative — the charge revalidates against settled funds and may still refuse.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addBalances( + PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem balances) { + this.balances.add(balances); + return this; + } + + /** + *

Available amount per currency. Read from the balance cache, so it is indicative — the charge revalidates against settled funds and may still refuse.

+ */ + @java.lang.Override + @JsonSetter(value = "balances", nulls = Nulls.SKIP) + public _FinalStage balances( + List balances) { + this.balances.clear(); + if (balances != null) { + this.balances.addAll(balances); + } + return this; + } + + /** + *

The account whose wallet this is. Null for the buyer's own personal wallet. A buyer sees an account's balance here when they hold permission to spend it, so a list can hold several — their own and one per account they are on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account( + Nullable account) { + if (account.isNull()) { + this.account = null; + } else if (account.isEmpty()) { + this.account = Optional.empty(); + } else { + this.account = Optional.of(account.get()); + } + return this; + } + + /** + *

The account whose wallet this is. Null for the buyer's own personal wallet. A buyer sees an account's balance here when they hold permission to spend it, so a list can hold several — their own and one per account they are on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount account) { + this.account = Optional.ofNullable(account); + return this; + } + + /** + *

The account whose wallet this is. Null for the buyer's own personal wallet. A buyer sees an account's balance here when they hold permission to spend it, so a list can hold several — their own and one per account they are on.

+ */ + @java.lang.Override + @JsonSetter(value = "account", nulls = Nulls.SKIP) + public _FinalStage account( + Optional account) { + this.account = account; + return this; + } + + @java.lang.Override + public PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance build() { + return new PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalance( + account, balances, spendable, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount.java b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount.java new file mode 100644 index 00000000..cd754938 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount.java @@ -0,0 +1,244 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount.Builder.class) +public final class PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount { + private final String id; + + private final Optional logo; + + private final String title; + + private final Map additionalProperties; + + private PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount( + String id, + Optional logo, + String title, + Map additionalProperties) { + this.id = id; + this.logo = logo; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The company's logo. + */ + @JsonIgnore + public Optional getLogo() { + if (logo == null) { + return Optional.empty(); + } + return logo; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo") + private Optional _getLogo() { + return logo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount + && equalTo((PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount other) { + return id.equals(other.id) && logo.equals(other.logo) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.logo, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + TitleStage id(@NotNull String id); + + Builder from(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount other); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The company's logo.

+ */ + _FinalStage logo(Optional logo); + + _FinalStage logo(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccountLogo logo); + + _FinalStage logo(Nullable logo); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + private Optional logo = + Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount other) { + id(other.getId()); + logo(other.getLogo()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

The company's logo.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logo( + Nullable logo) { + if (logo.isNull()) { + this.logo = null; + } else if (logo.isEmpty()) { + this.logo = Optional.empty(); + } else { + this.logo = Optional.of(logo.get()); + } + return this; + } + + /** + *

The company's logo.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logo(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccountLogo logo) { + this.logo = Optional.ofNullable(logo); + return this; + } + + /** + *

The company's logo.

+ */ + @java.lang.Override + @JsonSetter(value = "logo", nulls = Nulls.SKIP) + public _FinalStage logo( + Optional logo) { + this.logo = logo; + return this; + } + + @java.lang.Override + public PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount build() { + return new PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccount( + id, logo, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccountLogo.java b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccountLogo.java new file mode 100644 index 00000000..198c58cc --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccountLogo.java @@ -0,0 +1,137 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccountLogo.Builder.class) +public final class PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccountLogo { + private final Optional url; + + private final Map additionalProperties; + + private PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccountLogo( + Optional url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccountLogo + && equalTo((PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccountLogo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccountLogo other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccountLogo other) { + url(other.getUrl()); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public Builder url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + public PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccountLogo build() { + return new PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceAccountLogo( + url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem.java b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem.java new file mode 100644 index 00000000..3a6f60bd --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem.java @@ -0,0 +1,239 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem.Builder.class) +public final class PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem { + private final String amount; + + private final Currencies currency; + + private final int decimals; + + private final int displayDecimals; + + private final Map additionalProperties; + + private PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem( + String amount, + Currencies currency, + int decimals, + int displayDecimals, + Map additionalProperties) { + this.amount = amount; + this.currency = currency; + this.decimals = decimals; + this.displayDecimals = displayDecimals; + this.additionalProperties = additionalProperties; + } + + /** + * @return The amount in major units, as an exact decimal string — "10.00" is ten dollars. A string so no float rounds it in transit. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + /** + * @return Three-letter ISO 4217 currency code, lowercase. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return How many decimal places the amount CARRIES — the precision the charge itself runs at. + */ + @JsonProperty("decimals") + public int getDecimals() { + return decimals; + } + + /** + * @return How many decimal places to SHOW. Usually equal to decimals, and deliberately not always: COP is charged in centavos but written in whole pesos, so it is 2 and 0. Format the number in your own locale using this. + */ + @JsonProperty("display_decimals") + public int getDisplayDecimals() { + return displayDecimals; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem + && equalTo((PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem other) { + return amount.equals(other.amount) + && currency.equals(other.currency) + && decimals == other.decimals + && displayDecimals == other.displayDecimals; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.currency, this.decimals, this.displayDecimals); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The amount in major units, as an exact decimal string — "10.00" is ten dollars. A string so no float rounds it in transit.

+ */ + CurrencyStage amount(@NotNull String amount); + + Builder from(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem other); + } + + public interface CurrencyStage { + /** + *

Three-letter ISO 4217 currency code, lowercase.

+ */ + DecimalsStage currency(@NotNull Currencies currency); + } + + public interface DecimalsStage { + /** + *

How many decimal places the amount CARRIES — the precision the charge itself runs at.

+ */ + DisplayDecimalsStage decimals(int decimals); + } + + public interface DisplayDecimalsStage { + /** + *

How many decimal places to SHOW. Usually equal to decimals, and deliberately not always: COP is charged in centavos but written in whole pesos, so it is 2 and 0. Format the number in your own locale using this.

+ */ + _FinalStage displayDecimals(int displayDecimals); + } + + public interface _FinalStage { + PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, CurrencyStage, DecimalsStage, DisplayDecimalsStage, _FinalStage { + private String amount; + + private Currencies currency; + + private int decimals; + + private int displayDecimals; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem other) { + amount(other.getAmount()); + currency(other.getCurrency()); + decimals(other.getDecimals()); + displayDecimals(other.getDisplayDecimals()); + return this; + } + + /** + *

The amount in major units, as an exact decimal string — "10.00" is ten dollars. A string so no float rounds it in transit.

+ *

The amount in major units, as an exact decimal string — "10.00" is ten dollars. A string so no float rounds it in transit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CurrencyStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

Three-letter ISO 4217 currency code, lowercase.

+ *

Three-letter ISO 4217 currency code, lowercase.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DecimalsStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

How many decimal places the amount CARRIES — the precision the charge itself runs at.

+ *

How many decimal places the amount CARRIES — the precision the charge itself runs at.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("decimals") + public DisplayDecimalsStage decimals(int decimals) { + this.decimals = decimals; + return this; + } + + /** + *

How many decimal places to SHOW. Usually equal to decimals, and deliberately not always: COP is charged in centavos but written in whole pesos, so it is 2 and 0. Format the number in your own locale using this.

+ *

How many decimal places to SHOW. Usually equal to decimals, and deliberately not always: COP is charged in centavos but written in whole pesos, so it is 2 and 0. Format the number in your own locale using this.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("display_decimals") + public _FinalStage displayDecimals(int displayDecimals) { + this.displayDecimals = displayDecimals; + return this; + } + + @java.lang.Override + public PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem build() { + return new PaymentMethodListItemPlatformBalancePaymentMethodPlatformBalanceBalancesItem( + amount, currency, decimals, displayDecimals, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethod.java b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethod.java new file mode 100644 index 00000000..e9e9be98 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethod.java @@ -0,0 +1,275 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemSepaDebitPaymentMethod.Builder.class) +public final class PaymentMethodListItemSepaDebitPaymentMethod { + private final OffsetDateTime createdAt; + + private final PaymentMethodListItemSepaDebitPaymentMethodIcons icons; + + private final String id; + + private final PaymentMethodTypes paymentMethodType; + + private final PaymentMethodListItemSepaDebitPaymentMethodSepaDebit sepaDebit; + + private final Map additionalProperties; + + private PaymentMethodListItemSepaDebitPaymentMethod( + OffsetDateTime createdAt, + PaymentMethodListItemSepaDebitPaymentMethodIcons icons, + String id, + PaymentMethodTypes paymentMethodType, + PaymentMethodListItemSepaDebitPaymentMethodSepaDebit sepaDebit, + Map additionalProperties) { + this.createdAt = createdAt; + this.icons = icons; + this.id = id; + this.paymentMethodType = paymentMethodType; + this.sepaDebit = sepaDebit; + this.additionalProperties = additionalProperties; + } + + /** + * @return The time of the event in ISO 8601 UTC format with millisecond precision + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art. + */ + @JsonProperty("icons") + public PaymentMethodListItemSepaDebitPaymentMethodIcons getIcons() { + return icons; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit). + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + /** + * @return The SEPA Direct Debit-specific details for this payment method, including bank code and last four IBAN digits. + */ + @JsonProperty("sepa_debit") + public PaymentMethodListItemSepaDebitPaymentMethodSepaDebit getSepaDebit() { + return sepaDebit; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemSepaDebitPaymentMethod + && equalTo((PaymentMethodListItemSepaDebitPaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemSepaDebitPaymentMethod other) { + return createdAt.equals(other.createdAt) + && icons.equals(other.icons) + && id.equals(other.id) + && paymentMethodType.equals(other.paymentMethodType) + && sepaDebit.equals(other.sepaDebit); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.icons, this.id, this.paymentMethodType, this.sepaDebit); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ */ + IconsStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PaymentMethodListItemSepaDebitPaymentMethod other); + } + + public interface IconsStage { + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ */ + IdStage icons(@NotNull PaymentMethodListItemSepaDebitPaymentMethodIcons icons); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ */ + SepaDebitStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface SepaDebitStage { + /** + *

The SEPA Direct Debit-specific details for this payment method, including bank code and last four IBAN digits.

+ */ + _FinalStage sepaDebit(@NotNull PaymentMethodListItemSepaDebitPaymentMethodSepaDebit sepaDebit); + } + + public interface _FinalStage { + PaymentMethodListItemSepaDebitPaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IconsStage, IdStage, PaymentMethodTypeStage, SepaDebitStage, _FinalStage { + private OffsetDateTime createdAt; + + private PaymentMethodListItemSepaDebitPaymentMethodIcons icons; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + private PaymentMethodListItemSepaDebitPaymentMethodSepaDebit sepaDebit; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemSepaDebitPaymentMethod other) { + createdAt(other.getCreatedAt()); + icons(other.getIcons()); + id(other.getId()); + paymentMethodType(other.getPaymentMethodType()); + sepaDebit(other.getSepaDebit()); + return this; + } + + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ *

The time of the event in ISO 8601 UTC format with millisecond precision

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IconsStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public IdStage icons(@NotNull PaymentMethodListItemSepaDebitPaymentMethodIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public SepaDebitStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + /** + *

The SEPA Direct Debit-specific details for this payment method, including bank code and last four IBAN digits.

+ *

The SEPA Direct Debit-specific details for this payment method, including bank code and last four IBAN digits.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sepa_debit") + public _FinalStage sepaDebit(@NotNull PaymentMethodListItemSepaDebitPaymentMethodSepaDebit sepaDebit) { + this.sepaDebit = Objects.requireNonNull(sepaDebit, "sepaDebit must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemSepaDebitPaymentMethod build() { + return new PaymentMethodListItemSepaDebitPaymentMethod( + createdAt, icons, id, paymentMethodType, sepaDebit, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIcons.java b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIcons.java new file mode 100644 index 00000000..c7211aff --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIcons.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemSepaDebitPaymentMethodIcons.Builder.class) +public final class PaymentMethodListItemSepaDebitPaymentMethodIcons { + private final PaymentMethodListItemSepaDebitPaymentMethodIconsCard card; + + private final PaymentMethodListItemSepaDebitPaymentMethodIconsSquare square; + + private final Map additionalProperties; + + private PaymentMethodListItemSepaDebitPaymentMethodIcons( + PaymentMethodListItemSepaDebitPaymentMethodIconsCard card, + PaymentMethodListItemSepaDebitPaymentMethodIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentMethodListItemSepaDebitPaymentMethodIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentMethodListItemSepaDebitPaymentMethodIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemSepaDebitPaymentMethodIcons + && equalTo((PaymentMethodListItemSepaDebitPaymentMethodIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemSepaDebitPaymentMethodIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentMethodListItemSepaDebitPaymentMethodIconsCard card); + + Builder from(PaymentMethodListItemSepaDebitPaymentMethodIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentMethodListItemSepaDebitPaymentMethodIconsSquare square); + } + + public interface _FinalStage { + PaymentMethodListItemSepaDebitPaymentMethodIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentMethodListItemSepaDebitPaymentMethodIconsCard card; + + private PaymentMethodListItemSepaDebitPaymentMethodIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemSepaDebitPaymentMethodIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentMethodListItemSepaDebitPaymentMethodIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentMethodListItemSepaDebitPaymentMethodIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemSepaDebitPaymentMethodIcons build() { + return new PaymentMethodListItemSepaDebitPaymentMethodIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsCard.java b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsCard.java new file mode 100644 index 00000000..b52f034b --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsCard.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemSepaDebitPaymentMethodIconsCard.Builder.class) +public final class PaymentMethodListItemSepaDebitPaymentMethodIconsCard { + private final PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark dark; + + private final PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight light; + + private final Map additionalProperties; + + private PaymentMethodListItemSepaDebitPaymentMethodIconsCard( + PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark dark, + PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemSepaDebitPaymentMethodIconsCard + && equalTo((PaymentMethodListItemSepaDebitPaymentMethodIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemSepaDebitPaymentMethodIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark dark); + + Builder from(PaymentMethodListItemSepaDebitPaymentMethodIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight light); + } + + public interface _FinalStage { + PaymentMethodListItemSepaDebitPaymentMethodIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark dark; + + private PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemSepaDebitPaymentMethodIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemSepaDebitPaymentMethodIconsCard build() { + return new PaymentMethodListItemSepaDebitPaymentMethodIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark.java new file mode 100644 index 00000000..e9c1f5a6 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark.Builder.class) +public final class PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark + && equalTo((PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark build() { + return new PaymentMethodListItemSepaDebitPaymentMethodIconsCardDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight.java new file mode 100644 index 00000000..6587a117 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight.Builder.class) +public final class PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight + && equalTo((PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight build() { + return new PaymentMethodListItemSepaDebitPaymentMethodIconsCardLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsSquare.java b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsSquare.java new file mode 100644 index 00000000..af702afa --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemSepaDebitPaymentMethodIconsSquare.Builder.class) +public final class PaymentMethodListItemSepaDebitPaymentMethodIconsSquare { + private final PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark dark; + + private final PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentMethodListItemSepaDebitPaymentMethodIconsSquare( + PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark dark, + PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemSepaDebitPaymentMethodIconsSquare + && equalTo((PaymentMethodListItemSepaDebitPaymentMethodIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemSepaDebitPaymentMethodIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark dark); + + Builder from(PaymentMethodListItemSepaDebitPaymentMethodIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight light); + } + + public interface _FinalStage { + PaymentMethodListItemSepaDebitPaymentMethodIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark dark; + + private PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemSepaDebitPaymentMethodIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemSepaDebitPaymentMethodIconsSquare build() { + return new PaymentMethodListItemSepaDebitPaymentMethodIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark.java new file mode 100644 index 00000000..51f09eb5 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark.Builder.class) +public final class PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark + && equalTo((PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark build() { + return new PaymentMethodListItemSepaDebitPaymentMethodIconsSquareDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight.java new file mode 100644 index 00000000..be63a438 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight.Builder.class) +public final class PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight + && equalTo((PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight build() { + return new PaymentMethodListItemSepaDebitPaymentMethodIconsSquareLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodSepaDebit.java b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodSepaDebit.java new file mode 100644 index 00000000..dd2b19b8 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemSepaDebitPaymentMethodSepaDebit.java @@ -0,0 +1,288 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemSepaDebitPaymentMethodSepaDebit.Builder.class) +public final class PaymentMethodListItemSepaDebitPaymentMethodSepaDebit { + private final Optional bankCode; + + private final Optional branchCode; + + private final Optional country; + + private final Optional last4; + + private final Map additionalProperties; + + private PaymentMethodListItemSepaDebitPaymentMethodSepaDebit( + Optional bankCode, + Optional branchCode, + Optional country, + Optional last4, + Map additionalProperties) { + this.bankCode = bankCode; + this.branchCode = branchCode; + this.country = country; + this.last4 = last4; + this.additionalProperties = additionalProperties; + } + + /** + * @return The bank code of the financial institution associated with this SEPA account. Null if not available. + */ + @JsonIgnore + public Optional getBankCode() { + if (bankCode == null) { + return Optional.empty(); + } + return bankCode; + } + + /** + * @return The branch code of the financial institution associated with this SEPA account. Null if not available. + */ + @JsonIgnore + public Optional getBranchCode() { + if (branchCode == null) { + return Optional.empty(); + } + return branchCode; + } + + /** + * @return The two-letter ISO country code where the bank account is located. Null if not available. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The last four digits of the IBAN associated with this SEPA account. Null if not available. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bank_code") + private Optional _getBankCode() { + return bankCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("branch_code") + private Optional _getBranchCode() { + return branchCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemSepaDebitPaymentMethodSepaDebit + && equalTo((PaymentMethodListItemSepaDebitPaymentMethodSepaDebit) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemSepaDebitPaymentMethodSepaDebit other) { + return bankCode.equals(other.bankCode) + && branchCode.equals(other.branchCode) + && country.equals(other.country) + && last4.equals(other.last4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.bankCode, this.branchCode, this.country, this.last4); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional bankCode = Optional.empty(); + + private Optional branchCode = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional last4 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentMethodListItemSepaDebitPaymentMethodSepaDebit other) { + bankCode(other.getBankCode()); + branchCode(other.getBranchCode()); + country(other.getCountry()); + last4(other.getLast4()); + return this; + } + + /** + *

The bank code of the financial institution associated with this SEPA account. Null if not available.

+ */ + @JsonSetter(value = "bank_code", nulls = Nulls.SKIP) + public Builder bankCode(Optional bankCode) { + this.bankCode = bankCode; + return this; + } + + public Builder bankCode(String bankCode) { + this.bankCode = Optional.ofNullable(bankCode); + return this; + } + + public Builder bankCode(Nullable bankCode) { + if (bankCode.isNull()) { + this.bankCode = null; + } else if (bankCode.isEmpty()) { + this.bankCode = Optional.empty(); + } else { + this.bankCode = Optional.of(bankCode.get()); + } + return this; + } + + /** + *

The branch code of the financial institution associated with this SEPA account. Null if not available.

+ */ + @JsonSetter(value = "branch_code", nulls = Nulls.SKIP) + public Builder branchCode(Optional branchCode) { + this.branchCode = branchCode; + return this; + } + + public Builder branchCode(String branchCode) { + this.branchCode = Optional.ofNullable(branchCode); + return this; + } + + public Builder branchCode(Nullable branchCode) { + if (branchCode.isNull()) { + this.branchCode = null; + } else if (branchCode.isEmpty()) { + this.branchCode = Optional.empty(); + } else { + this.branchCode = Optional.of(branchCode.get()); + } + return this; + } + + /** + *

The two-letter ISO country code where the bank account is located. Null if not available.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The last four digits of the IBAN associated with this SEPA account. Null if not available.

+ */ + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public Builder last4(Optional last4) { + this.last4 = last4; + return this; + } + + public Builder last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + public Builder last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + public PaymentMethodListItemSepaDebitPaymentMethodSepaDebit build() { + return new PaymentMethodListItemSepaDebitPaymentMethodSepaDebit( + bankCode, branchCode, country, last4, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethod.java b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethod.java new file mode 100644 index 00000000..5cd56315 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethod.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemUsBankAccountPaymentMethod.Builder.class) +public final class PaymentMethodListItemUsBankAccountPaymentMethod { + private final OffsetDateTime createdAt; + + private final PaymentMethodListItemUsBankAccountPaymentMethodIcons icons; + + private final String id; + + private final PaymentMethodTypes paymentMethodType; + + private final PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount usBankAccount; + + private final Map additionalProperties; + + private PaymentMethodListItemUsBankAccountPaymentMethod( + OffsetDateTime createdAt, + PaymentMethodListItemUsBankAccountPaymentMethodIcons icons, + String id, + PaymentMethodTypes paymentMethodType, + PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount usBankAccount, + Map additionalProperties) { + this.createdAt = createdAt; + this.icons = icons; + this.id = id; + this.paymentMethodType = paymentMethodType; + this.usBankAccount = usBankAccount; + this.additionalProperties = additionalProperties; + } + + /** + * @return The time of the event in ISO 8601 UTC format with millisecond precision + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art. + */ + @JsonProperty("icons") + public PaymentMethodListItemUsBankAccountPaymentMethodIcons getIcons() { + return icons; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit). + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + /** + * @return The bank account-specific details for this payment method, including bank name and last four digits. + */ + @JsonProperty("us_bank_account") + public PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount getUsBankAccount() { + return usBankAccount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemUsBankAccountPaymentMethod + && equalTo((PaymentMethodListItemUsBankAccountPaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemUsBankAccountPaymentMethod other) { + return createdAt.equals(other.createdAt) + && icons.equals(other.icons) + && id.equals(other.id) + && paymentMethodType.equals(other.paymentMethodType) + && usBankAccount.equals(other.usBankAccount); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.icons, this.id, this.paymentMethodType, this.usBankAccount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ */ + IconsStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PaymentMethodListItemUsBankAccountPaymentMethod other); + } + + public interface IconsStage { + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ */ + IdStage icons(@NotNull PaymentMethodListItemUsBankAccountPaymentMethodIcons icons); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ */ + UsBankAccountStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface UsBankAccountStage { + /** + *

The bank account-specific details for this payment method, including bank name and last four digits.

+ */ + _FinalStage usBankAccount(@NotNull PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount usBankAccount); + } + + public interface _FinalStage { + PaymentMethodListItemUsBankAccountPaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IconsStage, IdStage, PaymentMethodTypeStage, UsBankAccountStage, _FinalStage { + private OffsetDateTime createdAt; + + private PaymentMethodListItemUsBankAccountPaymentMethodIcons icons; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + private PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount usBankAccount; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemUsBankAccountPaymentMethod other) { + createdAt(other.getCreatedAt()); + icons(other.getIcons()); + id(other.getId()); + paymentMethodType(other.getPaymentMethodType()); + usBankAccount(other.getUsBankAccount()); + return this; + } + + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ *

The time of the event in ISO 8601 UTC format with millisecond precision

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IconsStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public IdStage icons(@NotNull PaymentMethodListItemUsBankAccountPaymentMethodIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public UsBankAccountStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + /** + *

The bank account-specific details for this payment method, including bank name and last four digits.

+ *

The bank account-specific details for this payment method, including bank name and last four digits.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("us_bank_account") + public _FinalStage usBankAccount( + @NotNull PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount usBankAccount) { + this.usBankAccount = Objects.requireNonNull(usBankAccount, "usBankAccount must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemUsBankAccountPaymentMethod build() { + return new PaymentMethodListItemUsBankAccountPaymentMethod( + createdAt, icons, id, paymentMethodType, usBankAccount, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIcons.java b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIcons.java new file mode 100644 index 00000000..bf9df40b --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIcons.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemUsBankAccountPaymentMethodIcons.Builder.class) +public final class PaymentMethodListItemUsBankAccountPaymentMethodIcons { + private final PaymentMethodListItemUsBankAccountPaymentMethodIconsCard card; + + private final PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare square; + + private final Map additionalProperties; + + private PaymentMethodListItemUsBankAccountPaymentMethodIcons( + PaymentMethodListItemUsBankAccountPaymentMethodIconsCard card, + PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentMethodListItemUsBankAccountPaymentMethodIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemUsBankAccountPaymentMethodIcons + && equalTo((PaymentMethodListItemUsBankAccountPaymentMethodIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemUsBankAccountPaymentMethodIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentMethodListItemUsBankAccountPaymentMethodIconsCard card); + + Builder from(PaymentMethodListItemUsBankAccountPaymentMethodIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare square); + } + + public interface _FinalStage { + PaymentMethodListItemUsBankAccountPaymentMethodIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentMethodListItemUsBankAccountPaymentMethodIconsCard card; + + private PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemUsBankAccountPaymentMethodIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentMethodListItemUsBankAccountPaymentMethodIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemUsBankAccountPaymentMethodIcons build() { + return new PaymentMethodListItemUsBankAccountPaymentMethodIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsCard.java b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsCard.java new file mode 100644 index 00000000..2e3dd886 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsCard.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemUsBankAccountPaymentMethodIconsCard.Builder.class) +public final class PaymentMethodListItemUsBankAccountPaymentMethodIconsCard { + private final PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark dark; + + private final PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight light; + + private final Map additionalProperties; + + private PaymentMethodListItemUsBankAccountPaymentMethodIconsCard( + PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark dark, + PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemUsBankAccountPaymentMethodIconsCard + && equalTo((PaymentMethodListItemUsBankAccountPaymentMethodIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemUsBankAccountPaymentMethodIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark dark); + + Builder from(PaymentMethodListItemUsBankAccountPaymentMethodIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight light); + } + + public interface _FinalStage { + PaymentMethodListItemUsBankAccountPaymentMethodIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark dark; + + private PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemUsBankAccountPaymentMethodIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemUsBankAccountPaymentMethodIconsCard build() { + return new PaymentMethodListItemUsBankAccountPaymentMethodIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark.java new file mode 100644 index 00000000..b3a69a66 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark.Builder.class) +public final class PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark + && equalTo((PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark build() { + return new PaymentMethodListItemUsBankAccountPaymentMethodIconsCardDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight.java new file mode 100644 index 00000000..b2b7c679 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight.Builder.class) +public final class PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight + && equalTo((PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight build() { + return new PaymentMethodListItemUsBankAccountPaymentMethodIconsCardLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare.java b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare.java new file mode 100644 index 00000000..1d7b9c4f --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare.Builder.class) +public final class PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare { + private final PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark dark; + + private final PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare( + PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark dark, + PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare + && equalTo((PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark dark); + + Builder from(PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight light); + } + + public interface _FinalStage { + PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark dark; + + private PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare build() { + return new PaymentMethodListItemUsBankAccountPaymentMethodIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark.java new file mode 100644 index 00000000..31a7156e --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark.Builder.class) +public final class PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark + && equalTo((PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark build() { + return new PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight.java new file mode 100644 index 00000000..c84383c5 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight.Builder.class) +public final class PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight + && equalTo((PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight build() { + return new PaymentMethodListItemUsBankAccountPaymentMethodIconsSquareLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount.java b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount.java new file mode 100644 index 00000000..16e933a6 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount.java @@ -0,0 +1,198 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount.Builder.class) +public final class PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount { + private final String accountType; + + private final String bankName; + + private final String last4; + + private final Map additionalProperties; + + private PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount( + String accountType, String bankName, String last4, Map additionalProperties) { + this.accountType = accountType; + this.bankName = bankName; + this.last4 = last4; + this.additionalProperties = additionalProperties; + } + + /** + * @return The type of bank account (e.g., checking, savings). + */ + @JsonProperty("account_type") + public String getAccountType() { + return accountType; + } + + /** + * @return The name of the financial institution holding the account. + */ + @JsonProperty("bank_name") + public String getBankName() { + return bankName; + } + + /** + * @return The last four digits of the bank account number. + */ + @JsonProperty("last4") + public String getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount + && equalTo((PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount other) { + return accountType.equals(other.accountType) && bankName.equals(other.bankName) && last4.equals(other.last4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountType, this.bankName, this.last4); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountTypeStage builder() { + return new Builder(); + } + + public interface AccountTypeStage { + /** + *

The type of bank account (e.g., checking, savings).

+ */ + BankNameStage accountType(@NotNull String accountType); + + Builder from(PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount other); + } + + public interface BankNameStage { + /** + *

The name of the financial institution holding the account.

+ */ + Last4Stage bankName(@NotNull String bankName); + } + + public interface Last4Stage { + /** + *

The last four digits of the bank account number.

+ */ + _FinalStage last4(@NotNull String last4); + } + + public interface _FinalStage { + PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountTypeStage, BankNameStage, Last4Stage, _FinalStage { + private String accountType; + + private String bankName; + + private String last4; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount other) { + accountType(other.getAccountType()); + bankName(other.getBankName()); + last4(other.getLast4()); + return this; + } + + /** + *

The type of bank account (e.g., checking, savings).

+ *

The type of bank account (e.g., checking, savings).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_type") + public BankNameStage accountType(@NotNull String accountType) { + this.accountType = Objects.requireNonNull(accountType, "accountType must not be null"); + return this; + } + + /** + *

The name of the financial institution holding the account.

+ *

The name of the financial institution holding the account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bank_name") + public Last4Stage bankName(@NotNull String bankName) { + this.bankName = Objects.requireNonNull(bankName, "bankName must not be null"); + return this; + } + + /** + *

The last four digits of the bank account number.

+ *

The last four digits of the bank account number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("last4") + public _FinalStage last4(@NotNull String last4) { + this.last4 = Objects.requireNonNull(last4, "last4 must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount build() { + return new PaymentMethodListItemUsBankAccountPaymentMethodUsBankAccount( + accountType, bankName, last4, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethod.java b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethod.java new file mode 100644 index 00000000..bd13f6f8 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethod.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodPlatformBalancePaymentMethod.Builder.class) +public final class PaymentMethodPlatformBalancePaymentMethod { + private final OffsetDateTime createdAt; + + private final PaymentMethodPlatformBalancePaymentMethodIcons icons; + + private final String id; + + private final PaymentMethodTypes paymentMethodType; + + private final PaymentMethodPlatformBalancePaymentMethodPlatformBalance platformBalance; + + private final Map additionalProperties; + + private PaymentMethodPlatformBalancePaymentMethod( + OffsetDateTime createdAt, + PaymentMethodPlatformBalancePaymentMethodIcons icons, + String id, + PaymentMethodTypes paymentMethodType, + PaymentMethodPlatformBalancePaymentMethodPlatformBalance platformBalance, + Map additionalProperties) { + this.createdAt = createdAt; + this.icons = icons; + this.id = id; + this.paymentMethodType = paymentMethodType; + this.platformBalance = platformBalance; + this.additionalProperties = additionalProperties; + } + + /** + * @return The time of the event in ISO 8601 UTC format with millisecond precision + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art. + */ + @JsonProperty("icons") + public PaymentMethodPlatformBalancePaymentMethodIcons getIcons() { + return icons; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit). + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + /** + * @return What is available to spend, and whether the account may spend it. + */ + @JsonProperty("platform_balance") + public PaymentMethodPlatformBalancePaymentMethodPlatformBalance getPlatformBalance() { + return platformBalance; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodPlatformBalancePaymentMethod + && equalTo((PaymentMethodPlatformBalancePaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodPlatformBalancePaymentMethod other) { + return createdAt.equals(other.createdAt) + && icons.equals(other.icons) + && id.equals(other.id) + && paymentMethodType.equals(other.paymentMethodType) + && platformBalance.equals(other.platformBalance); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.icons, this.id, this.paymentMethodType, this.platformBalance); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ */ + IconsStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PaymentMethodPlatformBalancePaymentMethod other); + } + + public interface IconsStage { + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ */ + IdStage icons(@NotNull PaymentMethodPlatformBalancePaymentMethodIcons icons); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ */ + PlatformBalanceStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface PlatformBalanceStage { + /** + *

What is available to spend, and whether the account may spend it.

+ */ + _FinalStage platformBalance(@NotNull PaymentMethodPlatformBalancePaymentMethodPlatformBalance platformBalance); + } + + public interface _FinalStage { + PaymentMethodPlatformBalancePaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IconsStage, IdStage, PaymentMethodTypeStage, PlatformBalanceStage, _FinalStage { + private OffsetDateTime createdAt; + + private PaymentMethodPlatformBalancePaymentMethodIcons icons; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + private PaymentMethodPlatformBalancePaymentMethodPlatformBalance platformBalance; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodPlatformBalancePaymentMethod other) { + createdAt(other.getCreatedAt()); + icons(other.getIcons()); + id(other.getId()); + paymentMethodType(other.getPaymentMethodType()); + platformBalance(other.getPlatformBalance()); + return this; + } + + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ *

The time of the event in ISO 8601 UTC format with millisecond precision

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IconsStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public IdStage icons(@NotNull PaymentMethodPlatformBalancePaymentMethodIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public PlatformBalanceStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + /** + *

What is available to spend, and whether the account may spend it.

+ *

What is available to spend, and whether the account may spend it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform_balance") + public _FinalStage platformBalance( + @NotNull PaymentMethodPlatformBalancePaymentMethodPlatformBalance platformBalance) { + this.platformBalance = Objects.requireNonNull(platformBalance, "platformBalance must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodPlatformBalancePaymentMethod build() { + return new PaymentMethodPlatformBalancePaymentMethod( + createdAt, icons, id, paymentMethodType, platformBalance, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIcons.java b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIcons.java new file mode 100644 index 00000000..cf17fdbf --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIcons.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodPlatformBalancePaymentMethodIcons.Builder.class) +public final class PaymentMethodPlatformBalancePaymentMethodIcons { + private final PaymentMethodPlatformBalancePaymentMethodIconsCard card; + + private final PaymentMethodPlatformBalancePaymentMethodIconsSquare square; + + private final Map additionalProperties; + + private PaymentMethodPlatformBalancePaymentMethodIcons( + PaymentMethodPlatformBalancePaymentMethodIconsCard card, + PaymentMethodPlatformBalancePaymentMethodIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentMethodPlatformBalancePaymentMethodIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentMethodPlatformBalancePaymentMethodIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodPlatformBalancePaymentMethodIcons + && equalTo((PaymentMethodPlatformBalancePaymentMethodIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodPlatformBalancePaymentMethodIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentMethodPlatformBalancePaymentMethodIconsCard card); + + Builder from(PaymentMethodPlatformBalancePaymentMethodIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentMethodPlatformBalancePaymentMethodIconsSquare square); + } + + public interface _FinalStage { + PaymentMethodPlatformBalancePaymentMethodIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentMethodPlatformBalancePaymentMethodIconsCard card; + + private PaymentMethodPlatformBalancePaymentMethodIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodPlatformBalancePaymentMethodIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentMethodPlatformBalancePaymentMethodIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentMethodPlatformBalancePaymentMethodIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodPlatformBalancePaymentMethodIcons build() { + return new PaymentMethodPlatformBalancePaymentMethodIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsCard.java b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsCard.java new file mode 100644 index 00000000..eb335cc6 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsCard.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodPlatformBalancePaymentMethodIconsCard.Builder.class) +public final class PaymentMethodPlatformBalancePaymentMethodIconsCard { + private final PaymentMethodPlatformBalancePaymentMethodIconsCardDark dark; + + private final PaymentMethodPlatformBalancePaymentMethodIconsCardLight light; + + private final Map additionalProperties; + + private PaymentMethodPlatformBalancePaymentMethodIconsCard( + PaymentMethodPlatformBalancePaymentMethodIconsCardDark dark, + PaymentMethodPlatformBalancePaymentMethodIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodPlatformBalancePaymentMethodIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodPlatformBalancePaymentMethodIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodPlatformBalancePaymentMethodIconsCard + && equalTo((PaymentMethodPlatformBalancePaymentMethodIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodPlatformBalancePaymentMethodIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodPlatformBalancePaymentMethodIconsCardDark dark); + + Builder from(PaymentMethodPlatformBalancePaymentMethodIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodPlatformBalancePaymentMethodIconsCardLight light); + } + + public interface _FinalStage { + PaymentMethodPlatformBalancePaymentMethodIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodPlatformBalancePaymentMethodIconsCardDark dark; + + private PaymentMethodPlatformBalancePaymentMethodIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodPlatformBalancePaymentMethodIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodPlatformBalancePaymentMethodIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodPlatformBalancePaymentMethodIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodPlatformBalancePaymentMethodIconsCard build() { + return new PaymentMethodPlatformBalancePaymentMethodIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsCardDark.java new file mode 100644 index 00000000..fe02a6c5 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsCardDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodPlatformBalancePaymentMethodIconsCardDark.Builder.class) +public final class PaymentMethodPlatformBalancePaymentMethodIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodPlatformBalancePaymentMethodIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodPlatformBalancePaymentMethodIconsCardDark + && equalTo((PaymentMethodPlatformBalancePaymentMethodIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodPlatformBalancePaymentMethodIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodPlatformBalancePaymentMethodIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodPlatformBalancePaymentMethodIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodPlatformBalancePaymentMethodIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodPlatformBalancePaymentMethodIconsCardDark build() { + return new PaymentMethodPlatformBalancePaymentMethodIconsCardDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsCardLight.java new file mode 100644 index 00000000..6d3b82c5 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsCardLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodPlatformBalancePaymentMethodIconsCardLight.Builder.class) +public final class PaymentMethodPlatformBalancePaymentMethodIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodPlatformBalancePaymentMethodIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodPlatformBalancePaymentMethodIconsCardLight + && equalTo((PaymentMethodPlatformBalancePaymentMethodIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodPlatformBalancePaymentMethodIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodPlatformBalancePaymentMethodIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodPlatformBalancePaymentMethodIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodPlatformBalancePaymentMethodIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodPlatformBalancePaymentMethodIconsCardLight build() { + return new PaymentMethodPlatformBalancePaymentMethodIconsCardLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsSquare.java b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsSquare.java new file mode 100644 index 00000000..afeba4dc --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodPlatformBalancePaymentMethodIconsSquare.Builder.class) +public final class PaymentMethodPlatformBalancePaymentMethodIconsSquare { + private final PaymentMethodPlatformBalancePaymentMethodIconsSquareDark dark; + + private final PaymentMethodPlatformBalancePaymentMethodIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentMethodPlatformBalancePaymentMethodIconsSquare( + PaymentMethodPlatformBalancePaymentMethodIconsSquareDark dark, + PaymentMethodPlatformBalancePaymentMethodIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodPlatformBalancePaymentMethodIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodPlatformBalancePaymentMethodIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodPlatformBalancePaymentMethodIconsSquare + && equalTo((PaymentMethodPlatformBalancePaymentMethodIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodPlatformBalancePaymentMethodIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodPlatformBalancePaymentMethodIconsSquareDark dark); + + Builder from(PaymentMethodPlatformBalancePaymentMethodIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodPlatformBalancePaymentMethodIconsSquareLight light); + } + + public interface _FinalStage { + PaymentMethodPlatformBalancePaymentMethodIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodPlatformBalancePaymentMethodIconsSquareDark dark; + + private PaymentMethodPlatformBalancePaymentMethodIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodPlatformBalancePaymentMethodIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodPlatformBalancePaymentMethodIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodPlatformBalancePaymentMethodIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodPlatformBalancePaymentMethodIconsSquare build() { + return new PaymentMethodPlatformBalancePaymentMethodIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsSquareDark.java new file mode 100644 index 00000000..d785872d --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsSquareDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodPlatformBalancePaymentMethodIconsSquareDark.Builder.class) +public final class PaymentMethodPlatformBalancePaymentMethodIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodPlatformBalancePaymentMethodIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodPlatformBalancePaymentMethodIconsSquareDark + && equalTo((PaymentMethodPlatformBalancePaymentMethodIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodPlatformBalancePaymentMethodIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodPlatformBalancePaymentMethodIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodPlatformBalancePaymentMethodIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodPlatformBalancePaymentMethodIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodPlatformBalancePaymentMethodIconsSquareDark build() { + return new PaymentMethodPlatformBalancePaymentMethodIconsSquareDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsSquareLight.java new file mode 100644 index 00000000..7885a41e --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodIconsSquareLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodPlatformBalancePaymentMethodIconsSquareLight.Builder.class) +public final class PaymentMethodPlatformBalancePaymentMethodIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodPlatformBalancePaymentMethodIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodPlatformBalancePaymentMethodIconsSquareLight + && equalTo((PaymentMethodPlatformBalancePaymentMethodIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodPlatformBalancePaymentMethodIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodPlatformBalancePaymentMethodIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodPlatformBalancePaymentMethodIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodPlatformBalancePaymentMethodIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodPlatformBalancePaymentMethodIconsSquareLight build() { + return new PaymentMethodPlatformBalancePaymentMethodIconsSquareLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodPlatformBalance.java b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodPlatformBalance.java new file mode 100644 index 00000000..e66d1d3d --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodPlatformBalance.java @@ -0,0 +1,269 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodPlatformBalancePaymentMethodPlatformBalance.Builder.class) +public final class PaymentMethodPlatformBalancePaymentMethodPlatformBalance { + private final Optional account; + + private final List balances; + + private final boolean spendable; + + private final Map additionalProperties; + + private PaymentMethodPlatformBalancePaymentMethodPlatformBalance( + Optional account, + List balances, + boolean spendable, + Map additionalProperties) { + this.account = account; + this.balances = balances; + this.spendable = spendable; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account whose wallet this is. Null for the buyer's own personal wallet. A buyer sees an account's balance here when they hold permission to spend it, so a list can hold several — their own and one per account they are on. + */ + @JsonIgnore + public Optional getAccount() { + if (account == null) { + return Optional.empty(); + } + return account; + } + + /** + * @return Available amount per currency. Read from the balance cache, so it is indicative — the charge revalidates against settled funds and may still refuse. + */ + @JsonProperty("balances") + public List getBalances() { + return balances; + } + + /** + * @return Whether this balance can pay right now, which here means only whether it holds funds — an account blocked from spending is not listed at all. A zero balance is still returned so a client can show it as an option the buyer could top up. + */ + @JsonProperty("spendable") + public boolean getSpendable() { + return spendable; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account") + private Optional _getAccount() { + return account; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodPlatformBalancePaymentMethodPlatformBalance + && equalTo((PaymentMethodPlatformBalancePaymentMethodPlatformBalance) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodPlatformBalancePaymentMethodPlatformBalance other) { + return account.equals(other.account) && balances.equals(other.balances) && spendable == other.spendable; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.account, this.balances, this.spendable); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SpendableStage builder() { + return new Builder(); + } + + public interface SpendableStage { + /** + *

Whether this balance can pay right now, which here means only whether it holds funds — an account blocked from spending is not listed at all. A zero balance is still returned so a client can show it as an option the buyer could top up.

+ */ + _FinalStage spendable(boolean spendable); + + Builder from(PaymentMethodPlatformBalancePaymentMethodPlatformBalance other); + } + + public interface _FinalStage { + PaymentMethodPlatformBalancePaymentMethodPlatformBalance build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account whose wallet this is. Null for the buyer's own personal wallet. A buyer sees an account's balance here when they hold permission to spend it, so a list can hold several — their own and one per account they are on.

+ */ + _FinalStage account(Optional account); + + _FinalStage account(PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount account); + + _FinalStage account(Nullable account); + + /** + *

Available amount per currency. Read from the balance cache, so it is indicative — the charge revalidates against settled funds and may still refuse.

+ */ + _FinalStage balances(List balances); + + _FinalStage addBalances(PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem balances); + + _FinalStage addAllBalances(List balances); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SpendableStage, _FinalStage { + private boolean spendable; + + private List balances = new ArrayList<>(); + + private Optional account = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodPlatformBalancePaymentMethodPlatformBalance other) { + account(other.getAccount()); + balances(other.getBalances()); + spendable(other.getSpendable()); + return this; + } + + /** + *

Whether this balance can pay right now, which here means only whether it holds funds — an account blocked from spending is not listed at all. A zero balance is still returned so a client can show it as an option the buyer could top up.

+ *

Whether this balance can pay right now, which here means only whether it holds funds — an account blocked from spending is not listed at all. A zero balance is still returned so a client can show it as an option the buyer could top up.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("spendable") + public _FinalStage spendable(boolean spendable) { + this.spendable = spendable; + return this; + } + + /** + *

Available amount per currency. Read from the balance cache, so it is indicative — the charge revalidates against settled funds and may still refuse.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllBalances( + List balances) { + if (balances != null) { + this.balances.addAll(balances); + } + return this; + } + + /** + *

Available amount per currency. Read from the balance cache, so it is indicative — the charge revalidates against settled funds and may still refuse.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addBalances(PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem balances) { + this.balances.add(balances); + return this; + } + + /** + *

Available amount per currency. Read from the balance cache, so it is indicative — the charge revalidates against settled funds and may still refuse.

+ */ + @java.lang.Override + @JsonSetter(value = "balances", nulls = Nulls.SKIP) + public _FinalStage balances( + List balances) { + this.balances.clear(); + if (balances != null) { + this.balances.addAll(balances); + } + return this; + } + + /** + *

The account whose wallet this is. Null for the buyer's own personal wallet. A buyer sees an account's balance here when they hold permission to spend it, so a list can hold several — their own and one per account they are on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(Nullable account) { + if (account.isNull()) { + this.account = null; + } else if (account.isEmpty()) { + this.account = Optional.empty(); + } else { + this.account = Optional.of(account.get()); + } + return this; + } + + /** + *

The account whose wallet this is. Null for the buyer's own personal wallet. A buyer sees an account's balance here when they hold permission to spend it, so a list can hold several — their own and one per account they are on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount account) { + this.account = Optional.ofNullable(account); + return this; + } + + /** + *

The account whose wallet this is. Null for the buyer's own personal wallet. A buyer sees an account's balance here when they hold permission to spend it, so a list can hold several — their own and one per account they are on.

+ */ + @java.lang.Override + @JsonSetter(value = "account", nulls = Nulls.SKIP) + public _FinalStage account(Optional account) { + this.account = account; + return this; + } + + @java.lang.Override + public PaymentMethodPlatformBalancePaymentMethodPlatformBalance build() { + return new PaymentMethodPlatformBalancePaymentMethodPlatformBalance( + account, balances, spendable, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount.java b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount.java new file mode 100644 index 00000000..27291bbb --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount.java @@ -0,0 +1,241 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount.Builder.class) +public final class PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount { + private final String id; + + private final Optional logo; + + private final String title; + + private final Map additionalProperties; + + private PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount( + String id, + Optional logo, + String title, + Map additionalProperties) { + this.id = id; + this.logo = logo; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The company's logo. + */ + @JsonIgnore + public Optional getLogo() { + if (logo == null) { + return Optional.empty(); + } + return logo; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo") + private Optional _getLogo() { + return logo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount + && equalTo((PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount other) { + return id.equals(other.id) && logo.equals(other.logo) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.logo, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + TitleStage id(@NotNull String id); + + Builder from(PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount other); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The company's logo.

+ */ + _FinalStage logo(Optional logo); + + _FinalStage logo(PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccountLogo logo); + + _FinalStage logo(Nullable logo); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + private Optional logo = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount other) { + id(other.getId()); + logo(other.getLogo()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

The company's logo.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logo(Nullable logo) { + if (logo.isNull()) { + this.logo = null; + } else if (logo.isEmpty()) { + this.logo = Optional.empty(); + } else { + this.logo = Optional.of(logo.get()); + } + return this; + } + + /** + *

The company's logo.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logo(PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccountLogo logo) { + this.logo = Optional.ofNullable(logo); + return this; + } + + /** + *

The company's logo.

+ */ + @java.lang.Override + @JsonSetter(value = "logo", nulls = Nulls.SKIP) + public _FinalStage logo(Optional logo) { + this.logo = logo; + return this; + } + + @java.lang.Override + public PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount build() { + return new PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccount( + id, logo, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccountLogo.java b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccountLogo.java new file mode 100644 index 00000000..de870849 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccountLogo.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccountLogo.Builder.class) +public final class PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccountLogo { + private final Optional url; + + private final Map additionalProperties; + + private PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccountLogo( + Optional url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccountLogo + && equalTo((PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccountLogo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccountLogo other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional url = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccountLogo other) { + url(other.getUrl()); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + public Builder url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + public PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccountLogo build() { + return new PaymentMethodPlatformBalancePaymentMethodPlatformBalanceAccountLogo(url, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem.java b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem.java new file mode 100644 index 00000000..e8ef76ba --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem.java @@ -0,0 +1,239 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem.Builder.class) +public final class PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem { + private final String amount; + + private final Currencies currency; + + private final int decimals; + + private final int displayDecimals; + + private final Map additionalProperties; + + private PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem( + String amount, + Currencies currency, + int decimals, + int displayDecimals, + Map additionalProperties) { + this.amount = amount; + this.currency = currency; + this.decimals = decimals; + this.displayDecimals = displayDecimals; + this.additionalProperties = additionalProperties; + } + + /** + * @return The amount in major units, as an exact decimal string — "10.00" is ten dollars. A string so no float rounds it in transit. + */ + @JsonProperty("amount") + public String getAmount() { + return amount; + } + + /** + * @return Three-letter ISO 4217 currency code, lowercase. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return How many decimal places the amount CARRIES — the precision the charge itself runs at. + */ + @JsonProperty("decimals") + public int getDecimals() { + return decimals; + } + + /** + * @return How many decimal places to SHOW. Usually equal to decimals, and deliberately not always: COP is charged in centavos but written in whole pesos, so it is 2 and 0. Format the number in your own locale using this. + */ + @JsonProperty("display_decimals") + public int getDisplayDecimals() { + return displayDecimals; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem + && equalTo((PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem other) { + return amount.equals(other.amount) + && currency.equals(other.currency) + && decimals == other.decimals + && displayDecimals == other.displayDecimals; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.currency, this.decimals, this.displayDecimals); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The amount in major units, as an exact decimal string — "10.00" is ten dollars. A string so no float rounds it in transit.

+ */ + CurrencyStage amount(@NotNull String amount); + + Builder from(PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem other); + } + + public interface CurrencyStage { + /** + *

Three-letter ISO 4217 currency code, lowercase.

+ */ + DecimalsStage currency(@NotNull Currencies currency); + } + + public interface DecimalsStage { + /** + *

How many decimal places the amount CARRIES — the precision the charge itself runs at.

+ */ + DisplayDecimalsStage decimals(int decimals); + } + + public interface DisplayDecimalsStage { + /** + *

How many decimal places to SHOW. Usually equal to decimals, and deliberately not always: COP is charged in centavos but written in whole pesos, so it is 2 and 0. Format the number in your own locale using this.

+ */ + _FinalStage displayDecimals(int displayDecimals); + } + + public interface _FinalStage { + PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, CurrencyStage, DecimalsStage, DisplayDecimalsStage, _FinalStage { + private String amount; + + private Currencies currency; + + private int decimals; + + private int displayDecimals; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem other) { + amount(other.getAmount()); + currency(other.getCurrency()); + decimals(other.getDecimals()); + displayDecimals(other.getDisplayDecimals()); + return this; + } + + /** + *

The amount in major units, as an exact decimal string — "10.00" is ten dollars. A string so no float rounds it in transit.

+ *

The amount in major units, as an exact decimal string — "10.00" is ten dollars. A string so no float rounds it in transit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CurrencyStage amount(@NotNull String amount) { + this.amount = Objects.requireNonNull(amount, "amount must not be null"); + return this; + } + + /** + *

Three-letter ISO 4217 currency code, lowercase.

+ *

Three-letter ISO 4217 currency code, lowercase.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DecimalsStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

How many decimal places the amount CARRIES — the precision the charge itself runs at.

+ *

How many decimal places the amount CARRIES — the precision the charge itself runs at.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("decimals") + public DisplayDecimalsStage decimals(int decimals) { + this.decimals = decimals; + return this; + } + + /** + *

How many decimal places to SHOW. Usually equal to decimals, and deliberately not always: COP is charged in centavos but written in whole pesos, so it is 2 and 0. Format the number in your own locale using this.

+ *

How many decimal places to SHOW. Usually equal to decimals, and deliberately not always: COP is charged in centavos but written in whole pesos, so it is 2 and 0. Format the number in your own locale using this.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("display_decimals") + public _FinalStage displayDecimals(int displayDecimals) { + this.displayDecimals = displayDecimals; + return this; + } + + @java.lang.Override + public PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem build() { + return new PaymentMethodPlatformBalancePaymentMethodPlatformBalanceBalancesItem( + amount, currency, decimals, displayDecimals, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethod.java b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethod.java new file mode 100644 index 00000000..d56d001d --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethod.java @@ -0,0 +1,275 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodSepaDebitPaymentMethod.Builder.class) +public final class PaymentMethodSepaDebitPaymentMethod { + private final OffsetDateTime createdAt; + + private final PaymentMethodSepaDebitPaymentMethodIcons icons; + + private final String id; + + private final PaymentMethodTypes paymentMethodType; + + private final PaymentMethodSepaDebitPaymentMethodSepaDebit sepaDebit; + + private final Map additionalProperties; + + private PaymentMethodSepaDebitPaymentMethod( + OffsetDateTime createdAt, + PaymentMethodSepaDebitPaymentMethodIcons icons, + String id, + PaymentMethodTypes paymentMethodType, + PaymentMethodSepaDebitPaymentMethodSepaDebit sepaDebit, + Map additionalProperties) { + this.createdAt = createdAt; + this.icons = icons; + this.id = id; + this.paymentMethodType = paymentMethodType; + this.sepaDebit = sepaDebit; + this.additionalProperties = additionalProperties; + } + + /** + * @return The time of the event in ISO 8601 UTC format with millisecond precision + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art. + */ + @JsonProperty("icons") + public PaymentMethodSepaDebitPaymentMethodIcons getIcons() { + return icons; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit). + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + /** + * @return The SEPA Direct Debit-specific details for this payment method, including bank code and last four IBAN digits. + */ + @JsonProperty("sepa_debit") + public PaymentMethodSepaDebitPaymentMethodSepaDebit getSepaDebit() { + return sepaDebit; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodSepaDebitPaymentMethod + && equalTo((PaymentMethodSepaDebitPaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodSepaDebitPaymentMethod other) { + return createdAt.equals(other.createdAt) + && icons.equals(other.icons) + && id.equals(other.id) + && paymentMethodType.equals(other.paymentMethodType) + && sepaDebit.equals(other.sepaDebit); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.icons, this.id, this.paymentMethodType, this.sepaDebit); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ */ + IconsStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PaymentMethodSepaDebitPaymentMethod other); + } + + public interface IconsStage { + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ */ + IdStage icons(@NotNull PaymentMethodSepaDebitPaymentMethodIcons icons); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ */ + SepaDebitStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface SepaDebitStage { + /** + *

The SEPA Direct Debit-specific details for this payment method, including bank code and last four IBAN digits.

+ */ + _FinalStage sepaDebit(@NotNull PaymentMethodSepaDebitPaymentMethodSepaDebit sepaDebit); + } + + public interface _FinalStage { + PaymentMethodSepaDebitPaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IconsStage, IdStage, PaymentMethodTypeStage, SepaDebitStage, _FinalStage { + private OffsetDateTime createdAt; + + private PaymentMethodSepaDebitPaymentMethodIcons icons; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + private PaymentMethodSepaDebitPaymentMethodSepaDebit sepaDebit; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodSepaDebitPaymentMethod other) { + createdAt(other.getCreatedAt()); + icons(other.getIcons()); + id(other.getId()); + paymentMethodType(other.getPaymentMethodType()); + sepaDebit(other.getSepaDebit()); + return this; + } + + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ *

The time of the event in ISO 8601 UTC format with millisecond precision

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IconsStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public IdStage icons(@NotNull PaymentMethodSepaDebitPaymentMethodIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public SepaDebitStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + /** + *

The SEPA Direct Debit-specific details for this payment method, including bank code and last four IBAN digits.

+ *

The SEPA Direct Debit-specific details for this payment method, including bank code and last four IBAN digits.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sepa_debit") + public _FinalStage sepaDebit(@NotNull PaymentMethodSepaDebitPaymentMethodSepaDebit sepaDebit) { + this.sepaDebit = Objects.requireNonNull(sepaDebit, "sepaDebit must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodSepaDebitPaymentMethod build() { + return new PaymentMethodSepaDebitPaymentMethod( + createdAt, icons, id, paymentMethodType, sepaDebit, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIcons.java b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIcons.java new file mode 100644 index 00000000..8cc7a466 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIcons.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodSepaDebitPaymentMethodIcons.Builder.class) +public final class PaymentMethodSepaDebitPaymentMethodIcons { + private final PaymentMethodSepaDebitPaymentMethodIconsCard card; + + private final PaymentMethodSepaDebitPaymentMethodIconsSquare square; + + private final Map additionalProperties; + + private PaymentMethodSepaDebitPaymentMethodIcons( + PaymentMethodSepaDebitPaymentMethodIconsCard card, + PaymentMethodSepaDebitPaymentMethodIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentMethodSepaDebitPaymentMethodIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentMethodSepaDebitPaymentMethodIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodSepaDebitPaymentMethodIcons + && equalTo((PaymentMethodSepaDebitPaymentMethodIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodSepaDebitPaymentMethodIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentMethodSepaDebitPaymentMethodIconsCard card); + + Builder from(PaymentMethodSepaDebitPaymentMethodIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentMethodSepaDebitPaymentMethodIconsSquare square); + } + + public interface _FinalStage { + PaymentMethodSepaDebitPaymentMethodIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentMethodSepaDebitPaymentMethodIconsCard card; + + private PaymentMethodSepaDebitPaymentMethodIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodSepaDebitPaymentMethodIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentMethodSepaDebitPaymentMethodIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentMethodSepaDebitPaymentMethodIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodSepaDebitPaymentMethodIcons build() { + return new PaymentMethodSepaDebitPaymentMethodIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsCard.java b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsCard.java new file mode 100644 index 00000000..15eae970 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsCard.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodSepaDebitPaymentMethodIconsCard.Builder.class) +public final class PaymentMethodSepaDebitPaymentMethodIconsCard { + private final PaymentMethodSepaDebitPaymentMethodIconsCardDark dark; + + private final PaymentMethodSepaDebitPaymentMethodIconsCardLight light; + + private final Map additionalProperties; + + private PaymentMethodSepaDebitPaymentMethodIconsCard( + PaymentMethodSepaDebitPaymentMethodIconsCardDark dark, + PaymentMethodSepaDebitPaymentMethodIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodSepaDebitPaymentMethodIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodSepaDebitPaymentMethodIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodSepaDebitPaymentMethodIconsCard + && equalTo((PaymentMethodSepaDebitPaymentMethodIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodSepaDebitPaymentMethodIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodSepaDebitPaymentMethodIconsCardDark dark); + + Builder from(PaymentMethodSepaDebitPaymentMethodIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodSepaDebitPaymentMethodIconsCardLight light); + } + + public interface _FinalStage { + PaymentMethodSepaDebitPaymentMethodIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodSepaDebitPaymentMethodIconsCardDark dark; + + private PaymentMethodSepaDebitPaymentMethodIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodSepaDebitPaymentMethodIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodSepaDebitPaymentMethodIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodSepaDebitPaymentMethodIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodSepaDebitPaymentMethodIconsCard build() { + return new PaymentMethodSepaDebitPaymentMethodIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsCardDark.java new file mode 100644 index 00000000..ba1195a1 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsCardDark.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodSepaDebitPaymentMethodIconsCardDark.Builder.class) +public final class PaymentMethodSepaDebitPaymentMethodIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodSepaDebitPaymentMethodIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodSepaDebitPaymentMethodIconsCardDark + && equalTo((PaymentMethodSepaDebitPaymentMethodIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodSepaDebitPaymentMethodIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodSepaDebitPaymentMethodIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodSepaDebitPaymentMethodIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodSepaDebitPaymentMethodIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodSepaDebitPaymentMethodIconsCardDark build() { + return new PaymentMethodSepaDebitPaymentMethodIconsCardDark(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsCardLight.java new file mode 100644 index 00000000..094a347e --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsCardLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodSepaDebitPaymentMethodIconsCardLight.Builder.class) +public final class PaymentMethodSepaDebitPaymentMethodIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodSepaDebitPaymentMethodIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodSepaDebitPaymentMethodIconsCardLight + && equalTo((PaymentMethodSepaDebitPaymentMethodIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodSepaDebitPaymentMethodIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodSepaDebitPaymentMethodIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodSepaDebitPaymentMethodIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodSepaDebitPaymentMethodIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodSepaDebitPaymentMethodIconsCardLight build() { + return new PaymentMethodSepaDebitPaymentMethodIconsCardLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsSquare.java b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsSquare.java new file mode 100644 index 00000000..e4c7632b --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodSepaDebitPaymentMethodIconsSquare.Builder.class) +public final class PaymentMethodSepaDebitPaymentMethodIconsSquare { + private final PaymentMethodSepaDebitPaymentMethodIconsSquareDark dark; + + private final PaymentMethodSepaDebitPaymentMethodIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentMethodSepaDebitPaymentMethodIconsSquare( + PaymentMethodSepaDebitPaymentMethodIconsSquareDark dark, + PaymentMethodSepaDebitPaymentMethodIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodSepaDebitPaymentMethodIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodSepaDebitPaymentMethodIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodSepaDebitPaymentMethodIconsSquare + && equalTo((PaymentMethodSepaDebitPaymentMethodIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodSepaDebitPaymentMethodIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodSepaDebitPaymentMethodIconsSquareDark dark); + + Builder from(PaymentMethodSepaDebitPaymentMethodIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodSepaDebitPaymentMethodIconsSquareLight light); + } + + public interface _FinalStage { + PaymentMethodSepaDebitPaymentMethodIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodSepaDebitPaymentMethodIconsSquareDark dark; + + private PaymentMethodSepaDebitPaymentMethodIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodSepaDebitPaymentMethodIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodSepaDebitPaymentMethodIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodSepaDebitPaymentMethodIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodSepaDebitPaymentMethodIconsSquare build() { + return new PaymentMethodSepaDebitPaymentMethodIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsSquareDark.java new file mode 100644 index 00000000..7579160a --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsSquareDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodSepaDebitPaymentMethodIconsSquareDark.Builder.class) +public final class PaymentMethodSepaDebitPaymentMethodIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodSepaDebitPaymentMethodIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodSepaDebitPaymentMethodIconsSquareDark + && equalTo((PaymentMethodSepaDebitPaymentMethodIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodSepaDebitPaymentMethodIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodSepaDebitPaymentMethodIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodSepaDebitPaymentMethodIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodSepaDebitPaymentMethodIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodSepaDebitPaymentMethodIconsSquareDark build() { + return new PaymentMethodSepaDebitPaymentMethodIconsSquareDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsSquareLight.java new file mode 100644 index 00000000..b38dfdf8 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodIconsSquareLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodSepaDebitPaymentMethodIconsSquareLight.Builder.class) +public final class PaymentMethodSepaDebitPaymentMethodIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodSepaDebitPaymentMethodIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodSepaDebitPaymentMethodIconsSquareLight + && equalTo((PaymentMethodSepaDebitPaymentMethodIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodSepaDebitPaymentMethodIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodSepaDebitPaymentMethodIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodSepaDebitPaymentMethodIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodSepaDebitPaymentMethodIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodSepaDebitPaymentMethodIconsSquareLight build() { + return new PaymentMethodSepaDebitPaymentMethodIconsSquareLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodSepaDebit.java b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodSepaDebit.java new file mode 100644 index 00000000..4d540839 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodSepaDebitPaymentMethodSepaDebit.java @@ -0,0 +1,288 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodSepaDebitPaymentMethodSepaDebit.Builder.class) +public final class PaymentMethodSepaDebitPaymentMethodSepaDebit { + private final Optional bankCode; + + private final Optional branchCode; + + private final Optional country; + + private final Optional last4; + + private final Map additionalProperties; + + private PaymentMethodSepaDebitPaymentMethodSepaDebit( + Optional bankCode, + Optional branchCode, + Optional country, + Optional last4, + Map additionalProperties) { + this.bankCode = bankCode; + this.branchCode = branchCode; + this.country = country; + this.last4 = last4; + this.additionalProperties = additionalProperties; + } + + /** + * @return The bank code of the financial institution associated with this SEPA account. Null if not available. + */ + @JsonIgnore + public Optional getBankCode() { + if (bankCode == null) { + return Optional.empty(); + } + return bankCode; + } + + /** + * @return The branch code of the financial institution associated with this SEPA account. Null if not available. + */ + @JsonIgnore + public Optional getBranchCode() { + if (branchCode == null) { + return Optional.empty(); + } + return branchCode; + } + + /** + * @return The two-letter ISO country code where the bank account is located. Null if not available. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The last four digits of the IBAN associated with this SEPA account. Null if not available. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bank_code") + private Optional _getBankCode() { + return bankCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("branch_code") + private Optional _getBranchCode() { + return branchCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodSepaDebitPaymentMethodSepaDebit + && equalTo((PaymentMethodSepaDebitPaymentMethodSepaDebit) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodSepaDebitPaymentMethodSepaDebit other) { + return bankCode.equals(other.bankCode) + && branchCode.equals(other.branchCode) + && country.equals(other.country) + && last4.equals(other.last4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.bankCode, this.branchCode, this.country, this.last4); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional bankCode = Optional.empty(); + + private Optional branchCode = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional last4 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentMethodSepaDebitPaymentMethodSepaDebit other) { + bankCode(other.getBankCode()); + branchCode(other.getBranchCode()); + country(other.getCountry()); + last4(other.getLast4()); + return this; + } + + /** + *

The bank code of the financial institution associated with this SEPA account. Null if not available.

+ */ + @JsonSetter(value = "bank_code", nulls = Nulls.SKIP) + public Builder bankCode(Optional bankCode) { + this.bankCode = bankCode; + return this; + } + + public Builder bankCode(String bankCode) { + this.bankCode = Optional.ofNullable(bankCode); + return this; + } + + public Builder bankCode(Nullable bankCode) { + if (bankCode.isNull()) { + this.bankCode = null; + } else if (bankCode.isEmpty()) { + this.bankCode = Optional.empty(); + } else { + this.bankCode = Optional.of(bankCode.get()); + } + return this; + } + + /** + *

The branch code of the financial institution associated with this SEPA account. Null if not available.

+ */ + @JsonSetter(value = "branch_code", nulls = Nulls.SKIP) + public Builder branchCode(Optional branchCode) { + this.branchCode = branchCode; + return this; + } + + public Builder branchCode(String branchCode) { + this.branchCode = Optional.ofNullable(branchCode); + return this; + } + + public Builder branchCode(Nullable branchCode) { + if (branchCode.isNull()) { + this.branchCode = null; + } else if (branchCode.isEmpty()) { + this.branchCode = Optional.empty(); + } else { + this.branchCode = Optional.of(branchCode.get()); + } + return this; + } + + /** + *

The two-letter ISO country code where the bank account is located. Null if not available.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The last four digits of the IBAN associated with this SEPA account. Null if not available.

+ */ + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public Builder last4(Optional last4) { + this.last4 = last4; + return this; + } + + public Builder last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + public Builder last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + public PaymentMethodSepaDebitPaymentMethodSepaDebit build() { + return new PaymentMethodSepaDebitPaymentMethodSepaDebit( + bankCode, branchCode, country, last4, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodTypes.java b/src/main/java/com/whop/api/types/PaymentMethodTypes.java new file mode 100644 index 00000000..bd53bf01 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodTypes.java @@ -0,0 +1,1250 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PaymentMethodTypes { + public static final PaymentMethodTypes PIX = new PaymentMethodTypes(Value.PIX, "pix"); + + public static final PaymentMethodTypes SOFORT = new PaymentMethodTypes(Value.SOFORT, "sofort"); + + public static final PaymentMethodTypes US_BANK_ACCOUNT = + new PaymentMethodTypes(Value.US_BANK_ACCOUNT, "us_bank_account"); + + public static final PaymentMethodTypes SPEI = new PaymentMethodTypes(Value.SPEI, "spei"); + + public static final PaymentMethodTypes SOUTH_KOREA_MARKET = + new PaymentMethodTypes(Value.SOUTH_KOREA_MARKET, "south_korea_market"); + + public static final PaymentMethodTypes CASHAPP = new PaymentMethodTypes(Value.CASHAPP, "cashapp"); + + public static final PaymentMethodTypes GRABPAY = new PaymentMethodTypes(Value.GRABPAY, "grabpay"); + + public static final PaymentMethodTypes SERVIPAG = new PaymentMethodTypes(Value.SERVIPAG, "servipag"); + + public static final PaymentMethodTypes EPS = new PaymentMethodTypes(Value.EPS, "eps"); + + public static final PaymentMethodTypes NZ_BANK_ACCOUNT = + new PaymentMethodTypes(Value.NZ_BANK_ACCOUNT, "nz_bank_account"); + + public static final PaymentMethodTypes SEQURA = new PaymentMethodTypes(Value.SEQURA, "sequra"); + + public static final PaymentMethodTypes IDEAL = new PaymentMethodTypes(Value.IDEAL, "ideal"); + + public static final PaymentMethodTypes KR_MARKET = new PaymentMethodTypes(Value.KR_MARKET, "kr_market"); + + public static final PaymentMethodTypes RAPIPAGO = new PaymentMethodTypes(Value.RAPIPAGO, "rapipago"); + + public static final PaymentMethodTypes ZIP = new PaymentMethodTypes(Value.ZIP, "zip"); + + public static final PaymentMethodTypes NG_USSD = new PaymentMethodTypes(Value.NG_USSD, "ng_ussd"); + + public static final PaymentMethodTypes CARD_INSTALLMENTS_THREE = + new PaymentMethodTypes(Value.CARD_INSTALLMENTS_THREE, "card_installments_three"); + + public static final PaymentMethodTypes WECHAT_PAY = new PaymentMethodTypes(Value.WECHAT_PAY, "wechat_pay"); + + public static final PaymentMethodTypes SENCILLITO = new PaymentMethodTypes(Value.SENCILLITO, "sencillito"); + + public static final PaymentMethodTypes BANCOLOMBIA = new PaymentMethodTypes(Value.BANCOLOMBIA, "bancolombia"); + + public static final PaymentMethodTypes GB_BANK_TRANSFER = + new PaymentMethodTypes(Value.GB_BANK_TRANSFER, "gb_bank_transfer"); + + public static final PaymentMethodTypes CUSTOM = new PaymentMethodTypes(Value.CUSTOM, "custom"); + + public static final PaymentMethodTypes PAYPAL = new PaymentMethodTypes(Value.PAYPAL, "paypal"); + + public static final PaymentMethodTypes ALIPAY = new PaymentMethodTypes(Value.ALIPAY, "alipay"); + + public static final PaymentMethodTypes COINBASE = new PaymentMethodTypes(Value.COINBASE, "coinbase"); + + public static final PaymentMethodTypes APPLE_PAY = new PaymentMethodTypes(Value.APPLE_PAY, "apple_pay"); + + public static final PaymentMethodTypes CAPCHASE_PAY = new PaymentMethodTypes(Value.CAPCHASE_PAY, "capchase_pay"); + + public static final PaymentMethodTypes KAKAO_PAY = new PaymentMethodTypes(Value.KAKAO_PAY, "kakao_pay"); + + public static final PaymentMethodTypes SEPA_DEBIT = new PaymentMethodTypes(Value.SEPA_DEBIT, "sepa_debit"); + + public static final PaymentMethodTypes EFECTY = new PaymentMethodTypes(Value.EFECTY, "efecty"); + + public static final PaymentMethodTypes AMAZON_PAY = new PaymentMethodTypes(Value.AMAZON_PAY, "amazon_pay"); + + public static final PaymentMethodTypes YAPE = new PaymentMethodTypes(Value.YAPE, "yape"); + + public static final PaymentMethodTypes GIROPAY = new PaymentMethodTypes(Value.GIROPAY, "giropay"); + + public static final PaymentMethodTypes TAMARA = new PaymentMethodTypes(Value.TAMARA, "tamara"); + + public static final PaymentMethodTypes PAYCO = new PaymentMethodTypes(Value.PAYCO, "payco"); + + public static final PaymentMethodTypes NG_BANK = new PaymentMethodTypes(Value.NG_BANK, "ng_bank"); + + public static final PaymentMethodTypes NG_MARKET = new PaymentMethodTypes(Value.NG_MARKET, "ng_market"); + + public static final PaymentMethodTypes BACS_DEBIT = new PaymentMethodTypes(Value.BACS_DEBIT, "bacs_debit"); + + public static final PaymentMethodTypes AU_BANK_TRANSFER = + new PaymentMethodTypes(Value.AU_BANK_TRANSFER, "au_bank_transfer"); + + public static final PaymentMethodTypes CARD_INSTALLMENTS_SIX = + new PaymentMethodTypes(Value.CARD_INSTALLMENTS_SIX, "card_installments_six"); + + public static final PaymentMethodTypes SWISH = new PaymentMethodTypes(Value.SWISH, "swish"); + + public static final PaymentMethodTypes NG_CARD = new PaymentMethodTypes(Value.NG_CARD, "ng_card"); + + public static final PaymentMethodTypes CUSTOMER_BALANCE = + new PaymentMethodTypes(Value.CUSTOMER_BALANCE, "customer_balance"); + + public static final PaymentMethodTypes VENMO = new PaymentMethodTypes(Value.VENMO, "venmo"); + + public static final PaymentMethodTypes QRIS = new PaymentMethodTypes(Value.QRIS, "qris"); + + public static final PaymentMethodTypes SPLITIT = new PaymentMethodTypes(Value.SPLITIT, "splitit"); + + public static final PaymentMethodTypes SEZZLE = new PaymentMethodTypes(Value.SEZZLE, "sezzle"); + + public static final PaymentMethodTypes KONBINI = new PaymentMethodTypes(Value.KONBINI, "konbini"); + + public static final PaymentMethodTypes AFTERPAY_CLEARPAY = + new PaymentMethodTypes(Value.AFTERPAY_CLEARPAY, "afterpay_clearpay"); + + public static final PaymentMethodTypes PAGO_EFECTIVO = new PaymentMethodTypes(Value.PAGO_EFECTIVO, "pago_efectivo"); + + public static final PaymentMethodTypes UNKNOWN = new PaymentMethodTypes(Value.UNKNOWN, "unknown"); + + public static final PaymentMethodTypes SUNBIT = new PaymentMethodTypes(Value.SUNBIT, "sunbit"); + + public static final PaymentMethodTypes AFFIRM = new PaymentMethodTypes(Value.AFFIRM, "affirm"); + + public static final PaymentMethodTypes CA_BANK_TRANSFER = + new PaymentMethodTypes(Value.CA_BANK_TRANSFER, "ca_bank_transfer"); + + public static final PaymentMethodTypes MODO = new PaymentMethodTypes(Value.MODO, "modo"); + + public static final PaymentMethodTypes NG_BANK_TRANSFER = + new PaymentMethodTypes(Value.NG_BANK_TRANSFER, "ng_bank_transfer"); + + public static final PaymentMethodTypes P24 = new PaymentMethodTypes(Value.P24, "p24"); + + public static final PaymentMethodTypes MULTIBANCO = new PaymentMethodTypes(Value.MULTIBANCO, "multibanco"); + + public static final PaymentMethodTypes PAYPAY = new PaymentMethodTypes(Value.PAYPAY, "paypay"); + + public static final PaymentMethodTypes CRYPTO = new PaymentMethodTypes(Value.CRYPTO, "crypto"); + + public static final PaymentMethodTypes TWINT = new PaymentMethodTypes(Value.TWINT, "twint"); + + public static final PaymentMethodTypes CLARITYPAY = new PaymentMethodTypes(Value.CLARITYPAY, "claritypay"); + + public static final PaymentMethodTypes ID_BANK_TRANSFER = + new PaymentMethodTypes(Value.ID_BANK_TRANSFER, "id_bank_transfer"); + + public static final PaymentMethodTypes SHOP_PAY = new PaymentMethodTypes(Value.SHOP_PAY, "shop_pay"); + + public static final PaymentMethodTypes US_BANK_TRANSFER = + new PaymentMethodTypes(Value.US_BANK_TRANSFER, "us_bank_transfer"); + + public static final PaymentMethodTypes NAVER_PAY = new PaymentMethodTypes(Value.NAVER_PAY, "naver_pay"); + + public static final PaymentMethodTypes AU_BECS_DEBIT = new PaymentMethodTypes(Value.AU_BECS_DEBIT, "au_becs_debit"); + + public static final PaymentMethodTypes MERCADO_PAGO = new PaymentMethodTypes(Value.MERCADO_PAGO, "mercado_pago"); + + public static final PaymentMethodTypes OXXO = new PaymentMethodTypes(Value.OXXO, "oxxo"); + + public static final PaymentMethodTypes REVOLUT_PAY = new PaymentMethodTypes(Value.REVOLUT_PAY, "revolut_pay"); + + public static final PaymentMethodTypes SCALAPAY = new PaymentMethodTypes(Value.SCALAPAY, "scalapay"); + + public static final PaymentMethodTypes BANCONTACT = new PaymentMethodTypes(Value.BANCONTACT, "bancontact"); + + public static final PaymentMethodTypes GOPAY = new PaymentMethodTypes(Value.GOPAY, "gopay"); + + public static final PaymentMethodTypes SHOPEEPAY = new PaymentMethodTypes(Value.SHOPEEPAY, "shopeepay"); + + public static final PaymentMethodTypes KUESKI = new PaymentMethodTypes(Value.KUESKI, "kueski"); + + public static final PaymentMethodTypes PLATFORM_BALANCE = + new PaymentMethodTypes(Value.PLATFORM_BALANCE, "platform_balance"); + + public static final PaymentMethodTypes BANK_WIRE = new PaymentMethodTypes(Value.BANK_WIRE, "bank_wire"); + + public static final PaymentMethodTypes BLIK = new PaymentMethodTypes(Value.BLIK, "blik"); + + public static final PaymentMethodTypes MONDU = new PaymentMethodTypes(Value.MONDU, "mondu"); + + public static final PaymentMethodTypes COINFLOW = new PaymentMethodTypes(Value.COINFLOW, "coinflow"); + + public static final PaymentMethodTypes UPI = new PaymentMethodTypes(Value.UPI, "upi"); + + public static final PaymentMethodTypes CARD = new PaymentMethodTypes(Value.CARD, "card"); + + public static final PaymentMethodTypes NG_WALLET = new PaymentMethodTypes(Value.NG_WALLET, "ng_wallet"); + + public static final PaymentMethodTypes CARD_INSTALLMENTS_TWELVE = + new PaymentMethodTypes(Value.CARD_INSTALLMENTS_TWELVE, "card_installments_twelve"); + + public static final PaymentMethodTypes PSE = new PaymentMethodTypes(Value.PSE, "pse"); + + public static final PaymentMethodTypes PAYTO = new PaymentMethodTypes(Value.PAYTO, "payto"); + + public static final PaymentMethodTypes ALMA = new PaymentMethodTypes(Value.ALMA, "alma"); + + public static final PaymentMethodTypes BIZUM = new PaymentMethodTypes(Value.BIZUM, "bizum"); + + public static final PaymentMethodTypes RECHNUNG = new PaymentMethodTypes(Value.RECHNUNG, "rechnung"); + + public static final PaymentMethodTypes NETBANKING = new PaymentMethodTypes(Value.NETBANKING, "netbanking"); + + public static final PaymentMethodTypes MOBILEPAY = new PaymentMethodTypes(Value.MOBILEPAY, "mobilepay"); + + public static final PaymentMethodTypes M_PESA = new PaymentMethodTypes(Value.M_PESA, "m_pesa"); + + public static final PaymentMethodTypes VIPPS = new PaymentMethodTypes(Value.VIPPS, "vipps"); + + public static final PaymentMethodTypes WEBPAY = new PaymentMethodTypes(Value.WEBPAY, "webpay"); + + public static final PaymentMethodTypes BOLETO = new PaymentMethodTypes(Value.BOLETO, "boleto"); + + public static final PaymentMethodTypes MB_WAY = new PaymentMethodTypes(Value.MB_WAY, "mb_way"); + + public static final PaymentMethodTypes BILLIE = new PaymentMethodTypes(Value.BILLIE, "billie"); + + public static final PaymentMethodTypes KRIYA = new PaymentMethodTypes(Value.KRIYA, "kriya"); + + public static final PaymentMethodTypes SAMSUNG_PAY = new PaymentMethodTypes(Value.SAMSUNG_PAY, "samsung_pay"); + + public static final PaymentMethodTypes ADDI = new PaymentMethodTypes(Value.ADDI, "addi"); + + public static final PaymentMethodTypes ACSS_DEBIT = new PaymentMethodTypes(Value.ACSS_DEBIT, "acss_debit"); + + public static final PaymentMethodTypes PAYNOW = new PaymentMethodTypes(Value.PAYNOW, "paynow"); + + public static final PaymentMethodTypes KR_CARD = new PaymentMethodTypes(Value.KR_CARD, "kr_card"); + + public static final PaymentMethodTypes APPLE = new PaymentMethodTypes(Value.APPLE, "apple"); + + public static final PaymentMethodTypes KLARNA_PAY_NOW = + new PaymentMethodTypes(Value.KLARNA_PAY_NOW, "klarna_pay_now"); + + public static final PaymentMethodTypes INTERAC = new PaymentMethodTypes(Value.INTERAC, "interac"); + + public static final PaymentMethodTypes BRE_B = new PaymentMethodTypes(Value.BRE_B, "bre_b"); + + public static final PaymentMethodTypes PAY_BY_BANK = new PaymentMethodTypes(Value.PAY_BY_BANK, "pay_by_bank"); + + public static final PaymentMethodTypes DEMO_PAY = new PaymentMethodTypes(Value.DEMO_PAY, "demo_pay"); + + public static final PaymentMethodTypes NEQUI = new PaymentMethodTypes(Value.NEQUI, "nequi"); + + public static final PaymentMethodTypes SATISPAY = new PaymentMethodTypes(Value.SATISPAY, "satispay"); + + public static final PaymentMethodTypes GOOGLE_PAY = new PaymentMethodTypes(Value.GOOGLE_PAY, "google_pay"); + + public static final PaymentMethodTypes PROMPTPAY = new PaymentMethodTypes(Value.PROMPTPAY, "promptpay"); + + public static final PaymentMethodTypes FPX = new PaymentMethodTypes(Value.FPX, "fpx"); + + public static final PaymentMethodTypes KLARNA = new PaymentMethodTypes(Value.KLARNA, "klarna"); + + public static final PaymentMethodTypes LINK = new PaymentMethodTypes(Value.LINK, "link"); + + public static final PaymentMethodTypes EU_BANK_TRANSFER = + new PaymentMethodTypes(Value.EU_BANK_TRANSFER, "eu_bank_transfer"); + + private final Value value; + + private final String string; + + PaymentMethodTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PaymentMethodTypes && this.string.equals(((PaymentMethodTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PIX: + return visitor.visitPix(); + case SOFORT: + return visitor.visitSofort(); + case US_BANK_ACCOUNT: + return visitor.visitUsBankAccount(); + case SPEI: + return visitor.visitSpei(); + case SOUTH_KOREA_MARKET: + return visitor.visitSouthKoreaMarket(); + case CASHAPP: + return visitor.visitCashapp(); + case GRABPAY: + return visitor.visitGrabpay(); + case SERVIPAG: + return visitor.visitServipag(); + case EPS: + return visitor.visitEps(); + case NZ_BANK_ACCOUNT: + return visitor.visitNzBankAccount(); + case SEQURA: + return visitor.visitSequra(); + case IDEAL: + return visitor.visitIdeal(); + case KR_MARKET: + return visitor.visitKrMarket(); + case RAPIPAGO: + return visitor.visitRapipago(); + case ZIP: + return visitor.visitZip(); + case NG_USSD: + return visitor.visitNgUssd(); + case CARD_INSTALLMENTS_THREE: + return visitor.visitCardInstallmentsThree(); + case WECHAT_PAY: + return visitor.visitWechatPay(); + case SENCILLITO: + return visitor.visitSencillito(); + case BANCOLOMBIA: + return visitor.visitBancolombia(); + case GB_BANK_TRANSFER: + return visitor.visitGbBankTransfer(); + case CUSTOM: + return visitor.visitCustom(); + case PAYPAL: + return visitor.visitPaypal(); + case ALIPAY: + return visitor.visitAlipay(); + case COINBASE: + return visitor.visitCoinbase(); + case APPLE_PAY: + return visitor.visitApplePay(); + case CAPCHASE_PAY: + return visitor.visitCapchasePay(); + case KAKAO_PAY: + return visitor.visitKakaoPay(); + case SEPA_DEBIT: + return visitor.visitSepaDebit(); + case EFECTY: + return visitor.visitEfecty(); + case AMAZON_PAY: + return visitor.visitAmazonPay(); + case YAPE: + return visitor.visitYape(); + case GIROPAY: + return visitor.visitGiropay(); + case TAMARA: + return visitor.visitTamara(); + case PAYCO: + return visitor.visitPayco(); + case NG_BANK: + return visitor.visitNgBank(); + case NG_MARKET: + return visitor.visitNgMarket(); + case BACS_DEBIT: + return visitor.visitBacsDebit(); + case AU_BANK_TRANSFER: + return visitor.visitAuBankTransfer(); + case CARD_INSTALLMENTS_SIX: + return visitor.visitCardInstallmentsSix(); + case SWISH: + return visitor.visitSwish(); + case NG_CARD: + return visitor.visitNgCard(); + case CUSTOMER_BALANCE: + return visitor.visitCustomerBalance(); + case VENMO: + return visitor.visitVenmo(); + case QRIS: + return visitor.visitQris(); + case SPLITIT: + return visitor.visitSplitit(); + case SEZZLE: + return visitor.visitSezzle(); + case KONBINI: + return visitor.visitKonbini(); + case AFTERPAY_CLEARPAY: + return visitor.visitAfterpayClearpay(); + case PAGO_EFECTIVO: + return visitor.visitPagoEfectivo(); + case UNKNOWN: + return visitor.visitUnknown(); + case SUNBIT: + return visitor.visitSunbit(); + case AFFIRM: + return visitor.visitAffirm(); + case CA_BANK_TRANSFER: + return visitor.visitCaBankTransfer(); + case MODO: + return visitor.visitModo(); + case NG_BANK_TRANSFER: + return visitor.visitNgBankTransfer(); + case P24: + return visitor.visitP24(); + case MULTIBANCO: + return visitor.visitMultibanco(); + case PAYPAY: + return visitor.visitPaypay(); + case CRYPTO: + return visitor.visitCrypto(); + case TWINT: + return visitor.visitTwint(); + case CLARITYPAY: + return visitor.visitClaritypay(); + case ID_BANK_TRANSFER: + return visitor.visitIdBankTransfer(); + case SHOP_PAY: + return visitor.visitShopPay(); + case US_BANK_TRANSFER: + return visitor.visitUsBankTransfer(); + case NAVER_PAY: + return visitor.visitNaverPay(); + case AU_BECS_DEBIT: + return visitor.visitAuBecsDebit(); + case MERCADO_PAGO: + return visitor.visitMercadoPago(); + case OXXO: + return visitor.visitOxxo(); + case REVOLUT_PAY: + return visitor.visitRevolutPay(); + case SCALAPAY: + return visitor.visitScalapay(); + case BANCONTACT: + return visitor.visitBancontact(); + case GOPAY: + return visitor.visitGopay(); + case SHOPEEPAY: + return visitor.visitShopeepay(); + case KUESKI: + return visitor.visitKueski(); + case PLATFORM_BALANCE: + return visitor.visitPlatformBalance(); + case BANK_WIRE: + return visitor.visitBankWire(); + case BLIK: + return visitor.visitBlik(); + case MONDU: + return visitor.visitMondu(); + case COINFLOW: + return visitor.visitCoinflow(); + case UPI: + return visitor.visitUpi(); + case CARD: + return visitor.visitCard(); + case NG_WALLET: + return visitor.visitNgWallet(); + case CARD_INSTALLMENTS_TWELVE: + return visitor.visitCardInstallmentsTwelve(); + case PSE: + return visitor.visitPse(); + case PAYTO: + return visitor.visitPayto(); + case ALMA: + return visitor.visitAlma(); + case BIZUM: + return visitor.visitBizum(); + case RECHNUNG: + return visitor.visitRechnung(); + case NETBANKING: + return visitor.visitNetbanking(); + case MOBILEPAY: + return visitor.visitMobilepay(); + case M_PESA: + return visitor.visitMPesa(); + case VIPPS: + return visitor.visitVipps(); + case WEBPAY: + return visitor.visitWebpay(); + case BOLETO: + return visitor.visitBoleto(); + case MB_WAY: + return visitor.visitMbWay(); + case BILLIE: + return visitor.visitBillie(); + case KRIYA: + return visitor.visitKriya(); + case SAMSUNG_PAY: + return visitor.visitSamsungPay(); + case ADDI: + return visitor.visitAddi(); + case ACSS_DEBIT: + return visitor.visitAcssDebit(); + case PAYNOW: + return visitor.visitPaynow(); + case KR_CARD: + return visitor.visitKrCard(); + case APPLE: + return visitor.visitApple(); + case KLARNA_PAY_NOW: + return visitor.visitKlarnaPayNow(); + case INTERAC: + return visitor.visitInterac(); + case BRE_B: + return visitor.visitBreB(); + case PAY_BY_BANK: + return visitor.visitPayByBank(); + case DEMO_PAY: + return visitor.visitDemoPay(); + case NEQUI: + return visitor.visitNequi(); + case SATISPAY: + return visitor.visitSatispay(); + case GOOGLE_PAY: + return visitor.visitGooglePay(); + case PROMPTPAY: + return visitor.visitPromptpay(); + case FPX: + return visitor.visitFpx(); + case KLARNA: + return visitor.visitKlarna(); + case LINK: + return visitor.visitLink(); + case EU_BANK_TRANSFER: + return visitor.visitEuBankTransfer(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PaymentMethodTypes valueOf(String value) { + switch (value) { + case "pix": + return PIX; + case "sofort": + return SOFORT; + case "us_bank_account": + return US_BANK_ACCOUNT; + case "spei": + return SPEI; + case "south_korea_market": + return SOUTH_KOREA_MARKET; + case "cashapp": + return CASHAPP; + case "grabpay": + return GRABPAY; + case "servipag": + return SERVIPAG; + case "eps": + return EPS; + case "nz_bank_account": + return NZ_BANK_ACCOUNT; + case "sequra": + return SEQURA; + case "ideal": + return IDEAL; + case "kr_market": + return KR_MARKET; + case "rapipago": + return RAPIPAGO; + case "zip": + return ZIP; + case "ng_ussd": + return NG_USSD; + case "card_installments_three": + return CARD_INSTALLMENTS_THREE; + case "wechat_pay": + return WECHAT_PAY; + case "sencillito": + return SENCILLITO; + case "bancolombia": + return BANCOLOMBIA; + case "gb_bank_transfer": + return GB_BANK_TRANSFER; + case "custom": + return CUSTOM; + case "paypal": + return PAYPAL; + case "alipay": + return ALIPAY; + case "coinbase": + return COINBASE; + case "apple_pay": + return APPLE_PAY; + case "capchase_pay": + return CAPCHASE_PAY; + case "kakao_pay": + return KAKAO_PAY; + case "sepa_debit": + return SEPA_DEBIT; + case "efecty": + return EFECTY; + case "amazon_pay": + return AMAZON_PAY; + case "yape": + return YAPE; + case "giropay": + return GIROPAY; + case "tamara": + return TAMARA; + case "payco": + return PAYCO; + case "ng_bank": + return NG_BANK; + case "ng_market": + return NG_MARKET; + case "bacs_debit": + return BACS_DEBIT; + case "au_bank_transfer": + return AU_BANK_TRANSFER; + case "card_installments_six": + return CARD_INSTALLMENTS_SIX; + case "swish": + return SWISH; + case "ng_card": + return NG_CARD; + case "customer_balance": + return CUSTOMER_BALANCE; + case "venmo": + return VENMO; + case "qris": + return QRIS; + case "splitit": + return SPLITIT; + case "sezzle": + return SEZZLE; + case "konbini": + return KONBINI; + case "afterpay_clearpay": + return AFTERPAY_CLEARPAY; + case "pago_efectivo": + return PAGO_EFECTIVO; + case "unknown": + return UNKNOWN; + case "sunbit": + return SUNBIT; + case "affirm": + return AFFIRM; + case "ca_bank_transfer": + return CA_BANK_TRANSFER; + case "modo": + return MODO; + case "ng_bank_transfer": + return NG_BANK_TRANSFER; + case "p24": + return P24; + case "multibanco": + return MULTIBANCO; + case "paypay": + return PAYPAY; + case "crypto": + return CRYPTO; + case "twint": + return TWINT; + case "claritypay": + return CLARITYPAY; + case "id_bank_transfer": + return ID_BANK_TRANSFER; + case "shop_pay": + return SHOP_PAY; + case "us_bank_transfer": + return US_BANK_TRANSFER; + case "naver_pay": + return NAVER_PAY; + case "au_becs_debit": + return AU_BECS_DEBIT; + case "mercado_pago": + return MERCADO_PAGO; + case "oxxo": + return OXXO; + case "revolut_pay": + return REVOLUT_PAY; + case "scalapay": + return SCALAPAY; + case "bancontact": + return BANCONTACT; + case "gopay": + return GOPAY; + case "shopeepay": + return SHOPEEPAY; + case "kueski": + return KUESKI; + case "platform_balance": + return PLATFORM_BALANCE; + case "bank_wire": + return BANK_WIRE; + case "blik": + return BLIK; + case "mondu": + return MONDU; + case "coinflow": + return COINFLOW; + case "upi": + return UPI; + case "card": + return CARD; + case "ng_wallet": + return NG_WALLET; + case "card_installments_twelve": + return CARD_INSTALLMENTS_TWELVE; + case "pse": + return PSE; + case "payto": + return PAYTO; + case "alma": + return ALMA; + case "bizum": + return BIZUM; + case "rechnung": + return RECHNUNG; + case "netbanking": + return NETBANKING; + case "mobilepay": + return MOBILEPAY; + case "m_pesa": + return M_PESA; + case "vipps": + return VIPPS; + case "webpay": + return WEBPAY; + case "boleto": + return BOLETO; + case "mb_way": + return MB_WAY; + case "billie": + return BILLIE; + case "kriya": + return KRIYA; + case "samsung_pay": + return SAMSUNG_PAY; + case "addi": + return ADDI; + case "acss_debit": + return ACSS_DEBIT; + case "paynow": + return PAYNOW; + case "kr_card": + return KR_CARD; + case "apple": + return APPLE; + case "klarna_pay_now": + return KLARNA_PAY_NOW; + case "interac": + return INTERAC; + case "bre_b": + return BRE_B; + case "pay_by_bank": + return PAY_BY_BANK; + case "demo_pay": + return DEMO_PAY; + case "nequi": + return NEQUI; + case "satispay": + return SATISPAY; + case "google_pay": + return GOOGLE_PAY; + case "promptpay": + return PROMPTPAY; + case "fpx": + return FPX; + case "klarna": + return KLARNA; + case "link": + return LINK; + case "eu_bank_transfer": + return EU_BANK_TRANSFER; + default: + return new PaymentMethodTypes(Value._UNKNOWN, value); + } + } + + public enum Value { + ACSS_DEBIT, + + ADDI, + + AFFIRM, + + AFTERPAY_CLEARPAY, + + ALIPAY, + + ALMA, + + AMAZON_PAY, + + APPLE, + + APPLE_PAY, + + AU_BANK_TRANSFER, + + AU_BECS_DEBIT, + + BACS_DEBIT, + + BANCOLOMBIA, + + BANCONTACT, + + BANK_WIRE, + + BILLIE, + + BIZUM, + + BLIK, + + BOLETO, + + BRE_B, + + CA_BANK_TRANSFER, + + CAPCHASE_PAY, + + CARD, + + CARD_INSTALLMENTS_THREE, + + CARD_INSTALLMENTS_SIX, + + CARD_INSTALLMENTS_TWELVE, + + CASHAPP, + + CLARITYPAY, + + COINBASE, + + CRYPTO, + + CUSTOM, + + CUSTOMER_BALANCE, + + DEMO_PAY, + + EFECTY, + + EPS, + + EU_BANK_TRANSFER, + + FPX, + + GB_BANK_TRANSFER, + + GIROPAY, + + GOOGLE_PAY, + + GOPAY, + + GRABPAY, + + ID_BANK_TRANSFER, + + IDEAL, + + INTERAC, + + KAKAO_PAY, + + KLARNA, + + KLARNA_PAY_NOW, + + KONBINI, + + KR_CARD, + + KR_MARKET, + + KRIYA, + + KUESKI, + + LINK, + + MB_WAY, + + M_PESA, + + MERCADO_PAGO, + + MOBILEPAY, + + MODO, + + MONDU, + + MULTIBANCO, + + NAVER_PAY, + + NEQUI, + + NETBANKING, + + NG_BANK, + + NG_BANK_TRANSFER, + + NG_CARD, + + NG_MARKET, + + NG_USSD, + + NG_WALLET, + + NZ_BANK_ACCOUNT, + + OXXO, + + P24, + + PAGO_EFECTIVO, + + PSE, + + PAY_BY_BANK, + + PAYCO, + + PAYNOW, + + PAYPAL, + + PAYPAY, + + PAYTO, + + PIX, + + PLATFORM_BALANCE, + + PROMPTPAY, + + QRIS, + + RAPIPAGO, + + RECHNUNG, + + REVOLUT_PAY, + + SAMSUNG_PAY, + + SATISPAY, + + SCALAPAY, + + SENCILLITO, + + SEPA_DEBIT, + + SEQURA, + + SERVIPAG, + + SEZZLE, + + SHOP_PAY, + + SHOPEEPAY, + + SOFORT, + + SOUTH_KOREA_MARKET, + + SPEI, + + SPLITIT, + + SUNBIT, + + SWISH, + + TAMARA, + + TWINT, + + UPI, + + US_BANK_ACCOUNT, + + US_BANK_TRANSFER, + + VENMO, + + VIPPS, + + WEBPAY, + + WECHAT_PAY, + + YAPE, + + ZIP, + + COINFLOW, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitAcssDebit(); + + T visitAddi(); + + T visitAffirm(); + + T visitAfterpayClearpay(); + + T visitAlipay(); + + T visitAlma(); + + T visitAmazonPay(); + + T visitApple(); + + T visitApplePay(); + + T visitAuBankTransfer(); + + T visitAuBecsDebit(); + + T visitBacsDebit(); + + T visitBancolombia(); + + T visitBancontact(); + + T visitBankWire(); + + T visitBillie(); + + T visitBizum(); + + T visitBlik(); + + T visitBoleto(); + + T visitBreB(); + + T visitCaBankTransfer(); + + T visitCapchasePay(); + + T visitCard(); + + T visitCardInstallmentsThree(); + + T visitCardInstallmentsSix(); + + T visitCardInstallmentsTwelve(); + + T visitCashapp(); + + T visitClaritypay(); + + T visitCoinbase(); + + T visitCrypto(); + + T visitCustom(); + + T visitCustomerBalance(); + + T visitDemoPay(); + + T visitEfecty(); + + T visitEps(); + + T visitEuBankTransfer(); + + T visitFpx(); + + T visitGbBankTransfer(); + + T visitGiropay(); + + T visitGooglePay(); + + T visitGopay(); + + T visitGrabpay(); + + T visitIdBankTransfer(); + + T visitIdeal(); + + T visitInterac(); + + T visitKakaoPay(); + + T visitKlarna(); + + T visitKlarnaPayNow(); + + T visitKonbini(); + + T visitKrCard(); + + T visitKrMarket(); + + T visitKriya(); + + T visitKueski(); + + T visitLink(); + + T visitMbWay(); + + T visitMPesa(); + + T visitMercadoPago(); + + T visitMobilepay(); + + T visitModo(); + + T visitMondu(); + + T visitMultibanco(); + + T visitNaverPay(); + + T visitNequi(); + + T visitNetbanking(); + + T visitNgBank(); + + T visitNgBankTransfer(); + + T visitNgCard(); + + T visitNgMarket(); + + T visitNgUssd(); + + T visitNgWallet(); + + T visitNzBankAccount(); + + T visitOxxo(); + + T visitP24(); + + T visitPagoEfectivo(); + + T visitPse(); + + T visitPayByBank(); + + T visitPayco(); + + T visitPaynow(); + + T visitPaypal(); + + T visitPaypay(); + + T visitPayto(); + + T visitPix(); + + T visitPlatformBalance(); + + T visitPromptpay(); + + T visitQris(); + + T visitRapipago(); + + T visitRechnung(); + + T visitRevolutPay(); + + T visitSamsungPay(); + + T visitSatispay(); + + T visitScalapay(); + + T visitSencillito(); + + T visitSepaDebit(); + + T visitSequra(); + + T visitServipag(); + + T visitSezzle(); + + T visitShopPay(); + + T visitShopeepay(); + + T visitSofort(); + + T visitSouthKoreaMarket(); + + T visitSpei(); + + T visitSplitit(); + + T visitSunbit(); + + T visitSwish(); + + T visitTamara(); + + T visitTwint(); + + T visitUpi(); + + T visitUsBankAccount(); + + T visitUsBankTransfer(); + + T visitVenmo(); + + T visitVipps(); + + T visitWebpay(); + + T visitWechatPay(); + + T visitYape(); + + T visitZip(); + + T visitCoinflow(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethod.java b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethod.java new file mode 100644 index 00000000..c0136f1a --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethod.java @@ -0,0 +1,275 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodUsBankAccountPaymentMethod.Builder.class) +public final class PaymentMethodUsBankAccountPaymentMethod { + private final OffsetDateTime createdAt; + + private final PaymentMethodUsBankAccountPaymentMethodIcons icons; + + private final String id; + + private final PaymentMethodTypes paymentMethodType; + + private final PaymentMethodUsBankAccountPaymentMethodUsBankAccount usBankAccount; + + private final Map additionalProperties; + + private PaymentMethodUsBankAccountPaymentMethod( + OffsetDateTime createdAt, + PaymentMethodUsBankAccountPaymentMethodIcons icons, + String id, + PaymentMethodTypes paymentMethodType, + PaymentMethodUsBankAccountPaymentMethodUsBankAccount usBankAccount, + Map additionalProperties) { + this.createdAt = createdAt; + this.icons = icons; + this.id = id; + this.paymentMethodType = paymentMethodType; + this.usBankAccount = usBankAccount; + this.additionalProperties = additionalProperties; + } + + /** + * @return The time of the event in ISO 8601 UTC format with millisecond precision + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art. + */ + @JsonProperty("icons") + public PaymentMethodUsBankAccountPaymentMethodIcons getIcons() { + return icons; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit). + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + /** + * @return The bank account-specific details for this payment method, including bank name and last four digits. + */ + @JsonProperty("us_bank_account") + public PaymentMethodUsBankAccountPaymentMethodUsBankAccount getUsBankAccount() { + return usBankAccount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodUsBankAccountPaymentMethod + && equalTo((PaymentMethodUsBankAccountPaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodUsBankAccountPaymentMethod other) { + return createdAt.equals(other.createdAt) + && icons.equals(other.icons) + && id.equals(other.id) + && paymentMethodType.equals(other.paymentMethodType) + && usBankAccount.equals(other.usBankAccount); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.icons, this.id, this.paymentMethodType, this.usBankAccount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ */ + IconsStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PaymentMethodUsBankAccountPaymentMethod other); + } + + public interface IconsStage { + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ */ + IdStage icons(@NotNull PaymentMethodUsBankAccountPaymentMethodIcons icons); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ */ + UsBankAccountStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface UsBankAccountStage { + /** + *

The bank account-specific details for this payment method, including bank name and last four digits.

+ */ + _FinalStage usBankAccount(@NotNull PaymentMethodUsBankAccountPaymentMethodUsBankAccount usBankAccount); + } + + public interface _FinalStage { + PaymentMethodUsBankAccountPaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IconsStage, IdStage, PaymentMethodTypeStage, UsBankAccountStage, _FinalStage { + private OffsetDateTime createdAt; + + private PaymentMethodUsBankAccountPaymentMethodIcons icons; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + private PaymentMethodUsBankAccountPaymentMethodUsBankAccount usBankAccount; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodUsBankAccountPaymentMethod other) { + createdAt(other.getCreatedAt()); + icons(other.getIcons()); + id(other.getId()); + paymentMethodType(other.getPaymentMethodType()); + usBankAccount(other.getUsBankAccount()); + return this; + } + + /** + *

The time of the event in ISO 8601 UTC format with millisecond precision

+ *

The time of the event in ISO 8601 UTC format with millisecond precision

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IconsStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ *

Every rendition of the icon to display this payment method with. A saved card carries its brand's icon (Visa, Mastercard, ...) rather than the generic card art.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public IdStage icons(@NotNull PaymentMethodUsBankAccountPaymentMethodIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ *

The type of payment instrument stored on file (e.g., card, us_bank_account, cashapp, ideal, sepa_debit).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public UsBankAccountStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + /** + *

The bank account-specific details for this payment method, including bank name and last four digits.

+ *

The bank account-specific details for this payment method, including bank name and last four digits.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("us_bank_account") + public _FinalStage usBankAccount(@NotNull PaymentMethodUsBankAccountPaymentMethodUsBankAccount usBankAccount) { + this.usBankAccount = Objects.requireNonNull(usBankAccount, "usBankAccount must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodUsBankAccountPaymentMethod build() { + return new PaymentMethodUsBankAccountPaymentMethod( + createdAt, icons, id, paymentMethodType, usBankAccount, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIcons.java b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIcons.java new file mode 100644 index 00000000..6e0361b8 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIcons.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodUsBankAccountPaymentMethodIcons.Builder.class) +public final class PaymentMethodUsBankAccountPaymentMethodIcons { + private final PaymentMethodUsBankAccountPaymentMethodIconsCard card; + + private final PaymentMethodUsBankAccountPaymentMethodIconsSquare square; + + private final Map additionalProperties; + + private PaymentMethodUsBankAccountPaymentMethodIcons( + PaymentMethodUsBankAccountPaymentMethodIconsCard card, + PaymentMethodUsBankAccountPaymentMethodIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentMethodUsBankAccountPaymentMethodIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentMethodUsBankAccountPaymentMethodIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodUsBankAccountPaymentMethodIcons + && equalTo((PaymentMethodUsBankAccountPaymentMethodIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodUsBankAccountPaymentMethodIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentMethodUsBankAccountPaymentMethodIconsCard card); + + Builder from(PaymentMethodUsBankAccountPaymentMethodIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentMethodUsBankAccountPaymentMethodIconsSquare square); + } + + public interface _FinalStage { + PaymentMethodUsBankAccountPaymentMethodIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentMethodUsBankAccountPaymentMethodIconsCard card; + + private PaymentMethodUsBankAccountPaymentMethodIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodUsBankAccountPaymentMethodIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentMethodUsBankAccountPaymentMethodIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentMethodUsBankAccountPaymentMethodIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodUsBankAccountPaymentMethodIcons build() { + return new PaymentMethodUsBankAccountPaymentMethodIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsCard.java b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsCard.java new file mode 100644 index 00000000..0cdd79a7 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsCard.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodUsBankAccountPaymentMethodIconsCard.Builder.class) +public final class PaymentMethodUsBankAccountPaymentMethodIconsCard { + private final PaymentMethodUsBankAccountPaymentMethodIconsCardDark dark; + + private final PaymentMethodUsBankAccountPaymentMethodIconsCardLight light; + + private final Map additionalProperties; + + private PaymentMethodUsBankAccountPaymentMethodIconsCard( + PaymentMethodUsBankAccountPaymentMethodIconsCardDark dark, + PaymentMethodUsBankAccountPaymentMethodIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodUsBankAccountPaymentMethodIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodUsBankAccountPaymentMethodIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodUsBankAccountPaymentMethodIconsCard + && equalTo((PaymentMethodUsBankAccountPaymentMethodIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodUsBankAccountPaymentMethodIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodUsBankAccountPaymentMethodIconsCardDark dark); + + Builder from(PaymentMethodUsBankAccountPaymentMethodIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodUsBankAccountPaymentMethodIconsCardLight light); + } + + public interface _FinalStage { + PaymentMethodUsBankAccountPaymentMethodIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodUsBankAccountPaymentMethodIconsCardDark dark; + + private PaymentMethodUsBankAccountPaymentMethodIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodUsBankAccountPaymentMethodIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodUsBankAccountPaymentMethodIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodUsBankAccountPaymentMethodIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodUsBankAccountPaymentMethodIconsCard build() { + return new PaymentMethodUsBankAccountPaymentMethodIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsCardDark.java new file mode 100644 index 00000000..698ee08f --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsCardDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodUsBankAccountPaymentMethodIconsCardDark.Builder.class) +public final class PaymentMethodUsBankAccountPaymentMethodIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodUsBankAccountPaymentMethodIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodUsBankAccountPaymentMethodIconsCardDark + && equalTo((PaymentMethodUsBankAccountPaymentMethodIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodUsBankAccountPaymentMethodIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodUsBankAccountPaymentMethodIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodUsBankAccountPaymentMethodIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodUsBankAccountPaymentMethodIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodUsBankAccountPaymentMethodIconsCardDark build() { + return new PaymentMethodUsBankAccountPaymentMethodIconsCardDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsCardLight.java new file mode 100644 index 00000000..3be00a09 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsCardLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodUsBankAccountPaymentMethodIconsCardLight.Builder.class) +public final class PaymentMethodUsBankAccountPaymentMethodIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodUsBankAccountPaymentMethodIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodUsBankAccountPaymentMethodIconsCardLight + && equalTo((PaymentMethodUsBankAccountPaymentMethodIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodUsBankAccountPaymentMethodIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodUsBankAccountPaymentMethodIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodUsBankAccountPaymentMethodIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodUsBankAccountPaymentMethodIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodUsBankAccountPaymentMethodIconsCardLight build() { + return new PaymentMethodUsBankAccountPaymentMethodIconsCardLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsSquare.java b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsSquare.java new file mode 100644 index 00000000..2f536a4a --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodUsBankAccountPaymentMethodIconsSquare.Builder.class) +public final class PaymentMethodUsBankAccountPaymentMethodIconsSquare { + private final PaymentMethodUsBankAccountPaymentMethodIconsSquareDark dark; + + private final PaymentMethodUsBankAccountPaymentMethodIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentMethodUsBankAccountPaymentMethodIconsSquare( + PaymentMethodUsBankAccountPaymentMethodIconsSquareDark dark, + PaymentMethodUsBankAccountPaymentMethodIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentMethodUsBankAccountPaymentMethodIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentMethodUsBankAccountPaymentMethodIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodUsBankAccountPaymentMethodIconsSquare + && equalTo((PaymentMethodUsBankAccountPaymentMethodIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodUsBankAccountPaymentMethodIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentMethodUsBankAccountPaymentMethodIconsSquareDark dark); + + Builder from(PaymentMethodUsBankAccountPaymentMethodIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentMethodUsBankAccountPaymentMethodIconsSquareLight light); + } + + public interface _FinalStage { + PaymentMethodUsBankAccountPaymentMethodIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentMethodUsBankAccountPaymentMethodIconsSquareDark dark; + + private PaymentMethodUsBankAccountPaymentMethodIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodUsBankAccountPaymentMethodIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentMethodUsBankAccountPaymentMethodIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentMethodUsBankAccountPaymentMethodIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodUsBankAccountPaymentMethodIconsSquare build() { + return new PaymentMethodUsBankAccountPaymentMethodIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsSquareDark.java new file mode 100644 index 00000000..215ee0a2 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsSquareDark.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodUsBankAccountPaymentMethodIconsSquareDark.Builder.class) +public final class PaymentMethodUsBankAccountPaymentMethodIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodUsBankAccountPaymentMethodIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodUsBankAccountPaymentMethodIconsSquareDark + && equalTo((PaymentMethodUsBankAccountPaymentMethodIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodUsBankAccountPaymentMethodIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodUsBankAccountPaymentMethodIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodUsBankAccountPaymentMethodIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodUsBankAccountPaymentMethodIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodUsBankAccountPaymentMethodIconsSquareDark build() { + return new PaymentMethodUsBankAccountPaymentMethodIconsSquareDark( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsSquareLight.java new file mode 100644 index 00000000..11dfa34a --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodIconsSquareLight.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodUsBankAccountPaymentMethodIconsSquareLight.Builder.class) +public final class PaymentMethodUsBankAccountPaymentMethodIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentMethodUsBankAccountPaymentMethodIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodUsBankAccountPaymentMethodIconsSquareLight + && equalTo((PaymentMethodUsBankAccountPaymentMethodIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodUsBankAccountPaymentMethodIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentMethodUsBankAccountPaymentMethodIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentMethodUsBankAccountPaymentMethodIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodUsBankAccountPaymentMethodIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodUsBankAccountPaymentMethodIconsSquareLight build() { + return new PaymentMethodUsBankAccountPaymentMethodIconsSquareLight( + png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodUsBankAccount.java b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodUsBankAccount.java new file mode 100644 index 00000000..3fc21131 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentMethodUsBankAccountPaymentMethodUsBankAccount.java @@ -0,0 +1,198 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodUsBankAccountPaymentMethodUsBankAccount.Builder.class) +public final class PaymentMethodUsBankAccountPaymentMethodUsBankAccount { + private final String accountType; + + private final String bankName; + + private final String last4; + + private final Map additionalProperties; + + private PaymentMethodUsBankAccountPaymentMethodUsBankAccount( + String accountType, String bankName, String last4, Map additionalProperties) { + this.accountType = accountType; + this.bankName = bankName; + this.last4 = last4; + this.additionalProperties = additionalProperties; + } + + /** + * @return The type of bank account (e.g., checking, savings). + */ + @JsonProperty("account_type") + public String getAccountType() { + return accountType; + } + + /** + * @return The name of the financial institution holding the account. + */ + @JsonProperty("bank_name") + public String getBankName() { + return bankName; + } + + /** + * @return The last four digits of the bank account number. + */ + @JsonProperty("last4") + public String getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodUsBankAccountPaymentMethodUsBankAccount + && equalTo((PaymentMethodUsBankAccountPaymentMethodUsBankAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodUsBankAccountPaymentMethodUsBankAccount other) { + return accountType.equals(other.accountType) && bankName.equals(other.bankName) && last4.equals(other.last4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountType, this.bankName, this.last4); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountTypeStage builder() { + return new Builder(); + } + + public interface AccountTypeStage { + /** + *

The type of bank account (e.g., checking, savings).

+ */ + BankNameStage accountType(@NotNull String accountType); + + Builder from(PaymentMethodUsBankAccountPaymentMethodUsBankAccount other); + } + + public interface BankNameStage { + /** + *

The name of the financial institution holding the account.

+ */ + Last4Stage bankName(@NotNull String bankName); + } + + public interface Last4Stage { + /** + *

The last four digits of the bank account number.

+ */ + _FinalStage last4(@NotNull String last4); + } + + public interface _FinalStage { + PaymentMethodUsBankAccountPaymentMethodUsBankAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountTypeStage, BankNameStage, Last4Stage, _FinalStage { + private String accountType; + + private String bankName; + + private String last4; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentMethodUsBankAccountPaymentMethodUsBankAccount other) { + accountType(other.getAccountType()); + bankName(other.getBankName()); + last4(other.getLast4()); + return this; + } + + /** + *

The type of bank account (e.g., checking, savings).

+ *

The type of bank account (e.g., checking, savings).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_type") + public BankNameStage accountType(@NotNull String accountType) { + this.accountType = Objects.requireNonNull(accountType, "accountType must not be null"); + return this; + } + + /** + *

The name of the financial institution holding the account.

+ *

The name of the financial institution holding the account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bank_name") + public Last4Stage bankName(@NotNull String bankName) { + this.bankName = Objects.requireNonNull(bankName, "bankName must not be null"); + return this; + } + + /** + *

The last four digits of the bank account number.

+ *

The last four digits of the bank account number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("last4") + public _FinalStage last4(@NotNull String last4) { + this.last4 = Objects.requireNonNull(last4, "last4 must not be null"); + return this; + } + + @java.lang.Override + public PaymentMethodUsBankAccountPaymentMethodUsBankAccount build() { + return new PaymentMethodUsBankAccountPaymentMethodUsBankAccount( + accountType, bankName, last4, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentNextAction.java b/src/main/java/com/whop/api/types/PaymentNextAction.java new file mode 100644 index 00000000..73acff63 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentNextAction.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class PaymentNextAction { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PaymentNextAction(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PaymentNextAction awaitConfirmation(PaymentNextActionAwaitConfirmation value) { + return new PaymentNextAction(new AwaitConfirmationValue(value)); + } + + public static PaymentNextAction displayInstructions(PaymentNextActionDisplayInstructions value) { + return new PaymentNextAction(new DisplayInstructionsValue(value)); + } + + public static PaymentNextAction redirect(PaymentNextActionRedirect value) { + return new PaymentNextAction(new RedirectValue(value)); + } + + public boolean isAwaitConfirmation() { + return value instanceof AwaitConfirmationValue; + } + + public boolean isDisplayInstructions() { + return value instanceof DisplayInstructionsValue; + } + + public boolean isRedirect() { + return value instanceof RedirectValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAwaitConfirmation() { + if (isAwaitConfirmation()) { + return Optional.of(((AwaitConfirmationValue) value).value); + } + return Optional.empty(); + } + + public Optional getDisplayInstructions() { + if (isDisplayInstructions()) { + return Optional.of(((DisplayInstructionsValue) value).value); + } + return Optional.empty(); + } + + public Optional getRedirect() { + if (isRedirect()) { + return Optional.of(((RedirectValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentNextAction && value.equals(((PaymentNextAction) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAwaitConfirmation(PaymentNextActionAwaitConfirmation awaitConfirmation); + + T visitDisplayInstructions(PaymentNextActionDisplayInstructions displayInstructions); + + T visitRedirect(PaymentNextActionRedirect redirect); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AwaitConfirmationValue.class), + @JsonSubTypes.Type(DisplayInstructionsValue.class), + @JsonSubTypes.Type(RedirectValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("await_confirmation") + @JsonIgnoreProperties("type") + private static final class AwaitConfirmationValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private PaymentNextActionAwaitConfirmation value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AwaitConfirmationValue() {} + + private AwaitConfirmationValue(PaymentNextActionAwaitConfirmation value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAwaitConfirmation(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AwaitConfirmationValue && equalTo((AwaitConfirmationValue) other); + } + + private boolean equalTo(AwaitConfirmationValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentNextAction{" + "value: " + value + "}"; + } + } + + @JsonTypeName("display_instructions") + @JsonIgnoreProperties("type") + private static final class DisplayInstructionsValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private PaymentNextActionDisplayInstructions value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DisplayInstructionsValue() {} + + private DisplayInstructionsValue(PaymentNextActionDisplayInstructions value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDisplayInstructions(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisplayInstructionsValue && equalTo((DisplayInstructionsValue) other); + } + + private boolean equalTo(DisplayInstructionsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentNextAction{" + "value: " + value + "}"; + } + } + + @JsonTypeName("redirect") + @JsonIgnoreProperties("type") + private static final class RedirectValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private PaymentNextActionRedirect value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RedirectValue() {} + + private RedirectValue(PaymentNextActionRedirect value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRedirect(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RedirectValue && equalTo((RedirectValue) other); + } + + private boolean equalTo(RedirectValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentNextAction{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("type") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PaymentNextAction{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentNextActionAwaitConfirmation.java b/src/main/java/com/whop/api/types/PaymentNextActionAwaitConfirmation.java new file mode 100644 index 00000000..0fa85121 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentNextActionAwaitConfirmation.java @@ -0,0 +1,177 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentNextActionAwaitConfirmation.Builder.class) +public final class PaymentNextActionAwaitConfirmation { + private final PaymentNextActionAwaitConfirmationData data; + + private final List render; + + private final Map additionalProperties; + + private PaymentNextActionAwaitConfirmation( + PaymentNextActionAwaitConfirmationData data, + List render, + Map additionalProperties) { + this.data = data; + this.render = render; + this.additionalProperties = additionalProperties; + } + + /** + * @return How long the wait can last. + */ + @JsonProperty("data") + public PaymentNextActionAwaitConfirmationData getData() { + return data; + } + + @JsonProperty("render") + public List getRender() { + return render; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentNextActionAwaitConfirmation + && equalTo((PaymentNextActionAwaitConfirmation) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentNextActionAwaitConfirmation other) { + return data.equals(other.data) && render.equals(other.render); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.render); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + /** + *

How long the wait can last.

+ */ + _FinalStage data(@NotNull PaymentNextActionAwaitConfirmationData data); + + Builder from(PaymentNextActionAwaitConfirmation other); + } + + public interface _FinalStage { + PaymentNextActionAwaitConfirmation build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage render(List render); + + _FinalStage addRender(PaymentNextActionAwaitConfirmationRenderItem render); + + _FinalStage addAllRender(List render); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private PaymentNextActionAwaitConfirmationData data; + + private List render = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentNextActionAwaitConfirmation other) { + data(other.getData()); + render(other.getRender()); + return this; + } + + /** + *

How long the wait can last.

+ *

How long the wait can last.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull PaymentNextActionAwaitConfirmationData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllRender(List render) { + if (render != null) { + this.render.addAll(render); + } + return this; + } + + @java.lang.Override + public _FinalStage addRender(PaymentNextActionAwaitConfirmationRenderItem render) { + this.render.add(render); + return this; + } + + @java.lang.Override + @JsonSetter(value = "render", nulls = Nulls.SKIP) + public _FinalStage render(List render) { + this.render.clear(); + if (render != null) { + this.render.addAll(render); + } + return this; + } + + @java.lang.Override + public PaymentNextActionAwaitConfirmation build() { + return new PaymentNextActionAwaitConfirmation(data, render, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentNextActionAwaitConfirmationData.java b/src/main/java/com/whop/api/types/PaymentNextActionAwaitConfirmationData.java new file mode 100644 index 00000000..7a957094 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentNextActionAwaitConfirmationData.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentNextActionAwaitConfirmationData.Builder.class) +public final class PaymentNextActionAwaitConfirmationData { + private final String expiresAt; + + private final Map additionalProperties; + + private PaymentNextActionAwaitConfirmationData(String expiresAt, Map additionalProperties) { + this.expiresAt = expiresAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the confirmation window closes, as an ISO 8601 timestamp. A payment still unconfirmed by then will not succeed — watch status for the failed attempt. + */ + @JsonProperty("expires_at") + public String getExpiresAt() { + return expiresAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentNextActionAwaitConfirmationData + && equalTo((PaymentNextActionAwaitConfirmationData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentNextActionAwaitConfirmationData other) { + return expiresAt.equals(other.expiresAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.expiresAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExpiresAtStage builder() { + return new Builder(); + } + + public interface ExpiresAtStage { + /** + *

When the confirmation window closes, as an ISO 8601 timestamp. A payment still unconfirmed by then will not succeed — watch status for the failed attempt.

+ */ + _FinalStage expiresAt(@NotNull String expiresAt); + + Builder from(PaymentNextActionAwaitConfirmationData other); + } + + public interface _FinalStage { + PaymentNextActionAwaitConfirmationData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExpiresAtStage, _FinalStage { + private String expiresAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentNextActionAwaitConfirmationData other) { + expiresAt(other.getExpiresAt()); + return this; + } + + /** + *

When the confirmation window closes, as an ISO 8601 timestamp. A payment still unconfirmed by then will not succeed — watch status for the failed attempt.

+ *

When the confirmation window closes, as an ISO 8601 timestamp. A payment still unconfirmed by then will not succeed — watch status for the failed attempt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("expires_at") + public _FinalStage expiresAt(@NotNull String expiresAt) { + this.expiresAt = Objects.requireNonNull(expiresAt, "expiresAt must not be null"); + return this; + } + + @java.lang.Override + public PaymentNextActionAwaitConfirmationData build() { + return new PaymentNextActionAwaitConfirmationData(expiresAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentNextActionAwaitConfirmationRenderItem.java b/src/main/java/com/whop/api/types/PaymentNextActionAwaitConfirmationRenderItem.java new file mode 100644 index 00000000..affd7e02 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentNextActionAwaitConfirmationRenderItem.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PaymentNextActionAwaitConfirmationRenderItem { + public static final PaymentNextActionAwaitConfirmationRenderItem INLINE = + new PaymentNextActionAwaitConfirmationRenderItem(Value.INLINE, "inline"); + + public static final PaymentNextActionAwaitConfirmationRenderItem FULL_PAGE = + new PaymentNextActionAwaitConfirmationRenderItem(Value.FULL_PAGE, "full_page"); + + private final Value value; + + private final String string; + + PaymentNextActionAwaitConfirmationRenderItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PaymentNextActionAwaitConfirmationRenderItem + && this.string.equals(((PaymentNextActionAwaitConfirmationRenderItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INLINE: + return visitor.visitInline(); + case FULL_PAGE: + return visitor.visitFullPage(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PaymentNextActionAwaitConfirmationRenderItem valueOf(String value) { + switch (value) { + case "inline": + return INLINE; + case "full_page": + return FULL_PAGE; + default: + return new PaymentNextActionAwaitConfirmationRenderItem(Value.UNKNOWN, value); + } + } + + public enum Value { + INLINE, + + FULL_PAGE, + + UNKNOWN + } + + public interface Visitor { + T visitInline(); + + T visitFullPage(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PaymentNextActionDisplayInstructions.java b/src/main/java/com/whop/api/types/PaymentNextActionDisplayInstructions.java new file mode 100644 index 00000000..a8ad1458 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentNextActionDisplayInstructions.java @@ -0,0 +1,177 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentNextActionDisplayInstructions.Builder.class) +public final class PaymentNextActionDisplayInstructions { + private final PaymentInstructions data; + + private final List render; + + private final Map additionalProperties; + + private PaymentNextActionDisplayInstructions( + PaymentInstructions data, + List render, + Map additionalProperties) { + this.data = data; + this.render = render; + this.additionalProperties = additionalProperties; + } + + /** + * @return The instructions. kind picks the shape, and the details sit under the key named for it: voucher, qr, or bank_transfer. + */ + @JsonProperty("data") + public PaymentInstructions getData() { + return data; + } + + @JsonProperty("render") + public List getRender() { + return render; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentNextActionDisplayInstructions + && equalTo((PaymentNextActionDisplayInstructions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentNextActionDisplayInstructions other) { + return data.equals(other.data) && render.equals(other.render); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.render); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + /** + *

The instructions. kind picks the shape, and the details sit under the key named for it: voucher, qr, or bank_transfer.

+ */ + _FinalStage data(@NotNull PaymentInstructions data); + + Builder from(PaymentNextActionDisplayInstructions other); + } + + public interface _FinalStage { + PaymentNextActionDisplayInstructions build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage render(List render); + + _FinalStage addRender(PaymentNextActionDisplayInstructionsRenderItem render); + + _FinalStage addAllRender(List render); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private PaymentInstructions data; + + private List render = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentNextActionDisplayInstructions other) { + data(other.getData()); + render(other.getRender()); + return this; + } + + /** + *

The instructions. kind picks the shape, and the details sit under the key named for it: voucher, qr, or bank_transfer.

+ *

The instructions. kind picks the shape, and the details sit under the key named for it: voucher, qr, or bank_transfer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull PaymentInstructions data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllRender(List render) { + if (render != null) { + this.render.addAll(render); + } + return this; + } + + @java.lang.Override + public _FinalStage addRender(PaymentNextActionDisplayInstructionsRenderItem render) { + this.render.add(render); + return this; + } + + @java.lang.Override + @JsonSetter(value = "render", nulls = Nulls.SKIP) + public _FinalStage render(List render) { + this.render.clear(); + if (render != null) { + this.render.addAll(render); + } + return this; + } + + @java.lang.Override + public PaymentNextActionDisplayInstructions build() { + return new PaymentNextActionDisplayInstructions(data, render, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentNextActionDisplayInstructionsRenderItem.java b/src/main/java/com/whop/api/types/PaymentNextActionDisplayInstructionsRenderItem.java new file mode 100644 index 00000000..495402f0 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentNextActionDisplayInstructionsRenderItem.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PaymentNextActionDisplayInstructionsRenderItem { + public static final PaymentNextActionDisplayInstructionsRenderItem INLINE = + new PaymentNextActionDisplayInstructionsRenderItem(Value.INLINE, "inline"); + + public static final PaymentNextActionDisplayInstructionsRenderItem FULL_PAGE = + new PaymentNextActionDisplayInstructionsRenderItem(Value.FULL_PAGE, "full_page"); + + private final Value value; + + private final String string; + + PaymentNextActionDisplayInstructionsRenderItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PaymentNextActionDisplayInstructionsRenderItem + && this.string.equals(((PaymentNextActionDisplayInstructionsRenderItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INLINE: + return visitor.visitInline(); + case FULL_PAGE: + return visitor.visitFullPage(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PaymentNextActionDisplayInstructionsRenderItem valueOf(String value) { + switch (value) { + case "inline": + return INLINE; + case "full_page": + return FULL_PAGE; + default: + return new PaymentNextActionDisplayInstructionsRenderItem(Value.UNKNOWN, value); + } + } + + public enum Value { + INLINE, + + FULL_PAGE, + + UNKNOWN + } + + public interface Visitor { + T visitInline(); + + T visitFullPage(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PaymentNextActionRedirect.java b/src/main/java/com/whop/api/types/PaymentNextActionRedirect.java new file mode 100644 index 00000000..08eed2bc --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentNextActionRedirect.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentNextActionRedirect.Builder.class) +public final class PaymentNextActionRedirect { + private final PaymentNextActionRedirectData data; + + private final List render; + + private final Map additionalProperties; + + private PaymentNextActionRedirect( + PaymentNextActionRedirectData data, + List render, + Map additionalProperties) { + this.data = data; + this.render = render; + this.additionalProperties = additionalProperties; + } + + /** + * @return Where to send the buyer. + */ + @JsonProperty("data") + public PaymentNextActionRedirectData getData() { + return data; + } + + @JsonProperty("render") + public List getRender() { + return render; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentNextActionRedirect && equalTo((PaymentNextActionRedirect) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentNextActionRedirect other) { + return data.equals(other.data) && render.equals(other.render); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.render); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + /** + *

Where to send the buyer.

+ */ + _FinalStage data(@NotNull PaymentNextActionRedirectData data); + + Builder from(PaymentNextActionRedirect other); + } + + public interface _FinalStage { + PaymentNextActionRedirect build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage render(List render); + + _FinalStage addRender(PaymentNextActionRedirectRenderItem render); + + _FinalStage addAllRender(List render); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private PaymentNextActionRedirectData data; + + private List render = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentNextActionRedirect other) { + data(other.getData()); + render(other.getRender()); + return this; + } + + /** + *

Where to send the buyer.

+ *

Where to send the buyer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull PaymentNextActionRedirectData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllRender(List render) { + if (render != null) { + this.render.addAll(render); + } + return this; + } + + @java.lang.Override + public _FinalStage addRender(PaymentNextActionRedirectRenderItem render) { + this.render.add(render); + return this; + } + + @java.lang.Override + @JsonSetter(value = "render", nulls = Nulls.SKIP) + public _FinalStage render(List render) { + this.render.clear(); + if (render != null) { + this.render.addAll(render); + } + return this; + } + + @java.lang.Override + public PaymentNextActionRedirect build() { + return new PaymentNextActionRedirect(data, render, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentNextActionRedirectData.java b/src/main/java/com/whop/api/types/PaymentNextActionRedirectData.java new file mode 100644 index 00000000..36b51c44 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentNextActionRedirectData.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentNextActionRedirectData.Builder.class) +public final class PaymentNextActionRedirectData { + private final Optional frameMaxWidth; + + private final String url; + + private final Map additionalProperties; + + private PaymentNextActionRedirectData( + Optional frameMaxWidth, String url, Map additionalProperties) { + this.frameMaxWidth = frameMaxWidth; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The widest the provider's page lays out usefully, in CSS pixels — cap a frame or dialog presenting it at this width. null when the page fills whatever width it is given. + */ + @JsonIgnore + public Optional getFrameMaxWidth() { + if (frameMaxWidth == null) { + return Optional.empty(); + } + return frameMaxWidth; + } + + /** + * @return The provider's page for this payment, as an absolute URL — take the buyer there. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("frame_max_width") + private Optional _getFrameMaxWidth() { + return frameMaxWidth; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentNextActionRedirectData && equalTo((PaymentNextActionRedirectData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentNextActionRedirectData other) { + return frameMaxWidth.equals(other.frameMaxWidth) && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.frameMaxWidth, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

The provider's page for this payment, as an absolute URL — take the buyer there.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(PaymentNextActionRedirectData other); + } + + public interface _FinalStage { + PaymentNextActionRedirectData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The widest the provider's page lays out usefully, in CSS pixels — cap a frame or dialog presenting it at this width. null when the page fills whatever width it is given.

+ */ + _FinalStage frameMaxWidth(Optional frameMaxWidth); + + _FinalStage frameMaxWidth(Integer frameMaxWidth); + + _FinalStage frameMaxWidth(Nullable frameMaxWidth); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + private Optional frameMaxWidth = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentNextActionRedirectData other) { + frameMaxWidth(other.getFrameMaxWidth()); + url(other.getUrl()); + return this; + } + + /** + *

The provider's page for this payment, as an absolute URL — take the buyer there.

+ *

The provider's page for this payment, as an absolute URL — take the buyer there.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + /** + *

The widest the provider's page lays out usefully, in CSS pixels — cap a frame or dialog presenting it at this width. null when the page fills whatever width it is given.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frameMaxWidth(Nullable frameMaxWidth) { + if (frameMaxWidth.isNull()) { + this.frameMaxWidth = null; + } else if (frameMaxWidth.isEmpty()) { + this.frameMaxWidth = Optional.empty(); + } else { + this.frameMaxWidth = Optional.of(frameMaxWidth.get()); + } + return this; + } + + /** + *

The widest the provider's page lays out usefully, in CSS pixels — cap a frame or dialog presenting it at this width. null when the page fills whatever width it is given.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage frameMaxWidth(Integer frameMaxWidth) { + this.frameMaxWidth = Optional.ofNullable(frameMaxWidth); + return this; + } + + /** + *

The widest the provider's page lays out usefully, in CSS pixels — cap a frame or dialog presenting it at this width. null when the page fills whatever width it is given.

+ */ + @java.lang.Override + @JsonSetter(value = "frame_max_width", nulls = Nulls.SKIP) + public _FinalStage frameMaxWidth(Optional frameMaxWidth) { + this.frameMaxWidth = frameMaxWidth; + return this; + } + + @java.lang.Override + public PaymentNextActionRedirectData build() { + return new PaymentNextActionRedirectData(frameMaxWidth, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentNextActionRedirectRenderItem.java b/src/main/java/com/whop/api/types/PaymentNextActionRedirectRenderItem.java new file mode 100644 index 00000000..eab45ed3 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentNextActionRedirectRenderItem.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PaymentNextActionRedirectRenderItem { + public static final PaymentNextActionRedirectRenderItem INLINE = + new PaymentNextActionRedirectRenderItem(Value.INLINE, "inline"); + + public static final PaymentNextActionRedirectRenderItem FULL_PAGE = + new PaymentNextActionRedirectRenderItem(Value.FULL_PAGE, "full_page"); + + private final Value value; + + private final String string; + + PaymentNextActionRedirectRenderItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PaymentNextActionRedirectRenderItem + && this.string.equals(((PaymentNextActionRedirectRenderItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INLINE: + return visitor.visitInline(); + case FULL_PAGE: + return visitor.visitFullPage(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PaymentNextActionRedirectRenderItem valueOf(String value) { + switch (value) { + case "inline": + return INLINE; + case "full_page": + return FULL_PAGE; + default: + return new PaymentNextActionRedirectRenderItem(Value.UNKNOWN, value); + } + } + + public enum Value { + INLINE, + + FULL_PAGE, + + UNKNOWN + } + + public interface Visitor { + T visitInline(); + + T visitFullPage(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PaymentPaymentInstrument.java b/src/main/java/com/whop/api/types/PaymentPaymentInstrument.java new file mode 100644 index 00000000..ec4837f1 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentPaymentInstrument.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentPaymentInstrument.Builder.class) +public final class PaymentPaymentInstrument { + private final Optional card; + + private final String displayName; + + private final PaymentPaymentInstrumentIcons icons; + + private final Optional installmentCount; + + private final String paymentMethodType; + + private final Map additionalProperties; + + private PaymentPaymentInstrument( + Optional card, + String displayName, + PaymentPaymentInstrumentIcons icons, + Optional installmentCount, + String paymentMethodType, + Map additionalProperties) { + this.card = card; + this.displayName = displayName; + this.icons = icons; + this.installmentCount = installmentCount; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return Card payments only: the card's network and last four. + */ + @JsonIgnore + public Optional getCard() { + if (card == null) { + return Optional.empty(); + } + return card; + } + + /** + * @return Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna"). + */ + @JsonProperty("display_name") + public String getDisplayName() { + return displayName; + } + + /** + * @return The standard icon set: square and card shapes, each in light and dark colorways. + */ + @JsonProperty("icons") + public PaymentPaymentInstrumentIcons getIcons() { + return icons; + } + + /** + * @return Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side. + */ + @JsonIgnore + public Optional getInstallmentCount() { + if (installmentCount == null) { + return Optional.empty(); + } + return installmentCount; + } + + /** + * @return The payment method type identifier, e.g. card, klarna, apple_pay. + */ + @JsonProperty("payment_method_type") + public String getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card") + private Optional _getCard() { + return card; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("installment_count") + private Optional _getInstallmentCount() { + return installmentCount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentPaymentInstrument && equalTo((PaymentPaymentInstrument) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentPaymentInstrument other) { + return card.equals(other.card) + && displayName.equals(other.displayName) + && icons.equals(other.icons) + && installmentCount.equals(other.installmentCount) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.displayName, this.icons, this.installmentCount, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DisplayNameStage builder() { + return new Builder(); + } + + public interface DisplayNameStage { + /** + *

Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna").

+ */ + IconsStage displayName(@NotNull String displayName); + + Builder from(PaymentPaymentInstrument other); + } + + public interface IconsStage { + /** + *

The standard icon set: square and card shapes, each in light and dark colorways.

+ */ + PaymentMethodTypeStage icons(@NotNull PaymentPaymentInstrumentIcons icons); + } + + public interface PaymentMethodTypeStage { + /** + *

The payment method type identifier, e.g. card, klarna, apple_pay.

+ */ + _FinalStage paymentMethodType(@NotNull String paymentMethodType); + } + + public interface _FinalStage { + PaymentPaymentInstrument build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Card payments only: the card's network and last four.

+ */ + _FinalStage card(Optional card); + + _FinalStage card(PaymentPaymentInstrumentCard card); + + _FinalStage card(Nullable card); + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ */ + _FinalStage installmentCount(Optional installmentCount); + + _FinalStage installmentCount(Integer installmentCount); + + _FinalStage installmentCount(Nullable installmentCount); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DisplayNameStage, IconsStage, PaymentMethodTypeStage, _FinalStage { + private String displayName; + + private PaymentPaymentInstrumentIcons icons; + + private String paymentMethodType; + + private Optional installmentCount = Optional.empty(); + + private Optional card = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentPaymentInstrument other) { + card(other.getCard()); + displayName(other.getDisplayName()); + icons(other.getIcons()); + installmentCount(other.getInstallmentCount()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna").

+ *

Buyer-facing instrument name — "Visa •••• 4242" when the card surfaced, else the method's own name ("Klarna").

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("display_name") + public IconsStage displayName(@NotNull String displayName) { + this.displayName = Objects.requireNonNull(displayName, "displayName must not be null"); + return this; + } + + /** + *

The standard icon set: square and card shapes, each in light and dark colorways.

+ *

The standard icon set: square and card shapes, each in light and dark colorways.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("icons") + public PaymentMethodTypeStage icons(@NotNull PaymentPaymentInstrumentIcons icons) { + this.icons = Objects.requireNonNull(icons, "icons must not be null"); + return this; + } + + /** + *

The payment method type identifier, e.g. card, klarna, apple_pay.

+ *

The payment method type identifier, e.g. card, klarna, apple_pay.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull String paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage installmentCount(Nullable installmentCount) { + if (installmentCount.isNull()) { + this.installmentCount = null; + } else if (installmentCount.isEmpty()) { + this.installmentCount = Optional.empty(); + } else { + this.installmentCount = Optional.of(installmentCount.get()); + } + return this; + } + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage installmentCount(Integer installmentCount) { + this.installmentCount = Optional.ofNullable(installmentCount); + return this; + } + + /** + *

Installment methods only: how many payments the charge splits into. Data, not copy — compose and translate the label client-side.

+ */ + @java.lang.Override + @JsonSetter(value = "installment_count", nulls = Nulls.SKIP) + public _FinalStage installmentCount(Optional installmentCount) { + this.installmentCount = installmentCount; + return this; + } + + /** + *

Card payments only: the card's network and last four.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(Nullable card) { + if (card.isNull()) { + this.card = null; + } else if (card.isEmpty()) { + this.card = Optional.empty(); + } else { + this.card = Optional.of(card.get()); + } + return this; + } + + /** + *

Card payments only: the card's network and last four.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(PaymentPaymentInstrumentCard card) { + this.card = Optional.ofNullable(card); + return this; + } + + /** + *

Card payments only: the card's network and last four.

+ */ + @java.lang.Override + @JsonSetter(value = "card", nulls = Nulls.SKIP) + public _FinalStage card(Optional card) { + this.card = card; + return this; + } + + @java.lang.Override + public PaymentPaymentInstrument build() { + return new PaymentPaymentInstrument( + card, displayName, icons, installmentCount, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentPaymentInstrumentCard.java b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentCard.java new file mode 100644 index 00000000..3d586ea6 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentCard.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentPaymentInstrumentCard.Builder.class) +public final class PaymentPaymentInstrumentCard { + private final String brand; + + private final Optional last4; + + private final Map additionalProperties; + + private PaymentPaymentInstrumentCard( + String brand, Optional last4, Map additionalProperties) { + this.brand = brand; + this.last4 = last4; + this.additionalProperties = additionalProperties; + } + + /** + * @return The network identifier (visa, amex, …), matching card.networks entries and saved card payment methods. + */ + @JsonProperty("brand") + public String getBrand() { + return brand; + } + + /** + * @return The card's last four digits, when captured. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentPaymentInstrumentCard && equalTo((PaymentPaymentInstrumentCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentPaymentInstrumentCard other) { + return brand.equals(other.brand) && last4.equals(other.last4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.brand, this.last4); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BrandStage builder() { + return new Builder(); + } + + public interface BrandStage { + /** + *

The network identifier (visa, amex, …), matching card.networks entries and saved card payment methods.

+ */ + _FinalStage brand(@NotNull String brand); + + Builder from(PaymentPaymentInstrumentCard other); + } + + public interface _FinalStage { + PaymentPaymentInstrumentCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The card's last four digits, when captured.

+ */ + _FinalStage last4(Optional last4); + + _FinalStage last4(String last4); + + _FinalStage last4(Nullable last4); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BrandStage, _FinalStage { + private String brand; + + private Optional last4 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentPaymentInstrumentCard other) { + brand(other.getBrand()); + last4(other.getLast4()); + return this; + } + + /** + *

The network identifier (visa, amex, …), matching card.networks entries and saved card payment methods.

+ *

The network identifier (visa, amex, …), matching card.networks entries and saved card payment methods.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("brand") + public _FinalStage brand(@NotNull String brand) { + this.brand = Objects.requireNonNull(brand, "brand must not be null"); + return this; + } + + /** + *

The card's last four digits, when captured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + /** + *

The card's last four digits, when captured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + /** + *

The card's last four digits, when captured.

+ */ + @java.lang.Override + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public _FinalStage last4(Optional last4) { + this.last4 = last4; + return this; + } + + @java.lang.Override + public PaymentPaymentInstrumentCard build() { + return new PaymentPaymentInstrumentCard(brand, last4, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIcons.java b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIcons.java new file mode 100644 index 00000000..f6960151 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIcons.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentPaymentInstrumentIcons.Builder.class) +public final class PaymentPaymentInstrumentIcons { + private final PaymentPaymentInstrumentIconsCard card; + + private final PaymentPaymentInstrumentIconsSquare square; + + private final Map additionalProperties; + + private PaymentPaymentInstrumentIcons( + PaymentPaymentInstrumentIconsCard card, + PaymentPaymentInstrumentIconsSquare square, + Map additionalProperties) { + this.card = card; + this.square = square; + this.additionalProperties = additionalProperties; + } + + /** + * @return The credit-card-proportioned tile (48x30). + */ + @JsonProperty("card") + public PaymentPaymentInstrumentIconsCard getCard() { + return card; + } + + /** + * @return The square tile (32x32). + */ + @JsonProperty("square") + public PaymentPaymentInstrumentIconsSquare getSquare() { + return square; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentPaymentInstrumentIcons && equalTo((PaymentPaymentInstrumentIcons) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentPaymentInstrumentIcons other) { + return card.equals(other.card) && square.equals(other.square); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.square); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CardStage builder() { + return new Builder(); + } + + public interface CardStage { + /** + *

The credit-card-proportioned tile (48x30).

+ */ + SquareStage card(@NotNull PaymentPaymentInstrumentIconsCard card); + + Builder from(PaymentPaymentInstrumentIcons other); + } + + public interface SquareStage { + /** + *

The square tile (32x32).

+ */ + _FinalStage square(@NotNull PaymentPaymentInstrumentIconsSquare square); + } + + public interface _FinalStage { + PaymentPaymentInstrumentIcons build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CardStage, SquareStage, _FinalStage { + private PaymentPaymentInstrumentIconsCard card; + + private PaymentPaymentInstrumentIconsSquare square; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentPaymentInstrumentIcons other) { + card(other.getCard()); + square(other.getSquare()); + return this; + } + + /** + *

The credit-card-proportioned tile (48x30).

+ *

The credit-card-proportioned tile (48x30).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("card") + public SquareStage card(@NotNull PaymentPaymentInstrumentIconsCard card) { + this.card = Objects.requireNonNull(card, "card must not be null"); + return this; + } + + /** + *

The square tile (32x32).

+ *

The square tile (32x32).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("square") + public _FinalStage square(@NotNull PaymentPaymentInstrumentIconsSquare square) { + this.square = Objects.requireNonNull(square, "square must not be null"); + return this; + } + + @java.lang.Override + public PaymentPaymentInstrumentIcons build() { + return new PaymentPaymentInstrumentIcons(card, square, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsCard.java b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsCard.java new file mode 100644 index 00000000..f0724ba0 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsCard.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentPaymentInstrumentIconsCard.Builder.class) +public final class PaymentPaymentInstrumentIconsCard { + private final PaymentPaymentInstrumentIconsCardDark dark; + + private final PaymentPaymentInstrumentIconsCardLight light; + + private final Map additionalProperties; + + private PaymentPaymentInstrumentIconsCard( + PaymentPaymentInstrumentIconsCardDark dark, + PaymentPaymentInstrumentIconsCardLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentPaymentInstrumentIconsCardDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentPaymentInstrumentIconsCardLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentPaymentInstrumentIconsCard && equalTo((PaymentPaymentInstrumentIconsCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentPaymentInstrumentIconsCard other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentPaymentInstrumentIconsCardDark dark); + + Builder from(PaymentPaymentInstrumentIconsCard other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentPaymentInstrumentIconsCardLight light); + } + + public interface _FinalStage { + PaymentPaymentInstrumentIconsCard build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentPaymentInstrumentIconsCardDark dark; + + private PaymentPaymentInstrumentIconsCardLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentPaymentInstrumentIconsCard other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentPaymentInstrumentIconsCardDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentPaymentInstrumentIconsCardLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentPaymentInstrumentIconsCard build() { + return new PaymentPaymentInstrumentIconsCard(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsCardDark.java b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsCardDark.java new file mode 100644 index 00000000..93ddd539 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsCardDark.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentPaymentInstrumentIconsCardDark.Builder.class) +public final class PaymentPaymentInstrumentIconsCardDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentPaymentInstrumentIconsCardDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentPaymentInstrumentIconsCardDark + && equalTo((PaymentPaymentInstrumentIconsCardDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentPaymentInstrumentIconsCardDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentPaymentInstrumentIconsCardDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentPaymentInstrumentIconsCardDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentPaymentInstrumentIconsCardDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentPaymentInstrumentIconsCardDark build() { + return new PaymentPaymentInstrumentIconsCardDark(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsCardLight.java b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsCardLight.java new file mode 100644 index 00000000..424e7ef0 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsCardLight.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentPaymentInstrumentIconsCardLight.Builder.class) +public final class PaymentPaymentInstrumentIconsCardLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentPaymentInstrumentIconsCardLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentPaymentInstrumentIconsCardLight + && equalTo((PaymentPaymentInstrumentIconsCardLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentPaymentInstrumentIconsCardLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentPaymentInstrumentIconsCardLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentPaymentInstrumentIconsCardLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentPaymentInstrumentIconsCardLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentPaymentInstrumentIconsCardLight build() { + return new PaymentPaymentInstrumentIconsCardLight(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsSquare.java b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsSquare.java new file mode 100644 index 00000000..1f00e45d --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsSquare.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentPaymentInstrumentIconsSquare.Builder.class) +public final class PaymentPaymentInstrumentIconsSquare { + private final PaymentPaymentInstrumentIconsSquareDark dark; + + private final PaymentPaymentInstrumentIconsSquareLight light; + + private final Map additionalProperties; + + private PaymentPaymentInstrumentIconsSquare( + PaymentPaymentInstrumentIconsSquareDark dark, + PaymentPaymentInstrumentIconsSquareLight light, + Map additionalProperties) { + this.dark = dark; + this.light = light; + this.additionalProperties = additionalProperties; + } + + /** + * @return The colorway for dark surfaces. + */ + @JsonProperty("dark") + public PaymentPaymentInstrumentIconsSquareDark getDark() { + return dark; + } + + /** + * @return The colorway for light surfaces. + */ + @JsonProperty("light") + public PaymentPaymentInstrumentIconsSquareLight getLight() { + return light; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentPaymentInstrumentIconsSquare + && equalTo((PaymentPaymentInstrumentIconsSquare) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentPaymentInstrumentIconsSquare other) { + return dark.equals(other.dark) && light.equals(other.light); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dark, this.light); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DarkStage builder() { + return new Builder(); + } + + public interface DarkStage { + /** + *

The colorway for dark surfaces.

+ */ + LightStage dark(@NotNull PaymentPaymentInstrumentIconsSquareDark dark); + + Builder from(PaymentPaymentInstrumentIconsSquare other); + } + + public interface LightStage { + /** + *

The colorway for light surfaces.

+ */ + _FinalStage light(@NotNull PaymentPaymentInstrumentIconsSquareLight light); + } + + public interface _FinalStage { + PaymentPaymentInstrumentIconsSquare build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DarkStage, LightStage, _FinalStage { + private PaymentPaymentInstrumentIconsSquareDark dark; + + private PaymentPaymentInstrumentIconsSquareLight light; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentPaymentInstrumentIconsSquare other) { + dark(other.getDark()); + light(other.getLight()); + return this; + } + + /** + *

The colorway for dark surfaces.

+ *

The colorway for dark surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dark") + public LightStage dark(@NotNull PaymentPaymentInstrumentIconsSquareDark dark) { + this.dark = Objects.requireNonNull(dark, "dark must not be null"); + return this; + } + + /** + *

The colorway for light surfaces.

+ *

The colorway for light surfaces.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("light") + public _FinalStage light(@NotNull PaymentPaymentInstrumentIconsSquareLight light) { + this.light = Objects.requireNonNull(light, "light must not be null"); + return this; + } + + @java.lang.Override + public PaymentPaymentInstrumentIconsSquare build() { + return new PaymentPaymentInstrumentIconsSquare(dark, light, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsSquareDark.java b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsSquareDark.java new file mode 100644 index 00000000..1487b7d6 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsSquareDark.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentPaymentInstrumentIconsSquareDark.Builder.class) +public final class PaymentPaymentInstrumentIconsSquareDark { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentPaymentInstrumentIconsSquareDark( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentPaymentInstrumentIconsSquareDark + && equalTo((PaymentPaymentInstrumentIconsSquareDark) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentPaymentInstrumentIconsSquareDark other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentPaymentInstrumentIconsSquareDark other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentPaymentInstrumentIconsSquareDark build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentPaymentInstrumentIconsSquareDark other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentPaymentInstrumentIconsSquareDark build() { + return new PaymentPaymentInstrumentIconsSquareDark(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsSquareLight.java b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsSquareLight.java new file mode 100644 index 00000000..8f812ae4 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentPaymentInstrumentIconsSquareLight.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentPaymentInstrumentIconsSquareLight.Builder.class) +public final class PaymentPaymentInstrumentIconsSquareLight { + private final String png1X; + + private final String png2X; + + private final String png4X; + + private final String svg; + + private final Map additionalProperties; + + private PaymentPaymentInstrumentIconsSquareLight( + String png1X, String png2X, String png4X, String svg, Map additionalProperties) { + this.png1X = png1X; + this.png2X = png2X; + this.png4X = png4X; + this.svg = svg; + this.additionalProperties = additionalProperties; + } + + /** + * @return Raster fallback at the shape's native size. + */ + @JsonProperty("png_1x") + public String getPng1X() { + return png1X; + } + + /** + * @return Raster fallback at double density. + */ + @JsonProperty("png_2x") + public String getPng2X() { + return png2X; + } + + /** + * @return Raster fallback at quadruple density. + */ + @JsonProperty("png_4x") + public String getPng4X() { + return png4X; + } + + /** + * @return The vector file. Prefer this everywhere SVG renders. + */ + @JsonProperty("svg") + public String getSvg() { + return svg; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentPaymentInstrumentIconsSquareLight + && equalTo((PaymentPaymentInstrumentIconsSquareLight) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentPaymentInstrumentIconsSquareLight other) { + return png1X.equals(other.png1X) + && png2X.equals(other.png2X) + && png4X.equals(other.png4X) + && svg.equals(other.svg); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.png1X, this.png2X, this.png4X, this.svg); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Png1XStage builder() { + return new Builder(); + } + + public interface Png1XStage { + /** + *

Raster fallback at the shape's native size.

+ */ + Png2XStage png1X(@NotNull String png1X); + + Builder from(PaymentPaymentInstrumentIconsSquareLight other); + } + + public interface Png2XStage { + /** + *

Raster fallback at double density.

+ */ + Png4XStage png2X(@NotNull String png2X); + } + + public interface Png4XStage { + /** + *

Raster fallback at quadruple density.

+ */ + SvgStage png4X(@NotNull String png4X); + } + + public interface SvgStage { + /** + *

The vector file. Prefer this everywhere SVG renders.

+ */ + _FinalStage svg(@NotNull String svg); + } + + public interface _FinalStage { + PaymentPaymentInstrumentIconsSquareLight build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Png1XStage, Png2XStage, Png4XStage, SvgStage, _FinalStage { + private String png1X; + + private String png2X; + + private String png4X; + + private String svg; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentPaymentInstrumentIconsSquareLight other) { + png1X(other.getPng1X()); + png2X(other.getPng2X()); + png4X(other.getPng4X()); + svg(other.getSvg()); + return this; + } + + /** + *

Raster fallback at the shape's native size.

+ *

Raster fallback at the shape's native size.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_1x") + public Png2XStage png1X(@NotNull String png1X) { + this.png1X = Objects.requireNonNull(png1X, "png1X must not be null"); + return this; + } + + /** + *

Raster fallback at double density.

+ *

Raster fallback at double density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_2x") + public Png4XStage png2X(@NotNull String png2X) { + this.png2X = Objects.requireNonNull(png2X, "png2X must not be null"); + return this; + } + + /** + *

Raster fallback at quadruple density.

+ *

Raster fallback at quadruple density.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("png_4x") + public SvgStage png4X(@NotNull String png4X) { + this.png4X = Objects.requireNonNull(png4X, "png4X must not be null"); + return this; + } + + /** + *

The vector file. Prefer this everywhere SVG renders.

+ *

The vector file. Prefer this everywhere SVG renders.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("svg") + public _FinalStage svg(@NotNull String svg) { + this.svg = Objects.requireNonNull(svg, "svg must not be null"); + return this; + } + + @java.lang.Override + public PaymentPaymentInstrumentIconsSquareLight build() { + return new PaymentPaymentInstrumentIconsSquareLight(png1X, png2X, png4X, svg, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentPaymentMethod.java b/src/main/java/com/whop/api/types/PaymentPaymentMethod.java new file mode 100644 index 00000000..adaaa1d5 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentPaymentMethod.java @@ -0,0 +1,277 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentPaymentMethod.Builder.class) +public final class PaymentPaymentMethod { + private final Optional card; + + private final OffsetDateTime createdAt; + + private final String id; + + private final PaymentMethodTypes paymentMethodType; + + private final Map additionalProperties; + + private PaymentPaymentMethod( + Optional card, + OffsetDateTime createdAt, + String id, + PaymentMethodTypes paymentMethodType, + Map additionalProperties) { + this.card = card; + this.createdAt = createdAt; + this.id = id; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The card data associated with the payment method, if its a debit or credit card. + */ + @JsonIgnore + public Optional getCard() { + if (card == null) { + return Optional.empty(); + } + return card; + } + + /** + * @return The datetime the payment token was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the payment token. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The payment method type of the payment method + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card") + private Optional _getCard() { + return card; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentPaymentMethod && equalTo((PaymentPaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentPaymentMethod other) { + return card.equals(other.card) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.createdAt, this.id, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the payment token was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PaymentPaymentMethod other); + } + + public interface IdStage { + /** + *

The unique identifier for the payment token.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The payment method type of the payment method

+ */ + _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface _FinalStage { + PaymentPaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ */ + _FinalStage card(Optional card); + + _FinalStage card(PaymentPaymentMethodCard card); + + _FinalStage card(Nullable card); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, PaymentMethodTypeStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + private Optional card = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentPaymentMethod other) { + card(other.getCard()); + createdAt(other.getCreatedAt()); + id(other.getId()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

The datetime the payment token was created.

+ *

The datetime the payment token was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the payment token.

+ *

The unique identifier for the payment token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The payment method type of the payment method

+ *

The payment method type of the payment method

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(Nullable card) { + if (card.isNull()) { + this.card = null; + } else if (card.isEmpty()) { + this.card = Optional.empty(); + } else { + this.card = Optional.of(card.get()); + } + return this; + } + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(PaymentPaymentMethodCard card) { + this.card = Optional.ofNullable(card); + return this; + } + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ */ + @java.lang.Override + @JsonSetter(value = "card", nulls = Nulls.SKIP) + public _FinalStage card(Optional card) { + this.card = card; + return this; + } + + @java.lang.Override + public PaymentPaymentMethod build() { + return new PaymentPaymentMethod(card, createdAt, id, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentPaymentMethodCard.java b/src/main/java/com/whop/api/types/PaymentPaymentMethodCard.java new file mode 100644 index 00000000..6fb1cb22 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentPaymentMethodCard.java @@ -0,0 +1,336 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentPaymentMethodCard.Builder.class) +public final class PaymentPaymentMethodCard { + private final Optional brand; + + private final Optional expMonth; + + private final Optional expYear; + + private final Optional fingerprint; + + private final Optional last4; + + private final Map additionalProperties; + + private PaymentPaymentMethodCard( + Optional brand, + Optional expMonth, + Optional expYear, + Optional fingerprint, + Optional last4, + Map additionalProperties) { + this.brand = brand; + this.expMonth = expMonth; + this.expYear = expYear; + this.fingerprint = fingerprint; + this.last4 = last4; + this.additionalProperties = additionalProperties; + } + + /** + * @return The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined. + */ + @JsonIgnore + public Optional getBrand() { + if (brand == null) { + return Optional.empty(); + } + return brand; + } + + /** + * @return The two-digit expiration month of the card (1-12). Null if not available. + */ + @JsonIgnore + public Optional getExpMonth() { + if (expMonth == null) { + return Optional.empty(); + } + return expMonth; + } + + /** + * @return The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available. + */ + @JsonIgnore + public Optional getExpYear() { + if (expYear == null) { + return Optional.empty(); + } + return expYear; + } + + /** + * @return A stable identifier for the underlying card. Two payment methods with the same fingerprint are the same card. Null if not available. + */ + @JsonIgnore + public Optional getFingerprint() { + if (fingerprint == null) { + return Optional.empty(); + } + return fingerprint; + } + + /** + * @return The last four digits of the card number. Null if not available. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("brand") + private Optional _getBrand() { + return brand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_month") + private Optional _getExpMonth() { + return expMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_year") + private Optional _getExpYear() { + return expYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fingerprint") + private Optional _getFingerprint() { + return fingerprint; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentPaymentMethodCard && equalTo((PaymentPaymentMethodCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentPaymentMethodCard other) { + return brand.equals(other.brand) + && expMonth.equals(other.expMonth) + && expYear.equals(other.expYear) + && fingerprint.equals(other.fingerprint) + && last4.equals(other.last4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.brand, this.expMonth, this.expYear, this.fingerprint, this.last4); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional brand = Optional.empty(); + + private Optional expMonth = Optional.empty(); + + private Optional expYear = Optional.empty(); + + private Optional fingerprint = Optional.empty(); + + private Optional last4 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentPaymentMethodCard other) { + brand(other.getBrand()); + expMonth(other.getExpMonth()); + expYear(other.getExpYear()); + fingerprint(other.getFingerprint()); + last4(other.getLast4()); + return this; + } + + /** + *

The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined.

+ */ + @JsonSetter(value = "brand", nulls = Nulls.SKIP) + public Builder brand(Optional brand) { + this.brand = brand; + return this; + } + + public Builder brand(CardBrands brand) { + this.brand = Optional.ofNullable(brand); + return this; + } + + public Builder brand(Nullable brand) { + if (brand.isNull()) { + this.brand = null; + } else if (brand.isEmpty()) { + this.brand = Optional.empty(); + } else { + this.brand = Optional.of(brand.get()); + } + return this; + } + + /** + *

The two-digit expiration month of the card (1-12). Null if not available.

+ */ + @JsonSetter(value = "exp_month", nulls = Nulls.SKIP) + public Builder expMonth(Optional expMonth) { + this.expMonth = expMonth; + return this; + } + + public Builder expMonth(Integer expMonth) { + this.expMonth = Optional.ofNullable(expMonth); + return this; + } + + public Builder expMonth(Nullable expMonth) { + if (expMonth.isNull()) { + this.expMonth = null; + } else if (expMonth.isEmpty()) { + this.expMonth = Optional.empty(); + } else { + this.expMonth = Optional.of(expMonth.get()); + } + return this; + } + + /** + *

The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available.

+ */ + @JsonSetter(value = "exp_year", nulls = Nulls.SKIP) + public Builder expYear(Optional expYear) { + this.expYear = expYear; + return this; + } + + public Builder expYear(Integer expYear) { + this.expYear = Optional.ofNullable(expYear); + return this; + } + + public Builder expYear(Nullable expYear) { + if (expYear.isNull()) { + this.expYear = null; + } else if (expYear.isEmpty()) { + this.expYear = Optional.empty(); + } else { + this.expYear = Optional.of(expYear.get()); + } + return this; + } + + /** + *

A stable identifier for the underlying card. Two payment methods with the same fingerprint are the same card. Null if not available.

+ */ + @JsonSetter(value = "fingerprint", nulls = Nulls.SKIP) + public Builder fingerprint(Optional fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + public Builder fingerprint(String fingerprint) { + this.fingerprint = Optional.ofNullable(fingerprint); + return this; + } + + public Builder fingerprint(Nullable fingerprint) { + if (fingerprint.isNull()) { + this.fingerprint = null; + } else if (fingerprint.isEmpty()) { + this.fingerprint = Optional.empty(); + } else { + this.fingerprint = Optional.of(fingerprint.get()); + } + return this; + } + + /** + *

The last four digits of the card number. Null if not available.

+ */ + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public Builder last4(Optional last4) { + this.last4 = last4; + return this; + } + + public Builder last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + public Builder last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + public PaymentPaymentMethodCard build() { + return new PaymentPaymentMethodCard(brand, expMonth, expYear, fingerprint, last4, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentPlan.java b/src/main/java/com/whop/api/types/PaymentPlan.java new file mode 100644 index 00000000..1587ce41 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentPlan.java @@ -0,0 +1,274 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentPlan.Builder.class) +public final class PaymentPlan { + private final String id; + + private final Optional internalNotes; + + private final Optional> metadata; + + private final Map additionalProperties; + + private PaymentPlan( + String id, + Optional internalNotes, + Optional> metadata, + Map additionalProperties) { + this.id = id; + this.internalNotes = internalNotes; + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the plan. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A personal description or notes section for the business. + */ + @JsonIgnore + public Optional getInternalNotes() { + if (internalNotes == null) { + return Optional.empty(); + } + return internalNotes; + } + + /** + * @return Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("internal_notes") + private Optional _getInternalNotes() { + return internalNotes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentPlan && equalTo((PaymentPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentPlan other) { + return id.equals(other.id) && internalNotes.equals(other.internalNotes) && metadata.equals(other.metadata); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.internalNotes, this.metadata); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the plan.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PaymentPlan other); + } + + public interface _FinalStage { + PaymentPlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A personal description or notes section for the business.

+ */ + _FinalStage internalNotes(Optional internalNotes); + + _FinalStage internalNotes(String internalNotes); + + _FinalStage internalNotes(Nullable internalNotes); + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional> metadata = Optional.empty(); + + private Optional internalNotes = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentPlan other) { + id(other.getId()); + internalNotes(other.getInternalNotes()); + metadata(other.getMetadata()); + return this; + } + + /** + *

The unique identifier for the plan.

+ *

The unique identifier for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

A personal description or notes section for the business.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage internalNotes(Nullable internalNotes) { + if (internalNotes.isNull()) { + this.internalNotes = null; + } else if (internalNotes.isEmpty()) { + this.internalNotes = Optional.empty(); + } else { + this.internalNotes = Optional.of(internalNotes.get()); + } + return this; + } + + /** + *

A personal description or notes section for the business.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage internalNotes(String internalNotes) { + this.internalNotes = Optional.ofNullable(internalNotes); + return this; + } + + /** + *

A personal description or notes section for the business.

+ */ + @java.lang.Override + @JsonSetter(value = "internal_notes", nulls = Nulls.SKIP) + public _FinalStage internalNotes(Optional internalNotes) { + this.internalNotes = internalNotes; + return this; + } + + @java.lang.Override + public PaymentPlan build() { + return new PaymentPlan(id, internalNotes, metadata, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentProcessingDetails.java b/src/main/java/com/whop/api/types/PaymentProcessingDetails.java new file mode 100644 index 00000000..cabb84df --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentProcessingDetails.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentProcessingDetails.Builder.class) +public final class PaymentProcessingDetails { + private final Optional expectedBy; + + private final Map additionalProperties; + + private PaymentProcessingDetails(Optional expectedBy, Map additionalProperties) { + this.expectedBy = expectedBy; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the payment is expected to settle, as an ISO 8601 timestamp. + */ + @JsonIgnore + public Optional getExpectedBy() { + if (expectedBy == null) { + return Optional.empty(); + } + return expectedBy; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expected_by") + private Optional _getExpectedBy() { + return expectedBy; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentProcessingDetails && equalTo((PaymentProcessingDetails) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentProcessingDetails other) { + return expectedBy.equals(other.expectedBy); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.expectedBy); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional expectedBy = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentProcessingDetails other) { + expectedBy(other.getExpectedBy()); + return this; + } + + /** + *

When the payment is expected to settle, as an ISO 8601 timestamp.

+ */ + @JsonSetter(value = "expected_by", nulls = Nulls.SKIP) + public Builder expectedBy(Optional expectedBy) { + this.expectedBy = expectedBy; + return this; + } + + public Builder expectedBy(String expectedBy) { + this.expectedBy = Optional.ofNullable(expectedBy); + return this; + } + + public Builder expectedBy(Nullable expectedBy) { + if (expectedBy.isNull()) { + this.expectedBy = null; + } else if (expectedBy.isEmpty()) { + this.expectedBy = Optional.empty(); + } else { + this.expectedBy = Optional.of(expectedBy.get()); + } + return this; + } + + public PaymentProcessingDetails build() { + return new PaymentProcessingDetails(expectedBy, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentProduct.java b/src/main/java/com/whop/api/types/PaymentProduct.java new file mode 100644 index 00000000..2d000c5a --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentProduct.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentProduct.Builder.class) +public final class PaymentProduct { + private final String id; + + private final Optional> metadata; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private PaymentProduct( + String id, + Optional> metadata, + String route, + String title, + Map additionalProperties) { + this.id = id; + this.metadata = metadata; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the product. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return URL slug in the product's public link, e.g. pickaxe-analytics in whop.com/company/pickaxe-analytics. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return The display name of the product shown to customers on the product page and in search results. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentProduct && equalTo((PaymentProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentProduct other) { + return id.equals(other.id) + && metadata.equals(other.metadata) + && route.equals(other.route) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.metadata, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the product.

+ */ + RouteStage id(@NotNull String id); + + Builder from(PaymentProduct other); + } + + public interface RouteStage { + /** + *

URL slug in the product's public link, e.g. pickaxe-analytics in whop.com/company/pickaxe-analytics.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

The display name of the product shown to customers on the product page and in search results.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + PaymentProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + private Optional> metadata = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentProduct other) { + id(other.getId()); + metadata(other.getMetadata()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the product.

+ *

The unique identifier for the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

URL slug in the product's public link, e.g. pickaxe-analytics in whop.com/company/pickaxe-analytics.

+ *

URL slug in the product's public link, e.g. pickaxe-analytics in whop.com/company/pickaxe-analytics.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

The display name of the product shown to customers on the product page and in search results.

+ *

The display name of the product shown to customers on the product page and in search results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + @java.lang.Override + public PaymentProduct build() { + return new PaymentProduct(id, metadata, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentPromoCode.java b/src/main/java/com/whop/api/types/PaymentPromoCode.java new file mode 100644 index 00000000..8e9f395f --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentPromoCode.java @@ -0,0 +1,384 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentPromoCode.Builder.class) +public final class PaymentPromoCode { + private final double amountOff; + + private final Currencies baseCurrency; + + private final Optional code; + + private final String id; + + private final Optional numberOfIntervals; + + private final PromoTypes promoType; + + private final Map additionalProperties; + + private PaymentPromoCode( + double amountOff, + Currencies baseCurrency, + Optional code, + String id, + Optional numberOfIntervals, + PromoTypes promoType, + Map additionalProperties) { + this.amountOff = amountOff; + this.baseCurrency = baseCurrency; + this.code = code; + this.id = id; + this.numberOfIntervals = numberOfIntervals; + this.promoType = promoType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The discount amount. Interpretation depends on promo_type: if 'percentage', this is the percentage (e.g., 20 means 20% off); if 'flat_amount', this is dollars off (e.g., 10.00 means $10.00 off). + */ + @JsonProperty("amount_off") + public double getAmountOff() { + return amountOff; + } + + /** + * @return The monetary currency of the promo code. + */ + @JsonProperty("base_currency") + public Currencies getBaseCurrency() { + return baseCurrency; + } + + /** + * @return The specific code used to apply the promo at checkout. + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + /** + * @return The unique identifier for the promo code. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The number of months the promo is applied for. + */ + @JsonIgnore + public Optional getNumberOfIntervals() { + if (numberOfIntervals == null) { + return Optional.empty(); + } + return numberOfIntervals; + } + + /** + * @return The type (% or flat amount) of the promo. + */ + @JsonProperty("promo_type") + public PromoTypes getPromoType() { + return promoType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("number_of_intervals") + private Optional _getNumberOfIntervals() { + return numberOfIntervals; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentPromoCode && equalTo((PaymentPromoCode) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentPromoCode other) { + return amountOff == other.amountOff + && baseCurrency.equals(other.baseCurrency) + && code.equals(other.code) + && id.equals(other.id) + && numberOfIntervals.equals(other.numberOfIntervals) + && promoType.equals(other.promoType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amountOff, this.baseCurrency, this.code, this.id, this.numberOfIntervals, this.promoType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountOffStage builder() { + return new Builder(); + } + + public interface AmountOffStage { + /** + *

The discount amount. Interpretation depends on promo_type: if 'percentage', this is the percentage (e.g., 20 means 20% off); if 'flat_amount', this is dollars off (e.g., 10.00 means $10.00 off).

+ */ + BaseCurrencyStage amountOff(double amountOff); + + Builder from(PaymentPromoCode other); + } + + public interface BaseCurrencyStage { + /** + *

The monetary currency of the promo code.

+ */ + IdStage baseCurrency(@NotNull Currencies baseCurrency); + } + + public interface IdStage { + /** + *

The unique identifier for the promo code.

+ */ + PromoTypeStage id(@NotNull String id); + } + + public interface PromoTypeStage { + /** + *

The type (% or flat amount) of the promo.

+ */ + _FinalStage promoType(@NotNull PromoTypes promoType); + } + + public interface _FinalStage { + PaymentPromoCode build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The specific code used to apply the promo at checkout.

+ */ + _FinalStage code(Optional code); + + _FinalStage code(String code); + + _FinalStage code(Nullable code); + + /** + *

The number of months the promo is applied for.

+ */ + _FinalStage numberOfIntervals(Optional numberOfIntervals); + + _FinalStage numberOfIntervals(Integer numberOfIntervals); + + _FinalStage numberOfIntervals(Nullable numberOfIntervals); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountOffStage, BaseCurrencyStage, IdStage, PromoTypeStage, _FinalStage { + private double amountOff; + + private Currencies baseCurrency; + + private String id; + + private PromoTypes promoType; + + private Optional numberOfIntervals = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentPromoCode other) { + amountOff(other.getAmountOff()); + baseCurrency(other.getBaseCurrency()); + code(other.getCode()); + id(other.getId()); + numberOfIntervals(other.getNumberOfIntervals()); + promoType(other.getPromoType()); + return this; + } + + /** + *

The discount amount. Interpretation depends on promo_type: if 'percentage', this is the percentage (e.g., 20 means 20% off); if 'flat_amount', this is dollars off (e.g., 10.00 means $10.00 off).

+ *

The discount amount. Interpretation depends on promo_type: if 'percentage', this is the percentage (e.g., 20 means 20% off); if 'flat_amount', this is dollars off (e.g., 10.00 means $10.00 off).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount_off") + public BaseCurrencyStage amountOff(double amountOff) { + this.amountOff = amountOff; + return this; + } + + /** + *

The monetary currency of the promo code.

+ *

The monetary currency of the promo code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("base_currency") + public IdStage baseCurrency(@NotNull Currencies baseCurrency) { + this.baseCurrency = Objects.requireNonNull(baseCurrency, "baseCurrency must not be null"); + return this; + } + + /** + *

The unique identifier for the promo code.

+ *

The unique identifier for the promo code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PromoTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The type (% or flat amount) of the promo.

+ *

The type (% or flat amount) of the promo.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("promo_type") + public _FinalStage promoType(@NotNull PromoTypes promoType) { + this.promoType = Objects.requireNonNull(promoType, "promoType must not be null"); + return this; + } + + /** + *

The number of months the promo is applied for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numberOfIntervals(Nullable numberOfIntervals) { + if (numberOfIntervals.isNull()) { + this.numberOfIntervals = null; + } else if (numberOfIntervals.isEmpty()) { + this.numberOfIntervals = Optional.empty(); + } else { + this.numberOfIntervals = Optional.of(numberOfIntervals.get()); + } + return this; + } + + /** + *

The number of months the promo is applied for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numberOfIntervals(Integer numberOfIntervals) { + this.numberOfIntervals = Optional.ofNullable(numberOfIntervals); + return this; + } + + /** + *

The number of months the promo is applied for.

+ */ + @java.lang.Override + @JsonSetter(value = "number_of_intervals", nulls = Nulls.SKIP) + public _FinalStage numberOfIntervals(Optional numberOfIntervals) { + this.numberOfIntervals = numberOfIntervals; + return this; + } + + /** + *

The specific code used to apply the promo at checkout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

The specific code used to apply the promo at checkout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

The specific code used to apply the promo at checkout.

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public PaymentPromoCode build() { + return new PaymentPromoCode( + amountOff, baseCurrency, code, id, numberOfIntervals, promoType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentProviders.java b/src/main/java/com/whop/api/types/PaymentProviders.java new file mode 100644 index 00000000..b0b32ce8 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentProviders.java @@ -0,0 +1,235 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PaymentProviders { + public static final PaymentProviders COINFLOW = new PaymentProviders(Value.COINFLOW, "coinflow"); + + public static final PaymentProviders ADYEN = new PaymentProviders(Value.ADYEN, "adyen"); + + public static final PaymentProviders APPLE = new PaymentProviders(Value.APPLE, "apple"); + + public static final PaymentProviders CLARITYPAY = new PaymentProviders(Value.CLARITYPAY, "claritypay"); + + public static final PaymentProviders CHECKOUT_DOT_COM = + new PaymentProviders(Value.CHECKOUT_DOT_COM, "checkout_dot_com"); + + public static final PaymentProviders DLOCAL = new PaymentProviders(Value.DLOCAL, "dlocal"); + + public static final PaymentProviders MULTI_PSP = new PaymentProviders(Value.MULTI_PSP, "multi_psp"); + + public static final PaymentProviders SPLITIT = new PaymentProviders(Value.SPLITIT, "splitit"); + + public static final PaymentProviders SEZZLE = new PaymentProviders(Value.SEZZLE, "sezzle"); + + public static final PaymentProviders MASSPAY = new PaymentProviders(Value.MASSPAY, "masspay"); + + public static final PaymentProviders PAYPAL = new PaymentProviders(Value.PAYPAL, "paypal"); + + public static final PaymentProviders SEQURA = new PaymentProviders(Value.SEQURA, "sequra"); + + public static final PaymentProviders COINBASE = new PaymentProviders(Value.COINBASE, "coinbase"); + + public static final PaymentProviders PLATFORM_BALANCE = + new PaymentProviders(Value.PLATFORM_BALANCE, "platform_balance"); + + public static final PaymentProviders BRAINTREE = new PaymentProviders(Value.BRAINTREE, "braintree"); + + public static final PaymentProviders STRIPE = new PaymentProviders(Value.STRIPE, "stripe"); + + public static final PaymentProviders AIRWALLEX = new PaymentProviders(Value.AIRWALLEX, "airwallex"); + + private final Value value; + + private final String string; + + PaymentProviders(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PaymentProviders && this.string.equals(((PaymentProviders) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case COINFLOW: + return visitor.visitCoinflow(); + case ADYEN: + return visitor.visitAdyen(); + case APPLE: + return visitor.visitApple(); + case CLARITYPAY: + return visitor.visitClaritypay(); + case CHECKOUT_DOT_COM: + return visitor.visitCheckoutDotCom(); + case DLOCAL: + return visitor.visitDlocal(); + case MULTI_PSP: + return visitor.visitMultiPsp(); + case SPLITIT: + return visitor.visitSplitit(); + case SEZZLE: + return visitor.visitSezzle(); + case MASSPAY: + return visitor.visitMasspay(); + case PAYPAL: + return visitor.visitPaypal(); + case SEQURA: + return visitor.visitSequra(); + case COINBASE: + return visitor.visitCoinbase(); + case PLATFORM_BALANCE: + return visitor.visitPlatformBalance(); + case BRAINTREE: + return visitor.visitBraintree(); + case STRIPE: + return visitor.visitStripe(); + case AIRWALLEX: + return visitor.visitAirwallex(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PaymentProviders valueOf(String value) { + switch (value) { + case "coinflow": + return COINFLOW; + case "adyen": + return ADYEN; + case "apple": + return APPLE; + case "claritypay": + return CLARITYPAY; + case "checkout_dot_com": + return CHECKOUT_DOT_COM; + case "dlocal": + return DLOCAL; + case "multi_psp": + return MULTI_PSP; + case "splitit": + return SPLITIT; + case "sezzle": + return SEZZLE; + case "masspay": + return MASSPAY; + case "paypal": + return PAYPAL; + case "sequra": + return SEQURA; + case "coinbase": + return COINBASE; + case "platform_balance": + return PLATFORM_BALANCE; + case "braintree": + return BRAINTREE; + case "stripe": + return STRIPE; + case "airwallex": + return AIRWALLEX; + default: + return new PaymentProviders(Value.UNKNOWN, value); + } + } + + public enum Value { + STRIPE, + + COINBASE, + + PAYPAL, + + APPLE, + + SEZZLE, + + SPLITIT, + + PLATFORM_BALANCE, + + MULTI_PSP, + + ADYEN, + + CLARITYPAY, + + CHECKOUT_DOT_COM, + + AIRWALLEX, + + COINFLOW, + + SEQURA, + + DLOCAL, + + MASSPAY, + + BRAINTREE, + + UNKNOWN + } + + public interface Visitor { + T visitStripe(); + + T visitCoinbase(); + + T visitPaypal(); + + T visitApple(); + + T visitSezzle(); + + T visitSplitit(); + + T visitPlatformBalance(); + + T visitMultiPsp(); + + T visitAdyen(); + + T visitClaritypay(); + + T visitCheckoutDotCom(); + + T visitAirwallex(); + + T visitCoinflow(); + + T visitSequra(); + + T visitDlocal(); + + T visitMasspay(); + + T visitBraintree(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PaymentQr.java b/src/main/java/com/whop/api/types/PaymentQr.java new file mode 100644 index 00000000..034713d1 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentQr.java @@ -0,0 +1,263 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentQr.Builder.class) +public final class PaymentQr { + private final Optional amount; + + private final Optional documentUrl; + + private final Optional expiresAt; + + private final Optional key; + + private final Optional qrCode; + + private final Optional qrFormat; + + private final Map additionalProperties; + + private PaymentQr( + Optional amount, + Optional documentUrl, + Optional expiresAt, + Optional key, + Optional qrCode, + Optional qrFormat, + Map additionalProperties) { + this.amount = amount; + this.documentUrl = documentUrl; + this.expiresAt = expiresAt; + this.key = key; + this.qrCode = qrCode; + this.qrFormat = qrFormat; + this.additionalProperties = additionalProperties; + } + + /** + * @return Exactly what the buyer must pay, in the charged currency. + */ + @JsonProperty("amount") + public Optional getAmount() { + return amount; + } + + /** + * @return A hosted page with the complete, printable instructions. If you would rather not render the details yourself, send the buyer here. + */ + @JsonProperty("document_url") + public Optional getDocumentUrl() { + return documentUrl; + } + + /** + * @return When the code stops being payable, as an ISO 8601 timestamp. + */ + @JsonProperty("expires_at") + public Optional getExpiresAt() { + return expiresAt; + } + + /** + * @return An account key the buyer can pay to directly (Colombia's Bre-B llave), for apps that take a key instead of a scan. + */ + @JsonProperty("key") + public Optional getKey() { + return key; + } + + /** + * @return The QR code's contents, ready to render as a scannable image — qr_format says how it is encoded. + */ + @JsonProperty("qr_code") + public Optional getQrCode() { + return qrCode; + } + + /** + * @return How qr_code is encoded. + */ + @JsonProperty("qr_format") + public Optional getQrFormat() { + return qrFormat; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentQr && equalTo((PaymentQr) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentQr other) { + return amount.equals(other.amount) + && documentUrl.equals(other.documentUrl) + && expiresAt.equals(other.expiresAt) + && key.equals(other.key) + && qrCode.equals(other.qrCode) + && qrFormat.equals(other.qrFormat); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.documentUrl, this.expiresAt, this.key, this.qrCode, this.qrFormat); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional amount = Optional.empty(); + + private Optional documentUrl = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + private Optional key = Optional.empty(); + + private Optional qrCode = Optional.empty(); + + private Optional qrFormat = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentQr other) { + amount(other.getAmount()); + documentUrl(other.getDocumentUrl()); + expiresAt(other.getExpiresAt()); + key(other.getKey()); + qrCode(other.getQrCode()); + qrFormat(other.getQrFormat()); + return this; + } + + /** + *

Exactly what the buyer must pay, in the charged currency.

+ */ + @JsonSetter(value = "amount", nulls = Nulls.SKIP) + public Builder amount(Optional amount) { + this.amount = amount; + return this; + } + + public Builder amount(Money amount) { + this.amount = Optional.ofNullable(amount); + return this; + } + + /** + *

A hosted page with the complete, printable instructions. If you would rather not render the details yourself, send the buyer here.

+ */ + @JsonSetter(value = "document_url", nulls = Nulls.SKIP) + public Builder documentUrl(Optional documentUrl) { + this.documentUrl = documentUrl; + return this; + } + + public Builder documentUrl(String documentUrl) { + this.documentUrl = Optional.ofNullable(documentUrl); + return this; + } + + /** + *

When the code stops being payable, as an ISO 8601 timestamp.

+ */ + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public Builder expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + public Builder expiresAt(String expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + /** + *

An account key the buyer can pay to directly (Colombia's Bre-B llave), for apps that take a key instead of a scan.

+ */ + @JsonSetter(value = "key", nulls = Nulls.SKIP) + public Builder key(Optional key) { + this.key = key; + return this; + } + + public Builder key(String key) { + this.key = Optional.ofNullable(key); + return this; + } + + /** + *

The QR code's contents, ready to render as a scannable image — qr_format says how it is encoded.

+ */ + @JsonSetter(value = "qr_code", nulls = Nulls.SKIP) + public Builder qrCode(Optional qrCode) { + this.qrCode = qrCode; + return this; + } + + public Builder qrCode(String qrCode) { + this.qrCode = Optional.ofNullable(qrCode); + return this; + } + + /** + *

How qr_code is encoded.

+ */ + @JsonSetter(value = "qr_format", nulls = Nulls.SKIP) + public Builder qrFormat(Optional qrFormat) { + this.qrFormat = qrFormat; + return this; + } + + public Builder qrFormat(String qrFormat) { + this.qrFormat = Optional.ofNullable(qrFormat); + return this; + } + + public PaymentQr build() { + return new PaymentQr(amount, documentUrl, expiresAt, key, qrCode, qrFormat, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentQrInstructions.java b/src/main/java/com/whop/api/types/PaymentQrInstructions.java new file mode 100644 index 00000000..dd12f9d5 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentQrInstructions.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentQrInstructions.Builder.class) +public final class PaymentQrInstructions { + private final PaymentQr qr; + + private final Map additionalProperties; + + private PaymentQrInstructions(PaymentQr qr, Map additionalProperties) { + this.qr = qr; + this.additionalProperties = additionalProperties; + } + + /** + * @return The code to show. + */ + @JsonProperty("qr") + public PaymentQr getQr() { + return qr; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentQrInstructions && equalTo((PaymentQrInstructions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentQrInstructions other) { + return qr.equals(other.qr); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.qr); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static QrStage builder() { + return new Builder(); + } + + public interface QrStage { + /** + *

The code to show.

+ */ + _FinalStage qr(@NotNull PaymentQr qr); + + Builder from(PaymentQrInstructions other); + } + + public interface _FinalStage { + PaymentQrInstructions build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements QrStage, _FinalStage { + private PaymentQr qr; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentQrInstructions other) { + qr(other.getQr()); + return this; + } + + /** + *

The code to show.

+ *

The code to show.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("qr") + public _FinalStage qr(@NotNull PaymentQr qr) { + this.qr = Objects.requireNonNull(qr, "qr must not be null"); + return this; + } + + @java.lang.Override + public PaymentQrInstructions build() { + return new PaymentQrInstructions(qr, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentRefundsItem.java b/src/main/java/com/whop/api/types/PaymentRefundsItem.java new file mode 100644 index 00000000..82e273fc --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentRefundsItem.java @@ -0,0 +1,273 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentRefundsItem.Builder.class) +public final class PaymentRefundsItem { + private final double amount; + + private final OffsetDateTime createdAt; + + private final Currencies currency; + + private final String id; + + private final RefundStatuses status; + + private final Map additionalProperties; + + private PaymentRefundsItem( + double amount, + OffsetDateTime createdAt, + Currencies currency, + String id, + RefundStatuses status, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.currency = currency; + this.id = id; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The refunded amount as a decimal in the specified currency, such as 10.43 for $10.43 USD. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The datetime the refund was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code for the refunded amount. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The unique identifier for the refund. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The current processing status of the refund, such as pending, succeeded, or failed. + */ + @JsonProperty("status") + public RefundStatuses getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentRefundsItem && equalTo((PaymentRefundsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentRefundsItem other) { + return amount == other.amount + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && id.equals(other.id) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.createdAt, this.currency, this.id, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The refunded amount as a decimal in the specified currency, such as 10.43 for $10.43 USD.

+ */ + CreatedAtStage amount(double amount); + + Builder from(PaymentRefundsItem other); + } + + public interface CreatedAtStage { + /** + *

The datetime the refund was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

The three-letter ISO currency code for the refunded amount.

+ */ + IdStage currency(@NotNull Currencies currency); + } + + public interface IdStage { + /** + *

The unique identifier for the refund.

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

The current processing status of the refund, such as pending, succeeded, or failed.

+ */ + _FinalStage status(@NotNull RefundStatuses status); + } + + public interface _FinalStage { + PaymentRefundsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, CreatedAtStage, CurrencyStage, IdStage, StatusStage, _FinalStage { + private double amount; + + private OffsetDateTime createdAt; + + private Currencies currency; + + private String id; + + private RefundStatuses status; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentRefundsItem other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + id(other.getId()); + status(other.getStatus()); + return this; + } + + /** + *

The refunded amount as a decimal in the specified currency, such as 10.43 for $10.43 USD.

+ *

The refunded amount as a decimal in the specified currency, such as 10.43 for $10.43 USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The datetime the refund was created.

+ *

The datetime the refund was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The three-letter ISO currency code for the refunded amount.

+ *

The three-letter ISO currency code for the refunded amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier for the refund.

+ *

The unique identifier for the refund.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current processing status of the refund, such as pending, succeeded, or failed.

+ *

The current processing status of the refund, such as pending, succeeded, or failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull RefundStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + public PaymentRefundsItem build() { + return new PaymentRefundsItem(amount, createdAt, currency, id, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentRequiredErrorBody.java b/src/main/java/com/whop/api/types/PaymentRequiredErrorBody.java new file mode 100644 index 00000000..b143c1b7 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentRequiredErrorBody.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentRequiredErrorBody.Builder.class) +public final class PaymentRequiredErrorBody { + private final PaymentRequiredErrorBodyError error; + + private final Map additionalProperties; + + private PaymentRequiredErrorBody(PaymentRequiredErrorBodyError error, Map additionalProperties) { + this.error = error; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("error") + public PaymentRequiredErrorBodyError getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentRequiredErrorBody && equalTo((PaymentRequiredErrorBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentRequiredErrorBody other) { + return error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + _FinalStage error(@NotNull PaymentRequiredErrorBodyError error); + + Builder from(PaymentRequiredErrorBody other); + } + + public interface _FinalStage { + PaymentRequiredErrorBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private PaymentRequiredErrorBodyError error; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentRequiredErrorBody other) { + error(other.getError()); + return this; + } + + @java.lang.Override + @JsonSetter("error") + public _FinalStage error(@NotNull PaymentRequiredErrorBodyError error) { + this.error = Objects.requireNonNull(error, "error must not be null"); + return this; + } + + @java.lang.Override + public PaymentRequiredErrorBody build() { + return new PaymentRequiredErrorBody(error, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentRequiredErrorBodyError.java b/src/main/java/com/whop/api/types/PaymentRequiredErrorBodyError.java new file mode 100644 index 00000000..c783d8f4 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentRequiredErrorBodyError.java @@ -0,0 +1,177 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentRequiredErrorBodyError.Builder.class) +public final class PaymentRequiredErrorBodyError { + private final String depositUrl; + + private final String message; + + private final PaymentRequiredErrorBodyErrorType type; + + private final Map additionalProperties; + + private PaymentRequiredErrorBodyError( + String depositUrl, + String message, + PaymentRequiredErrorBodyErrorType type, + Map additionalProperties) { + this.depositUrl = depositUrl; + this.message = message; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Hosted page where the account can deposit funds before retrying. + */ + @JsonProperty("deposit_url") + public String getDepositUrl() { + return depositUrl; + } + + @JsonProperty("message") + public String getMessage() { + return message; + } + + @JsonProperty("type") + public PaymentRequiredErrorBodyErrorType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentRequiredErrorBodyError && equalTo((PaymentRequiredErrorBodyError) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentRequiredErrorBodyError other) { + return depositUrl.equals(other.depositUrl) && message.equals(other.message) && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.depositUrl, this.message, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DepositUrlStage builder() { + return new Builder(); + } + + public interface DepositUrlStage { + /** + *

Hosted page where the account can deposit funds before retrying.

+ */ + MessageStage depositUrl(@NotNull String depositUrl); + + Builder from(PaymentRequiredErrorBodyError other); + } + + public interface MessageStage { + TypeStage message(@NotNull String message); + } + + public interface TypeStage { + _FinalStage type(@NotNull PaymentRequiredErrorBodyErrorType type); + } + + public interface _FinalStage { + PaymentRequiredErrorBodyError build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DepositUrlStage, MessageStage, TypeStage, _FinalStage { + private String depositUrl; + + private String message; + + private PaymentRequiredErrorBodyErrorType type; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentRequiredErrorBodyError other) { + depositUrl(other.getDepositUrl()); + message(other.getMessage()); + type(other.getType()); + return this; + } + + /** + *

Hosted page where the account can deposit funds before retrying.

+ *

Hosted page where the account can deposit funds before retrying.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("deposit_url") + public MessageStage depositUrl(@NotNull String depositUrl) { + this.depositUrl = Objects.requireNonNull(depositUrl, "depositUrl must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("message") + public TypeStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull PaymentRequiredErrorBodyErrorType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public PaymentRequiredErrorBodyError build() { + return new PaymentRequiredErrorBodyError(depositUrl, message, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentRequiredErrorBodyErrorType.java b/src/main/java/com/whop/api/types/PaymentRequiredErrorBodyErrorType.java new file mode 100644 index 00000000..ed76ede0 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentRequiredErrorBodyErrorType.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PaymentRequiredErrorBodyErrorType { + public static final PaymentRequiredErrorBodyErrorType PAYMENT_REQUIRED = + new PaymentRequiredErrorBodyErrorType(Value.PAYMENT_REQUIRED, "payment_required"); + + private final Value value; + + private final String string; + + PaymentRequiredErrorBodyErrorType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PaymentRequiredErrorBodyErrorType + && this.string.equals(((PaymentRequiredErrorBodyErrorType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAYMENT_REQUIRED: + return visitor.visitPaymentRequired(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PaymentRequiredErrorBodyErrorType valueOf(String value) { + switch (value) { + case "payment_required": + return PAYMENT_REQUIRED; + default: + return new PaymentRequiredErrorBodyErrorType(Value.UNKNOWN, value); + } + } + + public enum Value { + PAYMENT_REQUIRED, + + UNKNOWN + } + + public interface Visitor { + T visitPaymentRequired(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PaymentResolutionsItem.java b/src/main/java/com/whop/api/types/PaymentResolutionsItem.java new file mode 100644 index 00000000..d1f5fdfb --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentResolutionsItem.java @@ -0,0 +1,555 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentResolutionsItem.Builder.class) +public final class PaymentResolutionsItem { + private final boolean customerAppealed; + + private final List customerResponseActions; + + private final Optional dueDate; + + private final String id; + + private final ResolutionCenterCaseIssueTypes issue; + + private final boolean merchantAppealed; + + private final List merchantResponseActions; + + private final List platformResponseActions; + + private final ResolutionCenterCaseStatuses status; + + private final Map additionalProperties; + + private PaymentResolutionsItem( + boolean customerAppealed, + List customerResponseActions, + Optional dueDate, + String id, + ResolutionCenterCaseIssueTypes issue, + boolean merchantAppealed, + List merchantResponseActions, + List platformResponseActions, + ResolutionCenterCaseStatuses status, + Map additionalProperties) { + this.customerAppealed = customerAppealed; + this.customerResponseActions = customerResponseActions; + this.dueDate = dueDate; + this.id = id; + this.issue = issue; + this.merchantAppealed = merchantAppealed; + this.merchantResponseActions = merchantResponseActions; + this.platformResponseActions = platformResponseActions; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the customer has filed an appeal after the initial resolution decision. + */ + @JsonProperty("customer_appealed") + public boolean getCustomerAppealed() { + return customerAppealed; + } + + /** + * @return The list of actions currently available to the customer. + */ + @JsonProperty("customer_response_actions") + public List getCustomerResponseActions() { + return customerResponseActions; + } + + /** + * @return The deadline by which the next response is required. Null if no deadline is currently active. As a Unix timestamp. + */ + @JsonIgnore + public Optional getDueDate() { + if (dueDate == null) { + return Optional.empty(); + } + return dueDate; + } + + /** + * @return The unique identifier for the resolution. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The category of the dispute. + */ + @JsonProperty("issue") + public ResolutionCenterCaseIssueTypes getIssue() { + return issue; + } + + /** + * @return Whether the merchant has filed an appeal after the initial resolution decision. + */ + @JsonProperty("merchant_appealed") + public boolean getMerchantAppealed() { + return merchantAppealed; + } + + /** + * @return The list of actions currently available to the merchant. + */ + @JsonProperty("merchant_response_actions") + public List getMerchantResponseActions() { + return merchantResponseActions; + } + + /** + * @return The list of actions currently available to the Whop platform for moderating this resolution. + */ + @JsonProperty("platform_response_actions") + public List getPlatformResponseActions() { + return platformResponseActions; + } + + /** + * @return The current status of the resolution case, indicating which party needs to respond or if the case is closed. + */ + @JsonProperty("status") + public ResolutionCenterCaseStatuses getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("due_date") + private Optional _getDueDate() { + return dueDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentResolutionsItem && equalTo((PaymentResolutionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentResolutionsItem other) { + return customerAppealed == other.customerAppealed + && customerResponseActions.equals(other.customerResponseActions) + && dueDate.equals(other.dueDate) + && id.equals(other.id) + && issue.equals(other.issue) + && merchantAppealed == other.merchantAppealed + && merchantResponseActions.equals(other.merchantResponseActions) + && platformResponseActions.equals(other.platformResponseActions) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.customerAppealed, + this.customerResponseActions, + this.dueDate, + this.id, + this.issue, + this.merchantAppealed, + this.merchantResponseActions, + this.platformResponseActions, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CustomerAppealedStage builder() { + return new Builder(); + } + + public interface CustomerAppealedStage { + /** + *

Whether the customer has filed an appeal after the initial resolution decision.

+ */ + IdStage customerAppealed(boolean customerAppealed); + + Builder from(PaymentResolutionsItem other); + } + + public interface IdStage { + /** + *

The unique identifier for the resolution.

+ */ + IssueStage id(@NotNull String id); + } + + public interface IssueStage { + /** + *

The category of the dispute.

+ */ + MerchantAppealedStage issue(@NotNull ResolutionCenterCaseIssueTypes issue); + } + + public interface MerchantAppealedStage { + /** + *

Whether the merchant has filed an appeal after the initial resolution decision.

+ */ + StatusStage merchantAppealed(boolean merchantAppealed); + } + + public interface StatusStage { + /** + *

The current status of the resolution case, indicating which party needs to respond or if the case is closed.

+ */ + _FinalStage status(@NotNull ResolutionCenterCaseStatuses status); + } + + public interface _FinalStage { + PaymentResolutionsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The list of actions currently available to the customer.

+ */ + _FinalStage customerResponseActions(List customerResponseActions); + + _FinalStage addCustomerResponseActions(ResolutionCenterCaseCustomerResponses customerResponseActions); + + _FinalStage addAllCustomerResponseActions(List customerResponseActions); + + /** + *

The deadline by which the next response is required. Null if no deadline is currently active. As a Unix timestamp.

+ */ + _FinalStage dueDate(Optional dueDate); + + _FinalStage dueDate(OffsetDateTime dueDate); + + _FinalStage dueDate(Nullable dueDate); + + /** + *

The list of actions currently available to the merchant.

+ */ + _FinalStage merchantResponseActions(List merchantResponseActions); + + _FinalStage addMerchantResponseActions(ResolutionCenterCaseMerchantResponses merchantResponseActions); + + _FinalStage addAllMerchantResponseActions(List merchantResponseActions); + + /** + *

The list of actions currently available to the Whop platform for moderating this resolution.

+ */ + _FinalStage platformResponseActions(List platformResponseActions); + + _FinalStage addPlatformResponseActions(ResolutionCenterCasePlatformResponses platformResponseActions); + + _FinalStage addAllPlatformResponseActions(List platformResponseActions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CustomerAppealedStage, IdStage, IssueStage, MerchantAppealedStage, StatusStage, _FinalStage { + private boolean customerAppealed; + + private String id; + + private ResolutionCenterCaseIssueTypes issue; + + private boolean merchantAppealed; + + private ResolutionCenterCaseStatuses status; + + private List platformResponseActions = new ArrayList<>(); + + private List merchantResponseActions = new ArrayList<>(); + + private Optional dueDate = Optional.empty(); + + private List customerResponseActions = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentResolutionsItem other) { + customerAppealed(other.getCustomerAppealed()); + customerResponseActions(other.getCustomerResponseActions()); + dueDate(other.getDueDate()); + id(other.getId()); + issue(other.getIssue()); + merchantAppealed(other.getMerchantAppealed()); + merchantResponseActions(other.getMerchantResponseActions()); + platformResponseActions(other.getPlatformResponseActions()); + status(other.getStatus()); + return this; + } + + /** + *

Whether the customer has filed an appeal after the initial resolution decision.

+ *

Whether the customer has filed an appeal after the initial resolution decision.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("customer_appealed") + public IdStage customerAppealed(boolean customerAppealed) { + this.customerAppealed = customerAppealed; + return this; + } + + /** + *

The unique identifier for the resolution.

+ *

The unique identifier for the resolution.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IssueStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The category of the dispute.

+ *

The category of the dispute.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("issue") + public MerchantAppealedStage issue(@NotNull ResolutionCenterCaseIssueTypes issue) { + this.issue = Objects.requireNonNull(issue, "issue must not be null"); + return this; + } + + /** + *

Whether the merchant has filed an appeal after the initial resolution decision.

+ *

Whether the merchant has filed an appeal after the initial resolution decision.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("merchant_appealed") + public StatusStage merchantAppealed(boolean merchantAppealed) { + this.merchantAppealed = merchantAppealed; + return this; + } + + /** + *

The current status of the resolution case, indicating which party needs to respond or if the case is closed.

+ *

The current status of the resolution case, indicating which party needs to respond or if the case is closed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull ResolutionCenterCaseStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The list of actions currently available to the Whop platform for moderating this resolution.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllPlatformResponseActions( + List platformResponseActions) { + if (platformResponseActions != null) { + this.platformResponseActions.addAll(platformResponseActions); + } + return this; + } + + /** + *

The list of actions currently available to the Whop platform for moderating this resolution.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addPlatformResponseActions(ResolutionCenterCasePlatformResponses platformResponseActions) { + this.platformResponseActions.add(platformResponseActions); + return this; + } + + /** + *

The list of actions currently available to the Whop platform for moderating this resolution.

+ */ + @java.lang.Override + @JsonSetter(value = "platform_response_actions", nulls = Nulls.SKIP) + public _FinalStage platformResponseActions( + List platformResponseActions) { + this.platformResponseActions.clear(); + if (platformResponseActions != null) { + this.platformResponseActions.addAll(platformResponseActions); + } + return this; + } + + /** + *

The list of actions currently available to the merchant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllMerchantResponseActions( + List merchantResponseActions) { + if (merchantResponseActions != null) { + this.merchantResponseActions.addAll(merchantResponseActions); + } + return this; + } + + /** + *

The list of actions currently available to the merchant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addMerchantResponseActions(ResolutionCenterCaseMerchantResponses merchantResponseActions) { + this.merchantResponseActions.add(merchantResponseActions); + return this; + } + + /** + *

The list of actions currently available to the merchant.

+ */ + @java.lang.Override + @JsonSetter(value = "merchant_response_actions", nulls = Nulls.SKIP) + public _FinalStage merchantResponseActions( + List merchantResponseActions) { + this.merchantResponseActions.clear(); + if (merchantResponseActions != null) { + this.merchantResponseActions.addAll(merchantResponseActions); + } + return this; + } + + /** + *

The deadline by which the next response is required. Null if no deadline is currently active. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dueDate(Nullable dueDate) { + if (dueDate.isNull()) { + this.dueDate = null; + } else if (dueDate.isEmpty()) { + this.dueDate = Optional.empty(); + } else { + this.dueDate = Optional.of(dueDate.get()); + } + return this; + } + + /** + *

The deadline by which the next response is required. Null if no deadline is currently active. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dueDate(OffsetDateTime dueDate) { + this.dueDate = Optional.ofNullable(dueDate); + return this; + } + + /** + *

The deadline by which the next response is required. Null if no deadline is currently active. As a Unix timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "due_date", nulls = Nulls.SKIP) + public _FinalStage dueDate(Optional dueDate) { + this.dueDate = dueDate; + return this; + } + + /** + *

The list of actions currently available to the customer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllCustomerResponseActions( + List customerResponseActions) { + if (customerResponseActions != null) { + this.customerResponseActions.addAll(customerResponseActions); + } + return this; + } + + /** + *

The list of actions currently available to the customer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addCustomerResponseActions(ResolutionCenterCaseCustomerResponses customerResponseActions) { + this.customerResponseActions.add(customerResponseActions); + return this; + } + + /** + *

The list of actions currently available to the customer.

+ */ + @java.lang.Override + @JsonSetter(value = "customer_response_actions", nulls = Nulls.SKIP) + public _FinalStage customerResponseActions( + List customerResponseActions) { + this.customerResponseActions.clear(); + if (customerResponseActions != null) { + this.customerResponseActions.addAll(customerResponseActions); + } + return this; + } + + @java.lang.Override + public PaymentResolutionsItem build() { + return new PaymentResolutionsItem( + customerAppealed, + customerResponseActions, + dueDate, + id, + issue, + merchantAppealed, + merchantResponseActions, + platformResponseActions, + status, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentShipment.java b/src/main/java/com/whop/api/types/PaymentShipment.java new file mode 100644 index 00000000..85b2071e --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentShipment.java @@ -0,0 +1,312 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentShipment.Builder.class) +public final class PaymentShipment { + private final Optional carrier; + + private final String id; + + private final ShipmentStatuses status; + + private final String trackingNumber; + + private final String trackingUrl; + + private final Map additionalProperties; + + private PaymentShipment( + Optional carrier, + String id, + ShipmentStatuses status, + String trackingNumber, + String trackingUrl, + Map additionalProperties) { + this.carrier = carrier; + this.id = id; + this.status = status; + this.trackingNumber = trackingNumber; + this.trackingUrl = trackingUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The shipping carrier detected for this shipment. Null until a tracking update identifies it. + */ + @JsonIgnore + public Optional getCarrier() { + if (carrier == null) { + return Optional.empty(); + } + return carrier; + } + + /** + * @return The unique identifier for the shipment. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The current delivery status of this shipment. + */ + @JsonProperty("status") + public ShipmentStatuses getStatus() { + return status; + } + + /** + * @return The carrier-assigned tracking number used to look up shipment progress. + */ + @JsonProperty("tracking_number") + public String getTrackingNumber() { + return trackingNumber; + } + + /** + * @return A customer-facing URL to track this shipment's progress. + */ + @JsonProperty("tracking_url") + public String getTrackingUrl() { + return trackingUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("carrier") + private Optional _getCarrier() { + return carrier; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentShipment && equalTo((PaymentShipment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentShipment other) { + return carrier.equals(other.carrier) + && id.equals(other.id) + && status.equals(other.status) + && trackingNumber.equals(other.trackingNumber) + && trackingUrl.equals(other.trackingUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.carrier, this.id, this.status, this.trackingNumber, this.trackingUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the shipment.

+ */ + StatusStage id(@NotNull String id); + + Builder from(PaymentShipment other); + } + + public interface StatusStage { + /** + *

The current delivery status of this shipment.

+ */ + TrackingNumberStage status(@NotNull ShipmentStatuses status); + } + + public interface TrackingNumberStage { + /** + *

The carrier-assigned tracking number used to look up shipment progress.

+ */ + TrackingUrlStage trackingNumber(@NotNull String trackingNumber); + } + + public interface TrackingUrlStage { + /** + *

A customer-facing URL to track this shipment's progress.

+ */ + _FinalStage trackingUrl(@NotNull String trackingUrl); + } + + public interface _FinalStage { + PaymentShipment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The shipping carrier detected for this shipment. Null until a tracking update identifies it.

+ */ + _FinalStage carrier(Optional carrier); + + _FinalStage carrier(String carrier); + + _FinalStage carrier(Nullable carrier); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, StatusStage, TrackingNumberStage, TrackingUrlStage, _FinalStage { + private String id; + + private ShipmentStatuses status; + + private String trackingNumber; + + private String trackingUrl; + + private Optional carrier = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentShipment other) { + carrier(other.getCarrier()); + id(other.getId()); + status(other.getStatus()); + trackingNumber(other.getTrackingNumber()); + trackingUrl(other.getTrackingUrl()); + return this; + } + + /** + *

The unique identifier for the shipment.

+ *

The unique identifier for the shipment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current delivery status of this shipment.

+ *

The current delivery status of this shipment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TrackingNumberStage status(@NotNull ShipmentStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The carrier-assigned tracking number used to look up shipment progress.

+ *

The carrier-assigned tracking number used to look up shipment progress.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tracking_number") + public TrackingUrlStage trackingNumber(@NotNull String trackingNumber) { + this.trackingNumber = Objects.requireNonNull(trackingNumber, "trackingNumber must not be null"); + return this; + } + + /** + *

A customer-facing URL to track this shipment's progress.

+ *

A customer-facing URL to track this shipment's progress.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tracking_url") + public _FinalStage trackingUrl(@NotNull String trackingUrl) { + this.trackingUrl = Objects.requireNonNull(trackingUrl, "trackingUrl must not be null"); + return this; + } + + /** + *

The shipping carrier detected for this shipment. Null until a tracking update identifies it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage carrier(Nullable carrier) { + if (carrier.isNull()) { + this.carrier = null; + } else if (carrier.isEmpty()) { + this.carrier = Optional.empty(); + } else { + this.carrier = Optional.of(carrier.get()); + } + return this; + } + + /** + *

The shipping carrier detected for this shipment. Null until a tracking update identifies it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage carrier(String carrier) { + this.carrier = Optional.ofNullable(carrier); + return this; + } + + /** + *

The shipping carrier detected for this shipment. Null until a tracking update identifies it.

+ */ + @java.lang.Override + @JsonSetter(value = "carrier", nulls = Nulls.SKIP) + public _FinalStage carrier(Optional carrier) { + this.carrier = carrier; + return this; + } + + @java.lang.Override + public PaymentShipment build() { + return new PaymentShipment(carrier, id, status, trackingNumber, trackingUrl, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentShippingAddress.java b/src/main/java/com/whop/api/types/PaymentShippingAddress.java new file mode 100644 index 00000000..fe876119 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentShippingAddress.java @@ -0,0 +1,437 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentShippingAddress.Builder.class) +public final class PaymentShippingAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional name; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private PaymentShippingAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional name, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.name = name; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The name of the customer. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentShippingAddress && equalTo((PaymentShippingAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentShippingAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && name.equals(other.name) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.name, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentShippingAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + name(other.getName()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The name of the customer.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public PaymentShippingAddress build() { + return new PaymentShippingAddress( + city, country, line1, line2, name, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentStatus.java b/src/main/java/com/whop/api/types/PaymentStatus.java new file mode 100644 index 00000000..60ccb2bf --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentStatus.java @@ -0,0 +1,501 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentStatus.Builder.class) +public final class PaymentStatus { + private final String id; + + private final Optional lastPaymentError; + + private final Optional nextAction; + + private final String object; + + private final Optional processingDetails; + + private final Optional returnUrl; + + private final PaymentStatusStatus status; + + private final Map additionalProperties; + + private PaymentStatus( + String id, + Optional lastPaymentError, + Optional nextAction, + String object, + Optional processingDetails, + Optional returnUrl, + PaymentStatusStatus status, + Map additionalProperties) { + this.id = id; + this.lastPaymentError = lastPaymentError; + this.nextAction = nextAction; + this.object = object; + this.processingDetails = processingDetails; + this.returnUrl = returnUrl; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The payment this status describes, prefixed pay_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Details of the most recent failed attempt, or null when the payment has not failed. + */ + @JsonIgnore + public Optional getLastPaymentError() { + if (lastPaymentError == null) { + return Optional.empty(); + } + return lastPaymentError; + } + + /** + * @return What the buyer must do next while status is requires_action, otherwise null. type picks the shape and each variant carries only its own data, so switching on type gives you exactly that step's payload. + */ + @JsonIgnore + public Optional getNextAction() { + if (nextAction == null) { + return Optional.empty(); + } + return nextAction; + } + + /** + * @return Always payment_status. + */ + @JsonProperty("object") + public String getObject() { + return object; + } + + /** + * @return Present while status is processing on a settlement rail, otherwise null. + */ + @JsonIgnore + public Optional getProcessingDetails() { + if (processingDetails == null) { + return Optional.empty(); + } + return processingDetails; + } + + /** + * @return Where to send the buyer once the payment reaches a resting state, or null to leave them where they are. Editable until they return — see the return_url operation. + */ + @JsonIgnore + public Optional getReturnUrl() { + if (returnUrl == null) { + return Optional.empty(); + } + return returnUrl; + } + + /** + * @return How far the payment has got. requires_confirmation — nothing attempted yet, or the last attempt failed and can be retried. requires_action — the buyer has a step outstanding; see next_action. confirming — the buyer has done their part and the processor is deciding. processing — the money is moving; see processing_details. succeeded — collected. canceled — voided or written off. + */ + @JsonProperty("status") + public PaymentStatusStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_payment_error") + private Optional _getLastPaymentError() { + return lastPaymentError; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("next_action") + private Optional _getNextAction() { + return nextAction; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("processing_details") + private Optional _getProcessingDetails() { + return processingDetails; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("return_url") + private Optional _getReturnUrl() { + return returnUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentStatus && equalTo((PaymentStatus) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentStatus other) { + return id.equals(other.id) + && lastPaymentError.equals(other.lastPaymentError) + && nextAction.equals(other.nextAction) + && object.equals(other.object) + && processingDetails.equals(other.processingDetails) + && returnUrl.equals(other.returnUrl) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.lastPaymentError, + this.nextAction, + this.object, + this.processingDetails, + this.returnUrl, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The payment this status describes, prefixed pay_.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(PaymentStatus other); + } + + public interface ObjectStage { + /** + *

Always payment_status.

+ */ + StatusStage object(@NotNull String object); + } + + public interface StatusStage { + /** + *

How far the payment has got. requires_confirmation — nothing attempted yet, or the last attempt failed and can be retried. requires_action — the buyer has a step outstanding; see next_action. confirming — the buyer has done their part and the processor is deciding. processing — the money is moving; see processing_details. succeeded — collected. canceled — voided or written off.

+ */ + _FinalStage status(@NotNull PaymentStatusStatus status); + } + + public interface _FinalStage { + PaymentStatus build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Details of the most recent failed attempt, or null when the payment has not failed.

+ */ + _FinalStage lastPaymentError(Optional lastPaymentError); + + _FinalStage lastPaymentError(PaymentLastPaymentError lastPaymentError); + + _FinalStage lastPaymentError(Nullable lastPaymentError); + + /** + *

What the buyer must do next while status is requires_action, otherwise null. type picks the shape and each variant carries only its own data, so switching on type gives you exactly that step's payload.

+ */ + _FinalStage nextAction(Optional nextAction); + + _FinalStage nextAction(PaymentNextAction nextAction); + + _FinalStage nextAction(Nullable nextAction); + + /** + *

Present while status is processing on a settlement rail, otherwise null.

+ */ + _FinalStage processingDetails(Optional processingDetails); + + _FinalStage processingDetails(PaymentProcessingDetails processingDetails); + + _FinalStage processingDetails(Nullable processingDetails); + + /** + *

Where to send the buyer once the payment reaches a resting state, or null to leave them where they are. Editable until they return — see the return_url operation.

+ */ + _FinalStage returnUrl(Optional returnUrl); + + _FinalStage returnUrl(String returnUrl); + + _FinalStage returnUrl(Nullable returnUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, StatusStage, _FinalStage { + private String id; + + private String object; + + private PaymentStatusStatus status; + + private Optional returnUrl = Optional.empty(); + + private Optional processingDetails = Optional.empty(); + + private Optional nextAction = Optional.empty(); + + private Optional lastPaymentError = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentStatus other) { + id(other.getId()); + lastPaymentError(other.getLastPaymentError()); + nextAction(other.getNextAction()); + object(other.getObject()); + processingDetails(other.getProcessingDetails()); + returnUrl(other.getReturnUrl()); + status(other.getStatus()); + return this; + } + + /** + *

The payment this status describes, prefixed pay_.

+ *

The payment this status describes, prefixed pay_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Always payment_status.

+ *

Always payment_status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("object") + public StatusStage object(@NotNull String object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

How far the payment has got. requires_confirmation — nothing attempted yet, or the last attempt failed and can be retried. requires_action — the buyer has a step outstanding; see next_action. confirming — the buyer has done their part and the processor is deciding. processing — the money is moving; see processing_details. succeeded — collected. canceled — voided or written off.

+ *

How far the payment has got. requires_confirmation — nothing attempted yet, or the last attempt failed and can be retried. requires_action — the buyer has a step outstanding; see next_action. confirming — the buyer has done their part and the processor is deciding. processing — the money is moving; see processing_details. succeeded — collected. canceled — voided or written off.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull PaymentStatusStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Where to send the buyer once the payment reaches a resting state, or null to leave them where they are. Editable until they return — see the return_url operation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(Nullable returnUrl) { + if (returnUrl.isNull()) { + this.returnUrl = null; + } else if (returnUrl.isEmpty()) { + this.returnUrl = Optional.empty(); + } else { + this.returnUrl = Optional.of(returnUrl.get()); + } + return this; + } + + /** + *

Where to send the buyer once the payment reaches a resting state, or null to leave them where they are. Editable until they return — see the return_url operation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(String returnUrl) { + this.returnUrl = Optional.ofNullable(returnUrl); + return this; + } + + /** + *

Where to send the buyer once the payment reaches a resting state, or null to leave them where they are. Editable until they return — see the return_url operation.

+ */ + @java.lang.Override + @JsonSetter(value = "return_url", nulls = Nulls.SKIP) + public _FinalStage returnUrl(Optional returnUrl) { + this.returnUrl = returnUrl; + return this; + } + + /** + *

Present while status is processing on a settlement rail, otherwise null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage processingDetails(Nullable processingDetails) { + if (processingDetails.isNull()) { + this.processingDetails = null; + } else if (processingDetails.isEmpty()) { + this.processingDetails = Optional.empty(); + } else { + this.processingDetails = Optional.of(processingDetails.get()); + } + return this; + } + + /** + *

Present while status is processing on a settlement rail, otherwise null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage processingDetails(PaymentProcessingDetails processingDetails) { + this.processingDetails = Optional.ofNullable(processingDetails); + return this; + } + + /** + *

Present while status is processing on a settlement rail, otherwise null.

+ */ + @java.lang.Override + @JsonSetter(value = "processing_details", nulls = Nulls.SKIP) + public _FinalStage processingDetails(Optional processingDetails) { + this.processingDetails = processingDetails; + return this; + } + + /** + *

What the buyer must do next while status is requires_action, otherwise null. type picks the shape and each variant carries only its own data, so switching on type gives you exactly that step's payload.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nextAction(Nullable nextAction) { + if (nextAction.isNull()) { + this.nextAction = null; + } else if (nextAction.isEmpty()) { + this.nextAction = Optional.empty(); + } else { + this.nextAction = Optional.of(nextAction.get()); + } + return this; + } + + /** + *

What the buyer must do next while status is requires_action, otherwise null. type picks the shape and each variant carries only its own data, so switching on type gives you exactly that step's payload.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nextAction(PaymentNextAction nextAction) { + this.nextAction = Optional.ofNullable(nextAction); + return this; + } + + /** + *

What the buyer must do next while status is requires_action, otherwise null. type picks the shape and each variant carries only its own data, so switching on type gives you exactly that step's payload.

+ */ + @java.lang.Override + @JsonSetter(value = "next_action", nulls = Nulls.SKIP) + public _FinalStage nextAction(Optional nextAction) { + this.nextAction = nextAction; + return this; + } + + /** + *

Details of the most recent failed attempt, or null when the payment has not failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaymentError(Nullable lastPaymentError) { + if (lastPaymentError.isNull()) { + this.lastPaymentError = null; + } else if (lastPaymentError.isEmpty()) { + this.lastPaymentError = Optional.empty(); + } else { + this.lastPaymentError = Optional.of(lastPaymentError.get()); + } + return this; + } + + /** + *

Details of the most recent failed attempt, or null when the payment has not failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastPaymentError(PaymentLastPaymentError lastPaymentError) { + this.lastPaymentError = Optional.ofNullable(lastPaymentError); + return this; + } + + /** + *

Details of the most recent failed attempt, or null when the payment has not failed.

+ */ + @java.lang.Override + @JsonSetter(value = "last_payment_error", nulls = Nulls.SKIP) + public _FinalStage lastPaymentError(Optional lastPaymentError) { + this.lastPaymentError = lastPaymentError; + return this; + } + + @java.lang.Override + public PaymentStatus build() { + return new PaymentStatus( + id, + lastPaymentError, + nextAction, + object, + processingDetails, + returnUrl, + status, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentStatusStatus.java b/src/main/java/com/whop/api/types/PaymentStatusStatus.java new file mode 100644 index 00000000..197ed7cc --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentStatusStatus.java @@ -0,0 +1,125 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PaymentStatusStatus { + public static final PaymentStatusStatus SUCCEEDED = new PaymentStatusStatus(Value.SUCCEEDED, "succeeded"); + + public static final PaymentStatusStatus CONFIRMING = new PaymentStatusStatus(Value.CONFIRMING, "confirming"); + + public static final PaymentStatusStatus PROCESSING = new PaymentStatusStatus(Value.PROCESSING, "processing"); + + public static final PaymentStatusStatus CANCELED = new PaymentStatusStatus(Value.CANCELED, "canceled"); + + public static final PaymentStatusStatus REQUIRES_CONFIRMATION = + new PaymentStatusStatus(Value.REQUIRES_CONFIRMATION, "requires_confirmation"); + + public static final PaymentStatusStatus REQUIRES_ACTION = + new PaymentStatusStatus(Value.REQUIRES_ACTION, "requires_action"); + + private final Value value; + + private final String string; + + PaymentStatusStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PaymentStatusStatus && this.string.equals(((PaymentStatusStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SUCCEEDED: + return visitor.visitSucceeded(); + case CONFIRMING: + return visitor.visitConfirming(); + case PROCESSING: + return visitor.visitProcessing(); + case CANCELED: + return visitor.visitCanceled(); + case REQUIRES_CONFIRMATION: + return visitor.visitRequiresConfirmation(); + case REQUIRES_ACTION: + return visitor.visitRequiresAction(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PaymentStatusStatus valueOf(String value) { + switch (value) { + case "succeeded": + return SUCCEEDED; + case "confirming": + return CONFIRMING; + case "processing": + return PROCESSING; + case "canceled": + return CANCELED; + case "requires_confirmation": + return REQUIRES_CONFIRMATION; + case "requires_action": + return REQUIRES_ACTION; + default: + return new PaymentStatusStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + REQUIRES_CONFIRMATION, + + REQUIRES_ACTION, + + CONFIRMING, + + PROCESSING, + + SUCCEEDED, + + CANCELED, + + UNKNOWN + } + + public interface Visitor { + T visitRequiresConfirmation(); + + T visitRequiresAction(); + + T visitConfirming(); + + T visitProcessing(); + + T visitSucceeded(); + + T visitCanceled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PaymentTransactionStatuses.java b/src/main/java/com/whop/api/types/PaymentTransactionStatuses.java new file mode 100644 index 00000000..d07e7eb1 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentTransactionStatuses.java @@ -0,0 +1,179 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PaymentTransactionStatuses { + public static final PaymentTransactionStatuses PREVENTED = + new PaymentTransactionStatuses(Value.PREVENTED, "prevented"); + + public static final PaymentTransactionStatuses SUCCEEDED = + new PaymentTransactionStatuses(Value.SUCCEEDED, "succeeded"); + + public static final PaymentTransactionStatuses DECLINED = + new PaymentTransactionStatuses(Value.DECLINED, "declined"); + + public static final PaymentTransactionStatuses WON = new PaymentTransactionStatuses(Value.WON, "won"); + + public static final PaymentTransactionStatuses PENDING = new PaymentTransactionStatuses(Value.PENDING, "pending"); + + public static final PaymentTransactionStatuses CANCELED = + new PaymentTransactionStatuses(Value.CANCELED, "canceled"); + + public static final PaymentTransactionStatuses EXPIRED = new PaymentTransactionStatuses(Value.EXPIRED, "expired"); + + public static final PaymentTransactionStatuses ERROR = new PaymentTransactionStatuses(Value.ERROR, "error"); + + public static final PaymentTransactionStatuses REJECTED = + new PaymentTransactionStatuses(Value.REJECTED, "rejected"); + + public static final PaymentTransactionStatuses CREATED = new PaymentTransactionStatuses(Value.CREATED, "created"); + + public static final PaymentTransactionStatuses LOST = new PaymentTransactionStatuses(Value.LOST, "lost"); + + private final Value value; + + private final String string; + + PaymentTransactionStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PaymentTransactionStatuses + && this.string.equals(((PaymentTransactionStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PREVENTED: + return visitor.visitPrevented(); + case SUCCEEDED: + return visitor.visitSucceeded(); + case DECLINED: + return visitor.visitDeclined(); + case WON: + return visitor.visitWon(); + case PENDING: + return visitor.visitPending(); + case CANCELED: + return visitor.visitCanceled(); + case EXPIRED: + return visitor.visitExpired(); + case ERROR: + return visitor.visitError(); + case REJECTED: + return visitor.visitRejected(); + case CREATED: + return visitor.visitCreated(); + case LOST: + return visitor.visitLost(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PaymentTransactionStatuses valueOf(String value) { + switch (value) { + case "prevented": + return PREVENTED; + case "succeeded": + return SUCCEEDED; + case "declined": + return DECLINED; + case "won": + return WON; + case "pending": + return PENDING; + case "canceled": + return CANCELED; + case "expired": + return EXPIRED; + case "error": + return ERROR; + case "rejected": + return REJECTED; + case "created": + return CREATED; + case "lost": + return LOST; + default: + return new PaymentTransactionStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + SUCCEEDED, + + DECLINED, + + ERROR, + + PENDING, + + CREATED, + + EXPIRED, + + WON, + + REJECTED, + + LOST, + + PREVENTED, + + CANCELED, + + UNKNOWN + } + + public interface Visitor { + T visitSucceeded(); + + T visitDeclined(); + + T visitError(); + + T visitPending(); + + T visitCreated(); + + T visitExpired(); + + T visitWon(); + + T visitRejected(); + + T visitLost(); + + T visitPrevented(); + + T visitCanceled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PaymentTransactionTypes.java b/src/main/java/com/whop/api/types/PaymentTransactionTypes.java new file mode 100644 index 00000000..50b1e357 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentTransactionTypes.java @@ -0,0 +1,190 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PaymentTransactionTypes { + public static final PaymentTransactionTypes PURCHASE = new PaymentTransactionTypes(Value.PURCHASE, "purchase"); + + public static final PaymentTransactionTypes FRAUD_SCREENING = + new PaymentTransactionTypes(Value.FRAUD_SCREENING, "fraud_screening"); + + public static final PaymentTransactionTypes AUTHORIZE = new PaymentTransactionTypes(Value.AUTHORIZE, "authorize"); + + public static final PaymentTransactionTypes PRE_CHARGEBACK = + new PaymentTransactionTypes(Value.PRE_CHARGEBACK, "pre_chargeback"); + + public static final PaymentTransactionTypes THREE_D_SECURE = + new PaymentTransactionTypes(Value.THREE_D_SECURE, "three_d_secure"); + + public static final PaymentTransactionTypes INSTALLMENT = + new PaymentTransactionTypes(Value.INSTALLMENT, "installment"); + + public static final PaymentTransactionTypes CANCELED = new PaymentTransactionTypes(Value.CANCELED, "canceled"); + + public static final PaymentTransactionTypes CAPTURE = new PaymentTransactionTypes(Value.CAPTURE, "capture"); + + public static final PaymentTransactionTypes VERIFY = new PaymentTransactionTypes(Value.VERIFY, "verify"); + + public static final PaymentTransactionTypes REFUND = new PaymentTransactionTypes(Value.REFUND, "refund"); + + public static final PaymentTransactionTypes CHARGEBACK = + new PaymentTransactionTypes(Value.CHARGEBACK, "chargeback"); + + public static final PaymentTransactionTypes AUTHORIZATION = + new PaymentTransactionTypes(Value.AUTHORIZATION, "authorization"); + + private final Value value; + + private final String string; + + PaymentTransactionTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PaymentTransactionTypes + && this.string.equals(((PaymentTransactionTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PURCHASE: + return visitor.visitPurchase(); + case FRAUD_SCREENING: + return visitor.visitFraudScreening(); + case AUTHORIZE: + return visitor.visitAuthorize(); + case PRE_CHARGEBACK: + return visitor.visitPreChargeback(); + case THREE_D_SECURE: + return visitor.visitThreeDSecure(); + case INSTALLMENT: + return visitor.visitInstallment(); + case CANCELED: + return visitor.visitCanceled(); + case CAPTURE: + return visitor.visitCapture(); + case VERIFY: + return visitor.visitVerify(); + case REFUND: + return visitor.visitRefund(); + case CHARGEBACK: + return visitor.visitChargeback(); + case AUTHORIZATION: + return visitor.visitAuthorization(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PaymentTransactionTypes valueOf(String value) { + switch (value) { + case "purchase": + return PURCHASE; + case "fraud_screening": + return FRAUD_SCREENING; + case "authorize": + return AUTHORIZE; + case "pre_chargeback": + return PRE_CHARGEBACK; + case "three_d_secure": + return THREE_D_SECURE; + case "installment": + return INSTALLMENT; + case "canceled": + return CANCELED; + case "capture": + return CAPTURE; + case "verify": + return VERIFY; + case "refund": + return REFUND; + case "chargeback": + return CHARGEBACK; + case "authorization": + return AUTHORIZATION; + default: + return new PaymentTransactionTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + PURCHASE, + + AUTHORIZE, + + CAPTURE, + + REFUND, + + CANCELED, + + VERIFY, + + CHARGEBACK, + + PRE_CHARGEBACK, + + THREE_D_SECURE, + + FRAUD_SCREENING, + + AUTHORIZATION, + + INSTALLMENT, + + UNKNOWN + } + + public interface Visitor { + T visitPurchase(); + + T visitAuthorize(); + + T visitCapture(); + + T visitRefund(); + + T visitCanceled(); + + T visitVerify(); + + T visitChargeback(); + + T visitPreChargeback(); + + T visitThreeDSecure(); + + T visitFraudScreening(); + + T visitAuthorization(); + + T visitInstallment(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PaymentUser.java b/src/main/java/com/whop/api/types/PaymentUser.java new file mode 100644 index 00000000..d70ba784 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentUser.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentUser.Builder.class) +public final class PaymentUser { + private final Optional email; + + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private PaymentUser( + Optional email, + String id, + Optional name, + String username, + Map additionalProperties) { + this.email = email; + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's email address. Requires the member:email:read permission to access. Null if not authorized. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentUser && equalTo((PaymentUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentUser other) { + return email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(PaymentUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + PaymentUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentUser other) { + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public PaymentUser build() { + return new PaymentUser(email, id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentVerificationChecks.java b/src/main/java/com/whop/api/types/PaymentVerificationChecks.java new file mode 100644 index 00000000..16201618 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentVerificationChecks.java @@ -0,0 +1,287 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentVerificationChecks.Builder.class) +public final class PaymentVerificationChecks { + private final Optional addressLine1; + + private final Optional cardHolderName; + + private final Optional cardSecurityCode; + + private final Optional zipCode; + + private final Map additionalProperties; + + private PaymentVerificationChecks( + Optional addressLine1, + Optional cardHolderName, + Optional cardSecurityCode, + Optional zipCode, + Map additionalProperties) { + this.addressLine1 = addressLine1; + this.cardHolderName = cardHolderName; + this.cardSecurityCode = cardSecurityCode; + this.zipCode = zipCode; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the billing street address the customer entered matched the address the issuer has on file. + */ + @JsonIgnore + public Optional getAddressLine1() { + if (addressLine1 == null) { + return Optional.empty(); + } + return addressLine1; + } + + /** + * @return Whether the cardholder name the customer entered matched the name the issuer has on file. + */ + @JsonIgnore + public Optional getCardHolderName() { + if (cardHolderName == null) { + return Optional.empty(); + } + return cardHolderName; + } + + /** + * @return Whether the CVV / CVC the customer entered matched the card. + */ + @JsonIgnore + public Optional getCardSecurityCode() { + if (cardSecurityCode == null) { + return Optional.empty(); + } + return cardSecurityCode; + } + + /** + * @return Whether the billing postal code the customer entered matched the postal code the issuer has on file. + */ + @JsonIgnore + public Optional getZipCode() { + if (zipCode == null) { + return Optional.empty(); + } + return zipCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("address_line1") + private Optional _getAddressLine1() { + return addressLine1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_holder_name") + private Optional _getCardHolderName() { + return cardHolderName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_security_code") + private Optional _getCardSecurityCode() { + return cardSecurityCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("zip_code") + private Optional _getZipCode() { + return zipCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentVerificationChecks && equalTo((PaymentVerificationChecks) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentVerificationChecks other) { + return addressLine1.equals(other.addressLine1) + && cardHolderName.equals(other.cardHolderName) + && cardSecurityCode.equals(other.cardSecurityCode) + && zipCode.equals(other.zipCode); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.addressLine1, this.cardHolderName, this.cardSecurityCode, this.zipCode); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional addressLine1 = Optional.empty(); + + private Optional cardHolderName = Optional.empty(); + + private Optional cardSecurityCode = Optional.empty(); + + private Optional zipCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentVerificationChecks other) { + addressLine1(other.getAddressLine1()); + cardHolderName(other.getCardHolderName()); + cardSecurityCode(other.getCardSecurityCode()); + zipCode(other.getZipCode()); + return this; + } + + /** + *

Whether the billing street address the customer entered matched the address the issuer has on file.

+ */ + @JsonSetter(value = "address_line1", nulls = Nulls.SKIP) + public Builder addressLine1(Optional addressLine1) { + this.addressLine1 = addressLine1; + return this; + } + + public Builder addressLine1(String addressLine1) { + this.addressLine1 = Optional.ofNullable(addressLine1); + return this; + } + + public Builder addressLine1(Nullable addressLine1) { + if (addressLine1.isNull()) { + this.addressLine1 = null; + } else if (addressLine1.isEmpty()) { + this.addressLine1 = Optional.empty(); + } else { + this.addressLine1 = Optional.of(addressLine1.get()); + } + return this; + } + + /** + *

Whether the cardholder name the customer entered matched the name the issuer has on file.

+ */ + @JsonSetter(value = "card_holder_name", nulls = Nulls.SKIP) + public Builder cardHolderName(Optional cardHolderName) { + this.cardHolderName = cardHolderName; + return this; + } + + public Builder cardHolderName(String cardHolderName) { + this.cardHolderName = Optional.ofNullable(cardHolderName); + return this; + } + + public Builder cardHolderName(Nullable cardHolderName) { + if (cardHolderName.isNull()) { + this.cardHolderName = null; + } else if (cardHolderName.isEmpty()) { + this.cardHolderName = Optional.empty(); + } else { + this.cardHolderName = Optional.of(cardHolderName.get()); + } + return this; + } + + /** + *

Whether the CVV / CVC the customer entered matched the card.

+ */ + @JsonSetter(value = "card_security_code", nulls = Nulls.SKIP) + public Builder cardSecurityCode(Optional cardSecurityCode) { + this.cardSecurityCode = cardSecurityCode; + return this; + } + + public Builder cardSecurityCode(String cardSecurityCode) { + this.cardSecurityCode = Optional.ofNullable(cardSecurityCode); + return this; + } + + public Builder cardSecurityCode(Nullable cardSecurityCode) { + if (cardSecurityCode.isNull()) { + this.cardSecurityCode = null; + } else if (cardSecurityCode.isEmpty()) { + this.cardSecurityCode = Optional.empty(); + } else { + this.cardSecurityCode = Optional.of(cardSecurityCode.get()); + } + return this; + } + + /** + *

Whether the billing postal code the customer entered matched the postal code the issuer has on file.

+ */ + @JsonSetter(value = "zip_code", nulls = Nulls.SKIP) + public Builder zipCode(Optional zipCode) { + this.zipCode = zipCode; + return this; + } + + public Builder zipCode(String zipCode) { + this.zipCode = Optional.ofNullable(zipCode); + return this; + } + + public Builder zipCode(Nullable zipCode) { + if (zipCode.isNull()) { + this.zipCode = null; + } else if (zipCode.isEmpty()) { + this.zipCode = Optional.empty(); + } else { + this.zipCode = Optional.of(zipCode.get()); + } + return this; + } + + public PaymentVerificationChecks build() { + return new PaymentVerificationChecks( + addressLine1, cardHolderName, cardSecurityCode, zipCode, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentVoucher.java b/src/main/java/com/whop/api/types/PaymentVoucher.java new file mode 100644 index 00000000..d071aee5 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentVoucher.java @@ -0,0 +1,372 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentVoucher.Builder.class) +public final class PaymentVoucher { + private final Optional amount; + + private final Optional barcode; + + private final Optional barcodeFormat; + + private final Optional companyName; + + private final Optional documentUrl; + + private final Optional expiresAt; + + private final Optional providerLogo; + + private final Optional providerName; + + private final Optional reference; + + private final Map additionalProperties; + + private PaymentVoucher( + Optional amount, + Optional barcode, + Optional barcodeFormat, + Optional companyName, + Optional documentUrl, + Optional expiresAt, + Optional providerLogo, + Optional providerName, + Optional reference, + Map additionalProperties) { + this.amount = amount; + this.barcode = barcode; + this.barcodeFormat = barcodeFormat; + this.companyName = companyName; + this.documentUrl = documentUrl; + this.expiresAt = expiresAt; + this.providerLogo = providerLogo; + this.providerName = providerName; + this.reference = reference; + this.additionalProperties = additionalProperties; + } + + /** + * @return Exactly what the buyer must pay, in the charged currency. + */ + @JsonProperty("amount") + public Optional getAmount() { + return amount; + } + + /** + * @return The barcode's contents, when the voucher carries one — render it in the symbology named by barcode_format. + */ + @JsonProperty("barcode") + public Optional getBarcode() { + return barcode; + } + + /** + * @return The symbology barcode is encoded in, such as CODE_128. + */ + @JsonProperty("barcode_format") + public Optional getBarcodeFormat() { + return barcodeFormat; + } + + /** + * @return Who the payment is made out to. + */ + @JsonProperty("company_name") + public Optional getCompanyName() { + return companyName; + } + + /** + * @return A hosted page with the complete, printable instructions. If you would rather not render the details yourself, send the buyer here. + */ + @JsonProperty("document_url") + public Optional getDocumentUrl() { + return documentUrl; + } + + /** + * @return When the voucher stops being payable, as an ISO 8601 timestamp. + */ + @JsonProperty("expires_at") + public Optional getExpiresAt() { + return expiresAt; + } + + /** + * @return URL of that network's logo. + */ + @JsonProperty("provider_logo") + public Optional getProviderLogo() { + return providerLogo; + } + + /** + * @return The network the buyer pays at, such as OXXO. + */ + @JsonProperty("provider_name") + public Optional getProviderName() { + return providerName; + } + + /** + * @return The voucher's number — what the buyer reads out or types at the counter to pay. + */ + @JsonProperty("reference") + public Optional getReference() { + return reference; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentVoucher && equalTo((PaymentVoucher) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentVoucher other) { + return amount.equals(other.amount) + && barcode.equals(other.barcode) + && barcodeFormat.equals(other.barcodeFormat) + && companyName.equals(other.companyName) + && documentUrl.equals(other.documentUrl) + && expiresAt.equals(other.expiresAt) + && providerLogo.equals(other.providerLogo) + && providerName.equals(other.providerName) + && reference.equals(other.reference); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.barcode, + this.barcodeFormat, + this.companyName, + this.documentUrl, + this.expiresAt, + this.providerLogo, + this.providerName, + this.reference); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional amount = Optional.empty(); + + private Optional barcode = Optional.empty(); + + private Optional barcodeFormat = Optional.empty(); + + private Optional companyName = Optional.empty(); + + private Optional documentUrl = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + private Optional providerLogo = Optional.empty(); + + private Optional providerName = Optional.empty(); + + private Optional reference = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentVoucher other) { + amount(other.getAmount()); + barcode(other.getBarcode()); + barcodeFormat(other.getBarcodeFormat()); + companyName(other.getCompanyName()); + documentUrl(other.getDocumentUrl()); + expiresAt(other.getExpiresAt()); + providerLogo(other.getProviderLogo()); + providerName(other.getProviderName()); + reference(other.getReference()); + return this; + } + + /** + *

Exactly what the buyer must pay, in the charged currency.

+ */ + @JsonSetter(value = "amount", nulls = Nulls.SKIP) + public Builder amount(Optional amount) { + this.amount = amount; + return this; + } + + public Builder amount(Money amount) { + this.amount = Optional.ofNullable(amount); + return this; + } + + /** + *

The barcode's contents, when the voucher carries one — render it in the symbology named by barcode_format.

+ */ + @JsonSetter(value = "barcode", nulls = Nulls.SKIP) + public Builder barcode(Optional barcode) { + this.barcode = barcode; + return this; + } + + public Builder barcode(String barcode) { + this.barcode = Optional.ofNullable(barcode); + return this; + } + + /** + *

The symbology barcode is encoded in, such as CODE_128.

+ */ + @JsonSetter(value = "barcode_format", nulls = Nulls.SKIP) + public Builder barcodeFormat(Optional barcodeFormat) { + this.barcodeFormat = barcodeFormat; + return this; + } + + public Builder barcodeFormat(String barcodeFormat) { + this.barcodeFormat = Optional.ofNullable(barcodeFormat); + return this; + } + + /** + *

Who the payment is made out to.

+ */ + @JsonSetter(value = "company_name", nulls = Nulls.SKIP) + public Builder companyName(Optional companyName) { + this.companyName = companyName; + return this; + } + + public Builder companyName(String companyName) { + this.companyName = Optional.ofNullable(companyName); + return this; + } + + /** + *

A hosted page with the complete, printable instructions. If you would rather not render the details yourself, send the buyer here.

+ */ + @JsonSetter(value = "document_url", nulls = Nulls.SKIP) + public Builder documentUrl(Optional documentUrl) { + this.documentUrl = documentUrl; + return this; + } + + public Builder documentUrl(String documentUrl) { + this.documentUrl = Optional.ofNullable(documentUrl); + return this; + } + + /** + *

When the voucher stops being payable, as an ISO 8601 timestamp.

+ */ + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public Builder expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + public Builder expiresAt(String expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + /** + *

URL of that network's logo.

+ */ + @JsonSetter(value = "provider_logo", nulls = Nulls.SKIP) + public Builder providerLogo(Optional providerLogo) { + this.providerLogo = providerLogo; + return this; + } + + public Builder providerLogo(String providerLogo) { + this.providerLogo = Optional.ofNullable(providerLogo); + return this; + } + + /** + *

The network the buyer pays at, such as OXXO.

+ */ + @JsonSetter(value = "provider_name", nulls = Nulls.SKIP) + public Builder providerName(Optional providerName) { + this.providerName = providerName; + return this; + } + + public Builder providerName(String providerName) { + this.providerName = Optional.ofNullable(providerName); + return this; + } + + /** + *

The voucher's number — what the buyer reads out or types at the counter to pay.

+ */ + @JsonSetter(value = "reference", nulls = Nulls.SKIP) + public Builder reference(Optional reference) { + this.reference = reference; + return this; + } + + public Builder reference(String reference) { + this.reference = Optional.ofNullable(reference); + return this; + } + + public PaymentVoucher build() { + return new PaymentVoucher( + amount, + barcode, + barcodeFormat, + companyName, + documentUrl, + expiresAt, + providerLogo, + providerName, + reference, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentVoucherInstructions.java b/src/main/java/com/whop/api/types/PaymentVoucherInstructions.java new file mode 100644 index 00000000..5bd91bab --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentVoucherInstructions.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentVoucherInstructions.Builder.class) +public final class PaymentVoucherInstructions { + private final PaymentVoucher voucher; + + private final Map additionalProperties; + + private PaymentVoucherInstructions(PaymentVoucher voucher, Map additionalProperties) { + this.voucher = voucher; + this.additionalProperties = additionalProperties; + } + + /** + * @return The voucher to show. + */ + @JsonProperty("voucher") + public PaymentVoucher getVoucher() { + return voucher; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentVoucherInstructions && equalTo((PaymentVoucherInstructions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentVoucherInstructions other) { + return voucher.equals(other.voucher); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.voucher); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VoucherStage builder() { + return new Builder(); + } + + public interface VoucherStage { + /** + *

The voucher to show.

+ */ + _FinalStage voucher(@NotNull PaymentVoucher voucher); + + Builder from(PaymentVoucherInstructions other); + } + + public interface _FinalStage { + PaymentVoucherInstructions build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VoucherStage, _FinalStage { + private PaymentVoucher voucher; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaymentVoucherInstructions other) { + voucher(other.getVoucher()); + return this; + } + + /** + *

The voucher to show.

+ *

The voucher to show.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("voucher") + public _FinalStage voucher(@NotNull PaymentVoucher voucher) { + this.voucher = Objects.requireNonNull(voucher, "voucher must not be null"); + return this; + } + + @java.lang.Override + public PaymentVoucherInstructions build() { + return new PaymentVoucherInstructions(voucher, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PaymentsApprovalStatuses.java b/src/main/java/com/whop/api/types/PaymentsApprovalStatuses.java new file mode 100644 index 00000000..28f61f35 --- /dev/null +++ b/src/main/java/com/whop/api/types/PaymentsApprovalStatuses.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PaymentsApprovalStatuses { + public static final PaymentsApprovalStatuses APPROVED = new PaymentsApprovalStatuses(Value.APPROVED, "approved"); + + public static final PaymentsApprovalStatuses PENDING = new PaymentsApprovalStatuses(Value.PENDING, "pending"); + + public static final PaymentsApprovalStatuses MONITORING = + new PaymentsApprovalStatuses(Value.MONITORING, "monitoring"); + + public static final PaymentsApprovalStatuses REJECTED = new PaymentsApprovalStatuses(Value.REJECTED, "rejected"); + + private final Value value; + + private final String string; + + PaymentsApprovalStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PaymentsApprovalStatuses + && this.string.equals(((PaymentsApprovalStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case PENDING: + return visitor.visitPending(); + case MONITORING: + return visitor.visitMonitoring(); + case REJECTED: + return visitor.visitRejected(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PaymentsApprovalStatuses valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "pending": + return PENDING; + case "monitoring": + return MONITORING; + case "rejected": + return REJECTED; + default: + return new PaymentsApprovalStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + APPROVED, + + MONITORING, + + REJECTED, + + UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitApproved(); + + T visitMonitoring(); + + T visitRejected(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PayoutAccount.java b/src/main/java/com/whop/api/types/PayoutAccount.java new file mode 100644 index 00000000..aab83373 --- /dev/null +++ b/src/main/java/com/whop/api/types/PayoutAccount.java @@ -0,0 +1,645 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PayoutAccount.Builder.class) +public final class PayoutAccount { + private final Optional address; + + private final Optional businessName; + + private final Optional businessRepresentative; + + private final Optional email; + + private final String id; + + private final Optional latestVerification; + + private final Optional phone; + + private final Optional status; + + private final Map additionalProperties; + + private PayoutAccount( + Optional address, + Optional businessName, + Optional businessRepresentative, + Optional email, + String id, + Optional latestVerification, + Optional phone, + Optional status, + Map additionalProperties) { + this.address = address; + this.businessName = businessName; + this.businessRepresentative = businessRepresentative; + this.email = email; + this.id = id; + this.latestVerification = latestVerification; + this.phone = phone; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The physical address associated with this payout account + */ + @JsonIgnore + public Optional getAddress() { + if (address == null) { + return Optional.empty(); + } + return address; + } + + /** + * @return The company's legal name + */ + @JsonIgnore + public Optional getBusinessName() { + if (businessName == null) { + return Optional.empty(); + } + return businessName; + } + + /** + * @return The business representative for this payout account + */ + @JsonIgnore + public Optional getBusinessRepresentative() { + if (businessRepresentative == null) { + return Optional.empty(); + } + return businessRepresentative; + } + + /** + * @return The email address of the representative + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the payout account. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The latest verification for the connected account. + */ + @JsonIgnore + public Optional getLatestVerification() { + if (latestVerification == null) { + return Optional.empty(); + } + return latestVerification; + } + + /** + * @return The business representative's phone + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + /** + * @return The granular calculated status of the payout account reflecting its current KYC and withdrawal readiness state. + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("address") + private Optional _getAddress() { + return address; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_name") + private Optional _getBusinessName() { + return businessName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("business_representative") + private Optional _getBusinessRepresentative() { + return businessRepresentative; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("latest_verification") + private Optional _getLatestVerification() { + return latestVerification; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PayoutAccount && equalTo((PayoutAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PayoutAccount other) { + return address.equals(other.address) + && businessName.equals(other.businessName) + && businessRepresentative.equals(other.businessRepresentative) + && email.equals(other.email) + && id.equals(other.id) + && latestVerification.equals(other.latestVerification) + && phone.equals(other.phone) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.address, + this.businessName, + this.businessRepresentative, + this.email, + this.id, + this.latestVerification, + this.phone, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the payout account.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PayoutAccount other); + } + + public interface _FinalStage { + PayoutAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The physical address associated with this payout account

+ */ + _FinalStage address(Optional address); + + _FinalStage address(PayoutAccountAddress address); + + _FinalStage address(Nullable address); + + /** + *

The company's legal name

+ */ + _FinalStage businessName(Optional businessName); + + _FinalStage businessName(String businessName); + + _FinalStage businessName(Nullable businessName); + + /** + *

The business representative for this payout account

+ */ + _FinalStage businessRepresentative(Optional businessRepresentative); + + _FinalStage businessRepresentative(PayoutAccountBusinessRepresentative businessRepresentative); + + _FinalStage businessRepresentative(Nullable businessRepresentative); + + /** + *

The email address of the representative

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The latest verification for the connected account.

+ */ + _FinalStage latestVerification(Optional latestVerification); + + _FinalStage latestVerification(PayoutAccountLatestVerification latestVerification); + + _FinalStage latestVerification(Nullable latestVerification); + + /** + *

The business representative's phone

+ */ + _FinalStage phone(Optional phone); + + _FinalStage phone(String phone); + + _FinalStage phone(Nullable phone); + + /** + *

The granular calculated status of the payout account reflecting its current KYC and withdrawal readiness state.

+ */ + _FinalStage status(Optional status); + + _FinalStage status(PayoutAccountCalculatedStatuses status); + + _FinalStage status(Nullable status); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional status = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Optional latestVerification = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional businessRepresentative = Optional.empty(); + + private Optional businessName = Optional.empty(); + + private Optional address = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PayoutAccount other) { + address(other.getAddress()); + businessName(other.getBusinessName()); + businessRepresentative(other.getBusinessRepresentative()); + email(other.getEmail()); + id(other.getId()); + latestVerification(other.getLatestVerification()); + phone(other.getPhone()); + status(other.getStatus()); + return this; + } + + /** + *

The unique identifier for the payout account.

+ *

The unique identifier for the payout account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The granular calculated status of the payout account reflecting its current KYC and withdrawal readiness state.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The granular calculated status of the payout account reflecting its current KYC and withdrawal readiness state.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(PayoutAccountCalculatedStatuses status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The granular calculated status of the payout account reflecting its current KYC and withdrawal readiness state.

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

The business representative's phone

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

The business representative's phone

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + /** + *

The business representative's phone

+ */ + @java.lang.Override + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public _FinalStage phone(Optional phone) { + this.phone = phone; + return this; + } + + /** + *

The latest verification for the connected account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage latestVerification(Nullable latestVerification) { + if (latestVerification.isNull()) { + this.latestVerification = null; + } else if (latestVerification.isEmpty()) { + this.latestVerification = Optional.empty(); + } else { + this.latestVerification = Optional.of(latestVerification.get()); + } + return this; + } + + /** + *

The latest verification for the connected account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage latestVerification(PayoutAccountLatestVerification latestVerification) { + this.latestVerification = Optional.ofNullable(latestVerification); + return this; + } + + /** + *

The latest verification for the connected account.

+ */ + @java.lang.Override + @JsonSetter(value = "latest_verification", nulls = Nulls.SKIP) + public _FinalStage latestVerification(Optional latestVerification) { + this.latestVerification = latestVerification; + return this; + } + + /** + *

The email address of the representative

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The email address of the representative

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The email address of the representative

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + /** + *

The business representative for this payout account

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessRepresentative( + Nullable businessRepresentative) { + if (businessRepresentative.isNull()) { + this.businessRepresentative = null; + } else if (businessRepresentative.isEmpty()) { + this.businessRepresentative = Optional.empty(); + } else { + this.businessRepresentative = Optional.of(businessRepresentative.get()); + } + return this; + } + + /** + *

The business representative for this payout account

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessRepresentative(PayoutAccountBusinessRepresentative businessRepresentative) { + this.businessRepresentative = Optional.ofNullable(businessRepresentative); + return this; + } + + /** + *

The business representative for this payout account

+ */ + @java.lang.Override + @JsonSetter(value = "business_representative", nulls = Nulls.SKIP) + public _FinalStage businessRepresentative( + Optional businessRepresentative) { + this.businessRepresentative = businessRepresentative; + return this; + } + + /** + *

The company's legal name

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessName(Nullable businessName) { + if (businessName.isNull()) { + this.businessName = null; + } else if (businessName.isEmpty()) { + this.businessName = Optional.empty(); + } else { + this.businessName = Optional.of(businessName.get()); + } + return this; + } + + /** + *

The company's legal name

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage businessName(String businessName) { + this.businessName = Optional.ofNullable(businessName); + return this; + } + + /** + *

The company's legal name

+ */ + @java.lang.Override + @JsonSetter(value = "business_name", nulls = Nulls.SKIP) + public _FinalStage businessName(Optional businessName) { + this.businessName = businessName; + return this; + } + + /** + *

The physical address associated with this payout account

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage address(Nullable address) { + if (address.isNull()) { + this.address = null; + } else if (address.isEmpty()) { + this.address = Optional.empty(); + } else { + this.address = Optional.of(address.get()); + } + return this; + } + + /** + *

The physical address associated with this payout account

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage address(PayoutAccountAddress address) { + this.address = Optional.ofNullable(address); + return this; + } + + /** + *

The physical address associated with this payout account

+ */ + @java.lang.Override + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public _FinalStage address(Optional address) { + this.address = address; + return this; + } + + @java.lang.Override + public PayoutAccount build() { + return new PayoutAccount( + address, + businessName, + businessRepresentative, + email, + id, + latestVerification, + phone, + status, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PayoutAccountAddress.java b/src/main/java/com/whop/api/types/PayoutAccountAddress.java new file mode 100644 index 00000000..53e8229c --- /dev/null +++ b/src/main/java/com/whop/api/types/PayoutAccountAddress.java @@ -0,0 +1,386 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PayoutAccountAddress.Builder.class) +public final class PayoutAccountAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private PayoutAccountAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PayoutAccountAddress && equalTo((PayoutAccountAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PayoutAccountAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PayoutAccountAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public PayoutAccountAddress build() { + return new PayoutAccountAddress(city, country, line1, line2, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PayoutAccountBusinessRepresentative.java b/src/main/java/com/whop/api/types/PayoutAccountBusinessRepresentative.java new file mode 100644 index 00000000..9607b0c4 --- /dev/null +++ b/src/main/java/com/whop/api/types/PayoutAccountBusinessRepresentative.java @@ -0,0 +1,288 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PayoutAccountBusinessRepresentative.Builder.class) +public final class PayoutAccountBusinessRepresentative { + private final Optional dateOfBirth; + + private final Optional firstName; + + private final Optional lastName; + + private final Optional middleName; + + private final Map additionalProperties; + + private PayoutAccountBusinessRepresentative( + Optional dateOfBirth, + Optional firstName, + Optional lastName, + Optional middleName, + Map additionalProperties) { + this.dateOfBirth = dateOfBirth; + this.firstName = firstName; + this.lastName = lastName; + this.middleName = middleName; + this.additionalProperties = additionalProperties; + } + + /** + * @return The date of birth of the business representative in ISO 8601 format (YYYY-MM-DD). + */ + @JsonIgnore + public Optional getDateOfBirth() { + if (dateOfBirth == null) { + return Optional.empty(); + } + return dateOfBirth; + } + + /** + * @return The first name of the business representative. + */ + @JsonIgnore + public Optional getFirstName() { + if (firstName == null) { + return Optional.empty(); + } + return firstName; + } + + /** + * @return The last name of the business representative. + */ + @JsonIgnore + public Optional getLastName() { + if (lastName == null) { + return Optional.empty(); + } + return lastName; + } + + /** + * @return The middle name of the business representative. + */ + @JsonIgnore + public Optional getMiddleName() { + if (middleName == null) { + return Optional.empty(); + } + return middleName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("date_of_birth") + private Optional _getDateOfBirth() { + return dateOfBirth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_name") + private Optional _getFirstName() { + return firstName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_name") + private Optional _getLastName() { + return lastName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("middle_name") + private Optional _getMiddleName() { + return middleName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PayoutAccountBusinessRepresentative + && equalTo((PayoutAccountBusinessRepresentative) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PayoutAccountBusinessRepresentative other) { + return dateOfBirth.equals(other.dateOfBirth) + && firstName.equals(other.firstName) + && lastName.equals(other.lastName) + && middleName.equals(other.middleName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dateOfBirth, this.firstName, this.lastName, this.middleName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional dateOfBirth = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional lastName = Optional.empty(); + + private Optional middleName = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PayoutAccountBusinessRepresentative other) { + dateOfBirth(other.getDateOfBirth()); + firstName(other.getFirstName()); + lastName(other.getLastName()); + middleName(other.getMiddleName()); + return this; + } + + /** + *

The date of birth of the business representative in ISO 8601 format (YYYY-MM-DD).

+ */ + @JsonSetter(value = "date_of_birth", nulls = Nulls.SKIP) + public Builder dateOfBirth(Optional dateOfBirth) { + this.dateOfBirth = dateOfBirth; + return this; + } + + public Builder dateOfBirth(String dateOfBirth) { + this.dateOfBirth = Optional.ofNullable(dateOfBirth); + return this; + } + + public Builder dateOfBirth(Nullable dateOfBirth) { + if (dateOfBirth.isNull()) { + this.dateOfBirth = null; + } else if (dateOfBirth.isEmpty()) { + this.dateOfBirth = Optional.empty(); + } else { + this.dateOfBirth = Optional.of(dateOfBirth.get()); + } + return this; + } + + /** + *

The first name of the business representative.

+ */ + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public Builder firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + public Builder firstName(Nullable firstName) { + if (firstName.isNull()) { + this.firstName = null; + } else if (firstName.isEmpty()) { + this.firstName = Optional.empty(); + } else { + this.firstName = Optional.of(firstName.get()); + } + return this; + } + + /** + *

The last name of the business representative.

+ */ + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public Builder lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + public Builder lastName(Nullable lastName) { + if (lastName.isNull()) { + this.lastName = null; + } else if (lastName.isEmpty()) { + this.lastName = Optional.empty(); + } else { + this.lastName = Optional.of(lastName.get()); + } + return this; + } + + /** + *

The middle name of the business representative.

+ */ + @JsonSetter(value = "middle_name", nulls = Nulls.SKIP) + public Builder middleName(Optional middleName) { + this.middleName = middleName; + return this; + } + + public Builder middleName(String middleName) { + this.middleName = Optional.ofNullable(middleName); + return this; + } + + public Builder middleName(Nullable middleName) { + if (middleName.isNull()) { + this.middleName = null; + } else if (middleName.isEmpty()) { + this.middleName = Optional.empty(); + } else { + this.middleName = Optional.of(middleName.get()); + } + return this; + } + + public PayoutAccountBusinessRepresentative build() { + return new PayoutAccountBusinessRepresentative( + dateOfBirth, firstName, lastName, middleName, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PayoutAccountCalculatedStatuses.java b/src/main/java/com/whop/api/types/PayoutAccountCalculatedStatuses.java new file mode 100644 index 00000000..86941a21 --- /dev/null +++ b/src/main/java/com/whop/api/types/PayoutAccountCalculatedStatuses.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PayoutAccountCalculatedStatuses { + public static final PayoutAccountCalculatedStatuses MANUAL_REVIEW = + new PayoutAccountCalculatedStatuses(Value.MANUAL_REVIEW, "manual_review"); + + public static final PayoutAccountCalculatedStatuses VERIFICATION_FAILED = + new PayoutAccountCalculatedStatuses(Value.VERIFICATION_FAILED, "verification_failed"); + + public static final PayoutAccountCalculatedStatuses BLOCKED_BY_PARENT = + new PayoutAccountCalculatedStatuses(Value.BLOCKED_BY_PARENT, "blocked_by_parent"); + + public static final PayoutAccountCalculatedStatuses CONNECTED = + new PayoutAccountCalculatedStatuses(Value.CONNECTED, "connected"); + + public static final PayoutAccountCalculatedStatuses NOT_STARTED = + new PayoutAccountCalculatedStatuses(Value.NOT_STARTED, "not_started"); + + public static final PayoutAccountCalculatedStatuses PENDING_VERIFICATION = + new PayoutAccountCalculatedStatuses(Value.PENDING_VERIFICATION, "pending_verification"); + + public static final PayoutAccountCalculatedStatuses DISABLED = + new PayoutAccountCalculatedStatuses(Value.DISABLED, "disabled"); + + public static final PayoutAccountCalculatedStatuses DENIED = + new PayoutAccountCalculatedStatuses(Value.DENIED, "denied"); + + public static final PayoutAccountCalculatedStatuses ACTION_REQUIRED = + new PayoutAccountCalculatedStatuses(Value.ACTION_REQUIRED, "action_required"); + + private final Value value; + + private final String string; + + PayoutAccountCalculatedStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PayoutAccountCalculatedStatuses + && this.string.equals(((PayoutAccountCalculatedStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANUAL_REVIEW: + return visitor.visitManualReview(); + case VERIFICATION_FAILED: + return visitor.visitVerificationFailed(); + case BLOCKED_BY_PARENT: + return visitor.visitBlockedByParent(); + case CONNECTED: + return visitor.visitConnected(); + case NOT_STARTED: + return visitor.visitNotStarted(); + case PENDING_VERIFICATION: + return visitor.visitPendingVerification(); + case DISABLED: + return visitor.visitDisabled(); + case DENIED: + return visitor.visitDenied(); + case ACTION_REQUIRED: + return visitor.visitActionRequired(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PayoutAccountCalculatedStatuses valueOf(String value) { + switch (value) { + case "manual_review": + return MANUAL_REVIEW; + case "verification_failed": + return VERIFICATION_FAILED; + case "blocked_by_parent": + return BLOCKED_BY_PARENT; + case "connected": + return CONNECTED; + case "not_started": + return NOT_STARTED; + case "pending_verification": + return PENDING_VERIFICATION; + case "disabled": + return DISABLED; + case "denied": + return DENIED; + case "action_required": + return ACTION_REQUIRED; + default: + return new PayoutAccountCalculatedStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + CONNECTED, + + DISABLED, + + ACTION_REQUIRED, + + PENDING_VERIFICATION, + + VERIFICATION_FAILED, + + MANUAL_REVIEW, + + DENIED, + + NOT_STARTED, + + BLOCKED_BY_PARENT, + + UNKNOWN + } + + public interface Visitor { + T visitConnected(); + + T visitDisabled(); + + T visitActionRequired(); + + T visitPendingVerification(); + + T visitVerificationFailed(); + + T visitManualReview(); + + T visitDenied(); + + T visitNotStarted(); + + T visitBlockedByParent(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PayoutAccountLatestVerification.java b/src/main/java/com/whop/api/types/PayoutAccountLatestVerification.java new file mode 100644 index 00000000..f85ad2b4 --- /dev/null +++ b/src/main/java/com/whop/api/types/PayoutAccountLatestVerification.java @@ -0,0 +1,312 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PayoutAccountLatestVerification.Builder.class) +public final class PayoutAccountLatestVerification { + private final String id; + + private final Optional lastErrorCode; + + private final Optional lastErrorReason; + + private final VerificationStatuses status; + + private final Map additionalProperties; + + private PayoutAccountLatestVerification( + String id, + Optional lastErrorCode, + Optional lastErrorReason, + VerificationStatuses status, + Map additionalProperties) { + this.id = id; + this.lastErrorCode = lastErrorCode; + this.lastErrorReason = lastErrorReason; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The numeric id of the verification record. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The most recent error code returned during verification. Null if no error has occurred. + */ + @JsonIgnore + public Optional getLastErrorCode() { + if (lastErrorCode == null) { + return Optional.empty(); + } + return lastErrorCode; + } + + /** + * @return A human-readable explanation of the most recent verification error. Null if no error has occurred. + */ + @JsonIgnore + public Optional getLastErrorReason() { + if (lastErrorReason == null) { + return Optional.empty(); + } + return lastErrorReason; + } + + /** + * @return The current status of this verification session. + */ + @JsonProperty("status") + public VerificationStatuses getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_error_code") + private Optional _getLastErrorCode() { + return lastErrorCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_error_reason") + private Optional _getLastErrorReason() { + return lastErrorReason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PayoutAccountLatestVerification && equalTo((PayoutAccountLatestVerification) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PayoutAccountLatestVerification other) { + return id.equals(other.id) + && lastErrorCode.equals(other.lastErrorCode) + && lastErrorReason.equals(other.lastErrorReason) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.lastErrorCode, this.lastErrorReason, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The numeric id of the verification record.

+ */ + StatusStage id(@NotNull String id); + + Builder from(PayoutAccountLatestVerification other); + } + + public interface StatusStage { + /** + *

The current status of this verification session.

+ */ + _FinalStage status(@NotNull VerificationStatuses status); + } + + public interface _FinalStage { + PayoutAccountLatestVerification build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ */ + _FinalStage lastErrorCode(Optional lastErrorCode); + + _FinalStage lastErrorCode(VerificationErrorCodes lastErrorCode); + + _FinalStage lastErrorCode(Nullable lastErrorCode); + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ */ + _FinalStage lastErrorReason(Optional lastErrorReason); + + _FinalStage lastErrorReason(String lastErrorReason); + + _FinalStage lastErrorReason(Nullable lastErrorReason); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, StatusStage, _FinalStage { + private String id; + + private VerificationStatuses status; + + private Optional lastErrorReason = Optional.empty(); + + private Optional lastErrorCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PayoutAccountLatestVerification other) { + id(other.getId()); + lastErrorCode(other.getLastErrorCode()); + lastErrorReason(other.getLastErrorReason()); + status(other.getStatus()); + return this; + } + + /** + *

The numeric id of the verification record.

+ *

The numeric id of the verification record.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current status of this verification session.

+ *

The current status of this verification session.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull VerificationStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorReason(Nullable lastErrorReason) { + if (lastErrorReason.isNull()) { + this.lastErrorReason = null; + } else if (lastErrorReason.isEmpty()) { + this.lastErrorReason = Optional.empty(); + } else { + this.lastErrorReason = Optional.of(lastErrorReason.get()); + } + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorReason(String lastErrorReason) { + this.lastErrorReason = Optional.ofNullable(lastErrorReason); + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "last_error_reason", nulls = Nulls.SKIP) + public _FinalStage lastErrorReason(Optional lastErrorReason) { + this.lastErrorReason = lastErrorReason; + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorCode(Nullable lastErrorCode) { + if (lastErrorCode.isNull()) { + this.lastErrorCode = null; + } else if (lastErrorCode.isEmpty()) { + this.lastErrorCode = Optional.empty(); + } else { + this.lastErrorCode = Optional.of(lastErrorCode.get()); + } + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorCode(VerificationErrorCodes lastErrorCode) { + this.lastErrorCode = Optional.ofNullable(lastErrorCode); + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "last_error_code", nulls = Nulls.SKIP) + public _FinalStage lastErrorCode(Optional lastErrorCode) { + this.lastErrorCode = lastErrorCode; + return this; + } + + @java.lang.Override + public PayoutAccountLatestVerification build() { + return new PayoutAccountLatestVerification( + id, lastErrorCode, lastErrorReason, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PayoutDestinationCategory.java b/src/main/java/com/whop/api/types/PayoutDestinationCategory.java new file mode 100644 index 00000000..b86d6213 --- /dev/null +++ b/src/main/java/com/whop/api/types/PayoutDestinationCategory.java @@ -0,0 +1,127 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PayoutDestinationCategory { + public static final PayoutDestinationCategory CRYPTO = new PayoutDestinationCategory(Value.CRYPTO, "crypto"); + + public static final PayoutDestinationCategory RTP = new PayoutDestinationCategory(Value.RTP, "rtp"); + + public static final PayoutDestinationCategory UNKNOWN = new PayoutDestinationCategory(Value.UNKNOWN, "unknown"); + + public static final PayoutDestinationCategory NEXT_DAY_BANK = + new PayoutDestinationCategory(Value.NEXT_DAY_BANK, "next_day_bank"); + + public static final PayoutDestinationCategory DIGITAL_WALLET = + new PayoutDestinationCategory(Value.DIGITAL_WALLET, "digital_wallet"); + + public static final PayoutDestinationCategory BANK_WIRE = + new PayoutDestinationCategory(Value.BANK_WIRE, "bank_wire"); + + private final Value value; + + private final String string; + + PayoutDestinationCategory(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PayoutDestinationCategory + && this.string.equals(((PayoutDestinationCategory) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CRYPTO: + return visitor.visitCrypto(); + case RTP: + return visitor.visitRtp(); + case UNKNOWN: + return visitor.visitUnknown(); + case NEXT_DAY_BANK: + return visitor.visitNextDayBank(); + case DIGITAL_WALLET: + return visitor.visitDigitalWallet(); + case BANK_WIRE: + return visitor.visitBankWire(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PayoutDestinationCategory valueOf(String value) { + switch (value) { + case "crypto": + return CRYPTO; + case "rtp": + return RTP; + case "unknown": + return UNKNOWN; + case "next_day_bank": + return NEXT_DAY_BANK; + case "digital_wallet": + return DIGITAL_WALLET; + case "bank_wire": + return BANK_WIRE; + default: + return new PayoutDestinationCategory(Value._UNKNOWN, value); + } + } + + public enum Value { + CRYPTO, + + RTP, + + NEXT_DAY_BANK, + + BANK_WIRE, + + DIGITAL_WALLET, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitCrypto(); + + T visitRtp(); + + T visitNextDayBank(); + + T visitBankWire(); + + T visitDigitalWallet(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PayoutErrorCodes.java b/src/main/java/com/whop/api/types/PayoutErrorCodes.java new file mode 100644 index 00000000..21c1677a --- /dev/null +++ b/src/main/java/com/whop/api/types/PayoutErrorCodes.java @@ -0,0 +1,618 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PayoutErrorCodes { + public static final PayoutErrorCodes ACCOUNT_NUMBER_INVALID_REGION = + new PayoutErrorCodes(Value.ACCOUNT_NUMBER_INVALID_REGION, "account_number_invalid_region"); + + public static final PayoutErrorCodes PROVIDER_TEMPORARILY_UNAVAILABLE = + new PayoutErrorCodes(Value.PROVIDER_TEMPORARILY_UNAVAILABLE, "provider_temporarily_unavailable"); + + public static final PayoutErrorCodes IDENTIFICATION_NUMBER_INVALID = + new PayoutErrorCodes(Value.IDENTIFICATION_NUMBER_INVALID, "identification_number_invalid"); + + public static final PayoutErrorCodes ACCOUNT_CLOSED = new PayoutErrorCodes(Value.ACCOUNT_CLOSED, "account_closed"); + + public static final PayoutErrorCodes MISSING_CITY_AND_COUNTRY = + new PayoutErrorCodes(Value.MISSING_CITY_AND_COUNTRY, "missing_city_and_country"); + + public static final PayoutErrorCodes ACCOUNT_INFORMATION_INVALID = + new PayoutErrorCodes(Value.ACCOUNT_INFORMATION_INVALID, "account_information_invalid"); + + public static final PayoutErrorCodes BENEFICIARY_NAME_MISMATCH = + new PayoutErrorCodes(Value.BENEFICIARY_NAME_MISMATCH, "beneficiary_name_mismatch"); + + public static final PayoutErrorCodes COMPLIANCE_REVIEW = + new PayoutErrorCodes(Value.COMPLIANCE_REVIEW, "compliance_review"); + + public static final PayoutErrorCodes DEPOSIT_CANCELED = + new PayoutErrorCodes(Value.DEPOSIT_CANCELED, "deposit_canceled"); + + public static final PayoutErrorCodes MANUAL_CANCELATION = + new PayoutErrorCodes(Value.MANUAL_CANCELATION, "manual_cancelation"); + + public static final PayoutErrorCodes ACCOUNT_NOT_FOUND = + new PayoutErrorCodes(Value.ACCOUNT_NOT_FOUND, "account_not_found"); + + public static final PayoutErrorCodes INVALID_BENEFICIARY = + new PayoutErrorCodes(Value.INVALID_BENEFICIARY, "invalid_beneficiary"); + + public static final PayoutErrorCodes GENERIC_PAYOUT_ERROR = + new PayoutErrorCodes(Value.GENERIC_PAYOUT_ERROR, "generic_payout_error"); + + public static final PayoutErrorCodes PAYOUT_PROVIDER_TIMEOUT = + new PayoutErrorCodes(Value.PAYOUT_PROVIDER_TIMEOUT, "payout_provider_timeout"); + + public static final PayoutErrorCodes JUNK_FAILURE_REASON = + new PayoutErrorCodes(Value.JUNK_FAILURE_REASON, "junk_failure_reason"); + + public static final PayoutErrorCodes INVALID_BRANCH_CODE = + new PayoutErrorCodes(Value.INVALID_BRANCH_CODE, "invalid_branch_code"); + + public static final PayoutErrorCodes INVALID_ACCOUNT_NUMBER = + new PayoutErrorCodes(Value.INVALID_ACCOUNT_NUMBER, "invalid_account_number"); + + public static final PayoutErrorCodes DEPOSIT_FAILED = new PayoutErrorCodes(Value.DEPOSIT_FAILED, "deposit_failed"); + + public static final PayoutErrorCodes MISC_ERROR = new PayoutErrorCodes(Value.MISC_ERROR, "misc_error"); + + public static final PayoutErrorCodes PAYEE_NAME_INVALID = + new PayoutErrorCodes(Value.PAYEE_NAME_INVALID, "payee_name_invalid"); + + public static final PayoutErrorCodes ACCOUNT_FROZEN = new PayoutErrorCodes(Value.ACCOUNT_FROZEN, "account_frozen"); + + public static final PayoutErrorCodes NON_TRANSACTION_ACCOUNT = + new PayoutErrorCodes(Value.NON_TRANSACTION_ACCOUNT, "non_transaction_account"); + + public static final PayoutErrorCodes INVALID_SWIFT_CODE = + new PayoutErrorCodes(Value.INVALID_SWIFT_CODE, "invalid_swift_code"); + + public static final PayoutErrorCodes SSN_INVALID = new PayoutErrorCodes(Value.SSN_INVALID, "ssn_invalid"); + + public static final PayoutErrorCodes MISSING_REMITTANCE_INFO = + new PayoutErrorCodes(Value.MISSING_REMITTANCE_INFO, "missing_remittance_info"); + + public static final PayoutErrorCodes WALLET_SCREENSHOT_REQUIRED = + new PayoutErrorCodes(Value.WALLET_SCREENSHOT_REQUIRED, "wallet_screenshot_required"); + + public static final PayoutErrorCodes B2B_PAYMENTS_PROHIBITED = + new PayoutErrorCodes(Value.B2B_PAYMENTS_PROHIBITED, "b2b_payments_prohibited"); + + public static final PayoutErrorCodes ATTRIBUTES_NOT_VALIDATED = + new PayoutErrorCodes(Value.ATTRIBUTES_NOT_VALIDATED, "attributes_not_validated"); + + public static final PayoutErrorCodes REJECTED_BY_COMPLIANCE = + new PayoutErrorCodes(Value.REJECTED_BY_COMPLIANCE, "rejected_by_compliance"); + + public static final PayoutErrorCodes INVALID_BRANCH_NUMBER = + new PayoutErrorCodes(Value.INVALID_BRANCH_NUMBER, "invalid_branch_number"); + + public static final PayoutErrorCodes RTP_NOT_SUPPORTED = + new PayoutErrorCodes(Value.RTP_NOT_SUPPORTED, "rtp_not_supported"); + + public static final PayoutErrorCodes UNSUPPORTED_REGION = + new PayoutErrorCodes(Value.UNSUPPORTED_REGION, "unsupported_region"); + + public static final PayoutErrorCodes MISSING_PHONE_NUMBER = + new PayoutErrorCodes(Value.MISSING_PHONE_NUMBER, "missing_phone_number"); + + public static final PayoutErrorCodes CURRENCY_NOT_SUPPORTED = + new PayoutErrorCodes(Value.CURRENCY_NOT_SUPPORTED, "currency_not_supported"); + + public static final PayoutErrorCodes AMOUNT_OUT_OF_BOUNDS = + new PayoutErrorCodes(Value.AMOUNT_OUT_OF_BOUNDS, "amount_out_of_bounds"); + + public static final PayoutErrorCodes RECEIVING_ACCOUNT_LOCKED = + new PayoutErrorCodes(Value.RECEIVING_ACCOUNT_LOCKED, "receiving_account_locked"); + + public static final PayoutErrorCodes ACCOUNT_LOOKUP_FAILED = + new PayoutErrorCodes(Value.ACCOUNT_LOOKUP_FAILED, "account_lookup_failed"); + + public static final PayoutErrorCodes EXCEEDED_ACCOUNT_LIMIT = + new PayoutErrorCodes(Value.EXCEEDED_ACCOUNT_LIMIT, "exceeded_account_limit"); + + public static final PayoutErrorCodes INVALID_BANK_CODE = + new PayoutErrorCodes(Value.INVALID_BANK_CODE, "invalid_bank_code"); + + public static final PayoutErrorCodes EXPIRED_QUOTE = new PayoutErrorCodes(Value.EXPIRED_QUOTE, "expired_quote"); + + public static final PayoutErrorCodes INVALID_PHONE_NUMBER = + new PayoutErrorCodes(Value.INVALID_PHONE_NUMBER, "invalid_phone_number"); + + public static final PayoutErrorCodes ACCOUNT_DOES_NOT_EXIST = + new PayoutErrorCodes(Value.ACCOUNT_DOES_NOT_EXIST, "account_does_not_exist"); + + public static final PayoutErrorCodes INVALID_ROUTING_NUMBER = + new PayoutErrorCodes(Value.INVALID_ROUTING_NUMBER, "invalid_routing_number"); + + public static final PayoutErrorCodes INVALID_COMPANY_DETAILS = + new PayoutErrorCodes(Value.INVALID_COMPANY_DETAILS, "invalid_company_details"); + + public static final PayoutErrorCodes INVALID_MAILING_ADDRESS = + new PayoutErrorCodes(Value.INVALID_MAILING_ADDRESS, "invalid_mailing_address"); + + public static final PayoutErrorCodes SOURCE_TOKEN_INSUFFICIENT_FUNDS = + new PayoutErrorCodes(Value.SOURCE_TOKEN_INSUFFICIENT_FUNDS, "source_token_insufficient_funds"); + + public static final PayoutErrorCodes PROVIDER_VALIDATION_FAILED = + new PayoutErrorCodes(Value.PROVIDER_VALIDATION_FAILED, "provider_validation_failed"); + + public static final PayoutErrorCodes TECHNICAL_PROBLEM = + new PayoutErrorCodes(Value.TECHNICAL_PROBLEM, "technical_problem"); + + public static final PayoutErrorCodes BANK_STATEMENT_REQUIRED = + new PayoutErrorCodes(Value.BANK_STATEMENT_REQUIRED, "bank_statement_required"); + + public static final PayoutErrorCodes DEPOSIT_REJECTED = + new PayoutErrorCodes(Value.DEPOSIT_REJECTED, "deposit_rejected"); + + public static final PayoutErrorCodes DESTINATION_UNAVAILABLE = + new PayoutErrorCodes(Value.DESTINATION_UNAVAILABLE, "destination_unavailable"); + + private final Value value; + + private final String string; + + PayoutErrorCodes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PayoutErrorCodes && this.string.equals(((PayoutErrorCodes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ACCOUNT_NUMBER_INVALID_REGION: + return visitor.visitAccountNumberInvalidRegion(); + case PROVIDER_TEMPORARILY_UNAVAILABLE: + return visitor.visitProviderTemporarilyUnavailable(); + case IDENTIFICATION_NUMBER_INVALID: + return visitor.visitIdentificationNumberInvalid(); + case ACCOUNT_CLOSED: + return visitor.visitAccountClosed(); + case MISSING_CITY_AND_COUNTRY: + return visitor.visitMissingCityAndCountry(); + case ACCOUNT_INFORMATION_INVALID: + return visitor.visitAccountInformationInvalid(); + case BENEFICIARY_NAME_MISMATCH: + return visitor.visitBeneficiaryNameMismatch(); + case COMPLIANCE_REVIEW: + return visitor.visitComplianceReview(); + case DEPOSIT_CANCELED: + return visitor.visitDepositCanceled(); + case MANUAL_CANCELATION: + return visitor.visitManualCancelation(); + case ACCOUNT_NOT_FOUND: + return visitor.visitAccountNotFound(); + case INVALID_BENEFICIARY: + return visitor.visitInvalidBeneficiary(); + case GENERIC_PAYOUT_ERROR: + return visitor.visitGenericPayoutError(); + case PAYOUT_PROVIDER_TIMEOUT: + return visitor.visitPayoutProviderTimeout(); + case JUNK_FAILURE_REASON: + return visitor.visitJunkFailureReason(); + case INVALID_BRANCH_CODE: + return visitor.visitInvalidBranchCode(); + case INVALID_ACCOUNT_NUMBER: + return visitor.visitInvalidAccountNumber(); + case DEPOSIT_FAILED: + return visitor.visitDepositFailed(); + case MISC_ERROR: + return visitor.visitMiscError(); + case PAYEE_NAME_INVALID: + return visitor.visitPayeeNameInvalid(); + case ACCOUNT_FROZEN: + return visitor.visitAccountFrozen(); + case NON_TRANSACTION_ACCOUNT: + return visitor.visitNonTransactionAccount(); + case INVALID_SWIFT_CODE: + return visitor.visitInvalidSwiftCode(); + case SSN_INVALID: + return visitor.visitSsnInvalid(); + case MISSING_REMITTANCE_INFO: + return visitor.visitMissingRemittanceInfo(); + case WALLET_SCREENSHOT_REQUIRED: + return visitor.visitWalletScreenshotRequired(); + case B2B_PAYMENTS_PROHIBITED: + return visitor.visitB2BPaymentsProhibited(); + case ATTRIBUTES_NOT_VALIDATED: + return visitor.visitAttributesNotValidated(); + case REJECTED_BY_COMPLIANCE: + return visitor.visitRejectedByCompliance(); + case INVALID_BRANCH_NUMBER: + return visitor.visitInvalidBranchNumber(); + case RTP_NOT_SUPPORTED: + return visitor.visitRtpNotSupported(); + case UNSUPPORTED_REGION: + return visitor.visitUnsupportedRegion(); + case MISSING_PHONE_NUMBER: + return visitor.visitMissingPhoneNumber(); + case CURRENCY_NOT_SUPPORTED: + return visitor.visitCurrencyNotSupported(); + case AMOUNT_OUT_OF_BOUNDS: + return visitor.visitAmountOutOfBounds(); + case RECEIVING_ACCOUNT_LOCKED: + return visitor.visitReceivingAccountLocked(); + case ACCOUNT_LOOKUP_FAILED: + return visitor.visitAccountLookupFailed(); + case EXCEEDED_ACCOUNT_LIMIT: + return visitor.visitExceededAccountLimit(); + case INVALID_BANK_CODE: + return visitor.visitInvalidBankCode(); + case EXPIRED_QUOTE: + return visitor.visitExpiredQuote(); + case INVALID_PHONE_NUMBER: + return visitor.visitInvalidPhoneNumber(); + case ACCOUNT_DOES_NOT_EXIST: + return visitor.visitAccountDoesNotExist(); + case INVALID_ROUTING_NUMBER: + return visitor.visitInvalidRoutingNumber(); + case INVALID_COMPANY_DETAILS: + return visitor.visitInvalidCompanyDetails(); + case INVALID_MAILING_ADDRESS: + return visitor.visitInvalidMailingAddress(); + case SOURCE_TOKEN_INSUFFICIENT_FUNDS: + return visitor.visitSourceTokenInsufficientFunds(); + case PROVIDER_VALIDATION_FAILED: + return visitor.visitProviderValidationFailed(); + case TECHNICAL_PROBLEM: + return visitor.visitTechnicalProblem(); + case BANK_STATEMENT_REQUIRED: + return visitor.visitBankStatementRequired(); + case DEPOSIT_REJECTED: + return visitor.visitDepositRejected(); + case DESTINATION_UNAVAILABLE: + return visitor.visitDestinationUnavailable(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PayoutErrorCodes valueOf(String value) { + switch (value) { + case "account_number_invalid_region": + return ACCOUNT_NUMBER_INVALID_REGION; + case "provider_temporarily_unavailable": + return PROVIDER_TEMPORARILY_UNAVAILABLE; + case "identification_number_invalid": + return IDENTIFICATION_NUMBER_INVALID; + case "account_closed": + return ACCOUNT_CLOSED; + case "missing_city_and_country": + return MISSING_CITY_AND_COUNTRY; + case "account_information_invalid": + return ACCOUNT_INFORMATION_INVALID; + case "beneficiary_name_mismatch": + return BENEFICIARY_NAME_MISMATCH; + case "compliance_review": + return COMPLIANCE_REVIEW; + case "deposit_canceled": + return DEPOSIT_CANCELED; + case "manual_cancelation": + return MANUAL_CANCELATION; + case "account_not_found": + return ACCOUNT_NOT_FOUND; + case "invalid_beneficiary": + return INVALID_BENEFICIARY; + case "generic_payout_error": + return GENERIC_PAYOUT_ERROR; + case "payout_provider_timeout": + return PAYOUT_PROVIDER_TIMEOUT; + case "junk_failure_reason": + return JUNK_FAILURE_REASON; + case "invalid_branch_code": + return INVALID_BRANCH_CODE; + case "invalid_account_number": + return INVALID_ACCOUNT_NUMBER; + case "deposit_failed": + return DEPOSIT_FAILED; + case "misc_error": + return MISC_ERROR; + case "payee_name_invalid": + return PAYEE_NAME_INVALID; + case "account_frozen": + return ACCOUNT_FROZEN; + case "non_transaction_account": + return NON_TRANSACTION_ACCOUNT; + case "invalid_swift_code": + return INVALID_SWIFT_CODE; + case "ssn_invalid": + return SSN_INVALID; + case "missing_remittance_info": + return MISSING_REMITTANCE_INFO; + case "wallet_screenshot_required": + return WALLET_SCREENSHOT_REQUIRED; + case "b2b_payments_prohibited": + return B2B_PAYMENTS_PROHIBITED; + case "attributes_not_validated": + return ATTRIBUTES_NOT_VALIDATED; + case "rejected_by_compliance": + return REJECTED_BY_COMPLIANCE; + case "invalid_branch_number": + return INVALID_BRANCH_NUMBER; + case "rtp_not_supported": + return RTP_NOT_SUPPORTED; + case "unsupported_region": + return UNSUPPORTED_REGION; + case "missing_phone_number": + return MISSING_PHONE_NUMBER; + case "currency_not_supported": + return CURRENCY_NOT_SUPPORTED; + case "amount_out_of_bounds": + return AMOUNT_OUT_OF_BOUNDS; + case "receiving_account_locked": + return RECEIVING_ACCOUNT_LOCKED; + case "account_lookup_failed": + return ACCOUNT_LOOKUP_FAILED; + case "exceeded_account_limit": + return EXCEEDED_ACCOUNT_LIMIT; + case "invalid_bank_code": + return INVALID_BANK_CODE; + case "expired_quote": + return EXPIRED_QUOTE; + case "invalid_phone_number": + return INVALID_PHONE_NUMBER; + case "account_does_not_exist": + return ACCOUNT_DOES_NOT_EXIST; + case "invalid_routing_number": + return INVALID_ROUTING_NUMBER; + case "invalid_company_details": + return INVALID_COMPANY_DETAILS; + case "invalid_mailing_address": + return INVALID_MAILING_ADDRESS; + case "source_token_insufficient_funds": + return SOURCE_TOKEN_INSUFFICIENT_FUNDS; + case "provider_validation_failed": + return PROVIDER_VALIDATION_FAILED; + case "technical_problem": + return TECHNICAL_PROBLEM; + case "bank_statement_required": + return BANK_STATEMENT_REQUIRED; + case "deposit_rejected": + return DEPOSIT_REJECTED; + case "destination_unavailable": + return DESTINATION_UNAVAILABLE; + default: + return new PayoutErrorCodes(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT_CLOSED, + + ACCOUNT_DOES_NOT_EXIST, + + ACCOUNT_INFORMATION_INVALID, + + ACCOUNT_NUMBER_INVALID_REGION, + + ACCOUNT_FROZEN, + + ACCOUNT_LOOKUP_FAILED, + + ACCOUNT_NOT_FOUND, + + AMOUNT_OUT_OF_BOUNDS, + + ATTRIBUTES_NOT_VALIDATED, + + B2B_PAYMENTS_PROHIBITED, + + BANK_STATEMENT_REQUIRED, + + COMPLIANCE_REVIEW, + + CURRENCY_NOT_SUPPORTED, + + DEPOSIT_CANCELED, + + DEPOSIT_FAILED, + + DEPOSIT_REJECTED, + + DESTINATION_UNAVAILABLE, + + EXCEEDED_ACCOUNT_LIMIT, + + EXPIRED_QUOTE, + + GENERIC_PAYOUT_ERROR, + + JUNK_FAILURE_REASON, + + TECHNICAL_PROBLEM, + + PROVIDER_TEMPORARILY_UNAVAILABLE, + + PROVIDER_VALIDATION_FAILED, + + IDENTIFICATION_NUMBER_INVALID, + + INVALID_ACCOUNT_NUMBER, + + INVALID_BANK_CODE, + + INVALID_BENEFICIARY, + + INVALID_MAILING_ADDRESS, + + INVALID_BRANCH_NUMBER, + + INVALID_BRANCH_CODE, + + INVALID_PHONE_NUMBER, + + INVALID_ROUTING_NUMBER, + + INVALID_SWIFT_CODE, + + INVALID_COMPANY_DETAILS, + + MANUAL_CANCELATION, + + MISC_ERROR, + + MISSING_CITY_AND_COUNTRY, + + MISSING_PHONE_NUMBER, + + MISSING_REMITTANCE_INFO, + + PAYEE_NAME_INVALID, + + BENEFICIARY_NAME_MISMATCH, + + RECEIVING_ACCOUNT_LOCKED, + + REJECTED_BY_COMPLIANCE, + + RTP_NOT_SUPPORTED, + + NON_TRANSACTION_ACCOUNT, + + SOURCE_TOKEN_INSUFFICIENT_FUNDS, + + SSN_INVALID, + + WALLET_SCREENSHOT_REQUIRED, + + UNSUPPORTED_REGION, + + PAYOUT_PROVIDER_TIMEOUT, + + UNKNOWN + } + + public interface Visitor { + T visitAccountClosed(); + + T visitAccountDoesNotExist(); + + T visitAccountInformationInvalid(); + + T visitAccountNumberInvalidRegion(); + + T visitAccountFrozen(); + + T visitAccountLookupFailed(); + + T visitAccountNotFound(); + + T visitAmountOutOfBounds(); + + T visitAttributesNotValidated(); + + T visitB2BPaymentsProhibited(); + + T visitBankStatementRequired(); + + T visitComplianceReview(); + + T visitCurrencyNotSupported(); + + T visitDepositCanceled(); + + T visitDepositFailed(); + + T visitDepositRejected(); + + T visitDestinationUnavailable(); + + T visitExceededAccountLimit(); + + T visitExpiredQuote(); + + T visitGenericPayoutError(); + + T visitJunkFailureReason(); + + T visitTechnicalProblem(); + + T visitProviderTemporarilyUnavailable(); + + T visitProviderValidationFailed(); + + T visitIdentificationNumberInvalid(); + + T visitInvalidAccountNumber(); + + T visitInvalidBankCode(); + + T visitInvalidBeneficiary(); + + T visitInvalidMailingAddress(); + + T visitInvalidBranchNumber(); + + T visitInvalidBranchCode(); + + T visitInvalidPhoneNumber(); + + T visitInvalidRoutingNumber(); + + T visitInvalidSwiftCode(); + + T visitInvalidCompanyDetails(); + + T visitManualCancelation(); + + T visitMiscError(); + + T visitMissingCityAndCountry(); + + T visitMissingPhoneNumber(); + + T visitMissingRemittanceInfo(); + + T visitPayeeNameInvalid(); + + T visitBeneficiaryNameMismatch(); + + T visitReceivingAccountLocked(); + + T visitRejectedByCompliance(); + + T visitRtpNotSupported(); + + T visitNonTransactionAccount(); + + T visitSourceTokenInsufficientFunds(); + + T visitSsnInvalid(); + + T visitWalletScreenshotRequired(); + + T visitUnsupportedRegion(); + + T visitPayoutProviderTimeout(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PayoutMethod.java b/src/main/java/com/whop/api/types/PayoutMethod.java new file mode 100644 index 00000000..e32fc70c --- /dev/null +++ b/src/main/java/com/whop/api/types/PayoutMethod.java @@ -0,0 +1,611 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PayoutMethod.Builder.class) +public final class PayoutMethod { + private final Optional accountReference; + + private final Optional company; + + private final OffsetDateTime createdAt; + + private final String currency; + + private final Optional destination; + + private final String id; + + private final Optional institutionName; + + private final boolean isDefault; + + private final Optional nickname; + + private final Map additionalProperties; + + private PayoutMethod( + Optional accountReference, + Optional company, + OffsetDateTime createdAt, + String currency, + Optional destination, + String id, + Optional institutionName, + boolean isDefault, + Optional nickname, + Map additionalProperties) { + this.accountReference = accountReference; + this.company = company; + this.createdAt = createdAt; + this.currency = currency; + this.destination = destination; + this.id = id; + this.institutionName = institutionName; + this.isDefault = isDefault; + this.nickname = nickname; + this.additionalProperties = additionalProperties; + } + + /** + * @return A masked identifier for the payout destination, such as the last four digits of a bank account or an email address. Null if no reference is available. + */ + @JsonIgnore + public Optional getAccountReference() { + if (accountReference == null) { + return Optional.empty(); + } + return accountReference; + } + + /** + * @return The company associated with this payout destination. Null if not linked to a specific company. + */ + @JsonIgnore + public Optional getCompany() { + if (company == null) { + return Optional.empty(); + } + return company; + } + + /** + * @return The datetime the payout token was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code that payouts are delivered in for this destination. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return The payout destination configuration linked to this token. Null if not yet configured. + */ + @JsonIgnore + public Optional getDestination() { + if (destination == null) { + return Optional.empty(); + } + return destination; + } + + /** + * @return The unique identifier for the payout token. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The name of the bank or financial institution receiving payouts. Null if not applicable or not provided. + */ + @JsonIgnore + public Optional getInstitutionName() { + if (institutionName == null) { + return Optional.empty(); + } + return institutionName; + } + + /** + * @return Whether this is the default payout destination for the associated payout account. + */ + @JsonProperty("is_default") + public boolean getIsDefault() { + return isDefault; + } + + /** + * @return A user-defined label to help identify this payout destination. Not sent to the provider. Null if no nickname has been set. + */ + @JsonIgnore + public Optional getNickname() { + if (nickname == null) { + return Optional.empty(); + } + return nickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_reference") + private Optional _getAccountReference() { + return accountReference; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company") + private Optional _getCompany() { + return company; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination") + private Optional _getDestination() { + return destination; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("institution_name") + private Optional _getInstitutionName() { + return institutionName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("nickname") + private Optional _getNickname() { + return nickname; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PayoutMethod && equalTo((PayoutMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PayoutMethod other) { + return accountReference.equals(other.accountReference) + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && destination.equals(other.destination) + && id.equals(other.id) + && institutionName.equals(other.institutionName) + && isDefault == other.isDefault + && nickname.equals(other.nickname); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountReference, + this.company, + this.createdAt, + this.currency, + this.destination, + this.id, + this.institutionName, + this.isDefault, + this.nickname); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the payout token was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PayoutMethod other); + } + + public interface CurrencyStage { + /** + *

The three-letter ISO currency code that payouts are delivered in for this destination.

+ */ + IdStage currency(@NotNull String currency); + } + + public interface IdStage { + /** + *

The unique identifier for the payout token.

+ */ + IsDefaultStage id(@NotNull String id); + } + + public interface IsDefaultStage { + /** + *

Whether this is the default payout destination for the associated payout account.

+ */ + _FinalStage isDefault(boolean isDefault); + } + + public interface _FinalStage { + PayoutMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A masked identifier for the payout destination, such as the last four digits of a bank account or an email address. Null if no reference is available.

+ */ + _FinalStage accountReference(Optional accountReference); + + _FinalStage accountReference(String accountReference); + + _FinalStage accountReference(Nullable accountReference); + + /** + *

The company associated with this payout destination. Null if not linked to a specific company.

+ */ + _FinalStage company(Optional company); + + _FinalStage company(PayoutMethodCompany company); + + _FinalStage company(Nullable company); + + /** + *

The payout destination configuration linked to this token. Null if not yet configured.

+ */ + _FinalStage destination(Optional destination); + + _FinalStage destination(PayoutMethodDestination destination); + + _FinalStage destination(Nullable destination); + + /** + *

The name of the bank or financial institution receiving payouts. Null if not applicable or not provided.

+ */ + _FinalStage institutionName(Optional institutionName); + + _FinalStage institutionName(String institutionName); + + _FinalStage institutionName(Nullable institutionName); + + /** + *

A user-defined label to help identify this payout destination. Not sent to the provider. Null if no nickname has been set.

+ */ + _FinalStage nickname(Optional nickname); + + _FinalStage nickname(String nickname); + + _FinalStage nickname(Nullable nickname); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, CurrencyStage, IdStage, IsDefaultStage, _FinalStage { + private OffsetDateTime createdAt; + + private String currency; + + private String id; + + private boolean isDefault; + + private Optional nickname = Optional.empty(); + + private Optional institutionName = Optional.empty(); + + private Optional destination = Optional.empty(); + + private Optional company = Optional.empty(); + + private Optional accountReference = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PayoutMethod other) { + accountReference(other.getAccountReference()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + destination(other.getDestination()); + id(other.getId()); + institutionName(other.getInstitutionName()); + isDefault(other.getIsDefault()); + nickname(other.getNickname()); + return this; + } + + /** + *

The datetime the payout token was created.

+ *

The datetime the payout token was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The three-letter ISO currency code that payouts are delivered in for this destination.

+ *

The three-letter ISO currency code that payouts are delivered in for this destination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier for the payout token.

+ *

The unique identifier for the payout token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsDefaultStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether this is the default payout destination for the associated payout account.

+ *

Whether this is the default payout destination for the associated payout account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_default") + public _FinalStage isDefault(boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + /** + *

A user-defined label to help identify this payout destination. Not sent to the provider. Null if no nickname has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(Nullable nickname) { + if (nickname.isNull()) { + this.nickname = null; + } else if (nickname.isEmpty()) { + this.nickname = Optional.empty(); + } else { + this.nickname = Optional.of(nickname.get()); + } + return this; + } + + /** + *

A user-defined label to help identify this payout destination. Not sent to the provider. Null if no nickname has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(String nickname) { + this.nickname = Optional.ofNullable(nickname); + return this; + } + + /** + *

A user-defined label to help identify this payout destination. Not sent to the provider. Null if no nickname has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "nickname", nulls = Nulls.SKIP) + public _FinalStage nickname(Optional nickname) { + this.nickname = nickname; + return this; + } + + /** + *

The name of the bank or financial institution receiving payouts. Null if not applicable or not provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage institutionName(Nullable institutionName) { + if (institutionName.isNull()) { + this.institutionName = null; + } else if (institutionName.isEmpty()) { + this.institutionName = Optional.empty(); + } else { + this.institutionName = Optional.of(institutionName.get()); + } + return this; + } + + /** + *

The name of the bank or financial institution receiving payouts. Null if not applicable or not provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage institutionName(String institutionName) { + this.institutionName = Optional.ofNullable(institutionName); + return this; + } + + /** + *

The name of the bank or financial institution receiving payouts. Null if not applicable or not provided.

+ */ + @java.lang.Override + @JsonSetter(value = "institution_name", nulls = Nulls.SKIP) + public _FinalStage institutionName(Optional institutionName) { + this.institutionName = institutionName; + return this; + } + + /** + *

The payout destination configuration linked to this token. Null if not yet configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destination(Nullable destination) { + if (destination.isNull()) { + this.destination = null; + } else if (destination.isEmpty()) { + this.destination = Optional.empty(); + } else { + this.destination = Optional.of(destination.get()); + } + return this; + } + + /** + *

The payout destination configuration linked to this token. Null if not yet configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destination(PayoutMethodDestination destination) { + this.destination = Optional.ofNullable(destination); + return this; + } + + /** + *

The payout destination configuration linked to this token. Null if not yet configured.

+ */ + @java.lang.Override + @JsonSetter(value = "destination", nulls = Nulls.SKIP) + public _FinalStage destination(Optional destination) { + this.destination = destination; + return this; + } + + /** + *

The company associated with this payout destination. Null if not linked to a specific company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(Nullable company) { + if (company.isNull()) { + this.company = null; + } else if (company.isEmpty()) { + this.company = Optional.empty(); + } else { + this.company = Optional.of(company.get()); + } + return this; + } + + /** + *

The company associated with this payout destination. Null if not linked to a specific company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(PayoutMethodCompany company) { + this.company = Optional.ofNullable(company); + return this; + } + + /** + *

The company associated with this payout destination. Null if not linked to a specific company.

+ */ + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + + /** + *

A masked identifier for the payout destination, such as the last four digits of a bank account or an email address. Null if no reference is available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountReference(Nullable accountReference) { + if (accountReference.isNull()) { + this.accountReference = null; + } else if (accountReference.isEmpty()) { + this.accountReference = Optional.empty(); + } else { + this.accountReference = Optional.of(accountReference.get()); + } + return this; + } + + /** + *

A masked identifier for the payout destination, such as the last four digits of a bank account or an email address. Null if no reference is available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountReference(String accountReference) { + this.accountReference = Optional.ofNullable(accountReference); + return this; + } + + /** + *

A masked identifier for the payout destination, such as the last four digits of a bank account or an email address. Null if no reference is available.

+ */ + @java.lang.Override + @JsonSetter(value = "account_reference", nulls = Nulls.SKIP) + public _FinalStage accountReference(Optional accountReference) { + this.accountReference = accountReference; + return this; + } + + @java.lang.Override + public PayoutMethod build() { + return new PayoutMethod( + accountReference, + company, + createdAt, + currency, + destination, + id, + institutionName, + isDefault, + nickname, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PayoutMethodCompany.java b/src/main/java/com/whop/api/types/PayoutMethodCompany.java new file mode 100644 index 00000000..2f954f24 --- /dev/null +++ b/src/main/java/com/whop/api/types/PayoutMethodCompany.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PayoutMethodCompany.Builder.class) +public final class PayoutMethodCompany { + private final String id; + + private final Map additionalProperties; + + private PayoutMethodCompany(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PayoutMethodCompany && equalTo((PayoutMethodCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PayoutMethodCompany other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PayoutMethodCompany other); + } + + public interface _FinalStage { + PayoutMethodCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PayoutMethodCompany other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public PayoutMethodCompany build() { + return new PayoutMethodCompany(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PayoutMethodDestination.java b/src/main/java/com/whop/api/types/PayoutMethodDestination.java new file mode 100644 index 00000000..c0b5712f --- /dev/null +++ b/src/main/java/com/whop/api/types/PayoutMethodDestination.java @@ -0,0 +1,199 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PayoutMethodDestination.Builder.class) +public final class PayoutMethodDestination { + private final PayoutDestinationCategory category; + + private final String countryCode; + + private final String name; + + private final Map additionalProperties; + + private PayoutMethodDestination( + PayoutDestinationCategory category, + String countryCode, + String name, + Map additionalProperties) { + this.category = category; + this.countryCode = countryCode; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The category of the payout destination + */ + @JsonProperty("category") + public PayoutDestinationCategory getCategory() { + return category; + } + + /** + * @return The country code of the payout destination + */ + @JsonProperty("country_code") + public String getCountryCode() { + return countryCode; + } + + /** + * @return The name of the payer associated with the payout destination + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PayoutMethodDestination && equalTo((PayoutMethodDestination) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PayoutMethodDestination other) { + return category.equals(other.category) && countryCode.equals(other.countryCode) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.category, this.countryCode, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CategoryStage builder() { + return new Builder(); + } + + public interface CategoryStage { + /** + *

The category of the payout destination

+ */ + CountryCodeStage category(@NotNull PayoutDestinationCategory category); + + Builder from(PayoutMethodDestination other); + } + + public interface CountryCodeStage { + /** + *

The country code of the payout destination

+ */ + NameStage countryCode(@NotNull String countryCode); + } + + public interface NameStage { + /** + *

The name of the payer associated with the payout destination

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + PayoutMethodDestination build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CategoryStage, CountryCodeStage, NameStage, _FinalStage { + private PayoutDestinationCategory category; + + private String countryCode; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PayoutMethodDestination other) { + category(other.getCategory()); + countryCode(other.getCountryCode()); + name(other.getName()); + return this; + } + + /** + *

The category of the payout destination

+ *

The category of the payout destination

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("category") + public CountryCodeStage category(@NotNull PayoutDestinationCategory category) { + this.category = Objects.requireNonNull(category, "category must not be null"); + return this; + } + + /** + *

The country code of the payout destination

+ *

The country code of the payout destination

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("country_code") + public NameStage countryCode(@NotNull String countryCode) { + this.countryCode = Objects.requireNonNull(countryCode, "countryCode must not be null"); + return this; + } + + /** + *

The name of the payer associated with the payout destination

+ *

The name of the payer associated with the payout destination

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public PayoutMethodDestination build() { + return new PayoutMethodDestination(category, countryCode, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PayoutMethodListItem.java b/src/main/java/com/whop/api/types/PayoutMethodListItem.java new file mode 100644 index 00000000..9fac3606 --- /dev/null +++ b/src/main/java/com/whop/api/types/PayoutMethodListItem.java @@ -0,0 +1,611 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PayoutMethodListItem.Builder.class) +public final class PayoutMethodListItem { + private final Optional accountReference; + + private final Optional company; + + private final OffsetDateTime createdAt; + + private final String currency; + + private final Optional destination; + + private final String id; + + private final Optional institutionName; + + private final boolean isDefault; + + private final Optional nickname; + + private final Map additionalProperties; + + private PayoutMethodListItem( + Optional accountReference, + Optional company, + OffsetDateTime createdAt, + String currency, + Optional destination, + String id, + Optional institutionName, + boolean isDefault, + Optional nickname, + Map additionalProperties) { + this.accountReference = accountReference; + this.company = company; + this.createdAt = createdAt; + this.currency = currency; + this.destination = destination; + this.id = id; + this.institutionName = institutionName; + this.isDefault = isDefault; + this.nickname = nickname; + this.additionalProperties = additionalProperties; + } + + /** + * @return A masked identifier for the payout destination, such as the last four digits of a bank account or an email address. Null if no reference is available. + */ + @JsonIgnore + public Optional getAccountReference() { + if (accountReference == null) { + return Optional.empty(); + } + return accountReference; + } + + /** + * @return The company associated with this payout destination. Null if not linked to a specific company. + */ + @JsonIgnore + public Optional getCompany() { + if (company == null) { + return Optional.empty(); + } + return company; + } + + /** + * @return The datetime the payout token was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code that payouts are delivered in for this destination. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return The payout destination configuration linked to this token. Null if not yet configured. + */ + @JsonIgnore + public Optional getDestination() { + if (destination == null) { + return Optional.empty(); + } + return destination; + } + + /** + * @return The unique identifier for the payout token. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The name of the bank or financial institution receiving payouts. Null if not applicable or not provided. + */ + @JsonIgnore + public Optional getInstitutionName() { + if (institutionName == null) { + return Optional.empty(); + } + return institutionName; + } + + /** + * @return Whether this is the default payout destination for the associated payout account. + */ + @JsonProperty("is_default") + public boolean getIsDefault() { + return isDefault; + } + + /** + * @return A user-defined label to help identify this payout destination. Not sent to the provider. Null if no nickname has been set. + */ + @JsonIgnore + public Optional getNickname() { + if (nickname == null) { + return Optional.empty(); + } + return nickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_reference") + private Optional _getAccountReference() { + return accountReference; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company") + private Optional _getCompany() { + return company; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination") + private Optional _getDestination() { + return destination; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("institution_name") + private Optional _getInstitutionName() { + return institutionName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("nickname") + private Optional _getNickname() { + return nickname; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PayoutMethodListItem && equalTo((PayoutMethodListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PayoutMethodListItem other) { + return accountReference.equals(other.accountReference) + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && destination.equals(other.destination) + && id.equals(other.id) + && institutionName.equals(other.institutionName) + && isDefault == other.isDefault + && nickname.equals(other.nickname); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountReference, + this.company, + this.createdAt, + this.currency, + this.destination, + this.id, + this.institutionName, + this.isDefault, + this.nickname); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the payout token was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PayoutMethodListItem other); + } + + public interface CurrencyStage { + /** + *

The three-letter ISO currency code that payouts are delivered in for this destination.

+ */ + IdStage currency(@NotNull String currency); + } + + public interface IdStage { + /** + *

The unique identifier for the payout token.

+ */ + IsDefaultStage id(@NotNull String id); + } + + public interface IsDefaultStage { + /** + *

Whether this is the default payout destination for the associated payout account.

+ */ + _FinalStage isDefault(boolean isDefault); + } + + public interface _FinalStage { + PayoutMethodListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A masked identifier for the payout destination, such as the last four digits of a bank account or an email address. Null if no reference is available.

+ */ + _FinalStage accountReference(Optional accountReference); + + _FinalStage accountReference(String accountReference); + + _FinalStage accountReference(Nullable accountReference); + + /** + *

The company associated with this payout destination. Null if not linked to a specific company.

+ */ + _FinalStage company(Optional company); + + _FinalStage company(PayoutMethodListItemCompany company); + + _FinalStage company(Nullable company); + + /** + *

The payout destination configuration linked to this token. Null if not yet configured.

+ */ + _FinalStage destination(Optional destination); + + _FinalStage destination(PayoutMethodListItemDestination destination); + + _FinalStage destination(Nullable destination); + + /** + *

The name of the bank or financial institution receiving payouts. Null if not applicable or not provided.

+ */ + _FinalStage institutionName(Optional institutionName); + + _FinalStage institutionName(String institutionName); + + _FinalStage institutionName(Nullable institutionName); + + /** + *

A user-defined label to help identify this payout destination. Not sent to the provider. Null if no nickname has been set.

+ */ + _FinalStage nickname(Optional nickname); + + _FinalStage nickname(String nickname); + + _FinalStage nickname(Nullable nickname); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, CurrencyStage, IdStage, IsDefaultStage, _FinalStage { + private OffsetDateTime createdAt; + + private String currency; + + private String id; + + private boolean isDefault; + + private Optional nickname = Optional.empty(); + + private Optional institutionName = Optional.empty(); + + private Optional destination = Optional.empty(); + + private Optional company = Optional.empty(); + + private Optional accountReference = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PayoutMethodListItem other) { + accountReference(other.getAccountReference()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + destination(other.getDestination()); + id(other.getId()); + institutionName(other.getInstitutionName()); + isDefault(other.getIsDefault()); + nickname(other.getNickname()); + return this; + } + + /** + *

The datetime the payout token was created.

+ *

The datetime the payout token was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The three-letter ISO currency code that payouts are delivered in for this destination.

+ *

The three-letter ISO currency code that payouts are delivered in for this destination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier for the payout token.

+ *

The unique identifier for the payout token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsDefaultStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether this is the default payout destination for the associated payout account.

+ *

Whether this is the default payout destination for the associated payout account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_default") + public _FinalStage isDefault(boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + /** + *

A user-defined label to help identify this payout destination. Not sent to the provider. Null if no nickname has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(Nullable nickname) { + if (nickname.isNull()) { + this.nickname = null; + } else if (nickname.isEmpty()) { + this.nickname = Optional.empty(); + } else { + this.nickname = Optional.of(nickname.get()); + } + return this; + } + + /** + *

A user-defined label to help identify this payout destination. Not sent to the provider. Null if no nickname has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(String nickname) { + this.nickname = Optional.ofNullable(nickname); + return this; + } + + /** + *

A user-defined label to help identify this payout destination. Not sent to the provider. Null if no nickname has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "nickname", nulls = Nulls.SKIP) + public _FinalStage nickname(Optional nickname) { + this.nickname = nickname; + return this; + } + + /** + *

The name of the bank or financial institution receiving payouts. Null if not applicable or not provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage institutionName(Nullable institutionName) { + if (institutionName.isNull()) { + this.institutionName = null; + } else if (institutionName.isEmpty()) { + this.institutionName = Optional.empty(); + } else { + this.institutionName = Optional.of(institutionName.get()); + } + return this; + } + + /** + *

The name of the bank or financial institution receiving payouts. Null if not applicable or not provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage institutionName(String institutionName) { + this.institutionName = Optional.ofNullable(institutionName); + return this; + } + + /** + *

The name of the bank or financial institution receiving payouts. Null if not applicable or not provided.

+ */ + @java.lang.Override + @JsonSetter(value = "institution_name", nulls = Nulls.SKIP) + public _FinalStage institutionName(Optional institutionName) { + this.institutionName = institutionName; + return this; + } + + /** + *

The payout destination configuration linked to this token. Null if not yet configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destination(Nullable destination) { + if (destination.isNull()) { + this.destination = null; + } else if (destination.isEmpty()) { + this.destination = Optional.empty(); + } else { + this.destination = Optional.of(destination.get()); + } + return this; + } + + /** + *

The payout destination configuration linked to this token. Null if not yet configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destination(PayoutMethodListItemDestination destination) { + this.destination = Optional.ofNullable(destination); + return this; + } + + /** + *

The payout destination configuration linked to this token. Null if not yet configured.

+ */ + @java.lang.Override + @JsonSetter(value = "destination", nulls = Nulls.SKIP) + public _FinalStage destination(Optional destination) { + this.destination = destination; + return this; + } + + /** + *

The company associated with this payout destination. Null if not linked to a specific company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(Nullable company) { + if (company.isNull()) { + this.company = null; + } else if (company.isEmpty()) { + this.company = Optional.empty(); + } else { + this.company = Optional.of(company.get()); + } + return this; + } + + /** + *

The company associated with this payout destination. Null if not linked to a specific company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(PayoutMethodListItemCompany company) { + this.company = Optional.ofNullable(company); + return this; + } + + /** + *

The company associated with this payout destination. Null if not linked to a specific company.

+ */ + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + + /** + *

A masked identifier for the payout destination, such as the last four digits of a bank account or an email address. Null if no reference is available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountReference(Nullable accountReference) { + if (accountReference.isNull()) { + this.accountReference = null; + } else if (accountReference.isEmpty()) { + this.accountReference = Optional.empty(); + } else { + this.accountReference = Optional.of(accountReference.get()); + } + return this; + } + + /** + *

A masked identifier for the payout destination, such as the last four digits of a bank account or an email address. Null if no reference is available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountReference(String accountReference) { + this.accountReference = Optional.ofNullable(accountReference); + return this; + } + + /** + *

A masked identifier for the payout destination, such as the last four digits of a bank account or an email address. Null if no reference is available.

+ */ + @java.lang.Override + @JsonSetter(value = "account_reference", nulls = Nulls.SKIP) + public _FinalStage accountReference(Optional accountReference) { + this.accountReference = accountReference; + return this; + } + + @java.lang.Override + public PayoutMethodListItem build() { + return new PayoutMethodListItem( + accountReference, + company, + createdAt, + currency, + destination, + id, + institutionName, + isDefault, + nickname, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PayoutMethodListItemCompany.java b/src/main/java/com/whop/api/types/PayoutMethodListItemCompany.java new file mode 100644 index 00000000..fba80130 --- /dev/null +++ b/src/main/java/com/whop/api/types/PayoutMethodListItemCompany.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PayoutMethodListItemCompany.Builder.class) +public final class PayoutMethodListItemCompany { + private final String id; + + private final Map additionalProperties; + + private PayoutMethodListItemCompany(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PayoutMethodListItemCompany && equalTo((PayoutMethodListItemCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PayoutMethodListItemCompany other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(PayoutMethodListItemCompany other); + } + + public interface _FinalStage { + PayoutMethodListItemCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PayoutMethodListItemCompany other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public PayoutMethodListItemCompany build() { + return new PayoutMethodListItemCompany(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PayoutMethodListItemDestination.java b/src/main/java/com/whop/api/types/PayoutMethodListItemDestination.java new file mode 100644 index 00000000..7bea1240 --- /dev/null +++ b/src/main/java/com/whop/api/types/PayoutMethodListItemDestination.java @@ -0,0 +1,199 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PayoutMethodListItemDestination.Builder.class) +public final class PayoutMethodListItemDestination { + private final PayoutDestinationCategory category; + + private final String countryCode; + + private final String name; + + private final Map additionalProperties; + + private PayoutMethodListItemDestination( + PayoutDestinationCategory category, + String countryCode, + String name, + Map additionalProperties) { + this.category = category; + this.countryCode = countryCode; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The category of the payout destination + */ + @JsonProperty("category") + public PayoutDestinationCategory getCategory() { + return category; + } + + /** + * @return The country code of the payout destination + */ + @JsonProperty("country_code") + public String getCountryCode() { + return countryCode; + } + + /** + * @return The name of the payer associated with the payout destination + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PayoutMethodListItemDestination && equalTo((PayoutMethodListItemDestination) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PayoutMethodListItemDestination other) { + return category.equals(other.category) && countryCode.equals(other.countryCode) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.category, this.countryCode, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CategoryStage builder() { + return new Builder(); + } + + public interface CategoryStage { + /** + *

The category of the payout destination

+ */ + CountryCodeStage category(@NotNull PayoutDestinationCategory category); + + Builder from(PayoutMethodListItemDestination other); + } + + public interface CountryCodeStage { + /** + *

The country code of the payout destination

+ */ + NameStage countryCode(@NotNull String countryCode); + } + + public interface NameStage { + /** + *

The name of the payer associated with the payout destination

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + PayoutMethodListItemDestination build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CategoryStage, CountryCodeStage, NameStage, _FinalStage { + private PayoutDestinationCategory category; + + private String countryCode; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PayoutMethodListItemDestination other) { + category(other.getCategory()); + countryCode(other.getCountryCode()); + name(other.getName()); + return this; + } + + /** + *

The category of the payout destination

+ *

The category of the payout destination

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("category") + public CountryCodeStage category(@NotNull PayoutDestinationCategory category) { + this.category = Objects.requireNonNull(category, "category must not be null"); + return this; + } + + /** + *

The country code of the payout destination

+ *

The country code of the payout destination

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("country_code") + public NameStage countryCode(@NotNull String countryCode) { + this.countryCode = Objects.requireNonNull(countryCode, "countryCode must not be null"); + return this; + } + + /** + *

The name of the payer associated with the payout destination

+ *

The name of the payer associated with the payout destination

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public PayoutMethodListItemDestination build() { + return new PayoutMethodListItemDestination(category, countryCode, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Permission.java b/src/main/java/com/whop/api/types/Permission.java new file mode 100644 index 00000000..91c20145 --- /dev/null +++ b/src/main/java/com/whop/api/types/Permission.java @@ -0,0 +1,450 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Permission.Builder.class) +public final class Permission { + private final String action; + + private final boolean allowedOnApiKey; + + private final boolean allowedOnApp; + + private final boolean allowedOnUser; + + private final Optional category; + + private final String description; + + private final List grantedToSystemRoles; + + private final String name; + + private final Map additionalProperties; + + private Permission( + String action, + boolean allowedOnApiKey, + boolean allowedOnApp, + boolean allowedOnUser, + Optional category, + String description, + List grantedToSystemRoles, + String name, + Map additionalProperties) { + this.action = action; + this.allowedOnApiKey = allowedOnApiKey; + this.allowedOnApp = allowedOnApp; + this.allowedOnUser = allowedOnUser; + this.category = category; + this.description = description; + this.grantedToSystemRoles = grantedToSystemRoles; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The permission action's identifier, for example company:basic:read. + */ + @JsonProperty("action") + public String getAction() { + return action; + } + + /** + * @return Whether an API key can be granted the permission. + */ + @JsonProperty("allowed_on_api_key") + public boolean getAllowedOnApiKey() { + return allowedOnApiKey; + } + + /** + * @return Whether an app can request and be granted the permission. + */ + @JsonProperty("allowed_on_app") + public boolean getAllowedOnApp() { + return allowedOnApp; + } + + /** + * @return Whether the permission can be granted to user tokens. + */ + @JsonProperty("allowed_on_user") + public boolean getAllowedOnUser() { + return allowedOnUser; + } + + /** + * @return The category the action is grouped under, or null when uncategorized. + */ + @JsonIgnore + public Optional getCategory() { + if (category == null) { + return Optional.empty(); + } + return category; + } + + /** + * @return What granting the action allows. + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("granted_to_system_roles") + public List getGrantedToSystemRoles() { + return grantedToSystemRoles; + } + + /** + * @return Human-readable name of the action. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("category") + private Optional _getCategory() { + return category; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Permission && equalTo((Permission) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Permission other) { + return action.equals(other.action) + && allowedOnApiKey == other.allowedOnApiKey + && allowedOnApp == other.allowedOnApp + && allowedOnUser == other.allowedOnUser + && category.equals(other.category) + && description.equals(other.description) + && grantedToSystemRoles.equals(other.grantedToSystemRoles) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.action, + this.allowedOnApiKey, + this.allowedOnApp, + this.allowedOnUser, + this.category, + this.description, + this.grantedToSystemRoles, + this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + /** + *

The permission action's identifier, for example company:basic:read.

+ */ + AllowedOnApiKeyStage action(@NotNull String action); + + Builder from(Permission other); + } + + public interface AllowedOnApiKeyStage { + /** + *

Whether an API key can be granted the permission.

+ */ + AllowedOnAppStage allowedOnApiKey(boolean allowedOnApiKey); + } + + public interface AllowedOnAppStage { + /** + *

Whether an app can request and be granted the permission.

+ */ + AllowedOnUserStage allowedOnApp(boolean allowedOnApp); + } + + public interface AllowedOnUserStage { + /** + *

Whether the permission can be granted to user tokens.

+ */ + DescriptionStage allowedOnUser(boolean allowedOnUser); + } + + public interface DescriptionStage { + /** + *

What granting the action allows.

+ */ + NameStage description(@NotNull String description); + } + + public interface NameStage { + /** + *

Human-readable name of the action.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + Permission build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The category the action is grouped under, or null when uncategorized.

+ */ + _FinalStage category(Optional category); + + _FinalStage category(String category); + + _FinalStage category(Nullable category); + + _FinalStage grantedToSystemRoles(List grantedToSystemRoles); + + _FinalStage addGrantedToSystemRoles(PermissionGrantedToSystemRolesItem grantedToSystemRoles); + + _FinalStage addAllGrantedToSystemRoles(List grantedToSystemRoles); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ActionStage, + AllowedOnApiKeyStage, + AllowedOnAppStage, + AllowedOnUserStage, + DescriptionStage, + NameStage, + _FinalStage { + private String action; + + private boolean allowedOnApiKey; + + private boolean allowedOnApp; + + private boolean allowedOnUser; + + private String description; + + private String name; + + private List grantedToSystemRoles = new ArrayList<>(); + + private Optional category = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Permission other) { + action(other.getAction()); + allowedOnApiKey(other.getAllowedOnApiKey()); + allowedOnApp(other.getAllowedOnApp()); + allowedOnUser(other.getAllowedOnUser()); + category(other.getCategory()); + description(other.getDescription()); + grantedToSystemRoles(other.getGrantedToSystemRoles()); + name(other.getName()); + return this; + } + + /** + *

The permission action's identifier, for example company:basic:read.

+ *

The permission action's identifier, for example company:basic:read.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("action") + public AllowedOnApiKeyStage action(@NotNull String action) { + this.action = Objects.requireNonNull(action, "action must not be null"); + return this; + } + + /** + *

Whether an API key can be granted the permission.

+ *

Whether an API key can be granted the permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("allowed_on_api_key") + public AllowedOnAppStage allowedOnApiKey(boolean allowedOnApiKey) { + this.allowedOnApiKey = allowedOnApiKey; + return this; + } + + /** + *

Whether an app can request and be granted the permission.

+ *

Whether an app can request and be granted the permission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("allowed_on_app") + public AllowedOnUserStage allowedOnApp(boolean allowedOnApp) { + this.allowedOnApp = allowedOnApp; + return this; + } + + /** + *

Whether the permission can be granted to user tokens.

+ *

Whether the permission can be granted to user tokens.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("allowed_on_user") + public DescriptionStage allowedOnUser(boolean allowedOnUser) { + this.allowedOnUser = allowedOnUser; + return this; + } + + /** + *

What granting the action allows.

+ *

What granting the action allows.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("description") + public NameStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + /** + *

Human-readable name of the action.

+ *

Human-readable name of the action.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllGrantedToSystemRoles(List grantedToSystemRoles) { + if (grantedToSystemRoles != null) { + this.grantedToSystemRoles.addAll(grantedToSystemRoles); + } + return this; + } + + @java.lang.Override + public _FinalStage addGrantedToSystemRoles(PermissionGrantedToSystemRolesItem grantedToSystemRoles) { + this.grantedToSystemRoles.add(grantedToSystemRoles); + return this; + } + + @java.lang.Override + @JsonSetter(value = "granted_to_system_roles", nulls = Nulls.SKIP) + public _FinalStage grantedToSystemRoles(List grantedToSystemRoles) { + this.grantedToSystemRoles.clear(); + if (grantedToSystemRoles != null) { + this.grantedToSystemRoles.addAll(grantedToSystemRoles); + } + return this; + } + + /** + *

The category the action is grouped under, or null when uncategorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage category(Nullable category) { + if (category.isNull()) { + this.category = null; + } else if (category.isEmpty()) { + this.category = Optional.empty(); + } else { + this.category = Optional.of(category.get()); + } + return this; + } + + /** + *

The category the action is grouped under, or null when uncategorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage category(String category) { + this.category = Optional.ofNullable(category); + return this; + } + + /** + *

The category the action is grouped under, or null when uncategorized.

+ */ + @java.lang.Override + @JsonSetter(value = "category", nulls = Nulls.SKIP) + public _FinalStage category(Optional category) { + this.category = category; + return this; + } + + @java.lang.Override + public Permission build() { + return new Permission( + action, + allowedOnApiKey, + allowedOnApp, + allowedOnUser, + category, + description, + grantedToSystemRoles, + name, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PermissionAction.java b/src/main/java/com/whop/api/types/PermissionAction.java new file mode 100644 index 00000000..93cd1eed --- /dev/null +++ b/src/main/java/com/whop/api/types/PermissionAction.java @@ -0,0 +1,2832 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PermissionAction { + public static final PermissionAction INVOICE_CREATE = new PermissionAction(Value.INVOICE_CREATE, "invoice:create"); + + public static final PermissionAction WEBHOOK_RECEIVE_SHIPMENTS = + new PermissionAction(Value.WEBHOOK_RECEIVE_SHIPMENTS, "webhook_receive:shipments"); + + public static final PermissionAction COMPANY_TOKEN_TRANSACTION_READ = + new PermissionAction(Value.COMPANY_TOKEN_TRANSACTION_READ, "company_token_transaction:read"); + + public static final PermissionAction MEMBER_STATS_EXPORT = + new PermissionAction(Value.MEMBER_STATS_EXPORT, "member:stats:export"); + + public static final PermissionAction LIVESTREAM_MODERATE = + new PermissionAction(Value.LIVESTREAM_MODERATE, "livestream:moderate"); + + public static final PermissionAction TRACKING_LINK_UPDATE = + new PermissionAction(Value.TRACKING_LINK_UPDATE, "tracking_link:update"); + + public static final PermissionAction AUTHORIZED_USER_DELETE = + new PermissionAction(Value.AUTHORIZED_USER_DELETE, "authorized_user:delete"); + + public static final PermissionAction COMPANY_AUTHORIZED_USER_EMAIL_READ = + new PermissionAction(Value.COMPANY_AUTHORIZED_USER_EMAIL_READ, "company:authorized_user:email:read"); + + public static final PermissionAction SOCIAL_ACCOUNT_DELETE = + new PermissionAction(Value.SOCIAL_ACCOUNT_DELETE, "social_account:delete"); + + public static final PermissionAction PARTNER_CREATE = new PermissionAction(Value.PARTNER_CREATE, "partner:create"); + + public static final PermissionAction WEBHOOK_RECEIVE_REFUNDS = + new PermissionAction(Value.WEBHOOK_RECEIVE_REFUNDS, "webhook_receive:refunds"); + + public static final PermissionAction OAUTH_TOKEN_EXCHANGE = + new PermissionAction(Value.OAUTH_TOKEN_EXCHANGE, "oauth:token_exchange"); + + public static final PermissionAction PAYMENT_RESOLUTION_CENTER_CASE_MANAGE = + new PermissionAction(Value.PAYMENT_RESOLUTION_CENTER_CASE_MANAGE, "payment:resolution_center_case:manage"); + + public static final PermissionAction IDENTITY_WRITE = new PermissionAction(Value.IDENTITY_WRITE, "identity:write"); + + public static final PermissionAction COMPANY_UPDATE = new PermissionAction(Value.COMPANY_UPDATE, "company:update"); + + public static final PermissionAction COMPANY_DELETE_CHILD = + new PermissionAction(Value.COMPANY_DELETE_CHILD, "company:delete_child"); + + public static final PermissionAction WEBHOOK_RECEIVE_VERIFICATIONS = + new PermissionAction(Value.WEBHOOK_RECEIVE_VERIFICATIONS, "webhook_receive:verifications"); + + public static final PermissionAction WEBHOOK_RECEIVE_PRODUCTS = + new PermissionAction(Value.WEBHOOK_RECEIVE_PRODUCTS, "webhook_receive:products"); + + public static final PermissionAction AD_CAMPAIGN_UPDATE = + new PermissionAction(Value.AD_CAMPAIGN_UPDATE, "ad_campaign:update"); + + public static final PermissionAction NOTIFICATION_CREATE = + new PermissionAction(Value.NOTIFICATION_CREATE, "notification:create"); + + public static final PermissionAction BOUNTY_CREATE = new PermissionAction(Value.BOUNTY_CREATE, "bounty:create"); + + public static final PermissionAction INVOICE_BASIC_READ = + new PermissionAction(Value.INVOICE_BASIC_READ, "invoice:basic:read"); + + public static final PermissionAction DEVELOPER_MANAGE_OAUTH = + new PermissionAction(Value.DEVELOPER_MANAGE_OAUTH, "developer:manage_oauth"); + + public static final PermissionAction DMS_CHANNEL_MANAGE = + new PermissionAction(Value.DMS_CHANNEL_MANAGE, "dms:channel:manage"); + + public static final PermissionAction CHECKOUT_REQUEST_CREATE = + new PermissionAction(Value.CHECKOUT_REQUEST_CREATE, "checkout_request:create"); + + public static final PermissionAction WEBHOOK_RECEIVE_ACCOUNTS = + new PermissionAction(Value.WEBHOOK_RECEIVE_ACCOUNTS, "webhook_receive:accounts"); + + public static final PermissionAction DMS_READ = new PermissionAction(Value.DMS_READ, "dms:read"); + + public static final PermissionAction PAYMENT_SETUP_INTENT_READ = + new PermissionAction(Value.PAYMENT_SETUP_INTENT_READ, "payment:setup_intent:read"); + + public static final PermissionAction COMPANY_DELETE = new PermissionAction(Value.COMPANY_DELETE, "company:delete"); + + public static final PermissionAction SOCIAL_ACCOUNT_CREATE = + new PermissionAction(Value.SOCIAL_ACCOUNT_CREATE, "social_account:create"); + + public static final PermissionAction USER_PROFILE_UPDATE = + new PermissionAction(Value.USER_PROFILE_UPDATE, "user:profile:update"); + + public static final PermissionAction PAYMENT_RESOLUTION_CENTER_CASE_READ = + new PermissionAction(Value.PAYMENT_RESOLUTION_CENTER_CASE_READ, "payment:resolution_center_case:read"); + + public static final PermissionAction WEBHOOK_RECEIVE_APP_PAYMENTS = + new PermissionAction(Value.WEBHOOK_RECEIVE_APP_PAYMENTS, "webhook_receive:app_payments"); + + public static final PermissionAction AD_CAMPAIGN_CREATE = + new PermissionAction(Value.AD_CAMPAIGN_CREATE, "ad_campaign:create"); + + public static final PermissionAction BOUNTY_UPDATE = new PermissionAction(Value.BOUNTY_UPDATE, "bounty:update"); + + public static final PermissionAction PAYMENT_SETUP_INTENT_MANAGE = + new PermissionAction(Value.PAYMENT_SETUP_INTENT_MANAGE, "payment:setup_intent:manage"); + + public static final PermissionAction COMPANY_BALANCE_READ = + new PermissionAction(Value.COMPANY_BALANCE_READ, "company:balance:read"); + + public static final PermissionAction PLAN_BASIC_READ = + new PermissionAction(Value.PLAN_BASIC_READ, "plan:basic:read"); + + public static final PermissionAction TRACKING_LINK_BASIC_READ = + new PermissionAction(Value.TRACKING_LINK_BASIC_READ, "tracking_link:basic:read"); + + public static final PermissionAction PLAN_WAITLIST_READ = + new PermissionAction(Value.PLAN_WAITLIST_READ, "plan:waitlist:read"); + + public static final PermissionAction PAYOUT_WITHDRAWAL_READ = + new PermissionAction(Value.PAYOUT_WITHDRAWAL_READ, "payout:withdrawal:read"); + + public static final PermissionAction COMPANY_BALANCE_EXPORT = + new PermissionAction(Value.COMPANY_BALANCE_EXPORT, "company:balance:export"); + + public static final PermissionAction WEBHOOK_RECEIVE_PAYMENTS = + new PermissionAction(Value.WEBHOOK_RECEIVE_PAYMENTS, "webhook_receive:payments"); + + public static final PermissionAction TRACKING_LINK_DELETE = + new PermissionAction(Value.TRACKING_LINK_DELETE, "tracking_link:delete"); + + public static final PermissionAction WEBHOOK_RECEIVE_INVOICES = + new PermissionAction(Value.WEBHOOK_RECEIVE_INVOICES, "webhook_receive:invoices"); + + public static final PermissionAction CHAT_READ = new PermissionAction(Value.CHAT_READ, "chat:read"); + + public static final PermissionAction EXPERIENCE_DELETE = + new PermissionAction(Value.EXPERIENCE_DELETE, "experience:delete"); + + public static final PermissionAction PAYMENT_RESOLUTION_CENTER_CASE_EXPORT = + new PermissionAction(Value.PAYMENT_RESOLUTION_CENTER_CASE_EXPORT, "payment:resolution_center_case:export"); + + public static final PermissionAction WEBHOOK_RECEIVE_AD_CAMPAIGNS = + new PermissionAction(Value.WEBHOOK_RECEIVE_AD_CAMPAIGNS, "webhook_receive:ad_campaigns"); + + public static final PermissionAction CHECKOUT_CONFIGURATION_CREATE = + new PermissionAction(Value.CHECKOUT_CONFIGURATION_CREATE, "checkout_configuration:create"); + + public static final PermissionAction DEVELOPER_MANAGE_API_KEY = + new PermissionAction(Value.DEVELOPER_MANAGE_API_KEY, "developer:manage_api_key"); + + public static final PermissionAction AI_CHAT_DELETE = new PermissionAction(Value.AI_CHAT_DELETE, "ai_chat:delete"); + + public static final PermissionAction WEBHOOK_RECEIVE_DISPUTES = + new PermissionAction(Value.WEBHOOK_RECEIVE_DISPUTES, "webhook_receive:disputes"); + + public static final PermissionAction IAP_READ = new PermissionAction(Value.IAP_READ, "iap:read"); + + public static final PermissionAction CRYPTO_WALLET_MANAGE = + new PermissionAction(Value.CRYPTO_WALLET_MANAGE, "crypto_wallet:manage"); + + public static final PermissionAction SUPPORT_CHAT_CREATE = + new PermissionAction(Value.SUPPORT_CHAT_CREATE, "support_chat:create"); + + public static final PermissionAction DMS_MESSAGE_MANAGE = + new PermissionAction(Value.DMS_MESSAGE_MANAGE, "dms:message:manage"); + + public static final PermissionAction AUTHORIZED_USER_UPDATE = + new PermissionAction(Value.AUTHORIZED_USER_UPDATE, "authorized_user:update"); + + public static final PermissionAction APP_AUTHORIZATION_DELETE = + new PermissionAction(Value.APP_AUTHORIZATION_DELETE, "app_authorization:delete"); + + public static final PermissionAction MEDIA_READ = new PermissionAction(Value.MEDIA_READ, "media:read"); + + public static final PermissionAction MEMBER_PAYMENT_METHODS_READ = + new PermissionAction(Value.MEMBER_PAYMENT_METHODS_READ, "member:payment_methods:read"); + + public static final PermissionAction REFERRAL_BASIC_READ = + new PermissionAction(Value.REFERRAL_BASIC_READ, "referral:basic:read"); + + public static final PermissionAction AUDIENCE_UPDATE = + new PermissionAction(Value.AUDIENCE_UPDATE, "audience:update"); + + public static final PermissionAction PLAN_WAITLIST_EXPORT = + new PermissionAction(Value.PLAN_WAITLIST_EXPORT, "plan:waitlist:export"); + + public static final PermissionAction AI_PROMPT_CREATE = + new PermissionAction(Value.AI_PROMPT_CREATE, "ai_prompt:create"); + + public static final PermissionAction PROMO_CODE_BASIC_EXPORT = + new PermissionAction(Value.PROMO_CODE_BASIC_EXPORT, "promo_code:basic:export"); + + public static final PermissionAction COMPANY_LOG_READ = + new PermissionAction(Value.COMPANY_LOG_READ, "company:log:read"); + + public static final PermissionAction CONTENT_REWARDS_MODERATE_SUBMISSION = + new PermissionAction(Value.CONTENT_REWARDS_MODERATE_SUBMISSION, "content_rewards:moderate_submission"); + + public static final PermissionAction PAYOUT_TRANSFER_READ = + new PermissionAction(Value.PAYOUT_TRANSFER_READ, "payout:transfer:read"); + + public static final PermissionAction AUTHORIZED_ROLE_DETACH = + new PermissionAction(Value.AUTHORIZED_ROLE_DETACH, "authorized_role:detach"); + + public static final PermissionAction WEBHOOK_RECEIVE_SWAPS = + new PermissionAction(Value.WEBHOOK_RECEIVE_SWAPS, "webhook_receive:swaps"); + + public static final PermissionAction PARTNER_BASIC_READ = + new PermissionAction(Value.PARTNER_BASIC_READ, "partner:basic:read"); + + public static final PermissionAction MEMBER_PHONE_READ = + new PermissionAction(Value.MEMBER_PHONE_READ, "member:phone:read"); + + public static final PermissionAction FORUM_POST_CREATE = + new PermissionAction(Value.FORUM_POST_CREATE, "forum:post:create"); + + public static final PermissionAction INCORPORATION_WRITE = + new PermissionAction(Value.INCORPORATION_WRITE, "incorporation:write"); + + public static final PermissionAction MEMBER_MANAGE = new PermissionAction(Value.MEMBER_MANAGE, "member:manage"); + + public static final PermissionAction MEMBER_BASIC_READ = + new PermissionAction(Value.MEMBER_BASIC_READ, "member:basic:read"); + + public static final PermissionAction MEMBER_JOURNEY_READ = + new PermissionAction(Value.MEMBER_JOURNEY_READ, "member:journey:read"); + + public static final PermissionAction WEBHOOK_RECEIVE_WITHDRAWALS = + new PermissionAction(Value.WEBHOOK_RECEIVE_WITHDRAWALS, "webhook_receive:withdrawals"); + + public static final PermissionAction WEBHOOK_RECEIVE_MEMBERSHIPS = + new PermissionAction(Value.WEBHOOK_RECEIVE_MEMBERSHIPS, "webhook_receive:memberships"); + + public static final PermissionAction EXPERIENCE_HIDDEN_EXPERIENCE_READ = + new PermissionAction(Value.EXPERIENCE_HIDDEN_EXPERIENCE_READ, "experience:hidden_experience:read"); + + public static final PermissionAction PROMO_CODE_CREATE = + new PermissionAction(Value.PROMO_CODE_CREATE, "promo_code:create"); + + public static final PermissionAction COMPANY_AUTHORIZED_USER_READ = + new PermissionAction(Value.COMPANY_AUTHORIZED_USER_READ, "company:authorized_user:read"); + + public static final PermissionAction ACCESS_PASS_STATS_READ = + new PermissionAction(Value.ACCESS_PASS_STATS_READ, "access_pass:stats:read"); + + public static final PermissionAction LIVESTREAM_CREATE = + new PermissionAction(Value.LIVESTREAM_CREATE, "livestream:create"); + + public static final PermissionAction ACCESS_PASS_BASIC_EXPORT = + new PermissionAction(Value.ACCESS_PASS_BASIC_EXPORT, "access_pass:basic:export"); + + public static final PermissionAction MEMBER_PAYMENT_METHODS_MANAGE = + new PermissionAction(Value.MEMBER_PAYMENT_METHODS_MANAGE, "member:payment_methods:manage"); + + public static final PermissionAction PAYOUT_DELETE_DESTINATION = + new PermissionAction(Value.PAYOUT_DELETE_DESTINATION, "payout:delete_destination"); + + public static final PermissionAction PLAN_CREATE = new PermissionAction(Value.PLAN_CREATE, "plan:create"); + + public static final PermissionAction WEBHOOK_RECEIVE_CARD_TRANSACTIONS = + new PermissionAction(Value.WEBHOOK_RECEIVE_CARD_TRANSACTIONS, "webhook_receive:card_transactions"); + + public static final PermissionAction COURSES_READ = new PermissionAction(Value.COURSES_READ, "courses:read"); + + public static final PermissionAction INVOICE_BASIC_EXPORT = + new PermissionAction(Value.INVOICE_BASIC_EXPORT, "invoice:basic:export"); + + public static final PermissionAction MEMBER_EMAIL_READ = + new PermissionAction(Value.MEMBER_EMAIL_READ, "member:email:read"); + + public static final PermissionAction LEAD_BASIC_READ = + new PermissionAction(Value.LEAD_BASIC_READ, "lead:basic:read"); + + public static final PermissionAction PAYOUT_WITHDRAWAL_EXPORT = + new PermissionAction(Value.PAYOUT_WITHDRAWAL_EXPORT, "payout:withdrawal:export"); + + public static final PermissionAction PLAN_DELETE = new PermissionAction(Value.PLAN_DELETE, "plan:delete"); + + public static final PermissionAction PAYOUT_ACCOUNT_READ = + new PermissionAction(Value.PAYOUT_ACCOUNT_READ, "payout:account:read"); + + public static final PermissionAction PROFILE = new PermissionAction(Value.PROFILE, "profile"); + + public static final PermissionAction DEVELOPER_BASIC_READ = + new PermissionAction(Value.DEVELOPER_BASIC_READ, "developer:basic:read"); + + public static final PermissionAction ACCESS_PASS_CREATE = + new PermissionAction(Value.ACCESS_PASS_CREATE, "access_pass:create"); + + public static final PermissionAction WEBHOOK_RECEIVE_COURSES = + new PermissionAction(Value.WEBHOOK_RECEIVE_COURSES, "webhook_receive:courses"); + + public static final PermissionAction SHIPMENT_CREATE = + new PermissionAction(Value.SHIPMENT_CREATE, "shipment:create"); + + public static final PermissionAction TRACKING_LINK_STATS_EXPORT = + new PermissionAction(Value.TRACKING_LINK_STATS_EXPORT, "tracking_link:stats:export"); + + public static final PermissionAction COURSES_UPDATE = new PermissionAction(Value.COURSES_UPDATE, "courses:update"); + + public static final PermissionAction PLAN_BASIC_EXPORT = + new PermissionAction(Value.PLAN_BASIC_EXPORT, "plan:basic:export"); + + public static final PermissionAction AI_CHAT_CREATE = new PermissionAction(Value.AI_CHAT_CREATE, "ai_chat:create"); + + public static final PermissionAction WEBHOOK_RECEIVE_MEMBERS = + new PermissionAction(Value.WEBHOOK_RECEIVE_MEMBERS, "webhook_receive:members"); + + public static final PermissionAction WEBHOOK_RECEIVE_PAYOUT_ACCOUNTS = + new PermissionAction(Value.WEBHOOK_RECEIVE_PAYOUT_ACCOUNTS, "webhook_receive:payout_accounts"); + + public static final PermissionAction COMPANY_TRANSFER_OWNERSHIP = + new PermissionAction(Value.COMPANY_TRANSFER_OWNERSHIP, "company:transfer_ownership"); + + public static final PermissionAction CHAT_MANAGE_WEBHOOK = + new PermissionAction(Value.CHAT_MANAGE_WEBHOOK, "chat:manage_webhook"); + + public static final PermissionAction DEVELOPER_CREATE_APP = + new PermissionAction(Value.DEVELOPER_CREATE_APP, "developer:create_app"); + + public static final PermissionAction SUPPORT_CHAT_READ = + new PermissionAction(Value.SUPPORT_CHAT_READ, "support_chat:read"); + + public static final PermissionAction LEAD_MANAGE = new PermissionAction(Value.LEAD_MANAGE, "lead:manage"); + + public static final PermissionAction INVOICE_UPDATE = new PermissionAction(Value.INVOICE_UPDATE, "invoice:update"); + + public static final PermissionAction CONTENT_REWARDS_BASIC_EXPORT = + new PermissionAction(Value.CONTENT_REWARDS_BASIC_EXPORT, "content_rewards:basic:export"); + + public static final PermissionAction PLAN_UPDATE = new PermissionAction(Value.PLAN_UPDATE, "plan:update"); + + public static final PermissionAction MEMBER_BASIC_EXPORT = + new PermissionAction(Value.MEMBER_BASIC_EXPORT, "member:basic:export"); + + public static final PermissionAction COMPANY_CREATE_CHILD = + new PermissionAction(Value.COMPANY_CREATE_CHILD, "company:create_child"); + + public static final PermissionAction APP_AUTHORIZATION_CREATE = + new PermissionAction(Value.APP_AUTHORIZATION_CREATE, "app_authorization:create"); + + public static final PermissionAction WEBHOOK_RECEIVE_ENTRIES = + new PermissionAction(Value.WEBHOOK_RECEIVE_ENTRIES, "webhook_receive:entries"); + + public static final PermissionAction WEBHOOK_RECEIVE_CARDS = + new PermissionAction(Value.WEBHOOK_RECEIVE_CARDS, "webhook_receive:cards"); + + public static final PermissionAction CHECKOUT_CONFIGURATION_DELETE = + new PermissionAction(Value.CHECKOUT_CONFIGURATION_DELETE, "checkout_configuration:delete"); + + public static final PermissionAction USER_NOTIFICATIONS_UPDATE = + new PermissionAction(Value.USER_NOTIFICATIONS_UPDATE, "user:notifications:update"); + + public static final PermissionAction USER_NOTIFICATIONS_READ = + new PermissionAction(Value.USER_NOTIFICATIONS_READ, "user:notifications:read"); + + public static final PermissionAction PAYMENT_DISPUTE_ALERT_READ = + new PermissionAction(Value.PAYMENT_DISPUTE_ALERT_READ, "payment:dispute_alert:read"); + + public static final PermissionAction PAYMENT_RESOLUTION_CENTER = + new PermissionAction(Value.PAYMENT_RESOLUTION_CENTER, "payment:resolution_center"); + + public static final PermissionAction LIVESTREAM_CHAT_WRITE = + new PermissionAction(Value.LIVESTREAM_CHAT_WRITE, "livestream:chat:write"); + + public static final PermissionAction USER_BALANCE_READ = + new PermissionAction(Value.USER_BALANCE_READ, "user:balance:read"); + + public static final PermissionAction SUPPORT_CHAT_MESSAGE_CREATE = + new PermissionAction(Value.SUPPORT_CHAT_MESSAGE_CREATE, "support_chat:message:create"); + + public static final PermissionAction SOCIAL_LINK_UPDATE = + new PermissionAction(Value.SOCIAL_LINK_UPDATE, "social_link:update"); + + public static final PermissionAction DEVELOPER_UPDATE_APP = + new PermissionAction(Value.DEVELOPER_UPDATE_APP, "developer:update_app"); + + public static final PermissionAction AUDIENCE_BASIC_READ = + new PermissionAction(Value.AUDIENCE_BASIC_READ, "audience:basic:read"); + + public static final PermissionAction PAYOUT_CREATE_DESTINATION = + new PermissionAction(Value.PAYOUT_CREATE_DESTINATION, "payout:create_destination"); + + public static final PermissionAction AIRDROP_LINK_BASIC_READ = + new PermissionAction(Value.AIRDROP_LINK_BASIC_READ, "airdrop_link:basic:read"); + + public static final PermissionAction CHECKOUT_CONFIGURATION_BASIC_READ = + new PermissionAction(Value.CHECKOUT_CONFIGURATION_BASIC_READ, "checkout_configuration:basic:read"); + + public static final PermissionAction AD_CAMPAIGN_CONVERSION_CREATE = + new PermissionAction(Value.AD_CAMPAIGN_CONVERSION_CREATE, "ad_campaign:conversion:create"); + + public static final PermissionAction AD_PUBLISHER_READ = + new PermissionAction(Value.AD_PUBLISHER_READ, "ad_publisher:read"); + + public static final PermissionAction CHAT_MODERATE = new PermissionAction(Value.CHAT_MODERATE, "chat:moderate"); + + public static final PermissionAction DEVELOPER_LOGS_READ = + new PermissionAction(Value.DEVELOPER_LOGS_READ, "developer:logs:read"); + + public static final PermissionAction WEBHOOK_RECEIVE_TRANSFERS = + new PermissionAction(Value.WEBHOOK_RECEIVE_TRANSFERS, "webhook_receive:transfers"); + + public static final PermissionAction COMPANY_MANAGE_LEGAL = + new PermissionAction(Value.COMPANY_MANAGE_LEGAL, "company:manage_legal"); + + public static final PermissionAction PAYOUT_TRANSFER_FUNDS = + new PermissionAction(Value.PAYOUT_TRANSFER_FUNDS, "payout:transfer_funds"); + + public static final PermissionAction WEBHOOK_RECEIVE_APP_MEMBERSHIPS = + new PermissionAction(Value.WEBHOOK_RECEIVE_APP_MEMBERSHIPS, "webhook_receive:app_memberships"); + + public static final PermissionAction CONTENT_REWARDS_BASIC_READ = + new PermissionAction(Value.CONTENT_REWARDS_BASIC_READ, "content_rewards:basic:read"); + + public static final PermissionAction PAYMENT_CHARGE = new PermissionAction(Value.PAYMENT_CHARGE, "payment:charge"); + + public static final PermissionAction DEVELOPER_MANAGE_BUILDS = + new PermissionAction(Value.DEVELOPER_MANAGE_BUILDS, "developer:manage_builds"); + + public static final PermissionAction CRYPTO_WALLET_SWAP = + new PermissionAction(Value.CRYPTO_WALLET_SWAP, "crypto_wallet:swap"); + + public static final PermissionAction EMAIL = new PermissionAction(Value.EMAIL, "email"); + + public static final PermissionAction PROMO_CODE_DELETE = + new PermissionAction(Value.PROMO_CODE_DELETE, "promo_code:delete"); + + public static final PermissionAction PAYOUT_ACCOUNT_UPDATE = + new PermissionAction(Value.PAYOUT_ACCOUNT_UPDATE, "payout:account:update"); + + public static final PermissionAction PAYOUT_TRANSFER_EXPORT = + new PermissionAction(Value.PAYOUT_TRANSFER_EXPORT, "payout:transfer:export"); + + public static final PermissionAction USER_EMAIL_READ = + new PermissionAction(Value.USER_EMAIL_READ, "user:email:read"); + + public static final PermissionAction COMPANY_BASIC_READ = + new PermissionAction(Value.COMPANY_BASIC_READ, "company:basic:read"); + + public static final PermissionAction LEAD_BASIC_EXPORT = + new PermissionAction(Value.LEAD_BASIC_EXPORT, "lead:basic:export"); + + public static final PermissionAction STATS_READ = new PermissionAction(Value.STATS_READ, "stats:read"); + + public static final PermissionAction AI_CHAT_UPDATE = new PermissionAction(Value.AI_CHAT_UPDATE, "ai_chat:update"); + + public static final PermissionAction INCORPORATION_READ = + new PermissionAction(Value.INCORPORATION_READ, "incorporation:read"); + + public static final PermissionAction AI_CHAT_READ = new PermissionAction(Value.AI_CHAT_READ, "ai_chat:read"); + + public static final PermissionAction APP_AUTHORIZATION_UPDATE = + new PermissionAction(Value.APP_AUTHORIZATION_UPDATE, "app_authorization:update"); + + public static final PermissionAction REFERRAL_PARTNER_CREATE = + new PermissionAction(Value.REFERRAL_PARTNER_CREATE, "referral:partner:create"); + + public static final PermissionAction TRACKING_LINK_BASIC_EXPORT = + new PermissionAction(Value.TRACKING_LINK_BASIC_EXPORT, "tracking_link:basic:export"); + + public static final PermissionAction ACCESS_PASS_CONTROL_CENTER = + new PermissionAction(Value.ACCESS_PASS_CONTROL_CENTER, "access_pass:control_center"); + + public static final PermissionAction FORUM_MODERATE = new PermissionAction(Value.FORUM_MODERATE, "forum:moderate"); + + public static final PermissionAction APP_AUTHORIZATION_READ = + new PermissionAction(Value.APP_AUTHORIZATION_READ, "app_authorization:read"); + + public static final PermissionAction PAYOUT_UPDATE_DESTINATION = + new PermissionAction(Value.PAYOUT_UPDATE_DESTINATION, "payout:update_destination"); + + public static final PermissionAction DEVELOPER_MANAGE_WEBHOOK = + new PermissionAction(Value.DEVELOPER_MANAGE_WEBHOOK, "developer:manage_webhook"); + + public static final PermissionAction BOUNTY_BASIC_READ = + new PermissionAction(Value.BOUNTY_BASIC_READ, "bounty:basic:read"); + + public static final PermissionAction WEBHOOK_RECEIVE_LEDGER_ACCOUNTS = + new PermissionAction(Value.WEBHOOK_RECEIVE_LEDGER_ACCOUNTS, "webhook_receive:ledger_accounts"); + + public static final PermissionAction ACCESS_PASS_UPDATE = + new PermissionAction(Value.ACCESS_PASS_UPDATE, "access_pass:update"); + + public static final PermissionAction MEMBERSHIP_UPDATE = + new PermissionAction(Value.MEMBERSHIP_UPDATE, "membership:update"); + + public static final PermissionAction LIVESTREAM_MANAGE_RECORDING = + new PermissionAction(Value.LIVESTREAM_MANAGE_RECORDING, "livestream:manage_recording"); + + public static final PermissionAction WEBHOOK_RECEIVE_PAYOUT_METHODS = + new PermissionAction(Value.WEBHOOK_RECEIVE_PAYOUT_METHODS, "webhook_receive:payout_methods"); + + public static final PermissionAction USER_STAFF_READ = + new PermissionAction(Value.USER_STAFF_READ, "user:staff:read"); + + public static final PermissionAction AD_CAMPAIGN_CREDIT_CREATE = + new PermissionAction(Value.AD_CAMPAIGN_CREDIT_CREATE, "ad_campaign:credit:create"); + + public static final PermissionAction WEBHOOK_RECEIVE_EXPORTS = + new PermissionAction(Value.WEBHOOK_RECEIVE_EXPORTS, "webhook_receive:exports"); + + public static final PermissionAction EXPERIENCE_UPDATE = + new PermissionAction(Value.EXPERIENCE_UPDATE, "experience:update"); + + public static final PermissionAction AFFILIATE_BASIC_READ = + new PermissionAction(Value.AFFILIATE_BASIC_READ, "affiliate:basic:read"); + + public static final PermissionAction WEBHOOK_RECEIVE_SETUP_INTENTS = + new PermissionAction(Value.WEBHOOK_RECEIVE_SETUP_INTENTS, "webhook_receive:setup_intents"); + + public static final PermissionAction PAYMENT_DISPUTE_EXPORT = + new PermissionAction(Value.PAYMENT_DISPUTE_EXPORT, "payment:dispute:export"); + + public static final PermissionAction EVENT_CREATE = new PermissionAction(Value.EVENT_CREATE, "event:create"); + + public static final PermissionAction PAYMENT_BASIC_READ = + new PermissionAction(Value.PAYMENT_BASIC_READ, "payment:basic:read"); + + public static final PermissionAction MEMBER_PAYMENT_METHODS_USE = + new PermissionAction(Value.MEMBER_PAYMENT_METHODS_USE, "member:payment_methods:use"); + + public static final PermissionAction ACCESS_PASS_DELETE = + new PermissionAction(Value.ACCESS_PASS_DELETE, "access_pass:delete"); + + public static final PermissionAction PAYMENT_BASIC_EXPORT = + new PermissionAction(Value.PAYMENT_BASIC_EXPORT, "payment:basic:export"); + + public static final PermissionAction AD_CAMPAIGN_DELETE = + new PermissionAction(Value.AD_CAMPAIGN_DELETE, "ad_campaign:delete"); + + public static final PermissionAction AFFILIATE_CREATE = + new PermissionAction(Value.AFFILIATE_CREATE, "affiliate:create"); + + public static final PermissionAction BOUNTY_CAPTURE_CLIP_DISCARD = + new PermissionAction(Value.BOUNTY_CAPTURE_CLIP_DISCARD, "bounty:capture_clip:discard"); + + public static final PermissionAction LIVESTREAM_CHAT_READ = + new PermissionAction(Value.LIVESTREAM_CHAT_READ, "livestream:chat:read"); + + public static final PermissionAction AD_CAMPAIGN_BASIC_READ = + new PermissionAction(Value.AD_CAMPAIGN_BASIC_READ, "ad_campaign:basic:read"); + + public static final PermissionAction BOUNTY_CAPTURE_CLIP_COMPLETE = + new PermissionAction(Value.BOUNTY_CAPTURE_CLIP_COMPLETE, "bounty:capture_clip:complete"); + + public static final PermissionAction BOUNTY_SUBMISSION_DELETE = + new PermissionAction(Value.BOUNTY_SUBMISSION_DELETE, "bounty:submission:delete"); + + public static final PermissionAction PROMO_CODE_UPDATE = + new PermissionAction(Value.PROMO_CODE_UPDATE, "promo_code:update"); + + public static final PermissionAction AD_CAMPAIGN_BASIC_EXPORT = + new PermissionAction(Value.AD_CAMPAIGN_BASIC_EXPORT, "ad_campaign:basic:export"); + + public static final PermissionAction PAYMENT_MANAGE = new PermissionAction(Value.PAYMENT_MANAGE, "payment:manage"); + + public static final PermissionAction AD_CAMPAIGN_STATS_READ = + new PermissionAction(Value.AD_CAMPAIGN_STATS_READ, "ad_campaign:stats:read"); + + public static final PermissionAction PAYOUT_DESTINATION_READ = + new PermissionAction(Value.PAYOUT_DESTINATION_READ, "payout:destination:read"); + + public static final PermissionAction WEBHOOK_RECEIVE_DEPOSITS = + new PermissionAction(Value.WEBHOOK_RECEIVE_DEPOSITS, "webhook_receive:deposits"); + + public static final PermissionAction EXPERIENCE_CREATE = + new PermissionAction(Value.EXPERIENCE_CREATE, "experience:create"); + + public static final PermissionAction OPENID = new PermissionAction(Value.OPENID, "openid"); + + public static final PermissionAction COMPANY_TOKEN_TRANSACTION_CREATE = + new PermissionAction(Value.COMPANY_TOKEN_TRANSACTION_CREATE, "company_token_transaction:create"); + + public static final PermissionAction AUTHORIZED_ROLE_CREATE = + new PermissionAction(Value.AUTHORIZED_ROLE_CREATE, "authorized_role:create"); + + public static final PermissionAction DEVELOPER_UPDATE_APP_AUTHORIZATION = + new PermissionAction(Value.DEVELOPER_UPDATE_APP_AUTHORIZATION, "developer:update_app_authorization"); + + public static final PermissionAction WEBHOOK_RECEIVE_CARD_APPLICATIONS = + new PermissionAction(Value.WEBHOOK_RECEIVE_CARD_APPLICATIONS, "webhook_receive:card_applications"); + + public static final PermissionAction MEDIA_GENERATE = new PermissionAction(Value.MEDIA_GENERATE, "media:generate"); + + public static final PermissionAction PAYMENT_DISPUTE = + new PermissionAction(Value.PAYMENT_DISPUTE, "payment:dispute"); + + public static final PermissionAction AUTHORIZED_ROLE_ATTACH = + new PermissionAction(Value.AUTHORIZED_ROLE_ATTACH, "authorized_role:attach"); + + public static final PermissionAction AD_CAMPAIGN_READ = + new PermissionAction(Value.AD_CAMPAIGN_READ, "ad_campaign:read"); + + public static final PermissionAction CHILD_COMPANY_BASIC_EXPORT = + new PermissionAction(Value.CHILD_COMPANY_BASIC_EXPORT, "child_company:basic:export"); + + public static final PermissionAction LIVESTREAM_DELETE = + new PermissionAction(Value.LIVESTREAM_DELETE, "livestream:delete"); + + public static final PermissionAction EXPERIENCE_DETACH = + new PermissionAction(Value.EXPERIENCE_DETACH, "experience:detach"); + + public static final PermissionAction TRACKING_LINK_STATS_READ = + new PermissionAction(Value.TRACKING_LINK_STATS_READ, "tracking_link:stats:read"); + + public static final PermissionAction WEBHOOK_RECEIVE_CHAT = + new PermissionAction(Value.WEBHOOK_RECEIVE_CHAT, "webhook_receive:chat"); + + public static final PermissionAction CONTENT_REWARDS_DELETE = + new PermissionAction(Value.CONTENT_REWARDS_DELETE, "content_rewards:delete"); + + public static final PermissionAction MEMBERSHIP_CANCEL = + new PermissionAction(Value.MEMBERSHIP_CANCEL, "membership:cancel"); + + public static final PermissionAction MEMBERSHIP_CREATE = + new PermissionAction(Value.MEMBERSHIP_CREATE, "membership:create"); + + public static final PermissionAction ACCESS_PASS_BASIC_READ = + new PermissionAction(Value.ACCESS_PASS_BASIC_READ, "access_pass:basic:read"); + + public static final PermissionAction PARTNER_INVITE_CREATE = + new PermissionAction(Value.PARTNER_INVITE_CREATE, "partner:invite:create"); + + public static final PermissionAction BOUNTY_CAPTURE_CLIP_CREATE = + new PermissionAction(Value.BOUNTY_CAPTURE_CLIP_CREATE, "bounty:capture_clip:create"); + + public static final PermissionAction PAYOUT_WITHDRAW_FUNDS = + new PermissionAction(Value.PAYOUT_WITHDRAW_FUNDS, "payout:withdraw_funds"); + + public static final PermissionAction SOCIAL_ACCOUNT_READ = + new PermissionAction(Value.SOCIAL_ACCOUNT_READ, "social_account:read"); + + public static final PermissionAction EXPERIENCE_ATTACH = + new PermissionAction(Value.EXPERIENCE_ATTACH, "experience:attach"); + + public static final PermissionAction CONTENT_REWARDS_CREATE = + new PermissionAction(Value.CONTENT_REWARDS_CREATE, "content_rewards:create"); + + public static final PermissionAction MEMBERSHIP_RESYNC_ACCESS = + new PermissionAction(Value.MEMBERSHIP_RESYNC_ACCESS, "membership:resync_access"); + + public static final PermissionAction PLAN_WAITLIST_MANAGE = + new PermissionAction(Value.PLAN_WAITLIST_MANAGE, "plan:waitlist:manage"); + + public static final PermissionAction AUTHORIZED_USER_CREATE = + new PermissionAction(Value.AUTHORIZED_USER_CREATE, "authorized_user:create"); + + public static final PermissionAction AUTHORIZED_ROLE_UPDATE = + new PermissionAction(Value.AUTHORIZED_ROLE_UPDATE, "authorized_role:update"); + + public static final PermissionAction CHECKOUT_REQUEST_BASIC_READ = + new PermissionAction(Value.CHECKOUT_REQUEST_BASIC_READ, "checkout_request:basic:read"); + + public static final PermissionAction AUTHORIZED_ROLE_DELETE = + new PermissionAction(Value.AUTHORIZED_ROLE_DELETE, "authorized_role:delete"); + + public static final PermissionAction CUSTOM_EMOJI_UPDATE = + new PermissionAction(Value.CUSTOM_EMOJI_UPDATE, "custom_emoji:update"); + + public static final PermissionAction AIRDROP_LINK_MANAGE = + new PermissionAction(Value.AIRDROP_LINK_MANAGE, "airdrop_link:manage"); + + public static final PermissionAction CONTENT_REWARDS_UPDATE = + new PermissionAction(Value.CONTENT_REWARDS_UPDATE, "content_rewards:update"); + + public static final PermissionAction PAYMENT_DISPUTE_READ = + new PermissionAction(Value.PAYMENT_DISPUTE_READ, "payment:dispute:read"); + + public static final PermissionAction ACCESS_PASS_STATS_EXPORT = + new PermissionAction(Value.ACCESS_PASS_STATS_EXPORT, "access_pass:stats:export"); + + public static final PermissionAction MEMBER_MODERATE = + new PermissionAction(Value.MEMBER_MODERATE, "member:moderate"); + + public static final PermissionAction PLAN_STATS_EXPORT = + new PermissionAction(Value.PLAN_STATS_EXPORT, "plan:stats:export"); + + public static final PermissionAction FORUM_READ = new PermissionAction(Value.FORUM_READ, "forum:read"); + + public static final PermissionAction MEMBERSHIP_TRANSFER = + new PermissionAction(Value.MEMBERSHIP_TRANSFER, "membership:transfer"); + + public static final PermissionAction AFFILIATE_UPDATE = + new PermissionAction(Value.AFFILIATE_UPDATE, "affiliate:update"); + + public static final PermissionAction TRACKING_LINK_CREATE = + new PermissionAction(Value.TRACKING_LINK_CREATE, "tracking_link:create"); + + public static final PermissionAction CHAT_MESSAGE_CREATE = + new PermissionAction(Value.CHAT_MESSAGE_CREATE, "chat:message:create"); + + public static final PermissionAction WEBHOOK_RECEIVE_PLANS = + new PermissionAction(Value.WEBHOOK_RECEIVE_PLANS, "webhook_receive:plans"); + + public static final PermissionAction PLAN_STATS_READ = + new PermissionAction(Value.PLAN_STATS_READ, "plan:stats:read"); + + public static final PermissionAction COURSE_ANALYTICS_READ = + new PermissionAction(Value.COURSE_ANALYTICS_READ, "course_analytics:read"); + + public static final PermissionAction WEBHOOK_RECEIVE_RESOLUTIONS = + new PermissionAction(Value.WEBHOOK_RECEIVE_RESOLUTIONS, "webhook_receive:resolutions"); + + public static final PermissionAction COURSE_LESSON_INTERACTION_READ = + new PermissionAction(Value.COURSE_LESSON_INTERACTION_READ, "course_lesson_interaction:read"); + + public static final PermissionAction MEMBER_STATS_READ = + new PermissionAction(Value.MEMBER_STATS_READ, "member:stats:read"); + + public static final PermissionAction BOUNTY_SUBMISSION_VOTE = + new PermissionAction(Value.BOUNTY_SUBMISSION_VOTE, "bounty:submission:vote"); + + public static final PermissionAction PROMO_CODE_BASIC_READ = + new PermissionAction(Value.PROMO_CODE_BASIC_READ, "promo_code:basic:read"); + + public static final PermissionAction BOUNTY_SUBMISSION_CREATE = + new PermissionAction(Value.BOUNTY_SUBMISSION_CREATE, "bounty:submission:create"); + + public static final PermissionAction COMPANY_MANAGE_CHECKOUT = + new PermissionAction(Value.COMPANY_MANAGE_CHECKOUT, "company:manage_checkout"); + + public static final PermissionAction IDENTITY_READ = new PermissionAction(Value.IDENTITY_READ, "identity:read"); + + public static final PermissionAction COMPANY_CREATE = new PermissionAction(Value.COMPANY_CREATE, "company:create"); + + public static final PermissionAction SHIPMENT_BASIC_READ = + new PermissionAction(Value.SHIPMENT_BASIC_READ, "shipment:basic:read"); + + public static final PermissionAction WEBHOOK_RECEIVE_IDENTITY_PROFILES = + new PermissionAction(Value.WEBHOOK_RECEIVE_IDENTITY_PROFILES, "webhook_receive:identity_profiles"); + + public static final PermissionAction COMPANY_UPDATE_CHILD_FEES = + new PermissionAction(Value.COMPANY_UPDATE_CHILD_FEES, "company:update_child_fees"); + + private final Value value; + + private final String string; + + PermissionAction(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PermissionAction && this.string.equals(((PermissionAction) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INVOICE_CREATE: + return visitor.visitInvoiceCreate(); + case WEBHOOK_RECEIVE_SHIPMENTS: + return visitor.visitWebhookReceiveShipments(); + case COMPANY_TOKEN_TRANSACTION_READ: + return visitor.visitCompanyTokenTransactionRead(); + case MEMBER_STATS_EXPORT: + return visitor.visitMemberStatsExport(); + case LIVESTREAM_MODERATE: + return visitor.visitLivestreamModerate(); + case TRACKING_LINK_UPDATE: + return visitor.visitTrackingLinkUpdate(); + case AUTHORIZED_USER_DELETE: + return visitor.visitAuthorizedUserDelete(); + case COMPANY_AUTHORIZED_USER_EMAIL_READ: + return visitor.visitCompanyAuthorizedUserEmailRead(); + case SOCIAL_ACCOUNT_DELETE: + return visitor.visitSocialAccountDelete(); + case PARTNER_CREATE: + return visitor.visitPartnerCreate(); + case WEBHOOK_RECEIVE_REFUNDS: + return visitor.visitWebhookReceiveRefunds(); + case OAUTH_TOKEN_EXCHANGE: + return visitor.visitOauthTokenExchange(); + case PAYMENT_RESOLUTION_CENTER_CASE_MANAGE: + return visitor.visitPaymentResolutionCenterCaseManage(); + case IDENTITY_WRITE: + return visitor.visitIdentityWrite(); + case COMPANY_UPDATE: + return visitor.visitCompanyUpdate(); + case COMPANY_DELETE_CHILD: + return visitor.visitCompanyDeleteChild(); + case WEBHOOK_RECEIVE_VERIFICATIONS: + return visitor.visitWebhookReceiveVerifications(); + case WEBHOOK_RECEIVE_PRODUCTS: + return visitor.visitWebhookReceiveProducts(); + case AD_CAMPAIGN_UPDATE: + return visitor.visitAdCampaignUpdate(); + case NOTIFICATION_CREATE: + return visitor.visitNotificationCreate(); + case BOUNTY_CREATE: + return visitor.visitBountyCreate(); + case INVOICE_BASIC_READ: + return visitor.visitInvoiceBasicRead(); + case DEVELOPER_MANAGE_OAUTH: + return visitor.visitDeveloperManageOauth(); + case DMS_CHANNEL_MANAGE: + return visitor.visitDmsChannelManage(); + case CHECKOUT_REQUEST_CREATE: + return visitor.visitCheckoutRequestCreate(); + case WEBHOOK_RECEIVE_ACCOUNTS: + return visitor.visitWebhookReceiveAccounts(); + case DMS_READ: + return visitor.visitDmsRead(); + case PAYMENT_SETUP_INTENT_READ: + return visitor.visitPaymentSetupIntentRead(); + case COMPANY_DELETE: + return visitor.visitCompanyDelete(); + case SOCIAL_ACCOUNT_CREATE: + return visitor.visitSocialAccountCreate(); + case USER_PROFILE_UPDATE: + return visitor.visitUserProfileUpdate(); + case PAYMENT_RESOLUTION_CENTER_CASE_READ: + return visitor.visitPaymentResolutionCenterCaseRead(); + case WEBHOOK_RECEIVE_APP_PAYMENTS: + return visitor.visitWebhookReceiveAppPayments(); + case AD_CAMPAIGN_CREATE: + return visitor.visitAdCampaignCreate(); + case BOUNTY_UPDATE: + return visitor.visitBountyUpdate(); + case PAYMENT_SETUP_INTENT_MANAGE: + return visitor.visitPaymentSetupIntentManage(); + case COMPANY_BALANCE_READ: + return visitor.visitCompanyBalanceRead(); + case PLAN_BASIC_READ: + return visitor.visitPlanBasicRead(); + case TRACKING_LINK_BASIC_READ: + return visitor.visitTrackingLinkBasicRead(); + case PLAN_WAITLIST_READ: + return visitor.visitPlanWaitlistRead(); + case PAYOUT_WITHDRAWAL_READ: + return visitor.visitPayoutWithdrawalRead(); + case COMPANY_BALANCE_EXPORT: + return visitor.visitCompanyBalanceExport(); + case WEBHOOK_RECEIVE_PAYMENTS: + return visitor.visitWebhookReceivePayments(); + case TRACKING_LINK_DELETE: + return visitor.visitTrackingLinkDelete(); + case WEBHOOK_RECEIVE_INVOICES: + return visitor.visitWebhookReceiveInvoices(); + case CHAT_READ: + return visitor.visitChatRead(); + case EXPERIENCE_DELETE: + return visitor.visitExperienceDelete(); + case PAYMENT_RESOLUTION_CENTER_CASE_EXPORT: + return visitor.visitPaymentResolutionCenterCaseExport(); + case WEBHOOK_RECEIVE_AD_CAMPAIGNS: + return visitor.visitWebhookReceiveAdCampaigns(); + case CHECKOUT_CONFIGURATION_CREATE: + return visitor.visitCheckoutConfigurationCreate(); + case DEVELOPER_MANAGE_API_KEY: + return visitor.visitDeveloperManageApiKey(); + case AI_CHAT_DELETE: + return visitor.visitAiChatDelete(); + case WEBHOOK_RECEIVE_DISPUTES: + return visitor.visitWebhookReceiveDisputes(); + case IAP_READ: + return visitor.visitIapRead(); + case CRYPTO_WALLET_MANAGE: + return visitor.visitCryptoWalletManage(); + case SUPPORT_CHAT_CREATE: + return visitor.visitSupportChatCreate(); + case DMS_MESSAGE_MANAGE: + return visitor.visitDmsMessageManage(); + case AUTHORIZED_USER_UPDATE: + return visitor.visitAuthorizedUserUpdate(); + case APP_AUTHORIZATION_DELETE: + return visitor.visitAppAuthorizationDelete(); + case MEDIA_READ: + return visitor.visitMediaRead(); + case MEMBER_PAYMENT_METHODS_READ: + return visitor.visitMemberPaymentMethodsRead(); + case REFERRAL_BASIC_READ: + return visitor.visitReferralBasicRead(); + case AUDIENCE_UPDATE: + return visitor.visitAudienceUpdate(); + case PLAN_WAITLIST_EXPORT: + return visitor.visitPlanWaitlistExport(); + case AI_PROMPT_CREATE: + return visitor.visitAiPromptCreate(); + case PROMO_CODE_BASIC_EXPORT: + return visitor.visitPromoCodeBasicExport(); + case COMPANY_LOG_READ: + return visitor.visitCompanyLogRead(); + case CONTENT_REWARDS_MODERATE_SUBMISSION: + return visitor.visitContentRewardsModerateSubmission(); + case PAYOUT_TRANSFER_READ: + return visitor.visitPayoutTransferRead(); + case AUTHORIZED_ROLE_DETACH: + return visitor.visitAuthorizedRoleDetach(); + case WEBHOOK_RECEIVE_SWAPS: + return visitor.visitWebhookReceiveSwaps(); + case PARTNER_BASIC_READ: + return visitor.visitPartnerBasicRead(); + case MEMBER_PHONE_READ: + return visitor.visitMemberPhoneRead(); + case FORUM_POST_CREATE: + return visitor.visitForumPostCreate(); + case INCORPORATION_WRITE: + return visitor.visitIncorporationWrite(); + case MEMBER_MANAGE: + return visitor.visitMemberManage(); + case MEMBER_BASIC_READ: + return visitor.visitMemberBasicRead(); + case MEMBER_JOURNEY_READ: + return visitor.visitMemberJourneyRead(); + case WEBHOOK_RECEIVE_WITHDRAWALS: + return visitor.visitWebhookReceiveWithdrawals(); + case WEBHOOK_RECEIVE_MEMBERSHIPS: + return visitor.visitWebhookReceiveMemberships(); + case EXPERIENCE_HIDDEN_EXPERIENCE_READ: + return visitor.visitExperienceHiddenExperienceRead(); + case PROMO_CODE_CREATE: + return visitor.visitPromoCodeCreate(); + case COMPANY_AUTHORIZED_USER_READ: + return visitor.visitCompanyAuthorizedUserRead(); + case ACCESS_PASS_STATS_READ: + return visitor.visitAccessPassStatsRead(); + case LIVESTREAM_CREATE: + return visitor.visitLivestreamCreate(); + case ACCESS_PASS_BASIC_EXPORT: + return visitor.visitAccessPassBasicExport(); + case MEMBER_PAYMENT_METHODS_MANAGE: + return visitor.visitMemberPaymentMethodsManage(); + case PAYOUT_DELETE_DESTINATION: + return visitor.visitPayoutDeleteDestination(); + case PLAN_CREATE: + return visitor.visitPlanCreate(); + case WEBHOOK_RECEIVE_CARD_TRANSACTIONS: + return visitor.visitWebhookReceiveCardTransactions(); + case COURSES_READ: + return visitor.visitCoursesRead(); + case INVOICE_BASIC_EXPORT: + return visitor.visitInvoiceBasicExport(); + case MEMBER_EMAIL_READ: + return visitor.visitMemberEmailRead(); + case LEAD_BASIC_READ: + return visitor.visitLeadBasicRead(); + case PAYOUT_WITHDRAWAL_EXPORT: + return visitor.visitPayoutWithdrawalExport(); + case PLAN_DELETE: + return visitor.visitPlanDelete(); + case PAYOUT_ACCOUNT_READ: + return visitor.visitPayoutAccountRead(); + case PROFILE: + return visitor.visitProfile(); + case DEVELOPER_BASIC_READ: + return visitor.visitDeveloperBasicRead(); + case ACCESS_PASS_CREATE: + return visitor.visitAccessPassCreate(); + case WEBHOOK_RECEIVE_COURSES: + return visitor.visitWebhookReceiveCourses(); + case SHIPMENT_CREATE: + return visitor.visitShipmentCreate(); + case TRACKING_LINK_STATS_EXPORT: + return visitor.visitTrackingLinkStatsExport(); + case COURSES_UPDATE: + return visitor.visitCoursesUpdate(); + case PLAN_BASIC_EXPORT: + return visitor.visitPlanBasicExport(); + case AI_CHAT_CREATE: + return visitor.visitAiChatCreate(); + case WEBHOOK_RECEIVE_MEMBERS: + return visitor.visitWebhookReceiveMembers(); + case WEBHOOK_RECEIVE_PAYOUT_ACCOUNTS: + return visitor.visitWebhookReceivePayoutAccounts(); + case COMPANY_TRANSFER_OWNERSHIP: + return visitor.visitCompanyTransferOwnership(); + case CHAT_MANAGE_WEBHOOK: + return visitor.visitChatManageWebhook(); + case DEVELOPER_CREATE_APP: + return visitor.visitDeveloperCreateApp(); + case SUPPORT_CHAT_READ: + return visitor.visitSupportChatRead(); + case LEAD_MANAGE: + return visitor.visitLeadManage(); + case INVOICE_UPDATE: + return visitor.visitInvoiceUpdate(); + case CONTENT_REWARDS_BASIC_EXPORT: + return visitor.visitContentRewardsBasicExport(); + case PLAN_UPDATE: + return visitor.visitPlanUpdate(); + case MEMBER_BASIC_EXPORT: + return visitor.visitMemberBasicExport(); + case COMPANY_CREATE_CHILD: + return visitor.visitCompanyCreateChild(); + case APP_AUTHORIZATION_CREATE: + return visitor.visitAppAuthorizationCreate(); + case WEBHOOK_RECEIVE_ENTRIES: + return visitor.visitWebhookReceiveEntries(); + case WEBHOOK_RECEIVE_CARDS: + return visitor.visitWebhookReceiveCards(); + case CHECKOUT_CONFIGURATION_DELETE: + return visitor.visitCheckoutConfigurationDelete(); + case USER_NOTIFICATIONS_UPDATE: + return visitor.visitUserNotificationsUpdate(); + case USER_NOTIFICATIONS_READ: + return visitor.visitUserNotificationsRead(); + case PAYMENT_DISPUTE_ALERT_READ: + return visitor.visitPaymentDisputeAlertRead(); + case PAYMENT_RESOLUTION_CENTER: + return visitor.visitPaymentResolutionCenter(); + case LIVESTREAM_CHAT_WRITE: + return visitor.visitLivestreamChatWrite(); + case USER_BALANCE_READ: + return visitor.visitUserBalanceRead(); + case SUPPORT_CHAT_MESSAGE_CREATE: + return visitor.visitSupportChatMessageCreate(); + case SOCIAL_LINK_UPDATE: + return visitor.visitSocialLinkUpdate(); + case DEVELOPER_UPDATE_APP: + return visitor.visitDeveloperUpdateApp(); + case AUDIENCE_BASIC_READ: + return visitor.visitAudienceBasicRead(); + case PAYOUT_CREATE_DESTINATION: + return visitor.visitPayoutCreateDestination(); + case AIRDROP_LINK_BASIC_READ: + return visitor.visitAirdropLinkBasicRead(); + case CHECKOUT_CONFIGURATION_BASIC_READ: + return visitor.visitCheckoutConfigurationBasicRead(); + case AD_CAMPAIGN_CONVERSION_CREATE: + return visitor.visitAdCampaignConversionCreate(); + case AD_PUBLISHER_READ: + return visitor.visitAdPublisherRead(); + case CHAT_MODERATE: + return visitor.visitChatModerate(); + case DEVELOPER_LOGS_READ: + return visitor.visitDeveloperLogsRead(); + case WEBHOOK_RECEIVE_TRANSFERS: + return visitor.visitWebhookReceiveTransfers(); + case COMPANY_MANAGE_LEGAL: + return visitor.visitCompanyManageLegal(); + case PAYOUT_TRANSFER_FUNDS: + return visitor.visitPayoutTransferFunds(); + case WEBHOOK_RECEIVE_APP_MEMBERSHIPS: + return visitor.visitWebhookReceiveAppMemberships(); + case CONTENT_REWARDS_BASIC_READ: + return visitor.visitContentRewardsBasicRead(); + case PAYMENT_CHARGE: + return visitor.visitPaymentCharge(); + case DEVELOPER_MANAGE_BUILDS: + return visitor.visitDeveloperManageBuilds(); + case CRYPTO_WALLET_SWAP: + return visitor.visitCryptoWalletSwap(); + case EMAIL: + return visitor.visitEmail(); + case PROMO_CODE_DELETE: + return visitor.visitPromoCodeDelete(); + case PAYOUT_ACCOUNT_UPDATE: + return visitor.visitPayoutAccountUpdate(); + case PAYOUT_TRANSFER_EXPORT: + return visitor.visitPayoutTransferExport(); + case USER_EMAIL_READ: + return visitor.visitUserEmailRead(); + case COMPANY_BASIC_READ: + return visitor.visitCompanyBasicRead(); + case LEAD_BASIC_EXPORT: + return visitor.visitLeadBasicExport(); + case STATS_READ: + return visitor.visitStatsRead(); + case AI_CHAT_UPDATE: + return visitor.visitAiChatUpdate(); + case INCORPORATION_READ: + return visitor.visitIncorporationRead(); + case AI_CHAT_READ: + return visitor.visitAiChatRead(); + case APP_AUTHORIZATION_UPDATE: + return visitor.visitAppAuthorizationUpdate(); + case REFERRAL_PARTNER_CREATE: + return visitor.visitReferralPartnerCreate(); + case TRACKING_LINK_BASIC_EXPORT: + return visitor.visitTrackingLinkBasicExport(); + case ACCESS_PASS_CONTROL_CENTER: + return visitor.visitAccessPassControlCenter(); + case FORUM_MODERATE: + return visitor.visitForumModerate(); + case APP_AUTHORIZATION_READ: + return visitor.visitAppAuthorizationRead(); + case PAYOUT_UPDATE_DESTINATION: + return visitor.visitPayoutUpdateDestination(); + case DEVELOPER_MANAGE_WEBHOOK: + return visitor.visitDeveloperManageWebhook(); + case BOUNTY_BASIC_READ: + return visitor.visitBountyBasicRead(); + case WEBHOOK_RECEIVE_LEDGER_ACCOUNTS: + return visitor.visitWebhookReceiveLedgerAccounts(); + case ACCESS_PASS_UPDATE: + return visitor.visitAccessPassUpdate(); + case MEMBERSHIP_UPDATE: + return visitor.visitMembershipUpdate(); + case LIVESTREAM_MANAGE_RECORDING: + return visitor.visitLivestreamManageRecording(); + case WEBHOOK_RECEIVE_PAYOUT_METHODS: + return visitor.visitWebhookReceivePayoutMethods(); + case USER_STAFF_READ: + return visitor.visitUserStaffRead(); + case AD_CAMPAIGN_CREDIT_CREATE: + return visitor.visitAdCampaignCreditCreate(); + case WEBHOOK_RECEIVE_EXPORTS: + return visitor.visitWebhookReceiveExports(); + case EXPERIENCE_UPDATE: + return visitor.visitExperienceUpdate(); + case AFFILIATE_BASIC_READ: + return visitor.visitAffiliateBasicRead(); + case WEBHOOK_RECEIVE_SETUP_INTENTS: + return visitor.visitWebhookReceiveSetupIntents(); + case PAYMENT_DISPUTE_EXPORT: + return visitor.visitPaymentDisputeExport(); + case EVENT_CREATE: + return visitor.visitEventCreate(); + case PAYMENT_BASIC_READ: + return visitor.visitPaymentBasicRead(); + case MEMBER_PAYMENT_METHODS_USE: + return visitor.visitMemberPaymentMethodsUse(); + case ACCESS_PASS_DELETE: + return visitor.visitAccessPassDelete(); + case PAYMENT_BASIC_EXPORT: + return visitor.visitPaymentBasicExport(); + case AD_CAMPAIGN_DELETE: + return visitor.visitAdCampaignDelete(); + case AFFILIATE_CREATE: + return visitor.visitAffiliateCreate(); + case BOUNTY_CAPTURE_CLIP_DISCARD: + return visitor.visitBountyCaptureClipDiscard(); + case LIVESTREAM_CHAT_READ: + return visitor.visitLivestreamChatRead(); + case AD_CAMPAIGN_BASIC_READ: + return visitor.visitAdCampaignBasicRead(); + case BOUNTY_CAPTURE_CLIP_COMPLETE: + return visitor.visitBountyCaptureClipComplete(); + case BOUNTY_SUBMISSION_DELETE: + return visitor.visitBountySubmissionDelete(); + case PROMO_CODE_UPDATE: + return visitor.visitPromoCodeUpdate(); + case AD_CAMPAIGN_BASIC_EXPORT: + return visitor.visitAdCampaignBasicExport(); + case PAYMENT_MANAGE: + return visitor.visitPaymentManage(); + case AD_CAMPAIGN_STATS_READ: + return visitor.visitAdCampaignStatsRead(); + case PAYOUT_DESTINATION_READ: + return visitor.visitPayoutDestinationRead(); + case WEBHOOK_RECEIVE_DEPOSITS: + return visitor.visitWebhookReceiveDeposits(); + case EXPERIENCE_CREATE: + return visitor.visitExperienceCreate(); + case OPENID: + return visitor.visitOpenid(); + case COMPANY_TOKEN_TRANSACTION_CREATE: + return visitor.visitCompanyTokenTransactionCreate(); + case AUTHORIZED_ROLE_CREATE: + return visitor.visitAuthorizedRoleCreate(); + case DEVELOPER_UPDATE_APP_AUTHORIZATION: + return visitor.visitDeveloperUpdateAppAuthorization(); + case WEBHOOK_RECEIVE_CARD_APPLICATIONS: + return visitor.visitWebhookReceiveCardApplications(); + case MEDIA_GENERATE: + return visitor.visitMediaGenerate(); + case PAYMENT_DISPUTE: + return visitor.visitPaymentDispute(); + case AUTHORIZED_ROLE_ATTACH: + return visitor.visitAuthorizedRoleAttach(); + case AD_CAMPAIGN_READ: + return visitor.visitAdCampaignRead(); + case CHILD_COMPANY_BASIC_EXPORT: + return visitor.visitChildCompanyBasicExport(); + case LIVESTREAM_DELETE: + return visitor.visitLivestreamDelete(); + case EXPERIENCE_DETACH: + return visitor.visitExperienceDetach(); + case TRACKING_LINK_STATS_READ: + return visitor.visitTrackingLinkStatsRead(); + case WEBHOOK_RECEIVE_CHAT: + return visitor.visitWebhookReceiveChat(); + case CONTENT_REWARDS_DELETE: + return visitor.visitContentRewardsDelete(); + case MEMBERSHIP_CANCEL: + return visitor.visitMembershipCancel(); + case MEMBERSHIP_CREATE: + return visitor.visitMembershipCreate(); + case ACCESS_PASS_BASIC_READ: + return visitor.visitAccessPassBasicRead(); + case PARTNER_INVITE_CREATE: + return visitor.visitPartnerInviteCreate(); + case BOUNTY_CAPTURE_CLIP_CREATE: + return visitor.visitBountyCaptureClipCreate(); + case PAYOUT_WITHDRAW_FUNDS: + return visitor.visitPayoutWithdrawFunds(); + case SOCIAL_ACCOUNT_READ: + return visitor.visitSocialAccountRead(); + case EXPERIENCE_ATTACH: + return visitor.visitExperienceAttach(); + case CONTENT_REWARDS_CREATE: + return visitor.visitContentRewardsCreate(); + case MEMBERSHIP_RESYNC_ACCESS: + return visitor.visitMembershipResyncAccess(); + case PLAN_WAITLIST_MANAGE: + return visitor.visitPlanWaitlistManage(); + case AUTHORIZED_USER_CREATE: + return visitor.visitAuthorizedUserCreate(); + case AUTHORIZED_ROLE_UPDATE: + return visitor.visitAuthorizedRoleUpdate(); + case CHECKOUT_REQUEST_BASIC_READ: + return visitor.visitCheckoutRequestBasicRead(); + case AUTHORIZED_ROLE_DELETE: + return visitor.visitAuthorizedRoleDelete(); + case CUSTOM_EMOJI_UPDATE: + return visitor.visitCustomEmojiUpdate(); + case AIRDROP_LINK_MANAGE: + return visitor.visitAirdropLinkManage(); + case CONTENT_REWARDS_UPDATE: + return visitor.visitContentRewardsUpdate(); + case PAYMENT_DISPUTE_READ: + return visitor.visitPaymentDisputeRead(); + case ACCESS_PASS_STATS_EXPORT: + return visitor.visitAccessPassStatsExport(); + case MEMBER_MODERATE: + return visitor.visitMemberModerate(); + case PLAN_STATS_EXPORT: + return visitor.visitPlanStatsExport(); + case FORUM_READ: + return visitor.visitForumRead(); + case MEMBERSHIP_TRANSFER: + return visitor.visitMembershipTransfer(); + case AFFILIATE_UPDATE: + return visitor.visitAffiliateUpdate(); + case TRACKING_LINK_CREATE: + return visitor.visitTrackingLinkCreate(); + case CHAT_MESSAGE_CREATE: + return visitor.visitChatMessageCreate(); + case WEBHOOK_RECEIVE_PLANS: + return visitor.visitWebhookReceivePlans(); + case PLAN_STATS_READ: + return visitor.visitPlanStatsRead(); + case COURSE_ANALYTICS_READ: + return visitor.visitCourseAnalyticsRead(); + case WEBHOOK_RECEIVE_RESOLUTIONS: + return visitor.visitWebhookReceiveResolutions(); + case COURSE_LESSON_INTERACTION_READ: + return visitor.visitCourseLessonInteractionRead(); + case MEMBER_STATS_READ: + return visitor.visitMemberStatsRead(); + case BOUNTY_SUBMISSION_VOTE: + return visitor.visitBountySubmissionVote(); + case PROMO_CODE_BASIC_READ: + return visitor.visitPromoCodeBasicRead(); + case BOUNTY_SUBMISSION_CREATE: + return visitor.visitBountySubmissionCreate(); + case COMPANY_MANAGE_CHECKOUT: + return visitor.visitCompanyManageCheckout(); + case IDENTITY_READ: + return visitor.visitIdentityRead(); + case COMPANY_CREATE: + return visitor.visitCompanyCreate(); + case SHIPMENT_BASIC_READ: + return visitor.visitShipmentBasicRead(); + case WEBHOOK_RECEIVE_IDENTITY_PROFILES: + return visitor.visitWebhookReceiveIdentityProfiles(); + case COMPANY_UPDATE_CHILD_FEES: + return visitor.visitCompanyUpdateChildFees(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PermissionAction valueOf(String value) { + switch (value) { + case "invoice:create": + return INVOICE_CREATE; + case "webhook_receive:shipments": + return WEBHOOK_RECEIVE_SHIPMENTS; + case "company_token_transaction:read": + return COMPANY_TOKEN_TRANSACTION_READ; + case "member:stats:export": + return MEMBER_STATS_EXPORT; + case "livestream:moderate": + return LIVESTREAM_MODERATE; + case "tracking_link:update": + return TRACKING_LINK_UPDATE; + case "authorized_user:delete": + return AUTHORIZED_USER_DELETE; + case "company:authorized_user:email:read": + return COMPANY_AUTHORIZED_USER_EMAIL_READ; + case "social_account:delete": + return SOCIAL_ACCOUNT_DELETE; + case "partner:create": + return PARTNER_CREATE; + case "webhook_receive:refunds": + return WEBHOOK_RECEIVE_REFUNDS; + case "oauth:token_exchange": + return OAUTH_TOKEN_EXCHANGE; + case "payment:resolution_center_case:manage": + return PAYMENT_RESOLUTION_CENTER_CASE_MANAGE; + case "identity:write": + return IDENTITY_WRITE; + case "company:update": + return COMPANY_UPDATE; + case "company:delete_child": + return COMPANY_DELETE_CHILD; + case "webhook_receive:verifications": + return WEBHOOK_RECEIVE_VERIFICATIONS; + case "webhook_receive:products": + return WEBHOOK_RECEIVE_PRODUCTS; + case "ad_campaign:update": + return AD_CAMPAIGN_UPDATE; + case "notification:create": + return NOTIFICATION_CREATE; + case "bounty:create": + return BOUNTY_CREATE; + case "invoice:basic:read": + return INVOICE_BASIC_READ; + case "developer:manage_oauth": + return DEVELOPER_MANAGE_OAUTH; + case "dms:channel:manage": + return DMS_CHANNEL_MANAGE; + case "checkout_request:create": + return CHECKOUT_REQUEST_CREATE; + case "webhook_receive:accounts": + return WEBHOOK_RECEIVE_ACCOUNTS; + case "dms:read": + return DMS_READ; + case "payment:setup_intent:read": + return PAYMENT_SETUP_INTENT_READ; + case "company:delete": + return COMPANY_DELETE; + case "social_account:create": + return SOCIAL_ACCOUNT_CREATE; + case "user:profile:update": + return USER_PROFILE_UPDATE; + case "payment:resolution_center_case:read": + return PAYMENT_RESOLUTION_CENTER_CASE_READ; + case "webhook_receive:app_payments": + return WEBHOOK_RECEIVE_APP_PAYMENTS; + case "ad_campaign:create": + return AD_CAMPAIGN_CREATE; + case "bounty:update": + return BOUNTY_UPDATE; + case "payment:setup_intent:manage": + return PAYMENT_SETUP_INTENT_MANAGE; + case "company:balance:read": + return COMPANY_BALANCE_READ; + case "plan:basic:read": + return PLAN_BASIC_READ; + case "tracking_link:basic:read": + return TRACKING_LINK_BASIC_READ; + case "plan:waitlist:read": + return PLAN_WAITLIST_READ; + case "payout:withdrawal:read": + return PAYOUT_WITHDRAWAL_READ; + case "company:balance:export": + return COMPANY_BALANCE_EXPORT; + case "webhook_receive:payments": + return WEBHOOK_RECEIVE_PAYMENTS; + case "tracking_link:delete": + return TRACKING_LINK_DELETE; + case "webhook_receive:invoices": + return WEBHOOK_RECEIVE_INVOICES; + case "chat:read": + return CHAT_READ; + case "experience:delete": + return EXPERIENCE_DELETE; + case "payment:resolution_center_case:export": + return PAYMENT_RESOLUTION_CENTER_CASE_EXPORT; + case "webhook_receive:ad_campaigns": + return WEBHOOK_RECEIVE_AD_CAMPAIGNS; + case "checkout_configuration:create": + return CHECKOUT_CONFIGURATION_CREATE; + case "developer:manage_api_key": + return DEVELOPER_MANAGE_API_KEY; + case "ai_chat:delete": + return AI_CHAT_DELETE; + case "webhook_receive:disputes": + return WEBHOOK_RECEIVE_DISPUTES; + case "iap:read": + return IAP_READ; + case "crypto_wallet:manage": + return CRYPTO_WALLET_MANAGE; + case "support_chat:create": + return SUPPORT_CHAT_CREATE; + case "dms:message:manage": + return DMS_MESSAGE_MANAGE; + case "authorized_user:update": + return AUTHORIZED_USER_UPDATE; + case "app_authorization:delete": + return APP_AUTHORIZATION_DELETE; + case "media:read": + return MEDIA_READ; + case "member:payment_methods:read": + return MEMBER_PAYMENT_METHODS_READ; + case "referral:basic:read": + return REFERRAL_BASIC_READ; + case "audience:update": + return AUDIENCE_UPDATE; + case "plan:waitlist:export": + return PLAN_WAITLIST_EXPORT; + case "ai_prompt:create": + return AI_PROMPT_CREATE; + case "promo_code:basic:export": + return PROMO_CODE_BASIC_EXPORT; + case "company:log:read": + return COMPANY_LOG_READ; + case "content_rewards:moderate_submission": + return CONTENT_REWARDS_MODERATE_SUBMISSION; + case "payout:transfer:read": + return PAYOUT_TRANSFER_READ; + case "authorized_role:detach": + return AUTHORIZED_ROLE_DETACH; + case "webhook_receive:swaps": + return WEBHOOK_RECEIVE_SWAPS; + case "partner:basic:read": + return PARTNER_BASIC_READ; + case "member:phone:read": + return MEMBER_PHONE_READ; + case "forum:post:create": + return FORUM_POST_CREATE; + case "incorporation:write": + return INCORPORATION_WRITE; + case "member:manage": + return MEMBER_MANAGE; + case "member:basic:read": + return MEMBER_BASIC_READ; + case "member:journey:read": + return MEMBER_JOURNEY_READ; + case "webhook_receive:withdrawals": + return WEBHOOK_RECEIVE_WITHDRAWALS; + case "webhook_receive:memberships": + return WEBHOOK_RECEIVE_MEMBERSHIPS; + case "experience:hidden_experience:read": + return EXPERIENCE_HIDDEN_EXPERIENCE_READ; + case "promo_code:create": + return PROMO_CODE_CREATE; + case "company:authorized_user:read": + return COMPANY_AUTHORIZED_USER_READ; + case "access_pass:stats:read": + return ACCESS_PASS_STATS_READ; + case "livestream:create": + return LIVESTREAM_CREATE; + case "access_pass:basic:export": + return ACCESS_PASS_BASIC_EXPORT; + case "member:payment_methods:manage": + return MEMBER_PAYMENT_METHODS_MANAGE; + case "payout:delete_destination": + return PAYOUT_DELETE_DESTINATION; + case "plan:create": + return PLAN_CREATE; + case "webhook_receive:card_transactions": + return WEBHOOK_RECEIVE_CARD_TRANSACTIONS; + case "courses:read": + return COURSES_READ; + case "invoice:basic:export": + return INVOICE_BASIC_EXPORT; + case "member:email:read": + return MEMBER_EMAIL_READ; + case "lead:basic:read": + return LEAD_BASIC_READ; + case "payout:withdrawal:export": + return PAYOUT_WITHDRAWAL_EXPORT; + case "plan:delete": + return PLAN_DELETE; + case "payout:account:read": + return PAYOUT_ACCOUNT_READ; + case "profile": + return PROFILE; + case "developer:basic:read": + return DEVELOPER_BASIC_READ; + case "access_pass:create": + return ACCESS_PASS_CREATE; + case "webhook_receive:courses": + return WEBHOOK_RECEIVE_COURSES; + case "shipment:create": + return SHIPMENT_CREATE; + case "tracking_link:stats:export": + return TRACKING_LINK_STATS_EXPORT; + case "courses:update": + return COURSES_UPDATE; + case "plan:basic:export": + return PLAN_BASIC_EXPORT; + case "ai_chat:create": + return AI_CHAT_CREATE; + case "webhook_receive:members": + return WEBHOOK_RECEIVE_MEMBERS; + case "webhook_receive:payout_accounts": + return WEBHOOK_RECEIVE_PAYOUT_ACCOUNTS; + case "company:transfer_ownership": + return COMPANY_TRANSFER_OWNERSHIP; + case "chat:manage_webhook": + return CHAT_MANAGE_WEBHOOK; + case "developer:create_app": + return DEVELOPER_CREATE_APP; + case "support_chat:read": + return SUPPORT_CHAT_READ; + case "lead:manage": + return LEAD_MANAGE; + case "invoice:update": + return INVOICE_UPDATE; + case "content_rewards:basic:export": + return CONTENT_REWARDS_BASIC_EXPORT; + case "plan:update": + return PLAN_UPDATE; + case "member:basic:export": + return MEMBER_BASIC_EXPORT; + case "company:create_child": + return COMPANY_CREATE_CHILD; + case "app_authorization:create": + return APP_AUTHORIZATION_CREATE; + case "webhook_receive:entries": + return WEBHOOK_RECEIVE_ENTRIES; + case "webhook_receive:cards": + return WEBHOOK_RECEIVE_CARDS; + case "checkout_configuration:delete": + return CHECKOUT_CONFIGURATION_DELETE; + case "user:notifications:update": + return USER_NOTIFICATIONS_UPDATE; + case "user:notifications:read": + return USER_NOTIFICATIONS_READ; + case "payment:dispute_alert:read": + return PAYMENT_DISPUTE_ALERT_READ; + case "payment:resolution_center": + return PAYMENT_RESOLUTION_CENTER; + case "livestream:chat:write": + return LIVESTREAM_CHAT_WRITE; + case "user:balance:read": + return USER_BALANCE_READ; + case "support_chat:message:create": + return SUPPORT_CHAT_MESSAGE_CREATE; + case "social_link:update": + return SOCIAL_LINK_UPDATE; + case "developer:update_app": + return DEVELOPER_UPDATE_APP; + case "audience:basic:read": + return AUDIENCE_BASIC_READ; + case "payout:create_destination": + return PAYOUT_CREATE_DESTINATION; + case "airdrop_link:basic:read": + return AIRDROP_LINK_BASIC_READ; + case "checkout_configuration:basic:read": + return CHECKOUT_CONFIGURATION_BASIC_READ; + case "ad_campaign:conversion:create": + return AD_CAMPAIGN_CONVERSION_CREATE; + case "ad_publisher:read": + return AD_PUBLISHER_READ; + case "chat:moderate": + return CHAT_MODERATE; + case "developer:logs:read": + return DEVELOPER_LOGS_READ; + case "webhook_receive:transfers": + return WEBHOOK_RECEIVE_TRANSFERS; + case "company:manage_legal": + return COMPANY_MANAGE_LEGAL; + case "payout:transfer_funds": + return PAYOUT_TRANSFER_FUNDS; + case "webhook_receive:app_memberships": + return WEBHOOK_RECEIVE_APP_MEMBERSHIPS; + case "content_rewards:basic:read": + return CONTENT_REWARDS_BASIC_READ; + case "payment:charge": + return PAYMENT_CHARGE; + case "developer:manage_builds": + return DEVELOPER_MANAGE_BUILDS; + case "crypto_wallet:swap": + return CRYPTO_WALLET_SWAP; + case "email": + return EMAIL; + case "promo_code:delete": + return PROMO_CODE_DELETE; + case "payout:account:update": + return PAYOUT_ACCOUNT_UPDATE; + case "payout:transfer:export": + return PAYOUT_TRANSFER_EXPORT; + case "user:email:read": + return USER_EMAIL_READ; + case "company:basic:read": + return COMPANY_BASIC_READ; + case "lead:basic:export": + return LEAD_BASIC_EXPORT; + case "stats:read": + return STATS_READ; + case "ai_chat:update": + return AI_CHAT_UPDATE; + case "incorporation:read": + return INCORPORATION_READ; + case "ai_chat:read": + return AI_CHAT_READ; + case "app_authorization:update": + return APP_AUTHORIZATION_UPDATE; + case "referral:partner:create": + return REFERRAL_PARTNER_CREATE; + case "tracking_link:basic:export": + return TRACKING_LINK_BASIC_EXPORT; + case "access_pass:control_center": + return ACCESS_PASS_CONTROL_CENTER; + case "forum:moderate": + return FORUM_MODERATE; + case "app_authorization:read": + return APP_AUTHORIZATION_READ; + case "payout:update_destination": + return PAYOUT_UPDATE_DESTINATION; + case "developer:manage_webhook": + return DEVELOPER_MANAGE_WEBHOOK; + case "bounty:basic:read": + return BOUNTY_BASIC_READ; + case "webhook_receive:ledger_accounts": + return WEBHOOK_RECEIVE_LEDGER_ACCOUNTS; + case "access_pass:update": + return ACCESS_PASS_UPDATE; + case "membership:update": + return MEMBERSHIP_UPDATE; + case "livestream:manage_recording": + return LIVESTREAM_MANAGE_RECORDING; + case "webhook_receive:payout_methods": + return WEBHOOK_RECEIVE_PAYOUT_METHODS; + case "user:staff:read": + return USER_STAFF_READ; + case "ad_campaign:credit:create": + return AD_CAMPAIGN_CREDIT_CREATE; + case "webhook_receive:exports": + return WEBHOOK_RECEIVE_EXPORTS; + case "experience:update": + return EXPERIENCE_UPDATE; + case "affiliate:basic:read": + return AFFILIATE_BASIC_READ; + case "webhook_receive:setup_intents": + return WEBHOOK_RECEIVE_SETUP_INTENTS; + case "payment:dispute:export": + return PAYMENT_DISPUTE_EXPORT; + case "event:create": + return EVENT_CREATE; + case "payment:basic:read": + return PAYMENT_BASIC_READ; + case "member:payment_methods:use": + return MEMBER_PAYMENT_METHODS_USE; + case "access_pass:delete": + return ACCESS_PASS_DELETE; + case "payment:basic:export": + return PAYMENT_BASIC_EXPORT; + case "ad_campaign:delete": + return AD_CAMPAIGN_DELETE; + case "affiliate:create": + return AFFILIATE_CREATE; + case "bounty:capture_clip:discard": + return BOUNTY_CAPTURE_CLIP_DISCARD; + case "livestream:chat:read": + return LIVESTREAM_CHAT_READ; + case "ad_campaign:basic:read": + return AD_CAMPAIGN_BASIC_READ; + case "bounty:capture_clip:complete": + return BOUNTY_CAPTURE_CLIP_COMPLETE; + case "bounty:submission:delete": + return BOUNTY_SUBMISSION_DELETE; + case "promo_code:update": + return PROMO_CODE_UPDATE; + case "ad_campaign:basic:export": + return AD_CAMPAIGN_BASIC_EXPORT; + case "payment:manage": + return PAYMENT_MANAGE; + case "ad_campaign:stats:read": + return AD_CAMPAIGN_STATS_READ; + case "payout:destination:read": + return PAYOUT_DESTINATION_READ; + case "webhook_receive:deposits": + return WEBHOOK_RECEIVE_DEPOSITS; + case "experience:create": + return EXPERIENCE_CREATE; + case "openid": + return OPENID; + case "company_token_transaction:create": + return COMPANY_TOKEN_TRANSACTION_CREATE; + case "authorized_role:create": + return AUTHORIZED_ROLE_CREATE; + case "developer:update_app_authorization": + return DEVELOPER_UPDATE_APP_AUTHORIZATION; + case "webhook_receive:card_applications": + return WEBHOOK_RECEIVE_CARD_APPLICATIONS; + case "media:generate": + return MEDIA_GENERATE; + case "payment:dispute": + return PAYMENT_DISPUTE; + case "authorized_role:attach": + return AUTHORIZED_ROLE_ATTACH; + case "ad_campaign:read": + return AD_CAMPAIGN_READ; + case "child_company:basic:export": + return CHILD_COMPANY_BASIC_EXPORT; + case "livestream:delete": + return LIVESTREAM_DELETE; + case "experience:detach": + return EXPERIENCE_DETACH; + case "tracking_link:stats:read": + return TRACKING_LINK_STATS_READ; + case "webhook_receive:chat": + return WEBHOOK_RECEIVE_CHAT; + case "content_rewards:delete": + return CONTENT_REWARDS_DELETE; + case "membership:cancel": + return MEMBERSHIP_CANCEL; + case "membership:create": + return MEMBERSHIP_CREATE; + case "access_pass:basic:read": + return ACCESS_PASS_BASIC_READ; + case "partner:invite:create": + return PARTNER_INVITE_CREATE; + case "bounty:capture_clip:create": + return BOUNTY_CAPTURE_CLIP_CREATE; + case "payout:withdraw_funds": + return PAYOUT_WITHDRAW_FUNDS; + case "social_account:read": + return SOCIAL_ACCOUNT_READ; + case "experience:attach": + return EXPERIENCE_ATTACH; + case "content_rewards:create": + return CONTENT_REWARDS_CREATE; + case "membership:resync_access": + return MEMBERSHIP_RESYNC_ACCESS; + case "plan:waitlist:manage": + return PLAN_WAITLIST_MANAGE; + case "authorized_user:create": + return AUTHORIZED_USER_CREATE; + case "authorized_role:update": + return AUTHORIZED_ROLE_UPDATE; + case "checkout_request:basic:read": + return CHECKOUT_REQUEST_BASIC_READ; + case "authorized_role:delete": + return AUTHORIZED_ROLE_DELETE; + case "custom_emoji:update": + return CUSTOM_EMOJI_UPDATE; + case "airdrop_link:manage": + return AIRDROP_LINK_MANAGE; + case "content_rewards:update": + return CONTENT_REWARDS_UPDATE; + case "payment:dispute:read": + return PAYMENT_DISPUTE_READ; + case "access_pass:stats:export": + return ACCESS_PASS_STATS_EXPORT; + case "member:moderate": + return MEMBER_MODERATE; + case "plan:stats:export": + return PLAN_STATS_EXPORT; + case "forum:read": + return FORUM_READ; + case "membership:transfer": + return MEMBERSHIP_TRANSFER; + case "affiliate:update": + return AFFILIATE_UPDATE; + case "tracking_link:create": + return TRACKING_LINK_CREATE; + case "chat:message:create": + return CHAT_MESSAGE_CREATE; + case "webhook_receive:plans": + return WEBHOOK_RECEIVE_PLANS; + case "plan:stats:read": + return PLAN_STATS_READ; + case "course_analytics:read": + return COURSE_ANALYTICS_READ; + case "webhook_receive:resolutions": + return WEBHOOK_RECEIVE_RESOLUTIONS; + case "course_lesson_interaction:read": + return COURSE_LESSON_INTERACTION_READ; + case "member:stats:read": + return MEMBER_STATS_READ; + case "bounty:submission:vote": + return BOUNTY_SUBMISSION_VOTE; + case "promo_code:basic:read": + return PROMO_CODE_BASIC_READ; + case "bounty:submission:create": + return BOUNTY_SUBMISSION_CREATE; + case "company:manage_checkout": + return COMPANY_MANAGE_CHECKOUT; + case "identity:read": + return IDENTITY_READ; + case "company:create": + return COMPANY_CREATE; + case "shipment:basic:read": + return SHIPMENT_BASIC_READ; + case "webhook_receive:identity_profiles": + return WEBHOOK_RECEIVE_IDENTITY_PROFILES; + case "company:update_child_fees": + return COMPANY_UPDATE_CHILD_FEES; + default: + return new PermissionAction(Value.UNKNOWN, value); + } + } + + public enum Value { + AI_PROMPT_CREATE, + + ACCESS_PASS_BASIC_EXPORT, + + ACCESS_PASS_BASIC_READ, + + ACCESS_PASS_CONTROL_CENTER, + + ACCESS_PASS_CREATE, + + ACCESS_PASS_DELETE, + + ACCESS_PASS_STATS_EXPORT, + + ACCESS_PASS_STATS_READ, + + ACCESS_PASS_UPDATE, + + AD_CAMPAIGN_BASIC_EXPORT, + + AD_CAMPAIGN_BASIC_READ, + + AD_CAMPAIGN_CONVERSION_CREATE, + + AD_CAMPAIGN_CREATE, + + AD_CAMPAIGN_CREDIT_CREATE, + + AD_CAMPAIGN_DELETE, + + AD_CAMPAIGN_READ, + + AD_CAMPAIGN_STATS_READ, + + AD_CAMPAIGN_UPDATE, + + AUDIENCE_BASIC_READ, + + AUDIENCE_UPDATE, + + AD_PUBLISHER_READ, + + AFFILIATE_BASIC_READ, + + AFFILIATE_CREATE, + + AFFILIATE_UPDATE, + + AUTHORIZED_USER_CREATE, + + AUTHORIZED_USER_DELETE, + + AUTHORIZED_USER_UPDATE, + + AUTHORIZED_ROLE_CREATE, + + AUTHORIZED_ROLE_UPDATE, + + AUTHORIZED_ROLE_DELETE, + + AUTHORIZED_ROLE_ATTACH, + + AUTHORIZED_ROLE_DETACH, + + APP_AUTHORIZATION_CREATE, + + APP_AUTHORIZATION_READ, + + APP_AUTHORIZATION_UPDATE, + + APP_AUTHORIZATION_DELETE, + + BOUNTY_BASIC_READ, + + BOUNTY_CREATE, + + BOUNTY_CAPTURE_CLIP_CREATE, + + BOUNTY_CAPTURE_CLIP_COMPLETE, + + BOUNTY_CAPTURE_CLIP_DISCARD, + + BOUNTY_UPDATE, + + BOUNTY_SUBMISSION_CREATE, + + BOUNTY_SUBMISSION_DELETE, + + BOUNTY_SUBMISSION_VOTE, + + CHAT_MANAGE_WEBHOOK, + + CHAT_MODERATE, + + CHAT_MESSAGE_CREATE, + + CHAT_READ, + + DMS_READ, + + DMS_MESSAGE_MANAGE, + + DMS_CHANNEL_MANAGE, + + FORUM_POST_CREATE, + + FORUM_READ, + + FORUM_MODERATE, + + COMPANY_AUTHORIZED_USER_READ, + + COMPANY_AUTHORIZED_USER_EMAIL_READ, + + COMPANY_BALANCE_READ, + + COMPANY_BALANCE_EXPORT, + + COMPANY_TOKEN_TRANSACTION_READ, + + COMPANY_TOKEN_TRANSACTION_CREATE, + + COMPANY_LOG_READ, + + COMPANY_MANAGE_CHECKOUT, + + COMPANY_MANAGE_LEGAL, + + COMPANY_BASIC_READ, + + COMPANY_UPDATE, + + COMPANY_TRANSFER_OWNERSHIP, + + COMPANY_CREATE, + + COMPANY_CREATE_CHILD, + + COMPANY_DELETE, + + COMPANY_DELETE_CHILD, + + COMPANY_UPDATE_CHILD_FEES, + + CHILD_COMPANY_BASIC_EXPORT, + + SOCIAL_ACCOUNT_CREATE, + + SOCIAL_ACCOUNT_DELETE, + + SOCIAL_ACCOUNT_READ, + + SOCIAL_LINK_UPDATE, + + CUSTOM_EMOJI_UPDATE, + + CONTENT_REWARDS_BASIC_EXPORT, + + CONTENT_REWARDS_BASIC_READ, + + CONTENT_REWARDS_CREATE, + + CONTENT_REWARDS_DELETE, + + CONTENT_REWARDS_MODERATE_SUBMISSION, + + CONTENT_REWARDS_UPDATE, + + DEVELOPER_BASIC_READ, + + DEVELOPER_CREATE_APP, + + DEVELOPER_MANAGE_API_KEY, + + DEVELOPER_MANAGE_OAUTH, + + DEVELOPER_MANAGE_WEBHOOK, + + DEVELOPER_LOGS_READ, + + DEVELOPER_MANAGE_BUILDS, + + DEVELOPER_UPDATE_APP, + + DEVELOPER_UPDATE_APP_AUTHORIZATION, + + EVENT_CREATE, + + EXPERIENCE_ATTACH, + + EXPERIENCE_CREATE, + + EXPERIENCE_DELETE, + + EXPERIENCE_DETACH, + + EXPERIENCE_HIDDEN_EXPERIENCE_READ, + + EXPERIENCE_UPDATE, + + IAP_READ, + + IDENTITY_READ, + + IDENTITY_WRITE, + + INCORPORATION_READ, + + INCORPORATION_WRITE, + + LIVESTREAM_CREATE, + + LIVESTREAM_DELETE, + + LIVESTREAM_MANAGE_RECORDING, + + LIVESTREAM_CHAT_READ, + + LIVESTREAM_CHAT_WRITE, + + LIVESTREAM_MODERATE, + + MEDIA_GENERATE, + + MEDIA_READ, + + MEMBER_BASIC_EXPORT, + + MEMBER_BASIC_READ, + + MEMBER_EMAIL_READ, + + MEMBER_PHONE_READ, + + MEMBER_PAYMENT_METHODS_READ, + + MEMBER_PAYMENT_METHODS_USE, + + MEMBER_PAYMENT_METHODS_MANAGE, + + MEMBER_MANAGE, + + MEMBERSHIP_CANCEL, + + MEMBERSHIP_RESYNC_ACCESS, + + MEMBERSHIP_CREATE, + + MEMBERSHIP_UPDATE, + + MEMBERSHIP_TRANSFER, + + MEMBER_MODERATE, + + MEMBER_STATS_EXPORT, + + MEMBER_STATS_READ, + + MEMBER_JOURNEY_READ, + + PAYMENT_BASIC_EXPORT, + + PAYMENT_BASIC_READ, + + PAYMENT_CHARGE, + + PAYMENT_DISPUTE, + + PAYMENT_DISPUTE_EXPORT, + + PAYMENT_DISPUTE_READ, + + PAYMENT_DISPUTE_ALERT_READ, + + PAYMENT_SETUP_INTENT_READ, + + PAYMENT_SETUP_INTENT_MANAGE, + + PAYMENT_MANAGE, + + PAYMENT_RESOLUTION_CENTER, + + PAYMENT_RESOLUTION_CENTER_CASE_EXPORT, + + PAYMENT_RESOLUTION_CENTER_CASE_READ, + + PAYMENT_RESOLUTION_CENTER_CASE_MANAGE, + + PAYOUT_CREATE_DESTINATION, + + PAYOUT_DELETE_DESTINATION, + + PAYOUT_DESTINATION_READ, + + PAYOUT_TRANSFER_FUNDS, + + PAYOUT_TRANSFER_READ, + + PAYOUT_TRANSFER_EXPORT, + + PAYOUT_UPDATE_DESTINATION, + + PAYOUT_WITHDRAW_FUNDS, + + PAYOUT_WITHDRAWAL_READ, + + PAYOUT_WITHDRAWAL_EXPORT, + + PAYOUT_ACCOUNT_READ, + + PAYOUT_ACCOUNT_UPDATE, + + PLAN_BASIC_EXPORT, + + PLAN_BASIC_READ, + + PLAN_CREATE, + + PLAN_DELETE, + + PLAN_STATS_EXPORT, + + PLAN_STATS_READ, + + PLAN_UPDATE, + + PLAN_WAITLIST_MANAGE, + + PLAN_WAITLIST_EXPORT, + + PLAN_WAITLIST_READ, + + PROMO_CODE_BASIC_EXPORT, + + PROMO_CODE_BASIC_READ, + + PROMO_CODE_CREATE, + + PROMO_CODE_DELETE, + + PROMO_CODE_UPDATE, + + REFERRAL_BASIC_READ, + + REFERRAL_PARTNER_CREATE, + + PARTNER_BASIC_READ, + + PARTNER_INVITE_CREATE, + + PARTNER_CREATE, + + STATS_READ, + + SUPPORT_CHAT_READ, + + SUPPORT_CHAT_CREATE, + + SUPPORT_CHAT_MESSAGE_CREATE, + + TRACKING_LINK_BASIC_EXPORT, + + TRACKING_LINK_BASIC_READ, + + TRACKING_LINK_CREATE, + + TRACKING_LINK_DELETE, + + TRACKING_LINK_STATS_EXPORT, + + TRACKING_LINK_STATS_READ, + + TRACKING_LINK_UPDATE, + + COURSES_READ, + + COURSES_UPDATE, + + COURSE_LESSON_INTERACTION_READ, + + COURSE_ANALYTICS_READ, + + LEAD_BASIC_READ, + + LEAD_BASIC_EXPORT, + + INVOICE_CREATE, + + INVOICE_BASIC_READ, + + INVOICE_BASIC_EXPORT, + + INVOICE_UPDATE, + + WEBHOOK_RECEIVE_INVOICES, + + WEBHOOK_RECEIVE_SETUP_INTENTS, + + WEBHOOK_RECEIVE_WITHDRAWALS, + + WEBHOOK_RECEIVE_SWAPS, + + WEBHOOK_RECEIVE_LEDGER_ACCOUNTS, + + WEBHOOK_RECEIVE_ACCOUNTS, + + WEBHOOK_RECEIVE_DEPOSITS, + + WEBHOOK_RECEIVE_TRANSFERS, + + WEBHOOK_RECEIVE_CARD_TRANSACTIONS, + + WEBHOOK_RECEIVE_CARDS, + + WEBHOOK_RECEIVE_CARD_APPLICATIONS, + + WEBHOOK_RECEIVE_PAYOUT_METHODS, + + WEBHOOK_RECEIVE_VERIFICATIONS, + + WEBHOOK_RECEIVE_IDENTITY_PROFILES, + + WEBHOOK_RECEIVE_PAYOUT_ACCOUNTS, + + WEBHOOK_RECEIVE_CHAT, + + WEBHOOK_RECEIVE_ENTRIES, + + WEBHOOK_RECEIVE_AD_CAMPAIGNS, + + WEBHOOK_RECEIVE_PRODUCTS, + + WEBHOOK_RECEIVE_PLANS, + + WEBHOOK_RECEIVE_SHIPMENTS, + + WEBHOOK_RECEIVE_MEMBERS, + + WEBHOOK_RECEIVE_EXPORTS, + + WEBHOOK_RECEIVE_COURSES, + + WEBHOOK_RECEIVE_MEMBERSHIPS, + + WEBHOOK_RECEIVE_PAYMENTS, + + WEBHOOK_RECEIVE_REFUNDS, + + WEBHOOK_RECEIVE_DISPUTES, + + WEBHOOK_RECEIVE_RESOLUTIONS, + + WEBHOOK_RECEIVE_APP_PAYMENTS, + + WEBHOOK_RECEIVE_APP_MEMBERSHIPS, + + SHIPMENT_CREATE, + + SHIPMENT_BASIC_READ, + + CHECKOUT_CONFIGURATION_BASIC_READ, + + CHECKOUT_CONFIGURATION_CREATE, + + CHECKOUT_CONFIGURATION_DELETE, + + CHECKOUT_REQUEST_CREATE, + + CHECKOUT_REQUEST_BASIC_READ, + + CRYPTO_WALLET_MANAGE, + + CRYPTO_WALLET_SWAP, + + AIRDROP_LINK_BASIC_READ, + + AIRDROP_LINK_MANAGE, + + LEAD_MANAGE, + + NOTIFICATION_CREATE, + + USER_BALANCE_READ, + + USER_EMAIL_READ, + + USER_STAFF_READ, + + OAUTH_TOKEN_EXCHANGE, + + OPENID, + + PROFILE, + + EMAIL, + + AI_CHAT_READ, + + AI_CHAT_CREATE, + + AI_CHAT_DELETE, + + AI_CHAT_UPDATE, + + USER_NOTIFICATIONS_READ, + + USER_NOTIFICATIONS_UPDATE, + + USER_PROFILE_UPDATE, + + UNKNOWN + } + + public interface Visitor { + T visitAiPromptCreate(); + + T visitAccessPassBasicExport(); + + T visitAccessPassBasicRead(); + + T visitAccessPassControlCenter(); + + T visitAccessPassCreate(); + + T visitAccessPassDelete(); + + T visitAccessPassStatsExport(); + + T visitAccessPassStatsRead(); + + T visitAccessPassUpdate(); + + T visitAdCampaignBasicExport(); + + T visitAdCampaignBasicRead(); + + T visitAdCampaignConversionCreate(); + + T visitAdCampaignCreate(); + + T visitAdCampaignCreditCreate(); + + T visitAdCampaignDelete(); + + T visitAdCampaignRead(); + + T visitAdCampaignStatsRead(); + + T visitAdCampaignUpdate(); + + T visitAudienceBasicRead(); + + T visitAudienceUpdate(); + + T visitAdPublisherRead(); + + T visitAffiliateBasicRead(); + + T visitAffiliateCreate(); + + T visitAffiliateUpdate(); + + T visitAuthorizedUserCreate(); + + T visitAuthorizedUserDelete(); + + T visitAuthorizedUserUpdate(); + + T visitAuthorizedRoleCreate(); + + T visitAuthorizedRoleUpdate(); + + T visitAuthorizedRoleDelete(); + + T visitAuthorizedRoleAttach(); + + T visitAuthorizedRoleDetach(); + + T visitAppAuthorizationCreate(); + + T visitAppAuthorizationRead(); + + T visitAppAuthorizationUpdate(); + + T visitAppAuthorizationDelete(); + + T visitBountyBasicRead(); + + T visitBountyCreate(); + + T visitBountyCaptureClipCreate(); + + T visitBountyCaptureClipComplete(); + + T visitBountyCaptureClipDiscard(); + + T visitBountyUpdate(); + + T visitBountySubmissionCreate(); + + T visitBountySubmissionDelete(); + + T visitBountySubmissionVote(); + + T visitChatManageWebhook(); + + T visitChatModerate(); + + T visitChatMessageCreate(); + + T visitChatRead(); + + T visitDmsRead(); + + T visitDmsMessageManage(); + + T visitDmsChannelManage(); + + T visitForumPostCreate(); + + T visitForumRead(); + + T visitForumModerate(); + + T visitCompanyAuthorizedUserRead(); + + T visitCompanyAuthorizedUserEmailRead(); + + T visitCompanyBalanceRead(); + + T visitCompanyBalanceExport(); + + T visitCompanyTokenTransactionRead(); + + T visitCompanyTokenTransactionCreate(); + + T visitCompanyLogRead(); + + T visitCompanyManageCheckout(); + + T visitCompanyManageLegal(); + + T visitCompanyBasicRead(); + + T visitCompanyUpdate(); + + T visitCompanyTransferOwnership(); + + T visitCompanyCreate(); + + T visitCompanyCreateChild(); + + T visitCompanyDelete(); + + T visitCompanyDeleteChild(); + + T visitCompanyUpdateChildFees(); + + T visitChildCompanyBasicExport(); + + T visitSocialAccountCreate(); + + T visitSocialAccountDelete(); + + T visitSocialAccountRead(); + + T visitSocialLinkUpdate(); + + T visitCustomEmojiUpdate(); + + T visitContentRewardsBasicExport(); + + T visitContentRewardsBasicRead(); + + T visitContentRewardsCreate(); + + T visitContentRewardsDelete(); + + T visitContentRewardsModerateSubmission(); + + T visitContentRewardsUpdate(); + + T visitDeveloperBasicRead(); + + T visitDeveloperCreateApp(); + + T visitDeveloperManageApiKey(); + + T visitDeveloperManageOauth(); + + T visitDeveloperManageWebhook(); + + T visitDeveloperLogsRead(); + + T visitDeveloperManageBuilds(); + + T visitDeveloperUpdateApp(); + + T visitDeveloperUpdateAppAuthorization(); + + T visitEventCreate(); + + T visitExperienceAttach(); + + T visitExperienceCreate(); + + T visitExperienceDelete(); + + T visitExperienceDetach(); + + T visitExperienceHiddenExperienceRead(); + + T visitExperienceUpdate(); + + T visitIapRead(); + + T visitIdentityRead(); + + T visitIdentityWrite(); + + T visitIncorporationRead(); + + T visitIncorporationWrite(); + + T visitLivestreamCreate(); + + T visitLivestreamDelete(); + + T visitLivestreamManageRecording(); + + T visitLivestreamChatRead(); + + T visitLivestreamChatWrite(); + + T visitLivestreamModerate(); + + T visitMediaGenerate(); + + T visitMediaRead(); + + T visitMemberBasicExport(); + + T visitMemberBasicRead(); + + T visitMemberEmailRead(); + + T visitMemberPhoneRead(); + + T visitMemberPaymentMethodsRead(); + + T visitMemberPaymentMethodsUse(); + + T visitMemberPaymentMethodsManage(); + + T visitMemberManage(); + + T visitMembershipCancel(); + + T visitMembershipResyncAccess(); + + T visitMembershipCreate(); + + T visitMembershipUpdate(); + + T visitMembershipTransfer(); + + T visitMemberModerate(); + + T visitMemberStatsExport(); + + T visitMemberStatsRead(); + + T visitMemberJourneyRead(); + + T visitPaymentBasicExport(); + + T visitPaymentBasicRead(); + + T visitPaymentCharge(); + + T visitPaymentDispute(); + + T visitPaymentDisputeExport(); + + T visitPaymentDisputeRead(); + + T visitPaymentDisputeAlertRead(); + + T visitPaymentSetupIntentRead(); + + T visitPaymentSetupIntentManage(); + + T visitPaymentManage(); + + T visitPaymentResolutionCenter(); + + T visitPaymentResolutionCenterCaseExport(); + + T visitPaymentResolutionCenterCaseRead(); + + T visitPaymentResolutionCenterCaseManage(); + + T visitPayoutCreateDestination(); + + T visitPayoutDeleteDestination(); + + T visitPayoutDestinationRead(); + + T visitPayoutTransferFunds(); + + T visitPayoutTransferRead(); + + T visitPayoutTransferExport(); + + T visitPayoutUpdateDestination(); + + T visitPayoutWithdrawFunds(); + + T visitPayoutWithdrawalRead(); + + T visitPayoutWithdrawalExport(); + + T visitPayoutAccountRead(); + + T visitPayoutAccountUpdate(); + + T visitPlanBasicExport(); + + T visitPlanBasicRead(); + + T visitPlanCreate(); + + T visitPlanDelete(); + + T visitPlanStatsExport(); + + T visitPlanStatsRead(); + + T visitPlanUpdate(); + + T visitPlanWaitlistManage(); + + T visitPlanWaitlistExport(); + + T visitPlanWaitlistRead(); + + T visitPromoCodeBasicExport(); + + T visitPromoCodeBasicRead(); + + T visitPromoCodeCreate(); + + T visitPromoCodeDelete(); + + T visitPromoCodeUpdate(); + + T visitReferralBasicRead(); + + T visitReferralPartnerCreate(); + + T visitPartnerBasicRead(); + + T visitPartnerInviteCreate(); + + T visitPartnerCreate(); + + T visitStatsRead(); + + T visitSupportChatRead(); + + T visitSupportChatCreate(); + + T visitSupportChatMessageCreate(); + + T visitTrackingLinkBasicExport(); + + T visitTrackingLinkBasicRead(); + + T visitTrackingLinkCreate(); + + T visitTrackingLinkDelete(); + + T visitTrackingLinkStatsExport(); + + T visitTrackingLinkStatsRead(); + + T visitTrackingLinkUpdate(); + + T visitCoursesRead(); + + T visitCoursesUpdate(); + + T visitCourseLessonInteractionRead(); + + T visitCourseAnalyticsRead(); + + T visitLeadBasicRead(); + + T visitLeadBasicExport(); + + T visitInvoiceCreate(); + + T visitInvoiceBasicRead(); + + T visitInvoiceBasicExport(); + + T visitInvoiceUpdate(); + + T visitWebhookReceiveInvoices(); + + T visitWebhookReceiveSetupIntents(); + + T visitWebhookReceiveWithdrawals(); + + T visitWebhookReceiveSwaps(); + + T visitWebhookReceiveLedgerAccounts(); + + T visitWebhookReceiveAccounts(); + + T visitWebhookReceiveDeposits(); + + T visitWebhookReceiveTransfers(); + + T visitWebhookReceiveCardTransactions(); + + T visitWebhookReceiveCards(); + + T visitWebhookReceiveCardApplications(); + + T visitWebhookReceivePayoutMethods(); + + T visitWebhookReceiveVerifications(); + + T visitWebhookReceiveIdentityProfiles(); + + T visitWebhookReceivePayoutAccounts(); + + T visitWebhookReceiveChat(); + + T visitWebhookReceiveEntries(); + + T visitWebhookReceiveAdCampaigns(); + + T visitWebhookReceiveProducts(); + + T visitWebhookReceivePlans(); + + T visitWebhookReceiveShipments(); + + T visitWebhookReceiveMembers(); + + T visitWebhookReceiveExports(); + + T visitWebhookReceiveCourses(); + + T visitWebhookReceiveMemberships(); + + T visitWebhookReceivePayments(); + + T visitWebhookReceiveRefunds(); + + T visitWebhookReceiveDisputes(); + + T visitWebhookReceiveResolutions(); + + T visitWebhookReceiveAppPayments(); + + T visitWebhookReceiveAppMemberships(); + + T visitShipmentCreate(); + + T visitShipmentBasicRead(); + + T visitCheckoutConfigurationBasicRead(); + + T visitCheckoutConfigurationCreate(); + + T visitCheckoutConfigurationDelete(); + + T visitCheckoutRequestCreate(); + + T visitCheckoutRequestBasicRead(); + + T visitCryptoWalletManage(); + + T visitCryptoWalletSwap(); + + T visitAirdropLinkBasicRead(); + + T visitAirdropLinkManage(); + + T visitLeadManage(); + + T visitNotificationCreate(); + + T visitUserBalanceRead(); + + T visitUserEmailRead(); + + T visitUserStaffRead(); + + T visitOauthTokenExchange(); + + T visitOpenid(); + + T visitProfile(); + + T visitEmail(); + + T visitAiChatRead(); + + T visitAiChatCreate(); + + T visitAiChatDelete(); + + T visitAiChatUpdate(); + + T visitUserNotificationsRead(); + + T visitUserNotificationsUpdate(); + + T visitUserProfileUpdate(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PermissionGrantedToSystemRolesItem.java b/src/main/java/com/whop/api/types/PermissionGrantedToSystemRolesItem.java new file mode 100644 index 00000000..35f53c14 --- /dev/null +++ b/src/main/java/com/whop/api/types/PermissionGrantedToSystemRolesItem.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PermissionGrantedToSystemRolesItem { + public static final PermissionGrantedToSystemRolesItem OWNER = + new PermissionGrantedToSystemRolesItem(Value.OWNER, "owner"); + + public static final PermissionGrantedToSystemRolesItem ADMIN = + new PermissionGrantedToSystemRolesItem(Value.ADMIN, "admin"); + + public static final PermissionGrantedToSystemRolesItem SALES_MANAGER = + new PermissionGrantedToSystemRolesItem(Value.SALES_MANAGER, "sales_manager"); + + public static final PermissionGrantedToSystemRolesItem MODERATOR = + new PermissionGrantedToSystemRolesItem(Value.MODERATOR, "moderator"); + + public static final PermissionGrantedToSystemRolesItem ADVERTISER = + new PermissionGrantedToSystemRolesItem(Value.ADVERTISER, "advertiser"); + + private final Value value; + + private final String string; + + PermissionGrantedToSystemRolesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PermissionGrantedToSystemRolesItem + && this.string.equals(((PermissionGrantedToSystemRolesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case OWNER: + return visitor.visitOwner(); + case ADMIN: + return visitor.visitAdmin(); + case SALES_MANAGER: + return visitor.visitSalesManager(); + case MODERATOR: + return visitor.visitModerator(); + case ADVERTISER: + return visitor.visitAdvertiser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PermissionGrantedToSystemRolesItem valueOf(String value) { + switch (value) { + case "owner": + return OWNER; + case "admin": + return ADMIN; + case "sales_manager": + return SALES_MANAGER; + case "moderator": + return MODERATOR; + case "advertiser": + return ADVERTISER; + default: + return new PermissionGrantedToSystemRolesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + OWNER, + + ADMIN, + + MODERATOR, + + SALES_MANAGER, + + ADVERTISER, + + UNKNOWN + } + + public interface Visitor { + T visitOwner(); + + T visitAdmin(); + + T visitModerator(); + + T visitSalesManager(); + + T visitAdvertiser(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PermissionSystemRoles.java b/src/main/java/com/whop/api/types/PermissionSystemRoles.java new file mode 100644 index 00000000..75193186 --- /dev/null +++ b/src/main/java/com/whop/api/types/PermissionSystemRoles.java @@ -0,0 +1,115 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PermissionSystemRoles { + public static final PermissionSystemRoles OWNER = new PermissionSystemRoles(Value.OWNER, "owner"); + + public static final PermissionSystemRoles ADMIN = new PermissionSystemRoles(Value.ADMIN, "admin"); + + public static final PermissionSystemRoles SALES_MANAGER = + new PermissionSystemRoles(Value.SALES_MANAGER, "sales_manager"); + + public static final PermissionSystemRoles MODERATOR = new PermissionSystemRoles(Value.MODERATOR, "moderator"); + + public static final PermissionSystemRoles ADVERTISER = new PermissionSystemRoles(Value.ADVERTISER, "advertiser"); + + private final Value value; + + private final String string; + + PermissionSystemRoles(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PermissionSystemRoles + && this.string.equals(((PermissionSystemRoles) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case OWNER: + return visitor.visitOwner(); + case ADMIN: + return visitor.visitAdmin(); + case SALES_MANAGER: + return visitor.visitSalesManager(); + case MODERATOR: + return visitor.visitModerator(); + case ADVERTISER: + return visitor.visitAdvertiser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PermissionSystemRoles valueOf(String value) { + switch (value) { + case "owner": + return OWNER; + case "admin": + return ADMIN; + case "sales_manager": + return SALES_MANAGER; + case "moderator": + return MODERATOR; + case "advertiser": + return ADVERTISER; + default: + return new PermissionSystemRoles(Value.UNKNOWN, value); + } + } + + public enum Value { + OWNER, + + ADMIN, + + MODERATOR, + + SALES_MANAGER, + + ADVERTISER, + + UNKNOWN + } + + public interface Visitor { + T visitOwner(); + + T visitAdmin(); + + T visitModerator(); + + T visitSalesManager(); + + T visitAdvertiser(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PixelValidation.java b/src/main/java/com/whop/api/types/PixelValidation.java new file mode 100644 index 00000000..73609027 --- /dev/null +++ b/src/main/java/com/whop/api/types/PixelValidation.java @@ -0,0 +1,583 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PixelValidation.Builder.class) +public final class PixelValidation { + private final boolean firingDataOk; + + private final List hostEvents; + + private final boolean installed; + + private final Map lastFiredDays; + + private final Optional lastSeenDays; + + private final boolean nativeTracking; + + private final List pageEvents; + + private final Optional reachable; + + private final Optional url; + + private final Map additionalProperties; + + private PixelValidation( + boolean firingDataOk, + List hostEvents, + boolean installed, + Map lastFiredDays, + Optional lastSeenDays, + boolean nativeTracking, + List pageEvents, + Optional reachable, + Optional url, + Map additionalProperties) { + this.firingDataOk = firingDataOk; + this.hostEvents = hostEvents; + this.installed = installed; + this.lastFiredDays = lastFiredDays; + this.lastSeenDays = lastSeenDays; + this.nativeTracking = nativeTracking; + this.pageEvents = pageEvents; + this.reachable = reachable; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return False when the event lookup failed, meaning host_events and last_seen_days are incomplete. + */ + @JsonProperty("firing_data_ok") + public boolean getFiringDataOk() { + return firingDataOk; + } + + @JsonProperty("host_events") + public List getHostEvents() { + return hostEvents; + } + + /** + * @return Whether the pixel was seen. Without a url this answers for the whole account: true when it has sent events recently. With a url it answers for THAT page only — true when the page is hosted on Whop, when the page itself has sent events recently, or when the pixel was found in its source. Events the account sent from other pages do not make a given url installed. + */ + @JsonProperty("installed") + public boolean getInstalled() { + return installed; + } + + /** + * @return Event name to whole days since that event last fired, e.g. { "lead": 3 }. Carries events that fired too long ago to count as installed, so you can prompt to re-check rather than report them missing. + */ + @JsonProperty("last_fired_days") + public Map getLastFiredDays() { + return lastFiredDays; + } + + /** + * @return Days since the pixel last sent an event, within a 30-day window. null when it hasn't sent one in that window — which includes a pixel installed moments ago. + */ + @JsonIgnore + public Optional getLastSeenDays() { + if (lastSeenDays == null) { + return Optional.empty(); + } + return lastSeenDays; + } + + /** + * @return True when url is hosted on Whop, so no pixel snippet is required. + */ + @JsonProperty("native_tracking") + public boolean getNativeTracking() { + return nativeTracking; + } + + @JsonProperty("page_events") + public List getPageEvents() { + return pageEvents; + } + + /** + * @return Whether the page could be loaded. null when the request included no URL, and true when events settled the answer without a fetch. + */ + @JsonIgnore + public Optional getReachable() { + if (reachable == null) { + return Optional.empty(); + } + return reachable; + } + + /** + * @return The URL that was checked, after normalization. null when the request didn't include one. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_seen_days") + private Optional _getLastSeenDays() { + return lastSeenDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reachable") + private Optional _getReachable() { + return reachable; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PixelValidation && equalTo((PixelValidation) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PixelValidation other) { + return firingDataOk == other.firingDataOk + && hostEvents.equals(other.hostEvents) + && installed == other.installed + && lastFiredDays.equals(other.lastFiredDays) + && lastSeenDays.equals(other.lastSeenDays) + && nativeTracking == other.nativeTracking + && pageEvents.equals(other.pageEvents) + && reachable.equals(other.reachable) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.firingDataOk, + this.hostEvents, + this.installed, + this.lastFiredDays, + this.lastSeenDays, + this.nativeTracking, + this.pageEvents, + this.reachable, + this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FiringDataOkStage builder() { + return new Builder(); + } + + public interface FiringDataOkStage { + /** + *

False when the event lookup failed, meaning host_events and last_seen_days are incomplete.

+ */ + InstalledStage firingDataOk(boolean firingDataOk); + + Builder from(PixelValidation other); + } + + public interface InstalledStage { + /** + *

Whether the pixel was seen. Without a url this answers for the whole account: true when it has sent events recently. With a url it answers for THAT page only — true when the page is hosted on Whop, when the page itself has sent events recently, or when the pixel was found in its source. Events the account sent from other pages do not make a given url installed.

+ */ + NativeTrackingStage installed(boolean installed); + } + + public interface NativeTrackingStage { + /** + *

True when url is hosted on Whop, so no pixel snippet is required.

+ */ + _FinalStage nativeTracking(boolean nativeTracking); + } + + public interface _FinalStage { + PixelValidation build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage hostEvents(List hostEvents); + + _FinalStage addHostEvents(String hostEvents); + + _FinalStage addAllHostEvents(List hostEvents); + + /** + *

Event name to whole days since that event last fired, e.g. { "lead": 3 }. Carries events that fired too long ago to count as installed, so you can prompt to re-check rather than report them missing.

+ */ + _FinalStage lastFiredDays(Map lastFiredDays); + + _FinalStage putAllLastFiredDays(Map lastFiredDays); + + _FinalStage lastFiredDays(String key, Object value); + + /** + *

Days since the pixel last sent an event, within a 30-day window. null when it hasn't sent one in that window — which includes a pixel installed moments ago.

+ */ + _FinalStage lastSeenDays(Optional lastSeenDays); + + _FinalStage lastSeenDays(Double lastSeenDays); + + _FinalStage lastSeenDays(Nullable lastSeenDays); + + _FinalStage pageEvents(List pageEvents); + + _FinalStage addPageEvents(String pageEvents); + + _FinalStage addAllPageEvents(List pageEvents); + + /** + *

Whether the page could be loaded. null when the request included no URL, and true when events settled the answer without a fetch.

+ */ + _FinalStage reachable(Optional reachable); + + _FinalStage reachable(Boolean reachable); + + _FinalStage reachable(Nullable reachable); + + /** + *

The URL that was checked, after normalization. null when the request didn't include one.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FiringDataOkStage, InstalledStage, NativeTrackingStage, _FinalStage { + private boolean firingDataOk; + + private boolean installed; + + private boolean nativeTracking; + + private Optional url = Optional.empty(); + + private Optional reachable = Optional.empty(); + + private List pageEvents = new ArrayList<>(); + + private Optional lastSeenDays = Optional.empty(); + + private Map lastFiredDays = new LinkedHashMap<>(); + + private List hostEvents = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PixelValidation other) { + firingDataOk(other.getFiringDataOk()); + hostEvents(other.getHostEvents()); + installed(other.getInstalled()); + lastFiredDays(other.getLastFiredDays()); + lastSeenDays(other.getLastSeenDays()); + nativeTracking(other.getNativeTracking()); + pageEvents(other.getPageEvents()); + reachable(other.getReachable()); + url(other.getUrl()); + return this; + } + + /** + *

False when the event lookup failed, meaning host_events and last_seen_days are incomplete.

+ *

False when the event lookup failed, meaning host_events and last_seen_days are incomplete.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("firing_data_ok") + public InstalledStage firingDataOk(boolean firingDataOk) { + this.firingDataOk = firingDataOk; + return this; + } + + /** + *

Whether the pixel was seen. Without a url this answers for the whole account: true when it has sent events recently. With a url it answers for THAT page only — true when the page is hosted on Whop, when the page itself has sent events recently, or when the pixel was found in its source. Events the account sent from other pages do not make a given url installed.

+ *

Whether the pixel was seen. Without a url this answers for the whole account: true when it has sent events recently. With a url it answers for THAT page only — true when the page is hosted on Whop, when the page itself has sent events recently, or when the pixel was found in its source. Events the account sent from other pages do not make a given url installed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("installed") + public NativeTrackingStage installed(boolean installed) { + this.installed = installed; + return this; + } + + /** + *

True when url is hosted on Whop, so no pixel snippet is required.

+ *

True when url is hosted on Whop, so no pixel snippet is required.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("native_tracking") + public _FinalStage nativeTracking(boolean nativeTracking) { + this.nativeTracking = nativeTracking; + return this; + } + + /** + *

The URL that was checked, after normalization. null when the request didn't include one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

The URL that was checked, after normalization. null when the request didn't include one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

The URL that was checked, after normalization. null when the request didn't include one.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

Whether the page could be loaded. null when the request included no URL, and true when events settled the answer without a fetch.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reachable(Nullable reachable) { + if (reachable.isNull()) { + this.reachable = null; + } else if (reachable.isEmpty()) { + this.reachable = Optional.empty(); + } else { + this.reachable = Optional.of(reachable.get()); + } + return this; + } + + /** + *

Whether the page could be loaded. null when the request included no URL, and true when events settled the answer without a fetch.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reachable(Boolean reachable) { + this.reachable = Optional.ofNullable(reachable); + return this; + } + + /** + *

Whether the page could be loaded. null when the request included no URL, and true when events settled the answer without a fetch.

+ */ + @java.lang.Override + @JsonSetter(value = "reachable", nulls = Nulls.SKIP) + public _FinalStage reachable(Optional reachable) { + this.reachable = reachable; + return this; + } + + @java.lang.Override + public _FinalStage addAllPageEvents(List pageEvents) { + if (pageEvents != null) { + this.pageEvents.addAll(pageEvents); + } + return this; + } + + @java.lang.Override + public _FinalStage addPageEvents(String pageEvents) { + this.pageEvents.add(pageEvents); + return this; + } + + @java.lang.Override + @JsonSetter(value = "page_events", nulls = Nulls.SKIP) + public _FinalStage pageEvents(List pageEvents) { + this.pageEvents.clear(); + if (pageEvents != null) { + this.pageEvents.addAll(pageEvents); + } + return this; + } + + /** + *

Days since the pixel last sent an event, within a 30-day window. null when it hasn't sent one in that window — which includes a pixel installed moments ago.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastSeenDays(Nullable lastSeenDays) { + if (lastSeenDays.isNull()) { + this.lastSeenDays = null; + } else if (lastSeenDays.isEmpty()) { + this.lastSeenDays = Optional.empty(); + } else { + this.lastSeenDays = Optional.of(lastSeenDays.get()); + } + return this; + } + + /** + *

Days since the pixel last sent an event, within a 30-day window. null when it hasn't sent one in that window — which includes a pixel installed moments ago.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastSeenDays(Double lastSeenDays) { + this.lastSeenDays = Optional.ofNullable(lastSeenDays); + return this; + } + + /** + *

Days since the pixel last sent an event, within a 30-day window. null when it hasn't sent one in that window — which includes a pixel installed moments ago.

+ */ + @java.lang.Override + @JsonSetter(value = "last_seen_days", nulls = Nulls.SKIP) + public _FinalStage lastSeenDays(Optional lastSeenDays) { + this.lastSeenDays = lastSeenDays; + return this; + } + + /** + *

Event name to whole days since that event last fired, e.g. { "lead": 3 }. Carries events that fired too long ago to count as installed, so you can prompt to re-check rather than report them missing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastFiredDays(String key, Object value) { + this.lastFiredDays.put(key, value); + return this; + } + + /** + *

Event name to whole days since that event last fired, e.g. { "lead": 3 }. Carries events that fired too long ago to count as installed, so you can prompt to re-check rather than report them missing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllLastFiredDays(Map lastFiredDays) { + if (lastFiredDays != null) { + this.lastFiredDays.putAll(lastFiredDays); + } + return this; + } + + /** + *

Event name to whole days since that event last fired, e.g. { "lead": 3 }. Carries events that fired too long ago to count as installed, so you can prompt to re-check rather than report them missing.

+ */ + @java.lang.Override + @JsonSetter(value = "last_fired_days", nulls = Nulls.SKIP) + public _FinalStage lastFiredDays(Map lastFiredDays) { + this.lastFiredDays.clear(); + if (lastFiredDays != null) { + this.lastFiredDays.putAll(lastFiredDays); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllHostEvents(List hostEvents) { + if (hostEvents != null) { + this.hostEvents.addAll(hostEvents); + } + return this; + } + + @java.lang.Override + public _FinalStage addHostEvents(String hostEvents) { + this.hostEvents.add(hostEvents); + return this; + } + + @java.lang.Override + @JsonSetter(value = "host_events", nulls = Nulls.SKIP) + public _FinalStage hostEvents(List hostEvents) { + this.hostEvents.clear(); + if (hostEvents != null) { + this.hostEvents.addAll(hostEvents); + } + return this; + } + + @java.lang.Override + public PixelValidation build() { + return new PixelValidation( + firingDataOk, + hostEvents, + installed, + lastFiredDays, + lastSeenDays, + nativeTracking, + pageEvents, + reachable, + url, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Plan.java b/src/main/java/com/whop/api/types/Plan.java new file mode 100644 index 00000000..6ea73ace --- /dev/null +++ b/src/main/java/com/whop/api/types/Plan.java @@ -0,0 +1,2455 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Plan.Builder.class) +public final class Plan { + private final Optional account; + + private final boolean adaptivePricingEnabled; + + private final Optional billingPeriod; + + private final Optional cancelDiscountIntervals; + + private final Optional cancelDiscountPercentage; + + private final Optional> checkoutStyling; + + private final boolean collectTax; + + private final String createdAt; + + private final PlanCurrency currency; + + private final List customFields; + + private final Optional deletable; + + private final Optional description; + + private final Optional effectivePaymentMethodConfiguration; + + private final Optional expirationDays; + + private final String formattedPrice; + + private final String id; + + private final Optional> image; + + private final double initialPrice; + + private final Optional internalNotes; + + private final Optional> invoice; + + private final Optional memberCount; + + private final Optional> metadata; + + private final Optional offerCancelDiscount; + + private final Optional> paymentMethodConfiguration; + + private final PlanPlanType planType; + + private final Optional> product; + + private final String purchaseUrl; + + private final PlanReleaseMethod releaseMethod; + + private final double renewalPrice; + + private final Optional splitPayRequiredPayments; + + private final Optional stock; + + private final Optional strikeThroughInitialPrice; + + private final Optional strikeThroughRenewalPrice; + + private final PlanTaxType taxType; + + private final Optional threeDsLevel; + + private final Optional title; + + private final Optional trialPeriodDays; + + private final boolean unlimitedStock; + + private final String updatedAt; + + private final PlanVisibility visibility; + + private final Map additionalProperties; + + private Plan( + Optional account, + boolean adaptivePricingEnabled, + Optional billingPeriod, + Optional cancelDiscountIntervals, + Optional cancelDiscountPercentage, + Optional> checkoutStyling, + boolean collectTax, + String createdAt, + PlanCurrency currency, + List customFields, + Optional deletable, + Optional description, + Optional effectivePaymentMethodConfiguration, + Optional expirationDays, + String formattedPrice, + String id, + Optional> image, + double initialPrice, + Optional internalNotes, + Optional> invoice, + Optional memberCount, + Optional> metadata, + Optional offerCancelDiscount, + Optional> paymentMethodConfiguration, + PlanPlanType planType, + Optional> product, + String purchaseUrl, + PlanReleaseMethod releaseMethod, + double renewalPrice, + Optional splitPayRequiredPayments, + Optional stock, + Optional strikeThroughInitialPrice, + Optional strikeThroughRenewalPrice, + PlanTaxType taxType, + Optional threeDsLevel, + Optional title, + Optional trialPeriodDays, + boolean unlimitedStock, + String updatedAt, + PlanVisibility visibility, + Map additionalProperties) { + this.account = account; + this.adaptivePricingEnabled = adaptivePricingEnabled; + this.billingPeriod = billingPeriod; + this.cancelDiscountIntervals = cancelDiscountIntervals; + this.cancelDiscountPercentage = cancelDiscountPercentage; + this.checkoutStyling = checkoutStyling; + this.collectTax = collectTax; + this.createdAt = createdAt; + this.currency = currency; + this.customFields = customFields; + this.deletable = deletable; + this.description = description; + this.effectivePaymentMethodConfiguration = effectivePaymentMethodConfiguration; + this.expirationDays = expirationDays; + this.formattedPrice = formattedPrice; + this.id = id; + this.image = image; + this.initialPrice = initialPrice; + this.internalNotes = internalNotes; + this.invoice = invoice; + this.memberCount = memberCount; + this.metadata = metadata; + this.offerCancelDiscount = offerCancelDiscount; + this.paymentMethodConfiguration = paymentMethodConfiguration; + this.planType = planType; + this.product = product; + this.purchaseUrl = purchaseUrl; + this.releaseMethod = releaseMethod; + this.renewalPrice = renewalPrice; + this.splitPayRequiredPayments = splitPayRequiredPayments; + this.stock = stock; + this.strikeThroughInitialPrice = strikeThroughInitialPrice; + this.strikeThroughRenewalPrice = strikeThroughRenewalPrice; + this.taxType = taxType; + this.threeDsLevel = threeDsLevel; + this.title = title; + this.trialPeriodDays = trialPeriodDays; + this.unlimitedStock = unlimitedStock; + this.updatedAt = updatedAt; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account that sells this plan; null for standalone invoice plans. + */ + @JsonIgnore + public Optional getAccount() { + if (account == null) { + return Optional.empty(); + } + return account; + } + + /** + * @return Whether adaptive pricing is enabled for this plan. Raw setting — does not check processor compatibility or feature flags. + */ + @JsonProperty("adaptive_pricing_enabled") + public boolean getAdaptivePricingEnabled() { + return adaptivePricingEnabled; + } + + /** + * @return Number of days between recurring charges, such as 30 for monthly or 365 for annual. null for one-time plans. + */ + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + /** + * @return Billing intervals the cancellation discount applies to (0 forever, 1 first payment, or a month count). null when none is offered or the actor lacks the plan:basic:read scope. + */ + @JsonIgnore + public Optional getCancelDiscountIntervals() { + if (cancelDiscountIntervals == null) { + return Optional.empty(); + } + return cancelDiscountIntervals; + } + + /** + * @return Cancellation discount as a whole-number percentage. null when none is offered or the actor lacks the plan:basic:read scope. + */ + @JsonIgnore + public Optional getCancelDiscountPercentage() { + if (cancelDiscountPercentage == null) { + return Optional.empty(); + } + return cancelDiscountPercentage; + } + + /** + * @return Plan-level checkout styling (background_color, button_color, font_family, border_style); null inherits the account default. + */ + @JsonIgnore + public Optional> getCheckoutStyling() { + if (checkoutStyling == null) { + return Optional.empty(); + } + return checkoutStyling; + } + + /** + * @return Whether tax is collected on purchases of this plan, based on the account's tax configuration. + */ + @JsonProperty("collect_tax") + public boolean getCollectTax() { + return collectTax; + } + + /** + * @return When the plan was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Three-letter ISO currency code for this plan's prices. + */ + @JsonProperty("currency") + public PlanCurrency getCurrency() { + return currency; + } + + @JsonProperty("custom_fields") + public List getCustomFields() { + return customFields; + } + + /** + * @return Whether the plan can be deleted (it has no memberships or waitlist entries). null unless the actor has the plan:basic:read scope on the plan's account. + */ + @JsonIgnore + public Optional getDeletable() { + if (deletable == null) { + return Optional.empty(); + } + return deletable; + } + + /** + * @return Customer-visible plan description. Maximum 1000 characters. null if no description is set. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The configuration governing a checkout for this plan, resolved through every layer (the plan's own and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays the plan's own editable override. + */ + @JsonIgnore + public Optional getEffectivePaymentMethodConfiguration() { + if (effectivePaymentMethodConfiguration == null) { + return Optional.empty(); + } + return effectivePaymentMethodConfiguration; + } + + /** + * @return Access duration in days for expiration-based plans, such as 365 for a one-year pass. null for plans without an expiration. + */ + @JsonIgnore + public Optional getExpirationDays() { + if (expirationDays == null) { + return Optional.empty(); + } + return expirationDays; + } + + /** + * @return Human-readable price for display (currency + interval), e.g. "$10 / month". + */ + @JsonProperty("formatted_price") + public String getFormattedPrice() { + return formattedPrice; + } + + /** + * @return Plan ID, prefixed plan_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Pricing-tier image (url, blurhash) shown on the product page; null when no image is set. + */ + @JsonIgnore + public Optional> getImage() { + if (image == null) { + return Optional.empty(); + } + return image; + } + + /** + * @return Initial purchase price in plan currency. + */ + @JsonProperty("initial_price") + public double getInitialPrice() { + return initialPrice; + } + + /** + * @return Private notes not shown to customers. null unless the actor has the plan:basic:read scope on the plan's account. + */ + @JsonIgnore + public Optional getInternalNotes() { + if (internalNotes == null) { + return Optional.empty(); + } + return internalNotes; + } + + /** + * @return Invoice this plan was generated for; null unless created for an invoice. + */ + @JsonIgnore + public Optional> getInvoice() { + if (invoice == null) { + return Optional.empty(); + } + return invoice; + } + + /** + * @return Active memberships through this plan. null unless the actor has the plan:basic:read scope on the plan's account. + */ + @JsonIgnore + public Optional getMemberCount() { + if (memberCount == null) { + return Optional.empty(); + } + return memberCount; + } + + /** + * @return Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Maximum 50 keys, 100 characters per key, 500 characters per value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Whether a cancellation discount is offered. null unless the actor has the plan:basic:read scope on the plan's account. + */ + @JsonIgnore + public Optional getOfferCancelDiscount() { + if (offerCancelDiscount == null) { + return Optional.empty(); + } + return offerCancelDiscount; + } + + /** + * @return Payment method configuration (enabled, disabled, include_platform_defaults); null when plan uses default settings. + */ + @JsonIgnore + public Optional> getPaymentMethodConfiguration() { + if (paymentMethodConfiguration == null) { + return Optional.empty(); + } + return paymentMethodConfiguration; + } + + /** + * @return Billing model for this plan. + */ + @JsonProperty("plan_type") + public PlanPlanType getPlanType() { + return planType; + } + + /** + * @return Product this plan belongs to; null for standalone plans. + */ + @JsonIgnore + public Optional> getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return URL where customers can purchase this plan directly. + */ + @JsonProperty("purchase_url") + public String getPurchaseUrl() { + return purchaseUrl; + } + + /** + * @return Sales method for this plan. + */ + @JsonProperty("release_method") + public PlanReleaseMethod getReleaseMethod() { + return releaseMethod; + } + + /** + * @return Recurring price charged every billing period. + */ + @JsonProperty("renewal_price") + public double getRenewalPrice() { + return renewalPrice; + } + + /** + * @return Installment payments required before the subscription pauses. Must be greater than 1. null if split pay is not configured. + */ + @JsonIgnore + public Optional getSplitPayRequiredPayments() { + if (splitPayRequiredPayments == null) { + return Optional.empty(); + } + return splitPayRequiredPayments; + } + + /** + * @return Units available for purchase. null unless the actor has the plan:basic:read scope on the plan's account. + */ + @JsonIgnore + public Optional getStock() { + if (stock == null) { + return Optional.empty(); + } + return stock; + } + + /** + * @return Original initial price shown with a strikethrough, in the plan's currency. null when no strikethrough is set. + */ + @JsonIgnore + public Optional getStrikeThroughInitialPrice() { + if (strikeThroughInitialPrice == null) { + return Optional.empty(); + } + return strikeThroughInitialPrice; + } + + /** + * @return Original renewal price shown with a strikethrough, in the plan's currency. null when no strikethrough is set. + */ + @JsonIgnore + public Optional getStrikeThroughRenewalPrice() { + if (strikeThroughRenewalPrice == null) { + return Optional.empty(); + } + return strikeThroughRenewalPrice; + } + + /** + * @return How tax is handled for this plan, including whether tax is included in the price, added at checkout, or not configured. + */ + @JsonProperty("tax_type") + public PlanTaxType getTaxType() { + return taxType; + } + + /** + * @return 3D Secure behavior for this plan; null inherits the account default. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return Plan display name shown to customers. Maximum 30 characters. null if no title has been set. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return Free trial days before the first renewal charge. null if no trial is configured or the user has already used a trial for this plan. + */ + @JsonIgnore + public Optional getTrialPeriodDays() { + if (trialPeriodDays == null) { + return Optional.empty(); + } + return trialPeriodDays; + } + + /** + * @return Whether the plan has unlimited stock. When true, the stock field is ignored; waitlist plans always report true. + */ + @JsonProperty("unlimited_stock") + public boolean getUnlimitedStock() { + return unlimitedStock; + } + + /** + * @return When the plan was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return Controls where this plan can be seen. When hidden, the plan is reachable only by its direct link. + */ + @JsonProperty("visibility") + public PlanVisibility getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account") + private Optional _getAccount() { + return account; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancel_discount_intervals") + private Optional _getCancelDiscountIntervals() { + return cancelDiscountIntervals; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancel_discount_percentage") + private Optional _getCancelDiscountPercentage() { + return cancelDiscountPercentage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_styling") + private Optional> _getCheckoutStyling() { + return checkoutStyling; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("deletable") + private Optional _getDeletable() { + return deletable; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("effective_payment_method_configuration") + private Optional _getEffectivePaymentMethodConfiguration() { + return effectivePaymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_days") + private Optional _getExpirationDays() { + return expirationDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("image") + private Optional> _getImage() { + return image; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("internal_notes") + private Optional _getInternalNotes() { + return internalNotes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("invoice") + private Optional> _getInvoice() { + return invoice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member_count") + private Optional _getMemberCount() { + return memberCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("offer_cancel_discount") + private Optional _getOfferCancelDiscount() { + return offerCancelDiscount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_configuration") + private Optional> _getPaymentMethodConfiguration() { + return paymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional> _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("split_pay_required_payments") + private Optional _getSplitPayRequiredPayments() { + return splitPayRequiredPayments; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("stock") + private Optional _getStock() { + return stock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("strike_through_initial_price") + private Optional _getStrikeThroughInitialPrice() { + return strikeThroughInitialPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("strike_through_renewal_price") + private Optional _getStrikeThroughRenewalPrice() { + return strikeThroughRenewalPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trial_period_days") + private Optional _getTrialPeriodDays() { + return trialPeriodDays; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Plan && equalTo((Plan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Plan other) { + return account.equals(other.account) + && adaptivePricingEnabled == other.adaptivePricingEnabled + && billingPeriod.equals(other.billingPeriod) + && cancelDiscountIntervals.equals(other.cancelDiscountIntervals) + && cancelDiscountPercentage.equals(other.cancelDiscountPercentage) + && checkoutStyling.equals(other.checkoutStyling) + && collectTax == other.collectTax + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && customFields.equals(other.customFields) + && deletable.equals(other.deletable) + && description.equals(other.description) + && effectivePaymentMethodConfiguration.equals(other.effectivePaymentMethodConfiguration) + && expirationDays.equals(other.expirationDays) + && formattedPrice.equals(other.formattedPrice) + && id.equals(other.id) + && image.equals(other.image) + && initialPrice == other.initialPrice + && internalNotes.equals(other.internalNotes) + && invoice.equals(other.invoice) + && memberCount.equals(other.memberCount) + && metadata.equals(other.metadata) + && offerCancelDiscount.equals(other.offerCancelDiscount) + && paymentMethodConfiguration.equals(other.paymentMethodConfiguration) + && planType.equals(other.planType) + && product.equals(other.product) + && purchaseUrl.equals(other.purchaseUrl) + && releaseMethod.equals(other.releaseMethod) + && renewalPrice == other.renewalPrice + && splitPayRequiredPayments.equals(other.splitPayRequiredPayments) + && stock.equals(other.stock) + && strikeThroughInitialPrice.equals(other.strikeThroughInitialPrice) + && strikeThroughRenewalPrice.equals(other.strikeThroughRenewalPrice) + && taxType.equals(other.taxType) + && threeDsLevel.equals(other.threeDsLevel) + && title.equals(other.title) + && trialPeriodDays.equals(other.trialPeriodDays) + && unlimitedStock == other.unlimitedStock + && updatedAt.equals(other.updatedAt) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.account, + this.adaptivePricingEnabled, + this.billingPeriod, + this.cancelDiscountIntervals, + this.cancelDiscountPercentage, + this.checkoutStyling, + this.collectTax, + this.createdAt, + this.currency, + this.customFields, + this.deletable, + this.description, + this.effectivePaymentMethodConfiguration, + this.expirationDays, + this.formattedPrice, + this.id, + this.image, + this.initialPrice, + this.internalNotes, + this.invoice, + this.memberCount, + this.metadata, + this.offerCancelDiscount, + this.paymentMethodConfiguration, + this.planType, + this.product, + this.purchaseUrl, + this.releaseMethod, + this.renewalPrice, + this.splitPayRequiredPayments, + this.stock, + this.strikeThroughInitialPrice, + this.strikeThroughRenewalPrice, + this.taxType, + this.threeDsLevel, + this.title, + this.trialPeriodDays, + this.unlimitedStock, + this.updatedAt, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdaptivePricingEnabledStage builder() { + return new Builder(); + } + + public interface AdaptivePricingEnabledStage { + /** + *

Whether adaptive pricing is enabled for this plan. Raw setting — does not check processor compatibility or feature flags.

+ */ + CollectTaxStage adaptivePricingEnabled(boolean adaptivePricingEnabled); + + Builder from(Plan other); + } + + public interface CollectTaxStage { + /** + *

Whether tax is collected on purchases of this plan, based on the account's tax configuration.

+ */ + CreatedAtStage collectTax(boolean collectTax); + } + + public interface CreatedAtStage { + /** + *

When the plan was created, as an ISO 8601 timestamp.

+ */ + CurrencyStage createdAt(@NotNull String createdAt); + } + + public interface CurrencyStage { + /** + *

Three-letter ISO currency code for this plan's prices.

+ */ + FormattedPriceStage currency(@NotNull PlanCurrency currency); + } + + public interface FormattedPriceStage { + /** + *

Human-readable price for display (currency + interval), e.g. "$10 / month".

+ */ + IdStage formattedPrice(@NotNull String formattedPrice); + } + + public interface IdStage { + /** + *

Plan ID, prefixed plan_.

+ */ + InitialPriceStage id(@NotNull String id); + } + + public interface InitialPriceStage { + /** + *

Initial purchase price in plan currency.

+ */ + PlanTypeStage initialPrice(double initialPrice); + } + + public interface PlanTypeStage { + /** + *

Billing model for this plan.

+ */ + PurchaseUrlStage planType(@NotNull PlanPlanType planType); + } + + public interface PurchaseUrlStage { + /** + *

URL where customers can purchase this plan directly.

+ */ + ReleaseMethodStage purchaseUrl(@NotNull String purchaseUrl); + } + + public interface ReleaseMethodStage { + /** + *

Sales method for this plan.

+ */ + RenewalPriceStage releaseMethod(@NotNull PlanReleaseMethod releaseMethod); + } + + public interface RenewalPriceStage { + /** + *

Recurring price charged every billing period.

+ */ + TaxTypeStage renewalPrice(double renewalPrice); + } + + public interface TaxTypeStage { + /** + *

How tax is handled for this plan, including whether tax is included in the price, added at checkout, or not configured.

+ */ + UnlimitedStockStage taxType(@NotNull PlanTaxType taxType); + } + + public interface UnlimitedStockStage { + /** + *

Whether the plan has unlimited stock. When true, the stock field is ignored; waitlist plans always report true.

+ */ + UpdatedAtStage unlimitedStock(boolean unlimitedStock); + } + + public interface UpdatedAtStage { + /** + *

When the plan was last updated, as an ISO 8601 timestamp.

+ */ + VisibilityStage updatedAt(@NotNull String updatedAt); + } + + public interface VisibilityStage { + /** + *

Controls where this plan can be seen. When hidden, the plan is reachable only by its direct link.

+ */ + _FinalStage visibility(@NotNull PlanVisibility visibility); + } + + public interface _FinalStage { + Plan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account that sells this plan; null for standalone invoice plans.

+ */ + _FinalStage account(Optional account); + + _FinalStage account(AccountSummary account); + + _FinalStage account(Nullable account); + + /** + *

Number of days between recurring charges, such as 30 for monthly or 365 for annual. null for one-time plans.

+ */ + _FinalStage billingPeriod(Optional billingPeriod); + + _FinalStage billingPeriod(Double billingPeriod); + + _FinalStage billingPeriod(Nullable billingPeriod); + + /** + *

Billing intervals the cancellation discount applies to (0 forever, 1 first payment, or a month count). null when none is offered or the actor lacks the plan:basic:read scope.

+ */ + _FinalStage cancelDiscountIntervals(Optional cancelDiscountIntervals); + + _FinalStage cancelDiscountIntervals(Double cancelDiscountIntervals); + + _FinalStage cancelDiscountIntervals(Nullable cancelDiscountIntervals); + + /** + *

Cancellation discount as a whole-number percentage. null when none is offered or the actor lacks the plan:basic:read scope.

+ */ + _FinalStage cancelDiscountPercentage(Optional cancelDiscountPercentage); + + _FinalStage cancelDiscountPercentage(Double cancelDiscountPercentage); + + _FinalStage cancelDiscountPercentage(Nullable cancelDiscountPercentage); + + /** + *

Plan-level checkout styling (background_color, button_color, font_family, border_style); null inherits the account default.

+ */ + _FinalStage checkoutStyling(Optional> checkoutStyling); + + _FinalStage checkoutStyling(Map checkoutStyling); + + _FinalStage checkoutStyling(Nullable> checkoutStyling); + + _FinalStage customFields(List customFields); + + _FinalStage addCustomFields(PlanCustomField customFields); + + _FinalStage addAllCustomFields(List customFields); + + /** + *

Whether the plan can be deleted (it has no memberships or waitlist entries). null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + _FinalStage deletable(Optional deletable); + + _FinalStage deletable(Boolean deletable); + + _FinalStage deletable(Nullable deletable); + + /** + *

Customer-visible plan description. Maximum 1000 characters. null if no description is set.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

The configuration governing a checkout for this plan, resolved through every layer (the plan's own and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays the plan's own editable override.

+ */ + _FinalStage effectivePaymentMethodConfiguration( + Optional effectivePaymentMethodConfiguration); + + _FinalStage effectivePaymentMethodConfiguration( + CheckoutSessionPaymentMethodConfiguration effectivePaymentMethodConfiguration); + + _FinalStage effectivePaymentMethodConfiguration( + Nullable effectivePaymentMethodConfiguration); + + /** + *

Access duration in days for expiration-based plans, such as 365 for a one-year pass. null for plans without an expiration.

+ */ + _FinalStage expirationDays(Optional expirationDays); + + _FinalStage expirationDays(Double expirationDays); + + _FinalStage expirationDays(Nullable expirationDays); + + /** + *

Pricing-tier image (url, blurhash) shown on the product page; null when no image is set.

+ */ + _FinalStage image(Optional> image); + + _FinalStage image(Map image); + + _FinalStage image(Nullable> image); + + /** + *

Private notes not shown to customers. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + _FinalStage internalNotes(Optional internalNotes); + + _FinalStage internalNotes(String internalNotes); + + _FinalStage internalNotes(Nullable internalNotes); + + /** + *

Invoice this plan was generated for; null unless created for an invoice.

+ */ + _FinalStage invoice(Optional> invoice); + + _FinalStage invoice(Map invoice); + + _FinalStage invoice(Nullable> invoice); + + /** + *

Active memberships through this plan. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + _FinalStage memberCount(Optional memberCount); + + _FinalStage memberCount(Double memberCount); + + _FinalStage memberCount(Nullable memberCount); + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Maximum 50 keys, 100 characters per key, 500 characters per value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Whether a cancellation discount is offered. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + _FinalStage offerCancelDiscount(Optional offerCancelDiscount); + + _FinalStage offerCancelDiscount(Boolean offerCancelDiscount); + + _FinalStage offerCancelDiscount(Nullable offerCancelDiscount); + + /** + *

Payment method configuration (enabled, disabled, include_platform_defaults); null when plan uses default settings.

+ */ + _FinalStage paymentMethodConfiguration(Optional> paymentMethodConfiguration); + + _FinalStage paymentMethodConfiguration(Map paymentMethodConfiguration); + + _FinalStage paymentMethodConfiguration(Nullable> paymentMethodConfiguration); + + /** + *

Product this plan belongs to; null for standalone plans.

+ */ + _FinalStage product(Optional> product); + + _FinalStage product(Map product); + + _FinalStage product(Nullable> product); + + /** + *

Installment payments required before the subscription pauses. Must be greater than 1. null if split pay is not configured.

+ */ + _FinalStage splitPayRequiredPayments(Optional splitPayRequiredPayments); + + _FinalStage splitPayRequiredPayments(Double splitPayRequiredPayments); + + _FinalStage splitPayRequiredPayments(Nullable splitPayRequiredPayments); + + /** + *

Units available for purchase. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + _FinalStage stock(Optional stock); + + _FinalStage stock(Double stock); + + _FinalStage stock(Nullable stock); + + /** + *

Original initial price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ */ + _FinalStage strikeThroughInitialPrice(Optional strikeThroughInitialPrice); + + _FinalStage strikeThroughInitialPrice(Double strikeThroughInitialPrice); + + _FinalStage strikeThroughInitialPrice(Nullable strikeThroughInitialPrice); + + /** + *

Original renewal price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ */ + _FinalStage strikeThroughRenewalPrice(Optional strikeThroughRenewalPrice); + + _FinalStage strikeThroughRenewalPrice(Double strikeThroughRenewalPrice); + + _FinalStage strikeThroughRenewalPrice(Nullable strikeThroughRenewalPrice); + + /** + *

3D Secure behavior for this plan; null inherits the account default.

+ */ + _FinalStage threeDsLevel(Optional threeDsLevel); + + _FinalStage threeDsLevel(PlanThreeDsLevel threeDsLevel); + + _FinalStage threeDsLevel(Nullable threeDsLevel); + + /** + *

Plan display name shown to customers. Maximum 30 characters. null if no title has been set.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + + /** + *

Free trial days before the first renewal charge. null if no trial is configured or the user has already used a trial for this plan.

+ */ + _FinalStage trialPeriodDays(Optional trialPeriodDays); + + _FinalStage trialPeriodDays(Double trialPeriodDays); + + _FinalStage trialPeriodDays(Nullable trialPeriodDays); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AdaptivePricingEnabledStage, + CollectTaxStage, + CreatedAtStage, + CurrencyStage, + FormattedPriceStage, + IdStage, + InitialPriceStage, + PlanTypeStage, + PurchaseUrlStage, + ReleaseMethodStage, + RenewalPriceStage, + TaxTypeStage, + UnlimitedStockStage, + UpdatedAtStage, + VisibilityStage, + _FinalStage { + private boolean adaptivePricingEnabled; + + private boolean collectTax; + + private String createdAt; + + private PlanCurrency currency; + + private String formattedPrice; + + private String id; + + private double initialPrice; + + private PlanPlanType planType; + + private String purchaseUrl; + + private PlanReleaseMethod releaseMethod; + + private double renewalPrice; + + private PlanTaxType taxType; + + private boolean unlimitedStock; + + private String updatedAt; + + private PlanVisibility visibility; + + private Optional trialPeriodDays = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional threeDsLevel = Optional.empty(); + + private Optional strikeThroughRenewalPrice = Optional.empty(); + + private Optional strikeThroughInitialPrice = Optional.empty(); + + private Optional stock = Optional.empty(); + + private Optional splitPayRequiredPayments = Optional.empty(); + + private Optional> product = Optional.empty(); + + private Optional> paymentMethodConfiguration = Optional.empty(); + + private Optional offerCancelDiscount = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional memberCount = Optional.empty(); + + private Optional> invoice = Optional.empty(); + + private Optional internalNotes = Optional.empty(); + + private Optional> image = Optional.empty(); + + private Optional expirationDays = Optional.empty(); + + private Optional effectivePaymentMethodConfiguration = + Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional deletable = Optional.empty(); + + private List customFields = new ArrayList<>(); + + private Optional> checkoutStyling = Optional.empty(); + + private Optional cancelDiscountPercentage = Optional.empty(); + + private Optional cancelDiscountIntervals = Optional.empty(); + + private Optional billingPeriod = Optional.empty(); + + private Optional account = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Plan other) { + account(other.getAccount()); + adaptivePricingEnabled(other.getAdaptivePricingEnabled()); + billingPeriod(other.getBillingPeriod()); + cancelDiscountIntervals(other.getCancelDiscountIntervals()); + cancelDiscountPercentage(other.getCancelDiscountPercentage()); + checkoutStyling(other.getCheckoutStyling()); + collectTax(other.getCollectTax()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + customFields(other.getCustomFields()); + deletable(other.getDeletable()); + description(other.getDescription()); + effectivePaymentMethodConfiguration(other.getEffectivePaymentMethodConfiguration()); + expirationDays(other.getExpirationDays()); + formattedPrice(other.getFormattedPrice()); + id(other.getId()); + image(other.getImage()); + initialPrice(other.getInitialPrice()); + internalNotes(other.getInternalNotes()); + invoice(other.getInvoice()); + memberCount(other.getMemberCount()); + metadata(other.getMetadata()); + offerCancelDiscount(other.getOfferCancelDiscount()); + paymentMethodConfiguration(other.getPaymentMethodConfiguration()); + planType(other.getPlanType()); + product(other.getProduct()); + purchaseUrl(other.getPurchaseUrl()); + releaseMethod(other.getReleaseMethod()); + renewalPrice(other.getRenewalPrice()); + splitPayRequiredPayments(other.getSplitPayRequiredPayments()); + stock(other.getStock()); + strikeThroughInitialPrice(other.getStrikeThroughInitialPrice()); + strikeThroughRenewalPrice(other.getStrikeThroughRenewalPrice()); + taxType(other.getTaxType()); + threeDsLevel(other.getThreeDsLevel()); + title(other.getTitle()); + trialPeriodDays(other.getTrialPeriodDays()); + unlimitedStock(other.getUnlimitedStock()); + updatedAt(other.getUpdatedAt()); + visibility(other.getVisibility()); + return this; + } + + /** + *

Whether adaptive pricing is enabled for this plan. Raw setting — does not check processor compatibility or feature flags.

+ *

Whether adaptive pricing is enabled for this plan. Raw setting — does not check processor compatibility or feature flags.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("adaptive_pricing_enabled") + public CollectTaxStage adaptivePricingEnabled(boolean adaptivePricingEnabled) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + return this; + } + + /** + *

Whether tax is collected on purchases of this plan, based on the account's tax configuration.

+ *

Whether tax is collected on purchases of this plan, based on the account's tax configuration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("collect_tax") + public CreatedAtStage collectTax(boolean collectTax) { + this.collectTax = collectTax; + return this; + } + + /** + *

When the plan was created, as an ISO 8601 timestamp.

+ *

When the plan was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Three-letter ISO currency code for this plan's prices.

+ *

Three-letter ISO currency code for this plan's prices.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public FormattedPriceStage currency(@NotNull PlanCurrency currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Human-readable price for display (currency + interval), e.g. "$10 / month".

+ *

Human-readable price for display (currency + interval), e.g. "$10 / month".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("formatted_price") + public IdStage formattedPrice(@NotNull String formattedPrice) { + this.formattedPrice = Objects.requireNonNull(formattedPrice, "formattedPrice must not be null"); + return this; + } + + /** + *

Plan ID, prefixed plan_.

+ *

Plan ID, prefixed plan_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public InitialPriceStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Initial purchase price in plan currency.

+ *

Initial purchase price in plan currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("initial_price") + public PlanTypeStage initialPrice(double initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + /** + *

Billing model for this plan.

+ *

Billing model for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan_type") + public PurchaseUrlStage planType(@NotNull PlanPlanType planType) { + this.planType = Objects.requireNonNull(planType, "planType must not be null"); + return this; + } + + /** + *

URL where customers can purchase this plan directly.

+ *

URL where customers can purchase this plan directly.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("purchase_url") + public ReleaseMethodStage purchaseUrl(@NotNull String purchaseUrl) { + this.purchaseUrl = Objects.requireNonNull(purchaseUrl, "purchaseUrl must not be null"); + return this; + } + + /** + *

Sales method for this plan.

+ *

Sales method for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("release_method") + public RenewalPriceStage releaseMethod(@NotNull PlanReleaseMethod releaseMethod) { + this.releaseMethod = Objects.requireNonNull(releaseMethod, "releaseMethod must not be null"); + return this; + } + + /** + *

Recurring price charged every billing period.

+ *

Recurring price charged every billing period.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("renewal_price") + public TaxTypeStage renewalPrice(double renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + /** + *

How tax is handled for this plan, including whether tax is included in the price, added at checkout, or not configured.

+ *

How tax is handled for this plan, including whether tax is included in the price, added at checkout, or not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tax_type") + public UnlimitedStockStage taxType(@NotNull PlanTaxType taxType) { + this.taxType = Objects.requireNonNull(taxType, "taxType must not be null"); + return this; + } + + /** + *

Whether the plan has unlimited stock. When true, the stock field is ignored; waitlist plans always report true.

+ *

Whether the plan has unlimited stock. When true, the stock field is ignored; waitlist plans always report true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("unlimited_stock") + public UpdatedAtStage unlimitedStock(boolean unlimitedStock) { + this.unlimitedStock = unlimitedStock; + return this; + } + + /** + *

When the plan was last updated, as an ISO 8601 timestamp.

+ *

When the plan was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public VisibilityStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

Controls where this plan can be seen. When hidden, the plan is reachable only by its direct link.

+ *

Controls where this plan can be seen. When hidden, the plan is reachable only by its direct link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("visibility") + public _FinalStage visibility(@NotNull PlanVisibility visibility) { + this.visibility = Objects.requireNonNull(visibility, "visibility must not be null"); + return this; + } + + /** + *

Free trial days before the first renewal charge. null if no trial is configured or the user has already used a trial for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Nullable trialPeriodDays) { + if (trialPeriodDays.isNull()) { + this.trialPeriodDays = null; + } else if (trialPeriodDays.isEmpty()) { + this.trialPeriodDays = Optional.empty(); + } else { + this.trialPeriodDays = Optional.of(trialPeriodDays.get()); + } + return this; + } + + /** + *

Free trial days before the first renewal charge. null if no trial is configured or the user has already used a trial for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Double trialPeriodDays) { + this.trialPeriodDays = Optional.ofNullable(trialPeriodDays); + return this; + } + + /** + *

Free trial days before the first renewal charge. null if no trial is configured or the user has already used a trial for this plan.

+ */ + @java.lang.Override + @JsonSetter(value = "trial_period_days", nulls = Nulls.SKIP) + public _FinalStage trialPeriodDays(Optional trialPeriodDays) { + this.trialPeriodDays = trialPeriodDays; + return this; + } + + /** + *

Plan display name shown to customers. Maximum 30 characters. null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Plan display name shown to customers. Maximum 30 characters. null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Plan display name shown to customers. Maximum 30 characters. null if no title has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

3D Secure behavior for this plan; null inherits the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

3D Secure behavior for this plan; null inherits the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(PlanThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + /** + *

3D Secure behavior for this plan; null inherits the account default.

+ */ + @java.lang.Override + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public _FinalStage threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + /** + *

Original renewal price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage strikeThroughRenewalPrice(Nullable strikeThroughRenewalPrice) { + if (strikeThroughRenewalPrice.isNull()) { + this.strikeThroughRenewalPrice = null; + } else if (strikeThroughRenewalPrice.isEmpty()) { + this.strikeThroughRenewalPrice = Optional.empty(); + } else { + this.strikeThroughRenewalPrice = Optional.of(strikeThroughRenewalPrice.get()); + } + return this; + } + + /** + *

Original renewal price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage strikeThroughRenewalPrice(Double strikeThroughRenewalPrice) { + this.strikeThroughRenewalPrice = Optional.ofNullable(strikeThroughRenewalPrice); + return this; + } + + /** + *

Original renewal price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ */ + @java.lang.Override + @JsonSetter(value = "strike_through_renewal_price", nulls = Nulls.SKIP) + public _FinalStage strikeThroughRenewalPrice(Optional strikeThroughRenewalPrice) { + this.strikeThroughRenewalPrice = strikeThroughRenewalPrice; + return this; + } + + /** + *

Original initial price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage strikeThroughInitialPrice(Nullable strikeThroughInitialPrice) { + if (strikeThroughInitialPrice.isNull()) { + this.strikeThroughInitialPrice = null; + } else if (strikeThroughInitialPrice.isEmpty()) { + this.strikeThroughInitialPrice = Optional.empty(); + } else { + this.strikeThroughInitialPrice = Optional.of(strikeThroughInitialPrice.get()); + } + return this; + } + + /** + *

Original initial price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage strikeThroughInitialPrice(Double strikeThroughInitialPrice) { + this.strikeThroughInitialPrice = Optional.ofNullable(strikeThroughInitialPrice); + return this; + } + + /** + *

Original initial price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ */ + @java.lang.Override + @JsonSetter(value = "strike_through_initial_price", nulls = Nulls.SKIP) + public _FinalStage strikeThroughInitialPrice(Optional strikeThroughInitialPrice) { + this.strikeThroughInitialPrice = strikeThroughInitialPrice; + return this; + } + + /** + *

Units available for purchase. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage stock(Nullable stock) { + if (stock.isNull()) { + this.stock = null; + } else if (stock.isEmpty()) { + this.stock = Optional.empty(); + } else { + this.stock = Optional.of(stock.get()); + } + return this; + } + + /** + *

Units available for purchase. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage stock(Double stock) { + this.stock = Optional.ofNullable(stock); + return this; + } + + /** + *

Units available for purchase. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + @java.lang.Override + @JsonSetter(value = "stock", nulls = Nulls.SKIP) + public _FinalStage stock(Optional stock) { + this.stock = stock; + return this; + } + + /** + *

Installment payments required before the subscription pauses. Must be greater than 1. null if split pay is not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage splitPayRequiredPayments(Nullable splitPayRequiredPayments) { + if (splitPayRequiredPayments.isNull()) { + this.splitPayRequiredPayments = null; + } else if (splitPayRequiredPayments.isEmpty()) { + this.splitPayRequiredPayments = Optional.empty(); + } else { + this.splitPayRequiredPayments = Optional.of(splitPayRequiredPayments.get()); + } + return this; + } + + /** + *

Installment payments required before the subscription pauses. Must be greater than 1. null if split pay is not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage splitPayRequiredPayments(Double splitPayRequiredPayments) { + this.splitPayRequiredPayments = Optional.ofNullable(splitPayRequiredPayments); + return this; + } + + /** + *

Installment payments required before the subscription pauses. Must be greater than 1. null if split pay is not configured.

+ */ + @java.lang.Override + @JsonSetter(value = "split_pay_required_payments", nulls = Nulls.SKIP) + public _FinalStage splitPayRequiredPayments(Optional splitPayRequiredPayments) { + this.splitPayRequiredPayments = splitPayRequiredPayments; + return this; + } + + /** + *

Product this plan belongs to; null for standalone plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable> product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

Product this plan belongs to; null for standalone plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Map product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

Product this plan belongs to; null for standalone plans.

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional> product) { + this.product = product; + return this; + } + + /** + *

Payment method configuration (enabled, disabled, include_platform_defaults); null when plan uses default settings.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodConfiguration(Nullable> paymentMethodConfiguration) { + if (paymentMethodConfiguration.isNull()) { + this.paymentMethodConfiguration = null; + } else if (paymentMethodConfiguration.isEmpty()) { + this.paymentMethodConfiguration = Optional.empty(); + } else { + this.paymentMethodConfiguration = Optional.of(paymentMethodConfiguration.get()); + } + return this; + } + + /** + *

Payment method configuration (enabled, disabled, include_platform_defaults); null when plan uses default settings.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodConfiguration(Map paymentMethodConfiguration) { + this.paymentMethodConfiguration = Optional.ofNullable(paymentMethodConfiguration); + return this; + } + + /** + *

Payment method configuration (enabled, disabled, include_platform_defaults); null when plan uses default settings.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_configuration", nulls = Nulls.SKIP) + public _FinalStage paymentMethodConfiguration(Optional> paymentMethodConfiguration) { + this.paymentMethodConfiguration = paymentMethodConfiguration; + return this; + } + + /** + *

Whether a cancellation discount is offered. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage offerCancelDiscount(Nullable offerCancelDiscount) { + if (offerCancelDiscount.isNull()) { + this.offerCancelDiscount = null; + } else if (offerCancelDiscount.isEmpty()) { + this.offerCancelDiscount = Optional.empty(); + } else { + this.offerCancelDiscount = Optional.of(offerCancelDiscount.get()); + } + return this; + } + + /** + *

Whether a cancellation discount is offered. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage offerCancelDiscount(Boolean offerCancelDiscount) { + this.offerCancelDiscount = Optional.ofNullable(offerCancelDiscount); + return this; + } + + /** + *

Whether a cancellation discount is offered. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + @java.lang.Override + @JsonSetter(value = "offer_cancel_discount", nulls = Nulls.SKIP) + public _FinalStage offerCancelDiscount(Optional offerCancelDiscount) { + this.offerCancelDiscount = offerCancelDiscount; + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Maximum 50 keys, 100 characters per key, 500 characters per value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Maximum 50 keys, 100 characters per key, 500 characters per value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Maximum 50 keys, 100 characters per key, 500 characters per value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Active memberships through this plan. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memberCount(Nullable memberCount) { + if (memberCount.isNull()) { + this.memberCount = null; + } else if (memberCount.isEmpty()) { + this.memberCount = Optional.empty(); + } else { + this.memberCount = Optional.of(memberCount.get()); + } + return this; + } + + /** + *

Active memberships through this plan. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memberCount(Double memberCount) { + this.memberCount = Optional.ofNullable(memberCount); + return this; + } + + /** + *

Active memberships through this plan. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + @java.lang.Override + @JsonSetter(value = "member_count", nulls = Nulls.SKIP) + public _FinalStage memberCount(Optional memberCount) { + this.memberCount = memberCount; + return this; + } + + /** + *

Invoice this plan was generated for; null unless created for an invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage invoice(Nullable> invoice) { + if (invoice.isNull()) { + this.invoice = null; + } else if (invoice.isEmpty()) { + this.invoice = Optional.empty(); + } else { + this.invoice = Optional.of(invoice.get()); + } + return this; + } + + /** + *

Invoice this plan was generated for; null unless created for an invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage invoice(Map invoice) { + this.invoice = Optional.ofNullable(invoice); + return this; + } + + /** + *

Invoice this plan was generated for; null unless created for an invoice.

+ */ + @java.lang.Override + @JsonSetter(value = "invoice", nulls = Nulls.SKIP) + public _FinalStage invoice(Optional> invoice) { + this.invoice = invoice; + return this; + } + + /** + *

Private notes not shown to customers. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage internalNotes(Nullable internalNotes) { + if (internalNotes.isNull()) { + this.internalNotes = null; + } else if (internalNotes.isEmpty()) { + this.internalNotes = Optional.empty(); + } else { + this.internalNotes = Optional.of(internalNotes.get()); + } + return this; + } + + /** + *

Private notes not shown to customers. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage internalNotes(String internalNotes) { + this.internalNotes = Optional.ofNullable(internalNotes); + return this; + } + + /** + *

Private notes not shown to customers. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + @java.lang.Override + @JsonSetter(value = "internal_notes", nulls = Nulls.SKIP) + public _FinalStage internalNotes(Optional internalNotes) { + this.internalNotes = internalNotes; + return this; + } + + /** + *

Pricing-tier image (url, blurhash) shown on the product page; null when no image is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage image(Nullable> image) { + if (image.isNull()) { + this.image = null; + } else if (image.isEmpty()) { + this.image = Optional.empty(); + } else { + this.image = Optional.of(image.get()); + } + return this; + } + + /** + *

Pricing-tier image (url, blurhash) shown on the product page; null when no image is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage image(Map image) { + this.image = Optional.ofNullable(image); + return this; + } + + /** + *

Pricing-tier image (url, blurhash) shown on the product page; null when no image is set.

+ */ + @java.lang.Override + @JsonSetter(value = "image", nulls = Nulls.SKIP) + public _FinalStage image(Optional> image) { + this.image = image; + return this; + } + + /** + *

Access duration in days for expiration-based plans, such as 365 for a one-year pass. null for plans without an expiration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Nullable expirationDays) { + if (expirationDays.isNull()) { + this.expirationDays = null; + } else if (expirationDays.isEmpty()) { + this.expirationDays = Optional.empty(); + } else { + this.expirationDays = Optional.of(expirationDays.get()); + } + return this; + } + + /** + *

Access duration in days for expiration-based plans, such as 365 for a one-year pass. null for plans without an expiration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Double expirationDays) { + this.expirationDays = Optional.ofNullable(expirationDays); + return this; + } + + /** + *

Access duration in days for expiration-based plans, such as 365 for a one-year pass. null for plans without an expiration.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_days", nulls = Nulls.SKIP) + public _FinalStage expirationDays(Optional expirationDays) { + this.expirationDays = expirationDays; + return this; + } + + /** + *

The configuration governing a checkout for this plan, resolved through every layer (the plan's own and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays the plan's own editable override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage effectivePaymentMethodConfiguration( + Nullable effectivePaymentMethodConfiguration) { + if (effectivePaymentMethodConfiguration.isNull()) { + this.effectivePaymentMethodConfiguration = null; + } else if (effectivePaymentMethodConfiguration.isEmpty()) { + this.effectivePaymentMethodConfiguration = Optional.empty(); + } else { + this.effectivePaymentMethodConfiguration = Optional.of(effectivePaymentMethodConfiguration.get()); + } + return this; + } + + /** + *

The configuration governing a checkout for this plan, resolved through every layer (the plan's own and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays the plan's own editable override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage effectivePaymentMethodConfiguration( + CheckoutSessionPaymentMethodConfiguration effectivePaymentMethodConfiguration) { + this.effectivePaymentMethodConfiguration = Optional.ofNullable(effectivePaymentMethodConfiguration); + return this; + } + + /** + *

The configuration governing a checkout for this plan, resolved through every layer (the plan's own and the account's) — the shape a session's payment_method_configuration carries. Apply it over the payment method types catalogue for the offerable set. null means platform defaults; payment_method_configuration stays the plan's own editable override.

+ */ + @java.lang.Override + @JsonSetter(value = "effective_payment_method_configuration", nulls = Nulls.SKIP) + public _FinalStage effectivePaymentMethodConfiguration( + Optional effectivePaymentMethodConfiguration) { + this.effectivePaymentMethodConfiguration = effectivePaymentMethodConfiguration; + return this; + } + + /** + *

Customer-visible plan description. Maximum 1000 characters. null if no description is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

Customer-visible plan description. Maximum 1000 characters. null if no description is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

Customer-visible plan description. Maximum 1000 characters. null if no description is set.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

Whether the plan can be deleted (it has no memberships or waitlist entries). null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage deletable(Nullable deletable) { + if (deletable.isNull()) { + this.deletable = null; + } else if (deletable.isEmpty()) { + this.deletable = Optional.empty(); + } else { + this.deletable = Optional.of(deletable.get()); + } + return this; + } + + /** + *

Whether the plan can be deleted (it has no memberships or waitlist entries). null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage deletable(Boolean deletable) { + this.deletable = Optional.ofNullable(deletable); + return this; + } + + /** + *

Whether the plan can be deleted (it has no memberships or waitlist entries). null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + @java.lang.Override + @JsonSetter(value = "deletable", nulls = Nulls.SKIP) + public _FinalStage deletable(Optional deletable) { + this.deletable = deletable; + return this; + } + + @java.lang.Override + public _FinalStage addAllCustomFields(List customFields) { + if (customFields != null) { + this.customFields.addAll(customFields); + } + return this; + } + + @java.lang.Override + public _FinalStage addCustomFields(PlanCustomField customFields) { + this.customFields.add(customFields); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_fields", nulls = Nulls.SKIP) + public _FinalStage customFields(List customFields) { + this.customFields.clear(); + if (customFields != null) { + this.customFields.addAll(customFields); + } + return this; + } + + /** + *

Plan-level checkout styling (background_color, button_color, font_family, border_style); null inherits the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutStyling(Nullable> checkoutStyling) { + if (checkoutStyling.isNull()) { + this.checkoutStyling = null; + } else if (checkoutStyling.isEmpty()) { + this.checkoutStyling = Optional.empty(); + } else { + this.checkoutStyling = Optional.of(checkoutStyling.get()); + } + return this; + } + + /** + *

Plan-level checkout styling (background_color, button_color, font_family, border_style); null inherits the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutStyling(Map checkoutStyling) { + this.checkoutStyling = Optional.ofNullable(checkoutStyling); + return this; + } + + /** + *

Plan-level checkout styling (background_color, button_color, font_family, border_style); null inherits the account default.

+ */ + @java.lang.Override + @JsonSetter(value = "checkout_styling", nulls = Nulls.SKIP) + public _FinalStage checkoutStyling(Optional> checkoutStyling) { + this.checkoutStyling = checkoutStyling; + return this; + } + + /** + *

Cancellation discount as a whole-number percentage. null when none is offered or the actor lacks the plan:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelDiscountPercentage(Nullable cancelDiscountPercentage) { + if (cancelDiscountPercentage.isNull()) { + this.cancelDiscountPercentage = null; + } else if (cancelDiscountPercentage.isEmpty()) { + this.cancelDiscountPercentage = Optional.empty(); + } else { + this.cancelDiscountPercentage = Optional.of(cancelDiscountPercentage.get()); + } + return this; + } + + /** + *

Cancellation discount as a whole-number percentage. null when none is offered or the actor lacks the plan:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelDiscountPercentage(Double cancelDiscountPercentage) { + this.cancelDiscountPercentage = Optional.ofNullable(cancelDiscountPercentage); + return this; + } + + /** + *

Cancellation discount as a whole-number percentage. null when none is offered or the actor lacks the plan:basic:read scope.

+ */ + @java.lang.Override + @JsonSetter(value = "cancel_discount_percentage", nulls = Nulls.SKIP) + public _FinalStage cancelDiscountPercentage(Optional cancelDiscountPercentage) { + this.cancelDiscountPercentage = cancelDiscountPercentage; + return this; + } + + /** + *

Billing intervals the cancellation discount applies to (0 forever, 1 first payment, or a month count). null when none is offered or the actor lacks the plan:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelDiscountIntervals(Nullable cancelDiscountIntervals) { + if (cancelDiscountIntervals.isNull()) { + this.cancelDiscountIntervals = null; + } else if (cancelDiscountIntervals.isEmpty()) { + this.cancelDiscountIntervals = Optional.empty(); + } else { + this.cancelDiscountIntervals = Optional.of(cancelDiscountIntervals.get()); + } + return this; + } + + /** + *

Billing intervals the cancellation discount applies to (0 forever, 1 first payment, or a month count). null when none is offered or the actor lacks the plan:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelDiscountIntervals(Double cancelDiscountIntervals) { + this.cancelDiscountIntervals = Optional.ofNullable(cancelDiscountIntervals); + return this; + } + + /** + *

Billing intervals the cancellation discount applies to (0 forever, 1 first payment, or a month count). null when none is offered or the actor lacks the plan:basic:read scope.

+ */ + @java.lang.Override + @JsonSetter(value = "cancel_discount_intervals", nulls = Nulls.SKIP) + public _FinalStage cancelDiscountIntervals(Optional cancelDiscountIntervals) { + this.cancelDiscountIntervals = cancelDiscountIntervals; + return this; + } + + /** + *

Number of days between recurring charges, such as 30 for monthly or 365 for annual. null for one-time plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + /** + *

Number of days between recurring charges, such as 30 for monthly or 365 for annual. null for one-time plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Double billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + /** + *

Number of days between recurring charges, such as 30 for monthly or 365 for annual. null for one-time plans.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public _FinalStage billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + /** + *

Account that sells this plan; null for standalone invoice plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(Nullable account) { + if (account.isNull()) { + this.account = null; + } else if (account.isEmpty()) { + this.account = Optional.empty(); + } else { + this.account = Optional.of(account.get()); + } + return this; + } + + /** + *

Account that sells this plan; null for standalone invoice plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(AccountSummary account) { + this.account = Optional.ofNullable(account); + return this; + } + + /** + *

Account that sells this plan; null for standalone invoice plans.

+ */ + @java.lang.Override + @JsonSetter(value = "account", nulls = Nulls.SKIP) + public _FinalStage account(Optional account) { + this.account = account; + return this; + } + + @java.lang.Override + public Plan build() { + return new Plan( + account, + adaptivePricingEnabled, + billingPeriod, + cancelDiscountIntervals, + cancelDiscountPercentage, + checkoutStyling, + collectTax, + createdAt, + currency, + customFields, + deletable, + description, + effectivePaymentMethodConfiguration, + expirationDays, + formattedPrice, + id, + image, + initialPrice, + internalNotes, + invoice, + memberCount, + metadata, + offerCancelDiscount, + paymentMethodConfiguration, + planType, + product, + purchaseUrl, + releaseMethod, + renewalPrice, + splitPayRequiredPayments, + stock, + strikeThroughInitialPrice, + strikeThroughRenewalPrice, + taxType, + threeDsLevel, + title, + trialPeriodDays, + unlimitedStock, + updatedAt, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PlanCurrency.java b/src/main/java/com/whop/api/types/PlanCurrency.java new file mode 100644 index 00000000..9c743322 --- /dev/null +++ b/src/main/java/com/whop/api/types/PlanCurrency.java @@ -0,0 +1,962 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanCurrency { + public static final PlanCurrency CRC = new PlanCurrency(Value.CRC, "crc"); + + public static final PlanCurrency OMR = new PlanCurrency(Value.OMR, "omr"); + + public static final PlanCurrency RUB = new PlanCurrency(Value.RUB, "rub"); + + public static final PlanCurrency BGN = new PlanCurrency(Value.BGN, "bgn"); + + public static final PlanCurrency SAR = new PlanCurrency(Value.SAR, "sar"); + + public static final PlanCurrency UYU = new PlanCurrency(Value.UYU, "uyu"); + + public static final PlanCurrency TZS = new PlanCurrency(Value.TZS, "tzs"); + + public static final PlanCurrency XCD = new PlanCurrency(Value.XCD, "xcd"); + + public static final PlanCurrency GTQ = new PlanCurrency(Value.GTQ, "gtq"); + + public static final PlanCurrency CHF = new PlanCurrency(Value.CHF, "chf"); + + public static final PlanCurrency RON = new PlanCurrency(Value.RON, "ron"); + + public static final PlanCurrency PHP = new PlanCurrency(Value.PHP, "php"); + + public static final PlanCurrency KES = new PlanCurrency(Value.KES, "kes"); + + public static final PlanCurrency XAU = new PlanCurrency(Value.XAU, "xau"); + + public static final PlanCurrency BSD = new PlanCurrency(Value.BSD, "bsd"); + + public static final PlanCurrency INR = new PlanCurrency(Value.INR, "inr"); + + public static final PlanCurrency HKD = new PlanCurrency(Value.HKD, "hkd"); + + public static final PlanCurrency JOD = new PlanCurrency(Value.JOD, "jod"); + + public static final PlanCurrency MKD = new PlanCurrency(Value.MKD, "mkd"); + + public static final PlanCurrency CLP = new PlanCurrency(Value.CLP, "clp"); + + public static final PlanCurrency NZD = new PlanCurrency(Value.NZD, "nzd"); + + public static final PlanCurrency IDR = new PlanCurrency(Value.IDR, "idr"); + + public static final PlanCurrency MOP = new PlanCurrency(Value.MOP, "mop"); + + public static final PlanCurrency HUF = new PlanCurrency(Value.HUF, "huf"); + + public static final PlanCurrency MAD = new PlanCurrency(Value.MAD, "mad"); + + public static final PlanCurrency KHR = new PlanCurrency(Value.KHR, "khr"); + + public static final PlanCurrency NGN = new PlanCurrency(Value.NGN, "ngn"); + + public static final PlanCurrency THB = new PlanCurrency(Value.THB, "thb"); + + public static final PlanCurrency DZD = new PlanCurrency(Value.DZD, "dzd"); + + public static final PlanCurrency ARS = new PlanCurrency(Value.ARS, "ars"); + + public static final PlanCurrency CAD = new PlanCurrency(Value.CAD, "cad"); + + public static final PlanCurrency MYR = new PlanCurrency(Value.MYR, "myr"); + + public static final PlanCurrency KRW = new PlanCurrency(Value.KRW, "krw"); + + public static final PlanCurrency KZT = new PlanCurrency(Value.KZT, "kzt"); + + public static final PlanCurrency ETH = new PlanCurrency(Value.ETH, "eth"); + + public static final PlanCurrency COP = new PlanCurrency(Value.COP, "cop"); + + public static final PlanCurrency JMD = new PlanCurrency(Value.JMD, "jmd"); + + public static final PlanCurrency NAD = new PlanCurrency(Value.NAD, "nad"); + + public static final PlanCurrency GYD = new PlanCurrency(Value.GYD, "gyd"); + + public static final PlanCurrency KWD = new PlanCurrency(Value.KWD, "kwd"); + + public static final PlanCurrency DOP = new PlanCurrency(Value.DOP, "dop"); + + public static final PlanCurrency BTC = new PlanCurrency(Value.BTC, "btc"); + + public static final PlanCurrency AMD = new PlanCurrency(Value.AMD, "amd"); + + public static final PlanCurrency LKR = new PlanCurrency(Value.LKR, "lkr"); + + public static final PlanCurrency ALL = new PlanCurrency(Value.ALL, "all"); + + public static final PlanCurrency USDT = new PlanCurrency(Value.USDT, "usdt"); + + public static final PlanCurrency TND = new PlanCurrency(Value.TND, "tnd"); + + public static final PlanCurrency MUR = new PlanCurrency(Value.MUR, "mur"); + + public static final PlanCurrency PEN = new PlanCurrency(Value.PEN, "pen"); + + public static final PlanCurrency USD = new PlanCurrency(Value.USD, "usd"); + + public static final PlanCurrency APE = new PlanCurrency(Value.APE, "ape"); + + public static final PlanCurrency BHD = new PlanCurrency(Value.BHD, "bhd"); + + public static final PlanCurrency XOF = new PlanCurrency(Value.XOF, "xof"); + + public static final PlanCurrency RWF = new PlanCurrency(Value.RWF, "rwf"); + + public static final PlanCurrency GBP = new PlanCurrency(Value.GBP, "gbp"); + + public static final PlanCurrency VND = new PlanCurrency(Value.VND, "vnd"); + + public static final PlanCurrency MNT = new PlanCurrency(Value.MNT, "mnt"); + + public static final PlanCurrency ETB = new PlanCurrency(Value.ETB, "etb"); + + public static final PlanCurrency TTD = new PlanCurrency(Value.TTD, "ttd"); + + public static final PlanCurrency EUR = new PlanCurrency(Value.EUR, "eur"); + + public static final PlanCurrency BRL = new PlanCurrency(Value.BRL, "brl"); + + public static final PlanCurrency SEK = new PlanCurrency(Value.SEK, "sek"); + + public static final PlanCurrency RSD = new PlanCurrency(Value.RSD, "rsd"); + + public static final PlanCurrency UZS = new PlanCurrency(Value.UZS, "uzs"); + + public static final PlanCurrency TWD = new PlanCurrency(Value.TWD, "twd"); + + public static final PlanCurrency NOK = new PlanCurrency(Value.NOK, "nok"); + + public static final PlanCurrency WHOP_USD = new PlanCurrency(Value.WHOP_USD, "whop_usd"); + + public static final PlanCurrency PYG = new PlanCurrency(Value.PYG, "pyg"); + + public static final PlanCurrency TRY = new PlanCurrency(Value.TRY, "try"); + + public static final PlanCurrency ZAR = new PlanCurrency(Value.ZAR, "zar"); + + public static final PlanCurrency PKR = new PlanCurrency(Value.PKR, "pkr"); + + public static final PlanCurrency CNY = new PlanCurrency(Value.CNY, "cny"); + + public static final PlanCurrency CZK = new PlanCurrency(Value.CZK, "czk"); + + public static final PlanCurrency ILS = new PlanCurrency(Value.ILS, "ils"); + + public static final PlanCurrency MGA = new PlanCurrency(Value.MGA, "mga"); + + public static final PlanCurrency AED = new PlanCurrency(Value.AED, "aed"); + + public static final PlanCurrency GHS = new PlanCurrency(Value.GHS, "ghs"); + + public static final PlanCurrency BAM = new PlanCurrency(Value.BAM, "bam"); + + public static final PlanCurrency JPY = new PlanCurrency(Value.JPY, "jpy"); + + public static final PlanCurrency PLN = new PlanCurrency(Value.PLN, "pln"); + + public static final PlanCurrency BOB = new PlanCurrency(Value.BOB, "bob"); + + public static final PlanCurrency QAR = new PlanCurrency(Value.QAR, "qar"); + + public static final PlanCurrency EGP = new PlanCurrency(Value.EGP, "egp"); + + public static final PlanCurrency AWG = new PlanCurrency(Value.AWG, "awg"); + + public static final PlanCurrency DKK = new PlanCurrency(Value.DKK, "dkk"); + + public static final PlanCurrency MDL = new PlanCurrency(Value.MDL, "mdl"); + + public static final PlanCurrency MXN = new PlanCurrency(Value.MXN, "mxn"); + + public static final PlanCurrency SGD = new PlanCurrency(Value.SGD, "sgd"); + + public static final PlanCurrency AUD = new PlanCurrency(Value.AUD, "aud"); + + public static final PlanCurrency GMD = new PlanCurrency(Value.GMD, "gmd"); + + private final Value value; + + private final String string; + + PlanCurrency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof PlanCurrency && this.string.equals(((PlanCurrency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CRC: + return visitor.visitCrc(); + case OMR: + return visitor.visitOmr(); + case RUB: + return visitor.visitRub(); + case BGN: + return visitor.visitBgn(); + case SAR: + return visitor.visitSar(); + case UYU: + return visitor.visitUyu(); + case TZS: + return visitor.visitTzs(); + case XCD: + return visitor.visitXcd(); + case GTQ: + return visitor.visitGtq(); + case CHF: + return visitor.visitChf(); + case RON: + return visitor.visitRon(); + case PHP: + return visitor.visitPhp(); + case KES: + return visitor.visitKes(); + case XAU: + return visitor.visitXau(); + case BSD: + return visitor.visitBsd(); + case INR: + return visitor.visitInr(); + case HKD: + return visitor.visitHkd(); + case JOD: + return visitor.visitJod(); + case MKD: + return visitor.visitMkd(); + case CLP: + return visitor.visitClp(); + case NZD: + return visitor.visitNzd(); + case IDR: + return visitor.visitIdr(); + case MOP: + return visitor.visitMop(); + case HUF: + return visitor.visitHuf(); + case MAD: + return visitor.visitMad(); + case KHR: + return visitor.visitKhr(); + case NGN: + return visitor.visitNgn(); + case THB: + return visitor.visitThb(); + case DZD: + return visitor.visitDzd(); + case ARS: + return visitor.visitArs(); + case CAD: + return visitor.visitCad(); + case MYR: + return visitor.visitMyr(); + case KRW: + return visitor.visitKrw(); + case KZT: + return visitor.visitKzt(); + case ETH: + return visitor.visitEth(); + case COP: + return visitor.visitCop(); + case JMD: + return visitor.visitJmd(); + case NAD: + return visitor.visitNad(); + case GYD: + return visitor.visitGyd(); + case KWD: + return visitor.visitKwd(); + case DOP: + return visitor.visitDop(); + case BTC: + return visitor.visitBtc(); + case AMD: + return visitor.visitAmd(); + case LKR: + return visitor.visitLkr(); + case ALL: + return visitor.visitAll(); + case USDT: + return visitor.visitUsdt(); + case TND: + return visitor.visitTnd(); + case MUR: + return visitor.visitMur(); + case PEN: + return visitor.visitPen(); + case USD: + return visitor.visitUsd(); + case APE: + return visitor.visitApe(); + case BHD: + return visitor.visitBhd(); + case XOF: + return visitor.visitXof(); + case RWF: + return visitor.visitRwf(); + case GBP: + return visitor.visitGbp(); + case VND: + return visitor.visitVnd(); + case MNT: + return visitor.visitMnt(); + case ETB: + return visitor.visitEtb(); + case TTD: + return visitor.visitTtd(); + case EUR: + return visitor.visitEur(); + case BRL: + return visitor.visitBrl(); + case SEK: + return visitor.visitSek(); + case RSD: + return visitor.visitRsd(); + case UZS: + return visitor.visitUzs(); + case TWD: + return visitor.visitTwd(); + case NOK: + return visitor.visitNok(); + case WHOP_USD: + return visitor.visitWhopUsd(); + case PYG: + return visitor.visitPyg(); + case TRY: + return visitor.visitTry(); + case ZAR: + return visitor.visitZar(); + case PKR: + return visitor.visitPkr(); + case CNY: + return visitor.visitCny(); + case CZK: + return visitor.visitCzk(); + case ILS: + return visitor.visitIls(); + case MGA: + return visitor.visitMga(); + case AED: + return visitor.visitAed(); + case GHS: + return visitor.visitGhs(); + case BAM: + return visitor.visitBam(); + case JPY: + return visitor.visitJpy(); + case PLN: + return visitor.visitPln(); + case BOB: + return visitor.visitBob(); + case QAR: + return visitor.visitQar(); + case EGP: + return visitor.visitEgp(); + case AWG: + return visitor.visitAwg(); + case DKK: + return visitor.visitDkk(); + case MDL: + return visitor.visitMdl(); + case MXN: + return visitor.visitMxn(); + case SGD: + return visitor.visitSgd(); + case AUD: + return visitor.visitAud(); + case GMD: + return visitor.visitGmd(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanCurrency valueOf(String value) { + switch (value) { + case "crc": + return CRC; + case "omr": + return OMR; + case "rub": + return RUB; + case "bgn": + return BGN; + case "sar": + return SAR; + case "uyu": + return UYU; + case "tzs": + return TZS; + case "xcd": + return XCD; + case "gtq": + return GTQ; + case "chf": + return CHF; + case "ron": + return RON; + case "php": + return PHP; + case "kes": + return KES; + case "xau": + return XAU; + case "bsd": + return BSD; + case "inr": + return INR; + case "hkd": + return HKD; + case "jod": + return JOD; + case "mkd": + return MKD; + case "clp": + return CLP; + case "nzd": + return NZD; + case "idr": + return IDR; + case "mop": + return MOP; + case "huf": + return HUF; + case "mad": + return MAD; + case "khr": + return KHR; + case "ngn": + return NGN; + case "thb": + return THB; + case "dzd": + return DZD; + case "ars": + return ARS; + case "cad": + return CAD; + case "myr": + return MYR; + case "krw": + return KRW; + case "kzt": + return KZT; + case "eth": + return ETH; + case "cop": + return COP; + case "jmd": + return JMD; + case "nad": + return NAD; + case "gyd": + return GYD; + case "kwd": + return KWD; + case "dop": + return DOP; + case "btc": + return BTC; + case "amd": + return AMD; + case "lkr": + return LKR; + case "all": + return ALL; + case "usdt": + return USDT; + case "tnd": + return TND; + case "mur": + return MUR; + case "pen": + return PEN; + case "usd": + return USD; + case "ape": + return APE; + case "bhd": + return BHD; + case "xof": + return XOF; + case "rwf": + return RWF; + case "gbp": + return GBP; + case "vnd": + return VND; + case "mnt": + return MNT; + case "etb": + return ETB; + case "ttd": + return TTD; + case "eur": + return EUR; + case "brl": + return BRL; + case "sek": + return SEK; + case "rsd": + return RSD; + case "uzs": + return UZS; + case "twd": + return TWD; + case "nok": + return NOK; + case "whop_usd": + return WHOP_USD; + case "pyg": + return PYG; + case "try": + return TRY; + case "zar": + return ZAR; + case "pkr": + return PKR; + case "cny": + return CNY; + case "czk": + return CZK; + case "ils": + return ILS; + case "mga": + return MGA; + case "aed": + return AED; + case "ghs": + return GHS; + case "bam": + return BAM; + case "jpy": + return JPY; + case "pln": + return PLN; + case "bob": + return BOB; + case "qar": + return QAR; + case "egp": + return EGP; + case "awg": + return AWG; + case "dkk": + return DKK; + case "mdl": + return MDL; + case "mxn": + return MXN; + case "sgd": + return SGD; + case "aud": + return AUD; + case "gmd": + return GMD; + default: + return new PlanCurrency(Value.UNKNOWN, value); + } + } + + public enum Value { + USD, + + SGD, + + INR, + + AUD, + + BRL, + + CAD, + + DKK, + + EUR, + + NOK, + + GBP, + + SEK, + + CHF, + + HKD, + + HUF, + + JPY, + + MXN, + + MYR, + + PLN, + + CZK, + + NZD, + + AED, + + ETH, + + APE, + + COP, + + RON, + + THB, + + BGN, + + IDR, + + DOP, + + PHP, + + TRY, + + KRW, + + TWD, + + VND, + + PKR, + + CLP, + + UYU, + + ARS, + + ZAR, + + DZD, + + TND, + + MAD, + + KES, + + KWD, + + JOD, + + ALL, + + XCD, + + AMD, + + BSD, + + BHD, + + BOB, + + BAM, + + KHR, + + CRC, + + XOF, + + EGP, + + ETB, + + GMD, + + GHS, + + GTQ, + + GYD, + + ILS, + + JMD, + + MOP, + + MGA, + + MUR, + + MDL, + + MNT, + + NAD, + + NGN, + + MKD, + + OMR, + + PYG, + + PEN, + + QAR, + + RWF, + + SAR, + + RSD, + + LKR, + + TZS, + + TTD, + + UZS, + + RUB, + + BTC, + + CNY, + + USDT, + + KZT, + + AWG, + + WHOP_USD, + + XAU, + + UNKNOWN + } + + public interface Visitor { + T visitUsd(); + + T visitSgd(); + + T visitInr(); + + T visitAud(); + + T visitBrl(); + + T visitCad(); + + T visitDkk(); + + T visitEur(); + + T visitNok(); + + T visitGbp(); + + T visitSek(); + + T visitChf(); + + T visitHkd(); + + T visitHuf(); + + T visitJpy(); + + T visitMxn(); + + T visitMyr(); + + T visitPln(); + + T visitCzk(); + + T visitNzd(); + + T visitAed(); + + T visitEth(); + + T visitApe(); + + T visitCop(); + + T visitRon(); + + T visitThb(); + + T visitBgn(); + + T visitIdr(); + + T visitDop(); + + T visitPhp(); + + T visitTry(); + + T visitKrw(); + + T visitTwd(); + + T visitVnd(); + + T visitPkr(); + + T visitClp(); + + T visitUyu(); + + T visitArs(); + + T visitZar(); + + T visitDzd(); + + T visitTnd(); + + T visitMad(); + + T visitKes(); + + T visitKwd(); + + T visitJod(); + + T visitAll(); + + T visitXcd(); + + T visitAmd(); + + T visitBsd(); + + T visitBhd(); + + T visitBob(); + + T visitBam(); + + T visitKhr(); + + T visitCrc(); + + T visitXof(); + + T visitEgp(); + + T visitEtb(); + + T visitGmd(); + + T visitGhs(); + + T visitGtq(); + + T visitGyd(); + + T visitIls(); + + T visitJmd(); + + T visitMop(); + + T visitMga(); + + T visitMur(); + + T visitMdl(); + + T visitMnt(); + + T visitNad(); + + T visitNgn(); + + T visitMkd(); + + T visitOmr(); + + T visitPyg(); + + T visitPen(); + + T visitQar(); + + T visitRwf(); + + T visitSar(); + + T visitRsd(); + + T visitLkr(); + + T visitTzs(); + + T visitTtd(); + + T visitUzs(); + + T visitRub(); + + T visitBtc(); + + T visitCny(); + + T visitUsdt(); + + T visitKzt(); + + T visitAwg(); + + T visitWhopUsd(); + + T visitXau(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PlanCustomField.java b/src/main/java/com/whop/api/types/PlanCustomField.java new file mode 100644 index 00000000..d305da07 --- /dev/null +++ b/src/main/java/com/whop/api/types/PlanCustomField.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PlanCustomField.Builder.class) +public final class PlanCustomField { + private final PlanCustomFieldFieldType fieldType; + + private final String id; + + private final String name; + + private final double order; + + private final Optional placeholder; + + private final boolean required; + + private final Map additionalProperties; + + private PlanCustomField( + PlanCustomFieldFieldType fieldType, + String id, + String name, + double order, + Optional placeholder, + boolean required, + Map additionalProperties) { + this.fieldType = fieldType; + this.id = id; + this.name = name; + this.order = order; + this.placeholder = placeholder; + this.required = required; + this.additionalProperties = additionalProperties; + } + + /** + * @return Custom field input type. + */ + @JsonProperty("field_type") + public PlanCustomFieldFieldType getFieldType() { + return fieldType; + } + + /** + * @return Custom field ID, prefixed field_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Field label shown to customer at checkout. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return Field position on checkout form. + */ + @JsonProperty("order") + public double getOrder() { + return order; + } + + /** + * @return Placeholder text shown in the empty field. null if none is set. + */ + @JsonIgnore + public Optional getPlaceholder() { + if (placeholder == null) { + return Optional.empty(); + } + return placeholder; + } + + /** + * @return Whether the customer must complete this field to check out. + */ + @JsonProperty("required") + public boolean getRequired() { + return required; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("placeholder") + private Optional _getPlaceholder() { + return placeholder; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanCustomField && equalTo((PlanCustomField) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlanCustomField other) { + return fieldType.equals(other.fieldType) + && id.equals(other.id) + && name.equals(other.name) + && order == other.order + && placeholder.equals(other.placeholder) + && required == other.required; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fieldType, this.id, this.name, this.order, this.placeholder, this.required); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FieldTypeStage builder() { + return new Builder(); + } + + public interface FieldTypeStage { + /** + *

Custom field input type.

+ */ + IdStage fieldType(@NotNull PlanCustomFieldFieldType fieldType); + + Builder from(PlanCustomField other); + } + + public interface IdStage { + /** + *

Custom field ID, prefixed field_.

+ */ + NameStage id(@NotNull String id); + } + + public interface NameStage { + /** + *

Field label shown to customer at checkout.

+ */ + OrderStage name(@NotNull String name); + } + + public interface OrderStage { + /** + *

Field position on checkout form.

+ */ + RequiredStage order(double order); + } + + public interface RequiredStage { + /** + *

Whether the customer must complete this field to check out.

+ */ + _FinalStage required(boolean required); + } + + public interface _FinalStage { + PlanCustomField build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Placeholder text shown in the empty field. null if none is set.

+ */ + _FinalStage placeholder(Optional placeholder); + + _FinalStage placeholder(String placeholder); + + _FinalStage placeholder(Nullable placeholder); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements FieldTypeStage, IdStage, NameStage, OrderStage, RequiredStage, _FinalStage { + private PlanCustomFieldFieldType fieldType; + + private String id; + + private String name; + + private double order; + + private boolean required; + + private Optional placeholder = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlanCustomField other) { + fieldType(other.getFieldType()); + id(other.getId()); + name(other.getName()); + order(other.getOrder()); + placeholder(other.getPlaceholder()); + required(other.getRequired()); + return this; + } + + /** + *

Custom field input type.

+ *

Custom field input type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("field_type") + public IdStage fieldType(@NotNull PlanCustomFieldFieldType fieldType) { + this.fieldType = Objects.requireNonNull(fieldType, "fieldType must not be null"); + return this; + } + + /** + *

Custom field ID, prefixed field_.

+ *

Custom field ID, prefixed field_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Field label shown to customer at checkout.

+ *

Field label shown to customer at checkout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public OrderStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

Field position on checkout form.

+ *

Field position on checkout form.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("order") + public RequiredStage order(double order) { + this.order = order; + return this; + } + + /** + *

Whether the customer must complete this field to check out.

+ *

Whether the customer must complete this field to check out.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("required") + public _FinalStage required(boolean required) { + this.required = required; + return this; + } + + /** + *

Placeholder text shown in the empty field. null if none is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage placeholder(Nullable placeholder) { + if (placeholder.isNull()) { + this.placeholder = null; + } else if (placeholder.isEmpty()) { + this.placeholder = Optional.empty(); + } else { + this.placeholder = Optional.of(placeholder.get()); + } + return this; + } + + /** + *

Placeholder text shown in the empty field. null if none is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage placeholder(String placeholder) { + this.placeholder = Optional.ofNullable(placeholder); + return this; + } + + /** + *

Placeholder text shown in the empty field. null if none is set.

+ */ + @java.lang.Override + @JsonSetter(value = "placeholder", nulls = Nulls.SKIP) + public _FinalStage placeholder(Optional placeholder) { + this.placeholder = placeholder; + return this; + } + + @java.lang.Override + public PlanCustomField build() { + return new PlanCustomField(fieldType, id, name, order, placeholder, required, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PlanCustomFieldFieldType.java b/src/main/java/com/whop/api/types/PlanCustomFieldFieldType.java new file mode 100644 index 00000000..630ad2cc --- /dev/null +++ b/src/main/java/com/whop/api/types/PlanCustomFieldFieldType.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanCustomFieldFieldType { + public static final PlanCustomFieldFieldType TEXT = new PlanCustomFieldFieldType(Value.TEXT, "text"); + + private final Value value; + + private final String string; + + PlanCustomFieldFieldType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PlanCustomFieldFieldType + && this.string.equals(((PlanCustomFieldFieldType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TEXT: + return visitor.visitText(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanCustomFieldFieldType valueOf(String value) { + switch (value) { + case "text": + return TEXT; + default: + return new PlanCustomFieldFieldType(Value.UNKNOWN, value); + } + } + + public enum Value { + TEXT, + + UNKNOWN + } + + public interface Visitor { + T visitText(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PlanListItem.java b/src/main/java/com/whop/api/types/PlanListItem.java new file mode 100644 index 00000000..dbfb0c71 --- /dev/null +++ b/src/main/java/com/whop/api/types/PlanListItem.java @@ -0,0 +1,2228 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PlanListItem.Builder.class) +public final class PlanListItem { + private final Optional account; + + private final boolean adaptivePricingEnabled; + + private final Optional billingPeriod; + + private final Optional cancelDiscountIntervals; + + private final Optional cancelDiscountPercentage; + + private final Optional> checkoutStyling; + + private final String createdAt; + + private final String currency; + + private final List customFields; + + private final Optional description; + + private final Optional expirationDays; + + private final String formattedPrice; + + private final String id; + + private final Optional> image; + + private final double initialPrice; + + private final Optional internalNotes; + + private final Optional> invoice; + + private final Optional memberCount; + + private final Optional> metadata; + + private final Optional offerCancelDiscount; + + private final Optional> paymentMethodConfiguration; + + private final PlanListItemPlanType planType; + + private final Optional> product; + + private final String purchaseUrl; + + private final PlanListItemReleaseMethod releaseMethod; + + private final double renewalPrice; + + private final Optional splitPayRequiredPayments; + + private final Optional stock; + + private final Optional strikeThroughInitialPrice; + + private final Optional strikeThroughRenewalPrice; + + private final Optional threeDsLevel; + + private final Optional title; + + private final Optional trialPeriodDays; + + private final boolean unlimitedStock; + + private final String updatedAt; + + private final PlanListItemVisibility visibility; + + private final Map additionalProperties; + + private PlanListItem( + Optional account, + boolean adaptivePricingEnabled, + Optional billingPeriod, + Optional cancelDiscountIntervals, + Optional cancelDiscountPercentage, + Optional> checkoutStyling, + String createdAt, + String currency, + List customFields, + Optional description, + Optional expirationDays, + String formattedPrice, + String id, + Optional> image, + double initialPrice, + Optional internalNotes, + Optional> invoice, + Optional memberCount, + Optional> metadata, + Optional offerCancelDiscount, + Optional> paymentMethodConfiguration, + PlanListItemPlanType planType, + Optional> product, + String purchaseUrl, + PlanListItemReleaseMethod releaseMethod, + double renewalPrice, + Optional splitPayRequiredPayments, + Optional stock, + Optional strikeThroughInitialPrice, + Optional strikeThroughRenewalPrice, + Optional threeDsLevel, + Optional title, + Optional trialPeriodDays, + boolean unlimitedStock, + String updatedAt, + PlanListItemVisibility visibility, + Map additionalProperties) { + this.account = account; + this.adaptivePricingEnabled = adaptivePricingEnabled; + this.billingPeriod = billingPeriod; + this.cancelDiscountIntervals = cancelDiscountIntervals; + this.cancelDiscountPercentage = cancelDiscountPercentage; + this.checkoutStyling = checkoutStyling; + this.createdAt = createdAt; + this.currency = currency; + this.customFields = customFields; + this.description = description; + this.expirationDays = expirationDays; + this.formattedPrice = formattedPrice; + this.id = id; + this.image = image; + this.initialPrice = initialPrice; + this.internalNotes = internalNotes; + this.invoice = invoice; + this.memberCount = memberCount; + this.metadata = metadata; + this.offerCancelDiscount = offerCancelDiscount; + this.paymentMethodConfiguration = paymentMethodConfiguration; + this.planType = planType; + this.product = product; + this.purchaseUrl = purchaseUrl; + this.releaseMethod = releaseMethod; + this.renewalPrice = renewalPrice; + this.splitPayRequiredPayments = splitPayRequiredPayments; + this.stock = stock; + this.strikeThroughInitialPrice = strikeThroughInitialPrice; + this.strikeThroughRenewalPrice = strikeThroughRenewalPrice; + this.threeDsLevel = threeDsLevel; + this.title = title; + this.trialPeriodDays = trialPeriodDays; + this.unlimitedStock = unlimitedStock; + this.updatedAt = updatedAt; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account that sells this plan; null for standalone invoice plans. + */ + @JsonIgnore + public Optional getAccount() { + if (account == null) { + return Optional.empty(); + } + return account; + } + + /** + * @return Whether adaptive pricing is enabled for this plan. Raw setting — does not check processor compatibility or feature flags. + */ + @JsonProperty("adaptive_pricing_enabled") + public boolean getAdaptivePricingEnabled() { + return adaptivePricingEnabled; + } + + /** + * @return Number of days between recurring charges, such as 30 for monthly or 365 for annual. null for one-time plans. + */ + @JsonIgnore + public Optional getBillingPeriod() { + if (billingPeriod == null) { + return Optional.empty(); + } + return billingPeriod; + } + + /** + * @return Billing intervals the cancellation discount applies to (0 forever, 1 first payment, or a month count). null when none is offered or the actor lacks the plan:basic:read scope. + */ + @JsonIgnore + public Optional getCancelDiscountIntervals() { + if (cancelDiscountIntervals == null) { + return Optional.empty(); + } + return cancelDiscountIntervals; + } + + /** + * @return Cancellation discount as a whole-number percentage. null when none is offered or the actor lacks the plan:basic:read scope. + */ + @JsonIgnore + public Optional getCancelDiscountPercentage() { + if (cancelDiscountPercentage == null) { + return Optional.empty(); + } + return cancelDiscountPercentage; + } + + /** + * @return Plan-level checkout styling (background_color, button_color, font_family, border_style); null inherits the account default. + */ + @JsonIgnore + public Optional> getCheckoutStyling() { + if (checkoutStyling == null) { + return Optional.empty(); + } + return checkoutStyling; + } + + /** + * @return When the plan was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Three-letter ISO currency code for this plan's prices. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("custom_fields") + public List getCustomFields() { + return customFields; + } + + /** + * @return Customer-visible plan description. Maximum 1000 characters. null if no description is set. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return Access duration in days for expiration-based plans, such as 365 for a one-year pass. null for plans without an expiration. + */ + @JsonIgnore + public Optional getExpirationDays() { + if (expirationDays == null) { + return Optional.empty(); + } + return expirationDays; + } + + /** + * @return Human-readable price for display (currency + interval), e.g. "$10 / month". + */ + @JsonProperty("formatted_price") + public String getFormattedPrice() { + return formattedPrice; + } + + /** + * @return Plan ID, prefixed plan_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Pricing-tier image (url, blurhash) shown on the product page; null when no image is set. + */ + @JsonIgnore + public Optional> getImage() { + if (image == null) { + return Optional.empty(); + } + return image; + } + + /** + * @return Initial purchase price in plan currency. + */ + @JsonProperty("initial_price") + public double getInitialPrice() { + return initialPrice; + } + + /** + * @return Private notes not shown to customers. null unless the actor has the plan:basic:read scope on the plan's account. + */ + @JsonIgnore + public Optional getInternalNotes() { + if (internalNotes == null) { + return Optional.empty(); + } + return internalNotes; + } + + /** + * @return Invoice this plan was generated for; null unless created for an invoice. + */ + @JsonIgnore + public Optional> getInvoice() { + if (invoice == null) { + return Optional.empty(); + } + return invoice; + } + + /** + * @return Active memberships through this plan. null unless the actor has the plan:basic:read scope on the plan's account. + */ + @JsonIgnore + public Optional getMemberCount() { + if (memberCount == null) { + return Optional.empty(); + } + return memberCount; + } + + /** + * @return Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Maximum 50 keys, 100 characters per key, 500 characters per value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Whether a cancellation discount is offered. null unless the actor has the plan:basic:read scope on the plan's account. + */ + @JsonIgnore + public Optional getOfferCancelDiscount() { + if (offerCancelDiscount == null) { + return Optional.empty(); + } + return offerCancelDiscount; + } + + /** + * @return Payment method configuration (enabled, disabled, include_platform_defaults); null when plan uses default settings. + */ + @JsonIgnore + public Optional> getPaymentMethodConfiguration() { + if (paymentMethodConfiguration == null) { + return Optional.empty(); + } + return paymentMethodConfiguration; + } + + /** + * @return Billing model for this plan. + */ + @JsonProperty("plan_type") + public PlanListItemPlanType getPlanType() { + return planType; + } + + /** + * @return Product this plan belongs to; null for standalone plans. + */ + @JsonIgnore + public Optional> getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return URL where customers can purchase this plan directly. + */ + @JsonProperty("purchase_url") + public String getPurchaseUrl() { + return purchaseUrl; + } + + /** + * @return Sales method for this plan. + */ + @JsonProperty("release_method") + public PlanListItemReleaseMethod getReleaseMethod() { + return releaseMethod; + } + + /** + * @return Recurring price charged every billing period. + */ + @JsonProperty("renewal_price") + public double getRenewalPrice() { + return renewalPrice; + } + + /** + * @return Installment payments required before the subscription pauses. Must be greater than 1. null if split pay is not configured. + */ + @JsonIgnore + public Optional getSplitPayRequiredPayments() { + if (splitPayRequiredPayments == null) { + return Optional.empty(); + } + return splitPayRequiredPayments; + } + + /** + * @return Units available for purchase. null unless the actor has the plan:basic:read scope on the plan's account. + */ + @JsonIgnore + public Optional getStock() { + if (stock == null) { + return Optional.empty(); + } + return stock; + } + + /** + * @return Original initial price shown with a strikethrough, in the plan's currency. null when no strikethrough is set. + */ + @JsonIgnore + public Optional getStrikeThroughInitialPrice() { + if (strikeThroughInitialPrice == null) { + return Optional.empty(); + } + return strikeThroughInitialPrice; + } + + /** + * @return Original renewal price shown with a strikethrough, in the plan's currency. null when no strikethrough is set. + */ + @JsonIgnore + public Optional getStrikeThroughRenewalPrice() { + if (strikeThroughRenewalPrice == null) { + return Optional.empty(); + } + return strikeThroughRenewalPrice; + } + + /** + * @return 3D Secure behavior for this plan; null inherits the account default. + */ + @JsonIgnore + public Optional getThreeDsLevel() { + if (threeDsLevel == null) { + return Optional.empty(); + } + return threeDsLevel; + } + + /** + * @return Plan display name shown to customers. Maximum 30 characters. null if no title has been set. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return Free trial days before the first renewal charge. null if no trial is configured or the user has already used a trial for this plan. + */ + @JsonIgnore + public Optional getTrialPeriodDays() { + if (trialPeriodDays == null) { + return Optional.empty(); + } + return trialPeriodDays; + } + + /** + * @return Whether the plan has unlimited stock. When true, the stock field is ignored; waitlist plans always report true. + */ + @JsonProperty("unlimited_stock") + public boolean getUnlimitedStock() { + return unlimitedStock; + } + + /** + * @return When the plan was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return Controls where this plan can be seen. When hidden, the plan is reachable only by its direct link. + */ + @JsonProperty("visibility") + public PlanListItemVisibility getVisibility() { + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account") + private Optional _getAccount() { + return account; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_period") + private Optional _getBillingPeriod() { + return billingPeriod; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancel_discount_intervals") + private Optional _getCancelDiscountIntervals() { + return cancelDiscountIntervals; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("cancel_discount_percentage") + private Optional _getCancelDiscountPercentage() { + return cancelDiscountPercentage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_styling") + private Optional> _getCheckoutStyling() { + return checkoutStyling; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expiration_days") + private Optional _getExpirationDays() { + return expirationDays; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("image") + private Optional> _getImage() { + return image; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("internal_notes") + private Optional _getInternalNotes() { + return internalNotes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("invoice") + private Optional> _getInvoice() { + return invoice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member_count") + private Optional _getMemberCount() { + return memberCount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("offer_cancel_discount") + private Optional _getOfferCancelDiscount() { + return offerCancelDiscount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_configuration") + private Optional> _getPaymentMethodConfiguration() { + return paymentMethodConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional> _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("split_pay_required_payments") + private Optional _getSplitPayRequiredPayments() { + return splitPayRequiredPayments; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("stock") + private Optional _getStock() { + return stock; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("strike_through_initial_price") + private Optional _getStrikeThroughInitialPrice() { + return strikeThroughInitialPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("strike_through_renewal_price") + private Optional _getStrikeThroughRenewalPrice() { + return strikeThroughRenewalPrice; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("three_ds_level") + private Optional _getThreeDsLevel() { + return threeDsLevel; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trial_period_days") + private Optional _getTrialPeriodDays() { + return trialPeriodDays; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanListItem && equalTo((PlanListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlanListItem other) { + return account.equals(other.account) + && adaptivePricingEnabled == other.adaptivePricingEnabled + && billingPeriod.equals(other.billingPeriod) + && cancelDiscountIntervals.equals(other.cancelDiscountIntervals) + && cancelDiscountPercentage.equals(other.cancelDiscountPercentage) + && checkoutStyling.equals(other.checkoutStyling) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && customFields.equals(other.customFields) + && description.equals(other.description) + && expirationDays.equals(other.expirationDays) + && formattedPrice.equals(other.formattedPrice) + && id.equals(other.id) + && image.equals(other.image) + && initialPrice == other.initialPrice + && internalNotes.equals(other.internalNotes) + && invoice.equals(other.invoice) + && memberCount.equals(other.memberCount) + && metadata.equals(other.metadata) + && offerCancelDiscount.equals(other.offerCancelDiscount) + && paymentMethodConfiguration.equals(other.paymentMethodConfiguration) + && planType.equals(other.planType) + && product.equals(other.product) + && purchaseUrl.equals(other.purchaseUrl) + && releaseMethod.equals(other.releaseMethod) + && renewalPrice == other.renewalPrice + && splitPayRequiredPayments.equals(other.splitPayRequiredPayments) + && stock.equals(other.stock) + && strikeThroughInitialPrice.equals(other.strikeThroughInitialPrice) + && strikeThroughRenewalPrice.equals(other.strikeThroughRenewalPrice) + && threeDsLevel.equals(other.threeDsLevel) + && title.equals(other.title) + && trialPeriodDays.equals(other.trialPeriodDays) + && unlimitedStock == other.unlimitedStock + && updatedAt.equals(other.updatedAt) + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.account, + this.adaptivePricingEnabled, + this.billingPeriod, + this.cancelDiscountIntervals, + this.cancelDiscountPercentage, + this.checkoutStyling, + this.createdAt, + this.currency, + this.customFields, + this.description, + this.expirationDays, + this.formattedPrice, + this.id, + this.image, + this.initialPrice, + this.internalNotes, + this.invoice, + this.memberCount, + this.metadata, + this.offerCancelDiscount, + this.paymentMethodConfiguration, + this.planType, + this.product, + this.purchaseUrl, + this.releaseMethod, + this.renewalPrice, + this.splitPayRequiredPayments, + this.stock, + this.strikeThroughInitialPrice, + this.strikeThroughRenewalPrice, + this.threeDsLevel, + this.title, + this.trialPeriodDays, + this.unlimitedStock, + this.updatedAt, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdaptivePricingEnabledStage builder() { + return new Builder(); + } + + public interface AdaptivePricingEnabledStage { + /** + *

Whether adaptive pricing is enabled for this plan. Raw setting — does not check processor compatibility or feature flags.

+ */ + CreatedAtStage adaptivePricingEnabled(boolean adaptivePricingEnabled); + + Builder from(PlanListItem other); + } + + public interface CreatedAtStage { + /** + *

When the plan was created, as an ISO 8601 timestamp.

+ */ + CurrencyStage createdAt(@NotNull String createdAt); + } + + public interface CurrencyStage { + /** + *

Three-letter ISO currency code for this plan's prices.

+ */ + FormattedPriceStage currency(@NotNull String currency); + } + + public interface FormattedPriceStage { + /** + *

Human-readable price for display (currency + interval), e.g. "$10 / month".

+ */ + IdStage formattedPrice(@NotNull String formattedPrice); + } + + public interface IdStage { + /** + *

Plan ID, prefixed plan_.

+ */ + InitialPriceStage id(@NotNull String id); + } + + public interface InitialPriceStage { + /** + *

Initial purchase price in plan currency.

+ */ + PlanTypeStage initialPrice(double initialPrice); + } + + public interface PlanTypeStage { + /** + *

Billing model for this plan.

+ */ + PurchaseUrlStage planType(@NotNull PlanListItemPlanType planType); + } + + public interface PurchaseUrlStage { + /** + *

URL where customers can purchase this plan directly.

+ */ + ReleaseMethodStage purchaseUrl(@NotNull String purchaseUrl); + } + + public interface ReleaseMethodStage { + /** + *

Sales method for this plan.

+ */ + RenewalPriceStage releaseMethod(@NotNull PlanListItemReleaseMethod releaseMethod); + } + + public interface RenewalPriceStage { + /** + *

Recurring price charged every billing period.

+ */ + UnlimitedStockStage renewalPrice(double renewalPrice); + } + + public interface UnlimitedStockStage { + /** + *

Whether the plan has unlimited stock. When true, the stock field is ignored; waitlist plans always report true.

+ */ + UpdatedAtStage unlimitedStock(boolean unlimitedStock); + } + + public interface UpdatedAtStage { + /** + *

When the plan was last updated, as an ISO 8601 timestamp.

+ */ + VisibilityStage updatedAt(@NotNull String updatedAt); + } + + public interface VisibilityStage { + /** + *

Controls where this plan can be seen. When hidden, the plan is reachable only by its direct link.

+ */ + _FinalStage visibility(@NotNull PlanListItemVisibility visibility); + } + + public interface _FinalStage { + PlanListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account that sells this plan; null for standalone invoice plans.

+ */ + _FinalStage account(Optional account); + + _FinalStage account(AccountSummary account); + + _FinalStage account(Nullable account); + + /** + *

Number of days between recurring charges, such as 30 for monthly or 365 for annual. null for one-time plans.

+ */ + _FinalStage billingPeriod(Optional billingPeriod); + + _FinalStage billingPeriod(Double billingPeriod); + + _FinalStage billingPeriod(Nullable billingPeriod); + + /** + *

Billing intervals the cancellation discount applies to (0 forever, 1 first payment, or a month count). null when none is offered or the actor lacks the plan:basic:read scope.

+ */ + _FinalStage cancelDiscountIntervals(Optional cancelDiscountIntervals); + + _FinalStage cancelDiscountIntervals(Double cancelDiscountIntervals); + + _FinalStage cancelDiscountIntervals(Nullable cancelDiscountIntervals); + + /** + *

Cancellation discount as a whole-number percentage. null when none is offered or the actor lacks the plan:basic:read scope.

+ */ + _FinalStage cancelDiscountPercentage(Optional cancelDiscountPercentage); + + _FinalStage cancelDiscountPercentage(Double cancelDiscountPercentage); + + _FinalStage cancelDiscountPercentage(Nullable cancelDiscountPercentage); + + /** + *

Plan-level checkout styling (background_color, button_color, font_family, border_style); null inherits the account default.

+ */ + _FinalStage checkoutStyling(Optional> checkoutStyling); + + _FinalStage checkoutStyling(Map checkoutStyling); + + _FinalStage checkoutStyling(Nullable> checkoutStyling); + + _FinalStage customFields(List customFields); + + _FinalStage addCustomFields(PlanCustomField customFields); + + _FinalStage addAllCustomFields(List customFields); + + /** + *

Customer-visible plan description. Maximum 1000 characters. null if no description is set.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

Access duration in days for expiration-based plans, such as 365 for a one-year pass. null for plans without an expiration.

+ */ + _FinalStage expirationDays(Optional expirationDays); + + _FinalStage expirationDays(Double expirationDays); + + _FinalStage expirationDays(Nullable expirationDays); + + /** + *

Pricing-tier image (url, blurhash) shown on the product page; null when no image is set.

+ */ + _FinalStage image(Optional> image); + + _FinalStage image(Map image); + + _FinalStage image(Nullable> image); + + /** + *

Private notes not shown to customers. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + _FinalStage internalNotes(Optional internalNotes); + + _FinalStage internalNotes(String internalNotes); + + _FinalStage internalNotes(Nullable internalNotes); + + /** + *

Invoice this plan was generated for; null unless created for an invoice.

+ */ + _FinalStage invoice(Optional> invoice); + + _FinalStage invoice(Map invoice); + + _FinalStage invoice(Nullable> invoice); + + /** + *

Active memberships through this plan. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + _FinalStage memberCount(Optional memberCount); + + _FinalStage memberCount(Double memberCount); + + _FinalStage memberCount(Nullable memberCount); + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Maximum 50 keys, 100 characters per key, 500 characters per value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Whether a cancellation discount is offered. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + _FinalStage offerCancelDiscount(Optional offerCancelDiscount); + + _FinalStage offerCancelDiscount(Boolean offerCancelDiscount); + + _FinalStage offerCancelDiscount(Nullable offerCancelDiscount); + + /** + *

Payment method configuration (enabled, disabled, include_platform_defaults); null when plan uses default settings.

+ */ + _FinalStage paymentMethodConfiguration(Optional> paymentMethodConfiguration); + + _FinalStage paymentMethodConfiguration(Map paymentMethodConfiguration); + + _FinalStage paymentMethodConfiguration(Nullable> paymentMethodConfiguration); + + /** + *

Product this plan belongs to; null for standalone plans.

+ */ + _FinalStage product(Optional> product); + + _FinalStage product(Map product); + + _FinalStage product(Nullable> product); + + /** + *

Installment payments required before the subscription pauses. Must be greater than 1. null if split pay is not configured.

+ */ + _FinalStage splitPayRequiredPayments(Optional splitPayRequiredPayments); + + _FinalStage splitPayRequiredPayments(Double splitPayRequiredPayments); + + _FinalStage splitPayRequiredPayments(Nullable splitPayRequiredPayments); + + /** + *

Units available for purchase. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + _FinalStage stock(Optional stock); + + _FinalStage stock(Double stock); + + _FinalStage stock(Nullable stock); + + /** + *

Original initial price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ */ + _FinalStage strikeThroughInitialPrice(Optional strikeThroughInitialPrice); + + _FinalStage strikeThroughInitialPrice(Double strikeThroughInitialPrice); + + _FinalStage strikeThroughInitialPrice(Nullable strikeThroughInitialPrice); + + /** + *

Original renewal price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ */ + _FinalStage strikeThroughRenewalPrice(Optional strikeThroughRenewalPrice); + + _FinalStage strikeThroughRenewalPrice(Double strikeThroughRenewalPrice); + + _FinalStage strikeThroughRenewalPrice(Nullable strikeThroughRenewalPrice); + + /** + *

3D Secure behavior for this plan; null inherits the account default.

+ */ + _FinalStage threeDsLevel(Optional threeDsLevel); + + _FinalStage threeDsLevel(PlanListItemThreeDsLevel threeDsLevel); + + _FinalStage threeDsLevel(Nullable threeDsLevel); + + /** + *

Plan display name shown to customers. Maximum 30 characters. null if no title has been set.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + + /** + *

Free trial days before the first renewal charge. null if no trial is configured or the user has already used a trial for this plan.

+ */ + _FinalStage trialPeriodDays(Optional trialPeriodDays); + + _FinalStage trialPeriodDays(Double trialPeriodDays); + + _FinalStage trialPeriodDays(Nullable trialPeriodDays); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AdaptivePricingEnabledStage, + CreatedAtStage, + CurrencyStage, + FormattedPriceStage, + IdStage, + InitialPriceStage, + PlanTypeStage, + PurchaseUrlStage, + ReleaseMethodStage, + RenewalPriceStage, + UnlimitedStockStage, + UpdatedAtStage, + VisibilityStage, + _FinalStage { + private boolean adaptivePricingEnabled; + + private String createdAt; + + private String currency; + + private String formattedPrice; + + private String id; + + private double initialPrice; + + private PlanListItemPlanType planType; + + private String purchaseUrl; + + private PlanListItemReleaseMethod releaseMethod; + + private double renewalPrice; + + private boolean unlimitedStock; + + private String updatedAt; + + private PlanListItemVisibility visibility; + + private Optional trialPeriodDays = Optional.empty(); + + private Optional title = Optional.empty(); + + private Optional threeDsLevel = Optional.empty(); + + private Optional strikeThroughRenewalPrice = Optional.empty(); + + private Optional strikeThroughInitialPrice = Optional.empty(); + + private Optional stock = Optional.empty(); + + private Optional splitPayRequiredPayments = Optional.empty(); + + private Optional> product = Optional.empty(); + + private Optional> paymentMethodConfiguration = Optional.empty(); + + private Optional offerCancelDiscount = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional memberCount = Optional.empty(); + + private Optional> invoice = Optional.empty(); + + private Optional internalNotes = Optional.empty(); + + private Optional> image = Optional.empty(); + + private Optional expirationDays = Optional.empty(); + + private Optional description = Optional.empty(); + + private List customFields = new ArrayList<>(); + + private Optional> checkoutStyling = Optional.empty(); + + private Optional cancelDiscountPercentage = Optional.empty(); + + private Optional cancelDiscountIntervals = Optional.empty(); + + private Optional billingPeriod = Optional.empty(); + + private Optional account = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlanListItem other) { + account(other.getAccount()); + adaptivePricingEnabled(other.getAdaptivePricingEnabled()); + billingPeriod(other.getBillingPeriod()); + cancelDiscountIntervals(other.getCancelDiscountIntervals()); + cancelDiscountPercentage(other.getCancelDiscountPercentage()); + checkoutStyling(other.getCheckoutStyling()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + customFields(other.getCustomFields()); + description(other.getDescription()); + expirationDays(other.getExpirationDays()); + formattedPrice(other.getFormattedPrice()); + id(other.getId()); + image(other.getImage()); + initialPrice(other.getInitialPrice()); + internalNotes(other.getInternalNotes()); + invoice(other.getInvoice()); + memberCount(other.getMemberCount()); + metadata(other.getMetadata()); + offerCancelDiscount(other.getOfferCancelDiscount()); + paymentMethodConfiguration(other.getPaymentMethodConfiguration()); + planType(other.getPlanType()); + product(other.getProduct()); + purchaseUrl(other.getPurchaseUrl()); + releaseMethod(other.getReleaseMethod()); + renewalPrice(other.getRenewalPrice()); + splitPayRequiredPayments(other.getSplitPayRequiredPayments()); + stock(other.getStock()); + strikeThroughInitialPrice(other.getStrikeThroughInitialPrice()); + strikeThroughRenewalPrice(other.getStrikeThroughRenewalPrice()); + threeDsLevel(other.getThreeDsLevel()); + title(other.getTitle()); + trialPeriodDays(other.getTrialPeriodDays()); + unlimitedStock(other.getUnlimitedStock()); + updatedAt(other.getUpdatedAt()); + visibility(other.getVisibility()); + return this; + } + + /** + *

Whether adaptive pricing is enabled for this plan. Raw setting — does not check processor compatibility or feature flags.

+ *

Whether adaptive pricing is enabled for this plan. Raw setting — does not check processor compatibility or feature flags.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("adaptive_pricing_enabled") + public CreatedAtStage adaptivePricingEnabled(boolean adaptivePricingEnabled) { + this.adaptivePricingEnabled = adaptivePricingEnabled; + return this; + } + + /** + *

When the plan was created, as an ISO 8601 timestamp.

+ *

When the plan was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Three-letter ISO currency code for this plan's prices.

+ *

Three-letter ISO currency code for this plan's prices.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public FormattedPriceStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Human-readable price for display (currency + interval), e.g. "$10 / month".

+ *

Human-readable price for display (currency + interval), e.g. "$10 / month".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("formatted_price") + public IdStage formattedPrice(@NotNull String formattedPrice) { + this.formattedPrice = Objects.requireNonNull(formattedPrice, "formattedPrice must not be null"); + return this; + } + + /** + *

Plan ID, prefixed plan_.

+ *

Plan ID, prefixed plan_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public InitialPriceStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Initial purchase price in plan currency.

+ *

Initial purchase price in plan currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("initial_price") + public PlanTypeStage initialPrice(double initialPrice) { + this.initialPrice = initialPrice; + return this; + } + + /** + *

Billing model for this plan.

+ *

Billing model for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan_type") + public PurchaseUrlStage planType(@NotNull PlanListItemPlanType planType) { + this.planType = Objects.requireNonNull(planType, "planType must not be null"); + return this; + } + + /** + *

URL where customers can purchase this plan directly.

+ *

URL where customers can purchase this plan directly.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("purchase_url") + public ReleaseMethodStage purchaseUrl(@NotNull String purchaseUrl) { + this.purchaseUrl = Objects.requireNonNull(purchaseUrl, "purchaseUrl must not be null"); + return this; + } + + /** + *

Sales method for this plan.

+ *

Sales method for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("release_method") + public RenewalPriceStage releaseMethod(@NotNull PlanListItemReleaseMethod releaseMethod) { + this.releaseMethod = Objects.requireNonNull(releaseMethod, "releaseMethod must not be null"); + return this; + } + + /** + *

Recurring price charged every billing period.

+ *

Recurring price charged every billing period.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("renewal_price") + public UnlimitedStockStage renewalPrice(double renewalPrice) { + this.renewalPrice = renewalPrice; + return this; + } + + /** + *

Whether the plan has unlimited stock. When true, the stock field is ignored; waitlist plans always report true.

+ *

Whether the plan has unlimited stock. When true, the stock field is ignored; waitlist plans always report true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("unlimited_stock") + public UpdatedAtStage unlimitedStock(boolean unlimitedStock) { + this.unlimitedStock = unlimitedStock; + return this; + } + + /** + *

When the plan was last updated, as an ISO 8601 timestamp.

+ *

When the plan was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public VisibilityStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

Controls where this plan can be seen. When hidden, the plan is reachable only by its direct link.

+ *

Controls where this plan can be seen. When hidden, the plan is reachable only by its direct link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("visibility") + public _FinalStage visibility(@NotNull PlanListItemVisibility visibility) { + this.visibility = Objects.requireNonNull(visibility, "visibility must not be null"); + return this; + } + + /** + *

Free trial days before the first renewal charge. null if no trial is configured or the user has already used a trial for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Nullable trialPeriodDays) { + if (trialPeriodDays.isNull()) { + this.trialPeriodDays = null; + } else if (trialPeriodDays.isEmpty()) { + this.trialPeriodDays = Optional.empty(); + } else { + this.trialPeriodDays = Optional.of(trialPeriodDays.get()); + } + return this; + } + + /** + *

Free trial days before the first renewal charge. null if no trial is configured or the user has already used a trial for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage trialPeriodDays(Double trialPeriodDays) { + this.trialPeriodDays = Optional.ofNullable(trialPeriodDays); + return this; + } + + /** + *

Free trial days before the first renewal charge. null if no trial is configured or the user has already used a trial for this plan.

+ */ + @java.lang.Override + @JsonSetter(value = "trial_period_days", nulls = Nulls.SKIP) + public _FinalStage trialPeriodDays(Optional trialPeriodDays) { + this.trialPeriodDays = trialPeriodDays; + return this; + } + + /** + *

Plan display name shown to customers. Maximum 30 characters. null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

Plan display name shown to customers. Maximum 30 characters. null if no title has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

Plan display name shown to customers. Maximum 30 characters. null if no title has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

3D Secure behavior for this plan; null inherits the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(Nullable threeDsLevel) { + if (threeDsLevel.isNull()) { + this.threeDsLevel = null; + } else if (threeDsLevel.isEmpty()) { + this.threeDsLevel = Optional.empty(); + } else { + this.threeDsLevel = Optional.of(threeDsLevel.get()); + } + return this; + } + + /** + *

3D Secure behavior for this plan; null inherits the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage threeDsLevel(PlanListItemThreeDsLevel threeDsLevel) { + this.threeDsLevel = Optional.ofNullable(threeDsLevel); + return this; + } + + /** + *

3D Secure behavior for this plan; null inherits the account default.

+ */ + @java.lang.Override + @JsonSetter(value = "three_ds_level", nulls = Nulls.SKIP) + public _FinalStage threeDsLevel(Optional threeDsLevel) { + this.threeDsLevel = threeDsLevel; + return this; + } + + /** + *

Original renewal price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage strikeThroughRenewalPrice(Nullable strikeThroughRenewalPrice) { + if (strikeThroughRenewalPrice.isNull()) { + this.strikeThroughRenewalPrice = null; + } else if (strikeThroughRenewalPrice.isEmpty()) { + this.strikeThroughRenewalPrice = Optional.empty(); + } else { + this.strikeThroughRenewalPrice = Optional.of(strikeThroughRenewalPrice.get()); + } + return this; + } + + /** + *

Original renewal price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage strikeThroughRenewalPrice(Double strikeThroughRenewalPrice) { + this.strikeThroughRenewalPrice = Optional.ofNullable(strikeThroughRenewalPrice); + return this; + } + + /** + *

Original renewal price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ */ + @java.lang.Override + @JsonSetter(value = "strike_through_renewal_price", nulls = Nulls.SKIP) + public _FinalStage strikeThroughRenewalPrice(Optional strikeThroughRenewalPrice) { + this.strikeThroughRenewalPrice = strikeThroughRenewalPrice; + return this; + } + + /** + *

Original initial price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage strikeThroughInitialPrice(Nullable strikeThroughInitialPrice) { + if (strikeThroughInitialPrice.isNull()) { + this.strikeThroughInitialPrice = null; + } else if (strikeThroughInitialPrice.isEmpty()) { + this.strikeThroughInitialPrice = Optional.empty(); + } else { + this.strikeThroughInitialPrice = Optional.of(strikeThroughInitialPrice.get()); + } + return this; + } + + /** + *

Original initial price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage strikeThroughInitialPrice(Double strikeThroughInitialPrice) { + this.strikeThroughInitialPrice = Optional.ofNullable(strikeThroughInitialPrice); + return this; + } + + /** + *

Original initial price shown with a strikethrough, in the plan's currency. null when no strikethrough is set.

+ */ + @java.lang.Override + @JsonSetter(value = "strike_through_initial_price", nulls = Nulls.SKIP) + public _FinalStage strikeThroughInitialPrice(Optional strikeThroughInitialPrice) { + this.strikeThroughInitialPrice = strikeThroughInitialPrice; + return this; + } + + /** + *

Units available for purchase. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage stock(Nullable stock) { + if (stock.isNull()) { + this.stock = null; + } else if (stock.isEmpty()) { + this.stock = Optional.empty(); + } else { + this.stock = Optional.of(stock.get()); + } + return this; + } + + /** + *

Units available for purchase. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage stock(Double stock) { + this.stock = Optional.ofNullable(stock); + return this; + } + + /** + *

Units available for purchase. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + @java.lang.Override + @JsonSetter(value = "stock", nulls = Nulls.SKIP) + public _FinalStage stock(Optional stock) { + this.stock = stock; + return this; + } + + /** + *

Installment payments required before the subscription pauses. Must be greater than 1. null if split pay is not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage splitPayRequiredPayments(Nullable splitPayRequiredPayments) { + if (splitPayRequiredPayments.isNull()) { + this.splitPayRequiredPayments = null; + } else if (splitPayRequiredPayments.isEmpty()) { + this.splitPayRequiredPayments = Optional.empty(); + } else { + this.splitPayRequiredPayments = Optional.of(splitPayRequiredPayments.get()); + } + return this; + } + + /** + *

Installment payments required before the subscription pauses. Must be greater than 1. null if split pay is not configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage splitPayRequiredPayments(Double splitPayRequiredPayments) { + this.splitPayRequiredPayments = Optional.ofNullable(splitPayRequiredPayments); + return this; + } + + /** + *

Installment payments required before the subscription pauses. Must be greater than 1. null if split pay is not configured.

+ */ + @java.lang.Override + @JsonSetter(value = "split_pay_required_payments", nulls = Nulls.SKIP) + public _FinalStage splitPayRequiredPayments(Optional splitPayRequiredPayments) { + this.splitPayRequiredPayments = splitPayRequiredPayments; + return this; + } + + /** + *

Product this plan belongs to; null for standalone plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable> product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

Product this plan belongs to; null for standalone plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Map product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

Product this plan belongs to; null for standalone plans.

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional> product) { + this.product = product; + return this; + } + + /** + *

Payment method configuration (enabled, disabled, include_platform_defaults); null when plan uses default settings.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodConfiguration(Nullable> paymentMethodConfiguration) { + if (paymentMethodConfiguration.isNull()) { + this.paymentMethodConfiguration = null; + } else if (paymentMethodConfiguration.isEmpty()) { + this.paymentMethodConfiguration = Optional.empty(); + } else { + this.paymentMethodConfiguration = Optional.of(paymentMethodConfiguration.get()); + } + return this; + } + + /** + *

Payment method configuration (enabled, disabled, include_platform_defaults); null when plan uses default settings.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodConfiguration(Map paymentMethodConfiguration) { + this.paymentMethodConfiguration = Optional.ofNullable(paymentMethodConfiguration); + return this; + } + + /** + *

Payment method configuration (enabled, disabled, include_platform_defaults); null when plan uses default settings.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_configuration", nulls = Nulls.SKIP) + public _FinalStage paymentMethodConfiguration(Optional> paymentMethodConfiguration) { + this.paymentMethodConfiguration = paymentMethodConfiguration; + return this; + } + + /** + *

Whether a cancellation discount is offered. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage offerCancelDiscount(Nullable offerCancelDiscount) { + if (offerCancelDiscount.isNull()) { + this.offerCancelDiscount = null; + } else if (offerCancelDiscount.isEmpty()) { + this.offerCancelDiscount = Optional.empty(); + } else { + this.offerCancelDiscount = Optional.of(offerCancelDiscount.get()); + } + return this; + } + + /** + *

Whether a cancellation discount is offered. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage offerCancelDiscount(Boolean offerCancelDiscount) { + this.offerCancelDiscount = Optional.ofNullable(offerCancelDiscount); + return this; + } + + /** + *

Whether a cancellation discount is offered. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + @java.lang.Override + @JsonSetter(value = "offer_cancel_discount", nulls = Nulls.SKIP) + public _FinalStage offerCancelDiscount(Optional offerCancelDiscount) { + this.offerCancelDiscount = offerCancelDiscount; + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Maximum 50 keys, 100 characters per key, 500 characters per value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Maximum 50 keys, 100 characters per key, 500 characters per value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Maximum 50 keys, 100 characters per key, 500 characters per value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Active memberships through this plan. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memberCount(Nullable memberCount) { + if (memberCount.isNull()) { + this.memberCount = null; + } else if (memberCount.isEmpty()) { + this.memberCount = Optional.empty(); + } else { + this.memberCount = Optional.of(memberCount.get()); + } + return this; + } + + /** + *

Active memberships through this plan. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memberCount(Double memberCount) { + this.memberCount = Optional.ofNullable(memberCount); + return this; + } + + /** + *

Active memberships through this plan. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + @java.lang.Override + @JsonSetter(value = "member_count", nulls = Nulls.SKIP) + public _FinalStage memberCount(Optional memberCount) { + this.memberCount = memberCount; + return this; + } + + /** + *

Invoice this plan was generated for; null unless created for an invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage invoice(Nullable> invoice) { + if (invoice.isNull()) { + this.invoice = null; + } else if (invoice.isEmpty()) { + this.invoice = Optional.empty(); + } else { + this.invoice = Optional.of(invoice.get()); + } + return this; + } + + /** + *

Invoice this plan was generated for; null unless created for an invoice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage invoice(Map invoice) { + this.invoice = Optional.ofNullable(invoice); + return this; + } + + /** + *

Invoice this plan was generated for; null unless created for an invoice.

+ */ + @java.lang.Override + @JsonSetter(value = "invoice", nulls = Nulls.SKIP) + public _FinalStage invoice(Optional> invoice) { + this.invoice = invoice; + return this; + } + + /** + *

Private notes not shown to customers. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage internalNotes(Nullable internalNotes) { + if (internalNotes.isNull()) { + this.internalNotes = null; + } else if (internalNotes.isEmpty()) { + this.internalNotes = Optional.empty(); + } else { + this.internalNotes = Optional.of(internalNotes.get()); + } + return this; + } + + /** + *

Private notes not shown to customers. null unless the actor has the plan:basic:read scope on the plan's account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage internalNotes(String internalNotes) { + this.internalNotes = Optional.ofNullable(internalNotes); + return this; + } + + /** + *

Private notes not shown to customers. null unless the actor has the plan:basic:read scope on the plan's account.

+ */ + @java.lang.Override + @JsonSetter(value = "internal_notes", nulls = Nulls.SKIP) + public _FinalStage internalNotes(Optional internalNotes) { + this.internalNotes = internalNotes; + return this; + } + + /** + *

Pricing-tier image (url, blurhash) shown on the product page; null when no image is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage image(Nullable> image) { + if (image.isNull()) { + this.image = null; + } else if (image.isEmpty()) { + this.image = Optional.empty(); + } else { + this.image = Optional.of(image.get()); + } + return this; + } + + /** + *

Pricing-tier image (url, blurhash) shown on the product page; null when no image is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage image(Map image) { + this.image = Optional.ofNullable(image); + return this; + } + + /** + *

Pricing-tier image (url, blurhash) shown on the product page; null when no image is set.

+ */ + @java.lang.Override + @JsonSetter(value = "image", nulls = Nulls.SKIP) + public _FinalStage image(Optional> image) { + this.image = image; + return this; + } + + /** + *

Access duration in days for expiration-based plans, such as 365 for a one-year pass. null for plans without an expiration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Nullable expirationDays) { + if (expirationDays.isNull()) { + this.expirationDays = null; + } else if (expirationDays.isEmpty()) { + this.expirationDays = Optional.empty(); + } else { + this.expirationDays = Optional.of(expirationDays.get()); + } + return this; + } + + /** + *

Access duration in days for expiration-based plans, such as 365 for a one-year pass. null for plans without an expiration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expirationDays(Double expirationDays) { + this.expirationDays = Optional.ofNullable(expirationDays); + return this; + } + + /** + *

Access duration in days for expiration-based plans, such as 365 for a one-year pass. null for plans without an expiration.

+ */ + @java.lang.Override + @JsonSetter(value = "expiration_days", nulls = Nulls.SKIP) + public _FinalStage expirationDays(Optional expirationDays) { + this.expirationDays = expirationDays; + return this; + } + + /** + *

Customer-visible plan description. Maximum 1000 characters. null if no description is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

Customer-visible plan description. Maximum 1000 characters. null if no description is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

Customer-visible plan description. Maximum 1000 characters. null if no description is set.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public _FinalStage addAllCustomFields(List customFields) { + if (customFields != null) { + this.customFields.addAll(customFields); + } + return this; + } + + @java.lang.Override + public _FinalStage addCustomFields(PlanCustomField customFields) { + this.customFields.add(customFields); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_fields", nulls = Nulls.SKIP) + public _FinalStage customFields(List customFields) { + this.customFields.clear(); + if (customFields != null) { + this.customFields.addAll(customFields); + } + return this; + } + + /** + *

Plan-level checkout styling (background_color, button_color, font_family, border_style); null inherits the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutStyling(Nullable> checkoutStyling) { + if (checkoutStyling.isNull()) { + this.checkoutStyling = null; + } else if (checkoutStyling.isEmpty()) { + this.checkoutStyling = Optional.empty(); + } else { + this.checkoutStyling = Optional.of(checkoutStyling.get()); + } + return this; + } + + /** + *

Plan-level checkout styling (background_color, button_color, font_family, border_style); null inherits the account default.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutStyling(Map checkoutStyling) { + this.checkoutStyling = Optional.ofNullable(checkoutStyling); + return this; + } + + /** + *

Plan-level checkout styling (background_color, button_color, font_family, border_style); null inherits the account default.

+ */ + @java.lang.Override + @JsonSetter(value = "checkout_styling", nulls = Nulls.SKIP) + public _FinalStage checkoutStyling(Optional> checkoutStyling) { + this.checkoutStyling = checkoutStyling; + return this; + } + + /** + *

Cancellation discount as a whole-number percentage. null when none is offered or the actor lacks the plan:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelDiscountPercentage(Nullable cancelDiscountPercentage) { + if (cancelDiscountPercentage.isNull()) { + this.cancelDiscountPercentage = null; + } else if (cancelDiscountPercentage.isEmpty()) { + this.cancelDiscountPercentage = Optional.empty(); + } else { + this.cancelDiscountPercentage = Optional.of(cancelDiscountPercentage.get()); + } + return this; + } + + /** + *

Cancellation discount as a whole-number percentage. null when none is offered or the actor lacks the plan:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelDiscountPercentage(Double cancelDiscountPercentage) { + this.cancelDiscountPercentage = Optional.ofNullable(cancelDiscountPercentage); + return this; + } + + /** + *

Cancellation discount as a whole-number percentage. null when none is offered or the actor lacks the plan:basic:read scope.

+ */ + @java.lang.Override + @JsonSetter(value = "cancel_discount_percentage", nulls = Nulls.SKIP) + public _FinalStage cancelDiscountPercentage(Optional cancelDiscountPercentage) { + this.cancelDiscountPercentage = cancelDiscountPercentage; + return this; + } + + /** + *

Billing intervals the cancellation discount applies to (0 forever, 1 first payment, or a month count). null when none is offered or the actor lacks the plan:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelDiscountIntervals(Nullable cancelDiscountIntervals) { + if (cancelDiscountIntervals.isNull()) { + this.cancelDiscountIntervals = null; + } else if (cancelDiscountIntervals.isEmpty()) { + this.cancelDiscountIntervals = Optional.empty(); + } else { + this.cancelDiscountIntervals = Optional.of(cancelDiscountIntervals.get()); + } + return this; + } + + /** + *

Billing intervals the cancellation discount applies to (0 forever, 1 first payment, or a month count). null when none is offered or the actor lacks the plan:basic:read scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cancelDiscountIntervals(Double cancelDiscountIntervals) { + this.cancelDiscountIntervals = Optional.ofNullable(cancelDiscountIntervals); + return this; + } + + /** + *

Billing intervals the cancellation discount applies to (0 forever, 1 first payment, or a month count). null when none is offered or the actor lacks the plan:basic:read scope.

+ */ + @java.lang.Override + @JsonSetter(value = "cancel_discount_intervals", nulls = Nulls.SKIP) + public _FinalStage cancelDiscountIntervals(Optional cancelDiscountIntervals) { + this.cancelDiscountIntervals = cancelDiscountIntervals; + return this; + } + + /** + *

Number of days between recurring charges, such as 30 for monthly or 365 for annual. null for one-time plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Nullable billingPeriod) { + if (billingPeriod.isNull()) { + this.billingPeriod = null; + } else if (billingPeriod.isEmpty()) { + this.billingPeriod = Optional.empty(); + } else { + this.billingPeriod = Optional.of(billingPeriod.get()); + } + return this; + } + + /** + *

Number of days between recurring charges, such as 30 for monthly or 365 for annual. null for one-time plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingPeriod(Double billingPeriod) { + this.billingPeriod = Optional.ofNullable(billingPeriod); + return this; + } + + /** + *

Number of days between recurring charges, such as 30 for monthly or 365 for annual. null for one-time plans.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_period", nulls = Nulls.SKIP) + public _FinalStage billingPeriod(Optional billingPeriod) { + this.billingPeriod = billingPeriod; + return this; + } + + /** + *

Account that sells this plan; null for standalone invoice plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(Nullable account) { + if (account.isNull()) { + this.account = null; + } else if (account.isEmpty()) { + this.account = Optional.empty(); + } else { + this.account = Optional.of(account.get()); + } + return this; + } + + /** + *

Account that sells this plan; null for standalone invoice plans.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(AccountSummary account) { + this.account = Optional.ofNullable(account); + return this; + } + + /** + *

Account that sells this plan; null for standalone invoice plans.

+ */ + @java.lang.Override + @JsonSetter(value = "account", nulls = Nulls.SKIP) + public _FinalStage account(Optional account) { + this.account = account; + return this; + } + + @java.lang.Override + public PlanListItem build() { + return new PlanListItem( + account, + adaptivePricingEnabled, + billingPeriod, + cancelDiscountIntervals, + cancelDiscountPercentage, + checkoutStyling, + createdAt, + currency, + customFields, + description, + expirationDays, + formattedPrice, + id, + image, + initialPrice, + internalNotes, + invoice, + memberCount, + metadata, + offerCancelDiscount, + paymentMethodConfiguration, + planType, + product, + purchaseUrl, + releaseMethod, + renewalPrice, + splitPayRequiredPayments, + stock, + strikeThroughInitialPrice, + strikeThroughRenewalPrice, + threeDsLevel, + title, + trialPeriodDays, + unlimitedStock, + updatedAt, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PlanListItemPlanType.java b/src/main/java/com/whop/api/types/PlanListItemPlanType.java new file mode 100644 index 00000000..5a27ba2e --- /dev/null +++ b/src/main/java/com/whop/api/types/PlanListItemPlanType.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanListItemPlanType { + public static final PlanListItemPlanType RENEWAL = new PlanListItemPlanType(Value.RENEWAL, "renewal"); + + public static final PlanListItemPlanType ONE_TIME = new PlanListItemPlanType(Value.ONE_TIME, "one_time"); + + private final Value value; + + private final String string; + + PlanListItemPlanType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PlanListItemPlanType && this.string.equals(((PlanListItemPlanType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RENEWAL: + return visitor.visitRenewal(); + case ONE_TIME: + return visitor.visitOneTime(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanListItemPlanType valueOf(String value) { + switch (value) { + case "renewal": + return RENEWAL; + case "one_time": + return ONE_TIME; + default: + return new PlanListItemPlanType(Value.UNKNOWN, value); + } + } + + public enum Value { + RENEWAL, + + ONE_TIME, + + UNKNOWN + } + + public interface Visitor { + T visitRenewal(); + + T visitOneTime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PlanListItemReleaseMethod.java b/src/main/java/com/whop/api/types/PlanListItemReleaseMethod.java new file mode 100644 index 00000000..5de06049 --- /dev/null +++ b/src/main/java/com/whop/api/types/PlanListItemReleaseMethod.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanListItemReleaseMethod { + public static final PlanListItemReleaseMethod WAITLIST = new PlanListItemReleaseMethod(Value.WAITLIST, "waitlist"); + + public static final PlanListItemReleaseMethod BUY_NOW = new PlanListItemReleaseMethod(Value.BUY_NOW, "buy_now"); + + private final Value value; + + private final String string; + + PlanListItemReleaseMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PlanListItemReleaseMethod + && this.string.equals(((PlanListItemReleaseMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WAITLIST: + return visitor.visitWaitlist(); + case BUY_NOW: + return visitor.visitBuyNow(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanListItemReleaseMethod valueOf(String value) { + switch (value) { + case "waitlist": + return WAITLIST; + case "buy_now": + return BUY_NOW; + default: + return new PlanListItemReleaseMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + BUY_NOW, + + WAITLIST, + + UNKNOWN + } + + public interface Visitor { + T visitBuyNow(); + + T visitWaitlist(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PlanListItemThreeDsLevel.java b/src/main/java/com/whop/api/types/PlanListItemThreeDsLevel.java new file mode 100644 index 00000000..af9403df --- /dev/null +++ b/src/main/java/com/whop/api/types/PlanListItemThreeDsLevel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanListItemThreeDsLevel { + public static final PlanListItemThreeDsLevel MANDATE_CHALLENGE = + new PlanListItemThreeDsLevel(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + public static final PlanListItemThreeDsLevel FRICTIONLESS = + new PlanListItemThreeDsLevel(Value.FRICTIONLESS, "frictionless"); + + private final Value value; + + private final String string; + + PlanListItemThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PlanListItemThreeDsLevel + && this.string.equals(((PlanListItemThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case FRICTIONLESS: + return visitor.visitFrictionless(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanListItemThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + case "frictionless": + return FRICTIONLESS; + default: + return new PlanListItemThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + FRICTIONLESS, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitFrictionless(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PlanListItemVisibility.java b/src/main/java/com/whop/api/types/PlanListItemVisibility.java new file mode 100644 index 00000000..763f6af4 --- /dev/null +++ b/src/main/java/com/whop/api/types/PlanListItemVisibility.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanListItemVisibility { + public static final PlanListItemVisibility VISIBLE = new PlanListItemVisibility(Value.VISIBLE, "visible"); + + public static final PlanListItemVisibility HIDDEN = new PlanListItemVisibility(Value.HIDDEN, "hidden"); + + public static final PlanListItemVisibility QUICK_LINK = new PlanListItemVisibility(Value.QUICK_LINK, "quick_link"); + + public static final PlanListItemVisibility ARCHIVED = new PlanListItemVisibility(Value.ARCHIVED, "archived"); + + private final Value value; + + private final String string; + + PlanListItemVisibility(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PlanListItemVisibility + && this.string.equals(((PlanListItemVisibility) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VISIBLE: + return visitor.visitVisible(); + case HIDDEN: + return visitor.visitHidden(); + case QUICK_LINK: + return visitor.visitQuickLink(); + case ARCHIVED: + return visitor.visitArchived(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanListItemVisibility valueOf(String value) { + switch (value) { + case "visible": + return VISIBLE; + case "hidden": + return HIDDEN; + case "quick_link": + return QUICK_LINK; + case "archived": + return ARCHIVED; + default: + return new PlanListItemVisibility(Value.UNKNOWN, value); + } + } + + public enum Value { + VISIBLE, + + HIDDEN, + + ARCHIVED, + + QUICK_LINK, + + UNKNOWN + } + + public interface Visitor { + T visitVisible(); + + T visitHidden(); + + T visitArchived(); + + T visitQuickLink(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PlanPlanType.java b/src/main/java/com/whop/api/types/PlanPlanType.java new file mode 100644 index 00000000..f1e33962 --- /dev/null +++ b/src/main/java/com/whop/api/types/PlanPlanType.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanPlanType { + public static final PlanPlanType RENEWAL = new PlanPlanType(Value.RENEWAL, "renewal"); + + public static final PlanPlanType ONE_TIME = new PlanPlanType(Value.ONE_TIME, "one_time"); + + private final Value value; + + private final String string; + + PlanPlanType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof PlanPlanType && this.string.equals(((PlanPlanType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RENEWAL: + return visitor.visitRenewal(); + case ONE_TIME: + return visitor.visitOneTime(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanPlanType valueOf(String value) { + switch (value) { + case "renewal": + return RENEWAL; + case "one_time": + return ONE_TIME; + default: + return new PlanPlanType(Value.UNKNOWN, value); + } + } + + public enum Value { + RENEWAL, + + ONE_TIME, + + UNKNOWN + } + + public interface Visitor { + T visitRenewal(); + + T visitOneTime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PlanReleaseMethod.java b/src/main/java/com/whop/api/types/PlanReleaseMethod.java new file mode 100644 index 00000000..1d8bd55a --- /dev/null +++ b/src/main/java/com/whop/api/types/PlanReleaseMethod.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanReleaseMethod { + public static final PlanReleaseMethod WAITLIST = new PlanReleaseMethod(Value.WAITLIST, "waitlist"); + + public static final PlanReleaseMethod BUY_NOW = new PlanReleaseMethod(Value.BUY_NOW, "buy_now"); + + private final Value value; + + private final String string; + + PlanReleaseMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PlanReleaseMethod && this.string.equals(((PlanReleaseMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WAITLIST: + return visitor.visitWaitlist(); + case BUY_NOW: + return visitor.visitBuyNow(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanReleaseMethod valueOf(String value) { + switch (value) { + case "waitlist": + return WAITLIST; + case "buy_now": + return BUY_NOW; + default: + return new PlanReleaseMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + BUY_NOW, + + WAITLIST, + + UNKNOWN + } + + public interface Visitor { + T visitBuyNow(); + + T visitWaitlist(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PlanTaxType.java b/src/main/java/com/whop/api/types/PlanTaxType.java new file mode 100644 index 00000000..a93e9832 --- /dev/null +++ b/src/main/java/com/whop/api/types/PlanTaxType.java @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanTaxType { + public static final PlanTaxType UNSPECIFIED = new PlanTaxType(Value.UNSPECIFIED, "unspecified"); + + public static final PlanTaxType EXCLUSIVE = new PlanTaxType(Value.EXCLUSIVE, "exclusive"); + + public static final PlanTaxType INCLUSIVE = new PlanTaxType(Value.INCLUSIVE, "inclusive"); + + private final Value value; + + private final String string; + + PlanTaxType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof PlanTaxType && this.string.equals(((PlanTaxType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case UNSPECIFIED: + return visitor.visitUnspecified(); + case EXCLUSIVE: + return visitor.visitExclusive(); + case INCLUSIVE: + return visitor.visitInclusive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanTaxType valueOf(String value) { + switch (value) { + case "unspecified": + return UNSPECIFIED; + case "exclusive": + return EXCLUSIVE; + case "inclusive": + return INCLUSIVE; + default: + return new PlanTaxType(Value.UNKNOWN, value); + } + } + + public enum Value { + INCLUSIVE, + + EXCLUSIVE, + + UNSPECIFIED, + + UNKNOWN + } + + public interface Visitor { + T visitInclusive(); + + T visitExclusive(); + + T visitUnspecified(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PlanThreeDsLevel.java b/src/main/java/com/whop/api/types/PlanThreeDsLevel.java new file mode 100644 index 00000000..8288de6b --- /dev/null +++ b/src/main/java/com/whop/api/types/PlanThreeDsLevel.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanThreeDsLevel { + public static final PlanThreeDsLevel MANDATE_CHALLENGE = + new PlanThreeDsLevel(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + public static final PlanThreeDsLevel FRICTIONLESS = new PlanThreeDsLevel(Value.FRICTIONLESS, "frictionless"); + + private final Value value; + + private final String string; + + PlanThreeDsLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PlanThreeDsLevel && this.string.equals(((PlanThreeDsLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case FRICTIONLESS: + return visitor.visitFrictionless(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanThreeDsLevel valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + case "frictionless": + return FRICTIONLESS; + default: + return new PlanThreeDsLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + FRICTIONLESS, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitFrictionless(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PlanThreeDsLevels.java b/src/main/java/com/whop/api/types/PlanThreeDsLevels.java new file mode 100644 index 00000000..a918855a --- /dev/null +++ b/src/main/java/com/whop/api/types/PlanThreeDsLevels.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanThreeDsLevels { + public static final PlanThreeDsLevels MANDATE_CHALLENGE = + new PlanThreeDsLevels(Value.MANDATE_CHALLENGE, "mandate_challenge"); + + public static final PlanThreeDsLevels FRICTIONLESS = new PlanThreeDsLevels(Value.FRICTIONLESS, "frictionless"); + + private final Value value; + + private final String string; + + PlanThreeDsLevels(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PlanThreeDsLevels && this.string.equals(((PlanThreeDsLevels) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MANDATE_CHALLENGE: + return visitor.visitMandateChallenge(); + case FRICTIONLESS: + return visitor.visitFrictionless(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanThreeDsLevels valueOf(String value) { + switch (value) { + case "mandate_challenge": + return MANDATE_CHALLENGE; + case "frictionless": + return FRICTIONLESS; + default: + return new PlanThreeDsLevels(Value.UNKNOWN, value); + } + } + + public enum Value { + MANDATE_CHALLENGE, + + FRICTIONLESS, + + UNKNOWN + } + + public interface Visitor { + T visitMandateChallenge(); + + T visitFrictionless(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PlanTypes.java b/src/main/java/com/whop/api/types/PlanTypes.java new file mode 100644 index 00000000..4724b290 --- /dev/null +++ b/src/main/java/com/whop/api/types/PlanTypes.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanTypes { + public static final PlanTypes RENEWAL = new PlanTypes(Value.RENEWAL, "renewal"); + + public static final PlanTypes ONE_TIME = new PlanTypes(Value.ONE_TIME, "one_time"); + + private final Value value; + + private final String string; + + PlanTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof PlanTypes && this.string.equals(((PlanTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RENEWAL: + return visitor.visitRenewal(); + case ONE_TIME: + return visitor.visitOneTime(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanTypes valueOf(String value) { + switch (value) { + case "renewal": + return RENEWAL; + case "one_time": + return ONE_TIME; + default: + return new PlanTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + RENEWAL, + + ONE_TIME, + + UNKNOWN + } + + public interface Visitor { + T visitRenewal(); + + T visitOneTime(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PlanVisibility.java b/src/main/java/com/whop/api/types/PlanVisibility.java new file mode 100644 index 00000000..c39abc9b --- /dev/null +++ b/src/main/java/com/whop/api/types/PlanVisibility.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanVisibility { + public static final PlanVisibility VISIBLE = new PlanVisibility(Value.VISIBLE, "visible"); + + public static final PlanVisibility HIDDEN = new PlanVisibility(Value.HIDDEN, "hidden"); + + public static final PlanVisibility QUICK_LINK = new PlanVisibility(Value.QUICK_LINK, "quick_link"); + + public static final PlanVisibility ARCHIVED = new PlanVisibility(Value.ARCHIVED, "archived"); + + private final Value value; + + private final String string; + + PlanVisibility(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PlanVisibility && this.string.equals(((PlanVisibility) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VISIBLE: + return visitor.visitVisible(); + case HIDDEN: + return visitor.visitHidden(); + case QUICK_LINK: + return visitor.visitQuickLink(); + case ARCHIVED: + return visitor.visitArchived(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanVisibility valueOf(String value) { + switch (value) { + case "visible": + return VISIBLE; + case "hidden": + return HIDDEN; + case "quick_link": + return QUICK_LINK; + case "archived": + return ARCHIVED; + default: + return new PlanVisibility(Value.UNKNOWN, value); + } + } + + public enum Value { + VISIBLE, + + HIDDEN, + + ARCHIVED, + + QUICK_LINK, + + UNKNOWN + } + + public interface Visitor { + T visitVisible(); + + T visitHidden(); + + T visitArchived(); + + T visitQuickLink(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Product.java b/src/main/java/com/whop/api/types/Product.java new file mode 100644 index 00000000..bf6481c1 --- /dev/null +++ b/src/main/java/com/whop/api/types/Product.java @@ -0,0 +1,1617 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Product.Builder.class) +public final class Product { + private final Optional> account; + + private final String createdAt; + + private final Optional customCta; + + private final Optional customCtaUrl; + + private final Optional customStatementDescriptor; + + private final Optional description; + + private final Optional externalIdentifier; + + private final List galleryImages; + + private final Optional globalAffiliatePercentage; + + private final Optional globalAffiliateStatus; + + private final Optional headline; + + private final String id; + + private final List labels; + + private final ProductMarketplaceStatus marketplaceStatus; + + private final Optional memberAffiliatePercentage; + + private final Optional memberAffiliateStatus; + + private final double memberCount; + + private final Optional> metadata; + + private final Optional> ownerUser; + + private final Optional> productTaxCode; + + private final double publishedReviewsCount; + + private final String route; + + private final String title; + + private final String updatedAt; + + private final boolean verified; + + private final Optional visibility; + + private final Map additionalProperties; + + private Product( + Optional> account, + String createdAt, + Optional customCta, + Optional customCtaUrl, + Optional customStatementDescriptor, + Optional description, + Optional externalIdentifier, + List galleryImages, + Optional globalAffiliatePercentage, + Optional globalAffiliateStatus, + Optional headline, + String id, + List labels, + ProductMarketplaceStatus marketplaceStatus, + Optional memberAffiliatePercentage, + Optional memberAffiliateStatus, + double memberCount, + Optional> metadata, + Optional> ownerUser, + Optional> productTaxCode, + double publishedReviewsCount, + String route, + String title, + String updatedAt, + boolean verified, + Optional visibility, + Map additionalProperties) { + this.account = account; + this.createdAt = createdAt; + this.customCta = customCta; + this.customCtaUrl = customCtaUrl; + this.customStatementDescriptor = customStatementDescriptor; + this.description = description; + this.externalIdentifier = externalIdentifier; + this.galleryImages = galleryImages; + this.globalAffiliatePercentage = globalAffiliatePercentage; + this.globalAffiliateStatus = globalAffiliateStatus; + this.headline = headline; + this.id = id; + this.labels = labels; + this.marketplaceStatus = marketplaceStatus; + this.memberAffiliatePercentage = memberAffiliatePercentage; + this.memberAffiliateStatus = memberAffiliateStatus; + this.memberCount = memberCount; + this.metadata = metadata; + this.ownerUser = ownerUser; + this.productTaxCode = productTaxCode; + this.publishedReviewsCount = publishedReviewsCount; + this.route = route; + this.title = title; + this.updatedAt = updatedAt; + this.verified = verified; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account that sells this product. + */ + @JsonIgnore + public Optional> getAccount() { + if (account == null) { + return Optional.empty(); + } + return account; + } + + /** + * @return When the product was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Call-to-action button label shown on the product purchase page. + */ + @JsonIgnore + public Optional getCustomCta() { + if (customCta == null) { + return Optional.empty(); + } + return customCta; + } + + /** + * @return URL the call-to-action button links to instead of checkout. + */ + @JsonIgnore + public Optional getCustomCtaUrl() { + if (customCtaUrl == null) { + return Optional.empty(); + } + return customCtaUrl; + } + + /** + * @return Custom text label on customer's bank statement. + */ + @JsonIgnore + public Optional getCustomStatementDescriptor() { + if (customStatementDescriptor == null) { + return Optional.empty(); + } + return customStatementDescriptor; + } + + /** + * @return Written description displayed on product page. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return External identifier stored on the product for your own reference. + */ + @JsonIgnore + public Optional getExternalIdentifier() { + if (externalIdentifier == null) { + return Optional.empty(); + } + return externalIdentifier; + } + + @JsonProperty("gallery_images") + public List getGalleryImages() { + return galleryImages; + } + + /** + * @return Commission rate affiliates earn through the global affiliate program. + */ + @JsonIgnore + public Optional getGlobalAffiliatePercentage() { + if (globalAffiliatePercentage == null) { + return Optional.empty(); + } + return globalAffiliatePercentage; + } + + /** + * @return Enrollment status in the global affiliate program. + */ + @JsonIgnore + public Optional getGlobalAffiliateStatus() { + if (globalAffiliateStatus == null) { + return Optional.empty(); + } + return globalAffiliateStatus; + } + + /** + * @return Short marketing headline displayed on product page. + */ + @JsonIgnore + public Optional getHeadline() { + if (headline == null) { + return Optional.empty(); + } + return headline; + } + + /** + * @return Product ID, prefixed prod_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("labels") + public List getLabels() { + return labels; + } + + /** + * @return Listing state on the whop.com marketplace. pending_review means submitted and awaiting review; live_marketplace means approved and discoverable. + */ + @JsonProperty("marketplace_status") + public ProductMarketplaceStatus getMarketplaceStatus() { + return marketplaceStatus; + } + + /** + * @return Commission rate members earn through the member affiliate program. + */ + @JsonIgnore + public Optional getMemberAffiliatePercentage() { + if (memberAffiliatePercentage == null) { + return Optional.empty(); + } + return memberAffiliatePercentage; + } + + /** + * @return Enrollment status in the member affiliate program. + */ + @JsonIgnore + public Optional getMemberAffiliateStatus() { + if (memberAffiliateStatus == null) { + return Optional.empty(); + } + return memberAffiliateStatus; + } + + /** + * @return Active memberships for this product; 0 if public member counts are disabled. + */ + @JsonProperty("member_count") + public double getMemberCount() { + return memberCount; + } + + /** + * @return Custom key-value pairs stored on the product. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return User who owns the account selling this product. + */ + @JsonIgnore + public Optional> getOwnerUser() { + if (ownerUser == null) { + return Optional.empty(); + } + return ownerUser; + } + + /** + * @return Tax classification code for this product, or null if no tax code is set. + */ + @JsonIgnore + public Optional> getProductTaxCode() { + if (productTaxCode == null) { + return Optional.empty(); + } + return productTaxCode; + } + + /** + * @return Published customer reviews for this product. + */ + @JsonProperty("published_reviews_count") + public double getPublishedReviewsCount() { + return publishedReviewsCount; + } + + /** + * @return URL slug for the product's public link. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return Product display name shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return When the product was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return Whether the product has been verified by Whop. + */ + @JsonProperty("verified") + public boolean getVerified() { + return verified; + } + + /** + * @return Whether the product is publicly visible, hidden, or archived. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account") + private Optional> _getAccount() { + return account; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_cta") + private Optional _getCustomCta() { + return customCta; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_cta_url") + private Optional _getCustomCtaUrl() { + return customCtaUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_statement_descriptor") + private Optional _getCustomStatementDescriptor() { + return customStatementDescriptor; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("external_identifier") + private Optional _getExternalIdentifier() { + return externalIdentifier; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("global_affiliate_percentage") + private Optional _getGlobalAffiliatePercentage() { + return globalAffiliatePercentage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("global_affiliate_status") + private Optional _getGlobalAffiliateStatus() { + return globalAffiliateStatus; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("headline") + private Optional _getHeadline() { + return headline; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member_affiliate_percentage") + private Optional _getMemberAffiliatePercentage() { + return memberAffiliatePercentage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member_affiliate_status") + private Optional _getMemberAffiliateStatus() { + return memberAffiliateStatus; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("owner_user") + private Optional> _getOwnerUser() { + return ownerUser; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_tax_code") + private Optional> _getProductTaxCode() { + return productTaxCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Product && equalTo((Product) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Product other) { + return account.equals(other.account) + && createdAt.equals(other.createdAt) + && customCta.equals(other.customCta) + && customCtaUrl.equals(other.customCtaUrl) + && customStatementDescriptor.equals(other.customStatementDescriptor) + && description.equals(other.description) + && externalIdentifier.equals(other.externalIdentifier) + && galleryImages.equals(other.galleryImages) + && globalAffiliatePercentage.equals(other.globalAffiliatePercentage) + && globalAffiliateStatus.equals(other.globalAffiliateStatus) + && headline.equals(other.headline) + && id.equals(other.id) + && labels.equals(other.labels) + && marketplaceStatus.equals(other.marketplaceStatus) + && memberAffiliatePercentage.equals(other.memberAffiliatePercentage) + && memberAffiliateStatus.equals(other.memberAffiliateStatus) + && memberCount == other.memberCount + && metadata.equals(other.metadata) + && ownerUser.equals(other.ownerUser) + && productTaxCode.equals(other.productTaxCode) + && publishedReviewsCount == other.publishedReviewsCount + && route.equals(other.route) + && title.equals(other.title) + && updatedAt.equals(other.updatedAt) + && verified == other.verified + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.account, + this.createdAt, + this.customCta, + this.customCtaUrl, + this.customStatementDescriptor, + this.description, + this.externalIdentifier, + this.galleryImages, + this.globalAffiliatePercentage, + this.globalAffiliateStatus, + this.headline, + this.id, + this.labels, + this.marketplaceStatus, + this.memberAffiliatePercentage, + this.memberAffiliateStatus, + this.memberCount, + this.metadata, + this.ownerUser, + this.productTaxCode, + this.publishedReviewsCount, + this.route, + this.title, + this.updatedAt, + this.verified, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the product was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + + Builder from(Product other); + } + + public interface IdStage { + /** + *

Product ID, prefixed prod_.

+ */ + MarketplaceStatusStage id(@NotNull String id); + } + + public interface MarketplaceStatusStage { + /** + *

Listing state on the whop.com marketplace. pending_review means submitted and awaiting review; live_marketplace means approved and discoverable.

+ */ + MemberCountStage marketplaceStatus(@NotNull ProductMarketplaceStatus marketplaceStatus); + } + + public interface MemberCountStage { + /** + *

Active memberships for this product; 0 if public member counts are disabled.

+ */ + PublishedReviewsCountStage memberCount(double memberCount); + } + + public interface PublishedReviewsCountStage { + /** + *

Published customer reviews for this product.

+ */ + RouteStage publishedReviewsCount(double publishedReviewsCount); + } + + public interface RouteStage { + /** + *

URL slug for the product's public link.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

Product display name shown to customers.

+ */ + UpdatedAtStage title(@NotNull String title); + } + + public interface UpdatedAtStage { + /** + *

When the product was last updated, as an ISO 8601 timestamp.

+ */ + VerifiedStage updatedAt(@NotNull String updatedAt); + } + + public interface VerifiedStage { + /** + *

Whether the product has been verified by Whop.

+ */ + _FinalStage verified(boolean verified); + } + + public interface _FinalStage { + Product build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Account that sells this product.

+ */ + _FinalStage account(Optional> account); + + _FinalStage account(Map account); + + _FinalStage account(Nullable> account); + + /** + *

Call-to-action button label shown on the product purchase page.

+ */ + _FinalStage customCta(Optional customCta); + + _FinalStage customCta(ProductCustomCta customCta); + + _FinalStage customCta(Nullable customCta); + + /** + *

URL the call-to-action button links to instead of checkout.

+ */ + _FinalStage customCtaUrl(Optional customCtaUrl); + + _FinalStage customCtaUrl(String customCtaUrl); + + _FinalStage customCtaUrl(Nullable customCtaUrl); + + /** + *

Custom text label on customer's bank statement.

+ */ + _FinalStage customStatementDescriptor(Optional customStatementDescriptor); + + _FinalStage customStatementDescriptor(String customStatementDescriptor); + + _FinalStage customStatementDescriptor(Nullable customStatementDescriptor); + + /** + *

Written description displayed on product page.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

External identifier stored on the product for your own reference.

+ */ + _FinalStage externalIdentifier(Optional externalIdentifier); + + _FinalStage externalIdentifier(String externalIdentifier); + + _FinalStage externalIdentifier(Nullable externalIdentifier); + + _FinalStage galleryImages(List galleryImages); + + _FinalStage addGalleryImages(ProductGalleryImage galleryImages); + + _FinalStage addAllGalleryImages(List galleryImages); + + /** + *

Commission rate affiliates earn through the global affiliate program.

+ */ + _FinalStage globalAffiliatePercentage(Optional globalAffiliatePercentage); + + _FinalStage globalAffiliatePercentage(Double globalAffiliatePercentage); + + _FinalStage globalAffiliatePercentage(Nullable globalAffiliatePercentage); + + /** + *

Enrollment status in the global affiliate program.

+ */ + _FinalStage globalAffiliateStatus(Optional globalAffiliateStatus); + + _FinalStage globalAffiliateStatus(ProductGlobalAffiliateStatus globalAffiliateStatus); + + _FinalStage globalAffiliateStatus(Nullable globalAffiliateStatus); + + /** + *

Short marketing headline displayed on product page.

+ */ + _FinalStage headline(Optional headline); + + _FinalStage headline(String headline); + + _FinalStage headline(Nullable headline); + + _FinalStage labels(List labels); + + _FinalStage addLabels(String labels); + + _FinalStage addAllLabels(List labels); + + /** + *

Commission rate members earn through the member affiliate program.

+ */ + _FinalStage memberAffiliatePercentage(Optional memberAffiliatePercentage); + + _FinalStage memberAffiliatePercentage(Double memberAffiliatePercentage); + + _FinalStage memberAffiliatePercentage(Nullable memberAffiliatePercentage); + + /** + *

Enrollment status in the member affiliate program.

+ */ + _FinalStage memberAffiliateStatus(Optional memberAffiliateStatus); + + _FinalStage memberAffiliateStatus(ProductMemberAffiliateStatus memberAffiliateStatus); + + _FinalStage memberAffiliateStatus(Nullable memberAffiliateStatus); + + /** + *

Custom key-value pairs stored on the product.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

User who owns the account selling this product.

+ */ + _FinalStage ownerUser(Optional> ownerUser); + + _FinalStage ownerUser(Map ownerUser); + + _FinalStage ownerUser(Nullable> ownerUser); + + /** + *

Tax classification code for this product, or null if no tax code is set.

+ */ + _FinalStage productTaxCode(Optional> productTaxCode); + + _FinalStage productTaxCode(Map productTaxCode); + + _FinalStage productTaxCode(Nullable> productTaxCode); + + /** + *

Whether the product is publicly visible, hidden, or archived.

+ */ + _FinalStage visibility(Optional visibility); + + _FinalStage visibility(String visibility); + + _FinalStage visibility(Nullable visibility); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + IdStage, + MarketplaceStatusStage, + MemberCountStage, + PublishedReviewsCountStage, + RouteStage, + TitleStage, + UpdatedAtStage, + VerifiedStage, + _FinalStage { + private String createdAt; + + private String id; + + private ProductMarketplaceStatus marketplaceStatus; + + private double memberCount; + + private double publishedReviewsCount; + + private String route; + + private String title; + + private String updatedAt; + + private boolean verified; + + private Optional visibility = Optional.empty(); + + private Optional> productTaxCode = Optional.empty(); + + private Optional> ownerUser = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional memberAffiliateStatus = Optional.empty(); + + private Optional memberAffiliatePercentage = Optional.empty(); + + private List labels = new ArrayList<>(); + + private Optional headline = Optional.empty(); + + private Optional globalAffiliateStatus = Optional.empty(); + + private Optional globalAffiliatePercentage = Optional.empty(); + + private List galleryImages = new ArrayList<>(); + + private Optional externalIdentifier = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional customStatementDescriptor = Optional.empty(); + + private Optional customCtaUrl = Optional.empty(); + + private Optional customCta = Optional.empty(); + + private Optional> account = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Product other) { + account(other.getAccount()); + createdAt(other.getCreatedAt()); + customCta(other.getCustomCta()); + customCtaUrl(other.getCustomCtaUrl()); + customStatementDescriptor(other.getCustomStatementDescriptor()); + description(other.getDescription()); + externalIdentifier(other.getExternalIdentifier()); + galleryImages(other.getGalleryImages()); + globalAffiliatePercentage(other.getGlobalAffiliatePercentage()); + globalAffiliateStatus(other.getGlobalAffiliateStatus()); + headline(other.getHeadline()); + id(other.getId()); + labels(other.getLabels()); + marketplaceStatus(other.getMarketplaceStatus()); + memberAffiliatePercentage(other.getMemberAffiliatePercentage()); + memberAffiliateStatus(other.getMemberAffiliateStatus()); + memberCount(other.getMemberCount()); + metadata(other.getMetadata()); + ownerUser(other.getOwnerUser()); + productTaxCode(other.getProductTaxCode()); + publishedReviewsCount(other.getPublishedReviewsCount()); + route(other.getRoute()); + title(other.getTitle()); + updatedAt(other.getUpdatedAt()); + verified(other.getVerified()); + visibility(other.getVisibility()); + return this; + } + + /** + *

When the product was created, as an ISO 8601 timestamp.

+ *

When the product was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Product ID, prefixed prod_.

+ *

Product ID, prefixed prod_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MarketplaceStatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Listing state on the whop.com marketplace. pending_review means submitted and awaiting review; live_marketplace means approved and discoverable.

+ *

Listing state on the whop.com marketplace. pending_review means submitted and awaiting review; live_marketplace means approved and discoverable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("marketplace_status") + public MemberCountStage marketplaceStatus(@NotNull ProductMarketplaceStatus marketplaceStatus) { + this.marketplaceStatus = Objects.requireNonNull(marketplaceStatus, "marketplaceStatus must not be null"); + return this; + } + + /** + *

Active memberships for this product; 0 if public member counts are disabled.

+ *

Active memberships for this product; 0 if public member counts are disabled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("member_count") + public PublishedReviewsCountStage memberCount(double memberCount) { + this.memberCount = memberCount; + return this; + } + + /** + *

Published customer reviews for this product.

+ *

Published customer reviews for this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("published_reviews_count") + public RouteStage publishedReviewsCount(double publishedReviewsCount) { + this.publishedReviewsCount = publishedReviewsCount; + return this; + } + + /** + *

URL slug for the product's public link.

+ *

URL slug for the product's public link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

Product display name shown to customers.

+ *

Product display name shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public UpdatedAtStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

When the product was last updated, as an ISO 8601 timestamp.

+ *

When the product was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public VerifiedStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

Whether the product has been verified by Whop.

+ *

Whether the product has been verified by Whop.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("verified") + public _FinalStage verified(boolean verified) { + this.verified = verified; + return this; + } + + /** + *

Whether the product is publicly visible, hidden, or archived.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + /** + *

Whether the product is publicly visible, hidden, or archived.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(String visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + /** + *

Whether the product is publicly visible, hidden, or archived.

+ */ + @java.lang.Override + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public _FinalStage visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + /** + *

Tax classification code for this product, or null if no tax code is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productTaxCode(Nullable> productTaxCode) { + if (productTaxCode.isNull()) { + this.productTaxCode = null; + } else if (productTaxCode.isEmpty()) { + this.productTaxCode = Optional.empty(); + } else { + this.productTaxCode = Optional.of(productTaxCode.get()); + } + return this; + } + + /** + *

Tax classification code for this product, or null if no tax code is set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productTaxCode(Map productTaxCode) { + this.productTaxCode = Optional.ofNullable(productTaxCode); + return this; + } + + /** + *

Tax classification code for this product, or null if no tax code is set.

+ */ + @java.lang.Override + @JsonSetter(value = "product_tax_code", nulls = Nulls.SKIP) + public _FinalStage productTaxCode(Optional> productTaxCode) { + this.productTaxCode = productTaxCode; + return this; + } + + /** + *

User who owns the account selling this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage ownerUser(Nullable> ownerUser) { + if (ownerUser.isNull()) { + this.ownerUser = null; + } else if (ownerUser.isEmpty()) { + this.ownerUser = Optional.empty(); + } else { + this.ownerUser = Optional.of(ownerUser.get()); + } + return this; + } + + /** + *

User who owns the account selling this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage ownerUser(Map ownerUser) { + this.ownerUser = Optional.ofNullable(ownerUser); + return this; + } + + /** + *

User who owns the account selling this product.

+ */ + @java.lang.Override + @JsonSetter(value = "owner_user", nulls = Nulls.SKIP) + public _FinalStage ownerUser(Optional> ownerUser) { + this.ownerUser = ownerUser; + return this; + } + + /** + *

Custom key-value pairs stored on the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs stored on the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs stored on the product.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

Enrollment status in the member affiliate program.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memberAffiliateStatus(Nullable memberAffiliateStatus) { + if (memberAffiliateStatus.isNull()) { + this.memberAffiliateStatus = null; + } else if (memberAffiliateStatus.isEmpty()) { + this.memberAffiliateStatus = Optional.empty(); + } else { + this.memberAffiliateStatus = Optional.of(memberAffiliateStatus.get()); + } + return this; + } + + /** + *

Enrollment status in the member affiliate program.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memberAffiliateStatus(ProductMemberAffiliateStatus memberAffiliateStatus) { + this.memberAffiliateStatus = Optional.ofNullable(memberAffiliateStatus); + return this; + } + + /** + *

Enrollment status in the member affiliate program.

+ */ + @java.lang.Override + @JsonSetter(value = "member_affiliate_status", nulls = Nulls.SKIP) + public _FinalStage memberAffiliateStatus(Optional memberAffiliateStatus) { + this.memberAffiliateStatus = memberAffiliateStatus; + return this; + } + + /** + *

Commission rate members earn through the member affiliate program.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memberAffiliatePercentage(Nullable memberAffiliatePercentage) { + if (memberAffiliatePercentage.isNull()) { + this.memberAffiliatePercentage = null; + } else if (memberAffiliatePercentage.isEmpty()) { + this.memberAffiliatePercentage = Optional.empty(); + } else { + this.memberAffiliatePercentage = Optional.of(memberAffiliatePercentage.get()); + } + return this; + } + + /** + *

Commission rate members earn through the member affiliate program.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage memberAffiliatePercentage(Double memberAffiliatePercentage) { + this.memberAffiliatePercentage = Optional.ofNullable(memberAffiliatePercentage); + return this; + } + + /** + *

Commission rate members earn through the member affiliate program.

+ */ + @java.lang.Override + @JsonSetter(value = "member_affiliate_percentage", nulls = Nulls.SKIP) + public _FinalStage memberAffiliatePercentage(Optional memberAffiliatePercentage) { + this.memberAffiliatePercentage = memberAffiliatePercentage; + return this; + } + + @java.lang.Override + public _FinalStage addAllLabels(List labels) { + if (labels != null) { + this.labels.addAll(labels); + } + return this; + } + + @java.lang.Override + public _FinalStage addLabels(String labels) { + this.labels.add(labels); + return this; + } + + @java.lang.Override + @JsonSetter(value = "labels", nulls = Nulls.SKIP) + public _FinalStage labels(List labels) { + this.labels.clear(); + if (labels != null) { + this.labels.addAll(labels); + } + return this; + } + + /** + *

Short marketing headline displayed on product page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage headline(Nullable headline) { + if (headline.isNull()) { + this.headline = null; + } else if (headline.isEmpty()) { + this.headline = Optional.empty(); + } else { + this.headline = Optional.of(headline.get()); + } + return this; + } + + /** + *

Short marketing headline displayed on product page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage headline(String headline) { + this.headline = Optional.ofNullable(headline); + return this; + } + + /** + *

Short marketing headline displayed on product page.

+ */ + @java.lang.Override + @JsonSetter(value = "headline", nulls = Nulls.SKIP) + public _FinalStage headline(Optional headline) { + this.headline = headline; + return this; + } + + /** + *

Enrollment status in the global affiliate program.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage globalAffiliateStatus(Nullable globalAffiliateStatus) { + if (globalAffiliateStatus.isNull()) { + this.globalAffiliateStatus = null; + } else if (globalAffiliateStatus.isEmpty()) { + this.globalAffiliateStatus = Optional.empty(); + } else { + this.globalAffiliateStatus = Optional.of(globalAffiliateStatus.get()); + } + return this; + } + + /** + *

Enrollment status in the global affiliate program.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage globalAffiliateStatus(ProductGlobalAffiliateStatus globalAffiliateStatus) { + this.globalAffiliateStatus = Optional.ofNullable(globalAffiliateStatus); + return this; + } + + /** + *

Enrollment status in the global affiliate program.

+ */ + @java.lang.Override + @JsonSetter(value = "global_affiliate_status", nulls = Nulls.SKIP) + public _FinalStage globalAffiliateStatus(Optional globalAffiliateStatus) { + this.globalAffiliateStatus = globalAffiliateStatus; + return this; + } + + /** + *

Commission rate affiliates earn through the global affiliate program.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage globalAffiliatePercentage(Nullable globalAffiliatePercentage) { + if (globalAffiliatePercentage.isNull()) { + this.globalAffiliatePercentage = null; + } else if (globalAffiliatePercentage.isEmpty()) { + this.globalAffiliatePercentage = Optional.empty(); + } else { + this.globalAffiliatePercentage = Optional.of(globalAffiliatePercentage.get()); + } + return this; + } + + /** + *

Commission rate affiliates earn through the global affiliate program.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage globalAffiliatePercentage(Double globalAffiliatePercentage) { + this.globalAffiliatePercentage = Optional.ofNullable(globalAffiliatePercentage); + return this; + } + + /** + *

Commission rate affiliates earn through the global affiliate program.

+ */ + @java.lang.Override + @JsonSetter(value = "global_affiliate_percentage", nulls = Nulls.SKIP) + public _FinalStage globalAffiliatePercentage(Optional globalAffiliatePercentage) { + this.globalAffiliatePercentage = globalAffiliatePercentage; + return this; + } + + @java.lang.Override + public _FinalStage addAllGalleryImages(List galleryImages) { + if (galleryImages != null) { + this.galleryImages.addAll(galleryImages); + } + return this; + } + + @java.lang.Override + public _FinalStage addGalleryImages(ProductGalleryImage galleryImages) { + this.galleryImages.add(galleryImages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "gallery_images", nulls = Nulls.SKIP) + public _FinalStage galleryImages(List galleryImages) { + this.galleryImages.clear(); + if (galleryImages != null) { + this.galleryImages.addAll(galleryImages); + } + return this; + } + + /** + *

External identifier stored on the product for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage externalIdentifier(Nullable externalIdentifier) { + if (externalIdentifier.isNull()) { + this.externalIdentifier = null; + } else if (externalIdentifier.isEmpty()) { + this.externalIdentifier = Optional.empty(); + } else { + this.externalIdentifier = Optional.of(externalIdentifier.get()); + } + return this; + } + + /** + *

External identifier stored on the product for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage externalIdentifier(String externalIdentifier) { + this.externalIdentifier = Optional.ofNullable(externalIdentifier); + return this; + } + + /** + *

External identifier stored on the product for your own reference.

+ */ + @java.lang.Override + @JsonSetter(value = "external_identifier", nulls = Nulls.SKIP) + public _FinalStage externalIdentifier(Optional externalIdentifier) { + this.externalIdentifier = externalIdentifier; + return this; + } + + /** + *

Written description displayed on product page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

Written description displayed on product page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

Written description displayed on product page.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

Custom text label on customer's bank statement.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customStatementDescriptor(Nullable customStatementDescriptor) { + if (customStatementDescriptor.isNull()) { + this.customStatementDescriptor = null; + } else if (customStatementDescriptor.isEmpty()) { + this.customStatementDescriptor = Optional.empty(); + } else { + this.customStatementDescriptor = Optional.of(customStatementDescriptor.get()); + } + return this; + } + + /** + *

Custom text label on customer's bank statement.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customStatementDescriptor(String customStatementDescriptor) { + this.customStatementDescriptor = Optional.ofNullable(customStatementDescriptor); + return this; + } + + /** + *

Custom text label on customer's bank statement.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_statement_descriptor", nulls = Nulls.SKIP) + public _FinalStage customStatementDescriptor(Optional customStatementDescriptor) { + this.customStatementDescriptor = customStatementDescriptor; + return this; + } + + /** + *

URL the call-to-action button links to instead of checkout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customCtaUrl(Nullable customCtaUrl) { + if (customCtaUrl.isNull()) { + this.customCtaUrl = null; + } else if (customCtaUrl.isEmpty()) { + this.customCtaUrl = Optional.empty(); + } else { + this.customCtaUrl = Optional.of(customCtaUrl.get()); + } + return this; + } + + /** + *

URL the call-to-action button links to instead of checkout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customCtaUrl(String customCtaUrl) { + this.customCtaUrl = Optional.ofNullable(customCtaUrl); + return this; + } + + /** + *

URL the call-to-action button links to instead of checkout.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_cta_url", nulls = Nulls.SKIP) + public _FinalStage customCtaUrl(Optional customCtaUrl) { + this.customCtaUrl = customCtaUrl; + return this; + } + + /** + *

Call-to-action button label shown on the product purchase page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customCta(Nullable customCta) { + if (customCta.isNull()) { + this.customCta = null; + } else if (customCta.isEmpty()) { + this.customCta = Optional.empty(); + } else { + this.customCta = Optional.of(customCta.get()); + } + return this; + } + + /** + *

Call-to-action button label shown on the product purchase page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customCta(ProductCustomCta customCta) { + this.customCta = Optional.ofNullable(customCta); + return this; + } + + /** + *

Call-to-action button label shown on the product purchase page.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_cta", nulls = Nulls.SKIP) + public _FinalStage customCta(Optional customCta) { + this.customCta = customCta; + return this; + } + + /** + *

Account that sells this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(Nullable> account) { + if (account.isNull()) { + this.account = null; + } else if (account.isEmpty()) { + this.account = Optional.empty(); + } else { + this.account = Optional.of(account.get()); + } + return this; + } + + /** + *

Account that sells this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(Map account) { + this.account = Optional.ofNullable(account); + return this; + } + + /** + *

Account that sells this product.

+ */ + @java.lang.Override + @JsonSetter(value = "account", nulls = Nulls.SKIP) + public _FinalStage account(Optional> account) { + this.account = account; + return this; + } + + @java.lang.Override + public Product build() { + return new Product( + account, + createdAt, + customCta, + customCtaUrl, + customStatementDescriptor, + description, + externalIdentifier, + galleryImages, + globalAffiliatePercentage, + globalAffiliateStatus, + headline, + id, + labels, + marketplaceStatus, + memberAffiliatePercentage, + memberAffiliateStatus, + memberCount, + metadata, + ownerUser, + productTaxCode, + publishedReviewsCount, + route, + title, + updatedAt, + verified, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ProductCustomCta.java b/src/main/java/com/whop/api/types/ProductCustomCta.java new file mode 100644 index 00000000..4a66b36a --- /dev/null +++ b/src/main/java/com/whop/api/types/ProductCustomCta.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ProductCustomCta { + public static final ProductCustomCta DONATE_NOW = new ProductCustomCta(Value.DONATE_NOW, "donate_now"); + + public static final ProductCustomCta SIGN_UP = new ProductCustomCta(Value.SIGN_UP, "sign_up"); + + public static final ProductCustomCta GET_OFFER = new ProductCustomCta(Value.GET_OFFER, "get_offer"); + + public static final ProductCustomCta COMPLETE_ORDER = new ProductCustomCta(Value.COMPLETE_ORDER, "complete_order"); + + public static final ProductCustomCta PURCHASE = new ProductCustomCta(Value.PURCHASE, "purchase"); + + public static final ProductCustomCta SHOP_NOW = new ProductCustomCta(Value.SHOP_NOW, "shop_now"); + + public static final ProductCustomCta GET_ACCESS = new ProductCustomCta(Value.GET_ACCESS, "get_access"); + + public static final ProductCustomCta JOIN = new ProductCustomCta(Value.JOIN, "join"); + + public static final ProductCustomCta CALL_NOW = new ProductCustomCta(Value.CALL_NOW, "call_now"); + + public static final ProductCustomCta ORDER_NOW = new ProductCustomCta(Value.ORDER_NOW, "order_now"); + + public static final ProductCustomCta SUBSCRIBE = new ProductCustomCta(Value.SUBSCRIBE, "subscribe"); + + public static final ProductCustomCta APPLY_NOW = new ProductCustomCta(Value.APPLY_NOW, "apply_now"); + + public static final ProductCustomCta CONTACT_US = new ProductCustomCta(Value.CONTACT_US, "contact_us"); + + private final Value value; + + private final String string; + + ProductCustomCta(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ProductCustomCta && this.string.equals(((ProductCustomCta) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DONATE_NOW: + return visitor.visitDonateNow(); + case SIGN_UP: + return visitor.visitSignUp(); + case GET_OFFER: + return visitor.visitGetOffer(); + case COMPLETE_ORDER: + return visitor.visitCompleteOrder(); + case PURCHASE: + return visitor.visitPurchase(); + case SHOP_NOW: + return visitor.visitShopNow(); + case GET_ACCESS: + return visitor.visitGetAccess(); + case JOIN: + return visitor.visitJoin(); + case CALL_NOW: + return visitor.visitCallNow(); + case ORDER_NOW: + return visitor.visitOrderNow(); + case SUBSCRIBE: + return visitor.visitSubscribe(); + case APPLY_NOW: + return visitor.visitApplyNow(); + case CONTACT_US: + return visitor.visitContactUs(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ProductCustomCta valueOf(String value) { + switch (value) { + case "donate_now": + return DONATE_NOW; + case "sign_up": + return SIGN_UP; + case "get_offer": + return GET_OFFER; + case "complete_order": + return COMPLETE_ORDER; + case "purchase": + return PURCHASE; + case "shop_now": + return SHOP_NOW; + case "get_access": + return GET_ACCESS; + case "join": + return JOIN; + case "call_now": + return CALL_NOW; + case "order_now": + return ORDER_NOW; + case "subscribe": + return SUBSCRIBE; + case "apply_now": + return APPLY_NOW; + case "contact_us": + return CONTACT_US; + default: + return new ProductCustomCta(Value.UNKNOWN, value); + } + } + + public enum Value { + GET_ACCESS, + + JOIN, + + ORDER_NOW, + + SHOP_NOW, + + CALL_NOW, + + DONATE_NOW, + + CONTACT_US, + + SIGN_UP, + + SUBSCRIBE, + + PURCHASE, + + GET_OFFER, + + APPLY_NOW, + + COMPLETE_ORDER, + + UNKNOWN + } + + public interface Visitor { + T visitGetAccess(); + + T visitJoin(); + + T visitOrderNow(); + + T visitShopNow(); + + T visitCallNow(); + + T visitDonateNow(); + + T visitContactUs(); + + T visitSignUp(); + + T visitSubscribe(); + + T visitPurchase(); + + T visitGetOffer(); + + T visitApplyNow(); + + T visitCompleteOrder(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ProductGalleryImage.java b/src/main/java/com/whop/api/types/ProductGalleryImage.java new file mode 100644 index 00000000..cd4458f9 --- /dev/null +++ b/src/main/java/com/whop/api/types/ProductGalleryImage.java @@ -0,0 +1,271 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProductGalleryImage.Builder.class) +public final class ProductGalleryImage { + private final Optional contentType; + + private final String id; + + private final Optional url; + + private final Map additionalProperties; + + private ProductGalleryImage( + Optional contentType, String id, Optional url, Map additionalProperties) { + this.contentType = contentType; + this.id = id; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Uploaded file MIME type, such as image/jpeg. + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return Gallery image ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Pre-optimized URL for rendering this image on the client. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProductGalleryImage && equalTo((ProductGalleryImage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProductGalleryImage other) { + return contentType.equals(other.contentType) && id.equals(other.id) && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contentType, this.id, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Gallery image ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(ProductGalleryImage other); + } + + public interface _FinalStage { + ProductGalleryImage build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Uploaded file MIME type, such as image/jpeg.

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

Pre-optimized URL for rendering this image on the client.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional url = Optional.empty(); + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProductGalleryImage other) { + contentType(other.getContentType()); + id(other.getId()); + url(other.getUrl()); + return this; + } + + /** + *

Gallery image ID.

+ *

Gallery image ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Pre-optimized URL for rendering this image on the client.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

Pre-optimized URL for rendering this image on the client.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

Pre-optimized URL for rendering this image on the client.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg.

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public ProductGalleryImage build() { + return new ProductGalleryImage(contentType, id, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ProductGlobalAffiliateStatus.java b/src/main/java/com/whop/api/types/ProductGlobalAffiliateStatus.java new file mode 100644 index 00000000..943f795f --- /dev/null +++ b/src/main/java/com/whop/api/types/ProductGlobalAffiliateStatus.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ProductGlobalAffiliateStatus { + public static final ProductGlobalAffiliateStatus ENABLED = + new ProductGlobalAffiliateStatus(Value.ENABLED, "enabled"); + + public static final ProductGlobalAffiliateStatus DISABLED = + new ProductGlobalAffiliateStatus(Value.DISABLED, "disabled"); + + private final Value value; + + private final String string; + + ProductGlobalAffiliateStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ProductGlobalAffiliateStatus + && this.string.equals(((ProductGlobalAffiliateStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ENABLED: + return visitor.visitEnabled(); + case DISABLED: + return visitor.visitDisabled(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ProductGlobalAffiliateStatus valueOf(String value) { + switch (value) { + case "enabled": + return ENABLED; + case "disabled": + return DISABLED; + default: + return new ProductGlobalAffiliateStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ENABLED, + + DISABLED, + + UNKNOWN + } + + public interface Visitor { + T visitEnabled(); + + T visitDisabled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ProductListItem.java b/src/main/java/com/whop/api/types/ProductListItem.java new file mode 100644 index 00000000..2e8e3c26 --- /dev/null +++ b/src/main/java/com/whop/api/types/ProductListItem.java @@ -0,0 +1,787 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProductListItem.Builder.class) +public final class ProductListItem { + private final String createdAt; + + private final Optional externalIdentifier; + + private final List galleryImages; + + private final Optional headline; + + private final String id; + + private final List labels; + + private final double memberCount; + + private final Optional> metadata; + + private final double publishedReviewsCount; + + private final String route; + + private final String title; + + private final String updatedAt; + + private final boolean verified; + + private final Optional visibility; + + private final Map additionalProperties; + + private ProductListItem( + String createdAt, + Optional externalIdentifier, + List galleryImages, + Optional headline, + String id, + List labels, + double memberCount, + Optional> metadata, + double publishedReviewsCount, + String route, + String title, + String updatedAt, + boolean verified, + Optional visibility, + Map additionalProperties) { + this.createdAt = createdAt; + this.externalIdentifier = externalIdentifier; + this.galleryImages = galleryImages; + this.headline = headline; + this.id = id; + this.labels = labels; + this.memberCount = memberCount; + this.metadata = metadata; + this.publishedReviewsCount = publishedReviewsCount; + this.route = route; + this.title = title; + this.updatedAt = updatedAt; + this.verified = verified; + this.visibility = visibility; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the product was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return External identifier stored on the product for your own reference. + */ + @JsonIgnore + public Optional getExternalIdentifier() { + if (externalIdentifier == null) { + return Optional.empty(); + } + return externalIdentifier; + } + + @JsonProperty("gallery_images") + public List getGalleryImages() { + return galleryImages; + } + + /** + * @return Short marketing headline displayed on product page. + */ + @JsonIgnore + public Optional getHeadline() { + if (headline == null) { + return Optional.empty(); + } + return headline; + } + + /** + * @return Product ID, prefixed prod_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("labels") + public List getLabels() { + return labels; + } + + /** + * @return Active memberships for this product; 0 if public member counts are disabled. + */ + @JsonProperty("member_count") + public double getMemberCount() { + return memberCount; + } + + /** + * @return Custom key-value pairs stored on the product. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return Published customer reviews for this product. + */ + @JsonProperty("published_reviews_count") + public double getPublishedReviewsCount() { + return publishedReviewsCount; + } + + /** + * @return URL slug for the product's public link. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return Product display name shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return When the product was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return Whether the product has been verified by Whop. + */ + @JsonProperty("verified") + public boolean getVerified() { + return verified; + } + + /** + * @return Whether the product is publicly visible, hidden, or archived. + */ + @JsonIgnore + public Optional getVisibility() { + if (visibility == null) { + return Optional.empty(); + } + return visibility; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("external_identifier") + private Optional _getExternalIdentifier() { + return externalIdentifier; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("headline") + private Optional _getHeadline() { + return headline; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("visibility") + private Optional _getVisibility() { + return visibility; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProductListItem && equalTo((ProductListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProductListItem other) { + return createdAt.equals(other.createdAt) + && externalIdentifier.equals(other.externalIdentifier) + && galleryImages.equals(other.galleryImages) + && headline.equals(other.headline) + && id.equals(other.id) + && labels.equals(other.labels) + && memberCount == other.memberCount + && metadata.equals(other.metadata) + && publishedReviewsCount == other.publishedReviewsCount + && route.equals(other.route) + && title.equals(other.title) + && updatedAt.equals(other.updatedAt) + && verified == other.verified + && visibility.equals(other.visibility); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, + this.externalIdentifier, + this.galleryImages, + this.headline, + this.id, + this.labels, + this.memberCount, + this.metadata, + this.publishedReviewsCount, + this.route, + this.title, + this.updatedAt, + this.verified, + this.visibility); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the product was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + + Builder from(ProductListItem other); + } + + public interface IdStage { + /** + *

Product ID, prefixed prod_.

+ */ + MemberCountStage id(@NotNull String id); + } + + public interface MemberCountStage { + /** + *

Active memberships for this product; 0 if public member counts are disabled.

+ */ + PublishedReviewsCountStage memberCount(double memberCount); + } + + public interface PublishedReviewsCountStage { + /** + *

Published customer reviews for this product.

+ */ + RouteStage publishedReviewsCount(double publishedReviewsCount); + } + + public interface RouteStage { + /** + *

URL slug for the product's public link.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

Product display name shown to customers.

+ */ + UpdatedAtStage title(@NotNull String title); + } + + public interface UpdatedAtStage { + /** + *

When the product was last updated, as an ISO 8601 timestamp.

+ */ + VerifiedStage updatedAt(@NotNull String updatedAt); + } + + public interface VerifiedStage { + /** + *

Whether the product has been verified by Whop.

+ */ + _FinalStage verified(boolean verified); + } + + public interface _FinalStage { + ProductListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

External identifier stored on the product for your own reference.

+ */ + _FinalStage externalIdentifier(Optional externalIdentifier); + + _FinalStage externalIdentifier(String externalIdentifier); + + _FinalStage externalIdentifier(Nullable externalIdentifier); + + _FinalStage galleryImages(List galleryImages); + + _FinalStage addGalleryImages(ProductGalleryImage galleryImages); + + _FinalStage addAllGalleryImages(List galleryImages); + + /** + *

Short marketing headline displayed on product page.

+ */ + _FinalStage headline(Optional headline); + + _FinalStage headline(String headline); + + _FinalStage headline(Nullable headline); + + _FinalStage labels(List labels); + + _FinalStage addLabels(String labels); + + _FinalStage addAllLabels(List labels); + + /** + *

Custom key-value pairs stored on the product.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

Whether the product is publicly visible, hidden, or archived.

+ */ + _FinalStage visibility(Optional visibility); + + _FinalStage visibility(String visibility); + + _FinalStage visibility(Nullable visibility); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + IdStage, + MemberCountStage, + PublishedReviewsCountStage, + RouteStage, + TitleStage, + UpdatedAtStage, + VerifiedStage, + _FinalStage { + private String createdAt; + + private String id; + + private double memberCount; + + private double publishedReviewsCount; + + private String route; + + private String title; + + private String updatedAt; + + private boolean verified; + + private Optional visibility = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private List labels = new ArrayList<>(); + + private Optional headline = Optional.empty(); + + private List galleryImages = new ArrayList<>(); + + private Optional externalIdentifier = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProductListItem other) { + createdAt(other.getCreatedAt()); + externalIdentifier(other.getExternalIdentifier()); + galleryImages(other.getGalleryImages()); + headline(other.getHeadline()); + id(other.getId()); + labels(other.getLabels()); + memberCount(other.getMemberCount()); + metadata(other.getMetadata()); + publishedReviewsCount(other.getPublishedReviewsCount()); + route(other.getRoute()); + title(other.getTitle()); + updatedAt(other.getUpdatedAt()); + verified(other.getVerified()); + visibility(other.getVisibility()); + return this; + } + + /** + *

When the product was created, as an ISO 8601 timestamp.

+ *

When the product was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Product ID, prefixed prod_.

+ *

Product ID, prefixed prod_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MemberCountStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Active memberships for this product; 0 if public member counts are disabled.

+ *

Active memberships for this product; 0 if public member counts are disabled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("member_count") + public PublishedReviewsCountStage memberCount(double memberCount) { + this.memberCount = memberCount; + return this; + } + + /** + *

Published customer reviews for this product.

+ *

Published customer reviews for this product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("published_reviews_count") + public RouteStage publishedReviewsCount(double publishedReviewsCount) { + this.publishedReviewsCount = publishedReviewsCount; + return this; + } + + /** + *

URL slug for the product's public link.

+ *

URL slug for the product's public link.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

Product display name shown to customers.

+ *

Product display name shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public UpdatedAtStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

When the product was last updated, as an ISO 8601 timestamp.

+ *

When the product was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public VerifiedStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

Whether the product has been verified by Whop.

+ *

Whether the product has been verified by Whop.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("verified") + public _FinalStage verified(boolean verified) { + this.verified = verified; + return this; + } + + /** + *

Whether the product is publicly visible, hidden, or archived.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(Nullable visibility) { + if (visibility.isNull()) { + this.visibility = null; + } else if (visibility.isEmpty()) { + this.visibility = Optional.empty(); + } else { + this.visibility = Optional.of(visibility.get()); + } + return this; + } + + /** + *

Whether the product is publicly visible, hidden, or archived.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage visibility(String visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + /** + *

Whether the product is publicly visible, hidden, or archived.

+ */ + @java.lang.Override + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public _FinalStage visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + /** + *

Custom key-value pairs stored on the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs stored on the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs stored on the product.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + @java.lang.Override + public _FinalStage addAllLabels(List labels) { + if (labels != null) { + this.labels.addAll(labels); + } + return this; + } + + @java.lang.Override + public _FinalStage addLabels(String labels) { + this.labels.add(labels); + return this; + } + + @java.lang.Override + @JsonSetter(value = "labels", nulls = Nulls.SKIP) + public _FinalStage labels(List labels) { + this.labels.clear(); + if (labels != null) { + this.labels.addAll(labels); + } + return this; + } + + /** + *

Short marketing headline displayed on product page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage headline(Nullable headline) { + if (headline.isNull()) { + this.headline = null; + } else if (headline.isEmpty()) { + this.headline = Optional.empty(); + } else { + this.headline = Optional.of(headline.get()); + } + return this; + } + + /** + *

Short marketing headline displayed on product page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage headline(String headline) { + this.headline = Optional.ofNullable(headline); + return this; + } + + /** + *

Short marketing headline displayed on product page.

+ */ + @java.lang.Override + @JsonSetter(value = "headline", nulls = Nulls.SKIP) + public _FinalStage headline(Optional headline) { + this.headline = headline; + return this; + } + + @java.lang.Override + public _FinalStage addAllGalleryImages(List galleryImages) { + if (galleryImages != null) { + this.galleryImages.addAll(galleryImages); + } + return this; + } + + @java.lang.Override + public _FinalStage addGalleryImages(ProductGalleryImage galleryImages) { + this.galleryImages.add(galleryImages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "gallery_images", nulls = Nulls.SKIP) + public _FinalStage galleryImages(List galleryImages) { + this.galleryImages.clear(); + if (galleryImages != null) { + this.galleryImages.addAll(galleryImages); + } + return this; + } + + /** + *

External identifier stored on the product for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage externalIdentifier(Nullable externalIdentifier) { + if (externalIdentifier.isNull()) { + this.externalIdentifier = null; + } else if (externalIdentifier.isEmpty()) { + this.externalIdentifier = Optional.empty(); + } else { + this.externalIdentifier = Optional.of(externalIdentifier.get()); + } + return this; + } + + /** + *

External identifier stored on the product for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage externalIdentifier(String externalIdentifier) { + this.externalIdentifier = Optional.ofNullable(externalIdentifier); + return this; + } + + /** + *

External identifier stored on the product for your own reference.

+ */ + @java.lang.Override + @JsonSetter(value = "external_identifier", nulls = Nulls.SKIP) + public _FinalStage externalIdentifier(Optional externalIdentifier) { + this.externalIdentifier = externalIdentifier; + return this; + } + + @java.lang.Override + public ProductListItem build() { + return new ProductListItem( + createdAt, + externalIdentifier, + galleryImages, + headline, + id, + labels, + memberCount, + metadata, + publishedReviewsCount, + route, + title, + updatedAt, + verified, + visibility, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ProductMarketplaceStatus.java b/src/main/java/com/whop/api/types/ProductMarketplaceStatus.java new file mode 100644 index 00000000..818d7eb5 --- /dev/null +++ b/src/main/java/com/whop/api/types/ProductMarketplaceStatus.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ProductMarketplaceStatus { + public static final ProductMarketplaceStatus PENDING_REVIEW = + new ProductMarketplaceStatus(Value.PENDING_REVIEW, "pending_review"); + + public static final ProductMarketplaceStatus NOT_AVAILABLE = + new ProductMarketplaceStatus(Value.NOT_AVAILABLE, "not_available"); + + public static final ProductMarketplaceStatus LIVE_MARKETPLACE = + new ProductMarketplaceStatus(Value.LIVE_MARKETPLACE, "live_marketplace"); + + private final Value value; + + private final String string; + + ProductMarketplaceStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ProductMarketplaceStatus + && this.string.equals(((ProductMarketplaceStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING_REVIEW: + return visitor.visitPendingReview(); + case NOT_AVAILABLE: + return visitor.visitNotAvailable(); + case LIVE_MARKETPLACE: + return visitor.visitLiveMarketplace(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ProductMarketplaceStatus valueOf(String value) { + switch (value) { + case "pending_review": + return PENDING_REVIEW; + case "not_available": + return NOT_AVAILABLE; + case "live_marketplace": + return LIVE_MARKETPLACE; + default: + return new ProductMarketplaceStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + NOT_AVAILABLE, + + PENDING_REVIEW, + + LIVE_MARKETPLACE, + + UNKNOWN + } + + public interface Visitor { + T visitNotAvailable(); + + T visitPendingReview(); + + T visitLiveMarketplace(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ProductMemberAffiliateStatus.java b/src/main/java/com/whop/api/types/ProductMemberAffiliateStatus.java new file mode 100644 index 00000000..90877033 --- /dev/null +++ b/src/main/java/com/whop/api/types/ProductMemberAffiliateStatus.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ProductMemberAffiliateStatus { + public static final ProductMemberAffiliateStatus ENABLED = + new ProductMemberAffiliateStatus(Value.ENABLED, "enabled"); + + public static final ProductMemberAffiliateStatus DISABLED = + new ProductMemberAffiliateStatus(Value.DISABLED, "disabled"); + + private final Value value; + + private final String string; + + ProductMemberAffiliateStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ProductMemberAffiliateStatus + && this.string.equals(((ProductMemberAffiliateStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ENABLED: + return visitor.visitEnabled(); + case DISABLED: + return visitor.visitDisabled(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ProductMemberAffiliateStatus valueOf(String value) { + switch (value) { + case "enabled": + return ENABLED; + case "disabled": + return DISABLED; + default: + return new ProductMemberAffiliateStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ENABLED, + + DISABLED, + + UNKNOWN + } + + public interface Visitor { + T visitEnabled(); + + T visitDisabled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ProductTaxCodeProductTypes.java b/src/main/java/com/whop/api/types/ProductTaxCodeProductTypes.java new file mode 100644 index 00000000..da42b8ab --- /dev/null +++ b/src/main/java/com/whop/api/types/ProductTaxCodeProductTypes.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ProductTaxCodeProductTypes { + public static final ProductTaxCodeProductTypes SERVICES = + new ProductTaxCodeProductTypes(Value.SERVICES, "services"); + + public static final ProductTaxCodeProductTypes DIGITAL = new ProductTaxCodeProductTypes(Value.DIGITAL, "digital"); + + public static final ProductTaxCodeProductTypes PHYSICAL = + new ProductTaxCodeProductTypes(Value.PHYSICAL, "physical"); + + private final Value value; + + private final String string; + + ProductTaxCodeProductTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ProductTaxCodeProductTypes + && this.string.equals(((ProductTaxCodeProductTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SERVICES: + return visitor.visitServices(); + case DIGITAL: + return visitor.visitDigital(); + case PHYSICAL: + return visitor.visitPhysical(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ProductTaxCodeProductTypes valueOf(String value) { + switch (value) { + case "services": + return SERVICES; + case "digital": + return DIGITAL; + case "physical": + return PHYSICAL; + default: + return new ProductTaxCodeProductTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + PHYSICAL, + + DIGITAL, + + SERVICES, + + UNKNOWN + } + + public interface Visitor { + T visitPhysical(); + + T visitDigital(); + + T visitServices(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PromoCode.java b/src/main/java/com/whop/api/types/PromoCode.java new file mode 100644 index 00000000..a1ebdfab --- /dev/null +++ b/src/main/java/com/whop/api/types/PromoCode.java @@ -0,0 +1,1062 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PromoCode.Builder.class) +public final class PromoCode { + private final AccountSummary account; + + private final double amountOff; + + private final boolean churnedUsersOnly; + + private final Optional code; + + private final String createdAt; + + private final PromoCodeCurrency currency; + + private final PromoCodeDuration duration; + + private final boolean existingMembershipsOnly; + + private final Optional expiresAt; + + private final String id; + + private final Map metadata; + + private final boolean newUsersOnly; + + private final boolean onePerCustomer; + + private final Optional product; + + private final Optional promoDurationMonths; + + private final PromoCodePromoType promoType; + + private final PromoCodeStatus status; + + private final int stock; + + private final boolean unlimitedStock; + + private final String updatedAt; + + private final int uses; + + private final Map additionalProperties; + + private PromoCode( + AccountSummary account, + double amountOff, + boolean churnedUsersOnly, + Optional code, + String createdAt, + PromoCodeCurrency currency, + PromoCodeDuration duration, + boolean existingMembershipsOnly, + Optional expiresAt, + String id, + Map metadata, + boolean newUsersOnly, + boolean onePerCustomer, + Optional product, + Optional promoDurationMonths, + PromoCodePromoType promoType, + PromoCodeStatus status, + int stock, + boolean unlimitedStock, + String updatedAt, + int uses, + Map additionalProperties) { + this.account = account; + this.amountOff = amountOff; + this.churnedUsersOnly = churnedUsersOnly; + this.code = code; + this.createdAt = createdAt; + this.currency = currency; + this.duration = duration; + this.existingMembershipsOnly = existingMembershipsOnly; + this.expiresAt = expiresAt; + this.id = id; + this.metadata = metadata; + this.newUsersOnly = newUsersOnly; + this.onePerCustomer = onePerCustomer; + this.product = product; + this.promoDurationMonths = promoDurationMonths; + this.promoType = promoType; + this.status = status; + this.stock = stock; + this.unlimitedStock = unlimitedStock; + this.updatedAt = updatedAt; + this.uses = uses; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account that owns the promo code. + */ + @JsonProperty("account") + public AccountSummary getAccount() { + return account; + } + + /** + * @return Discount amount. Percentage discounts are represented as a decimal fraction. + */ + @JsonProperty("amount_off") + public double getAmountOff() { + return amountOff; + } + + /** + * @return Whether the promo code is restricted to churned customers. + */ + @JsonProperty("churned_users_only") + public boolean getChurnedUsersOnly() { + return churnedUsersOnly; + } + + /** + * @return Code entered at checkout. + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + /** + * @return When the promo code was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Currency used for a fixed-amount discount. + */ + @JsonProperty("currency") + public PromoCodeCurrency getCurrency() { + return currency; + } + + /** + * @return How long the discount applies. + */ + @JsonProperty("duration") + public PromoCodeDuration getDuration() { + return duration; + } + + /** + * @return Whether the promo code applies only to existing memberships. + */ + @JsonProperty("existing_memberships_only") + public boolean getExistingMembershipsOnly() { + return existingMembershipsOnly; + } + + /** + * @return When the promo code expires, as an ISO 8601 timestamp. + */ + @JsonIgnore + public Optional getExpiresAt() { + if (expiresAt == null) { + return Optional.empty(); + } + return expiresAt; + } + + /** + * @return Promo code ID, prefixed promo_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom key-value metadata stored on the promo code. + */ + @JsonProperty("metadata") + public Map getMetadata() { + return metadata; + } + + /** + * @return Whether the promo code is restricted to new customers. + */ + @JsonProperty("new_users_only") + public boolean getNewUsersOnly() { + return newUsersOnly; + } + + /** + * @return Whether each customer may redeem the promo code only once. + */ + @JsonProperty("one_per_customer") + public boolean getOnePerCustomer() { + return onePerCustomer; + } + + /** + * @return Product the promo code is restricted to, or null when it is not product-scoped. + */ + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return Billing intervals the discount applies to. + */ + @JsonIgnore + public Optional getPromoDurationMonths() { + if (promoDurationMonths == null) { + return Optional.empty(); + } + return promoDurationMonths; + } + + /** + * @return Whether the discount is percentage-based or a fixed amount. + */ + @JsonProperty("promo_type") + public PromoCodePromoType getPromoType() { + return promoType; + } + + /** + * @return Promo code lifecycle status. + */ + @JsonProperty("status") + public PromoCodeStatus getStatus() { + return status; + } + + /** + * @return Maximum uses when stock is limited. + */ + @JsonProperty("stock") + public int getStock() { + return stock; + } + + /** + * @return Whether the promo code has no redemption limit. + */ + @JsonProperty("unlimited_stock") + public boolean getUnlimitedStock() { + return unlimitedStock; + } + + /** + * @return When the promo code was updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return Memberships that used the promo code. + */ + @JsonProperty("uses") + public int getUses() { + return uses; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expires_at") + private Optional _getExpiresAt() { + return expiresAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("promo_duration_months") + private Optional _getPromoDurationMonths() { + return promoDurationMonths; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PromoCode && equalTo((PromoCode) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PromoCode other) { + return account.equals(other.account) + && amountOff == other.amountOff + && churnedUsersOnly == other.churnedUsersOnly + && code.equals(other.code) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && duration.equals(other.duration) + && existingMembershipsOnly == other.existingMembershipsOnly + && expiresAt.equals(other.expiresAt) + && id.equals(other.id) + && metadata.equals(other.metadata) + && newUsersOnly == other.newUsersOnly + && onePerCustomer == other.onePerCustomer + && product.equals(other.product) + && promoDurationMonths.equals(other.promoDurationMonths) + && promoType.equals(other.promoType) + && status.equals(other.status) + && stock == other.stock + && unlimitedStock == other.unlimitedStock + && updatedAt.equals(other.updatedAt) + && uses == other.uses; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.account, + this.amountOff, + this.churnedUsersOnly, + this.code, + this.createdAt, + this.currency, + this.duration, + this.existingMembershipsOnly, + this.expiresAt, + this.id, + this.metadata, + this.newUsersOnly, + this.onePerCustomer, + this.product, + this.promoDurationMonths, + this.promoType, + this.status, + this.stock, + this.unlimitedStock, + this.updatedAt, + this.uses); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountStage builder() { + return new Builder(); + } + + public interface AccountStage { + /** + *

Account that owns the promo code.

+ */ + AmountOffStage account(@NotNull AccountSummary account); + + Builder from(PromoCode other); + } + + public interface AmountOffStage { + /** + *

Discount amount. Percentage discounts are represented as a decimal fraction.

+ */ + ChurnedUsersOnlyStage amountOff(double amountOff); + } + + public interface ChurnedUsersOnlyStage { + /** + *

Whether the promo code is restricted to churned customers.

+ */ + CreatedAtStage churnedUsersOnly(boolean churnedUsersOnly); + } + + public interface CreatedAtStage { + /** + *

When the promo code was created, as an ISO 8601 timestamp.

+ */ + CurrencyStage createdAt(@NotNull String createdAt); + } + + public interface CurrencyStage { + /** + *

Currency used for a fixed-amount discount.

+ */ + DurationStage currency(@NotNull PromoCodeCurrency currency); + } + + public interface DurationStage { + /** + *

How long the discount applies.

+ */ + ExistingMembershipsOnlyStage duration(@NotNull PromoCodeDuration duration); + } + + public interface ExistingMembershipsOnlyStage { + /** + *

Whether the promo code applies only to existing memberships.

+ */ + IdStage existingMembershipsOnly(boolean existingMembershipsOnly); + } + + public interface IdStage { + /** + *

Promo code ID, prefixed promo_.

+ */ + NewUsersOnlyStage id(@NotNull String id); + } + + public interface NewUsersOnlyStage { + /** + *

Whether the promo code is restricted to new customers.

+ */ + OnePerCustomerStage newUsersOnly(boolean newUsersOnly); + } + + public interface OnePerCustomerStage { + /** + *

Whether each customer may redeem the promo code only once.

+ */ + PromoTypeStage onePerCustomer(boolean onePerCustomer); + } + + public interface PromoTypeStage { + /** + *

Whether the discount is percentage-based or a fixed amount.

+ */ + StatusStage promoType(@NotNull PromoCodePromoType promoType); + } + + public interface StatusStage { + /** + *

Promo code lifecycle status.

+ */ + StockStage status(@NotNull PromoCodeStatus status); + } + + public interface StockStage { + /** + *

Maximum uses when stock is limited.

+ */ + UnlimitedStockStage stock(int stock); + } + + public interface UnlimitedStockStage { + /** + *

Whether the promo code has no redemption limit.

+ */ + UpdatedAtStage unlimitedStock(boolean unlimitedStock); + } + + public interface UpdatedAtStage { + /** + *

When the promo code was updated, as an ISO 8601 timestamp.

+ */ + UsesStage updatedAt(@NotNull String updatedAt); + } + + public interface UsesStage { + /** + *

Memberships that used the promo code.

+ */ + _FinalStage uses(int uses); + } + + public interface _FinalStage { + PromoCode build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Code entered at checkout.

+ */ + _FinalStage code(Optional code); + + _FinalStage code(String code); + + _FinalStage code(Nullable code); + + /** + *

When the promo code expires, as an ISO 8601 timestamp.

+ */ + _FinalStage expiresAt(Optional expiresAt); + + _FinalStage expiresAt(String expiresAt); + + _FinalStage expiresAt(Nullable expiresAt); + + /** + *

Custom key-value metadata stored on the promo code.

+ */ + _FinalStage metadata(Map metadata); + + _FinalStage putAllMetadata(Map metadata); + + _FinalStage metadata(String key, Object value); + + /** + *

Product the promo code is restricted to, or null when it is not product-scoped.

+ */ + _FinalStage product(Optional product); + + _FinalStage product(PromoCodeProduct product); + + _FinalStage product(Nullable product); + + /** + *

Billing intervals the discount applies to.

+ */ + _FinalStage promoDurationMonths(Optional promoDurationMonths); + + _FinalStage promoDurationMonths(Integer promoDurationMonths); + + _FinalStage promoDurationMonths(Nullable promoDurationMonths); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountStage, + AmountOffStage, + ChurnedUsersOnlyStage, + CreatedAtStage, + CurrencyStage, + DurationStage, + ExistingMembershipsOnlyStage, + IdStage, + NewUsersOnlyStage, + OnePerCustomerStage, + PromoTypeStage, + StatusStage, + StockStage, + UnlimitedStockStage, + UpdatedAtStage, + UsesStage, + _FinalStage { + private AccountSummary account; + + private double amountOff; + + private boolean churnedUsersOnly; + + private String createdAt; + + private PromoCodeCurrency currency; + + private PromoCodeDuration duration; + + private boolean existingMembershipsOnly; + + private String id; + + private boolean newUsersOnly; + + private boolean onePerCustomer; + + private PromoCodePromoType promoType; + + private PromoCodeStatus status; + + private int stock; + + private boolean unlimitedStock; + + private String updatedAt; + + private int uses; + + private Optional promoDurationMonths = Optional.empty(); + + private Optional product = Optional.empty(); + + private Map metadata = new LinkedHashMap<>(); + + private Optional expiresAt = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PromoCode other) { + account(other.getAccount()); + amountOff(other.getAmountOff()); + churnedUsersOnly(other.getChurnedUsersOnly()); + code(other.getCode()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + duration(other.getDuration()); + existingMembershipsOnly(other.getExistingMembershipsOnly()); + expiresAt(other.getExpiresAt()); + id(other.getId()); + metadata(other.getMetadata()); + newUsersOnly(other.getNewUsersOnly()); + onePerCustomer(other.getOnePerCustomer()); + product(other.getProduct()); + promoDurationMonths(other.getPromoDurationMonths()); + promoType(other.getPromoType()); + status(other.getStatus()); + stock(other.getStock()); + unlimitedStock(other.getUnlimitedStock()); + updatedAt(other.getUpdatedAt()); + uses(other.getUses()); + return this; + } + + /** + *

Account that owns the promo code.

+ *

Account that owns the promo code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account") + public AmountOffStage account(@NotNull AccountSummary account) { + this.account = Objects.requireNonNull(account, "account must not be null"); + return this; + } + + /** + *

Discount amount. Percentage discounts are represented as a decimal fraction.

+ *

Discount amount. Percentage discounts are represented as a decimal fraction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount_off") + public ChurnedUsersOnlyStage amountOff(double amountOff) { + this.amountOff = amountOff; + return this; + } + + /** + *

Whether the promo code is restricted to churned customers.

+ *

Whether the promo code is restricted to churned customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("churned_users_only") + public CreatedAtStage churnedUsersOnly(boolean churnedUsersOnly) { + this.churnedUsersOnly = churnedUsersOnly; + return this; + } + + /** + *

When the promo code was created, as an ISO 8601 timestamp.

+ *

When the promo code was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Currency used for a fixed-amount discount.

+ *

Currency used for a fixed-amount discount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DurationStage currency(@NotNull PromoCodeCurrency currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

How long the discount applies.

+ *

How long the discount applies.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("duration") + public ExistingMembershipsOnlyStage duration(@NotNull PromoCodeDuration duration) { + this.duration = Objects.requireNonNull(duration, "duration must not be null"); + return this; + } + + /** + *

Whether the promo code applies only to existing memberships.

+ *

Whether the promo code applies only to existing memberships.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("existing_memberships_only") + public IdStage existingMembershipsOnly(boolean existingMembershipsOnly) { + this.existingMembershipsOnly = existingMembershipsOnly; + return this; + } + + /** + *

Promo code ID, prefixed promo_.

+ *

Promo code ID, prefixed promo_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NewUsersOnlyStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether the promo code is restricted to new customers.

+ *

Whether the promo code is restricted to new customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("new_users_only") + public OnePerCustomerStage newUsersOnly(boolean newUsersOnly) { + this.newUsersOnly = newUsersOnly; + return this; + } + + /** + *

Whether each customer may redeem the promo code only once.

+ *

Whether each customer may redeem the promo code only once.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("one_per_customer") + public PromoTypeStage onePerCustomer(boolean onePerCustomer) { + this.onePerCustomer = onePerCustomer; + return this; + } + + /** + *

Whether the discount is percentage-based or a fixed amount.

+ *

Whether the discount is percentage-based or a fixed amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("promo_type") + public StatusStage promoType(@NotNull PromoCodePromoType promoType) { + this.promoType = Objects.requireNonNull(promoType, "promoType must not be null"); + return this; + } + + /** + *

Promo code lifecycle status.

+ *

Promo code lifecycle status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public StockStage status(@NotNull PromoCodeStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Maximum uses when stock is limited.

+ *

Maximum uses when stock is limited.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("stock") + public UnlimitedStockStage stock(int stock) { + this.stock = stock; + return this; + } + + /** + *

Whether the promo code has no redemption limit.

+ *

Whether the promo code has no redemption limit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("unlimited_stock") + public UpdatedAtStage unlimitedStock(boolean unlimitedStock) { + this.unlimitedStock = unlimitedStock; + return this; + } + + /** + *

When the promo code was updated, as an ISO 8601 timestamp.

+ *

When the promo code was updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UsesStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

Memberships that used the promo code.

+ *

Memberships that used the promo code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("uses") + public _FinalStage uses(int uses) { + this.uses = uses; + return this; + } + + /** + *

Billing intervals the discount applies to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoDurationMonths(Nullable promoDurationMonths) { + if (promoDurationMonths.isNull()) { + this.promoDurationMonths = null; + } else if (promoDurationMonths.isEmpty()) { + this.promoDurationMonths = Optional.empty(); + } else { + this.promoDurationMonths = Optional.of(promoDurationMonths.get()); + } + return this; + } + + /** + *

Billing intervals the discount applies to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoDurationMonths(Integer promoDurationMonths) { + this.promoDurationMonths = Optional.ofNullable(promoDurationMonths); + return this; + } + + /** + *

Billing intervals the discount applies to.

+ */ + @java.lang.Override + @JsonSetter(value = "promo_duration_months", nulls = Nulls.SKIP) + public _FinalStage promoDurationMonths(Optional promoDurationMonths) { + this.promoDurationMonths = promoDurationMonths; + return this; + } + + /** + *

Product the promo code is restricted to, or null when it is not product-scoped.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

Product the promo code is restricted to, or null when it is not product-scoped.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(PromoCodeProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

Product the promo code is restricted to, or null when it is not product-scoped.

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

Custom key-value metadata stored on the promo code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(String key, Object value) { + this.metadata.put(key, value); + return this; + } + + /** + *

Custom key-value metadata stored on the promo code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllMetadata(Map metadata) { + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Custom key-value metadata stored on the promo code.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Map metadata) { + this.metadata.clear(); + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

When the promo code expires, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expiresAt(Nullable expiresAt) { + if (expiresAt.isNull()) { + this.expiresAt = null; + } else if (expiresAt.isEmpty()) { + this.expiresAt = Optional.empty(); + } else { + this.expiresAt = Optional.of(expiresAt.get()); + } + return this; + } + + /** + *

When the promo code expires, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expiresAt(String expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + /** + *

When the promo code expires, as an ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public _FinalStage expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + *

Code entered at checkout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

Code entered at checkout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

Code entered at checkout.

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public PromoCode build() { + return new PromoCode( + account, + amountOff, + churnedUsersOnly, + code, + createdAt, + currency, + duration, + existingMembershipsOnly, + expiresAt, + id, + metadata, + newUsersOnly, + onePerCustomer, + product, + promoDurationMonths, + promoType, + status, + stock, + unlimitedStock, + updatedAt, + uses, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PromoCodeCurrency.java b/src/main/java/com/whop/api/types/PromoCodeCurrency.java new file mode 100644 index 00000000..1be2ccdd --- /dev/null +++ b/src/main/java/com/whop/api/types/PromoCodeCurrency.java @@ -0,0 +1,963 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PromoCodeCurrency { + public static final PromoCodeCurrency CRC = new PromoCodeCurrency(Value.CRC, "crc"); + + public static final PromoCodeCurrency OMR = new PromoCodeCurrency(Value.OMR, "omr"); + + public static final PromoCodeCurrency RUB = new PromoCodeCurrency(Value.RUB, "rub"); + + public static final PromoCodeCurrency BGN = new PromoCodeCurrency(Value.BGN, "bgn"); + + public static final PromoCodeCurrency SAR = new PromoCodeCurrency(Value.SAR, "sar"); + + public static final PromoCodeCurrency UYU = new PromoCodeCurrency(Value.UYU, "uyu"); + + public static final PromoCodeCurrency TZS = new PromoCodeCurrency(Value.TZS, "tzs"); + + public static final PromoCodeCurrency XCD = new PromoCodeCurrency(Value.XCD, "xcd"); + + public static final PromoCodeCurrency GTQ = new PromoCodeCurrency(Value.GTQ, "gtq"); + + public static final PromoCodeCurrency CHF = new PromoCodeCurrency(Value.CHF, "chf"); + + public static final PromoCodeCurrency RON = new PromoCodeCurrency(Value.RON, "ron"); + + public static final PromoCodeCurrency PHP = new PromoCodeCurrency(Value.PHP, "php"); + + public static final PromoCodeCurrency KES = new PromoCodeCurrency(Value.KES, "kes"); + + public static final PromoCodeCurrency XAU = new PromoCodeCurrency(Value.XAU, "xau"); + + public static final PromoCodeCurrency BSD = new PromoCodeCurrency(Value.BSD, "bsd"); + + public static final PromoCodeCurrency INR = new PromoCodeCurrency(Value.INR, "inr"); + + public static final PromoCodeCurrency HKD = new PromoCodeCurrency(Value.HKD, "hkd"); + + public static final PromoCodeCurrency JOD = new PromoCodeCurrency(Value.JOD, "jod"); + + public static final PromoCodeCurrency MKD = new PromoCodeCurrency(Value.MKD, "mkd"); + + public static final PromoCodeCurrency CLP = new PromoCodeCurrency(Value.CLP, "clp"); + + public static final PromoCodeCurrency NZD = new PromoCodeCurrency(Value.NZD, "nzd"); + + public static final PromoCodeCurrency IDR = new PromoCodeCurrency(Value.IDR, "idr"); + + public static final PromoCodeCurrency MOP = new PromoCodeCurrency(Value.MOP, "mop"); + + public static final PromoCodeCurrency HUF = new PromoCodeCurrency(Value.HUF, "huf"); + + public static final PromoCodeCurrency MAD = new PromoCodeCurrency(Value.MAD, "mad"); + + public static final PromoCodeCurrency KHR = new PromoCodeCurrency(Value.KHR, "khr"); + + public static final PromoCodeCurrency NGN = new PromoCodeCurrency(Value.NGN, "ngn"); + + public static final PromoCodeCurrency THB = new PromoCodeCurrency(Value.THB, "thb"); + + public static final PromoCodeCurrency DZD = new PromoCodeCurrency(Value.DZD, "dzd"); + + public static final PromoCodeCurrency ARS = new PromoCodeCurrency(Value.ARS, "ars"); + + public static final PromoCodeCurrency CAD = new PromoCodeCurrency(Value.CAD, "cad"); + + public static final PromoCodeCurrency MYR = new PromoCodeCurrency(Value.MYR, "myr"); + + public static final PromoCodeCurrency KRW = new PromoCodeCurrency(Value.KRW, "krw"); + + public static final PromoCodeCurrency KZT = new PromoCodeCurrency(Value.KZT, "kzt"); + + public static final PromoCodeCurrency ETH = new PromoCodeCurrency(Value.ETH, "eth"); + + public static final PromoCodeCurrency COP = new PromoCodeCurrency(Value.COP, "cop"); + + public static final PromoCodeCurrency JMD = new PromoCodeCurrency(Value.JMD, "jmd"); + + public static final PromoCodeCurrency NAD = new PromoCodeCurrency(Value.NAD, "nad"); + + public static final PromoCodeCurrency GYD = new PromoCodeCurrency(Value.GYD, "gyd"); + + public static final PromoCodeCurrency KWD = new PromoCodeCurrency(Value.KWD, "kwd"); + + public static final PromoCodeCurrency DOP = new PromoCodeCurrency(Value.DOP, "dop"); + + public static final PromoCodeCurrency BTC = new PromoCodeCurrency(Value.BTC, "btc"); + + public static final PromoCodeCurrency AMD = new PromoCodeCurrency(Value.AMD, "amd"); + + public static final PromoCodeCurrency LKR = new PromoCodeCurrency(Value.LKR, "lkr"); + + public static final PromoCodeCurrency ALL = new PromoCodeCurrency(Value.ALL, "all"); + + public static final PromoCodeCurrency USDT = new PromoCodeCurrency(Value.USDT, "usdt"); + + public static final PromoCodeCurrency TND = new PromoCodeCurrency(Value.TND, "tnd"); + + public static final PromoCodeCurrency MUR = new PromoCodeCurrency(Value.MUR, "mur"); + + public static final PromoCodeCurrency PEN = new PromoCodeCurrency(Value.PEN, "pen"); + + public static final PromoCodeCurrency USD = new PromoCodeCurrency(Value.USD, "usd"); + + public static final PromoCodeCurrency APE = new PromoCodeCurrency(Value.APE, "ape"); + + public static final PromoCodeCurrency BHD = new PromoCodeCurrency(Value.BHD, "bhd"); + + public static final PromoCodeCurrency XOF = new PromoCodeCurrency(Value.XOF, "xof"); + + public static final PromoCodeCurrency RWF = new PromoCodeCurrency(Value.RWF, "rwf"); + + public static final PromoCodeCurrency GBP = new PromoCodeCurrency(Value.GBP, "gbp"); + + public static final PromoCodeCurrency VND = new PromoCodeCurrency(Value.VND, "vnd"); + + public static final PromoCodeCurrency MNT = new PromoCodeCurrency(Value.MNT, "mnt"); + + public static final PromoCodeCurrency ETB = new PromoCodeCurrency(Value.ETB, "etb"); + + public static final PromoCodeCurrency TTD = new PromoCodeCurrency(Value.TTD, "ttd"); + + public static final PromoCodeCurrency EUR = new PromoCodeCurrency(Value.EUR, "eur"); + + public static final PromoCodeCurrency BRL = new PromoCodeCurrency(Value.BRL, "brl"); + + public static final PromoCodeCurrency SEK = new PromoCodeCurrency(Value.SEK, "sek"); + + public static final PromoCodeCurrency RSD = new PromoCodeCurrency(Value.RSD, "rsd"); + + public static final PromoCodeCurrency UZS = new PromoCodeCurrency(Value.UZS, "uzs"); + + public static final PromoCodeCurrency TWD = new PromoCodeCurrency(Value.TWD, "twd"); + + public static final PromoCodeCurrency NOK = new PromoCodeCurrency(Value.NOK, "nok"); + + public static final PromoCodeCurrency WHOP_USD = new PromoCodeCurrency(Value.WHOP_USD, "whop_usd"); + + public static final PromoCodeCurrency PYG = new PromoCodeCurrency(Value.PYG, "pyg"); + + public static final PromoCodeCurrency TRY = new PromoCodeCurrency(Value.TRY, "try"); + + public static final PromoCodeCurrency ZAR = new PromoCodeCurrency(Value.ZAR, "zar"); + + public static final PromoCodeCurrency PKR = new PromoCodeCurrency(Value.PKR, "pkr"); + + public static final PromoCodeCurrency CNY = new PromoCodeCurrency(Value.CNY, "cny"); + + public static final PromoCodeCurrency CZK = new PromoCodeCurrency(Value.CZK, "czk"); + + public static final PromoCodeCurrency ILS = new PromoCodeCurrency(Value.ILS, "ils"); + + public static final PromoCodeCurrency MGA = new PromoCodeCurrency(Value.MGA, "mga"); + + public static final PromoCodeCurrency AED = new PromoCodeCurrency(Value.AED, "aed"); + + public static final PromoCodeCurrency GHS = new PromoCodeCurrency(Value.GHS, "ghs"); + + public static final PromoCodeCurrency BAM = new PromoCodeCurrency(Value.BAM, "bam"); + + public static final PromoCodeCurrency JPY = new PromoCodeCurrency(Value.JPY, "jpy"); + + public static final PromoCodeCurrency PLN = new PromoCodeCurrency(Value.PLN, "pln"); + + public static final PromoCodeCurrency BOB = new PromoCodeCurrency(Value.BOB, "bob"); + + public static final PromoCodeCurrency QAR = new PromoCodeCurrency(Value.QAR, "qar"); + + public static final PromoCodeCurrency EGP = new PromoCodeCurrency(Value.EGP, "egp"); + + public static final PromoCodeCurrency AWG = new PromoCodeCurrency(Value.AWG, "awg"); + + public static final PromoCodeCurrency DKK = new PromoCodeCurrency(Value.DKK, "dkk"); + + public static final PromoCodeCurrency MDL = new PromoCodeCurrency(Value.MDL, "mdl"); + + public static final PromoCodeCurrency MXN = new PromoCodeCurrency(Value.MXN, "mxn"); + + public static final PromoCodeCurrency SGD = new PromoCodeCurrency(Value.SGD, "sgd"); + + public static final PromoCodeCurrency AUD = new PromoCodeCurrency(Value.AUD, "aud"); + + public static final PromoCodeCurrency GMD = new PromoCodeCurrency(Value.GMD, "gmd"); + + private final Value value; + + private final String string; + + PromoCodeCurrency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PromoCodeCurrency && this.string.equals(((PromoCodeCurrency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CRC: + return visitor.visitCrc(); + case OMR: + return visitor.visitOmr(); + case RUB: + return visitor.visitRub(); + case BGN: + return visitor.visitBgn(); + case SAR: + return visitor.visitSar(); + case UYU: + return visitor.visitUyu(); + case TZS: + return visitor.visitTzs(); + case XCD: + return visitor.visitXcd(); + case GTQ: + return visitor.visitGtq(); + case CHF: + return visitor.visitChf(); + case RON: + return visitor.visitRon(); + case PHP: + return visitor.visitPhp(); + case KES: + return visitor.visitKes(); + case XAU: + return visitor.visitXau(); + case BSD: + return visitor.visitBsd(); + case INR: + return visitor.visitInr(); + case HKD: + return visitor.visitHkd(); + case JOD: + return visitor.visitJod(); + case MKD: + return visitor.visitMkd(); + case CLP: + return visitor.visitClp(); + case NZD: + return visitor.visitNzd(); + case IDR: + return visitor.visitIdr(); + case MOP: + return visitor.visitMop(); + case HUF: + return visitor.visitHuf(); + case MAD: + return visitor.visitMad(); + case KHR: + return visitor.visitKhr(); + case NGN: + return visitor.visitNgn(); + case THB: + return visitor.visitThb(); + case DZD: + return visitor.visitDzd(); + case ARS: + return visitor.visitArs(); + case CAD: + return visitor.visitCad(); + case MYR: + return visitor.visitMyr(); + case KRW: + return visitor.visitKrw(); + case KZT: + return visitor.visitKzt(); + case ETH: + return visitor.visitEth(); + case COP: + return visitor.visitCop(); + case JMD: + return visitor.visitJmd(); + case NAD: + return visitor.visitNad(); + case GYD: + return visitor.visitGyd(); + case KWD: + return visitor.visitKwd(); + case DOP: + return visitor.visitDop(); + case BTC: + return visitor.visitBtc(); + case AMD: + return visitor.visitAmd(); + case LKR: + return visitor.visitLkr(); + case ALL: + return visitor.visitAll(); + case USDT: + return visitor.visitUsdt(); + case TND: + return visitor.visitTnd(); + case MUR: + return visitor.visitMur(); + case PEN: + return visitor.visitPen(); + case USD: + return visitor.visitUsd(); + case APE: + return visitor.visitApe(); + case BHD: + return visitor.visitBhd(); + case XOF: + return visitor.visitXof(); + case RWF: + return visitor.visitRwf(); + case GBP: + return visitor.visitGbp(); + case VND: + return visitor.visitVnd(); + case MNT: + return visitor.visitMnt(); + case ETB: + return visitor.visitEtb(); + case TTD: + return visitor.visitTtd(); + case EUR: + return visitor.visitEur(); + case BRL: + return visitor.visitBrl(); + case SEK: + return visitor.visitSek(); + case RSD: + return visitor.visitRsd(); + case UZS: + return visitor.visitUzs(); + case TWD: + return visitor.visitTwd(); + case NOK: + return visitor.visitNok(); + case WHOP_USD: + return visitor.visitWhopUsd(); + case PYG: + return visitor.visitPyg(); + case TRY: + return visitor.visitTry(); + case ZAR: + return visitor.visitZar(); + case PKR: + return visitor.visitPkr(); + case CNY: + return visitor.visitCny(); + case CZK: + return visitor.visitCzk(); + case ILS: + return visitor.visitIls(); + case MGA: + return visitor.visitMga(); + case AED: + return visitor.visitAed(); + case GHS: + return visitor.visitGhs(); + case BAM: + return visitor.visitBam(); + case JPY: + return visitor.visitJpy(); + case PLN: + return visitor.visitPln(); + case BOB: + return visitor.visitBob(); + case QAR: + return visitor.visitQar(); + case EGP: + return visitor.visitEgp(); + case AWG: + return visitor.visitAwg(); + case DKK: + return visitor.visitDkk(); + case MDL: + return visitor.visitMdl(); + case MXN: + return visitor.visitMxn(); + case SGD: + return visitor.visitSgd(); + case AUD: + return visitor.visitAud(); + case GMD: + return visitor.visitGmd(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PromoCodeCurrency valueOf(String value) { + switch (value) { + case "crc": + return CRC; + case "omr": + return OMR; + case "rub": + return RUB; + case "bgn": + return BGN; + case "sar": + return SAR; + case "uyu": + return UYU; + case "tzs": + return TZS; + case "xcd": + return XCD; + case "gtq": + return GTQ; + case "chf": + return CHF; + case "ron": + return RON; + case "php": + return PHP; + case "kes": + return KES; + case "xau": + return XAU; + case "bsd": + return BSD; + case "inr": + return INR; + case "hkd": + return HKD; + case "jod": + return JOD; + case "mkd": + return MKD; + case "clp": + return CLP; + case "nzd": + return NZD; + case "idr": + return IDR; + case "mop": + return MOP; + case "huf": + return HUF; + case "mad": + return MAD; + case "khr": + return KHR; + case "ngn": + return NGN; + case "thb": + return THB; + case "dzd": + return DZD; + case "ars": + return ARS; + case "cad": + return CAD; + case "myr": + return MYR; + case "krw": + return KRW; + case "kzt": + return KZT; + case "eth": + return ETH; + case "cop": + return COP; + case "jmd": + return JMD; + case "nad": + return NAD; + case "gyd": + return GYD; + case "kwd": + return KWD; + case "dop": + return DOP; + case "btc": + return BTC; + case "amd": + return AMD; + case "lkr": + return LKR; + case "all": + return ALL; + case "usdt": + return USDT; + case "tnd": + return TND; + case "mur": + return MUR; + case "pen": + return PEN; + case "usd": + return USD; + case "ape": + return APE; + case "bhd": + return BHD; + case "xof": + return XOF; + case "rwf": + return RWF; + case "gbp": + return GBP; + case "vnd": + return VND; + case "mnt": + return MNT; + case "etb": + return ETB; + case "ttd": + return TTD; + case "eur": + return EUR; + case "brl": + return BRL; + case "sek": + return SEK; + case "rsd": + return RSD; + case "uzs": + return UZS; + case "twd": + return TWD; + case "nok": + return NOK; + case "whop_usd": + return WHOP_USD; + case "pyg": + return PYG; + case "try": + return TRY; + case "zar": + return ZAR; + case "pkr": + return PKR; + case "cny": + return CNY; + case "czk": + return CZK; + case "ils": + return ILS; + case "mga": + return MGA; + case "aed": + return AED; + case "ghs": + return GHS; + case "bam": + return BAM; + case "jpy": + return JPY; + case "pln": + return PLN; + case "bob": + return BOB; + case "qar": + return QAR; + case "egp": + return EGP; + case "awg": + return AWG; + case "dkk": + return DKK; + case "mdl": + return MDL; + case "mxn": + return MXN; + case "sgd": + return SGD; + case "aud": + return AUD; + case "gmd": + return GMD; + default: + return new PromoCodeCurrency(Value.UNKNOWN, value); + } + } + + public enum Value { + USD, + + SGD, + + INR, + + AUD, + + BRL, + + CAD, + + DKK, + + EUR, + + NOK, + + GBP, + + SEK, + + CHF, + + HKD, + + HUF, + + JPY, + + MXN, + + MYR, + + PLN, + + CZK, + + NZD, + + AED, + + ETH, + + APE, + + COP, + + RON, + + THB, + + BGN, + + IDR, + + DOP, + + PHP, + + TRY, + + KRW, + + TWD, + + VND, + + PKR, + + CLP, + + UYU, + + ARS, + + ZAR, + + DZD, + + TND, + + MAD, + + KES, + + KWD, + + JOD, + + ALL, + + XCD, + + AMD, + + BSD, + + BHD, + + BOB, + + BAM, + + KHR, + + CRC, + + XOF, + + EGP, + + ETB, + + GMD, + + GHS, + + GTQ, + + GYD, + + ILS, + + JMD, + + MOP, + + MGA, + + MUR, + + MDL, + + MNT, + + NAD, + + NGN, + + MKD, + + OMR, + + PYG, + + PEN, + + QAR, + + RWF, + + SAR, + + RSD, + + LKR, + + TZS, + + TTD, + + UZS, + + RUB, + + BTC, + + CNY, + + USDT, + + KZT, + + AWG, + + WHOP_USD, + + XAU, + + UNKNOWN + } + + public interface Visitor { + T visitUsd(); + + T visitSgd(); + + T visitInr(); + + T visitAud(); + + T visitBrl(); + + T visitCad(); + + T visitDkk(); + + T visitEur(); + + T visitNok(); + + T visitGbp(); + + T visitSek(); + + T visitChf(); + + T visitHkd(); + + T visitHuf(); + + T visitJpy(); + + T visitMxn(); + + T visitMyr(); + + T visitPln(); + + T visitCzk(); + + T visitNzd(); + + T visitAed(); + + T visitEth(); + + T visitApe(); + + T visitCop(); + + T visitRon(); + + T visitThb(); + + T visitBgn(); + + T visitIdr(); + + T visitDop(); + + T visitPhp(); + + T visitTry(); + + T visitKrw(); + + T visitTwd(); + + T visitVnd(); + + T visitPkr(); + + T visitClp(); + + T visitUyu(); + + T visitArs(); + + T visitZar(); + + T visitDzd(); + + T visitTnd(); + + T visitMad(); + + T visitKes(); + + T visitKwd(); + + T visitJod(); + + T visitAll(); + + T visitXcd(); + + T visitAmd(); + + T visitBsd(); + + T visitBhd(); + + T visitBob(); + + T visitBam(); + + T visitKhr(); + + T visitCrc(); + + T visitXof(); + + T visitEgp(); + + T visitEtb(); + + T visitGmd(); + + T visitGhs(); + + T visitGtq(); + + T visitGyd(); + + T visitIls(); + + T visitJmd(); + + T visitMop(); + + T visitMga(); + + T visitMur(); + + T visitMdl(); + + T visitMnt(); + + T visitNad(); + + T visitNgn(); + + T visitMkd(); + + T visitOmr(); + + T visitPyg(); + + T visitPen(); + + T visitQar(); + + T visitRwf(); + + T visitSar(); + + T visitRsd(); + + T visitLkr(); + + T visitTzs(); + + T visitTtd(); + + T visitUzs(); + + T visitRub(); + + T visitBtc(); + + T visitCny(); + + T visitUsdt(); + + T visitKzt(); + + T visitAwg(); + + T visitWhopUsd(); + + T visitXau(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PromoCodeDuration.java b/src/main/java/com/whop/api/types/PromoCodeDuration.java new file mode 100644 index 00000000..ced820da --- /dev/null +++ b/src/main/java/com/whop/api/types/PromoCodeDuration.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PromoCodeDuration { + public static final PromoCodeDuration REPEATING = new PromoCodeDuration(Value.REPEATING, "repeating"); + + public static final PromoCodeDuration ONCE = new PromoCodeDuration(Value.ONCE, "once"); + + public static final PromoCodeDuration FOREVER = new PromoCodeDuration(Value.FOREVER, "forever"); + + private final Value value; + + private final String string; + + PromoCodeDuration(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PromoCodeDuration && this.string.equals(((PromoCodeDuration) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REPEATING: + return visitor.visitRepeating(); + case ONCE: + return visitor.visitOnce(); + case FOREVER: + return visitor.visitForever(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PromoCodeDuration valueOf(String value) { + switch (value) { + case "repeating": + return REPEATING; + case "once": + return ONCE; + case "forever": + return FOREVER; + default: + return new PromoCodeDuration(Value.UNKNOWN, value); + } + } + + public enum Value { + FOREVER, + + ONCE, + + REPEATING, + + UNKNOWN + } + + public interface Visitor { + T visitForever(); + + T visitOnce(); + + T visitRepeating(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PromoCodeListItem.java b/src/main/java/com/whop/api/types/PromoCodeListItem.java new file mode 100644 index 00000000..8704d907 --- /dev/null +++ b/src/main/java/com/whop/api/types/PromoCodeListItem.java @@ -0,0 +1,1024 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PromoCodeListItem.Builder.class) +public final class PromoCodeListItem { + private final double amountOff; + + private final boolean churnedUsersOnly; + + private final Optional code; + + private final String createdAt; + + private final PromoCodeListItemCurrency currency; + + private final PromoCodeListItemDuration duration; + + private final boolean existingMembershipsOnly; + + private final Optional expiresAt; + + private final String id; + + private final Map metadata; + + private final boolean newUsersOnly; + + private final boolean onePerCustomer; + + private final Optional product; + + private final Optional promoDurationMonths; + + private final PromoCodeListItemPromoType promoType; + + private final PromoCodeListItemStatus status; + + private final int stock; + + private final boolean unlimitedStock; + + private final String updatedAt; + + private final int uses; + + private final Map additionalProperties; + + private PromoCodeListItem( + double amountOff, + boolean churnedUsersOnly, + Optional code, + String createdAt, + PromoCodeListItemCurrency currency, + PromoCodeListItemDuration duration, + boolean existingMembershipsOnly, + Optional expiresAt, + String id, + Map metadata, + boolean newUsersOnly, + boolean onePerCustomer, + Optional product, + Optional promoDurationMonths, + PromoCodeListItemPromoType promoType, + PromoCodeListItemStatus status, + int stock, + boolean unlimitedStock, + String updatedAt, + int uses, + Map additionalProperties) { + this.amountOff = amountOff; + this.churnedUsersOnly = churnedUsersOnly; + this.code = code; + this.createdAt = createdAt; + this.currency = currency; + this.duration = duration; + this.existingMembershipsOnly = existingMembershipsOnly; + this.expiresAt = expiresAt; + this.id = id; + this.metadata = metadata; + this.newUsersOnly = newUsersOnly; + this.onePerCustomer = onePerCustomer; + this.product = product; + this.promoDurationMonths = promoDurationMonths; + this.promoType = promoType; + this.status = status; + this.stock = stock; + this.unlimitedStock = unlimitedStock; + this.updatedAt = updatedAt; + this.uses = uses; + this.additionalProperties = additionalProperties; + } + + /** + * @return Discount amount. Percentage discounts are represented as a decimal fraction. + */ + @JsonProperty("amount_off") + public double getAmountOff() { + return amountOff; + } + + /** + * @return Whether the promo code is restricted to churned customers. + */ + @JsonProperty("churned_users_only") + public boolean getChurnedUsersOnly() { + return churnedUsersOnly; + } + + /** + * @return Code entered at checkout. + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + /** + * @return When the promo code was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Currency used for a fixed-amount discount. + */ + @JsonProperty("currency") + public PromoCodeListItemCurrency getCurrency() { + return currency; + } + + /** + * @return How long the discount applies. + */ + @JsonProperty("duration") + public PromoCodeListItemDuration getDuration() { + return duration; + } + + /** + * @return Whether the promo code applies only to existing memberships. + */ + @JsonProperty("existing_memberships_only") + public boolean getExistingMembershipsOnly() { + return existingMembershipsOnly; + } + + /** + * @return When the promo code expires, as an ISO 8601 timestamp. + */ + @JsonIgnore + public Optional getExpiresAt() { + if (expiresAt == null) { + return Optional.empty(); + } + return expiresAt; + } + + /** + * @return Promo code ID, prefixed promo_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom key-value metadata stored on the promo code. + */ + @JsonProperty("metadata") + public Map getMetadata() { + return metadata; + } + + /** + * @return Whether the promo code is restricted to new customers. + */ + @JsonProperty("new_users_only") + public boolean getNewUsersOnly() { + return newUsersOnly; + } + + /** + * @return Whether each customer may redeem the promo code only once. + */ + @JsonProperty("one_per_customer") + public boolean getOnePerCustomer() { + return onePerCustomer; + } + + /** + * @return Product the promo code is restricted to, or null when it is not product-scoped. + */ + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return Billing intervals the discount applies to. + */ + @JsonIgnore + public Optional getPromoDurationMonths() { + if (promoDurationMonths == null) { + return Optional.empty(); + } + return promoDurationMonths; + } + + /** + * @return Whether the discount is percentage-based or a fixed amount. + */ + @JsonProperty("promo_type") + public PromoCodeListItemPromoType getPromoType() { + return promoType; + } + + /** + * @return Promo code lifecycle status. + */ + @JsonProperty("status") + public PromoCodeListItemStatus getStatus() { + return status; + } + + /** + * @return Maximum uses when stock is limited. + */ + @JsonProperty("stock") + public int getStock() { + return stock; + } + + /** + * @return Whether the promo code has no redemption limit. + */ + @JsonProperty("unlimited_stock") + public boolean getUnlimitedStock() { + return unlimitedStock; + } + + /** + * @return When the promo code was updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return Memberships that used the promo code. + */ + @JsonProperty("uses") + public int getUses() { + return uses; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("expires_at") + private Optional _getExpiresAt() { + return expiresAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("promo_duration_months") + private Optional _getPromoDurationMonths() { + return promoDurationMonths; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PromoCodeListItem && equalTo((PromoCodeListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PromoCodeListItem other) { + return amountOff == other.amountOff + && churnedUsersOnly == other.churnedUsersOnly + && code.equals(other.code) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && duration.equals(other.duration) + && existingMembershipsOnly == other.existingMembershipsOnly + && expiresAt.equals(other.expiresAt) + && id.equals(other.id) + && metadata.equals(other.metadata) + && newUsersOnly == other.newUsersOnly + && onePerCustomer == other.onePerCustomer + && product.equals(other.product) + && promoDurationMonths.equals(other.promoDurationMonths) + && promoType.equals(other.promoType) + && status.equals(other.status) + && stock == other.stock + && unlimitedStock == other.unlimitedStock + && updatedAt.equals(other.updatedAt) + && uses == other.uses; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amountOff, + this.churnedUsersOnly, + this.code, + this.createdAt, + this.currency, + this.duration, + this.existingMembershipsOnly, + this.expiresAt, + this.id, + this.metadata, + this.newUsersOnly, + this.onePerCustomer, + this.product, + this.promoDurationMonths, + this.promoType, + this.status, + this.stock, + this.unlimitedStock, + this.updatedAt, + this.uses); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountOffStage builder() { + return new Builder(); + } + + public interface AmountOffStage { + /** + *

Discount amount. Percentage discounts are represented as a decimal fraction.

+ */ + ChurnedUsersOnlyStage amountOff(double amountOff); + + Builder from(PromoCodeListItem other); + } + + public interface ChurnedUsersOnlyStage { + /** + *

Whether the promo code is restricted to churned customers.

+ */ + CreatedAtStage churnedUsersOnly(boolean churnedUsersOnly); + } + + public interface CreatedAtStage { + /** + *

When the promo code was created, as an ISO 8601 timestamp.

+ */ + CurrencyStage createdAt(@NotNull String createdAt); + } + + public interface CurrencyStage { + /** + *

Currency used for a fixed-amount discount.

+ */ + DurationStage currency(@NotNull PromoCodeListItemCurrency currency); + } + + public interface DurationStage { + /** + *

How long the discount applies.

+ */ + ExistingMembershipsOnlyStage duration(@NotNull PromoCodeListItemDuration duration); + } + + public interface ExistingMembershipsOnlyStage { + /** + *

Whether the promo code applies only to existing memberships.

+ */ + IdStage existingMembershipsOnly(boolean existingMembershipsOnly); + } + + public interface IdStage { + /** + *

Promo code ID, prefixed promo_.

+ */ + NewUsersOnlyStage id(@NotNull String id); + } + + public interface NewUsersOnlyStage { + /** + *

Whether the promo code is restricted to new customers.

+ */ + OnePerCustomerStage newUsersOnly(boolean newUsersOnly); + } + + public interface OnePerCustomerStage { + /** + *

Whether each customer may redeem the promo code only once.

+ */ + PromoTypeStage onePerCustomer(boolean onePerCustomer); + } + + public interface PromoTypeStage { + /** + *

Whether the discount is percentage-based or a fixed amount.

+ */ + StatusStage promoType(@NotNull PromoCodeListItemPromoType promoType); + } + + public interface StatusStage { + /** + *

Promo code lifecycle status.

+ */ + StockStage status(@NotNull PromoCodeListItemStatus status); + } + + public interface StockStage { + /** + *

Maximum uses when stock is limited.

+ */ + UnlimitedStockStage stock(int stock); + } + + public interface UnlimitedStockStage { + /** + *

Whether the promo code has no redemption limit.

+ */ + UpdatedAtStage unlimitedStock(boolean unlimitedStock); + } + + public interface UpdatedAtStage { + /** + *

When the promo code was updated, as an ISO 8601 timestamp.

+ */ + UsesStage updatedAt(@NotNull String updatedAt); + } + + public interface UsesStage { + /** + *

Memberships that used the promo code.

+ */ + _FinalStage uses(int uses); + } + + public interface _FinalStage { + PromoCodeListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Code entered at checkout.

+ */ + _FinalStage code(Optional code); + + _FinalStage code(String code); + + _FinalStage code(Nullable code); + + /** + *

When the promo code expires, as an ISO 8601 timestamp.

+ */ + _FinalStage expiresAt(Optional expiresAt); + + _FinalStage expiresAt(String expiresAt); + + _FinalStage expiresAt(Nullable expiresAt); + + /** + *

Custom key-value metadata stored on the promo code.

+ */ + _FinalStage metadata(Map metadata); + + _FinalStage putAllMetadata(Map metadata); + + _FinalStage metadata(String key, Object value); + + /** + *

Product the promo code is restricted to, or null when it is not product-scoped.

+ */ + _FinalStage product(Optional product); + + _FinalStage product(PromoCodeProduct product); + + _FinalStage product(Nullable product); + + /** + *

Billing intervals the discount applies to.

+ */ + _FinalStage promoDurationMonths(Optional promoDurationMonths); + + _FinalStage promoDurationMonths(Integer promoDurationMonths); + + _FinalStage promoDurationMonths(Nullable promoDurationMonths); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountOffStage, + ChurnedUsersOnlyStage, + CreatedAtStage, + CurrencyStage, + DurationStage, + ExistingMembershipsOnlyStage, + IdStage, + NewUsersOnlyStage, + OnePerCustomerStage, + PromoTypeStage, + StatusStage, + StockStage, + UnlimitedStockStage, + UpdatedAtStage, + UsesStage, + _FinalStage { + private double amountOff; + + private boolean churnedUsersOnly; + + private String createdAt; + + private PromoCodeListItemCurrency currency; + + private PromoCodeListItemDuration duration; + + private boolean existingMembershipsOnly; + + private String id; + + private boolean newUsersOnly; + + private boolean onePerCustomer; + + private PromoCodeListItemPromoType promoType; + + private PromoCodeListItemStatus status; + + private int stock; + + private boolean unlimitedStock; + + private String updatedAt; + + private int uses; + + private Optional promoDurationMonths = Optional.empty(); + + private Optional product = Optional.empty(); + + private Map metadata = new LinkedHashMap<>(); + + private Optional expiresAt = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PromoCodeListItem other) { + amountOff(other.getAmountOff()); + churnedUsersOnly(other.getChurnedUsersOnly()); + code(other.getCode()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + duration(other.getDuration()); + existingMembershipsOnly(other.getExistingMembershipsOnly()); + expiresAt(other.getExpiresAt()); + id(other.getId()); + metadata(other.getMetadata()); + newUsersOnly(other.getNewUsersOnly()); + onePerCustomer(other.getOnePerCustomer()); + product(other.getProduct()); + promoDurationMonths(other.getPromoDurationMonths()); + promoType(other.getPromoType()); + status(other.getStatus()); + stock(other.getStock()); + unlimitedStock(other.getUnlimitedStock()); + updatedAt(other.getUpdatedAt()); + uses(other.getUses()); + return this; + } + + /** + *

Discount amount. Percentage discounts are represented as a decimal fraction.

+ *

Discount amount. Percentage discounts are represented as a decimal fraction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount_off") + public ChurnedUsersOnlyStage amountOff(double amountOff) { + this.amountOff = amountOff; + return this; + } + + /** + *

Whether the promo code is restricted to churned customers.

+ *

Whether the promo code is restricted to churned customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("churned_users_only") + public CreatedAtStage churnedUsersOnly(boolean churnedUsersOnly) { + this.churnedUsersOnly = churnedUsersOnly; + return this; + } + + /** + *

When the promo code was created, as an ISO 8601 timestamp.

+ *

When the promo code was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Currency used for a fixed-amount discount.

+ *

Currency used for a fixed-amount discount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DurationStage currency(@NotNull PromoCodeListItemCurrency currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

How long the discount applies.

+ *

How long the discount applies.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("duration") + public ExistingMembershipsOnlyStage duration(@NotNull PromoCodeListItemDuration duration) { + this.duration = Objects.requireNonNull(duration, "duration must not be null"); + return this; + } + + /** + *

Whether the promo code applies only to existing memberships.

+ *

Whether the promo code applies only to existing memberships.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("existing_memberships_only") + public IdStage existingMembershipsOnly(boolean existingMembershipsOnly) { + this.existingMembershipsOnly = existingMembershipsOnly; + return this; + } + + /** + *

Promo code ID, prefixed promo_.

+ *

Promo code ID, prefixed promo_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NewUsersOnlyStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether the promo code is restricted to new customers.

+ *

Whether the promo code is restricted to new customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("new_users_only") + public OnePerCustomerStage newUsersOnly(boolean newUsersOnly) { + this.newUsersOnly = newUsersOnly; + return this; + } + + /** + *

Whether each customer may redeem the promo code only once.

+ *

Whether each customer may redeem the promo code only once.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("one_per_customer") + public PromoTypeStage onePerCustomer(boolean onePerCustomer) { + this.onePerCustomer = onePerCustomer; + return this; + } + + /** + *

Whether the discount is percentage-based or a fixed amount.

+ *

Whether the discount is percentage-based or a fixed amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("promo_type") + public StatusStage promoType(@NotNull PromoCodeListItemPromoType promoType) { + this.promoType = Objects.requireNonNull(promoType, "promoType must not be null"); + return this; + } + + /** + *

Promo code lifecycle status.

+ *

Promo code lifecycle status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public StockStage status(@NotNull PromoCodeListItemStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Maximum uses when stock is limited.

+ *

Maximum uses when stock is limited.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("stock") + public UnlimitedStockStage stock(int stock) { + this.stock = stock; + return this; + } + + /** + *

Whether the promo code has no redemption limit.

+ *

Whether the promo code has no redemption limit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("unlimited_stock") + public UpdatedAtStage unlimitedStock(boolean unlimitedStock) { + this.unlimitedStock = unlimitedStock; + return this; + } + + /** + *

When the promo code was updated, as an ISO 8601 timestamp.

+ *

When the promo code was updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UsesStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

Memberships that used the promo code.

+ *

Memberships that used the promo code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("uses") + public _FinalStage uses(int uses) { + this.uses = uses; + return this; + } + + /** + *

Billing intervals the discount applies to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoDurationMonths(Nullable promoDurationMonths) { + if (promoDurationMonths.isNull()) { + this.promoDurationMonths = null; + } else if (promoDurationMonths.isEmpty()) { + this.promoDurationMonths = Optional.empty(); + } else { + this.promoDurationMonths = Optional.of(promoDurationMonths.get()); + } + return this; + } + + /** + *

Billing intervals the discount applies to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage promoDurationMonths(Integer promoDurationMonths) { + this.promoDurationMonths = Optional.ofNullable(promoDurationMonths); + return this; + } + + /** + *

Billing intervals the discount applies to.

+ */ + @java.lang.Override + @JsonSetter(value = "promo_duration_months", nulls = Nulls.SKIP) + public _FinalStage promoDurationMonths(Optional promoDurationMonths) { + this.promoDurationMonths = promoDurationMonths; + return this; + } + + /** + *

Product the promo code is restricted to, or null when it is not product-scoped.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

Product the promo code is restricted to, or null when it is not product-scoped.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(PromoCodeProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

Product the promo code is restricted to, or null when it is not product-scoped.

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

Custom key-value metadata stored on the promo code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(String key, Object value) { + this.metadata.put(key, value); + return this; + } + + /** + *

Custom key-value metadata stored on the promo code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllMetadata(Map metadata) { + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

Custom key-value metadata stored on the promo code.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Map metadata) { + this.metadata.clear(); + if (metadata != null) { + this.metadata.putAll(metadata); + } + return this; + } + + /** + *

When the promo code expires, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expiresAt(Nullable expiresAt) { + if (expiresAt.isNull()) { + this.expiresAt = null; + } else if (expiresAt.isEmpty()) { + this.expiresAt = Optional.empty(); + } else { + this.expiresAt = Optional.of(expiresAt.get()); + } + return this; + } + + /** + *

When the promo code expires, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expiresAt(String expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + /** + *

When the promo code expires, as an ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public _FinalStage expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + *

Code entered at checkout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

Code entered at checkout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

Code entered at checkout.

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public PromoCodeListItem build() { + return new PromoCodeListItem( + amountOff, + churnedUsersOnly, + code, + createdAt, + currency, + duration, + existingMembershipsOnly, + expiresAt, + id, + metadata, + newUsersOnly, + onePerCustomer, + product, + promoDurationMonths, + promoType, + status, + stock, + unlimitedStock, + updatedAt, + uses, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PromoCodeListItemCurrency.java b/src/main/java/com/whop/api/types/PromoCodeListItemCurrency.java new file mode 100644 index 00000000..d9c99c09 --- /dev/null +++ b/src/main/java/com/whop/api/types/PromoCodeListItemCurrency.java @@ -0,0 +1,964 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PromoCodeListItemCurrency { + public static final PromoCodeListItemCurrency CRC = new PromoCodeListItemCurrency(Value.CRC, "crc"); + + public static final PromoCodeListItemCurrency OMR = new PromoCodeListItemCurrency(Value.OMR, "omr"); + + public static final PromoCodeListItemCurrency RUB = new PromoCodeListItemCurrency(Value.RUB, "rub"); + + public static final PromoCodeListItemCurrency BGN = new PromoCodeListItemCurrency(Value.BGN, "bgn"); + + public static final PromoCodeListItemCurrency SAR = new PromoCodeListItemCurrency(Value.SAR, "sar"); + + public static final PromoCodeListItemCurrency UYU = new PromoCodeListItemCurrency(Value.UYU, "uyu"); + + public static final PromoCodeListItemCurrency TZS = new PromoCodeListItemCurrency(Value.TZS, "tzs"); + + public static final PromoCodeListItemCurrency XCD = new PromoCodeListItemCurrency(Value.XCD, "xcd"); + + public static final PromoCodeListItemCurrency GTQ = new PromoCodeListItemCurrency(Value.GTQ, "gtq"); + + public static final PromoCodeListItemCurrency CHF = new PromoCodeListItemCurrency(Value.CHF, "chf"); + + public static final PromoCodeListItemCurrency RON = new PromoCodeListItemCurrency(Value.RON, "ron"); + + public static final PromoCodeListItemCurrency PHP = new PromoCodeListItemCurrency(Value.PHP, "php"); + + public static final PromoCodeListItemCurrency KES = new PromoCodeListItemCurrency(Value.KES, "kes"); + + public static final PromoCodeListItemCurrency XAU = new PromoCodeListItemCurrency(Value.XAU, "xau"); + + public static final PromoCodeListItemCurrency BSD = new PromoCodeListItemCurrency(Value.BSD, "bsd"); + + public static final PromoCodeListItemCurrency INR = new PromoCodeListItemCurrency(Value.INR, "inr"); + + public static final PromoCodeListItemCurrency HKD = new PromoCodeListItemCurrency(Value.HKD, "hkd"); + + public static final PromoCodeListItemCurrency JOD = new PromoCodeListItemCurrency(Value.JOD, "jod"); + + public static final PromoCodeListItemCurrency MKD = new PromoCodeListItemCurrency(Value.MKD, "mkd"); + + public static final PromoCodeListItemCurrency CLP = new PromoCodeListItemCurrency(Value.CLP, "clp"); + + public static final PromoCodeListItemCurrency NZD = new PromoCodeListItemCurrency(Value.NZD, "nzd"); + + public static final PromoCodeListItemCurrency IDR = new PromoCodeListItemCurrency(Value.IDR, "idr"); + + public static final PromoCodeListItemCurrency MOP = new PromoCodeListItemCurrency(Value.MOP, "mop"); + + public static final PromoCodeListItemCurrency HUF = new PromoCodeListItemCurrency(Value.HUF, "huf"); + + public static final PromoCodeListItemCurrency MAD = new PromoCodeListItemCurrency(Value.MAD, "mad"); + + public static final PromoCodeListItemCurrency KHR = new PromoCodeListItemCurrency(Value.KHR, "khr"); + + public static final PromoCodeListItemCurrency NGN = new PromoCodeListItemCurrency(Value.NGN, "ngn"); + + public static final PromoCodeListItemCurrency THB = new PromoCodeListItemCurrency(Value.THB, "thb"); + + public static final PromoCodeListItemCurrency DZD = new PromoCodeListItemCurrency(Value.DZD, "dzd"); + + public static final PromoCodeListItemCurrency ARS = new PromoCodeListItemCurrency(Value.ARS, "ars"); + + public static final PromoCodeListItemCurrency CAD = new PromoCodeListItemCurrency(Value.CAD, "cad"); + + public static final PromoCodeListItemCurrency MYR = new PromoCodeListItemCurrency(Value.MYR, "myr"); + + public static final PromoCodeListItemCurrency KRW = new PromoCodeListItemCurrency(Value.KRW, "krw"); + + public static final PromoCodeListItemCurrency KZT = new PromoCodeListItemCurrency(Value.KZT, "kzt"); + + public static final PromoCodeListItemCurrency ETH = new PromoCodeListItemCurrency(Value.ETH, "eth"); + + public static final PromoCodeListItemCurrency COP = new PromoCodeListItemCurrency(Value.COP, "cop"); + + public static final PromoCodeListItemCurrency JMD = new PromoCodeListItemCurrency(Value.JMD, "jmd"); + + public static final PromoCodeListItemCurrency NAD = new PromoCodeListItemCurrency(Value.NAD, "nad"); + + public static final PromoCodeListItemCurrency GYD = new PromoCodeListItemCurrency(Value.GYD, "gyd"); + + public static final PromoCodeListItemCurrency KWD = new PromoCodeListItemCurrency(Value.KWD, "kwd"); + + public static final PromoCodeListItemCurrency DOP = new PromoCodeListItemCurrency(Value.DOP, "dop"); + + public static final PromoCodeListItemCurrency BTC = new PromoCodeListItemCurrency(Value.BTC, "btc"); + + public static final PromoCodeListItemCurrency AMD = new PromoCodeListItemCurrency(Value.AMD, "amd"); + + public static final PromoCodeListItemCurrency LKR = new PromoCodeListItemCurrency(Value.LKR, "lkr"); + + public static final PromoCodeListItemCurrency ALL = new PromoCodeListItemCurrency(Value.ALL, "all"); + + public static final PromoCodeListItemCurrency USDT = new PromoCodeListItemCurrency(Value.USDT, "usdt"); + + public static final PromoCodeListItemCurrency TND = new PromoCodeListItemCurrency(Value.TND, "tnd"); + + public static final PromoCodeListItemCurrency MUR = new PromoCodeListItemCurrency(Value.MUR, "mur"); + + public static final PromoCodeListItemCurrency PEN = new PromoCodeListItemCurrency(Value.PEN, "pen"); + + public static final PromoCodeListItemCurrency USD = new PromoCodeListItemCurrency(Value.USD, "usd"); + + public static final PromoCodeListItemCurrency APE = new PromoCodeListItemCurrency(Value.APE, "ape"); + + public static final PromoCodeListItemCurrency BHD = new PromoCodeListItemCurrency(Value.BHD, "bhd"); + + public static final PromoCodeListItemCurrency XOF = new PromoCodeListItemCurrency(Value.XOF, "xof"); + + public static final PromoCodeListItemCurrency RWF = new PromoCodeListItemCurrency(Value.RWF, "rwf"); + + public static final PromoCodeListItemCurrency GBP = new PromoCodeListItemCurrency(Value.GBP, "gbp"); + + public static final PromoCodeListItemCurrency VND = new PromoCodeListItemCurrency(Value.VND, "vnd"); + + public static final PromoCodeListItemCurrency MNT = new PromoCodeListItemCurrency(Value.MNT, "mnt"); + + public static final PromoCodeListItemCurrency ETB = new PromoCodeListItemCurrency(Value.ETB, "etb"); + + public static final PromoCodeListItemCurrency TTD = new PromoCodeListItemCurrency(Value.TTD, "ttd"); + + public static final PromoCodeListItemCurrency EUR = new PromoCodeListItemCurrency(Value.EUR, "eur"); + + public static final PromoCodeListItemCurrency BRL = new PromoCodeListItemCurrency(Value.BRL, "brl"); + + public static final PromoCodeListItemCurrency SEK = new PromoCodeListItemCurrency(Value.SEK, "sek"); + + public static final PromoCodeListItemCurrency RSD = new PromoCodeListItemCurrency(Value.RSD, "rsd"); + + public static final PromoCodeListItemCurrency UZS = new PromoCodeListItemCurrency(Value.UZS, "uzs"); + + public static final PromoCodeListItemCurrency TWD = new PromoCodeListItemCurrency(Value.TWD, "twd"); + + public static final PromoCodeListItemCurrency NOK = new PromoCodeListItemCurrency(Value.NOK, "nok"); + + public static final PromoCodeListItemCurrency WHOP_USD = new PromoCodeListItemCurrency(Value.WHOP_USD, "whop_usd"); + + public static final PromoCodeListItemCurrency PYG = new PromoCodeListItemCurrency(Value.PYG, "pyg"); + + public static final PromoCodeListItemCurrency TRY = new PromoCodeListItemCurrency(Value.TRY, "try"); + + public static final PromoCodeListItemCurrency ZAR = new PromoCodeListItemCurrency(Value.ZAR, "zar"); + + public static final PromoCodeListItemCurrency PKR = new PromoCodeListItemCurrency(Value.PKR, "pkr"); + + public static final PromoCodeListItemCurrency CNY = new PromoCodeListItemCurrency(Value.CNY, "cny"); + + public static final PromoCodeListItemCurrency CZK = new PromoCodeListItemCurrency(Value.CZK, "czk"); + + public static final PromoCodeListItemCurrency ILS = new PromoCodeListItemCurrency(Value.ILS, "ils"); + + public static final PromoCodeListItemCurrency MGA = new PromoCodeListItemCurrency(Value.MGA, "mga"); + + public static final PromoCodeListItemCurrency AED = new PromoCodeListItemCurrency(Value.AED, "aed"); + + public static final PromoCodeListItemCurrency GHS = new PromoCodeListItemCurrency(Value.GHS, "ghs"); + + public static final PromoCodeListItemCurrency BAM = new PromoCodeListItemCurrency(Value.BAM, "bam"); + + public static final PromoCodeListItemCurrency JPY = new PromoCodeListItemCurrency(Value.JPY, "jpy"); + + public static final PromoCodeListItemCurrency PLN = new PromoCodeListItemCurrency(Value.PLN, "pln"); + + public static final PromoCodeListItemCurrency BOB = new PromoCodeListItemCurrency(Value.BOB, "bob"); + + public static final PromoCodeListItemCurrency QAR = new PromoCodeListItemCurrency(Value.QAR, "qar"); + + public static final PromoCodeListItemCurrency EGP = new PromoCodeListItemCurrency(Value.EGP, "egp"); + + public static final PromoCodeListItemCurrency AWG = new PromoCodeListItemCurrency(Value.AWG, "awg"); + + public static final PromoCodeListItemCurrency DKK = new PromoCodeListItemCurrency(Value.DKK, "dkk"); + + public static final PromoCodeListItemCurrency MDL = new PromoCodeListItemCurrency(Value.MDL, "mdl"); + + public static final PromoCodeListItemCurrency MXN = new PromoCodeListItemCurrency(Value.MXN, "mxn"); + + public static final PromoCodeListItemCurrency SGD = new PromoCodeListItemCurrency(Value.SGD, "sgd"); + + public static final PromoCodeListItemCurrency AUD = new PromoCodeListItemCurrency(Value.AUD, "aud"); + + public static final PromoCodeListItemCurrency GMD = new PromoCodeListItemCurrency(Value.GMD, "gmd"); + + private final Value value; + + private final String string; + + PromoCodeListItemCurrency(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PromoCodeListItemCurrency + && this.string.equals(((PromoCodeListItemCurrency) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CRC: + return visitor.visitCrc(); + case OMR: + return visitor.visitOmr(); + case RUB: + return visitor.visitRub(); + case BGN: + return visitor.visitBgn(); + case SAR: + return visitor.visitSar(); + case UYU: + return visitor.visitUyu(); + case TZS: + return visitor.visitTzs(); + case XCD: + return visitor.visitXcd(); + case GTQ: + return visitor.visitGtq(); + case CHF: + return visitor.visitChf(); + case RON: + return visitor.visitRon(); + case PHP: + return visitor.visitPhp(); + case KES: + return visitor.visitKes(); + case XAU: + return visitor.visitXau(); + case BSD: + return visitor.visitBsd(); + case INR: + return visitor.visitInr(); + case HKD: + return visitor.visitHkd(); + case JOD: + return visitor.visitJod(); + case MKD: + return visitor.visitMkd(); + case CLP: + return visitor.visitClp(); + case NZD: + return visitor.visitNzd(); + case IDR: + return visitor.visitIdr(); + case MOP: + return visitor.visitMop(); + case HUF: + return visitor.visitHuf(); + case MAD: + return visitor.visitMad(); + case KHR: + return visitor.visitKhr(); + case NGN: + return visitor.visitNgn(); + case THB: + return visitor.visitThb(); + case DZD: + return visitor.visitDzd(); + case ARS: + return visitor.visitArs(); + case CAD: + return visitor.visitCad(); + case MYR: + return visitor.visitMyr(); + case KRW: + return visitor.visitKrw(); + case KZT: + return visitor.visitKzt(); + case ETH: + return visitor.visitEth(); + case COP: + return visitor.visitCop(); + case JMD: + return visitor.visitJmd(); + case NAD: + return visitor.visitNad(); + case GYD: + return visitor.visitGyd(); + case KWD: + return visitor.visitKwd(); + case DOP: + return visitor.visitDop(); + case BTC: + return visitor.visitBtc(); + case AMD: + return visitor.visitAmd(); + case LKR: + return visitor.visitLkr(); + case ALL: + return visitor.visitAll(); + case USDT: + return visitor.visitUsdt(); + case TND: + return visitor.visitTnd(); + case MUR: + return visitor.visitMur(); + case PEN: + return visitor.visitPen(); + case USD: + return visitor.visitUsd(); + case APE: + return visitor.visitApe(); + case BHD: + return visitor.visitBhd(); + case XOF: + return visitor.visitXof(); + case RWF: + return visitor.visitRwf(); + case GBP: + return visitor.visitGbp(); + case VND: + return visitor.visitVnd(); + case MNT: + return visitor.visitMnt(); + case ETB: + return visitor.visitEtb(); + case TTD: + return visitor.visitTtd(); + case EUR: + return visitor.visitEur(); + case BRL: + return visitor.visitBrl(); + case SEK: + return visitor.visitSek(); + case RSD: + return visitor.visitRsd(); + case UZS: + return visitor.visitUzs(); + case TWD: + return visitor.visitTwd(); + case NOK: + return visitor.visitNok(); + case WHOP_USD: + return visitor.visitWhopUsd(); + case PYG: + return visitor.visitPyg(); + case TRY: + return visitor.visitTry(); + case ZAR: + return visitor.visitZar(); + case PKR: + return visitor.visitPkr(); + case CNY: + return visitor.visitCny(); + case CZK: + return visitor.visitCzk(); + case ILS: + return visitor.visitIls(); + case MGA: + return visitor.visitMga(); + case AED: + return visitor.visitAed(); + case GHS: + return visitor.visitGhs(); + case BAM: + return visitor.visitBam(); + case JPY: + return visitor.visitJpy(); + case PLN: + return visitor.visitPln(); + case BOB: + return visitor.visitBob(); + case QAR: + return visitor.visitQar(); + case EGP: + return visitor.visitEgp(); + case AWG: + return visitor.visitAwg(); + case DKK: + return visitor.visitDkk(); + case MDL: + return visitor.visitMdl(); + case MXN: + return visitor.visitMxn(); + case SGD: + return visitor.visitSgd(); + case AUD: + return visitor.visitAud(); + case GMD: + return visitor.visitGmd(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PromoCodeListItemCurrency valueOf(String value) { + switch (value) { + case "crc": + return CRC; + case "omr": + return OMR; + case "rub": + return RUB; + case "bgn": + return BGN; + case "sar": + return SAR; + case "uyu": + return UYU; + case "tzs": + return TZS; + case "xcd": + return XCD; + case "gtq": + return GTQ; + case "chf": + return CHF; + case "ron": + return RON; + case "php": + return PHP; + case "kes": + return KES; + case "xau": + return XAU; + case "bsd": + return BSD; + case "inr": + return INR; + case "hkd": + return HKD; + case "jod": + return JOD; + case "mkd": + return MKD; + case "clp": + return CLP; + case "nzd": + return NZD; + case "idr": + return IDR; + case "mop": + return MOP; + case "huf": + return HUF; + case "mad": + return MAD; + case "khr": + return KHR; + case "ngn": + return NGN; + case "thb": + return THB; + case "dzd": + return DZD; + case "ars": + return ARS; + case "cad": + return CAD; + case "myr": + return MYR; + case "krw": + return KRW; + case "kzt": + return KZT; + case "eth": + return ETH; + case "cop": + return COP; + case "jmd": + return JMD; + case "nad": + return NAD; + case "gyd": + return GYD; + case "kwd": + return KWD; + case "dop": + return DOP; + case "btc": + return BTC; + case "amd": + return AMD; + case "lkr": + return LKR; + case "all": + return ALL; + case "usdt": + return USDT; + case "tnd": + return TND; + case "mur": + return MUR; + case "pen": + return PEN; + case "usd": + return USD; + case "ape": + return APE; + case "bhd": + return BHD; + case "xof": + return XOF; + case "rwf": + return RWF; + case "gbp": + return GBP; + case "vnd": + return VND; + case "mnt": + return MNT; + case "etb": + return ETB; + case "ttd": + return TTD; + case "eur": + return EUR; + case "brl": + return BRL; + case "sek": + return SEK; + case "rsd": + return RSD; + case "uzs": + return UZS; + case "twd": + return TWD; + case "nok": + return NOK; + case "whop_usd": + return WHOP_USD; + case "pyg": + return PYG; + case "try": + return TRY; + case "zar": + return ZAR; + case "pkr": + return PKR; + case "cny": + return CNY; + case "czk": + return CZK; + case "ils": + return ILS; + case "mga": + return MGA; + case "aed": + return AED; + case "ghs": + return GHS; + case "bam": + return BAM; + case "jpy": + return JPY; + case "pln": + return PLN; + case "bob": + return BOB; + case "qar": + return QAR; + case "egp": + return EGP; + case "awg": + return AWG; + case "dkk": + return DKK; + case "mdl": + return MDL; + case "mxn": + return MXN; + case "sgd": + return SGD; + case "aud": + return AUD; + case "gmd": + return GMD; + default: + return new PromoCodeListItemCurrency(Value.UNKNOWN, value); + } + } + + public enum Value { + USD, + + SGD, + + INR, + + AUD, + + BRL, + + CAD, + + DKK, + + EUR, + + NOK, + + GBP, + + SEK, + + CHF, + + HKD, + + HUF, + + JPY, + + MXN, + + MYR, + + PLN, + + CZK, + + NZD, + + AED, + + ETH, + + APE, + + COP, + + RON, + + THB, + + BGN, + + IDR, + + DOP, + + PHP, + + TRY, + + KRW, + + TWD, + + VND, + + PKR, + + CLP, + + UYU, + + ARS, + + ZAR, + + DZD, + + TND, + + MAD, + + KES, + + KWD, + + JOD, + + ALL, + + XCD, + + AMD, + + BSD, + + BHD, + + BOB, + + BAM, + + KHR, + + CRC, + + XOF, + + EGP, + + ETB, + + GMD, + + GHS, + + GTQ, + + GYD, + + ILS, + + JMD, + + MOP, + + MGA, + + MUR, + + MDL, + + MNT, + + NAD, + + NGN, + + MKD, + + OMR, + + PYG, + + PEN, + + QAR, + + RWF, + + SAR, + + RSD, + + LKR, + + TZS, + + TTD, + + UZS, + + RUB, + + BTC, + + CNY, + + USDT, + + KZT, + + AWG, + + WHOP_USD, + + XAU, + + UNKNOWN + } + + public interface Visitor { + T visitUsd(); + + T visitSgd(); + + T visitInr(); + + T visitAud(); + + T visitBrl(); + + T visitCad(); + + T visitDkk(); + + T visitEur(); + + T visitNok(); + + T visitGbp(); + + T visitSek(); + + T visitChf(); + + T visitHkd(); + + T visitHuf(); + + T visitJpy(); + + T visitMxn(); + + T visitMyr(); + + T visitPln(); + + T visitCzk(); + + T visitNzd(); + + T visitAed(); + + T visitEth(); + + T visitApe(); + + T visitCop(); + + T visitRon(); + + T visitThb(); + + T visitBgn(); + + T visitIdr(); + + T visitDop(); + + T visitPhp(); + + T visitTry(); + + T visitKrw(); + + T visitTwd(); + + T visitVnd(); + + T visitPkr(); + + T visitClp(); + + T visitUyu(); + + T visitArs(); + + T visitZar(); + + T visitDzd(); + + T visitTnd(); + + T visitMad(); + + T visitKes(); + + T visitKwd(); + + T visitJod(); + + T visitAll(); + + T visitXcd(); + + T visitAmd(); + + T visitBsd(); + + T visitBhd(); + + T visitBob(); + + T visitBam(); + + T visitKhr(); + + T visitCrc(); + + T visitXof(); + + T visitEgp(); + + T visitEtb(); + + T visitGmd(); + + T visitGhs(); + + T visitGtq(); + + T visitGyd(); + + T visitIls(); + + T visitJmd(); + + T visitMop(); + + T visitMga(); + + T visitMur(); + + T visitMdl(); + + T visitMnt(); + + T visitNad(); + + T visitNgn(); + + T visitMkd(); + + T visitOmr(); + + T visitPyg(); + + T visitPen(); + + T visitQar(); + + T visitRwf(); + + T visitSar(); + + T visitRsd(); + + T visitLkr(); + + T visitTzs(); + + T visitTtd(); + + T visitUzs(); + + T visitRub(); + + T visitBtc(); + + T visitCny(); + + T visitUsdt(); + + T visitKzt(); + + T visitAwg(); + + T visitWhopUsd(); + + T visitXau(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PromoCodeListItemDuration.java b/src/main/java/com/whop/api/types/PromoCodeListItemDuration.java new file mode 100644 index 00000000..0905f62c --- /dev/null +++ b/src/main/java/com/whop/api/types/PromoCodeListItemDuration.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PromoCodeListItemDuration { + public static final PromoCodeListItemDuration REPEATING = + new PromoCodeListItemDuration(Value.REPEATING, "repeating"); + + public static final PromoCodeListItemDuration ONCE = new PromoCodeListItemDuration(Value.ONCE, "once"); + + public static final PromoCodeListItemDuration FOREVER = new PromoCodeListItemDuration(Value.FOREVER, "forever"); + + private final Value value; + + private final String string; + + PromoCodeListItemDuration(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PromoCodeListItemDuration + && this.string.equals(((PromoCodeListItemDuration) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REPEATING: + return visitor.visitRepeating(); + case ONCE: + return visitor.visitOnce(); + case FOREVER: + return visitor.visitForever(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PromoCodeListItemDuration valueOf(String value) { + switch (value) { + case "repeating": + return REPEATING; + case "once": + return ONCE; + case "forever": + return FOREVER; + default: + return new PromoCodeListItemDuration(Value.UNKNOWN, value); + } + } + + public enum Value { + FOREVER, + + ONCE, + + REPEATING, + + UNKNOWN + } + + public interface Visitor { + T visitForever(); + + T visitOnce(); + + T visitRepeating(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PromoCodeListItemPromoType.java b/src/main/java/com/whop/api/types/PromoCodeListItemPromoType.java new file mode 100644 index 00000000..a40c84b2 --- /dev/null +++ b/src/main/java/com/whop/api/types/PromoCodeListItemPromoType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PromoCodeListItemPromoType { + public static final PromoCodeListItemPromoType FLAT_AMOUNT = + new PromoCodeListItemPromoType(Value.FLAT_AMOUNT, "flat_amount"); + + public static final PromoCodeListItemPromoType PERCENTAGE = + new PromoCodeListItemPromoType(Value.PERCENTAGE, "percentage"); + + private final Value value; + + private final String string; + + PromoCodeListItemPromoType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PromoCodeListItemPromoType + && this.string.equals(((PromoCodeListItemPromoType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FLAT_AMOUNT: + return visitor.visitFlatAmount(); + case PERCENTAGE: + return visitor.visitPercentage(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PromoCodeListItemPromoType valueOf(String value) { + switch (value) { + case "flat_amount": + return FLAT_AMOUNT; + case "percentage": + return PERCENTAGE; + default: + return new PromoCodeListItemPromoType(Value.UNKNOWN, value); + } + } + + public enum Value { + PERCENTAGE, + + FLAT_AMOUNT, + + UNKNOWN + } + + public interface Visitor { + T visitPercentage(); + + T visitFlatAmount(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PromoCodeListItemStatus.java b/src/main/java/com/whop/api/types/PromoCodeListItemStatus.java new file mode 100644 index 00000000..3cd0bc38 --- /dev/null +++ b/src/main/java/com/whop/api/types/PromoCodeListItemStatus.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PromoCodeListItemStatus { + public static final PromoCodeListItemStatus INACTIVE = new PromoCodeListItemStatus(Value.INACTIVE, "inactive"); + + public static final PromoCodeListItemStatus ARCHIVED = new PromoCodeListItemStatus(Value.ARCHIVED, "archived"); + + public static final PromoCodeListItemStatus ACTIVE = new PromoCodeListItemStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + PromoCodeListItemStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PromoCodeListItemStatus + && this.string.equals(((PromoCodeListItemStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INACTIVE: + return visitor.visitInactive(); + case ARCHIVED: + return visitor.visitArchived(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PromoCodeListItemStatus valueOf(String value) { + switch (value) { + case "inactive": + return INACTIVE; + case "archived": + return ARCHIVED; + case "active": + return ACTIVE; + default: + return new PromoCodeListItemStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + ARCHIVED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitArchived(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PromoCodeProduct.java b/src/main/java/com/whop/api/types/PromoCodeProduct.java new file mode 100644 index 00000000..d532c573 --- /dev/null +++ b/src/main/java/com/whop/api/types/PromoCodeProduct.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PromoCodeProduct.Builder.class) +public final class PromoCodeProduct { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private PromoCodeProduct(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Product ID, prefixed prod_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Product display name. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PromoCodeProduct && equalTo((PromoCodeProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PromoCodeProduct other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Product ID, prefixed prod_.

+ */ + TitleStage id(@NotNull String id); + + Builder from(PromoCodeProduct other); + } + + public interface TitleStage { + /** + *

Product display name.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + PromoCodeProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PromoCodeProduct other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

Product ID, prefixed prod_.

+ *

Product ID, prefixed prod_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Product display name.

+ *

Product display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public PromoCodeProduct build() { + return new PromoCodeProduct(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PromoCodePromoType.java b/src/main/java/com/whop/api/types/PromoCodePromoType.java new file mode 100644 index 00000000..742bb08d --- /dev/null +++ b/src/main/java/com/whop/api/types/PromoCodePromoType.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PromoCodePromoType { + public static final PromoCodePromoType FLAT_AMOUNT = new PromoCodePromoType(Value.FLAT_AMOUNT, "flat_amount"); + + public static final PromoCodePromoType PERCENTAGE = new PromoCodePromoType(Value.PERCENTAGE, "percentage"); + + private final Value value; + + private final String string; + + PromoCodePromoType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PromoCodePromoType && this.string.equals(((PromoCodePromoType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FLAT_AMOUNT: + return visitor.visitFlatAmount(); + case PERCENTAGE: + return visitor.visitPercentage(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PromoCodePromoType valueOf(String value) { + switch (value) { + case "flat_amount": + return FLAT_AMOUNT; + case "percentage": + return PERCENTAGE; + default: + return new PromoCodePromoType(Value.UNKNOWN, value); + } + } + + public enum Value { + PERCENTAGE, + + FLAT_AMOUNT, + + UNKNOWN + } + + public interface Visitor { + T visitPercentage(); + + T visitFlatAmount(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PromoCodeStatus.java b/src/main/java/com/whop/api/types/PromoCodeStatus.java new file mode 100644 index 00000000..fac54394 --- /dev/null +++ b/src/main/java/com/whop/api/types/PromoCodeStatus.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PromoCodeStatus { + public static final PromoCodeStatus INACTIVE = new PromoCodeStatus(Value.INACTIVE, "inactive"); + + public static final PromoCodeStatus ARCHIVED = new PromoCodeStatus(Value.ARCHIVED, "archived"); + + public static final PromoCodeStatus ACTIVE = new PromoCodeStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + PromoCodeStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PromoCodeStatus && this.string.equals(((PromoCodeStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INACTIVE: + return visitor.visitInactive(); + case ARCHIVED: + return visitor.visitArchived(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PromoCodeStatus valueOf(String value) { + switch (value) { + case "inactive": + return INACTIVE; + case "archived": + return ARCHIVED; + case "active": + return ACTIVE; + default: + return new PromoCodeStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + ARCHIVED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitArchived(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PromoCodeUpdateStatus.java b/src/main/java/com/whop/api/types/PromoCodeUpdateStatus.java new file mode 100644 index 00000000..da05a80a --- /dev/null +++ b/src/main/java/com/whop/api/types/PromoCodeUpdateStatus.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PromoCodeUpdateStatus { + public static final PromoCodeUpdateStatus INACTIVE = new PromoCodeUpdateStatus(Value.INACTIVE, "inactive"); + + public static final PromoCodeUpdateStatus ACTIVE = new PromoCodeUpdateStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + PromoCodeUpdateStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PromoCodeUpdateStatus + && this.string.equals(((PromoCodeUpdateStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INACTIVE: + return visitor.visitInactive(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PromoCodeUpdateStatus valueOf(String value) { + switch (value) { + case "inactive": + return INACTIVE; + case "active": + return ACTIVE; + default: + return new PromoCodeUpdateStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + INACTIVE, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitInactive(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PromoDurations.java b/src/main/java/com/whop/api/types/PromoDurations.java new file mode 100644 index 00000000..b4ac7bec --- /dev/null +++ b/src/main/java/com/whop/api/types/PromoDurations.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PromoDurations { + public static final PromoDurations REPEATING = new PromoDurations(Value.REPEATING, "repeating"); + + public static final PromoDurations ONCE = new PromoDurations(Value.ONCE, "once"); + + public static final PromoDurations FOREVER = new PromoDurations(Value.FOREVER, "forever"); + + private final Value value; + + private final String string; + + PromoDurations(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PromoDurations && this.string.equals(((PromoDurations) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REPEATING: + return visitor.visitRepeating(); + case ONCE: + return visitor.visitOnce(); + case FOREVER: + return visitor.visitForever(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PromoDurations valueOf(String value) { + switch (value) { + case "repeating": + return REPEATING; + case "once": + return ONCE; + case "forever": + return FOREVER; + default: + return new PromoDurations(Value.UNKNOWN, value); + } + } + + public enum Value { + FOREVER, + + ONCE, + + REPEATING, + + UNKNOWN + } + + public interface Visitor { + T visitForever(); + + T visitOnce(); + + T visitRepeating(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PromoTypes.java b/src/main/java/com/whop/api/types/PromoTypes.java new file mode 100644 index 00000000..12e7ef96 --- /dev/null +++ b/src/main/java/com/whop/api/types/PromoTypes.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PromoTypes { + public static final PromoTypes FLAT_AMOUNT = new PromoTypes(Value.FLAT_AMOUNT, "flat_amount"); + + public static final PromoTypes PERCENTAGE = new PromoTypes(Value.PERCENTAGE, "percentage"); + + private final Value value; + + private final String string; + + PromoTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof PromoTypes && this.string.equals(((PromoTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FLAT_AMOUNT: + return visitor.visitFlatAmount(); + case PERCENTAGE: + return visitor.visitPercentage(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PromoTypes valueOf(String value) { + switch (value) { + case "flat_amount": + return FLAT_AMOUNT; + case "percentage": + return PERCENTAGE; + default: + return new PromoTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + PERCENTAGE, + + FLAT_AMOUNT, + + UNKNOWN + } + + public interface Visitor { + T visitPercentage(); + + T visitFlatAmount(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/PublicBountySubmission.java b/src/main/java/com/whop/api/types/PublicBountySubmission.java new file mode 100644 index 00000000..40c9cc68 --- /dev/null +++ b/src/main/java/com/whop/api/types/PublicBountySubmission.java @@ -0,0 +1,687 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PublicBountySubmission.Builder.class) +public final class PublicBountySubmission { + private final String bountyId; + + private final Optional claimedAt; + + private final String createdAt; + + private final Optional denialReason; + + private final String id; + + private final Optional latestProofLivestreamFeed; + + private final Optional resolvedAt; + + private final PublicBountySubmissionStatus status; + + private final Optional submittedAt; + + private final String updatedAt; + + private final UserSummary worker; + + private final Map additionalProperties; + + private PublicBountySubmission( + String bountyId, + Optional claimedAt, + String createdAt, + Optional denialReason, + String id, + Optional latestProofLivestreamFeed, + Optional resolvedAt, + PublicBountySubmissionStatus status, + Optional submittedAt, + String updatedAt, + UserSummary worker, + Map additionalProperties) { + this.bountyId = bountyId; + this.claimedAt = claimedAt; + this.createdAt = createdAt; + this.denialReason = denialReason; + this.id = id; + this.latestProofLivestreamFeed = latestProofLivestreamFeed; + this.resolvedAt = resolvedAt; + this.status = status; + this.submittedAt = submittedAt; + this.updatedAt = updatedAt; + this.worker = worker; + this.additionalProperties = additionalProperties; + } + + /** + * @return The bounty the work was submitted to, prefixed bnty_. + */ + @JsonProperty("bounty_id") + public String getBountyId() { + return bountyId; + } + + /** + * @return When the worker claimed the submission, as an ISO 8601 timestamp. + */ + @JsonIgnore + public Optional getClaimedAt() { + if (claimedAt == null) { + return Optional.empty(); + } + return claimedAt; + } + + /** + * @return When the submission was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Why the submission was denied, when a presentable reason exists. Always null unless status is denied. + */ + @JsonIgnore + public Optional getDenialReason() { + if (denialReason == null) { + return Optional.empty(); + } + return denialReason; + } + + /** + * @return Submission ID, prefixed btys_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Latest public proof livestream attached to the submission. + */ + @JsonIgnore + public Optional getLatestProofLivestreamFeed() { + if (latestProofLivestreamFeed == null) { + return Optional.empty(); + } + return latestProofLivestreamFeed; + } + + /** + * @return When the submission was approved or denied, as an ISO 8601 timestamp. null until then. + */ + @JsonIgnore + public Optional getResolvedAt() { + if (resolvedAt == null) { + return Optional.empty(); + } + return resolvedAt; + } + + /** + * @return Lifecycle state. submitted submissions await review; approved submissions were accepted and paid; denied submissions were rejected. In-progress attempts never appear on the public list. + */ + @JsonProperty("status") + public PublicBountySubmissionStatus getStatus() { + return status; + } + + /** + * @return When proof was submitted for review, as an ISO 8601 timestamp. + */ + @JsonIgnore + public Optional getSubmittedAt() { + if (submittedAt == null) { + return Optional.empty(); + } + return submittedAt; + } + + /** + * @return When the submission was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return User who submitted the work. + */ + @JsonProperty("worker") + public UserSummary getWorker() { + return worker; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("claimed_at") + private Optional _getClaimedAt() { + return claimedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("denial_reason") + private Optional _getDenialReason() { + return denialReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("latest_proof_livestream_feed") + private Optional _getLatestProofLivestreamFeed() { + return latestProofLivestreamFeed; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resolved_at") + private Optional _getResolvedAt() { + return resolvedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("submitted_at") + private Optional _getSubmittedAt() { + return submittedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PublicBountySubmission && equalTo((PublicBountySubmission) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PublicBountySubmission other) { + return bountyId.equals(other.bountyId) + && claimedAt.equals(other.claimedAt) + && createdAt.equals(other.createdAt) + && denialReason.equals(other.denialReason) + && id.equals(other.id) + && latestProofLivestreamFeed.equals(other.latestProofLivestreamFeed) + && resolvedAt.equals(other.resolvedAt) + && status.equals(other.status) + && submittedAt.equals(other.submittedAt) + && updatedAt.equals(other.updatedAt) + && worker.equals(other.worker); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bountyId, + this.claimedAt, + this.createdAt, + this.denialReason, + this.id, + this.latestProofLivestreamFeed, + this.resolvedAt, + this.status, + this.submittedAt, + this.updatedAt, + this.worker); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BountyIdStage builder() { + return new Builder(); + } + + public interface BountyIdStage { + /** + *

The bounty the work was submitted to, prefixed bnty_.

+ */ + CreatedAtStage bountyId(@NotNull String bountyId); + + Builder from(PublicBountySubmission other); + } + + public interface CreatedAtStage { + /** + *

When the submission was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Submission ID, prefixed btys_.

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

Lifecycle state. submitted submissions await review; approved submissions were accepted and paid; denied submissions were rejected. In-progress attempts never appear on the public list.

+ */ + UpdatedAtStage status(@NotNull PublicBountySubmissionStatus status); + } + + public interface UpdatedAtStage { + /** + *

When the submission was last updated, as an ISO 8601 timestamp.

+ */ + WorkerStage updatedAt(@NotNull String updatedAt); + } + + public interface WorkerStage { + /** + *

User who submitted the work.

+ */ + _FinalStage worker(@NotNull UserSummary worker); + } + + public interface _FinalStage { + PublicBountySubmission build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When the worker claimed the submission, as an ISO 8601 timestamp.

+ */ + _FinalStage claimedAt(Optional claimedAt); + + _FinalStage claimedAt(String claimedAt); + + _FinalStage claimedAt(Nullable claimedAt); + + /** + *

Why the submission was denied, when a presentable reason exists. Always null unless status is denied.

+ */ + _FinalStage denialReason(Optional denialReason); + + _FinalStage denialReason(String denialReason); + + _FinalStage denialReason(Nullable denialReason); + + /** + *

Latest public proof livestream attached to the submission.

+ */ + _FinalStage latestProofLivestreamFeed(Optional latestProofLivestreamFeed); + + _FinalStage latestProofLivestreamFeed(BountySubmissionLivestreamFeed latestProofLivestreamFeed); + + _FinalStage latestProofLivestreamFeed(Nullable latestProofLivestreamFeed); + + /** + *

When the submission was approved or denied, as an ISO 8601 timestamp. null until then.

+ */ + _FinalStage resolvedAt(Optional resolvedAt); + + _FinalStage resolvedAt(String resolvedAt); + + _FinalStage resolvedAt(Nullable resolvedAt); + + /** + *

When proof was submitted for review, as an ISO 8601 timestamp.

+ */ + _FinalStage submittedAt(Optional submittedAt); + + _FinalStage submittedAt(String submittedAt); + + _FinalStage submittedAt(Nullable submittedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BountyIdStage, CreatedAtStage, IdStage, StatusStage, UpdatedAtStage, WorkerStage, _FinalStage { + private String bountyId; + + private String createdAt; + + private String id; + + private PublicBountySubmissionStatus status; + + private String updatedAt; + + private UserSummary worker; + + private Optional submittedAt = Optional.empty(); + + private Optional resolvedAt = Optional.empty(); + + private Optional latestProofLivestreamFeed = Optional.empty(); + + private Optional denialReason = Optional.empty(); + + private Optional claimedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PublicBountySubmission other) { + bountyId(other.getBountyId()); + claimedAt(other.getClaimedAt()); + createdAt(other.getCreatedAt()); + denialReason(other.getDenialReason()); + id(other.getId()); + latestProofLivestreamFeed(other.getLatestProofLivestreamFeed()); + resolvedAt(other.getResolvedAt()); + status(other.getStatus()); + submittedAt(other.getSubmittedAt()); + updatedAt(other.getUpdatedAt()); + worker(other.getWorker()); + return this; + } + + /** + *

The bounty the work was submitted to, prefixed bnty_.

+ *

The bounty the work was submitted to, prefixed bnty_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bounty_id") + public CreatedAtStage bountyId(@NotNull String bountyId) { + this.bountyId = Objects.requireNonNull(bountyId, "bountyId must not be null"); + return this; + } + + /** + *

When the submission was created, as an ISO 8601 timestamp.

+ *

When the submission was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Submission ID, prefixed btys_.

+ *

Submission ID, prefixed btys_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Lifecycle state. submitted submissions await review; approved submissions were accepted and paid; denied submissions were rejected. In-progress attempts never appear on the public list.

+ *

Lifecycle state. submitted submissions await review; approved submissions were accepted and paid; denied submissions were rejected. In-progress attempts never appear on the public list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull PublicBountySubmissionStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

When the submission was last updated, as an ISO 8601 timestamp.

+ *

When the submission was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public WorkerStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

User who submitted the work.

+ *

User who submitted the work.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("worker") + public _FinalStage worker(@NotNull UserSummary worker) { + this.worker = Objects.requireNonNull(worker, "worker must not be null"); + return this; + } + + /** + *

When proof was submitted for review, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage submittedAt(Nullable submittedAt) { + if (submittedAt.isNull()) { + this.submittedAt = null; + } else if (submittedAt.isEmpty()) { + this.submittedAt = Optional.empty(); + } else { + this.submittedAt = Optional.of(submittedAt.get()); + } + return this; + } + + /** + *

When proof was submitted for review, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage submittedAt(String submittedAt) { + this.submittedAt = Optional.ofNullable(submittedAt); + return this; + } + + /** + *

When proof was submitted for review, as an ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "submitted_at", nulls = Nulls.SKIP) + public _FinalStage submittedAt(Optional submittedAt) { + this.submittedAt = submittedAt; + return this; + } + + /** + *

When the submission was approved or denied, as an ISO 8601 timestamp. null until then.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolvedAt(Nullable resolvedAt) { + if (resolvedAt.isNull()) { + this.resolvedAt = null; + } else if (resolvedAt.isEmpty()) { + this.resolvedAt = Optional.empty(); + } else { + this.resolvedAt = Optional.of(resolvedAt.get()); + } + return this; + } + + /** + *

When the submission was approved or denied, as an ISO 8601 timestamp. null until then.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolvedAt(String resolvedAt) { + this.resolvedAt = Optional.ofNullable(resolvedAt); + return this; + } + + /** + *

When the submission was approved or denied, as an ISO 8601 timestamp. null until then.

+ */ + @java.lang.Override + @JsonSetter(value = "resolved_at", nulls = Nulls.SKIP) + public _FinalStage resolvedAt(Optional resolvedAt) { + this.resolvedAt = resolvedAt; + return this; + } + + /** + *

Latest public proof livestream attached to the submission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage latestProofLivestreamFeed( + Nullable latestProofLivestreamFeed) { + if (latestProofLivestreamFeed.isNull()) { + this.latestProofLivestreamFeed = null; + } else if (latestProofLivestreamFeed.isEmpty()) { + this.latestProofLivestreamFeed = Optional.empty(); + } else { + this.latestProofLivestreamFeed = Optional.of(latestProofLivestreamFeed.get()); + } + return this; + } + + /** + *

Latest public proof livestream attached to the submission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage latestProofLivestreamFeed(BountySubmissionLivestreamFeed latestProofLivestreamFeed) { + this.latestProofLivestreamFeed = Optional.ofNullable(latestProofLivestreamFeed); + return this; + } + + /** + *

Latest public proof livestream attached to the submission.

+ */ + @java.lang.Override + @JsonSetter(value = "latest_proof_livestream_feed", nulls = Nulls.SKIP) + public _FinalStage latestProofLivestreamFeed( + Optional latestProofLivestreamFeed) { + this.latestProofLivestreamFeed = latestProofLivestreamFeed; + return this; + } + + /** + *

Why the submission was denied, when a presentable reason exists. Always null unless status is denied.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage denialReason(Nullable denialReason) { + if (denialReason.isNull()) { + this.denialReason = null; + } else if (denialReason.isEmpty()) { + this.denialReason = Optional.empty(); + } else { + this.denialReason = Optional.of(denialReason.get()); + } + return this; + } + + /** + *

Why the submission was denied, when a presentable reason exists. Always null unless status is denied.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage denialReason(String denialReason) { + this.denialReason = Optional.ofNullable(denialReason); + return this; + } + + /** + *

Why the submission was denied, when a presentable reason exists. Always null unless status is denied.

+ */ + @java.lang.Override + @JsonSetter(value = "denial_reason", nulls = Nulls.SKIP) + public _FinalStage denialReason(Optional denialReason) { + this.denialReason = denialReason; + return this; + } + + /** + *

When the worker claimed the submission, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage claimedAt(Nullable claimedAt) { + if (claimedAt.isNull()) { + this.claimedAt = null; + } else if (claimedAt.isEmpty()) { + this.claimedAt = Optional.empty(); + } else { + this.claimedAt = Optional.of(claimedAt.get()); + } + return this; + } + + /** + *

When the worker claimed the submission, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage claimedAt(String claimedAt) { + this.claimedAt = Optional.ofNullable(claimedAt); + return this; + } + + /** + *

When the worker claimed the submission, as an ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "claimed_at", nulls = Nulls.SKIP) + public _FinalStage claimedAt(Optional claimedAt) { + this.claimedAt = claimedAt; + return this; + } + + @java.lang.Override + public PublicBountySubmission build() { + return new PublicBountySubmission( + bountyId, + claimedAt, + createdAt, + denialReason, + id, + latestProofLivestreamFeed, + resolvedAt, + status, + submittedAt, + updatedAt, + worker, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/PublicBountySubmissionStatus.java b/src/main/java/com/whop/api/types/PublicBountySubmissionStatus.java new file mode 100644 index 00000000..129b60f9 --- /dev/null +++ b/src/main/java/com/whop/api/types/PublicBountySubmissionStatus.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PublicBountySubmissionStatus { + public static final PublicBountySubmissionStatus APPROVED = + new PublicBountySubmissionStatus(Value.APPROVED, "approved"); + + public static final PublicBountySubmissionStatus DENIED = new PublicBountySubmissionStatus(Value.DENIED, "denied"); + + public static final PublicBountySubmissionStatus SUBMITTED = + new PublicBountySubmissionStatus(Value.SUBMITTED, "submitted"); + + private final Value value; + + private final String string; + + PublicBountySubmissionStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof PublicBountySubmissionStatus + && this.string.equals(((PublicBountySubmissionStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case DENIED: + return visitor.visitDenied(); + case SUBMITTED: + return visitor.visitSubmitted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PublicBountySubmissionStatus valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "denied": + return DENIED; + case "submitted": + return SUBMITTED; + default: + return new PublicBountySubmissionStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + SUBMITTED, + + APPROVED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitSubmitted(); + + T visitApproved(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ReachEstimate.java b/src/main/java/com/whop/api/types/ReachEstimate.java new file mode 100644 index 00000000..781c3f69 --- /dev/null +++ b/src/main/java/com/whop/api/types/ReachEstimate.java @@ -0,0 +1,185 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReachEstimate.Builder.class) +public final class ReachEstimate { + private final Optional usersLowerBound; + + private final Optional usersUpperBound; + + private final Map additionalProperties; + + private ReachEstimate( + Optional usersLowerBound, + Optional usersUpperBound, + Map additionalProperties) { + this.usersLowerBound = usersLowerBound; + this.usersUpperBound = usersUpperBound; + this.additionalProperties = additionalProperties; + } + + /** + * @return Low end of how many people the targeting can reach. Null when the platform couldn't produce an estimate. + */ + @JsonIgnore + public Optional getUsersLowerBound() { + if (usersLowerBound == null) { + return Optional.empty(); + } + return usersLowerBound; + } + + /** + * @return High end of how many people the targeting can reach. Null when the platform couldn't produce an estimate. + */ + @JsonIgnore + public Optional getUsersUpperBound() { + if (usersUpperBound == null) { + return Optional.empty(); + } + return usersUpperBound; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("users_lower_bound") + private Optional _getUsersLowerBound() { + return usersLowerBound; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("users_upper_bound") + private Optional _getUsersUpperBound() { + return usersUpperBound; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReachEstimate && equalTo((ReachEstimate) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReachEstimate other) { + return usersLowerBound.equals(other.usersLowerBound) && usersUpperBound.equals(other.usersUpperBound); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.usersLowerBound, this.usersUpperBound); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional usersLowerBound = Optional.empty(); + + private Optional usersUpperBound = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReachEstimate other) { + usersLowerBound(other.getUsersLowerBound()); + usersUpperBound(other.getUsersUpperBound()); + return this; + } + + /** + *

Low end of how many people the targeting can reach. Null when the platform couldn't produce an estimate.

+ */ + @JsonSetter(value = "users_lower_bound", nulls = Nulls.SKIP) + public Builder usersLowerBound(Optional usersLowerBound) { + this.usersLowerBound = usersLowerBound; + return this; + } + + public Builder usersLowerBound(Double usersLowerBound) { + this.usersLowerBound = Optional.ofNullable(usersLowerBound); + return this; + } + + public Builder usersLowerBound(Nullable usersLowerBound) { + if (usersLowerBound.isNull()) { + this.usersLowerBound = null; + } else if (usersLowerBound.isEmpty()) { + this.usersLowerBound = Optional.empty(); + } else { + this.usersLowerBound = Optional.of(usersLowerBound.get()); + } + return this; + } + + /** + *

High end of how many people the targeting can reach. Null when the platform couldn't produce an estimate.

+ */ + @JsonSetter(value = "users_upper_bound", nulls = Nulls.SKIP) + public Builder usersUpperBound(Optional usersUpperBound) { + this.usersUpperBound = usersUpperBound; + return this; + } + + public Builder usersUpperBound(Double usersUpperBound) { + this.usersUpperBound = Optional.ofNullable(usersUpperBound); + return this; + } + + public Builder usersUpperBound(Nullable usersUpperBound) { + if (usersUpperBound.isNull()) { + this.usersUpperBound = null; + } else if (usersUpperBound.isEmpty()) { + this.usersUpperBound = Optional.empty(); + } else { + this.usersUpperBound = Optional.of(usersUpperBound.get()); + } + return this; + } + + public ReachEstimate build() { + return new ReachEstimate(usersLowerBound, usersUpperBound, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Reaction.java b/src/main/java/com/whop/api/types/Reaction.java new file mode 100644 index 00000000..477e25db --- /dev/null +++ b/src/main/java/com/whop/api/types/Reaction.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Reaction.Builder.class) +public final class Reaction { + private final Optional emoji; + + private final String id; + + private final String resourceId; + + private final ReactionUser user; + + private final Map additionalProperties; + + private Reaction( + Optional emoji, + String id, + String resourceId, + ReactionUser user, + Map additionalProperties) { + this.emoji = emoji; + this.id = id; + this.resourceId = resourceId; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The emoji used for this reaction in shortcode format. Null if the reaction type is not emoji. + */ + @JsonIgnore + public Optional getEmoji() { + if (emoji == null) { + return Optional.empty(); + } + return emoji; + } + + /** + * @return The unique identifier for the entity + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The unique identifier of the post this reaction was left on. + */ + @JsonProperty("resource_id") + public String getResourceId() { + return resourceId; + } + + /** + * @return The user who left this reaction on the post. + */ + @JsonProperty("user") + public ReactionUser getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("emoji") + private Optional _getEmoji() { + return emoji; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Reaction && equalTo((Reaction) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Reaction other) { + return emoji.equals(other.emoji) + && id.equals(other.id) + && resourceId.equals(other.resourceId) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.emoji, this.id, this.resourceId, this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the entity

+ */ + ResourceIdStage id(@NotNull String id); + + Builder from(Reaction other); + } + + public interface ResourceIdStage { + /** + *

The unique identifier of the post this reaction was left on.

+ */ + UserStage resourceId(@NotNull String resourceId); + } + + public interface UserStage { + /** + *

The user who left this reaction on the post.

+ */ + _FinalStage user(@NotNull ReactionUser user); + } + + public interface _FinalStage { + Reaction build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The emoji used for this reaction in shortcode format. Null if the reaction type is not emoji.

+ */ + _FinalStage emoji(Optional emoji); + + _FinalStage emoji(String emoji); + + _FinalStage emoji(Nullable emoji); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ResourceIdStage, UserStage, _FinalStage { + private String id; + + private String resourceId; + + private ReactionUser user; + + private Optional emoji = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Reaction other) { + emoji(other.getEmoji()); + id(other.getId()); + resourceId(other.getResourceId()); + user(other.getUser()); + return this; + } + + /** + *

The unique identifier for the entity

+ *

The unique identifier for the entity

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ResourceIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The unique identifier of the post this reaction was left on.

+ *

The unique identifier of the post this reaction was left on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_id") + public UserStage resourceId(@NotNull String resourceId) { + this.resourceId = Objects.requireNonNull(resourceId, "resourceId must not be null"); + return this; + } + + /** + *

The user who left this reaction on the post.

+ *

The user who left this reaction on the post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull ReactionUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

The emoji used for this reaction in shortcode format. Null if the reaction type is not emoji.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emoji(Nullable emoji) { + if (emoji.isNull()) { + this.emoji = null; + } else if (emoji.isEmpty()) { + this.emoji = Optional.empty(); + } else { + this.emoji = Optional.of(emoji.get()); + } + return this; + } + + /** + *

The emoji used for this reaction in shortcode format. Null if the reaction type is not emoji.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emoji(String emoji) { + this.emoji = Optional.ofNullable(emoji); + return this; + } + + /** + *

The emoji used for this reaction in shortcode format. Null if the reaction type is not emoji.

+ */ + @java.lang.Override + @JsonSetter(value = "emoji", nulls = Nulls.SKIP) + public _FinalStage emoji(Optional emoji) { + this.emoji = emoji; + return this; + } + + @java.lang.Override + public Reaction build() { + return new Reaction(emoji, id, resourceId, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ReactionListItem.java b/src/main/java/com/whop/api/types/ReactionListItem.java new file mode 100644 index 00000000..068e1c74 --- /dev/null +++ b/src/main/java/com/whop/api/types/ReactionListItem.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReactionListItem.Builder.class) +public final class ReactionListItem { + private final Optional emoji; + + private final String id; + + private final String resourceId; + + private final ReactionListItemUser user; + + private final Map additionalProperties; + + private ReactionListItem( + Optional emoji, + String id, + String resourceId, + ReactionListItemUser user, + Map additionalProperties) { + this.emoji = emoji; + this.id = id; + this.resourceId = resourceId; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The emoji used for this reaction in shortcode format. Null if the reaction type is not emoji. + */ + @JsonIgnore + public Optional getEmoji() { + if (emoji == null) { + return Optional.empty(); + } + return emoji; + } + + /** + * @return The unique identifier for the entity + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The unique identifier of the post this reaction was left on. + */ + @JsonProperty("resource_id") + public String getResourceId() { + return resourceId; + } + + /** + * @return The user who left this reaction on the post. + */ + @JsonProperty("user") + public ReactionListItemUser getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("emoji") + private Optional _getEmoji() { + return emoji; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReactionListItem && equalTo((ReactionListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReactionListItem other) { + return emoji.equals(other.emoji) + && id.equals(other.id) + && resourceId.equals(other.resourceId) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.emoji, this.id, this.resourceId, this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the entity

+ */ + ResourceIdStage id(@NotNull String id); + + Builder from(ReactionListItem other); + } + + public interface ResourceIdStage { + /** + *

The unique identifier of the post this reaction was left on.

+ */ + UserStage resourceId(@NotNull String resourceId); + } + + public interface UserStage { + /** + *

The user who left this reaction on the post.

+ */ + _FinalStage user(@NotNull ReactionListItemUser user); + } + + public interface _FinalStage { + ReactionListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The emoji used for this reaction in shortcode format. Null if the reaction type is not emoji.

+ */ + _FinalStage emoji(Optional emoji); + + _FinalStage emoji(String emoji); + + _FinalStage emoji(Nullable emoji); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ResourceIdStage, UserStage, _FinalStage { + private String id; + + private String resourceId; + + private ReactionListItemUser user; + + private Optional emoji = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReactionListItem other) { + emoji(other.getEmoji()); + id(other.getId()); + resourceId(other.getResourceId()); + user(other.getUser()); + return this; + } + + /** + *

The unique identifier for the entity

+ *

The unique identifier for the entity

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ResourceIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The unique identifier of the post this reaction was left on.

+ *

The unique identifier of the post this reaction was left on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_id") + public UserStage resourceId(@NotNull String resourceId) { + this.resourceId = Objects.requireNonNull(resourceId, "resourceId must not be null"); + return this; + } + + /** + *

The user who left this reaction on the post.

+ *

The user who left this reaction on the post.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull ReactionListItemUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

The emoji used for this reaction in shortcode format. Null if the reaction type is not emoji.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emoji(Nullable emoji) { + if (emoji.isNull()) { + this.emoji = null; + } else if (emoji.isEmpty()) { + this.emoji = Optional.empty(); + } else { + this.emoji = Optional.of(emoji.get()); + } + return this; + } + + /** + *

The emoji used for this reaction in shortcode format. Null if the reaction type is not emoji.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emoji(String emoji) { + this.emoji = Optional.ofNullable(emoji); + return this; + } + + /** + *

The emoji used for this reaction in shortcode format. Null if the reaction type is not emoji.

+ */ + @java.lang.Override + @JsonSetter(value = "emoji", nulls = Nulls.SKIP) + public _FinalStage emoji(Optional emoji) { + this.emoji = emoji; + return this; + } + + @java.lang.Override + public ReactionListItem build() { + return new ReactionListItem(emoji, id, resourceId, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ReactionListItemUser.java b/src/main/java/com/whop/api/types/ReactionListItemUser.java new file mode 100644 index 00000000..6a7f3385 --- /dev/null +++ b/src/main/java/com/whop/api/types/ReactionListItemUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReactionListItemUser.Builder.class) +public final class ReactionListItemUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private ReactionListItemUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReactionListItemUser && equalTo((ReactionListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReactionListItemUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(ReactionListItemUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + ReactionListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReactionListItemUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ReactionListItemUser build() { + return new ReactionListItemUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ReactionUser.java b/src/main/java/com/whop/api/types/ReactionUser.java new file mode 100644 index 00000000..915f8a0d --- /dev/null +++ b/src/main/java/com/whop/api/types/ReactionUser.java @@ -0,0 +1,235 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReactionUser.Builder.class) +public final class ReactionUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private ReactionUser(String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReactionUser && equalTo((ReactionUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReactionUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(ReactionUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + ReactionUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReactionUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ReactionUser build() { + return new ReactionUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ReceiptStatus.java b/src/main/java/com/whop/api/types/ReceiptStatus.java new file mode 100644 index 00000000..7811cdfe --- /dev/null +++ b/src/main/java/com/whop/api/types/ReceiptStatus.java @@ -0,0 +1,133 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ReceiptStatus { + public static final ReceiptStatus VOID = new ReceiptStatus(Value.VOID, "void"); + + public static final ReceiptStatus PENDING = new ReceiptStatus(Value.PENDING, "pending"); + + public static final ReceiptStatus PAID = new ReceiptStatus(Value.PAID, "paid"); + + public static final ReceiptStatus DRAFT = new ReceiptStatus(Value.DRAFT, "draft"); + + public static final ReceiptStatus UNCOLLECTIBLE = new ReceiptStatus(Value.UNCOLLECTIBLE, "uncollectible"); + + public static final ReceiptStatus UNRESOLVED = new ReceiptStatus(Value.UNRESOLVED, "unresolved"); + + public static final ReceiptStatus OPEN = new ReceiptStatus(Value.OPEN, "open"); + + private final Value value; + + private final String string; + + ReceiptStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ReceiptStatus && this.string.equals(((ReceiptStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VOID: + return visitor.visitVoid(); + case PENDING: + return visitor.visitPending(); + case PAID: + return visitor.visitPaid(); + case DRAFT: + return visitor.visitDraft(); + case UNCOLLECTIBLE: + return visitor.visitUncollectible(); + case UNRESOLVED: + return visitor.visitUnresolved(); + case OPEN: + return visitor.visitOpen(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ReceiptStatus valueOf(String value) { + switch (value) { + case "void": + return VOID; + case "pending": + return PENDING; + case "paid": + return PAID; + case "draft": + return DRAFT; + case "uncollectible": + return UNCOLLECTIBLE; + case "unresolved": + return UNRESOLVED; + case "open": + return OPEN; + default: + return new ReceiptStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + DRAFT, + + OPEN, + + PAID, + + PENDING, + + UNCOLLECTIBLE, + + UNRESOLVED, + + VOID, + + UNKNOWN + } + + public interface Visitor { + T visitDraft(); + + T visitOpen(); + + T visitPaid(); + + T visitPending(); + + T visitUncollectible(); + + T visitUnresolved(); + + T visitVoid(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ReceiptTaxBehaviors.java b/src/main/java/com/whop/api/types/ReceiptTaxBehaviors.java new file mode 100644 index 00000000..7b792f12 --- /dev/null +++ b/src/main/java/com/whop/api/types/ReceiptTaxBehaviors.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ReceiptTaxBehaviors { + public static final ReceiptTaxBehaviors UNABLE_TO_COLLECT = + new ReceiptTaxBehaviors(Value.UNABLE_TO_COLLECT, "unable_to_collect"); + + public static final ReceiptTaxBehaviors UNSPECIFIED = new ReceiptTaxBehaviors(Value.UNSPECIFIED, "unspecified"); + + public static final ReceiptTaxBehaviors EXCLUSIVE = new ReceiptTaxBehaviors(Value.EXCLUSIVE, "exclusive"); + + public static final ReceiptTaxBehaviors INCLUSIVE = new ReceiptTaxBehaviors(Value.INCLUSIVE, "inclusive"); + + private final Value value; + + private final String string; + + ReceiptTaxBehaviors(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ReceiptTaxBehaviors && this.string.equals(((ReceiptTaxBehaviors) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case UNABLE_TO_COLLECT: + return visitor.visitUnableToCollect(); + case UNSPECIFIED: + return visitor.visitUnspecified(); + case EXCLUSIVE: + return visitor.visitExclusive(); + case INCLUSIVE: + return visitor.visitInclusive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ReceiptTaxBehaviors valueOf(String value) { + switch (value) { + case "unable_to_collect": + return UNABLE_TO_COLLECT; + case "unspecified": + return UNSPECIFIED; + case "exclusive": + return EXCLUSIVE; + case "inclusive": + return INCLUSIVE; + default: + return new ReceiptTaxBehaviors(Value.UNKNOWN, value); + } + } + + public enum Value { + EXCLUSIVE, + + INCLUSIVE, + + UNSPECIFIED, + + UNABLE_TO_COLLECT, + + UNKNOWN + } + + public interface Visitor { + T visitExclusive(); + + T visitInclusive(); + + T visitUnspecified(); + + T visitUnableToCollect(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ReceiptV2Order.java b/src/main/java/com/whop/api/types/ReceiptV2Order.java new file mode 100644 index 00000000..2782cf7b --- /dev/null +++ b/src/main/java/com/whop/api/types/ReceiptV2Order.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ReceiptV2Order { + public static final ReceiptV2Order PAID_AT = new ReceiptV2Order(Value.PAID_AT, "paid_at"); + + public static final ReceiptV2Order FINAL_AMOUNT = new ReceiptV2Order(Value.FINAL_AMOUNT, "final_amount"); + + public static final ReceiptV2Order CREATED_AT = new ReceiptV2Order(Value.CREATED_AT, "created_at"); + + private final Value value; + + private final String string; + + ReceiptV2Order(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ReceiptV2Order && this.string.equals(((ReceiptV2Order) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAID_AT: + return visitor.visitPaidAt(); + case FINAL_AMOUNT: + return visitor.visitFinalAmount(); + case CREATED_AT: + return visitor.visitCreatedAt(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ReceiptV2Order valueOf(String value) { + switch (value) { + case "paid_at": + return PAID_AT; + case "final_amount": + return FINAL_AMOUNT; + case "created_at": + return CREATED_AT; + default: + return new ReceiptV2Order(Value.UNKNOWN, value); + } + } + + public enum Value { + FINAL_AMOUNT, + + CREATED_AT, + + PAID_AT, + + UNKNOWN + } + + public interface Visitor { + T visitFinalAmount(); + + T visitCreatedAt(); + + T visitPaidAt(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/RecommendedActionExecution.java b/src/main/java/com/whop/api/types/RecommendedActionExecution.java new file mode 100644 index 00000000..482d6cdc --- /dev/null +++ b/src/main/java/com/whop/api/types/RecommendedActionExecution.java @@ -0,0 +1,453 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RecommendedActionExecution.Builder.class) +public final class RecommendedActionExecution { + private final String action; + + private final Optional completedAt; + + private final Optional error; + + private final String id; + + private final Optional> output; + + private final int position; + + private final RecommendedActionExecutionStatus status; + + private final Map additionalProperties; + + private RecommendedActionExecution( + String action, + Optional completedAt, + Optional error, + String id, + Optional> output, + int position, + RecommendedActionExecutionStatus status, + Map additionalProperties) { + this.action = action; + this.completedAt = completedAt; + this.error = error; + this.id = id; + this.output = output; + this.position = position; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The action definition key the step ran + */ + @JsonProperty("action") + public String getAction() { + return action; + } + + /** + * @return When the step reached a terminal status, ISO 8601 + */ + @JsonIgnore + public Optional getCompletedAt() { + if (completedAt == null) { + return Optional.empty(); + } + return completedAt; + } + + /** + * @return Why the step failed, or null + */ + @JsonIgnore + public Optional getError() { + if (error == null) { + return Optional.empty(); + } + return error; + } + + /** + * @return Execution ID, prefixed raex_ + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The API response the step produced, or null until it succeeds + */ + @JsonIgnore + public Optional> getOutput() { + if (output == null) { + return Optional.empty(); + } + return output; + } + + /** + * @return Zero-based order of the step within the chain + */ + @JsonProperty("position") + public int getPosition() { + return position; + } + + /** + * @return Where the step currently stands + */ + @JsonProperty("status") + public RecommendedActionExecutionStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("completed_at") + private Optional _getCompletedAt() { + return completedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("error") + private Optional _getError() { + return error; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("output") + private Optional> _getOutput() { + return output; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RecommendedActionExecution && equalTo((RecommendedActionExecution) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RecommendedActionExecution other) { + return action.equals(other.action) + && completedAt.equals(other.completedAt) + && error.equals(other.error) + && id.equals(other.id) + && output.equals(other.output) + && position == other.position + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.action, this.completedAt, this.error, this.id, this.output, this.position, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + /** + *

The action definition key the step ran

+ */ + IdStage action(@NotNull String action); + + Builder from(RecommendedActionExecution other); + } + + public interface IdStage { + /** + *

Execution ID, prefixed raex_

+ */ + PositionStage id(@NotNull String id); + } + + public interface PositionStage { + /** + *

Zero-based order of the step within the chain

+ */ + StatusStage position(int position); + } + + public interface StatusStage { + /** + *

Where the step currently stands

+ */ + _FinalStage status(@NotNull RecommendedActionExecutionStatus status); + } + + public interface _FinalStage { + RecommendedActionExecution build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When the step reached a terminal status, ISO 8601

+ */ + _FinalStage completedAt(Optional completedAt); + + _FinalStage completedAt(String completedAt); + + _FinalStage completedAt(Nullable completedAt); + + /** + *

Why the step failed, or null

+ */ + _FinalStage error(Optional error); + + _FinalStage error(String error); + + _FinalStage error(Nullable error); + + /** + *

The API response the step produced, or null until it succeeds

+ */ + _FinalStage output(Optional> output); + + _FinalStage output(Map output); + + _FinalStage output(Nullable> output); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ActionStage, IdStage, PositionStage, StatusStage, _FinalStage { + private String action; + + private String id; + + private int position; + + private RecommendedActionExecutionStatus status; + + private Optional> output = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional completedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RecommendedActionExecution other) { + action(other.getAction()); + completedAt(other.getCompletedAt()); + error(other.getError()); + id(other.getId()); + output(other.getOutput()); + position(other.getPosition()); + status(other.getStatus()); + return this; + } + + /** + *

The action definition key the step ran

+ *

The action definition key the step ran

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("action") + public IdStage action(@NotNull String action) { + this.action = Objects.requireNonNull(action, "action must not be null"); + return this; + } + + /** + *

Execution ID, prefixed raex_

+ *

Execution ID, prefixed raex_

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PositionStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Zero-based order of the step within the chain

+ *

Zero-based order of the step within the chain

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("position") + public StatusStage position(int position) { + this.position = position; + return this; + } + + /** + *

Where the step currently stands

+ *

Where the step currently stands

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull RecommendedActionExecutionStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The API response the step produced, or null until it succeeds

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage output(Nullable> output) { + if (output.isNull()) { + this.output = null; + } else if (output.isEmpty()) { + this.output = Optional.empty(); + } else { + this.output = Optional.of(output.get()); + } + return this; + } + + /** + *

The API response the step produced, or null until it succeeds

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage output(Map output) { + this.output = Optional.ofNullable(output); + return this; + } + + /** + *

The API response the step produced, or null until it succeeds

+ */ + @java.lang.Override + @JsonSetter(value = "output", nulls = Nulls.SKIP) + public _FinalStage output(Optional> output) { + this.output = output; + return this; + } + + /** + *

Why the step failed, or null

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(Nullable error) { + if (error.isNull()) { + this.error = null; + } else if (error.isEmpty()) { + this.error = Optional.empty(); + } else { + this.error = Optional.of(error.get()); + } + return this; + } + + /** + *

Why the step failed, or null

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

Why the step failed, or null

+ */ + @java.lang.Override + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public _FinalStage error(Optional error) { + this.error = error; + return this; + } + + /** + *

When the step reached a terminal status, ISO 8601

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage completedAt(Nullable completedAt) { + if (completedAt.isNull()) { + this.completedAt = null; + } else if (completedAt.isEmpty()) { + this.completedAt = Optional.empty(); + } else { + this.completedAt = Optional.of(completedAt.get()); + } + return this; + } + + /** + *

When the step reached a terminal status, ISO 8601

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage completedAt(String completedAt) { + this.completedAt = Optional.ofNullable(completedAt); + return this; + } + + /** + *

When the step reached a terminal status, ISO 8601

+ */ + @java.lang.Override + @JsonSetter(value = "completed_at", nulls = Nulls.SKIP) + public _FinalStage completedAt(Optional completedAt) { + this.completedAt = completedAt; + return this; + } + + @java.lang.Override + public RecommendedActionExecution build() { + return new RecommendedActionExecution( + action, completedAt, error, id, output, position, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/RecommendedActionExecutionStatus.java b/src/main/java/com/whop/api/types/RecommendedActionExecutionStatus.java new file mode 100644 index 00000000..cdd7a193 --- /dev/null +++ b/src/main/java/com/whop/api/types/RecommendedActionExecutionStatus.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RecommendedActionExecutionStatus { + public static final RecommendedActionExecutionStatus FAILED = + new RecommendedActionExecutionStatus(Value.FAILED, "failed"); + + public static final RecommendedActionExecutionStatus SUCCEEDED = + new RecommendedActionExecutionStatus(Value.SUCCEEDED, "succeeded"); + + public static final RecommendedActionExecutionStatus PENDING = + new RecommendedActionExecutionStatus(Value.PENDING, "pending"); + + public static final RecommendedActionExecutionStatus REDIRECTED = + new RecommendedActionExecutionStatus(Value.REDIRECTED, "redirected"); + + public static final RecommendedActionExecutionStatus RUNNING = + new RecommendedActionExecutionStatus(Value.RUNNING, "running"); + + private final Value value; + + private final String string; + + RecommendedActionExecutionStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RecommendedActionExecutionStatus + && this.string.equals(((RecommendedActionExecutionStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case SUCCEEDED: + return visitor.visitSucceeded(); + case PENDING: + return visitor.visitPending(); + case REDIRECTED: + return visitor.visitRedirected(); + case RUNNING: + return visitor.visitRunning(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RecommendedActionExecutionStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "succeeded": + return SUCCEEDED; + case "pending": + return PENDING; + case "redirected": + return REDIRECTED; + case "running": + return RUNNING; + default: + return new RecommendedActionExecutionStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + REDIRECTED, + + RUNNING, + + SUCCEEDED, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitRedirected(); + + T visitRunning(); + + T visitSucceeded(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Refund.java b/src/main/java/com/whop/api/types/Refund.java new file mode 100644 index 00000000..ec61d8db --- /dev/null +++ b/src/main/java/com/whop/api/types/Refund.java @@ -0,0 +1,686 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Refund.Builder.class) +public final class Refund { + private final double amount; + + private final OffsetDateTime createdAt; + + private final Currencies currency; + + private final String id; + + private final Optional payment; + + private final PaymentProviders provider; + + private final Optional providerCreatedAt; + + private final Optional referenceStatus; + + private final Optional referenceType; + + private final Optional referenceValue; + + private final RefundStatuses status; + + private final Map additionalProperties; + + private Refund( + double amount, + OffsetDateTime createdAt, + Currencies currency, + String id, + Optional payment, + PaymentProviders provider, + Optional providerCreatedAt, + Optional referenceStatus, + Optional referenceType, + Optional referenceValue, + RefundStatuses status, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.currency = currency; + this.id = id; + this.payment = payment; + this.provider = provider; + this.providerCreatedAt = providerCreatedAt; + this.referenceStatus = referenceStatus; + this.referenceType = referenceType; + this.referenceValue = referenceValue; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The refunded amount as a decimal in the specified currency, such as 10.43 for $10.43 USD. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The datetime the refund was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code for the refunded amount. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The unique identifier for the refund. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The original payment that this refund was issued against. Null if the payment is no longer available. + */ + @JsonIgnore + public Optional getPayment() { + if (payment == null) { + return Optional.empty(); + } + return payment; + } + + /** + * @return The payment provider that processed the refund. + */ + @JsonProperty("provider") + public PaymentProviders getProvider() { + return provider; + } + + /** + * @return The timestamp when the refund was created in the payment provider's system. Null if not available from the provider. + */ + @JsonIgnore + public Optional getProviderCreatedAt() { + if (providerCreatedAt == null) { + return Optional.empty(); + } + return providerCreatedAt; + } + + /** + * @return The availability status of the refund tracking reference from the payment processor. Null if no reference was provided. + */ + @JsonIgnore + public Optional getReferenceStatus() { + if (referenceStatus == null) { + return Optional.empty(); + } + return referenceStatus; + } + + /** + * @return The type of tracking reference provided by the payment processor, such as an acquirer reference number. Null if no reference was provided. + */ + @JsonIgnore + public Optional getReferenceType() { + if (referenceType == null) { + return Optional.empty(); + } + return referenceType; + } + + /** + * @return The tracking reference value from the payment processor, used to trace the refund through banking networks. Null if no reference was provided. + */ + @JsonIgnore + public Optional getReferenceValue() { + if (referenceValue == null) { + return Optional.empty(); + } + return referenceValue; + } + + /** + * @return The current processing status of the refund, such as pending, succeeded, or failed. + */ + @JsonProperty("status") + public RefundStatuses getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment") + private Optional _getPayment() { + return payment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("provider_created_at") + private Optional _getProviderCreatedAt() { + return providerCreatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reference_status") + private Optional _getReferenceStatus() { + return referenceStatus; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reference_type") + private Optional _getReferenceType() { + return referenceType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reference_value") + private Optional _getReferenceValue() { + return referenceValue; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Refund && equalTo((Refund) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Refund other) { + return amount == other.amount + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && id.equals(other.id) + && payment.equals(other.payment) + && provider.equals(other.provider) + && providerCreatedAt.equals(other.providerCreatedAt) + && referenceStatus.equals(other.referenceStatus) + && referenceType.equals(other.referenceType) + && referenceValue.equals(other.referenceValue) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.currency, + this.id, + this.payment, + this.provider, + this.providerCreatedAt, + this.referenceStatus, + this.referenceType, + this.referenceValue, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The refunded amount as a decimal in the specified currency, such as 10.43 for $10.43 USD.

+ */ + CreatedAtStage amount(double amount); + + Builder from(Refund other); + } + + public interface CreatedAtStage { + /** + *

The datetime the refund was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

The three-letter ISO currency code for the refunded amount.

+ */ + IdStage currency(@NotNull Currencies currency); + } + + public interface IdStage { + /** + *

The unique identifier for the refund.

+ */ + ProviderStage id(@NotNull String id); + } + + public interface ProviderStage { + /** + *

The payment provider that processed the refund.

+ */ + StatusStage provider(@NotNull PaymentProviders provider); + } + + public interface StatusStage { + /** + *

The current processing status of the refund, such as pending, succeeded, or failed.

+ */ + _FinalStage status(@NotNull RefundStatuses status); + } + + public interface _FinalStage { + Refund build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The original payment that this refund was issued against. Null if the payment is no longer available.

+ */ + _FinalStage payment(Optional payment); + + _FinalStage payment(RefundPayment payment); + + _FinalStage payment(Nullable payment); + + /** + *

The timestamp when the refund was created in the payment provider's system. Null if not available from the provider.

+ */ + _FinalStage providerCreatedAt(Optional providerCreatedAt); + + _FinalStage providerCreatedAt(OffsetDateTime providerCreatedAt); + + _FinalStage providerCreatedAt(Nullable providerCreatedAt); + + /** + *

The availability status of the refund tracking reference from the payment processor. Null if no reference was provided.

+ */ + _FinalStage referenceStatus(Optional referenceStatus); + + _FinalStage referenceStatus(RefundReferenceStatuses referenceStatus); + + _FinalStage referenceStatus(Nullable referenceStatus); + + /** + *

The type of tracking reference provided by the payment processor, such as an acquirer reference number. Null if no reference was provided.

+ */ + _FinalStage referenceType(Optional referenceType); + + _FinalStage referenceType(RefundReferenceTypes referenceType); + + _FinalStage referenceType(Nullable referenceType); + + /** + *

The tracking reference value from the payment processor, used to trace the refund through banking networks. Null if no reference was provided.

+ */ + _FinalStage referenceValue(Optional referenceValue); + + _FinalStage referenceValue(String referenceValue); + + _FinalStage referenceValue(Nullable referenceValue); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, CreatedAtStage, CurrencyStage, IdStage, ProviderStage, StatusStage, _FinalStage { + private double amount; + + private OffsetDateTime createdAt; + + private Currencies currency; + + private String id; + + private PaymentProviders provider; + + private RefundStatuses status; + + private Optional referenceValue = Optional.empty(); + + private Optional referenceType = Optional.empty(); + + private Optional referenceStatus = Optional.empty(); + + private Optional providerCreatedAt = Optional.empty(); + + private Optional payment = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Refund other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + id(other.getId()); + payment(other.getPayment()); + provider(other.getProvider()); + providerCreatedAt(other.getProviderCreatedAt()); + referenceStatus(other.getReferenceStatus()); + referenceType(other.getReferenceType()); + referenceValue(other.getReferenceValue()); + status(other.getStatus()); + return this; + } + + /** + *

The refunded amount as a decimal in the specified currency, such as 10.43 for $10.43 USD.

+ *

The refunded amount as a decimal in the specified currency, such as 10.43 for $10.43 USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The datetime the refund was created.

+ *

The datetime the refund was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The three-letter ISO currency code for the refunded amount.

+ *

The three-letter ISO currency code for the refunded amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier for the refund.

+ *

The unique identifier for the refund.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ProviderStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The payment provider that processed the refund.

+ *

The payment provider that processed the refund.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("provider") + public StatusStage provider(@NotNull PaymentProviders provider) { + this.provider = Objects.requireNonNull(provider, "provider must not be null"); + return this; + } + + /** + *

The current processing status of the refund, such as pending, succeeded, or failed.

+ *

The current processing status of the refund, such as pending, succeeded, or failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull RefundStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The tracking reference value from the payment processor, used to trace the refund through banking networks. Null if no reference was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referenceValue(Nullable referenceValue) { + if (referenceValue.isNull()) { + this.referenceValue = null; + } else if (referenceValue.isEmpty()) { + this.referenceValue = Optional.empty(); + } else { + this.referenceValue = Optional.of(referenceValue.get()); + } + return this; + } + + /** + *

The tracking reference value from the payment processor, used to trace the refund through banking networks. Null if no reference was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referenceValue(String referenceValue) { + this.referenceValue = Optional.ofNullable(referenceValue); + return this; + } + + /** + *

The tracking reference value from the payment processor, used to trace the refund through banking networks. Null if no reference was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "reference_value", nulls = Nulls.SKIP) + public _FinalStage referenceValue(Optional referenceValue) { + this.referenceValue = referenceValue; + return this; + } + + /** + *

The type of tracking reference provided by the payment processor, such as an acquirer reference number. Null if no reference was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referenceType(Nullable referenceType) { + if (referenceType.isNull()) { + this.referenceType = null; + } else if (referenceType.isEmpty()) { + this.referenceType = Optional.empty(); + } else { + this.referenceType = Optional.of(referenceType.get()); + } + return this; + } + + /** + *

The type of tracking reference provided by the payment processor, such as an acquirer reference number. Null if no reference was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referenceType(RefundReferenceTypes referenceType) { + this.referenceType = Optional.ofNullable(referenceType); + return this; + } + + /** + *

The type of tracking reference provided by the payment processor, such as an acquirer reference number. Null if no reference was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "reference_type", nulls = Nulls.SKIP) + public _FinalStage referenceType(Optional referenceType) { + this.referenceType = referenceType; + return this; + } + + /** + *

The availability status of the refund tracking reference from the payment processor. Null if no reference was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referenceStatus(Nullable referenceStatus) { + if (referenceStatus.isNull()) { + this.referenceStatus = null; + } else if (referenceStatus.isEmpty()) { + this.referenceStatus = Optional.empty(); + } else { + this.referenceStatus = Optional.of(referenceStatus.get()); + } + return this; + } + + /** + *

The availability status of the refund tracking reference from the payment processor. Null if no reference was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referenceStatus(RefundReferenceStatuses referenceStatus) { + this.referenceStatus = Optional.ofNullable(referenceStatus); + return this; + } + + /** + *

The availability status of the refund tracking reference from the payment processor. Null if no reference was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "reference_status", nulls = Nulls.SKIP) + public _FinalStage referenceStatus(Optional referenceStatus) { + this.referenceStatus = referenceStatus; + return this; + } + + /** + *

The timestamp when the refund was created in the payment provider's system. Null if not available from the provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage providerCreatedAt(Nullable providerCreatedAt) { + if (providerCreatedAt.isNull()) { + this.providerCreatedAt = null; + } else if (providerCreatedAt.isEmpty()) { + this.providerCreatedAt = Optional.empty(); + } else { + this.providerCreatedAt = Optional.of(providerCreatedAt.get()); + } + return this; + } + + /** + *

The timestamp when the refund was created in the payment provider's system. Null if not available from the provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage providerCreatedAt(OffsetDateTime providerCreatedAt) { + this.providerCreatedAt = Optional.ofNullable(providerCreatedAt); + return this; + } + + /** + *

The timestamp when the refund was created in the payment provider's system. Null if not available from the provider.

+ */ + @java.lang.Override + @JsonSetter(value = "provider_created_at", nulls = Nulls.SKIP) + public _FinalStage providerCreatedAt(Optional providerCreatedAt) { + this.providerCreatedAt = providerCreatedAt; + return this; + } + + /** + *

The original payment that this refund was issued against. Null if the payment is no longer available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(Nullable payment) { + if (payment.isNull()) { + this.payment = null; + } else if (payment.isEmpty()) { + this.payment = Optional.empty(); + } else { + this.payment = Optional.of(payment.get()); + } + return this; + } + + /** + *

The original payment that this refund was issued against. Null if the payment is no longer available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(RefundPayment payment) { + this.payment = Optional.ofNullable(payment); + return this; + } + + /** + *

The original payment that this refund was issued against. Null if the payment is no longer available.

+ */ + @java.lang.Override + @JsonSetter(value = "payment", nulls = Nulls.SKIP) + public _FinalStage payment(Optional payment) { + this.payment = payment; + return this; + } + + @java.lang.Override + public Refund build() { + return new Refund( + amount, + createdAt, + currency, + id, + payment, + provider, + providerCreatedAt, + referenceStatus, + referenceType, + referenceValue, + status, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/RefundListItem.java b/src/main/java/com/whop/api/types/RefundListItem.java new file mode 100644 index 00000000..de76eace --- /dev/null +++ b/src/main/java/com/whop/api/types/RefundListItem.java @@ -0,0 +1,686 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RefundListItem.Builder.class) +public final class RefundListItem { + private final double amount; + + private final OffsetDateTime createdAt; + + private final Currencies currency; + + private final String id; + + private final Optional payment; + + private final PaymentProviders provider; + + private final Optional providerCreatedAt; + + private final Optional referenceStatus; + + private final Optional referenceType; + + private final Optional referenceValue; + + private final RefundStatuses status; + + private final Map additionalProperties; + + private RefundListItem( + double amount, + OffsetDateTime createdAt, + Currencies currency, + String id, + Optional payment, + PaymentProviders provider, + Optional providerCreatedAt, + Optional referenceStatus, + Optional referenceType, + Optional referenceValue, + RefundStatuses status, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.currency = currency; + this.id = id; + this.payment = payment; + this.provider = provider; + this.providerCreatedAt = providerCreatedAt; + this.referenceStatus = referenceStatus; + this.referenceType = referenceType; + this.referenceValue = referenceValue; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The refunded amount as a decimal in the specified currency, such as 10.43 for $10.43 USD. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The datetime the refund was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code for the refunded amount. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The unique identifier for the refund. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The original payment that this refund was issued against. Null if the payment is no longer available. + */ + @JsonIgnore + public Optional getPayment() { + if (payment == null) { + return Optional.empty(); + } + return payment; + } + + /** + * @return The payment provider that processed the refund. + */ + @JsonProperty("provider") + public PaymentProviders getProvider() { + return provider; + } + + /** + * @return The timestamp when the refund was created in the payment provider's system. Null if not available from the provider. + */ + @JsonIgnore + public Optional getProviderCreatedAt() { + if (providerCreatedAt == null) { + return Optional.empty(); + } + return providerCreatedAt; + } + + /** + * @return The availability status of the refund tracking reference from the payment processor. Null if no reference was provided. + */ + @JsonIgnore + public Optional getReferenceStatus() { + if (referenceStatus == null) { + return Optional.empty(); + } + return referenceStatus; + } + + /** + * @return The type of tracking reference provided by the payment processor, such as an acquirer reference number. Null if no reference was provided. + */ + @JsonIgnore + public Optional getReferenceType() { + if (referenceType == null) { + return Optional.empty(); + } + return referenceType; + } + + /** + * @return The tracking reference value from the payment processor, used to trace the refund through banking networks. Null if no reference was provided. + */ + @JsonIgnore + public Optional getReferenceValue() { + if (referenceValue == null) { + return Optional.empty(); + } + return referenceValue; + } + + /** + * @return The current processing status of the refund, such as pending, succeeded, or failed. + */ + @JsonProperty("status") + public RefundStatuses getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment") + private Optional _getPayment() { + return payment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("provider_created_at") + private Optional _getProviderCreatedAt() { + return providerCreatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reference_status") + private Optional _getReferenceStatus() { + return referenceStatus; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reference_type") + private Optional _getReferenceType() { + return referenceType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reference_value") + private Optional _getReferenceValue() { + return referenceValue; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RefundListItem && equalTo((RefundListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RefundListItem other) { + return amount == other.amount + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && id.equals(other.id) + && payment.equals(other.payment) + && provider.equals(other.provider) + && providerCreatedAt.equals(other.providerCreatedAt) + && referenceStatus.equals(other.referenceStatus) + && referenceType.equals(other.referenceType) + && referenceValue.equals(other.referenceValue) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.currency, + this.id, + this.payment, + this.provider, + this.providerCreatedAt, + this.referenceStatus, + this.referenceType, + this.referenceValue, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The refunded amount as a decimal in the specified currency, such as 10.43 for $10.43 USD.

+ */ + CreatedAtStage amount(double amount); + + Builder from(RefundListItem other); + } + + public interface CreatedAtStage { + /** + *

The datetime the refund was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

The three-letter ISO currency code for the refunded amount.

+ */ + IdStage currency(@NotNull Currencies currency); + } + + public interface IdStage { + /** + *

The unique identifier for the refund.

+ */ + ProviderStage id(@NotNull String id); + } + + public interface ProviderStage { + /** + *

The payment provider that processed the refund.

+ */ + StatusStage provider(@NotNull PaymentProviders provider); + } + + public interface StatusStage { + /** + *

The current processing status of the refund, such as pending, succeeded, or failed.

+ */ + _FinalStage status(@NotNull RefundStatuses status); + } + + public interface _FinalStage { + RefundListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The original payment that this refund was issued against. Null if the payment is no longer available.

+ */ + _FinalStage payment(Optional payment); + + _FinalStage payment(RefundListItemPayment payment); + + _FinalStage payment(Nullable payment); + + /** + *

The timestamp when the refund was created in the payment provider's system. Null if not available from the provider.

+ */ + _FinalStage providerCreatedAt(Optional providerCreatedAt); + + _FinalStage providerCreatedAt(OffsetDateTime providerCreatedAt); + + _FinalStage providerCreatedAt(Nullable providerCreatedAt); + + /** + *

The availability status of the refund tracking reference from the payment processor. Null if no reference was provided.

+ */ + _FinalStage referenceStatus(Optional referenceStatus); + + _FinalStage referenceStatus(RefundReferenceStatuses referenceStatus); + + _FinalStage referenceStatus(Nullable referenceStatus); + + /** + *

The type of tracking reference provided by the payment processor, such as an acquirer reference number. Null if no reference was provided.

+ */ + _FinalStage referenceType(Optional referenceType); + + _FinalStage referenceType(RefundReferenceTypes referenceType); + + _FinalStage referenceType(Nullable referenceType); + + /** + *

The tracking reference value from the payment processor, used to trace the refund through banking networks. Null if no reference was provided.

+ */ + _FinalStage referenceValue(Optional referenceValue); + + _FinalStage referenceValue(String referenceValue); + + _FinalStage referenceValue(Nullable referenceValue); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, CreatedAtStage, CurrencyStage, IdStage, ProviderStage, StatusStage, _FinalStage { + private double amount; + + private OffsetDateTime createdAt; + + private Currencies currency; + + private String id; + + private PaymentProviders provider; + + private RefundStatuses status; + + private Optional referenceValue = Optional.empty(); + + private Optional referenceType = Optional.empty(); + + private Optional referenceStatus = Optional.empty(); + + private Optional providerCreatedAt = Optional.empty(); + + private Optional payment = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RefundListItem other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + id(other.getId()); + payment(other.getPayment()); + provider(other.getProvider()); + providerCreatedAt(other.getProviderCreatedAt()); + referenceStatus(other.getReferenceStatus()); + referenceType(other.getReferenceType()); + referenceValue(other.getReferenceValue()); + status(other.getStatus()); + return this; + } + + /** + *

The refunded amount as a decimal in the specified currency, such as 10.43 for $10.43 USD.

+ *

The refunded amount as a decimal in the specified currency, such as 10.43 for $10.43 USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The datetime the refund was created.

+ *

The datetime the refund was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The three-letter ISO currency code for the refunded amount.

+ *

The three-letter ISO currency code for the refunded amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier for the refund.

+ *

The unique identifier for the refund.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ProviderStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The payment provider that processed the refund.

+ *

The payment provider that processed the refund.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("provider") + public StatusStage provider(@NotNull PaymentProviders provider) { + this.provider = Objects.requireNonNull(provider, "provider must not be null"); + return this; + } + + /** + *

The current processing status of the refund, such as pending, succeeded, or failed.

+ *

The current processing status of the refund, such as pending, succeeded, or failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull RefundStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The tracking reference value from the payment processor, used to trace the refund through banking networks. Null if no reference was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referenceValue(Nullable referenceValue) { + if (referenceValue.isNull()) { + this.referenceValue = null; + } else if (referenceValue.isEmpty()) { + this.referenceValue = Optional.empty(); + } else { + this.referenceValue = Optional.of(referenceValue.get()); + } + return this; + } + + /** + *

The tracking reference value from the payment processor, used to trace the refund through banking networks. Null if no reference was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referenceValue(String referenceValue) { + this.referenceValue = Optional.ofNullable(referenceValue); + return this; + } + + /** + *

The tracking reference value from the payment processor, used to trace the refund through banking networks. Null if no reference was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "reference_value", nulls = Nulls.SKIP) + public _FinalStage referenceValue(Optional referenceValue) { + this.referenceValue = referenceValue; + return this; + } + + /** + *

The type of tracking reference provided by the payment processor, such as an acquirer reference number. Null if no reference was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referenceType(Nullable referenceType) { + if (referenceType.isNull()) { + this.referenceType = null; + } else if (referenceType.isEmpty()) { + this.referenceType = Optional.empty(); + } else { + this.referenceType = Optional.of(referenceType.get()); + } + return this; + } + + /** + *

The type of tracking reference provided by the payment processor, such as an acquirer reference number. Null if no reference was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referenceType(RefundReferenceTypes referenceType) { + this.referenceType = Optional.ofNullable(referenceType); + return this; + } + + /** + *

The type of tracking reference provided by the payment processor, such as an acquirer reference number. Null if no reference was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "reference_type", nulls = Nulls.SKIP) + public _FinalStage referenceType(Optional referenceType) { + this.referenceType = referenceType; + return this; + } + + /** + *

The availability status of the refund tracking reference from the payment processor. Null if no reference was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referenceStatus(Nullable referenceStatus) { + if (referenceStatus.isNull()) { + this.referenceStatus = null; + } else if (referenceStatus.isEmpty()) { + this.referenceStatus = Optional.empty(); + } else { + this.referenceStatus = Optional.of(referenceStatus.get()); + } + return this; + } + + /** + *

The availability status of the refund tracking reference from the payment processor. Null if no reference was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage referenceStatus(RefundReferenceStatuses referenceStatus) { + this.referenceStatus = Optional.ofNullable(referenceStatus); + return this; + } + + /** + *

The availability status of the refund tracking reference from the payment processor. Null if no reference was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "reference_status", nulls = Nulls.SKIP) + public _FinalStage referenceStatus(Optional referenceStatus) { + this.referenceStatus = referenceStatus; + return this; + } + + /** + *

The timestamp when the refund was created in the payment provider's system. Null if not available from the provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage providerCreatedAt(Nullable providerCreatedAt) { + if (providerCreatedAt.isNull()) { + this.providerCreatedAt = null; + } else if (providerCreatedAt.isEmpty()) { + this.providerCreatedAt = Optional.empty(); + } else { + this.providerCreatedAt = Optional.of(providerCreatedAt.get()); + } + return this; + } + + /** + *

The timestamp when the refund was created in the payment provider's system. Null if not available from the provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage providerCreatedAt(OffsetDateTime providerCreatedAt) { + this.providerCreatedAt = Optional.ofNullable(providerCreatedAt); + return this; + } + + /** + *

The timestamp when the refund was created in the payment provider's system. Null if not available from the provider.

+ */ + @java.lang.Override + @JsonSetter(value = "provider_created_at", nulls = Nulls.SKIP) + public _FinalStage providerCreatedAt(Optional providerCreatedAt) { + this.providerCreatedAt = providerCreatedAt; + return this; + } + + /** + *

The original payment that this refund was issued against. Null if the payment is no longer available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(Nullable payment) { + if (payment.isNull()) { + this.payment = null; + } else if (payment.isEmpty()) { + this.payment = Optional.empty(); + } else { + this.payment = Optional.of(payment.get()); + } + return this; + } + + /** + *

The original payment that this refund was issued against. Null if the payment is no longer available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(RefundListItemPayment payment) { + this.payment = Optional.ofNullable(payment); + return this; + } + + /** + *

The original payment that this refund was issued against. Null if the payment is no longer available.

+ */ + @java.lang.Override + @JsonSetter(value = "payment", nulls = Nulls.SKIP) + public _FinalStage payment(Optional payment) { + this.payment = payment; + return this; + } + + @java.lang.Override + public RefundListItem build() { + return new RefundListItem( + amount, + createdAt, + currency, + id, + payment, + provider, + providerCreatedAt, + referenceStatus, + referenceType, + referenceValue, + status, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/RefundListItemPayment.java b/src/main/java/com/whop/api/types/RefundListItemPayment.java new file mode 100644 index 00000000..d02aabc9 --- /dev/null +++ b/src/main/java/com/whop/api/types/RefundListItemPayment.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RefundListItemPayment.Builder.class) +public final class RefundListItemPayment { + private final String id; + + private final Map additionalProperties; + + private RefundListItemPayment(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the payment. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RefundListItemPayment && equalTo((RefundListItemPayment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RefundListItemPayment other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the payment.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(RefundListItemPayment other); + } + + public interface _FinalStage { + RefundListItemPayment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RefundListItemPayment other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the payment.

+ *

The unique identifier for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public RefundListItemPayment build() { + return new RefundListItemPayment(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/RefundPayment.java b/src/main/java/com/whop/api/types/RefundPayment.java new file mode 100644 index 00000000..f3e4d9c4 --- /dev/null +++ b/src/main/java/com/whop/api/types/RefundPayment.java @@ -0,0 +1,1510 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RefundPayment.Builder.class) +public final class RefundPayment { + private final Optional billingReason; + + private final Optional cardBrand; + + private final Optional cardLast4; + + private final OffsetDateTime createdAt; + + private final Currencies currency; + + private final Optional disputeAlertedAt; + + private final String id; + + private final Optional member; + + private final Optional membership; + + private final Optional> metadata; + + private final Optional paidAt; + + private final Optional paymentMethodType; + + private final Optional plan; + + private final Optional product; + + private final Optional subtotal; + + private final Optional taxAmount; + + private final Optional taxBehavior; + + private final Optional taxRefundedAmount; + + private final Optional total; + + private final Optional usdTotal; + + private final Optional user; + + private final Map additionalProperties; + + private RefundPayment( + Optional billingReason, + Optional cardBrand, + Optional cardLast4, + OffsetDateTime createdAt, + Currencies currency, + Optional disputeAlertedAt, + String id, + Optional member, + Optional membership, + Optional> metadata, + Optional paidAt, + Optional paymentMethodType, + Optional plan, + Optional product, + Optional subtotal, + Optional taxAmount, + Optional taxBehavior, + Optional taxRefundedAmount, + Optional total, + Optional usdTotal, + Optional user, + Map additionalProperties) { + this.billingReason = billingReason; + this.cardBrand = cardBrand; + this.cardLast4 = cardLast4; + this.createdAt = createdAt; + this.currency = currency; + this.disputeAlertedAt = disputeAlertedAt; + this.id = id; + this.member = member; + this.membership = membership; + this.metadata = metadata; + this.paidAt = paidAt; + this.paymentMethodType = paymentMethodType; + this.plan = plan; + this.product = product; + this.subtotal = subtotal; + this.taxAmount = taxAmount; + this.taxBehavior = taxBehavior; + this.taxRefundedAmount = taxRefundedAmount; + this.total = total; + this.usdTotal = usdTotal; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment. + */ + @JsonIgnore + public Optional getBillingReason() { + if (billingReason == null) { + return Optional.empty(); + } + return billingReason; + } + + /** + * @return Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'. + */ + @JsonIgnore + public Optional getCardBrand() { + if (cardBrand == null) { + return Optional.empty(); + } + return cardBrand; + } + + /** + * @return The last four digits of the card used to make this payment. Null if the payment was not made with a card. + */ + @JsonIgnore + public Optional getCardLast4() { + if (cardLast4 == null) { + return Optional.empty(); + } + return cardLast4; + } + + /** + * @return The datetime the payment was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code for this payment (e.g., 'usd', 'eur'). + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return When an alert came in that this transaction will be disputed + */ + @JsonIgnore + public Optional getDisputeAlertedAt() { + if (disputeAlertedAt == null) { + return Optional.empty(); + } + return disputeAlertedAt; + } + + /** + * @return The unique identifier for the payment. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The member attached to this payment. + */ + @JsonIgnore + public Optional getMember() { + if (member == null) { + return Optional.empty(); + } + return member; + } + + /** + * @return The membership attached to this payment. + */ + @JsonIgnore + public Optional getMembership() { + if (membership == null) { + return Optional.empty(); + } + return membership; + } + + /** + * @return The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp. + */ + @JsonIgnore + public Optional getPaidAt() { + if (paidAt == null) { + return Optional.empty(); + } + return paidAt; + } + + /** + * @return The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type. + */ + @JsonIgnore + public Optional getPaymentMethodType() { + if (paymentMethodType == null) { + return Optional.empty(); + } + return paymentMethodType; + } + + /** + * @return The plan attached to this payment. + */ + @JsonIgnore + public Optional getPlan() { + if (plan == null) { + return Optional.empty(); + } + return plan; + } + + /** + * @return The product this payment was made for + */ + @JsonIgnore + public Optional getProduct() { + if (product == null) { + return Optional.empty(); + } + return product; + } + + /** + * @return The subtotal to show to the creator (excluding buyer fees). + */ + @JsonIgnore + public Optional getSubtotal() { + if (subtotal == null) { + return Optional.empty(); + } + return subtotal; + } + + /** + * @return The calculated amount of the sales/VAT tax (if applicable). + */ + @JsonIgnore + public Optional getTaxAmount() { + if (taxAmount == null) { + return Optional.empty(); + } + return taxAmount; + } + + /** + * @return The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top. + */ + @JsonIgnore + public Optional getTaxBehavior() { + if (taxBehavior == null) { + return Optional.empty(); + } + return taxBehavior; + } + + /** + * @return The amount of tax that has been refunded (if applicable). + */ + @JsonIgnore + public Optional getTaxRefundedAmount() { + if (taxRefundedAmount == null) { + return Optional.empty(); + } + return taxRefundedAmount; + } + + /** + * @return The total to show to the creator (excluding buyer fees). + */ + @JsonIgnore + public Optional getTotal() { + if (total == null) { + return Optional.empty(); + } + return total; + } + + /** + * @return The total in USD to show to the creator (excluding buyer fees). + */ + @JsonIgnore + public Optional getUsdTotal() { + if (usdTotal == null) { + return Optional.empty(); + } + return usdTotal; + } + + /** + * @return The user that made this payment. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("billing_reason") + private Optional _getBillingReason() { + return billingReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_brand") + private Optional _getCardBrand() { + return cardBrand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_last4") + private Optional _getCardLast4() { + return cardLast4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("dispute_alerted_at") + private Optional _getDisputeAlertedAt() { + return disputeAlertedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member") + private Optional _getMember() { + return member; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("membership") + private Optional _getMembership() { + return membership; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("paid_at") + private Optional _getPaidAt() { + return paidAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_type") + private Optional _getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan") + private Optional _getPlan() { + return plan; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product") + private Optional _getProduct() { + return product; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("subtotal") + private Optional _getSubtotal() { + return subtotal; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_amount") + private Optional _getTaxAmount() { + return taxAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_behavior") + private Optional _getTaxBehavior() { + return taxBehavior; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("tax_refunded_amount") + private Optional _getTaxRefundedAmount() { + return taxRefundedAmount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("total") + private Optional _getTotal() { + return total; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("usd_total") + private Optional _getUsdTotal() { + return usdTotal; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RefundPayment && equalTo((RefundPayment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RefundPayment other) { + return billingReason.equals(other.billingReason) + && cardBrand.equals(other.cardBrand) + && cardLast4.equals(other.cardLast4) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && disputeAlertedAt.equals(other.disputeAlertedAt) + && id.equals(other.id) + && member.equals(other.member) + && membership.equals(other.membership) + && metadata.equals(other.metadata) + && paidAt.equals(other.paidAt) + && paymentMethodType.equals(other.paymentMethodType) + && plan.equals(other.plan) + && product.equals(other.product) + && subtotal.equals(other.subtotal) + && taxAmount.equals(other.taxAmount) + && taxBehavior.equals(other.taxBehavior) + && taxRefundedAmount.equals(other.taxRefundedAmount) + && total.equals(other.total) + && usdTotal.equals(other.usdTotal) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billingReason, + this.cardBrand, + this.cardLast4, + this.createdAt, + this.currency, + this.disputeAlertedAt, + this.id, + this.member, + this.membership, + this.metadata, + this.paidAt, + this.paymentMethodType, + this.plan, + this.product, + this.subtotal, + this.taxAmount, + this.taxBehavior, + this.taxRefundedAmount, + this.total, + this.usdTotal, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the payment was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(RefundPayment other); + } + + public interface CurrencyStage { + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ */ + IdStage currency(@NotNull Currencies currency); + } + + public interface IdStage { + /** + *

The unique identifier for the payment.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + RefundPayment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ */ + _FinalStage billingReason(Optional billingReason); + + _FinalStage billingReason(BillingReasons billingReason); + + _FinalStage billingReason(Nullable billingReason); + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ */ + _FinalStage cardBrand(Optional cardBrand); + + _FinalStage cardBrand(CardBrands cardBrand); + + _FinalStage cardBrand(Nullable cardBrand); + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ */ + _FinalStage cardLast4(Optional cardLast4); + + _FinalStage cardLast4(String cardLast4); + + _FinalStage cardLast4(Nullable cardLast4); + + /** + *

When an alert came in that this transaction will be disputed

+ */ + _FinalStage disputeAlertedAt(Optional disputeAlertedAt); + + _FinalStage disputeAlertedAt(OffsetDateTime disputeAlertedAt); + + _FinalStage disputeAlertedAt(Nullable disputeAlertedAt); + + /** + *

The member attached to this payment.

+ */ + _FinalStage member(Optional member); + + _FinalStage member(RefundPaymentMember member); + + _FinalStage member(Nullable member); + + /** + *

The membership attached to this payment.

+ */ + _FinalStage membership(Optional membership); + + _FinalStage membership(RefundPaymentMembership membership); + + _FinalStage membership(Nullable membership); + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ */ + _FinalStage paidAt(Optional paidAt); + + _FinalStage paidAt(OffsetDateTime paidAt); + + _FinalStage paidAt(Nullable paidAt); + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ */ + _FinalStage paymentMethodType(Optional paymentMethodType); + + _FinalStage paymentMethodType(PaymentMethodTypes paymentMethodType); + + _FinalStage paymentMethodType(Nullable paymentMethodType); + + /** + *

The plan attached to this payment.

+ */ + _FinalStage plan(Optional plan); + + _FinalStage plan(RefundPaymentPlan plan); + + _FinalStage plan(Nullable plan); + + /** + *

The product this payment was made for

+ */ + _FinalStage product(Optional product); + + _FinalStage product(RefundPaymentProduct product); + + _FinalStage product(Nullable product); + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ */ + _FinalStage subtotal(Optional subtotal); + + _FinalStage subtotal(Double subtotal); + + _FinalStage subtotal(Nullable subtotal); + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ */ + _FinalStage taxAmount(Optional taxAmount); + + _FinalStage taxAmount(Double taxAmount); + + _FinalStage taxAmount(Nullable taxAmount); + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ */ + _FinalStage taxBehavior(Optional taxBehavior); + + _FinalStage taxBehavior(ReceiptTaxBehaviors taxBehavior); + + _FinalStage taxBehavior(Nullable taxBehavior); + + /** + *

The amount of tax that has been refunded (if applicable).

+ */ + _FinalStage taxRefundedAmount(Optional taxRefundedAmount); + + _FinalStage taxRefundedAmount(Double taxRefundedAmount); + + _FinalStage taxRefundedAmount(Nullable taxRefundedAmount); + + /** + *

The total to show to the creator (excluding buyer fees).

+ */ + _FinalStage total(Optional total); + + _FinalStage total(Double total); + + _FinalStage total(Nullable total); + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ */ + _FinalStage usdTotal(Optional usdTotal); + + _FinalStage usdTotal(Double usdTotal); + + _FinalStage usdTotal(Nullable usdTotal); + + /** + *

The user that made this payment.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(RefundPaymentUser user); + + _FinalStage user(Nullable user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, CurrencyStage, IdStage, _FinalStage { + private OffsetDateTime createdAt; + + private Currencies currency; + + private String id; + + private Optional user = Optional.empty(); + + private Optional usdTotal = Optional.empty(); + + private Optional total = Optional.empty(); + + private Optional taxRefundedAmount = Optional.empty(); + + private Optional taxBehavior = Optional.empty(); + + private Optional taxAmount = Optional.empty(); + + private Optional subtotal = Optional.empty(); + + private Optional product = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional paymentMethodType = Optional.empty(); + + private Optional paidAt = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional membership = Optional.empty(); + + private Optional member = Optional.empty(); + + private Optional disputeAlertedAt = Optional.empty(); + + private Optional cardLast4 = Optional.empty(); + + private Optional cardBrand = Optional.empty(); + + private Optional billingReason = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RefundPayment other) { + billingReason(other.getBillingReason()); + cardBrand(other.getCardBrand()); + cardLast4(other.getCardLast4()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + disputeAlertedAt(other.getDisputeAlertedAt()); + id(other.getId()); + member(other.getMember()); + membership(other.getMembership()); + metadata(other.getMetadata()); + paidAt(other.getPaidAt()); + paymentMethodType(other.getPaymentMethodType()); + plan(other.getPlan()); + product(other.getProduct()); + subtotal(other.getSubtotal()); + taxAmount(other.getTaxAmount()); + taxBehavior(other.getTaxBehavior()); + taxRefundedAmount(other.getTaxRefundedAmount()); + total(other.getTotal()); + usdTotal(other.getUsdTotal()); + user(other.getUser()); + return this; + } + + /** + *

The datetime the payment was created.

+ *

The datetime the payment was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The unique identifier for the payment.

+ *

The unique identifier for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user that made this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The user that made this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(RefundPaymentUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The user that made this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdTotal(Nullable usdTotal) { + if (usdTotal.isNull()) { + this.usdTotal = null; + } else if (usdTotal.isEmpty()) { + this.usdTotal = Optional.empty(); + } else { + this.usdTotal = Optional.of(usdTotal.get()); + } + return this; + } + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage usdTotal(Double usdTotal) { + this.usdTotal = Optional.ofNullable(usdTotal); + return this; + } + + /** + *

The total in USD to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "usd_total", nulls = Nulls.SKIP) + public _FinalStage usdTotal(Optional usdTotal) { + this.usdTotal = usdTotal; + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage total(Nullable total) { + if (total.isNull()) { + this.total = null; + } else if (total.isEmpty()) { + this.total = Optional.empty(); + } else { + this.total = Optional.of(total.get()); + } + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage total(Double total) { + this.total = Optional.ofNullable(total); + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "total", nulls = Nulls.SKIP) + public _FinalStage total(Optional total) { + this.total = total; + return this; + } + + /** + *

The amount of tax that has been refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxRefundedAmount(Nullable taxRefundedAmount) { + if (taxRefundedAmount.isNull()) { + this.taxRefundedAmount = null; + } else if (taxRefundedAmount.isEmpty()) { + this.taxRefundedAmount = Optional.empty(); + } else { + this.taxRefundedAmount = Optional.of(taxRefundedAmount.get()); + } + return this; + } + + /** + *

The amount of tax that has been refunded (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxRefundedAmount(Double taxRefundedAmount) { + this.taxRefundedAmount = Optional.ofNullable(taxRefundedAmount); + return this; + } + + /** + *

The amount of tax that has been refunded (if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "tax_refunded_amount", nulls = Nulls.SKIP) + public _FinalStage taxRefundedAmount(Optional taxRefundedAmount) { + this.taxRefundedAmount = taxRefundedAmount; + return this; + } + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxBehavior(Nullable taxBehavior) { + if (taxBehavior.isNull()) { + this.taxBehavior = null; + } else if (taxBehavior.isEmpty()) { + this.taxBehavior = Optional.empty(); + } else { + this.taxBehavior = Optional.of(taxBehavior.get()); + } + return this; + } + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxBehavior(ReceiptTaxBehaviors taxBehavior) { + this.taxBehavior = Optional.ofNullable(taxBehavior); + return this; + } + + /** + *

The type of tax inclusivity applied to the payment, for determining whether the tax is included in the final price, or paid on top.

+ */ + @java.lang.Override + @JsonSetter(value = "tax_behavior", nulls = Nulls.SKIP) + public _FinalStage taxBehavior(Optional taxBehavior) { + this.taxBehavior = taxBehavior; + return this; + } + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxAmount(Nullable taxAmount) { + if (taxAmount.isNull()) { + this.taxAmount = null; + } else if (taxAmount.isEmpty()) { + this.taxAmount = Optional.empty(); + } else { + this.taxAmount = Optional.of(taxAmount.get()); + } + return this; + } + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage taxAmount(Double taxAmount) { + this.taxAmount = Optional.ofNullable(taxAmount); + return this; + } + + /** + *

The calculated amount of the sales/VAT tax (if applicable).

+ */ + @java.lang.Override + @JsonSetter(value = "tax_amount", nulls = Nulls.SKIP) + public _FinalStage taxAmount(Optional taxAmount) { + this.taxAmount = taxAmount; + return this; + } + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subtotal(Nullable subtotal) { + if (subtotal.isNull()) { + this.subtotal = null; + } else if (subtotal.isEmpty()) { + this.subtotal = Optional.empty(); + } else { + this.subtotal = Optional.of(subtotal.get()); + } + return this; + } + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage subtotal(Double subtotal) { + this.subtotal = Optional.ofNullable(subtotal); + return this; + } + + /** + *

The subtotal to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "subtotal", nulls = Nulls.SKIP) + public _FinalStage subtotal(Optional subtotal) { + this.subtotal = subtotal; + return this; + } + + /** + *

The product this payment was made for

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(Nullable product) { + if (product.isNull()) { + this.product = null; + } else if (product.isEmpty()) { + this.product = Optional.empty(); + } else { + this.product = Optional.of(product.get()); + } + return this; + } + + /** + *

The product this payment was made for

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage product(RefundPaymentProduct product) { + this.product = Optional.ofNullable(product); + return this; + } + + /** + *

The product this payment was made for

+ */ + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + /** + *

The plan attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(Nullable plan) { + if (plan.isNull()) { + this.plan = null; + } else if (plan.isEmpty()) { + this.plan = Optional.empty(); + } else { + this.plan = Optional.of(plan.get()); + } + return this; + } + + /** + *

The plan attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(RefundPaymentPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + /** + *

The plan attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(Nullable paymentMethodType) { + if (paymentMethodType.isNull()) { + this.paymentMethodType = null; + } else if (paymentMethodType.isEmpty()) { + this.paymentMethodType = Optional.empty(); + } else { + this.paymentMethodType = Optional.of(paymentMethodType.get()); + } + return this; + } + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Optional.ofNullable(paymentMethodType); + return this; + } + + /** + *

The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_type", nulls = Nulls.SKIP) + public _FinalStage paymentMethodType(Optional paymentMethodType) { + this.paymentMethodType = paymentMethodType; + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidAt(Nullable paidAt) { + if (paidAt.isNull()) { + this.paidAt = null; + } else if (paidAt.isEmpty()) { + this.paidAt = Optional.empty(); + } else { + this.paidAt = Optional.of(paidAt.get()); + } + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidAt(OffsetDateTime paidAt) { + this.paidAt = Optional.ofNullable(paidAt); + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "paid_at", nulls = Nulls.SKIP) + public _FinalStage paidAt(Optional paidAt) { + this.paidAt = paidAt; + return this; + } + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

The custom metadata stored on this payment. This will be copied over to the checkout configuration for which this payment was made

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The membership attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage membership(Nullable membership) { + if (membership.isNull()) { + this.membership = null; + } else if (membership.isEmpty()) { + this.membership = Optional.empty(); + } else { + this.membership = Optional.of(membership.get()); + } + return this; + } + + /** + *

The membership attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage membership(RefundPaymentMembership membership) { + this.membership = Optional.ofNullable(membership); + return this; + } + + /** + *

The membership attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "membership", nulls = Nulls.SKIP) + public _FinalStage membership(Optional membership) { + this.membership = membership; + return this; + } + + /** + *

The member attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(Nullable member) { + if (member.isNull()) { + this.member = null; + } else if (member.isEmpty()) { + this.member = Optional.empty(); + } else { + this.member = Optional.of(member.get()); + } + return this; + } + + /** + *

The member attached to this payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(RefundPaymentMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + /** + *

The member attached to this payment.

+ */ + @java.lang.Override + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public _FinalStage member(Optional member) { + this.member = member; + return this; + } + + /** + *

When an alert came in that this transaction will be disputed

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputeAlertedAt(Nullable disputeAlertedAt) { + if (disputeAlertedAt.isNull()) { + this.disputeAlertedAt = null; + } else if (disputeAlertedAt.isEmpty()) { + this.disputeAlertedAt = Optional.empty(); + } else { + this.disputeAlertedAt = Optional.of(disputeAlertedAt.get()); + } + return this; + } + + /** + *

When an alert came in that this transaction will be disputed

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disputeAlertedAt(OffsetDateTime disputeAlertedAt) { + this.disputeAlertedAt = Optional.ofNullable(disputeAlertedAt); + return this; + } + + /** + *

When an alert came in that this transaction will be disputed

+ */ + @java.lang.Override + @JsonSetter(value = "dispute_alerted_at", nulls = Nulls.SKIP) + public _FinalStage disputeAlertedAt(Optional disputeAlertedAt) { + this.disputeAlertedAt = disputeAlertedAt; + return this; + } + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardLast4(Nullable cardLast4) { + if (cardLast4.isNull()) { + this.cardLast4 = null; + } else if (cardLast4.isEmpty()) { + this.cardLast4 = Optional.empty(); + } else { + this.cardLast4 = Optional.of(cardLast4.get()); + } + return this; + } + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardLast4(String cardLast4) { + this.cardLast4 = Optional.ofNullable(cardLast4); + return this; + } + + /** + *

The last four digits of the card used to make this payment. Null if the payment was not made with a card.

+ */ + @java.lang.Override + @JsonSetter(value = "card_last4", nulls = Nulls.SKIP) + public _FinalStage cardLast4(Optional cardLast4) { + this.cardLast4 = cardLast4; + return this; + } + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(Nullable cardBrand) { + if (cardBrand.isNull()) { + this.cardBrand = null; + } else if (cardBrand.isEmpty()) { + this.cardBrand = Optional.empty(); + } else { + this.cardBrand = Optional.of(cardBrand.get()); + } + return this; + } + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(CardBrands cardBrand) { + this.cardBrand = Optional.ofNullable(cardBrand); + return this; + } + + /** + *

Card network reported by the processor (e.g., 'visa', 'mastercard', 'amex'). Present only when the payment method type is 'card'.

+ */ + @java.lang.Override + @JsonSetter(value = "card_brand", nulls = Nulls.SKIP) + public _FinalStage cardBrand(Optional cardBrand) { + this.cardBrand = cardBrand; + return this; + } + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingReason(Nullable billingReason) { + if (billingReason.isNull()) { + this.billingReason = null; + } else if (billingReason.isEmpty()) { + this.billingReason = Optional.empty(); + } else { + this.billingReason = Optional.of(billingReason.get()); + } + return this; + } + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingReason(BillingReasons billingReason) { + this.billingReason = Optional.ofNullable(billingReason); + return this; + } + + /** + *

The machine-readable reason this charge was created, such as initial subscription purchase, renewal cycle, or one-time payment.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_reason", nulls = Nulls.SKIP) + public _FinalStage billingReason(Optional billingReason) { + this.billingReason = billingReason; + return this; + } + + @java.lang.Override + public RefundPayment build() { + return new RefundPayment( + billingReason, + cardBrand, + cardLast4, + createdAt, + currency, + disputeAlertedAt, + id, + member, + membership, + metadata, + paidAt, + paymentMethodType, + plan, + product, + subtotal, + taxAmount, + taxBehavior, + taxRefundedAmount, + total, + usdTotal, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/RefundPaymentMember.java b/src/main/java/com/whop/api/types/RefundPaymentMember.java new file mode 100644 index 00000000..6ee7a4f0 --- /dev/null +++ b/src/main/java/com/whop/api/types/RefundPaymentMember.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RefundPaymentMember.Builder.class) +public final class RefundPaymentMember { + private final String id; + + private final Optional phone; + + private final Map additionalProperties; + + private RefundPaymentMember(String id, Optional phone, Map additionalProperties) { + this.id = id; + this.phone = phone; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company member. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The phone number for the member, if available. + */ + @JsonIgnore + public Optional getPhone() { + if (phone == null) { + return Optional.empty(); + } + return phone; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("phone") + private Optional _getPhone() { + return phone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RefundPaymentMember && equalTo((RefundPaymentMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RefundPaymentMember other) { + return id.equals(other.id) && phone.equals(other.phone); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.phone); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company member.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(RefundPaymentMember other); + } + + public interface _FinalStage { + RefundPaymentMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The phone number for the member, if available.

+ */ + _FinalStage phone(Optional phone); + + _FinalStage phone(String phone); + + _FinalStage phone(Nullable phone); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional phone = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RefundPaymentMember other) { + id(other.getId()); + phone(other.getPhone()); + return this; + } + + /** + *

The unique identifier for the company member.

+ *

The unique identifier for the company member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The phone number for the member, if available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(Nullable phone) { + if (phone.isNull()) { + this.phone = null; + } else if (phone.isEmpty()) { + this.phone = Optional.empty(); + } else { + this.phone = Optional.of(phone.get()); + } + return this; + } + + /** + *

The phone number for the member, if available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + /** + *

The phone number for the member, if available.

+ */ + @java.lang.Override + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public _FinalStage phone(Optional phone) { + this.phone = phone; + return this; + } + + @java.lang.Override + public RefundPaymentMember build() { + return new RefundPaymentMember(id, phone, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/RefundPaymentMembership.java b/src/main/java/com/whop/api/types/RefundPaymentMembership.java new file mode 100644 index 00000000..b2227e89 --- /dev/null +++ b/src/main/java/com/whop/api/types/RefundPaymentMembership.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RefundPaymentMembership.Builder.class) +public final class RefundPaymentMembership { + private final String id; + + private final MembershipStatus status; + + private final Map additionalProperties; + + private RefundPaymentMembership(String id, MembershipStatus status, Map additionalProperties) { + this.id = id; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the membership. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The state of the membership. + */ + @JsonProperty("status") + public MembershipStatus getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RefundPaymentMembership && equalTo((RefundPaymentMembership) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RefundPaymentMembership other) { + return id.equals(other.id) && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the membership.

+ */ + StatusStage id(@NotNull String id); + + Builder from(RefundPaymentMembership other); + } + + public interface StatusStage { + /** + *

The state of the membership.

+ */ + _FinalStage status(@NotNull MembershipStatus status); + } + + public interface _FinalStage { + RefundPaymentMembership build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, StatusStage, _FinalStage { + private String id; + + private MembershipStatus status; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RefundPaymentMembership other) { + id(other.getId()); + status(other.getStatus()); + return this; + } + + /** + *

The unique identifier for the membership.

+ *

The unique identifier for the membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The state of the membership.

+ *

The state of the membership.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull MembershipStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + public RefundPaymentMembership build() { + return new RefundPaymentMembership(id, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/RefundPaymentPlan.java b/src/main/java/com/whop/api/types/RefundPaymentPlan.java new file mode 100644 index 00000000..081d49a8 --- /dev/null +++ b/src/main/java/com/whop/api/types/RefundPaymentPlan.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RefundPaymentPlan.Builder.class) +public final class RefundPaymentPlan { + private final String id; + + private final Optional> metadata; + + private final Map additionalProperties; + + private RefundPaymentPlan( + String id, Optional> metadata, Map additionalProperties) { + this.id = id; + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the plan. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RefundPaymentPlan && equalTo((RefundPaymentPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RefundPaymentPlan other) { + return id.equals(other.id) && metadata.equals(other.metadata); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.metadata); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the plan.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(RefundPaymentPlan other); + } + + public interface _FinalStage { + RefundPaymentPlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional> metadata = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RefundPaymentPlan other) { + id(other.getId()); + metadata(other.getMetadata()); + return this; + } + + /** + *

The unique identifier for the plan.

+ *

The unique identifier for the plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs stored on the plan. Included in webhook payloads for payment and membership events. Max 50 keys, 100 chars per key, 500 chars per string value. The reserved keys custom_cta and custom_cta_url, when set, override the product's checkout call to action for this plan.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + @java.lang.Override + public RefundPaymentPlan build() { + return new RefundPaymentPlan(id, metadata, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/RefundPaymentProduct.java b/src/main/java/com/whop/api/types/RefundPaymentProduct.java new file mode 100644 index 00000000..a39489e7 --- /dev/null +++ b/src/main/java/com/whop/api/types/RefundPaymentProduct.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RefundPaymentProduct.Builder.class) +public final class RefundPaymentProduct { + private final String id; + + private final Optional> metadata; + + private final Map additionalProperties; + + private RefundPaymentProduct( + String id, Optional> metadata, Map additionalProperties) { + this.id = id; + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the product. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RefundPaymentProduct && equalTo((RefundPaymentProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RefundPaymentProduct other) { + return id.equals(other.id) && metadata.equals(other.metadata); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.metadata); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the product.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(RefundPaymentProduct other); + } + + public interface _FinalStage { + RefundPaymentProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional> metadata = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RefundPaymentProduct other) { + id(other.getId()); + metadata(other.getMetadata()); + return this; + } + + /** + *

The unique identifier for the product.

+ *

The unique identifier for the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs stored on the product and included in payment and membership webhook payloads. Max 50 keys, 100 characters per key, 500 characters per string value.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + @java.lang.Override + public RefundPaymentProduct build() { + return new RefundPaymentProduct(id, metadata, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/RefundPaymentUser.java b/src/main/java/com/whop/api/types/RefundPaymentUser.java new file mode 100644 index 00000000..256d48e4 --- /dev/null +++ b/src/main/java/com/whop/api/types/RefundPaymentUser.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RefundPaymentUser.Builder.class) +public final class RefundPaymentUser { + private final Optional email; + + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private RefundPaymentUser( + Optional email, + String id, + Optional name, + String username, + Map additionalProperties) { + this.email = email; + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's email address. Requires the member:email:read permission to access. Null if not authorized. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RefundPaymentUser && equalTo((RefundPaymentUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RefundPaymentUser other) { + return email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(RefundPaymentUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + RefundPaymentUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RefundPaymentUser other) { + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The user's email address. Requires the member:email:read permission to access. Null if not authorized.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public RefundPaymentUser build() { + return new RefundPaymentUser(email, id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/RefundReferenceStatuses.java b/src/main/java/com/whop/api/types/RefundReferenceStatuses.java new file mode 100644 index 00000000..a63c3273 --- /dev/null +++ b/src/main/java/com/whop/api/types/RefundReferenceStatuses.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RefundReferenceStatuses { + public static final RefundReferenceStatuses AVAILABLE = new RefundReferenceStatuses(Value.AVAILABLE, "available"); + + public static final RefundReferenceStatuses PENDING = new RefundReferenceStatuses(Value.PENDING, "pending"); + + public static final RefundReferenceStatuses UNAVAILABLE = + new RefundReferenceStatuses(Value.UNAVAILABLE, "unavailable"); + + private final Value value; + + private final String string; + + RefundReferenceStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RefundReferenceStatuses + && this.string.equals(((RefundReferenceStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AVAILABLE: + return visitor.visitAvailable(); + case PENDING: + return visitor.visitPending(); + case UNAVAILABLE: + return visitor.visitUnavailable(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RefundReferenceStatuses valueOf(String value) { + switch (value) { + case "available": + return AVAILABLE; + case "pending": + return PENDING; + case "unavailable": + return UNAVAILABLE; + default: + return new RefundReferenceStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + AVAILABLE, + + PENDING, + + UNAVAILABLE, + + UNKNOWN + } + + public interface Visitor { + T visitAvailable(); + + T visitPending(); + + T visitUnavailable(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/RefundReferenceTypes.java b/src/main/java/com/whop/api/types/RefundReferenceTypes.java new file mode 100644 index 00000000..5d63ed94 --- /dev/null +++ b/src/main/java/com/whop/api/types/RefundReferenceTypes.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RefundReferenceTypes { + public static final RefundReferenceTypes RETRIEVAL_REFERENCE_NUMBER = + new RefundReferenceTypes(Value.RETRIEVAL_REFERENCE_NUMBER, "retrieval_reference_number"); + + public static final RefundReferenceTypes ACQUIRER_REFERENCE_NUMBER = + new RefundReferenceTypes(Value.ACQUIRER_REFERENCE_NUMBER, "acquirer_reference_number"); + + public static final RefundReferenceTypes SYSTEM_TRACE_AUDIT_NUMBER = + new RefundReferenceTypes(Value.SYSTEM_TRACE_AUDIT_NUMBER, "system_trace_audit_number"); + + private final Value value; + + private final String string; + + RefundReferenceTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RefundReferenceTypes && this.string.equals(((RefundReferenceTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RETRIEVAL_REFERENCE_NUMBER: + return visitor.visitRetrievalReferenceNumber(); + case ACQUIRER_REFERENCE_NUMBER: + return visitor.visitAcquirerReferenceNumber(); + case SYSTEM_TRACE_AUDIT_NUMBER: + return visitor.visitSystemTraceAuditNumber(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RefundReferenceTypes valueOf(String value) { + switch (value) { + case "retrieval_reference_number": + return RETRIEVAL_REFERENCE_NUMBER; + case "acquirer_reference_number": + return ACQUIRER_REFERENCE_NUMBER; + case "system_trace_audit_number": + return SYSTEM_TRACE_AUDIT_NUMBER; + default: + return new RefundReferenceTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + ACQUIRER_REFERENCE_NUMBER, + + RETRIEVAL_REFERENCE_NUMBER, + + SYSTEM_TRACE_AUDIT_NUMBER, + + UNKNOWN + } + + public interface Visitor { + T visitAcquirerReferenceNumber(); + + T visitRetrievalReferenceNumber(); + + T visitSystemTraceAuditNumber(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/RefundStatuses.java b/src/main/java/com/whop/api/types/RefundStatuses.java new file mode 100644 index 00000000..845cc023 --- /dev/null +++ b/src/main/java/com/whop/api/types/RefundStatuses.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RefundStatuses { + public static final RefundStatuses FAILED = new RefundStatuses(Value.FAILED, "failed"); + + public static final RefundStatuses SUCCEEDED = new RefundStatuses(Value.SUCCEEDED, "succeeded"); + + public static final RefundStatuses PENDING = new RefundStatuses(Value.PENDING, "pending"); + + public static final RefundStatuses CANCELED = new RefundStatuses(Value.CANCELED, "canceled"); + + public static final RefundStatuses REQUIRES_ACTION = new RefundStatuses(Value.REQUIRES_ACTION, "requires_action"); + + private final Value value; + + private final String string; + + RefundStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RefundStatuses && this.string.equals(((RefundStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case SUCCEEDED: + return visitor.visitSucceeded(); + case PENDING: + return visitor.visitPending(); + case CANCELED: + return visitor.visitCanceled(); + case REQUIRES_ACTION: + return visitor.visitRequiresAction(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RefundStatuses valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "succeeded": + return SUCCEEDED; + case "pending": + return PENDING; + case "canceled": + return CANCELED; + case "requires_action": + return REQUIRES_ACTION; + default: + return new RefundStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + REQUIRES_ACTION, + + SUCCEEDED, + + FAILED, + + CANCELED, + + UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitRequiresAction(); + + T visitSucceeded(); + + T visitFailed(); + + T visitCanceled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ReleaseMethod.java b/src/main/java/com/whop/api/types/ReleaseMethod.java new file mode 100644 index 00000000..4f98709b --- /dev/null +++ b/src/main/java/com/whop/api/types/ReleaseMethod.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ReleaseMethod { + public static final ReleaseMethod WAITLIST = new ReleaseMethod(Value.WAITLIST, "waitlist"); + + public static final ReleaseMethod BUY_NOW = new ReleaseMethod(Value.BUY_NOW, "buy_now"); + + private final Value value; + + private final String string; + + ReleaseMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ReleaseMethod && this.string.equals(((ReleaseMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WAITLIST: + return visitor.visitWaitlist(); + case BUY_NOW: + return visitor.visitBuyNow(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ReleaseMethod valueOf(String value) { + switch (value) { + case "waitlist": + return WAITLIST; + case "buy_now": + return BUY_NOW; + default: + return new ReleaseMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + BUY_NOW, + + WAITLIST, + + UNKNOWN + } + + public interface Visitor { + T visitBuyNow(); + + T visitWaitlist(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionAttachment.java b/src/main/java/com/whop/api/types/ResolutionAttachment.java new file mode 100644 index 00000000..fdcb5aba --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionAttachment.java @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ResolutionAttachment.Builder.class) +public final class ResolutionAttachment { + private final Optional contentType; + + private final Optional filename; + + private final String id; + + private final Optional url; + + private final Map additionalProperties; + + private ResolutionAttachment( + Optional contentType, + Optional filename, + String id, + Optional url, + Map additionalProperties) { + this.contentType = contentType; + this.filename = filename; + this.id = id; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return The file's MIME type. + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return The original file name. + */ + @JsonIgnore + public Optional getFilename() { + if (filename == null) { + return Optional.empty(); + } + return filename; + } + + /** + * @return Unique identifier for the attachment, prefixed att_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A URL to view or download the file. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filename") + private Optional _getFilename() { + return filename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ResolutionAttachment && equalTo((ResolutionAttachment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ResolutionAttachment other) { + return contentType.equals(other.contentType) + && filename.equals(other.filename) + && id.equals(other.id) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contentType, this.filename, this.id, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Unique identifier for the attachment, prefixed att_.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(ResolutionAttachment other); + } + + public interface _FinalStage { + ResolutionAttachment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The file's MIME type.

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

The original file name.

+ */ + _FinalStage filename(Optional filename); + + _FinalStage filename(String filename); + + _FinalStage filename(Nullable filename); + + /** + *

A URL to view or download the file.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional url = Optional.empty(); + + private Optional filename = Optional.empty(); + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ResolutionAttachment other) { + contentType(other.getContentType()); + filename(other.getFilename()); + id(other.getId()); + url(other.getUrl()); + return this; + } + + /** + *

Unique identifier for the attachment, prefixed att_.

+ *

Unique identifier for the attachment, prefixed att_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

A URL to view or download the file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

A URL to view or download the file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

A URL to view or download the file.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

The original file name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(Nullable filename) { + if (filename.isNull()) { + this.filename = null; + } else if (filename.isEmpty()) { + this.filename = Optional.empty(); + } else { + this.filename = Optional.of(filename.get()); + } + return this; + } + + /** + *

The original file name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(String filename) { + this.filename = Optional.ofNullable(filename); + return this; + } + + /** + *

The original file name.

+ */ + @java.lang.Override + @JsonSetter(value = "filename", nulls = Nulls.SKIP) + public _FinalStage filename(Optional filename) { + this.filename = filename; + return this; + } + + /** + *

The file's MIME type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

The file's MIME type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

The file's MIME type.

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public ResolutionAttachment build() { + return new ResolutionAttachment(contentType, filename, id, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionBuyer.java b/src/main/java/com/whop/api/types/ResolutionBuyer.java new file mode 100644 index 00000000..a927241b --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionBuyer.java @@ -0,0 +1,336 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ResolutionBuyer.Builder.class) +public final class ResolutionBuyer { + private final Optional email; + + private final Optional memberId; + + private final Optional name; + + private final Optional userId; + + private final Optional username; + + private final Map additionalProperties; + + private ResolutionBuyer( + Optional email, + Optional memberId, + Optional name, + Optional userId, + Optional username, + Map additionalProperties) { + this.email = email; + this.memberId = memberId; + this.name = name; + this.userId = userId; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The customer's email address. Requires the member:email:read scope; null without it. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The customer's member row on the account, prefixed mem_. + */ + @JsonIgnore + public Optional getMemberId() { + if (memberId == null) { + return Optional.empty(); + } + return memberId; + } + + /** + * @return The customer's display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The customer's user ID, prefixed user_. + */ + @JsonIgnore + public Optional getUserId() { + if (userId == null) { + return Optional.empty(); + } + return userId; + } + + /** + * @return The customer's Whop username. + */ + @JsonIgnore + public Optional getUsername() { + if (username == null) { + return Optional.empty(); + } + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member_id") + private Optional _getMemberId() { + return memberId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user_id") + private Optional _getUserId() { + return userId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("username") + private Optional _getUsername() { + return username; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ResolutionBuyer && equalTo((ResolutionBuyer) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ResolutionBuyer other) { + return email.equals(other.email) + && memberId.equals(other.memberId) + && name.equals(other.name) + && userId.equals(other.userId) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.memberId, this.name, this.userId, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional email = Optional.empty(); + + private Optional memberId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional username = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ResolutionBuyer other) { + email(other.getEmail()); + memberId(other.getMemberId()); + name(other.getName()); + userId(other.getUserId()); + username(other.getUsername()); + return this; + } + + /** + *

The customer's email address. Requires the member:email:read scope; null without it.

+ */ + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + public Builder email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The customer's member row on the account, prefixed mem_.

+ */ + @JsonSetter(value = "member_id", nulls = Nulls.SKIP) + public Builder memberId(Optional memberId) { + this.memberId = memberId; + return this; + } + + public Builder memberId(String memberId) { + this.memberId = Optional.ofNullable(memberId); + return this; + } + + public Builder memberId(Nullable memberId) { + if (memberId.isNull()) { + this.memberId = null; + } else if (memberId.isEmpty()) { + this.memberId = Optional.empty(); + } else { + this.memberId = Optional.of(memberId.get()); + } + return this; + } + + /** + *

The customer's display name.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The customer's user ID, prefixed user_.

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + public Builder userId(Nullable userId) { + if (userId.isNull()) { + this.userId = null; + } else if (userId.isEmpty()) { + this.userId = Optional.empty(); + } else { + this.userId = Optional.of(userId.get()); + } + return this; + } + + /** + *

The customer's Whop username.

+ */ + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public Builder username(Optional username) { + this.username = username; + return this; + } + + public Builder username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + public Builder username(Nullable username) { + if (username.isNull()) { + this.username = null; + } else if (username.isEmpty()) { + this.username = Optional.empty(); + } else { + this.username = Optional.of(username.get()); + } + return this; + } + + public ResolutionBuyer build() { + return new ResolutionBuyer(email, memberId, name, userId, username, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCase.java b/src/main/java/com/whop/api/types/ResolutionCenterCase.java new file mode 100644 index 00000000..2d07b4e6 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCase.java @@ -0,0 +1,1034 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ResolutionCenterCase.Builder.class) +public final class ResolutionCenterCase { + private final Optional account; + + private final double amount; + + private final List availableActions; + + private final ResolutionBuyer buyer; + + private final String createdAt; + + private final Optional currency; + + private final boolean customerAppealed; + + private final boolean escalated; + + private final String id; + + private final Optional outcome; + + private final ResolutionPayment payment; + + private final Optional planId; + + private final Optional productId; + + private final ResolutionCenterCaseReason reason; + + private final Optional refund; + + private final Optional responseDueAt; + + private final ResolutionCenterCaseStatus status; + + private final String updatedAt; + + private final Map additionalProperties; + + private ResolutionCenterCase( + Optional account, + double amount, + List availableActions, + ResolutionBuyer buyer, + String createdAt, + Optional currency, + boolean customerAppealed, + boolean escalated, + String id, + Optional outcome, + ResolutionPayment payment, + Optional planId, + Optional productId, + ResolutionCenterCaseReason reason, + Optional refund, + Optional responseDueAt, + ResolutionCenterCaseStatus status, + String updatedAt, + Map additionalProperties) { + this.account = account; + this.amount = amount; + this.availableActions = availableActions; + this.buyer = buyer; + this.createdAt = createdAt; + this.currency = currency; + this.customerAppealed = customerAppealed; + this.escalated = escalated; + this.id = id; + this.outcome = outcome; + this.payment = payment; + this.planId = planId; + this.productId = productId; + this.reason = reason; + this.refund = refund; + this.responseDueAt = responseDueAt; + this.status = status; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account the case was filed against. + */ + @JsonIgnore + public Optional getAccount() { + if (account == null) { + return Optional.empty(); + } + return account; + } + + /** + * @return The amount in question, in whole units of currency. + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + @JsonProperty("available_actions") + public List getAvailableActions() { + return availableActions; + } + + /** + * @return The customer who opened the case. + */ + @JsonProperty("buyer") + public ResolutionBuyer getBuyer() { + return buyer; + } + + /** + * @return When the case was opened, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Three-letter ISO currency code of the amount. + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return Whether the customer has appealed a decision on this case. + */ + @JsonProperty("customer_appealed") + public boolean getCustomerAppealed() { + return customerAppealed; + } + + /** + * @return Whether Whop is involved — either reviewing the case, or waiting on the side named by status for something it asked for while reviewing. + */ + @JsonProperty("escalated") + public boolean getEscalated() { + return escalated; + } + + /** + * @return Resolution center case ID, prefixed reso_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Who prevailed on the claim. null until the case closes. Read refund for whether any money actually moved. + */ + @JsonIgnore + public Optional getOutcome() { + if (outcome == null) { + return Optional.empty(); + } + return outcome; + } + + /** + * @return The payment the case was opened against. + */ + @JsonProperty("payment") + public ResolutionPayment getPayment() { + return payment; + } + + /** + * @return The plan the payment was made on, prefixed plan_. + */ + @JsonIgnore + public Optional getPlanId() { + if (planId == null) { + return Optional.empty(); + } + return planId; + } + + /** + * @return The product the payment was for, prefixed prod_. + */ + @JsonIgnore + public Optional getProductId() { + if (productId == null) { + return Optional.empty(); + } + return productId; + } + + /** + * @return What the customer says went wrong. Shares the /disputes vocabulary, so a case that later becomes a chargeback reports the same complaint. + */ + @JsonProperty("reason") + public ResolutionCenterCaseReason getReason() { + return reason; + } + + /** + * @return Whether money moved and off whose balance: none, merchant, or platform (Whop refunded the customer and the merchant kept the funds). Independent of outcome — a case the merchant won can still carry a platform refund. null while the case is open, and on older closed cases that predate this being recorded. + */ + @JsonIgnore + public Optional getRefund() { + if (refund == null) { + return Optional.empty(); + } + return refund; + } + + /** + * @return When the next response is due, as an ISO 8601 timestamp. + */ + @JsonIgnore + public Optional getResponseDueAt() { + if (responseDueAt == null) { + return Optional.empty(); + } + return responseDueAt; + } + + /** + * @return Who the case is waiting on. awaiting_merchant and awaiting_customer name the side that owes a response, under_review means Whop is deciding, and closed means it is settled — read outcome for how. + */ + @JsonProperty("status") + public ResolutionCenterCaseStatus getStatus() { + return status; + } + + /** + * @return When the case was last changed, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account") + private Optional _getAccount() { + return account; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("outcome") + private Optional _getOutcome() { + return outcome; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("plan_id") + private Optional _getPlanId() { + return planId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("product_id") + private Optional _getProductId() { + return productId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("refund") + private Optional _getRefund() { + return refund; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("response_due_at") + private Optional _getResponseDueAt() { + return responseDueAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ResolutionCenterCase && equalTo((ResolutionCenterCase) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ResolutionCenterCase other) { + return account.equals(other.account) + && amount == other.amount + && availableActions.equals(other.availableActions) + && buyer.equals(other.buyer) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && customerAppealed == other.customerAppealed + && escalated == other.escalated + && id.equals(other.id) + && outcome.equals(other.outcome) + && payment.equals(other.payment) + && planId.equals(other.planId) + && productId.equals(other.productId) + && reason.equals(other.reason) + && refund.equals(other.refund) + && responseDueAt.equals(other.responseDueAt) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.account, + this.amount, + this.availableActions, + this.buyer, + this.createdAt, + this.currency, + this.customerAppealed, + this.escalated, + this.id, + this.outcome, + this.payment, + this.planId, + this.productId, + this.reason, + this.refund, + this.responseDueAt, + this.status, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The amount in question, in whole units of currency.

+ */ + BuyerStage amount(double amount); + + Builder from(ResolutionCenterCase other); + } + + public interface BuyerStage { + /** + *

The customer who opened the case.

+ */ + CreatedAtStage buyer(@NotNull ResolutionBuyer buyer); + } + + public interface CreatedAtStage { + /** + *

When the case was opened, as an ISO 8601 timestamp.

+ */ + CustomerAppealedStage createdAt(@NotNull String createdAt); + } + + public interface CustomerAppealedStage { + /** + *

Whether the customer has appealed a decision on this case.

+ */ + EscalatedStage customerAppealed(boolean customerAppealed); + } + + public interface EscalatedStage { + /** + *

Whether Whop is involved — either reviewing the case, or waiting on the side named by status for something it asked for while reviewing.

+ */ + IdStage escalated(boolean escalated); + } + + public interface IdStage { + /** + *

Resolution center case ID, prefixed reso_.

+ */ + PaymentStage id(@NotNull String id); + } + + public interface PaymentStage { + /** + *

The payment the case was opened against.

+ */ + ReasonStage payment(@NotNull ResolutionPayment payment); + } + + public interface ReasonStage { + /** + *

What the customer says went wrong. Shares the /disputes vocabulary, so a case that later becomes a chargeback reports the same complaint.

+ */ + StatusStage reason(@NotNull ResolutionCenterCaseReason reason); + } + + public interface StatusStage { + /** + *

Who the case is waiting on. awaiting_merchant and awaiting_customer name the side that owes a response, under_review means Whop is deciding, and closed means it is settled — read outcome for how.

+ */ + UpdatedAtStage status(@NotNull ResolutionCenterCaseStatus status); + } + + public interface UpdatedAtStage { + /** + *

When the case was last changed, as an ISO 8601 timestamp.

+ */ + _FinalStage updatedAt(@NotNull String updatedAt); + } + + public interface _FinalStage { + ResolutionCenterCase build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account the case was filed against.

+ */ + _FinalStage account(Optional account); + + _FinalStage account(AccountSummary account); + + _FinalStage account(Nullable account); + + _FinalStage availableActions(List availableActions); + + _FinalStage addAvailableActions(ResolutionCenterCaseAvailableActionsItem availableActions); + + _FinalStage addAllAvailableActions(List availableActions); + + /** + *

Three-letter ISO currency code of the amount.

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + _FinalStage currency(Nullable currency); + + /** + *

Who prevailed on the claim. null until the case closes. Read refund for whether any money actually moved.

+ */ + _FinalStage outcome(Optional outcome); + + _FinalStage outcome(ResolutionCenterCaseOutcome outcome); + + _FinalStage outcome(Nullable outcome); + + /** + *

The plan the payment was made on, prefixed plan_.

+ */ + _FinalStage planId(Optional planId); + + _FinalStage planId(String planId); + + _FinalStage planId(Nullable planId); + + /** + *

The product the payment was for, prefixed prod_.

+ */ + _FinalStage productId(Optional productId); + + _FinalStage productId(String productId); + + _FinalStage productId(Nullable productId); + + /** + *

Whether money moved and off whose balance: none, merchant, or platform (Whop refunded the customer and the merchant kept the funds). Independent of outcome — a case the merchant won can still carry a platform refund. null while the case is open, and on older closed cases that predate this being recorded.

+ */ + _FinalStage refund(Optional refund); + + _FinalStage refund(ResolutionCenterCaseRefund refund); + + _FinalStage refund(Nullable refund); + + /** + *

When the next response is due, as an ISO 8601 timestamp.

+ */ + _FinalStage responseDueAt(Optional responseDueAt); + + _FinalStage responseDueAt(String responseDueAt); + + _FinalStage responseDueAt(Nullable responseDueAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + BuyerStage, + CreatedAtStage, + CustomerAppealedStage, + EscalatedStage, + IdStage, + PaymentStage, + ReasonStage, + StatusStage, + UpdatedAtStage, + _FinalStage { + private double amount; + + private ResolutionBuyer buyer; + + private String createdAt; + + private boolean customerAppealed; + + private boolean escalated; + + private String id; + + private ResolutionPayment payment; + + private ResolutionCenterCaseReason reason; + + private ResolutionCenterCaseStatus status; + + private String updatedAt; + + private Optional responseDueAt = Optional.empty(); + + private Optional refund = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional planId = Optional.empty(); + + private Optional outcome = Optional.empty(); + + private Optional currency = Optional.empty(); + + private List availableActions = new ArrayList<>(); + + private Optional account = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ResolutionCenterCase other) { + account(other.getAccount()); + amount(other.getAmount()); + availableActions(other.getAvailableActions()); + buyer(other.getBuyer()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + customerAppealed(other.getCustomerAppealed()); + escalated(other.getEscalated()); + id(other.getId()); + outcome(other.getOutcome()); + payment(other.getPayment()); + planId(other.getPlanId()); + productId(other.getProductId()); + reason(other.getReason()); + refund(other.getRefund()); + responseDueAt(other.getResponseDueAt()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

The amount in question, in whole units of currency.

+ *

The amount in question, in whole units of currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public BuyerStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The customer who opened the case.

+ *

The customer who opened the case.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("buyer") + public CreatedAtStage buyer(@NotNull ResolutionBuyer buyer) { + this.buyer = Objects.requireNonNull(buyer, "buyer must not be null"); + return this; + } + + /** + *

When the case was opened, as an ISO 8601 timestamp.

+ *

When the case was opened, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CustomerAppealedStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Whether the customer has appealed a decision on this case.

+ *

Whether the customer has appealed a decision on this case.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("customer_appealed") + public EscalatedStage customerAppealed(boolean customerAppealed) { + this.customerAppealed = customerAppealed; + return this; + } + + /** + *

Whether Whop is involved — either reviewing the case, or waiting on the side named by status for something it asked for while reviewing.

+ *

Whether Whop is involved — either reviewing the case, or waiting on the side named by status for something it asked for while reviewing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("escalated") + public IdStage escalated(boolean escalated) { + this.escalated = escalated; + return this; + } + + /** + *

Resolution center case ID, prefixed reso_.

+ *

Resolution center case ID, prefixed reso_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The payment the case was opened against.

+ *

The payment the case was opened against.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment") + public ReasonStage payment(@NotNull ResolutionPayment payment) { + this.payment = Objects.requireNonNull(payment, "payment must not be null"); + return this; + } + + /** + *

What the customer says went wrong. Shares the /disputes vocabulary, so a case that later becomes a chargeback reports the same complaint.

+ *

What the customer says went wrong. Shares the /disputes vocabulary, so a case that later becomes a chargeback reports the same complaint.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reason") + public StatusStage reason(@NotNull ResolutionCenterCaseReason reason) { + this.reason = Objects.requireNonNull(reason, "reason must not be null"); + return this; + } + + /** + *

Who the case is waiting on. awaiting_merchant and awaiting_customer name the side that owes a response, under_review means Whop is deciding, and closed means it is settled — read outcome for how.

+ *

Who the case is waiting on. awaiting_merchant and awaiting_customer name the side that owes a response, under_review means Whop is deciding, and closed means it is settled — read outcome for how.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull ResolutionCenterCaseStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

When the case was last changed, as an ISO 8601 timestamp.

+ *

When the case was last changed, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

When the next response is due, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage responseDueAt(Nullable responseDueAt) { + if (responseDueAt.isNull()) { + this.responseDueAt = null; + } else if (responseDueAt.isEmpty()) { + this.responseDueAt = Optional.empty(); + } else { + this.responseDueAt = Optional.of(responseDueAt.get()); + } + return this; + } + + /** + *

When the next response is due, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage responseDueAt(String responseDueAt) { + this.responseDueAt = Optional.ofNullable(responseDueAt); + return this; + } + + /** + *

When the next response is due, as an ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "response_due_at", nulls = Nulls.SKIP) + public _FinalStage responseDueAt(Optional responseDueAt) { + this.responseDueAt = responseDueAt; + return this; + } + + /** + *

Whether money moved and off whose balance: none, merchant, or platform (Whop refunded the customer and the merchant kept the funds). Independent of outcome — a case the merchant won can still carry a platform refund. null while the case is open, and on older closed cases that predate this being recorded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refund(Nullable refund) { + if (refund.isNull()) { + this.refund = null; + } else if (refund.isEmpty()) { + this.refund = Optional.empty(); + } else { + this.refund = Optional.of(refund.get()); + } + return this; + } + + /** + *

Whether money moved and off whose balance: none, merchant, or platform (Whop refunded the customer and the merchant kept the funds). Independent of outcome — a case the merchant won can still carry a platform refund. null while the case is open, and on older closed cases that predate this being recorded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage refund(ResolutionCenterCaseRefund refund) { + this.refund = Optional.ofNullable(refund); + return this; + } + + /** + *

Whether money moved and off whose balance: none, merchant, or platform (Whop refunded the customer and the merchant kept the funds). Independent of outcome — a case the merchant won can still carry a platform refund. null while the case is open, and on older closed cases that predate this being recorded.

+ */ + @java.lang.Override + @JsonSetter(value = "refund", nulls = Nulls.SKIP) + public _FinalStage refund(Optional refund) { + this.refund = refund; + return this; + } + + /** + *

The product the payment was for, prefixed prod_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(Nullable productId) { + if (productId.isNull()) { + this.productId = null; + } else if (productId.isEmpty()) { + this.productId = Optional.empty(); + } else { + this.productId = Optional.of(productId.get()); + } + return this; + } + + /** + *

The product the payment was for, prefixed prod_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + /** + *

The product the payment was for, prefixed prod_.

+ */ + @java.lang.Override + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public _FinalStage productId(Optional productId) { + this.productId = productId; + return this; + } + + /** + *

The plan the payment was made on, prefixed plan_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planId(Nullable planId) { + if (planId.isNull()) { + this.planId = null; + } else if (planId.isEmpty()) { + this.planId = Optional.empty(); + } else { + this.planId = Optional.of(planId.get()); + } + return this; + } + + /** + *

The plan the payment was made on, prefixed plan_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage planId(String planId) { + this.planId = Optional.ofNullable(planId); + return this; + } + + /** + *

The plan the payment was made on, prefixed plan_.

+ */ + @java.lang.Override + @JsonSetter(value = "plan_id", nulls = Nulls.SKIP) + public _FinalStage planId(Optional planId) { + this.planId = planId; + return this; + } + + /** + *

Who prevailed on the claim. null until the case closes. Read refund for whether any money actually moved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage outcome(Nullable outcome) { + if (outcome.isNull()) { + this.outcome = null; + } else if (outcome.isEmpty()) { + this.outcome = Optional.empty(); + } else { + this.outcome = Optional.of(outcome.get()); + } + return this; + } + + /** + *

Who prevailed on the claim. null until the case closes. Read refund for whether any money actually moved.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage outcome(ResolutionCenterCaseOutcome outcome) { + this.outcome = Optional.ofNullable(outcome); + return this; + } + + /** + *

Who prevailed on the claim. null until the case closes. Read refund for whether any money actually moved.

+ */ + @java.lang.Override + @JsonSetter(value = "outcome", nulls = Nulls.SKIP) + public _FinalStage outcome(Optional outcome) { + this.outcome = outcome; + return this; + } + + /** + *

Three-letter ISO currency code of the amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

Three-letter ISO currency code of the amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

Three-letter ISO currency code of the amount.

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + @java.lang.Override + public _FinalStage addAllAvailableActions(List availableActions) { + if (availableActions != null) { + this.availableActions.addAll(availableActions); + } + return this; + } + + @java.lang.Override + public _FinalStage addAvailableActions(ResolutionCenterCaseAvailableActionsItem availableActions) { + this.availableActions.add(availableActions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "available_actions", nulls = Nulls.SKIP) + public _FinalStage availableActions(List availableActions) { + this.availableActions.clear(); + if (availableActions != null) { + this.availableActions.addAll(availableActions); + } + return this; + } + + /** + *

The account the case was filed against.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(Nullable account) { + if (account.isNull()) { + this.account = null; + } else if (account.isEmpty()) { + this.account = Optional.empty(); + } else { + this.account = Optional.of(account.get()); + } + return this; + } + + /** + *

The account the case was filed against.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage account(AccountSummary account) { + this.account = Optional.ofNullable(account); + return this; + } + + /** + *

The account the case was filed against.

+ */ + @java.lang.Override + @JsonSetter(value = "account", nulls = Nulls.SKIP) + public _FinalStage account(Optional account) { + this.account = account; + return this; + } + + @java.lang.Override + public ResolutionCenterCase build() { + return new ResolutionCenterCase( + account, + amount, + availableActions, + buyer, + createdAt, + currency, + customerAppealed, + escalated, + id, + outcome, + payment, + planId, + productId, + reason, + refund, + responseDueAt, + status, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCaseActions.java b/src/main/java/com/whop/api/types/ResolutionCenterCaseActions.java new file mode 100644 index 00000000..c99032e3 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCaseActions.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ResolutionCenterCaseActions { + public static final ResolutionCenterCaseActions WITHDREW = + new ResolutionCenterCaseActions(Value.WITHDREW, "withdrew"); + + public static final ResolutionCenterCaseActions DISPUTE_OPENED = + new ResolutionCenterCaseActions(Value.DISPUTE_OPENED, "dispute_opened"); + + public static final ResolutionCenterCaseActions RESPONDED = + new ResolutionCenterCaseActions(Value.RESPONDED, "responded"); + + public static final ResolutionCenterCaseActions DISPUTE_CUSTOMER_WON = + new ResolutionCenterCaseActions(Value.DISPUTE_CUSTOMER_WON, "dispute_customer_won"); + + public static final ResolutionCenterCaseActions ESCALATED = + new ResolutionCenterCaseActions(Value.ESCALATED, "escalated"); + + public static final ResolutionCenterCaseActions DENIED = new ResolutionCenterCaseActions(Value.DENIED, "denied"); + + public static final ResolutionCenterCaseActions ACCEPTED = + new ResolutionCenterCaseActions(Value.ACCEPTED, "accepted"); + + public static final ResolutionCenterCaseActions CREATED = new ResolutionCenterCaseActions(Value.CREATED, "created"); + + public static final ResolutionCenterCaseActions APPEALED = + new ResolutionCenterCaseActions(Value.APPEALED, "appealed"); + + public static final ResolutionCenterCaseActions REQUESTED_MORE_INFO = + new ResolutionCenterCaseActions(Value.REQUESTED_MORE_INFO, "requested_more_info"); + + public static final ResolutionCenterCaseActions DISPUTE_MERCHANT_WON = + new ResolutionCenterCaseActions(Value.DISPUTE_MERCHANT_WON, "dispute_merchant_won"); + + private final Value value; + + private final String string; + + ResolutionCenterCaseActions(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ResolutionCenterCaseActions + && this.string.equals(((ResolutionCenterCaseActions) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WITHDREW: + return visitor.visitWithdrew(); + case DISPUTE_OPENED: + return visitor.visitDisputeOpened(); + case RESPONDED: + return visitor.visitResponded(); + case DISPUTE_CUSTOMER_WON: + return visitor.visitDisputeCustomerWon(); + case ESCALATED: + return visitor.visitEscalated(); + case DENIED: + return visitor.visitDenied(); + case ACCEPTED: + return visitor.visitAccepted(); + case CREATED: + return visitor.visitCreated(); + case APPEALED: + return visitor.visitAppealed(); + case REQUESTED_MORE_INFO: + return visitor.visitRequestedMoreInfo(); + case DISPUTE_MERCHANT_WON: + return visitor.visitDisputeMerchantWon(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ResolutionCenterCaseActions valueOf(String value) { + switch (value) { + case "withdrew": + return WITHDREW; + case "dispute_opened": + return DISPUTE_OPENED; + case "responded": + return RESPONDED; + case "dispute_customer_won": + return DISPUTE_CUSTOMER_WON; + case "escalated": + return ESCALATED; + case "denied": + return DENIED; + case "accepted": + return ACCEPTED; + case "created": + return CREATED; + case "appealed": + return APPEALED; + case "requested_more_info": + return REQUESTED_MORE_INFO; + case "dispute_merchant_won": + return DISPUTE_MERCHANT_WON; + default: + return new ResolutionCenterCaseActions(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED, + + RESPONDED, + + ACCEPTED, + + DENIED, + + APPEALED, + + WITHDREW, + + REQUESTED_MORE_INFO, + + ESCALATED, + + DISPUTE_OPENED, + + DISPUTE_CUSTOMER_WON, + + DISPUTE_MERCHANT_WON, + + UNKNOWN + } + + public interface Visitor { + T visitCreated(); + + T visitResponded(); + + T visitAccepted(); + + T visitDenied(); + + T visitAppealed(); + + T visitWithdrew(); + + T visitRequestedMoreInfo(); + + T visitEscalated(); + + T visitDisputeOpened(); + + T visitDisputeCustomerWon(); + + T visitDisputeMerchantWon(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCaseAvailableActionsItem.java b/src/main/java/com/whop/api/types/ResolutionCenterCaseAvailableActionsItem.java new file mode 100644 index 00000000..6a947464 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCaseAvailableActionsItem.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ResolutionCenterCaseAvailableActionsItem { + public static final ResolutionCenterCaseAvailableActionsItem ACCEPT = + new ResolutionCenterCaseAvailableActionsItem(Value.ACCEPT, "accept"); + + public static final ResolutionCenterCaseAvailableActionsItem APPEAL = + new ResolutionCenterCaseAvailableActionsItem(Value.APPEAL, "appeal"); + + public static final ResolutionCenterCaseAvailableActionsItem REPLY = + new ResolutionCenterCaseAvailableActionsItem(Value.REPLY, "reply"); + + public static final ResolutionCenterCaseAvailableActionsItem REQUEST_INFO = + new ResolutionCenterCaseAvailableActionsItem(Value.REQUEST_INFO, "request_info"); + + public static final ResolutionCenterCaseAvailableActionsItem WITHDRAW = + new ResolutionCenterCaseAvailableActionsItem(Value.WITHDRAW, "withdraw"); + + public static final ResolutionCenterCaseAvailableActionsItem DENY = + new ResolutionCenterCaseAvailableActionsItem(Value.DENY, "deny"); + + private final Value value; + + private final String string; + + ResolutionCenterCaseAvailableActionsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ResolutionCenterCaseAvailableActionsItem + && this.string.equals(((ResolutionCenterCaseAvailableActionsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ACCEPT: + return visitor.visitAccept(); + case APPEAL: + return visitor.visitAppeal(); + case REPLY: + return visitor.visitReply(); + case REQUEST_INFO: + return visitor.visitRequestInfo(); + case WITHDRAW: + return visitor.visitWithdraw(); + case DENY: + return visitor.visitDeny(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ResolutionCenterCaseAvailableActionsItem valueOf(String value) { + switch (value) { + case "accept": + return ACCEPT; + case "appeal": + return APPEAL; + case "reply": + return REPLY; + case "request_info": + return REQUEST_INFO; + case "withdraw": + return WITHDRAW; + case "deny": + return DENY; + default: + return new ResolutionCenterCaseAvailableActionsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCEPT, + + DENY, + + REQUEST_INFO, + + REPLY, + + APPEAL, + + WITHDRAW, + + UNKNOWN + } + + public interface Visitor { + T visitAccept(); + + T visitDeny(); + + T visitRequestInfo(); + + T visitReply(); + + T visitAppeal(); + + T visitWithdraw(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCaseCustomerResponses.java b/src/main/java/com/whop/api/types/ResolutionCenterCaseCustomerResponses.java new file mode 100644 index 00000000..4648678a --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCaseCustomerResponses.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ResolutionCenterCaseCustomerResponses { + public static final ResolutionCenterCaseCustomerResponses APPEAL = + new ResolutionCenterCaseCustomerResponses(Value.APPEAL, "appeal"); + + public static final ResolutionCenterCaseCustomerResponses RESPOND = + new ResolutionCenterCaseCustomerResponses(Value.RESPOND, "respond"); + + public static final ResolutionCenterCaseCustomerResponses WITHDRAW = + new ResolutionCenterCaseCustomerResponses(Value.WITHDRAW, "withdraw"); + + private final Value value; + + private final String string; + + ResolutionCenterCaseCustomerResponses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ResolutionCenterCaseCustomerResponses + && this.string.equals(((ResolutionCenterCaseCustomerResponses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPEAL: + return visitor.visitAppeal(); + case RESPOND: + return visitor.visitRespond(); + case WITHDRAW: + return visitor.visitWithdraw(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ResolutionCenterCaseCustomerResponses valueOf(String value) { + switch (value) { + case "appeal": + return APPEAL; + case "respond": + return RESPOND; + case "withdraw": + return WITHDRAW; + default: + return new ResolutionCenterCaseCustomerResponses(Value.UNKNOWN, value); + } + } + + public enum Value { + RESPOND, + + APPEAL, + + WITHDRAW, + + UNKNOWN + } + + public interface Visitor { + T visitRespond(); + + T visitAppeal(); + + T visitWithdraw(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCaseIssueTypes.java b/src/main/java/com/whop/api/types/ResolutionCenterCaseIssueTypes.java new file mode 100644 index 00000000..c83b0358 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCaseIssueTypes.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ResolutionCenterCaseIssueTypes { + public static final ResolutionCenterCaseIssueTypes ITEM_NOT_RECEIVED = + new ResolutionCenterCaseIssueTypes(Value.ITEM_NOT_RECEIVED, "item_not_received"); + + public static final ResolutionCenterCaseIssueTypes SIGNIFICANTLY_NOT_AS_DESCRIBED = + new ResolutionCenterCaseIssueTypes(Value.SIGNIFICANTLY_NOT_AS_DESCRIBED, "significantly_not_as_described"); + + public static final ResolutionCenterCaseIssueTypes UNAUTHORIZED_TRANSACTION = + new ResolutionCenterCaseIssueTypes(Value.UNAUTHORIZED_TRANSACTION, "unauthorized_transaction"); + + public static final ResolutionCenterCaseIssueTypes PRODUCT_UNACCEPTABLE = + new ResolutionCenterCaseIssueTypes(Value.PRODUCT_UNACCEPTABLE, "product_unacceptable"); + + public static final ResolutionCenterCaseIssueTypes FORGOT_TO_CANCEL = + new ResolutionCenterCaseIssueTypes(Value.FORGOT_TO_CANCEL, "forgot_to_cancel"); + + private final Value value; + + private final String string; + + ResolutionCenterCaseIssueTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ResolutionCenterCaseIssueTypes + && this.string.equals(((ResolutionCenterCaseIssueTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ITEM_NOT_RECEIVED: + return visitor.visitItemNotReceived(); + case SIGNIFICANTLY_NOT_AS_DESCRIBED: + return visitor.visitSignificantlyNotAsDescribed(); + case UNAUTHORIZED_TRANSACTION: + return visitor.visitUnauthorizedTransaction(); + case PRODUCT_UNACCEPTABLE: + return visitor.visitProductUnacceptable(); + case FORGOT_TO_CANCEL: + return visitor.visitForgotToCancel(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ResolutionCenterCaseIssueTypes valueOf(String value) { + switch (value) { + case "item_not_received": + return ITEM_NOT_RECEIVED; + case "significantly_not_as_described": + return SIGNIFICANTLY_NOT_AS_DESCRIBED; + case "unauthorized_transaction": + return UNAUTHORIZED_TRANSACTION; + case "product_unacceptable": + return PRODUCT_UNACCEPTABLE; + case "forgot_to_cancel": + return FORGOT_TO_CANCEL; + default: + return new ResolutionCenterCaseIssueTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + FORGOT_TO_CANCEL, + + ITEM_NOT_RECEIVED, + + SIGNIFICANTLY_NOT_AS_DESCRIBED, + + UNAUTHORIZED_TRANSACTION, + + PRODUCT_UNACCEPTABLE, + + UNKNOWN + } + + public interface Visitor { + T visitForgotToCancel(); + + T visitItemNotReceived(); + + T visitSignificantlyNotAsDescribed(); + + T visitUnauthorizedTransaction(); + + T visitProductUnacceptable(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCaseListItem.java b/src/main/java/com/whop/api/types/ResolutionCenterCaseListItem.java new file mode 100644 index 00000000..4672d821 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCaseListItem.java @@ -0,0 +1,720 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ResolutionCenterCaseListItem.Builder.class) +public final class ResolutionCenterCaseListItem { + private final Optional company; + + private final OffsetDateTime createdAt; + + private final boolean customerAppealed; + + private final List customerResponseActions; + + private final Optional dueDate; + + private final String id; + + private final ResolutionCenterCaseIssueTypes issue; + + private final boolean merchantAppealed; + + private final List merchantResponseActions; + + private final ResolutionCenterCaseListItemPayment payment; + + private final ResolutionCenterCaseStatuses status; + + private final OffsetDateTime updatedAt; + + private final ResolutionCenterCaseListItemUser user; + + private final Map additionalProperties; + + private ResolutionCenterCaseListItem( + Optional company, + OffsetDateTime createdAt, + boolean customerAppealed, + List customerResponseActions, + Optional dueDate, + String id, + ResolutionCenterCaseIssueTypes issue, + boolean merchantAppealed, + List merchantResponseActions, + ResolutionCenterCaseListItemPayment payment, + ResolutionCenterCaseStatuses status, + OffsetDateTime updatedAt, + ResolutionCenterCaseListItemUser user, + Map additionalProperties) { + this.company = company; + this.createdAt = createdAt; + this.customerAppealed = customerAppealed; + this.customerResponseActions = customerResponseActions; + this.dueDate = dueDate; + this.id = id; + this.issue = issue; + this.merchantAppealed = merchantAppealed; + this.merchantResponseActions = merchantResponseActions; + this.payment = payment; + this.status = status; + this.updatedAt = updatedAt; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The company involved in this resolution case. Null if the company no longer exists. + */ + @JsonIgnore + public Optional getCompany() { + if (company == null) { + return Optional.empty(); + } + return company; + } + + /** + * @return The datetime the resolution was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return Whether the customer has filed an appeal after the initial resolution decision. + */ + @JsonProperty("customer_appealed") + public boolean getCustomerAppealed() { + return customerAppealed; + } + + /** + * @return The list of actions currently available to the customer. + */ + @JsonProperty("customer_response_actions") + public List getCustomerResponseActions() { + return customerResponseActions; + } + + /** + * @return The deadline by which the next response is required. Null if no deadline is currently active. As a Unix timestamp. + */ + @JsonIgnore + public Optional getDueDate() { + if (dueDate == null) { + return Optional.empty(); + } + return dueDate; + } + + /** + * @return The unique identifier for the resolution. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The category of the dispute. + */ + @JsonProperty("issue") + public ResolutionCenterCaseIssueTypes getIssue() { + return issue; + } + + /** + * @return Whether the merchant has filed an appeal after the initial resolution decision. + */ + @JsonProperty("merchant_appealed") + public boolean getMerchantAppealed() { + return merchantAppealed; + } + + /** + * @return The list of actions currently available to the merchant. + */ + @JsonProperty("merchant_response_actions") + public List getMerchantResponseActions() { + return merchantResponseActions; + } + + /** + * @return The payment record that is the subject of this resolution case. + */ + @JsonProperty("payment") + public ResolutionCenterCaseListItemPayment getPayment() { + return payment; + } + + /** + * @return The current status of the resolution case, indicating which party needs to respond or if the case is closed. + */ + @JsonProperty("status") + public ResolutionCenterCaseStatuses getStatus() { + return status; + } + + /** + * @return The datetime the resolution was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The customer (buyer) who filed this resolution case. + */ + @JsonProperty("user") + public ResolutionCenterCaseListItemUser getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company") + private Optional _getCompany() { + return company; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("due_date") + private Optional _getDueDate() { + return dueDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ResolutionCenterCaseListItem && equalTo((ResolutionCenterCaseListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ResolutionCenterCaseListItem other) { + return company.equals(other.company) + && createdAt.equals(other.createdAt) + && customerAppealed == other.customerAppealed + && customerResponseActions.equals(other.customerResponseActions) + && dueDate.equals(other.dueDate) + && id.equals(other.id) + && issue.equals(other.issue) + && merchantAppealed == other.merchantAppealed + && merchantResponseActions.equals(other.merchantResponseActions) + && payment.equals(other.payment) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.company, + this.createdAt, + this.customerAppealed, + this.customerResponseActions, + this.dueDate, + this.id, + this.issue, + this.merchantAppealed, + this.merchantResponseActions, + this.payment, + this.status, + this.updatedAt, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the resolution was created.

+ */ + CustomerAppealedStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(ResolutionCenterCaseListItem other); + } + + public interface CustomerAppealedStage { + /** + *

Whether the customer has filed an appeal after the initial resolution decision.

+ */ + IdStage customerAppealed(boolean customerAppealed); + } + + public interface IdStage { + /** + *

The unique identifier for the resolution.

+ */ + IssueStage id(@NotNull String id); + } + + public interface IssueStage { + /** + *

The category of the dispute.

+ */ + MerchantAppealedStage issue(@NotNull ResolutionCenterCaseIssueTypes issue); + } + + public interface MerchantAppealedStage { + /** + *

Whether the merchant has filed an appeal after the initial resolution decision.

+ */ + PaymentStage merchantAppealed(boolean merchantAppealed); + } + + public interface PaymentStage { + /** + *

The payment record that is the subject of this resolution case.

+ */ + StatusStage payment(@NotNull ResolutionCenterCaseListItemPayment payment); + } + + public interface StatusStage { + /** + *

The current status of the resolution case, indicating which party needs to respond or if the case is closed.

+ */ + UpdatedAtStage status(@NotNull ResolutionCenterCaseStatuses status); + } + + public interface UpdatedAtStage { + /** + *

The datetime the resolution was last updated.

+ */ + UserStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UserStage { + /** + *

The customer (buyer) who filed this resolution case.

+ */ + _FinalStage user(@NotNull ResolutionCenterCaseListItemUser user); + } + + public interface _FinalStage { + ResolutionCenterCaseListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The company involved in this resolution case. Null if the company no longer exists.

+ */ + _FinalStage company(Optional company); + + _FinalStage company(ResolutionCenterCaseListItemCompany company); + + _FinalStage company(Nullable company); + + /** + *

The list of actions currently available to the customer.

+ */ + _FinalStage customerResponseActions(List customerResponseActions); + + _FinalStage addCustomerResponseActions(ResolutionCenterCaseCustomerResponses customerResponseActions); + + _FinalStage addAllCustomerResponseActions(List customerResponseActions); + + /** + *

The deadline by which the next response is required. Null if no deadline is currently active. As a Unix timestamp.

+ */ + _FinalStage dueDate(Optional dueDate); + + _FinalStage dueDate(OffsetDateTime dueDate); + + _FinalStage dueDate(Nullable dueDate); + + /** + *

The list of actions currently available to the merchant.

+ */ + _FinalStage merchantResponseActions(List merchantResponseActions); + + _FinalStage addMerchantResponseActions(ResolutionCenterCaseMerchantResponses merchantResponseActions); + + _FinalStage addAllMerchantResponseActions(List merchantResponseActions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + CustomerAppealedStage, + IdStage, + IssueStage, + MerchantAppealedStage, + PaymentStage, + StatusStage, + UpdatedAtStage, + UserStage, + _FinalStage { + private OffsetDateTime createdAt; + + private boolean customerAppealed; + + private String id; + + private ResolutionCenterCaseIssueTypes issue; + + private boolean merchantAppealed; + + private ResolutionCenterCaseListItemPayment payment; + + private ResolutionCenterCaseStatuses status; + + private OffsetDateTime updatedAt; + + private ResolutionCenterCaseListItemUser user; + + private List merchantResponseActions = new ArrayList<>(); + + private Optional dueDate = Optional.empty(); + + private List customerResponseActions = new ArrayList<>(); + + private Optional company = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ResolutionCenterCaseListItem other) { + company(other.getCompany()); + createdAt(other.getCreatedAt()); + customerAppealed(other.getCustomerAppealed()); + customerResponseActions(other.getCustomerResponseActions()); + dueDate(other.getDueDate()); + id(other.getId()); + issue(other.getIssue()); + merchantAppealed(other.getMerchantAppealed()); + merchantResponseActions(other.getMerchantResponseActions()); + payment(other.getPayment()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + return this; + } + + /** + *

The datetime the resolution was created.

+ *

The datetime the resolution was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CustomerAppealedStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Whether the customer has filed an appeal after the initial resolution decision.

+ *

Whether the customer has filed an appeal after the initial resolution decision.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("customer_appealed") + public IdStage customerAppealed(boolean customerAppealed) { + this.customerAppealed = customerAppealed; + return this; + } + + /** + *

The unique identifier for the resolution.

+ *

The unique identifier for the resolution.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IssueStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The category of the dispute.

+ *

The category of the dispute.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("issue") + public MerchantAppealedStage issue(@NotNull ResolutionCenterCaseIssueTypes issue) { + this.issue = Objects.requireNonNull(issue, "issue must not be null"); + return this; + } + + /** + *

Whether the merchant has filed an appeal after the initial resolution decision.

+ *

Whether the merchant has filed an appeal after the initial resolution decision.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("merchant_appealed") + public PaymentStage merchantAppealed(boolean merchantAppealed) { + this.merchantAppealed = merchantAppealed; + return this; + } + + /** + *

The payment record that is the subject of this resolution case.

+ *

The payment record that is the subject of this resolution case.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment") + public StatusStage payment(@NotNull ResolutionCenterCaseListItemPayment payment) { + this.payment = Objects.requireNonNull(payment, "payment must not be null"); + return this; + } + + /** + *

The current status of the resolution case, indicating which party needs to respond or if the case is closed.

+ *

The current status of the resolution case, indicating which party needs to respond or if the case is closed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull ResolutionCenterCaseStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The datetime the resolution was last updated.

+ *

The datetime the resolution was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UserStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The customer (buyer) who filed this resolution case.

+ *

The customer (buyer) who filed this resolution case.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull ResolutionCenterCaseListItemUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

The list of actions currently available to the merchant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllMerchantResponseActions( + List merchantResponseActions) { + if (merchantResponseActions != null) { + this.merchantResponseActions.addAll(merchantResponseActions); + } + return this; + } + + /** + *

The list of actions currently available to the merchant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addMerchantResponseActions(ResolutionCenterCaseMerchantResponses merchantResponseActions) { + this.merchantResponseActions.add(merchantResponseActions); + return this; + } + + /** + *

The list of actions currently available to the merchant.

+ */ + @java.lang.Override + @JsonSetter(value = "merchant_response_actions", nulls = Nulls.SKIP) + public _FinalStage merchantResponseActions( + List merchantResponseActions) { + this.merchantResponseActions.clear(); + if (merchantResponseActions != null) { + this.merchantResponseActions.addAll(merchantResponseActions); + } + return this; + } + + /** + *

The deadline by which the next response is required. Null if no deadline is currently active. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dueDate(Nullable dueDate) { + if (dueDate.isNull()) { + this.dueDate = null; + } else if (dueDate.isEmpty()) { + this.dueDate = Optional.empty(); + } else { + this.dueDate = Optional.of(dueDate.get()); + } + return this; + } + + /** + *

The deadline by which the next response is required. Null if no deadline is currently active. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dueDate(OffsetDateTime dueDate) { + this.dueDate = Optional.ofNullable(dueDate); + return this; + } + + /** + *

The deadline by which the next response is required. Null if no deadline is currently active. As a Unix timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "due_date", nulls = Nulls.SKIP) + public _FinalStage dueDate(Optional dueDate) { + this.dueDate = dueDate; + return this; + } + + /** + *

The list of actions currently available to the customer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllCustomerResponseActions( + List customerResponseActions) { + if (customerResponseActions != null) { + this.customerResponseActions.addAll(customerResponseActions); + } + return this; + } + + /** + *

The list of actions currently available to the customer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addCustomerResponseActions(ResolutionCenterCaseCustomerResponses customerResponseActions) { + this.customerResponseActions.add(customerResponseActions); + return this; + } + + /** + *

The list of actions currently available to the customer.

+ */ + @java.lang.Override + @JsonSetter(value = "customer_response_actions", nulls = Nulls.SKIP) + public _FinalStage customerResponseActions( + List customerResponseActions) { + this.customerResponseActions.clear(); + if (customerResponseActions != null) { + this.customerResponseActions.addAll(customerResponseActions); + } + return this; + } + + /** + *

The company involved in this resolution case. Null if the company no longer exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(Nullable company) { + if (company.isNull()) { + this.company = null; + } else if (company.isEmpty()) { + this.company = Optional.empty(); + } else { + this.company = Optional.of(company.get()); + } + return this; + } + + /** + *

The company involved in this resolution case. Null if the company no longer exists.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(ResolutionCenterCaseListItemCompany company) { + this.company = Optional.ofNullable(company); + return this; + } + + /** + *

The company involved in this resolution case. Null if the company no longer exists.

+ */ + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + + @java.lang.Override + public ResolutionCenterCaseListItem build() { + return new ResolutionCenterCaseListItem( + company, + createdAt, + customerAppealed, + customerResponseActions, + dueDate, + id, + issue, + merchantAppealed, + merchantResponseActions, + payment, + status, + updatedAt, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCaseListItemCompany.java b/src/main/java/com/whop/api/types/ResolutionCenterCaseListItemCompany.java new file mode 100644 index 00000000..35740490 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCaseListItemCompany.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ResolutionCenterCaseListItemCompany.Builder.class) +public final class ResolutionCenterCaseListItemCompany { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private ResolutionCenterCaseListItemCompany(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ResolutionCenterCaseListItemCompany + && equalTo((ResolutionCenterCaseListItemCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ResolutionCenterCaseListItemCompany other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + TitleStage id(@NotNull String id); + + Builder from(ResolutionCenterCaseListItemCompany other); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + ResolutionCenterCaseListItemCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ResolutionCenterCaseListItemCompany other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public ResolutionCenterCaseListItemCompany build() { + return new ResolutionCenterCaseListItemCompany(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCaseListItemPayment.java b/src/main/java/com/whop/api/types/ResolutionCenterCaseListItemPayment.java new file mode 100644 index 00000000..f3f87619 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCaseListItemPayment.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ResolutionCenterCaseListItemPayment.Builder.class) +public final class ResolutionCenterCaseListItemPayment { + private final String id; + + private final Map additionalProperties; + + private ResolutionCenterCaseListItemPayment(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the payment. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ResolutionCenterCaseListItemPayment + && equalTo((ResolutionCenterCaseListItemPayment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ResolutionCenterCaseListItemPayment other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the payment.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(ResolutionCenterCaseListItemPayment other); + } + + public interface _FinalStage { + ResolutionCenterCaseListItemPayment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ResolutionCenterCaseListItemPayment other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the payment.

+ *

The unique identifier for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public ResolutionCenterCaseListItemPayment build() { + return new ResolutionCenterCaseListItemPayment(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCaseListItemUser.java b/src/main/java/com/whop/api/types/ResolutionCenterCaseListItemUser.java new file mode 100644 index 00000000..fe928178 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCaseListItemUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ResolutionCenterCaseListItemUser.Builder.class) +public final class ResolutionCenterCaseListItemUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private ResolutionCenterCaseListItemUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ResolutionCenterCaseListItemUser && equalTo((ResolutionCenterCaseListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ResolutionCenterCaseListItemUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(ResolutionCenterCaseListItemUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + ResolutionCenterCaseListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ResolutionCenterCaseListItemUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ResolutionCenterCaseListItemUser build() { + return new ResolutionCenterCaseListItemUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCaseMerchantResponses.java b/src/main/java/com/whop/api/types/ResolutionCenterCaseMerchantResponses.java new file mode 100644 index 00000000..2f5cac9d --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCaseMerchantResponses.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ResolutionCenterCaseMerchantResponses { + public static final ResolutionCenterCaseMerchantResponses REQUEST_MORE_INFO = + new ResolutionCenterCaseMerchantResponses(Value.REQUEST_MORE_INFO, "request_more_info"); + + public static final ResolutionCenterCaseMerchantResponses ACCEPT = + new ResolutionCenterCaseMerchantResponses(Value.ACCEPT, "accept"); + + public static final ResolutionCenterCaseMerchantResponses APPEAL = + new ResolutionCenterCaseMerchantResponses(Value.APPEAL, "appeal"); + + public static final ResolutionCenterCaseMerchantResponses RESPOND = + new ResolutionCenterCaseMerchantResponses(Value.RESPOND, "respond"); + + public static final ResolutionCenterCaseMerchantResponses DENY = + new ResolutionCenterCaseMerchantResponses(Value.DENY, "deny"); + + private final Value value; + + private final String string; + + ResolutionCenterCaseMerchantResponses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ResolutionCenterCaseMerchantResponses + && this.string.equals(((ResolutionCenterCaseMerchantResponses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REQUEST_MORE_INFO: + return visitor.visitRequestMoreInfo(); + case ACCEPT: + return visitor.visitAccept(); + case APPEAL: + return visitor.visitAppeal(); + case RESPOND: + return visitor.visitRespond(); + case DENY: + return visitor.visitDeny(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ResolutionCenterCaseMerchantResponses valueOf(String value) { + switch (value) { + case "request_more_info": + return REQUEST_MORE_INFO; + case "accept": + return ACCEPT; + case "appeal": + return APPEAL; + case "respond": + return RESPOND; + case "deny": + return DENY; + default: + return new ResolutionCenterCaseMerchantResponses(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCEPT, + + DENY, + + REQUEST_MORE_INFO, + + APPEAL, + + RESPOND, + + UNKNOWN + } + + public interface Visitor { + T visitAccept(); + + T visitDeny(); + + T visitRequestMoreInfo(); + + T visitAppeal(); + + T visitRespond(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCaseOutcome.java b/src/main/java/com/whop/api/types/ResolutionCenterCaseOutcome.java new file mode 100644 index 00000000..5513f7f6 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCaseOutcome.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ResolutionCenterCaseOutcome { + public static final ResolutionCenterCaseOutcome MERCHANT_WON = + new ResolutionCenterCaseOutcome(Value.MERCHANT_WON, "merchant_won"); + + public static final ResolutionCenterCaseOutcome CUSTOMER_WON = + new ResolutionCenterCaseOutcome(Value.CUSTOMER_WON, "customer_won"); + + public static final ResolutionCenterCaseOutcome WITHDRAWN = + new ResolutionCenterCaseOutcome(Value.WITHDRAWN, "withdrawn"); + + private final Value value; + + private final String string; + + ResolutionCenterCaseOutcome(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ResolutionCenterCaseOutcome + && this.string.equals(((ResolutionCenterCaseOutcome) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MERCHANT_WON: + return visitor.visitMerchantWon(); + case CUSTOMER_WON: + return visitor.visitCustomerWon(); + case WITHDRAWN: + return visitor.visitWithdrawn(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ResolutionCenterCaseOutcome valueOf(String value) { + switch (value) { + case "merchant_won": + return MERCHANT_WON; + case "customer_won": + return CUSTOMER_WON; + case "withdrawn": + return WITHDRAWN; + default: + return new ResolutionCenterCaseOutcome(Value.UNKNOWN, value); + } + } + + public enum Value { + CUSTOMER_WON, + + MERCHANT_WON, + + WITHDRAWN, + + UNKNOWN + } + + public interface Visitor { + T visitCustomerWon(); + + T visitMerchantWon(); + + T visitWithdrawn(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCasePlatformResponses.java b/src/main/java/com/whop/api/types/ResolutionCenterCasePlatformResponses.java new file mode 100644 index 00000000..f4d0af04 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCasePlatformResponses.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ResolutionCenterCasePlatformResponses { + public static final ResolutionCenterCasePlatformResponses REQUEST_BUYER_INFO = + new ResolutionCenterCasePlatformResponses(Value.REQUEST_BUYER_INFO, "request_buyer_info"); + + public static final ResolutionCenterCasePlatformResponses MERCHANT_WINS = + new ResolutionCenterCasePlatformResponses(Value.MERCHANT_WINS, "merchant_wins"); + + public static final ResolutionCenterCasePlatformResponses REQUEST_MERCHANT_INFO = + new ResolutionCenterCasePlatformResponses(Value.REQUEST_MERCHANT_INFO, "request_merchant_info"); + + public static final ResolutionCenterCasePlatformResponses MERCHANT_REFUND = + new ResolutionCenterCasePlatformResponses(Value.MERCHANT_REFUND, "merchant_refund"); + + private final Value value; + + private final String string; + + ResolutionCenterCasePlatformResponses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ResolutionCenterCasePlatformResponses + && this.string.equals(((ResolutionCenterCasePlatformResponses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case REQUEST_BUYER_INFO: + return visitor.visitRequestBuyerInfo(); + case MERCHANT_WINS: + return visitor.visitMerchantWins(); + case REQUEST_MERCHANT_INFO: + return visitor.visitRequestMerchantInfo(); + case MERCHANT_REFUND: + return visitor.visitMerchantRefund(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ResolutionCenterCasePlatformResponses valueOf(String value) { + switch (value) { + case "request_buyer_info": + return REQUEST_BUYER_INFO; + case "merchant_wins": + return MERCHANT_WINS; + case "request_merchant_info": + return REQUEST_MERCHANT_INFO; + case "merchant_refund": + return MERCHANT_REFUND; + default: + return new ResolutionCenterCasePlatformResponses(Value.UNKNOWN, value); + } + } + + public enum Value { + REQUEST_BUYER_INFO, + + REQUEST_MERCHANT_INFO, + + MERCHANT_WINS, + + MERCHANT_REFUND, + + UNKNOWN + } + + public interface Visitor { + T visitRequestBuyerInfo(); + + T visitRequestMerchantInfo(); + + T visitMerchantWins(); + + T visitMerchantRefund(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCaseReason.java b/src/main/java/com/whop/api/types/ResolutionCenterCaseReason.java new file mode 100644 index 00000000..5b07d6fe --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCaseReason.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ResolutionCenterCaseReason { + public static final ResolutionCenterCaseReason FRAUDULENT = + new ResolutionCenterCaseReason(Value.FRAUDULENT, "fraudulent"); + + public static final ResolutionCenterCaseReason PRODUCT_UNACCEPTABLE = + new ResolutionCenterCaseReason(Value.PRODUCT_UNACCEPTABLE, "product_unacceptable"); + + public static final ResolutionCenterCaseReason NOT_AS_DESCRIBED = + new ResolutionCenterCaseReason(Value.NOT_AS_DESCRIBED, "not_as_described"); + + public static final ResolutionCenterCaseReason PRODUCT_NOT_RECEIVED = + new ResolutionCenterCaseReason(Value.PRODUCT_NOT_RECEIVED, "product_not_received"); + + public static final ResolutionCenterCaseReason SUBSCRIPTION_CANCELED = + new ResolutionCenterCaseReason(Value.SUBSCRIPTION_CANCELED, "subscription_canceled"); + + private final Value value; + + private final String string; + + ResolutionCenterCaseReason(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ResolutionCenterCaseReason + && this.string.equals(((ResolutionCenterCaseReason) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FRAUDULENT: + return visitor.visitFraudulent(); + case PRODUCT_UNACCEPTABLE: + return visitor.visitProductUnacceptable(); + case NOT_AS_DESCRIBED: + return visitor.visitNotAsDescribed(); + case PRODUCT_NOT_RECEIVED: + return visitor.visitProductNotReceived(); + case SUBSCRIPTION_CANCELED: + return visitor.visitSubscriptionCanceled(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ResolutionCenterCaseReason valueOf(String value) { + switch (value) { + case "fraudulent": + return FRAUDULENT; + case "product_unacceptable": + return PRODUCT_UNACCEPTABLE; + case "not_as_described": + return NOT_AS_DESCRIBED; + case "product_not_received": + return PRODUCT_NOT_RECEIVED; + case "subscription_canceled": + return SUBSCRIPTION_CANCELED; + default: + return new ResolutionCenterCaseReason(Value.UNKNOWN, value); + } + } + + public enum Value { + FRAUDULENT, + + PRODUCT_NOT_RECEIVED, + + NOT_AS_DESCRIBED, + + PRODUCT_UNACCEPTABLE, + + SUBSCRIPTION_CANCELED, + + UNKNOWN + } + + public interface Visitor { + T visitFraudulent(); + + T visitProductNotReceived(); + + T visitNotAsDescribed(); + + T visitProductUnacceptable(); + + T visitSubscriptionCanceled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCaseRefund.java b/src/main/java/com/whop/api/types/ResolutionCenterCaseRefund.java new file mode 100644 index 00000000..67944d50 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCaseRefund.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ResolutionCenterCaseRefund { + public static final ResolutionCenterCaseRefund MERCHANT = + new ResolutionCenterCaseRefund(Value.MERCHANT, "merchant"); + + public static final ResolutionCenterCaseRefund PLATFORM = + new ResolutionCenterCaseRefund(Value.PLATFORM, "platform"); + + public static final ResolutionCenterCaseRefund NONE = new ResolutionCenterCaseRefund(Value.NONE, "none"); + + private final Value value; + + private final String string; + + ResolutionCenterCaseRefund(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ResolutionCenterCaseRefund + && this.string.equals(((ResolutionCenterCaseRefund) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MERCHANT: + return visitor.visitMerchant(); + case PLATFORM: + return visitor.visitPlatform(); + case NONE: + return visitor.visitNone(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ResolutionCenterCaseRefund valueOf(String value) { + switch (value) { + case "merchant": + return MERCHANT; + case "platform": + return PLATFORM; + case "none": + return NONE; + default: + return new ResolutionCenterCaseRefund(Value.UNKNOWN, value); + } + } + + public enum Value { + NONE, + + MERCHANT, + + PLATFORM, + + UNKNOWN + } + + public interface Visitor { + T visitNone(); + + T visitMerchant(); + + T visitPlatform(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCaseReporters.java b/src/main/java/com/whop/api/types/ResolutionCenterCaseReporters.java new file mode 100644 index 00000000..2d69e679 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCaseReporters.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ResolutionCenterCaseReporters { + public static final ResolutionCenterCaseReporters CUSTOMER = + new ResolutionCenterCaseReporters(Value.CUSTOMER, "customer"); + + public static final ResolutionCenterCaseReporters MERCHANT = + new ResolutionCenterCaseReporters(Value.MERCHANT, "merchant"); + + public static final ResolutionCenterCaseReporters SYSTEM = + new ResolutionCenterCaseReporters(Value.SYSTEM, "system"); + + public static final ResolutionCenterCaseReporters PLATFORM = + new ResolutionCenterCaseReporters(Value.PLATFORM, "platform"); + + private final Value value; + + private final String string; + + ResolutionCenterCaseReporters(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ResolutionCenterCaseReporters + && this.string.equals(((ResolutionCenterCaseReporters) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CUSTOMER: + return visitor.visitCustomer(); + case MERCHANT: + return visitor.visitMerchant(); + case SYSTEM: + return visitor.visitSystem(); + case PLATFORM: + return visitor.visitPlatform(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ResolutionCenterCaseReporters valueOf(String value) { + switch (value) { + case "customer": + return CUSTOMER; + case "merchant": + return MERCHANT; + case "system": + return SYSTEM; + case "platform": + return PLATFORM; + default: + return new ResolutionCenterCaseReporters(Value.UNKNOWN, value); + } + } + + public enum Value { + MERCHANT, + + CUSTOMER, + + PLATFORM, + + SYSTEM, + + UNKNOWN + } + + public interface Visitor { + T visitMerchant(); + + T visitCustomer(); + + T visitPlatform(); + + T visitSystem(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCaseStatus.java b/src/main/java/com/whop/api/types/ResolutionCenterCaseStatus.java new file mode 100644 index 00000000..c0606e29 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCaseStatus.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ResolutionCenterCaseStatus { + public static final ResolutionCenterCaseStatus AWAITING_CUSTOMER = + new ResolutionCenterCaseStatus(Value.AWAITING_CUSTOMER, "awaiting_customer"); + + public static final ResolutionCenterCaseStatus CLOSED = new ResolutionCenterCaseStatus(Value.CLOSED, "closed"); + + public static final ResolutionCenterCaseStatus UNDER_REVIEW = + new ResolutionCenterCaseStatus(Value.UNDER_REVIEW, "under_review"); + + public static final ResolutionCenterCaseStatus AWAITING_MERCHANT = + new ResolutionCenterCaseStatus(Value.AWAITING_MERCHANT, "awaiting_merchant"); + + private final Value value; + + private final String string; + + ResolutionCenterCaseStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ResolutionCenterCaseStatus + && this.string.equals(((ResolutionCenterCaseStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AWAITING_CUSTOMER: + return visitor.visitAwaitingCustomer(); + case CLOSED: + return visitor.visitClosed(); + case UNDER_REVIEW: + return visitor.visitUnderReview(); + case AWAITING_MERCHANT: + return visitor.visitAwaitingMerchant(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ResolutionCenterCaseStatus valueOf(String value) { + switch (value) { + case "awaiting_customer": + return AWAITING_CUSTOMER; + case "closed": + return CLOSED; + case "under_review": + return UNDER_REVIEW; + case "awaiting_merchant": + return AWAITING_MERCHANT; + default: + return new ResolutionCenterCaseStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + AWAITING_MERCHANT, + + AWAITING_CUSTOMER, + + UNDER_REVIEW, + + CLOSED, + + UNKNOWN + } + + public interface Visitor { + T visitAwaitingMerchant(); + + T visitAwaitingCustomer(); + + T visitUnderReview(); + + T visitClosed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionCenterCaseStatuses.java b/src/main/java/com/whop/api/types/ResolutionCenterCaseStatuses.java new file mode 100644 index 00000000..4dcdc6ef --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionCenterCaseStatuses.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ResolutionCenterCaseStatuses { + public static final ResolutionCenterCaseStatuses CUSTOMER_WITHDREW = + new ResolutionCenterCaseStatuses(Value.CUSTOMER_WITHDREW, "customer_withdrew"); + + public static final ResolutionCenterCaseStatuses MERCHANT_INFO_NEEDED = + new ResolutionCenterCaseStatuses(Value.MERCHANT_INFO_NEEDED, "merchant_info_needed"); + + public static final ResolutionCenterCaseStatuses CUSTOMER_INFO_NEEDED = + new ResolutionCenterCaseStatuses(Value.CUSTOMER_INFO_NEEDED, "customer_info_needed"); + + public static final ResolutionCenterCaseStatuses MERCHANT_WON = + new ResolutionCenterCaseStatuses(Value.MERCHANT_WON, "merchant_won"); + + public static final ResolutionCenterCaseStatuses CUSTOMER_RESPONSE_NEEDED = + new ResolutionCenterCaseStatuses(Value.CUSTOMER_RESPONSE_NEEDED, "customer_response_needed"); + + public static final ResolutionCenterCaseStatuses CUSTOMER_WON = + new ResolutionCenterCaseStatuses(Value.CUSTOMER_WON, "customer_won"); + + public static final ResolutionCenterCaseStatuses UNDER_PLATFORM_REVIEW = + new ResolutionCenterCaseStatuses(Value.UNDER_PLATFORM_REVIEW, "under_platform_review"); + + public static final ResolutionCenterCaseStatuses MERCHANT_RESPONSE_NEEDED = + new ResolutionCenterCaseStatuses(Value.MERCHANT_RESPONSE_NEEDED, "merchant_response_needed"); + + private final Value value; + + private final String string; + + ResolutionCenterCaseStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ResolutionCenterCaseStatuses + && this.string.equals(((ResolutionCenterCaseStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CUSTOMER_WITHDREW: + return visitor.visitCustomerWithdrew(); + case MERCHANT_INFO_NEEDED: + return visitor.visitMerchantInfoNeeded(); + case CUSTOMER_INFO_NEEDED: + return visitor.visitCustomerInfoNeeded(); + case MERCHANT_WON: + return visitor.visitMerchantWon(); + case CUSTOMER_RESPONSE_NEEDED: + return visitor.visitCustomerResponseNeeded(); + case CUSTOMER_WON: + return visitor.visitCustomerWon(); + case UNDER_PLATFORM_REVIEW: + return visitor.visitUnderPlatformReview(); + case MERCHANT_RESPONSE_NEEDED: + return visitor.visitMerchantResponseNeeded(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ResolutionCenterCaseStatuses valueOf(String value) { + switch (value) { + case "customer_withdrew": + return CUSTOMER_WITHDREW; + case "merchant_info_needed": + return MERCHANT_INFO_NEEDED; + case "customer_info_needed": + return CUSTOMER_INFO_NEEDED; + case "merchant_won": + return MERCHANT_WON; + case "customer_response_needed": + return CUSTOMER_RESPONSE_NEEDED; + case "customer_won": + return CUSTOMER_WON; + case "under_platform_review": + return UNDER_PLATFORM_REVIEW; + case "merchant_response_needed": + return MERCHANT_RESPONSE_NEEDED; + default: + return new ResolutionCenterCaseStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + MERCHANT_RESPONSE_NEEDED, + + CUSTOMER_RESPONSE_NEEDED, + + MERCHANT_INFO_NEEDED, + + CUSTOMER_INFO_NEEDED, + + UNDER_PLATFORM_REVIEW, + + CUSTOMER_WON, + + MERCHANT_WON, + + CUSTOMER_WITHDREW, + + UNKNOWN + } + + public interface Visitor { + T visitMerchantResponseNeeded(); + + T visitCustomerResponseNeeded(); + + T visitMerchantInfoNeeded(); + + T visitCustomerInfoNeeded(); + + T visitUnderPlatformReview(); + + T visitCustomerWon(); + + T visitMerchantWon(); + + T visitCustomerWithdrew(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionEvent.java b/src/main/java/com/whop/api/types/ResolutionEvent.java new file mode 100644 index 00000000..e46284e0 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionEvent.java @@ -0,0 +1,450 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ResolutionEvent.Builder.class) +public final class ResolutionEvent { + private final ResolutionEventAction action; + + private final List attachments; + + private final String createdAt; + + private final Optional details; + + private final String id; + + private final ResolutionEventReporterType reporterType; + + private final boolean viewableByCustomer; + + private final boolean viewableByMerchant; + + private final Map additionalProperties; + + private ResolutionEvent( + ResolutionEventAction action, + List attachments, + String createdAt, + Optional details, + String id, + ResolutionEventReporterType reporterType, + boolean viewableByCustomer, + boolean viewableByMerchant, + Map additionalProperties) { + this.action = action; + this.attachments = attachments; + this.createdAt = createdAt; + this.details = details; + this.id = id; + this.reporterType = reporterType; + this.viewableByCustomer = viewableByCustomer; + this.viewableByMerchant = viewableByMerchant; + this.additionalProperties = additionalProperties; + } + + /** + * @return The action recorded in this event. + */ + @JsonProperty("action") + public ResolutionEventAction getAction() { + return action; + } + + @JsonProperty("attachments") + public List getAttachments() { + return attachments; + } + + /** + * @return When the event occurred, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return The message body or additional context provided with the event. + */ + @JsonIgnore + public Optional getDetails() { + if (details == null) { + return Optional.empty(); + } + return details; + } + + /** + * @return Unique identifier for the event, prefixed revt_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The party that performed the action. + */ + @JsonProperty("reporter_type") + public ResolutionEventReporterType getReporterType() { + return reporterType; + } + + /** + * @return Whether the customer can see this event in the timeline. + */ + @JsonProperty("viewable_by_customer") + public boolean getViewableByCustomer() { + return viewableByCustomer; + } + + /** + * @return Whether the merchant can see this event in the timeline. + */ + @JsonProperty("viewable_by_merchant") + public boolean getViewableByMerchant() { + return viewableByMerchant; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("details") + private Optional _getDetails() { + return details; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ResolutionEvent && equalTo((ResolutionEvent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ResolutionEvent other) { + return action.equals(other.action) + && attachments.equals(other.attachments) + && createdAt.equals(other.createdAt) + && details.equals(other.details) + && id.equals(other.id) + && reporterType.equals(other.reporterType) + && viewableByCustomer == other.viewableByCustomer + && viewableByMerchant == other.viewableByMerchant; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.action, + this.attachments, + this.createdAt, + this.details, + this.id, + this.reporterType, + this.viewableByCustomer, + this.viewableByMerchant); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + /** + *

The action recorded in this event.

+ */ + CreatedAtStage action(@NotNull ResolutionEventAction action); + + Builder from(ResolutionEvent other); + } + + public interface CreatedAtStage { + /** + *

When the event occurred, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Unique identifier for the event, prefixed revt_.

+ */ + ReporterTypeStage id(@NotNull String id); + } + + public interface ReporterTypeStage { + /** + *

The party that performed the action.

+ */ + ViewableByCustomerStage reporterType(@NotNull ResolutionEventReporterType reporterType); + } + + public interface ViewableByCustomerStage { + /** + *

Whether the customer can see this event in the timeline.

+ */ + ViewableByMerchantStage viewableByCustomer(boolean viewableByCustomer); + } + + public interface ViewableByMerchantStage { + /** + *

Whether the merchant can see this event in the timeline.

+ */ + _FinalStage viewableByMerchant(boolean viewableByMerchant); + } + + public interface _FinalStage { + ResolutionEvent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage attachments(List attachments); + + _FinalStage addAttachments(ResolutionAttachment attachments); + + _FinalStage addAllAttachments(List attachments); + + /** + *

The message body or additional context provided with the event.

+ */ + _FinalStage details(Optional details); + + _FinalStage details(String details); + + _FinalStage details(Nullable details); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ActionStage, + CreatedAtStage, + IdStage, + ReporterTypeStage, + ViewableByCustomerStage, + ViewableByMerchantStage, + _FinalStage { + private ResolutionEventAction action; + + private String createdAt; + + private String id; + + private ResolutionEventReporterType reporterType; + + private boolean viewableByCustomer; + + private boolean viewableByMerchant; + + private Optional details = Optional.empty(); + + private List attachments = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ResolutionEvent other) { + action(other.getAction()); + attachments(other.getAttachments()); + createdAt(other.getCreatedAt()); + details(other.getDetails()); + id(other.getId()); + reporterType(other.getReporterType()); + viewableByCustomer(other.getViewableByCustomer()); + viewableByMerchant(other.getViewableByMerchant()); + return this; + } + + /** + *

The action recorded in this event.

+ *

The action recorded in this event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("action") + public CreatedAtStage action(@NotNull ResolutionEventAction action) { + this.action = Objects.requireNonNull(action, "action must not be null"); + return this; + } + + /** + *

When the event occurred, as an ISO 8601 timestamp.

+ *

When the event occurred, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Unique identifier for the event, prefixed revt_.

+ *

Unique identifier for the event, prefixed revt_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ReporterTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The party that performed the action.

+ *

The party that performed the action.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reporter_type") + public ViewableByCustomerStage reporterType(@NotNull ResolutionEventReporterType reporterType) { + this.reporterType = Objects.requireNonNull(reporterType, "reporterType must not be null"); + return this; + } + + /** + *

Whether the customer can see this event in the timeline.

+ *

Whether the customer can see this event in the timeline.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("viewable_by_customer") + public ViewableByMerchantStage viewableByCustomer(boolean viewableByCustomer) { + this.viewableByCustomer = viewableByCustomer; + return this; + } + + /** + *

Whether the merchant can see this event in the timeline.

+ *

Whether the merchant can see this event in the timeline.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("viewable_by_merchant") + public _FinalStage viewableByMerchant(boolean viewableByMerchant) { + this.viewableByMerchant = viewableByMerchant; + return this; + } + + /** + *

The message body or additional context provided with the event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage details(Nullable details) { + if (details.isNull()) { + this.details = null; + } else if (details.isEmpty()) { + this.details = Optional.empty(); + } else { + this.details = Optional.of(details.get()); + } + return this; + } + + /** + *

The message body or additional context provided with the event.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage details(String details) { + this.details = Optional.ofNullable(details); + return this; + } + + /** + *

The message body or additional context provided with the event.

+ */ + @java.lang.Override + @JsonSetter(value = "details", nulls = Nulls.SKIP) + public _FinalStage details(Optional details) { + this.details = details; + return this; + } + + @java.lang.Override + public _FinalStage addAllAttachments(List attachments) { + if (attachments != null) { + this.attachments.addAll(attachments); + } + return this; + } + + @java.lang.Override + public _FinalStage addAttachments(ResolutionAttachment attachments) { + this.attachments.add(attachments); + return this; + } + + @java.lang.Override + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public _FinalStage attachments(List attachments) { + this.attachments.clear(); + if (attachments != null) { + this.attachments.addAll(attachments); + } + return this; + } + + @java.lang.Override + public ResolutionEvent build() { + return new ResolutionEvent( + action, + attachments, + createdAt, + details, + id, + reporterType, + viewableByCustomer, + viewableByMerchant, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionEventAction.java b/src/main/java/com/whop/api/types/ResolutionEventAction.java new file mode 100644 index 00000000..b9082dd4 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionEventAction.java @@ -0,0 +1,178 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ResolutionEventAction { + public static final ResolutionEventAction WITHDREW = new ResolutionEventAction(Value.WITHDREW, "withdrew"); + + public static final ResolutionEventAction DISPUTE_OPENED = + new ResolutionEventAction(Value.DISPUTE_OPENED, "dispute_opened"); + + public static final ResolutionEventAction RESPONDED = new ResolutionEventAction(Value.RESPONDED, "responded"); + + public static final ResolutionEventAction DISPUTE_CUSTOMER_WON = + new ResolutionEventAction(Value.DISPUTE_CUSTOMER_WON, "dispute_customer_won"); + + public static final ResolutionEventAction ESCALATED = new ResolutionEventAction(Value.ESCALATED, "escalated"); + + public static final ResolutionEventAction DENIED = new ResolutionEventAction(Value.DENIED, "denied"); + + public static final ResolutionEventAction ACCEPTED = new ResolutionEventAction(Value.ACCEPTED, "accepted"); + + public static final ResolutionEventAction CREATED = new ResolutionEventAction(Value.CREATED, "created"); + + public static final ResolutionEventAction APPEALED = new ResolutionEventAction(Value.APPEALED, "appealed"); + + public static final ResolutionEventAction REQUESTED_MORE_INFO = + new ResolutionEventAction(Value.REQUESTED_MORE_INFO, "requested_more_info"); + + public static final ResolutionEventAction DISPUTE_MERCHANT_WON = + new ResolutionEventAction(Value.DISPUTE_MERCHANT_WON, "dispute_merchant_won"); + + private final Value value; + + private final String string; + + ResolutionEventAction(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ResolutionEventAction + && this.string.equals(((ResolutionEventAction) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WITHDREW: + return visitor.visitWithdrew(); + case DISPUTE_OPENED: + return visitor.visitDisputeOpened(); + case RESPONDED: + return visitor.visitResponded(); + case DISPUTE_CUSTOMER_WON: + return visitor.visitDisputeCustomerWon(); + case ESCALATED: + return visitor.visitEscalated(); + case DENIED: + return visitor.visitDenied(); + case ACCEPTED: + return visitor.visitAccepted(); + case CREATED: + return visitor.visitCreated(); + case APPEALED: + return visitor.visitAppealed(); + case REQUESTED_MORE_INFO: + return visitor.visitRequestedMoreInfo(); + case DISPUTE_MERCHANT_WON: + return visitor.visitDisputeMerchantWon(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ResolutionEventAction valueOf(String value) { + switch (value) { + case "withdrew": + return WITHDREW; + case "dispute_opened": + return DISPUTE_OPENED; + case "responded": + return RESPONDED; + case "dispute_customer_won": + return DISPUTE_CUSTOMER_WON; + case "escalated": + return ESCALATED; + case "denied": + return DENIED; + case "accepted": + return ACCEPTED; + case "created": + return CREATED; + case "appealed": + return APPEALED; + case "requested_more_info": + return REQUESTED_MORE_INFO; + case "dispute_merchant_won": + return DISPUTE_MERCHANT_WON; + default: + return new ResolutionEventAction(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATED, + + RESPONDED, + + ACCEPTED, + + DENIED, + + APPEALED, + + WITHDREW, + + REQUESTED_MORE_INFO, + + ESCALATED, + + DISPUTE_OPENED, + + DISPUTE_CUSTOMER_WON, + + DISPUTE_MERCHANT_WON, + + UNKNOWN + } + + public interface Visitor { + T visitCreated(); + + T visitResponded(); + + T visitAccepted(); + + T visitDenied(); + + T visitAppealed(); + + T visitWithdrew(); + + T visitRequestedMoreInfo(); + + T visitEscalated(); + + T visitDisputeOpened(); + + T visitDisputeCustomerWon(); + + T visitDisputeMerchantWon(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionEventReporterType.java b/src/main/java/com/whop/api/types/ResolutionEventReporterType.java new file mode 100644 index 00000000..cf273e7b --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionEventReporterType.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ResolutionEventReporterType { + public static final ResolutionEventReporterType CUSTOMER = + new ResolutionEventReporterType(Value.CUSTOMER, "customer"); + + public static final ResolutionEventReporterType MERCHANT = + new ResolutionEventReporterType(Value.MERCHANT, "merchant"); + + public static final ResolutionEventReporterType SYSTEM = new ResolutionEventReporterType(Value.SYSTEM, "system"); + + public static final ResolutionEventReporterType PLATFORM = + new ResolutionEventReporterType(Value.PLATFORM, "platform"); + + private final Value value; + + private final String string; + + ResolutionEventReporterType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ResolutionEventReporterType + && this.string.equals(((ResolutionEventReporterType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CUSTOMER: + return visitor.visitCustomer(); + case MERCHANT: + return visitor.visitMerchant(); + case SYSTEM: + return visitor.visitSystem(); + case PLATFORM: + return visitor.visitPlatform(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ResolutionEventReporterType valueOf(String value) { + switch (value) { + case "customer": + return CUSTOMER; + case "merchant": + return MERCHANT; + case "system": + return SYSTEM; + case "platform": + return PLATFORM; + default: + return new ResolutionEventReporterType(Value.UNKNOWN, value); + } + } + + public enum Value { + MERCHANT, + + CUSTOMER, + + PLATFORM, + + SYSTEM, + + UNKNOWN + } + + public interface Visitor { + T visitMerchant(); + + T visitCustomer(); + + T visitPlatform(); + + T visitSystem(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ResolutionPayment.java b/src/main/java/com/whop/api/types/ResolutionPayment.java new file mode 100644 index 00000000..dbd9feaf --- /dev/null +++ b/src/main/java/com/whop/api/types/ResolutionPayment.java @@ -0,0 +1,381 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ResolutionPayment.Builder.class) +public final class ResolutionPayment { + private final Optional cardBrand; + + private final Optional cardLast4; + + private final String createdAt; + + private final String id; + + private final Optional paymentMethodType; + + private final Map additionalProperties; + + private ResolutionPayment( + Optional cardBrand, + Optional cardLast4, + String createdAt, + String id, + Optional paymentMethodType, + Map additionalProperties) { + this.cardBrand = cardBrand; + this.cardLast4 = cardLast4; + this.createdAt = createdAt; + this.id = id; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return Card brand, when the customer paid by card. + */ + @JsonIgnore + public Optional getCardBrand() { + if (cardBrand == null) { + return Optional.empty(); + } + return cardBrand; + } + + /** + * @return Last four digits of the card, when the customer paid by card. + */ + @JsonIgnore + public Optional getCardLast4() { + if (cardLast4 == null) { + return Optional.empty(); + } + return cardLast4; + } + + /** + * @return When the payment was made, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Payment ID, prefixed pay_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return How the customer paid, such as card or paypal. + */ + @JsonIgnore + public Optional getPaymentMethodType() { + if (paymentMethodType == null) { + return Optional.empty(); + } + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_brand") + private Optional _getCardBrand() { + return cardBrand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card_last4") + private Optional _getCardLast4() { + return cardLast4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method_type") + private Optional _getPaymentMethodType() { + return paymentMethodType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ResolutionPayment && equalTo((ResolutionPayment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ResolutionPayment other) { + return cardBrand.equals(other.cardBrand) + && cardLast4.equals(other.cardLast4) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cardBrand, this.cardLast4, this.createdAt, this.id, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the payment was made, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + + Builder from(ResolutionPayment other); + } + + public interface IdStage { + /** + *

Payment ID, prefixed pay_.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + ResolutionPayment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Card brand, when the customer paid by card.

+ */ + _FinalStage cardBrand(Optional cardBrand); + + _FinalStage cardBrand(String cardBrand); + + _FinalStage cardBrand(Nullable cardBrand); + + /** + *

Last four digits of the card, when the customer paid by card.

+ */ + _FinalStage cardLast4(Optional cardLast4); + + _FinalStage cardLast4(String cardLast4); + + _FinalStage cardLast4(Nullable cardLast4); + + /** + *

How the customer paid, such as card or paypal.

+ */ + _FinalStage paymentMethodType(Optional paymentMethodType); + + _FinalStage paymentMethodType(String paymentMethodType); + + _FinalStage paymentMethodType(Nullable paymentMethodType); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, _FinalStage { + private String createdAt; + + private String id; + + private Optional paymentMethodType = Optional.empty(); + + private Optional cardLast4 = Optional.empty(); + + private Optional cardBrand = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ResolutionPayment other) { + cardBrand(other.getCardBrand()); + cardLast4(other.getCardLast4()); + createdAt(other.getCreatedAt()); + id(other.getId()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

When the payment was made, as an ISO 8601 timestamp.

+ *

When the payment was made, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Payment ID, prefixed pay_.

+ *

Payment ID, prefixed pay_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

How the customer paid, such as card or paypal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(Nullable paymentMethodType) { + if (paymentMethodType.isNull()) { + this.paymentMethodType = null; + } else if (paymentMethodType.isEmpty()) { + this.paymentMethodType = Optional.empty(); + } else { + this.paymentMethodType = Optional.of(paymentMethodType.get()); + } + return this; + } + + /** + *

How the customer paid, such as card or paypal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethodType(String paymentMethodType) { + this.paymentMethodType = Optional.ofNullable(paymentMethodType); + return this; + } + + /** + *

How the customer paid, such as card or paypal.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method_type", nulls = Nulls.SKIP) + public _FinalStage paymentMethodType(Optional paymentMethodType) { + this.paymentMethodType = paymentMethodType; + return this; + } + + /** + *

Last four digits of the card, when the customer paid by card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardLast4(Nullable cardLast4) { + if (cardLast4.isNull()) { + this.cardLast4 = null; + } else if (cardLast4.isEmpty()) { + this.cardLast4 = Optional.empty(); + } else { + this.cardLast4 = Optional.of(cardLast4.get()); + } + return this; + } + + /** + *

Last four digits of the card, when the customer paid by card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardLast4(String cardLast4) { + this.cardLast4 = Optional.ofNullable(cardLast4); + return this; + } + + /** + *

Last four digits of the card, when the customer paid by card.

+ */ + @java.lang.Override + @JsonSetter(value = "card_last4", nulls = Nulls.SKIP) + public _FinalStage cardLast4(Optional cardLast4) { + this.cardLast4 = cardLast4; + return this; + } + + /** + *

Card brand, when the customer paid by card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(Nullable cardBrand) { + if (cardBrand.isNull()) { + this.cardBrand = null; + } else if (cardBrand.isEmpty()) { + this.cardBrand = Optional.empty(); + } else { + this.cardBrand = Optional.of(cardBrand.get()); + } + return this; + } + + /** + *

Card brand, when the customer paid by card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cardBrand(String cardBrand) { + this.cardBrand = Optional.ofNullable(cardBrand); + return this; + } + + /** + *

Card brand, when the customer paid by card.

+ */ + @java.lang.Override + @JsonSetter(value = "card_brand", nulls = Nulls.SKIP) + public _FinalStage cardBrand(Optional cardBrand) { + this.cardBrand = cardBrand; + return this; + } + + @java.lang.Override + public ResolutionPayment build() { + return new ResolutionPayment(cardBrand, cardLast4, createdAt, id, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ResultLabelKeys.java b/src/main/java/com/whop/api/types/ResultLabelKeys.java new file mode 100644 index 00000000..c5d36546 --- /dev/null +++ b/src/main/java/com/whop/api/types/ResultLabelKeys.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ResultLabelKeys { + public static final ResultLabelKeys CONTENT_VIEWS = new ResultLabelKeys(Value.CONTENT_VIEWS, "content_views"); + + public static final ResultLabelKeys WEBSITE_SUBMIT_APPLICATIONS = + new ResultLabelKeys(Value.WEBSITE_SUBMIT_APPLICATIONS, "website_submit_applications"); + + public static final ResultLabelKeys PAGE_LIKES = new ResultLabelKeys(Value.PAGE_LIKES, "page_likes"); + + public static final ResultLabelKeys EVENT_RESPONSES = new ResultLabelKeys(Value.EVENT_RESPONSES, "event_responses"); + + public static final ResultLabelKeys WEBSITE_CONTACTS = + new ResultLabelKeys(Value.WEBSITE_CONTACTS, "website_contacts"); + + public static final ResultLabelKeys VIDEO_VIEWS = new ResultLabelKeys(Value.VIDEO_VIEWS, "video_views"); + + public static final ResultLabelKeys REACH = new ResultLabelKeys(Value.REACH, "reach"); + + public static final ResultLabelKeys LANDING_PAGE_VIEWS = + new ResultLabelKeys(Value.LANDING_PAGE_VIEWS, "landing_page_views"); + + public static final ResultLabelKeys WEBSITE_PURCHASES = + new ResultLabelKeys(Value.WEBSITE_PURCHASES, "website_purchases"); + + public static final ResultLabelKeys QUALITY_CALLS = new ResultLabelKeys(Value.QUALITY_CALLS, "quality_calls"); + + public static final ResultLabelKeys APP_INSTALLS = new ResultLabelKeys(Value.APP_INSTALLS, "app_installs"); + + public static final ResultLabelKeys REGISTRATIONS = new ResultLabelKeys(Value.REGISTRATIONS, "registrations"); + + public static final ResultLabelKeys ADDS_TO_WISHLIST = + new ResultLabelKeys(Value.ADDS_TO_WISHLIST, "adds_to_wishlist"); + + public static final ResultLabelKeys WEBSITE_FIND_LOCATIONS = + new ResultLabelKeys(Value.WEBSITE_FIND_LOCATIONS, "website_find_locations"); + + public static final ResultLabelKeys POST_ENGAGEMENT = new ResultLabelKeys(Value.POST_ENGAGEMENT, "post_engagement"); + + public static final ResultLabelKeys INSTAGRAM_PROFILE_VISITS = + new ResultLabelKeys(Value.INSTAGRAM_PROFILE_VISITS, "instagram_profile_visits"); + + public static final ResultLabelKeys LEADS = new ResultLabelKeys(Value.LEADS, "leads"); + + public static final ResultLabelKeys CHECKOUTS_INITIATED = + new ResultLabelKeys(Value.CHECKOUTS_INITIATED, "checkouts_initiated"); + + public static final ResultLabelKeys NEW_SUBSCRIBERS = new ResultLabelKeys(Value.NEW_SUBSCRIBERS, "new_subscribers"); + + public static final ResultLabelKeys WEBSITE_TRIALS_STARTED = + new ResultLabelKeys(Value.WEBSITE_TRIALS_STARTED, "website_trials_started"); + + public static final ResultLabelKeys SEARCHES = new ResultLabelKeys(Value.SEARCHES, "searches"); + + public static final ResultLabelKeys LINK_CLICKS = new ResultLabelKeys(Value.LINK_CLICKS, "link_clicks"); + + public static final ResultLabelKeys WEBSITE_SUBSCRIPTIONS = + new ResultLabelKeys(Value.WEBSITE_SUBSCRIPTIONS, "website_subscriptions"); + + public static final ResultLabelKeys MESSAGING_CONVERSATIONS_STARTED = + new ResultLabelKeys(Value.MESSAGING_CONVERSATIONS_STARTED, "messaging_conversations_started"); + + public static final ResultLabelKeys WEBSITE_DONATIONS = + new ResultLabelKeys(Value.WEBSITE_DONATIONS, "website_donations"); + + public static final ResultLabelKeys ADDS_TO_CART = new ResultLabelKeys(Value.ADDS_TO_CART, "adds_to_cart"); + + public static final ResultLabelKeys WEBSITE_PRODUCT_CUSTOMIZATIONS = + new ResultLabelKeys(Value.WEBSITE_PRODUCT_CUSTOMIZATIONS, "website_product_customizations"); + + public static final ResultLabelKeys REMINDERS_SET = new ResultLabelKeys(Value.REMINDERS_SET, "reminders_set"); + + public static final ResultLabelKeys WEBSITE_SCHEDULES = + new ResultLabelKeys(Value.WEBSITE_SCHEDULES, "website_schedules"); + + public static final ResultLabelKeys CUSTOM = new ResultLabelKeys(Value.CUSTOM, "custom"); + + public static final ResultLabelKeys APPOINTMENTS_BOOKED = + new ResultLabelKeys(Value.APPOINTMENTS_BOOKED, "appointments_booked"); + + public static final ResultLabelKeys ADDS_OF_PAYMENT_INFO = + new ResultLabelKeys(Value.ADDS_OF_PAYMENT_INFO, "adds_of_payment_info"); + + public static final ResultLabelKeys MESSAGING_PURCHASES = + new ResultLabelKeys(Value.MESSAGING_PURCHASES, "messaging_purchases"); + + public static final ResultLabelKeys IMPRESSIONS = new ResultLabelKeys(Value.IMPRESSIONS, "impressions"); + + private final Value value; + + private final String string; + + ResultLabelKeys(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ResultLabelKeys && this.string.equals(((ResultLabelKeys) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CONTENT_VIEWS: + return visitor.visitContentViews(); + case WEBSITE_SUBMIT_APPLICATIONS: + return visitor.visitWebsiteSubmitApplications(); + case PAGE_LIKES: + return visitor.visitPageLikes(); + case EVENT_RESPONSES: + return visitor.visitEventResponses(); + case WEBSITE_CONTACTS: + return visitor.visitWebsiteContacts(); + case VIDEO_VIEWS: + return visitor.visitVideoViews(); + case REACH: + return visitor.visitReach(); + case LANDING_PAGE_VIEWS: + return visitor.visitLandingPageViews(); + case WEBSITE_PURCHASES: + return visitor.visitWebsitePurchases(); + case QUALITY_CALLS: + return visitor.visitQualityCalls(); + case APP_INSTALLS: + return visitor.visitAppInstalls(); + case REGISTRATIONS: + return visitor.visitRegistrations(); + case ADDS_TO_WISHLIST: + return visitor.visitAddsToWishlist(); + case WEBSITE_FIND_LOCATIONS: + return visitor.visitWebsiteFindLocations(); + case POST_ENGAGEMENT: + return visitor.visitPostEngagement(); + case INSTAGRAM_PROFILE_VISITS: + return visitor.visitInstagramProfileVisits(); + case LEADS: + return visitor.visitLeads(); + case CHECKOUTS_INITIATED: + return visitor.visitCheckoutsInitiated(); + case NEW_SUBSCRIBERS: + return visitor.visitNewSubscribers(); + case WEBSITE_TRIALS_STARTED: + return visitor.visitWebsiteTrialsStarted(); + case SEARCHES: + return visitor.visitSearches(); + case LINK_CLICKS: + return visitor.visitLinkClicks(); + case WEBSITE_SUBSCRIPTIONS: + return visitor.visitWebsiteSubscriptions(); + case MESSAGING_CONVERSATIONS_STARTED: + return visitor.visitMessagingConversationsStarted(); + case WEBSITE_DONATIONS: + return visitor.visitWebsiteDonations(); + case ADDS_TO_CART: + return visitor.visitAddsToCart(); + case WEBSITE_PRODUCT_CUSTOMIZATIONS: + return visitor.visitWebsiteProductCustomizations(); + case REMINDERS_SET: + return visitor.visitRemindersSet(); + case WEBSITE_SCHEDULES: + return visitor.visitWebsiteSchedules(); + case CUSTOM: + return visitor.visitCustom(); + case APPOINTMENTS_BOOKED: + return visitor.visitAppointmentsBooked(); + case ADDS_OF_PAYMENT_INFO: + return visitor.visitAddsOfPaymentInfo(); + case MESSAGING_PURCHASES: + return visitor.visitMessagingPurchases(); + case IMPRESSIONS: + return visitor.visitImpressions(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ResultLabelKeys valueOf(String value) { + switch (value) { + case "content_views": + return CONTENT_VIEWS; + case "website_submit_applications": + return WEBSITE_SUBMIT_APPLICATIONS; + case "page_likes": + return PAGE_LIKES; + case "event_responses": + return EVENT_RESPONSES; + case "website_contacts": + return WEBSITE_CONTACTS; + case "video_views": + return VIDEO_VIEWS; + case "reach": + return REACH; + case "landing_page_views": + return LANDING_PAGE_VIEWS; + case "website_purchases": + return WEBSITE_PURCHASES; + case "quality_calls": + return QUALITY_CALLS; + case "app_installs": + return APP_INSTALLS; + case "registrations": + return REGISTRATIONS; + case "adds_to_wishlist": + return ADDS_TO_WISHLIST; + case "website_find_locations": + return WEBSITE_FIND_LOCATIONS; + case "post_engagement": + return POST_ENGAGEMENT; + case "instagram_profile_visits": + return INSTAGRAM_PROFILE_VISITS; + case "leads": + return LEADS; + case "checkouts_initiated": + return CHECKOUTS_INITIATED; + case "new_subscribers": + return NEW_SUBSCRIBERS; + case "website_trials_started": + return WEBSITE_TRIALS_STARTED; + case "searches": + return SEARCHES; + case "link_clicks": + return LINK_CLICKS; + case "website_subscriptions": + return WEBSITE_SUBSCRIPTIONS; + case "messaging_conversations_started": + return MESSAGING_CONVERSATIONS_STARTED; + case "website_donations": + return WEBSITE_DONATIONS; + case "adds_to_cart": + return ADDS_TO_CART; + case "website_product_customizations": + return WEBSITE_PRODUCT_CUSTOMIZATIONS; + case "reminders_set": + return REMINDERS_SET; + case "website_schedules": + return WEBSITE_SCHEDULES; + case "custom": + return CUSTOM; + case "appointments_booked": + return APPOINTMENTS_BOOKED; + case "adds_of_payment_info": + return ADDS_OF_PAYMENT_INFO; + case "messaging_purchases": + return MESSAGING_PURCHASES; + case "impressions": + return IMPRESSIONS; + default: + return new ResultLabelKeys(Value.UNKNOWN, value); + } + } + + public enum Value { + APP_INSTALLS, + + MESSAGING_CONVERSATIONS_STARTED, + + POST_ENGAGEMENT, + + EVENT_RESPONSES, + + IMPRESSIONS, + + WEBSITE_PURCHASES, + + LANDING_PAGE_VIEWS, + + LEADS, + + LINK_CLICKS, + + QUALITY_CALLS, + + APPOINTMENTS_BOOKED, + + MESSAGING_PURCHASES, + + PAGE_LIKES, + + INSTAGRAM_PROFILE_VISITS, + + REACH, + + REMINDERS_SET, + + NEW_SUBSCRIBERS, + + VIDEO_VIEWS, + + REGISTRATIONS, + + CONTENT_VIEWS, + + SEARCHES, + + ADDS_TO_CART, + + ADDS_TO_WISHLIST, + + ADDS_OF_PAYMENT_INFO, + + CHECKOUTS_INITIATED, + + WEBSITE_SCHEDULES, + + WEBSITE_SUBMIT_APPLICATIONS, + + WEBSITE_TRIALS_STARTED, + + WEBSITE_SUBSCRIPTIONS, + + WEBSITE_CONTACTS, + + WEBSITE_DONATIONS, + + WEBSITE_FIND_LOCATIONS, + + WEBSITE_PRODUCT_CUSTOMIZATIONS, + + CUSTOM, + + UNKNOWN + } + + public interface Visitor { + T visitAppInstalls(); + + T visitMessagingConversationsStarted(); + + T visitPostEngagement(); + + T visitEventResponses(); + + T visitImpressions(); + + T visitWebsitePurchases(); + + T visitLandingPageViews(); + + T visitLeads(); + + T visitLinkClicks(); + + T visitQualityCalls(); + + T visitAppointmentsBooked(); + + T visitMessagingPurchases(); + + T visitPageLikes(); + + T visitInstagramProfileVisits(); + + T visitReach(); + + T visitRemindersSet(); + + T visitNewSubscribers(); + + T visitVideoViews(); + + T visitRegistrations(); + + T visitContentViews(); + + T visitSearches(); + + T visitAddsToCart(); + + T visitAddsToWishlist(); + + T visitAddsOfPaymentInfo(); + + T visitCheckoutsInitiated(); + + T visitWebsiteSchedules(); + + T visitWebsiteSubmitApplications(); + + T visitWebsiteTrialsStarted(); + + T visitWebsiteSubscriptions(); + + T visitWebsiteContacts(); + + T visitWebsiteDonations(); + + T visitWebsiteFindLocations(); + + T visitWebsiteProductCustomizations(); + + T visitCustom(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Review.java b/src/main/java/com/whop/api/types/Review.java new file mode 100644 index 00000000..4cafddf5 --- /dev/null +++ b/src/main/java/com/whop/api/types/Review.java @@ -0,0 +1,832 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Review.Builder.class) +public final class Review { + private final List attachments; + + private final ReviewCompany company; + + private final OffsetDateTime createdAt; + + private final Optional description; + + private final String id; + + private final Optional joinedAt; + + private final Optional paidForProduct; + + private final ReviewProduct product; + + private final Optional publishedAt; + + private final int stars; + + private final ReviewStatus status; + + private final Optional title; + + private final OffsetDateTime updatedAt; + + private final ReviewUser user; + + private final Map additionalProperties; + + private Review( + List attachments, + ReviewCompany company, + OffsetDateTime createdAt, + Optional description, + String id, + Optional joinedAt, + Optional paidForProduct, + ReviewProduct product, + Optional publishedAt, + int stars, + ReviewStatus status, + Optional title, + OffsetDateTime updatedAt, + ReviewUser user, + Map additionalProperties) { + this.attachments = attachments; + this.company = company; + this.createdAt = createdAt; + this.description = description; + this.id = id; + this.joinedAt = joinedAt; + this.paidForProduct = paidForProduct; + this.product = product; + this.publishedAt = publishedAt; + this.stars = stars; + this.status = status; + this.title = title; + this.updatedAt = updatedAt; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of files and media attached to the review. + */ + @JsonProperty("attachments") + public List getAttachments() { + return attachments; + } + + /** + * @return The company that this review was written for. + */ + @JsonProperty("company") + public ReviewCompany getCompany() { + return company; + } + + /** + * @return The datetime the review was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The body text of the review containing the user's detailed feedback. Returns an empty string if no description was provided. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The unique identifier for the review. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The timestamp of when the reviewer first joined the product. Null if unknown. + */ + @JsonIgnore + public Optional getJoinedAt() { + if (joinedAt == null) { + return Optional.empty(); + } + return joinedAt; + } + + /** + * @return Whether the reviewer paid for the product. Null if the payment status is unknown. + */ + @JsonIgnore + public Optional getPaidForProduct() { + if (paidForProduct == null) { + return Optional.empty(); + } + return paidForProduct; + } + + /** + * @return The product that this review was written for. + */ + @JsonProperty("product") + public ReviewProduct getProduct() { + return product; + } + + /** + * @return The timestamp of when the review was published. Null if the review has not been published yet. + */ + @JsonIgnore + public Optional getPublishedAt() { + if (publishedAt == null) { + return Optional.empty(); + } + return publishedAt; + } + + /** + * @return The star rating given by the reviewer, from 1 to 5. + */ + @JsonProperty("stars") + public int getStars() { + return stars; + } + + /** + * @return The current moderation status of the review. + */ + @JsonProperty("status") + public ReviewStatus getStatus() { + return status; + } + + /** + * @return A short summary title for the review. Null if the reviewer did not provide one. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The datetime the review was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user account of the person who wrote this review. + */ + @JsonProperty("user") + public ReviewUser getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("joined_at") + private Optional _getJoinedAt() { + return joinedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("paid_for_product") + private Optional _getPaidForProduct() { + return paidForProduct; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("published_at") + private Optional _getPublishedAt() { + return publishedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Review && equalTo((Review) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Review other) { + return attachments.equals(other.attachments) + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && description.equals(other.description) + && id.equals(other.id) + && joinedAt.equals(other.joinedAt) + && paidForProduct.equals(other.paidForProduct) + && product.equals(other.product) + && publishedAt.equals(other.publishedAt) + && stars == other.stars + && status.equals(other.status) + && title.equals(other.title) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.attachments, + this.company, + this.createdAt, + this.description, + this.id, + this.joinedAt, + this.paidForProduct, + this.product, + this.publishedAt, + this.stars, + this.status, + this.title, + this.updatedAt, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyStage builder() { + return new Builder(); + } + + public interface CompanyStage { + /** + *

The company that this review was written for.

+ */ + CreatedAtStage company(@NotNull ReviewCompany company); + + Builder from(Review other); + } + + public interface CreatedAtStage { + /** + *

The datetime the review was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + /** + *

The unique identifier for the review.

+ */ + ProductStage id(@NotNull String id); + } + + public interface ProductStage { + /** + *

The product that this review was written for.

+ */ + StarsStage product(@NotNull ReviewProduct product); + } + + public interface StarsStage { + /** + *

The star rating given by the reviewer, from 1 to 5.

+ */ + StatusStage stars(int stars); + } + + public interface StatusStage { + /** + *

The current moderation status of the review.

+ */ + UpdatedAtStage status(@NotNull ReviewStatus status); + } + + public interface UpdatedAtStage { + /** + *

The datetime the review was last updated.

+ */ + UserStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UserStage { + /** + *

The user account of the person who wrote this review.

+ */ + _FinalStage user(@NotNull ReviewUser user); + } + + public interface _FinalStage { + Review build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of files and media attached to the review.

+ */ + _FinalStage attachments(List attachments); + + _FinalStage addAttachments(ReviewAttachmentsItem attachments); + + _FinalStage addAllAttachments(List attachments); + + /** + *

The body text of the review containing the user's detailed feedback. Returns an empty string if no description was provided.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

The timestamp of when the reviewer first joined the product. Null if unknown.

+ */ + _FinalStage joinedAt(Optional joinedAt); + + _FinalStage joinedAt(OffsetDateTime joinedAt); + + _FinalStage joinedAt(Nullable joinedAt); + + /** + *

Whether the reviewer paid for the product. Null if the payment status is unknown.

+ */ + _FinalStage paidForProduct(Optional paidForProduct); + + _FinalStage paidForProduct(Boolean paidForProduct); + + _FinalStage paidForProduct(Nullable paidForProduct); + + /** + *

The timestamp of when the review was published. Null if the review has not been published yet.

+ */ + _FinalStage publishedAt(Optional publishedAt); + + _FinalStage publishedAt(OffsetDateTime publishedAt); + + _FinalStage publishedAt(Nullable publishedAt); + + /** + *

A short summary title for the review. Null if the reviewer did not provide one.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CompanyStage, + CreatedAtStage, + IdStage, + ProductStage, + StarsStage, + StatusStage, + UpdatedAtStage, + UserStage, + _FinalStage { + private ReviewCompany company; + + private OffsetDateTime createdAt; + + private String id; + + private ReviewProduct product; + + private int stars; + + private ReviewStatus status; + + private OffsetDateTime updatedAt; + + private ReviewUser user; + + private Optional title = Optional.empty(); + + private Optional publishedAt = Optional.empty(); + + private Optional paidForProduct = Optional.empty(); + + private Optional joinedAt = Optional.empty(); + + private Optional description = Optional.empty(); + + private List attachments = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Review other) { + attachments(other.getAttachments()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + description(other.getDescription()); + id(other.getId()); + joinedAt(other.getJoinedAt()); + paidForProduct(other.getPaidForProduct()); + product(other.getProduct()); + publishedAt(other.getPublishedAt()); + stars(other.getStars()); + status(other.getStatus()); + title(other.getTitle()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + return this; + } + + /** + *

The company that this review was written for.

+ *

The company that this review was written for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company") + public CreatedAtStage company(@NotNull ReviewCompany company) { + this.company = Objects.requireNonNull(company, "company must not be null"); + return this; + } + + /** + *

The datetime the review was created.

+ *

The datetime the review was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the review.

+ *

The unique identifier for the review.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ProductStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The product that this review was written for.

+ *

The product that this review was written for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("product") + public StarsStage product(@NotNull ReviewProduct product) { + this.product = Objects.requireNonNull(product, "product must not be null"); + return this; + } + + /** + *

The star rating given by the reviewer, from 1 to 5.

+ *

The star rating given by the reviewer, from 1 to 5.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("stars") + public StatusStage stars(int stars) { + this.stars = stars; + return this; + } + + /** + *

The current moderation status of the review.

+ *

The current moderation status of the review.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull ReviewStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The datetime the review was last updated.

+ *

The datetime the review was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UserStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user account of the person who wrote this review.

+ *

The user account of the person who wrote this review.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull ReviewUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

A short summary title for the review. Null if the reviewer did not provide one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

A short summary title for the review. Null if the reviewer did not provide one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

A short summary title for the review. Null if the reviewer did not provide one.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

The timestamp of when the review was published. Null if the review has not been published yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage publishedAt(Nullable publishedAt) { + if (publishedAt.isNull()) { + this.publishedAt = null; + } else if (publishedAt.isEmpty()) { + this.publishedAt = Optional.empty(); + } else { + this.publishedAt = Optional.of(publishedAt.get()); + } + return this; + } + + /** + *

The timestamp of when the review was published. Null if the review has not been published yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage publishedAt(OffsetDateTime publishedAt) { + this.publishedAt = Optional.ofNullable(publishedAt); + return this; + } + + /** + *

The timestamp of when the review was published. Null if the review has not been published yet.

+ */ + @java.lang.Override + @JsonSetter(value = "published_at", nulls = Nulls.SKIP) + public _FinalStage publishedAt(Optional publishedAt) { + this.publishedAt = publishedAt; + return this; + } + + /** + *

Whether the reviewer paid for the product. Null if the payment status is unknown.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidForProduct(Nullable paidForProduct) { + if (paidForProduct.isNull()) { + this.paidForProduct = null; + } else if (paidForProduct.isEmpty()) { + this.paidForProduct = Optional.empty(); + } else { + this.paidForProduct = Optional.of(paidForProduct.get()); + } + return this; + } + + /** + *

Whether the reviewer paid for the product. Null if the payment status is unknown.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidForProduct(Boolean paidForProduct) { + this.paidForProduct = Optional.ofNullable(paidForProduct); + return this; + } + + /** + *

Whether the reviewer paid for the product. Null if the payment status is unknown.

+ */ + @java.lang.Override + @JsonSetter(value = "paid_for_product", nulls = Nulls.SKIP) + public _FinalStage paidForProduct(Optional paidForProduct) { + this.paidForProduct = paidForProduct; + return this; + } + + /** + *

The timestamp of when the reviewer first joined the product. Null if unknown.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage joinedAt(Nullable joinedAt) { + if (joinedAt.isNull()) { + this.joinedAt = null; + } else if (joinedAt.isEmpty()) { + this.joinedAt = Optional.empty(); + } else { + this.joinedAt = Optional.of(joinedAt.get()); + } + return this; + } + + /** + *

The timestamp of when the reviewer first joined the product. Null if unknown.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage joinedAt(OffsetDateTime joinedAt) { + this.joinedAt = Optional.ofNullable(joinedAt); + return this; + } + + /** + *

The timestamp of when the reviewer first joined the product. Null if unknown.

+ */ + @java.lang.Override + @JsonSetter(value = "joined_at", nulls = Nulls.SKIP) + public _FinalStage joinedAt(Optional joinedAt) { + this.joinedAt = joinedAt; + return this; + } + + /** + *

The body text of the review containing the user's detailed feedback. Returns an empty string if no description was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

The body text of the review containing the user's detailed feedback. Returns an empty string if no description was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

The body text of the review containing the user's detailed feedback. Returns an empty string if no description was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

A list of files and media attached to the review.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllAttachments(List attachments) { + if (attachments != null) { + this.attachments.addAll(attachments); + } + return this; + } + + /** + *

A list of files and media attached to the review.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAttachments(ReviewAttachmentsItem attachments) { + this.attachments.add(attachments); + return this; + } + + /** + *

A list of files and media attached to the review.

+ */ + @java.lang.Override + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public _FinalStage attachments(List attachments) { + this.attachments.clear(); + if (attachments != null) { + this.attachments.addAll(attachments); + } + return this; + } + + @java.lang.Override + public Review build() { + return new Review( + attachments, + company, + createdAt, + description, + id, + joinedAt, + paidForProduct, + product, + publishedAt, + stars, + status, + title, + updatedAt, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ReviewAttachmentsItem.java b/src/main/java/com/whop/api/types/ReviewAttachmentsItem.java new file mode 100644 index 00000000..6b3f127a --- /dev/null +++ b/src/main/java/com/whop/api/types/ReviewAttachmentsItem.java @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReviewAttachmentsItem.Builder.class) +public final class ReviewAttachmentsItem { + private final Optional contentType; + + private final Optional filename; + + private final String id; + + private final Optional url; + + private final Map additionalProperties; + + private ReviewAttachmentsItem( + Optional contentType, + Optional filename, + String id, + Optional url, + Map additionalProperties) { + this.contentType = contentType; + this.filename = filename; + this.id = id; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg. + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return The original filename of the uploaded attachment, including its file extension. + */ + @JsonIgnore + public Optional getFilename() { + if (filename == null) { + return Optional.empty(); + } + return filename; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filename") + private Optional _getFilename() { + return filename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReviewAttachmentsItem && equalTo((ReviewAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReviewAttachmentsItem other) { + return contentType.equals(other.contentType) + && filename.equals(other.filename) + && id.equals(other.id) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contentType, this.filename, this.id, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(ReviewAttachmentsItem other); + } + + public interface _FinalStage { + ReviewAttachmentsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + _FinalStage filename(Optional filename); + + _FinalStage filename(String filename); + + _FinalStage filename(Nullable filename); + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional url = Optional.empty(); + + private Optional filename = Optional.empty(); + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReviewAttachmentsItem other) { + contentType(other.getContentType()); + filename(other.getFilename()); + id(other.getId()); + url(other.getUrl()); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(Nullable filename) { + if (filename.isNull()) { + this.filename = null; + } else if (filename.isEmpty()) { + this.filename = Optional.empty(); + } else { + this.filename = Optional.of(filename.get()); + } + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(String filename) { + this.filename = Optional.ofNullable(filename); + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + @java.lang.Override + @JsonSetter(value = "filename", nulls = Nulls.SKIP) + public _FinalStage filename(Optional filename) { + this.filename = filename; + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public ReviewAttachmentsItem build() { + return new ReviewAttachmentsItem(contentType, filename, id, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ReviewCompany.java b/src/main/java/com/whop/api/types/ReviewCompany.java new file mode 100644 index 00000000..1660728c --- /dev/null +++ b/src/main/java/com/whop/api/types/ReviewCompany.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReviewCompany.Builder.class) +public final class ReviewCompany { + private final String id; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private ReviewCompany(String id, String route, String title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReviewCompany && equalTo((ReviewCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReviewCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + RouteStage id(@NotNull String id); + + Builder from(ReviewCompany other); + } + + public interface RouteStage { + /** + *

URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + ReviewCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReviewCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe.

+ *

URL slug for the account's store page, e.g. pickaxe in whop.com/pickaxe.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public ReviewCompany build() { + return new ReviewCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ReviewListItem.java b/src/main/java/com/whop/api/types/ReviewListItem.java new file mode 100644 index 00000000..54ed075e --- /dev/null +++ b/src/main/java/com/whop/api/types/ReviewListItem.java @@ -0,0 +1,750 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReviewListItem.Builder.class) +public final class ReviewListItem { + private final List attachments; + + private final OffsetDateTime createdAt; + + private final Optional description; + + private final String id; + + private final Optional joinedAt; + + private final Optional paidForProduct; + + private final Optional publishedAt; + + private final int stars; + + private final ReviewStatus status; + + private final Optional title; + + private final OffsetDateTime updatedAt; + + private final ReviewListItemUser user; + + private final Map additionalProperties; + + private ReviewListItem( + List attachments, + OffsetDateTime createdAt, + Optional description, + String id, + Optional joinedAt, + Optional paidForProduct, + Optional publishedAt, + int stars, + ReviewStatus status, + Optional title, + OffsetDateTime updatedAt, + ReviewListItemUser user, + Map additionalProperties) { + this.attachments = attachments; + this.createdAt = createdAt; + this.description = description; + this.id = id; + this.joinedAt = joinedAt; + this.paidForProduct = paidForProduct; + this.publishedAt = publishedAt; + this.stars = stars; + this.status = status; + this.title = title; + this.updatedAt = updatedAt; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return A list of files and media attached to the review. + */ + @JsonProperty("attachments") + public List getAttachments() { + return attachments; + } + + /** + * @return The datetime the review was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The body text of the review containing the user's detailed feedback. Returns an empty string if no description was provided. + */ + @JsonIgnore + public Optional getDescription() { + if (description == null) { + return Optional.empty(); + } + return description; + } + + /** + * @return The unique identifier for the review. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The timestamp of when the reviewer first joined the product. Null if unknown. + */ + @JsonIgnore + public Optional getJoinedAt() { + if (joinedAt == null) { + return Optional.empty(); + } + return joinedAt; + } + + /** + * @return Whether the reviewer paid for the product. Null if the payment status is unknown. + */ + @JsonIgnore + public Optional getPaidForProduct() { + if (paidForProduct == null) { + return Optional.empty(); + } + return paidForProduct; + } + + /** + * @return The timestamp of when the review was published. Null if the review has not been published yet. + */ + @JsonIgnore + public Optional getPublishedAt() { + if (publishedAt == null) { + return Optional.empty(); + } + return publishedAt; + } + + /** + * @return The star rating given by the reviewer, from 1 to 5. + */ + @JsonProperty("stars") + public int getStars() { + return stars; + } + + /** + * @return The current moderation status of the review. + */ + @JsonProperty("status") + public ReviewStatus getStatus() { + return status; + } + + /** + * @return A short summary title for the review. Null if the reviewer did not provide one. + */ + @JsonIgnore + public Optional getTitle() { + if (title == null) { + return Optional.empty(); + } + return title; + } + + /** + * @return The datetime the review was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user account of the person who wrote this review. + */ + @JsonProperty("user") + public ReviewListItemUser getUser() { + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("description") + private Optional _getDescription() { + return description; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("joined_at") + private Optional _getJoinedAt() { + return joinedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("paid_for_product") + private Optional _getPaidForProduct() { + return paidForProduct; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("published_at") + private Optional _getPublishedAt() { + return publishedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("title") + private Optional _getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReviewListItem && equalTo((ReviewListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReviewListItem other) { + return attachments.equals(other.attachments) + && createdAt.equals(other.createdAt) + && description.equals(other.description) + && id.equals(other.id) + && joinedAt.equals(other.joinedAt) + && paidForProduct.equals(other.paidForProduct) + && publishedAt.equals(other.publishedAt) + && stars == other.stars + && status.equals(other.status) + && title.equals(other.title) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.attachments, + this.createdAt, + this.description, + this.id, + this.joinedAt, + this.paidForProduct, + this.publishedAt, + this.stars, + this.status, + this.title, + this.updatedAt, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the review was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(ReviewListItem other); + } + + public interface IdStage { + /** + *

The unique identifier for the review.

+ */ + StarsStage id(@NotNull String id); + } + + public interface StarsStage { + /** + *

The star rating given by the reviewer, from 1 to 5.

+ */ + StatusStage stars(int stars); + } + + public interface StatusStage { + /** + *

The current moderation status of the review.

+ */ + UpdatedAtStage status(@NotNull ReviewStatus status); + } + + public interface UpdatedAtStage { + /** + *

The datetime the review was last updated.

+ */ + UserStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UserStage { + /** + *

The user account of the person who wrote this review.

+ */ + _FinalStage user(@NotNull ReviewListItemUser user); + } + + public interface _FinalStage { + ReviewListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A list of files and media attached to the review.

+ */ + _FinalStage attachments(List attachments); + + _FinalStage addAttachments(ReviewListItemAttachmentsItem attachments); + + _FinalStage addAllAttachments(List attachments); + + /** + *

The body text of the review containing the user's detailed feedback. Returns an empty string if no description was provided.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage description(Nullable description); + + /** + *

The timestamp of when the reviewer first joined the product. Null if unknown.

+ */ + _FinalStage joinedAt(Optional joinedAt); + + _FinalStage joinedAt(OffsetDateTime joinedAt); + + _FinalStage joinedAt(Nullable joinedAt); + + /** + *

Whether the reviewer paid for the product. Null if the payment status is unknown.

+ */ + _FinalStage paidForProduct(Optional paidForProduct); + + _FinalStage paidForProduct(Boolean paidForProduct); + + _FinalStage paidForProduct(Nullable paidForProduct); + + /** + *

The timestamp of when the review was published. Null if the review has not been published yet.

+ */ + _FinalStage publishedAt(Optional publishedAt); + + _FinalStage publishedAt(OffsetDateTime publishedAt); + + _FinalStage publishedAt(Nullable publishedAt); + + /** + *

A short summary title for the review. Null if the reviewer did not provide one.

+ */ + _FinalStage title(Optional title); + + _FinalStage title(String title); + + _FinalStage title(Nullable title); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IdStage, StarsStage, StatusStage, UpdatedAtStage, UserStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private int stars; + + private ReviewStatus status; + + private OffsetDateTime updatedAt; + + private ReviewListItemUser user; + + private Optional title = Optional.empty(); + + private Optional publishedAt = Optional.empty(); + + private Optional paidForProduct = Optional.empty(); + + private Optional joinedAt = Optional.empty(); + + private Optional description = Optional.empty(); + + private List attachments = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReviewListItem other) { + attachments(other.getAttachments()); + createdAt(other.getCreatedAt()); + description(other.getDescription()); + id(other.getId()); + joinedAt(other.getJoinedAt()); + paidForProduct(other.getPaidForProduct()); + publishedAt(other.getPublishedAt()); + stars(other.getStars()); + status(other.getStatus()); + title(other.getTitle()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + return this; + } + + /** + *

The datetime the review was created.

+ *

The datetime the review was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the review.

+ *

The unique identifier for the review.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StarsStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The star rating given by the reviewer, from 1 to 5.

+ *

The star rating given by the reviewer, from 1 to 5.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("stars") + public StatusStage stars(int stars) { + this.stars = stars; + return this; + } + + /** + *

The current moderation status of the review.

+ *

The current moderation status of the review.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull ReviewStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The datetime the review was last updated.

+ *

The datetime the review was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public UserStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user account of the person who wrote this review.

+ *

The user account of the person who wrote this review.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("user") + public _FinalStage user(@NotNull ReviewListItemUser user) { + this.user = Objects.requireNonNull(user, "user must not be null"); + return this; + } + + /** + *

A short summary title for the review. Null if the reviewer did not provide one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(Nullable title) { + if (title.isNull()) { + this.title = null; + } else if (title.isEmpty()) { + this.title = Optional.empty(); + } else { + this.title = Optional.of(title.get()); + } + return this; + } + + /** + *

A short summary title for the review. Null if the reviewer did not provide one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage title(String title) { + this.title = Optional.ofNullable(title); + return this; + } + + /** + *

A short summary title for the review. Null if the reviewer did not provide one.

+ */ + @java.lang.Override + @JsonSetter(value = "title", nulls = Nulls.SKIP) + public _FinalStage title(Optional title) { + this.title = title; + return this; + } + + /** + *

The timestamp of when the review was published. Null if the review has not been published yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage publishedAt(Nullable publishedAt) { + if (publishedAt.isNull()) { + this.publishedAt = null; + } else if (publishedAt.isEmpty()) { + this.publishedAt = Optional.empty(); + } else { + this.publishedAt = Optional.of(publishedAt.get()); + } + return this; + } + + /** + *

The timestamp of when the review was published. Null if the review has not been published yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage publishedAt(OffsetDateTime publishedAt) { + this.publishedAt = Optional.ofNullable(publishedAt); + return this; + } + + /** + *

The timestamp of when the review was published. Null if the review has not been published yet.

+ */ + @java.lang.Override + @JsonSetter(value = "published_at", nulls = Nulls.SKIP) + public _FinalStage publishedAt(Optional publishedAt) { + this.publishedAt = publishedAt; + return this; + } + + /** + *

Whether the reviewer paid for the product. Null if the payment status is unknown.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidForProduct(Nullable paidForProduct) { + if (paidForProduct.isNull()) { + this.paidForProduct = null; + } else if (paidForProduct.isEmpty()) { + this.paidForProduct = Optional.empty(); + } else { + this.paidForProduct = Optional.of(paidForProduct.get()); + } + return this; + } + + /** + *

Whether the reviewer paid for the product. Null if the payment status is unknown.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidForProduct(Boolean paidForProduct) { + this.paidForProduct = Optional.ofNullable(paidForProduct); + return this; + } + + /** + *

Whether the reviewer paid for the product. Null if the payment status is unknown.

+ */ + @java.lang.Override + @JsonSetter(value = "paid_for_product", nulls = Nulls.SKIP) + public _FinalStage paidForProduct(Optional paidForProduct) { + this.paidForProduct = paidForProduct; + return this; + } + + /** + *

The timestamp of when the reviewer first joined the product. Null if unknown.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage joinedAt(Nullable joinedAt) { + if (joinedAt.isNull()) { + this.joinedAt = null; + } else if (joinedAt.isEmpty()) { + this.joinedAt = Optional.empty(); + } else { + this.joinedAt = Optional.of(joinedAt.get()); + } + return this; + } + + /** + *

The timestamp of when the reviewer first joined the product. Null if unknown.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage joinedAt(OffsetDateTime joinedAt) { + this.joinedAt = Optional.ofNullable(joinedAt); + return this; + } + + /** + *

The timestamp of when the reviewer first joined the product. Null if unknown.

+ */ + @java.lang.Override + @JsonSetter(value = "joined_at", nulls = Nulls.SKIP) + public _FinalStage joinedAt(Optional joinedAt) { + this.joinedAt = joinedAt; + return this; + } + + /** + *

The body text of the review containing the user's detailed feedback. Returns an empty string if no description was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(Nullable description) { + if (description.isNull()) { + this.description = null; + } else if (description.isEmpty()) { + this.description = Optional.empty(); + } else { + this.description = Optional.of(description.get()); + } + return this; + } + + /** + *

The body text of the review containing the user's detailed feedback. Returns an empty string if no description was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

The body text of the review containing the user's detailed feedback. Returns an empty string if no description was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

A list of files and media attached to the review.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllAttachments(List attachments) { + if (attachments != null) { + this.attachments.addAll(attachments); + } + return this; + } + + /** + *

A list of files and media attached to the review.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAttachments(ReviewListItemAttachmentsItem attachments) { + this.attachments.add(attachments); + return this; + } + + /** + *

A list of files and media attached to the review.

+ */ + @java.lang.Override + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public _FinalStage attachments(List attachments) { + this.attachments.clear(); + if (attachments != null) { + this.attachments.addAll(attachments); + } + return this; + } + + @java.lang.Override + public ReviewListItem build() { + return new ReviewListItem( + attachments, + createdAt, + description, + id, + joinedAt, + paidForProduct, + publishedAt, + stars, + status, + title, + updatedAt, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ReviewListItemAttachmentsItem.java b/src/main/java/com/whop/api/types/ReviewListItemAttachmentsItem.java new file mode 100644 index 00000000..f0801421 --- /dev/null +++ b/src/main/java/com/whop/api/types/ReviewListItemAttachmentsItem.java @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReviewListItemAttachmentsItem.Builder.class) +public final class ReviewListItemAttachmentsItem { + private final Optional contentType; + + private final Optional filename; + + private final String id; + + private final Optional url; + + private final Map additionalProperties; + + private ReviewListItemAttachmentsItem( + Optional contentType, + Optional filename, + String id, + Optional url, + Map additionalProperties) { + this.contentType = contentType; + this.filename = filename; + this.id = id; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg. + */ + @JsonIgnore + public Optional getContentType() { + if (contentType == null) { + return Optional.empty(); + } + return contentType; + } + + /** + * @return The original filename of the uploaded attachment, including its file extension. + */ + @JsonIgnore + public Optional getFilename() { + if (filename == null) { + return Optional.empty(); + } + return filename; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("content_type") + private Optional _getContentType() { + return contentType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("filename") + private Optional _getFilename() { + return filename; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReviewListItemAttachmentsItem && equalTo((ReviewListItemAttachmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReviewListItemAttachmentsItem other) { + return contentType.equals(other.contentType) + && filename.equals(other.filename) + && id.equals(other.id) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contentType, this.filename, this.id, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(ReviewListItemAttachmentsItem other); + } + + public interface _FinalStage { + ReviewListItemAttachmentsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + _FinalStage contentType(Nullable contentType); + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + _FinalStage filename(Optional filename); + + _FinalStage filename(String filename); + + _FinalStage filename(Nullable filename); + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional url = Optional.empty(); + + private Optional filename = Optional.empty(); + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReviewListItemAttachmentsItem other) { + contentType(other.getContentType()); + filename(other.getFilename()); + id(other.getId()); + url(other.getUrl()); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

A pre-optimized URL for rendering this attachment on the client. This should be used for displaying attachments in apps.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(Nullable filename) { + if (filename.isNull()) { + this.filename = null; + } else if (filename.isEmpty()) { + this.filename = Optional.empty(); + } else { + this.filename = Optional.of(filename.get()); + } + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filename(String filename) { + this.filename = Optional.ofNullable(filename); + return this; + } + + /** + *

The original filename of the uploaded attachment, including its file extension.

+ */ + @java.lang.Override + @JsonSetter(value = "filename", nulls = Nulls.SKIP) + public _FinalStage filename(Optional filename) { + this.filename = filename; + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(Nullable contentType) { + if (contentType.isNull()) { + this.contentType = null; + } else if (contentType.isEmpty()) { + this.contentType = Optional.empty(); + } else { + this.contentType = Optional.of(contentType.get()); + } + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

Uploaded file MIME type, such as image/jpeg, video/mp4, or audio/mpeg.

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public ReviewListItemAttachmentsItem build() { + return new ReviewListItemAttachmentsItem(contentType, filename, id, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ReviewListItemUser.java b/src/main/java/com/whop/api/types/ReviewListItemUser.java new file mode 100644 index 00000000..17b706d5 --- /dev/null +++ b/src/main/java/com/whop/api/types/ReviewListItemUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReviewListItemUser.Builder.class) +public final class ReviewListItemUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private ReviewListItemUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReviewListItemUser && equalTo((ReviewListItemUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReviewListItemUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(ReviewListItemUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + ReviewListItemUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReviewListItemUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ReviewListItemUser build() { + return new ReviewListItemUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ReviewProduct.java b/src/main/java/com/whop/api/types/ReviewProduct.java new file mode 100644 index 00000000..20acaf67 --- /dev/null +++ b/src/main/java/com/whop/api/types/ReviewProduct.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReviewProduct.Builder.class) +public final class ReviewProduct { + private final String id; + + private final String title; + + private final Map additionalProperties; + + private ReviewProduct(String id, String title, Map additionalProperties) { + this.id = id; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the product. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the product shown to customers on the product page and in search results. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReviewProduct && equalTo((ReviewProduct) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReviewProduct other) { + return id.equals(other.id) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the product.

+ */ + TitleStage id(@NotNull String id); + + Builder from(ReviewProduct other); + } + + public interface TitleStage { + /** + *

The display name of the product shown to customers on the product page and in search results.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + ReviewProduct build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, TitleStage, _FinalStage { + private String id; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReviewProduct other) { + id(other.getId()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the product.

+ *

The unique identifier for the product.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public TitleStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The display name of the product shown to customers on the product page and in search results.

+ *

The display name of the product shown to customers on the product page and in search results.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public ReviewProduct build() { + return new ReviewProduct(id, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ReviewStatus.java b/src/main/java/com/whop/api/types/ReviewStatus.java new file mode 100644 index 00000000..d9d25652 --- /dev/null +++ b/src/main/java/com/whop/api/types/ReviewStatus.java @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ReviewStatus { + public static final ReviewStatus PENDING = new ReviewStatus(Value.PENDING, "pending"); + + public static final ReviewStatus PUBLISHED = new ReviewStatus(Value.PUBLISHED, "published"); + + public static final ReviewStatus REMOVED = new ReviewStatus(Value.REMOVED, "removed"); + + private final Value value; + + private final String string; + + ReviewStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof ReviewStatus && this.string.equals(((ReviewStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case PUBLISHED: + return visitor.visitPublished(); + case REMOVED: + return visitor.visitRemoved(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ReviewStatus valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "published": + return PUBLISHED; + case "removed": + return REMOVED; + default: + return new ReviewStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + PUBLISHED, + + REMOVED, + + UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitPublished(); + + T visitRemoved(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ReviewUser.java b/src/main/java/com/whop/api/types/ReviewUser.java new file mode 100644 index 00000000..761dc2ae --- /dev/null +++ b/src/main/java/com/whop/api/types/ReviewUser.java @@ -0,0 +1,235 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReviewUser.Builder.class) +public final class ReviewUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private ReviewUser(String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReviewUser && equalTo((ReviewUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReviewUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(ReviewUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + ReviewUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReviewUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public ReviewUser build() { + return new ReviewUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ScheduleFrequencies.java b/src/main/java/com/whop/api/types/ScheduleFrequencies.java new file mode 100644 index 00000000..f12364eb --- /dev/null +++ b/src/main/java/com/whop/api/types/ScheduleFrequencies.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ScheduleFrequencies { + public static final ScheduleFrequencies HOURLY = new ScheduleFrequencies(Value.HOURLY, "hourly"); + + public static final ScheduleFrequencies ONCE = new ScheduleFrequencies(Value.ONCE, "once"); + + public static final ScheduleFrequencies DAILY = new ScheduleFrequencies(Value.DAILY, "daily"); + + public static final ScheduleFrequencies WEEKLY = new ScheduleFrequencies(Value.WEEKLY, "weekly"); + + public static final ScheduleFrequencies MONTHLY = new ScheduleFrequencies(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + ScheduleFrequencies(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ScheduleFrequencies && this.string.equals(((ScheduleFrequencies) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HOURLY: + return visitor.visitHourly(); + case ONCE: + return visitor.visitOnce(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ScheduleFrequencies valueOf(String value) { + switch (value) { + case "hourly": + return HOURLY; + case "once": + return ONCE; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + case "monthly": + return MONTHLY; + default: + return new ScheduleFrequencies(Value.UNKNOWN, value); + } + } + + public enum Value { + ONCE, + + HOURLY, + + DAILY, + + WEEKLY, + + MONTHLY, + + UNKNOWN + } + + public interface Visitor { + T visitOnce(); + + T visitHourly(); + + T visitDaily(); + + T visitWeekly(); + + T visitMonthly(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntent.java b/src/main/java/com/whop/api/types/SetupIntent.java new file mode 100644 index 00000000..6b542e83 --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntent.java @@ -0,0 +1,684 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntent.Builder.class) +public final class SetupIntent { + private final Optional checkoutConfiguration; + + private final Optional company; + + private final OffsetDateTime createdAt; + + private final Optional errorMessage; + + private final String id; + + private final Optional member; + + private final Optional> metadata; + + private final Optional paymentMethod; + + private final SetupIntentStatuses status; + + private final boolean threeDsVerified; + + private final Map additionalProperties; + + private SetupIntent( + Optional checkoutConfiguration, + Optional company, + OffsetDateTime createdAt, + Optional errorMessage, + String id, + Optional member, + Optional> metadata, + Optional paymentMethod, + SetupIntentStatuses status, + boolean threeDsVerified, + Map additionalProperties) { + this.checkoutConfiguration = checkoutConfiguration; + this.company = company; + this.createdAt = createdAt; + this.errorMessage = errorMessage; + this.id = id; + this.member = member; + this.metadata = metadata; + this.paymentMethod = paymentMethod; + this.status = status; + this.threeDsVerified = threeDsVerified; + this.additionalProperties = additionalProperties; + } + + /** + * @return The checkout session configuration associated with this setup intent. Null if no checkout session was used. + */ + @JsonIgnore + public Optional getCheckoutConfiguration() { + if (checkoutConfiguration == null) { + return Optional.empty(); + } + return checkoutConfiguration; + } + + /** + * @return The company that initiated this setup intent. Null if the company has been deleted. + */ + @JsonIgnore + public Optional getCompany() { + if (company == null) { + return Optional.empty(); + } + return company; + } + + /** + * @return The datetime the setup intent was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return A human-readable error message explaining why the setup intent failed. Null if no error occurred. + */ + @JsonIgnore + public Optional getErrorMessage() { + if (errorMessage == null) { + return Optional.empty(); + } + return errorMessage; + } + + /** + * @return The unique identifier for the setup intent. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The company member associated with this setup intent. Null if the user is not a member. + */ + @JsonIgnore + public Optional getMember() { + if (member == null) { + return Optional.empty(); + } + return member; + } + + /** + * @return Custom key-value pairs attached to this setup intent. Null if no metadata was provided. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The saved payment method created by this setup intent. Null if the setup has not completed successfully. + */ + @JsonIgnore + public Optional getPaymentMethod() { + if (paymentMethod == null) { + return Optional.empty(); + } + return paymentMethod; + } + + /** + * @return The current status of the setup intent. + */ + @JsonProperty("status") + public SetupIntentStatuses getStatus() { + return status; + } + + /** + * @return Whether 3D Secure authentication was completed when this payment method was set up. + */ + @JsonProperty("three_ds_verified") + public boolean getThreeDsVerified() { + return threeDsVerified; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_configuration") + private Optional _getCheckoutConfiguration() { + return checkoutConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company") + private Optional _getCompany() { + return company; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("error_message") + private Optional _getErrorMessage() { + return errorMessage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member") + private Optional _getMember() { + return member; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method") + private Optional _getPaymentMethod() { + return paymentMethod; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntent && equalTo((SetupIntent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntent other) { + return checkoutConfiguration.equals(other.checkoutConfiguration) + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && errorMessage.equals(other.errorMessage) + && id.equals(other.id) + && member.equals(other.member) + && metadata.equals(other.metadata) + && paymentMethod.equals(other.paymentMethod) + && status.equals(other.status) + && threeDsVerified == other.threeDsVerified; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.checkoutConfiguration, + this.company, + this.createdAt, + this.errorMessage, + this.id, + this.member, + this.metadata, + this.paymentMethod, + this.status, + this.threeDsVerified); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the setup intent was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(SetupIntent other); + } + + public interface IdStage { + /** + *

The unique identifier for the setup intent.

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

The current status of the setup intent.

+ */ + ThreeDsVerifiedStage status(@NotNull SetupIntentStatuses status); + } + + public interface ThreeDsVerifiedStage { + /** + *

Whether 3D Secure authentication was completed when this payment method was set up.

+ */ + _FinalStage threeDsVerified(boolean threeDsVerified); + } + + public interface _FinalStage { + SetupIntent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The checkout session configuration associated with this setup intent. Null if no checkout session was used.

+ */ + _FinalStage checkoutConfiguration(Optional checkoutConfiguration); + + _FinalStage checkoutConfiguration(SetupIntentCheckoutConfiguration checkoutConfiguration); + + _FinalStage checkoutConfiguration(Nullable checkoutConfiguration); + + /** + *

The company that initiated this setup intent. Null if the company has been deleted.

+ */ + _FinalStage company(Optional company); + + _FinalStage company(SetupIntentCompany company); + + _FinalStage company(Nullable company); + + /** + *

A human-readable error message explaining why the setup intent failed. Null if no error occurred.

+ */ + _FinalStage errorMessage(Optional errorMessage); + + _FinalStage errorMessage(String errorMessage); + + _FinalStage errorMessage(Nullable errorMessage); + + /** + *

The company member associated with this setup intent. Null if the user is not a member.

+ */ + _FinalStage member(Optional member); + + _FinalStage member(SetupIntentMember member); + + _FinalStage member(Nullable member); + + /** + *

Custom key-value pairs attached to this setup intent. Null if no metadata was provided.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The saved payment method created by this setup intent. Null if the setup has not completed successfully.

+ */ + _FinalStage paymentMethod(Optional paymentMethod); + + _FinalStage paymentMethod(SetupIntentPaymentMethod paymentMethod); + + _FinalStage paymentMethod(Nullable paymentMethod); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IdStage, StatusStage, ThreeDsVerifiedStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private SetupIntentStatuses status; + + private boolean threeDsVerified; + + private Optional paymentMethod = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional member = Optional.empty(); + + private Optional errorMessage = Optional.empty(); + + private Optional company = Optional.empty(); + + private Optional checkoutConfiguration = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SetupIntent other) { + checkoutConfiguration(other.getCheckoutConfiguration()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + errorMessage(other.getErrorMessage()); + id(other.getId()); + member(other.getMember()); + metadata(other.getMetadata()); + paymentMethod(other.getPaymentMethod()); + status(other.getStatus()); + threeDsVerified(other.getThreeDsVerified()); + return this; + } + + /** + *

The datetime the setup intent was created.

+ *

The datetime the setup intent was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the setup intent.

+ *

The unique identifier for the setup intent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current status of the setup intent.

+ *

The current status of the setup intent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public ThreeDsVerifiedStage status(@NotNull SetupIntentStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Whether 3D Secure authentication was completed when this payment method was set up.

+ *

Whether 3D Secure authentication was completed when this payment method was set up.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("three_ds_verified") + public _FinalStage threeDsVerified(boolean threeDsVerified) { + this.threeDsVerified = threeDsVerified; + return this; + } + + /** + *

The saved payment method created by this setup intent. Null if the setup has not completed successfully.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethod(Nullable paymentMethod) { + if (paymentMethod.isNull()) { + this.paymentMethod = null; + } else if (paymentMethod.isEmpty()) { + this.paymentMethod = Optional.empty(); + } else { + this.paymentMethod = Optional.of(paymentMethod.get()); + } + return this; + } + + /** + *

The saved payment method created by this setup intent. Null if the setup has not completed successfully.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethod(SetupIntentPaymentMethod paymentMethod) { + this.paymentMethod = Optional.ofNullable(paymentMethod); + return this; + } + + /** + *

The saved payment method created by this setup intent. Null if the setup has not completed successfully.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method", nulls = Nulls.SKIP) + public _FinalStage paymentMethod(Optional paymentMethod) { + this.paymentMethod = paymentMethod; + return this; + } + + /** + *

Custom key-value pairs attached to this setup intent. Null if no metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs attached to this setup intent. Null if no metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs attached to this setup intent. Null if no metadata was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The company member associated with this setup intent. Null if the user is not a member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(Nullable member) { + if (member.isNull()) { + this.member = null; + } else if (member.isEmpty()) { + this.member = Optional.empty(); + } else { + this.member = Optional.of(member.get()); + } + return this; + } + + /** + *

The company member associated with this setup intent. Null if the user is not a member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(SetupIntentMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + /** + *

The company member associated with this setup intent. Null if the user is not a member.

+ */ + @java.lang.Override + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public _FinalStage member(Optional member) { + this.member = member; + return this; + } + + /** + *

A human-readable error message explaining why the setup intent failed. Null if no error occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorMessage(Nullable errorMessage) { + if (errorMessage.isNull()) { + this.errorMessage = null; + } else if (errorMessage.isEmpty()) { + this.errorMessage = Optional.empty(); + } else { + this.errorMessage = Optional.of(errorMessage.get()); + } + return this; + } + + /** + *

A human-readable error message explaining why the setup intent failed. Null if no error occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorMessage(String errorMessage) { + this.errorMessage = Optional.ofNullable(errorMessage); + return this; + } + + /** + *

A human-readable error message explaining why the setup intent failed. Null if no error occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "error_message", nulls = Nulls.SKIP) + public _FinalStage errorMessage(Optional errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + *

The company that initiated this setup intent. Null if the company has been deleted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(Nullable company) { + if (company.isNull()) { + this.company = null; + } else if (company.isEmpty()) { + this.company = Optional.empty(); + } else { + this.company = Optional.of(company.get()); + } + return this; + } + + /** + *

The company that initiated this setup intent. Null if the company has been deleted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(SetupIntentCompany company) { + this.company = Optional.ofNullable(company); + return this; + } + + /** + *

The company that initiated this setup intent. Null if the company has been deleted.

+ */ + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + + /** + *

The checkout session configuration associated with this setup intent. Null if no checkout session was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfiguration(Nullable checkoutConfiguration) { + if (checkoutConfiguration.isNull()) { + this.checkoutConfiguration = null; + } else if (checkoutConfiguration.isEmpty()) { + this.checkoutConfiguration = Optional.empty(); + } else { + this.checkoutConfiguration = Optional.of(checkoutConfiguration.get()); + } + return this; + } + + /** + *

The checkout session configuration associated with this setup intent. Null if no checkout session was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfiguration(SetupIntentCheckoutConfiguration checkoutConfiguration) { + this.checkoutConfiguration = Optional.ofNullable(checkoutConfiguration); + return this; + } + + /** + *

The checkout session configuration associated with this setup intent. Null if no checkout session was used.

+ */ + @java.lang.Override + @JsonSetter(value = "checkout_configuration", nulls = Nulls.SKIP) + public _FinalStage checkoutConfiguration(Optional checkoutConfiguration) { + this.checkoutConfiguration = checkoutConfiguration; + return this; + } + + @java.lang.Override + public SetupIntent build() { + return new SetupIntent( + checkoutConfiguration, + company, + createdAt, + errorMessage, + id, + member, + metadata, + paymentMethod, + status, + threeDsVerified, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentCheckoutConfiguration.java b/src/main/java/com/whop/api/types/SetupIntentCheckoutConfiguration.java new file mode 100644 index 00000000..c84806e6 --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentCheckoutConfiguration.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntentCheckoutConfiguration.Builder.class) +public final class SetupIntentCheckoutConfiguration { + private final String id; + + private final Map additionalProperties; + + private SetupIntentCheckoutConfiguration(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the checkout session. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntentCheckoutConfiguration && equalTo((SetupIntentCheckoutConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntentCheckoutConfiguration other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the checkout session.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(SetupIntentCheckoutConfiguration other); + } + + public interface _FinalStage { + SetupIntentCheckoutConfiguration build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SetupIntentCheckoutConfiguration other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the checkout session.

+ *

The unique identifier for the checkout session.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public SetupIntentCheckoutConfiguration build() { + return new SetupIntentCheckoutConfiguration(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentCompany.java b/src/main/java/com/whop/api/types/SetupIntentCompany.java new file mode 100644 index 00000000..11d63794 --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentCompany.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntentCompany.Builder.class) +public final class SetupIntentCompany { + private final String id; + + private final Map additionalProperties; + + private SetupIntentCompany(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntentCompany && equalTo((SetupIntentCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntentCompany other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(SetupIntentCompany other); + } + + public interface _FinalStage { + SetupIntentCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SetupIntentCompany other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public SetupIntentCompany build() { + return new SetupIntentCompany(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentListItem.java b/src/main/java/com/whop/api/types/SetupIntentListItem.java new file mode 100644 index 00000000..c752c4f5 --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentListItem.java @@ -0,0 +1,648 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntentListItem.Builder.class) +public final class SetupIntentListItem { + private final Optional checkoutConfiguration; + + private final Optional company; + + private final OffsetDateTime createdAt; + + private final Optional errorMessage; + + private final String id; + + private final Optional member; + + private final Optional> metadata; + + private final Optional paymentMethod; + + private final SetupIntentStatuses status; + + private final Map additionalProperties; + + private SetupIntentListItem( + Optional checkoutConfiguration, + Optional company, + OffsetDateTime createdAt, + Optional errorMessage, + String id, + Optional member, + Optional> metadata, + Optional paymentMethod, + SetupIntentStatuses status, + Map additionalProperties) { + this.checkoutConfiguration = checkoutConfiguration; + this.company = company; + this.createdAt = createdAt; + this.errorMessage = errorMessage; + this.id = id; + this.member = member; + this.metadata = metadata; + this.paymentMethod = paymentMethod; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The checkout session configuration associated with this setup intent. Null if no checkout session was used. + */ + @JsonIgnore + public Optional getCheckoutConfiguration() { + if (checkoutConfiguration == null) { + return Optional.empty(); + } + return checkoutConfiguration; + } + + /** + * @return The company that initiated this setup intent. Null if the company has been deleted. + */ + @JsonIgnore + public Optional getCompany() { + if (company == null) { + return Optional.empty(); + } + return company; + } + + /** + * @return The datetime the setup intent was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return A human-readable error message explaining why the setup intent failed. Null if no error occurred. + */ + @JsonIgnore + public Optional getErrorMessage() { + if (errorMessage == null) { + return Optional.empty(); + } + return errorMessage; + } + + /** + * @return The unique identifier for the setup intent. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The company member associated with this setup intent. Null if the user is not a member. + */ + @JsonIgnore + public Optional getMember() { + if (member == null) { + return Optional.empty(); + } + return member; + } + + /** + * @return Custom key-value pairs attached to this setup intent. Null if no metadata was provided. + */ + @JsonIgnore + public Optional> getMetadata() { + if (metadata == null) { + return Optional.empty(); + } + return metadata; + } + + /** + * @return The saved payment method created by this setup intent. Null if the setup has not completed successfully. + */ + @JsonIgnore + public Optional getPaymentMethod() { + if (paymentMethod == null) { + return Optional.empty(); + } + return paymentMethod; + } + + /** + * @return The current status of the setup intent. + */ + @JsonProperty("status") + public SetupIntentStatuses getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("checkout_configuration") + private Optional _getCheckoutConfiguration() { + return checkoutConfiguration; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company") + private Optional _getCompany() { + return company; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("error_message") + private Optional _getErrorMessage() { + return errorMessage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("member") + private Optional _getMember() { + return member; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("metadata") + private Optional> _getMetadata() { + return metadata; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment_method") + private Optional _getPaymentMethod() { + return paymentMethod; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntentListItem && equalTo((SetupIntentListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntentListItem other) { + return checkoutConfiguration.equals(other.checkoutConfiguration) + && company.equals(other.company) + && createdAt.equals(other.createdAt) + && errorMessage.equals(other.errorMessage) + && id.equals(other.id) + && member.equals(other.member) + && metadata.equals(other.metadata) + && paymentMethod.equals(other.paymentMethod) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.checkoutConfiguration, + this.company, + this.createdAt, + this.errorMessage, + this.id, + this.member, + this.metadata, + this.paymentMethod, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the setup intent was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(SetupIntentListItem other); + } + + public interface IdStage { + /** + *

The unique identifier for the setup intent.

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

The current status of the setup intent.

+ */ + _FinalStage status(@NotNull SetupIntentStatuses status); + } + + public interface _FinalStage { + SetupIntentListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The checkout session configuration associated with this setup intent. Null if no checkout session was used.

+ */ + _FinalStage checkoutConfiguration(Optional checkoutConfiguration); + + _FinalStage checkoutConfiguration(SetupIntentListItemCheckoutConfiguration checkoutConfiguration); + + _FinalStage checkoutConfiguration(Nullable checkoutConfiguration); + + /** + *

The company that initiated this setup intent. Null if the company has been deleted.

+ */ + _FinalStage company(Optional company); + + _FinalStage company(SetupIntentListItemCompany company); + + _FinalStage company(Nullable company); + + /** + *

A human-readable error message explaining why the setup intent failed. Null if no error occurred.

+ */ + _FinalStage errorMessage(Optional errorMessage); + + _FinalStage errorMessage(String errorMessage); + + _FinalStage errorMessage(Nullable errorMessage); + + /** + *

The company member associated with this setup intent. Null if the user is not a member.

+ */ + _FinalStage member(Optional member); + + _FinalStage member(SetupIntentListItemMember member); + + _FinalStage member(Nullable member); + + /** + *

Custom key-value pairs attached to this setup intent. Null if no metadata was provided.

+ */ + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage metadata(Nullable> metadata); + + /** + *

The saved payment method created by this setup intent. Null if the setup has not completed successfully.

+ */ + _FinalStage paymentMethod(Optional paymentMethod); + + _FinalStage paymentMethod(SetupIntentListItemPaymentMethod paymentMethod); + + _FinalStage paymentMethod(Nullable paymentMethod); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, StatusStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private SetupIntentStatuses status; + + private Optional paymentMethod = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional member = Optional.empty(); + + private Optional errorMessage = Optional.empty(); + + private Optional company = Optional.empty(); + + private Optional checkoutConfiguration = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SetupIntentListItem other) { + checkoutConfiguration(other.getCheckoutConfiguration()); + company(other.getCompany()); + createdAt(other.getCreatedAt()); + errorMessage(other.getErrorMessage()); + id(other.getId()); + member(other.getMember()); + metadata(other.getMetadata()); + paymentMethod(other.getPaymentMethod()); + status(other.getStatus()); + return this; + } + + /** + *

The datetime the setup intent was created.

+ *

The datetime the setup intent was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the setup intent.

+ *

The unique identifier for the setup intent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current status of the setup intent.

+ *

The current status of the setup intent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull SetupIntentStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The saved payment method created by this setup intent. Null if the setup has not completed successfully.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethod(Nullable paymentMethod) { + if (paymentMethod.isNull()) { + this.paymentMethod = null; + } else if (paymentMethod.isEmpty()) { + this.paymentMethod = Optional.empty(); + } else { + this.paymentMethod = Optional.of(paymentMethod.get()); + } + return this; + } + + /** + *

The saved payment method created by this setup intent. Null if the setup has not completed successfully.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paymentMethod(SetupIntentListItemPaymentMethod paymentMethod) { + this.paymentMethod = Optional.ofNullable(paymentMethod); + return this; + } + + /** + *

The saved payment method created by this setup intent. Null if the setup has not completed successfully.

+ */ + @java.lang.Override + @JsonSetter(value = "payment_method", nulls = Nulls.SKIP) + public _FinalStage paymentMethod(Optional paymentMethod) { + this.paymentMethod = paymentMethod; + return this; + } + + /** + *

Custom key-value pairs attached to this setup intent. Null if no metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Nullable> metadata) { + if (metadata.isNull()) { + this.metadata = null; + } else if (metadata.isEmpty()) { + this.metadata = Optional.empty(); + } else { + this.metadata = Optional.of(metadata.get()); + } + return this; + } + + /** + *

Custom key-value pairs attached to this setup intent. Null if no metadata was provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + /** + *

Custom key-value pairs attached to this setup intent. Null if no metadata was provided.

+ */ + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

The company member associated with this setup intent. Null if the user is not a member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(Nullable member) { + if (member.isNull()) { + this.member = null; + } else if (member.isEmpty()) { + this.member = Optional.empty(); + } else { + this.member = Optional.of(member.get()); + } + return this; + } + + /** + *

The company member associated with this setup intent. Null if the user is not a member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage member(SetupIntentListItemMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + /** + *

The company member associated with this setup intent. Null if the user is not a member.

+ */ + @java.lang.Override + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public _FinalStage member(Optional member) { + this.member = member; + return this; + } + + /** + *

A human-readable error message explaining why the setup intent failed. Null if no error occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorMessage(Nullable errorMessage) { + if (errorMessage.isNull()) { + this.errorMessage = null; + } else if (errorMessage.isEmpty()) { + this.errorMessage = Optional.empty(); + } else { + this.errorMessage = Optional.of(errorMessage.get()); + } + return this; + } + + /** + *

A human-readable error message explaining why the setup intent failed. Null if no error occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorMessage(String errorMessage) { + this.errorMessage = Optional.ofNullable(errorMessage); + return this; + } + + /** + *

A human-readable error message explaining why the setup intent failed. Null if no error occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "error_message", nulls = Nulls.SKIP) + public _FinalStage errorMessage(Optional errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + *

The company that initiated this setup intent. Null if the company has been deleted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(Nullable company) { + if (company.isNull()) { + this.company = null; + } else if (company.isEmpty()) { + this.company = Optional.empty(); + } else { + this.company = Optional.of(company.get()); + } + return this; + } + + /** + *

The company that initiated this setup intent. Null if the company has been deleted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage company(SetupIntentListItemCompany company) { + this.company = Optional.ofNullable(company); + return this; + } + + /** + *

The company that initiated this setup intent. Null if the company has been deleted.

+ */ + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + + /** + *

The checkout session configuration associated with this setup intent. Null if no checkout session was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfiguration( + Nullable checkoutConfiguration) { + if (checkoutConfiguration.isNull()) { + this.checkoutConfiguration = null; + } else if (checkoutConfiguration.isEmpty()) { + this.checkoutConfiguration = Optional.empty(); + } else { + this.checkoutConfiguration = Optional.of(checkoutConfiguration.get()); + } + return this; + } + + /** + *

The checkout session configuration associated with this setup intent. Null if no checkout session was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage checkoutConfiguration(SetupIntentListItemCheckoutConfiguration checkoutConfiguration) { + this.checkoutConfiguration = Optional.ofNullable(checkoutConfiguration); + return this; + } + + /** + *

The checkout session configuration associated with this setup intent. Null if no checkout session was used.

+ */ + @java.lang.Override + @JsonSetter(value = "checkout_configuration", nulls = Nulls.SKIP) + public _FinalStage checkoutConfiguration( + Optional checkoutConfiguration) { + this.checkoutConfiguration = checkoutConfiguration; + return this; + } + + @java.lang.Override + public SetupIntentListItem build() { + return new SetupIntentListItem( + checkoutConfiguration, + company, + createdAt, + errorMessage, + id, + member, + metadata, + paymentMethod, + status, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentListItemCheckoutConfiguration.java b/src/main/java/com/whop/api/types/SetupIntentListItemCheckoutConfiguration.java new file mode 100644 index 00000000..4f28767e --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentListItemCheckoutConfiguration.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntentListItemCheckoutConfiguration.Builder.class) +public final class SetupIntentListItemCheckoutConfiguration { + private final String id; + + private final Map additionalProperties; + + private SetupIntentListItemCheckoutConfiguration(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the checkout session. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntentListItemCheckoutConfiguration + && equalTo((SetupIntentListItemCheckoutConfiguration) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntentListItemCheckoutConfiguration other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the checkout session.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(SetupIntentListItemCheckoutConfiguration other); + } + + public interface _FinalStage { + SetupIntentListItemCheckoutConfiguration build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SetupIntentListItemCheckoutConfiguration other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the checkout session.

+ *

The unique identifier for the checkout session.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public SetupIntentListItemCheckoutConfiguration build() { + return new SetupIntentListItemCheckoutConfiguration(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentListItemCompany.java b/src/main/java/com/whop/api/types/SetupIntentListItemCompany.java new file mode 100644 index 00000000..1a5b71ff --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentListItemCompany.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntentListItemCompany.Builder.class) +public final class SetupIntentListItemCompany { + private final String id; + + private final Map additionalProperties; + + private SetupIntentListItemCompany(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntentListItemCompany && equalTo((SetupIntentListItemCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntentListItemCompany other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(SetupIntentListItemCompany other); + } + + public interface _FinalStage { + SetupIntentListItemCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SetupIntentListItemCompany other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public SetupIntentListItemCompany build() { + return new SetupIntentListItemCompany(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentListItemMember.java b/src/main/java/com/whop/api/types/SetupIntentListItemMember.java new file mode 100644 index 00000000..4ec5e433 --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentListItemMember.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntentListItemMember.Builder.class) +public final class SetupIntentListItemMember { + private final String id; + + private final Optional user; + + private final Map additionalProperties; + + private SetupIntentListItemMember( + String id, Optional user, Map additionalProperties) { + this.id = id; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company member. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user for this member, if any. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntentListItemMember && equalTo((SetupIntentListItemMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntentListItemMember other) { + return id.equals(other.id) && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company member.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(SetupIntentListItemMember other); + } + + public interface _FinalStage { + SetupIntentListItemMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user for this member, if any.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(SetupIntentListItemMemberUser user); + + _FinalStage user(Nullable user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional user = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SetupIntentListItemMember other) { + id(other.getId()); + user(other.getUser()); + return this; + } + + /** + *

The unique identifier for the company member.

+ *

The unique identifier for the company member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user for this member, if any.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The user for this member, if any.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(SetupIntentListItemMemberUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The user for this member, if any.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + @java.lang.Override + public SetupIntentListItemMember build() { + return new SetupIntentListItemMember(id, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentListItemMemberUser.java b/src/main/java/com/whop/api/types/SetupIntentListItemMemberUser.java new file mode 100644 index 00000000..56a40016 --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentListItemMemberUser.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntentListItemMemberUser.Builder.class) +public final class SetupIntentListItemMemberUser { + private final Optional email; + + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private SetupIntentListItemMemberUser( + Optional email, + String id, + Optional name, + String username, + Map additionalProperties) { + this.email = email; + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The digital mailing address of the user. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the company member user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's full name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The whop username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntentListItemMemberUser && equalTo((SetupIntentListItemMemberUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntentListItemMemberUser other) { + return email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company member user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(SetupIntentListItemMemberUser other); + } + + public interface UsernameStage { + /** + *

The whop username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + SetupIntentListItemMemberUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The digital mailing address of the user.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's full name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SetupIntentListItemMemberUser other) { + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the company member user.

+ *

The unique identifier for the company member user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The whop username.

+ *

The whop username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's full name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's full name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's full name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The digital mailing address of the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The digital mailing address of the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The digital mailing address of the user.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public SetupIntentListItemMemberUser build() { + return new SetupIntentListItemMemberUser(email, id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentListItemPaymentMethod.java b/src/main/java/com/whop/api/types/SetupIntentListItemPaymentMethod.java new file mode 100644 index 00000000..9a887412 --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentListItemPaymentMethod.java @@ -0,0 +1,348 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntentListItemPaymentMethod.Builder.class) +public final class SetupIntentListItemPaymentMethod { + private final Optional card; + + private final OffsetDateTime createdAt; + + private final String id; + + private final Optional mailingAddress; + + private final PaymentMethodTypes paymentMethodType; + + private final Map additionalProperties; + + private SetupIntentListItemPaymentMethod( + Optional card, + OffsetDateTime createdAt, + String id, + Optional mailingAddress, + PaymentMethodTypes paymentMethodType, + Map additionalProperties) { + this.card = card; + this.createdAt = createdAt; + this.id = id; + this.mailingAddress = mailingAddress; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The card data associated with the payment method, if its a debit or credit card. + */ + @JsonIgnore + public Optional getCard() { + if (card == null) { + return Optional.empty(); + } + return card; + } + + /** + * @return The datetime the payment token was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the payment token. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The mailing address associated with the payment method's user + */ + @JsonIgnore + public Optional getMailingAddress() { + if (mailingAddress == null) { + return Optional.empty(); + } + return mailingAddress; + } + + /** + * @return The payment method type of the payment method + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card") + private Optional _getCard() { + return card; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("mailing_address") + private Optional _getMailingAddress() { + return mailingAddress; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntentListItemPaymentMethod && equalTo((SetupIntentListItemPaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntentListItemPaymentMethod other) { + return card.equals(other.card) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && mailingAddress.equals(other.mailingAddress) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.createdAt, this.id, this.mailingAddress, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the payment token was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(SetupIntentListItemPaymentMethod other); + } + + public interface IdStage { + /** + *

The unique identifier for the payment token.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The payment method type of the payment method

+ */ + _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface _FinalStage { + SetupIntentListItemPaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ */ + _FinalStage card(Optional card); + + _FinalStage card(SetupIntentListItemPaymentMethodCard card); + + _FinalStage card(Nullable card); + + /** + *

The mailing address associated with the payment method's user

+ */ + _FinalStage mailingAddress(Optional mailingAddress); + + _FinalStage mailingAddress(SetupIntentListItemPaymentMethodMailingAddress mailingAddress); + + _FinalStage mailingAddress(Nullable mailingAddress); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, PaymentMethodTypeStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + private Optional mailingAddress = Optional.empty(); + + private Optional card = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SetupIntentListItemPaymentMethod other) { + card(other.getCard()); + createdAt(other.getCreatedAt()); + id(other.getId()); + mailingAddress(other.getMailingAddress()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

The datetime the payment token was created.

+ *

The datetime the payment token was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the payment token.

+ *

The unique identifier for the payment token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The payment method type of the payment method

+ *

The payment method type of the payment method

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + /** + *

The mailing address associated with the payment method's user

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mailingAddress(Nullable mailingAddress) { + if (mailingAddress.isNull()) { + this.mailingAddress = null; + } else if (mailingAddress.isEmpty()) { + this.mailingAddress = Optional.empty(); + } else { + this.mailingAddress = Optional.of(mailingAddress.get()); + } + return this; + } + + /** + *

The mailing address associated with the payment method's user

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mailingAddress(SetupIntentListItemPaymentMethodMailingAddress mailingAddress) { + this.mailingAddress = Optional.ofNullable(mailingAddress); + return this; + } + + /** + *

The mailing address associated with the payment method's user

+ */ + @java.lang.Override + @JsonSetter(value = "mailing_address", nulls = Nulls.SKIP) + public _FinalStage mailingAddress(Optional mailingAddress) { + this.mailingAddress = mailingAddress; + return this; + } + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(Nullable card) { + if (card.isNull()) { + this.card = null; + } else if (card.isEmpty()) { + this.card = Optional.empty(); + } else { + this.card = Optional.of(card.get()); + } + return this; + } + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(SetupIntentListItemPaymentMethodCard card) { + this.card = Optional.ofNullable(card); + return this; + } + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ */ + @java.lang.Override + @JsonSetter(value = "card", nulls = Nulls.SKIP) + public _FinalStage card(Optional card) { + this.card = card; + return this; + } + + @java.lang.Override + public SetupIntentListItemPaymentMethod build() { + return new SetupIntentListItemPaymentMethod( + card, createdAt, id, mailingAddress, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentListItemPaymentMethodCard.java b/src/main/java/com/whop/api/types/SetupIntentListItemPaymentMethodCard.java new file mode 100644 index 00000000..dcc44eac --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentListItemPaymentMethodCard.java @@ -0,0 +1,287 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntentListItemPaymentMethodCard.Builder.class) +public final class SetupIntentListItemPaymentMethodCard { + private final Optional brand; + + private final Optional expMonth; + + private final Optional expYear; + + private final Optional last4; + + private final Map additionalProperties; + + private SetupIntentListItemPaymentMethodCard( + Optional brand, + Optional expMonth, + Optional expYear, + Optional last4, + Map additionalProperties) { + this.brand = brand; + this.expMonth = expMonth; + this.expYear = expYear; + this.last4 = last4; + this.additionalProperties = additionalProperties; + } + + /** + * @return The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined. + */ + @JsonIgnore + public Optional getBrand() { + if (brand == null) { + return Optional.empty(); + } + return brand; + } + + /** + * @return The two-digit expiration month of the card (1-12). Null if not available. + */ + @JsonIgnore + public Optional getExpMonth() { + if (expMonth == null) { + return Optional.empty(); + } + return expMonth; + } + + /** + * @return The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available. + */ + @JsonIgnore + public Optional getExpYear() { + if (expYear == null) { + return Optional.empty(); + } + return expYear; + } + + /** + * @return The last four digits of the card number. Null if not available. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("brand") + private Optional _getBrand() { + return brand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_month") + private Optional _getExpMonth() { + return expMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_year") + private Optional _getExpYear() { + return expYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntentListItemPaymentMethodCard + && equalTo((SetupIntentListItemPaymentMethodCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntentListItemPaymentMethodCard other) { + return brand.equals(other.brand) + && expMonth.equals(other.expMonth) + && expYear.equals(other.expYear) + && last4.equals(other.last4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.brand, this.expMonth, this.expYear, this.last4); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional brand = Optional.empty(); + + private Optional expMonth = Optional.empty(); + + private Optional expYear = Optional.empty(); + + private Optional last4 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SetupIntentListItemPaymentMethodCard other) { + brand(other.getBrand()); + expMonth(other.getExpMonth()); + expYear(other.getExpYear()); + last4(other.getLast4()); + return this; + } + + /** + *

The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined.

+ */ + @JsonSetter(value = "brand", nulls = Nulls.SKIP) + public Builder brand(Optional brand) { + this.brand = brand; + return this; + } + + public Builder brand(CardBrands brand) { + this.brand = Optional.ofNullable(brand); + return this; + } + + public Builder brand(Nullable brand) { + if (brand.isNull()) { + this.brand = null; + } else if (brand.isEmpty()) { + this.brand = Optional.empty(); + } else { + this.brand = Optional.of(brand.get()); + } + return this; + } + + /** + *

The two-digit expiration month of the card (1-12). Null if not available.

+ */ + @JsonSetter(value = "exp_month", nulls = Nulls.SKIP) + public Builder expMonth(Optional expMonth) { + this.expMonth = expMonth; + return this; + } + + public Builder expMonth(Integer expMonth) { + this.expMonth = Optional.ofNullable(expMonth); + return this; + } + + public Builder expMonth(Nullable expMonth) { + if (expMonth.isNull()) { + this.expMonth = null; + } else if (expMonth.isEmpty()) { + this.expMonth = Optional.empty(); + } else { + this.expMonth = Optional.of(expMonth.get()); + } + return this; + } + + /** + *

The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available.

+ */ + @JsonSetter(value = "exp_year", nulls = Nulls.SKIP) + public Builder expYear(Optional expYear) { + this.expYear = expYear; + return this; + } + + public Builder expYear(Integer expYear) { + this.expYear = Optional.ofNullable(expYear); + return this; + } + + public Builder expYear(Nullable expYear) { + if (expYear.isNull()) { + this.expYear = null; + } else if (expYear.isEmpty()) { + this.expYear = Optional.empty(); + } else { + this.expYear = Optional.of(expYear.get()); + } + return this; + } + + /** + *

The last four digits of the card number. Null if not available.

+ */ + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public Builder last4(Optional last4) { + this.last4 = last4; + return this; + } + + public Builder last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + public Builder last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + public SetupIntentListItemPaymentMethodCard build() { + return new SetupIntentListItemPaymentMethodCard(brand, expMonth, expYear, last4, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentListItemPaymentMethodMailingAddress.java b/src/main/java/com/whop/api/types/SetupIntentListItemPaymentMethodMailingAddress.java new file mode 100644 index 00000000..340e4d10 --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentListItemPaymentMethodMailingAddress.java @@ -0,0 +1,438 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntentListItemPaymentMethodMailingAddress.Builder.class) +public final class SetupIntentListItemPaymentMethodMailingAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional name; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private SetupIntentListItemPaymentMethodMailingAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional name, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.name = name; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The name of the customer. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntentListItemPaymentMethodMailingAddress + && equalTo((SetupIntentListItemPaymentMethodMailingAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntentListItemPaymentMethodMailingAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && name.equals(other.name) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.name, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SetupIntentListItemPaymentMethodMailingAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + name(other.getName()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The name of the customer.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public SetupIntentListItemPaymentMethodMailingAddress build() { + return new SetupIntentListItemPaymentMethodMailingAddress( + city, country, line1, line2, name, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentMember.java b/src/main/java/com/whop/api/types/SetupIntentMember.java new file mode 100644 index 00000000..53dd5e7e --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentMember.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntentMember.Builder.class) +public final class SetupIntentMember { + private final String id; + + private final Optional user; + + private final Map additionalProperties; + + private SetupIntentMember( + String id, Optional user, Map additionalProperties) { + this.id = id; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company member. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user for this member, if any. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntentMember && equalTo((SetupIntentMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntentMember other) { + return id.equals(other.id) && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company member.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(SetupIntentMember other); + } + + public interface _FinalStage { + SetupIntentMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user for this member, if any.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(SetupIntentMemberUser user); + + _FinalStage user(Nullable user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional user = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SetupIntentMember other) { + id(other.getId()); + user(other.getUser()); + return this; + } + + /** + *

The unique identifier for the company member.

+ *

The unique identifier for the company member.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user for this member, if any.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The user for this member, if any.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(SetupIntentMemberUser user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The user for this member, if any.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + @java.lang.Override + public SetupIntentMember build() { + return new SetupIntentMember(id, user, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentMemberUser.java b/src/main/java/com/whop/api/types/SetupIntentMemberUser.java new file mode 100644 index 00000000..f8c66457 --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentMemberUser.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntentMemberUser.Builder.class) +public final class SetupIntentMemberUser { + private final Optional email; + + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private SetupIntentMemberUser( + Optional email, + String id, + Optional name, + String username, + Map additionalProperties) { + this.email = email; + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The digital mailing address of the user. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return The unique identifier for the company member user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's full name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The whop username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntentMemberUser && equalTo((SetupIntentMemberUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntentMemberUser other) { + return email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company member user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(SetupIntentMemberUser other); + } + + public interface UsernameStage { + /** + *

The whop username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + SetupIntentMemberUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The digital mailing address of the user.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's full name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SetupIntentMemberUser other) { + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the company member user.

+ *

The unique identifier for the company member user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The whop username.

+ *

The whop username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's full name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's full name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's full name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The digital mailing address of the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The digital mailing address of the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The digital mailing address of the user.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public SetupIntentMemberUser build() { + return new SetupIntentMemberUser(email, id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentPaymentMethod.java b/src/main/java/com/whop/api/types/SetupIntentPaymentMethod.java new file mode 100644 index 00000000..06cce374 --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentPaymentMethod.java @@ -0,0 +1,348 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntentPaymentMethod.Builder.class) +public final class SetupIntentPaymentMethod { + private final Optional card; + + private final OffsetDateTime createdAt; + + private final String id; + + private final Optional mailingAddress; + + private final PaymentMethodTypes paymentMethodType; + + private final Map additionalProperties; + + private SetupIntentPaymentMethod( + Optional card, + OffsetDateTime createdAt, + String id, + Optional mailingAddress, + PaymentMethodTypes paymentMethodType, + Map additionalProperties) { + this.card = card; + this.createdAt = createdAt; + this.id = id; + this.mailingAddress = mailingAddress; + this.paymentMethodType = paymentMethodType; + this.additionalProperties = additionalProperties; + } + + /** + * @return The card data associated with the payment method, if its a debit or credit card. + */ + @JsonIgnore + public Optional getCard() { + if (card == null) { + return Optional.empty(); + } + return card; + } + + /** + * @return The datetime the payment token was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The unique identifier for the payment token. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The mailing address associated with the payment method's user + */ + @JsonIgnore + public Optional getMailingAddress() { + if (mailingAddress == null) { + return Optional.empty(); + } + return mailingAddress; + } + + /** + * @return The payment method type of the payment method + */ + @JsonProperty("payment_method_type") + public PaymentMethodTypes getPaymentMethodType() { + return paymentMethodType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("card") + private Optional _getCard() { + return card; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("mailing_address") + private Optional _getMailingAddress() { + return mailingAddress; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntentPaymentMethod && equalTo((SetupIntentPaymentMethod) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntentPaymentMethod other) { + return card.equals(other.card) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && mailingAddress.equals(other.mailingAddress) + && paymentMethodType.equals(other.paymentMethodType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.card, this.createdAt, this.id, this.mailingAddress, this.paymentMethodType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the payment token was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(SetupIntentPaymentMethod other); + } + + public interface IdStage { + /** + *

The unique identifier for the payment token.

+ */ + PaymentMethodTypeStage id(@NotNull String id); + } + + public interface PaymentMethodTypeStage { + /** + *

The payment method type of the payment method

+ */ + _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType); + } + + public interface _FinalStage { + SetupIntentPaymentMethod build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ */ + _FinalStage card(Optional card); + + _FinalStage card(SetupIntentPaymentMethodCard card); + + _FinalStage card(Nullable card); + + /** + *

The mailing address associated with the payment method's user

+ */ + _FinalStage mailingAddress(Optional mailingAddress); + + _FinalStage mailingAddress(SetupIntentPaymentMethodMailingAddress mailingAddress); + + _FinalStage mailingAddress(Nullable mailingAddress); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, PaymentMethodTypeStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private PaymentMethodTypes paymentMethodType; + + private Optional mailingAddress = Optional.empty(); + + private Optional card = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SetupIntentPaymentMethod other) { + card(other.getCard()); + createdAt(other.getCreatedAt()); + id(other.getId()); + mailingAddress(other.getMailingAddress()); + paymentMethodType(other.getPaymentMethodType()); + return this; + } + + /** + *

The datetime the payment token was created.

+ *

The datetime the payment token was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the payment token.

+ *

The unique identifier for the payment token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentMethodTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The payment method type of the payment method

+ *

The payment method type of the payment method

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_method_type") + public _FinalStage paymentMethodType(@NotNull PaymentMethodTypes paymentMethodType) { + this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); + return this; + } + + /** + *

The mailing address associated with the payment method's user

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mailingAddress(Nullable mailingAddress) { + if (mailingAddress.isNull()) { + this.mailingAddress = null; + } else if (mailingAddress.isEmpty()) { + this.mailingAddress = Optional.empty(); + } else { + this.mailingAddress = Optional.of(mailingAddress.get()); + } + return this; + } + + /** + *

The mailing address associated with the payment method's user

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mailingAddress(SetupIntentPaymentMethodMailingAddress mailingAddress) { + this.mailingAddress = Optional.ofNullable(mailingAddress); + return this; + } + + /** + *

The mailing address associated with the payment method's user

+ */ + @java.lang.Override + @JsonSetter(value = "mailing_address", nulls = Nulls.SKIP) + public _FinalStage mailingAddress(Optional mailingAddress) { + this.mailingAddress = mailingAddress; + return this; + } + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(Nullable card) { + if (card.isNull()) { + this.card = null; + } else if (card.isEmpty()) { + this.card = Optional.empty(); + } else { + this.card = Optional.of(card.get()); + } + return this; + } + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage card(SetupIntentPaymentMethodCard card) { + this.card = Optional.ofNullable(card); + return this; + } + + /** + *

The card data associated with the payment method, if its a debit or credit card.

+ */ + @java.lang.Override + @JsonSetter(value = "card", nulls = Nulls.SKIP) + public _FinalStage card(Optional card) { + this.card = card; + return this; + } + + @java.lang.Override + public SetupIntentPaymentMethod build() { + return new SetupIntentPaymentMethod( + card, createdAt, id, mailingAddress, paymentMethodType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentPaymentMethodCard.java b/src/main/java/com/whop/api/types/SetupIntentPaymentMethodCard.java new file mode 100644 index 00000000..fb351a81 --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentPaymentMethodCard.java @@ -0,0 +1,286 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntentPaymentMethodCard.Builder.class) +public final class SetupIntentPaymentMethodCard { + private final Optional brand; + + private final Optional expMonth; + + private final Optional expYear; + + private final Optional last4; + + private final Map additionalProperties; + + private SetupIntentPaymentMethodCard( + Optional brand, + Optional expMonth, + Optional expYear, + Optional last4, + Map additionalProperties) { + this.brand = brand; + this.expMonth = expMonth; + this.expYear = expYear; + this.last4 = last4; + this.additionalProperties = additionalProperties; + } + + /** + * @return The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined. + */ + @JsonIgnore + public Optional getBrand() { + if (brand == null) { + return Optional.empty(); + } + return brand; + } + + /** + * @return The two-digit expiration month of the card (1-12). Null if not available. + */ + @JsonIgnore + public Optional getExpMonth() { + if (expMonth == null) { + return Optional.empty(); + } + return expMonth; + } + + /** + * @return The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available. + */ + @JsonIgnore + public Optional getExpYear() { + if (expYear == null) { + return Optional.empty(); + } + return expYear; + } + + /** + * @return The last four digits of the card number. Null if not available. + */ + @JsonIgnore + public Optional getLast4() { + if (last4 == null) { + return Optional.empty(); + } + return last4; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("brand") + private Optional _getBrand() { + return brand; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_month") + private Optional _getExpMonth() { + return expMonth; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("exp_year") + private Optional _getExpYear() { + return expYear; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last4") + private Optional _getLast4() { + return last4; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntentPaymentMethodCard && equalTo((SetupIntentPaymentMethodCard) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntentPaymentMethodCard other) { + return brand.equals(other.brand) + && expMonth.equals(other.expMonth) + && expYear.equals(other.expYear) + && last4.equals(other.last4); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.brand, this.expMonth, this.expYear, this.last4); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional brand = Optional.empty(); + + private Optional expMonth = Optional.empty(); + + private Optional expYear = Optional.empty(); + + private Optional last4 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SetupIntentPaymentMethodCard other) { + brand(other.getBrand()); + expMonth(other.getExpMonth()); + expYear(other.getExpYear()); + last4(other.getLast4()); + return this; + } + + /** + *

The card network (e.g., visa, mastercard, amex). Null if the brand could not be determined.

+ */ + @JsonSetter(value = "brand", nulls = Nulls.SKIP) + public Builder brand(Optional brand) { + this.brand = brand; + return this; + } + + public Builder brand(CardBrands brand) { + this.brand = Optional.ofNullable(brand); + return this; + } + + public Builder brand(Nullable brand) { + if (brand.isNull()) { + this.brand = null; + } else if (brand.isEmpty()) { + this.brand = Optional.empty(); + } else { + this.brand = Optional.of(brand.get()); + } + return this; + } + + /** + *

The two-digit expiration month of the card (1-12). Null if not available.

+ */ + @JsonSetter(value = "exp_month", nulls = Nulls.SKIP) + public Builder expMonth(Optional expMonth) { + this.expMonth = expMonth; + return this; + } + + public Builder expMonth(Integer expMonth) { + this.expMonth = Optional.ofNullable(expMonth); + return this; + } + + public Builder expMonth(Nullable expMonth) { + if (expMonth.isNull()) { + this.expMonth = null; + } else if (expMonth.isEmpty()) { + this.expMonth = Optional.empty(); + } else { + this.expMonth = Optional.of(expMonth.get()); + } + return this; + } + + /** + *

The two-digit expiration year of the card (e.g., 27 for 2027). Null if not available.

+ */ + @JsonSetter(value = "exp_year", nulls = Nulls.SKIP) + public Builder expYear(Optional expYear) { + this.expYear = expYear; + return this; + } + + public Builder expYear(Integer expYear) { + this.expYear = Optional.ofNullable(expYear); + return this; + } + + public Builder expYear(Nullable expYear) { + if (expYear.isNull()) { + this.expYear = null; + } else if (expYear.isEmpty()) { + this.expYear = Optional.empty(); + } else { + this.expYear = Optional.of(expYear.get()); + } + return this; + } + + /** + *

The last four digits of the card number. Null if not available.

+ */ + @JsonSetter(value = "last4", nulls = Nulls.SKIP) + public Builder last4(Optional last4) { + this.last4 = last4; + return this; + } + + public Builder last4(String last4) { + this.last4 = Optional.ofNullable(last4); + return this; + } + + public Builder last4(Nullable last4) { + if (last4.isNull()) { + this.last4 = null; + } else if (last4.isEmpty()) { + this.last4 = Optional.empty(); + } else { + this.last4 = Optional.of(last4.get()); + } + return this; + } + + public SetupIntentPaymentMethodCard build() { + return new SetupIntentPaymentMethodCard(brand, expMonth, expYear, last4, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentPaymentMethodMailingAddress.java b/src/main/java/com/whop/api/types/SetupIntentPaymentMethodMailingAddress.java new file mode 100644 index 00000000..1311f482 --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentPaymentMethodMailingAddress.java @@ -0,0 +1,438 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupIntentPaymentMethodMailingAddress.Builder.class) +public final class SetupIntentPaymentMethodMailingAddress { + private final Optional city; + + private final Optional country; + + private final Optional line1; + + private final Optional line2; + + private final Optional name; + + private final Optional postalCode; + + private final Optional state; + + private final Map additionalProperties; + + private SetupIntentPaymentMethodMailingAddress( + Optional city, + Optional country, + Optional line1, + Optional line2, + Optional name, + Optional postalCode, + Optional state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.name = name; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + /** + * @return The city of the address. + */ + @JsonIgnore + public Optional getCity() { + if (city == null) { + return Optional.empty(); + } + return city; + } + + /** + * @return The country of the address. + */ + @JsonIgnore + public Optional getCountry() { + if (country == null) { + return Optional.empty(); + } + return country; + } + + /** + * @return The line 1 of the address. + */ + @JsonIgnore + public Optional getLine1() { + if (line1 == null) { + return Optional.empty(); + } + return line1; + } + + /** + * @return The line 2 of the address. + */ + @JsonIgnore + public Optional getLine2() { + if (line2 == null) { + return Optional.empty(); + } + return line2; + } + + /** + * @return The name of the customer. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The postal code of the address. + */ + @JsonIgnore + public Optional getPostalCode() { + if (postalCode == null) { + return Optional.empty(); + } + return postalCode; + } + + /** + * @return The state of the address. + */ + @JsonIgnore + public Optional getState() { + if (state == null) { + return Optional.empty(); + } + return state; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("city") + private Optional _getCity() { + return city; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("country") + private Optional _getCountry() { + return country; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line1") + private Optional _getLine1() { + return line1; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("line2") + private Optional _getLine2() { + return line2; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("postal_code") + private Optional _getPostalCode() { + return postalCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("state") + private Optional _getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupIntentPaymentMethodMailingAddress + && equalTo((SetupIntentPaymentMethodMailingAddress) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupIntentPaymentMethodMailingAddress other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && name.equals(other.name) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.name, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional city = Optional.empty(); + + private Optional country = Optional.empty(); + + private Optional line1 = Optional.empty(); + + private Optional line2 = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional postalCode = Optional.empty(); + + private Optional state = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SetupIntentPaymentMethodMailingAddress other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + name(other.getName()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + /** + *

The city of the address.

+ */ + @JsonSetter(value = "city", nulls = Nulls.SKIP) + public Builder city(Optional city) { + this.city = city; + return this; + } + + public Builder city(String city) { + this.city = Optional.ofNullable(city); + return this; + } + + public Builder city(Nullable city) { + if (city.isNull()) { + this.city = null; + } else if (city.isEmpty()) { + this.city = Optional.empty(); + } else { + this.city = Optional.of(city.get()); + } + return this; + } + + /** + *

The country of the address.

+ */ + @JsonSetter(value = "country", nulls = Nulls.SKIP) + public Builder country(Optional country) { + this.country = country; + return this; + } + + public Builder country(String country) { + this.country = Optional.ofNullable(country); + return this; + } + + public Builder country(Nullable country) { + if (country.isNull()) { + this.country = null; + } else if (country.isEmpty()) { + this.country = Optional.empty(); + } else { + this.country = Optional.of(country.get()); + } + return this; + } + + /** + *

The line 1 of the address.

+ */ + @JsonSetter(value = "line1", nulls = Nulls.SKIP) + public Builder line1(Optional line1) { + this.line1 = line1; + return this; + } + + public Builder line1(String line1) { + this.line1 = Optional.ofNullable(line1); + return this; + } + + public Builder line1(Nullable line1) { + if (line1.isNull()) { + this.line1 = null; + } else if (line1.isEmpty()) { + this.line1 = Optional.empty(); + } else { + this.line1 = Optional.of(line1.get()); + } + return this; + } + + /** + *

The line 2 of the address.

+ */ + @JsonSetter(value = "line2", nulls = Nulls.SKIP) + public Builder line2(Optional line2) { + this.line2 = line2; + return this; + } + + public Builder line2(String line2) { + this.line2 = Optional.ofNullable(line2); + return this; + } + + public Builder line2(Nullable line2) { + if (line2.isNull()) { + this.line2 = null; + } else if (line2.isEmpty()) { + this.line2 = Optional.empty(); + } else { + this.line2 = Optional.of(line2.get()); + } + return this; + } + + /** + *

The name of the customer.

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The postal code of the address.

+ */ + @JsonSetter(value = "postal_code", nulls = Nulls.SKIP) + public Builder postalCode(Optional postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = Optional.ofNullable(postalCode); + return this; + } + + public Builder postalCode(Nullable postalCode) { + if (postalCode.isNull()) { + this.postalCode = null; + } else if (postalCode.isEmpty()) { + this.postalCode = Optional.empty(); + } else { + this.postalCode = Optional.of(postalCode.get()); + } + return this; + } + + /** + *

The state of the address.

+ */ + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public Builder state(Optional state) { + this.state = state; + return this; + } + + public Builder state(String state) { + this.state = Optional.ofNullable(state); + return this; + } + + public Builder state(Nullable state) { + if (state.isNull()) { + this.state = null; + } else if (state.isEmpty()) { + this.state = Optional.empty(); + } else { + this.state = Optional.of(state.get()); + } + return this; + } + + public SetupIntentPaymentMethodMailingAddress build() { + return new SetupIntentPaymentMethodMailingAddress( + city, country, line1, line2, name, postalCode, state, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupIntentStatuses.java b/src/main/java/com/whop/api/types/SetupIntentStatuses.java new file mode 100644 index 00000000..a7fa9ba9 --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupIntentStatuses.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SetupIntentStatuses { + public static final SetupIntentStatuses SUCCEEDED = new SetupIntentStatuses(Value.SUCCEEDED, "succeeded"); + + public static final SetupIntentStatuses PROCESSING = new SetupIntentStatuses(Value.PROCESSING, "processing"); + + public static final SetupIntentStatuses CANCELED = new SetupIntentStatuses(Value.CANCELED, "canceled"); + + public static final SetupIntentStatuses REQUIRES_ACTION = + new SetupIntentStatuses(Value.REQUIRES_ACTION, "requires_action"); + + private final Value value; + + private final String string; + + SetupIntentStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SetupIntentStatuses && this.string.equals(((SetupIntentStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SUCCEEDED: + return visitor.visitSucceeded(); + case PROCESSING: + return visitor.visitProcessing(); + case CANCELED: + return visitor.visitCanceled(); + case REQUIRES_ACTION: + return visitor.visitRequiresAction(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SetupIntentStatuses valueOf(String value) { + switch (value) { + case "succeeded": + return SUCCEEDED; + case "processing": + return PROCESSING; + case "canceled": + return CANCELED; + case "requires_action": + return REQUIRES_ACTION; + default: + return new SetupIntentStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + PROCESSING, + + SUCCEEDED, + + CANCELED, + + REQUIRES_ACTION, + + UNKNOWN + } + + public interface Visitor { + T visitProcessing(); + + T visitSucceeded(); + + T visitCanceled(); + + T visitRequiresAction(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/SetupLastSetupError.java b/src/main/java/com/whop/api/types/SetupLastSetupError.java new file mode 100644 index 00000000..d7b40b65 --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupLastSetupError.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupLastSetupError.Builder.class) +public final class SetupLastSetupError { + private final Optional code; + + private final Optional message; + + private final Map additionalProperties; + + private SetupLastSetupError( + Optional code, Optional message, Map additionalProperties) { + this.code = code; + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return A machine-readable classification of the failure, e.g. enrollment_declined. Absent when the buyer simply abandoned the setup. + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + /** + * @return A human-readable explanation of the failure. + */ + @JsonIgnore + public Optional getMessage() { + if (message == null) { + return Optional.empty(); + } + return message; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("message") + private Optional _getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupLastSetupError && equalTo((SetupLastSetupError) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupLastSetupError other) { + return code.equals(other.code) && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional code = Optional.empty(); + + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SetupLastSetupError other) { + code(other.getCode()); + message(other.getMessage()); + return this; + } + + /** + *

A machine-readable classification of the failure, e.g. enrollment_declined. Absent when the buyer simply abandoned the setup.

+ */ + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public Builder code(Optional code) { + this.code = code; + return this; + } + + public Builder code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + public Builder code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

A human-readable explanation of the failure.

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public Builder message(Nullable message) { + if (message.isNull()) { + this.message = null; + } else if (message.isEmpty()) { + this.message = Optional.empty(); + } else { + this.message = Optional.of(message.get()); + } + return this; + } + + public SetupLastSetupError build() { + return new SetupLastSetupError(code, message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupStatus.java b/src/main/java/com/whop/api/types/SetupStatus.java new file mode 100644 index 00000000..e11a172f --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupStatus.java @@ -0,0 +1,416 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SetupStatus.Builder.class) +public final class SetupStatus { + private final String id; + + private final Optional lastSetupError; + + private final Optional nextAction; + + private final String object; + + private final Optional returnUrl; + + private final SetupStatusStatus status; + + private final Map additionalProperties; + + private SetupStatus( + String id, + Optional lastSetupError, + Optional nextAction, + String object, + Optional returnUrl, + SetupStatusStatus status, + Map additionalProperties) { + this.id = id; + this.lastSetupError = lastSetupError; + this.nextAction = nextAction; + this.object = object; + this.returnUrl = returnUrl; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The setup this status describes, prefixed sint_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Why the setup ended where it did, or null when nothing has failed. Present on canceled — a buyer who abandoned carries no code, one refused by the provider does. + */ + @JsonIgnore + public Optional getLastSetupError() { + if (lastSetupError == null) { + return Optional.empty(); + } + return lastSetupError; + } + + /** + * @return What the buyer must do next while status is requires_action, otherwise null. type picks the shape and each variant carries only its own data, so switching on type gives you exactly that step's payload. + */ + @JsonIgnore + public Optional getNextAction() { + if (nextAction == null) { + return Optional.empty(); + } + return nextAction; + } + + /** + * @return Always setup_status. + */ + @JsonProperty("object") + public String getObject() { + return object; + } + + /** + * @return Where to send the buyer once the setup reaches a resting state, or null to leave them where they are. + */ + @JsonIgnore + public Optional getReturnUrl() { + if (returnUrl == null) { + return Optional.empty(); + } + return returnUrl; + } + + /** + * @return How far the setup has got. A 200 means we answered, not that the method was saved — always branch on this. requires_action — the buyer has a step outstanding; see next_action. processing — the buyer has done their part and the processor is deciding. succeeded — the payment method is saved, and only this one means saved. canceled — abandoned or refused; see last_setup_error to tell which. + */ + @JsonProperty("status") + public SetupStatusStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_setup_error") + private Optional _getLastSetupError() { + return lastSetupError; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("next_action") + private Optional _getNextAction() { + return nextAction; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("return_url") + private Optional _getReturnUrl() { + return returnUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SetupStatus && equalTo((SetupStatus) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SetupStatus other) { + return id.equals(other.id) + && lastSetupError.equals(other.lastSetupError) + && nextAction.equals(other.nextAction) + && object.equals(other.object) + && returnUrl.equals(other.returnUrl) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.lastSetupError, this.nextAction, this.object, this.returnUrl, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The setup this status describes, prefixed sint_.

+ */ + ObjectStage id(@NotNull String id); + + Builder from(SetupStatus other); + } + + public interface ObjectStage { + /** + *

Always setup_status.

+ */ + StatusStage object(@NotNull String object); + } + + public interface StatusStage { + /** + *

How far the setup has got. A 200 means we answered, not that the method was saved — always branch on this. requires_action — the buyer has a step outstanding; see next_action. processing — the buyer has done their part and the processor is deciding. succeeded — the payment method is saved, and only this one means saved. canceled — abandoned or refused; see last_setup_error to tell which.

+ */ + _FinalStage status(@NotNull SetupStatusStatus status); + } + + public interface _FinalStage { + SetupStatus build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Why the setup ended where it did, or null when nothing has failed. Present on canceled — a buyer who abandoned carries no code, one refused by the provider does.

+ */ + _FinalStage lastSetupError(Optional lastSetupError); + + _FinalStage lastSetupError(SetupLastSetupError lastSetupError); + + _FinalStage lastSetupError(Nullable lastSetupError); + + /** + *

What the buyer must do next while status is requires_action, otherwise null. type picks the shape and each variant carries only its own data, so switching on type gives you exactly that step's payload.

+ */ + _FinalStage nextAction(Optional nextAction); + + _FinalStage nextAction(PaymentNextAction nextAction); + + _FinalStage nextAction(Nullable nextAction); + + /** + *

Where to send the buyer once the setup reaches a resting state, or null to leave them where they are.

+ */ + _FinalStage returnUrl(Optional returnUrl); + + _FinalStage returnUrl(String returnUrl); + + _FinalStage returnUrl(Nullable returnUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ObjectStage, StatusStage, _FinalStage { + private String id; + + private String object; + + private SetupStatusStatus status; + + private Optional returnUrl = Optional.empty(); + + private Optional nextAction = Optional.empty(); + + private Optional lastSetupError = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SetupStatus other) { + id(other.getId()); + lastSetupError(other.getLastSetupError()); + nextAction(other.getNextAction()); + object(other.getObject()); + returnUrl(other.getReturnUrl()); + status(other.getStatus()); + return this; + } + + /** + *

The setup this status describes, prefixed sint_.

+ *

The setup this status describes, prefixed sint_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ObjectStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Always setup_status.

+ *

Always setup_status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("object") + public StatusStage object(@NotNull String object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

How far the setup has got. A 200 means we answered, not that the method was saved — always branch on this. requires_action — the buyer has a step outstanding; see next_action. processing — the buyer has done their part and the processor is deciding. succeeded — the payment method is saved, and only this one means saved. canceled — abandoned or refused; see last_setup_error to tell which.

+ *

How far the setup has got. A 200 means we answered, not that the method was saved — always branch on this. requires_action — the buyer has a step outstanding; see next_action. processing — the buyer has done their part and the processor is deciding. succeeded — the payment method is saved, and only this one means saved. canceled — abandoned or refused; see last_setup_error to tell which.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull SetupStatusStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Where to send the buyer once the setup reaches a resting state, or null to leave them where they are.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(Nullable returnUrl) { + if (returnUrl.isNull()) { + this.returnUrl = null; + } else if (returnUrl.isEmpty()) { + this.returnUrl = Optional.empty(); + } else { + this.returnUrl = Optional.of(returnUrl.get()); + } + return this; + } + + /** + *

Where to send the buyer once the setup reaches a resting state, or null to leave them where they are.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage returnUrl(String returnUrl) { + this.returnUrl = Optional.ofNullable(returnUrl); + return this; + } + + /** + *

Where to send the buyer once the setup reaches a resting state, or null to leave them where they are.

+ */ + @java.lang.Override + @JsonSetter(value = "return_url", nulls = Nulls.SKIP) + public _FinalStage returnUrl(Optional returnUrl) { + this.returnUrl = returnUrl; + return this; + } + + /** + *

What the buyer must do next while status is requires_action, otherwise null. type picks the shape and each variant carries only its own data, so switching on type gives you exactly that step's payload.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nextAction(Nullable nextAction) { + if (nextAction.isNull()) { + this.nextAction = null; + } else if (nextAction.isEmpty()) { + this.nextAction = Optional.empty(); + } else { + this.nextAction = Optional.of(nextAction.get()); + } + return this; + } + + /** + *

What the buyer must do next while status is requires_action, otherwise null. type picks the shape and each variant carries only its own data, so switching on type gives you exactly that step's payload.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nextAction(PaymentNextAction nextAction) { + this.nextAction = Optional.ofNullable(nextAction); + return this; + } + + /** + *

What the buyer must do next while status is requires_action, otherwise null. type picks the shape and each variant carries only its own data, so switching on type gives you exactly that step's payload.

+ */ + @java.lang.Override + @JsonSetter(value = "next_action", nulls = Nulls.SKIP) + public _FinalStage nextAction(Optional nextAction) { + this.nextAction = nextAction; + return this; + } + + /** + *

Why the setup ended where it did, or null when nothing has failed. Present on canceled — a buyer who abandoned carries no code, one refused by the provider does.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastSetupError(Nullable lastSetupError) { + if (lastSetupError.isNull()) { + this.lastSetupError = null; + } else if (lastSetupError.isEmpty()) { + this.lastSetupError = Optional.empty(); + } else { + this.lastSetupError = Optional.of(lastSetupError.get()); + } + return this; + } + + /** + *

Why the setup ended where it did, or null when nothing has failed. Present on canceled — a buyer who abandoned carries no code, one refused by the provider does.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastSetupError(SetupLastSetupError lastSetupError) { + this.lastSetupError = Optional.ofNullable(lastSetupError); + return this; + } + + /** + *

Why the setup ended where it did, or null when nothing has failed. Present on canceled — a buyer who abandoned carries no code, one refused by the provider does.

+ */ + @java.lang.Override + @JsonSetter(value = "last_setup_error", nulls = Nulls.SKIP) + public _FinalStage lastSetupError(Optional lastSetupError) { + this.lastSetupError = lastSetupError; + return this; + } + + @java.lang.Override + public SetupStatus build() { + return new SetupStatus(id, lastSetupError, nextAction, object, returnUrl, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SetupStatusStatus.java b/src/main/java/com/whop/api/types/SetupStatusStatus.java new file mode 100644 index 00000000..c8322fb8 --- /dev/null +++ b/src/main/java/com/whop/api/types/SetupStatusStatus.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SetupStatusStatus { + public static final SetupStatusStatus SUCCEEDED = new SetupStatusStatus(Value.SUCCEEDED, "succeeded"); + + public static final SetupStatusStatus PROCESSING = new SetupStatusStatus(Value.PROCESSING, "processing"); + + public static final SetupStatusStatus CANCELED = new SetupStatusStatus(Value.CANCELED, "canceled"); + + public static final SetupStatusStatus REQUIRES_ACTION = + new SetupStatusStatus(Value.REQUIRES_ACTION, "requires_action"); + + private final Value value; + + private final String string; + + SetupStatusStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SetupStatusStatus && this.string.equals(((SetupStatusStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SUCCEEDED: + return visitor.visitSucceeded(); + case PROCESSING: + return visitor.visitProcessing(); + case CANCELED: + return visitor.visitCanceled(); + case REQUIRES_ACTION: + return visitor.visitRequiresAction(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SetupStatusStatus valueOf(String value) { + switch (value) { + case "succeeded": + return SUCCEEDED; + case "processing": + return PROCESSING; + case "canceled": + return CANCELED; + case "requires_action": + return REQUIRES_ACTION; + default: + return new SetupStatusStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PROCESSING, + + SUCCEEDED, + + CANCELED, + + REQUIRES_ACTION, + + UNKNOWN + } + + public interface Visitor { + T visitProcessing(); + + T visitSucceeded(); + + T visitCanceled(); + + T visitRequiresAction(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Shipment.java b/src/main/java/com/whop/api/types/Shipment.java new file mode 100644 index 00000000..8caf8ec4 --- /dev/null +++ b/src/main/java/com/whop/api/types/Shipment.java @@ -0,0 +1,526 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Shipment.Builder.class) +public final class Shipment { + private final String accountId; + + private final Optional carrier; + + private final List checkpoints; + + private final String createdAt; + + private final String id; + + private final String paymentId; + + private final ShipmentStatus status; + + private final String trackingNumber; + + private final String trackingUrl; + + private final String updatedAt; + + private final Map additionalProperties; + + private Shipment( + String accountId, + Optional carrier, + List checkpoints, + String createdAt, + String id, + String paymentId, + ShipmentStatus status, + String trackingNumber, + String trackingUrl, + String updatedAt, + Map additionalProperties) { + this.accountId = accountId; + this.carrier = carrier; + this.checkpoints = checkpoints; + this.createdAt = createdAt; + this.id = id; + this.paymentId = paymentId; + this.status = status; + this.trackingNumber = trackingNumber; + this.trackingUrl = trackingUrl; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account that owns this shipment, prefixed biz_. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return The shipping carrier detected for this shipment. Null until a tracking update identifies it. + */ + @JsonIgnore + public Optional getCarrier() { + if (carrier == null) { + return Optional.empty(); + } + return carrier; + } + + @JsonProperty("checkpoints") + public List getCheckpoints() { + return checkpoints; + } + + /** + * @return The datetime the shipment was created (ISO 8601). + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Shipment ID, prefixed ship_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The payment this shipment fulfills, prefixed pay_. + */ + @JsonProperty("payment_id") + public String getPaymentId() { + return paymentId; + } + + /** + * @return The current delivery status of this shipment. + */ + @JsonProperty("status") + public ShipmentStatus getStatus() { + return status; + } + + /** + * @return The carrier-assigned tracking number used to look up shipment progress. + */ + @JsonProperty("tracking_number") + public String getTrackingNumber() { + return trackingNumber; + } + + /** + * @return A customer-facing URL to track this shipment's progress. + */ + @JsonProperty("tracking_url") + public String getTrackingUrl() { + return trackingUrl; + } + + /** + * @return The datetime the shipment was last updated (ISO 8601). + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("carrier") + private Optional _getCarrier() { + return carrier; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Shipment && equalTo((Shipment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Shipment other) { + return accountId.equals(other.accountId) + && carrier.equals(other.carrier) + && checkpoints.equals(other.checkpoints) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && paymentId.equals(other.paymentId) + && status.equals(other.status) + && trackingNumber.equals(other.trackingNumber) + && trackingUrl.equals(other.trackingUrl) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.carrier, + this.checkpoints, + this.createdAt, + this.id, + this.paymentId, + this.status, + this.trackingNumber, + this.trackingUrl, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

The account that owns this shipment, prefixed biz_.

+ */ + CreatedAtStage accountId(@NotNull String accountId); + + Builder from(Shipment other); + } + + public interface CreatedAtStage { + /** + *

The datetime the shipment was created (ISO 8601).

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Shipment ID, prefixed ship_.

+ */ + PaymentIdStage id(@NotNull String id); + } + + public interface PaymentIdStage { + /** + *

The payment this shipment fulfills, prefixed pay_.

+ */ + StatusStage paymentId(@NotNull String paymentId); + } + + public interface StatusStage { + /** + *

The current delivery status of this shipment.

+ */ + TrackingNumberStage status(@NotNull ShipmentStatus status); + } + + public interface TrackingNumberStage { + /** + *

The carrier-assigned tracking number used to look up shipment progress.

+ */ + TrackingUrlStage trackingNumber(@NotNull String trackingNumber); + } + + public interface TrackingUrlStage { + /** + *

A customer-facing URL to track this shipment's progress.

+ */ + UpdatedAtStage trackingUrl(@NotNull String trackingUrl); + } + + public interface UpdatedAtStage { + /** + *

The datetime the shipment was last updated (ISO 8601).

+ */ + _FinalStage updatedAt(@NotNull String updatedAt); + } + + public interface _FinalStage { + Shipment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The shipping carrier detected for this shipment. Null until a tracking update identifies it.

+ */ + _FinalStage carrier(Optional carrier); + + _FinalStage carrier(String carrier); + + _FinalStage carrier(Nullable carrier); + + _FinalStage checkpoints(List checkpoints); + + _FinalStage addCheckpoints(ShipmentCheckpoint checkpoints); + + _FinalStage addAllCheckpoints(List checkpoints); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, + CreatedAtStage, + IdStage, + PaymentIdStage, + StatusStage, + TrackingNumberStage, + TrackingUrlStage, + UpdatedAtStage, + _FinalStage { + private String accountId; + + private String createdAt; + + private String id; + + private String paymentId; + + private ShipmentStatus status; + + private String trackingNumber; + + private String trackingUrl; + + private String updatedAt; + + private List checkpoints = new ArrayList<>(); + + private Optional carrier = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Shipment other) { + accountId(other.getAccountId()); + carrier(other.getCarrier()); + checkpoints(other.getCheckpoints()); + createdAt(other.getCreatedAt()); + id(other.getId()); + paymentId(other.getPaymentId()); + status(other.getStatus()); + trackingNumber(other.getTrackingNumber()); + trackingUrl(other.getTrackingUrl()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

The account that owns this shipment, prefixed biz_.

+ *

The account that owns this shipment, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public CreatedAtStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

The datetime the shipment was created (ISO 8601).

+ *

The datetime the shipment was created (ISO 8601).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Shipment ID, prefixed ship_.

+ *

Shipment ID, prefixed ship_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PaymentIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The payment this shipment fulfills, prefixed pay_.

+ *

The payment this shipment fulfills, prefixed pay_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("payment_id") + public StatusStage paymentId(@NotNull String paymentId) { + this.paymentId = Objects.requireNonNull(paymentId, "paymentId must not be null"); + return this; + } + + /** + *

The current delivery status of this shipment.

+ *

The current delivery status of this shipment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TrackingNumberStage status(@NotNull ShipmentStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The carrier-assigned tracking number used to look up shipment progress.

+ *

The carrier-assigned tracking number used to look up shipment progress.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tracking_number") + public TrackingUrlStage trackingNumber(@NotNull String trackingNumber) { + this.trackingNumber = Objects.requireNonNull(trackingNumber, "trackingNumber must not be null"); + return this; + } + + /** + *

A customer-facing URL to track this shipment's progress.

+ *

A customer-facing URL to track this shipment's progress.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tracking_url") + public UpdatedAtStage trackingUrl(@NotNull String trackingUrl) { + this.trackingUrl = Objects.requireNonNull(trackingUrl, "trackingUrl must not be null"); + return this; + } + + /** + *

The datetime the shipment was last updated (ISO 8601).

+ *

The datetime the shipment was last updated (ISO 8601).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllCheckpoints(List checkpoints) { + if (checkpoints != null) { + this.checkpoints.addAll(checkpoints); + } + return this; + } + + @java.lang.Override + public _FinalStage addCheckpoints(ShipmentCheckpoint checkpoints) { + this.checkpoints.add(checkpoints); + return this; + } + + @java.lang.Override + @JsonSetter(value = "checkpoints", nulls = Nulls.SKIP) + public _FinalStage checkpoints(List checkpoints) { + this.checkpoints.clear(); + if (checkpoints != null) { + this.checkpoints.addAll(checkpoints); + } + return this; + } + + /** + *

The shipping carrier detected for this shipment. Null until a tracking update identifies it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage carrier(Nullable carrier) { + if (carrier.isNull()) { + this.carrier = null; + } else if (carrier.isEmpty()) { + this.carrier = Optional.empty(); + } else { + this.carrier = Optional.of(carrier.get()); + } + return this; + } + + /** + *

The shipping carrier detected for this shipment. Null until a tracking update identifies it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage carrier(String carrier) { + this.carrier = Optional.ofNullable(carrier); + return this; + } + + /** + *

The shipping carrier detected for this shipment. Null until a tracking update identifies it.

+ */ + @java.lang.Override + @JsonSetter(value = "carrier", nulls = Nulls.SKIP) + public _FinalStage carrier(Optional carrier) { + this.carrier = carrier; + return this; + } + + @java.lang.Override + public Shipment build() { + return new Shipment( + accountId, + carrier, + checkpoints, + createdAt, + id, + paymentId, + status, + trackingNumber, + trackingUrl, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ShipmentCheckpoint.java b/src/main/java/com/whop/api/types/ShipmentCheckpoint.java new file mode 100644 index 00000000..94b053c6 --- /dev/null +++ b/src/main/java/com/whop/api/types/ShipmentCheckpoint.java @@ -0,0 +1,346 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ShipmentCheckpoint.Builder.class) +public final class ShipmentCheckpoint { + private final Optional location; + + private final Optional message; + + private final ShipmentCheckpointStatus status; + + private final Optional timestamp; + + private final Map additionalProperties; + + private ShipmentCheckpoint( + Optional location, + Optional message, + ShipmentCheckpointStatus status, + Optional timestamp, + Map additionalProperties) { + this.location = location; + this.message = message; + this.status = status; + this.timestamp = timestamp; + this.additionalProperties = additionalProperties; + } + + /** + * @return Where the carrier recorded the scan, such as PHILADELPHIA, PA. Null when the carrier sent none. + */ + @JsonIgnore + public Optional getLocation() { + if (location == null) { + return Optional.empty(); + } + return location; + } + + /** + * @return Carrier's description of the scan, such as Departed USPS Regional Facility. Null when the carrier sent none. + */ + @JsonIgnore + public Optional getMessage() { + if (message == null) { + return Optional.empty(); + } + return message; + } + + /** + * @return Delivery status this carrier scan maps to. + */ + @JsonProperty("status") + public ShipmentCheckpointStatus getStatus() { + return status; + } + + /** + * @return When the carrier recorded the scan, as an ISO 8601 timestamp. Null when the carrier sent no scan time. + */ + @JsonIgnore + public Optional getTimestamp() { + if (timestamp == null) { + return Optional.empty(); + } + return timestamp; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("location") + private Optional _getLocation() { + return location; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("message") + private Optional _getMessage() { + return message; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("timestamp") + private Optional _getTimestamp() { + return timestamp; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ShipmentCheckpoint && equalTo((ShipmentCheckpoint) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ShipmentCheckpoint other) { + return location.equals(other.location) + && message.equals(other.message) + && status.equals(other.status) + && timestamp.equals(other.timestamp); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.location, this.message, this.status, this.timestamp); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StatusStage builder() { + return new Builder(); + } + + public interface StatusStage { + /** + *

Delivery status this carrier scan maps to.

+ */ + _FinalStage status(@NotNull ShipmentCheckpointStatus status); + + Builder from(ShipmentCheckpoint other); + } + + public interface _FinalStage { + ShipmentCheckpoint build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Where the carrier recorded the scan, such as PHILADELPHIA, PA. Null when the carrier sent none.

+ */ + _FinalStage location(Optional location); + + _FinalStage location(String location); + + _FinalStage location(Nullable location); + + /** + *

Carrier's description of the scan, such as Departed USPS Regional Facility. Null when the carrier sent none.

+ */ + _FinalStage message(Optional message); + + _FinalStage message(String message); + + _FinalStage message(Nullable message); + + /** + *

When the carrier recorded the scan, as an ISO 8601 timestamp. Null when the carrier sent no scan time.

+ */ + _FinalStage timestamp(Optional timestamp); + + _FinalStage timestamp(String timestamp); + + _FinalStage timestamp(Nullable timestamp); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StatusStage, _FinalStage { + private ShipmentCheckpointStatus status; + + private Optional timestamp = Optional.empty(); + + private Optional message = Optional.empty(); + + private Optional location = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ShipmentCheckpoint other) { + location(other.getLocation()); + message(other.getMessage()); + status(other.getStatus()); + timestamp(other.getTimestamp()); + return this; + } + + /** + *

Delivery status this carrier scan maps to.

+ *

Delivery status this carrier scan maps to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull ShipmentCheckpointStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

When the carrier recorded the scan, as an ISO 8601 timestamp. Null when the carrier sent no scan time.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timestamp(Nullable timestamp) { + if (timestamp.isNull()) { + this.timestamp = null; + } else if (timestamp.isEmpty()) { + this.timestamp = Optional.empty(); + } else { + this.timestamp = Optional.of(timestamp.get()); + } + return this; + } + + /** + *

When the carrier recorded the scan, as an ISO 8601 timestamp. Null when the carrier sent no scan time.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + /** + *

When the carrier recorded the scan, as an ISO 8601 timestamp. Null when the carrier sent no scan time.

+ */ + @java.lang.Override + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public _FinalStage timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + *

Carrier's description of the scan, such as Departed USPS Regional Facility. Null when the carrier sent none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage message(Nullable message) { + if (message.isNull()) { + this.message = null; + } else if (message.isEmpty()) { + this.message = Optional.empty(); + } else { + this.message = Optional.of(message.get()); + } + return this; + } + + /** + *

Carrier's description of the scan, such as Departed USPS Regional Facility. Null when the carrier sent none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + /** + *

Carrier's description of the scan, such as Departed USPS Regional Facility. Null when the carrier sent none.

+ */ + @java.lang.Override + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public _FinalStage message(Optional message) { + this.message = message; + return this; + } + + /** + *

Where the carrier recorded the scan, such as PHILADELPHIA, PA. Null when the carrier sent none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage location(Nullable location) { + if (location.isNull()) { + this.location = null; + } else if (location.isEmpty()) { + this.location = Optional.empty(); + } else { + this.location = Optional.of(location.get()); + } + return this; + } + + /** + *

Where the carrier recorded the scan, such as PHILADELPHIA, PA. Null when the carrier sent none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage location(String location) { + this.location = Optional.ofNullable(location); + return this; + } + + /** + *

Where the carrier recorded the scan, such as PHILADELPHIA, PA. Null when the carrier sent none.

+ */ + @java.lang.Override + @JsonSetter(value = "location", nulls = Nulls.SKIP) + public _FinalStage location(Optional location) { + this.location = location; + return this; + } + + @java.lang.Override + public ShipmentCheckpoint build() { + return new ShipmentCheckpoint(location, message, status, timestamp, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ShipmentCheckpointStatus.java b/src/main/java/com/whop/api/types/ShipmentCheckpointStatus.java new file mode 100644 index 00000000..657733ff --- /dev/null +++ b/src/main/java/com/whop/api/types/ShipmentCheckpointStatus.java @@ -0,0 +1,169 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ShipmentCheckpointStatus { + public static final ShipmentCheckpointStatus DELIVERED = new ShipmentCheckpointStatus(Value.DELIVERED, "delivered"); + + public static final ShipmentCheckpointStatus FAILURE = new ShipmentCheckpointStatus(Value.FAILURE, "failure"); + + public static final ShipmentCheckpointStatus PRE_TRANSIT = + new ShipmentCheckpointStatus(Value.PRE_TRANSIT, "pre_transit"); + + public static final ShipmentCheckpointStatus UNKNOWN = new ShipmentCheckpointStatus(Value.UNKNOWN, "unknown"); + + public static final ShipmentCheckpointStatus RETURN_TO_SENDER = + new ShipmentCheckpointStatus(Value.RETURN_TO_SENDER, "return_to_sender"); + + public static final ShipmentCheckpointStatus CANCELLED = new ShipmentCheckpointStatus(Value.CANCELLED, "cancelled"); + + public static final ShipmentCheckpointStatus ERROR = new ShipmentCheckpointStatus(Value.ERROR, "error"); + + public static final ShipmentCheckpointStatus OUT_FOR_DELIVERY = + new ShipmentCheckpointStatus(Value.OUT_FOR_DELIVERY, "out_for_delivery"); + + public static final ShipmentCheckpointStatus AVAILABLE_FOR_PICKUP = + new ShipmentCheckpointStatus(Value.AVAILABLE_FOR_PICKUP, "available_for_pickup"); + + public static final ShipmentCheckpointStatus IN_TRANSIT = + new ShipmentCheckpointStatus(Value.IN_TRANSIT, "in_transit"); + + private final Value value; + + private final String string; + + ShipmentCheckpointStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ShipmentCheckpointStatus + && this.string.equals(((ShipmentCheckpointStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DELIVERED: + return visitor.visitDelivered(); + case FAILURE: + return visitor.visitFailure(); + case PRE_TRANSIT: + return visitor.visitPreTransit(); + case UNKNOWN: + return visitor.visitUnknown(); + case RETURN_TO_SENDER: + return visitor.visitReturnToSender(); + case CANCELLED: + return visitor.visitCancelled(); + case ERROR: + return visitor.visitError(); + case OUT_FOR_DELIVERY: + return visitor.visitOutForDelivery(); + case AVAILABLE_FOR_PICKUP: + return visitor.visitAvailableForPickup(); + case IN_TRANSIT: + return visitor.visitInTransit(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ShipmentCheckpointStatus valueOf(String value) { + switch (value) { + case "delivered": + return DELIVERED; + case "failure": + return FAILURE; + case "pre_transit": + return PRE_TRANSIT; + case "unknown": + return UNKNOWN; + case "return_to_sender": + return RETURN_TO_SENDER; + case "cancelled": + return CANCELLED; + case "error": + return ERROR; + case "out_for_delivery": + return OUT_FOR_DELIVERY; + case "available_for_pickup": + return AVAILABLE_FOR_PICKUP; + case "in_transit": + return IN_TRANSIT; + default: + return new ShipmentCheckpointStatus(Value._UNKNOWN, value); + } + } + + public enum Value { + UNKNOWN, + + PRE_TRANSIT, + + IN_TRANSIT, + + OUT_FOR_DELIVERY, + + DELIVERED, + + AVAILABLE_FOR_PICKUP, + + RETURN_TO_SENDER, + + FAILURE, + + CANCELLED, + + ERROR, + + _UNKNOWN + } + + public interface Visitor { + T visitUnknown(); + + T visitPreTransit(); + + T visitInTransit(); + + T visitOutForDelivery(); + + T visitDelivered(); + + T visitAvailableForPickup(); + + T visitReturnToSender(); + + T visitFailure(); + + T visitCancelled(); + + T visitError(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ShipmentListItem.java b/src/main/java/com/whop/api/types/ShipmentListItem.java new file mode 100644 index 00000000..b296a8fc --- /dev/null +++ b/src/main/java/com/whop/api/types/ShipmentListItem.java @@ -0,0 +1,577 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ShipmentListItem.Builder.class) +public final class ShipmentListItem { + private final OffsetDateTime createdAt; + + private final Optional deliveryEstimate; + + private final String id; + + private final Optional payment; + + private final Optional service; + + private final ShipmentStatuses status; + + private final Optional substatus; + + private final String trackingCode; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private ShipmentListItem( + OffsetDateTime createdAt, + Optional deliveryEstimate, + String id, + Optional payment, + Optional service, + ShipmentStatuses status, + Optional substatus, + String trackingCode, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.createdAt = createdAt; + this.deliveryEstimate = deliveryEstimate; + this.id = id; + this.payment = payment; + this.service = service; + this.status = status; + this.substatus = substatus; + this.trackingCode = trackingCode; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The datetime the shipment was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The estimated delivery date for this shipment. Null if the carrier has not provided an estimate. + */ + @JsonIgnore + public Optional getDeliveryEstimate() { + if (deliveryEstimate == null) { + return Optional.empty(); + } + return deliveryEstimate; + } + + /** + * @return The unique identifier for the shipment. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The payment associated with this shipment. Null if the payment has been deleted or is inaccessible. + */ + @JsonIgnore + public Optional getPayment() { + if (payment == null) { + return Optional.empty(); + } + return payment; + } + + /** + * @return The shipping service level used for this shipment. Null if the carrier does not specify a service tier. + */ + @JsonIgnore + public Optional getService() { + if (service == null) { + return Optional.empty(); + } + return service; + } + + /** + * @return The current delivery status of this shipment. + */ + @JsonProperty("status") + public ShipmentStatuses getStatus() { + return status; + } + + /** + * @return A more granular status providing additional detail about the shipment's current state. Null if no substatus applies. + */ + @JsonIgnore + public Optional getSubstatus() { + if (substatus == null) { + return Optional.empty(); + } + return substatus; + } + + /** + * @return The carrier-assigned tracking number used to look up shipment progress. + */ + @JsonProperty("tracking_code") + public String getTrackingCode() { + return trackingCode; + } + + /** + * @return The datetime the shipment was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("delivery_estimate") + private Optional _getDeliveryEstimate() { + return deliveryEstimate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payment") + private Optional _getPayment() { + return payment; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("service") + private Optional _getService() { + return service; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("substatus") + private Optional _getSubstatus() { + return substatus; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ShipmentListItem && equalTo((ShipmentListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ShipmentListItem other) { + return createdAt.equals(other.createdAt) + && deliveryEstimate.equals(other.deliveryEstimate) + && id.equals(other.id) + && payment.equals(other.payment) + && service.equals(other.service) + && status.equals(other.status) + && substatus.equals(other.substatus) + && trackingCode.equals(other.trackingCode) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, + this.deliveryEstimate, + this.id, + this.payment, + this.service, + this.status, + this.substatus, + this.trackingCode, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the shipment was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(ShipmentListItem other); + } + + public interface IdStage { + /** + *

The unique identifier for the shipment.

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

The current delivery status of this shipment.

+ */ + TrackingCodeStage status(@NotNull ShipmentStatuses status); + } + + public interface TrackingCodeStage { + /** + *

The carrier-assigned tracking number used to look up shipment progress.

+ */ + UpdatedAtStage trackingCode(@NotNull String trackingCode); + } + + public interface UpdatedAtStage { + /** + *

The datetime the shipment was last updated.

+ */ + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + ShipmentListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The estimated delivery date for this shipment. Null if the carrier has not provided an estimate.

+ */ + _FinalStage deliveryEstimate(Optional deliveryEstimate); + + _FinalStage deliveryEstimate(OffsetDateTime deliveryEstimate); + + _FinalStage deliveryEstimate(Nullable deliveryEstimate); + + /** + *

The payment associated with this shipment. Null if the payment has been deleted or is inaccessible.

+ */ + _FinalStage payment(Optional payment); + + _FinalStage payment(ShipmentListItemPayment payment); + + _FinalStage payment(Nullable payment); + + /** + *

The shipping service level used for this shipment. Null if the carrier does not specify a service tier.

+ */ + _FinalStage service(Optional service); + + _FinalStage service(String service); + + _FinalStage service(Nullable service); + + /** + *

A more granular status providing additional detail about the shipment's current state. Null if no substatus applies.

+ */ + _FinalStage substatus(Optional substatus); + + _FinalStage substatus(ShipmentSubstatuses substatus); + + _FinalStage substatus(Nullable substatus); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IdStage, StatusStage, TrackingCodeStage, UpdatedAtStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private ShipmentStatuses status; + + private String trackingCode; + + private OffsetDateTime updatedAt; + + private Optional substatus = Optional.empty(); + + private Optional service = Optional.empty(); + + private Optional payment = Optional.empty(); + + private Optional deliveryEstimate = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ShipmentListItem other) { + createdAt(other.getCreatedAt()); + deliveryEstimate(other.getDeliveryEstimate()); + id(other.getId()); + payment(other.getPayment()); + service(other.getService()); + status(other.getStatus()); + substatus(other.getSubstatus()); + trackingCode(other.getTrackingCode()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

The datetime the shipment was created.

+ *

The datetime the shipment was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the shipment.

+ *

The unique identifier for the shipment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current delivery status of this shipment.

+ *

The current delivery status of this shipment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TrackingCodeStage status(@NotNull ShipmentStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The carrier-assigned tracking number used to look up shipment progress.

+ *

The carrier-assigned tracking number used to look up shipment progress.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tracking_code") + public UpdatedAtStage trackingCode(@NotNull String trackingCode) { + this.trackingCode = Objects.requireNonNull(trackingCode, "trackingCode must not be null"); + return this; + } + + /** + *

The datetime the shipment was last updated.

+ *

The datetime the shipment was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

A more granular status providing additional detail about the shipment's current state. Null if no substatus applies.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage substatus(Nullable substatus) { + if (substatus.isNull()) { + this.substatus = null; + } else if (substatus.isEmpty()) { + this.substatus = Optional.empty(); + } else { + this.substatus = Optional.of(substatus.get()); + } + return this; + } + + /** + *

A more granular status providing additional detail about the shipment's current state. Null if no substatus applies.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage substatus(ShipmentSubstatuses substatus) { + this.substatus = Optional.ofNullable(substatus); + return this; + } + + /** + *

A more granular status providing additional detail about the shipment's current state. Null if no substatus applies.

+ */ + @java.lang.Override + @JsonSetter(value = "substatus", nulls = Nulls.SKIP) + public _FinalStage substatus(Optional substatus) { + this.substatus = substatus; + return this; + } + + /** + *

The shipping service level used for this shipment. Null if the carrier does not specify a service tier.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage service(Nullable service) { + if (service.isNull()) { + this.service = null; + } else if (service.isEmpty()) { + this.service = Optional.empty(); + } else { + this.service = Optional.of(service.get()); + } + return this; + } + + /** + *

The shipping service level used for this shipment. Null if the carrier does not specify a service tier.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage service(String service) { + this.service = Optional.ofNullable(service); + return this; + } + + /** + *

The shipping service level used for this shipment. Null if the carrier does not specify a service tier.

+ */ + @java.lang.Override + @JsonSetter(value = "service", nulls = Nulls.SKIP) + public _FinalStage service(Optional service) { + this.service = service; + return this; + } + + /** + *

The payment associated with this shipment. Null if the payment has been deleted or is inaccessible.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(Nullable payment) { + if (payment.isNull()) { + this.payment = null; + } else if (payment.isEmpty()) { + this.payment = Optional.empty(); + } else { + this.payment = Optional.of(payment.get()); + } + return this; + } + + /** + *

The payment associated with this shipment. Null if the payment has been deleted or is inaccessible.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payment(ShipmentListItemPayment payment) { + this.payment = Optional.ofNullable(payment); + return this; + } + + /** + *

The payment associated with this shipment. Null if the payment has been deleted or is inaccessible.

+ */ + @java.lang.Override + @JsonSetter(value = "payment", nulls = Nulls.SKIP) + public _FinalStage payment(Optional payment) { + this.payment = payment; + return this; + } + + /** + *

The estimated delivery date for this shipment. Null if the carrier has not provided an estimate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage deliveryEstimate(Nullable deliveryEstimate) { + if (deliveryEstimate.isNull()) { + this.deliveryEstimate = null; + } else if (deliveryEstimate.isEmpty()) { + this.deliveryEstimate = Optional.empty(); + } else { + this.deliveryEstimate = Optional.of(deliveryEstimate.get()); + } + return this; + } + + /** + *

The estimated delivery date for this shipment. Null if the carrier has not provided an estimate.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage deliveryEstimate(OffsetDateTime deliveryEstimate) { + this.deliveryEstimate = Optional.ofNullable(deliveryEstimate); + return this; + } + + /** + *

The estimated delivery date for this shipment. Null if the carrier has not provided an estimate.

+ */ + @java.lang.Override + @JsonSetter(value = "delivery_estimate", nulls = Nulls.SKIP) + public _FinalStage deliveryEstimate(Optional deliveryEstimate) { + this.deliveryEstimate = deliveryEstimate; + return this; + } + + @java.lang.Override + public ShipmentListItem build() { + return new ShipmentListItem( + createdAt, + deliveryEstimate, + id, + payment, + service, + status, + substatus, + trackingCode, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ShipmentListItemPayment.java b/src/main/java/com/whop/api/types/ShipmentListItemPayment.java new file mode 100644 index 00000000..4184e120 --- /dev/null +++ b/src/main/java/com/whop/api/types/ShipmentListItemPayment.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ShipmentListItemPayment.Builder.class) +public final class ShipmentListItemPayment { + private final String id; + + private final Map additionalProperties; + + private ShipmentListItemPayment(String id, Map additionalProperties) { + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the payment. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ShipmentListItemPayment && equalTo((ShipmentListItemPayment) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ShipmentListItemPayment other) { + return id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the payment.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(ShipmentListItemPayment other); + } + + public interface _FinalStage { + ShipmentListItemPayment build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ShipmentListItemPayment other) { + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the payment.

+ *

The unique identifier for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public ShipmentListItemPayment build() { + return new ShipmentListItemPayment(id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/ShipmentStatus.java b/src/main/java/com/whop/api/types/ShipmentStatus.java new file mode 100644 index 00000000..75ead0d4 --- /dev/null +++ b/src/main/java/com/whop/api/types/ShipmentStatus.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ShipmentStatus { + public static final ShipmentStatus DELIVERED = new ShipmentStatus(Value.DELIVERED, "delivered"); + + public static final ShipmentStatus FAILURE = new ShipmentStatus(Value.FAILURE, "failure"); + + public static final ShipmentStatus PRE_TRANSIT = new ShipmentStatus(Value.PRE_TRANSIT, "pre_transit"); + + public static final ShipmentStatus UNKNOWN = new ShipmentStatus(Value.UNKNOWN, "unknown"); + + public static final ShipmentStatus RETURN_TO_SENDER = + new ShipmentStatus(Value.RETURN_TO_SENDER, "return_to_sender"); + + public static final ShipmentStatus CANCELLED = new ShipmentStatus(Value.CANCELLED, "cancelled"); + + public static final ShipmentStatus ERROR = new ShipmentStatus(Value.ERROR, "error"); + + public static final ShipmentStatus OUT_FOR_DELIVERY = + new ShipmentStatus(Value.OUT_FOR_DELIVERY, "out_for_delivery"); + + public static final ShipmentStatus AVAILABLE_FOR_PICKUP = + new ShipmentStatus(Value.AVAILABLE_FOR_PICKUP, "available_for_pickup"); + + public static final ShipmentStatus IN_TRANSIT = new ShipmentStatus(Value.IN_TRANSIT, "in_transit"); + + private final Value value; + + private final String string; + + ShipmentStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ShipmentStatus && this.string.equals(((ShipmentStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DELIVERED: + return visitor.visitDelivered(); + case FAILURE: + return visitor.visitFailure(); + case PRE_TRANSIT: + return visitor.visitPreTransit(); + case UNKNOWN: + return visitor.visitUnknown(); + case RETURN_TO_SENDER: + return visitor.visitReturnToSender(); + case CANCELLED: + return visitor.visitCancelled(); + case ERROR: + return visitor.visitError(); + case OUT_FOR_DELIVERY: + return visitor.visitOutForDelivery(); + case AVAILABLE_FOR_PICKUP: + return visitor.visitAvailableForPickup(); + case IN_TRANSIT: + return visitor.visitInTransit(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ShipmentStatus valueOf(String value) { + switch (value) { + case "delivered": + return DELIVERED; + case "failure": + return FAILURE; + case "pre_transit": + return PRE_TRANSIT; + case "unknown": + return UNKNOWN; + case "return_to_sender": + return RETURN_TO_SENDER; + case "cancelled": + return CANCELLED; + case "error": + return ERROR; + case "out_for_delivery": + return OUT_FOR_DELIVERY; + case "available_for_pickup": + return AVAILABLE_FOR_PICKUP; + case "in_transit": + return IN_TRANSIT; + default: + return new ShipmentStatus(Value._UNKNOWN, value); + } + } + + public enum Value { + UNKNOWN, + + PRE_TRANSIT, + + IN_TRANSIT, + + OUT_FOR_DELIVERY, + + DELIVERED, + + AVAILABLE_FOR_PICKUP, + + RETURN_TO_SENDER, + + FAILURE, + + CANCELLED, + + ERROR, + + _UNKNOWN + } + + public interface Visitor { + T visitUnknown(); + + T visitPreTransit(); + + T visitInTransit(); + + T visitOutForDelivery(); + + T visitDelivered(); + + T visitAvailableForPickup(); + + T visitReturnToSender(); + + T visitFailure(); + + T visitCancelled(); + + T visitError(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ShipmentStatuses.java b/src/main/java/com/whop/api/types/ShipmentStatuses.java new file mode 100644 index 00000000..c539d94a --- /dev/null +++ b/src/main/java/com/whop/api/types/ShipmentStatuses.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ShipmentStatuses { + public static final ShipmentStatuses DELIVERED = new ShipmentStatuses(Value.DELIVERED, "delivered"); + + public static final ShipmentStatuses FAILURE = new ShipmentStatuses(Value.FAILURE, "failure"); + + public static final ShipmentStatuses PRE_TRANSIT = new ShipmentStatuses(Value.PRE_TRANSIT, "pre_transit"); + + public static final ShipmentStatuses UNKNOWN = new ShipmentStatuses(Value.UNKNOWN, "unknown"); + + public static final ShipmentStatuses RETURN_TO_SENDER = + new ShipmentStatuses(Value.RETURN_TO_SENDER, "return_to_sender"); + + public static final ShipmentStatuses CANCELLED = new ShipmentStatuses(Value.CANCELLED, "cancelled"); + + public static final ShipmentStatuses ERROR = new ShipmentStatuses(Value.ERROR, "error"); + + public static final ShipmentStatuses OUT_FOR_DELIVERY = + new ShipmentStatuses(Value.OUT_FOR_DELIVERY, "out_for_delivery"); + + public static final ShipmentStatuses AVAILABLE_FOR_PICKUP = + new ShipmentStatuses(Value.AVAILABLE_FOR_PICKUP, "available_for_pickup"); + + public static final ShipmentStatuses IN_TRANSIT = new ShipmentStatuses(Value.IN_TRANSIT, "in_transit"); + + private final Value value; + + private final String string; + + ShipmentStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ShipmentStatuses && this.string.equals(((ShipmentStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DELIVERED: + return visitor.visitDelivered(); + case FAILURE: + return visitor.visitFailure(); + case PRE_TRANSIT: + return visitor.visitPreTransit(); + case UNKNOWN: + return visitor.visitUnknown(); + case RETURN_TO_SENDER: + return visitor.visitReturnToSender(); + case CANCELLED: + return visitor.visitCancelled(); + case ERROR: + return visitor.visitError(); + case OUT_FOR_DELIVERY: + return visitor.visitOutForDelivery(); + case AVAILABLE_FOR_PICKUP: + return visitor.visitAvailableForPickup(); + case IN_TRANSIT: + return visitor.visitInTransit(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ShipmentStatuses valueOf(String value) { + switch (value) { + case "delivered": + return DELIVERED; + case "failure": + return FAILURE; + case "pre_transit": + return PRE_TRANSIT; + case "unknown": + return UNKNOWN; + case "return_to_sender": + return RETURN_TO_SENDER; + case "cancelled": + return CANCELLED; + case "error": + return ERROR; + case "out_for_delivery": + return OUT_FOR_DELIVERY; + case "available_for_pickup": + return AVAILABLE_FOR_PICKUP; + case "in_transit": + return IN_TRANSIT; + default: + return new ShipmentStatuses(Value._UNKNOWN, value); + } + } + + public enum Value { + UNKNOWN, + + PRE_TRANSIT, + + IN_TRANSIT, + + OUT_FOR_DELIVERY, + + DELIVERED, + + AVAILABLE_FOR_PICKUP, + + RETURN_TO_SENDER, + + FAILURE, + + CANCELLED, + + ERROR, + + _UNKNOWN + } + + public interface Visitor { + T visitUnknown(); + + T visitPreTransit(); + + T visitInTransit(); + + T visitOutForDelivery(); + + T visitDelivered(); + + T visitAvailableForPickup(); + + T visitReturnToSender(); + + T visitFailure(); + + T visitCancelled(); + + T visitError(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/ShipmentSubstatuses.java b/src/main/java/com/whop/api/types/ShipmentSubstatuses.java new file mode 100644 index 00000000..89a282ed --- /dev/null +++ b/src/main/java/com/whop/api/types/ShipmentSubstatuses.java @@ -0,0 +1,363 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ShipmentSubstatuses { + public static final ShipmentSubstatuses SUBSTATUS_IN_TRANSIT = + new ShipmentSubstatuses(Value.SUBSTATUS_IN_TRANSIT, "substatus_in_transit"); + + public static final ShipmentSubstatuses TRANSIT_EXCEPTION = + new ShipmentSubstatuses(Value.TRANSIT_EXCEPTION, "transit_exception"); + + public static final ShipmentSubstatuses AWAITING_INFORMATION = + new ShipmentSubstatuses(Value.AWAITING_INFORMATION, "awaiting_information"); + + public static final ShipmentSubstatuses ARRIVED_AT_PICKUP_LOCATION = + new ShipmentSubstatuses(Value.ARRIVED_AT_PICKUP_LOCATION, "arrived_at_pickup_location"); + + public static final ShipmentSubstatuses DAMAGED = new ShipmentSubstatuses(Value.DAMAGED, "damaged"); + + public static final ShipmentSubstatuses SUBSTATUS_OUT_FOR_DELIVERY = + new ShipmentSubstatuses(Value.SUBSTATUS_OUT_FOR_DELIVERY, "substatus_out_for_delivery"); + + public static final ShipmentSubstatuses WEATHER_DELAY = + new ShipmentSubstatuses(Value.WEATHER_DELAY, "weather_delay"); + + public static final ShipmentSubstatuses RECEIVED_AT_ORIGIN_FACILITY = + new ShipmentSubstatuses(Value.RECEIVED_AT_ORIGIN_FACILITY, "received_at_origin_facility"); + + public static final ShipmentSubstatuses ADDRESS_CORRECTION = + new ShipmentSubstatuses(Value.ADDRESS_CORRECTION, "address_correction"); + + public static final ShipmentSubstatuses DEPARTED_ORIGIN_FACILITY = + new ShipmentSubstatuses(Value.DEPARTED_ORIGIN_FACILITY, "departed_origin_facility"); + + public static final ShipmentSubstatuses HELD = new ShipmentSubstatuses(Value.HELD, "held"); + + public static final ShipmentSubstatuses SUBSTATUS_CANCELLED = + new ShipmentSubstatuses(Value.SUBSTATUS_CANCELLED, "substatus_cancelled"); + + public static final ShipmentSubstatuses DELIVERY_EXCEPTION = + new ShipmentSubstatuses(Value.DELIVERY_EXCEPTION, "delivery_exception"); + + public static final ShipmentSubstatuses EXPIRED = new ShipmentSubstatuses(Value.EXPIRED, "expired"); + + public static final ShipmentSubstatuses LABEL_CREATED = + new ShipmentSubstatuses(Value.LABEL_CREATED, "label_created"); + + public static final ShipmentSubstatuses LOST = new ShipmentSubstatuses(Value.LOST, "lost"); + + public static final ShipmentSubstatuses SUBSTATUS_UNKNOWN = + new ShipmentSubstatuses(Value.SUBSTATUS_UNKNOWN, "substatus_unknown"); + + public static final ShipmentSubstatuses STATUS_UPDATE = + new ShipmentSubstatuses(Value.STATUS_UPDATE, "status_update"); + + public static final ShipmentSubstatuses SUBSTATUS_FAILURE = + new ShipmentSubstatuses(Value.SUBSTATUS_FAILURE, "substatus_failure"); + + public static final ShipmentSubstatuses ARRIVED_AT_FACILITY = + new ShipmentSubstatuses(Value.ARRIVED_AT_FACILITY, "arrived_at_facility"); + + public static final ShipmentSubstatuses RETURN = new ShipmentSubstatuses(Value.RETURN, "return"); + + public static final ShipmentSubstatuses RECEIVED_AT_DESTINATION_FACILITY = + new ShipmentSubstatuses(Value.RECEIVED_AT_DESTINATION_FACILITY, "received_at_destination_facility"); + + public static final ShipmentSubstatuses DEPARTED_FACILITY = + new ShipmentSubstatuses(Value.DEPARTED_FACILITY, "departed_facility"); + + public static final ShipmentSubstatuses ARRIVED_AT_DESTINATION = + new ShipmentSubstatuses(Value.ARRIVED_AT_DESTINATION, "arrived_at_destination"); + + public static final ShipmentSubstatuses TRANSFERRED_TO_DESTINATION_CARRIER = + new ShipmentSubstatuses(Value.TRANSFERRED_TO_DESTINATION_CARRIER, "transferred_to_destination_carrier"); + + public static final ShipmentSubstatuses DELAYED = new ShipmentSubstatuses(Value.DELAYED, "delayed"); + + public static final ShipmentSubstatuses MISSORTED = new ShipmentSubstatuses(Value.MISSORTED, "missorted"); + + public static final ShipmentSubstatuses REFUSED = new ShipmentSubstatuses(Value.REFUSED, "refused"); + + private final Value value; + + private final String string; + + ShipmentSubstatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ShipmentSubstatuses && this.string.equals(((ShipmentSubstatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SUBSTATUS_IN_TRANSIT: + return visitor.visitSubstatusInTransit(); + case TRANSIT_EXCEPTION: + return visitor.visitTransitException(); + case AWAITING_INFORMATION: + return visitor.visitAwaitingInformation(); + case ARRIVED_AT_PICKUP_LOCATION: + return visitor.visitArrivedAtPickupLocation(); + case DAMAGED: + return visitor.visitDamaged(); + case SUBSTATUS_OUT_FOR_DELIVERY: + return visitor.visitSubstatusOutForDelivery(); + case WEATHER_DELAY: + return visitor.visitWeatherDelay(); + case RECEIVED_AT_ORIGIN_FACILITY: + return visitor.visitReceivedAtOriginFacility(); + case ADDRESS_CORRECTION: + return visitor.visitAddressCorrection(); + case DEPARTED_ORIGIN_FACILITY: + return visitor.visitDepartedOriginFacility(); + case HELD: + return visitor.visitHeld(); + case SUBSTATUS_CANCELLED: + return visitor.visitSubstatusCancelled(); + case DELIVERY_EXCEPTION: + return visitor.visitDeliveryException(); + case EXPIRED: + return visitor.visitExpired(); + case LABEL_CREATED: + return visitor.visitLabelCreated(); + case LOST: + return visitor.visitLost(); + case SUBSTATUS_UNKNOWN: + return visitor.visitSubstatusUnknown(); + case STATUS_UPDATE: + return visitor.visitStatusUpdate(); + case SUBSTATUS_FAILURE: + return visitor.visitSubstatusFailure(); + case ARRIVED_AT_FACILITY: + return visitor.visitArrivedAtFacility(); + case RETURN: + return visitor.visitReturn(); + case RECEIVED_AT_DESTINATION_FACILITY: + return visitor.visitReceivedAtDestinationFacility(); + case DEPARTED_FACILITY: + return visitor.visitDepartedFacility(); + case ARRIVED_AT_DESTINATION: + return visitor.visitArrivedAtDestination(); + case TRANSFERRED_TO_DESTINATION_CARRIER: + return visitor.visitTransferredToDestinationCarrier(); + case DELAYED: + return visitor.visitDelayed(); + case MISSORTED: + return visitor.visitMissorted(); + case REFUSED: + return visitor.visitRefused(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ShipmentSubstatuses valueOf(String value) { + switch (value) { + case "substatus_in_transit": + return SUBSTATUS_IN_TRANSIT; + case "transit_exception": + return TRANSIT_EXCEPTION; + case "awaiting_information": + return AWAITING_INFORMATION; + case "arrived_at_pickup_location": + return ARRIVED_AT_PICKUP_LOCATION; + case "damaged": + return DAMAGED; + case "substatus_out_for_delivery": + return SUBSTATUS_OUT_FOR_DELIVERY; + case "weather_delay": + return WEATHER_DELAY; + case "received_at_origin_facility": + return RECEIVED_AT_ORIGIN_FACILITY; + case "address_correction": + return ADDRESS_CORRECTION; + case "departed_origin_facility": + return DEPARTED_ORIGIN_FACILITY; + case "held": + return HELD; + case "substatus_cancelled": + return SUBSTATUS_CANCELLED; + case "delivery_exception": + return DELIVERY_EXCEPTION; + case "expired": + return EXPIRED; + case "label_created": + return LABEL_CREATED; + case "lost": + return LOST; + case "substatus_unknown": + return SUBSTATUS_UNKNOWN; + case "status_update": + return STATUS_UPDATE; + case "substatus_failure": + return SUBSTATUS_FAILURE; + case "arrived_at_facility": + return ARRIVED_AT_FACILITY; + case "return": + return RETURN; + case "received_at_destination_facility": + return RECEIVED_AT_DESTINATION_FACILITY; + case "departed_facility": + return DEPARTED_FACILITY; + case "arrived_at_destination": + return ARRIVED_AT_DESTINATION; + case "transferred_to_destination_carrier": + return TRANSFERRED_TO_DESTINATION_CARRIER; + case "delayed": + return DELAYED; + case "missorted": + return MISSORTED; + case "refused": + return REFUSED; + default: + return new ShipmentSubstatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + ADDRESS_CORRECTION, + + ARRIVED_AT_DESTINATION, + + ARRIVED_AT_FACILITY, + + ARRIVED_AT_PICKUP_LOCATION, + + AWAITING_INFORMATION, + + SUBSTATUS_CANCELLED, + + DAMAGED, + + DELAYED, + + DELIVERY_EXCEPTION, + + DEPARTED_FACILITY, + + DEPARTED_ORIGIN_FACILITY, + + EXPIRED, + + SUBSTATUS_FAILURE, + + HELD, + + SUBSTATUS_IN_TRANSIT, + + LABEL_CREATED, + + LOST, + + MISSORTED, + + SUBSTATUS_OUT_FOR_DELIVERY, + + RECEIVED_AT_DESTINATION_FACILITY, + + RECEIVED_AT_ORIGIN_FACILITY, + + REFUSED, + + RETURN, + + STATUS_UPDATE, + + TRANSFERRED_TO_DESTINATION_CARRIER, + + TRANSIT_EXCEPTION, + + SUBSTATUS_UNKNOWN, + + WEATHER_DELAY, + + UNKNOWN + } + + public interface Visitor { + T visitAddressCorrection(); + + T visitArrivedAtDestination(); + + T visitArrivedAtFacility(); + + T visitArrivedAtPickupLocation(); + + T visitAwaitingInformation(); + + T visitSubstatusCancelled(); + + T visitDamaged(); + + T visitDelayed(); + + T visitDeliveryException(); + + T visitDepartedFacility(); + + T visitDepartedOriginFacility(); + + T visitExpired(); + + T visitSubstatusFailure(); + + T visitHeld(); + + T visitSubstatusInTransit(); + + T visitLabelCreated(); + + T visitLost(); + + T visitMissorted(); + + T visitSubstatusOutForDelivery(); + + T visitReceivedAtDestinationFacility(); + + T visitReceivedAtOriginFacility(); + + T visitRefused(); + + T visitReturn(); + + T visitStatusUpdate(); + + T visitTransferredToDestinationCarrier(); + + T visitTransitException(); + + T visitSubstatusUnknown(); + + T visitWeatherDelay(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/SocialAccount.java b/src/main/java/com/whop/api/types/SocialAccount.java new file mode 100644 index 00000000..7b642f3a --- /dev/null +++ b/src/main/java/com/whop/api/types/SocialAccount.java @@ -0,0 +1,764 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SocialAccount.Builder.class) +public final class SocialAccount { + private final Optional error; + + private final Optional externalId; + + private final String id; + + private final Optional name; + + private final Optional parentSocialAccount; + + private final SocialAccountPlatform platform; + + private final Optional profilePictureUrl; + + private final List scopes; + + private final Optional url; + + private final Optional username; + + private final boolean verified; + + private final Map additionalProperties; + + private SocialAccount( + Optional error, + Optional externalId, + String id, + Optional name, + Optional parentSocialAccount, + SocialAccountPlatform platform, + Optional profilePictureUrl, + List scopes, + Optional url, + Optional username, + boolean verified, + Map additionalProperties) { + this.error = error; + this.externalId = externalId; + this.id = id; + this.name = name; + this.parentSocialAccount = parentSocialAccount; + this.platform = platform; + this.profilePictureUrl = profilePictureUrl; + this.scopes = scopes; + this.url = url; + this.username = username; + this.verified = verified; + this.additionalProperties = additionalProperties; + } + + /** + * @return Why this social account currently can't be used for advertising — a failed share or a Meta-side restriction. Null when the account is healthy. + */ + @JsonIgnore + public Optional getError() { + if (error == null) { + return Optional.empty(); + } + return error; + } + + /** + * @return The platform-specific ID for this social account. + */ + @JsonIgnore + public Optional getExternalId() { + if (externalId == null) { + return Optional.empty(); + } + return externalId; + } + + /** + * @return Unique identifier for the social account. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the social account on the platform. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The social account this one belongs to on the platform, such as the Facebook page that owns an Instagram account. Null when the social account stands on its own. + */ + @JsonIgnore + public Optional getParentSocialAccount() { + if (parentSocialAccount == null) { + return Optional.empty(); + } + return parentSocialAccount; + } + + /** + * @return The platform the social account exists on. + */ + @JsonProperty("platform") + public SocialAccountPlatform getPlatform() { + return platform; + } + + /** + * @return The URL where the profile picture of the social account can be accessed. + */ + @JsonIgnore + public Optional getProfilePictureUrl() { + if (profilePictureUrl == null) { + return Optional.empty(); + } + return profilePictureUrl; + } + + @JsonProperty("scopes") + public List getScopes() { + return scopes; + } + + /** + * @return The URL where the social account can be accessed on the platform. Null while a Whop-owned page is still being provisioned. + */ + @JsonIgnore + public Optional getUrl() { + if (url == null) { + return Optional.empty(); + } + return url; + } + + /** + * @return The username of the social account on the platform. Null while a Whop-owned page is still being provisioned. + */ + @JsonIgnore + public Optional getUsername() { + if (username == null) { + return Optional.empty(); + } + return username; + } + + /** + * @return Whether the social account is verified on the platform. + */ + @JsonProperty("verified") + public boolean getVerified() { + return verified; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("error") + private Optional _getError() { + return error; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("external_id") + private Optional _getExternalId() { + return externalId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("parent_social_account") + private Optional _getParentSocialAccount() { + return parentSocialAccount; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("profile_picture_url") + private Optional _getProfilePictureUrl() { + return profilePictureUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("url") + private Optional _getUrl() { + return url; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("username") + private Optional _getUsername() { + return username; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SocialAccount && equalTo((SocialAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SocialAccount other) { + return error.equals(other.error) + && externalId.equals(other.externalId) + && id.equals(other.id) + && name.equals(other.name) + && parentSocialAccount.equals(other.parentSocialAccount) + && platform.equals(other.platform) + && profilePictureUrl.equals(other.profilePictureUrl) + && scopes.equals(other.scopes) + && url.equals(other.url) + && username.equals(other.username) + && verified == other.verified; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.error, + this.externalId, + this.id, + this.name, + this.parentSocialAccount, + this.platform, + this.profilePictureUrl, + this.scopes, + this.url, + this.username, + this.verified); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Unique identifier for the social account.

+ */ + PlatformStage id(@NotNull String id); + + Builder from(SocialAccount other); + } + + public interface PlatformStage { + /** + *

The platform the social account exists on.

+ */ + VerifiedStage platform(@NotNull SocialAccountPlatform platform); + } + + public interface VerifiedStage { + /** + *

Whether the social account is verified on the platform.

+ */ + _FinalStage verified(boolean verified); + } + + public interface _FinalStage { + SocialAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Why this social account currently can't be used for advertising — a failed share or a Meta-side restriction. Null when the account is healthy.

+ */ + _FinalStage error(Optional error); + + _FinalStage error(String error); + + _FinalStage error(Nullable error); + + /** + *

The platform-specific ID for this social account.

+ */ + _FinalStage externalId(Optional externalId); + + _FinalStage externalId(String externalId); + + _FinalStage externalId(Nullable externalId); + + /** + *

The display name of the social account on the platform.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

The social account this one belongs to on the platform, such as the Facebook page that owns an Instagram account. Null when the social account stands on its own.

+ */ + _FinalStage parentSocialAccount(Optional parentSocialAccount); + + _FinalStage parentSocialAccount(SocialAccountParent parentSocialAccount); + + _FinalStage parentSocialAccount(Nullable parentSocialAccount); + + /** + *

The URL where the profile picture of the social account can be accessed.

+ */ + _FinalStage profilePictureUrl(Optional profilePictureUrl); + + _FinalStage profilePictureUrl(String profilePictureUrl); + + _FinalStage profilePictureUrl(Nullable profilePictureUrl); + + _FinalStage scopes(List scopes); + + _FinalStage addScopes(String scopes); + + _FinalStage addAllScopes(List scopes); + + /** + *

The URL where the social account can be accessed on the platform. Null while a Whop-owned page is still being provisioned.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage url(Nullable url); + + /** + *

The username of the social account on the platform. Null while a Whop-owned page is still being provisioned.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + + _FinalStage username(Nullable username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, PlatformStage, VerifiedStage, _FinalStage { + private String id; + + private SocialAccountPlatform platform; + + private boolean verified; + + private Optional username = Optional.empty(); + + private Optional url = Optional.empty(); + + private List scopes = new ArrayList<>(); + + private Optional profilePictureUrl = Optional.empty(); + + private Optional parentSocialAccount = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional externalId = Optional.empty(); + + private Optional error = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SocialAccount other) { + error(other.getError()); + externalId(other.getExternalId()); + id(other.getId()); + name(other.getName()); + parentSocialAccount(other.getParentSocialAccount()); + platform(other.getPlatform()); + profilePictureUrl(other.getProfilePictureUrl()); + scopes(other.getScopes()); + url(other.getUrl()); + username(other.getUsername()); + verified(other.getVerified()); + return this; + } + + /** + *

Unique identifier for the social account.

+ *

Unique identifier for the social account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PlatformStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The platform the social account exists on.

+ *

The platform the social account exists on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public VerifiedStage platform(@NotNull SocialAccountPlatform platform) { + this.platform = Objects.requireNonNull(platform, "platform must not be null"); + return this; + } + + /** + *

Whether the social account is verified on the platform.

+ *

Whether the social account is verified on the platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("verified") + public _FinalStage verified(boolean verified) { + this.verified = verified; + return this; + } + + /** + *

The username of the social account on the platform. Null while a Whop-owned page is still being provisioned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(Nullable username) { + if (username.isNull()) { + this.username = null; + } else if (username.isEmpty()) { + this.username = Optional.empty(); + } else { + this.username = Optional.of(username.get()); + } + return this; + } + + /** + *

The username of the social account on the platform. Null while a Whop-owned page is still being provisioned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

The username of the social account on the platform. Null while a Whop-owned page is still being provisioned.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

The URL where the social account can be accessed on the platform. Null while a Whop-owned page is still being provisioned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(Nullable url) { + if (url.isNull()) { + this.url = null; + } else if (url.isEmpty()) { + this.url = Optional.empty(); + } else { + this.url = Optional.of(url.get()); + } + return this; + } + + /** + *

The URL where the social account can be accessed on the platform. Null while a Whop-owned page is still being provisioned.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

The URL where the social account can be accessed on the platform. Null while a Whop-owned page is still being provisioned.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + @java.lang.Override + public _FinalStage addAllScopes(List scopes) { + if (scopes != null) { + this.scopes.addAll(scopes); + } + return this; + } + + @java.lang.Override + public _FinalStage addScopes(String scopes) { + this.scopes.add(scopes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scopes", nulls = Nulls.SKIP) + public _FinalStage scopes(List scopes) { + this.scopes.clear(); + if (scopes != null) { + this.scopes.addAll(scopes); + } + return this; + } + + /** + *

The URL where the profile picture of the social account can be accessed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profilePictureUrl(Nullable profilePictureUrl) { + if (profilePictureUrl.isNull()) { + this.profilePictureUrl = null; + } else if (profilePictureUrl.isEmpty()) { + this.profilePictureUrl = Optional.empty(); + } else { + this.profilePictureUrl = Optional.of(profilePictureUrl.get()); + } + return this; + } + + /** + *

The URL where the profile picture of the social account can be accessed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profilePictureUrl(String profilePictureUrl) { + this.profilePictureUrl = Optional.ofNullable(profilePictureUrl); + return this; + } + + /** + *

The URL where the profile picture of the social account can be accessed.

+ */ + @java.lang.Override + @JsonSetter(value = "profile_picture_url", nulls = Nulls.SKIP) + public _FinalStage profilePictureUrl(Optional profilePictureUrl) { + this.profilePictureUrl = profilePictureUrl; + return this; + } + + /** + *

The social account this one belongs to on the platform, such as the Facebook page that owns an Instagram account. Null when the social account stands on its own.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage parentSocialAccount(Nullable parentSocialAccount) { + if (parentSocialAccount.isNull()) { + this.parentSocialAccount = null; + } else if (parentSocialAccount.isEmpty()) { + this.parentSocialAccount = Optional.empty(); + } else { + this.parentSocialAccount = Optional.of(parentSocialAccount.get()); + } + return this; + } + + /** + *

The social account this one belongs to on the platform, such as the Facebook page that owns an Instagram account. Null when the social account stands on its own.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage parentSocialAccount(SocialAccountParent parentSocialAccount) { + this.parentSocialAccount = Optional.ofNullable(parentSocialAccount); + return this; + } + + /** + *

The social account this one belongs to on the platform, such as the Facebook page that owns an Instagram account. Null when the social account stands on its own.

+ */ + @java.lang.Override + @JsonSetter(value = "parent_social_account", nulls = Nulls.SKIP) + public _FinalStage parentSocialAccount(Optional parentSocialAccount) { + this.parentSocialAccount = parentSocialAccount; + return this; + } + + /** + *

The display name of the social account on the platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The display name of the social account on the platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The display name of the social account on the platform.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The platform-specific ID for this social account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage externalId(Nullable externalId) { + if (externalId.isNull()) { + this.externalId = null; + } else if (externalId.isEmpty()) { + this.externalId = Optional.empty(); + } else { + this.externalId = Optional.of(externalId.get()); + } + return this; + } + + /** + *

The platform-specific ID for this social account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage externalId(String externalId) { + this.externalId = Optional.ofNullable(externalId); + return this; + } + + /** + *

The platform-specific ID for this social account.

+ */ + @java.lang.Override + @JsonSetter(value = "external_id", nulls = Nulls.SKIP) + public _FinalStage externalId(Optional externalId) { + this.externalId = externalId; + return this; + } + + /** + *

Why this social account currently can't be used for advertising — a failed share or a Meta-side restriction. Null when the account is healthy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(Nullable error) { + if (error.isNull()) { + this.error = null; + } else if (error.isEmpty()) { + this.error = Optional.empty(); + } else { + this.error = Optional.of(error.get()); + } + return this; + } + + /** + *

Why this social account currently can't be used for advertising — a failed share or a Meta-side restriction. Null when the account is healthy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

Why this social account currently can't be used for advertising — a failed share or a Meta-side restriction. Null when the account is healthy.

+ */ + @java.lang.Override + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public _FinalStage error(Optional error) { + this.error = error; + return this; + } + + @java.lang.Override + public SocialAccount build() { + return new SocialAccount( + error, + externalId, + id, + name, + parentSocialAccount, + platform, + profilePictureUrl, + scopes, + url, + username, + verified, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SocialAccountLeadForm.java b/src/main/java/com/whop/api/types/SocialAccountLeadForm.java new file mode 100644 index 00000000..b1ed3a6f --- /dev/null +++ b/src/main/java/com/whop/api/types/SocialAccountLeadForm.java @@ -0,0 +1,844 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SocialAccountLeadForm.Builder.class) +public final class SocialAccountLeadForm { + private final Optional completion; + + private final Optional createdAt; + + private final Optional disclaimer; + + private final SocialAccountLeadFormFormType formType; + + private final String id; + + private final Optional intro; + + private final Optional locale; + + private final Optional name; + + private final Optional privacyPolicyLinkText; + + private final Optional privacyPolicyUrl; + + private final List questionLabels; + + private final List questions; + + private final Map additionalProperties; + + private SocialAccountLeadForm( + Optional completion, + Optional createdAt, + Optional disclaimer, + SocialAccountLeadFormFormType formType, + String id, + Optional intro, + Optional locale, + Optional name, + Optional privacyPolicyLinkText, + Optional privacyPolicyUrl, + List questionLabels, + List questions, + Map additionalProperties) { + this.completion = completion; + this.createdAt = createdAt; + this.disclaimer = disclaimer; + this.formType = formType; + this.id = id; + this.intro = intro; + this.locale = locale; + this.name = name; + this.privacyPolicyLinkText = privacyPolicyLinkText; + this.privacyPolicyUrl = privacyPolicyUrl; + this.questionLabels = questionLabels; + this.questions = questions; + this.additionalProperties = additionalProperties; + } + + /** + * @return Screen shown after the form is submitted. null when the form has none. + */ + @JsonIgnore + public Optional getCompletion() { + if (completion == null) { + return Optional.empty(); + } + return completion; + } + + /** + * @return When the form was created, as an ISO 8601 timestamp. + */ + @JsonIgnore + public Optional getCreatedAt() { + if (createdAt == null) { + return Optional.empty(); + } + return createdAt; + } + + /** + * @return Custom consent disclaimer shown before submission. null when the form has none. + */ + @JsonIgnore + public Optional getDisclaimer() { + if (disclaimer == null) { + return Optional.empty(); + } + return disclaimer; + } + + /** + * @return more_volume is quickest to submit; higher_intent adds a confirmation step before submission. + */ + @JsonProperty("form_type") + public SocialAccountLeadFormFormType getFormType() { + return formType; + } + + /** + * @return The ad platform's identifier for the form. Use it as lead_gen_form_id on an ad to reuse the form. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Intro screen shown before the questions. null when the form has none. + */ + @JsonIgnore + public Optional getIntro() { + if (intro == null) { + return Optional.empty(); + } + return intro; + } + + /** + * @return Language the form is shown in, such as en_US. + */ + @JsonIgnore + public Optional getLocale() { + if (locale == null) { + return Optional.empty(); + } + return locale; + } + + /** + * @return Advertiser-facing form name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return Custom link text for the privacy policy. null when the default is used. + */ + @JsonIgnore + public Optional getPrivacyPolicyLinkText() { + if (privacyPolicyLinkText == null) { + return Optional.empty(); + } + return privacyPolicyLinkText; + } + + /** + * @return Privacy policy URL configured on the form. + */ + @JsonIgnore + public Optional getPrivacyPolicyUrl() { + if (privacyPolicyUrl == null) { + return Optional.empty(); + } + return privacyPolicyUrl; + } + + @JsonProperty("question_labels") + public List getQuestionLabels() { + return questionLabels; + } + + @JsonProperty("questions") + public List getQuestions() { + return questions; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("completion") + private Optional _getCompletion() { + return completion; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("created_at") + private Optional _getCreatedAt() { + return createdAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("disclaimer") + private Optional _getDisclaimer() { + return disclaimer; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("intro") + private Optional _getIntro() { + return intro; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("locale") + private Optional _getLocale() { + return locale; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("privacy_policy_link_text") + private Optional _getPrivacyPolicyLinkText() { + return privacyPolicyLinkText; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("privacy_policy_url") + private Optional _getPrivacyPolicyUrl() { + return privacyPolicyUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SocialAccountLeadForm && equalTo((SocialAccountLeadForm) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SocialAccountLeadForm other) { + return completion.equals(other.completion) + && createdAt.equals(other.createdAt) + && disclaimer.equals(other.disclaimer) + && formType.equals(other.formType) + && id.equals(other.id) + && intro.equals(other.intro) + && locale.equals(other.locale) + && name.equals(other.name) + && privacyPolicyLinkText.equals(other.privacyPolicyLinkText) + && privacyPolicyUrl.equals(other.privacyPolicyUrl) + && questionLabels.equals(other.questionLabels) + && questions.equals(other.questions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.completion, + this.createdAt, + this.disclaimer, + this.formType, + this.id, + this.intro, + this.locale, + this.name, + this.privacyPolicyLinkText, + this.privacyPolicyUrl, + this.questionLabels, + this.questions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FormTypeStage builder() { + return new Builder(); + } + + public interface FormTypeStage { + /** + *

more_volume is quickest to submit; higher_intent adds a confirmation step before submission.

+ */ + IdStage formType(@NotNull SocialAccountLeadFormFormType formType); + + Builder from(SocialAccountLeadForm other); + } + + public interface IdStage { + /** + *

The ad platform's identifier for the form. Use it as lead_gen_form_id on an ad to reuse the form.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + SocialAccountLeadForm build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Screen shown after the form is submitted. null when the form has none.

+ */ + _FinalStage completion(Optional completion); + + _FinalStage completion(AdLeadFormCompletion completion); + + _FinalStage completion(Nullable completion); + + /** + *

When the form was created, as an ISO 8601 timestamp.

+ */ + _FinalStage createdAt(Optional createdAt); + + _FinalStage createdAt(String createdAt); + + _FinalStage createdAt(Nullable createdAt); + + /** + *

Custom consent disclaimer shown before submission. null when the form has none.

+ */ + _FinalStage disclaimer(Optional disclaimer); + + _FinalStage disclaimer(AdLeadFormDisclaimer disclaimer); + + _FinalStage disclaimer(Nullable disclaimer); + + /** + *

Intro screen shown before the questions. null when the form has none.

+ */ + _FinalStage intro(Optional intro); + + _FinalStage intro(AdLeadFormIntro intro); + + _FinalStage intro(Nullable intro); + + /** + *

Language the form is shown in, such as en_US.

+ */ + _FinalStage locale(Optional locale); + + _FinalStage locale(String locale); + + _FinalStage locale(Nullable locale); + + /** + *

Advertiser-facing form name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

Custom link text for the privacy policy. null when the default is used.

+ */ + _FinalStage privacyPolicyLinkText(Optional privacyPolicyLinkText); + + _FinalStage privacyPolicyLinkText(String privacyPolicyLinkText); + + _FinalStage privacyPolicyLinkText(Nullable privacyPolicyLinkText); + + /** + *

Privacy policy URL configured on the form.

+ */ + _FinalStage privacyPolicyUrl(Optional privacyPolicyUrl); + + _FinalStage privacyPolicyUrl(String privacyPolicyUrl); + + _FinalStage privacyPolicyUrl(Nullable privacyPolicyUrl); + + _FinalStage questionLabels(List questionLabels); + + _FinalStage addQuestionLabels(String questionLabels); + + _FinalStage addAllQuestionLabels(List questionLabels); + + _FinalStage questions(List questions); + + _FinalStage addQuestions(AdLeadFormQuestion questions); + + _FinalStage addAllQuestions(List questions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FormTypeStage, IdStage, _FinalStage { + private SocialAccountLeadFormFormType formType; + + private String id; + + private List questions = new ArrayList<>(); + + private List questionLabels = new ArrayList<>(); + + private Optional privacyPolicyUrl = Optional.empty(); + + private Optional privacyPolicyLinkText = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional locale = Optional.empty(); + + private Optional intro = Optional.empty(); + + private Optional disclaimer = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional completion = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SocialAccountLeadForm other) { + completion(other.getCompletion()); + createdAt(other.getCreatedAt()); + disclaimer(other.getDisclaimer()); + formType(other.getFormType()); + id(other.getId()); + intro(other.getIntro()); + locale(other.getLocale()); + name(other.getName()); + privacyPolicyLinkText(other.getPrivacyPolicyLinkText()); + privacyPolicyUrl(other.getPrivacyPolicyUrl()); + questionLabels(other.getQuestionLabels()); + questions(other.getQuestions()); + return this; + } + + /** + *

more_volume is quickest to submit; higher_intent adds a confirmation step before submission.

+ *

more_volume is quickest to submit; higher_intent adds a confirmation step before submission.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("form_type") + public IdStage formType(@NotNull SocialAccountLeadFormFormType formType) { + this.formType = Objects.requireNonNull(formType, "formType must not be null"); + return this; + } + + /** + *

The ad platform's identifier for the form. Use it as lead_gen_form_id on an ad to reuse the form.

+ *

The ad platform's identifier for the form. Use it as lead_gen_form_id on an ad to reuse the form.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllQuestions(List questions) { + if (questions != null) { + this.questions.addAll(questions); + } + return this; + } + + @java.lang.Override + public _FinalStage addQuestions(AdLeadFormQuestion questions) { + this.questions.add(questions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "questions", nulls = Nulls.SKIP) + public _FinalStage questions(List questions) { + this.questions.clear(); + if (questions != null) { + this.questions.addAll(questions); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllQuestionLabels(List questionLabels) { + if (questionLabels != null) { + this.questionLabels.addAll(questionLabels); + } + return this; + } + + @java.lang.Override + public _FinalStage addQuestionLabels(String questionLabels) { + this.questionLabels.add(questionLabels); + return this; + } + + @java.lang.Override + @JsonSetter(value = "question_labels", nulls = Nulls.SKIP) + public _FinalStage questionLabels(List questionLabels) { + this.questionLabels.clear(); + if (questionLabels != null) { + this.questionLabels.addAll(questionLabels); + } + return this; + } + + /** + *

Privacy policy URL configured on the form.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage privacyPolicyUrl(Nullable privacyPolicyUrl) { + if (privacyPolicyUrl.isNull()) { + this.privacyPolicyUrl = null; + } else if (privacyPolicyUrl.isEmpty()) { + this.privacyPolicyUrl = Optional.empty(); + } else { + this.privacyPolicyUrl = Optional.of(privacyPolicyUrl.get()); + } + return this; + } + + /** + *

Privacy policy URL configured on the form.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage privacyPolicyUrl(String privacyPolicyUrl) { + this.privacyPolicyUrl = Optional.ofNullable(privacyPolicyUrl); + return this; + } + + /** + *

Privacy policy URL configured on the form.

+ */ + @java.lang.Override + @JsonSetter(value = "privacy_policy_url", nulls = Nulls.SKIP) + public _FinalStage privacyPolicyUrl(Optional privacyPolicyUrl) { + this.privacyPolicyUrl = privacyPolicyUrl; + return this; + } + + /** + *

Custom link text for the privacy policy. null when the default is used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage privacyPolicyLinkText(Nullable privacyPolicyLinkText) { + if (privacyPolicyLinkText.isNull()) { + this.privacyPolicyLinkText = null; + } else if (privacyPolicyLinkText.isEmpty()) { + this.privacyPolicyLinkText = Optional.empty(); + } else { + this.privacyPolicyLinkText = Optional.of(privacyPolicyLinkText.get()); + } + return this; + } + + /** + *

Custom link text for the privacy policy. null when the default is used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage privacyPolicyLinkText(String privacyPolicyLinkText) { + this.privacyPolicyLinkText = Optional.ofNullable(privacyPolicyLinkText); + return this; + } + + /** + *

Custom link text for the privacy policy. null when the default is used.

+ */ + @java.lang.Override + @JsonSetter(value = "privacy_policy_link_text", nulls = Nulls.SKIP) + public _FinalStage privacyPolicyLinkText(Optional privacyPolicyLinkText) { + this.privacyPolicyLinkText = privacyPolicyLinkText; + return this; + } + + /** + *

Advertiser-facing form name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Advertiser-facing form name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Advertiser-facing form name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

Language the form is shown in, such as en_US.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage locale(Nullable locale) { + if (locale.isNull()) { + this.locale = null; + } else if (locale.isEmpty()) { + this.locale = Optional.empty(); + } else { + this.locale = Optional.of(locale.get()); + } + return this; + } + + /** + *

Language the form is shown in, such as en_US.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage locale(String locale) { + this.locale = Optional.ofNullable(locale); + return this; + } + + /** + *

Language the form is shown in, such as en_US.

+ */ + @java.lang.Override + @JsonSetter(value = "locale", nulls = Nulls.SKIP) + public _FinalStage locale(Optional locale) { + this.locale = locale; + return this; + } + + /** + *

Intro screen shown before the questions. null when the form has none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage intro(Nullable intro) { + if (intro.isNull()) { + this.intro = null; + } else if (intro.isEmpty()) { + this.intro = Optional.empty(); + } else { + this.intro = Optional.of(intro.get()); + } + return this; + } + + /** + *

Intro screen shown before the questions. null when the form has none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage intro(AdLeadFormIntro intro) { + this.intro = Optional.ofNullable(intro); + return this; + } + + /** + *

Intro screen shown before the questions. null when the form has none.

+ */ + @java.lang.Override + @JsonSetter(value = "intro", nulls = Nulls.SKIP) + public _FinalStage intro(Optional intro) { + this.intro = intro; + return this; + } + + /** + *

Custom consent disclaimer shown before submission. null when the form has none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disclaimer(Nullable disclaimer) { + if (disclaimer.isNull()) { + this.disclaimer = null; + } else if (disclaimer.isEmpty()) { + this.disclaimer = Optional.empty(); + } else { + this.disclaimer = Optional.of(disclaimer.get()); + } + return this; + } + + /** + *

Custom consent disclaimer shown before submission. null when the form has none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disclaimer(AdLeadFormDisclaimer disclaimer) { + this.disclaimer = Optional.ofNullable(disclaimer); + return this; + } + + /** + *

Custom consent disclaimer shown before submission. null when the form has none.

+ */ + @java.lang.Override + @JsonSetter(value = "disclaimer", nulls = Nulls.SKIP) + public _FinalStage disclaimer(Optional disclaimer) { + this.disclaimer = disclaimer; + return this; + } + + /** + *

When the form was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(Nullable createdAt) { + if (createdAt.isNull()) { + this.createdAt = null; + } else if (createdAt.isEmpty()) { + this.createdAt = Optional.empty(); + } else { + this.createdAt = Optional.of(createdAt.get()); + } + return this; + } + + /** + *

When the form was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage createdAt(String createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

When the form was created, as an ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public _FinalStage createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

Screen shown after the form is submitted. null when the form has none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage completion(Nullable completion) { + if (completion.isNull()) { + this.completion = null; + } else if (completion.isEmpty()) { + this.completion = Optional.empty(); + } else { + this.completion = Optional.of(completion.get()); + } + return this; + } + + /** + *

Screen shown after the form is submitted. null when the form has none.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage completion(AdLeadFormCompletion completion) { + this.completion = Optional.ofNullable(completion); + return this; + } + + /** + *

Screen shown after the form is submitted. null when the form has none.

+ */ + @java.lang.Override + @JsonSetter(value = "completion", nulls = Nulls.SKIP) + public _FinalStage completion(Optional completion) { + this.completion = completion; + return this; + } + + @java.lang.Override + public SocialAccountLeadForm build() { + return new SocialAccountLeadForm( + completion, + createdAt, + disclaimer, + formType, + id, + intro, + locale, + name, + privacyPolicyLinkText, + privacyPolicyUrl, + questionLabels, + questions, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SocialAccountLeadFormFormType.java b/src/main/java/com/whop/api/types/SocialAccountLeadFormFormType.java new file mode 100644 index 00000000..3329c25a --- /dev/null +++ b/src/main/java/com/whop/api/types/SocialAccountLeadFormFormType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SocialAccountLeadFormFormType { + public static final SocialAccountLeadFormFormType HIGHER_INTENT = + new SocialAccountLeadFormFormType(Value.HIGHER_INTENT, "higher_intent"); + + public static final SocialAccountLeadFormFormType MORE_VOLUME = + new SocialAccountLeadFormFormType(Value.MORE_VOLUME, "more_volume"); + + private final Value value; + + private final String string; + + SocialAccountLeadFormFormType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SocialAccountLeadFormFormType + && this.string.equals(((SocialAccountLeadFormFormType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case HIGHER_INTENT: + return visitor.visitHigherIntent(); + case MORE_VOLUME: + return visitor.visitMoreVolume(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SocialAccountLeadFormFormType valueOf(String value) { + switch (value) { + case "higher_intent": + return HIGHER_INTENT; + case "more_volume": + return MORE_VOLUME; + default: + return new SocialAccountLeadFormFormType(Value.UNKNOWN, value); + } + } + + public enum Value { + MORE_VOLUME, + + HIGHER_INTENT, + + UNKNOWN + } + + public interface Visitor { + T visitMoreVolume(); + + T visitHigherIntent(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/SocialAccountParent.java b/src/main/java/com/whop/api/types/SocialAccountParent.java new file mode 100644 index 00000000..1c0f4783 --- /dev/null +++ b/src/main/java/com/whop/api/types/SocialAccountParent.java @@ -0,0 +1,494 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SocialAccountParent.Builder.class) +public final class SocialAccountParent { + private final Optional externalId; + + private final String id; + + private final Optional name; + + private final SocialAccountParentPlatform platform; + + private final Optional profilePictureUrl; + + private final Optional username; + + private final boolean verified; + + private final Map additionalProperties; + + private SocialAccountParent( + Optional externalId, + String id, + Optional name, + SocialAccountParentPlatform platform, + Optional profilePictureUrl, + Optional username, + boolean verified, + Map additionalProperties) { + this.externalId = externalId; + this.id = id; + this.name = name; + this.platform = platform; + this.profilePictureUrl = profilePictureUrl; + this.username = username; + this.verified = verified; + this.additionalProperties = additionalProperties; + } + + /** + * @return The platform-specific ID for the parent social account. + */ + @JsonIgnore + public Optional getExternalId() { + if (externalId == null) { + return Optional.empty(); + } + return externalId; + } + + /** + * @return Social account ID, prefixed sacc_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the parent social account on the platform. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The platform the parent social account exists on. + */ + @JsonProperty("platform") + public SocialAccountParentPlatform getPlatform() { + return platform; + } + + /** + * @return The URL where the profile picture of the parent social account can be accessed. + */ + @JsonIgnore + public Optional getProfilePictureUrl() { + if (profilePictureUrl == null) { + return Optional.empty(); + } + return profilePictureUrl; + } + + /** + * @return The username of the parent social account on the platform. + */ + @JsonIgnore + public Optional getUsername() { + if (username == null) { + return Optional.empty(); + } + return username; + } + + /** + * @return Whether the parent social account is verified on the platform. + */ + @JsonProperty("verified") + public boolean getVerified() { + return verified; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("external_id") + private Optional _getExternalId() { + return externalId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("profile_picture_url") + private Optional _getProfilePictureUrl() { + return profilePictureUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("username") + private Optional _getUsername() { + return username; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SocialAccountParent && equalTo((SocialAccountParent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SocialAccountParent other) { + return externalId.equals(other.externalId) + && id.equals(other.id) + && name.equals(other.name) + && platform.equals(other.platform) + && profilePictureUrl.equals(other.profilePictureUrl) + && username.equals(other.username) + && verified == other.verified; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.externalId, + this.id, + this.name, + this.platform, + this.profilePictureUrl, + this.username, + this.verified); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Social account ID, prefixed sacc_.

+ */ + PlatformStage id(@NotNull String id); + + Builder from(SocialAccountParent other); + } + + public interface PlatformStage { + /** + *

The platform the parent social account exists on.

+ */ + VerifiedStage platform(@NotNull SocialAccountParentPlatform platform); + } + + public interface VerifiedStage { + /** + *

Whether the parent social account is verified on the platform.

+ */ + _FinalStage verified(boolean verified); + } + + public interface _FinalStage { + SocialAccountParent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The platform-specific ID for the parent social account.

+ */ + _FinalStage externalId(Optional externalId); + + _FinalStage externalId(String externalId); + + _FinalStage externalId(Nullable externalId); + + /** + *

The display name of the parent social account on the platform.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

The URL where the profile picture of the parent social account can be accessed.

+ */ + _FinalStage profilePictureUrl(Optional profilePictureUrl); + + _FinalStage profilePictureUrl(String profilePictureUrl); + + _FinalStage profilePictureUrl(Nullable profilePictureUrl); + + /** + *

The username of the parent social account on the platform.

+ */ + _FinalStage username(Optional username); + + _FinalStage username(String username); + + _FinalStage username(Nullable username); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, PlatformStage, VerifiedStage, _FinalStage { + private String id; + + private SocialAccountParentPlatform platform; + + private boolean verified; + + private Optional username = Optional.empty(); + + private Optional profilePictureUrl = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional externalId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SocialAccountParent other) { + externalId(other.getExternalId()); + id(other.getId()); + name(other.getName()); + platform(other.getPlatform()); + profilePictureUrl(other.getProfilePictureUrl()); + username(other.getUsername()); + verified(other.getVerified()); + return this; + } + + /** + *

Social account ID, prefixed sacc_.

+ *

Social account ID, prefixed sacc_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public PlatformStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The platform the parent social account exists on.

+ *

The platform the parent social account exists on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("platform") + public VerifiedStage platform(@NotNull SocialAccountParentPlatform platform) { + this.platform = Objects.requireNonNull(platform, "platform must not be null"); + return this; + } + + /** + *

Whether the parent social account is verified on the platform.

+ *

Whether the parent social account is verified on the platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("verified") + public _FinalStage verified(boolean verified) { + this.verified = verified; + return this; + } + + /** + *

The username of the parent social account on the platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(Nullable username) { + if (username.isNull()) { + this.username = null; + } else if (username.isEmpty()) { + this.username = Optional.empty(); + } else { + this.username = Optional.of(username.get()); + } + return this; + } + + /** + *

The username of the parent social account on the platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + /** + *

The username of the parent social account on the platform.

+ */ + @java.lang.Override + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public _FinalStage username(Optional username) { + this.username = username; + return this; + } + + /** + *

The URL where the profile picture of the parent social account can be accessed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profilePictureUrl(Nullable profilePictureUrl) { + if (profilePictureUrl.isNull()) { + this.profilePictureUrl = null; + } else if (profilePictureUrl.isEmpty()) { + this.profilePictureUrl = Optional.empty(); + } else { + this.profilePictureUrl = Optional.of(profilePictureUrl.get()); + } + return this; + } + + /** + *

The URL where the profile picture of the parent social account can be accessed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profilePictureUrl(String profilePictureUrl) { + this.profilePictureUrl = Optional.ofNullable(profilePictureUrl); + return this; + } + + /** + *

The URL where the profile picture of the parent social account can be accessed.

+ */ + @java.lang.Override + @JsonSetter(value = "profile_picture_url", nulls = Nulls.SKIP) + public _FinalStage profilePictureUrl(Optional profilePictureUrl) { + this.profilePictureUrl = profilePictureUrl; + return this; + } + + /** + *

The display name of the parent social account on the platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The display name of the parent social account on the platform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The display name of the parent social account on the platform.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The platform-specific ID for the parent social account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage externalId(Nullable externalId) { + if (externalId.isNull()) { + this.externalId = null; + } else if (externalId.isEmpty()) { + this.externalId = Optional.empty(); + } else { + this.externalId = Optional.of(externalId.get()); + } + return this; + } + + /** + *

The platform-specific ID for the parent social account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage externalId(String externalId) { + this.externalId = Optional.ofNullable(externalId); + return this; + } + + /** + *

The platform-specific ID for the parent social account.

+ */ + @java.lang.Override + @JsonSetter(value = "external_id", nulls = Nulls.SKIP) + public _FinalStage externalId(Optional externalId) { + this.externalId = externalId; + return this; + } + + @java.lang.Override + public SocialAccountParent build() { + return new SocialAccountParent( + externalId, id, name, platform, profilePictureUrl, username, verified, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SocialAccountParentPlatform.java b/src/main/java/com/whop/api/types/SocialAccountParentPlatform.java new file mode 100644 index 00000000..f175735c --- /dev/null +++ b/src/main/java/com/whop/api/types/SocialAccountParentPlatform.java @@ -0,0 +1,137 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SocialAccountParentPlatform { + public static final SocialAccountParentPlatform INSTAGRAM = + new SocialAccountParentPlatform(Value.INSTAGRAM, "instagram"); + + public static final SocialAccountParentPlatform FACEBOOK = + new SocialAccountParentPlatform(Value.FACEBOOK, "facebook"); + + public static final SocialAccountParentPlatform YOUTUBE = new SocialAccountParentPlatform(Value.YOUTUBE, "youtube"); + + public static final SocialAccountParentPlatform DISCORD = new SocialAccountParentPlatform(Value.DISCORD, "discord"); + + public static final SocialAccountParentPlatform TELEGRAM = + new SocialAccountParentPlatform(Value.TELEGRAM, "telegram"); + + public static final SocialAccountParentPlatform X = new SocialAccountParentPlatform(Value.X, "x"); + + public static final SocialAccountParentPlatform TIKTOK = new SocialAccountParentPlatform(Value.TIKTOK, "tiktok"); + + private final Value value; + + private final String string; + + SocialAccountParentPlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SocialAccountParentPlatform + && this.string.equals(((SocialAccountParentPlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTAGRAM: + return visitor.visitInstagram(); + case FACEBOOK: + return visitor.visitFacebook(); + case YOUTUBE: + return visitor.visitYoutube(); + case DISCORD: + return visitor.visitDiscord(); + case TELEGRAM: + return visitor.visitTelegram(); + case X: + return visitor.visitX(); + case TIKTOK: + return visitor.visitTiktok(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SocialAccountParentPlatform valueOf(String value) { + switch (value) { + case "instagram": + return INSTAGRAM; + case "facebook": + return FACEBOOK; + case "youtube": + return YOUTUBE; + case "discord": + return DISCORD; + case "telegram": + return TELEGRAM; + case "x": + return X; + case "tiktok": + return TIKTOK; + default: + return new SocialAccountParentPlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + X, + + INSTAGRAM, + + YOUTUBE, + + TIKTOK, + + FACEBOOK, + + DISCORD, + + TELEGRAM, + + UNKNOWN + } + + public interface Visitor { + T visitX(); + + T visitInstagram(); + + T visitYoutube(); + + T visitTiktok(); + + T visitFacebook(); + + T visitDiscord(); + + T visitTelegram(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/SocialAccountPlatform.java b/src/main/java/com/whop/api/types/SocialAccountPlatform.java new file mode 100644 index 00000000..445516f6 --- /dev/null +++ b/src/main/java/com/whop/api/types/SocialAccountPlatform.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SocialAccountPlatform { + public static final SocialAccountPlatform INSTAGRAM = new SocialAccountPlatform(Value.INSTAGRAM, "instagram"); + + public static final SocialAccountPlatform FACEBOOK = new SocialAccountPlatform(Value.FACEBOOK, "facebook"); + + public static final SocialAccountPlatform YOUTUBE = new SocialAccountPlatform(Value.YOUTUBE, "youtube"); + + public static final SocialAccountPlatform DISCORD = new SocialAccountPlatform(Value.DISCORD, "discord"); + + public static final SocialAccountPlatform TELEGRAM = new SocialAccountPlatform(Value.TELEGRAM, "telegram"); + + public static final SocialAccountPlatform X = new SocialAccountPlatform(Value.X, "x"); + + public static final SocialAccountPlatform TIKTOK = new SocialAccountPlatform(Value.TIKTOK, "tiktok"); + + private final Value value; + + private final String string; + + SocialAccountPlatform(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SocialAccountPlatform + && this.string.equals(((SocialAccountPlatform) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTAGRAM: + return visitor.visitInstagram(); + case FACEBOOK: + return visitor.visitFacebook(); + case YOUTUBE: + return visitor.visitYoutube(); + case DISCORD: + return visitor.visitDiscord(); + case TELEGRAM: + return visitor.visitTelegram(); + case X: + return visitor.visitX(); + case TIKTOK: + return visitor.visitTiktok(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SocialAccountPlatform valueOf(String value) { + switch (value) { + case "instagram": + return INSTAGRAM; + case "facebook": + return FACEBOOK; + case "youtube": + return YOUTUBE; + case "discord": + return DISCORD; + case "telegram": + return TELEGRAM; + case "x": + return X; + case "tiktok": + return TIKTOK; + default: + return new SocialAccountPlatform(Value.UNKNOWN, value); + } + } + + public enum Value { + X, + + INSTAGRAM, + + YOUTUBE, + + TIKTOK, + + FACEBOOK, + + DISCORD, + + TELEGRAM, + + UNKNOWN + } + + public interface Visitor { + T visitX(); + + T visitInstagram(); + + T visitYoutube(); + + T visitTiktok(); + + T visitFacebook(); + + T visitDiscord(); + + T visitTelegram(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/SocialAccountPost.java b/src/main/java/com/whop/api/types/SocialAccountPost.java new file mode 100644 index 00000000..946c0097 --- /dev/null +++ b/src/main/java/com/whop/api/types/SocialAccountPost.java @@ -0,0 +1,546 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SocialAccountPost.Builder.class) +public final class SocialAccountPost { + private final Optional callToAction; + + private final Optional destinationUrl; + + private final Optional embedUrl; + + private final String id; + + private final Optional mediaUrl; + + private final List restrictions; + + private final Optional thumbnailUrl; + + private final Map additionalProperties; + + private SocialAccountPost( + Optional callToAction, + Optional destinationUrl, + Optional embedUrl, + String id, + Optional mediaUrl, + List restrictions, + Optional thumbnailUrl, + Map additionalProperties) { + this.callToAction = callToAction; + this.destinationUrl = destinationUrl; + this.embedUrl = embedUrl; + this.id = id; + this.mediaUrl = mediaUrl; + this.restrictions = restrictions; + this.thumbnailUrl = thumbnailUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The post's call-to-action button, for example shop_now (Facebook only; null for Instagram and TikTok). + */ + @JsonIgnore + public Optional getCallToAction() { + if (callToAction == null) { + return Optional.empty(); + } + return callToAction; + } + + /** + * @return The URL the post's call-to-action drives to (Facebook only; null for Instagram and TikTok). + */ + @JsonIgnore + public Optional getDestinationUrl() { + if (destinationUrl == null) { + return Optional.empty(); + } + return destinationUrl; + } + + /** + * @return An iframe-embeddable URL for previewing the post inline (the platform's player or post embed). For TikTok this is the only preview, since media_url is null; for Facebook and Instagram it supplements media_url. Null when no public embed is available. + */ + @JsonIgnore + public Optional getEmbedUrl() { + if (embedUrl == null) { + return Optional.empty(); + } + return embedUrl; + } + + /** + * @return The platform's own identifier for the post or media. Use it to reference the post on an ad. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The URL of the post's media — the image for image posts, the playable video file for video posts. Null for TikTok, which exposes no raw file (use embed_url). Meta URLs are signed and expire after roughly 24 hours, so don't store them. + */ + @JsonIgnore + public Optional getMediaUrl() { + if (mediaUrl == null) { + return Optional.empty(); + } + return mediaUrl; + } + + @JsonProperty("restrictions") + public List getRestrictions() { + return restrictions; + } + + /** + * @return Poster image for video posts (always set for TikTok, which is video-only); null for image posts, where media_url is already the image. + */ + @JsonIgnore + public Optional getThumbnailUrl() { + if (thumbnailUrl == null) { + return Optional.empty(); + } + return thumbnailUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("call_to_action") + private Optional _getCallToAction() { + return callToAction; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("destination_url") + private Optional _getDestinationUrl() { + return destinationUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("embed_url") + private Optional _getEmbedUrl() { + return embedUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("media_url") + private Optional _getMediaUrl() { + return mediaUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("thumbnail_url") + private Optional _getThumbnailUrl() { + return thumbnailUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SocialAccountPost && equalTo((SocialAccountPost) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SocialAccountPost other) { + return callToAction.equals(other.callToAction) + && destinationUrl.equals(other.destinationUrl) + && embedUrl.equals(other.embedUrl) + && id.equals(other.id) + && mediaUrl.equals(other.mediaUrl) + && restrictions.equals(other.restrictions) + && thumbnailUrl.equals(other.thumbnailUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.callToAction, + this.destinationUrl, + this.embedUrl, + this.id, + this.mediaUrl, + this.restrictions, + this.thumbnailUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The platform's own identifier for the post or media. Use it to reference the post on an ad.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(SocialAccountPost other); + } + + public interface _FinalStage { + SocialAccountPost build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The post's call-to-action button, for example shop_now (Facebook only; null for Instagram and TikTok).

+ */ + _FinalStage callToAction(Optional callToAction); + + _FinalStage callToAction(SocialAccountPostCallToAction callToAction); + + _FinalStage callToAction(Nullable callToAction); + + /** + *

The URL the post's call-to-action drives to (Facebook only; null for Instagram and TikTok).

+ */ + _FinalStage destinationUrl(Optional destinationUrl); + + _FinalStage destinationUrl(String destinationUrl); + + _FinalStage destinationUrl(Nullable destinationUrl); + + /** + *

An iframe-embeddable URL for previewing the post inline (the platform's player or post embed). For TikTok this is the only preview, since media_url is null; for Facebook and Instagram it supplements media_url. Null when no public embed is available.

+ */ + _FinalStage embedUrl(Optional embedUrl); + + _FinalStage embedUrl(String embedUrl); + + _FinalStage embedUrl(Nullable embedUrl); + + /** + *

The URL of the post's media — the image for image posts, the playable video file for video posts. Null for TikTok, which exposes no raw file (use embed_url). Meta URLs are signed and expire after roughly 24 hours, so don't store them.

+ */ + _FinalStage mediaUrl(Optional mediaUrl); + + _FinalStage mediaUrl(String mediaUrl); + + _FinalStage mediaUrl(Nullable mediaUrl); + + _FinalStage restrictions(List restrictions); + + _FinalStage addRestrictions(SocialAccountPostRestrictionsItem restrictions); + + _FinalStage addAllRestrictions(List restrictions); + + /** + *

Poster image for video posts (always set for TikTok, which is video-only); null for image posts, where media_url is already the image.

+ */ + _FinalStage thumbnailUrl(Optional thumbnailUrl); + + _FinalStage thumbnailUrl(String thumbnailUrl); + + _FinalStage thumbnailUrl(Nullable thumbnailUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional thumbnailUrl = Optional.empty(); + + private List restrictions = new ArrayList<>(); + + private Optional mediaUrl = Optional.empty(); + + private Optional embedUrl = Optional.empty(); + + private Optional destinationUrl = Optional.empty(); + + private Optional callToAction = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SocialAccountPost other) { + callToAction(other.getCallToAction()); + destinationUrl(other.getDestinationUrl()); + embedUrl(other.getEmbedUrl()); + id(other.getId()); + mediaUrl(other.getMediaUrl()); + restrictions(other.getRestrictions()); + thumbnailUrl(other.getThumbnailUrl()); + return this; + } + + /** + *

The platform's own identifier for the post or media. Use it to reference the post on an ad.

+ *

The platform's own identifier for the post or media. Use it to reference the post on an ad.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Poster image for video posts (always set for TikTok, which is video-only); null for image posts, where media_url is already the image.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnailUrl(Nullable thumbnailUrl) { + if (thumbnailUrl.isNull()) { + this.thumbnailUrl = null; + } else if (thumbnailUrl.isEmpty()) { + this.thumbnailUrl = Optional.empty(); + } else { + this.thumbnailUrl = Optional.of(thumbnailUrl.get()); + } + return this; + } + + /** + *

Poster image for video posts (always set for TikTok, which is video-only); null for image posts, where media_url is already the image.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = Optional.ofNullable(thumbnailUrl); + return this; + } + + /** + *

Poster image for video posts (always set for TikTok, which is video-only); null for image posts, where media_url is already the image.

+ */ + @java.lang.Override + @JsonSetter(value = "thumbnail_url", nulls = Nulls.SKIP) + public _FinalStage thumbnailUrl(Optional thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + @java.lang.Override + public _FinalStage addAllRestrictions(List restrictions) { + if (restrictions != null) { + this.restrictions.addAll(restrictions); + } + return this; + } + + @java.lang.Override + public _FinalStage addRestrictions(SocialAccountPostRestrictionsItem restrictions) { + this.restrictions.add(restrictions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "restrictions", nulls = Nulls.SKIP) + public _FinalStage restrictions(List restrictions) { + this.restrictions.clear(); + if (restrictions != null) { + this.restrictions.addAll(restrictions); + } + return this; + } + + /** + *

The URL of the post's media — the image for image posts, the playable video file for video posts. Null for TikTok, which exposes no raw file (use embed_url). Meta URLs are signed and expire after roughly 24 hours, so don't store them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mediaUrl(Nullable mediaUrl) { + if (mediaUrl.isNull()) { + this.mediaUrl = null; + } else if (mediaUrl.isEmpty()) { + this.mediaUrl = Optional.empty(); + } else { + this.mediaUrl = Optional.of(mediaUrl.get()); + } + return this; + } + + /** + *

The URL of the post's media — the image for image posts, the playable video file for video posts. Null for TikTok, which exposes no raw file (use embed_url). Meta URLs are signed and expire after roughly 24 hours, so don't store them.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mediaUrl(String mediaUrl) { + this.mediaUrl = Optional.ofNullable(mediaUrl); + return this; + } + + /** + *

The URL of the post's media — the image for image posts, the playable video file for video posts. Null for TikTok, which exposes no raw file (use embed_url). Meta URLs are signed and expire after roughly 24 hours, so don't store them.

+ */ + @java.lang.Override + @JsonSetter(value = "media_url", nulls = Nulls.SKIP) + public _FinalStage mediaUrl(Optional mediaUrl) { + this.mediaUrl = mediaUrl; + return this; + } + + /** + *

An iframe-embeddable URL for previewing the post inline (the platform's player or post embed). For TikTok this is the only preview, since media_url is null; for Facebook and Instagram it supplements media_url. Null when no public embed is available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage embedUrl(Nullable embedUrl) { + if (embedUrl.isNull()) { + this.embedUrl = null; + } else if (embedUrl.isEmpty()) { + this.embedUrl = Optional.empty(); + } else { + this.embedUrl = Optional.of(embedUrl.get()); + } + return this; + } + + /** + *

An iframe-embeddable URL for previewing the post inline (the platform's player or post embed). For TikTok this is the only preview, since media_url is null; for Facebook and Instagram it supplements media_url. Null when no public embed is available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage embedUrl(String embedUrl) { + this.embedUrl = Optional.ofNullable(embedUrl); + return this; + } + + /** + *

An iframe-embeddable URL for previewing the post inline (the platform's player or post embed). For TikTok this is the only preview, since media_url is null; for Facebook and Instagram it supplements media_url. Null when no public embed is available.

+ */ + @java.lang.Override + @JsonSetter(value = "embed_url", nulls = Nulls.SKIP) + public _FinalStage embedUrl(Optional embedUrl) { + this.embedUrl = embedUrl; + return this; + } + + /** + *

The URL the post's call-to-action drives to (Facebook only; null for Instagram and TikTok).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationUrl(Nullable destinationUrl) { + if (destinationUrl.isNull()) { + this.destinationUrl = null; + } else if (destinationUrl.isEmpty()) { + this.destinationUrl = Optional.empty(); + } else { + this.destinationUrl = Optional.of(destinationUrl.get()); + } + return this; + } + + /** + *

The URL the post's call-to-action drives to (Facebook only; null for Instagram and TikTok).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinationUrl(String destinationUrl) { + this.destinationUrl = Optional.ofNullable(destinationUrl); + return this; + } + + /** + *

The URL the post's call-to-action drives to (Facebook only; null for Instagram and TikTok).

+ */ + @java.lang.Override + @JsonSetter(value = "destination_url", nulls = Nulls.SKIP) + public _FinalStage destinationUrl(Optional destinationUrl) { + this.destinationUrl = destinationUrl; + return this; + } + + /** + *

The post's call-to-action button, for example shop_now (Facebook only; null for Instagram and TikTok).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage callToAction(Nullable callToAction) { + if (callToAction.isNull()) { + this.callToAction = null; + } else if (callToAction.isEmpty()) { + this.callToAction = Optional.empty(); + } else { + this.callToAction = Optional.of(callToAction.get()); + } + return this; + } + + /** + *

The post's call-to-action button, for example shop_now (Facebook only; null for Instagram and TikTok).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage callToAction(SocialAccountPostCallToAction callToAction) { + this.callToAction = Optional.ofNullable(callToAction); + return this; + } + + /** + *

The post's call-to-action button, for example shop_now (Facebook only; null for Instagram and TikTok).

+ */ + @java.lang.Override + @JsonSetter(value = "call_to_action", nulls = Nulls.SKIP) + public _FinalStage callToAction(Optional callToAction) { + this.callToAction = callToAction; + return this; + } + + @java.lang.Override + public SocialAccountPost build() { + return new SocialAccountPost( + callToAction, + destinationUrl, + embedUrl, + id, + mediaUrl, + restrictions, + thumbnailUrl, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SocialAccountPostCallToAction.java b/src/main/java/com/whop/api/types/SocialAccountPostCallToAction.java new file mode 100644 index 00000000..baad7287 --- /dev/null +++ b/src/main/java/com/whop/api/types/SocialAccountPostCallToAction.java @@ -0,0 +1,405 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SocialAccountPostCallToAction { + public static final SocialAccountPostCallToAction WHATSAPP_MESSAGE = + new SocialAccountPostCallToAction(Value.WHATSAPP_MESSAGE, "whatsapp_message"); + + public static final SocialAccountPostCallToAction REQUEST_TIME = + new SocialAccountPostCallToAction(Value.REQUEST_TIME, "request_time"); + + public static final SocialAccountPostCallToAction NO_BUTTON = + new SocialAccountPostCallToAction(Value.NO_BUTTON, "no_button"); + + public static final SocialAccountPostCallToAction GET_STARTED = + new SocialAccountPostCallToAction(Value.GET_STARTED, "get_started"); + + public static final SocialAccountPostCallToAction GET_OFFER = + new SocialAccountPostCallToAction(Value.GET_OFFER, "get_offer"); + + public static final SocialAccountPostCallToAction OPEN_LINK = + new SocialAccountPostCallToAction(Value.OPEN_LINK, "open_link"); + + public static final SocialAccountPostCallToAction INSTAGRAM_MESSAGE = + new SocialAccountPostCallToAction(Value.INSTAGRAM_MESSAGE, "instagram_message"); + + public static final SocialAccountPostCallToAction LISTEN_NOW = + new SocialAccountPostCallToAction(Value.LISTEN_NOW, "listen_now"); + + public static final SocialAccountPostCallToAction ORDER_NOW = + new SocialAccountPostCallToAction(Value.ORDER_NOW, "order_now"); + + public static final SocialAccountPostCallToAction GET_QUOTE = + new SocialAccountPostCallToAction(Value.GET_QUOTE, "get_quote"); + + public static final SocialAccountPostCallToAction LEARN_MORE = + new SocialAccountPostCallToAction(Value.LEARN_MORE, "learn_more"); + + public static final SocialAccountPostCallToAction DOWNLOAD = + new SocialAccountPostCallToAction(Value.DOWNLOAD, "download"); + + public static final SocialAccountPostCallToAction SEND_UPDATES = + new SocialAccountPostCallToAction(Value.SEND_UPDATES, "send_updates"); + + public static final SocialAccountPostCallToAction CONTACT_US = + new SocialAccountPostCallToAction(Value.CONTACT_US, "contact_us"); + + public static final SocialAccountPostCallToAction WATCH_MORE = + new SocialAccountPostCallToAction(Value.WATCH_MORE, "watch_more"); + + public static final SocialAccountPostCallToAction BOOK_NOW = + new SocialAccountPostCallToAction(Value.BOOK_NOW, "book_now"); + + public static final SocialAccountPostCallToAction SIGN_UP = + new SocialAccountPostCallToAction(Value.SIGN_UP, "sign_up"); + + public static final SocialAccountPostCallToAction GET_EVENT_TICKETS = + new SocialAccountPostCallToAction(Value.GET_EVENT_TICKETS, "get_event_tickets"); + + public static final SocialAccountPostCallToAction VIEW_INSTAGRAM_PROFILE = + new SocialAccountPostCallToAction(Value.VIEW_INSTAGRAM_PROFILE, "view_instagram_profile"); + + public static final SocialAccountPostCallToAction EVENT_RSVP = + new SocialAccountPostCallToAction(Value.EVENT_RSVP, "event_rsvp"); + + public static final SocialAccountPostCallToAction SHOP_NOW = + new SocialAccountPostCallToAction(Value.SHOP_NOW, "shop_now"); + + public static final SocialAccountPostCallToAction GET_OFFER_VIEW = + new SocialAccountPostCallToAction(Value.GET_OFFER_VIEW, "get_offer_view"); + + public static final SocialAccountPostCallToAction MESSAGE_PAGE = + new SocialAccountPostCallToAction(Value.MESSAGE_PAGE, "message_page"); + + public static final SocialAccountPostCallToAction GET_DIRECTIONS = + new SocialAccountPostCallToAction(Value.GET_DIRECTIONS, "get_directions"); + + public static final SocialAccountPostCallToAction SEE_DETAILS = + new SocialAccountPostCallToAction(Value.SEE_DETAILS, "see_details"); + + public static final SocialAccountPostCallToAction CALL_NOW = + new SocialAccountPostCallToAction(Value.CALL_NOW, "call_now"); + + public static final SocialAccountPostCallToAction SUBSCRIBE = + new SocialAccountPostCallToAction(Value.SUBSCRIBE, "subscribe"); + + public static final SocialAccountPostCallToAction BUY_NOW = + new SocialAccountPostCallToAction(Value.BUY_NOW, "buy_now"); + + public static final SocialAccountPostCallToAction SEE_MENU = + new SocialAccountPostCallToAction(Value.SEE_MENU, "see_menu"); + + public static final SocialAccountPostCallToAction APPLY_NOW = + new SocialAccountPostCallToAction(Value.APPLY_NOW, "apply_now"); + + public static final SocialAccountPostCallToAction PLAY_GAME = + new SocialAccountPostCallToAction(Value.PLAY_GAME, "play_game"); + + private final Value value; + + private final String string; + + SocialAccountPostCallToAction(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SocialAccountPostCallToAction + && this.string.equals(((SocialAccountPostCallToAction) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case WHATSAPP_MESSAGE: + return visitor.visitWhatsappMessage(); + case REQUEST_TIME: + return visitor.visitRequestTime(); + case NO_BUTTON: + return visitor.visitNoButton(); + case GET_STARTED: + return visitor.visitGetStarted(); + case GET_OFFER: + return visitor.visitGetOffer(); + case OPEN_LINK: + return visitor.visitOpenLink(); + case INSTAGRAM_MESSAGE: + return visitor.visitInstagramMessage(); + case LISTEN_NOW: + return visitor.visitListenNow(); + case ORDER_NOW: + return visitor.visitOrderNow(); + case GET_QUOTE: + return visitor.visitGetQuote(); + case LEARN_MORE: + return visitor.visitLearnMore(); + case DOWNLOAD: + return visitor.visitDownload(); + case SEND_UPDATES: + return visitor.visitSendUpdates(); + case CONTACT_US: + return visitor.visitContactUs(); + case WATCH_MORE: + return visitor.visitWatchMore(); + case BOOK_NOW: + return visitor.visitBookNow(); + case SIGN_UP: + return visitor.visitSignUp(); + case GET_EVENT_TICKETS: + return visitor.visitGetEventTickets(); + case VIEW_INSTAGRAM_PROFILE: + return visitor.visitViewInstagramProfile(); + case EVENT_RSVP: + return visitor.visitEventRsvp(); + case SHOP_NOW: + return visitor.visitShopNow(); + case GET_OFFER_VIEW: + return visitor.visitGetOfferView(); + case MESSAGE_PAGE: + return visitor.visitMessagePage(); + case GET_DIRECTIONS: + return visitor.visitGetDirections(); + case SEE_DETAILS: + return visitor.visitSeeDetails(); + case CALL_NOW: + return visitor.visitCallNow(); + case SUBSCRIBE: + return visitor.visitSubscribe(); + case BUY_NOW: + return visitor.visitBuyNow(); + case SEE_MENU: + return visitor.visitSeeMenu(); + case APPLY_NOW: + return visitor.visitApplyNow(); + case PLAY_GAME: + return visitor.visitPlayGame(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SocialAccountPostCallToAction valueOf(String value) { + switch (value) { + case "whatsapp_message": + return WHATSAPP_MESSAGE; + case "request_time": + return REQUEST_TIME; + case "no_button": + return NO_BUTTON; + case "get_started": + return GET_STARTED; + case "get_offer": + return GET_OFFER; + case "open_link": + return OPEN_LINK; + case "instagram_message": + return INSTAGRAM_MESSAGE; + case "listen_now": + return LISTEN_NOW; + case "order_now": + return ORDER_NOW; + case "get_quote": + return GET_QUOTE; + case "learn_more": + return LEARN_MORE; + case "download": + return DOWNLOAD; + case "send_updates": + return SEND_UPDATES; + case "contact_us": + return CONTACT_US; + case "watch_more": + return WATCH_MORE; + case "book_now": + return BOOK_NOW; + case "sign_up": + return SIGN_UP; + case "get_event_tickets": + return GET_EVENT_TICKETS; + case "view_instagram_profile": + return VIEW_INSTAGRAM_PROFILE; + case "event_rsvp": + return EVENT_RSVP; + case "shop_now": + return SHOP_NOW; + case "get_offer_view": + return GET_OFFER_VIEW; + case "message_page": + return MESSAGE_PAGE; + case "get_directions": + return GET_DIRECTIONS; + case "see_details": + return SEE_DETAILS; + case "call_now": + return CALL_NOW; + case "subscribe": + return SUBSCRIBE; + case "buy_now": + return BUY_NOW; + case "see_menu": + return SEE_MENU; + case "apply_now": + return APPLY_NOW; + case "play_game": + return PLAY_GAME; + default: + return new SocialAccountPostCallToAction(Value.UNKNOWN, value); + } + } + + public enum Value { + LEARN_MORE, + + SHOP_NOW, + + SIGN_UP, + + SUBSCRIBE, + + GET_STARTED, + + BOOK_NOW, + + APPLY_NOW, + + CONTACT_US, + + DOWNLOAD, + + ORDER_NOW, + + BUY_NOW, + + GET_QUOTE, + + MESSAGE_PAGE, + + WHATSAPP_MESSAGE, + + INSTAGRAM_MESSAGE, + + CALL_NOW, + + GET_DIRECTIONS, + + SEND_UPDATES, + + GET_OFFER, + + WATCH_MORE, + + LISTEN_NOW, + + PLAY_GAME, + + OPEN_LINK, + + NO_BUTTON, + + GET_OFFER_VIEW, + + GET_EVENT_TICKETS, + + SEE_MENU, + + REQUEST_TIME, + + EVENT_RSVP, + + SEE_DETAILS, + + VIEW_INSTAGRAM_PROFILE, + + UNKNOWN + } + + public interface Visitor { + T visitLearnMore(); + + T visitShopNow(); + + T visitSignUp(); + + T visitSubscribe(); + + T visitGetStarted(); + + T visitBookNow(); + + T visitApplyNow(); + + T visitContactUs(); + + T visitDownload(); + + T visitOrderNow(); + + T visitBuyNow(); + + T visitGetQuote(); + + T visitMessagePage(); + + T visitWhatsappMessage(); + + T visitInstagramMessage(); + + T visitCallNow(); + + T visitGetDirections(); + + T visitSendUpdates(); + + T visitGetOffer(); + + T visitWatchMore(); + + T visitListenNow(); + + T visitPlayGame(); + + T visitOpenLink(); + + T visitNoButton(); + + T visitGetOfferView(); + + T visitGetEventTickets(); + + T visitSeeMenu(); + + T visitRequestTime(); + + T visitEventRsvp(); + + T visitSeeDetails(); + + T visitViewInstagramProfile(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/SocialAccountPostRestrictionsItem.java b/src/main/java/com/whop/api/types/SocialAccountPostRestrictionsItem.java new file mode 100644 index 00000000..833309bd --- /dev/null +++ b/src/main/java/com/whop/api/types/SocialAccountPostRestrictionsItem.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SocialAccountPostRestrictionsItem { + public static final SocialAccountPostRestrictionsItem MESSENGER_DESTINATION = + new SocialAccountPostRestrictionsItem(Value.MESSENGER_DESTINATION, "messenger_destination"); + + public static final SocialAccountPostRestrictionsItem PROMOTION_INELIGIBLE = + new SocialAccountPostRestrictionsItem(Value.PROMOTION_INELIGIBLE, "promotion_ineligible"); + + public static final SocialAccountPostRestrictionsItem LEAD_FORM_INELIGIBLE = + new SocialAccountPostRestrictionsItem(Value.LEAD_FORM_INELIGIBLE, "lead_form_ineligible"); + + public static final SocialAccountPostRestrictionsItem COPYRIGHTED_MUSIC = + new SocialAccountPostRestrictionsItem(Value.COPYRIGHTED_MUSIC, "copyrighted_music"); + + public static final SocialAccountPostRestrictionsItem INSTAGRAM_DESTINATION = + new SocialAccountPostRestrictionsItem(Value.INSTAGRAM_DESTINATION, "instagram_destination"); + + public static final SocialAccountPostRestrictionsItem WHATSAPP_DESTINATION = + new SocialAccountPostRestrictionsItem(Value.WHATSAPP_DESTINATION, "whatsapp_destination"); + + private final Value value; + + private final String string; + + SocialAccountPostRestrictionsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SocialAccountPostRestrictionsItem + && this.string.equals(((SocialAccountPostRestrictionsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MESSENGER_DESTINATION: + return visitor.visitMessengerDestination(); + case PROMOTION_INELIGIBLE: + return visitor.visitPromotionIneligible(); + case LEAD_FORM_INELIGIBLE: + return visitor.visitLeadFormIneligible(); + case COPYRIGHTED_MUSIC: + return visitor.visitCopyrightedMusic(); + case INSTAGRAM_DESTINATION: + return visitor.visitInstagramDestination(); + case WHATSAPP_DESTINATION: + return visitor.visitWhatsappDestination(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SocialAccountPostRestrictionsItem valueOf(String value) { + switch (value) { + case "messenger_destination": + return MESSENGER_DESTINATION; + case "promotion_ineligible": + return PROMOTION_INELIGIBLE; + case "lead_form_ineligible": + return LEAD_FORM_INELIGIBLE; + case "copyrighted_music": + return COPYRIGHTED_MUSIC; + case "instagram_destination": + return INSTAGRAM_DESTINATION; + case "whatsapp_destination": + return WHATSAPP_DESTINATION; + default: + return new SocialAccountPostRestrictionsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + LEAD_FORM_INELIGIBLE, + + PROMOTION_INELIGIBLE, + + COPYRIGHTED_MUSIC, + + MESSENGER_DESTINATION, + + INSTAGRAM_DESTINATION, + + WHATSAPP_DESTINATION, + + UNKNOWN + } + + public interface Visitor { + T visitLeadFormIneligible(); + + T visitPromotionIneligible(); + + T visitCopyrightedMusic(); + + T visitMessengerDestination(); + + T visitInstagramDestination(); + + T visitWhatsappDestination(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/SocialLinkWebsites.java b/src/main/java/com/whop/api/types/SocialLinkWebsites.java new file mode 100644 index 00000000..c8e1e2ab --- /dev/null +++ b/src/main/java/com/whop/api/types/SocialLinkWebsites.java @@ -0,0 +1,153 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SocialLinkWebsites { + public static final SocialLinkWebsites INSTAGRAM = new SocialLinkWebsites(Value.INSTAGRAM, "instagram"); + + public static final SocialLinkWebsites WEBSITE = new SocialLinkWebsites(Value.WEBSITE, "website"); + + public static final SocialLinkWebsites TWITCH = new SocialLinkWebsites(Value.TWITCH, "twitch"); + + public static final SocialLinkWebsites FACEBOOK = new SocialLinkWebsites(Value.FACEBOOK, "facebook"); + + public static final SocialLinkWebsites YOUTUBE = new SocialLinkWebsites(Value.YOUTUBE, "youtube"); + + public static final SocialLinkWebsites CUSTOM = new SocialLinkWebsites(Value.CUSTOM, "custom"); + + public static final SocialLinkWebsites LINKEDIN = new SocialLinkWebsites(Value.LINKEDIN, "linkedin"); + + public static final SocialLinkWebsites X = new SocialLinkWebsites(Value.X, "x"); + + public static final SocialLinkWebsites TIKTOK = new SocialLinkWebsites(Value.TIKTOK, "tiktok"); + + private final Value value; + + private final String string; + + SocialLinkWebsites(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SocialLinkWebsites && this.string.equals(((SocialLinkWebsites) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTAGRAM: + return visitor.visitInstagram(); + case WEBSITE: + return visitor.visitWebsite(); + case TWITCH: + return visitor.visitTwitch(); + case FACEBOOK: + return visitor.visitFacebook(); + case YOUTUBE: + return visitor.visitYoutube(); + case CUSTOM: + return visitor.visitCustom(); + case LINKEDIN: + return visitor.visitLinkedin(); + case X: + return visitor.visitX(); + case TIKTOK: + return visitor.visitTiktok(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SocialLinkWebsites valueOf(String value) { + switch (value) { + case "instagram": + return INSTAGRAM; + case "website": + return WEBSITE; + case "twitch": + return TWITCH; + case "facebook": + return FACEBOOK; + case "youtube": + return YOUTUBE; + case "custom": + return CUSTOM; + case "linkedin": + return LINKEDIN; + case "x": + return X; + case "tiktok": + return TIKTOK; + default: + return new SocialLinkWebsites(Value.UNKNOWN, value); + } + } + + public enum Value { + X, + + INSTAGRAM, + + FACEBOOK, + + TIKTOK, + + YOUTUBE, + + LINKEDIN, + + TWITCH, + + WEBSITE, + + CUSTOM, + + UNKNOWN + } + + public interface Visitor { + T visitX(); + + T visitInstagram(); + + T visitFacebook(); + + T visitTiktok(); + + T visitYoutube(); + + T visitLinkedin(); + + T visitTwitch(); + + T visitWebsite(); + + T visitCustom(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/SpecificFeeOrigins.java b/src/main/java/com/whop/api/types/SpecificFeeOrigins.java new file mode 100644 index 00000000..edfb7b4a --- /dev/null +++ b/src/main/java/com/whop/api/types/SpecificFeeOrigins.java @@ -0,0 +1,410 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SpecificFeeOrigins { + public static final SpecificFeeOrigins APPLE_PROCESSING_FEE = + new SpecificFeeOrigins(Value.APPLE_PROCESSING_FEE, "apple_processing_fee"); + + public static final SpecificFeeOrigins STRIPE_INTERNATIONAL_PROCESSING_FEE = + new SpecificFeeOrigins(Value.STRIPE_INTERNATIONAL_PROCESSING_FEE, "stripe_international_processing_fee"); + + public static final SpecificFeeOrigins MARKETPLACE_AFFILIATE_FEE = + new SpecificFeeOrigins(Value.MARKETPLACE_AFFILIATE_FEE, "marketplace_affiliate_fee"); + + public static final SpecificFeeOrigins DISPUTE_FEE = new SpecificFeeOrigins(Value.DISPUTE_FEE, "dispute_fee"); + + public static final SpecificFeeOrigins STRIPE_DOMESTIC_PROCESSING_FEE = + new SpecificFeeOrigins(Value.STRIPE_DOMESTIC_PROCESSING_FEE, "stripe_domestic_processing_fee"); + + public static final SpecificFeeOrigins BILLING_PERCENTAGE_FEE = + new SpecificFeeOrigins(Value.BILLING_PERCENTAGE_FEE, "billing_percentage_fee"); + + public static final SpecificFeeOrigins PAYMENT_PROCESSING_PERCENTAGE_FEE = + new SpecificFeeOrigins(Value.PAYMENT_PROCESSING_PERCENTAGE_FEE, "payment_processing_percentage_fee"); + + public static final SpecificFeeOrigins THREE_DS_FIXED_FEE = + new SpecificFeeOrigins(Value.THREE_DS_FIXED_FEE, "three_ds_fixed_fee"); + + public static final SpecificFeeOrigins PAYPAL_FEE = new SpecificFeeOrigins(Value.PAYPAL_FEE, "paypal_fee"); + + public static final SpecificFeeOrigins DISPUTE_ALERT_FEE = + new SpecificFeeOrigins(Value.DISPUTE_ALERT_FEE, "dispute_alert_fee"); + + public static final SpecificFeeOrigins APPLICATION_FEE = + new SpecificFeeOrigins(Value.APPLICATION_FEE, "application_fee"); + + public static final SpecificFeeOrigins AFFILIATE_FEE = new SpecificFeeOrigins(Value.AFFILIATE_FEE, "affiliate_fee"); + + public static final SpecificFeeOrigins SEZZLE_PROCESSING_FEE = + new SpecificFeeOrigins(Value.SEZZLE_PROCESSING_FEE, "sezzle_processing_fee"); + + public static final SpecificFeeOrigins STRIPE_STANDARD_PROCESSING_FEE = + new SpecificFeeOrigins(Value.STRIPE_STANDARD_PROCESSING_FEE, "stripe_standard_processing_fee"); + + public static final SpecificFeeOrigins STRIPE_FIXED_PROCESSING_FEE = + new SpecificFeeOrigins(Value.STRIPE_FIXED_PROCESSING_FEE, "stripe_fixed_processing_fee"); + + public static final SpecificFeeOrigins STRIPE_BILLING_FEE = + new SpecificFeeOrigins(Value.STRIPE_BILLING_FEE, "stripe_billing_fee"); + + public static final SpecificFeeOrigins PLATFORM_BALANCE_PROCESSING_FEE = + new SpecificFeeOrigins(Value.PLATFORM_BALANCE_PROCESSING_FEE, "platform_balance_processing_fee"); + + public static final SpecificFeeOrigins SALES_TAX_REMITTANCE_REVERSAL = + new SpecificFeeOrigins(Value.SALES_TAX_REMITTANCE_REVERSAL, "sales_tax_remittance_reversal"); + + public static final SpecificFeeOrigins REVSHARE_PERCENTAGE_FEE = + new SpecificFeeOrigins(Value.REVSHARE_PERCENTAGE_FEE, "revshare_percentage_fee"); + + public static final SpecificFeeOrigins CROSS_BORDER_PERCENTAGE_FEE = + new SpecificFeeOrigins(Value.CROSS_BORDER_PERCENTAGE_FEE, "cross_border_percentage_fee"); + + public static final SpecificFeeOrigins STRIPE_PAYOUT_FEE = + new SpecificFeeOrigins(Value.STRIPE_PAYOUT_FEE, "stripe_payout_fee"); + + public static final SpecificFeeOrigins SPLITIT_PROCESSING_FEE = + new SpecificFeeOrigins(Value.SPLITIT_PROCESSING_FEE, "splitit_processing_fee"); + + public static final SpecificFeeOrigins FX_PERCENTAGE_FEE = + new SpecificFeeOrigins(Value.FX_PERCENTAGE_FEE, "fx_percentage_fee"); + + public static final SpecificFeeOrigins ORCHESTRATION_PERCENTAGE_FEE = + new SpecificFeeOrigins(Value.ORCHESTRATION_PERCENTAGE_FEE, "orchestration_percentage_fee"); + + public static final SpecificFeeOrigins SALES_TAX_REMITTANCE = + new SpecificFeeOrigins(Value.SALES_TAX_REMITTANCE, "sales_tax_remittance"); + + public static final SpecificFeeOrigins PAYMENT_PROCESSING_FIXED_FEE = + new SpecificFeeOrigins(Value.PAYMENT_PROCESSING_FIXED_FEE, "payment_processing_fixed_fee"); + + public static final SpecificFeeOrigins STRIPE_SALES_TAX_FEE = + new SpecificFeeOrigins(Value.STRIPE_SALES_TAX_FEE, "stripe_sales_tax_fee"); + + public static final SpecificFeeOrigins WHOP_PROCESSING_FEE = + new SpecificFeeOrigins(Value.WHOP_PROCESSING_FEE, "whop_processing_fee"); + + public static final SpecificFeeOrigins BUYER_FEE = new SpecificFeeOrigins(Value.BUYER_FEE, "buyer_fee"); + + public static final SpecificFeeOrigins HIGH_RISK_MERCHANT_FEE = + new SpecificFeeOrigins(Value.HIGH_RISK_MERCHANT_FEE, "high_risk_merchant_fee"); + + public static final SpecificFeeOrigins STRIPE_RADAR_FEE = + new SpecificFeeOrigins(Value.STRIPE_RADAR_FEE, "stripe_radar_fee"); + + public static final SpecificFeeOrigins CRYPTO_FEE = new SpecificFeeOrigins(Value.CRYPTO_FEE, "crypto_fee"); + + private final Value value; + + private final String string; + + SpecificFeeOrigins(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SpecificFeeOrigins && this.string.equals(((SpecificFeeOrigins) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPLE_PROCESSING_FEE: + return visitor.visitAppleProcessingFee(); + case STRIPE_INTERNATIONAL_PROCESSING_FEE: + return visitor.visitStripeInternationalProcessingFee(); + case MARKETPLACE_AFFILIATE_FEE: + return visitor.visitMarketplaceAffiliateFee(); + case DISPUTE_FEE: + return visitor.visitDisputeFee(); + case STRIPE_DOMESTIC_PROCESSING_FEE: + return visitor.visitStripeDomesticProcessingFee(); + case BILLING_PERCENTAGE_FEE: + return visitor.visitBillingPercentageFee(); + case PAYMENT_PROCESSING_PERCENTAGE_FEE: + return visitor.visitPaymentProcessingPercentageFee(); + case THREE_DS_FIXED_FEE: + return visitor.visitThreeDsFixedFee(); + case PAYPAL_FEE: + return visitor.visitPaypalFee(); + case DISPUTE_ALERT_FEE: + return visitor.visitDisputeAlertFee(); + case APPLICATION_FEE: + return visitor.visitApplicationFee(); + case AFFILIATE_FEE: + return visitor.visitAffiliateFee(); + case SEZZLE_PROCESSING_FEE: + return visitor.visitSezzleProcessingFee(); + case STRIPE_STANDARD_PROCESSING_FEE: + return visitor.visitStripeStandardProcessingFee(); + case STRIPE_FIXED_PROCESSING_FEE: + return visitor.visitStripeFixedProcessingFee(); + case STRIPE_BILLING_FEE: + return visitor.visitStripeBillingFee(); + case PLATFORM_BALANCE_PROCESSING_FEE: + return visitor.visitPlatformBalanceProcessingFee(); + case SALES_TAX_REMITTANCE_REVERSAL: + return visitor.visitSalesTaxRemittanceReversal(); + case REVSHARE_PERCENTAGE_FEE: + return visitor.visitRevsharePercentageFee(); + case CROSS_BORDER_PERCENTAGE_FEE: + return visitor.visitCrossBorderPercentageFee(); + case STRIPE_PAYOUT_FEE: + return visitor.visitStripePayoutFee(); + case SPLITIT_PROCESSING_FEE: + return visitor.visitSplititProcessingFee(); + case FX_PERCENTAGE_FEE: + return visitor.visitFxPercentageFee(); + case ORCHESTRATION_PERCENTAGE_FEE: + return visitor.visitOrchestrationPercentageFee(); + case SALES_TAX_REMITTANCE: + return visitor.visitSalesTaxRemittance(); + case PAYMENT_PROCESSING_FIXED_FEE: + return visitor.visitPaymentProcessingFixedFee(); + case STRIPE_SALES_TAX_FEE: + return visitor.visitStripeSalesTaxFee(); + case WHOP_PROCESSING_FEE: + return visitor.visitWhopProcessingFee(); + case BUYER_FEE: + return visitor.visitBuyerFee(); + case HIGH_RISK_MERCHANT_FEE: + return visitor.visitHighRiskMerchantFee(); + case STRIPE_RADAR_FEE: + return visitor.visitStripeRadarFee(); + case CRYPTO_FEE: + return visitor.visitCryptoFee(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SpecificFeeOrigins valueOf(String value) { + switch (value) { + case "apple_processing_fee": + return APPLE_PROCESSING_FEE; + case "stripe_international_processing_fee": + return STRIPE_INTERNATIONAL_PROCESSING_FEE; + case "marketplace_affiliate_fee": + return MARKETPLACE_AFFILIATE_FEE; + case "dispute_fee": + return DISPUTE_FEE; + case "stripe_domestic_processing_fee": + return STRIPE_DOMESTIC_PROCESSING_FEE; + case "billing_percentage_fee": + return BILLING_PERCENTAGE_FEE; + case "payment_processing_percentage_fee": + return PAYMENT_PROCESSING_PERCENTAGE_FEE; + case "three_ds_fixed_fee": + return THREE_DS_FIXED_FEE; + case "paypal_fee": + return PAYPAL_FEE; + case "dispute_alert_fee": + return DISPUTE_ALERT_FEE; + case "application_fee": + return APPLICATION_FEE; + case "affiliate_fee": + return AFFILIATE_FEE; + case "sezzle_processing_fee": + return SEZZLE_PROCESSING_FEE; + case "stripe_standard_processing_fee": + return STRIPE_STANDARD_PROCESSING_FEE; + case "stripe_fixed_processing_fee": + return STRIPE_FIXED_PROCESSING_FEE; + case "stripe_billing_fee": + return STRIPE_BILLING_FEE; + case "platform_balance_processing_fee": + return PLATFORM_BALANCE_PROCESSING_FEE; + case "sales_tax_remittance_reversal": + return SALES_TAX_REMITTANCE_REVERSAL; + case "revshare_percentage_fee": + return REVSHARE_PERCENTAGE_FEE; + case "cross_border_percentage_fee": + return CROSS_BORDER_PERCENTAGE_FEE; + case "stripe_payout_fee": + return STRIPE_PAYOUT_FEE; + case "splitit_processing_fee": + return SPLITIT_PROCESSING_FEE; + case "fx_percentage_fee": + return FX_PERCENTAGE_FEE; + case "orchestration_percentage_fee": + return ORCHESTRATION_PERCENTAGE_FEE; + case "sales_tax_remittance": + return SALES_TAX_REMITTANCE; + case "payment_processing_fixed_fee": + return PAYMENT_PROCESSING_FIXED_FEE; + case "stripe_sales_tax_fee": + return STRIPE_SALES_TAX_FEE; + case "whop_processing_fee": + return WHOP_PROCESSING_FEE; + case "buyer_fee": + return BUYER_FEE; + case "high_risk_merchant_fee": + return HIGH_RISK_MERCHANT_FEE; + case "stripe_radar_fee": + return STRIPE_RADAR_FEE; + case "crypto_fee": + return CRYPTO_FEE; + default: + return new SpecificFeeOrigins(Value.UNKNOWN, value); + } + } + + public enum Value { + STRIPE_DOMESTIC_PROCESSING_FEE, + + STRIPE_INTERNATIONAL_PROCESSING_FEE, + + STRIPE_FIXED_PROCESSING_FEE, + + STRIPE_BILLING_FEE, + + STRIPE_RADAR_FEE, + + SALES_TAX_REMITTANCE, + + SALES_TAX_REMITTANCE_REVERSAL, + + STRIPE_SALES_TAX_FEE, + + WHOP_PROCESSING_FEE, + + MARKETPLACE_AFFILIATE_FEE, + + AFFILIATE_FEE, + + CRYPTO_FEE, + + STRIPE_STANDARD_PROCESSING_FEE, + + PAYPAL_FEE, + + STRIPE_PAYOUT_FEE, + + DISPUTE_FEE, + + DISPUTE_ALERT_FEE, + + APPLE_PROCESSING_FEE, + + BUYER_FEE, + + SEZZLE_PROCESSING_FEE, + + SPLITIT_PROCESSING_FEE, + + PLATFORM_BALANCE_PROCESSING_FEE, + + PAYMENT_PROCESSING_PERCENTAGE_FEE, + + PAYMENT_PROCESSING_FIXED_FEE, + + CROSS_BORDER_PERCENTAGE_FEE, + + FX_PERCENTAGE_FEE, + + ORCHESTRATION_PERCENTAGE_FEE, + + THREE_DS_FIXED_FEE, + + BILLING_PERCENTAGE_FEE, + + REVSHARE_PERCENTAGE_FEE, + + APPLICATION_FEE, + + HIGH_RISK_MERCHANT_FEE, + + UNKNOWN + } + + public interface Visitor { + T visitStripeDomesticProcessingFee(); + + T visitStripeInternationalProcessingFee(); + + T visitStripeFixedProcessingFee(); + + T visitStripeBillingFee(); + + T visitStripeRadarFee(); + + T visitSalesTaxRemittance(); + + T visitSalesTaxRemittanceReversal(); + + T visitStripeSalesTaxFee(); + + T visitWhopProcessingFee(); + + T visitMarketplaceAffiliateFee(); + + T visitAffiliateFee(); + + T visitCryptoFee(); + + T visitStripeStandardProcessingFee(); + + T visitPaypalFee(); + + T visitStripePayoutFee(); + + T visitDisputeFee(); + + T visitDisputeAlertFee(); + + T visitAppleProcessingFee(); + + T visitBuyerFee(); + + T visitSezzleProcessingFee(); + + T visitSplititProcessingFee(); + + T visitPlatformBalanceProcessingFee(); + + T visitPaymentProcessingPercentageFee(); + + T visitPaymentProcessingFixedFee(); + + T visitCrossBorderPercentageFee(); + + T visitFxPercentageFee(); + + T visitOrchestrationPercentageFee(); + + T visitThreeDsFixedFee(); + + T visitBillingPercentageFee(); + + T visitRevsharePercentageFee(); + + T visitApplicationFee(); + + T visitHighRiskMerchantFee(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Status.java b/src/main/java/com/whop/api/types/Status.java new file mode 100644 index 00000000..a590796b --- /dev/null +++ b/src/main/java/com/whop/api/types/Status.java @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class Status { + public static final Status DELETED = new Status(Value.DELETED, "deleted"); + + public static final Status ARCHIVED = new Status(Value.ARCHIVED, "archived"); + + public static final Status ACTIVE = new Status(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + Status(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof Status && this.string.equals(((Status) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DELETED: + return visitor.visitDeleted(); + case ARCHIVED: + return visitor.visitArchived(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static Status valueOf(String value) { + switch (value) { + case "deleted": + return DELETED; + case "archived": + return ARCHIVED; + case "active": + return ACTIVE; + default: + return new Status(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + ARCHIVED, + + DELETED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitArchived(); + + T visitDeleted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Statuses.java b/src/main/java/com/whop/api/types/Statuses.java new file mode 100644 index 00000000..1f248b75 --- /dev/null +++ b/src/main/java/com/whop/api/types/Statuses.java @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class Statuses { + public static final Statuses PUBLISHED = new Statuses(Value.PUBLISHED, "published"); + + public static final Statuses SCHEDULED = new Statuses(Value.SCHEDULED, "scheduled"); + + public static final Statuses ARCHIVED = new Statuses(Value.ARCHIVED, "archived"); + + private final Value value; + + private final String string; + + Statuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof Statuses && this.string.equals(((Statuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PUBLISHED: + return visitor.visitPublished(); + case SCHEDULED: + return visitor.visitScheduled(); + case ARCHIVED: + return visitor.visitArchived(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static Statuses valueOf(String value) { + switch (value) { + case "published": + return PUBLISHED; + case "scheduled": + return SCHEDULED; + case "archived": + return ARCHIVED; + default: + return new Statuses(Value.UNKNOWN, value); + } + } + + public enum Value { + PUBLISHED, + + ARCHIVED, + + SCHEDULED, + + UNKNOWN + } + + public interface Visitor { + T visitPublished(); + + T visitArchived(); + + T visitScheduled(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/StorefrontAccount.java b/src/main/java/com/whop/api/types/StorefrontAccount.java new file mode 100644 index 00000000..4a244ec1 --- /dev/null +++ b/src/main/java/com/whop/api/types/StorefrontAccount.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = StorefrontAccount.Builder.class) +public final class StorefrontAccount { + private final String id; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private StorefrontAccount(String id, String route, String title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return Account ID, prefixed biz_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Account public route identifier — the whop.com/{route} storefront path. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return Account display name. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StorefrontAccount && equalTo((StorefrontAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(StorefrontAccount other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Account ID, prefixed biz_.

+ */ + RouteStage id(@NotNull String id); + + Builder from(StorefrontAccount other); + } + + public interface RouteStage { + /** + *

Account public route identifier — the whop.com/{route} storefront path.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

Account display name.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + StorefrontAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(StorefrontAccount other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

Account ID, prefixed biz_.

+ *

Account ID, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Account public route identifier — the whop.com/{route} storefront path.

+ *

Account public route identifier — the whop.com/{route} storefront path.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

Account display name.

+ *

Account display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public StorefrontAccount build() { + return new StorefrontAccount(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SupportChannel.java b/src/main/java/com/whop/api/types/SupportChannel.java new file mode 100644 index 00000000..c8698872 --- /dev/null +++ b/src/main/java/com/whop/api/types/SupportChannel.java @@ -0,0 +1,489 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SupportChannel.Builder.class) +public final class SupportChannel { + private final Optional companyId; + + private final Optional customName; + + private final Optional customerUser; + + private final String id; + + private final Optional lastMessageAt; + + private final Optional resolvedAt; + + private final Map additionalProperties; + + private SupportChannel( + Optional companyId, + Optional customName, + Optional customerUser, + String id, + Optional lastMessageAt, + Optional resolvedAt, + Map additionalProperties) { + this.companyId = companyId; + this.customName = customName; + this.customerUser = customerUser; + this.id = id; + this.lastMessageAt = lastMessageAt; + this.resolvedAt = resolvedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the company associated with this channel. Null if this is not a support or company-scoped conversation. + */ + @JsonIgnore + public Optional getCompanyId() { + if (companyId == null) { + return Optional.empty(); + } + return companyId; + } + + /** + * @return A custom display name assigned to this channel by the user. Null if no custom name has been set. + */ + @JsonIgnore + public Optional getCustomName() { + if (customName == null) { + return Optional.empty(); + } + return customName; + } + + /** + * @return The customer who initiated this support conversation. Null if this is not a support chat. + */ + @JsonIgnore + public Optional getCustomerUser() { + if (customerUser == null) { + return Optional.empty(); + } + return customerUser; + } + + /** + * @return The unique identifier for the entity + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The timestamp when the most recent message was sent in this channel. Null if no messages have been sent. + */ + @JsonIgnore + public Optional getLastMessageAt() { + if (lastMessageAt == null) { + return Optional.empty(); + } + return lastMessageAt; + } + + /** + * @return The timestamp when the linked support ticket was marked as resolved. Null if unresolved or not a support chat. + */ + @JsonIgnore + public Optional getResolvedAt() { + if (resolvedAt == null) { + return Optional.empty(); + } + return resolvedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company_id") + private Optional _getCompanyId() { + return companyId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_name") + private Optional _getCustomName() { + return customName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_user") + private Optional _getCustomerUser() { + return customerUser; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_message_at") + private Optional _getLastMessageAt() { + return lastMessageAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resolved_at") + private Optional _getResolvedAt() { + return resolvedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SupportChannel && equalTo((SupportChannel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SupportChannel other) { + return companyId.equals(other.companyId) + && customName.equals(other.customName) + && customerUser.equals(other.customerUser) + && id.equals(other.id) + && lastMessageAt.equals(other.lastMessageAt) + && resolvedAt.equals(other.resolvedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyId, this.customName, this.customerUser, this.id, this.lastMessageAt, this.resolvedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the entity

+ */ + _FinalStage id(@NotNull String id); + + Builder from(SupportChannel other); + } + + public interface _FinalStage { + SupportChannel build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The unique identifier of the company associated with this channel. Null if this is not a support or company-scoped conversation.

+ */ + _FinalStage companyId(Optional companyId); + + _FinalStage companyId(String companyId); + + _FinalStage companyId(Nullable companyId); + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ */ + _FinalStage customName(Optional customName); + + _FinalStage customName(String customName); + + _FinalStage customName(Nullable customName); + + /** + *

The customer who initiated this support conversation. Null if this is not a support chat.

+ */ + _FinalStage customerUser(Optional customerUser); + + _FinalStage customerUser(SupportChannelCustomerUser customerUser); + + _FinalStage customerUser(Nullable customerUser); + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ */ + _FinalStage lastMessageAt(Optional lastMessageAt); + + _FinalStage lastMessageAt(OffsetDateTime lastMessageAt); + + _FinalStage lastMessageAt(Nullable lastMessageAt); + + /** + *

The timestamp when the linked support ticket was marked as resolved. Null if unresolved or not a support chat.

+ */ + _FinalStage resolvedAt(Optional resolvedAt); + + _FinalStage resolvedAt(OffsetDateTime resolvedAt); + + _FinalStage resolvedAt(Nullable resolvedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional resolvedAt = Optional.empty(); + + private Optional lastMessageAt = Optional.empty(); + + private Optional customerUser = Optional.empty(); + + private Optional customName = Optional.empty(); + + private Optional companyId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SupportChannel other) { + companyId(other.getCompanyId()); + customName(other.getCustomName()); + customerUser(other.getCustomerUser()); + id(other.getId()); + lastMessageAt(other.getLastMessageAt()); + resolvedAt(other.getResolvedAt()); + return this; + } + + /** + *

The unique identifier for the entity

+ *

The unique identifier for the entity

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp when the linked support ticket was marked as resolved. Null if unresolved or not a support chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolvedAt(Nullable resolvedAt) { + if (resolvedAt.isNull()) { + this.resolvedAt = null; + } else if (resolvedAt.isEmpty()) { + this.resolvedAt = Optional.empty(); + } else { + this.resolvedAt = Optional.of(resolvedAt.get()); + } + return this; + } + + /** + *

The timestamp when the linked support ticket was marked as resolved. Null if unresolved or not a support chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolvedAt(OffsetDateTime resolvedAt) { + this.resolvedAt = Optional.ofNullable(resolvedAt); + return this; + } + + /** + *

The timestamp when the linked support ticket was marked as resolved. Null if unresolved or not a support chat.

+ */ + @java.lang.Override + @JsonSetter(value = "resolved_at", nulls = Nulls.SKIP) + public _FinalStage resolvedAt(Optional resolvedAt) { + this.resolvedAt = resolvedAt; + return this; + } + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastMessageAt(Nullable lastMessageAt) { + if (lastMessageAt.isNull()) { + this.lastMessageAt = null; + } else if (lastMessageAt.isEmpty()) { + this.lastMessageAt = Optional.empty(); + } else { + this.lastMessageAt = Optional.of(lastMessageAt.get()); + } + return this; + } + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastMessageAt(OffsetDateTime lastMessageAt) { + this.lastMessageAt = Optional.ofNullable(lastMessageAt); + return this; + } + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ */ + @java.lang.Override + @JsonSetter(value = "last_message_at", nulls = Nulls.SKIP) + public _FinalStage lastMessageAt(Optional lastMessageAt) { + this.lastMessageAt = lastMessageAt; + return this; + } + + /** + *

The customer who initiated this support conversation. Null if this is not a support chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerUser(Nullable customerUser) { + if (customerUser.isNull()) { + this.customerUser = null; + } else if (customerUser.isEmpty()) { + this.customerUser = Optional.empty(); + } else { + this.customerUser = Optional.of(customerUser.get()); + } + return this; + } + + /** + *

The customer who initiated this support conversation. Null if this is not a support chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerUser(SupportChannelCustomerUser customerUser) { + this.customerUser = Optional.ofNullable(customerUser); + return this; + } + + /** + *

The customer who initiated this support conversation. Null if this is not a support chat.

+ */ + @java.lang.Override + @JsonSetter(value = "customer_user", nulls = Nulls.SKIP) + public _FinalStage customerUser(Optional customerUser) { + this.customerUser = customerUser; + return this; + } + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customName(Nullable customName) { + if (customName.isNull()) { + this.customName = null; + } else if (customName.isEmpty()) { + this.customName = Optional.empty(); + } else { + this.customName = Optional.of(customName.get()); + } + return this; + } + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customName(String customName) { + this.customName = Optional.ofNullable(customName); + return this; + } + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_name", nulls = Nulls.SKIP) + public _FinalStage customName(Optional customName) { + this.customName = customName; + return this; + } + + /** + *

The unique identifier of the company associated with this channel. Null if this is not a support or company-scoped conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage companyId(Nullable companyId) { + if (companyId.isNull()) { + this.companyId = null; + } else if (companyId.isEmpty()) { + this.companyId = Optional.empty(); + } else { + this.companyId = Optional.of(companyId.get()); + } + return this; + } + + /** + *

The unique identifier of the company associated with this channel. Null if this is not a support or company-scoped conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + /** + *

The unique identifier of the company associated with this channel. Null if this is not a support or company-scoped conversation.

+ */ + @java.lang.Override + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public _FinalStage companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + @java.lang.Override + public SupportChannel build() { + return new SupportChannel( + companyId, customName, customerUser, id, lastMessageAt, resolvedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SupportChannelCustomerUser.java b/src/main/java/com/whop/api/types/SupportChannelCustomerUser.java new file mode 100644 index 00000000..f8bb941d --- /dev/null +++ b/src/main/java/com/whop/api/types/SupportChannelCustomerUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SupportChannelCustomerUser.Builder.class) +public final class SupportChannelCustomerUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private SupportChannelCustomerUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SupportChannelCustomerUser && equalTo((SupportChannelCustomerUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SupportChannelCustomerUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(SupportChannelCustomerUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + SupportChannelCustomerUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SupportChannelCustomerUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public SupportChannelCustomerUser build() { + return new SupportChannelCustomerUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SupportChannelListItem.java b/src/main/java/com/whop/api/types/SupportChannelListItem.java new file mode 100644 index 00000000..7700e170 --- /dev/null +++ b/src/main/java/com/whop/api/types/SupportChannelListItem.java @@ -0,0 +1,489 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SupportChannelListItem.Builder.class) +public final class SupportChannelListItem { + private final Optional companyId; + + private final Optional customName; + + private final Optional customerUser; + + private final String id; + + private final Optional lastMessageAt; + + private final Optional resolvedAt; + + private final Map additionalProperties; + + private SupportChannelListItem( + Optional companyId, + Optional customName, + Optional customerUser, + String id, + Optional lastMessageAt, + Optional resolvedAt, + Map additionalProperties) { + this.companyId = companyId; + this.customName = customName; + this.customerUser = customerUser; + this.id = id; + this.lastMessageAt = lastMessageAt; + this.resolvedAt = resolvedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the company associated with this channel. Null if this is not a support or company-scoped conversation. + */ + @JsonIgnore + public Optional getCompanyId() { + if (companyId == null) { + return Optional.empty(); + } + return companyId; + } + + /** + * @return A custom display name assigned to this channel by the user. Null if no custom name has been set. + */ + @JsonIgnore + public Optional getCustomName() { + if (customName == null) { + return Optional.empty(); + } + return customName; + } + + /** + * @return The customer who initiated this support conversation. Null if this is not a support chat. + */ + @JsonIgnore + public Optional getCustomerUser() { + if (customerUser == null) { + return Optional.empty(); + } + return customerUser; + } + + /** + * @return The unique identifier for the entity + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The timestamp when the most recent message was sent in this channel. Null if no messages have been sent. + */ + @JsonIgnore + public Optional getLastMessageAt() { + if (lastMessageAt == null) { + return Optional.empty(); + } + return lastMessageAt; + } + + /** + * @return The timestamp when the linked support ticket was marked as resolved. Null if unresolved or not a support chat. + */ + @JsonIgnore + public Optional getResolvedAt() { + if (resolvedAt == null) { + return Optional.empty(); + } + return resolvedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company_id") + private Optional _getCompanyId() { + return companyId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("custom_name") + private Optional _getCustomName() { + return customName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_user") + private Optional _getCustomerUser() { + return customerUser; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_message_at") + private Optional _getLastMessageAt() { + return lastMessageAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("resolved_at") + private Optional _getResolvedAt() { + return resolvedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SupportChannelListItem && equalTo((SupportChannelListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SupportChannelListItem other) { + return companyId.equals(other.companyId) + && customName.equals(other.customName) + && customerUser.equals(other.customerUser) + && id.equals(other.id) + && lastMessageAt.equals(other.lastMessageAt) + && resolvedAt.equals(other.resolvedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyId, this.customName, this.customerUser, this.id, this.lastMessageAt, this.resolvedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the entity

+ */ + _FinalStage id(@NotNull String id); + + Builder from(SupportChannelListItem other); + } + + public interface _FinalStage { + SupportChannelListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The unique identifier of the company associated with this channel. Null if this is not a support or company-scoped conversation.

+ */ + _FinalStage companyId(Optional companyId); + + _FinalStage companyId(String companyId); + + _FinalStage companyId(Nullable companyId); + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ */ + _FinalStage customName(Optional customName); + + _FinalStage customName(String customName); + + _FinalStage customName(Nullable customName); + + /** + *

The customer who initiated this support conversation. Null if this is not a support chat.

+ */ + _FinalStage customerUser(Optional customerUser); + + _FinalStage customerUser(SupportChannelListItemCustomerUser customerUser); + + _FinalStage customerUser(Nullable customerUser); + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ */ + _FinalStage lastMessageAt(Optional lastMessageAt); + + _FinalStage lastMessageAt(OffsetDateTime lastMessageAt); + + _FinalStage lastMessageAt(Nullable lastMessageAt); + + /** + *

The timestamp when the linked support ticket was marked as resolved. Null if unresolved or not a support chat.

+ */ + _FinalStage resolvedAt(Optional resolvedAt); + + _FinalStage resolvedAt(OffsetDateTime resolvedAt); + + _FinalStage resolvedAt(Nullable resolvedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional resolvedAt = Optional.empty(); + + private Optional lastMessageAt = Optional.empty(); + + private Optional customerUser = Optional.empty(); + + private Optional customName = Optional.empty(); + + private Optional companyId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SupportChannelListItem other) { + companyId(other.getCompanyId()); + customName(other.getCustomName()); + customerUser(other.getCustomerUser()); + id(other.getId()); + lastMessageAt(other.getLastMessageAt()); + resolvedAt(other.getResolvedAt()); + return this; + } + + /** + *

The unique identifier for the entity

+ *

The unique identifier for the entity

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The timestamp when the linked support ticket was marked as resolved. Null if unresolved or not a support chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolvedAt(Nullable resolvedAt) { + if (resolvedAt.isNull()) { + this.resolvedAt = null; + } else if (resolvedAt.isEmpty()) { + this.resolvedAt = Optional.empty(); + } else { + this.resolvedAt = Optional.of(resolvedAt.get()); + } + return this; + } + + /** + *

The timestamp when the linked support ticket was marked as resolved. Null if unresolved or not a support chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resolvedAt(OffsetDateTime resolvedAt) { + this.resolvedAt = Optional.ofNullable(resolvedAt); + return this; + } + + /** + *

The timestamp when the linked support ticket was marked as resolved. Null if unresolved or not a support chat.

+ */ + @java.lang.Override + @JsonSetter(value = "resolved_at", nulls = Nulls.SKIP) + public _FinalStage resolvedAt(Optional resolvedAt) { + this.resolvedAt = resolvedAt; + return this; + } + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastMessageAt(Nullable lastMessageAt) { + if (lastMessageAt.isNull()) { + this.lastMessageAt = null; + } else if (lastMessageAt.isEmpty()) { + this.lastMessageAt = Optional.empty(); + } else { + this.lastMessageAt = Optional.of(lastMessageAt.get()); + } + return this; + } + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastMessageAt(OffsetDateTime lastMessageAt) { + this.lastMessageAt = Optional.ofNullable(lastMessageAt); + return this; + } + + /** + *

The timestamp when the most recent message was sent in this channel. Null if no messages have been sent.

+ */ + @java.lang.Override + @JsonSetter(value = "last_message_at", nulls = Nulls.SKIP) + public _FinalStage lastMessageAt(Optional lastMessageAt) { + this.lastMessageAt = lastMessageAt; + return this; + } + + /** + *

The customer who initiated this support conversation. Null if this is not a support chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerUser(Nullable customerUser) { + if (customerUser.isNull()) { + this.customerUser = null; + } else if (customerUser.isEmpty()) { + this.customerUser = Optional.empty(); + } else { + this.customerUser = Optional.of(customerUser.get()); + } + return this; + } + + /** + *

The customer who initiated this support conversation. Null if this is not a support chat.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerUser(SupportChannelListItemCustomerUser customerUser) { + this.customerUser = Optional.ofNullable(customerUser); + return this; + } + + /** + *

The customer who initiated this support conversation. Null if this is not a support chat.

+ */ + @java.lang.Override + @JsonSetter(value = "customer_user", nulls = Nulls.SKIP) + public _FinalStage customerUser(Optional customerUser) { + this.customerUser = customerUser; + return this; + } + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customName(Nullable customName) { + if (customName.isNull()) { + this.customName = null; + } else if (customName.isEmpty()) { + this.customName = Optional.empty(); + } else { + this.customName = Optional.of(customName.get()); + } + return this; + } + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customName(String customName) { + this.customName = Optional.ofNullable(customName); + return this; + } + + /** + *

A custom display name assigned to this channel by the user. Null if no custom name has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_name", nulls = Nulls.SKIP) + public _FinalStage customName(Optional customName) { + this.customName = customName; + return this; + } + + /** + *

The unique identifier of the company associated with this channel. Null if this is not a support or company-scoped conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage companyId(Nullable companyId) { + if (companyId.isNull()) { + this.companyId = null; + } else if (companyId.isEmpty()) { + this.companyId = Optional.empty(); + } else { + this.companyId = Optional.of(companyId.get()); + } + return this; + } + + /** + *

The unique identifier of the company associated with this channel. Null if this is not a support or company-scoped conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + /** + *

The unique identifier of the company associated with this channel. Null if this is not a support or company-scoped conversation.

+ */ + @java.lang.Override + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public _FinalStage companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + @java.lang.Override + public SupportChannelListItem build() { + return new SupportChannelListItem( + companyId, customName, customerUser, id, lastMessageAt, resolvedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SupportChannelListItemCustomerUser.java b/src/main/java/com/whop/api/types/SupportChannelListItemCustomerUser.java new file mode 100644 index 00000000..c6f61ded --- /dev/null +++ b/src/main/java/com/whop/api/types/SupportChannelListItemCustomerUser.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SupportChannelListItemCustomerUser.Builder.class) +public final class SupportChannelListItemCustomerUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private SupportChannelListItemCustomerUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SupportChannelListItemCustomerUser + && equalTo((SupportChannelListItemCustomerUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SupportChannelListItemCustomerUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(SupportChannelListItemCustomerUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + SupportChannelListItemCustomerUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SupportChannelListItemCustomerUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public SupportChannelListItemCustomerUser build() { + return new SupportChannelListItemCustomerUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/SupportChannelView.java b/src/main/java/com/whop/api/types/SupportChannelView.java new file mode 100644 index 00000000..d550da3d --- /dev/null +++ b/src/main/java/com/whop/api/types/SupportChannelView.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SupportChannelView { + public static final SupportChannelView ALL = new SupportChannelView(Value.ALL, "all"); + + public static final SupportChannelView ADMIN = new SupportChannelView(Value.ADMIN, "admin"); + + public static final SupportChannelView CUSTOMER = new SupportChannelView(Value.CUSTOMER, "customer"); + + private final Value value; + + private final String string; + + SupportChannelView(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SupportChannelView && this.string.equals(((SupportChannelView) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ALL: + return visitor.visitAll(); + case ADMIN: + return visitor.visitAdmin(); + case CUSTOMER: + return visitor.visitCustomer(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SupportChannelView valueOf(String value) { + switch (value) { + case "all": + return ALL; + case "admin": + return ADMIN; + case "customer": + return CUSTOMER; + default: + return new SupportChannelView(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL, + + ADMIN, + + CUSTOMER, + + UNKNOWN + } + + public interface Visitor { + T visitAll(); + + T visitAdmin(); + + T visitCustomer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/TargetingOption.java b/src/main/java/com/whop/api/types/TargetingOption.java new file mode 100644 index 00000000..45df8c08 --- /dev/null +++ b/src/main/java/com/whop/api/types/TargetingOption.java @@ -0,0 +1,804 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class TargetingOption { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private TargetingOption(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static TargetingOption behaviors(DetailedTargetingOption value) { + return new TargetingOption(new BehaviorsValue(value)); + } + + public static TargetingOption educationMajors(DetailedTargetingOption value) { + return new TargetingOption(new EducationMajorsValue(value)); + } + + public static TargetingOption educationSchools(DetailedTargetingOption value) { + return new TargetingOption(new EducationSchoolsValue(value)); + } + + public static TargetingOption familyStatuses(DetailedTargetingOption value) { + return new TargetingOption(new FamilyStatusesValue(value)); + } + + public static TargetingOption income(DetailedTargetingOption value) { + return new TargetingOption(new IncomeValue(value)); + } + + public static TargetingOption industries(DetailedTargetingOption value) { + return new TargetingOption(new IndustriesValue(value)); + } + + public static TargetingOption interests(DetailedTargetingOption value) { + return new TargetingOption(new InterestsValue(value)); + } + + public static TargetingOption languages(LanguageTargetingOption value) { + return new TargetingOption(new LanguagesValue(value)); + } + + public static TargetingOption lifeEvents(DetailedTargetingOption value) { + return new TargetingOption(new LifeEventsValue(value)); + } + + public static TargetingOption locations(LocationTargetingOption value) { + return new TargetingOption(new LocationsValue(value)); + } + + public static TargetingOption workEmployers(DetailedTargetingOption value) { + return new TargetingOption(new WorkEmployersValue(value)); + } + + public static TargetingOption workPositions(DetailedTargetingOption value) { + return new TargetingOption(new WorkPositionsValue(value)); + } + + public boolean isBehaviors() { + return value instanceof BehaviorsValue; + } + + public boolean isEducationMajors() { + return value instanceof EducationMajorsValue; + } + + public boolean isEducationSchools() { + return value instanceof EducationSchoolsValue; + } + + public boolean isFamilyStatuses() { + return value instanceof FamilyStatusesValue; + } + + public boolean isIncome() { + return value instanceof IncomeValue; + } + + public boolean isIndustries() { + return value instanceof IndustriesValue; + } + + public boolean isInterests() { + return value instanceof InterestsValue; + } + + public boolean isLanguages() { + return value instanceof LanguagesValue; + } + + public boolean isLifeEvents() { + return value instanceof LifeEventsValue; + } + + public boolean isLocations() { + return value instanceof LocationsValue; + } + + public boolean isWorkEmployers() { + return value instanceof WorkEmployersValue; + } + + public boolean isWorkPositions() { + return value instanceof WorkPositionsValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getBehaviors() { + if (isBehaviors()) { + return Optional.of(((BehaviorsValue) value).value); + } + return Optional.empty(); + } + + public Optional getEducationMajors() { + if (isEducationMajors()) { + return Optional.of(((EducationMajorsValue) value).value); + } + return Optional.empty(); + } + + public Optional getEducationSchools() { + if (isEducationSchools()) { + return Optional.of(((EducationSchoolsValue) value).value); + } + return Optional.empty(); + } + + public Optional getFamilyStatuses() { + if (isFamilyStatuses()) { + return Optional.of(((FamilyStatusesValue) value).value); + } + return Optional.empty(); + } + + public Optional getIncome() { + if (isIncome()) { + return Optional.of(((IncomeValue) value).value); + } + return Optional.empty(); + } + + public Optional getIndustries() { + if (isIndustries()) { + return Optional.of(((IndustriesValue) value).value); + } + return Optional.empty(); + } + + public Optional getInterests() { + if (isInterests()) { + return Optional.of(((InterestsValue) value).value); + } + return Optional.empty(); + } + + public Optional getLanguages() { + if (isLanguages()) { + return Optional.of(((LanguagesValue) value).value); + } + return Optional.empty(); + } + + public Optional getLifeEvents() { + if (isLifeEvents()) { + return Optional.of(((LifeEventsValue) value).value); + } + return Optional.empty(); + } + + public Optional getLocations() { + if (isLocations()) { + return Optional.of(((LocationsValue) value).value); + } + return Optional.empty(); + } + + public Optional getWorkEmployers() { + if (isWorkEmployers()) { + return Optional.of(((WorkEmployersValue) value).value); + } + return Optional.empty(); + } + + public Optional getWorkPositions() { + if (isWorkPositions()) { + return Optional.of(((WorkPositionsValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TargetingOption && value.equals(((TargetingOption) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitBehaviors(DetailedTargetingOption behaviors); + + T visitEducationMajors(DetailedTargetingOption educationMajors); + + T visitEducationSchools(DetailedTargetingOption educationSchools); + + T visitFamilyStatuses(DetailedTargetingOption familyStatuses); + + T visitIncome(DetailedTargetingOption income); + + T visitIndustries(DetailedTargetingOption industries); + + T visitInterests(DetailedTargetingOption interests); + + T visitLanguages(LanguageTargetingOption languages); + + T visitLifeEvents(DetailedTargetingOption lifeEvents); + + T visitLocations(LocationTargetingOption locations); + + T visitWorkEmployers(DetailedTargetingOption workEmployers); + + T visitWorkPositions(DetailedTargetingOption workPositions); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(BehaviorsValue.class), + @JsonSubTypes.Type(EducationMajorsValue.class), + @JsonSubTypes.Type(EducationSchoolsValue.class), + @JsonSubTypes.Type(FamilyStatusesValue.class), + @JsonSubTypes.Type(IncomeValue.class), + @JsonSubTypes.Type(IndustriesValue.class), + @JsonSubTypes.Type(InterestsValue.class), + @JsonSubTypes.Type(LanguagesValue.class), + @JsonSubTypes.Type(LifeEventsValue.class), + @JsonSubTypes.Type(LocationsValue.class), + @JsonSubTypes.Type(WorkEmployersValue.class), + @JsonSubTypes.Type(WorkPositionsValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("behaviors") + @JsonIgnoreProperties("type") + private static final class BehaviorsValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private DetailedTargetingOption value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BehaviorsValue() {} + + private BehaviorsValue(DetailedTargetingOption value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBehaviors(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BehaviorsValue && equalTo((BehaviorsValue) other); + } + + private boolean equalTo(BehaviorsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TargetingOption{" + "value: " + value + "}"; + } + } + + @JsonTypeName("education_majors") + @JsonIgnoreProperties("type") + private static final class EducationMajorsValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private DetailedTargetingOption value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EducationMajorsValue() {} + + private EducationMajorsValue(DetailedTargetingOption value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEducationMajors(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EducationMajorsValue && equalTo((EducationMajorsValue) other); + } + + private boolean equalTo(EducationMajorsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TargetingOption{" + "value: " + value + "}"; + } + } + + @JsonTypeName("education_schools") + @JsonIgnoreProperties("type") + private static final class EducationSchoolsValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private DetailedTargetingOption value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EducationSchoolsValue() {} + + private EducationSchoolsValue(DetailedTargetingOption value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEducationSchools(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EducationSchoolsValue && equalTo((EducationSchoolsValue) other); + } + + private boolean equalTo(EducationSchoolsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TargetingOption{" + "value: " + value + "}"; + } + } + + @JsonTypeName("family_statuses") + @JsonIgnoreProperties("type") + private static final class FamilyStatusesValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private DetailedTargetingOption value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FamilyStatusesValue() {} + + private FamilyStatusesValue(DetailedTargetingOption value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFamilyStatuses(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FamilyStatusesValue && equalTo((FamilyStatusesValue) other); + } + + private boolean equalTo(FamilyStatusesValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TargetingOption{" + "value: " + value + "}"; + } + } + + @JsonTypeName("income") + @JsonIgnoreProperties("type") + private static final class IncomeValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private DetailedTargetingOption value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private IncomeValue() {} + + private IncomeValue(DetailedTargetingOption value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitIncome(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IncomeValue && equalTo((IncomeValue) other); + } + + private boolean equalTo(IncomeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TargetingOption{" + "value: " + value + "}"; + } + } + + @JsonTypeName("industries") + @JsonIgnoreProperties("type") + private static final class IndustriesValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private DetailedTargetingOption value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private IndustriesValue() {} + + private IndustriesValue(DetailedTargetingOption value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitIndustries(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IndustriesValue && equalTo((IndustriesValue) other); + } + + private boolean equalTo(IndustriesValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TargetingOption{" + "value: " + value + "}"; + } + } + + @JsonTypeName("interests") + @JsonIgnoreProperties("type") + private static final class InterestsValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private DetailedTargetingOption value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private InterestsValue() {} + + private InterestsValue(DetailedTargetingOption value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitInterests(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InterestsValue && equalTo((InterestsValue) other); + } + + private boolean equalTo(InterestsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TargetingOption{" + "value: " + value + "}"; + } + } + + @JsonTypeName("languages") + @JsonIgnoreProperties("type") + private static final class LanguagesValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private LanguageTargetingOption value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private LanguagesValue() {} + + private LanguagesValue(LanguageTargetingOption value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitLanguages(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LanguagesValue && equalTo((LanguagesValue) other); + } + + private boolean equalTo(LanguagesValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TargetingOption{" + "value: " + value + "}"; + } + } + + @JsonTypeName("life_events") + @JsonIgnoreProperties("type") + private static final class LifeEventsValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private DetailedTargetingOption value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private LifeEventsValue() {} + + private LifeEventsValue(DetailedTargetingOption value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitLifeEvents(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LifeEventsValue && equalTo((LifeEventsValue) other); + } + + private boolean equalTo(LifeEventsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TargetingOption{" + "value: " + value + "}"; + } + } + + @JsonTypeName("locations") + @JsonIgnoreProperties("type") + private static final class LocationsValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private LocationTargetingOption value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private LocationsValue() {} + + private LocationsValue(LocationTargetingOption value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitLocations(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LocationsValue && equalTo((LocationsValue) other); + } + + private boolean equalTo(LocationsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TargetingOption{" + "value: " + value + "}"; + } + } + + @JsonTypeName("work_employers") + @JsonIgnoreProperties("type") + private static final class WorkEmployersValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private DetailedTargetingOption value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private WorkEmployersValue() {} + + private WorkEmployersValue(DetailedTargetingOption value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitWorkEmployers(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkEmployersValue && equalTo((WorkEmployersValue) other); + } + + private boolean equalTo(WorkEmployersValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TargetingOption{" + "value: " + value + "}"; + } + } + + @JsonTypeName("work_positions") + @JsonIgnoreProperties("type") + private static final class WorkPositionsValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private DetailedTargetingOption value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private WorkPositionsValue() {} + + private WorkPositionsValue(DetailedTargetingOption value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitWorkPositions(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkPositionsValue && equalTo((WorkPositionsValue) other); + } + + private boolean equalTo(WorkPositionsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TargetingOption{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("type") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "TargetingOption{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/types/TaxIdentifierTypes.java b/src/main/java/com/whop/api/types/TaxIdentifierTypes.java new file mode 100644 index 00000000..0b558c0a --- /dev/null +++ b/src/main/java/com/whop/api/types/TaxIdentifierTypes.java @@ -0,0 +1,1193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class TaxIdentifierTypes { + public static final TaxIdentifierTypes TW_VAT = new TaxIdentifierTypes(Value.TW_VAT, "tw_vat"); + + public static final TaxIdentifierTypes VE_RIF = new TaxIdentifierTypes(Value.VE_RIF, "ve_rif"); + + public static final TaxIdentifierTypes KR_BRN = new TaxIdentifierTypes(Value.KR_BRN, "kr_brn"); + + public static final TaxIdentifierTypes SN_NINEA = new TaxIdentifierTypes(Value.SN_NINEA, "sn_ninea"); + + public static final TaxIdentifierTypes AU_ABN = new TaxIdentifierTypes(Value.AU_ABN, "au_abn"); + + public static final TaxIdentifierTypes MY_SST = new TaxIdentifierTypes(Value.MY_SST, "my_sst"); + + public static final TaxIdentifierTypes EU_VAT = new TaxIdentifierTypes(Value.EU_VAT, "eu_vat"); + + public static final TaxIdentifierTypes IN_GST = new TaxIdentifierTypes(Value.IN_GST, "in_gst"); + + public static final TaxIdentifierTypes CA_QST = new TaxIdentifierTypes(Value.CA_QST, "ca_qst"); + + public static final TaxIdentifierTypes MA_VAT = new TaxIdentifierTypes(Value.MA_VAT, "ma_vat"); + + public static final TaxIdentifierTypes MK_VAT = new TaxIdentifierTypes(Value.MK_VAT, "mk_vat"); + + public static final TaxIdentifierTypes UA_VAT = new TaxIdentifierTypes(Value.UA_VAT, "ua_vat"); + + public static final TaxIdentifierTypes CN_TIN = new TaxIdentifierTypes(Value.CN_TIN, "cn_tin"); + + public static final TaxIdentifierTypes MX_RFC = new TaxIdentifierTypes(Value.MX_RFC, "mx_rfc"); + + public static final TaxIdentifierTypes BY_TIN = new TaxIdentifierTypes(Value.BY_TIN, "by_tin"); + + public static final TaxIdentifierTypes CA_PST_BC = new TaxIdentifierTypes(Value.CA_PST_BC, "ca_pst_bc"); + + public static final TaxIdentifierTypes ID_NPWP = new TaxIdentifierTypes(Value.ID_NPWP, "id_npwp"); + + public static final TaxIdentifierTypes PH_TIN = new TaxIdentifierTypes(Value.PH_TIN, "ph_tin"); + + public static final TaxIdentifierTypes AE_TRN = new TaxIdentifierTypes(Value.AE_TRN, "ae_trn"); + + public static final TaxIdentifierTypes EC_RUC = new TaxIdentifierTypes(Value.EC_RUC, "ec_ruc"); + + public static final TaxIdentifierTypes XI_VAT = new TaxIdentifierTypes(Value.XI_VAT, "xi_vat"); + + public static final TaxIdentifierTypes DE_STN = new TaxIdentifierTypes(Value.DE_STN, "de_stn"); + + public static final TaxIdentifierTypes US_EIN = new TaxIdentifierTypes(Value.US_EIN, "us_ein"); + + public static final TaxIdentifierTypes CM_NIU = new TaxIdentifierTypes(Value.CM_NIU, "cm_niu"); + + public static final TaxIdentifierTypes ET_TIN = new TaxIdentifierTypes(Value.ET_TIN, "et_tin"); + + public static final TaxIdentifierTypes IS_VAT = new TaxIdentifierTypes(Value.IS_VAT, "is_vat"); + + public static final TaxIdentifierTypes MY_FRP = new TaxIdentifierTypes(Value.MY_FRP, "my_frp"); + + public static final TaxIdentifierTypes SG_UEN = new TaxIdentifierTypes(Value.SG_UEN, "sg_uen"); + + public static final TaxIdentifierTypes HU_TIN = new TaxIdentifierTypes(Value.HU_TIN, "hu_tin"); + + public static final TaxIdentifierTypes CO_NIT = new TaxIdentifierTypes(Value.CO_NIT, "co_nit"); + + public static final TaxIdentifierTypes JP_CN = new TaxIdentifierTypes(Value.JP_CN, "jp_cn"); + + public static final TaxIdentifierTypes MY_ITN = new TaxIdentifierTypes(Value.MY_ITN, "my_itn"); + + public static final TaxIdentifierTypes RU_KPP = new TaxIdentifierTypes(Value.RU_KPP, "ru_kpp"); + + public static final TaxIdentifierTypes KE_PIN = new TaxIdentifierTypes(Value.KE_PIN, "ke_pin"); + + public static final TaxIdentifierTypes AR_CUIT = new TaxIdentifierTypes(Value.AR_CUIT, "ar_cuit"); + + public static final TaxIdentifierTypes PE_RUC = new TaxIdentifierTypes(Value.PE_RUC, "pe_ruc"); + + public static final TaxIdentifierTypes CA_PST_MB = new TaxIdentifierTypes(Value.CA_PST_MB, "ca_pst_mb"); + + public static final TaxIdentifierTypes AM_TIN = new TaxIdentifierTypes(Value.AM_TIN, "am_tin"); + + public static final TaxIdentifierTypes DO_RCN = new TaxIdentifierTypes(Value.DO_RCN, "do_rcn"); + + public static final TaxIdentifierTypes BB_TIN = new TaxIdentifierTypes(Value.BB_TIN, "bb_tin"); + + public static final TaxIdentifierTypes JP_TRN = new TaxIdentifierTypes(Value.JP_TRN, "jp_trn"); + + public static final TaxIdentifierTypes HK_BR = new TaxIdentifierTypes(Value.HK_BR, "hk_br"); + + public static final TaxIdentifierTypes UZ_TIN = new TaxIdentifierTypes(Value.UZ_TIN, "uz_tin"); + + public static final TaxIdentifierTypes ME_PIB = new TaxIdentifierTypes(Value.ME_PIB, "me_pib"); + + public static final TaxIdentifierTypes BS_TIN = new TaxIdentifierTypes(Value.BS_TIN, "bs_tin"); + + public static final TaxIdentifierTypes GN_NIF = new TaxIdentifierTypes(Value.GN_NIF, "gn_nif"); + + public static final TaxIdentifierTypes KH_TIN = new TaxIdentifierTypes(Value.KH_TIN, "kh_tin"); + + public static final TaxIdentifierTypes CD_NIF = new TaxIdentifierTypes(Value.CD_NIF, "cd_nif"); + + public static final TaxIdentifierTypes NZ_GST = new TaxIdentifierTypes(Value.NZ_GST, "nz_gst"); + + public static final TaxIdentifierTypes TH_VAT = new TaxIdentifierTypes(Value.TH_VAT, "th_vat"); + + public static final TaxIdentifierTypes JP_RN = new TaxIdentifierTypes(Value.JP_RN, "jp_rn"); + + public static final TaxIdentifierTypes RU_INN = new TaxIdentifierTypes(Value.RU_INN, "ru_inn"); + + public static final TaxIdentifierTypes SG_GST = new TaxIdentifierTypes(Value.SG_GST, "sg_gst"); + + public static final TaxIdentifierTypes NO_VAT = new TaxIdentifierTypes(Value.NO_VAT, "no_vat"); + + public static final TaxIdentifierTypes BA_TIN = new TaxIdentifierTypes(Value.BA_TIN, "ba_tin"); + + public static final TaxIdentifierTypes KZ_BIN = new TaxIdentifierTypes(Value.KZ_BIN, "kz_bin"); + + public static final TaxIdentifierTypes AL_TIN = new TaxIdentifierTypes(Value.AL_TIN, "al_tin"); + + public static final TaxIdentifierTypes EG_TIN = new TaxIdentifierTypes(Value.EG_TIN, "eg_tin"); + + public static final TaxIdentifierTypes NP_PAN = new TaxIdentifierTypes(Value.NP_PAN, "np_pan"); + + public static final TaxIdentifierTypes CH_VAT = new TaxIdentifierTypes(Value.CH_VAT, "ch_vat"); + + public static final TaxIdentifierTypes NO_VOEC = new TaxIdentifierTypes(Value.NO_VOEC, "no_voec"); + + public static final TaxIdentifierTypes UZ_VAT = new TaxIdentifierTypes(Value.UZ_VAT, "uz_vat"); + + public static final TaxIdentifierTypes SR_FIN = new TaxIdentifierTypes(Value.SR_FIN, "sr_fin"); + + public static final TaxIdentifierTypes BG_UIC = new TaxIdentifierTypes(Value.BG_UIC, "bg_uic"); + + public static final TaxIdentifierTypes AU_ARN = new TaxIdentifierTypes(Value.AU_ARN, "au_arn"); + + public static final TaxIdentifierTypes BR_CNPJ = new TaxIdentifierTypes(Value.BR_CNPJ, "br_cnpj"); + + public static final TaxIdentifierTypes UG_TIN = new TaxIdentifierTypes(Value.UG_TIN, "ug_tin"); + + public static final TaxIdentifierTypes CA_PST_SK = new TaxIdentifierTypes(Value.CA_PST_SK, "ca_pst_sk"); + + public static final TaxIdentifierTypes OM_VAT = new TaxIdentifierTypes(Value.OM_VAT, "om_vat"); + + public static final TaxIdentifierTypes BR_CPF = new TaxIdentifierTypes(Value.BR_CPF, "br_cpf"); + + public static final TaxIdentifierTypes MR_NIF = new TaxIdentifierTypes(Value.MR_NIF, "mr_nif"); + + public static final TaxIdentifierTypes TR_TIN = new TaxIdentifierTypes(Value.TR_TIN, "tr_tin"); + + public static final TaxIdentifierTypes BJ_IFU = new TaxIdentifierTypes(Value.BJ_IFU, "bj_ifu"); + + public static final TaxIdentifierTypes ZW_TIN = new TaxIdentifierTypes(Value.ZW_TIN, "zw_tin"); + + public static final TaxIdentifierTypes LI_VAT = new TaxIdentifierTypes(Value.LI_VAT, "li_vat"); + + public static final TaxIdentifierTypes ZM_TIN = new TaxIdentifierTypes(Value.ZM_TIN, "zm_tin"); + + public static final TaxIdentifierTypes SI_TIN = new TaxIdentifierTypes(Value.SI_TIN, "si_tin"); + + public static final TaxIdentifierTypes CV_NIF = new TaxIdentifierTypes(Value.CV_NIF, "cv_nif"); + + public static final TaxIdentifierTypes LI_UID = new TaxIdentifierTypes(Value.LI_UID, "li_uid"); + + public static final TaxIdentifierTypes RS_PIB = new TaxIdentifierTypes(Value.RS_PIB, "rs_pib"); + + public static final TaxIdentifierTypes IL_VAT = new TaxIdentifierTypes(Value.IL_VAT, "il_vat"); + + public static final TaxIdentifierTypes TZ_VAT = new TaxIdentifierTypes(Value.TZ_VAT, "tz_vat"); + + public static final TaxIdentifierTypes BH_VAT = new TaxIdentifierTypes(Value.BH_VAT, "bh_vat"); + + public static final TaxIdentifierTypes HR_OIB = new TaxIdentifierTypes(Value.HR_OIB, "hr_oib"); + + public static final TaxIdentifierTypes NG_TIN = new TaxIdentifierTypes(Value.NG_TIN, "ng_tin"); + + public static final TaxIdentifierTypes ZA_VAT = new TaxIdentifierTypes(Value.ZA_VAT, "za_vat"); + + public static final TaxIdentifierTypes AO_TIN = new TaxIdentifierTypes(Value.AO_TIN, "ao_tin"); + + public static final TaxIdentifierTypes MD_VAT = new TaxIdentifierTypes(Value.MD_VAT, "md_vat"); + + public static final TaxIdentifierTypes UY_RUC = new TaxIdentifierTypes(Value.UY_RUC, "uy_ruc"); + + public static final TaxIdentifierTypes AD_NRT = new TaxIdentifierTypes(Value.AD_NRT, "ad_nrt"); + + public static final TaxIdentifierTypes BF_IFU = new TaxIdentifierTypes(Value.BF_IFU, "bf_ifu"); + + public static final TaxIdentifierTypes VN_TIN = new TaxIdentifierTypes(Value.VN_TIN, "vn_tin"); + + public static final TaxIdentifierTypes CL_TIN = new TaxIdentifierTypes(Value.CL_TIN, "cl_tin"); + + public static final TaxIdentifierTypes LA_TIN = new TaxIdentifierTypes(Value.LA_TIN, "la_tin"); + + public static final TaxIdentifierTypes KG_TIN = new TaxIdentifierTypes(Value.KG_TIN, "kg_tin"); + + public static final TaxIdentifierTypes CA_BN = new TaxIdentifierTypes(Value.CA_BN, "ca_bn"); + + public static final TaxIdentifierTypes SA_VAT = new TaxIdentifierTypes(Value.SA_VAT, "sa_vat"); + + public static final TaxIdentifierTypes EU_OSS_VAT = new TaxIdentifierTypes(Value.EU_OSS_VAT, "eu_oss_vat"); + + public static final TaxIdentifierTypes BD_BIN = new TaxIdentifierTypes(Value.BD_BIN, "bd_bin"); + + public static final TaxIdentifierTypes SV_NIT = new TaxIdentifierTypes(Value.SV_NIT, "sv_nit"); + + public static final TaxIdentifierTypes BO_TIN = new TaxIdentifierTypes(Value.BO_TIN, "bo_tin"); + + public static final TaxIdentifierTypes GE_VAT = new TaxIdentifierTypes(Value.GE_VAT, "ge_vat"); + + public static final TaxIdentifierTypes AZ_TIN = new TaxIdentifierTypes(Value.AZ_TIN, "az_tin"); + + public static final TaxIdentifierTypes CH_UID = new TaxIdentifierTypes(Value.CH_UID, "ch_uid"); + + public static final TaxIdentifierTypes RO_TIN = new TaxIdentifierTypes(Value.RO_TIN, "ro_tin"); + + public static final TaxIdentifierTypes TJ_TIN = new TaxIdentifierTypes(Value.TJ_TIN, "tj_tin"); + + public static final TaxIdentifierTypes AW_TIN = new TaxIdentifierTypes(Value.AW_TIN, "aw_tin"); + + public static final TaxIdentifierTypes CR_TIN = new TaxIdentifierTypes(Value.CR_TIN, "cr_tin"); + + public static final TaxIdentifierTypes GB_VAT = new TaxIdentifierTypes(Value.GB_VAT, "gb_vat"); + + public static final TaxIdentifierTypes ES_CIF = new TaxIdentifierTypes(Value.ES_CIF, "es_cif"); + + public static final TaxIdentifierTypes PL_NIP = new TaxIdentifierTypes(Value.PL_NIP, "pl_nip"); + + public static final TaxIdentifierTypes GH_TIN = new TaxIdentifierTypes(Value.GH_TIN, "gh_tin"); + + public static final TaxIdentifierTypes CA_GST_HST = new TaxIdentifierTypes(Value.CA_GST_HST, "ca_gst_hst"); + + private final Value value; + + private final String string; + + TaxIdentifierTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof TaxIdentifierTypes && this.string.equals(((TaxIdentifierTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TW_VAT: + return visitor.visitTwVat(); + case VE_RIF: + return visitor.visitVeRif(); + case KR_BRN: + return visitor.visitKrBrn(); + case SN_NINEA: + return visitor.visitSnNinea(); + case AU_ABN: + return visitor.visitAuAbn(); + case MY_SST: + return visitor.visitMySst(); + case EU_VAT: + return visitor.visitEuVat(); + case IN_GST: + return visitor.visitInGst(); + case CA_QST: + return visitor.visitCaQst(); + case MA_VAT: + return visitor.visitMaVat(); + case MK_VAT: + return visitor.visitMkVat(); + case UA_VAT: + return visitor.visitUaVat(); + case CN_TIN: + return visitor.visitCnTin(); + case MX_RFC: + return visitor.visitMxRfc(); + case BY_TIN: + return visitor.visitByTin(); + case CA_PST_BC: + return visitor.visitCaPstBc(); + case ID_NPWP: + return visitor.visitIdNpwp(); + case PH_TIN: + return visitor.visitPhTin(); + case AE_TRN: + return visitor.visitAeTrn(); + case EC_RUC: + return visitor.visitEcRuc(); + case XI_VAT: + return visitor.visitXiVat(); + case DE_STN: + return visitor.visitDeStn(); + case US_EIN: + return visitor.visitUsEin(); + case CM_NIU: + return visitor.visitCmNiu(); + case ET_TIN: + return visitor.visitEtTin(); + case IS_VAT: + return visitor.visitIsVat(); + case MY_FRP: + return visitor.visitMyFrp(); + case SG_UEN: + return visitor.visitSgUen(); + case HU_TIN: + return visitor.visitHuTin(); + case CO_NIT: + return visitor.visitCoNit(); + case JP_CN: + return visitor.visitJpCn(); + case MY_ITN: + return visitor.visitMyItn(); + case RU_KPP: + return visitor.visitRuKpp(); + case KE_PIN: + return visitor.visitKePin(); + case AR_CUIT: + return visitor.visitArCuit(); + case PE_RUC: + return visitor.visitPeRuc(); + case CA_PST_MB: + return visitor.visitCaPstMb(); + case AM_TIN: + return visitor.visitAmTin(); + case DO_RCN: + return visitor.visitDoRcn(); + case BB_TIN: + return visitor.visitBbTin(); + case JP_TRN: + return visitor.visitJpTrn(); + case HK_BR: + return visitor.visitHkBr(); + case UZ_TIN: + return visitor.visitUzTin(); + case ME_PIB: + return visitor.visitMePib(); + case BS_TIN: + return visitor.visitBsTin(); + case GN_NIF: + return visitor.visitGnNif(); + case KH_TIN: + return visitor.visitKhTin(); + case CD_NIF: + return visitor.visitCdNif(); + case NZ_GST: + return visitor.visitNzGst(); + case TH_VAT: + return visitor.visitThVat(); + case JP_RN: + return visitor.visitJpRn(); + case RU_INN: + return visitor.visitRuInn(); + case SG_GST: + return visitor.visitSgGst(); + case NO_VAT: + return visitor.visitNoVat(); + case BA_TIN: + return visitor.visitBaTin(); + case KZ_BIN: + return visitor.visitKzBin(); + case AL_TIN: + return visitor.visitAlTin(); + case EG_TIN: + return visitor.visitEgTin(); + case NP_PAN: + return visitor.visitNpPan(); + case CH_VAT: + return visitor.visitChVat(); + case NO_VOEC: + return visitor.visitNoVoec(); + case UZ_VAT: + return visitor.visitUzVat(); + case SR_FIN: + return visitor.visitSrFin(); + case BG_UIC: + return visitor.visitBgUic(); + case AU_ARN: + return visitor.visitAuArn(); + case BR_CNPJ: + return visitor.visitBrCnpj(); + case UG_TIN: + return visitor.visitUgTin(); + case CA_PST_SK: + return visitor.visitCaPstSk(); + case OM_VAT: + return visitor.visitOmVat(); + case BR_CPF: + return visitor.visitBrCpf(); + case MR_NIF: + return visitor.visitMrNif(); + case TR_TIN: + return visitor.visitTrTin(); + case BJ_IFU: + return visitor.visitBjIfu(); + case ZW_TIN: + return visitor.visitZwTin(); + case LI_VAT: + return visitor.visitLiVat(); + case ZM_TIN: + return visitor.visitZmTin(); + case SI_TIN: + return visitor.visitSiTin(); + case CV_NIF: + return visitor.visitCvNif(); + case LI_UID: + return visitor.visitLiUid(); + case RS_PIB: + return visitor.visitRsPib(); + case IL_VAT: + return visitor.visitIlVat(); + case TZ_VAT: + return visitor.visitTzVat(); + case BH_VAT: + return visitor.visitBhVat(); + case HR_OIB: + return visitor.visitHrOib(); + case NG_TIN: + return visitor.visitNgTin(); + case ZA_VAT: + return visitor.visitZaVat(); + case AO_TIN: + return visitor.visitAoTin(); + case MD_VAT: + return visitor.visitMdVat(); + case UY_RUC: + return visitor.visitUyRuc(); + case AD_NRT: + return visitor.visitAdNrt(); + case BF_IFU: + return visitor.visitBfIfu(); + case VN_TIN: + return visitor.visitVnTin(); + case CL_TIN: + return visitor.visitClTin(); + case LA_TIN: + return visitor.visitLaTin(); + case KG_TIN: + return visitor.visitKgTin(); + case CA_BN: + return visitor.visitCaBn(); + case SA_VAT: + return visitor.visitSaVat(); + case EU_OSS_VAT: + return visitor.visitEuOssVat(); + case BD_BIN: + return visitor.visitBdBin(); + case SV_NIT: + return visitor.visitSvNit(); + case BO_TIN: + return visitor.visitBoTin(); + case GE_VAT: + return visitor.visitGeVat(); + case AZ_TIN: + return visitor.visitAzTin(); + case CH_UID: + return visitor.visitChUid(); + case RO_TIN: + return visitor.visitRoTin(); + case TJ_TIN: + return visitor.visitTjTin(); + case AW_TIN: + return visitor.visitAwTin(); + case CR_TIN: + return visitor.visitCrTin(); + case GB_VAT: + return visitor.visitGbVat(); + case ES_CIF: + return visitor.visitEsCif(); + case PL_NIP: + return visitor.visitPlNip(); + case GH_TIN: + return visitor.visitGhTin(); + case CA_GST_HST: + return visitor.visitCaGstHst(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static TaxIdentifierTypes valueOf(String value) { + switch (value) { + case "tw_vat": + return TW_VAT; + case "ve_rif": + return VE_RIF; + case "kr_brn": + return KR_BRN; + case "sn_ninea": + return SN_NINEA; + case "au_abn": + return AU_ABN; + case "my_sst": + return MY_SST; + case "eu_vat": + return EU_VAT; + case "in_gst": + return IN_GST; + case "ca_qst": + return CA_QST; + case "ma_vat": + return MA_VAT; + case "mk_vat": + return MK_VAT; + case "ua_vat": + return UA_VAT; + case "cn_tin": + return CN_TIN; + case "mx_rfc": + return MX_RFC; + case "by_tin": + return BY_TIN; + case "ca_pst_bc": + return CA_PST_BC; + case "id_npwp": + return ID_NPWP; + case "ph_tin": + return PH_TIN; + case "ae_trn": + return AE_TRN; + case "ec_ruc": + return EC_RUC; + case "xi_vat": + return XI_VAT; + case "de_stn": + return DE_STN; + case "us_ein": + return US_EIN; + case "cm_niu": + return CM_NIU; + case "et_tin": + return ET_TIN; + case "is_vat": + return IS_VAT; + case "my_frp": + return MY_FRP; + case "sg_uen": + return SG_UEN; + case "hu_tin": + return HU_TIN; + case "co_nit": + return CO_NIT; + case "jp_cn": + return JP_CN; + case "my_itn": + return MY_ITN; + case "ru_kpp": + return RU_KPP; + case "ke_pin": + return KE_PIN; + case "ar_cuit": + return AR_CUIT; + case "pe_ruc": + return PE_RUC; + case "ca_pst_mb": + return CA_PST_MB; + case "am_tin": + return AM_TIN; + case "do_rcn": + return DO_RCN; + case "bb_tin": + return BB_TIN; + case "jp_trn": + return JP_TRN; + case "hk_br": + return HK_BR; + case "uz_tin": + return UZ_TIN; + case "me_pib": + return ME_PIB; + case "bs_tin": + return BS_TIN; + case "gn_nif": + return GN_NIF; + case "kh_tin": + return KH_TIN; + case "cd_nif": + return CD_NIF; + case "nz_gst": + return NZ_GST; + case "th_vat": + return TH_VAT; + case "jp_rn": + return JP_RN; + case "ru_inn": + return RU_INN; + case "sg_gst": + return SG_GST; + case "no_vat": + return NO_VAT; + case "ba_tin": + return BA_TIN; + case "kz_bin": + return KZ_BIN; + case "al_tin": + return AL_TIN; + case "eg_tin": + return EG_TIN; + case "np_pan": + return NP_PAN; + case "ch_vat": + return CH_VAT; + case "no_voec": + return NO_VOEC; + case "uz_vat": + return UZ_VAT; + case "sr_fin": + return SR_FIN; + case "bg_uic": + return BG_UIC; + case "au_arn": + return AU_ARN; + case "br_cnpj": + return BR_CNPJ; + case "ug_tin": + return UG_TIN; + case "ca_pst_sk": + return CA_PST_SK; + case "om_vat": + return OM_VAT; + case "br_cpf": + return BR_CPF; + case "mr_nif": + return MR_NIF; + case "tr_tin": + return TR_TIN; + case "bj_ifu": + return BJ_IFU; + case "zw_tin": + return ZW_TIN; + case "li_vat": + return LI_VAT; + case "zm_tin": + return ZM_TIN; + case "si_tin": + return SI_TIN; + case "cv_nif": + return CV_NIF; + case "li_uid": + return LI_UID; + case "rs_pib": + return RS_PIB; + case "il_vat": + return IL_VAT; + case "tz_vat": + return TZ_VAT; + case "bh_vat": + return BH_VAT; + case "hr_oib": + return HR_OIB; + case "ng_tin": + return NG_TIN; + case "za_vat": + return ZA_VAT; + case "ao_tin": + return AO_TIN; + case "md_vat": + return MD_VAT; + case "uy_ruc": + return UY_RUC; + case "ad_nrt": + return AD_NRT; + case "bf_ifu": + return BF_IFU; + case "vn_tin": + return VN_TIN; + case "cl_tin": + return CL_TIN; + case "la_tin": + return LA_TIN; + case "kg_tin": + return KG_TIN; + case "ca_bn": + return CA_BN; + case "sa_vat": + return SA_VAT; + case "eu_oss_vat": + return EU_OSS_VAT; + case "bd_bin": + return BD_BIN; + case "sv_nit": + return SV_NIT; + case "bo_tin": + return BO_TIN; + case "ge_vat": + return GE_VAT; + case "az_tin": + return AZ_TIN; + case "ch_uid": + return CH_UID; + case "ro_tin": + return RO_TIN; + case "tj_tin": + return TJ_TIN; + case "aw_tin": + return AW_TIN; + case "cr_tin": + return CR_TIN; + case "gb_vat": + return GB_VAT; + case "es_cif": + return ES_CIF; + case "pl_nip": + return PL_NIP; + case "gh_tin": + return GH_TIN; + case "ca_gst_hst": + return CA_GST_HST; + default: + return new TaxIdentifierTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + AD_NRT, + + AO_TIN, + + AR_CUIT, + + AL_TIN, + + AM_TIN, + + AW_TIN, + + AU_ABN, + + AU_ARN, + + EU_VAT, + + AZ_TIN, + + BS_TIN, + + BH_VAT, + + BD_BIN, + + BB_TIN, + + BY_TIN, + + BJ_IFU, + + BO_TIN, + + BA_TIN, + + BR_CNPJ, + + BR_CPF, + + BG_UIC, + + BF_IFU, + + KH_TIN, + + CM_NIU, + + CA_BN, + + CA_GST_HST, + + CA_PST_BC, + + CA_PST_MB, + + CA_PST_SK, + + CA_QST, + + CV_NIF, + + CL_TIN, + + CN_TIN, + + CO_NIT, + + CD_NIF, + + CR_TIN, + + HR_OIB, + + DO_RCN, + + EC_RUC, + + EG_TIN, + + SV_NIT, + + ET_TIN, + + EU_OSS_VAT, + + GE_VAT, + + GH_TIN, + + DE_STN, + + GB_VAT, + + GN_NIF, + + HK_BR, + + HU_TIN, + + IS_VAT, + + IN_GST, + + ID_NPWP, + + IL_VAT, + + JP_CN, + + JP_RN, + + JP_TRN, + + KZ_BIN, + + KE_PIN, + + KG_TIN, + + LA_TIN, + + LI_UID, + + LI_VAT, + + MY_FRP, + + MY_ITN, + + MY_SST, + + MR_NIF, + + MX_RFC, + + MD_VAT, + + ME_PIB, + + MA_VAT, + + NP_PAN, + + NZ_GST, + + NG_TIN, + + MK_VAT, + + NO_VAT, + + NO_VOEC, + + OM_VAT, + + PE_RUC, + + PH_TIN, + + PL_NIP, + + RO_TIN, + + RU_INN, + + RU_KPP, + + SA_VAT, + + SN_NINEA, + + RS_PIB, + + SG_GST, + + SG_UEN, + + SI_TIN, + + ZA_VAT, + + KR_BRN, + + ES_CIF, + + CH_UID, + + CH_VAT, + + TW_VAT, + + TJ_TIN, + + TZ_VAT, + + TH_VAT, + + TR_TIN, + + UG_TIN, + + UA_VAT, + + AE_TRN, + + US_EIN, + + UY_RUC, + + UZ_TIN, + + UZ_VAT, + + VE_RIF, + + VN_TIN, + + ZM_TIN, + + ZW_TIN, + + SR_FIN, + + XI_VAT, + + UNKNOWN + } + + public interface Visitor { + T visitAdNrt(); + + T visitAoTin(); + + T visitArCuit(); + + T visitAlTin(); + + T visitAmTin(); + + T visitAwTin(); + + T visitAuAbn(); + + T visitAuArn(); + + T visitEuVat(); + + T visitAzTin(); + + T visitBsTin(); + + T visitBhVat(); + + T visitBdBin(); + + T visitBbTin(); + + T visitByTin(); + + T visitBjIfu(); + + T visitBoTin(); + + T visitBaTin(); + + T visitBrCnpj(); + + T visitBrCpf(); + + T visitBgUic(); + + T visitBfIfu(); + + T visitKhTin(); + + T visitCmNiu(); + + T visitCaBn(); + + T visitCaGstHst(); + + T visitCaPstBc(); + + T visitCaPstMb(); + + T visitCaPstSk(); + + T visitCaQst(); + + T visitCvNif(); + + T visitClTin(); + + T visitCnTin(); + + T visitCoNit(); + + T visitCdNif(); + + T visitCrTin(); + + T visitHrOib(); + + T visitDoRcn(); + + T visitEcRuc(); + + T visitEgTin(); + + T visitSvNit(); + + T visitEtTin(); + + T visitEuOssVat(); + + T visitGeVat(); + + T visitGhTin(); + + T visitDeStn(); + + T visitGbVat(); + + T visitGnNif(); + + T visitHkBr(); + + T visitHuTin(); + + T visitIsVat(); + + T visitInGst(); + + T visitIdNpwp(); + + T visitIlVat(); + + T visitJpCn(); + + T visitJpRn(); + + T visitJpTrn(); + + T visitKzBin(); + + T visitKePin(); + + T visitKgTin(); + + T visitLaTin(); + + T visitLiUid(); + + T visitLiVat(); + + T visitMyFrp(); + + T visitMyItn(); + + T visitMySst(); + + T visitMrNif(); + + T visitMxRfc(); + + T visitMdVat(); + + T visitMePib(); + + T visitMaVat(); + + T visitNpPan(); + + T visitNzGst(); + + T visitNgTin(); + + T visitMkVat(); + + T visitNoVat(); + + T visitNoVoec(); + + T visitOmVat(); + + T visitPeRuc(); + + T visitPhTin(); + + T visitPlNip(); + + T visitRoTin(); + + T visitRuInn(); + + T visitRuKpp(); + + T visitSaVat(); + + T visitSnNinea(); + + T visitRsPib(); + + T visitSgGst(); + + T visitSgUen(); + + T visitSiTin(); + + T visitZaVat(); + + T visitKrBrn(); + + T visitEsCif(); + + T visitChUid(); + + T visitChVat(); + + T visitTwVat(); + + T visitTjTin(); + + T visitTzVat(); + + T visitThVat(); + + T visitTrTin(); + + T visitUgTin(); + + T visitUaVat(); + + T visitAeTrn(); + + T visitUsEin(); + + T visitUyRuc(); + + T visitUzTin(); + + T visitUzVat(); + + T visitVeRif(); + + T visitVnTin(); + + T visitZmTin(); + + T visitZwTin(); + + T visitSrFin(); + + T visitXiVat(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/TaxTypes.java b/src/main/java/com/whop/api/types/TaxTypes.java new file mode 100644 index 00000000..7d8ba137 --- /dev/null +++ b/src/main/java/com/whop/api/types/TaxTypes.java @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class TaxTypes { + public static final TaxTypes UNSPECIFIED = new TaxTypes(Value.UNSPECIFIED, "unspecified"); + + public static final TaxTypes EXCLUSIVE = new TaxTypes(Value.EXCLUSIVE, "exclusive"); + + public static final TaxTypes INCLUSIVE = new TaxTypes(Value.INCLUSIVE, "inclusive"); + + private final Value value; + + private final String string; + + TaxTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof TaxTypes && this.string.equals(((TaxTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case UNSPECIFIED: + return visitor.visitUnspecified(); + case EXCLUSIVE: + return visitor.visitExclusive(); + case INCLUSIVE: + return visitor.visitInclusive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static TaxTypes valueOf(String value) { + switch (value) { + case "unspecified": + return UNSPECIFIED; + case "exclusive": + return EXCLUSIVE; + case "inclusive": + return INCLUSIVE; + default: + return new TaxTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + INCLUSIVE, + + EXCLUSIVE, + + UNSPECIFIED, + + UNKNOWN + } + + public interface Visitor { + T visitInclusive(); + + T visitExclusive(); + + T visitUnspecified(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/TeamMember.java b/src/main/java/com/whop/api/types/TeamMember.java new file mode 100644 index 00000000..61756d72 --- /dev/null +++ b/src/main/java/com/whop/api/types/TeamMember.java @@ -0,0 +1,585 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TeamMember.Builder.class) +public final class TeamMember { + private final String accountId; + + private final Optional authorizedRole; + + private final String createdAt; + + private final Optional email; + + private final String id; + + private final boolean isAgent; + + private final TeamMemberRole role; + + private final TeamMemberStatus status; + + private final String updatedAt; + + private final Optional user; + + private final Map additionalProperties; + + private TeamMember( + String accountId, + Optional authorizedRole, + String createdAt, + Optional email, + String id, + boolean isAgent, + TeamMemberRole role, + TeamMemberStatus status, + String updatedAt, + Optional user, + Map additionalProperties) { + this.accountId = accountId; + this.authorizedRole = authorizedRole; + this.createdAt = createdAt; + this.email = email; + this.id = id; + this.isAgent = isAgent; + this.role = role; + this.status = status; + this.updatedAt = updatedAt; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account this membership belongs to, prefixed biz_. + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Custom role assigned to this member, or null when the member has a system role. + */ + @JsonIgnore + public Optional getAuthorizedRole() { + if (authorizedRole == null) { + return Optional.empty(); + } + return authorizedRole; + } + + /** + * @return When the member joined or the invite was sent, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return The member's email address. For accepted members, null unless the caller holds the email read scope; for invites, the invited address. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return Team member ID — ausr_ for accepted members, ausri_ for pending invites. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Whether this member is an agent (app-controlled account) rather than a human team member. Always false for invites. + */ + @JsonProperty("is_agent") + public boolean getIsAgent() { + return isAgent; + } + + /** + * @return The member's role on the account. custom means a bespoke dashboard-managed role; the API can read but not grant it. + */ + @JsonProperty("role") + public TeamMemberRole getRole() { + return role; + } + + /** + * @return joined for accepted members, pending while the invite is pending. + */ + @JsonProperty("status") + public TeamMemberStatus getStatus() { + return status; + } + + /** + * @return When the membership was last updated, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return The user behind this team membership. null for an invite sent to an email with no Whop account yet. + */ + @JsonIgnore + public Optional getUser() { + if (user == null) { + return Optional.empty(); + } + return user; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("authorized_role") + private Optional _getAuthorizedRole() { + return authorizedRole; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("user") + private Optional _getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TeamMember && equalTo((TeamMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TeamMember other) { + return accountId.equals(other.accountId) + && authorizedRole.equals(other.authorizedRole) + && createdAt.equals(other.createdAt) + && email.equals(other.email) + && id.equals(other.id) + && isAgent == other.isAgent + && role.equals(other.role) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.authorizedRole, + this.createdAt, + this.email, + this.id, + this.isAgent, + this.role, + this.status, + this.updatedAt, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + /** + *

The account this membership belongs to, prefixed biz_.

+ */ + CreatedAtStage accountId(@NotNull String accountId); + + Builder from(TeamMember other); + } + + public interface CreatedAtStage { + /** + *

When the member joined or the invite was sent, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + } + + public interface IdStage { + /** + *

Team member ID — ausr_ for accepted members, ausri_ for pending invites.

+ */ + IsAgentStage id(@NotNull String id); + } + + public interface IsAgentStage { + /** + *

Whether this member is an agent (app-controlled account) rather than a human team member. Always false for invites.

+ */ + RoleStage isAgent(boolean isAgent); + } + + public interface RoleStage { + /** + *

The member's role on the account. custom means a bespoke dashboard-managed role; the API can read but not grant it.

+ */ + StatusStage role(@NotNull TeamMemberRole role); + } + + public interface StatusStage { + /** + *

joined for accepted members, pending while the invite is pending.

+ */ + UpdatedAtStage status(@NotNull TeamMemberStatus status); + } + + public interface UpdatedAtStage { + /** + *

When the membership was last updated, as an ISO 8601 timestamp.

+ */ + _FinalStage updatedAt(@NotNull String updatedAt); + } + + public interface _FinalStage { + TeamMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Custom role assigned to this member, or null when the member has a system role.

+ */ + _FinalStage authorizedRole(Optional authorizedRole); + + _FinalStage authorizedRole(TeamMemberAuthorizedRole authorizedRole); + + _FinalStage authorizedRole(Nullable authorizedRole); + + /** + *

The member's email address. For accepted members, null unless the caller holds the email read scope; for invites, the invited address.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user behind this team membership. null for an invite sent to an email with no Whop account yet.

+ */ + _FinalStage user(Optional user); + + _FinalStage user(UserSummary user); + + _FinalStage user(Nullable user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, + CreatedAtStage, + IdStage, + IsAgentStage, + RoleStage, + StatusStage, + UpdatedAtStage, + _FinalStage { + private String accountId; + + private String createdAt; + + private String id; + + private boolean isAgent; + + private TeamMemberRole role; + + private TeamMemberStatus status; + + private String updatedAt; + + private Optional user = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional authorizedRole = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TeamMember other) { + accountId(other.getAccountId()); + authorizedRole(other.getAuthorizedRole()); + createdAt(other.getCreatedAt()); + email(other.getEmail()); + id(other.getId()); + isAgent(other.getIsAgent()); + role(other.getRole()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + user(other.getUser()); + return this; + } + + /** + *

The account this membership belongs to, prefixed biz_.

+ *

The account this membership belongs to, prefixed biz_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public CreatedAtStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

When the member joined or the invite was sent, as an ISO 8601 timestamp.

+ *

When the member joined or the invite was sent, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Team member ID — ausr_ for accepted members, ausri_ for pending invites.

+ *

Team member ID — ausr_ for accepted members, ausri_ for pending invites.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public IsAgentStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Whether this member is an agent (app-controlled account) rather than a human team member. Always false for invites.

+ *

Whether this member is an agent (app-controlled account) rather than a human team member. Always false for invites.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("is_agent") + public RoleStage isAgent(boolean isAgent) { + this.isAgent = isAgent; + return this; + } + + /** + *

The member's role on the account. custom means a bespoke dashboard-managed role; the API can read but not grant it.

+ *

The member's role on the account. custom means a bespoke dashboard-managed role; the API can read but not grant it.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("role") + public StatusStage role(@NotNull TeamMemberRole role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + /** + *

joined for accepted members, pending while the invite is pending.

+ *

joined for accepted members, pending while the invite is pending.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull TeamMemberStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

When the membership was last updated, as an ISO 8601 timestamp.

+ *

When the membership was last updated, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The user behind this team membership. null for an invite sent to an email with no Whop account yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(Nullable user) { + if (user.isNull()) { + this.user = null; + } else if (user.isEmpty()) { + this.user = Optional.empty(); + } else { + this.user = Optional.of(user.get()); + } + return this; + } + + /** + *

The user behind this team membership. null for an invite sent to an email with no Whop account yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage user(UserSummary user) { + this.user = Optional.ofNullable(user); + return this; + } + + /** + *

The user behind this team membership. null for an invite sent to an email with no Whop account yet.

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + /** + *

The member's email address. For accepted members, null unless the caller holds the email read scope; for invites, the invited address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The member's email address. For accepted members, null unless the caller holds the email read scope; for invites, the invited address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The member's email address. For accepted members, null unless the caller holds the email read scope; for invites, the invited address.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + /** + *

Custom role assigned to this member, or null when the member has a system role.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage authorizedRole(Nullable authorizedRole) { + if (authorizedRole.isNull()) { + this.authorizedRole = null; + } else if (authorizedRole.isEmpty()) { + this.authorizedRole = Optional.empty(); + } else { + this.authorizedRole = Optional.of(authorizedRole.get()); + } + return this; + } + + /** + *

Custom role assigned to this member, or null when the member has a system role.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage authorizedRole(TeamMemberAuthorizedRole authorizedRole) { + this.authorizedRole = Optional.ofNullable(authorizedRole); + return this; + } + + /** + *

Custom role assigned to this member, or null when the member has a system role.

+ */ + @java.lang.Override + @JsonSetter(value = "authorized_role", nulls = Nulls.SKIP) + public _FinalStage authorizedRole(Optional authorizedRole) { + this.authorizedRole = authorizedRole; + return this; + } + + @java.lang.Override + public TeamMember build() { + return new TeamMember( + accountId, + authorizedRole, + createdAt, + email, + id, + isAgent, + role, + status, + updatedAt, + user, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/TeamMemberAuthorizedRole.java b/src/main/java/com/whop/api/types/TeamMemberAuthorizedRole.java new file mode 100644 index 00000000..17d81e11 --- /dev/null +++ b/src/main/java/com/whop/api/types/TeamMemberAuthorizedRole.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TeamMemberAuthorizedRole.Builder.class) +public final class TeamMemberAuthorizedRole { + private final String id; + + private final String name; + + private final Map additionalProperties; + + private TeamMemberAuthorizedRole(String id, String name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return Custom role ID, prefixed aurl_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Custom role name. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TeamMemberAuthorizedRole && equalTo((TeamMemberAuthorizedRole) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TeamMemberAuthorizedRole other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Custom role ID, prefixed aurl_.

+ */ + NameStage id(@NotNull String id); + + Builder from(TeamMemberAuthorizedRole other); + } + + public interface NameStage { + /** + *

Custom role name.

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + TeamMemberAuthorizedRole build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TeamMemberAuthorizedRole other) { + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

Custom role ID, prefixed aurl_.

+ *

Custom role ID, prefixed aurl_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Custom role name.

+ *

Custom role name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public TeamMemberAuthorizedRole build() { + return new TeamMemberAuthorizedRole(id, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/TeamMemberRole.java b/src/main/java/com/whop/api/types/TeamMemberRole.java new file mode 100644 index 00000000..6299ac07 --- /dev/null +++ b/src/main/java/com/whop/api/types/TeamMemberRole.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class TeamMemberRole { + public static final TeamMemberRole APP_MANAGER = new TeamMemberRole(Value.APP_MANAGER, "app_manager"); + + public static final TeamMemberRole OWNER = new TeamMemberRole(Value.OWNER, "owner"); + + public static final TeamMemberRole WORKFORCE = new TeamMemberRole(Value.WORKFORCE, "workforce"); + + public static final TeamMemberRole ADMIN = new TeamMemberRole(Value.ADMIN, "admin"); + + public static final TeamMemberRole SUPPORT = new TeamMemberRole(Value.SUPPORT, "support"); + + public static final TeamMemberRole CUSTOM = new TeamMemberRole(Value.CUSTOM, "custom"); + + public static final TeamMemberRole SALES_MANAGER = new TeamMemberRole(Value.SALES_MANAGER, "sales_manager"); + + public static final TeamMemberRole MANAGER = new TeamMemberRole(Value.MANAGER, "manager"); + + public static final TeamMemberRole MODERATOR = new TeamMemberRole(Value.MODERATOR, "moderator"); + + public static final TeamMemberRole ADVERTISER = new TeamMemberRole(Value.ADVERTISER, "advertiser"); + + private final Value value; + + private final String string; + + TeamMemberRole(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof TeamMemberRole && this.string.equals(((TeamMemberRole) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APP_MANAGER: + return visitor.visitAppManager(); + case OWNER: + return visitor.visitOwner(); + case WORKFORCE: + return visitor.visitWorkforce(); + case ADMIN: + return visitor.visitAdmin(); + case SUPPORT: + return visitor.visitSupport(); + case CUSTOM: + return visitor.visitCustom(); + case SALES_MANAGER: + return visitor.visitSalesManager(); + case MANAGER: + return visitor.visitManager(); + case MODERATOR: + return visitor.visitModerator(); + case ADVERTISER: + return visitor.visitAdvertiser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static TeamMemberRole valueOf(String value) { + switch (value) { + case "app_manager": + return APP_MANAGER; + case "owner": + return OWNER; + case "workforce": + return WORKFORCE; + case "admin": + return ADMIN; + case "support": + return SUPPORT; + case "custom": + return CUSTOM; + case "sales_manager": + return SALES_MANAGER; + case "manager": + return MANAGER; + case "moderator": + return MODERATOR; + case "advertiser": + return ADVERTISER; + default: + return new TeamMemberRole(Value.UNKNOWN, value); + } + } + + public enum Value { + OWNER, + + ADMIN, + + SALES_MANAGER, + + MODERATOR, + + ADVERTISER, + + APP_MANAGER, + + SUPPORT, + + MANAGER, + + WORKFORCE, + + CUSTOM, + + UNKNOWN + } + + public interface Visitor { + T visitOwner(); + + T visitAdmin(); + + T visitSalesManager(); + + T visitModerator(); + + T visitAdvertiser(); + + T visitAppManager(); + + T visitSupport(); + + T visitManager(); + + T visitWorkforce(); + + T visitCustom(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/TeamMemberStatus.java b/src/main/java/com/whop/api/types/TeamMemberStatus.java new file mode 100644 index 00000000..b13cee85 --- /dev/null +++ b/src/main/java/com/whop/api/types/TeamMemberStatus.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class TeamMemberStatus { + public static final TeamMemberStatus PENDING = new TeamMemberStatus(Value.PENDING, "pending"); + + public static final TeamMemberStatus JOINED = new TeamMemberStatus(Value.JOINED, "joined"); + + private final Value value; + + private final String string; + + TeamMemberStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof TeamMemberStatus && this.string.equals(((TeamMemberStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case JOINED: + return visitor.visitJoined(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static TeamMemberStatus valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "joined": + return JOINED; + default: + return new TeamMemberStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + JOINED, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitJoined(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/TooManyRequestsErrorBody.java b/src/main/java/com/whop/api/types/TooManyRequestsErrorBody.java new file mode 100644 index 00000000..dabbf2d3 --- /dev/null +++ b/src/main/java/com/whop/api/types/TooManyRequestsErrorBody.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TooManyRequestsErrorBody.Builder.class) +public final class TooManyRequestsErrorBody { + private final TooManyRequestsErrorBodyError error; + + private final Map additionalProperties; + + private TooManyRequestsErrorBody(TooManyRequestsErrorBodyError error, Map additionalProperties) { + this.error = error; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("error") + public TooManyRequestsErrorBodyError getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TooManyRequestsErrorBody && equalTo((TooManyRequestsErrorBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TooManyRequestsErrorBody other) { + return error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + _FinalStage error(@NotNull TooManyRequestsErrorBodyError error); + + Builder from(TooManyRequestsErrorBody other); + } + + public interface _FinalStage { + TooManyRequestsErrorBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private TooManyRequestsErrorBodyError error; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TooManyRequestsErrorBody other) { + error(other.getError()); + return this; + } + + @java.lang.Override + @JsonSetter("error") + public _FinalStage error(@NotNull TooManyRequestsErrorBodyError error) { + this.error = Objects.requireNonNull(error, "error must not be null"); + return this; + } + + @java.lang.Override + public TooManyRequestsErrorBody build() { + return new TooManyRequestsErrorBody(error, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/TooManyRequestsErrorBodyError.java b/src/main/java/com/whop/api/types/TooManyRequestsErrorBodyError.java new file mode 100644 index 00000000..0a4d48c5 --- /dev/null +++ b/src/main/java/com/whop/api/types/TooManyRequestsErrorBodyError.java @@ -0,0 +1,289 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TooManyRequestsErrorBodyError.Builder.class) +public final class TooManyRequestsErrorBodyError { + private final Optional code; + + private final String message; + + private final Optional param; + + private final String type; + + private final Map additionalProperties; + + private TooManyRequestsErrorBodyError( + Optional code, + String message, + Optional param, + String type, + Map additionalProperties) { + this.code = code; + this.message = message; + this.param = param; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json' + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + @JsonProperty("message") + public String getMessage() { + return message; + } + + /** + * @return The parameter that caused the error, if applicable + */ + @JsonIgnore + public Optional getParam() { + if (param == null) { + return Optional.empty(); + } + return param; + } + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("param") + private Optional _getParam() { + return param; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TooManyRequestsErrorBodyError && equalTo((TooManyRequestsErrorBodyError) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TooManyRequestsErrorBodyError other) { + return code.equals(other.code) + && message.equals(other.message) + && param.equals(other.param) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.message, this.param, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + TypeStage message(@NotNull String message); + + Builder from(TooManyRequestsErrorBodyError other); + } + + public interface TypeStage { + _FinalStage type(@NotNull String type); + } + + public interface _FinalStage { + TooManyRequestsErrorBodyError build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ */ + _FinalStage code(Optional code); + + _FinalStage code(String code); + + _FinalStage code(Nullable code); + + /** + *

The parameter that caused the error, if applicable

+ */ + _FinalStage param(Optional param); + + _FinalStage param(String param); + + _FinalStage param(Nullable param); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, TypeStage, _FinalStage { + private String message; + + private String type; + + private Optional param = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TooManyRequestsErrorBodyError other) { + code(other.getCode()); + message(other.getMessage()); + param(other.getParam()); + type(other.getType()); + return this; + } + + @java.lang.Override + @JsonSetter("message") + public TypeStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage param(Nullable param) { + if (param.isNull()) { + this.param = null; + } else if (param.isEmpty()) { + this.param = Optional.empty(); + } else { + this.param = Optional.of(param.get()); + } + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage param(String param) { + this.param = Optional.ofNullable(param); + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ */ + @java.lang.Override + @JsonSetter(value = "param", nulls = Nulls.SKIP) + public _FinalStage param(Optional param) { + this.param = param; + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public TooManyRequestsErrorBodyError build() { + return new TooManyRequestsErrorBodyError(code, message, param, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Topup.java b/src/main/java/com/whop/api/types/Topup.java new file mode 100644 index 00000000..25d082c5 --- /dev/null +++ b/src/main/java/com/whop/api/types/Topup.java @@ -0,0 +1,523 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Topup.Builder.class) +public final class Topup { + private final OffsetDateTime createdAt; + + private final Optional currency; + + private final Optional failureMessage; + + private final String id; + + private final Optional paidAt; + + private final Optional status; + + private final Optional total; + + private final Map additionalProperties; + + private Topup( + OffsetDateTime createdAt, + Optional currency, + Optional failureMessage, + String id, + Optional paidAt, + Optional status, + Optional total, + Map additionalProperties) { + this.createdAt = createdAt; + this.currency = currency; + this.failureMessage = failureMessage; + this.id = id; + this.paidAt = paidAt; + this.status = status; + this.total = total; + this.additionalProperties = additionalProperties; + } + + /** + * @return The datetime the payment was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code for this payment (e.g., 'usd', 'eur'). + */ + @JsonIgnore + public Optional getCurrency() { + if (currency == null) { + return Optional.empty(); + } + return currency; + } + + /** + * @return If the payment failed, the reason for the failure. + */ + @JsonIgnore + public Optional getFailureMessage() { + if (failureMessage == null) { + return Optional.empty(); + } + return failureMessage; + } + + /** + * @return The unique identifier for the payment. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp. + */ + @JsonIgnore + public Optional getPaidAt() { + if (paidAt == null) { + return Optional.empty(); + } + return paidAt; + } + + /** + * @return The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void'). + */ + @JsonIgnore + public Optional getStatus() { + if (status == null) { + return Optional.empty(); + } + return status; + } + + /** + * @return The total to show to the creator (excluding buyer fees). + */ + @JsonIgnore + public Optional getTotal() { + if (total == null) { + return Optional.empty(); + } + return total; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("currency") + private Optional _getCurrency() { + return currency; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failure_message") + private Optional _getFailureMessage() { + return failureMessage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("paid_at") + private Optional _getPaidAt() { + return paidAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status") + private Optional _getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("total") + private Optional _getTotal() { + return total; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Topup && equalTo((Topup) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Topup other) { + return createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && failureMessage.equals(other.failureMessage) + && id.equals(other.id) + && paidAt.equals(other.paidAt) + && status.equals(other.status) + && total.equals(other.total); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, this.currency, this.failureMessage, this.id, this.paidAt, this.status, this.total); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the payment was created.

+ */ + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(Topup other); + } + + public interface IdStage { + /** + *

The unique identifier for the payment.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + Topup build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ */ + _FinalStage currency(Optional currency); + + _FinalStage currency(Currencies currency); + + _FinalStage currency(Nullable currency); + + /** + *

If the payment failed, the reason for the failure.

+ */ + _FinalStage failureMessage(Optional failureMessage); + + _FinalStage failureMessage(String failureMessage); + + _FinalStage failureMessage(Nullable failureMessage); + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ */ + _FinalStage paidAt(Optional paidAt); + + _FinalStage paidAt(OffsetDateTime paidAt); + + _FinalStage paidAt(Nullable paidAt); + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ */ + _FinalStage status(Optional status); + + _FinalStage status(ReceiptStatus status); + + _FinalStage status(Nullable status); + + /** + *

The total to show to the creator (excluding buyer fees).

+ */ + _FinalStage total(Optional total); + + _FinalStage total(Double total); + + _FinalStage total(Nullable total); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private Optional total = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional paidAt = Optional.empty(); + + private Optional failureMessage = Optional.empty(); + + private Optional currency = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Topup other) { + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + failureMessage(other.getFailureMessage()); + id(other.getId()); + paidAt(other.getPaidAt()); + status(other.getStatus()); + total(other.getTotal()); + return this; + } + + /** + *

The datetime the payment was created.

+ *

The datetime the payment was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The unique identifier for the payment.

+ *

The unique identifier for the payment.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage total(Nullable total) { + if (total.isNull()) { + this.total = null; + } else if (total.isEmpty()) { + this.total = Optional.empty(); + } else { + this.total = Optional.of(total.get()); + } + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage total(Double total) { + this.total = Optional.ofNullable(total); + return this; + } + + /** + *

The total to show to the creator (excluding buyer fees).

+ */ + @java.lang.Override + @JsonSetter(value = "total", nulls = Nulls.SKIP) + public _FinalStage total(Optional total) { + this.total = total; + return this; + } + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(Nullable status) { + if (status.isNull()) { + this.status = null; + } else if (status.isEmpty()) { + this.status = Optional.empty(); + } else { + this.status = Optional.of(status.get()); + } + return this; + } + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(ReceiptStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

The current lifecycle state of this payment (e.g., 'draft', 'open', 'paid', 'void').

+ */ + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidAt(Nullable paidAt) { + if (paidAt.isNull()) { + this.paidAt = null; + } else if (paidAt.isEmpty()) { + this.paidAt = Optional.empty(); + } else { + this.paidAt = Optional.of(paidAt.get()); + } + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paidAt(OffsetDateTime paidAt) { + this.paidAt = Optional.ofNullable(paidAt); + return this; + } + + /** + *

The time at which this payment was successfully collected. Null if the payment has not yet succeeded. As a Unix timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "paid_at", nulls = Nulls.SKIP) + public _FinalStage paidAt(Optional paidAt) { + this.paidAt = paidAt; + return this; + } + + /** + *

If the payment failed, the reason for the failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureMessage(Nullable failureMessage) { + if (failureMessage.isNull()) { + this.failureMessage = null; + } else if (failureMessage.isEmpty()) { + this.failureMessage = Optional.empty(); + } else { + this.failureMessage = Optional.of(failureMessage.get()); + } + return this; + } + + /** + *

If the payment failed, the reason for the failure.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failureMessage(String failureMessage) { + this.failureMessage = Optional.ofNullable(failureMessage); + return this; + } + + /** + *

If the payment failed, the reason for the failure.

+ */ + @java.lang.Override + @JsonSetter(value = "failure_message", nulls = Nulls.SKIP) + public _FinalStage failureMessage(Optional failureMessage) { + this.failureMessage = failureMessage; + return this; + } + + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Nullable currency) { + if (currency.isNull()) { + this.currency = null; + } else if (currency.isEmpty()) { + this.currency = Optional.empty(); + } else { + this.currency = Optional.of(currency.get()); + } + return this; + } + + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage currency(Currencies currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + *

The three-letter ISO currency code for this payment (e.g., 'usd', 'eur').

+ */ + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + @java.lang.Override + public Topup build() { + return new Topup(createdAt, currency, failureMessage, id, paidAt, status, total, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Transfer.java b/src/main/java/com/whop/api/types/Transfer.java new file mode 100644 index 00000000..e3b40540 --- /dev/null +++ b/src/main/java/com/whop/api/types/Transfer.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Transfer.Builder.class) +public final class Transfer { + private final Optional origin; + + private final Optional destination; + + private final Map additionalProperties; + + private Transfer( + Optional origin, + Optional destination, + Map additionalProperties) { + this.origin = origin; + this.destination = destination; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("origin") + public Optional getOrigin() { + return origin; + } + + @JsonProperty("destination") + public Optional getDestination() { + return destination; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Transfer && equalTo((Transfer) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Transfer other) { + return origin.equals(other.origin) && destination.equals(other.destination); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.origin, this.destination); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional origin = Optional.empty(); + + private Optional destination = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(Transfer other) { + origin(other.getOrigin()); + destination(other.getDestination()); + return this; + } + + @JsonSetter(value = "origin", nulls = Nulls.SKIP) + public Builder origin(Optional origin) { + this.origin = origin; + return this; + } + + public Builder origin(TransferOrigin origin) { + this.origin = Optional.ofNullable(origin); + return this; + } + + @JsonSetter(value = "destination", nulls = Nulls.SKIP) + public Builder destination(Optional destination) { + this.destination = destination; + return this; + } + + public Builder destination(TransferDestination destination) { + this.destination = Optional.ofNullable(destination); + return this; + } + + public Transfer build() { + return new Transfer(origin, destination, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/TransferDestination.java b/src/main/java/com/whop/api/types/TransferDestination.java new file mode 100644 index 00000000..b1f087f8 --- /dev/null +++ b/src/main/java/com/whop/api/types/TransferDestination.java @@ -0,0 +1,221 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class TransferDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private TransferDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static TransferDestination user(TransferDestinationUser value) { + return new TransferDestination(new UserValue(value)); + } + + public static TransferDestination company(TransferDestinationCompany value) { + return new TransferDestination(new CompanyValue(value)); + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean isCompany() { + return value instanceof CompanyValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional getCompany() { + if (isCompany()) { + return Optional.of(((CompanyValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferDestination && value.equals(((TransferDestination) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitUser(TransferDestinationUser user); + + T visitCompany(TransferDestinationCompany company); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(UserValue.class), @JsonSubTypes.Type(CompanyValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("User") + @JsonIgnoreProperties("typename") + private static final class UserValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private TransferDestinationUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(TransferDestinationUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TransferDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("Company") + @JsonIgnoreProperties("typename") + private static final class CompanyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private TransferDestinationCompany value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CompanyValue() {} + + private CompanyValue(TransferDestinationCompany value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCompany(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyValue && equalTo((CompanyValue) other); + } + + private boolean equalTo(CompanyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TransferDestination{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "TransferDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/types/TransferDestinationCompany.java b/src/main/java/com/whop/api/types/TransferDestinationCompany.java new file mode 100644 index 00000000..665edc24 --- /dev/null +++ b/src/main/java/com/whop/api/types/TransferDestinationCompany.java @@ -0,0 +1,196 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TransferDestinationCompany.Builder.class) +public final class TransferDestinationCompany { + private final String id; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private TransferDestinationCompany( + String id, String route, String title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The URL slug for the company's store page. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferDestinationCompany && equalTo((TransferDestinationCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TransferDestinationCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + RouteStage id(@NotNull String id); + + Builder from(TransferDestinationCompany other); + } + + public interface RouteStage { + /** + *

The URL slug for the company's store page.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + TransferDestinationCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TransferDestinationCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The URL slug for the company's store page.

+ *

The URL slug for the company's store page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public TransferDestinationCompany build() { + return new TransferDestinationCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/TransferDestinationUser.java b/src/main/java/com/whop/api/types/TransferDestinationUser.java new file mode 100644 index 00000000..5aebdca4 --- /dev/null +++ b/src/main/java/com/whop/api/types/TransferDestinationUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TransferDestinationUser.Builder.class) +public final class TransferDestinationUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private TransferDestinationUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferDestinationUser && equalTo((TransferDestinationUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TransferDestinationUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(TransferDestinationUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + TransferDestinationUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TransferDestinationUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public TransferDestinationUser build() { + return new TransferDestinationUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/TransferOrigin.java b/src/main/java/com/whop/api/types/TransferOrigin.java new file mode 100644 index 00000000..aad0580c --- /dev/null +++ b/src/main/java/com/whop/api/types/TransferOrigin.java @@ -0,0 +1,221 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class TransferOrigin { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private TransferOrigin(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static TransferOrigin user(TransferOriginUser value) { + return new TransferOrigin(new UserValue(value)); + } + + public static TransferOrigin company(TransferOriginCompany value) { + return new TransferOrigin(new CompanyValue(value)); + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean isCompany() { + return value instanceof CompanyValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional getCompany() { + if (isCompany()) { + return Optional.of(((CompanyValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferOrigin && value.equals(((TransferOrigin) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitUser(TransferOriginUser user); + + T visitCompany(TransferOriginCompany company); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "typename", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(UserValue.class), @JsonSubTypes.Type(CompanyValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("User") + @JsonIgnoreProperties("typename") + private static final class UserValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private TransferOriginUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(TransferOriginUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TransferOrigin{" + "value: " + value + "}"; + } + } + + @JsonTypeName("Company") + @JsonIgnoreProperties("typename") + private static final class CompanyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "typename", allowSetters = true) + private TransferOriginCompany value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CompanyValue() {} + + private CompanyValue(TransferOriginCompany value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCompany(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyValue && equalTo((CompanyValue) other); + } + + private boolean equalTo(CompanyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TransferOrigin{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("typename") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "TransferOrigin{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/whop/api/types/TransferOriginCompany.java b/src/main/java/com/whop/api/types/TransferOriginCompany.java new file mode 100644 index 00000000..76bf0345 --- /dev/null +++ b/src/main/java/com/whop/api/types/TransferOriginCompany.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TransferOriginCompany.Builder.class) +public final class TransferOriginCompany { + private final String id; + + private final String route; + + private final String title; + + private final Map additionalProperties; + + private TransferOriginCompany(String id, String route, String title, Map additionalProperties) { + this.id = id; + this.route = route; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the company. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The URL slug for the company's store page. + */ + @JsonProperty("route") + public String getRoute() { + return route; + } + + /** + * @return The display name of the company shown to customers. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferOriginCompany && equalTo((TransferOriginCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TransferOriginCompany other) { + return id.equals(other.id) && route.equals(other.route) && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.route, this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the company.

+ */ + RouteStage id(@NotNull String id); + + Builder from(TransferOriginCompany other); + } + + public interface RouteStage { + /** + *

The URL slug for the company's store page.

+ */ + TitleStage route(@NotNull String route); + } + + public interface TitleStage { + /** + *

The display name of the company shown to customers.

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + TransferOriginCompany build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, RouteStage, TitleStage, _FinalStage { + private String id; + + private String route; + + private String title; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TransferOriginCompany other) { + id(other.getId()); + route(other.getRoute()); + title(other.getTitle()); + return this; + } + + /** + *

The unique identifier for the company.

+ *

The unique identifier for the company.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public RouteStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The URL slug for the company's store page.

+ *

The URL slug for the company's store page.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("route") + public TitleStage route(@NotNull String route) { + this.route = Objects.requireNonNull(route, "route must not be null"); + return this; + } + + /** + *

The display name of the company shown to customers.

+ *

The display name of the company shown to customers.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public TransferOriginCompany build() { + return new TransferOriginCompany(id, route, title, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/TransferOriginUser.java b/src/main/java/com/whop/api/types/TransferOriginUser.java new file mode 100644 index 00000000..9c30f5fd --- /dev/null +++ b/src/main/java/com/whop/api/types/TransferOriginUser.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TransferOriginUser.Builder.class) +public final class TransferOriginUser { + private final String id; + + private final Optional name; + + private final String username; + + private final Map additionalProperties; + + private TransferOriginUser( + String id, Optional name, String username, Map additionalProperties) { + this.id = id; + this.name = name; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier for the user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name shown on their public profile. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return The user's unique username shown on their public profile. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferOriginUser && equalTo((TransferOriginUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TransferOriginUser other) { + return id.equals(other.id) && name.equals(other.name) && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the user.

+ */ + UsernameStage id(@NotNull String id); + + Builder from(TransferOriginUser other); + } + + public interface UsernameStage { + /** + *

The user's unique username shown on their public profile.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + TransferOriginUser build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's display name shown on their public profile.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, UsernameStage, _FinalStage { + private String id; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TransferOriginUser other) { + id(other.getId()); + name(other.getName()); + username(other.getUsername()); + return this; + } + + /** + *

The unique identifier for the user.

+ *

The unique identifier for the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public UsernameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The user's unique username shown on their public profile.

+ *

The user's unique username shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name shown on their public profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name shown on their public profile.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public TransferOriginUser build() { + return new TransferOriginUser(id, name, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UnauthorizedErrorBody.java b/src/main/java/com/whop/api/types/UnauthorizedErrorBody.java new file mode 100644 index 00000000..dee0ae2a --- /dev/null +++ b/src/main/java/com/whop/api/types/UnauthorizedErrorBody.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UnauthorizedErrorBody.Builder.class) +public final class UnauthorizedErrorBody { + private final UnauthorizedErrorBodyError error; + + private final Map additionalProperties; + + private UnauthorizedErrorBody(UnauthorizedErrorBodyError error, Map additionalProperties) { + this.error = error; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("error") + public UnauthorizedErrorBodyError getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UnauthorizedErrorBody && equalTo((UnauthorizedErrorBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UnauthorizedErrorBody other) { + return error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + _FinalStage error(@NotNull UnauthorizedErrorBodyError error); + + Builder from(UnauthorizedErrorBody other); + } + + public interface _FinalStage { + UnauthorizedErrorBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private UnauthorizedErrorBodyError error; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UnauthorizedErrorBody other) { + error(other.getError()); + return this; + } + + @java.lang.Override + @JsonSetter("error") + public _FinalStage error(@NotNull UnauthorizedErrorBodyError error) { + this.error = Objects.requireNonNull(error, "error must not be null"); + return this; + } + + @java.lang.Override + public UnauthorizedErrorBody build() { + return new UnauthorizedErrorBody(error, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UnauthorizedErrorBodyError.java b/src/main/java/com/whop/api/types/UnauthorizedErrorBodyError.java new file mode 100644 index 00000000..13c047d8 --- /dev/null +++ b/src/main/java/com/whop/api/types/UnauthorizedErrorBodyError.java @@ -0,0 +1,289 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UnauthorizedErrorBodyError.Builder.class) +public final class UnauthorizedErrorBodyError { + private final Optional code; + + private final String message; + + private final Optional param; + + private final String type; + + private final Map additionalProperties; + + private UnauthorizedErrorBodyError( + Optional code, + String message, + Optional param, + String type, + Map additionalProperties) { + this.code = code; + this.message = message; + this.param = param; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json' + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + @JsonProperty("message") + public String getMessage() { + return message; + } + + /** + * @return The parameter that caused the error, if applicable + */ + @JsonIgnore + public Optional getParam() { + if (param == null) { + return Optional.empty(); + } + return param; + } + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("param") + private Optional _getParam() { + return param; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UnauthorizedErrorBodyError && equalTo((UnauthorizedErrorBodyError) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UnauthorizedErrorBodyError other) { + return code.equals(other.code) + && message.equals(other.message) + && param.equals(other.param) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.message, this.param, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + TypeStage message(@NotNull String message); + + Builder from(UnauthorizedErrorBodyError other); + } + + public interface TypeStage { + _FinalStage type(@NotNull String type); + } + + public interface _FinalStage { + UnauthorizedErrorBodyError build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ */ + _FinalStage code(Optional code); + + _FinalStage code(String code); + + _FinalStage code(Nullable code); + + /** + *

The parameter that caused the error, if applicable

+ */ + _FinalStage param(Optional param); + + _FinalStage param(String param); + + _FinalStage param(Nullable param); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, TypeStage, _FinalStage { + private String message; + + private String type; + + private Optional param = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UnauthorizedErrorBodyError other) { + code(other.getCode()); + message(other.getMessage()); + param(other.getParam()); + type(other.getType()); + return this; + } + + @java.lang.Override + @JsonSetter("message") + public TypeStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage param(Nullable param) { + if (param.isNull()) { + this.param = null; + } else if (param.isEmpty()) { + this.param = Optional.empty(); + } else { + this.param = Optional.of(param.get()); + } + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage param(String param) { + this.param = Optional.ofNullable(param); + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ */ + @java.lang.Override + @JsonSetter(value = "param", nulls = Nulls.SKIP) + public _FinalStage param(Optional param) { + this.param = param; + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public UnauthorizedErrorBodyError build() { + return new UnauthorizedErrorBodyError(code, message, param, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UnprocessableEntityErrorBody.java b/src/main/java/com/whop/api/types/UnprocessableEntityErrorBody.java new file mode 100644 index 00000000..0b1b2578 --- /dev/null +++ b/src/main/java/com/whop/api/types/UnprocessableEntityErrorBody.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UnprocessableEntityErrorBody.Builder.class) +public final class UnprocessableEntityErrorBody { + private final UnprocessableEntityErrorBodyError error; + + private final Map additionalProperties; + + private UnprocessableEntityErrorBody( + UnprocessableEntityErrorBodyError error, Map additionalProperties) { + this.error = error; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("error") + public UnprocessableEntityErrorBodyError getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UnprocessableEntityErrorBody && equalTo((UnprocessableEntityErrorBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UnprocessableEntityErrorBody other) { + return error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + _FinalStage error(@NotNull UnprocessableEntityErrorBodyError error); + + Builder from(UnprocessableEntityErrorBody other); + } + + public interface _FinalStage { + UnprocessableEntityErrorBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private UnprocessableEntityErrorBodyError error; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UnprocessableEntityErrorBody other) { + error(other.getError()); + return this; + } + + @java.lang.Override + @JsonSetter("error") + public _FinalStage error(@NotNull UnprocessableEntityErrorBodyError error) { + this.error = Objects.requireNonNull(error, "error must not be null"); + return this; + } + + @java.lang.Override + public UnprocessableEntityErrorBody build() { + return new UnprocessableEntityErrorBody(error, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UnprocessableEntityErrorBodyError.java b/src/main/java/com/whop/api/types/UnprocessableEntityErrorBodyError.java new file mode 100644 index 00000000..b0d86466 --- /dev/null +++ b/src/main/java/com/whop/api/types/UnprocessableEntityErrorBodyError.java @@ -0,0 +1,289 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UnprocessableEntityErrorBodyError.Builder.class) +public final class UnprocessableEntityErrorBodyError { + private final Optional code; + + private final String message; + + private final Optional param; + + private final String type; + + private final Map additionalProperties; + + private UnprocessableEntityErrorBodyError( + Optional code, + String message, + Optional param, + String type, + Map additionalProperties) { + this.code = code; + this.message = message; + this.param = param; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json' + */ + @JsonIgnore + public Optional getCode() { + if (code == null) { + return Optional.empty(); + } + return code; + } + + @JsonProperty("message") + public String getMessage() { + return message; + } + + /** + * @return The parameter that caused the error, if applicable + */ + @JsonIgnore + public Optional getParam() { + if (param == null) { + return Optional.empty(); + } + return param; + } + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("code") + private Optional _getCode() { + return code; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("param") + private Optional _getParam() { + return param; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UnprocessableEntityErrorBodyError && equalTo((UnprocessableEntityErrorBodyError) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UnprocessableEntityErrorBodyError other) { + return code.equals(other.code) + && message.equals(other.message) + && param.equals(other.param) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.message, this.param, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + TypeStage message(@NotNull String message); + + Builder from(UnprocessableEntityErrorBodyError other); + } + + public interface TypeStage { + _FinalStage type(@NotNull String type); + } + + public interface _FinalStage { + UnprocessableEntityErrorBodyError build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ */ + _FinalStage code(Optional code); + + _FinalStage code(String code); + + _FinalStage code(Nullable code); + + /** + *

The parameter that caused the error, if applicable

+ */ + _FinalStage param(Optional param); + + _FinalStage param(String param); + + _FinalStage param(Nullable param); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, TypeStage, _FinalStage { + private String message; + + private String type; + + private Optional param = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UnprocessableEntityErrorBodyError other) { + code(other.getCode()); + message(other.getMessage()); + param(other.getParam()); + type(other.getType()); + return this; + } + + @java.lang.Override + @JsonSetter("message") + public TypeStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage param(Nullable param) { + if (param.isNull()) { + this.param = null; + } else if (param.isEmpty()) { + this.param = Optional.empty(); + } else { + this.param = Optional.of(param.get()); + } + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage param(String param) { + this.param = Optional.ofNullable(param); + return this; + } + + /** + *

The parameter that caused the error, if applicable

+ */ + @java.lang.Override + @JsonSetter(value = "param", nulls = Nulls.SKIP) + public _FinalStage param(Optional param) { + this.param = param; + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(Nullable code) { + if (code.isNull()) { + this.code = null; + } else if (code.isEmpty()) { + this.code = Optional.empty(); + } else { + this.code = Optional.of(code.get()); + } + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

A short string indicating the specific error code, e.g. 'parameter_missing', 'parameter_invalid', 'invalid_json'

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public UnprocessableEntityErrorBodyError build() { + return new UnprocessableEntityErrorBodyError(code, message, param, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UploadStatuses.java b/src/main/java/com/whop/api/types/UploadStatuses.java new file mode 100644 index 00000000..21477cfd --- /dev/null +++ b/src/main/java/com/whop/api/types/UploadStatuses.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UploadStatuses { + public static final UploadStatuses FAILED = new UploadStatuses(Value.FAILED, "failed"); + + public static final UploadStatuses PENDING = new UploadStatuses(Value.PENDING, "pending"); + + public static final UploadStatuses PROCESSING = new UploadStatuses(Value.PROCESSING, "processing"); + + public static final UploadStatuses READY = new UploadStatuses(Value.READY, "ready"); + + private final Value value; + + private final String string; + + UploadStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UploadStatuses && this.string.equals(((UploadStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case PENDING: + return visitor.visitPending(); + case PROCESSING: + return visitor.visitProcessing(); + case READY: + return visitor.visitReady(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UploadStatuses valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "pending": + return PENDING; + case "processing": + return PROCESSING; + case "ready": + return READY; + default: + return new UploadStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + PENDING, + + PROCESSING, + + READY, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitPending(); + + T visitProcessing(); + + T visitReady(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/User.java b/src/main/java/com/whop/api/types/User.java new file mode 100644 index 00000000..8e14be13 --- /dev/null +++ b/src/main/java/com/whop/api/types/User.java @@ -0,0 +1,1009 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = User.Builder.class) +public final class User { + private final Optional balance; + + private final Optional balanceHistory; + + private final Optional banner; + + private final Optional bio; + + private final String createdAt; + + private final Optional earningsUsd; + + private final Optional email; + + private final String id; + + private final Optional name; + + private final UserProfilePicture profilePicture; + + private final List socialAccounts; + + private final Optional staff; + + private final String username; + + private final Map verification; + + private final Optional whopPartnerEnabledAt; + + private final Map additionalProperties; + + private User( + Optional balance, + Optional balanceHistory, + Optional banner, + Optional bio, + String createdAt, + Optional earningsUsd, + Optional email, + String id, + Optional name, + UserProfilePicture profilePicture, + List socialAccounts, + Optional staff, + String username, + Map verification, + Optional whopPartnerEnabledAt, + Map additionalProperties) { + this.balance = balance; + this.balanceHistory = balanceHistory; + this.banner = banner; + this.bio = bio; + this.createdAt = createdAt; + this.earningsUsd = earningsUsd; + this.email = email; + this.id = id; + this.name = name; + this.profilePicture = profilePicture; + this.socialAccounts = socialAccounts; + this.staff = staff; + this.username = username; + this.verification = verification; + this.whopPartnerEnabledAt = whopPartnerEnabledAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's balance: personal cash + crypto + in-flight treasury deposits, plus account balances for accounts they own. Computed only on the self view (retrieved with the reserved id me) for callers with balance-read scope; null otherwise. + */ + @JsonIgnore + public Optional getBalance() { + if (balance == null) { + return Optional.empty(); + } + return balance; + } + + /** + * @return The user's cumulative wallet balance over time (USD { t, v } points plus last/min/max), for the balance chart. Opt in with include_balance_history=true when retrieving yourself with the reserved id me; populated only for callers with balance-read scope and null otherwise. A user with no wallet activity returns an empty series. + */ + @JsonIgnore + public Optional getBalanceHistory() { + if (balanceHistory == null) { + return Optional.empty(); + } + return balanceHistory; + } + + /** + * @return The user's profile banner wrapper. null when the user has no banner. + */ + @JsonIgnore + public Optional getBanner() { + if (banner == null) { + return Optional.empty(); + } + return banner; + } + + /** + * @return The user's biography + */ + @JsonIgnore + public Optional getBio() { + if (bio == null) { + return Optional.empty(); + } + return bio; + } + + /** + * @return When the user was created, as an ISO 8601 timestamp + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return The user's gross USD income over time. Populated only on single-user self reads for callers with balance-read scope; null otherwise. + */ + @JsonIgnore + public Optional getEarningsUsd() { + if (earningsUsd == null) { + return Optional.empty(); + } + return earningsUsd; + } + + /** + * @return The user's email address. Populated only on the self view (retrieved with the reserved id me) for callers with email-read scope; null otherwise, or while the account has no confirmed email yet. + */ + @JsonIgnore + public Optional getEmail() { + if (email == null) { + return Optional.empty(); + } + return email; + } + + /** + * @return User ID, prefixed user_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The user's display name + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return Avatar wrapper; its url is always present, using a generated placeholder when the user set no picture. + */ + @JsonProperty("profile_picture") + public UserProfilePicture getProfilePicture() { + return profilePicture; + } + + @JsonProperty("social_accounts") + public List getSocialAccounts() { + return socialAccounts; + } + + /** + * @return Whop staff access flags. Populated only on the self view (retrieved with the reserved id me) for callers with staff-read scope; null there for every user who is not Whop staff, and always null elsewhere. + */ + @JsonIgnore + public Optional getStaff() { + if (staff == null) { + return Optional.empty(); + } + return staff; + } + + /** + * @return The user's unique username + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + /** + * @return Identity verification status for the user's individual (KYC) and business (KYB) profiles. Each is null until created, otherwise a status of not_started, pending, approved, or rejected. + */ + @JsonProperty("verification") + public Map getVerification() { + return verification; + } + + /** + * @return When the user became an enrolled Whop Partner, as an ISO 8601 timestamp. null if never enrolled. + */ + @JsonIgnore + public Optional getWhopPartnerEnabledAt() { + if (whopPartnerEnabledAt == null) { + return Optional.empty(); + } + return whopPartnerEnabledAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("balance") + private Optional _getBalance() { + return balance; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("balance_history") + private Optional _getBalanceHistory() { + return balanceHistory; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("banner") + private Optional _getBanner() { + return banner; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("bio") + private Optional _getBio() { + return bio; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("earnings_usd") + private Optional _getEarningsUsd() { + return earningsUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("email") + private Optional _getEmail() { + return email; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("staff") + private Optional _getStaff() { + return staff; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("whop_partner_enabled_at") + private Optional _getWhopPartnerEnabledAt() { + return whopPartnerEnabledAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof User && equalTo((User) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(User other) { + return balance.equals(other.balance) + && balanceHistory.equals(other.balanceHistory) + && banner.equals(other.banner) + && bio.equals(other.bio) + && createdAt.equals(other.createdAt) + && earningsUsd.equals(other.earningsUsd) + && email.equals(other.email) + && id.equals(other.id) + && name.equals(other.name) + && profilePicture.equals(other.profilePicture) + && socialAccounts.equals(other.socialAccounts) + && staff.equals(other.staff) + && username.equals(other.username) + && verification.equals(other.verification) + && whopPartnerEnabledAt.equals(other.whopPartnerEnabledAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.balance, + this.balanceHistory, + this.banner, + this.bio, + this.createdAt, + this.earningsUsd, + this.email, + this.id, + this.name, + this.profilePicture, + this.socialAccounts, + this.staff, + this.username, + this.verification, + this.whopPartnerEnabledAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the user was created, as an ISO 8601 timestamp

+ */ + IdStage createdAt(@NotNull String createdAt); + + Builder from(User other); + } + + public interface IdStage { + /** + *

User ID, prefixed user_.

+ */ + ProfilePictureStage id(@NotNull String id); + } + + public interface ProfilePictureStage { + /** + *

Avatar wrapper; its url is always present, using a generated placeholder when the user set no picture.

+ */ + UsernameStage profilePicture(@NotNull UserProfilePicture profilePicture); + } + + public interface UsernameStage { + /** + *

The user's unique username

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + User build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's balance: personal cash + crypto + in-flight treasury deposits, plus account balances for accounts they own. Computed only on the self view (retrieved with the reserved id me) for callers with balance-read scope; null otherwise.

+ */ + _FinalStage balance(Optional balance); + + _FinalStage balance(UserBalance balance); + + _FinalStage balance(Nullable balance); + + /** + *

The user's cumulative wallet balance over time (USD { t, v } points plus last/min/max), for the balance chart. Opt in with include_balance_history=true when retrieving yourself with the reserved id me; populated only for callers with balance-read scope and null otherwise. A user with no wallet activity returns an empty series.

+ */ + _FinalStage balanceHistory(Optional balanceHistory); + + _FinalStage balanceHistory(UserBalanceHistory balanceHistory); + + _FinalStage balanceHistory(Nullable balanceHistory); + + /** + *

The user's profile banner wrapper. null when the user has no banner.

+ */ + _FinalStage banner(Optional banner); + + _FinalStage banner(UserBanner banner); + + _FinalStage banner(Nullable banner); + + /** + *

The user's biography

+ */ + _FinalStage bio(Optional bio); + + _FinalStage bio(String bio); + + _FinalStage bio(Nullable bio); + + /** + *

The user's gross USD income over time. Populated only on single-user self reads for callers with balance-read scope; null otherwise.

+ */ + _FinalStage earningsUsd(Optional earningsUsd); + + _FinalStage earningsUsd(UserEarnings earningsUsd); + + _FinalStage earningsUsd(Nullable earningsUsd); + + /** + *

The user's email address. Populated only on the self view (retrieved with the reserved id me) for callers with email-read scope; null otherwise, or while the account has no confirmed email yet.

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage email(Nullable email); + + /** + *

The user's display name

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + _FinalStage socialAccounts(List socialAccounts); + + _FinalStage addSocialAccounts(SocialAccount socialAccounts); + + _FinalStage addAllSocialAccounts(List socialAccounts); + + /** + *

Whop staff access flags. Populated only on the self view (retrieved with the reserved id me) for callers with staff-read scope; null there for every user who is not Whop staff, and always null elsewhere.

+ */ + _FinalStage staff(Optional staff); + + _FinalStage staff(UserStaffAccess staff); + + _FinalStage staff(Nullable staff); + + /** + *

Identity verification status for the user's individual (KYC) and business (KYB) profiles. Each is null until created, otherwise a status of not_started, pending, approved, or rejected.

+ */ + _FinalStage verification(Map verification); + + _FinalStage putAllVerification(Map verification); + + _FinalStage verification(String key, Object value); + + /** + *

When the user became an enrolled Whop Partner, as an ISO 8601 timestamp. null if never enrolled.

+ */ + _FinalStage whopPartnerEnabledAt(Optional whopPartnerEnabledAt); + + _FinalStage whopPartnerEnabledAt(String whopPartnerEnabledAt); + + _FinalStage whopPartnerEnabledAt(Nullable whopPartnerEnabledAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IdStage, ProfilePictureStage, UsernameStage, _FinalStage { + private String createdAt; + + private String id; + + private UserProfilePicture profilePicture; + + private String username; + + private Optional whopPartnerEnabledAt = Optional.empty(); + + private Map verification = new LinkedHashMap<>(); + + private Optional staff = Optional.empty(); + + private List socialAccounts = new ArrayList<>(); + + private Optional name = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional earningsUsd = Optional.empty(); + + private Optional bio = Optional.empty(); + + private Optional banner = Optional.empty(); + + private Optional balanceHistory = Optional.empty(); + + private Optional balance = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(User other) { + balance(other.getBalance()); + balanceHistory(other.getBalanceHistory()); + banner(other.getBanner()); + bio(other.getBio()); + createdAt(other.getCreatedAt()); + earningsUsd(other.getEarningsUsd()); + email(other.getEmail()); + id(other.getId()); + name(other.getName()); + profilePicture(other.getProfilePicture()); + socialAccounts(other.getSocialAccounts()); + staff(other.getStaff()); + username(other.getUsername()); + verification(other.getVerification()); + whopPartnerEnabledAt(other.getWhopPartnerEnabledAt()); + return this; + } + + /** + *

When the user was created, as an ISO 8601 timestamp

+ *

When the user was created, as an ISO 8601 timestamp

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

User ID, prefixed user_.

+ *

User ID, prefixed user_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ProfilePictureStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Avatar wrapper; its url is always present, using a generated placeholder when the user set no picture.

+ *

Avatar wrapper; its url is always present, using a generated placeholder when the user set no picture.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("profile_picture") + public UsernameStage profilePicture(@NotNull UserProfilePicture profilePicture) { + this.profilePicture = Objects.requireNonNull(profilePicture, "profilePicture must not be null"); + return this; + } + + /** + *

The user's unique username

+ *

The user's unique username

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

When the user became an enrolled Whop Partner, as an ISO 8601 timestamp. null if never enrolled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage whopPartnerEnabledAt(Nullable whopPartnerEnabledAt) { + if (whopPartnerEnabledAt.isNull()) { + this.whopPartnerEnabledAt = null; + } else if (whopPartnerEnabledAt.isEmpty()) { + this.whopPartnerEnabledAt = Optional.empty(); + } else { + this.whopPartnerEnabledAt = Optional.of(whopPartnerEnabledAt.get()); + } + return this; + } + + /** + *

When the user became an enrolled Whop Partner, as an ISO 8601 timestamp. null if never enrolled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage whopPartnerEnabledAt(String whopPartnerEnabledAt) { + this.whopPartnerEnabledAt = Optional.ofNullable(whopPartnerEnabledAt); + return this; + } + + /** + *

When the user became an enrolled Whop Partner, as an ISO 8601 timestamp. null if never enrolled.

+ */ + @java.lang.Override + @JsonSetter(value = "whop_partner_enabled_at", nulls = Nulls.SKIP) + public _FinalStage whopPartnerEnabledAt(Optional whopPartnerEnabledAt) { + this.whopPartnerEnabledAt = whopPartnerEnabledAt; + return this; + } + + /** + *

Identity verification status for the user's individual (KYC) and business (KYB) profiles. Each is null until created, otherwise a status of not_started, pending, approved, or rejected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage verification(String key, Object value) { + this.verification.put(key, value); + return this; + } + + /** + *

Identity verification status for the user's individual (KYC) and business (KYB) profiles. Each is null until created, otherwise a status of not_started, pending, approved, or rejected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllVerification(Map verification) { + if (verification != null) { + this.verification.putAll(verification); + } + return this; + } + + /** + *

Identity verification status for the user's individual (KYC) and business (KYB) profiles. Each is null until created, otherwise a status of not_started, pending, approved, or rejected.

+ */ + @java.lang.Override + @JsonSetter(value = "verification", nulls = Nulls.SKIP) + public _FinalStage verification(Map verification) { + this.verification.clear(); + if (verification != null) { + this.verification.putAll(verification); + } + return this; + } + + /** + *

Whop staff access flags. Populated only on the self view (retrieved with the reserved id me) for callers with staff-read scope; null there for every user who is not Whop staff, and always null elsewhere.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage staff(Nullable staff) { + if (staff.isNull()) { + this.staff = null; + } else if (staff.isEmpty()) { + this.staff = Optional.empty(); + } else { + this.staff = Optional.of(staff.get()); + } + return this; + } + + /** + *

Whop staff access flags. Populated only on the self view (retrieved with the reserved id me) for callers with staff-read scope; null there for every user who is not Whop staff, and always null elsewhere.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage staff(UserStaffAccess staff) { + this.staff = Optional.ofNullable(staff); + return this; + } + + /** + *

Whop staff access flags. Populated only on the self view (retrieved with the reserved id me) for callers with staff-read scope; null there for every user who is not Whop staff, and always null elsewhere.

+ */ + @java.lang.Override + @JsonSetter(value = "staff", nulls = Nulls.SKIP) + public _FinalStage staff(Optional staff) { + this.staff = staff; + return this; + } + + @java.lang.Override + public _FinalStage addAllSocialAccounts(List socialAccounts) { + if (socialAccounts != null) { + this.socialAccounts.addAll(socialAccounts); + } + return this; + } + + @java.lang.Override + public _FinalStage addSocialAccounts(SocialAccount socialAccounts) { + this.socialAccounts.add(socialAccounts); + return this; + } + + @java.lang.Override + @JsonSetter(value = "social_accounts", nulls = Nulls.SKIP) + public _FinalStage socialAccounts(List socialAccounts) { + this.socialAccounts.clear(); + if (socialAccounts != null) { + this.socialAccounts.addAll(socialAccounts); + } + return this; + } + + /** + *

The user's display name

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The user's display name

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The user's display name

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The user's email address. Populated only on the self view (retrieved with the reserved id me) for callers with email-read scope; null otherwise, or while the account has no confirmed email yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(Nullable email) { + if (email.isNull()) { + this.email = null; + } else if (email.isEmpty()) { + this.email = Optional.empty(); + } else { + this.email = Optional.of(email.get()); + } + return this; + } + + /** + *

The user's email address. Populated only on the self view (retrieved with the reserved id me) for callers with email-read scope; null otherwise, or while the account has no confirmed email yet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The user's email address. Populated only on the self view (retrieved with the reserved id me) for callers with email-read scope; null otherwise, or while the account has no confirmed email yet.

+ */ + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + /** + *

The user's gross USD income over time. Populated only on single-user self reads for callers with balance-read scope; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage earningsUsd(Nullable earningsUsd) { + if (earningsUsd.isNull()) { + this.earningsUsd = null; + } else if (earningsUsd.isEmpty()) { + this.earningsUsd = Optional.empty(); + } else { + this.earningsUsd = Optional.of(earningsUsd.get()); + } + return this; + } + + /** + *

The user's gross USD income over time. Populated only on single-user self reads for callers with balance-read scope; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage earningsUsd(UserEarnings earningsUsd) { + this.earningsUsd = Optional.ofNullable(earningsUsd); + return this; + } + + /** + *

The user's gross USD income over time. Populated only on single-user self reads for callers with balance-read scope; null otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "earnings_usd", nulls = Nulls.SKIP) + public _FinalStage earningsUsd(Optional earningsUsd) { + this.earningsUsd = earningsUsd; + return this; + } + + /** + *

The user's biography

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bio(Nullable bio) { + if (bio.isNull()) { + this.bio = null; + } else if (bio.isEmpty()) { + this.bio = Optional.empty(); + } else { + this.bio = Optional.of(bio.get()); + } + return this; + } + + /** + *

The user's biography

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bio(String bio) { + this.bio = Optional.ofNullable(bio); + return this; + } + + /** + *

The user's biography

+ */ + @java.lang.Override + @JsonSetter(value = "bio", nulls = Nulls.SKIP) + public _FinalStage bio(Optional bio) { + this.bio = bio; + return this; + } + + /** + *

The user's profile banner wrapper. null when the user has no banner.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage banner(Nullable banner) { + if (banner.isNull()) { + this.banner = null; + } else if (banner.isEmpty()) { + this.banner = Optional.empty(); + } else { + this.banner = Optional.of(banner.get()); + } + return this; + } + + /** + *

The user's profile banner wrapper. null when the user has no banner.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage banner(UserBanner banner) { + this.banner = Optional.ofNullable(banner); + return this; + } + + /** + *

The user's profile banner wrapper. null when the user has no banner.

+ */ + @java.lang.Override + @JsonSetter(value = "banner", nulls = Nulls.SKIP) + public _FinalStage banner(Optional banner) { + this.banner = banner; + return this; + } + + /** + *

The user's cumulative wallet balance over time (USD { t, v } points plus last/min/max), for the balance chart. Opt in with include_balance_history=true when retrieving yourself with the reserved id me; populated only for callers with balance-read scope and null otherwise. A user with no wallet activity returns an empty series.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage balanceHistory(Nullable balanceHistory) { + if (balanceHistory.isNull()) { + this.balanceHistory = null; + } else if (balanceHistory.isEmpty()) { + this.balanceHistory = Optional.empty(); + } else { + this.balanceHistory = Optional.of(balanceHistory.get()); + } + return this; + } + + /** + *

The user's cumulative wallet balance over time (USD { t, v } points plus last/min/max), for the balance chart. Opt in with include_balance_history=true when retrieving yourself with the reserved id me; populated only for callers with balance-read scope and null otherwise. A user with no wallet activity returns an empty series.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage balanceHistory(UserBalanceHistory balanceHistory) { + this.balanceHistory = Optional.ofNullable(balanceHistory); + return this; + } + + /** + *

The user's cumulative wallet balance over time (USD { t, v } points plus last/min/max), for the balance chart. Opt in with include_balance_history=true when retrieving yourself with the reserved id me; populated only for callers with balance-read scope and null otherwise. A user with no wallet activity returns an empty series.

+ */ + @java.lang.Override + @JsonSetter(value = "balance_history", nulls = Nulls.SKIP) + public _FinalStage balanceHistory(Optional balanceHistory) { + this.balanceHistory = balanceHistory; + return this; + } + + /** + *

The user's balance: personal cash + crypto + in-flight treasury deposits, plus account balances for accounts they own. Computed only on the self view (retrieved with the reserved id me) for callers with balance-read scope; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage balance(Nullable balance) { + if (balance.isNull()) { + this.balance = null; + } else if (balance.isEmpty()) { + this.balance = Optional.empty(); + } else { + this.balance = Optional.of(balance.get()); + } + return this; + } + + /** + *

The user's balance: personal cash + crypto + in-flight treasury deposits, plus account balances for accounts they own. Computed only on the self view (retrieved with the reserved id me) for callers with balance-read scope; null otherwise.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage balance(UserBalance balance) { + this.balance = Optional.ofNullable(balance); + return this; + } + + /** + *

The user's balance: personal cash + crypto + in-flight treasury deposits, plus account balances for accounts they own. Computed only on the self view (retrieved with the reserved id me) for callers with balance-read scope; null otherwise.

+ */ + @java.lang.Override + @JsonSetter(value = "balance", nulls = Nulls.SKIP) + public _FinalStage balance(Optional balance) { + this.balance = balance; + return this; + } + + @java.lang.Override + public User build() { + return new User( + balance, + balanceHistory, + banner, + bio, + createdAt, + earningsUsd, + email, + id, + name, + profilePicture, + socialAccounts, + staff, + username, + verification, + whopPartnerEnabledAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UserBalance.java b/src/main/java/com/whop/api/types/UserBalance.java new file mode 100644 index 00000000..fd39ef92 --- /dev/null +++ b/src/main/java/com/whop/api/types/UserBalance.java @@ -0,0 +1,464 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserBalance.Builder.class) +public final class UserBalance { + private final List businesses; + + private final String businessesTotalUsd; + + private final List cash; + + private final String cashUsd; + + private final List crypto; + + private final String cryptoUsd; + + private final String pendingUsd; + + private final String totalUsd; + + private final String treasuryPendingUsd; + + private final Map additionalProperties; + + private UserBalance( + List businesses, + String businessesTotalUsd, + List cash, + String cashUsd, + List crypto, + String cryptoUsd, + String pendingUsd, + String totalUsd, + String treasuryPendingUsd, + Map additionalProperties) { + this.businesses = businesses; + this.businessesTotalUsd = businessesTotalUsd; + this.cash = cash; + this.cashUsd = cashUsd; + this.crypto = crypto; + this.cryptoUsd = cryptoUsd; + this.pendingUsd = pendingUsd; + this.totalUsd = totalUsd; + this.treasuryPendingUsd = treasuryPendingUsd; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("businesses") + public List getBusinesses() { + return businesses; + } + + /** + * @return Combined USD balance across every account the user owns. + */ + @JsonProperty("businesses_total_usd") + public String getBusinessesTotalUsd() { + return businessesTotalUsd; + } + + @JsonProperty("cash") + public List getCash() { + return cash; + } + + /** + * @return Fiat cash in USD, including pending, in-transit, and reserve. + */ + @JsonProperty("cash_usd") + public String getCashUsd() { + return cashUsd; + } + + @JsonProperty("crypto") + public List getCrypto() { + return crypto; + } + + /** + * @return Crypto holdings in USD. + */ + @JsonProperty("crypto_usd") + public String getCryptoUsd() { + return cryptoUsd; + } + + /** + * @return Fiat pending and in-transit balances, plus in-flight treasury deposits, in USD. + */ + @JsonProperty("pending_usd") + public String getPendingUsd() { + return pendingUsd; + } + + /** + * @return The user's personal balance in USD: cash (available + pending + in-transit + reserve) + crypto + in-flight treasury deposits. Excludes account balances (see businesses_total_usd). + */ + @JsonProperty("total_usd") + public String getTotalUsd() { + return totalUsd; + } + + /** + * @return Balance-to-wallet USDT0 withdrawals still in flight, in USD. + */ + @JsonProperty("treasury_pending_usd") + public String getTreasuryPendingUsd() { + return treasuryPendingUsd; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserBalance && equalTo((UserBalance) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserBalance other) { + return businesses.equals(other.businesses) + && businessesTotalUsd.equals(other.businessesTotalUsd) + && cash.equals(other.cash) + && cashUsd.equals(other.cashUsd) + && crypto.equals(other.crypto) + && cryptoUsd.equals(other.cryptoUsd) + && pendingUsd.equals(other.pendingUsd) + && totalUsd.equals(other.totalUsd) + && treasuryPendingUsd.equals(other.treasuryPendingUsd); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.businesses, + this.businessesTotalUsd, + this.cash, + this.cashUsd, + this.crypto, + this.cryptoUsd, + this.pendingUsd, + this.totalUsd, + this.treasuryPendingUsd); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BusinessesTotalUsdStage builder() { + return new Builder(); + } + + public interface BusinessesTotalUsdStage { + /** + *

Combined USD balance across every account the user owns.

+ */ + CashUsdStage businessesTotalUsd(@NotNull String businessesTotalUsd); + + Builder from(UserBalance other); + } + + public interface CashUsdStage { + /** + *

Fiat cash in USD, including pending, in-transit, and reserve.

+ */ + CryptoUsdStage cashUsd(@NotNull String cashUsd); + } + + public interface CryptoUsdStage { + /** + *

Crypto holdings in USD.

+ */ + PendingUsdStage cryptoUsd(@NotNull String cryptoUsd); + } + + public interface PendingUsdStage { + /** + *

Fiat pending and in-transit balances, plus in-flight treasury deposits, in USD.

+ */ + TotalUsdStage pendingUsd(@NotNull String pendingUsd); + } + + public interface TotalUsdStage { + /** + *

The user's personal balance in USD: cash (available + pending + in-transit + reserve) + crypto + in-flight treasury deposits. Excludes account balances (see businesses_total_usd).

+ */ + TreasuryPendingUsdStage totalUsd(@NotNull String totalUsd); + } + + public interface TreasuryPendingUsdStage { + /** + *

Balance-to-wallet USDT0 withdrawals still in flight, in USD.

+ */ + _FinalStage treasuryPendingUsd(@NotNull String treasuryPendingUsd); + } + + public interface _FinalStage { + UserBalance build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage businesses(List businesses); + + _FinalStage addBusinesses(UserBalanceBusiness businesses); + + _FinalStage addAllBusinesses(List businesses); + + _FinalStage cash(List cash); + + _FinalStage addCash(UserBalanceCash cash); + + _FinalStage addAllCash(List cash); + + _FinalStage crypto(List crypto); + + _FinalStage addCrypto(UserBalanceToken crypto); + + _FinalStage addAllCrypto(List crypto); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BusinessesTotalUsdStage, + CashUsdStage, + CryptoUsdStage, + PendingUsdStage, + TotalUsdStage, + TreasuryPendingUsdStage, + _FinalStage { + private String businessesTotalUsd; + + private String cashUsd; + + private String cryptoUsd; + + private String pendingUsd; + + private String totalUsd; + + private String treasuryPendingUsd; + + private List crypto = new ArrayList<>(); + + private List cash = new ArrayList<>(); + + private List businesses = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserBalance other) { + businesses(other.getBusinesses()); + businessesTotalUsd(other.getBusinessesTotalUsd()); + cash(other.getCash()); + cashUsd(other.getCashUsd()); + crypto(other.getCrypto()); + cryptoUsd(other.getCryptoUsd()); + pendingUsd(other.getPendingUsd()); + totalUsd(other.getTotalUsd()); + treasuryPendingUsd(other.getTreasuryPendingUsd()); + return this; + } + + /** + *

Combined USD balance across every account the user owns.

+ *

Combined USD balance across every account the user owns.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("businesses_total_usd") + public CashUsdStage businessesTotalUsd(@NotNull String businessesTotalUsd) { + this.businessesTotalUsd = Objects.requireNonNull(businessesTotalUsd, "businessesTotalUsd must not be null"); + return this; + } + + /** + *

Fiat cash in USD, including pending, in-transit, and reserve.

+ *

Fiat cash in USD, including pending, in-transit, and reserve.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cash_usd") + public CryptoUsdStage cashUsd(@NotNull String cashUsd) { + this.cashUsd = Objects.requireNonNull(cashUsd, "cashUsd must not be null"); + return this; + } + + /** + *

Crypto holdings in USD.

+ *

Crypto holdings in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("crypto_usd") + public PendingUsdStage cryptoUsd(@NotNull String cryptoUsd) { + this.cryptoUsd = Objects.requireNonNull(cryptoUsd, "cryptoUsd must not be null"); + return this; + } + + /** + *

Fiat pending and in-transit balances, plus in-flight treasury deposits, in USD.

+ *

Fiat pending and in-transit balances, plus in-flight treasury deposits, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("pending_usd") + public TotalUsdStage pendingUsd(@NotNull String pendingUsd) { + this.pendingUsd = Objects.requireNonNull(pendingUsd, "pendingUsd must not be null"); + return this; + } + + /** + *

The user's personal balance in USD: cash (available + pending + in-transit + reserve) + crypto + in-flight treasury deposits. Excludes account balances (see businesses_total_usd).

+ *

The user's personal balance in USD: cash (available + pending + in-transit + reserve) + crypto + in-flight treasury deposits. Excludes account balances (see businesses_total_usd).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_usd") + public TreasuryPendingUsdStage totalUsd(@NotNull String totalUsd) { + this.totalUsd = Objects.requireNonNull(totalUsd, "totalUsd must not be null"); + return this; + } + + /** + *

Balance-to-wallet USDT0 withdrawals still in flight, in USD.

+ *

Balance-to-wallet USDT0 withdrawals still in flight, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("treasury_pending_usd") + public _FinalStage treasuryPendingUsd(@NotNull String treasuryPendingUsd) { + this.treasuryPendingUsd = Objects.requireNonNull(treasuryPendingUsd, "treasuryPendingUsd must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllCrypto(List crypto) { + if (crypto != null) { + this.crypto.addAll(crypto); + } + return this; + } + + @java.lang.Override + public _FinalStage addCrypto(UserBalanceToken crypto) { + this.crypto.add(crypto); + return this; + } + + @java.lang.Override + @JsonSetter(value = "crypto", nulls = Nulls.SKIP) + public _FinalStage crypto(List crypto) { + this.crypto.clear(); + if (crypto != null) { + this.crypto.addAll(crypto); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllCash(List cash) { + if (cash != null) { + this.cash.addAll(cash); + } + return this; + } + + @java.lang.Override + public _FinalStage addCash(UserBalanceCash cash) { + this.cash.add(cash); + return this; + } + + @java.lang.Override + @JsonSetter(value = "cash", nulls = Nulls.SKIP) + public _FinalStage cash(List cash) { + this.cash.clear(); + if (cash != null) { + this.cash.addAll(cash); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllBusinesses(List businesses) { + if (businesses != null) { + this.businesses.addAll(businesses); + } + return this; + } + + @java.lang.Override + public _FinalStage addBusinesses(UserBalanceBusiness businesses) { + this.businesses.add(businesses); + return this; + } + + @java.lang.Override + @JsonSetter(value = "businesses", nulls = Nulls.SKIP) + public _FinalStage businesses(List businesses) { + this.businesses.clear(); + if (businesses != null) { + this.businesses.addAll(businesses); + } + return this; + } + + @java.lang.Override + public UserBalance build() { + return new UserBalance( + businesses, + businessesTotalUsd, + cash, + cashUsd, + crypto, + cryptoUsd, + pendingUsd, + totalUsd, + treasuryPendingUsd, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UserBalanceBusiness.java b/src/main/java/com/whop/api/types/UserBalanceBusiness.java new file mode 100644 index 00000000..c68112f3 --- /dev/null +++ b/src/main/java/com/whop/api/types/UserBalanceBusiness.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserBalanceBusiness.Builder.class) +public final class UserBalanceBusiness { + private final String balanceUsd; + + private final String id; + + private final Optional logoUrl; + + private final Optional name; + + private final Map additionalProperties; + + private UserBalanceBusiness( + String balanceUsd, + String id, + Optional logoUrl, + Optional name, + Map additionalProperties) { + this.balanceUsd = balanceUsd; + this.id = id; + this.logoUrl = logoUrl; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account's total balance in USD. + */ + @JsonProperty("balance_usd") + public String getBalanceUsd() { + return balanceUsd; + } + + /** + * @return The account ID, which looks like biz_*************. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The account's logo URL. + */ + @JsonIgnore + public Optional getLogoUrl() { + if (logoUrl == null) { + return Optional.empty(); + } + return logoUrl; + } + + /** + * @return The account's display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("logo_url") + private Optional _getLogoUrl() { + return logoUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserBalanceBusiness && equalTo((UserBalanceBusiness) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserBalanceBusiness other) { + return balanceUsd.equals(other.balanceUsd) + && id.equals(other.id) + && logoUrl.equals(other.logoUrl) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.balanceUsd, this.id, this.logoUrl, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BalanceUsdStage builder() { + return new Builder(); + } + + public interface BalanceUsdStage { + /** + *

The account's total balance in USD.

+ */ + IdStage balanceUsd(@NotNull String balanceUsd); + + Builder from(UserBalanceBusiness other); + } + + public interface IdStage { + /** + *

The account ID, which looks like biz_*************.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + UserBalanceBusiness build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account's logo URL.

+ */ + _FinalStage logoUrl(Optional logoUrl); + + _FinalStage logoUrl(String logoUrl); + + _FinalStage logoUrl(Nullable logoUrl); + + /** + *

The account's display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BalanceUsdStage, IdStage, _FinalStage { + private String balanceUsd; + + private String id; + + private Optional name = Optional.empty(); + + private Optional logoUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserBalanceBusiness other) { + balanceUsd(other.getBalanceUsd()); + id(other.getId()); + logoUrl(other.getLogoUrl()); + name(other.getName()); + return this; + } + + /** + *

The account's total balance in USD.

+ *

The account's total balance in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("balance_usd") + public IdStage balanceUsd(@NotNull String balanceUsd) { + this.balanceUsd = Objects.requireNonNull(balanceUsd, "balanceUsd must not be null"); + return this; + } + + /** + *

The account ID, which looks like biz_*************.

+ *

The account ID, which looks like biz_*************.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The account's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The account's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The account's display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The account's logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(Nullable logoUrl) { + if (logoUrl.isNull()) { + this.logoUrl = null; + } else if (logoUrl.isEmpty()) { + this.logoUrl = Optional.empty(); + } else { + this.logoUrl = Optional.of(logoUrl.get()); + } + return this; + } + + /** + *

The account's logo URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage logoUrl(String logoUrl) { + this.logoUrl = Optional.ofNullable(logoUrl); + return this; + } + + /** + *

The account's logo URL.

+ */ + @java.lang.Override + @JsonSetter(value = "logo_url", nulls = Nulls.SKIP) + public _FinalStage logoUrl(Optional logoUrl) { + this.logoUrl = logoUrl; + return this; + } + + @java.lang.Override + public UserBalanceBusiness build() { + return new UserBalanceBusiness(balanceUsd, id, logoUrl, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UserBalanceCash.java b/src/main/java/com/whop/api/types/UserBalanceCash.java new file mode 100644 index 00000000..fea03b20 --- /dev/null +++ b/src/main/java/com/whop/api/types/UserBalanceCash.java @@ -0,0 +1,441 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserBalanceCash.Builder.class) +public final class UserBalanceCash { + private final double balance; + + private final double balanceUsd; + + private final String currency; + + private final double inTransitBalanceUsd; + + private final double pendingBalanceUsd; + + private final Optional priceUsd; + + private final double reserveBalanceUsd; + + private final double totalWithdrawableBalance; + + private final Map additionalProperties; + + private UserBalanceCash( + double balance, + double balanceUsd, + String currency, + double inTransitBalanceUsd, + double pendingBalanceUsd, + Optional priceUsd, + double reserveBalanceUsd, + double totalWithdrawableBalance, + Map additionalProperties) { + this.balance = balance; + this.balanceUsd = balanceUsd; + this.currency = currency; + this.inTransitBalanceUsd = inTransitBalanceUsd; + this.pendingBalanceUsd = pendingBalanceUsd; + this.priceUsd = priceUsd; + this.reserveBalanceUsd = reserveBalanceUsd; + this.totalWithdrawableBalance = totalWithdrawableBalance; + this.additionalProperties = additionalProperties; + } + + /** + * @return Available balance in the native currency. + */ + @JsonProperty("balance") + public double getBalance() { + return balance; + } + + /** + * @return Available balance converted to USD. + */ + @JsonProperty("balance_usd") + public double getBalanceUsd() { + return balanceUsd; + } + + /** + * @return Lowercase ISO currency code, such as usd or eur. + */ + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + /** + * @return Balance moving to the user's own wallet or card, converted to USD. + */ + @JsonProperty("in_transit_balance_usd") + public double getInTransitBalanceUsd() { + return inTransitBalanceUsd; + } + + /** + * @return Pending balance converted to USD. + */ + @JsonProperty("pending_balance_usd") + public double getPendingBalanceUsd() { + return pendingBalanceUsd; + } + + /** + * @return USD price per native currency unit, or null when no exchange rate is available. + */ + @JsonIgnore + public Optional getPriceUsd() { + if (priceUsd == null) { + return Optional.empty(); + } + return priceUsd; + } + + /** + * @return Reserved balance converted to USD. + */ + @JsonProperty("reserve_balance_usd") + public double getReserveBalanceUsd() { + return reserveBalanceUsd; + } + + /** + * @return Withdrawable amount in the native currency. + */ + @JsonProperty("total_withdrawable_balance") + public double getTotalWithdrawableBalance() { + return totalWithdrawableBalance; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("price_usd") + private Optional _getPriceUsd() { + return priceUsd; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserBalanceCash && equalTo((UserBalanceCash) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserBalanceCash other) { + return balance == other.balance + && balanceUsd == other.balanceUsd + && currency.equals(other.currency) + && inTransitBalanceUsd == other.inTransitBalanceUsd + && pendingBalanceUsd == other.pendingBalanceUsd + && priceUsd.equals(other.priceUsd) + && reserveBalanceUsd == other.reserveBalanceUsd + && totalWithdrawableBalance == other.totalWithdrawableBalance; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.balance, + this.balanceUsd, + this.currency, + this.inTransitBalanceUsd, + this.pendingBalanceUsd, + this.priceUsd, + this.reserveBalanceUsd, + this.totalWithdrawableBalance); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BalanceStage builder() { + return new Builder(); + } + + public interface BalanceStage { + /** + *

Available balance in the native currency.

+ */ + BalanceUsdStage balance(double balance); + + Builder from(UserBalanceCash other); + } + + public interface BalanceUsdStage { + /** + *

Available balance converted to USD.

+ */ + CurrencyStage balanceUsd(double balanceUsd); + } + + public interface CurrencyStage { + /** + *

Lowercase ISO currency code, such as usd or eur.

+ */ + InTransitBalanceUsdStage currency(@NotNull String currency); + } + + public interface InTransitBalanceUsdStage { + /** + *

Balance moving to the user's own wallet or card, converted to USD.

+ */ + PendingBalanceUsdStage inTransitBalanceUsd(double inTransitBalanceUsd); + } + + public interface PendingBalanceUsdStage { + /** + *

Pending balance converted to USD.

+ */ + ReserveBalanceUsdStage pendingBalanceUsd(double pendingBalanceUsd); + } + + public interface ReserveBalanceUsdStage { + /** + *

Reserved balance converted to USD.

+ */ + TotalWithdrawableBalanceStage reserveBalanceUsd(double reserveBalanceUsd); + } + + public interface TotalWithdrawableBalanceStage { + /** + *

Withdrawable amount in the native currency.

+ */ + _FinalStage totalWithdrawableBalance(double totalWithdrawableBalance); + } + + public interface _FinalStage { + UserBalanceCash build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

USD price per native currency unit, or null when no exchange rate is available.

+ */ + _FinalStage priceUsd(Optional priceUsd); + + _FinalStage priceUsd(Double priceUsd); + + _FinalStage priceUsd(Nullable priceUsd); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BalanceStage, + BalanceUsdStage, + CurrencyStage, + InTransitBalanceUsdStage, + PendingBalanceUsdStage, + ReserveBalanceUsdStage, + TotalWithdrawableBalanceStage, + _FinalStage { + private double balance; + + private double balanceUsd; + + private String currency; + + private double inTransitBalanceUsd; + + private double pendingBalanceUsd; + + private double reserveBalanceUsd; + + private double totalWithdrawableBalance; + + private Optional priceUsd = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserBalanceCash other) { + balance(other.getBalance()); + balanceUsd(other.getBalanceUsd()); + currency(other.getCurrency()); + inTransitBalanceUsd(other.getInTransitBalanceUsd()); + pendingBalanceUsd(other.getPendingBalanceUsd()); + priceUsd(other.getPriceUsd()); + reserveBalanceUsd(other.getReserveBalanceUsd()); + totalWithdrawableBalance(other.getTotalWithdrawableBalance()); + return this; + } + + /** + *

Available balance in the native currency.

+ *

Available balance in the native currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("balance") + public BalanceUsdStage balance(double balance) { + this.balance = balance; + return this; + } + + /** + *

Available balance converted to USD.

+ *

Available balance converted to USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("balance_usd") + public CurrencyStage balanceUsd(double balanceUsd) { + this.balanceUsd = balanceUsd; + return this; + } + + /** + *

Lowercase ISO currency code, such as usd or eur.

+ *

Lowercase ISO currency code, such as usd or eur.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public InTransitBalanceUsdStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

Balance moving to the user's own wallet or card, converted to USD.

+ *

Balance moving to the user's own wallet or card, converted to USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("in_transit_balance_usd") + public PendingBalanceUsdStage inTransitBalanceUsd(double inTransitBalanceUsd) { + this.inTransitBalanceUsd = inTransitBalanceUsd; + return this; + } + + /** + *

Pending balance converted to USD.

+ *

Pending balance converted to USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("pending_balance_usd") + public ReserveBalanceUsdStage pendingBalanceUsd(double pendingBalanceUsd) { + this.pendingBalanceUsd = pendingBalanceUsd; + return this; + } + + /** + *

Reserved balance converted to USD.

+ *

Reserved balance converted to USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("reserve_balance_usd") + public TotalWithdrawableBalanceStage reserveBalanceUsd(double reserveBalanceUsd) { + this.reserveBalanceUsd = reserveBalanceUsd; + return this; + } + + /** + *

Withdrawable amount in the native currency.

+ *

Withdrawable amount in the native currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_withdrawable_balance") + public _FinalStage totalWithdrawableBalance(double totalWithdrawableBalance) { + this.totalWithdrawableBalance = totalWithdrawableBalance; + return this; + } + + /** + *

USD price per native currency unit, or null when no exchange rate is available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage priceUsd(Nullable priceUsd) { + if (priceUsd.isNull()) { + this.priceUsd = null; + } else if (priceUsd.isEmpty()) { + this.priceUsd = Optional.empty(); + } else { + this.priceUsd = Optional.of(priceUsd.get()); + } + return this; + } + + /** + *

USD price per native currency unit, or null when no exchange rate is available.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage priceUsd(Double priceUsd) { + this.priceUsd = Optional.ofNullable(priceUsd); + return this; + } + + /** + *

USD price per native currency unit, or null when no exchange rate is available.

+ */ + @java.lang.Override + @JsonSetter(value = "price_usd", nulls = Nulls.SKIP) + public _FinalStage priceUsd(Optional priceUsd) { + this.priceUsd = priceUsd; + return this; + } + + @java.lang.Override + public UserBalanceCash build() { + return new UserBalanceCash( + balance, + balanceUsd, + currency, + inTransitBalanceUsd, + pendingBalanceUsd, + priceUsd, + reserveBalanceUsd, + totalWithdrawableBalance, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UserBalanceHistory.java b/src/main/java/com/whop/api/types/UserBalanceHistory.java new file mode 100644 index 00000000..b34a58ba --- /dev/null +++ b/src/main/java/com/whop/api/types/UserBalanceHistory.java @@ -0,0 +1,243 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserBalanceHistory.Builder.class) +public final class UserBalanceHistory { + private final List data; + + private final double last; + + private final double max; + + private final double min; + + private final Map additionalProperties; + + private UserBalanceHistory( + List data, + double last, + double max, + double min, + Map additionalProperties) { + this.data = data; + this.last = last; + this.max = max; + this.min = min; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Value of the most recent point, in USD. + */ + @JsonProperty("last") + public double getLast() { + return last; + } + + /** + * @return Maximum value across the window, in USD. + */ + @JsonProperty("max") + public double getMax() { + return max; + } + + /** + * @return Minimum value across the window, in USD. + */ + @JsonProperty("min") + public double getMin() { + return min; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserBalanceHistory && equalTo((UserBalanceHistory) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserBalanceHistory other) { + return data.equals(other.data) && last == other.last && max == other.max && min == other.min; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.last, this.max, this.min); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LastStage builder() { + return new Builder(); + } + + public interface LastStage { + /** + *

Value of the most recent point, in USD.

+ */ + MaxStage last(double last); + + Builder from(UserBalanceHistory other); + } + + public interface MaxStage { + /** + *

Maximum value across the window, in USD.

+ */ + MinStage max(double max); + } + + public interface MinStage { + /** + *

Minimum value across the window, in USD.

+ */ + _FinalStage min(double min); + } + + public interface _FinalStage { + UserBalanceHistory build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(UserBalanceHistoryPoint data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LastStage, MaxStage, MinStage, _FinalStage { + private double last; + + private double max; + + private double min; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserBalanceHistory other) { + data(other.getData()); + last(other.getLast()); + max(other.getMax()); + min(other.getMin()); + return this; + } + + /** + *

Value of the most recent point, in USD.

+ *

Value of the most recent point, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("last") + public MaxStage last(double last) { + this.last = last; + return this; + } + + /** + *

Maximum value across the window, in USD.

+ *

Maximum value across the window, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("max") + public MinStage max(double max) { + this.max = max; + return this; + } + + /** + *

Minimum value across the window, in USD.

+ *

Minimum value across the window, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("min") + public _FinalStage min(double min) { + this.min = min; + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(UserBalanceHistoryPoint data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public UserBalanceHistory build() { + return new UserBalanceHistory(data, last, max, min, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UserBalanceHistoryPoint.java b/src/main/java/com/whop/api/types/UserBalanceHistoryPoint.java new file mode 100644 index 00000000..2135bded --- /dev/null +++ b/src/main/java/com/whop/api/types/UserBalanceHistoryPoint.java @@ -0,0 +1,161 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserBalanceHistoryPoint.Builder.class) +public final class UserBalanceHistoryPoint { + private final int t; + + private final double v; + + private final Map additionalProperties; + + private UserBalanceHistoryPoint(int t, double v, Map additionalProperties) { + this.t = t; + this.v = v; + this.additionalProperties = additionalProperties; + } + + /** + * @return Point timestamp, in Unix seconds. + */ + @JsonProperty("t") + public int getT() { + return t; + } + + /** + * @return Cumulative wallet balance at this point, in USD. + */ + @JsonProperty("v") + public double getV() { + return v; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserBalanceHistoryPoint && equalTo((UserBalanceHistoryPoint) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserBalanceHistoryPoint other) { + return t == other.t && v == other.v; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.t, this.v); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TStage builder() { + return new Builder(); + } + + public interface TStage { + /** + *

Point timestamp, in Unix seconds.

+ */ + VStage t(int t); + + Builder from(UserBalanceHistoryPoint other); + } + + public interface VStage { + /** + *

Cumulative wallet balance at this point, in USD.

+ */ + _FinalStage v(double v); + } + + public interface _FinalStage { + UserBalanceHistoryPoint build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TStage, VStage, _FinalStage { + private int t; + + private double v; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserBalanceHistoryPoint other) { + t(other.getT()); + v(other.getV()); + return this; + } + + /** + *

Point timestamp, in Unix seconds.

+ *

Point timestamp, in Unix seconds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("t") + public VStage t(int t) { + this.t = t; + return this; + } + + /** + *

Cumulative wallet balance at this point, in USD.

+ *

Cumulative wallet balance at this point, in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("v") + public _FinalStage v(double v) { + this.v = v; + return this; + } + + @java.lang.Override + public UserBalanceHistoryPoint build() { + return new UserBalanceHistoryPoint(t, v, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UserBalanceToken.java b/src/main/java/com/whop/api/types/UserBalanceToken.java new file mode 100644 index 00000000..4c893092 --- /dev/null +++ b/src/main/java/com/whop/api/types/UserBalanceToken.java @@ -0,0 +1,453 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserBalanceToken.Builder.class) +public final class UserBalanceToken { + private final String balance; + + private final AccountBalanceBreakdown breakdown; + + private final Optional iconUrl; + + private final Optional name; + + private final Optional priceUsd; + + private final String symbol; + + private final double valueUsd; + + private final Map additionalProperties; + + private UserBalanceToken( + String balance, + AccountBalanceBreakdown breakdown, + Optional iconUrl, + Optional name, + Optional priceUsd, + String symbol, + double valueUsd, + Map additionalProperties) { + this.balance = balance; + this.breakdown = breakdown; + this.iconUrl = iconUrl; + this.name = name; + this.priceUsd = priceUsd; + this.symbol = symbol; + this.valueUsd = valueUsd; + this.additionalProperties = additionalProperties; + } + + /** + * @return Amount held in native token units, as a decimal string. + */ + @JsonProperty("balance") + public String getBalance() { + return balance; + } + + /** + * @return Balance split into available, pending, in-transit, and reserve amounts, as native-unit decimal strings. Transfers between the user's own wallet and card are reported in in_transit until they arrive. + */ + @JsonProperty("breakdown") + public AccountBalanceBreakdown getBreakdown() { + return breakdown; + } + + /** + * @return Token icon URL. + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return The token's display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return USD price per token, or null when unknown. + */ + @JsonIgnore + public Optional getPriceUsd() { + if (priceUsd == null) { + return Optional.empty(); + } + return priceUsd; + } + + /** + * @return Token display symbol, such as USDT, XAUT, or cbBTC. + */ + @JsonProperty("symbol") + public String getSymbol() { + return symbol; + } + + /** + * @return Holding USD value. + */ + @JsonProperty("value_usd") + public double getValueUsd() { + return valueUsd; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("price_usd") + private Optional _getPriceUsd() { + return priceUsd; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserBalanceToken && equalTo((UserBalanceToken) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserBalanceToken other) { + return balance.equals(other.balance) + && breakdown.equals(other.breakdown) + && iconUrl.equals(other.iconUrl) + && name.equals(other.name) + && priceUsd.equals(other.priceUsd) + && symbol.equals(other.symbol) + && valueUsd == other.valueUsd; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.balance, this.breakdown, this.iconUrl, this.name, this.priceUsd, this.symbol, this.valueUsd); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BalanceStage builder() { + return new Builder(); + } + + public interface BalanceStage { + /** + *

Amount held in native token units, as a decimal string.

+ */ + BreakdownStage balance(@NotNull String balance); + + Builder from(UserBalanceToken other); + } + + public interface BreakdownStage { + /** + *

Balance split into available, pending, in-transit, and reserve amounts, as native-unit decimal strings. Transfers between the user's own wallet and card are reported in in_transit until they arrive.

+ */ + SymbolStage breakdown(@NotNull AccountBalanceBreakdown breakdown); + } + + public interface SymbolStage { + /** + *

Token display symbol, such as USDT, XAUT, or cbBTC.

+ */ + ValueUsdStage symbol(@NotNull String symbol); + } + + public interface ValueUsdStage { + /** + *

Holding USD value.

+ */ + _FinalStage valueUsd(double valueUsd); + } + + public interface _FinalStage { + UserBalanceToken build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Token icon URL.

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

The token's display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + + /** + *

USD price per token, or null when unknown.

+ */ + _FinalStage priceUsd(Optional priceUsd); + + _FinalStage priceUsd(Double priceUsd); + + _FinalStage priceUsd(Nullable priceUsd); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BalanceStage, BreakdownStage, SymbolStage, ValueUsdStage, _FinalStage { + private String balance; + + private AccountBalanceBreakdown breakdown; + + private String symbol; + + private double valueUsd; + + private Optional priceUsd = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserBalanceToken other) { + balance(other.getBalance()); + breakdown(other.getBreakdown()); + iconUrl(other.getIconUrl()); + name(other.getName()); + priceUsd(other.getPriceUsd()); + symbol(other.getSymbol()); + valueUsd(other.getValueUsd()); + return this; + } + + /** + *

Amount held in native token units, as a decimal string.

+ *

Amount held in native token units, as a decimal string.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("balance") + public BreakdownStage balance(@NotNull String balance) { + this.balance = Objects.requireNonNull(balance, "balance must not be null"); + return this; + } + + /** + *

Balance split into available, pending, in-transit, and reserve amounts, as native-unit decimal strings. Transfers between the user's own wallet and card are reported in in_transit until they arrive.

+ *

Balance split into available, pending, in-transit, and reserve amounts, as native-unit decimal strings. Transfers between the user's own wallet and card are reported in in_transit until they arrive.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("breakdown") + public SymbolStage breakdown(@NotNull AccountBalanceBreakdown breakdown) { + this.breakdown = Objects.requireNonNull(breakdown, "breakdown must not be null"); + return this; + } + + /** + *

Token display symbol, such as USDT, XAUT, or cbBTC.

+ *

Token display symbol, such as USDT, XAUT, or cbBTC.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("symbol") + public ValueUsdStage symbol(@NotNull String symbol) { + this.symbol = Objects.requireNonNull(symbol, "symbol must not be null"); + return this; + } + + /** + *

Holding USD value.

+ *

Holding USD value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("value_usd") + public _FinalStage valueUsd(double valueUsd) { + this.valueUsd = valueUsd; + return this; + } + + /** + *

USD price per token, or null when unknown.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage priceUsd(Nullable priceUsd) { + if (priceUsd.isNull()) { + this.priceUsd = null; + } else if (priceUsd.isEmpty()) { + this.priceUsd = Optional.empty(); + } else { + this.priceUsd = Optional.of(priceUsd.get()); + } + return this; + } + + /** + *

USD price per token, or null when unknown.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage priceUsd(Double priceUsd) { + this.priceUsd = Optional.ofNullable(priceUsd); + return this; + } + + /** + *

USD price per token, or null when unknown.

+ */ + @java.lang.Override + @JsonSetter(value = "price_usd", nulls = Nulls.SKIP) + public _FinalStage priceUsd(Optional priceUsd) { + this.priceUsd = priceUsd; + return this; + } + + /** + *

The token's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

The token's display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

The token's display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

Token icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Token icon URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Token icon URL.

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + @java.lang.Override + public UserBalanceToken build() { + return new UserBalanceToken( + balance, breakdown, iconUrl, name, priceUsd, symbol, valueUsd, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UserBanner.java b/src/main/java/com/whop/api/types/UserBanner.java new file mode 100644 index 00000000..5b98cc15 --- /dev/null +++ b/src/main/java/com/whop/api/types/UserBanner.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserBanner.Builder.class) +public final class UserBanner { + private final String url; + + private final Map additionalProperties; + + private UserBanner(String url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Profile banner image URL. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserBanner && equalTo((UserBanner) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserBanner other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

Profile banner image URL.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(UserBanner other); + } + + public interface _FinalStage { + UserBanner build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserBanner other) { + url(other.getUrl()); + return this; + } + + /** + *

Profile banner image URL.

+ *

Profile banner image URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public UserBanner build() { + return new UserBanner(url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UserEarnings.java b/src/main/java/com/whop/api/types/UserEarnings.java new file mode 100644 index 00000000..cf0f7a9a --- /dev/null +++ b/src/main/java/com/whop/api/types/UserEarnings.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserEarnings.Builder.class) +public final class UserEarnings { + private final Optional firstEarnedAt; + + private final UserEarningsAmount ownedAccounts; + + private final UserEarningsAmount personal; + + private final UserEarningsAmount total; + + private final Map additionalProperties; + + private UserEarnings( + Optional firstEarnedAt, + UserEarningsAmount ownedAccounts, + UserEarningsAmount personal, + UserEarningsAmount total, + Map additionalProperties) { + this.firstEarnedAt = firstEarnedAt; + this.ownedAccounts = ownedAccounts; + this.personal = personal; + this.total = total; + this.additionalProperties = additionalProperties; + } + + /** + * @return The first time the user earned gross income, as an ISO 8601 timestamp. + */ + @JsonIgnore + public Optional getFirstEarnedAt() { + if (firstEarnedAt == null) { + return Optional.empty(); + } + return firstEarnedAt; + } + + /** + * @return Gross income from accounts the user owns or is owner-authorized on. + */ + @JsonProperty("owned_accounts") + public UserEarningsAmount getOwnedAccounts() { + return ownedAccounts; + } + + /** + * @return Gross income from the user's personal wallet. + */ + @JsonProperty("personal") + public UserEarningsAmount getPersonal() { + return personal; + } + + /** + * @return Gross income from the user's personal wallet plus accounts they own or are owner-authorized on. + */ + @JsonProperty("total") + public UserEarningsAmount getTotal() { + return total; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("first_earned_at") + private Optional _getFirstEarnedAt() { + return firstEarnedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserEarnings && equalTo((UserEarnings) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserEarnings other) { + return firstEarnedAt.equals(other.firstEarnedAt) + && ownedAccounts.equals(other.ownedAccounts) + && personal.equals(other.personal) + && total.equals(other.total); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.firstEarnedAt, this.ownedAccounts, this.personal, this.total); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static OwnedAccountsStage builder() { + return new Builder(); + } + + public interface OwnedAccountsStage { + /** + *

Gross income from accounts the user owns or is owner-authorized on.

+ */ + PersonalStage ownedAccounts(@NotNull UserEarningsAmount ownedAccounts); + + Builder from(UserEarnings other); + } + + public interface PersonalStage { + /** + *

Gross income from the user's personal wallet.

+ */ + TotalStage personal(@NotNull UserEarningsAmount personal); + } + + public interface TotalStage { + /** + *

Gross income from the user's personal wallet plus accounts they own or are owner-authorized on.

+ */ + _FinalStage total(@NotNull UserEarningsAmount total); + } + + public interface _FinalStage { + UserEarnings build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The first time the user earned gross income, as an ISO 8601 timestamp.

+ */ + _FinalStage firstEarnedAt(Optional firstEarnedAt); + + _FinalStage firstEarnedAt(String firstEarnedAt); + + _FinalStage firstEarnedAt(Nullable firstEarnedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements OwnedAccountsStage, PersonalStage, TotalStage, _FinalStage { + private UserEarningsAmount ownedAccounts; + + private UserEarningsAmount personal; + + private UserEarningsAmount total; + + private Optional firstEarnedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserEarnings other) { + firstEarnedAt(other.getFirstEarnedAt()); + ownedAccounts(other.getOwnedAccounts()); + personal(other.getPersonal()); + total(other.getTotal()); + return this; + } + + /** + *

Gross income from accounts the user owns or is owner-authorized on.

+ *

Gross income from accounts the user owns or is owner-authorized on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("owned_accounts") + public PersonalStage ownedAccounts(@NotNull UserEarningsAmount ownedAccounts) { + this.ownedAccounts = Objects.requireNonNull(ownedAccounts, "ownedAccounts must not be null"); + return this; + } + + /** + *

Gross income from the user's personal wallet.

+ *

Gross income from the user's personal wallet.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("personal") + public TotalStage personal(@NotNull UserEarningsAmount personal) { + this.personal = Objects.requireNonNull(personal, "personal must not be null"); + return this; + } + + /** + *

Gross income from the user's personal wallet plus accounts they own or are owner-authorized on.

+ *

Gross income from the user's personal wallet plus accounts they own or are owner-authorized on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total") + public _FinalStage total(@NotNull UserEarningsAmount total) { + this.total = Objects.requireNonNull(total, "total must not be null"); + return this; + } + + /** + *

The first time the user earned gross income, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstEarnedAt(Nullable firstEarnedAt) { + if (firstEarnedAt.isNull()) { + this.firstEarnedAt = null; + } else if (firstEarnedAt.isEmpty()) { + this.firstEarnedAt = Optional.empty(); + } else { + this.firstEarnedAt = Optional.of(firstEarnedAt.get()); + } + return this; + } + + /** + *

The first time the user earned gross income, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstEarnedAt(String firstEarnedAt) { + this.firstEarnedAt = Optional.ofNullable(firstEarnedAt); + return this; + } + + /** + *

The first time the user earned gross income, as an ISO 8601 timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "first_earned_at", nulls = Nulls.SKIP) + public _FinalStage firstEarnedAt(Optional firstEarnedAt) { + this.firstEarnedAt = firstEarnedAt; + return this; + } + + @java.lang.Override + public UserEarnings build() { + return new UserEarnings(firstEarnedAt, ownedAccounts, personal, total, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UserEarningsAmount.java b/src/main/java/com/whop/api/types/UserEarningsAmount.java new file mode 100644 index 00000000..384d2924 --- /dev/null +++ b/src/main/java/com/whop/api/types/UserEarningsAmount.java @@ -0,0 +1,237 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserEarningsAmount.Builder.class) +public final class UserEarningsAmount { + private final String last24Hours; + + private final String last30Days; + + private final String last7Days; + + private final String lifetime; + + private final Map additionalProperties; + + private UserEarningsAmount( + String last24Hours, + String last30Days, + String last7Days, + String lifetime, + Map additionalProperties) { + this.last24Hours = last24Hours; + this.last30Days = last30Days; + this.last7Days = last7Days; + this.lifetime = lifetime; + this.additionalProperties = additionalProperties; + } + + /** + * @return Gross income in USD over the last 24 hours. + */ + @JsonProperty("last_24_hours") + public String getLast24Hours() { + return last24Hours; + } + + /** + * @return Gross income in USD over the last 30 days. + */ + @JsonProperty("last_30_days") + public String getLast30Days() { + return last30Days; + } + + /** + * @return Gross income in USD over the last 7 days. + */ + @JsonProperty("last_7_days") + public String getLast7Days() { + return last7Days; + } + + /** + * @return All-time gross income in USD. + */ + @JsonProperty("lifetime") + public String getLifetime() { + return lifetime; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserEarningsAmount && equalTo((UserEarningsAmount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserEarningsAmount other) { + return last24Hours.equals(other.last24Hours) + && last30Days.equals(other.last30Days) + && last7Days.equals(other.last7Days) + && lifetime.equals(other.lifetime); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.last24Hours, this.last30Days, this.last7Days, this.lifetime); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Last24HoursStage builder() { + return new Builder(); + } + + public interface Last24HoursStage { + /** + *

Gross income in USD over the last 24 hours.

+ */ + Last30DaysStage last24Hours(@NotNull String last24Hours); + + Builder from(UserEarningsAmount other); + } + + public interface Last30DaysStage { + /** + *

Gross income in USD over the last 30 days.

+ */ + Last7DaysStage last30Days(@NotNull String last30Days); + } + + public interface Last7DaysStage { + /** + *

Gross income in USD over the last 7 days.

+ */ + LifetimeStage last7Days(@NotNull String last7Days); + } + + public interface LifetimeStage { + /** + *

All-time gross income in USD.

+ */ + _FinalStage lifetime(@NotNull String lifetime); + } + + public interface _FinalStage { + UserEarningsAmount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements Last24HoursStage, Last30DaysStage, Last7DaysStage, LifetimeStage, _FinalStage { + private String last24Hours; + + private String last30Days; + + private String last7Days; + + private String lifetime; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserEarningsAmount other) { + last24Hours(other.getLast24Hours()); + last30Days(other.getLast30Days()); + last7Days(other.getLast7Days()); + lifetime(other.getLifetime()); + return this; + } + + /** + *

Gross income in USD over the last 24 hours.

+ *

Gross income in USD over the last 24 hours.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("last_24_hours") + public Last30DaysStage last24Hours(@NotNull String last24Hours) { + this.last24Hours = Objects.requireNonNull(last24Hours, "last24Hours must not be null"); + return this; + } + + /** + *

Gross income in USD over the last 30 days.

+ *

Gross income in USD over the last 30 days.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("last_30_days") + public Last7DaysStage last30Days(@NotNull String last30Days) { + this.last30Days = Objects.requireNonNull(last30Days, "last30Days must not be null"); + return this; + } + + /** + *

Gross income in USD over the last 7 days.

+ *

Gross income in USD over the last 7 days.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("last_7_days") + public LifetimeStage last7Days(@NotNull String last7Days) { + this.last7Days = Objects.requireNonNull(last7Days, "last7Days must not be null"); + return this; + } + + /** + *

All-time gross income in USD.

+ *

All-time gross income in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("lifetime") + public _FinalStage lifetime(@NotNull String lifetime) { + this.lifetime = Objects.requireNonNull(lifetime, "lifetime must not be null"); + return this; + } + + @java.lang.Override + public UserEarningsAmount build() { + return new UserEarningsAmount(last24Hours, last30Days, last7Days, lifetime, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UserNotificationPreference.java b/src/main/java/com/whop/api/types/UserNotificationPreference.java new file mode 100644 index 00000000..d7ad364a --- /dev/null +++ b/src/main/java/com/whop/api/types/UserNotificationPreference.java @@ -0,0 +1,307 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserNotificationPreference.Builder.class) +public final class UserNotificationPreference { + private final String createdAt; + + private final String id; + + private final UserNotificationPreferenceLevel level; + + private final UserNotificationPreferenceObject object; + + private final NotificationPreferenceScope scope; + + private final String updatedAt; + + private final Map additionalProperties; + + private UserNotificationPreference( + String createdAt, + String id, + UserNotificationPreferenceLevel level, + UserNotificationPreferenceObject object, + NotificationPreferenceScope scope, + String updatedAt, + Map additionalProperties) { + this.createdAt = createdAt; + this.id = id; + this.level = level; + this.object = object; + this.scope = scope; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the preference was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return Notification preference ID, prefixed unpf_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return What the user is notified about in this scope: all or nothing. + */ + @JsonProperty("level") + public UserNotificationPreferenceLevel getLevel() { + return level; + } + + /** + * @return The type of object. Always notification_preference. + */ + @JsonProperty("object") + public UserNotificationPreferenceObject getObject() { + return object; + } + + /** + * @return What the preference applies to. Echo it back to PATCH /users/me/preferences/notifications to change this preference. + */ + @JsonProperty("scope") + public NotificationPreferenceScope getScope() { + return scope; + } + + /** + * @return When the preference was last changed, as an ISO 8601 timestamp. + */ + @JsonProperty("updated_at") + public String getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserNotificationPreference && equalTo((UserNotificationPreference) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserNotificationPreference other) { + return createdAt.equals(other.createdAt) + && id.equals(other.id) + && level.equals(other.level) + && object.equals(other.object) + && scope.equals(other.scope) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.id, this.level, this.object, this.scope, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

When the preference was created, as an ISO 8601 timestamp.

+ */ + IdStage createdAt(@NotNull String createdAt); + + Builder from(UserNotificationPreference other); + } + + public interface IdStage { + /** + *

Notification preference ID, prefixed unpf_.

+ */ + LevelStage id(@NotNull String id); + } + + public interface LevelStage { + /** + *

What the user is notified about in this scope: all or nothing.

+ */ + ObjectStage level(@NotNull UserNotificationPreferenceLevel level); + } + + public interface ObjectStage { + /** + *

The type of object. Always notification_preference.

+ */ + ScopeStage object(@NotNull UserNotificationPreferenceObject object); + } + + public interface ScopeStage { + /** + *

What the preference applies to. Echo it back to PATCH /users/me/preferences/notifications to change this preference.

+ */ + UpdatedAtStage scope(@NotNull NotificationPreferenceScope scope); + } + + public interface UpdatedAtStage { + /** + *

When the preference was last changed, as an ISO 8601 timestamp.

+ */ + _FinalStage updatedAt(@NotNull String updatedAt); + } + + public interface _FinalStage { + UserNotificationPreference build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, IdStage, LevelStage, ObjectStage, ScopeStage, UpdatedAtStage, _FinalStage { + private String createdAt; + + private String id; + + private UserNotificationPreferenceLevel level; + + private UserNotificationPreferenceObject object; + + private NotificationPreferenceScope scope; + + private String updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserNotificationPreference other) { + createdAt(other.getCreatedAt()); + id(other.getId()); + level(other.getLevel()); + object(other.getObject()); + scope(other.getScope()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

When the preference was created, as an ISO 8601 timestamp.

+ *

When the preference was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Notification preference ID, prefixed unpf_.

+ *

Notification preference ID, prefixed unpf_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LevelStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

What the user is notified about in this scope: all or nothing.

+ *

What the user is notified about in this scope: all or nothing.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("level") + public ObjectStage level(@NotNull UserNotificationPreferenceLevel level) { + this.level = Objects.requireNonNull(level, "level must not be null"); + return this; + } + + /** + *

The type of object. Always notification_preference.

+ *

The type of object. Always notification_preference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("object") + public ScopeStage object(@NotNull UserNotificationPreferenceObject object) { + this.object = Objects.requireNonNull(object, "object must not be null"); + return this; + } + + /** + *

What the preference applies to. Echo it back to PATCH /users/me/preferences/notifications to change this preference.

+ *

What the preference applies to. Echo it back to PATCH /users/me/preferences/notifications to change this preference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("scope") + public UpdatedAtStage scope(@NotNull NotificationPreferenceScope scope) { + this.scope = Objects.requireNonNull(scope, "scope must not be null"); + return this; + } + + /** + *

When the preference was last changed, as an ISO 8601 timestamp.

+ *

When the preference was last changed, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull String updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public UserNotificationPreference build() { + return new UserNotificationPreference(createdAt, id, level, object, scope, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UserNotificationPreferenceLevel.java b/src/main/java/com/whop/api/types/UserNotificationPreferenceLevel.java new file mode 100644 index 00000000..9c387db7 --- /dev/null +++ b/src/main/java/com/whop/api/types/UserNotificationPreferenceLevel.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UserNotificationPreferenceLevel { + public static final UserNotificationPreferenceLevel ALL = new UserNotificationPreferenceLevel(Value.ALL, "all"); + + public static final UserNotificationPreferenceLevel NOTHING = + new UserNotificationPreferenceLevel(Value.NOTHING, "nothing"); + + private final Value value; + + private final String string; + + UserNotificationPreferenceLevel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UserNotificationPreferenceLevel + && this.string.equals(((UserNotificationPreferenceLevel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ALL: + return visitor.visitAll(); + case NOTHING: + return visitor.visitNothing(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UserNotificationPreferenceLevel valueOf(String value) { + switch (value) { + case "all": + return ALL; + case "nothing": + return NOTHING; + default: + return new UserNotificationPreferenceLevel(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL, + + NOTHING, + + UNKNOWN + } + + public interface Visitor { + T visitAll(); + + T visitNothing(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/UserNotificationPreferenceObject.java b/src/main/java/com/whop/api/types/UserNotificationPreferenceObject.java new file mode 100644 index 00000000..8bcd37bd --- /dev/null +++ b/src/main/java/com/whop/api/types/UserNotificationPreferenceObject.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UserNotificationPreferenceObject { + public static final UserNotificationPreferenceObject NOTIFICATION_PREFERENCE = + new UserNotificationPreferenceObject(Value.NOTIFICATION_PREFERENCE, "notification_preference"); + + private final Value value; + + private final String string; + + UserNotificationPreferenceObject(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UserNotificationPreferenceObject + && this.string.equals(((UserNotificationPreferenceObject) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NOTIFICATION_PREFERENCE: + return visitor.visitNotificationPreference(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UserNotificationPreferenceObject valueOf(String value) { + switch (value) { + case "notification_preference": + return NOTIFICATION_PREFERENCE; + default: + return new UserNotificationPreferenceObject(Value.UNKNOWN, value); + } + } + + public enum Value { + NOTIFICATION_PREFERENCE, + + UNKNOWN + } + + public interface Visitor { + T visitNotificationPreference(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/UserPreferences.java b/src/main/java/com/whop/api/types/UserPreferences.java new file mode 100644 index 00000000..7f54207b --- /dev/null +++ b/src/main/java/com/whop/api/types/UserPreferences.java @@ -0,0 +1,288 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserPreferences.Builder.class) +public final class UserPreferences { + private final boolean bountyWorkerOnboardingDismissed; + + private final boolean investigationEnabled; + + private final boolean termsAccepted; + + private final Optional termsAcceptedAt; + + private final Map additionalProperties; + + private UserPreferences( + boolean bountyWorkerOnboardingDismissed, + boolean investigationEnabled, + boolean termsAccepted, + Optional termsAcceptedAt, + Map additionalProperties) { + this.bountyWorkerOnboardingDismissed = bountyWorkerOnboardingDismissed; + this.investigationEnabled = investigationEnabled; + this.termsAccepted = termsAccepted; + this.termsAcceptedAt = termsAcceptedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the user has dismissed the first-time bounty worker onboarding. Set to false to show it again. + */ + @JsonProperty("bounty_worker_onboarding_dismissed") + public boolean getBountyWorkerOnboardingDismissed() { + return bountyWorkerOnboardingDismissed; + } + + /** + * @return Whether investigation mode is enabled for the user. Only meaningful for staff users with investigation access. + */ + @JsonProperty("investigation_enabled") + public boolean getInvestigationEnabled() { + return investigationEnabled; + } + + /** + * @return Whether the user has accepted Whop's terms and policies. false until recorded via PATCH with terms_accepted: true. + */ + @JsonProperty("terms_accepted") + public boolean getTermsAccepted() { + return termsAccepted; + } + + /** + * @return When the user most recently accepted Whop's terms and policies, as an ISO 8601 timestamp. null until accepted. + */ + @JsonIgnore + public Optional getTermsAcceptedAt() { + if (termsAcceptedAt == null) { + return Optional.empty(); + } + return termsAcceptedAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("terms_accepted_at") + private Optional _getTermsAcceptedAt() { + return termsAcceptedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserPreferences && equalTo((UserPreferences) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserPreferences other) { + return bountyWorkerOnboardingDismissed == other.bountyWorkerOnboardingDismissed + && investigationEnabled == other.investigationEnabled + && termsAccepted == other.termsAccepted + && termsAcceptedAt.equals(other.termsAcceptedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bountyWorkerOnboardingDismissed, + this.investigationEnabled, + this.termsAccepted, + this.termsAcceptedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BountyWorkerOnboardingDismissedStage builder() { + return new Builder(); + } + + public interface BountyWorkerOnboardingDismissedStage { + /** + *

Whether the user has dismissed the first-time bounty worker onboarding. Set to false to show it again.

+ */ + InvestigationEnabledStage bountyWorkerOnboardingDismissed(boolean bountyWorkerOnboardingDismissed); + + Builder from(UserPreferences other); + } + + public interface InvestigationEnabledStage { + /** + *

Whether investigation mode is enabled for the user. Only meaningful for staff users with investigation access.

+ */ + TermsAcceptedStage investigationEnabled(boolean investigationEnabled); + } + + public interface TermsAcceptedStage { + /** + *

Whether the user has accepted Whop's terms and policies. false until recorded via PATCH with terms_accepted: true.

+ */ + _FinalStage termsAccepted(boolean termsAccepted); + } + + public interface _FinalStage { + UserPreferences build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When the user most recently accepted Whop's terms and policies, as an ISO 8601 timestamp. null until accepted.

+ */ + _FinalStage termsAcceptedAt(Optional termsAcceptedAt); + + _FinalStage termsAcceptedAt(String termsAcceptedAt); + + _FinalStage termsAcceptedAt(Nullable termsAcceptedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BountyWorkerOnboardingDismissedStage, + InvestigationEnabledStage, + TermsAcceptedStage, + _FinalStage { + private boolean bountyWorkerOnboardingDismissed; + + private boolean investigationEnabled; + + private boolean termsAccepted; + + private Optional termsAcceptedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserPreferences other) { + bountyWorkerOnboardingDismissed(other.getBountyWorkerOnboardingDismissed()); + investigationEnabled(other.getInvestigationEnabled()); + termsAccepted(other.getTermsAccepted()); + termsAcceptedAt(other.getTermsAcceptedAt()); + return this; + } + + /** + *

Whether the user has dismissed the first-time bounty worker onboarding. Set to false to show it again.

+ *

Whether the user has dismissed the first-time bounty worker onboarding. Set to false to show it again.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bounty_worker_onboarding_dismissed") + public InvestigationEnabledStage bountyWorkerOnboardingDismissed(boolean bountyWorkerOnboardingDismissed) { + this.bountyWorkerOnboardingDismissed = bountyWorkerOnboardingDismissed; + return this; + } + + /** + *

Whether investigation mode is enabled for the user. Only meaningful for staff users with investigation access.

+ *

Whether investigation mode is enabled for the user. Only meaningful for staff users with investigation access.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("investigation_enabled") + public TermsAcceptedStage investigationEnabled(boolean investigationEnabled) { + this.investigationEnabled = investigationEnabled; + return this; + } + + /** + *

Whether the user has accepted Whop's terms and policies. false until recorded via PATCH with terms_accepted: true.

+ *

Whether the user has accepted Whop's terms and policies. false until recorded via PATCH with terms_accepted: true.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("terms_accepted") + public _FinalStage termsAccepted(boolean termsAccepted) { + this.termsAccepted = termsAccepted; + return this; + } + + /** + *

When the user most recently accepted Whop's terms and policies, as an ISO 8601 timestamp. null until accepted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage termsAcceptedAt(Nullable termsAcceptedAt) { + if (termsAcceptedAt.isNull()) { + this.termsAcceptedAt = null; + } else if (termsAcceptedAt.isEmpty()) { + this.termsAcceptedAt = Optional.empty(); + } else { + this.termsAcceptedAt = Optional.of(termsAcceptedAt.get()); + } + return this; + } + + /** + *

When the user most recently accepted Whop's terms and policies, as an ISO 8601 timestamp. null until accepted.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage termsAcceptedAt(String termsAcceptedAt) { + this.termsAcceptedAt = Optional.ofNullable(termsAcceptedAt); + return this; + } + + /** + *

When the user most recently accepted Whop's terms and policies, as an ISO 8601 timestamp. null until accepted.

+ */ + @java.lang.Override + @JsonSetter(value = "terms_accepted_at", nulls = Nulls.SKIP) + public _FinalStage termsAcceptedAt(Optional termsAcceptedAt) { + this.termsAcceptedAt = termsAcceptedAt; + return this; + } + + @java.lang.Override + public UserPreferences build() { + return new UserPreferences( + bountyWorkerOnboardingDismissed, + investigationEnabled, + termsAccepted, + termsAcceptedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UserProfilePicture.java b/src/main/java/com/whop/api/types/UserProfilePicture.java new file mode 100644 index 00000000..7b12ad3c --- /dev/null +++ b/src/main/java/com/whop/api/types/UserProfilePicture.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserProfilePicture.Builder.class) +public final class UserProfilePicture { + private final String url; + + private final Map additionalProperties; + + private UserProfilePicture(String url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Avatar image URL. Always present — a generated placeholder when the user set no picture. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserProfilePicture && equalTo((UserProfilePicture) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserProfilePicture other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

Avatar image URL. Always present — a generated placeholder when the user set no picture.

+ */ + _FinalStage url(@NotNull String url); + + Builder from(UserProfilePicture other); + } + + public interface _FinalStage { + UserProfilePicture build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserProfilePicture other) { + url(other.getUrl()); + return this; + } + + /** + *

Avatar image URL. Always present — a generated placeholder when the user set no picture.

+ *

Avatar image URL. Always present — a generated placeholder when the user set no picture.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public UserProfilePicture build() { + return new UserProfilePicture(url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UserRecommendedAction.java b/src/main/java/com/whop/api/types/UserRecommendedAction.java new file mode 100644 index 00000000..d3a2c1b9 --- /dev/null +++ b/src/main/java/com/whop/api/types/UserRecommendedAction.java @@ -0,0 +1,732 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserRecommendedAction.Builder.class) +public final class UserRecommendedAction { + private final Optional accountId; + + private final Optional accountName; + + private final UserRecommendedActionAction action; + + private final List blockedCapabilities; + + private final String cta; + + private final String ctaLabel; + + private final String description; + + private final Optional iconUrl; + + private final Optional impactScore; + + private final Optional reasoning; + + private final UserRecommendedActionStatus status; + + private final String title; + + private final Map additionalProperties; + + private UserRecommendedAction( + Optional accountId, + Optional accountName, + UserRecommendedActionAction action, + List blockedCapabilities, + String cta, + String ctaLabel, + String description, + Optional iconUrl, + Optional impactScore, + Optional reasoning, + UserRecommendedActionStatus status, + String title, + Map additionalProperties) { + this.accountId = accountId; + this.accountName = accountName; + this.action = action; + this.blockedCapabilities = blockedCapabilities; + this.cta = cta; + this.ctaLabel = ctaLabel; + this.description = description; + this.iconUrl = iconUrl; + this.impactScore = impactScore; + this.reasoning = reasoning; + this.status = status; + this.title = title; + this.additionalProperties = additionalProperties; + } + + /** + * @return The account (biz_) a business recommendation is for, or null for personal recommendations + */ + @JsonIgnore + public Optional getAccountId() { + if (accountId == null) { + return Optional.empty(); + } + return accountId; + } + + /** + * @return The account's display name, or null + */ + @JsonIgnore + public Optional getAccountName() { + if (accountName == null) { + return Optional.empty(); + } + return accountName; + } + + /** + * @return The recommendation; new values may be added, so handle unknown actions gracefully + */ + @JsonProperty("action") + public UserRecommendedActionAction getAction() { + return action; + } + + @JsonProperty("blocked_capabilities") + public List getBlockedCapabilities() { + return blockedCapabilities; + } + + /** + * @return The URL the call-to-action links to + */ + @JsonProperty("cta") + public String getCta() { + return cta; + } + + /** + * @return Button label + */ + @JsonProperty("cta_label") + public String getCtaLabel() { + return ctaLabel; + } + + /** + * @return Supporting copy, or empty + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * @return Illustration icon URL, or null + */ + @JsonIgnore + public Optional getIconUrl() { + if (iconUrl == null) { + return Optional.empty(); + } + return iconUrl; + } + + /** + * @return Estimated impact from 0-100, or null when not ranked + */ + @JsonIgnore + public Optional getImpactScore() { + if (impactScore == null) { + return Optional.empty(); + } + return impactScore; + } + + /** + * @return Why this action was recommended, or null + */ + @JsonIgnore + public Optional getReasoning() { + if (reasoning == null) { + return Optional.empty(); + } + return reasoning; + } + + /** + * @return Always optional — never blocking + */ + @JsonProperty("status") + public UserRecommendedActionStatus getStatus() { + return status; + } + + /** + * @return Headline for the recommendation + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_id") + private Optional _getAccountId() { + return accountId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("account_name") + private Optional _getAccountName() { + return accountName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("icon_url") + private Optional _getIconUrl() { + return iconUrl; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("impact_score") + private Optional _getImpactScore() { + return impactScore; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("reasoning") + private Optional _getReasoning() { + return reasoning; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserRecommendedAction && equalTo((UserRecommendedAction) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserRecommendedAction other) { + return accountId.equals(other.accountId) + && accountName.equals(other.accountName) + && action.equals(other.action) + && blockedCapabilities.equals(other.blockedCapabilities) + && cta.equals(other.cta) + && ctaLabel.equals(other.ctaLabel) + && description.equals(other.description) + && iconUrl.equals(other.iconUrl) + && impactScore.equals(other.impactScore) + && reasoning.equals(other.reasoning) + && status.equals(other.status) + && title.equals(other.title); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.accountName, + this.action, + this.blockedCapabilities, + this.cta, + this.ctaLabel, + this.description, + this.iconUrl, + this.impactScore, + this.reasoning, + this.status, + this.title); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + /** + *

The recommendation; new values may be added, so handle unknown actions gracefully

+ */ + CtaStage action(@NotNull UserRecommendedActionAction action); + + Builder from(UserRecommendedAction other); + } + + public interface CtaStage { + /** + *

The URL the call-to-action links to

+ */ + CtaLabelStage cta(@NotNull String cta); + } + + public interface CtaLabelStage { + /** + *

Button label

+ */ + DescriptionStage ctaLabel(@NotNull String ctaLabel); + } + + public interface DescriptionStage { + /** + *

Supporting copy, or empty

+ */ + StatusStage description(@NotNull String description); + } + + public interface StatusStage { + /** + *

Always optional — never blocking

+ */ + TitleStage status(@NotNull UserRecommendedActionStatus status); + } + + public interface TitleStage { + /** + *

Headline for the recommendation

+ */ + _FinalStage title(@NotNull String title); + } + + public interface _FinalStage { + UserRecommendedAction build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The account (biz_) a business recommendation is for, or null for personal recommendations

+ */ + _FinalStage accountId(Optional accountId); + + _FinalStage accountId(String accountId); + + _FinalStage accountId(Nullable accountId); + + /** + *

The account's display name, or null

+ */ + _FinalStage accountName(Optional accountName); + + _FinalStage accountName(String accountName); + + _FinalStage accountName(Nullable accountName); + + _FinalStage blockedCapabilities(List blockedCapabilities); + + _FinalStage addBlockedCapabilities(String blockedCapabilities); + + _FinalStage addAllBlockedCapabilities(List blockedCapabilities); + + /** + *

Illustration icon URL, or null

+ */ + _FinalStage iconUrl(Optional iconUrl); + + _FinalStage iconUrl(String iconUrl); + + _FinalStage iconUrl(Nullable iconUrl); + + /** + *

Estimated impact from 0-100, or null when not ranked

+ */ + _FinalStage impactScore(Optional impactScore); + + _FinalStage impactScore(Integer impactScore); + + _FinalStage impactScore(Nullable impactScore); + + /** + *

Why this action was recommended, or null

+ */ + _FinalStage reasoning(Optional reasoning); + + _FinalStage reasoning(String reasoning); + + _FinalStage reasoning(Nullable reasoning); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ActionStage, CtaStage, CtaLabelStage, DescriptionStage, StatusStage, TitleStage, _FinalStage { + private UserRecommendedActionAction action; + + private String cta; + + private String ctaLabel; + + private String description; + + private UserRecommendedActionStatus status; + + private String title; + + private Optional reasoning = Optional.empty(); + + private Optional impactScore = Optional.empty(); + + private Optional iconUrl = Optional.empty(); + + private List blockedCapabilities = new ArrayList<>(); + + private Optional accountName = Optional.empty(); + + private Optional accountId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserRecommendedAction other) { + accountId(other.getAccountId()); + accountName(other.getAccountName()); + action(other.getAction()); + blockedCapabilities(other.getBlockedCapabilities()); + cta(other.getCta()); + ctaLabel(other.getCtaLabel()); + description(other.getDescription()); + iconUrl(other.getIconUrl()); + impactScore(other.getImpactScore()); + reasoning(other.getReasoning()); + status(other.getStatus()); + title(other.getTitle()); + return this; + } + + /** + *

The recommendation; new values may be added, so handle unknown actions gracefully

+ *

The recommendation; new values may be added, so handle unknown actions gracefully

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("action") + public CtaStage action(@NotNull UserRecommendedActionAction action) { + this.action = Objects.requireNonNull(action, "action must not be null"); + return this; + } + + /** + *

The URL the call-to-action links to

+ *

The URL the call-to-action links to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cta") + public CtaLabelStage cta(@NotNull String cta) { + this.cta = Objects.requireNonNull(cta, "cta must not be null"); + return this; + } + + /** + *

Button label

+ *

Button label

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cta_label") + public DescriptionStage ctaLabel(@NotNull String ctaLabel) { + this.ctaLabel = Objects.requireNonNull(ctaLabel, "ctaLabel must not be null"); + return this; + } + + /** + *

Supporting copy, or empty

+ *

Supporting copy, or empty

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("description") + public StatusStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + /** + *

Always optional — never blocking

+ *

Always optional — never blocking

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TitleStage status(@NotNull UserRecommendedActionStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

Headline for the recommendation

+ *

Headline for the recommendation

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

Why this action was recommended, or null

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reasoning(Nullable reasoning) { + if (reasoning.isNull()) { + this.reasoning = null; + } else if (reasoning.isEmpty()) { + this.reasoning = Optional.empty(); + } else { + this.reasoning = Optional.of(reasoning.get()); + } + return this; + } + + /** + *

Why this action was recommended, or null

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reasoning(String reasoning) { + this.reasoning = Optional.ofNullable(reasoning); + return this; + } + + /** + *

Why this action was recommended, or null

+ */ + @java.lang.Override + @JsonSetter(value = "reasoning", nulls = Nulls.SKIP) + public _FinalStage reasoning(Optional reasoning) { + this.reasoning = reasoning; + return this; + } + + /** + *

Estimated impact from 0-100, or null when not ranked

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage impactScore(Nullable impactScore) { + if (impactScore.isNull()) { + this.impactScore = null; + } else if (impactScore.isEmpty()) { + this.impactScore = Optional.empty(); + } else { + this.impactScore = Optional.of(impactScore.get()); + } + return this; + } + + /** + *

Estimated impact from 0-100, or null when not ranked

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage impactScore(Integer impactScore) { + this.impactScore = Optional.ofNullable(impactScore); + return this; + } + + /** + *

Estimated impact from 0-100, or null when not ranked

+ */ + @java.lang.Override + @JsonSetter(value = "impact_score", nulls = Nulls.SKIP) + public _FinalStage impactScore(Optional impactScore) { + this.impactScore = impactScore; + return this; + } + + /** + *

Illustration icon URL, or null

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(Nullable iconUrl) { + if (iconUrl.isNull()) { + this.iconUrl = null; + } else if (iconUrl.isEmpty()) { + this.iconUrl = Optional.empty(); + } else { + this.iconUrl = Optional.of(iconUrl.get()); + } + return this; + } + + /** + *

Illustration icon URL, or null

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage iconUrl(String iconUrl) { + this.iconUrl = Optional.ofNullable(iconUrl); + return this; + } + + /** + *

Illustration icon URL, or null

+ */ + @java.lang.Override + @JsonSetter(value = "icon_url", nulls = Nulls.SKIP) + public _FinalStage iconUrl(Optional iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + @java.lang.Override + public _FinalStage addAllBlockedCapabilities(List blockedCapabilities) { + if (blockedCapabilities != null) { + this.blockedCapabilities.addAll(blockedCapabilities); + } + return this; + } + + @java.lang.Override + public _FinalStage addBlockedCapabilities(String blockedCapabilities) { + this.blockedCapabilities.add(blockedCapabilities); + return this; + } + + @java.lang.Override + @JsonSetter(value = "blocked_capabilities", nulls = Nulls.SKIP) + public _FinalStage blockedCapabilities(List blockedCapabilities) { + this.blockedCapabilities.clear(); + if (blockedCapabilities != null) { + this.blockedCapabilities.addAll(blockedCapabilities); + } + return this; + } + + /** + *

The account's display name, or null

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountName(Nullable accountName) { + if (accountName.isNull()) { + this.accountName = null; + } else if (accountName.isEmpty()) { + this.accountName = Optional.empty(); + } else { + this.accountName = Optional.of(accountName.get()); + } + return this; + } + + /** + *

The account's display name, or null

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountName(String accountName) { + this.accountName = Optional.ofNullable(accountName); + return this; + } + + /** + *

The account's display name, or null

+ */ + @java.lang.Override + @JsonSetter(value = "account_name", nulls = Nulls.SKIP) + public _FinalStage accountName(Optional accountName) { + this.accountName = accountName; + return this; + } + + /** + *

The account (biz_) a business recommendation is for, or null for personal recommendations

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(Nullable accountId) { + if (accountId.isNull()) { + this.accountId = null; + } else if (accountId.isEmpty()) { + this.accountId = Optional.empty(); + } else { + this.accountId = Optional.of(accountId.get()); + } + return this; + } + + /** + *

The account (biz_) a business recommendation is for, or null for personal recommendations

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accountId(String accountId) { + this.accountId = Optional.ofNullable(accountId); + return this; + } + + /** + *

The account (biz_) a business recommendation is for, or null for personal recommendations

+ */ + @java.lang.Override + @JsonSetter(value = "account_id", nulls = Nulls.SKIP) + public _FinalStage accountId(Optional accountId) { + this.accountId = accountId; + return this; + } + + @java.lang.Override + public UserRecommendedAction build() { + return new UserRecommendedAction( + accountId, + accountName, + action, + blockedCapabilities, + cta, + ctaLabel, + description, + iconUrl, + impactScore, + reasoning, + status, + title, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UserRecommendedActionAction.java b/src/main/java/com/whop/api/types/UserRecommendedActionAction.java new file mode 100644 index 00000000..e69b746d --- /dev/null +++ b/src/main/java/com/whop/api/types/UserRecommendedActionAction.java @@ -0,0 +1,317 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UserRecommendedActionAction { + public static final UserRecommendedActionAction FIX_AD_BILLING = + new UserRecommendedActionAction(Value.FIX_AD_BILLING, "fix_ad_billing"); + + public static final UserRecommendedActionAction LAUNCH_DRAFT_CAMPAIGN = + new UserRecommendedActionAction(Value.LAUNCH_DRAFT_CAMPAIGN, "launch_draft_campaign"); + + public static final UserRecommendedActionAction CREATE_CARD = + new UserRecommendedActionAction(Value.CREATE_CARD, "create_card"); + + public static final UserRecommendedActionAction EXCLUDE_CUSTOMERS_FROM_ADS = + new UserRecommendedActionAction(Value.EXCLUDE_CUSTOMERS_FROM_ADS, "exclude_customers_from_ads"); + + public static final UserRecommendedActionAction INVITE_TEAM_MEMBER = + new UserRecommendedActionAction(Value.INVITE_TEAM_MEMBER, "invite_team_member"); + + public static final UserRecommendedActionAction BECOME_WHOP_PARTNER = + new UserRecommendedActionAction(Value.BECOME_WHOP_PARTNER, "become_whop_partner"); + + public static final UserRecommendedActionAction APPLY_FOR_FINANCING = + new UserRecommendedActionAction(Value.APPLY_FOR_FINANCING, "apply_for_financing"); + + public static final UserRecommendedActionAction CREATE_PRODUCT = + new UserRecommendedActionAction(Value.CREATE_PRODUCT, "create_product"); + + public static final UserRecommendedActionAction FIX_FUNNEL_DROPOFF = + new UserRecommendedActionAction(Value.FIX_FUNNEL_DROPOFF, "fix_funnel_dropoff"); + + public static final UserRecommendedActionAction LAUNCH_FIRST_AD = + new UserRecommendedActionAction(Value.LAUNCH_FIRST_AD, "launch_first_ad"); + + public static final UserRecommendedActionAction RETARGET_ABANDONED_CHECKOUTS = + new UserRecommendedActionAction(Value.RETARGET_ABANDONED_CHECKOUTS, "retarget_abandoned_checkouts"); + + public static final UserRecommendedActionAction CONNECT_AFFILIATE_PROGRAM = + new UserRecommendedActionAction(Value.CONNECT_AFFILIATE_PROGRAM, "connect_affiliate_program"); + + public static final UserRecommendedActionAction INCREASE_AD_BUDGET = + new UserRecommendedActionAction(Value.INCREASE_AD_BUDGET, "increase_ad_budget"); + + public static final UserRecommendedActionAction BECOME_AFFILIATE = + new UserRecommendedActionAction(Value.BECOME_AFFILIATE, "become_affiliate"); + + public static final UserRecommendedActionAction VERIFY_IDENTITY = + new UserRecommendedActionAction(Value.VERIFY_IDENTITY, "verify_identity"); + + public static final UserRecommendedActionAction MIGRATE_FROM_STRIPE = + new UserRecommendedActionAction(Value.MIGRATE_FROM_STRIPE, "migrate_from_stripe"); + + public static final UserRecommendedActionAction REFRESH_AD_CREATIVES = + new UserRecommendedActionAction(Value.REFRESH_AD_CREATIVES, "refresh_ad_creatives"); + + public static final UserRecommendedActionAction CREATE_PLAN = + new UserRecommendedActionAction(Value.CREATE_PLAN, "create_plan"); + + public static final UserRecommendedActionAction ENABLE_TAX_COLLECTION = + new UserRecommendedActionAction(Value.ENABLE_TAX_COLLECTION, "enable_tax_collection"); + + public static final UserRecommendedActionAction THEME_BUSINESS = + new UserRecommendedActionAction(Value.THEME_BUSINESS, "theme_business"); + + public static final UserRecommendedActionAction ACCEPT_FIRST_PAYMENT = + new UserRecommendedActionAction(Value.ACCEPT_FIRST_PAYMENT, "accept_first_payment"); + + public static final UserRecommendedActionAction CREATE_BUSINESS = + new UserRecommendedActionAction(Value.CREATE_BUSINESS, "create_business"); + + public static final UserRecommendedActionAction CREATE_PROMOTION = + new UserRecommendedActionAction(Value.CREATE_PROMOTION, "create_promotion"); + + private final Value value; + + private final String string; + + UserRecommendedActionAction(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UserRecommendedActionAction + && this.string.equals(((UserRecommendedActionAction) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FIX_AD_BILLING: + return visitor.visitFixAdBilling(); + case LAUNCH_DRAFT_CAMPAIGN: + return visitor.visitLaunchDraftCampaign(); + case CREATE_CARD: + return visitor.visitCreateCard(); + case EXCLUDE_CUSTOMERS_FROM_ADS: + return visitor.visitExcludeCustomersFromAds(); + case INVITE_TEAM_MEMBER: + return visitor.visitInviteTeamMember(); + case BECOME_WHOP_PARTNER: + return visitor.visitBecomeWhopPartner(); + case APPLY_FOR_FINANCING: + return visitor.visitApplyForFinancing(); + case CREATE_PRODUCT: + return visitor.visitCreateProduct(); + case FIX_FUNNEL_DROPOFF: + return visitor.visitFixFunnelDropoff(); + case LAUNCH_FIRST_AD: + return visitor.visitLaunchFirstAd(); + case RETARGET_ABANDONED_CHECKOUTS: + return visitor.visitRetargetAbandonedCheckouts(); + case CONNECT_AFFILIATE_PROGRAM: + return visitor.visitConnectAffiliateProgram(); + case INCREASE_AD_BUDGET: + return visitor.visitIncreaseAdBudget(); + case BECOME_AFFILIATE: + return visitor.visitBecomeAffiliate(); + case VERIFY_IDENTITY: + return visitor.visitVerifyIdentity(); + case MIGRATE_FROM_STRIPE: + return visitor.visitMigrateFromStripe(); + case REFRESH_AD_CREATIVES: + return visitor.visitRefreshAdCreatives(); + case CREATE_PLAN: + return visitor.visitCreatePlan(); + case ENABLE_TAX_COLLECTION: + return visitor.visitEnableTaxCollection(); + case THEME_BUSINESS: + return visitor.visitThemeBusiness(); + case ACCEPT_FIRST_PAYMENT: + return visitor.visitAcceptFirstPayment(); + case CREATE_BUSINESS: + return visitor.visitCreateBusiness(); + case CREATE_PROMOTION: + return visitor.visitCreatePromotion(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UserRecommendedActionAction valueOf(String value) { + switch (value) { + case "fix_ad_billing": + return FIX_AD_BILLING; + case "launch_draft_campaign": + return LAUNCH_DRAFT_CAMPAIGN; + case "create_card": + return CREATE_CARD; + case "exclude_customers_from_ads": + return EXCLUDE_CUSTOMERS_FROM_ADS; + case "invite_team_member": + return INVITE_TEAM_MEMBER; + case "become_whop_partner": + return BECOME_WHOP_PARTNER; + case "apply_for_financing": + return APPLY_FOR_FINANCING; + case "create_product": + return CREATE_PRODUCT; + case "fix_funnel_dropoff": + return FIX_FUNNEL_DROPOFF; + case "launch_first_ad": + return LAUNCH_FIRST_AD; + case "retarget_abandoned_checkouts": + return RETARGET_ABANDONED_CHECKOUTS; + case "connect_affiliate_program": + return CONNECT_AFFILIATE_PROGRAM; + case "increase_ad_budget": + return INCREASE_AD_BUDGET; + case "become_affiliate": + return BECOME_AFFILIATE; + case "verify_identity": + return VERIFY_IDENTITY; + case "migrate_from_stripe": + return MIGRATE_FROM_STRIPE; + case "refresh_ad_creatives": + return REFRESH_AD_CREATIVES; + case "create_plan": + return CREATE_PLAN; + case "enable_tax_collection": + return ENABLE_TAX_COLLECTION; + case "theme_business": + return THEME_BUSINESS; + case "accept_first_payment": + return ACCEPT_FIRST_PAYMENT; + case "create_business": + return CREATE_BUSINESS; + case "create_promotion": + return CREATE_PROMOTION; + default: + return new UserRecommendedActionAction(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATE_BUSINESS, + + BECOME_AFFILIATE, + + BECOME_WHOP_PARTNER, + + THEME_BUSINESS, + + CREATE_PRODUCT, + + CREATE_PLAN, + + VERIFY_IDENTITY, + + CONNECT_AFFILIATE_PROGRAM, + + CREATE_PROMOTION, + + MIGRATE_FROM_STRIPE, + + ACCEPT_FIRST_PAYMENT, + + LAUNCH_FIRST_AD, + + LAUNCH_DRAFT_CAMPAIGN, + + INCREASE_AD_BUDGET, + + REFRESH_AD_CREATIVES, + + FIX_AD_BILLING, + + EXCLUDE_CUSTOMERS_FROM_ADS, + + RETARGET_ABANDONED_CHECKOUTS, + + FIX_FUNNEL_DROPOFF, + + INVITE_TEAM_MEMBER, + + ENABLE_TAX_COLLECTION, + + CREATE_CARD, + + APPLY_FOR_FINANCING, + + UNKNOWN + } + + public interface Visitor { + T visitCreateBusiness(); + + T visitBecomeAffiliate(); + + T visitBecomeWhopPartner(); + + T visitThemeBusiness(); + + T visitCreateProduct(); + + T visitCreatePlan(); + + T visitVerifyIdentity(); + + T visitConnectAffiliateProgram(); + + T visitCreatePromotion(); + + T visitMigrateFromStripe(); + + T visitAcceptFirstPayment(); + + T visitLaunchFirstAd(); + + T visitLaunchDraftCampaign(); + + T visitIncreaseAdBudget(); + + T visitRefreshAdCreatives(); + + T visitFixAdBilling(); + + T visitExcludeCustomersFromAds(); + + T visitRetargetAbandonedCheckouts(); + + T visitFixFunnelDropoff(); + + T visitInviteTeamMember(); + + T visitEnableTaxCollection(); + + T visitCreateCard(); + + T visitApplyForFinancing(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/UserRecommendedActionStatus.java b/src/main/java/com/whop/api/types/UserRecommendedActionStatus.java new file mode 100644 index 00000000..e4be111d --- /dev/null +++ b/src/main/java/com/whop/api/types/UserRecommendedActionStatus.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UserRecommendedActionStatus { + public static final UserRecommendedActionStatus OPTIONAL = + new UserRecommendedActionStatus(Value.OPTIONAL, "optional"); + + private final Value value; + + private final String string; + + UserRecommendedActionStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UserRecommendedActionStatus + && this.string.equals(((UserRecommendedActionStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case OPTIONAL: + return visitor.visitOptional(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UserRecommendedActionStatus valueOf(String value) { + switch (value) { + case "optional": + return OPTIONAL; + default: + return new UserRecommendedActionStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + OPTIONAL, + + UNKNOWN + } + + public interface Visitor { + T visitOptional(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/UserStaffAccess.java b/src/main/java/com/whop/api/types/UserStaffAccess.java new file mode 100644 index 00000000..763287eb --- /dev/null +++ b/src/main/java/com/whop/api/types/UserStaffAccess.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserStaffAccess.Builder.class) +public final class UserStaffAccess { + private final boolean admin; + + private final boolean investigationAccess; + + private final boolean manager; + + private final boolean support; + + private final Map additionalProperties; + + private UserStaffAccess( + boolean admin, + boolean investigationAccess, + boolean manager, + boolean support, + Map additionalProperties) { + this.admin = admin; + this.investigationAccess = investigationAccess; + this.manager = manager; + this.support = support; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the user holds the admin staff role with a valid second factor. + */ + @JsonProperty("admin") + public boolean getAdmin() { + return admin; + } + + /** + * @return Whether the user can open Whop-internal investigation tooling right now: a qualifying staff role plus their investigation toggle switched on. + */ + @JsonProperty("investigation_access") + public boolean getInvestigationAccess() { + return investigationAccess; + } + + /** + * @return Whether the user holds the manager staff role with a valid second factor. + */ + @JsonProperty("manager") + public boolean getManager() { + return manager; + } + + /** + * @return Whether the user holds the support staff role with a valid second factor. + */ + @JsonProperty("support") + public boolean getSupport() { + return support; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserStaffAccess && equalTo((UserStaffAccess) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserStaffAccess other) { + return admin == other.admin + && investigationAccess == other.investigationAccess + && manager == other.manager + && support == other.support; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.admin, this.investigationAccess, this.manager, this.support); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdminStage builder() { + return new Builder(); + } + + public interface AdminStage { + /** + *

Whether the user holds the admin staff role with a valid second factor.

+ */ + InvestigationAccessStage admin(boolean admin); + + Builder from(UserStaffAccess other); + } + + public interface InvestigationAccessStage { + /** + *

Whether the user can open Whop-internal investigation tooling right now: a qualifying staff role plus their investigation toggle switched on.

+ */ + ManagerStage investigationAccess(boolean investigationAccess); + } + + public interface ManagerStage { + /** + *

Whether the user holds the manager staff role with a valid second factor.

+ */ + SupportStage manager(boolean manager); + } + + public interface SupportStage { + /** + *

Whether the user holds the support staff role with a valid second factor.

+ */ + _FinalStage support(boolean support); + } + + public interface _FinalStage { + UserStaffAccess build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AdminStage, InvestigationAccessStage, ManagerStage, SupportStage, _FinalStage { + private boolean admin; + + private boolean investigationAccess; + + private boolean manager; + + private boolean support; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserStaffAccess other) { + admin(other.getAdmin()); + investigationAccess(other.getInvestigationAccess()); + manager(other.getManager()); + support(other.getSupport()); + return this; + } + + /** + *

Whether the user holds the admin staff role with a valid second factor.

+ *

Whether the user holds the admin staff role with a valid second factor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("admin") + public InvestigationAccessStage admin(boolean admin) { + this.admin = admin; + return this; + } + + /** + *

Whether the user can open Whop-internal investigation tooling right now: a qualifying staff role plus their investigation toggle switched on.

+ *

Whether the user can open Whop-internal investigation tooling right now: a qualifying staff role plus their investigation toggle switched on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("investigation_access") + public ManagerStage investigationAccess(boolean investigationAccess) { + this.investigationAccess = investigationAccess; + return this; + } + + /** + *

Whether the user holds the manager staff role with a valid second factor.

+ *

Whether the user holds the manager staff role with a valid second factor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("manager") + public SupportStage manager(boolean manager) { + this.manager = manager; + return this; + } + + /** + *

Whether the user holds the support staff role with a valid second factor.

+ *

Whether the user holds the support staff role with a valid second factor.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("support") + public _FinalStage support(boolean support) { + this.support = support; + return this; + } + + @java.lang.Override + public UserStaffAccess build() { + return new UserStaffAccess(admin, investigationAccess, manager, support, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/UserSummary.java b/src/main/java/com/whop/api/types/UserSummary.java new file mode 100644 index 00000000..c01ac69d --- /dev/null +++ b/src/main/java/com/whop/api/types/UserSummary.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserSummary.Builder.class) +public final class UserSummary { + private final String id; + + private final Optional name; + + private final UserProfilePicture profilePicture; + + private final String username; + + private final Map additionalProperties; + + private UserSummary( + String id, + Optional name, + UserProfilePicture profilePicture, + String username, + Map additionalProperties) { + this.id = id; + this.name = name; + this.profilePicture = profilePicture; + this.username = username; + this.additionalProperties = additionalProperties; + } + + /** + * @return User ID, prefixed user_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Display name. + */ + @JsonIgnore + public Optional getName() { + if (name == null) { + return Optional.empty(); + } + return name; + } + + /** + * @return Avatar wrapper; its url is always present, using a generated placeholder when the user set no picture. + */ + @JsonProperty("profile_picture") + public UserProfilePicture getProfilePicture() { + return profilePicture; + } + + /** + * @return Public username. + */ + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("name") + private Optional _getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserSummary && equalTo((UserSummary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserSummary other) { + return id.equals(other.id) + && name.equals(other.name) + && profilePicture.equals(other.profilePicture) + && username.equals(other.username); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.profilePicture, this.username); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

User ID, prefixed user_.

+ */ + ProfilePictureStage id(@NotNull String id); + + Builder from(UserSummary other); + } + + public interface ProfilePictureStage { + /** + *

Avatar wrapper; its url is always present, using a generated placeholder when the user set no picture.

+ */ + UsernameStage profilePicture(@NotNull UserProfilePicture profilePicture); + } + + public interface UsernameStage { + /** + *

Public username.

+ */ + _FinalStage username(@NotNull String username); + } + + public interface _FinalStage { + UserSummary build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Display name.

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage name(Nullable name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ProfilePictureStage, UsernameStage, _FinalStage { + private String id; + + private UserProfilePicture profilePicture; + + private String username; + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserSummary other) { + id(other.getId()); + name(other.getName()); + profilePicture(other.getProfilePicture()); + username(other.getUsername()); + return this; + } + + /** + *

User ID, prefixed user_.

+ *

User ID, prefixed user_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ProfilePictureStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Avatar wrapper; its url is always present, using a generated placeholder when the user set no picture.

+ *

Avatar wrapper; its url is always present, using a generated placeholder when the user set no picture.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("profile_picture") + public UsernameStage profilePicture(@NotNull UserProfilePicture profilePicture) { + this.profilePicture = Objects.requireNonNull(profilePicture, "profilePicture must not be null"); + return this; + } + + /** + *

Public username.

+ *

Public username.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("username") + public _FinalStage username(@NotNull String username) { + this.username = Objects.requireNonNull(username, "username must not be null"); + return this; + } + + /** + *

Display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(Nullable name) { + if (name.isNull()) { + this.name = null; + } else if (name.isEmpty()) { + this.name = Optional.empty(); + } else { + this.name = Optional.of(name.get()); + } + return this; + } + + /** + *

Display name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

Display name.

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public UserSummary build() { + return new UserSummary(id, name, profilePicture, username, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/V1ErrorResponse.java b/src/main/java/com/whop/api/types/V1ErrorResponse.java new file mode 100644 index 00000000..d8f2de6b --- /dev/null +++ b/src/main/java/com/whop/api/types/V1ErrorResponse.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = V1ErrorResponse.Builder.class) +public final class V1ErrorResponse { + private final V1ErrorResponseError error; + + private final Map additionalProperties; + + private V1ErrorResponse(V1ErrorResponseError error, Map additionalProperties) { + this.error = error; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("error") + public V1ErrorResponseError getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1ErrorResponse && equalTo((V1ErrorResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1ErrorResponse other) { + return error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + _FinalStage error(@NotNull V1ErrorResponseError error); + + Builder from(V1ErrorResponse other); + } + + public interface _FinalStage { + V1ErrorResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private V1ErrorResponseError error; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(V1ErrorResponse other) { + error(other.getError()); + return this; + } + + @java.lang.Override + @JsonSetter("error") + public _FinalStage error(@NotNull V1ErrorResponseError error) { + this.error = Objects.requireNonNull(error, "error must not be null"); + return this; + } + + @java.lang.Override + public V1ErrorResponse build() { + return new V1ErrorResponse(error, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/V1ErrorResponseError.java b/src/main/java/com/whop/api/types/V1ErrorResponseError.java new file mode 100644 index 00000000..aeace891 --- /dev/null +++ b/src/main/java/com/whop/api/types/V1ErrorResponseError.java @@ -0,0 +1,206 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = V1ErrorResponseError.Builder.class) +public final class V1ErrorResponseError { + private final Optional code; + + private final String message; + + private final String type; + + private final Map additionalProperties; + + private V1ErrorResponseError( + Optional code, String message, String type, Map additionalProperties) { + this.code = code; + this.message = message; + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Machine-readable reason for this specific refusal, such as bank_warning_not_acknowledged. Only present when the error carries one. + */ + @JsonProperty("code") + public Optional getCode() { + return code; + } + + /** + * @return Human-readable error message. + */ + @JsonProperty("message") + public String getMessage() { + return message; + } + + /** + * @return Machine-readable error code. + */ + @JsonProperty("type") + public String getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1ErrorResponseError && equalTo((V1ErrorResponseError) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1ErrorResponseError other) { + return code.equals(other.code) && message.equals(other.message) && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.code, this.message, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + /** + *

Human-readable error message.

+ */ + TypeStage message(@NotNull String message); + + Builder from(V1ErrorResponseError other); + } + + public interface TypeStage { + /** + *

Machine-readable error code.

+ */ + _FinalStage type(@NotNull String type); + } + + public interface _FinalStage { + V1ErrorResponseError build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Machine-readable reason for this specific refusal, such as bank_warning_not_acknowledged. Only present when the error carries one.

+ */ + _FinalStage code(Optional code); + + _FinalStage code(String code); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, TypeStage, _FinalStage { + private String message; + + private String type; + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(V1ErrorResponseError other) { + code(other.getCode()); + message(other.getMessage()); + type(other.getType()); + return this; + } + + /** + *

Human-readable error message.

+ *

Human-readable error message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message") + public TypeStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + /** + *

Machine-readable error code.

+ *

Machine-readable error code.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

Machine-readable reason for this specific refusal, such as bank_warning_not_acknowledged. Only present when the error carries one.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

Machine-readable reason for this specific refusal, such as bank_warning_not_acknowledged. Only present when the error carries one.

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public V1ErrorResponseError build() { + return new V1ErrorResponseError(code, message, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/Verification.java b/src/main/java/com/whop/api/types/Verification.java new file mode 100644 index 00000000..93d37188 --- /dev/null +++ b/src/main/java/com/whop/api/types/Verification.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Verification.Builder.class) +public final class Verification { + private final String id; + + private final Optional lastErrorCode; + + private final Optional lastErrorReason; + + private final VerificationStatuses status; + + private final Map additionalProperties; + + private Verification( + String id, + Optional lastErrorCode, + Optional lastErrorReason, + VerificationStatuses status, + Map additionalProperties) { + this.id = id; + this.lastErrorCode = lastErrorCode; + this.lastErrorReason = lastErrorReason; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The numeric id of the verification record. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The most recent error code returned during verification. Null if no error has occurred. + */ + @JsonIgnore + public Optional getLastErrorCode() { + if (lastErrorCode == null) { + return Optional.empty(); + } + return lastErrorCode; + } + + /** + * @return A human-readable explanation of the most recent verification error. Null if no error has occurred. + */ + @JsonIgnore + public Optional getLastErrorReason() { + if (lastErrorReason == null) { + return Optional.empty(); + } + return lastErrorReason; + } + + /** + * @return The current status of this verification session. + */ + @JsonProperty("status") + public VerificationStatuses getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_error_code") + private Optional _getLastErrorCode() { + return lastErrorCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_error_reason") + private Optional _getLastErrorReason() { + return lastErrorReason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Verification && equalTo((Verification) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Verification other) { + return id.equals(other.id) + && lastErrorCode.equals(other.lastErrorCode) + && lastErrorReason.equals(other.lastErrorReason) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.lastErrorCode, this.lastErrorReason, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The numeric id of the verification record.

+ */ + StatusStage id(@NotNull String id); + + Builder from(Verification other); + } + + public interface StatusStage { + /** + *

The current status of this verification session.

+ */ + _FinalStage status(@NotNull VerificationStatuses status); + } + + public interface _FinalStage { + Verification build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ */ + _FinalStage lastErrorCode(Optional lastErrorCode); + + _FinalStage lastErrorCode(VerificationErrorCodes lastErrorCode); + + _FinalStage lastErrorCode(Nullable lastErrorCode); + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ */ + _FinalStage lastErrorReason(Optional lastErrorReason); + + _FinalStage lastErrorReason(String lastErrorReason); + + _FinalStage lastErrorReason(Nullable lastErrorReason); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, StatusStage, _FinalStage { + private String id; + + private VerificationStatuses status; + + private Optional lastErrorReason = Optional.empty(); + + private Optional lastErrorCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Verification other) { + id(other.getId()); + lastErrorCode(other.getLastErrorCode()); + lastErrorReason(other.getLastErrorReason()); + status(other.getStatus()); + return this; + } + + /** + *

The numeric id of the verification record.

+ *

The numeric id of the verification record.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current status of this verification session.

+ *

The current status of this verification session.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull VerificationStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorReason(Nullable lastErrorReason) { + if (lastErrorReason.isNull()) { + this.lastErrorReason = null; + } else if (lastErrorReason.isEmpty()) { + this.lastErrorReason = Optional.empty(); + } else { + this.lastErrorReason = Optional.of(lastErrorReason.get()); + } + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorReason(String lastErrorReason) { + this.lastErrorReason = Optional.ofNullable(lastErrorReason); + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "last_error_reason", nulls = Nulls.SKIP) + public _FinalStage lastErrorReason(Optional lastErrorReason) { + this.lastErrorReason = lastErrorReason; + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorCode(Nullable lastErrorCode) { + if (lastErrorCode.isNull()) { + this.lastErrorCode = null; + } else if (lastErrorCode.isEmpty()) { + this.lastErrorCode = Optional.empty(); + } else { + this.lastErrorCode = Optional.of(lastErrorCode.get()); + } + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorCode(VerificationErrorCodes lastErrorCode) { + this.lastErrorCode = Optional.ofNullable(lastErrorCode); + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "last_error_code", nulls = Nulls.SKIP) + public _FinalStage lastErrorCode(Optional lastErrorCode) { + this.lastErrorCode = lastErrorCode; + return this; + } + + @java.lang.Override + public Verification build() { + return new Verification(id, lastErrorCode, lastErrorReason, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/VerificationErrorCodes.java b/src/main/java/com/whop/api/types/VerificationErrorCodes.java new file mode 100644 index 00000000..7a6e956e --- /dev/null +++ b/src/main/java/com/whop/api/types/VerificationErrorCodes.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class VerificationErrorCodes { + public static final VerificationErrorCodes DEVICE_NOT_SUPPORTED = + new VerificationErrorCodes(Value.DEVICE_NOT_SUPPORTED, "device_not_supported"); + + public static final VerificationErrorCodes UNDER_SUPPORTED_AGE = + new VerificationErrorCodes(Value.UNDER_SUPPORTED_AGE, "under_supported_age"); + + public static final VerificationErrorCodes EMAIL_VERIFICATION_DECLINED = + new VerificationErrorCodes(Value.EMAIL_VERIFICATION_DECLINED, "email_verification_declined"); + + public static final VerificationErrorCodes PHONE_UNVERIFIED_OTHER = + new VerificationErrorCodes(Value.PHONE_UNVERIFIED_OTHER, "phone_unverified_other"); + + public static final VerificationErrorCodes DOCUMENT_EXPIRED = + new VerificationErrorCodes(Value.DOCUMENT_EXPIRED, "document_expired"); + + public static final VerificationErrorCodes SELFIE_FACE_MISMATCH = + new VerificationErrorCodes(Value.SELFIE_FACE_MISMATCH, "selfie_face_mismatch"); + + public static final VerificationErrorCodes ID_NUMBER_UNVERIFIED_OTHER = + new VerificationErrorCodes(Value.ID_NUMBER_UNVERIFIED_OTHER, "id_number_unverified_other"); + + public static final VerificationErrorCodes ID_NUMBER_INSUFFICIENT_DOCUMENT_DATA = new VerificationErrorCodes( + Value.ID_NUMBER_INSUFFICIENT_DOCUMENT_DATA, "id_number_insufficient_document_data"); + + public static final VerificationErrorCodes COUNTRY_NOT_SUPPORTED = + new VerificationErrorCodes(Value.COUNTRY_NOT_SUPPORTED, "country_not_supported"); + + public static final VerificationErrorCodes DOCUMENT_UNVERIFIED_OTHER = + new VerificationErrorCodes(Value.DOCUMENT_UNVERIFIED_OTHER, "document_unverified_other"); + + public static final VerificationErrorCodes EMAIL_UNVERIFIED_OTHER = + new VerificationErrorCodes(Value.EMAIL_UNVERIFIED_OTHER, "email_unverified_other"); + + public static final VerificationErrorCodes ID_NUMBER_MISMATCH = + new VerificationErrorCodes(Value.ID_NUMBER_MISMATCH, "id_number_mismatch"); + + public static final VerificationErrorCodes SELFIE_MANIPULATED = + new VerificationErrorCodes(Value.SELFIE_MANIPULATED, "selfie_manipulated"); + + public static final VerificationErrorCodes ABANDONED = new VerificationErrorCodes(Value.ABANDONED, "abandoned"); + + public static final VerificationErrorCodes CONSENT_DECLINED = + new VerificationErrorCodes(Value.CONSENT_DECLINED, "consent_declined"); + + public static final VerificationErrorCodes DOCUMENT_TYPE_NOT_SUPPORTED = + new VerificationErrorCodes(Value.DOCUMENT_TYPE_NOT_SUPPORTED, "document_type_not_supported"); + + public static final VerificationErrorCodes PHONE_VERIFICATION_DECLINED = + new VerificationErrorCodes(Value.PHONE_VERIFICATION_DECLINED, "phone_verification_declined"); + + public static final VerificationErrorCodes SELFIE_DOCUMENT_MISSING_PHOTO = + new VerificationErrorCodes(Value.SELFIE_DOCUMENT_MISSING_PHOTO, "selfie_document_missing_photo"); + + public static final VerificationErrorCodes SELFIE_UNVERIFIED_OTHER = + new VerificationErrorCodes(Value.SELFIE_UNVERIFIED_OTHER, "selfie_unverified_other"); + + private final Value value; + + private final String string; + + VerificationErrorCodes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof VerificationErrorCodes + && this.string.equals(((VerificationErrorCodes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DEVICE_NOT_SUPPORTED: + return visitor.visitDeviceNotSupported(); + case UNDER_SUPPORTED_AGE: + return visitor.visitUnderSupportedAge(); + case EMAIL_VERIFICATION_DECLINED: + return visitor.visitEmailVerificationDeclined(); + case PHONE_UNVERIFIED_OTHER: + return visitor.visitPhoneUnverifiedOther(); + case DOCUMENT_EXPIRED: + return visitor.visitDocumentExpired(); + case SELFIE_FACE_MISMATCH: + return visitor.visitSelfieFaceMismatch(); + case ID_NUMBER_UNVERIFIED_OTHER: + return visitor.visitIdNumberUnverifiedOther(); + case ID_NUMBER_INSUFFICIENT_DOCUMENT_DATA: + return visitor.visitIdNumberInsufficientDocumentData(); + case COUNTRY_NOT_SUPPORTED: + return visitor.visitCountryNotSupported(); + case DOCUMENT_UNVERIFIED_OTHER: + return visitor.visitDocumentUnverifiedOther(); + case EMAIL_UNVERIFIED_OTHER: + return visitor.visitEmailUnverifiedOther(); + case ID_NUMBER_MISMATCH: + return visitor.visitIdNumberMismatch(); + case SELFIE_MANIPULATED: + return visitor.visitSelfieManipulated(); + case ABANDONED: + return visitor.visitAbandoned(); + case CONSENT_DECLINED: + return visitor.visitConsentDeclined(); + case DOCUMENT_TYPE_NOT_SUPPORTED: + return visitor.visitDocumentTypeNotSupported(); + case PHONE_VERIFICATION_DECLINED: + return visitor.visitPhoneVerificationDeclined(); + case SELFIE_DOCUMENT_MISSING_PHOTO: + return visitor.visitSelfieDocumentMissingPhoto(); + case SELFIE_UNVERIFIED_OTHER: + return visitor.visitSelfieUnverifiedOther(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static VerificationErrorCodes valueOf(String value) { + switch (value) { + case "device_not_supported": + return DEVICE_NOT_SUPPORTED; + case "under_supported_age": + return UNDER_SUPPORTED_AGE; + case "email_verification_declined": + return EMAIL_VERIFICATION_DECLINED; + case "phone_unverified_other": + return PHONE_UNVERIFIED_OTHER; + case "document_expired": + return DOCUMENT_EXPIRED; + case "selfie_face_mismatch": + return SELFIE_FACE_MISMATCH; + case "id_number_unverified_other": + return ID_NUMBER_UNVERIFIED_OTHER; + case "id_number_insufficient_document_data": + return ID_NUMBER_INSUFFICIENT_DOCUMENT_DATA; + case "country_not_supported": + return COUNTRY_NOT_SUPPORTED; + case "document_unverified_other": + return DOCUMENT_UNVERIFIED_OTHER; + case "email_unverified_other": + return EMAIL_UNVERIFIED_OTHER; + case "id_number_mismatch": + return ID_NUMBER_MISMATCH; + case "selfie_manipulated": + return SELFIE_MANIPULATED; + case "abandoned": + return ABANDONED; + case "consent_declined": + return CONSENT_DECLINED; + case "document_type_not_supported": + return DOCUMENT_TYPE_NOT_SUPPORTED; + case "phone_verification_declined": + return PHONE_VERIFICATION_DECLINED; + case "selfie_document_missing_photo": + return SELFIE_DOCUMENT_MISSING_PHOTO; + case "selfie_unverified_other": + return SELFIE_UNVERIFIED_OTHER; + default: + return new VerificationErrorCodes(Value.UNKNOWN, value); + } + } + + public enum Value { + ABANDONED, + + CONSENT_DECLINED, + + COUNTRY_NOT_SUPPORTED, + + DEVICE_NOT_SUPPORTED, + + DOCUMENT_EXPIRED, + + DOCUMENT_TYPE_NOT_SUPPORTED, + + DOCUMENT_UNVERIFIED_OTHER, + + EMAIL_UNVERIFIED_OTHER, + + EMAIL_VERIFICATION_DECLINED, + + ID_NUMBER_INSUFFICIENT_DOCUMENT_DATA, + + ID_NUMBER_MISMATCH, + + ID_NUMBER_UNVERIFIED_OTHER, + + PHONE_UNVERIFIED_OTHER, + + PHONE_VERIFICATION_DECLINED, + + SELFIE_DOCUMENT_MISSING_PHOTO, + + SELFIE_FACE_MISMATCH, + + SELFIE_MANIPULATED, + + SELFIE_UNVERIFIED_OTHER, + + UNDER_SUPPORTED_AGE, + + UNKNOWN + } + + public interface Visitor { + T visitAbandoned(); + + T visitConsentDeclined(); + + T visitCountryNotSupported(); + + T visitDeviceNotSupported(); + + T visitDocumentExpired(); + + T visitDocumentTypeNotSupported(); + + T visitDocumentUnverifiedOther(); + + T visitEmailUnverifiedOther(); + + T visitEmailVerificationDeclined(); + + T visitIdNumberInsufficientDocumentData(); + + T visitIdNumberMismatch(); + + T visitIdNumberUnverifiedOther(); + + T visitPhoneUnverifiedOther(); + + T visitPhoneVerificationDeclined(); + + T visitSelfieDocumentMissingPhoto(); + + T visitSelfieFaceMismatch(); + + T visitSelfieManipulated(); + + T visitSelfieUnverifiedOther(); + + T visitUnderSupportedAge(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/VerificationListItem.java b/src/main/java/com/whop/api/types/VerificationListItem.java new file mode 100644 index 00000000..9e8def6e --- /dev/null +++ b/src/main/java/com/whop/api/types/VerificationListItem.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = VerificationListItem.Builder.class) +public final class VerificationListItem { + private final String id; + + private final Optional lastErrorCode; + + private final Optional lastErrorReason; + + private final VerificationStatuses status; + + private final Map additionalProperties; + + private VerificationListItem( + String id, + Optional lastErrorCode, + Optional lastErrorReason, + VerificationStatuses status, + Map additionalProperties) { + this.id = id; + this.lastErrorCode = lastErrorCode; + this.lastErrorReason = lastErrorReason; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The numeric id of the verification record. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The most recent error code returned during verification. Null if no error has occurred. + */ + @JsonIgnore + public Optional getLastErrorCode() { + if (lastErrorCode == null) { + return Optional.empty(); + } + return lastErrorCode; + } + + /** + * @return A human-readable explanation of the most recent verification error. Null if no error has occurred. + */ + @JsonIgnore + public Optional getLastErrorReason() { + if (lastErrorReason == null) { + return Optional.empty(); + } + return lastErrorReason; + } + + /** + * @return The current status of this verification session. + */ + @JsonProperty("status") + public VerificationStatuses getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_error_code") + private Optional _getLastErrorCode() { + return lastErrorCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_error_reason") + private Optional _getLastErrorReason() { + return lastErrorReason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VerificationListItem && equalTo((VerificationListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(VerificationListItem other) { + return id.equals(other.id) + && lastErrorCode.equals(other.lastErrorCode) + && lastErrorReason.equals(other.lastErrorReason) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.lastErrorCode, this.lastErrorReason, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The numeric id of the verification record.

+ */ + StatusStage id(@NotNull String id); + + Builder from(VerificationListItem other); + } + + public interface StatusStage { + /** + *

The current status of this verification session.

+ */ + _FinalStage status(@NotNull VerificationStatuses status); + } + + public interface _FinalStage { + VerificationListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ */ + _FinalStage lastErrorCode(Optional lastErrorCode); + + _FinalStage lastErrorCode(VerificationErrorCodes lastErrorCode); + + _FinalStage lastErrorCode(Nullable lastErrorCode); + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ */ + _FinalStage lastErrorReason(Optional lastErrorReason); + + _FinalStage lastErrorReason(String lastErrorReason); + + _FinalStage lastErrorReason(Nullable lastErrorReason); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, StatusStage, _FinalStage { + private String id; + + private VerificationStatuses status; + + private Optional lastErrorReason = Optional.empty(); + + private Optional lastErrorCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(VerificationListItem other) { + id(other.getId()); + lastErrorCode(other.getLastErrorCode()); + lastErrorReason(other.getLastErrorReason()); + status(other.getStatus()); + return this; + } + + /** + *

The numeric id of the verification record.

+ *

The numeric id of the verification record.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current status of this verification session.

+ *

The current status of this verification session.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull VerificationStatuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorReason(Nullable lastErrorReason) { + if (lastErrorReason.isNull()) { + this.lastErrorReason = null; + } else if (lastErrorReason.isEmpty()) { + this.lastErrorReason = Optional.empty(); + } else { + this.lastErrorReason = Optional.of(lastErrorReason.get()); + } + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorReason(String lastErrorReason) { + this.lastErrorReason = Optional.ofNullable(lastErrorReason); + return this; + } + + /** + *

A human-readable explanation of the most recent verification error. Null if no error has occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "last_error_reason", nulls = Nulls.SKIP) + public _FinalStage lastErrorReason(Optional lastErrorReason) { + this.lastErrorReason = lastErrorReason; + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorCode(Nullable lastErrorCode) { + if (lastErrorCode.isNull()) { + this.lastErrorCode = null; + } else if (lastErrorCode.isEmpty()) { + this.lastErrorCode = Optional.empty(); + } else { + this.lastErrorCode = Optional.of(lastErrorCode.get()); + } + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastErrorCode(VerificationErrorCodes lastErrorCode) { + this.lastErrorCode = Optional.ofNullable(lastErrorCode); + return this; + } + + /** + *

The most recent error code returned during verification. Null if no error has occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "last_error_code", nulls = Nulls.SKIP) + public _FinalStage lastErrorCode(Optional lastErrorCode) { + this.lastErrorCode = lastErrorCode; + return this; + } + + @java.lang.Override + public VerificationListItem build() { + return new VerificationListItem(id, lastErrorCode, lastErrorReason, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/VerificationStatuses.java b/src/main/java/com/whop/api/types/VerificationStatuses.java new file mode 100644 index 00000000..a687d90a --- /dev/null +++ b/src/main/java/com/whop/api/types/VerificationStatuses.java @@ -0,0 +1,217 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class VerificationStatuses { + public static final VerificationStatuses APPROVED = new VerificationStatuses(Value.APPROVED, "approved"); + + public static final VerificationStatuses PROCESSING = new VerificationStatuses(Value.PROCESSING, "processing"); + + public static final VerificationStatuses RESUBMISSION_REQUESTED = + new VerificationStatuses(Value.RESUBMISSION_REQUESTED, "resubmission_requested"); + + public static final VerificationStatuses SUBMITTED = new VerificationStatuses(Value.SUBMITTED, "submitted"); + + public static final VerificationStatuses ACTION_REQUIRED = + new VerificationStatuses(Value.ACTION_REQUIRED, "action_required"); + + public static final VerificationStatuses DECLINED = new VerificationStatuses(Value.DECLINED, "declined"); + + public static final VerificationStatuses MANUAL_REVIEW = + new VerificationStatuses(Value.MANUAL_REVIEW, "manual_review"); + + public static final VerificationStatuses REVIEW = new VerificationStatuses(Value.REVIEW, "review"); + + public static final VerificationStatuses CANCELED = new VerificationStatuses(Value.CANCELED, "canceled"); + + public static final VerificationStatuses REQUIRES_INPUT = + new VerificationStatuses(Value.REQUIRES_INPUT, "requires_input"); + + public static final VerificationStatuses EXPIRED = new VerificationStatuses(Value.EXPIRED, "expired"); + + public static final VerificationStatuses VERIFIED = new VerificationStatuses(Value.VERIFIED, "verified"); + + public static final VerificationStatuses ABANDONED = new VerificationStatuses(Value.ABANDONED, "abandoned"); + + public static final VerificationStatuses CREATED = new VerificationStatuses(Value.CREATED, "created"); + + public static final VerificationStatuses STARTED = new VerificationStatuses(Value.STARTED, "started"); + + private final Value value; + + private final String string; + + VerificationStatuses(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof VerificationStatuses && this.string.equals(((VerificationStatuses) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPROVED: + return visitor.visitApproved(); + case PROCESSING: + return visitor.visitProcessing(); + case RESUBMISSION_REQUESTED: + return visitor.visitResubmissionRequested(); + case SUBMITTED: + return visitor.visitSubmitted(); + case ACTION_REQUIRED: + return visitor.visitActionRequired(); + case DECLINED: + return visitor.visitDeclined(); + case MANUAL_REVIEW: + return visitor.visitManualReview(); + case REVIEW: + return visitor.visitReview(); + case CANCELED: + return visitor.visitCanceled(); + case REQUIRES_INPUT: + return visitor.visitRequiresInput(); + case EXPIRED: + return visitor.visitExpired(); + case VERIFIED: + return visitor.visitVerified(); + case ABANDONED: + return visitor.visitAbandoned(); + case CREATED: + return visitor.visitCreated(); + case STARTED: + return visitor.visitStarted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static VerificationStatuses valueOf(String value) { + switch (value) { + case "approved": + return APPROVED; + case "processing": + return PROCESSING; + case "resubmission_requested": + return RESUBMISSION_REQUESTED; + case "submitted": + return SUBMITTED; + case "action_required": + return ACTION_REQUIRED; + case "declined": + return DECLINED; + case "manual_review": + return MANUAL_REVIEW; + case "review": + return REVIEW; + case "canceled": + return CANCELED; + case "requires_input": + return REQUIRES_INPUT; + case "expired": + return EXPIRED; + case "verified": + return VERIFIED; + case "abandoned": + return ABANDONED; + case "created": + return CREATED; + case "started": + return STARTED; + default: + return new VerificationStatuses(Value.UNKNOWN, value); + } + } + + public enum Value { + REQUIRES_INPUT, + + PROCESSING, + + VERIFIED, + + CANCELED, + + CREATED, + + STARTED, + + SUBMITTED, + + APPROVED, + + DECLINED, + + RESUBMISSION_REQUESTED, + + EXPIRED, + + ABANDONED, + + REVIEW, + + ACTION_REQUIRED, + + MANUAL_REVIEW, + + UNKNOWN + } + + public interface Visitor { + T visitRequiresInput(); + + T visitProcessing(); + + T visitVerified(); + + T visitCanceled(); + + T visitCreated(); + + T visitStarted(); + + T visitSubmitted(); + + T visitApproved(); + + T visitDeclined(); + + T visitResubmissionRequested(); + + T visitExpired(); + + T visitAbandoned(); + + T visitReview(); + + T visitActionRequired(); + + T visitManualReview(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Visibility.java b/src/main/java/com/whop/api/types/Visibility.java new file mode 100644 index 00000000..11453e30 --- /dev/null +++ b/src/main/java/com/whop/api/types/Visibility.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class Visibility { + public static final Visibility VISIBLE = new Visibility(Value.VISIBLE, "visible"); + + public static final Visibility HIDDEN = new Visibility(Value.HIDDEN, "hidden"); + + public static final Visibility QUICK_LINK = new Visibility(Value.QUICK_LINK, "quick_link"); + + public static final Visibility ARCHIVED = new Visibility(Value.ARCHIVED, "archived"); + + private final Value value; + + private final String string; + + Visibility(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof Visibility && this.string.equals(((Visibility) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VISIBLE: + return visitor.visitVisible(); + case HIDDEN: + return visitor.visitHidden(); + case QUICK_LINK: + return visitor.visitQuickLink(); + case ARCHIVED: + return visitor.visitArchived(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static Visibility valueOf(String value) { + switch (value) { + case "visible": + return VISIBLE; + case "hidden": + return HIDDEN; + case "quick_link": + return QUICK_LINK; + case "archived": + return ARCHIVED; + default: + return new Visibility(Value.UNKNOWN, value); + } + } + + public enum Value { + VISIBLE, + + HIDDEN, + + ARCHIVED, + + QUICK_LINK, + + UNKNOWN + } + + public interface Visitor { + T visitVisible(); + + T visitHidden(); + + T visitArchived(); + + T visitQuickLink(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/VisibilityFilter.java b/src/main/java/com/whop/api/types/VisibilityFilter.java new file mode 100644 index 00000000..85b94276 --- /dev/null +++ b/src/main/java/com/whop/api/types/VisibilityFilter.java @@ -0,0 +1,133 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class VisibilityFilter { + public static final VisibilityFilter VISIBLE = new VisibilityFilter(Value.VISIBLE, "visible"); + + public static final VisibilityFilter HIDDEN = new VisibilityFilter(Value.HIDDEN, "hidden"); + + public static final VisibilityFilter ALL = new VisibilityFilter(Value.ALL, "all"); + + public static final VisibilityFilter NOT_QUICK_LINK = new VisibilityFilter(Value.NOT_QUICK_LINK, "not_quick_link"); + + public static final VisibilityFilter NOT_ARCHIVED = new VisibilityFilter(Value.NOT_ARCHIVED, "not_archived"); + + public static final VisibilityFilter QUICK_LINK = new VisibilityFilter(Value.QUICK_LINK, "quick_link"); + + public static final VisibilityFilter ARCHIVED = new VisibilityFilter(Value.ARCHIVED, "archived"); + + private final Value value; + + private final String string; + + VisibilityFilter(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof VisibilityFilter && this.string.equals(((VisibilityFilter) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case VISIBLE: + return visitor.visitVisible(); + case HIDDEN: + return visitor.visitHidden(); + case ALL: + return visitor.visitAll(); + case NOT_QUICK_LINK: + return visitor.visitNotQuickLink(); + case NOT_ARCHIVED: + return visitor.visitNotArchived(); + case QUICK_LINK: + return visitor.visitQuickLink(); + case ARCHIVED: + return visitor.visitArchived(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static VisibilityFilter valueOf(String value) { + switch (value) { + case "visible": + return VISIBLE; + case "hidden": + return HIDDEN; + case "all": + return ALL; + case "not_quick_link": + return NOT_QUICK_LINK; + case "not_archived": + return NOT_ARCHIVED; + case "quick_link": + return QUICK_LINK; + case "archived": + return ARCHIVED; + default: + return new VisibilityFilter(Value.UNKNOWN, value); + } + } + + public enum Value { + VISIBLE, + + HIDDEN, + + ARCHIVED, + + QUICK_LINK, + + ALL, + + NOT_QUICK_LINK, + + NOT_ARCHIVED, + + UNKNOWN + } + + public interface Visitor { + T visitVisible(); + + T visitHidden(); + + T visitArchived(); + + T visitQuickLink(); + + T visitAll(); + + T visitNotQuickLink(); + + T visitNotArchived(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Webhook.java b/src/main/java/com/whop/api/types/Webhook.java new file mode 100644 index 00000000..41d2fd6e --- /dev/null +++ b/src/main/java/com/whop/api/types/Webhook.java @@ -0,0 +1,931 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Webhook.Builder.class) +public final class Webhook { + private final WebhookApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final boolean childResourceEvents; + + private final int consecutiveFailures; + + private final String createdAt; + + private final Optional disabledAt; + + private final Optional disabledReason; + + private final boolean enabled; + + private final List events; + + private final Optional failingSince; + + private final String id; + + private final Optional lastFailureAt; + + private final String resourceId; + + private final List testableEvents; + + private final String url; + + private final Optional webhookSecret; + + private final Map additionalProperties; + + private Webhook( + WebhookApiVersion apiVersion, + Optional apiVersionDate, + boolean childResourceEvents, + int consecutiveFailures, + String createdAt, + Optional disabledAt, + Optional disabledReason, + boolean enabled, + List events, + Optional failingSince, + String id, + Optional lastFailureAt, + String resourceId, + List testableEvents, + String url, + Optional webhookSecret, + Map additionalProperties) { + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.childResourceEvents = childResourceEvents; + this.consecutiveFailures = consecutiveFailures; + this.createdAt = createdAt; + this.disabledAt = disabledAt; + this.disabledReason = disabledReason; + this.enabled = enabled; + this.events = events; + this.failingSince = failingSince; + this.id = id; + this.lastFailureAt = lastFailureAt; + this.resourceId = resourceId; + this.testableEvents = testableEvents; + this.url = url; + this.webhookSecret = webhookSecret; + this.additionalProperties = additionalProperties; + } + + /** + * @return The API version used to format payloads sent to this webhook endpoint. + */ + @JsonProperty("api_version") + public WebhookApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) that v1 payloads for this endpoint are pinned to: events serialize exactly like a REST read at this version (the native serializer where the resource has one). Null when unpinned — legacy (v2/v5) webhooks, and v1 webhooks on the legacy payload shape. + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + /** + * @return Whether events are sent for child resources. For example, if the webhook is on an account, enabling this sends events only from its connected accounts. + */ + @JsonProperty("child_resource_events") + public boolean getChildResourceEvents() { + return childResourceEvents; + } + + /** + * @return Number of consecutive deliveries whose first attempt to this endpoint failed since it last accepted one. Later retries of the same delivery do not increment it. Resets to 0 when a delivery succeeds or the webhook is re-enabled. + */ + @JsonProperty("consecutive_failures") + public int getConsecutiveFailures() { + return consecutiveFailures; + } + + /** + * @return When the webhook was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return When Whop automatically disabled this webhook, as an ISO 8601 timestamp. null unless the webhook was disabled by Whop; a webhook you disabled yourself has enabled: false and a null disabled_at. + */ + @JsonIgnore + public Optional getDisabledAt() { + if (disabledAt == null) { + return Optional.empty(); + } + return disabledAt; + } + + /** + * @return Why Whop disabled this webhook. delivery_failures means every delivery failed for 3 days straight. null when disabled_at is null. + */ + @JsonIgnore + public Optional getDisabledReason() { + if (disabledReason == null) { + return Optional.empty(); + } + return disabledReason; + } + + /** + * @return Whether this webhook endpoint is currently active and receiving events. + */ + @JsonProperty("enabled") + public boolean getEnabled() { + return enabled; + } + + @JsonProperty("events") + public List getEvents() { + return events; + } + + /** + * @return When the current failure streak began, as an ISO 8601 timestamp. Unlike last_failure_at, this is set on the streak's first failed attempt, so it shows an endpoint that is failing right now. null when the endpoint is healthy. + */ + @JsonIgnore + public Optional getFailingSince() { + if (failingSince == null) { + return Optional.empty(); + } + return failingSince; + } + + /** + * @return Webhook ID, prefixed hook_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return When a delivery to this endpoint most recently failed after exhausting retries, as an ISO 8601 timestamp. null if no delivery has ever failed. + */ + @JsonIgnore + public Optional getLastFailureAt() { + if (lastFailureAt == null) { + return Optional.empty(); + } + return lastFailureAt; + } + + /** + * @return ID of the resource (account or app) this webhook is attached to. + */ + @JsonProperty("resource_id") + public String getResourceId() { + return resourceId; + } + + @JsonProperty("testable_events") + public List getTestableEvents() { + return testableEvents; + } + + /** + * @return Destination URL where webhook payloads are delivered via HTTP POST. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + /** + * @return Secret key used to sign webhook payloads for verification. Include this in your HMAC validation logic. Returned on the create response and to interactive dashboard sessions; null for API-key and OAuth callers on later reads. + */ + @JsonIgnore + public Optional getWebhookSecret() { + if (webhookSecret == null) { + return Optional.empty(); + } + return webhookSecret; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("disabled_at") + private Optional _getDisabledAt() { + return disabledAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("disabled_reason") + private Optional _getDisabledReason() { + return disabledReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failing_since") + private Optional _getFailingSince() { + return failingSince; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_failure_at") + private Optional _getLastFailureAt() { + return lastFailureAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("webhook_secret") + private Optional _getWebhookSecret() { + return webhookSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Webhook && equalTo((Webhook) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Webhook other) { + return apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && childResourceEvents == other.childResourceEvents + && consecutiveFailures == other.consecutiveFailures + && createdAt.equals(other.createdAt) + && disabledAt.equals(other.disabledAt) + && disabledReason.equals(other.disabledReason) + && enabled == other.enabled + && events.equals(other.events) + && failingSince.equals(other.failingSince) + && id.equals(other.id) + && lastFailureAt.equals(other.lastFailureAt) + && resourceId.equals(other.resourceId) + && testableEvents.equals(other.testableEvents) + && url.equals(other.url) + && webhookSecret.equals(other.webhookSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.apiVersion, + this.apiVersionDate, + this.childResourceEvents, + this.consecutiveFailures, + this.createdAt, + this.disabledAt, + this.disabledReason, + this.enabled, + this.events, + this.failingSince, + this.id, + this.lastFailureAt, + this.resourceId, + this.testableEvents, + this.url, + this.webhookSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version used to format payloads sent to this webhook endpoint.

+ */ + ChildResourceEventsStage apiVersion(@NotNull WebhookApiVersion apiVersion); + + Builder from(Webhook other); + } + + public interface ChildResourceEventsStage { + /** + *

Whether events are sent for child resources. For example, if the webhook is on an account, enabling this sends events only from its connected accounts.

+ */ + ConsecutiveFailuresStage childResourceEvents(boolean childResourceEvents); + } + + public interface ConsecutiveFailuresStage { + /** + *

Number of consecutive deliveries whose first attempt to this endpoint failed since it last accepted one. Later retries of the same delivery do not increment it. Resets to 0 when a delivery succeeds or the webhook is re-enabled.

+ */ + CreatedAtStage consecutiveFailures(int consecutiveFailures); + } + + public interface CreatedAtStage { + /** + *

When the webhook was created, as an ISO 8601 timestamp.

+ */ + EnabledStage createdAt(@NotNull String createdAt); + } + + public interface EnabledStage { + /** + *

Whether this webhook endpoint is currently active and receiving events.

+ */ + IdStage enabled(boolean enabled); + } + + public interface IdStage { + /** + *

Webhook ID, prefixed hook_.

+ */ + ResourceIdStage id(@NotNull String id); + } + + public interface ResourceIdStage { + /** + *

ID of the resource (account or app) this webhook is attached to.

+ */ + UrlStage resourceId(@NotNull String resourceId); + } + + public interface UrlStage { + /** + *

Destination URL where webhook payloads are delivered via HTTP POST.

+ */ + _FinalStage url(@NotNull String url); + } + + public interface _FinalStage { + Webhook build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The dated API version (Api-Version-Date) that v1 payloads for this endpoint are pinned to: events serialize exactly like a REST read at this version (the native serializer where the resource has one). Null when unpinned — legacy (v2/v5) webhooks, and v1 webhooks on the legacy payload shape.

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

When Whop automatically disabled this webhook, as an ISO 8601 timestamp. null unless the webhook was disabled by Whop; a webhook you disabled yourself has enabled: false and a null disabled_at.

+ */ + _FinalStage disabledAt(Optional disabledAt); + + _FinalStage disabledAt(String disabledAt); + + _FinalStage disabledAt(Nullable disabledAt); + + /** + *

Why Whop disabled this webhook. delivery_failures means every delivery failed for 3 days straight. null when disabled_at is null.

+ */ + _FinalStage disabledReason(Optional disabledReason); + + _FinalStage disabledReason(WebhookDisabledReason disabledReason); + + _FinalStage disabledReason(Nullable disabledReason); + + _FinalStage events(List events); + + _FinalStage addEvents(WebhookEventsItem events); + + _FinalStage addAllEvents(List events); + + /** + *

When the current failure streak began, as an ISO 8601 timestamp. Unlike last_failure_at, this is set on the streak's first failed attempt, so it shows an endpoint that is failing right now. null when the endpoint is healthy.

+ */ + _FinalStage failingSince(Optional failingSince); + + _FinalStage failingSince(String failingSince); + + _FinalStage failingSince(Nullable failingSince); + + /** + *

When a delivery to this endpoint most recently failed after exhausting retries, as an ISO 8601 timestamp. null if no delivery has ever failed.

+ */ + _FinalStage lastFailureAt(Optional lastFailureAt); + + _FinalStage lastFailureAt(String lastFailureAt); + + _FinalStage lastFailureAt(Nullable lastFailureAt); + + _FinalStage testableEvents(List testableEvents); + + _FinalStage addTestableEvents(WebhookTestableEventsItem testableEvents); + + _FinalStage addAllTestableEvents(List testableEvents); + + /** + *

Secret key used to sign webhook payloads for verification. Include this in your HMAC validation logic. Returned on the create response and to interactive dashboard sessions; null for API-key and OAuth callers on later reads.

+ */ + _FinalStage webhookSecret(Optional webhookSecret); + + _FinalStage webhookSecret(String webhookSecret); + + _FinalStage webhookSecret(Nullable webhookSecret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, + ChildResourceEventsStage, + ConsecutiveFailuresStage, + CreatedAtStage, + EnabledStage, + IdStage, + ResourceIdStage, + UrlStage, + _FinalStage { + private WebhookApiVersion apiVersion; + + private boolean childResourceEvents; + + private int consecutiveFailures; + + private String createdAt; + + private boolean enabled; + + private String id; + + private String resourceId; + + private String url; + + private Optional webhookSecret = Optional.empty(); + + private List testableEvents = new ArrayList<>(); + + private Optional lastFailureAt = Optional.empty(); + + private Optional failingSince = Optional.empty(); + + private List events = new ArrayList<>(); + + private Optional disabledReason = Optional.empty(); + + private Optional disabledAt = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Webhook other) { + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + childResourceEvents(other.getChildResourceEvents()); + consecutiveFailures(other.getConsecutiveFailures()); + createdAt(other.getCreatedAt()); + disabledAt(other.getDisabledAt()); + disabledReason(other.getDisabledReason()); + enabled(other.getEnabled()); + events(other.getEvents()); + failingSince(other.getFailingSince()); + id(other.getId()); + lastFailureAt(other.getLastFailureAt()); + resourceId(other.getResourceId()); + testableEvents(other.getTestableEvents()); + url(other.getUrl()); + webhookSecret(other.getWebhookSecret()); + return this; + } + + /** + *

The API version used to format payloads sent to this webhook endpoint.

+ *

The API version used to format payloads sent to this webhook endpoint.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public ChildResourceEventsStage apiVersion(@NotNull WebhookApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + /** + *

Whether events are sent for child resources. For example, if the webhook is on an account, enabling this sends events only from its connected accounts.

+ *

Whether events are sent for child resources. For example, if the webhook is on an account, enabling this sends events only from its connected accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("child_resource_events") + public ConsecutiveFailuresStage childResourceEvents(boolean childResourceEvents) { + this.childResourceEvents = childResourceEvents; + return this; + } + + /** + *

Number of consecutive deliveries whose first attempt to this endpoint failed since it last accepted one. Later retries of the same delivery do not increment it. Resets to 0 when a delivery succeeds or the webhook is re-enabled.

+ *

Number of consecutive deliveries whose first attempt to this endpoint failed since it last accepted one. Later retries of the same delivery do not increment it. Resets to 0 when a delivery succeeds or the webhook is re-enabled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("consecutive_failures") + public CreatedAtStage consecutiveFailures(int consecutiveFailures) { + this.consecutiveFailures = consecutiveFailures; + return this; + } + + /** + *

When the webhook was created, as an ISO 8601 timestamp.

+ *

When the webhook was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public EnabledStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Whether this webhook endpoint is currently active and receiving events.

+ *

Whether this webhook endpoint is currently active and receiving events.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("enabled") + public IdStage enabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + *

Webhook ID, prefixed hook_.

+ *

Webhook ID, prefixed hook_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ResourceIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

ID of the resource (account or app) this webhook is attached to.

+ *

ID of the resource (account or app) this webhook is attached to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_id") + public UrlStage resourceId(@NotNull String resourceId) { + this.resourceId = Objects.requireNonNull(resourceId, "resourceId must not be null"); + return this; + } + + /** + *

Destination URL where webhook payloads are delivered via HTTP POST.

+ *

Destination URL where webhook payloads are delivered via HTTP POST.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + /** + *

Secret key used to sign webhook payloads for verification. Include this in your HMAC validation logic. Returned on the create response and to interactive dashboard sessions; null for API-key and OAuth callers on later reads.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage webhookSecret(Nullable webhookSecret) { + if (webhookSecret.isNull()) { + this.webhookSecret = null; + } else if (webhookSecret.isEmpty()) { + this.webhookSecret = Optional.empty(); + } else { + this.webhookSecret = Optional.of(webhookSecret.get()); + } + return this; + } + + /** + *

Secret key used to sign webhook payloads for verification. Include this in your HMAC validation logic. Returned on the create response and to interactive dashboard sessions; null for API-key and OAuth callers on later reads.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage webhookSecret(String webhookSecret) { + this.webhookSecret = Optional.ofNullable(webhookSecret); + return this; + } + + /** + *

Secret key used to sign webhook payloads for verification. Include this in your HMAC validation logic. Returned on the create response and to interactive dashboard sessions; null for API-key and OAuth callers on later reads.

+ */ + @java.lang.Override + @JsonSetter(value = "webhook_secret", nulls = Nulls.SKIP) + public _FinalStage webhookSecret(Optional webhookSecret) { + this.webhookSecret = webhookSecret; + return this; + } + + @java.lang.Override + public _FinalStage addAllTestableEvents(List testableEvents) { + if (testableEvents != null) { + this.testableEvents.addAll(testableEvents); + } + return this; + } + + @java.lang.Override + public _FinalStage addTestableEvents(WebhookTestableEventsItem testableEvents) { + this.testableEvents.add(testableEvents); + return this; + } + + @java.lang.Override + @JsonSetter(value = "testable_events", nulls = Nulls.SKIP) + public _FinalStage testableEvents(List testableEvents) { + this.testableEvents.clear(); + if (testableEvents != null) { + this.testableEvents.addAll(testableEvents); + } + return this; + } + + /** + *

When a delivery to this endpoint most recently failed after exhausting retries, as an ISO 8601 timestamp. null if no delivery has ever failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastFailureAt(Nullable lastFailureAt) { + if (lastFailureAt.isNull()) { + this.lastFailureAt = null; + } else if (lastFailureAt.isEmpty()) { + this.lastFailureAt = Optional.empty(); + } else { + this.lastFailureAt = Optional.of(lastFailureAt.get()); + } + return this; + } + + /** + *

When a delivery to this endpoint most recently failed after exhausting retries, as an ISO 8601 timestamp. null if no delivery has ever failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastFailureAt(String lastFailureAt) { + this.lastFailureAt = Optional.ofNullable(lastFailureAt); + return this; + } + + /** + *

When a delivery to this endpoint most recently failed after exhausting retries, as an ISO 8601 timestamp. null if no delivery has ever failed.

+ */ + @java.lang.Override + @JsonSetter(value = "last_failure_at", nulls = Nulls.SKIP) + public _FinalStage lastFailureAt(Optional lastFailureAt) { + this.lastFailureAt = lastFailureAt; + return this; + } + + /** + *

When the current failure streak began, as an ISO 8601 timestamp. Unlike last_failure_at, this is set on the streak's first failed attempt, so it shows an endpoint that is failing right now. null when the endpoint is healthy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failingSince(Nullable failingSince) { + if (failingSince.isNull()) { + this.failingSince = null; + } else if (failingSince.isEmpty()) { + this.failingSince = Optional.empty(); + } else { + this.failingSince = Optional.of(failingSince.get()); + } + return this; + } + + /** + *

When the current failure streak began, as an ISO 8601 timestamp. Unlike last_failure_at, this is set on the streak's first failed attempt, so it shows an endpoint that is failing right now. null when the endpoint is healthy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failingSince(String failingSince) { + this.failingSince = Optional.ofNullable(failingSince); + return this; + } + + /** + *

When the current failure streak began, as an ISO 8601 timestamp. Unlike last_failure_at, this is set on the streak's first failed attempt, so it shows an endpoint that is failing right now. null when the endpoint is healthy.

+ */ + @java.lang.Override + @JsonSetter(value = "failing_since", nulls = Nulls.SKIP) + public _FinalStage failingSince(Optional failingSince) { + this.failingSince = failingSince; + return this; + } + + @java.lang.Override + public _FinalStage addAllEvents(List events) { + if (events != null) { + this.events.addAll(events); + } + return this; + } + + @java.lang.Override + public _FinalStage addEvents(WebhookEventsItem events) { + this.events.add(events); + return this; + } + + @java.lang.Override + @JsonSetter(value = "events", nulls = Nulls.SKIP) + public _FinalStage events(List events) { + this.events.clear(); + if (events != null) { + this.events.addAll(events); + } + return this; + } + + /** + *

Why Whop disabled this webhook. delivery_failures means every delivery failed for 3 days straight. null when disabled_at is null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disabledReason(Nullable disabledReason) { + if (disabledReason.isNull()) { + this.disabledReason = null; + } else if (disabledReason.isEmpty()) { + this.disabledReason = Optional.empty(); + } else { + this.disabledReason = Optional.of(disabledReason.get()); + } + return this; + } + + /** + *

Why Whop disabled this webhook. delivery_failures means every delivery failed for 3 days straight. null when disabled_at is null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disabledReason(WebhookDisabledReason disabledReason) { + this.disabledReason = Optional.ofNullable(disabledReason); + return this; + } + + /** + *

Why Whop disabled this webhook. delivery_failures means every delivery failed for 3 days straight. null when disabled_at is null.

+ */ + @java.lang.Override + @JsonSetter(value = "disabled_reason", nulls = Nulls.SKIP) + public _FinalStage disabledReason(Optional disabledReason) { + this.disabledReason = disabledReason; + return this; + } + + /** + *

When Whop automatically disabled this webhook, as an ISO 8601 timestamp. null unless the webhook was disabled by Whop; a webhook you disabled yourself has enabled: false and a null disabled_at.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disabledAt(Nullable disabledAt) { + if (disabledAt.isNull()) { + this.disabledAt = null; + } else if (disabledAt.isEmpty()) { + this.disabledAt = Optional.empty(); + } else { + this.disabledAt = Optional.of(disabledAt.get()); + } + return this; + } + + /** + *

When Whop automatically disabled this webhook, as an ISO 8601 timestamp. null unless the webhook was disabled by Whop; a webhook you disabled yourself has enabled: false and a null disabled_at.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disabledAt(String disabledAt) { + this.disabledAt = Optional.ofNullable(disabledAt); + return this; + } + + /** + *

When Whop automatically disabled this webhook, as an ISO 8601 timestamp. null unless the webhook was disabled by Whop; a webhook you disabled yourself has enabled: false and a null disabled_at.

+ */ + @java.lang.Override + @JsonSetter(value = "disabled_at", nulls = Nulls.SKIP) + public _FinalStage disabledAt(Optional disabledAt) { + this.disabledAt = disabledAt; + return this; + } + + /** + *

The dated API version (Api-Version-Date) that v1 payloads for this endpoint are pinned to: events serialize exactly like a REST read at this version (the native serializer where the resource has one). Null when unpinned — legacy (v2/v5) webhooks, and v1 webhooks on the legacy payload shape.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) that v1 payloads for this endpoint are pinned to: events serialize exactly like a REST read at this version (the native serializer where the resource has one). Null when unpinned — legacy (v2/v5) webhooks, and v1 webhooks on the legacy payload shape.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) that v1 payloads for this endpoint are pinned to: events serialize exactly like a REST read at this version (the native serializer where the resource has one). Null when unpinned — legacy (v2/v5) webhooks, and v1 webhooks on the legacy payload shape.

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + @java.lang.Override + public Webhook build() { + return new Webhook( + apiVersion, + apiVersionDate, + childResourceEvents, + consecutiveFailures, + createdAt, + disabledAt, + disabledReason, + enabled, + events, + failingSince, + id, + lastFailureAt, + resourceId, + testableEvents, + url, + webhookSecret, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/WebhookApiVersion.java b/src/main/java/com/whop/api/types/WebhookApiVersion.java new file mode 100644 index 00000000..86795b68 --- /dev/null +++ b/src/main/java/com/whop/api/types/WebhookApiVersion.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WebhookApiVersion { + public static final WebhookApiVersion V2 = new WebhookApiVersion(Value.V2, "v2"); + + public static final WebhookApiVersion V1 = new WebhookApiVersion(Value.V1, "v1"); + + public static final WebhookApiVersion V5 = new WebhookApiVersion(Value.V5, "v5"); + + private final Value value; + + private final String string; + + WebhookApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof WebhookApiVersion && this.string.equals(((WebhookApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V2: + return visitor.visitV2(); + case V1: + return visitor.visitV1(); + case V5: + return visitor.visitV5(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WebhookApiVersion valueOf(String value) { + switch (value) { + case "v2": + return V2; + case "v1": + return V1; + case "v5": + return V5; + default: + return new WebhookApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + V2, + + V5, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitV2(); + + T visitV5(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/WebhookDelivery.java b/src/main/java/com/whop/api/types/WebhookDelivery.java new file mode 100644 index 00000000..5385b907 --- /dev/null +++ b/src/main/java/com/whop/api/types/WebhookDelivery.java @@ -0,0 +1,610 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = WebhookDelivery.Builder.class) +public final class WebhookDelivery { + private final Optional event; + + private final String id; + + private final Optional replayedFrom; + + private final Map requestBody; + + private final String resourceId; + + private final Optional> responseBody; + + private final double responseCode; + + private final String sentAt; + + private final boolean success; + + private final double totalTime; + + private final Map additionalProperties; + + private WebhookDelivery( + Optional event, + String id, + Optional replayedFrom, + Map requestBody, + String resourceId, + Optional> responseBody, + double responseCode, + String sentAt, + boolean success, + double totalTime, + Map additionalProperties) { + this.event = event; + this.id = id; + this.replayedFrom = replayedFrom; + this.requestBody = requestBody; + this.resourceId = resourceId; + this.responseBody = responseBody; + this.responseCode = responseCode; + this.sentAt = sentAt; + this.success = success; + this.totalTime = totalTime; + this.additionalProperties = additionalProperties; + } + + /** + * @return The event type this delivery carried, for example payment.succeeded. + */ + @JsonIgnore + public Optional getEvent() { + if (event == null) { + return Optional.empty(); + } + return event; + } + + /** + * @return Unique identifier for this delivery attempt. Pass it to the replay endpoint to re-send this exact payload. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The id of the delivery attempt this one replayed. null for an original delivery. + */ + @JsonIgnore + public Optional getReplayedFrom() { + if (replayedFrom == null) { + return Optional.empty(); + } + return replayedFrom; + } + + /** + * @return The JSON event payload sent to the webhook endpoint. + */ + @JsonProperty("request_body") + public Map getRequestBody() { + return requestBody; + } + + /** + * @return ID of the resource that triggered the webhook. + */ + @JsonProperty("resource_id") + public String getResourceId() { + return resourceId; + } + + /** + * @return The endpoint's JSON response. A non-JSON response is stored as { error, raw_body } with the first 100 bytes. + */ + @JsonIgnore + public Optional> getResponseBody() { + if (responseBody == null) { + return Optional.empty(); + } + return responseBody; + } + + /** + * @return HTTP response code received from the webhook endpoint. + */ + @JsonProperty("response_code") + public double getResponseCode() { + return responseCode; + } + + /** + * @return When the webhook was sent, as an ISO 8601 timestamp. + */ + @JsonProperty("sent_at") + public String getSentAt() { + return sentAt; + } + + /** + * @return Whether the endpoint acknowledged this attempt with a 2xx response. + */ + @JsonProperty("success") + public boolean getSuccess() { + return success; + } + + /** + * @return Total time taken to send the webhook request, in seconds. + */ + @JsonProperty("total_time") + public double getTotalTime() { + return totalTime; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("event") + private Optional _getEvent() { + return event; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("replayed_from") + private Optional _getReplayedFrom() { + return replayedFrom; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("response_body") + private Optional> _getResponseBody() { + return responseBody; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WebhookDelivery && equalTo((WebhookDelivery) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WebhookDelivery other) { + return event.equals(other.event) + && id.equals(other.id) + && replayedFrom.equals(other.replayedFrom) + && requestBody.equals(other.requestBody) + && resourceId.equals(other.resourceId) + && responseBody.equals(other.responseBody) + && responseCode == other.responseCode + && sentAt.equals(other.sentAt) + && success == other.success + && totalTime == other.totalTime; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.event, + this.id, + this.replayedFrom, + this.requestBody, + this.resourceId, + this.responseBody, + this.responseCode, + this.sentAt, + this.success, + this.totalTime); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Unique identifier for this delivery attempt. Pass it to the replay endpoint to re-send this exact payload.

+ */ + ResourceIdStage id(@NotNull String id); + + Builder from(WebhookDelivery other); + } + + public interface ResourceIdStage { + /** + *

ID of the resource that triggered the webhook.

+ */ + ResponseCodeStage resourceId(@NotNull String resourceId); + } + + public interface ResponseCodeStage { + /** + *

HTTP response code received from the webhook endpoint.

+ */ + SentAtStage responseCode(double responseCode); + } + + public interface SentAtStage { + /** + *

When the webhook was sent, as an ISO 8601 timestamp.

+ */ + SuccessStage sentAt(@NotNull String sentAt); + } + + public interface SuccessStage { + /** + *

Whether the endpoint acknowledged this attempt with a 2xx response.

+ */ + TotalTimeStage success(boolean success); + } + + public interface TotalTimeStage { + /** + *

Total time taken to send the webhook request, in seconds.

+ */ + _FinalStage totalTime(double totalTime); + } + + public interface _FinalStage { + WebhookDelivery build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The event type this delivery carried, for example payment.succeeded.

+ */ + _FinalStage event(Optional event); + + _FinalStage event(String event); + + _FinalStage event(Nullable event); + + /** + *

The id of the delivery attempt this one replayed. null for an original delivery.

+ */ + _FinalStage replayedFrom(Optional replayedFrom); + + _FinalStage replayedFrom(String replayedFrom); + + _FinalStage replayedFrom(Nullable replayedFrom); + + /** + *

The JSON event payload sent to the webhook endpoint.

+ */ + _FinalStage requestBody(Map requestBody); + + _FinalStage putAllRequestBody(Map requestBody); + + _FinalStage requestBody(String key, Object value); + + /** + *

The endpoint's JSON response. A non-JSON response is stored as { error, raw_body } with the first 100 bytes.

+ */ + _FinalStage responseBody(Optional> responseBody); + + _FinalStage responseBody(Map responseBody); + + _FinalStage responseBody(Nullable> responseBody); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, + ResourceIdStage, + ResponseCodeStage, + SentAtStage, + SuccessStage, + TotalTimeStage, + _FinalStage { + private String id; + + private String resourceId; + + private double responseCode; + + private String sentAt; + + private boolean success; + + private double totalTime; + + private Optional> responseBody = Optional.empty(); + + private Map requestBody = new LinkedHashMap<>(); + + private Optional replayedFrom = Optional.empty(); + + private Optional event = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(WebhookDelivery other) { + event(other.getEvent()); + id(other.getId()); + replayedFrom(other.getReplayedFrom()); + requestBody(other.getRequestBody()); + resourceId(other.getResourceId()); + responseBody(other.getResponseBody()); + responseCode(other.getResponseCode()); + sentAt(other.getSentAt()); + success(other.getSuccess()); + totalTime(other.getTotalTime()); + return this; + } + + /** + *

Unique identifier for this delivery attempt. Pass it to the replay endpoint to re-send this exact payload.

+ *

Unique identifier for this delivery attempt. Pass it to the replay endpoint to re-send this exact payload.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ResourceIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

ID of the resource that triggered the webhook.

+ *

ID of the resource that triggered the webhook.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_id") + public ResponseCodeStage resourceId(@NotNull String resourceId) { + this.resourceId = Objects.requireNonNull(resourceId, "resourceId must not be null"); + return this; + } + + /** + *

HTTP response code received from the webhook endpoint.

+ *

HTTP response code received from the webhook endpoint.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("response_code") + public SentAtStage responseCode(double responseCode) { + this.responseCode = responseCode; + return this; + } + + /** + *

When the webhook was sent, as an ISO 8601 timestamp.

+ *

When the webhook was sent, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sent_at") + public SuccessStage sentAt(@NotNull String sentAt) { + this.sentAt = Objects.requireNonNull(sentAt, "sentAt must not be null"); + return this; + } + + /** + *

Whether the endpoint acknowledged this attempt with a 2xx response.

+ *

Whether the endpoint acknowledged this attempt with a 2xx response.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("success") + public TotalTimeStage success(boolean success) { + this.success = success; + return this; + } + + /** + *

Total time taken to send the webhook request, in seconds.

+ *

Total time taken to send the webhook request, in seconds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_time") + public _FinalStage totalTime(double totalTime) { + this.totalTime = totalTime; + return this; + } + + /** + *

The endpoint's JSON response. A non-JSON response is stored as { error, raw_body } with the first 100 bytes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage responseBody(Nullable> responseBody) { + if (responseBody.isNull()) { + this.responseBody = null; + } else if (responseBody.isEmpty()) { + this.responseBody = Optional.empty(); + } else { + this.responseBody = Optional.of(responseBody.get()); + } + return this; + } + + /** + *

The endpoint's JSON response. A non-JSON response is stored as { error, raw_body } with the first 100 bytes.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage responseBody(Map responseBody) { + this.responseBody = Optional.ofNullable(responseBody); + return this; + } + + /** + *

The endpoint's JSON response. A non-JSON response is stored as { error, raw_body } with the first 100 bytes.

+ */ + @java.lang.Override + @JsonSetter(value = "response_body", nulls = Nulls.SKIP) + public _FinalStage responseBody(Optional> responseBody) { + this.responseBody = responseBody; + return this; + } + + /** + *

The JSON event payload sent to the webhook endpoint.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requestBody(String key, Object value) { + this.requestBody.put(key, value); + return this; + } + + /** + *

The JSON event payload sent to the webhook endpoint.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllRequestBody(Map requestBody) { + if (requestBody != null) { + this.requestBody.putAll(requestBody); + } + return this; + } + + /** + *

The JSON event payload sent to the webhook endpoint.

+ */ + @java.lang.Override + @JsonSetter(value = "request_body", nulls = Nulls.SKIP) + public _FinalStage requestBody(Map requestBody) { + this.requestBody.clear(); + if (requestBody != null) { + this.requestBody.putAll(requestBody); + } + return this; + } + + /** + *

The id of the delivery attempt this one replayed. null for an original delivery.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage replayedFrom(Nullable replayedFrom) { + if (replayedFrom.isNull()) { + this.replayedFrom = null; + } else if (replayedFrom.isEmpty()) { + this.replayedFrom = Optional.empty(); + } else { + this.replayedFrom = Optional.of(replayedFrom.get()); + } + return this; + } + + /** + *

The id of the delivery attempt this one replayed. null for an original delivery.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage replayedFrom(String replayedFrom) { + this.replayedFrom = Optional.ofNullable(replayedFrom); + return this; + } + + /** + *

The id of the delivery attempt this one replayed. null for an original delivery.

+ */ + @java.lang.Override + @JsonSetter(value = "replayed_from", nulls = Nulls.SKIP) + public _FinalStage replayedFrom(Optional replayedFrom) { + this.replayedFrom = replayedFrom; + return this; + } + + /** + *

The event type this delivery carried, for example payment.succeeded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage event(Nullable event) { + if (event.isNull()) { + this.event = null; + } else if (event.isEmpty()) { + this.event = Optional.empty(); + } else { + this.event = Optional.of(event.get()); + } + return this; + } + + /** + *

The event type this delivery carried, for example payment.succeeded.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage event(String event) { + this.event = Optional.ofNullable(event); + return this; + } + + /** + *

The event type this delivery carried, for example payment.succeeded.

+ */ + @java.lang.Override + @JsonSetter(value = "event", nulls = Nulls.SKIP) + public _FinalStage event(Optional event) { + this.event = event; + return this; + } + + @java.lang.Override + public WebhookDelivery build() { + return new WebhookDelivery( + event, + id, + replayedFrom, + requestBody, + resourceId, + responseBody, + responseCode, + sentAt, + success, + totalTime, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/WebhookDisabledReason.java b/src/main/java/com/whop/api/types/WebhookDisabledReason.java new file mode 100644 index 00000000..bfd10905 --- /dev/null +++ b/src/main/java/com/whop/api/types/WebhookDisabledReason.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WebhookDisabledReason { + public static final WebhookDisabledReason DELIVERY_FAILURES = + new WebhookDisabledReason(Value.DELIVERY_FAILURES, "delivery_failures"); + + private final Value value; + + private final String string; + + WebhookDisabledReason(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof WebhookDisabledReason + && this.string.equals(((WebhookDisabledReason) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DELIVERY_FAILURES: + return visitor.visitDeliveryFailures(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WebhookDisabledReason valueOf(String value) { + switch (value) { + case "delivery_failures": + return DELIVERY_FAILURES; + default: + return new WebhookDisabledReason(Value.UNKNOWN, value); + } + } + + public enum Value { + DELIVERY_FAILURES, + + UNKNOWN + } + + public interface Visitor { + T visitDeliveryFailures(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/WebhookEvent.java b/src/main/java/com/whop/api/types/WebhookEvent.java new file mode 100644 index 00000000..616c087c --- /dev/null +++ b/src/main/java/com/whop/api/types/WebhookEvent.java @@ -0,0 +1,850 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WebhookEvent { + public static final WebhookEvent RESOLUTION_CENTER_CASE_CREATED = + new WebhookEvent(Value.RESOLUTION_CENTER_CASE_CREATED, "resolution_center_case.created"); + + public static final WebhookEvent AD_CAMPAIGN_PAYMENT_FAILED = + new WebhookEvent(Value.AD_CAMPAIGN_PAYMENT_FAILED, "ad_campaign.payment_failed"); + + public static final WebhookEvent IDENTITY_PROFILE_REJECTED = + new WebhookEvent(Value.IDENTITY_PROFILE_REJECTED, "identity_profile.rejected"); + + public static final WebhookEvent PLAN_DELETED = new WebhookEvent(Value.PLAN_DELETED, "plan.deleted"); + + public static final WebhookEvent PAYOUT_METHOD_CREATED = + new WebhookEvent(Value.PAYOUT_METHOD_CREATED, "payout_method.created"); + + public static final WebhookEvent TRANSFER_COMPLETED = + new WebhookEvent(Value.TRANSFER_COMPLETED, "transfer.completed"); + + public static final WebhookEvent CARD_APPLICATION_DENIED = + new WebhookEvent(Value.CARD_APPLICATION_DENIED, "card_application.denied"); + + public static final WebhookEvent TRANSFER_CREATED = new WebhookEvent(Value.TRANSFER_CREATED, "transfer.created"); + + public static final WebhookEvent CARD_APPLICATION_CREATED = + new WebhookEvent(Value.CARD_APPLICATION_CREATED, "card_application.created"); + + public static final WebhookEvent MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED = + new WebhookEvent(Value.MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, "membership.cancel_at_period_end_changed"); + + public static final WebhookEvent ENTRY_DENIED = new WebhookEvent(Value.ENTRY_DENIED, "entry.denied"); + + public static final WebhookEvent TRANSFER_FAILED = new WebhookEvent(Value.TRANSFER_FAILED, "transfer.failed"); + + public static final WebhookEvent COURSE_LESSON_INTERACTION_COMPLETED = + new WebhookEvent(Value.COURSE_LESSON_INTERACTION_COMPLETED, "course_lesson_interaction.completed"); + + public static final WebhookEvent CARD_CANCELED = new WebhookEvent(Value.CARD_CANCELED, "card.canceled"); + + public static final WebhookEvent DEPOSIT_SUCCEEDED = new WebhookEvent(Value.DEPOSIT_SUCCEEDED, "deposit.succeeded"); + + public static final WebhookEvent VERIFICATION_SUCCEEDED = + new WebhookEvent(Value.VERIFICATION_SUCCEEDED, "verification.succeeded"); + + public static final WebhookEvent PLAN_UPDATED = new WebhookEvent(Value.PLAN_UPDATED, "plan.updated"); + + public static final WebhookEvent PRODUCT_CREATED = new WebhookEvent(Value.PRODUCT_CREATED, "product.created"); + + public static final WebhookEvent MEMBER_CREATED = new WebhookEvent(Value.MEMBER_CREATED, "member.created"); + + public static final WebhookEvent SETUP_INTENT_SUCCEEDED = + new WebhookEvent(Value.SETUP_INTENT_SUCCEEDED, "setup_intent.succeeded"); + + public static final WebhookEvent CARD_TRANSACTION_COMPLETED = + new WebhookEvent(Value.CARD_TRANSACTION_COMPLETED, "card_transaction.completed"); + + public static final WebhookEvent MEMBERSHIP_DEACTIVATED = + new WebhookEvent(Value.MEMBERSHIP_DEACTIVATED, "membership.deactivated"); + + public static final WebhookEvent CARD_TRANSACTION_REVERSED = + new WebhookEvent(Value.CARD_TRANSACTION_REVERSED, "card_transaction.reversed"); + + public static final WebhookEvent CARD_FROZEN = new WebhookEvent(Value.CARD_FROZEN, "card.frozen"); + + public static final WebhookEvent WITHDRAWAL_UPDATED = + new WebhookEvent(Value.WITHDRAWAL_UPDATED, "withdrawal.updated"); + + public static final WebhookEvent SETUP_INTENT_CANCELED = + new WebhookEvent(Value.SETUP_INTENT_CANCELED, "setup_intent.canceled"); + + public static final WebhookEvent CARD_CREATED = new WebhookEvent(Value.CARD_CREATED, "card.created"); + + public static final WebhookEvent RESOLUTION_CENTER_CASE_UPDATED = + new WebhookEvent(Value.RESOLUTION_CENTER_CASE_UPDATED, "resolution_center_case.updated"); + + public static final WebhookEvent PRODUCT_UNPUBLISHED = + new WebhookEvent(Value.PRODUCT_UNPUBLISHED, "product.unpublished"); + + public static final WebhookEvent PAYMENT_FAILED = new WebhookEvent(Value.PAYMENT_FAILED, "payment.failed"); + + public static final WebhookEvent ENTRY_DELETED = new WebhookEvent(Value.ENTRY_DELETED, "entry.deleted"); + + public static final WebhookEvent SWAP_COMPLETED = new WebhookEvent(Value.SWAP_COMPLETED, "swap.completed"); + + public static final WebhookEvent ENTRY_APPROVED = new WebhookEvent(Value.ENTRY_APPROVED, "entry.approved"); + + public static final WebhookEvent DISPUTE_ALERT_CREATED = + new WebhookEvent(Value.DISPUTE_ALERT_CREATED, "dispute_alert.created"); + + public static final WebhookEvent CARD_TRANSACTION_CREATED = + new WebhookEvent(Value.CARD_TRANSACTION_CREATED, "card_transaction.created"); + + public static final WebhookEvent REFUND_UPDATED = new WebhookEvent(Value.REFUND_UPDATED, "refund.updated"); + + public static final WebhookEvent WITHDRAWAL_REVERSED = + new WebhookEvent(Value.WITHDRAWAL_REVERSED, "withdrawal.reversed"); + + public static final WebhookEvent PAYOUT_ACCOUNT_STATUS_UPDATED = + new WebhookEvent(Value.PAYOUT_ACCOUNT_STATUS_UPDATED, "payout_account.status_updated"); + + public static final WebhookEvent IDENTITY_PROFILE_APPROVED = + new WebhookEvent(Value.IDENTITY_PROFILE_APPROVED, "identity_profile.approved"); + + public static final WebhookEvent SHIPMENT_CREATED = new WebhookEvent(Value.SHIPMENT_CREATED, "shipment.created"); + + public static final WebhookEvent DISPUTE_UPDATED = new WebhookEvent(Value.DISPUTE_UPDATED, "dispute.updated"); + + public static final WebhookEvent ENTRY_CREATED = new WebhookEvent(Value.ENTRY_CREATED, "entry.created"); + + public static final WebhookEvent PRODUCT_UPDATED = new WebhookEvent(Value.PRODUCT_UPDATED, "product.updated"); + + public static final WebhookEvent ACCOUNT_UPDATED = new WebhookEvent(Value.ACCOUNT_UPDATED, "account.updated"); + + public static final WebhookEvent WITHDRAWAL_CREATED = + new WebhookEvent(Value.WITHDRAWAL_CREATED, "withdrawal.created"); + + public static final WebhookEvent CHAT_MESSAGE_CREATED = + new WebhookEvent(Value.CHAT_MESSAGE_CREATED, "chat.message.created"); + + public static final WebhookEvent LEDGER_ACCOUNT_FUNDS_AVAILABLE = + new WebhookEvent(Value.LEDGER_ACCOUNT_FUNDS_AVAILABLE, "ledger_account.funds_available"); + + public static final WebhookEvent MEMBERSHIP_ACTIVATED = + new WebhookEvent(Value.MEMBERSHIP_ACTIVATED, "membership.activated"); + + public static final WebhookEvent PAYMENT_PENDING = new WebhookEvent(Value.PAYMENT_PENDING, "payment.pending"); + + public static final WebhookEvent MEMBERSHIP_TRIAL_ENDING_SOON = + new WebhookEvent(Value.MEMBERSHIP_TRIAL_ENDING_SOON, "membership.trial_ending_soon"); + + public static final WebhookEvent REFUND_CREATED = new WebhookEvent(Value.REFUND_CREATED, "refund.created"); + + public static final WebhookEvent CARD_UPDATED = new WebhookEvent(Value.CARD_UPDATED, "card.updated"); + + public static final WebhookEvent CARD_APPLICATION_APPROVED = + new WebhookEvent(Value.CARD_APPLICATION_APPROVED, "card_application.approved"); + + public static final WebhookEvent PRODUCT_DELETED = new WebhookEvent(Value.PRODUCT_DELETED, "product.deleted"); + + public static final WebhookEvent PAYMENT_CREATED = new WebhookEvent(Value.PAYMENT_CREATED, "payment.created"); + + public static final WebhookEvent INVOICE_MARKED_UNCOLLECTIBLE = + new WebhookEvent(Value.INVOICE_MARKED_UNCOLLECTIBLE, "invoice.marked_uncollectible"); + + public static final WebhookEvent RESOLUTION_CENTER_CASE_DECIDED = + new WebhookEvent(Value.RESOLUTION_CENTER_CASE_DECIDED, "resolution_center_case.decided"); + + public static final WebhookEvent EXPORT_COMPLETED = new WebhookEvent(Value.EXPORT_COMPLETED, "export.completed"); + + public static final WebhookEvent PRODUCT_PUBLISHED = new WebhookEvent(Value.PRODUCT_PUBLISHED, "product.published"); + + public static final WebhookEvent CARD_APPLICATION_UPDATED = + new WebhookEvent(Value.CARD_APPLICATION_UPDATED, "card_application.updated"); + + public static final WebhookEvent EXPORT_FAILED = new WebhookEvent(Value.EXPORT_FAILED, "export.failed"); + + public static final WebhookEvent CARD_TRANSACTION_UPDATED = + new WebhookEvent(Value.CARD_TRANSACTION_UPDATED, "card_transaction.updated"); + + public static final WebhookEvent CHAT_REACTION_CREATED = + new WebhookEvent(Value.CHAT_REACTION_CREATED, "chat.reaction.created"); + + public static final WebhookEvent PAYMENT_SUCCEEDED = new WebhookEvent(Value.PAYMENT_SUCCEEDED, "payment.succeeded"); + + public static final WebhookEvent SHIPMENT_UPDATED = new WebhookEvent(Value.SHIPMENT_UPDATED, "shipment.updated"); + + public static final WebhookEvent DISPUTE_CREATED = new WebhookEvent(Value.DISPUTE_CREATED, "dispute.created"); + + public static final WebhookEvent INVOICE_CREATED = new WebhookEvent(Value.INVOICE_CREATED, "invoice.created"); + + public static final WebhookEvent INVOICE_PAST_DUE = new WebhookEvent(Value.INVOICE_PAST_DUE, "invoice.past_due"); + + public static final WebhookEvent IDENTITY_PROFILE_NEEDS_ACTION = + new WebhookEvent(Value.IDENTITY_PROFILE_NEEDS_ACTION, "identity_profile.needs_action"); + + public static final WebhookEvent INVOICE_PAID = new WebhookEvent(Value.INVOICE_PAID, "invoice.paid"); + + public static final WebhookEvent PLAN_CREATED = new WebhookEvent(Value.PLAN_CREATED, "plan.created"); + + public static final WebhookEvent SETUP_INTENT_REQUIRES_ACTION = + new WebhookEvent(Value.SETUP_INTENT_REQUIRES_ACTION, "setup_intent.requires_action"); + + public static final WebhookEvent INVOICE_VOIDED = new WebhookEvent(Value.INVOICE_VOIDED, "invoice.voided"); + + public static final WebhookEvent CARD_TRANSACTION_DECLINED = + new WebhookEvent(Value.CARD_TRANSACTION_DECLINED, "card_transaction.declined"); + + public static final WebhookEvent IDENTITY_PROFILE_UPDATED = + new WebhookEvent(Value.IDENTITY_PROFILE_UPDATED, "identity_profile.updated"); + + private final Value value; + + private final String string; + + WebhookEvent(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof WebhookEvent && this.string.equals(((WebhookEvent) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RESOLUTION_CENTER_CASE_CREATED: + return visitor.visitResolutionCenterCaseCreated(); + case AD_CAMPAIGN_PAYMENT_FAILED: + return visitor.visitAdCampaignPaymentFailed(); + case IDENTITY_PROFILE_REJECTED: + return visitor.visitIdentityProfileRejected(); + case PLAN_DELETED: + return visitor.visitPlanDeleted(); + case PAYOUT_METHOD_CREATED: + return visitor.visitPayoutMethodCreated(); + case TRANSFER_COMPLETED: + return visitor.visitTransferCompleted(); + case CARD_APPLICATION_DENIED: + return visitor.visitCardApplicationDenied(); + case TRANSFER_CREATED: + return visitor.visitTransferCreated(); + case CARD_APPLICATION_CREATED: + return visitor.visitCardApplicationCreated(); + case MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED: + return visitor.visitMembershipCancelAtPeriodEndChanged(); + case ENTRY_DENIED: + return visitor.visitEntryDenied(); + case TRANSFER_FAILED: + return visitor.visitTransferFailed(); + case COURSE_LESSON_INTERACTION_COMPLETED: + return visitor.visitCourseLessonInteractionCompleted(); + case CARD_CANCELED: + return visitor.visitCardCanceled(); + case DEPOSIT_SUCCEEDED: + return visitor.visitDepositSucceeded(); + case VERIFICATION_SUCCEEDED: + return visitor.visitVerificationSucceeded(); + case PLAN_UPDATED: + return visitor.visitPlanUpdated(); + case PRODUCT_CREATED: + return visitor.visitProductCreated(); + case MEMBER_CREATED: + return visitor.visitMemberCreated(); + case SETUP_INTENT_SUCCEEDED: + return visitor.visitSetupIntentSucceeded(); + case CARD_TRANSACTION_COMPLETED: + return visitor.visitCardTransactionCompleted(); + case MEMBERSHIP_DEACTIVATED: + return visitor.visitMembershipDeactivated(); + case CARD_TRANSACTION_REVERSED: + return visitor.visitCardTransactionReversed(); + case CARD_FROZEN: + return visitor.visitCardFrozen(); + case WITHDRAWAL_UPDATED: + return visitor.visitWithdrawalUpdated(); + case SETUP_INTENT_CANCELED: + return visitor.visitSetupIntentCanceled(); + case CARD_CREATED: + return visitor.visitCardCreated(); + case RESOLUTION_CENTER_CASE_UPDATED: + return visitor.visitResolutionCenterCaseUpdated(); + case PRODUCT_UNPUBLISHED: + return visitor.visitProductUnpublished(); + case PAYMENT_FAILED: + return visitor.visitPaymentFailed(); + case ENTRY_DELETED: + return visitor.visitEntryDeleted(); + case SWAP_COMPLETED: + return visitor.visitSwapCompleted(); + case ENTRY_APPROVED: + return visitor.visitEntryApproved(); + case DISPUTE_ALERT_CREATED: + return visitor.visitDisputeAlertCreated(); + case CARD_TRANSACTION_CREATED: + return visitor.visitCardTransactionCreated(); + case REFUND_UPDATED: + return visitor.visitRefundUpdated(); + case WITHDRAWAL_REVERSED: + return visitor.visitWithdrawalReversed(); + case PAYOUT_ACCOUNT_STATUS_UPDATED: + return visitor.visitPayoutAccountStatusUpdated(); + case IDENTITY_PROFILE_APPROVED: + return visitor.visitIdentityProfileApproved(); + case SHIPMENT_CREATED: + return visitor.visitShipmentCreated(); + case DISPUTE_UPDATED: + return visitor.visitDisputeUpdated(); + case ENTRY_CREATED: + return visitor.visitEntryCreated(); + case PRODUCT_UPDATED: + return visitor.visitProductUpdated(); + case ACCOUNT_UPDATED: + return visitor.visitAccountUpdated(); + case WITHDRAWAL_CREATED: + return visitor.visitWithdrawalCreated(); + case CHAT_MESSAGE_CREATED: + return visitor.visitChatMessageCreated(); + case LEDGER_ACCOUNT_FUNDS_AVAILABLE: + return visitor.visitLedgerAccountFundsAvailable(); + case MEMBERSHIP_ACTIVATED: + return visitor.visitMembershipActivated(); + case PAYMENT_PENDING: + return visitor.visitPaymentPending(); + case MEMBERSHIP_TRIAL_ENDING_SOON: + return visitor.visitMembershipTrialEndingSoon(); + case REFUND_CREATED: + return visitor.visitRefundCreated(); + case CARD_UPDATED: + return visitor.visitCardUpdated(); + case CARD_APPLICATION_APPROVED: + return visitor.visitCardApplicationApproved(); + case PRODUCT_DELETED: + return visitor.visitProductDeleted(); + case PAYMENT_CREATED: + return visitor.visitPaymentCreated(); + case INVOICE_MARKED_UNCOLLECTIBLE: + return visitor.visitInvoiceMarkedUncollectible(); + case RESOLUTION_CENTER_CASE_DECIDED: + return visitor.visitResolutionCenterCaseDecided(); + case EXPORT_COMPLETED: + return visitor.visitExportCompleted(); + case PRODUCT_PUBLISHED: + return visitor.visitProductPublished(); + case CARD_APPLICATION_UPDATED: + return visitor.visitCardApplicationUpdated(); + case EXPORT_FAILED: + return visitor.visitExportFailed(); + case CARD_TRANSACTION_UPDATED: + return visitor.visitCardTransactionUpdated(); + case CHAT_REACTION_CREATED: + return visitor.visitChatReactionCreated(); + case PAYMENT_SUCCEEDED: + return visitor.visitPaymentSucceeded(); + case SHIPMENT_UPDATED: + return visitor.visitShipmentUpdated(); + case DISPUTE_CREATED: + return visitor.visitDisputeCreated(); + case INVOICE_CREATED: + return visitor.visitInvoiceCreated(); + case INVOICE_PAST_DUE: + return visitor.visitInvoicePastDue(); + case IDENTITY_PROFILE_NEEDS_ACTION: + return visitor.visitIdentityProfileNeedsAction(); + case INVOICE_PAID: + return visitor.visitInvoicePaid(); + case PLAN_CREATED: + return visitor.visitPlanCreated(); + case SETUP_INTENT_REQUIRES_ACTION: + return visitor.visitSetupIntentRequiresAction(); + case INVOICE_VOIDED: + return visitor.visitInvoiceVoided(); + case CARD_TRANSACTION_DECLINED: + return visitor.visitCardTransactionDeclined(); + case IDENTITY_PROFILE_UPDATED: + return visitor.visitIdentityProfileUpdated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WebhookEvent valueOf(String value) { + switch (value) { + case "resolution_center_case.created": + return RESOLUTION_CENTER_CASE_CREATED; + case "ad_campaign.payment_failed": + return AD_CAMPAIGN_PAYMENT_FAILED; + case "identity_profile.rejected": + return IDENTITY_PROFILE_REJECTED; + case "plan.deleted": + return PLAN_DELETED; + case "payout_method.created": + return PAYOUT_METHOD_CREATED; + case "transfer.completed": + return TRANSFER_COMPLETED; + case "card_application.denied": + return CARD_APPLICATION_DENIED; + case "transfer.created": + return TRANSFER_CREATED; + case "card_application.created": + return CARD_APPLICATION_CREATED; + case "membership.cancel_at_period_end_changed": + return MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED; + case "entry.denied": + return ENTRY_DENIED; + case "transfer.failed": + return TRANSFER_FAILED; + case "course_lesson_interaction.completed": + return COURSE_LESSON_INTERACTION_COMPLETED; + case "card.canceled": + return CARD_CANCELED; + case "deposit.succeeded": + return DEPOSIT_SUCCEEDED; + case "verification.succeeded": + return VERIFICATION_SUCCEEDED; + case "plan.updated": + return PLAN_UPDATED; + case "product.created": + return PRODUCT_CREATED; + case "member.created": + return MEMBER_CREATED; + case "setup_intent.succeeded": + return SETUP_INTENT_SUCCEEDED; + case "card_transaction.completed": + return CARD_TRANSACTION_COMPLETED; + case "membership.deactivated": + return MEMBERSHIP_DEACTIVATED; + case "card_transaction.reversed": + return CARD_TRANSACTION_REVERSED; + case "card.frozen": + return CARD_FROZEN; + case "withdrawal.updated": + return WITHDRAWAL_UPDATED; + case "setup_intent.canceled": + return SETUP_INTENT_CANCELED; + case "card.created": + return CARD_CREATED; + case "resolution_center_case.updated": + return RESOLUTION_CENTER_CASE_UPDATED; + case "product.unpublished": + return PRODUCT_UNPUBLISHED; + case "payment.failed": + return PAYMENT_FAILED; + case "entry.deleted": + return ENTRY_DELETED; + case "swap.completed": + return SWAP_COMPLETED; + case "entry.approved": + return ENTRY_APPROVED; + case "dispute_alert.created": + return DISPUTE_ALERT_CREATED; + case "card_transaction.created": + return CARD_TRANSACTION_CREATED; + case "refund.updated": + return REFUND_UPDATED; + case "withdrawal.reversed": + return WITHDRAWAL_REVERSED; + case "payout_account.status_updated": + return PAYOUT_ACCOUNT_STATUS_UPDATED; + case "identity_profile.approved": + return IDENTITY_PROFILE_APPROVED; + case "shipment.created": + return SHIPMENT_CREATED; + case "dispute.updated": + return DISPUTE_UPDATED; + case "entry.created": + return ENTRY_CREATED; + case "product.updated": + return PRODUCT_UPDATED; + case "account.updated": + return ACCOUNT_UPDATED; + case "withdrawal.created": + return WITHDRAWAL_CREATED; + case "chat.message.created": + return CHAT_MESSAGE_CREATED; + case "ledger_account.funds_available": + return LEDGER_ACCOUNT_FUNDS_AVAILABLE; + case "membership.activated": + return MEMBERSHIP_ACTIVATED; + case "payment.pending": + return PAYMENT_PENDING; + case "membership.trial_ending_soon": + return MEMBERSHIP_TRIAL_ENDING_SOON; + case "refund.created": + return REFUND_CREATED; + case "card.updated": + return CARD_UPDATED; + case "card_application.approved": + return CARD_APPLICATION_APPROVED; + case "product.deleted": + return PRODUCT_DELETED; + case "payment.created": + return PAYMENT_CREATED; + case "invoice.marked_uncollectible": + return INVOICE_MARKED_UNCOLLECTIBLE; + case "resolution_center_case.decided": + return RESOLUTION_CENTER_CASE_DECIDED; + case "export.completed": + return EXPORT_COMPLETED; + case "product.published": + return PRODUCT_PUBLISHED; + case "card_application.updated": + return CARD_APPLICATION_UPDATED; + case "export.failed": + return EXPORT_FAILED; + case "card_transaction.updated": + return CARD_TRANSACTION_UPDATED; + case "chat.reaction.created": + return CHAT_REACTION_CREATED; + case "payment.succeeded": + return PAYMENT_SUCCEEDED; + case "shipment.updated": + return SHIPMENT_UPDATED; + case "dispute.created": + return DISPUTE_CREATED; + case "invoice.created": + return INVOICE_CREATED; + case "invoice.past_due": + return INVOICE_PAST_DUE; + case "identity_profile.needs_action": + return IDENTITY_PROFILE_NEEDS_ACTION; + case "invoice.paid": + return INVOICE_PAID; + case "plan.created": + return PLAN_CREATED; + case "setup_intent.requires_action": + return SETUP_INTENT_REQUIRES_ACTION; + case "invoice.voided": + return INVOICE_VOIDED; + case "card_transaction.declined": + return CARD_TRANSACTION_DECLINED; + case "identity_profile.updated": + return IDENTITY_PROFILE_UPDATED; + default: + return new WebhookEvent(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT_UPDATED, + + INVOICE_CREATED, + + INVOICE_MARKED_UNCOLLECTIBLE, + + INVOICE_PAID, + + INVOICE_PAST_DUE, + + INVOICE_VOIDED, + + MEMBERSHIP_ACTIVATED, + + MEMBERSHIP_DEACTIVATED, + + MEMBERSHIP_TRIAL_ENDING_SOON, + + ENTRY_CREATED, + + ENTRY_APPROVED, + + ENTRY_DENIED, + + ENTRY_DELETED, + + EXPORT_COMPLETED, + + EXPORT_FAILED, + + SETUP_INTENT_REQUIRES_ACTION, + + SETUP_INTENT_SUCCEEDED, + + SETUP_INTENT_CANCELED, + + LEDGER_ACCOUNT_FUNDS_AVAILABLE, + + SWAP_COMPLETED, + + DEPOSIT_SUCCEEDED, + + TRANSFER_CREATED, + + TRANSFER_COMPLETED, + + TRANSFER_FAILED, + + WITHDRAWAL_CREATED, + + WITHDRAWAL_UPDATED, + + WITHDRAWAL_REVERSED, + + CARD_TRANSACTION_CREATED, + + CARD_TRANSACTION_UPDATED, + + CARD_TRANSACTION_COMPLETED, + + CARD_TRANSACTION_DECLINED, + + CARD_TRANSACTION_REVERSED, + + CARD_CREATED, + + CARD_UPDATED, + + CARD_FROZEN, + + CARD_CANCELED, + + CARD_APPLICATION_CREATED, + + CARD_APPLICATION_UPDATED, + + CARD_APPLICATION_APPROVED, + + CARD_APPLICATION_DENIED, + + COURSE_LESSON_INTERACTION_COMPLETED, + + PAYOUT_METHOD_CREATED, + + VERIFICATION_SUCCEEDED, + + IDENTITY_PROFILE_APPROVED, + + IDENTITY_PROFILE_REJECTED, + + IDENTITY_PROFILE_NEEDS_ACTION, + + IDENTITY_PROFILE_UPDATED, + + PAYOUT_ACCOUNT_STATUS_UPDATED, + + RESOLUTION_CENTER_CASE_CREATED, + + RESOLUTION_CENTER_CASE_UPDATED, + + RESOLUTION_CENTER_CASE_DECIDED, + + PRODUCT_CREATED, + + PRODUCT_UPDATED, + + PRODUCT_DELETED, + + PRODUCT_PUBLISHED, + + PRODUCT_UNPUBLISHED, + + PLAN_CREATED, + + PLAN_UPDATED, + + PLAN_DELETED, + + SHIPMENT_CREATED, + + SHIPMENT_UPDATED, + + MEMBER_CREATED, + + AD_CAMPAIGN_PAYMENT_FAILED, + + CHAT_MESSAGE_CREATED, + + CHAT_REACTION_CREATED, + + PAYMENT_CREATED, + + PAYMENT_SUCCEEDED, + + PAYMENT_FAILED, + + PAYMENT_PENDING, + + DISPUTE_CREATED, + + DISPUTE_UPDATED, + + REFUND_CREATED, + + REFUND_UPDATED, + + DISPUTE_ALERT_CREATED, + + MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, + + UNKNOWN + } + + public interface Visitor { + T visitAccountUpdated(); + + T visitInvoiceCreated(); + + T visitInvoiceMarkedUncollectible(); + + T visitInvoicePaid(); + + T visitInvoicePastDue(); + + T visitInvoiceVoided(); + + T visitMembershipActivated(); + + T visitMembershipDeactivated(); + + T visitMembershipTrialEndingSoon(); + + T visitEntryCreated(); + + T visitEntryApproved(); + + T visitEntryDenied(); + + T visitEntryDeleted(); + + T visitExportCompleted(); + + T visitExportFailed(); + + T visitSetupIntentRequiresAction(); + + T visitSetupIntentSucceeded(); + + T visitSetupIntentCanceled(); + + T visitLedgerAccountFundsAvailable(); + + T visitSwapCompleted(); + + T visitDepositSucceeded(); + + T visitTransferCreated(); + + T visitTransferCompleted(); + + T visitTransferFailed(); + + T visitWithdrawalCreated(); + + T visitWithdrawalUpdated(); + + T visitWithdrawalReversed(); + + T visitCardTransactionCreated(); + + T visitCardTransactionUpdated(); + + T visitCardTransactionCompleted(); + + T visitCardTransactionDeclined(); + + T visitCardTransactionReversed(); + + T visitCardCreated(); + + T visitCardUpdated(); + + T visitCardFrozen(); + + T visitCardCanceled(); + + T visitCardApplicationCreated(); + + T visitCardApplicationUpdated(); + + T visitCardApplicationApproved(); + + T visitCardApplicationDenied(); + + T visitCourseLessonInteractionCompleted(); + + T visitPayoutMethodCreated(); + + T visitVerificationSucceeded(); + + T visitIdentityProfileApproved(); + + T visitIdentityProfileRejected(); + + T visitIdentityProfileNeedsAction(); + + T visitIdentityProfileUpdated(); + + T visitPayoutAccountStatusUpdated(); + + T visitResolutionCenterCaseCreated(); + + T visitResolutionCenterCaseUpdated(); + + T visitResolutionCenterCaseDecided(); + + T visitProductCreated(); + + T visitProductUpdated(); + + T visitProductDeleted(); + + T visitProductPublished(); + + T visitProductUnpublished(); + + T visitPlanCreated(); + + T visitPlanUpdated(); + + T visitPlanDeleted(); + + T visitShipmentCreated(); + + T visitShipmentUpdated(); + + T visitMemberCreated(); + + T visitAdCampaignPaymentFailed(); + + T visitChatMessageCreated(); + + T visitChatReactionCreated(); + + T visitPaymentCreated(); + + T visitPaymentSucceeded(); + + T visitPaymentFailed(); + + T visitPaymentPending(); + + T visitDisputeCreated(); + + T visitDisputeUpdated(); + + T visitRefundCreated(); + + T visitRefundUpdated(); + + T visitDisputeAlertCreated(); + + T visitMembershipCancelAtPeriodEndChanged(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/WebhookEventsItem.java b/src/main/java/com/whop/api/types/WebhookEventsItem.java new file mode 100644 index 00000000..9ecb5623 --- /dev/null +++ b/src/main/java/com/whop/api/types/WebhookEventsItem.java @@ -0,0 +1,1041 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WebhookEventsItem { + public static final WebhookEventsItem RESOLUTION_CENTER_CASE_CREATED = + new WebhookEventsItem(Value.RESOLUTION_CENTER_CASE_CREATED, "resolution_center_case.created"); + + public static final WebhookEventsItem PAYMENT_AFFILIATE_REWARD_CREATED = + new WebhookEventsItem(Value.PAYMENT_AFFILIATE_REWARD_CREATED, "payment.affiliate_reward_created"); + + public static final WebhookEventsItem APP_PAYMENT_CREATED = + new WebhookEventsItem(Value.APP_PAYMENT_CREATED, "app_payment.created"); + + public static final WebhookEventsItem AD_CAMPAIGN_PAYMENT_FAILED = + new WebhookEventsItem(Value.AD_CAMPAIGN_PAYMENT_FAILED, "ad_campaign.payment_failed"); + + public static final WebhookEventsItem IDENTITY_PROFILE_REJECTED = + new WebhookEventsItem(Value.IDENTITY_PROFILE_REJECTED, "identity_profile.rejected"); + + public static final WebhookEventsItem PLAN_DELETED = new WebhookEventsItem(Value.PLAN_DELETED, "plan.deleted"); + + public static final WebhookEventsItem RESOLUTION_CREATED = + new WebhookEventsItem(Value.RESOLUTION_CREATED, "resolution.created"); + + public static final WebhookEventsItem PAYOUT_METHOD_CREATED = + new WebhookEventsItem(Value.PAYOUT_METHOD_CREATED, "payout_method.created"); + + public static final WebhookEventsItem MEMBERSHIP_WENT_INVALID = + new WebhookEventsItem(Value.MEMBERSHIP_WENT_INVALID, "membership.went_invalid"); + + public static final WebhookEventsItem TRANSFER_COMPLETED = + new WebhookEventsItem(Value.TRANSFER_COMPLETED, "transfer.completed"); + + public static final WebhookEventsItem CARD_APPLICATION_DENIED = + new WebhookEventsItem(Value.CARD_APPLICATION_DENIED, "card_application.denied"); + + public static final WebhookEventsItem TRANSFER_CREATED = + new WebhookEventsItem(Value.TRANSFER_CREATED, "transfer.created"); + + public static final WebhookEventsItem CARD_APPLICATION_CREATED = + new WebhookEventsItem(Value.CARD_APPLICATION_CREATED, "card_application.created"); + + public static final WebhookEventsItem MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED = new WebhookEventsItem( + Value.MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, "membership.cancel_at_period_end_changed"); + + public static final WebhookEventsItem ENTRY_DENIED = new WebhookEventsItem(Value.ENTRY_DENIED, "entry.denied"); + + public static final WebhookEventsItem TRANSFER_FAILED = + new WebhookEventsItem(Value.TRANSFER_FAILED, "transfer.failed"); + + public static final WebhookEventsItem COURSE_LESSON_INTERACTION_COMPLETED = + new WebhookEventsItem(Value.COURSE_LESSON_INTERACTION_COMPLETED, "course_lesson_interaction.completed"); + + public static final WebhookEventsItem CARD_CANCELED = new WebhookEventsItem(Value.CARD_CANCELED, "card.canceled"); + + public static final WebhookEventsItem DEPOSIT_SUCCEEDED = + new WebhookEventsItem(Value.DEPOSIT_SUCCEEDED, "deposit.succeeded"); + + public static final WebhookEventsItem VERIFICATION_SUCCEEDED = + new WebhookEventsItem(Value.VERIFICATION_SUCCEEDED, "verification.succeeded"); + + public static final WebhookEventsItem PLAN_UPDATED = new WebhookEventsItem(Value.PLAN_UPDATED, "plan.updated"); + + public static final WebhookEventsItem PRODUCT_CREATED = + new WebhookEventsItem(Value.PRODUCT_CREATED, "product.created"); + + public static final WebhookEventsItem MEMBER_CREATED = + new WebhookEventsItem(Value.MEMBER_CREATED, "member.created"); + + public static final WebhookEventsItem SETUP_INTENT_SUCCEEDED = + new WebhookEventsItem(Value.SETUP_INTENT_SUCCEEDED, "setup_intent.succeeded"); + + public static final WebhookEventsItem CARD_TRANSACTION_COMPLETED = + new WebhookEventsItem(Value.CARD_TRANSACTION_COMPLETED, "card_transaction.completed"); + + public static final WebhookEventsItem MEMBERSHIP_DEACTIVATED = + new WebhookEventsItem(Value.MEMBERSHIP_DEACTIVATED, "membership.deactivated"); + + public static final WebhookEventsItem CARD_TRANSACTION_REVERSED = + new WebhookEventsItem(Value.CARD_TRANSACTION_REVERSED, "card_transaction.reversed"); + + public static final WebhookEventsItem CARD_FROZEN = new WebhookEventsItem(Value.CARD_FROZEN, "card.frozen"); + + public static final WebhookEventsItem WITHDRAWAL_UPDATED = + new WebhookEventsItem(Value.WITHDRAWAL_UPDATED, "withdrawal.updated"); + + public static final WebhookEventsItem SETUP_INTENT_CANCELED = + new WebhookEventsItem(Value.SETUP_INTENT_CANCELED, "setup_intent.canceled"); + + public static final WebhookEventsItem APP_PAYMENT_FAILED = + new WebhookEventsItem(Value.APP_PAYMENT_FAILED, "app_payment.failed"); + + public static final WebhookEventsItem APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED = new WebhookEventsItem( + Value.APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, "app_membership.cancel_at_period_end_changed"); + + public static final WebhookEventsItem APP_PAYMENT_SUCCEEDED = + new WebhookEventsItem(Value.APP_PAYMENT_SUCCEEDED, "app_payment.succeeded"); + + public static final WebhookEventsItem CARD_CREATED = new WebhookEventsItem(Value.CARD_CREATED, "card.created"); + + public static final WebhookEventsItem RESOLUTION_CENTER_CASE_UPDATED = + new WebhookEventsItem(Value.RESOLUTION_CENTER_CASE_UPDATED, "resolution_center_case.updated"); + + public static final WebhookEventsItem PRODUCT_UNPUBLISHED = + new WebhookEventsItem(Value.PRODUCT_UNPUBLISHED, "product.unpublished"); + + public static final WebhookEventsItem PAYMENT_FAILED = + new WebhookEventsItem(Value.PAYMENT_FAILED, "payment.failed"); + + public static final WebhookEventsItem APP_PAYMENT_PENDING = + new WebhookEventsItem(Value.APP_PAYMENT_PENDING, "app_payment.pending"); + + public static final WebhookEventsItem ENTRY_DELETED = new WebhookEventsItem(Value.ENTRY_DELETED, "entry.deleted"); + + public static final WebhookEventsItem SWAP_COMPLETED = + new WebhookEventsItem(Value.SWAP_COMPLETED, "swap.completed"); + + public static final WebhookEventsItem ENTRY_APPROVED = + new WebhookEventsItem(Value.ENTRY_APPROVED, "entry.approved"); + + public static final WebhookEventsItem DISPUTE_ALERT_CREATED = + new WebhookEventsItem(Value.DISPUTE_ALERT_CREATED, "dispute_alert.created"); + + public static final WebhookEventsItem CARD_TRANSACTION_CREATED = + new WebhookEventsItem(Value.CARD_TRANSACTION_CREATED, "card_transaction.created"); + + public static final WebhookEventsItem REFUND_UPDATED = + new WebhookEventsItem(Value.REFUND_UPDATED, "refund.updated"); + + public static final WebhookEventsItem RESOLUTION_DECIDED = + new WebhookEventsItem(Value.RESOLUTION_DECIDED, "resolution.decided"); + + public static final WebhookEventsItem WITHDRAWAL_REVERSED = + new WebhookEventsItem(Value.WITHDRAWAL_REVERSED, "withdrawal.reversed"); + + public static final WebhookEventsItem PAYOUT_ACCOUNT_STATUS_UPDATED = + new WebhookEventsItem(Value.PAYOUT_ACCOUNT_STATUS_UPDATED, "payout_account.status_updated"); + + public static final WebhookEventsItem IDENTITY_PROFILE_APPROVED = + new WebhookEventsItem(Value.IDENTITY_PROFILE_APPROVED, "identity_profile.approved"); + + public static final WebhookEventsItem SHIPMENT_CREATED = + new WebhookEventsItem(Value.SHIPMENT_CREATED, "shipment.created"); + + public static final WebhookEventsItem DISPUTE_UPDATED = + new WebhookEventsItem(Value.DISPUTE_UPDATED, "dispute.updated"); + + public static final WebhookEventsItem ENTRY_CREATED = new WebhookEventsItem(Value.ENTRY_CREATED, "entry.created"); + + public static final WebhookEventsItem APP_MEMBERSHIP_WENT_VALID = + new WebhookEventsItem(Value.APP_MEMBERSHIP_WENT_VALID, "app_membership.went_valid"); + + public static final WebhookEventsItem PRODUCT_UPDATED = + new WebhookEventsItem(Value.PRODUCT_UPDATED, "product.updated"); + + public static final WebhookEventsItem ACCOUNT_UPDATED = + new WebhookEventsItem(Value.ACCOUNT_UPDATED, "account.updated"); + + public static final WebhookEventsItem WITHDRAWAL_CREATED = + new WebhookEventsItem(Value.WITHDRAWAL_CREATED, "withdrawal.created"); + + public static final WebhookEventsItem CHAT_MESSAGE_CREATED = + new WebhookEventsItem(Value.CHAT_MESSAGE_CREATED, "chat.message.created"); + + public static final WebhookEventsItem LEDGER_ACCOUNT_FUNDS_AVAILABLE = + new WebhookEventsItem(Value.LEDGER_ACCOUNT_FUNDS_AVAILABLE, "ledger_account.funds_available"); + + public static final WebhookEventsItem MEMBERSHIP_ACTIVATED = + new WebhookEventsItem(Value.MEMBERSHIP_ACTIVATED, "membership.activated"); + + public static final WebhookEventsItem PAYMENT_PENDING = + new WebhookEventsItem(Value.PAYMENT_PENDING, "payment.pending"); + + public static final WebhookEventsItem MEMBERSHIP_TRIAL_ENDING_SOON = + new WebhookEventsItem(Value.MEMBERSHIP_TRIAL_ENDING_SOON, "membership.trial_ending_soon"); + + public static final WebhookEventsItem REFUND_CREATED = + new WebhookEventsItem(Value.REFUND_CREATED, "refund.created"); + + public static final WebhookEventsItem CARD_UPDATED = new WebhookEventsItem(Value.CARD_UPDATED, "card.updated"); + + public static final WebhookEventsItem CARD_APPLICATION_APPROVED = + new WebhookEventsItem(Value.CARD_APPLICATION_APPROVED, "card_application.approved"); + + public static final WebhookEventsItem PRODUCT_DELETED = + new WebhookEventsItem(Value.PRODUCT_DELETED, "product.deleted"); + + public static final WebhookEventsItem PAYMENT_CREATED = + new WebhookEventsItem(Value.PAYMENT_CREATED, "payment.created"); + + public static final WebhookEventsItem INVOICE_MARKED_UNCOLLECTIBLE = + new WebhookEventsItem(Value.INVOICE_MARKED_UNCOLLECTIBLE, "invoice.marked_uncollectible"); + + public static final WebhookEventsItem RESOLUTION_CENTER_CASE_DECIDED = + new WebhookEventsItem(Value.RESOLUTION_CENTER_CASE_DECIDED, "resolution_center_case.decided"); + + public static final WebhookEventsItem MEMBERSHIP_EXPERIENCE_CLAIMED = + new WebhookEventsItem(Value.MEMBERSHIP_EXPERIENCE_CLAIMED, "membership.experience_claimed"); + + public static final WebhookEventsItem EXPORT_COMPLETED = + new WebhookEventsItem(Value.EXPORT_COMPLETED, "export.completed"); + + public static final WebhookEventsItem PRODUCT_PUBLISHED = + new WebhookEventsItem(Value.PRODUCT_PUBLISHED, "product.published"); + + public static final WebhookEventsItem CARD_APPLICATION_UPDATED = + new WebhookEventsItem(Value.CARD_APPLICATION_UPDATED, "card_application.updated"); + + public static final WebhookEventsItem RESOLUTION_UPDATED = + new WebhookEventsItem(Value.RESOLUTION_UPDATED, "resolution.updated"); + + public static final WebhookEventsItem EXPORT_FAILED = new WebhookEventsItem(Value.EXPORT_FAILED, "export.failed"); + + public static final WebhookEventsItem MEMBERSHIP_METADATA_UPDATED = + new WebhookEventsItem(Value.MEMBERSHIP_METADATA_UPDATED, "membership.metadata_updated"); + + public static final WebhookEventsItem CARD_TRANSACTION_UPDATED = + new WebhookEventsItem(Value.CARD_TRANSACTION_UPDATED, "card_transaction.updated"); + + public static final WebhookEventsItem CHAT_REACTION_CREATED = + new WebhookEventsItem(Value.CHAT_REACTION_CREATED, "chat.reaction.created"); + + public static final WebhookEventsItem PAYMENT_SUCCEEDED = + new WebhookEventsItem(Value.PAYMENT_SUCCEEDED, "payment.succeeded"); + + public static final WebhookEventsItem SHIPMENT_UPDATED = + new WebhookEventsItem(Value.SHIPMENT_UPDATED, "shipment.updated"); + + public static final WebhookEventsItem DISPUTE_CREATED = + new WebhookEventsItem(Value.DISPUTE_CREATED, "dispute.created"); + + public static final WebhookEventsItem INVOICE_CREATED = + new WebhookEventsItem(Value.INVOICE_CREATED, "invoice.created"); + + public static final WebhookEventsItem INVOICE_PAST_DUE = + new WebhookEventsItem(Value.INVOICE_PAST_DUE, "invoice.past_due"); + + public static final WebhookEventsItem MEMBERSHIP_WENT_VALID = + new WebhookEventsItem(Value.MEMBERSHIP_WENT_VALID, "membership.went_valid"); + + public static final WebhookEventsItem IDENTITY_PROFILE_NEEDS_ACTION = + new WebhookEventsItem(Value.IDENTITY_PROFILE_NEEDS_ACTION, "identity_profile.needs_action"); + + public static final WebhookEventsItem INVOICE_PAID = new WebhookEventsItem(Value.INVOICE_PAID, "invoice.paid"); + + public static final WebhookEventsItem PLAN_CREATED = new WebhookEventsItem(Value.PLAN_CREATED, "plan.created"); + + public static final WebhookEventsItem SETUP_INTENT_REQUIRES_ACTION = + new WebhookEventsItem(Value.SETUP_INTENT_REQUIRES_ACTION, "setup_intent.requires_action"); + + public static final WebhookEventsItem INVOICE_VOIDED = + new WebhookEventsItem(Value.INVOICE_VOIDED, "invoice.voided"); + + public static final WebhookEventsItem CARD_TRANSACTION_DECLINED = + new WebhookEventsItem(Value.CARD_TRANSACTION_DECLINED, "card_transaction.declined"); + + public static final WebhookEventsItem IDENTITY_PROFILE_UPDATED = + new WebhookEventsItem(Value.IDENTITY_PROFILE_UPDATED, "identity_profile.updated"); + + public static final WebhookEventsItem APP_MEMBERSHIP_WENT_INVALID = + new WebhookEventsItem(Value.APP_MEMBERSHIP_WENT_INVALID, "app_membership.went_invalid"); + + private final Value value; + + private final String string; + + WebhookEventsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof WebhookEventsItem && this.string.equals(((WebhookEventsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RESOLUTION_CENTER_CASE_CREATED: + return visitor.visitResolutionCenterCaseCreated(); + case PAYMENT_AFFILIATE_REWARD_CREATED: + return visitor.visitPaymentAffiliateRewardCreated(); + case APP_PAYMENT_CREATED: + return visitor.visitAppPaymentCreated(); + case AD_CAMPAIGN_PAYMENT_FAILED: + return visitor.visitAdCampaignPaymentFailed(); + case IDENTITY_PROFILE_REJECTED: + return visitor.visitIdentityProfileRejected(); + case PLAN_DELETED: + return visitor.visitPlanDeleted(); + case RESOLUTION_CREATED: + return visitor.visitResolutionCreated(); + case PAYOUT_METHOD_CREATED: + return visitor.visitPayoutMethodCreated(); + case MEMBERSHIP_WENT_INVALID: + return visitor.visitMembershipWentInvalid(); + case TRANSFER_COMPLETED: + return visitor.visitTransferCompleted(); + case CARD_APPLICATION_DENIED: + return visitor.visitCardApplicationDenied(); + case TRANSFER_CREATED: + return visitor.visitTransferCreated(); + case CARD_APPLICATION_CREATED: + return visitor.visitCardApplicationCreated(); + case MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED: + return visitor.visitMembershipCancelAtPeriodEndChanged(); + case ENTRY_DENIED: + return visitor.visitEntryDenied(); + case TRANSFER_FAILED: + return visitor.visitTransferFailed(); + case COURSE_LESSON_INTERACTION_COMPLETED: + return visitor.visitCourseLessonInteractionCompleted(); + case CARD_CANCELED: + return visitor.visitCardCanceled(); + case DEPOSIT_SUCCEEDED: + return visitor.visitDepositSucceeded(); + case VERIFICATION_SUCCEEDED: + return visitor.visitVerificationSucceeded(); + case PLAN_UPDATED: + return visitor.visitPlanUpdated(); + case PRODUCT_CREATED: + return visitor.visitProductCreated(); + case MEMBER_CREATED: + return visitor.visitMemberCreated(); + case SETUP_INTENT_SUCCEEDED: + return visitor.visitSetupIntentSucceeded(); + case CARD_TRANSACTION_COMPLETED: + return visitor.visitCardTransactionCompleted(); + case MEMBERSHIP_DEACTIVATED: + return visitor.visitMembershipDeactivated(); + case CARD_TRANSACTION_REVERSED: + return visitor.visitCardTransactionReversed(); + case CARD_FROZEN: + return visitor.visitCardFrozen(); + case WITHDRAWAL_UPDATED: + return visitor.visitWithdrawalUpdated(); + case SETUP_INTENT_CANCELED: + return visitor.visitSetupIntentCanceled(); + case APP_PAYMENT_FAILED: + return visitor.visitAppPaymentFailed(); + case APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED: + return visitor.visitAppMembershipCancelAtPeriodEndChanged(); + case APP_PAYMENT_SUCCEEDED: + return visitor.visitAppPaymentSucceeded(); + case CARD_CREATED: + return visitor.visitCardCreated(); + case RESOLUTION_CENTER_CASE_UPDATED: + return visitor.visitResolutionCenterCaseUpdated(); + case PRODUCT_UNPUBLISHED: + return visitor.visitProductUnpublished(); + case PAYMENT_FAILED: + return visitor.visitPaymentFailed(); + case APP_PAYMENT_PENDING: + return visitor.visitAppPaymentPending(); + case ENTRY_DELETED: + return visitor.visitEntryDeleted(); + case SWAP_COMPLETED: + return visitor.visitSwapCompleted(); + case ENTRY_APPROVED: + return visitor.visitEntryApproved(); + case DISPUTE_ALERT_CREATED: + return visitor.visitDisputeAlertCreated(); + case CARD_TRANSACTION_CREATED: + return visitor.visitCardTransactionCreated(); + case REFUND_UPDATED: + return visitor.visitRefundUpdated(); + case RESOLUTION_DECIDED: + return visitor.visitResolutionDecided(); + case WITHDRAWAL_REVERSED: + return visitor.visitWithdrawalReversed(); + case PAYOUT_ACCOUNT_STATUS_UPDATED: + return visitor.visitPayoutAccountStatusUpdated(); + case IDENTITY_PROFILE_APPROVED: + return visitor.visitIdentityProfileApproved(); + case SHIPMENT_CREATED: + return visitor.visitShipmentCreated(); + case DISPUTE_UPDATED: + return visitor.visitDisputeUpdated(); + case ENTRY_CREATED: + return visitor.visitEntryCreated(); + case APP_MEMBERSHIP_WENT_VALID: + return visitor.visitAppMembershipWentValid(); + case PRODUCT_UPDATED: + return visitor.visitProductUpdated(); + case ACCOUNT_UPDATED: + return visitor.visitAccountUpdated(); + case WITHDRAWAL_CREATED: + return visitor.visitWithdrawalCreated(); + case CHAT_MESSAGE_CREATED: + return visitor.visitChatMessageCreated(); + case LEDGER_ACCOUNT_FUNDS_AVAILABLE: + return visitor.visitLedgerAccountFundsAvailable(); + case MEMBERSHIP_ACTIVATED: + return visitor.visitMembershipActivated(); + case PAYMENT_PENDING: + return visitor.visitPaymentPending(); + case MEMBERSHIP_TRIAL_ENDING_SOON: + return visitor.visitMembershipTrialEndingSoon(); + case REFUND_CREATED: + return visitor.visitRefundCreated(); + case CARD_UPDATED: + return visitor.visitCardUpdated(); + case CARD_APPLICATION_APPROVED: + return visitor.visitCardApplicationApproved(); + case PRODUCT_DELETED: + return visitor.visitProductDeleted(); + case PAYMENT_CREATED: + return visitor.visitPaymentCreated(); + case INVOICE_MARKED_UNCOLLECTIBLE: + return visitor.visitInvoiceMarkedUncollectible(); + case RESOLUTION_CENTER_CASE_DECIDED: + return visitor.visitResolutionCenterCaseDecided(); + case MEMBERSHIP_EXPERIENCE_CLAIMED: + return visitor.visitMembershipExperienceClaimed(); + case EXPORT_COMPLETED: + return visitor.visitExportCompleted(); + case PRODUCT_PUBLISHED: + return visitor.visitProductPublished(); + case CARD_APPLICATION_UPDATED: + return visitor.visitCardApplicationUpdated(); + case RESOLUTION_UPDATED: + return visitor.visitResolutionUpdated(); + case EXPORT_FAILED: + return visitor.visitExportFailed(); + case MEMBERSHIP_METADATA_UPDATED: + return visitor.visitMembershipMetadataUpdated(); + case CARD_TRANSACTION_UPDATED: + return visitor.visitCardTransactionUpdated(); + case CHAT_REACTION_CREATED: + return visitor.visitChatReactionCreated(); + case PAYMENT_SUCCEEDED: + return visitor.visitPaymentSucceeded(); + case SHIPMENT_UPDATED: + return visitor.visitShipmentUpdated(); + case DISPUTE_CREATED: + return visitor.visitDisputeCreated(); + case INVOICE_CREATED: + return visitor.visitInvoiceCreated(); + case INVOICE_PAST_DUE: + return visitor.visitInvoicePastDue(); + case MEMBERSHIP_WENT_VALID: + return visitor.visitMembershipWentValid(); + case IDENTITY_PROFILE_NEEDS_ACTION: + return visitor.visitIdentityProfileNeedsAction(); + case INVOICE_PAID: + return visitor.visitInvoicePaid(); + case PLAN_CREATED: + return visitor.visitPlanCreated(); + case SETUP_INTENT_REQUIRES_ACTION: + return visitor.visitSetupIntentRequiresAction(); + case INVOICE_VOIDED: + return visitor.visitInvoiceVoided(); + case CARD_TRANSACTION_DECLINED: + return visitor.visitCardTransactionDeclined(); + case IDENTITY_PROFILE_UPDATED: + return visitor.visitIdentityProfileUpdated(); + case APP_MEMBERSHIP_WENT_INVALID: + return visitor.visitAppMembershipWentInvalid(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WebhookEventsItem valueOf(String value) { + switch (value) { + case "resolution_center_case.created": + return RESOLUTION_CENTER_CASE_CREATED; + case "payment.affiliate_reward_created": + return PAYMENT_AFFILIATE_REWARD_CREATED; + case "app_payment.created": + return APP_PAYMENT_CREATED; + case "ad_campaign.payment_failed": + return AD_CAMPAIGN_PAYMENT_FAILED; + case "identity_profile.rejected": + return IDENTITY_PROFILE_REJECTED; + case "plan.deleted": + return PLAN_DELETED; + case "resolution.created": + return RESOLUTION_CREATED; + case "payout_method.created": + return PAYOUT_METHOD_CREATED; + case "membership.went_invalid": + return MEMBERSHIP_WENT_INVALID; + case "transfer.completed": + return TRANSFER_COMPLETED; + case "card_application.denied": + return CARD_APPLICATION_DENIED; + case "transfer.created": + return TRANSFER_CREATED; + case "card_application.created": + return CARD_APPLICATION_CREATED; + case "membership.cancel_at_period_end_changed": + return MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED; + case "entry.denied": + return ENTRY_DENIED; + case "transfer.failed": + return TRANSFER_FAILED; + case "course_lesson_interaction.completed": + return COURSE_LESSON_INTERACTION_COMPLETED; + case "card.canceled": + return CARD_CANCELED; + case "deposit.succeeded": + return DEPOSIT_SUCCEEDED; + case "verification.succeeded": + return VERIFICATION_SUCCEEDED; + case "plan.updated": + return PLAN_UPDATED; + case "product.created": + return PRODUCT_CREATED; + case "member.created": + return MEMBER_CREATED; + case "setup_intent.succeeded": + return SETUP_INTENT_SUCCEEDED; + case "card_transaction.completed": + return CARD_TRANSACTION_COMPLETED; + case "membership.deactivated": + return MEMBERSHIP_DEACTIVATED; + case "card_transaction.reversed": + return CARD_TRANSACTION_REVERSED; + case "card.frozen": + return CARD_FROZEN; + case "withdrawal.updated": + return WITHDRAWAL_UPDATED; + case "setup_intent.canceled": + return SETUP_INTENT_CANCELED; + case "app_payment.failed": + return APP_PAYMENT_FAILED; + case "app_membership.cancel_at_period_end_changed": + return APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED; + case "app_payment.succeeded": + return APP_PAYMENT_SUCCEEDED; + case "card.created": + return CARD_CREATED; + case "resolution_center_case.updated": + return RESOLUTION_CENTER_CASE_UPDATED; + case "product.unpublished": + return PRODUCT_UNPUBLISHED; + case "payment.failed": + return PAYMENT_FAILED; + case "app_payment.pending": + return APP_PAYMENT_PENDING; + case "entry.deleted": + return ENTRY_DELETED; + case "swap.completed": + return SWAP_COMPLETED; + case "entry.approved": + return ENTRY_APPROVED; + case "dispute_alert.created": + return DISPUTE_ALERT_CREATED; + case "card_transaction.created": + return CARD_TRANSACTION_CREATED; + case "refund.updated": + return REFUND_UPDATED; + case "resolution.decided": + return RESOLUTION_DECIDED; + case "withdrawal.reversed": + return WITHDRAWAL_REVERSED; + case "payout_account.status_updated": + return PAYOUT_ACCOUNT_STATUS_UPDATED; + case "identity_profile.approved": + return IDENTITY_PROFILE_APPROVED; + case "shipment.created": + return SHIPMENT_CREATED; + case "dispute.updated": + return DISPUTE_UPDATED; + case "entry.created": + return ENTRY_CREATED; + case "app_membership.went_valid": + return APP_MEMBERSHIP_WENT_VALID; + case "product.updated": + return PRODUCT_UPDATED; + case "account.updated": + return ACCOUNT_UPDATED; + case "withdrawal.created": + return WITHDRAWAL_CREATED; + case "chat.message.created": + return CHAT_MESSAGE_CREATED; + case "ledger_account.funds_available": + return LEDGER_ACCOUNT_FUNDS_AVAILABLE; + case "membership.activated": + return MEMBERSHIP_ACTIVATED; + case "payment.pending": + return PAYMENT_PENDING; + case "membership.trial_ending_soon": + return MEMBERSHIP_TRIAL_ENDING_SOON; + case "refund.created": + return REFUND_CREATED; + case "card.updated": + return CARD_UPDATED; + case "card_application.approved": + return CARD_APPLICATION_APPROVED; + case "product.deleted": + return PRODUCT_DELETED; + case "payment.created": + return PAYMENT_CREATED; + case "invoice.marked_uncollectible": + return INVOICE_MARKED_UNCOLLECTIBLE; + case "resolution_center_case.decided": + return RESOLUTION_CENTER_CASE_DECIDED; + case "membership.experience_claimed": + return MEMBERSHIP_EXPERIENCE_CLAIMED; + case "export.completed": + return EXPORT_COMPLETED; + case "product.published": + return PRODUCT_PUBLISHED; + case "card_application.updated": + return CARD_APPLICATION_UPDATED; + case "resolution.updated": + return RESOLUTION_UPDATED; + case "export.failed": + return EXPORT_FAILED; + case "membership.metadata_updated": + return MEMBERSHIP_METADATA_UPDATED; + case "card_transaction.updated": + return CARD_TRANSACTION_UPDATED; + case "chat.reaction.created": + return CHAT_REACTION_CREATED; + case "payment.succeeded": + return PAYMENT_SUCCEEDED; + case "shipment.updated": + return SHIPMENT_UPDATED; + case "dispute.created": + return DISPUTE_CREATED; + case "invoice.created": + return INVOICE_CREATED; + case "invoice.past_due": + return INVOICE_PAST_DUE; + case "membership.went_valid": + return MEMBERSHIP_WENT_VALID; + case "identity_profile.needs_action": + return IDENTITY_PROFILE_NEEDS_ACTION; + case "invoice.paid": + return INVOICE_PAID; + case "plan.created": + return PLAN_CREATED; + case "setup_intent.requires_action": + return SETUP_INTENT_REQUIRES_ACTION; + case "invoice.voided": + return INVOICE_VOIDED; + case "card_transaction.declined": + return CARD_TRANSACTION_DECLINED; + case "identity_profile.updated": + return IDENTITY_PROFILE_UPDATED; + case "app_membership.went_invalid": + return APP_MEMBERSHIP_WENT_INVALID; + default: + return new WebhookEventsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT_UPDATED, + + INVOICE_CREATED, + + INVOICE_MARKED_UNCOLLECTIBLE, + + INVOICE_PAID, + + INVOICE_PAST_DUE, + + INVOICE_VOIDED, + + MEMBERSHIP_ACTIVATED, + + MEMBERSHIP_DEACTIVATED, + + MEMBERSHIP_TRIAL_ENDING_SOON, + + ENTRY_CREATED, + + ENTRY_APPROVED, + + ENTRY_DENIED, + + ENTRY_DELETED, + + EXPORT_COMPLETED, + + EXPORT_FAILED, + + SETUP_INTENT_REQUIRES_ACTION, + + SETUP_INTENT_SUCCEEDED, + + SETUP_INTENT_CANCELED, + + LEDGER_ACCOUNT_FUNDS_AVAILABLE, + + SWAP_COMPLETED, + + DEPOSIT_SUCCEEDED, + + TRANSFER_CREATED, + + TRANSFER_COMPLETED, + + TRANSFER_FAILED, + + WITHDRAWAL_CREATED, + + WITHDRAWAL_UPDATED, + + WITHDRAWAL_REVERSED, + + CARD_TRANSACTION_CREATED, + + CARD_TRANSACTION_UPDATED, + + CARD_TRANSACTION_COMPLETED, + + CARD_TRANSACTION_DECLINED, + + CARD_TRANSACTION_REVERSED, + + CARD_CREATED, + + CARD_UPDATED, + + CARD_FROZEN, + + CARD_CANCELED, + + CARD_APPLICATION_CREATED, + + CARD_APPLICATION_UPDATED, + + CARD_APPLICATION_APPROVED, + + CARD_APPLICATION_DENIED, + + COURSE_LESSON_INTERACTION_COMPLETED, + + PAYOUT_METHOD_CREATED, + + VERIFICATION_SUCCEEDED, + + IDENTITY_PROFILE_APPROVED, + + IDENTITY_PROFILE_REJECTED, + + IDENTITY_PROFILE_NEEDS_ACTION, + + IDENTITY_PROFILE_UPDATED, + + PAYOUT_ACCOUNT_STATUS_UPDATED, + + RESOLUTION_CENTER_CASE_CREATED, + + RESOLUTION_CENTER_CASE_UPDATED, + + RESOLUTION_CENTER_CASE_DECIDED, + + PRODUCT_CREATED, + + PRODUCT_UPDATED, + + PRODUCT_DELETED, + + PRODUCT_PUBLISHED, + + PRODUCT_UNPUBLISHED, + + PLAN_CREATED, + + PLAN_UPDATED, + + PLAN_DELETED, + + SHIPMENT_CREATED, + + SHIPMENT_UPDATED, + + MEMBER_CREATED, + + AD_CAMPAIGN_PAYMENT_FAILED, + + CHAT_MESSAGE_CREATED, + + CHAT_REACTION_CREATED, + + PAYMENT_CREATED, + + PAYMENT_SUCCEEDED, + + PAYMENT_FAILED, + + PAYMENT_PENDING, + + DISPUTE_CREATED, + + DISPUTE_UPDATED, + + REFUND_CREATED, + + REFUND_UPDATED, + + DISPUTE_ALERT_CREATED, + + MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, + + MEMBERSHIP_WENT_VALID, + + MEMBERSHIP_WENT_INVALID, + + MEMBERSHIP_METADATA_UPDATED, + + RESOLUTION_CREATED, + + RESOLUTION_UPDATED, + + RESOLUTION_DECIDED, + + PAYMENT_AFFILIATE_REWARD_CREATED, + + MEMBERSHIP_EXPERIENCE_CLAIMED, + + APP_MEMBERSHIP_WENT_VALID, + + APP_MEMBERSHIP_WENT_INVALID, + + APP_PAYMENT_CREATED, + + APP_PAYMENT_SUCCEEDED, + + APP_PAYMENT_FAILED, + + APP_PAYMENT_PENDING, + + APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, + + UNKNOWN + } + + public interface Visitor { + T visitAccountUpdated(); + + T visitInvoiceCreated(); + + T visitInvoiceMarkedUncollectible(); + + T visitInvoicePaid(); + + T visitInvoicePastDue(); + + T visitInvoiceVoided(); + + T visitMembershipActivated(); + + T visitMembershipDeactivated(); + + T visitMembershipTrialEndingSoon(); + + T visitEntryCreated(); + + T visitEntryApproved(); + + T visitEntryDenied(); + + T visitEntryDeleted(); + + T visitExportCompleted(); + + T visitExportFailed(); + + T visitSetupIntentRequiresAction(); + + T visitSetupIntentSucceeded(); + + T visitSetupIntentCanceled(); + + T visitLedgerAccountFundsAvailable(); + + T visitSwapCompleted(); + + T visitDepositSucceeded(); + + T visitTransferCreated(); + + T visitTransferCompleted(); + + T visitTransferFailed(); + + T visitWithdrawalCreated(); + + T visitWithdrawalUpdated(); + + T visitWithdrawalReversed(); + + T visitCardTransactionCreated(); + + T visitCardTransactionUpdated(); + + T visitCardTransactionCompleted(); + + T visitCardTransactionDeclined(); + + T visitCardTransactionReversed(); + + T visitCardCreated(); + + T visitCardUpdated(); + + T visitCardFrozen(); + + T visitCardCanceled(); + + T visitCardApplicationCreated(); + + T visitCardApplicationUpdated(); + + T visitCardApplicationApproved(); + + T visitCardApplicationDenied(); + + T visitCourseLessonInteractionCompleted(); + + T visitPayoutMethodCreated(); + + T visitVerificationSucceeded(); + + T visitIdentityProfileApproved(); + + T visitIdentityProfileRejected(); + + T visitIdentityProfileNeedsAction(); + + T visitIdentityProfileUpdated(); + + T visitPayoutAccountStatusUpdated(); + + T visitResolutionCenterCaseCreated(); + + T visitResolutionCenterCaseUpdated(); + + T visitResolutionCenterCaseDecided(); + + T visitProductCreated(); + + T visitProductUpdated(); + + T visitProductDeleted(); + + T visitProductPublished(); + + T visitProductUnpublished(); + + T visitPlanCreated(); + + T visitPlanUpdated(); + + T visitPlanDeleted(); + + T visitShipmentCreated(); + + T visitShipmentUpdated(); + + T visitMemberCreated(); + + T visitAdCampaignPaymentFailed(); + + T visitChatMessageCreated(); + + T visitChatReactionCreated(); + + T visitPaymentCreated(); + + T visitPaymentSucceeded(); + + T visitPaymentFailed(); + + T visitPaymentPending(); + + T visitDisputeCreated(); + + T visitDisputeUpdated(); + + T visitRefundCreated(); + + T visitRefundUpdated(); + + T visitDisputeAlertCreated(); + + T visitMembershipCancelAtPeriodEndChanged(); + + T visitMembershipWentValid(); + + T visitMembershipWentInvalid(); + + T visitMembershipMetadataUpdated(); + + T visitResolutionCreated(); + + T visitResolutionUpdated(); + + T visitResolutionDecided(); + + T visitPaymentAffiliateRewardCreated(); + + T visitMembershipExperienceClaimed(); + + T visitAppMembershipWentValid(); + + T visitAppMembershipWentInvalid(); + + T visitAppPaymentCreated(); + + T visitAppPaymentSucceeded(); + + T visitAppPaymentFailed(); + + T visitAppPaymentPending(); + + T visitAppMembershipCancelAtPeriodEndChanged(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/WebhookListItem.java b/src/main/java/com/whop/api/types/WebhookListItem.java new file mode 100644 index 00000000..6504f418 --- /dev/null +++ b/src/main/java/com/whop/api/types/WebhookListItem.java @@ -0,0 +1,886 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = WebhookListItem.Builder.class) +public final class WebhookListItem { + private final WebhookListItemApiVersion apiVersion; + + private final Optional apiVersionDate; + + private final boolean childResourceEvents; + + private final int consecutiveFailures; + + private final String createdAt; + + private final Optional disabledAt; + + private final Optional disabledReason; + + private final boolean enabled; + + private final List events; + + private final Optional failingSince; + + private final String id; + + private final Optional lastFailureAt; + + private final String resourceId; + + private final String url; + + private final Optional webhookSecret; + + private final Map additionalProperties; + + private WebhookListItem( + WebhookListItemApiVersion apiVersion, + Optional apiVersionDate, + boolean childResourceEvents, + int consecutiveFailures, + String createdAt, + Optional disabledAt, + Optional disabledReason, + boolean enabled, + List events, + Optional failingSince, + String id, + Optional lastFailureAt, + String resourceId, + String url, + Optional webhookSecret, + Map additionalProperties) { + this.apiVersion = apiVersion; + this.apiVersionDate = apiVersionDate; + this.childResourceEvents = childResourceEvents; + this.consecutiveFailures = consecutiveFailures; + this.createdAt = createdAt; + this.disabledAt = disabledAt; + this.disabledReason = disabledReason; + this.enabled = enabled; + this.events = events; + this.failingSince = failingSince; + this.id = id; + this.lastFailureAt = lastFailureAt; + this.resourceId = resourceId; + this.url = url; + this.webhookSecret = webhookSecret; + this.additionalProperties = additionalProperties; + } + + /** + * @return The API version used to format payloads sent to this webhook endpoint. + */ + @JsonProperty("api_version") + public WebhookListItemApiVersion getApiVersion() { + return apiVersion; + } + + /** + * @return The dated API version (Api-Version-Date) that v1 payloads for this endpoint are pinned to: events serialize exactly like a REST read at this version (the native serializer where the resource has one). Null when unpinned — legacy (v2/v5) webhooks, and v1 webhooks on the legacy payload shape. + */ + @JsonIgnore + public Optional getApiVersionDate() { + if (apiVersionDate == null) { + return Optional.empty(); + } + return apiVersionDate; + } + + /** + * @return Whether events are sent for child resources. For example, if the webhook is on an account, enabling this sends events only from its connected accounts. + */ + @JsonProperty("child_resource_events") + public boolean getChildResourceEvents() { + return childResourceEvents; + } + + /** + * @return Number of consecutive deliveries whose first attempt to this endpoint failed since it last accepted one. Later retries of the same delivery do not increment it. Resets to 0 when a delivery succeeds or the webhook is re-enabled. + */ + @JsonProperty("consecutive_failures") + public int getConsecutiveFailures() { + return consecutiveFailures; + } + + /** + * @return When the webhook was created, as an ISO 8601 timestamp. + */ + @JsonProperty("created_at") + public String getCreatedAt() { + return createdAt; + } + + /** + * @return When Whop automatically disabled this webhook, as an ISO 8601 timestamp. null unless the webhook was disabled by Whop; a webhook you disabled yourself has enabled: false and a null disabled_at. + */ + @JsonIgnore + public Optional getDisabledAt() { + if (disabledAt == null) { + return Optional.empty(); + } + return disabledAt; + } + + /** + * @return Why Whop disabled this webhook. delivery_failures means every delivery failed for 3 days straight. null when disabled_at is null. + */ + @JsonIgnore + public Optional getDisabledReason() { + if (disabledReason == null) { + return Optional.empty(); + } + return disabledReason; + } + + /** + * @return Whether this webhook endpoint is currently active and receiving events. + */ + @JsonProperty("enabled") + public boolean getEnabled() { + return enabled; + } + + @JsonProperty("events") + public List getEvents() { + return events; + } + + /** + * @return When the current failure streak began, as an ISO 8601 timestamp. Unlike last_failure_at, this is set on the streak's first failed attempt, so it shows an endpoint that is failing right now. null when the endpoint is healthy. + */ + @JsonIgnore + public Optional getFailingSince() { + if (failingSince == null) { + return Optional.empty(); + } + return failingSince; + } + + /** + * @return Webhook ID, prefixed hook_. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return When a delivery to this endpoint most recently failed after exhausting retries, as an ISO 8601 timestamp. null if no delivery has ever failed. + */ + @JsonIgnore + public Optional getLastFailureAt() { + if (lastFailureAt == null) { + return Optional.empty(); + } + return lastFailureAt; + } + + /** + * @return ID of the resource (account or app) this webhook is attached to. + */ + @JsonProperty("resource_id") + public String getResourceId() { + return resourceId; + } + + /** + * @return Destination URL where webhook payloads are delivered via HTTP POST. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + /** + * @return Secret key used to sign webhook payloads for verification. Include this in your HMAC validation logic. Returned on the create response and to interactive dashboard sessions; null for API-key and OAuth callers on later reads. + */ + @JsonIgnore + public Optional getWebhookSecret() { + if (webhookSecret == null) { + return Optional.empty(); + } + return webhookSecret; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("api_version_date") + private Optional _getApiVersionDate() { + return apiVersionDate; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("disabled_at") + private Optional _getDisabledAt() { + return disabledAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("disabled_reason") + private Optional _getDisabledReason() { + return disabledReason; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("failing_since") + private Optional _getFailingSince() { + return failingSince; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("last_failure_at") + private Optional _getLastFailureAt() { + return lastFailureAt; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("webhook_secret") + private Optional _getWebhookSecret() { + return webhookSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WebhookListItem && equalTo((WebhookListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WebhookListItem other) { + return apiVersion.equals(other.apiVersion) + && apiVersionDate.equals(other.apiVersionDate) + && childResourceEvents == other.childResourceEvents + && consecutiveFailures == other.consecutiveFailures + && createdAt.equals(other.createdAt) + && disabledAt.equals(other.disabledAt) + && disabledReason.equals(other.disabledReason) + && enabled == other.enabled + && events.equals(other.events) + && failingSince.equals(other.failingSince) + && id.equals(other.id) + && lastFailureAt.equals(other.lastFailureAt) + && resourceId.equals(other.resourceId) + && url.equals(other.url) + && webhookSecret.equals(other.webhookSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.apiVersion, + this.apiVersionDate, + this.childResourceEvents, + this.consecutiveFailures, + this.createdAt, + this.disabledAt, + this.disabledReason, + this.enabled, + this.events, + this.failingSince, + this.id, + this.lastFailureAt, + this.resourceId, + this.url, + this.webhookSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiVersionStage builder() { + return new Builder(); + } + + public interface ApiVersionStage { + /** + *

The API version used to format payloads sent to this webhook endpoint.

+ */ + ChildResourceEventsStage apiVersion(@NotNull WebhookListItemApiVersion apiVersion); + + Builder from(WebhookListItem other); + } + + public interface ChildResourceEventsStage { + /** + *

Whether events are sent for child resources. For example, if the webhook is on an account, enabling this sends events only from its connected accounts.

+ */ + ConsecutiveFailuresStage childResourceEvents(boolean childResourceEvents); + } + + public interface ConsecutiveFailuresStage { + /** + *

Number of consecutive deliveries whose first attempt to this endpoint failed since it last accepted one. Later retries of the same delivery do not increment it. Resets to 0 when a delivery succeeds or the webhook is re-enabled.

+ */ + CreatedAtStage consecutiveFailures(int consecutiveFailures); + } + + public interface CreatedAtStage { + /** + *

When the webhook was created, as an ISO 8601 timestamp.

+ */ + EnabledStage createdAt(@NotNull String createdAt); + } + + public interface EnabledStage { + /** + *

Whether this webhook endpoint is currently active and receiving events.

+ */ + IdStage enabled(boolean enabled); + } + + public interface IdStage { + /** + *

Webhook ID, prefixed hook_.

+ */ + ResourceIdStage id(@NotNull String id); + } + + public interface ResourceIdStage { + /** + *

ID of the resource (account or app) this webhook is attached to.

+ */ + UrlStage resourceId(@NotNull String resourceId); + } + + public interface UrlStage { + /** + *

Destination URL where webhook payloads are delivered via HTTP POST.

+ */ + _FinalStage url(@NotNull String url); + } + + public interface _FinalStage { + WebhookListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The dated API version (Api-Version-Date) that v1 payloads for this endpoint are pinned to: events serialize exactly like a REST read at this version (the native serializer where the resource has one). Null when unpinned — legacy (v2/v5) webhooks, and v1 webhooks on the legacy payload shape.

+ */ + _FinalStage apiVersionDate(Optional apiVersionDate); + + _FinalStage apiVersionDate(String apiVersionDate); + + _FinalStage apiVersionDate(Nullable apiVersionDate); + + /** + *

When Whop automatically disabled this webhook, as an ISO 8601 timestamp. null unless the webhook was disabled by Whop; a webhook you disabled yourself has enabled: false and a null disabled_at.

+ */ + _FinalStage disabledAt(Optional disabledAt); + + _FinalStage disabledAt(String disabledAt); + + _FinalStage disabledAt(Nullable disabledAt); + + /** + *

Why Whop disabled this webhook. delivery_failures means every delivery failed for 3 days straight. null when disabled_at is null.

+ */ + _FinalStage disabledReason(Optional disabledReason); + + _FinalStage disabledReason(WebhookListItemDisabledReason disabledReason); + + _FinalStage disabledReason(Nullable disabledReason); + + _FinalStage events(List events); + + _FinalStage addEvents(WebhookListItemEventsItem events); + + _FinalStage addAllEvents(List events); + + /** + *

When the current failure streak began, as an ISO 8601 timestamp. Unlike last_failure_at, this is set on the streak's first failed attempt, so it shows an endpoint that is failing right now. null when the endpoint is healthy.

+ */ + _FinalStage failingSince(Optional failingSince); + + _FinalStage failingSince(String failingSince); + + _FinalStage failingSince(Nullable failingSince); + + /** + *

When a delivery to this endpoint most recently failed after exhausting retries, as an ISO 8601 timestamp. null if no delivery has ever failed.

+ */ + _FinalStage lastFailureAt(Optional lastFailureAt); + + _FinalStage lastFailureAt(String lastFailureAt); + + _FinalStage lastFailureAt(Nullable lastFailureAt); + + /** + *

Secret key used to sign webhook payloads for verification. Include this in your HMAC validation logic. Returned on the create response and to interactive dashboard sessions; null for API-key and OAuth callers on later reads.

+ */ + _FinalStage webhookSecret(Optional webhookSecret); + + _FinalStage webhookSecret(String webhookSecret); + + _FinalStage webhookSecret(Nullable webhookSecret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiVersionStage, + ChildResourceEventsStage, + ConsecutiveFailuresStage, + CreatedAtStage, + EnabledStage, + IdStage, + ResourceIdStage, + UrlStage, + _FinalStage { + private WebhookListItemApiVersion apiVersion; + + private boolean childResourceEvents; + + private int consecutiveFailures; + + private String createdAt; + + private boolean enabled; + + private String id; + + private String resourceId; + + private String url; + + private Optional webhookSecret = Optional.empty(); + + private Optional lastFailureAt = Optional.empty(); + + private Optional failingSince = Optional.empty(); + + private List events = new ArrayList<>(); + + private Optional disabledReason = Optional.empty(); + + private Optional disabledAt = Optional.empty(); + + private Optional apiVersionDate = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(WebhookListItem other) { + apiVersion(other.getApiVersion()); + apiVersionDate(other.getApiVersionDate()); + childResourceEvents(other.getChildResourceEvents()); + consecutiveFailures(other.getConsecutiveFailures()); + createdAt(other.getCreatedAt()); + disabledAt(other.getDisabledAt()); + disabledReason(other.getDisabledReason()); + enabled(other.getEnabled()); + events(other.getEvents()); + failingSince(other.getFailingSince()); + id(other.getId()); + lastFailureAt(other.getLastFailureAt()); + resourceId(other.getResourceId()); + url(other.getUrl()); + webhookSecret(other.getWebhookSecret()); + return this; + } + + /** + *

The API version used to format payloads sent to this webhook endpoint.

+ *

The API version used to format payloads sent to this webhook endpoint.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("api_version") + public ChildResourceEventsStage apiVersion(@NotNull WebhookListItemApiVersion apiVersion) { + this.apiVersion = Objects.requireNonNull(apiVersion, "apiVersion must not be null"); + return this; + } + + /** + *

Whether events are sent for child resources. For example, if the webhook is on an account, enabling this sends events only from its connected accounts.

+ *

Whether events are sent for child resources. For example, if the webhook is on an account, enabling this sends events only from its connected accounts.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("child_resource_events") + public ConsecutiveFailuresStage childResourceEvents(boolean childResourceEvents) { + this.childResourceEvents = childResourceEvents; + return this; + } + + /** + *

Number of consecutive deliveries whose first attempt to this endpoint failed since it last accepted one. Later retries of the same delivery do not increment it. Resets to 0 when a delivery succeeds or the webhook is re-enabled.

+ *

Number of consecutive deliveries whose first attempt to this endpoint failed since it last accepted one. Later retries of the same delivery do not increment it. Resets to 0 when a delivery succeeds or the webhook is re-enabled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("consecutive_failures") + public CreatedAtStage consecutiveFailures(int consecutiveFailures) { + this.consecutiveFailures = consecutiveFailures; + return this; + } + + /** + *

When the webhook was created, as an ISO 8601 timestamp.

+ *

When the webhook was created, as an ISO 8601 timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public EnabledStage createdAt(@NotNull String createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

Whether this webhook endpoint is currently active and receiving events.

+ *

Whether this webhook endpoint is currently active and receiving events.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("enabled") + public IdStage enabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + *

Webhook ID, prefixed hook_.

+ *

Webhook ID, prefixed hook_.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ResourceIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

ID of the resource (account or app) this webhook is attached to.

+ *

ID of the resource (account or app) this webhook is attached to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("resource_id") + public UrlStage resourceId(@NotNull String resourceId) { + this.resourceId = Objects.requireNonNull(resourceId, "resourceId must not be null"); + return this; + } + + /** + *

Destination URL where webhook payloads are delivered via HTTP POST.

+ *

Destination URL where webhook payloads are delivered via HTTP POST.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + /** + *

Secret key used to sign webhook payloads for verification. Include this in your HMAC validation logic. Returned on the create response and to interactive dashboard sessions; null for API-key and OAuth callers on later reads.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage webhookSecret(Nullable webhookSecret) { + if (webhookSecret.isNull()) { + this.webhookSecret = null; + } else if (webhookSecret.isEmpty()) { + this.webhookSecret = Optional.empty(); + } else { + this.webhookSecret = Optional.of(webhookSecret.get()); + } + return this; + } + + /** + *

Secret key used to sign webhook payloads for verification. Include this in your HMAC validation logic. Returned on the create response and to interactive dashboard sessions; null for API-key and OAuth callers on later reads.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage webhookSecret(String webhookSecret) { + this.webhookSecret = Optional.ofNullable(webhookSecret); + return this; + } + + /** + *

Secret key used to sign webhook payloads for verification. Include this in your HMAC validation logic. Returned on the create response and to interactive dashboard sessions; null for API-key and OAuth callers on later reads.

+ */ + @java.lang.Override + @JsonSetter(value = "webhook_secret", nulls = Nulls.SKIP) + public _FinalStage webhookSecret(Optional webhookSecret) { + this.webhookSecret = webhookSecret; + return this; + } + + /** + *

When a delivery to this endpoint most recently failed after exhausting retries, as an ISO 8601 timestamp. null if no delivery has ever failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastFailureAt(Nullable lastFailureAt) { + if (lastFailureAt.isNull()) { + this.lastFailureAt = null; + } else if (lastFailureAt.isEmpty()) { + this.lastFailureAt = Optional.empty(); + } else { + this.lastFailureAt = Optional.of(lastFailureAt.get()); + } + return this; + } + + /** + *

When a delivery to this endpoint most recently failed after exhausting retries, as an ISO 8601 timestamp. null if no delivery has ever failed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage lastFailureAt(String lastFailureAt) { + this.lastFailureAt = Optional.ofNullable(lastFailureAt); + return this; + } + + /** + *

When a delivery to this endpoint most recently failed after exhausting retries, as an ISO 8601 timestamp. null if no delivery has ever failed.

+ */ + @java.lang.Override + @JsonSetter(value = "last_failure_at", nulls = Nulls.SKIP) + public _FinalStage lastFailureAt(Optional lastFailureAt) { + this.lastFailureAt = lastFailureAt; + return this; + } + + /** + *

When the current failure streak began, as an ISO 8601 timestamp. Unlike last_failure_at, this is set on the streak's first failed attempt, so it shows an endpoint that is failing right now. null when the endpoint is healthy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failingSince(Nullable failingSince) { + if (failingSince.isNull()) { + this.failingSince = null; + } else if (failingSince.isEmpty()) { + this.failingSince = Optional.empty(); + } else { + this.failingSince = Optional.of(failingSince.get()); + } + return this; + } + + /** + *

When the current failure streak began, as an ISO 8601 timestamp. Unlike last_failure_at, this is set on the streak's first failed attempt, so it shows an endpoint that is failing right now. null when the endpoint is healthy.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage failingSince(String failingSince) { + this.failingSince = Optional.ofNullable(failingSince); + return this; + } + + /** + *

When the current failure streak began, as an ISO 8601 timestamp. Unlike last_failure_at, this is set on the streak's first failed attempt, so it shows an endpoint that is failing right now. null when the endpoint is healthy.

+ */ + @java.lang.Override + @JsonSetter(value = "failing_since", nulls = Nulls.SKIP) + public _FinalStage failingSince(Optional failingSince) { + this.failingSince = failingSince; + return this; + } + + @java.lang.Override + public _FinalStage addAllEvents(List events) { + if (events != null) { + this.events.addAll(events); + } + return this; + } + + @java.lang.Override + public _FinalStage addEvents(WebhookListItemEventsItem events) { + this.events.add(events); + return this; + } + + @java.lang.Override + @JsonSetter(value = "events", nulls = Nulls.SKIP) + public _FinalStage events(List events) { + this.events.clear(); + if (events != null) { + this.events.addAll(events); + } + return this; + } + + /** + *

Why Whop disabled this webhook. delivery_failures means every delivery failed for 3 days straight. null when disabled_at is null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disabledReason(Nullable disabledReason) { + if (disabledReason.isNull()) { + this.disabledReason = null; + } else if (disabledReason.isEmpty()) { + this.disabledReason = Optional.empty(); + } else { + this.disabledReason = Optional.of(disabledReason.get()); + } + return this; + } + + /** + *

Why Whop disabled this webhook. delivery_failures means every delivery failed for 3 days straight. null when disabled_at is null.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disabledReason(WebhookListItemDisabledReason disabledReason) { + this.disabledReason = Optional.ofNullable(disabledReason); + return this; + } + + /** + *

Why Whop disabled this webhook. delivery_failures means every delivery failed for 3 days straight. null when disabled_at is null.

+ */ + @java.lang.Override + @JsonSetter(value = "disabled_reason", nulls = Nulls.SKIP) + public _FinalStage disabledReason(Optional disabledReason) { + this.disabledReason = disabledReason; + return this; + } + + /** + *

When Whop automatically disabled this webhook, as an ISO 8601 timestamp. null unless the webhook was disabled by Whop; a webhook you disabled yourself has enabled: false and a null disabled_at.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disabledAt(Nullable disabledAt) { + if (disabledAt.isNull()) { + this.disabledAt = null; + } else if (disabledAt.isEmpty()) { + this.disabledAt = Optional.empty(); + } else { + this.disabledAt = Optional.of(disabledAt.get()); + } + return this; + } + + /** + *

When Whop automatically disabled this webhook, as an ISO 8601 timestamp. null unless the webhook was disabled by Whop; a webhook you disabled yourself has enabled: false and a null disabled_at.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage disabledAt(String disabledAt) { + this.disabledAt = Optional.ofNullable(disabledAt); + return this; + } + + /** + *

When Whop automatically disabled this webhook, as an ISO 8601 timestamp. null unless the webhook was disabled by Whop; a webhook you disabled yourself has enabled: false and a null disabled_at.

+ */ + @java.lang.Override + @JsonSetter(value = "disabled_at", nulls = Nulls.SKIP) + public _FinalStage disabledAt(Optional disabledAt) { + this.disabledAt = disabledAt; + return this; + } + + /** + *

The dated API version (Api-Version-Date) that v1 payloads for this endpoint are pinned to: events serialize exactly like a REST read at this version (the native serializer where the resource has one). Null when unpinned — legacy (v2/v5) webhooks, and v1 webhooks on the legacy payload shape.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(Nullable apiVersionDate) { + if (apiVersionDate.isNull()) { + this.apiVersionDate = null; + } else if (apiVersionDate.isEmpty()) { + this.apiVersionDate = Optional.empty(); + } else { + this.apiVersionDate = Optional.of(apiVersionDate.get()); + } + return this; + } + + /** + *

The dated API version (Api-Version-Date) that v1 payloads for this endpoint are pinned to: events serialize exactly like a REST read at this version (the native serializer where the resource has one). Null when unpinned — legacy (v2/v5) webhooks, and v1 webhooks on the legacy payload shape.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiVersionDate(String apiVersionDate) { + this.apiVersionDate = Optional.ofNullable(apiVersionDate); + return this; + } + + /** + *

The dated API version (Api-Version-Date) that v1 payloads for this endpoint are pinned to: events serialize exactly like a REST read at this version (the native serializer where the resource has one). Null when unpinned — legacy (v2/v5) webhooks, and v1 webhooks on the legacy payload shape.

+ */ + @java.lang.Override + @JsonSetter(value = "api_version_date", nulls = Nulls.SKIP) + public _FinalStage apiVersionDate(Optional apiVersionDate) { + this.apiVersionDate = apiVersionDate; + return this; + } + + @java.lang.Override + public WebhookListItem build() { + return new WebhookListItem( + apiVersion, + apiVersionDate, + childResourceEvents, + consecutiveFailures, + createdAt, + disabledAt, + disabledReason, + enabled, + events, + failingSince, + id, + lastFailureAt, + resourceId, + url, + webhookSecret, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/WebhookListItemApiVersion.java b/src/main/java/com/whop/api/types/WebhookListItemApiVersion.java new file mode 100644 index 00000000..b33aa1f0 --- /dev/null +++ b/src/main/java/com/whop/api/types/WebhookListItemApiVersion.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WebhookListItemApiVersion { + public static final WebhookListItemApiVersion V2 = new WebhookListItemApiVersion(Value.V2, "v2"); + + public static final WebhookListItemApiVersion V1 = new WebhookListItemApiVersion(Value.V1, "v1"); + + public static final WebhookListItemApiVersion V5 = new WebhookListItemApiVersion(Value.V5, "v5"); + + private final Value value; + + private final String string; + + WebhookListItemApiVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof WebhookListItemApiVersion + && this.string.equals(((WebhookListItemApiVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V2: + return visitor.visitV2(); + case V1: + return visitor.visitV1(); + case V5: + return visitor.visitV5(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WebhookListItemApiVersion valueOf(String value) { + switch (value) { + case "v2": + return V2; + case "v1": + return V1; + case "v5": + return V5; + default: + return new WebhookListItemApiVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V1, + + V2, + + V5, + + UNKNOWN + } + + public interface Visitor { + T visitV1(); + + T visitV2(); + + T visitV5(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/WebhookListItemDisabledReason.java b/src/main/java/com/whop/api/types/WebhookListItemDisabledReason.java new file mode 100644 index 00000000..fb6ca4ea --- /dev/null +++ b/src/main/java/com/whop/api/types/WebhookListItemDisabledReason.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WebhookListItemDisabledReason { + public static final WebhookListItemDisabledReason DELIVERY_FAILURES = + new WebhookListItemDisabledReason(Value.DELIVERY_FAILURES, "delivery_failures"); + + private final Value value; + + private final String string; + + WebhookListItemDisabledReason(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof WebhookListItemDisabledReason + && this.string.equals(((WebhookListItemDisabledReason) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DELIVERY_FAILURES: + return visitor.visitDeliveryFailures(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WebhookListItemDisabledReason valueOf(String value) { + switch (value) { + case "delivery_failures": + return DELIVERY_FAILURES; + default: + return new WebhookListItemDisabledReason(Value.UNKNOWN, value); + } + } + + public enum Value { + DELIVERY_FAILURES, + + UNKNOWN + } + + public interface Visitor { + T visitDeliveryFailures(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/WebhookListItemEventsItem.java b/src/main/java/com/whop/api/types/WebhookListItemEventsItem.java new file mode 100644 index 00000000..434828ec --- /dev/null +++ b/src/main/java/com/whop/api/types/WebhookListItemEventsItem.java @@ -0,0 +1,1056 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WebhookListItemEventsItem { + public static final WebhookListItemEventsItem RESOLUTION_CENTER_CASE_CREATED = + new WebhookListItemEventsItem(Value.RESOLUTION_CENTER_CASE_CREATED, "resolution_center_case.created"); + + public static final WebhookListItemEventsItem PAYMENT_AFFILIATE_REWARD_CREATED = + new WebhookListItemEventsItem(Value.PAYMENT_AFFILIATE_REWARD_CREATED, "payment.affiliate_reward_created"); + + public static final WebhookListItemEventsItem APP_PAYMENT_CREATED = + new WebhookListItemEventsItem(Value.APP_PAYMENT_CREATED, "app_payment.created"); + + public static final WebhookListItemEventsItem AD_CAMPAIGN_PAYMENT_FAILED = + new WebhookListItemEventsItem(Value.AD_CAMPAIGN_PAYMENT_FAILED, "ad_campaign.payment_failed"); + + public static final WebhookListItemEventsItem IDENTITY_PROFILE_REJECTED = + new WebhookListItemEventsItem(Value.IDENTITY_PROFILE_REJECTED, "identity_profile.rejected"); + + public static final WebhookListItemEventsItem PLAN_DELETED = + new WebhookListItemEventsItem(Value.PLAN_DELETED, "plan.deleted"); + + public static final WebhookListItemEventsItem RESOLUTION_CREATED = + new WebhookListItemEventsItem(Value.RESOLUTION_CREATED, "resolution.created"); + + public static final WebhookListItemEventsItem PAYOUT_METHOD_CREATED = + new WebhookListItemEventsItem(Value.PAYOUT_METHOD_CREATED, "payout_method.created"); + + public static final WebhookListItemEventsItem MEMBERSHIP_WENT_INVALID = + new WebhookListItemEventsItem(Value.MEMBERSHIP_WENT_INVALID, "membership.went_invalid"); + + public static final WebhookListItemEventsItem TRANSFER_COMPLETED = + new WebhookListItemEventsItem(Value.TRANSFER_COMPLETED, "transfer.completed"); + + public static final WebhookListItemEventsItem CARD_APPLICATION_DENIED = + new WebhookListItemEventsItem(Value.CARD_APPLICATION_DENIED, "card_application.denied"); + + public static final WebhookListItemEventsItem TRANSFER_CREATED = + new WebhookListItemEventsItem(Value.TRANSFER_CREATED, "transfer.created"); + + public static final WebhookListItemEventsItem CARD_APPLICATION_CREATED = + new WebhookListItemEventsItem(Value.CARD_APPLICATION_CREATED, "card_application.created"); + + public static final WebhookListItemEventsItem MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED = + new WebhookListItemEventsItem( + Value.MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, "membership.cancel_at_period_end_changed"); + + public static final WebhookListItemEventsItem ENTRY_DENIED = + new WebhookListItemEventsItem(Value.ENTRY_DENIED, "entry.denied"); + + public static final WebhookListItemEventsItem TRANSFER_FAILED = + new WebhookListItemEventsItem(Value.TRANSFER_FAILED, "transfer.failed"); + + public static final WebhookListItemEventsItem COURSE_LESSON_INTERACTION_COMPLETED = new WebhookListItemEventsItem( + Value.COURSE_LESSON_INTERACTION_COMPLETED, "course_lesson_interaction.completed"); + + public static final WebhookListItemEventsItem CARD_CANCELED = + new WebhookListItemEventsItem(Value.CARD_CANCELED, "card.canceled"); + + public static final WebhookListItemEventsItem DEPOSIT_SUCCEEDED = + new WebhookListItemEventsItem(Value.DEPOSIT_SUCCEEDED, "deposit.succeeded"); + + public static final WebhookListItemEventsItem VERIFICATION_SUCCEEDED = + new WebhookListItemEventsItem(Value.VERIFICATION_SUCCEEDED, "verification.succeeded"); + + public static final WebhookListItemEventsItem PLAN_UPDATED = + new WebhookListItemEventsItem(Value.PLAN_UPDATED, "plan.updated"); + + public static final WebhookListItemEventsItem PRODUCT_CREATED = + new WebhookListItemEventsItem(Value.PRODUCT_CREATED, "product.created"); + + public static final WebhookListItemEventsItem MEMBER_CREATED = + new WebhookListItemEventsItem(Value.MEMBER_CREATED, "member.created"); + + public static final WebhookListItemEventsItem SETUP_INTENT_SUCCEEDED = + new WebhookListItemEventsItem(Value.SETUP_INTENT_SUCCEEDED, "setup_intent.succeeded"); + + public static final WebhookListItemEventsItem CARD_TRANSACTION_COMPLETED = + new WebhookListItemEventsItem(Value.CARD_TRANSACTION_COMPLETED, "card_transaction.completed"); + + public static final WebhookListItemEventsItem MEMBERSHIP_DEACTIVATED = + new WebhookListItemEventsItem(Value.MEMBERSHIP_DEACTIVATED, "membership.deactivated"); + + public static final WebhookListItemEventsItem CARD_TRANSACTION_REVERSED = + new WebhookListItemEventsItem(Value.CARD_TRANSACTION_REVERSED, "card_transaction.reversed"); + + public static final WebhookListItemEventsItem CARD_FROZEN = + new WebhookListItemEventsItem(Value.CARD_FROZEN, "card.frozen"); + + public static final WebhookListItemEventsItem WITHDRAWAL_UPDATED = + new WebhookListItemEventsItem(Value.WITHDRAWAL_UPDATED, "withdrawal.updated"); + + public static final WebhookListItemEventsItem SETUP_INTENT_CANCELED = + new WebhookListItemEventsItem(Value.SETUP_INTENT_CANCELED, "setup_intent.canceled"); + + public static final WebhookListItemEventsItem APP_PAYMENT_FAILED = + new WebhookListItemEventsItem(Value.APP_PAYMENT_FAILED, "app_payment.failed"); + + public static final WebhookListItemEventsItem APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED = + new WebhookListItemEventsItem( + Value.APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, "app_membership.cancel_at_period_end_changed"); + + public static final WebhookListItemEventsItem APP_PAYMENT_SUCCEEDED = + new WebhookListItemEventsItem(Value.APP_PAYMENT_SUCCEEDED, "app_payment.succeeded"); + + public static final WebhookListItemEventsItem CARD_CREATED = + new WebhookListItemEventsItem(Value.CARD_CREATED, "card.created"); + + public static final WebhookListItemEventsItem RESOLUTION_CENTER_CASE_UPDATED = + new WebhookListItemEventsItem(Value.RESOLUTION_CENTER_CASE_UPDATED, "resolution_center_case.updated"); + + public static final WebhookListItemEventsItem PRODUCT_UNPUBLISHED = + new WebhookListItemEventsItem(Value.PRODUCT_UNPUBLISHED, "product.unpublished"); + + public static final WebhookListItemEventsItem PAYMENT_FAILED = + new WebhookListItemEventsItem(Value.PAYMENT_FAILED, "payment.failed"); + + public static final WebhookListItemEventsItem APP_PAYMENT_PENDING = + new WebhookListItemEventsItem(Value.APP_PAYMENT_PENDING, "app_payment.pending"); + + public static final WebhookListItemEventsItem ENTRY_DELETED = + new WebhookListItemEventsItem(Value.ENTRY_DELETED, "entry.deleted"); + + public static final WebhookListItemEventsItem SWAP_COMPLETED = + new WebhookListItemEventsItem(Value.SWAP_COMPLETED, "swap.completed"); + + public static final WebhookListItemEventsItem ENTRY_APPROVED = + new WebhookListItemEventsItem(Value.ENTRY_APPROVED, "entry.approved"); + + public static final WebhookListItemEventsItem DISPUTE_ALERT_CREATED = + new WebhookListItemEventsItem(Value.DISPUTE_ALERT_CREATED, "dispute_alert.created"); + + public static final WebhookListItemEventsItem CARD_TRANSACTION_CREATED = + new WebhookListItemEventsItem(Value.CARD_TRANSACTION_CREATED, "card_transaction.created"); + + public static final WebhookListItemEventsItem REFUND_UPDATED = + new WebhookListItemEventsItem(Value.REFUND_UPDATED, "refund.updated"); + + public static final WebhookListItemEventsItem RESOLUTION_DECIDED = + new WebhookListItemEventsItem(Value.RESOLUTION_DECIDED, "resolution.decided"); + + public static final WebhookListItemEventsItem WITHDRAWAL_REVERSED = + new WebhookListItemEventsItem(Value.WITHDRAWAL_REVERSED, "withdrawal.reversed"); + + public static final WebhookListItemEventsItem PAYOUT_ACCOUNT_STATUS_UPDATED = + new WebhookListItemEventsItem(Value.PAYOUT_ACCOUNT_STATUS_UPDATED, "payout_account.status_updated"); + + public static final WebhookListItemEventsItem IDENTITY_PROFILE_APPROVED = + new WebhookListItemEventsItem(Value.IDENTITY_PROFILE_APPROVED, "identity_profile.approved"); + + public static final WebhookListItemEventsItem SHIPMENT_CREATED = + new WebhookListItemEventsItem(Value.SHIPMENT_CREATED, "shipment.created"); + + public static final WebhookListItemEventsItem DISPUTE_UPDATED = + new WebhookListItemEventsItem(Value.DISPUTE_UPDATED, "dispute.updated"); + + public static final WebhookListItemEventsItem ENTRY_CREATED = + new WebhookListItemEventsItem(Value.ENTRY_CREATED, "entry.created"); + + public static final WebhookListItemEventsItem APP_MEMBERSHIP_WENT_VALID = + new WebhookListItemEventsItem(Value.APP_MEMBERSHIP_WENT_VALID, "app_membership.went_valid"); + + public static final WebhookListItemEventsItem PRODUCT_UPDATED = + new WebhookListItemEventsItem(Value.PRODUCT_UPDATED, "product.updated"); + + public static final WebhookListItemEventsItem ACCOUNT_UPDATED = + new WebhookListItemEventsItem(Value.ACCOUNT_UPDATED, "account.updated"); + + public static final WebhookListItemEventsItem WITHDRAWAL_CREATED = + new WebhookListItemEventsItem(Value.WITHDRAWAL_CREATED, "withdrawal.created"); + + public static final WebhookListItemEventsItem CHAT_MESSAGE_CREATED = + new WebhookListItemEventsItem(Value.CHAT_MESSAGE_CREATED, "chat.message.created"); + + public static final WebhookListItemEventsItem LEDGER_ACCOUNT_FUNDS_AVAILABLE = + new WebhookListItemEventsItem(Value.LEDGER_ACCOUNT_FUNDS_AVAILABLE, "ledger_account.funds_available"); + + public static final WebhookListItemEventsItem MEMBERSHIP_ACTIVATED = + new WebhookListItemEventsItem(Value.MEMBERSHIP_ACTIVATED, "membership.activated"); + + public static final WebhookListItemEventsItem PAYMENT_PENDING = + new WebhookListItemEventsItem(Value.PAYMENT_PENDING, "payment.pending"); + + public static final WebhookListItemEventsItem MEMBERSHIP_TRIAL_ENDING_SOON = + new WebhookListItemEventsItem(Value.MEMBERSHIP_TRIAL_ENDING_SOON, "membership.trial_ending_soon"); + + public static final WebhookListItemEventsItem REFUND_CREATED = + new WebhookListItemEventsItem(Value.REFUND_CREATED, "refund.created"); + + public static final WebhookListItemEventsItem CARD_UPDATED = + new WebhookListItemEventsItem(Value.CARD_UPDATED, "card.updated"); + + public static final WebhookListItemEventsItem CARD_APPLICATION_APPROVED = + new WebhookListItemEventsItem(Value.CARD_APPLICATION_APPROVED, "card_application.approved"); + + public static final WebhookListItemEventsItem PRODUCT_DELETED = + new WebhookListItemEventsItem(Value.PRODUCT_DELETED, "product.deleted"); + + public static final WebhookListItemEventsItem PAYMENT_CREATED = + new WebhookListItemEventsItem(Value.PAYMENT_CREATED, "payment.created"); + + public static final WebhookListItemEventsItem INVOICE_MARKED_UNCOLLECTIBLE = + new WebhookListItemEventsItem(Value.INVOICE_MARKED_UNCOLLECTIBLE, "invoice.marked_uncollectible"); + + public static final WebhookListItemEventsItem RESOLUTION_CENTER_CASE_DECIDED = + new WebhookListItemEventsItem(Value.RESOLUTION_CENTER_CASE_DECIDED, "resolution_center_case.decided"); + + public static final WebhookListItemEventsItem MEMBERSHIP_EXPERIENCE_CLAIMED = + new WebhookListItemEventsItem(Value.MEMBERSHIP_EXPERIENCE_CLAIMED, "membership.experience_claimed"); + + public static final WebhookListItemEventsItem EXPORT_COMPLETED = + new WebhookListItemEventsItem(Value.EXPORT_COMPLETED, "export.completed"); + + public static final WebhookListItemEventsItem PRODUCT_PUBLISHED = + new WebhookListItemEventsItem(Value.PRODUCT_PUBLISHED, "product.published"); + + public static final WebhookListItemEventsItem CARD_APPLICATION_UPDATED = + new WebhookListItemEventsItem(Value.CARD_APPLICATION_UPDATED, "card_application.updated"); + + public static final WebhookListItemEventsItem RESOLUTION_UPDATED = + new WebhookListItemEventsItem(Value.RESOLUTION_UPDATED, "resolution.updated"); + + public static final WebhookListItemEventsItem EXPORT_FAILED = + new WebhookListItemEventsItem(Value.EXPORT_FAILED, "export.failed"); + + public static final WebhookListItemEventsItem MEMBERSHIP_METADATA_UPDATED = + new WebhookListItemEventsItem(Value.MEMBERSHIP_METADATA_UPDATED, "membership.metadata_updated"); + + public static final WebhookListItemEventsItem CARD_TRANSACTION_UPDATED = + new WebhookListItemEventsItem(Value.CARD_TRANSACTION_UPDATED, "card_transaction.updated"); + + public static final WebhookListItemEventsItem CHAT_REACTION_CREATED = + new WebhookListItemEventsItem(Value.CHAT_REACTION_CREATED, "chat.reaction.created"); + + public static final WebhookListItemEventsItem PAYMENT_SUCCEEDED = + new WebhookListItemEventsItem(Value.PAYMENT_SUCCEEDED, "payment.succeeded"); + + public static final WebhookListItemEventsItem SHIPMENT_UPDATED = + new WebhookListItemEventsItem(Value.SHIPMENT_UPDATED, "shipment.updated"); + + public static final WebhookListItemEventsItem DISPUTE_CREATED = + new WebhookListItemEventsItem(Value.DISPUTE_CREATED, "dispute.created"); + + public static final WebhookListItemEventsItem INVOICE_CREATED = + new WebhookListItemEventsItem(Value.INVOICE_CREATED, "invoice.created"); + + public static final WebhookListItemEventsItem INVOICE_PAST_DUE = + new WebhookListItemEventsItem(Value.INVOICE_PAST_DUE, "invoice.past_due"); + + public static final WebhookListItemEventsItem MEMBERSHIP_WENT_VALID = + new WebhookListItemEventsItem(Value.MEMBERSHIP_WENT_VALID, "membership.went_valid"); + + public static final WebhookListItemEventsItem IDENTITY_PROFILE_NEEDS_ACTION = + new WebhookListItemEventsItem(Value.IDENTITY_PROFILE_NEEDS_ACTION, "identity_profile.needs_action"); + + public static final WebhookListItemEventsItem INVOICE_PAID = + new WebhookListItemEventsItem(Value.INVOICE_PAID, "invoice.paid"); + + public static final WebhookListItemEventsItem PLAN_CREATED = + new WebhookListItemEventsItem(Value.PLAN_CREATED, "plan.created"); + + public static final WebhookListItemEventsItem SETUP_INTENT_REQUIRES_ACTION = + new WebhookListItemEventsItem(Value.SETUP_INTENT_REQUIRES_ACTION, "setup_intent.requires_action"); + + public static final WebhookListItemEventsItem INVOICE_VOIDED = + new WebhookListItemEventsItem(Value.INVOICE_VOIDED, "invoice.voided"); + + public static final WebhookListItemEventsItem CARD_TRANSACTION_DECLINED = + new WebhookListItemEventsItem(Value.CARD_TRANSACTION_DECLINED, "card_transaction.declined"); + + public static final WebhookListItemEventsItem IDENTITY_PROFILE_UPDATED = + new WebhookListItemEventsItem(Value.IDENTITY_PROFILE_UPDATED, "identity_profile.updated"); + + public static final WebhookListItemEventsItem APP_MEMBERSHIP_WENT_INVALID = + new WebhookListItemEventsItem(Value.APP_MEMBERSHIP_WENT_INVALID, "app_membership.went_invalid"); + + private final Value value; + + private final String string; + + WebhookListItemEventsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof WebhookListItemEventsItem + && this.string.equals(((WebhookListItemEventsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RESOLUTION_CENTER_CASE_CREATED: + return visitor.visitResolutionCenterCaseCreated(); + case PAYMENT_AFFILIATE_REWARD_CREATED: + return visitor.visitPaymentAffiliateRewardCreated(); + case APP_PAYMENT_CREATED: + return visitor.visitAppPaymentCreated(); + case AD_CAMPAIGN_PAYMENT_FAILED: + return visitor.visitAdCampaignPaymentFailed(); + case IDENTITY_PROFILE_REJECTED: + return visitor.visitIdentityProfileRejected(); + case PLAN_DELETED: + return visitor.visitPlanDeleted(); + case RESOLUTION_CREATED: + return visitor.visitResolutionCreated(); + case PAYOUT_METHOD_CREATED: + return visitor.visitPayoutMethodCreated(); + case MEMBERSHIP_WENT_INVALID: + return visitor.visitMembershipWentInvalid(); + case TRANSFER_COMPLETED: + return visitor.visitTransferCompleted(); + case CARD_APPLICATION_DENIED: + return visitor.visitCardApplicationDenied(); + case TRANSFER_CREATED: + return visitor.visitTransferCreated(); + case CARD_APPLICATION_CREATED: + return visitor.visitCardApplicationCreated(); + case MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED: + return visitor.visitMembershipCancelAtPeriodEndChanged(); + case ENTRY_DENIED: + return visitor.visitEntryDenied(); + case TRANSFER_FAILED: + return visitor.visitTransferFailed(); + case COURSE_LESSON_INTERACTION_COMPLETED: + return visitor.visitCourseLessonInteractionCompleted(); + case CARD_CANCELED: + return visitor.visitCardCanceled(); + case DEPOSIT_SUCCEEDED: + return visitor.visitDepositSucceeded(); + case VERIFICATION_SUCCEEDED: + return visitor.visitVerificationSucceeded(); + case PLAN_UPDATED: + return visitor.visitPlanUpdated(); + case PRODUCT_CREATED: + return visitor.visitProductCreated(); + case MEMBER_CREATED: + return visitor.visitMemberCreated(); + case SETUP_INTENT_SUCCEEDED: + return visitor.visitSetupIntentSucceeded(); + case CARD_TRANSACTION_COMPLETED: + return visitor.visitCardTransactionCompleted(); + case MEMBERSHIP_DEACTIVATED: + return visitor.visitMembershipDeactivated(); + case CARD_TRANSACTION_REVERSED: + return visitor.visitCardTransactionReversed(); + case CARD_FROZEN: + return visitor.visitCardFrozen(); + case WITHDRAWAL_UPDATED: + return visitor.visitWithdrawalUpdated(); + case SETUP_INTENT_CANCELED: + return visitor.visitSetupIntentCanceled(); + case APP_PAYMENT_FAILED: + return visitor.visitAppPaymentFailed(); + case APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED: + return visitor.visitAppMembershipCancelAtPeriodEndChanged(); + case APP_PAYMENT_SUCCEEDED: + return visitor.visitAppPaymentSucceeded(); + case CARD_CREATED: + return visitor.visitCardCreated(); + case RESOLUTION_CENTER_CASE_UPDATED: + return visitor.visitResolutionCenterCaseUpdated(); + case PRODUCT_UNPUBLISHED: + return visitor.visitProductUnpublished(); + case PAYMENT_FAILED: + return visitor.visitPaymentFailed(); + case APP_PAYMENT_PENDING: + return visitor.visitAppPaymentPending(); + case ENTRY_DELETED: + return visitor.visitEntryDeleted(); + case SWAP_COMPLETED: + return visitor.visitSwapCompleted(); + case ENTRY_APPROVED: + return visitor.visitEntryApproved(); + case DISPUTE_ALERT_CREATED: + return visitor.visitDisputeAlertCreated(); + case CARD_TRANSACTION_CREATED: + return visitor.visitCardTransactionCreated(); + case REFUND_UPDATED: + return visitor.visitRefundUpdated(); + case RESOLUTION_DECIDED: + return visitor.visitResolutionDecided(); + case WITHDRAWAL_REVERSED: + return visitor.visitWithdrawalReversed(); + case PAYOUT_ACCOUNT_STATUS_UPDATED: + return visitor.visitPayoutAccountStatusUpdated(); + case IDENTITY_PROFILE_APPROVED: + return visitor.visitIdentityProfileApproved(); + case SHIPMENT_CREATED: + return visitor.visitShipmentCreated(); + case DISPUTE_UPDATED: + return visitor.visitDisputeUpdated(); + case ENTRY_CREATED: + return visitor.visitEntryCreated(); + case APP_MEMBERSHIP_WENT_VALID: + return visitor.visitAppMembershipWentValid(); + case PRODUCT_UPDATED: + return visitor.visitProductUpdated(); + case ACCOUNT_UPDATED: + return visitor.visitAccountUpdated(); + case WITHDRAWAL_CREATED: + return visitor.visitWithdrawalCreated(); + case CHAT_MESSAGE_CREATED: + return visitor.visitChatMessageCreated(); + case LEDGER_ACCOUNT_FUNDS_AVAILABLE: + return visitor.visitLedgerAccountFundsAvailable(); + case MEMBERSHIP_ACTIVATED: + return visitor.visitMembershipActivated(); + case PAYMENT_PENDING: + return visitor.visitPaymentPending(); + case MEMBERSHIP_TRIAL_ENDING_SOON: + return visitor.visitMembershipTrialEndingSoon(); + case REFUND_CREATED: + return visitor.visitRefundCreated(); + case CARD_UPDATED: + return visitor.visitCardUpdated(); + case CARD_APPLICATION_APPROVED: + return visitor.visitCardApplicationApproved(); + case PRODUCT_DELETED: + return visitor.visitProductDeleted(); + case PAYMENT_CREATED: + return visitor.visitPaymentCreated(); + case INVOICE_MARKED_UNCOLLECTIBLE: + return visitor.visitInvoiceMarkedUncollectible(); + case RESOLUTION_CENTER_CASE_DECIDED: + return visitor.visitResolutionCenterCaseDecided(); + case MEMBERSHIP_EXPERIENCE_CLAIMED: + return visitor.visitMembershipExperienceClaimed(); + case EXPORT_COMPLETED: + return visitor.visitExportCompleted(); + case PRODUCT_PUBLISHED: + return visitor.visitProductPublished(); + case CARD_APPLICATION_UPDATED: + return visitor.visitCardApplicationUpdated(); + case RESOLUTION_UPDATED: + return visitor.visitResolutionUpdated(); + case EXPORT_FAILED: + return visitor.visitExportFailed(); + case MEMBERSHIP_METADATA_UPDATED: + return visitor.visitMembershipMetadataUpdated(); + case CARD_TRANSACTION_UPDATED: + return visitor.visitCardTransactionUpdated(); + case CHAT_REACTION_CREATED: + return visitor.visitChatReactionCreated(); + case PAYMENT_SUCCEEDED: + return visitor.visitPaymentSucceeded(); + case SHIPMENT_UPDATED: + return visitor.visitShipmentUpdated(); + case DISPUTE_CREATED: + return visitor.visitDisputeCreated(); + case INVOICE_CREATED: + return visitor.visitInvoiceCreated(); + case INVOICE_PAST_DUE: + return visitor.visitInvoicePastDue(); + case MEMBERSHIP_WENT_VALID: + return visitor.visitMembershipWentValid(); + case IDENTITY_PROFILE_NEEDS_ACTION: + return visitor.visitIdentityProfileNeedsAction(); + case INVOICE_PAID: + return visitor.visitInvoicePaid(); + case PLAN_CREATED: + return visitor.visitPlanCreated(); + case SETUP_INTENT_REQUIRES_ACTION: + return visitor.visitSetupIntentRequiresAction(); + case INVOICE_VOIDED: + return visitor.visitInvoiceVoided(); + case CARD_TRANSACTION_DECLINED: + return visitor.visitCardTransactionDeclined(); + case IDENTITY_PROFILE_UPDATED: + return visitor.visitIdentityProfileUpdated(); + case APP_MEMBERSHIP_WENT_INVALID: + return visitor.visitAppMembershipWentInvalid(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WebhookListItemEventsItem valueOf(String value) { + switch (value) { + case "resolution_center_case.created": + return RESOLUTION_CENTER_CASE_CREATED; + case "payment.affiliate_reward_created": + return PAYMENT_AFFILIATE_REWARD_CREATED; + case "app_payment.created": + return APP_PAYMENT_CREATED; + case "ad_campaign.payment_failed": + return AD_CAMPAIGN_PAYMENT_FAILED; + case "identity_profile.rejected": + return IDENTITY_PROFILE_REJECTED; + case "plan.deleted": + return PLAN_DELETED; + case "resolution.created": + return RESOLUTION_CREATED; + case "payout_method.created": + return PAYOUT_METHOD_CREATED; + case "membership.went_invalid": + return MEMBERSHIP_WENT_INVALID; + case "transfer.completed": + return TRANSFER_COMPLETED; + case "card_application.denied": + return CARD_APPLICATION_DENIED; + case "transfer.created": + return TRANSFER_CREATED; + case "card_application.created": + return CARD_APPLICATION_CREATED; + case "membership.cancel_at_period_end_changed": + return MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED; + case "entry.denied": + return ENTRY_DENIED; + case "transfer.failed": + return TRANSFER_FAILED; + case "course_lesson_interaction.completed": + return COURSE_LESSON_INTERACTION_COMPLETED; + case "card.canceled": + return CARD_CANCELED; + case "deposit.succeeded": + return DEPOSIT_SUCCEEDED; + case "verification.succeeded": + return VERIFICATION_SUCCEEDED; + case "plan.updated": + return PLAN_UPDATED; + case "product.created": + return PRODUCT_CREATED; + case "member.created": + return MEMBER_CREATED; + case "setup_intent.succeeded": + return SETUP_INTENT_SUCCEEDED; + case "card_transaction.completed": + return CARD_TRANSACTION_COMPLETED; + case "membership.deactivated": + return MEMBERSHIP_DEACTIVATED; + case "card_transaction.reversed": + return CARD_TRANSACTION_REVERSED; + case "card.frozen": + return CARD_FROZEN; + case "withdrawal.updated": + return WITHDRAWAL_UPDATED; + case "setup_intent.canceled": + return SETUP_INTENT_CANCELED; + case "app_payment.failed": + return APP_PAYMENT_FAILED; + case "app_membership.cancel_at_period_end_changed": + return APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED; + case "app_payment.succeeded": + return APP_PAYMENT_SUCCEEDED; + case "card.created": + return CARD_CREATED; + case "resolution_center_case.updated": + return RESOLUTION_CENTER_CASE_UPDATED; + case "product.unpublished": + return PRODUCT_UNPUBLISHED; + case "payment.failed": + return PAYMENT_FAILED; + case "app_payment.pending": + return APP_PAYMENT_PENDING; + case "entry.deleted": + return ENTRY_DELETED; + case "swap.completed": + return SWAP_COMPLETED; + case "entry.approved": + return ENTRY_APPROVED; + case "dispute_alert.created": + return DISPUTE_ALERT_CREATED; + case "card_transaction.created": + return CARD_TRANSACTION_CREATED; + case "refund.updated": + return REFUND_UPDATED; + case "resolution.decided": + return RESOLUTION_DECIDED; + case "withdrawal.reversed": + return WITHDRAWAL_REVERSED; + case "payout_account.status_updated": + return PAYOUT_ACCOUNT_STATUS_UPDATED; + case "identity_profile.approved": + return IDENTITY_PROFILE_APPROVED; + case "shipment.created": + return SHIPMENT_CREATED; + case "dispute.updated": + return DISPUTE_UPDATED; + case "entry.created": + return ENTRY_CREATED; + case "app_membership.went_valid": + return APP_MEMBERSHIP_WENT_VALID; + case "product.updated": + return PRODUCT_UPDATED; + case "account.updated": + return ACCOUNT_UPDATED; + case "withdrawal.created": + return WITHDRAWAL_CREATED; + case "chat.message.created": + return CHAT_MESSAGE_CREATED; + case "ledger_account.funds_available": + return LEDGER_ACCOUNT_FUNDS_AVAILABLE; + case "membership.activated": + return MEMBERSHIP_ACTIVATED; + case "payment.pending": + return PAYMENT_PENDING; + case "membership.trial_ending_soon": + return MEMBERSHIP_TRIAL_ENDING_SOON; + case "refund.created": + return REFUND_CREATED; + case "card.updated": + return CARD_UPDATED; + case "card_application.approved": + return CARD_APPLICATION_APPROVED; + case "product.deleted": + return PRODUCT_DELETED; + case "payment.created": + return PAYMENT_CREATED; + case "invoice.marked_uncollectible": + return INVOICE_MARKED_UNCOLLECTIBLE; + case "resolution_center_case.decided": + return RESOLUTION_CENTER_CASE_DECIDED; + case "membership.experience_claimed": + return MEMBERSHIP_EXPERIENCE_CLAIMED; + case "export.completed": + return EXPORT_COMPLETED; + case "product.published": + return PRODUCT_PUBLISHED; + case "card_application.updated": + return CARD_APPLICATION_UPDATED; + case "resolution.updated": + return RESOLUTION_UPDATED; + case "export.failed": + return EXPORT_FAILED; + case "membership.metadata_updated": + return MEMBERSHIP_METADATA_UPDATED; + case "card_transaction.updated": + return CARD_TRANSACTION_UPDATED; + case "chat.reaction.created": + return CHAT_REACTION_CREATED; + case "payment.succeeded": + return PAYMENT_SUCCEEDED; + case "shipment.updated": + return SHIPMENT_UPDATED; + case "dispute.created": + return DISPUTE_CREATED; + case "invoice.created": + return INVOICE_CREATED; + case "invoice.past_due": + return INVOICE_PAST_DUE; + case "membership.went_valid": + return MEMBERSHIP_WENT_VALID; + case "identity_profile.needs_action": + return IDENTITY_PROFILE_NEEDS_ACTION; + case "invoice.paid": + return INVOICE_PAID; + case "plan.created": + return PLAN_CREATED; + case "setup_intent.requires_action": + return SETUP_INTENT_REQUIRES_ACTION; + case "invoice.voided": + return INVOICE_VOIDED; + case "card_transaction.declined": + return CARD_TRANSACTION_DECLINED; + case "identity_profile.updated": + return IDENTITY_PROFILE_UPDATED; + case "app_membership.went_invalid": + return APP_MEMBERSHIP_WENT_INVALID; + default: + return new WebhookListItemEventsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT_UPDATED, + + INVOICE_CREATED, + + INVOICE_MARKED_UNCOLLECTIBLE, + + INVOICE_PAID, + + INVOICE_PAST_DUE, + + INVOICE_VOIDED, + + MEMBERSHIP_ACTIVATED, + + MEMBERSHIP_DEACTIVATED, + + MEMBERSHIP_TRIAL_ENDING_SOON, + + ENTRY_CREATED, + + ENTRY_APPROVED, + + ENTRY_DENIED, + + ENTRY_DELETED, + + EXPORT_COMPLETED, + + EXPORT_FAILED, + + SETUP_INTENT_REQUIRES_ACTION, + + SETUP_INTENT_SUCCEEDED, + + SETUP_INTENT_CANCELED, + + LEDGER_ACCOUNT_FUNDS_AVAILABLE, + + SWAP_COMPLETED, + + DEPOSIT_SUCCEEDED, + + TRANSFER_CREATED, + + TRANSFER_COMPLETED, + + TRANSFER_FAILED, + + WITHDRAWAL_CREATED, + + WITHDRAWAL_UPDATED, + + WITHDRAWAL_REVERSED, + + CARD_TRANSACTION_CREATED, + + CARD_TRANSACTION_UPDATED, + + CARD_TRANSACTION_COMPLETED, + + CARD_TRANSACTION_DECLINED, + + CARD_TRANSACTION_REVERSED, + + CARD_CREATED, + + CARD_UPDATED, + + CARD_FROZEN, + + CARD_CANCELED, + + CARD_APPLICATION_CREATED, + + CARD_APPLICATION_UPDATED, + + CARD_APPLICATION_APPROVED, + + CARD_APPLICATION_DENIED, + + COURSE_LESSON_INTERACTION_COMPLETED, + + PAYOUT_METHOD_CREATED, + + VERIFICATION_SUCCEEDED, + + IDENTITY_PROFILE_APPROVED, + + IDENTITY_PROFILE_REJECTED, + + IDENTITY_PROFILE_NEEDS_ACTION, + + IDENTITY_PROFILE_UPDATED, + + PAYOUT_ACCOUNT_STATUS_UPDATED, + + RESOLUTION_CENTER_CASE_CREATED, + + RESOLUTION_CENTER_CASE_UPDATED, + + RESOLUTION_CENTER_CASE_DECIDED, + + PRODUCT_CREATED, + + PRODUCT_UPDATED, + + PRODUCT_DELETED, + + PRODUCT_PUBLISHED, + + PRODUCT_UNPUBLISHED, + + PLAN_CREATED, + + PLAN_UPDATED, + + PLAN_DELETED, + + SHIPMENT_CREATED, + + SHIPMENT_UPDATED, + + MEMBER_CREATED, + + AD_CAMPAIGN_PAYMENT_FAILED, + + CHAT_MESSAGE_CREATED, + + CHAT_REACTION_CREATED, + + PAYMENT_CREATED, + + PAYMENT_SUCCEEDED, + + PAYMENT_FAILED, + + PAYMENT_PENDING, + + DISPUTE_CREATED, + + DISPUTE_UPDATED, + + REFUND_CREATED, + + REFUND_UPDATED, + + DISPUTE_ALERT_CREATED, + + MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, + + MEMBERSHIP_WENT_VALID, + + MEMBERSHIP_WENT_INVALID, + + MEMBERSHIP_METADATA_UPDATED, + + RESOLUTION_CREATED, + + RESOLUTION_UPDATED, + + RESOLUTION_DECIDED, + + PAYMENT_AFFILIATE_REWARD_CREATED, + + MEMBERSHIP_EXPERIENCE_CLAIMED, + + APP_MEMBERSHIP_WENT_VALID, + + APP_MEMBERSHIP_WENT_INVALID, + + APP_PAYMENT_CREATED, + + APP_PAYMENT_SUCCEEDED, + + APP_PAYMENT_FAILED, + + APP_PAYMENT_PENDING, + + APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, + + UNKNOWN + } + + public interface Visitor { + T visitAccountUpdated(); + + T visitInvoiceCreated(); + + T visitInvoiceMarkedUncollectible(); + + T visitInvoicePaid(); + + T visitInvoicePastDue(); + + T visitInvoiceVoided(); + + T visitMembershipActivated(); + + T visitMembershipDeactivated(); + + T visitMembershipTrialEndingSoon(); + + T visitEntryCreated(); + + T visitEntryApproved(); + + T visitEntryDenied(); + + T visitEntryDeleted(); + + T visitExportCompleted(); + + T visitExportFailed(); + + T visitSetupIntentRequiresAction(); + + T visitSetupIntentSucceeded(); + + T visitSetupIntentCanceled(); + + T visitLedgerAccountFundsAvailable(); + + T visitSwapCompleted(); + + T visitDepositSucceeded(); + + T visitTransferCreated(); + + T visitTransferCompleted(); + + T visitTransferFailed(); + + T visitWithdrawalCreated(); + + T visitWithdrawalUpdated(); + + T visitWithdrawalReversed(); + + T visitCardTransactionCreated(); + + T visitCardTransactionUpdated(); + + T visitCardTransactionCompleted(); + + T visitCardTransactionDeclined(); + + T visitCardTransactionReversed(); + + T visitCardCreated(); + + T visitCardUpdated(); + + T visitCardFrozen(); + + T visitCardCanceled(); + + T visitCardApplicationCreated(); + + T visitCardApplicationUpdated(); + + T visitCardApplicationApproved(); + + T visitCardApplicationDenied(); + + T visitCourseLessonInteractionCompleted(); + + T visitPayoutMethodCreated(); + + T visitVerificationSucceeded(); + + T visitIdentityProfileApproved(); + + T visitIdentityProfileRejected(); + + T visitIdentityProfileNeedsAction(); + + T visitIdentityProfileUpdated(); + + T visitPayoutAccountStatusUpdated(); + + T visitResolutionCenterCaseCreated(); + + T visitResolutionCenterCaseUpdated(); + + T visitResolutionCenterCaseDecided(); + + T visitProductCreated(); + + T visitProductUpdated(); + + T visitProductDeleted(); + + T visitProductPublished(); + + T visitProductUnpublished(); + + T visitPlanCreated(); + + T visitPlanUpdated(); + + T visitPlanDeleted(); + + T visitShipmentCreated(); + + T visitShipmentUpdated(); + + T visitMemberCreated(); + + T visitAdCampaignPaymentFailed(); + + T visitChatMessageCreated(); + + T visitChatReactionCreated(); + + T visitPaymentCreated(); + + T visitPaymentSucceeded(); + + T visitPaymentFailed(); + + T visitPaymentPending(); + + T visitDisputeCreated(); + + T visitDisputeUpdated(); + + T visitRefundCreated(); + + T visitRefundUpdated(); + + T visitDisputeAlertCreated(); + + T visitMembershipCancelAtPeriodEndChanged(); + + T visitMembershipWentValid(); + + T visitMembershipWentInvalid(); + + T visitMembershipMetadataUpdated(); + + T visitResolutionCreated(); + + T visitResolutionUpdated(); + + T visitResolutionDecided(); + + T visitPaymentAffiliateRewardCreated(); + + T visitMembershipExperienceClaimed(); + + T visitAppMembershipWentValid(); + + T visitAppMembershipWentInvalid(); + + T visitAppPaymentCreated(); + + T visitAppPaymentSucceeded(); + + T visitAppPaymentFailed(); + + T visitAppPaymentPending(); + + T visitAppMembershipCancelAtPeriodEndChanged(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/WebhookTestableEventsItem.java b/src/main/java/com/whop/api/types/WebhookTestableEventsItem.java new file mode 100644 index 00000000..999264c7 --- /dev/null +++ b/src/main/java/com/whop/api/types/WebhookTestableEventsItem.java @@ -0,0 +1,1056 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WebhookTestableEventsItem { + public static final WebhookTestableEventsItem RESOLUTION_CENTER_CASE_CREATED = + new WebhookTestableEventsItem(Value.RESOLUTION_CENTER_CASE_CREATED, "resolution_center_case.created"); + + public static final WebhookTestableEventsItem PAYMENT_AFFILIATE_REWARD_CREATED = + new WebhookTestableEventsItem(Value.PAYMENT_AFFILIATE_REWARD_CREATED, "payment.affiliate_reward_created"); + + public static final WebhookTestableEventsItem APP_PAYMENT_CREATED = + new WebhookTestableEventsItem(Value.APP_PAYMENT_CREATED, "app_payment.created"); + + public static final WebhookTestableEventsItem AD_CAMPAIGN_PAYMENT_FAILED = + new WebhookTestableEventsItem(Value.AD_CAMPAIGN_PAYMENT_FAILED, "ad_campaign.payment_failed"); + + public static final WebhookTestableEventsItem IDENTITY_PROFILE_REJECTED = + new WebhookTestableEventsItem(Value.IDENTITY_PROFILE_REJECTED, "identity_profile.rejected"); + + public static final WebhookTestableEventsItem PLAN_DELETED = + new WebhookTestableEventsItem(Value.PLAN_DELETED, "plan.deleted"); + + public static final WebhookTestableEventsItem RESOLUTION_CREATED = + new WebhookTestableEventsItem(Value.RESOLUTION_CREATED, "resolution.created"); + + public static final WebhookTestableEventsItem PAYOUT_METHOD_CREATED = + new WebhookTestableEventsItem(Value.PAYOUT_METHOD_CREATED, "payout_method.created"); + + public static final WebhookTestableEventsItem MEMBERSHIP_WENT_INVALID = + new WebhookTestableEventsItem(Value.MEMBERSHIP_WENT_INVALID, "membership.went_invalid"); + + public static final WebhookTestableEventsItem TRANSFER_COMPLETED = + new WebhookTestableEventsItem(Value.TRANSFER_COMPLETED, "transfer.completed"); + + public static final WebhookTestableEventsItem CARD_APPLICATION_DENIED = + new WebhookTestableEventsItem(Value.CARD_APPLICATION_DENIED, "card_application.denied"); + + public static final WebhookTestableEventsItem TRANSFER_CREATED = + new WebhookTestableEventsItem(Value.TRANSFER_CREATED, "transfer.created"); + + public static final WebhookTestableEventsItem CARD_APPLICATION_CREATED = + new WebhookTestableEventsItem(Value.CARD_APPLICATION_CREATED, "card_application.created"); + + public static final WebhookTestableEventsItem MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED = + new WebhookTestableEventsItem( + Value.MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, "membership.cancel_at_period_end_changed"); + + public static final WebhookTestableEventsItem ENTRY_DENIED = + new WebhookTestableEventsItem(Value.ENTRY_DENIED, "entry.denied"); + + public static final WebhookTestableEventsItem TRANSFER_FAILED = + new WebhookTestableEventsItem(Value.TRANSFER_FAILED, "transfer.failed"); + + public static final WebhookTestableEventsItem COURSE_LESSON_INTERACTION_COMPLETED = new WebhookTestableEventsItem( + Value.COURSE_LESSON_INTERACTION_COMPLETED, "course_lesson_interaction.completed"); + + public static final WebhookTestableEventsItem CARD_CANCELED = + new WebhookTestableEventsItem(Value.CARD_CANCELED, "card.canceled"); + + public static final WebhookTestableEventsItem DEPOSIT_SUCCEEDED = + new WebhookTestableEventsItem(Value.DEPOSIT_SUCCEEDED, "deposit.succeeded"); + + public static final WebhookTestableEventsItem VERIFICATION_SUCCEEDED = + new WebhookTestableEventsItem(Value.VERIFICATION_SUCCEEDED, "verification.succeeded"); + + public static final WebhookTestableEventsItem PLAN_UPDATED = + new WebhookTestableEventsItem(Value.PLAN_UPDATED, "plan.updated"); + + public static final WebhookTestableEventsItem PRODUCT_CREATED = + new WebhookTestableEventsItem(Value.PRODUCT_CREATED, "product.created"); + + public static final WebhookTestableEventsItem MEMBER_CREATED = + new WebhookTestableEventsItem(Value.MEMBER_CREATED, "member.created"); + + public static final WebhookTestableEventsItem SETUP_INTENT_SUCCEEDED = + new WebhookTestableEventsItem(Value.SETUP_INTENT_SUCCEEDED, "setup_intent.succeeded"); + + public static final WebhookTestableEventsItem CARD_TRANSACTION_COMPLETED = + new WebhookTestableEventsItem(Value.CARD_TRANSACTION_COMPLETED, "card_transaction.completed"); + + public static final WebhookTestableEventsItem MEMBERSHIP_DEACTIVATED = + new WebhookTestableEventsItem(Value.MEMBERSHIP_DEACTIVATED, "membership.deactivated"); + + public static final WebhookTestableEventsItem CARD_TRANSACTION_REVERSED = + new WebhookTestableEventsItem(Value.CARD_TRANSACTION_REVERSED, "card_transaction.reversed"); + + public static final WebhookTestableEventsItem CARD_FROZEN = + new WebhookTestableEventsItem(Value.CARD_FROZEN, "card.frozen"); + + public static final WebhookTestableEventsItem WITHDRAWAL_UPDATED = + new WebhookTestableEventsItem(Value.WITHDRAWAL_UPDATED, "withdrawal.updated"); + + public static final WebhookTestableEventsItem SETUP_INTENT_CANCELED = + new WebhookTestableEventsItem(Value.SETUP_INTENT_CANCELED, "setup_intent.canceled"); + + public static final WebhookTestableEventsItem APP_PAYMENT_FAILED = + new WebhookTestableEventsItem(Value.APP_PAYMENT_FAILED, "app_payment.failed"); + + public static final WebhookTestableEventsItem APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED = + new WebhookTestableEventsItem( + Value.APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, "app_membership.cancel_at_period_end_changed"); + + public static final WebhookTestableEventsItem APP_PAYMENT_SUCCEEDED = + new WebhookTestableEventsItem(Value.APP_PAYMENT_SUCCEEDED, "app_payment.succeeded"); + + public static final WebhookTestableEventsItem CARD_CREATED = + new WebhookTestableEventsItem(Value.CARD_CREATED, "card.created"); + + public static final WebhookTestableEventsItem RESOLUTION_CENTER_CASE_UPDATED = + new WebhookTestableEventsItem(Value.RESOLUTION_CENTER_CASE_UPDATED, "resolution_center_case.updated"); + + public static final WebhookTestableEventsItem PRODUCT_UNPUBLISHED = + new WebhookTestableEventsItem(Value.PRODUCT_UNPUBLISHED, "product.unpublished"); + + public static final WebhookTestableEventsItem PAYMENT_FAILED = + new WebhookTestableEventsItem(Value.PAYMENT_FAILED, "payment.failed"); + + public static final WebhookTestableEventsItem APP_PAYMENT_PENDING = + new WebhookTestableEventsItem(Value.APP_PAYMENT_PENDING, "app_payment.pending"); + + public static final WebhookTestableEventsItem ENTRY_DELETED = + new WebhookTestableEventsItem(Value.ENTRY_DELETED, "entry.deleted"); + + public static final WebhookTestableEventsItem SWAP_COMPLETED = + new WebhookTestableEventsItem(Value.SWAP_COMPLETED, "swap.completed"); + + public static final WebhookTestableEventsItem ENTRY_APPROVED = + new WebhookTestableEventsItem(Value.ENTRY_APPROVED, "entry.approved"); + + public static final WebhookTestableEventsItem DISPUTE_ALERT_CREATED = + new WebhookTestableEventsItem(Value.DISPUTE_ALERT_CREATED, "dispute_alert.created"); + + public static final WebhookTestableEventsItem CARD_TRANSACTION_CREATED = + new WebhookTestableEventsItem(Value.CARD_TRANSACTION_CREATED, "card_transaction.created"); + + public static final WebhookTestableEventsItem REFUND_UPDATED = + new WebhookTestableEventsItem(Value.REFUND_UPDATED, "refund.updated"); + + public static final WebhookTestableEventsItem RESOLUTION_DECIDED = + new WebhookTestableEventsItem(Value.RESOLUTION_DECIDED, "resolution.decided"); + + public static final WebhookTestableEventsItem WITHDRAWAL_REVERSED = + new WebhookTestableEventsItem(Value.WITHDRAWAL_REVERSED, "withdrawal.reversed"); + + public static final WebhookTestableEventsItem PAYOUT_ACCOUNT_STATUS_UPDATED = + new WebhookTestableEventsItem(Value.PAYOUT_ACCOUNT_STATUS_UPDATED, "payout_account.status_updated"); + + public static final WebhookTestableEventsItem IDENTITY_PROFILE_APPROVED = + new WebhookTestableEventsItem(Value.IDENTITY_PROFILE_APPROVED, "identity_profile.approved"); + + public static final WebhookTestableEventsItem SHIPMENT_CREATED = + new WebhookTestableEventsItem(Value.SHIPMENT_CREATED, "shipment.created"); + + public static final WebhookTestableEventsItem DISPUTE_UPDATED = + new WebhookTestableEventsItem(Value.DISPUTE_UPDATED, "dispute.updated"); + + public static final WebhookTestableEventsItem ENTRY_CREATED = + new WebhookTestableEventsItem(Value.ENTRY_CREATED, "entry.created"); + + public static final WebhookTestableEventsItem APP_MEMBERSHIP_WENT_VALID = + new WebhookTestableEventsItem(Value.APP_MEMBERSHIP_WENT_VALID, "app_membership.went_valid"); + + public static final WebhookTestableEventsItem PRODUCT_UPDATED = + new WebhookTestableEventsItem(Value.PRODUCT_UPDATED, "product.updated"); + + public static final WebhookTestableEventsItem ACCOUNT_UPDATED = + new WebhookTestableEventsItem(Value.ACCOUNT_UPDATED, "account.updated"); + + public static final WebhookTestableEventsItem WITHDRAWAL_CREATED = + new WebhookTestableEventsItem(Value.WITHDRAWAL_CREATED, "withdrawal.created"); + + public static final WebhookTestableEventsItem CHAT_MESSAGE_CREATED = + new WebhookTestableEventsItem(Value.CHAT_MESSAGE_CREATED, "chat.message.created"); + + public static final WebhookTestableEventsItem LEDGER_ACCOUNT_FUNDS_AVAILABLE = + new WebhookTestableEventsItem(Value.LEDGER_ACCOUNT_FUNDS_AVAILABLE, "ledger_account.funds_available"); + + public static final WebhookTestableEventsItem MEMBERSHIP_ACTIVATED = + new WebhookTestableEventsItem(Value.MEMBERSHIP_ACTIVATED, "membership.activated"); + + public static final WebhookTestableEventsItem PAYMENT_PENDING = + new WebhookTestableEventsItem(Value.PAYMENT_PENDING, "payment.pending"); + + public static final WebhookTestableEventsItem MEMBERSHIP_TRIAL_ENDING_SOON = + new WebhookTestableEventsItem(Value.MEMBERSHIP_TRIAL_ENDING_SOON, "membership.trial_ending_soon"); + + public static final WebhookTestableEventsItem REFUND_CREATED = + new WebhookTestableEventsItem(Value.REFUND_CREATED, "refund.created"); + + public static final WebhookTestableEventsItem CARD_UPDATED = + new WebhookTestableEventsItem(Value.CARD_UPDATED, "card.updated"); + + public static final WebhookTestableEventsItem CARD_APPLICATION_APPROVED = + new WebhookTestableEventsItem(Value.CARD_APPLICATION_APPROVED, "card_application.approved"); + + public static final WebhookTestableEventsItem PRODUCT_DELETED = + new WebhookTestableEventsItem(Value.PRODUCT_DELETED, "product.deleted"); + + public static final WebhookTestableEventsItem PAYMENT_CREATED = + new WebhookTestableEventsItem(Value.PAYMENT_CREATED, "payment.created"); + + public static final WebhookTestableEventsItem INVOICE_MARKED_UNCOLLECTIBLE = + new WebhookTestableEventsItem(Value.INVOICE_MARKED_UNCOLLECTIBLE, "invoice.marked_uncollectible"); + + public static final WebhookTestableEventsItem RESOLUTION_CENTER_CASE_DECIDED = + new WebhookTestableEventsItem(Value.RESOLUTION_CENTER_CASE_DECIDED, "resolution_center_case.decided"); + + public static final WebhookTestableEventsItem MEMBERSHIP_EXPERIENCE_CLAIMED = + new WebhookTestableEventsItem(Value.MEMBERSHIP_EXPERIENCE_CLAIMED, "membership.experience_claimed"); + + public static final WebhookTestableEventsItem EXPORT_COMPLETED = + new WebhookTestableEventsItem(Value.EXPORT_COMPLETED, "export.completed"); + + public static final WebhookTestableEventsItem PRODUCT_PUBLISHED = + new WebhookTestableEventsItem(Value.PRODUCT_PUBLISHED, "product.published"); + + public static final WebhookTestableEventsItem CARD_APPLICATION_UPDATED = + new WebhookTestableEventsItem(Value.CARD_APPLICATION_UPDATED, "card_application.updated"); + + public static final WebhookTestableEventsItem RESOLUTION_UPDATED = + new WebhookTestableEventsItem(Value.RESOLUTION_UPDATED, "resolution.updated"); + + public static final WebhookTestableEventsItem EXPORT_FAILED = + new WebhookTestableEventsItem(Value.EXPORT_FAILED, "export.failed"); + + public static final WebhookTestableEventsItem MEMBERSHIP_METADATA_UPDATED = + new WebhookTestableEventsItem(Value.MEMBERSHIP_METADATA_UPDATED, "membership.metadata_updated"); + + public static final WebhookTestableEventsItem CARD_TRANSACTION_UPDATED = + new WebhookTestableEventsItem(Value.CARD_TRANSACTION_UPDATED, "card_transaction.updated"); + + public static final WebhookTestableEventsItem CHAT_REACTION_CREATED = + new WebhookTestableEventsItem(Value.CHAT_REACTION_CREATED, "chat.reaction.created"); + + public static final WebhookTestableEventsItem PAYMENT_SUCCEEDED = + new WebhookTestableEventsItem(Value.PAYMENT_SUCCEEDED, "payment.succeeded"); + + public static final WebhookTestableEventsItem SHIPMENT_UPDATED = + new WebhookTestableEventsItem(Value.SHIPMENT_UPDATED, "shipment.updated"); + + public static final WebhookTestableEventsItem DISPUTE_CREATED = + new WebhookTestableEventsItem(Value.DISPUTE_CREATED, "dispute.created"); + + public static final WebhookTestableEventsItem INVOICE_CREATED = + new WebhookTestableEventsItem(Value.INVOICE_CREATED, "invoice.created"); + + public static final WebhookTestableEventsItem INVOICE_PAST_DUE = + new WebhookTestableEventsItem(Value.INVOICE_PAST_DUE, "invoice.past_due"); + + public static final WebhookTestableEventsItem MEMBERSHIP_WENT_VALID = + new WebhookTestableEventsItem(Value.MEMBERSHIP_WENT_VALID, "membership.went_valid"); + + public static final WebhookTestableEventsItem IDENTITY_PROFILE_NEEDS_ACTION = + new WebhookTestableEventsItem(Value.IDENTITY_PROFILE_NEEDS_ACTION, "identity_profile.needs_action"); + + public static final WebhookTestableEventsItem INVOICE_PAID = + new WebhookTestableEventsItem(Value.INVOICE_PAID, "invoice.paid"); + + public static final WebhookTestableEventsItem PLAN_CREATED = + new WebhookTestableEventsItem(Value.PLAN_CREATED, "plan.created"); + + public static final WebhookTestableEventsItem SETUP_INTENT_REQUIRES_ACTION = + new WebhookTestableEventsItem(Value.SETUP_INTENT_REQUIRES_ACTION, "setup_intent.requires_action"); + + public static final WebhookTestableEventsItem INVOICE_VOIDED = + new WebhookTestableEventsItem(Value.INVOICE_VOIDED, "invoice.voided"); + + public static final WebhookTestableEventsItem CARD_TRANSACTION_DECLINED = + new WebhookTestableEventsItem(Value.CARD_TRANSACTION_DECLINED, "card_transaction.declined"); + + public static final WebhookTestableEventsItem IDENTITY_PROFILE_UPDATED = + new WebhookTestableEventsItem(Value.IDENTITY_PROFILE_UPDATED, "identity_profile.updated"); + + public static final WebhookTestableEventsItem APP_MEMBERSHIP_WENT_INVALID = + new WebhookTestableEventsItem(Value.APP_MEMBERSHIP_WENT_INVALID, "app_membership.went_invalid"); + + private final Value value; + + private final String string; + + WebhookTestableEventsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof WebhookTestableEventsItem + && this.string.equals(((WebhookTestableEventsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case RESOLUTION_CENTER_CASE_CREATED: + return visitor.visitResolutionCenterCaseCreated(); + case PAYMENT_AFFILIATE_REWARD_CREATED: + return visitor.visitPaymentAffiliateRewardCreated(); + case APP_PAYMENT_CREATED: + return visitor.visitAppPaymentCreated(); + case AD_CAMPAIGN_PAYMENT_FAILED: + return visitor.visitAdCampaignPaymentFailed(); + case IDENTITY_PROFILE_REJECTED: + return visitor.visitIdentityProfileRejected(); + case PLAN_DELETED: + return visitor.visitPlanDeleted(); + case RESOLUTION_CREATED: + return visitor.visitResolutionCreated(); + case PAYOUT_METHOD_CREATED: + return visitor.visitPayoutMethodCreated(); + case MEMBERSHIP_WENT_INVALID: + return visitor.visitMembershipWentInvalid(); + case TRANSFER_COMPLETED: + return visitor.visitTransferCompleted(); + case CARD_APPLICATION_DENIED: + return visitor.visitCardApplicationDenied(); + case TRANSFER_CREATED: + return visitor.visitTransferCreated(); + case CARD_APPLICATION_CREATED: + return visitor.visitCardApplicationCreated(); + case MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED: + return visitor.visitMembershipCancelAtPeriodEndChanged(); + case ENTRY_DENIED: + return visitor.visitEntryDenied(); + case TRANSFER_FAILED: + return visitor.visitTransferFailed(); + case COURSE_LESSON_INTERACTION_COMPLETED: + return visitor.visitCourseLessonInteractionCompleted(); + case CARD_CANCELED: + return visitor.visitCardCanceled(); + case DEPOSIT_SUCCEEDED: + return visitor.visitDepositSucceeded(); + case VERIFICATION_SUCCEEDED: + return visitor.visitVerificationSucceeded(); + case PLAN_UPDATED: + return visitor.visitPlanUpdated(); + case PRODUCT_CREATED: + return visitor.visitProductCreated(); + case MEMBER_CREATED: + return visitor.visitMemberCreated(); + case SETUP_INTENT_SUCCEEDED: + return visitor.visitSetupIntentSucceeded(); + case CARD_TRANSACTION_COMPLETED: + return visitor.visitCardTransactionCompleted(); + case MEMBERSHIP_DEACTIVATED: + return visitor.visitMembershipDeactivated(); + case CARD_TRANSACTION_REVERSED: + return visitor.visitCardTransactionReversed(); + case CARD_FROZEN: + return visitor.visitCardFrozen(); + case WITHDRAWAL_UPDATED: + return visitor.visitWithdrawalUpdated(); + case SETUP_INTENT_CANCELED: + return visitor.visitSetupIntentCanceled(); + case APP_PAYMENT_FAILED: + return visitor.visitAppPaymentFailed(); + case APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED: + return visitor.visitAppMembershipCancelAtPeriodEndChanged(); + case APP_PAYMENT_SUCCEEDED: + return visitor.visitAppPaymentSucceeded(); + case CARD_CREATED: + return visitor.visitCardCreated(); + case RESOLUTION_CENTER_CASE_UPDATED: + return visitor.visitResolutionCenterCaseUpdated(); + case PRODUCT_UNPUBLISHED: + return visitor.visitProductUnpublished(); + case PAYMENT_FAILED: + return visitor.visitPaymentFailed(); + case APP_PAYMENT_PENDING: + return visitor.visitAppPaymentPending(); + case ENTRY_DELETED: + return visitor.visitEntryDeleted(); + case SWAP_COMPLETED: + return visitor.visitSwapCompleted(); + case ENTRY_APPROVED: + return visitor.visitEntryApproved(); + case DISPUTE_ALERT_CREATED: + return visitor.visitDisputeAlertCreated(); + case CARD_TRANSACTION_CREATED: + return visitor.visitCardTransactionCreated(); + case REFUND_UPDATED: + return visitor.visitRefundUpdated(); + case RESOLUTION_DECIDED: + return visitor.visitResolutionDecided(); + case WITHDRAWAL_REVERSED: + return visitor.visitWithdrawalReversed(); + case PAYOUT_ACCOUNT_STATUS_UPDATED: + return visitor.visitPayoutAccountStatusUpdated(); + case IDENTITY_PROFILE_APPROVED: + return visitor.visitIdentityProfileApproved(); + case SHIPMENT_CREATED: + return visitor.visitShipmentCreated(); + case DISPUTE_UPDATED: + return visitor.visitDisputeUpdated(); + case ENTRY_CREATED: + return visitor.visitEntryCreated(); + case APP_MEMBERSHIP_WENT_VALID: + return visitor.visitAppMembershipWentValid(); + case PRODUCT_UPDATED: + return visitor.visitProductUpdated(); + case ACCOUNT_UPDATED: + return visitor.visitAccountUpdated(); + case WITHDRAWAL_CREATED: + return visitor.visitWithdrawalCreated(); + case CHAT_MESSAGE_CREATED: + return visitor.visitChatMessageCreated(); + case LEDGER_ACCOUNT_FUNDS_AVAILABLE: + return visitor.visitLedgerAccountFundsAvailable(); + case MEMBERSHIP_ACTIVATED: + return visitor.visitMembershipActivated(); + case PAYMENT_PENDING: + return visitor.visitPaymentPending(); + case MEMBERSHIP_TRIAL_ENDING_SOON: + return visitor.visitMembershipTrialEndingSoon(); + case REFUND_CREATED: + return visitor.visitRefundCreated(); + case CARD_UPDATED: + return visitor.visitCardUpdated(); + case CARD_APPLICATION_APPROVED: + return visitor.visitCardApplicationApproved(); + case PRODUCT_DELETED: + return visitor.visitProductDeleted(); + case PAYMENT_CREATED: + return visitor.visitPaymentCreated(); + case INVOICE_MARKED_UNCOLLECTIBLE: + return visitor.visitInvoiceMarkedUncollectible(); + case RESOLUTION_CENTER_CASE_DECIDED: + return visitor.visitResolutionCenterCaseDecided(); + case MEMBERSHIP_EXPERIENCE_CLAIMED: + return visitor.visitMembershipExperienceClaimed(); + case EXPORT_COMPLETED: + return visitor.visitExportCompleted(); + case PRODUCT_PUBLISHED: + return visitor.visitProductPublished(); + case CARD_APPLICATION_UPDATED: + return visitor.visitCardApplicationUpdated(); + case RESOLUTION_UPDATED: + return visitor.visitResolutionUpdated(); + case EXPORT_FAILED: + return visitor.visitExportFailed(); + case MEMBERSHIP_METADATA_UPDATED: + return visitor.visitMembershipMetadataUpdated(); + case CARD_TRANSACTION_UPDATED: + return visitor.visitCardTransactionUpdated(); + case CHAT_REACTION_CREATED: + return visitor.visitChatReactionCreated(); + case PAYMENT_SUCCEEDED: + return visitor.visitPaymentSucceeded(); + case SHIPMENT_UPDATED: + return visitor.visitShipmentUpdated(); + case DISPUTE_CREATED: + return visitor.visitDisputeCreated(); + case INVOICE_CREATED: + return visitor.visitInvoiceCreated(); + case INVOICE_PAST_DUE: + return visitor.visitInvoicePastDue(); + case MEMBERSHIP_WENT_VALID: + return visitor.visitMembershipWentValid(); + case IDENTITY_PROFILE_NEEDS_ACTION: + return visitor.visitIdentityProfileNeedsAction(); + case INVOICE_PAID: + return visitor.visitInvoicePaid(); + case PLAN_CREATED: + return visitor.visitPlanCreated(); + case SETUP_INTENT_REQUIRES_ACTION: + return visitor.visitSetupIntentRequiresAction(); + case INVOICE_VOIDED: + return visitor.visitInvoiceVoided(); + case CARD_TRANSACTION_DECLINED: + return visitor.visitCardTransactionDeclined(); + case IDENTITY_PROFILE_UPDATED: + return visitor.visitIdentityProfileUpdated(); + case APP_MEMBERSHIP_WENT_INVALID: + return visitor.visitAppMembershipWentInvalid(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WebhookTestableEventsItem valueOf(String value) { + switch (value) { + case "resolution_center_case.created": + return RESOLUTION_CENTER_CASE_CREATED; + case "payment.affiliate_reward_created": + return PAYMENT_AFFILIATE_REWARD_CREATED; + case "app_payment.created": + return APP_PAYMENT_CREATED; + case "ad_campaign.payment_failed": + return AD_CAMPAIGN_PAYMENT_FAILED; + case "identity_profile.rejected": + return IDENTITY_PROFILE_REJECTED; + case "plan.deleted": + return PLAN_DELETED; + case "resolution.created": + return RESOLUTION_CREATED; + case "payout_method.created": + return PAYOUT_METHOD_CREATED; + case "membership.went_invalid": + return MEMBERSHIP_WENT_INVALID; + case "transfer.completed": + return TRANSFER_COMPLETED; + case "card_application.denied": + return CARD_APPLICATION_DENIED; + case "transfer.created": + return TRANSFER_CREATED; + case "card_application.created": + return CARD_APPLICATION_CREATED; + case "membership.cancel_at_period_end_changed": + return MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED; + case "entry.denied": + return ENTRY_DENIED; + case "transfer.failed": + return TRANSFER_FAILED; + case "course_lesson_interaction.completed": + return COURSE_LESSON_INTERACTION_COMPLETED; + case "card.canceled": + return CARD_CANCELED; + case "deposit.succeeded": + return DEPOSIT_SUCCEEDED; + case "verification.succeeded": + return VERIFICATION_SUCCEEDED; + case "plan.updated": + return PLAN_UPDATED; + case "product.created": + return PRODUCT_CREATED; + case "member.created": + return MEMBER_CREATED; + case "setup_intent.succeeded": + return SETUP_INTENT_SUCCEEDED; + case "card_transaction.completed": + return CARD_TRANSACTION_COMPLETED; + case "membership.deactivated": + return MEMBERSHIP_DEACTIVATED; + case "card_transaction.reversed": + return CARD_TRANSACTION_REVERSED; + case "card.frozen": + return CARD_FROZEN; + case "withdrawal.updated": + return WITHDRAWAL_UPDATED; + case "setup_intent.canceled": + return SETUP_INTENT_CANCELED; + case "app_payment.failed": + return APP_PAYMENT_FAILED; + case "app_membership.cancel_at_period_end_changed": + return APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED; + case "app_payment.succeeded": + return APP_PAYMENT_SUCCEEDED; + case "card.created": + return CARD_CREATED; + case "resolution_center_case.updated": + return RESOLUTION_CENTER_CASE_UPDATED; + case "product.unpublished": + return PRODUCT_UNPUBLISHED; + case "payment.failed": + return PAYMENT_FAILED; + case "app_payment.pending": + return APP_PAYMENT_PENDING; + case "entry.deleted": + return ENTRY_DELETED; + case "swap.completed": + return SWAP_COMPLETED; + case "entry.approved": + return ENTRY_APPROVED; + case "dispute_alert.created": + return DISPUTE_ALERT_CREATED; + case "card_transaction.created": + return CARD_TRANSACTION_CREATED; + case "refund.updated": + return REFUND_UPDATED; + case "resolution.decided": + return RESOLUTION_DECIDED; + case "withdrawal.reversed": + return WITHDRAWAL_REVERSED; + case "payout_account.status_updated": + return PAYOUT_ACCOUNT_STATUS_UPDATED; + case "identity_profile.approved": + return IDENTITY_PROFILE_APPROVED; + case "shipment.created": + return SHIPMENT_CREATED; + case "dispute.updated": + return DISPUTE_UPDATED; + case "entry.created": + return ENTRY_CREATED; + case "app_membership.went_valid": + return APP_MEMBERSHIP_WENT_VALID; + case "product.updated": + return PRODUCT_UPDATED; + case "account.updated": + return ACCOUNT_UPDATED; + case "withdrawal.created": + return WITHDRAWAL_CREATED; + case "chat.message.created": + return CHAT_MESSAGE_CREATED; + case "ledger_account.funds_available": + return LEDGER_ACCOUNT_FUNDS_AVAILABLE; + case "membership.activated": + return MEMBERSHIP_ACTIVATED; + case "payment.pending": + return PAYMENT_PENDING; + case "membership.trial_ending_soon": + return MEMBERSHIP_TRIAL_ENDING_SOON; + case "refund.created": + return REFUND_CREATED; + case "card.updated": + return CARD_UPDATED; + case "card_application.approved": + return CARD_APPLICATION_APPROVED; + case "product.deleted": + return PRODUCT_DELETED; + case "payment.created": + return PAYMENT_CREATED; + case "invoice.marked_uncollectible": + return INVOICE_MARKED_UNCOLLECTIBLE; + case "resolution_center_case.decided": + return RESOLUTION_CENTER_CASE_DECIDED; + case "membership.experience_claimed": + return MEMBERSHIP_EXPERIENCE_CLAIMED; + case "export.completed": + return EXPORT_COMPLETED; + case "product.published": + return PRODUCT_PUBLISHED; + case "card_application.updated": + return CARD_APPLICATION_UPDATED; + case "resolution.updated": + return RESOLUTION_UPDATED; + case "export.failed": + return EXPORT_FAILED; + case "membership.metadata_updated": + return MEMBERSHIP_METADATA_UPDATED; + case "card_transaction.updated": + return CARD_TRANSACTION_UPDATED; + case "chat.reaction.created": + return CHAT_REACTION_CREATED; + case "payment.succeeded": + return PAYMENT_SUCCEEDED; + case "shipment.updated": + return SHIPMENT_UPDATED; + case "dispute.created": + return DISPUTE_CREATED; + case "invoice.created": + return INVOICE_CREATED; + case "invoice.past_due": + return INVOICE_PAST_DUE; + case "membership.went_valid": + return MEMBERSHIP_WENT_VALID; + case "identity_profile.needs_action": + return IDENTITY_PROFILE_NEEDS_ACTION; + case "invoice.paid": + return INVOICE_PAID; + case "plan.created": + return PLAN_CREATED; + case "setup_intent.requires_action": + return SETUP_INTENT_REQUIRES_ACTION; + case "invoice.voided": + return INVOICE_VOIDED; + case "card_transaction.declined": + return CARD_TRANSACTION_DECLINED; + case "identity_profile.updated": + return IDENTITY_PROFILE_UPDATED; + case "app_membership.went_invalid": + return APP_MEMBERSHIP_WENT_INVALID; + default: + return new WebhookTestableEventsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCOUNT_UPDATED, + + INVOICE_CREATED, + + INVOICE_MARKED_UNCOLLECTIBLE, + + INVOICE_PAID, + + INVOICE_PAST_DUE, + + INVOICE_VOIDED, + + MEMBERSHIP_ACTIVATED, + + MEMBERSHIP_DEACTIVATED, + + MEMBERSHIP_TRIAL_ENDING_SOON, + + ENTRY_CREATED, + + ENTRY_APPROVED, + + ENTRY_DENIED, + + ENTRY_DELETED, + + EXPORT_COMPLETED, + + EXPORT_FAILED, + + SETUP_INTENT_REQUIRES_ACTION, + + SETUP_INTENT_SUCCEEDED, + + SETUP_INTENT_CANCELED, + + LEDGER_ACCOUNT_FUNDS_AVAILABLE, + + SWAP_COMPLETED, + + DEPOSIT_SUCCEEDED, + + TRANSFER_CREATED, + + TRANSFER_COMPLETED, + + TRANSFER_FAILED, + + WITHDRAWAL_CREATED, + + WITHDRAWAL_UPDATED, + + WITHDRAWAL_REVERSED, + + CARD_TRANSACTION_CREATED, + + CARD_TRANSACTION_UPDATED, + + CARD_TRANSACTION_COMPLETED, + + CARD_TRANSACTION_DECLINED, + + CARD_TRANSACTION_REVERSED, + + CARD_CREATED, + + CARD_UPDATED, + + CARD_FROZEN, + + CARD_CANCELED, + + CARD_APPLICATION_CREATED, + + CARD_APPLICATION_UPDATED, + + CARD_APPLICATION_APPROVED, + + CARD_APPLICATION_DENIED, + + COURSE_LESSON_INTERACTION_COMPLETED, + + PAYOUT_METHOD_CREATED, + + VERIFICATION_SUCCEEDED, + + IDENTITY_PROFILE_APPROVED, + + IDENTITY_PROFILE_REJECTED, + + IDENTITY_PROFILE_NEEDS_ACTION, + + IDENTITY_PROFILE_UPDATED, + + PAYOUT_ACCOUNT_STATUS_UPDATED, + + RESOLUTION_CENTER_CASE_CREATED, + + RESOLUTION_CENTER_CASE_UPDATED, + + RESOLUTION_CENTER_CASE_DECIDED, + + PRODUCT_CREATED, + + PRODUCT_UPDATED, + + PRODUCT_DELETED, + + PRODUCT_PUBLISHED, + + PRODUCT_UNPUBLISHED, + + PLAN_CREATED, + + PLAN_UPDATED, + + PLAN_DELETED, + + SHIPMENT_CREATED, + + SHIPMENT_UPDATED, + + MEMBER_CREATED, + + AD_CAMPAIGN_PAYMENT_FAILED, + + CHAT_MESSAGE_CREATED, + + CHAT_REACTION_CREATED, + + PAYMENT_CREATED, + + PAYMENT_SUCCEEDED, + + PAYMENT_FAILED, + + PAYMENT_PENDING, + + DISPUTE_CREATED, + + DISPUTE_UPDATED, + + REFUND_CREATED, + + REFUND_UPDATED, + + DISPUTE_ALERT_CREATED, + + MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, + + MEMBERSHIP_WENT_VALID, + + MEMBERSHIP_WENT_INVALID, + + MEMBERSHIP_METADATA_UPDATED, + + RESOLUTION_CREATED, + + RESOLUTION_UPDATED, + + RESOLUTION_DECIDED, + + PAYMENT_AFFILIATE_REWARD_CREATED, + + MEMBERSHIP_EXPERIENCE_CLAIMED, + + APP_MEMBERSHIP_WENT_VALID, + + APP_MEMBERSHIP_WENT_INVALID, + + APP_PAYMENT_CREATED, + + APP_PAYMENT_SUCCEEDED, + + APP_PAYMENT_FAILED, + + APP_PAYMENT_PENDING, + + APP_MEMBERSHIP_CANCEL_AT_PERIOD_END_CHANGED, + + UNKNOWN + } + + public interface Visitor { + T visitAccountUpdated(); + + T visitInvoiceCreated(); + + T visitInvoiceMarkedUncollectible(); + + T visitInvoicePaid(); + + T visitInvoicePastDue(); + + T visitInvoiceVoided(); + + T visitMembershipActivated(); + + T visitMembershipDeactivated(); + + T visitMembershipTrialEndingSoon(); + + T visitEntryCreated(); + + T visitEntryApproved(); + + T visitEntryDenied(); + + T visitEntryDeleted(); + + T visitExportCompleted(); + + T visitExportFailed(); + + T visitSetupIntentRequiresAction(); + + T visitSetupIntentSucceeded(); + + T visitSetupIntentCanceled(); + + T visitLedgerAccountFundsAvailable(); + + T visitSwapCompleted(); + + T visitDepositSucceeded(); + + T visitTransferCreated(); + + T visitTransferCompleted(); + + T visitTransferFailed(); + + T visitWithdrawalCreated(); + + T visitWithdrawalUpdated(); + + T visitWithdrawalReversed(); + + T visitCardTransactionCreated(); + + T visitCardTransactionUpdated(); + + T visitCardTransactionCompleted(); + + T visitCardTransactionDeclined(); + + T visitCardTransactionReversed(); + + T visitCardCreated(); + + T visitCardUpdated(); + + T visitCardFrozen(); + + T visitCardCanceled(); + + T visitCardApplicationCreated(); + + T visitCardApplicationUpdated(); + + T visitCardApplicationApproved(); + + T visitCardApplicationDenied(); + + T visitCourseLessonInteractionCompleted(); + + T visitPayoutMethodCreated(); + + T visitVerificationSucceeded(); + + T visitIdentityProfileApproved(); + + T visitIdentityProfileRejected(); + + T visitIdentityProfileNeedsAction(); + + T visitIdentityProfileUpdated(); + + T visitPayoutAccountStatusUpdated(); + + T visitResolutionCenterCaseCreated(); + + T visitResolutionCenterCaseUpdated(); + + T visitResolutionCenterCaseDecided(); + + T visitProductCreated(); + + T visitProductUpdated(); + + T visitProductDeleted(); + + T visitProductPublished(); + + T visitProductUnpublished(); + + T visitPlanCreated(); + + T visitPlanUpdated(); + + T visitPlanDeleted(); + + T visitShipmentCreated(); + + T visitShipmentUpdated(); + + T visitMemberCreated(); + + T visitAdCampaignPaymentFailed(); + + T visitChatMessageCreated(); + + T visitChatReactionCreated(); + + T visitPaymentCreated(); + + T visitPaymentSucceeded(); + + T visitPaymentFailed(); + + T visitPaymentPending(); + + T visitDisputeCreated(); + + T visitDisputeUpdated(); + + T visitRefundCreated(); + + T visitRefundUpdated(); + + T visitDisputeAlertCreated(); + + T visitMembershipCancelAtPeriodEndChanged(); + + T visitMembershipWentValid(); + + T visitMembershipWentInvalid(); + + T visitMembershipMetadataUpdated(); + + T visitResolutionCreated(); + + T visitResolutionUpdated(); + + T visitResolutionDecided(); + + T visitPaymentAffiliateRewardCreated(); + + T visitMembershipExperienceClaimed(); + + T visitAppMembershipWentValid(); + + T visitAppMembershipWentInvalid(); + + T visitAppPaymentCreated(); + + T visitAppPaymentSucceeded(); + + T visitAppPaymentFailed(); + + T visitAppPaymentPending(); + + T visitAppMembershipCancelAtPeriodEndChanged(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/WhoCanPostTypes.java b/src/main/java/com/whop/api/types/WhoCanPostTypes.java new file mode 100644 index 00000000..1e24dd29 --- /dev/null +++ b/src/main/java/com/whop/api/types/WhoCanPostTypes.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WhoCanPostTypes { + public static final WhoCanPostTypes ADMINS = new WhoCanPostTypes(Value.ADMINS, "admins"); + + public static final WhoCanPostTypes EVERYONE = new WhoCanPostTypes(Value.EVERYONE, "everyone"); + + private final Value value; + + private final String string; + + WhoCanPostTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof WhoCanPostTypes && this.string.equals(((WhoCanPostTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ADMINS: + return visitor.visitAdmins(); + case EVERYONE: + return visitor.visitEveryone(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WhoCanPostTypes valueOf(String value) { + switch (value) { + case "admins": + return ADMINS; + case "everyone": + return EVERYONE; + default: + return new WhoCanPostTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + EVERYONE, + + ADMINS, + + UNKNOWN + } + + public interface Visitor { + T visitEveryone(); + + T visitAdmins(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/WhoCanReactTypes.java b/src/main/java/com/whop/api/types/WhoCanReactTypes.java new file mode 100644 index 00000000..0c7fa4a6 --- /dev/null +++ b/src/main/java/com/whop/api/types/WhoCanReactTypes.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WhoCanReactTypes { + public static final WhoCanReactTypes NO_ONE = new WhoCanReactTypes(Value.NO_ONE, "no_one"); + + public static final WhoCanReactTypes EVERYONE = new WhoCanReactTypes(Value.EVERYONE, "everyone"); + + private final Value value; + + private final String string; + + WhoCanReactTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof WhoCanReactTypes && this.string.equals(((WhoCanReactTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NO_ONE: + return visitor.visitNoOne(); + case EVERYONE: + return visitor.visitEveryone(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WhoCanReactTypes valueOf(String value) { + switch (value) { + case "no_one": + return NO_ONE; + case "everyone": + return EVERYONE; + default: + return new WhoCanReactTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + EVERYONE, + + NO_ONE, + + UNKNOWN + } + + public interface Visitor { + T visitEveryone(); + + T visitNoOne(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/Withdrawal.java b/src/main/java/com/whop/api/types/Withdrawal.java new file mode 100644 index 00000000..baf0fa3e --- /dev/null +++ b/src/main/java/com/whop/api/types/Withdrawal.java @@ -0,0 +1,950 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Withdrawal.Builder.class) +public final class Withdrawal { + private final double amount; + + private final OffsetDateTime createdAt; + + private final Currencies currency; + + private final Optional errorCode; + + private final Optional errorMessage; + + private final Optional estimatedAvailability; + + private final double feeAmount; + + private final Optional feeType; + + private final String id; + + private final WithdrawalLedgerAccount ledgerAccount; + + private final double markupFee; + + private final Optional payoutRequestId; + + private final Optional payoutToken; + + private final WithdrawalSpeeds speed; + + private final WithdrawalStatus status; + + private final Optional traceCode; + + private final Map additionalProperties; + + private Withdrawal( + double amount, + OffsetDateTime createdAt, + Currencies currency, + Optional errorCode, + Optional errorMessage, + Optional estimatedAvailability, + double feeAmount, + Optional feeType, + String id, + WithdrawalLedgerAccount ledgerAccount, + double markupFee, + Optional payoutRequestId, + Optional payoutToken, + WithdrawalSpeeds speed, + WithdrawalStatus status, + Optional traceCode, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.currency = currency; + this.errorCode = errorCode; + this.errorMessage = errorMessage; + this.estimatedAvailability = estimatedAvailability; + this.feeAmount = feeAmount; + this.feeType = feeType; + this.id = id; + this.ledgerAccount = ledgerAccount; + this.markupFee = markupFee; + this.payoutRequestId = payoutRequestId; + this.payoutToken = payoutToken; + this.speed = speed; + this.status = status; + this.traceCode = traceCode; + this.additionalProperties = additionalProperties; + } + + /** + * @return The withdrawal amount as a decimal number in the specified currency (e.g., 100.00 for $100.00 USD). + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The datetime the withdrawal was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code for this withdrawal (e.g., 'usd', 'eur'). + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return A machine-readable error code describing why the payout failed. Null if no error occurred. + */ + @JsonIgnore + public Optional getErrorCode() { + if (errorCode == null) { + return Optional.empty(); + } + return errorCode; + } + + /** + * @return A human-readable message describing why the payout failed. Null if no error occurred. + */ + @JsonIgnore + public Optional getErrorMessage() { + if (errorMessage == null) { + return Optional.empty(); + } + return errorMessage; + } + + /** + * @return The estimated time at which the funds become available in the destination account. Null if no estimate is available. As a Unix timestamp. + */ + @JsonIgnore + public Optional getEstimatedAvailability() { + if (estimatedAvailability == null) { + return Optional.empty(); + } + return estimatedAvailability; + } + + /** + * @return The fee charged for processing this withdrawal, in the same currency as the withdrawal amount. + */ + @JsonProperty("fee_amount") + public double getFeeAmount() { + return feeAmount; + } + + /** + * @return How the fee was applied to the withdrawal. 'exclusive' means the fee was added on top (user receives the full requested amount). 'inclusive' means the fee was deducted from the withdrawal (user receives less than requested). Null if no fee was charged. + */ + @JsonIgnore + public Optional getFeeType() { + if (feeType == null) { + return Optional.empty(); + } + return feeType; + } + + /** + * @return The unique identifier for the withdrawal. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The ledger account from which the withdrawal funds are sourced. + */ + @JsonProperty("ledger_account") + public WithdrawalLedgerAccount getLedgerAccount() { + return ledgerAccount; + } + + /** + * @return An additional markup fee charged for the withdrawal, in the same currency as the withdrawal amount. Only applies to platform accounts using Whop Rails. + */ + @JsonProperty("markup_fee") + public double getMarkupFee() { + return markupFee; + } + + /** + * @return The id of the payout request (returned by POST /payouts) that this withdrawal settles. Null unless the withdrawal originated from a stablecoin payout. + */ + @JsonIgnore + public Optional getPayoutRequestId() { + if (payoutRequestId == null) { + return Optional.empty(); + } + return payoutRequestId; + } + + /** + * @return The saved payout destination used for this withdrawal (e.g., a bank account or PayPal address). Null if no payout token was used. + */ + @JsonIgnore + public Optional getPayoutToken() { + if (payoutToken == null) { + return Optional.empty(); + } + return payoutToken; + } + + /** + * @return The processing speed selected for this withdrawal ('standard' or 'instant'). + */ + @JsonProperty("speed") + public WithdrawalSpeeds getSpeed() { + return speed; + } + + /** + * @return The computed lifecycle status of the withdrawal, accounting for the state of associated payouts (e.g., 'requested', 'in_transit', 'completed', 'failed'). + */ + @JsonProperty("status") + public WithdrawalStatus getStatus() { + return status; + } + + /** + * @return The ACH trace number for tracking the payout through the banking network. Null if not available or not an ACH transaction. + */ + @JsonIgnore + public Optional getTraceCode() { + if (traceCode == null) { + return Optional.empty(); + } + return traceCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("error_code") + private Optional _getErrorCode() { + return errorCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("error_message") + private Optional _getErrorMessage() { + return errorMessage; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("estimated_availability") + private Optional _getEstimatedAvailability() { + return estimatedAvailability; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fee_type") + private Optional _getFeeType() { + return feeType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_request_id") + private Optional _getPayoutRequestId() { + return payoutRequestId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_token") + private Optional _getPayoutToken() { + return payoutToken; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("trace_code") + private Optional _getTraceCode() { + return traceCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Withdrawal && equalTo((Withdrawal) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Withdrawal other) { + return amount == other.amount + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && errorCode.equals(other.errorCode) + && errorMessage.equals(other.errorMessage) + && estimatedAvailability.equals(other.estimatedAvailability) + && feeAmount == other.feeAmount + && feeType.equals(other.feeType) + && id.equals(other.id) + && ledgerAccount.equals(other.ledgerAccount) + && markupFee == other.markupFee + && payoutRequestId.equals(other.payoutRequestId) + && payoutToken.equals(other.payoutToken) + && speed.equals(other.speed) + && status.equals(other.status) + && traceCode.equals(other.traceCode); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.currency, + this.errorCode, + this.errorMessage, + this.estimatedAvailability, + this.feeAmount, + this.feeType, + this.id, + this.ledgerAccount, + this.markupFee, + this.payoutRequestId, + this.payoutToken, + this.speed, + this.status, + this.traceCode); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The withdrawal amount as a decimal number in the specified currency (e.g., 100.00 for $100.00 USD).

+ */ + CreatedAtStage amount(double amount); + + Builder from(Withdrawal other); + } + + public interface CreatedAtStage { + /** + *

The datetime the withdrawal was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

The three-letter ISO currency code for this withdrawal (e.g., 'usd', 'eur').

+ */ + FeeAmountStage currency(@NotNull Currencies currency); + } + + public interface FeeAmountStage { + /** + *

The fee charged for processing this withdrawal, in the same currency as the withdrawal amount.

+ */ + IdStage feeAmount(double feeAmount); + } + + public interface IdStage { + /** + *

The unique identifier for the withdrawal.

+ */ + LedgerAccountStage id(@NotNull String id); + } + + public interface LedgerAccountStage { + /** + *

The ledger account from which the withdrawal funds are sourced.

+ */ + MarkupFeeStage ledgerAccount(@NotNull WithdrawalLedgerAccount ledgerAccount); + } + + public interface MarkupFeeStage { + /** + *

An additional markup fee charged for the withdrawal, in the same currency as the withdrawal amount. Only applies to platform accounts using Whop Rails.

+ */ + SpeedStage markupFee(double markupFee); + } + + public interface SpeedStage { + /** + *

The processing speed selected for this withdrawal ('standard' or 'instant').

+ */ + StatusStage speed(@NotNull WithdrawalSpeeds speed); + } + + public interface StatusStage { + /** + *

The computed lifecycle status of the withdrawal, accounting for the state of associated payouts (e.g., 'requested', 'in_transit', 'completed', 'failed').

+ */ + _FinalStage status(@NotNull WithdrawalStatus status); + } + + public interface _FinalStage { + Withdrawal build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A machine-readable error code describing why the payout failed. Null if no error occurred.

+ */ + _FinalStage errorCode(Optional errorCode); + + _FinalStage errorCode(PayoutErrorCodes errorCode); + + _FinalStage errorCode(Nullable errorCode); + + /** + *

A human-readable message describing why the payout failed. Null if no error occurred.

+ */ + _FinalStage errorMessage(Optional errorMessage); + + _FinalStage errorMessage(String errorMessage); + + _FinalStage errorMessage(Nullable errorMessage); + + /** + *

The estimated time at which the funds become available in the destination account. Null if no estimate is available. As a Unix timestamp.

+ */ + _FinalStage estimatedAvailability(Optional estimatedAvailability); + + _FinalStage estimatedAvailability(OffsetDateTime estimatedAvailability); + + _FinalStage estimatedAvailability(Nullable estimatedAvailability); + + /** + *

How the fee was applied to the withdrawal. 'exclusive' means the fee was added on top (user receives the full requested amount). 'inclusive' means the fee was deducted from the withdrawal (user receives less than requested). Null if no fee was charged.

+ */ + _FinalStage feeType(Optional feeType); + + _FinalStage feeType(WithdrawalFeeTypes feeType); + + _FinalStage feeType(Nullable feeType); + + /** + *

The id of the payout request (returned by POST /payouts) that this withdrawal settles. Null unless the withdrawal originated from a stablecoin payout.

+ */ + _FinalStage payoutRequestId(Optional payoutRequestId); + + _FinalStage payoutRequestId(String payoutRequestId); + + _FinalStage payoutRequestId(Nullable payoutRequestId); + + /** + *

The saved payout destination used for this withdrawal (e.g., a bank account or PayPal address). Null if no payout token was used.

+ */ + _FinalStage payoutToken(Optional payoutToken); + + _FinalStage payoutToken(WithdrawalPayoutToken payoutToken); + + _FinalStage payoutToken(Nullable payoutToken); + + /** + *

The ACH trace number for tracking the payout through the banking network. Null if not available or not an ACH transaction.

+ */ + _FinalStage traceCode(Optional traceCode); + + _FinalStage traceCode(String traceCode); + + _FinalStage traceCode(Nullable traceCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + CurrencyStage, + FeeAmountStage, + IdStage, + LedgerAccountStage, + MarkupFeeStage, + SpeedStage, + StatusStage, + _FinalStage { + private double amount; + + private OffsetDateTime createdAt; + + private Currencies currency; + + private double feeAmount; + + private String id; + + private WithdrawalLedgerAccount ledgerAccount; + + private double markupFee; + + private WithdrawalSpeeds speed; + + private WithdrawalStatus status; + + private Optional traceCode = Optional.empty(); + + private Optional payoutToken = Optional.empty(); + + private Optional payoutRequestId = Optional.empty(); + + private Optional feeType = Optional.empty(); + + private Optional estimatedAvailability = Optional.empty(); + + private Optional errorMessage = Optional.empty(); + + private Optional errorCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Withdrawal other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + errorCode(other.getErrorCode()); + errorMessage(other.getErrorMessage()); + estimatedAvailability(other.getEstimatedAvailability()); + feeAmount(other.getFeeAmount()); + feeType(other.getFeeType()); + id(other.getId()); + ledgerAccount(other.getLedgerAccount()); + markupFee(other.getMarkupFee()); + payoutRequestId(other.getPayoutRequestId()); + payoutToken(other.getPayoutToken()); + speed(other.getSpeed()); + status(other.getStatus()); + traceCode(other.getTraceCode()); + return this; + } + + /** + *

The withdrawal amount as a decimal number in the specified currency (e.g., 100.00 for $100.00 USD).

+ *

The withdrawal amount as a decimal number in the specified currency (e.g., 100.00 for $100.00 USD).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The datetime the withdrawal was created.

+ *

The datetime the withdrawal was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The three-letter ISO currency code for this withdrawal (e.g., 'usd', 'eur').

+ *

The three-letter ISO currency code for this withdrawal (e.g., 'usd', 'eur').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public FeeAmountStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The fee charged for processing this withdrawal, in the same currency as the withdrawal amount.

+ *

The fee charged for processing this withdrawal, in the same currency as the withdrawal amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_amount") + public IdStage feeAmount(double feeAmount) { + this.feeAmount = feeAmount; + return this; + } + + /** + *

The unique identifier for the withdrawal.

+ *

The unique identifier for the withdrawal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LedgerAccountStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The ledger account from which the withdrawal funds are sourced.

+ *

The ledger account from which the withdrawal funds are sourced.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ledger_account") + public MarkupFeeStage ledgerAccount(@NotNull WithdrawalLedgerAccount ledgerAccount) { + this.ledgerAccount = Objects.requireNonNull(ledgerAccount, "ledgerAccount must not be null"); + return this; + } + + /** + *

An additional markup fee charged for the withdrawal, in the same currency as the withdrawal amount. Only applies to platform accounts using Whop Rails.

+ *

An additional markup fee charged for the withdrawal, in the same currency as the withdrawal amount. Only applies to platform accounts using Whop Rails.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("markup_fee") + public SpeedStage markupFee(double markupFee) { + this.markupFee = markupFee; + return this; + } + + /** + *

The processing speed selected for this withdrawal ('standard' or 'instant').

+ *

The processing speed selected for this withdrawal ('standard' or 'instant').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("speed") + public StatusStage speed(@NotNull WithdrawalSpeeds speed) { + this.speed = Objects.requireNonNull(speed, "speed must not be null"); + return this; + } + + /** + *

The computed lifecycle status of the withdrawal, accounting for the state of associated payouts (e.g., 'requested', 'in_transit', 'completed', 'failed').

+ *

The computed lifecycle status of the withdrawal, accounting for the state of associated payouts (e.g., 'requested', 'in_transit', 'completed', 'failed').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull WithdrawalStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The ACH trace number for tracking the payout through the banking network. Null if not available or not an ACH transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage traceCode(Nullable traceCode) { + if (traceCode.isNull()) { + this.traceCode = null; + } else if (traceCode.isEmpty()) { + this.traceCode = Optional.empty(); + } else { + this.traceCode = Optional.of(traceCode.get()); + } + return this; + } + + /** + *

The ACH trace number for tracking the payout through the banking network. Null if not available or not an ACH transaction.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage traceCode(String traceCode) { + this.traceCode = Optional.ofNullable(traceCode); + return this; + } + + /** + *

The ACH trace number for tracking the payout through the banking network. Null if not available or not an ACH transaction.

+ */ + @java.lang.Override + @JsonSetter(value = "trace_code", nulls = Nulls.SKIP) + public _FinalStage traceCode(Optional traceCode) { + this.traceCode = traceCode; + return this; + } + + /** + *

The saved payout destination used for this withdrawal (e.g., a bank account or PayPal address). Null if no payout token was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutToken(Nullable payoutToken) { + if (payoutToken.isNull()) { + this.payoutToken = null; + } else if (payoutToken.isEmpty()) { + this.payoutToken = Optional.empty(); + } else { + this.payoutToken = Optional.of(payoutToken.get()); + } + return this; + } + + /** + *

The saved payout destination used for this withdrawal (e.g., a bank account or PayPal address). Null if no payout token was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutToken(WithdrawalPayoutToken payoutToken) { + this.payoutToken = Optional.ofNullable(payoutToken); + return this; + } + + /** + *

The saved payout destination used for this withdrawal (e.g., a bank account or PayPal address). Null if no payout token was used.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_token", nulls = Nulls.SKIP) + public _FinalStage payoutToken(Optional payoutToken) { + this.payoutToken = payoutToken; + return this; + } + + /** + *

The id of the payout request (returned by POST /payouts) that this withdrawal settles. Null unless the withdrawal originated from a stablecoin payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(Nullable payoutRequestId) { + if (payoutRequestId.isNull()) { + this.payoutRequestId = null; + } else if (payoutRequestId.isEmpty()) { + this.payoutRequestId = Optional.empty(); + } else { + this.payoutRequestId = Optional.of(payoutRequestId.get()); + } + return this; + } + + /** + *

The id of the payout request (returned by POST /payouts) that this withdrawal settles. Null unless the withdrawal originated from a stablecoin payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(String payoutRequestId) { + this.payoutRequestId = Optional.ofNullable(payoutRequestId); + return this; + } + + /** + *

The id of the payout request (returned by POST /payouts) that this withdrawal settles. Null unless the withdrawal originated from a stablecoin payout.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_request_id", nulls = Nulls.SKIP) + public _FinalStage payoutRequestId(Optional payoutRequestId) { + this.payoutRequestId = payoutRequestId; + return this; + } + + /** + *

How the fee was applied to the withdrawal. 'exclusive' means the fee was added on top (user receives the full requested amount). 'inclusive' means the fee was deducted from the withdrawal (user receives less than requested). Null if no fee was charged.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeType(Nullable feeType) { + if (feeType.isNull()) { + this.feeType = null; + } else if (feeType.isEmpty()) { + this.feeType = Optional.empty(); + } else { + this.feeType = Optional.of(feeType.get()); + } + return this; + } + + /** + *

How the fee was applied to the withdrawal. 'exclusive' means the fee was added on top (user receives the full requested amount). 'inclusive' means the fee was deducted from the withdrawal (user receives less than requested). Null if no fee was charged.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeType(WithdrawalFeeTypes feeType) { + this.feeType = Optional.ofNullable(feeType); + return this; + } + + /** + *

How the fee was applied to the withdrawal. 'exclusive' means the fee was added on top (user receives the full requested amount). 'inclusive' means the fee was deducted from the withdrawal (user receives less than requested). Null if no fee was charged.

+ */ + @java.lang.Override + @JsonSetter(value = "fee_type", nulls = Nulls.SKIP) + public _FinalStage feeType(Optional feeType) { + this.feeType = feeType; + return this; + } + + /** + *

The estimated time at which the funds become available in the destination account. Null if no estimate is available. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedAvailability(Nullable estimatedAvailability) { + if (estimatedAvailability.isNull()) { + this.estimatedAvailability = null; + } else if (estimatedAvailability.isEmpty()) { + this.estimatedAvailability = Optional.empty(); + } else { + this.estimatedAvailability = Optional.of(estimatedAvailability.get()); + } + return this; + } + + /** + *

The estimated time at which the funds become available in the destination account. Null if no estimate is available. As a Unix timestamp.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage estimatedAvailability(OffsetDateTime estimatedAvailability) { + this.estimatedAvailability = Optional.ofNullable(estimatedAvailability); + return this; + } + + /** + *

The estimated time at which the funds become available in the destination account. Null if no estimate is available. As a Unix timestamp.

+ */ + @java.lang.Override + @JsonSetter(value = "estimated_availability", nulls = Nulls.SKIP) + public _FinalStage estimatedAvailability(Optional estimatedAvailability) { + this.estimatedAvailability = estimatedAvailability; + return this; + } + + /** + *

A human-readable message describing why the payout failed. Null if no error occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorMessage(Nullable errorMessage) { + if (errorMessage.isNull()) { + this.errorMessage = null; + } else if (errorMessage.isEmpty()) { + this.errorMessage = Optional.empty(); + } else { + this.errorMessage = Optional.of(errorMessage.get()); + } + return this; + } + + /** + *

A human-readable message describing why the payout failed. Null if no error occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorMessage(String errorMessage) { + this.errorMessage = Optional.ofNullable(errorMessage); + return this; + } + + /** + *

A human-readable message describing why the payout failed. Null if no error occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "error_message", nulls = Nulls.SKIP) + public _FinalStage errorMessage(Optional errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + *

A machine-readable error code describing why the payout failed. Null if no error occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorCode(Nullable errorCode) { + if (errorCode.isNull()) { + this.errorCode = null; + } else if (errorCode.isEmpty()) { + this.errorCode = Optional.empty(); + } else { + this.errorCode = Optional.of(errorCode.get()); + } + return this; + } + + /** + *

A machine-readable error code describing why the payout failed. Null if no error occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorCode(PayoutErrorCodes errorCode) { + this.errorCode = Optional.ofNullable(errorCode); + return this; + } + + /** + *

A machine-readable error code describing why the payout failed. Null if no error occurred.

+ */ + @java.lang.Override + @JsonSetter(value = "error_code", nulls = Nulls.SKIP) + public _FinalStage errorCode(Optional errorCode) { + this.errorCode = errorCode; + return this; + } + + @java.lang.Override + public Withdrawal build() { + return new Withdrawal( + amount, + createdAt, + currency, + errorCode, + errorMessage, + estimatedAvailability, + feeAmount, + feeType, + id, + ledgerAccount, + markupFee, + payoutRequestId, + payoutToken, + speed, + status, + traceCode, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/WithdrawalFeeTypes.java b/src/main/java/com/whop/api/types/WithdrawalFeeTypes.java new file mode 100644 index 00000000..bdafb733 --- /dev/null +++ b/src/main/java/com/whop/api/types/WithdrawalFeeTypes.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WithdrawalFeeTypes { + public static final WithdrawalFeeTypes EXCLUSIVE = new WithdrawalFeeTypes(Value.EXCLUSIVE, "exclusive"); + + public static final WithdrawalFeeTypes INCLUSIVE = new WithdrawalFeeTypes(Value.INCLUSIVE, "inclusive"); + + private final Value value; + + private final String string; + + WithdrawalFeeTypes(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof WithdrawalFeeTypes && this.string.equals(((WithdrawalFeeTypes) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EXCLUSIVE: + return visitor.visitExclusive(); + case INCLUSIVE: + return visitor.visitInclusive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WithdrawalFeeTypes valueOf(String value) { + switch (value) { + case "exclusive": + return EXCLUSIVE; + case "inclusive": + return INCLUSIVE; + default: + return new WithdrawalFeeTypes(Value.UNKNOWN, value); + } + } + + public enum Value { + EXCLUSIVE, + + INCLUSIVE, + + UNKNOWN + } + + public interface Visitor { + T visitExclusive(); + + T visitInclusive(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/WithdrawalLedgerAccount.java b/src/main/java/com/whop/api/types/WithdrawalLedgerAccount.java new file mode 100644 index 00000000..44c941b6 --- /dev/null +++ b/src/main/java/com/whop/api/types/WithdrawalLedgerAccount.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = WithdrawalLedgerAccount.Builder.class) +public final class WithdrawalLedgerAccount { + private final Optional companyId; + + private final String id; + + private final Map additionalProperties; + + private WithdrawalLedgerAccount(Optional companyId, String id, Map additionalProperties) { + this.companyId = companyId; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID. + */ + @JsonIgnore + public Optional getCompanyId() { + if (companyId == null) { + return Optional.empty(); + } + return companyId; + } + + /** + * @return The unique identifier for the ledger account. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("company_id") + private Optional _getCompanyId() { + return companyId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WithdrawalLedgerAccount && equalTo((WithdrawalLedgerAccount) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WithdrawalLedgerAccount other) { + return companyId.equals(other.companyId) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier for the ledger account.

+ */ + _FinalStage id(@NotNull String id); + + Builder from(WithdrawalLedgerAccount other); + } + + public interface _FinalStage { + WithdrawalLedgerAccount build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + _FinalStage companyId(Optional companyId); + + _FinalStage companyId(String companyId); + + _FinalStage companyId(Nullable companyId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, _FinalStage { + private String id; + + private Optional companyId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(WithdrawalLedgerAccount other) { + companyId(other.getCompanyId()); + id(other.getId()); + return this; + } + + /** + *

The unique identifier for the ledger account.

+ *

The unique identifier for the ledger account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage companyId(Nullable companyId) { + if (companyId.isNull()) { + this.companyId = null; + } else if (companyId.isEmpty()) { + this.companyId = Optional.empty(); + } else { + this.companyId = Optional.of(companyId.get()); + } + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + /** + *

Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.

+ */ + @java.lang.Override + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public _FinalStage companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + @java.lang.Override + public WithdrawalLedgerAccount build() { + return new WithdrawalLedgerAccount(companyId, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/WithdrawalListItem.java b/src/main/java/com/whop/api/types/WithdrawalListItem.java new file mode 100644 index 00000000..f0dce6a1 --- /dev/null +++ b/src/main/java/com/whop/api/types/WithdrawalListItem.java @@ -0,0 +1,552 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = WithdrawalListItem.Builder.class) +public final class WithdrawalListItem { + private final double amount; + + private final OffsetDateTime createdAt; + + private final Currencies currency; + + private final double feeAmount; + + private final Optional feeType; + + private final String id; + + private final double markupFee; + + private final Optional payoutRequestId; + + private final WithdrawalSpeeds speed; + + private final WithdrawalStatus status; + + private final Map additionalProperties; + + private WithdrawalListItem( + double amount, + OffsetDateTime createdAt, + Currencies currency, + double feeAmount, + Optional feeType, + String id, + double markupFee, + Optional payoutRequestId, + WithdrawalSpeeds speed, + WithdrawalStatus status, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.currency = currency; + this.feeAmount = feeAmount; + this.feeType = feeType; + this.id = id; + this.markupFee = markupFee; + this.payoutRequestId = payoutRequestId; + this.speed = speed; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The withdrawal amount as a decimal number in the specified currency (e.g., 100.00 for $100.00 USD). + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + /** + * @return The datetime the withdrawal was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code for this withdrawal (e.g., 'usd', 'eur'). + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The fee charged for processing this withdrawal, in the same currency as the withdrawal amount. + */ + @JsonProperty("fee_amount") + public double getFeeAmount() { + return feeAmount; + } + + /** + * @return How the fee was applied to the withdrawal. 'exclusive' means the fee was added on top (user receives the full requested amount). 'inclusive' means the fee was deducted from the withdrawal (user receives less than requested). Null if no fee was charged. + */ + @JsonIgnore + public Optional getFeeType() { + if (feeType == null) { + return Optional.empty(); + } + return feeType; + } + + /** + * @return The unique identifier for the withdrawal. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return An additional markup fee charged for the withdrawal, in the same currency as the withdrawal amount. Only applies to platform accounts using Whop Rails. + */ + @JsonProperty("markup_fee") + public double getMarkupFee() { + return markupFee; + } + + /** + * @return The id of the payout request (returned by POST /payouts) that this withdrawal settles. Null unless the withdrawal originated from a stablecoin payout. + */ + @JsonIgnore + public Optional getPayoutRequestId() { + if (payoutRequestId == null) { + return Optional.empty(); + } + return payoutRequestId; + } + + /** + * @return The processing speed selected for this withdrawal ('standard' or 'instant'). + */ + @JsonProperty("speed") + public WithdrawalSpeeds getSpeed() { + return speed; + } + + /** + * @return The computed lifecycle status of the withdrawal, accounting for the state of associated payouts (e.g., 'requested', 'in_transit', 'completed', 'failed'). + */ + @JsonProperty("status") + public WithdrawalStatus getStatus() { + return status; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("fee_type") + private Optional _getFeeType() { + return feeType; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payout_request_id") + private Optional _getPayoutRequestId() { + return payoutRequestId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WithdrawalListItem && equalTo((WithdrawalListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WithdrawalListItem other) { + return amount == other.amount + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && feeAmount == other.feeAmount + && feeType.equals(other.feeType) + && id.equals(other.id) + && markupFee == other.markupFee + && payoutRequestId.equals(other.payoutRequestId) + && speed.equals(other.speed) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.createdAt, + this.currency, + this.feeAmount, + this.feeType, + this.id, + this.markupFee, + this.payoutRequestId, + this.speed, + this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

The withdrawal amount as a decimal number in the specified currency (e.g., 100.00 for $100.00 USD).

+ */ + CreatedAtStage amount(double amount); + + Builder from(WithdrawalListItem other); + } + + public interface CreatedAtStage { + /** + *

The datetime the withdrawal was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

The three-letter ISO currency code for this withdrawal (e.g., 'usd', 'eur').

+ */ + FeeAmountStage currency(@NotNull Currencies currency); + } + + public interface FeeAmountStage { + /** + *

The fee charged for processing this withdrawal, in the same currency as the withdrawal amount.

+ */ + IdStage feeAmount(double feeAmount); + } + + public interface IdStage { + /** + *

The unique identifier for the withdrawal.

+ */ + MarkupFeeStage id(@NotNull String id); + } + + public interface MarkupFeeStage { + /** + *

An additional markup fee charged for the withdrawal, in the same currency as the withdrawal amount. Only applies to platform accounts using Whop Rails.

+ */ + SpeedStage markupFee(double markupFee); + } + + public interface SpeedStage { + /** + *

The processing speed selected for this withdrawal ('standard' or 'instant').

+ */ + StatusStage speed(@NotNull WithdrawalSpeeds speed); + } + + public interface StatusStage { + /** + *

The computed lifecycle status of the withdrawal, accounting for the state of associated payouts (e.g., 'requested', 'in_transit', 'completed', 'failed').

+ */ + _FinalStage status(@NotNull WithdrawalStatus status); + } + + public interface _FinalStage { + WithdrawalListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

How the fee was applied to the withdrawal. 'exclusive' means the fee was added on top (user receives the full requested amount). 'inclusive' means the fee was deducted from the withdrawal (user receives less than requested). Null if no fee was charged.

+ */ + _FinalStage feeType(Optional feeType); + + _FinalStage feeType(WithdrawalFeeTypes feeType); + + _FinalStage feeType(Nullable feeType); + + /** + *

The id of the payout request (returned by POST /payouts) that this withdrawal settles. Null unless the withdrawal originated from a stablecoin payout.

+ */ + _FinalStage payoutRequestId(Optional payoutRequestId); + + _FinalStage payoutRequestId(String payoutRequestId); + + _FinalStage payoutRequestId(Nullable payoutRequestId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + CurrencyStage, + FeeAmountStage, + IdStage, + MarkupFeeStage, + SpeedStage, + StatusStage, + _FinalStage { + private double amount; + + private OffsetDateTime createdAt; + + private Currencies currency; + + private double feeAmount; + + private String id; + + private double markupFee; + + private WithdrawalSpeeds speed; + + private WithdrawalStatus status; + + private Optional payoutRequestId = Optional.empty(); + + private Optional feeType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(WithdrawalListItem other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + feeAmount(other.getFeeAmount()); + feeType(other.getFeeType()); + id(other.getId()); + markupFee(other.getMarkupFee()); + payoutRequestId(other.getPayoutRequestId()); + speed(other.getSpeed()); + status(other.getStatus()); + return this; + } + + /** + *

The withdrawal amount as a decimal number in the specified currency (e.g., 100.00 for $100.00 USD).

+ *

The withdrawal amount as a decimal number in the specified currency (e.g., 100.00 for $100.00 USD).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + /** + *

The datetime the withdrawal was created.

+ *

The datetime the withdrawal was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The three-letter ISO currency code for this withdrawal (e.g., 'usd', 'eur').

+ *

The three-letter ISO currency code for this withdrawal (e.g., 'usd', 'eur').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public FeeAmountStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The fee charged for processing this withdrawal, in the same currency as the withdrawal amount.

+ *

The fee charged for processing this withdrawal, in the same currency as the withdrawal amount.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("fee_amount") + public IdStage feeAmount(double feeAmount) { + this.feeAmount = feeAmount; + return this; + } + + /** + *

The unique identifier for the withdrawal.

+ *

The unique identifier for the withdrawal.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public MarkupFeeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

An additional markup fee charged for the withdrawal, in the same currency as the withdrawal amount. Only applies to platform accounts using Whop Rails.

+ *

An additional markup fee charged for the withdrawal, in the same currency as the withdrawal amount. Only applies to platform accounts using Whop Rails.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("markup_fee") + public SpeedStage markupFee(double markupFee) { + this.markupFee = markupFee; + return this; + } + + /** + *

The processing speed selected for this withdrawal ('standard' or 'instant').

+ *

The processing speed selected for this withdrawal ('standard' or 'instant').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("speed") + public StatusStage speed(@NotNull WithdrawalSpeeds speed) { + this.speed = Objects.requireNonNull(speed, "speed must not be null"); + return this; + } + + /** + *

The computed lifecycle status of the withdrawal, accounting for the state of associated payouts (e.g., 'requested', 'in_transit', 'completed', 'failed').

+ *

The computed lifecycle status of the withdrawal, accounting for the state of associated payouts (e.g., 'requested', 'in_transit', 'completed', 'failed').

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull WithdrawalStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The id of the payout request (returned by POST /payouts) that this withdrawal settles. Null unless the withdrawal originated from a stablecoin payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(Nullable payoutRequestId) { + if (payoutRequestId.isNull()) { + this.payoutRequestId = null; + } else if (payoutRequestId.isEmpty()) { + this.payoutRequestId = Optional.empty(); + } else { + this.payoutRequestId = Optional.of(payoutRequestId.get()); + } + return this; + } + + /** + *

The id of the payout request (returned by POST /payouts) that this withdrawal settles. Null unless the withdrawal originated from a stablecoin payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payoutRequestId(String payoutRequestId) { + this.payoutRequestId = Optional.ofNullable(payoutRequestId); + return this; + } + + /** + *

The id of the payout request (returned by POST /payouts) that this withdrawal settles. Null unless the withdrawal originated from a stablecoin payout.

+ */ + @java.lang.Override + @JsonSetter(value = "payout_request_id", nulls = Nulls.SKIP) + public _FinalStage payoutRequestId(Optional payoutRequestId) { + this.payoutRequestId = payoutRequestId; + return this; + } + + /** + *

How the fee was applied to the withdrawal. 'exclusive' means the fee was added on top (user receives the full requested amount). 'inclusive' means the fee was deducted from the withdrawal (user receives less than requested). Null if no fee was charged.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeType(Nullable feeType) { + if (feeType.isNull()) { + this.feeType = null; + } else if (feeType.isEmpty()) { + this.feeType = Optional.empty(); + } else { + this.feeType = Optional.of(feeType.get()); + } + return this; + } + + /** + *

How the fee was applied to the withdrawal. 'exclusive' means the fee was added on top (user receives the full requested amount). 'inclusive' means the fee was deducted from the withdrawal (user receives less than requested). Null if no fee was charged.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage feeType(WithdrawalFeeTypes feeType) { + this.feeType = Optional.ofNullable(feeType); + return this; + } + + /** + *

How the fee was applied to the withdrawal. 'exclusive' means the fee was added on top (user receives the full requested amount). 'inclusive' means the fee was deducted from the withdrawal (user receives less than requested). Null if no fee was charged.

+ */ + @java.lang.Override + @JsonSetter(value = "fee_type", nulls = Nulls.SKIP) + public _FinalStage feeType(Optional feeType) { + this.feeType = feeType; + return this; + } + + @java.lang.Override + public WithdrawalListItem build() { + return new WithdrawalListItem( + amount, + createdAt, + currency, + feeAmount, + feeType, + id, + markupFee, + payoutRequestId, + speed, + status, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/WithdrawalPayoutToken.java b/src/main/java/com/whop/api/types/WithdrawalPayoutToken.java new file mode 100644 index 00000000..31cccfd5 --- /dev/null +++ b/src/main/java/com/whop/api/types/WithdrawalPayoutToken.java @@ -0,0 +1,349 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.Nullable; +import com.whop.api.core.NullableNonemptyFilter; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = WithdrawalPayoutToken.Builder.class) +public final class WithdrawalPayoutToken { + private final OffsetDateTime createdAt; + + private final String destinationCurrencyCode; + + private final String id; + + private final Optional nickname; + + private final Optional payerName; + + private final Map additionalProperties; + + private WithdrawalPayoutToken( + OffsetDateTime createdAt, + String destinationCurrencyCode, + String id, + Optional nickname, + Optional payerName, + Map additionalProperties) { + this.createdAt = createdAt; + this.destinationCurrencyCode = destinationCurrencyCode; + this.id = id; + this.nickname = nickname; + this.payerName = payerName; + this.additionalProperties = additionalProperties; + } + + /** + * @return The datetime the payout token was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The three-letter ISO currency code that payouts are delivered in for this destination. + */ + @JsonProperty("destination_currency_code") + public String getDestinationCurrencyCode() { + return destinationCurrencyCode; + } + + /** + * @return The unique identifier for the payout token. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return A user-defined label to help identify this payout destination. Not sent to the provider. Null if no nickname has been set. + */ + @JsonIgnore + public Optional getNickname() { + if (nickname == null) { + return Optional.empty(); + } + return nickname; + } + + /** + * @return The legal name of the account holder receiving payouts. Null if not provided. + */ + @JsonIgnore + public Optional getPayerName() { + if (payerName == null) { + return Optional.empty(); + } + return payerName; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("nickname") + private Optional _getNickname() { + return nickname; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payer_name") + private Optional _getPayerName() { + return payerName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WithdrawalPayoutToken && equalTo((WithdrawalPayoutToken) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WithdrawalPayoutToken other) { + return createdAt.equals(other.createdAt) + && destinationCurrencyCode.equals(other.destinationCurrencyCode) + && id.equals(other.id) + && nickname.equals(other.nickname) + && payerName.equals(other.payerName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.destinationCurrencyCode, this.id, this.nickname, this.payerName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + /** + *

The datetime the payout token was created.

+ */ + DestinationCurrencyCodeStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(WithdrawalPayoutToken other); + } + + public interface DestinationCurrencyCodeStage { + /** + *

The three-letter ISO currency code that payouts are delivered in for this destination.

+ */ + IdStage destinationCurrencyCode(@NotNull String destinationCurrencyCode); + } + + public interface IdStage { + /** + *

The unique identifier for the payout token.

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + WithdrawalPayoutToken build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

A user-defined label to help identify this payout destination. Not sent to the provider. Null if no nickname has been set.

+ */ + _FinalStage nickname(Optional nickname); + + _FinalStage nickname(String nickname); + + _FinalStage nickname(Nullable nickname); + + /** + *

The legal name of the account holder receiving payouts. Null if not provided.

+ */ + _FinalStage payerName(Optional payerName); + + _FinalStage payerName(String payerName); + + _FinalStage payerName(Nullable payerName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, DestinationCurrencyCodeStage, IdStage, _FinalStage { + private OffsetDateTime createdAt; + + private String destinationCurrencyCode; + + private String id; + + private Optional payerName = Optional.empty(); + + private Optional nickname = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(WithdrawalPayoutToken other) { + createdAt(other.getCreatedAt()); + destinationCurrencyCode(other.getDestinationCurrencyCode()); + id(other.getId()); + nickname(other.getNickname()); + payerName(other.getPayerName()); + return this; + } + + /** + *

The datetime the payout token was created.

+ *

The datetime the payout token was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public DestinationCurrencyCodeStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The three-letter ISO currency code that payouts are delivered in for this destination.

+ *

The three-letter ISO currency code that payouts are delivered in for this destination.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("destination_currency_code") + public IdStage destinationCurrencyCode(@NotNull String destinationCurrencyCode) { + this.destinationCurrencyCode = + Objects.requireNonNull(destinationCurrencyCode, "destinationCurrencyCode must not be null"); + return this; + } + + /** + *

The unique identifier for the payout token.

+ *

The unique identifier for the payout token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The legal name of the account holder receiving payouts. Null if not provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(Nullable payerName) { + if (payerName.isNull()) { + this.payerName = null; + } else if (payerName.isEmpty()) { + this.payerName = Optional.empty(); + } else { + this.payerName = Optional.of(payerName.get()); + } + return this; + } + + /** + *

The legal name of the account holder receiving payouts. Null if not provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage payerName(String payerName) { + this.payerName = Optional.ofNullable(payerName); + return this; + } + + /** + *

The legal name of the account holder receiving payouts. Null if not provided.

+ */ + @java.lang.Override + @JsonSetter(value = "payer_name", nulls = Nulls.SKIP) + public _FinalStage payerName(Optional payerName) { + this.payerName = payerName; + return this; + } + + /** + *

A user-defined label to help identify this payout destination. Not sent to the provider. Null if no nickname has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(Nullable nickname) { + if (nickname.isNull()) { + this.nickname = null; + } else if (nickname.isEmpty()) { + this.nickname = Optional.empty(); + } else { + this.nickname = Optional.of(nickname.get()); + } + return this; + } + + /** + *

A user-defined label to help identify this payout destination. Not sent to the provider. Null if no nickname has been set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage nickname(String nickname) { + this.nickname = Optional.ofNullable(nickname); + return this; + } + + /** + *

A user-defined label to help identify this payout destination. Not sent to the provider. Null if no nickname has been set.

+ */ + @java.lang.Override + @JsonSetter(value = "nickname", nulls = Nulls.SKIP) + public _FinalStage nickname(Optional nickname) { + this.nickname = nickname; + return this; + } + + @java.lang.Override + public WithdrawalPayoutToken build() { + return new WithdrawalPayoutToken( + createdAt, destinationCurrencyCode, id, nickname, payerName, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/WithdrawalSpeeds.java b/src/main/java/com/whop/api/types/WithdrawalSpeeds.java new file mode 100644 index 00000000..008bf778 --- /dev/null +++ b/src/main/java/com/whop/api/types/WithdrawalSpeeds.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WithdrawalSpeeds { + public static final WithdrawalSpeeds INSTANT = new WithdrawalSpeeds(Value.INSTANT, "instant"); + + public static final WithdrawalSpeeds STANDARD = new WithdrawalSpeeds(Value.STANDARD, "standard"); + + private final Value value; + + private final String string; + + WithdrawalSpeeds(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof WithdrawalSpeeds && this.string.equals(((WithdrawalSpeeds) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INSTANT: + return visitor.visitInstant(); + case STANDARD: + return visitor.visitStandard(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WithdrawalSpeeds valueOf(String value) { + switch (value) { + case "instant": + return INSTANT; + case "standard": + return STANDARD; + default: + return new WithdrawalSpeeds(Value.UNKNOWN, value); + } + } + + public enum Value { + STANDARD, + + INSTANT, + + UNKNOWN + } + + public interface Visitor { + T visitStandard(); + + T visitInstant(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/WithdrawalStatus.java b/src/main/java/com/whop/api/types/WithdrawalStatus.java new file mode 100644 index 00000000..148d61ab --- /dev/null +++ b/src/main/java/com/whop/api/types/WithdrawalStatus.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WithdrawalStatus { + public static final WithdrawalStatus FAILED = new WithdrawalStatus(Value.FAILED, "failed"); + + public static final WithdrawalStatus CANCELED = new WithdrawalStatus(Value.CANCELED, "canceled"); + + public static final WithdrawalStatus COMPLETED = new WithdrawalStatus(Value.COMPLETED, "completed"); + + public static final WithdrawalStatus REQUESTED = new WithdrawalStatus(Value.REQUESTED, "requested"); + + public static final WithdrawalStatus AWAITING_PAYMENT = + new WithdrawalStatus(Value.AWAITING_PAYMENT, "awaiting_payment"); + + public static final WithdrawalStatus DENIED = new WithdrawalStatus(Value.DENIED, "denied"); + + public static final WithdrawalStatus IN_TRANSIT = new WithdrawalStatus(Value.IN_TRANSIT, "in_transit"); + + private final Value value; + + private final String string; + + WithdrawalStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof WithdrawalStatus && this.string.equals(((WithdrawalStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case CANCELED: + return visitor.visitCanceled(); + case COMPLETED: + return visitor.visitCompleted(); + case REQUESTED: + return visitor.visitRequested(); + case AWAITING_PAYMENT: + return visitor.visitAwaitingPayment(); + case DENIED: + return visitor.visitDenied(); + case IN_TRANSIT: + return visitor.visitInTransit(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WithdrawalStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "canceled": + return CANCELED; + case "completed": + return COMPLETED; + case "requested": + return REQUESTED; + case "awaiting_payment": + return AWAITING_PAYMENT; + case "denied": + return DENIED; + case "in_transit": + return IN_TRANSIT; + default: + return new WithdrawalStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + REQUESTED, + + AWAITING_PAYMENT, + + IN_TRANSIT, + + COMPLETED, + + FAILED, + + CANCELED, + + DENIED, + + UNKNOWN + } + + public interface Visitor { + T visitRequested(); + + T visitAwaitingPayment(); + + T visitInTransit(); + + T visitCompleted(); + + T visitFailed(); + + T visitCanceled(); + + T visitDenied(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/whop/api/types/WorkforceBounty.java b/src/main/java/com/whop/api/types/WorkforceBounty.java new file mode 100644 index 00000000..acd20f04 --- /dev/null +++ b/src/main/java/com/whop/api/types/WorkforceBounty.java @@ -0,0 +1,517 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = WorkforceBounty.Builder.class) +public final class WorkforceBounty { + private final BountyTypes bountyType; + + private final OffsetDateTime createdAt; + + private final Currencies currency; + + private final String description; + + private final String id; + + private final Statuses status; + + private final String title; + + private final double totalAvailable; + + private final double totalPaid; + + private final OffsetDateTime updatedAt; + + private final int voteThreshold; + + private final Map additionalProperties; + + private WorkforceBounty( + BountyTypes bountyType, + OffsetDateTime createdAt, + Currencies currency, + String description, + String id, + Statuses status, + String title, + double totalAvailable, + double totalPaid, + OffsetDateTime updatedAt, + int voteThreshold, + Map additionalProperties) { + this.bountyType = bountyType; + this.createdAt = createdAt; + this.currency = currency; + this.description = description; + this.id = id; + this.status = status; + this.title = title; + this.totalAvailable = totalAvailable; + this.totalPaid = totalPaid; + this.updatedAt = updatedAt; + this.voteThreshold = voteThreshold; + this.additionalProperties = additionalProperties; + } + + /** + * @return The underlying bounty implementation type. + */ + @JsonProperty("bounty_type") + public BountyTypes getBountyType() { + return bountyType; + } + + /** + * @return The datetime the bounty was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The currency used for the bounty funds. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The description of the bounty. + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * @return The unique identifier for the bounty. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The current lifecycle status of the bounty. + */ + @JsonProperty("status") + public Statuses getStatus() { + return status; + } + + /** + * @return The title of the bounty. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return The total amount currently funded in the bounty pool for payout. + */ + @JsonProperty("total_available") + public double getTotalAvailable() { + return totalAvailable; + } + + /** + * @return The total amount paid out for this bounty. + */ + @JsonProperty("total_paid") + public double getTotalPaid() { + return totalPaid; + } + + /** + * @return The datetime the bounty was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The number of watcher votes required before the submission can resolve. + */ + @JsonProperty("vote_threshold") + public int getVoteThreshold() { + return voteThreshold; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkforceBounty && equalTo((WorkforceBounty) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WorkforceBounty other) { + return bountyType.equals(other.bountyType) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && description.equals(other.description) + && id.equals(other.id) + && status.equals(other.status) + && title.equals(other.title) + && totalAvailable == other.totalAvailable + && totalPaid == other.totalPaid + && updatedAt.equals(other.updatedAt) + && voteThreshold == other.voteThreshold; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bountyType, + this.createdAt, + this.currency, + this.description, + this.id, + this.status, + this.title, + this.totalAvailable, + this.totalPaid, + this.updatedAt, + this.voteThreshold); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BountyTypeStage builder() { + return new Builder(); + } + + public interface BountyTypeStage { + /** + *

The underlying bounty implementation type.

+ */ + CreatedAtStage bountyType(@NotNull BountyTypes bountyType); + + Builder from(WorkforceBounty other); + } + + public interface CreatedAtStage { + /** + *

The datetime the bounty was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

The currency used for the bounty funds.

+ */ + DescriptionStage currency(@NotNull Currencies currency); + } + + public interface DescriptionStage { + /** + *

The description of the bounty.

+ */ + IdStage description(@NotNull String description); + } + + public interface IdStage { + /** + *

The unique identifier for the bounty.

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

The current lifecycle status of the bounty.

+ */ + TitleStage status(@NotNull Statuses status); + } + + public interface TitleStage { + /** + *

The title of the bounty.

+ */ + TotalAvailableStage title(@NotNull String title); + } + + public interface TotalAvailableStage { + /** + *

The total amount currently funded in the bounty pool for payout.

+ */ + TotalPaidStage totalAvailable(double totalAvailable); + } + + public interface TotalPaidStage { + /** + *

The total amount paid out for this bounty.

+ */ + UpdatedAtStage totalPaid(double totalPaid); + } + + public interface UpdatedAtStage { + /** + *

The datetime the bounty was last updated.

+ */ + VoteThresholdStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface VoteThresholdStage { + /** + *

The number of watcher votes required before the submission can resolve.

+ */ + _FinalStage voteThreshold(int voteThreshold); + } + + public interface _FinalStage { + WorkforceBounty build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BountyTypeStage, + CreatedAtStage, + CurrencyStage, + DescriptionStage, + IdStage, + StatusStage, + TitleStage, + TotalAvailableStage, + TotalPaidStage, + UpdatedAtStage, + VoteThresholdStage, + _FinalStage { + private BountyTypes bountyType; + + private OffsetDateTime createdAt; + + private Currencies currency; + + private String description; + + private String id; + + private Statuses status; + + private String title; + + private double totalAvailable; + + private double totalPaid; + + private OffsetDateTime updatedAt; + + private int voteThreshold; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(WorkforceBounty other) { + bountyType(other.getBountyType()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + description(other.getDescription()); + id(other.getId()); + status(other.getStatus()); + title(other.getTitle()); + totalAvailable(other.getTotalAvailable()); + totalPaid(other.getTotalPaid()); + updatedAt(other.getUpdatedAt()); + voteThreshold(other.getVoteThreshold()); + return this; + } + + /** + *

The underlying bounty implementation type.

+ *

The underlying bounty implementation type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bounty_type") + public CreatedAtStage bountyType(@NotNull BountyTypes bountyType) { + this.bountyType = Objects.requireNonNull(bountyType, "bountyType must not be null"); + return this; + } + + /** + *

The datetime the bounty was created.

+ *

The datetime the bounty was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The currency used for the bounty funds.

+ *

The currency used for the bounty funds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DescriptionStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The description of the bounty.

+ *

The description of the bounty.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("description") + public IdStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + /** + *

The unique identifier for the bounty.

+ *

The unique identifier for the bounty.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current lifecycle status of the bounty.

+ *

The current lifecycle status of the bounty.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TitleStage status(@NotNull Statuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The title of the bounty.

+ *

The title of the bounty.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public TotalAvailableStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

The total amount currently funded in the bounty pool for payout.

+ *

The total amount currently funded in the bounty pool for payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_available") + public TotalPaidStage totalAvailable(double totalAvailable) { + this.totalAvailable = totalAvailable; + return this; + } + + /** + *

The total amount paid out for this bounty.

+ *

The total amount paid out for this bounty.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_paid") + public UpdatedAtStage totalPaid(double totalPaid) { + this.totalPaid = totalPaid; + return this; + } + + /** + *

The datetime the bounty was last updated.

+ *

The datetime the bounty was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public VoteThresholdStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The number of watcher votes required before the submission can resolve.

+ *

The number of watcher votes required before the submission can resolve.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("vote_threshold") + public _FinalStage voteThreshold(int voteThreshold) { + this.voteThreshold = voteThreshold; + return this; + } + + @java.lang.Override + public WorkforceBounty build() { + return new WorkforceBounty( + bountyType, + createdAt, + currency, + description, + id, + status, + title, + totalAvailable, + totalPaid, + updatedAt, + voteThreshold, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/whop/api/types/WorkforceBountyListItem.java b/src/main/java/com/whop/api/types/WorkforceBountyListItem.java new file mode 100644 index 00000000..7d14ef94 --- /dev/null +++ b/src/main/java/com/whop/api/types/WorkforceBountyListItem.java @@ -0,0 +1,517 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.whop.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = WorkforceBountyListItem.Builder.class) +public final class WorkforceBountyListItem { + private final BountyTypes bountyType; + + private final OffsetDateTime createdAt; + + private final Currencies currency; + + private final String description; + + private final String id; + + private final Statuses status; + + private final String title; + + private final double totalAvailable; + + private final double totalPaid; + + private final OffsetDateTime updatedAt; + + private final int voteThreshold; + + private final Map additionalProperties; + + private WorkforceBountyListItem( + BountyTypes bountyType, + OffsetDateTime createdAt, + Currencies currency, + String description, + String id, + Statuses status, + String title, + double totalAvailable, + double totalPaid, + OffsetDateTime updatedAt, + int voteThreshold, + Map additionalProperties) { + this.bountyType = bountyType; + this.createdAt = createdAt; + this.currency = currency; + this.description = description; + this.id = id; + this.status = status; + this.title = title; + this.totalAvailable = totalAvailable; + this.totalPaid = totalPaid; + this.updatedAt = updatedAt; + this.voteThreshold = voteThreshold; + this.additionalProperties = additionalProperties; + } + + /** + * @return The underlying bounty implementation type. + */ + @JsonProperty("bounty_type") + public BountyTypes getBountyType() { + return bountyType; + } + + /** + * @return The datetime the bounty was created. + */ + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The currency used for the bounty funds. + */ + @JsonProperty("currency") + public Currencies getCurrency() { + return currency; + } + + /** + * @return The description of the bounty. + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * @return The unique identifier for the bounty. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The current lifecycle status of the bounty. + */ + @JsonProperty("status") + public Statuses getStatus() { + return status; + } + + /** + * @return The title of the bounty. + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return The total amount currently funded in the bounty pool for payout. + */ + @JsonProperty("total_available") + public double getTotalAvailable() { + return totalAvailable; + } + + /** + * @return The total amount paid out for this bounty. + */ + @JsonProperty("total_paid") + public double getTotalPaid() { + return totalPaid; + } + + /** + * @return The datetime the bounty was last updated. + */ + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return The number of watcher votes required before the submission can resolve. + */ + @JsonProperty("vote_threshold") + public int getVoteThreshold() { + return voteThreshold; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkforceBountyListItem && equalTo((WorkforceBountyListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WorkforceBountyListItem other) { + return bountyType.equals(other.bountyType) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && description.equals(other.description) + && id.equals(other.id) + && status.equals(other.status) + && title.equals(other.title) + && totalAvailable == other.totalAvailable + && totalPaid == other.totalPaid + && updatedAt.equals(other.updatedAt) + && voteThreshold == other.voteThreshold; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bountyType, + this.createdAt, + this.currency, + this.description, + this.id, + this.status, + this.title, + this.totalAvailable, + this.totalPaid, + this.updatedAt, + this.voteThreshold); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BountyTypeStage builder() { + return new Builder(); + } + + public interface BountyTypeStage { + /** + *

The underlying bounty implementation type.

+ */ + CreatedAtStage bountyType(@NotNull BountyTypes bountyType); + + Builder from(WorkforceBountyListItem other); + } + + public interface CreatedAtStage { + /** + *

The datetime the bounty was created.

+ */ + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + /** + *

The currency used for the bounty funds.

+ */ + DescriptionStage currency(@NotNull Currencies currency); + } + + public interface DescriptionStage { + /** + *

The description of the bounty.

+ */ + IdStage description(@NotNull String description); + } + + public interface IdStage { + /** + *

The unique identifier for the bounty.

+ */ + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + /** + *

The current lifecycle status of the bounty.

+ */ + TitleStage status(@NotNull Statuses status); + } + + public interface TitleStage { + /** + *

The title of the bounty.

+ */ + TotalAvailableStage title(@NotNull String title); + } + + public interface TotalAvailableStage { + /** + *

The total amount currently funded in the bounty pool for payout.

+ */ + TotalPaidStage totalAvailable(double totalAvailable); + } + + public interface TotalPaidStage { + /** + *

The total amount paid out for this bounty.

+ */ + UpdatedAtStage totalPaid(double totalPaid); + } + + public interface UpdatedAtStage { + /** + *

The datetime the bounty was last updated.

+ */ + VoteThresholdStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface VoteThresholdStage { + /** + *

The number of watcher votes required before the submission can resolve.

+ */ + _FinalStage voteThreshold(int voteThreshold); + } + + public interface _FinalStage { + WorkforceBountyListItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BountyTypeStage, + CreatedAtStage, + CurrencyStage, + DescriptionStage, + IdStage, + StatusStage, + TitleStage, + TotalAvailableStage, + TotalPaidStage, + UpdatedAtStage, + VoteThresholdStage, + _FinalStage { + private BountyTypes bountyType; + + private OffsetDateTime createdAt; + + private Currencies currency; + + private String description; + + private String id; + + private Statuses status; + + private String title; + + private double totalAvailable; + + private double totalPaid; + + private OffsetDateTime updatedAt; + + private int voteThreshold; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(WorkforceBountyListItem other) { + bountyType(other.getBountyType()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + description(other.getDescription()); + id(other.getId()); + status(other.getStatus()); + title(other.getTitle()); + totalAvailable(other.getTotalAvailable()); + totalPaid(other.getTotalPaid()); + updatedAt(other.getUpdatedAt()); + voteThreshold(other.getVoteThreshold()); + return this; + } + + /** + *

The underlying bounty implementation type.

+ *

The underlying bounty implementation type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bounty_type") + public CreatedAtStage bountyType(@NotNull BountyTypes bountyType) { + this.bountyType = Objects.requireNonNull(bountyType, "bountyType must not be null"); + return this; + } + + /** + *

The datetime the bounty was created.

+ *

The datetime the bounty was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The currency used for the bounty funds.

+ *

The currency used for the bounty funds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("currency") + public DescriptionStage currency(@NotNull Currencies currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + /** + *

The description of the bounty.

+ *

The description of the bounty.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("description") + public IdStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + /** + *

The unique identifier for the bounty.

+ *

The unique identifier for the bounty.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The current lifecycle status of the bounty.

+ *

The current lifecycle status of the bounty.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public TitleStage status(@NotNull Statuses status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The title of the bounty.

+ *

The title of the bounty.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("title") + public TotalAvailableStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + /** + *

The total amount currently funded in the bounty pool for payout.

+ *

The total amount currently funded in the bounty pool for payout.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_available") + public TotalPaidStage totalAvailable(double totalAvailable) { + this.totalAvailable = totalAvailable; + return this; + } + + /** + *

The total amount paid out for this bounty.

+ *

The total amount paid out for this bounty.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total_paid") + public UpdatedAtStage totalPaid(double totalPaid) { + this.totalPaid = totalPaid; + return this; + } + + /** + *

The datetime the bounty was last updated.

+ *

The datetime the bounty was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public VoteThresholdStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The number of watcher votes required before the submission can resolve.

+ *

The number of watcher votes required before the submission can resolve.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("vote_threshold") + public _FinalStage voteThreshold(int voteThreshold) { + this.voteThreshold = voteThreshold; + return this; + } + + @java.lang.Override + public WorkforceBountyListItem build() { + return new WorkforceBountyListItem( + bountyType, + createdAt, + currency, + description, + id, + status, + title, + totalAvailable, + totalPaid, + updatedAt, + voteThreshold, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/test/java/com/whop/api/StreamTest.java b/src/test/java/com/whop/api/StreamTest.java new file mode 100644 index 00000000..65c3af3f --- /dev/null +++ b/src/test/java/com/whop/api/StreamTest.java @@ -0,0 +1,120 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api; + +import static org.junit.jupiter.api.Assertions.*; + +import com.whop.api.core.ObjectMappers; +import com.whop.api.core.Stream; +import java.io.IOException; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Test; + +public final class StreamTest { + @Test + public void testJsonStream() { + List> messages = + Arrays.asList(createMap("message", "hello"), createMap("message", "world")); + List jsonStrings = messages.stream().map(StreamTest::mapToJson).collect(Collectors.toList()); + String input = String.join("\n", jsonStrings); + StringReader jsonInput = new StringReader(input); + Stream jsonStream = Stream.fromJson(Map.class, jsonInput); + int expectedMessages = 2; + int actualMessages = 0; + for (Map jsonObject : jsonStream) { + actualMessages++; + assertTrue(jsonObject.containsKey("message")); + } + assertEquals(expectedMessages, actualMessages); + } + + @Test + public void testSseStream() { + List> events = Arrays.asList(createMap("event", "start"), createMap("event", "end")); + List sseStrings = events.stream().map(StreamTest::mapToSse).collect(Collectors.toList()); + String input = String.join("\n" + "\n", sseStrings); + StringReader sseInput = new StringReader(input); + Stream sseStream = Stream.fromSse(Map.class, sseInput); + int expectedEvents = 2; + int actualEvents = 0; + for (Map eventData : sseStream) { + actualEvents++; + assertTrue(eventData.containsKey("event")); + } + assertEquals(expectedEvents, actualEvents); + } + + @Test + public void testSseStreamWithTerminator() { + List> events = Arrays.asList(createMap("message", "first"), createMap("message", "second")); + List sseStrings = + new ArrayList<>(events.stream().map(StreamTest::mapToSse).collect(Collectors.toList())); + sseStrings.add("data: [DONE]"); + String input = String.join("\n" + "\n", sseStrings); + StringReader sseInput = new StringReader(input); + Stream sseStream = Stream.fromSse(Map.class, sseInput, "[DONE]"); + int expectedEvents = 2; + int actualEvents = 0; + for (Map eventData : sseStream) { + actualEvents++; + assertTrue(eventData.containsKey("message")); + } + assertEquals(expectedEvents, actualEvents); + } + + @Test + public void testSseEventDiscriminatedStream() { + List sseStrings = Arrays.asList( + mapToSseWithEvent("start", createMap("status", "pending")), + mapToSseWithEvent("end", createMap("status", "complete"))); + String input = String.join("\n" + "\n", sseStrings); + StringReader sseInput = new StringReader(input); + Stream sseStream = Stream.fromSseWithEventDiscrimination(Map.class, sseInput, "event"); + int expectedEvents = 2; + int actualEvents = 0; + for (Map eventData : sseStream) { + actualEvents++; + // Event-level discrimination includes the event field in the parsed result + assertTrue(eventData.containsKey("event")); + assertTrue(eventData.containsKey("data")); + } + assertEquals(expectedEvents, actualEvents); + } + + @Test + public void testStreamResourceManagement() throws IOException { + StringReader testInput = new StringReader("{\"test\":\"data\"}"); + Stream testStream = Stream.fromJson(Map.class, testInput); + testStream.close(); + assertFalse(testStream.iterator().hasNext()); + } + + private static String mapToJson(Map map) { + try { + return ObjectMappers.JSON_MAPPER.writeValueAsString(map); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private static String mapToSse(Map map) { + return "data: " + mapToJson(map); + } + + private static String mapToSseWithEvent(String eventType, Map data) { + return "event: " + eventType + "\n" + "data: " + mapToJson(data); + } + + private static Map createMap(String key, String value) { + Map map = new HashMap<>(); + map.put(key, value); + return map; + } +} diff --git a/src/test/java/com/whop/api/TestClient.java b/src/test/java/com/whop/api/TestClient.java new file mode 100644 index 00000000..b9b9ee2d --- /dev/null +++ b/src/test/java/com/whop/api/TestClient.java @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api; + +public final class TestClient { + public void test() { + // Add tests here and mark this file in .fernignore + assert true; + } +} diff --git a/src/test/java/com/whop/api/UndiscriminatedUnionTest.java b/src/test/java/com/whop/api/UndiscriminatedUnionTest.java new file mode 100644 index 00000000..205a0b4c --- /dev/null +++ b/src/test/java/com/whop/api/UndiscriminatedUnionTest.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api; + +import static org.junit.jupiter.api.Assertions.*; + +import com.whop.api.core.ObjectMappers; +import com.whop.api.resources.memberships.types.InviteMembershipsRequestBody; +import com.whop.api.resources.memberships.types.InviteMembershipsRequestBodyEmail; +import com.whop.api.resources.memberships.types.InviteMembershipsRequestBodyUserId; +import com.whop.api.resources.payments.types.CreatePaymentsRequest; +import com.whop.api.resources.payments.types.CreatePaymentsRequestOne; +import com.whop.api.resources.payments.types.CreatePaymentsRequestThree; +import com.whop.api.resources.payments.types.CreatePaymentsRequestTwo; +import com.whop.api.resources.payments.types.CreatePaymentsRequestZero; +import com.whop.api.resources.setupintents.types.CreateSetupIntentsRequest; +import com.whop.api.resources.setupintents.types.CreateSetupIntentsRequestConfirmationToken; +import com.whop.api.resources.setupintents.types.CreateSetupIntentsRequestPaymentMethodId; +import org.junit.jupiter.api.Test; + +public final class UndiscriminatedUnionTest { + @Test + public void testInviteMembershipsRequestBody_InviteMembershipsRequestBodyUserId() throws Exception { + String json = "{\"plan_id\":\"test\",\"user_id\":\"test\"}"; + InviteMembershipsRequestBody union = + ObjectMappers.JSON_MAPPER.readValue(json, InviteMembershipsRequestBody.class); + assertTrue( + union.get() instanceof InviteMembershipsRequestBodyUserId, + "Expected InviteMembershipsRequestBodyUserId but got different variant"); + } + + @Test + public void testInviteMembershipsRequestBody_InviteMembershipsRequestBodyEmail() throws Exception { + String json = "{\"email\":\"test\",\"plan_id\":\"test\"}"; + InviteMembershipsRequestBody union = + ObjectMappers.JSON_MAPPER.readValue(json, InviteMembershipsRequestBody.class); + assertTrue( + union.get() instanceof InviteMembershipsRequestBodyEmail, + "Expected InviteMembershipsRequestBodyEmail but got different variant"); + } + + @Test + public void testCreatePaymentsRequest_CreatePaymentsRequestZero() throws Exception { + String json = "{\"company_id\":\"test\",\"confirmation_token\":\"test\",\"plan\":{}}"; + CreatePaymentsRequest union = ObjectMappers.JSON_MAPPER.readValue(json, CreatePaymentsRequest.class); + assertTrue( + union.get() instanceof CreatePaymentsRequestZero, + "Expected CreatePaymentsRequestZero but got different variant"); + } + + @Test + public void testCreatePaymentsRequest_CreatePaymentsRequestOne() throws Exception { + String json = "{\"company_id\":\"test\",\"member_id\":\"test\",\"plan\":{}}"; + CreatePaymentsRequest union = ObjectMappers.JSON_MAPPER.readValue(json, CreatePaymentsRequest.class); + assertTrue( + union.get() instanceof CreatePaymentsRequestOne, + "Expected CreatePaymentsRequestOne but got different variant"); + } + + @Test + public void testCreatePaymentsRequest_CreatePaymentsRequestTwo() throws Exception { + String json = "{\"company_id\":\"test\",\"confirmation_token\":\"test\",\"plan_id\":\"test\"}"; + CreatePaymentsRequest union = ObjectMappers.JSON_MAPPER.readValue(json, CreatePaymentsRequest.class); + assertTrue( + union.get() instanceof CreatePaymentsRequestTwo, + "Expected CreatePaymentsRequestTwo but got different variant"); + } + + @Test + public void testCreatePaymentsRequest_CreatePaymentsRequestThree() throws Exception { + String json = "{\"company_id\":\"test\",\"member_id\":\"test\",\"plan_id\":\"test\"}"; + CreatePaymentsRequest union = ObjectMappers.JSON_MAPPER.readValue(json, CreatePaymentsRequest.class); + assertTrue( + union.get() instanceof CreatePaymentsRequestThree, + "Expected CreatePaymentsRequestThree but got different variant"); + } + + @Test + public void testCreateSetupIntentsRequest_CreateSetupIntentsRequestConfirmationToken() throws Exception { + String json = "{\"company_id\":\"test\",\"confirmation_token\":\"test\"}"; + CreateSetupIntentsRequest union = ObjectMappers.JSON_MAPPER.readValue(json, CreateSetupIntentsRequest.class); + assertTrue( + union.get() instanceof CreateSetupIntentsRequestConfirmationToken, + "Expected CreateSetupIntentsRequestConfirmationToken but got different variant"); + } + + @Test + public void testCreateSetupIntentsRequest_CreateSetupIntentsRequestPaymentMethodId() throws Exception { + String json = "{\"company_id\":\"test\",\"payment_method_id\":\"test\"}"; + CreateSetupIntentsRequest union = ObjectMappers.JSON_MAPPER.readValue(json, CreateSetupIntentsRequest.class); + assertTrue( + union.get() instanceof CreateSetupIntentsRequestPaymentMethodId, + "Expected CreateSetupIntentsRequestPaymentMethodId but got different variant"); + } +} diff --git a/src/test/java/com/whop/api/core/QueryStringMapperTest.java b/src/test/java/com/whop/api/core/QueryStringMapperTest.java new file mode 100644 index 00000000..17d8e775 --- /dev/null +++ b/src/test/java/com/whop/api/core/QueryStringMapperTest.java @@ -0,0 +1,339 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.whop.api.core; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.HttpUrl; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class QueryStringMapperTest { + @Test + public void testObjectWithQuotedString_indexedArrays() { + Map map = new HashMap() { + { + put("hello", "\"world\""); + } + }; + + String expectedQueryString = "withquoted%5Bhello%5D=%22world%22"; + + String actualQueryString = queryString( + new HashMap() { + { + put("withquoted", map); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithQuotedString_arraysAsRepeats() { + Map map = new HashMap() { + { + put("hello", "\"world\""); + } + }; + + String expectedQueryString = "withquoted%5Bhello%5D=%22world%22"; + + String actualQueryString = queryString( + new HashMap() { + { + put("withquoted", map); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObject_indexedArrays() { + Map map = new HashMap() { + { + put("foo", "bar"); + put("baz", "qux"); + } + }; + + String expectedQueryString = "metadata%5Bfoo%5D=bar&metadata%5Bbaz%5D=qux"; + + String actualQueryString = queryString( + new HashMap() { + { + put("metadata", map); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObject_arraysAsRepeats() { + Map map = new HashMap() { + { + put("foo", "bar"); + put("baz", "qux"); + } + }; + + String expectedQueryString = "metadata%5Bfoo%5D=bar&metadata%5Bbaz%5D=qux"; + + String actualQueryString = queryString( + new HashMap() { + { + put("metadata", map); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testNestedObject_indexedArrays() { + Map> nestedMap = new HashMap>() { + { + put("mapkey1", new HashMap() { + { + put("mapkey1mapkey1", "mapkey1mapkey1value"); + put("mapkey1mapkey2", "mapkey1mapkey2value"); + } + }); + put("mapkey2", new HashMap() { + { + put("mapkey2mapkey1", "mapkey2mapkey1value"); + } + }); + } + }; + + String expectedQueryString = + "nested%5Bmapkey2%5D%5Bmapkey2mapkey1%5D=mapkey2mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey1" + + "%5D=mapkey1mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey2%5D=mapkey1mapkey2value"; + + String actualQueryString = queryString( + new HashMap() { + { + put("nested", nestedMap); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testNestedObject_arraysAsRepeats() { + Map> nestedMap = new HashMap>() { + { + put("mapkey1", new HashMap() { + { + put("mapkey1mapkey1", "mapkey1mapkey1value"); + put("mapkey1mapkey2", "mapkey1mapkey2value"); + } + }); + put("mapkey2", new HashMap() { + { + put("mapkey2mapkey1", "mapkey2mapkey1value"); + } + }); + } + }; + + String expectedQueryString = + "nested%5Bmapkey2%5D%5Bmapkey2mapkey1%5D=mapkey2mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey1" + + "%5D=mapkey1mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey2%5D=mapkey1mapkey2value"; + + String actualQueryString = queryString( + new HashMap() { + { + put("nested", nestedMap); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testDateTime_indexedArrays() { + OffsetDateTime dateTime = + OffsetDateTime.ofInstant(Instant.ofEpochSecond(1740412107L), ZoneId.of("America/New_York")); + + String expectedQueryString = "datetime=2025-02-24T10%3A48%3A27-05%3A00"; + + String actualQueryString = queryString( + new HashMap() { + { + put("datetime", dateTime); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testDateTime_arraysAsRepeats() { + OffsetDateTime dateTime = + OffsetDateTime.ofInstant(Instant.ofEpochSecond(1740412107L), ZoneId.of("America/New_York")); + + String expectedQueryString = "datetime=2025-02-24T10%3A48%3A27-05%3A00"; + + String actualQueryString = queryString( + new HashMap() { + { + put("datetime", dateTime); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectArray_indexedArrays() { + List> mapArray = new ArrayList>() { + { + add(new HashMap() { + { + put("key", "hello"); + put("value", "world"); + } + }); + add(new HashMap() { + { + put("key", "foo"); + put("value", "bar"); + } + }); + add(new HashMap<>()); + } + }; + + String expectedQueryString = "objects%5B0%5D%5Bvalue%5D=world&objects%5B0%5D%5Bkey%5D=hello&objects%5B1%5D" + + "%5Bvalue%5D=bar&objects%5B1%5D%5Bkey%5D=foo"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objects", mapArray); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectArray_arraysAsRepeats() { + List> mapArray = new ArrayList>() { + { + add(new HashMap() { + { + put("key", "hello"); + put("value", "world"); + } + }); + add(new HashMap() { + { + put("key", "foo"); + put("value", "bar"); + } + }); + add(new HashMap<>()); + } + }; + + String expectedQueryString = + "objects%5Bvalue%5D=world&objects%5Bkey%5D=hello&objects%5Bvalue" + "%5D=bar&objects%5Bkey%5D=foo"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objects", mapArray); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithArray_indexedArrays() { + Map objectWithArray = new HashMap() { + { + put("id", "abc123"); + put("contactIds", new ArrayList() { + { + add("id1"); + add("id2"); + add("id3"); + } + }); + } + }; + + String expectedQueryString = + "objectwitharray%5Bid%5D=abc123&objectwitharray%5BcontactIds%5D%5B0%5D=id1&objectwitharray" + + "%5BcontactIds%5D%5B1%5D=id2&objectwitharray%5BcontactIds%5D%5B2%5D=id3"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objectwitharray", objectWithArray); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithArray_arraysAsRepeats() { + Map objectWithArray = new HashMap() { + { + put("id", "abc123"); + put("contactIds", new ArrayList() { + { + add("id1"); + add("id2"); + add("id3"); + } + }); + } + }; + + String expectedQueryString = "objectwitharray%5Bid%5D=abc123&objectwitharray%5BcontactIds" + + "%5D=id1&objectwitharray%5BcontactIds%5D=id2&objectwitharray%5BcontactIds%5D=id3"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objectwitharray", objectWithArray); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + private static String queryString(Map params, boolean arraysAsRepeats) { + HttpUrl.Builder httpUrl = HttpUrl.parse("http://www.fakewebsite.com/").newBuilder(); + params.forEach((paramName, paramValue) -> + QueryStringMapper.addQueryParameter(httpUrl, paramName, paramValue, arraysAsRepeats)); + return httpUrl.build().encodedQuery(); + } +}